From: Cris Di Sclafani Date: Wed, 16 Sep 2020 14:13:53 +0000 (+0200) Subject: Built motion from commit (unavailable).|2.5.3 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22%7B%7Blicense.messaging?a=commitdiff_plain;h=c4a8d6ded7b35b09164a6b02ea7aaf845d0f8da7;p=motion2.git Built motion from commit (unavailable).|2.5.3 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 252ca54..ef3d9d7 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1 +1 @@ -define({ "name": "xCALLY Motion API", "version": "2.5.3", "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-09-16T13:43:56.154Z", "url": "http://apidocjs.com", "version": "0.19.0" } }); +define({ "name": "xCALLY Motion API", "version": "2.5.3", "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-09-16T14:06:36.451Z", "url": "http://apidocjs.com", "version": "0.19.0" } }); diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 42f3afb..43a83c8 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -1 +1 @@ -{ "name": "xCALLY Motion API", "version": "2.5.3", "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-09-16T13:43:56.154Z", "url": "http://apidocjs.com", "version": "0.19.0" } } +{ "name": "xCALLY Motion API", "version": "2.5.3", "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-09-16T14:06:36.451Z", "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 6d77541..7323557 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 _0xef52=['integration','motionbar','jscripty','browser','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)]','motionbar[NULL,NULL,WinAppArguments]','sequelize','exports','VIRTUAL','getDataValue','action','STRING','contactManager'];(function(_0x1f37bd,_0xd654f6){var _0x133a2c=function(_0x5afc09){while(--_0x5afc09){_0x1f37bd['push'](_0x1f37bd['shift']());}};_0x133a2c(++_0xd654f6);}(_0xef52,0x71));var _0x2ef5=function(_0x91384,_0x545eef){_0x91384=_0x91384-0x0;var _0x44daa0=_0xef52[_0x91384];return _0x44daa0;};'use strict';var Sequelize=require(_0x2ef5('0x0'));module[_0x2ef5('0x1')]={'name':{'type':Sequelize[_0x2ef5('0x2')],'get':function(_0x5c7220){return this[_0x2ef5('0x3')](_0x2ef5('0x4'));}},'action':{'type':Sequelize[_0x2ef5('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0x2ef5('0x6'),_0x2ef5('0x7'),_0x2ef5('0x8'),_0x2ef5('0x9'),'urlForward',_0x2ef5('0xa'),'bot',_0x2ef5('0xb')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x2ef5('0xc')},'data1':{'type':Sequelize[_0x2ef5('0x5')](0x1000),'comment':_0x2ef5('0xd')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':'integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]'},'data3':{'type':Sequelize[_0x2ef5('0x5')](0x1000),'comment':_0x2ef5('0xe')},'data4':{'type':Sequelize['STRING'](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize[_0x2ef5('0x5')]},'data7':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xed74=['contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','exports','VIRTUAL','getDataValue','STRING'];(function(_0x25e37d,_0x48304f){var _0x9db28d=function(_0x2df556){while(--_0x2df556){_0x25e37d['push'](_0x25e37d['shift']());}};_0x9db28d(++_0x48304f);}(_0xed74,0x13f));var _0x4ed7=function(_0x49431e,_0x17699a){_0x49431e=_0x49431e-0x0;var _0x759cc0=_0xed74[_0x49431e];return _0x759cc0;};'use strict';var Sequelize=require(_0x4ed7('0x0'));module[_0x4ed7('0x1')]={'name':{'type':Sequelize[_0x4ed7('0x2')],'get':function(_0x296e46){return this[_0x4ed7('0x3')]('action');}},'action':{'type':Sequelize[_0x4ed7('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x4ed7('0x5'),_0x4ed7('0x6'),_0x4ed7('0x7'),_0x4ed7('0x8'),_0x4ed7('0x9'),_0x4ed7('0xa'),_0x4ed7('0xb'),_0x4ed7('0xc')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x4ed7('0xd')},'data1':{'type':Sequelize[_0x4ed7('0x4')](0x1000),'comment':_0x4ed7('0xe')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x4ed7('0xf')},'data3':{'type':Sequelize[_0x4ed7('0x4')](0x1000),'comment':_0x4ed7('0x10')},'data4':{'type':Sequelize['STRING'](0x1000)},'data5':{'type':Sequelize[_0x4ed7('0x4')](0x1000)},'data6':{'type':Sequelize[_0x4ed7('0x4')]},'data7':{'type':Sequelize[_0x4ed7('0x11')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index c59231d..74032b6 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 _0x0bf7=['to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','then','destroy','error','stack','name','send','body','Action','find','params','catch','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox'];(function(_0x1d9934,_0x15c292){var _0x3f8856=function(_0x2db3ea){while(--_0x2db3ea){_0x1d9934['push'](_0x1d9934['shift']());}};_0x3f8856(++_0x15c292);}(_0x0bf7,0x104));var _0x70bf=function(_0x3c49fa,_0x4587d2){_0x3c49fa=_0x3c49fa-0x0;var _0x43907a=_0x0bf7[_0x3c49fa];return _0x43907a;};'use strict';var pdf=require(_0x70bf('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x70bf('0x1'));var zipdir=require(_0x70bf('0x2'));var jsonpatch=require(_0x70bf('0x3'));var rp=require(_0x70bf('0x4'));var moment=require(_0x70bf('0x5'));var BPromise=require(_0x70bf('0x6'));var Mustache=require('mustache');var util=require(_0x70bf('0x7'));var path=require(_0x70bf('0x8'));var sox=require(_0x70bf('0x9'));var csv=require(_0x70bf('0xa'));var ejs=require(_0x70bf('0xb'));var fs=require('fs');var _=require(_0x70bf('0xc'));var squel=require(_0x70bf('0xd'));var crypto=require('crypto');var jsforce=require(_0x70bf('0xe'));var deskjs=require(_0x70bf('0xf'));var toCsv=require(_0x70bf('0xa'));var querystring=require(_0x70bf('0x10'));var Papa=require(_0x70bf('0x11'));var Redis=require(_0x70bf('0x12'));var authService=require(_0x70bf('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x70bf('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x70bf('0x15'));var config=require(_0x70bf('0x16'));var db=require(_0x70bf('0x17'))['db'];function respondWithStatusCode(_0x10266d,_0x341a22){_0x341a22=_0x341a22||0xcc;return function(_0x4c2558){if(_0x4c2558){return _0x10266d[_0x70bf('0x18')](_0x341a22);}return _0x10266d[_0x70bf('0x19')](_0x341a22)[_0x70bf('0x1a')]();};}function respondWithResult(_0x81e7a6,_0xa75b14){_0xa75b14=_0xa75b14||0xc8;return function(_0x3da06d){if(_0x3da06d){return _0x81e7a6[_0x70bf('0x19')](_0xa75b14)[_0x70bf('0x1b')](_0x3da06d);}};}function respondWithFilteredResult(_0x586439,_0x19da27){return function(_0x1310c1){if(_0x1310c1){var _0x31f6a4=_0x1310c1[_0x70bf('0x1c')],_0x420789=_0x19da27['offset'],_0x58fa0d=_0x19da27[_0x70bf('0x1d')]+_0x19da27[_0x70bf('0x1e')],_0x33faf9;if(_0x58fa0d>=_0x31f6a4){_0x58fa0d=_0x31f6a4;_0x33faf9=0xc8;}else{_0x33faf9=0xce;}_0x586439[_0x70bf('0x19')](_0x33faf9);return _0x586439[_0x70bf('0x1f')]('Content-Range',_0x420789+'-'+_0x58fa0d+'/'+_0x31f6a4)[_0x70bf('0x1b')](_0x1310c1);}return null;};}function patchUpdates(_0x374da0){return function(_0x380ff8){try{jsonpatch[_0x70bf('0x20')](_0x380ff8,_0x374da0,!![]);}catch(_0x4eafc8){return BPromise[_0x70bf('0x21')](_0x4eafc8);}return _0x380ff8['save']();};}function saveUpdates(_0x13f0a8,_0x2b5ff8){return function(_0x5c1fec){if(_0x5c1fec){return _0x5c1fec['update'](_0x13f0a8)[_0x70bf('0x22')](function(_0x1ff01c){return _0x1ff01c;});}return null;};}function removeEntity(_0x182aad,_0xc887a4){return function(_0x15898f){if(_0x15898f){return _0x15898f[_0x70bf('0x23')]()['then'](function(){_0x182aad[_0x70bf('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27b056,_0xbaa834){return function(_0x4f888f){if(!_0x4f888f){_0x27b056['sendStatus'](0x194);}return _0x4f888f;};}function handleError(_0x5874fd,_0x12f9cd){_0x12f9cd=_0x12f9cd||0x1f4;return function(_0x3451f9){logger[_0x70bf('0x24')](_0x3451f9[_0x70bf('0x25')]);if(_0x3451f9[_0x70bf('0x26')]){delete _0x3451f9[_0x70bf('0x26')];}_0x5874fd['status'](_0x12f9cd)[_0x70bf('0x27')](_0x3451f9);};}exports['update']=function(_0x2eb698,_0x25d190){if(_0x2eb698[_0x70bf('0x28')]['id']){delete _0x2eb698[_0x70bf('0x28')]['id'];}return db[_0x70bf('0x29')][_0x70bf('0x2a')]({'where':{'id':_0x2eb698[_0x70bf('0x2b')]['id']}})[_0x70bf('0x22')](handleEntityNotFound(_0x25d190,null))[_0x70bf('0x22')](saveUpdates(_0x2eb698['body'],null))[_0x70bf('0x22')](respondWithResult(_0x25d190,null))[_0x70bf('0x2c')](handleError(_0x25d190,null));};exports[_0x70bf('0x23')]=function(_0x881308,_0x357df8){return db[_0x70bf('0x29')]['find']({'where':{'id':_0x881308[_0x70bf('0x2b')]['id']}})[_0x70bf('0x22')](handleEntityNotFound(_0x357df8,null))[_0x70bf('0x22')](removeEntity(_0x357df8,null))[_0x70bf('0x2c')](handleError(_0x357df8,null));}; \ No newline at end of file +var _0xf069=['eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','body','Action','find','params','catch'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0xf069,0x160));var _0x9f06=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf069[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9f06('0x0'));var rimraf=require(_0x9f06('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9f06('0x2'));var moment=require(_0x9f06('0x3'));var BPromise=require(_0x9f06('0x4'));var Mustache=require(_0x9f06('0x5'));var util=require(_0x9f06('0x6'));var path=require(_0x9f06('0x7'));var sox=require(_0x9f06('0x8'));var csv=require(_0x9f06('0x9'));var ejs=require(_0x9f06('0xa'));var fs=require('fs');var _=require(_0x9f06('0xb'));var squel=require('squel');var crypto=require(_0x9f06('0xc'));var jsforce=require(_0x9f06('0xd'));var deskjs=require(_0x9f06('0xe'));var toCsv=require(_0x9f06('0x9'));var querystring=require('querystring');var Papa=require(_0x9f06('0xf'));var Redis=require(_0x9f06('0x10'));var authService=require(_0x9f06('0x11'));var qs=require(_0x9f06('0x12'));var as=require(_0x9f06('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9f06('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x9f06('0x15'))['db'];function respondWithStatusCode(_0x1e0626,_0x7425ea){_0x7425ea=_0x7425ea||0xcc;return function(_0x19aad9){if(_0x19aad9){return _0x1e0626[_0x9f06('0x16')](_0x7425ea);}return _0x1e0626[_0x9f06('0x17')](_0x7425ea)[_0x9f06('0x18')]();};}function respondWithResult(_0xe6b1a3,_0x2de380){_0x2de380=_0x2de380||0xc8;return function(_0x4668ba){if(_0x4668ba){return _0xe6b1a3[_0x9f06('0x17')](_0x2de380)['json'](_0x4668ba);}};}function respondWithFilteredResult(_0xc01fd8,_0x130c4f){return function(_0x1b38a5){if(_0x1b38a5){var _0x51f69a=_0x1b38a5[_0x9f06('0x19')],_0xe207aa=_0x130c4f[_0x9f06('0x1a')],_0x2d10b8=_0x130c4f[_0x9f06('0x1a')]+_0x130c4f['limit'],_0x180df8;if(_0x2d10b8>=_0x51f69a){_0x2d10b8=_0x51f69a;_0x180df8=0xc8;}else{_0x180df8=0xce;}_0xc01fd8[_0x9f06('0x17')](_0x180df8);return _0xc01fd8[_0x9f06('0x1b')](_0x9f06('0x1c'),_0xe207aa+'-'+_0x2d10b8+'/'+_0x51f69a)[_0x9f06('0x1d')](_0x1b38a5);}return null;};}function patchUpdates(_0x5a133e){return function(_0x465780){try{jsonpatch[_0x9f06('0x1e')](_0x465780,_0x5a133e,!![]);}catch(_0xd4eada){return BPromise[_0x9f06('0x1f')](_0xd4eada);}return _0x465780[_0x9f06('0x20')]();};}function saveUpdates(_0x43ee1b,_0x4956a4){return function(_0x5bb351){if(_0x5bb351){return _0x5bb351[_0x9f06('0x21')](_0x43ee1b)[_0x9f06('0x22')](function(_0x49c9da){return _0x49c9da;});}return null;};}function removeEntity(_0x552b0e,_0x1a80e1){return function(_0xb17d75){if(_0xb17d75){return _0xb17d75[_0x9f06('0x23')]()[_0x9f06('0x22')](function(){_0x552b0e['status'](0xcc)[_0x9f06('0x18')]();});}};}function handleEntityNotFound(_0x514b73,_0x4fa182){return function(_0x1b0cf2){if(!_0x1b0cf2){_0x514b73[_0x9f06('0x16')](0x194);}return _0x1b0cf2;};}function handleError(_0x139a75,_0xd34361){_0xd34361=_0xd34361||0x1f4;return function(_0x80bf8a){logger[_0x9f06('0x24')](_0x80bf8a['stack']);if(_0x80bf8a[_0x9f06('0x25')]){delete _0x80bf8a[_0x9f06('0x25')];}_0x139a75[_0x9f06('0x17')](_0xd34361)[_0x9f06('0x26')](_0x80bf8a);};}exports[_0x9f06('0x21')]=function(_0x511ba6,_0x59cc4d){if(_0x511ba6[_0x9f06('0x27')]['id']){delete _0x511ba6[_0x9f06('0x27')]['id'];}return db[_0x9f06('0x28')][_0x9f06('0x29')]({'where':{'id':_0x511ba6[_0x9f06('0x2a')]['id']}})['then'](handleEntityNotFound(_0x59cc4d,null))[_0x9f06('0x22')](saveUpdates(_0x511ba6[_0x9f06('0x27')],null))[_0x9f06('0x22')](respondWithResult(_0x59cc4d,null))[_0x9f06('0x2b')](handleError(_0x59cc4d,null));};exports[_0x9f06('0x23')]=function(_0x363853,_0x9a2271){return db[_0x9f06('0x28')]['find']({'where':{'id':_0x363853[_0x9f06('0x2a')]['id']}})['then'](handleEntityNotFound(_0x9a2271,null))['then'](removeEntity(_0x9a2271,null))[_0x9f06('0x2b')](handleError(_0x9a2271,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 32383d7..6f74221 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 _0xad8b=['./action.attributes','define','tools_actions','lodash','api','bluebird','rimraf','../../config/environment'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xad8b,0x1bb));var _0xbad8=function(_0x2c61c7,_0x4f5da0){_0x2c61c7=_0x2c61c7-0x0;var _0x8ceb1=_0xad8b[_0x2c61c7];return _0x8ceb1;};'use strict';var _=require(_0xbad8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbad8('0x1'));var moment=require('moment');var BPromise=require(_0xbad8('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbad8('0x3'));var config=require(_0xbad8('0x4'));var attributes=require(_0xbad8('0x5'));module['exports']=function(_0x4b69eb,_0x5d5fdd){return _0x4b69eb[_0xbad8('0x6')]('Action',attributes,{'tableName':_0xbad8('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7425=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','define','Action','tools_actions'];(function(_0x3b5ad9,_0x223867){var _0x611ae9=function(_0x1c5e28){while(--_0x1c5e28){_0x3b5ad9['push'](_0x3b5ad9['shift']());}};_0x611ae9(++_0x223867);}(_0x7425,0x111));var _0x5742=function(_0x2e3ef6,_0x7d3c9a){_0x2e3ef6=_0x2e3ef6-0x0;var _0x4780b5=_0x7425[_0x2e3ef6];return _0x4780b5;};'use strict';var _=require(_0x5742('0x0'));var util=require('util');var logger=require(_0x5742('0x1'))(_0x5742('0x2'));var moment=require(_0x5742('0x3'));var BPromise=require(_0x5742('0x4'));var rp=require(_0x5742('0x5'));var fs=require('fs');var path=require(_0x5742('0x6'));var rimraf=require(_0x5742('0x7'));var config=require(_0x5742('0x8'));var attributes=require(_0x5742('0x9'));module['exports']=function(_0x16ec28,_0x55dbaf){return _0x16ec28[_0x5742('0xa')](_0x5742('0xb'),attributes,{'tableName':_0x5742('0xc'),'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 f231a2c..76e51da 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 _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x1e4e22,_0x567aad){var _0x5a26ea=function(_0x1f9afd){while(--_0x1f9afd){_0x1e4e22['push'](_0x1e4e22['shift']());}};_0x5a26ea(++_0x567aad);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file +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(_0x35f74b,_0x2f75c3){var _0x4f182d=function(_0x19f93f){while(--_0x19f93f){_0x35f74b['push'](_0x35f74b['shift']());}};_0x4f182d(++_0x2f75c3);}(_0xe706,0xa3));var _0x6e70=function(_0x45bf48,_0x5dd33e){_0x45bf48=_0x45bf48-0x0;var _0x5299a0=_0xe706[_0x45bf48];return _0x5299a0;};'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 diff --git a/server/api/action/index.js b/server/api/action/index.js index f5c698e..4f111cf 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 _0xf439=['update','delete','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./action.controller','/:id','isAuthenticated'];(function(_0x1fc8b6,_0x1b61d9){var _0x558f29=function(_0x222551){while(--_0x222551){_0x1fc8b6['push'](_0x1fc8b6['shift']());}};_0x558f29(++_0x1b61d9);}(_0xf439,0x1e2));var _0x9f43=function(_0x48cc5b,_0x40aae5){_0x48cc5b=_0x48cc5b-0x0;var _0x161a80=_0xf439[_0x48cc5b];return _0x161a80;};'use strict';var multer=require(_0x9f43('0x0'));var util=require(_0x9f43('0x1'));var path=require('path');var timeout=require(_0x9f43('0x2'));var express=require(_0x9f43('0x3'));var router=express[_0x9f43('0x4')]();var auth=require(_0x9f43('0x5'));var interaction=require(_0x9f43('0x6'));var config=require('../../config/environment');var controller=require(_0x9f43('0x7'));router['put'](_0x9f43('0x8'),auth[_0x9f43('0x9')](),controller[_0x9f43('0xa')]);router[_0x9f43('0xb')](_0x9f43('0x8'),auth[_0x9f43('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x640e=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','update','delete','isAuthenticated','multer','connect-timeout'];(function(_0x238625,_0x1cfbe7){var _0x1f91e5=function(_0x3814ce){while(--_0x3814ce){_0x238625['push'](_0x238625['shift']());}};_0x1f91e5(++_0x1cfbe7);}(_0x640e,0xd6));var _0xe640=function(_0x4605dc,_0x3f7ae5){_0x4605dc=_0x4605dc-0x0;var _0x5d3e81=_0x640e[_0x4605dc];return _0x5d3e81;};'use strict';var multer=require(_0xe640('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe640('0x1'));var express=require('express');var router=express[_0xe640('0x2')]();var auth=require(_0xe640('0x3'));var interaction=require(_0xe640('0x4'));var config=require(_0xe640('0x5'));var controller=require(_0xe640('0x6'));router[_0xe640('0x7')](_0xe640('0x8'),auth['isAuthenticated'](),controller[_0xe640('0x9')]);router[_0xe640('0xa')]('/:id',auth[_0xe640('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index a01ba2d..954a403 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 _0xe966=['exports','STRING','TEXT'];(function(_0x5a3bd0,_0x44f68a){var _0x4754bc=function(_0x3063a4){while(--_0x3063a4){_0x5a3bd0['push'](_0x5a3bd0['shift']());}};_0x4754bc(++_0x44f68a);}(_0xe966,0x1aa));var _0x6e96=function(_0x4f1c2b,_0x589774){_0x4f1c2b=_0x4f1c2b-0x0;var _0x417317=_0xe966[_0x4f1c2b];return _0x417317;};'use strict';var Sequelize=require('sequelize');module[_0x6e96('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x6e96('0x1')]},'parent':{'type':Sequelize[_0x6e96('0x1')]},'table':{'type':Sequelize[_0x6e96('0x1')]},'conditions':{'type':Sequelize[_0x6e96('0x2')]},'joins':{'type':Sequelize[_0x6e96('0x2')]}}; \ No newline at end of file +var _0x6a3b=['exports','STRING','sequelize'];(function(_0x35f5a5,_0x3f8a65){var _0x143dce=function(_0x5c3197){while(--_0x5c3197){_0x35f5a5['push'](_0x35f5a5['shift']());}};_0x143dce(++_0x3f8a65);}(_0x6a3b,0x125));var _0xb6a3=function(_0x57ef76,_0x312d98){_0x57ef76=_0x57ef76-0x0;var _0x4741c0=_0x6a3b[_0x57ef76];return _0x4741c0;};'use strict';var Sequelize=require(_0xb6a3('0x0'));module[_0xb6a3('0x1')]={'name':{'type':Sequelize[_0xb6a3('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb6a3('0x2')]},'parent':{'type':Sequelize[_0xb6a3('0x2')]},'table':{'type':Sequelize[_0xb6a3('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index c9d2c49..955bf94 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 _0x130d=['sendStatus','name','send','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','AnalyticCustomReport','includeAll','include','findAll','rows','catch','show','params','keys','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','foreignTable','foreignKey','parentKey','conditions','clone','Limited\x20Query:','toString','QueryTypes','SELECT','AVG(%s)','GROUP_CONCAT(%s)','HOUR(%s)','IS\x20NULL','merge','ValidationErrorItem','select','%s.%s\x20=\x20%s.%s','debug','sequelize','No\x20available\x20data','output','web','fullPath','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','COUNT(*)','run','options','runReport','cross_join','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','CustomReports','UserProfileResource','end'];(function(_0x287436,_0x2dc3ab){var _0x59190a=function(_0x36a225){while(--_0x36a225){_0x287436['push'](_0x287436['shift']());}};_0x59190a(++_0x2dc3ab);}(_0x130d,0x125));var _0xd130=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x130d[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xd130('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd130('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd130('0x2'));var rp=require(_0xd130('0x3'));var moment=require(_0xd130('0x4'));var BPromise=require(_0xd130('0x5'));var Mustache=require(_0xd130('0x6'));var util=require(_0xd130('0x7'));var path=require(_0xd130('0x8'));var sox=require(_0xd130('0x9'));var csv=require(_0xd130('0xa'));var ejs=require(_0xd130('0xb'));var fs=require('fs');var _=require(_0xd130('0xc'));var squel=require(_0xd130('0xd'));var crypto=require(_0xd130('0xe'));var jsforce=require(_0xd130('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xd130('0xa'));var querystring=require('querystring');var Papa=require(_0xd130('0x10'));var Redis=require(_0xd130('0x11'));var authService=require(_0xd130('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd130('0x13'));var hardwareService=require(_0xd130('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xd130('0x15'));var config=require('../../config/environment');var db=require(_0xd130('0x16'))['db'];var dbH=require(_0xd130('0x16'))['dbH'];function respondWithStatusCode(_0x176cbf,_0x3ec517){_0x3ec517=_0x3ec517||0xcc;return function(_0xc035a){if(_0xc035a){return _0x176cbf['sendStatus'](_0x3ec517);}return _0x176cbf['status'](_0x3ec517)['end']();};}function respondWithResult(_0x1f56b7,_0x39a129){_0x39a129=_0x39a129||0xc8;return function(_0x13e06a){if(_0x13e06a){return _0x1f56b7[_0xd130('0x17')](_0x39a129)[_0xd130('0x18')](_0x13e06a);}};}function respondWithFilteredResult(_0x573e6b,_0x1239d7){return function(_0x3a59de){if(_0x3a59de){var _0x1f96e0=_0x3a59de[_0xd130('0x19')],_0x15bcac=_0x1239d7[_0xd130('0x1a')],_0x57930b=_0x1239d7[_0xd130('0x1a')]+_0x1239d7[_0xd130('0x1b')],_0x418890;if(_0x57930b>=_0x1f96e0){_0x57930b=_0x1f96e0;_0x418890=0xc8;}else{_0x418890=0xce;}_0x573e6b[_0xd130('0x17')](_0x418890);return _0x573e6b[_0xd130('0x1c')](_0xd130('0x1d'),_0x15bcac+'-'+_0x57930b+'/'+_0x1f96e0)['json'](_0x3a59de);}return null;};}function patchUpdates(_0x543144){return function(_0x5638c3){try{jsonpatch[_0xd130('0x1e')](_0x5638c3,_0x543144,!![]);}catch(_0x1fa466){return BPromise['reject'](_0x1fa466);}return _0x5638c3[_0xd130('0x1f')]();};}function saveUpdates(_0xcf5ce,_0x3c93d3){return function(_0x1d9cc8){if(_0x1d9cc8){return _0x1d9cc8[_0xd130('0x20')](_0xcf5ce)[_0xd130('0x21')](function(_0x4e5860){return _0x4e5860;});}return null;};}function removeEntity(_0x311c3a,_0x331b1a){return function(_0xbc75fa){if(_0xbc75fa){return _0xbc75fa[_0xd130('0x22')]()[_0xd130('0x21')](function(){var _0x159a02=_0xbc75fa[_0xd130('0x23')]({'plain':!![]});var _0x316540=_0xd130('0x24');return db[_0xd130('0x25')]['destroy']({'where':{'type':_0x316540,'resourceId':_0x159a02['id']}})[_0xd130('0x21')](function(){return _0xbc75fa;});})[_0xd130('0x21')](function(){_0x311c3a[_0xd130('0x17')](0xcc)[_0xd130('0x26')]();});}};}function handleEntityNotFound(_0x26dd6a,_0xf79e5c){return function(_0x51c187){if(!_0x51c187){_0x26dd6a[_0xd130('0x27')](0x194);}return _0x51c187;};}function handleError(_0x4eef42,_0x149e5a){_0x149e5a=_0x149e5a||0x1f4;return function(_0x4e2cb4){logger['error'](_0x4e2cb4['stack']);if(_0x4e2cb4[_0xd130('0x28')]){delete _0x4e2cb4[_0xd130('0x28')];}_0x4eef42[_0xd130('0x17')](_0x149e5a)[_0xd130('0x29')](_0x4e2cb4);};}exports['index']=function(_0x1d8d1c,_0x154eb6){var _0x28127d={},_0x562aef={},_0x84ae4b={'count':0x0,'rows':[]};var _0x4fee50=_[_0xd130('0x2a')](db['AnalyticCustomReport'][_0xd130('0x2b')],function(_0x19c180){return{'name':_0x19c180[_0xd130('0x2c')],'type':_0x19c180['type'][_0xd130('0x2d')]};});_0x562aef[_0xd130('0x2e')]=_[_0xd130('0x2a')](_0x4fee50,_0xd130('0x28'));_0x562aef[_0xd130('0x2f')]=_['keys'](_0x1d8d1c[_0xd130('0x2f')]);_0x562aef[_0xd130('0x30')]=_[_0xd130('0x31')](_0x562aef['model'],_0x562aef[_0xd130('0x2f')]);_0x28127d[_0xd130('0x32')]=_['intersection'](_0x562aef[_0xd130('0x2e')],qs[_0xd130('0x33')](_0x1d8d1c['query'][_0xd130('0x33')]));_0x28127d[_0xd130('0x32')]=_0x28127d[_0xd130('0x32')][_0xd130('0x34')]?_0x28127d[_0xd130('0x32')]:_0x562aef[_0xd130('0x2e')];if(!_0x1d8d1c['query'][_0xd130('0x35')](_0xd130('0x36'))){_0x28127d[_0xd130('0x1b')]=qs[_0xd130('0x1b')](_0x1d8d1c[_0xd130('0x2f')][_0xd130('0x1b')]);_0x28127d[_0xd130('0x1a')]=qs[_0xd130('0x1a')](_0x1d8d1c[_0xd130('0x2f')]['offset']);}_0x28127d[_0xd130('0x37')]=qs[_0xd130('0x38')](_0x1d8d1c['query'][_0xd130('0x38')]);_0x28127d[_0xd130('0x39')]=qs[_0xd130('0x30')](_[_0xd130('0x3a')](_0x1d8d1c[_0xd130('0x2f')],_0x562aef['filters']),_0x4fee50);if(_0x1d8d1c[_0xd130('0x2f')][_0xd130('0x3b')]){_0x28127d[_0xd130('0x39')]=_['merge'](_0x28127d[_0xd130('0x39')],{'$or':_[_0xd130('0x2a')](_0x4fee50,function(_0x52e3b3){if(_0x52e3b3[_0xd130('0x3c')]!==_0xd130('0x3d')){var _0x2dbbd6={};_0x2dbbd6[_0x52e3b3[_0xd130('0x28')]]={'$like':'%'+_0x1d8d1c[_0xd130('0x2f')][_0xd130('0x3b')]+'%'};return _0x2dbbd6;}})});}_0x28127d=_['merge']({},_0x28127d,_0x1d8d1c['options']);var _0xae03e={'where':_0x28127d[_0xd130('0x39')]};return db[_0xd130('0x3e')]['count'](_0xae03e)['then'](function(_0x4d446a){_0x84ae4b['count']=_0x4d446a;if(_0x1d8d1c[_0xd130('0x2f')][_0xd130('0x3f')]){_0x28127d[_0xd130('0x40')]=[{'all':!![]}];}return db[_0xd130('0x3e')][_0xd130('0x41')](_0x28127d);})['then'](function(_0x36856b){_0x84ae4b[_0xd130('0x42')]=_0x36856b;return _0x84ae4b;})[_0xd130('0x21')](respondWithFilteredResult(_0x154eb6,_0x28127d))[_0xd130('0x43')](handleError(_0x154eb6,null));};exports[_0xd130('0x44')]=function(_0x10154a,_0x10bbd6){var _0x3d88dd={'raw':![],'where':{'id':_0x10154a[_0xd130('0x45')]['id']}},_0x4f8d4f={};_0x4f8d4f[_0xd130('0x2e')]=_['keys'](db[_0xd130('0x3e')]['rawAttributes']);_0x4f8d4f[_0xd130('0x2f')]=_[_0xd130('0x46')](_0x10154a['query']);_0x4f8d4f[_0xd130('0x30')]=_['intersection'](_0x4f8d4f[_0xd130('0x2e')],_0x4f8d4f[_0xd130('0x2f')]);_0x3d88dd[_0xd130('0x32')]=_[_0xd130('0x31')](_0x4f8d4f[_0xd130('0x2e')],qs[_0xd130('0x33')](_0x10154a[_0xd130('0x2f')][_0xd130('0x33')]));_0x3d88dd[_0xd130('0x32')]=_0x3d88dd[_0xd130('0x32')][_0xd130('0x34')]?_0x3d88dd[_0xd130('0x32')]:_0x4f8d4f[_0xd130('0x2e')];if(_0x10154a[_0xd130('0x2f')]['includeAll']){_0x3d88dd['include']=[{'all':!![]}];}_0x3d88dd=_['merge']({},_0x3d88dd,_0x10154a['options']);return db['AnalyticCustomReport']['find'](_0x3d88dd)['then'](handleEntityNotFound(_0x10bbd6,null))[_0xd130('0x21')](respondWithResult(_0x10bbd6,null))['catch'](handleError(_0x10bbd6,null));};exports['create']=function(_0x1ac59c,_0x5c0e12){return db['AnalyticCustomReport'][_0xd130('0x47')](_0x1ac59c[_0xd130('0x48')],{})[_0xd130('0x21')](function(_0x4e3bfa){var _0x7a23a9=_0x1ac59c[_0xd130('0x49')][_0xd130('0x23')]({'plain':!![]});if(!_0x7a23a9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x7a23a9[_0xd130('0x4a')]==='user'){var _0x4622f2=_0x4e3bfa[_0xd130('0x23')]({'plain':!![]});var _0x554f62='Reports';return db[_0xd130('0x4b')][_0xd130('0x4c')]({'where':{'name':_0x554f62,'userProfileId':_0x7a23a9[_0xd130('0x4d')]},'raw':!![]})[_0xd130('0x21')](function(_0x54f406){if(_0x54f406&&_0x54f406[_0xd130('0x4e')]===0x0){return db[_0xd130('0x25')][_0xd130('0x47')]({'name':_0x4622f2['name'],'resourceId':_0x4622f2['id'],'type':_0xd130('0x24'),'sectionId':_0x54f406['id']},{})[_0xd130('0x21')](function(){return _0x4e3bfa;});}else{return _0x4e3bfa;}})[_0xd130('0x43')](function(_0x5ba415){logger[_0xd130('0x4f')](_0xd130('0x50'),_0x5ba415);throw _0x5ba415;});}return _0x4e3bfa;})[_0xd130('0x21')](respondWithResult(_0x5c0e12,0xc9))['catch'](handleError(_0x5c0e12,null));};exports[_0xd130('0x20')]=function(_0x395ffd,_0x4e7187){if(_0x395ffd['body']['id']){delete _0x395ffd[_0xd130('0x48')]['id'];}return db[_0xd130('0x3e')][_0xd130('0x4c')]({'where':{'id':_0x395ffd[_0xd130('0x45')]['id']}})[_0xd130('0x21')](handleEntityNotFound(_0x4e7187,null))[_0xd130('0x21')](saveUpdates(_0x395ffd[_0xd130('0x48')],null))['then'](respondWithResult(_0x4e7187,null))[_0xd130('0x43')](handleError(_0x4e7187,null));};exports['destroy']=function(_0x19de3e,_0x1c3f82){return db[_0xd130('0x3e')]['find']({'where':{'id':_0x19de3e[_0xd130('0x45')]['id']}})[_0xd130('0x21')](handleEntityNotFound(_0x1c3f82,null))[_0xd130('0x21')](removeEntity(_0x1c3f82,null))[_0xd130('0x43')](handleError(_0x1c3f82,null));};exports['preview']=function(_0x46bfb6,_0x94554e){var _0x20f135=0xa;var _0x176f4a=[_0xd130('0x51'),_0xd130('0x52'),_0xd130('0x53'),'cross_join'];var _0x35ecec={'SUM':_0xd130('0x54'),'COUNT':_0xd130('0x55'),'COUNT DISTINCT':_0xd130('0x56'),'MAX':_0xd130('0x57'),'MIN':_0xd130('0x58'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xd130('0x59'),'GROUP_CONCAT DESC':_0xd130('0x5a')};var _0x4f122e={'SEC_TO_TIME':_0xd130('0x5b'),'DATE':_0xd130('0x5c'),'HOUR':'HOUR(%s)','ROUND':_0xd130('0x5d'),'UNIX_TIMESTAMP':_0xd130('0x5e')};var _0x30edda=function(_0x3d563a){return!_[_0xd130('0x5f')](['IS\x20NULL',_0xd130('0x60'),_0xd130('0x61'),_0xd130('0x62')],_0x3d563a);};var _0x4c4fb=function(_0x57a594){if(!_0x57a594||!_0x57a594[_0xd130('0x63')][_0xd130('0x34')]){return'';}for(var _0x3711b0='(',_0x291f40=0x0;_0x291f40<_0x57a594[_0xd130('0x63')][_0xd130('0x34')];_0x291f40+=0x1){_0x291f40>0x0&&(_0x3711b0+='\x20'+_0x57a594[_0xd130('0x64')]+'\x20');_0x3711b0+=_0x57a594[_0xd130('0x63')][_0x291f40]['group']?_0x4c4fb(_0x57a594[_0xd130('0x63')][_0x291f40][_0xd130('0x65')]):_0x57a594[_0xd130('0x63')][_0x291f40][_0xd130('0x66')]+'\x20'+_0x57a594[_0xd130('0x63')][_0x291f40][_0xd130('0x67')]+(_0x30edda(_0x57a594[_0xd130('0x63')][_0x291f40][_0xd130('0x67')])?'\x20'+_0x57a594[_0xd130('0x63')][_0x291f40][_0xd130('0x68')]:'');}return _0x3711b0+')';};var _0xffdc9d={'where':{'id':_0x46bfb6[_0xd130('0x45')]['id']}},_0x289dde,_0x2f68b1,_0x19a1d5,_0x236d1c,_0x2244b2;_0xffdc9d=_['merge']({},_0xffdc9d,_0x46bfb6['options']);return db[_0xd130('0x3e')]['find'](_0xffdc9d)[_0xd130('0x21')](function(_0x3db45c){if(_0x3db45c){_0x289dde=_0x3db45c;return _0x3db45c[_0xd130('0x69')]();}return null;})['then'](function(_0x56b3ba){if(_0x56b3ba){if(!_0x56b3ba['length']){throw new db[(_0xd130('0x6a'))]['ValidationErrorItem'](_0xd130('0x6b'),0x193);}_0x2f68b1=_0x56b3ba;return db[_0xd130('0x6c')][_0xd130('0x41')]({'raw':!![]});}return null;})[_0xd130('0x21')](function(_0x2655b8){if(_0x2655b8){_0x19a1d5=_[_0xd130('0x6d')](_0x2655b8,'id');var _0x3b5d95;var _0x7f2d1f=squel['select']();_0x7f2d1f[_0xd130('0x6e')](_0x289dde[_0xd130('0x6f')]);for(var _0x5e7be3=0x0;_0x5e7be3<_0x2f68b1[_0xd130('0x34')];_0x5e7be3+=0x1){_0x3b5d95=_0x2f68b1[_0x5e7be3][_0xd130('0x70')]?_0x19a1d5[_0x2f68b1[_0x5e7be3][_0xd130('0x70')]][_0xd130('0x71')]:_0x2f68b1[_0x5e7be3][_0xd130('0x66')];_0x3b5d95=_0x2f68b1[_0x5e7be3][_0xd130('0x72')]?_[_0xd130('0x73')](_0x35ecec[_0x2f68b1[_0x5e7be3]['function']],'%s',_0x3b5d95):_0x3b5d95;_0x3b5d95=_0x2f68b1[_0x5e7be3][_0xd130('0x74')]?_['replace'](_0x4f122e[_0x2f68b1[_0x5e7be3][_0xd130('0x74')]],'%s',_0x3b5d95):_0x3b5d95;if(_0x2f68b1[_0x5e7be3][_0xd130('0x75')]){_0x7f2d1f[_0xd130('0x65')](_0x3b5d95);}_0x2f68b1[_0x5e7be3][_0xd130('0x76')]&&_0x7f2d1f[_0xd130('0x37')](_0x3b5d95,_0x2f68b1[_0x5e7be3][_0xd130('0x76')]===_0xd130('0x77')?![]:!![]);_0x7f2d1f['field'](_0x3b5d95,_0x2f68b1[_0x5e7be3][_0xd130('0x78')]||_0x3b5d95);}if(_0x289dde[_0xd130('0x79')]){_0x289dde[_0xd130('0x79')]=JSON[_0xd130('0x7a')](_0x289dde[_0xd130('0x79')]);for(var _0x139e1d=0x0;_0x139e1d<_0x289dde[_0xd130('0x79')][_0xd130('0x34')];_0x139e1d+=0x1){if(_0x289dde['joins'][_0x139e1d][_0xd130('0x3c')]&&_['includes'](_0x176f4a,_0x289dde[_0xd130('0x79')][_0x139e1d][_0xd130('0x3c')])&&_0x289dde[_0xd130('0x79')][_0x139e1d]['parentKey']&&_0x289dde[_0xd130('0x79')][_0x139e1d][_0xd130('0x7b')]&&_0x289dde['joins'][_0x139e1d][_0xd130('0x7c')]){_0x7f2d1f[_0x289dde[_0xd130('0x79')][_0x139e1d][_0xd130('0x3c')]](_0x289dde[_0xd130('0x79')][_0x139e1d][_0xd130('0x7b')],null,util[_0xd130('0x74')]('%s.%s\x20=\x20%s.%s',_0x289dde[_0xd130('0x6f')],_0x289dde[_0xd130('0x79')][_0x139e1d][_0xd130('0x7d')],_0x289dde[_0xd130('0x79')][_0x139e1d][_0xd130('0x7b')],_0x289dde[_0xd130('0x79')][_0x139e1d][_0xd130('0x7c')]));}}}if(_0x289dde['conditions']){_0x289dde[_0xd130('0x7e')]=JSON[_0xd130('0x7a')](_0x289dde[_0xd130('0x7e')]);_0x7f2d1f[_0xd130('0x39')](_0x4c4fb(_0x289dde[_0xd130('0x7e')][_0xd130('0x65')]));}_0x2244b2=_0x7f2d1f[_0xd130('0x7f')]();_0x7f2d1f['limit'](_0x20f135);_0x7f2d1f[_0xd130('0x1a')](0x0);logger['debug'](_0xd130('0x80'),_0x7f2d1f[_0xd130('0x81')]());return db['sequelize'][_0xd130('0x2f')](_0x7f2d1f[_0xd130('0x81')](),{'type':db['sequelize'][_0xd130('0x82')][_0xd130('0x83')]});}})[_0xd130('0x21')](respondWithResult(_0x94554e,null))[_0xd130('0x43')](handleError(_0x94554e,null));};function runReport(_0xf6eab9,_0x923946,_0x24ad53){var _0x2e69e0=_0x923946[_0xd130('0x28')];var _0xf872f6=0xa;var _0x24877b=[_0xd130('0x51'),_0xd130('0x52'),'right_join','cross_join'];var _0x329196={'SUM':_0xd130('0x54'),'COUNT':_0xd130('0x55'),'COUNT DISTINCT':_0xd130('0x56'),'MAX':'MAX(%s)','MIN':_0xd130('0x58'),'AVG':_0xd130('0x84'),'GROUP_CONCAT':_0xd130('0x85'),'GROUP_CONCAT ASC':_0xd130('0x59'),'GROUP_CONCAT DESC':_0xd130('0x5a')};var _0x3c2f5e={'SEC_TO_TIME':_0xd130('0x5b'),'DATE':_0xd130('0x5c'),'HOUR':_0xd130('0x86'),'ROUND':_0xd130('0x5d'),'UNIX_TIMESTAMP':_0xd130('0x5e')};var _0x40d778=function(_0x2ddcfa){return!_[_0xd130('0x5f')]([_0xd130('0x87'),_0xd130('0x60'),_0xd130('0x61'),_0xd130('0x62')],_0x2ddcfa);};var _0x22959b=function(_0x513c3f){if(!_0x513c3f||!_0x513c3f[_0xd130('0x63')]['length']){return'';}for(var _0x5fb166='(',_0x5729c=0x0;_0x5729c<_0x513c3f[_0xd130('0x63')][_0xd130('0x34')];_0x5729c+=0x1){_0x5729c>0x0&&(_0x5fb166+='\x20'+_0x513c3f[_0xd130('0x64')]+'\x20');_0x5fb166+=_0x513c3f[_0xd130('0x63')][_0x5729c][_0xd130('0x65')]?_0x22959b(_0x513c3f[_0xd130('0x63')][_0x5729c][_0xd130('0x65')]):_0x513c3f[_0xd130('0x63')][_0x5729c][_0xd130('0x66')]+'\x20'+_0x513c3f[_0xd130('0x63')][_0x5729c][_0xd130('0x67')]+(_0x40d778(_0x513c3f[_0xd130('0x63')][_0x5729c]['condition'])?'\x20'+_0x513c3f[_0xd130('0x63')][_0x5729c][_0xd130('0x68')]:'');}return _0x5fb166+')';};var _0x3df558={'where':{'id':_0xf6eab9['id']}},_0x143f0c,_0x262114,_0x212d8e,_0x29d8dc,_0x8fb916;_0x3df558=_[_0xd130('0x88')]({},_0x3df558,_0x24ad53);return db[_0xd130('0x3e')][_0xd130('0x4c')](_0x3df558)['then'](function(_0x275ce8){if(_0x275ce8){_0x143f0c=_0x275ce8;return _0x275ce8[_0xd130('0x69')]();}return null;})[_0xd130('0x21')](function(_0x2a97bd){if(_0x2a97bd){if(!_0x2a97bd[_0xd130('0x34')]){throw new db['Sequelize'][(_0xd130('0x89'))](_0xd130('0x6b'),0x193);}_0x262114=_0x2a97bd;return db[_0xd130('0x6c')][_0xd130('0x41')]({'raw':!![]});}return null;})[_0xd130('0x21')](function(_0x705f25){if(_0x705f25){_0x212d8e=_['keyBy'](_0x705f25,'id');var _0x5d3d13;var _0x14e718=squel[_0xd130('0x8a')]();_0x14e718[_0xd130('0x6e')](_0x143f0c[_0xd130('0x6f')]);for(var _0x33cb7a=0x0;_0x33cb7a<_0x262114['length'];_0x33cb7a+=0x1){_0x5d3d13=_0x262114[_0x33cb7a]['MetricId']?_0x212d8e[_0x262114[_0x33cb7a][_0xd130('0x70')]][_0xd130('0x71')]:_0x262114[_0x33cb7a][_0xd130('0x66')];_0x5d3d13=_0x262114[_0x33cb7a][_0xd130('0x72')]?_[_0xd130('0x73')](_0x329196[_0x262114[_0x33cb7a][_0xd130('0x72')]],'%s',_0x5d3d13):_0x5d3d13;_0x5d3d13=_0x262114[_0x33cb7a][_0xd130('0x74')]?_[_0xd130('0x73')](_0x3c2f5e[_0x262114[_0x33cb7a][_0xd130('0x74')]],'%s',_0x5d3d13):_0x5d3d13;if(_0x262114[_0x33cb7a]['groupBy']){_0x14e718[_0xd130('0x65')](_0x5d3d13);}_0x262114[_0x33cb7a][_0xd130('0x76')]&&_0x14e718[_0xd130('0x37')](_0x5d3d13,_0x262114[_0x33cb7a]['orderBy']===_0xd130('0x77')?![]:!![]);_0x14e718[_0xd130('0x66')](_0x5d3d13,_0x262114[_0x33cb7a][_0xd130('0x78')]||_0x5d3d13);}if(_0x143f0c['joins']){_0x143f0c[_0xd130('0x79')]=JSON[_0xd130('0x7a')](_0x143f0c['joins']);for(var _0x578c05=0x0;_0x578c05<_0x143f0c['joins'][_0xd130('0x34')];_0x578c05+=0x1){if(_0x143f0c['joins'][_0x578c05][_0xd130('0x3c')]&&_[_0xd130('0x5f')](_0x24877b,_0x143f0c['joins'][_0x578c05][_0xd130('0x3c')])&&_0x143f0c[_0xd130('0x79')][_0x578c05][_0xd130('0x7d')]&&_0x143f0c[_0xd130('0x79')][_0x578c05]['foreignTable']&&_0x143f0c[_0xd130('0x79')][_0x578c05][_0xd130('0x7c')]){_0x14e718[_0x143f0c[_0xd130('0x79')][_0x578c05][_0xd130('0x3c')]](_0x143f0c[_0xd130('0x79')][_0x578c05]['foreignTable'],null,util[_0xd130('0x74')](_0xd130('0x8b'),_0x143f0c['table'],_0x143f0c['joins'][_0x578c05]['parentKey'],_0x143f0c[_0xd130('0x79')][_0x578c05]['foreignTable'],_0x143f0c[_0xd130('0x79')][_0x578c05]['foreignKey']));}}}if(_0x143f0c[_0xd130('0x7e')]){_0x143f0c[_0xd130('0x7e')]=JSON[_0xd130('0x7a')](_0x143f0c[_0xd130('0x7e')]);_0x14e718[_0xd130('0x39')](_0x22959b(_0x143f0c['conditions'][_0xd130('0x65')]));}_0x8fb916=_0x14e718[_0xd130('0x7f')]();_0x14e718[_0xd130('0x1b')](_0xf872f6);_0x14e718[_0xd130('0x1a')](0x0);logger[_0xd130('0x8c')]('Limited\x20Query:',_0x14e718[_0xd130('0x81')]());return db[_0xd130('0x8d')][_0xd130('0x2f')](_0x14e718[_0xd130('0x81')](),{'type':db['sequelize'][_0xd130('0x82')][_0xd130('0x83')]});}})['then'](function(_0x2f2852){if(!_0x2f2852[_0xd130('0x34')]){throw new db[(_0xd130('0x6a'))][(_0xd130('0x89'))](_0xd130('0x8e'),0xcc);}if(_0x923946[_0xd130('0x8f')]===_0xd130('0x90')){return null;}var _0x24f6dc=_[_0xd130('0x88')](_0x923946,{'name':_0x923946[_0xd130('0x91')]||_0x923946['name']||_0x143f0c[_0xd130('0x28')],'basename':_0x2e69e0,'savename':util[_0xd130('0x74')]('%s-%s.%s',_0x923946['name']||_0x143f0c[_0xd130('0x28')],require(_0xd130('0x92'))[_0xd130('0x93')](0x4),_0x923946['output']||_0xd130('0x94')),'reportId':_0x143f0c['id'],'reportType':_0xd130('0x95')});return db[_0xd130('0x96')][_0xd130('0x47')](_0x24f6dc,{'raw':!![]});})['then'](function(_0x5f2d66){if(_0x143f0c[_0xd130('0x6f')]===_0xd130('0x97')){_0x8fb916['where'](_0x143f0c[_0xd130('0x6f')]+_0xd130('0x98'),_0x923946[_0xd130('0x99')],_0x923946[_0xd130('0x9a')]);}else{_0x8fb916[_0xd130('0x39')](_0x143f0c[_0xd130('0x6f')]+_0xd130('0x9b'),_0x923946[_0xd130('0x99')],_0x923946[_0xd130('0x9a')]);}if(_0x5f2d66){logger['info'](_0xd130('0x9c'),_0x8fb916[_0xd130('0x81')]());require(_0xd130('0x9d'))['fork'](path[_0xd130('0x51')](__dirname,_0xd130('0x9e'),_0x5f2d66[_0xd130('0x8f')]),[_0x5f2d66['id'],_0x8fb916[_0xd130('0x81')](),path[_0xd130('0x51')](__dirname,_0xd130('0x9f'),_0x5f2d66[_0xd130('0xa0')]),_0x2e69e0]);return _0x5f2d66;}else{var _0x4fd511=squel[_0xd130('0x8a')]();_0x4fd511[_0xd130('0x6e')]('('+_0x8fb916['toString']()+')','countTable');_0x4fd511[_0xd130('0x66')](_0xd130('0xa1'),_0xd130('0x19'));_0x8fb916['limit'](_0x923946['limit']||_0xf872f6);_0x8fb916[_0xd130('0x1a')](_0x923946[_0xd130('0x1a')]||0x0);return dbH[_0xd130('0x8d')]['query'](_0x4fd511[_0xd130('0x81')](),{'type':dbH['sequelize'][_0xd130('0x82')]['SELECT']})['then'](function(_0x70adb0){if(!_0x70adb0['length']){_0x29d8dc=0x0;}else{_0x29d8dc=_0x70adb0[0x0][_0xd130('0x19')]||0x0;}return dbH['sequelize']['query'](_0x8fb916[_0xd130('0x81')](),{'type':dbH[_0xd130('0x8d')][_0xd130('0x82')]['SELECT']});})['then'](function(_0x1a06a7){return{'rows':_0x1a06a7||[],'count':_0x29d8dc};});}});}exports[_0xd130('0xa2')]=function(_0x5a33a0,_0x5962a4){return runReport(_0x5a33a0[_0xd130('0x45')],_0x5a33a0['query'],_0x5a33a0[_0xd130('0xa3')])['then'](respondWithResult(_0x5962a4,null))['catch'](handleError(_0x5962a4,null));};exports[_0xd130('0xa4')]=runReport;exports[_0xd130('0x2f')]=function(_0x18f4d2,_0x159c95){var _0x5699f3=0xa;var _0x228124=[_0xd130('0x51'),'left_join',_0xd130('0x53'),_0xd130('0xa5')];var _0x2aea92={'SUM':_0xd130('0x54'),'COUNT':_0xd130('0x55'),'COUNT DISTINCT':_0xd130('0x56'),'MAX':_0xd130('0x57'),'MIN':_0xd130('0x58'),'AVG':_0xd130('0x84'),'GROUP_CONCAT':_0xd130('0x85'),'GROUP_CONCAT ASC':_0xd130('0x59'),'GROUP_CONCAT DESC':_0xd130('0x5a')};var _0x345280={'SEC_TO_TIME':_0xd130('0x5b'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xd130('0x5d'),'UNIX_TIMESTAMP':_0xd130('0x5e')};var _0x10d279=function(_0x59c917){return!_[_0xd130('0x5f')]([_0xd130('0x87'),_0xd130('0x60'),_0xd130('0x61'),_0xd130('0x62')],_0x59c917);};var _0x2ee05a=function(_0x10f70b){if(!_0x10f70b||!_0x10f70b[_0xd130('0x63')][_0xd130('0x34')]){return'';}for(var _0x43cd4a='(',_0x5904bd=0x0;_0x5904bd<_0x10f70b['rules'][_0xd130('0x34')];_0x5904bd+=0x1){_0x5904bd>0x0&&(_0x43cd4a+='\x20'+_0x10f70b[_0xd130('0x64')]+'\x20');_0x43cd4a+=_0x10f70b['rules'][_0x5904bd][_0xd130('0x65')]?_0x2ee05a(_0x10f70b[_0xd130('0x63')][_0x5904bd]['group']):_0x10f70b['rules'][_0x5904bd][_0xd130('0x66')]+'\x20'+_0x10f70b[_0xd130('0x63')][_0x5904bd][_0xd130('0x67')]+(_0x10d279(_0x10f70b[_0xd130('0x63')][_0x5904bd][_0xd130('0x67')])?'\x20'+_0x10f70b['rules'][_0x5904bd]['value']:'');}return _0x43cd4a+')';};var _0x41d4df={'where':{'id':_0x18f4d2[_0xd130('0x45')]['id']}},_0x4856ce,_0x1b9130,_0x26e27e,_0x472ff2,_0x41fc9d;_0x41d4df=_[_0xd130('0x88')]({},_0x41d4df,_0x18f4d2[_0xd130('0xa3')]);return db[_0xd130('0x3e')]['find'](_0x41d4df)[_0xd130('0x21')](function(_0x805cd1){if(_0x805cd1){_0x4856ce=_0x805cd1;return _0x805cd1[_0xd130('0x69')]();}return null;})[_0xd130('0x21')](function(_0x49a359){if(_0x49a359){if(!_0x49a359[_0xd130('0x34')]){throw new db[(_0xd130('0x6a'))][(_0xd130('0x89'))](_0xd130('0x6b'),0x193);}_0x1b9130=_0x49a359;return db[_0xd130('0x6c')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x4682ac){if(_0x4682ac){_0x26e27e=_[_0xd130('0x6d')](_0x4682ac,'id');var _0x23764b;var _0x347431=squel[_0xd130('0x8a')]();_0x347431[_0xd130('0x6e')](_0x4856ce[_0xd130('0x6f')]);for(var _0x333fc7=0x0;_0x333fc7<_0x1b9130[_0xd130('0x34')];_0x333fc7+=0x1){_0x23764b=_0x1b9130[_0x333fc7]['MetricId']?_0x26e27e[_0x1b9130[_0x333fc7][_0xd130('0x70')]][_0xd130('0x71')]:_0x1b9130[_0x333fc7][_0xd130('0x66')];_0x23764b=_0x1b9130[_0x333fc7][_0xd130('0x72')]?_[_0xd130('0x73')](_0x2aea92[_0x1b9130[_0x333fc7]['function']],'%s',_0x23764b):_0x23764b;_0x23764b=_0x1b9130[_0x333fc7][_0xd130('0x74')]?_['replace'](_0x345280[_0x1b9130[_0x333fc7][_0xd130('0x74')]],'%s',_0x23764b):_0x23764b;if(_0x1b9130[_0x333fc7]['groupBy']){_0x347431[_0xd130('0x65')](_0x23764b);}_0x1b9130[_0x333fc7][_0xd130('0x76')]&&_0x347431[_0xd130('0x37')](_0x23764b,_0x1b9130[_0x333fc7]['orderBy']==='DESC'?![]:!![]);_0x347431[_0xd130('0x66')](_0x23764b,_0x1b9130[_0x333fc7]['alias']||_0x23764b);}if(_0x4856ce[_0xd130('0x79')]){_0x4856ce[_0xd130('0x79')]=JSON[_0xd130('0x7a')](_0x4856ce[_0xd130('0x79')]);for(var _0x283b21=0x0;_0x283b21<_0x4856ce[_0xd130('0x79')][_0xd130('0x34')];_0x283b21+=0x1){if(_0x4856ce[_0xd130('0x79')][_0x283b21]['type']&&_[_0xd130('0x5f')](_0x228124,_0x4856ce[_0xd130('0x79')][_0x283b21][_0xd130('0x3c')])&&_0x4856ce[_0xd130('0x79')][_0x283b21][_0xd130('0x7d')]&&_0x4856ce[_0xd130('0x79')][_0x283b21]['foreignTable']&&_0x4856ce[_0xd130('0x79')][_0x283b21]['foreignKey']){_0x347431[_0x4856ce['joins'][_0x283b21][_0xd130('0x3c')]](_0x4856ce[_0xd130('0x79')][_0x283b21][_0xd130('0x7b')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x4856ce[_0xd130('0x6f')],_0x4856ce[_0xd130('0x79')][_0x283b21][_0xd130('0x7d')],_0x4856ce[_0xd130('0x79')][_0x283b21]['foreignTable'],_0x4856ce[_0xd130('0x79')][_0x283b21][_0xd130('0x7c')]));}}}if(_0x4856ce[_0xd130('0x7e')]){_0x4856ce[_0xd130('0x7e')]=JSON[_0xd130('0x7a')](_0x4856ce[_0xd130('0x7e')]);_0x347431['where'](_0x2ee05a(_0x4856ce[_0xd130('0x7e')][_0xd130('0x65')]));}_0x41fc9d=_0x347431[_0xd130('0x7f')]();_0x347431[_0xd130('0x1b')](_0x5699f3);_0x347431['offset'](0x0);logger['debug'](_0xd130('0x80'),_0x347431[_0xd130('0x81')]());return db[_0xd130('0x8d')]['query'](_0x347431[_0xd130('0x81')](),{'type':db['sequelize']['QueryTypes'][_0xd130('0x83')]});}})[_0xd130('0x21')](function(){return{'sql':_0x41fc9d[_0xd130('0x81')]()};})['then'](respondWithResult(_0x159c95,null))[_0xd130('0x43')](handleError(_0x159c95,null));}; \ No newline at end of file +var _0xaf9b=['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','dbH','status','end','count','offset','limit','set','json','reject','save','update','destroy','then','CustomReports','sendStatus','error','stack','name','index','map','AnalyticCustomReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','merge','include','findAll','catch','show','params','length','includeAll','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','options','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','metric','field','function','replace','groupBy','orderBy','alias','joins','parse','type','parentKey','foreignTable','foreignKey','format','%s.%s\x20=\x20%s.%s','conditions','clone','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','cross_join','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20EMPTY','Sequelize','DESC','debug','No\x20available\x20data','output','fullPath','%s-%s.%s','randomstring','generate','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','child_process','fork','../../components/export/','savename','from','countTable','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','jsforce'];(function(_0x339269,_0x515db7){var _0x2c13ea=function(_0x4bb7e9){while(--_0x4bb7e9){_0x339269['push'](_0x339269['shift']());}};_0x2c13ea(++_0x515db7);}(_0xaf9b,0x1d7));var _0xbaf9=function(_0x111f93,_0x19b71f){_0x111f93=_0x111f93-0x0;var _0x4220bb=_0xaf9b[_0x111f93];return _0x4220bb;};'use strict';var pdf=require(_0xbaf9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbaf9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbaf9('0x2'));var rp=require(_0xbaf9('0x3'));var moment=require(_0xbaf9('0x4'));var BPromise=require(_0xbaf9('0x5'));var Mustache=require('mustache');var util=require(_0xbaf9('0x6'));var path=require(_0xbaf9('0x7'));var sox=require(_0xbaf9('0x8'));var csv=require('to-csv');var ejs=require(_0xbaf9('0x9'));var fs=require('fs');var _=require(_0xbaf9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbaf9('0xb'));var deskjs=require(_0xbaf9('0xc'));var toCsv=require(_0xbaf9('0xd'));var querystring=require(_0xbaf9('0xe'));var Papa=require(_0xbaf9('0xf'));var Redis=require(_0xbaf9('0x10'));var authService=require(_0xbaf9('0x11'));var qs=require(_0xbaf9('0x12'));var as=require(_0xbaf9('0x13'));var hardwareService=require(_0xbaf9('0x14'));var logger=require(_0xbaf9('0x15'))(_0xbaf9('0x16'));var utils=require('../../config/utils');var config=require(_0xbaf9('0x17'));var db=require(_0xbaf9('0x18'))['db'];var dbH=require(_0xbaf9('0x18'))[_0xbaf9('0x19')];function respondWithStatusCode(_0x589811,_0x30a913){_0x30a913=_0x30a913||0xcc;return function(_0x37bc0c){if(_0x37bc0c){return _0x589811['sendStatus'](_0x30a913);}return _0x589811[_0xbaf9('0x1a')](_0x30a913)[_0xbaf9('0x1b')]();};}function respondWithResult(_0x24d000,_0x488d4a){_0x488d4a=_0x488d4a||0xc8;return function(_0x5a6cc5){if(_0x5a6cc5){return _0x24d000[_0xbaf9('0x1a')](_0x488d4a)['json'](_0x5a6cc5);}};}function respondWithFilteredResult(_0x2c1e8a,_0x39475d){return function(_0x2cd568){if(_0x2cd568){var _0x156530=_0x2cd568[_0xbaf9('0x1c')],_0x5a52c6=_0x39475d[_0xbaf9('0x1d')],_0x58e49a=_0x39475d[_0xbaf9('0x1d')]+_0x39475d[_0xbaf9('0x1e')],_0x419d2c;if(_0x58e49a>=_0x156530){_0x58e49a=_0x156530;_0x419d2c=0xc8;}else{_0x419d2c=0xce;}_0x2c1e8a[_0xbaf9('0x1a')](_0x419d2c);return _0x2c1e8a[_0xbaf9('0x1f')]('Content-Range',_0x5a52c6+'-'+_0x58e49a+'/'+_0x156530)[_0xbaf9('0x20')](_0x2cd568);}return null;};}function patchUpdates(_0x237c18){return function(_0x16f0e3){try{jsonpatch['apply'](_0x16f0e3,_0x237c18,!![]);}catch(_0x403790){return BPromise[_0xbaf9('0x21')](_0x403790);}return _0x16f0e3[_0xbaf9('0x22')]();};}function saveUpdates(_0x4dece7,_0x19e7dd){return function(_0x311995){if(_0x311995){return _0x311995[_0xbaf9('0x23')](_0x4dece7)['then'](function(_0x1f3819){return _0x1f3819;});}return null;};}function removeEntity(_0x5338f3,_0x4daf79){return function(_0x427c0c){if(_0x427c0c){return _0x427c0c[_0xbaf9('0x24')]()[_0xbaf9('0x25')](function(){var _0x2c1dac=_0x427c0c['get']({'plain':!![]});var _0x225334=_0xbaf9('0x26');return db['UserProfileResource'][_0xbaf9('0x24')]({'where':{'type':_0x225334,'resourceId':_0x2c1dac['id']}})[_0xbaf9('0x25')](function(){return _0x427c0c;});})[_0xbaf9('0x25')](function(){_0x5338f3[_0xbaf9('0x1a')](0xcc)[_0xbaf9('0x1b')]();});}};}function handleEntityNotFound(_0x4c69fb,_0x1b76cd){return function(_0x53455b){if(!_0x53455b){_0x4c69fb[_0xbaf9('0x27')](0x194);}return _0x53455b;};}function handleError(_0x246210,_0x589b5f){_0x589b5f=_0x589b5f||0x1f4;return function(_0x4aa2d7){logger[_0xbaf9('0x28')](_0x4aa2d7[_0xbaf9('0x29')]);if(_0x4aa2d7['name']){delete _0x4aa2d7[_0xbaf9('0x2a')];}_0x246210[_0xbaf9('0x1a')](_0x589b5f)['send'](_0x4aa2d7);};}exports[_0xbaf9('0x2b')]=function(_0x11df41,_0x4f1ac1){var _0x1a14f3={},_0x5ef118={},_0x599dc7={'count':0x0,'rows':[]};var _0x2cb46d=_[_0xbaf9('0x2c')](db[_0xbaf9('0x2d')][_0xbaf9('0x2e')],function(_0x7c9316){return{'name':_0x7c9316[_0xbaf9('0x2f')],'type':_0x7c9316['type']['key']};});_0x5ef118[_0xbaf9('0x30')]=_['map'](_0x2cb46d,_0xbaf9('0x2a'));_0x5ef118[_0xbaf9('0x31')]=_[_0xbaf9('0x32')](_0x11df41[_0xbaf9('0x31')]);_0x5ef118[_0xbaf9('0x33')]=_[_0xbaf9('0x34')](_0x5ef118[_0xbaf9('0x30')],_0x5ef118[_0xbaf9('0x31')]);_0x1a14f3[_0xbaf9('0x35')]=_[_0xbaf9('0x34')](_0x5ef118[_0xbaf9('0x30')],qs[_0xbaf9('0x36')](_0x11df41[_0xbaf9('0x31')][_0xbaf9('0x36')]));_0x1a14f3[_0xbaf9('0x35')]=_0x1a14f3[_0xbaf9('0x35')]['length']?_0x1a14f3[_0xbaf9('0x35')]:_0x5ef118[_0xbaf9('0x30')];if(!_0x11df41['query']['hasOwnProperty']('nolimit')){_0x1a14f3[_0xbaf9('0x1e')]=qs['limit'](_0x11df41[_0xbaf9('0x31')]['limit']);_0x1a14f3[_0xbaf9('0x1d')]=qs[_0xbaf9('0x1d')](_0x11df41[_0xbaf9('0x31')]['offset']);}_0x1a14f3[_0xbaf9('0x37')]=qs['sort'](_0x11df41['query'][_0xbaf9('0x38')]);_0x1a14f3[_0xbaf9('0x39')]=qs[_0xbaf9('0x33')](_[_0xbaf9('0x3a')](_0x11df41['query'],_0x5ef118['filters']),_0x2cb46d);if(_0x11df41[_0xbaf9('0x31')]['filter']){_0x1a14f3[_0xbaf9('0x39')]=_[_0xbaf9('0x3b')](_0x1a14f3['where'],{'$or':_['map'](_0x2cb46d,function(_0x581bf5){if(_0x581bf5['type']!=='VIRTUAL'){var _0x5bfbd3={};_0x5bfbd3[_0x581bf5[_0xbaf9('0x2a')]]={'$like':'%'+_0x11df41[_0xbaf9('0x31')]['filter']+'%'};return _0x5bfbd3;}})});}_0x1a14f3=_['merge']({},_0x1a14f3,_0x11df41['options']);var _0x2f5388={'where':_0x1a14f3[_0xbaf9('0x39')]};return db[_0xbaf9('0x2d')][_0xbaf9('0x1c')](_0x2f5388)[_0xbaf9('0x25')](function(_0x3f1f28){_0x599dc7[_0xbaf9('0x1c')]=_0x3f1f28;if(_0x11df41[_0xbaf9('0x31')]['includeAll']){_0x1a14f3[_0xbaf9('0x3c')]=[{'all':!![]}];}return db[_0xbaf9('0x2d')][_0xbaf9('0x3d')](_0x1a14f3);})['then'](function(_0x40781c){_0x599dc7['rows']=_0x40781c;return _0x599dc7;})['then'](respondWithFilteredResult(_0x4f1ac1,_0x1a14f3))[_0xbaf9('0x3e')](handleError(_0x4f1ac1,null));};exports[_0xbaf9('0x3f')]=function(_0x2f7d6f,_0x23280d){var _0x3a1147={'raw':![],'where':{'id':_0x2f7d6f[_0xbaf9('0x40')]['id']}},_0x482374={};_0x482374['model']=_[_0xbaf9('0x32')](db[_0xbaf9('0x2d')]['rawAttributes']);_0x482374[_0xbaf9('0x31')]=_['keys'](_0x2f7d6f[_0xbaf9('0x31')]);_0x482374['filters']=_[_0xbaf9('0x34')](_0x482374[_0xbaf9('0x30')],_0x482374['query']);_0x3a1147['attributes']=_[_0xbaf9('0x34')](_0x482374[_0xbaf9('0x30')],qs['fields'](_0x2f7d6f[_0xbaf9('0x31')][_0xbaf9('0x36')]));_0x3a1147[_0xbaf9('0x35')]=_0x3a1147[_0xbaf9('0x35')][_0xbaf9('0x41')]?_0x3a1147['attributes']:_0x482374[_0xbaf9('0x30')];if(_0x2f7d6f[_0xbaf9('0x31')][_0xbaf9('0x42')]){_0x3a1147[_0xbaf9('0x3c')]=[{'all':!![]}];}_0x3a1147=_[_0xbaf9('0x3b')]({},_0x3a1147,_0x2f7d6f['options']);return db[_0xbaf9('0x2d')]['find'](_0x3a1147)[_0xbaf9('0x25')](handleEntityNotFound(_0x23280d,null))[_0xbaf9('0x25')](respondWithResult(_0x23280d,null))[_0xbaf9('0x3e')](handleError(_0x23280d,null));};exports['create']=function(_0x53e6fb,_0x2c89f1){return db['AnalyticCustomReport'][_0xbaf9('0x43')](_0x53e6fb[_0xbaf9('0x44')],{})[_0xbaf9('0x25')](function(_0x10e73e){var _0x2a28b7=_0x53e6fb[_0xbaf9('0x45')][_0xbaf9('0x46')]({'plain':!![]});if(!_0x2a28b7)throw new Error(_0xbaf9('0x47'));if(_0x2a28b7[_0xbaf9('0x48')]===_0xbaf9('0x45')){var _0x19e1e7=_0x10e73e[_0xbaf9('0x46')]({'plain':!![]});var _0x473a6f=_0xbaf9('0x49');return db[_0xbaf9('0x4a')][_0xbaf9('0x4b')]({'where':{'name':_0x473a6f,'userProfileId':_0x2a28b7[_0xbaf9('0x4c')]},'raw':!![]})[_0xbaf9('0x25')](function(_0x447203){if(_0x447203&&_0x447203['autoAssociation']===0x0){return db[_0xbaf9('0x4d')]['create']({'name':_0x19e1e7[_0xbaf9('0x2a')],'resourceId':_0x19e1e7['id'],'type':'CustomReports','sectionId':_0x447203['id']},{})['then'](function(){return _0x10e73e;});}else{return _0x10e73e;}})[_0xbaf9('0x3e')](function(_0x2adad3){logger[_0xbaf9('0x28')](_0xbaf9('0x4e'),_0x2adad3);throw _0x2adad3;});}return _0x10e73e;})['then'](respondWithResult(_0x2c89f1,0xc9))['catch'](handleError(_0x2c89f1,null));};exports[_0xbaf9('0x23')]=function(_0xf147a2,_0x4e9a45){if(_0xf147a2[_0xbaf9('0x44')]['id']){delete _0xf147a2['body']['id'];}return db[_0xbaf9('0x2d')][_0xbaf9('0x4b')]({'where':{'id':_0xf147a2[_0xbaf9('0x40')]['id']}})['then'](handleEntityNotFound(_0x4e9a45,null))[_0xbaf9('0x25')](saveUpdates(_0xf147a2[_0xbaf9('0x44')],null))[_0xbaf9('0x25')](respondWithResult(_0x4e9a45,null))['catch'](handleError(_0x4e9a45,null));};exports[_0xbaf9('0x24')]=function(_0xeeedd3,_0x3103ed){return db[_0xbaf9('0x2d')][_0xbaf9('0x4b')]({'where':{'id':_0xeeedd3[_0xbaf9('0x40')]['id']}})['then'](handleEntityNotFound(_0x3103ed,null))[_0xbaf9('0x25')](removeEntity(_0x3103ed,null))['catch'](handleError(_0x3103ed,null));};exports[_0xbaf9('0x4f')]=function(_0xbc1c1f,_0xd9e821){var _0x35c69b=0xa;var _0x4fdfa0=[_0xbaf9('0x50'),_0xbaf9('0x51'),_0xbaf9('0x52'),'cross_join'];var _0x3fbd7a={'SUM':_0xbaf9('0x53'),'COUNT':_0xbaf9('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xbaf9('0x55'),'MIN':_0xbaf9('0x56'),'AVG':_0xbaf9('0x57'),'GROUP_CONCAT':_0xbaf9('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xbaf9('0x59')};var _0x30eb20={'SEC_TO_TIME':_0xbaf9('0x5a'),'DATE':_0xbaf9('0x5b'),'HOUR':_0xbaf9('0x5c'),'ROUND':_0xbaf9('0x5d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4fe0e5=function(_0x4234de){return!_[_0xbaf9('0x5e')](['IS\x20NULL',_0xbaf9('0x5f'),'IS\x20EMPTY',_0xbaf9('0x60')],_0x4234de);};var _0x779860=function(_0x28bcfe){if(!_0x28bcfe||!_0x28bcfe[_0xbaf9('0x61')][_0xbaf9('0x41')]){return'';}for(var _0x2303f2='(',_0x5f2922=0x0;_0x5f2922<_0x28bcfe[_0xbaf9('0x61')][_0xbaf9('0x41')];_0x5f2922+=0x1){_0x5f2922>0x0&&(_0x2303f2+='\x20'+_0x28bcfe[_0xbaf9('0x62')]+'\x20');_0x2303f2+=_0x28bcfe[_0xbaf9('0x61')][_0x5f2922][_0xbaf9('0x63')]?_0x779860(_0x28bcfe[_0xbaf9('0x61')][_0x5f2922][_0xbaf9('0x63')]):_0x28bcfe[_0xbaf9('0x61')][_0x5f2922]['field']+'\x20'+_0x28bcfe[_0xbaf9('0x61')][_0x5f2922][_0xbaf9('0x64')]+(_0x4fe0e5(_0x28bcfe[_0xbaf9('0x61')][_0x5f2922][_0xbaf9('0x64')])?'\x20'+_0x28bcfe[_0xbaf9('0x61')][_0x5f2922][_0xbaf9('0x65')]:'');}return _0x2303f2+')';};var _0x188a2f={'where':{'id':_0xbc1c1f[_0xbaf9('0x40')]['id']}},_0x3f0bd7,_0x3ceb19,_0x463bfd,_0x1439c9,_0x4b482d;_0x188a2f=_[_0xbaf9('0x3b')]({},_0x188a2f,_0xbc1c1f[_0xbaf9('0x66')]);return db['AnalyticCustomReport'][_0xbaf9('0x4b')](_0x188a2f)[_0xbaf9('0x25')](function(_0xc863ce){if(_0xc863ce){_0x3f0bd7=_0xc863ce;return _0xc863ce[_0xbaf9('0x67')]();}return null;})['then'](function(_0x10fb49){if(_0x10fb49){if(!_0x10fb49[_0xbaf9('0x41')]){throw new db['Sequelize'][(_0xbaf9('0x68'))](_0xbaf9('0x69'),0x193);}_0x3ceb19=_0x10fb49;return db[_0xbaf9('0x6a')][_0xbaf9('0x3d')]({'raw':!![]});}return null;})[_0xbaf9('0x25')](function(_0x99889){if(_0x99889){_0x463bfd=_[_0xbaf9('0x6b')](_0x99889,'id');var _0x4de5b8;var _0xa243bc=squel[_0xbaf9('0x6c')]();_0xa243bc['from'](_0x3f0bd7[_0xbaf9('0x6d')]);for(var _0x1341f4=0x0;_0x1341f4<_0x3ceb19['length'];_0x1341f4+=0x1){_0x4de5b8=_0x3ceb19[_0x1341f4]['MetricId']?_0x463bfd[_0x3ceb19[_0x1341f4][_0xbaf9('0x6e')]][_0xbaf9('0x6f')]:_0x3ceb19[_0x1341f4][_0xbaf9('0x70')];_0x4de5b8=_0x3ceb19[_0x1341f4][_0xbaf9('0x71')]?_[_0xbaf9('0x72')](_0x3fbd7a[_0x3ceb19[_0x1341f4][_0xbaf9('0x71')]],'%s',_0x4de5b8):_0x4de5b8;_0x4de5b8=_0x3ceb19[_0x1341f4]['format']?_['replace'](_0x30eb20[_0x3ceb19[_0x1341f4]['format']],'%s',_0x4de5b8):_0x4de5b8;if(_0x3ceb19[_0x1341f4][_0xbaf9('0x73')]){_0xa243bc['group'](_0x4de5b8);}_0x3ceb19[_0x1341f4]['orderBy']&&_0xa243bc[_0xbaf9('0x37')](_0x4de5b8,_0x3ceb19[_0x1341f4][_0xbaf9('0x74')]==='DESC'?![]:!![]);_0xa243bc[_0xbaf9('0x70')](_0x4de5b8,_0x3ceb19[_0x1341f4][_0xbaf9('0x75')]||_0x4de5b8);}if(_0x3f0bd7[_0xbaf9('0x76')]){_0x3f0bd7[_0xbaf9('0x76')]=JSON[_0xbaf9('0x77')](_0x3f0bd7[_0xbaf9('0x76')]);for(var _0x1ffe01=0x0;_0x1ffe01<_0x3f0bd7[_0xbaf9('0x76')][_0xbaf9('0x41')];_0x1ffe01+=0x1){if(_0x3f0bd7[_0xbaf9('0x76')][_0x1ffe01]['type']&&_[_0xbaf9('0x5e')](_0x4fdfa0,_0x3f0bd7[_0xbaf9('0x76')][_0x1ffe01][_0xbaf9('0x78')])&&_0x3f0bd7[_0xbaf9('0x76')][_0x1ffe01][_0xbaf9('0x79')]&&_0x3f0bd7['joins'][_0x1ffe01][_0xbaf9('0x7a')]&&_0x3f0bd7[_0xbaf9('0x76')][_0x1ffe01][_0xbaf9('0x7b')]){_0xa243bc[_0x3f0bd7[_0xbaf9('0x76')][_0x1ffe01]['type']](_0x3f0bd7['joins'][_0x1ffe01][_0xbaf9('0x7a')],null,util[_0xbaf9('0x7c')](_0xbaf9('0x7d'),_0x3f0bd7[_0xbaf9('0x6d')],_0x3f0bd7[_0xbaf9('0x76')][_0x1ffe01]['parentKey'],_0x3f0bd7[_0xbaf9('0x76')][_0x1ffe01][_0xbaf9('0x7a')],_0x3f0bd7['joins'][_0x1ffe01][_0xbaf9('0x7b')]));}}}if(_0x3f0bd7[_0xbaf9('0x7e')]){_0x3f0bd7[_0xbaf9('0x7e')]=JSON[_0xbaf9('0x77')](_0x3f0bd7[_0xbaf9('0x7e')]);_0xa243bc[_0xbaf9('0x39')](_0x779860(_0x3f0bd7[_0xbaf9('0x7e')][_0xbaf9('0x63')]));}_0x4b482d=_0xa243bc[_0xbaf9('0x7f')]();_0xa243bc[_0xbaf9('0x1e')](_0x35c69b);_0xa243bc[_0xbaf9('0x1d')](0x0);logger['debug'](_0xbaf9('0x80'),_0xa243bc['toString']());return db[_0xbaf9('0x81')][_0xbaf9('0x31')](_0xa243bc[_0xbaf9('0x82')](),{'type':db['sequelize'][_0xbaf9('0x83')][_0xbaf9('0x84')]});}})[_0xbaf9('0x25')](respondWithResult(_0xd9e821,null))[_0xbaf9('0x3e')](handleError(_0xd9e821,null));};function runReport(_0x344107,_0x1f682a,_0x509415){var _0x2eb5fb=_0x1f682a[_0xbaf9('0x2a')];var _0x4a674f=0xa;var _0x18c69c=[_0xbaf9('0x50'),'left_join','right_join',_0xbaf9('0x85')];var _0x17028c={'SUM':_0xbaf9('0x53'),'COUNT':_0xbaf9('0x54'),'COUNT DISTINCT':_0xbaf9('0x86'),'MAX':_0xbaf9('0x55'),'MIN':_0xbaf9('0x56'),'AVG':_0xbaf9('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xbaf9('0x87'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x21afa8={'SEC_TO_TIME':_0xbaf9('0x5a'),'DATE':'DATE(%s)','HOUR':_0xbaf9('0x5c'),'ROUND':_0xbaf9('0x5d'),'UNIX_TIMESTAMP':_0xbaf9('0x88')};var _0x4300bd=function(_0x4dd57d){return!_[_0xbaf9('0x5e')]([_0xbaf9('0x89'),_0xbaf9('0x5f'),_0xbaf9('0x8a'),_0xbaf9('0x60')],_0x4dd57d);};var _0x38e8be=function(_0xd7a763){if(!_0xd7a763||!_0xd7a763['rules'][_0xbaf9('0x41')]){return'';}for(var _0x491ef2='(',_0x15cc8f=0x0;_0x15cc8f<_0xd7a763[_0xbaf9('0x61')][_0xbaf9('0x41')];_0x15cc8f+=0x1){_0x15cc8f>0x0&&(_0x491ef2+='\x20'+_0xd7a763[_0xbaf9('0x62')]+'\x20');_0x491ef2+=_0xd7a763[_0xbaf9('0x61')][_0x15cc8f]['group']?_0x38e8be(_0xd7a763[_0xbaf9('0x61')][_0x15cc8f]['group']):_0xd7a763['rules'][_0x15cc8f][_0xbaf9('0x70')]+'\x20'+_0xd7a763[_0xbaf9('0x61')][_0x15cc8f][_0xbaf9('0x64')]+(_0x4300bd(_0xd7a763[_0xbaf9('0x61')][_0x15cc8f]['condition'])?'\x20'+_0xd7a763['rules'][_0x15cc8f][_0xbaf9('0x65')]:'');}return _0x491ef2+')';};var _0x4df925={'where':{'id':_0x344107['id']}},_0x1efc62,_0x4b64dc,_0x43840d,_0x2bdb31,_0xa954ba;_0x4df925=_['merge']({},_0x4df925,_0x509415);return db[_0xbaf9('0x2d')][_0xbaf9('0x4b')](_0x4df925)[_0xbaf9('0x25')](function(_0x268866){if(_0x268866){_0x1efc62=_0x268866;return _0x268866['getFields']();}return null;})['then'](function(_0xfe0565){if(_0xfe0565){if(!_0xfe0565[_0xbaf9('0x41')]){throw new db[(_0xbaf9('0x8b'))][(_0xbaf9('0x68'))](_0xbaf9('0x69'),0x193);}_0x4b64dc=_0xfe0565;return db[_0xbaf9('0x6a')][_0xbaf9('0x3d')]({'raw':!![]});}return null;})[_0xbaf9('0x25')](function(_0x49a03e){if(_0x49a03e){_0x43840d=_[_0xbaf9('0x6b')](_0x49a03e,'id');var _0xe6c604;var _0x1fe13e=squel[_0xbaf9('0x6c')]();_0x1fe13e['from'](_0x1efc62[_0xbaf9('0x6d')]);for(var _0x4396ed=0x0;_0x4396ed<_0x4b64dc[_0xbaf9('0x41')];_0x4396ed+=0x1){_0xe6c604=_0x4b64dc[_0x4396ed][_0xbaf9('0x6e')]?_0x43840d[_0x4b64dc[_0x4396ed][_0xbaf9('0x6e')]][_0xbaf9('0x6f')]:_0x4b64dc[_0x4396ed]['field'];_0xe6c604=_0x4b64dc[_0x4396ed][_0xbaf9('0x71')]?_[_0xbaf9('0x72')](_0x17028c[_0x4b64dc[_0x4396ed]['function']],'%s',_0xe6c604):_0xe6c604;_0xe6c604=_0x4b64dc[_0x4396ed][_0xbaf9('0x7c')]?_[_0xbaf9('0x72')](_0x21afa8[_0x4b64dc[_0x4396ed][_0xbaf9('0x7c')]],'%s',_0xe6c604):_0xe6c604;if(_0x4b64dc[_0x4396ed][_0xbaf9('0x73')]){_0x1fe13e[_0xbaf9('0x63')](_0xe6c604);}_0x4b64dc[_0x4396ed]['orderBy']&&_0x1fe13e[_0xbaf9('0x37')](_0xe6c604,_0x4b64dc[_0x4396ed][_0xbaf9('0x74')]===_0xbaf9('0x8c')?![]:!![]);_0x1fe13e[_0xbaf9('0x70')](_0xe6c604,_0x4b64dc[_0x4396ed][_0xbaf9('0x75')]||_0xe6c604);}if(_0x1efc62['joins']){_0x1efc62[_0xbaf9('0x76')]=JSON[_0xbaf9('0x77')](_0x1efc62['joins']);for(var _0x3ae683=0x0;_0x3ae683<_0x1efc62[_0xbaf9('0x76')][_0xbaf9('0x41')];_0x3ae683+=0x1){if(_0x1efc62['joins'][_0x3ae683]['type']&&_['includes'](_0x18c69c,_0x1efc62[_0xbaf9('0x76')][_0x3ae683][_0xbaf9('0x78')])&&_0x1efc62['joins'][_0x3ae683][_0xbaf9('0x79')]&&_0x1efc62[_0xbaf9('0x76')][_0x3ae683][_0xbaf9('0x7a')]&&_0x1efc62[_0xbaf9('0x76')][_0x3ae683][_0xbaf9('0x7b')]){_0x1fe13e[_0x1efc62[_0xbaf9('0x76')][_0x3ae683]['type']](_0x1efc62[_0xbaf9('0x76')][_0x3ae683][_0xbaf9('0x7a')],null,util[_0xbaf9('0x7c')](_0xbaf9('0x7d'),_0x1efc62[_0xbaf9('0x6d')],_0x1efc62[_0xbaf9('0x76')][_0x3ae683][_0xbaf9('0x79')],_0x1efc62[_0xbaf9('0x76')][_0x3ae683]['foreignTable'],_0x1efc62['joins'][_0x3ae683][_0xbaf9('0x7b')]));}}}if(_0x1efc62[_0xbaf9('0x7e')]){_0x1efc62[_0xbaf9('0x7e')]=JSON[_0xbaf9('0x77')](_0x1efc62[_0xbaf9('0x7e')]);_0x1fe13e[_0xbaf9('0x39')](_0x38e8be(_0x1efc62['conditions'][_0xbaf9('0x63')]));}_0xa954ba=_0x1fe13e[_0xbaf9('0x7f')]();_0x1fe13e['limit'](_0x4a674f);_0x1fe13e[_0xbaf9('0x1d')](0x0);logger[_0xbaf9('0x8d')](_0xbaf9('0x80'),_0x1fe13e['toString']());return db[_0xbaf9('0x81')][_0xbaf9('0x31')](_0x1fe13e[_0xbaf9('0x82')](),{'type':db['sequelize'][_0xbaf9('0x83')][_0xbaf9('0x84')]});}})[_0xbaf9('0x25')](function(_0x45bbdc){if(!_0x45bbdc['length']){throw new db[(_0xbaf9('0x8b'))][(_0xbaf9('0x68'))](_0xbaf9('0x8e'),0xcc);}if(_0x1f682a[_0xbaf9('0x8f')]==='web'){return null;}var _0x50ccd4=_['merge'](_0x1f682a,{'name':_0x1f682a[_0xbaf9('0x90')]||_0x1f682a[_0xbaf9('0x2a')]||_0x1efc62[_0xbaf9('0x2a')],'basename':_0x2eb5fb,'savename':util[_0xbaf9('0x7c')](_0xbaf9('0x91'),_0x1f682a[_0xbaf9('0x2a')]||_0x1efc62[_0xbaf9('0x2a')],require(_0xbaf9('0x92'))[_0xbaf9('0x93')](0x4),_0x1f682a['output']||'csv'),'reportId':_0x1efc62['id'],'reportType':_0xbaf9('0x94')});return db[_0xbaf9('0x95')][_0xbaf9('0x43')](_0x50ccd4,{'raw':!![]});})[_0xbaf9('0x25')](function(_0x1cd673){if(_0x1efc62['table']===_0xbaf9('0x96')){_0xa954ba[_0xbaf9('0x39')](_0x1efc62[_0xbaf9('0x6d')]+_0xbaf9('0x97'),_0x1f682a[_0xbaf9('0x98')],_0x1f682a[_0xbaf9('0x99')]);}else{_0xa954ba[_0xbaf9('0x39')](_0x1efc62[_0xbaf9('0x6d')]+_0xbaf9('0x9a'),_0x1f682a[_0xbaf9('0x98')],_0x1f682a[_0xbaf9('0x99')]);}if(_0x1cd673){logger['info']('Run\x20Query:',_0xa954ba['toString']());require(_0xbaf9('0x9b'))[_0xbaf9('0x9c')](path[_0xbaf9('0x50')](__dirname,_0xbaf9('0x9d'),_0x1cd673[_0xbaf9('0x8f')]),[_0x1cd673['id'],_0xa954ba[_0xbaf9('0x82')](),path[_0xbaf9('0x50')](__dirname,'../../files/reports',_0x1cd673[_0xbaf9('0x9e')]),_0x2eb5fb]);return _0x1cd673;}else{var _0x4934b9=squel[_0xbaf9('0x6c')]();_0x4934b9[_0xbaf9('0x9f')]('('+_0xa954ba[_0xbaf9('0x82')]()+')',_0xbaf9('0xa0'));_0x4934b9[_0xbaf9('0x70')]('COUNT(*)',_0xbaf9('0x1c'));_0xa954ba['limit'](_0x1f682a[_0xbaf9('0x1e')]||_0x4a674f);_0xa954ba[_0xbaf9('0x1d')](_0x1f682a['offset']||0x0);return dbH[_0xbaf9('0x81')][_0xbaf9('0x31')](_0x4934b9[_0xbaf9('0x82')](),{'type':dbH[_0xbaf9('0x81')]['QueryTypes'][_0xbaf9('0x84')]})[_0xbaf9('0x25')](function(_0x4c9c8a){if(!_0x4c9c8a['length']){_0x2bdb31=0x0;}else{_0x2bdb31=_0x4c9c8a[0x0][_0xbaf9('0x1c')]||0x0;}return dbH['sequelize'][_0xbaf9('0x31')](_0xa954ba[_0xbaf9('0x82')](),{'type':dbH[_0xbaf9('0x81')][_0xbaf9('0x83')][_0xbaf9('0x84')]});})[_0xbaf9('0x25')](function(_0x5bd1f5){return{'rows':_0x5bd1f5||[],'count':_0x2bdb31};});}});}exports['run']=function(_0x15712e,_0x233fc9){return runReport(_0x15712e[_0xbaf9('0x40')],_0x15712e[_0xbaf9('0x31')],_0x15712e[_0xbaf9('0x66')])[_0xbaf9('0x25')](respondWithResult(_0x233fc9,null))['catch'](handleError(_0x233fc9,null));};exports['runReport']=runReport;exports[_0xbaf9('0x31')]=function(_0x26e01c,_0x17f458){var _0x39d1c4=0xa;var _0x1a6b56=[_0xbaf9('0x50'),'left_join',_0xbaf9('0x52'),_0xbaf9('0x85')];var _0x3d0016={'SUM':_0xbaf9('0x53'),'COUNT':_0xbaf9('0x54'),'COUNT DISTINCT':_0xbaf9('0x86'),'MAX':_0xbaf9('0x55'),'MIN':_0xbaf9('0x56'),'AVG':_0xbaf9('0x57'),'GROUP_CONCAT':_0xbaf9('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xbaf9('0x59')};var _0x5875ae={'SEC_TO_TIME':_0xbaf9('0x5a'),'DATE':_0xbaf9('0x5b'),'HOUR':_0xbaf9('0x5c'),'ROUND':_0xbaf9('0x5d'),'UNIX_TIMESTAMP':_0xbaf9('0x88')};var _0x25fc39=function(_0x370b65){return!_[_0xbaf9('0x5e')]([_0xbaf9('0x89'),'IS\x20NOT\x20NULL',_0xbaf9('0x8a'),_0xbaf9('0x60')],_0x370b65);};var _0x3a7de3=function(_0x3d7c13){if(!_0x3d7c13||!_0x3d7c13[_0xbaf9('0x61')][_0xbaf9('0x41')]){return'';}for(var _0x58c720='(',_0x5c97f6=0x0;_0x5c97f6<_0x3d7c13[_0xbaf9('0x61')][_0xbaf9('0x41')];_0x5c97f6+=0x1){_0x5c97f6>0x0&&(_0x58c720+='\x20'+_0x3d7c13['operator']+'\x20');_0x58c720+=_0x3d7c13['rules'][_0x5c97f6][_0xbaf9('0x63')]?_0x3a7de3(_0x3d7c13['rules'][_0x5c97f6]['group']):_0x3d7c13['rules'][_0x5c97f6]['field']+'\x20'+_0x3d7c13[_0xbaf9('0x61')][_0x5c97f6][_0xbaf9('0x64')]+(_0x25fc39(_0x3d7c13[_0xbaf9('0x61')][_0x5c97f6][_0xbaf9('0x64')])?'\x20'+_0x3d7c13['rules'][_0x5c97f6][_0xbaf9('0x65')]:'');}return _0x58c720+')';};var _0x2c80ea={'where':{'id':_0x26e01c['params']['id']}},_0x4b3c6a,_0x3d71ba,_0x18eba6,_0x46517b,_0x3783e1;_0x2c80ea=_['merge']({},_0x2c80ea,_0x26e01c[_0xbaf9('0x66')]);return db[_0xbaf9('0x2d')]['find'](_0x2c80ea)[_0xbaf9('0x25')](function(_0x256bc5){if(_0x256bc5){_0x4b3c6a=_0x256bc5;return _0x256bc5['getFields']();}return null;})[_0xbaf9('0x25')](function(_0x1db510){if(_0x1db510){if(!_0x1db510[_0xbaf9('0x41')]){throw new db[(_0xbaf9('0x8b'))][(_0xbaf9('0x68'))](_0xbaf9('0x69'),0x193);}_0x3d71ba=_0x1db510;return db['AnalyticMetric'][_0xbaf9('0x3d')]({'raw':!![]});}return null;})[_0xbaf9('0x25')](function(_0x683061){if(_0x683061){_0x18eba6=_[_0xbaf9('0x6b')](_0x683061,'id');var _0x17096f;var _0x30731a=squel[_0xbaf9('0x6c')]();_0x30731a[_0xbaf9('0x9f')](_0x4b3c6a[_0xbaf9('0x6d')]);for(var _0x491ec6=0x0;_0x491ec6<_0x3d71ba[_0xbaf9('0x41')];_0x491ec6+=0x1){_0x17096f=_0x3d71ba[_0x491ec6]['MetricId']?_0x18eba6[_0x3d71ba[_0x491ec6][_0xbaf9('0x6e')]][_0xbaf9('0x6f')]:_0x3d71ba[_0x491ec6][_0xbaf9('0x70')];_0x17096f=_0x3d71ba[_0x491ec6]['function']?_[_0xbaf9('0x72')](_0x3d0016[_0x3d71ba[_0x491ec6][_0xbaf9('0x71')]],'%s',_0x17096f):_0x17096f;_0x17096f=_0x3d71ba[_0x491ec6][_0xbaf9('0x7c')]?_[_0xbaf9('0x72')](_0x5875ae[_0x3d71ba[_0x491ec6]['format']],'%s',_0x17096f):_0x17096f;if(_0x3d71ba[_0x491ec6][_0xbaf9('0x73')]){_0x30731a['group'](_0x17096f);}_0x3d71ba[_0x491ec6][_0xbaf9('0x74')]&&_0x30731a[_0xbaf9('0x37')](_0x17096f,_0x3d71ba[_0x491ec6][_0xbaf9('0x74')]===_0xbaf9('0x8c')?![]:!![]);_0x30731a[_0xbaf9('0x70')](_0x17096f,_0x3d71ba[_0x491ec6][_0xbaf9('0x75')]||_0x17096f);}if(_0x4b3c6a[_0xbaf9('0x76')]){_0x4b3c6a[_0xbaf9('0x76')]=JSON[_0xbaf9('0x77')](_0x4b3c6a[_0xbaf9('0x76')]);for(var _0x585fb=0x0;_0x585fb<_0x4b3c6a[_0xbaf9('0x76')][_0xbaf9('0x41')];_0x585fb+=0x1){if(_0x4b3c6a[_0xbaf9('0x76')][_0x585fb][_0xbaf9('0x78')]&&_[_0xbaf9('0x5e')](_0x1a6b56,_0x4b3c6a[_0xbaf9('0x76')][_0x585fb][_0xbaf9('0x78')])&&_0x4b3c6a[_0xbaf9('0x76')][_0x585fb][_0xbaf9('0x79')]&&_0x4b3c6a[_0xbaf9('0x76')][_0x585fb][_0xbaf9('0x7a')]&&_0x4b3c6a['joins'][_0x585fb][_0xbaf9('0x7b')]){_0x30731a[_0x4b3c6a[_0xbaf9('0x76')][_0x585fb][_0xbaf9('0x78')]](_0x4b3c6a[_0xbaf9('0x76')][_0x585fb]['foreignTable'],null,util[_0xbaf9('0x7c')](_0xbaf9('0x7d'),_0x4b3c6a['table'],_0x4b3c6a['joins'][_0x585fb][_0xbaf9('0x79')],_0x4b3c6a[_0xbaf9('0x76')][_0x585fb][_0xbaf9('0x7a')],_0x4b3c6a[_0xbaf9('0x76')][_0x585fb]['foreignKey']));}}}if(_0x4b3c6a[_0xbaf9('0x7e')]){_0x4b3c6a['conditions']=JSON[_0xbaf9('0x77')](_0x4b3c6a[_0xbaf9('0x7e')]);_0x30731a[_0xbaf9('0x39')](_0x3a7de3(_0x4b3c6a[_0xbaf9('0x7e')][_0xbaf9('0x63')]));}_0x3783e1=_0x30731a['clone']();_0x30731a[_0xbaf9('0x1e')](_0x39d1c4);_0x30731a[_0xbaf9('0x1d')](0x0);logger[_0xbaf9('0x8d')]('Limited\x20Query:',_0x30731a['toString']());return db[_0xbaf9('0x81')][_0xbaf9('0x31')](_0x30731a[_0xbaf9('0x82')](),{'type':db[_0xbaf9('0x81')][_0xbaf9('0x83')][_0xbaf9('0x84')]});}})[_0xbaf9('0x25')](function(){return{'sql':_0x3783e1[_0xbaf9('0x82')]()};})[_0xbaf9('0x25')](respondWithResult(_0x17f458,null))[_0xbaf9('0x3e')](handleError(_0x17f458,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 27224bf..de41629 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 _0xa3ac=['define','AnalyticCustomReport','analytics_custom_reports','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticCustomReport.attributes','exports'];(function(_0x5c0d82,_0x19f536){var _0x2d3f53=function(_0x9775ae){while(--_0x9775ae){_0x5c0d82['push'](_0x5c0d82['shift']());}};_0x2d3f53(++_0x19f536);}(_0xa3ac,0x13b));var _0xca3a=function(_0x16f287,_0x2da575){_0x16f287=_0x16f287-0x0;var _0x1919aa=_0xa3ac[_0x16f287];return _0x1919aa;};'use strict';var _=require(_0xca3a('0x0'));var util=require(_0xca3a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xca3a('0x2'));var BPromise=require(_0xca3a('0x3'));var rp=require(_0xca3a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xca3a('0x5'));var config=require(_0xca3a('0x6'));var attributes=require(_0xca3a('0x7'));module[_0xca3a('0x8')]=function(_0x2efac2,_0x465239){return _0x2efac2[_0xca3a('0x9')](_0xca3a('0xa'),attributes,{'tableName':_0xca3a('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ff5=['request-promise','path','rimraf','../../config/environment','exports','AnalyticCustomReport','analytics_custom_reports','util','../../config/logger','moment','bluebird'];(function(_0x1ebe90,_0x5d29fc){var _0x447c82=function(_0x1c2646){while(--_0x1c2646){_0x1ebe90['push'](_0x1ebe90['shift']());}};_0x447c82(++_0x5d29fc);}(_0x2ff5,0x1d5));var _0x52ff=function(_0x4d8b46,_0x43519b){_0x4d8b46=_0x4d8b46-0x0;var _0x2259d9=_0x2ff5[_0x4d8b46];return _0x2259d9;};'use strict';var _=require('lodash');var util=require(_0x52ff('0x0'));var logger=require(_0x52ff('0x1'))('api');var moment=require(_0x52ff('0x2'));var BPromise=require(_0x52ff('0x3'));var rp=require(_0x52ff('0x4'));var fs=require('fs');var path=require(_0x52ff('0x5'));var rimraf=require(_0x52ff('0x6'));var config=require(_0x52ff('0x7'));var attributes=require('./analyticCustomReport.attributes');module[_0x52ff('0x8')]=function(_0x285f60,_0x26906c){return _0x285f60['define'](_0x52ff('0x9'),attributes,{'tableName':_0x52ff('0xa'),'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 7c6e514..dc6def2 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 _0xd9bc=['moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x1cca82,_0x5c2d29){var _0xe5527d=function(_0x308708){while(--_0x308708){_0x1cca82['push'](_0x1cca82['shift']());}};_0xe5527d(++_0x5c2d29);}(_0xd9bc,0x1a3));var _0xcd9b=function(_0x312883,_0x313fa4){_0x312883=_0x312883-0x0;var _0x2b6685=_0xd9bc[_0x312883];return _0x2b6685;};'use strict';var _=require(_0xcd9b('0x0'));var util=require('util');var moment=require(_0xcd9b('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcd9b('0x2'))['db'];var utils=require(_0xcd9b('0x3'));var logger=require(_0xcd9b('0x4'))('rpc');var config=require(_0xcd9b('0x5'));var jayson=require(_0xcd9b('0x6'));var client=jayson[_0xcd9b('0x7')][_0xcd9b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x56cad8,_0xcb5bec,_0x14908d){return new BPromise(function(_0x13d98c,_0x552405){return client[_0xcd9b('0x9')](_0x56cad8,_0x14908d)[_0xcd9b('0xa')](function(_0x447140){logger[_0xcd9b('0xb')](_0xcd9b('0xc'),_0xcb5bec,_0xcd9b('0xd'));logger['debug'](_0xcd9b('0xe'),_0xcb5bec,_0xcd9b('0xd'),JSON[_0xcd9b('0xf')](_0x447140));if(_0x447140[_0xcd9b('0x10')]){if(_0x447140[_0xcd9b('0x10')][_0xcd9b('0x11')]===0x1f4){logger[_0xcd9b('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0xcb5bec,_0x447140['error'][_0xcd9b('0x12')]);return _0x552405(_0x447140[_0xcd9b('0x10')][_0xcd9b('0x12')]);}logger['error'](_0xcd9b('0xc'),_0xcb5bec,_0x447140[_0xcd9b('0x10')][_0xcd9b('0x12')]);return _0x13d98c(_0x447140['error'][_0xcd9b('0x12')]);}else{logger[_0xcd9b('0xb')]('AnalyticCustomReport,\x20%s,\x20%s',_0xcb5bec,'request\x20sent');_0x13d98c(_0x447140[_0xcd9b('0x13')]['message']);}})[_0xcd9b('0x14')](function(_0x3aaf8f){logger[_0xcd9b('0x10')](_0xcd9b('0xc'),_0xcb5bec,_0x3aaf8f);_0x552405(_0x3aaf8f);});});} \ No newline at end of file +var _0xf029=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash'];(function(_0x51e6db,_0x47345d){var _0x497e03=function(_0x518927){while(--_0x518927){_0x51e6db['push'](_0x51e6db['shift']());}};_0x497e03(++_0x47345d);}(_0xf029,0x16f));var _0x9f02=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xf029[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x9f02('0x0'));var util=require(_0x9f02('0x1'));var moment=require(_0x9f02('0x2'));var BPromise=require(_0x9f02('0x3'));var rs=require(_0x9f02('0x4'));var fs=require('fs');var Redis=require(_0x9f02('0x5'));var db=require(_0x9f02('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x9f02('0x7'));var jayson=require(_0x9f02('0x8'));var client=jayson[_0x9f02('0x9')][_0x9f02('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6aa12d,_0x560535,_0x5a2091){return new BPromise(function(_0x466b5e,_0x786688){return client[_0x9f02('0xb')](_0x6aa12d,_0x5a2091)[_0x9f02('0xc')](function(_0xf42b27){logger['info'](_0x9f02('0xd'),_0x560535,_0x9f02('0xe'));logger[_0x9f02('0xf')](_0x9f02('0x10'),_0x560535,_0x9f02('0xe'),JSON['stringify'](_0xf42b27));if(_0xf42b27[_0x9f02('0x11')]){if(_0xf42b27[_0x9f02('0x11')][_0x9f02('0x12')]===0x1f4){logger[_0x9f02('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x560535,_0xf42b27['error'][_0x9f02('0x13')]);return _0x786688(_0xf42b27[_0x9f02('0x11')]['message']);}logger[_0x9f02('0x11')](_0x9f02('0xd'),_0x560535,_0xf42b27['error'][_0x9f02('0x13')]);return _0x466b5e(_0xf42b27[_0x9f02('0x11')][_0x9f02('0x13')]);}else{logger[_0x9f02('0x14')](_0x9f02('0xd'),_0x560535,_0x9f02('0xe'));_0x466b5e(_0xf42b27[_0x9f02('0x15')][_0x9f02('0x13')]);}})[_0x9f02('0x16')](function(_0x3ccf9b){logger['error'](_0x9f02('0xd'),_0x560535,_0x3ccf9b);_0x786688(_0x3ccf9b);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index f1e8853..ebfd0a3 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 _0x4ff1=['/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show'];(function(_0x5974d0,_0x762561){var _0x48a5cd=function(_0x2ba5da){while(--_0x2ba5da){_0x5974d0['push'](_0x5974d0['shift']());}};_0x48a5cd(++_0x762561);}(_0x4ff1,0xf7));var _0x14ff=function(_0x12a612,_0x2a147e){_0x12a612=_0x12a612-0x0;var _0x20eea8=_0x4ff1[_0x12a612];return _0x20eea8;};'use strict';var multer=require(_0x14ff('0x0'));var util=require(_0x14ff('0x1'));var path=require('path');var timeout=require(_0x14ff('0x2'));var express=require(_0x14ff('0x3'));var router=express[_0x14ff('0x4')]();var auth=require(_0x14ff('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x14ff('0x6'));var controller=require(_0x14ff('0x7'));router[_0x14ff('0x8')]('/',auth[_0x14ff('0x9')](),controller[_0x14ff('0xa')]);router['get'](_0x14ff('0xb'),auth['isAuthenticated'](),controller[_0x14ff('0xc')]);router[_0x14ff('0x8')](_0x14ff('0xd'),auth[_0x14ff('0x9')](),controller[_0x14ff('0xe')]);router['get'](_0x14ff('0xf'),auth[_0x14ff('0x9')](),controller[_0x14ff('0x10')]);router[_0x14ff('0x8')](_0x14ff('0x11'),auth['isAuthenticated'](),controller[_0x14ff('0x12')]);router[_0x14ff('0x13')]('/',auth['isAuthenticated'](),controller[_0x14ff('0x14')]);router[_0x14ff('0x15')]('/:id',auth[_0x14ff('0x9')](),controller[_0x14ff('0x16')]);router[_0x14ff('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x14ff('0x18')]);module[_0x14ff('0x19')]=router; \ No newline at end of file +var _0x4133=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','run','/:id/query','create','put','update','delete','/:id','destroy','exports','util','connect-timeout','express','Router'];(function(_0xdae835,_0xf68f74){var _0x49ee74=function(_0x39f7c1){while(--_0x39f7c1){_0xdae835['push'](_0xdae835['shift']());}};_0x49ee74(++_0xf68f74);}(_0x4133,0x6e));var _0x3413=function(_0x580907,_0xbde208){_0x580907=_0x580907-0x0;var _0x50ab75=_0x4133[_0x580907];return _0x50ab75;};'use strict';var multer=require('multer');var util=require(_0x3413('0x0'));var path=require('path');var timeout=require(_0x3413('0x1'));var express=require(_0x3413('0x2'));var router=express[_0x3413('0x3')]();var auth=require(_0x3413('0x4'));var interaction=require(_0x3413('0x5'));var config=require(_0x3413('0x6'));var controller=require('./analyticCustomReport.controller');router[_0x3413('0x7')]('/',auth[_0x3413('0x8')](),controller['index']);router[_0x3413('0x7')]('/:id',auth[_0x3413('0x8')](),controller[_0x3413('0x9')]);router['get']('/:id/preview',auth[_0x3413('0x8')](),controller['preview']);router['get']('/:id/run',auth[_0x3413('0x8')](),controller[_0x3413('0xa')]);router['get'](_0x3413('0xb'),auth['isAuthenticated'](),controller['query']);router['post']('/',auth[_0x3413('0x8')](),controller[_0x3413('0xc')]);router[_0x3413('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x3413('0xe')]);router[_0x3413('0xf')](_0x3413('0x10'),auth['isAuthenticated'](),controller[_0x3413('0x11')]);module[_0x3413('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 1429965..10dda42 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 _0x8f67=['TEXT','sequelize','exports','STRING'];(function(_0x1e69f7,_0x5499c0){var _0x35051d=function(_0x2ac6bb){while(--_0x2ac6bb){_0x1e69f7['push'](_0x1e69f7['shift']());}};_0x35051d(++_0x5499c0);}(_0x8f67,0xc9));var _0x78f6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8f67[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x78f6('0x0'));module[_0x78f6('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x78f6('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x78f6('0x2')]},'conditions':{'type':Sequelize[_0x78f6('0x3')]},'joins':{'type':Sequelize[_0x78f6('0x3')]}}; \ No newline at end of file +var _0xb630=['TEXT','exports','STRING'];(function(_0x2cb0ac,_0x3d367f){var _0x4c757a=function(_0x5de26b){while(--_0x5de26b){_0x2cb0ac['push'](_0x2cb0ac['shift']());}};_0x4c757a(++_0x3d367f);}(_0xb630,0x1c0));var _0x0b63=function(_0x456904,_0x4cb25c){_0x456904=_0x456904-0x0;var _0x4b0063=_0xb630[_0x456904];return _0x4b0063;};'use strict';var Sequelize=require('sequelize');module[_0x0b63('0x0')]={'name':{'type':Sequelize[_0x0b63('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x0b63('0x1')]},'parent':{'type':Sequelize[_0x0b63('0x1')]},'table':{'type':Sequelize[_0x0b63('0x1')]},'conditions':{'type':Sequelize[_0x0b63('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 8b9cef0..2b59b8d 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 _0xe1df=['name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','AnalyticDefaultReport','includeAll','include','findAll','rows','show','params','fields','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','includes','IS\x20NULL','IS\x20EMPTY','rules','operator','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','order','field','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','sequelize','QueryTypes','COUNT(%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','select','DESC','foreignKey','debug','Limited\x20Query:','toString','SELECT','No\x20available\x20data','output','web','fullPath','%s-%s.%s','randomstring','generate','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../files/reports','savename','COUNT(*)','run','runReport','ROUND(%s)','AnalyticMetric','html-pdf','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','dbH','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','update','destroy','get','DefaultReports','then','error'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe1df,0x80));var _0xfe1d=function(_0x530723,_0x13390e){_0x530723=_0x530723-0x0;var _0x57adb3=_0xe1df[_0x530723];return _0x57adb3;};'use strict';var pdf=require(_0xfe1d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfe1d('0x1'));var zipdir=require(_0xfe1d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfe1d('0x3'));var moment=require('moment');var BPromise=require(_0xfe1d('0x4'));var Mustache=require(_0xfe1d('0x5'));var util=require('util');var path=require(_0xfe1d('0x6'));var sox=require(_0xfe1d('0x7'));var csv=require(_0xfe1d('0x8'));var ejs=require(_0xfe1d('0x9'));var fs=require('fs');var _=require(_0xfe1d('0xa'));var squel=require(_0xfe1d('0xb'));var crypto=require(_0xfe1d('0xc'));var jsforce=require(_0xfe1d('0xd'));var deskjs=require(_0xfe1d('0xe'));var toCsv=require('to-csv');var querystring=require(_0xfe1d('0xf'));var Papa=require('papaparse');var Redis=require(_0xfe1d('0x10'));var authService=require(_0xfe1d('0x11'));var qs=require(_0xfe1d('0x12'));var as=require(_0xfe1d('0x13'));var hardwareService=require(_0xfe1d('0x14'));var logger=require(_0xfe1d('0x15'))(_0xfe1d('0x16'));var utils=require('../../config/utils');var config=require(_0xfe1d('0x17'));var db=require(_0xfe1d('0x18'))['db'];var dbH=require(_0xfe1d('0x18'))[_0xfe1d('0x19')];function respondWithStatusCode(_0x42b9c5,_0x1d9bf1){_0x1d9bf1=_0x1d9bf1||0xcc;return function(_0x277522){if(_0x277522){return _0x42b9c5[_0xfe1d('0x1a')](_0x1d9bf1);}return _0x42b9c5['status'](_0x1d9bf1)[_0xfe1d('0x1b')]();};}function respondWithResult(_0x47476b,_0x121c00){_0x121c00=_0x121c00||0xc8;return function(_0x5a24a3){if(_0x5a24a3){return _0x47476b['status'](_0x121c00)[_0xfe1d('0x1c')](_0x5a24a3);}};}function respondWithFilteredResult(_0x5bea41,_0x9b1c5a){return function(_0x19badd){if(_0x19badd){var _0x1511a7=_0x19badd[_0xfe1d('0x1d')],_0x2d5e97=_0x9b1c5a[_0xfe1d('0x1e')],_0x179b4e=_0x9b1c5a[_0xfe1d('0x1e')]+_0x9b1c5a[_0xfe1d('0x1f')],_0x11a4d8;if(_0x179b4e>=_0x1511a7){_0x179b4e=_0x1511a7;_0x11a4d8=0xc8;}else{_0x11a4d8=0xce;}_0x5bea41[_0xfe1d('0x20')](_0x11a4d8);return _0x5bea41[_0xfe1d('0x21')](_0xfe1d('0x22'),_0x2d5e97+'-'+_0x179b4e+'/'+_0x1511a7)['json'](_0x19badd);}return null;};}function patchUpdates(_0x80676b){return function(_0x4d018f){try{jsonpatch[_0xfe1d('0x23')](_0x4d018f,_0x80676b,!![]);}catch(_0x33478e){return BPromise[_0xfe1d('0x24')](_0x33478e);}return _0x4d018f[_0xfe1d('0x25')]();};}function saveUpdates(_0x30f950,_0x3ab893){return function(_0x6d2aa){if(_0x6d2aa){return _0x6d2aa[_0xfe1d('0x26')](_0x30f950)['then'](function(_0x196bd4){return _0x196bd4;});}return null;};}function removeEntity(_0x1b3bb2,_0x2e6b81){return function(_0x220259){if(_0x220259){return _0x220259[_0xfe1d('0x27')]()['then'](function(){var _0x3ec9df=_0x220259[_0xfe1d('0x28')]({'plain':!![]});var _0x543424=_0xfe1d('0x29');return db['UserProfileResource'][_0xfe1d('0x27')]({'where':{'type':_0x543424,'resourceId':_0x3ec9df['id']}})[_0xfe1d('0x2a')](function(){return _0x220259;});})[_0xfe1d('0x2a')](function(){_0x1b3bb2[_0xfe1d('0x20')](0xcc)[_0xfe1d('0x1b')]();});}};}function handleEntityNotFound(_0x40ba4e,_0x1b6e89){return function(_0xbbca00){if(!_0xbbca00){_0x40ba4e[_0xfe1d('0x1a')](0x194);}return _0xbbca00;};}function handleError(_0x3294e9,_0x4fc156){_0x4fc156=_0x4fc156||0x1f4;return function(_0x479e18){logger[_0xfe1d('0x2b')](_0x479e18['stack']);if(_0x479e18[_0xfe1d('0x2c')]){delete _0x479e18['name'];}_0x3294e9[_0xfe1d('0x20')](_0x4fc156)[_0xfe1d('0x2d')](_0x479e18);};}exports[_0xfe1d('0x2e')]=function(_0x486383,_0x4fc546){var _0x4bf39c={},_0x2a7507={},_0x565e58={'count':0x0,'rows':[]};var _0x2b7aab=_[_0xfe1d('0x2f')](db['AnalyticDefaultReport'][_0xfe1d('0x30')],function(_0x3eec3b){return{'name':_0x3eec3b[_0xfe1d('0x31')],'type':_0x3eec3b[_0xfe1d('0x32')]['key']};});_0x2a7507[_0xfe1d('0x33')]=_[_0xfe1d('0x2f')](_0x2b7aab,_0xfe1d('0x2c'));_0x2a7507[_0xfe1d('0x34')]=_[_0xfe1d('0x35')](_0x486383[_0xfe1d('0x34')]);_0x2a7507[_0xfe1d('0x36')]=_[_0xfe1d('0x37')](_0x2a7507[_0xfe1d('0x33')],_0x2a7507['query']);_0x4bf39c[_0xfe1d('0x38')]=_[_0xfe1d('0x37')](_0x2a7507[_0xfe1d('0x33')],qs['fields'](_0x486383[_0xfe1d('0x34')]['fields']));_0x4bf39c[_0xfe1d('0x38')]=_0x4bf39c['attributes'][_0xfe1d('0x39')]?_0x4bf39c[_0xfe1d('0x38')]:_0x2a7507[_0xfe1d('0x33')];if(!_0x486383[_0xfe1d('0x34')][_0xfe1d('0x3a')](_0xfe1d('0x3b'))){_0x4bf39c[_0xfe1d('0x1f')]=qs['limit'](_0x486383[_0xfe1d('0x34')][_0xfe1d('0x1f')]);_0x4bf39c[_0xfe1d('0x1e')]=qs[_0xfe1d('0x1e')](_0x486383['query'][_0xfe1d('0x1e')]);}_0x4bf39c['order']=qs[_0xfe1d('0x3c')](_0x486383['query'][_0xfe1d('0x3c')]);_0x4bf39c[_0xfe1d('0x3d')]=qs[_0xfe1d('0x36')](_[_0xfe1d('0x3e')](_0x486383['query'],_0x2a7507[_0xfe1d('0x36')]),_0x2b7aab);if(_0x486383[_0xfe1d('0x34')]['filter']){_0x4bf39c[_0xfe1d('0x3d')]=_[_0xfe1d('0x3f')](_0x4bf39c[_0xfe1d('0x3d')],{'$or':_[_0xfe1d('0x2f')](_0x2b7aab,function(_0x41e488){if(_0x41e488[_0xfe1d('0x32')]!==_0xfe1d('0x40')){var _0x329c14={};_0x329c14[_0x41e488[_0xfe1d('0x2c')]]={'$like':'%'+_0x486383[_0xfe1d('0x34')][_0xfe1d('0x41')]+'%'};return _0x329c14;}})});}_0x4bf39c=_[_0xfe1d('0x3f')]({},_0x4bf39c,_0x486383[_0xfe1d('0x42')]);var _0x181623={'where':_0x4bf39c[_0xfe1d('0x3d')]};return db[_0xfe1d('0x43')][_0xfe1d('0x1d')](_0x181623)['then'](function(_0x490ed1){_0x565e58[_0xfe1d('0x1d')]=_0x490ed1;if(_0x486383[_0xfe1d('0x34')][_0xfe1d('0x44')]){_0x4bf39c[_0xfe1d('0x45')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0xfe1d('0x46')](_0x4bf39c);})['then'](function(_0x408ab8){_0x565e58[_0xfe1d('0x47')]=_0x408ab8;return _0x565e58;})[_0xfe1d('0x2a')](respondWithFilteredResult(_0x4fc546,_0x4bf39c))['catch'](handleError(_0x4fc546,null));};exports[_0xfe1d('0x48')]=function(_0x400c10,_0x12383a){var _0x865eb7={'raw':!![],'where':{'id':_0x400c10[_0xfe1d('0x49')]['id']}},_0x3f4b6b={};_0x3f4b6b['model']=_[_0xfe1d('0x35')](db[_0xfe1d('0x43')]['rawAttributes']);_0x3f4b6b[_0xfe1d('0x34')]=_['keys'](_0x400c10[_0xfe1d('0x34')]);_0x3f4b6b['filters']=_[_0xfe1d('0x37')](_0x3f4b6b[_0xfe1d('0x33')],_0x3f4b6b['query']);_0x865eb7[_0xfe1d('0x38')]=_['intersection'](_0x3f4b6b[_0xfe1d('0x33')],qs[_0xfe1d('0x4a')](_0x400c10[_0xfe1d('0x34')]['fields']));_0x865eb7[_0xfe1d('0x38')]=_0x865eb7[_0xfe1d('0x38')][_0xfe1d('0x39')]?_0x865eb7['attributes']:_0x3f4b6b[_0xfe1d('0x33')];if(_0x400c10[_0xfe1d('0x34')][_0xfe1d('0x44')]){_0x865eb7['include']=[{'all':!![]}];}_0x865eb7=_[_0xfe1d('0x3f')]({},_0x865eb7,_0x400c10[_0xfe1d('0x42')]);return db[_0xfe1d('0x43')][_0xfe1d('0x4b')](_0x865eb7)[_0xfe1d('0x2a')](handleEntityNotFound(_0x12383a,null))[_0xfe1d('0x2a')](respondWithResult(_0x12383a,null))[_0xfe1d('0x4c')](handleError(_0x12383a,null));};exports['create']=function(_0x2bbd94,_0xf26879){return db['AnalyticDefaultReport'][_0xfe1d('0x4d')](_0x2bbd94[_0xfe1d('0x4e')],{})[_0xfe1d('0x2a')](function(_0x340441){var _0x515543=_0x2bbd94[_0xfe1d('0x4f')][_0xfe1d('0x28')]({'plain':!![]});if(!_0x515543)throw new Error(_0xfe1d('0x50'));if(_0x515543[_0xfe1d('0x51')]===_0xfe1d('0x4f')){var _0x4a6222=_0x340441[_0xfe1d('0x28')]({'plain':!![]});var _0x4a1907='Reports';return db[_0xfe1d('0x52')]['find']({'where':{'name':_0x4a1907,'userProfileId':_0x515543[_0xfe1d('0x53')]},'raw':!![]})['then'](function(_0x34e74b){if(_0x34e74b&&_0x34e74b[_0xfe1d('0x54')]===0x0){return db[_0xfe1d('0x55')][_0xfe1d('0x4d')]({'name':_0x4a6222[_0xfe1d('0x2c')],'resourceId':_0x4a6222['id'],'type':'DefaultReports','sectionId':_0x34e74b['id']},{})[_0xfe1d('0x2a')](function(){return _0x340441;});}else{return _0x340441;}})[_0xfe1d('0x4c')](function(_0xa1a657){logger[_0xfe1d('0x2b')](_0xfe1d('0x56'),_0xa1a657);throw _0xa1a657;});}return _0x340441;})[_0xfe1d('0x2a')](respondWithResult(_0xf26879,0xc9))[_0xfe1d('0x4c')](handleError(_0xf26879,null));};exports[_0xfe1d('0x26')]=function(_0x3c2a60,_0x5ff75b){if(_0x3c2a60[_0xfe1d('0x4e')]['id']){delete _0x3c2a60[_0xfe1d('0x4e')]['id'];}return db[_0xfe1d('0x43')]['find']({'where':{'id':_0x3c2a60['params']['id']}})[_0xfe1d('0x2a')](handleEntityNotFound(_0x5ff75b,null))[_0xfe1d('0x2a')](saveUpdates(_0x3c2a60['body'],null))[_0xfe1d('0x2a')](respondWithResult(_0x5ff75b,null))['catch'](handleError(_0x5ff75b,null));};exports[_0xfe1d('0x27')]=function(_0x2a1b65,_0x33b465){return db[_0xfe1d('0x43')][_0xfe1d('0x4b')]({'where':{'id':_0x2a1b65[_0xfe1d('0x49')]['id']}})[_0xfe1d('0x2a')](handleEntityNotFound(_0x33b465,null))['then'](removeEntity(_0x33b465,null))[_0xfe1d('0x4c')](handleError(_0x33b465,null));};exports[_0xfe1d('0x57')]=function(_0x3ada8f,_0x11cc4a){var _0x39388e=0xa;var _0x35eecf=[_0xfe1d('0x58'),_0xfe1d('0x59'),_0xfe1d('0x5a'),_0xfe1d('0x5b')];var _0x5c064c={'SUM':_0xfe1d('0x5c'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xfe1d('0x5d'),'MAX':'MAX(%s)','MIN':_0xfe1d('0x5e'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xfe1d('0x5f'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xfe1d('0x60')};var _0x3322af={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xfe1d('0x61'),'HOUR':_0xfe1d('0x62'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x365a2b=function(_0x4c9426){return!_[_0xfe1d('0x63')]([_0xfe1d('0x64'),'IS\x20NOT\x20NULL',_0xfe1d('0x65'),'IS\x20NOT\x20EMPTY'],_0x4c9426);};var _0x196e02=function(_0x325b6c){if(!_0x325b6c||!_0x325b6c[_0xfe1d('0x66')][_0xfe1d('0x39')]){return'';}for(var _0x4cd6a8='(',_0x422659=0x0;_0x422659<_0x325b6c[_0xfe1d('0x66')][_0xfe1d('0x39')];_0x422659+=0x1){_0x422659>0x0&&(_0x4cd6a8+='\x20'+_0x325b6c[_0xfe1d('0x67')]+'\x20');_0x4cd6a8+=_0x325b6c['rules'][_0x422659][_0xfe1d('0x68')]?_0x196e02(_0x325b6c[_0xfe1d('0x66')][_0x422659][_0xfe1d('0x68')]):_0x325b6c[_0xfe1d('0x66')][_0x422659]['field']+'\x20'+_0x325b6c[_0xfe1d('0x66')][_0x422659][_0xfe1d('0x69')]+(_0x365a2b(_0x325b6c[_0xfe1d('0x66')][_0x422659][_0xfe1d('0x69')])?'\x20'+_0x325b6c[_0xfe1d('0x66')][_0x422659][_0xfe1d('0x6a')]:'');}return _0x4cd6a8+')';};var _0x5e1025={'where':{'id':_0x3ada8f[_0xfe1d('0x49')]['id']}},_0x34732a,_0x1661cb,_0x2b1a98,_0x383671,_0x56528f;_0x5e1025=_['merge']({},_0x5e1025,_0x3ada8f['options']);return db[_0xfe1d('0x43')][_0xfe1d('0x4b')](_0x5e1025)['then'](function(_0x20f4db){if(_0x20f4db){_0x34732a=_0x20f4db;return _0x20f4db[_0xfe1d('0x6b')]();}return null;})[_0xfe1d('0x2a')](function(_0x43e2aa){if(_0x43e2aa){if(!_0x43e2aa[_0xfe1d('0x39')]){throw new db[(_0xfe1d('0x6c'))][(_0xfe1d('0x6d'))](_0xfe1d('0x6e'),0x193);}_0x1661cb=_0x43e2aa;return db['AnalyticMetric'][_0xfe1d('0x46')]({'raw':!![]});}return null;})[_0xfe1d('0x2a')](function(_0x1cca19){if(_0x1cca19){_0x2b1a98=_[_0xfe1d('0x6f')](_0x1cca19,'id');var _0x13e951;var _0x452024=squel['select']();_0x452024[_0xfe1d('0x70')](_0x34732a[_0xfe1d('0x71')]);for(var _0xe09a0=0x0;_0xe09a0<_0x1661cb['length'];_0xe09a0+=0x1){_0x13e951=_0x1661cb[_0xe09a0][_0xfe1d('0x72')]?_0x2b1a98[_0x1661cb[_0xe09a0][_0xfe1d('0x72')]][_0xfe1d('0x73')]:_0x1661cb[_0xe09a0]['field'];_0x13e951=_0x1661cb[_0xe09a0][_0xfe1d('0x74')]?_[_0xfe1d('0x75')](_0x5c064c[_0x1661cb[_0xe09a0]['function']],'%s',_0x13e951):_0x13e951;_0x13e951=_0x1661cb[_0xe09a0][_0xfe1d('0x76')]?_[_0xfe1d('0x75')](_0x3322af[_0x1661cb[_0xe09a0][_0xfe1d('0x76')]],'%s',_0x13e951):_0x13e951;if(_0x1661cb[_0xe09a0][_0xfe1d('0x77')]){_0x452024['group'](_0x13e951);}_0x1661cb[_0xe09a0][_0xfe1d('0x78')]&&_0x452024[_0xfe1d('0x79')](_0x13e951,_0x1661cb[_0xe09a0][_0xfe1d('0x78')]==='DESC'?![]:!![]);_0x452024[_0xfe1d('0x7a')](_0x13e951,_0x1661cb[_0xe09a0][_0xfe1d('0x7b')]||_0x13e951);}if(_0x34732a[_0xfe1d('0x7c')]){_0x34732a[_0xfe1d('0x7c')]=JSON[_0xfe1d('0x7d')](_0x34732a[_0xfe1d('0x7c')]);for(var _0x31d1a1=0x0;_0x31d1a1<_0x34732a[_0xfe1d('0x7c')][_0xfe1d('0x39')];_0x31d1a1+=0x1){if(_0x34732a[_0xfe1d('0x7c')][_0x31d1a1]['type']&&_[_0xfe1d('0x63')](_0x35eecf,_0x34732a[_0xfe1d('0x7c')][_0x31d1a1][_0xfe1d('0x32')])&&_0x34732a[_0xfe1d('0x7c')][_0x31d1a1][_0xfe1d('0x7e')]&&_0x34732a[_0xfe1d('0x7c')][_0x31d1a1][_0xfe1d('0x7f')]&&_0x34732a[_0xfe1d('0x7c')][_0x31d1a1]['foreignKey']){_0x452024[_0x34732a['joins'][_0x31d1a1][_0xfe1d('0x32')]](_0x34732a[_0xfe1d('0x7c')][_0x31d1a1][_0xfe1d('0x7f')],null,util[_0xfe1d('0x76')](_0xfe1d('0x80'),_0x34732a[_0xfe1d('0x71')],_0x34732a[_0xfe1d('0x7c')][_0x31d1a1]['parentKey'],_0x34732a[_0xfe1d('0x7c')][_0x31d1a1][_0xfe1d('0x7f')],_0x34732a[_0xfe1d('0x7c')][_0x31d1a1]['foreignKey']));}}}if(_0x34732a[_0xfe1d('0x81')]){_0x34732a[_0xfe1d('0x81')]=JSON['parse'](_0x34732a[_0xfe1d('0x81')]);_0x452024[_0xfe1d('0x3d')](_0x196e02(_0x34732a['conditions']['group']));}_0x56528f=_0x452024[_0xfe1d('0x82')]();_0x452024[_0xfe1d('0x1f')](_0x39388e);_0x452024[_0xfe1d('0x1e')](0x0);logger['debug']('Limited\x20Query:',_0x452024['toString']());return db[_0xfe1d('0x83')][_0xfe1d('0x34')](_0x452024['toString'](),{'type':db[_0xfe1d('0x83')][_0xfe1d('0x84')]['SELECT']});}})['then'](respondWithResult(_0x11cc4a,null))[_0xfe1d('0x4c')](handleError(_0x11cc4a,null));};function runReport(_0x15ae42,_0x4b7c83,_0x4e7fb2){var _0x45cbf6=_0x4b7c83['name'];var _0x1a1967=0xa;var _0x4fb472=[_0xfe1d('0x58'),_0xfe1d('0x59'),_0xfe1d('0x5a'),'cross_join'];var _0x4af7f4={'SUM':'SUM(%s)','COUNT':_0xfe1d('0x85'),'COUNT DISTINCT':_0xfe1d('0x5d'),'MAX':_0xfe1d('0x86'),'MIN':_0xfe1d('0x5e'),'AVG':_0xfe1d('0x87'),'GROUP_CONCAT':_0xfe1d('0x5f'),'GROUP_CONCAT ASC':_0xfe1d('0x88'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x533f52={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xfe1d('0x89')};var _0x35676a=function(_0x2542cf){return!_[_0xfe1d('0x63')]([_0xfe1d('0x64'),_0xfe1d('0x8a'),_0xfe1d('0x65'),_0xfe1d('0x8b')],_0x2542cf);};var _0x2a655f=function(_0x20bdde){if(!_0x20bdde||!_0x20bdde[_0xfe1d('0x66')][_0xfe1d('0x39')]){return'';}for(var _0x16d1fa='(',_0x376e40=0x0;_0x376e40<_0x20bdde[_0xfe1d('0x66')][_0xfe1d('0x39')];_0x376e40+=0x1){_0x376e40>0x0&&(_0x16d1fa+='\x20'+_0x20bdde[_0xfe1d('0x67')]+'\x20');_0x16d1fa+=_0x20bdde[_0xfe1d('0x66')][_0x376e40][_0xfe1d('0x68')]?_0x2a655f(_0x20bdde[_0xfe1d('0x66')][_0x376e40][_0xfe1d('0x68')]):_0x20bdde['rules'][_0x376e40]['field']+'\x20'+_0x20bdde[_0xfe1d('0x66')][_0x376e40][_0xfe1d('0x69')]+(_0x35676a(_0x20bdde['rules'][_0x376e40]['condition'])?'\x20'+_0x20bdde[_0xfe1d('0x66')][_0x376e40][_0xfe1d('0x6a')]:'');}return _0x16d1fa+')';};var _0x5e9d8={'where':{'id':_0x15ae42['id']}},_0x2ec3ee,_0x20aa46,_0x2ec451,_0x1e5f12,_0x1693cf;_0x5e9d8=_[_0xfe1d('0x3f')]({},_0x5e9d8,_0x4e7fb2);return db[_0xfe1d('0x43')]['find'](_0x5e9d8)[_0xfe1d('0x2a')](function(_0x4358e5){if(_0x4358e5){_0x2ec3ee=_0x4358e5;return _0x4358e5[_0xfe1d('0x6b')]();}return null;})[_0xfe1d('0x2a')](function(_0x61a7cf){if(_0x61a7cf){if(!_0x61a7cf[_0xfe1d('0x39')]){throw new db[(_0xfe1d('0x6c'))][(_0xfe1d('0x6d'))](_0xfe1d('0x6e'),0x193);}_0x20aa46=_0x61a7cf;return db['AnalyticMetric'][_0xfe1d('0x46')]({'raw':!![]});}return null;})[_0xfe1d('0x2a')](function(_0x3d1acd){if(_0x3d1acd){_0x2ec451=_[_0xfe1d('0x6f')](_0x3d1acd,'id');var _0x1c59aa;var _0x40f881=squel[_0xfe1d('0x8c')]();_0x40f881[_0xfe1d('0x70')](_0x2ec3ee[_0xfe1d('0x71')]);for(var _0x297ff6=0x0;_0x297ff6<_0x20aa46[_0xfe1d('0x39')];_0x297ff6+=0x1){_0x1c59aa=_0x20aa46[_0x297ff6][_0xfe1d('0x72')]?_0x2ec451[_0x20aa46[_0x297ff6][_0xfe1d('0x72')]][_0xfe1d('0x73')]:_0x20aa46[_0x297ff6][_0xfe1d('0x7a')];_0x1c59aa=_0x20aa46[_0x297ff6][_0xfe1d('0x74')]?_['replace'](_0x4af7f4[_0x20aa46[_0x297ff6][_0xfe1d('0x74')]],'%s',_0x1c59aa):_0x1c59aa;_0x1c59aa=_0x20aa46[_0x297ff6][_0xfe1d('0x76')]?_[_0xfe1d('0x75')](_0x533f52[_0x20aa46[_0x297ff6][_0xfe1d('0x76')]],'%s',_0x1c59aa):_0x1c59aa;if(_0x20aa46[_0x297ff6]['groupBy']){_0x40f881[_0xfe1d('0x68')](_0x1c59aa);}_0x20aa46[_0x297ff6][_0xfe1d('0x78')]&&_0x40f881[_0xfe1d('0x79')](_0x1c59aa,_0x20aa46[_0x297ff6][_0xfe1d('0x78')]===_0xfe1d('0x8d')?![]:!![]);_0x40f881[_0xfe1d('0x7a')](_0x1c59aa,_0x20aa46[_0x297ff6][_0xfe1d('0x7b')]||_0x1c59aa);}if(_0x2ec3ee[_0xfe1d('0x7c')]){_0x2ec3ee[_0xfe1d('0x7c')]=JSON[_0xfe1d('0x7d')](_0x2ec3ee[_0xfe1d('0x7c')]);for(var _0x29f800=0x0;_0x29f800<_0x2ec3ee[_0xfe1d('0x7c')][_0xfe1d('0x39')];_0x29f800+=0x1){if(_0x2ec3ee[_0xfe1d('0x7c')][_0x29f800][_0xfe1d('0x32')]&&_[_0xfe1d('0x63')](_0x4fb472,_0x2ec3ee['joins'][_0x29f800][_0xfe1d('0x32')])&&_0x2ec3ee[_0xfe1d('0x7c')][_0x29f800][_0xfe1d('0x7e')]&&_0x2ec3ee[_0xfe1d('0x7c')][_0x29f800][_0xfe1d('0x7f')]&&_0x2ec3ee['joins'][_0x29f800][_0xfe1d('0x8e')]){_0x40f881[_0x2ec3ee['joins'][_0x29f800]['type']](_0x2ec3ee[_0xfe1d('0x7c')][_0x29f800]['foreignTable'],null,util[_0xfe1d('0x76')](_0xfe1d('0x80'),_0x2ec3ee[_0xfe1d('0x71')],_0x2ec3ee['joins'][_0x29f800][_0xfe1d('0x7e')],_0x2ec3ee[_0xfe1d('0x7c')][_0x29f800][_0xfe1d('0x7f')],_0x2ec3ee[_0xfe1d('0x7c')][_0x29f800][_0xfe1d('0x8e')]));}}}if(_0x2ec3ee[_0xfe1d('0x81')]){_0x2ec3ee[_0xfe1d('0x81')]=JSON[_0xfe1d('0x7d')](_0x2ec3ee[_0xfe1d('0x81')]);_0x40f881[_0xfe1d('0x3d')](_0x2a655f(_0x2ec3ee[_0xfe1d('0x81')]['group']));}_0x1693cf=_0x40f881['clone']();_0x40f881[_0xfe1d('0x1f')](_0x1a1967);_0x40f881[_0xfe1d('0x1e')](0x0);logger[_0xfe1d('0x8f')](_0xfe1d('0x90'),_0x40f881[_0xfe1d('0x91')]());return db['sequelize'][_0xfe1d('0x34')](_0x40f881[_0xfe1d('0x91')](),{'type':db[_0xfe1d('0x83')][_0xfe1d('0x84')][_0xfe1d('0x92')]});}})['then'](function(_0x4e7a9a){if(!_0x4e7a9a[_0xfe1d('0x39')]){throw new db[(_0xfe1d('0x6c'))][(_0xfe1d('0x6d'))](_0xfe1d('0x93'),0xcc);}if(_0x4b7c83[_0xfe1d('0x94')]===_0xfe1d('0x95')){return null;}var _0x410232=_['merge'](_0x4b7c83,{'name':_0x4b7c83[_0xfe1d('0x96')]||_0x4b7c83['name']||_0x2ec3ee[_0xfe1d('0x2c')],'basename':_0x45cbf6,'savename':util[_0xfe1d('0x76')](_0xfe1d('0x97'),_0x4b7c83[_0xfe1d('0x2c')]||_0x2ec3ee[_0xfe1d('0x2c')],require(_0xfe1d('0x98'))[_0xfe1d('0x99')](0x4),_0x4b7c83[_0xfe1d('0x94')]||'csv'),'reportId':_0x2ec3ee['id'],'reportType':_0xfe1d('0x9a')});return db[_0xfe1d('0x9b')]['create'](_0x410232,{'raw':!![]});})[_0xfe1d('0x2a')](function(_0x19e328){if(_0x2ec3ee[_0xfe1d('0x71')]===_0xfe1d('0x9c')){_0x1693cf[_0xfe1d('0x3d')](_0x2ec3ee[_0xfe1d('0x71')]+_0xfe1d('0x9d'),_0x4b7c83[_0xfe1d('0x9e')],_0x4b7c83[_0xfe1d('0x9f')]);}else{_0x1693cf[_0xfe1d('0x3d')](_0x2ec3ee['table']+_0xfe1d('0xa0'),_0x4b7c83[_0xfe1d('0x9e')],_0x4b7c83[_0xfe1d('0x9f')]);}if(_0x19e328){logger[_0xfe1d('0xa1')](_0xfe1d('0xa2'),_0x1693cf[_0xfe1d('0x91')]());require(_0xfe1d('0xa3'))[_0xfe1d('0xa4')](path['join'](__dirname,'../../components/export/',_0x19e328[_0xfe1d('0x94')]),[_0x19e328['id'],_0x1693cf[_0xfe1d('0x91')](),path[_0xfe1d('0x58')](__dirname,_0xfe1d('0xa5'),_0x19e328[_0xfe1d('0xa6')]),_0x45cbf6]);return _0x19e328;}else{var _0x44ddb6=squel['select']();_0x44ddb6[_0xfe1d('0x70')]('('+_0x1693cf[_0xfe1d('0x91')]()+')','countTable');_0x44ddb6['field'](_0xfe1d('0xa7'),_0xfe1d('0x1d'));_0x1693cf[_0xfe1d('0x1f')](_0x4b7c83[_0xfe1d('0x1f')]||_0x1a1967);_0x1693cf[_0xfe1d('0x1e')](_0x4b7c83[_0xfe1d('0x1e')]||0x0);return dbH[_0xfe1d('0x83')][_0xfe1d('0x34')](_0x44ddb6[_0xfe1d('0x91')](),{'type':dbH['sequelize'][_0xfe1d('0x84')][_0xfe1d('0x92')]})['then'](function(_0xdefd28){if(!_0xdefd28[_0xfe1d('0x39')]){_0x1e5f12=0x0;}else{_0x1e5f12=_0xdefd28[0x0][_0xfe1d('0x1d')]||0x0;}return dbH[_0xfe1d('0x83')][_0xfe1d('0x34')](_0x1693cf[_0xfe1d('0x91')](),{'type':dbH[_0xfe1d('0x83')][_0xfe1d('0x84')][_0xfe1d('0x92')]});})[_0xfe1d('0x2a')](function(_0x5c2c11){return{'rows':_0x5c2c11||[],'count':_0x1e5f12};});}});}exports[_0xfe1d('0xa8')]=function(_0xe6bd1b,_0x149bb4){return runReport(_0xe6bd1b[_0xfe1d('0x49')],_0xe6bd1b['query'],_0xe6bd1b[_0xfe1d('0x42')])['then'](respondWithResult(_0x149bb4,null))['catch'](handleError(_0x149bb4,null));};exports[_0xfe1d('0xa9')]=runReport;exports[_0xfe1d('0x34')]=function(_0x308349,_0x546264){var _0x561894=0xa;var _0x26f2f0=[_0xfe1d('0x58'),_0xfe1d('0x59'),'right_join',_0xfe1d('0x5b')];var _0x813af0={'SUM':_0xfe1d('0x5c'),'COUNT':_0xfe1d('0x85'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xfe1d('0x86'),'MIN':_0xfe1d('0x5e'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xfe1d('0x5f'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xfe1d('0x60')};var _0x1931aa={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xfe1d('0x61'),'HOUR':_0xfe1d('0x62'),'ROUND':_0xfe1d('0xaa'),'UNIX_TIMESTAMP':_0xfe1d('0x89')};var _0x3949e1=function(_0x438344){return!_[_0xfe1d('0x63')]([_0xfe1d('0x64'),_0xfe1d('0x8a'),_0xfe1d('0x65'),_0xfe1d('0x8b')],_0x438344);};var _0x5a10fe=function(_0x567dc5){if(!_0x567dc5||!_0x567dc5[_0xfe1d('0x66')][_0xfe1d('0x39')]){return'';}for(var _0x31a33b='(',_0x45e9de=0x0;_0x45e9de<_0x567dc5[_0xfe1d('0x66')]['length'];_0x45e9de+=0x1){_0x45e9de>0x0&&(_0x31a33b+='\x20'+_0x567dc5['operator']+'\x20');_0x31a33b+=_0x567dc5[_0xfe1d('0x66')][_0x45e9de]['group']?_0x5a10fe(_0x567dc5[_0xfe1d('0x66')][_0x45e9de][_0xfe1d('0x68')]):_0x567dc5[_0xfe1d('0x66')][_0x45e9de][_0xfe1d('0x7a')]+'\x20'+_0x567dc5[_0xfe1d('0x66')][_0x45e9de]['condition']+(_0x3949e1(_0x567dc5['rules'][_0x45e9de]['condition'])?'\x20'+_0x567dc5[_0xfe1d('0x66')][_0x45e9de]['value']:'');}return _0x31a33b+')';};var _0x54638f={'where':{'id':_0x308349[_0xfe1d('0x49')]['id']}},_0x43ac00,_0x309b28,_0x4c1568,_0x3547cc,_0x51b304;_0x54638f=_[_0xfe1d('0x3f')]({},_0x54638f,_0x308349[_0xfe1d('0x42')]);return db[_0xfe1d('0x43')][_0xfe1d('0x4b')](_0x54638f)[_0xfe1d('0x2a')](function(_0x9acfce){if(_0x9acfce){_0x43ac00=_0x9acfce;return _0x9acfce[_0xfe1d('0x6b')]();}return null;})[_0xfe1d('0x2a')](function(_0x161796){if(_0x161796){if(!_0x161796[_0xfe1d('0x39')]){throw new db[(_0xfe1d('0x6c'))][(_0xfe1d('0x6d'))](_0xfe1d('0x6e'),0x193);}_0x309b28=_0x161796;return db[_0xfe1d('0xab')][_0xfe1d('0x46')]({'raw':!![]});}return null;})[_0xfe1d('0x2a')](function(_0x43b55d){if(_0x43b55d){_0x4c1568=_[_0xfe1d('0x6f')](_0x43b55d,'id');var _0x548d5f;var _0xdb6438=squel['select']();_0xdb6438[_0xfe1d('0x70')](_0x43ac00[_0xfe1d('0x71')]);for(var _0x379d5f=0x0;_0x379d5f<_0x309b28[_0xfe1d('0x39')];_0x379d5f+=0x1){_0x548d5f=_0x309b28[_0x379d5f][_0xfe1d('0x72')]?_0x4c1568[_0x309b28[_0x379d5f][_0xfe1d('0x72')]][_0xfe1d('0x73')]:_0x309b28[_0x379d5f][_0xfe1d('0x7a')];_0x548d5f=_0x309b28[_0x379d5f][_0xfe1d('0x74')]?_['replace'](_0x813af0[_0x309b28[_0x379d5f][_0xfe1d('0x74')]],'%s',_0x548d5f):_0x548d5f;_0x548d5f=_0x309b28[_0x379d5f][_0xfe1d('0x76')]?_[_0xfe1d('0x75')](_0x1931aa[_0x309b28[_0x379d5f][_0xfe1d('0x76')]],'%s',_0x548d5f):_0x548d5f;if(_0x309b28[_0x379d5f][_0xfe1d('0x77')]){_0xdb6438[_0xfe1d('0x68')](_0x548d5f);}_0x309b28[_0x379d5f][_0xfe1d('0x78')]&&_0xdb6438[_0xfe1d('0x79')](_0x548d5f,_0x309b28[_0x379d5f]['orderBy']===_0xfe1d('0x8d')?![]:!![]);_0xdb6438['field'](_0x548d5f,_0x309b28[_0x379d5f]['alias']||_0x548d5f);}if(_0x43ac00[_0xfe1d('0x7c')]){_0x43ac00[_0xfe1d('0x7c')]=JSON[_0xfe1d('0x7d')](_0x43ac00[_0xfe1d('0x7c')]);for(var _0x4d6a3a=0x0;_0x4d6a3a<_0x43ac00[_0xfe1d('0x7c')][_0xfe1d('0x39')];_0x4d6a3a+=0x1){if(_0x43ac00[_0xfe1d('0x7c')][_0x4d6a3a][_0xfe1d('0x32')]&&_['includes'](_0x26f2f0,_0x43ac00[_0xfe1d('0x7c')][_0x4d6a3a][_0xfe1d('0x32')])&&_0x43ac00[_0xfe1d('0x7c')][_0x4d6a3a][_0xfe1d('0x7e')]&&_0x43ac00[_0xfe1d('0x7c')][_0x4d6a3a][_0xfe1d('0x7f')]&&_0x43ac00[_0xfe1d('0x7c')][_0x4d6a3a][_0xfe1d('0x8e')]){_0xdb6438[_0x43ac00['joins'][_0x4d6a3a][_0xfe1d('0x32')]](_0x43ac00['joins'][_0x4d6a3a]['foreignTable'],null,util[_0xfe1d('0x76')]('%s.%s\x20=\x20%s.%s',_0x43ac00[_0xfe1d('0x71')],_0x43ac00[_0xfe1d('0x7c')][_0x4d6a3a][_0xfe1d('0x7e')],_0x43ac00[_0xfe1d('0x7c')][_0x4d6a3a][_0xfe1d('0x7f')],_0x43ac00[_0xfe1d('0x7c')][_0x4d6a3a][_0xfe1d('0x8e')]));}}}if(_0x43ac00[_0xfe1d('0x81')]){_0x43ac00[_0xfe1d('0x81')]=JSON[_0xfe1d('0x7d')](_0x43ac00[_0xfe1d('0x81')]);_0xdb6438[_0xfe1d('0x3d')](_0x5a10fe(_0x43ac00[_0xfe1d('0x81')]['group']));}_0x51b304=_0xdb6438[_0xfe1d('0x82')]();_0xdb6438[_0xfe1d('0x1f')](_0x561894);_0xdb6438[_0xfe1d('0x1e')](0x0);logger[_0xfe1d('0x8f')](_0xfe1d('0x90'),_0xdb6438['toString']());return db[_0xfe1d('0x83')][_0xfe1d('0x34')](_0xdb6438[_0xfe1d('0x91')](),{'type':db[_0xfe1d('0x83')][_0xfe1d('0x84')]['SELECT']});}})[_0xfe1d('0x2a')](function(){return{'sql':_0x51b304[_0xfe1d('0x91')]()};})[_0xfe1d('0x2a')](respondWithResult(_0x546264,null))[_0xfe1d('0x4c')](handleError(_0x546264,null));}; \ No newline at end of file +var _0x4aa6=['moment','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','get','DefaultReports','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','include','find','create','role','user','Reports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','preview','join','left_join','cross_join','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','group','condition','value','getFields','keyBy','select','from','MetricId','metric','field','function','replace','format','orderBy','alias','joins','parse','type','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','clone','debug','toString','sequelize','SELECT','right_join','SUM(%s)','COUNT(DISTINCT\x20%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20EMPTY','ValidationErrorItem','AnalyticMetric','groupBy','DESC','Limited\x20Query:','QueryTypes','No\x20available\x20data','output','web','fullPath','%s-%s.%s','randomstring','generate','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','savename','countTable','COUNT(*)','runReport','Please\x20insert\x20at\x20least\x20one\x20field','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x334787,_0x1220a4){var _0x545b65=function(_0x1fe4cb){while(--_0x1fe4cb){_0x334787['push'](_0x334787['shift']());}};_0x545b65(++_0x1220a4);}(_0x4aa6,0xa1));var _0x64aa=function(_0x23eb70,_0x865e90){_0x23eb70=_0x23eb70-0x0;var _0x589671=_0x4aa6[_0x23eb70];return _0x589671;};'use strict';var pdf=require(_0x64aa('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x64aa('0x1'));var zipdir=require(_0x64aa('0x2'));var jsonpatch=require(_0x64aa('0x3'));var rp=require(_0x64aa('0x4'));var moment=require(_0x64aa('0x5'));var BPromise=require(_0x64aa('0x6'));var Mustache=require('mustache');var util=require(_0x64aa('0x7'));var path=require('path');var sox=require(_0x64aa('0x8'));var csv=require(_0x64aa('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x64aa('0xa'));var squel=require(_0x64aa('0xb'));var crypto=require(_0x64aa('0xc'));var jsforce=require(_0x64aa('0xd'));var deskjs=require(_0x64aa('0xe'));var toCsv=require('to-csv');var querystring=require(_0x64aa('0xf'));var Papa=require(_0x64aa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x64aa('0x11'));var as=require(_0x64aa('0x12'));var hardwareService=require(_0x64aa('0x13'));var logger=require(_0x64aa('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x64aa('0x15'));var db=require(_0x64aa('0x16'))['db'];var dbH=require('../../mysqldb')['dbH'];function respondWithStatusCode(_0x1b8335,_0x1571a1){_0x1571a1=_0x1571a1||0xcc;return function(_0x50912b){if(_0x50912b){return _0x1b8335[_0x64aa('0x17')](_0x1571a1);}return _0x1b8335['status'](_0x1571a1)[_0x64aa('0x18')]();};}function respondWithResult(_0x4c592a,_0xfcf1ac){_0xfcf1ac=_0xfcf1ac||0xc8;return function(_0x4ae147){if(_0x4ae147){return _0x4c592a[_0x64aa('0x19')](_0xfcf1ac)[_0x64aa('0x1a')](_0x4ae147);}};}function respondWithFilteredResult(_0x85e0bf,_0x17933f){return function(_0x1ba814){if(_0x1ba814){var _0x64d966=_0x1ba814['count'],_0x4ab317=_0x17933f[_0x64aa('0x1b')],_0x1ba4db=_0x17933f[_0x64aa('0x1b')]+_0x17933f[_0x64aa('0x1c')],_0x2cc277;if(_0x1ba4db>=_0x64d966){_0x1ba4db=_0x64d966;_0x2cc277=0xc8;}else{_0x2cc277=0xce;}_0x85e0bf['status'](_0x2cc277);return _0x85e0bf[_0x64aa('0x1d')](_0x64aa('0x1e'),_0x4ab317+'-'+_0x1ba4db+'/'+_0x64d966)[_0x64aa('0x1a')](_0x1ba814);}return null;};}function patchUpdates(_0x3a44f3){return function(_0x1a4847){try{jsonpatch[_0x64aa('0x1f')](_0x1a4847,_0x3a44f3,!![]);}catch(_0x28351){return BPromise[_0x64aa('0x20')](_0x28351);}return _0x1a4847[_0x64aa('0x21')]();};}function saveUpdates(_0x5acf6e,_0x162613){return function(_0x2ce059){if(_0x2ce059){return _0x2ce059[_0x64aa('0x22')](_0x5acf6e)[_0x64aa('0x23')](function(_0x1f98c3){return _0x1f98c3;});}return null;};}function removeEntity(_0x302127,_0x822a0d){return function(_0x46430e){if(_0x46430e){return _0x46430e['destroy']()[_0x64aa('0x23')](function(){var _0x905c7d=_0x46430e[_0x64aa('0x24')]({'plain':!![]});var _0x4e6ace=_0x64aa('0x25');return db[_0x64aa('0x26')][_0x64aa('0x27')]({'where':{'type':_0x4e6ace,'resourceId':_0x905c7d['id']}})[_0x64aa('0x23')](function(){return _0x46430e;});})[_0x64aa('0x23')](function(){_0x302127[_0x64aa('0x19')](0xcc)[_0x64aa('0x18')]();});}};}function handleEntityNotFound(_0x16b08d,_0x3885c5){return function(_0x228e03){if(!_0x228e03){_0x16b08d[_0x64aa('0x17')](0x194);}return _0x228e03;};}function handleError(_0x2f836a,_0x517a92){_0x517a92=_0x517a92||0x1f4;return function(_0x545f4){logger[_0x64aa('0x28')](_0x545f4[_0x64aa('0x29')]);if(_0x545f4[_0x64aa('0x2a')]){delete _0x545f4[_0x64aa('0x2a')];}_0x2f836a[_0x64aa('0x19')](_0x517a92)[_0x64aa('0x2b')](_0x545f4);};}exports[_0x64aa('0x2c')]=function(_0x74d12a,_0x219878){var _0x2d1ecf={},_0x36ec33={},_0x1035cc={'count':0x0,'rows':[]};var _0x5cc1fa=_[_0x64aa('0x2d')](db[_0x64aa('0x2e')][_0x64aa('0x2f')],function(_0x417379){return{'name':_0x417379[_0x64aa('0x30')],'type':_0x417379['type'][_0x64aa('0x31')]};});_0x36ec33[_0x64aa('0x32')]=_[_0x64aa('0x2d')](_0x5cc1fa,'name');_0x36ec33[_0x64aa('0x33')]=_[_0x64aa('0x34')](_0x74d12a['query']);_0x36ec33['filters']=_[_0x64aa('0x35')](_0x36ec33[_0x64aa('0x32')],_0x36ec33[_0x64aa('0x33')]);_0x2d1ecf['attributes']=_[_0x64aa('0x35')](_0x36ec33['model'],qs[_0x64aa('0x36')](_0x74d12a['query'][_0x64aa('0x36')]));_0x2d1ecf[_0x64aa('0x37')]=_0x2d1ecf[_0x64aa('0x37')][_0x64aa('0x38')]?_0x2d1ecf[_0x64aa('0x37')]:_0x36ec33[_0x64aa('0x32')];if(!_0x74d12a['query'][_0x64aa('0x39')]('nolimit')){_0x2d1ecf[_0x64aa('0x1c')]=qs[_0x64aa('0x1c')](_0x74d12a['query'][_0x64aa('0x1c')]);_0x2d1ecf[_0x64aa('0x1b')]=qs['offset'](_0x74d12a['query'][_0x64aa('0x1b')]);}_0x2d1ecf[_0x64aa('0x3a')]=qs[_0x64aa('0x3b')](_0x74d12a['query'][_0x64aa('0x3b')]);_0x2d1ecf[_0x64aa('0x3c')]=qs[_0x64aa('0x3d')](_[_0x64aa('0x3e')](_0x74d12a[_0x64aa('0x33')],_0x36ec33[_0x64aa('0x3d')]),_0x5cc1fa);if(_0x74d12a['query'][_0x64aa('0x3f')]){_0x2d1ecf[_0x64aa('0x3c')]=_[_0x64aa('0x40')](_0x2d1ecf[_0x64aa('0x3c')],{'$or':_['map'](_0x5cc1fa,function(_0x466104){if(_0x466104['type']!==_0x64aa('0x41')){var _0x5b675c={};_0x5b675c[_0x466104[_0x64aa('0x2a')]]={'$like':'%'+_0x74d12a[_0x64aa('0x33')]['filter']+'%'};return _0x5b675c;}})});}_0x2d1ecf=_['merge']({},_0x2d1ecf,_0x74d12a[_0x64aa('0x42')]);var _0x5eb92d={'where':_0x2d1ecf[_0x64aa('0x3c')]};return db['AnalyticDefaultReport'][_0x64aa('0x43')](_0x5eb92d)[_0x64aa('0x23')](function(_0x28265a){_0x1035cc[_0x64aa('0x43')]=_0x28265a;if(_0x74d12a[_0x64aa('0x33')][_0x64aa('0x44')]){_0x2d1ecf['include']=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x64aa('0x45')](_0x2d1ecf);})[_0x64aa('0x23')](function(_0x8b4770){_0x1035cc[_0x64aa('0x46')]=_0x8b4770;return _0x1035cc;})[_0x64aa('0x23')](respondWithFilteredResult(_0x219878,_0x2d1ecf))[_0x64aa('0x47')](handleError(_0x219878,null));};exports[_0x64aa('0x48')]=function(_0x2146eb,_0x432856){var _0x2faf13={'raw':!![],'where':{'id':_0x2146eb['params']['id']}},_0x3ba846={};_0x3ba846['model']=_[_0x64aa('0x34')](db['AnalyticDefaultReport']['rawAttributes']);_0x3ba846[_0x64aa('0x33')]=_[_0x64aa('0x34')](_0x2146eb['query']);_0x3ba846[_0x64aa('0x3d')]=_[_0x64aa('0x35')](_0x3ba846[_0x64aa('0x32')],_0x3ba846[_0x64aa('0x33')]);_0x2faf13[_0x64aa('0x37')]=_[_0x64aa('0x35')](_0x3ba846[_0x64aa('0x32')],qs['fields'](_0x2146eb[_0x64aa('0x33')][_0x64aa('0x36')]));_0x2faf13['attributes']=_0x2faf13['attributes'][_0x64aa('0x38')]?_0x2faf13['attributes']:_0x3ba846[_0x64aa('0x32')];if(_0x2146eb[_0x64aa('0x33')][_0x64aa('0x44')]){_0x2faf13[_0x64aa('0x49')]=[{'all':!![]}];}_0x2faf13=_[_0x64aa('0x40')]({},_0x2faf13,_0x2146eb[_0x64aa('0x42')]);return db[_0x64aa('0x2e')][_0x64aa('0x4a')](_0x2faf13)[_0x64aa('0x23')](handleEntityNotFound(_0x432856,null))[_0x64aa('0x23')](respondWithResult(_0x432856,null))['catch'](handleError(_0x432856,null));};exports[_0x64aa('0x4b')]=function(_0x336482,_0x5cacad){return db[_0x64aa('0x2e')][_0x64aa('0x4b')](_0x336482['body'],{})[_0x64aa('0x23')](function(_0x5aed62){var _0x13b655=_0x336482['user']['get']({'plain':!![]});if(!_0x13b655)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x13b655[_0x64aa('0x4c')]===_0x64aa('0x4d')){var _0x57cf62=_0x5aed62[_0x64aa('0x24')]({'plain':!![]});var _0x4a9e99=_0x64aa('0x4e');return db['UserProfileSection'][_0x64aa('0x4a')]({'where':{'name':_0x4a9e99,'userProfileId':_0x13b655['userProfileId']},'raw':!![]})[_0x64aa('0x23')](function(_0x2d5317){if(_0x2d5317&&_0x2d5317['autoAssociation']===0x0){return db[_0x64aa('0x26')]['create']({'name':_0x57cf62[_0x64aa('0x2a')],'resourceId':_0x57cf62['id'],'type':_0x64aa('0x25'),'sectionId':_0x2d5317['id']},{})[_0x64aa('0x23')](function(){return _0x5aed62;});}else{return _0x5aed62;}})[_0x64aa('0x47')](function(_0x52dc6b){logger[_0x64aa('0x28')](_0x64aa('0x4f'),_0x52dc6b);throw _0x52dc6b;});}return _0x5aed62;})[_0x64aa('0x23')](respondWithResult(_0x5cacad,0xc9))[_0x64aa('0x47')](handleError(_0x5cacad,null));};exports[_0x64aa('0x22')]=function(_0x26388e,_0x4f13fd){if(_0x26388e['body']['id']){delete _0x26388e[_0x64aa('0x50')]['id'];}return db[_0x64aa('0x2e')]['find']({'where':{'id':_0x26388e[_0x64aa('0x51')]['id']}})[_0x64aa('0x23')](handleEntityNotFound(_0x4f13fd,null))[_0x64aa('0x23')](saveUpdates(_0x26388e[_0x64aa('0x50')],null))['then'](respondWithResult(_0x4f13fd,null))['catch'](handleError(_0x4f13fd,null));};exports[_0x64aa('0x27')]=function(_0x32d19c,_0x34f952){return db[_0x64aa('0x2e')]['find']({'where':{'id':_0x32d19c[_0x64aa('0x51')]['id']}})[_0x64aa('0x23')](handleEntityNotFound(_0x34f952,null))['then'](removeEntity(_0x34f952,null))[_0x64aa('0x47')](handleError(_0x34f952,null));};exports[_0x64aa('0x52')]=function(_0xb3ecbc,_0x4ab3e4){var _0x3c8655=0xa;var _0x260738=[_0x64aa('0x53'),_0x64aa('0x54'),'right_join',_0x64aa('0x55')];var _0x4f6927={'SUM':'SUM(%s)','COUNT':_0x64aa('0x56'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x64aa('0x57'),'MIN':_0x64aa('0x58'),'AVG':_0x64aa('0x59'),'GROUP_CONCAT':_0x64aa('0x5a'),'GROUP_CONCAT ASC':_0x64aa('0x5b'),'GROUP_CONCAT DESC':_0x64aa('0x5c')};var _0x43e4f6={'SEC_TO_TIME':_0x64aa('0x5d'),'DATE':_0x64aa('0x5e'),'HOUR':'HOUR(%s)','ROUND':_0x64aa('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3728f4=function(_0x5199df){return!_[_0x64aa('0x60')](['IS\x20NULL',_0x64aa('0x61'),_0x64aa('0x62'),'IS\x20NOT\x20EMPTY'],_0x5199df);};var _0x3bbba9=function(_0x5caab2){if(!_0x5caab2||!_0x5caab2[_0x64aa('0x63')]['length']){return'';}for(var _0x3d64b3='(',_0x5d0e97=0x0;_0x5d0e97<_0x5caab2['rules'][_0x64aa('0x38')];_0x5d0e97+=0x1){_0x5d0e97>0x0&&(_0x3d64b3+='\x20'+_0x5caab2[_0x64aa('0x64')]+'\x20');_0x3d64b3+=_0x5caab2[_0x64aa('0x63')][_0x5d0e97][_0x64aa('0x65')]?_0x3bbba9(_0x5caab2[_0x64aa('0x63')][_0x5d0e97][_0x64aa('0x65')]):_0x5caab2['rules'][_0x5d0e97]['field']+'\x20'+_0x5caab2[_0x64aa('0x63')][_0x5d0e97][_0x64aa('0x66')]+(_0x3728f4(_0x5caab2['rules'][_0x5d0e97][_0x64aa('0x66')])?'\x20'+_0x5caab2[_0x64aa('0x63')][_0x5d0e97][_0x64aa('0x67')]:'');}return _0x3d64b3+')';};var _0x8c408c={'where':{'id':_0xb3ecbc[_0x64aa('0x51')]['id']}},_0x41d266,_0xe7e5c3,_0x170086,_0x54ca89,_0x1eecba;_0x8c408c=_[_0x64aa('0x40')]({},_0x8c408c,_0xb3ecbc['options']);return db[_0x64aa('0x2e')][_0x64aa('0x4a')](_0x8c408c)[_0x64aa('0x23')](function(_0x3fb746){if(_0x3fb746){_0x41d266=_0x3fb746;return _0x3fb746[_0x64aa('0x68')]();}return null;})[_0x64aa('0x23')](function(_0x3ef35e){if(_0x3ef35e){if(!_0x3ef35e[_0x64aa('0x38')]){throw new db['Sequelize']['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xe7e5c3=_0x3ef35e;return db['AnalyticMetric'][_0x64aa('0x45')]({'raw':!![]});}return null;})[_0x64aa('0x23')](function(_0xabe30a){if(_0xabe30a){_0x170086=_[_0x64aa('0x69')](_0xabe30a,'id');var _0x12a418;var _0x49de3a=squel[_0x64aa('0x6a')]();_0x49de3a[_0x64aa('0x6b')](_0x41d266['table']);for(var _0x198f0e=0x0;_0x198f0e<_0xe7e5c3[_0x64aa('0x38')];_0x198f0e+=0x1){_0x12a418=_0xe7e5c3[_0x198f0e][_0x64aa('0x6c')]?_0x170086[_0xe7e5c3[_0x198f0e][_0x64aa('0x6c')]][_0x64aa('0x6d')]:_0xe7e5c3[_0x198f0e][_0x64aa('0x6e')];_0x12a418=_0xe7e5c3[_0x198f0e][_0x64aa('0x6f')]?_[_0x64aa('0x70')](_0x4f6927[_0xe7e5c3[_0x198f0e][_0x64aa('0x6f')]],'%s',_0x12a418):_0x12a418;_0x12a418=_0xe7e5c3[_0x198f0e]['format']?_[_0x64aa('0x70')](_0x43e4f6[_0xe7e5c3[_0x198f0e][_0x64aa('0x71')]],'%s',_0x12a418):_0x12a418;if(_0xe7e5c3[_0x198f0e]['groupBy']){_0x49de3a[_0x64aa('0x65')](_0x12a418);}_0xe7e5c3[_0x198f0e][_0x64aa('0x72')]&&_0x49de3a[_0x64aa('0x3a')](_0x12a418,_0xe7e5c3[_0x198f0e][_0x64aa('0x72')]==='DESC'?![]:!![]);_0x49de3a[_0x64aa('0x6e')](_0x12a418,_0xe7e5c3[_0x198f0e][_0x64aa('0x73')]||_0x12a418);}if(_0x41d266[_0x64aa('0x74')]){_0x41d266[_0x64aa('0x74')]=JSON[_0x64aa('0x75')](_0x41d266[_0x64aa('0x74')]);for(var _0xc03f4c=0x0;_0xc03f4c<_0x41d266[_0x64aa('0x74')][_0x64aa('0x38')];_0xc03f4c+=0x1){if(_0x41d266[_0x64aa('0x74')][_0xc03f4c]['type']&&_[_0x64aa('0x60')](_0x260738,_0x41d266['joins'][_0xc03f4c][_0x64aa('0x76')])&&_0x41d266[_0x64aa('0x74')][_0xc03f4c][_0x64aa('0x77')]&&_0x41d266[_0x64aa('0x74')][_0xc03f4c][_0x64aa('0x78')]&&_0x41d266[_0x64aa('0x74')][_0xc03f4c][_0x64aa('0x79')]){_0x49de3a[_0x41d266['joins'][_0xc03f4c][_0x64aa('0x76')]](_0x41d266[_0x64aa('0x74')][_0xc03f4c][_0x64aa('0x78')],null,util[_0x64aa('0x71')](_0x64aa('0x7a'),_0x41d266[_0x64aa('0x7b')],_0x41d266[_0x64aa('0x74')][_0xc03f4c]['parentKey'],_0x41d266[_0x64aa('0x74')][_0xc03f4c][_0x64aa('0x78')],_0x41d266[_0x64aa('0x74')][_0xc03f4c][_0x64aa('0x79')]));}}}if(_0x41d266[_0x64aa('0x7c')]){_0x41d266[_0x64aa('0x7c')]=JSON[_0x64aa('0x75')](_0x41d266[_0x64aa('0x7c')]);_0x49de3a[_0x64aa('0x3c')](_0x3bbba9(_0x41d266['conditions']['group']));}_0x1eecba=_0x49de3a[_0x64aa('0x7d')]();_0x49de3a['limit'](_0x3c8655);_0x49de3a[_0x64aa('0x1b')](0x0);logger[_0x64aa('0x7e')]('Limited\x20Query:',_0x49de3a[_0x64aa('0x7f')]());return db[_0x64aa('0x80')][_0x64aa('0x33')](_0x49de3a[_0x64aa('0x7f')](),{'type':db[_0x64aa('0x80')]['QueryTypes'][_0x64aa('0x81')]});}})[_0x64aa('0x23')](respondWithResult(_0x4ab3e4,null))[_0x64aa('0x47')](handleError(_0x4ab3e4,null));};function runReport(_0xa4ea9a,_0x134231,_0x4ed544){var _0x151509=_0x134231[_0x64aa('0x2a')];var _0x4dbc78=0xa;var _0x50d3bc=['join',_0x64aa('0x54'),_0x64aa('0x82'),_0x64aa('0x55')];var _0xb8c72f={'SUM':_0x64aa('0x83'),'COUNT':_0x64aa('0x56'),'COUNT DISTINCT':_0x64aa('0x84'),'MAX':_0x64aa('0x57'),'MIN':'MIN(%s)','AVG':_0x64aa('0x59'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x64aa('0x5b'),'GROUP_CONCAT DESC':_0x64aa('0x5c')};var _0xa44c88={'SEC_TO_TIME':_0x64aa('0x5d'),'DATE':'DATE(%s)','HOUR':_0x64aa('0x85'),'ROUND':_0x64aa('0x5f'),'UNIX_TIMESTAMP':_0x64aa('0x86')};var _0x31d0d6=function(_0x3e37b2){return!_['includes']([_0x64aa('0x87'),_0x64aa('0x61'),_0x64aa('0x62'),_0x64aa('0x88')],_0x3e37b2);};var _0x348781=function(_0x396453){if(!_0x396453||!_0x396453[_0x64aa('0x63')][_0x64aa('0x38')]){return'';}for(var _0x8113eb='(',_0x4a2229=0x0;_0x4a2229<_0x396453[_0x64aa('0x63')]['length'];_0x4a2229+=0x1){_0x4a2229>0x0&&(_0x8113eb+='\x20'+_0x396453[_0x64aa('0x64')]+'\x20');_0x8113eb+=_0x396453['rules'][_0x4a2229][_0x64aa('0x65')]?_0x348781(_0x396453[_0x64aa('0x63')][_0x4a2229][_0x64aa('0x65')]):_0x396453[_0x64aa('0x63')][_0x4a2229]['field']+'\x20'+_0x396453['rules'][_0x4a2229][_0x64aa('0x66')]+(_0x31d0d6(_0x396453[_0x64aa('0x63')][_0x4a2229][_0x64aa('0x66')])?'\x20'+_0x396453[_0x64aa('0x63')][_0x4a2229][_0x64aa('0x67')]:'');}return _0x8113eb+')';};var _0x3c19ec={'where':{'id':_0xa4ea9a['id']}},_0xe5c120,_0x3cfdaf,_0x5428bf,_0x1e39cd,_0x2bdcef;_0x3c19ec=_[_0x64aa('0x40')]({},_0x3c19ec,_0x4ed544);return db['AnalyticDefaultReport'][_0x64aa('0x4a')](_0x3c19ec)[_0x64aa('0x23')](function(_0x285a9b){if(_0x285a9b){_0xe5c120=_0x285a9b;return _0x285a9b[_0x64aa('0x68')]();}return null;})[_0x64aa('0x23')](function(_0x468aca){if(_0x468aca){if(!_0x468aca['length']){throw new db['Sequelize'][(_0x64aa('0x89'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x3cfdaf=_0x468aca;return db[_0x64aa('0x8a')][_0x64aa('0x45')]({'raw':!![]});}return null;})[_0x64aa('0x23')](function(_0x7cbb1){if(_0x7cbb1){_0x5428bf=_[_0x64aa('0x69')](_0x7cbb1,'id');var _0x8e6010;var _0x3e28e1=squel[_0x64aa('0x6a')]();_0x3e28e1[_0x64aa('0x6b')](_0xe5c120[_0x64aa('0x7b')]);for(var _0x4d584c=0x0;_0x4d584c<_0x3cfdaf[_0x64aa('0x38')];_0x4d584c+=0x1){_0x8e6010=_0x3cfdaf[_0x4d584c]['MetricId']?_0x5428bf[_0x3cfdaf[_0x4d584c][_0x64aa('0x6c')]][_0x64aa('0x6d')]:_0x3cfdaf[_0x4d584c][_0x64aa('0x6e')];_0x8e6010=_0x3cfdaf[_0x4d584c]['function']?_[_0x64aa('0x70')](_0xb8c72f[_0x3cfdaf[_0x4d584c][_0x64aa('0x6f')]],'%s',_0x8e6010):_0x8e6010;_0x8e6010=_0x3cfdaf[_0x4d584c]['format']?_['replace'](_0xa44c88[_0x3cfdaf[_0x4d584c][_0x64aa('0x71')]],'%s',_0x8e6010):_0x8e6010;if(_0x3cfdaf[_0x4d584c][_0x64aa('0x8b')]){_0x3e28e1[_0x64aa('0x65')](_0x8e6010);}_0x3cfdaf[_0x4d584c][_0x64aa('0x72')]&&_0x3e28e1[_0x64aa('0x3a')](_0x8e6010,_0x3cfdaf[_0x4d584c]['orderBy']===_0x64aa('0x8c')?![]:!![]);_0x3e28e1['field'](_0x8e6010,_0x3cfdaf[_0x4d584c]['alias']||_0x8e6010);}if(_0xe5c120['joins']){_0xe5c120['joins']=JSON[_0x64aa('0x75')](_0xe5c120[_0x64aa('0x74')]);for(var _0x36fb01=0x0;_0x36fb01<_0xe5c120[_0x64aa('0x74')][_0x64aa('0x38')];_0x36fb01+=0x1){if(_0xe5c120[_0x64aa('0x74')][_0x36fb01][_0x64aa('0x76')]&&_[_0x64aa('0x60')](_0x50d3bc,_0xe5c120[_0x64aa('0x74')][_0x36fb01]['type'])&&_0xe5c120[_0x64aa('0x74')][_0x36fb01][_0x64aa('0x77')]&&_0xe5c120[_0x64aa('0x74')][_0x36fb01][_0x64aa('0x78')]&&_0xe5c120[_0x64aa('0x74')][_0x36fb01][_0x64aa('0x79')]){_0x3e28e1[_0xe5c120[_0x64aa('0x74')][_0x36fb01][_0x64aa('0x76')]](_0xe5c120[_0x64aa('0x74')][_0x36fb01][_0x64aa('0x78')],null,util[_0x64aa('0x71')](_0x64aa('0x7a'),_0xe5c120[_0x64aa('0x7b')],_0xe5c120[_0x64aa('0x74')][_0x36fb01][_0x64aa('0x77')],_0xe5c120['joins'][_0x36fb01][_0x64aa('0x78')],_0xe5c120[_0x64aa('0x74')][_0x36fb01]['foreignKey']));}}}if(_0xe5c120[_0x64aa('0x7c')]){_0xe5c120['conditions']=JSON[_0x64aa('0x75')](_0xe5c120[_0x64aa('0x7c')]);_0x3e28e1[_0x64aa('0x3c')](_0x348781(_0xe5c120[_0x64aa('0x7c')][_0x64aa('0x65')]));}_0x2bdcef=_0x3e28e1[_0x64aa('0x7d')]();_0x3e28e1[_0x64aa('0x1c')](_0x4dbc78);_0x3e28e1[_0x64aa('0x1b')](0x0);logger[_0x64aa('0x7e')](_0x64aa('0x8d'),_0x3e28e1[_0x64aa('0x7f')]());return db[_0x64aa('0x80')]['query'](_0x3e28e1['toString'](),{'type':db['sequelize'][_0x64aa('0x8e')][_0x64aa('0x81')]});}})[_0x64aa('0x23')](function(_0x5ac092){if(!_0x5ac092[_0x64aa('0x38')]){throw new db['Sequelize'][(_0x64aa('0x89'))](_0x64aa('0x8f'),0xcc);}if(_0x134231[_0x64aa('0x90')]===_0x64aa('0x91')){return null;}var _0x48e938=_[_0x64aa('0x40')](_0x134231,{'name':_0x134231[_0x64aa('0x92')]||_0x134231[_0x64aa('0x2a')]||_0xe5c120['name'],'basename':_0x151509,'savename':util[_0x64aa('0x71')](_0x64aa('0x93'),_0x134231[_0x64aa('0x2a')]||_0xe5c120['name'],require(_0x64aa('0x94'))[_0x64aa('0x95')](0x4),_0x134231[_0x64aa('0x90')]||'csv'),'reportId':_0xe5c120['id'],'reportType':_0x64aa('0x96')});return db[_0x64aa('0x97')]['create'](_0x48e938,{'raw':!![]});})[_0x64aa('0x23')](function(_0x5dc0a2){if(_0xe5c120[_0x64aa('0x7b')]===_0x64aa('0x98')){_0x2bdcef[_0x64aa('0x3c')](_0xe5c120[_0x64aa('0x7b')]+_0x64aa('0x99'),_0x134231[_0x64aa('0x9a')],_0x134231['endDate']);}else{_0x2bdcef['where'](_0xe5c120[_0x64aa('0x7b')]+_0x64aa('0x9b'),_0x134231[_0x64aa('0x9a')],_0x134231['endDate']);}if(_0x5dc0a2){logger[_0x64aa('0x9c')](_0x64aa('0x9d'),_0x2bdcef[_0x64aa('0x7f')]());require(_0x64aa('0x9e'))[_0x64aa('0x9f')](path[_0x64aa('0x53')](__dirname,_0x64aa('0xa0'),_0x5dc0a2[_0x64aa('0x90')]),[_0x5dc0a2['id'],_0x2bdcef[_0x64aa('0x7f')](),path['join'](__dirname,'../../files/reports',_0x5dc0a2[_0x64aa('0xa1')]),_0x151509]);return _0x5dc0a2;}else{var _0x505b6c=squel['select']();_0x505b6c[_0x64aa('0x6b')]('('+_0x2bdcef[_0x64aa('0x7f')]()+')',_0x64aa('0xa2'));_0x505b6c[_0x64aa('0x6e')](_0x64aa('0xa3'),_0x64aa('0x43'));_0x2bdcef['limit'](_0x134231[_0x64aa('0x1c')]||_0x4dbc78);_0x2bdcef['offset'](_0x134231[_0x64aa('0x1b')]||0x0);return dbH[_0x64aa('0x80')][_0x64aa('0x33')](_0x505b6c['toString'](),{'type':dbH[_0x64aa('0x80')][_0x64aa('0x8e')][_0x64aa('0x81')]})[_0x64aa('0x23')](function(_0x46af83){if(!_0x46af83[_0x64aa('0x38')]){_0x1e39cd=0x0;}else{_0x1e39cd=_0x46af83[0x0][_0x64aa('0x43')]||0x0;}return dbH['sequelize'][_0x64aa('0x33')](_0x2bdcef['toString'](),{'type':dbH[_0x64aa('0x80')][_0x64aa('0x8e')][_0x64aa('0x81')]});})[_0x64aa('0x23')](function(_0x3bd9ff){return{'rows':_0x3bd9ff||[],'count':_0x1e39cd};});}});}exports['run']=function(_0x24027b,_0x3f8c17){return runReport(_0x24027b['params'],_0x24027b[_0x64aa('0x33')],_0x24027b[_0x64aa('0x42')])['then'](respondWithResult(_0x3f8c17,null))['catch'](handleError(_0x3f8c17,null));};exports[_0x64aa('0xa4')]=runReport;exports['query']=function(_0x5c7e95,_0x40d607){var _0x5590e4=0xa;var _0x24593a=['join','left_join','right_join',_0x64aa('0x55')];var _0x2a98b1={'SUM':_0x64aa('0x83'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x64aa('0x57'),'MIN':_0x64aa('0x58'),'AVG':_0x64aa('0x59'),'GROUP_CONCAT':_0x64aa('0x5a'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x64aa('0x5c')};var _0x3dfceb={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x64aa('0x85'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x64aa('0x86')};var _0x3a8bbb=function(_0x386e2b){return!_[_0x64aa('0x60')](['IS\x20NULL',_0x64aa('0x61'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x386e2b);};var _0x286023=function(_0x3c4447){if(!_0x3c4447||!_0x3c4447['rules'][_0x64aa('0x38')]){return'';}for(var _0x227539='(',_0x4eefb5=0x0;_0x4eefb5<_0x3c4447['rules']['length'];_0x4eefb5+=0x1){_0x4eefb5>0x0&&(_0x227539+='\x20'+_0x3c4447[_0x64aa('0x64')]+'\x20');_0x227539+=_0x3c4447[_0x64aa('0x63')][_0x4eefb5][_0x64aa('0x65')]?_0x286023(_0x3c4447[_0x64aa('0x63')][_0x4eefb5]['group']):_0x3c4447[_0x64aa('0x63')][_0x4eefb5][_0x64aa('0x6e')]+'\x20'+_0x3c4447[_0x64aa('0x63')][_0x4eefb5][_0x64aa('0x66')]+(_0x3a8bbb(_0x3c4447[_0x64aa('0x63')][_0x4eefb5][_0x64aa('0x66')])?'\x20'+_0x3c4447[_0x64aa('0x63')][_0x4eefb5]['value']:'');}return _0x227539+')';};var _0xc3e66e={'where':{'id':_0x5c7e95['params']['id']}},_0x1ef337,_0x1d3118,_0x474969,_0x332027,_0x3695cf;_0xc3e66e=_[_0x64aa('0x40')]({},_0xc3e66e,_0x5c7e95[_0x64aa('0x42')]);return db['AnalyticDefaultReport'][_0x64aa('0x4a')](_0xc3e66e)[_0x64aa('0x23')](function(_0x348380){if(_0x348380){_0x1ef337=_0x348380;return _0x348380[_0x64aa('0x68')]();}return null;})[_0x64aa('0x23')](function(_0x40c053){if(_0x40c053){if(!_0x40c053['length']){throw new db['Sequelize'][(_0x64aa('0x89'))](_0x64aa('0xa5'),0x193);}_0x1d3118=_0x40c053;return db[_0x64aa('0x8a')][_0x64aa('0x45')]({'raw':!![]});}return null;})['then'](function(_0x44d8b3){if(_0x44d8b3){_0x474969=_['keyBy'](_0x44d8b3,'id');var _0x498e8a;var _0x337bc1=squel[_0x64aa('0x6a')]();_0x337bc1['from'](_0x1ef337[_0x64aa('0x7b')]);for(var _0x503c24=0x0;_0x503c24<_0x1d3118[_0x64aa('0x38')];_0x503c24+=0x1){_0x498e8a=_0x1d3118[_0x503c24]['MetricId']?_0x474969[_0x1d3118[_0x503c24][_0x64aa('0x6c')]][_0x64aa('0x6d')]:_0x1d3118[_0x503c24][_0x64aa('0x6e')];_0x498e8a=_0x1d3118[_0x503c24][_0x64aa('0x6f')]?_[_0x64aa('0x70')](_0x2a98b1[_0x1d3118[_0x503c24]['function']],'%s',_0x498e8a):_0x498e8a;_0x498e8a=_0x1d3118[_0x503c24][_0x64aa('0x71')]?_[_0x64aa('0x70')](_0x3dfceb[_0x1d3118[_0x503c24][_0x64aa('0x71')]],'%s',_0x498e8a):_0x498e8a;if(_0x1d3118[_0x503c24][_0x64aa('0x8b')]){_0x337bc1[_0x64aa('0x65')](_0x498e8a);}_0x1d3118[_0x503c24][_0x64aa('0x72')]&&_0x337bc1[_0x64aa('0x3a')](_0x498e8a,_0x1d3118[_0x503c24][_0x64aa('0x72')]===_0x64aa('0x8c')?![]:!![]);_0x337bc1[_0x64aa('0x6e')](_0x498e8a,_0x1d3118[_0x503c24][_0x64aa('0x73')]||_0x498e8a);}if(_0x1ef337[_0x64aa('0x74')]){_0x1ef337[_0x64aa('0x74')]=JSON[_0x64aa('0x75')](_0x1ef337[_0x64aa('0x74')]);for(var _0x56c683=0x0;_0x56c683<_0x1ef337[_0x64aa('0x74')][_0x64aa('0x38')];_0x56c683+=0x1){if(_0x1ef337[_0x64aa('0x74')][_0x56c683][_0x64aa('0x76')]&&_[_0x64aa('0x60')](_0x24593a,_0x1ef337[_0x64aa('0x74')][_0x56c683][_0x64aa('0x76')])&&_0x1ef337[_0x64aa('0x74')][_0x56c683]['parentKey']&&_0x1ef337[_0x64aa('0x74')][_0x56c683]['foreignTable']&&_0x1ef337[_0x64aa('0x74')][_0x56c683][_0x64aa('0x79')]){_0x337bc1[_0x1ef337[_0x64aa('0x74')][_0x56c683][_0x64aa('0x76')]](_0x1ef337[_0x64aa('0x74')][_0x56c683]['foreignTable'],null,util[_0x64aa('0x71')](_0x64aa('0x7a'),_0x1ef337[_0x64aa('0x7b')],_0x1ef337['joins'][_0x56c683][_0x64aa('0x77')],_0x1ef337['joins'][_0x56c683]['foreignTable'],_0x1ef337[_0x64aa('0x74')][_0x56c683]['foreignKey']));}}}if(_0x1ef337[_0x64aa('0x7c')]){_0x1ef337[_0x64aa('0x7c')]=JSON[_0x64aa('0x75')](_0x1ef337['conditions']);_0x337bc1[_0x64aa('0x3c')](_0x286023(_0x1ef337[_0x64aa('0x7c')][_0x64aa('0x65')]));}_0x3695cf=_0x337bc1[_0x64aa('0x7d')]();_0x337bc1[_0x64aa('0x1c')](_0x5590e4);_0x337bc1[_0x64aa('0x1b')](0x0);logger[_0x64aa('0x7e')]('Limited\x20Query:',_0x337bc1[_0x64aa('0x7f')]());return db[_0x64aa('0x80')]['query'](_0x337bc1[_0x64aa('0x7f')](),{'type':db[_0x64aa('0x80')][_0x64aa('0x8e')]['SELECT']});}})['then'](function(){return{'sql':_0x3695cf[_0x64aa('0x7f')]()};})[_0x64aa('0x23')](respondWithResult(_0x40d607,null))[_0x64aa('0x47')](handleError(_0x40d607,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 45dc590..e0c91f4 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 _0xc3c4=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','AnalyticDefaultReport','analytics_default_reports','lodash','../../config/logger'];(function(_0xddddab,_0x2f147e){var _0x57e97f=function(_0x1e21d1){while(--_0x1e21d1){_0xddddab['push'](_0xddddab['shift']());}};_0x57e97f(++_0x2f147e);}(_0xc3c4,0xf5));var _0x4c3c=function(_0x104064,_0x26ee24){_0x104064=_0x104064-0x0;var _0x23e0c3=_0xc3c4[_0x104064];return _0x23e0c3;};'use strict';var _=require(_0x4c3c('0x0'));var util=require('util');var logger=require(_0x4c3c('0x1'))(_0x4c3c('0x2'));var moment=require(_0x4c3c('0x3'));var BPromise=require(_0x4c3c('0x4'));var rp=require(_0x4c3c('0x5'));var fs=require('fs');var path=require(_0x4c3c('0x6'));var rimraf=require(_0x4c3c('0x7'));var config=require(_0x4c3c('0x8'));var attributes=require(_0x4c3c('0x9'));module[_0x4c3c('0xa')]=function(_0x1f93e5,_0x10cc5f){return _0x1f93e5['define'](_0x4c3c('0xb'),attributes,{'tableName':_0x4c3c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe57e=['lodash','../../config/logger','api','moment','path','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe57e,0xf2));var _0xee57=function(_0x509259,_0x1580ba){_0x509259=_0x509259-0x0;var _0x35ab14=_0xe57e[_0x509259];return _0x35ab14;};'use strict';var _=require(_0xee57('0x0'));var util=require('util');var logger=require(_0xee57('0x1'))(_0xee57('0x2'));var moment=require(_0xee57('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xee57('0x4'));var rimraf=require('rimraf');var config=require(_0xee57('0x5'));var attributes=require(_0xee57('0x6'));module[_0xee57('0x7')]=function(_0x4e21c4,_0x491334){return _0x4e21c4[_0xee57('0x8')](_0xee57('0x9'),attributes,{'tableName':_0xee57('0xa'),'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 3dbbdd9..387fb88 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 _0xd64b=['message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1daad3,_0x3d060a){var _0x2483dd=function(_0x4c4328){while(--_0x4c4328){_0x1daad3['push'](_0x1daad3['shift']());}};_0x2483dd(++_0x3d060a);}(_0xd64b,0xc1));var _0xbd64=function(_0x21140e,_0x5d3c73){_0x21140e=_0x21140e-0x0;var _0x5d6eff=_0xd64b[_0x21140e];return _0x5d6eff;};'use strict';var _=require(_0xbd64('0x0'));var util=require('util');var moment=require(_0xbd64('0x1'));var BPromise=require('bluebird');var rs=require(_0xbd64('0x2'));var fs=require('fs');var Redis=require(_0xbd64('0x3'));var db=require(_0xbd64('0x4'))['db'];var utils=require(_0xbd64('0x5'));var logger=require(_0xbd64('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xbd64('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x32995f,_0x3e700e,_0x38204e){return new BPromise(function(_0x3f1f17,_0x2b8543){return client[_0xbd64('0x8')](_0x32995f,_0x38204e)['then'](function(_0x5ae70c){logger[_0xbd64('0x9')](_0xbd64('0xa'),_0x3e700e,_0xbd64('0xb'));logger['debug'](_0xbd64('0xc'),_0x3e700e,_0xbd64('0xb'),JSON[_0xbd64('0xd')](_0x5ae70c));if(_0x5ae70c[_0xbd64('0xe')]){if(_0x5ae70c['error'][_0xbd64('0xf')]===0x1f4){logger['error'](_0xbd64('0xa'),_0x3e700e,_0x5ae70c[_0xbd64('0xe')][_0xbd64('0x10')]);return _0x2b8543(_0x5ae70c[_0xbd64('0xe')][_0xbd64('0x10')]);}logger[_0xbd64('0xe')](_0xbd64('0xa'),_0x3e700e,_0x5ae70c[_0xbd64('0xe')][_0xbd64('0x10')]);return _0x3f1f17(_0x5ae70c['error'][_0xbd64('0x10')]);}else{logger[_0xbd64('0x9')](_0xbd64('0xa'),_0x3e700e,_0xbd64('0xb'));_0x3f1f17(_0x5ae70c[_0xbd64('0x11')]['message']);}})[_0xbd64('0x12')](function(_0x5332e0){logger[_0xbd64('0xe')](_0xbd64('0xa'),_0x3e700e,_0x5332e0);_0x2b8543(_0x5332e0);});});} \ No newline at end of file +var _0xca56=['AnalyticDefaultReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x699e9,_0x3d6129){var _0x337e14=function(_0x799938){while(--_0x799938){_0x699e9['push'](_0x699e9['shift']());}};_0x337e14(++_0x3d6129);}(_0xca56,0xee));var _0x6ca5=function(_0x2f3953,_0x32e35b){_0x2f3953=_0x2f3953-0x0;var _0x2085de=_0xca56[_0x2f3953];return _0x2085de;};'use strict';var _=require(_0x6ca5('0x0'));var util=require(_0x6ca5('0x1'));var moment=require(_0x6ca5('0x2'));var BPromise=require(_0x6ca5('0x3'));var rs=require(_0x6ca5('0x4'));var fs=require('fs');var Redis=require(_0x6ca5('0x5'));var db=require(_0x6ca5('0x6'))['db'];var utils=require(_0x6ca5('0x7'));var logger=require(_0x6ca5('0x8'))('rpc');var config=require(_0x6ca5('0x9'));var jayson=require(_0x6ca5('0xa'));var client=jayson[_0x6ca5('0xb')][_0x6ca5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x529cbe,_0x3b2f91,_0x232b31){return new BPromise(function(_0x511b48,_0x586799){return client[_0x6ca5('0xd')](_0x529cbe,_0x232b31)[_0x6ca5('0xe')](function(_0x1d5253){logger[_0x6ca5('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3b2f91,'request\x20sent');logger[_0x6ca5('0x10')](_0x6ca5('0x11'),_0x3b2f91,_0x6ca5('0x12'),JSON[_0x6ca5('0x13')](_0x1d5253));if(_0x1d5253[_0x6ca5('0x14')]){if(_0x1d5253['error'][_0x6ca5('0x15')]===0x1f4){logger['error'](_0x6ca5('0x16'),_0x3b2f91,_0x1d5253['error']['message']);return _0x586799(_0x1d5253[_0x6ca5('0x14')]['message']);}logger['error'](_0x6ca5('0x16'),_0x3b2f91,_0x1d5253[_0x6ca5('0x14')]['message']);return _0x511b48(_0x1d5253[_0x6ca5('0x14')][_0x6ca5('0x17')]);}else{logger['info'](_0x6ca5('0x16'),_0x3b2f91,_0x6ca5('0x12'));_0x511b48(_0x1d5253[_0x6ca5('0x18')][_0x6ca5('0x17')]);}})[_0x6ca5('0x19')](function(_0x48c164){logger[_0x6ca5('0x14')](_0x6ca5('0x16'),_0x3b2f91,_0x48c164);_0x586799(_0x48c164);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 2a6c49b..e5cfa1d 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 _0x576c=['query','post','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','/:id','show','get','/:id/preview','preview','/:id/run','run','/:id/query'];(function(_0x38eb23,_0x196e8b){var _0x48506a=function(_0x36edb0){while(--_0x36edb0){_0x38eb23['push'](_0x38eb23['shift']());}};_0x48506a(++_0x196e8b);}(_0x576c,0x13f));var _0xc576=function(_0x1a69d2,_0x316b1d){_0x1a69d2=_0x1a69d2-0x0;var _0x6a6e44=_0x576c[_0x1a69d2];return _0x6a6e44;};'use strict';var multer=require('multer');var util=require(_0xc576('0x0'));var path=require(_0xc576('0x1'));var timeout=require(_0xc576('0x2'));var express=require(_0xc576('0x3'));var router=express[_0xc576('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xc576('0x5'));var config=require(_0xc576('0x6'));var controller=require(_0xc576('0x7'));router['get']('/',auth[_0xc576('0x8')](),controller['index']);router['get'](_0xc576('0x9'),auth[_0xc576('0x8')](),controller[_0xc576('0xa')]);router[_0xc576('0xb')](_0xc576('0xc'),auth[_0xc576('0x8')](),controller[_0xc576('0xd')]);router[_0xc576('0xb')](_0xc576('0xe'),auth[_0xc576('0x8')](),controller[_0xc576('0xf')]);router[_0xc576('0xb')](_0xc576('0x10'),auth[_0xc576('0x8')](),controller[_0xc576('0x11')]);router[_0xc576('0x12')]('/',auth[_0xc576('0x8')](),controller[_0xc576('0x13')]);router['put'](_0xc576('0x9'),auth[_0xc576('0x8')](),controller[_0xc576('0x14')]);router[_0xc576('0x15')](_0xc576('0x9'),auth[_0xc576('0x8')](),controller[_0xc576('0x16')]);module[_0xc576('0x17')]=router; \ No newline at end of file +var _0x029b=['isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','put','update','delete','destroy','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x2b9120,_0x4cba82){var _0x459db0=function(_0x5753b5){while(--_0x5753b5){_0x2b9120['push'](_0x2b9120['shift']());}};_0x459db0(++_0x4cba82);}(_0x029b,0x11f));var _0xb029=function(_0x452fc1,_0x9a1268){_0x452fc1=_0x452fc1-0x0;var _0x19860e=_0x029b[_0x452fc1];return _0x19860e;};'use strict';var multer=require(_0xb029('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb029('0x1'));var express=require(_0xb029('0x2'));var router=express['Router']();var auth=require(_0xb029('0x3'));var interaction=require(_0xb029('0x4'));var config=require(_0xb029('0x5'));var controller=require('./analyticDefaultReport.controller');router[_0xb029('0x6')]('/',auth[_0xb029('0x7')](),controller[_0xb029('0x8')]);router[_0xb029('0x6')](_0xb029('0x9'),auth[_0xb029('0x7')](),controller[_0xb029('0xa')]);router['get'](_0xb029('0xb'),auth[_0xb029('0x7')](),controller[_0xb029('0xc')]);router[_0xb029('0x6')](_0xb029('0xd'),auth['isAuthenticated'](),controller[_0xb029('0xe')]);router[_0xb029('0x6')](_0xb029('0xf'),auth[_0xb029('0x7')](),controller[_0xb029('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xb029('0x11')](_0xb029('0x9'),auth['isAuthenticated'](),controller[_0xb029('0x12')]);router[_0xb029('0x13')](_0xb029('0x9'),auth[_0xb029('0x7')](),controller[_0xb029('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 8167918..50512dd 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 _0x3fd0=['exports','STRING','ENUM','csv','pdf','xlsx','DATE','Loading','scheduled','manual','INTEGER','UNSIGNED'];(function(_0x3ca454,_0x34e294){var _0x2dd303=function(_0x465890){while(--_0x465890){_0x3ca454['push'](_0x3ca454['shift']());}};_0x2dd303(++_0x34e294);}(_0x3fd0,0x144));var _0x03fd=function(_0x143559,_0x24f9b0){_0x143559=_0x143559-0x0;var _0x66b778=_0x3fd0[_0x143559];return _0x66b778;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x03fd('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x03fd('0x1')],'allowNull':![]},'output':{'type':Sequelize[_0x03fd('0x2')](_0x03fd('0x3'),_0x03fd('0x4'),_0x03fd('0x5')),'allowNull':![],'defaultValue':_0x03fd('0x3')},'savename':{'type':Sequelize[_0x03fd('0x1')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x03fd('0x6')]},'status':{'type':Sequelize[_0x03fd('0x1')],'defaultValue':_0x03fd('0x7')},'type':{'type':Sequelize[_0x03fd('0x2')]('manual',_0x03fd('0x8')),'allowNull':![],'defaultValue':_0x03fd('0x9')},'reportId':{'type':Sequelize[_0x03fd('0xa')](0xb)[_0x03fd('0xb')]},'reportType':{'type':Sequelize[_0x03fd('0x1')]}}; \ No newline at end of file +var _0xeabd=['exports','ENUM','pdf','xlsx','csv','STRING','DATE','manual','UNSIGNED','sequelize','moment'];(function(_0x32738a,_0x2f4dcd){var _0x404c12=function(_0x2958cb){while(--_0x2958cb){_0x32738a['push'](_0x32738a['shift']());}};_0x404c12(++_0x2f4dcd);}(_0xeabd,0x1c1));var _0xdeab=function(_0x29d46f,_0x100347){_0x29d46f=_0x29d46f-0x0;var _0x1815aa=_0xeabd[_0x29d46f];return _0x1815aa;};'use strict';var Sequelize=require(_0xdeab('0x0'));var moment=require(_0xdeab('0x1'));module[_0xdeab('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0xdeab('0x3')]('csv',_0xdeab('0x4'),_0xdeab('0x5')),'allowNull':![],'defaultValue':_0xdeab('0x6')},'savename':{'type':Sequelize[_0xdeab('0x7')],'allowNull':![]},'startDate':{'type':Sequelize[_0xdeab('0x8')]},'endDate':{'type':Sequelize[_0xdeab('0x8')]},'status':{'type':Sequelize[_0xdeab('0x7')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0xdeab('0x3')](_0xdeab('0x9'),'scheduled'),'allowNull':![],'defaultValue':_0xdeab('0x9')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0xdeab('0xa')]},'reportType':{'type':Sequelize[_0xdeab('0x7')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 5d08264..5eeb7c2 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 _0x5aec=['sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','error','stack','index','AnalyticExtractedReport','fieldName','type','key','model','map','name','keys','intersection','query','attributes','fields','length','nolimit','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','options','catch','create','body','ExtractedReports','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','download','basename','savename','output','join','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','root','format','%s.%s','toLowerCase','html-pdf','eml-format','zip-dir','request-promise','bluebird','mustache','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0x5aec,0x19a));var _0xc5ae=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x5aec[_0x19950b];return _0x3c6b41;};'use strict';var pdf=require(_0xc5ae('0x0'));var emlformat=require(_0xc5ae('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc5ae('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc5ae('0x3'));var moment=require('moment');var BPromise=require(_0xc5ae('0x4'));var Mustache=require(_0xc5ae('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xc5ae('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc5ae('0x7'));var squel=require(_0xc5ae('0x8'));var crypto=require(_0xc5ae('0x9'));var jsforce=require(_0xc5ae('0xa'));var deskjs=require(_0xc5ae('0xb'));var toCsv=require(_0xc5ae('0x6'));var querystring=require(_0xc5ae('0xc'));var Papa=require(_0xc5ae('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc5ae('0xe'));var as=require(_0xc5ae('0xf'));var hardwareService=require(_0xc5ae('0x10'));var logger=require('../../config/logger')(_0xc5ae('0x11'));var utils=require(_0xc5ae('0x12'));var config=require(_0xc5ae('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x551c31,_0x1ff9d1){_0x1ff9d1=_0x1ff9d1||0xcc;return function(_0x3d0632){if(_0x3d0632){return _0x551c31[_0xc5ae('0x14')](_0x1ff9d1);}return _0x551c31[_0xc5ae('0x15')](_0x1ff9d1)[_0xc5ae('0x16')]();};}function respondWithResult(_0xd6b466,_0x102df9){_0x102df9=_0x102df9||0xc8;return function(_0x4729ad){if(_0x4729ad){return _0xd6b466['status'](_0x102df9)[_0xc5ae('0x17')](_0x4729ad);}};}function respondWithFilteredResult(_0x5d9dc8,_0x2ab8dd){return function(_0x3f6bea){if(_0x3f6bea){var _0x95e073=_0x3f6bea[_0xc5ae('0x18')],_0x2f05ae=_0x2ab8dd[_0xc5ae('0x19')],_0x480f21=_0x2ab8dd['offset']+_0x2ab8dd[_0xc5ae('0x1a')],_0x56b577;if(_0x480f21>=_0x95e073){_0x480f21=_0x95e073;_0x56b577=0xc8;}else{_0x56b577=0xce;}_0x5d9dc8[_0xc5ae('0x15')](_0x56b577);return _0x5d9dc8[_0xc5ae('0x1b')](_0xc5ae('0x1c'),_0x2f05ae+'-'+_0x480f21+'/'+_0x95e073)['json'](_0x3f6bea);}return null;};}function patchUpdates(_0x86f7e3){return function(_0x38b7b3){try{jsonpatch[_0xc5ae('0x1d')](_0x38b7b3,_0x86f7e3,!![]);}catch(_0x5aebed){return BPromise[_0xc5ae('0x1e')](_0x5aebed);}return _0x38b7b3[_0xc5ae('0x1f')]();};}function saveUpdates(_0x4d9aca,_0x2355c2){return function(_0x5e1b35){if(_0x5e1b35){return _0x5e1b35[_0xc5ae('0x20')](_0x4d9aca)['then'](function(_0x6497eb){return _0x6497eb;});}return null;};}function removeEntity(_0x244477,_0x397ad0){return function(_0x4eee0a){if(_0x4eee0a){return _0x4eee0a[_0xc5ae('0x21')]()[_0xc5ae('0x22')](function(){var _0x369935=_0x4eee0a[_0xc5ae('0x23')]({'plain':!![]});var _0x12fd57='ExtractedReports';return db['UserProfileResource'][_0xc5ae('0x21')]({'where':{'type':_0x12fd57,'resourceId':_0x369935['id']}})[_0xc5ae('0x22')](function(){return _0x4eee0a;});})['then'](function(){_0x244477['status'](0xcc)[_0xc5ae('0x16')]();});}};}function handleEntityNotFound(_0x408b72,_0x59d7df){return function(_0x4eedd7){if(!_0x4eedd7){_0x408b72[_0xc5ae('0x14')](0x194);}return _0x4eedd7;};}function handleError(_0x2ce582,_0x565c17){_0x565c17=_0x565c17||0x1f4;return function(_0x135c82){logger[_0xc5ae('0x24')](_0x135c82[_0xc5ae('0x25')]);if(_0x135c82['name']){delete _0x135c82['name'];}_0x2ce582[_0xc5ae('0x15')](_0x565c17)['send'](_0x135c82);};}exports[_0xc5ae('0x26')]=function(_0x4be3d1,_0x495235){var _0x4f9c6a={},_0x1ce6c5={},_0xae1123={'count':0x0,'rows':[]};var _0x4b843d=_['map'](db[_0xc5ae('0x27')]['rawAttributes'],function(_0x14115b){return{'name':_0x14115b[_0xc5ae('0x28')],'type':_0x14115b[_0xc5ae('0x29')][_0xc5ae('0x2a')]};});_0x1ce6c5[_0xc5ae('0x2b')]=_[_0xc5ae('0x2c')](_0x4b843d,_0xc5ae('0x2d'));_0x1ce6c5['query']=_[_0xc5ae('0x2e')](_0x4be3d1['query']);_0x1ce6c5['filters']=_[_0xc5ae('0x2f')](_0x1ce6c5[_0xc5ae('0x2b')],_0x1ce6c5[_0xc5ae('0x30')]);_0x4f9c6a[_0xc5ae('0x31')]=_[_0xc5ae('0x2f')](_0x1ce6c5[_0xc5ae('0x2b')],qs[_0xc5ae('0x32')](_0x4be3d1[_0xc5ae('0x30')][_0xc5ae('0x32')]));_0x4f9c6a[_0xc5ae('0x31')]=_0x4f9c6a[_0xc5ae('0x31')][_0xc5ae('0x33')]?_0x4f9c6a[_0xc5ae('0x31')]:_0x1ce6c5[_0xc5ae('0x2b')];if(!_0x4be3d1['query']['hasOwnProperty'](_0xc5ae('0x34'))){_0x4f9c6a[_0xc5ae('0x1a')]=qs[_0xc5ae('0x1a')](_0x4be3d1[_0xc5ae('0x30')][_0xc5ae('0x1a')]);_0x4f9c6a[_0xc5ae('0x19')]=qs['offset'](_0x4be3d1[_0xc5ae('0x30')]['offset']);}_0x4f9c6a['order']=qs[_0xc5ae('0x35')](_0x4be3d1[_0xc5ae('0x30')][_0xc5ae('0x35')]);_0x4f9c6a[_0xc5ae('0x36')]=qs[_0xc5ae('0x37')](_['pick'](_0x4be3d1[_0xc5ae('0x30')],_0x1ce6c5[_0xc5ae('0x37')]),_0x4b843d);if(_0x4be3d1[_0xc5ae('0x30')][_0xc5ae('0x38')]){_0x4f9c6a[_0xc5ae('0x36')]=_[_0xc5ae('0x39')](_0x4f9c6a[_0xc5ae('0x36')],{'$or':_[_0xc5ae('0x2c')](_0x4b843d,function(_0x403d13){if(_0x403d13[_0xc5ae('0x29')]!==_0xc5ae('0x3a')){var _0x5dd546={};_0x5dd546[_0x403d13[_0xc5ae('0x2d')]]={'$like':'%'+_0x4be3d1['query']['filter']+'%'};return _0x5dd546;}})});}_0x4f9c6a=_[_0xc5ae('0x39')]({},_0x4f9c6a,_0x4be3d1['options']);var _0x49cf10={'where':_0x4f9c6a['where']};return db['AnalyticExtractedReport']['count'](_0x49cf10)['then'](function(_0x2e0536){_0xae1123['count']=_0x2e0536;if(_0x4be3d1['query'][_0xc5ae('0x3b')]){_0x4f9c6a[_0xc5ae('0x3c')]=[{'all':!![]}];}return db[_0xc5ae('0x27')][_0xc5ae('0x3d')](_0x4f9c6a);})[_0xc5ae('0x22')](function(_0xd810d2){_0xae1123[_0xc5ae('0x3e')]=_0xd810d2;return _0xae1123;})['then'](respondWithFilteredResult(_0x495235,_0x4f9c6a))['catch'](handleError(_0x495235,null));};exports['show']=function(_0x33e21,_0x25c41d){var _0x5f05c8={'raw':!![],'where':{'id':_0x33e21['params']['id']}},_0x57d350={};_0x57d350['model']=_['keys'](db[_0xc5ae('0x27')]['rawAttributes']);_0x57d350[_0xc5ae('0x30')]=_[_0xc5ae('0x2e')](_0x33e21['query']);_0x57d350[_0xc5ae('0x37')]=_[_0xc5ae('0x2f')](_0x57d350[_0xc5ae('0x2b')],_0x57d350[_0xc5ae('0x30')]);_0x5f05c8['attributes']=_[_0xc5ae('0x2f')](_0x57d350[_0xc5ae('0x2b')],qs[_0xc5ae('0x32')](_0x33e21[_0xc5ae('0x30')][_0xc5ae('0x32')]));_0x5f05c8['attributes']=_0x5f05c8[_0xc5ae('0x31')][_0xc5ae('0x33')]?_0x5f05c8[_0xc5ae('0x31')]:_0x57d350['model'];if(_0x33e21[_0xc5ae('0x30')][_0xc5ae('0x3b')]){_0x5f05c8['include']=[{'all':!![]}];}_0x5f05c8=_['merge']({},_0x5f05c8,_0x33e21[_0xc5ae('0x3f')]);return db[_0xc5ae('0x27')]['find'](_0x5f05c8)[_0xc5ae('0x22')](handleEntityNotFound(_0x25c41d,null))[_0xc5ae('0x22')](respondWithResult(_0x25c41d,null))[_0xc5ae('0x40')](handleError(_0x25c41d,null));};exports[_0xc5ae('0x41')]=function(_0x3d0de9,_0x5ae1d3){return db[_0xc5ae('0x27')][_0xc5ae('0x41')](_0x3d0de9[_0xc5ae('0x42')],{})[_0xc5ae('0x22')](function(_0x4c24d8){var _0x5a9344=_0x3d0de9['user'][_0xc5ae('0x23')]({'plain':!![]});if(!_0x5a9344)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a9344['role']==='user'){var _0x1f100e=_0x4c24d8[_0xc5ae('0x23')]({'plain':!![]});var _0x5979b1=_0xc5ae('0x43');return db[_0xc5ae('0x44')][_0xc5ae('0x45')]({'where':{'name':_0x5979b1,'userProfileId':_0x5a9344[_0xc5ae('0x46')]},'raw':!![]})[_0xc5ae('0x22')](function(_0x1aaa5){if(_0x1aaa5&&_0x1aaa5['autoAssociation']===0x0){return db[_0xc5ae('0x47')][_0xc5ae('0x41')]({'name':_0x1f100e[_0xc5ae('0x2d')],'resourceId':_0x1f100e['id'],'type':_0x1aaa5[_0xc5ae('0x2d')],'sectionId':_0x1aaa5['id']},{})[_0xc5ae('0x22')](function(){return _0x4c24d8;});}else{return _0x4c24d8;}})[_0xc5ae('0x40')](function(_0x391ae6){logger['error'](_0xc5ae('0x48'),_0x391ae6);throw _0x391ae6;});}return _0x4c24d8;})[_0xc5ae('0x22')](respondWithResult(_0x5ae1d3,0xc9))[_0xc5ae('0x40')](handleError(_0x5ae1d3,null));};exports[_0xc5ae('0x20')]=function(_0x19ca05,_0x43532f){if(_0x19ca05['body']['id']){delete _0x19ca05[_0xc5ae('0x42')]['id'];}return db[_0xc5ae('0x27')][_0xc5ae('0x45')]({'where':{'id':_0x19ca05[_0xc5ae('0x49')]['id']}})['then'](handleEntityNotFound(_0x43532f,null))[_0xc5ae('0x22')](saveUpdates(_0x19ca05[_0xc5ae('0x42')],null))[_0xc5ae('0x22')](respondWithResult(_0x43532f,null))[_0xc5ae('0x40')](handleError(_0x43532f,null));};exports['destroy']=function(_0x23ce62,_0x283b4e){return db[_0xc5ae('0x27')]['find']({'where':{'id':_0x23ce62['params']['id']}})[_0xc5ae('0x22')](handleEntityNotFound(_0x283b4e,null))[_0xc5ae('0x22')](removeEntity(_0x283b4e,null))[_0xc5ae('0x40')](handleError(_0x283b4e,null));};exports[_0xc5ae('0x4a')]=function(_0x359bcd,_0x45c81a,_0xb8b803){return db[_0xc5ae('0x27')]['find']({'where':{'id':_0x359bcd[_0xc5ae('0x49')]['id']},'attributes':[_0xc5ae('0x2d'),_0xc5ae('0x4b'),_0xc5ae('0x4c'),_0xc5ae('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0x45c81a,null))['then'](function(_0x3357ed){if(_0x3357ed){if(!fs['existsSync'](path[_0xc5ae('0x4e')](config['root'],_0xc5ae('0x4f'),_0x3357ed[_0xc5ae('0x4c')]))){throw new db['Sequelize'][(_0xc5ae('0x50'))](_0xc5ae('0x51'));}if(_0x359bcd[_0xc5ae('0x30')]['exists']){return _0x45c81a[_0xc5ae('0x14')](0xc8);}return _0x45c81a['download'](path[_0xc5ae('0x4e')](config[_0xc5ae('0x52')],'server/files/reports',_0x3357ed[_0xc5ae('0x4c')]),util[_0xc5ae('0x53')](_0xc5ae('0x54'),_0x3357ed[_0xc5ae('0x4b')]||_0x3357ed[_0xc5ae('0x2d')],_0x3357ed[_0xc5ae('0x4d')][_0xc5ae('0x55')]()));}})['catch'](handleError(_0x45c81a,null));}; \ No newline at end of file +var _0x2949=['bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','set','Content-Range','apply','reject','destroy','get','ExtractedReports','UserProfileResource','then','end','sendStatus','error','name','index','map','AnalyticExtractedReport','model','query','attributes','intersection','fields','length','hasOwnProperty','limit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','count','include','rows','catch','params','keys','rawAttributes','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','download','basename','savename','join','root','server/files/reports','Sequelize','exists','%s.%s','toLowerCase','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment'];(function(_0xf66a25,_0x527689){var _0x231422=function(_0x164b05){while(--_0x164b05){_0xf66a25['push'](_0xf66a25['shift']());}};_0x231422(++_0x527689);}(_0x2949,0x1ad));var _0x9294=function(_0x15449d,_0x537b1d){_0x15449d=_0x15449d-0x0;var _0x55cf8c=_0x2949[_0x15449d];return _0x55cf8c;};'use strict';var pdf=require(_0x9294('0x0'));var emlformat=require(_0x9294('0x1'));var rimraf=require(_0x9294('0x2'));var zipdir=require(_0x9294('0x3'));var jsonpatch=require(_0x9294('0x4'));var rp=require('request-promise');var moment=require(_0x9294('0x5'));var BPromise=require(_0x9294('0x6'));var Mustache=require(_0x9294('0x7'));var util=require('util');var path=require(_0x9294('0x8'));var sox=require(_0x9294('0x9'));var csv=require('to-csv');var ejs=require(_0x9294('0xa'));var fs=require('fs');var _=require(_0x9294('0xb'));var squel=require(_0x9294('0xc'));var crypto=require(_0x9294('0xd'));var jsforce=require(_0x9294('0xe'));var deskjs=require(_0x9294('0xf'));var toCsv=require(_0x9294('0x10'));var querystring=require(_0x9294('0x11'));var Papa=require(_0x9294('0x12'));var Redis=require(_0x9294('0x13'));var authService=require(_0x9294('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9294('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x9294('0x16'));var config=require(_0x9294('0x17'));var db=require(_0x9294('0x18'))['db'];function respondWithStatusCode(_0x685de8,_0x3c6303){_0x3c6303=_0x3c6303||0xcc;return function(_0x384275){if(_0x384275){return _0x685de8['sendStatus'](_0x3c6303);}return _0x685de8[_0x9294('0x19')](_0x3c6303)['end']();};}function respondWithResult(_0x4e066f,_0x538fec){_0x538fec=_0x538fec||0xc8;return function(_0x36e364){if(_0x36e364){return _0x4e066f[_0x9294('0x19')](_0x538fec)[_0x9294('0x1a')](_0x36e364);}};}function respondWithFilteredResult(_0x2b8e72,_0x2264d8){return function(_0x676a1e){if(_0x676a1e){var _0x1fa3ae=_0x676a1e['count'],_0x8f662d=_0x2264d8[_0x9294('0x1b')],_0xb1e4b1=_0x2264d8[_0x9294('0x1b')]+_0x2264d8['limit'],_0x3e6c44;if(_0xb1e4b1>=_0x1fa3ae){_0xb1e4b1=_0x1fa3ae;_0x3e6c44=0xc8;}else{_0x3e6c44=0xce;}_0x2b8e72[_0x9294('0x19')](_0x3e6c44);return _0x2b8e72[_0x9294('0x1c')](_0x9294('0x1d'),_0x8f662d+'-'+_0xb1e4b1+'/'+_0x1fa3ae)[_0x9294('0x1a')](_0x676a1e);}return null;};}function patchUpdates(_0xb78cb9){return function(_0x4dd4b0){try{jsonpatch[_0x9294('0x1e')](_0x4dd4b0,_0xb78cb9,!![]);}catch(_0x5b6831){return BPromise[_0x9294('0x1f')](_0x5b6831);}return _0x4dd4b0['save']();};}function saveUpdates(_0x13e6fc,_0x14cfa4){return function(_0x181aea){if(_0x181aea){return _0x181aea['update'](_0x13e6fc)['then'](function(_0x31277b){return _0x31277b;});}return null;};}function removeEntity(_0x3fe0c9,_0xfec0a0){return function(_0x47dcea){if(_0x47dcea){return _0x47dcea[_0x9294('0x20')]()['then'](function(){var _0x538b00=_0x47dcea[_0x9294('0x21')]({'plain':!![]});var _0xa2abfe=_0x9294('0x22');return db[_0x9294('0x23')][_0x9294('0x20')]({'where':{'type':_0xa2abfe,'resourceId':_0x538b00['id']}})[_0x9294('0x24')](function(){return _0x47dcea;});})[_0x9294('0x24')](function(){_0x3fe0c9[_0x9294('0x19')](0xcc)[_0x9294('0x25')]();});}};}function handleEntityNotFound(_0x5f4d65,_0x31d9f8){return function(_0x2797be){if(!_0x2797be){_0x5f4d65[_0x9294('0x26')](0x194);}return _0x2797be;};}function handleError(_0x1dd9bd,_0x4402c5){_0x4402c5=_0x4402c5||0x1f4;return function(_0x506a2d){logger[_0x9294('0x27')](_0x506a2d['stack']);if(_0x506a2d['name']){delete _0x506a2d[_0x9294('0x28')];}_0x1dd9bd[_0x9294('0x19')](_0x4402c5)['send'](_0x506a2d);};}exports[_0x9294('0x29')]=function(_0x3e1acb,_0xc14a36){var _0x516a02={},_0x49ef54={},_0x2edced={'count':0x0,'rows':[]};var _0x1f2e40=_[_0x9294('0x2a')](db[_0x9294('0x2b')]['rawAttributes'],function(_0x1511e8){return{'name':_0x1511e8['fieldName'],'type':_0x1511e8['type']['key']};});_0x49ef54[_0x9294('0x2c')]=_['map'](_0x1f2e40,_0x9294('0x28'));_0x49ef54['query']=_['keys'](_0x3e1acb[_0x9294('0x2d')]);_0x49ef54['filters']=_['intersection'](_0x49ef54[_0x9294('0x2c')],_0x49ef54[_0x9294('0x2d')]);_0x516a02[_0x9294('0x2e')]=_[_0x9294('0x2f')](_0x49ef54[_0x9294('0x2c')],qs[_0x9294('0x30')](_0x3e1acb[_0x9294('0x2d')]['fields']));_0x516a02[_0x9294('0x2e')]=_0x516a02[_0x9294('0x2e')][_0x9294('0x31')]?_0x516a02[_0x9294('0x2e')]:_0x49ef54[_0x9294('0x2c')];if(!_0x3e1acb[_0x9294('0x2d')][_0x9294('0x32')]('nolimit')){_0x516a02['limit']=qs[_0x9294('0x33')](_0x3e1acb[_0x9294('0x2d')][_0x9294('0x33')]);_0x516a02[_0x9294('0x1b')]=qs[_0x9294('0x1b')](_0x3e1acb[_0x9294('0x2d')][_0x9294('0x1b')]);}_0x516a02['order']=qs[_0x9294('0x34')](_0x3e1acb[_0x9294('0x2d')][_0x9294('0x34')]);_0x516a02[_0x9294('0x35')]=qs[_0x9294('0x36')](_[_0x9294('0x37')](_0x3e1acb[_0x9294('0x2d')],_0x49ef54['filters']),_0x1f2e40);if(_0x3e1acb[_0x9294('0x2d')][_0x9294('0x38')]){_0x516a02['where']=_[_0x9294('0x39')](_0x516a02[_0x9294('0x35')],{'$or':_[_0x9294('0x2a')](_0x1f2e40,function(_0x31cd46){if(_0x31cd46[_0x9294('0x3a')]!==_0x9294('0x3b')){var _0x38a6c0={};_0x38a6c0[_0x31cd46[_0x9294('0x28')]]={'$like':'%'+_0x3e1acb['query']['filter']+'%'};return _0x38a6c0;}})});}_0x516a02=_['merge']({},_0x516a02,_0x3e1acb[_0x9294('0x3c')]);var _0x5009a0={'where':_0x516a02[_0x9294('0x35')]};return db[_0x9294('0x2b')][_0x9294('0x3d')](_0x5009a0)['then'](function(_0x5bb363){_0x2edced[_0x9294('0x3d')]=_0x5bb363;if(_0x3e1acb['query']['includeAll']){_0x516a02[_0x9294('0x3e')]=[{'all':!![]}];}return db[_0x9294('0x2b')]['findAll'](_0x516a02);})['then'](function(_0x1825c8){_0x2edced[_0x9294('0x3f')]=_0x1825c8;return _0x2edced;})[_0x9294('0x24')](respondWithFilteredResult(_0xc14a36,_0x516a02))[_0x9294('0x40')](handleError(_0xc14a36,null));};exports['show']=function(_0x7f878a,_0x38e78d){var _0x7c0498={'raw':!![],'where':{'id':_0x7f878a[_0x9294('0x41')]['id']}},_0xb69a9a={};_0xb69a9a[_0x9294('0x2c')]=_[_0x9294('0x42')](db[_0x9294('0x2b')][_0x9294('0x43')]);_0xb69a9a[_0x9294('0x2d')]=_[_0x9294('0x42')](_0x7f878a['query']);_0xb69a9a[_0x9294('0x36')]=_['intersection'](_0xb69a9a[_0x9294('0x2c')],_0xb69a9a['query']);_0x7c0498[_0x9294('0x2e')]=_[_0x9294('0x2f')](_0xb69a9a[_0x9294('0x2c')],qs[_0x9294('0x30')](_0x7f878a[_0x9294('0x2d')][_0x9294('0x30')]));_0x7c0498['attributes']=_0x7c0498[_0x9294('0x2e')]['length']?_0x7c0498['attributes']:_0xb69a9a['model'];if(_0x7f878a[_0x9294('0x2d')][_0x9294('0x44')]){_0x7c0498['include']=[{'all':!![]}];}_0x7c0498=_[_0x9294('0x39')]({},_0x7c0498,_0x7f878a[_0x9294('0x3c')]);return db[_0x9294('0x2b')][_0x9294('0x45')](_0x7c0498)[_0x9294('0x24')](handleEntityNotFound(_0x38e78d,null))[_0x9294('0x24')](respondWithResult(_0x38e78d,null))[_0x9294('0x40')](handleError(_0x38e78d,null));};exports[_0x9294('0x46')]=function(_0x7e72eb,_0x131e07){return db[_0x9294('0x2b')][_0x9294('0x46')](_0x7e72eb['body'],{})[_0x9294('0x24')](function(_0x37ffa3){var _0x4c2eae=_0x7e72eb['user'][_0x9294('0x21')]({'plain':!![]});if(!_0x4c2eae)throw new Error(_0x9294('0x47'));if(_0x4c2eae['role']==='user'){var _0x41ba10=_0x37ffa3[_0x9294('0x21')]({'plain':!![]});var _0x3eb8f2='ExtractedReports';return db[_0x9294('0x48')]['find']({'where':{'name':_0x3eb8f2,'userProfileId':_0x4c2eae['userProfileId']},'raw':!![]})[_0x9294('0x24')](function(_0x26ae19){if(_0x26ae19&&_0x26ae19[_0x9294('0x49')]===0x0){return db[_0x9294('0x23')]['create']({'name':_0x41ba10[_0x9294('0x28')],'resourceId':_0x41ba10['id'],'type':_0x26ae19[_0x9294('0x28')],'sectionId':_0x26ae19['id']},{})['then'](function(){return _0x37ffa3;});}else{return _0x37ffa3;}})['catch'](function(_0x413310){logger[_0x9294('0x27')](_0x9294('0x4a'),_0x413310);throw _0x413310;});}return _0x37ffa3;})[_0x9294('0x24')](respondWithResult(_0x131e07,0xc9))[_0x9294('0x40')](handleError(_0x131e07,null));};exports[_0x9294('0x4b')]=function(_0x31bc48,_0x3c7a87){if(_0x31bc48[_0x9294('0x4c')]['id']){delete _0x31bc48[_0x9294('0x4c')]['id'];}return db[_0x9294('0x2b')]['find']({'where':{'id':_0x31bc48[_0x9294('0x41')]['id']}})['then'](handleEntityNotFound(_0x3c7a87,null))['then'](saveUpdates(_0x31bc48[_0x9294('0x4c')],null))[_0x9294('0x24')](respondWithResult(_0x3c7a87,null))[_0x9294('0x40')](handleError(_0x3c7a87,null));};exports['destroy']=function(_0x4d3269,_0xede57f){return db[_0x9294('0x2b')][_0x9294('0x45')]({'where':{'id':_0x4d3269[_0x9294('0x41')]['id']}})[_0x9294('0x24')](handleEntityNotFound(_0xede57f,null))[_0x9294('0x24')](removeEntity(_0xede57f,null))[_0x9294('0x40')](handleError(_0xede57f,null));};exports[_0x9294('0x4d')]=function(_0x1d0e82,_0x5e0d44,_0x5e19ff){return db[_0x9294('0x2b')]['find']({'where':{'id':_0x1d0e82[_0x9294('0x41')]['id']},'attributes':[_0x9294('0x28'),_0x9294('0x4e'),_0x9294('0x4f'),'output'],'raw':!![]})[_0x9294('0x24')](handleEntityNotFound(_0x5e0d44,null))[_0x9294('0x24')](function(_0x9f8c61){if(_0x9f8c61){if(!fs['existsSync'](path[_0x9294('0x50')](config[_0x9294('0x51')],_0x9294('0x52'),_0x9f8c61['savename']))){throw new db[(_0x9294('0x53'))]['ValidationError']('Report\x20not\x20found\x20or\x20empty');}if(_0x1d0e82[_0x9294('0x2d')][_0x9294('0x54')]){return _0x5e0d44[_0x9294('0x26')](0xc8);}return _0x5e0d44[_0x9294('0x4d')](path[_0x9294('0x50')](config[_0x9294('0x51')],_0x9294('0x52'),_0x9f8c61['savename']),util['format'](_0x9294('0x55'),_0x9f8c61[_0x9294('0x4e')]||_0x9f8c61['name'],_0x9f8c61['output'][_0x9294('0x56')]()));}})[_0x9294('0x40')](handleError(_0x5e0d44,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 8864ed1..6a4c879 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 _0xd07f=['./analyticExtractedReport.attributes','define','AnalyticExtractedReport','analytics_extracted_reports','api','moment','bluebird','request-promise'];(function(_0x187b69,_0x4c0cbc){var _0x4afabc=function(_0x1d34c1){while(--_0x1d34c1){_0x187b69['push'](_0x187b69['shift']());}};_0x4afabc(++_0x4c0cbc);}(_0xd07f,0xdc));var _0xfd07=function(_0x550352,_0x54a823){_0x550352=_0x550352-0x0;var _0x551f23=_0xd07f[_0x550352];return _0x551f23;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xfd07('0x0'));var moment=require(_0xfd07('0x1'));var BPromise=require(_0xfd07('0x2'));var rp=require(_0xfd07('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfd07('0x4'));module['exports']=function(_0x3610f9,_0x74e224){return _0x3610f9[_0xfd07('0x5')](_0xfd07('0x6'),attributes,{'tableName':_0xfd07('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7b33=['../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x14ea2e,_0x1e1412){var _0x420542=function(_0x13b3a1){while(--_0x13b3a1){_0x14ea2e['push'](_0x14ea2e['shift']());}};_0x420542(++_0x1e1412);}(_0x7b33,0xf0));var _0x37b3=function(_0x3c4d12,_0x31eb8b){_0x3c4d12=_0x3c4d12-0x0;var _0x417cce=_0x7b33[_0x3c4d12];return _0x417cce;};'use strict';var _=require(_0x37b3('0x0'));var util=require(_0x37b3('0x1'));var logger=require(_0x37b3('0x2'))(_0x37b3('0x3'));var moment=require(_0x37b3('0x4'));var BPromise=require('bluebird');var rp=require(_0x37b3('0x5'));var fs=require('fs');var path=require(_0x37b3('0x6'));var rimraf=require('rimraf');var config=require(_0x37b3('0x7'));var attributes=require(_0x37b3('0x8'));module[_0x37b3('0x9')]=function(_0x18cdfb,_0x486511){return _0x18cdfb[_0x37b3('0xa')](_0x37b3('0xb'),attributes,{'tableName':_0x37b3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index a721f68..a7a375d 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 _0xca76=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x13932d,_0xf930d3){var _0x1a7b81=function(_0x5c7b67){while(--_0x5c7b67){_0x13932d['push'](_0x13932d['shift']());}};_0x1a7b81(++_0xf930d3);}(_0xca76,0x122));var _0x6ca7=function(_0x4a8081,_0x40aaf9){_0x4a8081=_0x4a8081-0x0;var _0x1808bc=_0xca76[_0x4a8081];return _0x1808bc;};'use strict';var _=require(_0x6ca7('0x0'));var util=require(_0x6ca7('0x1'));var moment=require(_0x6ca7('0x2'));var BPromise=require(_0x6ca7('0x3'));var rs=require(_0x6ca7('0x4'));var fs=require('fs');var Redis=require(_0x6ca7('0x5'));var db=require(_0x6ca7('0x6'))['db'];var utils=require(_0x6ca7('0x7'));var logger=require(_0x6ca7('0x8'))(_0x6ca7('0x9'));var config=require(_0x6ca7('0xa'));var jayson=require(_0x6ca7('0xb'));var client=jayson[_0x6ca7('0xc')][_0x6ca7('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1b40df,_0x4bd6f6,_0x28a00e){return new BPromise(function(_0x5ae159,_0x420831){return client['request'](_0x1b40df,_0x28a00e)[_0x6ca7('0xe')](function(_0xd0d2df){logger[_0x6ca7('0xf')](_0x6ca7('0x10'),_0x4bd6f6,_0x6ca7('0x11'));logger[_0x6ca7('0x12')](_0x6ca7('0x13'),_0x4bd6f6,_0x6ca7('0x11'),JSON[_0x6ca7('0x14')](_0xd0d2df));if(_0xd0d2df[_0x6ca7('0x15')]){if(_0xd0d2df['error'][_0x6ca7('0x16')]===0x1f4){logger['error'](_0x6ca7('0x10'),_0x4bd6f6,_0xd0d2df['error'][_0x6ca7('0x17')]);return _0x420831(_0xd0d2df['error']['message']);}logger[_0x6ca7('0x15')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4bd6f6,_0xd0d2df['error'][_0x6ca7('0x17')]);return _0x5ae159(_0xd0d2df[_0x6ca7('0x15')][_0x6ca7('0x17')]);}else{logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x4bd6f6,_0x6ca7('0x11'));_0x5ae159(_0xd0d2df[_0x6ca7('0x18')][_0x6ca7('0x17')]);}})[_0x6ca7('0x19')](function(_0x155fb3){logger[_0x6ca7('0x15')](_0x6ca7('0x10'),_0x4bd6f6,_0x155fb3);_0x420831(_0x155fb3);});});} \ No newline at end of file +var _0xf5ff=['http','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','client'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0xf5ff,0xac));var _0xff5f=function(_0x5e35f6,_0x2ad0d0){_0x5e35f6=_0x5e35f6-0x0;var _0x6e35ba=_0xf5ff[_0x5e35f6];return _0x6e35ba;};'use strict';var _=require('lodash');var util=require(_0xff5f('0x0'));var moment=require(_0xff5f('0x1'));var BPromise=require(_0xff5f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff5f('0x3'));var db=require(_0xff5f('0x4'))['db'];var utils=require(_0xff5f('0x5'));var logger=require(_0xff5f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xff5f('0x7')][_0xff5f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x371569,_0x1f264d,_0x4e3d76){return new BPromise(function(_0x39699f,_0x3d7877){return client['request'](_0x371569,_0x4e3d76)[_0xff5f('0x9')](function(_0x18c3d2){logger[_0xff5f('0xa')](_0xff5f('0xb'),_0x1f264d,_0xff5f('0xc'));logger['debug']('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x1f264d,'request\x20sent',JSON[_0xff5f('0xd')](_0x18c3d2));if(_0x18c3d2[_0xff5f('0xe')]){if(_0x18c3d2[_0xff5f('0xe')][_0xff5f('0xf')]===0x1f4){logger[_0xff5f('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1f264d,_0x18c3d2[_0xff5f('0xe')][_0xff5f('0x10')]);return _0x3d7877(_0x18c3d2[_0xff5f('0xe')]['message']);}logger[_0xff5f('0xe')](_0xff5f('0xb'),_0x1f264d,_0x18c3d2[_0xff5f('0xe')]['message']);return _0x39699f(_0x18c3d2[_0xff5f('0xe')]['message']);}else{logger[_0xff5f('0xa')](_0xff5f('0xb'),_0x1f264d,_0xff5f('0xc'));_0x39699f(_0x18c3d2[_0xff5f('0x11')]['message']);}})['catch'](function(_0x258027){logger[_0xff5f('0xe')](_0xff5f('0xb'),_0x1f264d,_0x258027);_0x3d7877(_0x258027);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 73e7d00..c6a887b 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 _0x7615=['download','post','create','put','update','delete','destroy','exports','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/download'];(function(_0x2f2360,_0x151089){var _0x1cc8d3=function(_0x5e356f){while(--_0x5e356f){_0x2f2360['push'](_0x2f2360['shift']());}};_0x1cc8d3(++_0x151089);}(_0x7615,0xec));var _0x5761=function(_0x5c4f6b,_0x2cdfce){_0x5c4f6b=_0x5c4f6b-0x0;var _0x104c4e=_0x7615[_0x5c4f6b];return _0x104c4e;};'use strict';var multer=require(_0x5761('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5761('0x1'));var express=require('express');var router=express[_0x5761('0x2')]();var auth=require(_0x5761('0x3'));var interaction=require(_0x5761('0x4'));var config=require(_0x5761('0x5'));var controller=require('./analyticExtractedReport.controller');router[_0x5761('0x6')]('/',auth[_0x5761('0x7')](),controller[_0x5761('0x8')]);router[_0x5761('0x6')](_0x5761('0x9'),auth[_0x5761('0x7')](),controller['show']);router[_0x5761('0x6')](_0x5761('0xa'),auth[_0x5761('0x7')](),controller[_0x5761('0xb')]);router[_0x5761('0xc')]('/',auth[_0x5761('0x7')](),controller[_0x5761('0xd')]);router[_0x5761('0xe')](_0x5761('0x9'),auth[_0x5761('0x7')](),controller[_0x5761('0xf')]);router[_0x5761('0x10')]('/:id',auth[_0x5761('0x7')](),controller[_0x5761('0x11')]);module[_0x5761('0x12')]=router; \ No newline at end of file +var _0x7799=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','index','show','isAuthenticated','download','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7799,0xbc));var _0x9779=function(_0x1451de,_0x347d48){_0x1451de=_0x1451de-0x0;var _0x2fefb4=_0x7799[_0x1451de];return _0x2fefb4;};'use strict';var multer=require(_0x9779('0x0'));var util=require('util');var path=require(_0x9779('0x1'));var timeout=require(_0x9779('0x2'));var express=require(_0x9779('0x3'));var router=express[_0x9779('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x9779('0x5'));var config=require(_0x9779('0x6'));var controller=require(_0x9779('0x7'));router[_0x9779('0x8')]('/',auth['isAuthenticated'](),controller[_0x9779('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x9779('0xa')]);router[_0x9779('0x8')]('/:id/download',auth[_0x9779('0xb')](),controller[_0x9779('0xc')]);router[_0x9779('0xd')]('/',auth[_0x9779('0xb')](),controller[_0x9779('0xe')]);router[_0x9779('0xf')](_0x9779('0x10'),auth[_0x9779('0xb')](),controller[_0x9779('0x11')]);router[_0x9779('0x12')](_0x9779('0x10'),auth[_0x9779('0xb')](),controller[_0x9779('0x13')]);module[_0x9779('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 6613e0a..51fb886 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 _0x7217=['STRING','BOOLEAN','sequelize','TEXT'];(function(_0x4009ce,_0x5c7a5a){var _0x4d60aa=function(_0x60b7be){while(--_0x60b7be){_0x4009ce['push'](_0x4009ce['shift']());}};_0x4d60aa(++_0x5c7a5a);}(_0x7217,0x19e));var _0x7721=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0x7217[_0x139a3c];return _0x2b375b;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'field':{'type':Sequelize[_0x7721('0x1')]},'alias':{'type':Sequelize[_0x7721('0x2')]},'function':{'type':Sequelize[_0x7721('0x2')]},'format':{'type':Sequelize[_0x7721('0x2')]},'groupBy':{'type':Sequelize[_0x7721('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xc4aa=['exports','TEXT','STRING','sequelize'];(function(_0x5540d1,_0x2dbf6c){var _0x2fed3f=function(_0x37c671){while(--_0x37c671){_0x5540d1['push'](_0x5540d1['shift']());}};_0x2fed3f(++_0x2dbf6c);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xc4aa[_0x45d55e];return _0x29812a;};'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 5320864..494f181 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 _0x0223=['findAll','catch','show','params','fields','find','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','map','CustomReportId','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','save','update','then','destroy','error','name','send','index','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','AnalyticFieldReport','includeAll','include'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x0223,0xaf));var _0x3022=function(_0x5f4952,_0x1a31f4){_0x5f4952=_0x5f4952-0x0;var _0x2e54a1=_0x0223[_0x5f4952];return _0x2e54a1;};'use strict';var pdf=require(_0x3022('0x0'));var emlformat=require(_0x3022('0x1'));var rimraf=require(_0x3022('0x2'));var zipdir=require(_0x3022('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3022('0x4'));var moment=require(_0x3022('0x5'));var BPromise=require(_0x3022('0x6'));var Mustache=require(_0x3022('0x7'));var util=require(_0x3022('0x8'));var path=require(_0x3022('0x9'));var sox=require(_0x3022('0xa'));var csv=require(_0x3022('0xb'));var ejs=require(_0x3022('0xc'));var fs=require('fs');var _=require(_0x3022('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3022('0xe'));var toCsv=require(_0x3022('0xb'));var querystring=require('querystring');var Papa=require(_0x3022('0xf'));var Redis=require(_0x3022('0x10'));var authService=require(_0x3022('0x11'));var qs=require(_0x3022('0x12'));var as=require(_0x3022('0x13'));var hardwareService=require(_0x3022('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x3022('0x15'));var config=require('../../config/environment');var db=require(_0x3022('0x16'))['db'];function respondWithStatusCode(_0x49e4c2,_0x21f87f){_0x21f87f=_0x21f87f||0xcc;return function(_0x15caeb){if(_0x15caeb){return _0x49e4c2[_0x3022('0x17')](_0x21f87f);}return _0x49e4c2[_0x3022('0x18')](_0x21f87f)[_0x3022('0x19')]();};}function respondWithResult(_0xe0d010,_0x510c3a){_0x510c3a=_0x510c3a||0xc8;return function(_0x23d6fc){if(_0x23d6fc){return _0xe0d010[_0x3022('0x18')](_0x510c3a)['json'](_0x23d6fc);}};}function respondWithFilteredResult(_0x401b86,_0x4b79af){return function(_0x1d5fd9){if(_0x1d5fd9){var _0x3dd72e=_0x1d5fd9[_0x3022('0x1a')],_0x55cedb=_0x4b79af[_0x3022('0x1b')],_0xd628c3=_0x4b79af['offset']+_0x4b79af[_0x3022('0x1c')],_0x5cf5f7;if(_0xd628c3>=_0x3dd72e){_0xd628c3=_0x3dd72e;_0x5cf5f7=0xc8;}else{_0x5cf5f7=0xce;}_0x401b86[_0x3022('0x18')](_0x5cf5f7);return _0x401b86['set'](_0x3022('0x1d'),_0x55cedb+'-'+_0xd628c3+'/'+_0x3dd72e)[_0x3022('0x1e')](_0x1d5fd9);}return null;};}function patchUpdates(_0x40267e){return function(_0x26d806){try{jsonpatch[_0x3022('0x1f')](_0x26d806,_0x40267e,!![]);}catch(_0x5811cf){return BPromise['reject'](_0x5811cf);}return _0x26d806[_0x3022('0x20')]();};}function saveUpdates(_0x29a69d,_0x5e81d1){return function(_0x404dfb){if(_0x404dfb){return _0x404dfb[_0x3022('0x21')](_0x29a69d)[_0x3022('0x22')](function(_0x79880d){return _0x79880d;});}return null;};}function removeEntity(_0x5c63f7,_0x32a945){return function(_0x53947c){if(_0x53947c){return _0x53947c[_0x3022('0x23')]()['then'](function(){_0x5c63f7[_0x3022('0x18')](0xcc)[_0x3022('0x19')]();});}};}function handleEntityNotFound(_0x49da67,_0x4af23a){return function(_0xd7d37){if(!_0xd7d37){_0x49da67[_0x3022('0x17')](0x194);}return _0xd7d37;};}function handleError(_0x4f7756,_0x2268fa){_0x2268fa=_0x2268fa||0x1f4;return function(_0x3af8d6){logger[_0x3022('0x24')](_0x3af8d6['stack']);if(_0x3af8d6[_0x3022('0x25')]){delete _0x3af8d6[_0x3022('0x25')];}_0x4f7756[_0x3022('0x18')](_0x2268fa)[_0x3022('0x26')](_0x3af8d6);};}exports[_0x3022('0x27')]=function(_0xe447b9,_0x36583a){var _0x2eab6e={},_0x1795e7={},_0x43d1d6={'count':0x0,'rows':[]};var _0x4d6659=_['map'](db['AnalyticFieldReport'][_0x3022('0x28')],function(_0x2cb86b){return{'name':_0x2cb86b[_0x3022('0x29')],'type':_0x2cb86b[_0x3022('0x2a')]['key']};});_0x1795e7[_0x3022('0x2b')]=_['map'](_0x4d6659,_0x3022('0x25'));_0x1795e7['query']=_[_0x3022('0x2c')](_0xe447b9['query']);_0x1795e7[_0x3022('0x2d')]=_[_0x3022('0x2e')](_0x1795e7[_0x3022('0x2b')],_0x1795e7[_0x3022('0x2f')]);_0x2eab6e[_0x3022('0x30')]=_['intersection'](_0x1795e7[_0x3022('0x2b')],qs['fields'](_0xe447b9[_0x3022('0x2f')]['fields']));_0x2eab6e[_0x3022('0x30')]=_0x2eab6e[_0x3022('0x30')][_0x3022('0x31')]?_0x2eab6e[_0x3022('0x30')]:_0x1795e7['model'];if(!_0xe447b9[_0x3022('0x2f')][_0x3022('0x32')](_0x3022('0x33'))){_0x2eab6e[_0x3022('0x1c')]=qs['limit'](_0xe447b9[_0x3022('0x2f')][_0x3022('0x1c')]);_0x2eab6e[_0x3022('0x1b')]=qs[_0x3022('0x1b')](_0xe447b9[_0x3022('0x2f')][_0x3022('0x1b')]);}_0x2eab6e[_0x3022('0x34')]=qs['sort'](_0xe447b9[_0x3022('0x2f')][_0x3022('0x35')]);_0x2eab6e[_0x3022('0x36')]=qs['filters'](_[_0x3022('0x37')](_0xe447b9['query'],_0x1795e7[_0x3022('0x2d')]),_0x4d6659);if(_0xe447b9[_0x3022('0x2f')][_0x3022('0x38')]){_0x2eab6e[_0x3022('0x36')]=_['merge'](_0x2eab6e[_0x3022('0x36')],{'$or':_['map'](_0x4d6659,function(_0x73326){if(_0x73326[_0x3022('0x2a')]!=='VIRTUAL'){var _0x48363f={};_0x48363f[_0x73326[_0x3022('0x25')]]={'$like':'%'+_0xe447b9[_0x3022('0x2f')][_0x3022('0x38')]+'%'};return _0x48363f;}})});}_0x2eab6e=_[_0x3022('0x39')]({},_0x2eab6e,_0xe447b9[_0x3022('0x3a')]);var _0x4c7f1d={'where':_0x2eab6e['where']};return db[_0x3022('0x3b')][_0x3022('0x1a')](_0x4c7f1d)[_0x3022('0x22')](function(_0x376c7b){_0x43d1d6[_0x3022('0x1a')]=_0x376c7b;if(_0xe447b9['query'][_0x3022('0x3c')]){_0x2eab6e[_0x3022('0x3d')]=[{'all':!![]}];}return db[_0x3022('0x3b')][_0x3022('0x3e')](_0x2eab6e);})[_0x3022('0x22')](function(_0x2d4619){_0x43d1d6['rows']=_0x2d4619;return _0x43d1d6;})[_0x3022('0x22')](respondWithFilteredResult(_0x36583a,_0x2eab6e))[_0x3022('0x3f')](handleError(_0x36583a,null));};exports[_0x3022('0x40')]=function(_0x4129dd,_0x157f14){var _0x23e9af={'raw':![],'where':{'id':_0x4129dd[_0x3022('0x41')]['id']}},_0x46081f={};_0x46081f[_0x3022('0x2b')]=_[_0x3022('0x2c')](db[_0x3022('0x3b')][_0x3022('0x28')]);_0x46081f[_0x3022('0x2f')]=_[_0x3022('0x2c')](_0x4129dd[_0x3022('0x2f')]);_0x46081f['filters']=_[_0x3022('0x2e')](_0x46081f['model'],_0x46081f[_0x3022('0x2f')]);_0x23e9af[_0x3022('0x30')]=_[_0x3022('0x2e')](_0x46081f[_0x3022('0x2b')],qs[_0x3022('0x42')](_0x4129dd['query'][_0x3022('0x42')]));_0x23e9af['attributes']=_0x23e9af[_0x3022('0x30')][_0x3022('0x31')]?_0x23e9af[_0x3022('0x30')]:_0x46081f[_0x3022('0x2b')];if(_0x4129dd['query'][_0x3022('0x3c')]){_0x23e9af[_0x3022('0x3d')]=[{'all':!![]}];}_0x23e9af=_[_0x3022('0x39')]({},_0x23e9af,_0x4129dd['options']);return db[_0x3022('0x3b')][_0x3022('0x43')](_0x23e9af)[_0x3022('0x22')](handleEntityNotFound(_0x157f14,null))[_0x3022('0x22')](respondWithResult(_0x157f14,null))[_0x3022('0x3f')](handleError(_0x157f14,null));};exports[_0x3022('0x44')]=function(_0x525a96,_0x2f5da8){return db['AnalyticFieldReport']['create'](_0x525a96[_0x3022('0x45')],{})[_0x3022('0x22')](respondWithResult(_0x2f5da8,0xc9))[_0x3022('0x3f')](handleError(_0x2f5da8,null));};exports[_0x3022('0x46')]=function(_0x332087,_0x3fa116){return db['AnalyticFieldReport']['bulkCreate'](_0x332087[_0x3022('0x45')],{'raw':![],'individualHooks':!![]})[_0x3022('0x22')](respondWithResult(_0x3fa116,0xc9))[_0x3022('0x3f')](handleError(_0x3fa116,null));};exports['update']=function(_0x290802,_0x2b7e2a){if(_0x290802['body']['id']){delete _0x290802[_0x3022('0x45')]['id'];}return db['AnalyticFieldReport'][_0x3022('0x43')]({'where':{'id':_0x290802[_0x3022('0x41')]['id']}})['then'](handleEntityNotFound(_0x2b7e2a,null))[_0x3022('0x22')](saveUpdates(_0x290802[_0x3022('0x45')],null))['then'](respondWithResult(_0x2b7e2a,null))[_0x3022('0x3f')](handleError(_0x2b7e2a,null));};exports[_0x3022('0x23')]=function(_0x51fcdd,_0x4cfe41){return db['AnalyticFieldReport'][_0x3022('0x43')]({'where':{'id':_0x51fcdd[_0x3022('0x41')]['id']}})[_0x3022('0x22')](handleEntityNotFound(_0x4cfe41,null))['then'](removeEntity(_0x4cfe41,null))[_0x3022('0x3f')](handleError(_0x4cfe41,null));};exports[_0x3022('0x47')]=function(_0x1b0ce6,_0x5e4702){return db[_0x3022('0x3b')][_0x3022('0x23')]({'where':{'id':_0x1b0ce6[_0x3022('0x2f')][_0x3022('0x48')]||[]},'raw':![],'individualHooks':!![]})[_0x3022('0x22')](respondWithResult(_0x5e4702,0xcc))[_0x3022('0x3f')](handleError(_0x5e4702,null));};exports[_0x3022('0x49')]=function(_0x214774,_0x2de8ce,_0x49b708){return db[_0x3022('0x4a')][_0x3022('0x4b')]({'where':{'id':_0x214774[_0x3022('0x41')]['id']}})[_0x3022('0x22')](handleEntityNotFound(_0x2de8ce,null))[_0x3022('0x22')](function(_0x95a88e){if(_0x95a88e){return db[_0x3022('0x4c')]['transaction'](function(_0x236543){return db[_0x3022('0x3b')][_0x3022('0x23')]({'where':{'CustomReportId':_0x214774['params']['id']},'transaction':_0x236543})[_0x3022('0x22')](function(_0x59c2b2){var _0x5a7b21=_[_0x3022('0x4d')](_0x214774['body'],function(_0x3bd8aa){delete _0x3bd8aa['id'];_0x3bd8aa[_0x3022('0x4e')]=_0x214774[_0x3022('0x41')]['id'];return _0x3bd8aa;});return db[_0x3022('0x3b')]['bulkCreate'](_0x5a7b21,{'transaction':_0x236543});});})[_0x3022('0x22')](function(){return db[_0x3022('0x3b')]['findAll']({'where':{'CustomReportId':_0x214774[_0x3022('0x41')]['id']}});});}})['then'](respondWithResult(_0x2de8ce,null))[_0x3022('0x3f')](handleError(_0x2de8ce,null));}; \ No newline at end of file +var _0x6a96=['key','model','query','intersection','fields','attributes','length','nolimit','sort','where','pick','filters','filter','merge','map','VIRTUAL','then','includeAll','include','catch','show','params','keys','options','find','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','CustomReportId','findAll','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','end','error','stack','name','index','AnalyticFieldReport','rawAttributes','fieldName','type'];(function(_0x3dd97a,_0xaeedea){var _0x5a6410=function(_0x465363){while(--_0x465363){_0x3dd97a['push'](_0x3dd97a['shift']());}};_0x5a6410(++_0xaeedea);}(_0x6a96,0x77));var _0x66a9=function(_0x30f07a,_0x98341){_0x30f07a=_0x30f07a-0x0;var _0xb38461=_0x6a96[_0x30f07a];return _0xb38461;};'use strict';var pdf=require(_0x66a9('0x0'));var emlformat=require(_0x66a9('0x1'));var rimraf=require(_0x66a9('0x2'));var zipdir=require(_0x66a9('0x3'));var jsonpatch=require(_0x66a9('0x4'));var rp=require(_0x66a9('0x5'));var moment=require(_0x66a9('0x6'));var BPromise=require(_0x66a9('0x7'));var Mustache=require(_0x66a9('0x8'));var util=require(_0x66a9('0x9'));var path=require('path');var sox=require(_0x66a9('0xa'));var csv=require('to-csv');var ejs=require(_0x66a9('0xb'));var fs=require('fs');var _=require(_0x66a9('0xc'));var squel=require('squel');var crypto=require(_0x66a9('0xd'));var jsforce=require(_0x66a9('0xe'));var deskjs=require(_0x66a9('0xf'));var toCsv=require(_0x66a9('0x10'));var querystring=require('querystring');var Papa=require(_0x66a9('0x11'));var Redis=require(_0x66a9('0x12'));var authService=require(_0x66a9('0x13'));var qs=require(_0x66a9('0x14'));var as=require(_0x66a9('0x15'));var hardwareService=require(_0x66a9('0x16'));var logger=require('../../config/logger')(_0x66a9('0x17'));var utils=require(_0x66a9('0x18'));var config=require(_0x66a9('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25c3db,_0xbbb45a){_0xbbb45a=_0xbbb45a||0xcc;return function(_0x44fbd9){if(_0x44fbd9){return _0x25c3db[_0x66a9('0x1a')](_0xbbb45a);}return _0x25c3db[_0x66a9('0x1b')](_0xbbb45a)['end']();};}function respondWithResult(_0x361025,_0x248887){_0x248887=_0x248887||0xc8;return function(_0x3fbafc){if(_0x3fbafc){return _0x361025[_0x66a9('0x1b')](_0x248887)[_0x66a9('0x1c')](_0x3fbafc);}};}function respondWithFilteredResult(_0x445f16,_0x378f71){return function(_0xa8c2d3){if(_0xa8c2d3){var _0x5e71de=_0xa8c2d3[_0x66a9('0x1d')],_0x1245f6=_0x378f71[_0x66a9('0x1e')],_0xe45a2b=_0x378f71[_0x66a9('0x1e')]+_0x378f71[_0x66a9('0x1f')],_0x4d59be;if(_0xe45a2b>=_0x5e71de){_0xe45a2b=_0x5e71de;_0x4d59be=0xc8;}else{_0x4d59be=0xce;}_0x445f16[_0x66a9('0x1b')](_0x4d59be);return _0x445f16[_0x66a9('0x20')](_0x66a9('0x21'),_0x1245f6+'-'+_0xe45a2b+'/'+_0x5e71de)[_0x66a9('0x1c')](_0xa8c2d3);}return null;};}function patchUpdates(_0x3f98b7){return function(_0x3e2344){try{jsonpatch[_0x66a9('0x22')](_0x3e2344,_0x3f98b7,!![]);}catch(_0x2e2992){return BPromise['reject'](_0x2e2992);}return _0x3e2344[_0x66a9('0x23')]();};}function saveUpdates(_0xb77b39,_0x1ed300){return function(_0x66be74){if(_0x66be74){return _0x66be74[_0x66a9('0x24')](_0xb77b39)['then'](function(_0x26afa3){return _0x26afa3;});}return null;};}function removeEntity(_0x3b0235,_0x3d78ac){return function(_0x2a89c3){if(_0x2a89c3){return _0x2a89c3[_0x66a9('0x25')]()['then'](function(){_0x3b0235[_0x66a9('0x1b')](0xcc)[_0x66a9('0x26')]();});}};}function handleEntityNotFound(_0x42f312,_0x33ffb1){return function(_0x39a5cb){if(!_0x39a5cb){_0x42f312[_0x66a9('0x1a')](0x194);}return _0x39a5cb;};}function handleError(_0x247bc5,_0x5e11d4){_0x5e11d4=_0x5e11d4||0x1f4;return function(_0x207f66){logger[_0x66a9('0x27')](_0x207f66[_0x66a9('0x28')]);if(_0x207f66[_0x66a9('0x29')]){delete _0x207f66[_0x66a9('0x29')];}_0x247bc5[_0x66a9('0x1b')](_0x5e11d4)['send'](_0x207f66);};}exports[_0x66a9('0x2a')]=function(_0x234074,_0x388d54){var _0x4aa7bf={},_0x138ce6={},_0x3b7cf1={'count':0x0,'rows':[]};var _0x268fa9=_['map'](db[_0x66a9('0x2b')][_0x66a9('0x2c')],function(_0x45125e){return{'name':_0x45125e[_0x66a9('0x2d')],'type':_0x45125e[_0x66a9('0x2e')][_0x66a9('0x2f')]};});_0x138ce6[_0x66a9('0x30')]=_['map'](_0x268fa9,_0x66a9('0x29'));_0x138ce6[_0x66a9('0x31')]=_['keys'](_0x234074[_0x66a9('0x31')]);_0x138ce6['filters']=_[_0x66a9('0x32')](_0x138ce6[_0x66a9('0x30')],_0x138ce6[_0x66a9('0x31')]);_0x4aa7bf['attributes']=_[_0x66a9('0x32')](_0x138ce6[_0x66a9('0x30')],qs[_0x66a9('0x33')](_0x234074['query'][_0x66a9('0x33')]));_0x4aa7bf[_0x66a9('0x34')]=_0x4aa7bf['attributes'][_0x66a9('0x35')]?_0x4aa7bf[_0x66a9('0x34')]:_0x138ce6[_0x66a9('0x30')];if(!_0x234074['query']['hasOwnProperty'](_0x66a9('0x36'))){_0x4aa7bf[_0x66a9('0x1f')]=qs[_0x66a9('0x1f')](_0x234074[_0x66a9('0x31')][_0x66a9('0x1f')]);_0x4aa7bf[_0x66a9('0x1e')]=qs['offset'](_0x234074['query'][_0x66a9('0x1e')]);}_0x4aa7bf['order']=qs[_0x66a9('0x37')](_0x234074[_0x66a9('0x31')][_0x66a9('0x37')]);_0x4aa7bf[_0x66a9('0x38')]=qs['filters'](_[_0x66a9('0x39')](_0x234074[_0x66a9('0x31')],_0x138ce6[_0x66a9('0x3a')]),_0x268fa9);if(_0x234074[_0x66a9('0x31')][_0x66a9('0x3b')]){_0x4aa7bf[_0x66a9('0x38')]=_[_0x66a9('0x3c')](_0x4aa7bf[_0x66a9('0x38')],{'$or':_[_0x66a9('0x3d')](_0x268fa9,function(_0x1886f4){if(_0x1886f4['type']!==_0x66a9('0x3e')){var _0x1038a8={};_0x1038a8[_0x1886f4[_0x66a9('0x29')]]={'$like':'%'+_0x234074[_0x66a9('0x31')][_0x66a9('0x3b')]+'%'};return _0x1038a8;}})});}_0x4aa7bf=_[_0x66a9('0x3c')]({},_0x4aa7bf,_0x234074['options']);var _0x5cbb15={'where':_0x4aa7bf[_0x66a9('0x38')]};return db[_0x66a9('0x2b')][_0x66a9('0x1d')](_0x5cbb15)[_0x66a9('0x3f')](function(_0x441bc2){_0x3b7cf1[_0x66a9('0x1d')]=_0x441bc2;if(_0x234074[_0x66a9('0x31')][_0x66a9('0x40')]){_0x4aa7bf[_0x66a9('0x41')]=[{'all':!![]}];}return db['AnalyticFieldReport']['findAll'](_0x4aa7bf);})[_0x66a9('0x3f')](function(_0x42f22c){_0x3b7cf1['rows']=_0x42f22c;return _0x3b7cf1;})[_0x66a9('0x3f')](respondWithFilteredResult(_0x388d54,_0x4aa7bf))[_0x66a9('0x42')](handleError(_0x388d54,null));};exports[_0x66a9('0x43')]=function(_0x514c76,_0x3d66e9){var _0x2b532d={'raw':![],'where':{'id':_0x514c76[_0x66a9('0x44')]['id']}},_0x100e33={};_0x100e33['model']=_[_0x66a9('0x45')](db[_0x66a9('0x2b')]['rawAttributes']);_0x100e33['query']=_[_0x66a9('0x45')](_0x514c76[_0x66a9('0x31')]);_0x100e33[_0x66a9('0x3a')]=_['intersection'](_0x100e33[_0x66a9('0x30')],_0x100e33['query']);_0x2b532d['attributes']=_[_0x66a9('0x32')](_0x100e33['model'],qs['fields'](_0x514c76[_0x66a9('0x31')][_0x66a9('0x33')]));_0x2b532d[_0x66a9('0x34')]=_0x2b532d['attributes']['length']?_0x2b532d[_0x66a9('0x34')]:_0x100e33['model'];if(_0x514c76[_0x66a9('0x31')][_0x66a9('0x40')]){_0x2b532d[_0x66a9('0x41')]=[{'all':!![]}];}_0x2b532d=_['merge']({},_0x2b532d,_0x514c76[_0x66a9('0x46')]);return db['AnalyticFieldReport'][_0x66a9('0x47')](_0x2b532d)[_0x66a9('0x3f')](handleEntityNotFound(_0x3d66e9,null))['then'](respondWithResult(_0x3d66e9,null))['catch'](handleError(_0x3d66e9,null));};exports[_0x66a9('0x48')]=function(_0xe7eafd,_0x552c1d){return db[_0x66a9('0x2b')]['create'](_0xe7eafd[_0x66a9('0x49')],{})[_0x66a9('0x3f')](respondWithResult(_0x552c1d,0xc9))[_0x66a9('0x42')](handleError(_0x552c1d,null));};exports['bulkCreate']=function(_0x43748f,_0x3e56f4){return db[_0x66a9('0x2b')][_0x66a9('0x4a')](_0x43748f[_0x66a9('0x49')],{'raw':![],'individualHooks':!![]})[_0x66a9('0x3f')](respondWithResult(_0x3e56f4,0xc9))['catch'](handleError(_0x3e56f4,null));};exports['update']=function(_0x48e32f,_0x1a1ee1){if(_0x48e32f[_0x66a9('0x49')]['id']){delete _0x48e32f[_0x66a9('0x49')]['id'];}return db[_0x66a9('0x2b')][_0x66a9('0x47')]({'where':{'id':_0x48e32f[_0x66a9('0x44')]['id']}})['then'](handleEntityNotFound(_0x1a1ee1,null))[_0x66a9('0x3f')](saveUpdates(_0x48e32f[_0x66a9('0x49')],null))[_0x66a9('0x3f')](respondWithResult(_0x1a1ee1,null))[_0x66a9('0x42')](handleError(_0x1a1ee1,null));};exports[_0x66a9('0x25')]=function(_0x412789,_0x81bd92){return db['AnalyticFieldReport'][_0x66a9('0x47')]({'where':{'id':_0x412789['params']['id']}})[_0x66a9('0x3f')](handleEntityNotFound(_0x81bd92,null))['then'](removeEntity(_0x81bd92,null))[_0x66a9('0x42')](handleError(_0x81bd92,null));};exports[_0x66a9('0x4b')]=function(_0x46af87,_0x303116){return db[_0x66a9('0x2b')][_0x66a9('0x25')]({'where':{'id':_0x46af87[_0x66a9('0x31')][_0x66a9('0x4c')]||[]},'raw':![],'individualHooks':!![]})[_0x66a9('0x3f')](respondWithResult(_0x303116,0xcc))[_0x66a9('0x42')](handleError(_0x303116,null));};exports[_0x66a9('0x4d')]=function(_0x4e3b6b,_0x278459,_0x3ecc34){return db[_0x66a9('0x4e')][_0x66a9('0x4f')]({'where':{'id':_0x4e3b6b[_0x66a9('0x44')]['id']}})[_0x66a9('0x3f')](handleEntityNotFound(_0x278459,null))[_0x66a9('0x3f')](function(_0x299bbe){if(_0x299bbe){return db[_0x66a9('0x50')]['transaction'](function(_0x519db3){return db[_0x66a9('0x2b')][_0x66a9('0x25')]({'where':{'CustomReportId':_0x4e3b6b[_0x66a9('0x44')]['id']},'transaction':_0x519db3})[_0x66a9('0x3f')](function(_0x51ad31){var _0x2e1acf=_[_0x66a9('0x3d')](_0x4e3b6b[_0x66a9('0x49')],function(_0x3c8e18){delete _0x3c8e18['id'];_0x3c8e18[_0x66a9('0x51')]=_0x4e3b6b[_0x66a9('0x44')]['id'];return _0x3c8e18;});return db[_0x66a9('0x2b')][_0x66a9('0x4a')](_0x2e1acf,{'transaction':_0x519db3});});})[_0x66a9('0x3f')](function(){return db[_0x66a9('0x2b')][_0x66a9('0x52')]({'where':{'CustomReportId':_0x4e3b6b[_0x66a9('0x44')]['id']}});});}})[_0x66a9('0x3f')](respondWithResult(_0x278459,null))[_0x66a9('0x42')](handleError(_0x278459,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 02e5884..50a0f9d 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 _0x8a99=['bluebird','request-promise','path','../../config/environment','exports','lodash','api','moment'];(function(_0x32e312,_0xcbff54){var _0x403f17=function(_0x3e61a1){while(--_0x3e61a1){_0x32e312['push'](_0x32e312['shift']());}};_0x403f17(++_0xcbff54);}(_0x8a99,0x11d));var _0x98a9=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x8a99[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require(_0x98a9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x98a9('0x1'));var moment=require(_0x98a9('0x2'));var BPromise=require(_0x98a9('0x3'));var rp=require(_0x98a9('0x4'));var fs=require('fs');var path=require(_0x98a9('0x5'));var rimraf=require('rimraf');var config=require(_0x98a9('0x6'));var attributes=require('./analyticFieldReport.attributes');module[_0x98a9('0x7')]=function(_0x492ac2,_0x1db4e9){return _0x492ac2['define']('AnalyticFieldReport',attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdbcf=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','AnalyticFieldReport','analytics_report_fields','lodash'];(function(_0x252493,_0x33cfc3){var _0x3371ff=function(_0x17564){while(--_0x17564){_0x252493['push'](_0x252493['shift']());}};_0x3371ff(++_0x33cfc3);}(_0xdbcf,0x14f));var _0xfdbc=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xdbcf[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xfdbc('0x0'));var util=require('util');var logger=require(_0xfdbc('0x1'))(_0xfdbc('0x2'));var moment=require('moment');var BPromise=require(_0xfdbc('0x3'));var rp=require(_0xfdbc('0x4'));var fs=require('fs');var path=require(_0xfdbc('0x5'));var rimraf=require(_0xfdbc('0x6'));var config=require(_0xfdbc('0x7'));var attributes=require(_0xfdbc('0x8'));module[_0xfdbc('0x9')]=function(_0x65a91f,_0x2f8223){return _0x65a91f['define'](_0xfdbc('0xa'),attributes,{'tableName':_0xfdbc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 54e38bf..fb45a6c 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 _0xd18c=['moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util'];(function(_0x173158,_0x1609cf){var _0x4ad038=function(_0x2922d7){while(--_0x2922d7){_0x173158['push'](_0x173158['shift']());}};_0x4ad038(++_0x1609cf);}(_0xd18c,0x1b7));var _0xcd18=function(_0x735da9,_0x38b186){_0x735da9=_0x735da9-0x0;var _0x39160b=_0xd18c[_0x735da9];return _0x39160b;};'use strict';var _=require(_0xcd18('0x0'));var util=require(_0xcd18('0x1'));var moment=require(_0xcd18('0x2'));var BPromise=require(_0xcd18('0x3'));var rs=require(_0xcd18('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcd18('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcd18('0x6'))(_0xcd18('0x7'));var config=require(_0xcd18('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcd18('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42efe1,_0x862e17,_0x3e5b74){return new BPromise(function(_0x520dc7,_0x47531e){return client[_0xcd18('0xa')](_0x42efe1,_0x3e5b74)[_0xcd18('0xb')](function(_0x36300c){logger['info'](_0xcd18('0xc'),_0x862e17,_0xcd18('0xd'));logger['debug'](_0xcd18('0xe'),_0x862e17,_0xcd18('0xd'),JSON[_0xcd18('0xf')](_0x36300c));if(_0x36300c[_0xcd18('0x10')]){if(_0x36300c[_0xcd18('0x10')][_0xcd18('0x11')]===0x1f4){logger['error'](_0xcd18('0xc'),_0x862e17,_0x36300c[_0xcd18('0x10')][_0xcd18('0x12')]);return _0x47531e(_0x36300c[_0xcd18('0x10')][_0xcd18('0x12')]);}logger[_0xcd18('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x862e17,_0x36300c[_0xcd18('0x10')][_0xcd18('0x12')]);return _0x520dc7(_0x36300c['error'][_0xcd18('0x12')]);}else{logger[_0xcd18('0x13')](_0xcd18('0xc'),_0x862e17,_0xcd18('0xd'));_0x520dc7(_0x36300c[_0xcd18('0x14')][_0xcd18('0x12')]);}})['catch'](function(_0x356e1b){logger[_0xcd18('0x10')](_0xcd18('0xc'),_0x862e17,_0x356e1b);_0x47531e(_0x356e1b);});});} \ No newline at end of file +var _0xa90a=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x1f5169,_0x50224c){var _0x28989f=function(_0x1fa67b){while(--_0x1fa67b){_0x1f5169['push'](_0x1f5169['shift']());}};_0x28989f(++_0x50224c);}(_0xa90a,0x1c3));var _0xaa90=function(_0x324882,_0x2998c9){_0x324882=_0x324882-0x0;var _0x1c4b97=_0xa90a[_0x324882];return _0x1c4b97;};'use strict';var _=require(_0xaa90('0x0'));var util=require('util');var moment=require(_0xaa90('0x1'));var BPromise=require(_0xaa90('0x2'));var rs=require(_0xaa90('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa90('0x4'))['db'];var utils=require(_0xaa90('0x5'));var logger=require(_0xaa90('0x6'))(_0xaa90('0x7'));var config=require(_0xaa90('0x8'));var jayson=require(_0xaa90('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x556717,_0xf596b3,_0x329997){return new BPromise(function(_0x1d033c,_0x361890){return client[_0xaa90('0xa')](_0x556717,_0x329997)['then'](function(_0x4f3c56){logger[_0xaa90('0xb')](_0xaa90('0xc'),_0xf596b3,_0xaa90('0xd'));logger[_0xaa90('0xe')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0xf596b3,_0xaa90('0xd'),JSON[_0xaa90('0xf')](_0x4f3c56));if(_0x4f3c56[_0xaa90('0x10')]){if(_0x4f3c56[_0xaa90('0x10')]['code']===0x1f4){logger[_0xaa90('0x10')](_0xaa90('0xc'),_0xf596b3,_0x4f3c56['error'][_0xaa90('0x11')]);return _0x361890(_0x4f3c56['error'][_0xaa90('0x11')]);}logger['error'](_0xaa90('0xc'),_0xf596b3,_0x4f3c56[_0xaa90('0x10')][_0xaa90('0x11')]);return _0x1d033c(_0x4f3c56[_0xaa90('0x10')][_0xaa90('0x11')]);}else{logger[_0xaa90('0xb')](_0xaa90('0xc'),_0xf596b3,_0xaa90('0xd'));_0x1d033c(_0x4f3c56['result'][_0xaa90('0x11')]);}})[_0xaa90('0x12')](function(_0x209795){logger[_0xaa90('0x10')](_0xaa90('0xc'),_0xf596b3,_0x209795);_0x361890(_0x209795);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 027c942..a9dcb79 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(_0x4fee76,_0xc60073){var _0x4335f4=function(_0xbd9fb1){while(--_0xbd9fb1){_0x4fee76['push'](_0x4fee76['shift']());}};_0x4335f4(++_0xc60073);}(_0x3e74,0x175));var _0x43e7=function(_0x53142f,_0x12d913){_0x53142f=_0x53142f-0x0;var _0x220b10=_0x3e74[_0x53142f];return _0x220b10;};'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 _0x326f=['/:id','show','post','/create_many','bulkCreate','/:id/create_many','addFields','update','/destroy_many','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','isAuthenticated','index'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x326f,0xd1));var _0xf326=function(_0x488fd6,_0x291c2f){_0x488fd6=_0x488fd6-0x0;var _0x3c205d=_0x326f[_0x488fd6];return _0x3c205d;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var auth=require(_0xf326('0x4'));var interaction=require(_0xf326('0x5'));var config=require(_0xf326('0x6'));var controller=require(_0xf326('0x7'));router[_0xf326('0x8')]('/',auth[_0xf326('0x9')](),controller[_0xf326('0xa')]);router['get'](_0xf326('0xb'),auth[_0xf326('0x9')](),controller[_0xf326('0xc')]);router[_0xf326('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xf326('0xe'),auth[_0xf326('0x9')](),controller[_0xf326('0xf')]);router[_0xf326('0xd')](_0xf326('0x10'),auth['isAuthenticated'](),controller[_0xf326('0x11')]);router['put'](_0xf326('0xb'),auth['isAuthenticated'](),controller[_0xf326('0x12')]);router['delete'](_0xf326('0x13'),auth[_0xf326('0x9')](),controller['bulkDestroy']);router[_0xf326('0x14')](_0xf326('0xb'),auth[_0xf326('0x9')](),controller[_0xf326('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 6df1264..26465f6 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 _0xe486=['TEXT','sequelize','exports','STRING','name'];(function(_0x458c3a,_0xe41198){var _0x1d144d=function(_0x4b4410){while(--_0x4b4410){_0x458c3a['push'](_0x458c3a['shift']());}};_0x1d144d(++_0xe41198);}(_0xe486,0x6a));var _0x6e48=function(_0x32eb8b,_0x5ac0b5){_0x32eb8b=_0x32eb8b-0x0;var _0x5bc68b=_0xe486[_0x32eb8b];return _0x5bc68b;};'use strict';var Sequelize=require(_0x6e48('0x0'));module[_0x6e48('0x1')]={'name':{'type':Sequelize[_0x6e48('0x2')],'allowNull':![],'unique':_0x6e48('0x3')},'table':{'type':Sequelize[_0x6e48('0x2')]},'metric':{'type':Sequelize[_0x6e48('0x4')]},'description':{'type':Sequelize[_0x6e48('0x2')]}}; \ No newline at end of file +var _0x3792=['sequelize','exports','name','STRING','TEXT'];(function(_0x32697d,_0x5a13ad){var _0x185042=function(_0x16f6c4){while(--_0x16f6c4){_0x32697d['push'](_0x32697d['shift']());}};_0x185042(++_0x5a13ad);}(_0x3792,0xbe));var _0x2379=function(_0x1f22e0,_0x32e6a1){_0x1f22e0=_0x1f22e0-0x0;var _0x31d7ee=_0x3792[_0x1f22e0];return _0x31d7ee;};'use strict';var Sequelize=require(_0x2379('0x0'));module[_0x2379('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2379('0x2')},'table':{'type':Sequelize[_0x2379('0x3')]},'metric':{'type':Sequelize[_0x2379('0x4')]},'description':{'type':Sequelize[_0x2379('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 2f1ab05..5c48779 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 _0x1775=['reject','save','update','then','destroy','Metrics','UserProfileResource','stack','name','send','index','map','AnalyticMetric','rawAttributes','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','params','options','find','body','user','get','UserProfileSection','userProfileId','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply'];(function(_0x5b3b9b,_0x1c71b0){var _0x47c1d7=function(_0x34c20b){while(--_0x34c20b){_0x5b3b9b['push'](_0x5b3b9b['shift']());}};_0x47c1d7(++_0x1c71b0);}(_0x1775,0x1db));var _0x5177=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1775[_0x14add3];return _0x4a174f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5177('0x0'));var rimraf=require(_0x5177('0x1'));var zipdir=require(_0x5177('0x2'));var jsonpatch=require(_0x5177('0x3'));var rp=require(_0x5177('0x4'));var moment=require(_0x5177('0x5'));var BPromise=require(_0x5177('0x6'));var Mustache=require(_0x5177('0x7'));var util=require(_0x5177('0x8'));var path=require(_0x5177('0x9'));var sox=require(_0x5177('0xa'));var csv=require(_0x5177('0xb'));var ejs=require(_0x5177('0xc'));var fs=require('fs');var _=require(_0x5177('0xd'));var squel=require(_0x5177('0xe'));var crypto=require(_0x5177('0xf'));var jsforce=require(_0x5177('0x10'));var deskjs=require(_0x5177('0x11'));var toCsv=require(_0x5177('0xb'));var querystring=require(_0x5177('0x12'));var Papa=require(_0x5177('0x13'));var Redis=require(_0x5177('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5177('0x15'));var hardwareService=require(_0x5177('0x16'));var logger=require(_0x5177('0x17'))(_0x5177('0x18'));var utils=require(_0x5177('0x19'));var config=require('../../config/environment');var db=require(_0x5177('0x1a'))['db'];function respondWithStatusCode(_0x22fe21,_0xc613b9){_0xc613b9=_0xc613b9||0xcc;return function(_0x3c4ced){if(_0x3c4ced){return _0x22fe21[_0x5177('0x1b')](_0xc613b9);}return _0x22fe21[_0x5177('0x1c')](_0xc613b9)[_0x5177('0x1d')]();};}function respondWithResult(_0x2ec90f,_0x3e6224){_0x3e6224=_0x3e6224||0xc8;return function(_0x1eb9dd){if(_0x1eb9dd){return _0x2ec90f[_0x5177('0x1c')](_0x3e6224)[_0x5177('0x1e')](_0x1eb9dd);}};}function respondWithFilteredResult(_0x29cd2c,_0x31aff8){return function(_0x1b32e6){if(_0x1b32e6){var _0x175ca6=_0x1b32e6['count'],_0x2ab5e5=_0x31aff8[_0x5177('0x1f')],_0x7dba6f=_0x31aff8[_0x5177('0x1f')]+_0x31aff8[_0x5177('0x20')],_0xe6dcf6;if(_0x7dba6f>=_0x175ca6){_0x7dba6f=_0x175ca6;_0xe6dcf6=0xc8;}else{_0xe6dcf6=0xce;}_0x29cd2c[_0x5177('0x1c')](_0xe6dcf6);return _0x29cd2c['set'](_0x5177('0x21'),_0x2ab5e5+'-'+_0x7dba6f+'/'+_0x175ca6)[_0x5177('0x1e')](_0x1b32e6);}return null;};}function patchUpdates(_0x13d5d4){return function(_0x5b5918){try{jsonpatch[_0x5177('0x22')](_0x5b5918,_0x13d5d4,!![]);}catch(_0x4cf600){return BPromise[_0x5177('0x23')](_0x4cf600);}return _0x5b5918[_0x5177('0x24')]();};}function saveUpdates(_0x219744,_0x27b732){return function(_0x451e5c){if(_0x451e5c){return _0x451e5c[_0x5177('0x25')](_0x219744)[_0x5177('0x26')](function(_0xfc1bd4){return _0xfc1bd4;});}return null;};}function removeEntity(_0x2152d4,_0x2a95cc){return function(_0x23dad2){if(_0x23dad2){return _0x23dad2[_0x5177('0x27')]()['then'](function(){var _0x3dcea1=_0x23dad2['get']({'plain':!![]});var _0x30b60f=_0x5177('0x28');return db[_0x5177('0x29')][_0x5177('0x27')]({'where':{'type':_0x30b60f,'resourceId':_0x3dcea1['id']}})['then'](function(){return _0x23dad2;});})[_0x5177('0x26')](function(){_0x2152d4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x19a0c2,_0x15cb93){return function(_0x577bf7){if(!_0x577bf7){_0x19a0c2[_0x5177('0x1b')](0x194);}return _0x577bf7;};}function handleError(_0x4eba3a,_0x231d35){_0x231d35=_0x231d35||0x1f4;return function(_0x1cbd29){logger['error'](_0x1cbd29[_0x5177('0x2a')]);if(_0x1cbd29[_0x5177('0x2b')]){delete _0x1cbd29[_0x5177('0x2b')];}_0x4eba3a[_0x5177('0x1c')](_0x231d35)[_0x5177('0x2c')](_0x1cbd29);};}exports[_0x5177('0x2d')]=function(_0x5577bb,_0x498fcd){var _0x45cf20={},_0x1c660e={},_0x7dae59={'count':0x0,'rows':[]};var _0x174f7a=_[_0x5177('0x2e')](db[_0x5177('0x2f')][_0x5177('0x30')],function(_0x72dced){return{'name':_0x72dced['fieldName'],'type':_0x72dced[_0x5177('0x31')][_0x5177('0x32')]};});_0x1c660e['model']=_[_0x5177('0x2e')](_0x174f7a,'name');_0x1c660e[_0x5177('0x33')]=_[_0x5177('0x34')](_0x5577bb[_0x5177('0x33')]);_0x1c660e['filters']=_['intersection'](_0x1c660e[_0x5177('0x35')],_0x1c660e[_0x5177('0x33')]);_0x45cf20[_0x5177('0x36')]=_[_0x5177('0x37')](_0x1c660e[_0x5177('0x35')],qs[_0x5177('0x38')](_0x5577bb[_0x5177('0x33')][_0x5177('0x38')]));_0x45cf20['attributes']=_0x45cf20[_0x5177('0x36')][_0x5177('0x39')]?_0x45cf20['attributes']:_0x1c660e[_0x5177('0x35')];if(!_0x5577bb[_0x5177('0x33')][_0x5177('0x3a')](_0x5177('0x3b'))){_0x45cf20[_0x5177('0x20')]=qs[_0x5177('0x20')](_0x5577bb['query'][_0x5177('0x20')]);_0x45cf20[_0x5177('0x1f')]=qs[_0x5177('0x1f')](_0x5577bb[_0x5177('0x33')][_0x5177('0x1f')]);}_0x45cf20[_0x5177('0x3c')]=qs[_0x5177('0x3d')](_0x5577bb['query'][_0x5177('0x3d')]);_0x45cf20[_0x5177('0x3e')]=qs['filters'](_['pick'](_0x5577bb[_0x5177('0x33')],_0x1c660e[_0x5177('0x3f')]),_0x174f7a);if(_0x5577bb[_0x5177('0x33')][_0x5177('0x40')]){_0x45cf20[_0x5177('0x3e')]=_[_0x5177('0x41')](_0x45cf20[_0x5177('0x3e')],{'$or':_[_0x5177('0x2e')](_0x174f7a,function(_0xa2ed49){if(_0xa2ed49[_0x5177('0x31')]!==_0x5177('0x42')){var _0x1f15f8={};_0x1f15f8[_0xa2ed49[_0x5177('0x2b')]]={'$like':'%'+_0x5577bb['query'][_0x5177('0x40')]+'%'};return _0x1f15f8;}})});}_0x45cf20=_[_0x5177('0x41')]({},_0x45cf20,_0x5577bb['options']);var _0x7341c0={'where':_0x45cf20['where']};return db[_0x5177('0x2f')][_0x5177('0x43')](_0x7341c0)[_0x5177('0x26')](function(_0x5742aa){_0x7dae59['count']=_0x5742aa;if(_0x5577bb[_0x5177('0x33')][_0x5177('0x44')]){_0x45cf20[_0x5177('0x45')]=[{'all':!![]}];}return db[_0x5177('0x2f')][_0x5177('0x46')](_0x45cf20);})[_0x5177('0x26')](function(_0x41d874){_0x7dae59[_0x5177('0x47')]=_0x41d874;return _0x7dae59;})['then'](respondWithFilteredResult(_0x498fcd,_0x45cf20))[_0x5177('0x48')](handleError(_0x498fcd,null));};exports['show']=function(_0x5e3d30,_0x30e4f3){var _0x17dc98={'raw':!![],'where':{'id':_0x5e3d30[_0x5177('0x49')]['id']}},_0x5172f8={};_0x5172f8['model']=_['keys'](db[_0x5177('0x2f')][_0x5177('0x30')]);_0x5172f8[_0x5177('0x33')]=_[_0x5177('0x34')](_0x5e3d30[_0x5177('0x33')]);_0x5172f8[_0x5177('0x3f')]=_[_0x5177('0x37')](_0x5172f8['model'],_0x5172f8['query']);_0x17dc98[_0x5177('0x36')]=_['intersection'](_0x5172f8[_0x5177('0x35')],qs[_0x5177('0x38')](_0x5e3d30[_0x5177('0x33')][_0x5177('0x38')]));_0x17dc98['attributes']=_0x17dc98[_0x5177('0x36')][_0x5177('0x39')]?_0x17dc98[_0x5177('0x36')]:_0x5172f8[_0x5177('0x35')];if(_0x5e3d30[_0x5177('0x33')][_0x5177('0x44')]){_0x17dc98[_0x5177('0x45')]=[{'all':!![]}];}_0x17dc98=_[_0x5177('0x41')]({},_0x17dc98,_0x5e3d30[_0x5177('0x4a')]);return db[_0x5177('0x2f')][_0x5177('0x4b')](_0x17dc98)['then'](handleEntityNotFound(_0x30e4f3,null))[_0x5177('0x26')](respondWithResult(_0x30e4f3,null))['catch'](handleError(_0x30e4f3,null));};exports['create']=function(_0x5bda8a,_0x2f9ff9){return db[_0x5177('0x2f')]['create'](_0x5bda8a[_0x5177('0x4c')],{})[_0x5177('0x26')](function(_0x208483){var _0x4891fe=_0x5bda8a[_0x5177('0x4d')]['get']({'plain':!![]});if(!_0x4891fe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4891fe['role']===_0x5177('0x4d')){var _0x37d5dd=_0x208483[_0x5177('0x4e')]({'plain':!![]});var _0x5a1f8b='Metrics';return db[_0x5177('0x4f')]['find']({'where':{'name':_0x5a1f8b,'userProfileId':_0x4891fe[_0x5177('0x50')]},'raw':!![]})[_0x5177('0x26')](function(_0x430e8e){if(_0x430e8e&&_0x430e8e[_0x5177('0x51')]===0x0){return db[_0x5177('0x29')][_0x5177('0x52')]({'name':_0x37d5dd[_0x5177('0x2b')],'resourceId':_0x37d5dd['id'],'type':_0x430e8e[_0x5177('0x2b')],'sectionId':_0x430e8e['id']},{})[_0x5177('0x26')](function(){return _0x208483;});}else{return _0x208483;}})[_0x5177('0x48')](function(_0x89fe3a){logger[_0x5177('0x53')](_0x5177('0x54'),_0x89fe3a);throw _0x89fe3a;});}return _0x208483;})['then'](respondWithResult(_0x2f9ff9,0xc9))['catch'](handleError(_0x2f9ff9,null));};exports[_0x5177('0x25')]=function(_0x5d5016,_0x649c6f){if(_0x5d5016['body']['id']){delete _0x5d5016[_0x5177('0x4c')]['id'];}return db[_0x5177('0x2f')][_0x5177('0x4b')]({'where':{'id':_0x5d5016['params']['id']}})['then'](handleEntityNotFound(_0x649c6f,null))[_0x5177('0x26')](saveUpdates(_0x5d5016[_0x5177('0x4c')],null))[_0x5177('0x26')](respondWithResult(_0x649c6f,null))[_0x5177('0x48')](handleError(_0x649c6f,null));};exports['destroy']=function(_0x5718a1,_0x3f0e89){return db[_0x5177('0x2f')][_0x5177('0x4b')]({'where':{'id':_0x5718a1[_0x5177('0x49')]['id']}})['then'](handleEntityNotFound(_0x3f0e89,null))[_0x5177('0x26')](removeEntity(_0x3f0e89,null))[_0x5177('0x48')](handleError(_0x3f0e89,null));}; \ No newline at end of file +var _0x0972=['include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','then','destroy','get','Metrics','error','name','send','index','map','AnalyticMetric','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll'];(function(_0x2474ac,_0x335d3a){var _0x384a8f=function(_0x402bf6){while(--_0x402bf6){_0x2474ac['push'](_0x2474ac['shift']());}};_0x384a8f(++_0x335d3a);}(_0x0972,0x64));var _0x2097=function(_0x445511,_0x226ba0){_0x445511=_0x445511-0x0;var _0x53d20f=_0x0972[_0x445511];return _0x53d20f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2097('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2097('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2097('0x2'));var moment=require(_0x2097('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2097('0x4'));var util=require(_0x2097('0x5'));var path=require(_0x2097('0x6'));var sox=require(_0x2097('0x7'));var csv=require(_0x2097('0x8'));var ejs=require(_0x2097('0x9'));var fs=require('fs');var _=require(_0x2097('0xa'));var squel=require('squel');var crypto=require(_0x2097('0xb'));var jsforce=require(_0x2097('0xc'));var deskjs=require(_0x2097('0xd'));var toCsv=require(_0x2097('0x8'));var querystring=require(_0x2097('0xe'));var Papa=require('papaparse');var Redis=require(_0x2097('0xf'));var authService=require(_0x2097('0x10'));var qs=require(_0x2097('0x11'));var as=require(_0x2097('0x12'));var hardwareService=require(_0x2097('0x13'));var logger=require(_0x2097('0x14'))(_0x2097('0x15'));var utils=require(_0x2097('0x16'));var config=require(_0x2097('0x17'));var db=require(_0x2097('0x18'))['db'];function respondWithStatusCode(_0x2cc91c,_0x3b2f94){_0x3b2f94=_0x3b2f94||0xcc;return function(_0x170005){if(_0x170005){return _0x2cc91c[_0x2097('0x19')](_0x3b2f94);}return _0x2cc91c[_0x2097('0x1a')](_0x3b2f94)[_0x2097('0x1b')]();};}function respondWithResult(_0x185be8,_0x1c9ef9){_0x1c9ef9=_0x1c9ef9||0xc8;return function(_0x2c3e41){if(_0x2c3e41){return _0x185be8[_0x2097('0x1a')](_0x1c9ef9)['json'](_0x2c3e41);}};}function respondWithFilteredResult(_0x639c14,_0x35c062){return function(_0x4d31bc){if(_0x4d31bc){var _0x4eec05=_0x4d31bc[_0x2097('0x1c')],_0x4fc8c5=_0x35c062[_0x2097('0x1d')],_0x409deb=_0x35c062[_0x2097('0x1d')]+_0x35c062[_0x2097('0x1e')],_0x588396;if(_0x409deb>=_0x4eec05){_0x409deb=_0x4eec05;_0x588396=0xc8;}else{_0x588396=0xce;}_0x639c14[_0x2097('0x1a')](_0x588396);return _0x639c14['set'](_0x2097('0x1f'),_0x4fc8c5+'-'+_0x409deb+'/'+_0x4eec05)[_0x2097('0x20')](_0x4d31bc);}return null;};}function patchUpdates(_0x451584){return function(_0x34654a){try{jsonpatch[_0x2097('0x21')](_0x34654a,_0x451584,!![]);}catch(_0x235304){return BPromise[_0x2097('0x22')](_0x235304);}return _0x34654a[_0x2097('0x23')]();};}function saveUpdates(_0x5d8b9e,_0x4d957e){return function(_0xf65dc6){if(_0xf65dc6){return _0xf65dc6['update'](_0x5d8b9e)[_0x2097('0x24')](function(_0x1ac5f1){return _0x1ac5f1;});}return null;};}function removeEntity(_0x49f601,_0x442db7){return function(_0x5b0582){if(_0x5b0582){return _0x5b0582[_0x2097('0x25')]()[_0x2097('0x24')](function(){var _0x36189e=_0x5b0582[_0x2097('0x26')]({'plain':!![]});var _0x36b15e=_0x2097('0x27');return db['UserProfileResource'][_0x2097('0x25')]({'where':{'type':_0x36b15e,'resourceId':_0x36189e['id']}})['then'](function(){return _0x5b0582;});})[_0x2097('0x24')](function(){_0x49f601[_0x2097('0x1a')](0xcc)[_0x2097('0x1b')]();});}};}function handleEntityNotFound(_0x9f59bc,_0x499988){return function(_0x2d683a){if(!_0x2d683a){_0x9f59bc[_0x2097('0x19')](0x194);}return _0x2d683a;};}function handleError(_0x56af3b,_0x1229fc){_0x1229fc=_0x1229fc||0x1f4;return function(_0x5ed0fa){logger[_0x2097('0x28')](_0x5ed0fa['stack']);if(_0x5ed0fa[_0x2097('0x29')]){delete _0x5ed0fa[_0x2097('0x29')];}_0x56af3b[_0x2097('0x1a')](_0x1229fc)[_0x2097('0x2a')](_0x5ed0fa);};}exports[_0x2097('0x2b')]=function(_0x36228c,_0x450e0b){var _0x4b443d={},_0x11242f={},_0x14d964={'count':0x0,'rows':[]};var _0x5cce55=_[_0x2097('0x2c')](db[_0x2097('0x2d')]['rawAttributes'],function(_0x4d0916){return{'name':_0x4d0916[_0x2097('0x2e')],'type':_0x4d0916[_0x2097('0x2f')][_0x2097('0x30')]};});_0x11242f[_0x2097('0x31')]=_[_0x2097('0x2c')](_0x5cce55,_0x2097('0x29'));_0x11242f['query']=_[_0x2097('0x32')](_0x36228c['query']);_0x11242f[_0x2097('0x33')]=_[_0x2097('0x34')](_0x11242f[_0x2097('0x31')],_0x11242f[_0x2097('0x35')]);_0x4b443d[_0x2097('0x36')]=_[_0x2097('0x34')](_0x11242f[_0x2097('0x31')],qs[_0x2097('0x37')](_0x36228c[_0x2097('0x35')]['fields']));_0x4b443d[_0x2097('0x36')]=_0x4b443d[_0x2097('0x36')][_0x2097('0x38')]?_0x4b443d['attributes']:_0x11242f[_0x2097('0x31')];if(!_0x36228c[_0x2097('0x35')][_0x2097('0x39')](_0x2097('0x3a'))){_0x4b443d['limit']=qs['limit'](_0x36228c['query'][_0x2097('0x1e')]);_0x4b443d[_0x2097('0x1d')]=qs[_0x2097('0x1d')](_0x36228c[_0x2097('0x35')][_0x2097('0x1d')]);}_0x4b443d[_0x2097('0x3b')]=qs['sort'](_0x36228c[_0x2097('0x35')][_0x2097('0x3c')]);_0x4b443d[_0x2097('0x3d')]=qs[_0x2097('0x33')](_[_0x2097('0x3e')](_0x36228c[_0x2097('0x35')],_0x11242f['filters']),_0x5cce55);if(_0x36228c[_0x2097('0x35')][_0x2097('0x3f')]){_0x4b443d[_0x2097('0x3d')]=_['merge'](_0x4b443d['where'],{'$or':_[_0x2097('0x2c')](_0x5cce55,function(_0x372693){if(_0x372693[_0x2097('0x2f')]!==_0x2097('0x40')){var _0x41c9e6={};_0x41c9e6[_0x372693[_0x2097('0x29')]]={'$like':'%'+_0x36228c[_0x2097('0x35')][_0x2097('0x3f')]+'%'};return _0x41c9e6;}})});}_0x4b443d=_[_0x2097('0x41')]({},_0x4b443d,_0x36228c[_0x2097('0x42')]);var _0x337979={'where':_0x4b443d[_0x2097('0x3d')]};return db['AnalyticMetric'][_0x2097('0x1c')](_0x337979)[_0x2097('0x24')](function(_0x7b556c){_0x14d964['count']=_0x7b556c;if(_0x36228c[_0x2097('0x35')][_0x2097('0x43')]){_0x4b443d[_0x2097('0x44')]=[{'all':!![]}];}return db[_0x2097('0x2d')][_0x2097('0x45')](_0x4b443d);})[_0x2097('0x24')](function(_0x29dab3){_0x14d964[_0x2097('0x46')]=_0x29dab3;return _0x14d964;})['then'](respondWithFilteredResult(_0x450e0b,_0x4b443d))[_0x2097('0x47')](handleError(_0x450e0b,null));};exports[_0x2097('0x48')]=function(_0x186ca5,_0x3288ae){var _0x12e0e2={'raw':!![],'where':{'id':_0x186ca5[_0x2097('0x49')]['id']}},_0xe3ac1b={};_0xe3ac1b[_0x2097('0x31')]=_['keys'](db[_0x2097('0x2d')]['rawAttributes']);_0xe3ac1b[_0x2097('0x35')]=_[_0x2097('0x32')](_0x186ca5[_0x2097('0x35')]);_0xe3ac1b[_0x2097('0x33')]=_[_0x2097('0x34')](_0xe3ac1b['model'],_0xe3ac1b[_0x2097('0x35')]);_0x12e0e2[_0x2097('0x36')]=_[_0x2097('0x34')](_0xe3ac1b[_0x2097('0x31')],qs[_0x2097('0x37')](_0x186ca5['query'][_0x2097('0x37')]));_0x12e0e2[_0x2097('0x36')]=_0x12e0e2[_0x2097('0x36')][_0x2097('0x38')]?_0x12e0e2[_0x2097('0x36')]:_0xe3ac1b[_0x2097('0x31')];if(_0x186ca5[_0x2097('0x35')][_0x2097('0x43')]){_0x12e0e2['include']=[{'all':!![]}];}_0x12e0e2=_[_0x2097('0x41')]({},_0x12e0e2,_0x186ca5[_0x2097('0x42')]);return db[_0x2097('0x2d')][_0x2097('0x4a')](_0x12e0e2)['then'](handleEntityNotFound(_0x3288ae,null))['then'](respondWithResult(_0x3288ae,null))['catch'](handleError(_0x3288ae,null));};exports[_0x2097('0x4b')]=function(_0x396979,_0x4c4ef9){return db[_0x2097('0x2d')][_0x2097('0x4b')](_0x396979['body'],{})['then'](function(_0x23acf3){var _0x21829d=_0x396979[_0x2097('0x4c')]['get']({'plain':!![]});if(!_0x21829d)throw new Error(_0x2097('0x4d'));if(_0x21829d[_0x2097('0x4e')]==='user'){var _0x86a05a=_0x23acf3[_0x2097('0x26')]({'plain':!![]});var _0xdfea21=_0x2097('0x27');return db[_0x2097('0x4f')]['find']({'where':{'name':_0xdfea21,'userProfileId':_0x21829d['userProfileId']},'raw':!![]})[_0x2097('0x24')](function(_0x39f9cb){if(_0x39f9cb&&_0x39f9cb[_0x2097('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x86a05a[_0x2097('0x29')],'resourceId':_0x86a05a['id'],'type':_0x39f9cb[_0x2097('0x29')],'sectionId':_0x39f9cb['id']},{})['then'](function(){return _0x23acf3;});}else{return _0x23acf3;}})[_0x2097('0x47')](function(_0x33583e){logger[_0x2097('0x28')](_0x2097('0x51'),_0x33583e);throw _0x33583e;});}return _0x23acf3;})[_0x2097('0x24')](respondWithResult(_0x4c4ef9,0xc9))['catch'](handleError(_0x4c4ef9,null));};exports[_0x2097('0x52')]=function(_0x228b60,_0x190859){if(_0x228b60['body']['id']){delete _0x228b60[_0x2097('0x53')]['id'];}return db[_0x2097('0x2d')]['find']({'where':{'id':_0x228b60[_0x2097('0x49')]['id']}})['then'](handleEntityNotFound(_0x190859,null))[_0x2097('0x24')](saveUpdates(_0x228b60['body'],null))['then'](respondWithResult(_0x190859,null))['catch'](handleError(_0x190859,null));};exports[_0x2097('0x25')]=function(_0x4d720a,_0x54bea1){return db[_0x2097('0x2d')]['find']({'where':{'id':_0x4d720a[_0x2097('0x49')]['id']}})[_0x2097('0x24')](handleEntityNotFound(_0x54bea1,null))['then'](removeEntity(_0x54bea1,null))[_0x2097('0x47')](handleError(_0x54bea1,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index f2335d3..833f3fa 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 _0x6ef9=['bluebird','request-promise','path','../../config/environment','./analyticMetric.attributes','exports','define','analytics_metrics','lodash','util','api','moment'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x6ef9,0x11c));var _0x96ef=function(_0x3f6c29,_0x370d86){_0x3f6c29=_0x3f6c29-0x0;var _0x4af959=_0x6ef9[_0x3f6c29];return _0x4af959;};'use strict';var _=require(_0x96ef('0x0'));var util=require(_0x96ef('0x1'));var logger=require('../../config/logger')(_0x96ef('0x2'));var moment=require(_0x96ef('0x3'));var BPromise=require(_0x96ef('0x4'));var rp=require(_0x96ef('0x5'));var fs=require('fs');var path=require(_0x96ef('0x6'));var rimraf=require('rimraf');var config=require(_0x96ef('0x7'));var attributes=require(_0x96ef('0x8'));module[_0x96ef('0x9')]=function(_0x53afba,_0x2c8d51){return _0x53afba[_0x96ef('0xa')]('AnalyticMetric',attributes,{'tableName':_0x96ef('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a9b=['analytics_metrics','lodash','util','moment','bluebird','path','rimraf','../../config/environment','exports','define','AnalyticMetric'];(function(_0x34e747,_0x173163){var _0x200a90=function(_0x2cfb42){while(--_0x2cfb42){_0x34e747['push'](_0x34e747['shift']());}};_0x200a90(++_0x173163);}(_0x1a9b,0x9b));var _0xb1a9=function(_0x44aac2,_0x336163){_0x44aac2=_0x44aac2-0x0;var _0x38a6bc=_0x1a9b[_0x44aac2];return _0x38a6bc;};'use strict';var _=require(_0xb1a9('0x0'));var util=require(_0xb1a9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb1a9('0x2'));var BPromise=require(_0xb1a9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb1a9('0x4'));var rimraf=require(_0xb1a9('0x5'));var config=require(_0xb1a9('0x6'));var attributes=require('./analyticMetric.attributes');module[_0xb1a9('0x7')]=function(_0x4228f9,_0x1a499c){return _0x4228f9[_0xb1a9('0x8')](_0xb1a9('0x9'),attributes,{'tableName':_0xb1a9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 9896c39..f4950ea 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 _0xdd93=['code','message','catch','lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x5c83f4,_0x83d00){var _0x237bf1=function(_0x1a528c){while(--_0x1a528c){_0x5c83f4['push'](_0x5c83f4['shift']());}};_0x237bf1(++_0x83d00);}(_0xdd93,0x1f1));var _0x3dd9=function(_0x3b57c0,_0xc11303){_0x3b57c0=_0x3b57c0-0x0;var _0x33aafa=_0xdd93[_0x3b57c0];return _0x33aafa;};'use strict';var _=require(_0x3dd9('0x0'));var util=require('util');var moment=require(_0x3dd9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3dd9('0x2'));var db=require(_0x3dd9('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3dd9('0x4'))(_0x3dd9('0x5'));var config=require(_0x3dd9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3dd9('0x7')][_0x3dd9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x433626,_0x4c682a,_0xb18162){return new BPromise(function(_0x47543e,_0x3da91e){return client['request'](_0x433626,_0xb18162)[_0x3dd9('0x9')](function(_0x3fc546){logger[_0x3dd9('0xa')](_0x3dd9('0xb'),_0x4c682a,_0x3dd9('0xc'));logger[_0x3dd9('0xd')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x4c682a,_0x3dd9('0xc'),JSON[_0x3dd9('0xe')](_0x3fc546));if(_0x3fc546['error']){if(_0x3fc546[_0x3dd9('0xf')][_0x3dd9('0x10')]===0x1f4){logger[_0x3dd9('0xf')](_0x3dd9('0xb'),_0x4c682a,_0x3fc546[_0x3dd9('0xf')][_0x3dd9('0x11')]);return _0x3da91e(_0x3fc546[_0x3dd9('0xf')][_0x3dd9('0x11')]);}logger[_0x3dd9('0xf')](_0x3dd9('0xb'),_0x4c682a,_0x3fc546[_0x3dd9('0xf')][_0x3dd9('0x11')]);return _0x47543e(_0x3fc546['error'][_0x3dd9('0x11')]);}else{logger[_0x3dd9('0xa')]('AnalyticMetric,\x20%s,\x20%s',_0x4c682a,_0x3dd9('0xc'));_0x47543e(_0x3fc546['result'][_0x3dd9('0x11')]);}})[_0x3dd9('0x12')](function(_0x343ffc){logger['error'](_0x3dd9('0xb'),_0x4c682a,_0x343ffc);_0x3da91e(_0x343ffc);});});} \ No newline at end of file +var _0x004b=['request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','code','message','info','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','AnalyticMetric,\x20%s,\x20%s'];(function(_0x3b59ed,_0x281a70){var _0x5cf829=function(_0xca820){while(--_0xca820){_0x3b59ed['push'](_0x3b59ed['shift']());}};_0x5cf829(++_0x281a70);}(_0x004b,0x137));var _0xb004=function(_0x19fe93,_0x588ca3){_0x19fe93=_0x19fe93-0x0;var _0x34e86a=_0x004b[_0x19fe93];return _0x34e86a;};'use strict';var _=require(_0xb004('0x0'));var util=require(_0xb004('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb004('0x2'));var fs=require('fs');var Redis=require(_0xb004('0x3'));var db=require(_0xb004('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb004('0x5'))(_0xb004('0x6'));var config=require(_0xb004('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb004('0x8')][_0xb004('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x199c8a,_0x2d612b,_0x2a7331){return new BPromise(function(_0x41fb12,_0x2f5cda){return client[_0xb004('0xa')](_0x199c8a,_0x2a7331)['then'](function(_0x44200f){logger['info'](_0xb004('0xb'),_0x2d612b,_0xb004('0xc'));logger[_0xb004('0xd')](_0xb004('0xe'),_0x2d612b,_0xb004('0xc'),JSON['stringify'](_0x44200f));if(_0x44200f[_0xb004('0xf')]){if(_0x44200f['error'][_0xb004('0x10')]===0x1f4){logger[_0xb004('0xf')](_0xb004('0xb'),_0x2d612b,_0x44200f[_0xb004('0xf')][_0xb004('0x11')]);return _0x2f5cda(_0x44200f[_0xb004('0xf')][_0xb004('0x11')]);}logger[_0xb004('0xf')](_0xb004('0xb'),_0x2d612b,_0x44200f['error'][_0xb004('0x11')]);return _0x41fb12(_0x44200f[_0xb004('0xf')][_0xb004('0x11')]);}else{logger[_0xb004('0x12')](_0xb004('0xb'),_0x2d612b,_0xb004('0xc'));_0x41fb12(_0x44200f['result'][_0xb004('0x11')]);}})['catch'](function(_0x5b9074){logger[_0xb004('0xf')](_0xb004('0xb'),_0x2d612b,_0x5b9074);_0x2f5cda(_0x5b9074);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 680ba19..0b1006b 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 _0x6d38=['path','connect-timeout','../../components/auth/service','../../config/environment','./analyticMetric.controller','get','index','/:id','isAuthenticated','create','put','update','delete','destroy','exports','util'];(function(_0x520a12,_0x10e69c){var _0x248e1f=function(_0x5045cf){while(--_0x5045cf){_0x520a12['push'](_0x520a12['shift']());}};_0x248e1f(++_0x10e69c);}(_0x6d38,0x1ef));var _0x86d3=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x6d38[_0xefd519];return _0x4bb882;};'use strict';var multer=require('multer');var util=require(_0x86d3('0x0'));var path=require(_0x86d3('0x1'));var timeout=require(_0x86d3('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x86d3('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x86d3('0x4'));var controller=require(_0x86d3('0x5'));router[_0x86d3('0x6')]('/',auth['isAuthenticated'](),controller[_0x86d3('0x7')]);router[_0x86d3('0x6')](_0x86d3('0x8'),auth[_0x86d3('0x9')](),controller['show']);router['post']('/',auth[_0x86d3('0x9')](),controller[_0x86d3('0xa')]);router[_0x86d3('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x86d3('0xc')]);router[_0x86d3('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x86d3('0xe')]);module[_0x86d3('0xf')]=router; \ No newline at end of file +var _0x2ef3=['post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show'];(function(_0x39e2f9,_0xc931d6){var _0x3bd552=function(_0xd3ea29){while(--_0xd3ea29){_0x39e2f9['push'](_0x39e2f9['shift']());}};_0x3bd552(++_0xc931d6);}(_0x2ef3,0xba));var _0x32ef=function(_0x26f18d,_0x47cb60){_0x26f18d=_0x26f18d-0x0;var _0x51a6a2=_0x2ef3[_0x26f18d];return _0x51a6a2;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x32ef('0x6'));var config=require(_0x32ef('0x7'));var controller=require('./analyticMetric.controller');router[_0x32ef('0x8')]('/',auth[_0x32ef('0x9')](),controller['index']);router['get'](_0x32ef('0xa'),auth[_0x32ef('0x9')](),controller[_0x32ef('0xb')]);router[_0x32ef('0xc')]('/',auth[_0x32ef('0x9')](),controller[_0x32ef('0xd')]);router[_0x32ef('0xe')](_0x32ef('0xa'),auth[_0x32ef('0x9')](),controller[_0x32ef('0xf')]);router['delete']('/:id',auth[_0x32ef('0x9')](),controller[_0x32ef('0x10')]);module[_0x32ef('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 482ebf5..52c97a6 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 _0x0cd8=['TEXT','sequelize','exports'];(function(_0xd099f4,_0x405b29){var _0x371b07=function(_0x46612c){while(--_0x46612c){_0xd099f4['push'](_0xd099f4['shift']());}};_0x371b07(++_0x405b29);}(_0x0cd8,0x1ab));var _0x80cd=function(_0x4d76e6,_0x92952b){_0x4d76e6=_0x4d76e6-0x0;var _0x3ec886=_0x0cd8[_0x4d76e6];return _0x3ec886;};'use strict';var Sequelize=require(_0x80cd('0x0'));module[_0x80cd('0x1')]={'tree':{'type':Sequelize[_0x80cd('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x65b2=['TEXT','sequelize'];(function(_0x59f0ff,_0x2b9d67){var _0x28e782=function(_0x437e09){while(--_0x437e09){_0x59f0ff['push'](_0x59f0ff['shift']());}};_0x28e782(++_0x2b9d67);}(_0x65b2,0x181));var _0x265b=function(_0x7457fe,_0x564a5e){_0x7457fe=_0x7457fe-0x0;var _0x57a6e4=_0x65b2[_0x7457fe];return _0x57a6e4;};'use strict';var Sequelize=require(_0x265b('0x0'));module['exports']={'tree':{'type':Sequelize[_0x265b('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index d2034ab..1e60952 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 _0x7137=['Content-Range','reject','save','then','error','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','update','body','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x7137,0x102));var _0x7713=function(_0x3e9898,_0x3dd20e){_0x3e9898=_0x3e9898-0x0;var _0x4f93e5=_0x7137[_0x3e9898];return _0x4f93e5;};'use strict';var pdf=require(_0x7713('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7713('0x1'));var zipdir=require(_0x7713('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7713('0x3'));var moment=require(_0x7713('0x4'));var BPromise=require(_0x7713('0x5'));var Mustache=require(_0x7713('0x6'));var util=require(_0x7713('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x7713('0x8'));var ejs=require(_0x7713('0x9'));var fs=require('fs');var _=require(_0x7713('0xa'));var squel=require(_0x7713('0xb'));var crypto=require(_0x7713('0xc'));var jsforce=require(_0x7713('0xd'));var deskjs=require(_0x7713('0xe'));var toCsv=require(_0x7713('0x8'));var querystring=require(_0x7713('0xf'));var Papa=require('papaparse');var Redis=require(_0x7713('0x10'));var authService=require(_0x7713('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7713('0x12'));var hardwareService=require(_0x7713('0x13'));var logger=require('../../config/logger')(_0x7713('0x14'));var utils=require(_0x7713('0x15'));var config=require(_0x7713('0x16'));var db=require(_0x7713('0x17'))['db'];function respondWithStatusCode(_0x48df8e,_0x31dd7a){_0x31dd7a=_0x31dd7a||0xcc;return function(_0x4d7598){if(_0x4d7598){return _0x48df8e[_0x7713('0x18')](_0x31dd7a);}return _0x48df8e[_0x7713('0x19')](_0x31dd7a)[_0x7713('0x1a')]();};}function respondWithResult(_0x4058a8,_0x3216c4){_0x3216c4=_0x3216c4||0xc8;return function(_0x5e7a6a){if(_0x5e7a6a){return _0x4058a8['status'](_0x3216c4)['json'](_0x5e7a6a);}};}function respondWithFilteredResult(_0x1d8dd4,_0x1a8ec0){return function(_0xe0b76e){if(_0xe0b76e){var _0x2f4eef=_0xe0b76e[_0x7713('0x1b')],_0x135721=_0x1a8ec0[_0x7713('0x1c')],_0x1b5afb=_0x1a8ec0[_0x7713('0x1c')]+_0x1a8ec0[_0x7713('0x1d')],_0x266b45;if(_0x1b5afb>=_0x2f4eef){_0x1b5afb=_0x2f4eef;_0x266b45=0xc8;}else{_0x266b45=0xce;}_0x1d8dd4[_0x7713('0x19')](_0x266b45);return _0x1d8dd4['set'](_0x7713('0x1e'),_0x135721+'-'+_0x1b5afb+'/'+_0x2f4eef)['json'](_0xe0b76e);}return null;};}function patchUpdates(_0x2ac769){return function(_0x2b3e09){try{jsonpatch['apply'](_0x2b3e09,_0x2ac769,!![]);}catch(_0x500fc8){return BPromise[_0x7713('0x1f')](_0x500fc8);}return _0x2b3e09[_0x7713('0x20')]();};}function saveUpdates(_0x457afc,_0x5713e8){return function(_0x3cc820){if(_0x3cc820){return _0x3cc820['update'](_0x457afc)[_0x7713('0x21')](function(_0x2de6ae){return _0x2de6ae;});}return null;};}function removeEntity(_0x541686,_0xec29f3){return function(_0x2d27d4){if(_0x2d27d4){return _0x2d27d4['destroy']()['then'](function(){_0x541686[_0x7713('0x19')](0xcc)[_0x7713('0x1a')]();});}};}function handleEntityNotFound(_0x13dd6f,_0x4017f1){return function(_0x34fe6d){if(!_0x34fe6d){_0x13dd6f['sendStatus'](0x194);}return _0x34fe6d;};}function handleError(_0x4c30f5,_0x19ad1f){_0x19ad1f=_0x19ad1f||0x1f4;return function(_0x412179){logger[_0x7713('0x22')](_0x412179['stack']);if(_0x412179['name']){delete _0x412179[_0x7713('0x23')];}_0x4c30f5[_0x7713('0x19')](_0x19ad1f)[_0x7713('0x24')](_0x412179);};}exports[_0x7713('0x25')]=function(_0x5b6f52,_0x31e2f7){var _0x36a37b={},_0x70adc2={},_0x3e861f={'count':0x0,'rows':[]};var _0xb92ba9=_[_0x7713('0x26')](db[_0x7713('0x27')][_0x7713('0x28')],function(_0x54c0b3){return{'name':_0x54c0b3[_0x7713('0x29')],'type':_0x54c0b3[_0x7713('0x2a')][_0x7713('0x2b')]};});_0x70adc2[_0x7713('0x2c')]=_[_0x7713('0x26')](_0xb92ba9,_0x7713('0x23'));_0x70adc2[_0x7713('0x2d')]=_[_0x7713('0x2e')](_0x5b6f52['query']);_0x70adc2[_0x7713('0x2f')]=_['intersection'](_0x70adc2[_0x7713('0x2c')],_0x70adc2[_0x7713('0x2d')]);_0x36a37b[_0x7713('0x30')]=_['intersection'](_0x70adc2[_0x7713('0x2c')],qs[_0x7713('0x31')](_0x5b6f52[_0x7713('0x2d')][_0x7713('0x31')]));_0x36a37b[_0x7713('0x30')]=_0x36a37b['attributes'][_0x7713('0x32')]?_0x36a37b[_0x7713('0x30')]:_0x70adc2['model'];if(!_0x5b6f52['query'][_0x7713('0x33')](_0x7713('0x34'))){_0x36a37b[_0x7713('0x1d')]=qs['limit'](_0x5b6f52[_0x7713('0x2d')][_0x7713('0x1d')]);_0x36a37b['offset']=qs['offset'](_0x5b6f52['query'][_0x7713('0x1c')]);}_0x36a37b['order']=qs[_0x7713('0x35')](_0x5b6f52[_0x7713('0x2d')][_0x7713('0x35')]);_0x36a37b[_0x7713('0x36')]=qs[_0x7713('0x2f')](_[_0x7713('0x37')](_0x5b6f52[_0x7713('0x2d')],_0x70adc2[_0x7713('0x2f')]),_0xb92ba9);if(_0x5b6f52[_0x7713('0x2d')]['filter']){_0x36a37b[_0x7713('0x36')]=_[_0x7713('0x38')](_0x36a37b[_0x7713('0x36')],{'$or':_['map'](_0xb92ba9,function(_0x2f5d03){if(_0x2f5d03[_0x7713('0x2a')]!==_0x7713('0x39')){var _0x2fbb0f={};_0x2fbb0f[_0x2f5d03[_0x7713('0x23')]]={'$like':'%'+_0x5b6f52[_0x7713('0x2d')][_0x7713('0x3a')]+'%'};return _0x2fbb0f;}})});}_0x36a37b=_[_0x7713('0x38')]({},_0x36a37b,_0x5b6f52[_0x7713('0x3b')]);var _0x105448={'where':_0x36a37b['where']};return db[_0x7713('0x27')][_0x7713('0x1b')](_0x105448)[_0x7713('0x21')](function(_0x286949){_0x3e861f['count']=_0x286949;if(_0x5b6f52['query'][_0x7713('0x3c')]){_0x36a37b[_0x7713('0x3d')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x7713('0x3e')](_0x36a37b);})[_0x7713('0x21')](function(_0x202e85){_0x3e861f[_0x7713('0x3f')]=_0x202e85;return _0x3e861f;})['then'](respondWithFilteredResult(_0x31e2f7,_0x36a37b))[_0x7713('0x40')](handleError(_0x31e2f7,null));};exports[_0x7713('0x41')]=function(_0x555294,_0x32757e){var _0xa0f2e={'raw':!![],'where':{'id':_0x555294[_0x7713('0x42')]['id']}},_0x2aa03a={};_0x2aa03a[_0x7713('0x2c')]=_['keys'](db['AnalyticTreeReport'][_0x7713('0x28')]);_0x2aa03a[_0x7713('0x2d')]=_['keys'](_0x555294['query']);_0x2aa03a[_0x7713('0x2f')]=_[_0x7713('0x43')](_0x2aa03a['model'],_0x2aa03a[_0x7713('0x2d')]);_0xa0f2e[_0x7713('0x30')]=_[_0x7713('0x43')](_0x2aa03a['model'],qs[_0x7713('0x31')](_0x555294[_0x7713('0x2d')]['fields']));_0xa0f2e[_0x7713('0x30')]=_0xa0f2e['attributes']['length']?_0xa0f2e[_0x7713('0x30')]:_0x2aa03a[_0x7713('0x2c')];if(_0x555294[_0x7713('0x2d')][_0x7713('0x3c')]){_0xa0f2e[_0x7713('0x3d')]=[{'all':!![]}];}_0xa0f2e=_['merge']({},_0xa0f2e,_0x555294[_0x7713('0x3b')]);return db[_0x7713('0x27')][_0x7713('0x44')](_0xa0f2e)[_0x7713('0x21')](handleEntityNotFound(_0x32757e,null))[_0x7713('0x21')](respondWithResult(_0x32757e,null))[_0x7713('0x40')](handleError(_0x32757e,null));};exports[_0x7713('0x45')]=function(_0x2d2fb9,_0x9a2ba4){return db['AnalyticTreeReport'][_0x7713('0x45')](_0x2d2fb9['body'],{})[_0x7713('0x21')](respondWithResult(_0x9a2ba4,0xc9))[_0x7713('0x40')](handleError(_0x9a2ba4,null));};exports[_0x7713('0x46')]=function(_0x2de1fe,_0x1dd608){if(_0x2de1fe[_0x7713('0x47')]['id']){delete _0x2de1fe[_0x7713('0x47')]['id'];}return db[_0x7713('0x27')][_0x7713('0x44')]({'where':{'id':_0x2de1fe[_0x7713('0x42')]['id']}})[_0x7713('0x21')](handleEntityNotFound(_0x1dd608,null))[_0x7713('0x21')](saveUpdates(_0x2de1fe[_0x7713('0x47')],null))[_0x7713('0x21')](respondWithResult(_0x1dd608,null))[_0x7713('0x40')](handleError(_0x1dd608,null));};exports['destroy']=function(_0x5122c7,_0x1f5544){return db['AnalyticTreeReport']['find']({'where':{'id':_0x5122c7[_0x7713('0x42')]['id']}})[_0x7713('0x21')](handleEntityNotFound(_0x1f5544,null))[_0x7713('0x21')](removeEntity(_0x1f5544,null))[_0x7713('0x40')](handleError(_0x1f5544,null));}; \ No newline at end of file +var _0xe77b=['destroy','sendStatus','error','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','keys','filters','intersection','model','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','status','end','json','offset','limit','set','Content-Range','apply','reject','update','then'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe77b,0xb5));var _0xbe77=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xe77b[_0x1facfa];return _0x9ec701;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbe77('0x0'));var rimraf=require(_0xbe77('0x1'));var zipdir=require(_0xbe77('0x2'));var jsonpatch=require(_0xbe77('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbe77('0x4'));var Mustache=require(_0xbe77('0x5'));var util=require(_0xbe77('0x6'));var path=require('path');var sox=require(_0xbe77('0x7'));var csv=require(_0xbe77('0x8'));var ejs=require(_0xbe77('0x9'));var fs=require('fs');var _=require(_0xbe77('0xa'));var squel=require('squel');var crypto=require(_0xbe77('0xb'));var jsforce=require(_0xbe77('0xc'));var deskjs=require(_0xbe77('0xd'));var toCsv=require(_0xbe77('0x8'));var querystring=require('querystring');var Papa=require(_0xbe77('0xe'));var Redis=require('ioredis');var authService=require(_0xbe77('0xf'));var qs=require(_0xbe77('0x10'));var as=require(_0xbe77('0x11'));var hardwareService=require(_0xbe77('0x12'));var logger=require('../../config/logger')(_0xbe77('0x13'));var utils=require('../../config/utils');var config=require(_0xbe77('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28207c,_0x571be6){_0x571be6=_0x571be6||0xcc;return function(_0x2855c4){if(_0x2855c4){return _0x28207c['sendStatus'](_0x571be6);}return _0x28207c[_0xbe77('0x15')](_0x571be6)[_0xbe77('0x16')]();};}function respondWithResult(_0x539592,_0x3e1f37){_0x3e1f37=_0x3e1f37||0xc8;return function(_0x505291){if(_0x505291){return _0x539592[_0xbe77('0x15')](_0x3e1f37)[_0xbe77('0x17')](_0x505291);}};}function respondWithFilteredResult(_0x15426f,_0x5321f3){return function(_0x1c879d){if(_0x1c879d){var _0x542b0c=_0x1c879d['count'],_0x3973aa=_0x5321f3[_0xbe77('0x18')],_0x727ada=_0x5321f3[_0xbe77('0x18')]+_0x5321f3[_0xbe77('0x19')],_0x821a87;if(_0x727ada>=_0x542b0c){_0x727ada=_0x542b0c;_0x821a87=0xc8;}else{_0x821a87=0xce;}_0x15426f[_0xbe77('0x15')](_0x821a87);return _0x15426f[_0xbe77('0x1a')](_0xbe77('0x1b'),_0x3973aa+'-'+_0x727ada+'/'+_0x542b0c)['json'](_0x1c879d);}return null;};}function patchUpdates(_0x13bd39){return function(_0x15429f){try{jsonpatch[_0xbe77('0x1c')](_0x15429f,_0x13bd39,!![]);}catch(_0x5bc7e4){return BPromise[_0xbe77('0x1d')](_0x5bc7e4);}return _0x15429f['save']();};}function saveUpdates(_0xd8b37c,_0x4527cb){return function(_0x179143){if(_0x179143){return _0x179143[_0xbe77('0x1e')](_0xd8b37c)[_0xbe77('0x1f')](function(_0x42f44a){return _0x42f44a;});}return null;};}function removeEntity(_0x3a11ee,_0x198a4a){return function(_0x5cfcac){if(_0x5cfcac){return _0x5cfcac[_0xbe77('0x20')]()['then'](function(){_0x3a11ee[_0xbe77('0x15')](0xcc)[_0xbe77('0x16')]();});}};}function handleEntityNotFound(_0x4e59cf,_0x45859f){return function(_0x3c0b50){if(!_0x3c0b50){_0x4e59cf[_0xbe77('0x21')](0x194);}return _0x3c0b50;};}function handleError(_0x37331c,_0x50caca){_0x50caca=_0x50caca||0x1f4;return function(_0x4fd044){logger[_0xbe77('0x22')](_0x4fd044['stack']);if(_0x4fd044[_0xbe77('0x23')]){delete _0x4fd044[_0xbe77('0x23')];}_0x37331c[_0xbe77('0x15')](_0x50caca)[_0xbe77('0x24')](_0x4fd044);};}exports[_0xbe77('0x25')]=function(_0x5b6678,_0x1997d8){var _0x83104d={},_0x4efbbd={},_0x5e7ba7={'count':0x0,'rows':[]};var _0x44d999=_[_0xbe77('0x26')](db[_0xbe77('0x27')][_0xbe77('0x28')],function(_0x3c2026){return{'name':_0x3c2026[_0xbe77('0x29')],'type':_0x3c2026['type']['key']};});_0x4efbbd['model']=_[_0xbe77('0x26')](_0x44d999,_0xbe77('0x23'));_0x4efbbd['query']=_[_0xbe77('0x2a')](_0x5b6678['query']);_0x4efbbd[_0xbe77('0x2b')]=_[_0xbe77('0x2c')](_0x4efbbd[_0xbe77('0x2d')],_0x4efbbd[_0xbe77('0x2e')]);_0x83104d['attributes']=_[_0xbe77('0x2c')](_0x4efbbd[_0xbe77('0x2d')],qs[_0xbe77('0x2f')](_0x5b6678[_0xbe77('0x2e')][_0xbe77('0x2f')]));_0x83104d[_0xbe77('0x30')]=_0x83104d[_0xbe77('0x30')][_0xbe77('0x31')]?_0x83104d['attributes']:_0x4efbbd[_0xbe77('0x2d')];if(!_0x5b6678[_0xbe77('0x2e')][_0xbe77('0x32')](_0xbe77('0x33'))){_0x83104d['limit']=qs[_0xbe77('0x19')](_0x5b6678[_0xbe77('0x2e')]['limit']);_0x83104d[_0xbe77('0x18')]=qs[_0xbe77('0x18')](_0x5b6678['query']['offset']);}_0x83104d[_0xbe77('0x34')]=qs[_0xbe77('0x35')](_0x5b6678[_0xbe77('0x2e')]['sort']);_0x83104d[_0xbe77('0x36')]=qs[_0xbe77('0x2b')](_[_0xbe77('0x37')](_0x5b6678['query'],_0x4efbbd[_0xbe77('0x2b')]),_0x44d999);if(_0x5b6678[_0xbe77('0x2e')][_0xbe77('0x38')]){_0x83104d[_0xbe77('0x36')]=_[_0xbe77('0x39')](_0x83104d[_0xbe77('0x36')],{'$or':_[_0xbe77('0x26')](_0x44d999,function(_0xf8aba7){if(_0xf8aba7[_0xbe77('0x3a')]!==_0xbe77('0x3b')){var _0x28b47c={};_0x28b47c[_0xf8aba7[_0xbe77('0x23')]]={'$like':'%'+_0x5b6678['query'][_0xbe77('0x38')]+'%'};return _0x28b47c;}})});}_0x83104d=_[_0xbe77('0x39')]({},_0x83104d,_0x5b6678[_0xbe77('0x3c')]);var _0x3715f0={'where':_0x83104d[_0xbe77('0x36')]};return db['AnalyticTreeReport'][_0xbe77('0x3d')](_0x3715f0)[_0xbe77('0x1f')](function(_0x1b8866){_0x5e7ba7[_0xbe77('0x3d')]=_0x1b8866;if(_0x5b6678[_0xbe77('0x2e')][_0xbe77('0x3e')]){_0x83104d[_0xbe77('0x3f')]=[{'all':!![]}];}return db[_0xbe77('0x27')][_0xbe77('0x40')](_0x83104d);})[_0xbe77('0x1f')](function(_0x435619){_0x5e7ba7['rows']=_0x435619;return _0x5e7ba7;})[_0xbe77('0x1f')](respondWithFilteredResult(_0x1997d8,_0x83104d))[_0xbe77('0x41')](handleError(_0x1997d8,null));};exports[_0xbe77('0x42')]=function(_0x23d71b,_0x614cb8){var _0x8e684={'raw':!![],'where':{'id':_0x23d71b[_0xbe77('0x43')]['id']}},_0x63d1b3={};_0x63d1b3[_0xbe77('0x2d')]=_[_0xbe77('0x2a')](db[_0xbe77('0x27')][_0xbe77('0x28')]);_0x63d1b3[_0xbe77('0x2e')]=_[_0xbe77('0x2a')](_0x23d71b[_0xbe77('0x2e')]);_0x63d1b3['filters']=_[_0xbe77('0x2c')](_0x63d1b3[_0xbe77('0x2d')],_0x63d1b3['query']);_0x8e684['attributes']=_[_0xbe77('0x2c')](_0x63d1b3['model'],qs[_0xbe77('0x2f')](_0x23d71b[_0xbe77('0x2e')][_0xbe77('0x2f')]));_0x8e684[_0xbe77('0x30')]=_0x8e684[_0xbe77('0x30')][_0xbe77('0x31')]?_0x8e684[_0xbe77('0x30')]:_0x63d1b3[_0xbe77('0x2d')];if(_0x23d71b[_0xbe77('0x2e')]['includeAll']){_0x8e684[_0xbe77('0x3f')]=[{'all':!![]}];}_0x8e684=_[_0xbe77('0x39')]({},_0x8e684,_0x23d71b['options']);return db[_0xbe77('0x27')][_0xbe77('0x44')](_0x8e684)[_0xbe77('0x1f')](handleEntityNotFound(_0x614cb8,null))['then'](respondWithResult(_0x614cb8,null))[_0xbe77('0x41')](handleError(_0x614cb8,null));};exports[_0xbe77('0x45')]=function(_0x35f805,_0x41a397){return db['AnalyticTreeReport'][_0xbe77('0x45')](_0x35f805[_0xbe77('0x46')],{})[_0xbe77('0x1f')](respondWithResult(_0x41a397,0xc9))[_0xbe77('0x41')](handleError(_0x41a397,null));};exports[_0xbe77('0x1e')]=function(_0x51170e,_0x5a6720){if(_0x51170e[_0xbe77('0x46')]['id']){delete _0x51170e[_0xbe77('0x46')]['id'];}return db[_0xbe77('0x27')][_0xbe77('0x44')]({'where':{'id':_0x51170e['params']['id']}})[_0xbe77('0x1f')](handleEntityNotFound(_0x5a6720,null))['then'](saveUpdates(_0x51170e[_0xbe77('0x46')],null))['then'](respondWithResult(_0x5a6720,null))[_0xbe77('0x41')](handleError(_0x5a6720,null));};exports[_0xbe77('0x20')]=function(_0x23c2c9,_0x2dfa21){return db[_0xbe77('0x27')][_0xbe77('0x44')]({'where':{'id':_0x23c2c9[_0xbe77('0x43')]['id']}})[_0xbe77('0x1f')](handleEntityNotFound(_0x2dfa21,null))[_0xbe77('0x1f')](removeEntity(_0x2dfa21,null))[_0xbe77('0x41')](handleError(_0x2dfa21,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 0fe3fcf..ba0320a 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 _0x7669=['analytics_report_trees','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x2c16bc,_0x280258){var _0x50f93c=function(_0x361c5b){while(--_0x361c5b){_0x2c16bc['push'](_0x2c16bc['shift']());}};_0x50f93c(++_0x280258);}(_0x7669,0xe5));var _0x9766=function(_0x3bdf14,_0x5f2a29){_0x3bdf14=_0x3bdf14-0x0;var _0x2c2535=_0x7669[_0x3bdf14];return _0x2c2535;};'use strict';var _=require(_0x9766('0x0'));var util=require(_0x9766('0x1'));var logger=require(_0x9766('0x2'))('api');var moment=require(_0x9766('0x3'));var BPromise=require(_0x9766('0x4'));var rp=require(_0x9766('0x5'));var fs=require('fs');var path=require(_0x9766('0x6'));var rimraf=require(_0x9766('0x7'));var config=require(_0x9766('0x8'));var attributes=require('./analyticTreeReport.attributes');module[_0x9766('0x9')]=function(_0x1f49b5,_0x245178){return _0x1f49b5[_0x9766('0xa')]('AnalyticTreeReport',attributes,{'tableName':_0x9766('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x00cd=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util'];(function(_0x5a71f0,_0x305824){var _0xae0744=function(_0x4bad4a){while(--_0x4bad4a){_0x5a71f0['push'](_0x5a71f0['shift']());}};_0xae0744(++_0x305824);}(_0x00cd,0xee));var _0xd00c=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0x00cd[_0x5a3cf0];return _0x5a64ee;};'use strict';var _=require(_0xd00c('0x0'));var util=require(_0xd00c('0x1'));var logger=require(_0xd00c('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd00c('0x3'));var rp=require(_0xd00c('0x4'));var fs=require('fs');var path=require(_0xd00c('0x5'));var rimraf=require(_0xd00c('0x6'));var config=require(_0xd00c('0x7'));var attributes=require('./analyticTreeReport.attributes');module[_0xd00c('0x8')]=function(_0xbeac62,_0x2eb6ca){return _0xbeac62[_0xd00c('0x9')](_0xd00c('0xa'),attributes,{'tableName':_0xd00c('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 06df49f..a7be9b4 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 _0x0ccb=['http','request','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x3f13ca,_0x5eab02){var _0x33ab93=function(_0x29f868){while(--_0x29f868){_0x3f13ca['push'](_0x3f13ca['shift']());}};_0x33ab93(++_0x5eab02);}(_0x0ccb,0x1d2));var _0xb0cc=function(_0x1d50a1,_0x4b707e){_0x1d50a1=_0x1d50a1-0x0;var _0x1b95f7=_0x0ccb[_0x1d50a1];return _0x1b95f7;};'use strict';var _=require(_0xb0cc('0x0'));var util=require(_0xb0cc('0x1'));var moment=require(_0xb0cc('0x2'));var BPromise=require(_0xb0cc('0x3'));var rs=require(_0xb0cc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb0cc('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xb0cc('0x6'));var jayson=require(_0xb0cc('0x7'));var client=jayson[_0xb0cc('0x8')][_0xb0cc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ddd9d,_0xf3fe3c,_0x4677f0){return new BPromise(function(_0x201eac,_0x458cfc){return client[_0xb0cc('0xa')](_0x2ddd9d,_0x4677f0)['then'](function(_0x33cdda){logger['info'](_0xb0cc('0xb'),_0xf3fe3c,_0xb0cc('0xc'));logger['debug'](_0xb0cc('0xd'),_0xf3fe3c,_0xb0cc('0xc'),JSON[_0xb0cc('0xe')](_0x33cdda));if(_0x33cdda[_0xb0cc('0xf')]){if(_0x33cdda[_0xb0cc('0xf')]['code']===0x1f4){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0xf3fe3c,_0x33cdda[_0xb0cc('0xf')][_0xb0cc('0x10')]);return _0x458cfc(_0x33cdda['error'][_0xb0cc('0x10')]);}logger['error'](_0xb0cc('0xb'),_0xf3fe3c,_0x33cdda[_0xb0cc('0xf')]['message']);return _0x201eac(_0x33cdda[_0xb0cc('0xf')][_0xb0cc('0x10')]);}else{logger[_0xb0cc('0x11')](_0xb0cc('0xb'),_0xf3fe3c,_0xb0cc('0xc'));_0x201eac(_0x33cdda['result'][_0xb0cc('0x10')]);}})[_0xb0cc('0x12')](function(_0x261daa){logger[_0xb0cc('0xf')](_0xb0cc('0xb'),_0xf3fe3c,_0x261daa);_0x458cfc(_0x261daa);});});} \ No newline at end of file +var _0x6bb5=['result','catch','lodash','util','moment','randomstring','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','code','error','message'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x6bb5,0x84));var _0x56bb=function(_0x3eb713,_0x437874){_0x3eb713=_0x3eb713-0x0;var _0x1d7128=_0x6bb5[_0x3eb713];return _0x1d7128;};'use strict';var _=require(_0x56bb('0x0'));var util=require(_0x56bb('0x1'));var moment=require(_0x56bb('0x2'));var BPromise=require('bluebird');var rs=require(_0x56bb('0x3'));var fs=require('fs');var Redis=require(_0x56bb('0x4'));var db=require(_0x56bb('0x5'))['db'];var utils=require(_0x56bb('0x6'));var logger=require(_0x56bb('0x7'))(_0x56bb('0x8'));var config=require(_0x56bb('0x9'));var jayson=require(_0x56bb('0xa'));var client=jayson[_0x56bb('0xb')][_0x56bb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4226d6,_0x3a0aaa,_0x26ad37){return new BPromise(function(_0x57fe1c,_0xdcac7b){return client[_0x56bb('0xd')](_0x4226d6,_0x26ad37)[_0x56bb('0xe')](function(_0x58c089){logger[_0x56bb('0xf')](_0x56bb('0x10'),_0x3a0aaa,_0x56bb('0x11'));logger[_0x56bb('0x12')](_0x56bb('0x13'),_0x3a0aaa,'request\x20sent',JSON[_0x56bb('0x14')](_0x58c089));if(_0x58c089['error']){if(_0x58c089['error'][_0x56bb('0x15')]===0x1f4){logger[_0x56bb('0x16')]('AnalyticTreeReport,\x20%s,\x20%s',_0x3a0aaa,_0x58c089[_0x56bb('0x16')][_0x56bb('0x17')]);return _0xdcac7b(_0x58c089[_0x56bb('0x16')][_0x56bb('0x17')]);}logger[_0x56bb('0x16')](_0x56bb('0x10'),_0x3a0aaa,_0x58c089[_0x56bb('0x16')][_0x56bb('0x17')]);return _0x57fe1c(_0x58c089[_0x56bb('0x16')][_0x56bb('0x17')]);}else{logger[_0x56bb('0xf')](_0x56bb('0x10'),_0x3a0aaa,'request\x20sent');_0x57fe1c(_0x58c089[_0x56bb('0x18')][_0x56bb('0x17')]);}})[_0x56bb('0x19')](function(_0x59fd22){logger[_0x56bb('0x16')]('AnalyticTreeReport,\x20%s,\x20%s',_0x3a0aaa,_0x59fd22);_0xdcac7b(_0x59fd22);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 9e61405..f52050f 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 _0x0a52=['../../config/environment','get','isAuthenticated','index','/:id','show','post','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x1e5da0,_0x236246){var _0x16ffeb=function(_0x68f835){while(--_0x68f835){_0x1e5da0['push'](_0x1e5da0['shift']());}};_0x16ffeb(++_0x236246);}(_0x0a52,0x1ca));var _0x20a5=function(_0x2078d4,_0x5415ab){_0x2078d4=_0x2078d4-0x0;var _0x2b7d38=_0x0a52[_0x2078d4];return _0x2b7d38;};'use strict';var multer=require(_0x20a5('0x0'));var util=require(_0x20a5('0x1'));var path=require(_0x20a5('0x2'));var timeout=require(_0x20a5('0x3'));var express=require(_0x20a5('0x4'));var router=express['Router']();var auth=require(_0x20a5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x20a5('0x6'));var controller=require('./analyticTreeReport.controller');router[_0x20a5('0x7')]('/',auth[_0x20a5('0x8')](),controller[_0x20a5('0x9')]);router[_0x20a5('0x7')](_0x20a5('0xa'),auth[_0x20a5('0x8')](),controller[_0x20a5('0xb')]);router[_0x20a5('0xc')]('/',auth[_0x20a5('0x8')](),controller['create']);router['put'](_0x20a5('0xa'),auth[_0x20a5('0x8')](),controller[_0x20a5('0xd')]);router['delete'](_0x20a5('0xa'),auth['isAuthenticated'](),controller[_0x20a5('0xe')]);module[_0x20a5('0xf')]=router; \ No newline at end of file +var _0xf0f2=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','index','get','/:id','show','create'];(function(_0x1fd022,_0x4f26f2){var _0x5b68e2=function(_0x18d13a){while(--_0x18d13a){_0x1fd022['push'](_0x1fd022['shift']());}};_0x5b68e2(++_0x4f26f2);}(_0xf0f2,0x9b));var _0x2f0f=function(_0x36368c,_0x464b85){_0x36368c=_0x36368c-0x0;var _0x1b2107=_0xf0f2[_0x36368c];return _0x1b2107;};'use strict';var multer=require(_0x2f0f('0x0'));var util=require(_0x2f0f('0x1'));var path=require(_0x2f0f('0x2'));var timeout=require(_0x2f0f('0x3'));var express=require(_0x2f0f('0x4'));var router=express[_0x2f0f('0x5')]();var auth=require(_0x2f0f('0x6'));var interaction=require(_0x2f0f('0x7'));var config=require(_0x2f0f('0x8'));var controller=require(_0x2f0f('0x9'));router['get']('/',auth[_0x2f0f('0xa')](),controller[_0x2f0f('0xb')]);router[_0x2f0f('0xc')](_0x2f0f('0xd'),auth[_0x2f0f('0xa')](),controller[_0x2f0f('0xe')]);router['post']('/',auth[_0x2f0f('0xa')](),controller[_0x2f0f('0xf')]);router['put'](_0x2f0f('0xd'),auth['isAuthenticated'](),controller[_0x2f0f('0x10')]);router['delete'](_0x2f0f('0xd'),auth[_0x2f0f('0xa')](),controller[_0x2f0f('0x11')]);module[_0x2f0f('0x12')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 9296a8b..4ed48fb 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 _0xf57a=['STRING','sequelize','exports'];(function(_0x1428d9,_0xded63c){var _0x438019=function(_0x31c37d){while(--_0x31c37d){_0x1428d9['push'](_0x1428d9['shift']());}};_0x438019(++_0xded63c);}(_0xf57a,0x1b4));var _0xaf57=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xf57a[_0x35885a];return _0xe86249;};'use strict';var Sequelize=require(_0xaf57('0x0'));module[_0xaf57('0x1')]={'name':{'type':Sequelize[_0xaf57('0x2')]},'basename':{'type':Sequelize[_0xaf57('0x2')]},'type':{'type':Sequelize[_0xaf57('0x2')]}}; \ No newline at end of file +var _0x2faf=['STRING','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2faf,0xe5));var _0xf2fa=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2faf[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xf2fa('0x0'));module[_0xf2fa('0x1')]={'name':{'type':Sequelize[_0xf2fa('0x2')]},'basename':{'type':Sequelize[_0xf2fa('0x2')]},'type':{'type':Sequelize[_0xf2fa('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index a664aa9..2aa683d 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 _0x4264=['path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','catch','show','params','find','clone','omit','createdAt','updatedAt','body','includeAll','create','file','originalname','basename','filename','mimetype','findOne','download','root','server/files/attachments/','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util'];(function(_0x12a95e,_0x3d40e3){var _0xd3ae8f=function(_0x59c849){while(--_0x59c849){_0x12a95e['push'](_0x12a95e['shift']());}};_0xd3ae8f(++_0x3d40e3);}(_0x4264,0x151));var _0x4426=function(_0x2cd235,_0x52df43){_0x2cd235=_0x2cd235-0x0;var _0x2c1532=_0x4264[_0x2cd235];return _0x2c1532;};'use strict';var pdf=require(_0x4426('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4426('0x1'));var zipdir=require(_0x4426('0x2'));var jsonpatch=require(_0x4426('0x3'));var rp=require(_0x4426('0x4'));var moment=require(_0x4426('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4426('0x6'));var path=require(_0x4426('0x7'));var sox=require(_0x4426('0x8'));var csv=require(_0x4426('0x9'));var ejs=require(_0x4426('0xa'));var fs=require('fs');var _=require(_0x4426('0xb'));var squel=require(_0x4426('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4426('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4426('0xe'));var Papa=require(_0x4426('0xf'));var Redis=require(_0x4426('0x10'));var authService=require(_0x4426('0x11'));var qs=require(_0x4426('0x12'));var as=require(_0x4426('0x13'));var hardwareService=require(_0x4426('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x4426('0x15'));var db=require(_0x4426('0x16'))['db'];function respondWithStatusCode(_0x209dec,_0x3346fc){_0x3346fc=_0x3346fc||0xcc;return function(_0x16640b){if(_0x16640b){return _0x209dec['sendStatus'](_0x3346fc);}return _0x209dec[_0x4426('0x17')](_0x3346fc)[_0x4426('0x18')]();};}function respondWithResult(_0x1c8670,_0x5746b8){_0x5746b8=_0x5746b8||0xc8;return function(_0x55172f){if(_0x55172f){return _0x1c8670[_0x4426('0x17')](_0x5746b8)[_0x4426('0x19')](_0x55172f);}};}function respondWithFilteredResult(_0x4261e8,_0x596905){return function(_0x45e52e){if(_0x45e52e){var _0xca74a6=_0x45e52e[_0x4426('0x1a')],_0x413ac5=_0x596905[_0x4426('0x1b')],_0x4380b2=_0x596905[_0x4426('0x1b')]+_0x596905[_0x4426('0x1c')],_0x27d6ee;if(_0x4380b2>=_0xca74a6){_0x4380b2=_0xca74a6;_0x27d6ee=0xc8;}else{_0x27d6ee=0xce;}_0x4261e8[_0x4426('0x17')](_0x27d6ee);return _0x4261e8['set'](_0x4426('0x1d'),_0x413ac5+'-'+_0x4380b2+'/'+_0xca74a6)[_0x4426('0x19')](_0x45e52e);}return null;};}function patchUpdates(_0x7462c7){return function(_0x14bb8a){try{jsonpatch['apply'](_0x14bb8a,_0x7462c7,!![]);}catch(_0x47e0f3){return BPromise[_0x4426('0x1e')](_0x47e0f3);}return _0x14bb8a[_0x4426('0x1f')]();};}function saveUpdates(_0x47daed,_0x595b64){return function(_0x1d1a24){if(_0x1d1a24){return _0x1d1a24[_0x4426('0x20')](_0x47daed)[_0x4426('0x21')](function(_0x9678f0){return _0x9678f0;});}return null;};}function removeEntity(_0x49a949,_0x13d035){return function(_0x23b58b){if(_0x23b58b){return _0x23b58b[_0x4426('0x22')]()[_0x4426('0x21')](function(){_0x49a949[_0x4426('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x299453,_0x5e291b){return function(_0x5b0ee3){if(!_0x5b0ee3){_0x299453[_0x4426('0x23')](0x194);}return _0x5b0ee3;};}function handleError(_0x1643b5,_0x1cfa91){_0x1cfa91=_0x1cfa91||0x1f4;return function(_0x4660f5){logger[_0x4426('0x24')](_0x4660f5[_0x4426('0x25')]);if(_0x4660f5[_0x4426('0x26')]){delete _0x4660f5[_0x4426('0x26')];}_0x1643b5[_0x4426('0x17')](_0x1cfa91)[_0x4426('0x27')](_0x4660f5);};}exports[_0x4426('0x28')]=function(_0xde598f,_0x13f695){var _0x52627b={},_0xba759f={},_0xc6e728={'count':0x0,'rows':[]};var _0x1a340d=_[_0x4426('0x29')](db[_0x4426('0x2a')][_0x4426('0x2b')],function(_0x489ff9){return{'name':_0x489ff9[_0x4426('0x2c')],'type':_0x489ff9[_0x4426('0x2d')]['key']};});_0xba759f[_0x4426('0x2e')]=_[_0x4426('0x29')](_0x1a340d,_0x4426('0x26'));_0xba759f['query']=_[_0x4426('0x2f')](_0xde598f['query']);_0xba759f[_0x4426('0x30')]=_[_0x4426('0x31')](_0xba759f[_0x4426('0x2e')],_0xba759f[_0x4426('0x32')]);_0x52627b[_0x4426('0x33')]=_[_0x4426('0x31')](_0xba759f[_0x4426('0x2e')],qs[_0x4426('0x34')](_0xde598f[_0x4426('0x32')][_0x4426('0x34')]));_0x52627b['attributes']=_0x52627b[_0x4426('0x33')][_0x4426('0x35')]?_0x52627b['attributes']:_0xba759f[_0x4426('0x2e')];if(!_0xde598f['query'][_0x4426('0x36')](_0x4426('0x37'))){_0x52627b['limit']=qs['limit'](_0xde598f[_0x4426('0x32')]['limit']);_0x52627b[_0x4426('0x1b')]=qs['offset'](_0xde598f[_0x4426('0x32')][_0x4426('0x1b')]);}_0x52627b[_0x4426('0x38')]=qs[_0x4426('0x39')](_0xde598f[_0x4426('0x32')][_0x4426('0x39')]);_0x52627b[_0x4426('0x3a')]=qs[_0x4426('0x30')](_[_0x4426('0x3b')](_0xde598f[_0x4426('0x32')],_0xba759f['filters']),_0x1a340d);if(_0xde598f[_0x4426('0x32')]['filter']){_0x52627b[_0x4426('0x3a')]=_[_0x4426('0x3c')](_0x52627b[_0x4426('0x3a')],{'$or':_[_0x4426('0x29')](_0x1a340d,function(_0xb6a5a){if(_0xb6a5a[_0x4426('0x2d')]!==_0x4426('0x3d')){var _0x179737={};_0x179737[_0xb6a5a['name']]={'$like':'%'+_0xde598f['query'][_0x4426('0x3e')]+'%'};return _0x179737;}})});}_0x52627b=_[_0x4426('0x3c')]({},_0x52627b,_0xde598f[_0x4426('0x3f')]);var _0xa5b96={'where':_0x52627b[_0x4426('0x3a')]};return db['Attachment'][_0x4426('0x1a')](_0xa5b96)[_0x4426('0x21')](function(_0x4079e2){_0xc6e728[_0x4426('0x1a')]=_0x4079e2;if(_0xde598f[_0x4426('0x32')]['includeAll']){_0x52627b[_0x4426('0x40')]=[{'all':!![]}];}return db[_0x4426('0x2a')][_0x4426('0x41')](_0x52627b);})[_0x4426('0x21')](function(_0x374b91){_0xc6e728['rows']=_0x374b91;return _0xc6e728;})['then'](respondWithFilteredResult(_0x13f695,_0x52627b))[_0x4426('0x42')](handleError(_0x13f695,null));};exports[_0x4426('0x43')]=function(_0x34c22e,_0x5464d8){var _0xa382ea={'raw':!![],'where':{'id':_0x34c22e[_0x4426('0x44')]['id']}},_0x7a779c={};_0x7a779c[_0x4426('0x2e')]=_['keys'](db['Attachment']['rawAttributes']);_0x7a779c[_0x4426('0x32')]=_[_0x4426('0x2f')](_0x34c22e[_0x4426('0x32')]);_0x7a779c[_0x4426('0x30')]=_[_0x4426('0x31')](_0x7a779c['model'],_0x7a779c[_0x4426('0x32')]);_0xa382ea['attributes']=_['intersection'](_0x7a779c[_0x4426('0x2e')],qs['fields'](_0x34c22e[_0x4426('0x32')][_0x4426('0x34')]));_0xa382ea[_0x4426('0x33')]=_0xa382ea[_0x4426('0x33')]['length']?_0xa382ea['attributes']:_0x7a779c[_0x4426('0x2e')];if(_0x34c22e[_0x4426('0x32')]['includeAll']){_0xa382ea['include']=[{'all':!![]}];}_0xa382ea=_[_0x4426('0x3c')]({},_0xa382ea,_0x34c22e['options']);return db[_0x4426('0x2a')][_0x4426('0x45')](_0xa382ea)[_0x4426('0x21')](handleEntityNotFound(_0x5464d8,null))[_0x4426('0x21')](respondWithResult(_0x5464d8,null))[_0x4426('0x42')](handleError(_0x5464d8,null));};exports[_0x4426('0x46')]=function(_0x3c1936,_0x35a6bb){var _0x5c8bb3={'where':{'id':_0x3c1936['params']['id']}},_0x4f2db0={};_0x4f2db0[_0x4426('0x2e')]=_['keys'](db[_0x4426('0x2a')]['rawAttributes']);_0x5c8bb3[_0x4426('0x33')]=_['intersection'](_0x4f2db0['model'],qs[_0x4426('0x34')](_0x3c1936['query'][_0x4426('0x34')]));_0x5c8bb3[_0x4426('0x33')]=_0x5c8bb3[_0x4426('0x33')][_0x4426('0x35')]?_0x5c8bb3[_0x4426('0x33')]:_0x4f2db0[_0x4426('0x2e')];if(_0x3c1936[_0x4426('0x32')]['includeAll']){_0x5c8bb3[_0x4426('0x40')]=[{'all':!![]}];}_0x5c8bb3=_[_0x4426('0x3c')]({},_0x5c8bb3,_0x3c1936[_0x4426('0x3f')]);return db[_0x4426('0x2a')]['find'](_0x5c8bb3)[_0x4426('0x21')](handleEntityNotFound(_0x35a6bb,null))[_0x4426('0x21')](function(_0x8bfb0c){if(_0x8bfb0c){var _0x31b548=_0x8bfb0c['get']({'plain':!![]});_0x31b548=qs[_0x4426('0x47')](_0x31b548,['id',_0x4426('0x48'),_0x4426('0x49')]);_0x3c1936[_0x4426('0x4a')]=_['omit'](_0x3c1936[_0x4426('0x4a')],['id',_0x4426('0x48'),'updatedAt']);return db[_0x4426('0x2a')]['create'](_[_0x4426('0x3c')](_0x31b548,_0x3c1936[_0x4426('0x4a')]),{'include':_0x3c1936[_0x4426('0x32')][_0x4426('0x4b')]?[{'all':!![]}]:undefined});}})[_0x4426('0x21')](respondWithResult(_0x35a6bb,0xc9))[_0x4426('0x42')](handleError(_0x35a6bb,null));};exports[_0x4426('0x20')]=function(_0x1864c8,_0x548609){if(_0x1864c8[_0x4426('0x4a')]['id']){delete _0x1864c8[_0x4426('0x4a')]['id'];}return db['Attachment'][_0x4426('0x45')]({'where':{'id':_0x1864c8[_0x4426('0x44')]['id']}})['then'](handleEntityNotFound(_0x548609,null))['then'](saveUpdates(_0x1864c8[_0x4426('0x4a')],null))[_0x4426('0x21')](respondWithResult(_0x548609,null))[_0x4426('0x42')](handleError(_0x548609,null));};exports[_0x4426('0x22')]=function(_0x552deb,_0x3f5363){return db[_0x4426('0x2a')][_0x4426('0x45')]({'where':{'id':_0x552deb[_0x4426('0x44')]['id']}})[_0x4426('0x21')](handleEntityNotFound(_0x3f5363,null))['then'](removeEntity(_0x3f5363,null))[_0x4426('0x42')](handleError(_0x3f5363,null));};exports[_0x4426('0x4c')]=function(_0xc1a00d,_0x625b2b,_0xa11b4c){_0xc1a00d[_0x4426('0x4a')]['name']=_0xc1a00d[_0x4426('0x4d')][_0x4426('0x4e')];_0xc1a00d[_0x4426('0x4a')][_0x4426('0x4f')]=_0xc1a00d['file'][_0x4426('0x50')];_0xc1a00d['body'][_0x4426('0x2d')]=_0xc1a00d[_0x4426('0x4d')][_0x4426('0x51')];return db['Attachment'][_0x4426('0x4c')](_0xc1a00d['body'])[_0x4426('0x21')](respondWithResult(_0x625b2b,0xc9))[_0x4426('0x42')](handleError(_0x625b2b,null));};exports['download']=function(_0x51d765,_0x4cbfc2,_0x116e22){return db[_0x4426('0x2a')][_0x4426('0x52')]({'where':{'id':_0x51d765[_0x4426('0x44')]['id']},'raw':!![]})[_0x4426('0x21')](handleEntityNotFound(_0x4cbfc2,null))[_0x4426('0x21')](function(_0x4c1494){if(_0x4c1494){return _0x4cbfc2[_0x4426('0x53')](path['join'](config[_0x4426('0x54')],_0x4426('0x55'),_0x4c1494[_0x4426('0x4f')]));}})[_0x4426('0x42')](handleError(_0x4cbfc2,null));}; \ No newline at end of file +var _0xfed7=['rawAttributes','fieldName','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','count','includeAll','findAll','rows','show','params','find','catch','clone','get','omit','createdAt','updatedAt','body','create','file','originalname','basename','filename','mimetype','download','findOne','join','server/files/attachments/','eml-format','rimraf','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','Attachment'];(function(_0x39ad4c,_0x2fa27e){var _0xf3314d=function(_0x4de109){while(--_0x4de109){_0x39ad4c['push'](_0x39ad4c['shift']());}};_0xf3314d(++_0x2fa27e);}(_0xfed7,0x1d1));var _0x7fed=function(_0x19159d,_0x3d05c8){_0x19159d=_0x19159d-0x0;var _0x35884a=_0xfed7[_0x19159d];return _0x35884a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7fed('0x0'));var rimraf=require(_0x7fed('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7fed('0x2'));var moment=require(_0x7fed('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7fed('0x4'));var util=require('util');var path=require(_0x7fed('0x5'));var sox=require(_0x7fed('0x6'));var csv=require(_0x7fed('0x7'));var ejs=require(_0x7fed('0x8'));var fs=require('fs');var _=require(_0x7fed('0x9'));var squel=require(_0x7fed('0xa'));var crypto=require('crypto');var jsforce=require(_0x7fed('0xb'));var deskjs=require(_0x7fed('0xc'));var toCsv=require(_0x7fed('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7fed('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x7fed('0xe'));var as=require(_0x7fed('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7fed('0x10'));var utils=require('../../config/utils');var config=require(_0x7fed('0x11'));var db=require(_0x7fed('0x12'))['db'];function respondWithStatusCode(_0x16efd8,_0x118c6c){_0x118c6c=_0x118c6c||0xcc;return function(_0x2696cd){if(_0x2696cd){return _0x16efd8[_0x7fed('0x13')](_0x118c6c);}return _0x16efd8['status'](_0x118c6c)[_0x7fed('0x14')]();};}function respondWithResult(_0x47eaf3,_0x566697){_0x566697=_0x566697||0xc8;return function(_0x45df40){if(_0x45df40){return _0x47eaf3[_0x7fed('0x15')](_0x566697)[_0x7fed('0x16')](_0x45df40);}};}function respondWithFilteredResult(_0xcefb83,_0x1008a2){return function(_0x10095e){if(_0x10095e){var _0x3162e9=_0x10095e['count'],_0x1a5197=_0x1008a2[_0x7fed('0x17')],_0x51f4e9=_0x1008a2['offset']+_0x1008a2[_0x7fed('0x18')],_0x4a531d;if(_0x51f4e9>=_0x3162e9){_0x51f4e9=_0x3162e9;_0x4a531d=0xc8;}else{_0x4a531d=0xce;}_0xcefb83[_0x7fed('0x15')](_0x4a531d);return _0xcefb83[_0x7fed('0x19')]('Content-Range',_0x1a5197+'-'+_0x51f4e9+'/'+_0x3162e9)[_0x7fed('0x16')](_0x10095e);}return null;};}function patchUpdates(_0x15c345){return function(_0xa3c975){try{jsonpatch[_0x7fed('0x1a')](_0xa3c975,_0x15c345,!![]);}catch(_0xc90cfc){return BPromise[_0x7fed('0x1b')](_0xc90cfc);}return _0xa3c975[_0x7fed('0x1c')]();};}function saveUpdates(_0x35b017,_0x5cb516){return function(_0x373ebe){if(_0x373ebe){return _0x373ebe[_0x7fed('0x1d')](_0x35b017)[_0x7fed('0x1e')](function(_0xe901c3){return _0xe901c3;});}return null;};}function removeEntity(_0x2f94b0,_0x15f010){return function(_0x4b2ba9){if(_0x4b2ba9){return _0x4b2ba9[_0x7fed('0x1f')]()[_0x7fed('0x1e')](function(){_0x2f94b0[_0x7fed('0x15')](0xcc)[_0x7fed('0x14')]();});}};}function handleEntityNotFound(_0x4d8da7,_0x185a32){return function(_0x59701d){if(!_0x59701d){_0x4d8da7['sendStatus'](0x194);}return _0x59701d;};}function handleError(_0x57a3be,_0x2a6bcd){_0x2a6bcd=_0x2a6bcd||0x1f4;return function(_0x573639){logger[_0x7fed('0x20')](_0x573639[_0x7fed('0x21')]);if(_0x573639[_0x7fed('0x22')]){delete _0x573639['name'];}_0x57a3be[_0x7fed('0x15')](_0x2a6bcd)[_0x7fed('0x23')](_0x573639);};}exports[_0x7fed('0x24')]=function(_0x555d11,_0x3a66c9){var _0x1557b1={},_0x8c97a2={},_0x46be95={'count':0x0,'rows':[]};var _0x18ad41=_[_0x7fed('0x25')](db[_0x7fed('0x26')][_0x7fed('0x27')],function(_0x347390){return{'name':_0x347390[_0x7fed('0x28')],'type':_0x347390['type']['key']};});_0x8c97a2[_0x7fed('0x29')]=_[_0x7fed('0x25')](_0x18ad41,_0x7fed('0x22'));_0x8c97a2['query']=_[_0x7fed('0x2a')](_0x555d11['query']);_0x8c97a2[_0x7fed('0x2b')]=_[_0x7fed('0x2c')](_0x8c97a2['model'],_0x8c97a2[_0x7fed('0x2d')]);_0x1557b1['attributes']=_[_0x7fed('0x2c')](_0x8c97a2[_0x7fed('0x29')],qs['fields'](_0x555d11['query'][_0x7fed('0x2e')]));_0x1557b1[_0x7fed('0x2f')]=_0x1557b1['attributes'][_0x7fed('0x30')]?_0x1557b1[_0x7fed('0x2f')]:_0x8c97a2[_0x7fed('0x29')];if(!_0x555d11[_0x7fed('0x2d')][_0x7fed('0x31')](_0x7fed('0x32'))){_0x1557b1[_0x7fed('0x18')]=qs[_0x7fed('0x18')](_0x555d11[_0x7fed('0x2d')][_0x7fed('0x18')]);_0x1557b1['offset']=qs[_0x7fed('0x17')](_0x555d11['query']['offset']);}_0x1557b1[_0x7fed('0x33')]=qs[_0x7fed('0x34')](_0x555d11[_0x7fed('0x2d')][_0x7fed('0x34')]);_0x1557b1[_0x7fed('0x35')]=qs[_0x7fed('0x2b')](_[_0x7fed('0x36')](_0x555d11[_0x7fed('0x2d')],_0x8c97a2['filters']),_0x18ad41);if(_0x555d11[_0x7fed('0x2d')]['filter']){_0x1557b1[_0x7fed('0x35')]=_[_0x7fed('0x37')](_0x1557b1[_0x7fed('0x35')],{'$or':_[_0x7fed('0x25')](_0x18ad41,function(_0xe3dda){if(_0xe3dda[_0x7fed('0x38')]!==_0x7fed('0x39')){var _0x44f263={};_0x44f263[_0xe3dda[_0x7fed('0x22')]]={'$like':'%'+_0x555d11[_0x7fed('0x2d')][_0x7fed('0x3a')]+'%'};return _0x44f263;}})});}_0x1557b1=_[_0x7fed('0x37')]({},_0x1557b1,_0x555d11[_0x7fed('0x3b')]);var _0x3ea207={'where':_0x1557b1[_0x7fed('0x35')]};return db[_0x7fed('0x26')][_0x7fed('0x3c')](_0x3ea207)['then'](function(_0x402cb9){_0x46be95[_0x7fed('0x3c')]=_0x402cb9;if(_0x555d11['query'][_0x7fed('0x3d')]){_0x1557b1['include']=[{'all':!![]}];}return db[_0x7fed('0x26')][_0x7fed('0x3e')](_0x1557b1);})['then'](function(_0x183498){_0x46be95[_0x7fed('0x3f')]=_0x183498;return _0x46be95;})[_0x7fed('0x1e')](respondWithFilteredResult(_0x3a66c9,_0x1557b1))['catch'](handleError(_0x3a66c9,null));};exports[_0x7fed('0x40')]=function(_0x5ba3fd,_0x5b252b){var _0x2e78b9={'raw':!![],'where':{'id':_0x5ba3fd[_0x7fed('0x41')]['id']}},_0xc5a39e={};_0xc5a39e[_0x7fed('0x29')]=_[_0x7fed('0x2a')](db['Attachment'][_0x7fed('0x27')]);_0xc5a39e['query']=_[_0x7fed('0x2a')](_0x5ba3fd['query']);_0xc5a39e[_0x7fed('0x2b')]=_[_0x7fed('0x2c')](_0xc5a39e['model'],_0xc5a39e[_0x7fed('0x2d')]);_0x2e78b9['attributes']=_[_0x7fed('0x2c')](_0xc5a39e[_0x7fed('0x29')],qs['fields'](_0x5ba3fd['query'][_0x7fed('0x2e')]));_0x2e78b9['attributes']=_0x2e78b9[_0x7fed('0x2f')][_0x7fed('0x30')]?_0x2e78b9[_0x7fed('0x2f')]:_0xc5a39e['model'];if(_0x5ba3fd[_0x7fed('0x2d')][_0x7fed('0x3d')]){_0x2e78b9['include']=[{'all':!![]}];}_0x2e78b9=_['merge']({},_0x2e78b9,_0x5ba3fd[_0x7fed('0x3b')]);return db[_0x7fed('0x26')][_0x7fed('0x42')](_0x2e78b9)[_0x7fed('0x1e')](handleEntityNotFound(_0x5b252b,null))[_0x7fed('0x1e')](respondWithResult(_0x5b252b,null))[_0x7fed('0x43')](handleError(_0x5b252b,null));};exports[_0x7fed('0x44')]=function(_0x48c003,_0x1e9a79){var _0x4bae1f={'where':{'id':_0x48c003[_0x7fed('0x41')]['id']}},_0x9e22b0={};_0x9e22b0[_0x7fed('0x29')]=_['keys'](db[_0x7fed('0x26')][_0x7fed('0x27')]);_0x4bae1f[_0x7fed('0x2f')]=_[_0x7fed('0x2c')](_0x9e22b0['model'],qs[_0x7fed('0x2e')](_0x48c003[_0x7fed('0x2d')][_0x7fed('0x2e')]));_0x4bae1f['attributes']=_0x4bae1f[_0x7fed('0x2f')][_0x7fed('0x30')]?_0x4bae1f[_0x7fed('0x2f')]:_0x9e22b0[_0x7fed('0x29')];if(_0x48c003[_0x7fed('0x2d')][_0x7fed('0x3d')]){_0x4bae1f['include']=[{'all':!![]}];}_0x4bae1f=_[_0x7fed('0x37')]({},_0x4bae1f,_0x48c003['options']);return db[_0x7fed('0x26')][_0x7fed('0x42')](_0x4bae1f)[_0x7fed('0x1e')](handleEntityNotFound(_0x1e9a79,null))[_0x7fed('0x1e')](function(_0x193f43){if(_0x193f43){var _0x3aa506=_0x193f43[_0x7fed('0x45')]({'plain':!![]});_0x3aa506=qs[_0x7fed('0x46')](_0x3aa506,['id',_0x7fed('0x47'),_0x7fed('0x48')]);_0x48c003[_0x7fed('0x49')]=_['omit'](_0x48c003[_0x7fed('0x49')],['id','createdAt',_0x7fed('0x48')]);return db[_0x7fed('0x26')][_0x7fed('0x4a')](_[_0x7fed('0x37')](_0x3aa506,_0x48c003[_0x7fed('0x49')]),{'include':_0x48c003[_0x7fed('0x2d')][_0x7fed('0x3d')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x1e9a79,0xc9))[_0x7fed('0x43')](handleError(_0x1e9a79,null));};exports[_0x7fed('0x1d')]=function(_0x5e1b31,_0x29af8d){if(_0x5e1b31[_0x7fed('0x49')]['id']){delete _0x5e1b31['body']['id'];}return db['Attachment'][_0x7fed('0x42')]({'where':{'id':_0x5e1b31[_0x7fed('0x41')]['id']}})[_0x7fed('0x1e')](handleEntityNotFound(_0x29af8d,null))[_0x7fed('0x1e')](saveUpdates(_0x5e1b31[_0x7fed('0x49')],null))[_0x7fed('0x1e')](respondWithResult(_0x29af8d,null))[_0x7fed('0x43')](handleError(_0x29af8d,null));};exports[_0x7fed('0x1f')]=function(_0x152878,_0x525c29){return db[_0x7fed('0x26')][_0x7fed('0x42')]({'where':{'id':_0x152878['params']['id']}})[_0x7fed('0x1e')](handleEntityNotFound(_0x525c29,null))[_0x7fed('0x1e')](removeEntity(_0x525c29,null))[_0x7fed('0x43')](handleError(_0x525c29,null));};exports[_0x7fed('0x4a')]=function(_0x332f07,_0x53ada7,_0x358f74){_0x332f07['body'][_0x7fed('0x22')]=_0x332f07[_0x7fed('0x4b')][_0x7fed('0x4c')];_0x332f07[_0x7fed('0x49')][_0x7fed('0x4d')]=_0x332f07['file'][_0x7fed('0x4e')];_0x332f07[_0x7fed('0x49')][_0x7fed('0x38')]=_0x332f07[_0x7fed('0x4b')][_0x7fed('0x4f')];return db['Attachment'][_0x7fed('0x4a')](_0x332f07[_0x7fed('0x49')])[_0x7fed('0x1e')](respondWithResult(_0x53ada7,0xc9))['catch'](handleError(_0x53ada7,null));};exports[_0x7fed('0x50')]=function(_0x1e6baf,_0x46d1b3,_0x1947cb){return db[_0x7fed('0x26')][_0x7fed('0x51')]({'where':{'id':_0x1e6baf[_0x7fed('0x41')]['id']},'raw':!![]})[_0x7fed('0x1e')](handleEntityNotFound(_0x46d1b3,null))[_0x7fed('0x1e')](function(_0x5d92f0){if(_0x5d92f0){return _0x46d1b3[_0x7fed('0x50')](path[_0x7fed('0x52')](config['root'],_0x7fed('0x53'),_0x5d92f0[_0x7fed('0x4d')]));}})[_0x7fed('0x43')](handleError(_0x46d1b3,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index bd94f30..07a1fae 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 _0xc2a2=['./attachment.attributes','exports','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x28104d,_0x1ddce1){var _0xca609b=function(_0x2b3b26){while(--_0x2b3b26){_0x28104d['push'](_0x28104d['shift']());}};_0xca609b(++_0x1ddce1);}(_0xc2a2,0x84));var _0x2c2a=function(_0x37821b,_0x4ace3a){_0x37821b=_0x37821b-0x0;var _0x2b7304=_0xc2a2[_0x37821b];return _0x2b7304;};'use strict';var _=require(_0x2c2a('0x0'));var util=require(_0x2c2a('0x1'));var logger=require(_0x2c2a('0x2'))(_0x2c2a('0x3'));var moment=require('moment');var BPromise=require(_0x2c2a('0x4'));var rp=require(_0x2c2a('0x5'));var fs=require('fs');var path=require(_0x2c2a('0x6'));var rimraf=require('rimraf');var config=require(_0x2c2a('0x7'));var attributes=require(_0x2c2a('0x8'));module[_0x2c2a('0x9')]=function(_0x17db27,_0x51c919){return _0x17db27['define']('Attachment',attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa0a3=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments','util'];(function(_0x5b5eb4,_0x117c87){var _0x42af53=function(_0xdf6fcb){while(--_0xdf6fcb){_0x5b5eb4['push'](_0x5b5eb4['shift']());}};_0x42af53(++_0x117c87);}(_0xa0a3,0x1e0));var _0x3a0a=function(_0x921c7f,_0x2af506){_0x921c7f=_0x921c7f-0x0;var _0x1c1ce9=_0xa0a3[_0x921c7f];return _0x1c1ce9;};'use strict';var _=require('lodash');var util=require(_0x3a0a('0x0'));var logger=require(_0x3a0a('0x1'))('api');var moment=require(_0x3a0a('0x2'));var BPromise=require(_0x3a0a('0x3'));var rp=require(_0x3a0a('0x4'));var fs=require('fs');var path=require(_0x3a0a('0x5'));var rimraf=require(_0x3a0a('0x6'));var config=require(_0x3a0a('0x7'));var attributes=require(_0x3a0a('0x8'));module[_0x3a0a('0x9')]=function(_0xa047cf,_0x3d7dc7){return _0xa047cf[_0x3a0a('0xa')](_0x3a0a('0xb'),attributes,{'tableName':_0x3a0a('0xc'),'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 a6a8138..b332222 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 _0x6ef6=['options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','CreateAttachment','Attachment','create','body'];(function(_0x55922b,_0x3e3916){var _0x1dba37=function(_0x20e386){while(--_0x20e386){_0x55922b['push'](_0x55922b['shift']());}};_0x1dba37(++_0x3e3916);}(_0x6ef6,0x8e));var _0x66ef=function(_0x4f2797,_0x4abfff){_0x4f2797=_0x4f2797-0x0;var _0xd5c811=_0x6ef6[_0x4f2797];return _0xd5c811;};'use strict';var _=require('lodash');var util=require(_0x66ef('0x0'));var moment=require(_0x66ef('0x1'));var BPromise=require(_0x66ef('0x2'));var rs=require(_0x66ef('0x3'));var fs=require('fs');var Redis=require(_0x66ef('0x4'));var db=require(_0x66ef('0x5'))['db'];var utils=require(_0x66ef('0x6'));var logger=require('../../config/logger')(_0x66ef('0x7'));var config=require(_0x66ef('0x8'));var jayson=require(_0x66ef('0x9'));var client=jayson[_0x66ef('0xa')][_0x66ef('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52388c,_0x356777,_0x3809ca){return new BPromise(function(_0x241506,_0x170110){return client[_0x66ef('0xc')](_0x52388c,_0x3809ca)['then'](function(_0x322683){logger['info'](_0x66ef('0xd'),_0x356777,_0x66ef('0xe'));logger[_0x66ef('0xf')](_0x66ef('0x10'),_0x356777,_0x66ef('0xe'),JSON[_0x66ef('0x11')](_0x322683));if(_0x322683['error']){if(_0x322683['error']['code']===0x1f4){logger[_0x66ef('0x12')](_0x66ef('0xd'),_0x356777,_0x322683[_0x66ef('0x12')][_0x66ef('0x13')]);return _0x170110(_0x322683[_0x66ef('0x12')][_0x66ef('0x13')]);}logger[_0x66ef('0x12')]('Attachment,\x20%s,\x20%s',_0x356777,_0x322683['error'][_0x66ef('0x13')]);return _0x241506(_0x322683[_0x66ef('0x12')]['message']);}else{logger[_0x66ef('0x14')](_0x66ef('0xd'),_0x356777,_0x66ef('0xe'));_0x241506(_0x322683['result'][_0x66ef('0x13')]);}})[_0x66ef('0x15')](function(_0x13cbbc){logger[_0x66ef('0x12')](_0x66ef('0xd'),_0x356777,_0x13cbbc);_0x170110(_0x13cbbc);});});}exports[_0x66ef('0x16')]=function(_0x5b5d3b){var _0x21d4f6=this;return new Promise(function(_0x808d58,_0x1a178c){return db[_0x66ef('0x17')][_0x66ef('0x18')](_0x5b5d3b[_0x66ef('0x19')],{'raw':_0x5b5d3b['options']?_0x5b5d3b[_0x66ef('0x1a')][_0x66ef('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x57a79f){logger['info'](_0x66ef('0x16'),_0x5b5d3b);logger[_0x66ef('0xf')](_0x66ef('0x16'),_0x5b5d3b,JSON['stringify'](_0x57a79f));_0x808d58(_0x57a79f);})[_0x66ef('0x15')](function(_0x360e49){logger[_0x66ef('0x12')](_0x66ef('0x16'),_0x360e49['message'],_0x5b5d3b);_0x1a178c(_0x21d4f6['error'](0x1f4,_0x360e49['message']));});});}; \ No newline at end of file +var _0xecb4=['util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','body','options','raw','CreateAttachment'];(function(_0x3dd500,_0x1ab959){var _0x442e4d=function(_0x4283d4){while(--_0x4283d4){_0x3dd500['push'](_0x3dd500['shift']());}};_0x442e4d(++_0x1ab959);}(_0xecb4,0x168));var _0x4ecb=function(_0x2db9e4,_0x67030e){_0x2db9e4=_0x2db9e4-0x0;var _0x2eca40=_0xecb4[_0x2db9e4];return _0x2eca40;};'use strict';var _=require('lodash');var util=require(_0x4ecb('0x0'));var moment=require('moment');var BPromise=require(_0x4ecb('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ecb('0x2'))['db'];var utils=require(_0x4ecb('0x3'));var logger=require('../../config/logger')(_0x4ecb('0x4'));var config=require(_0x4ecb('0x5'));var jayson=require(_0x4ecb('0x6'));var client=jayson['client'][_0x4ecb('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x38ad40,_0xc6f6,_0x30e90b){return new BPromise(function(_0x4380ee,_0xe1ab1b){return client[_0x4ecb('0x8')](_0x38ad40,_0x30e90b)['then'](function(_0x56d597){logger[_0x4ecb('0x9')](_0x4ecb('0xa'),_0xc6f6,_0x4ecb('0xb'));logger[_0x4ecb('0xc')](_0x4ecb('0xd'),_0xc6f6,_0x4ecb('0xb'),JSON[_0x4ecb('0xe')](_0x56d597));if(_0x56d597[_0x4ecb('0xf')]){if(_0x56d597['error'][_0x4ecb('0x10')]===0x1f4){logger[_0x4ecb('0xf')](_0x4ecb('0xa'),_0xc6f6,_0x56d597[_0x4ecb('0xf')][_0x4ecb('0x11')]);return _0xe1ab1b(_0x56d597[_0x4ecb('0xf')][_0x4ecb('0x11')]);}logger[_0x4ecb('0xf')](_0x4ecb('0xa'),_0xc6f6,_0x56d597[_0x4ecb('0xf')][_0x4ecb('0x11')]);return _0x4380ee(_0x56d597[_0x4ecb('0xf')][_0x4ecb('0x11')]);}else{logger[_0x4ecb('0x9')]('Attachment,\x20%s,\x20%s',_0xc6f6,'request\x20sent');_0x4380ee(_0x56d597[_0x4ecb('0x12')]['message']);}})[_0x4ecb('0x13')](function(_0x963fb9){logger[_0x4ecb('0xf')](_0x4ecb('0xa'),_0xc6f6,_0x963fb9);_0xe1ab1b(_0x963fb9);});});}exports['CreateAttachment']=function(_0x50248a){var _0x1bb5ac=this;return new Promise(function(_0x44edc5,_0xd60a2e){return db['Attachment']['create'](_0x50248a[_0x4ecb('0x14')],{'raw':_0x50248a[_0x4ecb('0x15')]?_0x50248a[_0x4ecb('0x15')][_0x4ecb('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x3b3b3b){logger['info'](_0x4ecb('0x17'),_0x50248a);logger['debug'](_0x4ecb('0x17'),_0x50248a,JSON[_0x4ecb('0xe')](_0x3b3b3b));_0x44edc5(_0x3b3b3b);})[_0x4ecb('0x13')](function(_0x5e1ae2){logger[_0x4ecb('0xf')](_0x4ecb('0x17'),_0x5e1ae2['message'],_0x50248a);_0xd60a2e(_0x1bb5ac['error'](0x1f4,_0x5e1ae2['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index db032f5..5a2ba82 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 _0xc3b7=['isAuthenticated','/:id/download','download','post','/:id/clone','clone','diskStorage','join','root','format','%s-%s','now','replace','single','file','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','index','get','/:id'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc3b7,0xb4));var _0x7c3b=function(_0x67227e,_0x549cd3){_0x67227e=_0x67227e-0x0;var _0x3dc6e4=_0xc3b7[_0x67227e];return _0x3dc6e4;};'use strict';var multer=require('multer');var util=require(_0x7c3b('0x0'));var path=require(_0x7c3b('0x1'));var timeout=require(_0x7c3b('0x2'));var express=require(_0x7c3b('0x3'));var router=express[_0x7c3b('0x4')]();var auth=require(_0x7c3b('0x5'));var interaction=require(_0x7c3b('0x6'));var config=require(_0x7c3b('0x7'));var controller=require(_0x7c3b('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x7c3b('0x9')]);router[_0x7c3b('0xa')](_0x7c3b('0xb'),auth[_0x7c3b('0xc')](),controller['show']);router[_0x7c3b('0xa')](_0x7c3b('0xd'),auth[_0x7c3b('0xc')](),controller[_0x7c3b('0xe')]);router[_0x7c3b('0xf')](_0x7c3b('0x10'),auth[_0x7c3b('0xc')](),controller[_0x7c3b('0x11')]);var upload=multer({'storage':multer[_0x7c3b('0x12')]({'destination':function(_0x220f21,_0x74dc35,_0xf4883f){_0xf4883f(null,path[_0x7c3b('0x13')](config[_0x7c3b('0x14')],'server/files/attachments/'));},'filename':function(_0x157e55,_0x455145,_0x4c7871){_0x4c7871(null,util[_0x7c3b('0x15')](_0x7c3b('0x16'),Date[_0x7c3b('0x17')](),_0x455145['originalname'][_0x7c3b('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x7c3b('0xf')]('/',upload[_0x7c3b('0x19')](_0x7c3b('0x1a')),controller['create']);router[_0x7c3b('0x1b')](_0x7c3b('0xb'),auth['isAuthenticated'](),controller[_0x7c3b('0x1c')]);router[_0x7c3b('0x1d')](_0x7c3b('0xb'),auth[_0x7c3b('0xc')](),controller[_0x7c3b('0x1e')]);module[_0x7c3b('0x1f')]=router; \ No newline at end of file +var _0x41f6=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','/:id','/:id/download','download','post','/:id/clone','clone','diskStorage','join','root','format','now','originalname','replace','single','file','create','destroy','multer','path','connect-timeout'];(function(_0x1304a4,_0x21bc8b){var _0x40cd18=function(_0x38fa52){while(--_0x38fa52){_0x1304a4['push'](_0x1304a4['shift']());}};_0x40cd18(++_0x21bc8b);}(_0x41f6,0x8e));var _0x641f=function(_0x354164,_0x4c30de){_0x354164=_0x354164-0x0;var _0x5db9a8=_0x41f6[_0x354164];return _0x5db9a8;};'use strict';var multer=require(_0x641f('0x0'));var util=require('util');var path=require(_0x641f('0x1'));var timeout=require(_0x641f('0x2'));var express=require(_0x641f('0x3'));var router=express[_0x641f('0x4')]();var auth=require(_0x641f('0x5'));var interaction=require(_0x641f('0x6'));var config=require(_0x641f('0x7'));var controller=require(_0x641f('0x8'));router[_0x641f('0x9')]('/',auth[_0x641f('0xa')](),controller[_0x641f('0xb')]);router['get'](_0x641f('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x641f('0x9')](_0x641f('0xd'),auth[_0x641f('0xa')](),controller[_0x641f('0xe')]);router[_0x641f('0xf')](_0x641f('0x10'),auth['isAuthenticated'](),controller[_0x641f('0x11')]);var upload=multer({'storage':multer[_0x641f('0x12')]({'destination':function(_0x420315,_0x2e0250,_0x1f1821){_0x1f1821(null,path[_0x641f('0x13')](config[_0x641f('0x14')],'server/files/attachments/'));},'filename':function(_0x4fabc7,_0x589ac5,_0x24ef04){_0x24ef04(null,util[_0x641f('0x15')]('%s-%s',Date[_0x641f('0x16')](),_0x589ac5[_0x641f('0x17')][_0x641f('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x641f('0xf')]('/',upload[_0x641f('0x19')](_0x641f('0x1a')),controller[_0x641f('0x1b')]);router['put'](_0x641f('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x641f('0xc'),auth[_0x641f('0xa')](),controller[_0x641f('0x1c')]);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 ffb0689..85956e1 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 _0xd8b0=['Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb','../../components/auth/service','signToken','../../config/utils','login','authenticate','google','email','callback','/login','clientID','clientSecret','callbackURL','Setting','findOne','allowedLoginAttempts','then','User','user','agent','disabled'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xd8b0,0x194));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var passport=require(_0x0d8b('0x1'));var GoogleStrategy=require(_0x0d8b('0x2'))[_0x0d8b('0x3')];var moment=require('moment');var db=require(_0x0d8b('0x4'))['db'];var config=require('../../config/environment');var signToken=require(_0x0d8b('0x5'))[_0x0d8b('0x6')];var utils=require(_0x0d8b('0x7'));exports[_0x0d8b('0x8')]=passport[_0x0d8b('0x9')](_0x0d8b('0xa'),{'failureRedirect':'/login','scope':['profile',_0x0d8b('0xb')],'session':![]});exports[_0x0d8b('0xc')]=passport[_0x0d8b('0x9')]('google',{'failureRedirect':_0x0d8b('0xd'),'session':![]});passport['use'](new GoogleStrategy({'clientID':config[_0x0d8b('0xa')]?config[_0x0d8b('0xa')][_0x0d8b('0xe')]:'id','clientSecret':config[_0x0d8b('0xa')]?config['google'][_0x0d8b('0xf')]:'secret','callbackURL':config[_0x0d8b('0xa')]?config['google'][_0x0d8b('0x10')]:''},function(_0x3f49f6,_0x36e705,_0x50ae14,_0x1d991b){var _0x9946bb,_0x3afe1c;return db[_0x0d8b('0x11')][_0x0d8b('0x12')]({'where':{'id':0x1},'attributes':[_0x0d8b('0x13'),'blockDuration'],'raw':!![]})[_0x0d8b('0x14')](function(_0x4c7ffb){_0x9946bb=_0x4c7ffb;return db[_0x0d8b('0x15')]['find']({'where':{'email':_['map'](_0x50ae14['emails'],'value'),'role':{'$or':['admin',_0x0d8b('0x16'),_0x0d8b('0x17')]}}});})[_0x0d8b('0x14')](function(_0x3eb260){_0x3afe1c=_0x3eb260;if(_0x3afe1c){if(_0x3afe1c[_0x0d8b('0x18')]){return _0x1d991b(_0x0d8b('0x19'));}else if(_0x9946bb['blockDuration']>0x0){if(_0x3afe1c[_0x0d8b('0x1a')]){if(moment(_0x3afe1c[_0x0d8b('0x1b')])[_0x0d8b('0x1c')](_0x9946bb['blockDuration'],_0x0d8b('0x1d'))>moment()){return _0x1d991b(_0x0d8b('0x19'));}else{return utils[_0x0d8b('0x1e')](_0x3afe1c,0x0,![],null)[_0x0d8b('0x14')](function(){return utils['getLicense'](_0x3afe1c);})[_0x0d8b('0x14')](function(){return _0x1d991b(null,_0x3afe1c);});}}else{return utils[_0x0d8b('0x1f')](_0x3afe1c)['then'](function(){return _0x1d991b(null,_0x3afe1c);});}}else{return utils[_0x0d8b('0x1f')](_0x3afe1c)[_0x0d8b('0x14')](function(){return _0x1d991b(null,_0x3afe1c);});}}return _0x1d991b('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})[_0x0d8b('0x20')](function(_0x39d28b){_0x1d991b(_0x39d28b);});})); \ No newline at end of file +var _0xdcdf=['disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockedAt','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','moment','../../mysqldb','../../components/auth/service','../../config/utils','authenticate','google','/login','profile','email','callback','use','callbackURL','Setting','findOne','allowedLoginAttempts','blockDuration','then','find','emails','value','user','agent'];(function(_0x38eb23,_0x196e8b){var _0x48506a=function(_0x36edb0){while(--_0x36edb0){_0x38eb23['push'](_0x38eb23['shift']());}};_0x48506a(++_0x196e8b);}(_0xdcdf,0xee));var _0xfdcd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdcdf[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfdcd('0x0'));var passport=require(_0xfdcd('0x1'));var GoogleStrategy=require(_0xfdcd('0x2'))[_0xfdcd('0x3')];var moment=require(_0xfdcd('0x4'));var db=require(_0xfdcd('0x5'))['db'];var config=require('../../config/environment');var signToken=require(_0xfdcd('0x6'))['signToken'];var utils=require(_0xfdcd('0x7'));exports['login']=passport[_0xfdcd('0x8')](_0xfdcd('0x9'),{'failureRedirect':_0xfdcd('0xa'),'scope':[_0xfdcd('0xb'),_0xfdcd('0xc')],'session':![]});exports[_0xfdcd('0xd')]=passport['authenticate'](_0xfdcd('0x9'),{'failureRedirect':_0xfdcd('0xa'),'session':![]});passport[_0xfdcd('0xe')](new GoogleStrategy({'clientID':config[_0xfdcd('0x9')]?config['google']['clientID']:'id','clientSecret':config['google']?config[_0xfdcd('0x9')]['clientSecret']:'secret','callbackURL':config[_0xfdcd('0x9')]?config[_0xfdcd('0x9')][_0xfdcd('0xf')]:''},function(_0x1be44b,_0x785d8b,_0x14210e,_0x545c90){var _0x32c4ef,_0x5bd96e;return db[_0xfdcd('0x10')][_0xfdcd('0x11')]({'where':{'id':0x1},'attributes':[_0xfdcd('0x12'),_0xfdcd('0x13')],'raw':!![]})[_0xfdcd('0x14')](function(_0x482674){_0x32c4ef=_0x482674;return db['User'][_0xfdcd('0x15')]({'where':{'email':_['map'](_0x14210e[_0xfdcd('0x16')],_0xfdcd('0x17')),'role':{'$or':['admin',_0xfdcd('0x18'),_0xfdcd('0x19')]}}});})[_0xfdcd('0x14')](function(_0x492cca){_0x5bd96e=_0x492cca;if(_0x5bd96e){if(_0x5bd96e[_0xfdcd('0x1a')]){return _0x545c90(_0xfdcd('0x1b'));}else if(_0x32c4ef[_0xfdcd('0x13')]>0x0){if(_0x5bd96e['blocked']){if(moment(_0x5bd96e[_0xfdcd('0x1c')])['add'](_0x32c4ef[_0xfdcd('0x13')],_0xfdcd('0x1d'))>moment()){return _0x545c90(_0xfdcd('0x1b'));}else{return utils[_0xfdcd('0x1e')](_0x5bd96e,0x0,![],null)['then'](function(){return utils['getLicense'](_0x5bd96e);})[_0xfdcd('0x14')](function(){return _0x545c90(null,_0x5bd96e);});}}else{return utils['getLicense'](_0x5bd96e)['then'](function(){return _0x545c90(null,_0x5bd96e);});}}else{return utils[_0xfdcd('0x1f')](_0x5bd96e)[_0xfdcd('0x14')](function(){return _0x545c90(null,_0x5bd96e);});}}return _0x545c90(_0xfdcd('0x1b'));})[_0xfdcd('0x20')](function(_0x19753f){_0x545c90(_0x19753f);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index a5096bc..162e211 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 _0xd51f=['../user/user.controller.js','get','login','/callback','callback','setTokenCookie','express','passport','./authGoogle.controller'];(function(_0x33fb76,_0x450ed3){var _0x41033e=function(_0x14ed5e){while(--_0x14ed5e){_0x33fb76['push'](_0x33fb76['shift']());}};_0x41033e(++_0x450ed3);}(_0xd51f,0xf0));var _0xfd51=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xd51f[_0x1cc8fe];return _0x230054;};'use strict';var express=require(_0xfd51('0x0'));var passport=require(_0xfd51('0x1'));var router=express['Router']();var controller=require(_0xfd51('0x2'));var userController=require(_0xfd51('0x3'));var authService=require('../../components/auth/service');router[_0xfd51('0x4')]('/',controller[_0xfd51('0x5')]);router['get'](_0xfd51('0x6'),controller[_0xfd51('0x7')],authService['isMiddleware'],userController[_0xfd51('0x5')],authService[_0xfd51('0x8')]);module['exports']=router; \ No newline at end of file +var _0x32ef=['./authGoogle.controller','../user/user.controller.js','../../components/auth/service','login','get','callback','isMiddleware','setTokenCookie','exports','express','passport','Router'];(function(_0x822a4a,_0x2203e9){var _0x4f34c6=function(_0xf5f8b4){while(--_0xf5f8b4){_0x822a4a['push'](_0x822a4a['shift']());}};_0x4f34c6(++_0x2203e9);}(_0x32ef,0xf9));var _0xf32e=function(_0x2b95e5,_0x5ea62c){_0x2b95e5=_0x2b95e5-0x0;var _0x5b0aee=_0x32ef[_0x2b95e5];return _0x5b0aee;};'use strict';var express=require(_0xf32e('0x0'));var passport=require(_0xf32e('0x1'));var router=express[_0xf32e('0x2')]();var controller=require(_0xf32e('0x3'));var userController=require(_0xf32e('0x4'));var authService=require(_0xf32e('0x5'));router['get']('/',controller[_0xf32e('0x6')]);router[_0xf32e('0x7')]('/callback',controller[_0xf32e('0x8')],authService[_0xf32e('0x9')],userController[_0xf32e('0x6')],authService[_0xf32e('0xa')]);module[_0xf32e('0xb')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 43e40bf..2f0b179 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 _0x8de8=['Setting','securePassword','resetPasswordToken','util','passport-local','Strategy','jayson/promise','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','findOne','blockDuration','then','name','password','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','allowedLoginAttempts','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','pass','format','\x22%s\x22\x20<%s>','request','SendMail','error','message','stringify','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~!@#$%^&-_=+[{]}.','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','forgot','Email\x20parameter\x20is\x20missing','generate','body','trim','toLowerCase','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','now','save','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','http://','headers','/reset/','send','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.'];(function(_0x5678b5,_0x1c4aa8){var _0x4c09a5=function(_0x2aa89a){while(--_0x2aa89a){_0x5678b5['push'](_0x5678b5['shift']());}};_0x4c09a5(++_0x1c4aa8);}(_0x8de8,0x19d));var _0x88de=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8de8[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x88de('0x0'));var passport=require('passport');var LocalStrategy=require(_0x88de('0x1'))[_0x88de('0x2')];var jayson=require(_0x88de('0x3'));var _=require('lodash');var rs=require(_0x88de('0x4'));var moment=require(_0x88de('0x5'));var db=require(_0x88de('0x6'))['db'];var authService=require(_0x88de('0x7'));var utils=require(_0x88de('0x8'));var client=jayson[_0x88de('0x9')]['http']({'port':0x232b});function localAuthenticate(_0x40550a,_0xcd2390,_0x5837f7,_0x3219a9){var _0x2eafef,_0x196cc9;return db['Setting'][_0x88de('0xa')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x88de('0xb')],'raw':!![]})[_0x88de('0xc')](function(_0x4f3378){_0x2eafef=_0x4f3378;return _0x40550a[_0x88de('0xa')]({'attributes':['id',_0x88de('0xd'),_0x88de('0xe'),_0x88de('0xf'),_0x88de('0x10'),_0x88de('0x11'),_0x88de('0x12'),_0x88de('0x13'),_0x88de('0x14')],'where':{'name':_0xcd2390,'role':{'$or':[_0x88de('0x15'),_0x88de('0x16'),_0x88de('0x17')]}}});})[_0x88de('0xc')](function(_0x2b15c4){if(!_0x2b15c4||_0x2b15c4&&_0x2b15c4[_0x88de('0xd')]!==_0xcd2390){throw new Error(_0x88de('0x18'));}else{_0x196cc9=_0x2b15c4;return _0x196cc9;}})[_0x88de('0xc')](function(){_0x196cc9[_0x88de('0x19')](_0x5837f7,function(_0x5ed58b,_0x3eb4dc){var _0x44a419=_0x196cc9[_0x88de('0x14')]+0x1;if(_0x5ed58b){return _0x3219a9(_0x5ed58b);}else if(!_0x3eb4dc){if(_0x196cc9[_0x88de('0x11')]){return _0x3219a9(null,![],{'message':_0x88de('0x18')});}else if(_0x2eafef[_0x88de('0x1a')]>0x0){if(_0x196cc9[_0x88de('0x12')]){if(_0x2eafef[_0x88de('0xb')]>0x0){if(moment(_0x196cc9['blockedAt'])[_0x88de('0x1b')](_0x2eafef[_0x88de('0xb')],_0x88de('0x1c'))>moment()){return _0x3219a9(null,![],{'message':_0x88de('0x18')});}else{return utils[_0x88de('0x1d')](_0x196cc9,_0x44a419,![],null)[_0x88de('0xc')](function(){return _0x3219a9(null,![],{'message':_0x88de('0x18')});});}}else{return _0x3219a9(null,![],{'message':_0x88de('0x18')});}}else{if(_0x44a419>=_0x2eafef[_0x88de('0x1a')]){return utils[_0x88de('0x1d')](_0x196cc9,0x0,!![],moment())[_0x88de('0xc')](function(){return _0x3219a9(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x88de('0x1d')](_0x196cc9,_0x44a419,![],null)[_0x88de('0xc')](function(){return _0x3219a9(null,![],{'message':_0x88de('0x18')});});}}}else{return _0x3219a9(null,![],{'message':_0x88de('0x18')});}}else{if(_0x196cc9['disabled']){return _0x3219a9(null,![],{'message':_0x88de('0x18')});}else if(_0x2eafef['allowedLoginAttempts']>0x0){if(_0x196cc9[_0x88de('0x12')]){if(_0x2eafef[_0x88de('0xb')]>0x0){if(moment(_0x196cc9[_0x88de('0x13')])[_0x88de('0x1b')](_0x2eafef[_0x88de('0xb')],_0x88de('0x1c'))>moment()){return _0x3219a9(null,![],{'message':_0x88de('0x18')});}else{return utils[_0x88de('0x1d')](_0x196cc9,0x0,![],null)[_0x88de('0xc')](function(){return utils[_0x88de('0x1e')](_0x196cc9);})[_0x88de('0xc')](function(){return _0x3219a9(null,_0x196cc9);});}}else{return _0x3219a9(null,![],{'message':_0x88de('0x18')});}}else{return utils[_0x88de('0x1d')](_0x196cc9,0x0,![],null)['then'](function(){return utils[_0x88de('0x1e')](_0x196cc9);})['then'](function(){return _0x3219a9(null,_0x196cc9);})[_0x88de('0x1f')](function(_0x4110cf){return _0x3219a9(null,![],_0x4110cf);});}}else{if(_0x196cc9['blocked']){return _0x3219a9(null,![],{'message':_0x88de('0x18')});}else{return utils['getLicense'](_0x196cc9)[_0x88de('0xc')](function(){return _0x3219a9(null,_0x196cc9);});}}}});})['catch'](function(_0xf271f3){return _0x3219a9(null,![],_0xf271f3);});}function sendServiceMail(_0x569aa5){return db[_0x88de('0x20')][_0x88de('0x21')]({'where':{'service':!![]},'attributes':['id','name',_0x88de('0x22')],'include':[{'model':db[_0x88de('0x23')],'as':_0x88de('0x24')}]})['then'](function(_0x5016a3){if(!_0x5016a3){throw new Error(_0x88de('0x25'));}var _0x2b4485={'tls':{'rejectUnauthorized':![]}};if(_0x5016a3[_0x88de('0x24')][_0x88de('0x26')]){_0x2b4485[_0x88de('0x26')]=_0x5016a3[_0x88de('0x24')][_0x88de('0x26')];}else{_0x2b4485['host']=_0x5016a3[_0x88de('0x24')][_0x88de('0x27')];_0x2b4485[_0x88de('0x28')]=_0x5016a3[_0x88de('0x24')][_0x88de('0x28')];_0x2b4485[_0x88de('0x29')]=_0x5016a3[_0x88de('0x24')][_0x88de('0x29')];}if(_0x5016a3['Smtp'][_0x88de('0x2a')]){_0x2b4485[_0x88de('0x2b')]={'user':_0x5016a3[_0x88de('0x24')][_0x88de('0x16')],'pass':_0x5016a3['Smtp'][_0x88de('0x2c')]};}var _0x2d3514={'account':_0x2b4485,'message':_['merge']({'from':util[_0x88de('0x2d')](_0x88de('0x2e'),_0x5016a3[_0x88de('0xd')],_0x5016a3[_0x88de('0x22')]||_0x5016a3[_0x88de('0x24')]['user'])},_0x569aa5)};return client[_0x88de('0x2f')](_0x88de('0x30'),_0x2d3514);})[_0x88de('0xc')](function(_0x4c3ca8){if(_0x4c3ca8[_0x88de('0x31')]){throw new Error(util[_0x88de('0x2d')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x4c3ca8['error'][_0x88de('0x32')]||JSON[_0x88de('0x33')](_0x4c3ca8[_0x88de('0x31')])));}return!![];});}function handleError(_0x690ede,_0x32249c,_0x14529c){return _0x690ede[_0x88de('0x34')](_0x32249c||0x1f4)['send']({'message':_0x14529c?_0x14529c[_0x88de('0x32')]||_0x14529c:''});}function checkPasswordPattern(_0x9c4563,_0x352af1,_0x1464b8){if(_0x1464b8){var _0x32029a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x32029a[_0x88de('0x35')](_0x352af1)){return _0x9c4563;}else{throw new Error(_0x88de('0x36'));}}else{return _0x9c4563;}}exports['login']=function(_0x30a6cb,_0x18411b,_0x32ef22){passport[_0x88de('0x19')]('local',function(_0x304ab5,_0x3c2610,_0x4f1155){var _0x2f5c05=_0x304ab5||_0x4f1155;if(_0x2f5c05){return handleError(_0x18411b,0x191,_0x2f5c05);}if(!_0x3c2610){return handleError(_0x18411b,0x194,{'message':_0x88de('0x37')});}else{var _0x5d5b09={'payload':{'id':_0x3c2610['id'],'role':_0x3c2610[_0x88de('0x10')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x5d5b09)['then'](function(_0x11c665){_0x18411b[_0x88de('0x38')]({'id':_0x3c2610['id'],'token':_0x11c665,'statusCall':'','isAlreadyLogged':_0x3c2610[_0x88de('0x39')]});});}})(_0x30a6cb,_0x18411b,_0x32ef22);};exports[_0x88de('0x3a')]=function(_0x4fe892,_0x4798f3,_0x1f5f60){if(!_0x4fe892['body']['email']){return handleError(_0x4798f3,0x1f4,{'message':_0x88de('0x3b')});}var _0x1ccc5a=rs[_0x88de('0x3c')]();_0x4fe892[_0x88de('0x3d')]['email']=_0x4fe892[_0x88de('0x3d')]['email'][_0x88de('0x3e')]()[_0x88de('0x3f')]();var _0x353e92;return db['Setting'][_0x88de('0xa')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x88de('0xb')],'raw':!![]})[_0x88de('0xc')](function(_0x414852){_0x353e92=_0x414852;return db[_0x88de('0x40')][_0x88de('0x21')]({'where':{'email':_0x4fe892[_0x88de('0x3d')][_0x88de('0x22')]}});})[_0x88de('0xc')](function(_0x3e8625){if(!_0x3e8625){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x3e8625[_0x88de('0x11')]){throw new Error(_0x88de('0x41'));}if(_0x3e8625[_0x88de('0x12')]){if(moment(_0x3e8625[_0x88de('0x13')])[_0x88de('0x1b')](_0x353e92['blockDuration'],_0x88de('0x1c'))>moment()){throw new Error(_0x88de('0x42'));}else{_0x3e8625['blocked']=![];_0x3e8625[_0x88de('0x13')]=null;}}_0x3e8625['resetPasswordToken']=_0x1ccc5a;_0x3e8625['resetPasswordExpires']=Date[_0x88de('0x43')]()+0x36ee80;return _0x3e8625[_0x88de('0x44')]();})[_0x88de('0xc')](function(){return sendServiceMail({'to':_0x4fe892[_0x88de('0x3d')]['email'],'subject':'xCally\x20Motion\x20Password\x20Reset','text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x88de('0x45')+_0x88de('0x46')+_0x4fe892[_0x88de('0x47')]['host']+_0x88de('0x48')+_0x1ccc5a+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x88de('0xc')](function(){_0x4798f3[_0x88de('0x34')](0xc8)[_0x88de('0x49')]({'message':_0x88de('0x4a')});})[_0x88de('0x1f')](function(_0x4a0b2a){return handleError(_0x4798f3,0x1f4,_0x4a0b2a);});};exports[_0x88de('0x4b')]=function(_0x24a3df,_0x591263,_0x51d15d){var _0x3f3bf1;return db[_0x88de('0x40')][_0x88de('0x21')]({'where':{'resetPasswordToken':_0x24a3df[_0x88de('0x4c')][_0x88de('0x4d')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x88de('0xc')](function(_0x232141){_0x3f3bf1=_0x232141;if(!_0x3f3bf1){throw new Error(_0x88de('0x4e'));}return db[_0x88de('0x4f')]['findOne']({'attributes':['id',_0x88de('0x50')]});})[_0x88de('0xc')](function(_0x23418d){return checkPasswordPattern(_0x23418d,_0x24a3df[_0x88de('0x3d')]['password'],_0x23418d['securePassword']);})[_0x88de('0xc')](function(){_0x3f3bf1[_0x88de('0xe')]=_0x24a3df[_0x88de('0x3d')][_0x88de('0xe')];_0x3f3bf1[_0x88de('0x51')]=null;_0x3f3bf1['resetPasswordExpires']=null;return _0x3f3bf1[_0x88de('0x44')]();})[_0x88de('0xc')](function(){_0x591263[_0x88de('0x34')](0xc8)[_0x88de('0x49')]({'message':'Password\x20reset!'});})[_0x88de('0x1f')](function(_0x5e2791){return handleError(_0x591263,0x1f4,_0x5e2791);});};passport['use'](new LocalStrategy({'usernameField':_0x88de('0xd'),'passwordField':_0x88de('0xe')},function(_0x857433,_0x4949b5,_0x6f4a3e){return localAuthenticate(db['User'],_0x857433,_0x4949b5,_0x6f4a3e);})); \ No newline at end of file +var _0x1ac3=['authenticate','blockedAt','clearBlockUser','add','minutes','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','merge','format','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','send','message','local','signToken','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','findOne','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','randomstring','moment','../../mysqldb','../../config/utils','http','Setting','allowedLoginAttempts','blockDuration','then','password','salt','role','disabled','blocked','loginAttempts','admin','user','agent','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x5426e1,_0x26210f){var _0x47790d=function(_0x315219){while(--_0x315219){_0x5426e1['push'](_0x5426e1['shift']());}};_0x47790d(++_0x26210f);}(_0x1ac3,0x17c));var _0x31ac=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x1ac3[_0x565c49];return _0x20ca34;};'use strict';var util=require(_0x31ac('0x0'));var passport=require(_0x31ac('0x1'));var LocalStrategy=require(_0x31ac('0x2'))[_0x31ac('0x3')];var jayson=require(_0x31ac('0x4'));var _=require('lodash');var rs=require(_0x31ac('0x5'));var moment=require(_0x31ac('0x6'));var db=require(_0x31ac('0x7'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x31ac('0x8'));var client=jayson['client'][_0x31ac('0x9')]({'port':0x232b});function localAuthenticate(_0x372a8b,_0x37a669,_0x43c2bc,_0xc07daf){var _0x3696e9,_0x4eda70;return db[_0x31ac('0xa')]['findOne']({'where':{'id':0x1},'attributes':[_0x31ac('0xb'),_0x31ac('0xc')],'raw':!![]})[_0x31ac('0xd')](function(_0x4d7959){_0x3696e9=_0x4d7959;return _0x372a8b['findOne']({'attributes':['id','name',_0x31ac('0xe'),_0x31ac('0xf'),_0x31ac('0x10'),_0x31ac('0x11'),_0x31ac('0x12'),'blockedAt',_0x31ac('0x13')],'where':{'name':_0x37a669,'role':{'$or':[_0x31ac('0x14'),_0x31ac('0x15'),_0x31ac('0x16')]}}});})[_0x31ac('0xd')](function(_0x414361){if(!_0x414361||_0x414361&&_0x414361[_0x31ac('0x17')]!==_0x37a669){throw new Error(_0x31ac('0x18'));}else{_0x4eda70=_0x414361;return _0x4eda70;}})[_0x31ac('0xd')](function(){_0x4eda70[_0x31ac('0x19')](_0x43c2bc,function(_0x42cee1,_0x3b360d){var _0xa960ce=_0x4eda70['loginAttempts']+0x1;if(_0x42cee1){return _0xc07daf(_0x42cee1);}else if(!_0x3b360d){if(_0x4eda70['disabled']){return _0xc07daf(null,![],{'message':_0x31ac('0x18')});}else if(_0x3696e9['allowedLoginAttempts']>0x0){if(_0x4eda70[_0x31ac('0x12')]){if(_0x3696e9['blockDuration']>0x0){if(moment(_0x4eda70[_0x31ac('0x1a')])['add'](_0x3696e9[_0x31ac('0xc')],'minutes')>moment()){return _0xc07daf(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x4eda70,_0xa960ce,![],null)[_0x31ac('0xd')](function(){return _0xc07daf(null,![],{'message':_0x31ac('0x18')});});}}else{return _0xc07daf(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0xa960ce>=_0x3696e9[_0x31ac('0xb')]){return utils['clearBlockUser'](_0x4eda70,0x0,!![],moment())[_0x31ac('0xd')](function(){return _0xc07daf(null,![],{'message':_0x31ac('0x18')});});}else{return utils[_0x31ac('0x1b')](_0x4eda70,_0xa960ce,![],null)[_0x31ac('0xd')](function(){return _0xc07daf(null,![],{'message':_0x31ac('0x18')});});}}}else{return _0xc07daf(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x4eda70[_0x31ac('0x11')]){return _0xc07daf(null,![],{'message':_0x31ac('0x18')});}else if(_0x3696e9[_0x31ac('0xb')]>0x0){if(_0x4eda70[_0x31ac('0x12')]){if(_0x3696e9[_0x31ac('0xc')]>0x0){if(moment(_0x4eda70[_0x31ac('0x1a')])[_0x31ac('0x1c')](_0x3696e9[_0x31ac('0xc')],_0x31ac('0x1d'))>moment()){return _0xc07daf(null,![],{'message':_0x31ac('0x18')});}else{return utils[_0x31ac('0x1b')](_0x4eda70,0x0,![],null)[_0x31ac('0xd')](function(){return utils['getLicense'](_0x4eda70);})[_0x31ac('0xd')](function(){return _0xc07daf(null,_0x4eda70);});}}else{return _0xc07daf(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x31ac('0x1b')](_0x4eda70,0x0,![],null)[_0x31ac('0xd')](function(){return utils[_0x31ac('0x1e')](_0x4eda70);})['then'](function(){return _0xc07daf(null,_0x4eda70);})[_0x31ac('0x1f')](function(_0x477cff){return _0xc07daf(null,![],_0x477cff);});}}else{if(_0x4eda70[_0x31ac('0x12')]){return _0xc07daf(null,![],{'message':_0x31ac('0x18')});}else{return utils['getLicense'](_0x4eda70)['then'](function(){return _0xc07daf(null,_0x4eda70);});}}}});})[_0x31ac('0x1f')](function(_0x388344){return _0xc07daf(null,![],_0x388344);});}function sendServiceMail(_0x5c1eb6){return db[_0x31ac('0x20')][_0x31ac('0x21')]({'where':{'service':!![]},'attributes':['id',_0x31ac('0x17'),_0x31ac('0x22')],'include':[{'model':db[_0x31ac('0x23')],'as':_0x31ac('0x24')}]})[_0x31ac('0xd')](function(_0x32a665){if(!_0x32a665){throw new Error(_0x31ac('0x25'));}var _0x15ee41={'tls':{'rejectUnauthorized':![]}};if(_0x32a665[_0x31ac('0x24')][_0x31ac('0x26')]){_0x15ee41['service']=_0x32a665[_0x31ac('0x24')][_0x31ac('0x26')];}else{_0x15ee41[_0x31ac('0x27')]=_0x32a665['Smtp'][_0x31ac('0x27')];_0x15ee41[_0x31ac('0x28')]=_0x32a665['Smtp'][_0x31ac('0x28')];_0x15ee41['secure']=_0x32a665['Smtp'][_0x31ac('0x29')];}if(_0x32a665[_0x31ac('0x24')][_0x31ac('0x2a')]){_0x15ee41[_0x31ac('0x2b')]={'user':_0x32a665['Smtp'][_0x31ac('0x15')],'pass':_0x32a665[_0x31ac('0x24')]['pass']};}var _0x3e8e31={'account':_0x15ee41,'message':_[_0x31ac('0x2c')]({'from':util[_0x31ac('0x2d')]('\x22%s\x22\x20<%s>',_0x32a665[_0x31ac('0x17')],_0x32a665[_0x31ac('0x22')]||_0x32a665['Smtp']['user'])},_0x5c1eb6)};return client[_0x31ac('0x2e')](_0x31ac('0x2f'),_0x3e8e31);})[_0x31ac('0xd')](function(_0x1a3cf7){if(_0x1a3cf7[_0x31ac('0x30')]){throw new Error(util[_0x31ac('0x2d')](_0x31ac('0x31'),_0x1a3cf7[_0x31ac('0x30')]['message']||JSON[_0x31ac('0x32')](_0x1a3cf7[_0x31ac('0x30')])));}return!![];});}function handleError(_0x4bb371,_0x145d06,_0x347c34){return _0x4bb371[_0x31ac('0x33')](_0x145d06||0x1f4)[_0x31ac('0x34')]({'message':_0x347c34?_0x347c34[_0x31ac('0x35')]||_0x347c34:''});}function checkPasswordPattern(_0x4b6871,_0x1a7041,_0x3f5acd){if(_0x3f5acd){var _0x5b6f53=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5b6f53['test'](_0x1a7041)){return _0x4b6871;}else{throw new Error('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x4b6871;}}exports['login']=function(_0x502634,_0x3eb6c9,_0x36d1ed){passport[_0x31ac('0x19')](_0x31ac('0x36'),function(_0x189ebb,_0x404de9,_0x592173){var _0x58c38b=_0x189ebb||_0x592173;if(_0x58c38b){return handleError(_0x3eb6c9,0x191,_0x58c38b);}if(!_0x404de9){return handleError(_0x3eb6c9,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x57bdc8={'payload':{'id':_0x404de9['id'],'role':_0x404de9[_0x31ac('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0x31ac('0x37')](_0x57bdc8)[_0x31ac('0xd')](function(_0x49c0da){_0x3eb6c9['json']({'id':_0x404de9['id'],'token':_0x49c0da,'statusCall':'','isAlreadyLogged':_0x404de9['online']});});}})(_0x502634,_0x3eb6c9,_0x36d1ed);};exports[_0x31ac('0x38')]=function(_0x468d1d,_0x54eb05,_0x334364){if(!_0x468d1d[_0x31ac('0x39')][_0x31ac('0x22')]){return handleError(_0x54eb05,0x1f4,{'message':_0x31ac('0x3a')});}var _0x3e015b=rs[_0x31ac('0x3b')]();_0x468d1d[_0x31ac('0x39')][_0x31ac('0x22')]=_0x468d1d[_0x31ac('0x39')][_0x31ac('0x22')][_0x31ac('0x3c')]()[_0x31ac('0x3d')]();var _0x2d3af3;return db[_0x31ac('0xa')][_0x31ac('0x3e')]({'where':{'id':0x1},'attributes':[_0x31ac('0xb'),'blockDuration'],'raw':!![]})[_0x31ac('0xd')](function(_0x200a00){_0x2d3af3=_0x200a00;return db[_0x31ac('0x3f')][_0x31ac('0x21')]({'where':{'email':_0x468d1d[_0x31ac('0x39')][_0x31ac('0x22')]}});})['then'](function(_0x13eb9f){if(!_0x13eb9f){throw new Error(_0x31ac('0x40'));}if(_0x13eb9f['disabled']){throw new Error(_0x31ac('0x41'));}if(_0x13eb9f[_0x31ac('0x12')]){if(moment(_0x13eb9f[_0x31ac('0x1a')])[_0x31ac('0x1c')](_0x2d3af3[_0x31ac('0xc')],_0x31ac('0x1d'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x13eb9f['blocked']=![];_0x13eb9f['blockedAt']=null;}}_0x13eb9f[_0x31ac('0x42')]=_0x3e015b;_0x13eb9f[_0x31ac('0x43')]=Date[_0x31ac('0x44')]()+0x36ee80;return _0x13eb9f[_0x31ac('0x45')]();})[_0x31ac('0xd')](function(){return sendServiceMail({'to':_0x468d1d[_0x31ac('0x39')][_0x31ac('0x22')],'subject':_0x31ac('0x46'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x31ac('0x47')+'http://'+_0x468d1d[_0x31ac('0x48')][_0x31ac('0x27')]+'/reset/'+_0x3e015b+'\x0a\x0a'+_0x31ac('0x49')});})[_0x31ac('0xd')](function(){_0x54eb05['status'](0xc8)['send']({'message':_0x31ac('0x4a')});})[_0x31ac('0x1f')](function(_0x212d65){return handleError(_0x54eb05,0x1f4,_0x212d65);});};exports['reset']=function(_0x1dbfb1,_0x1d18a5,_0x162082){var _0x42ea14;return db[_0x31ac('0x3f')][_0x31ac('0x21')]({'where':{'resetPasswordToken':_0x1dbfb1[_0x31ac('0x4b')][_0x31ac('0x4c')],'resetPasswordExpires':{'$gt':Date[_0x31ac('0x44')]()}}})[_0x31ac('0xd')](function(_0x425718){_0x42ea14=_0x425718;if(!_0x42ea14){throw new Error(_0x31ac('0x4d'));}return db['Setting']['findOne']({'attributes':['id',_0x31ac('0x4e')]});})['then'](function(_0x4512ed){return checkPasswordPattern(_0x4512ed,_0x1dbfb1[_0x31ac('0x39')][_0x31ac('0xe')],_0x4512ed[_0x31ac('0x4e')]);})[_0x31ac('0xd')](function(){_0x42ea14['password']=_0x1dbfb1['body'][_0x31ac('0xe')];_0x42ea14[_0x31ac('0x42')]=null;_0x42ea14[_0x31ac('0x43')]=null;return _0x42ea14[_0x31ac('0x45')]();})[_0x31ac('0xd')](function(){_0x1d18a5[_0x31ac('0x33')](0xc8)[_0x31ac('0x34')]({'message':_0x31ac('0x4f')});})[_0x31ac('0x1f')](function(_0x4ab1d7){return handleError(_0x1d18a5,0x1f4,_0x4ab1d7);});};passport[_0x31ac('0x50')](new LocalStrategy({'usernameField':_0x31ac('0x17'),'passwordField':_0x31ac('0xe')},function(_0x2342c9,_0x3f769e,_0x463c79){return localAuthenticate(db[_0x31ac('0x3f')],_0x2342c9,_0x3f769e,_0x463c79);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 11e85ac..4824f0e 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 _0x19ef=['forgot','express','Router','post','login','/forgot'];(function(_0xb60dba,_0xc37d23){var _0x2cd16a=function(_0x1558ae){while(--_0x1558ae){_0xb60dba['push'](_0xb60dba['shift']());}};_0x2cd16a(++_0xc37d23);}(_0x19ef,0x9d));var _0xf19e=function(_0x9bb4e1,_0x3870c8){_0x9bb4e1=_0x9bb4e1-0x0;var _0x38b73e=_0x19ef[_0x9bb4e1];return _0x38b73e;};'use strict';var express=require(_0xf19e('0x0'));var router=express[_0xf19e('0x1')]();var controller=require('./authLocal.controller');router[_0xf19e('0x2')]('/',controller[_0xf19e('0x3')]);router['post'](_0xf19e('0x4'),controller[_0xf19e('0x5')]);router[_0xf19e('0x2')]('/reset/:token',controller['reset']);module['exports']=router; \ No newline at end of file +var _0xd442=['/forgot','forgot','exports','express','Router','./authLocal.controller','post','login'];(function(_0x3a0863,_0x4cd5ef){var _0x85c557=function(_0x3011cb){while(--_0x3011cb){_0x3a0863['push'](_0x3a0863['shift']());}};_0x85c557(++_0x4cd5ef);}(_0xd442,0x183));var _0x2d44=function(_0x36da02,_0x483cd8){_0x36da02=_0x36da02-0x0;var _0x207e0a=_0xd442[_0x36da02];return _0x207e0a;};'use strict';var express=require(_0x2d44('0x0'));var router=express[_0x2d44('0x1')]();var controller=require(_0x2d44('0x2'));router[_0x2d44('0x3')]('/',controller[_0x2d44('0x4')]);router[_0x2d44('0x3')](_0x2d44('0x5'),controller[_0x2d44('0x6')]);router[_0x2d44('0x3')]('/reset/:token',controller['reset']);module[_0x2d44('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 19b609a..c09147b 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 _0xf766=['BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x467b5d,_0x22ca71){var _0x3a64da=function(_0x2709b7){while(--_0x2709b7){_0x467b5d['push'](_0x467b5d['shift']());}};_0x3a64da(++_0x22ca71);}(_0xf766,0xac));var _0x6f76=function(_0xfca0bf,_0x8ac9f9){_0xfca0bf=_0xfca0bf-0x0;var _0xc72568=_0xf766[_0xfca0bf];return _0xc72568;};'use strict';var Sequelize=require(_0x6f76('0x0'));module[_0x6f76('0x1')]={'name':{'type':Sequelize[_0x6f76('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6f76('0x2')]},'status':{'type':Sequelize[_0x6f76('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x6f76('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0xdabb=['BOOLEAN','INTEGER','sequelize','STRING'];(function(_0x559e49,_0x2096a9){var _0x7d02=function(_0x41d6ba){while(--_0x41d6ba){_0x559e49['push'](_0x559e49['shift']());}};_0x7d02(++_0x2096a9);}(_0xdabb,0x12e));var _0xbdab=function(_0x43236e,_0x430223){_0x43236e=_0x43236e-0x0;var _0x568711=_0xdabb[_0x43236e];return _0x568711;};'use strict';var Sequelize=require(_0xbdab('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0xbdab('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xbdab('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xbdab('0x3')],'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 1eb7eac..4335414 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 _0x8ce2=['papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','end','json','offset','limit','reject','save','update','error','stack','name','send','index','Automation','rawAttributes','fieldName','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','options','count','includeAll','include','findAll','then','params','intersection','catch','create','body','destroy','find','addConditions','ids','omit','findOne','Condition','getConditions','addActions','Action','getActions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','querystring'];(function(_0x5e202e,_0x1bf6ec){var _0x4777ad=function(_0x4332f2){while(--_0x4332f2){_0x5e202e['push'](_0x5e202e['shift']());}};_0x4777ad(++_0x1bf6ec);}(_0x8ce2,0x1c6));var _0x28ce=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x8ce2[_0x47b58b];return _0x46bebe;};'use strict';var pdf=require(_0x28ce('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x28ce('0x1'));var zipdir=require(_0x28ce('0x2'));var jsonpatch=require(_0x28ce('0x3'));var rp=require(_0x28ce('0x4'));var moment=require(_0x28ce('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x28ce('0x6'));var util=require(_0x28ce('0x7'));var path=require(_0x28ce('0x8'));var sox=require('sox');var csv=require(_0x28ce('0x9'));var ejs=require(_0x28ce('0xa'));var fs=require('fs');var _=require(_0x28ce('0xb'));var squel=require(_0x28ce('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x28ce('0x9'));var querystring=require(_0x28ce('0xd'));var Papa=require(_0x28ce('0xe'));var Redis=require('ioredis');var authService=require(_0x28ce('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x28ce('0x10'));var hardwareService=require(_0x28ce('0x11'));var logger=require('../../config/logger')(_0x28ce('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x28ce('0x13'))['db'];function respondWithStatusCode(_0xf88d5,_0x41590c){_0x41590c=_0x41590c||0xcc;return function(_0x4f298a){if(_0x4f298a){return _0xf88d5[_0x28ce('0x14')](_0x41590c);}return _0xf88d5[_0x28ce('0x15')](_0x41590c)[_0x28ce('0x16')]();};}function respondWithResult(_0x2ee968,_0x1bdc6e){_0x1bdc6e=_0x1bdc6e||0xc8;return function(_0x336955){if(_0x336955){return _0x2ee968[_0x28ce('0x15')](_0x1bdc6e)[_0x28ce('0x17')](_0x336955);}};}function respondWithFilteredResult(_0x4c88a9,_0x266946){return function(_0x524abc){if(_0x524abc){var _0x15049d=_0x524abc['count'],_0xbd607c=_0x266946['offset'],_0x1342e5=_0x266946[_0x28ce('0x18')]+_0x266946[_0x28ce('0x19')],_0x5bdc42;if(_0x1342e5>=_0x15049d){_0x1342e5=_0x15049d;_0x5bdc42=0xc8;}else{_0x5bdc42=0xce;}_0x4c88a9[_0x28ce('0x15')](_0x5bdc42);return _0x4c88a9['set']('Content-Range',_0xbd607c+'-'+_0x1342e5+'/'+_0x15049d)['json'](_0x524abc);}return null;};}function patchUpdates(_0x35dd81){return function(_0x3e5a15){try{jsonpatch['apply'](_0x3e5a15,_0x35dd81,!![]);}catch(_0x207747){return BPromise[_0x28ce('0x1a')](_0x207747);}return _0x3e5a15[_0x28ce('0x1b')]();};}function saveUpdates(_0x3cae6b,_0x595c7c){return function(_0x8db703){if(_0x8db703){return _0x8db703[_0x28ce('0x1c')](_0x3cae6b)['then'](function(_0x389796){return _0x389796;});}return null;};}function removeEntity(_0x24fdaa,_0x1b1dc2){return function(_0x503ec1){if(_0x503ec1){return _0x503ec1['destroy']()['then'](function(){_0x24fdaa['status'](0xcc)[_0x28ce('0x16')]();});}};}function handleEntityNotFound(_0x3b1834,_0x412b50){return function(_0x43cf12){if(!_0x43cf12){_0x3b1834[_0x28ce('0x14')](0x194);}return _0x43cf12;};}function handleError(_0x3ff376,_0x3c89e4){_0x3c89e4=_0x3c89e4||0x1f4;return function(_0x3aff14){logger[_0x28ce('0x1d')](_0x3aff14[_0x28ce('0x1e')]);if(_0x3aff14[_0x28ce('0x1f')]){delete _0x3aff14[_0x28ce('0x1f')];}_0x3ff376[_0x28ce('0x15')](_0x3c89e4)[_0x28ce('0x20')](_0x3aff14);};}exports[_0x28ce('0x21')]=function(_0x5252ad,_0x5e6ec4){var _0x42855c={},_0x181264={},_0x50e8c7={'count':0x0,'rows':[]};var _0x2a87d9=_['map'](db[_0x28ce('0x22')][_0x28ce('0x23')],function(_0x24d201){return{'name':_0x24d201[_0x28ce('0x24')],'type':_0x24d201['type'][_0x28ce('0x25')]};});_0x181264[_0x28ce('0x26')]=_['map'](_0x2a87d9,'name');_0x181264[_0x28ce('0x27')]=_[_0x28ce('0x28')](_0x5252ad[_0x28ce('0x27')]);_0x181264[_0x28ce('0x29')]=_['intersection'](_0x181264[_0x28ce('0x26')],_0x181264[_0x28ce('0x27')]);_0x42855c['attributes']=_['intersection'](_0x181264[_0x28ce('0x26')],qs[_0x28ce('0x2a')](_0x5252ad[_0x28ce('0x27')][_0x28ce('0x2a')]));_0x42855c[_0x28ce('0x2b')]=_0x42855c[_0x28ce('0x2b')][_0x28ce('0x2c')]?_0x42855c[_0x28ce('0x2b')]:_0x181264[_0x28ce('0x26')];if(!_0x5252ad[_0x28ce('0x27')][_0x28ce('0x2d')](_0x28ce('0x2e'))){_0x42855c[_0x28ce('0x19')]=qs[_0x28ce('0x19')](_0x5252ad[_0x28ce('0x27')][_0x28ce('0x19')]);_0x42855c[_0x28ce('0x18')]=qs['offset'](_0x5252ad[_0x28ce('0x27')]['offset']);}_0x42855c[_0x28ce('0x2f')]=qs[_0x28ce('0x30')](_0x5252ad[_0x28ce('0x27')][_0x28ce('0x30')]);_0x42855c[_0x28ce('0x31')]=qs['filters'](_[_0x28ce('0x32')](_0x5252ad[_0x28ce('0x27')],_0x181264['filters']),_0x2a87d9);if(_0x5252ad['query'][_0x28ce('0x33')]){_0x42855c[_0x28ce('0x31')]=_[_0x28ce('0x34')](_0x42855c[_0x28ce('0x31')],{'$or':_[_0x28ce('0x35')](_0x2a87d9,function(_0x505b25){if(_0x505b25[_0x28ce('0x36')]!==_0x28ce('0x37')){var _0x45a66c={};_0x45a66c[_0x505b25[_0x28ce('0x1f')]]={'$like':'%'+_0x5252ad[_0x28ce('0x27')]['filter']+'%'};return _0x45a66c;}})});}_0x42855c=_[_0x28ce('0x34')]({},_0x42855c,_0x5252ad[_0x28ce('0x38')]);var _0x309398={'where':_0x42855c[_0x28ce('0x31')]};return db[_0x28ce('0x22')][_0x28ce('0x39')](_0x309398)['then'](function(_0x2bce60){_0x50e8c7['count']=_0x2bce60;if(_0x5252ad[_0x28ce('0x27')][_0x28ce('0x3a')]){_0x42855c[_0x28ce('0x3b')]=[{'all':!![]}];}return db[_0x28ce('0x22')][_0x28ce('0x3c')](_0x42855c);})[_0x28ce('0x3d')](function(_0x32c126){_0x50e8c7['rows']=_0x32c126;return _0x50e8c7;})[_0x28ce('0x3d')](respondWithFilteredResult(_0x5e6ec4,_0x42855c))['catch'](handleError(_0x5e6ec4,null));};exports['show']=function(_0x503dc3,_0x4b2807){var _0x9797d3={'raw':![],'where':{'id':_0x503dc3[_0x28ce('0x3e')]['id']}},_0x403c54={};_0x403c54['model']=_[_0x28ce('0x28')](db['Automation'][_0x28ce('0x23')]);_0x403c54[_0x28ce('0x27')]=_[_0x28ce('0x28')](_0x503dc3[_0x28ce('0x27')]);_0x403c54['filters']=_['intersection'](_0x403c54[_0x28ce('0x26')],_0x403c54[_0x28ce('0x27')]);_0x9797d3['attributes']=_[_0x28ce('0x3f')](_0x403c54[_0x28ce('0x26')],qs[_0x28ce('0x2a')](_0x503dc3[_0x28ce('0x27')][_0x28ce('0x2a')]));_0x9797d3[_0x28ce('0x2b')]=_0x9797d3['attributes'][_0x28ce('0x2c')]?_0x9797d3[_0x28ce('0x2b')]:_0x403c54[_0x28ce('0x26')];if(_0x503dc3[_0x28ce('0x27')][_0x28ce('0x3a')]){_0x9797d3[_0x28ce('0x3b')]=[{'all':!![]}];}_0x9797d3=_[_0x28ce('0x34')]({},_0x9797d3,_0x503dc3[_0x28ce('0x38')]);return db['Automation']['find'](_0x9797d3)[_0x28ce('0x3d')](handleEntityNotFound(_0x4b2807,null))[_0x28ce('0x3d')](respondWithResult(_0x4b2807,null))[_0x28ce('0x40')](handleError(_0x4b2807,null));};exports[_0x28ce('0x41')]=function(_0xd07c1e,_0x1e15b9){return db[_0x28ce('0x22')][_0x28ce('0x41')](_0xd07c1e[_0x28ce('0x42')],{})[_0x28ce('0x3d')](respondWithResult(_0x1e15b9,0xc9))[_0x28ce('0x40')](handleError(_0x1e15b9,null));};exports[_0x28ce('0x1c')]=function(_0x1e155d,_0x822bc1){if(_0x1e155d[_0x28ce('0x42')]['id']){delete _0x1e155d[_0x28ce('0x42')]['id'];}return db[_0x28ce('0x22')]['find']({'where':{'id':_0x1e155d[_0x28ce('0x3e')]['id']}})[_0x28ce('0x3d')](handleEntityNotFound(_0x822bc1,null))[_0x28ce('0x3d')](saveUpdates(_0x1e155d[_0x28ce('0x42')],null))[_0x28ce('0x3d')](respondWithResult(_0x822bc1,null))[_0x28ce('0x40')](handleError(_0x822bc1,null));};exports[_0x28ce('0x43')]=function(_0x2b95f8,_0x538dc7){return db[_0x28ce('0x22')][_0x28ce('0x44')]({'where':{'id':_0x2b95f8[_0x28ce('0x3e')]['id']}})[_0x28ce('0x3d')](handleEntityNotFound(_0x538dc7,null))[_0x28ce('0x3d')](removeEntity(_0x538dc7,null))[_0x28ce('0x40')](handleError(_0x538dc7,null));};exports[_0x28ce('0x45')]=function(_0x1adb0c,_0x18a863,_0x34b391){return db['Condition'][_0x28ce('0x44')]({'where':{'id':_0x1adb0c[_0x28ce('0x3e')]['id']}})[_0x28ce('0x3d')](handleEntityNotFound(_0x18a863,null))[_0x28ce('0x3d')](function(_0x19727d){if(_0x19727d){return _0x19727d[_0x28ce('0x45')](_0x1adb0c[_0x28ce('0x42')][_0x28ce('0x46')],_[_0x28ce('0x47')](_0x1adb0c['body'],[_0x28ce('0x46'),'id'])||{});}})['then'](respondWithResult(_0x18a863,null))[_0x28ce('0x40')](handleError(_0x18a863,null));};exports['getConditions']=function(_0x28051c,_0x305a99,_0x3c7d6f){var _0x3abee4={};var _0x17d05a={};var _0x450db9;var _0x876ac5;return db['Automation'][_0x28ce('0x48')]({'where':{'id':_0x28051c[_0x28ce('0x3e')]['id']}})[_0x28ce('0x3d')](handleEntityNotFound(_0x305a99,null))[_0x28ce('0x3d')](function(_0x5637dc){if(_0x5637dc){_0x450db9=_0x5637dc;_0x17d05a[_0x28ce('0x26')]=_[_0x28ce('0x28')](db[_0x28ce('0x49')][_0x28ce('0x23')]);_0x17d05a[_0x28ce('0x27')]=_['keys'](_0x28051c[_0x28ce('0x27')]);_0x17d05a[_0x28ce('0x29')]=_['intersection'](_0x17d05a[_0x28ce('0x26')],_0x17d05a[_0x28ce('0x27')]);_0x3abee4['attributes']=_['intersection'](_0x17d05a[_0x28ce('0x26')],qs[_0x28ce('0x2a')](_0x28051c[_0x28ce('0x27')][_0x28ce('0x2a')]));_0x3abee4[_0x28ce('0x2b')]=_0x3abee4[_0x28ce('0x2b')][_0x28ce('0x2c')]?_0x3abee4['attributes']:_0x17d05a[_0x28ce('0x26')];_0x3abee4[_0x28ce('0x2f')]=qs[_0x28ce('0x30')](_0x28051c[_0x28ce('0x27')][_0x28ce('0x30')]);_0x3abee4[_0x28ce('0x31')]=qs[_0x28ce('0x29')](_[_0x28ce('0x32')](_0x28051c[_0x28ce('0x27')],_0x17d05a['filters']));if(_0x28051c[_0x28ce('0x27')][_0x28ce('0x33')]){_0x3abee4[_0x28ce('0x31')]=_[_0x28ce('0x34')](_0x3abee4[_0x28ce('0x31')],{'$or':_['map'](_0x3abee4[_0x28ce('0x2b')],function(_0x1f25e4){var _0xceb4d6={};_0xceb4d6[_0x1f25e4]={'$like':'%'+_0x28051c[_0x28ce('0x27')]['filter']+'%'};return _0xceb4d6;})});}_0x3abee4=_['merge']({},_0x3abee4,_0x28051c['options']);return _0x450db9[_0x28ce('0x4a')](_0x3abee4);}})['then'](function(_0x244165){if(_0x244165){_0x876ac5=_0x244165[_0x28ce('0x2c')];if(!_0x28051c[_0x28ce('0x27')][_0x28ce('0x2d')](_0x28ce('0x2e'))){_0x3abee4[_0x28ce('0x19')]=qs[_0x28ce('0x19')](_0x28051c[_0x28ce('0x27')][_0x28ce('0x19')]);_0x3abee4[_0x28ce('0x18')]=qs['offset'](_0x28051c[_0x28ce('0x27')][_0x28ce('0x18')]);}return _0x450db9[_0x28ce('0x4a')](_0x3abee4);}})[_0x28ce('0x3d')](function(_0x4c23e5){if(_0x4c23e5){return _0x4c23e5?{'count':_0x876ac5,'rows':_0x4c23e5}:null;}})[_0x28ce('0x3d')](respondWithResult(_0x305a99,null))['catch'](handleError(_0x305a99,null));};exports[_0x28ce('0x4b')]=function(_0x2f353e,_0x21d67d,_0x3564a5){return db[_0x28ce('0x4c')][_0x28ce('0x44')]({'where':{'id':_0x2f353e['params']['id']}})[_0x28ce('0x3d')](handleEntityNotFound(_0x21d67d,null))[_0x28ce('0x3d')](function(_0x37666e){if(_0x37666e){return _0x37666e[_0x28ce('0x4b')](_0x2f353e[_0x28ce('0x42')][_0x28ce('0x46')],_['omit'](_0x2f353e['body'],['ids','id'])||{});}})[_0x28ce('0x3d')](respondWithResult(_0x21d67d,null))['catch'](handleError(_0x21d67d,null));};exports[_0x28ce('0x4d')]=function(_0x35b7de,_0x29337c,_0xa64b6f){var _0x505d9a={};var _0x30ce23={};var _0x489dd6;var _0x35851d;return db[_0x28ce('0x22')][_0x28ce('0x48')]({'where':{'id':_0x35b7de[_0x28ce('0x3e')]['id']}})['then'](handleEntityNotFound(_0x29337c,null))[_0x28ce('0x3d')](function(_0x10083c){if(_0x10083c){_0x489dd6=_0x10083c;_0x30ce23[_0x28ce('0x26')]=_[_0x28ce('0x28')](db[_0x28ce('0x4c')][_0x28ce('0x23')]);_0x30ce23[_0x28ce('0x27')]=_[_0x28ce('0x28')](_0x35b7de[_0x28ce('0x27')]);_0x30ce23[_0x28ce('0x29')]=_[_0x28ce('0x3f')](_0x30ce23[_0x28ce('0x26')],_0x30ce23[_0x28ce('0x27')]);_0x505d9a[_0x28ce('0x2b')]=_['intersection'](_0x30ce23[_0x28ce('0x26')],qs['fields'](_0x35b7de[_0x28ce('0x27')][_0x28ce('0x2a')]));_0x505d9a[_0x28ce('0x2b')]=_0x505d9a[_0x28ce('0x2b')][_0x28ce('0x2c')]?_0x505d9a[_0x28ce('0x2b')]:_0x30ce23['model'];_0x505d9a['order']=qs[_0x28ce('0x30')](_0x35b7de['query'][_0x28ce('0x30')]);_0x505d9a['where']=qs['filters'](_['pick'](_0x35b7de['query'],_0x30ce23[_0x28ce('0x29')]));if(_0x35b7de[_0x28ce('0x27')][_0x28ce('0x33')]){_0x505d9a[_0x28ce('0x31')]=_[_0x28ce('0x34')](_0x505d9a[_0x28ce('0x31')],{'$or':_['map'](_0x505d9a[_0x28ce('0x2b')],function(_0x291d91){var _0x303a66={};_0x303a66[_0x291d91]={'$like':'%'+_0x35b7de[_0x28ce('0x27')][_0x28ce('0x33')]+'%'};return _0x303a66;})});}_0x505d9a=_['merge']({},_0x505d9a,_0x35b7de[_0x28ce('0x38')]);return _0x489dd6[_0x28ce('0x4d')](_0x505d9a);}})[_0x28ce('0x3d')](function(_0x1fb633){if(_0x1fb633){_0x35851d=_0x1fb633[_0x28ce('0x2c')];if(!_0x35b7de[_0x28ce('0x27')]['hasOwnProperty'](_0x28ce('0x2e'))){_0x505d9a[_0x28ce('0x19')]=qs['limit'](_0x35b7de[_0x28ce('0x27')][_0x28ce('0x19')]);_0x505d9a[_0x28ce('0x18')]=qs[_0x28ce('0x18')](_0x35b7de['query'][_0x28ce('0x18')]);}return _0x489dd6[_0x28ce('0x4d')](_0x505d9a);}})[_0x28ce('0x3d')](function(_0x2a145f){if(_0x2a145f){return _0x2a145f?{'count':_0x35851d,'rows':_0x2a145f}:null;}})[_0x28ce('0x3d')](respondWithResult(_0x29337c,null))[_0x28ce('0x40')](handleError(_0x29337c,null));}; \ No newline at end of file +var _0x870e=['filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','findAll','params','include','find','catch','create','body','destroy','Condition','addConditions','ids','getConditions','findOne','nolimit','addActions','Action','getActions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','set','Content-Range','reject','save','update','then','error','stack','name','send','Automation','rawAttributes','fieldName','type','key','model','keys'];(function(_0x3e6194,_0xf3b44e){var _0x7ceb16=function(_0xfb93ac){while(--_0xfb93ac){_0x3e6194['push'](_0x3e6194['shift']());}};_0x7ceb16(++_0xf3b44e);}(_0x870e,0x11b));var _0xe870=function(_0xaf469a,_0x1ec7c6){_0xaf469a=_0xaf469a-0x0;var _0x26bca0=_0x870e[_0xaf469a];return _0x26bca0;};'use strict';var pdf=require(_0xe870('0x0'));var emlformat=require(_0xe870('0x1'));var rimraf=require(_0xe870('0x2'));var zipdir=require(_0xe870('0x3'));var jsonpatch=require(_0xe870('0x4'));var rp=require(_0xe870('0x5'));var moment=require(_0xe870('0x6'));var BPromise=require(_0xe870('0x7'));var Mustache=require(_0xe870('0x8'));var util=require(_0xe870('0x9'));var path=require(_0xe870('0xa'));var sox=require('sox');var csv=require(_0xe870('0xb'));var ejs=require(_0xe870('0xc'));var fs=require('fs');var _=require(_0xe870('0xd'));var squel=require(_0xe870('0xe'));var crypto=require(_0xe870('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xe870('0x10'));var toCsv=require('to-csv');var querystring=require(_0xe870('0x11'));var Papa=require(_0xe870('0x12'));var Redis=require(_0xe870('0x13'));var authService=require(_0xe870('0x14'));var qs=require(_0xe870('0x15'));var as=require(_0xe870('0x16'));var hardwareService=require(_0xe870('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0xe870('0x18'));var config=require(_0xe870('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16b052,_0xbb2969){_0xbb2969=_0xbb2969||0xcc;return function(_0xdfea51){if(_0xdfea51){return _0x16b052[_0xe870('0x1a')](_0xbb2969);}return _0x16b052[_0xe870('0x1b')](_0xbb2969)[_0xe870('0x1c')]();};}function respondWithResult(_0x13a6cf,_0x4cdff6){_0x4cdff6=_0x4cdff6||0xc8;return function(_0x58f2b8){if(_0x58f2b8){return _0x13a6cf[_0xe870('0x1b')](_0x4cdff6)['json'](_0x58f2b8);}};}function respondWithFilteredResult(_0x6cd369,_0x30ae11){return function(_0x40564e){if(_0x40564e){var _0x40ba0b=_0x40564e[_0xe870('0x1d')],_0x30e2ae=_0x30ae11[_0xe870('0x1e')],_0x3ee983=_0x30ae11[_0xe870('0x1e')]+_0x30ae11[_0xe870('0x1f')],_0x3c94cc;if(_0x3ee983>=_0x40ba0b){_0x3ee983=_0x40ba0b;_0x3c94cc=0xc8;}else{_0x3c94cc=0xce;}_0x6cd369['status'](_0x3c94cc);return _0x6cd369[_0xe870('0x20')](_0xe870('0x21'),_0x30e2ae+'-'+_0x3ee983+'/'+_0x40ba0b)['json'](_0x40564e);}return null;};}function patchUpdates(_0x49d714){return function(_0x375299){try{jsonpatch['apply'](_0x375299,_0x49d714,!![]);}catch(_0x2ca07e){return BPromise[_0xe870('0x22')](_0x2ca07e);}return _0x375299[_0xe870('0x23')]();};}function saveUpdates(_0x3fbca8,_0x14d00e){return function(_0x52e749){if(_0x52e749){return _0x52e749[_0xe870('0x24')](_0x3fbca8)[_0xe870('0x25')](function(_0x4599c6){return _0x4599c6;});}return null;};}function removeEntity(_0x5cad2b,_0x45050e){return function(_0x2f5034){if(_0x2f5034){return _0x2f5034['destroy']()[_0xe870('0x25')](function(){_0x5cad2b[_0xe870('0x1b')](0xcc)[_0xe870('0x1c')]();});}};}function handleEntityNotFound(_0x375655,_0x27fff9){return function(_0x41c7ca){if(!_0x41c7ca){_0x375655[_0xe870('0x1a')](0x194);}return _0x41c7ca;};}function handleError(_0x46d7ea,_0x2fe97b){_0x2fe97b=_0x2fe97b||0x1f4;return function(_0x1e0b01){logger[_0xe870('0x26')](_0x1e0b01[_0xe870('0x27')]);if(_0x1e0b01['name']){delete _0x1e0b01[_0xe870('0x28')];}_0x46d7ea[_0xe870('0x1b')](_0x2fe97b)[_0xe870('0x29')](_0x1e0b01);};}exports['index']=function(_0x1c0f92,_0x25aa66){var _0x115659={},_0x527a57={},_0x27ad5d={'count':0x0,'rows':[]};var _0x1dbbe7=_['map'](db[_0xe870('0x2a')][_0xe870('0x2b')],function(_0x3c4956){return{'name':_0x3c4956[_0xe870('0x2c')],'type':_0x3c4956[_0xe870('0x2d')][_0xe870('0x2e')]};});_0x527a57[_0xe870('0x2f')]=_['map'](_0x1dbbe7,_0xe870('0x28'));_0x527a57['query']=_[_0xe870('0x30')](_0x1c0f92['query']);_0x527a57[_0xe870('0x31')]=_[_0xe870('0x32')](_0x527a57['model'],_0x527a57[_0xe870('0x33')]);_0x115659[_0xe870('0x34')]=_[_0xe870('0x32')](_0x527a57['model'],qs['fields'](_0x1c0f92[_0xe870('0x33')][_0xe870('0x35')]));_0x115659[_0xe870('0x34')]=_0x115659[_0xe870('0x34')][_0xe870('0x36')]?_0x115659[_0xe870('0x34')]:_0x527a57[_0xe870('0x2f')];if(!_0x1c0f92[_0xe870('0x33')][_0xe870('0x37')]('nolimit')){_0x115659[_0xe870('0x1f')]=qs[_0xe870('0x1f')](_0x1c0f92[_0xe870('0x33')][_0xe870('0x1f')]);_0x115659['offset']=qs[_0xe870('0x1e')](_0x1c0f92[_0xe870('0x33')][_0xe870('0x1e')]);}_0x115659[_0xe870('0x38')]=qs[_0xe870('0x39')](_0x1c0f92[_0xe870('0x33')]['sort']);_0x115659[_0xe870('0x3a')]=qs[_0xe870('0x31')](_[_0xe870('0x3b')](_0x1c0f92[_0xe870('0x33')],_0x527a57[_0xe870('0x31')]),_0x1dbbe7);if(_0x1c0f92[_0xe870('0x33')][_0xe870('0x3c')]){_0x115659['where']=_[_0xe870('0x3d')](_0x115659[_0xe870('0x3a')],{'$or':_[_0xe870('0x3e')](_0x1dbbe7,function(_0x2d9875){if(_0x2d9875[_0xe870('0x2d')]!==_0xe870('0x3f')){var _0x4cf587={};_0x4cf587[_0x2d9875[_0xe870('0x28')]]={'$like':'%'+_0x1c0f92['query'][_0xe870('0x3c')]+'%'};return _0x4cf587;}})});}_0x115659=_[_0xe870('0x3d')]({},_0x115659,_0x1c0f92[_0xe870('0x40')]);var _0x107ab5={'where':_0x115659[_0xe870('0x3a')]};return db[_0xe870('0x2a')][_0xe870('0x1d')](_0x107ab5)[_0xe870('0x25')](function(_0x5aad7f){_0x27ad5d[_0xe870('0x1d')]=_0x5aad7f;if(_0x1c0f92[_0xe870('0x33')][_0xe870('0x41')]){_0x115659['include']=[{'all':!![]}];}return db[_0xe870('0x2a')][_0xe870('0x42')](_0x115659);})[_0xe870('0x25')](function(_0x128dcd){_0x27ad5d['rows']=_0x128dcd;return _0x27ad5d;})['then'](respondWithFilteredResult(_0x25aa66,_0x115659))['catch'](handleError(_0x25aa66,null));};exports['show']=function(_0x46594c,_0x4a2fe1){var _0x53e433={'raw':![],'where':{'id':_0x46594c[_0xe870('0x43')]['id']}},_0x2813d2={};_0x2813d2['model']=_['keys'](db[_0xe870('0x2a')][_0xe870('0x2b')]);_0x2813d2['query']=_[_0xe870('0x30')](_0x46594c[_0xe870('0x33')]);_0x2813d2[_0xe870('0x31')]=_[_0xe870('0x32')](_0x2813d2['model'],_0x2813d2['query']);_0x53e433[_0xe870('0x34')]=_[_0xe870('0x32')](_0x2813d2[_0xe870('0x2f')],qs[_0xe870('0x35')](_0x46594c[_0xe870('0x33')][_0xe870('0x35')]));_0x53e433[_0xe870('0x34')]=_0x53e433[_0xe870('0x34')][_0xe870('0x36')]?_0x53e433['attributes']:_0x2813d2[_0xe870('0x2f')];if(_0x46594c[_0xe870('0x33')][_0xe870('0x41')]){_0x53e433[_0xe870('0x44')]=[{'all':!![]}];}_0x53e433=_[_0xe870('0x3d')]({},_0x53e433,_0x46594c['options']);return db[_0xe870('0x2a')][_0xe870('0x45')](_0x53e433)['then'](handleEntityNotFound(_0x4a2fe1,null))[_0xe870('0x25')](respondWithResult(_0x4a2fe1,null))[_0xe870('0x46')](handleError(_0x4a2fe1,null));};exports[_0xe870('0x47')]=function(_0x26dc4e,_0x9a524){return db[_0xe870('0x2a')]['create'](_0x26dc4e['body'],{})[_0xe870('0x25')](respondWithResult(_0x9a524,0xc9))[_0xe870('0x46')](handleError(_0x9a524,null));};exports[_0xe870('0x24')]=function(_0x5c29b6,_0x11551a){if(_0x5c29b6[_0xe870('0x48')]['id']){delete _0x5c29b6[_0xe870('0x48')]['id'];}return db[_0xe870('0x2a')][_0xe870('0x45')]({'where':{'id':_0x5c29b6[_0xe870('0x43')]['id']}})['then'](handleEntityNotFound(_0x11551a,null))[_0xe870('0x25')](saveUpdates(_0x5c29b6[_0xe870('0x48')],null))[_0xe870('0x25')](respondWithResult(_0x11551a,null))[_0xe870('0x46')](handleError(_0x11551a,null));};exports[_0xe870('0x49')]=function(_0x3e4c96,_0x10b45b){return db[_0xe870('0x2a')]['find']({'where':{'id':_0x3e4c96['params']['id']}})[_0xe870('0x25')](handleEntityNotFound(_0x10b45b,null))[_0xe870('0x25')](removeEntity(_0x10b45b,null))[_0xe870('0x46')](handleError(_0x10b45b,null));};exports['addConditions']=function(_0xb10092,_0x401633,_0xab00d){return db[_0xe870('0x4a')]['find']({'where':{'id':_0xb10092['params']['id']}})['then'](handleEntityNotFound(_0x401633,null))[_0xe870('0x25')](function(_0x32ddd5){if(_0x32ddd5){return _0x32ddd5[_0xe870('0x4b')](_0xb10092[_0xe870('0x48')][_0xe870('0x4c')],_['omit'](_0xb10092[_0xe870('0x48')],['ids','id'])||{});}})[_0xe870('0x25')](respondWithResult(_0x401633,null))[_0xe870('0x46')](handleError(_0x401633,null));};exports[_0xe870('0x4d')]=function(_0x23ee2e,_0x575bc9,_0x25f84d){var _0x1d6345={};var _0x3d946e={};var _0x592c0a;var _0x3ce6ef;return db['Automation'][_0xe870('0x4e')]({'where':{'id':_0x23ee2e[_0xe870('0x43')]['id']}})[_0xe870('0x25')](handleEntityNotFound(_0x575bc9,null))[_0xe870('0x25')](function(_0x2d8c7c){if(_0x2d8c7c){_0x592c0a=_0x2d8c7c;_0x3d946e[_0xe870('0x2f')]=_[_0xe870('0x30')](db['Condition'][_0xe870('0x2b')]);_0x3d946e[_0xe870('0x33')]=_[_0xe870('0x30')](_0x23ee2e[_0xe870('0x33')]);_0x3d946e[_0xe870('0x31')]=_[_0xe870('0x32')](_0x3d946e[_0xe870('0x2f')],_0x3d946e[_0xe870('0x33')]);_0x1d6345[_0xe870('0x34')]=_[_0xe870('0x32')](_0x3d946e['model'],qs[_0xe870('0x35')](_0x23ee2e[_0xe870('0x33')][_0xe870('0x35')]));_0x1d6345['attributes']=_0x1d6345['attributes'][_0xe870('0x36')]?_0x1d6345[_0xe870('0x34')]:_0x3d946e[_0xe870('0x2f')];_0x1d6345['order']=qs['sort'](_0x23ee2e[_0xe870('0x33')]['sort']);_0x1d6345[_0xe870('0x3a')]=qs['filters'](_[_0xe870('0x3b')](_0x23ee2e[_0xe870('0x33')],_0x3d946e[_0xe870('0x31')]));if(_0x23ee2e[_0xe870('0x33')][_0xe870('0x3c')]){_0x1d6345[_0xe870('0x3a')]=_[_0xe870('0x3d')](_0x1d6345['where'],{'$or':_[_0xe870('0x3e')](_0x1d6345[_0xe870('0x34')],function(_0x591a22){var _0x2b406f={};_0x2b406f[_0x591a22]={'$like':'%'+_0x23ee2e[_0xe870('0x33')][_0xe870('0x3c')]+'%'};return _0x2b406f;})});}_0x1d6345=_[_0xe870('0x3d')]({},_0x1d6345,_0x23ee2e['options']);return _0x592c0a[_0xe870('0x4d')](_0x1d6345);}})[_0xe870('0x25')](function(_0xe957cc){if(_0xe957cc){_0x3ce6ef=_0xe957cc[_0xe870('0x36')];if(!_0x23ee2e[_0xe870('0x33')]['hasOwnProperty'](_0xe870('0x4f'))){_0x1d6345['limit']=qs[_0xe870('0x1f')](_0x23ee2e[_0xe870('0x33')]['limit']);_0x1d6345[_0xe870('0x1e')]=qs[_0xe870('0x1e')](_0x23ee2e[_0xe870('0x33')]['offset']);}return _0x592c0a[_0xe870('0x4d')](_0x1d6345);}})[_0xe870('0x25')](function(_0x5683a0){if(_0x5683a0){return _0x5683a0?{'count':_0x3ce6ef,'rows':_0x5683a0}:null;}})[_0xe870('0x25')](respondWithResult(_0x575bc9,null))[_0xe870('0x46')](handleError(_0x575bc9,null));};exports[_0xe870('0x50')]=function(_0x30489b,_0x1f80f5,_0x306452){return db[_0xe870('0x51')][_0xe870('0x45')]({'where':{'id':_0x30489b[_0xe870('0x43')]['id']}})[_0xe870('0x25')](handleEntityNotFound(_0x1f80f5,null))[_0xe870('0x25')](function(_0x52ffe1){if(_0x52ffe1){return _0x52ffe1[_0xe870('0x50')](_0x30489b[_0xe870('0x48')][_0xe870('0x4c')],_['omit'](_0x30489b[_0xe870('0x48')],[_0xe870('0x4c'),'id'])||{});}})[_0xe870('0x25')](respondWithResult(_0x1f80f5,null))[_0xe870('0x46')](handleError(_0x1f80f5,null));};exports[_0xe870('0x52')]=function(_0x484e7a,_0x265d4e,_0x24097f){var _0x4fc2a9={};var _0x32595d={};var _0x285128;var _0x2ed628;return db[_0xe870('0x2a')]['findOne']({'where':{'id':_0x484e7a[_0xe870('0x43')]['id']}})[_0xe870('0x25')](handleEntityNotFound(_0x265d4e,null))[_0xe870('0x25')](function(_0x50bb2b){if(_0x50bb2b){_0x285128=_0x50bb2b;_0x32595d[_0xe870('0x2f')]=_['keys'](db[_0xe870('0x51')]['rawAttributes']);_0x32595d[_0xe870('0x33')]=_['keys'](_0x484e7a[_0xe870('0x33')]);_0x32595d[_0xe870('0x31')]=_[_0xe870('0x32')](_0x32595d[_0xe870('0x2f')],_0x32595d[_0xe870('0x33')]);_0x4fc2a9['attributes']=_[_0xe870('0x32')](_0x32595d[_0xe870('0x2f')],qs[_0xe870('0x35')](_0x484e7a[_0xe870('0x33')][_0xe870('0x35')]));_0x4fc2a9[_0xe870('0x34')]=_0x4fc2a9[_0xe870('0x34')]['length']?_0x4fc2a9['attributes']:_0x32595d['model'];_0x4fc2a9[_0xe870('0x38')]=qs[_0xe870('0x39')](_0x484e7a[_0xe870('0x33')][_0xe870('0x39')]);_0x4fc2a9[_0xe870('0x3a')]=qs[_0xe870('0x31')](_[_0xe870('0x3b')](_0x484e7a[_0xe870('0x33')],_0x32595d['filters']));if(_0x484e7a['query'][_0xe870('0x3c')]){_0x4fc2a9[_0xe870('0x3a')]=_['merge'](_0x4fc2a9['where'],{'$or':_[_0xe870('0x3e')](_0x4fc2a9[_0xe870('0x34')],function(_0x513a48){var _0x1a689d={};_0x1a689d[_0x513a48]={'$like':'%'+_0x484e7a[_0xe870('0x33')][_0xe870('0x3c')]+'%'};return _0x1a689d;})});}_0x4fc2a9=_['merge']({},_0x4fc2a9,_0x484e7a[_0xe870('0x40')]);return _0x285128[_0xe870('0x52')](_0x4fc2a9);}})[_0xe870('0x25')](function(_0x1063eb){if(_0x1063eb){_0x2ed628=_0x1063eb[_0xe870('0x36')];if(!_0x484e7a[_0xe870('0x33')][_0xe870('0x37')]('nolimit')){_0x4fc2a9['limit']=qs[_0xe870('0x1f')](_0x484e7a[_0xe870('0x33')][_0xe870('0x1f')]);_0x4fc2a9[_0xe870('0x1e')]=qs[_0xe870('0x1e')](_0x484e7a['query'][_0xe870('0x1e')]);}return _0x285128[_0xe870('0x52')](_0x4fc2a9);}})['then'](function(_0x16f0af){if(_0x16f0af){return _0x16f0af?{'count':_0x2ed628,'rows':_0x16f0af}:null;}})[_0xe870('0x25')](respondWithResult(_0x265d4e,null))[_0xe870('0x46')](handleError(_0x265d4e,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index f3e7af9..8ac746a 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 _0x8093=['tools_automations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./automation.attributes','exports','define','Automation'];(function(_0x4b775b,_0x2aadc6){var _0xf84d39=function(_0x55ac96){while(--_0x55ac96){_0x4b775b['push'](_0x4b775b['shift']());}};_0xf84d39(++_0x2aadc6);}(_0x8093,0xa9));var _0x3809=function(_0x52f1e6,_0xf70489){_0x52f1e6=_0x52f1e6-0x0;var _0x21f104=_0x8093[_0x52f1e6];return _0x21f104;};'use strict';var _=require(_0x3809('0x0'));var util=require(_0x3809('0x1'));var logger=require(_0x3809('0x2'))(_0x3809('0x3'));var moment=require(_0x3809('0x4'));var BPromise=require(_0x3809('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3809('0x6'));var rimraf=require(_0x3809('0x7'));var config=require(_0x3809('0x8'));var attributes=require(_0x3809('0x9'));module[_0x3809('0xa')]=function(_0x17ab0b,_0x29d5dc){return _0x17ab0b[_0x3809('0xb')](_0x3809('0xc'),attributes,{'tableName':_0x3809('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x696b=['request-promise','path','rimraf','../../config/environment','./automation.attributes','define','Automation','lodash','util','../../config/logger','bluebird'];(function(_0x47ce43,_0x34c068){var _0x5ae90f=function(_0x509aee){while(--_0x509aee){_0x47ce43['push'](_0x47ce43['shift']());}};_0x5ae90f(++_0x34c068);}(_0x696b,0xb7));var _0xb696=function(_0x2595e4,_0x2a58c4){_0x2595e4=_0x2595e4-0x0;var _0x142baa=_0x696b[_0x2595e4];return _0x142baa;};'use strict';var _=require(_0xb696('0x0'));var util=require(_0xb696('0x1'));var logger=require(_0xb696('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb696('0x3'));var rp=require(_0xb696('0x4'));var fs=require('fs');var path=require(_0xb696('0x5'));var rimraf=require(_0xb696('0x6'));var config=require(_0xb696('0x7'));var attributes=require(_0xb696('0x8'));module['exports']=function(_0x5cb640,_0x28d5ec){return _0x5cb640[_0xb696('0x9')](_0xb696('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 532ba16..902325f 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 _0x9393=['jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x83487c,_0x1104d8){var _0x25ce18=function(_0x5814dd){while(--_0x5814dd){_0x83487c['push'](_0x83487c['shift']());}};_0x25ce18(++_0x1104d8);}(_0x9393,0xea));var _0x3939=function(_0x4437c9,_0x6b22ae){_0x4437c9=_0x4437c9-0x0;var _0x40d91d=_0x9393[_0x4437c9];return _0x40d91d;};'use strict';var _=require('lodash');var util=require(_0x3939('0x0'));var moment=require(_0x3939('0x1'));var BPromise=require(_0x3939('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3939('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3939('0x4'));var logger=require(_0x3939('0x5'))(_0x3939('0x6'));var config=require(_0x3939('0x7'));var jayson=require(_0x3939('0x8'));var client=jayson[_0x3939('0x9')][_0x3939('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49fd79,_0xf56eed,_0x105095){return new BPromise(function(_0x2386f6,_0x30f998){return client[_0x3939('0xb')](_0x49fd79,_0x105095)[_0x3939('0xc')](function(_0x452e38){logger[_0x3939('0xd')](_0x3939('0xe'),_0xf56eed,_0x3939('0xf'));logger[_0x3939('0x10')]('Automation,\x20%s,\x20%s,\x20%s',_0xf56eed,_0x3939('0xf'),JSON['stringify'](_0x452e38));if(_0x452e38[_0x3939('0x11')]){if(_0x452e38[_0x3939('0x11')][_0x3939('0x12')]===0x1f4){logger['error']('Automation,\x20%s,\x20%s',_0xf56eed,_0x452e38['error'][_0x3939('0x13')]);return _0x30f998(_0x452e38[_0x3939('0x11')][_0x3939('0x13')]);}logger[_0x3939('0x11')](_0x3939('0xe'),_0xf56eed,_0x452e38[_0x3939('0x11')][_0x3939('0x13')]);return _0x2386f6(_0x452e38['error'][_0x3939('0x13')]);}else{logger[_0x3939('0xd')](_0x3939('0xe'),_0xf56eed,'request\x20sent');_0x2386f6(_0x452e38[_0x3939('0x14')][_0x3939('0x13')]);}})[_0x3939('0x15')](function(_0x28eae7){logger[_0x3939('0x11')](_0x3939('0xe'),_0xf56eed,_0x28eae7);_0x30f998(_0x28eae7);});});} \ No newline at end of file +var _0x6670=['request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','message','Automation,\x20%s,\x20%s','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','request','then','info'];(function(_0x21e459,_0x53ebc9){var _0x14853c=function(_0xfe7ff5){while(--_0xfe7ff5){_0x21e459['push'](_0x21e459['shift']());}};_0x14853c(++_0x53ebc9);}(_0x6670,0x16f));var _0x0667=function(_0x5e62c3,_0x11800e){_0x5e62c3=_0x5e62c3-0x0;var _0x54a5e9=_0x6670[_0x5e62c3];return _0x54a5e9;};'use strict';var _=require(_0x0667('0x0'));var util=require('util');var moment=require(_0x0667('0x1'));var BPromise=require(_0x0667('0x2'));var rs=require(_0x0667('0x3'));var fs=require('fs');var Redis=require(_0x0667('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0667('0x5'));var logger=require(_0x0667('0x6'))(_0x0667('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x269f93,_0xc5897f,_0x3352ed){return new BPromise(function(_0x5919b9,_0x1207b0){return client[_0x0667('0x8')](_0x269f93,_0x3352ed)[_0x0667('0x9')](function(_0x1ce65a){logger[_0x0667('0xa')]('Automation,\x20%s,\x20%s',_0xc5897f,_0x0667('0xb'));logger['debug'](_0x0667('0xc'),_0xc5897f,'request\x20sent',JSON[_0x0667('0xd')](_0x1ce65a));if(_0x1ce65a['error']){if(_0x1ce65a[_0x0667('0xe')]['code']===0x1f4){logger[_0x0667('0xe')]('Automation,\x20%s,\x20%s',_0xc5897f,_0x1ce65a[_0x0667('0xe')]['message']);return _0x1207b0(_0x1ce65a[_0x0667('0xe')][_0x0667('0xf')]);}logger['error'](_0x0667('0x10'),_0xc5897f,_0x1ce65a[_0x0667('0xe')][_0x0667('0xf')]);return _0x5919b9(_0x1ce65a[_0x0667('0xe')][_0x0667('0xf')]);}else{logger[_0x0667('0xa')](_0x0667('0x10'),_0xc5897f,_0x0667('0xb'));_0x5919b9(_0x1ce65a[_0x0667('0x11')][_0x0667('0xf')]);}})['catch'](function(_0xb1580d){logger['error'](_0x0667('0x10'),_0xc5897f,_0xb1580d);_0x1207b0(_0xb1580d);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index b1f4b3c..7a53e4e 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 _0x1808=['connect-timeout','express','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','/:id','show','/:id/actions','getActions','post','/:id/conditions','addActions','update','destroy','exports','multer','util'];(function(_0x219c79,_0x139b63){var _0xf7e0b6=function(_0x3940c3){while(--_0x3940c3){_0x219c79['push'](_0x219c79['shift']());}};_0xf7e0b6(++_0x139b63);}(_0x1808,0xe2));var _0x8180=function(_0x4d1965,_0x43152e){_0x4d1965=_0x4d1965-0x0;var _0xdcfade=_0x1808[_0x4d1965];return _0xdcfade;};'use strict';var multer=require(_0x8180('0x0'));var util=require(_0x8180('0x1'));var path=require('path');var timeout=require(_0x8180('0x2'));var express=require(_0x8180('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x8180('0x4'));var config=require(_0x8180('0x5'));var controller=require(_0x8180('0x6'));router[_0x8180('0x7')]('/',auth[_0x8180('0x8')](),controller['index']);router[_0x8180('0x7')](_0x8180('0x9'),auth[_0x8180('0x8')](),controller[_0x8180('0xa')]);router[_0x8180('0x7')]('/:id/conditions',auth[_0x8180('0x8')](),controller['getConditions']);router['get'](_0x8180('0xb'),auth[_0x8180('0x8')](),controller[_0x8180('0xc')]);router[_0x8180('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8180('0xd')](_0x8180('0xe'),auth['isAuthenticated'](),controller['addConditions']);router[_0x8180('0xd')](_0x8180('0xb'),auth[_0x8180('0x8')](),controller[_0x8180('0xf')]);router['put']('/:id',auth[_0x8180('0x8')](),controller[_0x8180('0x10')]);router['delete'](_0x8180('0x9'),auth['isAuthenticated'](),controller[_0x8180('0x11')]);module[_0x8180('0x12')]=router; \ No newline at end of file +var _0x6629=['addConditions','addActions','put','update','destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','index','get','/:id','isAuthenticated','show','/:id/conditions','getConditions','/:id/actions','getActions','post'];(function(_0x5199af,_0x1eb67c){var _0x381974=function(_0x456a88){while(--_0x456a88){_0x5199af['push'](_0x5199af['shift']());}};_0x381974(++_0x1eb67c);}(_0x6629,0x1a9));var _0x9662=function(_0x2e4a44,_0x1cde4c){_0x2e4a44=_0x2e4a44-0x0;var _0x5277e7=_0x6629[_0x2e4a44];return _0x5277e7;};'use strict';var multer=require(_0x9662('0x0'));var util=require(_0x9662('0x1'));var path=require('path');var timeout=require(_0x9662('0x2'));var express=require('express');var router=express[_0x9662('0x3')]();var auth=require(_0x9662('0x4'));var interaction=require(_0x9662('0x5'));var config=require('../../config/environment');var controller=require('./automation.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x9662('0x6')]);router[_0x9662('0x7')](_0x9662('0x8'),auth[_0x9662('0x9')](),controller[_0x9662('0xa')]);router[_0x9662('0x7')](_0x9662('0xb'),auth[_0x9662('0x9')](),controller[_0x9662('0xc')]);router['get'](_0x9662('0xd'),auth[_0x9662('0x9')](),controller[_0x9662('0xe')]);router['post']('/',auth[_0x9662('0x9')](),controller['create']);router[_0x9662('0xf')]('/:id/conditions',auth[_0x9662('0x9')](),controller[_0x9662('0x10')]);router[_0x9662('0xf')]('/:id/actions',auth['isAuthenticated'](),controller[_0x9662('0x11')]);router[_0x9662('0x12')](_0x9662('0x8'),auth[_0x9662('0x9')](),controller[_0x9662('0x13')]);router['delete'](_0x9662('0x8'),auth[_0x9662('0x9')](),controller[_0x9662('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 3b26193..f83a298 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 _0x1920=['Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)'];(function(_0x3c68e5,_0x19d28f){var _0x32f0bc=function(_0x29a62f){while(--_0x29a62f){_0x3c68e5['push'](_0x3c68e5['shift']());}};_0x32f0bc(++_0x19d28f);}(_0x1920,0x1b2));var _0x0192=function(_0x51eddf,_0x205238){_0x51eddf=_0x51eddf-0x0;var _0x33e9aa=_0x1920[_0x51eddf];return _0x33e9aa;};'use strict';var Sequelize=require(_0x0192('0x0'));module[_0x0192('0x1')]={'name':{'type':Sequelize[_0x0192('0x2')],'unique':_0x0192('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x0192('0x4')),'allowNull':![],'defaultValue':_0x0192('0x4')},'description':{'type':Sequelize[_0x0192('0x2')]},'active':{'type':Sequelize[_0x0192('0x5')],'defaultValue':0x0,'comment':_0x0192('0x6')},'limitCalls':{'type':Sequelize[_0x0192('0x7')](0x4)[_0x0192('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x0192('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x0192('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0192('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x0192('0x7')](0x3)[_0x0192('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0192('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0192('0x7')](0x3)[_0x0192('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0192('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x0192('0x7')](0x5)[_0x0192('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0192('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0x0192('0x7')](0x3)[_0x0192('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0192('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0192('0x7')](0x5)[_0x0192('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0192('0x7')](0x3)[_0x0192('0x8')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0192('0x7')](0x5)[_0x0192('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x0192('0x7')](0x3)[_0x0192('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x0192('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0192('0x2')],'defaultValue':_0x0192('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0x0192('0xf')](_0x0192('0x10'),_0x0192('0x11'),_0x0192('0x12')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x0192('0x7')](0x9)[_0x0192('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0192('0x13')},'dialAMDGreeting':{'type':Sequelize[_0x0192('0x7')](0x9)[_0x0192('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0192('0x7')](0x9)[_0x0192('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0192('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0192('0x7')](0x9)[_0x0192('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x0192('0x7')](0x9)[_0x0192('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0192('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0192('0x7')](0x9)[_0x0192('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x0192('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x0192('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x0192('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x0192('0x7')](0x5)[_0x0192('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0192('0x7')](0x9)[_0x0192('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0192('0x18')},'dialOrderByScheduledAt':{'type':Sequelize[_0x0192('0xf')](_0x0192('0x19'),_0x0192('0x1a')),'defaultValue':_0x0192('0x19')},'dialPrefix':{'type':Sequelize[_0x0192('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x0192('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0192('0x1b')},'dialCutDigit':{'type':Sequelize[_0x0192('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0192('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0192('0x7')](0x3)[_0x0192('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0192('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0192('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0192('0x1e')},'dialDropMaxRetry':{'type':Sequelize[_0x0192('0x7')](0x3)[_0x0192('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0192('0x1f')},'dialDropRetryFrequency':{'type':Sequelize[_0x0192('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0192('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0192('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0192('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0192('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0192('0x22')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0192('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0192('0x7')](0x5)[_0x0192('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0192('0x7')](0x3)[_0x0192('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0192('0x7')](0x5)[_0x0192('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0192('0x23')}}; \ No newline at end of file +var _0x131d=['ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','STRING','name'];(function(_0x174a18,_0x680ad){var _0x193c4b=function(_0x4af796){while(--_0x4af796){_0x174a18['push'](_0x174a18['shift']());}};_0x193c4b(++_0x680ad);}(_0x131d,0x1c5));var _0xd131=function(_0x29638a,_0x29f736){_0x29638a=_0x29638a-0x0;var _0x589b6f=_0x131d[_0x29638a];return _0x589b6f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xd131('0x0')],'unique':_0xd131('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xd131('0x2')](_0xd131('0x3')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0xd131('0x0')]},'active':{'type':Sequelize[_0xd131('0x4')],'defaultValue':0x0,'comment':_0xd131('0x5')},'limitCalls':{'type':Sequelize[_0xd131('0x6')](0x4)[_0xd131('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xd131('0x8')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xd131('0x0')]},'dialOriginateTimeout':{'type':Sequelize[_0xd131('0x6')](0x3)[_0xd131('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xd131('0x6')](0x3)[_0xd131('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd131('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xd131('0x6')](0x5)[_0xd131('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd131('0xa')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd131('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd131('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0xd131('0x6')](0x5)[_0xd131('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd131('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xd131('0x6')](0x3)[_0xd131('0x7')],'defaultValue':0x3,'comment':_0xd131('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xd131('0x6')](0x5)[_0xd131('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd131('0xe')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd131('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xd131('0x0')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xd131('0x0')],'defaultValue':_0xd131('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0xd131('0x2')](_0xd131('0x10'),'never',_0xd131('0x11')),'defaultValue':_0xd131('0x10')},'dialAMDActive':{'type':Sequelize[_0xd131('0x4')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xd131('0x6')](0x9)[_0xd131('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xd131('0x12')},'dialAMDGreeting':{'type':Sequelize[_0xd131('0x6')](0x9)[_0xd131('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xd131('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xd131('0x6')](0x9)[_0xd131('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xd131('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xd131('0x6')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xd131('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xd131('0x6')](0x9)[_0xd131('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xd131('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xd131('0x6')](0x9)[_0xd131('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xd131('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xd131('0x6')](0x5)[_0xd131('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xd131('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xd131('0x6')](0x9)[_0xd131('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd131('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0xd131('0x2')](_0xd131('0x1a'),'ASC'),'defaultValue':_0xd131('0x1a')},'dialPrefix':{'type':Sequelize[_0xd131('0x0')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xd131('0x6')](0x3)[_0xd131('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd131('0x1b')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xd131('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd131('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xd131('0x6')](0x3)[_0xd131('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd131('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xd131('0x6')](0x5)[_0xd131('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xd131('0x6')](0x3)[_0xd131('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xd131('0x6')](0x5)[_0xd131('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd131('0x1e')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xd131('0x6')](0x3)[_0xd131('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd131('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xd131('0x6')](0x5)[_0xd131('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd131('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0xd131('0x6')](0x3)[_0xd131('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xd131('0x6')](0x5)[_0xd131('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd131('0x21')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xd131('0x6')](0x3)[_0xd131('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xd131('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd131('0x22')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index bb3031e..da2d4d5 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 _0x884a=['Content-Range','apply','reject','save','destroy','then','get','IvrCampaigns','UserProfileResource','error','stack','name','send','index','Campaign','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','type','merge','options','includeAll','include','findAll','rows','params','rawAttributes','find','catch','create','body','user','userProfileId','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getHoppers','CmHopper','sort','CampaignId','getHopperHistories','findOne','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','ids','spread','dialCheckDuplicateType','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','field','NOW()','toString','cm_contacts','ListId\x20=\x20?','CmListId','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','from','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','insert','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','push','sequelize','all','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set'];(function(_0x5d4fed,_0xd2b5e5){var _0x1f29b0=function(_0x1317c2){while(--_0x1317c2){_0x5d4fed['push'](_0x5d4fed['shift']());}};_0x1f29b0(++_0xd2b5e5);}(_0x884a,0x1f2));var _0xa884=function(_0x448f77,_0x41b8eb){_0x448f77=_0x448f77-0x0;var _0x2b2fed=_0x884a[_0x448f77];return _0x2b2fed;};'use strict';var pdf=require(_0xa884('0x0'));var emlformat=require(_0xa884('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa884('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa884('0x3'));var moment=require(_0xa884('0x4'));var BPromise=require(_0xa884('0x5'));var Mustache=require(_0xa884('0x6'));var util=require(_0xa884('0x7'));var path=require(_0xa884('0x8'));var sox=require(_0xa884('0x9'));var csv=require(_0xa884('0xa'));var ejs=require(_0xa884('0xb'));var fs=require('fs');var _=require(_0xa884('0xc'));var squel=require(_0xa884('0xd'));var crypto=require(_0xa884('0xe'));var jsforce=require(_0xa884('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa884('0x10'));var Papa=require('papaparse');var Redis=require(_0xa884('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa884('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa884('0x13'));var logger=require(_0xa884('0x14'))('api');var utils=require(_0xa884('0x15'));var config=require(_0xa884('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21598a,_0x337c25){_0x337c25=_0x337c25||0xcc;return function(_0x5de13c){if(_0x5de13c){return _0x21598a[_0xa884('0x17')](_0x337c25);}return _0x21598a[_0xa884('0x18')](_0x337c25)['end']();};}function respondWithResult(_0x1c8d1e,_0x11e28c){_0x11e28c=_0x11e28c||0xc8;return function(_0x124d67){if(_0x124d67){return _0x1c8d1e[_0xa884('0x18')](_0x11e28c)[_0xa884('0x19')](_0x124d67);}};}function respondWithFilteredResult(_0x492817,_0x57272b){return function(_0x3acbb9){if(_0x3acbb9){var _0x3813e0=_0x3acbb9[_0xa884('0x1a')],_0x23ba6c=_0x57272b[_0xa884('0x1b')],_0x20c78e=_0x57272b['offset']+_0x57272b[_0xa884('0x1c')],_0x44b938;if(_0x20c78e>=_0x3813e0){_0x20c78e=_0x3813e0;_0x44b938=0xc8;}else{_0x44b938=0xce;}_0x492817[_0xa884('0x18')](_0x44b938);return _0x492817[_0xa884('0x1d')](_0xa884('0x1e'),_0x23ba6c+'-'+_0x20c78e+'/'+_0x3813e0)[_0xa884('0x19')](_0x3acbb9);}return null;};}function patchUpdates(_0x23600e){return function(_0x13301e){try{jsonpatch[_0xa884('0x1f')](_0x13301e,_0x23600e,!![]);}catch(_0x550c57){return BPromise[_0xa884('0x20')](_0x550c57);}return _0x13301e[_0xa884('0x21')]();};}function saveUpdates(_0x412471,_0x263916){return function(_0x4b3947){if(_0x4b3947){return _0x4b3947['update'](_0x412471)['then'](function(_0x24a952){return _0x24a952;});}return null;};}function removeEntity(_0x4eb2e8,_0x344766){return function(_0x1d76d2){if(_0x1d76d2){return _0x1d76d2[_0xa884('0x22')]()[_0xa884('0x23')](function(){var _0x584f26=_0x1d76d2[_0xa884('0x24')]({'plain':!![]});var _0x58662f=_0xa884('0x25');return db[_0xa884('0x26')][_0xa884('0x22')]({'where':{'type':_0x58662f,'resourceId':_0x584f26['id']}})[_0xa884('0x23')](function(){return _0x1d76d2;});})[_0xa884('0x23')](function(){_0x4eb2e8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x121852,_0x57c652){return function(_0x20e34d){if(!_0x20e34d){_0x121852[_0xa884('0x17')](0x194);}return _0x20e34d;};}function handleError(_0x11e2dc,_0x46fb84){_0x46fb84=_0x46fb84||0x1f4;return function(_0x39740d){logger[_0xa884('0x27')](_0x39740d[_0xa884('0x28')]);if(_0x39740d[_0xa884('0x29')]){delete _0x39740d[_0xa884('0x29')];}_0x11e2dc[_0xa884('0x18')](_0x46fb84)[_0xa884('0x2a')](_0x39740d);};}exports[_0xa884('0x2b')]=function(_0x232b0f,_0x58ccdd){var _0x5c96d8={},_0x4770b3={},_0x2ba557={'count':0x0,'rows':[]};var _0x306a2c=_['map'](db[_0xa884('0x2c')]['rawAttributes'],function(_0x5f1f48){return{'name':_0x5f1f48['fieldName'],'type':_0x5f1f48['type'][_0xa884('0x2d')]};});_0x4770b3[_0xa884('0x2e')]=_[_0xa884('0x2f')](_0x306a2c,_0xa884('0x29'));_0x4770b3[_0xa884('0x30')]=_[_0xa884('0x31')](_0x232b0f[_0xa884('0x30')]);_0x4770b3[_0xa884('0x32')]=_[_0xa884('0x33')](_0x4770b3[_0xa884('0x2e')],_0x4770b3['query']);_0x5c96d8[_0xa884('0x34')]=_[_0xa884('0x33')](_0x4770b3[_0xa884('0x2e')],qs[_0xa884('0x35')](_0x232b0f[_0xa884('0x30')][_0xa884('0x35')]));_0x5c96d8['attributes']=_0x5c96d8['attributes'][_0xa884('0x36')]?_0x5c96d8[_0xa884('0x34')]:_0x4770b3['model'];if(!_0x232b0f[_0xa884('0x30')][_0xa884('0x37')](_0xa884('0x38'))){_0x5c96d8[_0xa884('0x1c')]=qs[_0xa884('0x1c')](_0x232b0f[_0xa884('0x30')][_0xa884('0x1c')]);_0x5c96d8['offset']=qs['offset'](_0x232b0f['query']['offset']);}_0x5c96d8[_0xa884('0x39')]=qs['sort'](_0x232b0f[_0xa884('0x30')]['sort']);_0x5c96d8[_0xa884('0x3a')]=qs[_0xa884('0x32')](_[_0xa884('0x3b')](_0x232b0f[_0xa884('0x30')],_0x4770b3[_0xa884('0x32')]),_0x306a2c);if(_0x232b0f[_0xa884('0x30')][_0xa884('0x3c')]){_0x5c96d8[_0xa884('0x3a')]=_['merge'](_0x5c96d8[_0xa884('0x3a')],{'$or':_['map'](_0x306a2c,function(_0x2e15c8){if(_0x2e15c8[_0xa884('0x3d')]!=='VIRTUAL'){var _0x4a14a3={};_0x4a14a3[_0x2e15c8[_0xa884('0x29')]]={'$like':'%'+_0x232b0f['query']['filter']+'%'};return _0x4a14a3;}})});}_0x5c96d8=_[_0xa884('0x3e')]({},_0x5c96d8,_0x232b0f[_0xa884('0x3f')]);var _0x46b8c5={'where':_0x5c96d8[_0xa884('0x3a')]};return db[_0xa884('0x2c')][_0xa884('0x1a')](_0x46b8c5)[_0xa884('0x23')](function(_0x388279){_0x2ba557['count']=_0x388279;if(_0x232b0f[_0xa884('0x30')][_0xa884('0x40')]){_0x5c96d8[_0xa884('0x41')]=[{'all':!![]}];}return db[_0xa884('0x2c')][_0xa884('0x42')](_0x5c96d8);})['then'](function(_0x1a2ed7){_0x2ba557[_0xa884('0x43')]=_0x1a2ed7;return _0x2ba557;})['then'](respondWithFilteredResult(_0x58ccdd,_0x5c96d8))['catch'](handleError(_0x58ccdd,null));};exports['show']=function(_0x5556ab,_0x2b9ab3){var _0xcab4f1={'raw':![],'where':{'id':_0x5556ab[_0xa884('0x44')]['id']}},_0x1282a0={};_0x1282a0[_0xa884('0x2e')]=_[_0xa884('0x31')](db[_0xa884('0x2c')][_0xa884('0x45')]);_0x1282a0[_0xa884('0x30')]=_[_0xa884('0x31')](_0x5556ab[_0xa884('0x30')]);_0x1282a0['filters']=_[_0xa884('0x33')](_0x1282a0[_0xa884('0x2e')],_0x1282a0[_0xa884('0x30')]);_0xcab4f1['attributes']=_[_0xa884('0x33')](_0x1282a0[_0xa884('0x2e')],qs['fields'](_0x5556ab[_0xa884('0x30')][_0xa884('0x35')]));_0xcab4f1[_0xa884('0x34')]=_0xcab4f1[_0xa884('0x34')][_0xa884('0x36')]?_0xcab4f1[_0xa884('0x34')]:_0x1282a0['model'];if(_0x5556ab['query'][_0xa884('0x40')]){_0xcab4f1[_0xa884('0x41')]=[{'all':!![]}];}_0xcab4f1=_[_0xa884('0x3e')]({},_0xcab4f1,_0x5556ab[_0xa884('0x3f')]);return db[_0xa884('0x2c')][_0xa884('0x46')](_0xcab4f1)['then'](handleEntityNotFound(_0x2b9ab3,null))[_0xa884('0x23')](respondWithResult(_0x2b9ab3,null))[_0xa884('0x47')](handleError(_0x2b9ab3,null));};exports[_0xa884('0x48')]=function(_0x186fd2,_0x243683){return db[_0xa884('0x2c')][_0xa884('0x48')](_0x186fd2[_0xa884('0x49')],{})[_0xa884('0x23')](function(_0x205cf9){var _0x5641cd=_0x186fd2[_0xa884('0x4a')][_0xa884('0x24')]({'plain':!![]});if(!_0x5641cd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5641cd['role']==='user'){var _0x5a8d2f=_0x205cf9[_0xa884('0x24')]({'plain':!![]});var _0x31ee08='IvrCampaigns';return db['UserProfileSection'][_0xa884('0x46')]({'where':{'name':_0x31ee08,'userProfileId':_0x5641cd[_0xa884('0x4b')]},'raw':!![]})[_0xa884('0x23')](function(_0x2d3885){if(_0x2d3885&&_0x2d3885['autoAssociation']===0x0){return db[_0xa884('0x26')][_0xa884('0x48')]({'name':_0x5a8d2f['name'],'resourceId':_0x5a8d2f['id'],'type':_0x2d3885[_0xa884('0x29')],'sectionId':_0x2d3885['id']},{})['then'](function(){return _0x205cf9;});}else{return _0x205cf9;}})[_0xa884('0x47')](function(_0x404e34){logger[_0xa884('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x404e34);throw _0x404e34;});}return _0x205cf9;})[_0xa884('0x23')](respondWithResult(_0x243683,0xc9))['catch'](handleError(_0x243683,null));};exports['clone']=function(_0x3673cb,_0xb77cf4){var _0x42e9b9={'where':{'id':_0x3673cb[_0xa884('0x44')]['id']}},_0x2422ec={};_0x2422ec[_0xa884('0x2e')]=_['keys'](db['Campaign']['rawAttributes']);_0x42e9b9[_0xa884('0x34')]=_[_0xa884('0x33')](_0x2422ec[_0xa884('0x2e')],qs['fields'](_0x3673cb['query'][_0xa884('0x35')]));_0x42e9b9[_0xa884('0x34')]=_0x42e9b9[_0xa884('0x34')][_0xa884('0x36')]?_0x42e9b9[_0xa884('0x34')]:_0x2422ec[_0xa884('0x2e')];if(_0x3673cb[_0xa884('0x30')][_0xa884('0x40')]){_0x42e9b9[_0xa884('0x41')]=[{'all':!![]}];}_0x42e9b9=_['merge']({},_0x42e9b9,_0x3673cb['options']);return db[_0xa884('0x2c')][_0xa884('0x46')](_0x42e9b9)['then'](handleEntityNotFound(_0xb77cf4,null))[_0xa884('0x23')](function(_0xb370ff){if(_0xb370ff){var _0x41ee5b=_0xb370ff[_0xa884('0x24')]({'plain':!![]});_0x41ee5b=qs[_0xa884('0x4c')](_0x41ee5b,['id',_0xa884('0x4d'),_0xa884('0x4e')]);_0x3673cb[_0xa884('0x49')]=_['omit'](_0x3673cb['body'],['id',_0xa884('0x4d'),_0xa884('0x4e')]);return db[_0xa884('0x2c')][_0xa884('0x48')](_[_0xa884('0x3e')](_0x41ee5b,_0x3673cb[_0xa884('0x49')]),{'include':_0x3673cb[_0xa884('0x30')][_0xa884('0x40')]?[{'all':!![]}]:undefined})[_0xa884('0x23')](function(_0xca7343){var _0x72de1d=_0x3673cb[_0xa884('0x4a')]['get']({'plain':!![]});if(!_0x72de1d)throw new Error(_0xa884('0x4f'));if(_0x72de1d[_0xa884('0x50')]==='user'){var _0x1da4c1=_0xca7343[_0xa884('0x24')]({'plain':!![]});var _0x23a6a3=_0xa884('0x25');return db[_0xa884('0x51')]['find']({'where':{'name':_0x23a6a3,'userProfileId':_0x72de1d[_0xa884('0x4b')]},'raw':!![]})[_0xa884('0x23')](function(_0x4e76e4){if(_0x4e76e4&&_0x4e76e4[_0xa884('0x52')]===0x0){return db[_0xa884('0x26')]['create']({'name':_0x1da4c1[_0xa884('0x29')],'resourceId':_0x1da4c1['id'],'type':_0x4e76e4['name'],'sectionId':_0x4e76e4['id']},{})[_0xa884('0x23')](function(){return _0xca7343;});}else{return _0xca7343;}})[_0xa884('0x47')](function(_0x56db16){logger[_0xa884('0x27')](_0xa884('0x53'),_0x56db16);throw _0x56db16;});}return _0xca7343;});}})[_0xa884('0x23')](respondWithResult(_0xb77cf4,0xc9))[_0xa884('0x47')](handleError(_0xb77cf4,null));};exports[_0xa884('0x54')]=function(_0x3e485c,_0x55905a){if(_0x3e485c[_0xa884('0x49')]['id']){delete _0x3e485c['body']['id'];}return db['Campaign'][_0xa884('0x46')]({'where':{'id':_0x3e485c[_0xa884('0x44')]['id']}})['then'](handleEntityNotFound(_0x55905a,null))[_0xa884('0x23')](saveUpdates(_0x3e485c[_0xa884('0x49')],null))[_0xa884('0x23')](respondWithResult(_0x55905a,null))[_0xa884('0x47')](handleError(_0x55905a,null));};exports[_0xa884('0x22')]=function(_0x36062a,_0x14b913){return db[_0xa884('0x2c')][_0xa884('0x46')]({'where':{'id':_0x36062a[_0xa884('0x44')]['id']}})[_0xa884('0x23')](handleEntityNotFound(_0x14b913,null))['then'](removeEntity(_0x14b913,null))['catch'](handleError(_0x14b913,null));};exports[_0xa884('0x55')]=function(_0x4dad45,_0x8808d5,_0x3562e4){var _0x40b5a5={'raw':!![],'where':{}};var _0x20f7fc={};var _0x1925dd={'count':0x0,'rows':[]};return db[_0xa884('0x2c')]['findOne']({'where':{'id':_0x4dad45[_0xa884('0x44')]['id']}})[_0xa884('0x23')](handleEntityNotFound(_0x8808d5,null))[_0xa884('0x23')](function(_0x18d035){if(_0x18d035){_0x20f7fc[_0xa884('0x2e')]=_[_0xa884('0x31')](db[_0xa884('0x56')]['rawAttributes']);_0x20f7fc['query']=_[_0xa884('0x31')](_0x4dad45['query']);_0x20f7fc[_0xa884('0x32')]=_[_0xa884('0x33')](_0x20f7fc['model'],_0x20f7fc['query']);_0x40b5a5[_0xa884('0x34')]=_[_0xa884('0x33')](_0x20f7fc['model'],qs[_0xa884('0x35')](_0x4dad45['query'][_0xa884('0x35')]));_0x40b5a5[_0xa884('0x34')]=_0x40b5a5[_0xa884('0x34')]['length']?_0x40b5a5['attributes']:_0x20f7fc[_0xa884('0x2e')];if(!_0x4dad45[_0xa884('0x30')][_0xa884('0x37')](_0xa884('0x38'))){_0x40b5a5['limit']=qs[_0xa884('0x1c')](_0x4dad45['query'][_0xa884('0x1c')]);_0x40b5a5['offset']=qs[_0xa884('0x1b')](_0x4dad45[_0xa884('0x30')][_0xa884('0x1b')]);}_0x40b5a5['order']=qs[_0xa884('0x57')](_0x4dad45[_0xa884('0x30')][_0xa884('0x57')]);_0x40b5a5[_0xa884('0x3a')]=qs['filters'](_[_0xa884('0x3b')](_0x4dad45['query'],_0x20f7fc['filters']));_0x40b5a5[_0xa884('0x3a')][_0xa884('0x58')]=_0x18d035['id'];if(_0x4dad45['query'][_0xa884('0x3c')]){_0x40b5a5[_0xa884('0x3a')]=_[_0xa884('0x3e')](_0x40b5a5[_0xa884('0x3a')],{'$or':_[_0xa884('0x2f')](_0x40b5a5[_0xa884('0x34')],function(_0x47bd7d){var _0x2d224e={};_0x2d224e[_0x47bd7d]={'$like':'%'+_0x4dad45[_0xa884('0x30')][_0xa884('0x3c')]+'%'};return _0x2d224e;})});}_0x40b5a5=_[_0xa884('0x3e')]({},_0x40b5a5,_0x4dad45['options']);return db[_0xa884('0x56')]['count']({'where':_0x40b5a5[_0xa884('0x3a')]})['then'](function(_0x53ff98){_0x1925dd[_0xa884('0x1a')]=_0x53ff98;if(_0x4dad45['query'][_0xa884('0x40')]){_0x40b5a5[_0xa884('0x41')]=[{'all':!![]}];}return db[_0xa884('0x56')][_0xa884('0x42')](_0x40b5a5);})[_0xa884('0x23')](function(_0x3af90e){_0x1925dd[_0xa884('0x43')]=_0x3af90e;return _0x1925dd;});}})['then'](respondWithFilteredResult(_0x8808d5,_0x40b5a5))[_0xa884('0x47')](handleError(_0x8808d5,null));};exports[_0xa884('0x59')]=function(_0x45f3af,_0x397380,_0x1c589c){var _0x568c91={'raw':!![],'where':{}};var _0x44e105={};var _0x2a72e1={'count':0x0,'rows':[]};return db[_0xa884('0x2c')][_0xa884('0x5a')]({'where':{'id':_0x45f3af[_0xa884('0x44')]['id']}})['then'](handleEntityNotFound(_0x397380,null))[_0xa884('0x23')](function(_0xb2f058){if(_0xb2f058){_0x44e105[_0xa884('0x2e')]=_[_0xa884('0x31')](db[_0xa884('0x5b')][_0xa884('0x45')]);_0x44e105['query']=_[_0xa884('0x31')](_0x45f3af[_0xa884('0x30')]);_0x44e105[_0xa884('0x32')]=_[_0xa884('0x33')](_0x44e105[_0xa884('0x2e')],_0x44e105['query']);_0x568c91[_0xa884('0x34')]=_[_0xa884('0x33')](_0x44e105[_0xa884('0x2e')],qs[_0xa884('0x35')](_0x45f3af[_0xa884('0x30')]['fields']));_0x568c91[_0xa884('0x34')]=_0x568c91[_0xa884('0x34')][_0xa884('0x36')]?_0x568c91[_0xa884('0x34')]:_0x44e105[_0xa884('0x2e')];if(!_0x45f3af[_0xa884('0x30')][_0xa884('0x37')](_0xa884('0x38'))){_0x568c91[_0xa884('0x1c')]=qs[_0xa884('0x1c')](_0x45f3af[_0xa884('0x30')]['limit']);_0x568c91['offset']=qs[_0xa884('0x1b')](_0x45f3af[_0xa884('0x30')][_0xa884('0x1b')]);}_0x568c91['order']=qs[_0xa884('0x57')](_0x45f3af[_0xa884('0x30')][_0xa884('0x57')]);_0x568c91[_0xa884('0x3a')]=qs[_0xa884('0x32')](_['pick'](_0x45f3af['query'],_0x44e105[_0xa884('0x32')]));_0x568c91['where'][_0xa884('0x58')]=_0xb2f058['id'];if(_0x45f3af[_0xa884('0x30')][_0xa884('0x3c')]){_0x568c91[_0xa884('0x3a')]=_[_0xa884('0x3e')](_0x568c91[_0xa884('0x3a')],{'$or':_[_0xa884('0x2f')](_0x568c91[_0xa884('0x34')],function(_0x1b21f4){var _0x436d29={};_0x436d29[_0x1b21f4]={'$like':'%'+_0x45f3af['query'][_0xa884('0x3c')]+'%'};return _0x436d29;})});}_0x568c91=_[_0xa884('0x3e')]({},_0x568c91,_0x45f3af[_0xa884('0x3f')]);return db[_0xa884('0x5b')][_0xa884('0x1a')]({'where':_0x568c91[_0xa884('0x3a')]})[_0xa884('0x23')](function(_0x4925e6){_0x2a72e1['count']=_0x4925e6;if(_0x45f3af[_0xa884('0x30')][_0xa884('0x40')]){_0x568c91[_0xa884('0x41')]=[{'all':!![]}];}return db[_0xa884('0x5b')]['findAll'](_0x568c91);})[_0xa884('0x23')](function(_0x155e4c){_0x2a72e1[_0xa884('0x43')]=_0x155e4c;return _0x2a72e1;});}})[_0xa884('0x23')](respondWithFilteredResult(_0x397380,_0x568c91))[_0xa884('0x47')](handleError(_0x397380,null));};exports['getHopperFinals']=function(_0xbf48a0,_0x1dc40b,_0x236c22){var _0x2a3bad={'raw':!![],'where':{}};var _0x2e8e3f={};var _0x35dad6={'count':0x0,'rows':[]};return db[_0xa884('0x2c')]['findOne']({'where':{'id':_0xbf48a0[_0xa884('0x44')]['id']}})[_0xa884('0x23')](handleEntityNotFound(_0x1dc40b,null))[_0xa884('0x23')](function(_0x2c6a16){if(_0x2c6a16){_0x2e8e3f[_0xa884('0x2e')]=_['keys'](db[_0xa884('0x5c')][_0xa884('0x45')]);_0x2e8e3f['query']=_[_0xa884('0x31')](_0xbf48a0[_0xa884('0x30')]);_0x2e8e3f[_0xa884('0x32')]=_['intersection'](_0x2e8e3f['model'],_0x2e8e3f[_0xa884('0x30')]);_0x2a3bad[_0xa884('0x34')]=_['intersection'](_0x2e8e3f['model'],qs[_0xa884('0x35')](_0xbf48a0['query'][_0xa884('0x35')]));_0x2a3bad['attributes']=_0x2a3bad['attributes'][_0xa884('0x36')]?_0x2a3bad[_0xa884('0x34')]:_0x2e8e3f[_0xa884('0x2e')];if(!_0xbf48a0['query'][_0xa884('0x37')]('nolimit')){_0x2a3bad[_0xa884('0x1c')]=qs[_0xa884('0x1c')](_0xbf48a0[_0xa884('0x30')][_0xa884('0x1c')]);_0x2a3bad[_0xa884('0x1b')]=qs[_0xa884('0x1b')](_0xbf48a0['query'][_0xa884('0x1b')]);}_0x2a3bad[_0xa884('0x39')]=qs[_0xa884('0x57')](_0xbf48a0[_0xa884('0x30')]['sort']);_0x2a3bad['where']=qs[_0xa884('0x32')](_[_0xa884('0x3b')](_0xbf48a0[_0xa884('0x30')],_0x2e8e3f[_0xa884('0x32')]));_0x2a3bad[_0xa884('0x3a')][_0xa884('0x58')]=_0x2c6a16['id'];if(_0xbf48a0[_0xa884('0x30')]['filter']){_0x2a3bad[_0xa884('0x3a')]=_['merge'](_0x2a3bad[_0xa884('0x3a')],{'$or':_['map'](_0x2a3bad[_0xa884('0x34')],function(_0x3271e7){var _0x1f165c={};_0x1f165c[_0x3271e7]={'$like':'%'+_0xbf48a0[_0xa884('0x30')][_0xa884('0x3c')]+'%'};return _0x1f165c;})});}_0x2a3bad=_[_0xa884('0x3e')]({},_0x2a3bad,_0xbf48a0[_0xa884('0x3f')]);return db[_0xa884('0x5c')][_0xa884('0x1a')]({'where':_0x2a3bad[_0xa884('0x3a')]})[_0xa884('0x23')](function(_0x4bc0a9){_0x35dad6['count']=_0x4bc0a9;if(_0xbf48a0[_0xa884('0x30')]['includeAll']){_0x2a3bad[_0xa884('0x41')]=[{'all':!![]}];}return db[_0xa884('0x5c')][_0xa884('0x42')](_0x2a3bad);})[_0xa884('0x23')](function(_0x5e4494){_0x35dad6[_0xa884('0x43')]=_0x5e4494;return _0x35dad6;});}})[_0xa884('0x23')](respondWithFilteredResult(_0x1dc40b,_0x2a3bad))['catch'](handleError(_0x1dc40b,null));};exports[_0xa884('0x5d')]=function(_0xbd717f,_0x43c23f,_0x4f185f){var _0x447db2={'raw':!![],'where':{}};var _0x2e8a1e={};var _0x2c775a={'count':0x0,'rows':[]};return db[_0xa884('0x2c')][_0xa884('0x5a')]({'where':{'id':_0xbd717f[_0xa884('0x44')]['id']}})[_0xa884('0x23')](handleEntityNotFound(_0x43c23f,null))[_0xa884('0x23')](function(_0xcbd3db){if(_0xcbd3db){_0x2e8a1e['model']=_[_0xa884('0x31')](db['CmHopperBlack'][_0xa884('0x45')]);_0x2e8a1e[_0xa884('0x30')]=_[_0xa884('0x31')](_0xbd717f[_0xa884('0x30')]);_0x2e8a1e[_0xa884('0x32')]=_[_0xa884('0x33')](_0x2e8a1e[_0xa884('0x2e')],_0x2e8a1e['query']);_0x447db2[_0xa884('0x34')]=_['intersection'](_0x2e8a1e[_0xa884('0x2e')],qs[_0xa884('0x35')](_0xbd717f[_0xa884('0x30')][_0xa884('0x35')]));_0x447db2['attributes']=_0x447db2[_0xa884('0x34')][_0xa884('0x36')]?_0x447db2[_0xa884('0x34')]:_0x2e8a1e[_0xa884('0x2e')];if(!_0xbd717f['query'][_0xa884('0x37')](_0xa884('0x38'))){_0x447db2[_0xa884('0x1c')]=qs['limit'](_0xbd717f[_0xa884('0x30')]['limit']);_0x447db2[_0xa884('0x1b')]=qs[_0xa884('0x1b')](_0xbd717f[_0xa884('0x30')]['offset']);}_0x447db2[_0xa884('0x39')]=qs['sort'](_0xbd717f[_0xa884('0x30')][_0xa884('0x57')]);_0x447db2[_0xa884('0x3a')]=qs[_0xa884('0x32')](_[_0xa884('0x3b')](_0xbd717f[_0xa884('0x30')],_0x2e8a1e[_0xa884('0x32')]));_0x447db2[_0xa884('0x3a')][_0xa884('0x58')]=_0xcbd3db['id'];if(_0xbd717f[_0xa884('0x30')][_0xa884('0x3c')]){_0x447db2['where']=_[_0xa884('0x3e')](_0x447db2[_0xa884('0x3a')],{'$or':_[_0xa884('0x2f')](_0x447db2[_0xa884('0x34')],function(_0x111461){var _0xb80c65={};_0xb80c65[_0x111461]={'$like':'%'+_0xbd717f[_0xa884('0x30')][_0xa884('0x3c')]+'%'};return _0xb80c65;})});}_0x447db2=_[_0xa884('0x3e')]({},_0x447db2,_0xbd717f[_0xa884('0x3f')]);return db['CmHopperBlack'][_0xa884('0x1a')]({'where':_0x447db2[_0xa884('0x3a')]})['then'](function(_0x4a703f){_0x2c775a[_0xa884('0x1a')]=_0x4a703f;if(_0xbd717f[_0xa884('0x30')][_0xa884('0x40')]){_0x447db2[_0xa884('0x41')]=[{'all':!![]}];}return db[_0xa884('0x5e')]['findAll'](_0x447db2);})['then'](function(_0x4210d9){_0x2c775a[_0xa884('0x43')]=_0x4210d9;return _0x2c775a;});}})[_0xa884('0x23')](respondWithFilteredResult(_0x43c23f,_0x447db2))['catch'](handleError(_0x43c23f,null));};exports[_0xa884('0x5f')]=function(_0x3bf34d,_0x638350,_0x53ffec){var _0x5e0470={};var _0x4d36df={};var _0x85b914;var _0x40665a;return db[_0xa884('0x2c')]['findOne']({'where':{'id':_0x3bf34d[_0xa884('0x44')]['id']}})[_0xa884('0x23')](handleEntityNotFound(_0x638350,null))[_0xa884('0x23')](function(_0x2633b0){if(_0x2633b0){_0x85b914=_0x2633b0;_0x4d36df[_0xa884('0x2e')]=_['keys'](db['CmList']['rawAttributes']);_0x4d36df[_0xa884('0x30')]=_['keys'](_0x3bf34d[_0xa884('0x30')]);_0x4d36df['filters']=_[_0xa884('0x33')](_0x4d36df[_0xa884('0x2e')],_0x4d36df['query']);_0x5e0470[_0xa884('0x34')]=_[_0xa884('0x33')](_0x4d36df['model'],qs[_0xa884('0x35')](_0x3bf34d['query'][_0xa884('0x35')]));_0x5e0470['attributes']=_0x5e0470['attributes'][_0xa884('0x36')]?_0x5e0470[_0xa884('0x34')]:_0x4d36df[_0xa884('0x2e')];_0x5e0470[_0xa884('0x39')]=qs['sort'](_0x3bf34d['query'][_0xa884('0x57')]);_0x5e0470['where']=qs[_0xa884('0x32')](_[_0xa884('0x3b')](_0x3bf34d[_0xa884('0x30')],_0x4d36df[_0xa884('0x32')]));if(_0x3bf34d['query'][_0xa884('0x3c')]){_0x5e0470[_0xa884('0x3a')]=_[_0xa884('0x3e')](_0x5e0470[_0xa884('0x3a')],{'$or':_[_0xa884('0x2f')](_0x5e0470[_0xa884('0x34')],function(_0x144c5d){var _0x33919d={};_0x33919d[_0x144c5d]={'$like':'%'+_0x3bf34d[_0xa884('0x30')][_0xa884('0x3c')]+'%'};return _0x33919d;})});}_0x5e0470=_[_0xa884('0x3e')]({},_0x5e0470,_0x3bf34d[_0xa884('0x3f')]);return _0x85b914[_0xa884('0x5f')](_0x5e0470);}})[_0xa884('0x23')](function(_0x1a010f){if(_0x1a010f){_0x40665a=_0x1a010f[_0xa884('0x36')];if(!_0x3bf34d[_0xa884('0x30')]['hasOwnProperty'](_0xa884('0x38'))){_0x5e0470['limit']=qs[_0xa884('0x1c')](_0x3bf34d[_0xa884('0x30')]['limit']);_0x5e0470[_0xa884('0x1b')]=qs[_0xa884('0x1b')](_0x3bf34d['query'][_0xa884('0x1b')]);}return _0x85b914[_0xa884('0x5f')](_0x5e0470);}})[_0xa884('0x23')](function(_0x351fcb){if(_0x351fcb){return _0x351fcb?{'count':_0x40665a,'rows':_0x351fcb}:null;}})[_0xa884('0x23')](respondWithResult(_0x638350,null))[_0xa884('0x47')](handleError(_0x638350,null));};exports['addLists']=function(_0x485245,_0x1342e0,_0x395ad7){var _0x334e74,_0x38ede5;return db[_0xa884('0x2c')][_0xa884('0x46')]({'where':{'id':_0x485245['params']['id']}})[_0xa884('0x23')](handleEntityNotFound(_0x1342e0,null))[_0xa884('0x23')](function(_0x1f9182){if(_0x1f9182){_0x38ede5=_0x1f9182;return _0x1f9182[_0xa884('0x60')](_0x485245['body']['ids'],_[_0xa884('0x4c')](_0x485245[_0xa884('0x49')],[_0xa884('0x61'),'id'])||{});}return null;})[_0xa884('0x62')](function(_0x210ceb){var _0x555ada;_0x334e74=_0x210ceb||[];var _0x1f4c92=[];if(_0x210ceb){for(var _0xb59394=0x0;_0xb59394<_0x210ceb['length'];_0xb59394+=0x1){var _0x1ffe81=_0x210ceb[_0xb59394][_0xa884('0x24')]({'plain':!![]});_0x38ede5[_0xa884('0x63')]=_0x485245['body'][_0xa884('0x63')]?_0x485245['body'][_0xa884('0x63')]:_0x38ede5[_0xa884('0x63')];switch(_0x38ede5['dialCheckDuplicateType']){case'always':_0x555ada=squel['insert']()[_0xa884('0x64')](_0xa884('0x65'))[_0xa884('0x66')]([_0xa884('0x67'),_0xa884('0x68'),_0xa884('0x69'),_0xa884('0x6a'),_0xa884('0x58'),_0xa884('0x4d'),_0xa884('0x4e')],squel['select']()['field']('phone',_0xa884('0x67'))[_0xa884('0x6b')](_0xa884('0x6c'),_0xa884('0x68'))[_0xa884('0x6b')]('id',_0xa884('0x69'))[_0xa884('0x6b')](_0x1ffe81['CmListId'][_0xa884('0x6d')](),'ListId')[_0xa884('0x6b')](_0x485245[_0xa884('0x44')]['id']['toString'](),_0xa884('0x58'))[_0xa884('0x6b')](_0xa884('0x6c'),_0xa884('0x4d'))[_0xa884('0x6b')](_0xa884('0x6c'),_0xa884('0x4e'))['from'](_0xa884('0x6e'))[_0xa884('0x3a')]('deletedAt\x20IS\x20NULL')[_0xa884('0x3a')](_0xa884('0x6f'),_0x1ffe81[_0xa884('0x70')][_0xa884('0x6d')]())[_0xa884('0x3a')]('phone\x20IS\x20NOT\x20NULL')[_0xa884('0x3a')](_0xa884('0x71'),squel[_0xa884('0x72')]()[_0xa884('0x6b')](_0xa884('0x73'))[_0xa884('0x74')]('cm_hopper_final')[_0xa884('0x3a')]('CampaignId\x20=\x20?',_0x485245[_0xa884('0x44')]['id']['toString']()))[_0xa884('0x3a')](_0xa884('0x71'),squel[_0xa884('0x72')]()[_0xa884('0x6b')](_0xa884('0x75'))[_0xa884('0x74')](_0xa884('0x65'))[_0xa884('0x3a')](_0xa884('0x76'),_0x485245[_0xa884('0x44')]['id']['toString']())))['toString']();break;case _0xa884('0x77'):_0x555ada=squel[_0xa884('0x78')]()[_0xa884('0x64')]('cm_hopper')[_0xa884('0x66')]([_0xa884('0x67'),_0xa884('0x68'),_0xa884('0x69'),'ListId',_0xa884('0x58'),_0xa884('0x4d'),_0xa884('0x4e')],squel[_0xa884('0x72')]()['field'](_0xa884('0x67'),_0xa884('0x67'))['field'](_0xa884('0x6c'),_0xa884('0x68'))['field']('id',_0xa884('0x69'))['field'](_0x1ffe81[_0xa884('0x70')]['toString'](),'ListId')[_0xa884('0x6b')](_0x485245[_0xa884('0x44')]['id'][_0xa884('0x6d')](),'CampaignId')[_0xa884('0x6b')](_0xa884('0x6c'),'createdAt')['field']('NOW()','updatedAt')[_0xa884('0x74')](_0xa884('0x6e'))[_0xa884('0x3a')](_0xa884('0x79'))[_0xa884('0x3a')](_0xa884('0x6f'),_0x1ffe81['CmListId'][_0xa884('0x6d')]())[_0xa884('0x3a')](_0xa884('0x7a'))[_0xa884('0x3a')]('phone\x20NOT\x20IN\x20(?)',squel[_0xa884('0x72')]()['field'](_0xa884('0x75'))['from'](_0xa884('0x65'))['where'](_0xa884('0x76'),_0x485245[_0xa884('0x44')]['id']['toString']())))['toString']();break;default:_0x555ada=squel[_0xa884('0x78')]()['into'](_0xa884('0x65'))[_0xa884('0x66')]([_0xa884('0x67'),_0xa884('0x68'),_0xa884('0x69'),'ListId',_0xa884('0x58'),'createdAt',_0xa884('0x4e')],squel['select']()[_0xa884('0x6b')](_0xa884('0x67'),'phone')['field'](_0xa884('0x6c'),_0xa884('0x68'))['field']('id','ContactId')[_0xa884('0x6b')](_0x1ffe81[_0xa884('0x70')][_0xa884('0x6d')](),'ListId')[_0xa884('0x6b')](_0x485245[_0xa884('0x44')]['id'][_0xa884('0x6d')](),'CampaignId')[_0xa884('0x6b')](_0xa884('0x6c'),_0xa884('0x4d'))['field'](_0xa884('0x6c'),_0xa884('0x4e'))[_0xa884('0x74')](_0xa884('0x6e'))[_0xa884('0x3a')]('deletedAt\x20IS\x20NULL')[_0xa884('0x3a')](_0xa884('0x6f'),_0x1ffe81[_0xa884('0x70')][_0xa884('0x6d')]())[_0xa884('0x3a')](_0xa884('0x7a')))[_0xa884('0x6d')]();}_0x1f4c92[_0xa884('0x7b')](db[_0xa884('0x7c')]['query'](_0x555ada));}return BPromise[_0xa884('0x7d')](_0x1f4c92);}})[_0xa884('0x23')](function(){return _0x334e74;})[_0xa884('0x23')](respondWithResult(_0x1342e0,null))[_0xa884('0x47')](handleError(_0x1342e0,null));};exports[_0xa884('0x7e')]=function(_0x394a9f,_0x326270,_0x1a42dc){return db['Campaign'][_0xa884('0x46')]({'where':{'id':_0x394a9f[_0xa884('0x44')]['id']}})[_0xa884('0x23')](handleEntityNotFound(_0x326270,null))[_0xa884('0x23')](function(_0x1ac561){if(_0x1ac561){return _0x1ac561[_0xa884('0x7e')](_0x394a9f[_0xa884('0x30')][_0xa884('0x61')]);}})[_0xa884('0x23')](function(_0x10a0d0){if(_0x10a0d0){return db[_0xa884('0x56')][_0xa884('0x22')]({'where':{'ListId':_0x394a9f[_0xa884('0x30')][_0xa884('0x61')],'CampaignId':_0x394a9f[_0xa884('0x44')]['id']}})[_0xa884('0x23')](function(){return _0x10a0d0;});}})[_0xa884('0x23')](respondWithStatusCode(_0x326270,null))[_0xa884('0x47')](handleError(_0x326270,null));};exports[_0xa884('0x7f')]=function(_0x4cd0b6,_0x351319,_0x28abc5){var _0x59efd2={'raw':!![],'where':{}};var _0x2b74ed={};var _0x4d6538={'count':0x0,'rows':[]};return db[_0xa884('0x2c')][_0xa884('0x5a')]({'where':{'id':_0x4cd0b6[_0xa884('0x44')]['id']}})[_0xa884('0x23')](handleEntityNotFound(_0x351319,null))[_0xa884('0x23')](function(_0x45e156){if(_0x45e156){_0x2b74ed[_0xa884('0x2e')]=_[_0xa884('0x31')](db[_0xa884('0x80')]['rawAttributes']);_0x2b74ed[_0xa884('0x30')]=_[_0xa884('0x31')](_0x4cd0b6[_0xa884('0x30')]);_0x2b74ed[_0xa884('0x32')]=_[_0xa884('0x33')](_0x2b74ed[_0xa884('0x2e')],_0x2b74ed[_0xa884('0x30')]);_0x59efd2[_0xa884('0x34')]=_[_0xa884('0x33')](_0x2b74ed[_0xa884('0x2e')],qs[_0xa884('0x35')](_0x4cd0b6[_0xa884('0x30')][_0xa884('0x35')]));_0x59efd2[_0xa884('0x34')]=_0x59efd2[_0xa884('0x34')][_0xa884('0x36')]?_0x59efd2[_0xa884('0x34')]:_0x2b74ed['model'];if(!_0x4cd0b6['query'][_0xa884('0x37')]('nolimit')){_0x59efd2['limit']=qs[_0xa884('0x1c')](_0x4cd0b6['query'][_0xa884('0x1c')]);_0x59efd2[_0xa884('0x1b')]=qs['offset'](_0x4cd0b6[_0xa884('0x30')][_0xa884('0x1b')]);}_0x59efd2[_0xa884('0x39')]=qs[_0xa884('0x57')](_0x4cd0b6[_0xa884('0x30')][_0xa884('0x57')]);_0x59efd2[_0xa884('0x3a')]=qs[_0xa884('0x32')](_[_0xa884('0x3b')](_0x4cd0b6['query'],_0x2b74ed[_0xa884('0x32')]));_0x59efd2[_0xa884('0x3a')][_0xa884('0x58')]=_0x45e156['id'];if(_0x4cd0b6['query']['filter']){_0x59efd2[_0xa884('0x3a')]=_[_0xa884('0x3e')](_0x59efd2[_0xa884('0x3a')],{'$or':_[_0xa884('0x2f')](_0x59efd2[_0xa884('0x34')],function(_0x2ea08c){var _0x32ffe3={};_0x32ffe3[_0x2ea08c]={'$like':'%'+_0x4cd0b6['query'][_0xa884('0x3c')]+'%'};return _0x32ffe3;})});}_0x59efd2=_[_0xa884('0x3e')]({},_0x59efd2,_0x4cd0b6[_0xa884('0x3f')]);return db[_0xa884('0x80')][_0xa884('0x1a')]({'where':_0x59efd2[_0xa884('0x3a')]})[_0xa884('0x23')](function(_0x58dc45){_0x4d6538[_0xa884('0x1a')]=_0x58dc45;if(_0x4cd0b6[_0xa884('0x30')]['includeAll']){_0x59efd2['include']=[{'all':!![]}];}return db['CmList'][_0xa884('0x42')](_0x59efd2);})[_0xa884('0x23')](function(_0xb9708){_0x4d6538[_0xa884('0x43')]=_0xb9708;return _0x4d6538;});}})[_0xa884('0x23')](respondWithFilteredResult(_0x351319,_0x59efd2))[_0xa884('0x47')](handleError(_0x351319,null));};exports[_0xa884('0x81')]=function(_0x29e9d2,_0x1e6ebc,_0x30e14e){var _0x739fff,_0x3684a0;return db['Campaign'][_0xa884('0x46')]({'where':{'id':_0x29e9d2['params']['id']}})['then'](handleEntityNotFound(_0x1e6ebc,null))['then'](function(_0x4a5d0c){if(_0x4a5d0c){_0x3684a0=_0x4a5d0c;return _0x4a5d0c[_0xa884('0x81')](_0x29e9d2[_0xa884('0x49')][_0xa884('0x61')],_[_0xa884('0x4c')](_0x29e9d2[_0xa884('0x49')],[_0xa884('0x61'),'id'])||{});}return null;})[_0xa884('0x62')](function(_0x56fcc6){var _0x476509;_0x739fff=_0x56fcc6||[];var _0x5e295b=[];if(_0x56fcc6){for(var _0x2ac760=0x0;_0x2ac760<_0x56fcc6['length'];_0x2ac760+=0x1){var _0x3ce942=_0x56fcc6[_0x2ac760]['get']({'plain':!![]});_0x476509=squel[_0xa884('0x78')]()[_0xa884('0x64')](_0xa884('0x82'))[_0xa884('0x66')]([_0xa884('0x67'),_0xa884('0x69'),_0xa884('0x6a'),_0xa884('0x58'),_0xa884('0x4d'),_0xa884('0x4e')],squel[_0xa884('0x72')]()[_0xa884('0x6b')](_0xa884('0x67'),_0xa884('0x67'))[_0xa884('0x6b')]('id',_0xa884('0x69'))[_0xa884('0x6b')](_0x3ce942[_0xa884('0x70')][_0xa884('0x6d')](),_0xa884('0x6a'))['field'](_0x29e9d2[_0xa884('0x44')]['id'][_0xa884('0x6d')](),'CampaignId')[_0xa884('0x6b')](_0xa884('0x6c'),'createdAt')[_0xa884('0x6b')](_0xa884('0x6c'),'updatedAt')[_0xa884('0x74')]('cm_contacts')['where'](_0xa884('0x79'))[_0xa884('0x3a')]('ListId\x20=\x20?',_0x3ce942[_0xa884('0x70')][_0xa884('0x6d')]())[_0xa884('0x3a')](_0xa884('0x7a')))[_0xa884('0x6d')]();_0x5e295b[_0xa884('0x7b')](db['sequelize'][_0xa884('0x30')](_0x476509));}return BPromise[_0xa884('0x7d')](_0x5e295b);}})[_0xa884('0x23')](function(){return _0x739fff;})['then'](respondWithResult(_0x1e6ebc,null))['catch'](handleError(_0x1e6ebc,null));};exports['removeBlackLists']=function(_0x38ced9,_0x22a3c8,_0x2008ab){return db['Campaign'][_0xa884('0x46')]({'where':{'id':_0x38ced9[_0xa884('0x44')]['id']}})[_0xa884('0x23')](handleEntityNotFound(_0x22a3c8,null))[_0xa884('0x23')](function(_0x35db81){if(_0x35db81){return _0x35db81[_0xa884('0x83')](_0x38ced9[_0xa884('0x30')]['ids']);}})[_0xa884('0x23')](function(_0x501591){if(_0x501591){return db[_0xa884('0x5e')]['destroy']({'where':{'ListId':_0x38ced9[_0xa884('0x30')]['ids'],'CampaignId':_0x38ced9['params']['id']}})[_0xa884('0x23')](function(){return _0x501591;});}})[_0xa884('0x23')](respondWithStatusCode(_0x22a3c8,null))[_0xa884('0x47')](handleError(_0x22a3c8,null));}; \ No newline at end of file +var _0x34c3=['phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','fromQuery','push','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','sequelize','removeBlackLists','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','count','offset','limit','Content-Range','json','apply','update','then','destroy','get','IvrCampaigns','UserProfileResource','sendStatus','error','stack','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','UserProfileSection','findOne','CampaignId','CmHopper','getHopperHistories','CmHopperHistory','rows','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','CmList','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','phone','ContactId','ListId','createdAt','select','field','NOW()','scheduledAt','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL'];(function(_0x125a8a,_0x490d31){var _0xe767a5=function(_0x2a505c){while(--_0x2a505c){_0x125a8a['push'](_0x125a8a['shift']());}};_0xe767a5(++_0x490d31);}(_0x34c3,0x96));var _0x334c=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x34c3[_0x122096];return _0x3d1966;};'use strict';var pdf=require(_0x334c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x334c('0x1'));var zipdir=require(_0x334c('0x2'));var jsonpatch=require(_0x334c('0x3'));var rp=require(_0x334c('0x4'));var moment=require(_0x334c('0x5'));var BPromise=require(_0x334c('0x6'));var Mustache=require(_0x334c('0x7'));var util=require(_0x334c('0x8'));var path=require(_0x334c('0x9'));var sox=require(_0x334c('0xa'));var csv=require(_0x334c('0xb'));var ejs=require(_0x334c('0xc'));var fs=require('fs');var _=require(_0x334c('0xd'));var squel=require(_0x334c('0xe'));var crypto=require(_0x334c('0xf'));var jsforce=require(_0x334c('0x10'));var deskjs=require(_0x334c('0x11'));var toCsv=require(_0x334c('0xb'));var querystring=require(_0x334c('0x12'));var Papa=require(_0x334c('0x13'));var Redis=require(_0x334c('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x334c('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x334c('0x16'));var logger=require(_0x334c('0x17'))(_0x334c('0x18'));var utils=require(_0x334c('0x19'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x145c09,_0x1fcc9f){_0x1fcc9f=_0x1fcc9f||0xcc;return function(_0xd2b8c8){if(_0xd2b8c8){return _0x145c09['sendStatus'](_0x1fcc9f);}return _0x145c09[_0x334c('0x1a')](_0x1fcc9f)[_0x334c('0x1b')]();};}function respondWithResult(_0x4bb263,_0x1d24d2){_0x1d24d2=_0x1d24d2||0xc8;return function(_0x2d7b4e){if(_0x2d7b4e){return _0x4bb263[_0x334c('0x1a')](_0x1d24d2)['json'](_0x2d7b4e);}};}function respondWithFilteredResult(_0x5e3ac8,_0x41e769){return function(_0x1a93ee){if(_0x1a93ee){var _0x59b936=_0x1a93ee[_0x334c('0x1c')],_0x16b109=_0x41e769[_0x334c('0x1d')],_0x21e24e=_0x41e769[_0x334c('0x1d')]+_0x41e769[_0x334c('0x1e')],_0x2d7810;if(_0x21e24e>=_0x59b936){_0x21e24e=_0x59b936;_0x2d7810=0xc8;}else{_0x2d7810=0xce;}_0x5e3ac8['status'](_0x2d7810);return _0x5e3ac8['set'](_0x334c('0x1f'),_0x16b109+'-'+_0x21e24e+'/'+_0x59b936)[_0x334c('0x20')](_0x1a93ee);}return null;};}function patchUpdates(_0x1e20e1){return function(_0x42548d){try{jsonpatch[_0x334c('0x21')](_0x42548d,_0x1e20e1,!![]);}catch(_0x3c1d2f){return BPromise['reject'](_0x3c1d2f);}return _0x42548d['save']();};}function saveUpdates(_0xc59302,_0x5ddfe0){return function(_0x11f9b2){if(_0x11f9b2){return _0x11f9b2[_0x334c('0x22')](_0xc59302)[_0x334c('0x23')](function(_0x281796){return _0x281796;});}return null;};}function removeEntity(_0xa0a13e,_0x4d6f91){return function(_0x50599b){if(_0x50599b){return _0x50599b[_0x334c('0x24')]()[_0x334c('0x23')](function(){var _0x45e994=_0x50599b[_0x334c('0x25')]({'plain':!![]});var _0x1ee5a5=_0x334c('0x26');return db[_0x334c('0x27')][_0x334c('0x24')]({'where':{'type':_0x1ee5a5,'resourceId':_0x45e994['id']}})['then'](function(){return _0x50599b;});})[_0x334c('0x23')](function(){_0xa0a13e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x49e6cb,_0x30c6f3){return function(_0x5802fd){if(!_0x5802fd){_0x49e6cb[_0x334c('0x28')](0x194);}return _0x5802fd;};}function handleError(_0x354f06,_0x19085e){_0x19085e=_0x19085e||0x1f4;return function(_0x156124){logger[_0x334c('0x29')](_0x156124[_0x334c('0x2a')]);if(_0x156124[_0x334c('0x2b')]){delete _0x156124[_0x334c('0x2b')];}_0x354f06[_0x334c('0x1a')](_0x19085e)[_0x334c('0x2c')](_0x156124);};}exports[_0x334c('0x2d')]=function(_0x2cf077,_0x28be68){var _0x475fb6={},_0x56eb3b={},_0xbe53c3={'count':0x0,'rows':[]};var _0x2cece9=_[_0x334c('0x2e')](db[_0x334c('0x2f')][_0x334c('0x30')],function(_0x1bf8b6){return{'name':_0x1bf8b6[_0x334c('0x31')],'type':_0x1bf8b6[_0x334c('0x32')][_0x334c('0x33')]};});_0x56eb3b[_0x334c('0x34')]=_['map'](_0x2cece9,_0x334c('0x2b'));_0x56eb3b[_0x334c('0x35')]=_[_0x334c('0x36')](_0x2cf077['query']);_0x56eb3b[_0x334c('0x37')]=_['intersection'](_0x56eb3b[_0x334c('0x34')],_0x56eb3b[_0x334c('0x35')]);_0x475fb6[_0x334c('0x38')]=_[_0x334c('0x39')](_0x56eb3b[_0x334c('0x34')],qs['fields'](_0x2cf077[_0x334c('0x35')][_0x334c('0x3a')]));_0x475fb6[_0x334c('0x38')]=_0x475fb6['attributes'][_0x334c('0x3b')]?_0x475fb6[_0x334c('0x38')]:_0x56eb3b[_0x334c('0x34')];if(!_0x2cf077[_0x334c('0x35')][_0x334c('0x3c')](_0x334c('0x3d'))){_0x475fb6['limit']=qs[_0x334c('0x1e')](_0x2cf077[_0x334c('0x35')]['limit']);_0x475fb6[_0x334c('0x1d')]=qs[_0x334c('0x1d')](_0x2cf077[_0x334c('0x35')]['offset']);}_0x475fb6[_0x334c('0x3e')]=qs[_0x334c('0x3f')](_0x2cf077['query']['sort']);_0x475fb6[_0x334c('0x40')]=qs[_0x334c('0x37')](_[_0x334c('0x41')](_0x2cf077['query'],_0x56eb3b[_0x334c('0x37')]),_0x2cece9);if(_0x2cf077['query']['filter']){_0x475fb6['where']=_['merge'](_0x475fb6['where'],{'$or':_[_0x334c('0x2e')](_0x2cece9,function(_0x5769f6){if(_0x5769f6['type']!=='VIRTUAL'){var _0x14c493={};_0x14c493[_0x5769f6[_0x334c('0x2b')]]={'$like':'%'+_0x2cf077[_0x334c('0x35')][_0x334c('0x42')]+'%'};return _0x14c493;}})});}_0x475fb6=_[_0x334c('0x43')]({},_0x475fb6,_0x2cf077[_0x334c('0x44')]);var _0x3c21c7={'where':_0x475fb6[_0x334c('0x40')]};return db[_0x334c('0x2f')][_0x334c('0x1c')](_0x3c21c7)['then'](function(_0x22996f){_0xbe53c3['count']=_0x22996f;if(_0x2cf077['query'][_0x334c('0x45')]){_0x475fb6[_0x334c('0x46')]=[{'all':!![]}];}return db[_0x334c('0x2f')][_0x334c('0x47')](_0x475fb6);})[_0x334c('0x23')](function(_0x2df2b4){_0xbe53c3['rows']=_0x2df2b4;return _0xbe53c3;})[_0x334c('0x23')](respondWithFilteredResult(_0x28be68,_0x475fb6))[_0x334c('0x48')](handleError(_0x28be68,null));};exports[_0x334c('0x49')]=function(_0x1b3a14,_0x22f532){var _0x566181={'raw':![],'where':{'id':_0x1b3a14[_0x334c('0x4a')]['id']}},_0x4d81bc={};_0x4d81bc[_0x334c('0x34')]=_[_0x334c('0x36')](db[_0x334c('0x2f')][_0x334c('0x30')]);_0x4d81bc[_0x334c('0x35')]=_[_0x334c('0x36')](_0x1b3a14[_0x334c('0x35')]);_0x4d81bc['filters']=_[_0x334c('0x39')](_0x4d81bc[_0x334c('0x34')],_0x4d81bc['query']);_0x566181[_0x334c('0x38')]=_[_0x334c('0x39')](_0x4d81bc['model'],qs[_0x334c('0x3a')](_0x1b3a14['query'][_0x334c('0x3a')]));_0x566181[_0x334c('0x38')]=_0x566181[_0x334c('0x38')][_0x334c('0x3b')]?_0x566181['attributes']:_0x4d81bc[_0x334c('0x34')];if(_0x1b3a14[_0x334c('0x35')]['includeAll']){_0x566181['include']=[{'all':!![]}];}_0x566181=_[_0x334c('0x43')]({},_0x566181,_0x1b3a14[_0x334c('0x44')]);return db[_0x334c('0x2f')][_0x334c('0x4b')](_0x566181)[_0x334c('0x23')](handleEntityNotFound(_0x22f532,null))['then'](respondWithResult(_0x22f532,null))[_0x334c('0x48')](handleError(_0x22f532,null));};exports[_0x334c('0x4c')]=function(_0x10b399,_0x4221bb){return db[_0x334c('0x2f')][_0x334c('0x4c')](_0x10b399[_0x334c('0x4d')],{})[_0x334c('0x23')](function(_0x5e5b17){var _0x6b970a=_0x10b399[_0x334c('0x4e')][_0x334c('0x25')]({'plain':!![]});if(!_0x6b970a)throw new Error(_0x334c('0x4f'));if(_0x6b970a[_0x334c('0x50')]===_0x334c('0x4e')){var _0x258485=_0x5e5b17[_0x334c('0x25')]({'plain':!![]});var _0x57749a=_0x334c('0x26');return db['UserProfileSection'][_0x334c('0x4b')]({'where':{'name':_0x57749a,'userProfileId':_0x6b970a[_0x334c('0x51')]},'raw':!![]})['then'](function(_0x3b9fd6){if(_0x3b9fd6&&_0x3b9fd6[_0x334c('0x52')]===0x0){return db[_0x334c('0x27')][_0x334c('0x4c')]({'name':_0x258485[_0x334c('0x2b')],'resourceId':_0x258485['id'],'type':_0x3b9fd6[_0x334c('0x2b')],'sectionId':_0x3b9fd6['id']},{})['then'](function(){return _0x5e5b17;});}else{return _0x5e5b17;}})[_0x334c('0x48')](function(_0x5b9b12){logger[_0x334c('0x29')](_0x334c('0x53'),_0x5b9b12);throw _0x5b9b12;});}return _0x5e5b17;})[_0x334c('0x23')](respondWithResult(_0x4221bb,0xc9))['catch'](handleError(_0x4221bb,null));};exports[_0x334c('0x54')]=function(_0x5456c5,_0x2c6894){var _0x37a981={'where':{'id':_0x5456c5[_0x334c('0x4a')]['id']}},_0x4c454c={};_0x4c454c[_0x334c('0x34')]=_[_0x334c('0x36')](db[_0x334c('0x2f')][_0x334c('0x30')]);_0x37a981['attributes']=_[_0x334c('0x39')](_0x4c454c[_0x334c('0x34')],qs[_0x334c('0x3a')](_0x5456c5[_0x334c('0x35')]['fields']));_0x37a981[_0x334c('0x38')]=_0x37a981[_0x334c('0x38')]['length']?_0x37a981[_0x334c('0x38')]:_0x4c454c['model'];if(_0x5456c5['query']['includeAll']){_0x37a981[_0x334c('0x46')]=[{'all':!![]}];}_0x37a981=_[_0x334c('0x43')]({},_0x37a981,_0x5456c5[_0x334c('0x44')]);return db[_0x334c('0x2f')][_0x334c('0x4b')](_0x37a981)['then'](handleEntityNotFound(_0x2c6894,null))[_0x334c('0x23')](function(_0x2a17b9){if(_0x2a17b9){var _0x169c64=_0x2a17b9['get']({'plain':!![]});_0x169c64=qs[_0x334c('0x55')](_0x169c64,['id','createdAt',_0x334c('0x56')]);_0x5456c5['body']=_['omit'](_0x5456c5['body'],['id','createdAt',_0x334c('0x56')]);return db[_0x334c('0x2f')]['create'](_[_0x334c('0x43')](_0x169c64,_0x5456c5[_0x334c('0x4d')]),{'include':_0x5456c5['query'][_0x334c('0x45')]?[{'all':!![]}]:undefined})[_0x334c('0x23')](function(_0x2ff03b){var _0x17df0b=_0x5456c5[_0x334c('0x4e')][_0x334c('0x25')]({'plain':!![]});if(!_0x17df0b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x17df0b[_0x334c('0x50')]==='user'){var _0x512334=_0x2ff03b[_0x334c('0x25')]({'plain':!![]});var _0x25b692=_0x334c('0x26');return db[_0x334c('0x57')]['find']({'where':{'name':_0x25b692,'userProfileId':_0x17df0b[_0x334c('0x51')]},'raw':!![]})['then'](function(_0x48fad8){if(_0x48fad8&&_0x48fad8[_0x334c('0x52')]===0x0){return db[_0x334c('0x27')][_0x334c('0x4c')]({'name':_0x512334['name'],'resourceId':_0x512334['id'],'type':_0x48fad8[_0x334c('0x2b')],'sectionId':_0x48fad8['id']},{})[_0x334c('0x23')](function(){return _0x2ff03b;});}else{return _0x2ff03b;}})['catch'](function(_0x15a845){logger['error'](_0x334c('0x53'),_0x15a845);throw _0x15a845;});}return _0x2ff03b;});}})['then'](respondWithResult(_0x2c6894,0xc9))[_0x334c('0x48')](handleError(_0x2c6894,null));};exports[_0x334c('0x22')]=function(_0x3ce05f,_0x21265e){if(_0x3ce05f[_0x334c('0x4d')]['id']){delete _0x3ce05f[_0x334c('0x4d')]['id'];}return db['Campaign'][_0x334c('0x4b')]({'where':{'id':_0x3ce05f[_0x334c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x21265e,null))[_0x334c('0x23')](saveUpdates(_0x3ce05f['body'],null))['then'](respondWithResult(_0x21265e,null))[_0x334c('0x48')](handleError(_0x21265e,null));};exports['destroy']=function(_0x26800e,_0x137387){return db[_0x334c('0x2f')][_0x334c('0x4b')]({'where':{'id':_0x26800e[_0x334c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x137387,null))['then'](removeEntity(_0x137387,null))['catch'](handleError(_0x137387,null));};exports['getHoppers']=function(_0x435cd0,_0x32911a,_0x318630){var _0x896a68={'raw':!![],'where':{}};var _0x3921e2={};var _0x4e56a5={'count':0x0,'rows':[]};return db[_0x334c('0x2f')][_0x334c('0x58')]({'where':{'id':_0x435cd0[_0x334c('0x4a')]['id']}})[_0x334c('0x23')](handleEntityNotFound(_0x32911a,null))[_0x334c('0x23')](function(_0x26b4b7){if(_0x26b4b7){_0x3921e2[_0x334c('0x34')]=_[_0x334c('0x36')](db['CmHopper'][_0x334c('0x30')]);_0x3921e2[_0x334c('0x35')]=_[_0x334c('0x36')](_0x435cd0[_0x334c('0x35')]);_0x3921e2[_0x334c('0x37')]=_['intersection'](_0x3921e2[_0x334c('0x34')],_0x3921e2[_0x334c('0x35')]);_0x896a68[_0x334c('0x38')]=_[_0x334c('0x39')](_0x3921e2[_0x334c('0x34')],qs['fields'](_0x435cd0[_0x334c('0x35')]['fields']));_0x896a68[_0x334c('0x38')]=_0x896a68[_0x334c('0x38')][_0x334c('0x3b')]?_0x896a68[_0x334c('0x38')]:_0x3921e2['model'];if(!_0x435cd0[_0x334c('0x35')][_0x334c('0x3c')](_0x334c('0x3d'))){_0x896a68[_0x334c('0x1e')]=qs[_0x334c('0x1e')](_0x435cd0[_0x334c('0x35')][_0x334c('0x1e')]);_0x896a68[_0x334c('0x1d')]=qs[_0x334c('0x1d')](_0x435cd0[_0x334c('0x35')][_0x334c('0x1d')]);}_0x896a68['order']=qs[_0x334c('0x3f')](_0x435cd0['query'][_0x334c('0x3f')]);_0x896a68[_0x334c('0x40')]=qs[_0x334c('0x37')](_[_0x334c('0x41')](_0x435cd0['query'],_0x3921e2[_0x334c('0x37')]));_0x896a68[_0x334c('0x40')][_0x334c('0x59')]=_0x26b4b7['id'];if(_0x435cd0[_0x334c('0x35')][_0x334c('0x42')]){_0x896a68[_0x334c('0x40')]=_[_0x334c('0x43')](_0x896a68[_0x334c('0x40')],{'$or':_[_0x334c('0x2e')](_0x896a68[_0x334c('0x38')],function(_0x111c3e){var _0x33db20={};_0x33db20[_0x111c3e]={'$like':'%'+_0x435cd0[_0x334c('0x35')]['filter']+'%'};return _0x33db20;})});}_0x896a68=_[_0x334c('0x43')]({},_0x896a68,_0x435cd0['options']);return db[_0x334c('0x5a')][_0x334c('0x1c')]({'where':_0x896a68['where']})[_0x334c('0x23')](function(_0x372a75){_0x4e56a5[_0x334c('0x1c')]=_0x372a75;if(_0x435cd0[_0x334c('0x35')][_0x334c('0x45')]){_0x896a68[_0x334c('0x46')]=[{'all':!![]}];}return db[_0x334c('0x5a')][_0x334c('0x47')](_0x896a68);})['then'](function(_0x19c13f){_0x4e56a5['rows']=_0x19c13f;return _0x4e56a5;});}})[_0x334c('0x23')](respondWithFilteredResult(_0x32911a,_0x896a68))['catch'](handleError(_0x32911a,null));};exports[_0x334c('0x5b')]=function(_0x53fc0b,_0x34b750,_0x2ba758){var _0x38a079={'raw':!![],'where':{}};var _0xe45a96={};var _0x40b022={'count':0x0,'rows':[]};return db[_0x334c('0x2f')]['findOne']({'where':{'id':_0x53fc0b[_0x334c('0x4a')]['id']}})[_0x334c('0x23')](handleEntityNotFound(_0x34b750,null))[_0x334c('0x23')](function(_0xe7c62a){if(_0xe7c62a){_0xe45a96[_0x334c('0x34')]=_[_0x334c('0x36')](db[_0x334c('0x5c')]['rawAttributes']);_0xe45a96[_0x334c('0x35')]=_[_0x334c('0x36')](_0x53fc0b['query']);_0xe45a96[_0x334c('0x37')]=_[_0x334c('0x39')](_0xe45a96[_0x334c('0x34')],_0xe45a96[_0x334c('0x35')]);_0x38a079[_0x334c('0x38')]=_[_0x334c('0x39')](_0xe45a96[_0x334c('0x34')],qs[_0x334c('0x3a')](_0x53fc0b[_0x334c('0x35')][_0x334c('0x3a')]));_0x38a079['attributes']=_0x38a079[_0x334c('0x38')][_0x334c('0x3b')]?_0x38a079[_0x334c('0x38')]:_0xe45a96[_0x334c('0x34')];if(!_0x53fc0b[_0x334c('0x35')]['hasOwnProperty'](_0x334c('0x3d'))){_0x38a079['limit']=qs[_0x334c('0x1e')](_0x53fc0b[_0x334c('0x35')][_0x334c('0x1e')]);_0x38a079['offset']=qs[_0x334c('0x1d')](_0x53fc0b['query']['offset']);}_0x38a079[_0x334c('0x3e')]=qs['sort'](_0x53fc0b[_0x334c('0x35')][_0x334c('0x3f')]);_0x38a079[_0x334c('0x40')]=qs[_0x334c('0x37')](_['pick'](_0x53fc0b[_0x334c('0x35')],_0xe45a96['filters']));_0x38a079['where']['CampaignId']=_0xe7c62a['id'];if(_0x53fc0b['query'][_0x334c('0x42')]){_0x38a079[_0x334c('0x40')]=_[_0x334c('0x43')](_0x38a079[_0x334c('0x40')],{'$or':_['map'](_0x38a079[_0x334c('0x38')],function(_0x4e53c6){var _0x34fb19={};_0x34fb19[_0x4e53c6]={'$like':'%'+_0x53fc0b[_0x334c('0x35')][_0x334c('0x42')]+'%'};return _0x34fb19;})});}_0x38a079=_[_0x334c('0x43')]({},_0x38a079,_0x53fc0b[_0x334c('0x44')]);return db['CmHopperHistory']['count']({'where':_0x38a079[_0x334c('0x40')]})[_0x334c('0x23')](function(_0x415331){_0x40b022['count']=_0x415331;if(_0x53fc0b[_0x334c('0x35')]['includeAll']){_0x38a079['include']=[{'all':!![]}];}return db[_0x334c('0x5c')][_0x334c('0x47')](_0x38a079);})[_0x334c('0x23')](function(_0x22f55a){_0x40b022[_0x334c('0x5d')]=_0x22f55a;return _0x40b022;});}})[_0x334c('0x23')](respondWithFilteredResult(_0x34b750,_0x38a079))[_0x334c('0x48')](handleError(_0x34b750,null));};exports[_0x334c('0x5e')]=function(_0x48adc0,_0x2d37fc,_0x513f45){var _0x181fd9={'raw':!![],'where':{}};var _0x4353e2={};var _0x42ad3b={'count':0x0,'rows':[]};return db[_0x334c('0x2f')][_0x334c('0x58')]({'where':{'id':_0x48adc0[_0x334c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2d37fc,null))['then'](function(_0x496dfb){if(_0x496dfb){_0x4353e2[_0x334c('0x34')]=_[_0x334c('0x36')](db[_0x334c('0x5f')][_0x334c('0x30')]);_0x4353e2[_0x334c('0x35')]=_['keys'](_0x48adc0[_0x334c('0x35')]);_0x4353e2[_0x334c('0x37')]=_[_0x334c('0x39')](_0x4353e2[_0x334c('0x34')],_0x4353e2[_0x334c('0x35')]);_0x181fd9[_0x334c('0x38')]=_['intersection'](_0x4353e2[_0x334c('0x34')],qs[_0x334c('0x3a')](_0x48adc0[_0x334c('0x35')][_0x334c('0x3a')]));_0x181fd9[_0x334c('0x38')]=_0x181fd9[_0x334c('0x38')][_0x334c('0x3b')]?_0x181fd9['attributes']:_0x4353e2[_0x334c('0x34')];if(!_0x48adc0[_0x334c('0x35')][_0x334c('0x3c')](_0x334c('0x3d'))){_0x181fd9[_0x334c('0x1e')]=qs[_0x334c('0x1e')](_0x48adc0[_0x334c('0x35')][_0x334c('0x1e')]);_0x181fd9[_0x334c('0x1d')]=qs['offset'](_0x48adc0['query'][_0x334c('0x1d')]);}_0x181fd9[_0x334c('0x3e')]=qs[_0x334c('0x3f')](_0x48adc0[_0x334c('0x35')][_0x334c('0x3f')]);_0x181fd9['where']=qs[_0x334c('0x37')](_[_0x334c('0x41')](_0x48adc0[_0x334c('0x35')],_0x4353e2['filters']));_0x181fd9['where']['CampaignId']=_0x496dfb['id'];if(_0x48adc0['query'][_0x334c('0x42')]){_0x181fd9[_0x334c('0x40')]=_[_0x334c('0x43')](_0x181fd9['where'],{'$or':_[_0x334c('0x2e')](_0x181fd9[_0x334c('0x38')],function(_0x414ea9){var _0x57cfc7={};_0x57cfc7[_0x414ea9]={'$like':'%'+_0x48adc0[_0x334c('0x35')][_0x334c('0x42')]+'%'};return _0x57cfc7;})});}_0x181fd9=_['merge']({},_0x181fd9,_0x48adc0['options']);return db[_0x334c('0x5f')][_0x334c('0x1c')]({'where':_0x181fd9[_0x334c('0x40')]})[_0x334c('0x23')](function(_0x5cc0a0){_0x42ad3b[_0x334c('0x1c')]=_0x5cc0a0;if(_0x48adc0[_0x334c('0x35')][_0x334c('0x45')]){_0x181fd9[_0x334c('0x46')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x334c('0x47')](_0x181fd9);})['then'](function(_0x42c983){_0x42ad3b[_0x334c('0x5d')]=_0x42c983;return _0x42ad3b;});}})['then'](respondWithFilteredResult(_0x2d37fc,_0x181fd9))['catch'](handleError(_0x2d37fc,null));};exports['getHopperBlacks']=function(_0x13601a,_0x4ad2ed,_0x5bfbb6){var _0x3fb324={'raw':!![],'where':{}};var _0x3a0502={};var _0x140716={'count':0x0,'rows':[]};return db[_0x334c('0x2f')][_0x334c('0x58')]({'where':{'id':_0x13601a[_0x334c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4ad2ed,null))[_0x334c('0x23')](function(_0x50cbe2){if(_0x50cbe2){_0x3a0502[_0x334c('0x34')]=_[_0x334c('0x36')](db[_0x334c('0x60')][_0x334c('0x30')]);_0x3a0502[_0x334c('0x35')]=_[_0x334c('0x36')](_0x13601a[_0x334c('0x35')]);_0x3a0502['filters']=_[_0x334c('0x39')](_0x3a0502['model'],_0x3a0502['query']);_0x3fb324[_0x334c('0x38')]=_[_0x334c('0x39')](_0x3a0502[_0x334c('0x34')],qs[_0x334c('0x3a')](_0x13601a[_0x334c('0x35')][_0x334c('0x3a')]));_0x3fb324[_0x334c('0x38')]=_0x3fb324[_0x334c('0x38')]['length']?_0x3fb324['attributes']:_0x3a0502[_0x334c('0x34')];if(!_0x13601a['query'][_0x334c('0x3c')](_0x334c('0x3d'))){_0x3fb324['limit']=qs[_0x334c('0x1e')](_0x13601a[_0x334c('0x35')][_0x334c('0x1e')]);_0x3fb324[_0x334c('0x1d')]=qs[_0x334c('0x1d')](_0x13601a[_0x334c('0x35')]['offset']);}_0x3fb324[_0x334c('0x3e')]=qs['sort'](_0x13601a[_0x334c('0x35')][_0x334c('0x3f')]);_0x3fb324[_0x334c('0x40')]=qs[_0x334c('0x37')](_[_0x334c('0x41')](_0x13601a[_0x334c('0x35')],_0x3a0502[_0x334c('0x37')]));_0x3fb324['where'][_0x334c('0x59')]=_0x50cbe2['id'];if(_0x13601a[_0x334c('0x35')]['filter']){_0x3fb324[_0x334c('0x40')]=_[_0x334c('0x43')](_0x3fb324[_0x334c('0x40')],{'$or':_[_0x334c('0x2e')](_0x3fb324[_0x334c('0x38')],function(_0x9886ec){var _0x4e09b5={};_0x4e09b5[_0x9886ec]={'$like':'%'+_0x13601a[_0x334c('0x35')][_0x334c('0x42')]+'%'};return _0x4e09b5;})});}_0x3fb324=_[_0x334c('0x43')]({},_0x3fb324,_0x13601a['options']);return db['CmHopperBlack'][_0x334c('0x1c')]({'where':_0x3fb324[_0x334c('0x40')]})[_0x334c('0x23')](function(_0x1b003d){_0x140716['count']=_0x1b003d;if(_0x13601a['query'][_0x334c('0x45')]){_0x3fb324['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0x334c('0x47')](_0x3fb324);})[_0x334c('0x23')](function(_0x3029cb){_0x140716[_0x334c('0x5d')]=_0x3029cb;return _0x140716;});}})['then'](respondWithFilteredResult(_0x4ad2ed,_0x3fb324))[_0x334c('0x48')](handleError(_0x4ad2ed,null));};exports[_0x334c('0x61')]=function(_0x1ba233,_0x3e8a73,_0xda0916){var _0x2e8ea3={};var _0xa1b98f={};var _0x5880c0;var _0x4f2551;return db[_0x334c('0x2f')][_0x334c('0x58')]({'where':{'id':_0x1ba233[_0x334c('0x4a')]['id']}})[_0x334c('0x23')](handleEntityNotFound(_0x3e8a73,null))['then'](function(_0x1d077e){if(_0x1d077e){_0x5880c0=_0x1d077e;_0xa1b98f[_0x334c('0x34')]=_[_0x334c('0x36')](db[_0x334c('0x62')][_0x334c('0x30')]);_0xa1b98f[_0x334c('0x35')]=_[_0x334c('0x36')](_0x1ba233[_0x334c('0x35')]);_0xa1b98f[_0x334c('0x37')]=_[_0x334c('0x39')](_0xa1b98f[_0x334c('0x34')],_0xa1b98f[_0x334c('0x35')]);_0x2e8ea3[_0x334c('0x38')]=_[_0x334c('0x39')](_0xa1b98f['model'],qs[_0x334c('0x3a')](_0x1ba233[_0x334c('0x35')][_0x334c('0x3a')]));_0x2e8ea3['attributes']=_0x2e8ea3[_0x334c('0x38')]['length']?_0x2e8ea3[_0x334c('0x38')]:_0xa1b98f[_0x334c('0x34')];_0x2e8ea3[_0x334c('0x3e')]=qs[_0x334c('0x3f')](_0x1ba233[_0x334c('0x35')][_0x334c('0x3f')]);_0x2e8ea3[_0x334c('0x40')]=qs[_0x334c('0x37')](_[_0x334c('0x41')](_0x1ba233['query'],_0xa1b98f[_0x334c('0x37')]));if(_0x1ba233[_0x334c('0x35')][_0x334c('0x42')]){_0x2e8ea3[_0x334c('0x40')]=_[_0x334c('0x43')](_0x2e8ea3[_0x334c('0x40')],{'$or':_['map'](_0x2e8ea3[_0x334c('0x38')],function(_0x562a0a){var _0x2bee78={};_0x2bee78[_0x562a0a]={'$like':'%'+_0x1ba233['query']['filter']+'%'};return _0x2bee78;})});}_0x2e8ea3=_[_0x334c('0x43')]({},_0x2e8ea3,_0x1ba233[_0x334c('0x44')]);return _0x5880c0[_0x334c('0x61')](_0x2e8ea3);}})[_0x334c('0x23')](function(_0x4fd620){if(_0x4fd620){_0x4f2551=_0x4fd620[_0x334c('0x3b')];if(!_0x1ba233[_0x334c('0x35')]['hasOwnProperty'](_0x334c('0x3d'))){_0x2e8ea3[_0x334c('0x1e')]=qs[_0x334c('0x1e')](_0x1ba233['query'][_0x334c('0x1e')]);_0x2e8ea3['offset']=qs[_0x334c('0x1d')](_0x1ba233[_0x334c('0x35')][_0x334c('0x1d')]);}return _0x5880c0['getLists'](_0x2e8ea3);}})[_0x334c('0x23')](function(_0x5a24e7){if(_0x5a24e7){return _0x5a24e7?{'count':_0x4f2551,'rows':_0x5a24e7}:null;}})[_0x334c('0x23')](respondWithResult(_0x3e8a73,null))[_0x334c('0x48')](handleError(_0x3e8a73,null));};exports['addLists']=function(_0x2b2c68,_0x5687d1,_0x33a4d9){var _0x44934a,_0x1c0a3b;return db[_0x334c('0x2f')][_0x334c('0x4b')]({'where':{'id':_0x2b2c68[_0x334c('0x4a')]['id']}})[_0x334c('0x23')](handleEntityNotFound(_0x5687d1,null))[_0x334c('0x23')](function(_0x3c9728){if(_0x3c9728){_0x1c0a3b=_0x3c9728;return _0x3c9728['addLists'](_0x2b2c68[_0x334c('0x4d')]['ids'],_[_0x334c('0x55')](_0x2b2c68['body'],[_0x334c('0x63'),'id'])||{});}return null;})[_0x334c('0x64')](function(_0x4456cd){var _0x8f0b5e;_0x44934a=_0x4456cd||[];var _0x5d5555=[];if(_0x4456cd){for(var _0x3b8aa8=0x0;_0x3b8aa8<_0x4456cd['length'];_0x3b8aa8+=0x1){var _0x3e736b=_0x4456cd[_0x3b8aa8][_0x334c('0x25')]({'plain':!![]});_0x1c0a3b['dialCheckDuplicateType']=_0x2b2c68[_0x334c('0x4d')]['dialCheckDuplicateType']?_0x2b2c68[_0x334c('0x4d')][_0x334c('0x65')]:_0x1c0a3b[_0x334c('0x65')];switch(_0x1c0a3b[_0x334c('0x65')]){case'always':_0x8f0b5e=squel[_0x334c('0x66')]()[_0x334c('0x67')](_0x334c('0x68'))['fromQuery']([_0x334c('0x69'),'scheduledAt',_0x334c('0x6a'),_0x334c('0x6b'),_0x334c('0x59'),_0x334c('0x6c'),_0x334c('0x56')],squel[_0x334c('0x6d')]()[_0x334c('0x6e')](_0x334c('0x69'),_0x334c('0x69'))[_0x334c('0x6e')](_0x334c('0x6f'),_0x334c('0x70'))[_0x334c('0x6e')]('id',_0x334c('0x6a'))['field'](_0x3e736b[_0x334c('0x71')][_0x334c('0x72')](),'ListId')['field'](_0x2b2c68[_0x334c('0x4a')]['id'][_0x334c('0x72')](),'CampaignId')[_0x334c('0x6e')](_0x334c('0x6f'),_0x334c('0x6c'))[_0x334c('0x6e')](_0x334c('0x6f'),'updatedAt')[_0x334c('0x73')](_0x334c('0x74'))[_0x334c('0x40')](_0x334c('0x75'))['where'](_0x334c('0x76'),_0x3e736b[_0x334c('0x71')]['toString']())[_0x334c('0x40')](_0x334c('0x77'))[_0x334c('0x40')](_0x334c('0x78'),squel[_0x334c('0x6d')]()[_0x334c('0x6e')](_0x334c('0x79'))['from'](_0x334c('0x7a'))[_0x334c('0x40')](_0x334c('0x7b'),_0x2b2c68[_0x334c('0x4a')]['id']['toString']()))[_0x334c('0x40')](_0x334c('0x78'),squel['select']()['field'](_0x334c('0x7c'))[_0x334c('0x73')](_0x334c('0x68'))[_0x334c('0x40')](_0x334c('0x7b'),_0x2b2c68[_0x334c('0x4a')]['id'][_0x334c('0x72')]())))[_0x334c('0x72')]();break;case _0x334c('0x7d'):_0x8f0b5e=squel[_0x334c('0x66')]()['into'](_0x334c('0x68'))[_0x334c('0x7e')](['phone',_0x334c('0x70'),_0x334c('0x6a'),_0x334c('0x6b'),'CampaignId',_0x334c('0x6c'),_0x334c('0x56')],squel['select']()[_0x334c('0x6e')](_0x334c('0x69'),_0x334c('0x69'))['field'](_0x334c('0x6f'),_0x334c('0x70'))['field']('id',_0x334c('0x6a'))['field'](_0x3e736b['CmListId'][_0x334c('0x72')](),_0x334c('0x6b'))[_0x334c('0x6e')](_0x2b2c68['params']['id'][_0x334c('0x72')](),_0x334c('0x59'))[_0x334c('0x6e')](_0x334c('0x6f'),'createdAt')['field'](_0x334c('0x6f'),_0x334c('0x56'))[_0x334c('0x73')](_0x334c('0x74'))[_0x334c('0x40')](_0x334c('0x75'))[_0x334c('0x40')]('ListId\x20=\x20?',_0x3e736b[_0x334c('0x71')][_0x334c('0x72')]())[_0x334c('0x40')](_0x334c('0x77'))[_0x334c('0x40')](_0x334c('0x78'),squel[_0x334c('0x6d')]()[_0x334c('0x6e')]('COALESCE(phone,\x27\x27)')['from'](_0x334c('0x68'))[_0x334c('0x40')](_0x334c('0x7b'),_0x2b2c68['params']['id']['toString']())))[_0x334c('0x72')]();break;default:_0x8f0b5e=squel[_0x334c('0x66')]()['into']('cm_hopper')[_0x334c('0x7e')](['phone',_0x334c('0x70'),_0x334c('0x6a'),_0x334c('0x6b'),_0x334c('0x59'),_0x334c('0x6c'),_0x334c('0x56')],squel[_0x334c('0x6d')]()[_0x334c('0x6e')](_0x334c('0x69'),'phone')[_0x334c('0x6e')](_0x334c('0x6f'),_0x334c('0x70'))[_0x334c('0x6e')]('id',_0x334c('0x6a'))[_0x334c('0x6e')](_0x3e736b[_0x334c('0x71')]['toString'](),_0x334c('0x6b'))[_0x334c('0x6e')](_0x2b2c68[_0x334c('0x4a')]['id'][_0x334c('0x72')](),_0x334c('0x59'))[_0x334c('0x6e')](_0x334c('0x6f'),'createdAt')['field'](_0x334c('0x6f'),_0x334c('0x56'))[_0x334c('0x73')](_0x334c('0x74'))[_0x334c('0x40')](_0x334c('0x75'))[_0x334c('0x40')](_0x334c('0x76'),_0x3e736b[_0x334c('0x71')][_0x334c('0x72')]())[_0x334c('0x40')](_0x334c('0x77')))[_0x334c('0x72')]();}_0x5d5555[_0x334c('0x7f')](db['sequelize']['query'](_0x8f0b5e));}return BPromise[_0x334c('0x80')](_0x5d5555);}})[_0x334c('0x23')](function(){return _0x44934a;})[_0x334c('0x23')](respondWithResult(_0x5687d1,null))['catch'](handleError(_0x5687d1,null));};exports['removeLists']=function(_0x29587a,_0x115860,_0x1dde90){return db[_0x334c('0x2f')][_0x334c('0x4b')]({'where':{'id':_0x29587a[_0x334c('0x4a')]['id']}})[_0x334c('0x23')](handleEntityNotFound(_0x115860,null))[_0x334c('0x23')](function(_0x5368dd){if(_0x5368dd){return _0x5368dd[_0x334c('0x81')](_0x29587a['query'][_0x334c('0x63')]);}})[_0x334c('0x23')](function(_0x2f111f){if(_0x2f111f){return db[_0x334c('0x5a')][_0x334c('0x24')]({'where':{'ListId':_0x29587a[_0x334c('0x35')][_0x334c('0x63')],'CampaignId':_0x29587a[_0x334c('0x4a')]['id']}})[_0x334c('0x23')](function(){return _0x2f111f;});}})[_0x334c('0x23')](respondWithStatusCode(_0x115860,null))['catch'](handleError(_0x115860,null));};exports[_0x334c('0x82')]=function(_0x475c21,_0x44f645,_0xa716f1){var _0x10fc4e={'raw':!![],'where':{}};var _0x444ce2={};var _0x1a8b3b={'count':0x0,'rows':[]};return db[_0x334c('0x2f')][_0x334c('0x58')]({'where':{'id':_0x475c21['params']['id']}})[_0x334c('0x23')](handleEntityNotFound(_0x44f645,null))[_0x334c('0x23')](function(_0x77add1){if(_0x77add1){_0x444ce2[_0x334c('0x34')]=_[_0x334c('0x36')](db[_0x334c('0x62')][_0x334c('0x30')]);_0x444ce2[_0x334c('0x35')]=_[_0x334c('0x36')](_0x475c21[_0x334c('0x35')]);_0x444ce2[_0x334c('0x37')]=_[_0x334c('0x39')](_0x444ce2['model'],_0x444ce2[_0x334c('0x35')]);_0x10fc4e[_0x334c('0x38')]=_[_0x334c('0x39')](_0x444ce2[_0x334c('0x34')],qs['fields'](_0x475c21[_0x334c('0x35')]['fields']));_0x10fc4e[_0x334c('0x38')]=_0x10fc4e[_0x334c('0x38')][_0x334c('0x3b')]?_0x10fc4e['attributes']:_0x444ce2[_0x334c('0x34')];if(!_0x475c21[_0x334c('0x35')][_0x334c('0x3c')]('nolimit')){_0x10fc4e[_0x334c('0x1e')]=qs['limit'](_0x475c21[_0x334c('0x35')][_0x334c('0x1e')]);_0x10fc4e[_0x334c('0x1d')]=qs[_0x334c('0x1d')](_0x475c21[_0x334c('0x35')][_0x334c('0x1d')]);}_0x10fc4e['order']=qs[_0x334c('0x3f')](_0x475c21['query'][_0x334c('0x3f')]);_0x10fc4e['where']=qs[_0x334c('0x37')](_[_0x334c('0x41')](_0x475c21['query'],_0x444ce2[_0x334c('0x37')]));_0x10fc4e[_0x334c('0x40')][_0x334c('0x59')]=_0x77add1['id'];if(_0x475c21[_0x334c('0x35')][_0x334c('0x42')]){_0x10fc4e['where']=_['merge'](_0x10fc4e[_0x334c('0x40')],{'$or':_[_0x334c('0x2e')](_0x10fc4e[_0x334c('0x38')],function(_0x3841e6){var _0x2ca78b={};_0x2ca78b[_0x3841e6]={'$like':'%'+_0x475c21[_0x334c('0x35')][_0x334c('0x42')]+'%'};return _0x2ca78b;})});}_0x10fc4e=_['merge']({},_0x10fc4e,_0x475c21[_0x334c('0x44')]);return db[_0x334c('0x62')][_0x334c('0x1c')]({'where':_0x10fc4e[_0x334c('0x40')]})[_0x334c('0x23')](function(_0xdfa43){_0x1a8b3b[_0x334c('0x1c')]=_0xdfa43;if(_0x475c21[_0x334c('0x35')][_0x334c('0x45')]){_0x10fc4e[_0x334c('0x46')]=[{'all':!![]}];}return db[_0x334c('0x62')]['findAll'](_0x10fc4e);})['then'](function(_0x2bc9a2){_0x1a8b3b['rows']=_0x2bc9a2;return _0x1a8b3b;});}})[_0x334c('0x23')](respondWithFilteredResult(_0x44f645,_0x10fc4e))[_0x334c('0x48')](handleError(_0x44f645,null));};exports['addBlackLists']=function(_0x1c2b04,_0x50edfe,_0x293eda){var _0x325526,_0x2291eb;return db[_0x334c('0x2f')][_0x334c('0x4b')]({'where':{'id':_0x1c2b04[_0x334c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x50edfe,null))['then'](function(_0x42a136){if(_0x42a136){_0x2291eb=_0x42a136;return _0x42a136[_0x334c('0x83')](_0x1c2b04[_0x334c('0x4d')][_0x334c('0x63')],_[_0x334c('0x55')](_0x1c2b04[_0x334c('0x4d')],[_0x334c('0x63'),'id'])||{});}return null;})[_0x334c('0x64')](function(_0x27f294){var _0x18266b;_0x325526=_0x27f294||[];var _0x291c24=[];if(_0x27f294){for(var _0x2ab0c6=0x0;_0x2ab0c6<_0x27f294[_0x334c('0x3b')];_0x2ab0c6+=0x1){var _0x1d43e8=_0x27f294[_0x2ab0c6][_0x334c('0x25')]({'plain':!![]});_0x18266b=squel[_0x334c('0x66')]()[_0x334c('0x67')](_0x334c('0x84'))[_0x334c('0x7e')]([_0x334c('0x69'),'ContactId',_0x334c('0x6b'),'CampaignId',_0x334c('0x6c'),_0x334c('0x56')],squel[_0x334c('0x6d')]()[_0x334c('0x6e')]('phone','phone')['field']('id',_0x334c('0x6a'))[_0x334c('0x6e')](_0x1d43e8[_0x334c('0x71')][_0x334c('0x72')](),_0x334c('0x6b'))['field'](_0x1c2b04[_0x334c('0x4a')]['id'][_0x334c('0x72')](),_0x334c('0x59'))['field']('NOW()','createdAt')[_0x334c('0x6e')]('NOW()',_0x334c('0x56'))[_0x334c('0x73')](_0x334c('0x74'))[_0x334c('0x40')](_0x334c('0x75'))[_0x334c('0x40')]('ListId\x20=\x20?',_0x1d43e8[_0x334c('0x71')][_0x334c('0x72')]())[_0x334c('0x40')](_0x334c('0x77')))['toString']();_0x291c24[_0x334c('0x7f')](db[_0x334c('0x85')][_0x334c('0x35')](_0x18266b));}return BPromise[_0x334c('0x80')](_0x291c24);}})[_0x334c('0x23')](function(){return _0x325526;})[_0x334c('0x23')](respondWithResult(_0x50edfe,null))['catch'](handleError(_0x50edfe,null));};exports[_0x334c('0x86')]=function(_0x122dd3,_0x248e54,_0x49ba4e){return db[_0x334c('0x2f')][_0x334c('0x4b')]({'where':{'id':_0x122dd3['params']['id']}})['then'](handleEntityNotFound(_0x248e54,null))[_0x334c('0x23')](function(_0x13521b){if(_0x13521b){return _0x13521b[_0x334c('0x86')](_0x122dd3[_0x334c('0x35')][_0x334c('0x63')]);}})[_0x334c('0x23')](function(_0x2cf8fc){if(_0x2cf8fc){return db['CmHopperBlack'][_0x334c('0x24')]({'where':{'ListId':_0x122dd3[_0x334c('0x35')][_0x334c('0x63')],'CampaignId':_0x122dd3[_0x334c('0x4a')]['id']}})[_0x334c('0x23')](function(){return _0x2cf8fc;});}})[_0x334c('0x23')](respondWithStatusCode(_0x248e54,null))['catch'](handleError(_0x248e54,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 4decc6e..9636298 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 _0xdaf1=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./campaign.attributes','Campaign','campaigns'];(function(_0x5b34c8,_0x424a2b){var _0x569f3b=function(_0x5dd227){while(--_0x5dd227){_0x5b34c8['push'](_0x5b34c8['shift']());}};_0x569f3b(++_0x424a2b);}(_0xdaf1,0x1bc));var _0x1daf=function(_0x1081cf,_0x31b91f){_0x1081cf=_0x1081cf-0x0;var _0x17ef66=_0xdaf1[_0x1081cf];return _0x17ef66;};'use strict';var _=require('lodash');var util=require(_0x1daf('0x0'));var logger=require(_0x1daf('0x1'))(_0x1daf('0x2'));var moment=require(_0x1daf('0x3'));var BPromise=require(_0x1daf('0x4'));var rp=require(_0x1daf('0x5'));var fs=require('fs');var path=require(_0x1daf('0x6'));var rimraf=require(_0x1daf('0x7'));var config=require(_0x1daf('0x8'));var attributes=require(_0x1daf('0x9'));module['exports']=function(_0x3d49c2,_0x15139d){return _0x3d49c2['define'](_0x1daf('0xa'),attributes,{'tableName':_0x1daf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb0b8=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','Campaign','campaigns'];(function(_0x3b86f9,_0x49264b){var _0x28c997=function(_0xc3d1cf){while(--_0xc3d1cf){_0x3b86f9['push'](_0x3b86f9['shift']());}};_0x28c997(++_0x49264b);}(_0xb0b8,0x186));var _0x8b0b=function(_0x2bf466,_0x4929a5){_0x2bf466=_0x2bf466-0x0;var _0x856885=_0xb0b8[_0x2bf466];return _0x856885;};'use strict';var _=require(_0x8b0b('0x0'));var util=require(_0x8b0b('0x1'));var logger=require(_0x8b0b('0x2'))(_0x8b0b('0x3'));var moment=require(_0x8b0b('0x4'));var BPromise=require('bluebird');var rp=require(_0x8b0b('0x5'));var fs=require('fs');var path=require(_0x8b0b('0x6'));var rimraf=require(_0x8b0b('0x7'));var config=require(_0x8b0b('0x8'));var attributes=require('./campaign.attributes');module[_0x8b0b('0x9')]=function(_0x5bbb06,_0x209a28){return _0x5bbb06[_0x8b0b('0xa')](_0x8b0b('0xb'),attributes,{'tableName':_0x8b0b('0xc'),'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 8d67a09..92d04d9 100644 --- a/server/api/campaign/campaign.rpc.js +++ b/server/api/campaign/campaign.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['catch','GetCampaign','findAll','raw','options','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x40236e,_0x2b5c76){var _0x3d61d1=function(_0x369469){while(--_0x369469){_0x40236e['push'](_0x40236e['shift']());}};_0x3d61d1(++_0x2b5c76);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file +var _0xa9e0=['catch','Campaign','findAll','options','raw','where','attributes','include','map','model','GetCampaign','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0x497c86,_0x48cb1e){var _0x5ed108=function(_0x3ce1cb){while(--_0x3ce1cb){_0x497c86['push'](_0x497c86['shift']());}};_0x5ed108(++_0x48cb1e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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 e6f7c0f..6dcfed0 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 _0x3789=['addLists','addBlackLists','put','/:id','update','destroy','delete','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','getLists','getBlackLists','post','create','/:id/clone','/:id/lists'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x3789,0xe2));var _0x9378=function(_0x409bd8,_0x3ca346){_0x409bd8=_0x409bd8-0x0;var _0xb82592=_0x3789[_0x409bd8];return _0xb82592;};'use strict';var multer=require(_0x9378('0x0'));var util=require(_0x9378('0x1'));var path=require(_0x9378('0x2'));var timeout=require(_0x9378('0x3'));var express=require(_0x9378('0x4'));var router=express[_0x9378('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x9378('0x6'));var config=require(_0x9378('0x7'));var controller=require(_0x9378('0x8'));router[_0x9378('0x9')]('/',auth[_0x9378('0xa')](),controller[_0x9378('0xb')]);router[_0x9378('0x9')]('/:id',auth[_0x9378('0xa')](),controller[_0x9378('0xc')]);router[_0x9378('0x9')](_0x9378('0xd'),auth['isAuthenticated'](),controller[_0x9378('0xe')]);router[_0x9378('0x9')](_0x9378('0xf'),auth['isAuthenticated'](),controller[_0x9378('0x10')]);router[_0x9378('0x9')](_0x9378('0x11'),auth[_0x9378('0xa')](),controller['getHopperFinals']);router[_0x9378('0x9')](_0x9378('0x12'),auth[_0x9378('0xa')](),controller[_0x9378('0x13')]);router[_0x9378('0x9')]('/:id/lists',auth[_0x9378('0xa')](),controller[_0x9378('0x14')]);router['get']('/:id/blacklists',auth[_0x9378('0xa')](),controller[_0x9378('0x15')]);router[_0x9378('0x16')]('/',auth[_0x9378('0xa')](),controller[_0x9378('0x17')]);router[_0x9378('0x16')](_0x9378('0x18'),auth['isAuthenticated'](),controller['clone']);router['post'](_0x9378('0x19'),auth['isAuthenticated'](),controller[_0x9378('0x1a')]);router[_0x9378('0x16')]('/:id/blacklists',auth[_0x9378('0xa')](),controller[_0x9378('0x1b')]);router[_0x9378('0x1c')](_0x9378('0x1d'),auth['isAuthenticated'](),controller[_0x9378('0x1e')]);router['delete'](_0x9378('0x1d'),auth['isAuthenticated'](),controller[_0x9378('0x1f')]);router[_0x9378('0x20')](_0x9378('0x19'),auth[_0x9378('0xa')](),controller[_0x9378('0x21')]);router[_0x9378('0x20')]('/:id/blacklists',auth[_0x9378('0xa')](),controller[_0x9378('0x22')]);module[_0x9378('0x23')]=router; \ No newline at end of file +var _0x70e3=['clone','addLists','/:id/blacklists','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../config/environment','get','isAuthenticated','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','getBlackLists','post','/:id/clone'];(function(_0x1731a9,_0x4fb551){var _0x22b9a5=function(_0x3b62fd){while(--_0x3b62fd){_0x1731a9['push'](_0x1731a9['shift']());}};_0x22b9a5(++_0x4fb551);}(_0x70e3,0x117));var _0x370e=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x70e3[_0x465028];return _0xb783d4;};'use strict';var multer=require(_0x370e('0x0'));var util=require(_0x370e('0x1'));var path=require(_0x370e('0x2'));var timeout=require(_0x370e('0x3'));var express=require('express');var router=express[_0x370e('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x370e('0x5'));var controller=require('./campaign.controller');router[_0x370e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x370e('0x7')](),controller['show']);router[_0x370e('0x6')](_0x370e('0x8'),auth[_0x370e('0x7')](),controller[_0x370e('0x9')]);router['get'](_0x370e('0xa'),auth[_0x370e('0x7')](),controller[_0x370e('0xb')]);router['get'](_0x370e('0xc'),auth[_0x370e('0x7')](),controller[_0x370e('0xd')]);router[_0x370e('0x6')](_0x370e('0xe'),auth[_0x370e('0x7')](),controller[_0x370e('0xf')]);router['get'](_0x370e('0x10'),auth[_0x370e('0x7')](),controller[_0x370e('0x11')]);router['get']('/:id/blacklists',auth['isAuthenticated'](),controller[_0x370e('0x12')]);router[_0x370e('0x13')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x370e('0x14'),auth[_0x370e('0x7')](),controller[_0x370e('0x15')]);router['post']('/:id/lists',auth['isAuthenticated'](),controller[_0x370e('0x16')]);router[_0x370e('0x13')](_0x370e('0x17'),auth[_0x370e('0x7')](),controller['addBlackLists']);router[_0x370e('0x18')](_0x370e('0x19'),auth[_0x370e('0x7')](),controller[_0x370e('0x1a')]);router[_0x370e('0x1b')](_0x370e('0x19'),auth['isAuthenticated'](),controller[_0x370e('0x1c')]);router[_0x370e('0x1b')](_0x370e('0x10'),auth[_0x370e('0x7')](),controller['removeLists']);router[_0x370e('0x1b')](_0x370e('0x17'),auth['isAuthenticated'](),controller['removeBlackLists']);module[_0x370e('0x1d')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 1b3e8a2..93c8879 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 _0xc8de=['STRING','VIRTUAL','key','sequelize','exports','TEXT'];(function(_0x44268d,_0xad8443){var _0x4be92d=function(_0x8a57ff){while(--_0x8a57ff){_0x44268d['push'](_0x44268d['shift']());}};_0x4be92d(++_0xad8443);}(_0xc8de,0x135));var _0xec8d=function(_0x4973ca,_0x556d8a){_0x4973ca=_0x4973ca-0x0;var _0x24a142=_0xc8de[_0x4973ca];return _0x24a142;};'use strict';var Sequelize=require(_0xec8d('0x0'));module[_0xec8d('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xec8d('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xec8d('0x3')]},'name':{'type':Sequelize[_0xec8d('0x4')],'get':function(){return this['getDataValue'](_0xec8d('0x5'));}}}; \ No newline at end of file +var _0x8382=['key','sequelize','exports','STRING','VIRTUAL'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8382,0x15a));var _0x2838=function(_0x1b7523,_0x48f2f5){_0x1b7523=_0x1b7523-0x0;var _0x12532f=_0x8382[_0x1b7523];return _0x12532f;};'use strict';var Sequelize=require(_0x2838('0x0'));module[_0x2838('0x1')]={'key':{'type':Sequelize[_0x2838('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x2838('0x3')],'get':function(){return this['getDataValue'](_0x2838('0x4'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index ce76c40..139c4d2 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 _0x1eff=['options','includeAll','include','findAll','rows','show','params','find','catch','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','CannedAnswers','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','moment','bluebird','util','path','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','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','error','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL'];(function(_0x5606c0,_0xf27c2){var _0x535e89=function(_0x49c2fc){while(--_0x49c2fc){_0x5606c0['push'](_0x5606c0['shift']());}};_0x535e89(++_0xf27c2);}(_0x1eff,0x1da));var _0xf1ef=function(_0x37563b,_0x5188d7){_0x37563b=_0x37563b-0x0;var _0x2b2778=_0x1eff[_0x37563b];return _0x2b2778;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf1ef('0x0'));var rimraf=require(_0xf1ef('0x1'));var zipdir=require(_0xf1ef('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf1ef('0x3'));var BPromise=require(_0xf1ef('0x4'));var Mustache=require('mustache');var util=require(_0xf1ef('0x5'));var path=require(_0xf1ef('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf1ef('0x7'));var fs=require('fs');var _=require(_0xf1ef('0x8'));var squel=require(_0xf1ef('0x9'));var crypto=require(_0xf1ef('0xa'));var jsforce=require(_0xf1ef('0xb'));var deskjs=require(_0xf1ef('0xc'));var toCsv=require(_0xf1ef('0xd'));var querystring=require(_0xf1ef('0xe'));var Papa=require(_0xf1ef('0xf'));var Redis=require(_0xf1ef('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf1ef('0x11'));var as=require(_0xf1ef('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf1ef('0x13'))(_0xf1ef('0x14'));var utils=require(_0xf1ef('0x15'));var config=require(_0xf1ef('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55d9f0,_0x197cd3){_0x197cd3=_0x197cd3||0xcc;return function(_0x4c55d5){if(_0x4c55d5){return _0x55d9f0[_0xf1ef('0x17')](_0x197cd3);}return _0x55d9f0[_0xf1ef('0x18')](_0x197cd3)[_0xf1ef('0x19')]();};}function respondWithResult(_0x1d105d,_0xf95649){_0xf95649=_0xf95649||0xc8;return function(_0x3c1b13){if(_0x3c1b13){return _0x1d105d[_0xf1ef('0x18')](_0xf95649)[_0xf1ef('0x1a')](_0x3c1b13);}};}function respondWithFilteredResult(_0x314eca,_0x5344e9){return function(_0x4bf986){if(_0x4bf986){var _0x264c8b=_0x4bf986[_0xf1ef('0x1b')],_0xa2b2ed=_0x5344e9[_0xf1ef('0x1c')],_0x20b230=_0x5344e9[_0xf1ef('0x1c')]+_0x5344e9[_0xf1ef('0x1d')],_0x1fc6b5;if(_0x20b230>=_0x264c8b){_0x20b230=_0x264c8b;_0x1fc6b5=0xc8;}else{_0x1fc6b5=0xce;}_0x314eca['status'](_0x1fc6b5);return _0x314eca[_0xf1ef('0x1e')](_0xf1ef('0x1f'),_0xa2b2ed+'-'+_0x20b230+'/'+_0x264c8b)[_0xf1ef('0x1a')](_0x4bf986);}return null;};}function patchUpdates(_0x22fa70){return function(_0x26303c){try{jsonpatch[_0xf1ef('0x20')](_0x26303c,_0x22fa70,!![]);}catch(_0x3a448e){return BPromise['reject'](_0x3a448e);}return _0x26303c[_0xf1ef('0x21')]();};}function saveUpdates(_0x17329e,_0x3f3261){return function(_0x2699dc){if(_0x2699dc){return _0x2699dc[_0xf1ef('0x22')](_0x17329e)[_0xf1ef('0x23')](function(_0x261683){return _0x261683;});}return null;};}function removeEntity(_0x426ee7,_0x2730b1){return function(_0x141f18){if(_0x141f18){return _0x141f18[_0xf1ef('0x24')]()[_0xf1ef('0x23')](function(){var _0x574bc0=_0x141f18[_0xf1ef('0x25')]({'plain':!![]});var _0x404d05='CannedAnswers';return db['UserProfileResource'][_0xf1ef('0x24')]({'where':{'type':_0x404d05,'resourceId':_0x574bc0['id']}})[_0xf1ef('0x23')](function(){return _0x141f18;});})[_0xf1ef('0x23')](function(){_0x426ee7[_0xf1ef('0x18')](0xcc)[_0xf1ef('0x19')]();});}};}function handleEntityNotFound(_0x5ec5ef,_0x26c989){return function(_0x10cc92){if(!_0x10cc92){_0x5ec5ef[_0xf1ef('0x17')](0x194);}return _0x10cc92;};}function handleError(_0x2953d9,_0x886a5b){_0x886a5b=_0x886a5b||0x1f4;return function(_0x388e78){logger[_0xf1ef('0x26')](_0x388e78[_0xf1ef('0x27')]);if(_0x388e78[_0xf1ef('0x28')]){delete _0x388e78[_0xf1ef('0x28')];}_0x2953d9[_0xf1ef('0x18')](_0x886a5b)[_0xf1ef('0x29')](_0x388e78);};}exports[_0xf1ef('0x2a')]=function(_0x521a70,_0x4e10d4){var _0x254c87={},_0x15db70={},_0x57592c={'count':0x0,'rows':[]};var _0x2859c2=_[_0xf1ef('0x2b')](db[_0xf1ef('0x2c')][_0xf1ef('0x2d')],function(_0x55b121){return{'name':_0x55b121[_0xf1ef('0x2e')],'type':_0x55b121['type'][_0xf1ef('0x2f')]};});_0x15db70[_0xf1ef('0x30')]=_[_0xf1ef('0x2b')](_0x2859c2,_0xf1ef('0x28'));_0x15db70[_0xf1ef('0x31')]=_[_0xf1ef('0x32')](_0x521a70['query']);_0x15db70[_0xf1ef('0x33')]=_['intersection'](_0x15db70[_0xf1ef('0x30')],_0x15db70[_0xf1ef('0x31')]);_0x254c87[_0xf1ef('0x34')]=_[_0xf1ef('0x35')](_0x15db70['model'],qs[_0xf1ef('0x36')](_0x521a70[_0xf1ef('0x31')][_0xf1ef('0x36')]));_0x254c87['attributes']=_0x254c87[_0xf1ef('0x34')][_0xf1ef('0x37')]?_0x254c87[_0xf1ef('0x34')]:_0x15db70[_0xf1ef('0x30')];if(!_0x521a70[_0xf1ef('0x31')][_0xf1ef('0x38')](_0xf1ef('0x39'))){_0x254c87[_0xf1ef('0x1d')]=qs['limit'](_0x521a70[_0xf1ef('0x31')]['limit']);_0x254c87[_0xf1ef('0x1c')]=qs['offset'](_0x521a70[_0xf1ef('0x31')][_0xf1ef('0x1c')]);}_0x254c87[_0xf1ef('0x3a')]=qs[_0xf1ef('0x3b')](_0x521a70[_0xf1ef('0x31')][_0xf1ef('0x3b')]);_0x254c87['where']=qs[_0xf1ef('0x33')](_[_0xf1ef('0x3c')](_0x521a70[_0xf1ef('0x31')],_0x15db70[_0xf1ef('0x33')]),_0x2859c2);if(_0x521a70[_0xf1ef('0x31')][_0xf1ef('0x3d')]){_0x254c87['where']=_[_0xf1ef('0x3e')](_0x254c87[_0xf1ef('0x3f')],{'$or':_['map'](_0x2859c2,function(_0x480692){if(_0x480692[_0xf1ef('0x40')]!==_0xf1ef('0x41')){var _0x37a627={};_0x37a627[_0x480692[_0xf1ef('0x28')]]={'$like':'%'+_0x521a70['query'][_0xf1ef('0x3d')]+'%'};return _0x37a627;}})});}_0x254c87=_[_0xf1ef('0x3e')]({},_0x254c87,_0x521a70[_0xf1ef('0x42')]);var _0x181b8b={'where':_0x254c87[_0xf1ef('0x3f')]};return db['CannedAnswer'][_0xf1ef('0x1b')](_0x181b8b)[_0xf1ef('0x23')](function(_0x161805){_0x57592c[_0xf1ef('0x1b')]=_0x161805;if(_0x521a70[_0xf1ef('0x31')][_0xf1ef('0x43')]){_0x254c87[_0xf1ef('0x44')]=[{'all':!![]}];}return db['CannedAnswer'][_0xf1ef('0x45')](_0x254c87);})[_0xf1ef('0x23')](function(_0x255e0b){_0x57592c[_0xf1ef('0x46')]=_0x255e0b;return _0x57592c;})[_0xf1ef('0x23')](respondWithFilteredResult(_0x4e10d4,_0x254c87))['catch'](handleError(_0x4e10d4,null));};exports[_0xf1ef('0x47')]=function(_0x305109,_0x3aa880){var _0xea1df8={'raw':!![],'where':{'id':_0x305109[_0xf1ef('0x48')]['id']}},_0x1f8b4a={};_0x1f8b4a['model']=_[_0xf1ef('0x32')](db['CannedAnswer']['rawAttributes']);_0x1f8b4a[_0xf1ef('0x31')]=_[_0xf1ef('0x32')](_0x305109['query']);_0x1f8b4a[_0xf1ef('0x33')]=_[_0xf1ef('0x35')](_0x1f8b4a[_0xf1ef('0x30')],_0x1f8b4a[_0xf1ef('0x31')]);_0xea1df8[_0xf1ef('0x34')]=_[_0xf1ef('0x35')](_0x1f8b4a[_0xf1ef('0x30')],qs[_0xf1ef('0x36')](_0x305109[_0xf1ef('0x31')][_0xf1ef('0x36')]));_0xea1df8['attributes']=_0xea1df8[_0xf1ef('0x34')][_0xf1ef('0x37')]?_0xea1df8[_0xf1ef('0x34')]:_0x1f8b4a[_0xf1ef('0x30')];if(_0x305109[_0xf1ef('0x31')][_0xf1ef('0x43')]){_0xea1df8[_0xf1ef('0x44')]=[{'all':!![]}];}_0xea1df8=_['merge']({},_0xea1df8,_0x305109[_0xf1ef('0x42')]);return db[_0xf1ef('0x2c')][_0xf1ef('0x49')](_0xea1df8)[_0xf1ef('0x23')](handleEntityNotFound(_0x3aa880,null))['then'](respondWithResult(_0x3aa880,null))[_0xf1ef('0x4a')](handleError(_0x3aa880,null));};exports[_0xf1ef('0x22')]=function(_0x20ef75,_0x1c466e){if(_0x20ef75[_0xf1ef('0x4b')]['id']){delete _0x20ef75['body']['id'];}return db['CannedAnswer'][_0xf1ef('0x49')]({'where':{'id':_0x20ef75[_0xf1ef('0x48')]['id']}})[_0xf1ef('0x23')](handleEntityNotFound(_0x1c466e,null))[_0xf1ef('0x23')](saveUpdates(_0x20ef75[_0xf1ef('0x4b')],null))['then'](respondWithResult(_0x1c466e,null))[_0xf1ef('0x4a')](handleError(_0x1c466e,null));};exports[_0xf1ef('0x24')]=function(_0x44b414,_0x23034b){return db[_0xf1ef('0x2c')][_0xf1ef('0x49')]({'where':{'id':_0x44b414[_0xf1ef('0x48')]['id']}})[_0xf1ef('0x23')](handleEntityNotFound(_0x23034b,null))[_0xf1ef('0x23')](removeEntity(_0x23034b,null))['catch'](handleError(_0x23034b,null));};exports[_0xf1ef('0x4c')]=function(_0x3c5336,_0x5b8df3){var _0x1ac815={'key':_0x3c5336['body']['key']};if(_0x3c5336['body'][_0xf1ef('0x4d')]){_0x1ac815[_0xf1ef('0x4d')]=_0x3c5336[_0xf1ef('0x4b')][_0xf1ef('0x4d')];}else if(_0x3c5336['body']['SmsAccountId']){_0x1ac815['SmsAccountId']=_0x3c5336['body'][_0xf1ef('0x4e')];}else if(_0x3c5336[_0xf1ef('0x4b')]['OpenchannelAccountId']){_0x1ac815[_0xf1ef('0x4f')]=_0x3c5336[_0xf1ef('0x4b')]['OpenchannelAccountId'];}else if(_0x3c5336['body'][_0xf1ef('0x50')]){_0x1ac815[_0xf1ef('0x50')]=_0x3c5336[_0xf1ef('0x4b')][_0xf1ef('0x50')];}return db[_0xf1ef('0x2c')][_0xf1ef('0x49')]({'where':_0x1ac815})[_0xf1ef('0x23')](function(_0x3b6e6f){if(_0x3b6e6f){throw new db['Sequelize']['ValidationError'](_0xf1ef('0x51'));}return db[_0xf1ef('0x2c')][_0xf1ef('0x4c')](_0x3c5336['body']);})['then'](function(_0x4d16ab){var _0x134b72=_0x3c5336[_0xf1ef('0x52')]['get']({'plain':!![]});if(!_0x134b72)throw new Error(_0xf1ef('0x53'));if(_0x134b72[_0xf1ef('0x54')]===_0xf1ef('0x52')){var _0x5584bb=_0x4d16ab['get']({'plain':!![]});return db[_0xf1ef('0x55')][_0xf1ef('0x49')]({'where':{'name':_0xf1ef('0x56'),'userProfileId':_0x134b72['userProfileId']},'raw':!![]})[_0xf1ef('0x23')](function(_0x1555f7){if(_0x1555f7&&_0x1555f7[_0xf1ef('0x57')]===0x0){return db[_0xf1ef('0x58')][_0xf1ef('0x4c')]({'name':_0x5584bb['name'],'resourceId':_0x5584bb['id'],'type':_0x1555f7[_0xf1ef('0x28')],'sectionId':_0x1555f7['id']},{})[_0xf1ef('0x23')](function(){return _0x4d16ab;});}else{return _0x4d16ab;}})[_0xf1ef('0x4a')](function(_0x13d4ec){logger['error'](_0xf1ef('0x59'),_0x13d4ec);throw _0x13d4ec;});}return _0x4d16ab;})[_0xf1ef('0x23')](respondWithResult(_0x5b8df3,0xc9))[_0xf1ef('0x4a')](handleError(_0x5b8df3,null));}; \ No newline at end of file +var _0x1234=['MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','set','Content-Range','json','reject','then','destroy','get','CannedAnswers','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','VIRTUAL','CannedAnswer','count','include','findAll','catch','show','params','includeAll','options','update','body','find','create'];(function(_0x59c06f,_0x530289){var _0x4cba24=function(_0x8a0a45){while(--_0x8a0a45){_0x59c06f['push'](_0x59c06f['shift']());}};_0x4cba24(++_0x530289);}(_0x1234,0x14f));var _0x4123=function(_0x3f980c,_0x143f85){_0x3f980c=_0x3f980c-0x0;var _0x97bef=_0x1234[_0x3f980c];return _0x97bef;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x4123('0x0'));var zipdir=require(_0x4123('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4123('0x2'));var moment=require('moment');var BPromise=require(_0x4123('0x3'));var Mustache=require('mustache');var util=require(_0x4123('0x4'));var path=require(_0x4123('0x5'));var sox=require(_0x4123('0x6'));var csv=require(_0x4123('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x4123('0x8'));var jsforce=require(_0x4123('0x9'));var deskjs=require(_0x4123('0xa'));var toCsv=require(_0x4123('0x7'));var querystring=require('querystring');var Papa=require(_0x4123('0xb'));var Redis=require('ioredis');var authService=require(_0x4123('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4123('0xd'));var logger=require('../../config/logger')(_0x4123('0xe'));var utils=require(_0x4123('0xf'));var config=require(_0x4123('0x10'));var db=require(_0x4123('0x11'))['db'];function respondWithStatusCode(_0x3ddfb9,_0x515979){_0x515979=_0x515979||0xcc;return function(_0x5a565a){if(_0x5a565a){return _0x3ddfb9[_0x4123('0x12')](_0x515979);}return _0x3ddfb9[_0x4123('0x13')](_0x515979)[_0x4123('0x14')]();};}function respondWithResult(_0x5c3dab,_0x2380bf){_0x2380bf=_0x2380bf||0xc8;return function(_0x596964){if(_0x596964){return _0x5c3dab['status'](_0x2380bf)['json'](_0x596964);}};}function respondWithFilteredResult(_0x1d0d60,_0x9158b7){return function(_0x4d01bb){if(_0x4d01bb){var _0x307518=_0x4d01bb['count'],_0x1677ae=_0x9158b7[_0x4123('0x15')],_0x131874=_0x9158b7['offset']+_0x9158b7['limit'],_0x574cd7;if(_0x131874>=_0x307518){_0x131874=_0x307518;_0x574cd7=0xc8;}else{_0x574cd7=0xce;}_0x1d0d60[_0x4123('0x13')](_0x574cd7);return _0x1d0d60[_0x4123('0x16')](_0x4123('0x17'),_0x1677ae+'-'+_0x131874+'/'+_0x307518)[_0x4123('0x18')](_0x4d01bb);}return null;};}function patchUpdates(_0x220e2a){return function(_0x180714){try{jsonpatch['apply'](_0x180714,_0x220e2a,!![]);}catch(_0x5cdbc6){return BPromise[_0x4123('0x19')](_0x5cdbc6);}return _0x180714['save']();};}function saveUpdates(_0x1f1b96,_0x460eae){return function(_0xf28c0a){if(_0xf28c0a){return _0xf28c0a['update'](_0x1f1b96)[_0x4123('0x1a')](function(_0x298b5d){return _0x298b5d;});}return null;};}function removeEntity(_0xe8f06f,_0x422940){return function(_0x2f3000){if(_0x2f3000){return _0x2f3000[_0x4123('0x1b')]()[_0x4123('0x1a')](function(){var _0x316770=_0x2f3000[_0x4123('0x1c')]({'plain':!![]});var _0x8ca797=_0x4123('0x1d');return db[_0x4123('0x1e')][_0x4123('0x1b')]({'where':{'type':_0x8ca797,'resourceId':_0x316770['id']}})[_0x4123('0x1a')](function(){return _0x2f3000;});})[_0x4123('0x1a')](function(){_0xe8f06f[_0x4123('0x13')](0xcc)[_0x4123('0x14')]();});}};}function handleEntityNotFound(_0x384ecf,_0x178d65){return function(_0x4c3ed0){if(!_0x4c3ed0){_0x384ecf[_0x4123('0x12')](0x194);}return _0x4c3ed0;};}function handleError(_0x44cc55,_0x388e87){_0x388e87=_0x388e87||0x1f4;return function(_0x2325a1){logger[_0x4123('0x1f')](_0x2325a1[_0x4123('0x20')]);if(_0x2325a1[_0x4123('0x21')]){delete _0x2325a1[_0x4123('0x21')];}_0x44cc55[_0x4123('0x13')](_0x388e87)[_0x4123('0x22')](_0x2325a1);};}exports['index']=function(_0x1b86a2,_0x1d08d4){var _0x2d2f5a={},_0x58139f={},_0x1eb12c={'count':0x0,'rows':[]};var _0x277db3=_[_0x4123('0x23')](db['CannedAnswer'][_0x4123('0x24')],function(_0x21bf99){return{'name':_0x21bf99[_0x4123('0x25')],'type':_0x21bf99[_0x4123('0x26')][_0x4123('0x27')]};});_0x58139f[_0x4123('0x28')]=_['map'](_0x277db3,'name');_0x58139f[_0x4123('0x29')]=_[_0x4123('0x2a')](_0x1b86a2[_0x4123('0x29')]);_0x58139f[_0x4123('0x2b')]=_[_0x4123('0x2c')](_0x58139f['model'],_0x58139f[_0x4123('0x29')]);_0x2d2f5a[_0x4123('0x2d')]=_[_0x4123('0x2c')](_0x58139f[_0x4123('0x28')],qs['fields'](_0x1b86a2[_0x4123('0x29')][_0x4123('0x2e')]));_0x2d2f5a[_0x4123('0x2d')]=_0x2d2f5a[_0x4123('0x2d')][_0x4123('0x2f')]?_0x2d2f5a[_0x4123('0x2d')]:_0x58139f['model'];if(!_0x1b86a2['query'][_0x4123('0x30')](_0x4123('0x31'))){_0x2d2f5a[_0x4123('0x32')]=qs[_0x4123('0x32')](_0x1b86a2[_0x4123('0x29')][_0x4123('0x32')]);_0x2d2f5a[_0x4123('0x15')]=qs['offset'](_0x1b86a2[_0x4123('0x29')][_0x4123('0x15')]);}_0x2d2f5a[_0x4123('0x33')]=qs[_0x4123('0x34')](_0x1b86a2[_0x4123('0x29')][_0x4123('0x34')]);_0x2d2f5a['where']=qs[_0x4123('0x2b')](_['pick'](_0x1b86a2[_0x4123('0x29')],_0x58139f[_0x4123('0x2b')]),_0x277db3);if(_0x1b86a2[_0x4123('0x29')][_0x4123('0x35')]){_0x2d2f5a[_0x4123('0x36')]=_[_0x4123('0x37')](_0x2d2f5a[_0x4123('0x36')],{'$or':_[_0x4123('0x23')](_0x277db3,function(_0x40b93f){if(_0x40b93f[_0x4123('0x26')]!==_0x4123('0x38')){var _0x1a44c0={};_0x1a44c0[_0x40b93f[_0x4123('0x21')]]={'$like':'%'+_0x1b86a2[_0x4123('0x29')]['filter']+'%'};return _0x1a44c0;}})});}_0x2d2f5a=_[_0x4123('0x37')]({},_0x2d2f5a,_0x1b86a2['options']);var _0xbc5cb9={'where':_0x2d2f5a[_0x4123('0x36')]};return db[_0x4123('0x39')][_0x4123('0x3a')](_0xbc5cb9)[_0x4123('0x1a')](function(_0x4cc8f4){_0x1eb12c[_0x4123('0x3a')]=_0x4cc8f4;if(_0x1b86a2[_0x4123('0x29')]['includeAll']){_0x2d2f5a[_0x4123('0x3b')]=[{'all':!![]}];}return db[_0x4123('0x39')][_0x4123('0x3c')](_0x2d2f5a);})[_0x4123('0x1a')](function(_0xffad3a){_0x1eb12c['rows']=_0xffad3a;return _0x1eb12c;})[_0x4123('0x1a')](respondWithFilteredResult(_0x1d08d4,_0x2d2f5a))[_0x4123('0x3d')](handleError(_0x1d08d4,null));};exports[_0x4123('0x3e')]=function(_0x389637,_0x2be0a8){var _0x546647={'raw':!![],'where':{'id':_0x389637[_0x4123('0x3f')]['id']}},_0x83b24a={};_0x83b24a[_0x4123('0x28')]=_[_0x4123('0x2a')](db[_0x4123('0x39')][_0x4123('0x24')]);_0x83b24a[_0x4123('0x29')]=_[_0x4123('0x2a')](_0x389637['query']);_0x83b24a[_0x4123('0x2b')]=_[_0x4123('0x2c')](_0x83b24a[_0x4123('0x28')],_0x83b24a['query']);_0x546647['attributes']=_[_0x4123('0x2c')](_0x83b24a['model'],qs[_0x4123('0x2e')](_0x389637[_0x4123('0x29')]['fields']));_0x546647['attributes']=_0x546647['attributes'][_0x4123('0x2f')]?_0x546647['attributes']:_0x83b24a[_0x4123('0x28')];if(_0x389637[_0x4123('0x29')][_0x4123('0x40')]){_0x546647[_0x4123('0x3b')]=[{'all':!![]}];}_0x546647=_['merge']({},_0x546647,_0x389637[_0x4123('0x41')]);return db[_0x4123('0x39')]['find'](_0x546647)[_0x4123('0x1a')](handleEntityNotFound(_0x2be0a8,null))['then'](respondWithResult(_0x2be0a8,null))['catch'](handleError(_0x2be0a8,null));};exports[_0x4123('0x42')]=function(_0x4bf6b9,_0x3dc8a0){if(_0x4bf6b9[_0x4123('0x43')]['id']){delete _0x4bf6b9[_0x4123('0x43')]['id'];}return db[_0x4123('0x39')]['find']({'where':{'id':_0x4bf6b9['params']['id']}})[_0x4123('0x1a')](handleEntityNotFound(_0x3dc8a0,null))['then'](saveUpdates(_0x4bf6b9['body'],null))[_0x4123('0x1a')](respondWithResult(_0x3dc8a0,null))[_0x4123('0x3d')](handleError(_0x3dc8a0,null));};exports['destroy']=function(_0x124694,_0x321aa1){return db[_0x4123('0x39')][_0x4123('0x44')]({'where':{'id':_0x124694['params']['id']}})[_0x4123('0x1a')](handleEntityNotFound(_0x321aa1,null))[_0x4123('0x1a')](removeEntity(_0x321aa1,null))[_0x4123('0x3d')](handleError(_0x321aa1,null));};exports[_0x4123('0x45')]=function(_0x29e229,_0x50bb58){var _0x4361c3={'key':_0x29e229['body'][_0x4123('0x27')]};if(_0x29e229['body'][_0x4123('0x46')]){_0x4361c3[_0x4123('0x46')]=_0x29e229[_0x4123('0x43')][_0x4123('0x46')];}else if(_0x29e229['body']['SmsAccountId']){_0x4361c3[_0x4123('0x47')]=_0x29e229[_0x4123('0x43')][_0x4123('0x47')];}else if(_0x29e229[_0x4123('0x43')][_0x4123('0x48')]){_0x4361c3[_0x4123('0x48')]=_0x29e229[_0x4123('0x43')]['OpenchannelAccountId'];}else if(_0x29e229[_0x4123('0x43')][_0x4123('0x49')]){_0x4361c3['ChatWebsiteId']=_0x29e229[_0x4123('0x43')][_0x4123('0x49')];}return db[_0x4123('0x39')][_0x4123('0x44')]({'where':_0x4361c3})[_0x4123('0x1a')](function(_0x3a467f){if(_0x3a467f){throw new db[(_0x4123('0x4a'))][(_0x4123('0x4b'))](_0x4123('0x4c'));}return db['CannedAnswer']['create'](_0x29e229['body']);})['then'](function(_0x5366b6){var _0x566b20=_0x29e229['user'][_0x4123('0x1c')]({'plain':!![]});if(!_0x566b20)throw new Error(_0x4123('0x4d'));if(_0x566b20['role']===_0x4123('0x4e')){var _0x5199c8=_0x5366b6['get']({'plain':!![]});return db['UserProfileSection'][_0x4123('0x44')]({'where':{'name':_0x4123('0x1d'),'userProfileId':_0x566b20['userProfileId']},'raw':!![]})[_0x4123('0x1a')](function(_0x4bf264){if(_0x4bf264&&_0x4bf264[_0x4123('0x4f')]===0x0){return db['UserProfileResource'][_0x4123('0x45')]({'name':_0x5199c8[_0x4123('0x21')],'resourceId':_0x5199c8['id'],'type':_0x4bf264[_0x4123('0x21')],'sectionId':_0x4bf264['id']},{})[_0x4123('0x1a')](function(){return _0x5366b6;});}else{return _0x5366b6;}})[_0x4123('0x3d')](function(_0x39e06e){logger[_0x4123('0x1f')](_0x4123('0x50'),_0x39e06e);throw _0x39e06e;});}return _0x5366b6;})['then'](respondWithResult(_0x50bb58,0xc9))[_0x4123('0x3d')](handleError(_0x50bb58,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index baa0931..9a1811e 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 _0x78c7=['../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x106a77,_0x47ecbc){var _0x57ae98=function(_0x87b01c){while(--_0x87b01c){_0x106a77['push'](_0x106a77['shift']());}};_0x57ae98(++_0x47ecbc);}(_0x78c7,0x1c1));var _0x778c=function(_0x556927,_0x34b53f){_0x556927=_0x556927-0x0;var _0x5f1235=_0x78c7[_0x556927];return _0x5f1235;};'use strict';var _=require('lodash');var util=require(_0x778c('0x0'));var logger=require(_0x778c('0x1'))(_0x778c('0x2'));var moment=require(_0x778c('0x3'));var BPromise=require(_0x778c('0x4'));var rp=require(_0x778c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x778c('0x6'));var attributes=require(_0x778c('0x7'));module[_0x778c('0x8')]=function(_0x4f4f2e,_0x2fdd0b){return _0x4f4f2e[_0x778c('0x9')](_0x778c('0xa'),attributes,{'tableName':_0x778c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x778c('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xa25b=['request-promise','path','rimraf','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','lodash','util','api','bluebird'];(function(_0x340756,_0xad31ae){var _0x2ef745=function(_0x59ffde){while(--_0x59ffde){_0x340756['push'](_0x340756['shift']());}};_0x2ef745(++_0xad31ae);}(_0xa25b,0x170));var _0xba25=function(_0x40ee72,_0x1a9991){_0x40ee72=_0x40ee72-0x0;var _0x3fad42=_0xa25b[_0x40ee72];return _0x3fad42;};'use strict';var _=require(_0xba25('0x0'));var util=require(_0xba25('0x1'));var logger=require('../../config/logger')(_0xba25('0x2'));var moment=require('moment');var BPromise=require(_0xba25('0x3'));var rp=require(_0xba25('0x4'));var fs=require('fs');var path=require(_0xba25('0x5'));var rimraf=require(_0xba25('0x6'));var config=require('../../config/environment');var attributes=require(_0xba25('0x7'));module[_0xba25('0x8')]=function(_0x55b5a7,_0xa2c83b){return _0x55b5a7[_0xba25('0x9')](_0xba25('0xa'),attributes,{'tableName':_0xba25('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index b810a5b..fbd529c 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 _0xcd7d=['result','util','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','request','then','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x43d6fc,_0x2cc3f3){var _0x79aec2=function(_0x270dbf){while(--_0x270dbf){_0x43d6fc['push'](_0x43d6fc['shift']());}};_0x79aec2(++_0x2cc3f3);}(_0xcd7d,0x1c1));var _0xdcd7=function(_0x374954,_0x18dc36){_0x374954=_0x374954-0x0;var _0x42073e=_0xcd7d[_0x374954];return _0x42073e;};'use strict';var _=require('lodash');var util=require(_0xdcd7('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdcd7('0x1'));var fs=require('fs');var Redis=require(_0xdcd7('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xdcd7('0x3'));var logger=require('../../config/logger')(_0xdcd7('0x4'));var config=require('../../config/environment');var jayson=require(_0xdcd7('0x5'));var client=jayson[_0xdcd7('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19b0b8,_0x33acef,_0x541680){return new BPromise(function(_0x380db1,_0x6c664d){return client[_0xdcd7('0x7')](_0x19b0b8,_0x541680)[_0xdcd7('0x8')](function(_0x580381){logger[_0xdcd7('0x9')](_0xdcd7('0xa'),_0x33acef,'request\x20sent');logger['debug']('CannedAnswer,\x20%s,\x20%s,\x20%s',_0x33acef,_0xdcd7('0xb'),JSON['stringify'](_0x580381));if(_0x580381[_0xdcd7('0xc')]){if(_0x580381['error'][_0xdcd7('0xd')]===0x1f4){logger[_0xdcd7('0xc')](_0xdcd7('0xa'),_0x33acef,_0x580381[_0xdcd7('0xc')]['message']);return _0x6c664d(_0x580381[_0xdcd7('0xc')][_0xdcd7('0xe')]);}logger['error'](_0xdcd7('0xa'),_0x33acef,_0x580381[_0xdcd7('0xc')][_0xdcd7('0xe')]);return _0x380db1(_0x580381['error'][_0xdcd7('0xe')]);}else{logger['info'](_0xdcd7('0xa'),_0x33acef,_0xdcd7('0xb'));_0x380db1(_0x580381[_0xdcd7('0xf')][_0xdcd7('0xe')]);}})['catch'](function(_0x1a4a2a){logger[_0xdcd7('0xc')](_0xdcd7('0xa'),_0x33acef,_0x1a4a2a);_0x6c664d(_0x1a4a2a);});});} \ No newline at end of file +var _0x7f88=['stringify','error','CannedAnswer,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent'];(function(_0xa2c6c9,_0x383b47){var _0x10ba06=function(_0x371127){while(--_0x371127){_0xa2c6c9['push'](_0xa2c6c9['shift']());}};_0x10ba06(++_0x383b47);}(_0x7f88,0x1eb));var _0x87f8=function(_0xb02077,_0x60b7bf){_0xb02077=_0xb02077-0x0;var _0x414f1a=_0x7f88[_0xb02077];return _0x414f1a;};'use strict';var _=require(_0x87f8('0x0'));var util=require('util');var moment=require(_0x87f8('0x1'));var BPromise=require(_0x87f8('0x2'));var rs=require(_0x87f8('0x3'));var fs=require('fs');var Redis=require(_0x87f8('0x4'));var db=require(_0x87f8('0x5'))['db'];var utils=require(_0x87f8('0x6'));var logger=require(_0x87f8('0x7'))(_0x87f8('0x8'));var config=require(_0x87f8('0x9'));var jayson=require(_0x87f8('0xa'));var client=jayson[_0x87f8('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x125cf2,_0x25bea9,_0xb31665){return new BPromise(function(_0x34afbe,_0x279e57){return client[_0x87f8('0xc')](_0x125cf2,_0xb31665)[_0x87f8('0xd')](function(_0x1ceac0){logger['info']('CannedAnswer,\x20%s,\x20%s',_0x25bea9,'request\x20sent');logger['debug']('CannedAnswer,\x20%s,\x20%s,\x20%s',_0x25bea9,_0x87f8('0xe'),JSON[_0x87f8('0xf')](_0x1ceac0));if(_0x1ceac0['error']){if(_0x1ceac0['error']['code']===0x1f4){logger[_0x87f8('0x10')](_0x87f8('0x11'),_0x25bea9,_0x1ceac0[_0x87f8('0x10')][_0x87f8('0x12')]);return _0x279e57(_0x1ceac0['error']['message']);}logger[_0x87f8('0x10')](_0x87f8('0x11'),_0x25bea9,_0x1ceac0['error'][_0x87f8('0x12')]);return _0x34afbe(_0x1ceac0[_0x87f8('0x10')][_0x87f8('0x12')]);}else{logger[_0x87f8('0x13')]('CannedAnswer,\x20%s,\x20%s',_0x25bea9,_0x87f8('0xe'));_0x34afbe(_0x1ceac0[_0x87f8('0x14')]['message']);}})[_0x87f8('0x15')](function(_0x4b9127){logger[_0x87f8('0x10')](_0x87f8('0x11'),_0x25bea9,_0x4b9127);_0x279e57(_0x4b9127);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 0ab4250..511aa0c 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 _0x85a9=['./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post','create','update','destroy','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0x85a9,0x1a3));var _0x985a=function(_0x587fb5,_0x59cb3b){_0x587fb5=_0x587fb5-0x0;var _0x551105=_0x85a9[_0x587fb5];return _0x551105;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x985a('0x0'));var express=require(_0x985a('0x1'));var router=express[_0x985a('0x2')]();var auth=require(_0x985a('0x3'));var interaction=require(_0x985a('0x4'));var config=require(_0x985a('0x5'));var controller=require(_0x985a('0x6'));router[_0x985a('0x7')]('/',auth[_0x985a('0x8')](),controller[_0x985a('0x9')]);router[_0x985a('0x7')](_0x985a('0xa'),auth[_0x985a('0x8')](),controller[_0x985a('0xb')]);router[_0x985a('0xc')]('/',auth[_0x985a('0x8')](),controller[_0x985a('0xd')]);router['put']('/:id',auth[_0x985a('0x8')](),controller[_0x985a('0xe')]);router['delete'](_0x985a('0xa'),auth[_0x985a('0x8')](),controller[_0x985a('0xf')]);module[_0x985a('0x10')]=router; \ No newline at end of file +var _0xdf5d=['index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get'];(function(_0x40ea11,_0x2974ca){var _0x3bc266=function(_0x48e6d1){while(--_0x48e6d1){_0x40ea11['push'](_0x40ea11['shift']());}};_0x3bc266(++_0x2974ca);}(_0xdf5d,0x19a));var _0xddf5=function(_0x24e14e,_0x39d1c4){_0x24e14e=_0x24e14e-0x0;var _0x1de86b=_0xdf5d[_0x24e14e];return _0x1de86b;};'use strict';var multer=require('multer');var util=require(_0xddf5('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xddf5('0x1'));var router=express[_0xddf5('0x2')]();var auth=require(_0xddf5('0x3'));var interaction=require(_0xddf5('0x4'));var config=require(_0xddf5('0x5'));var controller=require(_0xddf5('0x6'));router[_0xddf5('0x7')]('/',auth['isAuthenticated'](),controller[_0xddf5('0x8')]);router[_0xddf5('0x7')](_0xddf5('0x9'),auth[_0xddf5('0xa')](),controller[_0xddf5('0xb')]);router[_0xddf5('0xc')]('/',auth[_0xddf5('0xa')](),controller[_0xddf5('0xd')]);router[_0xddf5('0xe')](_0xddf5('0x9'),auth[_0xddf5('0xa')](),controller[_0xddf5('0xf')]);router[_0xddf5('0x10')]('/:id',auth[_0xddf5('0xa')](),controller[_0xddf5('0x11')]);module[_0xddf5('0x12')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 88fa748..fc97cd1 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 _0xc824=['STRING','INTEGER','sequelize','exports','1970-01-01\x2000:00:01'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0xc824,0xa7));var _0x4c82=function(_0x4f3362,_0xdf87bf){_0x4f3362=_0x4f3362-0x0;var _0x4eeeb6=_0xc824[_0x4f3362];return _0x4eeeb6;};'use strict';var Sequelize=require(_0x4c82('0x0'));module[_0x4c82('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x4c82('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x4c82('0x3')]},'dcontext':{'type':Sequelize[_0x4c82('0x3')]},'channel':{'type':Sequelize[_0x4c82('0x3')]},'dstchannel':{'type':Sequelize[_0x4c82('0x3')]},'lastapp':{'type':Sequelize[_0x4c82('0x3')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x4c82('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x4c82('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x4c82('0x3')]},'amaflags':{'type':Sequelize[_0x4c82('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x4c82('0x3')]},'userfield':{'type':Sequelize[_0x4c82('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x4c82('0x3')]},'sequence':{'type':Sequelize[_0x4c82('0x3')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4c82('0x3')]},'tag':{'type':Sequelize[_0x4c82('0x3')]}}; \ No newline at end of file +var _0x3642=['INTEGER','sequelize','DATE','STRING'];(function(_0x20c42b,_0x5c5c76){var _0x135cfd=function(_0x8a3ec9){while(--_0x8a3ec9){_0x20c42b['push'](_0x20c42b['shift']());}};_0x135cfd(++_0x5c5c76);}(_0x3642,0x19d));var _0x2364=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x3642[_0x1e7b16];return _0x37fadc;};'use strict';var Sequelize=require(_0x2364('0x0'));module['exports']={'calldate':{'type':Sequelize[_0x2364('0x1')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x2364('0x2')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x2364('0x2')]},'dcontext':{'type':Sequelize[_0x2364('0x2')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x2364('0x2')]},'lastapp':{'type':Sequelize[_0x2364('0x2')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x2364('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x2364('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x2364('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x2364('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x2364('0x2')]},'sequence':{'type':Sequelize[_0x2364('0x2')]},'peeraccount':{'type':Sequelize[_0x2364('0x2')]},'type':{'type':Sequelize[_0x2364('0x2')]},'tag':{'type':Sequelize[_0x2364('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index d143ce7..073fbdd 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 _0x0418=['stack','name','send','index','map','Cdr','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','type','VIRTUAL','merge','options','includeAll','findAll','then','catch','show','params','include','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','apply','reject','update','destroy','sendStatus','error'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x0418,0x103));var _0x8041=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x0418[_0x2f5ac5];return _0x37c9a8;};'use strict';var pdf=require(_0x8041('0x0'));var emlformat=require(_0x8041('0x1'));var rimraf=require(_0x8041('0x2'));var zipdir=require(_0x8041('0x3'));var jsonpatch=require(_0x8041('0x4'));var rp=require(_0x8041('0x5'));var moment=require(_0x8041('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8041('0x7'));var path=require(_0x8041('0x8'));var sox=require(_0x8041('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x8041('0xa'));var squel=require(_0x8041('0xb'));var crypto=require(_0x8041('0xc'));var jsforce=require(_0x8041('0xd'));var deskjs=require(_0x8041('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8041('0xf'));var Papa=require(_0x8041('0x10'));var Redis=require(_0x8041('0x11'));var authService=require(_0x8041('0x12'));var qs=require(_0x8041('0x13'));var as=require(_0x8041('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8041('0x15'))(_0x8041('0x16'));var utils=require('../../config/utils');var config=require(_0x8041('0x17'));var db=require(_0x8041('0x18'))['db'];function respondWithStatusCode(_0x1b199d,_0x441fc9){_0x441fc9=_0x441fc9||0xcc;return function(_0x3d0207){if(_0x3d0207){return _0x1b199d['sendStatus'](_0x441fc9);}return _0x1b199d[_0x8041('0x19')](_0x441fc9)[_0x8041('0x1a')]();};}function respondWithResult(_0x506865,_0x4d91ff){_0x4d91ff=_0x4d91ff||0xc8;return function(_0x53da96){if(_0x53da96){return _0x506865[_0x8041('0x19')](_0x4d91ff)[_0x8041('0x1b')](_0x53da96);}};}function respondWithFilteredResult(_0x58e044,_0x86ceb3){return function(_0x16bcb7){if(_0x16bcb7){var _0x396edf=_0x16bcb7[_0x8041('0x1c')],_0x30033d=_0x86ceb3[_0x8041('0x1d')],_0x3e3b29=_0x86ceb3[_0x8041('0x1d')]+_0x86ceb3[_0x8041('0x1e')],_0x2e5df5;if(_0x3e3b29>=_0x396edf){_0x3e3b29=_0x396edf;_0x2e5df5=0xc8;}else{_0x2e5df5=0xce;}_0x58e044[_0x8041('0x19')](_0x2e5df5);return _0x58e044['set']('Content-Range',_0x30033d+'-'+_0x3e3b29+'/'+_0x396edf)[_0x8041('0x1b')](_0x16bcb7);}return null;};}function patchUpdates(_0x137575){return function(_0x157734){try{jsonpatch[_0x8041('0x1f')](_0x157734,_0x137575,!![]);}catch(_0x462918){return BPromise[_0x8041('0x20')](_0x462918);}return _0x157734['save']();};}function saveUpdates(_0xc28615,_0xd0fda4){return function(_0x5216a9){if(_0x5216a9){return _0x5216a9[_0x8041('0x21')](_0xc28615)['then'](function(_0x430b73){return _0x430b73;});}return null;};}function removeEntity(_0x4fa05f,_0x3b803d){return function(_0x6b64ba){if(_0x6b64ba){return _0x6b64ba[_0x8041('0x22')]()['then'](function(){_0x4fa05f[_0x8041('0x19')](0xcc)[_0x8041('0x1a')]();});}};}function handleEntityNotFound(_0x4602e9,_0x25f5f6){return function(_0x405ed9){if(!_0x405ed9){_0x4602e9[_0x8041('0x23')](0x194);}return _0x405ed9;};}function handleError(_0x56737b,_0x3f57c5){_0x3f57c5=_0x3f57c5||0x1f4;return function(_0x4c4791){logger[_0x8041('0x24')](_0x4c4791[_0x8041('0x25')]);if(_0x4c4791['name']){delete _0x4c4791[_0x8041('0x26')];}_0x56737b[_0x8041('0x19')](_0x3f57c5)[_0x8041('0x27')](_0x4c4791);};}exports[_0x8041('0x28')]=function(_0x5e811d,_0x36c619){var _0x25b01e={},_0x20cf3c={},_0x1d5c10={'count':0x0,'rows':[]};var _0xebb525=_[_0x8041('0x29')](db[_0x8041('0x2a')][_0x8041('0x2b')],function(_0x2b5425){return{'name':_0x2b5425[_0x8041('0x2c')],'type':_0x2b5425['type'][_0x8041('0x2d')]};});_0x20cf3c['model']=_['map'](_0xebb525,_0x8041('0x26'));_0x20cf3c[_0x8041('0x2e')]=_[_0x8041('0x2f')](_0x5e811d[_0x8041('0x2e')]);_0x20cf3c[_0x8041('0x30')]=_[_0x8041('0x31')](_0x20cf3c[_0x8041('0x32')],_0x20cf3c[_0x8041('0x2e')]);_0x25b01e[_0x8041('0x33')]=_[_0x8041('0x31')](_0x20cf3c[_0x8041('0x32')],qs[_0x8041('0x34')](_0x5e811d[_0x8041('0x2e')][_0x8041('0x34')]));_0x25b01e['attributes']=_0x25b01e[_0x8041('0x33')][_0x8041('0x35')]?_0x25b01e[_0x8041('0x33')]:_0x20cf3c[_0x8041('0x32')];if(!_0x5e811d[_0x8041('0x2e')][_0x8041('0x36')]('nolimit')){_0x25b01e[_0x8041('0x1e')]=qs[_0x8041('0x1e')](_0x5e811d[_0x8041('0x2e')][_0x8041('0x1e')]);_0x25b01e[_0x8041('0x1d')]=qs[_0x8041('0x1d')](_0x5e811d[_0x8041('0x2e')]['offset']);}_0x25b01e[_0x8041('0x37')]=qs[_0x8041('0x38')](_0x5e811d['query'][_0x8041('0x38')]);_0x25b01e[_0x8041('0x39')]=qs[_0x8041('0x30')](_['pick'](_0x5e811d['query'],_0x20cf3c[_0x8041('0x30')]),_0xebb525);if(_0x5e811d['query'][_0x8041('0x3a')]){_0x25b01e['where']=_['merge'](_0x25b01e['where'],{'$or':_[_0x8041('0x29')](_0xebb525,function(_0x6940f2){if(_0x6940f2[_0x8041('0x3b')]!==_0x8041('0x3c')){var _0x21f18c={};_0x21f18c[_0x6940f2['name']]={'$like':'%'+_0x5e811d['query'][_0x8041('0x3a')]+'%'};return _0x21f18c;}})});}_0x25b01e=_[_0x8041('0x3d')]({},_0x25b01e,_0x5e811d[_0x8041('0x3e')]);var _0x4ad2b1={'where':_0x25b01e[_0x8041('0x39')]};return db[_0x8041('0x2a')][_0x8041('0x1c')](_0x4ad2b1)['then'](function(_0x521823){_0x1d5c10[_0x8041('0x1c')]=_0x521823;if(_0x5e811d[_0x8041('0x2e')][_0x8041('0x3f')]){_0x25b01e['include']=[{'all':!![]}];}return db[_0x8041('0x2a')][_0x8041('0x40')](_0x25b01e);})[_0x8041('0x41')](function(_0x1ad0ea){_0x1d5c10['rows']=_0x1ad0ea;return _0x1d5c10;})[_0x8041('0x41')](respondWithFilteredResult(_0x36c619,_0x25b01e))[_0x8041('0x42')](handleError(_0x36c619,null));};exports[_0x8041('0x43')]=function(_0x2a7d06,_0x4f3923){var _0xf54d04={'raw':!![],'where':{'id':_0x2a7d06[_0x8041('0x44')]['id']}},_0x2b869e={};_0x2b869e[_0x8041('0x32')]=_['keys'](db[_0x8041('0x2a')][_0x8041('0x2b')]);_0x2b869e[_0x8041('0x2e')]=_[_0x8041('0x2f')](_0x2a7d06[_0x8041('0x2e')]);_0x2b869e[_0x8041('0x30')]=_[_0x8041('0x31')](_0x2b869e[_0x8041('0x32')],_0x2b869e['query']);_0xf54d04['attributes']=_[_0x8041('0x31')](_0x2b869e[_0x8041('0x32')],qs[_0x8041('0x34')](_0x2a7d06[_0x8041('0x2e')]['fields']));_0xf54d04[_0x8041('0x33')]=_0xf54d04[_0x8041('0x33')][_0x8041('0x35')]?_0xf54d04['attributes']:_0x2b869e[_0x8041('0x32')];if(_0x2a7d06[_0x8041('0x2e')][_0x8041('0x3f')]){_0xf54d04[_0x8041('0x45')]=[{'all':!![]}];}_0xf54d04=_['merge']({},_0xf54d04,_0x2a7d06[_0x8041('0x3e')]);return db[_0x8041('0x2a')]['find'](_0xf54d04)[_0x8041('0x41')](handleEntityNotFound(_0x4f3923,null))['then'](respondWithResult(_0x4f3923,null))[_0x8041('0x42')](handleError(_0x4f3923,null));};exports['create']=function(_0x76ee94,_0x57e23a){return db[_0x8041('0x2a')][_0x8041('0x46')](_0x76ee94[_0x8041('0x47')],{})[_0x8041('0x41')](respondWithResult(_0x57e23a,0xc9))[_0x8041('0x42')](handleError(_0x57e23a,null));};exports[_0x8041('0x21')]=function(_0x39c0a6,_0x4cb2cc){if(_0x39c0a6[_0x8041('0x47')]['id']){delete _0x39c0a6[_0x8041('0x47')]['id'];}return db['Cdr'][_0x8041('0x48')]({'where':{'id':_0x39c0a6[_0x8041('0x44')]['id']}})[_0x8041('0x41')](handleEntityNotFound(_0x4cb2cc,null))[_0x8041('0x41')](saveUpdates(_0x39c0a6[_0x8041('0x47')],null))['then'](respondWithResult(_0x4cb2cc,null))[_0x8041('0x42')](handleError(_0x4cb2cc,null));};exports[_0x8041('0x22')]=function(_0x197085,_0x83b831){return db[_0x8041('0x2a')]['find']({'where':{'id':_0x197085[_0x8041('0x44')]['id']}})['then'](handleEntityNotFound(_0x83b831,null))[_0x8041('0x41')](removeEntity(_0x83b831,null))[_0x8041('0x42')](handleError(_0x83b831,null));};exports[_0x8041('0x49')]=function(_0x4ed36a,_0x5d799d){return db[_0x8041('0x2a')][_0x8041('0x49')]()[_0x8041('0x41')](respondWithResult(_0x5d799d,null))[_0x8041('0x42')](handleError(_0x5d799d,null));}; \ No newline at end of file +var _0xde61=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','then','sendStatus','error','stack','send','index','map','Cdr','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','name','merge','options','includeAll','findAll','rows','catch','params','include','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xde61,0x15f));var _0x1de6=function(_0x366171,_0x160e18){_0x366171=_0x366171-0x0;var _0x2fb0af=_0xde61[_0x366171];return _0x2fb0af;};'use strict';var pdf=require(_0x1de6('0x0'));var emlformat=require(_0x1de6('0x1'));var rimraf=require(_0x1de6('0x2'));var zipdir=require(_0x1de6('0x3'));var jsonpatch=require(_0x1de6('0x4'));var rp=require('request-promise');var moment=require(_0x1de6('0x5'));var BPromise=require(_0x1de6('0x6'));var Mustache=require(_0x1de6('0x7'));var util=require('util');var path=require(_0x1de6('0x8'));var sox=require(_0x1de6('0x9'));var csv=require(_0x1de6('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1de6('0xb'));var squel=require(_0x1de6('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1de6('0xa'));var querystring=require(_0x1de6('0xd'));var Papa=require(_0x1de6('0xe'));var Redis=require(_0x1de6('0xf'));var authService=require(_0x1de6('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1de6('0x11'));var hardwareService=require(_0x1de6('0x12'));var logger=require(_0x1de6('0x13'))(_0x1de6('0x14'));var utils=require(_0x1de6('0x15'));var config=require(_0x1de6('0x16'));var db=require(_0x1de6('0x17'))['db'];function respondWithStatusCode(_0x1389d7,_0x296af0){_0x296af0=_0x296af0||0xcc;return function(_0x9e6f36){if(_0x9e6f36){return _0x1389d7['sendStatus'](_0x296af0);}return _0x1389d7[_0x1de6('0x18')](_0x296af0)[_0x1de6('0x19')]();};}function respondWithResult(_0x7ab5eb,_0x1355dc){_0x1355dc=_0x1355dc||0xc8;return function(_0x16c700){if(_0x16c700){return _0x7ab5eb[_0x1de6('0x18')](_0x1355dc)[_0x1de6('0x1a')](_0x16c700);}};}function respondWithFilteredResult(_0x57325b,_0x5d627c){return function(_0x3bf5af){if(_0x3bf5af){var _0x3cdb83=_0x3bf5af[_0x1de6('0x1b')],_0x3c2b98=_0x5d627c[_0x1de6('0x1c')],_0x4b7804=_0x5d627c[_0x1de6('0x1c')]+_0x5d627c[_0x1de6('0x1d')],_0x4ce7f8;if(_0x4b7804>=_0x3cdb83){_0x4b7804=_0x3cdb83;_0x4ce7f8=0xc8;}else{_0x4ce7f8=0xce;}_0x57325b[_0x1de6('0x18')](_0x4ce7f8);return _0x57325b[_0x1de6('0x1e')]('Content-Range',_0x3c2b98+'-'+_0x4b7804+'/'+_0x3cdb83)[_0x1de6('0x1a')](_0x3bf5af);}return null;};}function patchUpdates(_0x349a18){return function(_0x1d2d93){try{jsonpatch[_0x1de6('0x1f')](_0x1d2d93,_0x349a18,!![]);}catch(_0x4e0700){return BPromise[_0x1de6('0x20')](_0x4e0700);}return _0x1d2d93[_0x1de6('0x21')]();};}function saveUpdates(_0x1d4d84,_0x3bfa26){return function(_0x1dc277){if(_0x1dc277){return _0x1dc277[_0x1de6('0x22')](_0x1d4d84)['then'](function(_0x30dacf){return _0x30dacf;});}return null;};}function removeEntity(_0x1b6413,_0x4ba13d){return function(_0x50896b){if(_0x50896b){return _0x50896b[_0x1de6('0x23')]()[_0x1de6('0x24')](function(){_0x1b6413[_0x1de6('0x18')](0xcc)[_0x1de6('0x19')]();});}};}function handleEntityNotFound(_0x17fa22,_0x147d43){return function(_0x4d34d5){if(!_0x4d34d5){_0x17fa22[_0x1de6('0x25')](0x194);}return _0x4d34d5;};}function handleError(_0x461b58,_0x187e3b){_0x187e3b=_0x187e3b||0x1f4;return function(_0x2f9fea){logger[_0x1de6('0x26')](_0x2f9fea[_0x1de6('0x27')]);if(_0x2f9fea['name']){delete _0x2f9fea['name'];}_0x461b58['status'](_0x187e3b)[_0x1de6('0x28')](_0x2f9fea);};}exports[_0x1de6('0x29')]=function(_0x1624b4,_0x582c8e){var _0x10b001={},_0x20b3a5={},_0x245461={'count':0x0,'rows':[]};var _0x67d83a=_[_0x1de6('0x2a')](db[_0x1de6('0x2b')][_0x1de6('0x2c')],function(_0x56fc5e){return{'name':_0x56fc5e['fieldName'],'type':_0x56fc5e[_0x1de6('0x2d')]['key']};});_0x20b3a5[_0x1de6('0x2e')]=_[_0x1de6('0x2a')](_0x67d83a,'name');_0x20b3a5['query']=_[_0x1de6('0x2f')](_0x1624b4[_0x1de6('0x30')]);_0x20b3a5[_0x1de6('0x31')]=_[_0x1de6('0x32')](_0x20b3a5['model'],_0x20b3a5[_0x1de6('0x30')]);_0x10b001[_0x1de6('0x33')]=_['intersection'](_0x20b3a5[_0x1de6('0x2e')],qs['fields'](_0x1624b4[_0x1de6('0x30')][_0x1de6('0x34')]));_0x10b001[_0x1de6('0x33')]=_0x10b001[_0x1de6('0x33')]['length']?_0x10b001[_0x1de6('0x33')]:_0x20b3a5[_0x1de6('0x2e')];if(!_0x1624b4[_0x1de6('0x30')][_0x1de6('0x35')](_0x1de6('0x36'))){_0x10b001[_0x1de6('0x1d')]=qs[_0x1de6('0x1d')](_0x1624b4[_0x1de6('0x30')][_0x1de6('0x1d')]);_0x10b001[_0x1de6('0x1c')]=qs[_0x1de6('0x1c')](_0x1624b4['query'][_0x1de6('0x1c')]);}_0x10b001[_0x1de6('0x37')]=qs[_0x1de6('0x38')](_0x1624b4[_0x1de6('0x30')][_0x1de6('0x38')]);_0x10b001[_0x1de6('0x39')]=qs[_0x1de6('0x31')](_[_0x1de6('0x3a')](_0x1624b4['query'],_0x20b3a5[_0x1de6('0x31')]),_0x67d83a);if(_0x1624b4[_0x1de6('0x30')][_0x1de6('0x3b')]){_0x10b001[_0x1de6('0x39')]=_['merge'](_0x10b001['where'],{'$or':_['map'](_0x67d83a,function(_0x24ac23){if(_0x24ac23['type']!==_0x1de6('0x3c')){var _0x202cda={};_0x202cda[_0x24ac23[_0x1de6('0x3d')]]={'$like':'%'+_0x1624b4[_0x1de6('0x30')]['filter']+'%'};return _0x202cda;}})});}_0x10b001=_[_0x1de6('0x3e')]({},_0x10b001,_0x1624b4[_0x1de6('0x3f')]);var _0x240010={'where':_0x10b001[_0x1de6('0x39')]};return db[_0x1de6('0x2b')]['count'](_0x240010)[_0x1de6('0x24')](function(_0x546092){_0x245461['count']=_0x546092;if(_0x1624b4[_0x1de6('0x30')][_0x1de6('0x40')]){_0x10b001['include']=[{'all':!![]}];}return db['Cdr'][_0x1de6('0x41')](_0x10b001);})[_0x1de6('0x24')](function(_0x5ce386){_0x245461[_0x1de6('0x42')]=_0x5ce386;return _0x245461;})[_0x1de6('0x24')](respondWithFilteredResult(_0x582c8e,_0x10b001))[_0x1de6('0x43')](handleError(_0x582c8e,null));};exports['show']=function(_0x5179a5,_0x309dce){var _0x3ca7bc={'raw':!![],'where':{'id':_0x5179a5[_0x1de6('0x44')]['id']}},_0x220e48={};_0x220e48[_0x1de6('0x2e')]=_[_0x1de6('0x2f')](db[_0x1de6('0x2b')][_0x1de6('0x2c')]);_0x220e48[_0x1de6('0x30')]=_[_0x1de6('0x2f')](_0x5179a5[_0x1de6('0x30')]);_0x220e48['filters']=_['intersection'](_0x220e48[_0x1de6('0x2e')],_0x220e48[_0x1de6('0x30')]);_0x3ca7bc[_0x1de6('0x33')]=_['intersection'](_0x220e48['model'],qs[_0x1de6('0x34')](_0x5179a5[_0x1de6('0x30')]['fields']));_0x3ca7bc['attributes']=_0x3ca7bc['attributes']['length']?_0x3ca7bc[_0x1de6('0x33')]:_0x220e48[_0x1de6('0x2e')];if(_0x5179a5[_0x1de6('0x30')]['includeAll']){_0x3ca7bc[_0x1de6('0x45')]=[{'all':!![]}];}_0x3ca7bc=_[_0x1de6('0x3e')]({},_0x3ca7bc,_0x5179a5[_0x1de6('0x3f')]);return db[_0x1de6('0x2b')][_0x1de6('0x46')](_0x3ca7bc)['then'](handleEntityNotFound(_0x309dce,null))['then'](respondWithResult(_0x309dce,null))['catch'](handleError(_0x309dce,null));};exports[_0x1de6('0x47')]=function(_0x5d6217,_0x5d123f){return db[_0x1de6('0x2b')][_0x1de6('0x47')](_0x5d6217[_0x1de6('0x48')],{})[_0x1de6('0x24')](respondWithResult(_0x5d123f,0xc9))['catch'](handleError(_0x5d123f,null));};exports[_0x1de6('0x22')]=function(_0x15b5fb,_0x5e5ca3){if(_0x15b5fb[_0x1de6('0x48')]['id']){delete _0x15b5fb['body']['id'];}return db[_0x1de6('0x2b')][_0x1de6('0x46')]({'where':{'id':_0x15b5fb[_0x1de6('0x44')]['id']}})['then'](handleEntityNotFound(_0x5e5ca3,null))['then'](saveUpdates(_0x15b5fb['body'],null))[_0x1de6('0x24')](respondWithResult(_0x5e5ca3,null))[_0x1de6('0x43')](handleError(_0x5e5ca3,null));};exports[_0x1de6('0x23')]=function(_0x1673d9,_0x291798){return db['Cdr'][_0x1de6('0x46')]({'where':{'id':_0x1673d9['params']['id']}})['then'](handleEntityNotFound(_0x291798,null))['then'](removeEntity(_0x291798,null))[_0x1de6('0x43')](handleError(_0x291798,null));};exports['describe']=function(_0x1be5db,_0x16f4e6){return db[_0x1de6('0x2b')][_0x1de6('0x49')]()[_0x1de6('0x24')](respondWithResult(_0x16f4e6,null))[_0x1de6('0x43')](handleError(_0x16f4e6,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 3e37649..ec678d3 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 _0x5496=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./cdr.attributes','define','cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash'];(function(_0x1af026,_0x1e5637){var _0x5a0e66=function(_0x2b9ce8){while(--_0x2b9ce8){_0x1af026['push'](_0x1af026['shift']());}};_0x5a0e66(++_0x1e5637);}(_0x5496,0x175));var _0x6549=function(_0x2dca72,_0x3f9327){_0x2dca72=_0x2dca72-0x0;var _0xd089b9=_0x5496[_0x2dca72];return _0xd089b9;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var logger=require(_0x6549('0x2'))(_0x6549('0x3'));var moment=require(_0x6549('0x4'));var BPromise=require('bluebird');var rp=require(_0x6549('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var attributes=require(_0x6549('0x8'));module['exports']=function(_0x5a4658,_0x43cb17){return _0x5a4658[_0x6549('0x9')]('Cdr',attributes,{'tableName':_0x6549('0xa'),'paranoid':![],'indexes':[{'name':_0x6549('0xb'),'fields':[_0x6549('0xb')]},{'name':'calldate','fields':[_0x6549('0xc')]},{'name':_0x6549('0xd'),'fields':[_0x6549('0xd')]},{'name':_0x6549('0xe'),'fields':[_0x6549('0xe')]},{'name':_0x6549('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x6549('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x53ec=['path','../../config/environment','./cdr.attributes','define','Cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x53ec,0x192));var _0xc53e=function(_0x3c10b7,_0x10fb4a){_0x3c10b7=_0x3c10b7-0x0;var _0xbd891b=_0x53ec[_0x3c10b7];return _0xbd891b;};'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':'cdr','paranoid':![],'indexes':[{'name':_0xc53e('0xb'),'fields':[_0xc53e('0xb')]},{'name':_0xc53e('0xc'),'fields':[_0xc53e('0xc')]},{'name':_0xc53e('0xd'),'fields':[_0xc53e('0xd')]},{'name':_0xc53e('0xe'),'fields':[_0xc53e('0xe')]},{'name':_0xc53e('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0xc53e('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 8544d59..f5c4a40 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 _0x1826=['../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','Cdr,\x20%s,\x20%s','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x38bb3e,_0x17f62a){var _0x55fd30=function(_0x55d45c){while(--_0x55d45c){_0x38bb3e['push'](_0x38bb3e['shift']());}};_0x55fd30(++_0x17f62a);}(_0x1826,0x119));var _0x6182=function(_0x385101,_0x396ad1){_0x385101=_0x385101-0x0;var _0x5b836f=_0x1826[_0x385101];return _0x5b836f;};'use strict';var _=require(_0x6182('0x0'));var util=require(_0x6182('0x1'));var moment=require(_0x6182('0x2'));var BPromise=require(_0x6182('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6182('0x4'));var db=require(_0x6182('0x5'))['db'];var utils=require(_0x6182('0x6'));var logger=require('../../config/logger')(_0x6182('0x7'));var config=require(_0x6182('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6182('0x9')][_0x6182('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xebecad,_0x454bcb,_0xa23780){return new BPromise(function(_0x19f155,_0x1a86f9){return client[_0x6182('0xb')](_0xebecad,_0xa23780)['then'](function(_0x307052){logger[_0x6182('0xc')](_0x6182('0xd'),_0x454bcb,'request\x20sent');logger[_0x6182('0xe')](_0x6182('0xf'),_0x454bcb,'request\x20sent',JSON[_0x6182('0x10')](_0x307052));if(_0x307052[_0x6182('0x11')]){if(_0x307052[_0x6182('0x11')][_0x6182('0x12')]===0x1f4){logger[_0x6182('0x11')](_0x6182('0xd'),_0x454bcb,_0x307052['error'][_0x6182('0x13')]);return _0x1a86f9(_0x307052[_0x6182('0x11')]['message']);}logger['error'](_0x6182('0xd'),_0x454bcb,_0x307052[_0x6182('0x11')]['message']);return _0x19f155(_0x307052['error']['message']);}else{logger[_0x6182('0xc')]('Cdr,\x20%s,\x20%s',_0x454bcb,'request\x20sent');_0x19f155(_0x307052[_0x6182('0x14')]['message']);}})[_0x6182('0x15')](function(_0x3fcfc7){logger[_0x6182('0x11')](_0x6182('0xd'),_0x454bcb,_0x3fcfc7);_0x1a86f9(_0x3fcfc7);});});} \ No newline at end of file +var _0xcf1f=['client','http','request','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x453d7a,_0x2835dd){var _0xa47c94=function(_0x517704){while(--_0x517704){_0x453d7a['push'](_0x453d7a['shift']());}};_0xa47c94(++_0x2835dd);}(_0xcf1f,0x98));var _0xfcf1=function(_0x4b5c23,_0x101faa){_0x4b5c23=_0x4b5c23-0x0;var _0x262cfd=_0xcf1f[_0x4b5c23];return _0x262cfd;};'use strict';var _=require(_0xfcf1('0x0'));var util=require(_0xfcf1('0x1'));var moment=require('moment');var BPromise=require(_0xfcf1('0x2'));var rs=require(_0xfcf1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfcf1('0x4'))['db'];var utils=require(_0xfcf1('0x5'));var logger=require('../../config/logger')(_0xfcf1('0x6'));var config=require(_0xfcf1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfcf1('0x8')][_0xfcf1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x527387,_0x202955,_0x42a549){return new BPromise(function(_0xf5409f,_0x22a514){return client[_0xfcf1('0xa')](_0x527387,_0x42a549)['then'](function(_0x502557){logger[_0xfcf1('0xb')](_0xfcf1('0xc'),_0x202955,_0xfcf1('0xd'));logger[_0xfcf1('0xe')](_0xfcf1('0xf'),_0x202955,_0xfcf1('0xd'),JSON[_0xfcf1('0x10')](_0x502557));if(_0x502557['error']){if(_0x502557[_0xfcf1('0x11')]['code']===0x1f4){logger['error'](_0xfcf1('0xc'),_0x202955,_0x502557['error'][_0xfcf1('0x12')]);return _0x22a514(_0x502557['error']['message']);}logger[_0xfcf1('0x11')](_0xfcf1('0xc'),_0x202955,_0x502557[_0xfcf1('0x11')][_0xfcf1('0x12')]);return _0xf5409f(_0x502557[_0xfcf1('0x11')][_0xfcf1('0x12')]);}else{logger['info'](_0xfcf1('0xc'),_0x202955,'request\x20sent');_0xf5409f(_0x502557[_0xfcf1('0x13')][_0xfcf1('0x12')]);}})['catch'](function(_0x2d2c68){logger[_0xfcf1('0x11')](_0xfcf1('0xc'),_0x202955,_0x2d2c68);_0x22a514(_0x2d2c68);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 23f8c4c..9e0b9fb 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 _0x4414=['post','create','update','delete','/:id','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cdr.controller','isAuthenticated','index','describe','get','show'];(function(_0x1062ff,_0x189a3f){var _0x5e2d0f=function(_0x24d2ab){while(--_0x24d2ab){_0x1062ff['push'](_0x1062ff['shift']());}};_0x5e2d0f(++_0x189a3f);}(_0x4414,0x15d));var _0x4441=function(_0x11cb1d,_0x4782da){_0x11cb1d=_0x11cb1d-0x0;var _0x353d97=_0x4414[_0x11cb1d];return _0x353d97;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4441('0x0'));var timeout=require(_0x4441('0x1'));var express=require(_0x4441('0x2'));var router=express[_0x4441('0x3')]();var auth=require(_0x4441('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4441('0x5'));var controller=require(_0x4441('0x6'));router['get']('/',auth[_0x4441('0x7')](),controller[_0x4441('0x8')]);router['get']('/describe',auth[_0x4441('0x7')](),controller[_0x4441('0x9')]);router[_0x4441('0xa')]('/:id',auth[_0x4441('0x7')](),controller[_0x4441('0xb')]);router[_0x4441('0xc')]('/',auth[_0x4441('0x7')](),controller[_0x4441('0xd')]);router['put']('/:id',auth[_0x4441('0x7')](),controller[_0x4441('0xe')]);router[_0x4441('0xf')](_0x4441('0x10'),auth[_0x4441('0x7')](),controller[_0x4441('0x11')]);module[_0x4441('0x12')]=router; \ No newline at end of file +var _0xfa92=['express','Router','../../components/interaction/service','./cdr.controller','get','index','/describe','isAuthenticated','/:id','show','create','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x486513,_0x49ddc9){var _0x564738=function(_0xa97fb0){while(--_0xa97fb0){_0x486513['push'](_0x486513['shift']());}};_0x564738(++_0x49ddc9);}(_0xfa92,0x152));var _0x2fa9=function(_0x2860c3,_0x34ef84){_0x2860c3=_0x2860c3-0x0;var _0x23a976=_0xfa92[_0x2860c3];return _0x23a976;};'use strict';var multer=require(_0x2fa9('0x0'));var util=require(_0x2fa9('0x1'));var path=require(_0x2fa9('0x2'));var timeout=require(_0x2fa9('0x3'));var express=require(_0x2fa9('0x4'));var router=express[_0x2fa9('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x2fa9('0x6'));var config=require('../../config/environment');var controller=require(_0x2fa9('0x7'));router[_0x2fa9('0x8')]('/',auth['isAuthenticated'](),controller[_0x2fa9('0x9')]);router['get'](_0x2fa9('0xa'),auth[_0x2fa9('0xb')](),controller['describe']);router['get'](_0x2fa9('0xc'),auth[_0x2fa9('0xb')](),controller[_0x2fa9('0xd')]);router['post']('/',auth[_0x2fa9('0xb')](),controller[_0x2fa9('0xe')]);router['put']('/:id',auth[_0x2fa9('0xb')](),controller[_0x2fa9('0xf')]);router[_0x2fa9('0x10')](_0x2fa9('0xc'),auth[_0x2fa9('0xb')](),controller['destroy']);module[_0x2fa9('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 8a40279..1efd0c2 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 _0x0a55=['noop','TEXT','sequelize','exports','STRING'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x0a55,0x1ab));var _0x50a5=function(_0x409e6b,_0x3437b3){_0x409e6b=_0x409e6b-0x0;var _0x50c5af=_0x0a55[_0x409e6b];return _0x50c5af;};'use strict';var Sequelize=require(_0x50a5('0x0'));module[_0x50a5('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x50a5('0x2')],'allowNull':![],'defaultValue':_0x50a5('0x3')},'appdata':{'type':Sequelize[_0x50a5('0x4')]()},'description':{'type':Sequelize[_0x50a5('0x2')]},'interval':{'type':Sequelize[_0x50a5('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xe7a4=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x3daaef,_0x183eb7){var _0x115f53=function(_0x21eb2f){while(--_0x21eb2f){_0x3daaef['push'](_0x3daaef['shift']());}};_0x115f53(++_0x183eb7);}(_0xe7a4,0x113));var _0x4e7a=function(_0x1e0678,_0x3fe78f){_0x1e0678=_0x1e0678-0x0;var _0x445bdb=_0xe7a4[_0x1e0678];return _0x445bdb;};'use strict';var Sequelize=require(_0x4e7a('0x0'));module[_0x4e7a('0x1')]={'priority':{'type':Sequelize[_0x4e7a('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x4e7a('0x3')],'allowNull':![],'defaultValue':_0x4e7a('0x4')},'appdata':{'type':Sequelize[_0x4e7a('0x5')]()},'description':{'type':Sequelize[_0x4e7a('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x4e7a('0x6')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index f50c268..c4534bf 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 _0x5cec=['fields','length','includeAll','include','merge','find','catch','update','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','show','params','model','keys','ChatApplication','query','filters','intersection','attributes'];(function(_0x1d2706,_0x4db46f){var _0x15448d=function(_0x4b8d33){while(--_0x4b8d33){_0x1d2706['push'](_0x1d2706['shift']());}};_0x15448d(++_0x4db46f);}(_0x5cec,0x83));var _0xc5ce=function(_0x49c7b3,_0x36eca7){_0x49c7b3=_0x49c7b3-0x0;var _0x37b0f3=_0x5cec[_0x49c7b3];return _0x37b0f3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc5ce('0x0'));var rimraf=require(_0xc5ce('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc5ce('0x2'));var rp=require(_0xc5ce('0x3'));var moment=require(_0xc5ce('0x4'));var BPromise=require(_0xc5ce('0x5'));var Mustache=require(_0xc5ce('0x6'));var util=require(_0xc5ce('0x7'));var path=require(_0xc5ce('0x8'));var sox=require(_0xc5ce('0x9'));var csv=require('to-csv');var ejs=require(_0xc5ce('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc5ce('0xb'));var crypto=require(_0xc5ce('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc5ce('0xd'));var toCsv=require(_0xc5ce('0xe'));var querystring=require(_0xc5ce('0xf'));var Papa=require(_0xc5ce('0x10'));var Redis=require('ioredis');var authService=require(_0xc5ce('0x11'));var qs=require(_0xc5ce('0x12'));var as=require(_0xc5ce('0x13'));var hardwareService=require(_0xc5ce('0x14'));var logger=require('../../config/logger')(_0xc5ce('0x15'));var utils=require(_0xc5ce('0x16'));var config=require(_0xc5ce('0x17'));var db=require(_0xc5ce('0x18'))['db'];function respondWithStatusCode(_0x4803c6,_0x364b37){_0x364b37=_0x364b37||0xcc;return function(_0x46d6ec){if(_0x46d6ec){return _0x4803c6[_0xc5ce('0x19')](_0x364b37);}return _0x4803c6['status'](_0x364b37)[_0xc5ce('0x1a')]();};}function respondWithResult(_0x48c5f6,_0x23adf9){_0x23adf9=_0x23adf9||0xc8;return function(_0x552d0b){if(_0x552d0b){return _0x48c5f6[_0xc5ce('0x1b')](_0x23adf9)['json'](_0x552d0b);}};}function respondWithFilteredResult(_0x2dc5c1,_0x26d104){return function(_0x171720){if(_0x171720){var _0x51f9e6=_0x171720[_0xc5ce('0x1c')],_0x50246f=_0x26d104[_0xc5ce('0x1d')],_0x491c93=_0x26d104[_0xc5ce('0x1d')]+_0x26d104[_0xc5ce('0x1e')],_0x34b62b;if(_0x491c93>=_0x51f9e6){_0x491c93=_0x51f9e6;_0x34b62b=0xc8;}else{_0x34b62b=0xce;}_0x2dc5c1[_0xc5ce('0x1b')](_0x34b62b);return _0x2dc5c1[_0xc5ce('0x1f')](_0xc5ce('0x20'),_0x50246f+'-'+_0x491c93+'/'+_0x51f9e6)[_0xc5ce('0x21')](_0x171720);}return null;};}function patchUpdates(_0x4c0334){return function(_0x301afd){try{jsonpatch[_0xc5ce('0x22')](_0x301afd,_0x4c0334,!![]);}catch(_0x5ed864){return BPromise[_0xc5ce('0x23')](_0x5ed864);}return _0x301afd[_0xc5ce('0x24')]();};}function saveUpdates(_0x3a53ed,_0x5d54c5){return function(_0x5344de){if(_0x5344de){return _0x5344de['update'](_0x3a53ed)[_0xc5ce('0x25')](function(_0x1e95e5){return _0x1e95e5;});}return null;};}function removeEntity(_0x4a4207,_0x312c1c){return function(_0x2475e5){if(_0x2475e5){return _0x2475e5[_0xc5ce('0x26')]()[_0xc5ce('0x25')](function(){_0x4a4207[_0xc5ce('0x1b')](0xcc)[_0xc5ce('0x1a')]();});}};}function handleEntityNotFound(_0x292fe3,_0x385a07){return function(_0x3248c4){if(!_0x3248c4){_0x292fe3[_0xc5ce('0x19')](0x194);}return _0x3248c4;};}function handleError(_0x54a5d2,_0x50ed7c){_0x50ed7c=_0x50ed7c||0x1f4;return function(_0x522ab8){logger[_0xc5ce('0x27')](_0x522ab8[_0xc5ce('0x28')]);if(_0x522ab8[_0xc5ce('0x29')]){delete _0x522ab8['name'];}_0x54a5d2[_0xc5ce('0x1b')](_0x50ed7c)[_0xc5ce('0x2a')](_0x522ab8);};}exports[_0xc5ce('0x2b')]=function(_0x953868,_0x208266){var _0xe48b1c={'raw':!![],'where':{'id':_0x953868[_0xc5ce('0x2c')]['id']}},_0x5a2b5f={};_0x5a2b5f[_0xc5ce('0x2d')]=_[_0xc5ce('0x2e')](db[_0xc5ce('0x2f')]['rawAttributes']);_0x5a2b5f[_0xc5ce('0x30')]=_[_0xc5ce('0x2e')](_0x953868[_0xc5ce('0x30')]);_0x5a2b5f[_0xc5ce('0x31')]=_[_0xc5ce('0x32')](_0x5a2b5f[_0xc5ce('0x2d')],_0x5a2b5f[_0xc5ce('0x30')]);_0xe48b1c[_0xc5ce('0x33')]=_[_0xc5ce('0x32')](_0x5a2b5f[_0xc5ce('0x2d')],qs[_0xc5ce('0x34')](_0x953868[_0xc5ce('0x30')][_0xc5ce('0x34')]));_0xe48b1c['attributes']=_0xe48b1c[_0xc5ce('0x33')][_0xc5ce('0x35')]?_0xe48b1c[_0xc5ce('0x33')]:_0x5a2b5f[_0xc5ce('0x2d')];if(_0x953868[_0xc5ce('0x30')][_0xc5ce('0x36')]){_0xe48b1c[_0xc5ce('0x37')]=[{'all':!![]}];}_0xe48b1c=_[_0xc5ce('0x38')]({},_0xe48b1c,_0x953868['options']);return db[_0xc5ce('0x2f')][_0xc5ce('0x39')](_0xe48b1c)[_0xc5ce('0x25')](handleEntityNotFound(_0x208266,null))[_0xc5ce('0x25')](respondWithResult(_0x208266,null))[_0xc5ce('0x3a')](handleError(_0x208266,null));};exports[_0xc5ce('0x3b')]=function(_0x4fce4e,_0x37b0e5){if(_0x4fce4e['body']['id']){delete _0x4fce4e[_0xc5ce('0x3c')]['id'];}return db[_0xc5ce('0x2f')][_0xc5ce('0x39')]({'where':{'id':_0x4fce4e['params']['id']}})[_0xc5ce('0x25')](handleEntityNotFound(_0x37b0e5,null))[_0xc5ce('0x25')](saveUpdates(_0x4fce4e[_0xc5ce('0x3c')],null))[_0xc5ce('0x25')](respondWithResult(_0x37b0e5,null))[_0xc5ce('0x3a')](handleError(_0x37b0e5,null));};exports[_0xc5ce('0x26')]=function(_0x3b9004,_0x79bb6f){return db['ChatApplication'][_0xc5ce('0x39')]({'where':{'id':_0x3b9004['params']['id']}})[_0xc5ce('0x25')](handleEntityNotFound(_0x79bb6f,null))['then'](removeEntity(_0x79bb6f,null))[_0xc5ce('0x3a')](handleError(_0x79bb6f,null));}; \ No newline at end of file +var _0x18ab=['api','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','intersection','attributes','fields','length','includeAll','find','catch','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x30cec2,_0xfecd0a){var _0x1d44bd=function(_0x3ca538){while(--_0x3ca538){_0x30cec2['push'](_0x30cec2['shift']());}};_0x1d44bd(++_0xfecd0a);}(_0x18ab,0x8f));var _0xb18a=function(_0x2109cb,_0x596e11){_0x2109cb=_0x2109cb-0x0;var _0x21718c=_0x18ab[_0x2109cb];return _0x21718c;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb18a('0x0'));var jsonpatch=require(_0xb18a('0x1'));var rp=require(_0xb18a('0x2'));var moment=require(_0xb18a('0x3'));var BPromise=require(_0xb18a('0x4'));var Mustache=require(_0xb18a('0x5'));var util=require(_0xb18a('0x6'));var path=require('path');var sox=require(_0xb18a('0x7'));var csv=require(_0xb18a('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xb18a('0x9'));var crypto=require('crypto');var jsforce=require(_0xb18a('0xa'));var deskjs=require(_0xb18a('0xb'));var toCsv=require(_0xb18a('0x8'));var querystring=require(_0xb18a('0xc'));var Papa=require(_0xb18a('0xd'));var Redis=require(_0xb18a('0xe'));var authService=require(_0xb18a('0xf'));var qs=require(_0xb18a('0x10'));var as=require(_0xb18a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb18a('0x12'))(_0xb18a('0x13'));var utils=require(_0xb18a('0x14'));var config=require('../../config/environment');var db=require(_0xb18a('0x15'))['db'];function respondWithStatusCode(_0x5ab8ee,_0x54831b){_0x54831b=_0x54831b||0xcc;return function(_0x1354de){if(_0x1354de){return _0x5ab8ee[_0xb18a('0x16')](_0x54831b);}return _0x5ab8ee[_0xb18a('0x17')](_0x54831b)[_0xb18a('0x18')]();};}function respondWithResult(_0x26dc91,_0x576780){_0x576780=_0x576780||0xc8;return function(_0x5a84e3){if(_0x5a84e3){return _0x26dc91['status'](_0x576780)['json'](_0x5a84e3);}};}function respondWithFilteredResult(_0xfe8677,_0x343b61){return function(_0x47f23f){if(_0x47f23f){var _0xc06693=_0x47f23f[_0xb18a('0x19')],_0x3ec5a9=_0x343b61['offset'],_0x37962b=_0x343b61[_0xb18a('0x1a')]+_0x343b61[_0xb18a('0x1b')],_0x98eede;if(_0x37962b>=_0xc06693){_0x37962b=_0xc06693;_0x98eede=0xc8;}else{_0x98eede=0xce;}_0xfe8677[_0xb18a('0x17')](_0x98eede);return _0xfe8677[_0xb18a('0x1c')](_0xb18a('0x1d'),_0x3ec5a9+'-'+_0x37962b+'/'+_0xc06693)['json'](_0x47f23f);}return null;};}function patchUpdates(_0x3a5714){return function(_0x3e6af2){try{jsonpatch[_0xb18a('0x1e')](_0x3e6af2,_0x3a5714,!![]);}catch(_0x2b842d){return BPromise['reject'](_0x2b842d);}return _0x3e6af2[_0xb18a('0x1f')]();};}function saveUpdates(_0x1cc251,_0x56494e){return function(_0xfc0b19){if(_0xfc0b19){return _0xfc0b19[_0xb18a('0x20')](_0x1cc251)[_0xb18a('0x21')](function(_0x1ea4ec){return _0x1ea4ec;});}return null;};}function removeEntity(_0x449f67,_0x3fafd6){return function(_0x422755){if(_0x422755){return _0x422755[_0xb18a('0x22')]()[_0xb18a('0x21')](function(){_0x449f67[_0xb18a('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x318093,_0x2c73c1){return function(_0x4c11f3){if(!_0x4c11f3){_0x318093['sendStatus'](0x194);}return _0x4c11f3;};}function handleError(_0x39c90f,_0x3e2c57){_0x3e2c57=_0x3e2c57||0x1f4;return function(_0xce63a8){logger[_0xb18a('0x23')](_0xce63a8[_0xb18a('0x24')]);if(_0xce63a8[_0xb18a('0x25')]){delete _0xce63a8[_0xb18a('0x25')];}_0x39c90f[_0xb18a('0x17')](_0x3e2c57)[_0xb18a('0x26')](_0xce63a8);};}exports[_0xb18a('0x27')]=function(_0x1fe245,_0x48611a){var _0x26e9a9={'raw':!![],'where':{'id':_0x1fe245[_0xb18a('0x28')]['id']}},_0x4da512={};_0x4da512[_0xb18a('0x29')]=_[_0xb18a('0x2a')](db[_0xb18a('0x2b')][_0xb18a('0x2c')]);_0x4da512[_0xb18a('0x2d')]=_[_0xb18a('0x2a')](_0x1fe245[_0xb18a('0x2d')]);_0x4da512['filters']=_[_0xb18a('0x2e')](_0x4da512[_0xb18a('0x29')],_0x4da512[_0xb18a('0x2d')]);_0x26e9a9[_0xb18a('0x2f')]=_[_0xb18a('0x2e')](_0x4da512[_0xb18a('0x29')],qs[_0xb18a('0x30')](_0x1fe245[_0xb18a('0x2d')]['fields']));_0x26e9a9['attributes']=_0x26e9a9['attributes'][_0xb18a('0x31')]?_0x26e9a9[_0xb18a('0x2f')]:_0x4da512[_0xb18a('0x29')];if(_0x1fe245[_0xb18a('0x2d')][_0xb18a('0x32')]){_0x26e9a9['include']=[{'all':!![]}];}_0x26e9a9=_['merge']({},_0x26e9a9,_0x1fe245['options']);return db[_0xb18a('0x2b')][_0xb18a('0x33')](_0x26e9a9)[_0xb18a('0x21')](handleEntityNotFound(_0x48611a,null))['then'](respondWithResult(_0x48611a,null))[_0xb18a('0x34')](handleError(_0x48611a,null));};exports[_0xb18a('0x20')]=function(_0x285d2a,_0x3ff93a){if(_0x285d2a[_0xb18a('0x35')]['id']){delete _0x285d2a[_0xb18a('0x35')]['id'];}return db[_0xb18a('0x2b')][_0xb18a('0x33')]({'where':{'id':_0x285d2a[_0xb18a('0x28')]['id']}})[_0xb18a('0x21')](handleEntityNotFound(_0x3ff93a,null))[_0xb18a('0x21')](saveUpdates(_0x285d2a['body'],null))[_0xb18a('0x21')](respondWithResult(_0x3ff93a,null))[_0xb18a('0x34')](handleError(_0x3ff93a,null));};exports[_0xb18a('0x22')]=function(_0xc47b14,_0x23527b){return db['ChatApplication'][_0xb18a('0x33')]({'where':{'id':_0xc47b14['params']['id']}})['then'](handleEntityNotFound(_0x23527b,null))['then'](removeEntity(_0x23527b,null))[_0xb18a('0x34')](handleError(_0x23527b,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index ad3467d..8eb8086 100644 --- a/server/api/chatApplication/chatApplication.model.js +++ b/server/api/chatApplication/chatApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file +var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 4fcba76..85992aa 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 _0x451f=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x4914e2,_0x48be8f){var _0x2dcd07=function(_0x1a2565){while(--_0x1a2565){_0x4914e2['push'](_0x4914e2['shift']());}};_0x2dcd07(++_0x48be8f);}(_0x451f,0x11f));var _0xf451=function(_0x555dbf,_0x1041d7){_0x555dbf=_0x555dbf-0x0;var _0x8bd57e=_0x451f[_0x555dbf];return _0x8bd57e;};'use strict';var _=require(_0xf451('0x0'));var util=require(_0xf451('0x1'));var moment=require(_0xf451('0x2'));var BPromise=require('bluebird');var rs=require(_0xf451('0x3'));var fs=require('fs');var Redis=require(_0xf451('0x4'));var db=require(_0xf451('0x5'))['db'];var utils=require(_0xf451('0x6'));var logger=require(_0xf451('0x7'))(_0xf451('0x8'));var config=require('../../config/environment');var jayson=require(_0xf451('0x9'));var client=jayson[_0xf451('0xa')][_0xf451('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x17cf85,_0x2a3acb,_0x5c8c53){return new BPromise(function(_0x50a644,_0x2d120a){return client[_0xf451('0xc')](_0x17cf85,_0x5c8c53)[_0xf451('0xd')](function(_0x55d493){logger['info'](_0xf451('0xe'),_0x2a3acb,_0xf451('0xf'));logger[_0xf451('0x10')](_0xf451('0x11'),_0x2a3acb,_0xf451('0xf'),JSON[_0xf451('0x12')](_0x55d493));if(_0x55d493[_0xf451('0x13')]){if(_0x55d493[_0xf451('0x13')][_0xf451('0x14')]===0x1f4){logger['error'](_0xf451('0xe'),_0x2a3acb,_0x55d493['error'][_0xf451('0x15')]);return _0x2d120a(_0x55d493['error'][_0xf451('0x15')]);}logger[_0xf451('0x13')](_0xf451('0xe'),_0x2a3acb,_0x55d493['error'][_0xf451('0x15')]);return _0x50a644(_0x55d493['error'][_0xf451('0x15')]);}else{logger['info'](_0xf451('0xe'),_0x2a3acb,'request\x20sent');_0x50a644(_0x55d493[_0xf451('0x16')][_0xf451('0x15')]);}})[_0xf451('0x17')](function(_0x5026f5){logger[_0xf451('0x13')]('ChatApplication,\x20%s,\x20%s',_0x2a3acb,_0x5026f5);_0x2d120a(_0x5026f5);});});} \ No newline at end of file +var _0x8c4e=['request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s'];(function(_0x13c174,_0xda25fe){var _0x160654=function(_0x1b6ac2){while(--_0x1b6ac2){_0x13c174['push'](_0x13c174['shift']());}};_0x160654(++_0xda25fe);}(_0x8c4e,0x102));var _0xe8c4=function(_0x39170e,_0x476c88){_0x39170e=_0x39170e-0x0;var _0x4d5299=_0x8c4e[_0x39170e];return _0x4d5299;};'use strict';var _=require(_0xe8c4('0x0'));var util=require(_0xe8c4('0x1'));var moment=require(_0xe8c4('0x2'));var BPromise=require(_0xe8c4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe8c4('0x4'));var db=require(_0xe8c4('0x5'))['db'];var utils=require(_0xe8c4('0x6'));var logger=require(_0xe8c4('0x7'))(_0xe8c4('0x8'));var config=require(_0xe8c4('0x9'));var jayson=require(_0xe8c4('0xa'));var client=jayson[_0xe8c4('0xb')][_0xe8c4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4a21c2,_0x36cb0d,_0x5e639f){return new BPromise(function(_0x50d3d5,_0x1e35df){return client['request'](_0x4a21c2,_0x5e639f)[_0xe8c4('0xd')](function(_0x514d04){logger['info'](_0xe8c4('0xe'),_0x36cb0d,'request\x20sent');logger[_0xe8c4('0xf')](_0xe8c4('0x10'),_0x36cb0d,_0xe8c4('0x11'),JSON[_0xe8c4('0x12')](_0x514d04));if(_0x514d04[_0xe8c4('0x13')]){if(_0x514d04[_0xe8c4('0x13')][_0xe8c4('0x14')]===0x1f4){logger[_0xe8c4('0x13')](_0xe8c4('0xe'),_0x36cb0d,_0x514d04[_0xe8c4('0x13')]['message']);return _0x1e35df(_0x514d04[_0xe8c4('0x13')]['message']);}logger[_0xe8c4('0x13')]('ChatApplication,\x20%s,\x20%s',_0x36cb0d,_0x514d04['error'][_0xe8c4('0x15')]);return _0x50d3d5(_0x514d04['error']['message']);}else{logger[_0xe8c4('0x16')]('ChatApplication,\x20%s,\x20%s',_0x36cb0d,_0xe8c4('0x11'));_0x50d3d5(_0x514d04[_0xe8c4('0x17')][_0xe8c4('0x15')]);}})[_0xe8c4('0x18')](function(_0x5ac209){logger[_0xe8c4('0x13')]('ChatApplication,\x20%s,\x20%s',_0x36cb0d,_0x5ac209);_0x1e35df(_0x5ac209);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 538e5cc..9437c0a 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 _0x03e5=['get','/:id','isAuthenticated','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x12953d,_0x51b9f2){var _0x21fc78=function(_0x466ce0){while(--_0x466ce0){_0x12953d['push'](_0x12953d['shift']());}};_0x21fc78(++_0x51b9f2);}(_0x03e5,0x128));var _0x503e=function(_0x34b787,_0x288d0a){_0x34b787=_0x34b787-0x0;var _0x19e0e2=_0x03e5[_0x34b787];return _0x19e0e2;};'use strict';var multer=require(_0x503e('0x0'));var util=require(_0x503e('0x1'));var path=require(_0x503e('0x2'));var timeout=require(_0x503e('0x3'));var express=require(_0x503e('0x4'));var router=express[_0x503e('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x503e('0x6'));var config=require(_0x503e('0x7'));var controller=require('./chatApplication.controller');router[_0x503e('0x8')](_0x503e('0x9'),auth[_0x503e('0xa')](),controller['show']);router[_0x503e('0xb')](_0x503e('0x9'),auth[_0x503e('0xa')](),controller[_0x503e('0xc')]);router[_0x503e('0xd')](_0x503e('0x9'),auth[_0x503e('0xa')](),controller[_0x503e('0xe')]);module[_0x503e('0xf')]=router; \ No newline at end of file +var _0x1295=['isAuthenticated','show','put','/:id','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatApplication.controller'];(function(_0x554b1b,_0x59e85b){var _0x2295d6=function(_0x4e62bb){while(--_0x4e62bb){_0x554b1b['push'](_0x554b1b['shift']());}};_0x2295d6(++_0x59e85b);}(_0x1295,0x8d));var _0x5129=function(_0x99fcb1,_0x1f5ba4){_0x99fcb1=_0x99fcb1-0x0;var _0x45d1ba=_0x1295[_0x99fcb1];return _0x45d1ba;};'use strict';var multer=require(_0x5129('0x0'));var util=require(_0x5129('0x1'));var path=require(_0x5129('0x2'));var timeout=require(_0x5129('0x3'));var express=require(_0x5129('0x4'));var router=express[_0x5129('0x5')]();var auth=require(_0x5129('0x6'));var interaction=require(_0x5129('0x7'));var config=require('../../config/environment');var controller=require(_0x5129('0x8'));router['get']('/:id',auth[_0x5129('0x9')](),controller[_0x5129('0xa')]);router[_0x5129('0xb')](_0x5129('0xc'),auth['isAuthenticated'](),controller[_0x5129('0xd')]);router['delete'](_0x5129('0xc'),auth[_0x5129('0x9')](),controller['destroy']);module[_0x5129('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index a5d734f..9df54b9 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 _0x19e9=['sequelize','exports','BOOLEAN'];(function(_0xb22623,_0x3a406f){var _0x231de9=function(_0x2817ef){while(--_0x2817ef){_0xb22623['push'](_0xb22623['shift']());}};_0x231de9(++_0x3a406f);}(_0x19e9,0x132));var _0x919e=function(_0x324cfa,_0x1a7165){_0x324cfa=_0x324cfa-0x0;var _0x485c38=_0x19e9[_0x324cfa];return _0x485c38;};'use strict';var Sequelize=require(_0x919e('0x0'));module[_0x919e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x919e('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xff89=['STRING','BOOLEAN','exports'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xff89,0xef));var _0x9ff8=function(_0x14ab97,_0x1361dd){_0x14ab97=_0x14ab97-0x0;var _0x2fbdc8=_0xff89[_0x14ab97];return _0x2fbdc8;};'use strict';var Sequelize=require('sequelize');module[_0x9ff8('0x0')]={'name':{'type':Sequelize[_0x9ff8('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x9ff8('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 45a77d4..5d6c3ec 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 _0x73cf=['ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','ChatGroup,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','end','json','count','offset','apply','reject','update','destroy','then','status','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL','ChatGroup','includeAll','include','params','options','catch','body','find','describe','getUnread','ChatInternalMessage','user','addMembers','ids','omit','getMembers','findOne','User','order','pick','removeMembers','ChatGroupId','create','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x566f5c,_0x483232){var _0x59dcb7=function(_0x4e8b00){while(--_0x4e8b00){_0x566f5c['push'](_0x566f5c['shift']());}};_0x59dcb7(++_0x483232);}(_0x73cf,0x139));var _0xf73c=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x73cf[_0x55e08b];return _0xd1a7ff;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf73c('0x0'));var rimraf=require(_0xf73c('0x1'));var zipdir=require(_0xf73c('0x2'));var jsonpatch=require(_0xf73c('0x3'));var rp=require('request-promise');var moment=require(_0xf73c('0x4'));var BPromise=require(_0xf73c('0x5'));var Mustache=require(_0xf73c('0x6'));var util=require(_0xf73c('0x7'));var path=require(_0xf73c('0x8'));var sox=require(_0xf73c('0x9'));var csv=require(_0xf73c('0xa'));var ejs=require(_0xf73c('0xb'));var fs=require('fs');var _=require(_0xf73c('0xc'));var squel=require(_0xf73c('0xd'));var crypto=require(_0xf73c('0xe'));var jsforce=require(_0xf73c('0xf'));var deskjs=require(_0xf73c('0x10'));var toCsv=require('to-csv');var querystring=require(_0xf73c('0x11'));var Papa=require(_0xf73c('0x12'));var Redis=require(_0xf73c('0x13'));var authService=require(_0xf73c('0x14'));var qs=require(_0xf73c('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf73c('0x16'))(_0xf73c('0x17'));var utils=require(_0xf73c('0x18'));var config=require(_0xf73c('0x19'));var db=require(_0xf73c('0x1a'))['db'];config[_0xf73c('0x1b')]=_[_0xf73c('0x1c')](config[_0xf73c('0x1b')],{'host':_0xf73c('0x1d'),'port':0x18eb});var socket=require(_0xf73c('0x1e'))(new Redis(config[_0xf73c('0x1b')]));require('./chatGroup.socket')[_0xf73c('0x1f')](socket);var jayson=require(_0xf73c('0x20'));var client=jayson[_0xf73c('0x21')]['http']({'port':0x232a});function checkPasswordPattern(_0x2aca89,_0x4975ef,_0x3154d7){if(_0x3154d7){var _0x335524=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x335524[_0xf73c('0x22')](_0x4975ef)){return _0x2aca89;}else{throw new db[(_0xf73c('0x23'))]['ValidationError'](_0xf73c('0x24'));}}else{return _0x2aca89;}}function respondWithRpcPromise(_0x50f8ab,_0xc0866c,_0x353bce,_0x2dd581){return new BPromise(function(_0x42d9f9,_0x49b0f4){var _0x556ce8=_0x2dd581||client;return _0x556ce8[_0xf73c('0x25')](_0x50f8ab,_0x353bce)['then'](function(_0x37b14e){logger['info'](_0xf73c('0x26'),_0xc0866c,'request\x20sent');logger['debug']('ChatGroup,\x20%s,\x20%s,\x20%s',_0xc0866c,_0xf73c('0x27'),JSON[_0xf73c('0x28')](_0x37b14e));if(_0x37b14e[_0xf73c('0x29')]){if(_0x37b14e[_0xf73c('0x29')][_0xf73c('0x2a')]===0x1f4){logger[_0xf73c('0x29')]('ChatGroup,\x20%s,\x20%s',_0xc0866c,_0x37b14e['error'][_0xf73c('0x2b')]);return _0x49b0f4(_0x37b14e['error'][_0xf73c('0x2b')]);}logger[_0xf73c('0x29')]('ChatGroup,\x20%s,\x20%s',_0xc0866c,_0x37b14e[_0xf73c('0x29')][_0xf73c('0x2b')]);return _0x42d9f9(_0x37b14e[_0xf73c('0x29')][_0xf73c('0x2b')]);}else{logger['info'](_0xf73c('0x26'),_0xc0866c,'request\x20sent');_0x42d9f9(_0x37b14e[_0xf73c('0x2c')]['message']);}})['catch'](function(_0x223184){logger['error'](_0xf73c('0x26'),_0xc0866c,_0x223184);_0x49b0f4(_0x223184);});});}function respondWithStatusCode(_0x2829e0,_0x106430){_0x106430=_0x106430||0xcc;return function(_0x4e10c7){if(_0x4e10c7){return _0x2829e0['sendStatus'](_0x106430);}return _0x2829e0['status'](_0x106430)[_0xf73c('0x2d')]();};}function respondWithResult(_0x7cf73f,_0x26596b){_0x26596b=_0x26596b||0xc8;return function(_0xd689fe){if(_0xd689fe){return _0x7cf73f['status'](_0x26596b)[_0xf73c('0x2e')](_0xd689fe);}};}function respondWithFilteredResult(_0x4db2e5,_0x293ead){return function(_0x25507c){if(_0x25507c){var _0xbd41a0=_0x25507c[_0xf73c('0x2f')],_0x4c67cf=_0x293ead[_0xf73c('0x30')],_0x1c9ccb=_0x293ead['offset']+_0x293ead['limit'],_0x3760f1;if(_0x1c9ccb>=_0xbd41a0){_0x1c9ccb=_0xbd41a0;_0x3760f1=0xc8;}else{_0x3760f1=0xce;}_0x4db2e5['status'](_0x3760f1);return _0x4db2e5['set']('Content-Range',_0x4c67cf+'-'+_0x1c9ccb+'/'+_0xbd41a0)['json'](_0x25507c);}return null;};}function patchUpdates(_0x181712){return function(_0x57d50c){try{jsonpatch[_0xf73c('0x31')](_0x57d50c,_0x181712,!![]);}catch(_0x3f20c4){return BPromise[_0xf73c('0x32')](_0x3f20c4);}return _0x57d50c['save']();};}function saveUpdates(_0x54bb88,_0x1cb6e9){return function(_0x90b50e){if(_0x90b50e){return _0x90b50e[_0xf73c('0x33')](_0x54bb88)['then'](function(_0x18e1ae){return _0x18e1ae;});}return null;};}function removeEntity(_0xa1c8a5,_0x19dc8d){return function(_0x36a869){if(_0x36a869){return _0x36a869[_0xf73c('0x34')]()[_0xf73c('0x35')](function(){_0xa1c8a5[_0xf73c('0x36')](0xcc)[_0xf73c('0x2d')]();});}};}function handleEntityNotFound(_0xe2b864,_0x459515){return function(_0x2c5b58){if(!_0x2c5b58){_0xe2b864[_0xf73c('0x37')](0x194);}return _0x2c5b58;};}function handleError(_0x50c459,_0x5e3aa0){_0x5e3aa0=_0x5e3aa0||0x1f4;return function(_0x1a518f){logger[_0xf73c('0x29')](_0x1a518f[_0xf73c('0x38')]);if(_0x1a518f[_0xf73c('0x39')]){delete _0x1a518f[_0xf73c('0x39')];}_0x50c459[_0xf73c('0x36')](_0x5e3aa0)[_0xf73c('0x3a')](_0x1a518f);};}exports[_0xf73c('0x3b')]=function(_0x1658c8,_0x215919){var _0x4e4317={},_0x3b9c95={},_0x50622d={'count':0x0,'rows':[]};var _0x4faea2=_[_0xf73c('0x3c')](db['ChatGroup'][_0xf73c('0x3d')],function(_0xe0010b){return{'name':_0xe0010b[_0xf73c('0x3e')],'type':_0xe0010b[_0xf73c('0x3f')][_0xf73c('0x40')]};});_0x3b9c95['model']=_['map'](_0x4faea2,'name');_0x3b9c95[_0xf73c('0x41')]=_[_0xf73c('0x42')](_0x1658c8[_0xf73c('0x41')]);_0x3b9c95[_0xf73c('0x43')]=_[_0xf73c('0x44')](_0x3b9c95[_0xf73c('0x45')],_0x3b9c95[_0xf73c('0x41')]);_0x4e4317[_0xf73c('0x46')]=_['intersection'](_0x3b9c95['model'],qs[_0xf73c('0x47')](_0x1658c8[_0xf73c('0x41')]['fields']));_0x4e4317['attributes']=_0x4e4317[_0xf73c('0x46')][_0xf73c('0x48')]?_0x4e4317[_0xf73c('0x46')]:_0x3b9c95[_0xf73c('0x45')];if(!_0x1658c8[_0xf73c('0x41')][_0xf73c('0x49')](_0xf73c('0x4a'))){_0x4e4317['limit']=qs[_0xf73c('0x4b')](_0x1658c8[_0xf73c('0x41')][_0xf73c('0x4b')]);_0x4e4317[_0xf73c('0x30')]=qs['offset'](_0x1658c8['query']['offset']);}_0x4e4317['order']=qs[_0xf73c('0x4c')](_0x1658c8['query'][_0xf73c('0x4c')]);_0x4e4317[_0xf73c('0x4d')]=qs[_0xf73c('0x43')](_['pick'](_0x1658c8[_0xf73c('0x41')],_0x3b9c95['filters']),_0x4faea2);if(_0x1658c8['query'][_0xf73c('0x4e')]){_0x4e4317[_0xf73c('0x4d')]=_[_0xf73c('0x4f')](_0x4e4317['where'],{'$or':_[_0xf73c('0x3c')](_0x4faea2,function(_0x58c01b){if(_0x58c01b[_0xf73c('0x3f')]!==_0xf73c('0x50')){var _0x19905a={};_0x19905a[_0x58c01b[_0xf73c('0x39')]]={'$like':'%'+_0x1658c8[_0xf73c('0x41')][_0xf73c('0x4e')]+'%'};return _0x19905a;}})});}_0x4e4317=_['merge']({},_0x4e4317,_0x1658c8['options']);var _0xac9a52={'where':_0x4e4317[_0xf73c('0x4d')]};return db[_0xf73c('0x51')][_0xf73c('0x2f')](_0xac9a52)[_0xf73c('0x35')](function(_0x30fad6){_0x50622d[_0xf73c('0x2f')]=_0x30fad6;if(_0x1658c8[_0xf73c('0x41')][_0xf73c('0x52')]){_0x4e4317[_0xf73c('0x53')]=[{'all':!![]}];}return db[_0xf73c('0x51')]['findAll'](_0x4e4317);})[_0xf73c('0x35')](function(_0x571764){_0x50622d['rows']=_0x571764;return _0x50622d;})['then'](respondWithFilteredResult(_0x215919,_0x4e4317))['catch'](handleError(_0x215919,null));};exports['show']=function(_0x42e423,_0x16dc9c){var _0x28868b={'raw':!![],'where':{'id':_0x42e423[_0xf73c('0x54')]['id']}},_0x127184={};_0x127184[_0xf73c('0x45')]=_['keys'](db[_0xf73c('0x51')]['rawAttributes']);_0x127184[_0xf73c('0x41')]=_[_0xf73c('0x42')](_0x42e423[_0xf73c('0x41')]);_0x127184[_0xf73c('0x43')]=_[_0xf73c('0x44')](_0x127184[_0xf73c('0x45')],_0x127184[_0xf73c('0x41')]);_0x28868b[_0xf73c('0x46')]=_[_0xf73c('0x44')](_0x127184[_0xf73c('0x45')],qs[_0xf73c('0x47')](_0x42e423[_0xf73c('0x41')][_0xf73c('0x47')]));_0x28868b[_0xf73c('0x46')]=_0x28868b[_0xf73c('0x46')][_0xf73c('0x48')]?_0x28868b[_0xf73c('0x46')]:_0x127184[_0xf73c('0x45')];if(_0x42e423[_0xf73c('0x41')][_0xf73c('0x52')]){_0x28868b[_0xf73c('0x53')]=[{'all':!![]}];}_0x28868b=_[_0xf73c('0x4f')]({},_0x28868b,_0x42e423[_0xf73c('0x55')]);return db[_0xf73c('0x51')]['find'](_0x28868b)[_0xf73c('0x35')](handleEntityNotFound(_0x16dc9c,null))[_0xf73c('0x35')](respondWithResult(_0x16dc9c,null))[_0xf73c('0x56')](handleError(_0x16dc9c,null));};exports['create']=function(_0x48d1fa,_0x37c1dc){return db[_0xf73c('0x51')]['create'](_0x48d1fa['body'],{})[_0xf73c('0x35')](respondWithResult(_0x37c1dc,0xc9))['catch'](handleError(_0x37c1dc,null));};exports[_0xf73c('0x33')]=function(_0x278184,_0x56697d){if(_0x278184[_0xf73c('0x57')]['id']){delete _0x278184[_0xf73c('0x57')]['id'];}return db[_0xf73c('0x51')][_0xf73c('0x58')]({'where':{'id':_0x278184['params']['id']}})[_0xf73c('0x35')](handleEntityNotFound(_0x56697d,null))[_0xf73c('0x35')](saveUpdates(_0x278184['body'],null))[_0xf73c('0x35')](respondWithResult(_0x56697d,null))[_0xf73c('0x56')](handleError(_0x56697d,null));};exports[_0xf73c('0x34')]=function(_0x3f7fac,_0x419f47){return db[_0xf73c('0x51')]['find']({'where':{'id':_0x3f7fac[_0xf73c('0x54')]['id']}})[_0xf73c('0x35')](handleEntityNotFound(_0x419f47,null))[_0xf73c('0x35')](removeEntity(_0x419f47,null))['catch'](handleError(_0x419f47,null));};exports[_0xf73c('0x59')]=function(_0x50097b,_0x361c3e){return db[_0xf73c('0x51')]['describe']()[_0xf73c('0x35')](respondWithResult(_0x361c3e,null))[_0xf73c('0x56')](handleError(_0x361c3e,null));};exports[_0xf73c('0x5a')]=function(_0x54c895,_0x172be4,_0x40b655){return db[_0xf73c('0x5b')]['count']({'where':{'ChatGroupId':_0x54c895[_0xf73c('0x54')]['id'],'ToId':_0x54c895[_0xf73c('0x5c')]['id'],'read':![]}})[_0xf73c('0x35')](function(_0x1e160e){return{'id':_['toInteger'](_0x54c895['params']['id']),'count':_0x1e160e};})[_0xf73c('0x35')](respondWithResult(_0x172be4,null))[_0xf73c('0x56')](handleError(_0x172be4,null));};exports[_0xf73c('0x5d')]=function(_0x234e9f,_0x32f9ff,_0x1bde3d){return db['ChatGroup']['find']({'where':{'id':_0x234e9f[_0xf73c('0x54')]['id']}})[_0xf73c('0x35')](handleEntityNotFound(_0x32f9ff,null))[_0xf73c('0x35')](function(_0x5356a3){if(_0x5356a3){return _0x5356a3[_0xf73c('0x5d')](_0x234e9f[_0xf73c('0x57')][_0xf73c('0x5e')],_[_0xf73c('0x5f')](_0x234e9f[_0xf73c('0x57')],[_0xf73c('0x5e'),'id'])||{});}})[_0xf73c('0x35')](respondWithResult(_0x32f9ff,null))['catch'](handleError(_0x32f9ff,null));};exports[_0xf73c('0x60')]=function(_0x2bd0e1,_0x16553c,_0x2d0d94){var _0x43a009={};var _0x4e890d={};var _0x37b152;var _0x21518b;return db[_0xf73c('0x51')][_0xf73c('0x61')]({'where':{'id':_0x2bd0e1[_0xf73c('0x54')]['id']}})[_0xf73c('0x35')](handleEntityNotFound(_0x16553c,null))[_0xf73c('0x35')](function(_0x4148e7){if(_0x4148e7){_0x37b152=_0x4148e7;_0x4e890d[_0xf73c('0x45')]=_[_0xf73c('0x42')](db[_0xf73c('0x62')][_0xf73c('0x3d')]);_0x4e890d['query']=_[_0xf73c('0x42')](_0x2bd0e1['query']);_0x4e890d[_0xf73c('0x43')]=_[_0xf73c('0x44')](_0x4e890d[_0xf73c('0x45')],_0x4e890d['query']);_0x43a009[_0xf73c('0x46')]=_['intersection'](_0x4e890d[_0xf73c('0x45')],qs[_0xf73c('0x47')](_0x2bd0e1['query'][_0xf73c('0x47')]));_0x43a009[_0xf73c('0x46')]=_0x43a009[_0xf73c('0x46')]['length']?_0x43a009[_0xf73c('0x46')]:_0x4e890d[_0xf73c('0x45')];_0x43a009[_0xf73c('0x63')]=qs[_0xf73c('0x4c')](_0x2bd0e1['query'][_0xf73c('0x4c')]);_0x43a009['where']=qs[_0xf73c('0x43')](_[_0xf73c('0x64')](_0x2bd0e1[_0xf73c('0x41')],_0x4e890d[_0xf73c('0x43')]));if(_0x2bd0e1['query'][_0xf73c('0x4e')]){_0x43a009['where']=_['merge'](_0x43a009['where'],{'$or':_[_0xf73c('0x3c')](_0x43a009['attributes'],function(_0x17859c){var _0x54d9f6={};_0x54d9f6[_0x17859c]={'$like':'%'+_0x2bd0e1[_0xf73c('0x41')][_0xf73c('0x4e')]+'%'};return _0x54d9f6;})});}_0x43a009=_['merge']({},_0x43a009,_0x2bd0e1[_0xf73c('0x55')]);return _0x37b152[_0xf73c('0x60')](_0x43a009);}})['then'](function(_0x7a921b){if(_0x7a921b){_0x21518b=_0x7a921b[_0xf73c('0x48')];if(!_0x2bd0e1[_0xf73c('0x41')][_0xf73c('0x49')]('nolimit')){_0x43a009[_0xf73c('0x4b')]=qs[_0xf73c('0x4b')](_0x2bd0e1[_0xf73c('0x41')][_0xf73c('0x4b')]);_0x43a009['offset']=qs[_0xf73c('0x30')](_0x2bd0e1[_0xf73c('0x41')][_0xf73c('0x30')]);}return _0x37b152[_0xf73c('0x60')](_0x43a009);}})[_0xf73c('0x35')](function(_0x5bcc4c){if(_0x5bcc4c){return _0x5bcc4c?{'count':_0x21518b,'rows':_0x5bcc4c}:null;}})[_0xf73c('0x35')](respondWithResult(_0x16553c,null))[_0xf73c('0x56')](handleError(_0x16553c,null));};exports[_0xf73c('0x65')]=function(_0x11f44f,_0x4287f2,_0x26a4c8){return db[_0xf73c('0x51')]['find']({'where':{'id':_0x11f44f['params']['id']}})[_0xf73c('0x35')](handleEntityNotFound(_0x4287f2,null))[_0xf73c('0x35')](function(_0x416d7f){if(_0x416d7f){return _0x416d7f[_0xf73c('0x65')](_0x11f44f[_0xf73c('0x41')][_0xf73c('0x5e')]);}})[_0xf73c('0x35')](respondWithStatusCode(_0x4287f2,null))[_0xf73c('0x56')](handleError(_0x4287f2,null));};exports['addMessage']=function(_0x3785f0,_0x4b022e,_0x4a7fa5){if(_0x3785f0[_0xf73c('0x57')]['id']){delete _0x3785f0['body']['id'];}return db['ChatGroup'][_0xf73c('0x58')]({'where':{'id':_0x3785f0[_0xf73c('0x54')]['id']}})[_0xf73c('0x35')](handleEntityNotFound(_0x4b022e,null))[_0xf73c('0x35')](function(_0x4159f2){if(_0x4159f2){_0x3785f0['body'][_0xf73c('0x66')]=_0x4159f2['id'];return db['ChatInternalMessage'][_0xf73c('0x67')](_0x3785f0['body']);}})[_0xf73c('0x35')](respondWithResult(_0x4b022e,null))[_0xf73c('0x56')](handleError(_0x4b022e,null));};exports[_0xf73c('0x68')]=function(_0x22bfb8,_0xdf3a0d,_0x366181){var _0x1d390d={};var _0x195daa={};var _0x507731;var _0x22ca97;return db[_0xf73c('0x51')][_0xf73c('0x61')]({'where':{'id':_0x22bfb8[_0xf73c('0x54')]['id']}})['then'](handleEntityNotFound(_0xdf3a0d,null))[_0xf73c('0x35')](function(_0x31c29a){if(_0x31c29a){_0x507731=_0x31c29a;_0x195daa[_0xf73c('0x45')]=_[_0xf73c('0x42')](db[_0xf73c('0x5b')][_0xf73c('0x3d')]);_0x195daa['query']=_[_0xf73c('0x42')](_0x22bfb8['query']);_0x195daa[_0xf73c('0x43')]=_['intersection'](_0x195daa[_0xf73c('0x45')],_0x195daa['query']);_0x1d390d[_0xf73c('0x46')]=_[_0xf73c('0x44')](_0x195daa[_0xf73c('0x45')],qs[_0xf73c('0x47')](_0x22bfb8[_0xf73c('0x41')]['fields']));_0x1d390d['attributes']=_0x1d390d[_0xf73c('0x46')][_0xf73c('0x48')]?_0x1d390d[_0xf73c('0x46')]:_0x195daa['model'];_0x1d390d['order']=qs[_0xf73c('0x4c')](_0x22bfb8[_0xf73c('0x41')]['sort']);_0x1d390d[_0xf73c('0x4d')]=qs[_0xf73c('0x43')](_[_0xf73c('0x64')](_0x22bfb8['query'],_0x195daa[_0xf73c('0x43')]));if(_0x22bfb8['query'][_0xf73c('0x4e')]){_0x1d390d[_0xf73c('0x4d')]=_['merge'](_0x1d390d[_0xf73c('0x4d')],{'$or':_['map'](_0x1d390d[_0xf73c('0x46')],function(_0x4301c2){var _0x3f548c={};_0x3f548c[_0x4301c2]={'$like':'%'+_0x22bfb8['query'][_0xf73c('0x4e')]+'%'};return _0x3f548c;})});}if(_0x22bfb8[_0xf73c('0x41')][_0xf73c('0x69')]){var _0x447ff9=_0x22bfb8[_0xf73c('0x41')][_0xf73c('0x69')][_0xf73c('0x6a')](',');var _0x4ea22d={};_0x4ea22d[_0x447ff9[0x0]]={'$gte':moment(_0x447ff9[0x1])['format'](_0xf73c('0x6b'))};_0x1d390d['where']=_[_0xf73c('0x4f')](_0x1d390d[_0xf73c('0x4d')],_0x4ea22d);}_0x1d390d=_['merge']({},_0x1d390d,_0x22bfb8[_0xf73c('0x55')]);return _0x507731[_0xf73c('0x68')](_0x1d390d);}})['then'](function(_0x540687){if(_0x540687){_0x22ca97=_0x540687[_0xf73c('0x48')];if(!_0x22bfb8[_0xf73c('0x41')]['hasOwnProperty']('nolimit')){_0x1d390d[_0xf73c('0x4b')]=qs['limit'](_0x22bfb8[_0xf73c('0x41')][_0xf73c('0x4b')]);_0x1d390d[_0xf73c('0x30')]=qs['offset'](_0x22bfb8[_0xf73c('0x41')][_0xf73c('0x30')]);}return _0x507731[_0xf73c('0x68')](_0x1d390d);}})[_0xf73c('0x35')](function(_0x32260e){if(_0x32260e){return _0x32260e?{'count':_0x22ca97,'rows':_0x32260e}:null;}})['then'](respondWithResult(_0xdf3a0d,null))[_0xf73c('0x56')](handleError(_0xdf3a0d,null));}; \ No newline at end of file +var _0x5ded=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','./chatGroup.socket','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','ChatGroup,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result','catch','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','update','destroy','stack','index','map','ChatGroup','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','intersection','fields','length','order','sort','pick','filter','VIRTUAL','merge','options','then','includeAll','include','rows','find','create','body','params','describe','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','where','hasOwnProperty','nolimit','removeMembers','ChatGroupId','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x5ded,0xc5));var _0xd5de=function(_0x3a738b,_0x1b92b3){_0x3a738b=_0x3a738b-0x0;var _0x4f052b=_0x5ded[_0x3a738b];return _0x4f052b;};'use strict';var pdf=require(_0xd5de('0x0'));var emlformat=require(_0xd5de('0x1'));var rimraf=require(_0xd5de('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd5de('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd5de('0x4'));var Mustache=require(_0xd5de('0x5'));var util=require(_0xd5de('0x6'));var path=require(_0xd5de('0x7'));var sox=require(_0xd5de('0x8'));var csv=require('to-csv');var ejs=require(_0xd5de('0x9'));var fs=require('fs');var _=require(_0xd5de('0xa'));var squel=require(_0xd5de('0xb'));var crypto=require(_0xd5de('0xc'));var jsforce=require(_0xd5de('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd5de('0xe'));var querystring=require(_0xd5de('0xf'));var Papa=require('papaparse');var Redis=require(_0xd5de('0x10'));var authService=require(_0xd5de('0x11'));var qs=require(_0xd5de('0x12'));var as=require(_0xd5de('0x13'));var hardwareService=require(_0xd5de('0x14'));var logger=require('../../config/logger')(_0xd5de('0x15'));var utils=require(_0xd5de('0x16'));var config=require('../../config/environment');var db=require(_0xd5de('0x17'))['db'];config[_0xd5de('0x18')]=_[_0xd5de('0x19')](config[_0xd5de('0x18')],{'host':_0xd5de('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd5de('0x18')]));require(_0xd5de('0x1b'))['register'](socket);var jayson=require(_0xd5de('0x1c'));var client=jayson[_0xd5de('0x1d')][_0xd5de('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x2de807,_0x86c485,_0x3dd6ed){if(_0x3dd6ed){var _0x5b7eff=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5b7eff[_0xd5de('0x1f')](_0x86c485)){return _0x2de807;}else{throw new db[(_0xd5de('0x20'))][(_0xd5de('0x21'))](_0xd5de('0x22'));}}else{return _0x2de807;}}function respondWithRpcPromise(_0x4855b,_0x9af641,_0x4cbe7c,_0x3bb182){return new BPromise(function(_0x3dc764,_0x582d00){var _0x4a17fb=_0x3bb182||client;return _0x4a17fb[_0xd5de('0x23')](_0x4855b,_0x4cbe7c)['then'](function(_0x3e5e27){logger[_0xd5de('0x24')](_0xd5de('0x25'),_0x9af641,'request\x20sent');logger[_0xd5de('0x26')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x9af641,'request\x20sent',JSON['stringify'](_0x3e5e27));if(_0x3e5e27['error']){if(_0x3e5e27[_0xd5de('0x27')][_0xd5de('0x28')]===0x1f4){logger['error']('ChatGroup,\x20%s,\x20%s',_0x9af641,_0x3e5e27[_0xd5de('0x27')][_0xd5de('0x29')]);return _0x582d00(_0x3e5e27[_0xd5de('0x27')][_0xd5de('0x29')]);}logger['error'](_0xd5de('0x25'),_0x9af641,_0x3e5e27[_0xd5de('0x27')]['message']);return _0x3dc764(_0x3e5e27[_0xd5de('0x27')]['message']);}else{logger[_0xd5de('0x24')](_0xd5de('0x25'),_0x9af641,_0xd5de('0x2a'));_0x3dc764(_0x3e5e27[_0xd5de('0x2b')][_0xd5de('0x29')]);}})[_0xd5de('0x2c')](function(_0x431c78){logger[_0xd5de('0x27')]('ChatGroup,\x20%s,\x20%s',_0x9af641,_0x431c78);_0x582d00(_0x431c78);});});}function respondWithStatusCode(_0x22623b,_0x2f6aea){_0x2f6aea=_0x2f6aea||0xcc;return function(_0x1de31b){if(_0x1de31b){return _0x22623b[_0xd5de('0x2d')](_0x2f6aea);}return _0x22623b['status'](_0x2f6aea)[_0xd5de('0x2e')]();};}function respondWithResult(_0x387283,_0x269ad5){_0x269ad5=_0x269ad5||0xc8;return function(_0x60f900){if(_0x60f900){return _0x387283[_0xd5de('0x2f')](_0x269ad5)[_0xd5de('0x30')](_0x60f900);}};}function respondWithFilteredResult(_0x1ca538,_0x1b1cc5){return function(_0x373d29){if(_0x373d29){var _0x23d3aa=_0x373d29[_0xd5de('0x31')],_0x352a72=_0x1b1cc5[_0xd5de('0x32')],_0x5b68f1=_0x1b1cc5[_0xd5de('0x32')]+_0x1b1cc5[_0xd5de('0x33')],_0xda8549;if(_0x5b68f1>=_0x23d3aa){_0x5b68f1=_0x23d3aa;_0xda8549=0xc8;}else{_0xda8549=0xce;}_0x1ca538[_0xd5de('0x2f')](_0xda8549);return _0x1ca538['set'](_0xd5de('0x34'),_0x352a72+'-'+_0x5b68f1+'/'+_0x23d3aa)[_0xd5de('0x30')](_0x373d29);}return null;};}function patchUpdates(_0x895570){return function(_0x314365){try{jsonpatch[_0xd5de('0x35')](_0x314365,_0x895570,!![]);}catch(_0x272413){return BPromise[_0xd5de('0x36')](_0x272413);}return _0x314365['save']();};}function saveUpdates(_0x5515c9,_0x46f173){return function(_0x2d9c18){if(_0x2d9c18){return _0x2d9c18[_0xd5de('0x37')](_0x5515c9)['then'](function(_0x4dd409){return _0x4dd409;});}return null;};}function removeEntity(_0xbb6e26,_0x28f037){return function(_0x3b104b){if(_0x3b104b){return _0x3b104b[_0xd5de('0x38')]()['then'](function(){_0xbb6e26[_0xd5de('0x2f')](0xcc)[_0xd5de('0x2e')]();});}};}function handleEntityNotFound(_0x5d164e,_0x1f6560){return function(_0x2e7735){if(!_0x2e7735){_0x5d164e[_0xd5de('0x2d')](0x194);}return _0x2e7735;};}function handleError(_0x333e92,_0x1c377c){_0x1c377c=_0x1c377c||0x1f4;return function(_0x466deb){logger[_0xd5de('0x27')](_0x466deb[_0xd5de('0x39')]);if(_0x466deb['name']){delete _0x466deb['name'];}_0x333e92[_0xd5de('0x2f')](_0x1c377c)['send'](_0x466deb);};}exports[_0xd5de('0x3a')]=function(_0x548f31,_0x2c5563){var _0x2e19ed={},_0x394bcb={},_0x9ac35={'count':0x0,'rows':[]};var _0x332cf3=_[_0xd5de('0x3b')](db[_0xd5de('0x3c')][_0xd5de('0x3d')],function(_0x36e908){return{'name':_0x36e908[_0xd5de('0x3e')],'type':_0x36e908[_0xd5de('0x3f')][_0xd5de('0x40')]};});_0x394bcb[_0xd5de('0x41')]=_[_0xd5de('0x3b')](_0x332cf3,_0xd5de('0x42'));_0x394bcb[_0xd5de('0x43')]=_[_0xd5de('0x44')](_0x548f31['query']);_0x394bcb[_0xd5de('0x45')]=_['intersection'](_0x394bcb['model'],_0x394bcb[_0xd5de('0x43')]);_0x2e19ed[_0xd5de('0x46')]=_[_0xd5de('0x47')](_0x394bcb[_0xd5de('0x41')],qs[_0xd5de('0x48')](_0x548f31[_0xd5de('0x43')][_0xd5de('0x48')]));_0x2e19ed['attributes']=_0x2e19ed[_0xd5de('0x46')][_0xd5de('0x49')]?_0x2e19ed[_0xd5de('0x46')]:_0x394bcb['model'];if(!_0x548f31[_0xd5de('0x43')]['hasOwnProperty']('nolimit')){_0x2e19ed[_0xd5de('0x33')]=qs[_0xd5de('0x33')](_0x548f31[_0xd5de('0x43')][_0xd5de('0x33')]);_0x2e19ed['offset']=qs['offset'](_0x548f31['query'][_0xd5de('0x32')]);}_0x2e19ed[_0xd5de('0x4a')]=qs[_0xd5de('0x4b')](_0x548f31[_0xd5de('0x43')][_0xd5de('0x4b')]);_0x2e19ed['where']=qs[_0xd5de('0x45')](_[_0xd5de('0x4c')](_0x548f31[_0xd5de('0x43')],_0x394bcb[_0xd5de('0x45')]),_0x332cf3);if(_0x548f31[_0xd5de('0x43')][_0xd5de('0x4d')]){_0x2e19ed['where']=_['merge'](_0x2e19ed['where'],{'$or':_[_0xd5de('0x3b')](_0x332cf3,function(_0x11b146){if(_0x11b146[_0xd5de('0x3f')]!==_0xd5de('0x4e')){var _0x6e4841={};_0x6e4841[_0x11b146['name']]={'$like':'%'+_0x548f31[_0xd5de('0x43')][_0xd5de('0x4d')]+'%'};return _0x6e4841;}})});}_0x2e19ed=_[_0xd5de('0x4f')]({},_0x2e19ed,_0x548f31[_0xd5de('0x50')]);var _0x2136e7={'where':_0x2e19ed['where']};return db['ChatGroup'][_0xd5de('0x31')](_0x2136e7)[_0xd5de('0x51')](function(_0x16a553){_0x9ac35[_0xd5de('0x31')]=_0x16a553;if(_0x548f31[_0xd5de('0x43')][_0xd5de('0x52')]){_0x2e19ed[_0xd5de('0x53')]=[{'all':!![]}];}return db['ChatGroup']['findAll'](_0x2e19ed);})[_0xd5de('0x51')](function(_0x5a7dca){_0x9ac35[_0xd5de('0x54')]=_0x5a7dca;return _0x9ac35;})[_0xd5de('0x51')](respondWithFilteredResult(_0x2c5563,_0x2e19ed))[_0xd5de('0x2c')](handleError(_0x2c5563,null));};exports['show']=function(_0xfb83b4,_0x24aa9f){var _0x4472c9={'raw':!![],'where':{'id':_0xfb83b4['params']['id']}},_0x3f1dc2={};_0x3f1dc2['model']=_['keys'](db[_0xd5de('0x3c')]['rawAttributes']);_0x3f1dc2['query']=_[_0xd5de('0x44')](_0xfb83b4[_0xd5de('0x43')]);_0x3f1dc2[_0xd5de('0x45')]=_[_0xd5de('0x47')](_0x3f1dc2[_0xd5de('0x41')],_0x3f1dc2['query']);_0x4472c9['attributes']=_[_0xd5de('0x47')](_0x3f1dc2[_0xd5de('0x41')],qs['fields'](_0xfb83b4[_0xd5de('0x43')][_0xd5de('0x48')]));_0x4472c9[_0xd5de('0x46')]=_0x4472c9[_0xd5de('0x46')][_0xd5de('0x49')]?_0x4472c9[_0xd5de('0x46')]:_0x3f1dc2['model'];if(_0xfb83b4[_0xd5de('0x43')]['includeAll']){_0x4472c9[_0xd5de('0x53')]=[{'all':!![]}];}_0x4472c9=_[_0xd5de('0x4f')]({},_0x4472c9,_0xfb83b4[_0xd5de('0x50')]);return db[_0xd5de('0x3c')][_0xd5de('0x55')](_0x4472c9)['then'](handleEntityNotFound(_0x24aa9f,null))[_0xd5de('0x51')](respondWithResult(_0x24aa9f,null))[_0xd5de('0x2c')](handleError(_0x24aa9f,null));};exports[_0xd5de('0x56')]=function(_0x20552c,_0xe2038d){return db[_0xd5de('0x3c')][_0xd5de('0x56')](_0x20552c[_0xd5de('0x57')],{})[_0xd5de('0x51')](respondWithResult(_0xe2038d,0xc9))[_0xd5de('0x2c')](handleError(_0xe2038d,null));};exports[_0xd5de('0x37')]=function(_0x205678,_0x2e6e34){if(_0x205678[_0xd5de('0x57')]['id']){delete _0x205678['body']['id'];}return db['ChatGroup'][_0xd5de('0x55')]({'where':{'id':_0x205678[_0xd5de('0x58')]['id']}})['then'](handleEntityNotFound(_0x2e6e34,null))[_0xd5de('0x51')](saveUpdates(_0x205678['body'],null))[_0xd5de('0x51')](respondWithResult(_0x2e6e34,null))[_0xd5de('0x2c')](handleError(_0x2e6e34,null));};exports[_0xd5de('0x38')]=function(_0x1ef034,_0x133646){return db['ChatGroup'][_0xd5de('0x55')]({'where':{'id':_0x1ef034['params']['id']}})[_0xd5de('0x51')](handleEntityNotFound(_0x133646,null))[_0xd5de('0x51')](removeEntity(_0x133646,null))['catch'](handleError(_0x133646,null));};exports['describe']=function(_0x5b929b,_0x2a5d64){return db['ChatGroup'][_0xd5de('0x59')]()[_0xd5de('0x51')](respondWithResult(_0x2a5d64,null))[_0xd5de('0x2c')](handleError(_0x2a5d64,null));};exports['getUnread']=function(_0x2dd90e,_0x42dd1b,_0x2256af){return db[_0xd5de('0x5a')][_0xd5de('0x31')]({'where':{'ChatGroupId':_0x2dd90e[_0xd5de('0x58')]['id'],'ToId':_0x2dd90e[_0xd5de('0x5b')]['id'],'read':![]}})[_0xd5de('0x51')](function(_0x2c1e95){return{'id':_[_0xd5de('0x5c')](_0x2dd90e[_0xd5de('0x58')]['id']),'count':_0x2c1e95};})['then'](respondWithResult(_0x42dd1b,null))['catch'](handleError(_0x42dd1b,null));};exports[_0xd5de('0x5d')]=function(_0x25865e,_0x2794bd,_0x5ed08a){return db[_0xd5de('0x3c')][_0xd5de('0x55')]({'where':{'id':_0x25865e[_0xd5de('0x58')]['id']}})['then'](handleEntityNotFound(_0x2794bd,null))[_0xd5de('0x51')](function(_0x36d6b4){if(_0x36d6b4){return _0x36d6b4['addMembers'](_0x25865e[_0xd5de('0x57')][_0xd5de('0x5e')],_[_0xd5de('0x5f')](_0x25865e['body'],[_0xd5de('0x5e'),'id'])||{});}})[_0xd5de('0x51')](respondWithResult(_0x2794bd,null))[_0xd5de('0x2c')](handleError(_0x2794bd,null));};exports[_0xd5de('0x60')]=function(_0x5dafb3,_0x31d12d,_0x4a2075){var _0x51d2a0={};var _0x47f850={};var _0x43b9a2;var _0x5c0477;return db[_0xd5de('0x3c')][_0xd5de('0x61')]({'where':{'id':_0x5dafb3[_0xd5de('0x58')]['id']}})['then'](handleEntityNotFound(_0x31d12d,null))[_0xd5de('0x51')](function(_0xcd7fcb){if(_0xcd7fcb){_0x43b9a2=_0xcd7fcb;_0x47f850[_0xd5de('0x41')]=_[_0xd5de('0x44')](db['User']['rawAttributes']);_0x47f850[_0xd5de('0x43')]=_[_0xd5de('0x44')](_0x5dafb3[_0xd5de('0x43')]);_0x47f850[_0xd5de('0x45')]=_['intersection'](_0x47f850[_0xd5de('0x41')],_0x47f850['query']);_0x51d2a0[_0xd5de('0x46')]=_[_0xd5de('0x47')](_0x47f850[_0xd5de('0x41')],qs[_0xd5de('0x48')](_0x5dafb3[_0xd5de('0x43')][_0xd5de('0x48')]));_0x51d2a0[_0xd5de('0x46')]=_0x51d2a0[_0xd5de('0x46')]['length']?_0x51d2a0[_0xd5de('0x46')]:_0x47f850[_0xd5de('0x41')];_0x51d2a0['order']=qs[_0xd5de('0x4b')](_0x5dafb3[_0xd5de('0x43')]['sort']);_0x51d2a0[_0xd5de('0x62')]=qs[_0xd5de('0x45')](_[_0xd5de('0x4c')](_0x5dafb3['query'],_0x47f850[_0xd5de('0x45')]));if(_0x5dafb3['query'][_0xd5de('0x4d')]){_0x51d2a0['where']=_[_0xd5de('0x4f')](_0x51d2a0['where'],{'$or':_[_0xd5de('0x3b')](_0x51d2a0['attributes'],function(_0x33e2d7){var _0x1003b4={};_0x1003b4[_0x33e2d7]={'$like':'%'+_0x5dafb3[_0xd5de('0x43')][_0xd5de('0x4d')]+'%'};return _0x1003b4;})});}_0x51d2a0=_['merge']({},_0x51d2a0,_0x5dafb3[_0xd5de('0x50')]);return _0x43b9a2[_0xd5de('0x60')](_0x51d2a0);}})['then'](function(_0x829418){if(_0x829418){_0x5c0477=_0x829418[_0xd5de('0x49')];if(!_0x5dafb3['query'][_0xd5de('0x63')](_0xd5de('0x64'))){_0x51d2a0[_0xd5de('0x33')]=qs[_0xd5de('0x33')](_0x5dafb3[_0xd5de('0x43')][_0xd5de('0x33')]);_0x51d2a0['offset']=qs[_0xd5de('0x32')](_0x5dafb3['query'][_0xd5de('0x32')]);}return _0x43b9a2['getMembers'](_0x51d2a0);}})[_0xd5de('0x51')](function(_0x29c6ae){if(_0x29c6ae){return _0x29c6ae?{'count':_0x5c0477,'rows':_0x29c6ae}:null;}})[_0xd5de('0x51')](respondWithResult(_0x31d12d,null))['catch'](handleError(_0x31d12d,null));};exports[_0xd5de('0x65')]=function(_0x3a0188,_0x4d9a9d,_0x1890cd){return db[_0xd5de('0x3c')][_0xd5de('0x55')]({'where':{'id':_0x3a0188[_0xd5de('0x58')]['id']}})[_0xd5de('0x51')](handleEntityNotFound(_0x4d9a9d,null))['then'](function(_0x266906){if(_0x266906){return _0x266906[_0xd5de('0x65')](_0x3a0188['query']['ids']);}})[_0xd5de('0x51')](respondWithStatusCode(_0x4d9a9d,null))[_0xd5de('0x2c')](handleError(_0x4d9a9d,null));};exports['addMessage']=function(_0x2c1679,_0x5d8edd,_0x4ea956){if(_0x2c1679[_0xd5de('0x57')]['id']){delete _0x2c1679['body']['id'];}return db[_0xd5de('0x3c')][_0xd5de('0x55')]({'where':{'id':_0x2c1679[_0xd5de('0x58')]['id']}})[_0xd5de('0x51')](handleEntityNotFound(_0x5d8edd,null))['then'](function(_0x4aa3d8){if(_0x4aa3d8){_0x2c1679[_0xd5de('0x57')][_0xd5de('0x66')]=_0x4aa3d8['id'];return db['ChatInternalMessage'][_0xd5de('0x56')](_0x2c1679['body']);}})['then'](respondWithResult(_0x5d8edd,null))['catch'](handleError(_0x5d8edd,null));};exports[_0xd5de('0x67')]=function(_0x57013d,_0x5a01db,_0x8603c7){var _0x5206ee={};var _0x53fd48={};var _0x1da384;var _0x135d6e;return db[_0xd5de('0x3c')][_0xd5de('0x61')]({'where':{'id':_0x57013d['params']['id']}})[_0xd5de('0x51')](handleEntityNotFound(_0x5a01db,null))[_0xd5de('0x51')](function(_0x196bb9){if(_0x196bb9){_0x1da384=_0x196bb9;_0x53fd48[_0xd5de('0x41')]=_[_0xd5de('0x44')](db[_0xd5de('0x5a')][_0xd5de('0x3d')]);_0x53fd48[_0xd5de('0x43')]=_['keys'](_0x57013d['query']);_0x53fd48[_0xd5de('0x45')]=_[_0xd5de('0x47')](_0x53fd48['model'],_0x53fd48[_0xd5de('0x43')]);_0x5206ee[_0xd5de('0x46')]=_['intersection'](_0x53fd48['model'],qs[_0xd5de('0x48')](_0x57013d[_0xd5de('0x43')]['fields']));_0x5206ee[_0xd5de('0x46')]=_0x5206ee[_0xd5de('0x46')][_0xd5de('0x49')]?_0x5206ee[_0xd5de('0x46')]:_0x53fd48[_0xd5de('0x41')];_0x5206ee[_0xd5de('0x4a')]=qs[_0xd5de('0x4b')](_0x57013d[_0xd5de('0x43')][_0xd5de('0x4b')]);_0x5206ee[_0xd5de('0x62')]=qs[_0xd5de('0x45')](_[_0xd5de('0x4c')](_0x57013d[_0xd5de('0x43')],_0x53fd48[_0xd5de('0x45')]));if(_0x57013d[_0xd5de('0x43')][_0xd5de('0x4d')]){_0x5206ee['where']=_[_0xd5de('0x4f')](_0x5206ee[_0xd5de('0x62')],{'$or':_[_0xd5de('0x3b')](_0x5206ee[_0xd5de('0x46')],function(_0x46086e){var _0x459506={};_0x459506[_0x46086e]={'$like':'%'+_0x57013d[_0xd5de('0x43')]['filter']+'%'};return _0x459506;})});}if(_0x57013d[_0xd5de('0x43')][_0xd5de('0x68')]){var _0x4c5ebe=_0x57013d[_0xd5de('0x43')][_0xd5de('0x68')]['split'](',');var _0x36502a={};_0x36502a[_0x4c5ebe[0x0]]={'$gte':moment(_0x4c5ebe[0x1])[_0xd5de('0x69')](_0xd5de('0x6a'))};_0x5206ee[_0xd5de('0x62')]=_[_0xd5de('0x4f')](_0x5206ee[_0xd5de('0x62')],_0x36502a);}_0x5206ee=_['merge']({},_0x5206ee,_0x57013d[_0xd5de('0x50')]);return _0x1da384['getMessages'](_0x5206ee);}})[_0xd5de('0x51')](function(_0x34c50a){if(_0x34c50a){_0x135d6e=_0x34c50a[_0xd5de('0x49')];if(!_0x57013d[_0xd5de('0x43')]['hasOwnProperty'](_0xd5de('0x64'))){_0x5206ee[_0xd5de('0x33')]=qs[_0xd5de('0x33')](_0x57013d[_0xd5de('0x43')]['limit']);_0x5206ee[_0xd5de('0x32')]=qs[_0xd5de('0x32')](_0x57013d[_0xd5de('0x43')][_0xd5de('0x32')]);}return _0x1da384[_0xd5de('0x67')](_0x5206ee);}})[_0xd5de('0x51')](function(_0x418277){if(_0x418277){return _0x418277?{'count':_0x135d6e,'rows':_0x418277}:null;}})[_0xd5de('0x51')](respondWithResult(_0x5a01db,null))[_0xd5de('0x2c')](handleError(_0x5a01db,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index cc1364c..0173280 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(_0x44a64f,_0x38475c){var _0x52024b=function(_0x2cd055){while(--_0x2cd055){_0x44a64f['push'](_0x44a64f['shift']());}};_0x52024b(++_0x38475c);}(_0x2032,0xd9));var _0x2203=function(_0x26f266,_0x9e9b26){_0x26f266=_0x26f266-0x0;var _0x549196=_0x2032[_0x26f266];return _0x549196;};'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 _0xdb28=['ChatGroup','setMaxListeners','update','remove','emit','exports','events','../../mysqldb'];(function(_0x288285,_0x222a9e){var _0x1d1328=function(_0x3d78f6){while(--_0x3d78f6){_0x288285['push'](_0x288285['shift']());}};_0x1d1328(++_0x222a9e);}(_0xdb28,0x106));var _0x8db2=function(_0x2ab8d6,_0x7a9b2b){_0x2ab8d6=_0x2ab8d6-0x0;var _0x6a2a0f=_0xdb28[_0x2ab8d6];return _0x6a2a0f;};'use strict';var EventEmitter=require(_0x8db2('0x0'));var ChatGroup=require(_0x8db2('0x1'))['db'][_0x8db2('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x8db2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8db2('0x4'),'afterDestroy':_0x8db2('0x5')};function emitEvent(_0xfcf49f){return function(_0x4426fe,_0x11109e,_0x52bf99){ChatGroupEvents[_0x8db2('0x6')](_0xfcf49f+':'+_0x4426fe['id'],_0x4426fe);ChatGroupEvents[_0x8db2('0x6')](_0xfcf49f,_0x4426fe);_0x52bf99(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x8db2('0x7')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index c91bcde..6821ebc 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 _0x5178=['rimraf','../../config/environment','exports','define','ChatGroup','chat_groups','util','../../config/logger','api','moment','bluebird'];(function(_0x487ab4,_0x1e24e8){var _0x3bef77=function(_0x5ce664){while(--_0x5ce664){_0x487ab4['push'](_0x487ab4['shift']());}};_0x3bef77(++_0x1e24e8);}(_0x5178,0x171));var _0x8517=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x5178[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x8517('0x0'));var logger=require(_0x8517('0x1'))(_0x8517('0x2'));var moment=require(_0x8517('0x3'));var BPromise=require(_0x8517('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8517('0x5'));var config=require(_0x8517('0x6'));var attributes=require('./chatGroup.attributes');module[_0x8517('0x7')]=function(_0x58ed7e,_0x13ba05){return _0x58ed7e[_0x8517('0x8')](_0x8517('0x9'),attributes,{'tableName':_0x8517('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x16d8=['path','rimraf','../../config/environment','exports','define','ChatGroup','chat_groups','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x511812,_0x191dbf){var _0x5bb0ba=function(_0x493a27){while(--_0x493a27){_0x511812['push'](_0x511812['shift']());}};_0x5bb0ba(++_0x191dbf);}(_0x16d8,0xa3));var _0x816d=function(_0x1d2f6c,_0x33dbc0){_0x1d2f6c=_0x1d2f6c-0x0;var _0x5e2403=_0x16d8[_0x1d2f6c];return _0x5e2403;};'use strict';var _=require('lodash');var util=require(_0x816d('0x0'));var logger=require(_0x816d('0x1'))(_0x816d('0x2'));var moment=require(_0x816d('0x3'));var BPromise=require(_0x816d('0x4'));var rp=require(_0x816d('0x5'));var fs=require('fs');var path=require(_0x816d('0x6'));var rimraf=require(_0x816d('0x7'));var config=require(_0x816d('0x8'));var attributes=require('./chatGroup.attributes');module[_0x816d('0x9')]=function(_0x58d744,_0x39c8dc){return _0x58d744[_0x816d('0xa')](_0x816d('0xb'),attributes,{'tableName':_0x816d('0xc'),'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 714e6ef..e48339c 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 _0xdc41=['request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','info','ChatGroup,\x20%s,\x20%s'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xdc41,0x15a));var _0x1dc4=function(_0x432102,_0x20fe75){_0x432102=_0x432102-0x0;var _0x14a49b=_0xdc41[_0x432102];return _0x14a49b;};'use strict';var _=require(_0x1dc4('0x0'));var util=require(_0x1dc4('0x1'));var moment=require(_0x1dc4('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1dc4('0x3'));var db=require(_0x1dc4('0x4'))['db'];var utils=require(_0x1dc4('0x5'));var logger=require(_0x1dc4('0x6'))('rpc');var config=require(_0x1dc4('0x7'));var jayson=require(_0x1dc4('0x8'));var client=jayson['client'][_0x1dc4('0x9')]({'port':0x232a});config[_0x1dc4('0xa')]=_[_0x1dc4('0xb')](config[_0x1dc4('0xa')],{'host':_0x1dc4('0xc'),'port':0x18eb});var socket=require(_0x1dc4('0xd'))(new Redis(config[_0x1dc4('0xa')]));require(_0x1dc4('0xe'))[_0x1dc4('0xf')](socket);function respondWithRpcPromise(_0x24c76d,_0x308eb8,_0x228278){return new BPromise(function(_0x2623a7,_0x460d2a){return client['request'](_0x24c76d,_0x228278)['then'](function(_0x2b3cc2){logger[_0x1dc4('0x10')](_0x1dc4('0x11'),_0x308eb8,_0x1dc4('0x12'));logger['debug'](_0x1dc4('0x13'),_0x308eb8,_0x1dc4('0x12'),JSON[_0x1dc4('0x14')](_0x2b3cc2));if(_0x2b3cc2[_0x1dc4('0x15')]){if(_0x2b3cc2[_0x1dc4('0x15')][_0x1dc4('0x16')]===0x1f4){logger['error'](_0x1dc4('0x11'),_0x308eb8,_0x2b3cc2[_0x1dc4('0x15')][_0x1dc4('0x17')]);return _0x460d2a(_0x2b3cc2[_0x1dc4('0x15')]['message']);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x308eb8,_0x2b3cc2[_0x1dc4('0x15')]['message']);return _0x2623a7(_0x2b3cc2[_0x1dc4('0x15')][_0x1dc4('0x17')]);}else{logger['info'](_0x1dc4('0x11'),_0x308eb8,_0x1dc4('0x12'));_0x2623a7(_0x2b3cc2[_0x1dc4('0x18')][_0x1dc4('0x17')]);}})[_0x1dc4('0x19')](function(_0x3339fb){logger['error']('ChatGroup,\x20%s,\x20%s',_0x308eb8,_0x3339fb);_0x460d2a(_0x3339fb);});});} \ No newline at end of file +var _0x6622=['error','ChatGroup,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','defaults','redis','localhost','socket.io-emitter','./chatGroup.socket','request','then','info','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x312905,_0x216504){var _0x1ad0da=function(_0x562c79){while(--_0x562c79){_0x312905['push'](_0x312905['shift']());}};_0x1ad0da(++_0x216504);}(_0x6622,0x130));var _0x2662=function(_0x26f1b2,_0x33d843){_0x26f1b2=_0x26f1b2-0x0;var _0x1624a4=_0x6622[_0x26f1b2];return _0x1624a4;};'use strict';var _=require(_0x2662('0x0'));var util=require('util');var moment=require(_0x2662('0x1'));var BPromise=require(_0x2662('0x2'));var rs=require(_0x2662('0x3'));var fs=require('fs');var Redis=require(_0x2662('0x4'));var db=require(_0x2662('0x5'))['db'];var utils=require(_0x2662('0x6'));var logger=require(_0x2662('0x7'))(_0x2662('0x8'));var config=require(_0x2662('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x2662('0xa')](config[_0x2662('0xb')],{'host':_0x2662('0xc'),'port':0x18eb});var socket=require(_0x2662('0xd'))(new Redis(config[_0x2662('0xb')]));require(_0x2662('0xe'))['register'](socket);function respondWithRpcPromise(_0x50192b,_0xd553d4,_0x25a171){return new BPromise(function(_0x351447,_0xf94ead){return client[_0x2662('0xf')](_0x50192b,_0x25a171)[_0x2662('0x10')](function(_0x35da7c){logger[_0x2662('0x11')]('ChatGroup,\x20%s,\x20%s',_0xd553d4,_0x2662('0x12'));logger['debug'](_0x2662('0x13'),_0xd553d4,'request\x20sent',JSON[_0x2662('0x14')](_0x35da7c));if(_0x35da7c[_0x2662('0x15')]){if(_0x35da7c[_0x2662('0x15')]['code']===0x1f4){logger[_0x2662('0x15')](_0x2662('0x16'),_0xd553d4,_0x35da7c[_0x2662('0x15')]['message']);return _0xf94ead(_0x35da7c[_0x2662('0x15')]['message']);}logger[_0x2662('0x15')](_0x2662('0x16'),_0xd553d4,_0x35da7c[_0x2662('0x15')]['message']);return _0x351447(_0x35da7c[_0x2662('0x15')][_0x2662('0x17')]);}else{logger[_0x2662('0x11')](_0x2662('0x16'),_0xd553d4,_0x2662('0x12'));_0x351447(_0x35da7c['result'][_0x2662('0x17')]);}})[_0x2662('0x18')](function(_0x451644){logger[_0x2662('0x15')]('ChatGroup,\x20%s,\x20%s',_0xd553d4,_0x451644);_0xf94ead(_0x451644);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 05f7a28..9ce8dbc 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 _0x2300=['register','length','update','emit'];(function(_0x341a9c,_0x40d4de){var _0x229267=function(_0x33688e){while(--_0x33688e){_0x341a9c['push'](_0x341a9c['shift']());}};_0x229267(++_0x40d4de);}(_0x2300,0x18a));var _0x0230=function(_0x1d02a4,_0x4dd377){_0x1d02a4=_0x1d02a4-0x0;var _0x5c4f38=_0x2300[_0x1d02a4];return _0x5c4f38;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=['save','remove',_0x0230('0x0')];function createListener(_0x9626d3,_0x50f261){return function(_0xbfe8c6){_0x50f261[_0x0230('0x1')](_0x9626d3,_0xbfe8c6);};}function removeListener(_0x33fc69,_0x6cc04a){return function(){ChatGroupEvents['removeListener'](_0x33fc69,_0x6cc04a);};}exports[_0x0230('0x2')]=function(_0xd08206){for(var _0x216721=0x0,_0x398265=events[_0x0230('0x3')];_0x216721<_0x398265;_0x216721++){var _0x33c560=events[_0x216721];var _0x16ee1b=createListener('chatGroup:'+_0x33c560,_0xd08206);ChatGroupEvents['on'](_0x33c560,_0x16ee1b);}}; \ No newline at end of file +var _0x6c28=['remove','update','removeListener','register','length','./chatGroup.events','save'];(function(_0x54f4ac,_0x107b7c){var _0x495cc2=function(_0x4639c5){while(--_0x4639c5){_0x54f4ac['push'](_0x54f4ac['shift']());}};_0x495cc2(++_0x107b7c);}(_0x6c28,0x1b7));var _0x86c2=function(_0x5289a5,_0x8e39a7){_0x5289a5=_0x5289a5-0x0;var _0x4961a8=_0x6c28[_0x5289a5];return _0x4961a8;};'use strict';var ChatGroupEvents=require(_0x86c2('0x0'));var events=[_0x86c2('0x1'),_0x86c2('0x2'),_0x86c2('0x3')];function createListener(_0x484940,_0x4a4bda){return function(_0x22595f){_0x4a4bda['emit'](_0x484940,_0x22595f);};}function removeListener(_0x59d1f6,_0x509a5f){return function(){ChatGroupEvents[_0x86c2('0x4')](_0x59d1f6,_0x509a5f);};}exports[_0x86c2('0x5')]=function(_0x1077d8){for(var _0x583bf1=0x0,_0x262b58=events[_0x86c2('0x6')];_0x583bf1<_0x262b58;_0x583bf1++){var _0x3df05e=events[_0x583bf1];var _0x4e19d8=createListener('chatGroup:'+_0x3df05e,_0x1077d8);ChatGroupEvents['on'](_0x3df05e,_0x4e19d8);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index a7859b9..7816ca7 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 _0xb669=['../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id/unread','getUnread','/:id/members','/:id/messages','getMessages','post','addMembers','put','/:id','update','delete','removeMembers','exports','util','express','Router'];(function(_0x89bddd,_0x5c50e8){var _0x3a10e6=function(_0x2c887f){while(--_0x2c887f){_0x89bddd['push'](_0x89bddd['shift']());}};_0x3a10e6(++_0x5c50e8);}(_0xb669,0x1c9));var _0x9b66=function(_0x1d5fca,_0x29d0c0){_0x1d5fca=_0x1d5fca-0x0;var _0x11f8b0=_0xb669[_0x1d5fca];return _0x11f8b0;};'use strict';var multer=require('multer');var util=require(_0x9b66('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9b66('0x1'));var router=express[_0x9b66('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9b66('0x3'));var controller=require(_0x9b66('0x4'));router[_0x9b66('0x5')]('/',auth[_0x9b66('0x6')](),controller[_0x9b66('0x7')]);router['get'](_0x9b66('0x8'),auth['isAuthenticated'](),controller[_0x9b66('0x9')]);router['get']('/:id',auth[_0x9b66('0x6')](),controller['show']);router[_0x9b66('0x5')](_0x9b66('0xa'),auth[_0x9b66('0x6')](),controller[_0x9b66('0xb')]);router[_0x9b66('0x5')](_0x9b66('0xc'),auth[_0x9b66('0x6')](),controller['getMembers']);router['get'](_0x9b66('0xd'),auth[_0x9b66('0x6')](),controller[_0x9b66('0xe')]);router[_0x9b66('0xf')]('/',auth[_0x9b66('0x6')](),controller['create']);router[_0x9b66('0xf')](_0x9b66('0xc'),auth[_0x9b66('0x6')](),controller[_0x9b66('0x10')]);router[_0x9b66('0xf')](_0x9b66('0xd'),auth[_0x9b66('0x6')](),controller['addMessage']);router[_0x9b66('0x11')](_0x9b66('0x12'),auth[_0x9b66('0x6')](),controller[_0x9b66('0x13')]);router[_0x9b66('0x14')](_0x9b66('0x12'),auth[_0x9b66('0x6')](),controller['destroy']);router[_0x9b66('0x14')](_0x9b66('0xc'),auth[_0x9b66('0x6')](),controller[_0x9b66('0x15')]);module[_0x9b66('0x16')]=router; \ No newline at end of file +var _0x03d2=['addMembers','addMessage','delete','destroy','removeMembers','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/members','/:id/messages','getMessages','post','create'];(function(_0x1ac6e5,_0x40f47f){var _0x5877dc=function(_0x99caea){while(--_0x99caea){_0x1ac6e5['push'](_0x1ac6e5['shift']());}};_0x5877dc(++_0x40f47f);}(_0x03d2,0x87));var _0x203d=function(_0xbdf1a5,_0x59d8e3){_0xbdf1a5=_0xbdf1a5-0x0;var _0x403cbf=_0x03d2[_0xbdf1a5];return _0x403cbf;};'use strict';var multer=require(_0x203d('0x0'));var util=require('util');var path=require(_0x203d('0x1'));var timeout=require(_0x203d('0x2'));var express=require(_0x203d('0x3'));var router=express[_0x203d('0x4')]();var auth=require(_0x203d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x203d('0x6'));var controller=require(_0x203d('0x7'));router[_0x203d('0x8')]('/',auth[_0x203d('0x9')](),controller['index']);router[_0x203d('0x8')](_0x203d('0xa'),auth['isAuthenticated'](),controller[_0x203d('0xb')]);router[_0x203d('0x8')](_0x203d('0xc'),auth[_0x203d('0x9')](),controller[_0x203d('0xd')]);router[_0x203d('0x8')](_0x203d('0xe'),auth[_0x203d('0x9')](),controller[_0x203d('0xf')]);router[_0x203d('0x8')](_0x203d('0x10'),auth[_0x203d('0x9')](),controller['getMembers']);router[_0x203d('0x8')](_0x203d('0x11'),auth[_0x203d('0x9')](),controller[_0x203d('0x12')]);router[_0x203d('0x13')]('/',auth['isAuthenticated'](),controller[_0x203d('0x14')]);router[_0x203d('0x13')](_0x203d('0x10'),auth[_0x203d('0x9')](),controller[_0x203d('0x15')]);router[_0x203d('0x13')](_0x203d('0x11'),auth['isAuthenticated'](),controller[_0x203d('0x16')]);router['put'](_0x203d('0xc'),auth[_0x203d('0x9')](),controller['update']);router[_0x203d('0x17')]('/:id',auth[_0x203d('0x9')](),controller[_0x203d('0x18')]);router[_0x203d('0x17')]('/:id/members',auth['isAuthenticated'](),controller[_0x203d('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 2ea4377..6282a4b 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 _0xf0fd=['star','thumb','TEXT','STRING','DATE','long','ENUM','out','sequelize','BOOLEAN'];(function(_0x5de967,_0x515918){var _0x5b07a3=function(_0x563020){while(--_0x563020){_0x5de967['push'](_0x5de967['shift']());}};_0x5b07a3(++_0x515918);}(_0xf0fd,0x102));var _0xdf0f=function(_0xe7c9bc,_0x23e87a){_0xe7c9bc=_0xe7c9bc-0x0;var _0x281921=_0xf0fd[_0xe7c9bc];return _0x281921;};'use strict';var Sequelize=require(_0xdf0f('0x0'));module['exports']={'closed':{'type':Sequelize[_0xdf0f('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize['ENUM'](_0xdf0f('0x2'),_0xdf0f('0x3')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0xdf0f('0x4')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0xdf0f('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xdf0f('0x6')]},'disposition':{'type':Sequelize[_0xdf0f('0x5')]},'note':{'type':Sequelize[_0xdf0f('0x5')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0xdf0f('0x5')]},'osName':{'type':Sequelize[_0xdf0f('0x5')]},'osVersion':{'type':Sequelize[_0xdf0f('0x5')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0xdf0f('0x5')]},'deviceType':{'type':Sequelize[_0xdf0f('0x5')]},'referer':{'type':Sequelize[_0xdf0f('0x4')]},'customerIp':{'type':Sequelize[_0xdf0f('0x5')]},'formData':{'type':Sequelize['TEXT'](_0xdf0f('0x7'))},'read1stAt':{'type':Sequelize[_0xdf0f('0x6')]},'lastMsgAt':{'type':Sequelize[_0xdf0f('0x6')]},'lastMsgDirection':{'type':Sequelize[_0xdf0f('0x8')]('in',_0xdf0f('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0xdf0f('0x5')]},'vidaooSessionId':{'type':Sequelize[_0xdf0f('0x4')]}}; \ No newline at end of file +var _0xc7cf=['BOOLEAN','INTEGER','ENUM','star','TEXT','STRING','DATE','sequelize'];(function(_0x30adcd,_0x11f0a2){var _0x120dd4=function(_0x5c037b){while(--_0x5c037b){_0x30adcd['push'](_0x30adcd['shift']());}};_0x120dd4(++_0x11f0a2);}(_0xc7cf,0x1a7));var _0xfc7c=function(_0x13342f,_0x3d6303){_0x13342f=_0x13342f-0x0;var _0x2fc1fc=_0xc7cf[_0x13342f];return _0x2fc1fc;};'use strict';var Sequelize=require(_0xfc7c('0x0'));module['exports']={'closed':{'type':Sequelize[_0xfc7c('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xfc7c('0x2')]},'ratingType':{'type':Sequelize[_0xfc7c('0x3')](_0xfc7c('0x4'),'thumb'),'defaultValue':'star'},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0xfc7c('0x5')]},'mailTranscript':{'type':Sequelize[_0xfc7c('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xfc7c('0x7')]},'disposition':{'type':Sequelize[_0xfc7c('0x6')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0xfc7c('0x6')]},'browserVersion':{'type':Sequelize[_0xfc7c('0x6')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0xfc7c('0x6')]},'deviceModel':{'type':Sequelize[_0xfc7c('0x6')]},'deviceVendor':{'type':Sequelize[_0xfc7c('0x6')]},'deviceType':{'type':Sequelize[_0xfc7c('0x6')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xfc7c('0x5')]('long')},'read1stAt':{'type':Sequelize[_0xfc7c('0x7')]},'lastMsgAt':{'type':Sequelize[_0xfc7c('0x7')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xfc7c('0x6')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0xfc7c('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 227c9ec..630e491 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 _0x82c4=['resolve','ChatWebsiteId','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','toString','keyBy','merge','Account.key','a.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','sequelize','groupBy','ChatInteractionId','rows','show','params','include','options','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','https://api-vidaoo.xcally.com/api/v1/sessions','MotionCWB:','Error\x20in\x20Vidaoo\x20configuration','join_url','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','abandon','Interaction\x20already\x20assigned','disposition','AbandonInteraction','attachmentUpload','basename','filename','mimetype','Attachment','closed','Unauthorized','attachId','download','root','server/files/attachments/','close','server/files/chat/upload/','format','transcript-%s.txt','now','Messages','%s%d','agentAlias','System','Visitor','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','pass','SendMail','\x22%s\x22\x20<%s>','email','mailTranscript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ChatMessage','ids','omit','getMessages','hasOwnProperty','nolimit','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','includeAgent','includeAll','setTags','spread','color','emit','chatInteractionTags:save','removeTags','unix','join','server','tmp','files','attachments','transcript-%d-%s.zip','push','firstName','lastName','Owner','mkdirSync','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Chat','Account','N.A.','closedAt','osName','referer','customerIp','tail','existsSync','createReadStream','createWriteStream','read','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','jayson/promise','client','http','test','Sequelize','ValidationError','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\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','sendStatus','stack','name','Users','map','fullname','TagIds','split','forEach','Tags','index','ChatInteraction','rawAttributes','fieldName','model','keys','filters','intersection','query','fields','attributes','order','sort','where','pick','select','field','from','tools_tags','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','length','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','value','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','start','body','some','compact','isEmpty','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$lte','null','\x20=\x20?','`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?','group','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?'];(function(_0x28923c,_0x4429bd){var _0x18c26e=function(_0x1a3996){while(--_0x1a3996){_0x28923c['push'](_0x28923c['shift']());}};_0x18c26e(++_0x4429bd);}(_0x82c4,0x1ca));var _0x482c=function(_0x2faa2e,_0x198332){_0x2faa2e=_0x2faa2e-0x0;var _0x4d165d=_0x82c4[_0x2faa2e];return _0x4d165d;};'use strict';var pdf=require(_0x482c('0x0'));var emlformat=require(_0x482c('0x1'));var rimraf=require(_0x482c('0x2'));var zipdir=require(_0x482c('0x3'));var jsonpatch=require(_0x482c('0x4'));var rp=require(_0x482c('0x5'));var moment=require(_0x482c('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x482c('0x7'));var util=require('util');var path=require(_0x482c('0x8'));var sox=require('sox');var csv=require(_0x482c('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x482c('0xa'));var squel=require(_0x482c('0xb'));var crypto=require(_0x482c('0xc'));var jsforce=require(_0x482c('0xd'));var deskjs=require(_0x482c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x482c('0xf'));var Papa=require(_0x482c('0x10'));var Redis=require(_0x482c('0x11'));var authService=require(_0x482c('0x12'));var qs=require(_0x482c('0x13'));var as=require(_0x482c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x482c('0x15'))(_0x482c('0x16'));var utils=require(_0x482c('0x17'));var config=require('../../config/environment');var db=require(_0x482c('0x18'))['db'];config[_0x482c('0x19')]=_[_0x482c('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x482c('0x1b'))(new Redis(config[_0x482c('0x19')]));require('./chatInteraction.socket')['register'](socket);var jayson=require(_0x482c('0x1c'));var client=jayson[_0x482c('0x1d')][_0x482c('0x1e')]({'port':0x232b});var client9004=jayson[_0x482c('0x1d')][_0x482c('0x1e')]({'port':0x232c});function checkPasswordPattern(_0x119635,_0x3beedb,_0xf65563){if(_0xf65563){var _0x3fc79c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3fc79c[_0x482c('0x1f')](_0x3beedb)){return _0x119635;}else{throw new db[(_0x482c('0x20'))][(_0x482c('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 _0x119635;}}function respondWithRpcPromise(_0x244bb9,_0x5b6f7e,_0x3aed45,_0x258148){return new BPromise(function(_0x4af05a,_0x4bd270){var _0x357965=_0x258148||client;return _0x357965['request'](_0x244bb9,_0x3aed45)[_0x482c('0x22')](function(_0x4784a2){logger[_0x482c('0x23')](_0x482c('0x24'),_0x5b6f7e,'request\x20sent');logger[_0x482c('0x25')](_0x482c('0x26'),_0x5b6f7e,_0x482c('0x27'),JSON[_0x482c('0x28')](_0x4784a2));if(_0x4784a2[_0x482c('0x29')]){if(_0x4784a2['error']['code']===0x1f4){logger[_0x482c('0x29')](_0x482c('0x24'),_0x5b6f7e,_0x4784a2[_0x482c('0x29')]['message']);return _0x4bd270(_0x4784a2[_0x482c('0x29')]['message']);}logger[_0x482c('0x29')](_0x482c('0x24'),_0x5b6f7e,_0x4784a2['error'][_0x482c('0x2a')]);return _0x4af05a(_0x4784a2['error']['message']);}else{logger[_0x482c('0x23')](_0x482c('0x24'),_0x5b6f7e,_0x482c('0x27'));_0x4af05a(_0x4784a2[_0x482c('0x2b')][_0x482c('0x2a')]);}})[_0x482c('0x2c')](function(_0x2981d2){logger['error'](_0x482c('0x24'),_0x5b6f7e,_0x2981d2);_0x4bd270(_0x2981d2);});});}function respondWithStatusCode(_0x255417,_0x58da7c){_0x58da7c=_0x58da7c||0xcc;return function(_0xb01bc3){if(_0xb01bc3){return _0x255417['sendStatus'](_0x58da7c);}return _0x255417['status'](_0x58da7c)[_0x482c('0x2d')]();};}function respondWithResult(_0x5af04c,_0x1ac1c4){_0x1ac1c4=_0x1ac1c4||0xc8;return function(_0x2c5121){if(_0x2c5121){return _0x5af04c[_0x482c('0x2e')](_0x1ac1c4)[_0x482c('0x2f')](_0x2c5121);}};}function respondWithFilteredResult(_0x39e8aa,_0x11950f){return function(_0x36b00d){if(_0x36b00d){var _0x3e9b22=_0x36b00d[_0x482c('0x30')],_0x24b4df=_0x11950f[_0x482c('0x31')],_0x2d3800=_0x11950f[_0x482c('0x31')]+_0x11950f[_0x482c('0x32')],_0x3135a7;if(_0x2d3800>=_0x3e9b22){_0x2d3800=_0x3e9b22;_0x3135a7=0xc8;}else{_0x3135a7=0xce;}_0x39e8aa[_0x482c('0x2e')](_0x3135a7);return _0x39e8aa[_0x482c('0x33')](_0x482c('0x34'),_0x24b4df+'-'+_0x2d3800+'/'+_0x3e9b22)['json'](_0x36b00d);}return null;};}function patchUpdates(_0x4bc837){return function(_0x520b6b){try{jsonpatch[_0x482c('0x35')](_0x520b6b,_0x4bc837,!![]);}catch(_0x22e759){return BPromise[_0x482c('0x36')](_0x22e759);}return _0x520b6b[_0x482c('0x37')]();};}function saveUpdates(_0x59905b,_0x12ad47){return function(_0x4adc43){if(_0x4adc43){return _0x4adc43[_0x482c('0x38')](_0x59905b)[_0x482c('0x22')](function(_0xdb7f5a){return _0xdb7f5a;});}return null;};}function removeEntity(_0x28140b,_0x15223b){return function(_0x19cfc8){if(_0x19cfc8){return _0x19cfc8[_0x482c('0x39')]()[_0x482c('0x22')](function(){_0x28140b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x467a70,_0x4a4756){return function(_0xe62a02){if(!_0xe62a02){_0x467a70[_0x482c('0x3a')](0x194);}return _0xe62a02;};}function handleError(_0x3fda48,_0x47e912){_0x47e912=_0x47e912||0x1f4;return function(_0x29cbaa){logger[_0x482c('0x29')](_0x29cbaa[_0x482c('0x3b')]);if(_0x29cbaa[_0x482c('0x3c')]){delete _0x29cbaa['name'];}_0x3fda48[_0x482c('0x2e')](_0x47e912)['send'](_0x29cbaa);};}function getInteractionUsers(_0x1de7f4,_0x4fc994){return new BPromise(function(_0x234bd2,_0x47df5d){try{if(_0x4fc994[_0x1de7f4['id']]){_0x1de7f4[_0x482c('0x3d')]=_[_0x482c('0x3e')](_0x4fc994[_0x1de7f4['id']],function(_0x5942d2){return{'id':_0x5942d2['id'],'fullname':_0x5942d2[_0x482c('0x3f')]};});}}catch(_0x536816){_0x47df5d(_0x536816);}_0x234bd2(_0x1de7f4);});}function getInteractionTags(_0x5cd1b7,_0x1d0080){return new BPromise(function(_0x5ad861,_0x53ba0b){try{if(_0x5cd1b7['TagIds']){_0x5cd1b7['Tags']=[];_0x5cd1b7[_0x482c('0x40')][_0x482c('0x41')](',')[_0x482c('0x42')](function(_0x2fbcec){_0x5cd1b7[_0x482c('0x43')]['push'](_0x1d0080[_0x2fbcec]);});}delete _0x5cd1b7[_0x482c('0x40')];}catch(_0x43b8c8){_0x53ba0b(_0x43b8c8);}_0x5ad861(_0x5cd1b7);});}function updateChatInteraction(_0x45c8c2,_0xddffde,_0x5eb2f5){return new BPromise(function(_0x490641,_0xa41da0){return getInteractionUsers(_0x45c8c2,_0x5eb2f5)[_0x482c('0x22')](function(_0x4e4d91){return getInteractionTags(_0x4e4d91,_0xddffde);})[_0x482c('0x22')](function(_0x26e7f9){_0x490641(_0x26e7f9);})[_0x482c('0x2c')](function(_0x1a7257){_0xa41da0(_0x1a7257);});});}exports[_0x482c('0x44')]=function(_0x1bc15a,_0x15fc22){var _0x79d000={},_0x489131={},_0x1c8eba={'count':0x0,'rows':[]};var _0x147e0b=_[_0x482c('0x3e')](db[_0x482c('0x45')][_0x482c('0x46')],function(_0x3dd8a2){return{'name':_0x3dd8a2[_0x482c('0x47')],'type':_0x3dd8a2['type']['key']};});_0x489131[_0x482c('0x48')]=_[_0x482c('0x3e')](_0x147e0b,_0x482c('0x3c'));_0x489131['query']=_[_0x482c('0x49')](_0x1bc15a['query']);_0x489131[_0x482c('0x4a')]=_[_0x482c('0x4b')](_0x489131[_0x482c('0x48')],_0x489131[_0x482c('0x4c')]);_0x79d000['attributes']=_[_0x482c('0x4b')](_0x489131[_0x482c('0x48')],qs[_0x482c('0x4d')](_0x1bc15a['query'][_0x482c('0x4d')]));_0x79d000[_0x482c('0x4e')]=_0x79d000[_0x482c('0x4e')]['length']?_0x79d000['attributes']:_0x489131['model'];if(!_0x1bc15a['query']['hasOwnProperty']('nolimit')){_0x79d000[_0x482c('0x32')]=qs['limit'](_0x1bc15a[_0x482c('0x4c')][_0x482c('0x32')]);_0x79d000[_0x482c('0x31')]=qs[_0x482c('0x31')](_0x1bc15a[_0x482c('0x4c')][_0x482c('0x31')]);}_0x79d000[_0x482c('0x4f')]=qs[_0x482c('0x50')](_0x1bc15a[_0x482c('0x4c')][_0x482c('0x50')]);_0x79d000[_0x482c('0x51')]=qs[_0x482c('0x4a')](_[_0x482c('0x52')](_0x1bc15a[_0x482c('0x4c')],_0x489131[_0x482c('0x4a')]),_0x147e0b);var _0x3dbf6e=[];var _0x16264c=squel[_0x482c('0x53')]()[_0x482c('0x54')]('id')['field'](_0x482c('0x3c'))[_0x482c('0x54')]('color')[_0x482c('0x55')](_0x482c('0x56'));var _0x1f5e5b=squel[_0x482c('0x53')]()[_0x482c('0x54')]('u.id')['field'](_0x482c('0x57'))[_0x482c('0x54')](_0x482c('0x58'))[_0x482c('0x55')](_0x482c('0x59'),'ui')[_0x482c('0x5a')](_0x482c('0x5b'),'u','u.id\x20=\x20ui.UserId');var _0x508a10=squel['select']()[_0x482c('0x55')](_0x482c('0x5c'),'i')[_0x482c('0x5a')](_0x482c('0x5d'),'c',_0x482c('0x5e'))[_0x482c('0x5a')](_0x482c('0x5b'),'o',_0x482c('0x5f'))[_0x482c('0x5a')](_0x482c('0x60'),'a',_0x482c('0x61'))['left_join'](_0x482c('0x62'),'me',_0x482c('0x63'))[_0x482c('0x5a')](_0x482c('0x64'),'it',_0x482c('0x65'))[_0x482c('0x5a')](_0x482c('0x56'),'t',_0x482c('0x66'));var _0x369e91=squel[_0x482c('0x67')]();var _0x3981cf=[];var _0x1ff536=squel['expr']();var _0x5f579a;if(_0x1bc15a[_0x482c('0x4c')][_0x482c('0x68')]){_0x5f579a=as[_0x482c('0x69')](_0x1bc15a[_0x482c('0x4c')][_0x482c('0x68')]);var _0x313155=_0x5f579a['sqlOperator'];for(var _0x231353=0x0;_0x231353<_0x5f579a[_0x482c('0x6a')][_0x482c('0x6b')];_0x231353++){var _0x1f44f0=_0x5f579a[_0x482c('0x6a')][_0x231353];var _0x4fcc6a='i';var _0x2c517e=_[_0x482c('0x6c')](_0x147e0b,[_0x482c('0x3c'),_0x1f44f0[_0x482c('0x54')]]);if(!_0x2c517e){switch(_0x1f44f0[_0x482c('0x54')]){case _0x482c('0x6d'):if(_0x1f44f0['value']==0x1){_0x508a10[_0x482c('0x6e')]('`'+_0x1f44f0['field']+_0x482c('0x6f'));}else{_0x508a10[_0x482c('0x6e')]('`'+_0x1f44f0[_0x482c('0x54')]+_0x482c('0x70'));}break;case _0x482c('0x71'):if(_0x1f44f0[_0x482c('0x72')]==='$substring'){if(_0x1f44f0[_0x482c('0x73')][_0x482c('0x41')]('\x20')['length']>0x1){_0x369e91[_0x313155]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x482c('0x74')](_0x1f44f0[_0x482c('0x73')]),null);}else{var _0x481241='%'+_0x1f44f0[_0x482c('0x73')]+'%';_0x369e91[_0x313155](_0x482c('0x75'),_0x481241,_0x481241,_0x481241);}}else{_0x2c517e=_[_0x482c('0x6c')](_0x147e0b,[_0x482c('0x3c'),'ContactId']);_0x1f44f0[_0x482c('0x54')]=_0x482c('0x76');_0x243a37=as[_0x482c('0x77')](_0x4fcc6a,_0x2c517e[_0x482c('0x78')],_0x1f44f0);_0x369e91[_0x313155](_0x243a37[_0x482c('0x79')],_0x243a37[_0x482c('0x73')]['start'],_0x243a37['value'][_0x482c('0x2d')]);}break;case _0x482c('0x7a'):var _0x46c199=_0x1f44f0['value'][_0x482c('0x41')](',')[_0x482c('0x3e')](function(_0x48724c){return Number(_0x48724c);});_0x46c199[_0x482c('0x42')](function(_0x314ee9){_0x1ff536['or'](_0x482c('0x7b'),'%,'+_0x314ee9+',%');});_0x3981cf=_[_0x482c('0x7c')](_0x3981cf,_0x46c199);break;case _0x482c('0x7d'):if(_0x1f44f0[_0x482c('0x72')]==='$substring'){_0x369e91[_0x313155]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1f44f0[_0x482c('0x73')]+'%',null);}else{_0x2c517e=_[_0x482c('0x6c')](_0x147e0b,['name','UserId']);_0x1f44f0[_0x482c('0x54')]=_0x482c('0x7e');_0x243a37=as[_0x482c('0x77')](_0x4fcc6a,_0x2c517e['type'],_0x1f44f0);_0x369e91[_0x313155](_0x243a37['text'],_0x243a37['value'][_0x482c('0x7f')],_0x243a37[_0x482c('0x73')][_0x482c('0x2d')]);}break;case _0x482c('0x80'):_0x243a37=as[_0x482c('0x77')]('me',null,_0x1f44f0);_0x369e91[_0x313155](_0x243a37[_0x482c('0x79')],_0x243a37['value']['start'],_0x243a37[_0x482c('0x73')][_0x482c('0x2d')]);break;}}else{var _0x243a37=as[_0x482c('0x77')](_0x4fcc6a,_0x2c517e[_0x482c('0x78')],_0x1f44f0);_0x369e91[_0x313155](_0x243a37[_0x482c('0x79')],_0x243a37[_0x482c('0x73')][_0x482c('0x7f')],_0x243a37[_0x482c('0x73')][_0x482c('0x2d')]);}}}else{var _0x1591e9=_(_0x1bc15a[_0x482c('0x4c')])['keys']()[_0x482c('0x3e')](function(_0x22e18e){return _[_0x482c('0x81')](_0x147e0b,['name',_0x22e18e])?_0x22e18e:undefined;})[_0x482c('0x82')]()[_0x482c('0x73')]();if(!_[_0x482c('0x83')](_0x1591e9)){_0x1591e9['forEach'](function(_0x4751ca){if(_0x4751ca==='ChatWebsiteId'){_0x508a10['where'](_0x482c('0x84'),[][_0x482c('0x85')](_0x1bc15a[_0x482c('0x4c')][_0x4751ca]));}else if(_0x4751ca===_0x482c('0x86')){var _0xcc3fe7=JSON[_0x482c('0x87')](_0x1bc15a[_0x482c('0x4c')][_0x4751ca])['$gte'];var _0x1d497b=JSON[_0x482c('0x87')](_0x1bc15a['query'][_0x4751ca])[_0x482c('0x88')];_0x508a10['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xcc3fe7,_0x1d497b);}else{if(_0x1bc15a['query'][_0x4751ca]===_0x482c('0x89')){_0x508a10['where']('i.'+_0x4751ca+'\x20IS\x20NULL');}else{_0x508a10[_0x482c('0x51')]('i.'+_0x4751ca+_0x482c('0x8a'),_0x1bc15a['query'][_0x4751ca]);}}});}if(_0x1bc15a[_0x482c('0x4c')]['read']){if(_0x1bc15a['query']['read']==0x1){_0x508a10[_0x482c('0x6e')](_0x482c('0x8b'));}else{_0x508a10['having']('`unreadMessages`\x20>\x200');}}if(_0x1bc15a['query'][_0x482c('0x8c')]){_0x3981cf=_[_0x482c('0x8d')](_0x1bc15a[_0x482c('0x4c')]['tag'])?_0x1bc15a['query'][_0x482c('0x8c')]:new Array(_0x1bc15a['query'][_0x482c('0x8c')]);_0x3981cf[_0x482c('0x42')](function(_0x4cb228){_0x1ff536['or'](_0x482c('0x7b'),'%,'+_0x4cb228+',%');});}if(_0x1bc15a['query']['filter']){var _0x2c0056=_0x1bc15a['query'][_0x482c('0x8e')]['replace']('\x5c','\x5c\x5c')[_0x482c('0x8f')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0x482c('0x90')](_0x2c0056)){_0x369e91['or'](_0x482c('0x91'),_0x2c0056+'%');}else{_0x369e91['or'](_0x482c('0x92'),qs['getFullTextValue'](_0x2c0056))['or'](_0x482c('0x93'),_0x2c0056+'%');}}}_0x508a10[_0x482c('0x51')](_0x369e91);_0x508a10[_0x482c('0x94')]('i.id');var _0x223e03={'type':db[_0x482c('0x20')][_0x482c('0x95')][_0x482c('0x96')],'raw':!![]};var _0x1bfb6b=_0x508a10[_0x482c('0x97')]();_0x1bfb6b[_0x482c('0x54')]('i.id');_0x1bfb6b[_0x482c('0x54')](_0x482c('0x98'),_0x482c('0x6d'));if(_0x79d000['order']){_0x79d000['order']['forEach'](function(_0x2b6e16){_0x508a10['order']('i.'+_0x2b6e16[0x0],_0x2b6e16[0x1]==='DESC'?![]:!![]);});}if(!_[_0x482c('0x83')](_0x3981cf)){_0x508a10['having'](_0x1ff536);_0x1bfb6b[_0x482c('0x51')](_0x482c('0x99'),_0x3981cf);}BPromise[_0x482c('0x9a')]()[_0x482c('0x22')](function(){if(!_0x5f579a){if(_0x1bc15a['query'][_0x482c('0x9b')]||_0x1bc15a['query'][_0x482c('0x9c')])return;_0x1bfb6b[_0x482c('0x51')](_0x482c('0x9d'));_0x508a10['where']('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}return _0x1bc15a[_0x482c('0x9e')][_0x482c('0x9f')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4335d7){if(_['isEmpty'](_0x4335d7)){_0x1bfb6b[_0x482c('0x51')](_0x482c('0xa0'));_0x508a10[_0x482c('0x51')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x1bfb6b[_0x482c('0x51')](_0x482c('0x84'),_[_0x482c('0x3e')](_0x4335d7,'id'));_0x508a10['where'](_0x482c('0x84'),_[_0x482c('0x3e')](_0x4335d7,'id'));}});})[_0x482c('0x22')](function(){db['sequelize']['query'](_0x1bfb6b[_0x482c('0xa1')](),_0x223e03)[_0x482c('0x22')](function(_0x3f0561){_0x1c8eba['count']=_0x3f0561[_0x482c('0x6b')];if(_0x1c8eba[_0x482c('0x30')]===0x0)return[];return db['sequelize'][_0x482c('0x4c')](_0x16264c['toString'](),_0x223e03)[_0x482c('0x22')](function(_0x363735){_0x3dbf6e=_[_0x482c('0xa2')](_0x363735,'id');_0x223e03=_[_0x482c('0xa3')](_0x223e03,{'model':db[_0x482c('0x45')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1bc15a[_0x482c('0x4c')]['fields']){_0x79d000['attributes'][_0x482c('0x42')](function(_0x233926){_0x508a10[_0x482c('0x54')]('i.'+_0x233926);});}else{_0x508a10[_0x482c('0x54')](_0x482c('0x98'),_0x482c('0x6d'));_0x508a10[_0x482c('0x54')]('a.key',_0x482c('0xa4'));_0x508a10[_0x482c('0x54')](_0x482c('0xa5'),'Account.mandatoryDisposition');_0x508a10[_0x482c('0x54')](_0x482c('0xa6'));_0x508a10[_0x482c('0x54')](_0x482c('0xa7'),_0x482c('0xa8'));_0x508a10[_0x482c('0x54')](_0x482c('0xa9'),'Contact.lastName');_0x508a10[_0x482c('0x54')](_0x482c('0xaa'),_0x482c('0xab'));_0x508a10['field'](_0x482c('0xac'),'Contact.phone');_0x508a10[_0x482c('0x54')](_0x482c('0xad'),_0x482c('0xae'));_0x508a10[_0x482c('0x54')]('c.fax',_0x482c('0xaf'));_0x508a10[_0x482c('0x54')](_0x482c('0xb0'),_0x482c('0xb1'));_0x508a10['field'](_0x482c('0xb2'),_0x482c('0xb3'));_0x508a10[_0x482c('0x54')](_0x482c('0xb4'),_0x482c('0x40'));}if(_0x79d000['limit'])_0x508a10[_0x482c('0x32')](_0x79d000[_0x482c('0x32')]);if(_0x79d000[_0x482c('0x31')])_0x508a10[_0x482c('0x31')](_0x79d000[_0x482c('0x31')]);return db['sequelize'][_0x482c('0x4c')](_0x508a10[_0x482c('0xa1')](),_0x223e03);})[_0x482c('0x22')](function(_0x59d948){_0x1f5e5b[_0x482c('0x51')](_0x482c('0xb5'),_[_0x482c('0x3e')](_0x59d948,'id'));return db[_0x482c('0xb6')]['query'](_0x1f5e5b[_0x482c('0xa1')](),_0x223e03)[_0x482c('0x22')](function(_0x80d460){var _0x5cbf1a=_[_0x482c('0xb7')](_0x80d460,_0x482c('0xb8'));var _0x27101a=[];_0x59d948[_0x482c('0x42')](function(_0x561d86){_0x27101a['push'](updateChatInteraction(_0x561d86,_0x3dbf6e,_0x5cbf1a));});return BPromise['all'](_0x27101a);});});})[_0x482c('0x22')](function(_0x21fe3a){_0x1c8eba[_0x482c('0xb9')]=_0x21fe3a;return _0x1c8eba;})[_0x482c('0x22')](respondWithFilteredResult(_0x15fc22,_0x79d000));})[_0x482c('0x2c')](handleError(_0x15fc22,null));};exports[_0x482c('0xba')]=function(_0x13eb8e,_0x47d5a6){var _0x5889bc={'raw':![],'where':{'id':_0x13eb8e[_0x482c('0xbb')]['id']}},_0x544c63={};_0x544c63[_0x482c('0x48')]=_[_0x482c('0x49')](db[_0x482c('0x45')][_0x482c('0x46')]);_0x544c63[_0x482c('0x4c')]=_[_0x482c('0x49')](_0x13eb8e[_0x482c('0x4c')]);_0x544c63[_0x482c('0x4a')]=_['intersection'](_0x544c63[_0x482c('0x48')],_0x544c63[_0x482c('0x4c')]);_0x5889bc[_0x482c('0x4e')]=_[_0x482c('0x4b')](_0x544c63[_0x482c('0x48')],qs[_0x482c('0x4d')](_0x13eb8e[_0x482c('0x4c')]['fields']));_0x5889bc['attributes']=_0x5889bc['attributes'][_0x482c('0x6b')]?_0x5889bc['attributes']:_0x544c63[_0x482c('0x48')];if(_0x13eb8e[_0x482c('0x4c')]['includeAll']){_0x5889bc[_0x482c('0xbc')]=[{'all':!![]}];}_0x5889bc=_[_0x482c('0xa3')]({},_0x5889bc,_0x13eb8e[_0x482c('0xbd')]);return db[_0x482c('0x45')]['find'](_0x5889bc)[_0x482c('0x22')](handleEntityNotFound(_0x47d5a6,null))[_0x482c('0x22')](respondWithResult(_0x47d5a6,null))[_0x482c('0x2c')](handleError(_0x47d5a6,null));};exports['create']=function(_0x80e00d,_0x1d1d4e){return db[_0x482c('0x45')][_0x482c('0xbe')](_0x80e00d[_0x482c('0x80')],{})[_0x482c('0x22')](respondWithResult(_0x1d1d4e,0xc9))[_0x482c('0x2c')](handleError(_0x1d1d4e,null));};exports[_0x482c('0x38')]=function(_0x4e23a3,_0x4f4a0f){if(_0x4e23a3['body']['id']){delete _0x4e23a3['body']['id'];}return db[_0x482c('0x45')]['find']({'where':{'id':_0x4e23a3[_0x482c('0xbb')]['id']}})[_0x482c('0x22')](handleEntityNotFound(_0x4f4a0f,null))[_0x482c('0x22')](saveUpdates(_0x4e23a3[_0x482c('0x80')],null))[_0x482c('0x22')](respondWithResult(_0x4f4a0f,null))[_0x482c('0x2c')](handleError(_0x4f4a0f,null));};exports[_0x482c('0x39')]=function(_0x12ac9f,_0x315ad4){return db[_0x482c('0x45')][_0x482c('0x6c')]({'where':{'id':_0x12ac9f[_0x482c('0xbb')]['id']}})[_0x482c('0x22')](handleEntityNotFound(_0x315ad4,null))[_0x482c('0x22')](removeEntity(_0x315ad4,null))[_0x482c('0x2c')](handleError(_0x315ad4,null));};exports[_0x482c('0xbf')]=function(_0x23ac93,_0x511375){return db['ChatInteraction'][_0x482c('0xbf')]()[_0x482c('0x22')](respondWithResult(_0x511375,null))[_0x482c('0x2c')](handleError(_0x511375,null));};exports[_0x482c('0xc0')]=function(_0x1efbdc,_0x117bea){var _0x3f7d7a=_0x1efbdc[_0x482c('0xbb')]['id'];var _0x5128a6;var _0x5dffbc;var _0x3d832f;return db['ChatInteraction'][_0x482c('0xc1')]({'where':{'id':_0x3f7d7a}})[_0x482c('0x22')](function(_0x1c4e1c){_0x5128a6=_0x1c4e1c;return db[_0x482c('0xc2')][_0x482c('0xc1')]({'where':{'id':_0x1c4e1c[_0x482c('0x9b')]},'attributes':['id',_0x482c('0xc3'),'vidaooEscalation'],'raw':!![]});})[_0x482c('0x22')](function(_0x37f17e){if(_0x37f17e&&_0x37f17e[_0x482c('0xc3')]&&_0x37f17e[_0x482c('0xc4')]){_0x5dffbc=_0x37f17e;var _0x215b66={'rejectUnauthorized':![],'method':'POST','uri':_0x482c('0xc5'),'headers':{'X-APIKEY':_0x37f17e[_0x482c('0xc3')]},'body':{'name':_0x482c('0xc6')+_0x3f7d7a},'redirect':'follow','json':!![]};return rp(_0x215b66);}else{throw new db[(_0x482c('0x20'))][(_0x482c('0x21'))](_0x482c('0xc7'));}})[_0x482c('0x22')](function(_0x5c29c5){_0x3d832f=_0x5c29c5;if(_0x3d832f['id']){var _0x5335f9={'body':_0x3d832f[_0x482c('0xc8')],'ChatWebsiteId':_0x5dffbc['id'],'ChatInteractionId':_0x5128a6['id'],'direction':_0x482c('0xc9'),'UserId':_0x1efbdc['user']['id']};return db['ChatMessage']['create'](_0x5335f9,{});}else{throw new db['Sequelize'][(_0x482c('0x21'))](_0x482c('0xca'));}})[_0x482c('0x22')](function(){return _0x5128a6[_0x482c('0xcb')]({'vidaooSessionId':_0x3d832f['id']});})[_0x482c('0x22')](respondWithResult(_0x117bea,null))[_0x482c('0x2c')](handleError(_0x117bea,null));};exports['customUpdate']=function(_0x3f40e8,_0x4343b1){if(_0x3f40e8['body']['id']){delete _0x3f40e8[_0x482c('0x80')]['id'];}return db[_0x482c('0x45')][_0x482c('0x6c')]({'where':{'id':_0x3f40e8[_0x482c('0xbb')]['id']}})['then'](handleEntityNotFound(_0x4343b1,null))[_0x482c('0x22')](saveUpdates(_0x3f40e8['body'],null))[_0x482c('0x22')](respondWithResult(_0x4343b1,null))[_0x482c('0x2c')](handleError(_0x4343b1,null));};exports[_0x482c('0xcc')]=function(_0x54f2ea,_0x3bd0dd,_0x2ef4e3){if(_0x54f2ea['body']['id']){delete _0x54f2ea[_0x482c('0x80')]['id'];}return db[_0x482c('0x45')]['find']({'where':{'id':_0x54f2ea[_0x482c('0xbb')]['id']}})[_0x482c('0x22')](function(_0x36d6aa){if(!_0x36d6aa){logger[_0x482c('0x29')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x482c('0xcc'),0x194,'entity\x20not\x20found');_0x3bd0dd[_0x482c('0x3a')](0x194);}else{if(_0x36d6aa[_0x482c('0x7e')]){throw new db[(_0x482c('0x20'))][(_0x482c('0x21'))](_0x482c('0xcd'));}}return _0x36d6aa;})['then'](function(_0x50bff4){if(_0x50bff4){return _0x50bff4[_0x482c('0x38')]({'closed':_0x54f2ea[_0x482c('0x80')]['closed'],'disposition':_0x54f2ea[_0x482c('0x80')][_0x482c('0xce')]})['then'](function(_0x5e67f8){return _0x5e67f8;});}})[_0x482c('0x22')](function(_0x558d17){return respondWithRpcPromise(_0x482c('0xcf'),_0x482c('0xcc'),_0x54f2ea[_0x482c('0x80')],client9004);})[_0x482c('0x22')](respondWithResult(_0x3bd0dd,null))[_0x482c('0x2c')](handleError(_0x3bd0dd,null));};exports[_0x482c('0xd0')]=function(_0x454822,_0x2aa5ac,_0x318983){_0x454822['body'][_0x482c('0x3c')]=_0x454822['file']['originalname'];_0x454822[_0x482c('0x80')][_0x482c('0xd1')]=_0x454822['file'][_0x482c('0xd2')];_0x454822[_0x482c('0x80')][_0x482c('0x78')]=_0x454822['file'][_0x482c('0xd3')];return db[_0x482c('0xd4')]['create'](_0x454822['body'])[_0x482c('0x22')](respondWithResult(_0x2aa5ac,0xc9))[_0x482c('0x2c')](handleError(_0x2aa5ac,null));};exports['attachmentDownload']=function(_0x48caaa,_0x458189,_0x5749ae){return db['ChatInteraction'][_0x482c('0xc1')]({'where':{'id':_0x48caaa[_0x482c('0xbb')]['id']},'raw':!![]})[_0x482c('0x22')](handleEntityNotFound(_0x458189,null))[_0x482c('0x22')](function(_0x5d607c){if(_0x5d607c){if(_0x5d607c[_0x482c('0xd5')]){return _0x458189['status'](0x193)[_0x482c('0x2f')]({'status':0x193,'message':_0x482c('0xd6')});}return db[_0x482c('0xd4')][_0x482c('0xc1')]({'where':{'id':_0x48caaa['query'][_0x482c('0xd7')]},'raw':!![]})['then'](handleEntityNotFound(_0x458189,null));}})[_0x482c('0x22')](function(_0x19b08a){if(_0x19b08a){return _0x458189[_0x482c('0xd8')](path['join'](config[_0x482c('0xd9')],_0x482c('0xda'),_0x19b08a[_0x482c('0xd1')]));}})[_0x482c('0x2c')](handleError(_0x458189,null));};exports[_0x482c('0xdb')]=function(_0x4fdad6,_0x1296e6){var _0x43b80b=null;var _0x230119=null;var _0x479728=null;var _0x478c74=null;if(_0x4fdad6['body']['id']){delete _0x4fdad6[_0x482c('0x80')]['id'];}if(_0x4fdad6[_0x482c('0x80')]['mailTranscript']){_0x478c74=path['join'](config[_0x482c('0xd9')],_0x482c('0xdc'),util[_0x482c('0xdd')](_0x482c('0xde'),Date[_0x482c('0xdf')]()));_0x4fdad6[_0x482c('0x80')]['pathTranscript']=_0x478c74;}return db['ChatInteraction'][_0x482c('0x6c')]({'where':{'id':_0x4fdad6[_0x482c('0xbb')]['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db['User'],'as':'User'}]}]})[_0x482c('0x22')](handleEntityNotFound(_0x1296e6,null))['then'](saveUpdates(_0x4fdad6[_0x482c('0x80')],null))[_0x482c('0x22')](function(_0x1934e5){if(_0x1934e5){_0x43b80b=_0x1934e5;return db[_0x482c('0xc2')][_0x482c('0x6c')]({'where':{'id':_0x43b80b['ChatWebsiteId']}});}})['then'](function(_0x4fdc4d){if(_0x4fdc4d){_0x479728=_0x4fdc4d;return db['CmContact']['find']({'where':{'id':_0x43b80b['ContactId']}});}})[_0x482c('0x22')](function(_0x5eb8c9){if(_0x5eb8c9){_0x230119=_0x5eb8c9;if(_0x478c74){var _0x317558=null;for(var _0xebd616=0x1;_0xebd616<_0x43b80b[_0x482c('0xe0')][_0x482c('0x6b')];++_0xebd616){_0x317558=_0x43b80b['Messages'][_0xebd616];var _0xd67fe1=_0x317558[_0x482c('0x7e')]?util[_0x482c('0xdd')](_0x482c('0xe1'),_0x479728[_0x482c('0xe2')],_0x317558['UserId']):_0x482c('0xe3');var _0x5bdd27=_0x4fdad6['body']['customer']||util[_0x482c('0xdd')](_0x482c('0xe1'),_0x482c('0xe4'),_0x317558[_0x482c('0x76')]);switch(_0x479728['agentIdentifier']){case'website_alias':_0xd67fe1=_0x317558['UserId']?util[_0x482c('0xdd')](_0x482c('0xe1'),_0x479728[_0x482c('0xe2')],_0x317558[_0x482c('0x7e')]):_0x482c('0xe3');break;case _0x482c('0xe5'):_0xd67fe1=_0x317558[_0x482c('0x7e')]?_0x317558['User'][_0x482c('0xe6')]||_0x317558['User'][_0x482c('0x3f')]:_0x482c('0xe3');break;case _0x482c('0xe7'):_0xd67fe1=_0x317558[_0x482c('0x7e')]?_0x317558[_0x482c('0x7d')][_0x482c('0x3f')]:_0x482c('0xe3');break;default:_0xd67fe1=_0x317558[_0x482c('0x7e')]?util['format']('%s%d',_0x479728[_0x482c('0xe2')],_0x317558[_0x482c('0x7e')]):_0x482c('0xe3');}var _0xcec4c4=util[_0x482c('0xdd')](_0x482c('0xe8'),moment(_0x317558[_0x482c('0x86')])[_0x482c('0xdd')](_0x482c('0xe9')),_0x317558[_0x482c('0xea')]==='in'?_0x5bdd27:_0xd67fe1,_0x317558['body']);if(!_0x317558[_0x482c('0xeb')]){fs[_0x482c('0xec')](_0x478c74,_0xcec4c4);}}return db[_0x482c('0xed')][_0x482c('0xc1')]({'where':{'service':!![]},'include':[{'model':db[_0x482c('0xee')],'as':_0x482c('0xef'),'raw':!![]}]});}}})[_0x482c('0x22')](function(_0x236ec2){if(_0x236ec2&&_0x236ec2[_0x482c('0xef')]&&_0x4fdad6['body']){var _0x41f9fe={'tls':{'rejectUnauthorized':![]}};if(_0x236ec2[_0x482c('0xef')][_0x482c('0xf0')]){_0x41f9fe[_0x482c('0xf0')]=_0x236ec2[_0x482c('0xef')]['service'];}else{_0x41f9fe[_0x482c('0xf1')]=_0x236ec2[_0x482c('0xef')][_0x482c('0xf1')];_0x41f9fe[_0x482c('0xf2')]=_0x236ec2[_0x482c('0xef')][_0x482c('0xf2')];_0x41f9fe[_0x482c('0xf3')]=_0x236ec2['Smtp'][_0x482c('0xf3')];}if(_0x236ec2[_0x482c('0xef')][_0x482c('0xf4')]){_0x41f9fe['auth']={'user':_0x236ec2[_0x482c('0xef')][_0x482c('0x9e')],'pass':_0x236ec2[_0x482c('0xef')][_0x482c('0xf5')]};}return respondWithRpcPromise(_0x482c('0xf6'),'sendMail',{'account':_0x41f9fe,'message':{'from':util[_0x482c('0xdd')](_0x482c('0xf7'),_0x236ec2[_0x482c('0x3c')],_0x236ec2[_0x482c('0xf8')]||_0x236ec2[_0x482c('0xef')][_0x482c('0x9e')]),'to':_0x4fdad6[_0x482c('0x80')][_0x482c('0xf9')],'subject':'Mail\x20Transcript','text':util[_0x482c('0xdd')](_0x482c('0xfa'),_0x4fdad6[_0x482c('0x80')][_0x482c('0xf9')]),'attachments':[{'path':_0x478c74}]}})[_0x482c('0x22')](function(){return _0x43b80b;})[_0x482c('0x2c')](function(_0x16be60){console['error'](_0x16be60);});}else{return _0x43b80b;}})[_0x482c('0x22')](respondWithStatusCode(_0x1296e6,0xc8))[_0x482c('0x2c')](handleError(_0x1296e6,null));};exports[_0x482c('0xfb')]=function(_0x25c6ca,_0x1d5b30,_0x197c2b){return db[_0x482c('0xfc')]['find']({'where':{'id':_0x25c6ca[_0x482c('0xbb')]['id']}})[_0x482c('0x22')](handleEntityNotFound(_0x1d5b30,null))[_0x482c('0x22')](function(_0x2229bc){if(_0x2229bc){return _0x2229bc[_0x482c('0xfb')](_0x25c6ca[_0x482c('0x80')][_0x482c('0xfd')],_[_0x482c('0xfe')](_0x25c6ca[_0x482c('0x80')],[_0x482c('0xfd'),'id'])||{});}})[_0x482c('0x22')](respondWithResult(_0x1d5b30,null))[_0x482c('0x2c')](handleError(_0x1d5b30,null));};exports[_0x482c('0xff')]=function(_0x4b6ad0,_0x211956,_0x33b088){var _0x2cb7ee={'raw':![],'where':{}};var _0x48cf63={};var _0x5cfd92={'count':0x0,'rows':[]};return db[_0x482c('0x45')][_0x482c('0xc1')]({'where':{'id':_0x4b6ad0[_0x482c('0xbb')]['id']}})[_0x482c('0x22')](handleEntityNotFound(_0x211956,null))['then'](function(_0x4f77fa){if(_0x4f77fa){_0x48cf63[_0x482c('0x48')]=_['keys'](db[_0x482c('0xfc')][_0x482c('0x46')]);_0x48cf63[_0x482c('0x4c')]=_[_0x482c('0x49')](_0x4b6ad0[_0x482c('0x4c')]);_0x48cf63[_0x482c('0x4a')]=_['intersection'](_0x48cf63['model'],_0x48cf63[_0x482c('0x4c')]);_0x2cb7ee[_0x482c('0x4e')]=_['intersection'](_0x48cf63[_0x482c('0x48')],qs[_0x482c('0x4d')](_0x4b6ad0[_0x482c('0x4c')][_0x482c('0x4d')]));_0x2cb7ee['attributes']=_0x2cb7ee[_0x482c('0x4e')][_0x482c('0x6b')]?_0x2cb7ee[_0x482c('0x4e')]:_0x48cf63[_0x482c('0x48')];if(!_0x4b6ad0['query'][_0x482c('0x100')](_0x482c('0x101'))){_0x2cb7ee[_0x482c('0x32')]=qs[_0x482c('0x32')](_0x4b6ad0[_0x482c('0x4c')][_0x482c('0x32')]);_0x2cb7ee[_0x482c('0x31')]=qs[_0x482c('0x31')](_0x4b6ad0['query'][_0x482c('0x31')]);}_0x2cb7ee[_0x482c('0x4f')]=qs['sort'](_0x4b6ad0[_0x482c('0x4c')][_0x482c('0x50')]);_0x2cb7ee[_0x482c('0x51')]=qs[_0x482c('0x4a')](_['pick'](_0x4b6ad0[_0x482c('0x4c')],_0x48cf63[_0x482c('0x4a')]));_0x2cb7ee[_0x482c('0x51')][_0x482c('0xb8')]=_0x4f77fa['id'];if(_0x4b6ad0[_0x482c('0x4c')][_0x482c('0x8e')]){_0x2cb7ee[_0x482c('0x51')]=_[_0x482c('0xa3')](_0x2cb7ee[_0x482c('0x51')],{'$or':_['map'](_0x2cb7ee[_0x482c('0x4e')],function(_0x1da02b){var _0x24071b={};_0x24071b[_0x1da02b]={'$like':'%'+_0x4b6ad0['query'][_0x482c('0x8e')]+'%'};return _0x24071b;})});}if(_0x4b6ad0[_0x482c('0x4c')]['$gte']){var _0x144688=_0x4b6ad0['query']['$gte'][_0x482c('0x41')](',');var _0x2bfe53={};_0x2bfe53[_0x144688[0x0]]={'$gte':moment(_0x144688[0x1])['format'](_0x482c('0x102'))};_0x2cb7ee[_0x482c('0x51')]=_['merge'](_0x2cb7ee[_0x482c('0x51')],_0x2bfe53);}_0x2cb7ee=_[_0x482c('0xa3')]({},_0x2cb7ee,_0x4b6ad0[_0x482c('0xbd')]);return db['ChatMessage'][_0x482c('0x30')]({'where':_0x2cb7ee['where']})[_0x482c('0x22')](function(_0x5606d8){_0x5cfd92[_0x482c('0x30')]=_0x5606d8;if(_0x4b6ad0[_0x482c('0x4c')]['includeAll']){_0x2cb7ee[_0x482c('0xbc')]=[{'all':!![]}];}return db['ChatMessage'][_0x482c('0x103')](_0x2cb7ee);})[_0x482c('0x22')](function(_0x3ef041){_0x5cfd92['rows']=_0x3ef041;return _0x5cfd92;});}})[_0x482c('0x22')](respondWithFilteredResult(_0x211956,_0x2cb7ee))[_0x482c('0x2c')](handleError(_0x211956,null));};exports[_0x482c('0x104')]=function(_0x4762d8,_0x37f170,_0x34cf23){var _0x479a28={'where':{}},_0x3bb8b7={},_0x2527a6={'count':0x0,'rows':[]};return db[_0x482c('0x45')][_0x482c('0xc1')]({'where':{'id':_0x4762d8[_0x482c('0xbb')]['id']}})[_0x482c('0x22')](handleEntityNotFound(_0x37f170,null))[_0x482c('0x22')](function(_0xc69633){if(_0xc69633){_0x3bb8b7['model']=_[_0x482c('0x49')](db['ChatMessage'][_0x482c('0x46')]);_0x3bb8b7['query']=_[_0x482c('0x49')](_0x4762d8[_0x482c('0x4c')]);_0x3bb8b7[_0x482c('0x4a')]=_[_0x482c('0x4b')](_0x3bb8b7['model'],_0x3bb8b7['query']);_0x479a28['attributes']=_['intersection'](_0x3bb8b7[_0x482c('0x48')],qs[_0x482c('0x4d')](_0x4762d8[_0x482c('0x4c')][_0x482c('0x4d')]));_0x479a28[_0x482c('0x4e')]=_0x479a28['attributes'][_0x482c('0x6b')]?_0x479a28[_0x482c('0x4e')]:_0x3bb8b7[_0x482c('0x48')];if(!_0x4762d8[_0x482c('0x4c')][_0x482c('0x100')]('nolimit')){_0x479a28[_0x482c('0x32')]=qs[_0x482c('0x32')](_0x4762d8[_0x482c('0x4c')][_0x482c('0x32')]);_0x479a28[_0x482c('0x31')]=qs[_0x482c('0x31')](_0x4762d8[_0x482c('0x4c')][_0x482c('0x31')]);}_0x479a28[_0x482c('0x4f')]=qs[_0x482c('0x50')](_0x4762d8[_0x482c('0x4c')]['sort']);_0x479a28[_0x482c('0x51')]=qs[_0x482c('0x4a')](_[_0x482c('0x52')](_0x4762d8[_0x482c('0x4c')],_0x3bb8b7[_0x482c('0x4a')]));_0x479a28[_0x482c('0x51')][_0x482c('0xb8')]=_0xc69633['id'];if(_0x4762d8['query']['filter']){_0x479a28[_0x482c('0x51')]=_['merge'](_0x479a28[_0x482c('0x51')],{'$or':_[_0x482c('0x3e')](_0x479a28['attributes'],function(_0x408818){var _0x6fe46d={};_0x6fe46d[_0x408818]={'$like':'%'+_0x4762d8['query'][_0x482c('0x8e')]+'%'};return _0x6fe46d;})});}_0x479a28[_0x482c('0x51')][_0x482c('0xeb')]=![];if(_0x4762d8[_0x482c('0x4c')]['id']){_0x479a28[_0x482c('0x51')]['id']={'$gt':_0x4762d8[_0x482c('0x4c')]['id']};}_0x479a28=_[_0x482c('0xa3')]({},_0x479a28,_0x4762d8['options']);return db[_0x482c('0xfc')]['count']({'where':_0x479a28['where']})[_0x482c('0x22')](function(_0x1cc958){_0x2527a6[_0x482c('0x30')]=_0x1cc958;_0x479a28[_0x482c('0xbc')]=[];if(_0x4762d8['query'][_0x482c('0x105')]){_0x479a28['include']['push']({'model':db[_0x482c('0x7d')],'as':_0x482c('0x7d'),'attributes':['id',_0x482c('0x3f'),_0x482c('0xe6')]});}if(_0x4762d8[_0x482c('0x4c')][_0x482c('0x106')]){_0x479a28[_0x482c('0xbc')]=[{'all':!![]}];}return db[_0x482c('0xfc')][_0x482c('0x103')](_0x479a28);})['then'](function(_0x28e7c3){_0x2527a6[_0x482c('0xb9')]=_0x28e7c3;return _0x2527a6;});}})['then'](respondWithFilteredResult(_0x37f170,_0x479a28))[_0x482c('0x2c')](handleError(_0x37f170,null));};exports['addTags']=function(_0x36e33f,_0x430e34,_0x5196ed){return db[_0x482c('0x45')][_0x482c('0x6c')]({'where':{'id':_0x36e33f[_0x482c('0xbb')]['id']}})['then'](handleEntityNotFound(_0x430e34,null))['then'](function(_0x404f87){if(_0x404f87){return _0x404f87[_0x482c('0x107')](_0x36e33f[_0x482c('0x80')][_0x482c('0xfd')],_['omit'](_0x36e33f[_0x482c('0x80')],['ids','id'])||{})[_0x482c('0x108')](function(){return db[_0x482c('0x7a')][_0x482c('0x103')]({'attributes':['id',_0x482c('0x3c'),_0x482c('0x109')],'where':{'id':_0x36e33f[_0x482c('0x80')][_0x482c('0xfd')]}});})[_0x482c('0x22')](function(_0x5260a1){socket[_0x482c('0x10a')](_0x482c('0x10b'),{'id':Number(_0x36e33f[_0x482c('0xbb')]['id']),'tags':_0x5260a1||[]});return{'id':Number(_0x36e33f[_0x482c('0xbb')]['id']),'tags':_0x5260a1||[]};});}})['then'](respondWithResult(_0x430e34,null))[_0x482c('0x2c')](handleError(_0x430e34,null));};exports[_0x482c('0x10c')]=function(_0x27cb33,_0x585977,_0x41c326){return db[_0x482c('0x45')][_0x482c('0x6c')]({'where':{'id':_0x27cb33[_0x482c('0xbb')]['id']}})['then'](handleEntityNotFound(_0x585977,null))[_0x482c('0x22')](function(_0x3c99f8){if(_0x3c99f8){return _0x3c99f8[_0x482c('0x10c')](_0x27cb33[_0x482c('0x4c')]['ids']);}})[_0x482c('0x22')](respondWithStatusCode(_0x585977,null))[_0x482c('0x2c')](handleError(_0x585977,null));};exports['download']=function(_0x17d784,_0x2ab8b4){var _0x3e2629=moment()[_0x482c('0x10d')]()[_0x482c('0xa1')]();var _0x5b650d=path[_0x482c('0x10e')](config[_0x482c('0xd9')],_0x482c('0x10f'),'files',_0x482c('0x110'));var _0x566966=path[_0x482c('0x10e')](config[_0x482c('0xd9')],_0x482c('0x10f'),_0x482c('0x111'),_0x482c('0x112'));var _0x35ae33=path['join'](_0x5b650d,_0x3e2629);var _0xd733b1=util[_0x482c('0xdd')](_0x482c('0x113'),_0x17d784['params']['id'],_0x3e2629);var _0xfd6993=path['join'](_0x5b650d,_0xd733b1);var _0x14d2b1=[];_0x14d2b1['push']({'model':db[_0x482c('0x7d')],'as':_0x482c('0x7d'),'attributes':['id',_0x482c('0x3f')],'raw':!![]});_0x14d2b1[_0x482c('0x114')]({'model':db['CmContact'],'as':_0x482c('0x71'),'attributes':['id',_0x482c('0x115'),_0x482c('0x116')],'raw':!![]});if(_0x17d784['query'][_0x482c('0x112')]){_0x14d2b1[_0x482c('0x114')]({'model':db[_0x482c('0xd4')],'as':_0x482c('0xd4'),'raw':!![]});}var _0x744513=[{'model':db[_0x482c('0xfc')],'as':'Messages','attributes':['id',_0x482c('0x80'),_0x482c('0x86'),_0x482c('0xea'),_0x482c('0xeb'),'read'],'include':_0x14d2b1}];_0x744513['push']({'model':db['ChatWebsite'],'as':'Account','attributes':['id',_0x482c('0x3c')]});_0x744513['push']({'model':db[_0x482c('0x7d')],'as':_0x482c('0x117'),'attributes':['id',_0x482c('0x3f')]});return db[_0x482c('0x45')]['find']({'where':{'id':_0x17d784['params']['id']},'include':_0x744513})['then'](handleEntityNotFound(_0x2ab8b4,null))['then'](function(_0x32ab13){if(_0x32ab13){var _0x316d63=_0x32ab13['get']({'plain':!![]});fs[_0x482c('0x118')](_0x35ae33);var _0x2e69fb={'format':'A4','border':'10px','header':{'height':_0x482c('0x119'),'contents':{'first':_0x482c('0x11a')}},'footer':{'height':_0x482c('0x11b'),'contents':{'default':util['format'](_0x482c('0x11c'),util['format']('%s\x20#%d',_0x482c('0x11d'),_0x316d63['id']),moment()[_0x482c('0xdd')]('YYYY-MM-DD')[_0x482c('0xa1')]())}}};var _0x3fd051={'channel':_0x482c('0x11d'),'account':_0x316d63[_0x482c('0x11e')]['name'],'agent':_0x316d63[_0x482c('0x117')]?_0x316d63[_0x482c('0x117')][_0x482c('0x3f')]:_0x482c('0x11f'),'createdAt':moment(_0x316d63[_0x482c('0x86')])[_0x482c('0xdd')](_0x482c('0x102'))[_0x482c('0xa1')](),'closedAt':_0x316d63[_0x482c('0xd5')]?moment(_0x316d63[_0x482c('0x120')])['format'](_0x482c('0x102'))[_0x482c('0xa1')]():'','disposition':_0x316d63[_0x482c('0xce')],'chatInfo':{'browser':_0x316d63['browserName'],'os':_0x316d63[_0x482c('0x121')],'referer':_0x316d63[_0x482c('0x122')],'customerIp':_0x316d63[_0x482c('0x123')],'customerPort':_0x316d63['customerPort']?_0x316d63['customerPort']:_0x482c('0x11f')},'messages':_(_0x316d63[_0x482c('0xe0')])[_0x482c('0x124')]()[_0x482c('0x8e')]({'secret':![]})[_0x482c('0x3e')](function(_0x3faf40){if(_0x3faf40['Attachment']){var _0xb9756c=path[_0x482c('0x10e')](_0x566966,_0x3faf40[_0x482c('0xd4')][_0x482c('0xd1')]);if(fs[_0x482c('0x125')](_0xb9756c)){fs[_0x482c('0x126')](_0xb9756c)['pipe'](fs[_0x482c('0x127')](path[_0x482c('0x10e')](_0x35ae33,_0x3faf40['Attachment'][_0x482c('0xd1')])));}}return{'date':moment(_0x3faf40[_0x482c('0x86')])[_0x482c('0xdd')](_0x482c('0x102'))[_0x482c('0xa1')](),'sender':_0x3faf40['direction']===_0x482c('0xc9')?_0x3faf40[_0x482c('0x7d')]?_0x3faf40['User'][_0x482c('0x3f')]:_0x482c('0xe3'):_0x3faf40[_0x482c('0x71')]['firstName']+(_0x3faf40['Contact'][_0x482c('0x116')]?'\x20'+_0x3faf40[_0x482c('0x71')][_0x482c('0x116')]:''),'body':_0x3faf40[_0x482c('0xd4')]?_0x3faf40[_0x482c('0xd4')]['basename']:_0x3faf40['body'],'direction':_0x3faf40['direction']===_0x482c('0xc9')?'A':'C','secret':_0x3faf40[_0x482c('0xeb')],'read':_0x3faf40[_0x482c('0x128')],'attachment':_0x3faf40[_0x482c('0xd4')]};})[_0x482c('0x73')]()};return ejs[_0x482c('0x129')](path[_0x482c('0x10e')](config[_0x482c('0xd9')],'server',_0x482c('0x12a'),_0x482c('0x12b')),{'interaction':_0x3fd051})['then'](function(_0x70c1bb){return new BPromise(function(_0x5451e8,_0x2a8e97){pdf['create'](_0x70c1bb,_0x2e69fb)[_0x482c('0x12c')](path[_0x482c('0x10e')](_0x35ae33,_0x482c('0x12d')+_0x316d63['id']+'-'+_0x3e2629+_0x482c('0x12e')),function(_0x346194,_0x4a89ee){if(_0x346194)return _0x2a8e97(_0x346194);_0x5451e8(_0x4a89ee);});});})[_0x482c('0x22')](function(){return new BPromise(function(_0x4f3580,_0x5a941c){zipdir(_0x35ae33,{'saveTo':_0xfd6993},function(_0x22079c,_0x281ea3){if(_0x22079c)return _0x5a941c(_0x22079c);return _0x4f3580(_0x281ea3);});})[_0x482c('0x22')](function(){return new BPromise(function(_0x465a29,_0x2be39e){rimraf(_0x35ae33,function(_0x79c491){if(_0x79c491)_0x2be39e(_0x79c491);return _0x465a29();});});})[_0x482c('0x22')](function(){return _0x2ab8b4[_0x482c('0xd8')](_0xfd6993,_0xd733b1,function(_0x1b3f43){if(_0x1b3f43){console[_0x482c('0x12f')](_0x482c('0x130'),_0x1b3f43);}else{fs[_0x482c('0x131')](_0xfd6993);}});});});}else{return _0x2ab8b4[_0x482c('0x3a')](0xc8);}})[_0x482c('0x2c')](handleError(_0x2ab8b4,null));}; \ No newline at end of file +var _0x3e24=['secure','authentication','pass','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','addTags','setTags','spread','color','chatInteractionTags:save','removeTags','download','unix','root','server','files','tmp','transcript-%d-%s.zip','lastName','attachments','Owner','mkdirSync','10px','40px','30px','%s\x20#%d','Chat','YYYY-MM-DD','N.A.','closedAt','disposition','referer','customerPort','tail','createReadStream','pipe','firstName','downloadInteraction.html','transcript-','.pdf','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./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','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatInteraction,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','destroy','stack','name','send','map','TagIds','Tags','split','forEach','push','index','ChatInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','field','from','tools_tags','select','u.id','u.fullname','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','expr','search','parseSearch','sqlOperator','conditions','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','Tag','union','User','UserId','start','text','keys','some','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','DESC','t.id\x20IN\x20?','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','c.phone','Contact.phone','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','show','params','includeAll','include','merge','options','create','body','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','POST','MotionCWB:','follow','Error\x20in\x20Vidaoo\x20configuration','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandonInteraction,\x20%s,\x20%s,\x20%s','Interaction\x20already\x20assigned','closed','AbandonInteraction','abandon','attachmentUpload','file','basename','filename','Attachment','attachmentDownload','Unauthorized','server/files/attachments/','close','mailTranscript','join','transcript-%s.txt','now','pathTranscript','ChatMessage','Messages','CmContact','format','%s%d','agentAlias','System','agentIdentifier','website_alias','agent_alias','alias','fullname','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port'];(function(_0x57aad4,_0x108f28){var _0x26b886=function(_0x222c41){while(--_0x222c41){_0x57aad4['push'](_0x57aad4['shift']());}};_0x26b886(++_0x108f28);}(_0x3e24,0x167));var _0x43e2=function(_0x46ff82,_0x59d48c){_0x46ff82=_0x46ff82-0x0;var _0x262d95=_0x3e24[_0x46ff82];return _0x262d95;};'use strict';var pdf=require(_0x43e2('0x0'));var emlformat=require(_0x43e2('0x1'));var rimraf=require(_0x43e2('0x2'));var zipdir=require(_0x43e2('0x3'));var jsonpatch=require(_0x43e2('0x4'));var rp=require('request-promise');var moment=require(_0x43e2('0x5'));var BPromise=require(_0x43e2('0x6'));var Mustache=require('mustache');var util=require(_0x43e2('0x7'));var path=require(_0x43e2('0x8'));var sox=require(_0x43e2('0x9'));var csv=require(_0x43e2('0xa'));var ejs=require(_0x43e2('0xb'));var fs=require('fs');var _=require(_0x43e2('0xc'));var squel=require(_0x43e2('0xd'));var crypto=require('crypto');var jsforce=require(_0x43e2('0xe'));var deskjs=require(_0x43e2('0xf'));var toCsv=require('to-csv');var querystring=require(_0x43e2('0x10'));var Papa=require(_0x43e2('0x11'));var Redis=require('ioredis');var authService=require(_0x43e2('0x12'));var qs=require(_0x43e2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x43e2('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x43e2('0x15'));var db=require(_0x43e2('0x16'))['db'];config[_0x43e2('0x17')]=_[_0x43e2('0x18')](config[_0x43e2('0x17')],{'host':_0x43e2('0x19'),'port':0x18eb});var socket=require(_0x43e2('0x1a'))(new Redis(config[_0x43e2('0x17')]));require(_0x43e2('0x1b'))[_0x43e2('0x1c')](socket);var jayson=require(_0x43e2('0x1d'));var client=jayson[_0x43e2('0x1e')]['http']({'port':0x232b});var client9004=jayson[_0x43e2('0x1e')][_0x43e2('0x1f')]({'port':0x232c});function checkPasswordPattern(_0xb929b5,_0x2a0fb0,_0x5cea01){if(_0x5cea01){var _0x4a6443=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4a6443[_0x43e2('0x20')](_0x2a0fb0)){return _0xb929b5;}else{throw new db[(_0x43e2('0x21'))][(_0x43e2('0x22'))](_0x43e2('0x23'));}}else{return _0xb929b5;}}function respondWithRpcPromise(_0x105cb8,_0x1b7cde,_0x3ea010,_0x15ecb5){return new BPromise(function(_0x3236b9,_0x399cab){var _0x4879e9=_0x15ecb5||client;return _0x4879e9[_0x43e2('0x24')](_0x105cb8,_0x3ea010)[_0x43e2('0x25')](function(_0x4de509){logger[_0x43e2('0x26')]('ChatInteraction,\x20%s,\x20%s',_0x1b7cde,_0x43e2('0x27'));logger[_0x43e2('0x28')](_0x43e2('0x29'),_0x1b7cde,_0x43e2('0x27'),JSON[_0x43e2('0x2a')](_0x4de509));if(_0x4de509['error']){if(_0x4de509[_0x43e2('0x2b')][_0x43e2('0x2c')]===0x1f4){logger[_0x43e2('0x2b')]('ChatInteraction,\x20%s,\x20%s',_0x1b7cde,_0x4de509[_0x43e2('0x2b')][_0x43e2('0x2d')]);return _0x399cab(_0x4de509[_0x43e2('0x2b')][_0x43e2('0x2d')]);}logger['error'](_0x43e2('0x2e'),_0x1b7cde,_0x4de509[_0x43e2('0x2b')][_0x43e2('0x2d')]);return _0x3236b9(_0x4de509[_0x43e2('0x2b')][_0x43e2('0x2d')]);}else{logger[_0x43e2('0x26')](_0x43e2('0x2e'),_0x1b7cde,_0x43e2('0x27'));_0x3236b9(_0x4de509[_0x43e2('0x2f')][_0x43e2('0x2d')]);}})[_0x43e2('0x30')](function(_0x1de7e1){logger['error'](_0x43e2('0x2e'),_0x1b7cde,_0x1de7e1);_0x399cab(_0x1de7e1);});});}function respondWithStatusCode(_0x2f2bd8,_0x545246){_0x545246=_0x545246||0xcc;return function(_0x163063){if(_0x163063){return _0x2f2bd8[_0x43e2('0x31')](_0x545246);}return _0x2f2bd8[_0x43e2('0x32')](_0x545246)[_0x43e2('0x33')]();};}function respondWithResult(_0x3fd232,_0x5a896b){_0x5a896b=_0x5a896b||0xc8;return function(_0x42f495){if(_0x42f495){return _0x3fd232[_0x43e2('0x32')](_0x5a896b)[_0x43e2('0x34')](_0x42f495);}};}function respondWithFilteredResult(_0x3d8e16,_0x3316d6){return function(_0x30bdcb){if(_0x30bdcb){var _0x53f797=_0x30bdcb[_0x43e2('0x35')],_0x51226b=_0x3316d6[_0x43e2('0x36')],_0xe09322=_0x3316d6[_0x43e2('0x36')]+_0x3316d6['limit'],_0x1dcbc8;if(_0xe09322>=_0x53f797){_0xe09322=_0x53f797;_0x1dcbc8=0xc8;}else{_0x1dcbc8=0xce;}_0x3d8e16[_0x43e2('0x32')](_0x1dcbc8);return _0x3d8e16[_0x43e2('0x37')](_0x43e2('0x38'),_0x51226b+'-'+_0xe09322+'/'+_0x53f797)[_0x43e2('0x34')](_0x30bdcb);}return null;};}function patchUpdates(_0x418039){return function(_0x43ff4e){try{jsonpatch[_0x43e2('0x39')](_0x43ff4e,_0x418039,!![]);}catch(_0x56f0ad){return BPromise['reject'](_0x56f0ad);}return _0x43ff4e[_0x43e2('0x3a')]();};}function saveUpdates(_0xdbc014,_0x4ad24e){return function(_0x257676){if(_0x257676){return _0x257676[_0x43e2('0x3b')](_0xdbc014)['then'](function(_0xad8794){return _0xad8794;});}return null;};}function removeEntity(_0x4987ea,_0x4ad658){return function(_0x4cba6b){if(_0x4cba6b){return _0x4cba6b[_0x43e2('0x3c')]()['then'](function(){_0x4987ea[_0x43e2('0x32')](0xcc)[_0x43e2('0x33')]();});}};}function handleEntityNotFound(_0x128e22,_0x3bb911){return function(_0x44670b){if(!_0x44670b){_0x128e22[_0x43e2('0x31')](0x194);}return _0x44670b;};}function handleError(_0x1cf8e5,_0x13be86){_0x13be86=_0x13be86||0x1f4;return function(_0x1e9be1){logger[_0x43e2('0x2b')](_0x1e9be1[_0x43e2('0x3d')]);if(_0x1e9be1[_0x43e2('0x3e')]){delete _0x1e9be1[_0x43e2('0x3e')];}_0x1cf8e5[_0x43e2('0x32')](_0x13be86)[_0x43e2('0x3f')](_0x1e9be1);};}function getInteractionUsers(_0x40b39b,_0x16fac0){return new BPromise(function(_0x47f74c,_0x4da45f){try{if(_0x16fac0[_0x40b39b['id']]){_0x40b39b['Users']=_[_0x43e2('0x40')](_0x16fac0[_0x40b39b['id']],function(_0x13af7f){return{'id':_0x13af7f['id'],'fullname':_0x13af7f['fullname']};});}}catch(_0x5cfde9){_0x4da45f(_0x5cfde9);}_0x47f74c(_0x40b39b);});}function getInteractionTags(_0x2b5fce,_0x45cb38){return new BPromise(function(_0x8a62e4,_0x200d70){try{if(_0x2b5fce[_0x43e2('0x41')]){_0x2b5fce[_0x43e2('0x42')]=[];_0x2b5fce[_0x43e2('0x41')][_0x43e2('0x43')](',')[_0x43e2('0x44')](function(_0x39bf87){_0x2b5fce[_0x43e2('0x42')][_0x43e2('0x45')](_0x45cb38[_0x39bf87]);});}delete _0x2b5fce[_0x43e2('0x41')];}catch(_0x280074){_0x200d70(_0x280074);}_0x8a62e4(_0x2b5fce);});}function updateChatInteraction(_0x5e0673,_0xf6b2ae,_0x577d2e){return new BPromise(function(_0xc1fbb4,_0x5e8c0b){return getInteractionUsers(_0x5e0673,_0x577d2e)[_0x43e2('0x25')](function(_0x2ce990){return getInteractionTags(_0x2ce990,_0xf6b2ae);})[_0x43e2('0x25')](function(_0x4918bc){_0xc1fbb4(_0x4918bc);})[_0x43e2('0x30')](function(_0x5ca5d0){_0x5e8c0b(_0x5ca5d0);});});}exports[_0x43e2('0x46')]=function(_0x36f94a,_0x34f2b5){var _0x169a61={},_0x5c0c48={},_0x484372={'count':0x0,'rows':[]};var _0x95b22f=_[_0x43e2('0x40')](db[_0x43e2('0x47')][_0x43e2('0x48')],function(_0x4a849d){return{'name':_0x4a849d[_0x43e2('0x49')],'type':_0x4a849d[_0x43e2('0x4a')][_0x43e2('0x4b')]};});_0x5c0c48[_0x43e2('0x4c')]=_[_0x43e2('0x40')](_0x95b22f,'name');_0x5c0c48[_0x43e2('0x4d')]=_['keys'](_0x36f94a[_0x43e2('0x4d')]);_0x5c0c48[_0x43e2('0x4e')]=_['intersection'](_0x5c0c48[_0x43e2('0x4c')],_0x5c0c48['query']);_0x169a61['attributes']=_[_0x43e2('0x4f')](_0x5c0c48[_0x43e2('0x4c')],qs[_0x43e2('0x50')](_0x36f94a[_0x43e2('0x4d')][_0x43e2('0x50')]));_0x169a61['attributes']=_0x169a61[_0x43e2('0x51')][_0x43e2('0x52')]?_0x169a61[_0x43e2('0x51')]:_0x5c0c48[_0x43e2('0x4c')];if(!_0x36f94a[_0x43e2('0x4d')][_0x43e2('0x53')](_0x43e2('0x54'))){_0x169a61[_0x43e2('0x55')]=qs['limit'](_0x36f94a[_0x43e2('0x4d')][_0x43e2('0x55')]);_0x169a61['offset']=qs[_0x43e2('0x36')](_0x36f94a[_0x43e2('0x4d')][_0x43e2('0x36')]);}_0x169a61[_0x43e2('0x56')]=qs['sort'](_0x36f94a[_0x43e2('0x4d')][_0x43e2('0x57')]);_0x169a61[_0x43e2('0x58')]=qs[_0x43e2('0x4e')](_[_0x43e2('0x59')](_0x36f94a['query'],_0x5c0c48['filters']),_0x95b22f);var _0x399e96=[];var _0x1127e1=squel['select']()[_0x43e2('0x5a')]('id')[_0x43e2('0x5a')](_0x43e2('0x3e'))['field']('color')[_0x43e2('0x5b')](_0x43e2('0x5c'));var _0x32148b=squel[_0x43e2('0x5d')]()[_0x43e2('0x5a')](_0x43e2('0x5e'))[_0x43e2('0x5a')](_0x43e2('0x5f'))[_0x43e2('0x5a')]('ui.ChatInteractionId')[_0x43e2('0x5b')]('user_has_chat_interactions','ui')[_0x43e2('0x60')](_0x43e2('0x61'),'u',_0x43e2('0x62'));var _0x5a5b32=squel[_0x43e2('0x5d')]()[_0x43e2('0x5b')](_0x43e2('0x63'),'i')[_0x43e2('0x60')](_0x43e2('0x64'),'c',_0x43e2('0x65'))[_0x43e2('0x60')](_0x43e2('0x61'),'o',_0x43e2('0x66'))[_0x43e2('0x60')](_0x43e2('0x67'),'a',_0x43e2('0x68'))[_0x43e2('0x60')]('chat_messages','me','me.ChatInteractionId\x20=\x20i.id')['left_join']('chat_interaction_has_tags','it','it.ChatInteractionId\x20=\x20i.id')['left_join'](_0x43e2('0x5c'),'t','t.id\x20=\x20it.TagId');var _0x4ca995=squel[_0x43e2('0x69')]();var _0x4c6bb9=[];var _0x299c47=squel['expr']();var _0x3415b9;if(_0x36f94a[_0x43e2('0x4d')][_0x43e2('0x6a')]){_0x3415b9=as[_0x43e2('0x6b')](_0x36f94a[_0x43e2('0x4d')][_0x43e2('0x6a')]);var _0x129bd0=_0x3415b9[_0x43e2('0x6c')];for(var _0x40d99b=0x0;_0x40d99b<_0x3415b9[_0x43e2('0x6d')]['length'];_0x40d99b++){var _0x419450=_0x3415b9[_0x43e2('0x6d')][_0x40d99b];var _0x5b4161='i';var _0x2a795d=_['find'](_0x95b22f,['name',_0x419450['field']]);if(!_0x2a795d){switch(_0x419450['field']){case'unreadMessages':if(_0x419450[_0x43e2('0x6e')]==0x1){_0x5a5b32[_0x43e2('0x6f')]('`'+_0x419450[_0x43e2('0x5a')]+_0x43e2('0x70'));}else{_0x5a5b32['having']('`'+_0x419450['field']+_0x43e2('0x71'));}break;case _0x43e2('0x72'):if(_0x419450[_0x43e2('0x73')]===_0x43e2('0x74')){if(_0x419450[_0x43e2('0x6e')][_0x43e2('0x43')]('\x20')[_0x43e2('0x52')]>0x1){_0x4ca995[_0x129bd0](_0x43e2('0x75'),qs[_0x43e2('0x76')](_0x419450[_0x43e2('0x6e')]),null);}else{var _0x1dd8c8='%'+_0x419450['value']+'%';_0x4ca995[_0x129bd0](_0x43e2('0x77'),_0x1dd8c8,_0x1dd8c8,_0x1dd8c8);}}else{_0x2a795d=_[_0x43e2('0x78')](_0x95b22f,[_0x43e2('0x3e'),_0x43e2('0x79')]);_0x419450[_0x43e2('0x5a')]='ContactId';_0x4f6ad5=as[_0x43e2('0x7a')](_0x5b4161,_0x2a795d[_0x43e2('0x4a')],_0x419450);_0x4ca995[_0x129bd0](_0x4f6ad5['text'],_0x4f6ad5[_0x43e2('0x6e')]['start'],_0x4f6ad5[_0x43e2('0x6e')][_0x43e2('0x33')]);}break;case _0x43e2('0x7b'):var _0x462f25=_0x419450[_0x43e2('0x6e')][_0x43e2('0x43')](',')[_0x43e2('0x40')](function(_0xb0c30b){return Number(_0xb0c30b);});_0x462f25[_0x43e2('0x44')](function(_0x4866e1){_0x299c47['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4866e1+',%');});_0x4c6bb9=_[_0x43e2('0x7c')](_0x4c6bb9,_0x462f25);break;case _0x43e2('0x7d'):if(_0x419450[_0x43e2('0x73')]===_0x43e2('0x74')){_0x4ca995[_0x129bd0]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x419450[_0x43e2('0x6e')]+'%',null);}else{_0x2a795d=_[_0x43e2('0x78')](_0x95b22f,[_0x43e2('0x3e'),'UserId']);_0x419450[_0x43e2('0x5a')]=_0x43e2('0x7e');_0x4f6ad5=as[_0x43e2('0x7a')](_0x5b4161,_0x2a795d[_0x43e2('0x4a')],_0x419450);_0x4ca995[_0x129bd0](_0x4f6ad5['text'],_0x4f6ad5[_0x43e2('0x6e')][_0x43e2('0x7f')],_0x4f6ad5[_0x43e2('0x6e')]['end']);}break;case'body':_0x4f6ad5=as[_0x43e2('0x7a')]('me',null,_0x419450);_0x4ca995[_0x129bd0](_0x4f6ad5[_0x43e2('0x80')],_0x4f6ad5['value'][_0x43e2('0x7f')],_0x4f6ad5[_0x43e2('0x6e')][_0x43e2('0x33')]);break;}}else{var _0x4f6ad5=as[_0x43e2('0x7a')](_0x5b4161,_0x2a795d['type'],_0x419450);_0x4ca995[_0x129bd0](_0x4f6ad5[_0x43e2('0x80')],_0x4f6ad5[_0x43e2('0x6e')][_0x43e2('0x7f')],_0x4f6ad5[_0x43e2('0x6e')][_0x43e2('0x33')]);}}}else{var _0x13c0a6=_(_0x36f94a[_0x43e2('0x4d')])[_0x43e2('0x81')]()['map'](function(_0x897ec9){return _[_0x43e2('0x82')](_0x95b22f,[_0x43e2('0x3e'),_0x897ec9])?_0x897ec9:undefined;})[_0x43e2('0x83')]()[_0x43e2('0x6e')]();if(!_[_0x43e2('0x84')](_0x13c0a6)){_0x13c0a6[_0x43e2('0x44')](function(_0x15d96d){if(_0x15d96d===_0x43e2('0x85')){_0x5a5b32[_0x43e2('0x58')](_0x43e2('0x86'),[]['concat'](_0x36f94a[_0x43e2('0x4d')][_0x15d96d]));}else if(_0x15d96d===_0x43e2('0x87')){var _0x285dc6=JSON['parse'](_0x36f94a[_0x43e2('0x4d')][_0x15d96d])[_0x43e2('0x88')];var _0x374657=JSON[_0x43e2('0x89')](_0x36f94a['query'][_0x15d96d])[_0x43e2('0x8a')];_0x5a5b32['where'](_0x43e2('0x8b'),_0x285dc6,_0x374657);}else{if(_0x36f94a[_0x43e2('0x4d')][_0x15d96d]===_0x43e2('0x8c')){_0x5a5b32['where']('i.'+_0x15d96d+_0x43e2('0x8d'));}else{_0x5a5b32[_0x43e2('0x58')]('i.'+_0x15d96d+_0x43e2('0x8e'),_0x36f94a[_0x43e2('0x4d')][_0x15d96d]);}}});}if(_0x36f94a[_0x43e2('0x4d')][_0x43e2('0x8f')]){if(_0x36f94a[_0x43e2('0x4d')][_0x43e2('0x8f')]==0x1){_0x5a5b32[_0x43e2('0x6f')](_0x43e2('0x90'));}else{_0x5a5b32[_0x43e2('0x6f')]('`unreadMessages`\x20>\x200');}}if(_0x36f94a[_0x43e2('0x4d')][_0x43e2('0x91')]){_0x4c6bb9=_[_0x43e2('0x92')](_0x36f94a[_0x43e2('0x4d')]['tag'])?_0x36f94a[_0x43e2('0x4d')][_0x43e2('0x91')]:new Array(_0x36f94a[_0x43e2('0x4d')][_0x43e2('0x91')]);_0x4c6bb9[_0x43e2('0x44')](function(_0x2f4c99){_0x299c47['or'](_0x43e2('0x93'),'%,'+_0x2f4c99+',%');});}if(_0x36f94a[_0x43e2('0x4d')]['filter']){var _0x19d3ec=_0x36f94a[_0x43e2('0x4d')][_0x43e2('0x94')][_0x43e2('0x95')]('\x5c','\x5c\x5c')[_0x43e2('0x95')]('\x27\x27',_0x43e2('0x96'));if(qs[_0x43e2('0x97')](_0x19d3ec)){_0x4ca995['or']('i.id\x20LIKE\x20?',_0x19d3ec+'%');}else{_0x4ca995['or'](_0x43e2('0x98'),qs[_0x43e2('0x76')](_0x19d3ec))['or'](_0x43e2('0x99'),_0x19d3ec+'%');}}}_0x5a5b32[_0x43e2('0x58')](_0x4ca995);_0x5a5b32[_0x43e2('0x9a')](_0x43e2('0x9b'));var _0x5a10ba={'type':db[_0x43e2('0x21')][_0x43e2('0x9c')][_0x43e2('0x9d')],'raw':!![]};var _0x249ee8=_0x5a5b32[_0x43e2('0x9e')]();_0x249ee8[_0x43e2('0x5a')]('i.id');_0x249ee8[_0x43e2('0x5a')](_0x43e2('0x9f'),_0x43e2('0xa0'));if(_0x169a61['order']){_0x169a61['order'][_0x43e2('0x44')](function(_0x4d9520){_0x5a5b32['order']('i.'+_0x4d9520[0x0],_0x4d9520[0x1]===_0x43e2('0xa1')?![]:!![]);});}if(!_[_0x43e2('0x84')](_0x4c6bb9)){_0x5a5b32[_0x43e2('0x6f')](_0x299c47);_0x249ee8['where'](_0x43e2('0xa2'),_0x4c6bb9);}BPromise['resolve']()[_0x43e2('0x25')](function(){if(!_0x3415b9){if(_0x36f94a[_0x43e2('0x4d')][_0x43e2('0x85')]||_0x36f94a['query']['journey'])return;_0x249ee8['where'](_0x43e2('0xa3'));_0x5a5b32[_0x43e2('0x58')](_0x43e2('0xa3'));return;}return _0x36f94a[_0x43e2('0xa4')][_0x43e2('0xa5')]({'attributes':['id'],'raw':!![]})[_0x43e2('0x25')](function(_0x413fdb){if(_[_0x43e2('0x84')](_0x413fdb)){_0x249ee8[_0x43e2('0x58')](_0x43e2('0xa6'));_0x5a5b32[_0x43e2('0x58')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x249ee8[_0x43e2('0x58')](_0x43e2('0x86'),_['map'](_0x413fdb,'id'));_0x5a5b32[_0x43e2('0x58')]('i.ChatWebsiteId\x20IN\x20?',_[_0x43e2('0x40')](_0x413fdb,'id'));}});})[_0x43e2('0x25')](function(){db[_0x43e2('0xa7')]['query'](_0x249ee8[_0x43e2('0xa8')](),_0x5a10ba)[_0x43e2('0x25')](function(_0x5043f1){_0x484372['count']=_0x5043f1['length'];if(_0x484372[_0x43e2('0x35')]===0x0)return[];return db[_0x43e2('0xa7')][_0x43e2('0x4d')](_0x1127e1[_0x43e2('0xa8')](),_0x5a10ba)[_0x43e2('0x25')](function(_0x19b134){_0x399e96=_[_0x43e2('0xa9')](_0x19b134,'id');_0x5a10ba=_['merge'](_0x5a10ba,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x36f94a[_0x43e2('0x4d')][_0x43e2('0x50')]){_0x169a61['attributes'][_0x43e2('0x44')](function(_0x44edab){_0x5a5b32[_0x43e2('0x5a')]('i.'+_0x44edab);});}else{_0x5a5b32['field'](_0x43e2('0x9f'),_0x43e2('0xa0'));_0x5a5b32[_0x43e2('0x5a')](_0x43e2('0xaa'),_0x43e2('0xab'));_0x5a5b32[_0x43e2('0x5a')](_0x43e2('0xac'),_0x43e2('0xad'));_0x5a5b32[_0x43e2('0x5a')](_0x43e2('0xae'));_0x5a5b32[_0x43e2('0x5a')](_0x43e2('0xaf'),_0x43e2('0xb0'));_0x5a5b32[_0x43e2('0x5a')]('c.lastName',_0x43e2('0xb1'));_0x5a5b32[_0x43e2('0x5a')](_0x43e2('0xb2'),'Contact.email');_0x5a5b32['field'](_0x43e2('0xb3'),_0x43e2('0xb4'));_0x5a5b32[_0x43e2('0x5a')]('c.mobile','Contact.mobile');_0x5a5b32[_0x43e2('0x5a')](_0x43e2('0xb5'),_0x43e2('0xb6'));_0x5a5b32[_0x43e2('0x5a')](_0x43e2('0xb7'),_0x43e2('0xb8'));_0x5a5b32[_0x43e2('0x5a')](_0x43e2('0xb9'),_0x43e2('0xba'));_0x5a5b32[_0x43e2('0x5a')](_0x43e2('0xbb'),_0x43e2('0x41'));}if(_0x169a61[_0x43e2('0x55')])_0x5a5b32[_0x43e2('0x55')](_0x169a61[_0x43e2('0x55')]);if(_0x169a61[_0x43e2('0x36')])_0x5a5b32[_0x43e2('0x36')](_0x169a61[_0x43e2('0x36')]);return db[_0x43e2('0xa7')][_0x43e2('0x4d')](_0x5a5b32[_0x43e2('0xa8')](),_0x5a10ba);})[_0x43e2('0x25')](function(_0x2a3cf1){_0x32148b[_0x43e2('0x58')](_0x43e2('0xbc'),_['map'](_0x2a3cf1,'id'));return db['sequelize'][_0x43e2('0x4d')](_0x32148b[_0x43e2('0xa8')](),_0x5a10ba)[_0x43e2('0x25')](function(_0x54f411){var _0x8daf6c=_[_0x43e2('0xbd')](_0x54f411,_0x43e2('0xbe'));var _0x5c0ff4=[];_0x2a3cf1['forEach'](function(_0x5946fc){_0x5c0ff4[_0x43e2('0x45')](updateChatInteraction(_0x5946fc,_0x399e96,_0x8daf6c));});return BPromise[_0x43e2('0xbf')](_0x5c0ff4);});});})[_0x43e2('0x25')](function(_0x3cf96a){_0x484372[_0x43e2('0xc0')]=_0x3cf96a;return _0x484372;})[_0x43e2('0x25')](respondWithFilteredResult(_0x34f2b5,_0x169a61));})[_0x43e2('0x30')](handleError(_0x34f2b5,null));};exports[_0x43e2('0xc1')]=function(_0x2f63e9,_0x5803c5){var _0xfde322={'raw':![],'where':{'id':_0x2f63e9[_0x43e2('0xc2')]['id']}},_0x4c8478={};_0x4c8478[_0x43e2('0x4c')]=_[_0x43e2('0x81')](db[_0x43e2('0x47')][_0x43e2('0x48')]);_0x4c8478['query']=_[_0x43e2('0x81')](_0x2f63e9[_0x43e2('0x4d')]);_0x4c8478[_0x43e2('0x4e')]=_[_0x43e2('0x4f')](_0x4c8478[_0x43e2('0x4c')],_0x4c8478[_0x43e2('0x4d')]);_0xfde322[_0x43e2('0x51')]=_['intersection'](_0x4c8478[_0x43e2('0x4c')],qs['fields'](_0x2f63e9[_0x43e2('0x4d')][_0x43e2('0x50')]));_0xfde322['attributes']=_0xfde322['attributes'][_0x43e2('0x52')]?_0xfde322[_0x43e2('0x51')]:_0x4c8478[_0x43e2('0x4c')];if(_0x2f63e9['query'][_0x43e2('0xc3')]){_0xfde322[_0x43e2('0xc4')]=[{'all':!![]}];}_0xfde322=_[_0x43e2('0xc5')]({},_0xfde322,_0x2f63e9[_0x43e2('0xc6')]);return db[_0x43e2('0x47')]['find'](_0xfde322)[_0x43e2('0x25')](handleEntityNotFound(_0x5803c5,null))['then'](respondWithResult(_0x5803c5,null))[_0x43e2('0x30')](handleError(_0x5803c5,null));};exports[_0x43e2('0xc7')]=function(_0x48f833,_0x3be03d){return db[_0x43e2('0x47')]['create'](_0x48f833[_0x43e2('0xc8')],{})[_0x43e2('0x25')](respondWithResult(_0x3be03d,0xc9))[_0x43e2('0x30')](handleError(_0x3be03d,null));};exports[_0x43e2('0x3b')]=function(_0x137c06,_0x4d0e75){if(_0x137c06['body']['id']){delete _0x137c06[_0x43e2('0xc8')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x137c06['params']['id']}})[_0x43e2('0x25')](handleEntityNotFound(_0x4d0e75,null))[_0x43e2('0x25')](saveUpdates(_0x137c06['body'],null))['then'](respondWithResult(_0x4d0e75,null))['catch'](handleError(_0x4d0e75,null));};exports[_0x43e2('0x3c')]=function(_0x4392c3,_0x2270b5){return db[_0x43e2('0x47')]['find']({'where':{'id':_0x4392c3['params']['id']}})[_0x43e2('0x25')](handleEntityNotFound(_0x2270b5,null))[_0x43e2('0x25')](removeEntity(_0x2270b5,null))[_0x43e2('0x30')](handleError(_0x2270b5,null));};exports[_0x43e2('0xc9')]=function(_0x125e7a,_0x419b8b){return db[_0x43e2('0x47')][_0x43e2('0xc9')]()[_0x43e2('0x25')](respondWithResult(_0x419b8b,null))[_0x43e2('0x30')](handleError(_0x419b8b,null));};exports[_0x43e2('0xca')]=function(_0x3cfee0,_0x192ed3){var _0x81c11d=_0x3cfee0[_0x43e2('0xc2')]['id'];var _0x2113aa;var _0x1dc8f9;var _0x5c8e17;return db['ChatInteraction'][_0x43e2('0xcb')]({'where':{'id':_0x81c11d}})[_0x43e2('0x25')](function(_0x3ca04b){_0x2113aa=_0x3ca04b;return db[_0x43e2('0xcc')][_0x43e2('0xcb')]({'where':{'id':_0x3ca04b[_0x43e2('0x85')]},'attributes':['id',_0x43e2('0xcd'),_0x43e2('0xce')],'raw':!![]});})[_0x43e2('0x25')](function(_0x2efe6f){if(_0x2efe6f&&_0x2efe6f[_0x43e2('0xcd')]&&_0x2efe6f[_0x43e2('0xce')]){_0x1dc8f9=_0x2efe6f;var _0x5ad19b={'rejectUnauthorized':![],'method':_0x43e2('0xcf'),'uri':'https://api-vidaoo.xcally.com/api/v1/sessions','headers':{'X-APIKEY':_0x2efe6f[_0x43e2('0xcd')]},'body':{'name':_0x43e2('0xd0')+_0x81c11d},'redirect':_0x43e2('0xd1'),'json':!![]};return rp(_0x5ad19b);}else{throw new db[(_0x43e2('0x21'))]['ValidationError'](_0x43e2('0xd2'));}})[_0x43e2('0x25')](function(_0x20f3dc){_0x5c8e17=_0x20f3dc;if(_0x5c8e17['id']){var _0x27e72c={'body':_0x5c8e17['join_url'],'ChatWebsiteId':_0x1dc8f9['id'],'ChatInteractionId':_0x2113aa['id'],'direction':'out','UserId':_0x3cfee0['user']['id']};return db['ChatMessage'][_0x43e2('0xc7')](_0x27e72c,{});}else{throw new db['Sequelize'][(_0x43e2('0x22'))](_0x43e2('0xd3'));}})[_0x43e2('0x25')](function(){return _0x2113aa[_0x43e2('0xd4')]({'vidaooSessionId':_0x5c8e17['id']});})[_0x43e2('0x25')](respondWithResult(_0x192ed3,null))[_0x43e2('0x30')](handleError(_0x192ed3,null));};exports[_0x43e2('0xd5')]=function(_0x941c96,_0x24dc5b){if(_0x941c96[_0x43e2('0xc8')]['id']){delete _0x941c96[_0x43e2('0xc8')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x941c96[_0x43e2('0xc2')]['id']}})[_0x43e2('0x25')](handleEntityNotFound(_0x24dc5b,null))[_0x43e2('0x25')](saveUpdates(_0x941c96[_0x43e2('0xc8')],null))[_0x43e2('0x25')](respondWithResult(_0x24dc5b,null))[_0x43e2('0x30')](handleError(_0x24dc5b,null));};exports['abandon']=function(_0x25998e,_0x421a50,_0x214aa0){if(_0x25998e[_0x43e2('0xc8')]['id']){delete _0x25998e['body']['id'];}return db[_0x43e2('0x47')][_0x43e2('0x78')]({'where':{'id':_0x25998e['params']['id']}})[_0x43e2('0x25')](function(_0x1ac85c){if(!_0x1ac85c){logger[_0x43e2('0x2b')](_0x43e2('0xd6'),'abandon',0x194,'entity\x20not\x20found');_0x421a50[_0x43e2('0x31')](0x194);}else{if(_0x1ac85c[_0x43e2('0x7e')]){throw new db[(_0x43e2('0x21'))][(_0x43e2('0x22'))](_0x43e2('0xd7'));}}return _0x1ac85c;})[_0x43e2('0x25')](function(_0x399f4f){if(_0x399f4f){return _0x399f4f[_0x43e2('0x3b')]({'closed':_0x25998e['body'][_0x43e2('0xd8')],'disposition':_0x25998e[_0x43e2('0xc8')]['disposition']})[_0x43e2('0x25')](function(_0x3363fa){return _0x3363fa;});}})[_0x43e2('0x25')](function(_0x227851){return respondWithRpcPromise(_0x43e2('0xd9'),_0x43e2('0xda'),_0x25998e[_0x43e2('0xc8')],client9004);})[_0x43e2('0x25')](respondWithResult(_0x421a50,null))['catch'](handleError(_0x421a50,null));};exports[_0x43e2('0xdb')]=function(_0x220790,_0x2b5548,_0x4c4e02){_0x220790[_0x43e2('0xc8')][_0x43e2('0x3e')]=_0x220790[_0x43e2('0xdc')]['originalname'];_0x220790[_0x43e2('0xc8')][_0x43e2('0xdd')]=_0x220790[_0x43e2('0xdc')][_0x43e2('0xde')];_0x220790[_0x43e2('0xc8')][_0x43e2('0x4a')]=_0x220790[_0x43e2('0xdc')]['mimetype'];return db[_0x43e2('0xdf')][_0x43e2('0xc7')](_0x220790[_0x43e2('0xc8')])[_0x43e2('0x25')](respondWithResult(_0x2b5548,0xc9))[_0x43e2('0x30')](handleError(_0x2b5548,null));};exports[_0x43e2('0xe0')]=function(_0x2bff43,_0x36c628,_0x5e4e35){return db['ChatInteraction'][_0x43e2('0xcb')]({'where':{'id':_0x2bff43[_0x43e2('0xc2')]['id']},'raw':!![]})[_0x43e2('0x25')](handleEntityNotFound(_0x36c628,null))['then'](function(_0x404a81){if(_0x404a81){if(_0x404a81[_0x43e2('0xd8')]){return _0x36c628['status'](0x193)[_0x43e2('0x34')]({'status':0x193,'message':_0x43e2('0xe1')});}return db[_0x43e2('0xdf')][_0x43e2('0xcb')]({'where':{'id':_0x2bff43[_0x43e2('0x4d')]['attachId']},'raw':!![]})[_0x43e2('0x25')](handleEntityNotFound(_0x36c628,null));}})[_0x43e2('0x25')](function(_0x1236ea){if(_0x1236ea){return _0x36c628['download'](path['join'](config['root'],_0x43e2('0xe2'),_0x1236ea[_0x43e2('0xdd')]));}})[_0x43e2('0x30')](handleError(_0x36c628,null));};exports[_0x43e2('0xe3')]=function(_0x160a1e,_0x4a62d0){var _0x262c23=null;var _0x57edfb=null;var _0x4a935c=null;var _0x3d474c=null;if(_0x160a1e[_0x43e2('0xc8')]['id']){delete _0x160a1e[_0x43e2('0xc8')]['id'];}if(_0x160a1e[_0x43e2('0xc8')][_0x43e2('0xe4')]){_0x3d474c=path[_0x43e2('0xe5')](config['root'],'server/files/chat/upload/',util['format'](_0x43e2('0xe6'),Date[_0x43e2('0xe7')]()));_0x160a1e[_0x43e2('0xc8')][_0x43e2('0xe8')]=_0x3d474c;}return db[_0x43e2('0x47')][_0x43e2('0x78')]({'where':{'id':_0x160a1e[_0x43e2('0xc2')]['id']},'include':[{'model':db[_0x43e2('0xe9')],'as':_0x43e2('0xea'),'include':[{'model':db[_0x43e2('0x7d')],'as':'User'}]}]})[_0x43e2('0x25')](handleEntityNotFound(_0x4a62d0,null))[_0x43e2('0x25')](saveUpdates(_0x160a1e['body'],null))['then'](function(_0x4772a4){if(_0x4772a4){_0x262c23=_0x4772a4;return db[_0x43e2('0xcc')][_0x43e2('0x78')]({'where':{'id':_0x262c23['ChatWebsiteId']}});}})['then'](function(_0x20c697){if(_0x20c697){_0x4a935c=_0x20c697;return db[_0x43e2('0xeb')][_0x43e2('0x78')]({'where':{'id':_0x262c23[_0x43e2('0x79')]}});}})[_0x43e2('0x25')](function(_0x54c6f9){if(_0x54c6f9){_0x57edfb=_0x54c6f9;if(_0x3d474c){var _0x31eb44=null;for(var _0x432c97=0x1;_0x432c97<_0x262c23[_0x43e2('0xea')][_0x43e2('0x52')];++_0x432c97){_0x31eb44=_0x262c23['Messages'][_0x432c97];var _0x349dcf=_0x31eb44[_0x43e2('0x7e')]?util[_0x43e2('0xec')](_0x43e2('0xed'),_0x4a935c[_0x43e2('0xee')],_0x31eb44[_0x43e2('0x7e')]):_0x43e2('0xef');var _0x5b7b09=_0x160a1e[_0x43e2('0xc8')]['customer']||util[_0x43e2('0xec')](_0x43e2('0xed'),'Visitor',_0x31eb44[_0x43e2('0x79')]);switch(_0x4a935c[_0x43e2('0xf0')]){case _0x43e2('0xf1'):_0x349dcf=_0x31eb44[_0x43e2('0x7e')]?util[_0x43e2('0xec')]('%s%d',_0x4a935c[_0x43e2('0xee')],_0x31eb44[_0x43e2('0x7e')]):_0x43e2('0xef');break;case _0x43e2('0xf2'):_0x349dcf=_0x31eb44['UserId']?_0x31eb44['User'][_0x43e2('0xf3')]||_0x31eb44[_0x43e2('0x7d')][_0x43e2('0xf4')]:_0x43e2('0xef');break;case _0x43e2('0xf5'):_0x349dcf=_0x31eb44[_0x43e2('0x7e')]?_0x31eb44[_0x43e2('0x7d')][_0x43e2('0xf4')]:_0x43e2('0xef');break;default:_0x349dcf=_0x31eb44['UserId']?util[_0x43e2('0xec')](_0x43e2('0xed'),_0x4a935c[_0x43e2('0xee')],_0x31eb44[_0x43e2('0x7e')]):'System';}var _0x29f300=util['format'](_0x43e2('0xf6'),moment(_0x31eb44[_0x43e2('0x87')])[_0x43e2('0xec')](_0x43e2('0xf7')),_0x31eb44[_0x43e2('0xf8')]==='in'?_0x5b7b09:_0x349dcf,_0x31eb44[_0x43e2('0xc8')]);if(!_0x31eb44[_0x43e2('0xf9')]){fs[_0x43e2('0xfa')](_0x3d474c,_0x29f300);}}return db[_0x43e2('0xfb')][_0x43e2('0xcb')]({'where':{'service':!![]},'include':[{'model':db[_0x43e2('0xfc')],'as':'Smtp','raw':!![]}]});}}})['then'](function(_0x57c3f3){if(_0x57c3f3&&_0x57c3f3[_0x43e2('0xfd')]&&_0x160a1e[_0x43e2('0xc8')]){var _0x5dcb70={'tls':{'rejectUnauthorized':![]}};if(_0x57c3f3[_0x43e2('0xfd')][_0x43e2('0xfe')]){_0x5dcb70[_0x43e2('0xfe')]=_0x57c3f3[_0x43e2('0xfd')][_0x43e2('0xfe')];}else{_0x5dcb70['host']=_0x57c3f3['Smtp'][_0x43e2('0xff')];_0x5dcb70[_0x43e2('0x100')]=_0x57c3f3[_0x43e2('0xfd')][_0x43e2('0x100')];_0x5dcb70[_0x43e2('0x101')]=_0x57c3f3['Smtp'][_0x43e2('0x101')];}if(_0x57c3f3[_0x43e2('0xfd')][_0x43e2('0x102')]){_0x5dcb70['auth']={'user':_0x57c3f3[_0x43e2('0xfd')][_0x43e2('0xa4')],'pass':_0x57c3f3[_0x43e2('0xfd')][_0x43e2('0x103')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x5dcb70,'message':{'from':util[_0x43e2('0xec')](_0x43e2('0x104'),_0x57c3f3[_0x43e2('0x3e')],_0x57c3f3['email']||_0x57c3f3[_0x43e2('0xfd')][_0x43e2('0xa4')]),'to':_0x160a1e[_0x43e2('0xc8')][_0x43e2('0xe4')],'subject':_0x43e2('0x105'),'text':util[_0x43e2('0xec')](_0x43e2('0x106'),_0x160a1e[_0x43e2('0xc8')][_0x43e2('0xe4')]),'attachments':[{'path':_0x3d474c}]}})[_0x43e2('0x25')](function(){return _0x262c23;})[_0x43e2('0x30')](function(_0x46c19c){console[_0x43e2('0x2b')](_0x46c19c);});}else{return _0x262c23;}})[_0x43e2('0x25')](respondWithStatusCode(_0x4a62d0,0xc8))[_0x43e2('0x30')](handleError(_0x4a62d0,null));};exports[_0x43e2('0x107')]=function(_0x328236,_0x436c12,_0x4d04a5){return db[_0x43e2('0xe9')][_0x43e2('0x78')]({'where':{'id':_0x328236['params']['id']}})[_0x43e2('0x25')](handleEntityNotFound(_0x436c12,null))[_0x43e2('0x25')](function(_0x3f0b40){if(_0x3f0b40){return _0x3f0b40[_0x43e2('0x107')](_0x328236[_0x43e2('0xc8')][_0x43e2('0x108')],_[_0x43e2('0x109')](_0x328236[_0x43e2('0xc8')],[_0x43e2('0x108'),'id'])||{});}})[_0x43e2('0x25')](respondWithResult(_0x436c12,null))[_0x43e2('0x30')](handleError(_0x436c12,null));};exports[_0x43e2('0x10a')]=function(_0x38c345,_0xbc6c86,_0x30e7fd){var _0x334691={'raw':![],'where':{}};var _0x20178e={};var _0x150ba7={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x43e2('0xcb')]({'where':{'id':_0x38c345[_0x43e2('0xc2')]['id']}})[_0x43e2('0x25')](handleEntityNotFound(_0xbc6c86,null))['then'](function(_0x5a8da1){if(_0x5a8da1){_0x20178e[_0x43e2('0x4c')]=_[_0x43e2('0x81')](db[_0x43e2('0xe9')][_0x43e2('0x48')]);_0x20178e[_0x43e2('0x4d')]=_[_0x43e2('0x81')](_0x38c345['query']);_0x20178e[_0x43e2('0x4e')]=_[_0x43e2('0x4f')](_0x20178e[_0x43e2('0x4c')],_0x20178e[_0x43e2('0x4d')]);_0x334691[_0x43e2('0x51')]=_[_0x43e2('0x4f')](_0x20178e[_0x43e2('0x4c')],qs[_0x43e2('0x50')](_0x38c345[_0x43e2('0x4d')][_0x43e2('0x50')]));_0x334691[_0x43e2('0x51')]=_0x334691['attributes'][_0x43e2('0x52')]?_0x334691[_0x43e2('0x51')]:_0x20178e[_0x43e2('0x4c')];if(!_0x38c345[_0x43e2('0x4d')]['hasOwnProperty'](_0x43e2('0x54'))){_0x334691['limit']=qs['limit'](_0x38c345[_0x43e2('0x4d')]['limit']);_0x334691[_0x43e2('0x36')]=qs[_0x43e2('0x36')](_0x38c345[_0x43e2('0x4d')]['offset']);}_0x334691[_0x43e2('0x56')]=qs['sort'](_0x38c345[_0x43e2('0x4d')][_0x43e2('0x57')]);_0x334691[_0x43e2('0x58')]=qs[_0x43e2('0x4e')](_[_0x43e2('0x59')](_0x38c345['query'],_0x20178e[_0x43e2('0x4e')]));_0x334691['where'][_0x43e2('0xbe')]=_0x5a8da1['id'];if(_0x38c345['query'][_0x43e2('0x94')]){_0x334691[_0x43e2('0x58')]=_[_0x43e2('0xc5')](_0x334691[_0x43e2('0x58')],{'$or':_[_0x43e2('0x40')](_0x334691[_0x43e2('0x51')],function(_0x32bda0){var _0x3efe1c={};_0x3efe1c[_0x32bda0]={'$like':'%'+_0x38c345[_0x43e2('0x4d')]['filter']+'%'};return _0x3efe1c;})});}if(_0x38c345[_0x43e2('0x4d')]['$gte']){var _0x5d1f54=_0x38c345[_0x43e2('0x4d')][_0x43e2('0x88')][_0x43e2('0x43')](',');var _0x548484={};_0x548484[_0x5d1f54[0x0]]={'$gte':moment(_0x5d1f54[0x1])[_0x43e2('0xec')](_0x43e2('0x10b'))};_0x334691[_0x43e2('0x58')]=_[_0x43e2('0xc5')](_0x334691[_0x43e2('0x58')],_0x548484);}_0x334691=_[_0x43e2('0xc5')]({},_0x334691,_0x38c345['options']);return db['ChatMessage'][_0x43e2('0x35')]({'where':_0x334691[_0x43e2('0x58')]})[_0x43e2('0x25')](function(_0x20a3dd){_0x150ba7['count']=_0x20a3dd;if(_0x38c345['query']['includeAll']){_0x334691[_0x43e2('0xc4')]=[{'all':!![]}];}return db['ChatMessage'][_0x43e2('0x10c')](_0x334691);})[_0x43e2('0x25')](function(_0x320697){_0x150ba7[_0x43e2('0xc0')]=_0x320697;return _0x150ba7;});}})[_0x43e2('0x25')](respondWithFilteredResult(_0xbc6c86,_0x334691))[_0x43e2('0x30')](handleError(_0xbc6c86,null));};exports[_0x43e2('0x10d')]=function(_0x442bd6,_0x5de479,_0x37308e){var _0x5efc84={'where':{}},_0x1665b5={},_0x3c1a73={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x43e2('0xcb')]({'where':{'id':_0x442bd6[_0x43e2('0xc2')]['id']}})['then'](handleEntityNotFound(_0x5de479,null))[_0x43e2('0x25')](function(_0x551c01){if(_0x551c01){_0x1665b5[_0x43e2('0x4c')]=_['keys'](db[_0x43e2('0xe9')][_0x43e2('0x48')]);_0x1665b5[_0x43e2('0x4d')]=_[_0x43e2('0x81')](_0x442bd6[_0x43e2('0x4d')]);_0x1665b5[_0x43e2('0x4e')]=_['intersection'](_0x1665b5[_0x43e2('0x4c')],_0x1665b5[_0x43e2('0x4d')]);_0x5efc84[_0x43e2('0x51')]=_['intersection'](_0x1665b5[_0x43e2('0x4c')],qs['fields'](_0x442bd6['query'][_0x43e2('0x50')]));_0x5efc84[_0x43e2('0x51')]=_0x5efc84[_0x43e2('0x51')][_0x43e2('0x52')]?_0x5efc84[_0x43e2('0x51')]:_0x1665b5[_0x43e2('0x4c')];if(!_0x442bd6[_0x43e2('0x4d')][_0x43e2('0x53')](_0x43e2('0x54'))){_0x5efc84[_0x43e2('0x55')]=qs[_0x43e2('0x55')](_0x442bd6[_0x43e2('0x4d')][_0x43e2('0x55')]);_0x5efc84[_0x43e2('0x36')]=qs[_0x43e2('0x36')](_0x442bd6['query']['offset']);}_0x5efc84['order']=qs[_0x43e2('0x57')](_0x442bd6[_0x43e2('0x4d')][_0x43e2('0x57')]);_0x5efc84[_0x43e2('0x58')]=qs[_0x43e2('0x4e')](_[_0x43e2('0x59')](_0x442bd6['query'],_0x1665b5[_0x43e2('0x4e')]));_0x5efc84[_0x43e2('0x58')][_0x43e2('0xbe')]=_0x551c01['id'];if(_0x442bd6[_0x43e2('0x4d')][_0x43e2('0x94')]){_0x5efc84[_0x43e2('0x58')]=_[_0x43e2('0xc5')](_0x5efc84[_0x43e2('0x58')],{'$or':_['map'](_0x5efc84[_0x43e2('0x51')],function(_0x506003){var _0x5d8aab={};_0x5d8aab[_0x506003]={'$like':'%'+_0x442bd6['query']['filter']+'%'};return _0x5d8aab;})});}_0x5efc84['where'][_0x43e2('0xf9')]=![];if(_0x442bd6[_0x43e2('0x4d')]['id']){_0x5efc84['where']['id']={'$gt':_0x442bd6['query']['id']};}_0x5efc84=_[_0x43e2('0xc5')]({},_0x5efc84,_0x442bd6[_0x43e2('0xc6')]);return db[_0x43e2('0xe9')][_0x43e2('0x35')]({'where':_0x5efc84[_0x43e2('0x58')]})['then'](function(_0x130db8){_0x3c1a73[_0x43e2('0x35')]=_0x130db8;_0x5efc84[_0x43e2('0xc4')]=[];if(_0x442bd6['query']['includeAgent']){_0x5efc84[_0x43e2('0xc4')][_0x43e2('0x45')]({'model':db[_0x43e2('0x7d')],'as':_0x43e2('0x7d'),'attributes':['id',_0x43e2('0xf4'),'alias']});}if(_0x442bd6[_0x43e2('0x4d')][_0x43e2('0xc3')]){_0x5efc84[_0x43e2('0xc4')]=[{'all':!![]}];}return db[_0x43e2('0xe9')][_0x43e2('0x10c')](_0x5efc84);})[_0x43e2('0x25')](function(_0x17a69d){_0x3c1a73[_0x43e2('0xc0')]=_0x17a69d;return _0x3c1a73;});}})['then'](respondWithFilteredResult(_0x5de479,_0x5efc84))[_0x43e2('0x30')](handleError(_0x5de479,null));};exports[_0x43e2('0x10e')]=function(_0x296446,_0x222e3c,_0x1b2903){return db[_0x43e2('0x47')]['find']({'where':{'id':_0x296446[_0x43e2('0xc2')]['id']}})[_0x43e2('0x25')](handleEntityNotFound(_0x222e3c,null))[_0x43e2('0x25')](function(_0x21ae6e){if(_0x21ae6e){return _0x21ae6e[_0x43e2('0x10f')](_0x296446[_0x43e2('0xc8')][_0x43e2('0x108')],_['omit'](_0x296446[_0x43e2('0xc8')],[_0x43e2('0x108'),'id'])||{})[_0x43e2('0x110')](function(){return db[_0x43e2('0x7b')][_0x43e2('0x10c')]({'attributes':['id',_0x43e2('0x3e'),_0x43e2('0x111')],'where':{'id':_0x296446[_0x43e2('0xc8')][_0x43e2('0x108')]}});})[_0x43e2('0x25')](function(_0x2243ed){socket['emit'](_0x43e2('0x112'),{'id':Number(_0x296446[_0x43e2('0xc2')]['id']),'tags':_0x2243ed||[]});return{'id':Number(_0x296446[_0x43e2('0xc2')]['id']),'tags':_0x2243ed||[]};});}})['then'](respondWithResult(_0x222e3c,null))['catch'](handleError(_0x222e3c,null));};exports['removeTags']=function(_0x3ce34d,_0x5ea329,_0xe5079e){return db[_0x43e2('0x47')][_0x43e2('0x78')]({'where':{'id':_0x3ce34d[_0x43e2('0xc2')]['id']}})['then'](handleEntityNotFound(_0x5ea329,null))['then'](function(_0x4f465c){if(_0x4f465c){return _0x4f465c[_0x43e2('0x113')](_0x3ce34d[_0x43e2('0x4d')][_0x43e2('0x108')]);}})[_0x43e2('0x25')](respondWithStatusCode(_0x5ea329,null))[_0x43e2('0x30')](handleError(_0x5ea329,null));};exports[_0x43e2('0x114')]=function(_0x4a7e0e,_0x329a17){var _0x46a216=moment()[_0x43e2('0x115')]()['toString']();var _0x4ac2d7=path[_0x43e2('0xe5')](config[_0x43e2('0x116')],_0x43e2('0x117'),_0x43e2('0x118'),_0x43e2('0x119'));var _0x409285=path[_0x43e2('0xe5')](config[_0x43e2('0x116')],_0x43e2('0x117'),_0x43e2('0x118'),'attachments');var _0x349a0d=path[_0x43e2('0xe5')](_0x4ac2d7,_0x46a216);var _0x3168a4=util[_0x43e2('0xec')](_0x43e2('0x11a'),_0x4a7e0e[_0x43e2('0xc2')]['id'],_0x46a216);var _0x331669=path[_0x43e2('0xe5')](_0x4ac2d7,_0x3168a4);var _0x1e6a42=[];_0x1e6a42[_0x43e2('0x45')]({'model':db['User'],'as':_0x43e2('0x7d'),'attributes':['id',_0x43e2('0xf4')],'raw':!![]});_0x1e6a42[_0x43e2('0x45')]({'model':db[_0x43e2('0xeb')],'as':_0x43e2('0x72'),'attributes':['id','firstName',_0x43e2('0x11b')],'raw':!![]});if(_0x4a7e0e[_0x43e2('0x4d')][_0x43e2('0x11c')]){_0x1e6a42[_0x43e2('0x45')]({'model':db[_0x43e2('0xdf')],'as':_0x43e2('0xdf'),'raw':!![]});}var _0x20de62=[{'model':db['ChatMessage'],'as':_0x43e2('0xea'),'attributes':['id',_0x43e2('0xc8'),_0x43e2('0x87'),_0x43e2('0xf8'),_0x43e2('0xf9'),_0x43e2('0x8f')],'include':_0x1e6a42}];_0x20de62[_0x43e2('0x45')]({'model':db['ChatWebsite'],'as':'Account','attributes':['id',_0x43e2('0x3e')]});_0x20de62['push']({'model':db['User'],'as':_0x43e2('0x11d'),'attributes':['id',_0x43e2('0xf4')]});return db['ChatInteraction'][_0x43e2('0x78')]({'where':{'id':_0x4a7e0e[_0x43e2('0xc2')]['id']},'include':_0x20de62})[_0x43e2('0x25')](handleEntityNotFound(_0x329a17,null))['then'](function(_0x4c8a2d){if(_0x4c8a2d){var _0x2d01b0=_0x4c8a2d['get']({'plain':!![]});fs[_0x43e2('0x11e')](_0x349a0d);var _0x21cfc5={'format':'A4','border':_0x43e2('0x11f'),'header':{'height':_0x43e2('0x120'),'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':_0x43e2('0x121'),'contents':{'default':util[_0x43e2('0xec')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\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[_0x43e2('0xec')](_0x43e2('0x122'),_0x43e2('0x123'),_0x2d01b0['id']),moment()['format'](_0x43e2('0x124'))[_0x43e2('0xa8')]())}}};var _0x542eed={'channel':_0x43e2('0x123'),'account':_0x2d01b0['Account'][_0x43e2('0x3e')],'agent':_0x2d01b0[_0x43e2('0x11d')]?_0x2d01b0[_0x43e2('0x11d')][_0x43e2('0xf4')]:_0x43e2('0x125'),'createdAt':moment(_0x2d01b0['createdAt'])[_0x43e2('0xec')](_0x43e2('0x10b'))['toString'](),'closedAt':_0x2d01b0[_0x43e2('0xd8')]?moment(_0x2d01b0[_0x43e2('0x126')])[_0x43e2('0xec')]('YYYY-MM-DD\x20HH:mm:ss')[_0x43e2('0xa8')]():'','disposition':_0x2d01b0[_0x43e2('0x127')],'chatInfo':{'browser':_0x2d01b0['browserName'],'os':_0x2d01b0['osName'],'referer':_0x2d01b0[_0x43e2('0x128')],'customerIp':_0x2d01b0['customerIp'],'customerPort':_0x2d01b0['customerPort']?_0x2d01b0[_0x43e2('0x129')]:_0x43e2('0x125')},'messages':_(_0x2d01b0[_0x43e2('0xea')])[_0x43e2('0x12a')]()['filter']({'secret':![]})[_0x43e2('0x40')](function(_0x2526b6){if(_0x2526b6[_0x43e2('0xdf')]){var _0x9ff938=path[_0x43e2('0xe5')](_0x409285,_0x2526b6[_0x43e2('0xdf')][_0x43e2('0xdd')]);if(fs['existsSync'](_0x9ff938)){fs[_0x43e2('0x12b')](_0x9ff938)[_0x43e2('0x12c')](fs['createWriteStream'](path[_0x43e2('0xe5')](_0x349a0d,_0x2526b6[_0x43e2('0xdf')]['basename'])));}}return{'date':moment(_0x2526b6['createdAt'])[_0x43e2('0xec')](_0x43e2('0x10b'))['toString'](),'sender':_0x2526b6[_0x43e2('0xf8')]==='out'?_0x2526b6[_0x43e2('0x7d')]?_0x2526b6[_0x43e2('0x7d')][_0x43e2('0xf4')]:_0x43e2('0xef'):_0x2526b6[_0x43e2('0x72')][_0x43e2('0x12d')]+(_0x2526b6[_0x43e2('0x72')]['lastName']?'\x20'+_0x2526b6[_0x43e2('0x72')][_0x43e2('0x11b')]:''),'body':_0x2526b6[_0x43e2('0xdf')]?_0x2526b6['Attachment'][_0x43e2('0xdd')]:_0x2526b6[_0x43e2('0xc8')],'direction':_0x2526b6[_0x43e2('0xf8')]==='out'?'A':'C','secret':_0x2526b6['secret'],'read':_0x2526b6[_0x43e2('0x8f')],'attachment':_0x2526b6[_0x43e2('0xdf')]};})['value']()};return ejs['renderFile'](path['join'](config[_0x43e2('0x116')],_0x43e2('0x117'),'views',_0x43e2('0x12e')),{'interaction':_0x542eed})[_0x43e2('0x25')](function(_0x51e319){return new BPromise(function(_0x3619b1,_0x499731){pdf[_0x43e2('0xc7')](_0x51e319,_0x21cfc5)['toFile'](path['join'](_0x349a0d,_0x43e2('0x12f')+_0x2d01b0['id']+'-'+_0x46a216+_0x43e2('0x130')),function(_0x541375,_0x4bef3d){if(_0x541375)return _0x499731(_0x541375);_0x3619b1(_0x4bef3d);});});})[_0x43e2('0x25')](function(){return new BPromise(function(_0x12caa1,_0x2259c4){zipdir(_0x349a0d,{'saveTo':_0x331669},function(_0xd4b657,_0x497e28){if(_0xd4b657)return _0x2259c4(_0xd4b657);return _0x12caa1(_0x497e28);});})[_0x43e2('0x25')](function(){return new BPromise(function(_0x9d6261,_0x10d54c){rimraf(_0x349a0d,function(_0x3a6984){if(_0x3a6984)_0x10d54c(_0x3a6984);return _0x9d6261();});});})[_0x43e2('0x25')](function(){return _0x329a17['download'](_0x331669,_0x3168a4,function(_0x309d5e){if(_0x309d5e){console[_0x43e2('0x131')](_0x43e2('0x132'),_0x309d5e);}else{fs[_0x43e2('0x133')](_0x331669);}});});});}else{return _0x329a17[_0x43e2('0x31')](0xc8);}})[_0x43e2('0x30')](handleError(_0x329a17,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 49053dc..ca69133 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 _0xbe52=['hasOwnProperty','hook','exports','events','ChatInteraction','../../mysqldb','ChatMessage','setMaxListeners','update','remove','setDataValue','Users','map','findAll','then','emit'];(function(_0x8cd627,_0x1bf5ca){var _0x7e454=function(_0x562038){while(--_0x562038){_0x8cd627['push'](_0x8cd627['shift']());}};_0x7e454(++_0x1bf5ca);}(_0xbe52,0x133));var _0x2be5=function(_0x1c9a26,_0x5867dc){_0x1c9a26=_0x1c9a26-0x0;var _0x41a520=_0xbe52[_0x1c9a26];return _0x41a520;};'use strict';var EventEmitter=require(_0x2be5('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x2be5('0x1')];var ChatMessage=require(_0x2be5('0x2'))['db'][_0x2be5('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x2be5('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2be5('0x5'),'afterDestroy':_0x2be5('0x6')};function emitEvent(_0x1e0db1){return function(_0x438a7d,_0x345695,_0x5df3d4){_0x438a7d['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x4998d0){_0x438a7d[_0x2be5('0x7')](_0x2be5('0x8'),_0x4998d0[_0x2be5('0x9')](function(_0x4d1794){return{'id':_0x4d1794['id']};}));return ChatMessage[_0x2be5('0xa')]({'where':{'ChatInteractionId':_0x438a7d['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2be5('0xb')](function(_0x3e6932){_0x438a7d[_0x2be5('0x7')]('unreadMessages',_0x3e6932['length']);ChatInteractionEvents[_0x2be5('0xc')](_0x1e0db1+':'+_0x438a7d['id'],_0x438a7d);ChatInteractionEvents[_0x2be5('0xc')](_0x1e0db1,_0x438a7d);_0x5df3d4(null);})['catch'](_0x5df3d4(null));};}for(var e in events){if(events[_0x2be5('0xd')](e)){var event=events[e];ChatInteraction[_0x2be5('0xe')](e,emitEvent(event));}}module[_0x2be5('0xf')]=ChatInteractionEvents; \ No newline at end of file +var _0x7e3b=['../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','getUsers','Users','map','findAll','setDataValue','unreadMessages','length','emit','catch','hook','exports'];(function(_0x29d623,_0x1a5c9c){var _0x242e59=function(_0x2c78ab){while(--_0x2c78ab){_0x29d623['push'](_0x29d623['shift']());}};_0x242e59(++_0x1a5c9c);}(_0x7e3b,0xd8));var _0xb7e3=function(_0x514fe1,_0x1acbdf){_0x514fe1=_0x514fe1-0x0;var _0x547476=_0x7e3b[_0x514fe1];return _0x547476;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0xb7e3('0x0'))['db'][_0xb7e3('0x1')];var ChatMessage=require(_0xb7e3('0x0'))['db'][_0xb7e3('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xb7e3('0x3')](0x0);var events={'afterCreate':_0xb7e3('0x4'),'afterUpdate':_0xb7e3('0x5'),'afterDestroy':_0xb7e3('0x6')};function emitEvent(_0x55fa19){return function(_0x120010,_0x4c68f8,_0xbbb50c){_0x120010[_0xb7e3('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x192b06){_0x120010['setDataValue'](_0xb7e3('0x8'),_0x192b06[_0xb7e3('0x9')](function(_0x525af1){return{'id':_0x525af1['id']};}));return ChatMessage[_0xb7e3('0xa')]({'where':{'ChatInteractionId':_0x120010['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x30c404){_0x120010[_0xb7e3('0xb')](_0xb7e3('0xc'),_0x30c404[_0xb7e3('0xd')]);ChatInteractionEvents[_0xb7e3('0xe')](_0x55fa19+':'+_0x120010['id'],_0x120010);ChatInteractionEvents[_0xb7e3('0xe')](_0x55fa19,_0x120010);_0xbbb50c(null);})[_0xb7e3('0xf')](_0xbbb50c(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0xb7e3('0x10')](e,emitEvent(event));}}module[_0xb7e3('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 7a4f382..c741258 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 _0xd9fd=['lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','exports','define','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci'];(function(_0x4b8708,_0x444304){var _0x15170b=function(_0x2da153){while(--_0x2da153){_0x4b8708['push'](_0x4b8708['shift']());}};_0x15170b(++_0x444304);}(_0xd9fd,0x140));var _0xdd9f=function(_0x286003,_0x31d2d4){_0x286003=_0x286003-0x0;var _0x83ffb6=_0xd9fd[_0x286003];return _0x83ffb6;};'use strict';var _=require(_0xdd9f('0x0'));var util=require(_0xdd9f('0x1'));var logger=require('../../config/logger')(_0xdd9f('0x2'));var moment=require('moment');var BPromise=require(_0xdd9f('0x3'));var rp=require(_0xdd9f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdd9f('0x5'));var config=require(_0xdd9f('0x6'));var attributes=require('./chatInteraction.attributes');module[_0xdd9f('0x7')]=function(_0x212d17,_0x2261f5){return _0x212d17[_0xdd9f('0x8')]('ChatInteraction',attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4a493c,_0x48a450,_0x9bd6cd){if(_0x4a493c[_0xdd9f('0x9')](_0xdd9f('0xa'))){_0x4a493c[_0xdd9f('0xb')]=moment()[_0xdd9f('0xc')](_0xdd9f('0xd'));}_0x9bd6cd(null,_0x4a493c);}},'charset':_0xdd9f('0xe'),'collate':_0xdd9f('0xf')});}; \ No newline at end of file +var _0x6279=['chat_interactions','closedAt','format','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction'];(function(_0x3b422e,_0x232e34){var _0x3d5c7e=function(_0x1fa901){while(--_0x1fa901){_0x3b422e['push'](_0x3b422e['shift']());}};_0x3d5c7e(++_0x232e34);}(_0x6279,0x114));var _0x9627=function(_0xdff763,_0x477c10){_0xdff763=_0xdff763-0x0;var _0x99390e=_0x6279[_0xdff763];return _0x99390e;};'use strict';var _=require(_0x9627('0x0'));var util=require(_0x9627('0x1'));var logger=require(_0x9627('0x2'))(_0x9627('0x3'));var moment=require(_0x9627('0x4'));var BPromise=require(_0x9627('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9627('0x6'));var rimraf=require(_0x9627('0x7'));var config=require(_0x9627('0x8'));var attributes=require(_0x9627('0x9'));module[_0x9627('0xa')]=function(_0x3f5802,_0x45a916){return _0x3f5802[_0x9627('0xb')](_0x9627('0xc'),attributes,{'tableName':_0x9627('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1138af,_0x5e4dbe,_0x3394f9){if(_0x1138af['changed']('closed')){_0x1138af[_0x9627('0xe')]=moment()[_0x9627('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3394f9(null,_0x1138af);}},'charset':'utf8mb4','collate':_0x9627('0x10')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 017c095..3da0e28 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 _0x20d6=['jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','AddTagsToChatInteraction','find','then','addTags','ids','spread','AddTags','lodash','util','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x4656fe,_0xf16c21){var _0x156907=function(_0x455d2a){while(--_0x455d2a){_0x4656fe['push'](_0x4656fe['shift']());}};_0x156907(++_0xf16c21);}(_0x20d6,0xea));var _0x620d=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x20d6[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x620d('0x0'));var util=require(_0x620d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x620d('0x2'))['db'];var utils=require(_0x620d('0x3'));var logger=require(_0x620d('0x4'))('rpc');var config=require(_0x620d('0x5'));var jayson=require(_0x620d('0x6'));var client=jayson[_0x620d('0x7')]['http']({'port':0x232a});config[_0x620d('0x8')]=_[_0x620d('0x9')](config[_0x620d('0x8')],{'host':_0x620d('0xa'),'port':0x18eb});var socket=require(_0x620d('0xb'))(new Redis(config[_0x620d('0x8')]));require(_0x620d('0xc'))[_0x620d('0xd')](socket);function respondWithRpcPromise(_0xfc529,_0xc98470,_0x4e54c0){return new BPromise(function(_0x527585,_0x1ec1b1){return client[_0x620d('0xe')](_0xfc529,_0x4e54c0)['then'](function(_0x11ced6){logger[_0x620d('0xf')](_0x620d('0x10'),_0xc98470,_0x620d('0x11'));logger[_0x620d('0x12')](_0x620d('0x13'),_0xc98470,_0x620d('0x11'),JSON[_0x620d('0x14')](_0x11ced6));if(_0x11ced6[_0x620d('0x15')]){if(_0x11ced6[_0x620d('0x15')]['code']===0x1f4){logger[_0x620d('0x15')](_0x620d('0x10'),_0xc98470,_0x11ced6[_0x620d('0x15')][_0x620d('0x16')]);return _0x1ec1b1(_0x11ced6[_0x620d('0x15')][_0x620d('0x16')]);}logger[_0x620d('0x15')]('ChatInteraction,\x20%s,\x20%s',_0xc98470,_0x11ced6[_0x620d('0x15')][_0x620d('0x16')]);return _0x527585(_0x11ced6['error'][_0x620d('0x16')]);}else{logger[_0x620d('0xf')](_0x620d('0x10'),_0xc98470,'request\x20sent');_0x527585(_0x11ced6[_0x620d('0x17')]['message']);}})[_0x620d('0x18')](function(_0x216a92){logger[_0x620d('0x15')]('ChatInteraction,\x20%s,\x20%s',_0xc98470,_0x216a92);_0x1ec1b1(_0x216a92);});});}exports[_0x620d('0x19')]=function(_0x1590ff){var _0x13ec66=this;return new Promise(function(_0x8c98f5,_0x3ca25f){return db[_0x620d('0x1a')][_0x620d('0x1b')](_0x1590ff[_0x620d('0x1c')],{'raw':_0x1590ff[_0x620d('0x1d')]?_0x1590ff[_0x620d('0x1d')][_0x620d('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1590ff['options']?_0x1590ff[_0x620d('0x1d')][_0x620d('0x1f')]||null:null,'attributes':_0x1590ff['options']?_0x1590ff[_0x620d('0x1d')][_0x620d('0x20')]||null:null,'limit':_0x1590ff['options']?_0x1590ff[_0x620d('0x1d')]['limit']||null:null})['then'](function(_0x3505e4){logger[_0x620d('0xf')]('UpdateChatInteraction',_0x1590ff);logger[_0x620d('0x12')](_0x620d('0x19'),_0x1590ff,JSON[_0x620d('0x14')](_0x3505e4));_0x8c98f5(_0x3505e4);})[_0x620d('0x18')](function(_0x54e779){logger[_0x620d('0x15')](_0x620d('0x19'),_0x54e779[_0x620d('0x16')],_0x1590ff);_0x3ca25f(_0x13ec66['error'](0x1f4,_0x54e779[_0x620d('0x16')]));});});};exports[_0x620d('0x21')]=function(_0x7786f7){return new Promise(function(_0x2d6412,_0x4b730d){return db[_0x620d('0x1a')][_0x620d('0x22')]({'where':_0x7786f7[_0x620d('0x1d')]?_0x7786f7[_0x620d('0x1d')][_0x620d('0x1f')]||null:null})[_0x620d('0x23')](function(_0xcc06f4){if(_0xcc06f4){return _0xcc06f4[_0x620d('0x24')](_0x7786f7['body']['ids'],_['omit'](_0x7786f7[_0x620d('0x1c')],[_0x620d('0x25'),'id'])||{});}})[_0x620d('0x26')](function(_0x46a01a){logger[_0x620d('0xf')](_0x620d('0x27'),_0x7786f7);logger[_0x620d('0x12')](_0x620d('0x27'),_0x7786f7,JSON['stringify'](_0x46a01a));_0x2d6412(_0x46a01a);})[_0x620d('0x18')](function(_0xb527a4){logger[_0x620d('0x15')](_0x620d('0x27'),_0xb527a4[_0x620d('0x16')],_0x7786f7);_0x4b730d(_this[_0x620d('0x15')](0x1f4,_0xb527a4['message']));});});}; \ No newline at end of file +var _0xc642=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./chatInteraction.socket','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','limit','AddTagsToChatInteraction','find','addTags','ids','omit','spread','AddTags','moment','bluebird','randomstring'];(function(_0x181cbd,_0x46c41d){var _0x4c27a9=function(_0x1a3525){while(--_0x1a3525){_0x181cbd['push'](_0x181cbd['shift']());}};_0x4c27a9(++_0x46c41d);}(_0xc642,0x7e));var _0x2c64=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xc642[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2c64('0x0'));var BPromise=require(_0x2c64('0x1'));var rs=require(_0x2c64('0x2'));var fs=require('fs');var Redis=require(_0x2c64('0x3'));var db=require(_0x2c64('0x4'))['db'];var utils=require(_0x2c64('0x5'));var logger=require(_0x2c64('0x6'))(_0x2c64('0x7'));var config=require(_0x2c64('0x8'));var jayson=require(_0x2c64('0x9'));var client=jayson[_0x2c64('0xa')][_0x2c64('0xb')]({'port':0x232a});config['redis']=_[_0x2c64('0xc')](config[_0x2c64('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x2c64('0xe'))(new Redis(config['redis']));require(_0x2c64('0xf'))['register'](socket);function respondWithRpcPromise(_0x2a9ed4,_0x80d56,_0x291bc9){return new BPromise(function(_0x379e9e,_0x27492e){return client[_0x2c64('0x10')](_0x2a9ed4,_0x291bc9)[_0x2c64('0x11')](function(_0x353b93){logger[_0x2c64('0x12')](_0x2c64('0x13'),_0x80d56,_0x2c64('0x14'));logger[_0x2c64('0x15')](_0x2c64('0x16'),_0x80d56,_0x2c64('0x14'),JSON[_0x2c64('0x17')](_0x353b93));if(_0x353b93[_0x2c64('0x18')]){if(_0x353b93[_0x2c64('0x18')]['code']===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x80d56,_0x353b93[_0x2c64('0x18')]['message']);return _0x27492e(_0x353b93[_0x2c64('0x18')]['message']);}logger['error'](_0x2c64('0x13'),_0x80d56,_0x353b93[_0x2c64('0x18')][_0x2c64('0x19')]);return _0x379e9e(_0x353b93[_0x2c64('0x18')][_0x2c64('0x19')]);}else{logger[_0x2c64('0x12')](_0x2c64('0x13'),_0x80d56,_0x2c64('0x14'));_0x379e9e(_0x353b93['result'][_0x2c64('0x19')]);}})[_0x2c64('0x1a')](function(_0xb94f80){logger[_0x2c64('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x80d56,_0xb94f80);_0x27492e(_0xb94f80);});});}exports[_0x2c64('0x1b')]=function(_0x362d5a){var _0x417073=this;return new Promise(function(_0x1e18ec,_0x249b12){return db[_0x2c64('0x1c')][_0x2c64('0x1d')](_0x362d5a[_0x2c64('0x1e')],{'raw':_0x362d5a[_0x2c64('0x1f')]?_0x362d5a[_0x2c64('0x1f')][_0x2c64('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x362d5a[_0x2c64('0x1f')]?_0x362d5a[_0x2c64('0x1f')][_0x2c64('0x21')]||null:null,'attributes':_0x362d5a[_0x2c64('0x1f')]?_0x362d5a[_0x2c64('0x1f')][_0x2c64('0x22')]||null:null,'limit':_0x362d5a[_0x2c64('0x1f')]?_0x362d5a[_0x2c64('0x1f')][_0x2c64('0x23')]||null:null})['then'](function(_0x3fe5c0){logger['info'](_0x2c64('0x1b'),_0x362d5a);logger[_0x2c64('0x15')](_0x2c64('0x1b'),_0x362d5a,JSON[_0x2c64('0x17')](_0x3fe5c0));_0x1e18ec(_0x3fe5c0);})[_0x2c64('0x1a')](function(_0x1dd89c){logger[_0x2c64('0x18')](_0x2c64('0x1b'),_0x1dd89c[_0x2c64('0x19')],_0x362d5a);_0x249b12(_0x417073[_0x2c64('0x18')](0x1f4,_0x1dd89c['message']));});});};exports[_0x2c64('0x24')]=function(_0x572afb){return new Promise(function(_0x33a37e,_0x46c419){return db[_0x2c64('0x1c')][_0x2c64('0x25')]({'where':_0x572afb[_0x2c64('0x1f')]?_0x572afb[_0x2c64('0x1f')][_0x2c64('0x21')]||null:null})[_0x2c64('0x11')](function(_0x4ac22c){if(_0x4ac22c){return _0x4ac22c[_0x2c64('0x26')](_0x572afb[_0x2c64('0x1e')][_0x2c64('0x27')],_[_0x2c64('0x28')](_0x572afb[_0x2c64('0x1e')],[_0x2c64('0x27'),'id'])||{});}})[_0x2c64('0x29')](function(_0x52624c){logger[_0x2c64('0x12')](_0x2c64('0x2a'),_0x572afb);logger['debug'](_0x2c64('0x2a'),_0x572afb,JSON[_0x2c64('0x17')](_0x52624c));_0x33a37e(_0x52624c);})[_0x2c64('0x1a')](function(_0x141cc8){logger[_0x2c64('0x18')](_0x2c64('0x2a'),_0x141cc8[_0x2c64('0x19')],_0x572afb);_0x46c419(_this[_0x2c64('0x18')](0x1f4,_0x141cc8[_0x2c64('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index d37eca7..7273bf9 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 _0xd876=['removeListener','register','chatInteraction:','./chatInteraction.events','remove','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd876,0x11b));var _0x6d87=function(_0x4f55a8,_0x4794c6){_0x4f55a8=_0x4f55a8-0x0;var _0xaf1d53=_0xd876[_0x4f55a8];return _0xaf1d53;};'use strict';var ChatInteractionEvents=require(_0x6d87('0x0'));var events=['save',_0x6d87('0x1'),_0x6d87('0x2')];function createListener(_0x508948,_0x5a48b0){return function(_0x2263fd){_0x5a48b0[_0x6d87('0x3')](_0x508948,_0x2263fd);};}function removeListener(_0x3d239a,_0x3e4359){return function(){ChatInteractionEvents[_0x6d87('0x4')](_0x3d239a,_0x3e4359);};}exports[_0x6d87('0x5')]=function(_0xfafc2c){for(var _0xabcbe6=0x0,_0x444971=events['length'];_0xabcbe6<_0x444971;_0xabcbe6++){var _0x561107=events[_0xabcbe6];var _0x45c084=createListener(_0x6d87('0x6')+_0x561107,_0xfafc2c);ChatInteractionEvents['on'](_0x561107,_0x45c084);}}; \ No newline at end of file +var _0x15f7=['save','remove','emit','removeListener','register','chatInteraction:'];(function(_0x79ebc5,_0x2df5d1){var _0x3813b6=function(_0x4e2769){while(--_0x4e2769){_0x79ebc5['push'](_0x79ebc5['shift']());}};_0x3813b6(++_0x2df5d1);}(_0x15f7,0xea));var _0x715f=function(_0x12b449,_0x2b8a36){_0x12b449=_0x12b449-0x0;var _0x4e3784=_0x15f7[_0x12b449];return _0x4e3784;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x715f('0x0'),_0x715f('0x1'),'update'];function createListener(_0x2fee3f,_0xb70201){return function(_0xc14c49){_0xb70201[_0x715f('0x2')](_0x2fee3f,_0xc14c49);};}function removeListener(_0x118e5b,_0x4ddefa){return function(){ChatInteractionEvents[_0x715f('0x3')](_0x118e5b,_0x4ddefa);};}exports[_0x715f('0x4')]=function(_0x38ac93){for(var _0x4d75bb=0x0,_0x3152b6=events['length'];_0x4d75bb<_0x3152b6;_0x4d75bb++){var _0x455c0b=events[_0x4d75bb];var _0x1f69df=createListener(_0x715f('0x5')+_0x455c0b,_0x38ac93);ChatInteractionEvents['on'](_0x455c0b,_0x1f69df);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 6210dea..067d7d3 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 _0x9a1b=['/describe','describe','/:id','isChatInteractionAuthorized','show','attachmentDownload','/:id/messages','isAuthenticated','getMessages','/:id/my_messages','/:id/download','download','create','post','createVidaooSession','diskStorage','join','server/files/attachments/','format','now','originalname','replace','attachmentUpload','addMessage','tracked','chat','chatinteraction:addtags','addTags','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','put','/:id/close','close','delete','chatinteraction:destroy','/:id/tags','removeTags','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','get','index'];(function(_0x506623,_0x4cd325){var _0x26ddea=function(_0x3af4ab){while(--_0x3af4ab){_0x506623['push'](_0x506623['shift']());}};_0x26ddea(++_0x4cd325);}(_0x9a1b,0x1ba));var _0xb9a1=function(_0x529435,_0x1ef68f){_0x529435=_0x529435-0x0;var _0x563242=_0x9a1b[_0x529435];return _0x563242;};'use strict';var multer=require(_0xb9a1('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb9a1('0x1'));var router=express[_0xb9a1('0x2')]();var auth=require(_0xb9a1('0x3'));var interaction=require(_0xb9a1('0x4'));var config=require('../../config/environment');var controller=require(_0xb9a1('0x5'));router[_0xb9a1('0x6')]('/',auth['isAuthenticated'](),controller[_0xb9a1('0x7')]);router[_0xb9a1('0x6')](_0xb9a1('0x8'),auth['isAuthenticated'](),controller[_0xb9a1('0x9')]);router[_0xb9a1('0x6')](_0xb9a1('0xa'),auth[_0xb9a1('0xb')](),controller[_0xb9a1('0xc')]);router['get']('/:id/attachment_download',auth[_0xb9a1('0xb')](),controller[_0xb9a1('0xd')]);router[_0xb9a1('0x6')](_0xb9a1('0xe'),auth[_0xb9a1('0xf')](),controller[_0xb9a1('0x10')]);router[_0xb9a1('0x6')](_0xb9a1('0x11'),auth['isChatInteractionAuthorized'](),controller['getMyMessages']);router[_0xb9a1('0x6')](_0xb9a1('0x12'),auth['isAuthenticated'](),controller[_0xb9a1('0x13')]);router['post']('/',auth[_0xb9a1('0xf')](),controller[_0xb9a1('0x14')]);router[_0xb9a1('0x15')]('/:id/vidaoo',auth[_0xb9a1('0xf')](),controller[_0xb9a1('0x16')]);var upload=multer({'storage':multer[_0xb9a1('0x17')]({'destination':function(_0x4de0d8,_0x304c9c,_0x46e3a9){_0x46e3a9(null,path[_0xb9a1('0x18')](config['root'],_0xb9a1('0x19')));},'filename':function(_0x4096fb,_0x4e9037,_0xb95bd3){_0xb95bd3(null,util[_0xb9a1('0x1a')]('%s-%s',Date[_0xb9a1('0x1b')](),_0x4e9037[_0xb9a1('0x1c')][_0xb9a1('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xb9a1('0x15')]('/:id/attachment_upload',upload['single']('file'),controller[_0xb9a1('0x1e')]);router[_0xb9a1('0x15')]('/:id/messages',auth['isChatInteractionAuthorized'](),controller[_0xb9a1('0x1f')]);router[_0xb9a1('0x15')]('/:id/tags',auth[_0xb9a1('0xf')](),interaction[_0xb9a1('0x20')](_0xb9a1('0x21'),_0xb9a1('0x22')),controller[_0xb9a1('0x23')]);router['put']('/:id',auth[_0xb9a1('0xf')](),interaction[_0xb9a1('0x20')](_0xb9a1('0x21'),_0xb9a1('0x24')),controller[_0xb9a1('0x25')]);router['put'](_0xb9a1('0x26'),controller[_0xb9a1('0x27')]);router['put'](_0xb9a1('0x28'),auth[_0xb9a1('0xb')](),controller[_0xb9a1('0x29')]);router[_0xb9a1('0x2a')](_0xb9a1('0x2b'),controller[_0xb9a1('0x2c')]);router[_0xb9a1('0x2d')](_0xb9a1('0xa'),auth['isAuthenticated'](),interaction['tracked'](_0xb9a1('0x21'),_0xb9a1('0x2e')),controller['destroy']);router[_0xb9a1('0x2d')](_0xb9a1('0x2f'),auth[_0xb9a1('0xf')](),controller[_0xb9a1('0x30')]);module[_0xb9a1('0x31')]=router; \ No newline at end of file +var _0xdef9=['abandon','close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','/:id/download','download','create','post','/:id/vidaoo','createVidaooSession','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','attachmentUpload','addMessage','tracked','chat','addTags','update','/:id/custom_update','customUpdate','/:id/abandon'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdef9,0x1ed));var _0x9def=function(_0x2fb87c,_0x2dee49){_0x2fb87c=_0x2fb87c-0x0;var _0x43038b=_0xdef9[_0x2fb87c];return _0x43038b;};'use strict';var multer=require(_0x9def('0x0'));var util=require(_0x9def('0x1'));var path=require(_0x9def('0x2'));var timeout=require(_0x9def('0x3'));var express=require(_0x9def('0x4'));var router=express[_0x9def('0x5')]();var auth=require(_0x9def('0x6'));var interaction=require(_0x9def('0x7'));var config=require(_0x9def('0x8'));var controller=require(_0x9def('0x9'));router[_0x9def('0xa')]('/',auth[_0x9def('0xb')](),controller[_0x9def('0xc')]);router[_0x9def('0xa')](_0x9def('0xd'),auth[_0x9def('0xb')](),controller[_0x9def('0xe')]);router[_0x9def('0xa')](_0x9def('0xf'),auth['isChatInteractionAuthorized'](),controller[_0x9def('0x10')]);router['get']('/:id/attachment_download',auth[_0x9def('0x11')](),controller[_0x9def('0x12')]);router[_0x9def('0xa')](_0x9def('0x13'),auth['isAuthenticated'](),controller[_0x9def('0x14')]);router[_0x9def('0xa')](_0x9def('0x15'),auth[_0x9def('0x11')](),controller['getMyMessages']);router[_0x9def('0xa')](_0x9def('0x16'),auth['isAuthenticated'](),controller[_0x9def('0x17')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9def('0x18')]);router[_0x9def('0x19')](_0x9def('0x1a'),auth['isAuthenticated'](),controller[_0x9def('0x1b')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4c4ea4,_0x2d3604,_0x29dce4){_0x29dce4(null,path[_0x9def('0x1c')](config[_0x9def('0x1d')],_0x9def('0x1e')));},'filename':function(_0x269dc1,_0x162e7e,_0x39687f){_0x39687f(null,util[_0x9def('0x1f')](_0x9def('0x20'),Date[_0x9def('0x21')](),_0x162e7e[_0x9def('0x22')][_0x9def('0x23')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x9def('0x24'),upload[_0x9def('0x25')]('file'),controller[_0x9def('0x26')]);router['post'](_0x9def('0x13'),auth['isChatInteractionAuthorized'](),controller[_0x9def('0x27')]);router[_0x9def('0x19')]('/:id/tags',auth[_0x9def('0xb')](),interaction[_0x9def('0x28')](_0x9def('0x29'),'chatinteraction:addtags'),controller[_0x9def('0x2a')]);router['put'](_0x9def('0xf'),auth[_0x9def('0xb')](),interaction[_0x9def('0x28')](_0x9def('0x29'),'chatinteraction:update'),controller[_0x9def('0x2b')]);router['put'](_0x9def('0x2c'),controller[_0x9def('0x2d')]);router['put'](_0x9def('0x2e'),auth[_0x9def('0x11')](),controller[_0x9def('0x2f')]);router['put']('/:id/close',controller[_0x9def('0x30')]);router[_0x9def('0x31')](_0x9def('0xf'),auth[_0x9def('0xb')](),interaction['tracked'](_0x9def('0x29'),_0x9def('0x32')),controller[_0x9def('0x33')]);router[_0x9def('0x31')]('/:id/tags',auth['isAuthenticated'](),controller[_0x9def('0x34')]);module[_0x9def('0x35')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 00e4b22..a85c7c2 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 _0x5f66=['exports','medium','BOOLEAN','INTEGER'];(function(_0x51e987,_0x36a435){var _0x284ad7=function(_0x153af7){while(--_0x153af7){_0x51e987['push'](_0x51e987['shift']());}};_0x284ad7(++_0x36a435);}(_0x5f66,0x1a0));var _0x65f6=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x5f66[_0x122096];return _0x3d1966;};'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 +var _0x5f66=['exports','medium','BOOLEAN','INTEGER'];(function(_0x14a2a7,_0x25b938){var _0x3d351a=function(_0x1deca0){while(--_0x1deca0){_0x14a2a7['push'](_0x14a2a7['shift']());}};_0x3d351a(++_0x25b938);}(_0x5f66,0x1a0));var _0x65f6=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5f66[_0x19e35c];return _0x3e1fe8;};'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 2eff50d..c7b054b 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 _0x9df2=['VoiceQueues','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId','autoAssociation','isEmpty','agent','resourceId','push','messages','read','-createdAt','all','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','then','index','map','rawAttributes','type','key','model','name','query','keys','attributes','fields','order','sort','where','filters','filter','VIRTUAL','merge','options','ChatInternalMessage','includeAll','include','findAll','rows','catch','show','params','intersection','length','find','create','body','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','admin','user','role','internal','online','allowmessenger','-online'];(function(_0x30cc1a,_0x162bbc){var _0xb3f18f=function(_0x26bdfe){while(--_0x26bdfe){_0x30cc1a['push'](_0x30cc1a['shift']());}};_0xb3f18f(++_0x162bbc);}(_0x9df2,0x140));var _0x29df=function(_0x4169a6,_0x29386e){_0x4169a6=_0x4169a6-0x0;var _0x2a25b4=_0x9df2[_0x4169a6];return _0x2a25b4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x29df('0x0'));var rimraf=require(_0x29df('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x29df('0x2'));var rp=require('request-promise');var moment=require(_0x29df('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x29df('0x4'));var util=require(_0x29df('0x5'));var path=require(_0x29df('0x6'));var sox=require(_0x29df('0x7'));var csv=require(_0x29df('0x8'));var ejs=require(_0x29df('0x9'));var fs=require('fs');var _=require(_0x29df('0xa'));var squel=require(_0x29df('0xb'));var crypto=require(_0x29df('0xc'));var jsforce=require(_0x29df('0xd'));var deskjs=require(_0x29df('0xe'));var toCsv=require(_0x29df('0x8'));var querystring=require(_0x29df('0xf'));var Papa=require(_0x29df('0x10'));var Redis=require(_0x29df('0x11'));var authService=require(_0x29df('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x29df('0x13'));var hardwareService=require(_0x29df('0x14'));var logger=require(_0x29df('0x15'))('api');var utils=require(_0x29df('0x16'));var config=require(_0x29df('0x17'));var db=require(_0x29df('0x18'))['db'];config[_0x29df('0x19')]=_['defaults'](config[_0x29df('0x19')],{'host':_0x29df('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x29df('0x19')]));require('./chatInternalMessage.socket')[_0x29df('0x1b')](socket);function respondWithStatusCode(_0x3578a9,_0x45e809){_0x45e809=_0x45e809||0xcc;return function(_0x3b5e92){if(_0x3b5e92){return _0x3578a9[_0x29df('0x1c')](_0x45e809);}return _0x3578a9['status'](_0x45e809)[_0x29df('0x1d')]();};}function respondWithResult(_0x4188d0,_0x15d3b0){_0x15d3b0=_0x15d3b0||0xc8;return function(_0x26a132){if(_0x26a132){return _0x4188d0[_0x29df('0x1e')](_0x15d3b0)[_0x29df('0x1f')](_0x26a132);}};}function respondWithFilteredResult(_0x49b2b8,_0x129ebc){return function(_0x5ba127){if(_0x5ba127){var _0x53e99f=_0x5ba127[_0x29df('0x20')],_0x6fa1e1=_0x129ebc[_0x29df('0x21')],_0xc955f2=_0x129ebc[_0x29df('0x21')]+_0x129ebc[_0x29df('0x22')],_0x594d31;if(_0xc955f2>=_0x53e99f){_0xc955f2=_0x53e99f;_0x594d31=0xc8;}else{_0x594d31=0xce;}_0x49b2b8[_0x29df('0x1e')](_0x594d31);return _0x49b2b8[_0x29df('0x23')](_0x29df('0x24'),_0x6fa1e1+'-'+_0xc955f2+'/'+_0x53e99f)[_0x29df('0x1f')](_0x5ba127);}return null;};}function patchUpdates(_0x48b92d){return function(_0x5ce6ce){try{jsonpatch['apply'](_0x5ce6ce,_0x48b92d,!![]);}catch(_0x467050){return BPromise[_0x29df('0x25')](_0x467050);}return _0x5ce6ce[_0x29df('0x26')]();};}function saveUpdates(_0x4d5a3e,_0x502177){return function(_0x188c91){if(_0x188c91){return _0x188c91[_0x29df('0x27')](_0x4d5a3e)['then'](function(_0x415027){return _0x415027;});}return null;};}function removeEntity(_0x243178,_0x9e181){return function(_0x120547){if(_0x120547){return _0x120547[_0x29df('0x28')]()[_0x29df('0x29')](function(){_0x243178['status'](0xcc)[_0x29df('0x1d')]();});}};}function handleEntityNotFound(_0xb1a89f,_0x47a31e){return function(_0xd4bddc){if(!_0xd4bddc){_0xb1a89f[_0x29df('0x1c')](0x194);}return _0xd4bddc;};}function handleError(_0x7c15dc,_0x9e6d1b){_0x9e6d1b=_0x9e6d1b||0x1f4;return function(_0x349d19){logger['error'](_0x349d19['stack']);if(_0x349d19['name']){delete _0x349d19['name'];}_0x7c15dc[_0x29df('0x1e')](_0x9e6d1b)['send'](_0x349d19);};}exports[_0x29df('0x2a')]=function(_0x40bf7a,_0x361283){var _0x4d1222={},_0x28bc3f={},_0x31c809={'count':0x0,'rows':[]};var _0x309b89=_[_0x29df('0x2b')](db['ChatInternalMessage'][_0x29df('0x2c')],function(_0x309889){return{'name':_0x309889['fieldName'],'type':_0x309889[_0x29df('0x2d')][_0x29df('0x2e')]};});_0x28bc3f[_0x29df('0x2f')]=_[_0x29df('0x2b')](_0x309b89,_0x29df('0x30'));_0x28bc3f[_0x29df('0x31')]=_[_0x29df('0x32')](_0x40bf7a[_0x29df('0x31')]);_0x28bc3f['filters']=_['intersection'](_0x28bc3f[_0x29df('0x2f')],_0x28bc3f['query']);_0x4d1222[_0x29df('0x33')]=_['intersection'](_0x28bc3f['model'],qs['fields'](_0x40bf7a[_0x29df('0x31')][_0x29df('0x34')]));_0x4d1222[_0x29df('0x33')]=_0x4d1222[_0x29df('0x33')]['length']?_0x4d1222[_0x29df('0x33')]:_0x28bc3f[_0x29df('0x2f')];if(!_0x40bf7a[_0x29df('0x31')]['hasOwnProperty']('nolimit')){_0x4d1222[_0x29df('0x22')]=qs[_0x29df('0x22')](_0x40bf7a['query'][_0x29df('0x22')]);_0x4d1222[_0x29df('0x21')]=qs[_0x29df('0x21')](_0x40bf7a[_0x29df('0x31')]['offset']);}_0x4d1222[_0x29df('0x35')]=qs[_0x29df('0x36')](_0x40bf7a['query'][_0x29df('0x36')]);_0x4d1222[_0x29df('0x37')]=qs[_0x29df('0x38')](_['pick'](_0x40bf7a[_0x29df('0x31')],_0x28bc3f[_0x29df('0x38')]),_0x309b89);if(_0x40bf7a[_0x29df('0x31')][_0x29df('0x39')]){_0x4d1222[_0x29df('0x37')]=_['merge'](_0x4d1222[_0x29df('0x37')],{'$or':_[_0x29df('0x2b')](_0x309b89,function(_0x252ff9){if(_0x252ff9['type']!==_0x29df('0x3a')){var _0x4b1774={};_0x4b1774[_0x252ff9['name']]={'$like':'%'+_0x40bf7a[_0x29df('0x31')][_0x29df('0x39')]+'%'};return _0x4b1774;}})});}_0x4d1222=_[_0x29df('0x3b')]({},_0x4d1222,_0x40bf7a[_0x29df('0x3c')]);var _0x2b3aba={'where':_0x4d1222[_0x29df('0x37')]};return db[_0x29df('0x3d')][_0x29df('0x20')](_0x2b3aba)['then'](function(_0x76c3b){_0x31c809[_0x29df('0x20')]=_0x76c3b;if(_0x40bf7a[_0x29df('0x31')][_0x29df('0x3e')]){_0x4d1222[_0x29df('0x3f')]=[{'all':!![]}];}return db[_0x29df('0x3d')][_0x29df('0x40')](_0x4d1222);})[_0x29df('0x29')](function(_0x2d1acc){_0x31c809[_0x29df('0x41')]=_0x2d1acc;return _0x31c809;})[_0x29df('0x29')](respondWithFilteredResult(_0x361283,_0x4d1222))[_0x29df('0x42')](handleError(_0x361283,null));};exports[_0x29df('0x43')]=function(_0x200842,_0x304577){var _0x22c077={'raw':!![],'where':{'id':_0x200842[_0x29df('0x44')]['id']}},_0x5d16e1={};_0x5d16e1[_0x29df('0x2f')]=_[_0x29df('0x32')](db['ChatInternalMessage']['rawAttributes']);_0x5d16e1[_0x29df('0x31')]=_[_0x29df('0x32')](_0x200842[_0x29df('0x31')]);_0x5d16e1[_0x29df('0x38')]=_[_0x29df('0x45')](_0x5d16e1[_0x29df('0x2f')],_0x5d16e1[_0x29df('0x31')]);_0x22c077[_0x29df('0x33')]=_[_0x29df('0x45')](_0x5d16e1[_0x29df('0x2f')],qs['fields'](_0x200842[_0x29df('0x31')][_0x29df('0x34')]));_0x22c077['attributes']=_0x22c077[_0x29df('0x33')][_0x29df('0x46')]?_0x22c077[_0x29df('0x33')]:_0x5d16e1['model'];if(_0x200842['query']['includeAll']){_0x22c077['include']=[{'all':!![]}];}_0x22c077=_['merge']({},_0x22c077,_0x200842[_0x29df('0x3c')]);return db['ChatInternalMessage'][_0x29df('0x47')](_0x22c077)[_0x29df('0x29')](handleEntityNotFound(_0x304577,null))[_0x29df('0x29')](respondWithResult(_0x304577,null))[_0x29df('0x42')](handleError(_0x304577,null));};exports[_0x29df('0x48')]=function(_0x9b78a3,_0x2deb74){return db[_0x29df('0x3d')][_0x29df('0x48')](_0x9b78a3[_0x29df('0x49')],{})[_0x29df('0x29')](respondWithResult(_0x2deb74,0xc9))[_0x29df('0x42')](handleError(_0x2deb74,null));};exports['update']=function(_0x9ef364,_0x4b7e75){if(_0x9ef364['body']['id']){delete _0x9ef364[_0x29df('0x49')]['id'];}return db[_0x29df('0x3d')][_0x29df('0x47')]({'where':{'id':_0x9ef364[_0x29df('0x44')]['id']}})[_0x29df('0x29')](handleEntityNotFound(_0x4b7e75,null))[_0x29df('0x29')](saveUpdates(_0x9ef364['body'],null))[_0x29df('0x29')](respondWithResult(_0x4b7e75,null))[_0x29df('0x42')](handleError(_0x4b7e75,null));};exports['destroy']=function(_0x12db9d,_0x28a8f0){return db['ChatInternalMessage'][_0x29df('0x47')]({'where':{'id':_0x12db9d['params']['id']}})[_0x29df('0x29')](handleEntityNotFound(_0x28a8f0,null))[_0x29df('0x29')](removeEntity(_0x28a8f0,null))['catch'](handleError(_0x28a8f0,null));};exports['describe']=function(_0x505437,_0x404a83){return db['ChatInternalMessage']['describe']()[_0x29df('0x29')](respondWithResult(_0x404a83,null))[_0x29df('0x42')](handleError(_0x404a83,null));};function wrapUser(_0x3238d1){return function(_0x16bfe4){var _0x554b40=_0x3238d1['get']({'plain':!![]});_0x554b40['messages']=[];if(_0x16bfe4){_0x554b40[_0x29df('0x4a')]=_0x16bfe4[_0x29df('0x4b')];_0x554b40[_0x29df('0x4c')]=_0x16bfe4;}else{_0x554b40[_0x29df('0x4a')]=moment(0x0)[_0x29df('0x4d')](_0x29df('0x4e'));_0x554b40[_0x29df('0x4c')]={};}return _0x554b40;};}exports[_0x29df('0x4f')]=function(_0x5aa4de,_0x358613,_0x1c3605){var _0x2912c3=[];return db[_0x29df('0x50')][_0x29df('0x40')]({'where':{'role':['agent',_0x29df('0x51'),_0x29df('0x52')]},'attributes':['id','fullname','name',_0x29df('0x53'),'userpic',_0x29df('0x54'),_0x29df('0x55'),'lastLoginAt',_0x29df('0x56'),'showWebBar'],'order':qs['sort'](_0x29df('0x57')),'include':[{'model':db['VoiceQueue'],'as':_0x29df('0x58'),'attributes':['id','name',_0x29df('0x2d')],'through':{'attributes':[]}}]})[_0x29df('0x29')](function(_0x33f372){if(_0x33f372){var _0x40d2bf=_0x5aa4de[_0x29df('0x52')][_0x29df('0x59')]({'plain':!![]});if(!_0x40d2bf)throw new Error(_0x29df('0x5a'));if(_0x40d2bf[_0x29df('0x53')]===_0x29df('0x52')){return db['UserProfileSection'][_0x29df('0x47')]({'where':{'name':_0x29df('0x5b'),'userProfileId':_0x40d2bf[_0x29df('0x5c')]},'raw':!![]})['then'](function(_0x73093d){if(_0x73093d){if(_0x73093d[_0x29df('0x5d')]===0x0){return db['UserProfileResource'][_0x29df('0x40')]({'where':{'sectionId':_0x73093d['id']},'raw':!![]})[_0x29df('0x29')](function(_0x2bb87d){var _0x1f1d6f=[];if(_[_0x29df('0x5e')](_0x2bb87d)){_0x1f1d6f=_[_0x29df('0x39')](_0x33f372,function(_0x3adde6){if(_0x3adde6[_0x29df('0x53')]!=='agent'){return _0x3adde6;}});return _0x1f1d6f;}else{for(var _0x1f646a=0x0;_0x1f646a<_0x33f372['length'];_0x1f646a++){var _0xae548a=_0x33f372[_0x1f646a];if(_0xae548a[_0x29df('0x53')]===_0x29df('0x5f')){var _0x374129=_[_0x29df('0x47')](_0x2bb87d,function(_0x543ae2){return _0x543ae2[_0x29df('0x60')]===_0xae548a['id'];});if(_0x374129)_0x1f1d6f[_0x29df('0x61')](_0xae548a);}else{_0x1f1d6f['push'](_0xae548a);}}return _0x1f1d6f;}});}else{return _0x33f372;}}else{var _0x229a2d=_[_0x29df('0x39')](_0x33f372,function(_0x7789ca){if(_0x7789ca[_0x29df('0x53')]!==_0x29df('0x5f')){return _0x7789ca;}});return _0x229a2d;}});}else{return _0x33f372;}}})[_0x29df('0x29')](function(_0x408fe3){var _0x414373=[];if(_0x408fe3){_0x2912c3=_0x408fe3;for(var _0x42bd05=0x0;_0x42bd05<_0x408fe3['length'];_0x42bd05+=0x1){_0x2912c3[_0x42bd05][_0x29df('0x62')]=[];_0x414373['push'](db[_0x29df('0x3d')]['find']({'where':{'FromId':[_0x5aa4de[_0x29df('0x52')]['id'],_0x408fe3[_0x42bd05]['id']],'ToId':[_0x5aa4de[_0x29df('0x52')]['id'],_0x408fe3[_0x42bd05]['id']],'ChatGroupId':null},'attributes':['id',_0x29df('0x4b'),'FromId','ToId',_0x29df('0x63'),_0x29df('0x49')],'order':qs[_0x29df('0x36')](_0x29df('0x64')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x29df('0x29')](wrapUser(_0x408fe3[_0x42bd05])));}return BPromise[_0x29df('0x65')](_0x414373);}return[];})['then'](function(_0x16e380){return{'rows':_0x16e380,'count':_0x16e380['length']};})[_0x29df('0x29')](respondWithResult(_0x358613,null))[_0x29df('0x42')](handleError(_0x358613,null));}; \ No newline at end of file +var _0x65bc=['squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','then','destroy','error','stack','name','map','ChatInternalMessage','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId','UserProfileResource','isEmpty','resourceId','push','FromId','read','-createdAt','all','eml-format','rimraf','bluebird','mustache','util','path','ejs','lodash'];(function(_0x2fa95e,_0x197a9f){var _0x142212=function(_0x3b6e7a){while(--_0x3b6e7a){_0x2fa95e['push'](_0x2fa95e['shift']());}};_0x142212(++_0x197a9f);}(_0x65bc,0x64));var _0xc65b=function(_0x593f81,_0x298a1d){_0x593f81=_0x593f81-0x0;var _0xad3655=_0x65bc[_0x593f81];return _0xad3655;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc65b('0x0'));var rimraf=require(_0xc65b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc65b('0x2'));var Mustache=require(_0xc65b('0x3'));var util=require(_0xc65b('0x4'));var path=require(_0xc65b('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc65b('0x6'));var fs=require('fs');var _=require(_0xc65b('0x7'));var squel=require(_0xc65b('0x8'));var crypto=require('crypto');var jsforce=require(_0xc65b('0x9'));var deskjs=require(_0xc65b('0xa'));var toCsv=require(_0xc65b('0xb'));var querystring=require(_0xc65b('0xc'));var Papa=require(_0xc65b('0xd'));var Redis=require(_0xc65b('0xe'));var authService=require(_0xc65b('0xf'));var qs=require(_0xc65b('0x10'));var as=require(_0xc65b('0x11'));var hardwareService=require(_0xc65b('0x12'));var logger=require(_0xc65b('0x13'))(_0xc65b('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xc65b('0x15'))['db'];config[_0xc65b('0x16')]=_['defaults'](config[_0xc65b('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xc65b('0x17'))(new Redis(config[_0xc65b('0x16')]));require(_0xc65b('0x18'))[_0xc65b('0x19')](socket);function respondWithStatusCode(_0x3cf26b,_0x29150d){_0x29150d=_0x29150d||0xcc;return function(_0x275a95){if(_0x275a95){return _0x3cf26b[_0xc65b('0x1a')](_0x29150d);}return _0x3cf26b[_0xc65b('0x1b')](_0x29150d)[_0xc65b('0x1c')]();};}function respondWithResult(_0x3ee83a,_0x47637f){_0x47637f=_0x47637f||0xc8;return function(_0x8ded67){if(_0x8ded67){return _0x3ee83a[_0xc65b('0x1b')](_0x47637f)['json'](_0x8ded67);}};}function respondWithFilteredResult(_0x4f6c0a,_0x5d338f){return function(_0x1e4a7a){if(_0x1e4a7a){var _0x1aea76=_0x1e4a7a[_0xc65b('0x1d')],_0x48d2fe=_0x5d338f[_0xc65b('0x1e')],_0x46a68f=_0x5d338f[_0xc65b('0x1e')]+_0x5d338f[_0xc65b('0x1f')],_0x2f2b4c;if(_0x46a68f>=_0x1aea76){_0x46a68f=_0x1aea76;_0x2f2b4c=0xc8;}else{_0x2f2b4c=0xce;}_0x4f6c0a[_0xc65b('0x1b')](_0x2f2b4c);return _0x4f6c0a[_0xc65b('0x20')]('Content-Range',_0x48d2fe+'-'+_0x46a68f+'/'+_0x1aea76)[_0xc65b('0x21')](_0x1e4a7a);}return null;};}function patchUpdates(_0x43555b){return function(_0x1424db){try{jsonpatch[_0xc65b('0x22')](_0x1424db,_0x43555b,!![]);}catch(_0x317b40){return BPromise[_0xc65b('0x23')](_0x317b40);}return _0x1424db[_0xc65b('0x24')]();};}function saveUpdates(_0x3e846c,_0x197699){return function(_0x2a2233){if(_0x2a2233){return _0x2a2233[_0xc65b('0x25')](_0x3e846c)[_0xc65b('0x26')](function(_0x2a12bf){return _0x2a12bf;});}return null;};}function removeEntity(_0xfc8d2c,_0x279b31){return function(_0xd07cea){if(_0xd07cea){return _0xd07cea[_0xc65b('0x27')]()[_0xc65b('0x26')](function(){_0xfc8d2c[_0xc65b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f0a27,_0x3d742a){return function(_0x23e418){if(!_0x23e418){_0x5f0a27['sendStatus'](0x194);}return _0x23e418;};}function handleError(_0x2a200a,_0x273d1b){_0x273d1b=_0x273d1b||0x1f4;return function(_0xa0f68e){logger[_0xc65b('0x28')](_0xa0f68e[_0xc65b('0x29')]);if(_0xa0f68e[_0xc65b('0x2a')]){delete _0xa0f68e[_0xc65b('0x2a')];}_0x2a200a[_0xc65b('0x1b')](_0x273d1b)['send'](_0xa0f68e);};}exports['index']=function(_0x3b0f67,_0x1436d5){var _0x32e81={},_0x42e598={},_0xb2c54b={'count':0x0,'rows':[]};var _0x11c117=_[_0xc65b('0x2b')](db[_0xc65b('0x2c')]['rawAttributes'],function(_0x4fc729){return{'name':_0x4fc729[_0xc65b('0x2d')],'type':_0x4fc729[_0xc65b('0x2e')][_0xc65b('0x2f')]};});_0x42e598[_0xc65b('0x30')]=_[_0xc65b('0x2b')](_0x11c117,'name');_0x42e598[_0xc65b('0x31')]=_[_0xc65b('0x32')](_0x3b0f67[_0xc65b('0x31')]);_0x42e598[_0xc65b('0x33')]=_[_0xc65b('0x34')](_0x42e598['model'],_0x42e598[_0xc65b('0x31')]);_0x32e81['attributes']=_[_0xc65b('0x34')](_0x42e598[_0xc65b('0x30')],qs[_0xc65b('0x35')](_0x3b0f67[_0xc65b('0x31')][_0xc65b('0x35')]));_0x32e81[_0xc65b('0x36')]=_0x32e81['attributes'][_0xc65b('0x37')]?_0x32e81[_0xc65b('0x36')]:_0x42e598[_0xc65b('0x30')];if(!_0x3b0f67[_0xc65b('0x31')][_0xc65b('0x38')]('nolimit')){_0x32e81[_0xc65b('0x1f')]=qs[_0xc65b('0x1f')](_0x3b0f67[_0xc65b('0x31')][_0xc65b('0x1f')]);_0x32e81[_0xc65b('0x1e')]=qs[_0xc65b('0x1e')](_0x3b0f67['query'][_0xc65b('0x1e')]);}_0x32e81['order']=qs[_0xc65b('0x39')](_0x3b0f67[_0xc65b('0x31')][_0xc65b('0x39')]);_0x32e81[_0xc65b('0x3a')]=qs[_0xc65b('0x33')](_[_0xc65b('0x3b')](_0x3b0f67[_0xc65b('0x31')],_0x42e598['filters']),_0x11c117);if(_0x3b0f67[_0xc65b('0x31')][_0xc65b('0x3c')]){_0x32e81[_0xc65b('0x3a')]=_['merge'](_0x32e81[_0xc65b('0x3a')],{'$or':_[_0xc65b('0x2b')](_0x11c117,function(_0x357e89){if(_0x357e89['type']!==_0xc65b('0x3d')){var _0xc106f7={};_0xc106f7[_0x357e89[_0xc65b('0x2a')]]={'$like':'%'+_0x3b0f67['query'][_0xc65b('0x3c')]+'%'};return _0xc106f7;}})});}_0x32e81=_[_0xc65b('0x3e')]({},_0x32e81,_0x3b0f67[_0xc65b('0x3f')]);var _0x9cb0a1={'where':_0x32e81[_0xc65b('0x3a')]};return db['ChatInternalMessage']['count'](_0x9cb0a1)[_0xc65b('0x26')](function(_0x480793){_0xb2c54b['count']=_0x480793;if(_0x3b0f67['query'][_0xc65b('0x40')]){_0x32e81['include']=[{'all':!![]}];}return db[_0xc65b('0x2c')][_0xc65b('0x41')](_0x32e81);})[_0xc65b('0x26')](function(_0x2b2928){_0xb2c54b[_0xc65b('0x42')]=_0x2b2928;return _0xb2c54b;})[_0xc65b('0x26')](respondWithFilteredResult(_0x1436d5,_0x32e81))[_0xc65b('0x43')](handleError(_0x1436d5,null));};exports[_0xc65b('0x44')]=function(_0x1831ce,_0x588704){var _0x26e933={'raw':!![],'where':{'id':_0x1831ce[_0xc65b('0x45')]['id']}},_0x4afd0d={};_0x4afd0d['model']=_[_0xc65b('0x32')](db['ChatInternalMessage'][_0xc65b('0x46')]);_0x4afd0d[_0xc65b('0x31')]=_[_0xc65b('0x32')](_0x1831ce['query']);_0x4afd0d[_0xc65b('0x33')]=_[_0xc65b('0x34')](_0x4afd0d[_0xc65b('0x30')],_0x4afd0d[_0xc65b('0x31')]);_0x26e933[_0xc65b('0x36')]=_[_0xc65b('0x34')](_0x4afd0d[_0xc65b('0x30')],qs[_0xc65b('0x35')](_0x1831ce[_0xc65b('0x31')][_0xc65b('0x35')]));_0x26e933[_0xc65b('0x36')]=_0x26e933[_0xc65b('0x36')][_0xc65b('0x37')]?_0x26e933['attributes']:_0x4afd0d[_0xc65b('0x30')];if(_0x1831ce[_0xc65b('0x31')]['includeAll']){_0x26e933[_0xc65b('0x47')]=[{'all':!![]}];}_0x26e933=_[_0xc65b('0x3e')]({},_0x26e933,_0x1831ce[_0xc65b('0x3f')]);return db[_0xc65b('0x2c')][_0xc65b('0x48')](_0x26e933)[_0xc65b('0x26')](handleEntityNotFound(_0x588704,null))['then'](respondWithResult(_0x588704,null))[_0xc65b('0x43')](handleError(_0x588704,null));};exports[_0xc65b('0x49')]=function(_0x2d9403,_0x49fdb4){return db[_0xc65b('0x2c')]['create'](_0x2d9403[_0xc65b('0x4a')],{})['then'](respondWithResult(_0x49fdb4,0xc9))['catch'](handleError(_0x49fdb4,null));};exports['update']=function(_0x1dc7f6,_0x35795d){if(_0x1dc7f6['body']['id']){delete _0x1dc7f6['body']['id'];}return db[_0xc65b('0x2c')][_0xc65b('0x48')]({'where':{'id':_0x1dc7f6['params']['id']}})[_0xc65b('0x26')](handleEntityNotFound(_0x35795d,null))[_0xc65b('0x26')](saveUpdates(_0x1dc7f6[_0xc65b('0x4a')],null))[_0xc65b('0x26')](respondWithResult(_0x35795d,null))['catch'](handleError(_0x35795d,null));};exports[_0xc65b('0x27')]=function(_0x4b8367,_0x77f233){return db[_0xc65b('0x2c')][_0xc65b('0x48')]({'where':{'id':_0x4b8367[_0xc65b('0x45')]['id']}})[_0xc65b('0x26')](handleEntityNotFound(_0x77f233,null))['then'](removeEntity(_0x77f233,null))[_0xc65b('0x43')](handleError(_0x77f233,null));};exports[_0xc65b('0x4b')]=function(_0x323c3d,_0x24ad3f){return db[_0xc65b('0x2c')][_0xc65b('0x4b')]()['then'](respondWithResult(_0x24ad3f,null))[_0xc65b('0x43')](handleError(_0x24ad3f,null));};function wrapUser(_0x17575e){return function(_0x57cf29){var _0x467075=_0x17575e[_0xc65b('0x4c')]({'plain':!![]});_0x467075[_0xc65b('0x4d')]=[];if(_0x57cf29){_0x467075[_0xc65b('0x4e')]=_0x57cf29[_0xc65b('0x4f')];_0x467075[_0xc65b('0x50')]=_0x57cf29;}else{_0x467075[_0xc65b('0x4e')]=moment(0x0)[_0xc65b('0x51')](_0xc65b('0x52'));_0x467075[_0xc65b('0x50')]={};}return _0x467075;};}exports[_0xc65b('0x53')]=function(_0x25911b,_0x425361,_0x59b6b4){var _0x30f205=[];return db[_0xc65b('0x54')][_0xc65b('0x41')]({'where':{'role':[_0xc65b('0x55'),_0xc65b('0x56'),_0xc65b('0x57')]},'attributes':['id','fullname',_0xc65b('0x2a'),_0xc65b('0x58'),_0xc65b('0x59'),_0xc65b('0x5a'),_0xc65b('0x5b'),_0xc65b('0x5c'),_0xc65b('0x5d'),_0xc65b('0x5e')],'order':qs[_0xc65b('0x39')](_0xc65b('0x5f')),'include':[{'model':db[_0xc65b('0x60')],'as':'VoiceQueues','attributes':['id',_0xc65b('0x2a'),_0xc65b('0x2e')],'through':{'attributes':[]}}]})[_0xc65b('0x26')](function(_0x1fbfbe){if(_0x1fbfbe){var _0x57538d=_0x25911b['user'][_0xc65b('0x4c')]({'plain':!![]});if(!_0x57538d)throw new Error(_0xc65b('0x61'));if(_0x57538d[_0xc65b('0x58')]==='user'){return db['UserProfileSection']['find']({'where':{'name':_0xc65b('0x62'),'userProfileId':_0x57538d[_0xc65b('0x63')]},'raw':!![]})['then'](function(_0x3a026b){if(_0x3a026b){if(_0x3a026b['autoAssociation']===0x0){return db[_0xc65b('0x64')]['findAll']({'where':{'sectionId':_0x3a026b['id']},'raw':!![]})[_0xc65b('0x26')](function(_0x196097){var _0x2283df=[];if(_[_0xc65b('0x65')](_0x196097)){_0x2283df=_[_0xc65b('0x3c')](_0x1fbfbe,function(_0x3f51b5){if(_0x3f51b5['role']!==_0xc65b('0x55')){return _0x3f51b5;}});return _0x2283df;}else{for(var _0x5592c0=0x0;_0x5592c0<_0x1fbfbe[_0xc65b('0x37')];_0x5592c0++){var _0x2a0008=_0x1fbfbe[_0x5592c0];if(_0x2a0008['role']===_0xc65b('0x55')){var _0x1987d1=_[_0xc65b('0x48')](_0x196097,function(_0x4c2fc4){return _0x4c2fc4[_0xc65b('0x66')]===_0x2a0008['id'];});if(_0x1987d1)_0x2283df[_0xc65b('0x67')](_0x2a0008);}else{_0x2283df[_0xc65b('0x67')](_0x2a0008);}}return _0x2283df;}});}else{return _0x1fbfbe;}}else{var _0x11a755=_[_0xc65b('0x3c')](_0x1fbfbe,function(_0x5b22c1){if(_0x5b22c1['role']!==_0xc65b('0x55')){return _0x5b22c1;}});return _0x11a755;}});}else{return _0x1fbfbe;}}})[_0xc65b('0x26')](function(_0x195d63){var _0x11638a=[];if(_0x195d63){_0x30f205=_0x195d63;for(var _0x245bb4=0x0;_0x245bb4<_0x195d63[_0xc65b('0x37')];_0x245bb4+=0x1){_0x30f205[_0x245bb4][_0xc65b('0x4d')]=[];_0x11638a[_0xc65b('0x67')](db[_0xc65b('0x2c')][_0xc65b('0x48')]({'where':{'FromId':[_0x25911b[_0xc65b('0x57')]['id'],_0x195d63[_0x245bb4]['id']],'ToId':[_0x25911b['user']['id'],_0x195d63[_0x245bb4]['id']],'ChatGroupId':null},'attributes':['id',_0xc65b('0x4f'),_0xc65b('0x68'),'ToId',_0xc65b('0x69'),'body'],'order':qs[_0xc65b('0x39')](_0xc65b('0x6a')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xc65b('0x26')](wrapUser(_0x195d63[_0x245bb4])));}return BPromise[_0xc65b('0x6b')](_0x11638a);}return[];})[_0xc65b('0x26')](function(_0x4206df){return{'rows':_0x4206df,'count':_0x4206df['length']};})['then'](respondWithResult(_0x425361,null))[_0xc65b('0x43')](handleError(_0x425361,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 9709a0f..952ecf5 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 _0xee39=['events','../../mysqldb','ChatInternalMessage','save','update','remove','emit','hasOwnProperty','exports'];(function(_0xc32bee,_0x123ef6){var _0xf5ccf5=function(_0x2a8438){while(--_0x2a8438){_0xc32bee['push'](_0xc32bee['shift']());}};_0xf5ccf5(++_0x123ef6);}(_0xee39,0x1e6));var _0x9ee3=function(_0x2d37a8,_0x18c29d){_0x2d37a8=_0x2d37a8-0x0;var _0x9f247c=_0xee39[_0x2d37a8];return _0x9f247c;};'use strict';var EventEmitter=require(_0x9ee3('0x0'));var ChatInternalMessage=require(_0x9ee3('0x1'))['db'][_0x9ee3('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9ee3('0x3'),'afterUpdate':_0x9ee3('0x4'),'afterDestroy':_0x9ee3('0x5')};function emitEvent(_0x3cdeaf){return function(_0x2724c7,_0x3a556a,_0x3398c6){ChatInternalMessageEvents[_0x9ee3('0x6')](_0x3cdeaf+':'+_0x2724c7['id'],_0x2724c7);ChatInternalMessageEvents[_0x9ee3('0x6')](_0x3cdeaf,_0x2724c7);_0x3398c6(null);};}for(var e in events){if(events[_0x9ee3('0x7')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x9ee3('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x603f=['save','remove','hasOwnProperty','hook','exports','events','ChatInternalMessage','setMaxListeners'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0x603f,0x65));var _0xf603=function(_0x1fc0b3,_0x26d07f){_0x1fc0b3=_0x1fc0b3-0x0;var _0x1a0358=_0x603f[_0x1fc0b3];return _0x1a0358;};'use strict';var EventEmitter=require(_0xf603('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0xf603('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xf603('0x2')](0x0);var events={'afterCreate':_0xf603('0x3'),'afterUpdate':'update','afterDestroy':_0xf603('0x4')};function emitEvent(_0x43d9c6){return function(_0x4dfc9a,_0x2566e8,_0x468c1b){ChatInternalMessageEvents['emit'](_0x43d9c6+':'+_0x4dfc9a['id'],_0x4dfc9a);ChatInternalMessageEvents['emit'](_0x43d9c6,_0x4dfc9a);_0x468c1b(null);};}for(var e in events){if(events[_0xf603('0x5')](e)){var event=events[e];ChatInternalMessage[_0xf603('0x6')](e,emitEvent(event));}}module[_0xf603('0x7')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 86559d0..22f1728 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 _0xe706=['chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage'];(function(_0x48bc67,_0x3b2b80){var _0x5f0651=function(_0x2640ed){while(--_0x2640ed){_0x48bc67['push'](_0x48bc67['shift']());}};_0x5f0651(++_0x3b2b80);}(_0xe706,0xa3));var _0x6e70=function(_0x245a7d,_0x253c2f){_0x245a7d=_0x245a7d-0x0;var _0x24789d=_0xe706[_0x245a7d];return _0x24789d;};'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':!![],'charset':_0x6e70('0xe'),'collate':_0x6e70('0xf')});}; \ No newline at end of file +var _0xac4a=['bluebird','rimraf','../../config/environment','./chatInternalMessage.attributes','define','chat_internal_messages','utf8mb4','lodash','util','../../config/logger','api','moment'];(function(_0x4d7988,_0x4c62e3){var _0x97e287=function(_0x223966){while(--_0x223966){_0x4d7988['push'](_0x4d7988['shift']());}};_0x97e287(++_0x4c62e3);}(_0xac4a,0x13f));var _0xaac4=function(_0x15521a,_0x489ba2){_0x15521a=_0x15521a-0x0;var _0x35970d=_0xac4a[_0x15521a];return _0x35970d;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var logger=require(_0xaac4('0x2'))(_0xaac4('0x3'));var moment=require(_0xaac4('0x4'));var BPromise=require(_0xaac4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var attributes=require(_0xaac4('0x8'));module['exports']=function(_0x1283a5,_0x53d03a){return _0x1283a5[_0xaac4('0x9')]('ChatInternalMessage',attributes,{'tableName':_0xaac4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xaac4('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index b841d15..0c8ad98 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 _0xd5fd=['redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','then','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http'];(function(_0x2e871d,_0x540db1){var _0x1fc40d=function(_0x239f23){while(--_0x239f23){_0x2e871d['push'](_0x2e871d['shift']());}};_0x1fc40d(++_0x540db1);}(_0xd5fd,0xc0));var _0xdd5f=function(_0x5426d0,_0x4a4f10){_0x5426d0=_0x5426d0-0x0;var _0x37be89=_0xd5fd[_0x5426d0];return _0x37be89;};'use strict';var _=require(_0xdd5f('0x0'));var util=require(_0xdd5f('0x1'));var moment=require(_0xdd5f('0x2'));var BPromise=require(_0xdd5f('0x3'));var rs=require(_0xdd5f('0x4'));var fs=require('fs');var Redis=require(_0xdd5f('0x5'));var db=require(_0xdd5f('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdd5f('0x7'));var config=require(_0xdd5f('0x8'));var jayson=require(_0xdd5f('0x9'));var client=jayson['client'][_0xdd5f('0xa')]({'port':0x232a});config[_0xdd5f('0xb')]=_[_0xdd5f('0xc')](config[_0xdd5f('0xb')],{'host':_0xdd5f('0xd'),'port':0x18eb});var socket=require(_0xdd5f('0xe'))(new Redis(config[_0xdd5f('0xb')]));require(_0xdd5f('0xf'))[_0xdd5f('0x10')](socket);function respondWithRpcPromise(_0x400268,_0x267941,_0x5e2858){return new BPromise(function(_0x2636c6,_0x36d5b2){return client['request'](_0x400268,_0x5e2858)[_0xdd5f('0x11')](function(_0x468c55){logger[_0xdd5f('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x267941,_0xdd5f('0x13'));logger[_0xdd5f('0x14')](_0xdd5f('0x15'),_0x267941,_0xdd5f('0x13'),JSON[_0xdd5f('0x16')](_0x468c55));if(_0x468c55[_0xdd5f('0x17')]){if(_0x468c55[_0xdd5f('0x17')][_0xdd5f('0x18')]===0x1f4){logger[_0xdd5f('0x17')](_0xdd5f('0x19'),_0x267941,_0x468c55[_0xdd5f('0x17')]['message']);return _0x36d5b2(_0x468c55[_0xdd5f('0x17')][_0xdd5f('0x1a')]);}logger[_0xdd5f('0x17')](_0xdd5f('0x19'),_0x267941,_0x468c55['error']['message']);return _0x2636c6(_0x468c55[_0xdd5f('0x17')]['message']);}else{logger[_0xdd5f('0x12')](_0xdd5f('0x19'),_0x267941,_0xdd5f('0x13'));_0x2636c6(_0x468c55[_0xdd5f('0x1b')][_0xdd5f('0x1a')]);}})[_0xdd5f('0x1c')](function(_0x4c632a){logger[_0xdd5f('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x267941,_0x4c632a);_0x36d5b2(_0x4c632a);});});} \ No newline at end of file +var _0x6ced=['then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request'];(function(_0x3459e6,_0xfb17a0){var _0x54fefb=function(_0xb1f758){while(--_0xb1f758){_0x3459e6['push'](_0x3459e6['shift']());}};_0x54fefb(++_0xfb17a0);}(_0x6ced,0x15b));var _0xd6ce=function(_0x3970a8,_0x314afc){_0x3970a8=_0x3970a8-0x0;var _0x5a02c6=_0x6ced[_0x3970a8];return _0x5a02c6;};'use strict';var _=require(_0xd6ce('0x0'));var util=require(_0xd6ce('0x1'));var moment=require(_0xd6ce('0x2'));var BPromise=require(_0xd6ce('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd6ce('0x4'));var db=require(_0xd6ce('0x5'))['db'];var utils=require(_0xd6ce('0x6'));var logger=require('../../config/logger')(_0xd6ce('0x7'));var config=require('../../config/environment');var jayson=require(_0xd6ce('0x8'));var client=jayson['client'][_0xd6ce('0x9')]({'port':0x232a});config[_0xd6ce('0xa')]=_[_0xd6ce('0xb')](config['redis'],{'host':_0xd6ce('0xc'),'port':0x18eb});var socket=require(_0xd6ce('0xd'))(new Redis(config[_0xd6ce('0xa')]));require(_0xd6ce('0xe'))[_0xd6ce('0xf')](socket);function respondWithRpcPromise(_0x2b240a,_0x11e1c8,_0x5ee9db){return new BPromise(function(_0x37e499,_0x56efeb){return client[_0xd6ce('0x10')](_0x2b240a,_0x5ee9db)[_0xd6ce('0x11')](function(_0x1b7da3){logger[_0xd6ce('0x12')](_0xd6ce('0x13'),_0x11e1c8,_0xd6ce('0x14'));logger[_0xd6ce('0x15')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x11e1c8,_0xd6ce('0x14'),JSON[_0xd6ce('0x16')](_0x1b7da3));if(_0x1b7da3[_0xd6ce('0x17')]){if(_0x1b7da3[_0xd6ce('0x17')][_0xd6ce('0x18')]===0x1f4){logger[_0xd6ce('0x17')](_0xd6ce('0x13'),_0x11e1c8,_0x1b7da3['error']['message']);return _0x56efeb(_0x1b7da3['error'][_0xd6ce('0x19')]);}logger[_0xd6ce('0x17')](_0xd6ce('0x13'),_0x11e1c8,_0x1b7da3[_0xd6ce('0x17')][_0xd6ce('0x19')]);return _0x37e499(_0x1b7da3[_0xd6ce('0x17')][_0xd6ce('0x19')]);}else{logger[_0xd6ce('0x12')](_0xd6ce('0x13'),_0x11e1c8,_0xd6ce('0x14'));_0x37e499(_0x1b7da3['result']['message']);}})['catch'](function(_0x31e931){logger[_0xd6ce('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x11e1c8,_0x31e931);_0x56efeb(_0x31e931);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index ff9e568..c5d76e0 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 _0x8ebf=['remove','emit','register','length','chatInternalMessage:','./chatInternalMessage.events','save'];(function(_0x5e2751,_0x518a55){var _0x139a39=function(_0x4802db){while(--_0x4802db){_0x5e2751['push'](_0x5e2751['shift']());}};_0x139a39(++_0x518a55);}(_0x8ebf,0x15c));var _0xf8eb=function(_0x261b8a,_0x553ec4){_0x261b8a=_0x261b8a-0x0;var _0x3455e8=_0x8ebf[_0x261b8a];return _0x3455e8;};'use strict';var ChatInternalMessageEvents=require(_0xf8eb('0x0'));var events=[_0xf8eb('0x1'),_0xf8eb('0x2'),'update'];function createListener(_0x213f91,_0x1aa773){return function(_0x50d234){_0x1aa773[_0xf8eb('0x3')](_0x213f91,_0x50d234);};}function removeListener(_0x59d6a7,_0x41e20b){return function(){ChatInternalMessageEvents['removeListener'](_0x59d6a7,_0x41e20b);};}exports[_0xf8eb('0x4')]=function(_0x36fde3){for(var _0x4cbeaa=0x0,_0x30c91c=events[_0xf8eb('0x5')];_0x4cbeaa<_0x30c91c;_0x4cbeaa++){var _0x2a1fb6=events[_0x4cbeaa];var _0x4c628d=createListener(_0xf8eb('0x6')+_0x2a1fb6,_0x36fde3);ChatInternalMessageEvents['on'](_0x2a1fb6,_0x4c628d);}}; \ No newline at end of file +var _0x83d3=['emit','register','length','chatInternalMessage:','./chatInternalMessage.events','save','remove','update'];(function(_0x2a7982,_0x3a4ade){var _0x5e0db5=function(_0x25def5){while(--_0x25def5){_0x2a7982['push'](_0x2a7982['shift']());}};_0x5e0db5(++_0x3a4ade);}(_0x83d3,0x17c));var _0x383d=function(_0x127c7e,_0x470192){_0x127c7e=_0x127c7e-0x0;var _0x45f955=_0x83d3[_0x127c7e];return _0x45f955;};'use strict';var ChatInternalMessageEvents=require(_0x383d('0x0'));var events=[_0x383d('0x1'),_0x383d('0x2'),_0x383d('0x3')];function createListener(_0x37aa24,_0x5af289){return function(_0x9287d4){_0x5af289[_0x383d('0x4')](_0x37aa24,_0x9287d4);};}function removeListener(_0x31cbfc,_0x202ffc){return function(){ChatInternalMessageEvents['removeListener'](_0x31cbfc,_0x202ffc);};}exports[_0x383d('0x5')]=function(_0x4f3c10){for(var _0x50eaff=0x0,_0xbc074b=events[_0x383d('0x6')];_0x50eaff<_0xbc074b;_0x50eaff++){var _0x360bee=events[_0x50eaff];var _0x5641df=createListener(_0x383d('0x7')+_0x360bee,_0x4f3c10);ChatInternalMessageEvents['on'](_0x360bee,_0x5641df);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 4399cfd..848b440 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(_0x553bb0,_0x52e291){var _0x4cfcad=function(_0x1d37f5){while(--_0x1d37f5){_0x553bb0['push'](_0x553bb0['shift']());}};_0x4cfcad(++_0x52e291);}(_0x70e0,0x17b));var _0x070e=function(_0x166238,_0x481ae1){_0x166238=_0x166238-0x0;var _0x2de832=_0x70e0[_0x166238];return _0x2de832;};'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 _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(_0xf614b5,_0x387631){var _0x28e3d4=function(_0x3b795f){while(--_0x3b795f){_0xf614b5['push'](_0xf614b5['shift']());}};_0x28e3d4(++_0x387631);}(_0x70e0,0x17b));var _0x070e=function(_0xda3c8,_0x57b4c2){_0xda3c8=_0xda3c8-0x0;var _0x34c20c=_0x70e0[_0xda3c8];return _0x34c20c;};'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 diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 581430d..74a864b 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 _0x0e28=['DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x4f73e1,_0x3fa1ec){var _0x45e60b=function(_0x56544e){while(--_0x56544e){_0x4f73e1['push'](_0x4f73e1['shift']());}};_0x45e60b(++_0x3fa1ec);}(_0x0e28,0x101));var _0x80e2=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0e28[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x80e2('0x0'));module[_0x80e2('0x1')]={'body':{'type':Sequelize[_0x80e2('0x2')](_0x80e2('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x80e2('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x80e2('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x80e2('0x5')]('in',_0x80e2('0x6')),'defaultValue':_0x80e2('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x80e2('0x7')]}}; \ No newline at end of file +var _0xb019=['sequelize','exports','BOOLEAN','ENUM','out','DATE'];(function(_0x3d1b85,_0x10e828){var _0x31b1aa=function(_0xe883ca){while(--_0xe883ca){_0x3d1b85['push'](_0x3d1b85['shift']());}};_0x31b1aa(++_0x10e828);}(_0xb019,0x1a4));var _0x9b01=function(_0x2a9174,_0x2db921){_0x2a9174=_0x2a9174-0x0;var _0x4e8d75=_0xb019[_0x2a9174];return _0x4e8d75;};'use strict';var Sequelize=require(_0x9b01('0x0'));module[_0x9b01('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x9b01('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x9b01('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9b01('0x3')]('in',_0x9b01('0x4')),'defaultValue':_0x9b01('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x9b01('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 55958e9..7591ee1 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 _0x488d=['keys','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','rawAttributes','find','create','body','describe','chat-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','ChatInteraction','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','channel','EventManager','acceptmessage','parse','formData','chat','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','SIP/%s','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','redis','defaults','localhost','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','set','Content-Range','json','reject','save','update','destroy','stack','name','send','index','map','ChatMessage','fieldName','type','key','model','query'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x488d,0x12f));var _0xd488=function(_0x510a4d,_0x1a2b3e){_0x510a4d=_0x510a4d-0x0;var _0x238bbb=_0x488d[_0x510a4d];return _0x238bbb;};'use strict';var pdf=require(_0xd488('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd488('0x1'));var zipdir=require(_0xd488('0x2'));var jsonpatch=require(_0xd488('0x3'));var rp=require(_0xd488('0x4'));var moment=require(_0xd488('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xd488('0x6'));var sox=require(_0xd488('0x7'));var csv=require(_0xd488('0x8'));var ejs=require(_0xd488('0x9'));var fs=require('fs');var _=require(_0xd488('0xa'));var squel=require(_0xd488('0xb'));var crypto=require('crypto');var jsforce=require(_0xd488('0xc'));var deskjs=require(_0xd488('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd488('0xe'));var Papa=require(_0xd488('0xf'));var Redis=require(_0xd488('0x10'));var authService=require(_0xd488('0x11'));var qs=require(_0xd488('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd488('0x13'));var logger=require(_0xd488('0x14'))(_0xd488('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xd488('0x16')]=_[_0xd488('0x17')](config['redis'],{'host':_0xd488('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd488('0x16')]));require('./chatMessage.socket')['register'](socket);var jayson=require(_0xd488('0x19'));var client=jayson[_0xd488('0x1a')][_0xd488('0x1b')]({'port':0x232c});var client9002=jayson[_0xd488('0x1a')]['http']({'port':0x232a});function checkPasswordPattern(_0x5294e5,_0x5b462f,_0x485ada){if(_0x485ada){var _0x185c11=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x185c11[_0xd488('0x1c')](_0x5b462f)){return _0x5294e5;}else{throw new db['Sequelize'][(_0xd488('0x1d'))](_0xd488('0x1e'));}}else{return _0x5294e5;}}function respondWithRpcPromise(_0x141544,_0xe9c4be,_0x5620b9,_0x544a47){return new BPromise(function(_0x24996a,_0x3f20d0){var _0x3714a6=_0x544a47||client;return _0x3714a6['request'](_0x141544,_0x5620b9)[_0xd488('0x1f')](function(_0x53e82c){logger[_0xd488('0x20')](_0xd488('0x21'),_0xe9c4be,_0xd488('0x22'));logger[_0xd488('0x23')](_0xd488('0x24'),_0xe9c4be,_0xd488('0x22'),JSON[_0xd488('0x25')](_0x53e82c));if(_0x53e82c[_0xd488('0x26')]){if(_0x53e82c[_0xd488('0x26')][_0xd488('0x27')]===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0xe9c4be,_0x53e82c[_0xd488('0x26')][_0xd488('0x28')]);return _0x3f20d0(_0x53e82c[_0xd488('0x26')][_0xd488('0x28')]);}logger[_0xd488('0x26')](_0xd488('0x21'),_0xe9c4be,_0x53e82c['error'][_0xd488('0x28')]);return _0x24996a(_0x53e82c[_0xd488('0x26')][_0xd488('0x28')]);}else{logger['info'](_0xd488('0x21'),_0xe9c4be,_0xd488('0x22'));_0x24996a(_0x53e82c[_0xd488('0x29')]['message']);}})[_0xd488('0x2a')](function(_0x5a2d33){logger[_0xd488('0x26')](_0xd488('0x21'),_0xe9c4be,_0x5a2d33);_0x3f20d0(_0x5a2d33);});});}function respondWithStatusCode(_0x5bf03b,_0x524795){_0x524795=_0x524795||0xcc;return function(_0x4898cb){if(_0x4898cb){return _0x5bf03b[_0xd488('0x2b')](_0x524795);}return _0x5bf03b[_0xd488('0x2c')](_0x524795)[_0xd488('0x2d')]();};}function respondWithResult(_0x1123c5,_0x527b45){_0x527b45=_0x527b45||0xc8;return function(_0x4c5347){if(_0x4c5347){return _0x1123c5[_0xd488('0x2c')](_0x527b45)['json'](_0x4c5347);}};}function respondWithFilteredResult(_0xe8d403,_0xc68cca){return function(_0x5cbaef){if(_0x5cbaef){var _0x1a94c0=_0x5cbaef[_0xd488('0x2e')],_0x4b4066=_0xc68cca[_0xd488('0x2f')],_0x816f2c=_0xc68cca[_0xd488('0x2f')]+_0xc68cca['limit'],_0x4cbe3e;if(_0x816f2c>=_0x1a94c0){_0x816f2c=_0x1a94c0;_0x4cbe3e=0xc8;}else{_0x4cbe3e=0xce;}_0xe8d403['status'](_0x4cbe3e);return _0xe8d403[_0xd488('0x30')](_0xd488('0x31'),_0x4b4066+'-'+_0x816f2c+'/'+_0x1a94c0)[_0xd488('0x32')](_0x5cbaef);}return null;};}function patchUpdates(_0x2f22e6){return function(_0x35f6dd){try{jsonpatch['apply'](_0x35f6dd,_0x2f22e6,!![]);}catch(_0x5a14b1){return BPromise[_0xd488('0x33')](_0x5a14b1);}return _0x35f6dd[_0xd488('0x34')]();};}function saveUpdates(_0x2044c0,_0x6cd79c){return function(_0x52b143){if(_0x52b143){return _0x52b143[_0xd488('0x35')](_0x2044c0)[_0xd488('0x1f')](function(_0x4bac5f){return _0x4bac5f;});}return null;};}function removeEntity(_0x11d3da,_0x3a8370){return function(_0x2ec6b8){if(_0x2ec6b8){return _0x2ec6b8[_0xd488('0x36')]()[_0xd488('0x1f')](function(){_0x11d3da[_0xd488('0x2c')](0xcc)[_0xd488('0x2d')]();});}};}function handleEntityNotFound(_0xa62b83,_0x57201c){return function(_0x2c9327){if(!_0x2c9327){_0xa62b83['sendStatus'](0x194);}return _0x2c9327;};}function handleError(_0x1eba35,_0x77541a){_0x77541a=_0x77541a||0x1f4;return function(_0x7bba3f){logger[_0xd488('0x26')](_0x7bba3f[_0xd488('0x37')]);if(_0x7bba3f[_0xd488('0x38')]){delete _0x7bba3f[_0xd488('0x38')];}_0x1eba35['status'](_0x77541a)[_0xd488('0x39')](_0x7bba3f);};}exports[_0xd488('0x3a')]=function(_0x29248b,_0x39574c){var _0x30276c={},_0x4e34f8={},_0x4e6704={'count':0x0,'rows':[]};var _0x24b315=_[_0xd488('0x3b')](db[_0xd488('0x3c')]['rawAttributes'],function(_0x2e2d1d){return{'name':_0x2e2d1d[_0xd488('0x3d')],'type':_0x2e2d1d[_0xd488('0x3e')][_0xd488('0x3f')]};});_0x4e34f8[_0xd488('0x40')]=_[_0xd488('0x3b')](_0x24b315,_0xd488('0x38'));_0x4e34f8[_0xd488('0x41')]=_[_0xd488('0x42')](_0x29248b[_0xd488('0x41')]);_0x4e34f8['filters']=_[_0xd488('0x43')](_0x4e34f8[_0xd488('0x40')],_0x4e34f8['query']);_0x30276c[_0xd488('0x44')]=_['intersection'](_0x4e34f8['model'],qs['fields'](_0x29248b[_0xd488('0x41')][_0xd488('0x45')]));_0x30276c[_0xd488('0x44')]=_0x30276c[_0xd488('0x44')][_0xd488('0x46')]?_0x30276c[_0xd488('0x44')]:_0x4e34f8[_0xd488('0x40')];if(!_0x29248b[_0xd488('0x41')]['hasOwnProperty'](_0xd488('0x47'))){_0x30276c[_0xd488('0x48')]=qs[_0xd488('0x48')](_0x29248b['query'][_0xd488('0x48')]);_0x30276c[_0xd488('0x2f')]=qs['offset'](_0x29248b[_0xd488('0x41')][_0xd488('0x2f')]);}_0x30276c[_0xd488('0x49')]=qs[_0xd488('0x4a')](_0x29248b[_0xd488('0x41')][_0xd488('0x4a')]);_0x30276c[_0xd488('0x4b')]=qs[_0xd488('0x4c')](_[_0xd488('0x4d')](_0x29248b['query'],_0x4e34f8[_0xd488('0x4c')]),_0x24b315);if(_0x29248b[_0xd488('0x41')][_0xd488('0x4e')]){_0x30276c[_0xd488('0x4b')]=_[_0xd488('0x4f')](_0x30276c[_0xd488('0x4b')],{'$or':_[_0xd488('0x3b')](_0x24b315,function(_0x3b96e4){if(_0x3b96e4[_0xd488('0x3e')]!==_0xd488('0x50')){var _0x58b4fe={};_0x58b4fe[_0x3b96e4['name']]={'$like':'%'+_0x29248b['query'][_0xd488('0x4e')]+'%'};return _0x58b4fe;}})});}_0x30276c=_[_0xd488('0x4f')]({},_0x30276c,_0x29248b[_0xd488('0x51')]);var _0x32be3d={'where':_0x30276c['where']};return db[_0xd488('0x3c')][_0xd488('0x2e')](_0x32be3d)[_0xd488('0x1f')](function(_0x3a2565){_0x4e6704[_0xd488('0x2e')]=_0x3a2565;if(_0x29248b[_0xd488('0x41')][_0xd488('0x52')]){_0x30276c[_0xd488('0x53')]=[{'all':!![]}];}return db[_0xd488('0x3c')][_0xd488('0x54')](_0x30276c);})[_0xd488('0x1f')](function(_0x3d4745){_0x4e6704[_0xd488('0x55')]=_0x3d4745;return _0x4e6704;})[_0xd488('0x1f')](respondWithFilteredResult(_0x39574c,_0x30276c))[_0xd488('0x2a')](handleError(_0x39574c,null));};exports['show']=function(_0x23db43,_0xa400b6){var _0x24bf5e={'raw':!![],'where':{'id':_0x23db43[_0xd488('0x56')]['id']}},_0x4e56e5={};_0x4e56e5['model']=_[_0xd488('0x42')](db[_0xd488('0x3c')][_0xd488('0x57')]);_0x4e56e5[_0xd488('0x41')]=_[_0xd488('0x42')](_0x23db43[_0xd488('0x41')]);_0x4e56e5[_0xd488('0x4c')]=_['intersection'](_0x4e56e5[_0xd488('0x40')],_0x4e56e5[_0xd488('0x41')]);_0x24bf5e['attributes']=_[_0xd488('0x43')](_0x4e56e5['model'],qs[_0xd488('0x45')](_0x23db43[_0xd488('0x41')]['fields']));_0x24bf5e['attributes']=_0x24bf5e[_0xd488('0x44')][_0xd488('0x46')]?_0x24bf5e[_0xd488('0x44')]:_0x4e56e5[_0xd488('0x40')];if(_0x23db43[_0xd488('0x41')][_0xd488('0x52')]){_0x24bf5e[_0xd488('0x53')]=[{'all':!![]}];}_0x24bf5e=_[_0xd488('0x4f')]({},_0x24bf5e,_0x23db43[_0xd488('0x51')]);return db[_0xd488('0x3c')][_0xd488('0x58')](_0x24bf5e)['then'](handleEntityNotFound(_0xa400b6,null))[_0xd488('0x1f')](respondWithResult(_0xa400b6,null))['catch'](handleError(_0xa400b6,null));};exports['create']=function(_0x2abb36,_0xd2d5b7){return db[_0xd488('0x3c')][_0xd488('0x59')](_0x2abb36[_0xd488('0x5a')],{})[_0xd488('0x1f')](respondWithResult(_0xd2d5b7,0xc9))[_0xd488('0x2a')](handleError(_0xd2d5b7,null));};exports[_0xd488('0x35')]=function(_0x37401b,_0x4c7462){if(_0x37401b[_0xd488('0x5a')]['id']){delete _0x37401b['body']['id'];}return db[_0xd488('0x3c')][_0xd488('0x58')]({'where':{'id':_0x37401b['params']['id']}})[_0xd488('0x1f')](handleEntityNotFound(_0x4c7462,null))[_0xd488('0x1f')](saveUpdates(_0x37401b['body'],null))[_0xd488('0x1f')](respondWithResult(_0x4c7462,null))[_0xd488('0x2a')](handleError(_0x4c7462,null));};exports[_0xd488('0x36')]=function(_0x4205fe,_0x2395b9){return db[_0xd488('0x3c')][_0xd488('0x58')]({'where':{'id':_0x4205fe[_0xd488('0x56')]['id']}})['then'](handleEntityNotFound(_0x2395b9,null))[_0xd488('0x1f')](removeEntity(_0x2395b9,null))['catch'](handleError(_0x2395b9,null));};exports[_0xd488('0x5b')]=function(_0x50e220,_0x1622b0){return db[_0xd488('0x3c')][_0xd488('0x5b')]()[_0xd488('0x1f')](respondWithResult(_0x1622b0,null))[_0xd488('0x2a')](handleError(_0x1622b0,null));};var interaction_log=require(_0xd488('0x14'))(_0xd488('0x5c'));exports[_0xd488('0x5d')]=function(_0x1cb325,_0x535911,_0x2956ae){var _0x14d4ed={'channel':'chat'};if(_0x1cb325['body']['id']){delete _0x1cb325[_0xd488('0x5a')]['id'];}_0x1cb325[_0xd488('0x5a')]['read']=!![];_0x1cb325[_0xd488('0x5a')][_0xd488('0x5e')]=moment()[_0xd488('0x5f')](_0xd488('0x60'));_0x1cb325[_0xd488('0x5a')][_0xd488('0x61')]=_0x1cb325[_0xd488('0x5a')][_0xd488('0x61')]||_0x1cb325[_0xd488('0x62')]['id'];return db['ChatMessage'][_0xd488('0x58')]({'where':{'id':_0x1cb325['params']['id'],'UserId':null},'include':[{'model':db[_0xd488('0x63')],'as':_0xd488('0x64')}]})['then'](handleEntityNotFound(_0x535911,null))['then'](saveUpdates(_0x1cb325[_0xd488('0x5a')],null))[_0xd488('0x1f')](function(_0x7808f0){if(_0x7808f0){_0x14d4ed[_0xd488('0x28')]=_0x7808f0[_0xd488('0x65')]({'plain':!![]});return db[_0xd488('0x66')]['find']({'where':{'id':_0x7808f0['ChatInteractionId']}});}return null;})[_0xd488('0x1f')](handleEntityNotFound(_0x535911,null))['then'](function(_0x5a08d1){if(_0x5a08d1){return _0x5a08d1[_0xd488('0x35')]({'UserId':_0x1cb325['body'][_0xd488('0x61')],'read1stAt':_[_0xd488('0x67')](_0x5a08d1[_0xd488('0x68')])?moment()[_0xd488('0x5f')](_0xd488('0x60')):undefined});}return null;})['then'](function(_0x46cb0b){if(_0x46cb0b){_0x14d4ed[_0xd488('0x69')]=_0x46cb0b[_0xd488('0x65')]({'plain':!![]});interaction_log[_0xd488('0x20')](_0xd488('0x6a'),_0x1cb325[_0xd488('0x62')]['id'],_0x1cb325['user'][_0xd488('0x38')],_0x1cb325['user'][_0xd488('0x6b')],_0x14d4ed[_0xd488('0x69')]['id'],_0x1cb325[_0xd488('0x5a')]?JSON['stringify'](_0x1cb325[_0xd488('0x5a')]):_0xd488('0x6c'));return respondWithRpcPromise(_0xd488('0x6d'),_0xd488('0x6e'),_0x14d4ed);}return null;})['then'](function(_0x57985c){if(_0x57985c){if(_0x1cb325[_0xd488('0x5a')]['manual']){_0x14d4ed['message']['interface']=util[_0xd488('0x5f')]('SIP/%s',_0x1cb325[_0xd488('0x62')][_0xd488('0x38')]);_0x14d4ed[_0xd488('0x28')][_0xd488('0x6f')]=_0x14d4ed[_0xd488('0x6f')];_0x14d4ed[_0xd488('0x28')]['event']=_0xd488('0x5d');return respondWithRpcPromise(_0xd488('0x70'),'EventManager',{'event':_0xd488('0x71'),'message':_[_0xd488('0x4f')](_0x14d4ed[_0xd488('0x28')],JSON[_0xd488('0x72')](_0x14d4ed['interaction'][_0xd488('0x73')]))},client9002)['then'](function(){return _0x14d4ed;});}return _0x14d4ed;}return null;})[_0xd488('0x1f')](respondWithResult(_0x535911,null))[_0xd488('0x2a')](handleError(_0x535911,null));};var interaction_log=require(_0xd488('0x14'))(_0xd488('0x5c'));exports[_0xd488('0x33')]=function(_0x50eed1,_0x5cb8a1,_0x38d6e3){var _0x1282ab={'agent':{},'channel':_0xd488('0x74')};if(_0x50eed1[_0xd488('0x5a')]['id']){delete _0x50eed1[_0xd488('0x5a')]['id'];}_0x50eed1['body']['UserId']=_0x50eed1[_0xd488('0x5a')][_0xd488('0x61')]||_0x50eed1[_0xd488('0x62')]['id'];_0x1282ab['agent']['id']=_0x50eed1[_0xd488('0x5a')][_0xd488('0x61')];return db['ChatMessage']['find']({'where':{'id':_0x50eed1['params']['id'],'UserId':null}})[_0xd488('0x1f')](handleEntityNotFound(_0x5cb8a1,null))[_0xd488('0x1f')](function(_0x63fc3c){if(_0x63fc3c){_0x1282ab['message']=_0x63fc3c[_0xd488('0x65')]({'plain':!![]});return db[_0xd488('0x66')][_0xd488('0x58')]({'where':{'id':_0x63fc3c[_0xd488('0x75')]}});}return null;})['then'](handleEntityNotFound(_0x5cb8a1,null))[_0xd488('0x1f')](function(_0x1c005b){if(_0x1c005b){_0x1282ab[_0xd488('0x69')]=_0x1c005b['get']({'plain':!![]});interaction_log[_0xd488('0x20')](_0xd488('0x76'),_0x50eed1[_0xd488('0x62')]['id'],_0x50eed1[_0xd488('0x62')][_0xd488('0x38')],_0x50eed1[_0xd488('0x62')][_0xd488('0x6b')],_0x1282ab[_0xd488('0x69')]['id'],_0x50eed1[_0xd488('0x5a')]?JSON['stringify'](_0x50eed1['body']):'null');return respondWithRpcPromise(_0xd488('0x77'),_0xd488('0x78'),_0x1282ab);}return null;})[_0xd488('0x1f')](function(_0xac896f){if(_0xac896f){_0xac896f['message'][_0xd488('0x79')]=util['format'](_0xd488('0x7a'),_0x50eed1[_0xd488('0x62')][_0xd488('0x38')]);_0xac896f[_0xd488('0x28')][_0xd488('0x6f')]=_0x1282ab[_0xd488('0x6f')];_0xac896f[_0xd488('0x28')]['event']='reject';respondWithRpcPromise(_0xd488('0x70'),_0xd488('0x70'),{'event':'rejectmessage','message':_0xac896f[_0xd488('0x28')]},client9002);return _0x1282ab;}return null;})[_0xd488('0x1f')](respondWithResult(_0x5cb8a1,null))['catch'](handleError(_0x5cb8a1,null));}; \ No newline at end of file +var _0x8e61=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','./chatMessage.socket','register','jayson/promise','http','test','Sequelize','ValidationError','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','ChatMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','chat-interactions','accept','chat','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','ChatInteractionId','isNil','format','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','manual','channel','event','EventManager','acceptmessage','parse','formData','agent','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','SIP/%s','rejectmessage','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x5405e3,_0x32d477){var _0x1782e9=function(_0x246ffb){while(--_0x246ffb){_0x5405e3['push'](_0x5405e3['shift']());}};_0x1782e9(++_0x32d477);}(_0x8e61,0x69));var _0x18e6=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x8e61[_0x2064e5];return _0x21a233;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x18e6('0x0'));var rimraf=require(_0x18e6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x18e6('0x2'));var moment=require(_0x18e6('0x3'));var BPromise=require(_0x18e6('0x4'));var Mustache=require(_0x18e6('0x5'));var util=require(_0x18e6('0x6'));var path=require(_0x18e6('0x7'));var sox=require(_0x18e6('0x8'));var csv=require(_0x18e6('0x9'));var ejs=require(_0x18e6('0xa'));var fs=require('fs');var _=require(_0x18e6('0xb'));var squel=require(_0x18e6('0xc'));var crypto=require(_0x18e6('0xd'));var jsforce=require(_0x18e6('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x18e6('0xf'));var Redis=require(_0x18e6('0x10'));var authService=require(_0x18e6('0x11'));var qs=require(_0x18e6('0x12'));var as=require(_0x18e6('0x13'));var hardwareService=require(_0x18e6('0x14'));var logger=require(_0x18e6('0x15'))(_0x18e6('0x16'));var utils=require(_0x18e6('0x17'));var config=require(_0x18e6('0x18'));var db=require(_0x18e6('0x19'))['db'];config['redis']=_[_0x18e6('0x1a')](config[_0x18e6('0x1b')],{'host':_0x18e6('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x18e6('0x1b')]));require(_0x18e6('0x1d'))[_0x18e6('0x1e')](socket);var jayson=require(_0x18e6('0x1f'));var client=jayson['client'][_0x18e6('0x20')]({'port':0x232c});var client9002=jayson['client'][_0x18e6('0x20')]({'port':0x232a});function checkPasswordPattern(_0x5234dc,_0x1178c3,_0x180210){if(_0x180210){var _0x10be58=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x10be58[_0x18e6('0x21')](_0x1178c3)){return _0x5234dc;}else{throw new db[(_0x18e6('0x22'))][(_0x18e6('0x23'))]('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 _0x5234dc;}}function respondWithRpcPromise(_0xb22679,_0x13e9cd,_0x3e0dc6,_0x42e7bd){return new BPromise(function(_0x4ff5a1,_0x3c71c6){var _0x398350=_0x42e7bd||client;return _0x398350[_0x18e6('0x24')](_0xb22679,_0x3e0dc6)['then'](function(_0x53e624){logger[_0x18e6('0x25')](_0x18e6('0x26'),_0x13e9cd,_0x18e6('0x27'));logger['debug'](_0x18e6('0x28'),_0x13e9cd,'request\x20sent',JSON['stringify'](_0x53e624));if(_0x53e624[_0x18e6('0x29')]){if(_0x53e624[_0x18e6('0x29')][_0x18e6('0x2a')]===0x1f4){logger['error'](_0x18e6('0x26'),_0x13e9cd,_0x53e624['error'][_0x18e6('0x2b')]);return _0x3c71c6(_0x53e624['error'][_0x18e6('0x2b')]);}logger[_0x18e6('0x29')]('ChatMessage,\x20%s,\x20%s',_0x13e9cd,_0x53e624[_0x18e6('0x29')][_0x18e6('0x2b')]);return _0x4ff5a1(_0x53e624[_0x18e6('0x29')][_0x18e6('0x2b')]);}else{logger[_0x18e6('0x25')](_0x18e6('0x26'),_0x13e9cd,_0x18e6('0x27'));_0x4ff5a1(_0x53e624[_0x18e6('0x2c')][_0x18e6('0x2b')]);}})['catch'](function(_0x5604f5){logger[_0x18e6('0x29')](_0x18e6('0x26'),_0x13e9cd,_0x5604f5);_0x3c71c6(_0x5604f5);});});}function respondWithStatusCode(_0xf71837,_0x208d85){_0x208d85=_0x208d85||0xcc;return function(_0x2c8a72){if(_0x2c8a72){return _0xf71837[_0x18e6('0x2d')](_0x208d85);}return _0xf71837[_0x18e6('0x2e')](_0x208d85)[_0x18e6('0x2f')]();};}function respondWithResult(_0x57b1a7,_0x49bce4){_0x49bce4=_0x49bce4||0xc8;return function(_0x1d2534){if(_0x1d2534){return _0x57b1a7[_0x18e6('0x2e')](_0x49bce4)[_0x18e6('0x30')](_0x1d2534);}};}function respondWithFilteredResult(_0x92befc,_0x5544fb){return function(_0x546655){if(_0x546655){var _0x5e1d81=_0x546655[_0x18e6('0x31')],_0x4c864c=_0x5544fb[_0x18e6('0x32')],_0x4d9abf=_0x5544fb['offset']+_0x5544fb[_0x18e6('0x33')],_0x27609d;if(_0x4d9abf>=_0x5e1d81){_0x4d9abf=_0x5e1d81;_0x27609d=0xc8;}else{_0x27609d=0xce;}_0x92befc['status'](_0x27609d);return _0x92befc[_0x18e6('0x34')](_0x18e6('0x35'),_0x4c864c+'-'+_0x4d9abf+'/'+_0x5e1d81)[_0x18e6('0x30')](_0x546655);}return null;};}function patchUpdates(_0x55f2de){return function(_0xe3c24b){try{jsonpatch[_0x18e6('0x36')](_0xe3c24b,_0x55f2de,!![]);}catch(_0x2c3fd1){return BPromise[_0x18e6('0x37')](_0x2c3fd1);}return _0xe3c24b[_0x18e6('0x38')]();};}function saveUpdates(_0x5ead85,_0x87af16){return function(_0x5ab600){if(_0x5ab600){return _0x5ab600[_0x18e6('0x39')](_0x5ead85)[_0x18e6('0x3a')](function(_0x3f63fd){return _0x3f63fd;});}return null;};}function removeEntity(_0x5732c7,_0x2ad2ff){return function(_0x4cbef7){if(_0x4cbef7){return _0x4cbef7[_0x18e6('0x3b')]()[_0x18e6('0x3a')](function(){_0x5732c7[_0x18e6('0x2e')](0xcc)[_0x18e6('0x2f')]();});}};}function handleEntityNotFound(_0x1a2e54,_0x2b6b50){return function(_0x160fff){if(!_0x160fff){_0x1a2e54[_0x18e6('0x2d')](0x194);}return _0x160fff;};}function handleError(_0x560744,_0x2d53f8){_0x2d53f8=_0x2d53f8||0x1f4;return function(_0x5ebc0c){logger[_0x18e6('0x29')](_0x5ebc0c[_0x18e6('0x3c')]);if(_0x5ebc0c[_0x18e6('0x3d')]){delete _0x5ebc0c['name'];}_0x560744['status'](_0x2d53f8)['send'](_0x5ebc0c);};}exports[_0x18e6('0x3e')]=function(_0x84e0b3,_0x1f1c57){var _0x4b9992={},_0x44de2d={},_0x224702={'count':0x0,'rows':[]};var _0x1feafe=_[_0x18e6('0x3f')](db[_0x18e6('0x40')][_0x18e6('0x41')],function(_0x361e2c){return{'name':_0x361e2c[_0x18e6('0x42')],'type':_0x361e2c[_0x18e6('0x43')][_0x18e6('0x44')]};});_0x44de2d[_0x18e6('0x45')]=_[_0x18e6('0x3f')](_0x1feafe,'name');_0x44de2d[_0x18e6('0x46')]=_['keys'](_0x84e0b3[_0x18e6('0x46')]);_0x44de2d[_0x18e6('0x47')]=_[_0x18e6('0x48')](_0x44de2d[_0x18e6('0x45')],_0x44de2d[_0x18e6('0x46')]);_0x4b9992[_0x18e6('0x49')]=_['intersection'](_0x44de2d[_0x18e6('0x45')],qs['fields'](_0x84e0b3[_0x18e6('0x46')][_0x18e6('0x4a')]));_0x4b9992[_0x18e6('0x49')]=_0x4b9992[_0x18e6('0x49')]['length']?_0x4b9992[_0x18e6('0x49')]:_0x44de2d[_0x18e6('0x45')];if(!_0x84e0b3[_0x18e6('0x46')]['hasOwnProperty'](_0x18e6('0x4b'))){_0x4b9992[_0x18e6('0x33')]=qs[_0x18e6('0x33')](_0x84e0b3[_0x18e6('0x46')][_0x18e6('0x33')]);_0x4b9992[_0x18e6('0x32')]=qs[_0x18e6('0x32')](_0x84e0b3[_0x18e6('0x46')][_0x18e6('0x32')]);}_0x4b9992[_0x18e6('0x4c')]=qs['sort'](_0x84e0b3[_0x18e6('0x46')]['sort']);_0x4b9992['where']=qs['filters'](_[_0x18e6('0x4d')](_0x84e0b3[_0x18e6('0x46')],_0x44de2d[_0x18e6('0x47')]),_0x1feafe);if(_0x84e0b3[_0x18e6('0x46')][_0x18e6('0x4e')]){_0x4b9992[_0x18e6('0x4f')]=_[_0x18e6('0x50')](_0x4b9992[_0x18e6('0x4f')],{'$or':_['map'](_0x1feafe,function(_0x1d48c1){if(_0x1d48c1[_0x18e6('0x43')]!==_0x18e6('0x51')){var _0x5cf4ea={};_0x5cf4ea[_0x1d48c1[_0x18e6('0x3d')]]={'$like':'%'+_0x84e0b3['query'][_0x18e6('0x4e')]+'%'};return _0x5cf4ea;}})});}_0x4b9992=_[_0x18e6('0x50')]({},_0x4b9992,_0x84e0b3[_0x18e6('0x52')]);var _0x531c92={'where':_0x4b9992[_0x18e6('0x4f')]};return db[_0x18e6('0x40')]['count'](_0x531c92)[_0x18e6('0x3a')](function(_0x4be480){_0x224702[_0x18e6('0x31')]=_0x4be480;if(_0x84e0b3[_0x18e6('0x46')][_0x18e6('0x53')]){_0x4b9992[_0x18e6('0x54')]=[{'all':!![]}];}return db[_0x18e6('0x40')][_0x18e6('0x55')](_0x4b9992);})[_0x18e6('0x3a')](function(_0x9a1565){_0x224702[_0x18e6('0x56')]=_0x9a1565;return _0x224702;})[_0x18e6('0x3a')](respondWithFilteredResult(_0x1f1c57,_0x4b9992))[_0x18e6('0x57')](handleError(_0x1f1c57,null));};exports[_0x18e6('0x58')]=function(_0x4472f6,_0x5f3693){var _0x40f46c={'raw':!![],'where':{'id':_0x4472f6[_0x18e6('0x59')]['id']}},_0x607873={};_0x607873[_0x18e6('0x45')]=_[_0x18e6('0x5a')](db[_0x18e6('0x40')][_0x18e6('0x41')]);_0x607873['query']=_['keys'](_0x4472f6[_0x18e6('0x46')]);_0x607873[_0x18e6('0x47')]=_['intersection'](_0x607873['model'],_0x607873['query']);_0x40f46c[_0x18e6('0x49')]=_['intersection'](_0x607873['model'],qs[_0x18e6('0x4a')](_0x4472f6['query'][_0x18e6('0x4a')]));_0x40f46c[_0x18e6('0x49')]=_0x40f46c['attributes']['length']?_0x40f46c['attributes']:_0x607873['model'];if(_0x4472f6[_0x18e6('0x46')][_0x18e6('0x53')]){_0x40f46c['include']=[{'all':!![]}];}_0x40f46c=_[_0x18e6('0x50')]({},_0x40f46c,_0x4472f6['options']);return db[_0x18e6('0x40')][_0x18e6('0x5b')](_0x40f46c)[_0x18e6('0x3a')](handleEntityNotFound(_0x5f3693,null))[_0x18e6('0x3a')](respondWithResult(_0x5f3693,null))[_0x18e6('0x57')](handleError(_0x5f3693,null));};exports[_0x18e6('0x5c')]=function(_0xe780f8,_0x5c327c){return db[_0x18e6('0x40')]['create'](_0xe780f8[_0x18e6('0x5d')],{})[_0x18e6('0x3a')](respondWithResult(_0x5c327c,0xc9))[_0x18e6('0x57')](handleError(_0x5c327c,null));};exports[_0x18e6('0x39')]=function(_0x54390d,_0x5c65a5){if(_0x54390d['body']['id']){delete _0x54390d[_0x18e6('0x5d')]['id'];}return db[_0x18e6('0x40')][_0x18e6('0x5b')]({'where':{'id':_0x54390d['params']['id']}})[_0x18e6('0x3a')](handleEntityNotFound(_0x5c65a5,null))[_0x18e6('0x3a')](saveUpdates(_0x54390d[_0x18e6('0x5d')],null))[_0x18e6('0x3a')](respondWithResult(_0x5c65a5,null))[_0x18e6('0x57')](handleError(_0x5c65a5,null));};exports[_0x18e6('0x3b')]=function(_0x3c8269,_0x334726){return db[_0x18e6('0x40')][_0x18e6('0x5b')]({'where':{'id':_0x3c8269[_0x18e6('0x59')]['id']}})[_0x18e6('0x3a')](handleEntityNotFound(_0x334726,null))[_0x18e6('0x3a')](removeEntity(_0x334726,null))['catch'](handleError(_0x334726,null));};exports[_0x18e6('0x5e')]=function(_0x274fe8,_0x4a2f3e){return db['ChatMessage'][_0x18e6('0x5e')]()[_0x18e6('0x3a')](respondWithResult(_0x4a2f3e,null))['catch'](handleError(_0x4a2f3e,null));};var interaction_log=require('../../config/logger')(_0x18e6('0x5f'));exports[_0x18e6('0x60')]=function(_0xbc04f2,_0x28f6e6,_0xa7d908){var _0x205b8e={'channel':_0x18e6('0x61')};if(_0xbc04f2[_0x18e6('0x5d')]['id']){delete _0xbc04f2[_0x18e6('0x5d')]['id'];}_0xbc04f2['body'][_0x18e6('0x62')]=!![];_0xbc04f2[_0x18e6('0x5d')]['readAt']=moment()['format'](_0x18e6('0x63'));_0xbc04f2[_0x18e6('0x5d')][_0x18e6('0x64')]=_0xbc04f2[_0x18e6('0x5d')][_0x18e6('0x64')]||_0xbc04f2[_0x18e6('0x65')]['id'];return db[_0x18e6('0x40')][_0x18e6('0x5b')]({'where':{'id':_0xbc04f2['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0x18e6('0x3a')](handleEntityNotFound(_0x28f6e6,null))[_0x18e6('0x3a')](saveUpdates(_0xbc04f2[_0x18e6('0x5d')],null))['then'](function(_0x7ff670){if(_0x7ff670){_0x205b8e[_0x18e6('0x2b')]=_0x7ff670[_0x18e6('0x66')]({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x7ff670[_0x18e6('0x67')]}});}return null;})[_0x18e6('0x3a')](handleEntityNotFound(_0x28f6e6,null))[_0x18e6('0x3a')](function(_0x546db7){if(_0x546db7){return _0x546db7[_0x18e6('0x39')]({'UserId':_0xbc04f2[_0x18e6('0x5d')][_0x18e6('0x64')],'read1stAt':_[_0x18e6('0x68')](_0x546db7['read1stAt'])?moment()[_0x18e6('0x69')](_0x18e6('0x63')):undefined});}return null;})['then'](function(_0x1a7d16){if(_0x1a7d16){_0x205b8e[_0x18e6('0x6a')]=_0x1a7d16['get']({'plain':!![]});interaction_log[_0x18e6('0x25')](_0x18e6('0x6b'),_0xbc04f2[_0x18e6('0x65')]['id'],_0xbc04f2[_0x18e6('0x65')][_0x18e6('0x3d')],_0xbc04f2[_0x18e6('0x65')][_0x18e6('0x6c')],_0x205b8e[_0x18e6('0x6a')]['id'],_0xbc04f2[_0x18e6('0x5d')]?JSON['stringify'](_0xbc04f2[_0x18e6('0x5d')]):_0x18e6('0x6d'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x205b8e);}return null;})[_0x18e6('0x3a')](function(_0x3f01f5){if(_0x3f01f5){if(_0xbc04f2[_0x18e6('0x5d')][_0x18e6('0x6e')]){_0x205b8e[_0x18e6('0x2b')]['interface']=util[_0x18e6('0x69')]('SIP/%s',_0xbc04f2[_0x18e6('0x65')][_0x18e6('0x3d')]);_0x205b8e[_0x18e6('0x2b')]['channel']=_0x205b8e[_0x18e6('0x6f')];_0x205b8e[_0x18e6('0x2b')][_0x18e6('0x70')]='accept';return respondWithRpcPromise(_0x18e6('0x71'),'EventManager',{'event':_0x18e6('0x72'),'message':_[_0x18e6('0x50')](_0x205b8e[_0x18e6('0x2b')],JSON[_0x18e6('0x73')](_0x205b8e['interaction'][_0x18e6('0x74')]))},client9002)[_0x18e6('0x3a')](function(){return _0x205b8e;});}return _0x205b8e;}return null;})[_0x18e6('0x3a')](respondWithResult(_0x28f6e6,null))[_0x18e6('0x57')](handleError(_0x28f6e6,null));};var interaction_log=require('../../config/logger')(_0x18e6('0x5f'));exports[_0x18e6('0x37')]=function(_0x5cb965,_0x23ee88,_0x1eec7b){var _0x5afe0a={'agent':{},'channel':_0x18e6('0x61')};if(_0x5cb965[_0x18e6('0x5d')]['id']){delete _0x5cb965[_0x18e6('0x5d')]['id'];}_0x5cb965[_0x18e6('0x5d')][_0x18e6('0x64')]=_0x5cb965[_0x18e6('0x5d')][_0x18e6('0x64')]||_0x5cb965[_0x18e6('0x65')]['id'];_0x5afe0a[_0x18e6('0x75')]['id']=_0x5cb965[_0x18e6('0x5d')][_0x18e6('0x64')];return db['ChatMessage']['find']({'where':{'id':_0x5cb965[_0x18e6('0x59')]['id'],'UserId':null}})[_0x18e6('0x3a')](handleEntityNotFound(_0x23ee88,null))[_0x18e6('0x3a')](function(_0x1e0b0c){if(_0x1e0b0c){_0x5afe0a['message']=_0x1e0b0c['get']({'plain':!![]});return db[_0x18e6('0x76')][_0x18e6('0x5b')]({'where':{'id':_0x1e0b0c['ChatInteractionId']}});}return null;})[_0x18e6('0x3a')](handleEntityNotFound(_0x23ee88,null))[_0x18e6('0x3a')](function(_0x5d130f){if(_0x5d130f){_0x5afe0a['interaction']=_0x5d130f[_0x18e6('0x66')]({'plain':!![]});interaction_log['info'](_0x18e6('0x77'),_0x5cb965[_0x18e6('0x65')]['id'],_0x5cb965[_0x18e6('0x65')][_0x18e6('0x3d')],_0x5cb965[_0x18e6('0x65')]['role'],_0x5afe0a[_0x18e6('0x6a')]['id'],_0x5cb965[_0x18e6('0x5d')]?JSON['stringify'](_0x5cb965[_0x18e6('0x5d')]):_0x18e6('0x6d'));return respondWithRpcPromise(_0x18e6('0x78'),_0x18e6('0x79'),_0x5afe0a);}return null;})[_0x18e6('0x3a')](function(_0x427344){if(_0x427344){_0x427344[_0x18e6('0x2b')][_0x18e6('0x7a')]=util[_0x18e6('0x69')](_0x18e6('0x7b'),_0x5cb965[_0x18e6('0x65')][_0x18e6('0x3d')]);_0x427344['message'][_0x18e6('0x6f')]=_0x5afe0a[_0x18e6('0x6f')];_0x427344[_0x18e6('0x2b')][_0x18e6('0x70')]='reject';respondWithRpcPromise(_0x18e6('0x71'),_0x18e6('0x71'),{'event':_0x18e6('0x7c'),'message':_0x427344[_0x18e6('0x2b')]},client9002);return _0x5afe0a;}return null;})['then'](respondWithResult(_0x23ee88,null))['catch'](handleError(_0x23ee88,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index b7b5385..9729d24 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 _0xfe17=['update','remove','emit','hook','events','../../mysqldb','ChatMessage','setMaxListeners','save'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0xfe17,0x151));var _0x7fe1=function(_0x964316,_0x487778){_0x964316=_0x964316-0x0;var _0x29c707=_0xfe17[_0x964316];return _0x29c707;};'use strict';var EventEmitter=require(_0x7fe1('0x0'));var ChatMessage=require(_0x7fe1('0x1'))['db'][_0x7fe1('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x7fe1('0x3')](0x0);var events={'afterCreate':_0x7fe1('0x4'),'afterUpdate':_0x7fe1('0x5'),'afterDestroy':_0x7fe1('0x6')};function emitEvent(_0x2ff1e2){return function(_0x1b3e5b,_0x450b3d,_0x418524){ChatMessageEvents[_0x7fe1('0x7')](_0x2ff1e2+':'+_0x1b3e5b['id'],_0x1b3e5b);ChatMessageEvents[_0x7fe1('0x7')](_0x2ff1e2,_0x1b3e5b);_0x418524(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x7fe1('0x8')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0x6b4e=['save','update','hook','exports','events','ChatMessage','setMaxListeners'];(function(_0x1d84d3,_0x4fd845){var _0x2bef2c=function(_0x485be6){while(--_0x485be6){_0x1d84d3['push'](_0x1d84d3['shift']());}};_0x2bef2c(++_0x4fd845);}(_0x6b4e,0x1d9));var _0xe6b4=function(_0x72ae3d,_0x3c1774){_0x72ae3d=_0x72ae3d-0x0;var _0x4ba919=_0x6b4e[_0x72ae3d];return _0x4ba919;};'use strict';var EventEmitter=require(_0xe6b4('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0xe6b4('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xe6b4('0x2')](0x0);var events={'afterCreate':_0xe6b4('0x3'),'afterUpdate':_0xe6b4('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3818d0){return function(_0x4e1b4b,_0x404baf,_0x387da7){ChatMessageEvents['emit'](_0x3818d0+':'+_0x4e1b4b['id'],_0x4e1b4b);ChatMessageEvents['emit'](_0x3818d0,_0x4e1b4b);_0x387da7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xe6b4('0x5')](e,emitEvent(event));}}module[_0xe6b4('0x6')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index dcdcb43..51e9073 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 _0x3488=['isNil','ChatInteraction','findOne','ChatInteractionId','then','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','../../config/environment','./chatMessage.attributes','exports','ChatMessage','chat_messages','fti_chat_messages','body','direction','toLowerCase','out'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x3488,0x1b2));var _0x8348=function(_0x3f95d2,_0x486845){_0x3f95d2=_0x3f95d2-0x0;var _0xa15508=_0x3488[_0x3f95d2];return _0xa15508;};'use strict';var _=require(_0x8348('0x0'));var util=require(_0x8348('0x1'));var logger=require('../../config/logger')(_0x8348('0x2'));var moment=require(_0x8348('0x3'));var BPromise=require(_0x8348('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8348('0x5'));var rimraf=require('rimraf');var config=require(_0x8348('0x6'));var attributes=require(_0x8348('0x7'));module[_0x8348('0x8')]=function(_0x226856,_0x405f88){return _0x226856['define'](_0x8348('0x9'),attributes,{'tableName':_0x8348('0xa'),'paranoid':![],'indexes':[{'name':_0x8348('0xb'),'fields':[_0x8348('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x90d88a,_0xe8e0c2,_0x59eb87){var _0x151079=_0x226856['models'];var _0x5868a2=_0x90d88a['get']({'plain':!![]});if(_0x5868a2['direction']['toLowerCase']()==='in'||_0x5868a2[_0x8348('0xd')][_0x8348('0xe')]()===_0x8348('0xf')&&!_0x5868a2['secret']&&!_[_0x8348('0x10')](_0x5868a2['UserId'])){_0x151079[_0x8348('0x11')][_0x8348('0x12')]({'where':{'id':_0x5868a2[_0x8348('0x13')]}})[_0x8348('0x14')](function(_0x4d98a4){if(_0x4d98a4){_0x4d98a4['update']({'lastMsgAt':_0x5868a2[_0x8348('0x15')],'lastMsgDirection':_0x5868a2['direction'][_0x8348('0xe')]()});}})['catch'](function(_0x22ec9d){console[_0x8348('0x16')](_0x22ec9d);});}_0x59eb87();}},'charset':_0x8348('0x17'),'collate':_0x8348('0x18')});}; \ No newline at end of file +var _0x22c8=['ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','utf8mb4','utf8mb4_unicode_ci','lodash','bluebird','request-promise','../../config/environment','./chatMessage.attributes','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId'];(function(_0x5becdc,_0x366503){var _0x2c5786=function(_0x2f9993){while(--_0x2f9993){_0x5becdc['push'](_0x5becdc['shift']());}};_0x2c5786(++_0x366503);}(_0x22c8,0x92));var _0x822c=function(_0x1dac7a,_0x1828ce){_0x1dac7a=_0x1dac7a-0x0;var _0x4cb363=_0x22c8[_0x1dac7a];return _0x4cb363;};'use strict';var _=require(_0x822c('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x822c('0x1'));var rp=require(_0x822c('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x822c('0x3'));var attributes=require(_0x822c('0x4'));module['exports']=function(_0x5d32af,_0x4c0f94){return _0x5d32af['define']('ChatMessage',attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x822c('0x5'),'fields':[_0x822c('0x6')],'type':_0x822c('0x7')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xa050d3,_0x1a1ee4,_0x2fab88){var _0x4e7838=_0x5d32af[_0x822c('0x8')];var _0x28e9a2=_0xa050d3[_0x822c('0x9')]({'plain':!![]});if(_0x28e9a2[_0x822c('0xa')][_0x822c('0xb')]()==='in'||_0x28e9a2[_0x822c('0xa')][_0x822c('0xb')]()===_0x822c('0xc')&&!_0x28e9a2[_0x822c('0xd')]&&!_['isNil'](_0x28e9a2[_0x822c('0xe')])){_0x4e7838[_0x822c('0xf')][_0x822c('0x10')]({'where':{'id':_0x28e9a2[_0x822c('0x11')]}})[_0x822c('0x12')](function(_0x4b9702){if(_0x4b9702){_0x4b9702[_0x822c('0x13')]({'lastMsgAt':_0x28e9a2[_0x822c('0x14')],'lastMsgDirection':_0x28e9a2[_0x822c('0xa')][_0x822c('0xb')]()});}})['catch'](function(_0x17a8ee){console['error'](_0x17a8ee);});}_0x2fab88();}},'charset':_0x822c('0x15'),'collate':_0x822c('0x16')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 4bc2387..66d58a2 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 _0xe2af=['ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateChatMessage','create','options','raw','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info'];(function(_0x533437,_0x4d59d1){var _0x53f4ce=function(_0x483f6b){while(--_0x483f6b){_0x533437['push'](_0x533437['shift']());}};_0x53f4ce(++_0x4d59d1);}(_0xe2af,0x178));var _0xfe2a=function(_0x1b177a,_0x5e5043){_0x1b177a=_0x1b177a-0x0;var _0x557e29=_0xe2af[_0x1b177a];return _0x557e29;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfe2a('0x0'));var BPromise=require('bluebird');var rs=require(_0xfe2a('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfe2a('0x2'));var logger=require(_0xfe2a('0x3'))(_0xfe2a('0x4'));var config=require(_0xfe2a('0x5'));var jayson=require(_0xfe2a('0x6'));var client=jayson[_0xfe2a('0x7')][_0xfe2a('0x8')]({'port':0x232a});config[_0xfe2a('0x9')]=_[_0xfe2a('0xa')](config['redis'],{'host':_0xfe2a('0xb'),'port':0x18eb});var socket=require(_0xfe2a('0xc'))(new Redis(config['redis']));require('./chatMessage.socket')['register'](socket);function respondWithRpcPromise(_0x5e00e2,_0x618c88,_0x19d3cd){return new BPromise(function(_0x3c1e2b,_0x5dc510){return client[_0xfe2a('0xd')](_0x5e00e2,_0x19d3cd)[_0xfe2a('0xe')](function(_0x47a080){logger[_0xfe2a('0xf')](_0xfe2a('0x10'),_0x618c88,_0xfe2a('0x11'));logger['debug'](_0xfe2a('0x12'),_0x618c88,_0xfe2a('0x11'),JSON[_0xfe2a('0x13')](_0x47a080));if(_0x47a080[_0xfe2a('0x14')]){if(_0x47a080[_0xfe2a('0x14')]['code']===0x1f4){logger[_0xfe2a('0x14')]('ChatMessage,\x20%s,\x20%s',_0x618c88,_0x47a080[_0xfe2a('0x14')][_0xfe2a('0x15')]);return _0x5dc510(_0x47a080[_0xfe2a('0x14')][_0xfe2a('0x15')]);}logger[_0xfe2a('0x14')](_0xfe2a('0x10'),_0x618c88,_0x47a080['error']['message']);return _0x3c1e2b(_0x47a080[_0xfe2a('0x14')]['message']);}else{logger['info'](_0xfe2a('0x10'),_0x618c88,_0xfe2a('0x11'));_0x3c1e2b(_0x47a080[_0xfe2a('0x16')][_0xfe2a('0x15')]);}})[_0xfe2a('0x17')](function(_0x5966c5){logger[_0xfe2a('0x14')](_0xfe2a('0x10'),_0x618c88,_0x5966c5);_0x5dc510(_0x5966c5);});});}exports[_0xfe2a('0x18')]=function(_0x29bd4f){var _0x34882a=this;return new Promise(function(_0x28dfc0,_0x1892be){return db['ChatMessage'][_0xfe2a('0x19')](_0x29bd4f['body'],{'raw':_0x29bd4f[_0xfe2a('0x1a')]?_0x29bd4f[_0xfe2a('0x1a')][_0xfe2a('0x1b')]===undefined?!![]:![]:!![]})[_0xfe2a('0xe')](function(_0xc3b589){logger[_0xfe2a('0xf')]('CreateChatMessage',_0x29bd4f);logger['debug'](_0xfe2a('0x18'),_0x29bd4f,JSON[_0xfe2a('0x13')](_0xc3b589));_0x28dfc0(_0xc3b589);})['catch'](function(_0x10504e){logger[_0xfe2a('0x14')](_0xfe2a('0x18'),_0x10504e[_0xfe2a('0x15')],_0x29bd4f);_0x1892be(_0x34882a[_0xfe2a('0x14')](0x1f4,_0x10504e[_0xfe2a('0x15')]));});});}; \ No newline at end of file +var _0x71cc=['CreateChatMessage','debug','stringify','catch','util','bluebird','ioredis','../../config/logger','jayson/promise','client','redis','./chatMessage.socket','request','info','ChatMessage,\x20%s,\x20%s','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','ChatMessage','body','options','then'];(function(_0x5e8989,_0xf220a7){var _0x2142a8=function(_0x35b16c){while(--_0x35b16c){_0x5e8989['push'](_0x5e8989['shift']());}};_0x2142a8(++_0xf220a7);}(_0x71cc,0x174));var _0xc71c=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x71cc[_0x5f09c5];return _0x426ad9;};'use strict';var _=require('lodash');var util=require(_0xc71c('0x0'));var moment=require('moment');var BPromise=require(_0xc71c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc71c('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc71c('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc71c('0x4'));var client=jayson[_0xc71c('0x5')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xc71c('0x6')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc71c('0x6')]));require(_0xc71c('0x7'))['register'](socket);function respondWithRpcPromise(_0x5d0359,_0x4dbb17,_0xaba4ee){return new BPromise(function(_0x3f7082,_0x85bad3){return client[_0xc71c('0x8')](_0x5d0359,_0xaba4ee)['then'](function(_0x3d4e9b){logger[_0xc71c('0x9')](_0xc71c('0xa'),_0x4dbb17,'request\x20sent');logger['debug'](_0xc71c('0xb'),_0x4dbb17,_0xc71c('0xc'),JSON['stringify'](_0x3d4e9b));if(_0x3d4e9b[_0xc71c('0xd')]){if(_0x3d4e9b[_0xc71c('0xd')]['code']===0x1f4){logger[_0xc71c('0xd')](_0xc71c('0xa'),_0x4dbb17,_0x3d4e9b['error'][_0xc71c('0xe')]);return _0x85bad3(_0x3d4e9b[_0xc71c('0xd')][_0xc71c('0xe')]);}logger[_0xc71c('0xd')](_0xc71c('0xa'),_0x4dbb17,_0x3d4e9b[_0xc71c('0xd')][_0xc71c('0xe')]);return _0x3f7082(_0x3d4e9b[_0xc71c('0xd')][_0xc71c('0xe')]);}else{logger[_0xc71c('0x9')](_0xc71c('0xa'),_0x4dbb17,_0xc71c('0xc'));_0x3f7082(_0x3d4e9b['result'][_0xc71c('0xe')]);}})['catch'](function(_0x3207eb){logger['error']('ChatMessage,\x20%s,\x20%s',_0x4dbb17,_0x3207eb);_0x85bad3(_0x3207eb);});});}exports['CreateChatMessage']=function(_0x4e243c){var _0x1f0880=this;return new Promise(function(_0x5e4087,_0x186019){return db[_0xc71c('0xf')]['create'](_0x4e243c[_0xc71c('0x10')],{'raw':_0x4e243c[_0xc71c('0x11')]?_0x4e243c[_0xc71c('0x11')]['raw']===undefined?!![]:![]:!![]})[_0xc71c('0x12')](function(_0x179b91){logger[_0xc71c('0x9')](_0xc71c('0x13'),_0x4e243c);logger[_0xc71c('0x14')](_0xc71c('0x13'),_0x4e243c,JSON[_0xc71c('0x15')](_0x179b91));_0x5e4087(_0x179b91);})[_0xc71c('0x16')](function(_0xb4af1){logger[_0xc71c('0xd')]('CreateChatMessage',_0xb4af1[_0xc71c('0xe')],_0x4e243c);_0x186019(_0x1f0880[_0xc71c('0xd')](0x1f4,_0xb4af1[_0xc71c('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index b6bbc44..157153f 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 _0xe2fe=['update','emit','register','length','./chatMessage.events'];(function(_0x19181d,_0x430209){var _0x5bf00d=function(_0x159f49){while(--_0x159f49){_0x19181d['push'](_0x19181d['shift']());}};_0x5bf00d(++_0x430209);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var ChatMessageEvents=require(_0xee2f('0x0'));var events=['save','remove',_0xee2f('0x1')];function createListener(_0x5e18ae,_0x169cf9){return function(_0x1b6f4c){_0x169cf9[_0xee2f('0x2')](_0x5e18ae,_0x1b6f4c);};}function removeListener(_0x2d2b03,_0xcb45e6){return function(){ChatMessageEvents['removeListener'](_0x2d2b03,_0xcb45e6);};}exports[_0xee2f('0x3')]=function(_0x2b7e7c){for(var _0x49926b=0x0,_0x1533a0=events[_0xee2f('0x4')];_0x49926b<_0x1533a0;_0x49926b++){var _0x5a7975=events[_0x49926b];var _0x3c4095=createListener('chatMessage:'+_0x5a7975,_0x2b7e7c);ChatMessageEvents['on'](_0x5a7975,_0x3c4095);}}; \ No newline at end of file +var _0x687b=['update','emit','removeListener','register','length','chatMessage:','./chatMessage.events','save','remove'];(function(_0x209b06,_0x2be741){var _0xacc50f=function(_0x3fba09){while(--_0x3fba09){_0x209b06['push'](_0x209b06['shift']());}};_0xacc50f(++_0x2be741);}(_0x687b,0x14a));var _0xb687=function(_0x16dbab,_0x3ac1e1){_0x16dbab=_0x16dbab-0x0;var _0x59b0b2=_0x687b[_0x16dbab];return _0x59b0b2;};'use strict';var ChatMessageEvents=require(_0xb687('0x0'));var events=[_0xb687('0x1'),_0xb687('0x2'),_0xb687('0x3')];function createListener(_0x5d8563,_0x5e5f06){return function(_0x35069a){_0x5e5f06[_0xb687('0x4')](_0x5d8563,_0x35069a);};}function removeListener(_0x36c468,_0x31bd0d){return function(){ChatMessageEvents[_0xb687('0x5')](_0x36c468,_0x31bd0d);};}exports[_0xb687('0x6')]=function(_0x16ccf3){for(var _0xf43a1f=0x0,_0x47ffea=events[_0xb687('0x7')];_0xf43a1f<_0x47ffea;_0xf43a1f++){var _0x48942b=events[_0xf43a1f];var _0x2aea59=createListener(_0xb687('0x8')+_0x48942b,_0x16ccf3);ChatMessageEvents['on'](_0x48942b,_0x2aea59);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 4b8e5d0..cb0cb71 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 _0x50d3=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','index','get','/describe','isAuthenticated','describe','/:id','show','post','tracked','chatmessage:create','create','put','update','/:id/accept','reject','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x23022b,_0x1da268){var _0x245f0b=function(_0x4599a6){while(--_0x4599a6){_0x23022b['push'](_0x23022b['shift']());}};_0x245f0b(++_0x1da268);}(_0x50d3,0xdb));var _0x350d=function(_0x9729d7,_0x1b79a8){_0x9729d7=_0x9729d7-0x0;var _0x3c4ac6=_0x50d3[_0x9729d7];return _0x3c4ac6;};'use strict';var multer=require(_0x350d('0x0'));var util=require(_0x350d('0x1'));var path=require(_0x350d('0x2'));var timeout=require(_0x350d('0x3'));var express=require(_0x350d('0x4'));var router=express[_0x350d('0x5')]();var auth=require(_0x350d('0x6'));var interaction=require(_0x350d('0x7'));var config=require(_0x350d('0x8'));var controller=require(_0x350d('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x350d('0xa')]);router[_0x350d('0xb')](_0x350d('0xc'),auth[_0x350d('0xd')](),controller[_0x350d('0xe')]);router[_0x350d('0xb')](_0x350d('0xf'),auth[_0x350d('0xd')](),controller[_0x350d('0x10')]);router[_0x350d('0x11')]('/',auth[_0x350d('0xd')](),interaction[_0x350d('0x12')]('chat',_0x350d('0x13')),controller[_0x350d('0x14')]);router[_0x350d('0x15')](_0x350d('0xf'),controller[_0x350d('0x16')]);router[_0x350d('0x15')](_0x350d('0x17'),auth[_0x350d('0xd')](),controller['accept']);router[_0x350d('0x15')]('/:id/reject',auth[_0x350d('0xd')](),controller[_0x350d('0x18')]);router[_0x350d('0x19')](_0x350d('0xf'),auth['isAuthenticated'](),controller[_0x350d('0x1a')]);module[_0x350d('0x1b')]=router; \ No newline at end of file +var _0x29cd=['put','update','/:id/accept','accept','/:id/reject','destroy','multer','util','path','connect-timeout','express','Router','../../config/environment','./chatMessage.controller','get','index','isAuthenticated','describe','/:id','show','post','tracked','chat','chatmessage:create'];(function(_0x173da9,_0x41a35d){var _0x11c2e1=function(_0x2a31fb){while(--_0x2a31fb){_0x173da9['push'](_0x173da9['shift']());}};_0x11c2e1(++_0x41a35d);}(_0x29cd,0x10e));var _0xd29c=function(_0x1c1a6b,_0x846b2b){_0x1c1a6b=_0x1c1a6b-0x0;var _0x3784ee=_0x29cd[_0x1c1a6b];return _0x3784ee;};'use strict';var multer=require(_0xd29c('0x0'));var util=require(_0xd29c('0x1'));var path=require(_0xd29c('0x2'));var timeout=require(_0xd29c('0x3'));var express=require(_0xd29c('0x4'));var router=express[_0xd29c('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd29c('0x6'));var controller=require(_0xd29c('0x7'));router[_0xd29c('0x8')]('/',auth['isAuthenticated'](),controller[_0xd29c('0x9')]);router[_0xd29c('0x8')]('/describe',auth[_0xd29c('0xa')](),controller[_0xd29c('0xb')]);router[_0xd29c('0x8')](_0xd29c('0xc'),auth['isAuthenticated'](),controller[_0xd29c('0xd')]);router[_0xd29c('0xe')]('/',auth[_0xd29c('0xa')](),interaction[_0xd29c('0xf')](_0xd29c('0x10'),_0xd29c('0x11')),controller['create']);router[_0xd29c('0x12')](_0xd29c('0xc'),controller[_0xd29c('0x13')]);router[_0xd29c('0x12')](_0xd29c('0x14'),auth[_0xd29c('0xa')](),controller[_0xd29c('0x15')]);router[_0xd29c('0x12')](_0xd29c('0x16'),auth[_0xd29c('0xa')](),controller['reject']);router['delete']('/:id',auth[_0xd29c('0xa')](),controller[_0xd29c('0x17')]);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 c32d299..8156b2f 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 _0x2d1c=['TEXT','medium','sequelize','exports'];(function(_0x1c5d43,_0x319c6c){var _0x508385=function(_0xac81ce){while(--_0xac81ce){_0x1c5d43['push'](_0x1c5d43['shift']());}};_0x508385(++_0x319c6c);}(_0x2d1c,0xaa));var _0xc2d1=function(_0x2a7007,_0x599527){_0x2a7007=_0x2a7007-0x0;var _0x2b6f17=_0x2d1c[_0x2a7007];return _0x2b6f17;};'use strict';var Sequelize=require(_0xc2d1('0x0'));module[_0xc2d1('0x1')]={'body':{'type':Sequelize[_0xc2d1('0x2')](_0xc2d1('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0x23a8=['sequelize','exports','medium'];(function(_0x1e7ead,_0x7f6227){var _0x3912b2=function(_0x1eeb03){while(--_0x1eeb03){_0x1e7ead['push'](_0x1e7ead['shift']());}};_0x3912b2(++_0x7f6227);}(_0x23a8,0x186));var _0x823a=function(_0x3e9e76,_0x5cb4b1){_0x3e9e76=_0x3e9e76-0x0;var _0x5e8cf3=_0x23a8[_0x3e9e76];return _0x5e8cf3;};'use strict';var Sequelize=require(_0x823a('0x0'));module[_0x823a('0x1')]={'body':{'type':Sequelize['TEXT'](_0x823a('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 45c81bd..6a8e856 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 _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','ChatOfflineMessage','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(_0x20d4e7,_0x5f29f7){var _0x125131=function(_0x10dc57){while(--_0x10dc57){_0x20d4e7['push'](_0x20d4e7['shift']());}};_0x125131(++_0x5f29f7);}(_0x814b,0x1a2));var _0xb814=function(_0x9adcd6,_0x36278b){_0x9adcd6=_0x9adcd6-0x0;var _0xdf8ff2=_0x814b[_0x9adcd6];return _0xdf8ff2;};'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['ChatOfflineMessage'][_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['ChatOfflineMessage'][_0xb814('0x1e')](_0x4d308a)[_0xb814('0x27')](function(_0x38cdc2){_0x5a6291[_0xb814('0x1e')]=_0x38cdc2;if(_0x32ed56['query']['includeAll']){_0x3f0150[_0xb814('0x41')]=[{'all':!![]}];}return db['ChatOfflineMessage'][_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['ChatOfflineMessage'][_0xb814('0x4c')]()['then'](respondWithResult(_0xf27a6e,null))[_0xb814('0x44')](handleError(_0xf27a6e,null));}; \ No newline at end of file +var _0xb091=['filter','where','merge','VIRTUAL','rows','catch','show','params','includeAll','include','options','create','body','destroy','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','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','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','stack','name','send','index','map','ChatOfflineMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort'];(function(_0x2fb511,_0x41cf72){var _0x44d001=function(_0x49f2cb){while(--_0x49f2cb){_0x2fb511['push'](_0x2fb511['shift']());}};_0x44d001(++_0x41cf72);}(_0xb091,0x16e));var _0x1b09=function(_0x5d081a,_0x2a808c){_0x5d081a=_0x5d081a-0x0;var _0x45aee3=_0xb091[_0x5d081a];return _0x45aee3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1b09('0x0'));var rimraf=require(_0x1b09('0x1'));var zipdir=require(_0x1b09('0x2'));var jsonpatch=require(_0x1b09('0x3'));var rp=require('request-promise');var moment=require(_0x1b09('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1b09('0x5'));var path=require(_0x1b09('0x6'));var sox=require('sox');var csv=require(_0x1b09('0x7'));var ejs=require(_0x1b09('0x8'));var fs=require('fs');var _=require(_0x1b09('0x9'));var squel=require('squel');var crypto=require(_0x1b09('0xa'));var jsforce=require(_0x1b09('0xb'));var deskjs=require(_0x1b09('0xc'));var toCsv=require(_0x1b09('0x7'));var querystring=require(_0x1b09('0xd'));var Papa=require(_0x1b09('0xe'));var Redis=require(_0x1b09('0xf'));var authService=require(_0x1b09('0x10'));var qs=require(_0x1b09('0x11'));var as=require(_0x1b09('0x12'));var hardwareService=require(_0x1b09('0x13'));var logger=require('../../config/logger')(_0x1b09('0x14'));var utils=require(_0x1b09('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3839d9,_0x4284ad){_0x4284ad=_0x4284ad||0xcc;return function(_0x3ae4a0){if(_0x3ae4a0){return _0x3839d9[_0x1b09('0x16')](_0x4284ad);}return _0x3839d9[_0x1b09('0x17')](_0x4284ad)[_0x1b09('0x18')]();};}function respondWithResult(_0x1fd3bc,_0x58392d){_0x58392d=_0x58392d||0xc8;return function(_0x37fdb2){if(_0x37fdb2){return _0x1fd3bc['status'](_0x58392d)[_0x1b09('0x19')](_0x37fdb2);}};}function respondWithFilteredResult(_0x27a731,_0x11ab46){return function(_0x37673e){if(_0x37673e){var _0x10b7eb=_0x37673e[_0x1b09('0x1a')],_0x1dc96b=_0x11ab46[_0x1b09('0x1b')],_0x64689a=_0x11ab46[_0x1b09('0x1b')]+_0x11ab46[_0x1b09('0x1c')],_0x33129b;if(_0x64689a>=_0x10b7eb){_0x64689a=_0x10b7eb;_0x33129b=0xc8;}else{_0x33129b=0xce;}_0x27a731[_0x1b09('0x17')](_0x33129b);return _0x27a731['set'](_0x1b09('0x1d'),_0x1dc96b+'-'+_0x64689a+'/'+_0x10b7eb)[_0x1b09('0x19')](_0x37673e);}return null;};}function patchUpdates(_0x5483ef){return function(_0x5cf855){try{jsonpatch[_0x1b09('0x1e')](_0x5cf855,_0x5483ef,!![]);}catch(_0x5debd9){return BPromise[_0x1b09('0x1f')](_0x5debd9);}return _0x5cf855['save']();};}function saveUpdates(_0x136697,_0x4b2eab){return function(_0x2d6dba){if(_0x2d6dba){return _0x2d6dba[_0x1b09('0x20')](_0x136697)[_0x1b09('0x21')](function(_0x24889f){return _0x24889f;});}return null;};}function removeEntity(_0x363e78,_0x39e569){return function(_0x48b803){if(_0x48b803){return _0x48b803['destroy']()[_0x1b09('0x21')](function(){_0x363e78[_0x1b09('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c0496,_0x11d0d5){return function(_0x6e132c){if(!_0x6e132c){_0x3c0496[_0x1b09('0x16')](0x194);}return _0x6e132c;};}function handleError(_0x5a9677,_0xe0d931){_0xe0d931=_0xe0d931||0x1f4;return function(_0x15be49){logger['error'](_0x15be49[_0x1b09('0x22')]);if(_0x15be49[_0x1b09('0x23')]){delete _0x15be49['name'];}_0x5a9677[_0x1b09('0x17')](_0xe0d931)[_0x1b09('0x24')](_0x15be49);};}exports[_0x1b09('0x25')]=function(_0x1b8aaa,_0x547fbb){var _0xb3cf07={},_0x3cdbc5={},_0x532589={'count':0x0,'rows':[]};var _0x2d1ec0=_[_0x1b09('0x26')](db[_0x1b09('0x27')][_0x1b09('0x28')],function(_0x11098e){return{'name':_0x11098e[_0x1b09('0x29')],'type':_0x11098e[_0x1b09('0x2a')]['key']};});_0x3cdbc5[_0x1b09('0x2b')]=_[_0x1b09('0x26')](_0x2d1ec0,'name');_0x3cdbc5[_0x1b09('0x2c')]=_[_0x1b09('0x2d')](_0x1b8aaa[_0x1b09('0x2c')]);_0x3cdbc5[_0x1b09('0x2e')]=_[_0x1b09('0x2f')](_0x3cdbc5['model'],_0x3cdbc5[_0x1b09('0x2c')]);_0xb3cf07['attributes']=_[_0x1b09('0x2f')](_0x3cdbc5['model'],qs[_0x1b09('0x30')](_0x1b8aaa[_0x1b09('0x2c')][_0x1b09('0x30')]));_0xb3cf07[_0x1b09('0x31')]=_0xb3cf07[_0x1b09('0x31')][_0x1b09('0x32')]?_0xb3cf07[_0x1b09('0x31')]:_0x3cdbc5[_0x1b09('0x2b')];if(!_0x1b8aaa[_0x1b09('0x2c')][_0x1b09('0x33')]('nolimit')){_0xb3cf07[_0x1b09('0x1c')]=qs[_0x1b09('0x1c')](_0x1b8aaa[_0x1b09('0x2c')]['limit']);_0xb3cf07[_0x1b09('0x1b')]=qs[_0x1b09('0x1b')](_0x1b8aaa[_0x1b09('0x2c')][_0x1b09('0x1b')]);}_0xb3cf07[_0x1b09('0x34')]=qs[_0x1b09('0x35')](_0x1b8aaa[_0x1b09('0x2c')][_0x1b09('0x35')]);_0xb3cf07['where']=qs[_0x1b09('0x2e')](_['pick'](_0x1b8aaa[_0x1b09('0x2c')],_0x3cdbc5['filters']),_0x2d1ec0);if(_0x1b8aaa[_0x1b09('0x2c')][_0x1b09('0x36')]){_0xb3cf07[_0x1b09('0x37')]=_[_0x1b09('0x38')](_0xb3cf07[_0x1b09('0x37')],{'$or':_[_0x1b09('0x26')](_0x2d1ec0,function(_0x659067){if(_0x659067[_0x1b09('0x2a')]!==_0x1b09('0x39')){var _0x68fbfb={};_0x68fbfb[_0x659067[_0x1b09('0x23')]]={'$like':'%'+_0x1b8aaa[_0x1b09('0x2c')][_0x1b09('0x36')]+'%'};return _0x68fbfb;}})});}_0xb3cf07=_['merge']({},_0xb3cf07,_0x1b8aaa['options']);var _0x23ce9a={'where':_0xb3cf07[_0x1b09('0x37')]};return db[_0x1b09('0x27')][_0x1b09('0x1a')](_0x23ce9a)[_0x1b09('0x21')](function(_0x219258){_0x532589[_0x1b09('0x1a')]=_0x219258;if(_0x1b8aaa[_0x1b09('0x2c')]['includeAll']){_0xb3cf07['include']=[{'all':!![]}];}return db[_0x1b09('0x27')]['findAll'](_0xb3cf07);})[_0x1b09('0x21')](function(_0x31dbfd){_0x532589[_0x1b09('0x3a')]=_0x31dbfd;return _0x532589;})['then'](respondWithFilteredResult(_0x547fbb,_0xb3cf07))[_0x1b09('0x3b')](handleError(_0x547fbb,null));};exports[_0x1b09('0x3c')]=function(_0x202b18,_0x58c7c2){var _0x3edcde={'raw':!![],'where':{'id':_0x202b18[_0x1b09('0x3d')]['id']}},_0x6ae923={};_0x6ae923[_0x1b09('0x2b')]=_['keys'](db[_0x1b09('0x27')][_0x1b09('0x28')]);_0x6ae923['query']=_[_0x1b09('0x2d')](_0x202b18[_0x1b09('0x2c')]);_0x6ae923['filters']=_['intersection'](_0x6ae923['model'],_0x6ae923['query']);_0x3edcde[_0x1b09('0x31')]=_[_0x1b09('0x2f')](_0x6ae923[_0x1b09('0x2b')],qs['fields'](_0x202b18[_0x1b09('0x2c')][_0x1b09('0x30')]));_0x3edcde['attributes']=_0x3edcde[_0x1b09('0x31')][_0x1b09('0x32')]?_0x3edcde[_0x1b09('0x31')]:_0x6ae923[_0x1b09('0x2b')];if(_0x202b18[_0x1b09('0x2c')][_0x1b09('0x3e')]){_0x3edcde[_0x1b09('0x3f')]=[{'all':!![]}];}_0x3edcde=_[_0x1b09('0x38')]({},_0x3edcde,_0x202b18[_0x1b09('0x40')]);return db[_0x1b09('0x27')]['find'](_0x3edcde)[_0x1b09('0x21')](handleEntityNotFound(_0x58c7c2,null))[_0x1b09('0x21')](respondWithResult(_0x58c7c2,null))[_0x1b09('0x3b')](handleError(_0x58c7c2,null));};exports['create']=function(_0x2ab6ca,_0x4bf205){return db[_0x1b09('0x27')][_0x1b09('0x41')](_0x2ab6ca['body'],{})[_0x1b09('0x21')](respondWithResult(_0x4bf205,0xc9))[_0x1b09('0x3b')](handleError(_0x4bf205,null));};exports[_0x1b09('0x20')]=function(_0x25443a,_0x13294c){if(_0x25443a[_0x1b09('0x42')]['id']){delete _0x25443a['body']['id'];}return db[_0x1b09('0x27')]['find']({'where':{'id':_0x25443a[_0x1b09('0x3d')]['id']}})['then'](handleEntityNotFound(_0x13294c,null))['then'](saveUpdates(_0x25443a[_0x1b09('0x42')],null))[_0x1b09('0x21')](respondWithResult(_0x13294c,null))[_0x1b09('0x3b')](handleError(_0x13294c,null));};exports[_0x1b09('0x43')]=function(_0x66ca28,_0x3e7046){return db[_0x1b09('0x27')][_0x1b09('0x44')]({'where':{'id':_0x66ca28['params']['id']}})[_0x1b09('0x21')](handleEntityNotFound(_0x3e7046,null))[_0x1b09('0x21')](removeEntity(_0x3e7046,null))[_0x1b09('0x3b')](handleError(_0x3e7046,null));};exports['describe']=function(_0x55df13,_0x2b7552){return db['ChatOfflineMessage'][_0x1b09('0x45')]()[_0x1b09('0x21')](respondWithResult(_0x2b7552,null))['catch'](handleError(_0x2b7552,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 4a617ba..7da5155 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 _0x3667=['request-promise','path','../../config/environment','./chatOfflineMessage.attributes','exports','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x1ca7d5,_0x230f31){var _0x3292ac=function(_0x48a403){while(--_0x48a403){_0x1ca7d5['push'](_0x1ca7d5['shift']());}};_0x3292ac(++_0x230f31);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7366('0x0'));var util=require(_0x7366('0x1'));var logger=require(_0x7366('0x2'))(_0x7366('0x3'));var moment=require(_0x7366('0x4'));var BPromise=require('bluebird');var rp=require(_0x7366('0x5'));var fs=require('fs');var path=require(_0x7366('0x6'));var rimraf=require('rimraf');var config=require(_0x7366('0x7'));var attributes=require(_0x7366('0x8'));module[_0x7366('0x9')]=function(_0x1c0cf4,_0x101e3d){return _0x1c0cf4['define'](_0x7366('0xa'),attributes,{'tableName':_0x7366('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7366('0xc'),'collate':_0x7366('0xd')});}; \ No newline at end of file +var _0x55ca=['request-promise','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','define','chat_offline_messages','utf8mb4','lodash','util','bluebird'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0x55ca,0x126));var _0xa55c=function(_0x2d4a54,_0x1f759f){_0x2d4a54=_0x2d4a54-0x0;var _0x489a0f=_0x55ca[_0x2d4a54];return _0x489a0f;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('ChatOfflineMessage',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa55c('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 51e593f..f74e5bc 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 _0xcbd8=['moment','randomstring','../../mysqldb','../../config/logger','rpc','http','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x6c0123,_0x4c8d3b){var _0x5a87d2=function(_0x1ff614){while(--_0x1ff614){_0x6c0123['push'](_0x6c0123['shift']());}};_0x5a87d2(++_0x4c8d3b);}(_0xcbd8,0xd6));var _0x8cbd=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xcbd8[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x8cbd('0x0'));var util=require(_0x8cbd('0x1'));var moment=require(_0x8cbd('0x2'));var BPromise=require('bluebird');var rs=require(_0x8cbd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8cbd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8cbd('0x5'))(_0x8cbd('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x8cbd('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2ce5c1,_0x4e219d,_0x3e0e6f){return new BPromise(function(_0x2c4066,_0x403a4d){return client['request'](_0x2ce5c1,_0x3e0e6f)['then'](function(_0x2a0a47){logger[_0x8cbd('0x8')](_0x8cbd('0x9'),_0x4e219d,_0x8cbd('0xa'));logger['debug'](_0x8cbd('0xb'),_0x4e219d,_0x8cbd('0xa'),JSON[_0x8cbd('0xc')](_0x2a0a47));if(_0x2a0a47[_0x8cbd('0xd')]){if(_0x2a0a47[_0x8cbd('0xd')][_0x8cbd('0xe')]===0x1f4){logger[_0x8cbd('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x4e219d,_0x2a0a47['error'][_0x8cbd('0xf')]);return _0x403a4d(_0x2a0a47[_0x8cbd('0xd')][_0x8cbd('0xf')]);}logger[_0x8cbd('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x4e219d,_0x2a0a47[_0x8cbd('0xd')][_0x8cbd('0xf')]);return _0x2c4066(_0x2a0a47[_0x8cbd('0xd')]['message']);}else{logger[_0x8cbd('0x8')]('ChatOfflineMessage,\x20%s,\x20%s',_0x4e219d,_0x8cbd('0xa'));_0x2c4066(_0x2a0a47[_0x8cbd('0x10')]['message']);}})[_0x8cbd('0x11')](function(_0x239f63){logger[_0x8cbd('0xd')](_0x8cbd('0x9'),_0x4e219d,_0x239f63);_0x403a4d(_0x239f63);});});} \ No newline at end of file +var _0x0864=['../../config/environment','client','http','request','then','info','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatOfflineMessage,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0864,0x1b0));var _0x4086=function(_0x1ee9fd,_0x544844){_0x1ee9fd=_0x1ee9fd-0x0;var _0x181295=_0x0864[_0x1ee9fd];return _0x181295;};'use strict';var _=require(_0x4086('0x0'));var util=require(_0x4086('0x1'));var moment=require(_0x4086('0x2'));var BPromise=require(_0x4086('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4086('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4086('0x5'));var logger=require(_0x4086('0x6'))(_0x4086('0x7'));var config=require(_0x4086('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4086('0x9')][_0x4086('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e07be,_0x29f5df,_0x2c5b78){return new BPromise(function(_0x458e63,_0x544aee){return client[_0x4086('0xb')](_0x3e07be,_0x2c5b78)[_0x4086('0xc')](function(_0x4a76fa){logger[_0x4086('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x29f5df,_0x4086('0xe'));logger[_0x4086('0xf')](_0x4086('0x10'),_0x29f5df,_0x4086('0xe'),JSON[_0x4086('0x11')](_0x4a76fa));if(_0x4a76fa[_0x4086('0x12')]){if(_0x4a76fa[_0x4086('0x12')]['code']===0x1f4){logger[_0x4086('0x12')](_0x4086('0x13'),_0x29f5df,_0x4a76fa[_0x4086('0x12')]['message']);return _0x544aee(_0x4a76fa[_0x4086('0x12')][_0x4086('0x14')]);}logger[_0x4086('0x12')](_0x4086('0x13'),_0x29f5df,_0x4a76fa[_0x4086('0x12')][_0x4086('0x14')]);return _0x458e63(_0x4a76fa[_0x4086('0x12')][_0x4086('0x14')]);}else{logger[_0x4086('0xd')](_0x4086('0x13'),_0x29f5df,_0x4086('0xe'));_0x458e63(_0x4a76fa[_0x4086('0x15')][_0x4086('0x14')]);}})['catch'](function(_0xe8febd){logger[_0x4086('0x12')](_0x4086('0x13'),_0x29f5df,_0xe8febd);_0x544aee(_0xe8febd);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 6f056ab..89087ad 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 _0xf7ba=['Router','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','index','/describe','describe','/:id','isAuthenticated','create','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x358d30,_0x1600cd){var _0x28902d=function(_0x37f21a){while(--_0x37f21a){_0x358d30['push'](_0x358d30['shift']());}};_0x28902d(++_0x1600cd);}(_0xf7ba,0x1ea));var _0xaf7b=function(_0x4e726b,_0x4e540b){_0x4e726b=_0x4e726b-0x0;var _0x220f25=_0xf7ba[_0x4e726b];return _0x220f25;};'use strict';var multer=require(_0xaf7b('0x0'));var util=require(_0xaf7b('0x1'));var path=require(_0xaf7b('0x2'));var timeout=require(_0xaf7b('0x3'));var express=require('express');var router=express[_0xaf7b('0x4')]();var auth=require(_0xaf7b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xaf7b('0x6'));var controller=require(_0xaf7b('0x7'));router[_0xaf7b('0x8')]('/',auth['isAuthenticated'](),controller[_0xaf7b('0x9')]);router[_0xaf7b('0x8')](_0xaf7b('0xa'),auth['isAuthenticated'](),controller[_0xaf7b('0xb')]);router[_0xaf7b('0x8')](_0xaf7b('0xc'),auth[_0xaf7b('0xd')](),controller['show']);router['post']('/',auth[_0xaf7b('0xd')](),controller[_0xaf7b('0xe')]);router['put'](_0xaf7b('0xc'),auth[_0xaf7b('0xd')](),controller[_0xaf7b('0xf')]);router[_0xaf7b('0x10')]('/:id',auth[_0xaf7b('0xd')](),controller[_0xaf7b('0x11')]);module[_0xaf7b('0x12')]=router; \ No newline at end of file +var _0xb1d5=['destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','./chatOfflineMessage.controller','get','index','/describe','/:id','isAuthenticated','show','post','create','put','update','delete'];(function(_0x5e1e25,_0xdc1421){var _0x548e5f=function(_0x576360){while(--_0x576360){_0x5e1e25['push'](_0x5e1e25['shift']());}};_0x548e5f(++_0xdc1421);}(_0xb1d5,0x17e));var _0x5b1d=function(_0x1c8c07,_0x2579af){_0x1c8c07=_0x1c8c07-0x0;var _0x4aa88f=_0xb1d5[_0x1c8c07];return _0x4aa88f;};'use strict';var multer=require('multer');var util=require(_0x5b1d('0x0'));var path=require(_0x5b1d('0x1'));var timeout=require(_0x5b1d('0x2'));var express=require(_0x5b1d('0x3'));var router=express[_0x5b1d('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5b1d('0x5'));var controller=require(_0x5b1d('0x6'));router[_0x5b1d('0x7')]('/',auth['isAuthenticated'](),controller[_0x5b1d('0x8')]);router['get'](_0x5b1d('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x5b1d('0x7')](_0x5b1d('0xa'),auth[_0x5b1d('0xb')](),controller[_0x5b1d('0xc')]);router[_0x5b1d('0xd')]('/',auth[_0x5b1d('0xb')](),controller[_0x5b1d('0xe')]);router[_0x5b1d('0xf')](_0x5b1d('0xa'),auth[_0x5b1d('0xb')](),controller[_0x5b1d('0x10')]);router[_0x5b1d('0x11')](_0x5b1d('0xa'),auth[_0x5b1d('0xb')](),controller[_0x5b1d('0x12')]);module[_0x5b1d('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index d3e43a6..e91260c 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 _0x00fa=['mouseOver','timeout','INTEGER','exports','STRING'];(function(_0x40df32,_0x42da36){var _0xb94718=function(_0x3d7f04){while(--_0x3d7f04){_0x40df32['push'](_0x40df32['shift']());}};_0xb94718(++_0x42da36);}(_0x00fa,0xd5));var _0xa00f=function(_0xff3f4a,_0x50f3b4){_0xff3f4a=_0xff3f4a-0x0;var _0x13db8a=_0x00fa[_0xff3f4a];return _0x13db8a;};'use strict';var Sequelize=require('sequelize');module[_0xa00f('0x0')]={'name':{'type':Sequelize[_0xa00f('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xa00f('0x2'),_0xa00f('0x3')),'defaultValue':_0xa00f('0x2')},'selector':{'type':Sequelize[_0xa00f('0x1')]},'timeout':{'type':Sequelize[_0xa00f('0x4')]}}; \ No newline at end of file +var _0x1f07=['STRING','ENUM','mouseOver','timeout','INTEGER','sequelize','exports'];(function(_0x26c905,_0x4c2d24){var _0xb37ad2=function(_0xff7888){while(--_0xff7888){_0x26c905['push'](_0x26c905['shift']());}};_0xb37ad2(++_0x4c2d24);}(_0x1f07,0xc9));var _0x71f0=function(_0xb30531,_0x48bcf9){_0xb30531=_0xb30531-0x0;var _0x249cab=_0x1f07[_0xb30531];return _0x249cab;};'use strict';var Sequelize=require(_0x71f0('0x0'));module[_0x71f0('0x1')]={'name':{'type':Sequelize[_0x71f0('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x71f0('0x3')](_0x71f0('0x4'),_0x71f0('0x5')),'defaultValue':_0x71f0('0x4')},'selector':{'type':Sequelize[_0x71f0('0x2')]},'timeout':{'type':Sequelize[_0x71f0('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index c072492..a7fea0b 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 _0x9c44=['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','params','model','keys','rawAttributes','query','filters','intersection','attributes','length','includeAll','include','merge','options','catch','create','ChatProactiveAction','body','find','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs'];(function(_0x34311c,_0x52a317){var _0x4b8b35=function(_0x16888a){while(--_0x16888a){_0x34311c['push'](_0x34311c['shift']());}};_0x4b8b35(++_0x52a317);}(_0x9c44,0x178));var _0x49c4=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x9c44[_0x32f7d7];return _0x133d09;};'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['show']=function(_0x543ea2,_0x449960){var _0x53c199={'raw':!![],'where':{'id':_0x543ea2[_0x49c4('0x24')]['id']}},_0x3800b7={};_0x3800b7[_0x49c4('0x25')]=_[_0x49c4('0x26')](db['ChatProactiveAction'][_0x49c4('0x27')]);_0x3800b7[_0x49c4('0x28')]=_[_0x49c4('0x26')](_0x543ea2[_0x49c4('0x28')]);_0x3800b7[_0x49c4('0x29')]=_[_0x49c4('0x2a')](_0x3800b7[_0x49c4('0x25')],_0x3800b7[_0x49c4('0x28')]);_0x53c199[_0x49c4('0x2b')]=_[_0x49c4('0x2a')](_0x3800b7[_0x49c4('0x25')],qs['fields'](_0x543ea2['query']['fields']));_0x53c199[_0x49c4('0x2b')]=_0x53c199[_0x49c4('0x2b')][_0x49c4('0x2c')]?_0x53c199[_0x49c4('0x2b')]:_0x3800b7[_0x49c4('0x25')];if(_0x543ea2['query'][_0x49c4('0x2d')]){_0x53c199[_0x49c4('0x2e')]=[{'all':!![]}];}_0x53c199=_[_0x49c4('0x2f')]({},_0x53c199,_0x543ea2[_0x49c4('0x30')]);return db['ChatProactiveAction']['find'](_0x53c199)[_0x49c4('0x20')](handleEntityNotFound(_0x449960,null))[_0x49c4('0x20')](respondWithResult(_0x449960,null))[_0x49c4('0x31')](handleError(_0x449960,null));};exports[_0x49c4('0x32')]=function(_0xd38540,_0x4a0c7a){return db[_0x49c4('0x33')][_0x49c4('0x32')](_0xd38540[_0x49c4('0x34')],{})['then'](respondWithResult(_0x4a0c7a,0xc9))['catch'](handleError(_0x4a0c7a,null));};exports[_0x49c4('0x1f')]=function(_0x1991e9,_0x3bec0a){if(_0x1991e9[_0x49c4('0x34')]['id']){delete _0x1991e9[_0x49c4('0x34')]['id'];}return db[_0x49c4('0x33')][_0x49c4('0x35')]({'where':{'id':_0x1991e9[_0x49c4('0x24')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x3bec0a,null))['then'](saveUpdates(_0x1991e9[_0x49c4('0x34')],null))['then'](respondWithResult(_0x3bec0a,null))[_0x49c4('0x31')](handleError(_0x3bec0a,null));};exports[_0x49c4('0x36')]=function(_0x2625a6,_0x1c2830){return db['ChatProactiveAction'][_0x49c4('0x35')]({'where':{'id':_0x2625a6[_0x49c4('0x24')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x1c2830,null))['then'](removeEntity(_0x1c2830,null))[_0x49c4('0x31')](handleError(_0x1c2830,null));}; \ No newline at end of file +var _0xa9e0=['keys','ChatProactiveAction','rawAttributes','query','filters','attributes','intersection','fields','length','include','options','find','create','body','catch','params','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','show','model'];(function(_0x3ccdf8,_0x584ceb){var _0x243dab=function(_0x1a90d1){while(--_0x1a90d1){_0x3ccdf8['push'](_0x3ccdf8['shift']());}};_0x243dab(++_0x584ceb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={'raw':!![],'where':{'id':_0x526cf3['params']['id']}},_0x45a1e7={};_0x45a1e7[_0x0a9e('0x26')]=_[_0x0a9e('0x27')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x45a1e7[_0x0a9e('0x2a')]=_[_0x0a9e('0x27')](_0x526cf3[_0x0a9e('0x2a')]);_0x45a1e7[_0x0a9e('0x2b')]=_['intersection'](_0x45a1e7[_0x0a9e('0x26')],_0x45a1e7[_0x0a9e('0x2a')]);_0x479bc4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x45a1e7['model'],qs[_0x0a9e('0x2e')](_0x526cf3[_0x0a9e('0x2a')][_0x0a9e('0x2e')]));_0x479bc4[_0x0a9e('0x2c')]=_0x479bc4[_0x0a9e('0x2c')][_0x0a9e('0x2f')]?_0x479bc4[_0x0a9e('0x2c')]:_0x45a1e7[_0x0a9e('0x26')];if(_0x526cf3[_0x0a9e('0x2a')]['includeAll']){_0x479bc4[_0x0a9e('0x30')]=[{'all':!![]}];}_0x479bc4=_['merge']({},_0x479bc4,_0x526cf3[_0x0a9e('0x31')]);return db[_0x0a9e('0x28')][_0x0a9e('0x32')](_0x479bc4)[_0x0a9e('0x1f')](handleEntityNotFound(_0x384319,null))[_0x0a9e('0x1f')](respondWithResult(_0x384319,null))['catch'](handleError(_0x384319,null));};exports[_0x0a9e('0x33')]=function(_0x46f0a5,_0x40cb85){return db[_0x0a9e('0x28')][_0x0a9e('0x33')](_0x46f0a5[_0x0a9e('0x34')],{})[_0x0a9e('0x1f')](respondWithResult(_0x40cb85,0xc9))[_0x0a9e('0x35')](handleError(_0x40cb85,null));};exports['update']=function(_0x44295a,_0x5e7238){if(_0x44295a[_0x0a9e('0x34')]['id']){delete _0x44295a[_0x0a9e('0x34')]['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x32')]({'where':{'id':_0x44295a['params']['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x5e7238,null))[_0x0a9e('0x1f')](saveUpdates(_0x44295a[_0x0a9e('0x34')],null))[_0x0a9e('0x1f')](respondWithResult(_0x5e7238,null))['catch'](handleError(_0x5e7238,null));};exports['destroy']=function(_0x1e8694,_0x5640eb){return db[_0x0a9e('0x28')][_0x0a9e('0x32')]({'where':{'id':_0x1e8694[_0x0a9e('0x36')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x5640eb,null))['then'](removeEntity(_0x5640eb,null))[_0x0a9e('0x35')](handleError(_0x5640eb,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index a7b895d..d6657f0 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 _0xd39e=['define','chat_proactive_actions','lodash','util','moment','bluebird','rimraf','./chatProactiveAction.attributes','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xd39e,0x110));var _0xed39=function(_0x349b5c,_0x55e5fa){_0x349b5c=_0x349b5c-0x0;var _0x3efcac=_0xd39e[_0x349b5c];return _0x3efcac;};'use strict';var _=require(_0xed39('0x0'));var util=require(_0xed39('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xed39('0x2'));var BPromise=require(_0xed39('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xed39('0x4'));var config=require('../../config/environment');var attributes=require(_0xed39('0x5'));module[_0xed39('0x6')]=function(_0x18cc48,_0x431ed1){return _0x18cc48[_0xed39('0x7')]('ChatProactiveAction',attributes,{'tableName':_0xed39('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x28db=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','../../config/logger'];(function(_0x5f375d,_0x2b9724){var _0x46d109=function(_0x3b57a1){while(--_0x3b57a1){_0x5f375d['push'](_0x5f375d['shift']());}};_0x46d109(++_0x2b9724);}(_0x28db,0x18a));var _0xb28d=function(_0x114402,_0x115244){_0x114402=_0x114402-0x0;var _0x2a7456=_0x28db[_0x114402];return _0x2a7456;};'use strict';var _=require(_0xb28d('0x0'));var util=require('util');var logger=require(_0xb28d('0x1'))(_0xb28d('0x2'));var moment=require(_0xb28d('0x3'));var BPromise=require(_0xb28d('0x4'));var rp=require(_0xb28d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb28d('0x6'));var config=require(_0xb28d('0x7'));var attributes=require('./chatProactiveAction.attributes');module[_0xb28d('0x8')]=function(_0x283595,_0x5be921){return _0x283595[_0xb28d('0x9')](_0xb28d('0xa'),attributes,{'tableName':_0xb28d('0xb'),'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 d50c276..32daedd 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 _0x7953=['then','info','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','error','ChatProactiveAction,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request'];(function(_0x56431a,_0x52cc35){var _0x592aaf=function(_0x56e36a){while(--_0x56e36a){_0x56431a['push'](_0x56431a['shift']());}};_0x592aaf(++_0x52cc35);}(_0x7953,0x195));var _0x3795=function(_0x469665,_0x394876){_0x469665=_0x469665-0x0;var _0x291ab5=_0x7953[_0x469665];return _0x291ab5;};'use strict';var _=require(_0x3795('0x0'));var util=require(_0x3795('0x1'));var moment=require(_0x3795('0x2'));var BPromise=require(_0x3795('0x3'));var rs=require(_0x3795('0x4'));var fs=require('fs');var Redis=require(_0x3795('0x5'));var db=require(_0x3795('0x6'))['db'];var utils=require(_0x3795('0x7'));var logger=require(_0x3795('0x8'))(_0x3795('0x9'));var config=require(_0x3795('0xa'));var jayson=require(_0x3795('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x362771,_0x3846a6,_0x2100df){return new BPromise(function(_0x42f208,_0x16b483){return client[_0x3795('0xc')](_0x362771,_0x2100df)[_0x3795('0xd')](function(_0x33824d){logger[_0x3795('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x3846a6,'request\x20sent');logger['debug'](_0x3795('0xf'),_0x3846a6,_0x3795('0x10'),JSON['stringify'](_0x33824d));if(_0x33824d[_0x3795('0x11')]){if(_0x33824d[_0x3795('0x11')]['code']===0x1f4){logger['error'](_0x3795('0x12'),_0x3846a6,_0x33824d['error'][_0x3795('0x13')]);return _0x16b483(_0x33824d['error']['message']);}logger['error'](_0x3795('0x12'),_0x3846a6,_0x33824d[_0x3795('0x11')][_0x3795('0x13')]);return _0x42f208(_0x33824d[_0x3795('0x11')][_0x3795('0x13')]);}else{logger[_0x3795('0xe')](_0x3795('0x12'),_0x3846a6,'request\x20sent');_0x42f208(_0x33824d[_0x3795('0x14')][_0x3795('0x13')]);}})[_0x3795('0x15')](function(_0x4c5038){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x3846a6,_0x4c5038);_0x16b483(_0x4c5038);});});} \ No newline at end of file +var _0x7455=['util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash'];(function(_0x34325b,_0x5e5afe){var _0x3da348=function(_0x3bf709){while(--_0x3bf709){_0x34325b['push'](_0x34325b['shift']());}};_0x3da348(++_0x5e5afe);}(_0x7455,0xe6));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 moment=require(_0x5745('0x2'));var BPromise=require('bluebird');var rs=require(_0x5745('0x3'));var fs=require('fs');var Redis=require(_0x5745('0x4'));var db=require(_0x5745('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5745('0x6'))(_0x5745('0x7'));var config=require(_0x5745('0x8'));var jayson=require(_0x5745('0x9'));var client=jayson[_0x5745('0xa')][_0x5745('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa5b44e,_0x2c0897,_0x1c3bd6){return new BPromise(function(_0x36bc63,_0xb7e0ba){return client[_0x5745('0xc')](_0xa5b44e,_0x1c3bd6)['then'](function(_0x37cf24){logger[_0x5745('0xd')](_0x5745('0xe'),_0x2c0897,'request\x20sent');logger['debug']('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x2c0897,_0x5745('0xf'),JSON[_0x5745('0x10')](_0x37cf24));if(_0x37cf24[_0x5745('0x11')]){if(_0x37cf24['error'][_0x5745('0x12')]===0x1f4){logger[_0x5745('0x11')](_0x5745('0xe'),_0x2c0897,_0x37cf24[_0x5745('0x11')][_0x5745('0x13')]);return _0xb7e0ba(_0x37cf24['error'][_0x5745('0x13')]);}logger[_0x5745('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x2c0897,_0x37cf24['error'][_0x5745('0x13')]);return _0x36bc63(_0x37cf24[_0x5745('0x11')][_0x5745('0x13')]);}else{logger[_0x5745('0xd')](_0x5745('0xe'),_0x2c0897,_0x5745('0xf'));_0x36bc63(_0x37cf24[_0x5745('0x14')][_0x5745('0x13')]);}})['catch'](function(_0x1dfa0e){logger[_0x5745('0x11')](_0x5745('0xe'),_0x2c0897,_0x1dfa0e);_0xb7e0ba(_0x1dfa0e);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index f3a8bc0..6254ef7 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 _0xb6c8=['multer','path','connect-timeout','express','Router','../../components/auth/service','get','/:id','isAuthenticated','show','post','create','put','update','destroy','exports'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0xb6c8,0x180));var _0x8b6c=function(_0x325fa4,_0x1dcf06){_0x325fa4=_0x325fa4-0x0;var _0x5e20a2=_0xb6c8[_0x325fa4];return _0x5e20a2;};'use strict';var multer=require(_0x8b6c('0x0'));var util=require('util');var path=require(_0x8b6c('0x1'));var timeout=require(_0x8b6c('0x2'));var express=require(_0x8b6c('0x3'));var router=express[_0x8b6c('0x4')]();var auth=require(_0x8b6c('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatProactiveAction.controller');router[_0x8b6c('0x6')](_0x8b6c('0x7'),auth[_0x8b6c('0x8')](),controller[_0x8b6c('0x9')]);router[_0x8b6c('0xa')]('/',auth[_0x8b6c('0x8')](),controller[_0x8b6c('0xb')]);router[_0x8b6c('0xc')](_0x8b6c('0x7'),auth[_0x8b6c('0x8')](),controller[_0x8b6c('0xd')]);router['delete'](_0x8b6c('0x7'),auth[_0x8b6c('0x8')](),controller[_0x8b6c('0xe')]);module[_0x8b6c('0xf')]=router; \ No newline at end of file +var _0x4eb6=['/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','post','isAuthenticated','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4eb6,0xf5));var _0x64eb=function(_0xde874c,_0xfa917a){_0xde874c=_0xde874c-0x0;var _0x5a16ee=_0x4eb6[_0xde874c];return _0x5a16ee;};'use strict';var multer=require(_0x64eb('0x0'));var util=require(_0x64eb('0x1'));var path=require('path');var timeout=require(_0x64eb('0x2'));var express=require(_0x64eb('0x3'));var router=express['Router']();var auth=require(_0x64eb('0x4'));var interaction=require(_0x64eb('0x5'));var config=require(_0x64eb('0x6'));var controller=require('./chatProactiveAction.controller');router[_0x64eb('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x64eb('0x8')]('/',auth[_0x64eb('0x9')](),controller['create']);router[_0x64eb('0xa')](_0x64eb('0xb'),auth[_0x64eb('0x9')](),controller[_0x64eb('0xc')]);router[_0x64eb('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x64eb('0xe')]);module[_0x64eb('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 4143697..d3eb0ca 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 _0xc1a7=['exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x21d0c3,_0x16c71c){var _0x4df18e=function(_0x576bfe){while(--_0x576bfe){_0x21d0c3['push'](_0x21d0c3['shift']());}};_0x4df18e(++_0x16c71c);}(_0xc1a7,0x1a6));var _0x7c1a=function(_0x4b5813,_0x5769de){_0x4b5813=_0x4b5813-0x0;var _0x423465=_0xc1a7[_0x4b5813];return _0x423465;};'use strict';var Sequelize=require(_0x7c1a('0x0'));module[_0x7c1a('0x1')]={'name':{'type':Sequelize[_0x7c1a('0x2')],'unique':_0x7c1a('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7c1a('0x2')]},'timeout':{'type':Sequelize[_0x7c1a('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7c1a('0x5')](_0x7c1a('0x6'),_0x7c1a('0x7'),_0x7c1a('0x8'))}}; \ No newline at end of file +var _0x9f2a=['STRING','INTEGER','beepall','roundrobin','sequelize','exports'];(function(_0x2e3b4a,_0x150f8c){var _0x2d2a27=function(_0x47a934){while(--_0x47a934){_0x2e3b4a['push'](_0x2e3b4a['shift']());}};_0x2d2a27(++_0x150f8c);}(_0x9f2a,0xca));var _0xa9f2=function(_0x8e002,_0x35c2fa){_0x8e002=_0x8e002-0x0;var _0x547294=_0x9f2a[_0x8e002];return _0x547294;};'use strict';var Sequelize=require(_0xa9f2('0x0'));module[_0xa9f2('0x1')]={'name':{'type':Sequelize[_0xa9f2('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa9f2('0x2')]},'timeout':{'type':Sequelize[_0xa9f2('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0xa9f2('0x4'),_0xa9f2('0x5'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 87da111..9f888a6 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 _0x3666=['localhost','socket.io-emitter','./chatQueue.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','request\x20sent','error','code','message','ChatQueue,\x20%s,\x20%s','result','catch','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','ChatQueues','UserProfileResource','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','ChatQueue','includeAll','findAll','rows','show','params','length','include','find','user','role','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','ChatQueueId','UserChatQueue','User','UserId','agent','chatPause','updatedAt','createdAt','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','voicePause','interface','flatMap','each','forEach','emit','removeTeams','select','field','tq.TeamId','from','user_has_teams','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','every','TeamId','includes','union','value','transaction','isEmpty','userChatQueue:remove','addAgents','omit','removeAgents','isArray','getAgents','html-pdf','zip-dir','fast-json-patch','request-promise','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0x3666,0x110));var _0x6366=function(_0x36c7da,_0x38dfa7){_0x36c7da=_0x36c7da-0x0;var _0x3a34f4=_0x3666[_0x36c7da];return _0x3a34f4;};'use strict';var pdf=require(_0x6366('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6366('0x1'));var jsonpatch=require(_0x6366('0x2'));var rp=require(_0x6366('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6366('0x4'));var util=require('util');var path=require('path');var sox=require(_0x6366('0x5'));var csv=require(_0x6366('0x6'));var ejs=require(_0x6366('0x7'));var fs=require('fs');var _=require(_0x6366('0x8'));var squel=require(_0x6366('0x9'));var crypto=require(_0x6366('0xa'));var jsforce=require(_0x6366('0xb'));var deskjs=require(_0x6366('0xc'));var toCsv=require(_0x6366('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6366('0xd'));var authService=require(_0x6366('0xe'));var qs=require(_0x6366('0xf'));var as=require(_0x6366('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6366('0x11'))(_0x6366('0x12'));var utils=require(_0x6366('0x13'));var config=require('../../config/environment');var db=require(_0x6366('0x14'))['db'];config[_0x6366('0x15')]=_['defaults'](config[_0x6366('0x15')],{'host':_0x6366('0x16'),'port':0x18eb});var socket=require(_0x6366('0x17'))(new Redis(config[_0x6366('0x15')]));require(_0x6366('0x18'))[_0x6366('0x19')](socket);var jayson=require(_0x6366('0x1a'));var client=jayson[_0x6366('0x1b')][_0x6366('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x461a54,_0x4e93e8,_0x597f92){if(_0x597f92){var _0x3b3a57=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3b3a57[_0x6366('0x1d')](_0x4e93e8)){return _0x461a54;}else{throw new db[(_0x6366('0x1e'))][(_0x6366('0x1f'))](_0x6366('0x20'));}}else{return _0x461a54;}}function respondWithRpcPromise(_0x565d9c,_0x35443d,_0x5bee38,_0x436e3c){return new BPromise(function(_0x4980e1,_0x4d1f14){var _0x49809f=_0x436e3c||client;return _0x49809f[_0x6366('0x21')](_0x565d9c,_0x5bee38)['then'](function(_0x4eb93e){logger['info']('ChatQueue,\x20%s,\x20%s',_0x35443d,_0x6366('0x22'));logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x35443d,_0x6366('0x22'),JSON['stringify'](_0x4eb93e));if(_0x4eb93e['error']){if(_0x4eb93e[_0x6366('0x23')][_0x6366('0x24')]===0x1f4){logger[_0x6366('0x23')]('ChatQueue,\x20%s,\x20%s',_0x35443d,_0x4eb93e[_0x6366('0x23')]['message']);return _0x4d1f14(_0x4eb93e[_0x6366('0x23')][_0x6366('0x25')]);}logger['error'](_0x6366('0x26'),_0x35443d,_0x4eb93e[_0x6366('0x23')][_0x6366('0x25')]);return _0x4980e1(_0x4eb93e[_0x6366('0x23')][_0x6366('0x25')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x35443d,'request\x20sent');_0x4980e1(_0x4eb93e[_0x6366('0x27')][_0x6366('0x25')]);}})[_0x6366('0x28')](function(_0x1357ad){logger[_0x6366('0x23')](_0x6366('0x26'),_0x35443d,_0x1357ad);_0x4d1f14(_0x1357ad);});});}function respondWithStatusCode(_0x35b3e4,_0x5937b2){_0x5937b2=_0x5937b2||0xcc;return function(_0x1d8c47){if(_0x1d8c47){return _0x35b3e4['sendStatus'](_0x5937b2);}return _0x35b3e4[_0x6366('0x29')](_0x5937b2)[_0x6366('0x2a')]();};}function respondWithResult(_0x567cb8,_0x2c65d2){_0x2c65d2=_0x2c65d2||0xc8;return function(_0x589e20){if(_0x589e20){return _0x567cb8[_0x6366('0x29')](_0x2c65d2)['json'](_0x589e20);}};}function respondWithFilteredResult(_0x512e27,_0x304d81){return function(_0x1e7625){if(_0x1e7625){var _0x39521a=_0x1e7625[_0x6366('0x2b')],_0x400faf=_0x304d81[_0x6366('0x2c')],_0x46077b=_0x304d81[_0x6366('0x2c')]+_0x304d81[_0x6366('0x2d')],_0x1d48fb;if(_0x46077b>=_0x39521a){_0x46077b=_0x39521a;_0x1d48fb=0xc8;}else{_0x1d48fb=0xce;}_0x512e27[_0x6366('0x29')](_0x1d48fb);return _0x512e27[_0x6366('0x2e')](_0x6366('0x2f'),_0x400faf+'-'+_0x46077b+'/'+_0x39521a)['json'](_0x1e7625);}return null;};}function patchUpdates(_0x2c6a94){return function(_0x4c1b64){try{jsonpatch[_0x6366('0x30')](_0x4c1b64,_0x2c6a94,!![]);}catch(_0xccbaf1){return BPromise[_0x6366('0x31')](_0xccbaf1);}return _0x4c1b64[_0x6366('0x32')]();};}function saveUpdates(_0x4162e7,_0x29fe67){return function(_0x4937fd){if(_0x4937fd){return _0x4937fd[_0x6366('0x33')](_0x4162e7)[_0x6366('0x34')](function(_0xb29dc2){return _0xb29dc2;});}return null;};}function removeEntity(_0x417ff1,_0x45fe81){return function(_0x18ce35){if(_0x18ce35){return _0x18ce35[_0x6366('0x35')]()[_0x6366('0x34')](function(){var _0x3343e0=_0x18ce35[_0x6366('0x36')]({'plain':!![]});var _0x39bc0a=_0x6366('0x37');return db[_0x6366('0x38')][_0x6366('0x35')]({'where':{'type':_0x39bc0a,'resourceId':_0x3343e0['id']}})[_0x6366('0x34')](function(){return _0x18ce35;});})[_0x6366('0x34')](function(){_0x417ff1['status'](0xcc)[_0x6366('0x2a')]();});}};}function handleEntityNotFound(_0x2a4625,_0xff2d10){return function(_0x282bf3){if(!_0x282bf3){_0x2a4625['sendStatus'](0x194);}return _0x282bf3;};}function handleError(_0x34f282,_0x5e4e09){_0x5e4e09=_0x5e4e09||0x1f4;return function(_0x2a12f8){logger['error'](_0x2a12f8[_0x6366('0x39')]);if(_0x2a12f8['name']){delete _0x2a12f8['name'];}_0x34f282[_0x6366('0x29')](_0x5e4e09)[_0x6366('0x3a')](_0x2a12f8);};}exports[_0x6366('0x3b')]=function(_0x3c4595,_0xe693b4){var _0x2e7cfb={},_0x179d2b={},_0x4dd502={'count':0x0,'rows':[]};var _0x994352=_[_0x6366('0x3c')](db['ChatQueue'][_0x6366('0x3d')],function(_0xc5e432){return{'name':_0xc5e432[_0x6366('0x3e')],'type':_0xc5e432[_0x6366('0x3f')][_0x6366('0x40')]};});_0x179d2b[_0x6366('0x41')]=_[_0x6366('0x3c')](_0x994352,_0x6366('0x42'));_0x179d2b[_0x6366('0x43')]=_[_0x6366('0x44')](_0x3c4595[_0x6366('0x43')]);_0x179d2b[_0x6366('0x45')]=_[_0x6366('0x46')](_0x179d2b[_0x6366('0x41')],_0x179d2b[_0x6366('0x43')]);_0x2e7cfb[_0x6366('0x47')]=_[_0x6366('0x46')](_0x179d2b[_0x6366('0x41')],qs[_0x6366('0x48')](_0x3c4595[_0x6366('0x43')][_0x6366('0x48')]));_0x2e7cfb[_0x6366('0x47')]=_0x2e7cfb[_0x6366('0x47')]['length']?_0x2e7cfb[_0x6366('0x47')]:_0x179d2b[_0x6366('0x41')];if(!_0x3c4595[_0x6366('0x43')][_0x6366('0x49')](_0x6366('0x4a'))){_0x2e7cfb[_0x6366('0x2d')]=qs[_0x6366('0x2d')](_0x3c4595[_0x6366('0x43')][_0x6366('0x2d')]);_0x2e7cfb[_0x6366('0x2c')]=qs['offset'](_0x3c4595['query']['offset']);}_0x2e7cfb[_0x6366('0x4b')]=qs[_0x6366('0x4c')](_0x3c4595[_0x6366('0x43')][_0x6366('0x4c')]);_0x2e7cfb[_0x6366('0x4d')]=qs[_0x6366('0x45')](_[_0x6366('0x4e')](_0x3c4595[_0x6366('0x43')],_0x179d2b[_0x6366('0x45')]),_0x994352);if(_0x3c4595[_0x6366('0x43')][_0x6366('0x4f')]){_0x2e7cfb[_0x6366('0x4d')]=_[_0x6366('0x50')](_0x2e7cfb[_0x6366('0x4d')],{'$or':_[_0x6366('0x3c')](_0x994352,function(_0x2f35b9){if(_0x2f35b9['type']!=='VIRTUAL'){var _0x20fd2a={};_0x20fd2a[_0x2f35b9['name']]={'$like':'%'+_0x3c4595[_0x6366('0x43')][_0x6366('0x4f')]+'%'};return _0x20fd2a;}})});}_0x2e7cfb=_[_0x6366('0x50')]({},_0x2e7cfb,_0x3c4595[_0x6366('0x51')]);var _0x249b11={'where':_0x2e7cfb[_0x6366('0x4d')]};return db[_0x6366('0x52')]['count'](_0x249b11)[_0x6366('0x34')](function(_0x43ecd5){_0x4dd502[_0x6366('0x2b')]=_0x43ecd5;if(_0x3c4595[_0x6366('0x43')][_0x6366('0x53')]){_0x2e7cfb['include']=[{'all':!![]}];}return db['ChatQueue'][_0x6366('0x54')](_0x2e7cfb);})[_0x6366('0x34')](function(_0x314609){_0x4dd502[_0x6366('0x55')]=_0x314609;return _0x4dd502;})['then'](respondWithFilteredResult(_0xe693b4,_0x2e7cfb))[_0x6366('0x28')](handleError(_0xe693b4,null));};exports[_0x6366('0x56')]=function(_0x22f8f0,_0x4bccdf){var _0x6c3b82={'raw':!![],'where':{'id':_0x22f8f0[_0x6366('0x57')]['id']}},_0x134df0={};_0x134df0[_0x6366('0x41')]=_[_0x6366('0x44')](db[_0x6366('0x52')][_0x6366('0x3d')]);_0x134df0['query']=_['keys'](_0x22f8f0[_0x6366('0x43')]);_0x134df0[_0x6366('0x45')]=_[_0x6366('0x46')](_0x134df0[_0x6366('0x41')],_0x134df0['query']);_0x6c3b82[_0x6366('0x47')]=_[_0x6366('0x46')](_0x134df0['model'],qs['fields'](_0x22f8f0[_0x6366('0x43')][_0x6366('0x48')]));_0x6c3b82[_0x6366('0x47')]=_0x6c3b82['attributes'][_0x6366('0x58')]?_0x6c3b82[_0x6366('0x47')]:_0x134df0[_0x6366('0x41')];if(_0x22f8f0[_0x6366('0x43')][_0x6366('0x53')]){_0x6c3b82[_0x6366('0x59')]=[{'all':!![]}];}_0x6c3b82=_[_0x6366('0x50')]({},_0x6c3b82,_0x22f8f0[_0x6366('0x51')]);return db['ChatQueue'][_0x6366('0x5a')](_0x6c3b82)['then'](handleEntityNotFound(_0x4bccdf,null))[_0x6366('0x34')](respondWithResult(_0x4bccdf,null))[_0x6366('0x28')](handleError(_0x4bccdf,null));};exports['create']=function(_0x33cfe6,_0x386183){return db['ChatQueue']['create'](_0x33cfe6['body'],{})[_0x6366('0x34')](function(_0x234edb){var _0x266d1e=_0x33cfe6[_0x6366('0x5b')]['get']({'plain':!![]});if(!_0x266d1e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x266d1e[_0x6366('0x5c')]===_0x6366('0x5b')){var _0x1f10e8=_0x234edb['get']({'plain':!![]});var _0x2ab14b=_0x6366('0x37');return db['UserProfileSection'][_0x6366('0x5a')]({'where':{'name':_0x2ab14b,'userProfileId':_0x266d1e['userProfileId']},'raw':!![]})['then'](function(_0x55a83b){if(_0x55a83b&&_0x55a83b[_0x6366('0x5d')]===0x0){return db[_0x6366('0x38')][_0x6366('0x5e')]({'name':_0x1f10e8[_0x6366('0x42')],'resourceId':_0x1f10e8['id'],'type':_0x55a83b['name'],'sectionId':_0x55a83b['id']},{})['then'](function(){return _0x234edb;});}else{return _0x234edb;}})[_0x6366('0x28')](function(_0x235226){logger[_0x6366('0x23')](_0x6366('0x5f'),_0x235226);throw _0x235226;});}return _0x234edb;})[_0x6366('0x34')](respondWithResult(_0x386183,0xc9))[_0x6366('0x28')](handleError(_0x386183,null));};exports[_0x6366('0x33')]=function(_0x2707ee,_0x52a50e){if(_0x2707ee[_0x6366('0x60')]['id']){delete _0x2707ee[_0x6366('0x60')]['id'];}return db[_0x6366('0x52')][_0x6366('0x5a')]({'where':{'id':_0x2707ee[_0x6366('0x57')]['id']}})['then'](handleEntityNotFound(_0x52a50e,null))['then'](saveUpdates(_0x2707ee[_0x6366('0x60')],null))[_0x6366('0x34')](respondWithResult(_0x52a50e,null))[_0x6366('0x28')](handleError(_0x52a50e,null));};exports[_0x6366('0x35')]=function(_0x3d2fa6,_0x21a9d2){return db[_0x6366('0x52')][_0x6366('0x5a')]({'where':{'id':_0x3d2fa6[_0x6366('0x57')]['id']}})['then'](handleEntityNotFound(_0x21a9d2,null))['then'](removeEntity(_0x21a9d2,null))[_0x6366('0x28')](handleError(_0x21a9d2,null));};exports[_0x6366('0x61')]=function(_0x5c794f,_0x1b424c){return db[_0x6366('0x52')][_0x6366('0x61')]()[_0x6366('0x34')](respondWithResult(_0x1b424c,null))[_0x6366('0x28')](handleError(_0x1b424c,null));};exports[_0x6366('0x62')]=function(_0x5e516a,_0x1dd75b,_0x4e61d5){var _0x622d6d={'raw':!![],'where':{}},_0x51ff20={},_0x30915d;return db['ChatQueue'][_0x6366('0x63')]({'where':{'id':_0x5e516a[_0x6366('0x57')]['id']}})[_0x6366('0x34')](handleEntityNotFound(_0x1dd75b,null))[_0x6366('0x34')](function(_0x2326ec){if(_0x2326ec){_0x30915d=_0x2326ec['get']({'plain':!![]});_0x51ff20['model']=_[_0x6366('0x44')](db['UserChatQueue'][_0x6366('0x3d')]);_0x51ff20[_0x6366('0x43')]=_[_0x6366('0x44')](_0x5e516a[_0x6366('0x43')]);_0x51ff20[_0x6366('0x45')]=_[_0x6366('0x46')](_0x51ff20[_0x6366('0x41')],_0x51ff20[_0x6366('0x43')]);_0x622d6d[_0x6366('0x47')]=_[_0x6366('0x46')](_0x51ff20[_0x6366('0x41')],qs[_0x6366('0x48')](_0x5e516a[_0x6366('0x43')][_0x6366('0x48')]));_0x622d6d[_0x6366('0x47')]=_0x622d6d['attributes'][_0x6366('0x58')]?_0x622d6d['attributes']:_0x51ff20[_0x6366('0x41')];if(!_0x5e516a[_0x6366('0x43')]['hasOwnProperty'](_0x6366('0x4a'))){_0x622d6d[_0x6366('0x2d')]=qs['limit'](_0x5e516a['query'][_0x6366('0x2d')]);_0x622d6d[_0x6366('0x2c')]=qs['offset'](_0x5e516a[_0x6366('0x43')]['offset']);}_0x622d6d['order']=qs['sort'](_0x5e516a['query'][_0x6366('0x4c')]);_0x622d6d[_0x6366('0x4d')]=qs[_0x6366('0x45')](_[_0x6366('0x4e')](_0x5e516a[_0x6366('0x43')],_0x51ff20['filters']));_0x622d6d[_0x6366('0x4d')][_0x6366('0x64')]=_0x2326ec['id'];if(_0x5e516a['query']['filter']){_0x622d6d[_0x6366('0x4d')]=_['merge'](_0x622d6d[_0x6366('0x4d')],{'$or':_[_0x6366('0x3c')](_0x622d6d['attributes'],function(_0x114de9){var _0x4ce98f={};_0x4ce98f[_0x114de9]={'$like':'%'+_0x5e516a['query']['filter']+'%'};return _0x4ce98f;})});}_0x622d6d=_[_0x6366('0x50')]({},_0x622d6d,_0x5e516a[_0x6366('0x51')]);return db[_0x6366('0x65')]['findAll'](_0x622d6d);}})[_0x6366('0x34')](function(_0x38c37d){if(_0x38c37d){return db[_0x6366('0x66')]['findAndCountAll']({'where':{'id':_[_0x6366('0x3c')](_0x38c37d,_0x6366('0x67')),'role':_0x6366('0x68')},'attributes':['id',_0x6366('0x42'),_0x6366('0x69'),_0x6366('0x6a'),_0x6366('0x6b')]});}})[_0x6366('0x34')](function(_0x2a0bb1){if(_0x2a0bb1){return{'count':_0x2a0bb1['count'],'rows':_[_0x6366('0x3c')](_0x2a0bb1[_0x6366('0x55')],function(_0x59e851){return{'membername':_0x59e851[_0x6366('0x42')],'UserId':_0x59e851['id'],'queue_name':_0x30915d['name'],'ChatQueueId':_0x30915d['id'],'interface':util['format'](_0x6366('0x6c'),_0x6366('0x6d'),_0x59e851[_0x6366('0x42')]),'penalty':0x0,'paused':_0x59e851[_0x6366('0x69')],'createdAt':_0x59e851[_0x6366('0x6b')],'updatedAt':_0x59e851[_0x6366('0x6a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6366('0x34')](respondWithFilteredResult(_0x1dd75b,_0x622d6d))['catch'](handleError(_0x1dd75b,null));};exports[_0x6366('0x6e')]=function(_0x41baab,_0x1b91a4,_0x17d51b){var _0x2cedeb={};var _0x136f9b={};var _0x499e1a;var _0x5470d0;return db[_0x6366('0x52')]['findOne']({'where':{'id':_0x41baab[_0x6366('0x57')]['id']}})[_0x6366('0x34')](handleEntityNotFound(_0x1b91a4,null))[_0x6366('0x34')](function(_0x4f1dd9){if(_0x4f1dd9){_0x499e1a=_0x4f1dd9;_0x136f9b['model']=_[_0x6366('0x44')](db['Team'][_0x6366('0x3d')]);_0x136f9b[_0x6366('0x43')]=_[_0x6366('0x44')](_0x41baab['query']);_0x136f9b[_0x6366('0x45')]=_[_0x6366('0x46')](_0x136f9b['model'],_0x136f9b[_0x6366('0x43')]);_0x2cedeb[_0x6366('0x47')]=_[_0x6366('0x46')](_0x136f9b[_0x6366('0x41')],qs[_0x6366('0x48')](_0x41baab[_0x6366('0x43')][_0x6366('0x48')]));_0x2cedeb['attributes']=_0x2cedeb[_0x6366('0x47')][_0x6366('0x58')]?_0x2cedeb[_0x6366('0x47')]:_0x136f9b[_0x6366('0x41')];_0x2cedeb[_0x6366('0x4b')]=qs[_0x6366('0x4c')](_0x41baab[_0x6366('0x43')][_0x6366('0x4c')]);_0x2cedeb[_0x6366('0x4d')]=qs['filters'](_['pick'](_0x41baab[_0x6366('0x43')],_0x136f9b['filters']));if(_0x41baab[_0x6366('0x43')][_0x6366('0x4f')]){_0x2cedeb[_0x6366('0x4d')]=_['merge'](_0x2cedeb[_0x6366('0x4d')],{'$or':_['map'](_0x2cedeb[_0x6366('0x47')],function(_0x2c5483){var _0x3b27bb={};_0x3b27bb[_0x2c5483]={'$like':'%'+_0x41baab[_0x6366('0x43')]['filter']+'%'};return _0x3b27bb;})});}_0x2cedeb=_[_0x6366('0x50')]({},_0x2cedeb,_0x41baab[_0x6366('0x51')]);return _0x499e1a['getTeams'](_0x2cedeb);}})['then'](function(_0x1d058d){if(_0x1d058d){_0x5470d0=_0x1d058d['length'];if(!_0x41baab[_0x6366('0x43')][_0x6366('0x49')](_0x6366('0x4a'))){_0x2cedeb['limit']=qs[_0x6366('0x2d')](_0x41baab['query'][_0x6366('0x2d')]);_0x2cedeb['offset']=qs[_0x6366('0x2c')](_0x41baab[_0x6366('0x43')]['offset']);}return _0x499e1a[_0x6366('0x6e')](_0x2cedeb);}})[_0x6366('0x34')](function(_0x11da92){if(_0x11da92){return _0x11da92?{'count':_0x5470d0,'rows':_0x11da92}:null;}})[_0x6366('0x34')](respondWithResult(_0x1b91a4,null))[_0x6366('0x28')](handleError(_0x1b91a4,null));};exports[_0x6366('0x6f')]=function(_0x33206f,_0x331e51,_0x13bf46){var _0xafd222=_0x33206f['body'][_0x6366('0x70')];return db[_0x6366('0x71')][_0x6366('0x54')]({'where':{'id':_0xafd222},'attributes':['id'],'include':[{'model':db[_0x6366('0x66')],'as':_0x6366('0x72'),'attributes':['id',_0x6366('0x42'),'online',_0x6366('0x73'),_0x6366('0x74')],'raw':!![]}]})[_0x6366('0x34')](function(_0x39d4bc){if(_0x39d4bc){var _0xc6a336=_[_0x6366('0x75')](_0x39d4bc,function(_0x6031b4){var _0x3d1833=_0x6031b4[_0x6366('0x36')]({'plain':!![]});return _0x3d1833[_0x6366('0x72')];});return db[_0x6366('0x52')]['find']({'where':{'id':_0x33206f[_0x6366('0x57')]['id']}})[_0x6366('0x34')](function(_0x4e72ae){return db['sequelize']['transaction'](function(_0x18c7ce){return _0x4e72ae[_0x6366('0x6f')](_0xafd222,{'transaction':_0x18c7ce})[_0x6366('0x34')](function(){return BPromise[_0x6366('0x76')](_0xc6a336,function(_0x317564){return db[_0x6366('0x65')]['findOrCreate']({'where':{'UserId':_0x317564['id'],'ChatQueueId':_0x33206f['params']['id']},'transaction':_0x18c7ce});});})[_0x6366('0x34')](function(){_0xc6a336[_0x6366('0x77')](function(_0x5a19ea){socket[_0x6366('0x78')]('userChatQueue:save',{'UserId':_0x5a19ea['id'],'ChatQueueId':_0x4e72ae['id']});});});});});}})[_0x6366('0x34')](respondWithStatusCode(_0x331e51,null))[_0x6366('0x28')](handleError(_0x331e51,null));};exports[_0x6366('0x79')]=function(_0x1f9b10,_0x30e6e5,_0x50c1f1){return db[_0x6366('0x71')][_0x6366('0x54')]({'where':{'id':_0x1f9b10['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x6366('0x66')],'as':_0x6366('0x72'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x30e6e5,null))[_0x6366('0x34')](function(_0x1ad875){var _0x68d5af=_[_0x6366('0x3c')](_0x1ad875,'id');var _0x51ad2a=[];var _0x3259c6=[];var _0x145bf4=squel[_0x6366('0x7a')]();_0x145bf4[_0x6366('0x7b')](_0x6366('0x7c'))[_0x6366('0x7d')]('team_has_chat_queues','tq')['join'](_0x6366('0x7e'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x6366('0x4d')](_0x6366('0x7f'),_0x1f9b10[_0x6366('0x57')]['id']);for(var _0x36039d=0x0;_0x36039d<_0x1ad875[_0x6366('0x58')];_0x36039d+=0x1){let _0x512d7c=_0x1ad875[_0x36039d];for(var _0x53ad6e=0x0;_0x53ad6e<_0x512d7c[_0x6366('0x72')]['length'];_0x53ad6e+=0x1){let _0x32f109=_0x512d7c[_0x6366('0x72')][_0x53ad6e];var _0x35d164=_0x145bf4[_0x6366('0x80')]();_0x35d164[_0x6366('0x4d')](_0x6366('0x81'),_0x32f109['id']);_0x3259c6[_0x6366('0x82')](db[_0x6366('0x83')][_0x6366('0x43')](_0x35d164[_0x6366('0x84')](),{'type':db[_0x6366('0x83')]['QueryTypes'][_0x6366('0x85')]})[_0x6366('0x34')](function(_0x4f86){if(_0x4f86[_0x6366('0x58')]===0x1){return _0x32f109['id'];}else{var _0x3e41b4=_[_0x6366('0x86')](_['map'](_0x4f86,_0x6366('0x87')),function(_0x540b73){return _[_0x6366('0x88')](_0x68d5af,_0x540b73);});if(_0x3e41b4){return _0x32f109['id'];}}}));}}return BPromise['all'](_0x3259c6)[_0x6366('0x34')](function(_0x140868){_0x51ad2a=_(_0x51ad2a)[_0x6366('0x89')](_0x140868)['compact']()[_0x6366('0x8a')]();return db[_0x6366('0x52')][_0x6366('0x5a')]({'where':{'id':_0x1f9b10[_0x6366('0x57')]['id']}})['then'](function(_0x142711){return db[_0x6366('0x83')][_0x6366('0x8b')](function(_0x1b0981){return _0x142711['removeTeams'](_0x1f9b10[_0x6366('0x43')]['ids'],{'transaction':_0x1b0981})[_0x6366('0x34')](function(){if(!_[_0x6366('0x8c')](_0x51ad2a)){return _0x142711['removeAgents'](_0x51ad2a,{'transaction':_0x1b0981});}})[_0x6366('0x34')](function(){_0x51ad2a['forEach'](function(_0x309875){socket[_0x6366('0x78')](_0x6366('0x8d'),{'UserId':_0x309875,'ChatQueueId':_0x142711['id']});});});});});});})['then'](respondWithStatusCode(_0x30e6e5,null))['catch'](handleError(_0x30e6e5,null));};exports[_0x6366('0x8e')]=function(_0x5ab4bf,_0x133e2d,_0x4e1451){return db[_0x6366('0x52')]['find']({'where':{'id':_0x5ab4bf['params']['id']}})[_0x6366('0x34')](handleEntityNotFound(_0x133e2d,null))[_0x6366('0x34')](function(_0x25ccd1){if(_0x25ccd1){return _0x25ccd1[_0x6366('0x8e')](_0x5ab4bf[_0x6366('0x60')][_0x6366('0x70')],_[_0x6366('0x8f')](_0x5ab4bf[_0x6366('0x60')],[_0x6366('0x70'),'id'])||{})['spread'](function(_0x2a1087){for(var _0x30c429=0x0;_0x30c429<_0x5ab4bf['body']['ids'][_0x6366('0x58')];_0x30c429+=0x1){socket['emit']('userChatQueue:save',{'UserId':_0x5ab4bf[_0x6366('0x60')][_0x6366('0x70')][_0x30c429],'ChatQueueId':_0x5ab4bf[_0x6366('0x57')]['id']});}return _0x2a1087;});}})[_0x6366('0x34')](respondWithResult(_0x133e2d,null))[_0x6366('0x28')](handleError(_0x133e2d,null));};exports[_0x6366('0x90')]=function(_0x3137b0,_0x348d85,_0x449a25){return db[_0x6366('0x52')]['find']({'where':{'id':_0x3137b0[_0x6366('0x57')]['id']}})[_0x6366('0x34')](handleEntityNotFound(_0x348d85,null))['then'](function(_0x17de79){if(_0x17de79){return _0x17de79['removeAgents'](_0x3137b0[_0x6366('0x43')][_0x6366('0x70')])[_0x6366('0x34')](function(){if(_[_0x6366('0x91')](_0x3137b0['query'][_0x6366('0x70')])){for(var _0x5cad26=0x0;_0x5cad26<_0x3137b0[_0x6366('0x43')][_0x6366('0x70')][_0x6366('0x58')];_0x5cad26+=0x1){socket[_0x6366('0x78')]('userChatQueue:remove',{'UserId':Number(_0x3137b0[_0x6366('0x43')][_0x6366('0x70')][_0x5cad26]),'ChatQueueId':Number(_0x3137b0[_0x6366('0x57')]['id'])});}}else{socket[_0x6366('0x78')](_0x6366('0x8d'),{'UserId':Number(_0x3137b0['query'][_0x6366('0x70')]),'ChatQueueId':Number(_0x3137b0[_0x6366('0x57')]['id'])});}});}})[_0x6366('0x34')](respondWithStatusCode(_0x348d85,null))[_0x6366('0x28')](handleError(_0x348d85,null));};exports['getAgents']=function(_0x21f54d,_0x2e60e8,_0x151995){var _0x7d9dec={};var _0x13ed83={};var _0x323bf5;var _0x50f805;return db[_0x6366('0x52')][_0x6366('0x63')]({'where':{'id':_0x21f54d[_0x6366('0x57')]['id']}})[_0x6366('0x34')](handleEntityNotFound(_0x2e60e8,null))[_0x6366('0x34')](function(_0x47164e){if(_0x47164e){_0x323bf5=_0x47164e;_0x13ed83[_0x6366('0x41')]=_[_0x6366('0x44')](db[_0x6366('0x66')]['rawAttributes']);_0x13ed83[_0x6366('0x43')]=_[_0x6366('0x44')](_0x21f54d[_0x6366('0x43')]);_0x13ed83['filters']=_['intersection'](_0x13ed83['model'],_0x13ed83[_0x6366('0x43')]);_0x7d9dec[_0x6366('0x47')]=_['intersection'](_0x13ed83['model'],qs[_0x6366('0x48')](_0x21f54d[_0x6366('0x43')]['fields']));_0x7d9dec[_0x6366('0x47')]=_0x7d9dec['attributes'][_0x6366('0x58')]?_0x7d9dec[_0x6366('0x47')]:_0x13ed83['model'];_0x7d9dec[_0x6366('0x4b')]=qs[_0x6366('0x4c')](_0x21f54d[_0x6366('0x43')][_0x6366('0x4c')]);_0x7d9dec['where']=qs[_0x6366('0x45')](_[_0x6366('0x4e')](_0x21f54d[_0x6366('0x43')],_0x13ed83[_0x6366('0x45')]));if(_0x21f54d[_0x6366('0x43')][_0x6366('0x4f')]){_0x7d9dec[_0x6366('0x4d')]=_[_0x6366('0x50')](_0x7d9dec[_0x6366('0x4d')],{'$or':_[_0x6366('0x3c')](_0x7d9dec[_0x6366('0x47')],function(_0x1553e2){var _0x1b88ad={};_0x1b88ad[_0x1553e2]={'$like':'%'+_0x21f54d[_0x6366('0x43')]['filter']+'%'};return _0x1b88ad;})});}_0x7d9dec=_[_0x6366('0x50')]({},_0x7d9dec,_0x21f54d[_0x6366('0x51')]);return _0x323bf5[_0x6366('0x92')](_0x7d9dec);}})[_0x6366('0x34')](function(_0x830b){if(_0x830b){_0x50f805=_0x830b['length'];if(!_0x21f54d[_0x6366('0x43')][_0x6366('0x49')](_0x6366('0x4a'))){_0x7d9dec[_0x6366('0x2d')]=qs['limit'](_0x21f54d[_0x6366('0x43')][_0x6366('0x2d')]);_0x7d9dec[_0x6366('0x2c')]=qs['offset'](_0x21f54d[_0x6366('0x43')][_0x6366('0x2c')]);}return _0x323bf5[_0x6366('0x92')](_0x7d9dec);}})[_0x6366('0x34')](function(_0x21dd5f){if(_0x21dd5f){return _0x21dd5f?{'count':_0x50f805,'rows':_0x21dd5f}:null;}})[_0x6366('0x34')](respondWithResult(_0x2e60e8,null))[_0x6366('0x28')](handleError(_0x2e60e8,null));}; \ No newline at end of file +var _0xe44d=['info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','status','offset','limit','set','Content-Range','apply','save','update','destroy','get','ChatQueues','UserProfileResource','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','ChatQueue','count','includeAll','include','findAll','rows','show','keys','intersection','options','create','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','ChatQueueId','UserChatQueue','findAndCountAll','UserId','agent','chatPause','%s/%s','SIP','createdAt','updatedAt','getTeams','Team','addTeams','ids','User','online','voicePause','interface','flatMap','Agents','transaction','forEach','userChatQueue:save','select','from','team_has_chat_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','sequelize','QueryTypes','every','TeamId','includes','all','union','compact','removeTeams','isEmpty','removeAgents','emit','userChatQueue:remove','addAgents','omit','isArray','getAgents','eml-format','fast-json-patch','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./chatQueue.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'];(function(_0x5e0b7f,_0x34b1e0){var _0x22fbb1=function(_0x249687){while(--_0x249687){_0x5e0b7f['push'](_0x5e0b7f['shift']());}};_0x22fbb1(++_0x34b1e0);}(_0xe44d,0x1a0));var _0xde44=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0xe44d[_0x1da527];return _0x40fc7c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xde44('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xde44('0x1'));var rp=require('request-promise');var moment=require(_0xde44('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xde44('0x3'));var util=require(_0xde44('0x4'));var path=require(_0xde44('0x5'));var sox=require(_0xde44('0x6'));var csv=require(_0xde44('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xde44('0x8'));var squel=require(_0xde44('0x9'));var crypto=require(_0xde44('0xa'));var jsforce=require(_0xde44('0xb'));var deskjs=require(_0xde44('0xc'));var toCsv=require(_0xde44('0x7'));var querystring=require('querystring');var Papa=require(_0xde44('0xd'));var Redis=require('ioredis');var authService=require(_0xde44('0xe'));var qs=require(_0xde44('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xde44('0x10'));var logger=require(_0xde44('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xde44('0x12'));var db=require(_0xde44('0x13'))['db'];config['redis']=_[_0xde44('0x14')](config[_0xde44('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0xde44('0x16'))(new Redis(config['redis']));require(_0xde44('0x17'))[_0xde44('0x18')](socket);var jayson=require(_0xde44('0x19'));var client=jayson[_0xde44('0x1a')][_0xde44('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x1adbb7,_0x57c6b4,_0x30ac3e){if(_0x30ac3e){var _0x1a082e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1a082e[_0xde44('0x1c')](_0x57c6b4)){return _0x1adbb7;}else{throw new db[(_0xde44('0x1d'))][(_0xde44('0x1e'))](_0xde44('0x1f'));}}else{return _0x1adbb7;}}function respondWithRpcPromise(_0xea847d,_0x1e9dae,_0x222406,_0x46f371){return new BPromise(function(_0x116449,_0x38f40a){var _0x458e9c=_0x46f371||client;return _0x458e9c[_0xde44('0x20')](_0xea847d,_0x222406)[_0xde44('0x21')](function(_0x2081cb){logger[_0xde44('0x22')](_0xde44('0x23'),_0x1e9dae,_0xde44('0x24'));logger[_0xde44('0x25')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x1e9dae,_0xde44('0x24'),JSON[_0xde44('0x26')](_0x2081cb));if(_0x2081cb[_0xde44('0x27')]){if(_0x2081cb['error'][_0xde44('0x28')]===0x1f4){logger[_0xde44('0x27')](_0xde44('0x23'),_0x1e9dae,_0x2081cb[_0xde44('0x27')][_0xde44('0x29')]);return _0x38f40a(_0x2081cb[_0xde44('0x27')]['message']);}logger[_0xde44('0x27')](_0xde44('0x23'),_0x1e9dae,_0x2081cb[_0xde44('0x27')][_0xde44('0x29')]);return _0x116449(_0x2081cb['error']['message']);}else{logger[_0xde44('0x22')]('ChatQueue,\x20%s,\x20%s',_0x1e9dae,_0xde44('0x24'));_0x116449(_0x2081cb['result']['message']);}})[_0xde44('0x2a')](function(_0x5ba706){logger['error'](_0xde44('0x23'),_0x1e9dae,_0x5ba706);_0x38f40a(_0x5ba706);});});}function respondWithStatusCode(_0x181814,_0x465072){_0x465072=_0x465072||0xcc;return function(_0x5c566e){if(_0x5c566e){return _0x181814['sendStatus'](_0x465072);}return _0x181814[_0xde44('0x2b')](_0x465072)['end']();};}function respondWithResult(_0x31b0d0,_0x34f6eb){_0x34f6eb=_0x34f6eb||0xc8;return function(_0x2e98f){if(_0x2e98f){return _0x31b0d0[_0xde44('0x2b')](_0x34f6eb)['json'](_0x2e98f);}};}function respondWithFilteredResult(_0x30b492,_0x535af5){return function(_0x300636){if(_0x300636){var _0x9e6546=_0x300636['count'],_0x36def5=_0x535af5[_0xde44('0x2c')],_0x1b9513=_0x535af5[_0xde44('0x2c')]+_0x535af5[_0xde44('0x2d')],_0x2cee85;if(_0x1b9513>=_0x9e6546){_0x1b9513=_0x9e6546;_0x2cee85=0xc8;}else{_0x2cee85=0xce;}_0x30b492[_0xde44('0x2b')](_0x2cee85);return _0x30b492[_0xde44('0x2e')](_0xde44('0x2f'),_0x36def5+'-'+_0x1b9513+'/'+_0x9e6546)['json'](_0x300636);}return null;};}function patchUpdates(_0x2d98a3){return function(_0x3c4f12){try{jsonpatch[_0xde44('0x30')](_0x3c4f12,_0x2d98a3,!![]);}catch(_0x16b7b6){return BPromise['reject'](_0x16b7b6);}return _0x3c4f12[_0xde44('0x31')]();};}function saveUpdates(_0x4eb503,_0x849ee0){return function(_0x322093){if(_0x322093){return _0x322093[_0xde44('0x32')](_0x4eb503)[_0xde44('0x21')](function(_0x1a2ed1){return _0x1a2ed1;});}return null;};}function removeEntity(_0x1e3d28,_0x2953df){return function(_0x337d4f){if(_0x337d4f){return _0x337d4f[_0xde44('0x33')]()['then'](function(){var _0x105aed=_0x337d4f[_0xde44('0x34')]({'plain':!![]});var _0x3fe99c=_0xde44('0x35');return db[_0xde44('0x36')][_0xde44('0x33')]({'where':{'type':_0x3fe99c,'resourceId':_0x105aed['id']}})['then'](function(){return _0x337d4f;});})['then'](function(){_0x1e3d28['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3dd9fd,_0xd305d1){return function(_0xf3c59d){if(!_0xf3c59d){_0x3dd9fd['sendStatus'](0x194);}return _0xf3c59d;};}function handleError(_0x18a9de,_0x4aaf6c){_0x4aaf6c=_0x4aaf6c||0x1f4;return function(_0x163c43){logger[_0xde44('0x27')](_0x163c43[_0xde44('0x37')]);if(_0x163c43[_0xde44('0x38')]){delete _0x163c43[_0xde44('0x38')];}_0x18a9de[_0xde44('0x2b')](_0x4aaf6c)[_0xde44('0x39')](_0x163c43);};}exports[_0xde44('0x3a')]=function(_0x121ae0,_0x179e36){var _0x229811={},_0x1f367f={},_0x607481={'count':0x0,'rows':[]};var _0x21c101=_[_0xde44('0x3b')](db['ChatQueue'][_0xde44('0x3c')],function(_0x81714b){return{'name':_0x81714b['fieldName'],'type':_0x81714b[_0xde44('0x3d')][_0xde44('0x3e')]};});_0x1f367f[_0xde44('0x3f')]=_[_0xde44('0x3b')](_0x21c101,'name');_0x1f367f[_0xde44('0x40')]=_['keys'](_0x121ae0[_0xde44('0x40')]);_0x1f367f[_0xde44('0x41')]=_['intersection'](_0x1f367f[_0xde44('0x3f')],_0x1f367f[_0xde44('0x40')]);_0x229811[_0xde44('0x42')]=_['intersection'](_0x1f367f['model'],qs[_0xde44('0x43')](_0x121ae0['query'][_0xde44('0x43')]));_0x229811[_0xde44('0x42')]=_0x229811[_0xde44('0x42')][_0xde44('0x44')]?_0x229811[_0xde44('0x42')]:_0x1f367f[_0xde44('0x3f')];if(!_0x121ae0[_0xde44('0x40')][_0xde44('0x45')](_0xde44('0x46'))){_0x229811['limit']=qs[_0xde44('0x2d')](_0x121ae0['query'][_0xde44('0x2d')]);_0x229811[_0xde44('0x2c')]=qs[_0xde44('0x2c')](_0x121ae0[_0xde44('0x40')][_0xde44('0x2c')]);}_0x229811[_0xde44('0x47')]=qs[_0xde44('0x48')](_0x121ae0[_0xde44('0x40')][_0xde44('0x48')]);_0x229811[_0xde44('0x49')]=qs[_0xde44('0x41')](_[_0xde44('0x4a')](_0x121ae0['query'],_0x1f367f[_0xde44('0x41')]),_0x21c101);if(_0x121ae0[_0xde44('0x40')][_0xde44('0x4b')]){_0x229811[_0xde44('0x49')]=_[_0xde44('0x4c')](_0x229811[_0xde44('0x49')],{'$or':_['map'](_0x21c101,function(_0x5f36e8){if(_0x5f36e8['type']!==_0xde44('0x4d')){var _0xe17c30={};_0xe17c30[_0x5f36e8[_0xde44('0x38')]]={'$like':'%'+_0x121ae0[_0xde44('0x40')]['filter']+'%'};return _0xe17c30;}})});}_0x229811=_[_0xde44('0x4c')]({},_0x229811,_0x121ae0['options']);var _0x19505c={'where':_0x229811[_0xde44('0x49')]};return db[_0xde44('0x4e')][_0xde44('0x4f')](_0x19505c)[_0xde44('0x21')](function(_0x4b3fcf){_0x607481[_0xde44('0x4f')]=_0x4b3fcf;if(_0x121ae0[_0xde44('0x40')][_0xde44('0x50')]){_0x229811[_0xde44('0x51')]=[{'all':!![]}];}return db[_0xde44('0x4e')][_0xde44('0x52')](_0x229811);})[_0xde44('0x21')](function(_0x170ef8){_0x607481[_0xde44('0x53')]=_0x170ef8;return _0x607481;})[_0xde44('0x21')](respondWithFilteredResult(_0x179e36,_0x229811))[_0xde44('0x2a')](handleError(_0x179e36,null));};exports[_0xde44('0x54')]=function(_0x3499d2,_0x2d9190){var _0x4a7ca3={'raw':!![],'where':{'id':_0x3499d2['params']['id']}},_0x2c6f7c={};_0x2c6f7c['model']=_[_0xde44('0x55')](db[_0xde44('0x4e')][_0xde44('0x3c')]);_0x2c6f7c[_0xde44('0x40')]=_['keys'](_0x3499d2[_0xde44('0x40')]);_0x2c6f7c['filters']=_[_0xde44('0x56')](_0x2c6f7c[_0xde44('0x3f')],_0x2c6f7c[_0xde44('0x40')]);_0x4a7ca3[_0xde44('0x42')]=_[_0xde44('0x56')](_0x2c6f7c[_0xde44('0x3f')],qs[_0xde44('0x43')](_0x3499d2[_0xde44('0x40')]['fields']));_0x4a7ca3[_0xde44('0x42')]=_0x4a7ca3[_0xde44('0x42')]['length']?_0x4a7ca3[_0xde44('0x42')]:_0x2c6f7c['model'];if(_0x3499d2[_0xde44('0x40')]['includeAll']){_0x4a7ca3[_0xde44('0x51')]=[{'all':!![]}];}_0x4a7ca3=_[_0xde44('0x4c')]({},_0x4a7ca3,_0x3499d2[_0xde44('0x57')]);return db['ChatQueue']['find'](_0x4a7ca3)[_0xde44('0x21')](handleEntityNotFound(_0x2d9190,null))[_0xde44('0x21')](respondWithResult(_0x2d9190,null))[_0xde44('0x2a')](handleError(_0x2d9190,null));};exports[_0xde44('0x58')]=function(_0x285ce5,_0x25cc05){return db[_0xde44('0x4e')][_0xde44('0x58')](_0x285ce5['body'],{})[_0xde44('0x21')](function(_0x2f023a){var _0x2ca533=_0x285ce5['user'][_0xde44('0x34')]({'plain':!![]});if(!_0x2ca533)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2ca533[_0xde44('0x59')]===_0xde44('0x5a')){var _0x47851f=_0x2f023a[_0xde44('0x34')]({'plain':!![]});var _0x597329='ChatQueues';return db[_0xde44('0x5b')][_0xde44('0x5c')]({'where':{'name':_0x597329,'userProfileId':_0x2ca533[_0xde44('0x5d')]},'raw':!![]})[_0xde44('0x21')](function(_0x3e7ac4){if(_0x3e7ac4&&_0x3e7ac4[_0xde44('0x5e')]===0x0){return db[_0xde44('0x36')][_0xde44('0x58')]({'name':_0x47851f[_0xde44('0x38')],'resourceId':_0x47851f['id'],'type':_0x3e7ac4[_0xde44('0x38')],'sectionId':_0x3e7ac4['id']},{})[_0xde44('0x21')](function(){return _0x2f023a;});}else{return _0x2f023a;}})[_0xde44('0x2a')](function(_0x299444){logger[_0xde44('0x27')](_0xde44('0x5f'),_0x299444);throw _0x299444;});}return _0x2f023a;})['then'](respondWithResult(_0x25cc05,0xc9))[_0xde44('0x2a')](handleError(_0x25cc05,null));};exports['update']=function(_0x3614dd,_0x252313){if(_0x3614dd[_0xde44('0x60')]['id']){delete _0x3614dd[_0xde44('0x60')]['id'];}return db[_0xde44('0x4e')][_0xde44('0x5c')]({'where':{'id':_0x3614dd[_0xde44('0x61')]['id']}})['then'](handleEntityNotFound(_0x252313,null))[_0xde44('0x21')](saveUpdates(_0x3614dd['body'],null))['then'](respondWithResult(_0x252313,null))[_0xde44('0x2a')](handleError(_0x252313,null));};exports[_0xde44('0x33')]=function(_0xecc2fb,_0x16b112){return db[_0xde44('0x4e')][_0xde44('0x5c')]({'where':{'id':_0xecc2fb[_0xde44('0x61')]['id']}})[_0xde44('0x21')](handleEntityNotFound(_0x16b112,null))['then'](removeEntity(_0x16b112,null))[_0xde44('0x2a')](handleError(_0x16b112,null));};exports[_0xde44('0x62')]=function(_0x482436,_0x30e0a1){return db['ChatQueue'][_0xde44('0x62')]()['then'](respondWithResult(_0x30e0a1,null))[_0xde44('0x2a')](handleError(_0x30e0a1,null));};exports[_0xde44('0x63')]=function(_0x499f4f,_0xbb057e,_0x1adfbd){var _0x38b197={'raw':!![],'where':{}},_0x1d06a7={},_0x385ba6;return db[_0xde44('0x4e')][_0xde44('0x64')]({'where':{'id':_0x499f4f[_0xde44('0x61')]['id']}})[_0xde44('0x21')](handleEntityNotFound(_0xbb057e,null))[_0xde44('0x21')](function(_0x4d91f8){if(_0x4d91f8){_0x385ba6=_0x4d91f8[_0xde44('0x34')]({'plain':!![]});_0x1d06a7[_0xde44('0x3f')]=_[_0xde44('0x55')](db['UserChatQueue'][_0xde44('0x3c')]);_0x1d06a7[_0xde44('0x40')]=_['keys'](_0x499f4f[_0xde44('0x40')]);_0x1d06a7['filters']=_[_0xde44('0x56')](_0x1d06a7[_0xde44('0x3f')],_0x1d06a7[_0xde44('0x40')]);_0x38b197[_0xde44('0x42')]=_[_0xde44('0x56')](_0x1d06a7['model'],qs[_0xde44('0x43')](_0x499f4f[_0xde44('0x40')][_0xde44('0x43')]));_0x38b197['attributes']=_0x38b197[_0xde44('0x42')][_0xde44('0x44')]?_0x38b197[_0xde44('0x42')]:_0x1d06a7['model'];if(!_0x499f4f[_0xde44('0x40')][_0xde44('0x45')](_0xde44('0x46'))){_0x38b197[_0xde44('0x2d')]=qs[_0xde44('0x2d')](_0x499f4f[_0xde44('0x40')][_0xde44('0x2d')]);_0x38b197[_0xde44('0x2c')]=qs['offset'](_0x499f4f[_0xde44('0x40')]['offset']);}_0x38b197['order']=qs[_0xde44('0x48')](_0x499f4f[_0xde44('0x40')][_0xde44('0x48')]);_0x38b197[_0xde44('0x49')]=qs[_0xde44('0x41')](_[_0xde44('0x4a')](_0x499f4f['query'],_0x1d06a7[_0xde44('0x41')]));_0x38b197[_0xde44('0x49')][_0xde44('0x65')]=_0x4d91f8['id'];if(_0x499f4f[_0xde44('0x40')][_0xde44('0x4b')]){_0x38b197[_0xde44('0x49')]=_[_0xde44('0x4c')](_0x38b197['where'],{'$or':_[_0xde44('0x3b')](_0x38b197['attributes'],function(_0x3d09d7){var _0x1ffd14={};_0x1ffd14[_0x3d09d7]={'$like':'%'+_0x499f4f[_0xde44('0x40')]['filter']+'%'};return _0x1ffd14;})});}_0x38b197=_[_0xde44('0x4c')]({},_0x38b197,_0x499f4f[_0xde44('0x57')]);return db[_0xde44('0x66')][_0xde44('0x52')](_0x38b197);}})['then'](function(_0x1d24f9){if(_0x1d24f9){return db['User'][_0xde44('0x67')]({'where':{'id':_[_0xde44('0x3b')](_0x1d24f9,_0xde44('0x68')),'role':_0xde44('0x69')},'attributes':['id','name',_0xde44('0x6a'),'updatedAt','createdAt']});}})[_0xde44('0x21')](function(_0x29c194){if(_0x29c194){return{'count':_0x29c194[_0xde44('0x4f')],'rows':_[_0xde44('0x3b')](_0x29c194[_0xde44('0x53')],function(_0x4f7129){return{'membername':_0x4f7129[_0xde44('0x38')],'UserId':_0x4f7129['id'],'queue_name':_0x385ba6[_0xde44('0x38')],'ChatQueueId':_0x385ba6['id'],'interface':util['format'](_0xde44('0x6b'),_0xde44('0x6c'),_0x4f7129['name']),'penalty':0x0,'paused':_0x4f7129[_0xde44('0x6a')],'createdAt':_0x4f7129[_0xde44('0x6d')],'updatedAt':_0x4f7129[_0xde44('0x6e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0xbb057e,_0x38b197))[_0xde44('0x2a')](handleError(_0xbb057e,null));};exports[_0xde44('0x6f')]=function(_0x18dd3f,_0x3cd08f,_0xd0bd4f){var _0x4edffe={};var _0x53e88e={};var _0xe1c010;var _0x667d7e;return db[_0xde44('0x4e')][_0xde44('0x64')]({'where':{'id':_0x18dd3f[_0xde44('0x61')]['id']}})[_0xde44('0x21')](handleEntityNotFound(_0x3cd08f,null))[_0xde44('0x21')](function(_0x468022){if(_0x468022){_0xe1c010=_0x468022;_0x53e88e[_0xde44('0x3f')]=_[_0xde44('0x55')](db[_0xde44('0x70')]['rawAttributes']);_0x53e88e[_0xde44('0x40')]=_[_0xde44('0x55')](_0x18dd3f[_0xde44('0x40')]);_0x53e88e[_0xde44('0x41')]=_[_0xde44('0x56')](_0x53e88e[_0xde44('0x3f')],_0x53e88e[_0xde44('0x40')]);_0x4edffe[_0xde44('0x42')]=_[_0xde44('0x56')](_0x53e88e[_0xde44('0x3f')],qs[_0xde44('0x43')](_0x18dd3f[_0xde44('0x40')][_0xde44('0x43')]));_0x4edffe[_0xde44('0x42')]=_0x4edffe[_0xde44('0x42')]['length']?_0x4edffe[_0xde44('0x42')]:_0x53e88e['model'];_0x4edffe[_0xde44('0x47')]=qs['sort'](_0x18dd3f['query'][_0xde44('0x48')]);_0x4edffe[_0xde44('0x49')]=qs['filters'](_[_0xde44('0x4a')](_0x18dd3f[_0xde44('0x40')],_0x53e88e['filters']));if(_0x18dd3f[_0xde44('0x40')][_0xde44('0x4b')]){_0x4edffe[_0xde44('0x49')]=_['merge'](_0x4edffe[_0xde44('0x49')],{'$or':_[_0xde44('0x3b')](_0x4edffe[_0xde44('0x42')],function(_0x27c3d9){var _0x43a363={};_0x43a363[_0x27c3d9]={'$like':'%'+_0x18dd3f[_0xde44('0x40')][_0xde44('0x4b')]+'%'};return _0x43a363;})});}_0x4edffe=_[_0xde44('0x4c')]({},_0x4edffe,_0x18dd3f[_0xde44('0x57')]);return _0xe1c010[_0xde44('0x6f')](_0x4edffe);}})[_0xde44('0x21')](function(_0x8f9710){if(_0x8f9710){_0x667d7e=_0x8f9710[_0xde44('0x44')];if(!_0x18dd3f[_0xde44('0x40')][_0xde44('0x45')](_0xde44('0x46'))){_0x4edffe[_0xde44('0x2d')]=qs[_0xde44('0x2d')](_0x18dd3f['query'][_0xde44('0x2d')]);_0x4edffe[_0xde44('0x2c')]=qs[_0xde44('0x2c')](_0x18dd3f[_0xde44('0x40')][_0xde44('0x2c')]);}return _0xe1c010[_0xde44('0x6f')](_0x4edffe);}})[_0xde44('0x21')](function(_0x254caa){if(_0x254caa){return _0x254caa?{'count':_0x667d7e,'rows':_0x254caa}:null;}})[_0xde44('0x21')](respondWithResult(_0x3cd08f,null))[_0xde44('0x2a')](handleError(_0x3cd08f,null));};exports[_0xde44('0x71')]=function(_0x13a06a,_0x2fba5e,_0x3be40f){var _0x1845ed=_0x13a06a[_0xde44('0x60')][_0xde44('0x72')];return db[_0xde44('0x70')][_0xde44('0x52')]({'where':{'id':_0x1845ed},'attributes':['id'],'include':[{'model':db[_0xde44('0x73')],'as':'Agents','attributes':['id',_0xde44('0x38'),_0xde44('0x74'),_0xde44('0x75'),_0xde44('0x76')],'raw':!![]}]})[_0xde44('0x21')](function(_0x30b749){if(_0x30b749){var _0x142428=_[_0xde44('0x77')](_0x30b749,function(_0x3a4de4){var _0x454270=_0x3a4de4[_0xde44('0x34')]({'plain':!![]});return _0x454270[_0xde44('0x78')];});return db[_0xde44('0x4e')][_0xde44('0x5c')]({'where':{'id':_0x13a06a['params']['id']}})[_0xde44('0x21')](function(_0x3a8aeb){return db['sequelize'][_0xde44('0x79')](function(_0xfa8157){return _0x3a8aeb[_0xde44('0x71')](_0x1845ed,{'transaction':_0xfa8157})[_0xde44('0x21')](function(){return BPromise['each'](_0x142428,function(_0x59c4ec){return db[_0xde44('0x66')]['findOrCreate']({'where':{'UserId':_0x59c4ec['id'],'ChatQueueId':_0x13a06a[_0xde44('0x61')]['id']},'transaction':_0xfa8157});});})[_0xde44('0x21')](function(){_0x142428[_0xde44('0x7a')](function(_0x476c5f){socket['emit'](_0xde44('0x7b'),{'UserId':_0x476c5f['id'],'ChatQueueId':_0x3a8aeb['id']});});});});});}})[_0xde44('0x21')](respondWithStatusCode(_0x2fba5e,null))[_0xde44('0x2a')](handleError(_0x2fba5e,null));};exports['removeTeams']=function(_0x2978f8,_0x36bffc,_0x1a9bad){return db[_0xde44('0x70')][_0xde44('0x52')]({'where':{'id':_0x2978f8[_0xde44('0x40')][_0xde44('0x72')]},'attributes':['id'],'include':[{'model':db[_0xde44('0x73')],'as':_0xde44('0x78'),'attributes':['id'],'raw':!![]}]})[_0xde44('0x21')](handleEntityNotFound(_0x36bffc,null))[_0xde44('0x21')](function(_0x532690){var _0x3c17b3=_[_0xde44('0x3b')](_0x532690,'id');var _0x39c0f4=[];var _0x4cf9c2=[];var _0x140513=squel[_0xde44('0x7c')]();_0x140513['field']('tq.TeamId')[_0xde44('0x7d')](_0xde44('0x7e'),'tq')['join'](_0xde44('0x7f'),'ut',_0xde44('0x80'))['where'](_0xde44('0x81'),_0x2978f8[_0xde44('0x61')]['id']);for(var _0x164e80=0x0;_0x164e80<_0x532690[_0xde44('0x44')];_0x164e80+=0x1){let _0x2e4fda=_0x532690[_0x164e80];for(var _0x1f569d=0x0;_0x1f569d<_0x2e4fda[_0xde44('0x78')][_0xde44('0x44')];_0x1f569d+=0x1){let _0x3f1c8f=_0x2e4fda['Agents'][_0x1f569d];var _0x5f2f1b=_0x140513[_0xde44('0x82')]();_0x5f2f1b['where'](_0xde44('0x83'),_0x3f1c8f['id']);_0x4cf9c2['push'](db['sequelize'][_0xde44('0x40')](_0x5f2f1b[_0xde44('0x84')](),{'type':db[_0xde44('0x85')][_0xde44('0x86')]['SELECT']})[_0xde44('0x21')](function(_0xc8d3cb){if(_0xc8d3cb[_0xde44('0x44')]===0x1){return _0x3f1c8f['id'];}else{var _0x2fad25=_[_0xde44('0x87')](_[_0xde44('0x3b')](_0xc8d3cb,_0xde44('0x88')),function(_0x476ef2){return _[_0xde44('0x89')](_0x3c17b3,_0x476ef2);});if(_0x2fad25){return _0x3f1c8f['id'];}}}));}}return BPromise[_0xde44('0x8a')](_0x4cf9c2)['then'](function(_0x5eda3f){_0x39c0f4=_(_0x39c0f4)[_0xde44('0x8b')](_0x5eda3f)[_0xde44('0x8c')]()['value']();return db[_0xde44('0x4e')][_0xde44('0x5c')]({'where':{'id':_0x2978f8[_0xde44('0x61')]['id']}})[_0xde44('0x21')](function(_0x45cd5b){return db[_0xde44('0x85')][_0xde44('0x79')](function(_0x5a7ed5){return _0x45cd5b[_0xde44('0x8d')](_0x2978f8[_0xde44('0x40')][_0xde44('0x72')],{'transaction':_0x5a7ed5})[_0xde44('0x21')](function(){if(!_[_0xde44('0x8e')](_0x39c0f4)){return _0x45cd5b[_0xde44('0x8f')](_0x39c0f4,{'transaction':_0x5a7ed5});}})['then'](function(){_0x39c0f4[_0xde44('0x7a')](function(_0x59bfb0){socket[_0xde44('0x90')](_0xde44('0x91'),{'UserId':_0x59bfb0,'ChatQueueId':_0x45cd5b['id']});});});});});});})[_0xde44('0x21')](respondWithStatusCode(_0x36bffc,null))[_0xde44('0x2a')](handleError(_0x36bffc,null));};exports[_0xde44('0x92')]=function(_0x4a8b23,_0x15e936,_0x547981){return db[_0xde44('0x4e')][_0xde44('0x5c')]({'where':{'id':_0x4a8b23[_0xde44('0x61')]['id']}})['then'](handleEntityNotFound(_0x15e936,null))[_0xde44('0x21')](function(_0x592ff4){if(_0x592ff4){return _0x592ff4[_0xde44('0x92')](_0x4a8b23[_0xde44('0x60')][_0xde44('0x72')],_[_0xde44('0x93')](_0x4a8b23[_0xde44('0x60')],[_0xde44('0x72'),'id'])||{})['spread'](function(_0x137a7d){for(var _0x5da8b6=0x0;_0x5da8b6<_0x4a8b23[_0xde44('0x60')][_0xde44('0x72')][_0xde44('0x44')];_0x5da8b6+=0x1){socket[_0xde44('0x90')](_0xde44('0x7b'),{'UserId':_0x4a8b23[_0xde44('0x60')][_0xde44('0x72')][_0x5da8b6],'ChatQueueId':_0x4a8b23['params']['id']});}return _0x137a7d;});}})[_0xde44('0x21')](respondWithResult(_0x15e936,null))['catch'](handleError(_0x15e936,null));};exports[_0xde44('0x8f')]=function(_0x244a24,_0x282dbe,_0x4bcdc7){return db['ChatQueue'][_0xde44('0x5c')]({'where':{'id':_0x244a24[_0xde44('0x61')]['id']}})[_0xde44('0x21')](handleEntityNotFound(_0x282dbe,null))[_0xde44('0x21')](function(_0x590cd8){if(_0x590cd8){return _0x590cd8['removeAgents'](_0x244a24[_0xde44('0x40')][_0xde44('0x72')])['then'](function(){if(_[_0xde44('0x94')](_0x244a24['query'][_0xde44('0x72')])){for(var _0x238ff4=0x0;_0x238ff4<_0x244a24[_0xde44('0x40')][_0xde44('0x72')][_0xde44('0x44')];_0x238ff4+=0x1){socket[_0xde44('0x90')](_0xde44('0x91'),{'UserId':Number(_0x244a24['query']['ids'][_0x238ff4]),'ChatQueueId':Number(_0x244a24[_0xde44('0x61')]['id'])});}}else{socket[_0xde44('0x90')](_0xde44('0x91'),{'UserId':Number(_0x244a24[_0xde44('0x40')][_0xde44('0x72')]),'ChatQueueId':Number(_0x244a24['params']['id'])});}});}})[_0xde44('0x21')](respondWithStatusCode(_0x282dbe,null))[_0xde44('0x2a')](handleError(_0x282dbe,null));};exports[_0xde44('0x95')]=function(_0x2f357a,_0x4a0635,_0x428876){var _0x53704d={};var _0x3800e4={};var _0x18ace7;var _0x92fd54;return db['ChatQueue'][_0xde44('0x64')]({'where':{'id':_0x2f357a['params']['id']}})[_0xde44('0x21')](handleEntityNotFound(_0x4a0635,null))[_0xde44('0x21')](function(_0x2113dd){if(_0x2113dd){_0x18ace7=_0x2113dd;_0x3800e4['model']=_['keys'](db[_0xde44('0x73')][_0xde44('0x3c')]);_0x3800e4[_0xde44('0x40')]=_[_0xde44('0x55')](_0x2f357a[_0xde44('0x40')]);_0x3800e4[_0xde44('0x41')]=_['intersection'](_0x3800e4[_0xde44('0x3f')],_0x3800e4['query']);_0x53704d[_0xde44('0x42')]=_['intersection'](_0x3800e4['model'],qs[_0xde44('0x43')](_0x2f357a[_0xde44('0x40')][_0xde44('0x43')]));_0x53704d[_0xde44('0x42')]=_0x53704d[_0xde44('0x42')][_0xde44('0x44')]?_0x53704d[_0xde44('0x42')]:_0x3800e4[_0xde44('0x3f')];_0x53704d[_0xde44('0x47')]=qs[_0xde44('0x48')](_0x2f357a['query'][_0xde44('0x48')]);_0x53704d[_0xde44('0x49')]=qs['filters'](_['pick'](_0x2f357a['query'],_0x3800e4[_0xde44('0x41')]));if(_0x2f357a[_0xde44('0x40')][_0xde44('0x4b')]){_0x53704d[_0xde44('0x49')]=_[_0xde44('0x4c')](_0x53704d[_0xde44('0x49')],{'$or':_[_0xde44('0x3b')](_0x53704d[_0xde44('0x42')],function(_0x9eba79){var _0x4436f5={};_0x4436f5[_0x9eba79]={'$like':'%'+_0x2f357a[_0xde44('0x40')][_0xde44('0x4b')]+'%'};return _0x4436f5;})});}_0x53704d=_[_0xde44('0x4c')]({},_0x53704d,_0x2f357a[_0xde44('0x57')]);return _0x18ace7[_0xde44('0x95')](_0x53704d);}})[_0xde44('0x21')](function(_0x212dc4){if(_0x212dc4){_0x92fd54=_0x212dc4['length'];if(!_0x2f357a['query'][_0xde44('0x45')]('nolimit')){_0x53704d[_0xde44('0x2d')]=qs['limit'](_0x2f357a['query']['limit']);_0x53704d[_0xde44('0x2c')]=qs[_0xde44('0x2c')](_0x2f357a[_0xde44('0x40')][_0xde44('0x2c')]);}return _0x18ace7['getAgents'](_0x53704d);}})[_0xde44('0x21')](function(_0xb447bc){if(_0xb447bc){return _0xb447bc?{'count':_0x92fd54,'rows':_0xb447bc}:null;}})['then'](respondWithResult(_0x4a0635,null))['catch'](handleError(_0x4a0635,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index cd53779..267ca06 100644 --- a/server/api/chatQueue/chatQueue.events.js +++ b/server/api/chatQueue/chatQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update'];(function(_0x1b6657,_0x4cfe1c){var _0x3c1bbe=function(_0x3163da){while(--_0x3163da){_0x1b6657['push'](_0x1b6657['shift']());}};_0x3c1bbe(++_0x4cfe1c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x162d33,_0x49b23d){_0x162d33=_0x162d33-0x0;var _0x55fa06=_0x5f2f[_0x162d33];return _0x55fa06;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var ChatQueue=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){ChatQueueEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);ChatQueueEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];ChatQueue[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=ChatQueueEvents; \ No newline at end of file +var _0xb10b=['hasOwnProperty','hook','events','ChatQueue','setMaxListeners','save','remove','emit'];(function(_0x4f0e17,_0x426b82){var _0x1d43e1=function(_0x362348){while(--_0x362348){_0x4f0e17['push'](_0x4f0e17['shift']());}};_0x1d43e1(++_0x426b82);}(_0xb10b,0x12a));var _0xbb10=function(_0x49d7c8,_0x52d9a3){_0x49d7c8=_0x49d7c8-0x0;var _0x450089=_0xb10b[_0x49d7c8];return _0x450089;};'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 e7e9379..d976ddb 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 _0x865c=['moment','bluebird','request-promise','./chatQueue.attributes','exports','define','chat_queues','lodash'];(function(_0x5192de,_0x4e91cd){var _0x4e287e=function(_0x3639bc){while(--_0x3639bc){_0x5192de['push'](_0x5192de['shift']());}};_0x4e287e(++_0x4e91cd);}(_0x865c,0x1a7));var _0xc865=function(_0x1e26da,_0x4320ff){_0x1e26da=_0x1e26da-0x0;var _0xee354d=_0x865c[_0x1e26da];return _0xee354d;};'use strict';var _=require(_0xc865('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xc865('0x1'));var BPromise=require(_0xc865('0x2'));var rp=require(_0xc865('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc865('0x4'));module[_0xc865('0x5')]=function(_0x52d175,_0x31e2b9){return _0x52d175[_0xc865('0x6')]('ChatQueue',attributes,{'tableName':_0xc865('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x844e=['chat_queues','lodash','util','api','bluebird','path','rimraf','./chatQueue.attributes','exports','define'];(function(_0x4aa5d2,_0x1a165c){var _0x56e945=function(_0x1bfdd2){while(--_0x1bfdd2){_0x4aa5d2['push'](_0x4aa5d2['shift']());}};_0x56e945(++_0x1a165c);}(_0x844e,0x1d7));var _0xe844=function(_0x45d91b,_0x20f6b9){_0x45d91b=_0x45d91b-0x0;var _0x59f0fb=_0x844e[_0x45d91b];return _0x59f0fb;};'use strict';var _=require(_0xe844('0x0'));var util=require(_0xe844('0x1'));var logger=require('../../config/logger')(_0xe844('0x2'));var moment=require('moment');var BPromise=require(_0xe844('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe844('0x4'));var rimraf=require(_0xe844('0x5'));var config=require('../../config/environment');var attributes=require(_0xe844('0x6'));module[_0xe844('0x7')]=function(_0x2cab1c,_0x556895){return _0x2cab1c[_0xe844('0x8')]('ChatQueue',attributes,{'tableName':_0xe844('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index ca7b8ea..3e20321 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 _0xdf62=['code','ChatQueue,\x20%s,\x20%s','message','catch','GetChatQueue','ChatQueue','options','raw','where','attributes','limit','include','map','model','then','ShowChatQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./chatQueue.socket','register','request','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2cf22d,_0x5e0808){var _0x1f476f=function(_0x4f5a15){while(--_0x4f5a15){_0x2cf22d['push'](_0x2cf22d['shift']());}};_0x1f476f(++_0x5e0808);}(_0xdf62,0x151));var _0x2df6=function(_0x330538,_0x170937){_0x330538=_0x330538-0x0;var _0x41471d=_0xdf62[_0x330538];return _0x41471d;};'use strict';var _=require(_0x2df6('0x0'));var util=require(_0x2df6('0x1'));var moment=require(_0x2df6('0x2'));var BPromise=require(_0x2df6('0x3'));var rs=require(_0x2df6('0x4'));var fs=require('fs');var Redis=require(_0x2df6('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2df6('0x6'))(_0x2df6('0x7'));var config=require(_0x2df6('0x8'));var jayson=require(_0x2df6('0x9'));var client=jayson[_0x2df6('0xa')][_0x2df6('0xb')]({'port':0x232a});config[_0x2df6('0xc')]=_['defaults'](config[_0x2df6('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x2df6('0xd'))(new Redis(config[_0x2df6('0xc')]));require(_0x2df6('0xe'))[_0x2df6('0xf')](socket);function respondWithRpcPromise(_0x4928b0,_0x51072c,_0x1df717){return new BPromise(function(_0x2f9dc8,_0x1377cb){return client[_0x2df6('0x10')](_0x4928b0,_0x1df717)['then'](function(_0x228356){logger[_0x2df6('0x11')]('ChatQueue,\x20%s,\x20%s',_0x51072c,_0x2df6('0x12'));logger[_0x2df6('0x13')](_0x2df6('0x14'),_0x51072c,_0x2df6('0x12'),JSON[_0x2df6('0x15')](_0x228356));if(_0x228356['error']){if(_0x228356[_0x2df6('0x16')][_0x2df6('0x17')]===0x1f4){logger[_0x2df6('0x16')](_0x2df6('0x18'),_0x51072c,_0x228356[_0x2df6('0x16')]['message']);return _0x1377cb(_0x228356[_0x2df6('0x16')][_0x2df6('0x19')]);}logger[_0x2df6('0x16')](_0x2df6('0x18'),_0x51072c,_0x228356[_0x2df6('0x16')]['message']);return _0x2f9dc8(_0x228356[_0x2df6('0x16')][_0x2df6('0x19')]);}else{logger[_0x2df6('0x11')](_0x2df6('0x18'),_0x51072c,_0x2df6('0x12'));_0x2f9dc8(_0x228356['result'][_0x2df6('0x19')]);}})[_0x2df6('0x1a')](function(_0x34324a){logger[_0x2df6('0x16')](_0x2df6('0x18'),_0x51072c,_0x34324a);_0x1377cb(_0x34324a);});});}exports[_0x2df6('0x1b')]=function(_0x24aa14){var _0x4b8636=this;return new Promise(function(_0x41f6c3,_0x18da98){return db[_0x2df6('0x1c')]['findAll']({'raw':_0x24aa14[_0x2df6('0x1d')]?_0x24aa14[_0x2df6('0x1d')][_0x2df6('0x1e')]===undefined?!![]:![]:!![],'where':_0x24aa14['options']?_0x24aa14[_0x2df6('0x1d')][_0x2df6('0x1f')]||null:null,'attributes':_0x24aa14[_0x2df6('0x1d')]?_0x24aa14[_0x2df6('0x1d')][_0x2df6('0x20')]||null:null,'limit':_0x24aa14[_0x2df6('0x1d')]?_0x24aa14[_0x2df6('0x1d')][_0x2df6('0x21')]||null:null,'include':_0x24aa14[_0x2df6('0x1d')]?_0x24aa14[_0x2df6('0x1d')][_0x2df6('0x22')]?_[_0x2df6('0x23')](_0x24aa14['options']['include'],function(_0x19bbc0){return{'model':db[_0x19bbc0[_0x2df6('0x24')]],'as':_0x19bbc0['as'],'attributes':_0x19bbc0[_0x2df6('0x20')],'include':_0x19bbc0['include']?_[_0x2df6('0x23')](_0x19bbc0[_0x2df6('0x22')],function(_0x4abd1a){return{'model':db[_0x4abd1a[_0x2df6('0x24')]],'as':_0x4abd1a['as'],'attributes':_0x4abd1a['attributes'],'include':_0x4abd1a[_0x2df6('0x22')]?_['map'](_0x4abd1a[_0x2df6('0x22')],function(_0x5b0a98){return{'model':db[_0x5b0a98[_0x2df6('0x24')]],'as':_0x5b0a98['as'],'attributes':_0x5b0a98[_0x2df6('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2df6('0x25')](function(_0x376998){logger['info'](_0x2df6('0x1b'),_0x24aa14);logger['debug']('GetChatQueue',_0x24aa14,JSON[_0x2df6('0x15')](_0x376998));_0x41f6c3(_0x376998);})[_0x2df6('0x1a')](function(_0x2c298b){logger['error'](_0x2df6('0x1b'),_0x2c298b[_0x2df6('0x19')],_0x24aa14);_0x18da98(_0x4b8636[_0x2df6('0x16')](0x1f4,_0x2c298b[_0x2df6('0x19')]));});});};exports[_0x2df6('0x26')]=function(_0x246505){var _0x23c6da=this;return new Promise(function(_0x56f86a,_0x240045){return db[_0x2df6('0x1c')][_0x2df6('0x27')]({'raw':_0x246505[_0x2df6('0x1d')]?_0x246505['options'][_0x2df6('0x1e')]===undefined?!![]:![]:!![],'where':_0x246505['options']?_0x246505['options'][_0x2df6('0x1f')]||null:null,'attributes':_0x246505[_0x2df6('0x1d')]?_0x246505[_0x2df6('0x1d')][_0x2df6('0x20')]||null:null,'include':_0x246505['options']?_0x246505[_0x2df6('0x1d')][_0x2df6('0x22')]?_[_0x2df6('0x23')](_0x246505[_0x2df6('0x1d')][_0x2df6('0x22')],function(_0x18d63f){return{'model':db[_0x18d63f['model']],'as':_0x18d63f['as'],'attributes':_0x18d63f[_0x2df6('0x20')],'include':_0x18d63f[_0x2df6('0x22')]?_['map'](_0x18d63f[_0x2df6('0x22')],function(_0x3835b3){return{'model':db[_0x3835b3[_0x2df6('0x24')]],'as':_0x3835b3['as'],'attributes':_0x3835b3[_0x2df6('0x20')],'include':_0x3835b3[_0x2df6('0x22')]?_[_0x2df6('0x23')](_0x3835b3['include'],function(_0x3733af){return{'model':db[_0x3733af[_0x2df6('0x24')]],'as':_0x3733af['as'],'attributes':_0x3733af[_0x2df6('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2df6('0x25')](function(_0x392d46){logger[_0x2df6('0x11')]('ShowChatQueue',_0x246505);logger['debug'](_0x2df6('0x26'),_0x246505,JSON['stringify'](_0x392d46));_0x56f86a(_0x392d46);})['catch'](function(_0x4b62cc){logger[_0x2df6('0x16')](_0x2df6('0x26'),_0x4b62cc['message'],_0x246505);_0x240045(_0x23c6da[_0x2df6('0x16')](0x1f4,_0x4b62cc[_0x2df6('0x19')]));});});}; \ No newline at end of file +var _0xaf9f=['http','redis','defaults','localhost','./chatQueue.socket','register','request','info','ChatQueue,\x20%s,\x20%s','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','ChatQueue','options','limit','map','include','model','attributes','debug','stringify','ShowChatQueue','find','raw','where','then','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client'];(function(_0x5dacdd,_0x444643){var _0x55ee27=function(_0x535762){while(--_0x535762){_0x5dacdd['push'](_0x5dacdd['shift']());}};_0x55ee27(++_0x444643);}(_0xaf9f,0x1b4));var _0xfaf9=function(_0x5b4c44,_0x2e495e){_0x5b4c44=_0x5b4c44-0x0;var _0x58485a=_0xaf9f[_0x5b4c44];return _0x58485a;};'use strict';var _=require(_0xfaf9('0x0'));var util=require('util');var moment=require(_0xfaf9('0x1'));var BPromise=require(_0xfaf9('0x2'));var rs=require(_0xfaf9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfaf9('0x4'));var logger=require(_0xfaf9('0x5'))(_0xfaf9('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfaf9('0x7')][_0xfaf9('0x8')]({'port':0x232a});config[_0xfaf9('0x9')]=_[_0xfaf9('0xa')](config['redis'],{'host':_0xfaf9('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfaf9('0x9')]));require(_0xfaf9('0xc'))[_0xfaf9('0xd')](socket);function respondWithRpcPromise(_0x14e773,_0x32656d,_0x31e9ad){return new BPromise(function(_0x35f316,_0x5107bf){return client[_0xfaf9('0xe')](_0x14e773,_0x31e9ad)['then'](function(_0x497979){logger[_0xfaf9('0xf')](_0xfaf9('0x10'),_0x32656d,'request\x20sent');logger['debug'](_0xfaf9('0x11'),_0x32656d,_0xfaf9('0x12'),JSON['stringify'](_0x497979));if(_0x497979[_0xfaf9('0x13')]){if(_0x497979['error'][_0xfaf9('0x14')]===0x1f4){logger['error'](_0xfaf9('0x10'),_0x32656d,_0x497979[_0xfaf9('0x13')][_0xfaf9('0x15')]);return _0x5107bf(_0x497979[_0xfaf9('0x13')][_0xfaf9('0x15')]);}logger[_0xfaf9('0x13')](_0xfaf9('0x10'),_0x32656d,_0x497979[_0xfaf9('0x13')]['message']);return _0x35f316(_0x497979[_0xfaf9('0x13')][_0xfaf9('0x15')]);}else{logger[_0xfaf9('0xf')](_0xfaf9('0x10'),_0x32656d,_0xfaf9('0x12'));_0x35f316(_0x497979['result']['message']);}})[_0xfaf9('0x16')](function(_0x31cf9c){logger['error'](_0xfaf9('0x10'),_0x32656d,_0x31cf9c);_0x5107bf(_0x31cf9c);});});}exports['GetChatQueue']=function(_0x1c3337){var _0x2b4973=this;return new Promise(function(_0x3f5949,_0x1d3381){return db[_0xfaf9('0x17')]['findAll']({'raw':_0x1c3337['options']?_0x1c3337['options']['raw']===undefined?!![]:![]:!![],'where':_0x1c3337[_0xfaf9('0x18')]?_0x1c3337[_0xfaf9('0x18')]['where']||null:null,'attributes':_0x1c3337[_0xfaf9('0x18')]?_0x1c3337[_0xfaf9('0x18')]['attributes']||null:null,'limit':_0x1c3337[_0xfaf9('0x18')]?_0x1c3337[_0xfaf9('0x18')][_0xfaf9('0x19')]||null:null,'include':_0x1c3337[_0xfaf9('0x18')]?_0x1c3337[_0xfaf9('0x18')]['include']?_[_0xfaf9('0x1a')](_0x1c3337[_0xfaf9('0x18')][_0xfaf9('0x1b')],function(_0x252428){return{'model':db[_0x252428[_0xfaf9('0x1c')]],'as':_0x252428['as'],'attributes':_0x252428[_0xfaf9('0x1d')],'include':_0x252428['include']?_['map'](_0x252428[_0xfaf9('0x1b')],function(_0x399bce){return{'model':db[_0x399bce[_0xfaf9('0x1c')]],'as':_0x399bce['as'],'attributes':_0x399bce[_0xfaf9('0x1d')],'include':_0x399bce['include']?_['map'](_0x399bce['include'],function(_0x313f01){return{'model':db[_0x313f01[_0xfaf9('0x1c')]],'as':_0x313f01['as'],'attributes':_0x313f01[_0xfaf9('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ba0d0){logger['info']('GetChatQueue',_0x1c3337);logger[_0xfaf9('0x1e')]('GetChatQueue',_0x1c3337,JSON[_0xfaf9('0x1f')](_0x5ba0d0));_0x3f5949(_0x5ba0d0);})[_0xfaf9('0x16')](function(_0x5ec594){logger[_0xfaf9('0x13')]('GetChatQueue',_0x5ec594[_0xfaf9('0x15')],_0x1c3337);_0x1d3381(_0x2b4973[_0xfaf9('0x13')](0x1f4,_0x5ec594[_0xfaf9('0x15')]));});});};exports[_0xfaf9('0x20')]=function(_0x3f3565){var _0x1360a9=this;return new Promise(function(_0x50613c,_0x291039){return db[_0xfaf9('0x17')][_0xfaf9('0x21')]({'raw':_0x3f3565[_0xfaf9('0x18')]?_0x3f3565[_0xfaf9('0x18')][_0xfaf9('0x22')]===undefined?!![]:![]:!![],'where':_0x3f3565[_0xfaf9('0x18')]?_0x3f3565[_0xfaf9('0x18')][_0xfaf9('0x23')]||null:null,'attributes':_0x3f3565[_0xfaf9('0x18')]?_0x3f3565[_0xfaf9('0x18')]['attributes']||null:null,'include':_0x3f3565['options']?_0x3f3565[_0xfaf9('0x18')]['include']?_[_0xfaf9('0x1a')](_0x3f3565['options'][_0xfaf9('0x1b')],function(_0x3def7f){return{'model':db[_0x3def7f[_0xfaf9('0x1c')]],'as':_0x3def7f['as'],'attributes':_0x3def7f[_0xfaf9('0x1d')],'include':_0x3def7f[_0xfaf9('0x1b')]?_['map'](_0x3def7f[_0xfaf9('0x1b')],function(_0x2aaa8f){return{'model':db[_0x2aaa8f[_0xfaf9('0x1c')]],'as':_0x2aaa8f['as'],'attributes':_0x2aaa8f['attributes'],'include':_0x2aaa8f[_0xfaf9('0x1b')]?_[_0xfaf9('0x1a')](_0x2aaa8f[_0xfaf9('0x1b')],function(_0x54c04c){return{'model':db[_0x54c04c['model']],'as':_0x54c04c['as'],'attributes':_0x54c04c[_0xfaf9('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xfaf9('0x24')](function(_0x536c04){logger[_0xfaf9('0xf')]('ShowChatQueue',_0x3f3565);logger['debug'](_0xfaf9('0x20'),_0x3f3565,JSON[_0xfaf9('0x1f')](_0x536c04));_0x50613c(_0x536c04);})[_0xfaf9('0x16')](function(_0x3f521d){logger[_0xfaf9('0x13')]('ShowChatQueue',_0x3f521d[_0xfaf9('0x15')],_0x3f3565);_0x291039(_0x1360a9[_0xfaf9('0x13')](0x1f4,_0x3f521d[_0xfaf9('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index df59254..db8d1fb 100644 --- a/server/api/chatQueue/chatQueue.socket.js +++ b/server/api/chatQueue/chatQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['emit','removeListener','register','chatQueue:','./chatQueue.events','remove','update'];(function(_0xec1b03,_0x1ed76f){var _0x140c51=function(_0x2081cb){while(--_0x2081cb){_0xec1b03['push'](_0xec1b03['shift']());}};_0x140c51(++_0x1ed76f);}(_0xb10b,0x12a));var _0xbb10=function(_0x213721,_0xc41653){_0x213721=_0x213721-0x0;var _0x6435ee=_0xb10b[_0x213721];return _0x6435ee;};'use strict';var ChatQueueEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatQueueEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatQueueEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file +var _0x0b0e=['chatQueue:','./chatQueue.events','remove','emit','removeListener','register'];(function(_0x31591a,_0x59d3bd){var _0x516c6c=function(_0x2d22e8){while(--_0x2d22e8){_0x31591a['push'](_0x31591a['shift']());}};_0x516c6c(++_0x59d3bd);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4c6d6f,_0x291557){_0x4c6d6f=_0x4c6d6f-0x0;var _0x2d4478=_0x0b0e[_0x4c6d6f];return _0x2d4478;};'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 diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index a0e5287..0076b2c 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 _0xa16f=['get','isAuthenticated','index','/describe','describe','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','update','delete','destroy','removeTeams','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller'];(function(_0x2d0b15,_0x315b77){var _0x40f821=function(_0x16e576){while(--_0x16e576){_0x2d0b15['push'](_0x2d0b15['shift']());}};_0x40f821(++_0x315b77);}(_0xa16f,0xd9));var _0xfa16=function(_0x1acc2a,_0x4ce0dc){_0x1acc2a=_0x1acc2a-0x0;var _0x4ef342=_0xa16f[_0x1acc2a];return _0x4ef342;};'use strict';var multer=require(_0xfa16('0x0'));var util=require(_0xfa16('0x1'));var path=require('path');var timeout=require(_0xfa16('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xfa16('0x3'));var interaction=require(_0xfa16('0x4'));var config=require(_0xfa16('0x5'));var controller=require(_0xfa16('0x6'));router[_0xfa16('0x7')]('/',auth[_0xfa16('0x8')](),controller[_0xfa16('0x9')]);router[_0xfa16('0x7')](_0xfa16('0xa'),auth[_0xfa16('0x8')](),controller[_0xfa16('0xb')]);router[_0xfa16('0x7')]('/:id',auth[_0xfa16('0x8')](),controller[_0xfa16('0xc')]);router[_0xfa16('0x7')]('/:id/members',auth[_0xfa16('0x8')](),controller[_0xfa16('0xd')]);router[_0xfa16('0x7')](_0xfa16('0xe'),auth[_0xfa16('0x8')](),controller[_0xfa16('0xf')]);router[_0xfa16('0x7')](_0xfa16('0x10'),auth[_0xfa16('0x8')](),controller[_0xfa16('0x11')]);router[_0xfa16('0x12')]('/',auth['isAuthenticated'](),controller[_0xfa16('0x13')]);router[_0xfa16('0x12')](_0xfa16('0xe'),auth[_0xfa16('0x8')](),controller[_0xfa16('0x14')]);router[_0xfa16('0x12')]('/:id/users',auth[_0xfa16('0x8')](),controller[_0xfa16('0x15')]);router[_0xfa16('0x16')](_0xfa16('0x17'),auth['isAuthenticated'](),controller[_0xfa16('0x18')]);router[_0xfa16('0x19')](_0xfa16('0x17'),auth['isAuthenticated'](),controller[_0xfa16('0x1a')]);router['delete'](_0xfa16('0xe'),auth[_0xfa16('0x8')](),controller[_0xfa16('0x1b')]);router['delete'](_0xfa16('0x10'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xa68c=['/:id','show','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addAgents','update','delete','removeAgents','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','isAuthenticated','get','/describe','describe'];(function(_0x5ccbba,_0x30b39a){var _0x1aca2b=function(_0x1cc6bc){while(--_0x1cc6bc){_0x5ccbba['push'](_0x5ccbba['shift']());}};_0x1aca2b(++_0x30b39a);}(_0xa68c,0x1cf));var _0xca68=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa68c[_0x55f8b4];return _0x2475f9;};'use strict';var multer=require(_0xca68('0x0'));var util=require(_0xca68('0x1'));var path=require(_0xca68('0x2'));var timeout=require('connect-timeout');var express=require(_0xca68('0x3'));var router=express['Router']();var auth=require(_0xca68('0x4'));var interaction=require(_0xca68('0x5'));var config=require(_0xca68('0x6'));var controller=require(_0xca68('0x7'));router['get']('/',auth[_0xca68('0x8')](),controller['index']);router[_0xca68('0x9')](_0xca68('0xa'),auth[_0xca68('0x8')](),controller[_0xca68('0xb')]);router[_0xca68('0x9')](_0xca68('0xc'),auth['isAuthenticated'](),controller[_0xca68('0xd')]);router[_0xca68('0x9')]('/:id/members',auth[_0xca68('0x8')](),controller[_0xca68('0xe')]);router['get']('/:id/teams',auth[_0xca68('0x8')](),controller[_0xca68('0xf')]);router[_0xca68('0x9')](_0xca68('0x10'),auth[_0xca68('0x8')](),controller[_0xca68('0x11')]);router[_0xca68('0x12')]('/',auth[_0xca68('0x8')](),controller[_0xca68('0x13')]);router[_0xca68('0x12')](_0xca68('0x14'),auth[_0xca68('0x8')](),controller['addTeams']);router['post']('/:id/users',auth[_0xca68('0x8')](),controller[_0xca68('0x15')]);router['put'](_0xca68('0xc'),auth['isAuthenticated'](),controller[_0xca68('0x16')]);router['delete'](_0xca68('0xc'),auth['isAuthenticated'](),controller['destroy']);router[_0xca68('0x17')]('/:id/teams',auth[_0xca68('0x8')](),controller['removeTeams']);router[_0xca68('0x17')]('/:id/users',auth['isAuthenticated'](),controller[_0xca68('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index c8a48c2..2e89da8 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 _0xffcc=['DATE','STRING','moment','exports'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xffcc,0x76));var _0xcffc=function(_0x574839,_0x2f3943){_0x574839=_0x574839-0x0;var _0x269d2e=_0xffcc[_0x574839];return _0x269d2e;};'use strict';var moment=require(_0xcffc('0x0'));var Sequelize=require('sequelize');module[_0xcffc('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xcffc('0x2')]},'reason':{'type':Sequelize[_0xcffc('0x3')]}}; \ No newline at end of file +var _0xcbbd=['DATE','sequelize','exports','STRING'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xcbbd,0x6d));var _0xdcbb=function(_0x134827,_0x21f6ed){_0x134827=_0x134827-0x0;var _0x366671=_0xcbbd[_0x134827];return _0x366671;};'use strict';var moment=require('moment');var Sequelize=require(_0xdcbb('0x0'));module[_0xdcbb('0x1')]={'uniqueid':{'type':Sequelize[_0xdcbb('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xdcbb('0x2')]},'joinAt':{'type':Sequelize[_0xdcbb('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xdcbb('0x3')]},'exitAt':{'type':Sequelize[_0xdcbb('0x3')]},'reason':{'type':Sequelize[_0xdcbb('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 968bb78..806f73f 100644 --- a/server/api/chatQueueReport/chatQueueReport.controller.js +++ b/server/api/chatQueueReport/chatQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','end','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x2c4bb5,_0x2d0a38){var _0x5dc002=function(_0x5c11ce){while(--_0x5c11ce){_0x2c4bb5['push'](_0x2c4bb5['shift']());}};_0x5dc002(++_0x2d0a38);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0baf('0x0'));var rimraf=require(_0x0baf('0x1'));var zipdir=require(_0x0baf('0x2'));var jsonpatch=require(_0x0baf('0x3'));var rp=require(_0x0baf('0x4'));var moment=require(_0x0baf('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0baf('0x6'));var util=require(_0x0baf('0x7'));var path=require(_0x0baf('0x8'));var sox=require(_0x0baf('0x9'));var csv=require(_0x0baf('0xa'));var ejs=require(_0x0baf('0xb'));var fs=require('fs');var _=require(_0x0baf('0xc'));var squel=require(_0x0baf('0xd'));var crypto=require(_0x0baf('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0baf('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0baf('0x10'));var Papa=require(_0x0baf('0x11'));var Redis=require(_0x0baf('0x12'));var authService=require(_0x0baf('0x13'));var qs=require(_0x0baf('0x14'));var as=require(_0x0baf('0x15'));var hardwareService=require(_0x0baf('0x16'));var logger=require(_0x0baf('0x17'))(_0x0baf('0x18'));var utils=require(_0x0baf('0x19'));var config=require(_0x0baf('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a53e2,_0x465dd7){_0x465dd7=_0x465dd7||0xcc;return function(_0xe4378c){if(_0xe4378c){return _0x5a53e2[_0x0baf('0x1b')](_0x465dd7);}return _0x5a53e2[_0x0baf('0x1c')](_0x465dd7)['end']();};}function respondWithResult(_0x2ab33e,_0x49e44b){_0x49e44b=_0x49e44b||0xc8;return function(_0x1c76a8){if(_0x1c76a8){return _0x2ab33e[_0x0baf('0x1c')](_0x49e44b)[_0x0baf('0x1d')](_0x1c76a8);}};}function respondWithFilteredResult(_0x2bc381,_0xb8339e){return function(_0x469599){if(_0x469599){var _0x4f80a8=_0x469599[_0x0baf('0x1e')],_0x4cd79d=_0xb8339e[_0x0baf('0x1f')],_0x2312c7=_0xb8339e[_0x0baf('0x1f')]+_0xb8339e[_0x0baf('0x20')],_0x38395b;if(_0x2312c7>=_0x4f80a8){_0x2312c7=_0x4f80a8;_0x38395b=0xc8;}else{_0x38395b=0xce;}_0x2bc381['status'](_0x38395b);return _0x2bc381[_0x0baf('0x21')](_0x0baf('0x22'),_0x4cd79d+'-'+_0x2312c7+'/'+_0x4f80a8)[_0x0baf('0x1d')](_0x469599);}return null;};}function patchUpdates(_0x3e9cb4){return function(_0x47070d){try{jsonpatch[_0x0baf('0x23')](_0x47070d,_0x3e9cb4,!![]);}catch(_0x4ff793){return BPromise['reject'](_0x4ff793);}return _0x47070d[_0x0baf('0x24')]();};}function saveUpdates(_0x154f48,_0x32e839){return function(_0x1848e8){if(_0x1848e8){return _0x1848e8[_0x0baf('0x25')](_0x154f48)[_0x0baf('0x26')](function(_0x210cd8){return _0x210cd8;});}return null;};}function removeEntity(_0x636a13,_0x2c42e2){return function(_0x15a2c3){if(_0x15a2c3){return _0x15a2c3['destroy']()[_0x0baf('0x26')](function(){_0x636a13['status'](0xcc)[_0x0baf('0x27')]();});}};}function handleEntityNotFound(_0x5dbf00,_0x4de74c){return function(_0x2ef0aa){if(!_0x2ef0aa){_0x5dbf00['sendStatus'](0x194);}return _0x2ef0aa;};}function handleError(_0x4be1b9,_0x47c4b){_0x47c4b=_0x47c4b||0x1f4;return function(_0x27b59c){logger[_0x0baf('0x28')](_0x27b59c[_0x0baf('0x29')]);if(_0x27b59c[_0x0baf('0x2a')]){delete _0x27b59c['name'];}_0x4be1b9[_0x0baf('0x1c')](_0x47c4b)[_0x0baf('0x2b')](_0x27b59c);};}exports[_0x0baf('0x2c')]=function(_0x366e71,_0x3843b8){var _0x3b9b31={},_0x453525={},_0x549fd0={'count':0x0,'rows':[]};var _0x1590b4=_[_0x0baf('0x2d')](db[_0x0baf('0x2e')][_0x0baf('0x2f')],function(_0x55c715){return{'name':_0x55c715[_0x0baf('0x30')],'type':_0x55c715[_0x0baf('0x31')]['key']};});_0x453525[_0x0baf('0x32')]=_[_0x0baf('0x2d')](_0x1590b4,_0x0baf('0x2a'));_0x453525[_0x0baf('0x33')]=_[_0x0baf('0x34')](_0x366e71[_0x0baf('0x33')]);_0x453525[_0x0baf('0x35')]=_['intersection'](_0x453525[_0x0baf('0x32')],_0x453525[_0x0baf('0x33')]);_0x3b9b31[_0x0baf('0x36')]=_[_0x0baf('0x37')](_0x453525[_0x0baf('0x32')],qs[_0x0baf('0x38')](_0x366e71[_0x0baf('0x33')][_0x0baf('0x38')]));_0x3b9b31[_0x0baf('0x36')]=_0x3b9b31[_0x0baf('0x36')][_0x0baf('0x39')]?_0x3b9b31[_0x0baf('0x36')]:_0x453525[_0x0baf('0x32')];if(!_0x366e71[_0x0baf('0x33')]['hasOwnProperty'](_0x0baf('0x3a'))){_0x3b9b31['limit']=qs[_0x0baf('0x20')](_0x366e71[_0x0baf('0x33')][_0x0baf('0x20')]);_0x3b9b31[_0x0baf('0x1f')]=qs['offset'](_0x366e71[_0x0baf('0x33')][_0x0baf('0x1f')]);}_0x3b9b31['order']=qs[_0x0baf('0x3b')](_0x366e71[_0x0baf('0x33')][_0x0baf('0x3b')]);_0x3b9b31[_0x0baf('0x3c')]=qs[_0x0baf('0x35')](_[_0x0baf('0x3d')](_0x366e71[_0x0baf('0x33')],_0x453525[_0x0baf('0x35')]),_0x1590b4);if(_0x366e71['query'][_0x0baf('0x3e')]){_0x3b9b31[_0x0baf('0x3c')]=_['merge'](_0x3b9b31[_0x0baf('0x3c')],{'$or':_['map'](_0x1590b4,function(_0x5c545f){if(_0x5c545f[_0x0baf('0x31')]!==_0x0baf('0x3f')){var _0x5d3ad1={};_0x5d3ad1[_0x5c545f['name']]={'$like':'%'+_0x366e71[_0x0baf('0x33')][_0x0baf('0x3e')]+'%'};return _0x5d3ad1;}})});}_0x3b9b31=_[_0x0baf('0x40')]({},_0x3b9b31,_0x366e71[_0x0baf('0x41')]);var _0x15eb5c={'where':_0x3b9b31[_0x0baf('0x3c')]};return db[_0x0baf('0x2e')][_0x0baf('0x1e')](_0x15eb5c)[_0x0baf('0x26')](function(_0x36c6d2){_0x549fd0[_0x0baf('0x1e')]=_0x36c6d2;if(_0x366e71[_0x0baf('0x33')][_0x0baf('0x42')]){_0x3b9b31[_0x0baf('0x43')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x0baf('0x44')](_0x3b9b31);})[_0x0baf('0x26')](function(_0x4f1de9){_0x549fd0[_0x0baf('0x45')]=_0x4f1de9;return _0x549fd0;})[_0x0baf('0x26')](respondWithFilteredResult(_0x3843b8,_0x3b9b31))[_0x0baf('0x46')](handleError(_0x3843b8,null));};exports[_0x0baf('0x47')]=function(_0x2e20c8,_0x456d0b){var _0x57b581={'raw':!![],'where':{'id':_0x2e20c8[_0x0baf('0x48')]['id']}},_0x23ad34={};_0x23ad34['model']=_[_0x0baf('0x34')](db[_0x0baf('0x2e')][_0x0baf('0x2f')]);_0x23ad34[_0x0baf('0x33')]=_['keys'](_0x2e20c8[_0x0baf('0x33')]);_0x23ad34[_0x0baf('0x35')]=_[_0x0baf('0x37')](_0x23ad34[_0x0baf('0x32')],_0x23ad34[_0x0baf('0x33')]);_0x57b581[_0x0baf('0x36')]=_[_0x0baf('0x37')](_0x23ad34[_0x0baf('0x32')],qs[_0x0baf('0x38')](_0x2e20c8[_0x0baf('0x33')]['fields']));_0x57b581[_0x0baf('0x36')]=_0x57b581[_0x0baf('0x36')][_0x0baf('0x39')]?_0x57b581[_0x0baf('0x36')]:_0x23ad34[_0x0baf('0x32')];if(_0x2e20c8['query'][_0x0baf('0x42')]){_0x57b581[_0x0baf('0x43')]=[{'all':!![]}];}_0x57b581=_[_0x0baf('0x40')]({},_0x57b581,_0x2e20c8[_0x0baf('0x41')]);return db[_0x0baf('0x2e')]['find'](_0x57b581)[_0x0baf('0x26')](handleEntityNotFound(_0x456d0b,null))[_0x0baf('0x26')](respondWithResult(_0x456d0b,null))[_0x0baf('0x46')](handleError(_0x456d0b,null));};exports[_0x0baf('0x49')]=function(_0x41599f,_0x22d10f){return db[_0x0baf('0x2e')]['create'](_0x41599f[_0x0baf('0x4a')],{})[_0x0baf('0x26')](respondWithResult(_0x22d10f,0xc9))[_0x0baf('0x46')](handleError(_0x22d10f,null));};exports['update']=function(_0x3c9de3,_0x2222b6){if(_0x3c9de3[_0x0baf('0x4a')]['id']){delete _0x3c9de3[_0x0baf('0x4a')]['id'];}return db[_0x0baf('0x2e')][_0x0baf('0x4b')]({'where':{'id':_0x3c9de3[_0x0baf('0x48')]['id']}})['then'](handleEntityNotFound(_0x2222b6,null))[_0x0baf('0x26')](saveUpdates(_0x3c9de3[_0x0baf('0x4a')],null))[_0x0baf('0x26')](respondWithResult(_0x2222b6,null))[_0x0baf('0x46')](handleError(_0x2222b6,null));};exports[_0x0baf('0x4c')]=function(_0xc427b2,_0x40d4a6){return db[_0x0baf('0x2e')][_0x0baf('0x4b')]({'where':{'id':_0xc427b2[_0x0baf('0x48')]['id']}})[_0x0baf('0x26')](handleEntityNotFound(_0x40d4a6,null))['then'](removeEntity(_0x40d4a6,null))['catch'](handleError(_0x40d4a6,null));};exports[_0x0baf('0x4d')]=function(_0x3d6b19,_0x1cd114){return db[_0x0baf('0x2e')][_0x0baf('0x4d')]()[_0x0baf('0x26')](respondWithResult(_0x1cd114,null))[_0x0baf('0x46')](handleError(_0x1cd114,null));}; \ No newline at end of file +var _0xd8b0=['intersection','fields','attributes','length','model','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','ChatQueueReport','count','includeAll','include','findAll','catch','show','params','options','create','body','find','destroy','describe','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys'];(function(_0x26bcdb,_0x228e16){var _0x18bc4f=function(_0x1cd9b9){while(--_0x1cd9b9){_0x26bcdb['push'](_0x26bcdb['shift']());}};_0x18bc4f(++_0x228e16);}(_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(){_0x33fb87[_0x0d8b('0x17')](0xcc)[_0x0d8b('0x18')]();});}};}function handleEntityNotFound(_0x38efc8,_0x221071){return function(_0x2c64e2){if(!_0x2c64e2){_0x38efc8[_0x0d8b('0x16')](0x194);}return _0x2c64e2;};}function handleError(_0x4562cb,_0x27b695){_0x27b695=_0x27b695||0x1f4;return function(_0x5e5bc3){logger[_0x0d8b('0x23')](_0x5e5bc3[_0x0d8b('0x24')]);if(_0x5e5bc3['name']){delete _0x5e5bc3[_0x0d8b('0x25')];}_0x4562cb['status'](_0x27b695)[_0x0d8b('0x26')](_0x5e5bc3);};}exports[_0x0d8b('0x27')]=function(_0xa2af02,_0x4fe6f9){var _0x59a905={},_0x28f639={},_0x3ef745={'count':0x0,'rows':[]};var _0x4c05ee=_[_0x0d8b('0x28')](db['ChatQueueReport'][_0x0d8b('0x29')],function(_0x4b59e5){return{'name':_0x4b59e5[_0x0d8b('0x2a')],'type':_0x4b59e5['type'][_0x0d8b('0x2b')]};});_0x28f639['model']=_[_0x0d8b('0x28')](_0x4c05ee,'name');_0x28f639[_0x0d8b('0x2c')]=_[_0x0d8b('0x2d')](_0xa2af02[_0x0d8b('0x2c')]);_0x28f639['filters']=_['intersection'](_0x28f639['model'],_0x28f639[_0x0d8b('0x2c')]);_0x59a905['attributes']=_[_0x0d8b('0x2e')](_0x28f639['model'],qs['fields'](_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x2f')]));_0x59a905[_0x0d8b('0x30')]=_0x59a905[_0x0d8b('0x30')][_0x0d8b('0x31')]?_0x59a905[_0x0d8b('0x30')]:_0x28f639[_0x0d8b('0x32')];if(!_0xa2af02[_0x0d8b('0x2c')]['hasOwnProperty'](_0x0d8b('0x33'))){_0x59a905[_0x0d8b('0x1b')]=qs['limit'](_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x1b')]);_0x59a905[_0x0d8b('0x1a')]=qs['offset'](_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x1a')]);}_0x59a905[_0x0d8b('0x34')]=qs[_0x0d8b('0x35')](_0xa2af02[_0x0d8b('0x2c')]['sort']);_0x59a905[_0x0d8b('0x36')]=qs[_0x0d8b('0x37')](_['pick'](_0xa2af02[_0x0d8b('0x2c')],_0x28f639[_0x0d8b('0x37')]),_0x4c05ee);if(_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x38')]){_0x59a905[_0x0d8b('0x36')]=_['merge'](_0x59a905['where'],{'$or':_[_0x0d8b('0x28')](_0x4c05ee,function(_0x5c2c04){if(_0x5c2c04['type']!==_0x0d8b('0x39')){var _0x2e279c={};_0x2e279c[_0x5c2c04[_0x0d8b('0x25')]]={'$like':'%'+_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x38')]+'%'};return _0x2e279c;}})});}_0x59a905=_[_0x0d8b('0x3a')]({},_0x59a905,_0xa2af02['options']);var _0x6e5bab={'where':_0x59a905[_0x0d8b('0x36')]};return db[_0x0d8b('0x3b')][_0x0d8b('0x3c')](_0x6e5bab)[_0x0d8b('0x22')](function(_0x1a39ad){_0x3ef745[_0x0d8b('0x3c')]=_0x1a39ad;if(_0xa2af02['query'][_0x0d8b('0x3d')]){_0x59a905[_0x0d8b('0x3e')]=[{'all':!![]}];}return db[_0x0d8b('0x3b')][_0x0d8b('0x3f')](_0x59a905);})['then'](function(_0xe0bf42){_0x3ef745['rows']=_0xe0bf42;return _0x3ef745;})[_0x0d8b('0x22')](respondWithFilteredResult(_0x4fe6f9,_0x59a905))[_0x0d8b('0x40')](handleError(_0x4fe6f9,null));};exports[_0x0d8b('0x41')]=function(_0x26ac10,_0x35fa7e){var _0x3e632e={'raw':!![],'where':{'id':_0x26ac10[_0x0d8b('0x42')]['id']}},_0x1ff17d={};_0x1ff17d[_0x0d8b('0x32')]=_[_0x0d8b('0x2d')](db['ChatQueueReport']['rawAttributes']);_0x1ff17d['query']=_['keys'](_0x26ac10['query']);_0x1ff17d[_0x0d8b('0x37')]=_[_0x0d8b('0x2e')](_0x1ff17d[_0x0d8b('0x32')],_0x1ff17d['query']);_0x3e632e['attributes']=_[_0x0d8b('0x2e')](_0x1ff17d[_0x0d8b('0x32')],qs[_0x0d8b('0x2f')](_0x26ac10['query'][_0x0d8b('0x2f')]));_0x3e632e[_0x0d8b('0x30')]=_0x3e632e['attributes']['length']?_0x3e632e[_0x0d8b('0x30')]:_0x1ff17d['model'];if(_0x26ac10[_0x0d8b('0x2c')]['includeAll']){_0x3e632e['include']=[{'all':!![]}];}_0x3e632e=_[_0x0d8b('0x3a')]({},_0x3e632e,_0x26ac10[_0x0d8b('0x43')]);return db['ChatQueueReport']['find'](_0x3e632e)['then'](handleEntityNotFound(_0x35fa7e,null))['then'](respondWithResult(_0x35fa7e,null))[_0x0d8b('0x40')](handleError(_0x35fa7e,null));};exports[_0x0d8b('0x44')]=function(_0xd9d4c3,_0x490eda){return db[_0x0d8b('0x3b')][_0x0d8b('0x44')](_0xd9d4c3[_0x0d8b('0x45')],{})[_0x0d8b('0x22')](respondWithResult(_0x490eda,0xc9))[_0x0d8b('0x40')](handleError(_0x490eda,null));};exports[_0x0d8b('0x21')]=function(_0x11d22b,_0x1d5067){if(_0x11d22b[_0x0d8b('0x45')]['id']){delete _0x11d22b[_0x0d8b('0x45')]['id'];}return db[_0x0d8b('0x3b')][_0x0d8b('0x46')]({'where':{'id':_0x11d22b[_0x0d8b('0x42')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x1d5067,null))[_0x0d8b('0x22')](saveUpdates(_0x11d22b[_0x0d8b('0x45')],null))[_0x0d8b('0x22')](respondWithResult(_0x1d5067,null))[_0x0d8b('0x40')](handleError(_0x1d5067,null));};exports[_0x0d8b('0x47')]=function(_0x574b90,_0x371fa0){return db['ChatQueueReport']['find']({'where':{'id':_0x574b90[_0x0d8b('0x42')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x371fa0,null))[_0x0d8b('0x22')](removeEntity(_0x371fa0,null))[_0x0d8b('0x40')](handleError(_0x371fa0,null));};exports['describe']=function(_0x131579,_0x1106d6){return db[_0x0d8b('0x3b')][_0x0d8b('0x48')]()[_0x0d8b('0x22')](respondWithResult(_0x1106d6,null))['catch'](handleError(_0x1106d6,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index deaae5a..0196ec7 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 _0xafc8=['report_chat_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport'];(function(_0x2e1779,_0x427e29){var _0x485848=function(_0x181ab3){while(--_0x181ab3){_0x2e1779['push'](_0x2e1779['shift']());}};_0x485848(++_0x427e29);}(_0xafc8,0x98));var _0x8afc=function(_0xa941a4,_0x34df49){_0xa941a4=_0xa941a4-0x0;var _0x4f7fee=_0xafc8[_0xa941a4];return _0x4f7fee;};'use strict';var _=require(_0x8afc('0x0'));var util=require(_0x8afc('0x1'));var logger=require(_0x8afc('0x2'))('api');var moment=require(_0x8afc('0x3'));var BPromise=require(_0x8afc('0x4'));var rp=require(_0x8afc('0x5'));var fs=require('fs');var path=require(_0x8afc('0x6'));var rimraf=require(_0x8afc('0x7'));var config=require(_0x8afc('0x8'));var attributes=require(_0x8afc('0x9'));module[_0x8afc('0xa')]=function(_0x259d53,_0x5e4df2){return _0x259d53[_0x8afc('0xb')](_0x8afc('0xc'),attributes,{'tableName':_0x8afc('0xd'),'paranoid':![],'indexes':[{'name':_0x8afc('0xe'),'fields':[_0x8afc('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x887b=['./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0x887b,0xfc));var _0xb887=function(_0x36e874,_0x18b74d){_0x36e874=_0x36e874-0x0;var _0x40375e=_0x887b[_0x36e874];return _0x40375e;};'use strict';var _=require(_0xb887('0x0'));var util=require(_0xb887('0x1'));var logger=require(_0xb887('0x2'))(_0xb887('0x3'));var moment=require(_0xb887('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb887('0x5'));var rimraf=require(_0xb887('0x6'));var config=require(_0xb887('0x7'));var attributes=require(_0xb887('0x8'));module[_0xb887('0x9')]=function(_0x1c5000,_0x1894b2){return _0x1c5000[_0xb887('0xa')]('ChatQueueReport',attributes,{'tableName':_0xb887('0xb'),'paranoid':![],'indexes':[{'name':_0xb887('0xc'),'fields':[_0xb887('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index d7f73ab..73ebbf1 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 _0xcb8a=['result','catch','CreateChatQueueReport','create','options','debug','UpdateChatQueueReport','ChatQueueReport','update','body','raw','where','limit','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','then','info','ChatQueueReport,\x20%s,\x20%s','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0xcb8a,0x10d));var _0xacb8=function(_0x45f52f,_0x219ec5){_0x45f52f=_0x45f52f-0x0;var _0x292afb=_0xcb8a[_0x45f52f];return _0x292afb;};'use strict';var _=require('lodash');var util=require(_0xacb8('0x0'));var moment=require(_0xacb8('0x1'));var BPromise=require(_0xacb8('0x2'));var rs=require(_0xacb8('0x3'));var fs=require('fs');var Redis=require(_0xacb8('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xacb8('0x5'))(_0xacb8('0x6'));var config=require(_0xacb8('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xacb8('0x8')][_0xacb8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x17c6b1,_0x464156,_0x226b4b){return new BPromise(function(_0x59ab0e,_0x19285d){return client['request'](_0x17c6b1,_0x226b4b)[_0xacb8('0xa')](function(_0x3bed0b){logger[_0xacb8('0xb')](_0xacb8('0xc'),_0x464156,'request\x20sent');logger['debug'](_0xacb8('0xd'),_0x464156,_0xacb8('0xe'),JSON[_0xacb8('0xf')](_0x3bed0b));if(_0x3bed0b[_0xacb8('0x10')]){if(_0x3bed0b[_0xacb8('0x10')][_0xacb8('0x11')]===0x1f4){logger[_0xacb8('0x10')](_0xacb8('0xc'),_0x464156,_0x3bed0b[_0xacb8('0x10')][_0xacb8('0x12')]);return _0x19285d(_0x3bed0b['error'][_0xacb8('0x12')]);}logger[_0xacb8('0x10')](_0xacb8('0xc'),_0x464156,_0x3bed0b['error'][_0xacb8('0x12')]);return _0x59ab0e(_0x3bed0b[_0xacb8('0x10')][_0xacb8('0x12')]);}else{logger[_0xacb8('0xb')](_0xacb8('0xc'),_0x464156,'request\x20sent');_0x59ab0e(_0x3bed0b[_0xacb8('0x13')]['message']);}})[_0xacb8('0x14')](function(_0x5b1739){logger['error'](_0xacb8('0xc'),_0x464156,_0x5b1739);_0x19285d(_0x5b1739);});});}exports[_0xacb8('0x15')]=function(_0x3755db){var _0x1e5969=this;return new Promise(function(_0x380174,_0x26950f){return db['ChatQueueReport'][_0xacb8('0x16')](_0x3755db['body'],{'raw':_0x3755db[_0xacb8('0x17')]?_0x3755db['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x168412){logger[_0xacb8('0xb')](_0xacb8('0x15'),_0x3755db);logger[_0xacb8('0x18')]('CreateChatQueueReport',_0x3755db,JSON['stringify'](_0x168412));_0x380174(_0x168412);})['catch'](function(_0x7a2114){logger[_0xacb8('0x10')](_0xacb8('0x15'),_0x7a2114[_0xacb8('0x12')],_0x3755db);_0x26950f(_0x1e5969['error'](0x1f4,_0x7a2114[_0xacb8('0x12')]));});});};exports[_0xacb8('0x19')]=function(_0x4c0f7a){var _0x142a18=this;return new Promise(function(_0x5102eb,_0x53de31){return db[_0xacb8('0x1a')][_0xacb8('0x1b')](_0x4c0f7a[_0xacb8('0x1c')],{'raw':_0x4c0f7a[_0xacb8('0x17')]?_0x4c0f7a[_0xacb8('0x17')][_0xacb8('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c0f7a[_0xacb8('0x17')]?_0x4c0f7a['options'][_0xacb8('0x1e')]||null:null,'attributes':_0x4c0f7a['options']?_0x4c0f7a['options']['attributes']||null:null,'limit':_0x4c0f7a['options']?_0x4c0f7a[_0xacb8('0x17')][_0xacb8('0x1f')]||null:null})[_0xacb8('0xa')](function(_0x8ac6d2){logger['info'](_0xacb8('0x19'),_0x4c0f7a);logger[_0xacb8('0x18')](_0xacb8('0x19'),_0x4c0f7a,JSON[_0xacb8('0xf')](_0x8ac6d2));_0x5102eb(_0x8ac6d2);})[_0xacb8('0x14')](function(_0x91f272){logger[_0xacb8('0x10')]('UpdateChatQueueReport',_0x91f272[_0xacb8('0x12')],_0x4c0f7a);_0x53de31(_0x142a18[_0xacb8('0x10')](0x1f4,_0x91f272[_0xacb8('0x12')]));});});}; \ No newline at end of file +var _0xfcd0=['stringify','error','message','result','ChatQueueReport','create','body','options','raw','CreateChatQueueReport','catch','UpdateChatQueueReport','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','ChatQueueReport,\x20%s,\x20%s','debug'];(function(_0x31162c,_0x5be404){var _0xa0815b=function(_0x3b4a8e){while(--_0x3b4a8e){_0x31162c['push'](_0x31162c['shift']());}};_0xa0815b(++_0x5be404);}(_0xfcd0,0xa9));var _0x0fcd=function(_0x324713,_0x1e6122){_0x324713=_0x324713-0x0;var _0x3848d4=_0xfcd0[_0x324713];return _0x3848d4;};'use strict';var _=require(_0x0fcd('0x0'));var util=require(_0x0fcd('0x1'));var moment=require(_0x0fcd('0x2'));var BPromise=require(_0x0fcd('0x3'));var rs=require(_0x0fcd('0x4'));var fs=require('fs');var Redis=require(_0x0fcd('0x5'));var db=require(_0x0fcd('0x6'))['db'];var utils=require(_0x0fcd('0x7'));var logger=require(_0x0fcd('0x8'))('rpc');var config=require(_0x0fcd('0x9'));var jayson=require(_0x0fcd('0xa'));var client=jayson[_0x0fcd('0xb')][_0x0fcd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x31f35b,_0x5c7fa4,_0x49e51b){return new BPromise(function(_0x109ca4,_0x460487){return client['request'](_0x31f35b,_0x49e51b)[_0x0fcd('0xd')](function(_0x22f74f){logger[_0x0fcd('0xe')](_0x0fcd('0xf'),_0x5c7fa4,'request\x20sent');logger[_0x0fcd('0x10')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x5c7fa4,'request\x20sent',JSON[_0x0fcd('0x11')](_0x22f74f));if(_0x22f74f[_0x0fcd('0x12')]){if(_0x22f74f[_0x0fcd('0x12')]['code']===0x1f4){logger[_0x0fcd('0x12')](_0x0fcd('0xf'),_0x5c7fa4,_0x22f74f[_0x0fcd('0x12')][_0x0fcd('0x13')]);return _0x460487(_0x22f74f[_0x0fcd('0x12')][_0x0fcd('0x13')]);}logger[_0x0fcd('0x12')](_0x0fcd('0xf'),_0x5c7fa4,_0x22f74f[_0x0fcd('0x12')][_0x0fcd('0x13')]);return _0x109ca4(_0x22f74f[_0x0fcd('0x12')][_0x0fcd('0x13')]);}else{logger['info'](_0x0fcd('0xf'),_0x5c7fa4,'request\x20sent');_0x109ca4(_0x22f74f[_0x0fcd('0x14')][_0x0fcd('0x13')]);}})['catch'](function(_0x214a43){logger[_0x0fcd('0x12')](_0x0fcd('0xf'),_0x5c7fa4,_0x214a43);_0x460487(_0x214a43);});});}exports['CreateChatQueueReport']=function(_0x347653){var _0x51dfa2=this;return new Promise(function(_0x2ec9eb,_0xe08350){return db[_0x0fcd('0x15')][_0x0fcd('0x16')](_0x347653[_0x0fcd('0x17')],{'raw':_0x347653[_0x0fcd('0x18')]?_0x347653['options'][_0x0fcd('0x19')]===undefined?!![]:![]:!![]})[_0x0fcd('0xd')](function(_0xbc5451){logger[_0x0fcd('0xe')](_0x0fcd('0x1a'),_0x347653);logger['debug'](_0x0fcd('0x1a'),_0x347653,JSON[_0x0fcd('0x11')](_0xbc5451));_0x2ec9eb(_0xbc5451);})[_0x0fcd('0x1b')](function(_0x132ba9){logger['error'](_0x0fcd('0x1a'),_0x132ba9[_0x0fcd('0x13')],_0x347653);_0xe08350(_0x51dfa2[_0x0fcd('0x12')](0x1f4,_0x132ba9[_0x0fcd('0x13')]));});});};exports[_0x0fcd('0x1c')]=function(_0x34054d){var _0x5e59bd=this;return new Promise(function(_0x41bf34,_0x24acf0){return db[_0x0fcd('0x15')]['update'](_0x34054d['body'],{'raw':_0x34054d[_0x0fcd('0x18')]?_0x34054d['options'][_0x0fcd('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34054d[_0x0fcd('0x18')]?_0x34054d[_0x0fcd('0x18')][_0x0fcd('0x1d')]||null:null,'attributes':_0x34054d[_0x0fcd('0x18')]?_0x34054d[_0x0fcd('0x18')][_0x0fcd('0x1e')]||null:null,'limit':_0x34054d[_0x0fcd('0x18')]?_0x34054d['options']['limit']||null:null})[_0x0fcd('0xd')](function(_0x2bc6b8){logger[_0x0fcd('0xe')](_0x0fcd('0x1c'),_0x34054d);logger['debug'](_0x0fcd('0x1c'),_0x34054d,JSON[_0x0fcd('0x11')](_0x2bc6b8));_0x41bf34(_0x2bc6b8);})[_0x0fcd('0x1b')](function(_0x37775e){logger[_0x0fcd('0x12')]('UpdateChatQueueReport',_0x37775e['message'],_0x34054d);_0x24acf0(_0x5e59bd['error'](0x1f4,_0x37775e[_0x0fcd('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 59c63c0..d5d5796 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 _0xc3c7=['post','create','put','update','delete','destroy','exports','multer','connect-timeout','Router','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','/describe','/:id','isAuthenticated','show'];(function(_0x4f4521,_0x4847ab){var _0x4a8571=function(_0x51cc8f){while(--_0x51cc8f){_0x4f4521['push'](_0x4f4521['shift']());}};_0x4a8571(++_0x4847ab);}(_0xc3c7,0x73));var _0x7c3c=function(_0x520e49,_0x4c4d70){_0x520e49=_0x520e49-0x0;var _0x549d48=_0xc3c7[_0x520e49];return _0x549d48;};'use strict';var multer=require(_0x7c3c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7c3c('0x1'));var express=require('express');var router=express[_0x7c3c('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x7c3c('0x3'));var config=require(_0x7c3c('0x4'));var controller=require(_0x7c3c('0x5'));router[_0x7c3c('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7c3c('0x6')](_0x7c3c('0x7'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x7c3c('0x8'),auth[_0x7c3c('0x9')](),controller[_0x7c3c('0xa')]);router[_0x7c3c('0xb')]('/',auth['isAuthenticated'](),controller[_0x7c3c('0xc')]);router[_0x7c3c('0xd')](_0x7c3c('0x8'),auth['isAuthenticated'](),controller[_0x7c3c('0xe')]);router[_0x7c3c('0xf')](_0x7c3c('0x8'),auth[_0x7c3c('0x9')](),controller[_0x7c3c('0x10')]);module[_0x7c3c('0x11')]=router; \ No newline at end of file +var _0x1443=['/describe','/:id','show','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./chatQueueReport.controller','isAuthenticated','get'];(function(_0x3304d7,_0x550912){var _0x2f6b15=function(_0x643057){while(--_0x643057){_0x3304d7['push'](_0x3304d7['shift']());}};_0x2f6b15(++_0x550912);}(_0x1443,0x1ca));var _0x3144=function(_0x114e0,_0x26d452){_0x114e0=_0x114e0-0x0;var _0x49f23f=_0x1443[_0x114e0];return _0x49f23f;};'use strict';var multer=require(_0x3144('0x0'));var util=require(_0x3144('0x1'));var path=require(_0x3144('0x2'));var timeout=require(_0x3144('0x3'));var express=require(_0x3144('0x4'));var router=express['Router']();var auth=require(_0x3144('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3144('0x6'));var controller=require(_0x3144('0x7'));router['get']('/',auth[_0x3144('0x8')](),controller['index']);router[_0x3144('0x9')](_0x3144('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x3144('0x9')](_0x3144('0xb'),auth[_0x3144('0x8')](),controller[_0x3144('0xc')]);router[_0x3144('0xd')]('/',auth[_0x3144('0x8')](),controller['create']);router['put'](_0x3144('0xb'),auth[_0x3144('0x8')](),controller[_0x3144('0xe')]);router[_0x3144('0xf')]('/:id',auth[_0x3144('0x8')](),controller[_0x3144('0x10')]);module[_0x3144('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 8addacf..ad52568 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 _0xb184=['ENUM','agent','queue','moment','sequelize','exports','STRING'];(function(_0x5cc118,_0x479136){var _0x87ff2b=function(_0x2e3aa7){while(--_0x2e3aa7){_0x5cc118['push'](_0x5cc118['shift']());}};_0x87ff2b(++_0x479136);}(_0xb184,0x199));var _0x4b18=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb184[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x4b18('0x0'));var Sequelize=require(_0x4b18('0x1'));module[_0x4b18('0x2')]={'uniqueid':{'type':Sequelize[_0x4b18('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x4b18('0x4')]('account',_0x4b18('0x5'),_0x4b18('0x6')),'allowNull':![],'defaultValue':_0x4b18('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x5964=['sequelize','STRING','ENUM','account','agent','queue','NOW','moment'];(function(_0x221b8c,_0x2c7afc){var _0x3fab9f=function(_0x28bab0){while(--_0x28bab0){_0x221b8c['push'](_0x221b8c['shift']());}};_0x3fab9f(++_0x2c7afc);}(_0x5964,0x14f));var _0x4596=function(_0x18350a,_0x105fe4){_0x18350a=_0x18350a-0x0;var _0x33050e=_0x5964[_0x18350a];return _0x33050e;};'use strict';var moment=require(_0x4596('0x0'));var Sequelize=require(_0x4596('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x4596('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4596('0x3')](_0x4596('0x4'),_0x4596('0x5'),'queue'),'allowNull':![],'defaultValue':_0x4596('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x4596('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index a65d6b6..ed32914 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 _0xa910=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','save','update','then','error','stack','name','send','fieldName','type','map','keys','query','filters','intersection','model','attributes','fields','length','limit','order','sort','where','pick','filter','merge','VIRTUAL','ChatTransferReport','count','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service'];(function(_0x246c1d,_0x468add){var _0x4e9c0e=function(_0x2ada29){while(--_0x2ada29){_0x246c1d['push'](_0x246c1d['shift']());}};_0x4e9c0e(++_0x468add);}(_0xa910,0x101));var _0x0a91=function(_0x1c888d,_0x500e40){_0x1c888d=_0x1c888d-0x0;var _0x88d3f8=_0xa910[_0x1c888d];return _0x88d3f8;};'use strict';var pdf=require(_0x0a91('0x0'));var emlformat=require(_0x0a91('0x1'));var rimraf=require(_0x0a91('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0a91('0x3'));var rp=require(_0x0a91('0x4'));var moment=require('moment');var BPromise=require(_0x0a91('0x5'));var Mustache=require(_0x0a91('0x6'));var util=require('util');var path=require(_0x0a91('0x7'));var sox=require('sox');var csv=require(_0x0a91('0x8'));var ejs=require(_0x0a91('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0a91('0xa'));var crypto=require(_0x0a91('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0a91('0xc'));var toCsv=require(_0x0a91('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0a91('0xd'));var authService=require(_0x0a91('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x0a91('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0a91('0x10'))(_0x0a91('0x11'));var utils=require('../../config/utils');var config=require(_0x0a91('0x12'));var db=require(_0x0a91('0x13'))['db'];function respondWithStatusCode(_0x5bdaee,_0x4e9217){_0x4e9217=_0x4e9217||0xcc;return function(_0x453db7){if(_0x453db7){return _0x5bdaee[_0x0a91('0x14')](_0x4e9217);}return _0x5bdaee[_0x0a91('0x15')](_0x4e9217)[_0x0a91('0x16')]();};}function respondWithResult(_0x3a5978,_0x222a56){_0x222a56=_0x222a56||0xc8;return function(_0x4b97dd){if(_0x4b97dd){return _0x3a5978[_0x0a91('0x15')](_0x222a56)[_0x0a91('0x17')](_0x4b97dd);}};}function respondWithFilteredResult(_0x2649d3,_0x13cd14){return function(_0x2e247c){if(_0x2e247c){var _0x3add64=_0x2e247c['count'],_0x50a26e=_0x13cd14[_0x0a91('0x18')],_0x49ce35=_0x13cd14[_0x0a91('0x18')]+_0x13cd14['limit'],_0x3d1d81;if(_0x49ce35>=_0x3add64){_0x49ce35=_0x3add64;_0x3d1d81=0xc8;}else{_0x3d1d81=0xce;}_0x2649d3[_0x0a91('0x15')](_0x3d1d81);return _0x2649d3[_0x0a91('0x19')](_0x0a91('0x1a'),_0x50a26e+'-'+_0x49ce35+'/'+_0x3add64)[_0x0a91('0x17')](_0x2e247c);}return null;};}function patchUpdates(_0x38da48){return function(_0xadfd1d){try{jsonpatch['apply'](_0xadfd1d,_0x38da48,!![]);}catch(_0x494bd5){return BPromise['reject'](_0x494bd5);}return _0xadfd1d[_0x0a91('0x1b')]();};}function saveUpdates(_0x478d76,_0x35ae81){return function(_0x35f44f){if(_0x35f44f){return _0x35f44f[_0x0a91('0x1c')](_0x478d76)[_0x0a91('0x1d')](function(_0x54cd00){return _0x54cd00;});}return null;};}function removeEntity(_0x2d9471,_0x5db7b5){return function(_0x160f83){if(_0x160f83){return _0x160f83['destroy']()[_0x0a91('0x1d')](function(){_0x2d9471['status'](0xcc)[_0x0a91('0x16')]();});}};}function handleEntityNotFound(_0x501d52,_0x52c3fd){return function(_0x104970){if(!_0x104970){_0x501d52[_0x0a91('0x14')](0x194);}return _0x104970;};}function handleError(_0x1e3472,_0x5d0077){_0x5d0077=_0x5d0077||0x1f4;return function(_0x27723c){logger[_0x0a91('0x1e')](_0x27723c[_0x0a91('0x1f')]);if(_0x27723c['name']){delete _0x27723c[_0x0a91('0x20')];}_0x1e3472[_0x0a91('0x15')](_0x5d0077)[_0x0a91('0x21')](_0x27723c);};}exports['index']=function(_0x2edb7e,_0x30d3a8){var _0x3c572c={},_0x387a19={},_0x3a4b72={'count':0x0,'rows':[]};var _0x2f98c4=_['map'](db['ChatTransferReport']['rawAttributes'],function(_0x3a1965){return{'name':_0x3a1965[_0x0a91('0x22')],'type':_0x3a1965[_0x0a91('0x23')]['key']};});_0x387a19['model']=_[_0x0a91('0x24')](_0x2f98c4,_0x0a91('0x20'));_0x387a19['query']=_[_0x0a91('0x25')](_0x2edb7e[_0x0a91('0x26')]);_0x387a19[_0x0a91('0x27')]=_[_0x0a91('0x28')](_0x387a19[_0x0a91('0x29')],_0x387a19['query']);_0x3c572c[_0x0a91('0x2a')]=_['intersection'](_0x387a19['model'],qs[_0x0a91('0x2b')](_0x2edb7e[_0x0a91('0x26')][_0x0a91('0x2b')]));_0x3c572c[_0x0a91('0x2a')]=_0x3c572c[_0x0a91('0x2a')][_0x0a91('0x2c')]?_0x3c572c[_0x0a91('0x2a')]:_0x387a19[_0x0a91('0x29')];if(!_0x2edb7e['query']['hasOwnProperty']('nolimit')){_0x3c572c[_0x0a91('0x2d')]=qs[_0x0a91('0x2d')](_0x2edb7e['query'][_0x0a91('0x2d')]);_0x3c572c[_0x0a91('0x18')]=qs['offset'](_0x2edb7e[_0x0a91('0x26')][_0x0a91('0x18')]);}_0x3c572c[_0x0a91('0x2e')]=qs[_0x0a91('0x2f')](_0x2edb7e[_0x0a91('0x26')][_0x0a91('0x2f')]);_0x3c572c[_0x0a91('0x30')]=qs['filters'](_[_0x0a91('0x31')](_0x2edb7e[_0x0a91('0x26')],_0x387a19['filters']),_0x2f98c4);if(_0x2edb7e[_0x0a91('0x26')][_0x0a91('0x32')]){_0x3c572c[_0x0a91('0x30')]=_[_0x0a91('0x33')](_0x3c572c['where'],{'$or':_[_0x0a91('0x24')](_0x2f98c4,function(_0x15ac13){if(_0x15ac13[_0x0a91('0x23')]!==_0x0a91('0x34')){var _0x13f5ac={};_0x13f5ac[_0x15ac13[_0x0a91('0x20')]]={'$like':'%'+_0x2edb7e['query'][_0x0a91('0x32')]+'%'};return _0x13f5ac;}})});}_0x3c572c=_[_0x0a91('0x33')]({},_0x3c572c,_0x2edb7e['options']);var _0xe0327d={'where':_0x3c572c['where']};return db[_0x0a91('0x35')]['count'](_0xe0327d)[_0x0a91('0x1d')](function(_0x5729c7){_0x3a4b72[_0x0a91('0x36')]=_0x5729c7;if(_0x2edb7e[_0x0a91('0x26')]['includeAll']){_0x3c572c[_0x0a91('0x37')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x0a91('0x38')](_0x3c572c);})['then'](function(_0x526a3c){_0x3a4b72[_0x0a91('0x39')]=_0x526a3c;return _0x3a4b72;})[_0x0a91('0x1d')](respondWithFilteredResult(_0x30d3a8,_0x3c572c))[_0x0a91('0x3a')](handleError(_0x30d3a8,null));};exports[_0x0a91('0x3b')]=function(_0x3285aa,_0x35e5e7){var _0x4305e8={'raw':!![],'where':{'id':_0x3285aa[_0x0a91('0x3c')]['id']}},_0x4aed9f={};_0x4aed9f[_0x0a91('0x29')]=_[_0x0a91('0x25')](db['ChatTransferReport'][_0x0a91('0x3d')]);_0x4aed9f[_0x0a91('0x26')]=_['keys'](_0x3285aa[_0x0a91('0x26')]);_0x4aed9f[_0x0a91('0x27')]=_[_0x0a91('0x28')](_0x4aed9f[_0x0a91('0x29')],_0x4aed9f['query']);_0x4305e8['attributes']=_[_0x0a91('0x28')](_0x4aed9f['model'],qs[_0x0a91('0x2b')](_0x3285aa[_0x0a91('0x26')]['fields']));_0x4305e8[_0x0a91('0x2a')]=_0x4305e8[_0x0a91('0x2a')][_0x0a91('0x2c')]?_0x4305e8['attributes']:_0x4aed9f[_0x0a91('0x29')];if(_0x3285aa[_0x0a91('0x26')][_0x0a91('0x3e')]){_0x4305e8[_0x0a91('0x37')]=[{'all':!![]}];}_0x4305e8=_[_0x0a91('0x33')]({},_0x4305e8,_0x3285aa['options']);return db[_0x0a91('0x35')][_0x0a91('0x3f')](_0x4305e8)[_0x0a91('0x1d')](handleEntityNotFound(_0x35e5e7,null))['then'](respondWithResult(_0x35e5e7,null))[_0x0a91('0x3a')](handleError(_0x35e5e7,null));};exports['create']=function(_0x4edc5b,_0x28ce14){return db[_0x0a91('0x35')][_0x0a91('0x40')](_0x4edc5b['body'],{})[_0x0a91('0x1d')](respondWithResult(_0x28ce14,0xc9))['catch'](handleError(_0x28ce14,null));};exports[_0x0a91('0x1c')]=function(_0x360332,_0x1570aa){if(_0x360332[_0x0a91('0x41')]['id']){delete _0x360332[_0x0a91('0x41')]['id'];}return db[_0x0a91('0x35')][_0x0a91('0x3f')]({'where':{'id':_0x360332[_0x0a91('0x3c')]['id']}})[_0x0a91('0x1d')](handleEntityNotFound(_0x1570aa,null))[_0x0a91('0x1d')](saveUpdates(_0x360332['body'],null))['then'](respondWithResult(_0x1570aa,null))['catch'](handleError(_0x1570aa,null));};exports[_0x0a91('0x42')]=function(_0x550fe5,_0xe80841){return db[_0x0a91('0x35')][_0x0a91('0x3f')]({'where':{'id':_0x550fe5[_0x0a91('0x3c')]['id']}})['then'](handleEntityNotFound(_0xe80841,null))[_0x0a91('0x1d')](removeEntity(_0xe80841,null))[_0x0a91('0x3a')](handleError(_0xe80841,null));};exports[_0x0a91('0x43')]=function(_0x2c596a,_0x5b7d91){return db['ChatTransferReport'][_0x0a91('0x43')]()[_0x0a91('0x1d')](respondWithResult(_0x5b7d91,null))[_0x0a91('0x3a')](handleError(_0x5b7d91,null));}; \ No newline at end of file +var _0x656e=['params','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','squel','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','include','catch','show','find','create','body'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x656e,0x8e));var _0xe656=function(_0x1eb31c,_0x3afd06){_0x1eb31c=_0x1eb31c-0x0;var _0x5df7a0=_0x656e[_0x1eb31c];return _0x5df7a0;};'use strict';var pdf=require(_0xe656('0x0'));var emlformat=require(_0xe656('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe656('0x2'));var jsonpatch=require(_0xe656('0x3'));var rp=require(_0xe656('0x4'));var moment=require(_0xe656('0x5'));var BPromise=require(_0xe656('0x6'));var Mustache=require(_0xe656('0x7'));var util=require('util');var path=require(_0xe656('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe656('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe656('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe656('0xb'));var toCsv=require(_0xe656('0xc'));var querystring=require('querystring');var Papa=require(_0xe656('0xd'));var Redis=require(_0xe656('0xe'));var authService=require(_0xe656('0xf'));var qs=require(_0xe656('0x10'));var as=require(_0xe656('0x11'));var hardwareService=require(_0xe656('0x12'));var logger=require(_0xe656('0x13'))('api');var utils=require(_0xe656('0x14'));var config=require(_0xe656('0x15'));var db=require(_0xe656('0x16'))['db'];function respondWithStatusCode(_0xa1c5b0,_0x23410b){_0x23410b=_0x23410b||0xcc;return function(_0x448e1f){if(_0x448e1f){return _0xa1c5b0[_0xe656('0x17')](_0x23410b);}return _0xa1c5b0[_0xe656('0x18')](_0x23410b)[_0xe656('0x19')]();};}function respondWithResult(_0x3d4c16,_0x235d83){_0x235d83=_0x235d83||0xc8;return function(_0xa6dbe5){if(_0xa6dbe5){return _0x3d4c16[_0xe656('0x18')](_0x235d83)[_0xe656('0x1a')](_0xa6dbe5);}};}function respondWithFilteredResult(_0x571fbd,_0x4c2bbe){return function(_0x5ac453){if(_0x5ac453){var _0x2ef927=_0x5ac453[_0xe656('0x1b')],_0x141fba=_0x4c2bbe[_0xe656('0x1c')],_0xd04351=_0x4c2bbe['offset']+_0x4c2bbe[_0xe656('0x1d')],_0x51afdf;if(_0xd04351>=_0x2ef927){_0xd04351=_0x2ef927;_0x51afdf=0xc8;}else{_0x51afdf=0xce;}_0x571fbd[_0xe656('0x18')](_0x51afdf);return _0x571fbd[_0xe656('0x1e')](_0xe656('0x1f'),_0x141fba+'-'+_0xd04351+'/'+_0x2ef927)['json'](_0x5ac453);}return null;};}function patchUpdates(_0xbebffb){return function(_0x5c9c18){try{jsonpatch[_0xe656('0x20')](_0x5c9c18,_0xbebffb,!![]);}catch(_0x134ed5){return BPromise['reject'](_0x134ed5);}return _0x5c9c18[_0xe656('0x21')]();};}function saveUpdates(_0x4b0ea2,_0x45b5e0){return function(_0x57af3d){if(_0x57af3d){return _0x57af3d[_0xe656('0x22')](_0x4b0ea2)['then'](function(_0xb986c5){return _0xb986c5;});}return null;};}function removeEntity(_0xb2bfdf,_0x22082a){return function(_0xebdab){if(_0xebdab){return _0xebdab[_0xe656('0x23')]()[_0xe656('0x24')](function(){_0xb2bfdf[_0xe656('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3311a4,_0x1565a6){return function(_0x475e9d){if(!_0x475e9d){_0x3311a4[_0xe656('0x17')](0x194);}return _0x475e9d;};}function handleError(_0x4712c9,_0x5f581e){_0x5f581e=_0x5f581e||0x1f4;return function(_0x47353a){logger['error'](_0x47353a[_0xe656('0x25')]);if(_0x47353a['name']){delete _0x47353a[_0xe656('0x26')];}_0x4712c9['status'](_0x5f581e)[_0xe656('0x27')](_0x47353a);};}exports[_0xe656('0x28')]=function(_0x574adb,_0x434959){var _0x32f4f8={},_0x199305={},_0x455f42={'count':0x0,'rows':[]};var _0x1c908e=_[_0xe656('0x29')](db[_0xe656('0x2a')][_0xe656('0x2b')],function(_0xc6ce0a){return{'name':_0xc6ce0a[_0xe656('0x2c')],'type':_0xc6ce0a['type'][_0xe656('0x2d')]};});_0x199305[_0xe656('0x2e')]=_[_0xe656('0x29')](_0x1c908e,_0xe656('0x26'));_0x199305[_0xe656('0x2f')]=_['keys'](_0x574adb[_0xe656('0x2f')]);_0x199305['filters']=_[_0xe656('0x30')](_0x199305['model'],_0x199305[_0xe656('0x2f')]);_0x32f4f8['attributes']=_['intersection'](_0x199305[_0xe656('0x2e')],qs[_0xe656('0x31')](_0x574adb[_0xe656('0x2f')][_0xe656('0x31')]));_0x32f4f8[_0xe656('0x32')]=_0x32f4f8[_0xe656('0x32')][_0xe656('0x33')]?_0x32f4f8[_0xe656('0x32')]:_0x199305['model'];if(!_0x574adb[_0xe656('0x2f')][_0xe656('0x34')](_0xe656('0x35'))){_0x32f4f8[_0xe656('0x1d')]=qs[_0xe656('0x1d')](_0x574adb[_0xe656('0x2f')][_0xe656('0x1d')]);_0x32f4f8[_0xe656('0x1c')]=qs[_0xe656('0x1c')](_0x574adb[_0xe656('0x2f')]['offset']);}_0x32f4f8[_0xe656('0x36')]=qs[_0xe656('0x37')](_0x574adb[_0xe656('0x2f')][_0xe656('0x37')]);_0x32f4f8[_0xe656('0x38')]=qs[_0xe656('0x39')](_[_0xe656('0x3a')](_0x574adb[_0xe656('0x2f')],_0x199305[_0xe656('0x39')]),_0x1c908e);if(_0x574adb['query'][_0xe656('0x3b')]){_0x32f4f8[_0xe656('0x38')]=_[_0xe656('0x3c')](_0x32f4f8[_0xe656('0x38')],{'$or':_[_0xe656('0x29')](_0x1c908e,function(_0x546859){if(_0x546859['type']!=='VIRTUAL'){var _0x31de27={};_0x31de27[_0x546859[_0xe656('0x26')]]={'$like':'%'+_0x574adb['query'][_0xe656('0x3b')]+'%'};return _0x31de27;}})});}_0x32f4f8=_[_0xe656('0x3c')]({},_0x32f4f8,_0x574adb['options']);var _0x4f8473={'where':_0x32f4f8['where']};return db[_0xe656('0x2a')][_0xe656('0x1b')](_0x4f8473)[_0xe656('0x24')](function(_0x535b84){_0x455f42[_0xe656('0x1b')]=_0x535b84;if(_0x574adb['query'][_0xe656('0x3d')]){_0x32f4f8[_0xe656('0x3e')]=[{'all':!![]}];}return db[_0xe656('0x2a')]['findAll'](_0x32f4f8);})[_0xe656('0x24')](function(_0x206b1a){_0x455f42['rows']=_0x206b1a;return _0x455f42;})[_0xe656('0x24')](respondWithFilteredResult(_0x434959,_0x32f4f8))[_0xe656('0x3f')](handleError(_0x434959,null));};exports[_0xe656('0x40')]=function(_0x5037d8,_0x36a254){var _0x28e053={'raw':!![],'where':{'id':_0x5037d8['params']['id']}},_0x29017b={};_0x29017b[_0xe656('0x2e')]=_['keys'](db[_0xe656('0x2a')]['rawAttributes']);_0x29017b[_0xe656('0x2f')]=_['keys'](_0x5037d8[_0xe656('0x2f')]);_0x29017b['filters']=_[_0xe656('0x30')](_0x29017b[_0xe656('0x2e')],_0x29017b['query']);_0x28e053['attributes']=_['intersection'](_0x29017b[_0xe656('0x2e')],qs['fields'](_0x5037d8[_0xe656('0x2f')]['fields']));_0x28e053[_0xe656('0x32')]=_0x28e053['attributes'][_0xe656('0x33')]?_0x28e053['attributes']:_0x29017b[_0xe656('0x2e')];if(_0x5037d8['query']['includeAll']){_0x28e053[_0xe656('0x3e')]=[{'all':!![]}];}_0x28e053=_[_0xe656('0x3c')]({},_0x28e053,_0x5037d8['options']);return db[_0xe656('0x2a')][_0xe656('0x41')](_0x28e053)[_0xe656('0x24')](handleEntityNotFound(_0x36a254,null))[_0xe656('0x24')](respondWithResult(_0x36a254,null))[_0xe656('0x3f')](handleError(_0x36a254,null));};exports['create']=function(_0x96091e,_0x47c9d7){return db[_0xe656('0x2a')][_0xe656('0x42')](_0x96091e[_0xe656('0x43')],{})[_0xe656('0x24')](respondWithResult(_0x47c9d7,0xc9))['catch'](handleError(_0x47c9d7,null));};exports[_0xe656('0x22')]=function(_0xe4ba98,_0x576cff){if(_0xe4ba98[_0xe656('0x43')]['id']){delete _0xe4ba98[_0xe656('0x43')]['id'];}return db[_0xe656('0x2a')]['find']({'where':{'id':_0xe4ba98[_0xe656('0x44')]['id']}})['then'](handleEntityNotFound(_0x576cff,null))[_0xe656('0x24')](saveUpdates(_0xe4ba98[_0xe656('0x43')],null))[_0xe656('0x24')](respondWithResult(_0x576cff,null))['catch'](handleError(_0x576cff,null));};exports[_0xe656('0x23')]=function(_0x393628,_0x55506e){return db['ChatTransferReport'][_0xe656('0x41')]({'where':{'id':_0x393628[_0xe656('0x44')]['id']}})[_0xe656('0x24')](handleEntityNotFound(_0x55506e,null))[_0xe656('0x24')](removeEntity(_0x55506e,null))[_0xe656('0x3f')](handleError(_0x55506e,null));};exports[_0xe656('0x45')]=function(_0x8f48f8,_0x13082b){return db[_0xe656('0x2a')][_0xe656('0x45')]()[_0xe656('0x24')](respondWithResult(_0x13082b,null))['catch'](handleError(_0x13082b,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 6a955ef..c1c44a2 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 _0xfdb0=['uniqueid','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','exports','define','ChatTransferReport','report_chat_transfer'];(function(_0x56e001,_0x1fb14c){var _0x490d6f=function(_0x33888c){while(--_0x33888c){_0x56e001['push'](_0x56e001['shift']());}};_0x490d6f(++_0x1fb14c);}(_0xfdb0,0x6d));var _0x0fdb=function(_0x50f73f,_0x2c4c34){_0x50f73f=_0x50f73f-0x0;var _0x2474a3=_0xfdb0[_0x50f73f];return _0x2474a3;};'use strict';var _=require(_0x0fdb('0x0'));var util=require(_0x0fdb('0x1'));var logger=require(_0x0fdb('0x2'))(_0x0fdb('0x3'));var moment=require('moment');var BPromise=require(_0x0fdb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0fdb('0x5'));var config=require(_0x0fdb('0x6'));var attributes=require('./chatTransferReport.attributes');module[_0x0fdb('0x7')]=function(_0x199a05,_0x281c8f){return _0x199a05[_0x0fdb('0x8')](_0x0fdb('0x9'),attributes,{'tableName':_0x0fdb('0xa'),'paranoid':![],'indexes':[{'name':_0x0fdb('0xb'),'fields':[_0x0fdb('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x823b=['./chatTransferReport.attributes','exports','define','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','path','rimraf'];(function(_0x5ba599,_0x65c167){var _0x54e2c5=function(_0x4dab75){while(--_0x4dab75){_0x5ba599['push'](_0x5ba599['shift']());}};_0x54e2c5(++_0x65c167);}(_0x823b,0x1d9));var _0xb823=function(_0x44acf3,_0x559418){_0x44acf3=_0x44acf3-0x0;var _0x206d61=_0x823b[_0x44acf3];return _0x206d61;};'use strict';var _=require(_0xb823('0x0'));var util=require(_0xb823('0x1'));var logger=require(_0xb823('0x2'))(_0xb823('0x3'));var moment=require(_0xb823('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb823('0x5'));var rimraf=require(_0xb823('0x6'));var config=require('../../config/environment');var attributes=require(_0xb823('0x7'));module[_0xb823('0x8')]=function(_0x5c6b89,_0x4deb74){return _0x5c6b89[_0xb823('0x9')]('ChatTransferReport',attributes,{'tableName':_0xb823('0xa'),'paranoid':![],'indexes':[{'name':_0xb823('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 87693a8..b326764 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 _0xf8a3=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x23897f,_0x925717){var _0xff8e7e=function(_0x57608b){while(--_0x57608b){_0x23897f['push'](_0x23897f['shift']());}};_0xff8e7e(++_0x925717);}(_0xf8a3,0x1c8));var _0x3f8a=function(_0x1003b1,_0x4382a3){_0x1003b1=_0x1003b1-0x0;var _0x2455e1=_0xf8a3[_0x1003b1];return _0x2455e1;};'use strict';var _=require(_0x3f8a('0x0'));var util=require(_0x3f8a('0x1'));var moment=require(_0x3f8a('0x2'));var BPromise=require('bluebird');var rs=require(_0x3f8a('0x3'));var fs=require('fs');var Redis=require(_0x3f8a('0x4'));var db=require(_0x3f8a('0x5'))['db'];var utils=require(_0x3f8a('0x6'));var logger=require(_0x3f8a('0x7'))(_0x3f8a('0x8'));var config=require(_0x3f8a('0x9'));var jayson=require(_0x3f8a('0xa'));var client=jayson[_0x3f8a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d61f6,_0x3d23bd,_0x1c1f83){return new BPromise(function(_0xa2da08,_0xe23e5f){return client['request'](_0x5d61f6,_0x1c1f83)[_0x3f8a('0xc')](function(_0x467868){logger[_0x3f8a('0xd')](_0x3f8a('0xe'),_0x3d23bd,_0x3f8a('0xf'));logger[_0x3f8a('0x10')](_0x3f8a('0x11'),_0x3d23bd,_0x3f8a('0xf'),JSON[_0x3f8a('0x12')](_0x467868));if(_0x467868[_0x3f8a('0x13')]){if(_0x467868[_0x3f8a('0x13')][_0x3f8a('0x14')]===0x1f4){logger[_0x3f8a('0x13')](_0x3f8a('0xe'),_0x3d23bd,_0x467868[_0x3f8a('0x13')][_0x3f8a('0x15')]);return _0xe23e5f(_0x467868[_0x3f8a('0x13')][_0x3f8a('0x15')]);}logger[_0x3f8a('0x13')](_0x3f8a('0xe'),_0x3d23bd,_0x467868[_0x3f8a('0x13')][_0x3f8a('0x15')]);return _0xa2da08(_0x467868[_0x3f8a('0x13')][_0x3f8a('0x15')]);}else{logger[_0x3f8a('0xd')](_0x3f8a('0xe'),_0x3d23bd,_0x3f8a('0xf'));_0xa2da08(_0x467868[_0x3f8a('0x16')]['message']);}})[_0x3f8a('0x17')](function(_0x50d540){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x3d23bd,_0x50d540);_0xe23e5f(_0x50d540);});});} \ No newline at end of file +var _0x5f2e=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x3d2b35,_0x16d389){var _0x25cd30=function(_0x3741c6){while(--_0x3741c6){_0x3d2b35['push'](_0x3d2b35['shift']());}};_0x25cd30(++_0x16d389);}(_0x5f2e,0x178));var _0xe5f2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5f2e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xe5f2('0x0'));var util=require('util');var moment=require(_0xe5f2('0x1'));var BPromise=require(_0xe5f2('0x2'));var rs=require(_0xe5f2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe5f2('0x4'))['db'];var utils=require(_0xe5f2('0x5'));var logger=require(_0xe5f2('0x6'))(_0xe5f2('0x7'));var config=require(_0xe5f2('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe5f2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21d87f,_0x11d2ac,_0xe810ca){return new BPromise(function(_0x35d722,_0x108c6c){return client['request'](_0x21d87f,_0xe810ca)[_0xe5f2('0xa')](function(_0x4d2287){logger[_0xe5f2('0xb')](_0xe5f2('0xc'),_0x11d2ac,_0xe5f2('0xd'));logger[_0xe5f2('0xe')](_0xe5f2('0xf'),_0x11d2ac,_0xe5f2('0xd'),JSON['stringify'](_0x4d2287));if(_0x4d2287[_0xe5f2('0x10')]){if(_0x4d2287[_0xe5f2('0x10')]['code']===0x1f4){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x11d2ac,_0x4d2287[_0xe5f2('0x10')][_0xe5f2('0x11')]);return _0x108c6c(_0x4d2287[_0xe5f2('0x10')][_0xe5f2('0x11')]);}logger['error'](_0xe5f2('0xc'),_0x11d2ac,_0x4d2287['error'][_0xe5f2('0x11')]);return _0x35d722(_0x4d2287['error'][_0xe5f2('0x11')]);}else{logger[_0xe5f2('0xb')](_0xe5f2('0xc'),_0x11d2ac,_0xe5f2('0xd'));_0x35d722(_0x4d2287[_0xe5f2('0x12')][_0xe5f2('0x11')]);}})[_0xe5f2('0x13')](function(_0x4c7684){logger[_0xe5f2('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x11d2ac,_0x4c7684);_0x108c6c(_0x4c7684);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 19550e6..e9d347c 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 _0x2032=['describe','/:id','post','create','put','update','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x4bc43d,_0x2e481e){var _0x277b0f=function(_0x1d06b8){while(--_0x1d06b8){_0x4bc43d['push'](_0x4bc43d['shift']());}};_0x277b0f(++_0x2e481e);}(_0x2032,0xd9));var _0x2203=function(_0x3fa975,_0x138ed4){_0x3fa975=_0x3fa975-0x0;var _0x928186=_0x2032[_0x3fa975];return _0x928186;};'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 +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(_0x5e4563,_0x3ff918){var _0x8d1bf5=function(_0x3bf7a9){while(--_0x3bf7a9){_0x5e4563['push'](_0x5e4563['shift']());}};_0x8d1bf5(++_0x3ff918);}(_0x5f66,0x1a0));var _0x65f6=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5f66[_0x432682];return _0x463d05;};'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 diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 3a3f87f..7a10a8e 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 _0x9b39=['Skip','Feedback','star','thumb','stringify','name','onlineForm','parse','setDataValue','input','textarea','Comments','Leave\x20your\x20comments','getDataValue','offlineForm','generate','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','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','STRING','email','Agent','#9f946a','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Thanks\x20you\x20for\x20your\x20time!'];(function(_0x361d3f,_0x3be2aa){var _0x320229=function(_0x138319){while(--_0x138319){_0x361d3f['push'](_0x361d3f['shift']());}};_0x320229(++_0x3be2aa);}(_0x9b39,0x136));var _0x99b3=function(_0x47ee5e,_0x4a8c6c){_0x47ee5e=_0x47ee5e-0x0;var _0x49d689=_0x9b39[_0x47ee5e];return _0x49d689;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x99b3('0x0'));module['exports']={'name':{'type':Sequelize[_0x99b3('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0x99b3('0x1')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x99b3('0x1')]},'mapKey':{'type':Sequelize[_0x99b3('0x1')],'defaultValue':_0x99b3('0x2')},'mapKeyOffline':{'type':Sequelize[_0x99b3('0x1')],'defaultValue':_0x99b3('0x2')},'key':{'type':Sequelize[_0x99b3('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x99b3('0x1')],'defaultValue':_0x99b3('0x3')},'customerAlias':{'type':Sequelize[_0x99b3('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x99b3('0x1')],'allowNull':![],'defaultValue':_0x99b3('0x4'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x99b3('0x1')],'allowNull':![],'defaultValue':_0x99b3('0x4'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x99b3('0x1')],'allowNull':![],'defaultValue':_0x99b3('0x5'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x99b3('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x99b3('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x99b3('0x8')](_0x99b3('0x9'),'squared'),'defaultValue':_0x99b3('0x9')},'header_online':{'type':Sequelize[_0x99b3('0x1')],'defaultValue':_0x99b3('0xa')},'start_chat_button':{'type':Sequelize[_0x99b3('0x1')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x99b3('0x1')],'defaultValue':_0x99b3('0xb')},'header_offline':{'type':Sequelize[_0x99b3('0x1')],'defaultValue':_0x99b3('0xc')},'download_transcript':{'type':Sequelize[_0x99b3('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x99b3('0x6')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x99b3('0x1')],'defaultValue':_0x99b3('0xd')},'defaultWhiteLabel':{'type':Sequelize[_0x99b3('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x99b3('0xe')]},'closingQuestion':{'type':Sequelize[_0x99b3('0x1')],'defaultValue':_0x99b3('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0x99b3('0x1')],'defaultValue':_0x99b3('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0x99b3('0x1')],'defaultValue':_0x99b3('0x11')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x99b3('0x1')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x99b3('0x1')],'defaultValue':_0x99b3('0x12')},'closingMessageButton':{'type':Sequelize[_0x99b3('0x1')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x99b3('0x1')],'defaultValue':_0x99b3('0x13')},'conditionAgreement':{'type':Sequelize[_0x99b3('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x99b3('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x99b3('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x99b3('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x99b3('0x14')},'ratingType':{'type':Sequelize['ENUM'](_0x99b3('0x15'),_0x99b3('0x16')),'defaultValue':_0x99b3('0x15')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x99b3('0xe')],'defaultValue':function(){return JSON[_0x99b3('0x17')]({'items':[{'type':'input','variable':null,'config':{'placeholder':'name','type':'text','required':!![]},'props':{'title':_0x99b3('0x18'),'helpText':''}},{'type':'input','props':{'title':_0x99b3('0x2'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x99b3('0x19'))?JSON[_0x99b3('0x1a')](this['getDataValue'](_0x99b3('0x19'))):{};},'set':function(_0x55536f){return this[_0x99b3('0x1b')](_0x99b3('0x19'),JSON[_0x99b3('0x17')](_0x55536f));}},'offlineForm':{'type':Sequelize[_0x99b3('0xe')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x99b3('0x1c'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x99b3('0x2'),'type':_0x99b3('0x2')},'variable':null},{'type':_0x99b3('0x1d'),'config':{'placeholder':_0x99b3('0x1e')},'props':{'title':_0x99b3('0x1e'),'helpText':_0x99b3('0x1f')}}],'fromKey':0x0});},'get':function(){return this[_0x99b3('0x20')]('offlineForm')?JSON['parse'](this[_0x99b3('0x20')](_0x99b3('0x21'))):{};},'set':function(_0x472051){return this['setDataValue'](_0x99b3('0x21'),JSON[_0x99b3('0x17')](_0x472051));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x99b3('0x22')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x99b3('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x99b3('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x99b3('0x1')]},'forwardOffline':{'type':Sequelize[_0x99b3('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x99b3('0x1')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x99b3('0x1')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x99b3('0x23')},'offlineMessageBody':{'type':Sequelize[_0x99b3('0x1')],'defaultValue':_0x99b3('0x24')},'enableUnmanagedNote':{'type':Sequelize[_0x99b3('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x99b3('0x1')],'defaultValue':_0x99b3('0x25')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x99b3('0x13')},'sendUnmanaged':{'type':Sequelize[_0x99b3('0x1')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x99b3('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x99b3('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x99b3('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x99b3('0x1')]},'notificationTemplate':{'type':Sequelize[_0x99b3('0xe')],'defaultValue':function(){return _0x99b3('0x26');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x99b3('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x99b3('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x99b3('0x1')],'defaultValue':_0x99b3('0x27')},'waitForTheAssignedAgent':{'type':Sequelize[_0x99b3('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x99b3('0x6')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x99b3('0x1')],'defaultValue':_0x99b3('0x28')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x99b3('0xe')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x99b3('0x6')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x99b3('0x1')],'allowNull':![],'defaultValue':_0x99b3('0x29'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x99b3('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x99b3('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x99b3('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x99b3('0x1')],'defaultValue':_0x99b3('0x2a')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x99b3('0x6')],'comment':_0x99b3('0x2b')},'mandatoryDisposition':{'type':Sequelize[_0x99b3('0x7')],'defaultValue':![],'comment':_0x99b3('0x2c'),'set':function(_0x4b6e10){if(!_0x4b6e10)this[_0x99b3('0x1b')](_0x99b3('0x2d'),null);this[_0x99b3('0x1b')](_0x99b3('0x2e'),_0x4b6e10);}},'vidaooEscalation':{'type':Sequelize[_0x99b3('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x99b3('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x0d1f=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','exports','STRING','address','email','Agent','#9f946a','INTEGER','BOOLEAN','ENUM','squared','rounded','We\x20are\x20here!','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','name','text','input','getDataValue','onlineForm','parse','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','generate','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0d1f,0x129));var _0xf0d1=function(_0x4502a1,_0x1b2c8e){_0x4502a1=_0x4502a1-0x0;var _0x451239=_0x0d1f[_0x4502a1];return _0x451239;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0xf0d1('0x0')]={'name':{'type':Sequelize[_0xf0d1('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0xf0d1('0x1')],'allowNull':![],'unique':_0xf0d1('0x2')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xf0d1('0x3')},'mapKeyOffline':{'type':Sequelize[_0xf0d1('0x1')],'defaultValue':'email'},'key':{'type':Sequelize[_0xf0d1('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xf0d1('0x1')],'defaultValue':_0xf0d1('0x4')},'customerAlias':{'type':Sequelize[_0xf0d1('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf0d1('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf0d1('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xf0d1('0x1')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xf0d1('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xf0d1('0x1')]},'animation':{'type':Sequelize[_0xf0d1('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xf0d1('0x8')]('rounded',_0xf0d1('0x9')),'defaultValue':_0xf0d1('0xa')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0xf0d1('0xb')},'start_chat_button':{'type':Sequelize[_0xf0d1('0x1')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0xf0d1('0x1')],'defaultValue':_0xf0d1('0xc')},'header_offline':{'type':Sequelize[_0xf0d1('0x1')],'defaultValue':_0xf0d1('0xd')},'download_transcript':{'type':Sequelize[_0xf0d1('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xf0d1('0x1')],'defaultValue':_0xf0d1('0xe')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xf0d1('0xf')]},'closingQuestion':{'type':Sequelize[_0xf0d1('0x1')],'defaultValue':_0xf0d1('0x10')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0xf0d1('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0xf0d1('0x1')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0xf0d1('0x12')},'placeholderMessage':{'type':Sequelize[_0xf0d1('0x1')],'defaultValue':_0xf0d1('0x13')},'closingMessage':{'type':Sequelize[_0xf0d1('0x1')],'defaultValue':_0xf0d1('0x14')},'closingMessageButton':{'type':Sequelize[_0xf0d1('0x1')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0xf0d1('0x1')],'defaultValue':_0xf0d1('0x15')},'conditionAgreement':{'type':Sequelize[_0xf0d1('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xf0d1('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xf0d1('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0xf0d1('0x16')},'ratingType':{'type':Sequelize[_0xf0d1('0x8')](_0xf0d1('0x17'),_0xf0d1('0x18')),'defaultValue':_0xf0d1('0x17')},'ratingStarsNumber':{'type':Sequelize[_0xf0d1('0x6')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xf0d1('0xf')],'defaultValue':function(){return JSON[_0xf0d1('0x19')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0xf0d1('0x1a'),'type':_0xf0d1('0x1b'),'required':!![]},'props':{'title':_0xf0d1('0x1a'),'helpText':''}},{'type':_0xf0d1('0x1c'),'props':{'title':_0xf0d1('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xf0d1('0x3'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xf0d1('0x1d')](_0xf0d1('0x1e'))?JSON[_0xf0d1('0x1f')](this[_0xf0d1('0x1d')](_0xf0d1('0x1e'))):{};},'set':function(_0xe88655){return this['setDataValue'](_0xf0d1('0x1e'),JSON['stringify'](_0xe88655));}},'offlineForm':{'type':Sequelize[_0xf0d1('0xf')],'defaultValue':function(){return JSON[_0xf0d1('0x19')]({'items':[{'type':_0xf0d1('0x1c'),'props':{'title':_0xf0d1('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xf0d1('0x3'),'type':_0xf0d1('0x3')},'variable':null},{'type':'textarea','config':{'placeholder':_0xf0d1('0x20')},'props':{'title':_0xf0d1('0x20'),'helpText':_0xf0d1('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0xf0d1('0x1d')](_0xf0d1('0x22'))?JSON['parse'](this[_0xf0d1('0x1d')]('offlineForm')):{};},'set':function(_0xfe4f45){return this[_0xf0d1('0x23')]('offlineForm',JSON[_0xf0d1('0x19')](_0xfe4f45));}},'token':{'type':Sequelize[_0xf0d1('0x1')],'defaultValue':function(){return rs[_0xf0d1('0x24')]();}},'autoclose':{'type':Sequelize[_0xf0d1('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xf0d1('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xf0d1('0x1')]},'forwardOffline':{'type':Sequelize[_0xf0d1('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xf0d1('0x1')]},'waitingTitle':{'type':Sequelize[_0xf0d1('0x1')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0xf0d1('0x1')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0xf0d1('0x25')},'offlineMessageBody':{'type':Sequelize[_0xf0d1('0x1')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xf0d1('0x1')],'defaultValue':_0xf0d1('0x26')},'skipUnmanaged':{'type':Sequelize[_0xf0d1('0x1')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0xf0d1('0x1')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xf0d1('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0xf0d1('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xf0d1('0x1')]},'notificationTemplate':{'type':Sequelize[_0xf0d1('0xf')],'defaultValue':function(){return _0xf0d1('0x27');}},'notificationSound':{'type':Sequelize[_0xf0d1('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xf0d1('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0xf0d1('0x28')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xf0d1('0x1')],'defaultValue':_0xf0d1('0x29')},'verticalAlignment':{'type':Sequelize[_0xf0d1('0x6')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xf0d1('0x1')],'defaultValue':_0xf0d1('0x2a')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0xf0d1('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0xf0d1('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf0d1('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xf0d1('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf0d1('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf0d1('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf0d1('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xf0d1('0x1')],'defaultValue':_0xf0d1('0x2c')},'systemAvatar':{'type':Sequelize[_0xf0d1('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf0d1('0x6')],'comment':_0xf0d1('0x2d')},'mandatoryDisposition':{'type':Sequelize[_0xf0d1('0x7')],'defaultValue':![],'comment':_0xf0d1('0x2e'),'set':function(_0x4885c9){if(!_0x4885c9)this[_0xf0d1('0x23')](_0xf0d1('0x2f'),null);this[_0xf0d1('0x23')]('mandatoryDisposition',_0x4885c9);}},'vidaooEscalation':{'type':Sequelize[_0xf0d1('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xf0d1('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index ec2d8a7..d75f44a 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 _0x9c47=['options','count','include','findAll','rows','show','params','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addDisposition','ChatWebsiteId','Disposition','findOne','removeDispositions','ids','getAnswers','CannedAnswer','order','pick','removeAnswers','file','filename','addAvatar','customerAvatar','getLogo','join','root','server/files/images/logos/default_logo.png','getLicense','custom','isNil','existsSync','server/files/images/logos/','sitepic','download','agentAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','systemAvatar','notify','user-agent-parser','setUA','user-agent','getResult','chat','CmContact','describe','no\x20available\x20attributes','difference','createdAt','updatedAt','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','Contacts','DESC','ChatApplication','Applications','applications','list','List','orderBy','account','ListId','contact','customerIp','headers','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','referer','browser','format','%s\x20%s','version','unknown','device','%s\x20%s\x20%s','vendor','stringify','threadId','externalUrl','ChatInteraction','ContactId','interaction','spread','messageId','created','autoclose','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','forcedOwnership','startRouting','Start','EventManager','offline','CompanyId','send','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','user','pass','SendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','addInteraction','getInteractions','fullname','internal','Tag','Tags','color','tag','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','../../config/license/util','virtual','License','chatLicenseExceeded','push','all','server/files/chat/iframe.js','remote','x-real-ip','connection','replace','alignment','verticalAlignment','textColor','addApplications','sequelize','transaction','findAndCountAll','priority','getApplications','addProactiveActions','chatProactiveAction','omit','getProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','getOfflineMessages','Contact','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','set','apply','reject','update','destroy','get','ChatWebsites','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','map'];(function(_0x2f1ae9,_0x11ce9a){var _0x2420e7=function(_0x3908ee){while(--_0x3908ee){_0x2f1ae9['push'](_0x2f1ae9['shift']());}};_0x2420e7(++_0x11ce9a);}(_0x9c47,0xcc));var _0x79c4=function(_0x8a71d3,_0x212ca6){_0x8a71d3=_0x8a71d3-0x0;var _0x4b914c=_0x9c47[_0x8a71d3];return _0x4b914c;};'use strict';var pdf=require(_0x79c4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x79c4('0x1'));var zipdir=require(_0x79c4('0x2'));var jsonpatch=require(_0x79c4('0x3'));var rp=require(_0x79c4('0x4'));var moment=require(_0x79c4('0x5'));var BPromise=require(_0x79c4('0x6'));var Mustache=require(_0x79c4('0x7'));var util=require('util');var path=require('path');var sox=require(_0x79c4('0x8'));var csv=require(_0x79c4('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x79c4('0xa'));var squel=require(_0x79c4('0xb'));var crypto=require('crypto');var jsforce=require(_0x79c4('0xc'));var deskjs=require(_0x79c4('0xd'));var toCsv=require(_0x79c4('0x9'));var querystring=require(_0x79c4('0xe'));var Papa=require('papaparse');var Redis=require(_0x79c4('0xf'));var authService=require(_0x79c4('0x10'));var qs=require(_0x79c4('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x79c4('0x12'));var logger=require(_0x79c4('0x13'))(_0x79c4('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x79c4('0x15'))['db'];config[_0x79c4('0x16')]=_[_0x79c4('0x17')](config[_0x79c4('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x79c4('0x18'))(new Redis(config[_0x79c4('0x16')]));require(_0x79c4('0x19'))[_0x79c4('0x1a')](socket);var jayson=require(_0x79c4('0x1b'));var client=jayson[_0x79c4('0x1c')][_0x79c4('0x1d')]({'port':0x232c});var client9002=jayson[_0x79c4('0x1c')][_0x79c4('0x1d')]({'port':0x232a});var client9003=jayson[_0x79c4('0x1c')][_0x79c4('0x1d')]({'port':0x232b});function checkPasswordPattern(_0x1f0ec6,_0x2bf677,_0x46cb7e){if(_0x46cb7e){var _0x195c71=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x195c71['test'](_0x2bf677)){return _0x1f0ec6;}else{throw new db[(_0x79c4('0x1e'))][(_0x79c4('0x1f'))](_0x79c4('0x20'));}}else{return _0x1f0ec6;}}function respondWithRpcPromise(_0x26cb1a,_0x5d9bc8,_0x4cf585,_0x3dadfc){return new BPromise(function(_0x36dd7b,_0x90fab5){var _0x54792e=_0x3dadfc||client;return _0x54792e['request'](_0x26cb1a,_0x4cf585)[_0x79c4('0x21')](function(_0x4602b7){logger[_0x79c4('0x22')](_0x79c4('0x23'),_0x5d9bc8,_0x79c4('0x24'));logger[_0x79c4('0x25')](_0x79c4('0x26'),_0x5d9bc8,_0x79c4('0x24'),JSON['stringify'](_0x4602b7));if(_0x4602b7[_0x79c4('0x27')]){if(_0x4602b7['error'][_0x79c4('0x28')]===0x1f4){logger[_0x79c4('0x27')]('ChatWebsite,\x20%s,\x20%s',_0x5d9bc8,_0x4602b7[_0x79c4('0x27')][_0x79c4('0x29')]);return _0x90fab5(_0x4602b7[_0x79c4('0x27')][_0x79c4('0x29')]);}logger[_0x79c4('0x27')](_0x79c4('0x23'),_0x5d9bc8,_0x4602b7[_0x79c4('0x27')][_0x79c4('0x29')]);return _0x36dd7b(_0x4602b7['error'][_0x79c4('0x29')]);}else{logger[_0x79c4('0x22')](_0x79c4('0x23'),_0x5d9bc8,_0x79c4('0x24'));_0x36dd7b(_0x4602b7[_0x79c4('0x2a')]['message']);}})[_0x79c4('0x2b')](function(_0x1ab236){logger[_0x79c4('0x27')](_0x79c4('0x23'),_0x5d9bc8,_0x1ab236);_0x90fab5(_0x1ab236);});});}function respondWithStatusCode(_0x84ae90,_0x31a4cc){_0x31a4cc=_0x31a4cc||0xcc;return function(_0x499320){if(_0x499320){return _0x84ae90[_0x79c4('0x2c')](_0x31a4cc);}return _0x84ae90[_0x79c4('0x2d')](_0x31a4cc)[_0x79c4('0x2e')]();};}function respondWithResult(_0x1c54fb,_0x58ce63){_0x58ce63=_0x58ce63||0xc8;return function(_0x2558ae){if(_0x2558ae){return _0x1c54fb['status'](_0x58ce63)[_0x79c4('0x2f')](_0x2558ae);}};}function respondWithFilteredResult(_0x1e746d,_0x2c31e4){return function(_0x176019){if(_0x176019){var _0x3d03ae=_0x176019['count'],_0x415af9=_0x2c31e4[_0x79c4('0x30')],_0x1fa29c=_0x2c31e4[_0x79c4('0x30')]+_0x2c31e4[_0x79c4('0x31')],_0x48fc9b;if(_0x1fa29c>=_0x3d03ae){_0x1fa29c=_0x3d03ae;_0x48fc9b=0xc8;}else{_0x48fc9b=0xce;}_0x1e746d[_0x79c4('0x2d')](_0x48fc9b);return _0x1e746d[_0x79c4('0x32')]('Content-Range',_0x415af9+'-'+_0x1fa29c+'/'+_0x3d03ae)[_0x79c4('0x2f')](_0x176019);}return null;};}function patchUpdates(_0x42c9d8){return function(_0x1d94b0){try{jsonpatch[_0x79c4('0x33')](_0x1d94b0,_0x42c9d8,!![]);}catch(_0x52e952){return BPromise[_0x79c4('0x34')](_0x52e952);}return _0x1d94b0['save']();};}function saveUpdates(_0x4119fb,_0x5caebe){return function(_0x9cea62){if(_0x9cea62){return _0x9cea62[_0x79c4('0x35')](_0x4119fb)[_0x79c4('0x21')](function(_0x13e7ca){return _0x13e7ca;});}return null;};}function removeEntity(_0xa5456c,_0x597c3e){return function(_0x4db736){if(_0x4db736){return _0x4db736[_0x79c4('0x36')]()['then'](function(){var _0x4e99b9=_0x4db736[_0x79c4('0x37')]({'plain':!![]});var _0x3752d3=_0x79c4('0x38');return db[_0x79c4('0x39')][_0x79c4('0x36')]({'where':{'type':_0x3752d3,'resourceId':_0x4e99b9['id']}})[_0x79c4('0x21')](function(){return _0x4db736;});})[_0x79c4('0x21')](function(){_0xa5456c[_0x79c4('0x2d')](0xcc)[_0x79c4('0x2e')]();});}};}function handleEntityNotFound(_0x38b51a,_0x5c7320){return function(_0x2726f0){if(!_0x2726f0){_0x38b51a['sendStatus'](0x194);}return _0x2726f0;};}function handleError(_0x110b69,_0xef5f5d){_0xef5f5d=_0xef5f5d||0x1f4;return function(_0x1e148f){logger['error'](_0x1e148f[_0x79c4('0x3a')]);if(_0x1e148f['name']){delete _0x1e148f[_0x79c4('0x3b')];}_0x110b69['status'](_0xef5f5d)['send'](_0x1e148f);};}exports[_0x79c4('0x3c')]=function(_0x38a529,_0x184640){var _0x584301={'include':[{'model':db[_0x79c4('0x3d')],'as':_0x79c4('0x3e')}]},_0x3c935a={},_0x41d3d2={'count':0x0,'rows':[]};var _0x3cb4f8=_['map'](db[_0x79c4('0x3f')][_0x79c4('0x40')],function(_0x5e5460){return{'name':_0x5e5460[_0x79c4('0x41')],'type':_0x5e5460[_0x79c4('0x42')][_0x79c4('0x43')]};});_0x3c935a[_0x79c4('0x44')]=_['map'](_0x3cb4f8,'name');_0x3c935a[_0x79c4('0x45')]=_[_0x79c4('0x46')](_0x38a529[_0x79c4('0x45')]);_0x3c935a[_0x79c4('0x47')]=_[_0x79c4('0x48')](_0x3c935a['model'],_0x3c935a['query']);_0x584301[_0x79c4('0x49')]=_[_0x79c4('0x48')](_0x3c935a['model'],qs['fields'](_0x38a529[_0x79c4('0x45')][_0x79c4('0x4a')]));_0x584301[_0x79c4('0x49')]=_0x584301['attributes'][_0x79c4('0x4b')]?_0x584301['attributes']:_0x3c935a[_0x79c4('0x44')];if(!_0x38a529['query'][_0x79c4('0x4c')](_0x79c4('0x4d'))){_0x584301['limit']=qs[_0x79c4('0x31')](_0x38a529[_0x79c4('0x45')]['limit']);_0x584301[_0x79c4('0x30')]=qs[_0x79c4('0x30')](_0x38a529[_0x79c4('0x45')][_0x79c4('0x30')]);}_0x584301['order']=qs['sort'](_0x38a529['query'][_0x79c4('0x4e')]);_0x584301['where']=qs[_0x79c4('0x47')](_['pick'](_0x38a529['query'],_0x3c935a['filters']),_0x3cb4f8);if(_0x38a529[_0x79c4('0x45')][_0x79c4('0x4f')]){_0x584301[_0x79c4('0x50')]=_[_0x79c4('0x51')](_0x584301[_0x79c4('0x50')],{'$or':_[_0x79c4('0x52')](_0x3cb4f8,function(_0x49b323){if(_0x49b323[_0x79c4('0x42')]!=='VIRTUAL'){var _0x45bce9={};_0x45bce9[_0x49b323[_0x79c4('0x3b')]]={'$like':'%'+_0x38a529[_0x79c4('0x45')][_0x79c4('0x4f')]+'%'};return _0x45bce9;}})});}_0x584301=_[_0x79c4('0x51')]({},_0x584301,_0x38a529[_0x79c4('0x53')]);var _0x3d2b17={'where':_0x584301['where']};return db[_0x79c4('0x3f')][_0x79c4('0x54')](_0x3d2b17)[_0x79c4('0x21')](function(_0x5620ed){_0x41d3d2[_0x79c4('0x54')]=_0x5620ed;if(_0x38a529[_0x79c4('0x45')]['includeAll']){_0x584301[_0x79c4('0x55')]=[{'all':!![]}];}return db['ChatWebsite'][_0x79c4('0x56')](_0x584301);})[_0x79c4('0x21')](function(_0x3223d6){_0x41d3d2[_0x79c4('0x57')]=_0x3223d6;return _0x41d3d2;})[_0x79c4('0x21')](respondWithFilteredResult(_0x184640,_0x584301))['catch'](handleError(_0x184640,null));};exports[_0x79c4('0x58')]=function(_0x2e5e1e,_0x1dc8b4){var _0x3abbb1={'raw':![],'where':{'id':_0x2e5e1e[_0x79c4('0x59')]['id']},'include':[{'model':db[_0x79c4('0x3d')],'as':_0x79c4('0x3e')}]},_0x8186ec={};_0x8186ec[_0x79c4('0x44')]=_[_0x79c4('0x46')](db[_0x79c4('0x3f')][_0x79c4('0x40')]);_0x8186ec[_0x79c4('0x45')]=_[_0x79c4('0x46')](_0x2e5e1e[_0x79c4('0x45')]);_0x8186ec[_0x79c4('0x47')]=_[_0x79c4('0x48')](_0x8186ec[_0x79c4('0x44')],_0x8186ec[_0x79c4('0x45')]);_0x3abbb1['attributes']=_[_0x79c4('0x48')](_0x8186ec['model'],qs[_0x79c4('0x4a')](_0x2e5e1e[_0x79c4('0x45')][_0x79c4('0x4a')]));_0x3abbb1[_0x79c4('0x49')]=_0x3abbb1[_0x79c4('0x49')][_0x79c4('0x4b')]?_0x3abbb1[_0x79c4('0x49')]:_0x8186ec[_0x79c4('0x44')];if(_0x2e5e1e[_0x79c4('0x45')][_0x79c4('0x5a')]){_0x3abbb1[_0x79c4('0x55')]=[{'all':!![]}];}_0x3abbb1=_[_0x79c4('0x51')]({},_0x3abbb1,_0x2e5e1e[_0x79c4('0x53')]);return db[_0x79c4('0x3f')]['find'](_0x3abbb1)[_0x79c4('0x21')](handleEntityNotFound(_0x1dc8b4,null))[_0x79c4('0x21')](respondWithResult(_0x1dc8b4,null))['catch'](handleError(_0x1dc8b4,null));};exports['create']=function(_0x871af3,_0x4608da){return db[_0x79c4('0x3f')][_0x79c4('0x5b')](_0x871af3[_0x79c4('0x5c')],{})['then'](function(_0x2232c8){var _0x57effd=_0x871af3['user']['get']({'plain':!![]});if(!_0x57effd)throw new Error(_0x79c4('0x5d'));if(_0x57effd[_0x79c4('0x5e')]==='user'){var _0x539686=_0x2232c8[_0x79c4('0x37')]({'plain':!![]});var _0x48155e=_0x79c4('0x38');return db['UserProfileSection'][_0x79c4('0x5f')]({'where':{'name':_0x48155e,'userProfileId':_0x57effd[_0x79c4('0x60')]},'raw':!![]})[_0x79c4('0x21')](function(_0x2abfac){if(_0x2abfac&&_0x2abfac[_0x79c4('0x61')]===0x0){return db[_0x79c4('0x39')][_0x79c4('0x5b')]({'name':_0x539686[_0x79c4('0x3b')],'resourceId':_0x539686['id'],'type':_0x2abfac[_0x79c4('0x3b')],'sectionId':_0x2abfac['id']},{})['then'](function(){return _0x2232c8;});}else{return _0x2232c8;}})[_0x79c4('0x2b')](function(_0x5a706f){logger[_0x79c4('0x27')](_0x79c4('0x62'),_0x5a706f);throw _0x5a706f;});}return _0x2232c8;})['then'](respondWithResult(_0x4608da,0xc9))[_0x79c4('0x2b')](handleError(_0x4608da,null));};exports[_0x79c4('0x35')]=function(_0x4b2b3d,_0xbf27b){if(_0x4b2b3d[_0x79c4('0x5c')]['id']){delete _0x4b2b3d[_0x79c4('0x5c')]['id'];}return db[_0x79c4('0x3f')][_0x79c4('0x5f')]({'where':{'id':_0x4b2b3d[_0x79c4('0x59')]['id']},'include':[{'model':db[_0x79c4('0x3d')],'as':_0x79c4('0x3e')}]})['then'](handleEntityNotFound(_0xbf27b,null))[_0x79c4('0x21')](saveUpdates(_0x4b2b3d[_0x79c4('0x5c')],null))[_0x79c4('0x21')](respondWithResult(_0xbf27b,null))[_0x79c4('0x2b')](handleError(_0xbf27b,null));};exports[_0x79c4('0x36')]=function(_0x5d8ce6,_0x30e956){return db[_0x79c4('0x3f')][_0x79c4('0x5f')]({'where':{'id':_0x5d8ce6[_0x79c4('0x59')]['id']}})[_0x79c4('0x21')](handleEntityNotFound(_0x30e956,null))['then'](removeEntity(_0x30e956,null))[_0x79c4('0x2b')](handleError(_0x30e956,null));};exports['describe']=function(_0x23ebb0,_0x30e502){return db[_0x79c4('0x3f')]['describe']()[_0x79c4('0x21')](respondWithResult(_0x30e502,null))['catch'](handleError(_0x30e502,null));};exports[_0x79c4('0x63')]=function(_0x4f5fc9,_0x652113,_0x115e8d){if(_0x4f5fc9[_0x79c4('0x5c')]['id']){delete _0x4f5fc9['body']['id'];}return db[_0x79c4('0x3f')][_0x79c4('0x5f')]({'where':{'id':_0x4f5fc9[_0x79c4('0x59')]['id']}})[_0x79c4('0x21')](handleEntityNotFound(_0x652113,null))[_0x79c4('0x21')](function(_0x30c356){if(_0x30c356){_0x4f5fc9['body'][_0x79c4('0x64')]=_0x30c356['id'];return db[_0x79c4('0x65')][_0x79c4('0x5b')](_0x4f5fc9['body']);}})[_0x79c4('0x21')](respondWithResult(_0x652113,null))[_0x79c4('0x2b')](handleError(_0x652113,null));};exports['getDispositions']=function(_0x313608,_0x4e7220,_0x596686){var _0x5b1fc3={'raw':![],'where':{}};var _0x2349a1={};var _0x46028e={'count':0x0,'rows':[]};return db[_0x79c4('0x3f')][_0x79c4('0x66')]({'where':{'id':_0x313608[_0x79c4('0x59')]['id']}})[_0x79c4('0x21')](handleEntityNotFound(_0x4e7220,null))[_0x79c4('0x21')](function(_0x31bb6c){if(_0x31bb6c){_0x2349a1[_0x79c4('0x44')]=_['keys'](db['Disposition'][_0x79c4('0x40')]);_0x2349a1['query']=_['keys'](_0x313608[_0x79c4('0x45')]);_0x2349a1[_0x79c4('0x47')]=_[_0x79c4('0x48')](_0x2349a1['model'],_0x2349a1[_0x79c4('0x45')]);_0x5b1fc3[_0x79c4('0x49')]=_[_0x79c4('0x48')](_0x2349a1['model'],qs[_0x79c4('0x4a')](_0x313608[_0x79c4('0x45')][_0x79c4('0x4a')]));_0x5b1fc3['attributes']=_0x5b1fc3[_0x79c4('0x49')][_0x79c4('0x4b')]?_0x5b1fc3[_0x79c4('0x49')]:_0x2349a1['model'];if(!_0x313608[_0x79c4('0x45')]['hasOwnProperty'](_0x79c4('0x4d'))){_0x5b1fc3[_0x79c4('0x31')]=qs['limit'](_0x313608['query']['limit']);_0x5b1fc3[_0x79c4('0x30')]=qs['offset'](_0x313608[_0x79c4('0x45')][_0x79c4('0x30')]);}_0x5b1fc3['order']=qs['sort'](_0x313608[_0x79c4('0x45')][_0x79c4('0x4e')]);_0x5b1fc3[_0x79c4('0x50')]=qs[_0x79c4('0x47')](_['pick'](_0x313608['query'],_0x2349a1['filters']));_0x5b1fc3[_0x79c4('0x50')]['ChatWebsiteId']=_0x31bb6c['id'];if(_0x313608[_0x79c4('0x45')][_0x79c4('0x4f')]){_0x5b1fc3['where']=_['merge'](_0x5b1fc3[_0x79c4('0x50')],{'$or':_[_0x79c4('0x52')](_0x5b1fc3[_0x79c4('0x49')],function(_0x27b105){var _0x4de8e0={};_0x4de8e0[_0x27b105]={'$like':'%'+_0x313608[_0x79c4('0x45')]['filter']+'%'};return _0x4de8e0;})});}_0x5b1fc3=_[_0x79c4('0x51')]({},_0x5b1fc3,_0x313608[_0x79c4('0x53')]);return db[_0x79c4('0x65')][_0x79c4('0x54')]({'where':_0x5b1fc3[_0x79c4('0x50')]})[_0x79c4('0x21')](function(_0x4e217f){_0x46028e[_0x79c4('0x54')]=_0x4e217f;if(_0x313608[_0x79c4('0x45')]['includeAll']){_0x5b1fc3[_0x79c4('0x55')]=[{'all':!![]}];}return db[_0x79c4('0x65')]['findAll'](_0x5b1fc3);})[_0x79c4('0x21')](function(_0x551040){_0x46028e[_0x79c4('0x57')]=_0x551040;return _0x46028e;});}})['then'](respondWithFilteredResult(_0x4e7220,_0x5b1fc3))[_0x79c4('0x2b')](handleError(_0x4e7220,null));};exports[_0x79c4('0x67')]=function(_0x3fcea0,_0x200493,_0x436e90){return db['ChatWebsite']['find']({'where':{'id':_0x3fcea0[_0x79c4('0x59')]['id']}})[_0x79c4('0x21')](handleEntityNotFound(_0x200493,null))[_0x79c4('0x21')](function(_0x5cca3c){if(_0x5cca3c){return _0x5cca3c[_0x79c4('0x67')](_0x3fcea0['query'][_0x79c4('0x68')]);}})[_0x79c4('0x21')](respondWithStatusCode(_0x200493,null))[_0x79c4('0x2b')](handleError(_0x200493,null));};exports['addAnswer']=function(_0x4161f0,_0x534718,_0x2beb4c){if(_0x4161f0['body']['id']){delete _0x4161f0['body']['id'];}return db[_0x79c4('0x3f')][_0x79c4('0x5f')]({'where':{'id':_0x4161f0[_0x79c4('0x59')]['id']}})[_0x79c4('0x21')](handleEntityNotFound(_0x534718,null))[_0x79c4('0x21')](function(_0x2ea5b6){if(_0x2ea5b6){_0x4161f0[_0x79c4('0x5c')][_0x79c4('0x64')]=_0x2ea5b6['id'];return db['CannedAnswer'][_0x79c4('0x5b')](_0x4161f0['body']);}})[_0x79c4('0x21')](respondWithResult(_0x534718,null))[_0x79c4('0x2b')](handleError(_0x534718,null));};exports[_0x79c4('0x69')]=function(_0x1e6bbb,_0x4fe2cc,_0x209a3c){var _0x2d2fe3={'raw':![],'where':{}};var _0x5cd154={};var _0x11847d={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x79c4('0x66')]({'where':{'id':_0x1e6bbb['params']['id']}})['then'](handleEntityNotFound(_0x4fe2cc,null))[_0x79c4('0x21')](function(_0x2f136e){if(_0x2f136e){_0x5cd154[_0x79c4('0x44')]=_[_0x79c4('0x46')](db[_0x79c4('0x6a')][_0x79c4('0x40')]);_0x5cd154[_0x79c4('0x45')]=_[_0x79c4('0x46')](_0x1e6bbb[_0x79c4('0x45')]);_0x5cd154[_0x79c4('0x47')]=_[_0x79c4('0x48')](_0x5cd154[_0x79c4('0x44')],_0x5cd154[_0x79c4('0x45')]);_0x2d2fe3[_0x79c4('0x49')]=_[_0x79c4('0x48')](_0x5cd154[_0x79c4('0x44')],qs[_0x79c4('0x4a')](_0x1e6bbb[_0x79c4('0x45')]['fields']));_0x2d2fe3[_0x79c4('0x49')]=_0x2d2fe3[_0x79c4('0x49')]['length']?_0x2d2fe3[_0x79c4('0x49')]:_0x5cd154[_0x79c4('0x44')];if(!_0x1e6bbb['query'][_0x79c4('0x4c')]('nolimit')){_0x2d2fe3[_0x79c4('0x31')]=qs[_0x79c4('0x31')](_0x1e6bbb[_0x79c4('0x45')][_0x79c4('0x31')]);_0x2d2fe3[_0x79c4('0x30')]=qs[_0x79c4('0x30')](_0x1e6bbb[_0x79c4('0x45')][_0x79c4('0x30')]);}_0x2d2fe3[_0x79c4('0x6b')]=qs['sort'](_0x1e6bbb[_0x79c4('0x45')]['sort']);_0x2d2fe3[_0x79c4('0x50')]=qs[_0x79c4('0x47')](_[_0x79c4('0x6c')](_0x1e6bbb[_0x79c4('0x45')],_0x5cd154[_0x79c4('0x47')]));_0x2d2fe3[_0x79c4('0x50')]['ChatWebsiteId']=_0x2f136e['id'];if(_0x1e6bbb['query'][_0x79c4('0x4f')]){_0x2d2fe3[_0x79c4('0x50')]=_[_0x79c4('0x51')](_0x2d2fe3[_0x79c4('0x50')],{'$or':_[_0x79c4('0x52')](_0x2d2fe3[_0x79c4('0x49')],function(_0x3b3924){var _0x21137c={};_0x21137c[_0x3b3924]={'$like':'%'+_0x1e6bbb[_0x79c4('0x45')][_0x79c4('0x4f')]+'%'};return _0x21137c;})});}_0x2d2fe3=_[_0x79c4('0x51')]({},_0x2d2fe3,_0x1e6bbb['options']);return db[_0x79c4('0x6a')]['count']({'where':_0x2d2fe3[_0x79c4('0x50')]})[_0x79c4('0x21')](function(_0x2239f9){_0x11847d[_0x79c4('0x54')]=_0x2239f9;if(_0x1e6bbb['query'][_0x79c4('0x5a')]){_0x2d2fe3['include']=[{'all':!![]}];}return db[_0x79c4('0x6a')][_0x79c4('0x56')](_0x2d2fe3);})[_0x79c4('0x21')](function(_0x3b789d){_0x11847d[_0x79c4('0x57')]=_0x3b789d;return _0x11847d;});}})[_0x79c4('0x21')](respondWithFilteredResult(_0x4fe2cc,_0x2d2fe3))[_0x79c4('0x2b')](handleError(_0x4fe2cc,null));};exports[_0x79c4('0x6d')]=function(_0x118624,_0x267b70,_0x388bab){return db[_0x79c4('0x3f')][_0x79c4('0x5f')]({'where':{'id':_0x118624[_0x79c4('0x59')]['id']}})[_0x79c4('0x21')](handleEntityNotFound(_0x267b70,null))[_0x79c4('0x21')](function(_0x155760){if(_0x155760){return _0x155760[_0x79c4('0x6d')](_0x118624[_0x79c4('0x45')][_0x79c4('0x68')]);}})[_0x79c4('0x21')](respondWithStatusCode(_0x267b70,null))[_0x79c4('0x2b')](handleError(_0x267b70,null));};exports['addLogo']=function(_0x14269d,_0x1dfd41,_0x5b7816){_0x14269d[_0x79c4('0x5c')]['sitepic']=_0x14269d[_0x79c4('0x6e')][_0x79c4('0x6f')];return db[_0x79c4('0x3f')][_0x79c4('0x5f')]({'where':{'id':_0x14269d[_0x79c4('0x59')]['id']}})['then'](handleEntityNotFound(_0x1dfd41,null))[_0x79c4('0x21')](saveUpdates(_0x14269d[_0x79c4('0x5c')],null))[_0x79c4('0x21')](respondWithResult(_0x1dfd41,null))['catch'](handleError(_0x1dfd41,null));};exports[_0x79c4('0x70')]=function(_0x334284,_0x7ece84,_0x26fefd){_0x334284[_0x79c4('0x5c')]['agentAvatar']=_0x334284[_0x79c4('0x6e')]['filename'];return db['ChatWebsite']['find']({'where':{'id':_0x334284[_0x79c4('0x59')]['id']}})[_0x79c4('0x21')](handleEntityNotFound(_0x7ece84,null))['then'](saveUpdates(_0x334284[_0x79c4('0x5c')],null))[_0x79c4('0x21')](respondWithResult(_0x7ece84,null))['catch'](handleError(_0x7ece84,null));};exports['addCustomerAvatar']=function(_0x6c01e8,_0x40af9c,_0x3e278b){_0x6c01e8[_0x79c4('0x5c')][_0x79c4('0x71')]=_0x6c01e8[_0x79c4('0x6e')]['filename'];return db['ChatWebsite'][_0x79c4('0x5f')]({'where':{'id':_0x6c01e8[_0x79c4('0x59')]['id']}})[_0x79c4('0x21')](handleEntityNotFound(_0x40af9c,null))[_0x79c4('0x21')](saveUpdates(_0x6c01e8[_0x79c4('0x5c')],null))[_0x79c4('0x21')](respondWithResult(_0x40af9c,null))[_0x79c4('0x2b')](handleError(_0x40af9c,null));};exports['addSystemAvatar']=function(_0x2b368c,_0xcd9738,_0x214045){_0x2b368c[_0x79c4('0x5c')]['systemAvatar']=_0x2b368c['file'][_0x79c4('0x6f')];return db[_0x79c4('0x3f')]['find']({'where':{'id':_0x2b368c[_0x79c4('0x59')]['id']}})[_0x79c4('0x21')](handleEntityNotFound(_0xcd9738,null))['then'](saveUpdates(_0x2b368c['body'],null))[_0x79c4('0x21')](respondWithResult(_0xcd9738,null))[_0x79c4('0x2b')](handleError(_0xcd9738,null));};exports[_0x79c4('0x72')]=function(_0xd9fa69,_0x282c8e,_0x4d6063){var _0xc8bf60=path[_0x79c4('0x73')](config[_0x79c4('0x74')],_0x79c4('0x75'));var _0x1603ba={'where':{'id':_0xd9fa69[_0x79c4('0x59')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x560de2=![];return require('../../config/license/util')[_0x79c4('0x76')]()[_0x79c4('0x21')](function(_0x184ac5){if(_0x184ac5){_0x560de2=_0x184ac5[_0x79c4('0x77')];}})['then'](function(){return db[_0x79c4('0x3f')][_0x79c4('0x5f')](_0x1603ba);})[_0x79c4('0x21')](handleEntityNotFound(_0x282c8e,null))[_0x79c4('0x21')](function(_0x2a7554){if(_0x2a7554){if(!_[_0x79c4('0x78')](_0x2a7554['sitepic'])){if(fs[_0x79c4('0x79')](path[_0x79c4('0x73')](config[_0x79c4('0x74')],_0x79c4('0x7a'),_0x2a7554[_0x79c4('0x7b')]))&&_0x560de2){_0xc8bf60=path[_0x79c4('0x73')](config[_0x79c4('0x74')],'server/files/images/logos/',_0x2a7554['sitepic']);}}return _0x282c8e[_0x79c4('0x7c')](_0xc8bf60);}})[_0x79c4('0x2b')](handleError(_0x282c8e,null));};exports['getAvatar']=function(_0x5093d6,_0x3cbe7c,_0x4b9998){var _0x2542e0=path[_0x79c4('0x73')](config[_0x79c4('0x74')],'server/files/images/avatars/default_avatar.png');var _0x376874={'where':{'id':_0x5093d6['params']['id']},'attributes':['id',_0x79c4('0x7d')],'raw':!![]};return db[_0x79c4('0x3f')][_0x79c4('0x5f')](_0x376874)[_0x79c4('0x21')](handleEntityNotFound(_0x3cbe7c,null))[_0x79c4('0x21')](function(_0x50d833){if(_0x50d833){if(!_['isNil'](_0x50d833[_0x79c4('0x7d')])){if(fs[_0x79c4('0x79')](path[_0x79c4('0x73')](config[_0x79c4('0x74')],'server/files/images/avatars/',_0x50d833[_0x79c4('0x7d')]))){_0x2542e0=path[_0x79c4('0x73')](config['root'],_0x79c4('0x7e'),_0x50d833[_0x79c4('0x7d')]);}}return _0x3cbe7c[_0x79c4('0x7c')](_0x2542e0);}})['catch'](handleError(_0x3cbe7c,null));};exports[_0x79c4('0x7f')]=function(_0x33bca3,_0x5242bb,_0xf882ad){var _0x1cefcc=path['join'](config[_0x79c4('0x74')],_0x79c4('0x80'));var _0x3fd307={'where':{'id':_0x33bca3[_0x79c4('0x59')]['id']},'attributes':['id','customerAvatar',_0x79c4('0x81')],'raw':!![]};return db['ChatWebsite'][_0x79c4('0x5f')](_0x3fd307)['then'](handleEntityNotFound(_0x5242bb,null))[_0x79c4('0x21')](function(_0x44fa43){if(_0x44fa43){if(!_['isNil'](_0x44fa43[_0x79c4('0x71')])){if(fs['existsSync'](path['join'](config['root'],_0x79c4('0x7e'),_0x44fa43[_0x79c4('0x71')]))&&_0x44fa43[_0x79c4('0x81')]){_0x1cefcc=path['join'](config['root'],_0x79c4('0x7e'),_0x44fa43[_0x79c4('0x71')]);}}return _0x5242bb[_0x79c4('0x7c')](_0x1cefcc);}})[_0x79c4('0x2b')](handleError(_0x5242bb,null));};exports[_0x79c4('0x82')]=function(_0x581b79,_0x436500,_0x438d54){var _0x5acfa1=path[_0x79c4('0x73')](config[_0x79c4('0x74')],'server/files/images/avatars/system_avatar.png');var _0x11e942={'where':{'id':_0x581b79[_0x79c4('0x59')]['id']},'attributes':['id',_0x79c4('0x83')],'raw':!![]};return db[_0x79c4('0x3f')]['find'](_0x11e942)['then'](handleEntityNotFound(_0x436500,null))[_0x79c4('0x21')](function(_0x5a96d7){if(_0x5a96d7){if(!_[_0x79c4('0x78')](_0x5a96d7[_0x79c4('0x83')])){if(fs[_0x79c4('0x79')](path[_0x79c4('0x73')](config[_0x79c4('0x74')],'server/files/images/avatars/',_0x5a96d7['systemAvatar']))){_0x5acfa1=path[_0x79c4('0x73')](config[_0x79c4('0x74')],_0x79c4('0x7e'),_0x5a96d7[_0x79c4('0x83')]);}}return _0x436500['download'](_0x5acfa1);}})[_0x79c4('0x2b')](handleError(_0x436500,null));};exports[_0x79c4('0x84')]=function(_0x5cdccc,_0x400e0b,_0x13ddb3){var _0x397d59=require(_0x79c4('0x85'));var _0x2e04b3=new _0x397d59();var _0x574d25=_0x2e04b3[_0x79c4('0x86')](_0x5cdccc['headers'][_0x79c4('0x87')])[_0x79c4('0x88')]();var _0x52531b={'body':_0x5cdccc[_0x79c4('0x5c')],'channel':_0x79c4('0x89')};var _0x4e3414=[];var _0x4514f0=[];var _0x28d373={};var _0x32b003=![];return db[_0x79c4('0x8a')][_0x79c4('0x8b')]()[_0x79c4('0x21')](function(_0x299dc0){if(!_0x299dc0){throw new db['Sequelize'][(_0x79c4('0x1f'))](_0x79c4('0x8c'));}_0x4e3414=_[_0x79c4('0x8d')](_[_0x79c4('0x46')](_0x299dc0),[_0x79c4('0x8e'),_0x79c4('0x8f')]);_0x4514f0=_[_0x79c4('0x8d')](_[_0x79c4('0x46')](_0x299dc0),[_0x79c4('0x8e'),_0x79c4('0x8f'),'CompanyId','ListId']);if(_0x5cdccc[_0x79c4('0x5c')]['id']){delete _0x5cdccc[_0x79c4('0x5c')]['id'];}if(_[_0x79c4('0x78')](_0x5cdccc[_0x79c4('0x5c')]['from'])){throw new db[(_0x79c4('0x1e'))][(_0x79c4('0x1f'))](_0x79c4('0x90'));}if(_['isNil'](_0x5cdccc[_0x79c4('0x5c')]['body'])||_0x5cdccc[_0x79c4('0x5c')][_0x79c4('0x5c')]===''){throw new db[(_0x79c4('0x1e'))][(_0x79c4('0x1f'))](_0x79c4('0x91'));}if(_[_0x79c4('0x78')](_0x5cdccc[_0x79c4('0x5c')][_0x79c4('0x92')])){throw new db[(_0x79c4('0x1e'))][(_0x79c4('0x1f'))](_0x79c4('0x93')+_0x4514f0);}if(!_[_0x79c4('0x94')](_0x4514f0,_0x5cdccc[_0x79c4('0x5c')][_0x79c4('0x92')])){throw new db[(_0x79c4('0x1e'))][(_0x79c4('0x1f'))](_0x79c4('0x95')+_0x4514f0);}_0x28d373[_0x5cdccc[_0x79c4('0x5c')][_0x79c4('0x92')]]=_0x5cdccc[_0x79c4('0x5c')][_0x79c4('0x96')];})[_0x79c4('0x21')](function(){return db[_0x79c4('0x3f')]['find']({'where':{'id':_0x5cdccc['params']['id']},'include':[{'model':db[_0x79c4('0x97')],'as':'List','include':[{'model':db[_0x79c4('0x8a')],'as':_0x79c4('0x98'),'where':_0x28d373,'limit':0x1,'order':[[_0x79c4('0x8f'),_0x79c4('0x99')]]}]},{'model':db[_0x79c4('0x9a')],'as':_0x79c4('0x9b')}]});})[_0x79c4('0x21')](handleEntityNotFound(_0x400e0b,null))[_0x79c4('0x21')](function(_0x3faaff){if(_0x3faaff&&_0x3faaff['List']){_0x52531b['account']=_0x3faaff;_0x52531b[_0x79c4('0x9c')]=_0x3faaff['Applications'];_0x52531b[_0x79c4('0x9d')]=_0x3faaff[_0x79c4('0x9e')];_0x52531b['applications']=_[_0x79c4('0x9f')](_0x52531b['applications'],['priority'],['asc']);if(_0x52531b[_0x79c4('0xa0')][_0x79c4('0x9b')]){delete _0x52531b['account'][_0x79c4('0x9b')];}if(_0x52531b[_0x79c4('0xa0')]['List']&&_0x52531b[_0x79c4('0xa0')][_0x79c4('0x9e')][_0x79c4('0x98')][_0x79c4('0x4b')]){return _0x52531b[_0x79c4('0xa0')][_0x79c4('0x9e')][_0x79c4('0x98')][0x0];}var _0x191ee1=_[_0x79c4('0x17')](_0x5cdccc['body'],{'firstName':_0x5cdccc[_0x79c4('0x5c')][_0x79c4('0x96')],'ListId':_0x3faaff[_0x79c4('0xa1')]});_0x191ee1[_0x5cdccc[_0x79c4('0x5c')][_0x79c4('0x92')]]=_0x5cdccc[_0x79c4('0x5c')][_0x79c4('0x96')];return db[_0x79c4('0x8a')][_0x79c4('0x5b')](_0x191ee1,{'fields':_0x4e3414,'raw':!![]});}})[_0x79c4('0x21')](handleEntityNotFound(_0x400e0b,null))[_0x79c4('0x21')](function(_0x2a222b){_0x52531b[_0x79c4('0xa2')]=_0x2a222b;var _0x492fa6=_0x5cdccc[_0x79c4('0x5c')][_0x79c4('0xa3')];if(_0x5cdccc[_0x79c4('0xa4')][_0x79c4('0xa5')]){_0x492fa6=_0x5cdccc[_0x79c4('0xa4')]['cf-connecting-ip'];}else if(_0x5cdccc[_0x79c4('0xa4')][_0x79c4('0xa6')]){_0x492fa6=_[_0x79c4('0xa7')](_0x5cdccc[_0x79c4('0xa4')][_0x79c4('0xa6')][_0x79c4('0xa8')](','));}if(_0x2a222b){var _0x4cb459={'ContactId':_0x2a222b['id'],'ChatWebsiteId':_0x5cdccc[_0x79c4('0x59')]['id'],'from':(_0x2a222b[_0x79c4('0xa9')]||'')+'\x20'+(_0x2a222b[_0x79c4('0xaa')]||''),'customerIp':_0x492fa6,'customerPort':_0x5cdccc[_0x79c4('0xa4')]['x-real-port']?_0x5cdccc[_0x79c4('0xa4')]['x-real-port']:null,'referer':_0x5cdccc[_0x79c4('0x5c')][_0x79c4('0xab')],'browserName':_0x574d25[_0x79c4('0xac')][_0x79c4('0x3b')]&&_0x574d25['browser']['version']?util[_0x79c4('0xad')](_0x79c4('0xae'),_0x574d25[_0x79c4('0xac')][_0x79c4('0x3b')],_0x574d25[_0x79c4('0xac')][_0x79c4('0xaf')]):_0x79c4('0xb0'),'browserVersion':_0x574d25[_0x79c4('0xac')][_0x79c4('0xaf')]||_0x79c4('0xb0'),'osName':util[_0x79c4('0xad')](_0x79c4('0xae'),_0x574d25['os'][_0x79c4('0x3b')],_0x574d25['os']['version']),'osVersion':_0x574d25['os'][_0x79c4('0xaf')],'deviceModel':_0x574d25[_0x79c4('0xb1')][_0x79c4('0x44')]&&_0x574d25[_0x79c4('0xb1')]['vendor']?util[_0x79c4('0xad')](_0x79c4('0xb2'),_0x574d25[_0x79c4('0xb1')][_0x79c4('0x44')],_0x574d25['device']['vendor'],_0x574d25[_0x79c4('0xb1')][_0x79c4('0x42')]):null,'deviceVendor':_0x574d25['device'][_0x79c4('0xb3')],'deviceType':_0x574d25['device'][_0x79c4('0x42')],'formData':JSON[_0x79c4('0xb4')](_0x5cdccc[_0x79c4('0x5c')])};var _0x5d7fdf={'ChatWebsiteId':_0x5cdccc[_0x79c4('0x59')]['id'],'closed':![]};if(_0x5cdccc[_0x79c4('0x5c')][_0x79c4('0xb5')]){_0x5d7fdf[_0x79c4('0xb5')]=_0x5cdccc[_0x79c4('0x5c')]['threadId'];return db['ChatInteraction'][_0x79c4('0x5f')]({'where':_0x5d7fdf})[_0x79c4('0x21')](function(_0x2b05ad){if(_0x2b05ad){return[_0x2b05ad,![]];}_0x4cb459[_0x79c4('0xb5')]=_0x5cdccc[_0x79c4('0x5c')][_0x79c4('0xb5')];_0x4cb459[_0x79c4('0xb6')]=_0x5cdccc[_0x79c4('0x5c')]['externalUrl'];return db[_0x79c4('0xb7')][_0x79c4('0x5b')](_0x4cb459)['then'](function(_0x3636d0){return[_0x3636d0,!![]];});});}_0x5d7fdf[_0x79c4('0xb8')]=_0x2a222b['id'];if(_0x5cdccc[_0x79c4('0x5c')][_0x79c4('0xb9')]&&_0x5cdccc['body'][_0x79c4('0xb9')]['id']){_0x5d7fdf['id']=_0x5cdccc[_0x79c4('0x5c')][_0x79c4('0xb9')]['id'];return db[_0x79c4('0xb7')][_0x79c4('0x5f')]({'where':_0x5d7fdf})[_0x79c4('0x21')](function(_0x5335fc){if(_0x5335fc){return[_0x5335fc,![]];}return db[_0x79c4('0xb7')][_0x79c4('0x5b')](_0x4cb459)[_0x79c4('0x21')](function(_0x311701){return[_0x311701,!![]];});});}return db[_0x79c4('0xb7')][_0x79c4('0x5b')](_0x4cb459)[_0x79c4('0x21')](function(_0x3cb176){return[_0x3cb176,!![]];});}})[_0x79c4('0xba')](function(_0x3cc672,_0x505745){if(_0x3cc672){_0x32b003=_0x505745;if(!_0x505745){var _0x4fb982={'from':(_0x52531b['contact']['firstName']||'')+'\x20'+(_0x52531b['contact'][_0x79c4('0xaa')]||'')};if(_0x5cdccc[_0x79c4('0x5c')][_0x79c4('0xb5')]&&_0x5cdccc[_0x79c4('0x5c')][_0x79c4('0xbb')]&&_0x5cdccc[_0x79c4('0x5c')][_0x79c4('0xb5')]!=_0x5cdccc[_0x79c4('0x5c')]['messageId']){_0x4fb982[_0x79c4('0xb5')]=_0x5cdccc[_0x79c4('0x5c')][_0x79c4('0xbb')];}return _0x3cc672[_0x79c4('0x35')](_0x4fb982);}else{return _0x3cc672;}}})['then'](function(_0x51a94b){_0x52531b[_0x79c4('0xb9')]=_0x51a94b[_0x79c4('0x37')]({'plain':!![]});_0x52531b['interaction'][_0x79c4('0xbc')]=_0x32b003;if(_0x52531b[_0x79c4('0xb9')][_0x79c4('0xbc')]){if(_0x52531b[_0x79c4('0xa0')][_0x79c4('0xbd')]){_0x52531b[_0x79c4('0x9c')]['push']({'id':0x0,'priority':_0x52531b['applications']['length']+0x1,'app':'close','appdata':_0x79c4('0xbe'),'interval':_0x79c4('0xbf')});}}return db[_0x79c4('0xc0')][_0x79c4('0x5b')]({'body':_0x5cdccc[_0x79c4('0x5c')][_0x79c4('0x5c')],'ChatWebsiteId':_0x5cdccc[_0x79c4('0x59')]['id'],'ChatInteractionId':_0x51a94b['id'],'direction':'in','ContactId':_0x52531b[_0x79c4('0xa2')]['id'],'AttachmentId':_0x5cdccc[_0x79c4('0x5c')][_0x79c4('0xc1')]});})['then'](function(_0x524179){_0x52531b[_0x79c4('0x29')]=_0x524179;if(_0x52531b[_0x79c4('0xb9')][_0x79c4('0xc2')]){return db[_0x79c4('0xc3')][_0x79c4('0x5f')]({'attributes':['id',_0x79c4('0x3b')],'where':{'id':_0x52531b['interaction']['UserId']}})[_0x79c4('0x21')](function(_0x230365){if(_0x230365){_0x52531b[_0x79c4('0x9c')][_0x79c4('0xc4')]({'id':0x0,'priority':0x0,'app':_0x79c4('0xc5'),'appdata':_0x230365[_0x79c4('0x3b')]+','+(_0x52531b[_0x79c4('0xa0')]['waitForTheAssignedAgent']||0xa),'interval':_0x79c4('0xbf')});_0x52531b[_0x79c4('0xc6')]=!![];}return respondWithRpcPromise('Start',_0x79c4('0xc7'),_0x52531b);});}return respondWithRpcPromise(_0x79c4('0xc8'),_0x79c4('0xc7'),_0x52531b);})['then'](function(_0x1909e6){respondWithRpcPromise(_0x79c4('0xc9'),_0x79c4('0xc9'),{'event':_0x79c4('0x84'),'message':_0x1909e6},client9002);return _0x1909e6;})[_0x79c4('0x21')](respondWithResult(_0x400e0b,null))[_0x79c4('0x2b')](handleError(_0x400e0b,null));};exports[_0x79c4('0xca')]=function(_0xf49adf,_0x4efd6c,_0x4ed2af){var _0x80c84e,_0x38ac44,_0x3d231d;var _0x1dd6d8=[];var _0xa3a477=[];var _0x46ee4c={};return db[_0x79c4('0x8a')][_0x79c4('0x8b')]()[_0x79c4('0x21')](function(_0x197f3f){if(!_0x197f3f){throw new db[(_0x79c4('0x1e'))][(_0x79c4('0x1f'))](_0x79c4('0x8c'));}_0xa3a477=_[_0x79c4('0x8d')](_[_0x79c4('0x46')](_0x197f3f),['createdAt','updatedAt']);_0x1dd6d8=_['difference'](_[_0x79c4('0x46')](_0x197f3f),[_0x79c4('0x8e'),_0x79c4('0x8f'),_0x79c4('0xcb'),_0x79c4('0xa1')]);if(_0xf49adf[_0x79c4('0x5c')]['id']){delete _0xf49adf[_0x79c4('0x5c')]['id'];}if(_[_0x79c4('0x78')](_0xf49adf[_0x79c4('0x5c')]['from'])){throw _0x4efd6c[_0x79c4('0x2d')](0x1f4)[_0x79c4('0xcc')](new db[(_0x79c4('0x1e'))][(_0x79c4('0x1f'))](_0x79c4('0x90')));}if(_[_0x79c4('0x78')](_0xf49adf[_0x79c4('0x5c')][_0x79c4('0x5c')])||_0xf49adf[_0x79c4('0x5c')][_0x79c4('0x5c')]===''){throw _0x4efd6c[_0x79c4('0x2d')](0x1f4)['send'](new db[(_0x79c4('0x1e'))][(_0x79c4('0x1f'))](_0x79c4('0x91')));}if(_[_0x79c4('0x78')](_0xf49adf['body']['mapKeyOffline'])){throw _0x4efd6c['status'](0x1f4)[_0x79c4('0xcc')](new db['Sequelize'][(_0x79c4('0x1f'))](_0x79c4('0xcd')+_0x1dd6d8));}if(!_[_0x79c4('0x94')](_0x1dd6d8,_0xf49adf[_0x79c4('0x5c')]['mapKeyOffline'])){throw _0x4efd6c['status'](0x1f4)[_0x79c4('0xcc')](new db[(_0x79c4('0x1e'))]['ValidationError']('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1dd6d8));}_0x46ee4c[_0xf49adf[_0x79c4('0x5c')][_0x79c4('0xce')]]=_0xf49adf[_0x79c4('0x5c')][_0x79c4('0x96')];})[_0x79c4('0x21')](function(){return db[_0x79c4('0x3f')][_0x79c4('0x5f')]({'where':{'id':_0xf49adf[_0x79c4('0x59')]['id']},'include':[{'model':db[_0x79c4('0x97')],'as':_0x79c4('0x9e')}]});})[_0x79c4('0x21')](handleEntityNotFound(_0x4efd6c,null))[_0x79c4('0x21')](function(_0x55e1f0){if(_0x55e1f0&&_0x55e1f0[_0x79c4('0x9e')]){_0x38ac44=_0x55e1f0;var _0x1d82b8=_[_0x79c4('0x17')](_0xf49adf[_0x79c4('0x5c')],{'firstName':_0xf49adf[_0x79c4('0x5c')][_0x79c4('0x96')],'phone':_0xf49adf[_0x79c4('0x5c')][_0x79c4('0x96')],'ListId':_0x55e1f0[_0x79c4('0xa1')]});_0x1d82b8[_0xf49adf[_0x79c4('0x5c')][_0x79c4('0xce')]]=_0xf49adf[_0x79c4('0x5c')][_0x79c4('0x96')];return db[_0x79c4('0x8a')]['findOrCreate']({'where':_0x46ee4c,'defaults':_0x1d82b8});}})[_0x79c4('0xba')](function(_0x15ae25){if(_0x15ae25){_0x3d231d=_0x15ae25;var _0x3b7e6e=fs[_0x79c4('0xcf')](path['join'](config[_0x79c4('0x74')],_0x79c4('0xd0')),_0x79c4('0xd1'));var _0x23832d=ejs[_0x79c4('0xd2')](_0x3b7e6e,{'body':_[_0x79c4('0xd3')](_0xf49adf[_0x79c4('0x5c')]['body']),'bodyTitle':_0x38ac44[_0x79c4('0xd4')]});return db[_0x79c4('0xd5')][_0x79c4('0x5b')]({'body':_0x23832d,'ContactId':_0x15ae25['id'],'ChatWebsiteId':_0x38ac44['id']});}})[_0x79c4('0x21')](function(_0x2eed01){if(_0x2eed01){_0x80c84e=_0x2eed01;return db['MailAccount'][_0x79c4('0x66')]({'where':{'service':!![]},'include':[{'model':db[_0x79c4('0xd6')],'as':_0x79c4('0xd7'),'raw':!![]}]});}})[_0x79c4('0x21')](function(_0x2747f0){if(_0x2747f0&&_0x2747f0[_0x79c4('0xd7')]&&_0x38ac44[_0x79c4('0xd8')]){var _0x401fc8={'tls':{'rejectUnauthorized':![]}};if(_0x2747f0[_0x79c4('0xd7')][_0x79c4('0xd9')]){_0x401fc8[_0x79c4('0xd9')]=_0x2747f0[_0x79c4('0xd7')][_0x79c4('0xd9')];}else{_0x401fc8['host']=_0x2747f0[_0x79c4('0xd7')][_0x79c4('0xda')];_0x401fc8[_0x79c4('0xdb')]=_0x2747f0[_0x79c4('0xd7')][_0x79c4('0xdb')];_0x401fc8['secure']=_0x2747f0[_0x79c4('0xd7')]['secure'];}if(_0x2747f0['Smtp']['authentication']){_0x401fc8['auth']={'user':_0x2747f0[_0x79c4('0xd7')][_0x79c4('0xdc')],'pass':_0x2747f0[_0x79c4('0xd7')][_0x79c4('0xdd')]};}return respondWithRpcPromise(_0x79c4('0xde'),'sendMail',{'account':_0x401fc8,'message':{'from':util['format'](_0x79c4('0xdf'),_0x2747f0[_0x79c4('0x3b')],_0x2747f0[_0x79c4('0xe0')]||_0x2747f0[_0x79c4('0xd7')][_0x79c4('0xdc')]),'to':_0x38ac44[_0x79c4('0xd8')],'subject':_0x38ac44[_0x79c4('0xe1')],'text':_0x80c84e[_0x79c4('0x5c')]}},client9003)[_0x79c4('0x21')](function(){return _0x80c84e;})['catch'](function(_0xa5fb29){console['error'](_0xa5fb29);});}})['then'](function(){if(_0x80c84e){return _0x80c84e;}})['then'](respondWithResult(_0x4efd6c,null))[_0x79c4('0x2b')](handleError(_0x4efd6c,null));};exports[_0x79c4('0xe2')]=function(_0x5eabc5,_0xb31c5e,_0x10917e){return db[_0x79c4('0xb7')]['find']({'where':{'id':_0x5eabc5[_0x79c4('0x59')]['id']}})[_0x79c4('0x21')](handleEntityNotFound(_0xb31c5e,null))[_0x79c4('0x21')](function(_0x3b25e3){if(_0x3b25e3){return _0x3b25e3['addInteraction'](_0x5eabc5[_0x79c4('0x5c')]['ids'],_['omit'](_0x5eabc5[_0x79c4('0x5c')],[_0x79c4('0x68'),'id'])||{});}})[_0x79c4('0x21')](respondWithResult(_0xb31c5e,null))[_0x79c4('0x2b')](handleError(_0xb31c5e,null));};exports[_0x79c4('0xe3')]=function(_0x22d532,_0x5c53bc,_0x47ec6b){var _0x23d9ab={'raw':![],'where':{}};var _0x58e406={};var _0x818183={'count':0x0,'rows':[]};return db[_0x79c4('0x3f')][_0x79c4('0x66')]({'where':{'id':_0x22d532['params']['id']}})[_0x79c4('0x21')](handleEntityNotFound(_0x5c53bc,null))['then'](function(_0x5d296b){if(_0x5d296b){_0x58e406[_0x79c4('0x44')]=_[_0x79c4('0x46')](db[_0x79c4('0xb7')][_0x79c4('0x40')]);_0x58e406[_0x79c4('0x45')]=_[_0x79c4('0x46')](_0x22d532['query']);_0x58e406[_0x79c4('0x47')]=_['intersection'](_0x58e406['model'],_0x58e406['query']);_0x23d9ab[_0x79c4('0x49')]=_[_0x79c4('0x48')](_0x58e406[_0x79c4('0x44')],qs[_0x79c4('0x4a')](_0x22d532[_0x79c4('0x45')][_0x79c4('0x4a')]));_0x23d9ab['attributes']=_0x23d9ab[_0x79c4('0x49')][_0x79c4('0x4b')]?_0x23d9ab[_0x79c4('0x49')]:_0x58e406['model'];if(!_0x22d532[_0x79c4('0x45')][_0x79c4('0x4c')](_0x79c4('0x4d'))){_0x23d9ab[_0x79c4('0x31')]=qs[_0x79c4('0x31')](_0x22d532[_0x79c4('0x45')][_0x79c4('0x31')]);_0x23d9ab[_0x79c4('0x30')]=qs[_0x79c4('0x30')](_0x22d532[_0x79c4('0x45')][_0x79c4('0x30')]);}_0x23d9ab[_0x79c4('0x6b')]=qs[_0x79c4('0x4e')](_0x22d532[_0x79c4('0x45')]['sort']);_0x23d9ab['where']=qs['filters'](_[_0x79c4('0x6c')](_0x22d532[_0x79c4('0x45')],_0x58e406['filters']));_0x23d9ab[_0x79c4('0x50')][_0x79c4('0x64')]=_0x5d296b['id'];if(_0x22d532[_0x79c4('0x45')][_0x79c4('0x4f')]){_0x23d9ab[_0x79c4('0x50')]=_[_0x79c4('0x51')](_0x23d9ab[_0x79c4('0x50')],{'$or':_['map'](_0x23d9ab[_0x79c4('0x49')],function(_0x352cab){var _0x572f13={};_0x572f13[_0x352cab]={'$like':'%'+_0x22d532[_0x79c4('0x45')][_0x79c4('0x4f')]+'%'};return _0x572f13;})});}_0x23d9ab=_[_0x79c4('0x51')]({},_0x23d9ab,_0x22d532[_0x79c4('0x53')]);return db['ChatInteraction']['count']({'where':_0x23d9ab[_0x79c4('0x50')]})[_0x79c4('0x21')](function(_0x384db5){_0x818183[_0x79c4('0x54')]=_0x384db5;if(_0x22d532[_0x79c4('0x45')][_0x79c4('0x5a')]){_0x23d9ab[_0x79c4('0x55')]=[{'model':db[_0x79c4('0x8a')],'as':'Contact','required':![]},{'model':db[_0x79c4('0xc3')],'as':'Owner','attributes':['name',_0x79c4('0xe4'),_0x79c4('0xe5')],'required':![]},{'model':db[_0x79c4('0xe6')],'as':_0x79c4('0xe7'),'attributes':['id',_0x79c4('0x3b'),_0x79c4('0xe8')],'where':_0x22d532[_0x79c4('0x45')]['tag']?{'id':_0x22d532[_0x79c4('0x45')][_0x79c4('0xe9')]}:undefined,'required':_0x22d532[_0x79c4('0x45')][_0x79c4('0xe9')]?!![]:![]}];}return db['ChatInteraction']['findAll'](_0x23d9ab);})[_0x79c4('0x21')](function(_0x2c2fd4){_0x818183[_0x79c4('0x57')]=_0x2c2fd4;return _0x818183;});}})[_0x79c4('0x21')](respondWithFilteredResult(_0x5c53bc,_0x23d9ab))[_0x79c4('0x2b')](handleError(_0x5c53bc,null));};function iftimePromise(_0x2d54e2,_0x5d6321){return respondWithRpcPromise('Command',_0x79c4('0xea'),{'command':_0x5d6321[_0x79c4('0xeb')]?util['format'](_0x79c4('0xec'),_0x2d54e2[_0x79c4('0xed')],_0x5d6321[_0x79c4('0xeb')]):util[_0x79c4('0xad')](_0x79c4('0xee'),_0x2d54e2['interval'])},client9002)[_0x79c4('0x21')](function(_0x3935b2){var _0xe4e094=_0x3935b2&&_0x3935b2[_0x79c4('0xef')](_0x79c4('0xf0'))>=0x0?!![]:![];logger[_0x79c4('0x22')](_0x79c4('0xf1'),_0x5d6321['id'],_0x2d54e2['id'],_0x2d54e2[_0x79c4('0xed')],_0xe4e094?_0x79c4('0xf2'):_0x79c4('0xf3'),_0x5d6321['timezone']?_0x5d6321[_0x79c4('0xeb')]:_0x79c4('0xf4'));return _0xe4e094;})['catch'](function(_0x43e4f0){logger['error'](_0x79c4('0xf1'),_0x5d6321['id'],_0x2d54e2['id'],_0x2d54e2[_0x79c4('0xed')],util[_0x79c4('0xf5')](_0x43e4f0,{'showHidden':![],'depth':null}),_0x5d6321[_0x79c4('0xeb')]?_0x5d6321[_0x79c4('0xeb')]:_0x79c4('0xf4'));return![];});}exports['getSnippet']=function(_0x446fa8,_0x13615b,_0x18c056){var _0xf99e41=0x0;var _0x1b2876=0x0;var _0x3b7e3a=![];var _0x1d5d19;var _0x232989;return db['ChatWebsite'][_0x79c4('0x5f')]({'where':{'id':_0x446fa8[_0x79c4('0x59')]['id']},'include':[{'model':db[_0x79c4('0xf6')],'as':'Interval','include':[{'model':db[_0x79c4('0xf6')],'as':_0x79c4('0xf7'),'attributes':['id',_0x79c4('0xed')],'raw':!![]}]}]})[_0x79c4('0x21')](handleEntityNotFound(_0x13615b,null))[_0x79c4('0x21')](function(_0x22cc01){if(_0x22cc01){_0x1d5d19=_0x22cc01;return _0x22cc01['getProactiveActions']({'raw':!![]});}})[_0x79c4('0x21')](function(_0x2487f6){if(_0x1d5d19){if(_0x2487f6){_0x232989=_0x2487f6;}}return require(_0x79c4('0xf8'))[_0x79c4('0x76')]();})['then'](function(_0x1169b4){if(_0x1169b4){_0x1b2876=_0x1169b4[_0x79c4('0xf9')];_0x3b7e3a=_0x1169b4[_0x79c4('0x77')];}})[_0x79c4('0x21')](function(){return db['ChatInteraction'][_0x79c4('0x54')]({'where':{'closed':![]}});})['then'](function(_0x4a814f){_0xf99e41=_0x4a814f;if(_0x1b2876&&_0x4a814f>_0x1b2876){return db[_0x79c4('0xfa')][_0x79c4('0x66')]({'where':{'id':0x1}})[_0x79c4('0x21')](function(_0x6cf4ad){if(_0x6cf4ad){_0x6cf4ad['increment'](_0x79c4('0xfb'));}});}})[_0x79c4('0x21')](function(){if(_0x1d5d19[_0x79c4('0xf6')]&&_0x1d5d19[_0x79c4('0xf6')][_0x79c4('0xf7')]){var _0x39c252=[];for(var _0x4b9533=0x0;_0x4b9533<_0x1d5d19[_0x79c4('0xf6')][_0x79c4('0xf7')][_0x79c4('0x4b')];_0x4b9533++){var _0x575da1=_0x1d5d19['Interval'][_0x79c4('0xf7')][_0x4b9533]['get']({'plain':!![]});_0x39c252[_0x79c4('0xfc')](iftimePromise(_0x575da1,_0x1d5d19));}return BPromise[_0x79c4('0xfd')](_0x39c252)[_0x79c4('0x21')](function(_0x57209a){return _['some'](_0x57209a);});}else{return!![];}})['then'](function(_0x1db7ea){var _0x15270d=fs[_0x79c4('0xcf')](path[_0x79c4('0x73')](config[_0x79c4('0x74')],_0x79c4('0xfe')),_0x79c4('0xd1'));var _0xfbb88={'remote':_0x1d5d19[_0x79c4('0xff')],'query':querystring[_0x79c4('0xb4')](_[_0x79c4('0x51')](_0x1d5d19['get']({'plain':!![]}),{'customerIp':_0x446fa8[_0x79c4('0xa4')][_0x79c4('0xa6')]||_0x446fa8[_0x79c4('0xa4')][_0x79c4('0x100')]||_0x446fa8[_0x79c4('0x101')]['remoteAddress']||_0x446fa8['ip'],'referer':_0x446fa8[_0x79c4('0xa4')][_0x79c4('0xab')],'openedInteractions':_0xf99e41,'maxInteractions':_0x1b2876,'virtual':_0x3b7e3a[_0x79c4('0xf9')],'online':_0x1db7ea,'custom':_0x3b7e3a}))[_0x79c4('0x102')](/'/g,'\x5c\x27')};_0x13615b[_0x79c4('0xcc')](ejs[_0x79c4('0xd2')](Mustache[_0x79c4('0xd2')](_0x15270d,_0xfbb88),{'proactiveActions':_0x232989,'alignment':_0x1d5d19[_0x79c4('0x103')],'verticalAlignment':_0x1d5d19[_0x79c4('0x104')],'div_color':_0x1d5d19['color'],'text_color':_0x1d5d19[_0x79c4('0x105')]}));})[_0x79c4('0x2b')](handleError(_0x13615b,null));};exports[_0x79c4('0x106')]=function(_0x406a08,_0x8c2f47,_0x6aaabb){return db[_0x79c4('0x3f')][_0x79c4('0x66')]({'where':{'id':_0x406a08[_0x79c4('0x59')]['id']}})[_0x79c4('0x21')](handleEntityNotFound(_0x8c2f47,null))[_0x79c4('0x21')](function(_0xf51133){if(_0xf51133){return db[_0x79c4('0x107')][_0x79c4('0x108')](function(_0x4547f2){return db[_0x79c4('0x9a')][_0x79c4('0x36')]({'where':{'ChatWebsiteId':_0x406a08[_0x79c4('0x59')]['id']},'transaction':_0x4547f2})[_0x79c4('0x21')](function(_0x36d635){var _0x3793fe=_['map'](_0x406a08['body'],function(_0x385140){_0x385140[_0x79c4('0x64')]=_0x406a08[_0x79c4('0x59')]['id'];return _0x385140;});return db[_0x79c4('0x9a')]['bulkCreate'](_0x3793fe,{'transaction':_0x4547f2});});})[_0x79c4('0x21')](function(){return db['ChatApplication'][_0x79c4('0x109')]({'where':{'ChatWebsiteId':_0x406a08['params']['id']},'order':_0x79c4('0x10a')});});}})[_0x79c4('0x21')](respondWithResult(_0x8c2f47,null))['catch'](handleError(_0x8c2f47,null));};exports[_0x79c4('0x10b')]=function(_0xd803b6,_0x1558ef,_0x28cca7){var _0x3b07bb={};var _0x325cb5={};var _0xf754e2;var _0x19f81c;return db[_0x79c4('0x3f')][_0x79c4('0x66')]({'where':{'id':_0xd803b6[_0x79c4('0x59')]['id']}})[_0x79c4('0x21')](handleEntityNotFound(_0x1558ef,null))['then'](function(_0x37c04b){if(_0x37c04b){_0xf754e2=_0x37c04b;_0x325cb5[_0x79c4('0x44')]=_[_0x79c4('0x46')](db[_0x79c4('0x9a')][_0x79c4('0x40')]);_0x325cb5[_0x79c4('0x45')]=_[_0x79c4('0x46')](_0xd803b6[_0x79c4('0x45')]);_0x325cb5['filters']=_[_0x79c4('0x48')](_0x325cb5[_0x79c4('0x44')],_0x325cb5[_0x79c4('0x45')]);_0x3b07bb[_0x79c4('0x49')]=_[_0x79c4('0x48')](_0x325cb5[_0x79c4('0x44')],qs[_0x79c4('0x4a')](_0xd803b6[_0x79c4('0x45')][_0x79c4('0x4a')]));_0x3b07bb[_0x79c4('0x49')]=_0x3b07bb[_0x79c4('0x49')][_0x79c4('0x4b')]?_0x3b07bb[_0x79c4('0x49')]:_0x325cb5[_0x79c4('0x44')];_0x3b07bb[_0x79c4('0x6b')]=qs[_0x79c4('0x4e')](_0xd803b6[_0x79c4('0x45')][_0x79c4('0x4e')]);_0x3b07bb[_0x79c4('0x50')]=qs['filters'](_[_0x79c4('0x6c')](_0xd803b6['query'],_0x325cb5[_0x79c4('0x47')]));if(_0xd803b6[_0x79c4('0x45')]['filter']){_0x3b07bb['where']=_[_0x79c4('0x51')](_0x3b07bb[_0x79c4('0x50')],{'$or':_[_0x79c4('0x52')](_0x3b07bb['attributes'],function(_0x37d44f){var _0x3896c5={};_0x3896c5[_0x37d44f]={'$like':'%'+_0xd803b6[_0x79c4('0x45')][_0x79c4('0x4f')]+'%'};return _0x3896c5;})});}_0x3b07bb=_[_0x79c4('0x51')]({},_0x3b07bb,_0xd803b6['options']);return _0xf754e2['getApplications'](_0x3b07bb);}})[_0x79c4('0x21')](function(_0x1f90c7){if(_0x1f90c7){_0x19f81c=_0x1f90c7[_0x79c4('0x4b')];if(!_0xd803b6[_0x79c4('0x45')]['hasOwnProperty'](_0x79c4('0x4d'))){_0x3b07bb['limit']=qs['limit'](_0xd803b6[_0x79c4('0x45')]['limit']);_0x3b07bb['offset']=qs['offset'](_0xd803b6[_0x79c4('0x45')]['offset']);}return _0xf754e2[_0x79c4('0x10b')](_0x3b07bb);}})[_0x79c4('0x21')](function(_0x452686){if(_0x452686){return _0x452686?{'count':_0x19f81c,'rows':_0x452686}:null;}})['then'](respondWithResult(_0x1558ef,null))[_0x79c4('0x2b')](handleError(_0x1558ef,null));};exports[_0x79c4('0x10c')]=function(_0x1d1eeb,_0x51d04c,_0x1a8ab7){return db[_0x79c4('0x10d')][_0x79c4('0x5f')]({'where':{'id':_0x1d1eeb[_0x79c4('0x59')]['id']}})[_0x79c4('0x21')](handleEntityNotFound(_0x51d04c,null))[_0x79c4('0x21')](function(_0x285a01){if(_0x285a01){return _0x285a01[_0x79c4('0x10c')](_0x1d1eeb[_0x79c4('0x5c')][_0x79c4('0x68')],_[_0x79c4('0x10e')](_0x1d1eeb[_0x79c4('0x5c')],[_0x79c4('0x68'),'id'])||{});}})[_0x79c4('0x21')](respondWithResult(_0x51d04c,null))[_0x79c4('0x2b')](handleError(_0x51d04c,null));};exports[_0x79c4('0x10f')]=function(_0xd0a3ef,_0x4519fd,_0x284f91){var _0x209643={};var _0x3d9d49={};var _0x5162a7;var _0x139d02;return db[_0x79c4('0x3f')][_0x79c4('0x66')]({'where':{'id':_0xd0a3ef[_0x79c4('0x59')]['id']}})[_0x79c4('0x21')](handleEntityNotFound(_0x4519fd,null))[_0x79c4('0x21')](function(_0x4ec33b){if(_0x4ec33b){_0x5162a7=_0x4ec33b;_0x3d9d49['model']=_[_0x79c4('0x46')](db[_0x79c4('0x110')][_0x79c4('0x40')]);_0x3d9d49[_0x79c4('0x45')]=_['keys'](_0xd0a3ef[_0x79c4('0x45')]);_0x3d9d49[_0x79c4('0x47')]=_[_0x79c4('0x48')](_0x3d9d49[_0x79c4('0x44')],_0x3d9d49[_0x79c4('0x45')]);_0x209643[_0x79c4('0x49')]=_['intersection'](_0x3d9d49[_0x79c4('0x44')],qs[_0x79c4('0x4a')](_0xd0a3ef[_0x79c4('0x45')][_0x79c4('0x4a')]));_0x209643[_0x79c4('0x49')]=_0x209643['attributes'][_0x79c4('0x4b')]?_0x209643['attributes']:_0x3d9d49[_0x79c4('0x44')];_0x209643[_0x79c4('0x6b')]=qs[_0x79c4('0x4e')](_0xd0a3ef['query'][_0x79c4('0x4e')]);_0x209643[_0x79c4('0x50')]=qs[_0x79c4('0x47')](_[_0x79c4('0x6c')](_0xd0a3ef[_0x79c4('0x45')],_0x3d9d49[_0x79c4('0x47')]));if(_0xd0a3ef[_0x79c4('0x45')][_0x79c4('0x4f')]){_0x209643[_0x79c4('0x50')]=_[_0x79c4('0x51')](_0x209643[_0x79c4('0x50')],{'$or':_['map'](_0x209643[_0x79c4('0x49')],function(_0x55509d){var _0x21e917={};_0x21e917[_0x55509d]={'$like':'%'+_0xd0a3ef[_0x79c4('0x45')][_0x79c4('0x4f')]+'%'};return _0x21e917;})});}_0x209643=_['merge']({},_0x209643,_0xd0a3ef['options']);return _0x5162a7['getProactiveActions'](_0x209643);}})[_0x79c4('0x21')](function(_0x33da11){if(_0x33da11){_0x139d02=_0x33da11[_0x79c4('0x4b')];if(!_0xd0a3ef[_0x79c4('0x45')]['hasOwnProperty']('nolimit')){_0x209643[_0x79c4('0x31')]=qs[_0x79c4('0x31')](_0xd0a3ef['query'][_0x79c4('0x31')]);_0x209643['offset']=qs[_0x79c4('0x30')](_0xd0a3ef[_0x79c4('0x45')][_0x79c4('0x30')]);}return _0x5162a7[_0x79c4('0x10f')](_0x209643);}})['then'](function(_0x3acdc9){if(_0x3acdc9){return _0x3acdc9?{'count':_0x139d02,'rows':_0x3acdc9}:null;}})[_0x79c4('0x21')](respondWithResult(_0x4519fd,null))[_0x79c4('0x2b')](handleError(_0x4519fd,null));};exports[_0x79c4('0x111')]=function(_0x16aeed,_0x382ad2,_0x260c18){var _0x12872b=_0x16aeed[_0x79c4('0x45')][_0x79c4('0x112')]===_0x79c4('0x113')?_0x79c4('0x114'):_0x79c4('0x115');return db[_0x79c4('0x3f')]['find']({'attributes':['id',_0x12872b],'where':{'id':_0x16aeed[_0x79c4('0x59')]['id']}})['then'](handleEntityNotFound(_0x382ad2,null))[_0x79c4('0x21')](function(_0x1bcedc){if(_0x1bcedc){var _0xfac321=_0x1bcedc[_0x12872b];var _0x266827=_0xfac321&&_0xfac321[_0x79c4('0x116')]?_0xfac321['items']:[];_0x382ad2[_0x79c4('0xcc')]({'fromKey':_[_0x79c4('0x78')](_0xfac321['fromKey'])?undefined:_0xfac321['fromKey'],'count':_0x266827[_0x79c4('0x4b')],'rows':_0x266827});}})['catch'](handleError(_0x382ad2,null));};exports[_0x79c4('0x117')]=function(_0x4e3626,_0x1118ea,_0x419750){var _0x30e2db={'raw':![],'where':{}};var _0x2006e7={};var _0x229be7={'count':0x0,'rows':[]};return db[_0x79c4('0x3f')][_0x79c4('0x66')]({'where':{'id':_0x4e3626[_0x79c4('0x59')]['id']}})[_0x79c4('0x21')](handleEntityNotFound(_0x1118ea,null))[_0x79c4('0x21')](function(_0x348eef){if(_0x348eef){_0x2006e7[_0x79c4('0x44')]=_['keys'](db[_0x79c4('0xd5')][_0x79c4('0x40')]);_0x2006e7[_0x79c4('0x45')]=_[_0x79c4('0x46')](_0x4e3626[_0x79c4('0x45')]);_0x2006e7[_0x79c4('0x47')]=_['intersection'](_0x2006e7[_0x79c4('0x44')],_0x2006e7['query']);_0x30e2db[_0x79c4('0x49')]=_[_0x79c4('0x48')](_0x2006e7[_0x79c4('0x44')],qs[_0x79c4('0x4a')](_0x4e3626[_0x79c4('0x45')][_0x79c4('0x4a')]));_0x30e2db[_0x79c4('0x49')]=_0x30e2db[_0x79c4('0x49')][_0x79c4('0x4b')]?_0x30e2db[_0x79c4('0x49')]:_0x2006e7[_0x79c4('0x44')];if(!_0x4e3626[_0x79c4('0x45')]['hasOwnProperty'](_0x79c4('0x4d'))){_0x30e2db[_0x79c4('0x31')]=qs[_0x79c4('0x31')](_0x4e3626['query'][_0x79c4('0x31')]);_0x30e2db['offset']=qs[_0x79c4('0x30')](_0x4e3626[_0x79c4('0x45')][_0x79c4('0x30')]);}_0x30e2db[_0x79c4('0x6b')]=qs[_0x79c4('0x4e')](_0x4e3626[_0x79c4('0x45')][_0x79c4('0x4e')]);_0x30e2db['where']=qs[_0x79c4('0x47')](_['pick'](_0x4e3626[_0x79c4('0x45')],_0x2006e7[_0x79c4('0x47')]));_0x30e2db['where'][_0x79c4('0x64')]=_0x348eef['id'];if(_0x4e3626[_0x79c4('0x45')][_0x79c4('0x4f')]){_0x30e2db[_0x79c4('0x50')]=_[_0x79c4('0x51')](_0x30e2db['where'],{'$or':_[_0x79c4('0x52')](_0x30e2db[_0x79c4('0x49')],function(_0x533b31){var _0x9e38f7={};_0x9e38f7[_0x533b31]={'$like':'%'+_0x4e3626['query'][_0x79c4('0x4f')]+'%'};return _0x9e38f7;})});}_0x30e2db=_['merge']({},_0x30e2db,_0x4e3626[_0x79c4('0x53')]);return db[_0x79c4('0xd5')]['count']({'where':_0x30e2db['where']})[_0x79c4('0x21')](function(_0x320af5){_0x229be7[_0x79c4('0x54')]=_0x320af5;if(_0x4e3626[_0x79c4('0x45')][_0x79c4('0x5a')]){_0x30e2db[_0x79c4('0x55')]=[{'all':!![]}];}else{_0x30e2db['include']=[{'model':db['CmContact'],'as':_0x79c4('0x118'),'required':![]}];}return db[_0x79c4('0xd5')]['findAll'](_0x30e2db);})['then'](function(_0x4364e1){_0x229be7[_0x79c4('0x57')]=_0x4364e1;return _0x229be7;});}})[_0x79c4('0x21')](respondWithFilteredResult(_0x1118ea,_0x30e2db))[_0x79c4('0x2b')](handleError(_0x1118ea,null));};exports[_0x79c4('0x119')]=function(_0x329ad3,_0x3130fd,_0x37561a){return db['ChatWebsite'][_0x79c4('0x5f')]({'where':{'id':_0x329ad3[_0x79c4('0x59')]['id']}})[_0x79c4('0x21')](handleEntityNotFound(_0x3130fd,null))[_0x79c4('0x21')](function(_0x152108){if(_0x152108){return _0x152108['addAgents'](_0x329ad3[_0x79c4('0x5c')][_0x79c4('0x68')],_[_0x79c4('0x10e')](_0x329ad3[_0x79c4('0x5c')],['ids','id'])||{})[_0x79c4('0xba')](function(_0x389006){for(var _0x22e079=0x0;_0x22e079<_0x329ad3[_0x79c4('0x5c')][_0x79c4('0x68')][_0x79c4('0x4b')];_0x22e079+=0x1){socket[_0x79c4('0x11a')](_0x79c4('0x11b'),{'UserId':_0x329ad3[_0x79c4('0x5c')][_0x79c4('0x68')][_0x22e079],'ChatWebsiteId':_0x329ad3['params']['id']});}return _0x389006;});}})[_0x79c4('0x21')](respondWithResult(_0x3130fd,null))[_0x79c4('0x2b')](handleError(_0x3130fd,null));};exports[_0x79c4('0x11c')]=function(_0x3820e5,_0x2845e4,_0x2baef0){return db[_0x79c4('0x3f')][_0x79c4('0x5f')]({'where':{'id':_0x3820e5[_0x79c4('0x59')]['id']}})[_0x79c4('0x21')](handleEntityNotFound(_0x2845e4,null))['then'](function(_0x5a2d31){if(_0x5a2d31){return _0x5a2d31[_0x79c4('0x11c')](_0x3820e5['query']['ids'])[_0x79c4('0x21')](function(){if(_['isArray'](_0x3820e5[_0x79c4('0x45')][_0x79c4('0x68')])){for(var _0x141228=0x0;_0x141228<_0x3820e5[_0x79c4('0x45')][_0x79c4('0x68')][_0x79c4('0x4b')];_0x141228+=0x1){socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x3820e5[_0x79c4('0x45')][_0x79c4('0x68')][_0x141228]),'ChatWebsiteId':Number(_0x3820e5[_0x79c4('0x59')]['id'])});}}else{socket[_0x79c4('0x11a')](_0x79c4('0x11d'),{'UserId':Number(_0x3820e5['query'][_0x79c4('0x68')]),'ChatWebsiteId':Number(_0x3820e5[_0x79c4('0x59')]['id'])});}});}})[_0x79c4('0x21')](respondWithStatusCode(_0x2845e4,null))['catch'](handleError(_0x2845e4,null));};exports[_0x79c4('0x11e')]=function(_0x2d210f,_0x228353,_0x383e71){var _0x4d3cfa={};var _0xcbe048={};var _0x32f5b0;var _0x524126;return db[_0x79c4('0x3f')][_0x79c4('0x66')]({'where':{'id':_0x2d210f[_0x79c4('0x59')]['id']}})[_0x79c4('0x21')](handleEntityNotFound(_0x228353,null))['then'](function(_0xfdbace){if(_0xfdbace){_0x32f5b0=_0xfdbace;_0xcbe048['model']=_[_0x79c4('0x46')](db[_0x79c4('0xc3')]['rawAttributes']);_0xcbe048[_0x79c4('0x45')]=_['keys'](_0x2d210f[_0x79c4('0x45')]);_0xcbe048[_0x79c4('0x47')]=_['intersection'](_0xcbe048[_0x79c4('0x44')],_0xcbe048[_0x79c4('0x45')]);_0x4d3cfa['attributes']=_[_0x79c4('0x48')](_0xcbe048[_0x79c4('0x44')],qs['fields'](_0x2d210f[_0x79c4('0x45')][_0x79c4('0x4a')]));_0x4d3cfa[_0x79c4('0x49')]=_0x4d3cfa['attributes'][_0x79c4('0x4b')]?_0x4d3cfa['attributes']:_0xcbe048['model'];_0x4d3cfa[_0x79c4('0x6b')]=qs[_0x79c4('0x4e')](_0x2d210f[_0x79c4('0x45')]['sort']);_0x4d3cfa['where']=qs[_0x79c4('0x47')](_[_0x79c4('0x6c')](_0x2d210f['query'],_0xcbe048[_0x79c4('0x47')]));if(_0x2d210f[_0x79c4('0x45')][_0x79c4('0x4f')]){_0x4d3cfa[_0x79c4('0x50')]=_[_0x79c4('0x51')](_0x4d3cfa[_0x79c4('0x50')],{'$or':_['map'](_0x4d3cfa[_0x79c4('0x49')],function(_0x12d4d4){var _0x2b53ab={};_0x2b53ab[_0x12d4d4]={'$like':'%'+_0x2d210f['query'][_0x79c4('0x4f')]+'%'};return _0x2b53ab;})});}_0x4d3cfa=_[_0x79c4('0x51')]({},_0x4d3cfa,_0x2d210f[_0x79c4('0x53')]);return _0x32f5b0[_0x79c4('0x11e')](_0x4d3cfa);}})['then'](function(_0xc0e3a4){if(_0xc0e3a4){_0x524126=_0xc0e3a4[_0x79c4('0x4b')];if(!_0x2d210f[_0x79c4('0x45')]['hasOwnProperty']('nolimit')){_0x4d3cfa['limit']=qs[_0x79c4('0x31')](_0x2d210f[_0x79c4('0x45')][_0x79c4('0x31')]);_0x4d3cfa['offset']=qs['offset'](_0x2d210f[_0x79c4('0x45')][_0x79c4('0x30')]);}return _0x32f5b0[_0x79c4('0x11e')](_0x4d3cfa);}})[_0x79c4('0x21')](function(_0x27638b){if(_0x27638b){return _0x27638b?{'count':_0x524126,'rows':_0x27638b}:null;}})[_0x79c4('0x21')](respondWithResult(_0x228353,null))[_0x79c4('0x2b')](handleError(_0x228353,null));}; \ No newline at end of file +var _0xf6b1=['update','destroy','get','ChatWebsites','UserProfileResource','name','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','rows','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','findOne','ChatWebsiteId','Disposition','includeAll','findAll','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','nolimit','removeAnswers','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','addSystemAvatar','systemAvatar','getLogo','root','server/files/images/logos/default_logo.png','../../config/license/util','getLicense','isNil','existsSync','join','server/files/images/logos/','server/files/images/avatars/','download','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','headers','user-agent','getResult','chat','CmContact','Sequelize','no\x20available\x20attributes','createdAt','difference','updatedAt','ListId','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','Contacts','DESC','ChatApplication','Applications','applications','orderBy','priority','asc','account','customerIp','cf-connecting-ip','x-forwarded-for','firstName','lastName','x-real-port','referer','browser','version','unknown','format','%s\x20%s','device','vendor','%s\x20%s\x20%s','stringify','threadId','externalUrl','ChatInteraction','ContactId','interaction','spread','contact','messageId','created','close','unmanaged','ChatMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','startRouting','Start','EventManager','CompanyId','send','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','readFileSync','toPairs','offlineMessageBody','MailAccount','MailServerOut','forwardOfflineAddress','Smtp','service','host','port','secure','authentication','auth','SendMail','sendMail','email','offlineMessageSubject','addInteraction','omit','getInteractions','pick','include','Contact','User','Owner','fullname','internal','Tag','tag','Command','getSnippet','iftime\x20%s,%s','interval','timezone','iftime\x20%s','indexOf','true','ONLINE','OFFLINE','inspect','Interval','getProactiveActions','virtual','custom','License','increment','chatLicenseExceeded','Intervals','push','all','some','server/files/chat/iframe.js','utf8','remote','connection','remoteAddress','replace','render','alignment','verticalAlignment','color','textColor','addApplications','sequelize','transaction','bulkCreate','getApplications','addProactiveActions','ChatProactiveAction','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','addAgents','emit','userChatWebsite:save','removeAgents','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0xf6b1,0xee));var _0x1f6b=function(_0x31be85,_0x142500){_0x31be85=_0x31be85-0x0;var _0x3c895d=_0xf6b1[_0x31be85];return _0x3c895d;};'use strict';var pdf=require(_0x1f6b('0x0'));var emlformat=require(_0x1f6b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1f6b('0x2'));var jsonpatch=require(_0x1f6b('0x3'));var rp=require('request-promise');var moment=require(_0x1f6b('0x4'));var BPromise=require(_0x1f6b('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1f6b('0x6'));var sox=require(_0x1f6b('0x7'));var csv=require(_0x1f6b('0x8'));var ejs=require(_0x1f6b('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x1f6b('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x1f6b('0xb'));var toCsv=require(_0x1f6b('0x8'));var querystring=require(_0x1f6b('0xc'));var Papa=require('papaparse');var Redis=require(_0x1f6b('0xd'));var authService=require(_0x1f6b('0xe'));var qs=require(_0x1f6b('0xf'));var as=require(_0x1f6b('0x10'));var hardwareService=require(_0x1f6b('0x11'));var logger=require('../../config/logger')(_0x1f6b('0x12'));var utils=require(_0x1f6b('0x13'));var config=require(_0x1f6b('0x14'));var db=require(_0x1f6b('0x15'))['db'];config[_0x1f6b('0x16')]=_[_0x1f6b('0x17')](config['redis'],{'host':_0x1f6b('0x18'),'port':0x18eb});var socket=require(_0x1f6b('0x19'))(new Redis(config[_0x1f6b('0x16')]));require(_0x1f6b('0x1a'))['register'](socket);var jayson=require(_0x1f6b('0x1b'));var client=jayson[_0x1f6b('0x1c')][_0x1f6b('0x1d')]({'port':0x232c});var client9002=jayson[_0x1f6b('0x1c')]['http']({'port':0x232a});var client9003=jayson[_0x1f6b('0x1c')]['http']({'port':0x232b});function checkPasswordPattern(_0xe78e13,_0xfb97a4,_0x2bfdb7){if(_0x2bfdb7){var _0x20494a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x20494a[_0x1f6b('0x1e')](_0xfb97a4)){return _0xe78e13;}else{throw new db['Sequelize'][(_0x1f6b('0x1f'))](_0x1f6b('0x20'));}}else{return _0xe78e13;}}function respondWithRpcPromise(_0x2471b2,_0x2dc287,_0x1c3032,_0x4fc242){return new BPromise(function(_0x3dc801,_0x364f04){var _0x1743df=_0x4fc242||client;return _0x1743df[_0x1f6b('0x21')](_0x2471b2,_0x1c3032)[_0x1f6b('0x22')](function(_0xde866a){logger['info'](_0x1f6b('0x23'),_0x2dc287,_0x1f6b('0x24'));logger[_0x1f6b('0x25')](_0x1f6b('0x26'),_0x2dc287,_0x1f6b('0x24'),JSON['stringify'](_0xde866a));if(_0xde866a[_0x1f6b('0x27')]){if(_0xde866a[_0x1f6b('0x27')][_0x1f6b('0x28')]===0x1f4){logger['error'](_0x1f6b('0x23'),_0x2dc287,_0xde866a[_0x1f6b('0x27')]['message']);return _0x364f04(_0xde866a[_0x1f6b('0x27')][_0x1f6b('0x29')]);}logger['error'](_0x1f6b('0x23'),_0x2dc287,_0xde866a[_0x1f6b('0x27')]['message']);return _0x3dc801(_0xde866a[_0x1f6b('0x27')]['message']);}else{logger[_0x1f6b('0x2a')](_0x1f6b('0x23'),_0x2dc287,'request\x20sent');_0x3dc801(_0xde866a[_0x1f6b('0x2b')][_0x1f6b('0x29')]);}})[_0x1f6b('0x2c')](function(_0x17452d){logger[_0x1f6b('0x27')](_0x1f6b('0x23'),_0x2dc287,_0x17452d);_0x364f04(_0x17452d);});});}function respondWithStatusCode(_0x3cddd6,_0x4260df){_0x4260df=_0x4260df||0xcc;return function(_0x194530){if(_0x194530){return _0x3cddd6[_0x1f6b('0x2d')](_0x4260df);}return _0x3cddd6[_0x1f6b('0x2e')](_0x4260df)[_0x1f6b('0x2f')]();};}function respondWithResult(_0x5191f2,_0x9fa958){_0x9fa958=_0x9fa958||0xc8;return function(_0x53341c){if(_0x53341c){return _0x5191f2[_0x1f6b('0x2e')](_0x9fa958)[_0x1f6b('0x30')](_0x53341c);}};}function respondWithFilteredResult(_0x512d7f,_0x18d767){return function(_0x1bc554){if(_0x1bc554){var _0x48678a=_0x1bc554[_0x1f6b('0x31')],_0x209583=_0x18d767[_0x1f6b('0x32')],_0x659816=_0x18d767[_0x1f6b('0x32')]+_0x18d767[_0x1f6b('0x33')],_0x459735;if(_0x659816>=_0x48678a){_0x659816=_0x48678a;_0x459735=0xc8;}else{_0x459735=0xce;}_0x512d7f['status'](_0x459735);return _0x512d7f[_0x1f6b('0x34')](_0x1f6b('0x35'),_0x209583+'-'+_0x659816+'/'+_0x48678a)[_0x1f6b('0x30')](_0x1bc554);}return null;};}function patchUpdates(_0x1fec6e){return function(_0x132d42){try{jsonpatch['apply'](_0x132d42,_0x1fec6e,!![]);}catch(_0x4f258a){return BPromise[_0x1f6b('0x36')](_0x4f258a);}return _0x132d42[_0x1f6b('0x37')]();};}function saveUpdates(_0x6ef140,_0x2d8623){return function(_0x247cad){if(_0x247cad){return _0x247cad[_0x1f6b('0x38')](_0x6ef140)[_0x1f6b('0x22')](function(_0x3b235b){return _0x3b235b;});}return null;};}function removeEntity(_0x17166f,_0x5554d5){return function(_0x31d190){if(_0x31d190){return _0x31d190[_0x1f6b('0x39')]()[_0x1f6b('0x22')](function(){var _0x203b59=_0x31d190[_0x1f6b('0x3a')]({'plain':!![]});var _0x222cb7=_0x1f6b('0x3b');return db[_0x1f6b('0x3c')][_0x1f6b('0x39')]({'where':{'type':_0x222cb7,'resourceId':_0x203b59['id']}})['then'](function(){return _0x31d190;});})['then'](function(){_0x17166f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4938b4,_0x12c624){return function(_0xc8f7e8){if(!_0xc8f7e8){_0x4938b4[_0x1f6b('0x2d')](0x194);}return _0xc8f7e8;};}function handleError(_0xf07801,_0x9b4516){_0x9b4516=_0x9b4516||0x1f4;return function(_0x53a673){logger[_0x1f6b('0x27')](_0x53a673['stack']);if(_0x53a673[_0x1f6b('0x3d')]){delete _0x53a673[_0x1f6b('0x3d')];}_0xf07801[_0x1f6b('0x2e')](_0x9b4516)['send'](_0x53a673);};}exports[_0x1f6b('0x3e')]=function(_0x4b22f4,_0x323f44){var _0x41612a={'include':[{'model':db[_0x1f6b('0x3f')],'as':_0x1f6b('0x40')}]},_0x728db9={},_0x3252c6={'count':0x0,'rows':[]};var _0x773201=_[_0x1f6b('0x41')](db[_0x1f6b('0x42')][_0x1f6b('0x43')],function(_0x2320b0){return{'name':_0x2320b0[_0x1f6b('0x44')],'type':_0x2320b0[_0x1f6b('0x45')][_0x1f6b('0x46')]};});_0x728db9[_0x1f6b('0x47')]=_['map'](_0x773201,'name');_0x728db9['query']=_[_0x1f6b('0x48')](_0x4b22f4[_0x1f6b('0x49')]);_0x728db9[_0x1f6b('0x4a')]=_[_0x1f6b('0x4b')](_0x728db9[_0x1f6b('0x47')],_0x728db9[_0x1f6b('0x49')]);_0x41612a[_0x1f6b('0x4c')]=_[_0x1f6b('0x4b')](_0x728db9[_0x1f6b('0x47')],qs[_0x1f6b('0x4d')](_0x4b22f4[_0x1f6b('0x49')][_0x1f6b('0x4d')]));_0x41612a[_0x1f6b('0x4c')]=_0x41612a[_0x1f6b('0x4c')]['length']?_0x41612a['attributes']:_0x728db9[_0x1f6b('0x47')];if(!_0x4b22f4[_0x1f6b('0x49')][_0x1f6b('0x4e')]('nolimit')){_0x41612a[_0x1f6b('0x33')]=qs[_0x1f6b('0x33')](_0x4b22f4[_0x1f6b('0x49')][_0x1f6b('0x33')]);_0x41612a[_0x1f6b('0x32')]=qs[_0x1f6b('0x32')](_0x4b22f4[_0x1f6b('0x49')][_0x1f6b('0x32')]);}_0x41612a[_0x1f6b('0x4f')]=qs['sort'](_0x4b22f4['query'][_0x1f6b('0x50')]);_0x41612a[_0x1f6b('0x51')]=qs[_0x1f6b('0x4a')](_['pick'](_0x4b22f4[_0x1f6b('0x49')],_0x728db9[_0x1f6b('0x4a')]),_0x773201);if(_0x4b22f4[_0x1f6b('0x49')][_0x1f6b('0x52')]){_0x41612a[_0x1f6b('0x51')]=_[_0x1f6b('0x53')](_0x41612a[_0x1f6b('0x51')],{'$or':_[_0x1f6b('0x41')](_0x773201,function(_0xa00ea9){if(_0xa00ea9[_0x1f6b('0x45')]!==_0x1f6b('0x54')){var _0x1786cf={};_0x1786cf[_0xa00ea9[_0x1f6b('0x3d')]]={'$like':'%'+_0x4b22f4['query']['filter']+'%'};return _0x1786cf;}})});}_0x41612a=_['merge']({},_0x41612a,_0x4b22f4[_0x1f6b('0x55')]);var _0x76b94e={'where':_0x41612a[_0x1f6b('0x51')]};return db['ChatWebsite'][_0x1f6b('0x31')](_0x76b94e)[_0x1f6b('0x22')](function(_0x5c0382){_0x3252c6[_0x1f6b('0x31')]=_0x5c0382;if(_0x4b22f4[_0x1f6b('0x49')]['includeAll']){_0x41612a['include']=[{'all':!![]}];}return db[_0x1f6b('0x42')]['findAll'](_0x41612a);})['then'](function(_0x1e146d){_0x3252c6[_0x1f6b('0x56')]=_0x1e146d;return _0x3252c6;})[_0x1f6b('0x22')](respondWithFilteredResult(_0x323f44,_0x41612a))[_0x1f6b('0x2c')](handleError(_0x323f44,null));};exports[_0x1f6b('0x57')]=function(_0x5ea5a0,_0x43f88d){var _0x3dec2c={'raw':![],'where':{'id':_0x5ea5a0[_0x1f6b('0x58')]['id']},'include':[{'model':db[_0x1f6b('0x3f')],'as':_0x1f6b('0x40')}]},_0x394473={};_0x394473[_0x1f6b('0x47')]=_[_0x1f6b('0x48')](db[_0x1f6b('0x42')][_0x1f6b('0x43')]);_0x394473[_0x1f6b('0x49')]=_[_0x1f6b('0x48')](_0x5ea5a0[_0x1f6b('0x49')]);_0x394473[_0x1f6b('0x4a')]=_[_0x1f6b('0x4b')](_0x394473['model'],_0x394473[_0x1f6b('0x49')]);_0x3dec2c['attributes']=_[_0x1f6b('0x4b')](_0x394473['model'],qs[_0x1f6b('0x4d')](_0x5ea5a0[_0x1f6b('0x49')][_0x1f6b('0x4d')]));_0x3dec2c[_0x1f6b('0x4c')]=_0x3dec2c[_0x1f6b('0x4c')][_0x1f6b('0x59')]?_0x3dec2c[_0x1f6b('0x4c')]:_0x394473[_0x1f6b('0x47')];if(_0x5ea5a0[_0x1f6b('0x49')]['includeAll']){_0x3dec2c['include']=[{'all':!![]}];}_0x3dec2c=_[_0x1f6b('0x53')]({},_0x3dec2c,_0x5ea5a0[_0x1f6b('0x55')]);return db['ChatWebsite'][_0x1f6b('0x5a')](_0x3dec2c)[_0x1f6b('0x22')](handleEntityNotFound(_0x43f88d,null))[_0x1f6b('0x22')](respondWithResult(_0x43f88d,null))['catch'](handleError(_0x43f88d,null));};exports[_0x1f6b('0x5b')]=function(_0x41f806,_0x58182a){return db[_0x1f6b('0x42')][_0x1f6b('0x5b')](_0x41f806[_0x1f6b('0x5c')],{})[_0x1f6b('0x22')](function(_0x3f7a25){var _0x440ee5=_0x41f806[_0x1f6b('0x5d')]['get']({'plain':!![]});if(!_0x440ee5)throw new Error(_0x1f6b('0x5e'));if(_0x440ee5[_0x1f6b('0x5f')]===_0x1f6b('0x5d')){var _0x4a7a7c=_0x3f7a25[_0x1f6b('0x3a')]({'plain':!![]});var _0x2d75ed=_0x1f6b('0x3b');return db[_0x1f6b('0x60')][_0x1f6b('0x5a')]({'where':{'name':_0x2d75ed,'userProfileId':_0x440ee5[_0x1f6b('0x61')]},'raw':!![]})[_0x1f6b('0x22')](function(_0x5e97ba){if(_0x5e97ba&&_0x5e97ba[_0x1f6b('0x62')]===0x0){return db[_0x1f6b('0x3c')][_0x1f6b('0x5b')]({'name':_0x4a7a7c[_0x1f6b('0x3d')],'resourceId':_0x4a7a7c['id'],'type':_0x5e97ba[_0x1f6b('0x3d')],'sectionId':_0x5e97ba['id']},{})['then'](function(){return _0x3f7a25;});}else{return _0x3f7a25;}})[_0x1f6b('0x2c')](function(_0x55ed50){logger[_0x1f6b('0x27')](_0x1f6b('0x63'),_0x55ed50);throw _0x55ed50;});}return _0x3f7a25;})[_0x1f6b('0x22')](respondWithResult(_0x58182a,0xc9))[_0x1f6b('0x2c')](handleError(_0x58182a,null));};exports[_0x1f6b('0x38')]=function(_0x3b4e3f,_0x3e610c){if(_0x3b4e3f['body']['id']){delete _0x3b4e3f[_0x1f6b('0x5c')]['id'];}return db[_0x1f6b('0x42')][_0x1f6b('0x5a')]({'where':{'id':_0x3b4e3f[_0x1f6b('0x58')]['id']},'include':[{'model':db[_0x1f6b('0x3f')],'as':'mandatoryDispositionPause'}]})[_0x1f6b('0x22')](handleEntityNotFound(_0x3e610c,null))[_0x1f6b('0x22')](saveUpdates(_0x3b4e3f[_0x1f6b('0x5c')],null))[_0x1f6b('0x22')](respondWithResult(_0x3e610c,null))[_0x1f6b('0x2c')](handleError(_0x3e610c,null));};exports[_0x1f6b('0x39')]=function(_0x27079c,_0x43a6a8){return db[_0x1f6b('0x42')][_0x1f6b('0x5a')]({'where':{'id':_0x27079c[_0x1f6b('0x58')]['id']}})[_0x1f6b('0x22')](handleEntityNotFound(_0x43a6a8,null))[_0x1f6b('0x22')](removeEntity(_0x43a6a8,null))[_0x1f6b('0x2c')](handleError(_0x43a6a8,null));};exports[_0x1f6b('0x64')]=function(_0x4b1846,_0x5894af){return db[_0x1f6b('0x42')]['describe']()[_0x1f6b('0x22')](respondWithResult(_0x5894af,null))['catch'](handleError(_0x5894af,null));};exports[_0x1f6b('0x65')]=function(_0x31a577,_0x401a58,_0x5d2ed5){if(_0x31a577['body']['id']){delete _0x31a577[_0x1f6b('0x5c')]['id'];}return db['ChatWebsite'][_0x1f6b('0x5a')]({'where':{'id':_0x31a577[_0x1f6b('0x58')]['id']}})[_0x1f6b('0x22')](handleEntityNotFound(_0x401a58,null))[_0x1f6b('0x22')](function(_0x4b9ab9){if(_0x4b9ab9){_0x31a577[_0x1f6b('0x5c')]['ChatWebsiteId']=_0x4b9ab9['id'];return db['Disposition'][_0x1f6b('0x5b')](_0x31a577[_0x1f6b('0x5c')]);}})['then'](respondWithResult(_0x401a58,null))[_0x1f6b('0x2c')](handleError(_0x401a58,null));};exports['getDispositions']=function(_0x56c4a8,_0x22af74,_0x484b8b){var _0x181ef1={'raw':![],'where':{}};var _0x4cd0fa={};var _0x4bd419={'count':0x0,'rows':[]};return db[_0x1f6b('0x42')][_0x1f6b('0x66')]({'where':{'id':_0x56c4a8[_0x1f6b('0x58')]['id']}})[_0x1f6b('0x22')](handleEntityNotFound(_0x22af74,null))[_0x1f6b('0x22')](function(_0x51cc86){if(_0x51cc86){_0x4cd0fa[_0x1f6b('0x47')]=_[_0x1f6b('0x48')](db['Disposition'][_0x1f6b('0x43')]);_0x4cd0fa[_0x1f6b('0x49')]=_[_0x1f6b('0x48')](_0x56c4a8[_0x1f6b('0x49')]);_0x4cd0fa[_0x1f6b('0x4a')]=_[_0x1f6b('0x4b')](_0x4cd0fa[_0x1f6b('0x47')],_0x4cd0fa['query']);_0x181ef1[_0x1f6b('0x4c')]=_[_0x1f6b('0x4b')](_0x4cd0fa[_0x1f6b('0x47')],qs[_0x1f6b('0x4d')](_0x56c4a8[_0x1f6b('0x49')]['fields']));_0x181ef1[_0x1f6b('0x4c')]=_0x181ef1[_0x1f6b('0x4c')][_0x1f6b('0x59')]?_0x181ef1[_0x1f6b('0x4c')]:_0x4cd0fa[_0x1f6b('0x47')];if(!_0x56c4a8[_0x1f6b('0x49')]['hasOwnProperty']('nolimit')){_0x181ef1[_0x1f6b('0x33')]=qs[_0x1f6b('0x33')](_0x56c4a8[_0x1f6b('0x49')][_0x1f6b('0x33')]);_0x181ef1['offset']=qs[_0x1f6b('0x32')](_0x56c4a8[_0x1f6b('0x49')][_0x1f6b('0x32')]);}_0x181ef1['order']=qs[_0x1f6b('0x50')](_0x56c4a8[_0x1f6b('0x49')][_0x1f6b('0x50')]);_0x181ef1['where']=qs['filters'](_['pick'](_0x56c4a8[_0x1f6b('0x49')],_0x4cd0fa[_0x1f6b('0x4a')]));_0x181ef1[_0x1f6b('0x51')][_0x1f6b('0x67')]=_0x51cc86['id'];if(_0x56c4a8[_0x1f6b('0x49')][_0x1f6b('0x52')]){_0x181ef1[_0x1f6b('0x51')]=_['merge'](_0x181ef1[_0x1f6b('0x51')],{'$or':_[_0x1f6b('0x41')](_0x181ef1[_0x1f6b('0x4c')],function(_0x2eacf4){var _0x31696f={};_0x31696f[_0x2eacf4]={'$like':'%'+_0x56c4a8[_0x1f6b('0x49')]['filter']+'%'};return _0x31696f;})});}_0x181ef1=_[_0x1f6b('0x53')]({},_0x181ef1,_0x56c4a8[_0x1f6b('0x55')]);return db[_0x1f6b('0x68')]['count']({'where':_0x181ef1[_0x1f6b('0x51')]})['then'](function(_0x5161b1){_0x4bd419['count']=_0x5161b1;if(_0x56c4a8['query'][_0x1f6b('0x69')]){_0x181ef1['include']=[{'all':!![]}];}return db[_0x1f6b('0x68')][_0x1f6b('0x6a')](_0x181ef1);})['then'](function(_0x53d717){_0x4bd419[_0x1f6b('0x56')]=_0x53d717;return _0x4bd419;});}})[_0x1f6b('0x22')](respondWithFilteredResult(_0x22af74,_0x181ef1))[_0x1f6b('0x2c')](handleError(_0x22af74,null));};exports[_0x1f6b('0x6b')]=function(_0x4288cf,_0x1903bb,_0x10657c){return db[_0x1f6b('0x42')][_0x1f6b('0x5a')]({'where':{'id':_0x4288cf[_0x1f6b('0x58')]['id']}})[_0x1f6b('0x22')](handleEntityNotFound(_0x1903bb,null))[_0x1f6b('0x22')](function(_0x3d93f6){if(_0x3d93f6){return _0x3d93f6[_0x1f6b('0x6b')](_0x4288cf[_0x1f6b('0x49')][_0x1f6b('0x6c')]);}})[_0x1f6b('0x22')](respondWithStatusCode(_0x1903bb,null))[_0x1f6b('0x2c')](handleError(_0x1903bb,null));};exports[_0x1f6b('0x6d')]=function(_0x4ad15c,_0x13e9c9,_0xa0f2b6){if(_0x4ad15c['body']['id']){delete _0x4ad15c[_0x1f6b('0x5c')]['id'];}return db[_0x1f6b('0x42')][_0x1f6b('0x5a')]({'where':{'id':_0x4ad15c[_0x1f6b('0x58')]['id']}})[_0x1f6b('0x22')](handleEntityNotFound(_0x13e9c9,null))[_0x1f6b('0x22')](function(_0x3c55ef){if(_0x3c55ef){_0x4ad15c[_0x1f6b('0x5c')][_0x1f6b('0x67')]=_0x3c55ef['id'];return db['CannedAnswer'][_0x1f6b('0x5b')](_0x4ad15c[_0x1f6b('0x5c')]);}})[_0x1f6b('0x22')](respondWithResult(_0x13e9c9,null))[_0x1f6b('0x2c')](handleError(_0x13e9c9,null));};exports[_0x1f6b('0x6e')]=function(_0x24c883,_0x586ea1,_0x23a831){var _0xfb4def={'raw':![],'where':{}};var _0x81631b={};var _0x128996={'count':0x0,'rows':[]};return db[_0x1f6b('0x42')]['findOne']({'where':{'id':_0x24c883[_0x1f6b('0x58')]['id']}})['then'](handleEntityNotFound(_0x586ea1,null))[_0x1f6b('0x22')](function(_0x50d605){if(_0x50d605){_0x81631b['model']=_[_0x1f6b('0x48')](db[_0x1f6b('0x6f')]['rawAttributes']);_0x81631b[_0x1f6b('0x49')]=_[_0x1f6b('0x48')](_0x24c883[_0x1f6b('0x49')]);_0x81631b[_0x1f6b('0x4a')]=_[_0x1f6b('0x4b')](_0x81631b[_0x1f6b('0x47')],_0x81631b[_0x1f6b('0x49')]);_0xfb4def[_0x1f6b('0x4c')]=_['intersection'](_0x81631b[_0x1f6b('0x47')],qs[_0x1f6b('0x4d')](_0x24c883[_0x1f6b('0x49')][_0x1f6b('0x4d')]));_0xfb4def[_0x1f6b('0x4c')]=_0xfb4def['attributes'][_0x1f6b('0x59')]?_0xfb4def['attributes']:_0x81631b[_0x1f6b('0x47')];if(!_0x24c883[_0x1f6b('0x49')][_0x1f6b('0x4e')](_0x1f6b('0x70'))){_0xfb4def[_0x1f6b('0x33')]=qs[_0x1f6b('0x33')](_0x24c883[_0x1f6b('0x49')]['limit']);_0xfb4def[_0x1f6b('0x32')]=qs[_0x1f6b('0x32')](_0x24c883['query'][_0x1f6b('0x32')]);}_0xfb4def['order']=qs['sort'](_0x24c883['query'][_0x1f6b('0x50')]);_0xfb4def[_0x1f6b('0x51')]=qs[_0x1f6b('0x4a')](_['pick'](_0x24c883[_0x1f6b('0x49')],_0x81631b[_0x1f6b('0x4a')]));_0xfb4def['where']['ChatWebsiteId']=_0x50d605['id'];if(_0x24c883[_0x1f6b('0x49')][_0x1f6b('0x52')]){_0xfb4def[_0x1f6b('0x51')]=_[_0x1f6b('0x53')](_0xfb4def[_0x1f6b('0x51')],{'$or':_[_0x1f6b('0x41')](_0xfb4def[_0x1f6b('0x4c')],function(_0x40f343){var _0x44ff2d={};_0x44ff2d[_0x40f343]={'$like':'%'+_0x24c883[_0x1f6b('0x49')]['filter']+'%'};return _0x44ff2d;})});}_0xfb4def=_[_0x1f6b('0x53')]({},_0xfb4def,_0x24c883[_0x1f6b('0x55')]);return db[_0x1f6b('0x6f')][_0x1f6b('0x31')]({'where':_0xfb4def[_0x1f6b('0x51')]})[_0x1f6b('0x22')](function(_0x556588){_0x128996[_0x1f6b('0x31')]=_0x556588;if(_0x24c883[_0x1f6b('0x49')]['includeAll']){_0xfb4def['include']=[{'all':!![]}];}return db[_0x1f6b('0x6f')][_0x1f6b('0x6a')](_0xfb4def);})[_0x1f6b('0x22')](function(_0x51aad4){_0x128996[_0x1f6b('0x56')]=_0x51aad4;return _0x128996;});}})[_0x1f6b('0x22')](respondWithFilteredResult(_0x586ea1,_0xfb4def))[_0x1f6b('0x2c')](handleError(_0x586ea1,null));};exports[_0x1f6b('0x71')]=function(_0x1f9260,_0x475ea6,_0x4aa03e){return db['ChatWebsite']['find']({'where':{'id':_0x1f9260[_0x1f6b('0x58')]['id']}})[_0x1f6b('0x22')](handleEntityNotFound(_0x475ea6,null))[_0x1f6b('0x22')](function(_0x2b41cb){if(_0x2b41cb){return _0x2b41cb[_0x1f6b('0x71')](_0x1f9260[_0x1f6b('0x49')][_0x1f6b('0x6c')]);}})[_0x1f6b('0x22')](respondWithStatusCode(_0x475ea6,null))[_0x1f6b('0x2c')](handleError(_0x475ea6,null));};exports['addLogo']=function(_0x4f5ee1,_0xc3b795,_0x124cb9){_0x4f5ee1[_0x1f6b('0x5c')][_0x1f6b('0x72')]=_0x4f5ee1[_0x1f6b('0x73')][_0x1f6b('0x74')];return db[_0x1f6b('0x42')]['find']({'where':{'id':_0x4f5ee1[_0x1f6b('0x58')]['id']}})[_0x1f6b('0x22')](handleEntityNotFound(_0xc3b795,null))[_0x1f6b('0x22')](saveUpdates(_0x4f5ee1[_0x1f6b('0x5c')],null))[_0x1f6b('0x22')](respondWithResult(_0xc3b795,null))[_0x1f6b('0x2c')](handleError(_0xc3b795,null));};exports[_0x1f6b('0x75')]=function(_0x5f0ca9,_0x52b6de,_0x5df1b3){_0x5f0ca9[_0x1f6b('0x5c')][_0x1f6b('0x76')]=_0x5f0ca9[_0x1f6b('0x73')]['filename'];return db[_0x1f6b('0x42')][_0x1f6b('0x5a')]({'where':{'id':_0x5f0ca9[_0x1f6b('0x58')]['id']}})[_0x1f6b('0x22')](handleEntityNotFound(_0x52b6de,null))[_0x1f6b('0x22')](saveUpdates(_0x5f0ca9[_0x1f6b('0x5c')],null))[_0x1f6b('0x22')](respondWithResult(_0x52b6de,null))[_0x1f6b('0x2c')](handleError(_0x52b6de,null));};exports[_0x1f6b('0x77')]=function(_0x15bafb,_0x56568b,_0x4827e1){_0x15bafb[_0x1f6b('0x5c')]['customerAvatar']=_0x15bafb[_0x1f6b('0x73')][_0x1f6b('0x74')];return db[_0x1f6b('0x42')][_0x1f6b('0x5a')]({'where':{'id':_0x15bafb['params']['id']}})['then'](handleEntityNotFound(_0x56568b,null))[_0x1f6b('0x22')](saveUpdates(_0x15bafb[_0x1f6b('0x5c')],null))[_0x1f6b('0x22')](respondWithResult(_0x56568b,null))['catch'](handleError(_0x56568b,null));};exports[_0x1f6b('0x78')]=function(_0x1129db,_0x3e18ee,_0x1d9424){_0x1129db[_0x1f6b('0x5c')][_0x1f6b('0x79')]=_0x1129db[_0x1f6b('0x73')][_0x1f6b('0x74')];return db['ChatWebsite'][_0x1f6b('0x5a')]({'where':{'id':_0x1129db[_0x1f6b('0x58')]['id']}})[_0x1f6b('0x22')](handleEntityNotFound(_0x3e18ee,null))['then'](saveUpdates(_0x1129db[_0x1f6b('0x5c')],null))[_0x1f6b('0x22')](respondWithResult(_0x3e18ee,null))['catch'](handleError(_0x3e18ee,null));};exports[_0x1f6b('0x7a')]=function(_0x572a60,_0x4c8501,_0x3264cb){var _0x215f03=path['join'](config[_0x1f6b('0x7b')],_0x1f6b('0x7c'));var _0x2b52b9={'where':{'id':_0x572a60['params']['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x5031c9=![];return require(_0x1f6b('0x7d'))[_0x1f6b('0x7e')]()[_0x1f6b('0x22')](function(_0x18ea2d){if(_0x18ea2d){_0x5031c9=_0x18ea2d['custom'];}})[_0x1f6b('0x22')](function(){return db[_0x1f6b('0x42')]['find'](_0x2b52b9);})[_0x1f6b('0x22')](handleEntityNotFound(_0x4c8501,null))[_0x1f6b('0x22')](function(_0x355133){if(_0x355133){if(!_[_0x1f6b('0x7f')](_0x355133[_0x1f6b('0x72')])){if(fs[_0x1f6b('0x80')](path[_0x1f6b('0x81')](config['root'],_0x1f6b('0x82'),_0x355133[_0x1f6b('0x72')]))&&_0x5031c9){_0x215f03=path[_0x1f6b('0x81')](config['root'],_0x1f6b('0x82'),_0x355133[_0x1f6b('0x72')]);}}return _0x4c8501['download'](_0x215f03);}})[_0x1f6b('0x2c')](handleError(_0x4c8501,null));};exports['getAvatar']=function(_0x369c6b,_0x4b70a9,_0x56f4c4){var _0x272b3c=path[_0x1f6b('0x81')](config[_0x1f6b('0x7b')],'server/files/images/avatars/default_avatar.png');var _0x50045c={'where':{'id':_0x369c6b[_0x1f6b('0x58')]['id']},'attributes':['id',_0x1f6b('0x76')],'raw':!![]};return db[_0x1f6b('0x42')]['find'](_0x50045c)[_0x1f6b('0x22')](handleEntityNotFound(_0x4b70a9,null))[_0x1f6b('0x22')](function(_0x3d7244){if(_0x3d7244){if(!_['isNil'](_0x3d7244[_0x1f6b('0x76')])){if(fs[_0x1f6b('0x80')](path[_0x1f6b('0x81')](config[_0x1f6b('0x7b')],_0x1f6b('0x83'),_0x3d7244[_0x1f6b('0x76')]))){_0x272b3c=path['join'](config[_0x1f6b('0x7b')],'server/files/images/avatars/',_0x3d7244[_0x1f6b('0x76')]);}}return _0x4b70a9[_0x1f6b('0x84')](_0x272b3c);}})[_0x1f6b('0x2c')](handleError(_0x4b70a9,null));};exports[_0x1f6b('0x85')]=function(_0xa49460,_0x4dccb8,_0x31b84b){var _0x18b166=path[_0x1f6b('0x81')](config[_0x1f6b('0x7b')],_0x1f6b('0x86'));var _0x2916ca={'where':{'id':_0xa49460['params']['id']},'attributes':['id',_0x1f6b('0x87'),_0x1f6b('0x88')],'raw':!![]};return db[_0x1f6b('0x42')]['find'](_0x2916ca)[_0x1f6b('0x22')](handleEntityNotFound(_0x4dccb8,null))[_0x1f6b('0x22')](function(_0x572312){if(_0x572312){if(!_[_0x1f6b('0x7f')](_0x572312[_0x1f6b('0x87')])){if(fs[_0x1f6b('0x80')](path['join'](config[_0x1f6b('0x7b')],_0x1f6b('0x83'),_0x572312[_0x1f6b('0x87')]))&&_0x572312[_0x1f6b('0x88')]){_0x18b166=path['join'](config['root'],_0x1f6b('0x83'),_0x572312['customerAvatar']);}}return _0x4dccb8[_0x1f6b('0x84')](_0x18b166);}})[_0x1f6b('0x2c')](handleError(_0x4dccb8,null));};exports[_0x1f6b('0x89')]=function(_0x1a474c,_0x174ddc,_0x5aa82c){var _0x4f11ad=path[_0x1f6b('0x81')](config[_0x1f6b('0x7b')],_0x1f6b('0x8a'));var _0x41c7f0={'where':{'id':_0x1a474c[_0x1f6b('0x58')]['id']},'attributes':['id',_0x1f6b('0x79')],'raw':!![]};return db[_0x1f6b('0x42')][_0x1f6b('0x5a')](_0x41c7f0)[_0x1f6b('0x22')](handleEntityNotFound(_0x174ddc,null))[_0x1f6b('0x22')](function(_0x1f8893){if(_0x1f8893){if(!_['isNil'](_0x1f8893[_0x1f6b('0x79')])){if(fs['existsSync'](path['join'](config['root'],_0x1f6b('0x83'),_0x1f8893['systemAvatar']))){_0x4f11ad=path['join'](config[_0x1f6b('0x7b')],_0x1f6b('0x83'),_0x1f8893['systemAvatar']);}}return _0x174ddc[_0x1f6b('0x84')](_0x4f11ad);}})[_0x1f6b('0x2c')](handleError(_0x174ddc,null));};exports[_0x1f6b('0x8b')]=function(_0x1278c1,_0x592635,_0x3a42e3){var _0x4c91ff=require(_0x1f6b('0x8c'));var _0x3894b4=new _0x4c91ff();var _0x47de3d=_0x3894b4['setUA'](_0x1278c1[_0x1f6b('0x8d')][_0x1f6b('0x8e')])[_0x1f6b('0x8f')]();var _0x233bd7={'body':_0x1278c1['body'],'channel':_0x1f6b('0x90')};var _0x4a3dab=[];var _0x15351e=[];var _0x110a05={};var _0x510e8b=![];return db[_0x1f6b('0x91')]['describe']()[_0x1f6b('0x22')](function(_0x1836c1){if(!_0x1836c1){throw new db[(_0x1f6b('0x92'))][(_0x1f6b('0x1f'))](_0x1f6b('0x93'));}_0x4a3dab=_['difference'](_['keys'](_0x1836c1),[_0x1f6b('0x94'),'updatedAt']);_0x15351e=_[_0x1f6b('0x95')](_[_0x1f6b('0x48')](_0x1836c1),[_0x1f6b('0x94'),_0x1f6b('0x96'),'CompanyId',_0x1f6b('0x97')]);if(_0x1278c1[_0x1f6b('0x5c')]['id']){delete _0x1278c1[_0x1f6b('0x5c')]['id'];}if(_[_0x1f6b('0x7f')](_0x1278c1[_0x1f6b('0x5c')]['from'])){throw new db[(_0x1f6b('0x92'))][(_0x1f6b('0x1f'))](_0x1f6b('0x98'));}if(_['isNil'](_0x1278c1[_0x1f6b('0x5c')][_0x1f6b('0x5c')])||_0x1278c1[_0x1f6b('0x5c')][_0x1f6b('0x5c')]===''){throw new db[(_0x1f6b('0x92'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x1f6b('0x7f')](_0x1278c1['body'][_0x1f6b('0x99')])){throw new db['Sequelize'][(_0x1f6b('0x1f'))](_0x1f6b('0x9a')+_0x15351e);}if(!_['includes'](_0x15351e,_0x1278c1[_0x1f6b('0x5c')][_0x1f6b('0x99')])){throw new db['Sequelize']['ValidationError'](_0x1f6b('0x9b')+_0x15351e);}_0x110a05[_0x1278c1['body'][_0x1f6b('0x99')]]=_0x1278c1[_0x1f6b('0x5c')][_0x1f6b('0x9c')];})[_0x1f6b('0x22')](function(){return db[_0x1f6b('0x42')][_0x1f6b('0x5a')]({'where':{'id':_0x1278c1[_0x1f6b('0x58')]['id']},'include':[{'model':db[_0x1f6b('0x9d')],'as':_0x1f6b('0x9e'),'include':[{'model':db[_0x1f6b('0x91')],'as':_0x1f6b('0x9f'),'where':_0x110a05,'limit':0x1,'order':[[_0x1f6b('0x96'),_0x1f6b('0xa0')]]}]},{'model':db[_0x1f6b('0xa1')],'as':_0x1f6b('0xa2')}]});})[_0x1f6b('0x22')](handleEntityNotFound(_0x592635,null))[_0x1f6b('0x22')](function(_0x5e1813){if(_0x5e1813&&_0x5e1813[_0x1f6b('0x9e')]){_0x233bd7['account']=_0x5e1813;_0x233bd7[_0x1f6b('0xa3')]=_0x5e1813[_0x1f6b('0xa2')];_0x233bd7['list']=_0x5e1813['List'];_0x233bd7[_0x1f6b('0xa3')]=_[_0x1f6b('0xa4')](_0x233bd7[_0x1f6b('0xa3')],[_0x1f6b('0xa5')],[_0x1f6b('0xa6')]);if(_0x233bd7[_0x1f6b('0xa7')][_0x1f6b('0xa2')]){delete _0x233bd7[_0x1f6b('0xa7')]['Applications'];}if(_0x233bd7[_0x1f6b('0xa7')][_0x1f6b('0x9e')]&&_0x233bd7['account']['List'][_0x1f6b('0x9f')]['length']){return _0x233bd7[_0x1f6b('0xa7')][_0x1f6b('0x9e')]['Contacts'][0x0];}var _0xa28a1d=_[_0x1f6b('0x17')](_0x1278c1[_0x1f6b('0x5c')],{'firstName':_0x1278c1[_0x1f6b('0x5c')][_0x1f6b('0x9c')],'ListId':_0x5e1813[_0x1f6b('0x97')]});_0xa28a1d[_0x1278c1[_0x1f6b('0x5c')][_0x1f6b('0x99')]]=_0x1278c1[_0x1f6b('0x5c')][_0x1f6b('0x9c')];return db[_0x1f6b('0x91')][_0x1f6b('0x5b')](_0xa28a1d,{'fields':_0x4a3dab,'raw':!![]});}})[_0x1f6b('0x22')](handleEntityNotFound(_0x592635,null))[_0x1f6b('0x22')](function(_0x5449b8){_0x233bd7['contact']=_0x5449b8;var _0x4912ee=_0x1278c1[_0x1f6b('0x5c')][_0x1f6b('0xa8')];if(_0x1278c1['headers']['cf-connecting-ip']){_0x4912ee=_0x1278c1[_0x1f6b('0x8d')][_0x1f6b('0xa9')];}else if(_0x1278c1['headers'][_0x1f6b('0xaa')]){_0x4912ee=_['first'](_0x1278c1[_0x1f6b('0x8d')][_0x1f6b('0xaa')]['split'](','));}if(_0x5449b8){var _0x4597b7={'ContactId':_0x5449b8['id'],'ChatWebsiteId':_0x1278c1[_0x1f6b('0x58')]['id'],'from':(_0x5449b8[_0x1f6b('0xab')]||'')+'\x20'+(_0x5449b8[_0x1f6b('0xac')]||''),'customerIp':_0x4912ee,'customerPort':_0x1278c1[_0x1f6b('0x8d')][_0x1f6b('0xad')]?_0x1278c1[_0x1f6b('0x8d')][_0x1f6b('0xad')]:null,'referer':_0x1278c1[_0x1f6b('0x5c')][_0x1f6b('0xae')],'browserName':_0x47de3d[_0x1f6b('0xaf')][_0x1f6b('0x3d')]&&_0x47de3d['browser'][_0x1f6b('0xb0')]?util['format']('%s\x20%s',_0x47de3d[_0x1f6b('0xaf')][_0x1f6b('0x3d')],_0x47de3d[_0x1f6b('0xaf')][_0x1f6b('0xb0')]):'unknown','browserVersion':_0x47de3d['browser']['version']||_0x1f6b('0xb1'),'osName':util[_0x1f6b('0xb2')](_0x1f6b('0xb3'),_0x47de3d['os'][_0x1f6b('0x3d')],_0x47de3d['os']['version']),'osVersion':_0x47de3d['os']['version'],'deviceModel':_0x47de3d[_0x1f6b('0xb4')][_0x1f6b('0x47')]&&_0x47de3d[_0x1f6b('0xb4')][_0x1f6b('0xb5')]?util['format'](_0x1f6b('0xb6'),_0x47de3d['device'][_0x1f6b('0x47')],_0x47de3d[_0x1f6b('0xb4')][_0x1f6b('0xb5')],_0x47de3d[_0x1f6b('0xb4')]['type']):null,'deviceVendor':_0x47de3d[_0x1f6b('0xb4')][_0x1f6b('0xb5')],'deviceType':_0x47de3d[_0x1f6b('0xb4')][_0x1f6b('0x45')],'formData':JSON[_0x1f6b('0xb7')](_0x1278c1[_0x1f6b('0x5c')])};var _0x503458={'ChatWebsiteId':_0x1278c1[_0x1f6b('0x58')]['id'],'closed':![]};if(_0x1278c1['body'][_0x1f6b('0xb8')]){_0x503458[_0x1f6b('0xb8')]=_0x1278c1[_0x1f6b('0x5c')][_0x1f6b('0xb8')];return db['ChatInteraction'][_0x1f6b('0x5a')]({'where':_0x503458})[_0x1f6b('0x22')](function(_0x56b32a){if(_0x56b32a){return[_0x56b32a,![]];}_0x4597b7['threadId']=_0x1278c1[_0x1f6b('0x5c')][_0x1f6b('0xb8')];_0x4597b7['externalUrl']=_0x1278c1[_0x1f6b('0x5c')][_0x1f6b('0xb9')];return db[_0x1f6b('0xba')][_0x1f6b('0x5b')](_0x4597b7)[_0x1f6b('0x22')](function(_0x14f2c8){return[_0x14f2c8,!![]];});});}_0x503458[_0x1f6b('0xbb')]=_0x5449b8['id'];if(_0x1278c1[_0x1f6b('0x5c')][_0x1f6b('0xbc')]&&_0x1278c1[_0x1f6b('0x5c')][_0x1f6b('0xbc')]['id']){_0x503458['id']=_0x1278c1[_0x1f6b('0x5c')][_0x1f6b('0xbc')]['id'];return db[_0x1f6b('0xba')]['find']({'where':_0x503458})[_0x1f6b('0x22')](function(_0x7d2d9b){if(_0x7d2d9b){return[_0x7d2d9b,![]];}return db['ChatInteraction'][_0x1f6b('0x5b')](_0x4597b7)['then'](function(_0x3ba9ae){return[_0x3ba9ae,!![]];});});}return db[_0x1f6b('0xba')][_0x1f6b('0x5b')](_0x4597b7)[_0x1f6b('0x22')](function(_0x12b32f){return[_0x12b32f,!![]];});}})[_0x1f6b('0xbd')](function(_0x392350,_0x5c9da9){if(_0x392350){_0x510e8b=_0x5c9da9;if(!_0x5c9da9){var _0x7af622={'from':(_0x233bd7[_0x1f6b('0xbe')][_0x1f6b('0xab')]||'')+'\x20'+(_0x233bd7['contact'][_0x1f6b('0xac')]||'')};if(_0x1278c1[_0x1f6b('0x5c')]['threadId']&&_0x1278c1[_0x1f6b('0x5c')][_0x1f6b('0xbf')]&&_0x1278c1['body'][_0x1f6b('0xb8')]!=_0x1278c1['body']['messageId']){_0x7af622[_0x1f6b('0xb8')]=_0x1278c1['body'][_0x1f6b('0xbf')];}return _0x392350[_0x1f6b('0x38')](_0x7af622);}else{return _0x392350;}}})[_0x1f6b('0x22')](function(_0x2f8ab0){_0x233bd7[_0x1f6b('0xbc')]=_0x2f8ab0[_0x1f6b('0x3a')]({'plain':!![]});_0x233bd7[_0x1f6b('0xbc')][_0x1f6b('0xc0')]=_0x510e8b;if(_0x233bd7[_0x1f6b('0xbc')]['created']){if(_0x233bd7[_0x1f6b('0xa7')]['autoclose']){_0x233bd7[_0x1f6b('0xa3')]['push']({'id':0x0,'priority':_0x233bd7[_0x1f6b('0xa3')][_0x1f6b('0x59')]+0x1,'app':_0x1f6b('0xc1'),'appdata':_0x1f6b('0xc2'),'interval':'*,*,*,*'});}}return db[_0x1f6b('0xc3')][_0x1f6b('0x5b')]({'body':_0x1278c1[_0x1f6b('0x5c')][_0x1f6b('0x5c')],'ChatWebsiteId':_0x1278c1[_0x1f6b('0x58')]['id'],'ChatInteractionId':_0x2f8ab0['id'],'direction':'in','ContactId':_0x233bd7[_0x1f6b('0xbe')]['id'],'AttachmentId':_0x1278c1[_0x1f6b('0x5c')][_0x1f6b('0xc4')]});})[_0x1f6b('0x22')](function(_0x5dd80b){_0x233bd7[_0x1f6b('0x29')]=_0x5dd80b;if(_0x233bd7[_0x1f6b('0xbc')]['UserId']){return db['User'][_0x1f6b('0x5a')]({'attributes':['id',_0x1f6b('0x3d')],'where':{'id':_0x233bd7[_0x1f6b('0xbc')][_0x1f6b('0xc5')]}})[_0x1f6b('0x22')](function(_0x276b80){if(_0x276b80){_0x233bd7['applications'][_0x1f6b('0xc6')]({'id':0x0,'priority':0x0,'app':_0x1f6b('0xc7'),'appdata':_0x276b80[_0x1f6b('0x3d')]+','+(_0x233bd7[_0x1f6b('0xa7')][_0x1f6b('0xc8')]||0xa),'interval':_0x1f6b('0xc9')});_0x233bd7[_0x1f6b('0xca')]=!![];}return respondWithRpcPromise('Start',_0x1f6b('0xcb'),_0x233bd7);});}return respondWithRpcPromise(_0x1f6b('0xcc'),_0x1f6b('0xcb'),_0x233bd7);})[_0x1f6b('0x22')](function(_0x2ac478){respondWithRpcPromise(_0x1f6b('0xcd'),'EventManager',{'event':'notify','message':_0x2ac478},client9002);return _0x2ac478;})[_0x1f6b('0x22')](respondWithResult(_0x592635,null))['catch'](handleError(_0x592635,null));};exports['offline']=function(_0x597733,_0x33c3c1,_0x5cfa2d){var _0x55f2a5,_0x77c91b,_0x4ee8d8;var _0x2c766a=[];var _0x149fb5=[];var _0x4efbc6={};return db['CmContact']['describe']()[_0x1f6b('0x22')](function(_0x5ab83e){if(!_0x5ab83e){throw new db[(_0x1f6b('0x92'))][(_0x1f6b('0x1f'))](_0x1f6b('0x93'));}_0x149fb5=_[_0x1f6b('0x95')](_[_0x1f6b('0x48')](_0x5ab83e),['createdAt','updatedAt']);_0x2c766a=_[_0x1f6b('0x95')](_[_0x1f6b('0x48')](_0x5ab83e),[_0x1f6b('0x94'),_0x1f6b('0x96'),_0x1f6b('0xce'),_0x1f6b('0x97')]);if(_0x597733[_0x1f6b('0x5c')]['id']){delete _0x597733[_0x1f6b('0x5c')]['id'];}if(_[_0x1f6b('0x7f')](_0x597733[_0x1f6b('0x5c')][_0x1f6b('0x9c')])){throw _0x33c3c1['status'](0x1f4)[_0x1f6b('0xcf')](new db[(_0x1f6b('0x92'))]['ValidationError']('from\x20is\x20mandatory'));}if(_[_0x1f6b('0x7f')](_0x597733[_0x1f6b('0x5c')]['body'])||_0x597733[_0x1f6b('0x5c')]['body']===''){throw _0x33c3c1[_0x1f6b('0x2e')](0x1f4)[_0x1f6b('0xcf')](new db[(_0x1f6b('0x92'))][(_0x1f6b('0x1f'))](_0x1f6b('0xd0')));}if(_[_0x1f6b('0x7f')](_0x597733['body'][_0x1f6b('0xd1')])){throw _0x33c3c1[_0x1f6b('0x2e')](0x1f4)[_0x1f6b('0xcf')](new db[(_0x1f6b('0x92'))][(_0x1f6b('0x1f'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2c766a));}if(!_['includes'](_0x2c766a,_0x597733[_0x1f6b('0x5c')][_0x1f6b('0xd1')])){throw _0x33c3c1[_0x1f6b('0x2e')](0x1f4)[_0x1f6b('0xcf')](new db[(_0x1f6b('0x92'))][(_0x1f6b('0x1f'))](_0x1f6b('0xd2')+_0x2c766a));}_0x4efbc6[_0x597733[_0x1f6b('0x5c')][_0x1f6b('0xd1')]]=_0x597733[_0x1f6b('0x5c')][_0x1f6b('0x9c')];})['then'](function(){return db['ChatWebsite'][_0x1f6b('0x5a')]({'where':{'id':_0x597733['params']['id']},'include':[{'model':db[_0x1f6b('0x9d')],'as':'List'}]});})[_0x1f6b('0x22')](handleEntityNotFound(_0x33c3c1,null))[_0x1f6b('0x22')](function(_0x5325da){if(_0x5325da&&_0x5325da[_0x1f6b('0x9e')]){_0x77c91b=_0x5325da;var _0x2ac729=_[_0x1f6b('0x17')](_0x597733[_0x1f6b('0x5c')],{'firstName':_0x597733[_0x1f6b('0x5c')][_0x1f6b('0x9c')],'phone':_0x597733[_0x1f6b('0x5c')][_0x1f6b('0x9c')],'ListId':_0x5325da[_0x1f6b('0x97')]});_0x2ac729[_0x597733[_0x1f6b('0x5c')]['mapKeyOffline']]=_0x597733[_0x1f6b('0x5c')][_0x1f6b('0x9c')];return db['CmContact'][_0x1f6b('0xd3')]({'where':_0x4efbc6,'defaults':_0x2ac729});}})[_0x1f6b('0xbd')](function(_0x47d851){if(_0x47d851){_0x4ee8d8=_0x47d851;var _0x80468a=fs[_0x1f6b('0xd4')](path['join'](config[_0x1f6b('0x7b')],'server/files/templates/chatOfflineMessage.ejs'),'utf8');var _0x47ea62=ejs['render'](_0x80468a,{'body':_[_0x1f6b('0xd5')](_0x597733[_0x1f6b('0x5c')][_0x1f6b('0x5c')]),'bodyTitle':_0x77c91b[_0x1f6b('0xd6')]});return db['ChatOfflineMessage'][_0x1f6b('0x5b')]({'body':_0x47ea62,'ContactId':_0x47d851['id'],'ChatWebsiteId':_0x77c91b['id']});}})[_0x1f6b('0x22')](function(_0x5578ae){if(_0x5578ae){_0x55f2a5=_0x5578ae;return db[_0x1f6b('0xd7')][_0x1f6b('0x66')]({'where':{'service':!![]},'include':[{'model':db[_0x1f6b('0xd8')],'as':'Smtp','raw':!![]}]});}})[_0x1f6b('0x22')](function(_0x2b7069){if(_0x2b7069&&_0x2b7069['Smtp']&&_0x77c91b[_0x1f6b('0xd9')]){var _0x4b4ff1={'tls':{'rejectUnauthorized':![]}};if(_0x2b7069[_0x1f6b('0xda')][_0x1f6b('0xdb')]){_0x4b4ff1[_0x1f6b('0xdb')]=_0x2b7069[_0x1f6b('0xda')][_0x1f6b('0xdb')];}else{_0x4b4ff1[_0x1f6b('0xdc')]=_0x2b7069[_0x1f6b('0xda')][_0x1f6b('0xdc')];_0x4b4ff1[_0x1f6b('0xdd')]=_0x2b7069['Smtp']['port'];_0x4b4ff1[_0x1f6b('0xde')]=_0x2b7069[_0x1f6b('0xda')]['secure'];}if(_0x2b7069[_0x1f6b('0xda')][_0x1f6b('0xdf')]){_0x4b4ff1[_0x1f6b('0xe0')]={'user':_0x2b7069[_0x1f6b('0xda')][_0x1f6b('0x5d')],'pass':_0x2b7069[_0x1f6b('0xda')]['pass']};}return respondWithRpcPromise(_0x1f6b('0xe1'),_0x1f6b('0xe2'),{'account':_0x4b4ff1,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x2b7069[_0x1f6b('0x3d')],_0x2b7069[_0x1f6b('0xe3')]||_0x2b7069[_0x1f6b('0xda')][_0x1f6b('0x5d')]),'to':_0x77c91b[_0x1f6b('0xd9')],'subject':_0x77c91b[_0x1f6b('0xe4')],'text':_0x55f2a5[_0x1f6b('0x5c')]}},client9003)[_0x1f6b('0x22')](function(){return _0x55f2a5;})[_0x1f6b('0x2c')](function(_0x318265){console[_0x1f6b('0x27')](_0x318265);});}})[_0x1f6b('0x22')](function(){if(_0x55f2a5){return _0x55f2a5;}})[_0x1f6b('0x22')](respondWithResult(_0x33c3c1,null))[_0x1f6b('0x2c')](handleError(_0x33c3c1,null));};exports[_0x1f6b('0xe5')]=function(_0x262f98,_0x4be55a,_0x21d972){return db[_0x1f6b('0xba')]['find']({'where':{'id':_0x262f98[_0x1f6b('0x58')]['id']}})[_0x1f6b('0x22')](handleEntityNotFound(_0x4be55a,null))[_0x1f6b('0x22')](function(_0x493549){if(_0x493549){return _0x493549[_0x1f6b('0xe5')](_0x262f98['body']['ids'],_[_0x1f6b('0xe6')](_0x262f98[_0x1f6b('0x5c')],['ids','id'])||{});}})[_0x1f6b('0x22')](respondWithResult(_0x4be55a,null))[_0x1f6b('0x2c')](handleError(_0x4be55a,null));};exports[_0x1f6b('0xe7')]=function(_0x5f3847,_0x5e3f81,_0x3bec03){var _0x959cba={'raw':![],'where':{}};var _0x5a8476={};var _0x598887={'count':0x0,'rows':[]};return db[_0x1f6b('0x42')][_0x1f6b('0x66')]({'where':{'id':_0x5f3847[_0x1f6b('0x58')]['id']}})[_0x1f6b('0x22')](handleEntityNotFound(_0x5e3f81,null))[_0x1f6b('0x22')](function(_0x3eec10){if(_0x3eec10){_0x5a8476[_0x1f6b('0x47')]=_[_0x1f6b('0x48')](db[_0x1f6b('0xba')][_0x1f6b('0x43')]);_0x5a8476[_0x1f6b('0x49')]=_[_0x1f6b('0x48')](_0x5f3847[_0x1f6b('0x49')]);_0x5a8476[_0x1f6b('0x4a')]=_[_0x1f6b('0x4b')](_0x5a8476[_0x1f6b('0x47')],_0x5a8476[_0x1f6b('0x49')]);_0x959cba[_0x1f6b('0x4c')]=_[_0x1f6b('0x4b')](_0x5a8476[_0x1f6b('0x47')],qs[_0x1f6b('0x4d')](_0x5f3847[_0x1f6b('0x49')][_0x1f6b('0x4d')]));_0x959cba['attributes']=_0x959cba['attributes'][_0x1f6b('0x59')]?_0x959cba[_0x1f6b('0x4c')]:_0x5a8476['model'];if(!_0x5f3847[_0x1f6b('0x49')]['hasOwnProperty'](_0x1f6b('0x70'))){_0x959cba['limit']=qs[_0x1f6b('0x33')](_0x5f3847[_0x1f6b('0x49')][_0x1f6b('0x33')]);_0x959cba[_0x1f6b('0x32')]=qs[_0x1f6b('0x32')](_0x5f3847[_0x1f6b('0x49')][_0x1f6b('0x32')]);}_0x959cba[_0x1f6b('0x4f')]=qs['sort'](_0x5f3847[_0x1f6b('0x49')][_0x1f6b('0x50')]);_0x959cba['where']=qs['filters'](_[_0x1f6b('0xe8')](_0x5f3847[_0x1f6b('0x49')],_0x5a8476[_0x1f6b('0x4a')]));_0x959cba[_0x1f6b('0x51')][_0x1f6b('0x67')]=_0x3eec10['id'];if(_0x5f3847[_0x1f6b('0x49')]['filter']){_0x959cba[_0x1f6b('0x51')]=_[_0x1f6b('0x53')](_0x959cba[_0x1f6b('0x51')],{'$or':_[_0x1f6b('0x41')](_0x959cba['attributes'],function(_0x270f9c){var _0x125b6f={};_0x125b6f[_0x270f9c]={'$like':'%'+_0x5f3847[_0x1f6b('0x49')][_0x1f6b('0x52')]+'%'};return _0x125b6f;})});}_0x959cba=_[_0x1f6b('0x53')]({},_0x959cba,_0x5f3847['options']);return db['ChatInteraction'][_0x1f6b('0x31')]({'where':_0x959cba['where']})[_0x1f6b('0x22')](function(_0x242714){_0x598887[_0x1f6b('0x31')]=_0x242714;if(_0x5f3847['query'][_0x1f6b('0x69')]){_0x959cba[_0x1f6b('0xe9')]=[{'model':db[_0x1f6b('0x91')],'as':_0x1f6b('0xea'),'required':![]},{'model':db[_0x1f6b('0xeb')],'as':_0x1f6b('0xec'),'attributes':[_0x1f6b('0x3d'),_0x1f6b('0xed'),_0x1f6b('0xee')],'required':![]},{'model':db[_0x1f6b('0xef')],'as':'Tags','attributes':['id',_0x1f6b('0x3d'),'color'],'where':_0x5f3847[_0x1f6b('0x49')][_0x1f6b('0xf0')]?{'id':_0x5f3847[_0x1f6b('0x49')][_0x1f6b('0xf0')]}:undefined,'required':_0x5f3847[_0x1f6b('0x49')][_0x1f6b('0xf0')]?!![]:![]}];}return db['ChatInteraction'][_0x1f6b('0x6a')](_0x959cba);})['then'](function(_0x2afeb8){_0x598887['rows']=_0x2afeb8;return _0x598887;});}})[_0x1f6b('0x22')](respondWithFilteredResult(_0x5e3f81,_0x959cba))['catch'](handleError(_0x5e3f81,null));};function iftimePromise(_0x60ed9c,_0x5944cd){return respondWithRpcPromise(_0x1f6b('0xf1'),_0x1f6b('0xf2'),{'command':_0x5944cd['timezone']?util[_0x1f6b('0xb2')](_0x1f6b('0xf3'),_0x60ed9c[_0x1f6b('0xf4')],_0x5944cd[_0x1f6b('0xf5')]):util['format'](_0x1f6b('0xf6'),_0x60ed9c['interval'])},client9002)[_0x1f6b('0x22')](function(_0x43cf62){var _0x1528f2=_0x43cf62&&_0x43cf62[_0x1f6b('0xf7')](_0x1f6b('0xf8'))>=0x0?!![]:![];logger[_0x1f6b('0x2a')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x5944cd['id'],_0x60ed9c['id'],_0x60ed9c[_0x1f6b('0xf4')],_0x1528f2?_0x1f6b('0xf9'):_0x1f6b('0xfa'),_0x5944cd['timezone']?_0x5944cd[_0x1f6b('0xf5')]:'No\x20timezone');return _0x1528f2;})['catch'](function(_0x20e32c){logger['error']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x5944cd['id'],_0x60ed9c['id'],_0x60ed9c[_0x1f6b('0xf4')],util[_0x1f6b('0xfb')](_0x20e32c,{'showHidden':![],'depth':null}),_0x5944cd[_0x1f6b('0xf5')]?_0x5944cd['timezone']:'No\x20timezone');return![];});}exports[_0x1f6b('0xf2')]=function(_0x11d402,_0x16a972,_0x16adbe){var _0x1239bd=0x0;var _0x3b356a=0x0;var _0x442854=![];var _0x17bc37;var _0x1d7f3c;return db[_0x1f6b('0x42')][_0x1f6b('0x5a')]({'where':{'id':_0x11d402[_0x1f6b('0x58')]['id']},'include':[{'model':db['Interval'],'as':_0x1f6b('0xfc'),'include':[{'model':db[_0x1f6b('0xfc')],'as':'Intervals','attributes':['id',_0x1f6b('0xf4')],'raw':!![]}]}]})[_0x1f6b('0x22')](handleEntityNotFound(_0x16a972,null))[_0x1f6b('0x22')](function(_0x1ffba4){if(_0x1ffba4){_0x17bc37=_0x1ffba4;return _0x1ffba4[_0x1f6b('0xfd')]({'raw':!![]});}})[_0x1f6b('0x22')](function(_0x522323){if(_0x17bc37){if(_0x522323){_0x1d7f3c=_0x522323;}}return require(_0x1f6b('0x7d'))[_0x1f6b('0x7e')]();})[_0x1f6b('0x22')](function(_0x54805d){if(_0x54805d){_0x3b356a=_0x54805d[_0x1f6b('0xfe')];_0x442854=_0x54805d[_0x1f6b('0xff')];}})['then'](function(){return db['ChatInteraction'][_0x1f6b('0x31')]({'where':{'closed':![]}});})[_0x1f6b('0x22')](function(_0x17f247){_0x1239bd=_0x17f247;if(_0x3b356a&&_0x17f247>_0x3b356a){return db[_0x1f6b('0x100')][_0x1f6b('0x66')]({'where':{'id':0x1}})[_0x1f6b('0x22')](function(_0x427b89){if(_0x427b89){_0x427b89[_0x1f6b('0x101')](_0x1f6b('0x102'));}});}})[_0x1f6b('0x22')](function(){if(_0x17bc37[_0x1f6b('0xfc')]&&_0x17bc37[_0x1f6b('0xfc')][_0x1f6b('0x103')]){var _0x5af8b6=[];for(var _0x423bb2=0x0;_0x423bb2<_0x17bc37[_0x1f6b('0xfc')][_0x1f6b('0x103')][_0x1f6b('0x59')];_0x423bb2++){var _0x20eae1=_0x17bc37[_0x1f6b('0xfc')]['Intervals'][_0x423bb2][_0x1f6b('0x3a')]({'plain':!![]});_0x5af8b6[_0x1f6b('0x104')](iftimePromise(_0x20eae1,_0x17bc37));}return BPromise[_0x1f6b('0x105')](_0x5af8b6)['then'](function(_0x6041d3){return _[_0x1f6b('0x106')](_0x6041d3);});}else{return!![];}})[_0x1f6b('0x22')](function(_0x161ecc){var _0x5e8604=fs[_0x1f6b('0xd4')](path['join'](config['root'],_0x1f6b('0x107')),_0x1f6b('0x108'));var _0x572308={'remote':_0x17bc37[_0x1f6b('0x109')],'query':querystring[_0x1f6b('0xb7')](_[_0x1f6b('0x53')](_0x17bc37[_0x1f6b('0x3a')]({'plain':!![]}),{'customerIp':_0x11d402['headers'][_0x1f6b('0xaa')]||_0x11d402[_0x1f6b('0x8d')]['x-real-ip']||_0x11d402[_0x1f6b('0x10a')][_0x1f6b('0x10b')]||_0x11d402['ip'],'referer':_0x11d402['headers'][_0x1f6b('0xae')],'openedInteractions':_0x1239bd,'maxInteractions':_0x3b356a,'virtual':_0x442854[_0x1f6b('0xfe')],'online':_0x161ecc,'custom':_0x442854}))[_0x1f6b('0x10c')](/'/g,'\x5c\x27')};_0x16a972['send'](ejs[_0x1f6b('0x10d')](Mustache[_0x1f6b('0x10d')](_0x5e8604,_0x572308),{'proactiveActions':_0x1d7f3c,'alignment':_0x17bc37[_0x1f6b('0x10e')],'verticalAlignment':_0x17bc37[_0x1f6b('0x10f')],'div_color':_0x17bc37[_0x1f6b('0x110')],'text_color':_0x17bc37[_0x1f6b('0x111')]}));})[_0x1f6b('0x2c')](handleError(_0x16a972,null));};exports[_0x1f6b('0x112')]=function(_0x2ba9e7,_0x3a4738,_0x2d9cc4){return db['ChatWebsite']['findOne']({'where':{'id':_0x2ba9e7[_0x1f6b('0x58')]['id']}})[_0x1f6b('0x22')](handleEntityNotFound(_0x3a4738,null))['then'](function(_0x324132){if(_0x324132){return db[_0x1f6b('0x113')][_0x1f6b('0x114')](function(_0x420440){return db[_0x1f6b('0xa1')][_0x1f6b('0x39')]({'where':{'ChatWebsiteId':_0x2ba9e7['params']['id']},'transaction':_0x420440})[_0x1f6b('0x22')](function(_0x3a85b6){var _0x19201=_[_0x1f6b('0x41')](_0x2ba9e7[_0x1f6b('0x5c')],function(_0x239e65){_0x239e65[_0x1f6b('0x67')]=_0x2ba9e7[_0x1f6b('0x58')]['id'];return _0x239e65;});return db['ChatApplication'][_0x1f6b('0x115')](_0x19201,{'transaction':_0x420440});});})[_0x1f6b('0x22')](function(){return db['ChatApplication']['findAndCountAll']({'where':{'ChatWebsiteId':_0x2ba9e7[_0x1f6b('0x58')]['id']},'order':_0x1f6b('0xa5')});});}})[_0x1f6b('0x22')](respondWithResult(_0x3a4738,null))['catch'](handleError(_0x3a4738,null));};exports['getApplications']=function(_0x884eb1,_0x3423ef,_0x391e36){var _0x3edbf2={};var _0x37fa65={};var _0x4bb2f3;var _0x4f3e7a;return db[_0x1f6b('0x42')][_0x1f6b('0x66')]({'where':{'id':_0x884eb1[_0x1f6b('0x58')]['id']}})[_0x1f6b('0x22')](handleEntityNotFound(_0x3423ef,null))[_0x1f6b('0x22')](function(_0x153ae4){if(_0x153ae4){_0x4bb2f3=_0x153ae4;_0x37fa65['model']=_[_0x1f6b('0x48')](db[_0x1f6b('0xa1')][_0x1f6b('0x43')]);_0x37fa65[_0x1f6b('0x49')]=_[_0x1f6b('0x48')](_0x884eb1[_0x1f6b('0x49')]);_0x37fa65[_0x1f6b('0x4a')]=_[_0x1f6b('0x4b')](_0x37fa65[_0x1f6b('0x47')],_0x37fa65[_0x1f6b('0x49')]);_0x3edbf2[_0x1f6b('0x4c')]=_[_0x1f6b('0x4b')](_0x37fa65[_0x1f6b('0x47')],qs['fields'](_0x884eb1[_0x1f6b('0x49')][_0x1f6b('0x4d')]));_0x3edbf2[_0x1f6b('0x4c')]=_0x3edbf2[_0x1f6b('0x4c')][_0x1f6b('0x59')]?_0x3edbf2[_0x1f6b('0x4c')]:_0x37fa65[_0x1f6b('0x47')];_0x3edbf2[_0x1f6b('0x4f')]=qs['sort'](_0x884eb1['query'][_0x1f6b('0x50')]);_0x3edbf2[_0x1f6b('0x51')]=qs[_0x1f6b('0x4a')](_[_0x1f6b('0xe8')](_0x884eb1['query'],_0x37fa65[_0x1f6b('0x4a')]));if(_0x884eb1[_0x1f6b('0x49')][_0x1f6b('0x52')]){_0x3edbf2['where']=_[_0x1f6b('0x53')](_0x3edbf2[_0x1f6b('0x51')],{'$or':_[_0x1f6b('0x41')](_0x3edbf2[_0x1f6b('0x4c')],function(_0x3ee41b){var _0x3efe40={};_0x3efe40[_0x3ee41b]={'$like':'%'+_0x884eb1[_0x1f6b('0x49')][_0x1f6b('0x52')]+'%'};return _0x3efe40;})});}_0x3edbf2=_[_0x1f6b('0x53')]({},_0x3edbf2,_0x884eb1['options']);return _0x4bb2f3['getApplications'](_0x3edbf2);}})[_0x1f6b('0x22')](function(_0x52d77f){if(_0x52d77f){_0x4f3e7a=_0x52d77f[_0x1f6b('0x59')];if(!_0x884eb1['query'][_0x1f6b('0x4e')]('nolimit')){_0x3edbf2[_0x1f6b('0x33')]=qs['limit'](_0x884eb1['query'][_0x1f6b('0x33')]);_0x3edbf2[_0x1f6b('0x32')]=qs[_0x1f6b('0x32')](_0x884eb1[_0x1f6b('0x49')][_0x1f6b('0x32')]);}return _0x4bb2f3[_0x1f6b('0x116')](_0x3edbf2);}})[_0x1f6b('0x22')](function(_0x189bfa){if(_0x189bfa){return _0x189bfa?{'count':_0x4f3e7a,'rows':_0x189bfa}:null;}})[_0x1f6b('0x22')](respondWithResult(_0x3423ef,null))[_0x1f6b('0x2c')](handleError(_0x3423ef,null));};exports[_0x1f6b('0x117')]=function(_0x40b96a,_0x12fc89,_0x5a6e2c){return db['chatProactiveAction'][_0x1f6b('0x5a')]({'where':{'id':_0x40b96a[_0x1f6b('0x58')]['id']}})['then'](handleEntityNotFound(_0x12fc89,null))[_0x1f6b('0x22')](function(_0x15fd41){if(_0x15fd41){return _0x15fd41[_0x1f6b('0x117')](_0x40b96a['body'][_0x1f6b('0x6c')],_[_0x1f6b('0xe6')](_0x40b96a['body'],[_0x1f6b('0x6c'),'id'])||{});}})[_0x1f6b('0x22')](respondWithResult(_0x12fc89,null))[_0x1f6b('0x2c')](handleError(_0x12fc89,null));};exports['getProactiveActions']=function(_0x1b44be,_0x17dcfe,_0x24708f){var _0x136864={};var _0x1074d6={};var _0x7a72e9;var _0x50474a;return db[_0x1f6b('0x42')][_0x1f6b('0x66')]({'where':{'id':_0x1b44be['params']['id']}})[_0x1f6b('0x22')](handleEntityNotFound(_0x17dcfe,null))['then'](function(_0x5ccfd7){if(_0x5ccfd7){_0x7a72e9=_0x5ccfd7;_0x1074d6['model']=_[_0x1f6b('0x48')](db[_0x1f6b('0x118')][_0x1f6b('0x43')]);_0x1074d6[_0x1f6b('0x49')]=_[_0x1f6b('0x48')](_0x1b44be[_0x1f6b('0x49')]);_0x1074d6[_0x1f6b('0x4a')]=_[_0x1f6b('0x4b')](_0x1074d6[_0x1f6b('0x47')],_0x1074d6[_0x1f6b('0x49')]);_0x136864[_0x1f6b('0x4c')]=_[_0x1f6b('0x4b')](_0x1074d6[_0x1f6b('0x47')],qs[_0x1f6b('0x4d')](_0x1b44be[_0x1f6b('0x49')][_0x1f6b('0x4d')]));_0x136864[_0x1f6b('0x4c')]=_0x136864[_0x1f6b('0x4c')][_0x1f6b('0x59')]?_0x136864[_0x1f6b('0x4c')]:_0x1074d6[_0x1f6b('0x47')];_0x136864[_0x1f6b('0x4f')]=qs[_0x1f6b('0x50')](_0x1b44be['query'][_0x1f6b('0x50')]);_0x136864[_0x1f6b('0x51')]=qs[_0x1f6b('0x4a')](_[_0x1f6b('0xe8')](_0x1b44be[_0x1f6b('0x49')],_0x1074d6[_0x1f6b('0x4a')]));if(_0x1b44be[_0x1f6b('0x49')][_0x1f6b('0x52')]){_0x136864['where']=_[_0x1f6b('0x53')](_0x136864[_0x1f6b('0x51')],{'$or':_[_0x1f6b('0x41')](_0x136864['attributes'],function(_0x1a91d8){var _0x5eeee2={};_0x5eeee2[_0x1a91d8]={'$like':'%'+_0x1b44be['query'][_0x1f6b('0x52')]+'%'};return _0x5eeee2;})});}_0x136864=_[_0x1f6b('0x53')]({},_0x136864,_0x1b44be[_0x1f6b('0x55')]);return _0x7a72e9[_0x1f6b('0xfd')](_0x136864);}})[_0x1f6b('0x22')](function(_0x3ce4a8){if(_0x3ce4a8){_0x50474a=_0x3ce4a8[_0x1f6b('0x59')];if(!_0x1b44be[_0x1f6b('0x49')]['hasOwnProperty'](_0x1f6b('0x70'))){_0x136864[_0x1f6b('0x33')]=qs[_0x1f6b('0x33')](_0x1b44be[_0x1f6b('0x49')][_0x1f6b('0x33')]);_0x136864[_0x1f6b('0x32')]=qs[_0x1f6b('0x32')](_0x1b44be[_0x1f6b('0x49')]['offset']);}return _0x7a72e9['getProactiveActions'](_0x136864);}})[_0x1f6b('0x22')](function(_0x5d5a5f){if(_0x5d5a5f){return _0x5d5a5f?{'count':_0x50474a,'rows':_0x5d5a5f}:null;}})[_0x1f6b('0x22')](respondWithResult(_0x17dcfe,null))[_0x1f6b('0x2c')](handleError(_0x17dcfe,null));};exports['getFields']=function(_0x413550,_0x3814f1,_0x3a875e){var _0x50a2=_0x413550[_0x1f6b('0x49')][_0x1f6b('0x119')]===_0x1f6b('0x11a')?_0x1f6b('0x11b'):_0x1f6b('0x11c');return db[_0x1f6b('0x42')][_0x1f6b('0x5a')]({'attributes':['id',_0x50a2],'where':{'id':_0x413550[_0x1f6b('0x58')]['id']}})[_0x1f6b('0x22')](handleEntityNotFound(_0x3814f1,null))['then'](function(_0x42835a){if(_0x42835a){var _0x15262e=_0x42835a[_0x50a2];var _0x2f1cfb=_0x15262e&&_0x15262e[_0x1f6b('0x11d')]?_0x15262e[_0x1f6b('0x11d')]:[];_0x3814f1['send']({'fromKey':_[_0x1f6b('0x7f')](_0x15262e[_0x1f6b('0x11e')])?undefined:_0x15262e[_0x1f6b('0x11e')],'count':_0x2f1cfb[_0x1f6b('0x59')],'rows':_0x2f1cfb});}})[_0x1f6b('0x2c')](handleError(_0x3814f1,null));};exports[_0x1f6b('0x11f')]=function(_0xbd0ee9,_0x6dfd38,_0x15af79){var _0x2fa42b={'raw':![],'where':{}};var _0x3c5518={};var _0x1d39a5={'count':0x0,'rows':[]};return db[_0x1f6b('0x42')]['findOne']({'where':{'id':_0xbd0ee9['params']['id']}})[_0x1f6b('0x22')](handleEntityNotFound(_0x6dfd38,null))[_0x1f6b('0x22')](function(_0x542f1d){if(_0x542f1d){_0x3c5518[_0x1f6b('0x47')]=_[_0x1f6b('0x48')](db['ChatOfflineMessage'][_0x1f6b('0x43')]);_0x3c5518[_0x1f6b('0x49')]=_['keys'](_0xbd0ee9[_0x1f6b('0x49')]);_0x3c5518[_0x1f6b('0x4a')]=_[_0x1f6b('0x4b')](_0x3c5518[_0x1f6b('0x47')],_0x3c5518['query']);_0x2fa42b[_0x1f6b('0x4c')]=_[_0x1f6b('0x4b')](_0x3c5518[_0x1f6b('0x47')],qs[_0x1f6b('0x4d')](_0xbd0ee9['query'][_0x1f6b('0x4d')]));_0x2fa42b[_0x1f6b('0x4c')]=_0x2fa42b[_0x1f6b('0x4c')][_0x1f6b('0x59')]?_0x2fa42b['attributes']:_0x3c5518[_0x1f6b('0x47')];if(!_0xbd0ee9[_0x1f6b('0x49')][_0x1f6b('0x4e')]('nolimit')){_0x2fa42b[_0x1f6b('0x33')]=qs[_0x1f6b('0x33')](_0xbd0ee9[_0x1f6b('0x49')][_0x1f6b('0x33')]);_0x2fa42b['offset']=qs[_0x1f6b('0x32')](_0xbd0ee9[_0x1f6b('0x49')][_0x1f6b('0x32')]);}_0x2fa42b[_0x1f6b('0x4f')]=qs['sort'](_0xbd0ee9[_0x1f6b('0x49')][_0x1f6b('0x50')]);_0x2fa42b[_0x1f6b('0x51')]=qs[_0x1f6b('0x4a')](_[_0x1f6b('0xe8')](_0xbd0ee9['query'],_0x3c5518[_0x1f6b('0x4a')]));_0x2fa42b[_0x1f6b('0x51')]['ChatWebsiteId']=_0x542f1d['id'];if(_0xbd0ee9[_0x1f6b('0x49')][_0x1f6b('0x52')]){_0x2fa42b[_0x1f6b('0x51')]=_[_0x1f6b('0x53')](_0x2fa42b[_0x1f6b('0x51')],{'$or':_[_0x1f6b('0x41')](_0x2fa42b[_0x1f6b('0x4c')],function(_0x30d95c){var _0x4a3ba1={};_0x4a3ba1[_0x30d95c]={'$like':'%'+_0xbd0ee9[_0x1f6b('0x49')][_0x1f6b('0x52')]+'%'};return _0x4a3ba1;})});}_0x2fa42b=_[_0x1f6b('0x53')]({},_0x2fa42b,_0xbd0ee9[_0x1f6b('0x55')]);return db[_0x1f6b('0x120')][_0x1f6b('0x31')]({'where':_0x2fa42b[_0x1f6b('0x51')]})['then'](function(_0xc37037){_0x1d39a5[_0x1f6b('0x31')]=_0xc37037;if(_0xbd0ee9[_0x1f6b('0x49')]['includeAll']){_0x2fa42b[_0x1f6b('0xe9')]=[{'all':!![]}];}else{_0x2fa42b[_0x1f6b('0xe9')]=[{'model':db[_0x1f6b('0x91')],'as':_0x1f6b('0xea'),'required':![]}];}return db[_0x1f6b('0x120')][_0x1f6b('0x6a')](_0x2fa42b);})[_0x1f6b('0x22')](function(_0x502651){_0x1d39a5['rows']=_0x502651;return _0x1d39a5;});}})[_0x1f6b('0x22')](respondWithFilteredResult(_0x6dfd38,_0x2fa42b))[_0x1f6b('0x2c')](handleError(_0x6dfd38,null));};exports[_0x1f6b('0x121')]=function(_0x21cb37,_0x4bca02,_0x4c50ea){return db[_0x1f6b('0x42')][_0x1f6b('0x5a')]({'where':{'id':_0x21cb37[_0x1f6b('0x58')]['id']}})['then'](handleEntityNotFound(_0x4bca02,null))[_0x1f6b('0x22')](function(_0x2cd70e){if(_0x2cd70e){return _0x2cd70e[_0x1f6b('0x121')](_0x21cb37[_0x1f6b('0x5c')]['ids'],_[_0x1f6b('0xe6')](_0x21cb37[_0x1f6b('0x5c')],['ids','id'])||{})[_0x1f6b('0xbd')](function(_0xa9e417){for(var _0x22c125=0x0;_0x22c125<_0x21cb37['body']['ids'][_0x1f6b('0x59')];_0x22c125+=0x1){socket[_0x1f6b('0x122')](_0x1f6b('0x123'),{'UserId':_0x21cb37['body'][_0x1f6b('0x6c')][_0x22c125],'ChatWebsiteId':_0x21cb37[_0x1f6b('0x58')]['id']});}return _0xa9e417;});}})[_0x1f6b('0x22')](respondWithResult(_0x4bca02,null))[_0x1f6b('0x2c')](handleError(_0x4bca02,null));};exports['removeAgents']=function(_0x5539bd,_0x56e06b,_0x176c20){return db[_0x1f6b('0x42')][_0x1f6b('0x5a')]({'where':{'id':_0x5539bd['params']['id']}})['then'](handleEntityNotFound(_0x56e06b,null))[_0x1f6b('0x22')](function(_0x5f1e7b){if(_0x5f1e7b){return _0x5f1e7b[_0x1f6b('0x124')](_0x5539bd['query'][_0x1f6b('0x6c')])['then'](function(){if(_['isArray'](_0x5539bd[_0x1f6b('0x49')][_0x1f6b('0x6c')])){for(var _0x50fbdb=0x0;_0x50fbdb<_0x5539bd[_0x1f6b('0x49')][_0x1f6b('0x6c')]['length'];_0x50fbdb+=0x1){socket[_0x1f6b('0x122')]('userChatWebsite:remove',{'UserId':Number(_0x5539bd[_0x1f6b('0x49')][_0x1f6b('0x6c')][_0x50fbdb]),'ChatWebsiteId':Number(_0x5539bd[_0x1f6b('0x58')]['id'])});}}else{socket[_0x1f6b('0x122')]('userChatWebsite:remove',{'UserId':Number(_0x5539bd[_0x1f6b('0x49')][_0x1f6b('0x6c')]),'ChatWebsiteId':Number(_0x5539bd[_0x1f6b('0x58')]['id'])});}});}})[_0x1f6b('0x22')](respondWithStatusCode(_0x56e06b,null))[_0x1f6b('0x2c')](handleError(_0x56e06b,null));};exports[_0x1f6b('0x125')]=function(_0x54e704,_0x1cd2ac,_0x9de23d){var _0x4af911={};var _0x46c0b9={};var _0x676848;var _0x19d0a0;return db[_0x1f6b('0x42')][_0x1f6b('0x66')]({'where':{'id':_0x54e704[_0x1f6b('0x58')]['id']}})['then'](handleEntityNotFound(_0x1cd2ac,null))[_0x1f6b('0x22')](function(_0x393f22){if(_0x393f22){_0x676848=_0x393f22;_0x46c0b9[_0x1f6b('0x47')]=_['keys'](db[_0x1f6b('0xeb')][_0x1f6b('0x43')]);_0x46c0b9[_0x1f6b('0x49')]=_[_0x1f6b('0x48')](_0x54e704['query']);_0x46c0b9[_0x1f6b('0x4a')]=_[_0x1f6b('0x4b')](_0x46c0b9[_0x1f6b('0x47')],_0x46c0b9[_0x1f6b('0x49')]);_0x4af911[_0x1f6b('0x4c')]=_[_0x1f6b('0x4b')](_0x46c0b9[_0x1f6b('0x47')],qs[_0x1f6b('0x4d')](_0x54e704['query'][_0x1f6b('0x4d')]));_0x4af911['attributes']=_0x4af911[_0x1f6b('0x4c')]['length']?_0x4af911[_0x1f6b('0x4c')]:_0x46c0b9['model'];_0x4af911[_0x1f6b('0x4f')]=qs['sort'](_0x54e704[_0x1f6b('0x49')]['sort']);_0x4af911[_0x1f6b('0x51')]=qs['filters'](_[_0x1f6b('0xe8')](_0x54e704[_0x1f6b('0x49')],_0x46c0b9['filters']));if(_0x54e704['query'][_0x1f6b('0x52')]){_0x4af911[_0x1f6b('0x51')]=_['merge'](_0x4af911[_0x1f6b('0x51')],{'$or':_[_0x1f6b('0x41')](_0x4af911['attributes'],function(_0x4b6144){var _0x4da324={};_0x4da324[_0x4b6144]={'$like':'%'+_0x54e704['query'][_0x1f6b('0x52')]+'%'};return _0x4da324;})});}_0x4af911=_[_0x1f6b('0x53')]({},_0x4af911,_0x54e704[_0x1f6b('0x55')]);return _0x676848[_0x1f6b('0x125')](_0x4af911);}})['then'](function(_0x50a030){if(_0x50a030){_0x19d0a0=_0x50a030[_0x1f6b('0x59')];if(!_0x54e704[_0x1f6b('0x49')][_0x1f6b('0x4e')](_0x1f6b('0x70'))){_0x4af911[_0x1f6b('0x33')]=qs[_0x1f6b('0x33')](_0x54e704[_0x1f6b('0x49')][_0x1f6b('0x33')]);_0x4af911[_0x1f6b('0x32')]=qs[_0x1f6b('0x32')](_0x54e704[_0x1f6b('0x49')]['offset']);}return _0x676848['getAgents'](_0x4af911);}})[_0x1f6b('0x22')](function(_0x2de2fb){if(_0x2de2fb){return _0x2de2fb?{'count':_0x19d0a0,'rows':_0x2de2fb}:null;}})[_0x1f6b('0x22')](respondWithResult(_0x1cd2ac,null))['catch'](handleError(_0x1cd2ac,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index b5ce8ad..a8a1647 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 _0x18d6=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x435391,_0x4ca10c){var _0x55c7bc=function(_0x4be0d5){while(--_0x4be0d5){_0x435391['push'](_0x435391['shift']());}};_0x55c7bc(++_0x4ca10c);}(_0x18d6,0x166));var _0x618d=function(_0x41a237,_0x2647d7){_0x41a237=_0x41a237-0x0;var _0x276a84=_0x18d6[_0x41a237];return _0x276a84;};'use strict';var EventEmitter=require(_0x618d('0x0'));var ChatWebsite=require(_0x618d('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x618d('0x2')](0x0);var events={'afterCreate':_0x618d('0x3'),'afterUpdate':_0x618d('0x4'),'afterDestroy':_0x618d('0x5')};function emitEvent(_0x5f341a){return function(_0x3151de,_0x1a7716,_0x47d0b3){ChatWebsiteEvents[_0x618d('0x6')](_0x5f341a+':'+_0x3151de['id'],_0x3151de);ChatWebsiteEvents['emit'](_0x5f341a,_0x3151de);_0x47d0b3(null);};}for(var e in events){if(events[_0x618d('0x7')](e)){var event=events[e];ChatWebsite[_0x618d('0x8')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0x0a9a=['emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x28965f,_0x20a89d){var _0x34ea58=function(_0x4b0be7){while(--_0x4b0be7){_0x28965f['push'](_0x28965f['shift']());}};_0x34ea58(++_0x20a89d);}(_0x0a9a,0x183));var _0xa0a9=function(_0x5dabd9,_0x54b260){_0x5dabd9=_0x5dabd9-0x0;var _0x306636=_0x0a9a[_0x5dabd9];return _0x306636;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0xa0a9('0x0'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xa0a9('0x1')](0x0);var events={'afterCreate':_0xa0a9('0x2'),'afterUpdate':_0xa0a9('0x3'),'afterDestroy':_0xa0a9('0x4')};function emitEvent(_0x4ba993){return function(_0x317a94,_0x360be5,_0x50ea50){ChatWebsiteEvents[_0xa0a9('0x5')](_0x4ba993+':'+_0x317a94['id'],_0x317a94);ChatWebsiteEvents[_0xa0a9('0x5')](_0x4ba993,_0x317a94);_0x50ea50(null);};}for(var e in events){if(events[_0xa0a9('0x6')](e)){var event=events[e];ChatWebsite[_0xa0a9('0x7')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index e9c0cd5..4d05a5c 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 _0xc36d=['rimraf','./chatWebsite.attributes','exports','define','chat_websites','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0xa99c9f,_0x7765eb){var _0x531a95=function(_0x393233){while(--_0x393233){_0xa99c9f['push'](_0xa99c9f['shift']());}};_0x531a95(++_0x7765eb);}(_0xc36d,0x7d));var _0xdc36=function(_0x3b90ab,_0x174a22){_0x3b90ab=_0x3b90ab-0x0;var _0x206e92=_0xc36d[_0x3b90ab];return _0x206e92;};'use strict';var _=require(_0xdc36('0x0'));var util=require(_0xdc36('0x1'));var logger=require(_0xdc36('0x2'))(_0xdc36('0x3'));var moment=require(_0xdc36('0x4'));var BPromise=require(_0xdc36('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdc36('0x6'));var rimraf=require(_0xdc36('0x7'));var config=require('../../config/environment');var attributes=require(_0xdc36('0x8'));module[_0xdc36('0x9')]=function(_0x186c58,_0x11ad3b){return _0x186c58[_0xdc36('0xa')]('ChatWebsite',attributes,{'tableName':_0xdc36('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda3f=['../../config/environment','exports','ChatWebsite','chat_websites','util','../../config/logger','request-promise','rimraf'];(function(_0x2ec2c3,_0x30f34a){var _0x2e331d=function(_0x5b41cd){while(--_0x5b41cd){_0x2ec2c3['push'](_0x2ec2c3['shift']());}};_0x2e331d(++_0x30f34a);}(_0xda3f,0xec));var _0xfda3=function(_0x3d83d3,_0x57d3d9){_0x3d83d3=_0x3d83d3-0x0;var _0xba6c93=_0xda3f[_0x3d83d3];return _0xba6c93;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var logger=require(_0xfda3('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfda3('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var attributes=require('./chatWebsite.attributes');module[_0xfda3('0x5')]=function(_0x43a010,_0x47e7e2){return _0x43a010['define'](_0xfda3('0x6'),attributes,{'tableName':_0xfda3('0x7'),'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 03ea72f..9d7075e 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 _0x8e3f=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','request','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0xb1666b,_0x4c269e){var _0x110710=function(_0x25b803){while(--_0x25b803){_0xb1666b['push'](_0xb1666b['shift']());}};_0x110710(++_0x4c269e);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x8e3f[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xf8e3('0x0'));var util=require(_0xf8e3('0x1'));var moment=require(_0xf8e3('0x2'));var BPromise=require('bluebird');var rs=require(_0xf8e3('0x3'));var fs=require('fs');var Redis=require(_0xf8e3('0x4'));var db=require(_0xf8e3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf8e3('0x6'))(_0xf8e3('0x7'));var config=require('../../config/environment');var jayson=require(_0xf8e3('0x8'));var client=jayson[_0xf8e3('0x9')][_0xf8e3('0xa')]({'port':0x232a});config[_0xf8e3('0xb')]=_['defaults'](config[_0xf8e3('0xb')],{'host':_0xf8e3('0xc'),'port':0x18eb});var socket=require(_0xf8e3('0xd'))(new Redis(config[_0xf8e3('0xb')]));require(_0xf8e3('0xe'))[_0xf8e3('0xf')](socket);function respondWithRpcPromise(_0x299a7e,_0x2a3b59,_0x2d914d){return new BPromise(function(_0x2bc3cd,_0x28f5f0){return client[_0xf8e3('0x10')](_0x299a7e,_0x2d914d)['then'](function(_0xb7d14f){logger[_0xf8e3('0x11')](_0xf8e3('0x12'),_0x2a3b59,'request\x20sent');logger[_0xf8e3('0x13')](_0xf8e3('0x14'),_0x2a3b59,_0xf8e3('0x15'),JSON[_0xf8e3('0x16')](_0xb7d14f));if(_0xb7d14f['error']){if(_0xb7d14f[_0xf8e3('0x17')][_0xf8e3('0x18')]===0x1f4){logger[_0xf8e3('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x2a3b59,_0xb7d14f[_0xf8e3('0x17')]['message']);return _0x28f5f0(_0xb7d14f[_0xf8e3('0x17')][_0xf8e3('0x19')]);}logger[_0xf8e3('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x2a3b59,_0xb7d14f['error'][_0xf8e3('0x19')]);return _0x2bc3cd(_0xb7d14f[_0xf8e3('0x17')][_0xf8e3('0x19')]);}else{logger[_0xf8e3('0x11')](_0xf8e3('0x12'),_0x2a3b59,_0xf8e3('0x15'));_0x2bc3cd(_0xb7d14f[_0xf8e3('0x1a')][_0xf8e3('0x19')]);}})[_0xf8e3('0x1b')](function(_0x13fb31){logger['error'](_0xf8e3('0x12'),_0x2a3b59,_0x13fb31);_0x28f5f0(_0x13fb31);});});} \ No newline at end of file +var _0xfcf0=['ChatWebsite,\x20%s,\x20%s','message','info','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','request\x20sent','debug','stringify','error','code'];(function(_0x55c485,_0x3fe77e){var _0x6bb521=function(_0x466a3d){while(--_0x466a3d){_0x55c485['push'](_0x55c485['shift']());}};_0x6bb521(++_0x3fe77e);}(_0xfcf0,0x138));var _0x0fcf=function(_0x17882c,_0x4b964b){_0x17882c=_0x17882c-0x0;var _0x355a59=_0xfcf0[_0x17882c];return _0x355a59;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var moment=require('moment');var BPromise=require(_0x0fcf('0x2'));var rs=require(_0x0fcf('0x3'));var fs=require('fs');var Redis=require(_0x0fcf('0x4'));var db=require(_0x0fcf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0fcf('0x6'))(_0x0fcf('0x7'));var config=require(_0x0fcf('0x8'));var jayson=require(_0x0fcf('0x9'));var client=jayson[_0x0fcf('0xa')][_0x0fcf('0xb')]({'port':0x232a});config[_0x0fcf('0xc')]=_[_0x0fcf('0xd')](config['redis'],{'host':_0x0fcf('0xe'),'port':0x18eb});var socket=require(_0x0fcf('0xf'))(new Redis(config[_0x0fcf('0xc')]));require('./chatWebsite.socket')[_0x0fcf('0x10')](socket);function respondWithRpcPromise(_0x7ac7bd,_0x239e5d,_0x4b3923){return new BPromise(function(_0x369959,_0x5c29ed){return client[_0x0fcf('0x11')](_0x7ac7bd,_0x4b3923)[_0x0fcf('0x12')](function(_0x201a58){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x239e5d,_0x0fcf('0x13'));logger[_0x0fcf('0x14')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x239e5d,_0x0fcf('0x13'),JSON[_0x0fcf('0x15')](_0x201a58));if(_0x201a58[_0x0fcf('0x16')]){if(_0x201a58[_0x0fcf('0x16')][_0x0fcf('0x17')]===0x1f4){logger['error'](_0x0fcf('0x18'),_0x239e5d,_0x201a58[_0x0fcf('0x16')][_0x0fcf('0x19')]);return _0x5c29ed(_0x201a58['error'][_0x0fcf('0x19')]);}logger[_0x0fcf('0x16')](_0x0fcf('0x18'),_0x239e5d,_0x201a58[_0x0fcf('0x16')]['message']);return _0x369959(_0x201a58[_0x0fcf('0x16')][_0x0fcf('0x19')]);}else{logger[_0x0fcf('0x1a')](_0x0fcf('0x18'),_0x239e5d,_0x0fcf('0x13'));_0x369959(_0x201a58['result'][_0x0fcf('0x19')]);}})[_0x0fcf('0x1b')](function(_0x5dad87){logger[_0x0fcf('0x16')](_0x0fcf('0x18'),_0x239e5d,_0x5dad87);_0x5c29ed(_0x5dad87);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 4990381..c481762 100644 --- a/server/api/chatWebsite/chatWebsite.socket.js +++ b/server/api/chatWebsite/chatWebsite.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x4d770d,_0x5af4ce){var _0x11dc7a=function(_0x27d3f7){while(--_0x27d3f7){_0x4d770d['push'](_0x4d770d['shift']());}};_0x11dc7a(++_0x5af4ce);}(_0x5f2f,0x73));var _0xf5f2=function(_0x6af105,_0x5cbd36){_0x6af105=_0x6af105-0x0;var _0x1f1d48=_0x5f2f[_0x6af105];return _0x1f1d48;};'use strict';var ChatWebsiteEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatWebsiteEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatWebsiteEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file +var _0x5f2f=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x6b25ac,_0xe9fa01){var _0x4c84e9=function(_0x2bf6ec){while(--_0x2bf6ec){_0x6b25ac['push'](_0x6b25ac['shift']());}};_0x4c84e9(++_0xe9fa01);}(_0x5f2f,0x73));var _0xf5f2=function(_0x11e24e,_0x2b8bb1){_0x11e24e=_0x11e24e-0x0;var _0x2caedc=_0x5f2f[_0x11e24e];return _0x2caedc;};'use strict';var ChatWebsiteEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatWebsiteEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatWebsiteEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index f281ed7..db98bd3 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 _0x09e7=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getAvatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','getInteractions','/:id/snippet','getSnippet','/:id/applications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','addDisposition','addAnswer','diskStorage','root','server/files/images/logos/','%s-%s','now','single','addLogo','join','format','originalname','addAvatar','server/files/images/avatars/','notify','/:id/offline','offline','/:id/interactions','addApplications','addProactiveActions','update','delete','/:id','destroy','removeAnswers','removeAgents','exports','multer'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x09e7,0xb6));var _0x709e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0x09e7[_0x298ed3];return _0x5aad28;};'use strict';var multer=require(_0x709e('0x0'));var util=require(_0x709e('0x1'));var path=require(_0x709e('0x2'));var timeout=require(_0x709e('0x3'));var express=require(_0x709e('0x4'));var router=express['Router']();var auth=require(_0x709e('0x5'));var interaction=require(_0x709e('0x6'));var config=require(_0x709e('0x7'));var controller=require('./chatWebsite.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x709e('0x8')]('/describe',auth[_0x709e('0x9')](),controller[_0x709e('0xa')]);router['get']('/:id',auth[_0x709e('0x9')](),controller[_0x709e('0xb')]);router[_0x709e('0x8')](_0x709e('0xc'),auth[_0x709e('0x9')](),controller[_0x709e('0xd')]);router[_0x709e('0x8')](_0x709e('0xe'),auth[_0x709e('0x9')](),controller[_0x709e('0xf')]);router['get'](_0x709e('0x10'),controller['getLogo']);router[_0x709e('0x8')]('/:id/avatar',controller[_0x709e('0x11')]);router['get'](_0x709e('0x12'),controller['getCustomerAvatar']);router['get'](_0x709e('0x13'),controller[_0x709e('0x14')]);router[_0x709e('0x8')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x709e('0x15')]);router[_0x709e('0x8')](_0x709e('0x16'),controller[_0x709e('0x17')]);router['get'](_0x709e('0x18'),auth[_0x709e('0x9')](),controller['getApplications']);router[_0x709e('0x8')](_0x709e('0x19'),auth[_0x709e('0x9')](),controller[_0x709e('0x1a')]);router[_0x709e('0x8')](_0x709e('0x1b'),controller[_0x709e('0x1c')]);router[_0x709e('0x8')](_0x709e('0x1d'),auth[_0x709e('0x9')](),controller[_0x709e('0x1e')]);router[_0x709e('0x8')](_0x709e('0x1f'),auth[_0x709e('0x9')](),controller[_0x709e('0x20')]);router[_0x709e('0x21')]('/',auth[_0x709e('0x9')](),controller['create']);router['post'](_0x709e('0xc'),auth[_0x709e('0x9')](),controller[_0x709e('0x22')]);router[_0x709e('0x21')](_0x709e('0xe'),auth[_0x709e('0x9')](),controller[_0x709e('0x23')]);var upload=multer({'storage':multer[_0x709e('0x24')]({'destination':function(_0x2cf111,_0x426c64,_0x1be33c){_0x1be33c(null,path['join'](config[_0x709e('0x25')],_0x709e('0x26')));},'filename':function(_0x51431d,_0x4ee369,_0x4d7fc0){_0x4d7fc0(null,util['format'](_0x709e('0x27'),Date[_0x709e('0x28')](),_0x4ee369['originalname']));}})});router[_0x709e('0x21')](_0x709e('0x10'),upload[_0x709e('0x29')]('file'),controller[_0x709e('0x2a')]);var upload=multer({'storage':multer[_0x709e('0x24')]({'destination':function(_0x3cd983,_0x23f65a,_0x505dc3){_0x505dc3(null,path[_0x709e('0x2b')](config[_0x709e('0x25')],'server/files/images/avatars/'));},'filename':function(_0x4a66e7,_0x14aa0c,_0x465108){_0x465108(null,util[_0x709e('0x2c')]('%s-%s',Date['now'](),_0x14aa0c[_0x709e('0x2d')]));}})});router[_0x709e('0x21')]('/:id/avatar',upload[_0x709e('0x29')]('file'),controller[_0x709e('0x2e')]);var upload=multer({'storage':multer[_0x709e('0x24')]({'destination':function(_0x1cf64e,_0x4acd81,_0x3df21c){_0x3df21c(null,path[_0x709e('0x2b')](config['root'],_0x709e('0x2f')));},'filename':function(_0xa51a3d,_0x4a2efb,_0x265626){_0x265626(null,util[_0x709e('0x2c')](_0x709e('0x27'),Date[_0x709e('0x28')](),_0x4a2efb[_0x709e('0x2d')]));}})});router[_0x709e('0x21')](_0x709e('0x12'),upload[_0x709e('0x29')]('file'),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x709e('0x24')]({'destination':function(_0x548c00,_0x2e2daf,_0x48902f){_0x48902f(null,path['join'](config[_0x709e('0x25')],'server/files/images/avatars/'));},'filename':function(_0x1f54d1,_0x381911,_0x7f33ca){_0x7f33ca(null,util[_0x709e('0x2c')](_0x709e('0x27'),Date[_0x709e('0x28')](),_0x381911[_0x709e('0x2d')]));}})});router['post'](_0x709e('0x13'),upload[_0x709e('0x29')]('file'),controller['addSystemAvatar']);router[_0x709e('0x21')]('/:id/notify',controller[_0x709e('0x30')]);router[_0x709e('0x21')](_0x709e('0x31'),controller[_0x709e('0x32')]);router[_0x709e('0x21')](_0x709e('0x33'),auth[_0x709e('0x9')](),controller['addInteraction']);router[_0x709e('0x21')](_0x709e('0x18'),auth[_0x709e('0x9')](),controller[_0x709e('0x34')]);router[_0x709e('0x21')](_0x709e('0x19'),auth[_0x709e('0x9')](),controller[_0x709e('0x35')]);router['post'](_0x709e('0x1f'),auth[_0x709e('0x9')](),controller['addAgents']);router['put']('/:id',auth[_0x709e('0x9')](),controller[_0x709e('0x36')]);router[_0x709e('0x37')](_0x709e('0x38'),auth['isAuthenticated'](),controller[_0x709e('0x39')]);router['delete'](_0x709e('0xc'),auth['isAuthenticated'](),controller['removeDispositions']);router['delete'](_0x709e('0xe'),auth[_0x709e('0x9')](),controller[_0x709e('0x3a')]);router[_0x709e('0x37')](_0x709e('0x1f'),auth[_0x709e('0x9')](),controller[_0x709e('0x3b')]);module[_0x709e('0x3c')]=router; \ No newline at end of file +var _0x9f37=['file','addAvatar','/:id/customer_avatar','addCustomerAvatar','addSystemAvatar','/:id/notify','/:id/offline','offline','addApplications','addProactiveActions','addAgents','/:id','update','delete','destroy','removeDispositions','removeAgents','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/avatar','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','join','root','format','%s-%s','now','originalname','/:id/logo','single','addLogo','diskStorage','server/files/images/avatars/'];(function(_0x173e7c,_0x328213){var _0x5bdbb7=function(_0x32930f){while(--_0x32930f){_0x173e7c['push'](_0x173e7c['shift']());}};_0x5bdbb7(++_0x328213);}(_0x9f37,0xd1));var _0x79f3=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x9f37[_0xc4001c];return _0x49f7bc;};'use strict';var multer=require(_0x79f3('0x0'));var util=require(_0x79f3('0x1'));var path=require('path');var timeout=require(_0x79f3('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x79f3('0x3'));var interaction=require(_0x79f3('0x4'));var config=require(_0x79f3('0x5'));var controller=require('./chatWebsite.controller');router[_0x79f3('0x6')]('/',auth[_0x79f3('0x7')](),controller['index']);router['get'](_0x79f3('0x8'),auth[_0x79f3('0x7')](),controller[_0x79f3('0x9')]);router[_0x79f3('0x6')]('/:id',auth[_0x79f3('0x7')](),controller[_0x79f3('0xa')]);router['get'](_0x79f3('0xb'),auth[_0x79f3('0x7')](),controller[_0x79f3('0xc')]);router[_0x79f3('0x6')](_0x79f3('0xd'),auth['isAuthenticated'](),controller[_0x79f3('0xe')]);router[_0x79f3('0x6')]('/:id/logo',controller['getLogo']);router[_0x79f3('0x6')](_0x79f3('0xf'),controller[_0x79f3('0x10')]);router[_0x79f3('0x6')]('/:id/customer_avatar',controller[_0x79f3('0x11')]);router[_0x79f3('0x6')](_0x79f3('0x12'),controller[_0x79f3('0x13')]);router[_0x79f3('0x6')](_0x79f3('0x14'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x79f3('0x6')](_0x79f3('0x15'),controller['getSnippet']);router[_0x79f3('0x6')](_0x79f3('0x16'),auth[_0x79f3('0x7')](),controller[_0x79f3('0x17')]);router['get'](_0x79f3('0x18'),auth[_0x79f3('0x7')](),controller[_0x79f3('0x19')]);router[_0x79f3('0x6')](_0x79f3('0x1a'),controller[_0x79f3('0x1b')]);router[_0x79f3('0x6')](_0x79f3('0x1c'),auth[_0x79f3('0x7')](),controller[_0x79f3('0x1d')]);router[_0x79f3('0x6')](_0x79f3('0x1e'),auth[_0x79f3('0x7')](),controller[_0x79f3('0x1f')]);router[_0x79f3('0x20')]('/',auth[_0x79f3('0x7')](),controller[_0x79f3('0x21')]);router[_0x79f3('0x20')](_0x79f3('0xb'),auth[_0x79f3('0x7')](),controller[_0x79f3('0x22')]);router[_0x79f3('0x20')](_0x79f3('0xd'),auth[_0x79f3('0x7')](),controller[_0x79f3('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xc2122,_0x508966,_0x2b6ced){_0x2b6ced(null,path[_0x79f3('0x24')](config[_0x79f3('0x25')],'server/files/images/logos/'));},'filename':function(_0x4a9518,_0x1e8010,_0x142cfa){_0x142cfa(null,util[_0x79f3('0x26')](_0x79f3('0x27'),Date[_0x79f3('0x28')](),_0x1e8010[_0x79f3('0x29')]));}})});router['post'](_0x79f3('0x2a'),upload[_0x79f3('0x2b')]('file'),controller[_0x79f3('0x2c')]);var upload=multer({'storage':multer[_0x79f3('0x2d')]({'destination':function(_0x39ab86,_0x4c3c11,_0x4b0670){_0x4b0670(null,path[_0x79f3('0x24')](config[_0x79f3('0x25')],_0x79f3('0x2e')));},'filename':function(_0x337911,_0x205267,_0x69d14f){_0x69d14f(null,util[_0x79f3('0x26')](_0x79f3('0x27'),Date[_0x79f3('0x28')](),_0x205267[_0x79f3('0x29')]));}})});router[_0x79f3('0x20')](_0x79f3('0xf'),upload[_0x79f3('0x2b')](_0x79f3('0x2f')),controller[_0x79f3('0x30')]);var upload=multer({'storage':multer[_0x79f3('0x2d')]({'destination':function(_0x13b870,_0x29e665,_0x20108a){_0x20108a(null,path[_0x79f3('0x24')](config[_0x79f3('0x25')],'server/files/images/avatars/'));},'filename':function(_0x51a864,_0x36554f,_0x4f154f){_0x4f154f(null,util[_0x79f3('0x26')](_0x79f3('0x27'),Date[_0x79f3('0x28')](),_0x36554f['originalname']));}})});router[_0x79f3('0x20')](_0x79f3('0x31'),upload[_0x79f3('0x2b')]('file'),controller[_0x79f3('0x32')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xc3ca75,_0x49a237,_0x16d476){_0x16d476(null,path[_0x79f3('0x24')](config[_0x79f3('0x25')],_0x79f3('0x2e')));},'filename':function(_0x477e8a,_0x4fa06f,_0x1173d9){_0x1173d9(null,util[_0x79f3('0x26')](_0x79f3('0x27'),Date['now'](),_0x4fa06f['originalname']));}})});router[_0x79f3('0x20')](_0x79f3('0x12'),upload['single'](_0x79f3('0x2f')),controller[_0x79f3('0x33')]);router['post'](_0x79f3('0x34'),controller['notify']);router[_0x79f3('0x20')](_0x79f3('0x35'),controller[_0x79f3('0x36')]);router[_0x79f3('0x20')]('/:id/interactions',auth[_0x79f3('0x7')](),controller['addInteraction']);router[_0x79f3('0x20')](_0x79f3('0x16'),auth['isAuthenticated'](),controller[_0x79f3('0x37')]);router[_0x79f3('0x20')]('/:id/proactive_actions',auth[_0x79f3('0x7')](),controller[_0x79f3('0x38')]);router[_0x79f3('0x20')](_0x79f3('0x1e'),auth[_0x79f3('0x7')](),controller[_0x79f3('0x39')]);router['put'](_0x79f3('0x3a'),auth[_0x79f3('0x7')](),controller[_0x79f3('0x3b')]);router[_0x79f3('0x3c')]('/:id',auth['isAuthenticated'](),controller[_0x79f3('0x3d')]);router['delete'](_0x79f3('0xb'),auth[_0x79f3('0x7')](),controller[_0x79f3('0x3e')]);router[_0x79f3('0x3c')](_0x79f3('0xd'),auth[_0x79f3('0x7')](),controller['removeAnswers']);router[_0x79f3('0x3c')](_0x79f3('0x1e'),auth['isAuthenticated'](),controller[_0x79f3('0x3f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 6ca34dc..043b3aa 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 _0xc9b0=['exports','STRING','ENUM','AmazonAWS','Google','sequelize'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xc9b0,0x143));var _0x0c9b=function(_0x4b688f,_0x4e0ced){_0x4b688f=_0x4b688f-0x0;var _0xc47c6a=_0xc9b0[_0x4b688f];return _0xc47c6a;};'use strict';var Sequelize=require(_0x0c9b('0x0'));module[_0x0c9b('0x1')]={'name':{'type':Sequelize[_0x0c9b('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x0c9b('0x3')](_0x0c9b('0x4'),_0x0c9b('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x0c9b('0x2')]},'data2':{'type':Sequelize[_0x0c9b('0x2')]}}; \ No newline at end of file +var _0xa498=['AmazonAWS','Google','sequelize','exports','STRING'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0xa498,0x179));var _0x8a49=function(_0x4433b,_0x1eded1){_0x4433b=_0x4433b-0x0;var _0xffc1da=_0xa498[_0x4433b];return _0xffc1da;};'use strict';var Sequelize=require(_0x8a49('0x0'));module[_0x8a49('0x1')]={'name':{'type':Sequelize[_0x8a49('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x8a49('0x3'),_0x8a49('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x8a49('0x2')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index e8a0950..f2b96b4 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 _0x495c=['moment','bluebird','mustache','util','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','CloudProvider','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','html-pdf','rimraf','fast-json-patch','request-promise'];(function(_0x2e38e6,_0x459fc2){var _0x1d2089=function(_0x12ffc2){while(--_0x12ffc2){_0x2e38e6['push'](_0x2e38e6['shift']());}};_0x1d2089(++_0x459fc2);}(_0x495c,0x8c));var _0xc495=function(_0xd7efd6,_0x26fffb){_0xd7efd6=_0xd7efd6-0x0;var _0x2a9a1e=_0x495c[_0xd7efd6];return _0x2a9a1e;};'use strict';var pdf=require(_0xc495('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc495('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc495('0x2'));var rp=require(_0xc495('0x3'));var moment=require(_0xc495('0x4'));var BPromise=require(_0xc495('0x5'));var Mustache=require(_0xc495('0x6'));var util=require(_0xc495('0x7'));var path=require('path');var sox=require(_0xc495('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xc495('0x9'));var squel=require('squel');var crypto=require(_0xc495('0xa'));var jsforce=require(_0xc495('0xb'));var deskjs=require(_0xc495('0xc'));var toCsv=require(_0xc495('0xd'));var querystring=require(_0xc495('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc495('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc495('0x10'));var logger=require(_0xc495('0x11'))(_0xc495('0x12'));var utils=require(_0xc495('0x13'));var config=require(_0xc495('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4fab40,_0x4434ac){_0x4434ac=_0x4434ac||0xcc;return function(_0x30aa86){if(_0x30aa86){return _0x4fab40['sendStatus'](_0x4434ac);}return _0x4fab40[_0xc495('0x15')](_0x4434ac)['end']();};}function respondWithResult(_0x1ea3ff,_0x14ad4b){_0x14ad4b=_0x14ad4b||0xc8;return function(_0x577764){if(_0x577764){return _0x1ea3ff[_0xc495('0x15')](_0x14ad4b)[_0xc495('0x16')](_0x577764);}};}function respondWithFilteredResult(_0xf6b710,_0x39c992){return function(_0x5529e3){if(_0x5529e3){var _0x337a52=_0x5529e3[_0xc495('0x17')],_0x246359=_0x39c992[_0xc495('0x18')],_0x545686=_0x39c992[_0xc495('0x18')]+_0x39c992[_0xc495('0x19')],_0x439117;if(_0x545686>=_0x337a52){_0x545686=_0x337a52;_0x439117=0xc8;}else{_0x439117=0xce;}_0xf6b710[_0xc495('0x15')](_0x439117);return _0xf6b710[_0xc495('0x1a')](_0xc495('0x1b'),_0x246359+'-'+_0x545686+'/'+_0x337a52)[_0xc495('0x16')](_0x5529e3);}return null;};}function patchUpdates(_0x18492e){return function(_0x1ec0d9){try{jsonpatch[_0xc495('0x1c')](_0x1ec0d9,_0x18492e,!![]);}catch(_0x2811dd){return BPromise[_0xc495('0x1d')](_0x2811dd);}return _0x1ec0d9[_0xc495('0x1e')]();};}function saveUpdates(_0x1eb594,_0x1bb5ca){return function(_0x2366c3){if(_0x2366c3){return _0x2366c3[_0xc495('0x1f')](_0x1eb594)[_0xc495('0x20')](function(_0x2b10c1){return _0x2b10c1;});}return null;};}function removeEntity(_0x23aed2,_0x32d1ab){return function(_0x25fe03){if(_0x25fe03){return _0x25fe03[_0xc495('0x21')]()[_0xc495('0x20')](function(){_0x23aed2[_0xc495('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cc957,_0x351184){return function(_0x441817){if(!_0x441817){_0x3cc957[_0xc495('0x22')](0x194);}return _0x441817;};}function handleError(_0x5a9dea,_0x52f5dd){_0x52f5dd=_0x52f5dd||0x1f4;return function(_0x384e8c){logger[_0xc495('0x23')](_0x384e8c[_0xc495('0x24')]);if(_0x384e8c[_0xc495('0x25')]){delete _0x384e8c['name'];}_0x5a9dea['status'](_0x52f5dd)['send'](_0x384e8c);};}exports[_0xc495('0x26')]=function(_0x40c30d,_0x5dd94f){var _0xfdc478={},_0x549ee7={},_0x100002={'count':0x0,'rows':[]};var _0x27e8aa=_[_0xc495('0x27')](db[_0xc495('0x28')][_0xc495('0x29')],function(_0x6f5d40){return{'name':_0x6f5d40[_0xc495('0x2a')],'type':_0x6f5d40[_0xc495('0x2b')][_0xc495('0x2c')]};});_0x549ee7['model']=_[_0xc495('0x27')](_0x27e8aa,_0xc495('0x25'));_0x549ee7[_0xc495('0x2d')]=_[_0xc495('0x2e')](_0x40c30d['query']);_0x549ee7['filters']=_['intersection'](_0x549ee7[_0xc495('0x2f')],_0x549ee7[_0xc495('0x2d')]);_0xfdc478[_0xc495('0x30')]=_[_0xc495('0x31')](_0x549ee7[_0xc495('0x2f')],qs[_0xc495('0x32')](_0x40c30d[_0xc495('0x2d')][_0xc495('0x32')]));_0xfdc478[_0xc495('0x30')]=_0xfdc478[_0xc495('0x30')][_0xc495('0x33')]?_0xfdc478[_0xc495('0x30')]:_0x549ee7['model'];if(!_0x40c30d['query']['hasOwnProperty'](_0xc495('0x34'))){_0xfdc478[_0xc495('0x19')]=qs[_0xc495('0x19')](_0x40c30d[_0xc495('0x2d')]['limit']);_0xfdc478[_0xc495('0x18')]=qs[_0xc495('0x18')](_0x40c30d[_0xc495('0x2d')][_0xc495('0x18')]);}_0xfdc478[_0xc495('0x35')]=qs[_0xc495('0x36')](_0x40c30d[_0xc495('0x2d')]['sort']);_0xfdc478[_0xc495('0x37')]=qs[_0xc495('0x38')](_[_0xc495('0x39')](_0x40c30d['query'],_0x549ee7['filters']),_0x27e8aa);if(_0x40c30d[_0xc495('0x2d')][_0xc495('0x3a')]){_0xfdc478[_0xc495('0x37')]=_[_0xc495('0x3b')](_0xfdc478[_0xc495('0x37')],{'$or':_[_0xc495('0x27')](_0x27e8aa,function(_0xfcff3b){if(_0xfcff3b['type']!==_0xc495('0x3c')){var _0x5f0c00={};_0x5f0c00[_0xfcff3b[_0xc495('0x25')]]={'$like':'%'+_0x40c30d[_0xc495('0x2d')][_0xc495('0x3a')]+'%'};return _0x5f0c00;}})});}_0xfdc478=_['merge']({},_0xfdc478,_0x40c30d[_0xc495('0x3d')]);var _0x52d98f={'where':_0xfdc478[_0xc495('0x37')]};return db[_0xc495('0x28')][_0xc495('0x17')](_0x52d98f)[_0xc495('0x20')](function(_0x56972a){_0x100002[_0xc495('0x17')]=_0x56972a;if(_0x40c30d[_0xc495('0x2d')]['includeAll']){_0xfdc478[_0xc495('0x3e')]=[{'all':!![]}];}return db[_0xc495('0x28')][_0xc495('0x3f')](_0xfdc478);})[_0xc495('0x20')](function(_0x4e67d3){_0x100002[_0xc495('0x40')]=_0x4e67d3;return _0x100002;})[_0xc495('0x20')](respondWithFilteredResult(_0x5dd94f,_0xfdc478))[_0xc495('0x41')](handleError(_0x5dd94f,null));};exports[_0xc495('0x42')]=function(_0x154a04,_0xb81735){var _0xefd983={'raw':!![],'where':{'id':_0x154a04[_0xc495('0x43')]['id']}},_0x10b553={};_0x10b553[_0xc495('0x2f')]=_[_0xc495('0x2e')](db[_0xc495('0x28')]['rawAttributes']);_0x10b553[_0xc495('0x2d')]=_['keys'](_0x154a04[_0xc495('0x2d')]);_0x10b553[_0xc495('0x38')]=_[_0xc495('0x31')](_0x10b553[_0xc495('0x2f')],_0x10b553[_0xc495('0x2d')]);_0xefd983[_0xc495('0x30')]=_[_0xc495('0x31')](_0x10b553[_0xc495('0x2f')],qs[_0xc495('0x32')](_0x154a04['query']['fields']));_0xefd983[_0xc495('0x30')]=_0xefd983['attributes'][_0xc495('0x33')]?_0xefd983[_0xc495('0x30')]:_0x10b553[_0xc495('0x2f')];if(_0x154a04[_0xc495('0x2d')][_0xc495('0x44')]){_0xefd983[_0xc495('0x3e')]=[{'all':!![]}];}_0xefd983=_[_0xc495('0x3b')]({},_0xefd983,_0x154a04[_0xc495('0x3d')]);return db[_0xc495('0x28')][_0xc495('0x45')](_0xefd983)[_0xc495('0x20')](handleEntityNotFound(_0xb81735,null))[_0xc495('0x20')](respondWithResult(_0xb81735,null))[_0xc495('0x41')](handleError(_0xb81735,null));};exports[_0xc495('0x46')]=function(_0x159292,_0x5153a4){return db[_0xc495('0x28')][_0xc495('0x46')](_0x159292[_0xc495('0x47')],{})[_0xc495('0x20')](respondWithResult(_0x5153a4,0xc9))['catch'](handleError(_0x5153a4,null));};exports[_0xc495('0x1f')]=function(_0x3280f8,_0x56960f){if(_0x3280f8['body']['id']){delete _0x3280f8['body']['id'];}return db[_0xc495('0x28')][_0xc495('0x45')]({'where':{'id':_0x3280f8[_0xc495('0x43')]['id']}})[_0xc495('0x20')](handleEntityNotFound(_0x56960f,null))[_0xc495('0x20')](saveUpdates(_0x3280f8[_0xc495('0x47')],null))[_0xc495('0x20')](respondWithResult(_0x56960f,null))[_0xc495('0x41')](handleError(_0x56960f,null));};exports[_0xc495('0x21')]=function(_0x543d6b,_0x195d89){return db['CloudProvider']['find']({'where':{'id':_0x543d6b[_0xc495('0x43')]['id']}})['then'](handleEntityNotFound(_0x195d89,null))[_0xc495('0x20')](removeEntity(_0x195d89,null))['catch'](handleError(_0x195d89,null));}; \ No newline at end of file +var _0xc98a=['../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','CloudProvider','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','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/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x1d59a8,_0x489da7){var _0x44544d=function(_0x3858f4){while(--_0x3858f4){_0x1d59a8['push'](_0x1d59a8['shift']());}};_0x44544d(++_0x489da7);}(_0xc98a,0x83));var _0xac98=function(_0x1644f2,_0x2884e8){_0x1644f2=_0x1644f2-0x0;var _0x1fcb31=_0xc98a[_0x1644f2];return _0x1fcb31;};'use strict';var pdf=require(_0xac98('0x0'));var emlformat=require(_0xac98('0x1'));var rimraf=require(_0xac98('0x2'));var zipdir=require(_0xac98('0x3'));var jsonpatch=require(_0xac98('0x4'));var rp=require(_0xac98('0x5'));var moment=require(_0xac98('0x6'));var BPromise=require(_0xac98('0x7'));var Mustache=require(_0xac98('0x8'));var util=require(_0xac98('0x9'));var path=require(_0xac98('0xa'));var sox=require(_0xac98('0xb'));var csv=require(_0xac98('0xc'));var ejs=require(_0xac98('0xd'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xac98('0xe'));var jsforce=require(_0xac98('0xf'));var deskjs=require(_0xac98('0x10'));var toCsv=require(_0xac98('0xc'));var querystring=require(_0xac98('0x11'));var Papa=require(_0xac98('0x12'));var Redis=require(_0xac98('0x13'));var authService=require(_0xac98('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xac98('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac98('0x16'))(_0xac98('0x17'));var utils=require(_0xac98('0x18'));var config=require(_0xac98('0x19'));var db=require(_0xac98('0x1a'))['db'];function respondWithStatusCode(_0x59ec4e,_0x13a8fa){_0x13a8fa=_0x13a8fa||0xcc;return function(_0x20d46a){if(_0x20d46a){return _0x59ec4e['sendStatus'](_0x13a8fa);}return _0x59ec4e[_0xac98('0x1b')](_0x13a8fa)[_0xac98('0x1c')]();};}function respondWithResult(_0x234ce5,_0x241da6){_0x241da6=_0x241da6||0xc8;return function(_0x297f53){if(_0x297f53){return _0x234ce5[_0xac98('0x1b')](_0x241da6)[_0xac98('0x1d')](_0x297f53);}};}function respondWithFilteredResult(_0x4f7fea,_0x690cb5){return function(_0x4959e7){if(_0x4959e7){var _0x2b01b0=_0x4959e7[_0xac98('0x1e')],_0x5decb9=_0x690cb5[_0xac98('0x1f')],_0x324470=_0x690cb5[_0xac98('0x1f')]+_0x690cb5[_0xac98('0x20')],_0xad0106;if(_0x324470>=_0x2b01b0){_0x324470=_0x2b01b0;_0xad0106=0xc8;}else{_0xad0106=0xce;}_0x4f7fea[_0xac98('0x1b')](_0xad0106);return _0x4f7fea[_0xac98('0x21')](_0xac98('0x22'),_0x5decb9+'-'+_0x324470+'/'+_0x2b01b0)[_0xac98('0x1d')](_0x4959e7);}return null;};}function patchUpdates(_0x31a6f2){return function(_0x192b5e){try{jsonpatch[_0xac98('0x23')](_0x192b5e,_0x31a6f2,!![]);}catch(_0x386c96){return BPromise[_0xac98('0x24')](_0x386c96);}return _0x192b5e['save']();};}function saveUpdates(_0x259d76,_0x1cffb8){return function(_0x1142b9){if(_0x1142b9){return _0x1142b9[_0xac98('0x25')](_0x259d76)[_0xac98('0x26')](function(_0x4818ae){return _0x4818ae;});}return null;};}function removeEntity(_0x481069,_0x49216c){return function(_0x3811f0){if(_0x3811f0){return _0x3811f0[_0xac98('0x27')]()[_0xac98('0x26')](function(){_0x481069[_0xac98('0x1b')](0xcc)[_0xac98('0x1c')]();});}};}function handleEntityNotFound(_0x35052a,_0x41e36d){return function(_0x203ac9){if(!_0x203ac9){_0x35052a['sendStatus'](0x194);}return _0x203ac9;};}function handleError(_0x137a7d,_0x59a880){_0x59a880=_0x59a880||0x1f4;return function(_0x1664a0){logger[_0xac98('0x28')](_0x1664a0[_0xac98('0x29')]);if(_0x1664a0['name']){delete _0x1664a0[_0xac98('0x2a')];}_0x137a7d[_0xac98('0x1b')](_0x59a880)[_0xac98('0x2b')](_0x1664a0);};}exports[_0xac98('0x2c')]=function(_0x2e755e,_0x3b807f){var _0x1a3385={},_0x5ea2c7={},_0x231151={'count':0x0,'rows':[]};var _0x13509b=_[_0xac98('0x2d')](db[_0xac98('0x2e')][_0xac98('0x2f')],function(_0xd7982c){return{'name':_0xd7982c['fieldName'],'type':_0xd7982c['type'][_0xac98('0x30')]};});_0x5ea2c7[_0xac98('0x31')]=_[_0xac98('0x2d')](_0x13509b,'name');_0x5ea2c7[_0xac98('0x32')]=_[_0xac98('0x33')](_0x2e755e[_0xac98('0x32')]);_0x5ea2c7[_0xac98('0x34')]=_[_0xac98('0x35')](_0x5ea2c7[_0xac98('0x31')],_0x5ea2c7[_0xac98('0x32')]);_0x1a3385[_0xac98('0x36')]=_['intersection'](_0x5ea2c7[_0xac98('0x31')],qs[_0xac98('0x37')](_0x2e755e[_0xac98('0x32')][_0xac98('0x37')]));_0x1a3385[_0xac98('0x36')]=_0x1a3385[_0xac98('0x36')][_0xac98('0x38')]?_0x1a3385[_0xac98('0x36')]:_0x5ea2c7['model'];if(!_0x2e755e['query'][_0xac98('0x39')](_0xac98('0x3a'))){_0x1a3385[_0xac98('0x20')]=qs[_0xac98('0x20')](_0x2e755e['query'][_0xac98('0x20')]);_0x1a3385[_0xac98('0x1f')]=qs[_0xac98('0x1f')](_0x2e755e[_0xac98('0x32')]['offset']);}_0x1a3385[_0xac98('0x3b')]=qs[_0xac98('0x3c')](_0x2e755e[_0xac98('0x32')][_0xac98('0x3c')]);_0x1a3385['where']=qs[_0xac98('0x34')](_[_0xac98('0x3d')](_0x2e755e['query'],_0x5ea2c7[_0xac98('0x34')]),_0x13509b);if(_0x2e755e[_0xac98('0x32')][_0xac98('0x3e')]){_0x1a3385[_0xac98('0x3f')]=_[_0xac98('0x40')](_0x1a3385[_0xac98('0x3f')],{'$or':_[_0xac98('0x2d')](_0x13509b,function(_0x1654dc){if(_0x1654dc[_0xac98('0x41')]!==_0xac98('0x42')){var _0x103e9a={};_0x103e9a[_0x1654dc['name']]={'$like':'%'+_0x2e755e[_0xac98('0x32')][_0xac98('0x3e')]+'%'};return _0x103e9a;}})});}_0x1a3385=_[_0xac98('0x40')]({},_0x1a3385,_0x2e755e[_0xac98('0x43')]);var _0x2fe3e2={'where':_0x1a3385[_0xac98('0x3f')]};return db[_0xac98('0x2e')][_0xac98('0x1e')](_0x2fe3e2)[_0xac98('0x26')](function(_0x236130){_0x231151['count']=_0x236130;if(_0x2e755e['query'][_0xac98('0x44')]){_0x1a3385[_0xac98('0x45')]=[{'all':!![]}];}return db['CloudProvider'][_0xac98('0x46')](_0x1a3385);})[_0xac98('0x26')](function(_0x4396e3){_0x231151[_0xac98('0x47')]=_0x4396e3;return _0x231151;})[_0xac98('0x26')](respondWithFilteredResult(_0x3b807f,_0x1a3385))[_0xac98('0x48')](handleError(_0x3b807f,null));};exports[_0xac98('0x49')]=function(_0x5de6bd,_0x6ee21){var _0x2bc35a={'raw':!![],'where':{'id':_0x5de6bd[_0xac98('0x4a')]['id']}},_0x2150d9={};_0x2150d9[_0xac98('0x31')]=_[_0xac98('0x33')](db[_0xac98('0x2e')][_0xac98('0x2f')]);_0x2150d9['query']=_[_0xac98('0x33')](_0x5de6bd['query']);_0x2150d9[_0xac98('0x34')]=_[_0xac98('0x35')](_0x2150d9[_0xac98('0x31')],_0x2150d9['query']);_0x2bc35a[_0xac98('0x36')]=_['intersection'](_0x2150d9[_0xac98('0x31')],qs[_0xac98('0x37')](_0x5de6bd[_0xac98('0x32')][_0xac98('0x37')]));_0x2bc35a[_0xac98('0x36')]=_0x2bc35a[_0xac98('0x36')][_0xac98('0x38')]?_0x2bc35a[_0xac98('0x36')]:_0x2150d9[_0xac98('0x31')];if(_0x5de6bd[_0xac98('0x32')][_0xac98('0x44')]){_0x2bc35a['include']=[{'all':!![]}];}_0x2bc35a=_[_0xac98('0x40')]({},_0x2bc35a,_0x5de6bd['options']);return db[_0xac98('0x2e')][_0xac98('0x4b')](_0x2bc35a)[_0xac98('0x26')](handleEntityNotFound(_0x6ee21,null))[_0xac98('0x26')](respondWithResult(_0x6ee21,null))[_0xac98('0x48')](handleError(_0x6ee21,null));};exports['create']=function(_0x3ea4d8,_0x1e5501){return db[_0xac98('0x2e')][_0xac98('0x4c')](_0x3ea4d8['body'],{})[_0xac98('0x26')](respondWithResult(_0x1e5501,0xc9))[_0xac98('0x48')](handleError(_0x1e5501,null));};exports[_0xac98('0x25')]=function(_0x16bcde,_0x224d9d){if(_0x16bcde[_0xac98('0x4d')]['id']){delete _0x16bcde[_0xac98('0x4d')]['id'];}return db[_0xac98('0x2e')]['find']({'where':{'id':_0x16bcde[_0xac98('0x4a')]['id']}})[_0xac98('0x26')](handleEntityNotFound(_0x224d9d,null))[_0xac98('0x26')](saveUpdates(_0x16bcde['body'],null))[_0xac98('0x26')](respondWithResult(_0x224d9d,null))[_0xac98('0x48')](handleError(_0x224d9d,null));};exports[_0xac98('0x27')]=function(_0x36e875,_0xe429fa){return db[_0xac98('0x2e')][_0xac98('0x4b')]({'where':{'id':_0x36e875['params']['id']}})[_0xac98('0x26')](handleEntityNotFound(_0xe429fa,null))[_0xac98('0x26')](removeEntity(_0xe429fa,null))[_0xac98('0x48')](handleError(_0xe429fa,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index fa6eab9..3efa32a 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 _0x2d3c=['bluebird','request-promise','path','rimraf','../../config/environment','exports','CloudProvider','cloud_providers','lodash','util','../../config/logger','api'];(function(_0x56418c,_0xd90668){var _0x1c838d=function(_0x222bb8){while(--_0x222bb8){_0x56418c['push'](_0x56418c['shift']());}};_0x1c838d(++_0xd90668);}(_0x2d3c,0x128));var _0xc2d3=function(_0x4cc2d5,_0x397ddf){_0x4cc2d5=_0x4cc2d5-0x0;var _0x3c095e=_0x2d3c[_0x4cc2d5];return _0x3c095e;};'use strict';var _=require(_0xc2d3('0x0'));var util=require(_0xc2d3('0x1'));var logger=require(_0xc2d3('0x2'))(_0xc2d3('0x3'));var moment=require('moment');var BPromise=require(_0xc2d3('0x4'));var rp=require(_0xc2d3('0x5'));var fs=require('fs');var path=require(_0xc2d3('0x6'));var rimraf=require(_0xc2d3('0x7'));var config=require(_0xc2d3('0x8'));var attributes=require('./cloudProvider.attributes');module[_0xc2d3('0x9')]=function(_0x3363b9,_0x1b6601){return _0x3363b9['define'](_0xc2d3('0xa'),attributes,{'tableName':_0xc2d3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d14=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','CloudProvider','cloud_providers'];(function(_0x5d43fd,_0x1c1821){var _0x3303ae=function(_0x59af16){while(--_0x59af16){_0x5d43fd['push'](_0x5d43fd['shift']());}};_0x3303ae(++_0x1c1821);}(_0x8d14,0x134));var _0x48d1=function(_0x1f05b8,_0x26057e){_0x1f05b8=_0x1f05b8-0x0;var _0x177cf1=_0x8d14[_0x1f05b8];return _0x177cf1;};'use strict';var _=require(_0x48d1('0x0'));var util=require(_0x48d1('0x1'));var logger=require(_0x48d1('0x2'))(_0x48d1('0x3'));var moment=require(_0x48d1('0x4'));var BPromise=require(_0x48d1('0x5'));var rp=require(_0x48d1('0x6'));var fs=require('fs');var path=require(_0x48d1('0x7'));var rimraf=require(_0x48d1('0x8'));var config=require(_0x48d1('0x9'));var attributes=require('./cloudProvider.attributes');module[_0x48d1('0xa')]=function(_0x3b0690,_0x387247){return _0x3b0690[_0x48d1('0xb')](_0x48d1('0xc'),attributes,{'tableName':_0x48d1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 7be3e12..bcb6398 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 _0x7956=['result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x595e64,_0x5d2189){var _0x5c13bd=function(_0x486b90){while(--_0x486b90){_0x595e64['push'](_0x595e64['shift']());}};_0x5c13bd(++_0x5d2189);}(_0x7956,0x158));var _0x6795=function(_0x34d19b,_0x11f89a){_0x34d19b=_0x34d19b-0x0;var _0x2595f8=_0x7956[_0x34d19b];return _0x2595f8;};'use strict';var _=require(_0x6795('0x0'));var util=require(_0x6795('0x1'));var moment=require(_0x6795('0x2'));var BPromise=require(_0x6795('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6795('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6795('0x5'));var logger=require(_0x6795('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6795('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4b65a2,_0x280877,_0x42c335){return new BPromise(function(_0x3d0848,_0xed3d50){return client['request'](_0x4b65a2,_0x42c335)[_0x6795('0x8')](function(_0x2b54e8){logger[_0x6795('0x9')](_0x6795('0xa'),_0x280877,_0x6795('0xb'));logger[_0x6795('0xc')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x280877,_0x6795('0xb'),JSON[_0x6795('0xd')](_0x2b54e8));if(_0x2b54e8['error']){if(_0x2b54e8['error']['code']===0x1f4){logger[_0x6795('0xe')]('CloudProvider,\x20%s,\x20%s',_0x280877,_0x2b54e8['error'][_0x6795('0xf')]);return _0xed3d50(_0x2b54e8[_0x6795('0xe')][_0x6795('0xf')]);}logger['error'](_0x6795('0xa'),_0x280877,_0x2b54e8[_0x6795('0xe')][_0x6795('0xf')]);return _0x3d0848(_0x2b54e8[_0x6795('0xe')][_0x6795('0xf')]);}else{logger[_0x6795('0x9')](_0x6795('0xa'),_0x280877,'request\x20sent');_0x3d0848(_0x2b54e8[_0x6795('0x10')][_0x6795('0xf')]);}})[_0x6795('0x11')](function(_0xfeccb6){logger[_0x6795('0xe')](_0x6795('0xa'),_0x280877,_0xfeccb6);_0xed3d50(_0xfeccb6);});});} \ No newline at end of file +var _0x365b=['CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x365b,0x149));var _0xb365=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x365b[_0x3054be];return _0x3df150;};'use strict';var _=require(_0xb365('0x0'));var util=require(_0xb365('0x1'));var moment=require(_0xb365('0x2'));var BPromise=require(_0xb365('0x3'));var rs=require(_0xb365('0x4'));var fs=require('fs');var Redis=require(_0xb365('0x5'));var db=require(_0xb365('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb365('0x7'));var config=require(_0xb365('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb365('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2cf4d4,_0x2cc148,_0x152876){return new BPromise(function(_0x38197f,_0x397a3d){return client[_0xb365('0xa')](_0x2cf4d4,_0x152876)[_0xb365('0xb')](function(_0x54b0db){logger[_0xb365('0xc')](_0xb365('0xd'),_0x2cc148,_0xb365('0xe'));logger[_0xb365('0xf')](_0xb365('0x10'),_0x2cc148,_0xb365('0xe'),JSON[_0xb365('0x11')](_0x54b0db));if(_0x54b0db[_0xb365('0x12')]){if(_0x54b0db[_0xb365('0x12')][_0xb365('0x13')]===0x1f4){logger[_0xb365('0x12')](_0xb365('0xd'),_0x2cc148,_0x54b0db['error'][_0xb365('0x14')]);return _0x397a3d(_0x54b0db['error'][_0xb365('0x14')]);}logger[_0xb365('0x12')](_0xb365('0xd'),_0x2cc148,_0x54b0db[_0xb365('0x12')]['message']);return _0x38197f(_0x54b0db[_0xb365('0x12')][_0xb365('0x14')]);}else{logger[_0xb365('0xc')](_0xb365('0xd'),_0x2cc148,_0xb365('0xe'));_0x38197f(_0x54b0db[_0xb365('0x15')][_0xb365('0x14')]);}})[_0xb365('0x16')](function(_0x71d1bb){logger[_0xb365('0x12')]('CloudProvider,\x20%s,\x20%s',_0x2cc148,_0x71d1bb);_0x397a3d(_0x71d1bb);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 3caddb6..be402a4 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 _0x25cd=['connect-timeout','express','Router','../../components/interaction/service','./cloudProvider.controller','get','isAuthenticated','/:id','post','create','update','delete','destroy','exports','util','path'];(function(_0x13842e,_0x391709){var _0x240941=function(_0x50bc16){while(--_0x50bc16){_0x13842e['push'](_0x13842e['shift']());}};_0x240941(++_0x391709);}(_0x25cd,0x11e));var _0xd25c=function(_0x149a41,_0x3cbb44){_0x149a41=_0x149a41-0x0;var _0x10132c=_0x25cd[_0x149a41];return _0x10132c;};'use strict';var multer=require('multer');var util=require(_0xd25c('0x0'));var path=require(_0xd25c('0x1'));var timeout=require(_0xd25c('0x2'));var express=require(_0xd25c('0x3'));var router=express[_0xd25c('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd25c('0x5'));var config=require('../../config/environment');var controller=require(_0xd25c('0x6'));router[_0xd25c('0x7')]('/',auth[_0xd25c('0x8')](),controller['index']);router['get'](_0xd25c('0x9'),auth[_0xd25c('0x8')](),controller['show']);router[_0xd25c('0xa')]('/',auth[_0xd25c('0x8')](),controller[_0xd25c('0xb')]);router['put'](_0xd25c('0x9'),auth[_0xd25c('0x8')](),controller[_0xd25c('0xc')]);router[_0xd25c('0xd')](_0xd25c('0x9'),auth[_0xd25c('0x8')](),controller[_0xd25c('0xe')]);module[_0xd25c('0xf')]=router; \ No newline at end of file +var _0x3074=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','isAuthenticated','index','get','/:id','show','post'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x3074,0x1a8));var _0x4307=function(_0x58b905,_0x370f4b){_0x58b905=_0x58b905-0x0;var _0x374a75=_0x3074[_0x58b905];return _0x374a75;};'use strict';var multer=require(_0x4307('0x0'));var util=require(_0x4307('0x1'));var path=require(_0x4307('0x2'));var timeout=require(_0x4307('0x3'));var express=require(_0x4307('0x4'));var router=express[_0x4307('0x5')]();var auth=require(_0x4307('0x6'));var interaction=require(_0x4307('0x7'));var config=require(_0x4307('0x8'));var controller=require(_0x4307('0x9'));router['get']('/',auth[_0x4307('0xa')](),controller[_0x4307('0xb')]);router[_0x4307('0xc')](_0x4307('0xd'),auth[_0x4307('0xa')](),controller[_0x4307('0xe')]);router[_0x4307('0xf')]('/',auth[_0x4307('0xa')](),controller[_0x4307('0x10')]);router[_0x4307('0x11')](_0x4307('0xd'),auth[_0x4307('0xa')](),controller[_0x4307('0x12')]);router[_0x4307('0x13')](_0x4307('0xd'),auth[_0x4307('0xa')](),controller[_0x4307('0x14')]);module[_0x4307('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index bc8fa90..133ff20 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 _0x5f81=['sequelize','exports','STRING','name'];(function(_0x4c05da,_0x414720){var _0x1614db=function(_0xa19cf6){while(--_0xa19cf6){_0x4c05da['push'](_0x4c05da['shift']());}};_0x1614db(++_0x414720);}(_0x5f81,0x124));var _0x15f8=function(_0x551643,_0x1eb990){_0x551643=_0x551643-0x0;var _0x157d86=_0x5f81[_0x551643];return _0x157d86;};'use strict';var Sequelize=require(_0x15f8('0x0'));module[_0x15f8('0x1')]={'name':{'type':Sequelize[_0x15f8('0x2')],'unique':_0x15f8('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x15f8('0x2')]},'companyId':{'type':Sequelize[_0x15f8('0x2')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x15f8('0x2')]},'fax':{'type':Sequelize[_0x15f8('0x2')]},'type':{'type':Sequelize[_0x15f8('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x15f8('0x2')]},'city':{'type':Sequelize[_0x15f8('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x15f8('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x15f8('0x2')]},'sCountry':{'type':Sequelize[_0x15f8('0x2')]},'description':{'type':Sequelize[_0x15f8('0x2')]}}; \ No newline at end of file +var _0x34ac=['STRING','sequelize','exports'];(function(_0x478444,_0x1595dd){var _0x2fd3bc=function(_0x4c3a84){while(--_0x4c3a84){_0x478444['push'](_0x478444['shift']());}};_0x2fd3bc(++_0x1595dd);}(_0x34ac,0xf1));var _0xc34a=function(_0x3a257f,_0x3f30a0){_0x3a257f=_0x3a257f-0x0;var _0xec65bd=_0x34ac[_0x3a257f];return _0xec65bd;};'use strict';var Sequelize=require(_0xc34a('0x0'));module[_0xc34a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0xc34a('0x2')]},'website':{'type':Sequelize[_0xc34a('0x2')]},'phone':{'type':Sequelize[_0xc34a('0x2')]},'fax':{'type':Sequelize[_0xc34a('0x2')]},'type':{'type':Sequelize[_0xc34a('0x2')]},'street':{'type':Sequelize[_0xc34a('0x2')]},'postalCode':{'type':Sequelize[_0xc34a('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xc34a('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xc34a('0x2')]},'sStreet':{'type':Sequelize[_0xc34a('0x2')]},'sPostalCode':{'type':Sequelize[_0xc34a('0x2')]},'sCity':{'type':Sequelize[_0xc34a('0x2')]},'sCountry':{'type':Sequelize[_0xc34a('0x2')]},'description':{'type':Sequelize[_0xc34a('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 8724a6c..17ea2d9 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 _0xcb91=['status','end','json','offset','limit','set','apply','reject','save','update','then','destroy','get','Companies','UserProfileResource','sendStatus','error','stack','name','send','index','CmCompany','model','keys','query','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','options','count','includeAll','include','findAll','rows','catch','show','rawAttributes','merge','find','create','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addContacts','CmContact','ids','getContacts','findOne','order','map','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0x2dd12a,_0x441a94){var _0x52069c=function(_0x34591e){while(--_0x34591e){_0x2dd12a['push'](_0x2dd12a['shift']());}};_0x52069c(++_0x441a94);}(_0xcb91,0x141));var _0x1cb9=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0xcb91[_0x279d37];return _0x530173;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1cb9('0x0'));var rimraf=require(_0x1cb9('0x1'));var zipdir=require(_0x1cb9('0x2'));var jsonpatch=require(_0x1cb9('0x3'));var rp=require(_0x1cb9('0x4'));var moment=require('moment');var BPromise=require(_0x1cb9('0x5'));var Mustache=require(_0x1cb9('0x6'));var util=require(_0x1cb9('0x7'));var path=require(_0x1cb9('0x8'));var sox=require('sox');var csv=require(_0x1cb9('0x9'));var ejs=require(_0x1cb9('0xa'));var fs=require('fs');var _=require(_0x1cb9('0xb'));var squel=require(_0x1cb9('0xc'));var crypto=require(_0x1cb9('0xd'));var jsforce=require(_0x1cb9('0xe'));var deskjs=require(_0x1cb9('0xf'));var toCsv=require(_0x1cb9('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0x10'));var authService=require(_0x1cb9('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1cb9('0x12'));var hardwareService=require(_0x1cb9('0x13'));var logger=require(_0x1cb9('0x14'))(_0x1cb9('0x15'));var utils=require('../../config/utils');var config=require(_0x1cb9('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25140d,_0x1c4866){_0x1c4866=_0x1c4866||0xcc;return function(_0x1da979){if(_0x1da979){return _0x25140d['sendStatus'](_0x1c4866);}return _0x25140d[_0x1cb9('0x17')](_0x1c4866)[_0x1cb9('0x18')]();};}function respondWithResult(_0x4706ef,_0x3e59f3){_0x3e59f3=_0x3e59f3||0xc8;return function(_0x555cfd){if(_0x555cfd){return _0x4706ef[_0x1cb9('0x17')](_0x3e59f3)[_0x1cb9('0x19')](_0x555cfd);}};}function respondWithFilteredResult(_0x573f3,_0x229662){return function(_0x9be84f){if(_0x9be84f){var _0x5966e9=_0x9be84f['count'],_0x16327a=_0x229662['offset'],_0x5a036a=_0x229662[_0x1cb9('0x1a')]+_0x229662[_0x1cb9('0x1b')],_0x4dc15f;if(_0x5a036a>=_0x5966e9){_0x5a036a=_0x5966e9;_0x4dc15f=0xc8;}else{_0x4dc15f=0xce;}_0x573f3[_0x1cb9('0x17')](_0x4dc15f);return _0x573f3[_0x1cb9('0x1c')]('Content-Range',_0x16327a+'-'+_0x5a036a+'/'+_0x5966e9)['json'](_0x9be84f);}return null;};}function patchUpdates(_0x47d891){return function(_0x4974ef){try{jsonpatch[_0x1cb9('0x1d')](_0x4974ef,_0x47d891,!![]);}catch(_0x27a35f){return BPromise[_0x1cb9('0x1e')](_0x27a35f);}return _0x4974ef[_0x1cb9('0x1f')]();};}function saveUpdates(_0xa083f4,_0x17b2ff){return function(_0x15f153){if(_0x15f153){return _0x15f153[_0x1cb9('0x20')](_0xa083f4)[_0x1cb9('0x21')](function(_0x690b86){return _0x690b86;});}return null;};}function removeEntity(_0x224762,_0x250d3a){return function(_0x46fdeb){if(_0x46fdeb){return _0x46fdeb[_0x1cb9('0x22')]()[_0x1cb9('0x21')](function(){var _0x3eabca=_0x46fdeb[_0x1cb9('0x23')]({'plain':!![]});var _0x59e194=_0x1cb9('0x24');return db[_0x1cb9('0x25')][_0x1cb9('0x22')]({'where':{'type':_0x59e194,'resourceId':_0x3eabca['id']}})[_0x1cb9('0x21')](function(){return _0x46fdeb;});})[_0x1cb9('0x21')](function(){_0x224762[_0x1cb9('0x17')](0xcc)[_0x1cb9('0x18')]();});}};}function handleEntityNotFound(_0x570276,_0x57e110){return function(_0x21175f){if(!_0x21175f){_0x570276[_0x1cb9('0x26')](0x194);}return _0x21175f;};}function handleError(_0x5f86bb,_0x4e83ca){_0x4e83ca=_0x4e83ca||0x1f4;return function(_0x2c7728){logger[_0x1cb9('0x27')](_0x2c7728[_0x1cb9('0x28')]);if(_0x2c7728['name']){delete _0x2c7728[_0x1cb9('0x29')];}_0x5f86bb[_0x1cb9('0x17')](_0x4e83ca)[_0x1cb9('0x2a')](_0x2c7728);};}exports[_0x1cb9('0x2b')]=function(_0x1c9acf,_0x14b577){var _0x4a63e8={},_0x3eb6ff={},_0x1372b4={'count':0x0,'rows':[]};return db[_0x1cb9('0x2c')]['describe']()[_0x1cb9('0x21')](function(_0x9f2ebf){_0x3eb6ff[_0x1cb9('0x2d')]=_[_0x1cb9('0x2e')](_0x9f2ebf);_0x3eb6ff[_0x1cb9('0x2f')]=_[_0x1cb9('0x2e')](_0x1c9acf[_0x1cb9('0x2f')]);_0x3eb6ff[_0x1cb9('0x30')]=_['intersection'](_0x3eb6ff[_0x1cb9('0x2d')],_0x3eb6ff['query']);_0x4a63e8[_0x1cb9('0x31')]=_[_0x1cb9('0x32')](_0x3eb6ff['model'],qs[_0x1cb9('0x33')](_0x1c9acf['query'][_0x1cb9('0x33')]));_0x4a63e8[_0x1cb9('0x31')]=_0x4a63e8[_0x1cb9('0x31')][_0x1cb9('0x34')]?_0x4a63e8[_0x1cb9('0x31')]:_0x3eb6ff[_0x1cb9('0x2d')];if(!_0x1c9acf[_0x1cb9('0x2f')]['hasOwnProperty'](_0x1cb9('0x35'))){_0x4a63e8[_0x1cb9('0x1b')]=qs[_0x1cb9('0x1b')](_0x1c9acf['query'][_0x1cb9('0x1b')]);_0x4a63e8[_0x1cb9('0x1a')]=qs[_0x1cb9('0x1a')](_0x1c9acf[_0x1cb9('0x2f')]['offset']);}_0x4a63e8['order']=qs[_0x1cb9('0x36')](_0x1c9acf[_0x1cb9('0x2f')][_0x1cb9('0x36')]);_0x4a63e8[_0x1cb9('0x37')]=qs[_0x1cb9('0x30')](_[_0x1cb9('0x38')](_0x1c9acf[_0x1cb9('0x2f')],_0x3eb6ff[_0x1cb9('0x30')]),_0x9f2ebf);if(_0x1c9acf[_0x1cb9('0x2f')][_0x1cb9('0x39')]){_0x4a63e8[_0x1cb9('0x37')]=_['merge'](_0x4a63e8['where'],{'$or':_['map'](_0x4a63e8[_0x1cb9('0x31')],function(_0x3f15b5){var _0x26795e={};_0x26795e[_0x3f15b5]={'$like':'%'+_0x1c9acf[_0x1cb9('0x2f')]['filter']+'%'};return _0x26795e;})});}_0x4a63e8=_['merge']({},_0x4a63e8,_0x1c9acf[_0x1cb9('0x3a')]);var _0x4ddbde={'where':_0x4a63e8[_0x1cb9('0x37')]};return db[_0x1cb9('0x2c')][_0x1cb9('0x3b')](_0x4ddbde)[_0x1cb9('0x21')](function(_0x214858){_0x1372b4[_0x1cb9('0x3b')]=_0x214858;if(_0x1c9acf[_0x1cb9('0x2f')][_0x1cb9('0x3c')]){_0x4a63e8[_0x1cb9('0x3d')]=[{'all':!![]}];}return db[_0x1cb9('0x2c')][_0x1cb9('0x3e')](_0x4a63e8);})[_0x1cb9('0x21')](function(_0x1162f4){_0x1372b4[_0x1cb9('0x3f')]=_0x1162f4;return _0x1372b4;})[_0x1cb9('0x21')](respondWithFilteredResult(_0x14b577,_0x4a63e8))[_0x1cb9('0x40')](handleError(_0x14b577,null));})[_0x1cb9('0x40')](handleError(_0x14b577,null));};exports[_0x1cb9('0x41')]=function(_0x47c75a,_0x5c4699){var _0x4665aa={'raw':![],'where':{'id':_0x47c75a['params']['id']}},_0x4e0e10={};_0x4e0e10['model']=_[_0x1cb9('0x2e')](db['CmCompany'][_0x1cb9('0x42')]);_0x4e0e10['query']=_[_0x1cb9('0x2e')](_0x47c75a[_0x1cb9('0x2f')]);_0x4e0e10['filters']=_[_0x1cb9('0x32')](_0x4e0e10[_0x1cb9('0x2d')],_0x4e0e10['query']);_0x4665aa[_0x1cb9('0x31')]=_['intersection'](_0x4e0e10[_0x1cb9('0x2d')],qs[_0x1cb9('0x33')](_0x47c75a[_0x1cb9('0x2f')][_0x1cb9('0x33')]));_0x4665aa[_0x1cb9('0x31')]=_0x4665aa[_0x1cb9('0x31')][_0x1cb9('0x34')]?_0x4665aa[_0x1cb9('0x31')]:_0x4e0e10[_0x1cb9('0x2d')];if(_0x47c75a[_0x1cb9('0x2f')][_0x1cb9('0x3c')]){_0x4665aa[_0x1cb9('0x3d')]=[{'all':!![]}];}_0x4665aa=_[_0x1cb9('0x43')]({},_0x4665aa,_0x47c75a['options']);return db['CmCompany'][_0x1cb9('0x44')](_0x4665aa)[_0x1cb9('0x21')](handleEntityNotFound(_0x5c4699,null))['then'](respondWithResult(_0x5c4699,null))[_0x1cb9('0x40')](handleError(_0x5c4699,null));};exports[_0x1cb9('0x45')]=function(_0x11565a,_0x17fff3){return db['CmCompany'][_0x1cb9('0x45')](_0x11565a['body'],{})['then'](function(_0x51d5d9){var _0x58c3a0=_0x11565a[_0x1cb9('0x46')][_0x1cb9('0x23')]({'plain':!![]});if(!_0x58c3a0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x58c3a0[_0x1cb9('0x47')]===_0x1cb9('0x46')){var _0x4c3699=_0x51d5d9[_0x1cb9('0x23')]({'plain':!![]});var _0x4dbb39=_0x1cb9('0x24');return db[_0x1cb9('0x48')]['find']({'where':{'name':_0x4dbb39,'userProfileId':_0x58c3a0[_0x1cb9('0x49')]},'raw':!![]})[_0x1cb9('0x21')](function(_0x3981b9){if(_0x3981b9&&_0x3981b9['autoAssociation']===0x0){return db[_0x1cb9('0x25')][_0x1cb9('0x45')]({'name':_0x4c3699['name'],'resourceId':_0x4c3699['id'],'type':_0x3981b9[_0x1cb9('0x29')],'sectionId':_0x3981b9['id']},{})['then'](function(){return _0x51d5d9;});}else{return _0x51d5d9;}})[_0x1cb9('0x40')](function(_0x10853c){logger[_0x1cb9('0x27')](_0x1cb9('0x4a'),_0x10853c);throw _0x10853c;});}return _0x51d5d9;})[_0x1cb9('0x21')](respondWithResult(_0x17fff3,0xc9))['catch'](handleError(_0x17fff3,null));};exports[_0x1cb9('0x20')]=function(_0x5e9301,_0x1a9765){if(_0x5e9301['body']['id']){delete _0x5e9301[_0x1cb9('0x4b')]['id'];}return db[_0x1cb9('0x2c')][_0x1cb9('0x44')]({'where':{'id':_0x5e9301[_0x1cb9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1a9765,null))[_0x1cb9('0x21')](saveUpdates(_0x5e9301[_0x1cb9('0x4b')],null))['then'](respondWithResult(_0x1a9765,null))[_0x1cb9('0x40')](handleError(_0x1a9765,null));};exports[_0x1cb9('0x22')]=function(_0x4a5255,_0x119ff2){return db[_0x1cb9('0x2c')]['find']({'where':{'id':_0x4a5255[_0x1cb9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x119ff2,null))['then'](removeEntity(_0x119ff2,null))[_0x1cb9('0x40')](handleError(_0x119ff2,null));};exports[_0x1cb9('0x4d')]=function(_0x607ea,_0x1df119){return db[_0x1cb9('0x2c')][_0x1cb9('0x4d')]()[_0x1cb9('0x21')](respondWithResult(_0x1df119,null))[_0x1cb9('0x40')](handleError(_0x1df119,null));};exports[_0x1cb9('0x4e')]=function(_0xa3964a,_0x134bfc,_0x5d3873){return db[_0x1cb9('0x4f')][_0x1cb9('0x44')]({'where':{'id':_0xa3964a[_0x1cb9('0x4c')]['id']}})[_0x1cb9('0x21')](handleEntityNotFound(_0x134bfc,null))[_0x1cb9('0x21')](function(_0x50953d){if(_0x50953d){return _0x50953d[_0x1cb9('0x4e')](_0xa3964a['body'][_0x1cb9('0x50')],_['omit'](_0xa3964a[_0x1cb9('0x4b')],[_0x1cb9('0x50'),'id'])||{});}})[_0x1cb9('0x21')](respondWithResult(_0x134bfc,null))[_0x1cb9('0x40')](handleError(_0x134bfc,null));};exports[_0x1cb9('0x51')]=function(_0x4b1ada,_0x22bdb8,_0x51ac63){var _0x30ec9d={};var _0x3fef55={};var _0x14bf1a;var _0x7090b;return db['CmCompany'][_0x1cb9('0x52')]({'where':{'id':_0x4b1ada['params']['id']}})['then'](handleEntityNotFound(_0x22bdb8,null))[_0x1cb9('0x21')](function(_0x2f5bf8){if(_0x2f5bf8){_0x14bf1a=_0x2f5bf8;_0x3fef55[_0x1cb9('0x2d')]=_[_0x1cb9('0x2e')](db[_0x1cb9('0x4f')]['rawAttributes']);_0x3fef55[_0x1cb9('0x2f')]=_[_0x1cb9('0x2e')](_0x4b1ada[_0x1cb9('0x2f')]);_0x3fef55['filters']=_[_0x1cb9('0x32')](_0x3fef55[_0x1cb9('0x2d')],_0x3fef55[_0x1cb9('0x2f')]);_0x30ec9d[_0x1cb9('0x31')]=_[_0x1cb9('0x32')](_0x3fef55['model'],qs[_0x1cb9('0x33')](_0x4b1ada[_0x1cb9('0x2f')][_0x1cb9('0x33')]));_0x30ec9d[_0x1cb9('0x31')]=_0x30ec9d[_0x1cb9('0x31')]['length']?_0x30ec9d['attributes']:_0x3fef55[_0x1cb9('0x2d')];_0x30ec9d[_0x1cb9('0x53')]=qs['sort'](_0x4b1ada[_0x1cb9('0x2f')][_0x1cb9('0x36')]);_0x30ec9d[_0x1cb9('0x37')]=qs['filters'](_['pick'](_0x4b1ada['query'],_0x3fef55[_0x1cb9('0x30')]));if(_0x4b1ada[_0x1cb9('0x2f')][_0x1cb9('0x39')]){_0x30ec9d[_0x1cb9('0x37')]=_['merge'](_0x30ec9d['where'],{'$or':_[_0x1cb9('0x54')](_0x30ec9d[_0x1cb9('0x31')],function(_0x1bbd6b){var _0xd09f12={};_0xd09f12[_0x1bbd6b]={'$like':'%'+_0x4b1ada['query']['filter']+'%'};return _0xd09f12;})});}_0x30ec9d=_[_0x1cb9('0x43')]({},_0x30ec9d,_0x4b1ada[_0x1cb9('0x3a')]);return _0x14bf1a[_0x1cb9('0x51')](_0x30ec9d);}})['then'](function(_0x8bfaaf){if(_0x8bfaaf){_0x7090b=_0x8bfaaf['length'];if(!_0x4b1ada[_0x1cb9('0x2f')][_0x1cb9('0x55')](_0x1cb9('0x35'))){_0x30ec9d[_0x1cb9('0x1b')]=qs['limit'](_0x4b1ada[_0x1cb9('0x2f')][_0x1cb9('0x1b')]);_0x30ec9d[_0x1cb9('0x1a')]=qs[_0x1cb9('0x1a')](_0x4b1ada[_0x1cb9('0x2f')][_0x1cb9('0x1a')]);}return _0x14bf1a['getContacts'](_0x30ec9d);}})[_0x1cb9('0x21')](function(_0x4449c5){if(_0x4449c5){return _0x4449c5?{'count':_0x7090b,'rows':_0x4449c5}:null;}})[_0x1cb9('0x21')](respondWithResult(_0x22bdb8,null))['catch'](handleError(_0x22bdb8,null));}; \ No newline at end of file +var _0xa3ad=['nolimit','sort','pick','filter','where','merge','options','count','includeAll','include','findAll','catch','show','params','find','create','user','get','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addContacts','ids','omit','findOne','rawAttributes','getContacts','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','json','offset','limit','set','Content-Range','apply','save','update','then','Companies','UserProfileResource','destroy','sendStatus','name','send','CmCompany','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty'];(function(_0x1bc8fd,_0x394c0e){var _0x360730=function(_0x2a198c){while(--_0x2a198c){_0x1bc8fd['push'](_0x1bc8fd['shift']());}};_0x360730(++_0x394c0e);}(_0xa3ad,0x1a4));var _0xda3a=function(_0x2964a3,_0x4c4e27){_0x2964a3=_0x2964a3-0x0;var _0x7f2a9a=_0xa3ad[_0x2964a3];return _0x7f2a9a;};'use strict';var pdf=require(_0xda3a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xda3a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xda3a('0x2'));var rp=require(_0xda3a('0x3'));var moment=require('moment');var BPromise=require(_0xda3a('0x4'));var Mustache=require(_0xda3a('0x5'));var util=require('util');var path=require(_0xda3a('0x6'));var sox=require(_0xda3a('0x7'));var csv=require('to-csv');var ejs=require(_0xda3a('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xda3a('0x9'));var crypto=require(_0xda3a('0xa'));var jsforce=require(_0xda3a('0xb'));var deskjs=require(_0xda3a('0xc'));var toCsv=require(_0xda3a('0xd'));var querystring=require(_0xda3a('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xda3a('0xf'));var qs=require(_0xda3a('0x10'));var as=require(_0xda3a('0x11'));var hardwareService=require(_0xda3a('0x12'));var logger=require(_0xda3a('0x13'))(_0xda3a('0x14'));var utils=require(_0xda3a('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb0b955,_0x1a1201){_0x1a1201=_0x1a1201||0xcc;return function(_0x37d8d9){if(_0x37d8d9){return _0xb0b955['sendStatus'](_0x1a1201);}return _0xb0b955[_0xda3a('0x16')](_0x1a1201)['end']();};}function respondWithResult(_0x3d131b,_0x228ca7){_0x228ca7=_0x228ca7||0xc8;return function(_0x1c0052){if(_0x1c0052){return _0x3d131b[_0xda3a('0x16')](_0x228ca7)[_0xda3a('0x17')](_0x1c0052);}};}function respondWithFilteredResult(_0x1a7821,_0x290ae7){return function(_0x2f994c){if(_0x2f994c){var _0x167805=_0x2f994c['count'],_0x246ced=_0x290ae7[_0xda3a('0x18')],_0x39ec54=_0x290ae7['offset']+_0x290ae7[_0xda3a('0x19')],_0x1d8160;if(_0x39ec54>=_0x167805){_0x39ec54=_0x167805;_0x1d8160=0xc8;}else{_0x1d8160=0xce;}_0x1a7821[_0xda3a('0x16')](_0x1d8160);return _0x1a7821[_0xda3a('0x1a')](_0xda3a('0x1b'),_0x246ced+'-'+_0x39ec54+'/'+_0x167805)['json'](_0x2f994c);}return null;};}function patchUpdates(_0x58340c){return function(_0x609930){try{jsonpatch[_0xda3a('0x1c')](_0x609930,_0x58340c,!![]);}catch(_0x2674b2){return BPromise['reject'](_0x2674b2);}return _0x609930[_0xda3a('0x1d')]();};}function saveUpdates(_0x2b3bf5,_0x2f132c){return function(_0x220dde){if(_0x220dde){return _0x220dde[_0xda3a('0x1e')](_0x2b3bf5)[_0xda3a('0x1f')](function(_0x1f2d2c){return _0x1f2d2c;});}return null;};}function removeEntity(_0x3580d4,_0x4473cf){return function(_0x2d0fee){if(_0x2d0fee){return _0x2d0fee['destroy']()[_0xda3a('0x1f')](function(){var _0x169d8d=_0x2d0fee['get']({'plain':!![]});var _0x40d306=_0xda3a('0x20');return db[_0xda3a('0x21')][_0xda3a('0x22')]({'where':{'type':_0x40d306,'resourceId':_0x169d8d['id']}})[_0xda3a('0x1f')](function(){return _0x2d0fee;});})['then'](function(){_0x3580d4[_0xda3a('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c1ace,_0x1e453d){return function(_0x232888){if(!_0x232888){_0x3c1ace[_0xda3a('0x23')](0x194);}return _0x232888;};}function handleError(_0x4d1dcd,_0x1765cd){_0x1765cd=_0x1765cd||0x1f4;return function(_0x5dbed1){logger['error'](_0x5dbed1['stack']);if(_0x5dbed1['name']){delete _0x5dbed1[_0xda3a('0x24')];}_0x4d1dcd[_0xda3a('0x16')](_0x1765cd)[_0xda3a('0x25')](_0x5dbed1);};}exports['index']=function(_0x184ead,_0x247c2a){var _0x1b2b80={},_0x29aca8={},_0x34bb89={'count':0x0,'rows':[]};return db[_0xda3a('0x26')]['describe']()[_0xda3a('0x1f')](function(_0x1a6ee2){_0x29aca8['model']=_[_0xda3a('0x27')](_0x1a6ee2);_0x29aca8[_0xda3a('0x28')]=_[_0xda3a('0x27')](_0x184ead[_0xda3a('0x28')]);_0x29aca8[_0xda3a('0x29')]=_[_0xda3a('0x2a')](_0x29aca8[_0xda3a('0x2b')],_0x29aca8['query']);_0x1b2b80[_0xda3a('0x2c')]=_[_0xda3a('0x2a')](_0x29aca8[_0xda3a('0x2b')],qs[_0xda3a('0x2d')](_0x184ead['query'][_0xda3a('0x2d')]));_0x1b2b80[_0xda3a('0x2c')]=_0x1b2b80[_0xda3a('0x2c')][_0xda3a('0x2e')]?_0x1b2b80[_0xda3a('0x2c')]:_0x29aca8[_0xda3a('0x2b')];if(!_0x184ead[_0xda3a('0x28')][_0xda3a('0x2f')](_0xda3a('0x30'))){_0x1b2b80[_0xda3a('0x19')]=qs[_0xda3a('0x19')](_0x184ead[_0xda3a('0x28')][_0xda3a('0x19')]);_0x1b2b80[_0xda3a('0x18')]=qs[_0xda3a('0x18')](_0x184ead[_0xda3a('0x28')][_0xda3a('0x18')]);}_0x1b2b80['order']=qs[_0xda3a('0x31')](_0x184ead[_0xda3a('0x28')][_0xda3a('0x31')]);_0x1b2b80['where']=qs[_0xda3a('0x29')](_[_0xda3a('0x32')](_0x184ead[_0xda3a('0x28')],_0x29aca8[_0xda3a('0x29')]),_0x1a6ee2);if(_0x184ead[_0xda3a('0x28')][_0xda3a('0x33')]){_0x1b2b80[_0xda3a('0x34')]=_[_0xda3a('0x35')](_0x1b2b80[_0xda3a('0x34')],{'$or':_['map'](_0x1b2b80[_0xda3a('0x2c')],function(_0x455e45){var _0x1bd7fb={};_0x1bd7fb[_0x455e45]={'$like':'%'+_0x184ead[_0xda3a('0x28')][_0xda3a('0x33')]+'%'};return _0x1bd7fb;})});}_0x1b2b80=_[_0xda3a('0x35')]({},_0x1b2b80,_0x184ead[_0xda3a('0x36')]);var _0x16573c={'where':_0x1b2b80[_0xda3a('0x34')]};return db[_0xda3a('0x26')][_0xda3a('0x37')](_0x16573c)[_0xda3a('0x1f')](function(_0x468c0a){_0x34bb89['count']=_0x468c0a;if(_0x184ead[_0xda3a('0x28')][_0xda3a('0x38')]){_0x1b2b80[_0xda3a('0x39')]=[{'all':!![]}];}return db[_0xda3a('0x26')][_0xda3a('0x3a')](_0x1b2b80);})[_0xda3a('0x1f')](function(_0x595ed1){_0x34bb89['rows']=_0x595ed1;return _0x34bb89;})[_0xda3a('0x1f')](respondWithFilteredResult(_0x247c2a,_0x1b2b80))['catch'](handleError(_0x247c2a,null));})[_0xda3a('0x3b')](handleError(_0x247c2a,null));};exports[_0xda3a('0x3c')]=function(_0x35e2af,_0x35a26b){var _0x1b466a={'raw':![],'where':{'id':_0x35e2af[_0xda3a('0x3d')]['id']}},_0x4b3a20={};_0x4b3a20[_0xda3a('0x2b')]=_['keys'](db[_0xda3a('0x26')]['rawAttributes']);_0x4b3a20['query']=_[_0xda3a('0x27')](_0x35e2af[_0xda3a('0x28')]);_0x4b3a20[_0xda3a('0x29')]=_['intersection'](_0x4b3a20['model'],_0x4b3a20['query']);_0x1b466a['attributes']=_['intersection'](_0x4b3a20['model'],qs['fields'](_0x35e2af[_0xda3a('0x28')][_0xda3a('0x2d')]));_0x1b466a[_0xda3a('0x2c')]=_0x1b466a[_0xda3a('0x2c')][_0xda3a('0x2e')]?_0x1b466a['attributes']:_0x4b3a20[_0xda3a('0x2b')];if(_0x35e2af[_0xda3a('0x28')][_0xda3a('0x38')]){_0x1b466a[_0xda3a('0x39')]=[{'all':!![]}];}_0x1b466a=_[_0xda3a('0x35')]({},_0x1b466a,_0x35e2af[_0xda3a('0x36')]);return db[_0xda3a('0x26')][_0xda3a('0x3e')](_0x1b466a)[_0xda3a('0x1f')](handleEntityNotFound(_0x35a26b,null))[_0xda3a('0x1f')](respondWithResult(_0x35a26b,null))['catch'](handleError(_0x35a26b,null));};exports[_0xda3a('0x3f')]=function(_0x386d74,_0x1cbb8c){return db[_0xda3a('0x26')]['create'](_0x386d74['body'],{})[_0xda3a('0x1f')](function(_0xd38c5d){var _0x564a2a=_0x386d74[_0xda3a('0x40')][_0xda3a('0x41')]({'plain':!![]});if(!_0x564a2a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x564a2a[_0xda3a('0x42')]===_0xda3a('0x40')){var _0x5402aa=_0xd38c5d[_0xda3a('0x41')]({'plain':!![]});var _0x161703=_0xda3a('0x20');return db[_0xda3a('0x43')][_0xda3a('0x3e')]({'where':{'name':_0x161703,'userProfileId':_0x564a2a[_0xda3a('0x44')]},'raw':!![]})[_0xda3a('0x1f')](function(_0x2a1deb){if(_0x2a1deb&&_0x2a1deb['autoAssociation']===0x0){return db[_0xda3a('0x21')]['create']({'name':_0x5402aa['name'],'resourceId':_0x5402aa['id'],'type':_0x2a1deb[_0xda3a('0x24')],'sectionId':_0x2a1deb['id']},{})[_0xda3a('0x1f')](function(){return _0xd38c5d;});}else{return _0xd38c5d;}})[_0xda3a('0x3b')](function(_0x381f9f){logger['error'](_0xda3a('0x45'),_0x381f9f);throw _0x381f9f;});}return _0xd38c5d;})['then'](respondWithResult(_0x1cbb8c,0xc9))[_0xda3a('0x3b')](handleError(_0x1cbb8c,null));};exports[_0xda3a('0x1e')]=function(_0x484eb9,_0x109456){if(_0x484eb9[_0xda3a('0x46')]['id']){delete _0x484eb9[_0xda3a('0x46')]['id'];}return db[_0xda3a('0x26')][_0xda3a('0x3e')]({'where':{'id':_0x484eb9['params']['id']}})['then'](handleEntityNotFound(_0x109456,null))['then'](saveUpdates(_0x484eb9['body'],null))['then'](respondWithResult(_0x109456,null))[_0xda3a('0x3b')](handleError(_0x109456,null));};exports[_0xda3a('0x22')]=function(_0x251005,_0x57cf30){return db['CmCompany'][_0xda3a('0x3e')]({'where':{'id':_0x251005[_0xda3a('0x3d')]['id']}})[_0xda3a('0x1f')](handleEntityNotFound(_0x57cf30,null))[_0xda3a('0x1f')](removeEntity(_0x57cf30,null))['catch'](handleError(_0x57cf30,null));};exports[_0xda3a('0x47')]=function(_0x29ebc3,_0x515d21){return db['CmCompany']['describe']()['then'](respondWithResult(_0x515d21,null))[_0xda3a('0x3b')](handleError(_0x515d21,null));};exports[_0xda3a('0x48')]=function(_0x34e2d2,_0x13864f,_0x1e2362){return db['CmContact'][_0xda3a('0x3e')]({'where':{'id':_0x34e2d2[_0xda3a('0x3d')]['id']}})[_0xda3a('0x1f')](handleEntityNotFound(_0x13864f,null))[_0xda3a('0x1f')](function(_0x3e2340){if(_0x3e2340){return _0x3e2340[_0xda3a('0x48')](_0x34e2d2[_0xda3a('0x46')][_0xda3a('0x49')],_[_0xda3a('0x4a')](_0x34e2d2[_0xda3a('0x46')],[_0xda3a('0x49'),'id'])||{});}})[_0xda3a('0x1f')](respondWithResult(_0x13864f,null))['catch'](handleError(_0x13864f,null));};exports['getContacts']=function(_0x46a54b,_0x927315,_0x4fc35e){var _0x47334d={};var _0x2b699c={};var _0x2f567b;var _0x32a4bd;return db[_0xda3a('0x26')][_0xda3a('0x4b')]({'where':{'id':_0x46a54b['params']['id']}})[_0xda3a('0x1f')](handleEntityNotFound(_0x927315,null))[_0xda3a('0x1f')](function(_0x473cb9){if(_0x473cb9){_0x2f567b=_0x473cb9;_0x2b699c[_0xda3a('0x2b')]=_[_0xda3a('0x27')](db['CmContact'][_0xda3a('0x4c')]);_0x2b699c[_0xda3a('0x28')]=_[_0xda3a('0x27')](_0x46a54b[_0xda3a('0x28')]);_0x2b699c[_0xda3a('0x29')]=_[_0xda3a('0x2a')](_0x2b699c['model'],_0x2b699c['query']);_0x47334d[_0xda3a('0x2c')]=_['intersection'](_0x2b699c['model'],qs[_0xda3a('0x2d')](_0x46a54b[_0xda3a('0x28')][_0xda3a('0x2d')]));_0x47334d[_0xda3a('0x2c')]=_0x47334d[_0xda3a('0x2c')]['length']?_0x47334d[_0xda3a('0x2c')]:_0x2b699c['model'];_0x47334d['order']=qs[_0xda3a('0x31')](_0x46a54b[_0xda3a('0x28')]['sort']);_0x47334d[_0xda3a('0x34')]=qs[_0xda3a('0x29')](_[_0xda3a('0x32')](_0x46a54b[_0xda3a('0x28')],_0x2b699c['filters']));if(_0x46a54b[_0xda3a('0x28')][_0xda3a('0x33')]){_0x47334d[_0xda3a('0x34')]=_[_0xda3a('0x35')](_0x47334d[_0xda3a('0x34')],{'$or':_['map'](_0x47334d['attributes'],function(_0x2ece75){var _0x3296ea={};_0x3296ea[_0x2ece75]={'$like':'%'+_0x46a54b['query'][_0xda3a('0x33')]+'%'};return _0x3296ea;})});}_0x47334d=_['merge']({},_0x47334d,_0x46a54b['options']);return _0x2f567b[_0xda3a('0x4d')](_0x47334d);}})[_0xda3a('0x1f')](function(_0x90efa9){if(_0x90efa9){_0x32a4bd=_0x90efa9[_0xda3a('0x2e')];if(!_0x46a54b[_0xda3a('0x28')][_0xda3a('0x2f')](_0xda3a('0x30'))){_0x47334d['limit']=qs[_0xda3a('0x19')](_0x46a54b['query'][_0xda3a('0x19')]);_0x47334d[_0xda3a('0x18')]=qs[_0xda3a('0x18')](_0x46a54b[_0xda3a('0x28')]['offset']);}return _0x2f567b[_0xda3a('0x4d')](_0x47334d);}})[_0xda3a('0x1f')](function(_0x58ed02){if(_0x58ed02){return _0x58ed02?{'count':_0x32a4bd,'rows':_0x58ed02}:null;}})[_0xda3a('0x1f')](respondWithResult(_0x927315,null))[_0xda3a('0x3b')](handleError(_0x927315,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 85da320..c14a356 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 _0x6bff=['api','bluebird','request-promise','path','rimraf','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6bff,0xa6));var _0xf6bf=function(_0x28779f,_0x56a41b){_0x28779f=_0x28779f-0x0;var _0xa4b2f7=_0x6bff[_0x28779f];return _0xa4b2f7;};'use strict';var _=require(_0xf6bf('0x0'));var util=require(_0xf6bf('0x1'));var logger=require('../../config/logger')(_0xf6bf('0x2'));var moment=require('moment');var BPromise=require(_0xf6bf('0x3'));var rp=require(_0xf6bf('0x4'));var fs=require('fs');var path=require(_0xf6bf('0x5'));var rimraf=require(_0xf6bf('0x6'));var config=require('../../config/environment');var attributes=require(_0xf6bf('0x7'));module[_0xf6bf('0x8')]=function(_0x27cdda,_0x239d17){return _0x27cdda[_0xf6bf('0x9')](_0xf6bf('0xa'),attributes,{'tableName':_0xf6bf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c49=['cm_companies','lodash','util','moment','request-promise','path','./cmCompany.attributes','exports','define','CmCompany'];(function(_0x378720,_0xa711f1){var _0x47920a=function(_0xc5056){while(--_0xc5056){_0x378720['push'](_0x378720['shift']());}};_0x47920a(++_0xa711f1);}(_0x7c49,0x141));var _0x97c4=function(_0x51d405,_0x1fe78f){_0x51d405=_0x51d405-0x0;var _0x5230cd=_0x7c49[_0x51d405];return _0x5230cd;};'use strict';var _=require(_0x97c4('0x0'));var util=require(_0x97c4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x97c4('0x2'));var BPromise=require('bluebird');var rp=require(_0x97c4('0x3'));var fs=require('fs');var path=require(_0x97c4('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x97c4('0x5'));module[_0x97c4('0x6')]=function(_0x2f02ec,_0x538c14){return _0x2f02ec[_0x97c4('0x7')](_0x97c4('0x8'),attributes,{'tableName':_0x97c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 780dd99..160e033 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 _0xd419=['http','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x53b5b4,_0x5e04b3){var _0x5e325d=function(_0x2cc90b){while(--_0x2cc90b){_0x53b5b4['push'](_0x53b5b4['shift']());}};_0x5e325d(++_0x5e04b3);}(_0xd419,0xac));var _0x9d41=function(_0x547bb6,_0x2d6f27){_0x547bb6=_0x547bb6-0x0;var _0x1a9154=_0xd419[_0x547bb6];return _0x1a9154;};'use strict';var _=require('lodash');var util=require(_0x9d41('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9d41('0x1'));var fs=require('fs');var Redis=require(_0x9d41('0x2'));var db=require(_0x9d41('0x3'))['db'];var utils=require(_0x9d41('0x4'));var logger=require(_0x9d41('0x5'))(_0x9d41('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9d41('0x7')][_0x9d41('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x58f635,_0x26a50f,_0x33fb8d){return new BPromise(function(_0x38e104,_0x29c3ae){return client['request'](_0x58f635,_0x33fb8d)[_0x9d41('0x9')](function(_0x3bf5ee){logger[_0x9d41('0xa')](_0x9d41('0xb'),_0x26a50f,_0x9d41('0xc'));logger[_0x9d41('0xd')](_0x9d41('0xe'),_0x26a50f,'request\x20sent',JSON[_0x9d41('0xf')](_0x3bf5ee));if(_0x3bf5ee[_0x9d41('0x10')]){if(_0x3bf5ee[_0x9d41('0x10')][_0x9d41('0x11')]===0x1f4){logger['error'](_0x9d41('0xb'),_0x26a50f,_0x3bf5ee[_0x9d41('0x10')][_0x9d41('0x12')]);return _0x29c3ae(_0x3bf5ee[_0x9d41('0x10')][_0x9d41('0x12')]);}logger['error'](_0x9d41('0xb'),_0x26a50f,_0x3bf5ee['error'][_0x9d41('0x12')]);return _0x38e104(_0x3bf5ee[_0x9d41('0x10')][_0x9d41('0x12')]);}else{logger[_0x9d41('0xa')]('CmCompany,\x20%s,\x20%s',_0x26a50f,_0x9d41('0xc'));_0x38e104(_0x3bf5ee['result'][_0x9d41('0x12')]);}})[_0x9d41('0x13')](function(_0x1db63f){logger[_0x9d41('0x10')]('CmCompany,\x20%s,\x20%s',_0x26a50f,_0x1db63f);_0x29c3ae(_0x1db63f);});});} \ No newline at end of file +var _0x76dc=['debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmCompany,\x20%s,\x20%s','result','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent'];(function(_0x5edc7a,_0xbcf2bb){var _0xc9ea94=function(_0x54e7ee){while(--_0x54e7ee){_0x5edc7a['push'](_0x5edc7a['shift']());}};_0xc9ea94(++_0xbcf2bb);}(_0x76dc,0x1c1));var _0xc76d=function(_0x4eab9c,_0x30170e){_0x4eab9c=_0x4eab9c-0x0;var _0x380397=_0x76dc[_0x4eab9c];return _0x380397;};'use strict';var _=require('lodash');var util=require(_0xc76d('0x0'));var moment=require(_0xc76d('0x1'));var BPromise=require('bluebird');var rs=require(_0xc76d('0x2'));var fs=require('fs');var Redis=require(_0xc76d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc76d('0x4'));var logger=require('../../config/logger')(_0xc76d('0x5'));var config=require(_0xc76d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc76d('0x7')][_0xc76d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f0085,_0x4cc61d,_0x1e4f92){return new BPromise(function(_0x3ef7d4,_0x21e39a){return client[_0xc76d('0x9')](_0x3f0085,_0x1e4f92)[_0xc76d('0xa')](function(_0x23f09e){logger[_0xc76d('0xb')]('CmCompany,\x20%s,\x20%s',_0x4cc61d,_0xc76d('0xc'));logger[_0xc76d('0xd')](_0xc76d('0xe'),_0x4cc61d,_0xc76d('0xc'),JSON[_0xc76d('0xf')](_0x23f09e));if(_0x23f09e[_0xc76d('0x10')]){if(_0x23f09e[_0xc76d('0x10')][_0xc76d('0x11')]===0x1f4){logger['error']('CmCompany,\x20%s,\x20%s',_0x4cc61d,_0x23f09e[_0xc76d('0x10')][_0xc76d('0x12')]);return _0x21e39a(_0x23f09e[_0xc76d('0x10')][_0xc76d('0x12')]);}logger[_0xc76d('0x10')](_0xc76d('0x13'),_0x4cc61d,_0x23f09e[_0xc76d('0x10')][_0xc76d('0x12')]);return _0x3ef7d4(_0x23f09e[_0xc76d('0x10')][_0xc76d('0x12')]);}else{logger['info'](_0xc76d('0x13'),_0x4cc61d,'request\x20sent');_0x3ef7d4(_0x23f09e[_0xc76d('0x14')][_0xc76d('0x12')]);}})['catch'](function(_0x1578d9){logger[_0xc76d('0x10')](_0xc76d('0x13'),_0x4cc61d,_0x1578d9);_0x21e39a(_0x1578d9);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 31fa575..b3d4d62 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 _0x32b6=['put','update','destroy','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','/:id/contacts','addContacts'];(function(_0x1d92d4,_0x2448f1){var _0xa1d523=function(_0x317759){while(--_0x317759){_0x1d92d4['push'](_0x1d92d4['shift']());}};_0xa1d523(++_0x2448f1);}(_0x32b6,0x1d1));var _0x632b=function(_0xbb9b48,_0x45e172){_0xbb9b48=_0xbb9b48-0x0;var _0x3e8bf7=_0x32b6[_0xbb9b48];return _0x3e8bf7;};'use strict';var multer=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var path=require('path');var timeout=require(_0x632b('0x2'));var express=require(_0x632b('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x632b('0x4'));var config=require(_0x632b('0x5'));var controller=require(_0x632b('0x6'));router[_0x632b('0x7')]('/',auth[_0x632b('0x8')](),controller[_0x632b('0x9')]);router[_0x632b('0x7')](_0x632b('0xa'),auth[_0x632b('0x8')](),controller[_0x632b('0xb')]);router['get'](_0x632b('0xc'),auth[_0x632b('0x8')](),controller[_0x632b('0xd')]);router[_0x632b('0x7')]('/:id/contacts',auth['isAuthenticated'](),controller['getContacts']);router[_0x632b('0xe')]('/',auth['isAuthenticated'](),controller[_0x632b('0xf')]);router[_0x632b('0xe')](_0x632b('0x10'),auth[_0x632b('0x8')](),controller[_0x632b('0x11')]);router[_0x632b('0x12')](_0x632b('0xc'),auth[_0x632b('0x8')](),controller[_0x632b('0x13')]);router['delete'](_0x632b('0xc'),auth[_0x632b('0x8')](),controller[_0x632b('0x14')]);module['exports']=router; \ No newline at end of file +var _0x3d04=['/:id/contacts','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','get','isAuthenticated','index','/:id','show','getContacts','create','post'];(function(_0x5e1b91,_0x236f17){var _0x59b52f=function(_0x5c05ed){while(--_0x5c05ed){_0x5e1b91['push'](_0x5e1b91['shift']());}};_0x59b52f(++_0x236f17);}(_0x3d04,0xbe));var _0x43d0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3d04[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x43d0('0x0'));var util=require(_0x43d0('0x1'));var path=require(_0x43d0('0x2'));var timeout=require(_0x43d0('0x3'));var express=require(_0x43d0('0x4'));var router=express[_0x43d0('0x5')]();var auth=require(_0x43d0('0x6'));var interaction=require(_0x43d0('0x7'));var config=require('../../config/environment');var controller=require(_0x43d0('0x8'));router[_0x43d0('0x9')]('/',auth[_0x43d0('0xa')](),controller[_0x43d0('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x43d0('0x9')](_0x43d0('0xc'),auth[_0x43d0('0xa')](),controller[_0x43d0('0xd')]);router[_0x43d0('0x9')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x43d0('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x43d0('0xf')]);router[_0x43d0('0x10')](_0x43d0('0x11'),auth[_0x43d0('0xa')](),controller['addContacts']);router[_0x43d0('0x12')](_0x43d0('0xc'),auth['isAuthenticated'](),controller[_0x43d0('0x13')]);router[_0x43d0('0x14')](_0x43d0('0xc'),auth['isAuthenticated'](),controller[_0x43d0('0x15')]);module[_0x43d0('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 7b32afc..a1e7687 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 _0xc82f=['lodash','sequelize','exports','STRING','TEXT','INTEGER','DATE','NOW'];(function(_0x5ee748,_0x552a2b){var _0x36da37=function(_0x22cc48){while(--_0x22cc48){_0x5ee748['push'](_0x5ee748['shift']());}};_0x36da37(++_0x552a2b);}(_0xc82f,0xd8));var _0xfc82=function(_0x2b4eb1,_0x1d007a){_0x2b4eb1=_0x2b4eb1-0x0;var _0x2dd440=_0xc82f[_0x2b4eb1];return _0x2dd440;};'use strict';var _=require(_0xfc82('0x0'));var Sequelize=require(_0xfc82('0x1'));module[_0xfc82('0x2')]={'firstName':{'type':Sequelize[_0xfc82('0x3')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xfc82('0x3')]},'postalCode':{'type':Sequelize[_0xfc82('0x3')]},'city':{'type':Sequelize[_0xfc82('0x3')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0xfc82('0x3')]},'description':{'type':Sequelize[_0xfc82('0x4')]},'phone':{'type':Sequelize[_0xfc82('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xfc82('0x3')]},'email':{'type':Sequelize[_0xfc82('0x3')]},'url':{'type':Sequelize[_0xfc82('0x3')]},'facebook':{'type':Sequelize[_0xfc82('0x3')]},'fb_data':{'type':Sequelize[_0xfc82('0x3')]},'twitter':{'type':Sequelize[_0xfc82('0x3')]},'skype':{'type':Sequelize[_0xfc82('0x3')]},'teams':{'type':Sequelize[_0xfc82('0x3')]},'viber':{'type':Sequelize[_0xfc82('0x3')]},'line':{'type':Sequelize[_0xfc82('0x3')]},'wechat':{'type':Sequelize[_0xfc82('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xfc82('0x5')]},'priority':{'type':Sequelize[_0xfc82('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xfc82('0x6')],'defaultValue':Sequelize[_0xfc82('0x7')]}}; \ No newline at end of file +var _0xaed7=['DATE','NOW','lodash','sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED'];(function(_0x963086,_0x4f7f59){var _0x470c5c=function(_0x38ed15){while(--_0x38ed15){_0x963086['push'](_0x963086['shift']());}};_0x470c5c(++_0x4f7f59);}(_0xaed7,0x9b));var _0x7aed=function(_0x2112de,_0x17bc56){_0x2112de=_0x2112de-0x0;var _0x26540d=_0xaed7[_0x2112de];return _0x26540d;};'use strict';var _=require(_0x7aed('0x0'));var Sequelize=require(_0x7aed('0x1'));module[_0x7aed('0x2')]={'firstName':{'type':Sequelize[_0x7aed('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x7aed('0x3')]},'street':{'type':Sequelize[_0x7aed('0x3')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x7aed('0x3')]},'dateOfBirth':{'type':Sequelize[_0x7aed('0x3')]},'description':{'type':Sequelize[_0x7aed('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x7aed('0x3')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x7aed('0x3')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0x7aed('0x3')]},'twitter':{'type':Sequelize[_0x7aed('0x3')]},'skype':{'type':Sequelize[_0x7aed('0x3')]},'teams':{'type':Sequelize[_0x7aed('0x3')]},'viber':{'type':Sequelize[_0x7aed('0x3')]},'line':{'type':Sequelize[_0x7aed('0x3')]},'wechat':{'type':Sequelize[_0x7aed('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x7aed('0x5')]},'priority':{'type':Sequelize[_0x7aed('0x5')](0x2)[_0x7aed('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x7aed('0x7')],'defaultValue':Sequelize[_0x7aed('0x8')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 3493741..503dddc 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 _0x5f07=['message','error\x20child\x20process','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','./cmContact.socket','register','end','status','json','count','offset','set','Content-Range','reject','save','then','name','send','index','keys','length','startsWith','cf_','push','CmCustomField','findOne','fieldType','query','filters','model','attributes','fields','hasOwnProperty','limit','sort','where','pick','select','field','color','from','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','parseSearch','conditions','find','split','forEach','union','User','and','value','datetime','castTo','buildExpression','type','text','start','map','isNil','Contact','isEmpty','ListId','c.ListId\x20IN\x20?','concat','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','QueryTypes','SELECT','clone','c.id','order','DESC','having','resolve','some','user','c.ListId\x20IS\x20NULL','sequelize','toString','keyBy','merge','c.firstName','c.lastName','c.phone','c.mobile','c.fax','c.email','c.ListId','c.deletedAt','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','catch','destroy','params','describe','CmContact','tags','columnName','displayName','findAll','alias','custom','values','body','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','info','create','ChatInteraction','ChatMessage','update','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','duplicates','$or','findOrCreate','spread','Tags','get','$and','omit','format','cf_%d','pickBy','table','setFields','id\x20=\x20?','toParam','phone','getTags','Tag','rawAttributes','intersection','nolimit','setTags','ids','getHoppers','ContactId','options','includeAll','include','rows','getHopperHistories','getHopperFinals','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','binding_values','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','No\x20firstName\x20column\x20specified','root','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','socket_timestamp','pid','upload','createReadStream','parse','meta','import','agent','binding','firstName','../../components/import/cm/csv2','stringify'];(function(_0x1621c5,_0x2c944c){var _0x33610a=function(_0x3d7bd0){while(--_0x3d7bd0){_0x1621c5['push'](_0x1621c5['shift']());}};_0x33610a(++_0x2c944c);}(_0x5f07,0x1d4));var _0x75f0=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0x5f07[_0x1fc122];return _0xa2cb13;};'use strict';var pdf=require(_0x75f0('0x0'));var emlformat=require(_0x75f0('0x1'));var rimraf=require(_0x75f0('0x2'));var zipdir=require(_0x75f0('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x75f0('0x4'));var moment=require(_0x75f0('0x5'));var BPromise=require(_0x75f0('0x6'));var Mustache=require('mustache');var util=require(_0x75f0('0x7'));var path=require(_0x75f0('0x8'));var sox=require(_0x75f0('0x9'));var csv=require(_0x75f0('0xa'));var ejs=require(_0x75f0('0xb'));var fs=require('fs');var _=require(_0x75f0('0xc'));var squel=require(_0x75f0('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x75f0('0xe'));var Redis=require('ioredis');var authService=require(_0x75f0('0xf'));var qs=require(_0x75f0('0x10'));var as=require(_0x75f0('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x75f0('0x12'))(_0x75f0('0x13'));var utils=require(_0x75f0('0x14'));var config=require('../../config/environment');var db=require(_0x75f0('0x15'))['db'];config[_0x75f0('0x16')]=_[_0x75f0('0x17')](config['redis'],{'host':_0x75f0('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x75f0('0x16')]));require(_0x75f0('0x19'))[_0x75f0('0x1a')](socket);function respondWithStatusCode(_0x6fb61b,_0x519864){_0x519864=_0x519864||0xcc;return function(_0x26376c){if(_0x26376c){return _0x6fb61b['sendStatus'](_0x519864);}return _0x6fb61b['status'](_0x519864)[_0x75f0('0x1b')]();};}function respondWithResult(_0x590646,_0x3a5d1f){_0x3a5d1f=_0x3a5d1f||0xc8;return function(_0x29fe9e){if(_0x29fe9e){return _0x590646[_0x75f0('0x1c')](_0x3a5d1f)[_0x75f0('0x1d')](_0x29fe9e);}};}function respondWithFilteredResult(_0x52ab8b,_0x2443aa){return function(_0x154b2f){if(_0x154b2f){var _0x5f4c7d=_0x154b2f[_0x75f0('0x1e')],_0x303167=_0x2443aa['offset'],_0x3ce7e3=_0x2443aa[_0x75f0('0x1f')]+_0x2443aa['limit'],_0x38e0fe;if(_0x3ce7e3>=_0x5f4c7d){_0x3ce7e3=_0x5f4c7d;_0x38e0fe=0xc8;}else{_0x38e0fe=0xce;}_0x52ab8b[_0x75f0('0x1c')](_0x38e0fe);return _0x52ab8b[_0x75f0('0x20')](_0x75f0('0x21'),_0x303167+'-'+_0x3ce7e3+'/'+_0x5f4c7d)[_0x75f0('0x1d')](_0x154b2f);}return null;};}function patchUpdates(_0xe7e9e8){return function(_0x3046b5){try{jsonpatch['apply'](_0x3046b5,_0xe7e9e8,!![]);}catch(_0x545fe8){return BPromise[_0x75f0('0x22')](_0x545fe8);}return _0x3046b5[_0x75f0('0x23')]();};}function saveUpdates(_0x52b8a9,_0xfbe17b){return function(_0x19da03){if(_0x19da03){return _0x19da03['update'](_0x52b8a9)[_0x75f0('0x24')](function(_0x591681){return _0x591681;});}return null;};}function removeEntity(_0x569b35,_0x50a482){return function(_0x1300f1){if(_0x1300f1){return _0x1300f1['destroy']()[_0x75f0('0x24')](function(){_0x569b35[_0x75f0('0x1c')](0xcc)[_0x75f0('0x1b')]();});}};}function handleEntityNotFound(_0x40f246,_0x3e8eda){return function(_0x34cc45){if(!_0x34cc45){_0x40f246['sendStatus'](0x194);}return _0x34cc45;};}function handleError(_0x456c20,_0x1ece1e){_0x1ece1e=_0x1ece1e||0x1f4;return function(_0x43a146){logger['error'](_0x43a146['stack']);if(_0x43a146[_0x75f0('0x25')]){delete _0x43a146['name'];}_0x456c20[_0x75f0('0x1c')](_0x1ece1e)[_0x75f0('0x26')](_0x43a146);};}exports[_0x75f0('0x27')]=function(_0x1c6e8f,_0x58540b){var _0x1ba863={},_0x564616={},_0x1a3364={'count':0x0,'rows':[]};return db['CmContact']['describe']()[_0x75f0('0x24')](function(_0x31503c){var _0x2d1b60=[];for(var _0x1094d4=0x0;_0x1094d40x1){_0x14f0ed['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x75f0('0x61')](_0x5e08c6),null);}else{if(qs[_0x75f0('0x62')](_0x5e08c6)){_0x14f0ed['or'](_0x75f0('0x63'),_0x5e08c6+'%');_0x14f0ed['or'](_0x75f0('0x64'),_0x5e08c6+'%');_0x14f0ed['or'](_0x75f0('0x65'),_0x5e08c6+'%');_0x14f0ed['or'](_0x75f0('0x66'),_0x5e08c6+'%');}else if(qs['isEmail'](_0x5e08c6)){_0x14f0ed['or'](_0x75f0('0x67'),_0x5e08c6+'%');}else{_0x14f0ed['or'](_0x75f0('0x68'),'%'+_0x5e08c6+'%');_0x14f0ed['or'](_0x75f0('0x69'),'%'+_0x5e08c6+'%');_0x14f0ed['or'](_0x75f0('0x67'),'%'+_0x5e08c6+'%');}}}}_0x13ab3d['where'](_0x14f0ed);_0x13ab3d[_0x75f0('0x6a')]('c.id');var _0x4c97fa={'type':db['Sequelize'][_0x75f0('0x6b')][_0x75f0('0x6c')],'raw':!![]};var _0x1382c4=_0x13ab3d[_0x75f0('0x6d')]()['field'](_0x75f0('0x6e'));if(_0x1ba863[_0x75f0('0x6f')]){_0x1ba863[_0x75f0('0x6f')][_0x75f0('0x49')](function(_0x34c003){_0x13ab3d[_0x75f0('0x6f')]('c.'+_0x34c003[0x0],_0x34c003[0x1]===_0x75f0('0x70')?![]:!![]);});}if(!_[_0x75f0('0x57')](_0x11d452)){_0x13ab3d[_0x75f0('0x71')](_0xfab2d3);_0x1382c4[_0x75f0('0x38')]('t.id\x20IN\x20?',_0x11d452);}BPromise[_0x75f0('0x72')]()[_0x75f0('0x24')](function(){if(_0x4cd3e2&&!_[_0x75f0('0x73')](_0x4cd3e2[_0x75f0('0x46')],['field',_0x75f0('0x4b')])){return _0x1c6e8f[_0x75f0('0x74')]['getLists']({'attributes':['id'],'raw':!![]})[_0x75f0('0x24')](function(_0x13f56e){if(_['isEmpty'](_0x13f56e)){_0x1382c4['where']('c.ListId\x20IS\x20NULL');_0x13ab3d[_0x75f0('0x38')](_0x75f0('0x75'));}else{_0x1382c4['where'](_0x75f0('0x59'),_[_0x75f0('0x54')](_0x13f56e,'id'));_0x13ab3d[_0x75f0('0x38')](_0x75f0('0x59'),_['map'](_0x13f56e,'id'));}});}else{return;}})[_0x75f0('0x24')](function(){db[_0x75f0('0x76')][_0x75f0('0x30')](_0x1382c4[_0x75f0('0x77')](),_0x4c97fa)['then'](function(_0x358a7a){_0x1a3364[_0x75f0('0x1e')]=_0x358a7a['length'];if(_0x1a3364[_0x75f0('0x1e')]===0x0)return[];return db[_0x75f0('0x76')][_0x75f0('0x30')](_0x5cef38[_0x75f0('0x77')](),_0x4c97fa);})[_0x75f0('0x24')](function(_0xcdaec9){_0x1bb565=_[_0x75f0('0x78')](_0xcdaec9,'id');_0x4c97fa=_[_0x75f0('0x79')](_0x4c97fa,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1c6e8f[_0x75f0('0x30')][_0x75f0('0x34')]){_0x1ba863[_0x75f0('0x33')][_0x75f0('0x49')](function(_0x912acd){_0x13ab3d[_0x75f0('0x3b')]('c.'+_0x912acd);});}else{_0x13ab3d[_0x75f0('0x3b')](_0x75f0('0x6e'));_0x13ab3d[_0x75f0('0x3b')](_0x75f0('0x7a'));_0x13ab3d['field'](_0x75f0('0x7b'));_0x13ab3d[_0x75f0('0x3b')](_0x75f0('0x7c'));_0x13ab3d[_0x75f0('0x3b')](_0x75f0('0x7d'));_0x13ab3d[_0x75f0('0x3b')](_0x75f0('0x7e'));_0x13ab3d[_0x75f0('0x3b')](_0x75f0('0x7f'));_0x13ab3d[_0x75f0('0x3b')](_0x75f0('0x80'));_0x13ab3d[_0x75f0('0x3b')](_0x75f0('0x81'));_0x13ab3d['field'](_0x75f0('0x82'),_0x75f0('0x83'));}if(_0x1ba863[_0x75f0('0x36')])_0x13ab3d[_0x75f0('0x36')](_0x1ba863[_0x75f0('0x36')]);if(_0x1ba863[_0x75f0('0x1f')])_0x13ab3d['offset'](_0x1ba863[_0x75f0('0x1f')]);return db[_0x75f0('0x76')][_0x75f0('0x30')](_0x13ab3d[_0x75f0('0x77')](),_0x4c97fa);})['then'](function(_0x570379){_0x570379[_0x75f0('0x49')](function(_0x22aa40){if(_0x22aa40[_0x75f0('0x83')]){_0x22aa40['Tags']=[];_0x22aa40[_0x75f0('0x83')]['split'](',')['forEach'](function(_0x3ed7be){_0x22aa40['Tags']['push'](_0x1bb565[_0x3ed7be]);});}delete _0x22aa40['TagIds'];});_0x1a3364['rows']=_0x570379;return _0x1a3364;})[_0x75f0('0x24')](respondWithFilteredResult(_0x58540b,_0x1ba863));});})[_0x75f0('0x84')](handleError(_0x58540b,null));};exports[_0x75f0('0x85')]=function(_0xd83b6f,_0x2bce79){return db['CmContact'][_0x75f0('0x47')]({'where':{'id':_0xd83b6f[_0x75f0('0x86')]['id']}})[_0x75f0('0x24')](handleEntityNotFound(_0x2bce79,null))['then'](removeEntity(_0x2bce79,null))[_0x75f0('0x84')](handleError(_0x2bce79,null));};exports[_0x75f0('0x87')]=function(_0x529d0d,_0x2320eb){return db[_0x75f0('0x88')][_0x75f0('0x87')]()[_0x75f0('0x24')](function(_0x2d94f4){delete _0x2d94f4[_0x75f0('0x89')];for(var _0x2badf7=0x0;_0x2badf7=_0x13fa5b){_0x4a54a8=_0x13fa5b;_0x4aa4b8=0xc8;}else{_0x4aa4b8=0xce;}_0x30723b['status'](_0x4aa4b8);return _0x30723b['set'](_0x8e9d('0x22'),_0x1208a7+'-'+_0x4a54a8+'/'+_0x13fa5b)[_0x8e9d('0x1f')](_0x39c978);}return null;};}function patchUpdates(_0x5a3b57){return function(_0x1eda26){try{jsonpatch[_0x8e9d('0x23')](_0x1eda26,_0x5a3b57,!![]);}catch(_0xce29bf){return BPromise[_0x8e9d('0x24')](_0xce29bf);}return _0x1eda26[_0x8e9d('0x25')]();};}function saveUpdates(_0x6bd68d,_0x216dc7){return function(_0x29366b){if(_0x29366b){return _0x29366b[_0x8e9d('0x26')](_0x6bd68d)['then'](function(_0x5efa8e){return _0x5efa8e;});}return null;};}function removeEntity(_0x15dc3f,_0x320134){return function(_0x305533){if(_0x305533){return _0x305533['destroy']()[_0x8e9d('0x27')](function(){_0x15dc3f['status'](0xcc)[_0x8e9d('0x1e')]();});}};}function handleEntityNotFound(_0x13e95d,_0x24a190){return function(_0x31cf38){if(!_0x31cf38){_0x13e95d['sendStatus'](0x194);}return _0x31cf38;};}function handleError(_0x21872c,_0x1d4504){_0x1d4504=_0x1d4504||0x1f4;return function(_0x373d40){logger[_0x8e9d('0x28')](_0x373d40[_0x8e9d('0x29')]);if(_0x373d40['name']){delete _0x373d40['name'];}_0x21872c['status'](_0x1d4504)[_0x8e9d('0x2a')](_0x373d40);};}exports['index']=function(_0x285425,_0x51da22){var _0x3462cf={},_0x92ba95={},_0x50de36={'count':0x0,'rows':[]};return db['CmContact'][_0x8e9d('0x2b')]()['then'](function(_0x15b6aa){var _0x3c8ebe=[];for(var _0x3c70b6=0x0;_0x3c70b60x1){_0x47f4ab['or'](_0x8e9d('0x64'),qs[_0x8e9d('0x65')](_0x34f181),null);}else{if(qs[_0x8e9d('0x66')](_0x34f181)){_0x47f4ab['or']('c.id\x20LIKE\x20?',_0x34f181+'%');_0x47f4ab['or'](_0x8e9d('0x67'),_0x34f181+'%');_0x47f4ab['or'](_0x8e9d('0x68'),_0x34f181+'%');_0x47f4ab['or']('c.fax\x20LIKE\x20?',_0x34f181+'%');}else if(qs[_0x8e9d('0x69')](_0x34f181)){_0x47f4ab['or'](_0x8e9d('0x6a'),_0x34f181+'%');}else{_0x47f4ab['or'](_0x8e9d('0x6b'),'%'+_0x34f181+'%');_0x47f4ab['or']('c.lastName\x20LIKE\x20?','%'+_0x34f181+'%');_0x47f4ab['or'](_0x8e9d('0x6a'),'%'+_0x34f181+'%');}}}}_0x464818[_0x8e9d('0x3c')](_0x47f4ab);_0x464818[_0x8e9d('0x6c')]('c.id');var _0x39b488={'type':db[_0x8e9d('0x6d')][_0x8e9d('0x6e')][_0x8e9d('0x6f')],'raw':!![]};var _0x34bac6=_0x464818[_0x8e9d('0x70')]()[_0x8e9d('0x4c')](_0x8e9d('0x71'));if(_0x3462cf['order']){_0x3462cf[_0x8e9d('0x72')][_0x8e9d('0x5d')](function(_0x2d2721){_0x464818['order']('c.'+_0x2d2721[0x0],_0x2d2721[0x1]===_0x8e9d('0x73')?![]:!![]);});}if(!_[_0x8e9d('0x74')](_0x5f1f9e)){_0x464818[_0x8e9d('0x75')](_0x5368ad);_0x34bac6['where'](_0x8e9d('0x76'),_0x5f1f9e);}BPromise[_0x8e9d('0x77')]()['then'](function(){if(_0x5cb3d4&&!_[_0x8e9d('0x78')](_0x5cb3d4['conditions'],[_0x8e9d('0x4c'),_0x8e9d('0x52')])){return _0x285425[_0x8e9d('0x79')][_0x8e9d('0x7a')]({'attributes':['id'],'raw':!![]})[_0x8e9d('0x27')](function(_0x5df5ec){if(_[_0x8e9d('0x74')](_0x5df5ec)){_0x34bac6[_0x8e9d('0x3c')]('c.ListId\x20IS\x20NULL');_0x464818['where'](_0x8e9d('0x7b'));}else{_0x34bac6[_0x8e9d('0x3c')]('c.ListId\x20IN\x20?',_[_0x8e9d('0x50')](_0x5df5ec,'id'));_0x464818[_0x8e9d('0x3c')](_0x8e9d('0x7c'),_[_0x8e9d('0x50')](_0x5df5ec,'id'));}});}else{return;}})[_0x8e9d('0x27')](function(){db[_0x8e9d('0x7d')][_0x8e9d('0x35')](_0x34bac6[_0x8e9d('0x7e')](),_0x39b488)[_0x8e9d('0x27')](function(_0x8f5064){_0x50de36[_0x8e9d('0x7f')]=_0x8f5064[_0x8e9d('0x2d')];if(_0x50de36[_0x8e9d('0x7f')]===0x0)return[];return db[_0x8e9d('0x7d')]['query'](_0x1d5d7f['toString'](),_0x39b488);})[_0x8e9d('0x27')](function(_0xf63976){_0x13c87f=_['keyBy'](_0xf63976,'id');_0x39b488=_[_0x8e9d('0x80')](_0x39b488,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x285425[_0x8e9d('0x35')]['fields']){_0x3462cf['attributes'][_0x8e9d('0x5d')](function(_0x4fb99f){_0x464818[_0x8e9d('0x4c')]('c.'+_0x4fb99f);});}else{_0x464818[_0x8e9d('0x4c')]('c.id');_0x464818[_0x8e9d('0x4c')](_0x8e9d('0x81'));_0x464818[_0x8e9d('0x4c')]('c.lastName');_0x464818[_0x8e9d('0x4c')](_0x8e9d('0x82'));_0x464818[_0x8e9d('0x4c')](_0x8e9d('0x83'));_0x464818[_0x8e9d('0x4c')]('c.fax');_0x464818['field'](_0x8e9d('0x84'));_0x464818['field'](_0x8e9d('0x85'));_0x464818['field'](_0x8e9d('0x86'));_0x464818[_0x8e9d('0x4c')](_0x8e9d('0x87'),_0x8e9d('0x88'));}if(_0x3462cf[_0x8e9d('0x21')])_0x464818[_0x8e9d('0x21')](_0x3462cf[_0x8e9d('0x21')]);if(_0x3462cf[_0x8e9d('0x20')])_0x464818[_0x8e9d('0x20')](_0x3462cf[_0x8e9d('0x20')]);return db[_0x8e9d('0x7d')]['query'](_0x464818[_0x8e9d('0x7e')](),_0x39b488);})[_0x8e9d('0x27')](function(_0x2d4203){_0x2d4203['forEach'](function(_0x1bf301){if(_0x1bf301[_0x8e9d('0x88')]){_0x1bf301[_0x8e9d('0x89')]=[];_0x1bf301['TagIds'][_0x8e9d('0x4f')](',')[_0x8e9d('0x5d')](function(_0x2e662c){_0x1bf301[_0x8e9d('0x89')]['push'](_0x13c87f[_0x2e662c]);});}delete _0x1bf301['TagIds'];});_0x50de36[_0x8e9d('0x8a')]=_0x2d4203;return _0x50de36;})[_0x8e9d('0x27')](respondWithFilteredResult(_0x51da22,_0x3462cf));});})[_0x8e9d('0x8b')](handleError(_0x51da22,null));};exports[_0x8e9d('0x8c')]=function(_0xdcc0e9,_0x4b9a27){return db[_0x8e9d('0x8d')][_0x8e9d('0x4b')]({'where':{'id':_0xdcc0e9['params']['id']}})[_0x8e9d('0x27')](handleEntityNotFound(_0x4b9a27,null))[_0x8e9d('0x27')](removeEntity(_0x4b9a27,null))['catch'](handleError(_0x4b9a27,null));};exports[_0x8e9d('0x2b')]=function(_0x486984,_0x2449c3){return db[_0x8e9d('0x8d')][_0x8e9d('0x2b')]()[_0x8e9d('0x27')](function(_0x3e6594){delete _0x3e6594['tags'];for(var _0x16738d=0x0;_0x16738d{}\s\\|]/g,'-');_0x2dad65(null,util['format']('%s-%s%s',path[_0x7dc9('0x1f')](_0x184bfd[_0x7dc9('0x1d')],path['extname'](_0x184bfd[_0x7dc9('0x1d')])),Date[_0x7dc9('0x20')](),path['extname'](_0x184bfd[_0x7dc9('0x1d')])));}})});router[_0x7dc9('0x13')](_0x7dc9('0x21'),upload['single'](_0x7dc9('0x22')),controller[_0x7dc9('0x23')]);var upload=multer({'storage':multer[_0x7dc9('0x19')]({'destination':function(_0x55a482,_0x48c6bc,_0x4b9ba6){_0x4b9ba6(null,path[_0x7dc9('0x1a')](config[_0x7dc9('0x1b')],'server/files/tmp'));},'filename':function(_0x585eef,_0x47771b,_0x5afb7d){_0x47771b[_0x7dc9('0x1d')]=_0x47771b[_0x7dc9('0x1d')][_0x7dc9('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5afb7d(null,util[_0x7dc9('0x24')](_0x7dc9('0x25'),path[_0x7dc9('0x1f')](_0x47771b[_0x7dc9('0x1d')],path[_0x7dc9('0x26')](_0x47771b[_0x7dc9('0x1d')])),Date[_0x7dc9('0x20')](),path[_0x7dc9('0x26')](_0x47771b[_0x7dc9('0x1d')])));}})});router['post']('/upload',upload['single']('file'),controller['upload']);router['post']('/upload/:id',auth['isAuthenticated'](),controller[_0x7dc9('0x27')]);router[_0x7dc9('0x28')](_0x7dc9('0xb'),auth[_0x7dc9('0x8')](),controller[_0x7dc9('0x29')]);router[_0x7dc9('0x2a')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x7dc9('0x2b')]=router; \ No newline at end of file +var _0xe14b=['/upload/:id','import','put','/:id','update','exports','multer','util','express','Router','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show','/:id/tags','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','post','merge','create','/create_many','bulkCreate','setTags','join','root','server/files/tmp','originalname','replace','%s-%s%s','extname','/csv','file','diskStorage','format','basename','now','/upload','single','upload'];(function(_0x32d0e0,_0x53ee38){var _0x43993f=function(_0x37e0d5){while(--_0x37e0d5){_0x32d0e0['push'](_0x32d0e0['shift']());}};_0x43993f(++_0x53ee38);}(_0xe14b,0x93));var _0xbe14=function(_0x44e0c4,_0x1ea62f){_0x44e0c4=_0x44e0c4-0x0;var _0x5cdcd8=_0xe14b[_0x44e0c4];return _0x5cdcd8;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xbe14('0x4'));var config=require('../../config/environment');var controller=require('./cmContact.controller');router[_0xbe14('0x5')]('/',auth[_0xbe14('0x6')](),controller[_0xbe14('0x7')]);router[_0xbe14('0x5')](_0xbe14('0x8'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xbe14('0xa')]);router[_0xbe14('0x5')](_0xbe14('0xb'),auth[_0xbe14('0x6')](),controller['getTags']);router['get'](_0xbe14('0xc'),auth[_0xbe14('0x6')](),controller['getHoppers']);router[_0xbe14('0x5')](_0xbe14('0xd'),auth[_0xbe14('0x6')](),controller[_0xbe14('0xe')]);router[_0xbe14('0x5')](_0xbe14('0xf'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x10')]);router[_0xbe14('0x5')](_0xbe14('0x11'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x13')]('/merge',auth['isAuthenticated'](),controller[_0xbe14('0x14')]);router[_0xbe14('0x13')]('/',auth[_0xbe14('0x6')](),controller[_0xbe14('0x15')]);router['post'](_0xbe14('0x16'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x13')](_0xbe14('0xb'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x18')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x137ee5,_0x456ca8,_0x329588){_0x329588(null,path[_0xbe14('0x19')](config[_0xbe14('0x1a')],_0xbe14('0x1b')));},'filename':function(_0x59a9e3,_0x24f820,_0x4a1bbd){_0x24f820[_0xbe14('0x1c')]=_0x24f820[_0xbe14('0x1c')][_0xbe14('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4a1bbd(null,util['format'](_0xbe14('0x1e'),path['basename'](_0x24f820[_0xbe14('0x1c')],path['extname'](_0x24f820[_0xbe14('0x1c')])),Date['now'](),path[_0xbe14('0x1f')](_0x24f820[_0xbe14('0x1c')])));}})});router['post'](_0xbe14('0x20'),upload['single'](_0xbe14('0x21')),controller['uploadCsv']);var upload=multer({'storage':multer[_0xbe14('0x22')]({'destination':function(_0x5fa043,_0x1ee9c1,_0x39cc81){_0x39cc81(null,path[_0xbe14('0x19')](config[_0xbe14('0x1a')],'server/files/tmp'));},'filename':function(_0x1822e0,_0x1ba46a,_0x391556){_0x1ba46a[_0xbe14('0x1c')]=_0x1ba46a['originalname'][_0xbe14('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x391556(null,util[_0xbe14('0x23')]('%s-%s%s',path[_0xbe14('0x24')](_0x1ba46a[_0xbe14('0x1c')],path[_0xbe14('0x1f')](_0x1ba46a[_0xbe14('0x1c')])),Date[_0xbe14('0x25')](),path[_0xbe14('0x1f')](_0x1ba46a[_0xbe14('0x1c')])));}})});router[_0xbe14('0x13')](_0xbe14('0x26'),upload[_0xbe14('0x27')](_0xbe14('0x21')),controller[_0xbe14('0x28')]);router[_0xbe14('0x13')](_0xbe14('0x29'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x2a')]);router[_0xbe14('0x2b')](_0xbe14('0x2c'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x2d')]);router['delete'](_0xbe14('0x2c'),auth['isAuthenticated'](),controller['destroy']);module[_0xbe14('0x2e')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index f94a931..be21aea 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 _0x471b=['isArray','stringify','lodash','alias','setDataValue','getDataValue','name','STRING','TEXT','long','type','parse','values'];(function(_0x254b22,_0x27159f){var _0x1279db=function(_0x3ca06f){while(--_0x3ca06f){_0x254b22['push'](_0x254b22['shift']());}};_0x1279db(++_0x27159f);}(_0x471b,0x12d));var _0xb471=function(_0x12a3c3,_0xfa64cc){_0x12a3c3=_0x12a3c3-0x0;var _0x1f6855=_0x471b[_0x12a3c3];return _0x1f6855;};'use strict';var Sequelize=require('sequelize');var _=require(_0xb471('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0xc4ae17){return this['getDataValue'](_0xb471('0x1'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x1cb79a){this[_0xb471('0x2')](_0xb471('0x1'),_0x1cb79a?_0x1cb79a:this[_0xb471('0x3')](_0xb471('0x4')));}},'type':{'type':Sequelize[_0xb471('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0xb471('0x6')](_0xb471('0x7')),'get':function(){if(this[_0xb471('0x3')](_0xb471('0x8'))==='select'){return JSON[_0xb471('0x9')](this[_0xb471('0x3')]('values'));}else{return this[_0xb471('0x3')](_0xb471('0xa'));}},'set':function(_0x54f379){if(Array[_0xb471('0xb')](_0x54f379)){this[_0xb471('0x2')]('values',JSON[_0xb471('0xc')](_0x54f379));}else{this[_0xb471('0x2')](_0xb471('0xa'),_0x54f379);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x5479=['values','isArray','stringify','BOOLEAN','lodash','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT','type','select','parse'];(function(_0x5274b1,_0x165ccc){var _0x2c64ef=function(_0x24df29){while(--_0x24df29){_0x5274b1['push'](_0x5274b1['shift']());}};_0x2c64ef(++_0x165ccc);}(_0x5479,0x1c4));var _0x9547=function(_0xc2f5c2,_0x3e8fce){_0xc2f5c2=_0xc2f5c2-0x0;var _0xd65e76=_0x5479[_0xc2f5c2];return _0xd65e76;};'use strict';var Sequelize=require('sequelize');var _=require(_0x9547('0x0'));module[_0x9547('0x1')]={'name':{'type':Sequelize[_0x9547('0x2')],'get':function(_0x112b69){return this[_0x9547('0x3')](_0x9547('0x4'));}},'alias':{'type':Sequelize[_0x9547('0x5')],'allowNull':![],'set':function(_0x49bca0){this[_0x9547('0x6')]('alias',_0x49bca0?_0x49bca0:this['getDataValue'](_0x9547('0x7')));}},'type':{'type':Sequelize[_0x9547('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0x9547('0x8')]('long'),'get':function(){if(this[_0x9547('0x3')](_0x9547('0x9'))===_0x9547('0xa')){return JSON[_0x9547('0xb')](this[_0x9547('0x3')](_0x9547('0xc')));}else{return this[_0x9547('0x3')](_0x9547('0xc'));}},'set':function(_0x634bd){if(Array[_0x9547('0xd')](_0x634bd)){this['setDataValue']('values',JSON[_0x9547('0xe')](_0x634bd));}else{this['setDataValue'](_0x9547('0xc'),_0x634bd);}}},'required':{'type':Sequelize[_0x9547('0xf')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 496f49f..51102b9 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 _0x2bb5=['switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','apply','reject','update','then','destroy','error','name','send','map','fieldName','type','model','differenceBy','keys','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','count','CmCustomField','rows','catch','show','params','rawAttributes','fields','includeAll','include','merge','find','body','create','sequelize','Sequelize','TEXT','text','number','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2bb5,0x158));var _0x52bb=function(_0x4ef05e,_0x18b00a){_0x4ef05e=_0x4ef05e-0x0;var _0x241f30=_0x2bb5[_0x4ef05e];return _0x241f30;};'use strict';var pdf=require(_0x52bb('0x0'));var emlformat=require(_0x52bb('0x1'));var rimraf=require(_0x52bb('0x2'));var zipdir=require(_0x52bb('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x52bb('0x4'));var moment=require(_0x52bb('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x52bb('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x52bb('0x7'));var ejs=require(_0x52bb('0x8'));var fs=require('fs');var _=require(_0x52bb('0x9'));var squel=require(_0x52bb('0xa'));var crypto=require(_0x52bb('0xb'));var jsforce=require(_0x52bb('0xc'));var deskjs=require(_0x52bb('0xd'));var toCsv=require(_0x52bb('0x7'));var querystring=require('querystring');var Papa=require(_0x52bb('0xe'));var Redis=require(_0x52bb('0xf'));var authService=require(_0x52bb('0x10'));var qs=require(_0x52bb('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x52bb('0x12'));var logger=require(_0x52bb('0x13'))('api');var utils=require(_0x52bb('0x14'));var config=require(_0x52bb('0x15'));var db=require(_0x52bb('0x16'))['db'];function respondWithStatusCode(_0x30e95a,_0x2445c1){_0x2445c1=_0x2445c1||0xcc;return function(_0x304027){if(_0x304027){return _0x30e95a[_0x52bb('0x17')](_0x2445c1);}return _0x30e95a[_0x52bb('0x18')](_0x2445c1)[_0x52bb('0x19')]();};}function respondWithResult(_0x23957c,_0x5a2980){_0x5a2980=_0x5a2980||0xc8;return function(_0xe53fcd){if(_0xe53fcd){return _0x23957c[_0x52bb('0x18')](_0x5a2980)[_0x52bb('0x1a')](_0xe53fcd);}};}function respondWithFilteredResult(_0x5f429c,_0x2331e4){return function(_0x33481b){if(_0x33481b){var _0x2dcdc1=_0x33481b['count'],_0x1c963e=_0x2331e4[_0x52bb('0x1b')],_0x5c2e38=_0x2331e4[_0x52bb('0x1b')]+_0x2331e4[_0x52bb('0x1c')],_0x5f2d1a;if(_0x5c2e38>=_0x2dcdc1){_0x5c2e38=_0x2dcdc1;_0x5f2d1a=0xc8;}else{_0x5f2d1a=0xce;}_0x5f429c[_0x52bb('0x18')](_0x5f2d1a);return _0x5f429c['set']('Content-Range',_0x1c963e+'-'+_0x5c2e38+'/'+_0x2dcdc1)[_0x52bb('0x1a')](_0x33481b);}return null;};}function patchUpdates(_0x1f66cb){return function(_0x5b3c92){try{jsonpatch[_0x52bb('0x1d')](_0x5b3c92,_0x1f66cb,!![]);}catch(_0x29a271){return BPromise[_0x52bb('0x1e')](_0x29a271);}return _0x5b3c92['save']();};}function saveUpdates(_0x1ce5fc,_0x1bfe1b){return function(_0x2653ed){if(_0x2653ed){return _0x2653ed[_0x52bb('0x1f')](_0x1ce5fc)[_0x52bb('0x20')](function(_0x2e09db){return _0x2e09db;});}return null;};}function removeEntity(_0x587c3e,_0x51838c){return function(_0x5a2908){if(_0x5a2908){return _0x5a2908[_0x52bb('0x21')]()[_0x52bb('0x20')](function(){_0x587c3e[_0x52bb('0x18')](0xcc)[_0x52bb('0x19')]();});}};}function handleEntityNotFound(_0x2eba2e,_0x31b521){return function(_0x7f15c8){if(!_0x7f15c8){_0x2eba2e[_0x52bb('0x17')](0x194);}return _0x7f15c8;};}function handleError(_0x438873,_0x2401a7){_0x2401a7=_0x2401a7||0x1f4;return function(_0x49cda2){logger[_0x52bb('0x22')](_0x49cda2['stack']);if(_0x49cda2['name']){delete _0x49cda2[_0x52bb('0x23')];}_0x438873['status'](_0x2401a7)[_0x52bb('0x24')](_0x49cda2);};}exports['index']=function(_0x4e37a7,_0x220638){var _0x21b06c={},_0x48c07f={},_0x175daa={'count':0x0,'rows':[]};var _0x5bfaf5=_[_0x52bb('0x25')](db['CmCustomField']['rawAttributes'],function(_0x1c7f82){return{'name':_0x1c7f82[_0x52bb('0x26')],'type':_0x1c7f82[_0x52bb('0x27')]['key']};});_0x48c07f[_0x52bb('0x28')]=_[_0x52bb('0x29')](_[_0x52bb('0x25')](_0x5bfaf5,_0x52bb('0x23')),['name']);_0x48c07f['query']=_[_0x52bb('0x2a')](_0x4e37a7[_0x52bb('0x2b')]);_0x48c07f[_0x52bb('0x2c')]=_[_0x52bb('0x2d')](_0x48c07f[_0x52bb('0x28')],_0x48c07f['query']);_0x21b06c[_0x52bb('0x2e')]=_['intersection'](_0x48c07f[_0x52bb('0x28')],qs['fields'](_0x4e37a7[_0x52bb('0x2b')]['fields']));_0x21b06c['attributes']=_0x21b06c[_0x52bb('0x2e')][_0x52bb('0x2f')]?_0x21b06c[_0x52bb('0x2e')]:_0x48c07f[_0x52bb('0x28')];if(!_0x4e37a7[_0x52bb('0x2b')][_0x52bb('0x30')]('nolimit')){_0x21b06c[_0x52bb('0x1c')]=qs[_0x52bb('0x1c')](_0x4e37a7[_0x52bb('0x2b')][_0x52bb('0x1c')]);_0x21b06c['offset']=qs[_0x52bb('0x1b')](_0x4e37a7[_0x52bb('0x2b')]['offset']);}_0x21b06c[_0x52bb('0x31')]=qs[_0x52bb('0x32')](_0x4e37a7['query'][_0x52bb('0x32')]);_0x21b06c[_0x52bb('0x33')]=qs[_0x52bb('0x2c')](_[_0x52bb('0x34')](_0x4e37a7['query'],_0x48c07f[_0x52bb('0x2c')]),_0x5bfaf5);if(_0x4e37a7[_0x52bb('0x2b')][_0x52bb('0x35')]){_0x21b06c['where']=_['merge'](_0x21b06c[_0x52bb('0x33')],{'$or':_[_0x52bb('0x25')](_0x5bfaf5,function(_0x2535e4){if(_0x2535e4['type']!==_0x52bb('0x36')){var _0x28e25f={};_0x28e25f[_0x2535e4[_0x52bb('0x23')]]={'$like':'%'+_0x4e37a7[_0x52bb('0x2b')][_0x52bb('0x35')]+'%'};return _0x28e25f;}})});}_0x21b06c=_['merge']({},_0x21b06c,_0x4e37a7[_0x52bb('0x37')]);var _0xcf059d={'where':_0x21b06c[_0x52bb('0x33')]};return db['CmCustomField'][_0x52bb('0x38')](_0xcf059d)['then'](function(_0x1ddd5d){_0x175daa['count']=_0x1ddd5d;if(_0x4e37a7[_0x52bb('0x2b')]['includeAll']){_0x21b06c['include']=[{'all':!![]}];}return db[_0x52bb('0x39')]['findAll'](_0x21b06c);})[_0x52bb('0x20')](function(_0x3754b3){_0x175daa[_0x52bb('0x3a')]=_0x3754b3;return _0x175daa;})['then'](respondWithFilteredResult(_0x220638,_0x21b06c))[_0x52bb('0x3b')](handleError(_0x220638,null));};exports[_0x52bb('0x3c')]=function(_0x22c01f,_0x416914){var _0x5e714a={'raw':!![],'where':{'id':_0x22c01f[_0x52bb('0x3d')]['id']}},_0x4f7f4a={};_0x4f7f4a['model']=_['keys'](db[_0x52bb('0x39')][_0x52bb('0x3e')]);_0x4f7f4a[_0x52bb('0x2b')]=_[_0x52bb('0x2a')](_0x22c01f[_0x52bb('0x2b')]);_0x4f7f4a[_0x52bb('0x2c')]=_[_0x52bb('0x2d')](_0x4f7f4a['model'],_0x4f7f4a[_0x52bb('0x2b')]);_0x5e714a['attributes']=_['intersection'](_0x4f7f4a[_0x52bb('0x28')],qs[_0x52bb('0x3f')](_0x22c01f[_0x52bb('0x2b')][_0x52bb('0x3f')]));_0x5e714a[_0x52bb('0x2e')]=_0x5e714a['attributes']['length']?_0x5e714a['attributes']:_0x4f7f4a[_0x52bb('0x28')];if(_0x22c01f[_0x52bb('0x2b')][_0x52bb('0x40')]){_0x5e714a[_0x52bb('0x41')]=[{'all':!![]}];}_0x5e714a=_[_0x52bb('0x42')]({},_0x5e714a,_0x22c01f[_0x52bb('0x37')]);return db[_0x52bb('0x39')][_0x52bb('0x43')](_0x5e714a)[_0x52bb('0x20')](handleEntityNotFound(_0x416914,null))[_0x52bb('0x20')](respondWithResult(_0x416914,null))[_0x52bb('0x3b')](handleError(_0x416914,null));};exports[_0x52bb('0x1f')]=function(_0x1ce1f5,_0x223c2d){if(_0x1ce1f5['body']['id']){delete _0x1ce1f5[_0x52bb('0x44')]['id'];}return db[_0x52bb('0x39')][_0x52bb('0x43')]({'where':{'id':_0x1ce1f5[_0x52bb('0x3d')]['id']}})[_0x52bb('0x20')](handleEntityNotFound(_0x223c2d,null))[_0x52bb('0x20')](saveUpdates(_0x1ce1f5[_0x52bb('0x44')],null))[_0x52bb('0x20')](respondWithResult(_0x223c2d,null))[_0x52bb('0x3b')](handleError(_0x223c2d,null));};exports[_0x52bb('0x21')]=function(_0x434d33,_0x9f60c0){return db[_0x52bb('0x39')][_0x52bb('0x43')]({'where':{'id':_0x434d33['params']['id']}})['then'](handleEntityNotFound(_0x9f60c0,null))[_0x52bb('0x20')](removeEntity(_0x9f60c0,null))[_0x52bb('0x3b')](handleError(_0x9f60c0,null));};exports[_0x52bb('0x45')]=function(_0x1e949e,_0x2b43ab){var _0x2f6750;return db[_0x52bb('0x46')]['transaction'](function(_0x377355){return db['CmCustomField'][_0x52bb('0x45')](_0x1e949e[_0x52bb('0x44')],{'transaction':_0x377355})[_0x52bb('0x20')](function(_0x466b0a){_0x2f6750=_0x466b0a;var _0x35d4fe={'type':db[_0x52bb('0x47')][_0x52bb('0x48')],'transaction':_0x377355};switch(_0x1e949e[_0x52bb('0x44')][_0x52bb('0x27')]){case _0x52bb('0x49'):_0x35d4fe[_0x52bb('0x27')]=db['Sequelize'][_0x52bb('0x48')];break;case _0x52bb('0x4a'):_0x35d4fe[_0x52bb('0x27')]=db[_0x52bb('0x47')][_0x52bb('0x4b')];break;case _0x52bb('0x4c'):_0x35d4fe[_0x52bb('0x27')]=db[_0x52bb('0x47')][_0x52bb('0x4d')];_0x35d4fe[_0x52bb('0x4e')]=![];break;default:}return db[_0x52bb('0x46')][_0x52bb('0x4f')][_0x52bb('0x50')](_0x52bb('0x51'),util[_0x52bb('0x52')](_0x52bb('0x53'),_0x2f6750['id']),_0x35d4fe);})[_0x52bb('0x20')](function(){return _0x2f6750;});})['then'](respondWithResult(_0x2b43ab,0xc9))[_0x52bb('0x3b')](handleError(_0x2b43ab,null));}; \ No newline at end of file +var _0xf138=['defaultValue','queryInterface','format','cf_%d','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','name','send','index','map','CmCustomField','rawAttributes','type','differenceBy','keys','filters','intersection','model','query','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','fields','length','find','body','create','transaction','Sequelize','text','TEXT','INTEGER','switch','BOOLEAN'];(function(_0x128a51,_0x9b3dfc){var _0x33f5dc=function(_0x1757a0){while(--_0x1757a0){_0x128a51['push'](_0x128a51['shift']());}};_0x33f5dc(++_0x9b3dfc);}(_0xf138,0x103));var _0x8f13=function(_0x20e649,_0x1830f0){_0x20e649=_0x20e649-0x0;var _0x5e6397=_0xf138[_0x20e649];return _0x5e6397;};'use strict';var pdf=require(_0x8f13('0x0'));var emlformat=require(_0x8f13('0x1'));var rimraf=require(_0x8f13('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8f13('0x3'));var rp=require(_0x8f13('0x4'));var moment=require(_0x8f13('0x5'));var BPromise=require(_0x8f13('0x6'));var Mustache=require(_0x8f13('0x7'));var util=require(_0x8f13('0x8'));var path=require('path');var sox=require(_0x8f13('0x9'));var csv=require('to-csv');var ejs=require(_0x8f13('0xa'));var fs=require('fs');var _=require(_0x8f13('0xb'));var squel=require('squel');var crypto=require(_0x8f13('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8f13('0xd'));var toCsv=require(_0x8f13('0xe'));var querystring=require(_0x8f13('0xf'));var Papa=require(_0x8f13('0x10'));var Redis=require(_0x8f13('0x11'));var authService=require(_0x8f13('0x12'));var qs=require(_0x8f13('0x13'));var as=require(_0x8f13('0x14'));var hardwareService=require(_0x8f13('0x15'));var logger=require(_0x8f13('0x16'))(_0x8f13('0x17'));var utils=require(_0x8f13('0x18'));var config=require(_0x8f13('0x19'));var db=require(_0x8f13('0x1a'))['db'];function respondWithStatusCode(_0x4263d7,_0x532747){_0x532747=_0x532747||0xcc;return function(_0x22b576){if(_0x22b576){return _0x4263d7[_0x8f13('0x1b')](_0x532747);}return _0x4263d7['status'](_0x532747)[_0x8f13('0x1c')]();};}function respondWithResult(_0x514d14,_0x24b601){_0x24b601=_0x24b601||0xc8;return function(_0x4bbfb6){if(_0x4bbfb6){return _0x514d14[_0x8f13('0x1d')](_0x24b601)[_0x8f13('0x1e')](_0x4bbfb6);}};}function respondWithFilteredResult(_0x43b36b,_0x1ab0f4){return function(_0x455787){if(_0x455787){var _0x546acb=_0x455787[_0x8f13('0x1f')],_0x5c9366=_0x1ab0f4[_0x8f13('0x20')],_0x5f47ab=_0x1ab0f4[_0x8f13('0x20')]+_0x1ab0f4[_0x8f13('0x21')],_0x43d2db;if(_0x5f47ab>=_0x546acb){_0x5f47ab=_0x546acb;_0x43d2db=0xc8;}else{_0x43d2db=0xce;}_0x43b36b[_0x8f13('0x1d')](_0x43d2db);return _0x43b36b[_0x8f13('0x22')](_0x8f13('0x23'),_0x5c9366+'-'+_0x5f47ab+'/'+_0x546acb)[_0x8f13('0x1e')](_0x455787);}return null;};}function patchUpdates(_0xe301c9){return function(_0x242df3){try{jsonpatch[_0x8f13('0x24')](_0x242df3,_0xe301c9,!![]);}catch(_0x29770d){return BPromise[_0x8f13('0x25')](_0x29770d);}return _0x242df3['save']();};}function saveUpdates(_0x591478,_0x5eec5e){return function(_0x4efd69){if(_0x4efd69){return _0x4efd69[_0x8f13('0x26')](_0x591478)['then'](function(_0x34cdb3){return _0x34cdb3;});}return null;};}function removeEntity(_0x39ee9a,_0x209770){return function(_0x24719b){if(_0x24719b){return _0x24719b[_0x8f13('0x27')]()[_0x8f13('0x28')](function(){_0x39ee9a['status'](0xcc)[_0x8f13('0x1c')]();});}};}function handleEntityNotFound(_0x1e7cf8,_0x1ad8f0){return function(_0x277da8){if(!_0x277da8){_0x1e7cf8[_0x8f13('0x1b')](0x194);}return _0x277da8;};}function handleError(_0x5c388d,_0x2c2b00){_0x2c2b00=_0x2c2b00||0x1f4;return function(_0x58c635){logger['error'](_0x58c635['stack']);if(_0x58c635['name']){delete _0x58c635[_0x8f13('0x29')];}_0x5c388d[_0x8f13('0x1d')](_0x2c2b00)[_0x8f13('0x2a')](_0x58c635);};}exports[_0x8f13('0x2b')]=function(_0x23009e,_0x538056){var _0x57435a={},_0xd4c6f0={},_0x54f9f3={'count':0x0,'rows':[]};var _0x483b2d=_[_0x8f13('0x2c')](db[_0x8f13('0x2d')][_0x8f13('0x2e')],function(_0x278f9b){return{'name':_0x278f9b['fieldName'],'type':_0x278f9b[_0x8f13('0x2f')]['key']};});_0xd4c6f0['model']=_[_0x8f13('0x30')](_['map'](_0x483b2d,_0x8f13('0x29')),[_0x8f13('0x29')]);_0xd4c6f0['query']=_[_0x8f13('0x31')](_0x23009e['query']);_0xd4c6f0[_0x8f13('0x32')]=_[_0x8f13('0x33')](_0xd4c6f0[_0x8f13('0x34')],_0xd4c6f0[_0x8f13('0x35')]);_0x57435a[_0x8f13('0x36')]=_[_0x8f13('0x33')](_0xd4c6f0[_0x8f13('0x34')],qs['fields'](_0x23009e['query']['fields']));_0x57435a[_0x8f13('0x36')]=_0x57435a[_0x8f13('0x36')]['length']?_0x57435a[_0x8f13('0x36')]:_0xd4c6f0['model'];if(!_0x23009e[_0x8f13('0x35')][_0x8f13('0x37')]('nolimit')){_0x57435a[_0x8f13('0x21')]=qs[_0x8f13('0x21')](_0x23009e[_0x8f13('0x35')]['limit']);_0x57435a[_0x8f13('0x20')]=qs['offset'](_0x23009e[_0x8f13('0x35')][_0x8f13('0x20')]);}_0x57435a[_0x8f13('0x38')]=qs[_0x8f13('0x39')](_0x23009e[_0x8f13('0x35')][_0x8f13('0x39')]);_0x57435a[_0x8f13('0x3a')]=qs[_0x8f13('0x32')](_[_0x8f13('0x3b')](_0x23009e[_0x8f13('0x35')],_0xd4c6f0[_0x8f13('0x32')]),_0x483b2d);if(_0x23009e[_0x8f13('0x35')][_0x8f13('0x3c')]){_0x57435a[_0x8f13('0x3a')]=_[_0x8f13('0x3d')](_0x57435a[_0x8f13('0x3a')],{'$or':_[_0x8f13('0x2c')](_0x483b2d,function(_0x53140f){if(_0x53140f['type']!=='VIRTUAL'){var _0xac2027={};_0xac2027[_0x53140f[_0x8f13('0x29')]]={'$like':'%'+_0x23009e[_0x8f13('0x35')][_0x8f13('0x3c')]+'%'};return _0xac2027;}})});}_0x57435a=_[_0x8f13('0x3d')]({},_0x57435a,_0x23009e[_0x8f13('0x3e')]);var _0x2c9dfb={'where':_0x57435a[_0x8f13('0x3a')]};return db[_0x8f13('0x2d')][_0x8f13('0x1f')](_0x2c9dfb)[_0x8f13('0x28')](function(_0x4a0070){_0x54f9f3[_0x8f13('0x1f')]=_0x4a0070;if(_0x23009e['query'][_0x8f13('0x3f')]){_0x57435a[_0x8f13('0x40')]=[{'all':!![]}];}return db[_0x8f13('0x2d')][_0x8f13('0x41')](_0x57435a);})[_0x8f13('0x28')](function(_0x3cbeb6){_0x54f9f3['rows']=_0x3cbeb6;return _0x54f9f3;})['then'](respondWithFilteredResult(_0x538056,_0x57435a))[_0x8f13('0x42')](handleError(_0x538056,null));};exports[_0x8f13('0x43')]=function(_0x5563b0,_0x41281c){var _0x55bd2b={'raw':!![],'where':{'id':_0x5563b0[_0x8f13('0x44')]['id']}},_0x30269f={};_0x30269f['model']=_[_0x8f13('0x31')](db[_0x8f13('0x2d')][_0x8f13('0x2e')]);_0x30269f[_0x8f13('0x35')]=_[_0x8f13('0x31')](_0x5563b0[_0x8f13('0x35')]);_0x30269f['filters']=_['intersection'](_0x30269f['model'],_0x30269f[_0x8f13('0x35')]);_0x55bd2b[_0x8f13('0x36')]=_['intersection'](_0x30269f[_0x8f13('0x34')],qs[_0x8f13('0x45')](_0x5563b0[_0x8f13('0x35')][_0x8f13('0x45')]));_0x55bd2b['attributes']=_0x55bd2b['attributes'][_0x8f13('0x46')]?_0x55bd2b[_0x8f13('0x36')]:_0x30269f[_0x8f13('0x34')];if(_0x5563b0[_0x8f13('0x35')]['includeAll']){_0x55bd2b[_0x8f13('0x40')]=[{'all':!![]}];}_0x55bd2b=_['merge']({},_0x55bd2b,_0x5563b0[_0x8f13('0x3e')]);return db['CmCustomField'][_0x8f13('0x47')](_0x55bd2b)[_0x8f13('0x28')](handleEntityNotFound(_0x41281c,null))[_0x8f13('0x28')](respondWithResult(_0x41281c,null))[_0x8f13('0x42')](handleError(_0x41281c,null));};exports[_0x8f13('0x26')]=function(_0x3172c5,_0x3ab773){if(_0x3172c5[_0x8f13('0x48')]['id']){delete _0x3172c5[_0x8f13('0x48')]['id'];}return db['CmCustomField']['find']({'where':{'id':_0x3172c5['params']['id']}})[_0x8f13('0x28')](handleEntityNotFound(_0x3ab773,null))[_0x8f13('0x28')](saveUpdates(_0x3172c5['body'],null))[_0x8f13('0x28')](respondWithResult(_0x3ab773,null))['catch'](handleError(_0x3ab773,null));};exports[_0x8f13('0x27')]=function(_0x7d04b8,_0x4899a7){return db[_0x8f13('0x2d')][_0x8f13('0x47')]({'where':{'id':_0x7d04b8['params']['id']}})['then'](handleEntityNotFound(_0x4899a7,null))[_0x8f13('0x28')](removeEntity(_0x4899a7,null))[_0x8f13('0x42')](handleError(_0x4899a7,null));};exports[_0x8f13('0x49')]=function(_0x2ec232,_0x1a9051){var _0x263c85;return db['sequelize'][_0x8f13('0x4a')](function(_0x55ceea){return db[_0x8f13('0x2d')]['create'](_0x2ec232['body'],{'transaction':_0x55ceea})[_0x8f13('0x28')](function(_0x773f7c){_0x263c85=_0x773f7c;var _0x174bf1={'type':db[_0x8f13('0x4b')]['TEXT'],'transaction':_0x55ceea};switch(_0x2ec232[_0x8f13('0x48')][_0x8f13('0x2f')]){case _0x8f13('0x4c'):_0x174bf1['type']=db[_0x8f13('0x4b')][_0x8f13('0x4d')];break;case'number':_0x174bf1[_0x8f13('0x2f')]=db[_0x8f13('0x4b')][_0x8f13('0x4e')];break;case _0x8f13('0x4f'):_0x174bf1[_0x8f13('0x2f')]=db[_0x8f13('0x4b')][_0x8f13('0x50')];_0x174bf1[_0x8f13('0x51')]=![];break;default:}return db['sequelize'][_0x8f13('0x52')]['addColumn']('cm_contacts',util[_0x8f13('0x53')](_0x8f13('0x54'),_0x263c85['id']),_0x174bf1);})[_0x8f13('0x28')](function(){return _0x263c85;});})['then'](respondWithResult(_0x1a9051,0xc9))[_0x8f13('0x42')](handleError(_0x1a9051,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index bac96d4..cd4962e 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 _0xb4fc=['../../config/environment','./cmCustomField.attributes','exports','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x177d44,_0x2f1574){var _0x26e5e1=function(_0x428a35){while(--_0x428a35){_0x177d44['push'](_0x177d44['shift']());}};_0x26e5e1(++_0x2f1574);}(_0xb4fc,0x198));var _0xcb4f=function(_0x5a9d0e,_0x1f3230){_0x5a9d0e=_0x5a9d0e-0x0;var _0x28f27e=_0xb4fc[_0x5a9d0e];return _0x28f27e;};'use strict';var _=require(_0xcb4f('0x0'));var util=require(_0xcb4f('0x1'));var logger=require(_0xcb4f('0x2'))(_0xcb4f('0x3'));var moment=require(_0xcb4f('0x4'));var BPromise=require(_0xcb4f('0x5'));var rp=require(_0xcb4f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcb4f('0x7'));var config=require(_0xcb4f('0x8'));var attributes=require(_0xcb4f('0x9'));module[_0xcb4f('0xa')]=function(_0x18ae57,_0x308b62){return _0x18ae57['define'](_0xcb4f('0xb'),attributes,{'tableName':_0xcb4f('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd38=['define','CmCustomField','lodash','util','../../config/logger','moment','bluebird','../../config/environment'];(function(_0x179c0d,_0xc67776){var _0x40c885=function(_0x2f74ef){while(--_0x2f74ef){_0x179c0d['push'](_0x179c0d['shift']());}};_0x40c885(++_0xc67776);}(_0xbd38,0xe2));var _0x8bd3=function(_0x539d0e,_0x198e88){_0x539d0e=_0x539d0e-0x0;var _0x502a1d=_0xbd38[_0x539d0e];return _0x502a1d;};'use strict';var _=require(_0x8bd3('0x0'));var util=require(_0x8bd3('0x1'));var logger=require(_0x8bd3('0x2'))('api');var moment=require(_0x8bd3('0x3'));var BPromise=require(_0x8bd3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8bd3('0x5'));var attributes=require('./cmCustomField.attributes');module['exports']=function(_0x4c9bce,_0x2afd5e){return _0x4c9bce[_0x8bd3('0x6')](_0x8bd3('0x7'),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 df8adc1..3ef3f51 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 _0xadb8=['CmCustomField,\x20%s,\x20%s','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x184b00,_0x5a10c7){var _0x29ba1b=function(_0x58bc37){while(--_0x58bc37){_0x184b00['push'](_0x184b00['shift']());}};_0x29ba1b(++_0x5a10c7);}(_0xadb8,0x1d0));var _0x8adb=function(_0x400b6c,_0x4a6139){_0x400b6c=_0x400b6c-0x0;var _0x4c4e3e=_0xadb8[_0x400b6c];return _0x4c4e3e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8adb('0x0'));var BPromise=require('bluebird');var rs=require(_0x8adb('0x1'));var fs=require('fs');var Redis=require(_0x8adb('0x2'));var db=require(_0x8adb('0x3'))['db'];var utils=require(_0x8adb('0x4'));var logger=require(_0x8adb('0x5'))(_0x8adb('0x6'));var config=require(_0x8adb('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8adb('0x8')][_0x8adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x9f435,_0x2bebfe,_0x271bed){return new BPromise(function(_0x16b932,_0x27d994){return client['request'](_0x9f435,_0x271bed)['then'](function(_0x58ad1a){logger[_0x8adb('0xa')]('CmCustomField,\x20%s,\x20%s',_0x2bebfe,'request\x20sent');logger['debug'](_0x8adb('0xb'),_0x2bebfe,_0x8adb('0xc'),JSON[_0x8adb('0xd')](_0x58ad1a));if(_0x58ad1a[_0x8adb('0xe')]){if(_0x58ad1a[_0x8adb('0xe')][_0x8adb('0xf')]===0x1f4){logger[_0x8adb('0xe')](_0x8adb('0x10'),_0x2bebfe,_0x58ad1a[_0x8adb('0xe')][_0x8adb('0x11')]);return _0x27d994(_0x58ad1a['error']['message']);}logger['error'](_0x8adb('0x10'),_0x2bebfe,_0x58ad1a['error'][_0x8adb('0x11')]);return _0x16b932(_0x58ad1a[_0x8adb('0xe')][_0x8adb('0x11')]);}else{logger['info'](_0x8adb('0x10'),_0x2bebfe,_0x8adb('0xc'));_0x16b932(_0x58ad1a[_0x8adb('0x12')][_0x8adb('0x11')]);}})[_0x8adb('0x13')](function(_0x13659c){logger['error'](_0x8adb('0x10'),_0x2bebfe,_0x13659c);_0x27d994(_0x13659c);});});} \ No newline at end of file +var _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x10fc58,_0x284788){var _0x4ec867=function(_0x2badb4){while(--_0x2badb4){_0x10fc58['push'](_0x10fc58['shift']());}};_0x4ec867(++_0x284788);}(_0x34e8,0x12c));var _0x834e=function(_0x19296f,_0x29412c){_0x19296f=_0x19296f-0x0;var _0x514544=_0x34e8[_0x19296f];return _0x514544;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('CmCustomField,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('CmCustomField,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index d5ad5c6..e2890af 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 _0xedf3=['util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','show','post','create','put','/:id','delete','destroy','exports'];(function(_0x1bf809,_0x536f55){var _0x1caa4e=function(_0x9f9636){while(--_0x9f9636){_0x1bf809['push'](_0x1bf809['shift']());}};_0x1caa4e(++_0x536f55);}(_0xedf3,0x17a));var _0x3edf=function(_0x4aa838,_0x4aa14f){_0x4aa838=_0x4aa838-0x0;var _0x3abff0=_0xedf3[_0x4aa838];return _0x3abff0;};'use strict';var multer=require('multer');var util=require(_0x3edf('0x0'));var path=require(_0x3edf('0x1'));var timeout=require(_0x3edf('0x2'));var express=require(_0x3edf('0x3'));var router=express[_0x3edf('0x4')]();var auth=require(_0x3edf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3edf('0x6'));var controller=require(_0x3edf('0x7'));router[_0x3edf('0x8')]('/',auth[_0x3edf('0x9')](),controller['index']);router[_0x3edf('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x3edf('0xa')]);router[_0x3edf('0xb')]('/',auth[_0x3edf('0x9')](),controller[_0x3edf('0xc')]);router[_0x3edf('0xd')](_0x3edf('0xe'),auth[_0x3edf('0x9')](),controller['update']);router[_0x3edf('0xf')](_0x3edf('0xe'),auth[_0x3edf('0x9')](),controller[_0x3edf('0x10')]);module[_0x3edf('0x11')]=router; \ No newline at end of file +var _0x6222=['express','../../components/interaction/service','get','isAuthenticated','/:id','show','post','create','put','update','destroy','util','path'];(function(_0x54fd02,_0x3cf8c3){var _0xc294ef=function(_0x1eef16){while(--_0x1eef16){_0x54fd02['push'](_0x54fd02['shift']());}};_0xc294ef(++_0x3cf8c3);}(_0x6222,0x9a));var _0x2622=function(_0x11db7a,_0x1fcdca){_0x11db7a=_0x11db7a-0x0;var _0x29e9eb=_0x6222[_0x11db7a];return _0x29e9eb;};'use strict';var multer=require('multer');var util=require(_0x2622('0x0'));var path=require(_0x2622('0x1'));var timeout=require('connect-timeout');var express=require(_0x2622('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x2622('0x3'));var config=require('../../config/environment');var controller=require('./cmCustomField.controller');router[_0x2622('0x4')]('/',auth[_0x2622('0x5')](),controller['index']);router[_0x2622('0x4')](_0x2622('0x6'),auth['isAuthenticated'](),controller[_0x2622('0x7')]);router[_0x2622('0x8')]('/',auth[_0x2622('0x5')](),controller[_0x2622('0x9')]);router[_0x2622('0xa')](_0x2622('0x6'),auth[_0x2622('0x5')](),controller[_0x2622('0xb')]);router['delete'](_0x2622('0x6'),auth[_0x2622('0x5')](),controller[_0x2622('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 96df971..0641e1e 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 _0x207c=['STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','sequelize','exports'];(function(_0xb66df,_0x4fb5ce){var _0x42a702=function(_0x252d1d){while(--_0x252d1d){_0xb66df['push'](_0xb66df['shift']());}};_0x42a702(++_0x4fb5ce);}(_0x207c,0x1e8));var _0xc207=function(_0x316b3e,_0x47b154){_0x316b3e=_0x316b3e-0x0;var _0x45ba95=_0x207c[_0x316b3e];return _0x45ba95;};'use strict';var moment=require('moment');var Sequelize=require(_0xc207('0x0'));module[_0xc207('0x1')]={'phone':{'type':Sequelize[_0xc207('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xc207('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xc207('0x4')],'defaultValue':moment()[_0xc207('0x5')](_0xc207('0x6'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xc207('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xc207('0x4')]},'priority':{'type':Sequelize[_0xc207('0x7')](0x2)[_0xc207('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xc207('0x7')],'unique':_0xc207('0x9')},'ListId':{'type':Sequelize[_0xc207('0x7')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0xc207('0x7')]},'VoiceQueueId':{'type':Sequelize[_0xc207('0x7')],'unique':_0xc207('0x9')},'CampaignId':{'type':Sequelize[_0xc207('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0xc207('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xc207('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xdbf5=['sequelize','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','UNSIGNED','contactListQueue'];(function(_0x23929b,_0xb17ea6){var _0x23d545=function(_0x3be2be){while(--_0x3be2be){_0x23929b['push'](_0x23929b['shift']());}};_0x23d545(++_0xb17ea6);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x1fd558,_0x3556d0){_0x1fd558=_0x1fd558-0x0;var _0x4f0c36=_0xdbf5[_0x1fd558];return _0x4f0c36;};'use strict';var moment=require('moment');var Sequelize=require(_0x5dbf('0x0'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x5dbf('0x1')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x5dbf('0x2')],'defaultValue':moment()[_0x5dbf('0x3')](_0x5dbf('0x4'))},'countbusyretry':{'type':Sequelize[_0x5dbf('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5dbf('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5dbf('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x5dbf('0x1')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5dbf('0x6')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x5dbf('0x2')]},'priority':{'type':Sequelize[_0x5dbf('0x5')](0x2)[_0x5dbf('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x5dbf('0x1')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x5dbf('0x8')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x5dbf('0x8')},'UserId':{'type':Sequelize[_0x5dbf('0x5')]},'VoiceQueueId':{'type':Sequelize[_0x5dbf('0x5')],'unique':_0x5dbf('0x8')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x5dbf('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5dbf('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 92c3d22..0792591 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 _0x76d2=['then','destroy','error','stack','name','send','index','map','CmHopper','key','model','query','keys','filters','intersection','concat','$or','$gt','$gte','$lt','$lte','$ne','$eq','$between','$notBetween','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','attributes','fields','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','dataValues','updatedAt','state','statedesc','deleted','campaign','membername','user','deletedat','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','finally','end','getVoiceQueues','outbound','preview','transaction','format','direction','prev','isEmpty','hopperIds','ASC','dialOrderByScheduledAt','DESC','sequelize','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','literal','Contact','CmCompany','Company','CmList','List','Queue','dialActive','getOpenContacts','isNumber','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update'];(function(_0x48abf0,_0x22a199){var _0x2b75e6=function(_0x59e940){while(--_0x59e940){_0x48abf0['push'](_0x48abf0['shift']());}};_0x2b75e6(++_0x22a199);}(_0x76d2,0xf3));var _0x276d=function(_0xee54c3,_0x219399){_0xee54c3=_0xee54c3-0x0;var _0x35b8ef=_0x76d2[_0xee54c3];return _0x35b8ef;};'use strict';var pdf=require(_0x276d('0x0'));var emlformat=require(_0x276d('0x1'));var rimraf=require(_0x276d('0x2'));var zipdir=require(_0x276d('0x3'));var jsonpatch=require(_0x276d('0x4'));var rp=require(_0x276d('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x276d('0x6'));var util=require('util');var path=require(_0x276d('0x7'));var sox=require(_0x276d('0x8'));var csv=require(_0x276d('0x9'));var ejs=require(_0x276d('0xa'));var fs=require('fs');var _=require(_0x276d('0xb'));var squel=require(_0x276d('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x276d('0xd'));var toCsv=require(_0x276d('0x9'));var querystring=require(_0x276d('0xe'));var Papa=require(_0x276d('0xf'));var Redis=require('ioredis');var authService=require(_0x276d('0x10'));var qs=require(_0x276d('0x11'));var as=require(_0x276d('0x12'));var hardwareService=require(_0x276d('0x13'));var logger=require(_0x276d('0x14'))(_0x276d('0x15'));var utils=require('../../config/utils');var config=require(_0x276d('0x16'));var db=require(_0x276d('0x17'))['db'];function respondWithStatusCode(_0x270ae6,_0x47f366){_0x47f366=_0x47f366||0xcc;return function(_0x1c6a29){if(_0x1c6a29){return _0x270ae6[_0x276d('0x18')](_0x47f366);}return _0x270ae6[_0x276d('0x19')](_0x47f366)['end']();};}function respondWithResult(_0x30cc0c,_0x388504){_0x388504=_0x388504||0xc8;return function(_0x2cee26){if(_0x2cee26){return _0x30cc0c['status'](_0x388504)[_0x276d('0x1a')](_0x2cee26);}};}function respondWithFilteredResult(_0x573e8d,_0x2d3515){return function(_0x3e68bf){if(_0x3e68bf){var _0x3d3ccc=_0x3e68bf[_0x276d('0x1b')],_0x439c8d=_0x2d3515[_0x276d('0x1c')],_0x4831ee=_0x2d3515[_0x276d('0x1c')]+_0x2d3515[_0x276d('0x1d')],_0x74beab;if(_0x4831ee>=_0x3d3ccc){_0x4831ee=_0x3d3ccc;_0x74beab=0xc8;}else{_0x74beab=0xce;}_0x573e8d['status'](_0x74beab);return _0x573e8d[_0x276d('0x1e')]('Content-Range',_0x439c8d+'-'+_0x4831ee+'/'+_0x3d3ccc)[_0x276d('0x1a')](_0x3e68bf);}return null;};}function patchUpdates(_0x478fe5){return function(_0x50e217){try{jsonpatch[_0x276d('0x1f')](_0x50e217,_0x478fe5,!![]);}catch(_0x3f94f7){return BPromise[_0x276d('0x20')](_0x3f94f7);}return _0x50e217[_0x276d('0x21')]();};}function saveUpdates(_0x23ce98,_0x4c8802){return function(_0x587b72){if(_0x587b72){return _0x587b72[_0x276d('0x22')](_0x23ce98)[_0x276d('0x23')](function(_0x3a3ca5){return _0x3a3ca5;});}return null;};}function removeEntity(_0x14b401,_0xbdc4b7){return function(_0x296e9b){if(_0x296e9b){return _0x296e9b[_0x276d('0x24')]()[_0x276d('0x23')](function(){_0x14b401[_0x276d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55fd7d,_0x34387a){return function(_0x533bd5){if(!_0x533bd5){_0x55fd7d[_0x276d('0x18')](0x194);}return _0x533bd5;};}function handleError(_0x3cf802,_0x3dfd28){_0x3dfd28=_0x3dfd28||0x1f4;return function(_0x185407){logger[_0x276d('0x25')](_0x185407[_0x276d('0x26')]);if(_0x185407[_0x276d('0x27')]){delete _0x185407['name'];}_0x3cf802[_0x276d('0x19')](_0x3dfd28)[_0x276d('0x28')](_0x185407);};}exports[_0x276d('0x29')]=function(_0x44e4b4,_0x470ae9){var _0xfd26cf={},_0x40b017={},_0x4c9ed9={'count':0x0,'rows':[]};var _0x52d5c9=_[_0x276d('0x2a')](db[_0x276d('0x2b')]['rawAttributes'],function(_0x31fa2d){return{'name':_0x31fa2d['fieldName'],'type':_0x31fa2d['type'][_0x276d('0x2c')]};});_0x40b017[_0x276d('0x2d')]=_[_0x276d('0x2a')](_0x52d5c9,'name');_0x40b017[_0x276d('0x2e')]=_[_0x276d('0x2f')](_0x44e4b4[_0x276d('0x2e')]);_0x40b017[_0x276d('0x30')]=_[_0x276d('0x31')](_0x40b017['model'],_0x40b017[_0x276d('0x2e')]);_0x40b017[_0x276d('0x30')]=_[_0x276d('0x32')](_0x40b017[_0x276d('0x30')],['$and',_0x276d('0x33'),_0x276d('0x34'),_0x276d('0x35'),_0x276d('0x36'),_0x276d('0x37'),_0x276d('0x38'),_0x276d('0x39'),'$not',_0x276d('0x3a'),_0x276d('0x3b'),'$in',_0x276d('0x3c'),_0x276d('0x3d'),_0x276d('0x3e'),_0x276d('0x3f'),_0x276d('0x40'),'$like',_0x276d('0x41'),_0x276d('0x42'),_0x276d('0x43'),'$any']);_0xfd26cf[_0x276d('0x44')]=_[_0x276d('0x31')](_0x40b017['model'],qs[_0x276d('0x45')](_0x44e4b4[_0x276d('0x2e')][_0x276d('0x45')]));_0xfd26cf[_0x276d('0x44')]=_0xfd26cf[_0x276d('0x44')]['length']?_0xfd26cf['attributes']:_0x40b017[_0x276d('0x2d')];if(!_0x44e4b4[_0x276d('0x2e')][_0x276d('0x46')]('nolimit')){_0xfd26cf[_0x276d('0x1d')]=qs[_0x276d('0x1d')](_0x44e4b4[_0x276d('0x2e')][_0x276d('0x1d')]);_0xfd26cf[_0x276d('0x1c')]=qs['offset'](_0x44e4b4[_0x276d('0x2e')][_0x276d('0x1c')]);}_0xfd26cf['order']=qs[_0x276d('0x47')](_0x44e4b4[_0x276d('0x2e')][_0x276d('0x47')]);_0xfd26cf['where']=qs['filters'](_[_0x276d('0x48')](_0x44e4b4[_0x276d('0x2e')],_0x40b017[_0x276d('0x30')]),_0x52d5c9);if(_0x44e4b4[_0x276d('0x2e')][_0x276d('0x49')]){_0xfd26cf[_0x276d('0x4a')]=_[_0x276d('0x4b')](_0xfd26cf[_0x276d('0x4a')],{'$or':_[_0x276d('0x2a')](_0x52d5c9,function(_0x1ca0ec){if(_0x1ca0ec['type']!==_0x276d('0x4c')){var _0x446ad9={};_0x446ad9[_0x1ca0ec[_0x276d('0x27')]]={'$like':'%'+_0x44e4b4[_0x276d('0x2e')][_0x276d('0x49')]+'%'};return _0x446ad9;}})});}_0xfd26cf=_[_0x276d('0x4b')]({},_0xfd26cf,_0x44e4b4[_0x276d('0x4d')]);var _0x758840={'where':_0xfd26cf[_0x276d('0x4a')]};return db[_0x276d('0x2b')][_0x276d('0x1b')](_0x758840)[_0x276d('0x23')](function(_0x3ba6c3){_0x4c9ed9[_0x276d('0x1b')]=_0x3ba6c3;if(_0x44e4b4[_0x276d('0x2e')][_0x276d('0x4e')]){_0xfd26cf[_0x276d('0x4f')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0xfd26cf);})[_0x276d('0x23')](function(_0x213ce7){_0x4c9ed9[_0x276d('0x50')]=_0x213ce7;return _0x4c9ed9;})[_0x276d('0x23')](respondWithFilteredResult(_0x470ae9,_0xfd26cf))[_0x276d('0x51')](handleError(_0x470ae9,null));};exports[_0x276d('0x52')]=function(_0x1baf72,_0x307f82){var _0x20d240={'raw':!![],'where':{'id':_0x1baf72[_0x276d('0x53')]['id']}},_0x55e9dc={};_0x55e9dc[_0x276d('0x2d')]=_['keys'](db[_0x276d('0x2b')][_0x276d('0x54')]);_0x55e9dc[_0x276d('0x2e')]=_[_0x276d('0x2f')](_0x1baf72[_0x276d('0x2e')]);_0x55e9dc[_0x276d('0x30')]=_[_0x276d('0x31')](_0x55e9dc['model'],_0x55e9dc['query']);_0x20d240[_0x276d('0x44')]=_[_0x276d('0x31')](_0x55e9dc[_0x276d('0x2d')],qs['fields'](_0x1baf72[_0x276d('0x2e')]['fields']));_0x20d240[_0x276d('0x44')]=_0x20d240[_0x276d('0x44')][_0x276d('0x55')]?_0x20d240[_0x276d('0x44')]:_0x55e9dc[_0x276d('0x2d')];if(_0x1baf72[_0x276d('0x2e')][_0x276d('0x4e')]){_0x20d240['include']=[{'all':!![]}];}_0x20d240=_[_0x276d('0x4b')]({},_0x20d240,_0x1baf72[_0x276d('0x4d')]);return db['CmHopper'][_0x276d('0x56')](_0x20d240)[_0x276d('0x23')](handleEntityNotFound(_0x307f82,null))[_0x276d('0x23')](respondWithResult(_0x307f82,null))[_0x276d('0x51')](handleError(_0x307f82,null));};exports[_0x276d('0x57')]=function(_0x5094b0,_0x4be23b){return db['CmHopper'][_0x276d('0x57')](_0x5094b0[_0x276d('0x58')],{})[_0x276d('0x23')](respondWithResult(_0x4be23b,0xc9))['catch'](handleError(_0x4be23b,null));};exports[_0x276d('0x22')]=function(_0xa0e0e0,_0x59e1dc){if(_0xa0e0e0[_0x276d('0x58')]['id']){delete _0xa0e0e0[_0x276d('0x58')]['id'];}return db[_0x276d('0x2b')]['find']({'where':{'id':_0xa0e0e0[_0x276d('0x53')]['id']}})[_0x276d('0x23')](handleEntityNotFound(_0x59e1dc,null))['then'](saveUpdates(_0xa0e0e0[_0x276d('0x58')],null))[_0x276d('0x23')](respondWithResult(_0x59e1dc,null))['catch'](handleError(_0x59e1dc,null));};exports['describe']=function(_0x184c4a,_0x546cce){return db[_0x276d('0x2b')][_0x276d('0x59')]()[_0x276d('0x23')](respondWithResult(_0x546cce,null))['catch'](handleError(_0x546cce,null));};exports[_0x276d('0x24')]=function(_0x1138a2,_0x2bc483){var _0x5d077c;return db[_0x276d('0x2b')][_0x276d('0x56')]({'where':{'id':_0x1138a2[_0x276d('0x53')]['id']}})[_0x276d('0x23')](handleEntityNotFound(_0x2bc483,null))['then'](function(_0x5543b0){if(_0x5543b0){return _0x5543b0[_0x276d('0x24')]()[_0x276d('0x23')](function(_0x125cb8){return _0x125cb8;});}})[_0x276d('0x23')](function(_0x67714c){_0x5d077c=_0x67714c;if(_0x67714c){if(_0x67714c[_0x276d('0x5a')]||_0x67714c[_0x276d('0x5b')]){return db[_0x67714c['VoiceQueueId']?_0x276d('0x5c'):'Campaign'][_0x276d('0x56')]({'where':{'id':_0x67714c[_0x276d('0x5a')]?_0x67714c[_0x276d('0x5a')]:_0x67714c[_0x276d('0x5b')]},'attributes':['id',_0x276d('0x27')],'raw':!![]});}}})[_0x276d('0x23')](function(_0x4003b4){var _0x42c964={};if(_0x4003b4){_[_0x276d('0x4b')](_0x42c964,_['omit'](_0x5d077c[_0x276d('0x5d')],['createdAt',_0x276d('0x5e'),'id']));_0x42c964[_0x276d('0x5f')]=0x15;_0x42c964[_0x276d('0x60')]=_0x276d('0x61');_0x42c964[_0x276d('0x62')]=_0x4003b4['name'];_0x42c964[_0x276d('0x63')]=_0x1138a2['user'][_0x276d('0x27')];_0x42c964['UserId']=_0x1138a2[_0x276d('0x64')]['id'];_0x42c964[_0x276d('0x61')]=!![];_0x42c964[_0x276d('0x65')]=moment()['format'](_0x276d('0x66'));_0x42c964['calleridnum']=_0x5d077c[_0x276d('0x67')];_0x42c964[_0x276d('0x68')]=_0x5d077c[_0x276d('0x5a')]?_0x276d('0x69'):_0x276d('0x6a');return db[_0x276d('0x6b')][_0x276d('0x56')]({'where':{'id':_0x42c964[_0x276d('0x6c')]},'attributes':[_0x276d('0x6d'),_0x276d('0x6e')]})[_0x276d('0x23')](function(_0x28e3c7){if(!_[_0x276d('0x6f')](_0x2bc483)&&!_[_0x276d('0x6f')](_0x28e3c7[_0x276d('0x6d')])){_0x42c964['calleridname']=_0x28e3c7[_0x276d('0x6d')];if(!_[_0x276d('0x6f')](_0x28e3c7['lastName'])){_0x42c964['calleridname']+='\x20'+_0x28e3c7[_0x276d('0x6e')];}}})[_0x276d('0x70')](function(){return db['CmHopperFinal']['create'](_0x42c964);});}})['then'](function(){return _0x2bc483[_0x276d('0x19')](0xcc)[_0x276d('0x71')]();})['catch'](handleError(_0x2bc483,null));};exports['getPreview']=function(_0x5c14cc,_0x5e66d8,_0x2a579a){var _0x4f8c5d=[];return db[_0x276d('0x6b')][_0x276d('0x59')]()[_0x276d('0x23')](function(_0x2973f7){_0x4f8c5d=_[_0x276d('0x2f')](_0x2973f7);return _0x5c14cc[_0x276d('0x64')][_0x276d('0x72')]({'where':{'type':_0x276d('0x73'),'dialActive':!![],'dialMethod':_0x276d('0x74')},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})['then'](function(_0x59d670){if(_0x59d670&&_0x59d670[_0x276d('0x55')]){return db['sequelize'][_0x276d('0x75')](function(_0x180a34){var _0x4e93cf={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x276d('0x76')](_0x276d('0x66'))},'VoiceQueueId':{'$in':_[_0x276d('0x2a')](_0x59d670,'id')},'$or':[{'UserId':null},{'UserId':_0x5c14cc[_0x276d('0x64')]['id']}]};var _0x5e58c9=[];if(_0x5c14cc[_0x276d('0x58')][_0x276d('0x77')]&&_0x5c14cc[_0x276d('0x58')][_0x276d('0x77')]===_0x276d('0x78')){if(!_[_0x276d('0x79')](_0x5c14cc[_0x276d('0x58')][_0x276d('0x7a')])){_0x4e93cf['id']={'$in':_0x5c14cc[_0x276d('0x58')]['hopperIds']};}_0x5e58c9=[['priority',_0x276d('0x7b')],['scheduledAt',_0x59d670[0x0][_0x276d('0x7c')]===_0x276d('0x7b')?_0x276d('0x7d'):_0x276d('0x7b')],db[_0x276d('0x7e')]['literal'](_0x276d('0x7f')),['id','DESC']];}else{if(!_[_0x276d('0x79')](_0x5c14cc[_0x276d('0x58')][_0x276d('0x7a')])){_0x4e93cf['id']={'$notIn':_0x5c14cc[_0x276d('0x58')][_0x276d('0x7a')]};}_0x5e58c9=[['priority',_0x276d('0x7d')],[_0x276d('0x80'),_0x59d670[0x0][_0x276d('0x7c')]],db[_0x276d('0x7e')][_0x276d('0x81')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x276d('0x7b')]];}return db[_0x276d('0x2b')]['findOne']({'attributes':['id','scheduledat'],'where':_0x4e93cf,'order':_0x5e58c9,'transaction':_0x180a34,'lock':_0x180a34['LOCK']['UPDATE'],'include':[{'model':db[_0x276d('0x6b')],'as':_0x276d('0x82'),'attributes':_0x4f8c5d,'include':[{'model':db[_0x276d('0x83')],'as':_0x276d('0x84'),'attributes':['id',_0x276d('0x27')]}]},{'model':db[_0x276d('0x85')],'as':_0x276d('0x86'),'attributes':['id','name']},{'model':db[_0x276d('0x5c')],'as':_0x276d('0x87'),'attributes':['id',_0x276d('0x27'),_0x276d('0x88')]}]})['then'](function(_0xfc1c78){if(_0xfc1c78){return _0xfc1c78[_0x276d('0x22')]({'UserId':_0x5c14cc['user']['id']},{'transaction':_0x180a34});}});});}})['then'](handleEntityNotFound(_0x5e66d8,null))['then'](respondWithResult(_0x5e66d8,null))[_0x276d('0x51')](handleError(_0x5e66d8,null));};exports[_0x276d('0x89')]=function(_0x2726a9,_0x38039c,_0x320db2){return _0x2726a9[_0x276d('0x64')][_0x276d('0x72')]({'where':{'type':_0x276d('0x73'),'dialActive':!![],'dialMethod':_0x276d('0x74')},'attributes':['id'],'raw':!![]})[_0x276d('0x23')](function(_0x37d504){if(_0x37d504&&_0x37d504[_0x276d('0x55')]){return db[_0x276d('0x2b')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x37d504,'id')},'$or':[{'UserId':null},{'UserId':_0x2726a9[_0x276d('0x64')]['id']}]}});}return 0x0;})[_0x276d('0x23')](function(_0x3754ec){if(!_[_0x276d('0x6f')](_0x3754ec)&&_[_0x276d('0x8a')](_0x3754ec)){return _0x38039c[_0x276d('0x19')](0xc8)[_0x276d('0x1a')]({'contacts':_0x3754ec});}else{logger['error']('CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts',0x194,'entity\x20not\x20found');_0x38039c[_0x276d('0x18')](0x194);}})[_0x276d('0x51')](handleError(_0x38039c,null));}; \ No newline at end of file +var _0xda21=['calleridname','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','direction','prev','hopperIds','priority','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','scheduledAt','findOne','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','dialActive','getOpenContacts','isNumber','entity\x20not\x20found','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','lodash','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','concat','$and','$or','$gt','$gte','$lt','$lte','$eq','$not','$between','$notBetween','$notIn','$like','$notILike','$contains','$any','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','CmHopper','findAll','rows','catch','params','keys','includeAll','find','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','statedesc','deleted','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil'];(function(_0x54b617,_0x41a196){var _0x294435=function(_0x1213bf){while(--_0x1213bf){_0x54b617['push'](_0x54b617['shift']());}};_0x294435(++_0x41a196);}(_0xda21,0x141));var _0x1da2=function(_0x10814f,_0x43bfc0){_0x10814f=_0x10814f-0x0;var _0x47e19a=_0xda21[_0x10814f];return _0x47e19a;};'use strict';var pdf=require(_0x1da2('0x0'));var emlformat=require(_0x1da2('0x1'));var rimraf=require(_0x1da2('0x2'));var zipdir=require(_0x1da2('0x3'));var jsonpatch=require(_0x1da2('0x4'));var rp=require(_0x1da2('0x5'));var moment=require(_0x1da2('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1da2('0x7'));var path=require(_0x1da2('0x8'));var sox=require('sox');var csv=require(_0x1da2('0x9'));var ejs=require(_0x1da2('0xa'));var fs=require('fs');var _=require(_0x1da2('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1da2('0xc'));var toCsv=require(_0x1da2('0x9'));var querystring=require('querystring');var Papa=require(_0x1da2('0xd'));var Redis=require('ioredis');var authService=require(_0x1da2('0xe'));var qs=require(_0x1da2('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1da2('0x10'));var logger=require(_0x1da2('0x11'))('api');var utils=require(_0x1da2('0x12'));var config=require(_0x1da2('0x13'));var db=require(_0x1da2('0x14'))['db'];function respondWithStatusCode(_0x5dac5f,_0xa4e361){_0xa4e361=_0xa4e361||0xcc;return function(_0x453afd){if(_0x453afd){return _0x5dac5f['sendStatus'](_0xa4e361);}return _0x5dac5f['status'](_0xa4e361)[_0x1da2('0x15')]();};}function respondWithResult(_0x3058fa,_0x3fe990){_0x3fe990=_0x3fe990||0xc8;return function(_0x1d74e3){if(_0x1d74e3){return _0x3058fa[_0x1da2('0x16')](_0x3fe990)[_0x1da2('0x17')](_0x1d74e3);}};}function respondWithFilteredResult(_0x138962,_0x15fb7){return function(_0x40ba13){if(_0x40ba13){var _0x4d534d=_0x40ba13[_0x1da2('0x18')],_0x594ffb=_0x15fb7[_0x1da2('0x19')],_0x3ff197=_0x15fb7[_0x1da2('0x19')]+_0x15fb7[_0x1da2('0x1a')],_0x518d77;if(_0x3ff197>=_0x4d534d){_0x3ff197=_0x4d534d;_0x518d77=0xc8;}else{_0x518d77=0xce;}_0x138962[_0x1da2('0x16')](_0x518d77);return _0x138962['set'](_0x1da2('0x1b'),_0x594ffb+'-'+_0x3ff197+'/'+_0x4d534d)[_0x1da2('0x17')](_0x40ba13);}return null;};}function patchUpdates(_0x30d154){return function(_0x250bc8){try{jsonpatch[_0x1da2('0x1c')](_0x250bc8,_0x30d154,!![]);}catch(_0x63b41e){return BPromise[_0x1da2('0x1d')](_0x63b41e);}return _0x250bc8[_0x1da2('0x1e')]();};}function saveUpdates(_0x31f5da,_0x4c2fc1){return function(_0x4141bb){if(_0x4141bb){return _0x4141bb[_0x1da2('0x1f')](_0x31f5da)[_0x1da2('0x20')](function(_0x379673){return _0x379673;});}return null;};}function removeEntity(_0x251f34,_0x37b1ea){return function(_0x3083db){if(_0x3083db){return _0x3083db[_0x1da2('0x21')]()[_0x1da2('0x20')](function(){_0x251f34[_0x1da2('0x16')](0xcc)[_0x1da2('0x15')]();});}};}function handleEntityNotFound(_0xbf3c4a,_0x2984fc){return function(_0x341220){if(!_0x341220){_0xbf3c4a[_0x1da2('0x22')](0x194);}return _0x341220;};}function handleError(_0x5b9fe6,_0x4105d3){_0x4105d3=_0x4105d3||0x1f4;return function(_0x1d9236){logger[_0x1da2('0x23')](_0x1d9236['stack']);if(_0x1d9236[_0x1da2('0x24')]){delete _0x1d9236[_0x1da2('0x24')];}_0x5b9fe6[_0x1da2('0x16')](_0x4105d3)[_0x1da2('0x25')](_0x1d9236);};}exports[_0x1da2('0x26')]=function(_0x250eba,_0xe00933){var _0xe6896d={},_0x235f5e={},_0xcb5e0d={'count':0x0,'rows':[]};var _0x2408a8=_[_0x1da2('0x27')](db['CmHopper'][_0x1da2('0x28')],function(_0x4fa4c0){return{'name':_0x4fa4c0[_0x1da2('0x29')],'type':_0x4fa4c0['type'][_0x1da2('0x2a')]};});_0x235f5e[_0x1da2('0x2b')]=_[_0x1da2('0x27')](_0x2408a8,_0x1da2('0x24'));_0x235f5e[_0x1da2('0x2c')]=_['keys'](_0x250eba['query']);_0x235f5e['filters']=_['intersection'](_0x235f5e['model'],_0x235f5e[_0x1da2('0x2c')]);_0x235f5e[_0x1da2('0x2d')]=_[_0x1da2('0x2e')](_0x235f5e['filters'],[_0x1da2('0x2f'),_0x1da2('0x30'),_0x1da2('0x31'),_0x1da2('0x32'),_0x1da2('0x33'),_0x1da2('0x34'),'$ne',_0x1da2('0x35'),_0x1da2('0x36'),_0x1da2('0x37'),_0x1da2('0x38'),'$in',_0x1da2('0x39'),_0x1da2('0x3a'),'$notLike','$iLike',_0x1da2('0x3b'),'$like','$overlap',_0x1da2('0x3c'),'$contained',_0x1da2('0x3d')]);_0xe6896d['attributes']=_[_0x1da2('0x3e')](_0x235f5e['model'],qs[_0x1da2('0x3f')](_0x250eba[_0x1da2('0x2c')][_0x1da2('0x3f')]));_0xe6896d[_0x1da2('0x40')]=_0xe6896d[_0x1da2('0x40')][_0x1da2('0x41')]?_0xe6896d[_0x1da2('0x40')]:_0x235f5e[_0x1da2('0x2b')];if(!_0x250eba['query'][_0x1da2('0x42')](_0x1da2('0x43'))){_0xe6896d['limit']=qs[_0x1da2('0x1a')](_0x250eba[_0x1da2('0x2c')]['limit']);_0xe6896d[_0x1da2('0x19')]=qs[_0x1da2('0x19')](_0x250eba[_0x1da2('0x2c')]['offset']);}_0xe6896d[_0x1da2('0x44')]=qs[_0x1da2('0x45')](_0x250eba[_0x1da2('0x2c')][_0x1da2('0x45')]);_0xe6896d[_0x1da2('0x46')]=qs['filters'](_[_0x1da2('0x47')](_0x250eba[_0x1da2('0x2c')],_0x235f5e[_0x1da2('0x2d')]),_0x2408a8);if(_0x250eba[_0x1da2('0x2c')][_0x1da2('0x48')]){_0xe6896d[_0x1da2('0x46')]=_[_0x1da2('0x49')](_0xe6896d[_0x1da2('0x46')],{'$or':_[_0x1da2('0x27')](_0x2408a8,function(_0x1cea16){if(_0x1cea16['type']!==_0x1da2('0x4a')){var _0x46b1b3={};_0x46b1b3[_0x1cea16[_0x1da2('0x24')]]={'$like':'%'+_0x250eba[_0x1da2('0x2c')][_0x1da2('0x48')]+'%'};return _0x46b1b3;}})});}_0xe6896d=_[_0x1da2('0x49')]({},_0xe6896d,_0x250eba[_0x1da2('0x4b')]);var _0x1124c9={'where':_0xe6896d[_0x1da2('0x46')]};return db['CmHopper'][_0x1da2('0x18')](_0x1124c9)[_0x1da2('0x20')](function(_0xf3f127){_0xcb5e0d[_0x1da2('0x18')]=_0xf3f127;if(_0x250eba[_0x1da2('0x2c')]['includeAll']){_0xe6896d[_0x1da2('0x4c')]=[{'all':!![]}];}return db[_0x1da2('0x4d')][_0x1da2('0x4e')](_0xe6896d);})['then'](function(_0x5be36e){_0xcb5e0d[_0x1da2('0x4f')]=_0x5be36e;return _0xcb5e0d;})[_0x1da2('0x20')](respondWithFilteredResult(_0xe00933,_0xe6896d))[_0x1da2('0x50')](handleError(_0xe00933,null));};exports['show']=function(_0x1b5006,_0x1be812){var _0x32e6f1={'raw':!![],'where':{'id':_0x1b5006[_0x1da2('0x51')]['id']}},_0xfbf33c={};_0xfbf33c[_0x1da2('0x2b')]=_[_0x1da2('0x52')](db['CmHopper'][_0x1da2('0x28')]);_0xfbf33c[_0x1da2('0x2c')]=_['keys'](_0x1b5006[_0x1da2('0x2c')]);_0xfbf33c[_0x1da2('0x2d')]=_[_0x1da2('0x3e')](_0xfbf33c[_0x1da2('0x2b')],_0xfbf33c[_0x1da2('0x2c')]);_0x32e6f1['attributes']=_[_0x1da2('0x3e')](_0xfbf33c['model'],qs[_0x1da2('0x3f')](_0x1b5006[_0x1da2('0x2c')]['fields']));_0x32e6f1[_0x1da2('0x40')]=_0x32e6f1[_0x1da2('0x40')][_0x1da2('0x41')]?_0x32e6f1['attributes']:_0xfbf33c['model'];if(_0x1b5006[_0x1da2('0x2c')][_0x1da2('0x53')]){_0x32e6f1[_0x1da2('0x4c')]=[{'all':!![]}];}_0x32e6f1=_[_0x1da2('0x49')]({},_0x32e6f1,_0x1b5006['options']);return db[_0x1da2('0x4d')][_0x1da2('0x54')](_0x32e6f1)['then'](handleEntityNotFound(_0x1be812,null))[_0x1da2('0x20')](respondWithResult(_0x1be812,null))[_0x1da2('0x50')](handleError(_0x1be812,null));};exports[_0x1da2('0x55')]=function(_0x4e71f6,_0x5bc29a){return db[_0x1da2('0x4d')][_0x1da2('0x55')](_0x4e71f6['body'],{})['then'](respondWithResult(_0x5bc29a,0xc9))['catch'](handleError(_0x5bc29a,null));};exports[_0x1da2('0x1f')]=function(_0x88a5a3,_0x40cc78){if(_0x88a5a3[_0x1da2('0x56')]['id']){delete _0x88a5a3[_0x1da2('0x56')]['id'];}return db[_0x1da2('0x4d')][_0x1da2('0x54')]({'where':{'id':_0x88a5a3[_0x1da2('0x51')]['id']}})['then'](handleEntityNotFound(_0x40cc78,null))[_0x1da2('0x20')](saveUpdates(_0x88a5a3[_0x1da2('0x56')],null))['then'](respondWithResult(_0x40cc78,null))['catch'](handleError(_0x40cc78,null));};exports[_0x1da2('0x57')]=function(_0x247ee6,_0x4b1a0d){return db[_0x1da2('0x4d')][_0x1da2('0x57')]()[_0x1da2('0x20')](respondWithResult(_0x4b1a0d,null))[_0x1da2('0x50')](handleError(_0x4b1a0d,null));};exports['destroy']=function(_0x33ddb8,_0x4a8977){var _0x3411e2;return db[_0x1da2('0x4d')][_0x1da2('0x54')]({'where':{'id':_0x33ddb8[_0x1da2('0x51')]['id']}})[_0x1da2('0x20')](handleEntityNotFound(_0x4a8977,null))[_0x1da2('0x20')](function(_0x5ec86a){if(_0x5ec86a){return _0x5ec86a[_0x1da2('0x21')]()[_0x1da2('0x20')](function(_0x4eed28){return _0x4eed28;});}})[_0x1da2('0x20')](function(_0x41fc4a){_0x3411e2=_0x41fc4a;if(_0x41fc4a){if(_0x41fc4a[_0x1da2('0x58')]||_0x41fc4a[_0x1da2('0x59')]){return db[_0x41fc4a[_0x1da2('0x58')]?_0x1da2('0x5a'):_0x1da2('0x5b')]['find']({'where':{'id':_0x41fc4a[_0x1da2('0x58')]?_0x41fc4a[_0x1da2('0x58')]:_0x41fc4a[_0x1da2('0x59')]},'attributes':['id',_0x1da2('0x24')],'raw':!![]});}}})['then'](function(_0x2db1cf){var _0x398e51={};if(_0x2db1cf){_['merge'](_0x398e51,_[_0x1da2('0x5c')](_0x3411e2[_0x1da2('0x5d')],[_0x1da2('0x5e'),_0x1da2('0x5f'),'id']));_0x398e51['state']=0x15;_0x398e51[_0x1da2('0x60')]=_0x1da2('0x61');_0x398e51['campaign']=_0x2db1cf['name'];_0x398e51[_0x1da2('0x62')]=_0x33ddb8[_0x1da2('0x63')][_0x1da2('0x24')];_0x398e51[_0x1da2('0x64')]=_0x33ddb8['user']['id'];_0x398e51[_0x1da2('0x61')]=!![];_0x398e51[_0x1da2('0x65')]=moment()[_0x1da2('0x66')](_0x1da2('0x67'));_0x398e51[_0x1da2('0x68')]=_0x3411e2[_0x1da2('0x69')];_0x398e51[_0x1da2('0x6a')]=_0x3411e2['VoiceQueueId']?_0x1da2('0x6b'):_0x1da2('0x6c');return db[_0x1da2('0x6d')]['find']({'where':{'id':_0x398e51[_0x1da2('0x6e')]},'attributes':[_0x1da2('0x6f'),_0x1da2('0x70')]})[_0x1da2('0x20')](function(_0x333538){if(!_[_0x1da2('0x71')](_0x4a8977)&&!_['isNil'](_0x333538[_0x1da2('0x6f')])){_0x398e51[_0x1da2('0x72')]=_0x333538[_0x1da2('0x6f')];if(!_['isNil'](_0x333538[_0x1da2('0x70')])){_0x398e51[_0x1da2('0x72')]+='\x20'+_0x333538['lastName'];}}})['finally'](function(){return db[_0x1da2('0x73')][_0x1da2('0x55')](_0x398e51);});}})[_0x1da2('0x20')](function(){return _0x4a8977[_0x1da2('0x16')](0xcc)[_0x1da2('0x15')]();})[_0x1da2('0x50')](handleError(_0x4a8977,null));};exports[_0x1da2('0x74')]=function(_0x4e83a5,_0x12e4bf,_0x37153a){var _0x194898=[];return db[_0x1da2('0x6d')][_0x1da2('0x57')]()['then'](function(_0x10aa69){_0x194898=_[_0x1da2('0x52')](_0x10aa69);return _0x4e83a5['user'][_0x1da2('0x75')]({'where':{'type':_0x1da2('0x76'),'dialActive':!![],'dialMethod':_0x1da2('0x77')},'attributes':['id',_0x1da2('0x78')],'raw':!![]});})[_0x1da2('0x20')](function(_0x16748e){if(_0x16748e&&_0x16748e[_0x1da2('0x41')]){return db[_0x1da2('0x79')][_0x1da2('0x7a')](function(_0xda6584){var _0x249e95={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x1da2('0x67'))},'VoiceQueueId':{'$in':_[_0x1da2('0x27')](_0x16748e,'id')},'$or':[{'UserId':null},{'UserId':_0x4e83a5[_0x1da2('0x63')]['id']}]};var _0x45ca09=[];if(_0x4e83a5['body']['direction']&&_0x4e83a5[_0x1da2('0x56')][_0x1da2('0x7b')]===_0x1da2('0x7c')){if(!_['isEmpty'](_0x4e83a5[_0x1da2('0x56')]['hopperIds'])){_0x249e95['id']={'$in':_0x4e83a5['body'][_0x1da2('0x7d')]};}_0x45ca09=[[_0x1da2('0x7e'),_0x1da2('0x7f')],['scheduledAt',_0x16748e[0x0][_0x1da2('0x78')]===_0x1da2('0x7f')?_0x1da2('0x80'):_0x1da2('0x7f')],db[_0x1da2('0x79')][_0x1da2('0x81')](_0x1da2('0x82')),['id',_0x1da2('0x80')]];}else{if(!_[_0x1da2('0x83')](_0x4e83a5[_0x1da2('0x56')][_0x1da2('0x7d')])){_0x249e95['id']={'$notIn':_0x4e83a5[_0x1da2('0x56')][_0x1da2('0x7d')]};}_0x45ca09=[['priority','DESC'],[_0x1da2('0x84'),_0x16748e[0x0]['dialOrderByScheduledAt']],db[_0x1da2('0x79')][_0x1da2('0x81')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id','ASC']];}return db[_0x1da2('0x4d')][_0x1da2('0x85')]({'attributes':['id','scheduledat'],'where':_0x249e95,'order':_0x45ca09,'transaction':_0xda6584,'lock':_0xda6584['LOCK'][_0x1da2('0x86')],'include':[{'model':db[_0x1da2('0x6d')],'as':_0x1da2('0x87'),'attributes':_0x194898,'include':[{'model':db[_0x1da2('0x88')],'as':_0x1da2('0x89'),'attributes':['id','name']}]},{'model':db[_0x1da2('0x8a')],'as':_0x1da2('0x8b'),'attributes':['id',_0x1da2('0x24')]},{'model':db[_0x1da2('0x5a')],'as':_0x1da2('0x8c'),'attributes':['id',_0x1da2('0x24'),_0x1da2('0x8d')]}]})[_0x1da2('0x20')](function(_0x131ad1){if(_0x131ad1){return _0x131ad1[_0x1da2('0x1f')]({'UserId':_0x4e83a5[_0x1da2('0x63')]['id']},{'transaction':_0xda6584});}});});}})[_0x1da2('0x20')](handleEntityNotFound(_0x12e4bf,null))[_0x1da2('0x20')](respondWithResult(_0x12e4bf,null))[_0x1da2('0x50')](handleError(_0x12e4bf,null));};exports[_0x1da2('0x8e')]=function(_0x2f4db3,_0x369cf0,_0x68e29e){return _0x2f4db3[_0x1da2('0x63')][_0x1da2('0x75')]({'where':{'type':_0x1da2('0x76'),'dialActive':!![],'dialMethod':_0x1da2('0x77')},'attributes':['id'],'raw':!![]})[_0x1da2('0x20')](function(_0x1945db){if(_0x1945db&&_0x1945db['length']){return db[_0x1da2('0x4d')][_0x1da2('0x18')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x1da2('0x66')](_0x1da2('0x67'))},'VoiceQueueId':{'$in':_[_0x1da2('0x27')](_0x1945db,'id')},'$or':[{'UserId':null},{'UserId':_0x2f4db3[_0x1da2('0x63')]['id']}]}});}return 0x0;})[_0x1da2('0x20')](function(_0x2c9cc3){if(!_[_0x1da2('0x71')](_0x2c9cc3)&&_[_0x1da2('0x8f')](_0x2c9cc3)){return _0x369cf0[_0x1da2('0x16')](0xc8)['json']({'contacts':_0x2c9cc3});}else{logger[_0x1da2('0x23')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x1da2('0x8e'),0x194,_0x1da2('0x90'));_0x369cf0[_0x1da2('0x22')](0x194);}})[_0x1da2('0x50')](handleError(_0x369cf0,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index aa09fa4..a520448 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 _0xc480=['define','CmHopper','scheduledat','phone','priority','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','./cmHopper.attributes','exports'];(function(_0x59d0cc,_0xa7c52b){var _0x2ae79f=function(_0x33042e){while(--_0x33042e){_0x59d0cc['push'](_0x59d0cc['shift']());}};_0x2ae79f(++_0xa7c52b);}(_0xc480,0x139));var _0x0c48=function(_0x2f8da8,_0x5b193f){_0x2f8da8=_0x2f8da8-0x0;var _0x2efad0=_0xc480[_0x2f8da8];return _0x2efad0;};'use strict';var _=require(_0x0c48('0x0'));var util=require(_0x0c48('0x1'));var logger=require(_0x0c48('0x2'))('api');var moment=require(_0x0c48('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0c48('0x4'));var rimraf=require(_0x0c48('0x5'));var config=require(_0x0c48('0x6'));var attributes=require(_0x0c48('0x7'));module[_0x0c48('0x8')]=function(_0x54957b,_0x5330ad){return _0x54957b[_0x0c48('0x9')](_0x0c48('0xa'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x0c48('0xb')]},{'name':_0x0c48('0xc'),'fields':[_0x0c48('0xc')]},{'name':_0x0c48('0xd'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd65f=['./cmHopper.attributes','exports','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x47f5f2,_0x485063){var _0x5ba9d1=function(_0x5def02){while(--_0x5def02){_0x47f5f2['push'](_0x47f5f2['shift']());}};_0x5ba9d1(++_0x485063);}(_0xd65f,0x1e2));var _0xfd65=function(_0x17ec16,_0x2436e3){_0x17ec16=_0x17ec16-0x0;var _0x1f59f5=_0xd65f[_0x17ec16];return _0x1f59f5;};'use strict';var _=require(_0xfd65('0x0'));var util=require(_0xfd65('0x1'));var logger=require(_0xfd65('0x2'))(_0xfd65('0x3'));var moment=require(_0xfd65('0x4'));var BPromise=require('bluebird');var rp=require(_0xfd65('0x5'));var fs=require('fs');var path=require(_0xfd65('0x6'));var rimraf=require('rimraf');var config=require(_0xfd65('0x7'));var attributes=require(_0xfd65('0x8'));module[_0xfd65('0x9')]=function(_0x58128c,_0x3a374a){return _0x58128c['define']('CmHopper',attributes,{'tableName':_0xfd65('0xa'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0xfd65('0xb')]},{'name':_0xfd65('0xc'),'fields':[_0xfd65('0xc')]},{'name':_0xfd65('0xd'),'fields':[_0xfd65('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 f6361f1..70b56f1 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 _0x64cc=['describe','sequelize','order','LOCK','UPDATE','Contact','User','Agent','name','length','UserId','push','MoveContactManagedDialer','transaction','CmHopperFinal','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','GetCmHopperPreview','keys','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','stringify','error','code','CmHopper,\x20%s,\x20%s','message','request\x20sent','catch','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowCmHopper','find','CreateCmHopper','create','body','UpdateCmHopper','update','DestroyCmHopper','destroy','GetContactDialer','CmContact'];(function(_0x39109d,_0x84e5ce){var _0x138412=function(_0x1c0418){while(--_0x1c0418){_0x39109d['push'](_0x39109d['shift']());}};_0x138412(++_0x84e5ce);}(_0x64cc,0x1cb));var _0xc64c=function(_0x190a34,_0x3cd1a2){_0x190a34=_0x190a34-0x0;var _0x1a83f3=_0x64cc[_0x190a34];return _0x1a83f3;};'use strict';var _=require('lodash');var util=require(_0xc64c('0x0'));var moment=require(_0xc64c('0x1'));var BPromise=require('bluebird');var rs=require(_0xc64c('0x2'));var fs=require('fs');var Redis=require(_0xc64c('0x3'));var db=require(_0xc64c('0x4'))['db'];var utils=require(_0xc64c('0x5'));var logger=require(_0xc64c('0x6'))(_0xc64c('0x7'));var config=require(_0xc64c('0x8'));var jayson=require(_0xc64c('0x9'));var client=jayson[_0xc64c('0xa')][_0xc64c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a6925,_0x15e5c6,_0x36723a){return new BPromise(function(_0xd65b63,_0x28ec3f){return client[_0xc64c('0xc')](_0x2a6925,_0x36723a)['then'](function(_0x52a620){logger[_0xc64c('0xd')]('CmHopper,\x20%s,\x20%s',_0x15e5c6,'request\x20sent');logger[_0xc64c('0xe')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x15e5c6,'request\x20sent',JSON[_0xc64c('0xf')](_0x52a620));if(_0x52a620[_0xc64c('0x10')]){if(_0x52a620[_0xc64c('0x10')][_0xc64c('0x11')]===0x1f4){logger[_0xc64c('0x10')](_0xc64c('0x12'),_0x15e5c6,_0x52a620[_0xc64c('0x10')]['message']);return _0x28ec3f(_0x52a620[_0xc64c('0x10')][_0xc64c('0x13')]);}logger[_0xc64c('0x10')](_0xc64c('0x12'),_0x15e5c6,_0x52a620[_0xc64c('0x10')][_0xc64c('0x13')]);return _0xd65b63(_0x52a620[_0xc64c('0x10')]['message']);}else{logger[_0xc64c('0xd')](_0xc64c('0x12'),_0x15e5c6,_0xc64c('0x14'));_0xd65b63(_0x52a620['result'][_0xc64c('0x13')]);}})[_0xc64c('0x15')](function(_0x321581){logger[_0xc64c('0x10')](_0xc64c('0x12'),_0x15e5c6,_0x321581);_0x28ec3f(_0x321581);});});}exports[_0xc64c('0x16')]=function(_0x3a59ec){var _0x1ea849=this;return new Promise(function(_0x58cf72,_0x482f13){return db[_0xc64c('0x17')][_0xc64c('0x18')]({'raw':_0x3a59ec[_0xc64c('0x19')]?_0x3a59ec['options'][_0xc64c('0x1a')]===undefined?!![]:![]:!![],'where':_0x3a59ec['options']?_0x3a59ec[_0xc64c('0x19')][_0xc64c('0x1b')]||null:null,'attributes':_0x3a59ec[_0xc64c('0x19')]?_0x3a59ec['options'][_0xc64c('0x1c')]||null:null,'limit':_0x3a59ec['options']?_0x3a59ec[_0xc64c('0x19')][_0xc64c('0x1d')]||null:null,'include':_0x3a59ec[_0xc64c('0x19')]?_0x3a59ec[_0xc64c('0x19')][_0xc64c('0x1e')]?_[_0xc64c('0x1f')](_0x3a59ec[_0xc64c('0x19')][_0xc64c('0x1e')],function(_0x406ced){return{'model':db[_0x406ced['model']],'as':_0x406ced['as'],'attributes':_0x406ced[_0xc64c('0x1c')],'include':_0x406ced['include']?_[_0xc64c('0x1f')](_0x406ced[_0xc64c('0x1e')],function(_0x10a3c5){return{'model':db[_0x10a3c5[_0xc64c('0x20')]],'as':_0x10a3c5['as'],'attributes':_0x10a3c5[_0xc64c('0x1c')],'include':_0x10a3c5[_0xc64c('0x1e')]?_[_0xc64c('0x1f')](_0x10a3c5[_0xc64c('0x1e')],function(_0x121eeb){return{'model':db[_0x121eeb[_0xc64c('0x20')]],'as':_0x121eeb['as'],'attributes':_0x121eeb['attributes']};}):[]};}):[]};}):[]:[]})[_0xc64c('0x21')](function(_0x4d2b06){logger[_0xc64c('0xd')]('GetCmHopper',_0x3a59ec);logger[_0xc64c('0xe')]('GetCmHopper',_0x3a59ec,JSON[_0xc64c('0xf')](_0x4d2b06));_0x58cf72(_0x4d2b06);})[_0xc64c('0x15')](function(_0x452ae3){logger[_0xc64c('0x10')](_0xc64c('0x16'),_0x452ae3[_0xc64c('0x13')],_0x3a59ec);_0x482f13(_0x1ea849[_0xc64c('0x10')](0x1f4,_0x452ae3[_0xc64c('0x13')]));});});};exports[_0xc64c('0x22')]=function(_0x4418f5){var _0x3af6a4=this;return new Promise(function(_0x53d154,_0x3eeb4f){return db[_0xc64c('0x17')][_0xc64c('0x23')]({'raw':_0x4418f5[_0xc64c('0x19')]?_0x4418f5['options'][_0xc64c('0x1a')]===undefined?!![]:![]:!![],'where':_0x4418f5[_0xc64c('0x19')]?_0x4418f5['options'][_0xc64c('0x1b')]||null:null,'attributes':_0x4418f5['options']?_0x4418f5[_0xc64c('0x19')][_0xc64c('0x1c')]||null:null,'include':_0x4418f5['options']?_0x4418f5[_0xc64c('0x19')][_0xc64c('0x1e')]?_['map'](_0x4418f5['options'][_0xc64c('0x1e')],function(_0x557f8e){return{'model':db[_0x557f8e[_0xc64c('0x20')]],'as':_0x557f8e['as'],'attributes':_0x557f8e[_0xc64c('0x1c')],'include':_0x557f8e[_0xc64c('0x1e')]?_[_0xc64c('0x1f')](_0x557f8e[_0xc64c('0x1e')],function(_0x469d6d){return{'model':db[_0x469d6d[_0xc64c('0x20')]],'as':_0x469d6d['as'],'attributes':_0x469d6d['attributes'],'include':_0x469d6d['include']?_[_0xc64c('0x1f')](_0x469d6d[_0xc64c('0x1e')],function(_0x3f5387){return{'model':db[_0x3f5387[_0xc64c('0x20')]],'as':_0x3f5387['as'],'attributes':_0x3f5387[_0xc64c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc64c('0x21')](function(_0x39bf03){logger[_0xc64c('0xd')](_0xc64c('0x22'),_0x4418f5);logger[_0xc64c('0xe')](_0xc64c('0x22'),_0x4418f5,JSON[_0xc64c('0xf')](_0x39bf03));_0x53d154(_0x39bf03);})[_0xc64c('0x15')](function(_0x403ba3){logger[_0xc64c('0x10')]('ShowCmHopper',_0x403ba3['message'],_0x4418f5);_0x3eeb4f(_0x3af6a4[_0xc64c('0x10')](0x1f4,_0x403ba3[_0xc64c('0x13')]));});});};exports[_0xc64c('0x24')]=function(_0x53561a){var _0xa002fb=this;return new Promise(function(_0x2893e0,_0x7fc219){return db['CmHopper'][_0xc64c('0x25')](_0x53561a[_0xc64c('0x26')],{'raw':_0x53561a[_0xc64c('0x19')]?_0x53561a[_0xc64c('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xc64c('0x21')](function(_0x55f1c4){logger['info'](_0xc64c('0x24'),_0x53561a);logger[_0xc64c('0xe')]('CreateCmHopper',_0x53561a,JSON[_0xc64c('0xf')](_0x55f1c4));_0x2893e0(_0x55f1c4);})[_0xc64c('0x15')](function(_0x2d9593){logger[_0xc64c('0x10')]('CreateCmHopper',_0x2d9593[_0xc64c('0x13')],_0x53561a);_0x7fc219(_0xa002fb[_0xc64c('0x10')](0x1f4,_0x2d9593[_0xc64c('0x13')]));});});};exports[_0xc64c('0x27')]=function(_0x50a3e5){var _0x3817fa=this;return new Promise(function(_0x207dd4,_0x4628e3){return db[_0xc64c('0x17')][_0xc64c('0x28')](_0x50a3e5[_0xc64c('0x26')],{'raw':_0x50a3e5[_0xc64c('0x19')]?_0x50a3e5['options'][_0xc64c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50a3e5['options']?_0x50a3e5[_0xc64c('0x19')][_0xc64c('0x1b')]||null:null,'attributes':_0x50a3e5['options']?_0x50a3e5['options']['attributes']||null:null,'limit':_0x50a3e5[_0xc64c('0x19')]?_0x50a3e5[_0xc64c('0x19')][_0xc64c('0x1d')]||null:null})[_0xc64c('0x21')](function(_0x2c1dee){logger[_0xc64c('0xd')](_0xc64c('0x27'),_0x50a3e5);logger[_0xc64c('0xe')]('UpdateCmHopper',_0x50a3e5,JSON['stringify'](_0x2c1dee));_0x207dd4(_0x2c1dee);})[_0xc64c('0x15')](function(_0x22da80){logger[_0xc64c('0x10')](_0xc64c('0x27'),_0x22da80['message'],_0x50a3e5);_0x4628e3(_0x3817fa[_0xc64c('0x10')](0x1f4,_0x22da80[_0xc64c('0x13')]));});});};exports[_0xc64c('0x29')]=function(_0x2f0f26){var _0x491d4d=this;return new Promise(function(_0xfc58dd,_0x1bb656){return db[_0xc64c('0x17')][_0xc64c('0x2a')]({'where':_0x2f0f26[_0xc64c('0x19')]?_0x2f0f26[_0xc64c('0x19')][_0xc64c('0x1b')]||null:null})['then'](function(_0x58e94d){logger[_0xc64c('0xd')](_0xc64c('0x29'),_0x2f0f26);logger[_0xc64c('0xe')](_0xc64c('0x29'),_0x2f0f26,JSON[_0xc64c('0xf')](_0x58e94d));_0xfc58dd(_0x58e94d);})[_0xc64c('0x15')](function(_0x62633f){logger[_0xc64c('0x10')]('DestroyCmHopper',_0x62633f[_0xc64c('0x13')],_0x2f0f26);_0x1bb656(_0x491d4d[_0xc64c('0x10')](0x1f4,_0x62633f[_0xc64c('0x13')]));});});};exports[_0xc64c('0x2b')]=function(_0x3c5d74){var _0x280718=this;return new Promise(function(_0x5f3c22,_0x118cc5){return db[_0xc64c('0x2c')][_0xc64c('0x2d')]()[_0xc64c('0x21')](function(_0x2e2a04){return db[_0xc64c('0x2e')]['transaction'](function(_0x59ef1c){return db[_0xc64c('0x17')][_0xc64c('0x18')]({'where':_0x3c5d74[_0xc64c('0x19')]?_0x3c5d74[_0xc64c('0x19')][_0xc64c('0x1b')]||null:null,'attributes':_0x3c5d74[_0xc64c('0x19')]?_0x3c5d74['options'][_0xc64c('0x1c')]||null:null,'limit':_0x3c5d74[_0xc64c('0x19')]?_0x3c5d74[_0xc64c('0x19')][_0xc64c('0x1d')]||null:null,'order':_0x3c5d74[_0xc64c('0x19')]?_0x3c5d74[_0xc64c('0x19')][_0xc64c('0x2f')]||null:null,'transaction':_0x59ef1c,'lock':_0x59ef1c[_0xc64c('0x30')][_0xc64c('0x31')],'include':[{'model':db[_0xc64c('0x2c')],'as':_0xc64c('0x32'),'attributes':_['keys'](_0x2e2a04)},{'model':db[_0xc64c('0x33')],'as':_0xc64c('0x34'),'attributes':['id',_0xc64c('0x35'),'voicePause']}]})['then'](function(_0x55eaf4){var _0x2a5c8d=[];var _0x26fccd=[];for(var _0x57c30b=0x0;_0x57c30b<_0x55eaf4[_0xc64c('0x36')];_0x57c30b+=0x1){if(!_0x26fccd['includes'](_0x55eaf4[_0x57c30b][_0xc64c('0x37')])){_0x26fccd[_0xc64c('0x38')](_0x55eaf4[_0x57c30b][_0xc64c('0x37')]);_0x2a5c8d['push'](_0x55eaf4[_0x57c30b]['update'](_0x3c5d74[_0xc64c('0x26')],{'transaction':_0x59ef1c}));}}return BPromise['all'](_0x2a5c8d);});})[_0xc64c('0x21')](function(_0x3005e2){logger['info'](_0xc64c('0x2b'),_0x3c5d74);logger[_0xc64c('0xe')](_0xc64c('0x2b'),_0x3c5d74,JSON[_0xc64c('0xf')](_0x3005e2));_0x5f3c22(_0x3005e2);})[_0xc64c('0x15')](function(_0x28ed26){logger[_0xc64c('0x10')]('GetContactDialer',_0x28ed26[_0xc64c('0x13')],_0x3c5d74);_0x118cc5(_0x280718[_0xc64c('0x10')](0x1f4,_0x28ed26[_0xc64c('0x13')]));});});});};exports[_0xc64c('0x39')]=function(_0x2fee28){var _0x3c2cf8=this;return new Promise(function(_0x223f3e,_0x73674a){return db[_0xc64c('0x2e')][_0xc64c('0x3a')](function(_0x49cd1d){return db[_0xc64c('0x3b')][_0xc64c('0x25')](_0x2fee28['body'],{'raw':_0x2fee28[_0xc64c('0x19')]?_0x2fee28[_0xc64c('0x19')]['raw']===undefined?!![]:![]:!![],'transaction':_0x49cd1d})['then'](function(){return db[_0xc64c('0x17')][_0xc64c('0x2a')]({'where':_0x2fee28['options']?_0x2fee28['options'][_0xc64c('0x1b')]||null:null,'transaction':_0x49cd1d});});})[_0xc64c('0x21')](function(_0x7297bf){logger[_0xc64c('0xd')](_0xc64c('0x39'),_0x2fee28);logger['debug']('MoveContactManagedDialer',_0x2fee28,JSON[_0xc64c('0xf')](_0x7297bf));_0x223f3e(_0x7297bf);})[_0xc64c('0x15')](function(_0x2dafcc){logger[_0xc64c('0x10')]('MoveContactManagedDialer',_0x2dafcc[_0xc64c('0x13')],_0x2fee28);_0x73674a(_0x3c2cf8[_0xc64c('0x10')](0x1f4,_0x2dafcc[_0xc64c('0x13')]));});});};exports['CountReScheduled']=function(_0x4da647){var _0x1a3b52=this;return new Promise(function(_0x5df973,_0x49764d){return db[_0xc64c('0x17')][_0xc64c('0x18')]({'raw':_0x4da647[_0xc64c('0x19')]?_0x4da647[_0xc64c('0x19')][_0xc64c('0x1a')]===undefined?!![]:![]:!![],'where':_0x4da647[_0xc64c('0x19')]?_0x4da647[_0xc64c('0x19')][_0xc64c('0x1b')]||null:null,'attributes':[[db[_0xc64c('0x2e')]['fn'](_0xc64c('0x3c'),db[_0xc64c('0x2e')]['fn']('IF',db[_0xc64c('0x2e')][_0xc64c('0x3d')](_0xc64c('0x3e')+util[_0xc64c('0x3f')](_0xc64c('0x40'),moment()[_0xc64c('0x3f')](_0xc64c('0x41')))+_0xc64c('0x42')))),_0xc64c('0x43')]]})[_0xc64c('0x21')](function(_0x1d9a2a){logger['info'](_0xc64c('0x44'),_0x4da647);logger['debug'](_0xc64c('0x44'),_0x4da647,JSON[_0xc64c('0xf')](_0x1d9a2a));_0x5df973(_0x1d9a2a);})[_0xc64c('0x15')](function(_0x51c763){logger[_0xc64c('0x10')]('CountReScheduled',_0x51c763[_0xc64c('0x13')],_0x4da647);_0x49764d(_0x1a3b52[_0xc64c('0x10')](0x1f4,_0x51c763[_0xc64c('0x13')]));});});};exports[_0xc64c('0x45')]=function(_0x26f873){var _0x19c8c1=this;return new Promise(function(_0x53d54e,_0x41350b){return db[_0xc64c('0x2c')]['describe']()[_0xc64c('0x21')](function(_0x5ab43e){return db[_0xc64c('0x2e')][_0xc64c('0x3a')](function(_0x5075e8){return db['CmHopper'][_0xc64c('0x18')]({'where':_0x26f873['options']?_0x26f873['options'][_0xc64c('0x1b')]||null:null,'attributes':_0x26f873[_0xc64c('0x19')]?_0x26f873[_0xc64c('0x19')]['attributes']||null:null,'limit':0x1,'order':_0x26f873['options']?_0x26f873[_0xc64c('0x19')][_0xc64c('0x2f')]||null:null,'group':db[_0xc64c('0x17')][_0xc64c('0x37')],'transaction':_0x5075e8,'lock':_0x5075e8['LOCK']['UPDATE'],'include':_0x26f873[_0xc64c('0x19')]?_0x26f873[_0xc64c('0x19')]['include']?_[_0xc64c('0x1f')](_0x26f873[_0xc64c('0x19')][_0xc64c('0x1e')],function(_0x47b0ec){return{'model':db[_0x47b0ec[_0xc64c('0x20')]],'as':_0x47b0ec['as'],'attributes':_0x47b0ec['attributes'],'include':_0x47b0ec[_0xc64c('0x1e')]?_[_0xc64c('0x1f')](_0x47b0ec[_0xc64c('0x1e')],function(_0x1a77de){return{'model':db[_0x1a77de[_0xc64c('0x20')]],'as':_0x1a77de['as'],'attributes':_0x1a77de[_0xc64c('0x1c')],'include':_0x1a77de[_0xc64c('0x1e')]?_['map'](_0x1a77de[_0xc64c('0x1e')],function(_0x281584){return{'model':db[_0x281584['model']],'as':_0x281584['as'],'attributes':_0x281584[_0xc64c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc64c('0x21')](function(_0x143036){var _0x1b0263=[];for(var _0x2789d7=0x0;_0x2789d7<_0x143036['length'];_0x2789d7+=0x1){_0x1b0263[_0xc64c('0x38')](_0x143036[_0x2789d7][_0xc64c('0x28')](_0x26f873[_0xc64c('0x26')],{'transaction':_0x5075e8}));}return BPromise['all'](_0x1b0263);});})['then'](function(_0x8ee54e){logger[_0xc64c('0xd')](_0xc64c('0x45'),_0x26f873);logger[_0xc64c('0xe')]('GetContactRecallMe',_0x26f873,JSON[_0xc64c('0xf')](_0x8ee54e));_0x53d54e(_0x8ee54e);})[_0xc64c('0x15')](function(_0x3d946a){logger['error']('GetContactRecallMe',_0x3d946a['message'],_0x26f873);_0x41350b(_0x19c8c1['error'](0x1f4,_0x3d946a['message']));});});});};exports[_0xc64c('0x46')]=function(_0x302e49){var _0x369c63=this;return new Promise(function(_0x1d1363,_0x5b8b24){db[_0xc64c('0x2c')][_0xc64c('0x2d')]()[_0xc64c('0x21')](function(_0x506378){return db['CmHopper'][_0xc64c('0x18')]({'raw':_0x302e49[_0xc64c('0x19')]?_0x302e49['options'][_0xc64c('0x1a')]===undefined?!![]:![]:!![],'where':_0x302e49[_0xc64c('0x19')]?_0x302e49[_0xc64c('0x19')]['where']||null:null,'attributes':_0x302e49['options']?_0x302e49['options'][_0xc64c('0x1c')]||null:null,'limit':_0x302e49[_0xc64c('0x19')]?_0x302e49[_0xc64c('0x19')]['limit']||null:null,'include':_0x302e49[_0xc64c('0x19')]?_0x302e49[_0xc64c('0x19')][_0xc64c('0x1e')]?_[_0xc64c('0x1f')](_0x302e49[_0xc64c('0x19')]['include'],function(_0x3029e7){return{'model':db[_0x3029e7[_0xc64c('0x20')]],'as':_0x3029e7['as'],'attributes':_0x3029e7['as']===_0xc64c('0x32')?_[_0xc64c('0x47')](_0x506378):_0x3029e7[_0xc64c('0x1c')],'include':_0x3029e7['include']?_[_0xc64c('0x1f')](_0x3029e7[_0xc64c('0x1e')],function(_0x2c9fb3){return{'model':db[_0x2c9fb3[_0xc64c('0x20')]],'as':_0x2c9fb3['as'],'attributes':_0x2c9fb3[_0xc64c('0x1c')],'include':_0x2c9fb3['include']?_[_0xc64c('0x1f')](_0x2c9fb3['include'],function(_0x44acee){return{'model':db[_0x44acee[_0xc64c('0x20')]],'as':_0x44acee['as'],'attributes':_0x44acee[_0xc64c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc64c('0x21')](function(_0x373706){logger[_0xc64c('0xd')]('GetCmHopper',_0x302e49);logger[_0xc64c('0xe')](_0xc64c('0x16'),_0x302e49,JSON['stringify'](_0x373706));_0x1d1363(_0x373706);})['catch'](function(_0x22c9ec){logger[_0xc64c('0x10')]('GetCmHopper',_0x22c9ec[_0xc64c('0x13')],_0x302e49);_0x5b8b24(_0x369c63[_0xc64c('0x10')](0x1f4,_0x22c9ec[_0xc64c('0x13')]));});});});}; \ No newline at end of file +var _0x67d9=['debug','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','map','model','find','ShowCmHopper','catch','CreateCmHopper','body','UpdateCmHopper','DestroyCmHopper','destroy','GetContactDialer','transaction','order','UPDATE','CmContact','Contact','keys','User','name','voicePause','includes','UserId','push','MoveContactManagedDialer','CmHopperFinal','create','CountReScheduled','sequelize','literal','`scheduledat`\x20>=\x20','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','describe','LOCK','length','update','all','GetCmHopperPreview','util','moment','ioredis','../../config/logger','../../config/environment','client','http','then','info','CmHopper,\x20%s,\x20%s'];(function(_0x277107,_0x3420dc){var _0x1da046=function(_0x47122d){while(--_0x47122d){_0x277107['push'](_0x277107['shift']());}};_0x1da046(++_0x3420dc);}(_0x67d9,0x1d2));var _0x967d=function(_0x26fe83,_0xab81df){_0x26fe83=_0x26fe83-0x0;var _0xf467ec=_0x67d9[_0x26fe83];return _0xf467ec;};'use strict';var _=require('lodash');var util=require(_0x967d('0x0'));var moment=require(_0x967d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x967d('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x967d('0x3'))('rpc');var config=require(_0x967d('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x967d('0x5')][_0x967d('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3d0570,_0x19a2ee,_0x2a1095){return new BPromise(function(_0x1bbea5,_0x2ca2b6){return client['request'](_0x3d0570,_0x2a1095)[_0x967d('0x7')](function(_0x590d6a){logger[_0x967d('0x8')](_0x967d('0x9'),_0x19a2ee,'request\x20sent');logger[_0x967d('0xa')](_0x967d('0xb'),_0x19a2ee,_0x967d('0xc'),JSON[_0x967d('0xd')](_0x590d6a));if(_0x590d6a[_0x967d('0xe')]){if(_0x590d6a['error'][_0x967d('0xf')]===0x1f4){logger[_0x967d('0xe')](_0x967d('0x9'),_0x19a2ee,_0x590d6a[_0x967d('0xe')][_0x967d('0x10')]);return _0x2ca2b6(_0x590d6a[_0x967d('0xe')][_0x967d('0x10')]);}logger[_0x967d('0xe')]('CmHopper,\x20%s,\x20%s',_0x19a2ee,_0x590d6a[_0x967d('0xe')][_0x967d('0x10')]);return _0x1bbea5(_0x590d6a[_0x967d('0xe')]['message']);}else{logger['info'](_0x967d('0x9'),_0x19a2ee,_0x967d('0xc'));_0x1bbea5(_0x590d6a['result'][_0x967d('0x10')]);}})['catch'](function(_0x500b76){logger[_0x967d('0xe')](_0x967d('0x9'),_0x19a2ee,_0x500b76);_0x2ca2b6(_0x500b76);});});}exports[_0x967d('0x11')]=function(_0x4759cf){var _0x3b224f=this;return new Promise(function(_0x58cf9d,_0x476687){return db[_0x967d('0x12')][_0x967d('0x13')]({'raw':_0x4759cf[_0x967d('0x14')]?_0x4759cf[_0x967d('0x14')][_0x967d('0x15')]===undefined?!![]:![]:!![],'where':_0x4759cf[_0x967d('0x14')]?_0x4759cf[_0x967d('0x14')][_0x967d('0x16')]||null:null,'attributes':_0x4759cf[_0x967d('0x14')]?_0x4759cf[_0x967d('0x14')][_0x967d('0x17')]||null:null,'limit':_0x4759cf[_0x967d('0x14')]?_0x4759cf['options'][_0x967d('0x18')]||null:null,'include':_0x4759cf['options']?_0x4759cf[_0x967d('0x14')][_0x967d('0x19')]?_[_0x967d('0x1a')](_0x4759cf['options'][_0x967d('0x19')],function(_0x27c0ab){return{'model':db[_0x27c0ab[_0x967d('0x1b')]],'as':_0x27c0ab['as'],'attributes':_0x27c0ab[_0x967d('0x17')],'include':_0x27c0ab['include']?_[_0x967d('0x1a')](_0x27c0ab[_0x967d('0x19')],function(_0x7095c7){return{'model':db[_0x7095c7[_0x967d('0x1b')]],'as':_0x7095c7['as'],'attributes':_0x7095c7['attributes'],'include':_0x7095c7['include']?_['map'](_0x7095c7['include'],function(_0x5bebaf){return{'model':db[_0x5bebaf[_0x967d('0x1b')]],'as':_0x5bebaf['as'],'attributes':_0x5bebaf['attributes']};}):[]};}):[]};}):[]:[]})[_0x967d('0x7')](function(_0xb943f8){logger[_0x967d('0x8')](_0x967d('0x11'),_0x4759cf);logger[_0x967d('0xa')]('GetCmHopper',_0x4759cf,JSON[_0x967d('0xd')](_0xb943f8));_0x58cf9d(_0xb943f8);})['catch'](function(_0x37431b){logger['error'](_0x967d('0x11'),_0x37431b[_0x967d('0x10')],_0x4759cf);_0x476687(_0x3b224f[_0x967d('0xe')](0x1f4,_0x37431b[_0x967d('0x10')]));});});};exports['ShowCmHopper']=function(_0x3813ff){var _0x9b303=this;return new Promise(function(_0x10789e,_0x6122c7){return db['CmHopper'][_0x967d('0x1c')]({'raw':_0x3813ff['options']?_0x3813ff[_0x967d('0x14')][_0x967d('0x15')]===undefined?!![]:![]:!![],'where':_0x3813ff[_0x967d('0x14')]?_0x3813ff['options']['where']||null:null,'attributes':_0x3813ff['options']?_0x3813ff[_0x967d('0x14')][_0x967d('0x17')]||null:null,'include':_0x3813ff[_0x967d('0x14')]?_0x3813ff['options'][_0x967d('0x19')]?_['map'](_0x3813ff[_0x967d('0x14')][_0x967d('0x19')],function(_0x21f334){return{'model':db[_0x21f334[_0x967d('0x1b')]],'as':_0x21f334['as'],'attributes':_0x21f334['attributes'],'include':_0x21f334['include']?_[_0x967d('0x1a')](_0x21f334['include'],function(_0xb63d5b){return{'model':db[_0xb63d5b['model']],'as':_0xb63d5b['as'],'attributes':_0xb63d5b['attributes'],'include':_0xb63d5b[_0x967d('0x19')]?_['map'](_0xb63d5b['include'],function(_0x52c8ac){return{'model':db[_0x52c8ac[_0x967d('0x1b')]],'as':_0x52c8ac['as'],'attributes':_0x52c8ac['attributes']};}):[]};}):[]};}):[]:[]})[_0x967d('0x7')](function(_0x2fbfab){logger[_0x967d('0x8')](_0x967d('0x1d'),_0x3813ff);logger[_0x967d('0xa')](_0x967d('0x1d'),_0x3813ff,JSON[_0x967d('0xd')](_0x2fbfab));_0x10789e(_0x2fbfab);})[_0x967d('0x1e')](function(_0x2713ea){logger[_0x967d('0xe')](_0x967d('0x1d'),_0x2713ea[_0x967d('0x10')],_0x3813ff);_0x6122c7(_0x9b303[_0x967d('0xe')](0x1f4,_0x2713ea[_0x967d('0x10')]));});});};exports[_0x967d('0x1f')]=function(_0xf2fefd){var _0x4490c8=this;return new Promise(function(_0x357d1a,_0x3a317b){return db[_0x967d('0x12')]['create'](_0xf2fefd[_0x967d('0x20')],{'raw':_0xf2fefd['options']?_0xf2fefd['options'][_0x967d('0x15')]===undefined?!![]:![]:!![]})[_0x967d('0x7')](function(_0x14bf0d){logger[_0x967d('0x8')]('CreateCmHopper',_0xf2fefd);logger[_0x967d('0xa')]('CreateCmHopper',_0xf2fefd,JSON[_0x967d('0xd')](_0x14bf0d));_0x357d1a(_0x14bf0d);})[_0x967d('0x1e')](function(_0x8fde61){logger[_0x967d('0xe')](_0x967d('0x1f'),_0x8fde61[_0x967d('0x10')],_0xf2fefd);_0x3a317b(_0x4490c8[_0x967d('0xe')](0x1f4,_0x8fde61[_0x967d('0x10')]));});});};exports['UpdateCmHopper']=function(_0x190114){var _0xe9e591=this;return new Promise(function(_0x11b8b4,_0x7e7374){return db[_0x967d('0x12')]['update'](_0x190114[_0x967d('0x20')],{'raw':_0x190114[_0x967d('0x14')]?_0x190114[_0x967d('0x14')][_0x967d('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x190114[_0x967d('0x14')]?_0x190114[_0x967d('0x14')]['where']||null:null,'attributes':_0x190114[_0x967d('0x14')]?_0x190114['options'][_0x967d('0x17')]||null:null,'limit':_0x190114[_0x967d('0x14')]?_0x190114['options'][_0x967d('0x18')]||null:null})[_0x967d('0x7')](function(_0x4e353b){logger['info']('UpdateCmHopper',_0x190114);logger['debug'](_0x967d('0x21'),_0x190114,JSON[_0x967d('0xd')](_0x4e353b));_0x11b8b4(_0x4e353b);})['catch'](function(_0x158e39){logger[_0x967d('0xe')]('UpdateCmHopper',_0x158e39[_0x967d('0x10')],_0x190114);_0x7e7374(_0xe9e591[_0x967d('0xe')](0x1f4,_0x158e39[_0x967d('0x10')]));});});};exports[_0x967d('0x22')]=function(_0x551967){var _0x28058e=this;return new Promise(function(_0x9f3387,_0x43cb88){return db[_0x967d('0x12')][_0x967d('0x23')]({'where':_0x551967[_0x967d('0x14')]?_0x551967[_0x967d('0x14')][_0x967d('0x16')]||null:null})[_0x967d('0x7')](function(_0x3c738d){logger['info']('DestroyCmHopper',_0x551967);logger[_0x967d('0xa')](_0x967d('0x22'),_0x551967,JSON[_0x967d('0xd')](_0x3c738d));_0x9f3387(_0x3c738d);})[_0x967d('0x1e')](function(_0x1e3e51){logger[_0x967d('0xe')]('DestroyCmHopper',_0x1e3e51[_0x967d('0x10')],_0x551967);_0x43cb88(_0x28058e[_0x967d('0xe')](0x1f4,_0x1e3e51['message']));});});};exports[_0x967d('0x24')]=function(_0x322e72){var _0x1d05c3=this;return new Promise(function(_0x32cf8e,_0x458c6c){return db['CmContact']['describe']()[_0x967d('0x7')](function(_0x40479a){return db['sequelize'][_0x967d('0x25')](function(_0x16e409){return db[_0x967d('0x12')][_0x967d('0x13')]({'where':_0x322e72[_0x967d('0x14')]?_0x322e72[_0x967d('0x14')][_0x967d('0x16')]||null:null,'attributes':_0x322e72[_0x967d('0x14')]?_0x322e72[_0x967d('0x14')][_0x967d('0x17')]||null:null,'limit':_0x322e72['options']?_0x322e72[_0x967d('0x14')]['limit']||null:null,'order':_0x322e72[_0x967d('0x14')]?_0x322e72[_0x967d('0x14')][_0x967d('0x26')]||null:null,'transaction':_0x16e409,'lock':_0x16e409['LOCK'][_0x967d('0x27')],'include':[{'model':db[_0x967d('0x28')],'as':_0x967d('0x29'),'attributes':_[_0x967d('0x2a')](_0x40479a)},{'model':db[_0x967d('0x2b')],'as':'Agent','attributes':['id',_0x967d('0x2c'),_0x967d('0x2d')]}]})[_0x967d('0x7')](function(_0x235dce){var _0x462d06=[];var _0x22a47b=[];for(var _0x13d6a3=0x0;_0x13d6a3<_0x235dce['length'];_0x13d6a3+=0x1){if(!_0x22a47b[_0x967d('0x2e')](_0x235dce[_0x13d6a3][_0x967d('0x2f')])){_0x22a47b[_0x967d('0x30')](_0x235dce[_0x13d6a3][_0x967d('0x2f')]);_0x462d06[_0x967d('0x30')](_0x235dce[_0x13d6a3]['update'](_0x322e72[_0x967d('0x20')],{'transaction':_0x16e409}));}}return BPromise['all'](_0x462d06);});})[_0x967d('0x7')](function(_0x28093d){logger[_0x967d('0x8')](_0x967d('0x24'),_0x322e72);logger[_0x967d('0xa')](_0x967d('0x24'),_0x322e72,JSON[_0x967d('0xd')](_0x28093d));_0x32cf8e(_0x28093d);})[_0x967d('0x1e')](function(_0x389fa4){logger[_0x967d('0xe')]('GetContactDialer',_0x389fa4[_0x967d('0x10')],_0x322e72);_0x458c6c(_0x1d05c3[_0x967d('0xe')](0x1f4,_0x389fa4[_0x967d('0x10')]));});});});};exports[_0x967d('0x31')]=function(_0x543b4c){var _0x223e9e=this;return new Promise(function(_0x47ece1,_0x2920a5){return db['sequelize'][_0x967d('0x25')](function(_0x4fd93e){return db[_0x967d('0x32')][_0x967d('0x33')](_0x543b4c['body'],{'raw':_0x543b4c[_0x967d('0x14')]?_0x543b4c[_0x967d('0x14')][_0x967d('0x15')]===undefined?!![]:![]:!![],'transaction':_0x4fd93e})['then'](function(){return db[_0x967d('0x12')][_0x967d('0x23')]({'where':_0x543b4c[_0x967d('0x14')]?_0x543b4c[_0x967d('0x14')][_0x967d('0x16')]||null:null,'transaction':_0x4fd93e});});})[_0x967d('0x7')](function(_0x1cf64a){logger[_0x967d('0x8')]('MoveContactManagedDialer',_0x543b4c);logger[_0x967d('0xa')](_0x967d('0x31'),_0x543b4c,JSON[_0x967d('0xd')](_0x1cf64a));_0x47ece1(_0x1cf64a);})[_0x967d('0x1e')](function(_0x473085){logger['error']('MoveContactManagedDialer',_0x473085[_0x967d('0x10')],_0x543b4c);_0x2920a5(_0x223e9e[_0x967d('0xe')](0x1f4,_0x473085[_0x967d('0x10')]));});});};exports[_0x967d('0x34')]=function(_0x9081c9){var _0x236cb7=this;return new Promise(function(_0x3b6717,_0x2fdd05){return db[_0x967d('0x12')][_0x967d('0x13')]({'raw':_0x9081c9[_0x967d('0x14')]?_0x9081c9[_0x967d('0x14')][_0x967d('0x15')]===undefined?!![]:![]:!![],'where':_0x9081c9[_0x967d('0x14')]?_0x9081c9[_0x967d('0x14')]['where']||null:null,'attributes':[[db[_0x967d('0x35')]['fn']('COUNT',db[_0x967d('0x35')]['fn']('IF',db['sequelize'][_0x967d('0x36')](_0x967d('0x37')+util['format'](_0x967d('0x38'),moment()[_0x967d('0x39')](_0x967d('0x3a')))+_0x967d('0x3b')))),_0x967d('0x3c')]]})[_0x967d('0x7')](function(_0xfefd39){logger[_0x967d('0x8')](_0x967d('0x34'),_0x9081c9);logger[_0x967d('0xa')](_0x967d('0x34'),_0x9081c9,JSON['stringify'](_0xfefd39));_0x3b6717(_0xfefd39);})[_0x967d('0x1e')](function(_0x196f40){logger[_0x967d('0xe')](_0x967d('0x34'),_0x196f40['message'],_0x9081c9);_0x2fdd05(_0x236cb7[_0x967d('0xe')](0x1f4,_0x196f40[_0x967d('0x10')]));});});};exports[_0x967d('0x3d')]=function(_0x37db5c){var _0x28bf70=this;return new Promise(function(_0x3c2019,_0x227501){return db[_0x967d('0x28')][_0x967d('0x3e')]()['then'](function(_0x596789){return db[_0x967d('0x35')]['transaction'](function(_0x23cf62){return db[_0x967d('0x12')][_0x967d('0x13')]({'where':_0x37db5c['options']?_0x37db5c[_0x967d('0x14')][_0x967d('0x16')]||null:null,'attributes':_0x37db5c[_0x967d('0x14')]?_0x37db5c[_0x967d('0x14')][_0x967d('0x17')]||null:null,'limit':0x1,'order':_0x37db5c[_0x967d('0x14')]?_0x37db5c[_0x967d('0x14')][_0x967d('0x26')]||null:null,'group':db[_0x967d('0x12')][_0x967d('0x2f')],'transaction':_0x23cf62,'lock':_0x23cf62[_0x967d('0x3f')][_0x967d('0x27')],'include':_0x37db5c[_0x967d('0x14')]?_0x37db5c[_0x967d('0x14')][_0x967d('0x19')]?_[_0x967d('0x1a')](_0x37db5c[_0x967d('0x14')]['include'],function(_0x23ce25){return{'model':db[_0x23ce25['model']],'as':_0x23ce25['as'],'attributes':_0x23ce25[_0x967d('0x17')],'include':_0x23ce25[_0x967d('0x19')]?_[_0x967d('0x1a')](_0x23ce25['include'],function(_0x100567){return{'model':db[_0x100567[_0x967d('0x1b')]],'as':_0x100567['as'],'attributes':_0x100567['attributes'],'include':_0x100567[_0x967d('0x19')]?_[_0x967d('0x1a')](_0x100567[_0x967d('0x19')],function(_0x59a443){return{'model':db[_0x59a443[_0x967d('0x1b')]],'as':_0x59a443['as'],'attributes':_0x59a443['attributes']};}):[]};}):[]};}):[]:[]})[_0x967d('0x7')](function(_0x378434){var _0x280055=[];for(var _0x536410=0x0;_0x536410<_0x378434[_0x967d('0x40')];_0x536410+=0x1){_0x280055[_0x967d('0x30')](_0x378434[_0x536410][_0x967d('0x41')](_0x37db5c[_0x967d('0x20')],{'transaction':_0x23cf62}));}return BPromise[_0x967d('0x42')](_0x280055);});})['then'](function(_0x40a391){logger[_0x967d('0x8')](_0x967d('0x3d'),_0x37db5c);logger[_0x967d('0xa')](_0x967d('0x3d'),_0x37db5c,JSON['stringify'](_0x40a391));_0x3c2019(_0x40a391);})[_0x967d('0x1e')](function(_0xf546b){logger[_0x967d('0xe')]('GetContactRecallMe',_0xf546b[_0x967d('0x10')],_0x37db5c);_0x227501(_0x28bf70[_0x967d('0xe')](0x1f4,_0xf546b[_0x967d('0x10')]));});});});};exports[_0x967d('0x43')]=function(_0x73a407){var _0x3e530f=this;return new Promise(function(_0x305675,_0x164630){db['CmContact'][_0x967d('0x3e')]()[_0x967d('0x7')](function(_0x322292){return db['CmHopper'][_0x967d('0x13')]({'raw':_0x73a407[_0x967d('0x14')]?_0x73a407[_0x967d('0x14')][_0x967d('0x15')]===undefined?!![]:![]:!![],'where':_0x73a407[_0x967d('0x14')]?_0x73a407['options'][_0x967d('0x16')]||null:null,'attributes':_0x73a407['options']?_0x73a407[_0x967d('0x14')][_0x967d('0x17')]||null:null,'limit':_0x73a407[_0x967d('0x14')]?_0x73a407['options'][_0x967d('0x18')]||null:null,'include':_0x73a407['options']?_0x73a407[_0x967d('0x14')][_0x967d('0x19')]?_[_0x967d('0x1a')](_0x73a407[_0x967d('0x14')][_0x967d('0x19')],function(_0x55d051){return{'model':db[_0x55d051[_0x967d('0x1b')]],'as':_0x55d051['as'],'attributes':_0x55d051['as']==='Contact'?_['keys'](_0x322292):_0x55d051[_0x967d('0x17')],'include':_0x55d051['include']?_[_0x967d('0x1a')](_0x55d051[_0x967d('0x19')],function(_0x1ce170){return{'model':db[_0x1ce170['model']],'as':_0x1ce170['as'],'attributes':_0x1ce170[_0x967d('0x17')],'include':_0x1ce170[_0x967d('0x19')]?_[_0x967d('0x1a')](_0x1ce170[_0x967d('0x19')],function(_0x3c69ee){return{'model':db[_0x3c69ee[_0x967d('0x1b')]],'as':_0x3c69ee['as'],'attributes':_0x3c69ee[_0x967d('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x383d24){logger[_0x967d('0x8')]('GetCmHopper',_0x73a407);logger[_0x967d('0xa')](_0x967d('0x11'),_0x73a407,JSON[_0x967d('0xd')](_0x383d24));_0x305675(_0x383d24);})[_0x967d('0x1e')](function(_0x502bbf){logger[_0x967d('0xe')](_0x967d('0x11'),_0x502bbf[_0x967d('0x10')],_0x73a407);_0x164630(_0x3e530f['error'](0x1f4,_0x502bbf[_0x967d('0x10')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index f9fb566..449066d 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 _0xbf13=['create','post','put','update','delete','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./cmHopper.controller','get','isAuthenticated','index','describe','getOpenContacts','/:id','show'];(function(_0x49af86,_0x2cc09f){var _0x276f0f=function(_0x3e5257){while(--_0x3e5257){_0x49af86['push'](_0x49af86['shift']());}};_0x276f0f(++_0x2cc09f);}(_0xbf13,0xe2));var _0x3bf1=function(_0x42589e,_0x95ceae){_0x42589e=_0x42589e-0x0;var _0x23d290=_0xbf13[_0x42589e];return _0x23d290;};'use strict';var multer=require(_0x3bf1('0x0'));var util=require(_0x3bf1('0x1'));var path=require(_0x3bf1('0x2'));var timeout=require(_0x3bf1('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x3bf1('0x4'));var interaction=require(_0x3bf1('0x5'));var config=require('../../config/environment');var controller=require(_0x3bf1('0x6'));router[_0x3bf1('0x7')]('/',auth[_0x3bf1('0x8')](),controller[_0x3bf1('0x9')]);router[_0x3bf1('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x3bf1('0xa')]);router[_0x3bf1('0x7')]('/opencontacts',auth[_0x3bf1('0x8')](),controller[_0x3bf1('0xb')]);router[_0x3bf1('0x7')](_0x3bf1('0xc'),auth[_0x3bf1('0x8')](),controller[_0x3bf1('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3bf1('0xe')]);router[_0x3bf1('0xf')]('/preview',auth[_0x3bf1('0x8')](),controller['getPreview']);router[_0x3bf1('0x10')](_0x3bf1('0xc'),auth[_0x3bf1('0x8')](),controller[_0x3bf1('0x11')]);router[_0x3bf1('0x12')](_0x3bf1('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x3bf1('0x13')]=router; \ No newline at end of file +var _0xae24=['/preview','getPreview','delete','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','/describe','/opencontacts','getOpenContacts','/:id','show','post'];(function(_0x2d2ced,_0x2eb83a){var _0x353f4d=function(_0x287924){while(--_0x287924){_0x2d2ced['push'](_0x2d2ced['shift']());}};_0x353f4d(++_0x2eb83a);}(_0xae24,0x180));var _0x4ae2=function(_0x239cab,_0x5a61b7){_0x239cab=_0x239cab-0x0;var _0xabe06b=_0xae24[_0x239cab];return _0xabe06b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4ae2('0x0'));var timeout=require(_0x4ae2('0x1'));var express=require(_0x4ae2('0x2'));var router=express[_0x4ae2('0x3')]();var auth=require(_0x4ae2('0x4'));var interaction=require(_0x4ae2('0x5'));var config=require(_0x4ae2('0x6'));var controller=require(_0x4ae2('0x7'));router[_0x4ae2('0x8')]('/',auth[_0x4ae2('0x9')](),controller['index']);router[_0x4ae2('0x8')](_0x4ae2('0xa'),auth[_0x4ae2('0x9')](),controller['describe']);router['get'](_0x4ae2('0xb'),auth[_0x4ae2('0x9')](),controller[_0x4ae2('0xc')]);router[_0x4ae2('0x8')](_0x4ae2('0xd'),auth[_0x4ae2('0x9')](),controller[_0x4ae2('0xe')]);router[_0x4ae2('0xf')]('/',auth[_0x4ae2('0x9')](),controller['create']);router[_0x4ae2('0xf')](_0x4ae2('0x10'),auth['isAuthenticated'](),controller[_0x4ae2('0x11')]);router['put'](_0x4ae2('0xd'),auth[_0x4ae2('0x9')](),controller['update']);router[_0x4ae2('0x12')]('/:id',auth[_0x4ae2('0x9')](),controller[_0x4ae2('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 2861e4b..f533816 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 _0x0130=['exports','INTEGER','contactListQueue','moment','sequelize'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x0130,0xc1));var _0x0013=function(_0xac0de1,_0x12d3d9){_0xac0de1=_0xac0de1-0x0;var _0x1c1995=_0x0130[_0xac0de1];return _0x1c1995;};'use strict';var moment=require(_0x0013('0x0'));var Sequelize=require(_0x0013('0x1'));module[_0x0013('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x0013('0x3')],'unique':_0x0013('0x4')},'ListId':{'type':Sequelize[_0x0013('0x3')],'unique':_0x0013('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x0013('0x4')}}; \ No newline at end of file +var _0x6f01=['moment','sequelize','exports','STRING','INTEGER','contactListQueue'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6f01,0x126));var _0x16f0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f01[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x16f0('0x0'));var Sequelize=require(_0x16f0('0x1'));module[_0x16f0('0x2')]={'phone':{'type':Sequelize[_0x16f0('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x16f0('0x4')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x16f0('0x4')],'unique':_0x16f0('0x5')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x16f0('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index b9501a4..a1f9152 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(_0x51e7ba,_0x32044f){var _0x21000b=function(_0x51764a){while(--_0x51764a){_0x51e7ba['push'](_0x51e7ba['shift']());}};_0x21000b(++_0x32044f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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(_0x2ef198,_0x244d7b){var _0x5f3962=function(_0x275d82){while(--_0x275d82){_0x2ef198['push'](_0x2ef198['shift']());}};_0x5f3962(++_0x244d7b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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 aa88f95..c781045 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 _0x9528=['define','CmHopperBlack','cm_hopper_black','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x2583b1,_0x1aadda){var _0x43dc5e=function(_0x56882b){while(--_0x56882b){_0x2583b1['push'](_0x2583b1['shift']());}};_0x43dc5e(++_0x1aadda);}(_0x9528,0x1bc));var _0x8952=function(_0x113e23,_0x8dcb5f){_0x113e23=_0x113e23-0x0;var _0x4f858c=_0x9528[_0x113e23];return _0x4f858c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8952('0x0'))(_0x8952('0x1'));var moment=require(_0x8952('0x2'));var BPromise=require(_0x8952('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8952('0x4'));var rimraf=require('rimraf');var config=require(_0x8952('0x5'));var attributes=require('./cmHopperBlack.attributes');module['exports']=function(_0x28999f,_0x1d1975){return _0x28999f[_0x8952('0x6')](_0x8952('0x7'),attributes,{'tableName':_0x8952('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5913=['../../config/environment','exports','define','cm_hopper_black','util','api','moment','bluebird','request-promise','path'];(function(_0x86b219,_0x43038f){var _0x1f320c=function(_0x8cd63f){while(--_0x8cd63f){_0x86b219['push'](_0x86b219['shift']());}};_0x1f320c(++_0x43038f);}(_0x5913,0x16c));var _0x3591=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5913[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x3591('0x0'));var logger=require('../../config/logger')(_0x3591('0x1'));var moment=require(_0x3591('0x2'));var BPromise=require(_0x3591('0x3'));var rp=require(_0x3591('0x4'));var fs=require('fs');var path=require(_0x3591('0x5'));var rimraf=require('rimraf');var config=require(_0x3591('0x6'));var attributes=require('./cmHopperBlack.attributes');module[_0x3591('0x7')]=function(_0x3bf23c,_0x1ad094){return _0x3bf23c[_0x3591('0x8')]('CmHopperBlack',attributes,{'tableName':_0x3591('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index c22c7d1..27abb2d 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 _0x6f94=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','message','result','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','limit','include','map','model','attributes','stringify','UpdateCmHopperBlack','body','where','DestroyCmHopperBlack','destroy','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0x6f94,0x148));var _0x46f9=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x6f94[_0x42bdad];return _0x122626;};'use strict';var _=require('lodash');var util=require(_0x46f9('0x0'));var moment=require(_0x46f9('0x1'));var BPromise=require(_0x46f9('0x2'));var rs=require(_0x46f9('0x3'));var fs=require('fs');var Redis=require(_0x46f9('0x4'));var db=require(_0x46f9('0x5'))['db'];var utils=require(_0x46f9('0x6'));var logger=require(_0x46f9('0x7'))(_0x46f9('0x8'));var config=require(_0x46f9('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x46f9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e748d,_0x4b82e0,_0x22ac5b){return new BPromise(function(_0x59bc2c,_0x109405){return client['request'](_0x1e748d,_0x22ac5b)[_0x46f9('0xb')](function(_0x1ee8c6){logger[_0x46f9('0xc')](_0x46f9('0xd'),_0x4b82e0,_0x46f9('0xe'));logger[_0x46f9('0xf')](_0x46f9('0x10'),_0x4b82e0,_0x46f9('0xe'),JSON['stringify'](_0x1ee8c6));if(_0x1ee8c6['error']){if(_0x1ee8c6['error']['code']===0x1f4){logger[_0x46f9('0x11')](_0x46f9('0xd'),_0x4b82e0,_0x1ee8c6[_0x46f9('0x11')]['message']);return _0x109405(_0x1ee8c6[_0x46f9('0x11')][_0x46f9('0x12')]);}logger[_0x46f9('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x4b82e0,_0x1ee8c6[_0x46f9('0x11')][_0x46f9('0x12')]);return _0x59bc2c(_0x1ee8c6[_0x46f9('0x11')][_0x46f9('0x12')]);}else{logger['info'](_0x46f9('0xd'),_0x4b82e0,_0x46f9('0xe'));_0x59bc2c(_0x1ee8c6[_0x46f9('0x13')][_0x46f9('0x12')]);}})['catch'](function(_0x4391c6){logger[_0x46f9('0x11')](_0x46f9('0xd'),_0x4b82e0,_0x4391c6);_0x109405(_0x4391c6);});});}exports[_0x46f9('0x14')]=function(_0x1d9392){var _0x381287=this;return new Promise(function(_0x242def,_0x6cebf5){return db[_0x46f9('0x15')][_0x46f9('0x16')]({'raw':_0x1d9392[_0x46f9('0x17')]?_0x1d9392[_0x46f9('0x17')][_0x46f9('0x18')]===undefined?!![]:![]:!![],'where':_0x1d9392[_0x46f9('0x17')]?_0x1d9392[_0x46f9('0x17')]['where']||null:null,'attributes':_0x1d9392['options']?_0x1d9392[_0x46f9('0x17')]['attributes']||null:null,'limit':_0x1d9392[_0x46f9('0x17')]?_0x1d9392['options'][_0x46f9('0x19')]||null:null,'include':_0x1d9392['options']?_0x1d9392['options'][_0x46f9('0x1a')]?_[_0x46f9('0x1b')](_0x1d9392[_0x46f9('0x17')]['include'],function(_0x3635e9){return{'model':db[_0x3635e9[_0x46f9('0x1c')]],'as':_0x3635e9['as'],'attributes':_0x3635e9['attributes'],'include':_0x3635e9[_0x46f9('0x1a')]?_['map'](_0x3635e9[_0x46f9('0x1a')],function(_0x3502b3){return{'model':db[_0x3502b3[_0x46f9('0x1c')]],'as':_0x3502b3['as'],'attributes':_0x3502b3[_0x46f9('0x1d')],'include':_0x3502b3['include']?_[_0x46f9('0x1b')](_0x3502b3[_0x46f9('0x1a')],function(_0x1ff62f){return{'model':db[_0x1ff62f[_0x46f9('0x1c')]],'as':_0x1ff62f['as'],'attributes':_0x1ff62f[_0x46f9('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x46f9('0xb')](function(_0x158927){logger[_0x46f9('0xc')](_0x46f9('0x14'),_0x1d9392);logger['debug'](_0x46f9('0x14'),_0x1d9392,JSON[_0x46f9('0x1e')](_0x158927));_0x242def(_0x158927);})['catch'](function(_0x3882f8){logger[_0x46f9('0x11')](_0x46f9('0x14'),_0x3882f8[_0x46f9('0x12')],_0x1d9392);_0x6cebf5(_0x381287['error'](0x1f4,_0x3882f8[_0x46f9('0x12')]));});});};exports[_0x46f9('0x1f')]=function(_0x406c12){var _0x3f06ea=this;return new Promise(function(_0x104a77,_0x20281b){return db[_0x46f9('0x15')]['update'](_0x406c12[_0x46f9('0x20')],{'raw':_0x406c12[_0x46f9('0x17')]?_0x406c12[_0x46f9('0x17')][_0x46f9('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x406c12[_0x46f9('0x17')]?_0x406c12[_0x46f9('0x17')][_0x46f9('0x21')]||null:null,'attributes':_0x406c12[_0x46f9('0x17')]?_0x406c12['options'][_0x46f9('0x1d')]||null:null,'limit':_0x406c12[_0x46f9('0x17')]?_0x406c12[_0x46f9('0x17')][_0x46f9('0x19')]||null:null})[_0x46f9('0xb')](function(_0x1ec1bb){logger['info'](_0x46f9('0x1f'),_0x406c12);logger['debug'](_0x46f9('0x1f'),_0x406c12,JSON[_0x46f9('0x1e')](_0x1ec1bb));_0x104a77(_0x1ec1bb);})['catch'](function(_0x4b0c21){logger[_0x46f9('0x11')](_0x46f9('0x1f'),_0x4b0c21[_0x46f9('0x12')],_0x406c12);_0x20281b(_0x3f06ea['error'](0x1f4,_0x4b0c21['message']));});});};exports[_0x46f9('0x22')]=function(_0x27327b){var _0x38984d=this;return new Promise(function(_0x5d9777,_0x29f2be){return db[_0x46f9('0x15')][_0x46f9('0x23')]({'where':_0x27327b[_0x46f9('0x17')]?_0x27327b[_0x46f9('0x17')][_0x46f9('0x21')]||null:null})[_0x46f9('0xb')](function(_0x4a84be){logger['info'](_0x46f9('0x22'),_0x27327b);logger[_0x46f9('0xf')](_0x46f9('0x22'),_0x27327b,JSON['stringify'](_0x4a84be));_0x5d9777(_0x4a84be);})[_0x46f9('0x24')](function(_0x3686f3){logger[_0x46f9('0x11')](_0x46f9('0x22'),_0x3686f3[_0x46f9('0x12')],_0x27327b);_0x29f2be(_0x38984d['error'](0x1f4,_0x3686f3[_0x46f9('0x12')]));});});}; \ No newline at end of file +var _0xfa0e=['info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','attributes','limit','map','include','model','UpdateCmHopperBlack','raw','debug','DestroyCmHopperBlack','destroy','where','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x1fd3c9,_0x1024f8){var _0x44d133=function(_0x3e56b5){while(--_0x3e56b5){_0x1fd3c9['push'](_0x1fd3c9['shift']());}};_0x44d133(++_0x1024f8);}(_0xfa0e,0xd7));var _0xefa0=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xfa0e[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xefa0('0x0'));var util=require('util');var moment=require(_0xefa0('0x1'));var BPromise=require(_0xefa0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xefa0('0x3'));var db=require(_0xefa0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xefa0('0x5'))(_0xefa0('0x6'));var config=require(_0xefa0('0x7'));var jayson=require(_0xefa0('0x8'));var client=jayson[_0xefa0('0x9')][_0xefa0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e237c,_0x219daf,_0x1141ed){return new BPromise(function(_0x56dcae,_0x39d4fe){return client[_0xefa0('0xb')](_0x2e237c,_0x1141ed)[_0xefa0('0xc')](function(_0x3e7a43){logger[_0xefa0('0xd')](_0xefa0('0xe'),_0x219daf,_0xefa0('0xf'));logger['debug'](_0xefa0('0x10'),_0x219daf,_0xefa0('0xf'),JSON[_0xefa0('0x11')](_0x3e7a43));if(_0x3e7a43['error']){if(_0x3e7a43[_0xefa0('0x12')][_0xefa0('0x13')]===0x1f4){logger[_0xefa0('0x12')](_0xefa0('0xe'),_0x219daf,_0x3e7a43[_0xefa0('0x12')][_0xefa0('0x14')]);return _0x39d4fe(_0x3e7a43['error'][_0xefa0('0x14')]);}logger[_0xefa0('0x12')](_0xefa0('0xe'),_0x219daf,_0x3e7a43['error'][_0xefa0('0x14')]);return _0x56dcae(_0x3e7a43[_0xefa0('0x12')][_0xefa0('0x14')]);}else{logger[_0xefa0('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0x219daf,_0xefa0('0xf'));_0x56dcae(_0x3e7a43[_0xefa0('0x15')]['message']);}})[_0xefa0('0x16')](function(_0x5e01bb){logger[_0xefa0('0x12')](_0xefa0('0xe'),_0x219daf,_0x5e01bb);_0x39d4fe(_0x5e01bb);});});}exports[_0xefa0('0x17')]=function(_0x4f3921){var _0x5ecff7=this;return new Promise(function(_0x21ad22,_0x114d44){return db[_0xefa0('0x18')][_0xefa0('0x19')]({'raw':_0x4f3921[_0xefa0('0x1a')]?_0x4f3921[_0xefa0('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4f3921[_0xefa0('0x1a')]?_0x4f3921[_0xefa0('0x1a')]['where']||null:null,'attributes':_0x4f3921['options']?_0x4f3921[_0xefa0('0x1a')][_0xefa0('0x1b')]||null:null,'limit':_0x4f3921[_0xefa0('0x1a')]?_0x4f3921[_0xefa0('0x1a')][_0xefa0('0x1c')]||null:null,'include':_0x4f3921['options']?_0x4f3921[_0xefa0('0x1a')]['include']?_[_0xefa0('0x1d')](_0x4f3921['options'][_0xefa0('0x1e')],function(_0x4d3c01){return{'model':db[_0x4d3c01[_0xefa0('0x1f')]],'as':_0x4d3c01['as'],'attributes':_0x4d3c01[_0xefa0('0x1b')],'include':_0x4d3c01['include']?_[_0xefa0('0x1d')](_0x4d3c01[_0xefa0('0x1e')],function(_0xf2f0bf){return{'model':db[_0xf2f0bf[_0xefa0('0x1f')]],'as':_0xf2f0bf['as'],'attributes':_0xf2f0bf[_0xefa0('0x1b')],'include':_0xf2f0bf[_0xefa0('0x1e')]?_[_0xefa0('0x1d')](_0xf2f0bf[_0xefa0('0x1e')],function(_0x2cbd45){return{'model':db[_0x2cbd45[_0xefa0('0x1f')]],'as':_0x2cbd45['as'],'attributes':_0x2cbd45[_0xefa0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xefa0('0xc')](function(_0x2d71ca){logger[_0xefa0('0xd')]('GetCmHopperBlack',_0x4f3921);logger['debug'](_0xefa0('0x17'),_0x4f3921,JSON[_0xefa0('0x11')](_0x2d71ca));_0x21ad22(_0x2d71ca);})['catch'](function(_0x39a12f){logger[_0xefa0('0x12')](_0xefa0('0x17'),_0x39a12f['message'],_0x4f3921);_0x114d44(_0x5ecff7['error'](0x1f4,_0x39a12f[_0xefa0('0x14')]));});});};exports[_0xefa0('0x20')]=function(_0x222140){var _0x4f07c4=this;return new Promise(function(_0x59837c,_0x3d7679){return db[_0xefa0('0x18')]['update'](_0x222140['body'],{'raw':_0x222140[_0xefa0('0x1a')]?_0x222140[_0xefa0('0x1a')][_0xefa0('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x222140[_0xefa0('0x1a')]?_0x222140[_0xefa0('0x1a')]['where']||null:null,'attributes':_0x222140[_0xefa0('0x1a')]?_0x222140[_0xefa0('0x1a')][_0xefa0('0x1b')]||null:null,'limit':_0x222140[_0xefa0('0x1a')]?_0x222140[_0xefa0('0x1a')][_0xefa0('0x1c')]||null:null})[_0xefa0('0xc')](function(_0xf9fe41){logger[_0xefa0('0xd')]('UpdateCmHopperBlack',_0x222140);logger[_0xefa0('0x22')](_0xefa0('0x20'),_0x222140,JSON[_0xefa0('0x11')](_0xf9fe41));_0x59837c(_0xf9fe41);})[_0xefa0('0x16')](function(_0x41331d){logger[_0xefa0('0x12')]('UpdateCmHopperBlack',_0x41331d[_0xefa0('0x14')],_0x222140);_0x3d7679(_0x4f07c4[_0xefa0('0x12')](0x1f4,_0x41331d['message']));});});};exports[_0xefa0('0x23')]=function(_0x16f2ec){var _0x1c76b4=this;return new Promise(function(_0x2310b1,_0xdc43d5){return db[_0xefa0('0x18')][_0xefa0('0x24')]({'where':_0x16f2ec[_0xefa0('0x1a')]?_0x16f2ec['options'][_0xefa0('0x25')]||null:null})['then'](function(_0x2a8e16){logger[_0xefa0('0xd')](_0xefa0('0x23'),_0x16f2ec);logger[_0xefa0('0x22')](_0xefa0('0x23'),_0x16f2ec,JSON[_0xefa0('0x11')](_0x2a8e16));_0x2310b1(_0x2a8e16);})[_0xefa0('0x16')](function(_0xed3886){logger[_0xefa0('0x12')](_0xefa0('0x23'),_0xed3886['message'],_0x16f2ec);_0xdc43d5(_0x1c76b4[_0xefa0('0x12')](0x1f4,_0xed3886[_0xefa0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 7540d9b..be27417 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 _0xa41a=['../../config/environment','./cmHopperBlack.controller','get','index','describe','isAuthenticated','show','put','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x102e02,_0x57bd65){var _0x4dc653=function(_0x2f04ab){while(--_0x2f04ab){_0x102e02['push'](_0x102e02['shift']());}};_0x4dc653(++_0x57bd65);}(_0xa41a,0x6b));var _0xaa41=function(_0x164367,_0x2f212e){_0x164367=_0x164367-0x0;var _0x3e3e7e=_0xa41a[_0x164367];return _0x3e3e7e;};'use strict';var multer=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var path=require('path');var timeout=require(_0xaa41('0x2'));var express=require(_0xaa41('0x3'));var router=express[_0xaa41('0x4')]();var auth=require(_0xaa41('0x5'));var interaction=require(_0xaa41('0x6'));var config=require(_0xaa41('0x7'));var controller=require(_0xaa41('0x8'));router[_0xaa41('0x9')]('/',auth['isAuthenticated'](),controller[_0xaa41('0xa')]);router[_0xaa41('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xaa41('0xb')]);router[_0xaa41('0x9')]('/:id',auth[_0xaa41('0xc')](),controller[_0xaa41('0xd')]);router[_0xaa41('0xe')](_0xaa41('0xf'),auth[_0xaa41('0xc')](),controller[_0xaa41('0x10')]);router[_0xaa41('0x11')](_0xaa41('0xf'),auth[_0xaa41('0xc')](),controller['destroy']);module[_0xaa41('0x12')]=router; \ No newline at end of file +var _0x33c5=['destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','put','update','delete'];(function(_0x4605a1,_0x3bf24e){var _0x4574f8=function(_0x83dc79){while(--_0x83dc79){_0x4605a1['push'](_0x4605a1['shift']());}};_0x4574f8(++_0x3bf24e);}(_0x33c5,0xe6));var _0x533c=function(_0x1ebc6c,_0x58a00b){_0x1ebc6c=_0x1ebc6c-0x0;var _0x3a826d=_0x33c5[_0x1ebc6c];return _0x3a826d;};'use strict';var multer=require('multer');var util=require(_0x533c('0x0'));var path=require(_0x533c('0x1'));var timeout=require('connect-timeout');var express=require(_0x533c('0x2'));var router=express[_0x533c('0x3')]();var auth=require(_0x533c('0x4'));var interaction=require(_0x533c('0x5'));var config=require(_0x533c('0x6'));var controller=require('./cmHopperBlack.controller');router[_0x533c('0x7')]('/',auth[_0x533c('0x8')](),controller[_0x533c('0x9')]);router[_0x533c('0x7')](_0x533c('0xa'),auth[_0x533c('0x8')](),controller[_0x533c('0xb')]);router[_0x533c('0x7')](_0x533c('0xc'),auth[_0x533c('0x8')](),controller[_0x533c('0xd')]);router[_0x533c('0xe')](_0x533c('0xc'),auth[_0x533c('0x8')](),controller[_0x533c('0xf')]);router[_0x533c('0x10')]('/:id',auth[_0x533c('0x8')](),controller[_0x533c('0x11')]);module[_0x533c('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 7016842..abcf7ce 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 _0x5f21=['exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','dispositionat','BOOLEAN','sequelize','moment'];(function(_0x390dad,_0x3a3e5a){var _0x490148=function(_0x4a2c87){while(--_0x4a2c87){_0x390dad['push'](_0x390dad['shift']());}};_0x490148(++_0x3a3e5a);}(_0x5f21,0x1c5));var _0x15f2=function(_0x3340c8,_0x3d67d7){_0x3340c8=_0x3340c8-0x0;var _0x30ca8a=_0x5f21[_0x3340c8];return _0x30ca8a;};'use strict';var Sequelize=require(_0x15f2('0x0'));var moment=require(_0x15f2('0x1'));module[_0x15f2('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x15f2('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x15f2('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x15f2('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x15f2('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x15f2('0x4')]},'originatecalleridname':{'type':Sequelize[_0x15f2('0x4')]},'calleridnum':{'type':Sequelize[_0x15f2('0x4')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x15f2('0x5')]},'responsetime':{'type':Sequelize[_0x15f2('0x5')]},'answertime':{'type':Sequelize[_0x15f2('0x5')]},'droptime':{'type':Sequelize[_0x15f2('0x5')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x15f2('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x15f2('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x15f2('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x15f2('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x15f2('0x4')]},'campaign':{'type':Sequelize[_0x15f2('0x4')]},'campaigntype':{'type':Sequelize[_0x15f2('0x4')]},'membername':{'type':Sequelize[_0x15f2('0x4')]},'reason':{'type':Sequelize[_0x15f2('0x4')]},'disposition':{'type':Sequelize[_0x15f2('0x4')]},'dispositionat':{'type':Sequelize[_0x15f2('0x5')],'set':function(_0x3521c5){var _0x3e7cde=this[_0x15f2('0x6')](_0x15f2('0x7'));if(_0x3e7cde&&_0x3521c5){this[_0x15f2('0x8')](_0x15f2('0x9'),moment(_0x3521c5)[_0x15f2('0xa')](moment(_0x3e7cde),'seconds'));}return this[_0x15f2('0x8')](_0x15f2('0xb'),_0x3521c5);}},'amd':{'type':Sequelize[_0x15f2('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0x15f2('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x15f2('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x15f2('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x15f2('0x5')]},'callback':{'type':Sequelize[_0x15f2('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x15f2('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x15f2('0x5')]},'deleted':{'type':Sequelize[_0x15f2('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x15f2('0x5')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x15f2('0x5')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x15f2('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x15f2('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x15f2('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x15f2('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5af0=['seconds','dispositionat','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff'];(function(_0x2195a3,_0x3b9ad0){var _0x34ec9a=function(_0x3e8b60){while(--_0x3e8b60){_0x2195a3['push'](_0x2195a3['shift']());}};_0x34ec9a(++_0x3b9ad0);}(_0x5af0,0x73));var _0x05af=function(_0x3f6066,_0x2582d6){_0x3f6066=_0x3f6066-0x0;var _0x169181=_0x5af0[_0x3f6066];return _0x169181;};'use strict';var Sequelize=require(_0x05af('0x0'));var moment=require(_0x05af('0x1'));module[_0x05af('0x2')]={'state':{'type':Sequelize[_0x05af('0x3')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x05af('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x05af('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x05af('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x05af('0x4')]},'originatecalleridname':{'type':Sequelize[_0x05af('0x4')]},'calleridnum':{'type':Sequelize[_0x05af('0x4')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x05af('0x5')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x05af('0x5')]},'droptime':{'type':Sequelize[_0x05af('0x5')]},'endtime':{'type':Sequelize[_0x05af('0x5')]},'ringtime':{'type':Sequelize[_0x05af('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x05af('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x05af('0x4')]},'campaign':{'type':Sequelize[_0x05af('0x4')]},'campaigntype':{'type':Sequelize[_0x05af('0x4')]},'membername':{'type':Sequelize[_0x05af('0x4')]},'reason':{'type':Sequelize[_0x05af('0x4')]},'disposition':{'type':Sequelize[_0x05af('0x4')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x336556){var _0x45f154=this[_0x05af('0x6')](_0x05af('0x7'));if(_0x45f154&&_0x336556){this[_0x05af('0x8')](_0x05af('0x9'),moment(_0x336556)[_0x05af('0xa')](moment(_0x45f154),_0x05af('0xb')));}return this[_0x05af('0x8')](_0x05af('0xc'),_0x336556);}},'amd':{'type':Sequelize[_0x05af('0xd')],'defaultValue':![]},'fax':{'type':Sequelize[_0x05af('0xd')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x05af('0xd')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x05af('0xd')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x05af('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x05af('0x5')]},'deleted':{'type':Sequelize[_0x05af('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x05af('0x5')]},'recallme':{'type':Sequelize[_0x05af('0xd')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x05af('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x05af('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x05af('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x05af('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'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 c76f631..9962cde 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 _0x11f3=['COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x205,\x201,\x20null','congestionContacts','`state`\x20=\x2022,\x201,\x20null','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','phone','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','fromQuery','ANY_VALUE(CampaignId)','CampaignId','CampaignId\x20=\x20?','body','calleridnum','CmHopper','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','CmHopperFinal','fieldName','type','key','map','query','keys','intersection','attributes','model','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','fields','find','describe','uniqueid','countContactsQueueCampaignHopperFinal','params','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x11f3,0x149));var _0x311f=function(_0x46c952,_0x2b1b3f){_0x46c952=_0x46c952-0x0;var _0x3e98b4=_0x11f3[_0x46c952];return _0x3e98b4;};'use strict';var pdf=require(_0x311f('0x0'));var emlformat=require(_0x311f('0x1'));var rimraf=require(_0x311f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x311f('0x3'));var rp=require('request-promise');var moment=require(_0x311f('0x4'));var BPromise=require(_0x311f('0x5'));var Mustache=require(_0x311f('0x6'));var util=require('util');var path=require('path');var sox=require(_0x311f('0x7'));var csv=require('to-csv');var ejs=require(_0x311f('0x8'));var fs=require('fs');var _=require(_0x311f('0x9'));var squel=require(_0x311f('0xa'));var crypto=require(_0x311f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x311f('0xc'));var toCsv=require(_0x311f('0xd'));var querystring=require(_0x311f('0xe'));var Papa=require(_0x311f('0xf'));var Redis=require(_0x311f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x311f('0x11'));var as=require(_0x311f('0x12'));var hardwareService=require(_0x311f('0x13'));var logger=require(_0x311f('0x14'))(_0x311f('0x15'));var utils=require(_0x311f('0x16'));var config=require(_0x311f('0x17'));var db=require(_0x311f('0x18'))['db'];function respondWithStatusCode(_0x833528,_0xe68c1e){_0xe68c1e=_0xe68c1e||0xcc;return function(_0x3a73dd){if(_0x3a73dd){return _0x833528[_0x311f('0x19')](_0xe68c1e);}return _0x833528[_0x311f('0x1a')](_0xe68c1e)[_0x311f('0x1b')]();};}function respondWithResult(_0x3e809b,_0x25eb90){_0x25eb90=_0x25eb90||0xc8;return function(_0xeea2a8){if(_0xeea2a8){return _0x3e809b[_0x311f('0x1a')](_0x25eb90)[_0x311f('0x1c')](_0xeea2a8);}};}function respondWithFilteredResult(_0x5f09fb,_0x4e0362){return function(_0x5013f9){if(_0x5013f9){var _0x114ad7=_0x5013f9[_0x311f('0x1d')],_0x38f876=_0x4e0362[_0x311f('0x1e')],_0x248fca=_0x4e0362[_0x311f('0x1e')]+_0x4e0362[_0x311f('0x1f')],_0x7ff544;if(_0x248fca>=_0x114ad7){_0x248fca=_0x114ad7;_0x7ff544=0xc8;}else{_0x7ff544=0xce;}_0x5f09fb[_0x311f('0x1a')](_0x7ff544);return _0x5f09fb['set'](_0x311f('0x20'),_0x38f876+'-'+_0x248fca+'/'+_0x114ad7)[_0x311f('0x1c')](_0x5013f9);}return null;};}function patchUpdates(_0x3b9ca8){return function(_0x451467){try{jsonpatch[_0x311f('0x21')](_0x451467,_0x3b9ca8,!![]);}catch(_0x2e243f){return BPromise[_0x311f('0x22')](_0x2e243f);}return _0x451467[_0x311f('0x23')]();};}function saveUpdates(_0x3fc713,_0x67ea17){return function(_0x4c2b78){if(_0x4c2b78){return _0x4c2b78[_0x311f('0x24')](_0x3fc713)['then'](function(_0x82fdde){return _0x82fdde;});}return null;};}function removeEntity(_0x4ddf62,_0x29227e){return function(_0x32d9bf){if(_0x32d9bf){return _0x32d9bf[_0x311f('0x25')]()[_0x311f('0x26')](function(){_0x4ddf62[_0x311f('0x1a')](0xcc)[_0x311f('0x1b')]();});}};}function handleEntityNotFound(_0x59023e,_0x5a3319){return function(_0x5dd17d){if(!_0x5dd17d){_0x59023e[_0x311f('0x19')](0x194);}return _0x5dd17d;};}function handleError(_0x4429d3,_0x5ece19){_0x5ece19=_0x5ece19||0x1f4;return function(_0x10da88){logger[_0x311f('0x27')](_0x10da88[_0x311f('0x28')]);if(_0x10da88['name']){delete _0x10da88[_0x311f('0x29')];}_0x4429d3['status'](_0x5ece19)[_0x311f('0x2a')](_0x10da88);};}exports[_0x311f('0x2b')]=function(_0x12d14e,_0x583353){var _0x3a4ca5={},_0x1b1b88={},_0x22341e={'count':0x0,'rows':[]};var _0x536b4b=_['map'](db[_0x311f('0x2c')]['rawAttributes'],function(_0x9b611f){return{'name':_0x9b611f[_0x311f('0x2d')],'type':_0x9b611f[_0x311f('0x2e')][_0x311f('0x2f')]};});_0x1b1b88['model']=_[_0x311f('0x30')](_0x536b4b,'name');_0x1b1b88[_0x311f('0x31')]=_[_0x311f('0x32')](_0x12d14e[_0x311f('0x31')]);_0x1b1b88['filters']=_[_0x311f('0x33')](_0x1b1b88['model'],_0x1b1b88[_0x311f('0x31')]);_0x3a4ca5[_0x311f('0x34')]=_[_0x311f('0x33')](_0x1b1b88[_0x311f('0x35')],qs['fields'](_0x12d14e[_0x311f('0x31')]['fields']));_0x3a4ca5[_0x311f('0x34')]=_0x3a4ca5[_0x311f('0x34')][_0x311f('0x36')]?_0x3a4ca5['attributes']:_0x1b1b88[_0x311f('0x35')];if(!_0x12d14e[_0x311f('0x31')][_0x311f('0x37')](_0x311f('0x38'))){_0x3a4ca5[_0x311f('0x1f')]=qs['limit'](_0x12d14e[_0x311f('0x31')][_0x311f('0x1f')]);_0x3a4ca5[_0x311f('0x1e')]=qs[_0x311f('0x1e')](_0x12d14e[_0x311f('0x31')][_0x311f('0x1e')]);}_0x3a4ca5[_0x311f('0x39')]=qs[_0x311f('0x3a')](_0x12d14e['query'][_0x311f('0x3a')]);_0x3a4ca5[_0x311f('0x3b')]=qs['filters'](_['pick'](_0x12d14e[_0x311f('0x31')],_0x1b1b88[_0x311f('0x3c')]),_0x536b4b);if(_0x12d14e[_0x311f('0x31')][_0x311f('0x3d')]){_0x3a4ca5['where']=_[_0x311f('0x3e')](_0x3a4ca5[_0x311f('0x3b')],{'$or':_[_0x311f('0x30')](_0x536b4b,function(_0x1a58a8){if(_0x1a58a8[_0x311f('0x2e')]!==_0x311f('0x3f')){var _0x3c4f46={};_0x3c4f46[_0x1a58a8['name']]={'$like':'%'+_0x12d14e[_0x311f('0x31')][_0x311f('0x3d')]+'%'};return _0x3c4f46;}})});}_0x3a4ca5=_[_0x311f('0x3e')]({},_0x3a4ca5,_0x12d14e[_0x311f('0x40')]);var _0x2a4982={'where':_0x3a4ca5[_0x311f('0x3b')]};return db[_0x311f('0x2c')][_0x311f('0x1d')](_0x2a4982)[_0x311f('0x26')](function(_0x3a57ce){_0x22341e[_0x311f('0x1d')]=_0x3a57ce;if(_0x12d14e[_0x311f('0x31')][_0x311f('0x41')]){_0x3a4ca5[_0x311f('0x42')]=[{'all':!![]}];}return db[_0x311f('0x2c')][_0x311f('0x43')](_0x3a4ca5);})[_0x311f('0x26')](function(_0xb01961){_0x22341e[_0x311f('0x44')]=_0xb01961;return _0x22341e;})[_0x311f('0x26')](respondWithFilteredResult(_0x583353,_0x3a4ca5))[_0x311f('0x45')](handleError(_0x583353,null));};exports[_0x311f('0x46')]=function(_0x1c2e5f,_0x599ad8){var _0x206660={'raw':!![],'where':{'id':_0x1c2e5f['params']['id']}},_0x3ee59b={};_0x3ee59b['model']=_[_0x311f('0x32')](db[_0x311f('0x2c')][_0x311f('0x47')]);_0x3ee59b[_0x311f('0x31')]=_[_0x311f('0x32')](_0x1c2e5f[_0x311f('0x31')]);_0x3ee59b['filters']=_['intersection'](_0x3ee59b[_0x311f('0x35')],_0x3ee59b[_0x311f('0x31')]);_0x206660[_0x311f('0x34')]=_[_0x311f('0x33')](_0x3ee59b[_0x311f('0x35')],qs[_0x311f('0x48')](_0x1c2e5f['query'][_0x311f('0x48')]));_0x206660[_0x311f('0x34')]=_0x206660['attributes'][_0x311f('0x36')]?_0x206660['attributes']:_0x3ee59b[_0x311f('0x35')];if(_0x1c2e5f['query'][_0x311f('0x41')]){_0x206660[_0x311f('0x42')]=[{'all':!![]}];}_0x206660=_[_0x311f('0x3e')]({},_0x206660,_0x1c2e5f['options']);return db['CmHopperFinal'][_0x311f('0x49')](_0x206660)[_0x311f('0x26')](handleEntityNotFound(_0x599ad8,null))[_0x311f('0x26')](respondWithResult(_0x599ad8,null))['catch'](handleError(_0x599ad8,null));};exports['describe']=function(_0x349c79,_0x305b66){return db[_0x311f('0x2c')][_0x311f('0x4a')]()[_0x311f('0x26')](respondWithResult(_0x305b66,null))[_0x311f('0x45')](handleError(_0x305b66,null));};exports[_0x311f('0x24')]=function(_0x4992a3,_0x52cea4){if(_0x4992a3['body'][_0x311f('0x4b')]){delete _0x4992a3['body'][_0x311f('0x4b')];}return db[_0x311f('0x2c')]['find']({'where':{'uniqueid':_0x4992a3['params']['id']}})['then'](handleEntityNotFound(_0x52cea4,null))[_0x311f('0x26')](saveUpdates(_0x4992a3['body'],null))[_0x311f('0x26')](respondWithResult(_0x52cea4,null))[_0x311f('0x45')](handleError(_0x52cea4,null));};exports[_0x311f('0x4c')]=function(_0x49f2c0,_0x1e10b0,_0x13c6eb){return db[_0x311f('0x2c')][_0x311f('0x43')]({'raw':![],'where':{'VoiceQueueId':_0x49f2c0[_0x311f('0x4d')]['id']},'attributes':[[db[_0x311f('0x4e')]['fn'](_0x311f('0x4f'),db[_0x311f('0x4e')]['fn']('IF',db[_0x311f('0x4e')]['literal'](_0x311f('0x50')))),_0x311f('0x51')],[db[_0x311f('0x4e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x311f('0x4e')][_0x311f('0x52')](_0x311f('0x53')))),_0x311f('0x54')],[db[_0x311f('0x4e')]['fn'](_0x311f('0x4f'),db[_0x311f('0x4e')]['fn']('IF',db[_0x311f('0x4e')][_0x311f('0x52')]('`state`\x20=\x205,\x201,\x20null'))),_0x311f('0x55')],[db[_0x311f('0x4e')]['fn'](_0x311f('0x4f'),db['sequelize']['fn']('IF',db[_0x311f('0x4e')][_0x311f('0x52')](_0x311f('0x56')))),'congestionContacts'],[db[_0x311f('0x4e')]['fn'](_0x311f('0x4f'),db['sequelize']['fn']('IF',db[_0x311f('0x4e')]['literal'](_0x311f('0x57')))),_0x311f('0x58')],[db[_0x311f('0x4e')]['fn'](_0x311f('0x4f'),db[_0x311f('0x4e')]['fn']('IF',db[_0x311f('0x4e')]['literal'](_0x311f('0x59')))),_0x311f('0x5a')],[db[_0x311f('0x4e')]['fn'](_0x311f('0x4f'),db[_0x311f('0x4e')]['fn']('IF',db[_0x311f('0x4e')][_0x311f('0x52')]('`state`\x20=\x2022,\x201,\x20null'))),_0x311f('0x5b')],[db[_0x311f('0x4e')]['fn'](_0x311f('0x4f'),db[_0x311f('0x4e')]['fn']('IF',db[_0x311f('0x4e')][_0x311f('0x52')](_0x311f('0x5c')))),'answeringMachine']]})[_0x311f('0x26')](handleEntityNotFound(_0x1e10b0,null))['then'](respondWithResult(_0x1e10b0,null))[_0x311f('0x45')](handleError(_0x1e10b0,null));};exports[_0x311f('0x5d')]=function(_0x188929,_0x19dd16,_0x41aeee){return db[_0x311f('0x2c')][_0x311f('0x43')]({'raw':![],'where':{'CampaignId':_0x188929['params']['id']},'attributes':[[db[_0x311f('0x4e')]['fn'](_0x311f('0x4f'),db[_0x311f('0x4e')]['fn']('IF',db[_0x311f('0x4e')][_0x311f('0x52')](_0x311f('0x50')))),_0x311f('0x51')],[db[_0x311f('0x4e')]['fn'](_0x311f('0x4f'),db[_0x311f('0x4e')]['fn']('IF',db['sequelize'][_0x311f('0x52')]('`state`\x20=\x203,\x201,\x20null'))),_0x311f('0x54')],[db[_0x311f('0x4e')]['fn']('COUNT',db[_0x311f('0x4e')]['fn']('IF',db[_0x311f('0x4e')][_0x311f('0x52')](_0x311f('0x5e')))),_0x311f('0x55')],[db[_0x311f('0x4e')]['fn'](_0x311f('0x4f'),db['sequelize']['fn']('IF',db[_0x311f('0x4e')][_0x311f('0x52')]('`state`\x20=\x208,\x201,\x20null'))),_0x311f('0x5f')],[db[_0x311f('0x4e')]['fn'](_0x311f('0x4f'),db['sequelize']['fn']('IF',db[_0x311f('0x4e')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),'dropContacts'],[db[_0x311f('0x4e')]['fn'](_0x311f('0x4f'),db[_0x311f('0x4e')]['fn']('IF',db['sequelize'][_0x311f('0x52')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x311f('0x5a')],[db['sequelize']['fn'](_0x311f('0x4f'),db[_0x311f('0x4e')]['fn']('IF',db[_0x311f('0x4e')][_0x311f('0x52')](_0x311f('0x60')))),_0x311f('0x5b')],[db[_0x311f('0x4e')]['fn']('COUNT',db[_0x311f('0x4e')]['fn']('IF',db[_0x311f('0x4e')][_0x311f('0x52')](_0x311f('0x5c')))),_0x311f('0x61')]]})[_0x311f('0x26')](handleEntityNotFound(_0x19dd16,null))[_0x311f('0x26')](respondWithResult(_0x19dd16,null))['catch'](handleError(_0x19dd16,null));};exports[_0x311f('0x62')]=function(_0x1ebf8b,_0x280dbe,_0x5efbae){return db[_0x311f('0x63')][_0x311f('0x49')]({'where':{'id':_0x1ebf8b['params']['id']}})[_0x311f('0x26')](handleEntityNotFound(_0x280dbe,null))[_0x311f('0x26')](function(_0x5608b7){var _0x5049ae;if(_0x5608b7){_0x5049ae=squel[_0x311f('0x64')]()[_0x311f('0x65')](_0x311f('0x66'))['fromQuery']([_0x311f('0x67'),_0x311f('0x68'),_0x311f('0x69'),'ListId',_0x311f('0x6a'),_0x311f('0x6b'),_0x311f('0x6c')],squel['select']()[_0x311f('0x6d')](_0x311f('0x6e'),_0x311f('0x67'))['field'](_0x311f('0x6f'),_0x311f('0x68'))['field'](_0x311f('0x70'),_0x311f('0x69'))['field'](_0x311f('0x71'),_0x311f('0x72'))[_0x311f('0x6d')](_0x311f('0x73'),_0x311f('0x6a'))[_0x311f('0x6d')]('NOW()',_0x311f('0x6b'))[_0x311f('0x6d')]('NOW()',_0x311f('0x6c'))[_0x311f('0x74')](_0x311f('0x75'))['where'](_0x311f('0x76'),_0x1ebf8b['params']['id']['toString']())['where'](_0x311f('0x77'),_0x1ebf8b['body'][_0x311f('0x78')][_0x311f('0x79')]())[_0x311f('0x3b')](_0x311f('0x7a'))[_0x311f('0x3b')](_0x311f('0x7b'),squel[_0x311f('0x7c')]()[_0x311f('0x6d')](_0x311f('0x67'))[_0x311f('0x74')](_0x311f('0x66'))[_0x311f('0x3b')]('VoiceQueueId\x20=\x20?',_0x1ebf8b[_0x311f('0x4d')]['id'][_0x311f('0x79')]()))[_0x311f('0x3b')](_0x311f('0x7b'),squel[_0x311f('0x7c')]()[_0x311f('0x6d')]('calleridnum')[_0x311f('0x74')](_0x311f('0x75'))[_0x311f('0x3b')](_0x311f('0x76'),_0x1ebf8b['params']['id'][_0x311f('0x79')]())['where'](_0x311f('0x7d')))[_0x311f('0x7e')](_0x311f('0x69')))[_0x311f('0x79')]();return db[_0x311f('0x4e')][_0x311f('0x31')](_0x5049ae);}return[];})['then'](respondWithResult(_0x280dbe,null))[_0x311f('0x45')](handleError(_0x280dbe,null));};exports[_0x311f('0x7f')]=function(_0x468ebe,_0xa8b99f,_0x504884){return db[_0x311f('0x80')][_0x311f('0x49')]({'where':{'id':_0x468ebe[_0x311f('0x4d')]['id']}})[_0x311f('0x26')](handleEntityNotFound(_0xa8b99f,null))['then'](function(_0x1cf024){var _0x40fd27;if(_0x1cf024){_0x40fd27=squel['insert']()['into'](_0x311f('0x66'))[_0x311f('0x81')]([_0x311f('0x67'),'scheduledAt','ContactId',_0x311f('0x72'),'CampaignId',_0x311f('0x6b'),_0x311f('0x6c')],squel[_0x311f('0x7c')]()[_0x311f('0x6d')]('ANY_VALUE(calleridnum)','phone')[_0x311f('0x6d')](_0x311f('0x6f'),_0x311f('0x68'))[_0x311f('0x6d')](_0x311f('0x70'),_0x311f('0x69'))[_0x311f('0x6d')](_0x311f('0x71'),'ListId')[_0x311f('0x6d')](_0x311f('0x82'),_0x311f('0x83'))['field'](_0x311f('0x6f'),_0x311f('0x6b'))[_0x311f('0x6d')](_0x311f('0x6f'),_0x311f('0x6c'))[_0x311f('0x74')]('cm_hopper_final')['where'](_0x311f('0x84'),_0x468ebe[_0x311f('0x4d')]['id']['toString']())[_0x311f('0x3b')](_0x311f('0x77'),_0x468ebe[_0x311f('0x85')][_0x311f('0x78')][_0x311f('0x79')]())[_0x311f('0x3b')](_0x311f('0x7a'))[_0x311f('0x3b')](_0x311f('0x7b'),squel[_0x311f('0x7c')]()[_0x311f('0x6d')](_0x311f('0x67'))['from'](_0x311f('0x66'))['where'](_0x311f('0x84'),_0x468ebe[_0x311f('0x4d')]['id'][_0x311f('0x79')]()))['where'](_0x311f('0x7b'),squel[_0x311f('0x7c')]()[_0x311f('0x6d')](_0x311f('0x86'))[_0x311f('0x74')](_0x311f('0x75'))[_0x311f('0x3b')](_0x311f('0x84'),_0x468ebe[_0x311f('0x4d')]['id']['toString']())[_0x311f('0x3b')]('state\x20=\x204'))[_0x311f('0x7e')](_0x311f('0x69')))[_0x311f('0x79')]();return db[_0x311f('0x4e')]['query'](_0x40fd27);}return[];})[_0x311f('0x26')](respondWithResult(_0xa8b99f,null))[_0x311f('0x45')](handleError(_0xa8b99f,null));};exports['checkContactHopper']=function(_0x58a4de,_0x2a3527,_0x5a5694){return db[_0x311f('0x87')]['findOne']({'where':{'VoiceQueueId':_0x58a4de['body'][_0x311f('0x6a')],'CampaignId':_0x58a4de[_0x311f('0x85')][_0x311f('0x83')],'ContactId':_0x58a4de[_0x311f('0x85')][_0x311f('0x69')]}})['then'](handleEntityNotFound(_0x2a3527,null))[_0x311f('0x26')](function(_0x2acbbe){if(_0x2acbbe){return _0x2acbbe;}return null;})[_0x311f('0x26')](respondWithResult(_0x2a3527,null))[_0x311f('0x45')](handleError(_0x2a3527,null));}; \ No newline at end of file +var _0x96f2=['`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','congestionContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','createdAt','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','from','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(ContactId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state','CmHopper','findOne','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','Content-Range','json','apply','reject','then','destroy','sendStatus','error','stack','name','send','map','CmHopperFinal','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','filter','where','merge','type','options','findAll','rows','catch','show','params','length','includeAll','include','find','describe','update','uniqueid','body','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts'];(function(_0x510003,_0x39dc15){var _0xbb8b9c=function(_0x571ad9){while(--_0x571ad9){_0x510003['push'](_0x510003['shift']());}};_0xbb8b9c(++_0x39dc15);}(_0x96f2,0xb0));var _0x296f=function(_0x2a47fc,_0x3abb40){_0x2a47fc=_0x2a47fc-0x0;var _0x36612c=_0x96f2[_0x2a47fc];return _0x36612c;};'use strict';var pdf=require(_0x296f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x296f('0x1'));var zipdir=require(_0x296f('0x2'));var jsonpatch=require(_0x296f('0x3'));var rp=require('request-promise');var moment=require(_0x296f('0x4'));var BPromise=require(_0x296f('0x5'));var Mustache=require(_0x296f('0x6'));var util=require('util');var path=require(_0x296f('0x7'));var sox=require(_0x296f('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x296f('0x9'));var squel=require(_0x296f('0xa'));var crypto=require(_0x296f('0xb'));var jsforce=require(_0x296f('0xc'));var deskjs=require(_0x296f('0xd'));var toCsv=require(_0x296f('0xe'));var querystring=require(_0x296f('0xf'));var Papa=require(_0x296f('0x10'));var Redis=require(_0x296f('0x11'));var authService=require(_0x296f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x296f('0x13'));var hardwareService=require(_0x296f('0x14'));var logger=require(_0x296f('0x15'))('api');var utils=require(_0x296f('0x16'));var config=require(_0x296f('0x17'));var db=require(_0x296f('0x18'))['db'];function respondWithStatusCode(_0x28dad3,_0x5710ac){_0x5710ac=_0x5710ac||0xcc;return function(_0x4ef1e3){if(_0x4ef1e3){return _0x28dad3['sendStatus'](_0x5710ac);}return _0x28dad3[_0x296f('0x19')](_0x5710ac)[_0x296f('0x1a')]();};}function respondWithResult(_0x2ae407,_0xe843fc){_0xe843fc=_0xe843fc||0xc8;return function(_0x550b64){if(_0x550b64){return _0x2ae407[_0x296f('0x19')](_0xe843fc)['json'](_0x550b64);}};}function respondWithFilteredResult(_0x4e0b88,_0x367e03){return function(_0x2ae0f4){if(_0x2ae0f4){var _0x33654c=_0x2ae0f4[_0x296f('0x1b')],_0xa3d57a=_0x367e03['offset'],_0x4cfa9a=_0x367e03[_0x296f('0x1c')]+_0x367e03[_0x296f('0x1d')],_0x4a2aaa;if(_0x4cfa9a>=_0x33654c){_0x4cfa9a=_0x33654c;_0x4a2aaa=0xc8;}else{_0x4a2aaa=0xce;}_0x4e0b88[_0x296f('0x19')](_0x4a2aaa);return _0x4e0b88['set'](_0x296f('0x1e'),_0xa3d57a+'-'+_0x4cfa9a+'/'+_0x33654c)[_0x296f('0x1f')](_0x2ae0f4);}return null;};}function patchUpdates(_0x57f19d){return function(_0x33e62f){try{jsonpatch[_0x296f('0x20')](_0x33e62f,_0x57f19d,!![]);}catch(_0x51498d){return BPromise[_0x296f('0x21')](_0x51498d);}return _0x33e62f['save']();};}function saveUpdates(_0x132005,_0x474721){return function(_0x54f5d8){if(_0x54f5d8){return _0x54f5d8['update'](_0x132005)[_0x296f('0x22')](function(_0x31c544){return _0x31c544;});}return null;};}function removeEntity(_0x2ca4b2,_0x56cb8a){return function(_0x2a9a1c){if(_0x2a9a1c){return _0x2a9a1c[_0x296f('0x23')]()[_0x296f('0x22')](function(){_0x2ca4b2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x12abfb,_0x58bddc){return function(_0x54a0af){if(!_0x54a0af){_0x12abfb[_0x296f('0x24')](0x194);}return _0x54a0af;};}function handleError(_0x513d59,_0x4ab133){_0x4ab133=_0x4ab133||0x1f4;return function(_0x579977){logger[_0x296f('0x25')](_0x579977[_0x296f('0x26')]);if(_0x579977[_0x296f('0x27')]){delete _0x579977[_0x296f('0x27')];}_0x513d59[_0x296f('0x19')](_0x4ab133)[_0x296f('0x28')](_0x579977);};}exports['index']=function(_0x52ba5c,_0x12c4c5){var _0x5d388b={},_0xc47d1f={},_0x1de36c={'count':0x0,'rows':[]};var _0x436865=_[_0x296f('0x29')](db[_0x296f('0x2a')][_0x296f('0x2b')],function(_0x5918eb){return{'name':_0x5918eb[_0x296f('0x2c')],'type':_0x5918eb['type'][_0x296f('0x2d')]};});_0xc47d1f[_0x296f('0x2e')]=_[_0x296f('0x29')](_0x436865,_0x296f('0x27'));_0xc47d1f[_0x296f('0x2f')]=_[_0x296f('0x30')](_0x52ba5c[_0x296f('0x2f')]);_0xc47d1f[_0x296f('0x31')]=_[_0x296f('0x32')](_0xc47d1f[_0x296f('0x2e')],_0xc47d1f[_0x296f('0x2f')]);_0x5d388b[_0x296f('0x33')]=_[_0x296f('0x32')](_0xc47d1f['model'],qs[_0x296f('0x34')](_0x52ba5c[_0x296f('0x2f')][_0x296f('0x34')]));_0x5d388b[_0x296f('0x33')]=_0x5d388b['attributes']['length']?_0x5d388b['attributes']:_0xc47d1f[_0x296f('0x2e')];if(!_0x52ba5c[_0x296f('0x2f')]['hasOwnProperty'](_0x296f('0x35'))){_0x5d388b[_0x296f('0x1d')]=qs['limit'](_0x52ba5c['query'][_0x296f('0x1d')]);_0x5d388b[_0x296f('0x1c')]=qs['offset'](_0x52ba5c[_0x296f('0x2f')][_0x296f('0x1c')]);}_0x5d388b[_0x296f('0x36')]=qs[_0x296f('0x37')](_0x52ba5c[_0x296f('0x2f')][_0x296f('0x37')]);_0x5d388b['where']=qs['filters'](_['pick'](_0x52ba5c[_0x296f('0x2f')],_0xc47d1f['filters']),_0x436865);if(_0x52ba5c['query'][_0x296f('0x38')]){_0x5d388b[_0x296f('0x39')]=_[_0x296f('0x3a')](_0x5d388b[_0x296f('0x39')],{'$or':_[_0x296f('0x29')](_0x436865,function(_0x3e381d){if(_0x3e381d[_0x296f('0x3b')]!=='VIRTUAL'){var _0x2c46b8={};_0x2c46b8[_0x3e381d[_0x296f('0x27')]]={'$like':'%'+_0x52ba5c[_0x296f('0x2f')][_0x296f('0x38')]+'%'};return _0x2c46b8;}})});}_0x5d388b=_[_0x296f('0x3a')]({},_0x5d388b,_0x52ba5c[_0x296f('0x3c')]);var _0x344548={'where':_0x5d388b[_0x296f('0x39')]};return db['CmHopperFinal'][_0x296f('0x1b')](_0x344548)[_0x296f('0x22')](function(_0x5214bc){_0x1de36c[_0x296f('0x1b')]=_0x5214bc;if(_0x52ba5c[_0x296f('0x2f')]['includeAll']){_0x5d388b['include']=[{'all':!![]}];}return db[_0x296f('0x2a')][_0x296f('0x3d')](_0x5d388b);})[_0x296f('0x22')](function(_0x402ab7){_0x1de36c[_0x296f('0x3e')]=_0x402ab7;return _0x1de36c;})[_0x296f('0x22')](respondWithFilteredResult(_0x12c4c5,_0x5d388b))[_0x296f('0x3f')](handleError(_0x12c4c5,null));};exports[_0x296f('0x40')]=function(_0x34ef81,_0x54d10b){var _0x3145a4={'raw':!![],'where':{'id':_0x34ef81[_0x296f('0x41')]['id']}},_0x4e77e4={};_0x4e77e4[_0x296f('0x2e')]=_[_0x296f('0x30')](db[_0x296f('0x2a')]['rawAttributes']);_0x4e77e4[_0x296f('0x2f')]=_['keys'](_0x34ef81[_0x296f('0x2f')]);_0x4e77e4['filters']=_['intersection'](_0x4e77e4['model'],_0x4e77e4[_0x296f('0x2f')]);_0x3145a4[_0x296f('0x33')]=_[_0x296f('0x32')](_0x4e77e4[_0x296f('0x2e')],qs[_0x296f('0x34')](_0x34ef81[_0x296f('0x2f')][_0x296f('0x34')]));_0x3145a4['attributes']=_0x3145a4['attributes'][_0x296f('0x42')]?_0x3145a4['attributes']:_0x4e77e4[_0x296f('0x2e')];if(_0x34ef81[_0x296f('0x2f')][_0x296f('0x43')]){_0x3145a4[_0x296f('0x44')]=[{'all':!![]}];}_0x3145a4=_[_0x296f('0x3a')]({},_0x3145a4,_0x34ef81[_0x296f('0x3c')]);return db[_0x296f('0x2a')][_0x296f('0x45')](_0x3145a4)['then'](handleEntityNotFound(_0x54d10b,null))['then'](respondWithResult(_0x54d10b,null))[_0x296f('0x3f')](handleError(_0x54d10b,null));};exports[_0x296f('0x46')]=function(_0x450c4e,_0x420e0c){return db[_0x296f('0x2a')][_0x296f('0x46')]()['then'](respondWithResult(_0x420e0c,null))['catch'](handleError(_0x420e0c,null));};exports[_0x296f('0x47')]=function(_0x3641e0,_0x4cf2b0){if(_0x3641e0['body'][_0x296f('0x48')]){delete _0x3641e0[_0x296f('0x49')]['uniqueid'];}return db[_0x296f('0x2a')]['find']({'where':{'uniqueid':_0x3641e0['params']['id']}})['then'](handleEntityNotFound(_0x4cf2b0,null))[_0x296f('0x22')](saveUpdates(_0x3641e0[_0x296f('0x49')],null))[_0x296f('0x22')](respondWithResult(_0x4cf2b0,null))['catch'](handleError(_0x4cf2b0,null));};exports[_0x296f('0x4a')]=function(_0x8dadad,_0xb153bc,_0x4c8c35){return db[_0x296f('0x2a')][_0x296f('0x3d')]({'raw':![],'where':{'VoiceQueueId':_0x8dadad['params']['id']},'attributes':[[db[_0x296f('0x4b')]['fn'](_0x296f('0x4c'),db['sequelize']['fn']('IF',db[_0x296f('0x4b')]['literal']('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0x296f('0x4b')]['fn'](_0x296f('0x4c'),db['sequelize']['fn']('IF',db[_0x296f('0x4b')][_0x296f('0x4d')](_0x296f('0x4e')))),_0x296f('0x4f')],[db['sequelize']['fn']('COUNT',db[_0x296f('0x4b')]['fn']('IF',db['sequelize'][_0x296f('0x4d')](_0x296f('0x50')))),'busyContacts'],[db[_0x296f('0x4b')]['fn'](_0x296f('0x4c'),db[_0x296f('0x4b')]['fn']('IF',db['sequelize'][_0x296f('0x4d')](_0x296f('0x51')))),_0x296f('0x52')],[db[_0x296f('0x4b')]['fn'](_0x296f('0x4c'),db[_0x296f('0x4b')]['fn']('IF',db['sequelize'][_0x296f('0x4d')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x296f('0x53')],[db[_0x296f('0x4b')]['fn'](_0x296f('0x4c'),db[_0x296f('0x4b')]['fn']('IF',db[_0x296f('0x4b')][_0x296f('0x4d')](_0x296f('0x54')))),'abandonedContacts'],[db[_0x296f('0x4b')]['fn'](_0x296f('0x4c'),db['sequelize']['fn']('IF',db[_0x296f('0x4b')][_0x296f('0x4d')]('`state`\x20=\x2022,\x201,\x20null'))),_0x296f('0x55')],[db[_0x296f('0x4b')]['fn'](_0x296f('0x4c'),db['sequelize']['fn']('IF',db[_0x296f('0x4b')][_0x296f('0x4d')](_0x296f('0x56')))),_0x296f('0x57')]]})['then'](handleEntityNotFound(_0xb153bc,null))[_0x296f('0x22')](respondWithResult(_0xb153bc,null))[_0x296f('0x3f')](handleError(_0xb153bc,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x10f183,_0x3f5743,_0x23674e){return db[_0x296f('0x2a')][_0x296f('0x3d')]({'raw':![],'where':{'CampaignId':_0x10f183[_0x296f('0x41')]['id']},'attributes':[[db[_0x296f('0x4b')]['fn'](_0x296f('0x4c'),db[_0x296f('0x4b')]['fn']('IF',db[_0x296f('0x4b')]['literal'](_0x296f('0x58')))),'noSuchContacts'],[db[_0x296f('0x4b')]['fn'](_0x296f('0x4c'),db[_0x296f('0x4b')]['fn']('IF',db[_0x296f('0x4b')][_0x296f('0x4d')]('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0x296f('0x4b')]['fn'](_0x296f('0x4c'),db['sequelize']['fn']('IF',db[_0x296f('0x4b')][_0x296f('0x4d')](_0x296f('0x50')))),'busyContacts'],[db[_0x296f('0x4b')]['fn']('COUNT',db[_0x296f('0x4b')]['fn']('IF',db[_0x296f('0x4b')]['literal'](_0x296f('0x51')))),'congestionContacts'],[db['sequelize']['fn'](_0x296f('0x4c'),db[_0x296f('0x4b')]['fn']('IF',db['sequelize'][_0x296f('0x4d')](_0x296f('0x59')))),_0x296f('0x53')],[db[_0x296f('0x4b')]['fn'](_0x296f('0x4c'),db[_0x296f('0x4b')]['fn']('IF',db[_0x296f('0x4b')][_0x296f('0x4d')](_0x296f('0x54')))),_0x296f('0x5a')],[db[_0x296f('0x4b')]['fn'](_0x296f('0x4c'),db['sequelize']['fn']('IF',db[_0x296f('0x4b')][_0x296f('0x4d')](_0x296f('0x5b')))),_0x296f('0x55')],[db[_0x296f('0x4b')]['fn'](_0x296f('0x4c'),db['sequelize']['fn']('IF',db['sequelize'][_0x296f('0x4d')](_0x296f('0x56')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x3f5743,null))[_0x296f('0x22')](respondWithResult(_0x3f5743,null))[_0x296f('0x3f')](handleError(_0x3f5743,null));};exports[_0x296f('0x5c')]=function(_0x35b5a5,_0x476b9d,_0x597a85){return db[_0x296f('0x5d')][_0x296f('0x45')]({'where':{'id':_0x35b5a5[_0x296f('0x41')]['id']}})[_0x296f('0x22')](handleEntityNotFound(_0x476b9d,null))['then'](function(_0x142155){var _0x8fa1e6;if(_0x142155){_0x8fa1e6=squel['insert']()[_0x296f('0x5e')](_0x296f('0x5f'))[_0x296f('0x60')]([_0x296f('0x61'),_0x296f('0x62'),_0x296f('0x63'),_0x296f('0x64'),_0x296f('0x65'),'createdAt',_0x296f('0x66')],squel[_0x296f('0x67')]()[_0x296f('0x68')](_0x296f('0x69'),'phone')[_0x296f('0x68')](_0x296f('0x6a'),_0x296f('0x62'))[_0x296f('0x68')]('ANY_VALUE(ContactId)','ContactId')[_0x296f('0x68')](_0x296f('0x6b'),_0x296f('0x64'))[_0x296f('0x68')](_0x296f('0x6c'),_0x296f('0x65'))[_0x296f('0x68')](_0x296f('0x6a'),_0x296f('0x6d'))['field'](_0x296f('0x6a'),_0x296f('0x66'))['from'](_0x296f('0x6e'))[_0x296f('0x39')](_0x296f('0x6f'),_0x35b5a5[_0x296f('0x41')]['id']['toString']())['where']('state\x20=\x20?',_0x35b5a5[_0x296f('0x49')]['state'][_0x296f('0x70')]())[_0x296f('0x39')](_0x296f('0x71'))[_0x296f('0x39')](_0x296f('0x72'),squel[_0x296f('0x67')]()[_0x296f('0x68')](_0x296f('0x61'))[_0x296f('0x73')](_0x296f('0x5f'))[_0x296f('0x39')](_0x296f('0x6f'),_0x35b5a5[_0x296f('0x41')]['id'][_0x296f('0x70')]()))[_0x296f('0x39')](_0x296f('0x72'),squel[_0x296f('0x67')]()[_0x296f('0x68')](_0x296f('0x74'))[_0x296f('0x73')](_0x296f('0x6e'))[_0x296f('0x39')]('VoiceQueueId\x20=\x20?',_0x35b5a5['params']['id']['toString']())[_0x296f('0x39')](_0x296f('0x75')))[_0x296f('0x76')](_0x296f('0x63')))[_0x296f('0x70')]();return db[_0x296f('0x4b')]['query'](_0x8fa1e6);}return[];})[_0x296f('0x22')](respondWithResult(_0x476b9d,null))[_0x296f('0x3f')](handleError(_0x476b9d,null));};exports[_0x296f('0x77')]=function(_0x504d42,_0x4eb94f,_0x2a63e1){return db[_0x296f('0x78')][_0x296f('0x45')]({'where':{'id':_0x504d42[_0x296f('0x41')]['id']}})['then'](handleEntityNotFound(_0x4eb94f,null))[_0x296f('0x22')](function(_0x541b31){var _0x2bd560;if(_0x541b31){_0x2bd560=squel['insert']()[_0x296f('0x5e')](_0x296f('0x5f'))[_0x296f('0x60')]([_0x296f('0x61'),_0x296f('0x62'),_0x296f('0x63'),_0x296f('0x64'),_0x296f('0x79'),_0x296f('0x6d'),_0x296f('0x66')],squel['select']()[_0x296f('0x68')]('ANY_VALUE(calleridnum)',_0x296f('0x61'))[_0x296f('0x68')]('NOW()',_0x296f('0x62'))[_0x296f('0x68')](_0x296f('0x7a'),'ContactId')[_0x296f('0x68')](_0x296f('0x6b'),_0x296f('0x64'))[_0x296f('0x68')](_0x296f('0x7b'),_0x296f('0x79'))['field'](_0x296f('0x6a'),_0x296f('0x6d'))[_0x296f('0x68')](_0x296f('0x6a'),'updatedAt')[_0x296f('0x73')](_0x296f('0x6e'))[_0x296f('0x39')](_0x296f('0x7c'),_0x504d42[_0x296f('0x41')]['id'][_0x296f('0x70')]())[_0x296f('0x39')]('state\x20=\x20?',_0x504d42['body'][_0x296f('0x7d')][_0x296f('0x70')]())[_0x296f('0x39')](_0x296f('0x71'))['where'](_0x296f('0x72'),squel[_0x296f('0x67')]()['field'](_0x296f('0x61'))['from'](_0x296f('0x5f'))[_0x296f('0x39')](_0x296f('0x7c'),_0x504d42['params']['id'][_0x296f('0x70')]()))[_0x296f('0x39')](_0x296f('0x72'),squel['select']()[_0x296f('0x68')]('calleridnum')[_0x296f('0x73')]('cm_hopper_final')[_0x296f('0x39')]('CampaignId\x20=\x20?',_0x504d42['params']['id'][_0x296f('0x70')]())['where'](_0x296f('0x75')))[_0x296f('0x76')](_0x296f('0x63')))[_0x296f('0x70')]();return db[_0x296f('0x4b')]['query'](_0x2bd560);}return[];})[_0x296f('0x22')](respondWithResult(_0x4eb94f,null))[_0x296f('0x3f')](handleError(_0x4eb94f,null));};exports['checkContactHopper']=function(_0x381695,_0x5df478,_0x3b9dc4){return db[_0x296f('0x7e')][_0x296f('0x7f')]({'where':{'VoiceQueueId':_0x381695[_0x296f('0x49')][_0x296f('0x65')],'CampaignId':_0x381695['body'][_0x296f('0x79')],'ContactId':_0x381695[_0x296f('0x49')][_0x296f('0x63')]}})['then'](handleEntityNotFound(_0x5df478,null))['then'](function(_0x31f0d6){if(_0x31f0d6){return _0x31f0d6;}return null;})[_0x296f('0x22')](respondWithResult(_0x5df478,null))[_0x296f('0x3f')](handleError(_0x5df478,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 64ddbb3..8214b62 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 _0xcb60=['cm_hopper_final','calleridnum','uniqueid','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal'];(function(_0x5d679f,_0x15aaa8){var _0x226594=function(_0x242183){while(--_0x242183){_0x5d679f['push'](_0x5d679f['shift']());}};_0x226594(++_0x15aaa8);}(_0xcb60,0x1c5));var _0x0cb6=function(_0x1d7037,_0x57dd95){_0x1d7037=_0x1d7037-0x0;var _0x4d6568=_0xcb60[_0x1d7037];return _0x4d6568;};'use strict';var _=require(_0x0cb6('0x0'));var util=require('util');var logger=require(_0x0cb6('0x1'))(_0x0cb6('0x2'));var moment=require('moment');var BPromise=require(_0x0cb6('0x3'));var rp=require(_0x0cb6('0x4'));var fs=require('fs');var path=require(_0x0cb6('0x5'));var rimraf=require(_0x0cb6('0x6'));var config=require(_0x0cb6('0x7'));var attributes=require(_0x0cb6('0x8'));module[_0x0cb6('0x9')]=function(_0x4c1556,_0x5628fb){return _0x4c1556[_0x0cb6('0xa')](_0x0cb6('0xb'),attributes,{'tableName':_0x0cb6('0xc'),'paranoid':![],'indexes':[{'name':_0x0cb6('0xd'),'fields':[_0x0cb6('0xd')]},{'name':_0x0cb6('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1341=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','../../config/logger'];(function(_0xb1b616,_0x3b9023){var _0x1259b0=function(_0xb2e638){while(--_0xb2e638){_0xb1b616['push'](_0xb1b616['shift']());}};_0x1259b0(++_0x3b9023);}(_0x1341,0x7e));var _0x1134=function(_0x2161e,_0x30f769){_0x2161e=_0x2161e-0x0;var _0x377e75=_0x1341[_0x2161e];return _0x377e75;};'use strict';var _=require(_0x1134('0x0'));var util=require('util');var logger=require(_0x1134('0x1'))(_0x1134('0x2'));var moment=require(_0x1134('0x3'));var BPromise=require(_0x1134('0x4'));var rp=require(_0x1134('0x5'));var fs=require('fs');var path=require(_0x1134('0x6'));var rimraf=require(_0x1134('0x7'));var config=require(_0x1134('0x8'));var attributes=require(_0x1134('0x9'));module[_0x1134('0xa')]=function(_0x1de7dc,_0x1b4359){return _0x1de7dc[_0x1134('0xb')](_0x1134('0xc'),attributes,{'tableName':_0x1134('0xd'),'paranoid':![],'indexes':[{'name':_0x1134('0xe'),'fields':[_0x1134('0xe')]},{'name':'uniqueid','fields':[_0x1134('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 8897f3a..d2bea49 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 _0x1873=['CmHopperFinal,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','create','body','options','then','CreateCmHopperFinal','stringify','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4bf520,_0x5457ce){var _0x3d9889=function(_0x5b40e5){while(--_0x5b40e5){_0x4bf520['push'](_0x4bf520['shift']());}};_0x3d9889(++_0x5457ce);}(_0x1873,0x135));var _0x3187=function(_0x2ae967,_0x561ca7){_0x2ae967=_0x2ae967-0x0;var _0xa99ce9=_0x1873[_0x2ae967];return _0xa99ce9;};'use strict';var _=require('lodash');var util=require(_0x3187('0x0'));var moment=require('moment');var BPromise=require(_0x3187('0x1'));var rs=require(_0x3187('0x2'));var fs=require('fs');var Redis=require(_0x3187('0x3'));var db=require(_0x3187('0x4'))['db'];var utils=require(_0x3187('0x5'));var logger=require(_0x3187('0x6'))(_0x3187('0x7'));var config=require(_0x3187('0x8'));var jayson=require(_0x3187('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x116a6d,_0x5c6524,_0xee6538){return new BPromise(function(_0x4f3785,_0x5ba6a3){return client[_0x3187('0xa')](_0x116a6d,_0xee6538)['then'](function(_0x5ac0d4){logger[_0x3187('0xb')](_0x3187('0xc'),_0x5c6524,_0x3187('0xd'));logger[_0x3187('0xe')](_0x3187('0xf'),_0x5c6524,_0x3187('0xd'),JSON['stringify'](_0x5ac0d4));if(_0x5ac0d4['error']){if(_0x5ac0d4['error'][_0x3187('0x10')]===0x1f4){logger[_0x3187('0x11')](_0x3187('0xc'),_0x5c6524,_0x5ac0d4[_0x3187('0x11')][_0x3187('0x12')]);return _0x5ba6a3(_0x5ac0d4['error'][_0x3187('0x12')]);}logger[_0x3187('0x11')]('CmHopperFinal,\x20%s,\x20%s',_0x5c6524,_0x5ac0d4[_0x3187('0x11')][_0x3187('0x12')]);return _0x4f3785(_0x5ac0d4[_0x3187('0x11')][_0x3187('0x12')]);}else{logger['info'](_0x3187('0xc'),_0x5c6524,_0x3187('0xd'));_0x4f3785(_0x5ac0d4[_0x3187('0x13')][_0x3187('0x12')]);}})[_0x3187('0x14')](function(_0xbbc41d){logger['error'](_0x3187('0xc'),_0x5c6524,_0xbbc41d);_0x5ba6a3(_0xbbc41d);});});}exports['CreateCmHopperFinal']=function(_0x2321d6){var _0x3e4924=this;return new Promise(function(_0x1f31eb,_0x39b0f3){return db['CmHopperFinal'][_0x3187('0x15')](_0x2321d6[_0x3187('0x16')],{'raw':_0x2321d6['options']?_0x2321d6[_0x3187('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x3187('0x18')](function(_0x1b131f){logger[_0x3187('0xb')](_0x3187('0x19'),_0x2321d6);logger['debug']('CreateCmHopperFinal',_0x2321d6,JSON[_0x3187('0x1a')](_0x1b131f));_0x1f31eb(_0x1b131f);})[_0x3187('0x14')](function(_0x4dbf29){logger['error']('CreateCmHopperFinal',_0x4dbf29[_0x3187('0x12')],_0x2321d6);_0x39b0f3(_0x3e4924[_0x3187('0x11')](0x1f4,_0x4dbf29[_0x3187('0x12')]));});});}; \ No newline at end of file +var _0x0f4c=['stringify','error','code','CmHopperFinal,\x20%s,\x20%s','message','result','catch','CreateCmHopperFinal','create','body','options','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0f4c,0x178));var _0xc0f4=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x0f4c[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xc0f4('0x0'));var util=require(_0xc0f4('0x1'));var moment=require(_0xc0f4('0x2'));var BPromise=require('bluebird');var rs=require(_0xc0f4('0x3'));var fs=require('fs');var Redis=require(_0xc0f4('0x4'));var db=require(_0xc0f4('0x5'))['db'];var utils=require(_0xc0f4('0x6'));var logger=require('../../config/logger')(_0xc0f4('0x7'));var config=require(_0xc0f4('0x8'));var jayson=require(_0xc0f4('0x9'));var client=jayson[_0xc0f4('0xa')][_0xc0f4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1eccc3,_0x4c2bb1,_0x2393ee){return new BPromise(function(_0x14b011,_0xa6c2d2){return client[_0xc0f4('0xc')](_0x1eccc3,_0x2393ee)['then'](function(_0x3dd3cf){logger[_0xc0f4('0xd')]('CmHopperFinal,\x20%s,\x20%s',_0x4c2bb1,_0xc0f4('0xe'));logger[_0xc0f4('0xf')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x4c2bb1,_0xc0f4('0xe'),JSON[_0xc0f4('0x10')](_0x3dd3cf));if(_0x3dd3cf[_0xc0f4('0x11')]){if(_0x3dd3cf[_0xc0f4('0x11')][_0xc0f4('0x12')]===0x1f4){logger[_0xc0f4('0x11')](_0xc0f4('0x13'),_0x4c2bb1,_0x3dd3cf[_0xc0f4('0x11')][_0xc0f4('0x14')]);return _0xa6c2d2(_0x3dd3cf[_0xc0f4('0x11')]['message']);}logger[_0xc0f4('0x11')](_0xc0f4('0x13'),_0x4c2bb1,_0x3dd3cf[_0xc0f4('0x11')][_0xc0f4('0x14')]);return _0x14b011(_0x3dd3cf['error'][_0xc0f4('0x14')]);}else{logger[_0xc0f4('0xd')](_0xc0f4('0x13'),_0x4c2bb1,'request\x20sent');_0x14b011(_0x3dd3cf[_0xc0f4('0x15')][_0xc0f4('0x14')]);}})[_0xc0f4('0x16')](function(_0x3830b1){logger['error']('CmHopperFinal,\x20%s,\x20%s',_0x4c2bb1,_0x3830b1);_0xa6c2d2(_0x3830b1);});});}exports[_0xc0f4('0x17')]=function(_0x55c188){var _0x26b590=this;return new Promise(function(_0x32eb39,_0x51301b){return db['CmHopperFinal'][_0xc0f4('0x18')](_0x55c188[_0xc0f4('0x19')],{'raw':_0x55c188[_0xc0f4('0x1a')]?_0x55c188[_0xc0f4('0x1a')][_0xc0f4('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x232cff){logger[_0xc0f4('0xd')](_0xc0f4('0x17'),_0x55c188);logger['debug'](_0xc0f4('0x17'),_0x55c188,JSON[_0xc0f4('0x10')](_0x232cff));_0x32eb39(_0x232cff);})[_0xc0f4('0x16')](function(_0x5249fb){logger[_0xc0f4('0x11')](_0xc0f4('0x17'),_0x5249fb[_0xc0f4('0x14')],_0x55c188);_0x51301b(_0x26b590[_0xc0f4('0x11')](0x1f4,_0x5249fb[_0xc0f4('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 42592b1..c495b0e 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 _0xc85b=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmHopperFinal.controller','get','isAuthenticated','index','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','update','exports','multer','path'];(function(_0x456a6c,_0x47b35a){var _0x272575=function(_0x3e6af3){while(--_0x3e6af3){_0x456a6c['push'](_0x456a6c['shift']());}};_0x272575(++_0x47b35a);}(_0xc85b,0xb4));var _0xbc85=function(_0x77a6e7,_0x1d61b4){_0x77a6e7=_0x77a6e7-0x0;var _0x41e83a=_0xc85b[_0x77a6e7];return _0x41e83a;};'use strict';var multer=require(_0xbc85('0x0'));var util=require('util');var path=require(_0xbc85('0x1'));var timeout=require(_0xbc85('0x2'));var express=require(_0xbc85('0x3'));var router=express[_0xbc85('0x4')]();var auth=require(_0xbc85('0x5'));var interaction=require(_0xbc85('0x6'));var config=require('../../config/environment');var controller=require(_0xbc85('0x7'));router[_0xbc85('0x8')]('/',auth[_0xbc85('0x9')](),controller[_0xbc85('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xbc85('0xb')]);router[_0xbc85('0x8')](_0xbc85('0xc'),auth['isAuthenticated'](),controller[_0xbc85('0xd')]);router[_0xbc85('0x8')](_0xbc85('0xe'),auth[_0xbc85('0x9')](),controller[_0xbc85('0xf')]);router['get'](_0xbc85('0x10'),auth['isAuthenticated'](),controller[_0xbc85('0x11')]);router[_0xbc85('0x12')]('/voice/queue/moveContacts/:id',auth[_0xbc85('0x9')](),controller[_0xbc85('0x13')]);router[_0xbc85('0x12')](_0xbc85('0x14'),auth[_0xbc85('0x9')](),controller[_0xbc85('0x15')]);router[_0xbc85('0x12')](_0xbc85('0x16'),auth[_0xbc85('0x9')](),controller['checkContactHopper']);router[_0xbc85('0x17')](_0xbc85('0xc'),auth[_0xbc85('0x9')](),controller[_0xbc85('0x18')]);module[_0xbc85('0x19')]=router; \ No newline at end of file +var _0x088d=['post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','checkContactHopper','put','update','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','describe','/:id','isAuthenticated','show','/voice/queue/countAttributes/:id','countContactsIvrCampaignHopperFinal'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x088d,0x1eb));var _0xd088=function(_0x45aed0,_0x2a538f){_0x45aed0=_0x45aed0-0x0;var _0x4ad6af=_0x088d[_0x45aed0];return _0x4ad6af;};'use strict';var multer=require(_0xd088('0x0'));var util=require('util');var path=require(_0xd088('0x1'));var timeout=require(_0xd088('0x2'));var express=require('express');var router=express[_0xd088('0x3')]();var auth=require(_0xd088('0x4'));var interaction=require(_0xd088('0x5'));var config=require(_0xd088('0x6'));var controller=require('./cmHopperFinal.controller');router[_0xd088('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xd088('0x8'),auth['isAuthenticated'](),controller[_0xd088('0x9')]);router[_0xd088('0x7')](_0xd088('0xa'),auth[_0xd088('0xb')](),controller[_0xd088('0xc')]);router[_0xd088('0x7')](_0xd088('0xd'),auth[_0xd088('0xb')](),controller['countContactsQueueCampaignHopperFinal']);router['get']('/campaign/countAttributes/:id',auth[_0xd088('0xb')](),controller[_0xd088('0xe')]);router[_0xd088('0xf')](_0xd088('0x10'),auth[_0xd088('0xb')](),controller[_0xd088('0x11')]);router[_0xd088('0xf')]('/voice/campaign/moveContacts/:id',auth['isAuthenticated'](),controller[_0xd088('0x12')]);router[_0xd088('0xf')]('/checkContactHopper',auth['isAuthenticated'](),controller[_0xd088('0x13')]);router[_0xd088('0x14')](_0xd088('0xa'),auth[_0xd088('0xb')](),controller[_0xd088('0x15')]);module[_0xd088('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 10e3cf7..cbde7cf 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 _0xfe02=['INTEGER','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x4357da,_0x2e8f55){var _0x5da8de=function(_0x17cc66){while(--_0x17cc66){_0x4357da['push'](_0x4357da['shift']());}};_0x5da8de(++_0x2e8f55);}(_0xfe02,0xb8));var _0x2fe0=function(_0x526406,_0x549226){_0x526406=_0x526406-0x0;var _0xdd3e6d=_0xfe02[_0x526406];return _0xdd3e6d;};'use strict';var Sequelize=require(_0x2fe0('0x0'));module[_0x2fe0('0x1')]={'state':{'type':Sequelize[_0x2fe0('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x2fe0('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x2fe0('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2fe0('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x2fe0('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x2fe0('0x3')]},'originatecalleridname':{'type':Sequelize[_0x2fe0('0x3')]},'calleridnum':{'type':Sequelize[_0x2fe0('0x3')]},'calleridname':{'type':Sequelize[_0x2fe0('0x3')]},'starttime':{'type':Sequelize[_0x2fe0('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x2fe0('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x2fe0('0x4')]},'ringtime':{'type':Sequelize[_0x2fe0('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x2fe0('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x2fe0('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x2fe0('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x2fe0('0x3')]},'campaigntype':{'type':Sequelize[_0x2fe0('0x3')]},'membername':{'type':Sequelize[_0x2fe0('0x3')]},'reason':{'type':Sequelize[_0x2fe0('0x3')]},'amd':{'type':Sequelize[_0x2fe0('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x2fe0('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x2fe0('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x2fe0('0x4')]},'recallme':{'type':Sequelize[_0x2fe0('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x2fe0('0x4')]},'edited':{'type':Sequelize[_0x2fe0('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x2fe0('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x2fe0('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x2fe0('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x904d=['BOOLEAN','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x539028,_0x587dd9){var _0x2bdead=function(_0x22d16b){while(--_0x22d16b){_0x539028['push'](_0x539028['shift']());}};_0x2bdead(++_0x587dd9);}(_0x904d,0x151));var _0xd904=function(_0x34ad17,_0x246dce){_0x34ad17=_0x34ad17-0x0;var _0x3dc241=_0x904d[_0x34ad17];return _0x3dc241;};'use strict';var Sequelize=require(_0xd904('0x0'));module[_0xd904('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xd904('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xd904('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd904('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd904('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xd904('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xd904('0x2')]},'originatecalleridname':{'type':Sequelize[_0xd904('0x2')]},'calleridnum':{'type':Sequelize[_0xd904('0x2')]},'calleridname':{'type':Sequelize[_0xd904('0x2')]},'starttime':{'type':Sequelize[_0xd904('0x4')]},'responsetime':{'type':Sequelize[_0xd904('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xd904('0x4')]},'endtime':{'type':Sequelize[_0xd904('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xd904('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xd904('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xd904('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xd904('0x2')]},'campaigntype':{'type':Sequelize[_0xd904('0x2')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xd904('0x2')]},'amd':{'type':Sequelize[_0xd904('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xd904('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xd904('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd904('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xd904('0x4')]},'recallme':{'type':Sequelize[_0xd904('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xd904('0x4')]},'edited':{'type':Sequelize[_0xd904('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xd904('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd904('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd904('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 2cca733..e80fd25 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 _0x0d49=['offset','limit','set','Content-Range','apply','update','then','destroy','end','stack','name','send','index','map','CmHopperHistory','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','describe','uniqueid','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count'];(function(_0x4bb435,_0x23c5f8){var _0xcf7fa6=function(_0x1ec510){while(--_0x1ec510){_0x4bb435['push'](_0x4bb435['shift']());}};_0xcf7fa6(++_0x23c5f8);}(_0x0d49,0x7b));var _0x90d4=function(_0x97e409,_0x16eebb){_0x97e409=_0x97e409-0x0;var _0x3b5541=_0x0d49[_0x97e409];return _0x3b5541;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x90d4('0x0'));var rimraf=require(_0x90d4('0x1'));var zipdir=require(_0x90d4('0x2'));var jsonpatch=require(_0x90d4('0x3'));var rp=require(_0x90d4('0x4'));var moment=require('moment');var BPromise=require(_0x90d4('0x5'));var Mustache=require(_0x90d4('0x6'));var util=require('util');var path=require(_0x90d4('0x7'));var sox=require(_0x90d4('0x8'));var csv=require(_0x90d4('0x9'));var ejs=require(_0x90d4('0xa'));var fs=require('fs');var _=require(_0x90d4('0xb'));var squel=require('squel');var crypto=require(_0x90d4('0xc'));var jsforce=require(_0x90d4('0xd'));var deskjs=require(_0x90d4('0xe'));var toCsv=require(_0x90d4('0x9'));var querystring=require(_0x90d4('0xf'));var Papa=require(_0x90d4('0x10'));var Redis=require(_0x90d4('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x90d4('0x12'));var as=require(_0x90d4('0x13'));var hardwareService=require(_0x90d4('0x14'));var logger=require(_0x90d4('0x15'))('api');var utils=require(_0x90d4('0x16'));var config=require(_0x90d4('0x17'));var db=require(_0x90d4('0x18'))['db'];function respondWithStatusCode(_0x433706,_0x399549){_0x399549=_0x399549||0xcc;return function(_0x385477){if(_0x385477){return _0x433706[_0x90d4('0x19')](_0x399549);}return _0x433706[_0x90d4('0x1a')](_0x399549)['end']();};}function respondWithResult(_0x4a0e29,_0x5621ab){_0x5621ab=_0x5621ab||0xc8;return function(_0x5a57b7){if(_0x5a57b7){return _0x4a0e29[_0x90d4('0x1a')](_0x5621ab)[_0x90d4('0x1b')](_0x5a57b7);}};}function respondWithFilteredResult(_0x42f5f6,_0x365211){return function(_0x353f71){if(_0x353f71){var _0xb1b9e2=_0x353f71[_0x90d4('0x1c')],_0x398ea2=_0x365211['offset'],_0x5c827f=_0x365211[_0x90d4('0x1d')]+_0x365211[_0x90d4('0x1e')],_0x1eb07c;if(_0x5c827f>=_0xb1b9e2){_0x5c827f=_0xb1b9e2;_0x1eb07c=0xc8;}else{_0x1eb07c=0xce;}_0x42f5f6[_0x90d4('0x1a')](_0x1eb07c);return _0x42f5f6[_0x90d4('0x1f')](_0x90d4('0x20'),_0x398ea2+'-'+_0x5c827f+'/'+_0xb1b9e2)[_0x90d4('0x1b')](_0x353f71);}return null;};}function patchUpdates(_0x2530df){return function(_0x3ff296){try{jsonpatch[_0x90d4('0x21')](_0x3ff296,_0x2530df,!![]);}catch(_0x290d39){return BPromise['reject'](_0x290d39);}return _0x3ff296['save']();};}function saveUpdates(_0x11d739,_0x29e238){return function(_0x159829){if(_0x159829){return _0x159829[_0x90d4('0x22')](_0x11d739)[_0x90d4('0x23')](function(_0x57249b){return _0x57249b;});}return null;};}function removeEntity(_0x4b9258,_0x5dd7de){return function(_0x5a55f7){if(_0x5a55f7){return _0x5a55f7[_0x90d4('0x24')]()[_0x90d4('0x23')](function(){_0x4b9258[_0x90d4('0x1a')](0xcc)[_0x90d4('0x25')]();});}};}function handleEntityNotFound(_0x23ed81,_0x1cdf04){return function(_0xc2562f){if(!_0xc2562f){_0x23ed81['sendStatus'](0x194);}return _0xc2562f;};}function handleError(_0x272033,_0x51c988){_0x51c988=_0x51c988||0x1f4;return function(_0x222f98){logger['error'](_0x222f98[_0x90d4('0x26')]);if(_0x222f98[_0x90d4('0x27')]){delete _0x222f98[_0x90d4('0x27')];}_0x272033['status'](_0x51c988)[_0x90d4('0x28')](_0x222f98);};}exports[_0x90d4('0x29')]=function(_0x17b3fa,_0xb844f1){var _0x5f3fb8={},_0x4af8b1={},_0x3ad3db={'count':0x0,'rows':[]};var _0x530755=_[_0x90d4('0x2a')](db[_0x90d4('0x2b')]['rawAttributes'],function(_0x34a2ce){return{'name':_0x34a2ce[_0x90d4('0x2c')],'type':_0x34a2ce[_0x90d4('0x2d')][_0x90d4('0x2e')]};});_0x4af8b1[_0x90d4('0x2f')]=_[_0x90d4('0x2a')](_0x530755,_0x90d4('0x27'));_0x4af8b1[_0x90d4('0x30')]=_['keys'](_0x17b3fa[_0x90d4('0x30')]);_0x4af8b1[_0x90d4('0x31')]=_[_0x90d4('0x32')](_0x4af8b1['model'],_0x4af8b1[_0x90d4('0x30')]);_0x5f3fb8[_0x90d4('0x33')]=_[_0x90d4('0x32')](_0x4af8b1[_0x90d4('0x2f')],qs[_0x90d4('0x34')](_0x17b3fa[_0x90d4('0x30')][_0x90d4('0x34')]));_0x5f3fb8[_0x90d4('0x33')]=_0x5f3fb8[_0x90d4('0x33')][_0x90d4('0x35')]?_0x5f3fb8[_0x90d4('0x33')]:_0x4af8b1[_0x90d4('0x2f')];if(!_0x17b3fa[_0x90d4('0x30')][_0x90d4('0x36')]('nolimit')){_0x5f3fb8[_0x90d4('0x1e')]=qs[_0x90d4('0x1e')](_0x17b3fa['query'][_0x90d4('0x1e')]);_0x5f3fb8[_0x90d4('0x1d')]=qs['offset'](_0x17b3fa[_0x90d4('0x30')][_0x90d4('0x1d')]);}_0x5f3fb8[_0x90d4('0x37')]=qs[_0x90d4('0x38')](_0x17b3fa['query'][_0x90d4('0x38')]);_0x5f3fb8[_0x90d4('0x39')]=qs[_0x90d4('0x31')](_[_0x90d4('0x3a')](_0x17b3fa[_0x90d4('0x30')],_0x4af8b1[_0x90d4('0x31')]),_0x530755);if(_0x17b3fa[_0x90d4('0x30')][_0x90d4('0x3b')]){_0x5f3fb8[_0x90d4('0x39')]=_[_0x90d4('0x3c')](_0x5f3fb8['where'],{'$or':_[_0x90d4('0x2a')](_0x530755,function(_0xed0e57){if(_0xed0e57[_0x90d4('0x2d')]!=='VIRTUAL'){var _0x3fb473={};_0x3fb473[_0xed0e57[_0x90d4('0x27')]]={'$like':'%'+_0x17b3fa[_0x90d4('0x30')][_0x90d4('0x3b')]+'%'};return _0x3fb473;}})});}_0x5f3fb8=_[_0x90d4('0x3c')]({},_0x5f3fb8,_0x17b3fa[_0x90d4('0x3d')]);var _0x26882e={'where':_0x5f3fb8[_0x90d4('0x39')]};return db[_0x90d4('0x2b')][_0x90d4('0x1c')](_0x26882e)[_0x90d4('0x23')](function(_0x34d9ef){_0x3ad3db[_0x90d4('0x1c')]=_0x34d9ef;if(_0x17b3fa['query'][_0x90d4('0x3e')]){_0x5f3fb8[_0x90d4('0x3f')]=[{'all':!![]}];}return db[_0x90d4('0x2b')][_0x90d4('0x40')](_0x5f3fb8);})['then'](function(_0x50aa25){_0x3ad3db[_0x90d4('0x41')]=_0x50aa25;return _0x3ad3db;})[_0x90d4('0x23')](respondWithFilteredResult(_0xb844f1,_0x5f3fb8))[_0x90d4('0x42')](handleError(_0xb844f1,null));};exports[_0x90d4('0x43')]=function(_0x13ea92,_0xea064){var _0x1d738f={'raw':!![],'where':{'id':_0x13ea92[_0x90d4('0x44')]['id']}},_0x44549d={};_0x44549d['model']=_[_0x90d4('0x45')](db[_0x90d4('0x2b')][_0x90d4('0x46')]);_0x44549d['query']=_['keys'](_0x13ea92['query']);_0x44549d[_0x90d4('0x31')]=_[_0x90d4('0x32')](_0x44549d[_0x90d4('0x2f')],_0x44549d['query']);_0x1d738f[_0x90d4('0x33')]=_[_0x90d4('0x32')](_0x44549d[_0x90d4('0x2f')],qs['fields'](_0x13ea92[_0x90d4('0x30')][_0x90d4('0x34')]));_0x1d738f[_0x90d4('0x33')]=_0x1d738f[_0x90d4('0x33')]['length']?_0x1d738f[_0x90d4('0x33')]:_0x44549d[_0x90d4('0x2f')];if(_0x13ea92['query']['includeAll']){_0x1d738f[_0x90d4('0x3f')]=[{'all':!![]}];}_0x1d738f=_['merge']({},_0x1d738f,_0x13ea92[_0x90d4('0x3d')]);return db[_0x90d4('0x2b')][_0x90d4('0x47')](_0x1d738f)[_0x90d4('0x23')](handleEntityNotFound(_0xea064,null))[_0x90d4('0x23')](respondWithResult(_0xea064,null))['catch'](handleError(_0xea064,null));};exports[_0x90d4('0x48')]=function(_0x36b9a2,_0x2a7be3){return db[_0x90d4('0x2b')][_0x90d4('0x48')](_0x36b9a2['body'],{})['then'](respondWithResult(_0x2a7be3,0xc9))['catch'](handleError(_0x2a7be3,null));};exports[_0x90d4('0x49')]=function(_0x4960be,_0x4bf090){return db[_0x90d4('0x2b')][_0x90d4('0x49')]()[_0x90d4('0x23')](respondWithResult(_0x4bf090,null))[_0x90d4('0x42')](handleError(_0x4bf090,null));};exports['update']=function(_0x49b2ac,_0x587b87){if(_0x49b2ac['body'][_0x90d4('0x4a')]){delete _0x49b2ac[_0x90d4('0x4b')][_0x90d4('0x4a')];}return db[_0x90d4('0x2b')][_0x90d4('0x47')]({'where':{'uniqueid':_0x49b2ac[_0x90d4('0x44')]['id']}})[_0x90d4('0x23')](handleEntityNotFound(_0x587b87,null))[_0x90d4('0x23')](saveUpdates(_0x49b2ac[_0x90d4('0x4b')],null))[_0x90d4('0x23')](respondWithResult(_0x587b87,null))[_0x90d4('0x42')](handleError(_0x587b87,null));}; \ No newline at end of file +var _0x66b8=['stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','describe','uniqueid','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','set','Content-Range','json','save','update','then','destroy','sendStatus','error'];(function(_0x4f3cd1,_0x4b666e){var _0x4f304d=function(_0x5691ad){while(--_0x5691ad){_0x4f3cd1['push'](_0x4f3cd1['shift']());}};_0x4f304d(++_0x4b666e);}(_0x66b8,0x75));var _0x866b=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x66b8[_0x36ed48];return _0x51c63a;};'use strict';var pdf=require(_0x866b('0x0'));var emlformat=require(_0x866b('0x1'));var rimraf=require(_0x866b('0x2'));var zipdir=require(_0x866b('0x3'));var jsonpatch=require(_0x866b('0x4'));var rp=require(_0x866b('0x5'));var moment=require(_0x866b('0x6'));var BPromise=require(_0x866b('0x7'));var Mustache=require(_0x866b('0x8'));var util=require(_0x866b('0x9'));var path=require(_0x866b('0xa'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x866b('0xb'));var fs=require('fs');var _=require(_0x866b('0xc'));var squel=require('squel');var crypto=require(_0x866b('0xd'));var jsforce=require(_0x866b('0xe'));var deskjs=require(_0x866b('0xf'));var toCsv=require(_0x866b('0x10'));var querystring=require(_0x866b('0x11'));var Papa=require(_0x866b('0x12'));var Redis=require(_0x866b('0x13'));var authService=require(_0x866b('0x14'));var qs=require(_0x866b('0x15'));var as=require(_0x866b('0x16'));var hardwareService=require(_0x866b('0x17'));var logger=require(_0x866b('0x18'))('api');var utils=require(_0x866b('0x19'));var config=require(_0x866b('0x1a'));var db=require(_0x866b('0x1b'))['db'];function respondWithStatusCode(_0x29d466,_0x5ac935){_0x5ac935=_0x5ac935||0xcc;return function(_0x434fc5){if(_0x434fc5){return _0x29d466['sendStatus'](_0x5ac935);}return _0x29d466[_0x866b('0x1c')](_0x5ac935)[_0x866b('0x1d')]();};}function respondWithResult(_0x45684a,_0x288337){_0x288337=_0x288337||0xc8;return function(_0x205efc){if(_0x205efc){return _0x45684a[_0x866b('0x1c')](_0x288337)['json'](_0x205efc);}};}function respondWithFilteredResult(_0x52eba6,_0x462f57){return function(_0x5d7ee7){if(_0x5d7ee7){var _0x45e74d=_0x5d7ee7[_0x866b('0x1e')],_0x3f4e94=_0x462f57[_0x866b('0x1f')],_0x22222c=_0x462f57[_0x866b('0x1f')]+_0x462f57['limit'],_0x4d9c07;if(_0x22222c>=_0x45e74d){_0x22222c=_0x45e74d;_0x4d9c07=0xc8;}else{_0x4d9c07=0xce;}_0x52eba6[_0x866b('0x1c')](_0x4d9c07);return _0x52eba6[_0x866b('0x20')](_0x866b('0x21'),_0x3f4e94+'-'+_0x22222c+'/'+_0x45e74d)[_0x866b('0x22')](_0x5d7ee7);}return null;};}function patchUpdates(_0x1ab808){return function(_0xdfbff4){try{jsonpatch['apply'](_0xdfbff4,_0x1ab808,!![]);}catch(_0x2dc154){return BPromise['reject'](_0x2dc154);}return _0xdfbff4[_0x866b('0x23')]();};}function saveUpdates(_0x481bf3,_0x48e72d){return function(_0x56e256){if(_0x56e256){return _0x56e256[_0x866b('0x24')](_0x481bf3)[_0x866b('0x25')](function(_0x3c2170){return _0x3c2170;});}return null;};}function removeEntity(_0x54d2d1,_0x9c825a){return function(_0xa95e1d){if(_0xa95e1d){return _0xa95e1d[_0x866b('0x26')]()[_0x866b('0x25')](function(){_0x54d2d1[_0x866b('0x1c')](0xcc)[_0x866b('0x1d')]();});}};}function handleEntityNotFound(_0x5358c4,_0x101ba8){return function(_0x54b590){if(!_0x54b590){_0x5358c4[_0x866b('0x27')](0x194);}return _0x54b590;};}function handleError(_0xf2fe9c,_0x163a9f){_0x163a9f=_0x163a9f||0x1f4;return function(_0x47dc7c){logger[_0x866b('0x28')](_0x47dc7c[_0x866b('0x29')]);if(_0x47dc7c[_0x866b('0x2a')]){delete _0x47dc7c[_0x866b('0x2a')];}_0xf2fe9c['status'](_0x163a9f)[_0x866b('0x2b')](_0x47dc7c);};}exports[_0x866b('0x2c')]=function(_0x1c64ef,_0x14de87){var _0x6aaaa4={},_0x51bea6={},_0xa85c1f={'count':0x0,'rows':[]};var _0x1cb5c4=_[_0x866b('0x2d')](db[_0x866b('0x2e')][_0x866b('0x2f')],function(_0xca4c9c){return{'name':_0xca4c9c[_0x866b('0x30')],'type':_0xca4c9c['type'][_0x866b('0x31')]};});_0x51bea6[_0x866b('0x32')]=_['map'](_0x1cb5c4,'name');_0x51bea6[_0x866b('0x33')]=_[_0x866b('0x34')](_0x1c64ef[_0x866b('0x33')]);_0x51bea6[_0x866b('0x35')]=_[_0x866b('0x36')](_0x51bea6['model'],_0x51bea6[_0x866b('0x33')]);_0x6aaaa4[_0x866b('0x37')]=_[_0x866b('0x36')](_0x51bea6[_0x866b('0x32')],qs[_0x866b('0x38')](_0x1c64ef['query'][_0x866b('0x38')]));_0x6aaaa4['attributes']=_0x6aaaa4[_0x866b('0x37')][_0x866b('0x39')]?_0x6aaaa4['attributes']:_0x51bea6[_0x866b('0x32')];if(!_0x1c64ef[_0x866b('0x33')][_0x866b('0x3a')]('nolimit')){_0x6aaaa4[_0x866b('0x3b')]=qs[_0x866b('0x3b')](_0x1c64ef[_0x866b('0x33')]['limit']);_0x6aaaa4['offset']=qs[_0x866b('0x1f')](_0x1c64ef['query'][_0x866b('0x1f')]);}_0x6aaaa4[_0x866b('0x3c')]=qs[_0x866b('0x3d')](_0x1c64ef[_0x866b('0x33')]['sort']);_0x6aaaa4[_0x866b('0x3e')]=qs['filters'](_[_0x866b('0x3f')](_0x1c64ef['query'],_0x51bea6[_0x866b('0x35')]),_0x1cb5c4);if(_0x1c64ef['query'][_0x866b('0x40')]){_0x6aaaa4[_0x866b('0x3e')]=_[_0x866b('0x41')](_0x6aaaa4[_0x866b('0x3e')],{'$or':_[_0x866b('0x2d')](_0x1cb5c4,function(_0x80d205){if(_0x80d205['type']!==_0x866b('0x42')){var _0x416956={};_0x416956[_0x80d205[_0x866b('0x2a')]]={'$like':'%'+_0x1c64ef[_0x866b('0x33')][_0x866b('0x40')]+'%'};return _0x416956;}})});}_0x6aaaa4=_[_0x866b('0x41')]({},_0x6aaaa4,_0x1c64ef[_0x866b('0x43')]);var _0x2dbfb7={'where':_0x6aaaa4[_0x866b('0x3e')]};return db['CmHopperHistory'][_0x866b('0x1e')](_0x2dbfb7)[_0x866b('0x25')](function(_0x243380){_0xa85c1f[_0x866b('0x1e')]=_0x243380;if(_0x1c64ef[_0x866b('0x33')][_0x866b('0x44')]){_0x6aaaa4[_0x866b('0x45')]=[{'all':!![]}];}return db[_0x866b('0x2e')][_0x866b('0x46')](_0x6aaaa4);})['then'](function(_0x25dac2){_0xa85c1f[_0x866b('0x47')]=_0x25dac2;return _0xa85c1f;})[_0x866b('0x25')](respondWithFilteredResult(_0x14de87,_0x6aaaa4))[_0x866b('0x48')](handleError(_0x14de87,null));};exports['show']=function(_0x1b55e5,_0x19a306){var _0x112234={'raw':!![],'where':{'id':_0x1b55e5[_0x866b('0x49')]['id']}},_0x4b2548={};_0x4b2548[_0x866b('0x32')]=_['keys'](db[_0x866b('0x2e')]['rawAttributes']);_0x4b2548[_0x866b('0x33')]=_[_0x866b('0x34')](_0x1b55e5[_0x866b('0x33')]);_0x4b2548['filters']=_[_0x866b('0x36')](_0x4b2548[_0x866b('0x32')],_0x4b2548[_0x866b('0x33')]);_0x112234[_0x866b('0x37')]=_[_0x866b('0x36')](_0x4b2548[_0x866b('0x32')],qs[_0x866b('0x38')](_0x1b55e5[_0x866b('0x33')][_0x866b('0x38')]));_0x112234['attributes']=_0x112234[_0x866b('0x37')][_0x866b('0x39')]?_0x112234['attributes']:_0x4b2548[_0x866b('0x32')];if(_0x1b55e5['query']['includeAll']){_0x112234[_0x866b('0x45')]=[{'all':!![]}];}_0x112234=_[_0x866b('0x41')]({},_0x112234,_0x1b55e5[_0x866b('0x43')]);return db[_0x866b('0x2e')][_0x866b('0x4a')](_0x112234)['then'](handleEntityNotFound(_0x19a306,null))['then'](respondWithResult(_0x19a306,null))[_0x866b('0x48')](handleError(_0x19a306,null));};exports[_0x866b('0x4b')]=function(_0x37e84d,_0x404a33){return db[_0x866b('0x2e')][_0x866b('0x4b')](_0x37e84d[_0x866b('0x4c')],{})[_0x866b('0x25')](respondWithResult(_0x404a33,0xc9))[_0x866b('0x48')](handleError(_0x404a33,null));};exports[_0x866b('0x4d')]=function(_0x377921,_0x5f17f9){return db['CmHopperHistory'][_0x866b('0x4d')]()[_0x866b('0x25')](respondWithResult(_0x5f17f9,null))[_0x866b('0x48')](handleError(_0x5f17f9,null));};exports[_0x866b('0x24')]=function(_0x214e7f,_0x410a02){if(_0x214e7f[_0x866b('0x4c')][_0x866b('0x4e')]){delete _0x214e7f[_0x866b('0x4c')][_0x866b('0x4e')];}return db[_0x866b('0x2e')][_0x866b('0x4a')]({'where':{'uniqueid':_0x214e7f[_0x866b('0x49')]['id']}})[_0x866b('0x25')](handleEntityNotFound(_0x410a02,null))[_0x866b('0x25')](saveUpdates(_0x214e7f['body'],null))[_0x866b('0x25')](respondWithResult(_0x410a02,null))[_0x866b('0x48')](handleError(_0x410a02,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index a2273dc..87682c5 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 _0x3fe8=['util','api','moment','bluebird','rimraf','./cmHopperHistory.attributes','exports','CmHopperHistory','cm_hopper_history','endtime','uniqueid'];(function(_0x40b898,_0x2fd575){var _0x2ff0bb=function(_0x5a37ae){while(--_0x5a37ae){_0x40b898['push'](_0x40b898['shift']());}};_0x2ff0bb(++_0x2fd575);}(_0x3fe8,0x6e));var _0x83fe=function(_0x175a55,_0x4082fd){_0x175a55=_0x175a55-0x0;var _0x167adf=_0x3fe8[_0x175a55];return _0x167adf;};'use strict';var _=require('lodash');var util=require(_0x83fe('0x0'));var logger=require('../../config/logger')(_0x83fe('0x1'));var moment=require(_0x83fe('0x2'));var BPromise=require(_0x83fe('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x83fe('0x4'));var config=require('../../config/environment');var attributes=require(_0x83fe('0x5'));module[_0x83fe('0x6')]=function(_0x20d8cd,_0x4c22e1){return _0x20d8cd['define'](_0x83fe('0x7'),attributes,{'tableName':_0x83fe('0x8'),'paranoid':![],'indexes':[{'name':_0x83fe('0x9'),'fields':[_0x83fe('0x9')]},{'name':_0x83fe('0xa'),'fields':[_0x83fe('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x273c=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','cm_hopper_history','endtime','uniqueid','lodash','util'];(function(_0x1ccb1a,_0x3e787e){var _0x8956da=function(_0x3350ed){while(--_0x3350ed){_0x1ccb1a['push'](_0x1ccb1a['shift']());}};_0x8956da(++_0x3e787e);}(_0x273c,0x67));var _0xc273=function(_0x2b8722,_0x50d540){_0x2b8722=_0x2b8722-0x0;var _0x20c180=_0x273c[_0x2b8722];return _0x20c180;};'use strict';var _=require(_0xc273('0x0'));var util=require(_0xc273('0x1'));var logger=require(_0xc273('0x2'))(_0xc273('0x3'));var moment=require(_0xc273('0x4'));var BPromise=require(_0xc273('0x5'));var rp=require(_0xc273('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc273('0x7'));var config=require(_0xc273('0x8'));var attributes=require(_0xc273('0x9'));module[_0xc273('0xa')]=function(_0x83d914,_0x129a2e){return _0x83d914[_0xc273('0xb')]('CmHopperHistory',attributes,{'tableName':_0xc273('0xc'),'paranoid':![],'indexes':[{'name':_0xc273('0xd'),'fields':[_0xc273('0xd')]},{'name':_0xc273('0xe'),'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 ca2f81b..236514b 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 _0x5eb8=['raw','then','CreateCmHopperHistory','stringify','AvgHandleTime','sequelize','COUNT','col','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','GetVoiceQueueHopperHistory','findAll','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetCampaignHopperHistory','where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','message','catch','CmHopperHistory','create','body','options'];(function(_0x532112,_0x37d94b){var _0x23e5fb=function(_0x690ac8){while(--_0x690ac8){_0x532112['push'](_0x532112['shift']());}};_0x23e5fb(++_0x37d94b);}(_0x5eb8,0xb0));var _0x85eb=function(_0x507ac5,_0x33aaee){_0x507ac5=_0x507ac5-0x0;var _0x12c1bc=_0x5eb8[_0x507ac5];return _0x12c1bc;};'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')]('CmHopperHistory,\x20%s,\x20%s',_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x448345(_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);}else{logger[_0x85eb('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0x16d7b9,_0x85eb('0xf'));_0x448345(_0x1f0036['result'][_0x85eb('0x13')]);}})[_0x85eb('0x14')](function(_0x3e23e8){logger[_0x85eb('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x16d7b9,_0x3e23e8);_0x5cd4ec(_0x3e23e8);});});}exports['CreateCmHopperHistory']=function(_0x50d2a8){var _0xe198ca=this;return new Promise(function(_0x39ca96,_0x10cf2f){return db[_0x85eb('0x15')][_0x85eb('0x16')](_0x50d2a8[_0x85eb('0x17')],{'raw':_0x50d2a8['options']?_0x50d2a8[_0x85eb('0x18')][_0x85eb('0x19')]===undefined?!![]:![]:!![]})[_0x85eb('0x1a')](function(_0x4e8041){logger['info']('CreateCmHopperHistory',_0x50d2a8);logger['debug'](_0x85eb('0x1b'),_0x50d2a8,JSON[_0x85eb('0x1c')](_0x4e8041));_0x39ca96(_0x4e8041);})[_0x85eb('0x14')](function(_0x255ca7){logger[_0x85eb('0x12')](_0x85eb('0x1b'),_0x255ca7['message'],_0x50d2a8);_0x10cf2f(_0xe198ca['error'](0x1f4,_0x255ca7['message']));});});};exports[_0x85eb('0x1d')]=function(_0x1426c8){var _0x3f7a4d=this;return new Promise(function(_0x28b87d,_0x312b3e){return db[_0x85eb('0x15')]['findAll']({'raw':_0x1426c8[_0x85eb('0x18')]?_0x1426c8[_0x85eb('0x18')][_0x85eb('0x19')]===undefined?!![]:![]:!![],'where':_0x1426c8[_0x85eb('0x18')]?_0x1426c8[_0x85eb('0x18')]['where']||null:null,'attributes':[[db[_0x85eb('0x1e')]['fn'](_0x85eb('0x1f'),db[_0x85eb('0x1e')][_0x85eb('0x20')]('id')),_0x85eb('0x21')],[db[_0x85eb('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x85eb('0x1e')]['literal'](_0x85eb('0x22')))),'predictiveIntervalAnsweredCalls'],[db[_0x85eb('0x1e')]['fn'](_0x85eb('0x1f'),db[_0x85eb('0x1e')]['fn']('IF',db[_0x85eb('0x1e')][_0x85eb('0x23')](_0x85eb('0x24')))),_0x85eb('0x25')],[db['sequelize']['fn'](_0x85eb('0x1f'),db[_0x85eb('0x1e')]['fn']('IF',db['sequelize'][_0x85eb('0x23')]('`state`\x20=\x2011,\x201,\x20null'))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x85eb('0x1e')]['fn'](_0x85eb('0x26'),db[_0x85eb('0x1e')]['fn']('IF',db[_0x85eb('0x1e')][_0x85eb('0x23')](_0x85eb('0x27')))),_0x85eb('0x28')],[db[_0x85eb('0x1e')]['fn'](_0x85eb('0x26'),db[_0x85eb('0x1e')]['fn']('IF',db['sequelize'][_0x85eb('0x23')](_0x85eb('0x29')))),'predictiveIntervalAvgTalktime']]})['then'](function(_0x340745){logger[_0x85eb('0xd')](_0x85eb('0x1d'),_0x1426c8);logger[_0x85eb('0x10')](_0x85eb('0x1d'),_0x1426c8,JSON[_0x85eb('0x1c')](_0x340745));_0x28b87d(_0x340745);})[_0x85eb('0x14')](function(_0x35f092){logger[_0x85eb('0x12')](_0x85eb('0x1d'),_0x35f092[_0x85eb('0x13')],_0x1426c8);_0x312b3e(_0x3f7a4d[_0x85eb('0x12')](0x1f4,_0x35f092[_0x85eb('0x13')]));});});};exports[_0x85eb('0x2a')]=function(_0x4b69a7){var _0x4361e2=this;return new Promise(function(_0x3dfe74,_0x58f091){return db['CmHopperHistory'][_0x85eb('0x2b')]({'raw':_0x4b69a7[_0x85eb('0x18')]?_0x4b69a7['options'][_0x85eb('0x19')]===undefined?!![]:![]:!![],'where':_0x4b69a7['options']?_0x4b69a7[_0x85eb('0x18')]['where']||null:null,'attributes':[[_0x85eb('0x2c'),'name'],[db[_0x85eb('0x1e')]['fn']('COUNT',db[_0x85eb('0x1e')]['fn']('IF',db[_0x85eb('0x1e')]['literal'](_0x85eb('0x2d')))),'outboundNoSuchCallsDay'],[db[_0x85eb('0x1e')]['fn'](_0x85eb('0x1f'),db['sequelize']['fn']('IF',db[_0x85eb('0x1e')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x85eb('0x2e')],[db['sequelize']['fn'](_0x85eb('0x1f'),db[_0x85eb('0x1e')]['fn']('IF',db['sequelize']['literal'](_0x85eb('0x22')))),_0x85eb('0x2f')],[db['sequelize']['fn']('COUNT',db[_0x85eb('0x1e')]['fn']('IF',db[_0x85eb('0x1e')][_0x85eb('0x23')](_0x85eb('0x30')))),_0x85eb('0x31')],[db['sequelize']['fn'](_0x85eb('0x1f'),db[_0x85eb('0x1e')]['fn']('IF',db[_0x85eb('0x1e')][_0x85eb('0x23')](_0x85eb('0x32')))),_0x85eb('0x33')],[db[_0x85eb('0x1e')]['fn'](_0x85eb('0x1f'),db[_0x85eb('0x1e')]['fn']('IF',db['sequelize'][_0x85eb('0x23')](_0x85eb('0x34')))),'outboundDropCallsDayTimeout'],[db[_0x85eb('0x1e')]['fn'](_0x85eb('0x1f'),db[_0x85eb('0x1e')]['fn']('IF',db[_0x85eb('0x1e')][_0x85eb('0x23')](_0x85eb('0x35')))),'outboundDropCallsDayCallersExit'],[db[_0x85eb('0x1e')]['fn'](_0x85eb('0x1f'),db[_0x85eb('0x1e')]['fn']('IF',db[_0x85eb('0x1e')][_0x85eb('0x23')](_0x85eb('0x36')))),_0x85eb('0x37')],[db[_0x85eb('0x1e')]['fn']('COUNT',db[_0x85eb('0x1e')]['fn']('IF',db[_0x85eb('0x1e')][_0x85eb('0x23')](_0x85eb('0x38')))),_0x85eb('0x39')],[db[_0x85eb('0x1e')]['fn'](_0x85eb('0x1f'),db[_0x85eb('0x1e')]['fn']('IF',db[_0x85eb('0x1e')][_0x85eb('0x23')](_0x85eb('0x3a')))),_0x85eb('0x3b')],[db['sequelize']['fn'](_0x85eb('0x1f'),db[_0x85eb('0x1e')]['fn']('IF',db[_0x85eb('0x1e')]['literal'](_0x85eb('0x3c')))),_0x85eb('0x3d')],[db[_0x85eb('0x1e')]['fn'](_0x85eb('0x1f'),db[_0x85eb('0x1e')]['fn']('IF',db['sequelize'][_0x85eb('0x23')](_0x85eb('0x3e')))),_0x85eb('0x3f')],[db['sequelize']['fn'](_0x85eb('0x1f'),db[_0x85eb('0x1e')]['fn']('IF',db[_0x85eb('0x1e')]['literal']('`state`\x20=\x2020,\x201,\x20null'))),_0x85eb('0x3d')],[db['sequelize']['fn']('COUNT',db[_0x85eb('0x1e')]['fn']('IF',db['sequelize'][_0x85eb('0x23')](_0x85eb('0x40')))),'outboundReCallsDay']],'group':['campaign']})[_0x85eb('0x1a')](function(_0x249511){logger[_0x85eb('0xd')](_0x85eb('0x2a'),_0x4b69a7);logger[_0x85eb('0x10')]('GetVoiceQueueHopperHistory',_0x4b69a7,JSON[_0x85eb('0x1c')](_0x249511));_0x3dfe74(_0x249511);})[_0x85eb('0x14')](function(_0x270bb2){logger[_0x85eb('0x12')](_0x85eb('0x2a'),_0x270bb2['message'],_0x4b69a7);_0x58f091(_0x4361e2[_0x85eb('0x12')](0x1f4,_0x270bb2['message']));});});};exports[_0x85eb('0x41')]=function(_0x40d846){var _0x4ee529=this;return new Promise(function(_0x341ddb,_0xd04f24){return db[_0x85eb('0x15')][_0x85eb('0x2b')]({'raw':_0x40d846[_0x85eb('0x18')]?_0x40d846[_0x85eb('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x40d846[_0x85eb('0x18')]?_0x40d846['options'][_0x85eb('0x42')]||null:null,'attributes':[[_0x85eb('0x2c'),'name'],[db[_0x85eb('0x1e')]['fn'](_0x85eb('0x1f'),db['sequelize'][_0x85eb('0x20')]('id')),'ivrTotalCallsDays'],[db[_0x85eb('0x1e')]['fn'](_0x85eb('0x1f'),db[_0x85eb('0x1e')]['fn']('IF',db[_0x85eb('0x1e')][_0x85eb('0x23')](_0x85eb('0x22')))),'ivrAnswerCallsDay']],'group':[_0x85eb('0x2c')]})[_0x85eb('0x1a')](function(_0x1d3204){logger[_0x85eb('0xd')](_0x85eb('0x41'),_0x40d846);logger[_0x85eb('0x10')](_0x85eb('0x41'),_0x40d846,JSON[_0x85eb('0x1c')](_0x1d3204));_0x341ddb(_0x1d3204);})[_0x85eb('0x14')](function(_0x13cc2a){logger[_0x85eb('0x12')]('GetCampaignHopperHistory',_0x13cc2a[_0x85eb('0x13')],_0x40d846);_0xd04f24(_0x4ee529[_0x85eb('0x12')](0x1f4,_0x13cc2a[_0x85eb('0x13')]));});});}; \ No newline at end of file +var _0x087b=['`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','CmHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','CmHopperHistory,\x20%s,\x20%s','message','result','create','body','options','CreateCmHopperHistory','catch','AvgHandleTime','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','GetVoiceQueueHopperHistory','raw','campaign','name','outboundNoSuchCallsDay','outboundNoAnswerCallsDay'];(function(_0x175efd,_0x5b225b){var _0x4387dc=function(_0x543c2e){while(--_0x543c2e){_0x175efd['push'](_0x175efd['shift']());}};_0x4387dc(++_0x5b225b);}(_0x087b,0x11a));var _0xb087=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x087b[_0x4b7895];return _0x264180;};'use strict';var _=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb087('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb087('0x3'))['db'];var utils=require(_0xb087('0x4'));var logger=require(_0xb087('0x5'))(_0xb087('0x6'));var config=require(_0xb087('0x7'));var jayson=require(_0xb087('0x8'));var client=jayson[_0xb087('0x9')][_0xb087('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xecf080,_0x36ac30,_0x3cebbf){return new BPromise(function(_0x6d83fb,_0x1dbe9f){return client[_0xb087('0xb')](_0xecf080,_0x3cebbf)[_0xb087('0xc')](function(_0x23cdd7){logger[_0xb087('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0x36ac30,_0xb087('0xe'));logger[_0xb087('0xf')](_0xb087('0x10'),_0x36ac30,_0xb087('0xe'),JSON[_0xb087('0x11')](_0x23cdd7));if(_0x23cdd7[_0xb087('0x12')]){if(_0x23cdd7[_0xb087('0x12')]['code']===0x1f4){logger[_0xb087('0x12')](_0xb087('0x13'),_0x36ac30,_0x23cdd7[_0xb087('0x12')]['message']);return _0x1dbe9f(_0x23cdd7[_0xb087('0x12')][_0xb087('0x14')]);}logger[_0xb087('0x12')](_0xb087('0x13'),_0x36ac30,_0x23cdd7[_0xb087('0x12')][_0xb087('0x14')]);return _0x6d83fb(_0x23cdd7[_0xb087('0x12')][_0xb087('0x14')]);}else{logger[_0xb087('0xd')](_0xb087('0x13'),_0x36ac30,'request\x20sent');_0x6d83fb(_0x23cdd7[_0xb087('0x15')][_0xb087('0x14')]);}})['catch'](function(_0xcc4426){logger[_0xb087('0x12')](_0xb087('0x13'),_0x36ac30,_0xcc4426);_0x1dbe9f(_0xcc4426);});});}exports['CreateCmHopperHistory']=function(_0x330005){var _0x3c680f=this;return new Promise(function(_0x17200d,_0x45d074){return db['CmHopperHistory'][_0xb087('0x16')](_0x330005[_0xb087('0x17')],{'raw':_0x330005[_0xb087('0x18')]?_0x330005[_0xb087('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5ea3dc){logger['info'](_0xb087('0x19'),_0x330005);logger[_0xb087('0xf')](_0xb087('0x19'),_0x330005,JSON[_0xb087('0x11')](_0x5ea3dc));_0x17200d(_0x5ea3dc);})[_0xb087('0x1a')](function(_0x258b4c){logger[_0xb087('0x12')]('CreateCmHopperHistory',_0x258b4c[_0xb087('0x14')],_0x330005);_0x45d074(_0x3c680f[_0xb087('0x12')](0x1f4,_0x258b4c[_0xb087('0x14')]));});});};exports[_0xb087('0x1b')]=function(_0x3ad74e){var _0x4d9028=this;return new Promise(function(_0x183eab,_0xdd4216){return db['CmHopperHistory']['findAll']({'raw':_0x3ad74e['options']?_0x3ad74e['options']['raw']===undefined?!![]:![]:!![],'where':_0x3ad74e[_0xb087('0x18')]?_0x3ad74e[_0xb087('0x18')][_0xb087('0x1c')]||null:null,'attributes':[[db[_0xb087('0x1d')]['fn'](_0xb087('0x1e'),db[_0xb087('0x1d')][_0xb087('0x1f')]('id')),_0xb087('0x20')],[db[_0xb087('0x1d')]['fn'](_0xb087('0x1e'),db[_0xb087('0x1d')]['fn']('IF',db[_0xb087('0x1d')][_0xb087('0x21')](_0xb087('0x22')))),'predictiveIntervalAnsweredCalls'],[db[_0xb087('0x1d')]['fn'](_0xb087('0x1e'),db[_0xb087('0x1d')]['fn']('IF',db[_0xb087('0x1d')][_0xb087('0x21')](_0xb087('0x23')))),_0xb087('0x24')],[db[_0xb087('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb087('0x1d')][_0xb087('0x21')]('`state`\x20=\x2011,\x201,\x20null'))),_0xb087('0x25')],[db[_0xb087('0x1d')]['fn'](_0xb087('0x26'),db[_0xb087('0x1d')]['fn']('IF',db[_0xb087('0x1d')][_0xb087('0x21')](_0xb087('0x27')))),_0xb087('0x28')],[db[_0xb087('0x1d')]['fn'](_0xb087('0x26'),db[_0xb087('0x1d')]['fn']('IF',db[_0xb087('0x1d')]['literal'](_0xb087('0x29')))),'predictiveIntervalAvgTalktime']]})[_0xb087('0xc')](function(_0x296e9b){logger[_0xb087('0xd')](_0xb087('0x1b'),_0x3ad74e);logger[_0xb087('0xf')](_0xb087('0x1b'),_0x3ad74e,JSON[_0xb087('0x11')](_0x296e9b));_0x183eab(_0x296e9b);})[_0xb087('0x1a')](function(_0x8a4c3c){logger['error']('AvgHandleTime',_0x8a4c3c[_0xb087('0x14')],_0x3ad74e);_0xdd4216(_0x4d9028[_0xb087('0x12')](0x1f4,_0x8a4c3c[_0xb087('0x14')]));});});};exports[_0xb087('0x2a')]=function(_0x1982a8){var _0x5ca9b6=this;return new Promise(function(_0x1f24f4,_0x1fdc19){return db['CmHopperHistory']['findAll']({'raw':_0x1982a8[_0xb087('0x18')]?_0x1982a8[_0xb087('0x18')][_0xb087('0x2b')]===undefined?!![]:![]:!![],'where':_0x1982a8['options']?_0x1982a8[_0xb087('0x18')][_0xb087('0x1c')]||null:null,'attributes':[[_0xb087('0x2c'),_0xb087('0x2d')],[db[_0xb087('0x1d')]['fn']('COUNT',db[_0xb087('0x1d')]['fn']('IF',db['sequelize'][_0xb087('0x21')]('`state`\x20=\x200,\x201,\x20null'))),_0xb087('0x2e')],[db[_0xb087('0x1d')]['fn']('COUNT',db[_0xb087('0x1d')]['fn']('IF',db['sequelize'][_0xb087('0x21')]('`state`\x20=\x203,\x201,\x20null'))),_0xb087('0x2f')],[db[_0xb087('0x1d')]['fn'](_0xb087('0x1e'),db[_0xb087('0x1d')]['fn']('IF',db[_0xb087('0x1d')][_0xb087('0x21')](_0xb087('0x22')))),'outboundAnswerCallsDay'],[db[_0xb087('0x1d')]['fn']('COUNT',db[_0xb087('0x1d')]['fn']('IF',db[_0xb087('0x1d')]['literal'](_0xb087('0x30')))),_0xb087('0x31')],[db[_0xb087('0x1d')]['fn']('COUNT',db[_0xb087('0x1d')]['fn']('IF',db['sequelize'][_0xb087('0x21')](_0xb087('0x32')))),'outboundCongestionCallsDay'],[db[_0xb087('0x1d')]['fn'](_0xb087('0x1e'),db['sequelize']['fn']('IF',db[_0xb087('0x1d')][_0xb087('0x21')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xb087('0x33')],[db[_0xb087('0x1d')]['fn'](_0xb087('0x1e'),db[_0xb087('0x1d')]['fn']('IF',db['sequelize']['literal'](_0xb087('0x34')))),_0xb087('0x35')],[db[_0xb087('0x1d')]['fn'](_0xb087('0x1e'),db[_0xb087('0x1d')]['fn']('IF',db[_0xb087('0x1d')]['literal']('`state`\x20=\x2012,\x201,\x20null'))),_0xb087('0x36')],[db['sequelize']['fn'](_0xb087('0x1e'),db[_0xb087('0x1d')]['fn']('IF',db[_0xb087('0x1d')][_0xb087('0x21')]('`state`\x20=\x2013,\x201,\x20null'))),_0xb087('0x37')],[db['sequelize']['fn'](_0xb087('0x1e'),db[_0xb087('0x1d')]['fn']('IF',db[_0xb087('0x1d')][_0xb087('0x21')](_0xb087('0x38')))),'outboundOriginateFailureCallsDay'],[db[_0xb087('0x1d')]['fn'](_0xb087('0x1e'),db[_0xb087('0x1d')]['fn']('IF',db['sequelize'][_0xb087('0x21')]('`state`\x20=\x2018,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0xb087('0x1d')]['fn'](_0xb087('0x1e'),db['sequelize']['fn']('IF',db[_0xb087('0x1d')][_0xb087('0x21')](_0xb087('0x39')))),'outboundAnswerAgiCallsDay'],[db['sequelize']['fn'](_0xb087('0x1e'),db['sequelize']['fn']('IF',db['sequelize'][_0xb087('0x21')](_0xb087('0x3a')))),_0xb087('0x3b')],[db[_0xb087('0x1d')]['fn'](_0xb087('0x1e'),db[_0xb087('0x1d')]['fn']('IF',db[_0xb087('0x1d')][_0xb087('0x21')](_0xb087('0x3c')))),_0xb087('0x3d')]],'group':[_0xb087('0x2c')]})[_0xb087('0xc')](function(_0x55e653){logger[_0xb087('0xd')](_0xb087('0x2a'),_0x1982a8);logger['debug'](_0xb087('0x2a'),_0x1982a8,JSON[_0xb087('0x11')](_0x55e653));_0x1f24f4(_0x55e653);})[_0xb087('0x1a')](function(_0x1c91e8){logger[_0xb087('0x12')](_0xb087('0x2a'),_0x1c91e8[_0xb087('0x14')],_0x1982a8);_0x1fdc19(_0x5ca9b6[_0xb087('0x12')](0x1f4,_0x1c91e8[_0xb087('0x14')]));});});};exports[_0xb087('0x3e')]=function(_0x17c6d0){var _0x4ad1b6=this;return new Promise(function(_0x269eda,_0x56410e){return db[_0xb087('0x3f')]['findAll']({'raw':_0x17c6d0[_0xb087('0x18')]?_0x17c6d0[_0xb087('0x18')][_0xb087('0x2b')]===undefined?!![]:![]:!![],'where':_0x17c6d0[_0xb087('0x18')]?_0x17c6d0[_0xb087('0x18')][_0xb087('0x1c')]||null:null,'attributes':[[_0xb087('0x2c'),_0xb087('0x2d')],[db[_0xb087('0x1d')]['fn'](_0xb087('0x1e'),db[_0xb087('0x1d')][_0xb087('0x1f')]('id')),_0xb087('0x40')],[db[_0xb087('0x1d')]['fn'](_0xb087('0x1e'),db[_0xb087('0x1d')]['fn']('IF',db[_0xb087('0x1d')][_0xb087('0x21')](_0xb087('0x22')))),_0xb087('0x41')]],'group':[_0xb087('0x2c')]})[_0xb087('0xc')](function(_0x551274){logger[_0xb087('0xd')](_0xb087('0x3e'),_0x17c6d0);logger[_0xb087('0xf')]('GetCampaignHopperHistory',_0x17c6d0,JSON[_0xb087('0x11')](_0x551274));_0x269eda(_0x551274);})[_0xb087('0x1a')](function(_0x5685b1){logger[_0xb087('0x12')](_0xb087('0x3e'),_0x5685b1[_0xb087('0x14')],_0x17c6d0);_0x56410e(_0x4ad1b6['error'](0x1f4,_0x5685b1[_0xb087('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index b1addf0..8411f55 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 _0x9ee9=['show','create','put','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0x48e413,_0x141611){var _0x13eb86=function(_0x5a85a9){while(--_0x5a85a9){_0x48e413['push'](_0x48e413['shift']());}};_0x13eb86(++_0x141611);}(_0x9ee9,0x144));var _0x99ee=function(_0x99e044,_0x69b4ca){_0x99e044=_0x99e044-0x0;var _0x5e1557=_0x9ee9[_0x99e044];return _0x5e1557;};'use strict';var multer=require(_0x99ee('0x0'));var util=require('util');var path=require(_0x99ee('0x1'));var timeout=require('connect-timeout');var express=require(_0x99ee('0x2'));var router=express['Router']();var auth=require(_0x99ee('0x3'));var interaction=require(_0x99ee('0x4'));var config=require(_0x99ee('0x5'));var controller=require(_0x99ee('0x6'));router[_0x99ee('0x7')]('/',auth[_0x99ee('0x8')](),controller['index']);router[_0x99ee('0x7')](_0x99ee('0x9'),auth[_0x99ee('0x8')](),controller[_0x99ee('0xa')]);router[_0x99ee('0x7')](_0x99ee('0xb'),auth[_0x99ee('0x8')](),controller[_0x99ee('0xc')]);router['post']('/',auth[_0x99ee('0x8')](),controller[_0x99ee('0xd')]);router[_0x99ee('0xe')]('/:id',auth[_0x99ee('0x8')](),controller['update']);module[_0x99ee('0xf')]=router; \ No newline at end of file +var _0xbd54=['/describe','describe','/:id','show','post','create','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./cmHopperHistory.controller','get','isAuthenticated','index'];(function(_0xc357ac,_0x3486f1){var _0xca0100=function(_0x29ebec){while(--_0x29ebec){_0xc357ac['push'](_0xc357ac['shift']());}};_0xca0100(++_0x3486f1);}(_0xbd54,0x67));var _0x4bd5=function(_0x5d660b,_0x2b6023){_0x5d660b=_0x5d660b-0x0;var _0x29263a=_0xbd54[_0x5d660b];return _0x29263a;};'use strict';var multer=require(_0x4bd5('0x0'));var util=require(_0x4bd5('0x1'));var path=require(_0x4bd5('0x2'));var timeout=require(_0x4bd5('0x3'));var express=require(_0x4bd5('0x4'));var router=express[_0x4bd5('0x5')]();var auth=require(_0x4bd5('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4bd5('0x7'));router[_0x4bd5('0x8')]('/',auth[_0x4bd5('0x9')](),controller[_0x4bd5('0xa')]);router[_0x4bd5('0x8')](_0x4bd5('0xb'),auth[_0x4bd5('0x9')](),controller[_0x4bd5('0xc')]);router[_0x4bd5('0x8')](_0x4bd5('0xd'),auth[_0x4bd5('0x9')](),controller[_0x4bd5('0xe')]);router[_0x4bd5('0xf')]('/',auth[_0x4bd5('0x9')](),controller[_0x4bd5('0x10')]);router['put'](_0x4bd5('0xd'),auth[_0x4bd5('0x9')](),controller[_0x4bd5('0x11')]);module[_0x4bd5('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 45e1f99..cdcd48f 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 _0x2715=['STRING','name','sequelize','exports'];(function(_0x3e531a,_0x28a82a){var _0x3c2574=function(_0x4a0c98){while(--_0x4a0c98){_0x3e531a['push'](_0x3e531a['shift']());}};_0x3c2574(++_0x28a82a);}(_0x2715,0x152));var _0x5271=function(_0x516cbd,_0x36dcb5){_0x516cbd=_0x516cbd-0x0;var _0x1498c6=_0x2715[_0x516cbd];return _0x1498c6;};'use strict';var Sequelize=require(_0x5271('0x0'));module[_0x5271('0x1')]={'name':{'type':Sequelize[_0x5271('0x2')],'unique':_0x5271('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5271('0x2')]},'dialPrefix':{'type':Sequelize[_0x5271('0x2')]}}; \ No newline at end of file +var _0xd727=['exports','name','STRING'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xd727,0xff));var _0x7d72=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xd727[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require('sequelize');module[_0x7d72('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x7d72('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7d72('0x2')]},'dialPrefix':{'type':Sequelize[_0x7d72('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index d39f583..989ffc8 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 _0xc17d=['squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','sendStatus','end','status','count','offset','limit','set','json','apply','reject','save','update','destroy','then','Lists','stack','name','send','index','map','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','CmList','includeAll','findAll','rows','show','params','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','getDispositions','findOne','filter','removeDispositions','CmContact','tags','isArray','push','each','omit','ids','success','dataValues','message','Malformed\x20request\x20syntax','getContacts','CustomFields','rawAttributes','concat','format','raw','CmCustomField','isEmpty','writeFileSync','setHeader','Content-disposition','list_%d_%s.csv','text/csv','download','/tmp/list_%d_%s.csv','sequelize','addCustomFields','Sequelize','TEXT','number','INTEGER','BOOLEAN','defaultValue','queryInterface','cm_contacts','cf_%s','getCustomFields','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash'];(function(_0x25e7de,_0x24b676){var _0x5cd6b8=function(_0x38526c){while(--_0x38526c){_0x25e7de['push'](_0x25e7de['shift']());}};_0x5cd6b8(++_0x24b676);}(_0xc17d,0x83));var _0xdc17=function(_0x5d39e9,_0x4c7216){_0x5d39e9=_0x5d39e9-0x0;var _0x3e6c81=_0xc17d[_0x5d39e9];return _0x3e6c81;};'use strict';var pdf=require(_0xdc17('0x0'));var emlformat=require(_0xdc17('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xdc17('0x2'));var jsonpatch=require(_0xdc17('0x3'));var rp=require(_0xdc17('0x4'));var moment=require(_0xdc17('0x5'));var BPromise=require(_0xdc17('0x6'));var Mustache=require(_0xdc17('0x7'));var util=require('util');var path=require(_0xdc17('0x8'));var sox=require(_0xdc17('0x9'));var csv=require('to-csv');var ejs=require(_0xdc17('0xa'));var fs=require('fs');var _=require(_0xdc17('0xb'));var squel=require(_0xdc17('0xc'));var crypto=require(_0xdc17('0xd'));var jsforce=require(_0xdc17('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdc17('0xf'));var Papa=require(_0xdc17('0x10'));var Redis=require(_0xdc17('0x11'));var authService=require(_0xdc17('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xdc17('0x13'));var hardwareService=require(_0xdc17('0x14'));var logger=require(_0xdc17('0x15'))('api');var utils=require(_0xdc17('0x16'));var config=require(_0xdc17('0x17'));var db=require(_0xdc17('0x18'))['db'];config[_0xdc17('0x19')]=_[_0xdc17('0x1a')](config[_0xdc17('0x19')],{'host':_0xdc17('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xdc17('0x1c'))[_0xdc17('0x1d')](socket);function respondWithStatusCode(_0x156bd0,_0x534f32){_0x534f32=_0x534f32||0xcc;return function(_0xf0bef9){if(_0xf0bef9){return _0x156bd0[_0xdc17('0x1e')](_0x534f32);}return _0x156bd0['status'](_0x534f32)[_0xdc17('0x1f')]();};}function respondWithResult(_0x4edf23,_0x49e214){_0x49e214=_0x49e214||0xc8;return function(_0x1a1c93){if(_0x1a1c93){return _0x4edf23[_0xdc17('0x20')](_0x49e214)['json'](_0x1a1c93);}};}function respondWithFilteredResult(_0x58b9bb,_0x4bf5c0){return function(_0x28561e){if(_0x28561e){var _0xfd192d=_0x28561e[_0xdc17('0x21')],_0x81ed6b=_0x4bf5c0[_0xdc17('0x22')],_0x341609=_0x4bf5c0[_0xdc17('0x22')]+_0x4bf5c0[_0xdc17('0x23')],_0x182140;if(_0x341609>=_0xfd192d){_0x341609=_0xfd192d;_0x182140=0xc8;}else{_0x182140=0xce;}_0x58b9bb[_0xdc17('0x20')](_0x182140);return _0x58b9bb[_0xdc17('0x24')]('Content-Range',_0x81ed6b+'-'+_0x341609+'/'+_0xfd192d)[_0xdc17('0x25')](_0x28561e);}return null;};}function patchUpdates(_0x56c399){return function(_0x5dc4f6){try{jsonpatch[_0xdc17('0x26')](_0x5dc4f6,_0x56c399,!![]);}catch(_0x548fc7){return BPromise[_0xdc17('0x27')](_0x548fc7);}return _0x5dc4f6[_0xdc17('0x28')]();};}function saveUpdates(_0x253913,_0x490ddf){return function(_0x407cdd){if(_0x407cdd){return _0x407cdd[_0xdc17('0x29')](_0x253913)['then'](function(_0xef2663){return _0xef2663;});}return null;};}function removeEntity(_0x43f12d,_0x1a0474){return function(_0xc8594b){if(_0xc8594b){return _0xc8594b[_0xdc17('0x2a')]()[_0xdc17('0x2b')](function(){var _0x522895=_0xc8594b['get']({'plain':!![]});var _0x3a96bb=_0xdc17('0x2c');return db['UserProfileResource'][_0xdc17('0x2a')]({'where':{'type':_0x3a96bb,'resourceId':_0x522895['id']}})[_0xdc17('0x2b')](function(){return _0xc8594b;});})[_0xdc17('0x2b')](function(){_0x43f12d['status'](0xcc)[_0xdc17('0x1f')]();});}};}function handleEntityNotFound(_0x503d9c,_0x36a8b4){return function(_0x391108){if(!_0x391108){_0x503d9c['sendStatus'](0x194);}return _0x391108;};}function handleError(_0xf60cf5,_0x567af0){_0x567af0=_0x567af0||0x1f4;return function(_0x2a80b1){logger['error'](_0x2a80b1[_0xdc17('0x2d')]);if(_0x2a80b1[_0xdc17('0x2e')]){delete _0x2a80b1[_0xdc17('0x2e')];}_0xf60cf5['status'](_0x567af0)[_0xdc17('0x2f')](_0x2a80b1);};}exports[_0xdc17('0x30')]=function(_0x518065,_0x25f1f7){var _0x10b21a={},_0x1853f0={},_0x515825={'count':0x0,'rows':[]};var _0x2c1407=_[_0xdc17('0x31')](db['CmList']['rawAttributes'],function(_0x1a596c){return{'name':_0x1a596c[_0xdc17('0x32')],'type':_0x1a596c[_0xdc17('0x33')]['key']};});_0x1853f0['model']=_['map'](_0x2c1407,'name');_0x1853f0[_0xdc17('0x34')]=_[_0xdc17('0x35')](_0x518065[_0xdc17('0x34')]);_0x1853f0[_0xdc17('0x36')]=_[_0xdc17('0x37')](_0x1853f0[_0xdc17('0x38')],_0x1853f0[_0xdc17('0x34')]);_0x10b21a[_0xdc17('0x39')]=_[_0xdc17('0x37')](_0x1853f0['model'],qs[_0xdc17('0x3a')](_0x518065[_0xdc17('0x34')][_0xdc17('0x3a')]));_0x10b21a[_0xdc17('0x39')]=_0x10b21a['attributes'][_0xdc17('0x3b')]?_0x10b21a['attributes']:_0x1853f0[_0xdc17('0x38')];if(!_0x518065[_0xdc17('0x34')][_0xdc17('0x3c')](_0xdc17('0x3d'))){_0x10b21a[_0xdc17('0x23')]=qs[_0xdc17('0x23')](_0x518065[_0xdc17('0x34')][_0xdc17('0x23')]);_0x10b21a[_0xdc17('0x22')]=qs[_0xdc17('0x22')](_0x518065[_0xdc17('0x34')][_0xdc17('0x22')]);}_0x10b21a[_0xdc17('0x3e')]=qs[_0xdc17('0x3f')](_0x518065[_0xdc17('0x34')]['sort']);_0x10b21a[_0xdc17('0x40')]=qs[_0xdc17('0x36')](_[_0xdc17('0x41')](_0x518065[_0xdc17('0x34')],_0x1853f0[_0xdc17('0x36')]),_0x2c1407);if(_0x518065[_0xdc17('0x34')]['filter']){_0x10b21a[_0xdc17('0x40')]=_[_0xdc17('0x42')](_0x10b21a[_0xdc17('0x40')],{'$or':_[_0xdc17('0x31')](_0x2c1407,function(_0x23cc7d){if(_0x23cc7d[_0xdc17('0x33')]!==_0xdc17('0x43')){var _0x3b9a95={};_0x3b9a95[_0x23cc7d['name']]={'$like':'%'+_0x518065['query']['filter']+'%'};return _0x3b9a95;}})});}_0x10b21a=_[_0xdc17('0x42')]({},_0x10b21a,_0x518065[_0xdc17('0x44')]);var _0x315200={'where':_0x10b21a[_0xdc17('0x40')]};return db[_0xdc17('0x45')]['count'](_0x315200)[_0xdc17('0x2b')](function(_0x3dd67b){_0x515825['count']=_0x3dd67b;if(_0x518065['query'][_0xdc17('0x46')]){_0x10b21a['include']=[{'all':!![]}];}return db[_0xdc17('0x45')][_0xdc17('0x47')](_0x10b21a);})[_0xdc17('0x2b')](function(_0x5867cb){_0x515825[_0xdc17('0x48')]=_0x5867cb;return _0x515825;})[_0xdc17('0x2b')](respondWithFilteredResult(_0x25f1f7,_0x10b21a))['catch'](handleError(_0x25f1f7,null));};exports[_0xdc17('0x49')]=function(_0x1b1bc5,_0xa08c58){var _0x5714c7={'raw':![],'where':{'id':_0x1b1bc5[_0xdc17('0x4a')]['id']}},_0x1bf85f={};_0x1bf85f[_0xdc17('0x38')]=_[_0xdc17('0x35')](db[_0xdc17('0x45')]['rawAttributes']);_0x1bf85f['query']=_[_0xdc17('0x35')](_0x1b1bc5['query']);_0x1bf85f[_0xdc17('0x36')]=_[_0xdc17('0x37')](_0x1bf85f[_0xdc17('0x38')],_0x1bf85f[_0xdc17('0x34')]);_0x5714c7[_0xdc17('0x39')]=_[_0xdc17('0x37')](_0x1bf85f[_0xdc17('0x38')],qs['fields'](_0x1b1bc5[_0xdc17('0x34')]['fields']));_0x5714c7[_0xdc17('0x39')]=_0x5714c7[_0xdc17('0x39')]['length']?_0x5714c7[_0xdc17('0x39')]:_0x1bf85f[_0xdc17('0x38')];if(_0x1b1bc5['query'][_0xdc17('0x46')]){_0x5714c7[_0xdc17('0x4b')]=[{'all':!![]}];}_0x5714c7=_[_0xdc17('0x42')]({},_0x5714c7,_0x1b1bc5['options']);return db[_0xdc17('0x45')][_0xdc17('0x4c')](_0x5714c7)[_0xdc17('0x2b')](handleEntityNotFound(_0xa08c58,null))[_0xdc17('0x2b')](respondWithResult(_0xa08c58,null))['catch'](handleError(_0xa08c58,null));};exports[_0xdc17('0x4d')]=function(_0x5abd7d,_0x19468c){return db[_0xdc17('0x45')][_0xdc17('0x4d')](_0x5abd7d[_0xdc17('0x4e')],{})[_0xdc17('0x2b')](function(_0x2a09b4){var _0x458a47=_0x5abd7d[_0xdc17('0x4f')][_0xdc17('0x50')]({'plain':!![]});if(!_0x458a47)throw new Error(_0xdc17('0x51'));if(_0x458a47[_0xdc17('0x52')]==='user'){var _0x2ffcb8=_0x2a09b4['get']({'plain':!![]});var _0x53a2ba=_0xdc17('0x2c');return db[_0xdc17('0x53')][_0xdc17('0x4c')]({'where':{'name':_0x53a2ba,'userProfileId':_0x458a47[_0xdc17('0x54')]},'raw':!![]})[_0xdc17('0x2b')](function(_0x5cd7b6){if(_0x5cd7b6&&_0x5cd7b6[_0xdc17('0x55')]===0x0){return db[_0xdc17('0x56')][_0xdc17('0x4d')]({'name':_0x2ffcb8['name'],'resourceId':_0x2ffcb8['id'],'type':_0x5cd7b6[_0xdc17('0x2e')],'sectionId':_0x5cd7b6['id']},{})[_0xdc17('0x2b')](function(){return _0x2a09b4;});}else{return _0x2a09b4;}})[_0xdc17('0x57')](function(_0x297c82){logger[_0xdc17('0x58')](_0xdc17('0x59'),_0x297c82);throw _0x297c82;});}return _0x2a09b4;})[_0xdc17('0x2b')](respondWithResult(_0x19468c,0xc9))[_0xdc17('0x57')](handleError(_0x19468c,null));};exports[_0xdc17('0x29')]=function(_0xbb2ffe,_0x54dc9d){if(_0xbb2ffe[_0xdc17('0x4e')]['id']){delete _0xbb2ffe['body']['id'];}return db[_0xdc17('0x45')][_0xdc17('0x4c')]({'where':{'id':_0xbb2ffe['params']['id']}})[_0xdc17('0x2b')](handleEntityNotFound(_0x54dc9d,null))['then'](saveUpdates(_0xbb2ffe[_0xdc17('0x4e')],null))['then'](respondWithResult(_0x54dc9d,null))[_0xdc17('0x57')](handleError(_0x54dc9d,null));};exports['destroy']=function(_0x56ba96,_0x2ca421){return db[_0xdc17('0x45')][_0xdc17('0x4c')]({'where':{'id':_0x56ba96['params']['id']}})[_0xdc17('0x2b')](handleEntityNotFound(_0x2ca421,null))['then'](removeEntity(_0x2ca421,null))[_0xdc17('0x57')](handleError(_0x2ca421,null));};exports['describe']=function(_0x4d8ed1,_0x48b952){return db['CmList'][_0xdc17('0x5a')]()['then'](respondWithResult(_0x48b952,null))['catch'](handleError(_0x48b952,null));};exports[_0xdc17('0x5b')]=function(_0x7ac4f1,_0x2b4fa2,_0x18518a){if(_0x7ac4f1[_0xdc17('0x4e')]['id']){delete _0x7ac4f1['body']['id'];}return db[_0xdc17('0x45')][_0xdc17('0x4c')]({'where':{'id':_0x7ac4f1['params']['id']}})['then'](handleEntityNotFound(_0x2b4fa2,null))[_0xdc17('0x2b')](function(_0x21e7dc){if(_0x21e7dc){_0x7ac4f1[_0xdc17('0x4e')][_0xdc17('0x5c')]=_0x21e7dc['id'];return db[_0xdc17('0x5d')]['create'](_0x7ac4f1['body']);}})[_0xdc17('0x2b')](respondWithResult(_0x2b4fa2,null))[_0xdc17('0x57')](handleError(_0x2b4fa2,null));};exports[_0xdc17('0x5e')]=function(_0x2e3e4c,_0x3d25e9,_0x4cf64c){var _0x59ddc4={'raw':![],'where':{}};var _0x2e5049={};var _0x4202ee={'count':0x0,'rows':[]};return db['CmList'][_0xdc17('0x5f')]({'where':{'id':_0x2e3e4c[_0xdc17('0x4a')]['id']}})[_0xdc17('0x2b')](handleEntityNotFound(_0x3d25e9,null))['then'](function(_0x29406b){if(_0x29406b){_0x2e5049[_0xdc17('0x38')]=_[_0xdc17('0x35')](db['Disposition']['rawAttributes']);_0x2e5049[_0xdc17('0x34')]=_[_0xdc17('0x35')](_0x2e3e4c[_0xdc17('0x34')]);_0x2e5049[_0xdc17('0x36')]=_['intersection'](_0x2e5049[_0xdc17('0x38')],_0x2e5049[_0xdc17('0x34')]);_0x59ddc4[_0xdc17('0x39')]=_[_0xdc17('0x37')](_0x2e5049['model'],qs[_0xdc17('0x3a')](_0x2e3e4c['query'][_0xdc17('0x3a')]));_0x59ddc4[_0xdc17('0x39')]=_0x59ddc4[_0xdc17('0x39')][_0xdc17('0x3b')]?_0x59ddc4[_0xdc17('0x39')]:_0x2e5049[_0xdc17('0x38')];if(!_0x2e3e4c['query'][_0xdc17('0x3c')](_0xdc17('0x3d'))){_0x59ddc4[_0xdc17('0x23')]=qs[_0xdc17('0x23')](_0x2e3e4c[_0xdc17('0x34')][_0xdc17('0x23')]);_0x59ddc4['offset']=qs[_0xdc17('0x22')](_0x2e3e4c[_0xdc17('0x34')][_0xdc17('0x22')]);}_0x59ddc4['order']=qs[_0xdc17('0x3f')](_0x2e3e4c[_0xdc17('0x34')][_0xdc17('0x3f')]);_0x59ddc4[_0xdc17('0x40')]=qs[_0xdc17('0x36')](_[_0xdc17('0x41')](_0x2e3e4c[_0xdc17('0x34')],_0x2e5049[_0xdc17('0x36')]));_0x59ddc4[_0xdc17('0x40')][_0xdc17('0x5c')]=_0x29406b['id'];if(_0x2e3e4c[_0xdc17('0x34')]['filter']){_0x59ddc4[_0xdc17('0x40')]=_[_0xdc17('0x42')](_0x59ddc4[_0xdc17('0x40')],{'$or':_[_0xdc17('0x31')](_0x59ddc4[_0xdc17('0x39')],function(_0x2733bb){var _0x397452={};_0x397452[_0x2733bb]={'$like':'%'+_0x2e3e4c[_0xdc17('0x34')][_0xdc17('0x60')]+'%'};return _0x397452;})});}_0x59ddc4=_[_0xdc17('0x42')]({},_0x59ddc4,_0x2e3e4c[_0xdc17('0x44')]);return db['Disposition']['count']({'where':_0x59ddc4['where']})[_0xdc17('0x2b')](function(_0x520291){_0x4202ee['count']=_0x520291;if(_0x2e3e4c[_0xdc17('0x34')][_0xdc17('0x46')]){_0x59ddc4['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x59ddc4);})[_0xdc17('0x2b')](function(_0x57e2ea){_0x4202ee[_0xdc17('0x48')]=_0x57e2ea;return _0x4202ee;});}})['then'](respondWithFilteredResult(_0x3d25e9,_0x59ddc4))['catch'](handleError(_0x3d25e9,null));};exports[_0xdc17('0x61')]=function(_0x5d614f,_0x593ecd,_0xd99fc1){return db[_0xdc17('0x45')][_0xdc17('0x4c')]({'where':{'id':_0x5d614f['params']['id']}})[_0xdc17('0x2b')](handleEntityNotFound(_0x593ecd,null))[_0xdc17('0x2b')](function(_0x4a7363){if(_0x4a7363){return _0x4a7363[_0xdc17('0x61')](_0x5d614f['query']['ids']);}})[_0xdc17('0x2b')](respondWithStatusCode(_0x593ecd,null))[_0xdc17('0x57')](handleError(_0x593ecd,null));};exports['addContacts']=function(_0x19f38a,_0x4d5bcf,_0x17490c){return db[_0xdc17('0x45')][_0xdc17('0x4c')]({'where':{'id':_0x19f38a[_0xdc17('0x4a')]['id']}})[_0xdc17('0x2b')](handleEntityNotFound(_0x4d5bcf,null))[_0xdc17('0x2b')](function(_0x3042f3){if(_0x3042f3){var _0x4b801f=[];var _0x56efe9={'success':[],'errors':[]};return db[_0xdc17('0x62')][_0xdc17('0x5a')]()['then'](function(_0x48e220){if(_0x19f38a['body'][_0xdc17('0x63')]&&_['isArray'](_0x19f38a[_0xdc17('0x4e')][_0xdc17('0x63')])){if(_0x19f38a[_0xdc17('0x4e')]['tags'][_0xdc17('0x3b')]){_0x19f38a[_0xdc17('0x4e')][_0xdc17('0x63')]=_0x19f38a[_0xdc17('0x4e')][_0xdc17('0x63')]['join'](';')+';';}else{_0x19f38a['body']['tags']=null;}}else{_0x19f38a['body'][_0xdc17('0x63')]=null;}if(_0x19f38a[_0xdc17('0x4e')]&&_[_0xdc17('0x64')](_0x19f38a[_0xdc17('0x4e')])){for(var _0x7d0c29=0x0;_0x7d0c29<_0x19f38a[_0xdc17('0x4e')]['length'];_0x7d0c29+=0x1){_0x19f38a[_0xdc17('0x4e')][_0x7d0c29][_0xdc17('0x5c')]=_0x19f38a[_0xdc17('0x4a')]['id'];_0x4b801f[_0xdc17('0x65')](_0x19f38a[_0xdc17('0x4e')][_0x7d0c29]);}return BPromise[_0xdc17('0x66')](_0x4b801f,function(_0x21252b){return db['CmContact'][_0xdc17('0x4d')](_[_0xdc17('0x67')](_0x21252b,[_0xdc17('0x68'),'id'])||{},{'fields':_[_0xdc17('0x35')](_0x48e220),'raw':!![]})[_0xdc17('0x2b')](function(_0x3e2fd1){_0x56efe9[_0xdc17('0x69')][_0xdc17('0x65')](_0x3e2fd1[_0xdc17('0x6a')]);})[_0xdc17('0x57')](function(_0x7d07fe){_0x56efe9['errors']['push']({'data':_0x21252b,'error':_0x7d07fe[_0xdc17('0x6b')]});});})[_0xdc17('0x2b')](function(_0x534df7){return _0x56efe9;})['catch'](function(_0x3b3733){return _0x3b3733;});}else{_0x4d5bcf[_0xdc17('0x20')](0x190)['json']({'message':_0xdc17('0x6c')});}});}})[_0xdc17('0x2b')](respondWithResult(_0x4d5bcf,null))[_0xdc17('0x57')](handleError(_0x4d5bcf,null));};exports[_0xdc17('0x6d')]=function(_0x43e076,_0x483914,_0x1680c3){var _0x30febf;return db[_0xdc17('0x45')][_0xdc17('0x4c')]({'where':{'id':_0x43e076[_0xdc17('0x4a')]['id']},'include':[{'model':db['CmCustomField'],'as':_0xdc17('0x6e')}]})[_0xdc17('0x2b')](handleEntityNotFound(_0x483914,null))[_0xdc17('0x2b')](function(_0x249713){if(_0x249713){_0x30febf=_0x249713;return db[_0xdc17('0x62')][_0xdc17('0x6f')];}})[_0xdc17('0x2b')](function(_0x45ea5a){if(_0x45ea5a){var _0x1b6918={};var _0x5bb1a9={};_0x5bb1a9[_0xdc17('0x38')]=_[_0xdc17('0x70')](_['keys'](_0x45ea5a),_['map'](_0x30febf[_0xdc17('0x6e')],function(_0x425f51){return util[_0xdc17('0x71')]('cf_%d',_0x425f51['id']);}));_0x5bb1a9['query']=_['keys'](_0x43e076['query']);_0x5bb1a9['filters']=_[_0xdc17('0x37')](_0x5bb1a9[_0xdc17('0x38')],_0x5bb1a9[_0xdc17('0x34')]);_0x1b6918[_0xdc17('0x39')]=_[_0xdc17('0x37')](_0x5bb1a9[_0xdc17('0x38')],qs[_0xdc17('0x3a')](_0x43e076[_0xdc17('0x34')][_0xdc17('0x3a')]));_0x1b6918[_0xdc17('0x39')]=_0x1b6918[_0xdc17('0x39')]['length']?_0x1b6918[_0xdc17('0x39')]:_0x5bb1a9[_0xdc17('0x38')];if(!_0x43e076[_0xdc17('0x34')][_0xdc17('0x3c')](_0xdc17('0x3d'))){_0x1b6918[_0xdc17('0x23')]=qs[_0xdc17('0x23')](_0x43e076[_0xdc17('0x34')][_0xdc17('0x23')]);_0x1b6918[_0xdc17('0x22')]=qs['offset'](_0x43e076[_0xdc17('0x34')]['offset']);}_0x1b6918[_0xdc17('0x3e')]=qs['sort'](_0x43e076['query'][_0xdc17('0x3f')]);_0x1b6918[_0xdc17('0x40')]=qs[_0xdc17('0x36')](_[_0xdc17('0x41')](_0x43e076[_0xdc17('0x34')],_0x5bb1a9[_0xdc17('0x36')]));_0x1b6918[_0xdc17('0x72')]=!![];if(_0x43e076['query']['filter']){_0x1b6918[_0xdc17('0x40')]=_[_0xdc17('0x42')](_0x1b6918[_0xdc17('0x40')],{'$or':_['map'](_0x1b6918[_0xdc17('0x39')],function(_0x4f3f2e){var _0x2c1d5d={};_0x2c1d5d[_0x4f3f2e]={'$like':'%'+_0x43e076[_0xdc17('0x34')][_0xdc17('0x60')]+'%'};return _0x2c1d5d;})});}_0x1b6918=_['merge']({},_0x1b6918,_0x43e076[_0xdc17('0x44')]);return _0x30febf[_0xdc17('0x6d')](_0x1b6918);}})['then'](respondWithResult(_0x483914,null))['catch'](handleError(_0x483914,null));};exports['getContactsCsv']=function(_0x21044a,_0x6e0795,_0x53d392){var _0x4e32bd;return db[_0xdc17('0x45')][_0xdc17('0x4c')]({'where':{'id':_0x21044a['params']['id']},'include':[{'model':db[_0xdc17('0x73')],'as':'CustomFields'}]})[_0xdc17('0x2b')](handleEntityNotFound(_0x6e0795,null))[_0xdc17('0x2b')](function(_0x1df317){if(_0x1df317){_0x4e32bd=_0x1df317;return db['CmContact'][_0xdc17('0x6f')];}})[_0xdc17('0x2b')](function(_0x50e7e8){if(_0x50e7e8){var _0x4a8a6b={};var _0x1ed294={};_0x1ed294[_0xdc17('0x38')]=_[_0xdc17('0x70')](_[_0xdc17('0x35')](_0x50e7e8),_[_0xdc17('0x31')](_0x4e32bd[_0xdc17('0x6e')],function(_0x2df9d8){return util[_0xdc17('0x71')]('cf_%d',_0x2df9d8['id']);}));_0x1ed294[_0xdc17('0x34')]=_[_0xdc17('0x35')](_0x21044a[_0xdc17('0x34')]);_0x1ed294[_0xdc17('0x36')]=_[_0xdc17('0x37')](_0x1ed294['model'],_0x1ed294['query']);_0x4a8a6b[_0xdc17('0x39')]=_[_0xdc17('0x37')](_0x1ed294[_0xdc17('0x38')],qs[_0xdc17('0x3a')](_0x21044a['query'][_0xdc17('0x3a')]));_0x4a8a6b['attributes']=_0x4a8a6b[_0xdc17('0x39')][_0xdc17('0x3b')]?_0x4a8a6b['attributes']:_0x1ed294['model'];if(!_0x21044a[_0xdc17('0x34')][_0xdc17('0x3c')](_0xdc17('0x3d'))){_0x4a8a6b[_0xdc17('0x23')]=qs['limit'](_0x21044a['query'][_0xdc17('0x23')]);_0x4a8a6b[_0xdc17('0x22')]=qs[_0xdc17('0x22')](_0x21044a[_0xdc17('0x34')][_0xdc17('0x22')]);}_0x4a8a6b['order']=qs[_0xdc17('0x3f')](_0x21044a['query'][_0xdc17('0x3f')]);_0x4a8a6b[_0xdc17('0x40')]=qs['filters'](_[_0xdc17('0x41')](_0x21044a['query'],_0x1ed294[_0xdc17('0x36')]));_0x4a8a6b[_0xdc17('0x72')]=!![];if(_0x21044a[_0xdc17('0x34')][_0xdc17('0x60')]){_0x4a8a6b[_0xdc17('0x40')]=_[_0xdc17('0x42')](_0x4a8a6b[_0xdc17('0x40')],{'$or':_['map'](_0x4a8a6b['attributes'],function(_0x2868a6){var _0x2ee830={};_0x2ee830[_0x2868a6]={'$like':'%'+_0x21044a[_0xdc17('0x34')]['filter']+'%'};return _0x2ee830;})});}_0x4a8a6b=_[_0xdc17('0x42')]({},_0x4a8a6b,_0x21044a[_0xdc17('0x44')]);return _0x4e32bd['getContacts'](_0x4a8a6b);}})[_0xdc17('0x2b')](function(_0x2d3897){if(!_[_0xdc17('0x74')](_0x2d3897)){var _0x3631ae=toCsv(_0x2d3897);var _0x1eeef2=Date['now']();fs[_0xdc17('0x75')](util[_0xdc17('0x71')]('/tmp/list_%d_%s.csv',_0x4e32bd['id'],_0x1eeef2),_0x3631ae);_0x6e0795[_0xdc17('0x76')](_0xdc17('0x77'),'attachment;\x20filename='+util[_0xdc17('0x71')](_0xdc17('0x78'),_0x4e32bd['id'],_0x1eeef2));_0x6e0795[_0xdc17('0x76')]('Content-type',_0xdc17('0x79'));return _0x6e0795[_0xdc17('0x7a')](util[_0xdc17('0x71')](_0xdc17('0x7b'),_0x4e32bd['id'],_0x1eeef2));}else{return _0x6e0795[_0xdc17('0x1e')](0xcc);}})[_0xdc17('0x57')](handleError(_0x6e0795,null));};exports['addCustomField']=function(_0x49bf20,_0x1c2b74,_0x24fb19){var _0x4fabd4;delete _0x49bf20[_0xdc17('0x4e')]['id'];return db['CmList'][_0xdc17('0x5f')]({'where':{'id':_0x49bf20['params']['id']}})['then'](handleEntityNotFound(_0x1c2b74,null))[_0xdc17('0x2b')](function(_0x414e40){if(_0x414e40){return db[_0xdc17('0x7c')]['transaction'](function(_0x592b82){return db['CmCustomField'][_0xdc17('0x4d')](_0x49bf20[_0xdc17('0x4e')],{'transaction':_0x592b82})[_0xdc17('0x2b')](function(_0x5f037d){_0x4fabd4=_0x5f037d;return _0x414e40[_0xdc17('0x7d')](_0x5f037d,{'transaction':_0x592b82});})['then'](function(){var _0x3f6507={'type':db[_0xdc17('0x7e')]['TEXT'],'transaction':_0x592b82};switch(_0x49bf20[_0xdc17('0x4e')][_0xdc17('0x33')]){case'text':_0x3f6507[_0xdc17('0x33')]=db['Sequelize'][_0xdc17('0x7f')];break;case _0xdc17('0x80'):_0x3f6507[_0xdc17('0x33')]=db['Sequelize'][_0xdc17('0x81')];break;case'switch':_0x3f6507[_0xdc17('0x33')]=db[_0xdc17('0x7e')][_0xdc17('0x82')];_0x3f6507[_0xdc17('0x83')]=![];break;default:}return db['sequelize'][_0xdc17('0x84')]['addColumn'](_0xdc17('0x85'),util[_0xdc17('0x71')](_0xdc17('0x86'),_0x4fabd4['id']),_0x3f6507);})[_0xdc17('0x2b')](function(){return _0x4fabd4;});});}})[_0xdc17('0x2b')](respondWithResult(_0x1c2b74,null))['catch'](handleError(_0x1c2b74,null));};exports[_0xdc17('0x87')]=function(_0x5d674e,_0x582e88,_0x490fcd){var _0x56ce33={};var _0x1ecf19={};var _0x5ce9a6;var _0x4b7803;return db[_0xdc17('0x45')][_0xdc17('0x5f')]({'where':{'id':_0x5d674e[_0xdc17('0x4a')]['id']}})[_0xdc17('0x2b')](handleEntityNotFound(_0x582e88,null))['then'](function(_0x4f4d37){if(_0x4f4d37){_0x5ce9a6=_0x4f4d37;_0x1ecf19[_0xdc17('0x38')]=_['keys'](db[_0xdc17('0x73')]['rawAttributes']);_0x1ecf19[_0xdc17('0x34')]=_[_0xdc17('0x35')](_0x5d674e[_0xdc17('0x34')]);_0x1ecf19[_0xdc17('0x36')]=_['intersection'](_0x1ecf19['model'],_0x1ecf19['query']);_0x56ce33[_0xdc17('0x39')]=_[_0xdc17('0x37')](_0x1ecf19[_0xdc17('0x38')],qs[_0xdc17('0x3a')](_0x5d674e[_0xdc17('0x34')][_0xdc17('0x3a')]));_0x56ce33['attributes']=_0x56ce33['attributes'][_0xdc17('0x3b')]?_0x56ce33[_0xdc17('0x39')]:_0x1ecf19[_0xdc17('0x38')];_0x56ce33[_0xdc17('0x3e')]=qs['sort'](_0x5d674e[_0xdc17('0x34')][_0xdc17('0x3f')]);_0x56ce33[_0xdc17('0x40')]=qs[_0xdc17('0x36')](_['pick'](_0x5d674e[_0xdc17('0x34')],_0x1ecf19[_0xdc17('0x36')]));_0x56ce33[_0xdc17('0x40')]=_[_0xdc17('0x42')](_0x56ce33[_0xdc17('0x40')],{'$or':[{'ListId':_0x4f4d37['id']},{'ListId':null}]});if(_0x5d674e[_0xdc17('0x34')]['filter']){_0x56ce33[_0xdc17('0x40')]=_[_0xdc17('0x42')](_0x56ce33['where'],{'$or':_[_0xdc17('0x31')](_0x56ce33[_0xdc17('0x39')],function(_0x3fcf8b){var _0x281c46={};_0x281c46[_0x3fcf8b]={'$like':'%'+_0x5d674e[_0xdc17('0x34')][_0xdc17('0x60')]+'%'};return _0x281c46;})});}_0x56ce33=_['merge']({},_0x56ce33,_0x5d674e[_0xdc17('0x44')]);return db[_0xdc17('0x73')]['findAndCountAll'](_0x56ce33);}})[_0xdc17('0x2b')](respondWithResult(_0x582e88,null))['catch'](handleError(_0x582e88,null));};exports['addAgents']=function(_0x245e07,_0x313c5c,_0x246b4f){return db[_0xdc17('0x45')][_0xdc17('0x4c')]({'where':{'id':_0x245e07[_0xdc17('0x4a')]['id']}})['then'](handleEntityNotFound(_0x313c5c,null))[_0xdc17('0x2b')](function(_0xf58efd){if(_0xf58efd){return _0xf58efd['addAgents'](_0x245e07[_0xdc17('0x4e')]['ids'],_[_0xdc17('0x67')](_0x245e07['body'],[_0xdc17('0x68'),'id'])||{})[_0xdc17('0x88')](function(_0xcfb3e8){for(var _0x3971f4=0x0;_0x3971f4<_0x245e07[_0xdc17('0x4e')][_0xdc17('0x68')][_0xdc17('0x3b')];_0x3971f4+=0x1){socket[_0xdc17('0x89')](_0xdc17('0x8a'),{'UserId':_0x245e07[_0xdc17('0x4e')][_0xdc17('0x68')][_0x3971f4],'CmListId':_0x245e07[_0xdc17('0x4a')]['id']});}return _0xcfb3e8;});}})[_0xdc17('0x2b')](respondWithResult(_0x313c5c,null))[_0xdc17('0x57')](handleError(_0x313c5c,null));};exports[_0xdc17('0x8b')]=function(_0x328e6e,_0x10df27,_0xcd3994){return db['CmList'][_0xdc17('0x4c')]({'where':{'id':_0x328e6e[_0xdc17('0x4a')]['id']}})[_0xdc17('0x2b')](handleEntityNotFound(_0x10df27,null))[_0xdc17('0x2b')](function(_0x237b37){if(_0x237b37){return _0x237b37['removeAgents'](_0x328e6e['query'][_0xdc17('0x68')])['then'](function(){if(_[_0xdc17('0x64')](_0x328e6e['query'][_0xdc17('0x68')])){for(var _0x1aaaef=0x0;_0x1aaaef<_0x328e6e[_0xdc17('0x34')]['ids'][_0xdc17('0x3b')];_0x1aaaef+=0x1){socket[_0xdc17('0x89')](_0xdc17('0x8c'),{'UserId':Number(_0x328e6e[_0xdc17('0x34')][_0xdc17('0x68')][_0x1aaaef]),'CmListId':Number(_0x328e6e['params']['id'])});}}else{socket[_0xdc17('0x89')](_0xdc17('0x8c'),{'UserId':Number(_0x328e6e[_0xdc17('0x34')][_0xdc17('0x68')]),'CmListId':Number(_0x328e6e[_0xdc17('0x4a')]['id'])});}});}})[_0xdc17('0x2b')](respondWithStatusCode(_0x10df27,null))[_0xdc17('0x57')](handleError(_0x10df27,null));};exports[_0xdc17('0x8d')]=function(_0x4eff9e,_0x32325a,_0xc9e854){var _0x42cc91={};var _0x4f8c91={};var _0x1598f;var _0x140fd0;return db[_0xdc17('0x45')][_0xdc17('0x5f')]({'where':{'id':_0x4eff9e[_0xdc17('0x4a')]['id']}})[_0xdc17('0x2b')](handleEntityNotFound(_0x32325a,null))['then'](function(_0x7e1a77){if(_0x7e1a77){_0x1598f=_0x7e1a77;_0x4f8c91[_0xdc17('0x38')]=_[_0xdc17('0x35')](db[_0xdc17('0x8e')][_0xdc17('0x6f')]);_0x4f8c91[_0xdc17('0x34')]=_[_0xdc17('0x35')](_0x4eff9e[_0xdc17('0x34')]);_0x4f8c91[_0xdc17('0x36')]=_[_0xdc17('0x37')](_0x4f8c91[_0xdc17('0x38')],_0x4f8c91[_0xdc17('0x34')]);_0x42cc91[_0xdc17('0x39')]=_[_0xdc17('0x37')](_0x4f8c91[_0xdc17('0x38')],qs[_0xdc17('0x3a')](_0x4eff9e['query'][_0xdc17('0x3a')]));_0x42cc91[_0xdc17('0x39')]=_0x42cc91[_0xdc17('0x39')]['length']?_0x42cc91['attributes']:_0x4f8c91[_0xdc17('0x38')];_0x42cc91[_0xdc17('0x3e')]=qs[_0xdc17('0x3f')](_0x4eff9e['query'][_0xdc17('0x3f')]);_0x42cc91['where']=qs['filters'](_[_0xdc17('0x41')](_0x4eff9e[_0xdc17('0x34')],_0x4f8c91[_0xdc17('0x36')]));if(_0x4eff9e[_0xdc17('0x34')]['filter']){_0x42cc91[_0xdc17('0x40')]=_[_0xdc17('0x42')](_0x42cc91['where'],{'$or':_[_0xdc17('0x31')](_0x42cc91[_0xdc17('0x39')],function(_0x2e518e){var _0xd70918={};_0xd70918[_0x2e518e]={'$like':'%'+_0x4eff9e[_0xdc17('0x34')][_0xdc17('0x60')]+'%'};return _0xd70918;})});}_0x42cc91=_[_0xdc17('0x42')]({},_0x42cc91,_0x4eff9e['options']);return _0x1598f[_0xdc17('0x8d')](_0x42cc91);}})[_0xdc17('0x2b')](function(_0x2bfcd4){if(_0x2bfcd4){_0x140fd0=_0x2bfcd4[_0xdc17('0x3b')];if(!_0x4eff9e[_0xdc17('0x34')][_0xdc17('0x3c')](_0xdc17('0x3d'))){_0x42cc91[_0xdc17('0x23')]=qs[_0xdc17('0x23')](_0x4eff9e['query'][_0xdc17('0x23')]);_0x42cc91[_0xdc17('0x22')]=qs['offset'](_0x4eff9e[_0xdc17('0x34')][_0xdc17('0x22')]);}return _0x1598f[_0xdc17('0x8d')](_0x42cc91);}})[_0xdc17('0x2b')](function(_0x23d106){if(_0x23d106){return _0x23d106?{'count':_0x140fd0,'rows':_0x23d106}:null;}})[_0xdc17('0x2b')](respondWithResult(_0x32325a,null))[_0xdc17('0x57')](handleError(_0x32325a,null));}; \ No newline at end of file +var _0x73b5=['hasOwnProperty','limit','sort','pick','filter','where','merge','VIRTUAL','options','include','rows','catch','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','ListId','findOne','Disposition','order','removeDispositions','ids','CmContact','tags','isArray','join','push','each','omit','dataValues','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','format','nolimit','raw','CmCustomField','cf_%d','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','download','/tmp/list_%d_%s.csv','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','INTEGER','switch','defaultValue','queryInterface','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','User','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','count','offset','Content-Range','apply','reject','save','update','then','destroy','get','Lists','UserProfileResource','name','index','CmList','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length'];(function(_0x2e6cec,_0x1ba5b2){var _0x21a4ed=function(_0x3703a3){while(--_0x3703a3){_0x2e6cec['push'](_0x2e6cec['shift']());}};_0x21a4ed(++_0x1ba5b2);}(_0x73b5,0xd7));var _0x573b=function(_0x405c97,_0x3a9aeb){_0x405c97=_0x405c97-0x0;var _0x4bba8f=_0x73b5[_0x405c97];return _0x4bba8f;};'use strict';var pdf=require(_0x573b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x573b('0x1'));var zipdir=require(_0x573b('0x2'));var jsonpatch=require(_0x573b('0x3'));var rp=require(_0x573b('0x4'));var moment=require(_0x573b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x573b('0x6'));var util=require(_0x573b('0x7'));var path=require(_0x573b('0x8'));var sox=require('sox');var csv=require(_0x573b('0x9'));var ejs=require(_0x573b('0xa'));var fs=require('fs');var _=require(_0x573b('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x573b('0xc'));var deskjs=require(_0x573b('0xd'));var toCsv=require(_0x573b('0x9'));var querystring=require(_0x573b('0xe'));var Papa=require(_0x573b('0xf'));var Redis=require('ioredis');var authService=require(_0x573b('0x10'));var qs=require(_0x573b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x573b('0x12'))(_0x573b('0x13'));var utils=require('../../config/utils');var config=require(_0x573b('0x14'));var db=require(_0x573b('0x15'))['db'];config[_0x573b('0x16')]=_['defaults'](config[_0x573b('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x573b('0x17'))(new Redis(config[_0x573b('0x16')]));require(_0x573b('0x18'))[_0x573b('0x19')](socket);function respondWithStatusCode(_0x5502e8,_0x4bdf59){_0x4bdf59=_0x4bdf59||0xcc;return function(_0x208f2b){if(_0x208f2b){return _0x5502e8[_0x573b('0x1a')](_0x4bdf59);}return _0x5502e8[_0x573b('0x1b')](_0x4bdf59)[_0x573b('0x1c')]();};}function respondWithResult(_0x247a01,_0x2b9a6d){_0x2b9a6d=_0x2b9a6d||0xc8;return function(_0x4ca0c4){if(_0x4ca0c4){return _0x247a01[_0x573b('0x1b')](_0x2b9a6d)['json'](_0x4ca0c4);}};}function respondWithFilteredResult(_0x4f817c,_0x19be42){return function(_0x207719){if(_0x207719){var _0x96b02e=_0x207719[_0x573b('0x1d')],_0x27c9d4=_0x19be42[_0x573b('0x1e')],_0x323111=_0x19be42[_0x573b('0x1e')]+_0x19be42['limit'],_0x3a3a8a;if(_0x323111>=_0x96b02e){_0x323111=_0x96b02e;_0x3a3a8a=0xc8;}else{_0x3a3a8a=0xce;}_0x4f817c[_0x573b('0x1b')](_0x3a3a8a);return _0x4f817c['set'](_0x573b('0x1f'),_0x27c9d4+'-'+_0x323111+'/'+_0x96b02e)['json'](_0x207719);}return null;};}function patchUpdates(_0x4ecf28){return function(_0x3c94fe){try{jsonpatch[_0x573b('0x20')](_0x3c94fe,_0x4ecf28,!![]);}catch(_0x225cb5){return BPromise[_0x573b('0x21')](_0x225cb5);}return _0x3c94fe[_0x573b('0x22')]();};}function saveUpdates(_0x54549,_0x30e7c3){return function(_0x169608){if(_0x169608){return _0x169608[_0x573b('0x23')](_0x54549)[_0x573b('0x24')](function(_0x494623){return _0x494623;});}return null;};}function removeEntity(_0x2ba95a,_0x337f0a){return function(_0x1a8959){if(_0x1a8959){return _0x1a8959[_0x573b('0x25')]()[_0x573b('0x24')](function(){var _0x38afe7=_0x1a8959[_0x573b('0x26')]({'plain':!![]});var _0xc71efe=_0x573b('0x27');return db[_0x573b('0x28')][_0x573b('0x25')]({'where':{'type':_0xc71efe,'resourceId':_0x38afe7['id']}})[_0x573b('0x24')](function(){return _0x1a8959;});})[_0x573b('0x24')](function(){_0x2ba95a[_0x573b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbcfee3,_0xbb7c6){return function(_0x4fb0cc){if(!_0x4fb0cc){_0xbcfee3[_0x573b('0x1a')](0x194);}return _0x4fb0cc;};}function handleError(_0x163dc5,_0x7c5739){_0x7c5739=_0x7c5739||0x1f4;return function(_0x2ed5b1){logger['error'](_0x2ed5b1['stack']);if(_0x2ed5b1[_0x573b('0x29')]){delete _0x2ed5b1[_0x573b('0x29')];}_0x163dc5[_0x573b('0x1b')](_0x7c5739)['send'](_0x2ed5b1);};}exports[_0x573b('0x2a')]=function(_0x21e7f9,_0x3c0d68){var _0x5842a3={},_0x54ffd0={},_0x379186={'count':0x0,'rows':[]};var _0x5968f1=_['map'](db[_0x573b('0x2b')][_0x573b('0x2c')],function(_0x13844c){return{'name':_0x13844c[_0x573b('0x2d')],'type':_0x13844c[_0x573b('0x2e')][_0x573b('0x2f')]};});_0x54ffd0['model']=_[_0x573b('0x30')](_0x5968f1,_0x573b('0x29'));_0x54ffd0[_0x573b('0x31')]=_[_0x573b('0x32')](_0x21e7f9['query']);_0x54ffd0[_0x573b('0x33')]=_[_0x573b('0x34')](_0x54ffd0[_0x573b('0x35')],_0x54ffd0[_0x573b('0x31')]);_0x5842a3['attributes']=_[_0x573b('0x34')](_0x54ffd0[_0x573b('0x35')],qs[_0x573b('0x36')](_0x21e7f9['query'][_0x573b('0x36')]));_0x5842a3[_0x573b('0x37')]=_0x5842a3[_0x573b('0x37')][_0x573b('0x38')]?_0x5842a3['attributes']:_0x54ffd0[_0x573b('0x35')];if(!_0x21e7f9['query'][_0x573b('0x39')]('nolimit')){_0x5842a3[_0x573b('0x3a')]=qs[_0x573b('0x3a')](_0x21e7f9['query'][_0x573b('0x3a')]);_0x5842a3[_0x573b('0x1e')]=qs[_0x573b('0x1e')](_0x21e7f9['query'][_0x573b('0x1e')]);}_0x5842a3['order']=qs[_0x573b('0x3b')](_0x21e7f9[_0x573b('0x31')]['sort']);_0x5842a3['where']=qs[_0x573b('0x33')](_[_0x573b('0x3c')](_0x21e7f9[_0x573b('0x31')],_0x54ffd0[_0x573b('0x33')]),_0x5968f1);if(_0x21e7f9[_0x573b('0x31')][_0x573b('0x3d')]){_0x5842a3[_0x573b('0x3e')]=_[_0x573b('0x3f')](_0x5842a3[_0x573b('0x3e')],{'$or':_[_0x573b('0x30')](_0x5968f1,function(_0x346971){if(_0x346971['type']!==_0x573b('0x40')){var _0x5dc0e8={};_0x5dc0e8[_0x346971[_0x573b('0x29')]]={'$like':'%'+_0x21e7f9[_0x573b('0x31')]['filter']+'%'};return _0x5dc0e8;}})});}_0x5842a3=_['merge']({},_0x5842a3,_0x21e7f9[_0x573b('0x41')]);var _0x5f5356={'where':_0x5842a3[_0x573b('0x3e')]};return db['CmList'][_0x573b('0x1d')](_0x5f5356)[_0x573b('0x24')](function(_0x20bb2f){_0x379186[_0x573b('0x1d')]=_0x20bb2f;if(_0x21e7f9['query']['includeAll']){_0x5842a3[_0x573b('0x42')]=[{'all':!![]}];}return db['CmList']['findAll'](_0x5842a3);})[_0x573b('0x24')](function(_0xe32f20){_0x379186[_0x573b('0x43')]=_0xe32f20;return _0x379186;})[_0x573b('0x24')](respondWithFilteredResult(_0x3c0d68,_0x5842a3))[_0x573b('0x44')](handleError(_0x3c0d68,null));};exports['show']=function(_0x59508e,_0x30f1fb){var _0x3f1cd9={'raw':![],'where':{'id':_0x59508e['params']['id']}},_0x1ecf83={};_0x1ecf83['model']=_['keys'](db[_0x573b('0x2b')][_0x573b('0x2c')]);_0x1ecf83[_0x573b('0x31')]=_['keys'](_0x59508e[_0x573b('0x31')]);_0x1ecf83['filters']=_['intersection'](_0x1ecf83[_0x573b('0x35')],_0x1ecf83[_0x573b('0x31')]);_0x3f1cd9[_0x573b('0x37')]=_['intersection'](_0x1ecf83[_0x573b('0x35')],qs[_0x573b('0x36')](_0x59508e[_0x573b('0x31')][_0x573b('0x36')]));_0x3f1cd9['attributes']=_0x3f1cd9[_0x573b('0x37')][_0x573b('0x38')]?_0x3f1cd9[_0x573b('0x37')]:_0x1ecf83['model'];if(_0x59508e[_0x573b('0x31')][_0x573b('0x45')]){_0x3f1cd9[_0x573b('0x42')]=[{'all':!![]}];}_0x3f1cd9=_[_0x573b('0x3f')]({},_0x3f1cd9,_0x59508e[_0x573b('0x41')]);return db[_0x573b('0x2b')][_0x573b('0x46')](_0x3f1cd9)[_0x573b('0x24')](handleEntityNotFound(_0x30f1fb,null))[_0x573b('0x24')](respondWithResult(_0x30f1fb,null))[_0x573b('0x44')](handleError(_0x30f1fb,null));};exports[_0x573b('0x47')]=function(_0x3957b1,_0x4e2403){return db[_0x573b('0x2b')][_0x573b('0x47')](_0x3957b1[_0x573b('0x48')],{})[_0x573b('0x24')](function(_0x7833e){var _0xa8f5ac=_0x3957b1[_0x573b('0x49')][_0x573b('0x26')]({'plain':!![]});if(!_0xa8f5ac)throw new Error(_0x573b('0x4a'));if(_0xa8f5ac['role']==='user'){var _0x2170a1=_0x7833e['get']({'plain':!![]});var _0x144371=_0x573b('0x27');return db[_0x573b('0x4b')]['find']({'where':{'name':_0x144371,'userProfileId':_0xa8f5ac['userProfileId']},'raw':!![]})['then'](function(_0x6e75cf){if(_0x6e75cf&&_0x6e75cf['autoAssociation']===0x0){return db[_0x573b('0x28')][_0x573b('0x47')]({'name':_0x2170a1[_0x573b('0x29')],'resourceId':_0x2170a1['id'],'type':_0x6e75cf['name'],'sectionId':_0x6e75cf['id']},{})[_0x573b('0x24')](function(){return _0x7833e;});}else{return _0x7833e;}})[_0x573b('0x44')](function(_0x3b420d){logger[_0x573b('0x4c')](_0x573b('0x4d'),_0x3b420d);throw _0x3b420d;});}return _0x7833e;})[_0x573b('0x24')](respondWithResult(_0x4e2403,0xc9))[_0x573b('0x44')](handleError(_0x4e2403,null));};exports[_0x573b('0x23')]=function(_0x838817,_0x1e362a){if(_0x838817[_0x573b('0x48')]['id']){delete _0x838817['body']['id'];}return db['CmList'][_0x573b('0x46')]({'where':{'id':_0x838817[_0x573b('0x4e')]['id']}})[_0x573b('0x24')](handleEntityNotFound(_0x1e362a,null))['then'](saveUpdates(_0x838817['body'],null))[_0x573b('0x24')](respondWithResult(_0x1e362a,null))[_0x573b('0x44')](handleError(_0x1e362a,null));};exports['destroy']=function(_0x31b481,_0x591a57){return db[_0x573b('0x2b')][_0x573b('0x46')]({'where':{'id':_0x31b481[_0x573b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x591a57,null))[_0x573b('0x24')](removeEntity(_0x591a57,null))[_0x573b('0x44')](handleError(_0x591a57,null));};exports[_0x573b('0x4f')]=function(_0x4d5ca7,_0x5d0c95){return db['CmList'][_0x573b('0x4f')]()[_0x573b('0x24')](respondWithResult(_0x5d0c95,null))[_0x573b('0x44')](handleError(_0x5d0c95,null));};exports[_0x573b('0x50')]=function(_0x4f003a,_0x508378,_0xa84f99){if(_0x4f003a['body']['id']){delete _0x4f003a[_0x573b('0x48')]['id'];}return db[_0x573b('0x2b')][_0x573b('0x46')]({'where':{'id':_0x4f003a[_0x573b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x508378,null))['then'](function(_0x3ad458){if(_0x3ad458){_0x4f003a[_0x573b('0x48')][_0x573b('0x51')]=_0x3ad458['id'];return db['Disposition']['create'](_0x4f003a[_0x573b('0x48')]);}})[_0x573b('0x24')](respondWithResult(_0x508378,null))[_0x573b('0x44')](handleError(_0x508378,null));};exports['getDispositions']=function(_0x218dfe,_0x1d2d96,_0x469264){var _0x3f334c={'raw':![],'where':{}};var _0x475df5={};var _0x228bdd={'count':0x0,'rows':[]};return db[_0x573b('0x2b')][_0x573b('0x52')]({'where':{'id':_0x218dfe[_0x573b('0x4e')]['id']}})[_0x573b('0x24')](handleEntityNotFound(_0x1d2d96,null))[_0x573b('0x24')](function(_0x25339e){if(_0x25339e){_0x475df5[_0x573b('0x35')]=_['keys'](db[_0x573b('0x53')][_0x573b('0x2c')]);_0x475df5[_0x573b('0x31')]=_[_0x573b('0x32')](_0x218dfe['query']);_0x475df5[_0x573b('0x33')]=_[_0x573b('0x34')](_0x475df5[_0x573b('0x35')],_0x475df5[_0x573b('0x31')]);_0x3f334c[_0x573b('0x37')]=_['intersection'](_0x475df5[_0x573b('0x35')],qs[_0x573b('0x36')](_0x218dfe[_0x573b('0x31')]['fields']));_0x3f334c[_0x573b('0x37')]=_0x3f334c[_0x573b('0x37')][_0x573b('0x38')]?_0x3f334c[_0x573b('0x37')]:_0x475df5['model'];if(!_0x218dfe['query']['hasOwnProperty']('nolimit')){_0x3f334c[_0x573b('0x3a')]=qs[_0x573b('0x3a')](_0x218dfe['query'][_0x573b('0x3a')]);_0x3f334c['offset']=qs[_0x573b('0x1e')](_0x218dfe[_0x573b('0x31')][_0x573b('0x1e')]);}_0x3f334c[_0x573b('0x54')]=qs[_0x573b('0x3b')](_0x218dfe[_0x573b('0x31')]['sort']);_0x3f334c[_0x573b('0x3e')]=qs[_0x573b('0x33')](_['pick'](_0x218dfe[_0x573b('0x31')],_0x475df5[_0x573b('0x33')]));_0x3f334c['where'][_0x573b('0x51')]=_0x25339e['id'];if(_0x218dfe[_0x573b('0x31')][_0x573b('0x3d')]){_0x3f334c[_0x573b('0x3e')]=_[_0x573b('0x3f')](_0x3f334c[_0x573b('0x3e')],{'$or':_['map'](_0x3f334c[_0x573b('0x37')],function(_0x16dc69){var _0x416942={};_0x416942[_0x16dc69]={'$like':'%'+_0x218dfe[_0x573b('0x31')][_0x573b('0x3d')]+'%'};return _0x416942;})});}_0x3f334c=_[_0x573b('0x3f')]({},_0x3f334c,_0x218dfe[_0x573b('0x41')]);return db[_0x573b('0x53')][_0x573b('0x1d')]({'where':_0x3f334c[_0x573b('0x3e')]})[_0x573b('0x24')](function(_0x597b9a){_0x228bdd[_0x573b('0x1d')]=_0x597b9a;if(_0x218dfe['query'][_0x573b('0x45')]){_0x3f334c[_0x573b('0x42')]=[{'all':!![]}];}return db[_0x573b('0x53')]['findAll'](_0x3f334c);})['then'](function(_0x5ca900){_0x228bdd[_0x573b('0x43')]=_0x5ca900;return _0x228bdd;});}})[_0x573b('0x24')](respondWithFilteredResult(_0x1d2d96,_0x3f334c))[_0x573b('0x44')](handleError(_0x1d2d96,null));};exports[_0x573b('0x55')]=function(_0x25945c,_0x2605c6,_0x2f4124){return db[_0x573b('0x2b')][_0x573b('0x46')]({'where':{'id':_0x25945c[_0x573b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2605c6,null))[_0x573b('0x24')](function(_0x24737b){if(_0x24737b){return _0x24737b[_0x573b('0x55')](_0x25945c[_0x573b('0x31')][_0x573b('0x56')]);}})[_0x573b('0x24')](respondWithStatusCode(_0x2605c6,null))[_0x573b('0x44')](handleError(_0x2605c6,null));};exports['addContacts']=function(_0x2d07e6,_0x593b4d,_0x3b6e2a){return db[_0x573b('0x2b')][_0x573b('0x46')]({'where':{'id':_0x2d07e6[_0x573b('0x4e')]['id']}})[_0x573b('0x24')](handleEntityNotFound(_0x593b4d,null))[_0x573b('0x24')](function(_0x46438d){if(_0x46438d){var _0x337dc9=[];var _0x2fd85c={'success':[],'errors':[]};return db[_0x573b('0x57')][_0x573b('0x4f')]()[_0x573b('0x24')](function(_0x5c5461){if(_0x2d07e6[_0x573b('0x48')][_0x573b('0x58')]&&_[_0x573b('0x59')](_0x2d07e6[_0x573b('0x48')][_0x573b('0x58')])){if(_0x2d07e6[_0x573b('0x48')]['tags'][_0x573b('0x38')]){_0x2d07e6[_0x573b('0x48')][_0x573b('0x58')]=_0x2d07e6[_0x573b('0x48')][_0x573b('0x58')][_0x573b('0x5a')](';')+';';}else{_0x2d07e6[_0x573b('0x48')][_0x573b('0x58')]=null;}}else{_0x2d07e6[_0x573b('0x48')][_0x573b('0x58')]=null;}if(_0x2d07e6[_0x573b('0x48')]&&_[_0x573b('0x59')](_0x2d07e6[_0x573b('0x48')])){for(var _0x46ad1e=0x0;_0x46ad1e<_0x2d07e6[_0x573b('0x48')][_0x573b('0x38')];_0x46ad1e+=0x1){_0x2d07e6[_0x573b('0x48')][_0x46ad1e]['ListId']=_0x2d07e6['params']['id'];_0x337dc9[_0x573b('0x5b')](_0x2d07e6['body'][_0x46ad1e]);}return BPromise[_0x573b('0x5c')](_0x337dc9,function(_0x13fbce){return db[_0x573b('0x57')]['create'](_[_0x573b('0x5d')](_0x13fbce,[_0x573b('0x56'),'id'])||{},{'fields':_['keys'](_0x5c5461),'raw':!![]})['then'](function(_0x54f912){_0x2fd85c['success'][_0x573b('0x5b')](_0x54f912[_0x573b('0x5e')]);})[_0x573b('0x44')](function(_0x2909f7){_0x2fd85c['errors'][_0x573b('0x5b')]({'data':_0x13fbce,'error':_0x2909f7['message']});});})[_0x573b('0x24')](function(_0x54738f){return _0x2fd85c;})[_0x573b('0x44')](function(_0x2c001e){return _0x2c001e;});}else{_0x593b4d['status'](0x190)['json']({'message':_0x573b('0x5f')});}});}})[_0x573b('0x24')](respondWithResult(_0x593b4d,null))[_0x573b('0x44')](handleError(_0x593b4d,null));};exports[_0x573b('0x60')]=function(_0x4defaf,_0x3d2091,_0x54c1b0){var _0x42b65b;return db[_0x573b('0x2b')]['find']({'where':{'id':_0x4defaf[_0x573b('0x4e')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x573b('0x61')}]})[_0x573b('0x24')](handleEntityNotFound(_0x3d2091,null))[_0x573b('0x24')](function(_0x2c1d01){if(_0x2c1d01){_0x42b65b=_0x2c1d01;return db[_0x573b('0x57')][_0x573b('0x2c')];}})[_0x573b('0x24')](function(_0x1bcda7){if(_0x1bcda7){var _0x13d32b={};var _0x10853a={};_0x10853a[_0x573b('0x35')]=_[_0x573b('0x62')](_['keys'](_0x1bcda7),_[_0x573b('0x30')](_0x42b65b[_0x573b('0x61')],function(_0x29fedd){return util[_0x573b('0x63')]('cf_%d',_0x29fedd['id']);}));_0x10853a[_0x573b('0x31')]=_['keys'](_0x4defaf[_0x573b('0x31')]);_0x10853a[_0x573b('0x33')]=_[_0x573b('0x34')](_0x10853a[_0x573b('0x35')],_0x10853a['query']);_0x13d32b[_0x573b('0x37')]=_['intersection'](_0x10853a[_0x573b('0x35')],qs['fields'](_0x4defaf[_0x573b('0x31')][_0x573b('0x36')]));_0x13d32b[_0x573b('0x37')]=_0x13d32b['attributes'][_0x573b('0x38')]?_0x13d32b[_0x573b('0x37')]:_0x10853a[_0x573b('0x35')];if(!_0x4defaf['query'][_0x573b('0x39')](_0x573b('0x64'))){_0x13d32b[_0x573b('0x3a')]=qs['limit'](_0x4defaf[_0x573b('0x31')][_0x573b('0x3a')]);_0x13d32b[_0x573b('0x1e')]=qs[_0x573b('0x1e')](_0x4defaf[_0x573b('0x31')]['offset']);}_0x13d32b[_0x573b('0x54')]=qs['sort'](_0x4defaf['query'][_0x573b('0x3b')]);_0x13d32b['where']=qs[_0x573b('0x33')](_[_0x573b('0x3c')](_0x4defaf[_0x573b('0x31')],_0x10853a['filters']));_0x13d32b[_0x573b('0x65')]=!![];if(_0x4defaf[_0x573b('0x31')][_0x573b('0x3d')]){_0x13d32b['where']=_[_0x573b('0x3f')](_0x13d32b[_0x573b('0x3e')],{'$or':_['map'](_0x13d32b[_0x573b('0x37')],function(_0x13e935){var _0x4b6e4f={};_0x4b6e4f[_0x13e935]={'$like':'%'+_0x4defaf[_0x573b('0x31')][_0x573b('0x3d')]+'%'};return _0x4b6e4f;})});}_0x13d32b=_['merge']({},_0x13d32b,_0x4defaf['options']);return _0x42b65b[_0x573b('0x60')](_0x13d32b);}})[_0x573b('0x24')](respondWithResult(_0x3d2091,null))[_0x573b('0x44')](handleError(_0x3d2091,null));};exports['getContactsCsv']=function(_0x5a4b14,_0x248fea,_0x34503a){var _0x45a5ba;return db['CmList']['find']({'where':{'id':_0x5a4b14[_0x573b('0x4e')]['id']},'include':[{'model':db[_0x573b('0x66')],'as':_0x573b('0x61')}]})[_0x573b('0x24')](handleEntityNotFound(_0x248fea,null))[_0x573b('0x24')](function(_0x4d74d8){if(_0x4d74d8){_0x45a5ba=_0x4d74d8;return db[_0x573b('0x57')][_0x573b('0x2c')];}})[_0x573b('0x24')](function(_0x8adbc3){if(_0x8adbc3){var _0x2e514a={};var _0x22a11c={};_0x22a11c[_0x573b('0x35')]=_['concat'](_[_0x573b('0x32')](_0x8adbc3),_[_0x573b('0x30')](_0x45a5ba[_0x573b('0x61')],function(_0x357241){return util[_0x573b('0x63')](_0x573b('0x67'),_0x357241['id']);}));_0x22a11c[_0x573b('0x31')]=_[_0x573b('0x32')](_0x5a4b14['query']);_0x22a11c[_0x573b('0x33')]=_[_0x573b('0x34')](_0x22a11c[_0x573b('0x35')],_0x22a11c[_0x573b('0x31')]);_0x2e514a[_0x573b('0x37')]=_[_0x573b('0x34')](_0x22a11c[_0x573b('0x35')],qs[_0x573b('0x36')](_0x5a4b14[_0x573b('0x31')][_0x573b('0x36')]));_0x2e514a[_0x573b('0x37')]=_0x2e514a[_0x573b('0x37')][_0x573b('0x38')]?_0x2e514a['attributes']:_0x22a11c[_0x573b('0x35')];if(!_0x5a4b14[_0x573b('0x31')][_0x573b('0x39')](_0x573b('0x64'))){_0x2e514a[_0x573b('0x3a')]=qs['limit'](_0x5a4b14['query'][_0x573b('0x3a')]);_0x2e514a[_0x573b('0x1e')]=qs[_0x573b('0x1e')](_0x5a4b14[_0x573b('0x31')][_0x573b('0x1e')]);}_0x2e514a[_0x573b('0x54')]=qs[_0x573b('0x3b')](_0x5a4b14[_0x573b('0x31')][_0x573b('0x3b')]);_0x2e514a['where']=qs[_0x573b('0x33')](_['pick'](_0x5a4b14[_0x573b('0x31')],_0x22a11c['filters']));_0x2e514a[_0x573b('0x65')]=!![];if(_0x5a4b14[_0x573b('0x31')][_0x573b('0x3d')]){_0x2e514a[_0x573b('0x3e')]=_[_0x573b('0x3f')](_0x2e514a[_0x573b('0x3e')],{'$or':_[_0x573b('0x30')](_0x2e514a[_0x573b('0x37')],function(_0x371b02){var _0x507e6d={};_0x507e6d[_0x371b02]={'$like':'%'+_0x5a4b14['query'][_0x573b('0x3d')]+'%'};return _0x507e6d;})});}_0x2e514a=_[_0x573b('0x3f')]({},_0x2e514a,_0x5a4b14[_0x573b('0x41')]);return _0x45a5ba[_0x573b('0x60')](_0x2e514a);}})[_0x573b('0x24')](function(_0x59967c){if(!_[_0x573b('0x68')](_0x59967c)){var _0x262703=toCsv(_0x59967c);var _0x576a19=Date[_0x573b('0x69')]();fs[_0x573b('0x6a')](util[_0x573b('0x63')]('/tmp/list_%d_%s.csv',_0x45a5ba['id'],_0x576a19),_0x262703);_0x248fea[_0x573b('0x6b')](_0x573b('0x6c'),_0x573b('0x6d')+util[_0x573b('0x63')]('list_%d_%s.csv',_0x45a5ba['id'],_0x576a19));_0x248fea['setHeader'](_0x573b('0x6e'),_0x573b('0x6f'));return _0x248fea[_0x573b('0x70')](util['format'](_0x573b('0x71'),_0x45a5ba['id'],_0x576a19));}else{return _0x248fea['sendStatus'](0xcc);}})[_0x573b('0x44')](handleError(_0x248fea,null));};exports['addCustomField']=function(_0x39c155,_0x294c4d,_0x4a066b){var _0x584e90;delete _0x39c155[_0x573b('0x48')]['id'];return db[_0x573b('0x2b')][_0x573b('0x52')]({'where':{'id':_0x39c155['params']['id']}})['then'](handleEntityNotFound(_0x294c4d,null))[_0x573b('0x24')](function(_0x536f3b){if(_0x536f3b){return db[_0x573b('0x72')][_0x573b('0x73')](function(_0x5b078f){return db['CmCustomField'][_0x573b('0x47')](_0x39c155['body'],{'transaction':_0x5b078f})[_0x573b('0x24')](function(_0x5f2d39){_0x584e90=_0x5f2d39;return _0x536f3b[_0x573b('0x74')](_0x5f2d39,{'transaction':_0x5b078f});})[_0x573b('0x24')](function(){var _0x34f782={'type':db[_0x573b('0x75')][_0x573b('0x76')],'transaction':_0x5b078f};switch(_0x39c155[_0x573b('0x48')]['type']){case _0x573b('0x77'):_0x34f782['type']=db[_0x573b('0x75')][_0x573b('0x76')];break;case'number':_0x34f782['type']=db['Sequelize'][_0x573b('0x78')];break;case _0x573b('0x79'):_0x34f782[_0x573b('0x2e')]=db[_0x573b('0x75')]['BOOLEAN'];_0x34f782[_0x573b('0x7a')]=![];break;default:}return db[_0x573b('0x72')][_0x573b('0x7b')]['addColumn'](_0x573b('0x7c'),util[_0x573b('0x63')](_0x573b('0x7d'),_0x584e90['id']),_0x34f782);})[_0x573b('0x24')](function(){return _0x584e90;});});}})[_0x573b('0x24')](respondWithResult(_0x294c4d,null))['catch'](handleError(_0x294c4d,null));};exports[_0x573b('0x7e')]=function(_0xf11efd,_0x3e32c6,_0x22b7b6){var _0x4cf19a={};var _0x23726f={};var _0x5f287d;var _0x3ffcf4;return db[_0x573b('0x2b')][_0x573b('0x52')]({'where':{'id':_0xf11efd[_0x573b('0x4e')]['id']}})[_0x573b('0x24')](handleEntityNotFound(_0x3e32c6,null))[_0x573b('0x24')](function(_0x43f466){if(_0x43f466){_0x5f287d=_0x43f466;_0x23726f[_0x573b('0x35')]=_[_0x573b('0x32')](db[_0x573b('0x66')][_0x573b('0x2c')]);_0x23726f[_0x573b('0x31')]=_[_0x573b('0x32')](_0xf11efd[_0x573b('0x31')]);_0x23726f[_0x573b('0x33')]=_[_0x573b('0x34')](_0x23726f[_0x573b('0x35')],_0x23726f[_0x573b('0x31')]);_0x4cf19a[_0x573b('0x37')]=_['intersection'](_0x23726f[_0x573b('0x35')],qs['fields'](_0xf11efd[_0x573b('0x31')][_0x573b('0x36')]));_0x4cf19a[_0x573b('0x37')]=_0x4cf19a[_0x573b('0x37')][_0x573b('0x38')]?_0x4cf19a['attributes']:_0x23726f[_0x573b('0x35')];_0x4cf19a[_0x573b('0x54')]=qs[_0x573b('0x3b')](_0xf11efd[_0x573b('0x31')][_0x573b('0x3b')]);_0x4cf19a[_0x573b('0x3e')]=qs['filters'](_['pick'](_0xf11efd['query'],_0x23726f[_0x573b('0x33')]));_0x4cf19a[_0x573b('0x3e')]=_[_0x573b('0x3f')](_0x4cf19a[_0x573b('0x3e')],{'$or':[{'ListId':_0x43f466['id']},{'ListId':null}]});if(_0xf11efd[_0x573b('0x31')][_0x573b('0x3d')]){_0x4cf19a['where']=_['merge'](_0x4cf19a[_0x573b('0x3e')],{'$or':_[_0x573b('0x30')](_0x4cf19a[_0x573b('0x37')],function(_0x3abfae){var _0x7f0dfd={};_0x7f0dfd[_0x3abfae]={'$like':'%'+_0xf11efd['query'][_0x573b('0x3d')]+'%'};return _0x7f0dfd;})});}_0x4cf19a=_[_0x573b('0x3f')]({},_0x4cf19a,_0xf11efd[_0x573b('0x41')]);return db[_0x573b('0x66')][_0x573b('0x7f')](_0x4cf19a);}})[_0x573b('0x24')](respondWithResult(_0x3e32c6,null))[_0x573b('0x44')](handleError(_0x3e32c6,null));};exports['addAgents']=function(_0x894d09,_0xf90f0a,_0x4c98f6){return db[_0x573b('0x2b')][_0x573b('0x46')]({'where':{'id':_0x894d09['params']['id']}})[_0x573b('0x24')](handleEntityNotFound(_0xf90f0a,null))[_0x573b('0x24')](function(_0x54a3e8){if(_0x54a3e8){return _0x54a3e8[_0x573b('0x80')](_0x894d09[_0x573b('0x48')][_0x573b('0x56')],_[_0x573b('0x5d')](_0x894d09[_0x573b('0x48')],[_0x573b('0x56'),'id'])||{})[_0x573b('0x81')](function(_0x39dad7){for(var _0x172f15=0x0;_0x172f15<_0x894d09[_0x573b('0x48')][_0x573b('0x56')][_0x573b('0x38')];_0x172f15+=0x1){socket[_0x573b('0x82')](_0x573b('0x83'),{'UserId':_0x894d09[_0x573b('0x48')][_0x573b('0x56')][_0x172f15],'CmListId':_0x894d09[_0x573b('0x4e')]['id']});}return _0x39dad7;});}})[_0x573b('0x24')](respondWithResult(_0xf90f0a,null))[_0x573b('0x44')](handleError(_0xf90f0a,null));};exports[_0x573b('0x84')]=function(_0x221182,_0x5230df,_0x4b4922){return db[_0x573b('0x2b')][_0x573b('0x46')]({'where':{'id':_0x221182[_0x573b('0x4e')]['id']}})[_0x573b('0x24')](handleEntityNotFound(_0x5230df,null))['then'](function(_0x3ef4dc){if(_0x3ef4dc){return _0x3ef4dc['removeAgents'](_0x221182[_0x573b('0x31')][_0x573b('0x56')])[_0x573b('0x24')](function(){if(_[_0x573b('0x59')](_0x221182[_0x573b('0x31')][_0x573b('0x56')])){for(var _0x386196=0x0;_0x386196<_0x221182[_0x573b('0x31')][_0x573b('0x56')]['length'];_0x386196+=0x1){socket[_0x573b('0x82')](_0x573b('0x85'),{'UserId':Number(_0x221182[_0x573b('0x31')][_0x573b('0x56')][_0x386196]),'CmListId':Number(_0x221182['params']['id'])});}}else{socket['emit'](_0x573b('0x85'),{'UserId':Number(_0x221182[_0x573b('0x31')]['ids']),'CmListId':Number(_0x221182['params']['id'])});}});}})['then'](respondWithStatusCode(_0x5230df,null))[_0x573b('0x44')](handleError(_0x5230df,null));};exports['getAgents']=function(_0x59fbe6,_0x29f8a8,_0x5043e1){var _0x41d342={};var _0x4ea066={};var _0x46d26d;var _0x490c0e;return db[_0x573b('0x2b')]['findOne']({'where':{'id':_0x59fbe6[_0x573b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x29f8a8,null))[_0x573b('0x24')](function(_0x3312bc){if(_0x3312bc){_0x46d26d=_0x3312bc;_0x4ea066[_0x573b('0x35')]=_[_0x573b('0x32')](db[_0x573b('0x86')][_0x573b('0x2c')]);_0x4ea066['query']=_['keys'](_0x59fbe6[_0x573b('0x31')]);_0x4ea066[_0x573b('0x33')]=_['intersection'](_0x4ea066[_0x573b('0x35')],_0x4ea066[_0x573b('0x31')]);_0x41d342['attributes']=_[_0x573b('0x34')](_0x4ea066[_0x573b('0x35')],qs[_0x573b('0x36')](_0x59fbe6[_0x573b('0x31')]['fields']));_0x41d342[_0x573b('0x37')]=_0x41d342['attributes'][_0x573b('0x38')]?_0x41d342[_0x573b('0x37')]:_0x4ea066['model'];_0x41d342[_0x573b('0x54')]=qs[_0x573b('0x3b')](_0x59fbe6[_0x573b('0x31')]['sort']);_0x41d342[_0x573b('0x3e')]=qs[_0x573b('0x33')](_[_0x573b('0x3c')](_0x59fbe6[_0x573b('0x31')],_0x4ea066['filters']));if(_0x59fbe6['query'][_0x573b('0x3d')]){_0x41d342[_0x573b('0x3e')]=_[_0x573b('0x3f')](_0x41d342[_0x573b('0x3e')],{'$or':_[_0x573b('0x30')](_0x41d342[_0x573b('0x37')],function(_0x1d77f2){var _0x463e61={};_0x463e61[_0x1d77f2]={'$like':'%'+_0x59fbe6[_0x573b('0x31')]['filter']+'%'};return _0x463e61;})});}_0x41d342=_[_0x573b('0x3f')]({},_0x41d342,_0x59fbe6[_0x573b('0x41')]);return _0x46d26d[_0x573b('0x87')](_0x41d342);}})[_0x573b('0x24')](function(_0xc796f6){if(_0xc796f6){_0x490c0e=_0xc796f6[_0x573b('0x38')];if(!_0x59fbe6[_0x573b('0x31')][_0x573b('0x39')](_0x573b('0x64'))){_0x41d342[_0x573b('0x3a')]=qs[_0x573b('0x3a')](_0x59fbe6[_0x573b('0x31')]['limit']);_0x41d342[_0x573b('0x1e')]=qs[_0x573b('0x1e')](_0x59fbe6[_0x573b('0x31')][_0x573b('0x1e')]);}return _0x46d26d[_0x573b('0x87')](_0x41d342);}})[_0x573b('0x24')](function(_0x54f6ba){if(_0x54f6ba){return _0x54f6ba?{'count':_0x490c0e,'rows':_0x54f6ba}:null;}})[_0x573b('0x24')](respondWithResult(_0x29f8a8,null))[_0x573b('0x44')](handleError(_0x29f8a8,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 4aa14cf..be25680 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 _0x9bb2=['exports','events','../../mysqldb','CmList','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x27919c,_0x16ba72){var _0x5e610a=function(_0x418a8c){while(--_0x418a8c){_0x27919c['push'](_0x27919c['shift']());}};_0x5e610a(++_0x16ba72);}(_0x9bb2,0xd2));var _0x29bb=function(_0x1b63b6,_0xe7db19){_0x1b63b6=_0x1b63b6-0x0;var _0x11e2e5=_0x9bb2[_0x1b63b6];return _0x11e2e5;};'use strict';var EventEmitter=require(_0x29bb('0x0'));var CmList=require(_0x29bb('0x1'))['db'][_0x29bb('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x29bb('0x3')](0x0);var events={'afterCreate':_0x29bb('0x4'),'afterUpdate':_0x29bb('0x5'),'afterDestroy':_0x29bb('0x6')};function emitEvent(_0x2b0113){return function(_0x23b8c5,_0x3e6fd3,_0x480fc9){CmListEvents['emit'](_0x2b0113+':'+_0x23b8c5['id'],_0x23b8c5);CmListEvents[_0x29bb('0x7')](_0x2b0113,_0x23b8c5);_0x480fc9(null);};}for(var e in events){if(events[_0x29bb('0x8')](e)){var event=events[e];CmList[_0x29bb('0x9')](e,emitEvent(event));}}module[_0x29bb('0xa')]=CmListEvents; \ No newline at end of file +var _0x7b6e=['update','remove','emit','hasOwnProperty','exports','CmList','setMaxListeners','save'];(function(_0xbede7c,_0x4a5cfe){var _0x1b6f88=function(_0x1ecf6f){while(--_0x1ecf6f){_0xbede7c['push'](_0xbede7c['shift']());}};_0x1b6f88(++_0x4a5cfe);}(_0x7b6e,0x185));var _0xe7b6=function(_0x290492,_0x18cfad){_0x290492=_0x290492-0x0;var _0x52b5bf=_0x7b6e[_0x290492];return _0x52b5bf;};'use strict';var EventEmitter=require('events');var CmList=require('../../mysqldb')['db'][_0xe7b6('0x0')];var CmListEvents=new EventEmitter();CmListEvents[_0xe7b6('0x1')](0x0);var events={'afterCreate':_0xe7b6('0x2'),'afterUpdate':_0xe7b6('0x3'),'afterDestroy':_0xe7b6('0x4')};function emitEvent(_0x2fca66){return function(_0x4cc6c9,_0x3170e8,_0x3836d8){CmListEvents['emit'](_0x2fca66+':'+_0x4cc6c9['id'],_0x4cc6c9);CmListEvents[_0xe7b6('0x5')](_0x2fca66,_0x4cc6c9);_0x3836d8(null);};}for(var e in events){if(events[_0xe7b6('0x6')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0xe7b6('0x7')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index addd551..bad52c2 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 _0xdcaa=['path','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x48f180,_0x113fe4){var _0x5bc645=function(_0x4d5bb7){while(--_0x4d5bb7){_0x48f180['push'](_0x48f180['shift']());}};_0x5bc645(++_0x113fe4);}(_0xdcaa,0x1db));var _0xadca=function(_0x39806e,_0x2452e2){_0x39806e=_0x39806e-0x0;var _0x4c927e=_0xdcaa[_0x39806e];return _0x4c927e;};'use strict';var _=require(_0xadca('0x0'));var util=require(_0xadca('0x1'));var logger=require(_0xadca('0x2'))(_0xadca('0x3'));var moment=require(_0xadca('0x4'));var BPromise=require(_0xadca('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xadca('0x6'));var rimraf=require('rimraf');var config=require(_0xadca('0x7'));var attributes=require(_0xadca('0x8'));module[_0xadca('0x9')]=function(_0x12a99c,_0x42b5c2){return _0x12a99c[_0xadca('0xa')](_0xadca('0xb'),attributes,{'tableName':_0xadca('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e6a=['../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x4e6a,0x186));var _0xa4e6=function(_0x5ec8df,_0x117c97){_0x5ec8df=_0x5ec8df-0x0;var _0x49c7ff=_0x4e6a[_0x5ec8df];return _0x49c7ff;};'use strict';var _=require(_0xa4e6('0x0'));var util=require('util');var logger=require(_0xa4e6('0x1'))('api');var moment=require(_0xa4e6('0x2'));var BPromise=require(_0xa4e6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa4e6('0x4'));var rimraf=require(_0xa4e6('0x5'));var config=require(_0xa4e6('0x6'));var attributes=require(_0xa4e6('0x7'));module[_0xa4e6('0x8')]=function(_0x232c25,_0x6101c8){return _0x232c25[_0xa4e6('0x9')](_0xa4e6('0xa'),attributes,{'tableName':_0xa4e6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 32cc315..ae2b939 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 _0xb89d=['localhost','socket.io-emitter','register','request','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','randomstring','ioredis','../../config/environment','jayson/promise','client','http','redis'];(function(_0x2183ca,_0x3778a9){var _0x21d00e=function(_0x2fb048){while(--_0x2fb048){_0x2183ca['push'](_0x2183ca['shift']());}};_0x21d00e(++_0x3778a9);}(_0xb89d,0xd3));var _0xdb89=function(_0x1af19c,_0x513aa2){_0x1af19c=_0x1af19c-0x0;var _0x5b94be=_0xb89d[_0x1af19c];return _0x5b94be;};'use strict';var _=require('lodash');var util=require(_0xdb89('0x0'));var moment=require(_0xdb89('0x1'));var BPromise=require('bluebird');var rs=require(_0xdb89('0x2'));var fs=require('fs');var Redis=require(_0xdb89('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xdb89('0x4'));var jayson=require(_0xdb89('0x5'));var client=jayson[_0xdb89('0x6')][_0xdb89('0x7')]({'port':0x232a});config[_0xdb89('0x8')]=_['defaults'](config[_0xdb89('0x8')],{'host':_0xdb89('0x9'),'port':0x18eb});var socket=require(_0xdb89('0xa'))(new Redis(config[_0xdb89('0x8')]));require('./cmList.socket')[_0xdb89('0xb')](socket);function respondWithRpcPromise(_0x50c3e9,_0x3969c0,_0x1064f1){return new BPromise(function(_0x51dc3a,_0x5abca9){return client[_0xdb89('0xc')](_0x50c3e9,_0x1064f1)['then'](function(_0x35b5e4){logger[_0xdb89('0xd')](_0xdb89('0xe'),_0x3969c0,_0xdb89('0xf'));logger[_0xdb89('0x10')](_0xdb89('0x11'),_0x3969c0,_0xdb89('0xf'),JSON[_0xdb89('0x12')](_0x35b5e4));if(_0x35b5e4[_0xdb89('0x13')]){if(_0x35b5e4[_0xdb89('0x13')][_0xdb89('0x14')]===0x1f4){logger[_0xdb89('0x13')](_0xdb89('0xe'),_0x3969c0,_0x35b5e4[_0xdb89('0x13')][_0xdb89('0x15')]);return _0x5abca9(_0x35b5e4[_0xdb89('0x13')]['message']);}logger[_0xdb89('0x13')]('CmList,\x20%s,\x20%s',_0x3969c0,_0x35b5e4['error'][_0xdb89('0x15')]);return _0x51dc3a(_0x35b5e4[_0xdb89('0x13')][_0xdb89('0x15')]);}else{logger[_0xdb89('0xd')](_0xdb89('0xe'),_0x3969c0,'request\x20sent');_0x51dc3a(_0x35b5e4['result'][_0xdb89('0x15')]);}})['catch'](function(_0x814ee4){logger[_0xdb89('0x13')](_0xdb89('0xe'),_0x3969c0,_0x814ee4);_0x5abca9(_0x814ee4);});});} \ No newline at end of file +var _0x581e=['./cmList.socket','register','request','then','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x1c541a,_0x3763c4){var _0x3f512b=function(_0xe972ef){while(--_0xe972ef){_0x1c541a['push'](_0x1c541a['shift']());}};_0x3f512b(++_0x3763c4);}(_0x581e,0x99));var _0xe581=function(_0x506383,_0x1b1475){_0x506383=_0x506383-0x0;var _0x539798=_0x581e[_0x506383];return _0x539798;};'use strict';var _=require(_0xe581('0x0'));var util=require(_0xe581('0x1'));var moment=require('moment');var BPromise=require(_0xe581('0x2'));var rs=require(_0xe581('0x3'));var fs=require('fs');var Redis=require(_0xe581('0x4'));var db=require(_0xe581('0x5'))['db'];var utils=require(_0xe581('0x6'));var logger=require(_0xe581('0x7'))(_0xe581('0x8'));var config=require(_0xe581('0x9'));var jayson=require(_0xe581('0xa'));var client=jayson[_0xe581('0xb')][_0xe581('0xc')]({'port':0x232a});config[_0xe581('0xd')]=_[_0xe581('0xe')](config[_0xe581('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe581('0xd')]));require(_0xe581('0xf'))[_0xe581('0x10')](socket);function respondWithRpcPromise(_0x180e1b,_0x4bf86f,_0x26df3c){return new BPromise(function(_0x5226fe,_0x16793b){return client[_0xe581('0x11')](_0x180e1b,_0x26df3c)[_0xe581('0x12')](function(_0x4a9495){logger['info'](_0xe581('0x13'),_0x4bf86f,'request\x20sent');logger[_0xe581('0x14')](_0xe581('0x15'),_0x4bf86f,_0xe581('0x16'),JSON[_0xe581('0x17')](_0x4a9495));if(_0x4a9495[_0xe581('0x18')]){if(_0x4a9495[_0xe581('0x18')][_0xe581('0x19')]===0x1f4){logger[_0xe581('0x18')](_0xe581('0x13'),_0x4bf86f,_0x4a9495['error'][_0xe581('0x1a')]);return _0x16793b(_0x4a9495[_0xe581('0x18')][_0xe581('0x1a')]);}logger[_0xe581('0x18')](_0xe581('0x13'),_0x4bf86f,_0x4a9495[_0xe581('0x18')][_0xe581('0x1a')]);return _0x5226fe(_0x4a9495[_0xe581('0x18')]['message']);}else{logger['info'](_0xe581('0x13'),_0x4bf86f,_0xe581('0x16'));_0x5226fe(_0x4a9495['result'][_0xe581('0x1a')]);}})[_0xe581('0x1b')](function(_0x569343){logger[_0xe581('0x18')](_0xe581('0x13'),_0x4bf86f,_0x569343);_0x16793b(_0x569343);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 2a7a5cb..29cc1dd 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 _0xfa45=['register','length','cmList:','./cmList.events','save','remove','update','removeListener'];(function(_0x245545,_0x4983b3){var _0x106a5f=function(_0x278277){while(--_0x278277){_0x245545['push'](_0x245545['shift']());}};_0x106a5f(++_0x4983b3);}(_0xfa45,0x11b));var _0x5fa4=function(_0x4af3bb,_0x4cff2e){_0x4af3bb=_0x4af3bb-0x0;var _0x449d75=_0xfa45[_0x4af3bb];return _0x449d75;};'use strict';var CmListEvents=require(_0x5fa4('0x0'));var events=[_0x5fa4('0x1'),_0x5fa4('0x2'),_0x5fa4('0x3')];function createListener(_0x46c739,_0x2d966c){return function(_0x1e88c8){_0x2d966c['emit'](_0x46c739,_0x1e88c8);};}function removeListener(_0x2b3824,_0x4b7365){return function(){CmListEvents[_0x5fa4('0x4')](_0x2b3824,_0x4b7365);};}exports[_0x5fa4('0x5')]=function(_0x1121f8){for(var _0x260b0d=0x0,_0x28a266=events[_0x5fa4('0x6')];_0x260b0d<_0x28a266;_0x260b0d++){var _0x298dce=events[_0x260b0d];var _0x108de1=createListener(_0x5fa4('0x7')+_0x298dce,_0x1121f8);CmListEvents['on'](_0x298dce,_0x108de1);}}; \ No newline at end of file +var _0x87d3=['save','remove','update','emit','removeListener','register','length','cmList:','./cmList.events'];(function(_0x1402ba,_0x54cfaa){var _0x4198b5=function(_0x42dbad){while(--_0x42dbad){_0x1402ba['push'](_0x1402ba['shift']());}};_0x4198b5(++_0x54cfaa);}(_0x87d3,0x86));var _0x387d=function(_0x476c7,_0x298ee0){_0x476c7=_0x476c7-0x0;var _0x47ae56=_0x87d3[_0x476c7];return _0x47ae56;};'use strict';var CmListEvents=require(_0x387d('0x0'));var events=[_0x387d('0x1'),_0x387d('0x2'),_0x387d('0x3')];function createListener(_0x928149,_0x2bb005){return function(_0x4c308f){_0x2bb005[_0x387d('0x4')](_0x928149,_0x4c308f);};}function removeListener(_0x54c387,_0xde245d){return function(){CmListEvents[_0x387d('0x5')](_0x54c387,_0xde245d);};}exports[_0x387d('0x6')]=function(_0x49d349){for(var _0x3e0d03=0x0,_0x265532=events[_0x387d('0x7')];_0x3e0d03<_0x265532;_0x3e0d03++){var _0x689c51=events[_0x3e0d03];var _0x86e92e=createListener(_0x387d('0x8')+_0x689c51,_0x49d349);CmListEvents['on'](_0x689c51,_0x86e92e);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 8dd7a11..44233ce 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 _0xd86b=['/:id/fields','getCustomFields','/:id/users','getAgents','post','addDisposition','addContacts','addCustomField','put','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd86b,0x126));var _0xbd86=function(_0x38b14f,_0xd08fa8){_0x38b14f=_0x38b14f-0x0;var _0x22a324=_0xd86b[_0x38b14f];return _0x22a324;};'use strict';var multer=require(_0xbd86('0x0'));var util=require(_0xbd86('0x1'));var path=require(_0xbd86('0x2'));var timeout=require(_0xbd86('0x3'));var express=require(_0xbd86('0x4'));var router=express[_0xbd86('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xbd86('0x6'));var config=require(_0xbd86('0x7'));var controller=require(_0xbd86('0x8'));router[_0xbd86('0x9')]('/',auth[_0xbd86('0xa')](),controller[_0xbd86('0xb')]);router['get'](_0xbd86('0xc'),auth[_0xbd86('0xa')](),controller[_0xbd86('0xd')]);router[_0xbd86('0x9')](_0xbd86('0xe'),auth[_0xbd86('0xa')](),controller[_0xbd86('0xf')]);router['get'](_0xbd86('0x10'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xbd86('0x9')](_0xbd86('0x11'),auth['isAuthenticated'](),controller[_0xbd86('0x12')]);router[_0xbd86('0x9')](_0xbd86('0x13'),auth[_0xbd86('0xa')](),controller[_0xbd86('0x14')]);router[_0xbd86('0x9')](_0xbd86('0x15'),auth[_0xbd86('0xa')](),controller[_0xbd86('0x16')]);router[_0xbd86('0x9')](_0xbd86('0x17'),auth['isAuthenticated'](),controller[_0xbd86('0x18')]);router['post']('/',auth[_0xbd86('0xa')](),controller['create']);router[_0xbd86('0x19')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xbd86('0x1a')]);router[_0xbd86('0x19')]('/:id/contacts',auth[_0xbd86('0xa')](),controller[_0xbd86('0x1b')]);router['post'](_0xbd86('0x15'),auth[_0xbd86('0xa')](),controller[_0xbd86('0x1c')]);router[_0xbd86('0x19')](_0xbd86('0x17'),auth[_0xbd86('0xa')](),controller['addAgents']);router[_0xbd86('0x1d')](_0xbd86('0xe'),auth[_0xbd86('0xa')](),controller[_0xbd86('0x1e')]);router[_0xbd86('0x1f')]('/:id',auth[_0xbd86('0xa')](),controller[_0xbd86('0x20')]);router[_0xbd86('0x1f')](_0xbd86('0x10'),auth[_0xbd86('0xa')](),controller['removeDispositions']);router[_0xbd86('0x1f')](_0xbd86('0x17'),auth[_0xbd86('0xa')](),controller[_0xbd86('0x21')]);module[_0xbd86('0x22')]=router; \ No newline at end of file +var _0xc2b3=['put','/:id','update','delete','destroy','removeDispositions','exports','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./cmList.controller','get','index','/describe','isAuthenticated','show','/:id/dispositions','getDispositions','getContacts','/:id/contacts/csv','getContactsCsv','getAgents','post','create','addDisposition','addContacts','addCustomField','/:id/users','addAgents'];(function(_0x321f25,_0x5ed2a1){var _0x3a8732=function(_0x1b9703){while(--_0x1b9703){_0x321f25['push'](_0x321f25['shift']());}};_0x3a8732(++_0x5ed2a1);}(_0xc2b3,0xc7));var _0x3c2b=function(_0x3d181a,_0x439436){_0x3d181a=_0x3d181a-0x0;var _0x17d3a1=_0xc2b3[_0x3d181a];return _0x17d3a1;};'use strict';var multer=require('multer');var util=require(_0x3c2b('0x0'));var path=require(_0x3c2b('0x1'));var timeout=require(_0x3c2b('0x2'));var express=require(_0x3c2b('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x3c2b('0x4'));var config=require(_0x3c2b('0x5'));var controller=require(_0x3c2b('0x6'));router[_0x3c2b('0x7')]('/',auth['isAuthenticated'](),controller[_0x3c2b('0x8')]);router['get'](_0x3c2b('0x9'),auth[_0x3c2b('0xa')](),controller['describe']);router[_0x3c2b('0x7')]('/:id',auth[_0x3c2b('0xa')](),controller[_0x3c2b('0xb')]);router['get'](_0x3c2b('0xc'),auth[_0x3c2b('0xa')](),controller[_0x3c2b('0xd')]);router['get']('/:id/contacts',auth[_0x3c2b('0xa')](),controller[_0x3c2b('0xe')]);router['get'](_0x3c2b('0xf'),auth[_0x3c2b('0xa')](),controller[_0x3c2b('0x10')]);router[_0x3c2b('0x7')]('/:id/fields',auth[_0x3c2b('0xa')](),controller['getCustomFields']);router[_0x3c2b('0x7')]('/:id/users',auth[_0x3c2b('0xa')](),controller[_0x3c2b('0x11')]);router[_0x3c2b('0x12')]('/',auth[_0x3c2b('0xa')](),controller[_0x3c2b('0x13')]);router[_0x3c2b('0x12')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x3c2b('0x14')]);router['post']('/:id/contacts',auth[_0x3c2b('0xa')](),controller[_0x3c2b('0x15')]);router[_0x3c2b('0x12')]('/:id/fields',auth[_0x3c2b('0xa')](),controller[_0x3c2b('0x16')]);router['post'](_0x3c2b('0x17'),auth[_0x3c2b('0xa')](),controller[_0x3c2b('0x18')]);router[_0x3c2b('0x19')](_0x3c2b('0x1a'),auth[_0x3c2b('0xa')](),controller[_0x3c2b('0x1b')]);router[_0x3c2b('0x1c')]('/:id',auth[_0x3c2b('0xa')](),controller[_0x3c2b('0x1d')]);router[_0x3c2b('0x1c')](_0x3c2b('0xc'),auth[_0x3c2b('0xa')](),controller[_0x3c2b('0x1e')]);router['delete'](_0x3c2b('0x17'),auth[_0x3c2b('0xa')](),controller['removeAgents']);module[_0x3c2b('0x1f')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 88f3062..289847b 100644 --- a/server/api/condition/condition.attributes.js +++ b/server/api/condition/condition.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x404e97,_0x271132){var _0x527da1=function(_0x44c965){while(--_0x44c965){_0x404e97['push'](_0x404e97['shift']());}};_0x527da1(++_0x271132);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'get':function(_0x10a05d){return this['getDataValue'](_0x7995('0x3'));}},'field':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x459173,_0x2685e8){var _0x26cb72=function(_0x3cd2d1){while(--_0x3cd2d1){_0x459173['push'](_0x459173['shift']());}};_0x26cb72(++_0x2685e8);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'get':function(_0x10a05d){return this['getDataValue'](_0x7995('0x3'));}},'field':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index dc4abe3..5a69f84 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 _0xf79e=['sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','save','update','then','error','stack','name','body','Condition','find','params','destroy','catch','eml-format','rimraf','zip-dir','request-promise','moment','util','path'];(function(_0x4326d4,_0x29a654){var _0x3bfad1=function(_0x559216){while(--_0x559216){_0x4326d4['push'](_0x4326d4['shift']());}};_0x3bfad1(++_0x29a654);}(_0xf79e,0x185));var _0xef79=function(_0x2000c2,_0x5ea419){_0x2000c2=_0x2000c2-0x0;var _0x2c7711=_0xf79e[_0x2000c2];return _0x2c7711;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xef79('0x0'));var rimraf=require(_0xef79('0x1'));var zipdir=require(_0xef79('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xef79('0x3'));var moment=require(_0xef79('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xef79('0x5'));var path=require(_0xef79('0x6'));var sox=require(_0xef79('0x7'));var csv=require(_0xef79('0x8'));var ejs=require(_0xef79('0x9'));var fs=require('fs');var _=require(_0xef79('0xa'));var squel=require('squel');var crypto=require(_0xef79('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xef79('0xc'));var toCsv=require(_0xef79('0x8'));var querystring=require('querystring');var Papa=require(_0xef79('0xd'));var Redis=require(_0xef79('0xe'));var authService=require(_0xef79('0xf'));var qs=require(_0xef79('0x10'));var as=require(_0xef79('0x11'));var hardwareService=require(_0xef79('0x12'));var logger=require(_0xef79('0x13'))(_0xef79('0x14'));var utils=require('../../config/utils');var config=require(_0xef79('0x15'));var db=require(_0xef79('0x16'))['db'];function respondWithStatusCode(_0x1694a5,_0x29ef3d){_0x29ef3d=_0x29ef3d||0xcc;return function(_0x10f122){if(_0x10f122){return _0x1694a5[_0xef79('0x17')](_0x29ef3d);}return _0x1694a5[_0xef79('0x18')](_0x29ef3d)[_0xef79('0x19')]();};}function respondWithResult(_0x1d0dbf,_0x353e76){_0x353e76=_0x353e76||0xc8;return function(_0x4bc3ac){if(_0x4bc3ac){return _0x1d0dbf['status'](_0x353e76)['json'](_0x4bc3ac);}};}function respondWithFilteredResult(_0x499738,_0xe3dbe7){return function(_0x2b42bc){if(_0x2b42bc){var _0xfbbcfe=_0x2b42bc[_0xef79('0x1a')],_0x7a40d5=_0xe3dbe7['offset'],_0x548bf3=_0xe3dbe7[_0xef79('0x1b')]+_0xe3dbe7[_0xef79('0x1c')],_0x205a93;if(_0x548bf3>=_0xfbbcfe){_0x548bf3=_0xfbbcfe;_0x205a93=0xc8;}else{_0x205a93=0xce;}_0x499738[_0xef79('0x18')](_0x205a93);return _0x499738[_0xef79('0x1d')]('Content-Range',_0x7a40d5+'-'+_0x548bf3+'/'+_0xfbbcfe)[_0xef79('0x1e')](_0x2b42bc);}return null;};}function patchUpdates(_0x540f87){return function(_0xfed08b){try{jsonpatch[_0xef79('0x1f')](_0xfed08b,_0x540f87,!![]);}catch(_0xdba057){return BPromise['reject'](_0xdba057);}return _0xfed08b[_0xef79('0x20')]();};}function saveUpdates(_0x3902f9,_0x48e6e6){return function(_0x4a37e9){if(_0x4a37e9){return _0x4a37e9[_0xef79('0x21')](_0x3902f9)[_0xef79('0x22')](function(_0x5e14e2){return _0x5e14e2;});}return null;};}function removeEntity(_0x40cea7,_0x154bff){return function(_0x3ce762){if(_0x3ce762){return _0x3ce762['destroy']()[_0xef79('0x22')](function(){_0x40cea7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a125f,_0x196672){return function(_0x48b3f3){if(!_0x48b3f3){_0x1a125f[_0xef79('0x17')](0x194);}return _0x48b3f3;};}function handleError(_0x518be0,_0x285d4e){_0x285d4e=_0x285d4e||0x1f4;return function(_0x1393c4){logger[_0xef79('0x23')](_0x1393c4[_0xef79('0x24')]);if(_0x1393c4[_0xef79('0x25')]){delete _0x1393c4[_0xef79('0x25')];}_0x518be0[_0xef79('0x18')](_0x285d4e)['send'](_0x1393c4);};}exports[_0xef79('0x21')]=function(_0x52c241,_0x395674){if(_0x52c241['body']['id']){delete _0x52c241[_0xef79('0x26')]['id'];}return db[_0xef79('0x27')][_0xef79('0x28')]({'where':{'id':_0x52c241[_0xef79('0x29')]['id']}})[_0xef79('0x22')](handleEntityNotFound(_0x395674,null))[_0xef79('0x22')](saveUpdates(_0x52c241[_0xef79('0x26')],null))[_0xef79('0x22')](respondWithResult(_0x395674,null))['catch'](handleError(_0x395674,null));};exports[_0xef79('0x2a')]=function(_0x4b0d0d,_0x174eeb){return db[_0xef79('0x27')][_0xef79('0x28')]({'where':{'id':_0x4b0d0d[_0xef79('0x29')]['id']}})[_0xef79('0x22')](handleEntityNotFound(_0x174eeb,null))[_0xef79('0x22')](removeEntity(_0x174eeb,null))[_0xef79('0x2b')](handleError(_0x174eeb,null));}; \ No newline at end of file +var _0x416b=['util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','apply','reject','update','destroy','then','end','error','send','body','Condition','find','params','catch','html-pdf','eml-format','fast-json-patch','moment','bluebird','mustache'];(function(_0x21a051,_0x521e68){var _0x4d006c=function(_0x1df967){while(--_0x1df967){_0x21a051['push'](_0x21a051['shift']());}};_0x4d006c(++_0x521e68);}(_0x416b,0x1c8));var _0xb416=function(_0x5caee2,_0x325a65){_0x5caee2=_0x5caee2-0x0;var _0x3f8747=_0x416b[_0x5caee2];return _0x3f8747;};'use strict';var pdf=require(_0xb416('0x0'));var emlformat=require(_0xb416('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb416('0x2'));var rp=require('request-promise');var moment=require(_0xb416('0x3'));var BPromise=require(_0xb416('0x4'));var Mustache=require(_0xb416('0x5'));var util=require(_0xb416('0x6'));var path=require(_0xb416('0x7'));var sox=require(_0xb416('0x8'));var csv=require(_0xb416('0x9'));var ejs=require(_0xb416('0xa'));var fs=require('fs');var _=require(_0xb416('0xb'));var squel=require(_0xb416('0xc'));var crypto=require(_0xb416('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb416('0xe'));var toCsv=require(_0xb416('0x9'));var querystring=require(_0xb416('0xf'));var Papa=require('papaparse');var Redis=require(_0xb416('0x10'));var authService=require(_0xb416('0x11'));var qs=require(_0xb416('0x12'));var as=require(_0xb416('0x13'));var hardwareService=require(_0xb416('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xb416('0x15'));var db=require(_0xb416('0x16'))['db'];function respondWithStatusCode(_0x24f26f,_0x937be1){_0x937be1=_0x937be1||0xcc;return function(_0x5925f7){if(_0x5925f7){return _0x24f26f[_0xb416('0x17')](_0x937be1);}return _0x24f26f[_0xb416('0x18')](_0x937be1)['end']();};}function respondWithResult(_0xe0a004,_0x495a5c){_0x495a5c=_0x495a5c||0xc8;return function(_0x3c041e){if(_0x3c041e){return _0xe0a004[_0xb416('0x18')](_0x495a5c)[_0xb416('0x19')](_0x3c041e);}};}function respondWithFilteredResult(_0x3babec,_0x4cf40f){return function(_0x3320bf){if(_0x3320bf){var _0x26c222=_0x3320bf[_0xb416('0x1a')],_0x3eb85c=_0x4cf40f[_0xb416('0x1b')],_0x382978=_0x4cf40f['offset']+_0x4cf40f[_0xb416('0x1c')],_0x4bca1f;if(_0x382978>=_0x26c222){_0x382978=_0x26c222;_0x4bca1f=0xc8;}else{_0x4bca1f=0xce;}_0x3babec[_0xb416('0x18')](_0x4bca1f);return _0x3babec['set']('Content-Range',_0x3eb85c+'-'+_0x382978+'/'+_0x26c222)['json'](_0x3320bf);}return null;};}function patchUpdates(_0x42070e){return function(_0x362570){try{jsonpatch[_0xb416('0x1d')](_0x362570,_0x42070e,!![]);}catch(_0x398024){return BPromise[_0xb416('0x1e')](_0x398024);}return _0x362570['save']();};}function saveUpdates(_0xcff4dc,_0x3bd34b){return function(_0x1a7dd4){if(_0x1a7dd4){return _0x1a7dd4[_0xb416('0x1f')](_0xcff4dc)['then'](function(_0x19ab62){return _0x19ab62;});}return null;};}function removeEntity(_0x27d445,_0x16922f){return function(_0x22dc03){if(_0x22dc03){return _0x22dc03[_0xb416('0x20')]()[_0xb416('0x21')](function(){_0x27d445['status'](0xcc)[_0xb416('0x22')]();});}};}function handleEntityNotFound(_0x21f36d,_0x5a0132){return function(_0x16d7ce){if(!_0x16d7ce){_0x21f36d[_0xb416('0x17')](0x194);}return _0x16d7ce;};}function handleError(_0x607d50,_0x1ec5b0){_0x1ec5b0=_0x1ec5b0||0x1f4;return function(_0x3857f0){logger[_0xb416('0x23')](_0x3857f0['stack']);if(_0x3857f0['name']){delete _0x3857f0['name'];}_0x607d50['status'](_0x1ec5b0)[_0xb416('0x24')](_0x3857f0);};}exports['update']=function(_0x2aa4e0,_0x2cd038){if(_0x2aa4e0[_0xb416('0x25')]['id']){delete _0x2aa4e0['body']['id'];}return db[_0xb416('0x26')][_0xb416('0x27')]({'where':{'id':_0x2aa4e0[_0xb416('0x28')]['id']}})[_0xb416('0x21')](handleEntityNotFound(_0x2cd038,null))[_0xb416('0x21')](saveUpdates(_0x2aa4e0[_0xb416('0x25')],null))['then'](respondWithResult(_0x2cd038,null))[_0xb416('0x29')](handleError(_0x2cd038,null));};exports['destroy']=function(_0x4ba3af,_0x1988ea){return db[_0xb416('0x26')][_0xb416('0x27')]({'where':{'id':_0x4ba3af['params']['id']}})['then'](handleEntityNotFound(_0x1988ea,null))[_0xb416('0x21')](removeEntity(_0x1988ea,null))['catch'](handleError(_0x1988ea,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index d405995..8f7dc44 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 _0x5733=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./condition.attributes','exports','Condition','tools_conditions','lodash'];(function(_0x3ba927,_0x1a4b2c){var _0x2c88f5=function(_0x2fb08b){while(--_0x2fb08b){_0x3ba927['push'](_0x3ba927['shift']());}};_0x2c88f5(++_0x1a4b2c);}(_0x5733,0xa7));var _0x3573=function(_0x8dbed9,_0x19c180){_0x8dbed9=_0x8dbed9-0x0;var _0x4c49e9=_0x5733[_0x8dbed9];return _0x4c49e9;};'use strict';var _=require(_0x3573('0x0'));var util=require(_0x3573('0x1'));var logger=require(_0x3573('0x2'))(_0x3573('0x3'));var moment=require('moment');var BPromise=require(_0x3573('0x4'));var rp=require(_0x3573('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3573('0x6'));var config=require(_0x3573('0x7'));var attributes=require(_0x3573('0x8'));module[_0x3573('0x9')]=function(_0x2b47cc,_0x4f6971){return _0x2b47cc['define'](_0x3573('0xa'),attributes,{'tableName':_0x3573('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdcae=['../../config/logger','api','bluebird','path','./condition.attributes','define','Condition','tools_conditions','lodash','util'];(function(_0x38b135,_0x53d7d2){var _0x3096cc=function(_0x522239){while(--_0x522239){_0x38b135['push'](_0x38b135['shift']());}};_0x3096cc(++_0x53d7d2);}(_0xdcae,0x13e));var _0xedca=function(_0x1ded0f,_0x2c82a9){_0x1ded0f=_0x1ded0f-0x0;var _0x1ad47a=_0xdcae[_0x1ded0f];return _0x1ad47a;};'use strict';var _=require(_0xedca('0x0'));var util=require(_0xedca('0x1'));var logger=require(_0xedca('0x2'))(_0xedca('0x3'));var moment=require('moment');var BPromise=require(_0xedca('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xedca('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xedca('0x6'));module['exports']=function(_0x3be9e3,_0x5ea22f){return _0x3be9e3[_0xedca('0x7')](_0xedca('0x8'),attributes,{'tableName':_0xedca('0x9'),'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 33ae1c4..2098ab2 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 _0xa0e4=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','message','Condition,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x43e5ab,_0x4975a0){var _0x58ea0a=function(_0x35b921){while(--_0x35b921){_0x43e5ab['push'](_0x43e5ab['shift']());}};_0x58ea0a(++_0x4975a0);}(_0xa0e4,0x191));var _0x4a0e=function(_0x586642,_0x3b2e5d){_0x586642=_0x586642-0x0;var _0xef997a=_0xa0e4[_0x586642];return _0xef997a;};'use strict';var _=require(_0x4a0e('0x0'));var util=require(_0x4a0e('0x1'));var moment=require(_0x4a0e('0x2'));var BPromise=require(_0x4a0e('0x3'));var rs=require(_0x4a0e('0x4'));var fs=require('fs');var Redis=require(_0x4a0e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4a0e('0x6'));var logger=require(_0x4a0e('0x7'))('rpc');var config=require(_0x4a0e('0x8'));var jayson=require(_0x4a0e('0x9'));var client=jayson[_0x4a0e('0xa')][_0x4a0e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2c65b3,_0x126899,_0x1d77e9){return new BPromise(function(_0xad9bb5,_0x3fda13){return client[_0x4a0e('0xc')](_0x2c65b3,_0x1d77e9)[_0x4a0e('0xd')](function(_0x3389cb){logger[_0x4a0e('0xe')]('Condition,\x20%s,\x20%s',_0x126899,_0x4a0e('0xf'));logger[_0x4a0e('0x10')](_0x4a0e('0x11'),_0x126899,_0x4a0e('0xf'),JSON[_0x4a0e('0x12')](_0x3389cb));if(_0x3389cb['error']){if(_0x3389cb[_0x4a0e('0x13')]['code']===0x1f4){logger[_0x4a0e('0x13')]('Condition,\x20%s,\x20%s',_0x126899,_0x3389cb[_0x4a0e('0x13')][_0x4a0e('0x14')]);return _0x3fda13(_0x3389cb[_0x4a0e('0x13')][_0x4a0e('0x14')]);}logger[_0x4a0e('0x13')]('Condition,\x20%s,\x20%s',_0x126899,_0x3389cb[_0x4a0e('0x13')]['message']);return _0xad9bb5(_0x3389cb[_0x4a0e('0x13')][_0x4a0e('0x14')]);}else{logger['info'](_0x4a0e('0x15'),_0x126899,_0x4a0e('0xf'));_0xad9bb5(_0x3389cb[_0x4a0e('0x16')][_0x4a0e('0x14')]);}})[_0x4a0e('0x17')](function(_0xb7d675){logger[_0x4a0e('0x13')](_0x4a0e('0x15'),_0x126899,_0xb7d675);_0x3fda13(_0xb7d675);});});} \ No newline at end of file +var _0xec4e=['code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1e2f89,_0x2ea701){var _0x4484f8=function(_0x2abdfe){while(--_0x2abdfe){_0x1e2f89['push'](_0x1e2f89['shift']());}};_0x4484f8(++_0x2ea701);}(_0xec4e,0x13c));var _0xeec4=function(_0x45b7c6,_0x3eab8f){_0x45b7c6=_0x45b7c6-0x0;var _0x205928=_0xec4e[_0x45b7c6];return _0x205928;};'use strict';var _=require(_0xeec4('0x0'));var util=require(_0xeec4('0x1'));var moment=require('moment');var BPromise=require(_0xeec4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeec4('0x3'));var db=require(_0xeec4('0x4'))['db'];var utils=require(_0xeec4('0x5'));var logger=require(_0xeec4('0x6'))('rpc');var config=require(_0xeec4('0x7'));var jayson=require(_0xeec4('0x8'));var client=jayson[_0xeec4('0x9')][_0xeec4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5849c7,_0x300b9b,_0x1ee07c){return new BPromise(function(_0x552a20,_0x1a7e32){return client[_0xeec4('0xb')](_0x5849c7,_0x1ee07c)[_0xeec4('0xc')](function(_0x40c8cb){logger[_0xeec4('0xd')](_0xeec4('0xe'),_0x300b9b,_0xeec4('0xf'));logger[_0xeec4('0x10')](_0xeec4('0x11'),_0x300b9b,_0xeec4('0xf'),JSON[_0xeec4('0x12')](_0x40c8cb));if(_0x40c8cb[_0xeec4('0x13')]){if(_0x40c8cb['error'][_0xeec4('0x14')]===0x1f4){logger[_0xeec4('0x13')](_0xeec4('0xe'),_0x300b9b,_0x40c8cb[_0xeec4('0x13')][_0xeec4('0x15')]);return _0x1a7e32(_0x40c8cb[_0xeec4('0x13')]['message']);}logger[_0xeec4('0x13')](_0xeec4('0xe'),_0x300b9b,_0x40c8cb[_0xeec4('0x13')][_0xeec4('0x15')]);return _0x552a20(_0x40c8cb[_0xeec4('0x13')][_0xeec4('0x15')]);}else{logger[_0xeec4('0xd')](_0xeec4('0xe'),_0x300b9b,_0xeec4('0xf'));_0x552a20(_0x40c8cb[_0xeec4('0x16')]['message']);}})[_0xeec4('0x17')](function(_0x520ff7){logger[_0xeec4('0x13')](_0xeec4('0xe'),_0x300b9b,_0x520ff7);_0x1a7e32(_0x520ff7);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index d09adfa..1d977a4 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 _0xe1b1=['./condition.controller','put','/:id','isAuthenticated','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xe1b1,0x19d));var _0x1e1b=function(_0x162690,_0x3aa229){_0x162690=_0x162690-0x0;var _0x4df615=_0xe1b1[_0x162690];return _0x4df615;};'use strict';var multer=require(_0x1e1b('0x0'));var util=require('util');var path=require(_0x1e1b('0x1'));var timeout=require(_0x1e1b('0x2'));var express=require(_0x1e1b('0x3'));var router=express[_0x1e1b('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1e1b('0x5'));var config=require(_0x1e1b('0x6'));var controller=require(_0x1e1b('0x7'));router[_0x1e1b('0x8')](_0x1e1b('0x9'),auth[_0x1e1b('0xa')](),controller[_0x1e1b('0xb')]);router[_0x1e1b('0xc')](_0x1e1b('0x9'),auth[_0x1e1b('0xa')](),controller[_0x1e1b('0xd')]);module[_0x1e1b('0xe')]=router; \ No newline at end of file +var _0xf678=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','put','/:id','isAuthenticated','delete','exports'];(function(_0x57ed00,_0x39adc9){var _0x200220=function(_0x31350f){while(--_0x31350f){_0x57ed00['push'](_0x57ed00['shift']());}};_0x200220(++_0x39adc9);}(_0xf678,0x138));var _0x8f67=function(_0x43b019,_0x357367){_0x43b019=_0x43b019-0x0;var _0x5d9bed=_0xf678[_0x43b019];return _0x5d9bed;};'use strict';var multer=require('multer');var util=require(_0x8f67('0x0'));var path=require(_0x8f67('0x1'));var timeout=require(_0x8f67('0x2'));var express=require(_0x8f67('0x3'));var router=express[_0x8f67('0x4')]();var auth=require(_0x8f67('0x5'));var interaction=require(_0x8f67('0x6'));var config=require('../../config/environment');var controller=require('./condition.controller');router[_0x8f67('0x7')](_0x8f67('0x8'),auth[_0x8f67('0x9')](),controller['update']);router[_0x8f67('0xa')](_0x8f67('0x8'),auth[_0x8f67('0x9')](),controller['destroy']);module[_0x8f67('0xb')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 4e2e883..0ce2441 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 _0xaa96=['name','exports','STRING'];(function(_0x2c0c61,_0x147ede){var _0x23adbc=function(_0x55e9df){while(--_0x55e9df){_0x2c0c61['push'](_0x2c0c61['shift']());}};_0x23adbc(++_0x147ede);}(_0xaa96,0x145));var _0x6aa9=function(_0x13e115,_0x35835f){_0x13e115=_0x13e115-0x0;var _0x311265=_0xaa96[_0x13e115];return _0x311265;};'use strict';var Sequelize=require('sequelize');module[_0x6aa9('0x0')]={'name':{'type':Sequelize[_0x6aa9('0x1')],'allowNull':![],'unique':_0x6aa9('0x2')},'description':{'type':Sequelize[_0x6aa9('0x1')]}}; \ No newline at end of file +var _0xf404=['sequelize','name','STRING'];(function(_0x339a06,_0x48aaee){var _0xe94f58=function(_0x464416){while(--_0x464416){_0x339a06['push'](_0x339a06['shift']());}};_0xe94f58(++_0x48aaee);}(_0xf404,0x120));var _0x4f40=function(_0x78e3b9,_0x5924e2){_0x78e3b9=_0x78e3b9-0x0;var _0xbe684=_0xf404[_0x78e3b9];return _0xbe684;};'use strict';var Sequelize=require(_0x4f40('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4f40('0x1')},'description':{'type':Sequelize[_0x4f40('0x2')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 6da6c00..e3f8d0d 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 _0xaf92=['api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','query','model','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','includeAll','findAll','rows','catch','show','params','keys','fields','include','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','find','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','attrVoiceQueues','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','getItems','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x3a13ab,_0x114561){var _0x12d5c7=function(_0x54f0be){while(--_0x54f0be){_0x3a13ab['push'](_0x3a13ab['shift']());}};_0x12d5c7(++_0x114561);}(_0xaf92,0x67));var _0x2af9=function(_0x5cab26,_0x40d7bf){_0x5cab26=_0x5cab26-0x0;var _0x23e642=_0xaf92[_0x5cab26];return _0x23e642;};'use strict';var pdf=require(_0x2af9('0x0'));var emlformat=require(_0x2af9('0x1'));var rimraf=require(_0x2af9('0x2'));var zipdir=require(_0x2af9('0x3'));var jsonpatch=require(_0x2af9('0x4'));var rp=require(_0x2af9('0x5'));var moment=require(_0x2af9('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x2af9('0x7'));var util=require(_0x2af9('0x8'));var path=require(_0x2af9('0x9'));var sox=require('sox');var csv=require(_0x2af9('0xa'));var ejs=require(_0x2af9('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2af9('0xc'));var crypto=require(_0x2af9('0xd'));var jsforce=require(_0x2af9('0xe'));var deskjs=require(_0x2af9('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2af9('0x10'));var Papa=require(_0x2af9('0x11'));var Redis=require(_0x2af9('0x12'));var authService=require(_0x2af9('0x13'));var qs=require(_0x2af9('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2af9('0x15'));var logger=require(_0x2af9('0x16'))(_0x2af9('0x17'));var utils=require(_0x2af9('0x18'));var config=require(_0x2af9('0x19'));var db=require(_0x2af9('0x1a'))['db'];config[_0x2af9('0x1b')]=_[_0x2af9('0x1c')](config[_0x2af9('0x1b')],{'host':_0x2af9('0x1d'),'port':0x18eb});var socket=require(_0x2af9('0x1e'))(new Redis(config[_0x2af9('0x1b')]));require(_0x2af9('0x1f'))[_0x2af9('0x20')](socket);function respondWithStatusCode(_0x24b58f,_0x26b86c){_0x26b86c=_0x26b86c||0xcc;return function(_0x38cc87){if(_0x38cc87){return _0x24b58f[_0x2af9('0x21')](_0x26b86c);}return _0x24b58f['status'](_0x26b86c)[_0x2af9('0x22')]();};}function respondWithResult(_0x5f3316,_0x23a950){_0x23a950=_0x23a950||0xc8;return function(_0x53af25){if(_0x53af25){return _0x5f3316[_0x2af9('0x23')](_0x23a950)[_0x2af9('0x24')](_0x53af25);}};}function respondWithFilteredResult(_0x53bb19,_0x2ff658){return function(_0x46fa23){if(_0x46fa23){var _0xe5e4c1=_0x46fa23[_0x2af9('0x25')],_0x5c459c=_0x2ff658[_0x2af9('0x26')],_0x3698ae=_0x2ff658['offset']+_0x2ff658[_0x2af9('0x27')],_0x1eb9f1;if(_0x3698ae>=_0xe5e4c1){_0x3698ae=_0xe5e4c1;_0x1eb9f1=0xc8;}else{_0x1eb9f1=0xce;}_0x53bb19[_0x2af9('0x23')](_0x1eb9f1);return _0x53bb19[_0x2af9('0x28')](_0x2af9('0x29'),_0x5c459c+'-'+_0x3698ae+'/'+_0xe5e4c1)[_0x2af9('0x24')](_0x46fa23);}return null;};}function patchUpdates(_0x4f7a20){return function(_0x54b194){try{jsonpatch[_0x2af9('0x2a')](_0x54b194,_0x4f7a20,!![]);}catch(_0x34f5e1){return BPromise[_0x2af9('0x2b')](_0x34f5e1);}return _0x54b194[_0x2af9('0x2c')]();};}function saveUpdates(_0x517979,_0x403469){return function(_0x308a68){if(_0x308a68){return _0x308a68[_0x2af9('0x2d')](_0x517979)[_0x2af9('0x2e')](function(_0x6923b3){return _0x6923b3;});}return null;};}function removeEntity(_0x73d26d,_0x528be7){return function(_0x4058b5){if(_0x4058b5){return _0x4058b5[_0x2af9('0x2f')]()['then'](function(){var _0x521b67=_0x4058b5[_0x2af9('0x30')]({'plain':!![]});var _0x24eba2=_0x2af9('0x31');return db[_0x2af9('0x32')][_0x2af9('0x2f')]({'where':{'type':_0x24eba2,'resourceId':_0x521b67['id']}})['then'](function(){return _0x4058b5;});})['then'](function(){_0x73d26d[_0x2af9('0x23')](0xcc)[_0x2af9('0x22')]();});}};}function handleEntityNotFound(_0x2c1eec,_0x304dba){return function(_0x24b60e){if(!_0x24b60e){_0x2c1eec[_0x2af9('0x21')](0x194);}return _0x24b60e;};}function handleError(_0x5abf6b,_0x5d789c){_0x5d789c=_0x5d789c||0x1f4;return function(_0x3d7588){logger[_0x2af9('0x33')](_0x3d7588['stack']);if(_0x3d7588[_0x2af9('0x34')]){delete _0x3d7588[_0x2af9('0x34')];}_0x5abf6b[_0x2af9('0x23')](_0x5d789c)[_0x2af9('0x35')](_0x3d7588);};}exports[_0x2af9('0x36')]=function(_0x4f148d,_0x333295){var _0x48aae8={},_0x48a93f={},_0x370f2f={'count':0x0,'rows':[]};var _0x10c901=_[_0x2af9('0x37')](db[_0x2af9('0x38')][_0x2af9('0x39')],function(_0x19305){return{'name':_0x19305[_0x2af9('0x3a')],'type':_0x19305[_0x2af9('0x3b')][_0x2af9('0x3c')]};});_0x48a93f['model']=_[_0x2af9('0x37')](_0x10c901,'name');_0x48a93f['query']=_['keys'](_0x4f148d[_0x2af9('0x3d')]);_0x48a93f['filters']=_['intersection'](_0x48a93f[_0x2af9('0x3e')],_0x48a93f[_0x2af9('0x3d')]);_0x48aae8[_0x2af9('0x3f')]=_[_0x2af9('0x40')](_0x48a93f['model'],qs['fields'](_0x4f148d['query']['fields']));_0x48aae8['attributes']=_0x48aae8['attributes'][_0x2af9('0x41')]?_0x48aae8[_0x2af9('0x3f')]:_0x48a93f[_0x2af9('0x3e')];if(!_0x4f148d[_0x2af9('0x3d')][_0x2af9('0x42')](_0x2af9('0x43'))){_0x48aae8[_0x2af9('0x27')]=qs['limit'](_0x4f148d[_0x2af9('0x3d')][_0x2af9('0x27')]);_0x48aae8[_0x2af9('0x26')]=qs['offset'](_0x4f148d[_0x2af9('0x3d')]['offset']);}_0x48aae8[_0x2af9('0x44')]=qs[_0x2af9('0x45')](_0x4f148d['query'][_0x2af9('0x45')]);_0x48aae8['where']=qs[_0x2af9('0x46')](_[_0x2af9('0x47')](_0x4f148d[_0x2af9('0x3d')],_0x48a93f[_0x2af9('0x46')]),_0x10c901);if(_0x4f148d[_0x2af9('0x3d')][_0x2af9('0x48')]){_0x48aae8[_0x2af9('0x49')]=_[_0x2af9('0x4a')](_0x48aae8['where'],{'$or':_[_0x2af9('0x37')](_0x10c901,function(_0xe721d5){if(_0xe721d5[_0x2af9('0x3b')]!=='VIRTUAL'){var _0x3dd1e1={};_0x3dd1e1[_0xe721d5[_0x2af9('0x34')]]={'$like':'%'+_0x4f148d[_0x2af9('0x3d')][_0x2af9('0x48')]+'%'};return _0x3dd1e1;}})});}_0x48aae8=_['merge']({},_0x48aae8,_0x4f148d[_0x2af9('0x4b')]);var _0x1f9c41={'where':_0x48aae8[_0x2af9('0x49')]};return db[_0x2af9('0x38')]['count'](_0x1f9c41)[_0x2af9('0x2e')](function(_0x48a99a){_0x370f2f[_0x2af9('0x25')]=_0x48a99a;if(_0x4f148d[_0x2af9('0x3d')][_0x2af9('0x4c')]){_0x48aae8['include']=[{'all':!![]}];}return db['Dashboard'][_0x2af9('0x4d')](_0x48aae8);})[_0x2af9('0x2e')](function(_0x3f914f){_0x370f2f[_0x2af9('0x4e')]=_0x3f914f;return _0x370f2f;})[_0x2af9('0x2e')](respondWithFilteredResult(_0x333295,_0x48aae8))[_0x2af9('0x4f')](handleError(_0x333295,null));};exports[_0x2af9('0x50')]=function(_0x2ebab2,_0x37bc50){var _0x5e9f7d={'raw':![],'where':{'id':_0x2ebab2[_0x2af9('0x51')]['id']}},_0x107761={};_0x107761[_0x2af9('0x3e')]=_['keys'](db[_0x2af9('0x38')][_0x2af9('0x39')]);_0x107761['query']=_[_0x2af9('0x52')](_0x2ebab2[_0x2af9('0x3d')]);_0x107761[_0x2af9('0x46')]=_[_0x2af9('0x40')](_0x107761[_0x2af9('0x3e')],_0x107761[_0x2af9('0x3d')]);_0x5e9f7d[_0x2af9('0x3f')]=_[_0x2af9('0x40')](_0x107761[_0x2af9('0x3e')],qs[_0x2af9('0x53')](_0x2ebab2['query'][_0x2af9('0x53')]));_0x5e9f7d[_0x2af9('0x3f')]=_0x5e9f7d['attributes'][_0x2af9('0x41')]?_0x5e9f7d[_0x2af9('0x3f')]:_0x107761['model'];if(_0x2ebab2[_0x2af9('0x3d')][_0x2af9('0x4c')]){_0x5e9f7d[_0x2af9('0x54')]=[{'all':!![]}];}_0x5e9f7d=_[_0x2af9('0x4a')]({},_0x5e9f7d,_0x2ebab2['options']);return db[_0x2af9('0x38')]['find'](_0x5e9f7d)[_0x2af9('0x2e')](handleEntityNotFound(_0x37bc50,null))[_0x2af9('0x2e')](respondWithResult(_0x37bc50,null))[_0x2af9('0x4f')](handleError(_0x37bc50,null));};exports['create']=function(_0x59dbbb,_0x17ff2c){return db[_0x2af9('0x38')][_0x2af9('0x55')](_0x59dbbb[_0x2af9('0x56')],{})['then'](function(_0x5b25e4){var _0x377853=_0x59dbbb[_0x2af9('0x57')][_0x2af9('0x30')]({'plain':!![]});if(!_0x377853)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x377853[_0x2af9('0x58')]===_0x2af9('0x57')){var _0x5c1e91=_0x5b25e4[_0x2af9('0x30')]({'plain':!![]});var _0x27c399=_0x2af9('0x31');return db['UserProfileSection']['find']({'where':{'name':_0x27c399,'userProfileId':_0x377853[_0x2af9('0x59')]},'raw':!![]})[_0x2af9('0x2e')](function(_0x1bef27){if(_0x1bef27&&_0x1bef27[_0x2af9('0x5a')]===0x0){return db[_0x2af9('0x32')]['create']({'name':_0x5c1e91['name'],'resourceId':_0x5c1e91['id'],'type':_0x1bef27[_0x2af9('0x34')],'sectionId':_0x1bef27['id']},{})['then'](function(){return _0x5b25e4;});}else{return _0x5b25e4;}})[_0x2af9('0x4f')](function(_0x576bd8){logger['error'](_0x2af9('0x5b'),_0x576bd8);throw _0x576bd8;});}return _0x5b25e4;})[_0x2af9('0x2e')](respondWithResult(_0x17ff2c,0xc9))['catch'](handleError(_0x17ff2c,null));};exports[_0x2af9('0x5c')]=function(_0x94c7d2,_0xc3bbd8){var _0x5d9a55={'where':{'id':_0x94c7d2['params']['id']}},_0x357abe={};_0x357abe[_0x2af9('0x3e')]=_['keys'](db[_0x2af9('0x38')][_0x2af9('0x39')]);_0x5d9a55['attributes']=_[_0x2af9('0x40')](_0x357abe[_0x2af9('0x3e')],qs[_0x2af9('0x53')](_0x94c7d2[_0x2af9('0x3d')][_0x2af9('0x53')]));_0x5d9a55[_0x2af9('0x3f')]=_0x5d9a55[_0x2af9('0x3f')][_0x2af9('0x41')]?_0x5d9a55['attributes']:_0x357abe['model'];if(_0x94c7d2['query'][_0x2af9('0x4c')]){_0x5d9a55[_0x2af9('0x54')]=[{'all':!![]}];}_0x5d9a55=_[_0x2af9('0x4a')]({},_0x5d9a55,_0x94c7d2[_0x2af9('0x4b')]);return db[_0x2af9('0x38')][_0x2af9('0x5d')](_0x5d9a55)[_0x2af9('0x2e')](handleEntityNotFound(_0xc3bbd8,null))['then'](function(_0x3fda86){if(_0x3fda86){var _0x216421=_0x3fda86[_0x2af9('0x30')]({'plain':!![]});_0x216421=qs[_0x2af9('0x5e')](_0x216421,['id',_0x2af9('0x5f'),'updatedAt']);_0x94c7d2[_0x2af9('0x56')]=_[_0x2af9('0x5e')](_0x94c7d2[_0x2af9('0x56')],['id','createdAt',_0x2af9('0x60')]);return db[_0x2af9('0x38')]['create'](_[_0x2af9('0x4a')](_0x216421,_0x94c7d2[_0x2af9('0x56')]),{'include':_0x94c7d2[_0x2af9('0x3d')]['includeAll']?[{'all':!![]}]:undefined})[_0x2af9('0x2e')](function(_0x58bf88){var _0x120527=_0x94c7d2[_0x2af9('0x57')][_0x2af9('0x30')]({'plain':!![]});if(!_0x120527)throw new Error(_0x2af9('0x61'));if(_0x120527[_0x2af9('0x58')]===_0x2af9('0x57')){var _0xabe691=_0x58bf88['get']({'plain':!![]});var _0x4789c6=_0x2af9('0x31');return db['UserProfileSection'][_0x2af9('0x5d')]({'where':{'name':_0x4789c6,'userProfileId':_0x120527[_0x2af9('0x59')]},'raw':!![]})['then'](function(_0x2856a3){if(_0x2856a3&&_0x2856a3[_0x2af9('0x5a')]===0x0){return db[_0x2af9('0x32')][_0x2af9('0x55')]({'name':_0xabe691[_0x2af9('0x34')],'resourceId':_0xabe691['id'],'type':_0x2856a3[_0x2af9('0x34')],'sectionId':_0x2856a3['id']},{})['then'](function(){return _0x58bf88;});}else{return _0x58bf88;}})[_0x2af9('0x4f')](function(_0x524066){logger[_0x2af9('0x33')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x524066);throw _0x524066;});}return _0x58bf88;});}})[_0x2af9('0x2e')](respondWithResult(_0xc3bbd8,0xc9))[_0x2af9('0x4f')](handleError(_0xc3bbd8,null));};exports['update']=function(_0x2f187c,_0x3efbc9){if(_0x2f187c[_0x2af9('0x56')]['id']){delete _0x2f187c[_0x2af9('0x56')]['id'];}return db['Dashboard'][_0x2af9('0x5d')]({'where':{'id':_0x2f187c['params']['id']}})['then'](handleEntityNotFound(_0x3efbc9,null))[_0x2af9('0x2e')](saveUpdates(_0x2f187c[_0x2af9('0x56')],null))[_0x2af9('0x2e')](respondWithResult(_0x3efbc9,null))[_0x2af9('0x4f')](handleError(_0x3efbc9,null));};exports[_0x2af9('0x2f')]=function(_0x2ffe45,_0x4c2d08){return db[_0x2af9('0x38')][_0x2af9('0x5d')]({'where':{'id':_0x2ffe45[_0x2af9('0x51')]['id']}})[_0x2af9('0x2e')](handleEntityNotFound(_0x4c2d08,null))[_0x2af9('0x2e')](removeEntity(_0x4c2d08,null))[_0x2af9('0x4f')](handleError(_0x4c2d08,null));};function widgetAttributes(_0x4915cc){try{switch(_0x4915cc[_0x2af9('0x3b')]){case _0x2af9('0x62'):return[{'name':_0x2af9('0x63'),'value':_0x4915cc[_0x2af9('0x63')]||(_0x4915cc['attrs']&&_0x4915cc['attrs'][0x0]?_0x4915cc[_0x2af9('0x64')][0x0][_0x2af9('0x65')]:undefined)||'https://'}];case _0x2af9('0x66'):return[{'name':_0x2af9('0x67'),'value':_0x4915cc['attrPath']||(_0x4915cc[_0x2af9('0x64')]&&_0x4915cc['attrs'][0x0]?_0x4915cc[_0x2af9('0x64')][0x0][_0x2af9('0x65')]:undefined)||''}];case _0x2af9('0x68'):return[{'name':'attrHourFormat','value':_0x4915cc[_0x2af9('0x69')]||(_0x4915cc['attrs']&&_0x4915cc[_0x2af9('0x64')][0x0]?_0x4915cc[_0x2af9('0x64')][0x0]['value']:undefined)||_0x2af9('0x6a')},{'name':_0x2af9('0x6b'),'value':_0x4915cc[_0x2af9('0x6b')]||(_0x4915cc[_0x2af9('0x64')]&&_0x4915cc[_0x2af9('0x64')][0x1]?_0x4915cc[_0x2af9('0x64')][0x1][_0x2af9('0x65')]:undefined)||_0x2af9('0x6c')},{'name':_0x2af9('0x6d'),'value':_0x4915cc['attrFontSize']||(_0x4915cc['attrs']&&_0x4915cc[_0x2af9('0x64')][0x2]?_0x4915cc[_0x2af9('0x64')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x2af9('0x6e'),'value':_0x4915cc[_0x2af9('0x6e')]||(_0x4915cc[_0x2af9('0x64')]&&_0x4915cc[_0x2af9('0x64')][0x0]?_0x4915cc[_0x2af9('0x64')][0x0][_0x2af9('0x65')]:undefined)||'total'},{'name':_0x2af9('0x6f'),'value':_0x4915cc['attrVoiceQueues']||(_0x4915cc[_0x2af9('0x64')]&&_0x4915cc[_0x2af9('0x64')][0x1]?_0x4915cc[_0x2af9('0x64')][0x1][_0x2af9('0x65')]:undefined)||[]},{'name':_0x2af9('0x6d'),'value':_0x4915cc[_0x2af9('0x6d')]||(_0x4915cc[_0x2af9('0x64')]&&_0x4915cc[_0x2af9('0x64')][0x2]?_0x4915cc[_0x2af9('0x64')][0x2][_0x2af9('0x65')]:undefined)||0x14}];case'multibar-chart':case _0x2af9('0x70'):return[{'name':_0x2af9('0x71'),'value':_0x4915cc['attrSerie1']||(_0x4915cc[_0x2af9('0x64')]&&_0x4915cc['attrs'][0x0]?_0x4915cc['attrs'][0x0]['value']:undefined)||_0x2af9('0x72')},{'name':'attrSerie2','value':_0x4915cc[_0x2af9('0x73')]||(_0x4915cc[_0x2af9('0x64')]&&_0x4915cc[_0x2af9('0x64')][0x1]?_0x4915cc[_0x2af9('0x64')][0x1][_0x2af9('0x65')]:undefined)||null},{'name':_0x2af9('0x74'),'value':_0x4915cc[_0x2af9('0x74')]||(_0x4915cc[_0x2af9('0x64')]&&_0x4915cc[_0x2af9('0x64')][0x2]?_0x4915cc['attrs'][0x2][_0x2af9('0x65')]:undefined)||null},{'name':_0x2af9('0x6f'),'value':_0x4915cc['attrVoiceQueues']||(_0x4915cc[_0x2af9('0x64')]&&_0x4915cc[_0x2af9('0x64')][0x3]?_0x4915cc[_0x2af9('0x64')][0x3][_0x2af9('0x65')]:undefined)||[]}];case _0x2af9('0x75'):return[{'name':_0x2af9('0x76'),'type':_0x4915cc[_0x2af9('0x77')]||(_0x4915cc[_0x2af9('0x64')]&&_0x4915cc[_0x2af9('0x64')][0x0]?_0x4915cc[_0x2af9('0x64')][0x0][_0x2af9('0x3b')]:undefined)||null,'value':_0x4915cc[_0x2af9('0x76')]||(_0x4915cc[_0x2af9('0x64')]&&_0x4915cc[_0x2af9('0x64')][0x0]?_0x4915cc[_0x2af9('0x64')][0x0]['value']:undefined)||null},{'name':_0x2af9('0x78'),'value':_0x4915cc[_0x2af9('0x78')]||(_0x4915cc[_0x2af9('0x64')]&&_0x4915cc[_0x2af9('0x64')][0x1]?_0x4915cc[_0x2af9('0x64')][0x1][_0x2af9('0x65')]:undefined)||0x0}];default:return[];}}catch(_0x330904){logger[_0x2af9('0x33')](_0x2af9('0x79'),JSON[_0x2af9('0x7a')](_0x330904));return[];}}exports[_0x2af9('0x7b')]=function(_0x4d6a9b,_0x473c7f,_0x258786){if(_0x4d6a9b[_0x2af9('0x56')]['id']){delete _0x4d6a9b[_0x2af9('0x56')]['id'];}return db[_0x2af9('0x38')][_0x2af9('0x5d')]({'where':{'id':_0x4d6a9b[_0x2af9('0x51')]['id']}})[_0x2af9('0x2e')](handleEntityNotFound(_0x473c7f,null))[_0x2af9('0x2e')](function(_0x49c756){if(_0x49c756){_0x4d6a9b['body']['DashboardId']=_0x49c756['id'];_0x4d6a9b[_0x2af9('0x56')][_0x2af9('0x64')]=widgetAttributes(_0x4d6a9b['body']);return db[_0x2af9('0x7c')][_0x2af9('0x55')](_0x4d6a9b['body']);}})[_0x2af9('0x2e')](respondWithResult(_0x473c7f,null))[_0x2af9('0x4f')](handleError(_0x473c7f,null));};exports[_0x2af9('0x7d')]=function(_0x43685f,_0x4bd7a3,_0x38ad54){var _0x3e2417={};var _0x46831f={};var _0xbdc47e;var _0x5dd88c;return db[_0x2af9('0x38')]['findOne']({'where':{'id':_0x43685f['params']['id']}})['then'](handleEntityNotFound(_0x4bd7a3,null))[_0x2af9('0x2e')](function(_0x23572d){if(_0x23572d){_0xbdc47e=_0x23572d;_0x46831f[_0x2af9('0x3e')]=_[_0x2af9('0x52')](db[_0x2af9('0x7c')][_0x2af9('0x39')]);_0x46831f[_0x2af9('0x3d')]=_[_0x2af9('0x52')](_0x43685f[_0x2af9('0x3d')]);_0x46831f[_0x2af9('0x46')]=_[_0x2af9('0x40')](_0x46831f[_0x2af9('0x3e')],_0x46831f[_0x2af9('0x3d')]);_0x3e2417['attributes']=_[_0x2af9('0x40')](_0x46831f[_0x2af9('0x3e')],qs['fields'](_0x43685f['query'][_0x2af9('0x53')]));_0x3e2417[_0x2af9('0x3f')]=_0x3e2417['attributes']['length']?_0x3e2417['attributes']:_0x46831f[_0x2af9('0x3e')];_0x3e2417[_0x2af9('0x44')]=qs['sort'](_0x43685f[_0x2af9('0x3d')][_0x2af9('0x45')]);_0x3e2417[_0x2af9('0x49')]=qs[_0x2af9('0x46')](_[_0x2af9('0x47')](_0x43685f[_0x2af9('0x3d')],_0x46831f['filters']));if(_0x43685f[_0x2af9('0x3d')][_0x2af9('0x48')]){_0x3e2417['where']=_[_0x2af9('0x4a')](_0x3e2417['where'],{'$or':_[_0x2af9('0x37')](_0x3e2417[_0x2af9('0x3f')],function(_0xcaf9d9){var _0x36bea2={};_0x36bea2[_0xcaf9d9]={'$like':'%'+_0x43685f[_0x2af9('0x3d')][_0x2af9('0x48')]+'%'};return _0x36bea2;})});}_0x3e2417=_[_0x2af9('0x4a')]({},_0x3e2417,_0x43685f['options']);return _0xbdc47e[_0x2af9('0x7d')](_0x3e2417);}})['then'](function(_0x269f92){if(_0x269f92){_0x5dd88c=_0x269f92[_0x2af9('0x41')];if(!_0x43685f['query'][_0x2af9('0x42')](_0x2af9('0x43'))){_0x3e2417[_0x2af9('0x27')]=qs[_0x2af9('0x27')](_0x43685f[_0x2af9('0x3d')][_0x2af9('0x27')]);_0x3e2417[_0x2af9('0x26')]=qs[_0x2af9('0x26')](_0x43685f[_0x2af9('0x3d')][_0x2af9('0x26')]);}return _0xbdc47e[_0x2af9('0x7d')](_0x3e2417);}})['then'](function(_0x218e79){if(_0x218e79){return _0x218e79?{'count':_0x5dd88c,'rows':_0x218e79}:null;}})[_0x2af9('0x2e')](respondWithResult(_0x4bd7a3,null))[_0x2af9('0x4f')](handleError(_0x4bd7a3,null));}; \ No newline at end of file +var _0x7f04=['getItems','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','CustomDashboards','UserProfileResource','then','error','stack','name','send','index','map','Dashboard','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','rawAttributes','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','catch','createdAt','updatedAt','omit','body','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','findOne','DashboardItem','order','sort'];(function(_0x3e48ea,_0x449c4d){var _0x57eb9d=function(_0x1a5957){while(--_0x1a5957){_0x3e48ea['push'](_0x3e48ea['shift']());}};_0x57eb9d(++_0x449c4d);}(_0x7f04,0xf9));var _0x47f0=function(_0x129954,_0x17b156){_0x129954=_0x129954-0x0;var _0x2b40f2=_0x7f04[_0x129954];return _0x2b40f2;};'use strict';var pdf=require(_0x47f0('0x0'));var emlformat=require(_0x47f0('0x1'));var rimraf=require(_0x47f0('0x2'));var zipdir=require(_0x47f0('0x3'));var jsonpatch=require(_0x47f0('0x4'));var rp=require(_0x47f0('0x5'));var moment=require(_0x47f0('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x47f0('0x7'));var util=require('util');var path=require(_0x47f0('0x8'));var sox=require(_0x47f0('0x9'));var csv=require(_0x47f0('0xa'));var ejs=require(_0x47f0('0xb'));var fs=require('fs');var _=require(_0x47f0('0xc'));var squel=require('squel');var crypto=require(_0x47f0('0xd'));var jsforce=require(_0x47f0('0xe'));var deskjs=require(_0x47f0('0xf'));var toCsv=require(_0x47f0('0xa'));var querystring=require('querystring');var Papa=require(_0x47f0('0x10'));var Redis=require(_0x47f0('0x11'));var authService=require(_0x47f0('0x12'));var qs=require(_0x47f0('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x47f0('0x14'));var logger=require(_0x47f0('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x47f0('0x16'))['db'];config[_0x47f0('0x17')]=_[_0x47f0('0x18')](config['redis'],{'host':_0x47f0('0x19'),'port':0x18eb});var socket=require(_0x47f0('0x1a'))(new Redis(config[_0x47f0('0x17')]));require('./dashboard.socket')[_0x47f0('0x1b')](socket);function respondWithStatusCode(_0x3da344,_0x132d00){_0x132d00=_0x132d00||0xcc;return function(_0x5e5e79){if(_0x5e5e79){return _0x3da344[_0x47f0('0x1c')](_0x132d00);}return _0x3da344[_0x47f0('0x1d')](_0x132d00)[_0x47f0('0x1e')]();};}function respondWithResult(_0x147c31,_0x3e839){_0x3e839=_0x3e839||0xc8;return function(_0x34592d){if(_0x34592d){return _0x147c31[_0x47f0('0x1d')](_0x3e839)[_0x47f0('0x1f')](_0x34592d);}};}function respondWithFilteredResult(_0x45117f,_0xd854a5){return function(_0x318061){if(_0x318061){var _0x5f0d03=_0x318061[_0x47f0('0x20')],_0x814fa7=_0xd854a5[_0x47f0('0x21')],_0x2107ad=_0xd854a5['offset']+_0xd854a5[_0x47f0('0x22')],_0x313202;if(_0x2107ad>=_0x5f0d03){_0x2107ad=_0x5f0d03;_0x313202=0xc8;}else{_0x313202=0xce;}_0x45117f['status'](_0x313202);return _0x45117f[_0x47f0('0x23')](_0x47f0('0x24'),_0x814fa7+'-'+_0x2107ad+'/'+_0x5f0d03)['json'](_0x318061);}return null;};}function patchUpdates(_0x5f3663){return function(_0x38cfc2){try{jsonpatch[_0x47f0('0x25')](_0x38cfc2,_0x5f3663,!![]);}catch(_0x1363c6){return BPromise[_0x47f0('0x26')](_0x1363c6);}return _0x38cfc2[_0x47f0('0x27')]();};}function saveUpdates(_0x427faa,_0x1f1016){return function(_0x5c53b1){if(_0x5c53b1){return _0x5c53b1[_0x47f0('0x28')](_0x427faa)['then'](function(_0x5880c9){return _0x5880c9;});}return null;};}function removeEntity(_0x1f973b,_0xdb3790){return function(_0x43988a){if(_0x43988a){return _0x43988a[_0x47f0('0x29')]()['then'](function(){var _0x2bfaad=_0x43988a[_0x47f0('0x2a')]({'plain':!![]});var _0x5b20ff=_0x47f0('0x2b');return db[_0x47f0('0x2c')][_0x47f0('0x29')]({'where':{'type':_0x5b20ff,'resourceId':_0x2bfaad['id']}})[_0x47f0('0x2d')](function(){return _0x43988a;});})['then'](function(){_0x1f973b[_0x47f0('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x539b4c,_0x574a44){return function(_0x5ef1ee){if(!_0x5ef1ee){_0x539b4c['sendStatus'](0x194);}return _0x5ef1ee;};}function handleError(_0x30f564,_0x1c1abc){_0x1c1abc=_0x1c1abc||0x1f4;return function(_0x415593){logger[_0x47f0('0x2e')](_0x415593[_0x47f0('0x2f')]);if(_0x415593[_0x47f0('0x30')]){delete _0x415593['name'];}_0x30f564[_0x47f0('0x1d')](_0x1c1abc)[_0x47f0('0x31')](_0x415593);};}exports[_0x47f0('0x32')]=function(_0x3b85b4,_0x547eed){var _0x303d23={},_0x57c60f={},_0x44743e={'count':0x0,'rows':[]};var _0x3bcfdb=_[_0x47f0('0x33')](db[_0x47f0('0x34')]['rawAttributes'],function(_0x23cd84){return{'name':_0x23cd84[_0x47f0('0x35')],'type':_0x23cd84[_0x47f0('0x36')][_0x47f0('0x37')]};});_0x57c60f[_0x47f0('0x38')]=_[_0x47f0('0x33')](_0x3bcfdb,_0x47f0('0x30'));_0x57c60f[_0x47f0('0x39')]=_[_0x47f0('0x3a')](_0x3b85b4[_0x47f0('0x39')]);_0x57c60f['filters']=_[_0x47f0('0x3b')](_0x57c60f[_0x47f0('0x38')],_0x57c60f['query']);_0x303d23[_0x47f0('0x3c')]=_['intersection'](_0x57c60f[_0x47f0('0x38')],qs[_0x47f0('0x3d')](_0x3b85b4[_0x47f0('0x39')][_0x47f0('0x3d')]));_0x303d23[_0x47f0('0x3c')]=_0x303d23[_0x47f0('0x3c')][_0x47f0('0x3e')]?_0x303d23['attributes']:_0x57c60f[_0x47f0('0x38')];if(!_0x3b85b4[_0x47f0('0x39')][_0x47f0('0x3f')](_0x47f0('0x40'))){_0x303d23['limit']=qs['limit'](_0x3b85b4['query'][_0x47f0('0x22')]);_0x303d23[_0x47f0('0x21')]=qs[_0x47f0('0x21')](_0x3b85b4[_0x47f0('0x39')]['offset']);}_0x303d23['order']=qs['sort'](_0x3b85b4[_0x47f0('0x39')]['sort']);_0x303d23[_0x47f0('0x41')]=qs[_0x47f0('0x42')](_[_0x47f0('0x43')](_0x3b85b4['query'],_0x57c60f[_0x47f0('0x42')]),_0x3bcfdb);if(_0x3b85b4[_0x47f0('0x39')][_0x47f0('0x44')]){_0x303d23[_0x47f0('0x41')]=_[_0x47f0('0x45')](_0x303d23[_0x47f0('0x41')],{'$or':_['map'](_0x3bcfdb,function(_0x38b20e){if(_0x38b20e[_0x47f0('0x36')]!==_0x47f0('0x46')){var _0x419a99={};_0x419a99[_0x38b20e['name']]={'$like':'%'+_0x3b85b4[_0x47f0('0x39')][_0x47f0('0x44')]+'%'};return _0x419a99;}})});}_0x303d23=_['merge']({},_0x303d23,_0x3b85b4[_0x47f0('0x47')]);var _0x436714={'where':_0x303d23[_0x47f0('0x41')]};return db[_0x47f0('0x34')][_0x47f0('0x20')](_0x436714)[_0x47f0('0x2d')](function(_0x3a2d3d){_0x44743e['count']=_0x3a2d3d;if(_0x3b85b4[_0x47f0('0x39')][_0x47f0('0x48')]){_0x303d23['include']=[{'all':!![]}];}return db[_0x47f0('0x34')][_0x47f0('0x49')](_0x303d23);})[_0x47f0('0x2d')](function(_0x20cae0){_0x44743e[_0x47f0('0x4a')]=_0x20cae0;return _0x44743e;})[_0x47f0('0x2d')](respondWithFilteredResult(_0x547eed,_0x303d23))['catch'](handleError(_0x547eed,null));};exports[_0x47f0('0x4b')]=function(_0x3d4dea,_0xe3db75){var _0x48175e={'raw':![],'where':{'id':_0x3d4dea[_0x47f0('0x4c')]['id']}},_0x202cd4={};_0x202cd4[_0x47f0('0x38')]=_['keys'](db[_0x47f0('0x34')][_0x47f0('0x4d')]);_0x202cd4['query']=_[_0x47f0('0x3a')](_0x3d4dea[_0x47f0('0x39')]);_0x202cd4['filters']=_[_0x47f0('0x3b')](_0x202cd4[_0x47f0('0x38')],_0x202cd4[_0x47f0('0x39')]);_0x48175e[_0x47f0('0x3c')]=_['intersection'](_0x202cd4[_0x47f0('0x38')],qs[_0x47f0('0x3d')](_0x3d4dea['query'][_0x47f0('0x3d')]));_0x48175e[_0x47f0('0x3c')]=_0x48175e['attributes']['length']?_0x48175e[_0x47f0('0x3c')]:_0x202cd4[_0x47f0('0x38')];if(_0x3d4dea['query'][_0x47f0('0x48')]){_0x48175e[_0x47f0('0x4e')]=[{'all':!![]}];}_0x48175e=_[_0x47f0('0x45')]({},_0x48175e,_0x3d4dea[_0x47f0('0x47')]);return db['Dashboard'][_0x47f0('0x4f')](_0x48175e)[_0x47f0('0x2d')](handleEntityNotFound(_0xe3db75,null))['then'](respondWithResult(_0xe3db75,null))['catch'](handleError(_0xe3db75,null));};exports[_0x47f0('0x50')]=function(_0xe8f6a9,_0x370143){return db[_0x47f0('0x34')][_0x47f0('0x50')](_0xe8f6a9['body'],{})['then'](function(_0x1e0d80){var _0x35a519=_0xe8f6a9[_0x47f0('0x51')][_0x47f0('0x2a')]({'plain':!![]});if(!_0x35a519)throw new Error(_0x47f0('0x52'));if(_0x35a519['role']==='user'){var _0x5f5bf6=_0x1e0d80[_0x47f0('0x2a')]({'plain':!![]});var _0x299c3a=_0x47f0('0x2b');return db[_0x47f0('0x53')][_0x47f0('0x4f')]({'where':{'name':_0x299c3a,'userProfileId':_0x35a519['userProfileId']},'raw':!![]})['then'](function(_0x6c342b){if(_0x6c342b&&_0x6c342b[_0x47f0('0x54')]===0x0){return db[_0x47f0('0x2c')][_0x47f0('0x50')]({'name':_0x5f5bf6[_0x47f0('0x30')],'resourceId':_0x5f5bf6['id'],'type':_0x6c342b[_0x47f0('0x30')],'sectionId':_0x6c342b['id']},{})[_0x47f0('0x2d')](function(){return _0x1e0d80;});}else{return _0x1e0d80;}})[_0x47f0('0x55')](function(_0x454c9b){logger[_0x47f0('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x454c9b);throw _0x454c9b;});}return _0x1e0d80;})[_0x47f0('0x2d')](respondWithResult(_0x370143,0xc9))['catch'](handleError(_0x370143,null));};exports['clone']=function(_0x5ecb81,_0x3a0d09){var _0x3b9acb={'where':{'id':_0x5ecb81['params']['id']}},_0x463272={};_0x463272[_0x47f0('0x38')]=_[_0x47f0('0x3a')](db[_0x47f0('0x34')][_0x47f0('0x4d')]);_0x3b9acb[_0x47f0('0x3c')]=_[_0x47f0('0x3b')](_0x463272['model'],qs[_0x47f0('0x3d')](_0x5ecb81[_0x47f0('0x39')][_0x47f0('0x3d')]));_0x3b9acb[_0x47f0('0x3c')]=_0x3b9acb[_0x47f0('0x3c')][_0x47f0('0x3e')]?_0x3b9acb[_0x47f0('0x3c')]:_0x463272[_0x47f0('0x38')];if(_0x5ecb81[_0x47f0('0x39')][_0x47f0('0x48')]){_0x3b9acb['include']=[{'all':!![]}];}_0x3b9acb=_[_0x47f0('0x45')]({},_0x3b9acb,_0x5ecb81[_0x47f0('0x47')]);return db[_0x47f0('0x34')][_0x47f0('0x4f')](_0x3b9acb)[_0x47f0('0x2d')](handleEntityNotFound(_0x3a0d09,null))[_0x47f0('0x2d')](function(_0x3a8ed8){if(_0x3a8ed8){var _0x175712=_0x3a8ed8[_0x47f0('0x2a')]({'plain':!![]});_0x175712=qs['omit'](_0x175712,['id',_0x47f0('0x56'),_0x47f0('0x57')]);_0x5ecb81['body']=_[_0x47f0('0x58')](_0x5ecb81[_0x47f0('0x59')],['id',_0x47f0('0x56'),_0x47f0('0x57')]);return db[_0x47f0('0x34')]['create'](_[_0x47f0('0x45')](_0x175712,_0x5ecb81[_0x47f0('0x59')]),{'include':_0x5ecb81[_0x47f0('0x39')][_0x47f0('0x48')]?[{'all':!![]}]:undefined})[_0x47f0('0x2d')](function(_0x204541){var _0x357813=_0x5ecb81[_0x47f0('0x51')][_0x47f0('0x2a')]({'plain':!![]});if(!_0x357813)throw new Error(_0x47f0('0x52'));if(_0x357813[_0x47f0('0x5a')]===_0x47f0('0x51')){var _0x21d730=_0x204541[_0x47f0('0x2a')]({'plain':!![]});var _0x449a04='CustomDashboards';return db[_0x47f0('0x53')][_0x47f0('0x4f')]({'where':{'name':_0x449a04,'userProfileId':_0x357813[_0x47f0('0x5b')]},'raw':!![]})[_0x47f0('0x2d')](function(_0x33aed5){if(_0x33aed5&&_0x33aed5[_0x47f0('0x54')]===0x0){return db['UserProfileResource'][_0x47f0('0x50')]({'name':_0x21d730[_0x47f0('0x30')],'resourceId':_0x21d730['id'],'type':_0x33aed5[_0x47f0('0x30')],'sectionId':_0x33aed5['id']},{})[_0x47f0('0x2d')](function(){return _0x204541;});}else{return _0x204541;}})[_0x47f0('0x55')](function(_0x8869bd){logger[_0x47f0('0x2e')](_0x47f0('0x5c'),_0x8869bd);throw _0x8869bd;});}return _0x204541;});}})[_0x47f0('0x2d')](respondWithResult(_0x3a0d09,0xc9))[_0x47f0('0x55')](handleError(_0x3a0d09,null));};exports[_0x47f0('0x28')]=function(_0x2da265,_0x4976b5){if(_0x2da265[_0x47f0('0x59')]['id']){delete _0x2da265[_0x47f0('0x59')]['id'];}return db[_0x47f0('0x34')][_0x47f0('0x4f')]({'where':{'id':_0x2da265[_0x47f0('0x4c')]['id']}})[_0x47f0('0x2d')](handleEntityNotFound(_0x4976b5,null))['then'](saveUpdates(_0x2da265[_0x47f0('0x59')],null))[_0x47f0('0x2d')](respondWithResult(_0x4976b5,null))[_0x47f0('0x55')](handleError(_0x4976b5,null));};exports['destroy']=function(_0x525a39,_0x3b820b){return db['Dashboard'][_0x47f0('0x4f')]({'where':{'id':_0x525a39[_0x47f0('0x4c')]['id']}})[_0x47f0('0x2d')](handleEntityNotFound(_0x3b820b,null))[_0x47f0('0x2d')](removeEntity(_0x3b820b,null))[_0x47f0('0x55')](handleError(_0x3b820b,null));};function widgetAttributes(_0x4c970a){try{switch(_0x4c970a['type']){case'iframe':return[{'name':_0x47f0('0x5d'),'value':_0x4c970a[_0x47f0('0x5d')]||(_0x4c970a[_0x47f0('0x5e')]&&_0x4c970a[_0x47f0('0x5e')][0x0]?_0x4c970a['attrs'][0x0][_0x47f0('0x5f')]:undefined)||_0x47f0('0x60')}];case _0x47f0('0x61'):return[{'name':_0x47f0('0x62'),'value':_0x4c970a[_0x47f0('0x62')]||(_0x4c970a[_0x47f0('0x5e')]&&_0x4c970a[_0x47f0('0x5e')][0x0]?_0x4c970a[_0x47f0('0x5e')][0x0][_0x47f0('0x5f')]:undefined)||''}];case'clock':return[{'name':_0x47f0('0x63'),'value':_0x4c970a['attrHourFormat']||(_0x4c970a[_0x47f0('0x5e')]&&_0x4c970a[_0x47f0('0x5e')][0x0]?_0x4c970a[_0x47f0('0x5e')][0x0][_0x47f0('0x5f')]:undefined)||'HH:mm:ss'},{'name':_0x47f0('0x64'),'value':_0x4c970a[_0x47f0('0x64')]||(_0x4c970a[_0x47f0('0x5e')]&&_0x4c970a[_0x47f0('0x5e')][0x1]?_0x4c970a['attrs'][0x1]['value']:undefined)||_0x47f0('0x65')},{'name':_0x47f0('0x66'),'value':_0x4c970a[_0x47f0('0x66')]||(_0x4c970a[_0x47f0('0x5e')]&&_0x4c970a[_0x47f0('0x5e')][0x2]?_0x4c970a[_0x47f0('0x5e')][0x2][_0x47f0('0x5f')]:undefined)||0xc}];case _0x47f0('0x67'):return[{'name':_0x47f0('0x68'),'value':_0x4c970a['attrMetric']||(_0x4c970a[_0x47f0('0x5e')]&&_0x4c970a[_0x47f0('0x5e')][0x0]?_0x4c970a[_0x47f0('0x5e')][0x0][_0x47f0('0x5f')]:undefined)||_0x47f0('0x69')},{'name':_0x47f0('0x6a'),'value':_0x4c970a[_0x47f0('0x6a')]||(_0x4c970a[_0x47f0('0x5e')]&&_0x4c970a[_0x47f0('0x5e')][0x1]?_0x4c970a['attrs'][0x1][_0x47f0('0x5f')]:undefined)||[]},{'name':_0x47f0('0x66'),'value':_0x4c970a[_0x47f0('0x66')]||(_0x4c970a['attrs']&&_0x4c970a[_0x47f0('0x5e')][0x2]?_0x4c970a[_0x47f0('0x5e')][0x2][_0x47f0('0x5f')]:undefined)||0x14}];case _0x47f0('0x6b'):case _0x47f0('0x6c'):return[{'name':_0x47f0('0x6d'),'value':_0x4c970a[_0x47f0('0x6d')]||(_0x4c970a[_0x47f0('0x5e')]&&_0x4c970a[_0x47f0('0x5e')][0x0]?_0x4c970a['attrs'][0x0][_0x47f0('0x5f')]:undefined)||_0x47f0('0x69')},{'name':_0x47f0('0x6e'),'value':_0x4c970a[_0x47f0('0x6e')]||(_0x4c970a[_0x47f0('0x5e')]&&_0x4c970a['attrs'][0x1]?_0x4c970a[_0x47f0('0x5e')][0x1]['value']:undefined)||null},{'name':_0x47f0('0x6f'),'value':_0x4c970a[_0x47f0('0x6f')]||(_0x4c970a[_0x47f0('0x5e')]&&_0x4c970a[_0x47f0('0x5e')][0x2]?_0x4c970a['attrs'][0x2][_0x47f0('0x5f')]:undefined)||null},{'name':_0x47f0('0x6a'),'value':_0x4c970a[_0x47f0('0x6a')]||(_0x4c970a[_0x47f0('0x5e')]&&_0x4c970a[_0x47f0('0x5e')][0x3]?_0x4c970a[_0x47f0('0x5e')][0x3][_0x47f0('0x5f')]:undefined)||[]}];case _0x47f0('0x70'):return[{'name':_0x47f0('0x71'),'type':_0x4c970a[_0x47f0('0x72')]||(_0x4c970a[_0x47f0('0x5e')]&&_0x4c970a[_0x47f0('0x5e')][0x0]?_0x4c970a[_0x47f0('0x5e')][0x0]['type']:undefined)||null,'value':_0x4c970a[_0x47f0('0x71')]||(_0x4c970a[_0x47f0('0x5e')]&&_0x4c970a[_0x47f0('0x5e')][0x0]?_0x4c970a['attrs'][0x0]['value']:undefined)||null},{'name':_0x47f0('0x73'),'value':_0x4c970a[_0x47f0('0x73')]||(_0x4c970a[_0x47f0('0x5e')]&&_0x4c970a[_0x47f0('0x5e')][0x1]?_0x4c970a[_0x47f0('0x5e')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x11f1c8){logger[_0x47f0('0x2e')](_0x47f0('0x74'),JSON[_0x47f0('0x75')](_0x11f1c8));return[];}}exports['addItem']=function(_0x13648d,_0x2570ac,_0x234250){if(_0x13648d[_0x47f0('0x59')]['id']){delete _0x13648d[_0x47f0('0x59')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x13648d[_0x47f0('0x4c')]['id']}})[_0x47f0('0x2d')](handleEntityNotFound(_0x2570ac,null))[_0x47f0('0x2d')](function(_0x4a7d4c){if(_0x4a7d4c){_0x13648d[_0x47f0('0x59')][_0x47f0('0x76')]=_0x4a7d4c['id'];_0x13648d['body'][_0x47f0('0x5e')]=widgetAttributes(_0x13648d[_0x47f0('0x59')]);return db['DashboardItem'][_0x47f0('0x50')](_0x13648d[_0x47f0('0x59')]);}})[_0x47f0('0x2d')](respondWithResult(_0x2570ac,null))['catch'](handleError(_0x2570ac,null));};exports['getItems']=function(_0x35b954,_0x16d04e,_0x1eec9b){var _0x37ef05={};var _0x4c7434={};var _0xcd933e;var _0x27f279;return db[_0x47f0('0x34')][_0x47f0('0x77')]({'where':{'id':_0x35b954[_0x47f0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x16d04e,null))[_0x47f0('0x2d')](function(_0x486042){if(_0x486042){_0xcd933e=_0x486042;_0x4c7434[_0x47f0('0x38')]=_[_0x47f0('0x3a')](db[_0x47f0('0x78')][_0x47f0('0x4d')]);_0x4c7434[_0x47f0('0x39')]=_['keys'](_0x35b954[_0x47f0('0x39')]);_0x4c7434[_0x47f0('0x42')]=_['intersection'](_0x4c7434['model'],_0x4c7434['query']);_0x37ef05[_0x47f0('0x3c')]=_[_0x47f0('0x3b')](_0x4c7434[_0x47f0('0x38')],qs[_0x47f0('0x3d')](_0x35b954['query'][_0x47f0('0x3d')]));_0x37ef05[_0x47f0('0x3c')]=_0x37ef05[_0x47f0('0x3c')][_0x47f0('0x3e')]?_0x37ef05[_0x47f0('0x3c')]:_0x4c7434[_0x47f0('0x38')];_0x37ef05[_0x47f0('0x79')]=qs[_0x47f0('0x7a')](_0x35b954[_0x47f0('0x39')][_0x47f0('0x7a')]);_0x37ef05[_0x47f0('0x41')]=qs[_0x47f0('0x42')](_[_0x47f0('0x43')](_0x35b954[_0x47f0('0x39')],_0x4c7434[_0x47f0('0x42')]));if(_0x35b954[_0x47f0('0x39')][_0x47f0('0x44')]){_0x37ef05[_0x47f0('0x41')]=_[_0x47f0('0x45')](_0x37ef05[_0x47f0('0x41')],{'$or':_['map'](_0x37ef05['attributes'],function(_0x528f4b){var _0xe73de9={};_0xe73de9[_0x528f4b]={'$like':'%'+_0x35b954['query']['filter']+'%'};return _0xe73de9;})});}_0x37ef05=_[_0x47f0('0x45')]({},_0x37ef05,_0x35b954[_0x47f0('0x47')]);return _0xcd933e[_0x47f0('0x7b')](_0x37ef05);}})[_0x47f0('0x2d')](function(_0x50428a){if(_0x50428a){_0x27f279=_0x50428a[_0x47f0('0x3e')];if(!_0x35b954[_0x47f0('0x39')][_0x47f0('0x3f')](_0x47f0('0x40'))){_0x37ef05[_0x47f0('0x22')]=qs['limit'](_0x35b954[_0x47f0('0x39')][_0x47f0('0x22')]);_0x37ef05[_0x47f0('0x21')]=qs['offset'](_0x35b954['query'][_0x47f0('0x21')]);}return _0xcd933e[_0x47f0('0x7b')](_0x37ef05);}})[_0x47f0('0x2d')](function(_0x32c874){if(_0x32c874){return _0x32c874?{'count':_0x27f279,'rows':_0x32c874}:null;}})[_0x47f0('0x2d')](respondWithResult(_0x16d04e,null))[_0x47f0('0x55')](handleError(_0x16d04e,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 8534d09..609a362 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 _0x9560=['exports','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x5e7164,_0x504bc5){var _0xa0d06e=function(_0x45fc6a){while(--_0x45fc6a){_0x5e7164['push'](_0x5e7164['shift']());}};_0xa0d06e(++_0x504bc5);}(_0x9560,0x1b9));var _0x0956=function(_0x3d7fb5,_0x16eb5c){_0x3d7fb5=_0x3d7fb5-0x0;var _0x3a9642=_0x9560[_0x3d7fb5];return _0x3a9642;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x0956('0x0'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x0956('0x1')](0x0);var events={'afterCreate':_0x0956('0x2'),'afterUpdate':_0x0956('0x3'),'afterDestroy':_0x0956('0x4')};function emitEvent(_0x3fa3c3){return function(_0x5f3a66,_0x5343ec,_0x3165fd){DashboardEvents[_0x0956('0x5')](_0x3fa3c3+':'+_0x5f3a66['id'],_0x5f3a66);DashboardEvents[_0x0956('0x5')](_0x3fa3c3,_0x5f3a66);_0x3165fd(null);};}for(var e in events){if(events[_0x0956('0x6')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x0956('0x7')]=DashboardEvents; \ No newline at end of file +var _0xa5f6=['emit','hasOwnProperty','hook','../../mysqldb','Dashboard','setMaxListeners','save','update','remove'];(function(_0x2cd08a,_0x541694){var _0x5bfd5c=function(_0x1becdf){while(--_0x1becdf){_0x2cd08a['push'](_0x2cd08a['shift']());}};_0x5bfd5c(++_0x541694);}(_0xa5f6,0x66));var _0x6a5f=function(_0x46e0fc,_0x47d3d8){_0x46e0fc=_0x46e0fc-0x0;var _0x169502=_0xa5f6[_0x46e0fc];return _0x169502;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x6a5f('0x0'))['db'][_0x6a5f('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x6a5f('0x2')](0x0);var events={'afterCreate':_0x6a5f('0x3'),'afterUpdate':_0x6a5f('0x4'),'afterDestroy':_0x6a5f('0x5')};function emitEvent(_0x5ac72d){return function(_0x31b237,_0x58f4d0,_0x5d8245){DashboardEvents['emit'](_0x5ac72d+':'+_0x31b237['id'],_0x31b237);DashboardEvents[_0x6a5f('0x6')](_0x5ac72d,_0x31b237);_0x5d8245(null);};}for(var e in events){if(events[_0x6a5f('0x7')](e)){var event=events[e];Dashboard[_0x6a5f('0x8')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 75bfecc..0edf288 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 _0x2e97=['moment','bluebird','request-promise','path','exports','define','Dashboard','dashboards','lodash','api'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2e97,0x198));var _0x72e9=function(_0x97801c,_0xe28a34){_0x97801c=_0x97801c-0x0;var _0x27388c=_0x2e97[_0x97801c];return _0x27388c;};'use strict';var _=require(_0x72e9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x72e9('0x1'));var moment=require(_0x72e9('0x2'));var BPromise=require(_0x72e9('0x3'));var rp=require(_0x72e9('0x4'));var fs=require('fs');var path=require(_0x72e9('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./dashboard.attributes');module[_0x72e9('0x6')]=function(_0x1ee38b,_0x5c537e){return _0x1ee38b[_0x72e9('0x7')](_0x72e9('0x8'),attributes,{'tableName':_0x72e9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc01a=['util','../../config/logger','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','Dashboard','dashboards'];(function(_0x2c6fb6,_0x4b69a8){var _0x6653c4=function(_0x5937ef){while(--_0x5937ef){_0x2c6fb6['push'](_0x2c6fb6['shift']());}};_0x6653c4(++_0x4b69a8);}(_0xc01a,0x15f));var _0xac01=function(_0x2c98f5,_0x7f8484){_0x2c98f5=_0x2c98f5-0x0;var _0x365be9=_0xc01a[_0x2c98f5];return _0x365be9;};'use strict';var _=require('lodash');var util=require(_0xac01('0x0'));var logger=require(_0xac01('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xac01('0x2'));var fs=require('fs');var path=require(_0xac01('0x3'));var rimraf=require(_0xac01('0x4'));var config=require(_0xac01('0x5'));var attributes=require(_0xac01('0x6'));module['exports']=function(_0x483fa2,_0x54cc65){return _0x483fa2['define'](_0xac01('0x7'),attributes,{'tableName':_0xac01('0x8'),'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 e4a700c..9c3d6a3 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 _0xa04f=['http','redis','defaults','localhost','./dashboard.socket','register','request','then','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','Dashboard,\x20%s,\x20%s','message','info','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x5c3724,_0x4f1f25){var _0x52bc38=function(_0x114287){while(--_0x114287){_0x5c3724['push'](_0x5c3724['shift']());}};_0x52bc38(++_0x4f1f25);}(_0xa04f,0x9a));var _0xfa04=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xa04f[_0x1e7b16];return _0x37fadc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfa04('0x0'));var BPromise=require(_0xfa04('0x1'));var rs=require(_0xfa04('0x2'));var fs=require('fs');var Redis=require(_0xfa04('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfa04('0x4'));var logger=require(_0xfa04('0x5'))('rpc');var config=require(_0xfa04('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfa04('0x7')]({'port':0x232a});config[_0xfa04('0x8')]=_[_0xfa04('0x9')](config['redis'],{'host':_0xfa04('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfa04('0x8')]));require(_0xfa04('0xb'))[_0xfa04('0xc')](socket);function respondWithRpcPromise(_0x362568,_0x505454,_0x2000a7){return new BPromise(function(_0x5215e5,_0x1f5fba){return client[_0xfa04('0xd')](_0x362568,_0x2000a7)[_0xfa04('0xe')](function(_0x40c86f){logger['info']('Dashboard,\x20%s,\x20%s',_0x505454,_0xfa04('0xf'));logger['debug'](_0xfa04('0x10'),_0x505454,_0xfa04('0xf'),JSON[_0xfa04('0x11')](_0x40c86f));if(_0x40c86f[_0xfa04('0x12')]){if(_0x40c86f[_0xfa04('0x12')][_0xfa04('0x13')]===0x1f4){logger['error'](_0xfa04('0x14'),_0x505454,_0x40c86f[_0xfa04('0x12')][_0xfa04('0x15')]);return _0x1f5fba(_0x40c86f[_0xfa04('0x12')][_0xfa04('0x15')]);}logger['error'](_0xfa04('0x14'),_0x505454,_0x40c86f[_0xfa04('0x12')][_0xfa04('0x15')]);return _0x5215e5(_0x40c86f[_0xfa04('0x12')][_0xfa04('0x15')]);}else{logger[_0xfa04('0x16')]('Dashboard,\x20%s,\x20%s',_0x505454,_0xfa04('0xf'));_0x5215e5(_0x40c86f['result'][_0xfa04('0x15')]);}})['catch'](function(_0x5cc591){logger[_0xfa04('0x12')](_0xfa04('0x14'),_0x505454,_0x5cc591);_0x1f5fba(_0x5cc591);});});} \ No newline at end of file +var _0x4a2e=['then','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','Dashboard,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','http','defaults','redis','socket.io-emitter','./dashboard.socket','register'];(function(_0x57bb3a,_0x237ede){var _0x5decaa=function(_0x262a8f){while(--_0x262a8f){_0x57bb3a['push'](_0x57bb3a['shift']());}};_0x5decaa(++_0x237ede);}(_0x4a2e,0x87));var _0xe4a2=function(_0x7b4397,_0x50ab04){_0x7b4397=_0x7b4397-0x0;var _0x16de0b=_0x4a2e[_0x7b4397];return _0x16de0b;};'use strict';var _=require(_0xe4a2('0x0'));var util=require(_0xe4a2('0x1'));var moment=require(_0xe4a2('0x2'));var BPromise=require(_0xe4a2('0x3'));var rs=require(_0xe4a2('0x4'));var fs=require('fs');var Redis=require(_0xe4a2('0x5'));var db=require(_0xe4a2('0x6'))['db'];var utils=require(_0xe4a2('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe4a2('0x8')][_0xe4a2('0x9')]({'port':0x232a});config['redis']=_[_0xe4a2('0xa')](config[_0xe4a2('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xe4a2('0xc'))(new Redis(config[_0xe4a2('0xb')]));require(_0xe4a2('0xd'))[_0xe4a2('0xe')](socket);function respondWithRpcPromise(_0x26e783,_0xb7de6e,_0x2c9dcf){return new BPromise(function(_0x5f504d,_0x89357c){return client['request'](_0x26e783,_0x2c9dcf)[_0xe4a2('0xf')](function(_0xed338e){logger['info']('Dashboard,\x20%s,\x20%s',_0xb7de6e,'request\x20sent');logger[_0xe4a2('0x10')](_0xe4a2('0x11'),_0xb7de6e,'request\x20sent',JSON[_0xe4a2('0x12')](_0xed338e));if(_0xed338e[_0xe4a2('0x13')]){if(_0xed338e[_0xe4a2('0x13')]['code']===0x1f4){logger[_0xe4a2('0x13')]('Dashboard,\x20%s,\x20%s',_0xb7de6e,_0xed338e['error']['message']);return _0x89357c(_0xed338e[_0xe4a2('0x13')]['message']);}logger[_0xe4a2('0x13')](_0xe4a2('0x14'),_0xb7de6e,_0xed338e[_0xe4a2('0x13')][_0xe4a2('0x15')]);return _0x5f504d(_0xed338e[_0xe4a2('0x13')][_0xe4a2('0x15')]);}else{logger[_0xe4a2('0x16')](_0xe4a2('0x14'),_0xb7de6e,'request\x20sent');_0x5f504d(_0xed338e[_0xe4a2('0x17')][_0xe4a2('0x15')]);}})[_0xe4a2('0x18')](function(_0x2e6be3){logger['error'](_0xe4a2('0x14'),_0xb7de6e,_0x2e6be3);_0x89357c(_0x2e6be3);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index bde4d33..bc0a1f6 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 _0xbbd2=['update','removeListener','register','length','dashboard:','./dashboard.events'];(function(_0xa45395,_0x5579e6){var _0x3c83d2=function(_0x5d013c){while(--_0x5d013c){_0xa45395['push'](_0xa45395['shift']());}};_0x3c83d2(++_0x5579e6);}(_0xbbd2,0xbf));var _0x2bbd=function(_0xef4ef0,_0x3c72f9){_0xef4ef0=_0xef4ef0-0x0;var _0x39b60b=_0xbbd2[_0xef4ef0];return _0x39b60b;};'use strict';var DashboardEvents=require(_0x2bbd('0x0'));var events=['save','remove',_0x2bbd('0x1')];function createListener(_0xecb4d6,_0x2b65b1){return function(_0x36ea02){_0x2b65b1['emit'](_0xecb4d6,_0x36ea02);};}function removeListener(_0x33c7bb,_0x4b8879){return function(){DashboardEvents[_0x2bbd('0x2')](_0x33c7bb,_0x4b8879);};}exports[_0x2bbd('0x3')]=function(_0x3ac425){for(var _0x10671e=0x0,_0xa2481d=events[_0x2bbd('0x4')];_0x10671e<_0xa2481d;_0x10671e++){var _0x3c0904=events[_0x10671e];var _0x3692d9=createListener(_0x2bbd('0x5')+_0x3c0904,_0x3ac425);DashboardEvents['on'](_0x3c0904,_0x3692d9);}}; \ No newline at end of file +var _0xcb8b=['register','length','dashboard:','./dashboard.events','save','remove','emit','removeListener'];(function(_0x491f1d,_0xdbdd59){var _0x25d9fd=function(_0x5c433b){while(--_0x5c433b){_0x491f1d['push'](_0x491f1d['shift']());}};_0x25d9fd(++_0xdbdd59);}(_0xcb8b,0x153));var _0xbcb8=function(_0x18e00f,_0x27502f){_0x18e00f=_0x18e00f-0x0;var _0x323bd3=_0xcb8b[_0x18e00f];return _0x323bd3;};'use strict';var DashboardEvents=require(_0xbcb8('0x0'));var events=[_0xbcb8('0x1'),_0xbcb8('0x2'),'update'];function createListener(_0x11663c,_0xc20248){return function(_0x4a5bc0){_0xc20248[_0xbcb8('0x3')](_0x11663c,_0x4a5bc0);};}function removeListener(_0x7ccdd8,_0x597861){return function(){DashboardEvents[_0xbcb8('0x4')](_0x7ccdd8,_0x597861);};}exports[_0xbcb8('0x5')]=function(_0x1a60fe){for(var _0x3b8c28=0x0,_0x478edb=events[_0xbcb8('0x6')];_0x3b8c28<_0x478edb;_0x3b8c28++){var _0x581dc3=events[_0x3b8c28];var _0x1db35d=createListener(_0xbcb8('0x7')+_0x581dc3,_0x1a60fe);DashboardEvents['on'](_0x581dc3,_0x1db35d);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 47422ba..c0b40d6 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 _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(_0x30562a,_0x16f80d){var _0x453a7e=function(_0x92baa4){while(--_0x92baa4){_0x30562a['push'](_0x30562a['shift']());}};_0x453a7e(++_0x16f80d);}(_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 +var _0xb7e7=['addItem','put','update','delete','multer','path','express','../../components/auth/service','../../config/environment','./dashboard.controller','get','/:id','isAuthenticated','/:id/items','getItems','post','create','/:id/clone','clone'];(function(_0x5e2152,_0x172f3d){var _0x5ddcf6=function(_0x30a5cc){while(--_0x30a5cc){_0x5e2152['push'](_0x5e2152['shift']());}};_0x5ddcf6(++_0x172f3d);}(_0xb7e7,0x121));var _0x7b7e=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xb7e7[_0x126558];return _0x1f6d14;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var auth=require(_0x7b7e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7b7e('0x4'));var controller=require(_0x7b7e('0x5'));router[_0x7b7e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7b7e('0x6')](_0x7b7e('0x7'),auth[_0x7b7e('0x8')](),controller['show']);router[_0x7b7e('0x6')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xc')]);router['post'](_0x7b7e('0xd'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xe')]);router[_0x7b7e('0xb')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xf')]);router[_0x7b7e('0x10')](_0x7b7e('0x7'),auth['isAuthenticated'](),controller[_0x7b7e('0x11')]);router[_0x7b7e('0x12')]('/:id',auth[_0x7b7e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 6e45597..1e1ddd6 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 _0x851a=['stringify','attrs','INTEGER','#ffffff','#2196f3','sequelize','STRING','TEXT','parse','getDataValue','setDataValue'];(function(_0x2f22ee,_0x55cafa){var _0xd74ff2=function(_0x282529){while(--_0x282529){_0x2f22ee['push'](_0x2f22ee['shift']());}};_0xd74ff2(++_0x55cafa);}(_0x851a,0x12e));var _0xa851=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x851a[_0x40220a];return _0x3903cc;};'use strict';var Sequelize=require(_0xa851('0x0'));var squel=require('squel');var _=require('lodash');module['exports']={'title':{'type':Sequelize[_0xa851('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xa851('0x1')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xa851('0x2')]('long'),'get':function(){try{return JSON[_0xa851('0x3')](this[_0xa851('0x4')]('attrs'));}catch(_0xe4f138){return[];}},'set':function(_0x4922b9){try{this[_0xa851('0x5')]('attrs',JSON[_0xa851('0x6')](_0x4922b9));}catch(_0xa8609c){this[_0xa851('0x5')](_0xa851('0x7'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0xa851('0x8')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xa851('0x8')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xa851('0x8')]},'col':{'type':Sequelize[_0xa851('0x8')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa851('0x9'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xa851('0x1')],'allowNull':![],'defaultValue':_0xa851('0xa'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc460=['TEXT','parse','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','squel','exports','STRING'];(function(_0x533fd6,_0x3a7083){var _0x5a447d=function(_0x41e7e9){while(--_0x41e7e9){_0x533fd6['push'](_0x533fd6['shift']());}};_0x5a447d(++_0x3a7083);}(_0xc460,0x11b));var _0x0c46=function(_0x5df503,_0x3563e0){_0x5df503=_0x5df503-0x0;var _0x3b2ad3=_0xc460[_0x5df503];return _0x3b2ad3;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x0c46('0x0'));var _=require('lodash');module[_0x0c46('0x1')]={'title':{'type':Sequelize[_0x0c46('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x0c46('0x3')]('long'),'get':function(){try{return JSON[_0x0c46('0x4')](this['getDataValue'](_0x0c46('0x5')));}catch(_0x36f844){return[];}},'set':function(_0xb0c7ae){try{this[_0x0c46('0x6')](_0x0c46('0x5'),JSON[_0x0c46('0x7')](_0xb0c7ae));}catch(_0x2111da){this['setDataValue'](_0x0c46('0x5'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x0c46('0x8')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x0c46('0x8')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0c46('0x9'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x0c46('0x2')],'allowNull':![],'defaultValue':_0x0c46('0xa'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 31c5836..743fd5d 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 _0xf282=['filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','then','destroy','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','counter','attrMetric','total','attrVoiceQueues','attrFontSize','multibar-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','error','stringify','create','body','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','stack','name','send','model','keys','DashboardItem','query'];(function(_0x210710,_0x19ba10){var _0x1cd961=function(_0x2dcbe7){while(--_0x2dcbe7){_0x210710['push'](_0x210710['shift']());}};_0x1cd961(++_0x19ba10);}(_0xf282,0xdf));var _0x2f28=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xf282[_0x422905];return _0x33dc6c;};'use strict';var pdf=require(_0x2f28('0x0'));var emlformat=require(_0x2f28('0x1'));var rimraf=require(_0x2f28('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2f28('0x3'));var rp=require(_0x2f28('0x4'));var moment=require(_0x2f28('0x5'));var BPromise=require(_0x2f28('0x6'));var Mustache=require(_0x2f28('0x7'));var util=require(_0x2f28('0x8'));var path=require(_0x2f28('0x9'));var sox=require(_0x2f28('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x2f28('0xb'));var squel=require(_0x2f28('0xc'));var crypto=require(_0x2f28('0xd'));var jsforce=require(_0x2f28('0xe'));var deskjs=require(_0x2f28('0xf'));var toCsv=require(_0x2f28('0x10'));var querystring=require(_0x2f28('0x11'));var Papa=require(_0x2f28('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2f28('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2f28('0x14'));var logger=require(_0x2f28('0x15'))('api');var utils=require(_0x2f28('0x16'));var config=require(_0x2f28('0x17'));var db=require(_0x2f28('0x18'))['db'];config[_0x2f28('0x19')]=_['defaults'](config[_0x2f28('0x19')],{'host':_0x2f28('0x1a'),'port':0x18eb});var socket=require(_0x2f28('0x1b'))(new Redis(config[_0x2f28('0x19')]));require(_0x2f28('0x1c'))[_0x2f28('0x1d')](socket);function respondWithStatusCode(_0x41d0a7,_0x4c79ce){_0x4c79ce=_0x4c79ce||0xcc;return function(_0x5f1c0e){if(_0x5f1c0e){return _0x41d0a7[_0x2f28('0x1e')](_0x4c79ce);}return _0x41d0a7['status'](_0x4c79ce)[_0x2f28('0x1f')]();};}function respondWithResult(_0x585ce6,_0x376897){_0x376897=_0x376897||0xc8;return function(_0x18d2fd){if(_0x18d2fd){return _0x585ce6[_0x2f28('0x20')](_0x376897)[_0x2f28('0x21')](_0x18d2fd);}};}function respondWithFilteredResult(_0x2bbaf9,_0x4a470c){return function(_0x452ac7){if(_0x452ac7){var _0x2910ca=_0x452ac7[_0x2f28('0x22')],_0x561002=_0x4a470c[_0x2f28('0x23')],_0xd75a8d=_0x4a470c[_0x2f28('0x23')]+_0x4a470c[_0x2f28('0x24')],_0x4bf41a;if(_0xd75a8d>=_0x2910ca){_0xd75a8d=_0x2910ca;_0x4bf41a=0xc8;}else{_0x4bf41a=0xce;}_0x2bbaf9[_0x2f28('0x20')](_0x4bf41a);return _0x2bbaf9[_0x2f28('0x25')](_0x2f28('0x26'),_0x561002+'-'+_0xd75a8d+'/'+_0x2910ca)[_0x2f28('0x21')](_0x452ac7);}return null;};}function patchUpdates(_0x30c0d1){return function(_0xa7b7bb){try{jsonpatch[_0x2f28('0x27')](_0xa7b7bb,_0x30c0d1,!![]);}catch(_0x4c6145){return BPromise[_0x2f28('0x28')](_0x4c6145);}return _0xa7b7bb[_0x2f28('0x29')]();};}function saveUpdates(_0x57d504,_0x1583df){return function(_0xedbf39){if(_0xedbf39){return _0xedbf39[_0x2f28('0x2a')](_0x57d504)['then'](function(_0x43be95){return _0x43be95;});}return null;};}function removeEntity(_0x3c7c84,_0x2f7c12){return function(_0x8d9fce){if(_0x8d9fce){return _0x8d9fce['destroy']()['then'](function(){_0x3c7c84[_0x2f28('0x20')](0xcc)[_0x2f28('0x1f')]();});}};}function handleEntityNotFound(_0x4681e4,_0x5c3647){return function(_0x419596){if(!_0x419596){_0x4681e4[_0x2f28('0x1e')](0x194);}return _0x419596;};}function handleError(_0x1c3d6e,_0x1d186f){_0x1d186f=_0x1d186f||0x1f4;return function(_0x1584c0){logger['error'](_0x1584c0[_0x2f28('0x2b')]);if(_0x1584c0[_0x2f28('0x2c')]){delete _0x1584c0[_0x2f28('0x2c')];}_0x1c3d6e['status'](_0x1d186f)[_0x2f28('0x2d')](_0x1584c0);};}exports['show']=function(_0x373bea,_0x1e0335){var _0x9caf98={'raw':![],'where':{'id':_0x373bea['params']['id']}},_0x1f512c={};_0x1f512c[_0x2f28('0x2e')]=_[_0x2f28('0x2f')](db[_0x2f28('0x30')]['rawAttributes']);_0x1f512c['query']=_['keys'](_0x373bea[_0x2f28('0x31')]);_0x1f512c[_0x2f28('0x32')]=_[_0x2f28('0x33')](_0x1f512c[_0x2f28('0x2e')],_0x1f512c[_0x2f28('0x31')]);_0x9caf98[_0x2f28('0x34')]=_[_0x2f28('0x33')](_0x1f512c['model'],qs[_0x2f28('0x35')](_0x373bea['query']['fields']));_0x9caf98['attributes']=_0x9caf98[_0x2f28('0x34')][_0x2f28('0x36')]?_0x9caf98[_0x2f28('0x34')]:_0x1f512c[_0x2f28('0x2e')];if(_0x373bea['query'][_0x2f28('0x37')]){_0x9caf98[_0x2f28('0x38')]=[{'all':!![]}];}_0x9caf98=_[_0x2f28('0x39')]({},_0x9caf98,_0x373bea[_0x2f28('0x3a')]);return db[_0x2f28('0x30')][_0x2f28('0x3b')](_0x9caf98)[_0x2f28('0x3c')](handleEntityNotFound(_0x1e0335,null))['then'](respondWithResult(_0x1e0335,null))['catch'](handleError(_0x1e0335,null));};exports[_0x2f28('0x3d')]=function(_0x25de9c,_0x1e21cd){return db[_0x2f28('0x30')][_0x2f28('0x3b')]({'where':{'id':_0x25de9c['params']['id']}})['then'](handleEntityNotFound(_0x1e21cd,null))[_0x2f28('0x3c')](removeEntity(_0x1e21cd,null))[_0x2f28('0x3e')](handleError(_0x1e21cd,null));};function widgetAttributes(_0x18a658){try{switch(_0x18a658[_0x2f28('0x3f')]){case _0x2f28('0x40'):return[{'name':_0x2f28('0x41'),'value':_0x18a658['attrUrl']||(_0x18a658[_0x2f28('0x42')]&&_0x18a658[_0x2f28('0x42')][0x0]?_0x18a658[_0x2f28('0x42')][0x0][_0x2f28('0x43')]:undefined)||_0x2f28('0x44')}];case _0x2f28('0x45'):return[{'name':_0x2f28('0x46'),'value':_0x18a658[_0x2f28('0x46')]||(_0x18a658[_0x2f28('0x42')]&&_0x18a658['attrs'][0x0]?_0x18a658[_0x2f28('0x42')][0x0][_0x2f28('0x43')]:undefined)||''}];case'clock':return[{'name':_0x2f28('0x47'),'value':_0x18a658[_0x2f28('0x47')]||(_0x18a658[_0x2f28('0x42')]&&_0x18a658['attrs'][0x0]?_0x18a658['attrs'][0x0]['value']:undefined)||_0x2f28('0x48')},{'name':_0x2f28('0x49'),'value':_0x18a658[_0x2f28('0x49')]||(_0x18a658['attrs']&&_0x18a658[_0x2f28('0x42')][0x1]?_0x18a658['attrs'][0x1][_0x2f28('0x43')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0x18a658['attrFontSize']||(_0x18a658[_0x2f28('0x42')]&&_0x18a658[_0x2f28('0x42')][0x2]?_0x18a658[_0x2f28('0x42')][0x2][_0x2f28('0x43')]:undefined)||0xc}];case _0x2f28('0x4a'):return[{'name':_0x2f28('0x4b'),'value':_0x18a658[_0x2f28('0x4b')]||(_0x18a658[_0x2f28('0x42')]&&_0x18a658[_0x2f28('0x42')][0x0]?_0x18a658[_0x2f28('0x42')][0x0][_0x2f28('0x43')]:undefined)||_0x2f28('0x4c')},{'name':_0x2f28('0x4d'),'value':_0x18a658['attrVoiceQueues']||(_0x18a658['attrs']&&_0x18a658['attrs'][0x1]?_0x18a658[_0x2f28('0x42')][0x1]['value']:undefined)||[]},{'name':_0x2f28('0x4e'),'value':_0x18a658[_0x2f28('0x4e')]||(_0x18a658['attrs']&&_0x18a658[_0x2f28('0x42')][0x2]?_0x18a658[_0x2f28('0x42')][0x2][_0x2f28('0x43')]:undefined)||0x14}];case _0x2f28('0x4f'):case'pie-chart':return[{'name':_0x2f28('0x50'),'value':_0x18a658['attrSerie1']||(_0x18a658[_0x2f28('0x42')]&&_0x18a658[_0x2f28('0x42')][0x0]?_0x18a658[_0x2f28('0x42')][0x0]['value']:undefined)||'total'},{'name':_0x2f28('0x51'),'value':_0x18a658[_0x2f28('0x51')]||(_0x18a658[_0x2f28('0x42')]&&_0x18a658['attrs'][0x1]?_0x18a658['attrs'][0x1][_0x2f28('0x43')]:undefined)||null},{'name':_0x2f28('0x52'),'value':_0x18a658[_0x2f28('0x52')]||(_0x18a658[_0x2f28('0x42')]&&_0x18a658['attrs'][0x2]?_0x18a658[_0x2f28('0x42')][0x2][_0x2f28('0x43')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x18a658['attrVoiceQueues']||(_0x18a658[_0x2f28('0x42')]&&_0x18a658[_0x2f28('0x42')][0x3]?_0x18a658[_0x2f28('0x42')][0x3][_0x2f28('0x43')]:undefined)||[]}];case'web-report':return[{'name':_0x2f28('0x53'),'type':_0x18a658[_0x2f28('0x54')]||(_0x18a658[_0x2f28('0x42')]&&_0x18a658[_0x2f28('0x42')][0x0]?_0x18a658[_0x2f28('0x42')][0x0][_0x2f28('0x3f')]:undefined)||null,'value':_0x18a658['attrReport']||(_0x18a658['attrs']&&_0x18a658[_0x2f28('0x42')][0x0]?_0x18a658[_0x2f28('0x42')][0x0][_0x2f28('0x43')]:undefined)||null},{'name':_0x2f28('0x55'),'value':_0x18a658[_0x2f28('0x55')]||(_0x18a658['attrs']&&_0x18a658[_0x2f28('0x42')][0x1]?_0x18a658[_0x2f28('0x42')][0x1][_0x2f28('0x43')]:undefined)||0x0}];default:return[];}}catch(_0x5e5834){logger[_0x2f28('0x56')]('widgetAttributes:\x20%s',JSON[_0x2f28('0x57')](_0x5e5834));return[];}}exports[_0x2f28('0x58')]=function(_0x159294,_0x29ca00){if(_0x159294[_0x2f28('0x59')]){_0x159294[_0x2f28('0x59')][_0x2f28('0x42')]=widgetAttributes(_0x159294[_0x2f28('0x59')]);}return db['DashboardItem'][_0x2f28('0x58')](_0x159294[_0x2f28('0x59')],{})[_0x2f28('0x3c')](respondWithResult(_0x29ca00,0xc9))[_0x2f28('0x3e')](handleError(_0x29ca00,null));};exports[_0x2f28('0x2a')]=function(_0x2bffff,_0x356ba6){if(_0x2bffff['body']['id']){delete _0x2bffff[_0x2f28('0x59')]['id'];}_0x2bffff[_0x2f28('0x59')][_0x2f28('0x42')]=widgetAttributes(_0x2bffff['body']);return db[_0x2f28('0x30')][_0x2f28('0x3b')]({'where':{'id':_0x2bffff[_0x2f28('0x5a')]['id']}})[_0x2f28('0x3c')](handleEntityNotFound(_0x356ba6,null))[_0x2f28('0x3c')](saveUpdates(_0x2bffff[_0x2f28('0x59')],null))[_0x2f28('0x3c')](respondWithResult(_0x356ba6,null))['catch'](handleError(_0x356ba6,null));}; \ No newline at end of file +var _0xfa76=['update','then','destroy','error','stack','name','send','model','keys','rawAttributes','query','filters','fields','attributes','length','includeAll','include','merge','find','catch','params','type','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','multibar-chart','attrSerie1','attrSerie2','attrSerie3','attrVoiceQueues','web-report','attrReport','widgetAttributes:\x20%s','body','DashboardItem','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/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save'];(function(_0x46d834,_0x2c1283){var _0x118094=function(_0x348a2d){while(--_0x348a2d){_0x46d834['push'](_0x46d834['shift']());}};_0x118094(++_0x2c1283);}(_0xfa76,0xdc));var _0x6fa7=function(_0x1353d0,_0x536438){_0x1353d0=_0x1353d0-0x0;var _0x2ca930=_0xfa76[_0x1353d0];return _0x2ca930;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6fa7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6fa7('0x1'));var jsonpatch=require(_0x6fa7('0x2'));var rp=require(_0x6fa7('0x3'));var moment=require(_0x6fa7('0x4'));var BPromise=require(_0x6fa7('0x5'));var Mustache=require(_0x6fa7('0x6'));var util=require(_0x6fa7('0x7'));var path=require(_0x6fa7('0x8'));var sox=require(_0x6fa7('0x9'));var csv=require(_0x6fa7('0xa'));var ejs=require(_0x6fa7('0xb'));var fs=require('fs');var _=require(_0x6fa7('0xc'));var squel=require(_0x6fa7('0xd'));var crypto=require(_0x6fa7('0xe'));var jsforce=require(_0x6fa7('0xf'));var deskjs=require(_0x6fa7('0x10'));var toCsv=require('to-csv');var querystring=require(_0x6fa7('0x11'));var Papa=require('papaparse');var Redis=require(_0x6fa7('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6fa7('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6fa7('0x14'));var logger=require(_0x6fa7('0x15'))('api');var utils=require(_0x6fa7('0x16'));var config=require('../../config/environment');var db=require(_0x6fa7('0x17'))['db'];config[_0x6fa7('0x18')]=_[_0x6fa7('0x19')](config[_0x6fa7('0x18')],{'host':_0x6fa7('0x1a'),'port':0x18eb});var socket=require(_0x6fa7('0x1b'))(new Redis(config[_0x6fa7('0x18')]));require(_0x6fa7('0x1c'))[_0x6fa7('0x1d')](socket);function respondWithStatusCode(_0x4d6a70,_0x3bb009){_0x3bb009=_0x3bb009||0xcc;return function(_0x1ddd99){if(_0x1ddd99){return _0x4d6a70[_0x6fa7('0x1e')](_0x3bb009);}return _0x4d6a70[_0x6fa7('0x1f')](_0x3bb009)[_0x6fa7('0x20')]();};}function respondWithResult(_0x2f278e,_0x356419){_0x356419=_0x356419||0xc8;return function(_0x208412){if(_0x208412){return _0x2f278e[_0x6fa7('0x1f')](_0x356419)[_0x6fa7('0x21')](_0x208412);}};}function respondWithFilteredResult(_0x1c927d,_0x26ef73){return function(_0x5ef725){if(_0x5ef725){var _0x1bcd61=_0x5ef725['count'],_0x2dbcd3=_0x26ef73[_0x6fa7('0x22')],_0x32368d=_0x26ef73['offset']+_0x26ef73[_0x6fa7('0x23')],_0x478573;if(_0x32368d>=_0x1bcd61){_0x32368d=_0x1bcd61;_0x478573=0xc8;}else{_0x478573=0xce;}_0x1c927d[_0x6fa7('0x1f')](_0x478573);return _0x1c927d[_0x6fa7('0x24')](_0x6fa7('0x25'),_0x2dbcd3+'-'+_0x32368d+'/'+_0x1bcd61)[_0x6fa7('0x21')](_0x5ef725);}return null;};}function patchUpdates(_0x4b1c1b){return function(_0x410b33){try{jsonpatch[_0x6fa7('0x26')](_0x410b33,_0x4b1c1b,!![]);}catch(_0x5abb66){return BPromise[_0x6fa7('0x27')](_0x5abb66);}return _0x410b33[_0x6fa7('0x28')]();};}function saveUpdates(_0x2b2968,_0x4e2e1e){return function(_0x4bac6d){if(_0x4bac6d){return _0x4bac6d[_0x6fa7('0x29')](_0x2b2968)[_0x6fa7('0x2a')](function(_0x5663de){return _0x5663de;});}return null;};}function removeEntity(_0x492272,_0x5bae1f){return function(_0x162a74){if(_0x162a74){return _0x162a74[_0x6fa7('0x2b')]()[_0x6fa7('0x2a')](function(){_0x492272[_0x6fa7('0x1f')](0xcc)[_0x6fa7('0x20')]();});}};}function handleEntityNotFound(_0xbe825d,_0x8fcab1){return function(_0x30845b){if(!_0x30845b){_0xbe825d[_0x6fa7('0x1e')](0x194);}return _0x30845b;};}function handleError(_0x95eb04,_0xc6dc5d){_0xc6dc5d=_0xc6dc5d||0x1f4;return function(_0x15ef73){logger[_0x6fa7('0x2c')](_0x15ef73[_0x6fa7('0x2d')]);if(_0x15ef73[_0x6fa7('0x2e')]){delete _0x15ef73['name'];}_0x95eb04[_0x6fa7('0x1f')](_0xc6dc5d)[_0x6fa7('0x2f')](_0x15ef73);};}exports['show']=function(_0xe7adba,_0x22417d){var _0x4b6a28={'raw':![],'where':{'id':_0xe7adba['params']['id']}},_0x4dcbd2={};_0x4dcbd2[_0x6fa7('0x30')]=_[_0x6fa7('0x31')](db['DashboardItem'][_0x6fa7('0x32')]);_0x4dcbd2[_0x6fa7('0x33')]=_['keys'](_0xe7adba['query']);_0x4dcbd2[_0x6fa7('0x34')]=_['intersection'](_0x4dcbd2['model'],_0x4dcbd2[_0x6fa7('0x33')]);_0x4b6a28['attributes']=_['intersection'](_0x4dcbd2[_0x6fa7('0x30')],qs[_0x6fa7('0x35')](_0xe7adba['query'][_0x6fa7('0x35')]));_0x4b6a28[_0x6fa7('0x36')]=_0x4b6a28[_0x6fa7('0x36')][_0x6fa7('0x37')]?_0x4b6a28['attributes']:_0x4dcbd2[_0x6fa7('0x30')];if(_0xe7adba['query'][_0x6fa7('0x38')]){_0x4b6a28[_0x6fa7('0x39')]=[{'all':!![]}];}_0x4b6a28=_[_0x6fa7('0x3a')]({},_0x4b6a28,_0xe7adba['options']);return db['DashboardItem'][_0x6fa7('0x3b')](_0x4b6a28)[_0x6fa7('0x2a')](handleEntityNotFound(_0x22417d,null))['then'](respondWithResult(_0x22417d,null))[_0x6fa7('0x3c')](handleError(_0x22417d,null));};exports[_0x6fa7('0x2b')]=function(_0x38562a,_0x5679e8){return db['DashboardItem'][_0x6fa7('0x3b')]({'where':{'id':_0x38562a[_0x6fa7('0x3d')]['id']}})[_0x6fa7('0x2a')](handleEntityNotFound(_0x5679e8,null))['then'](removeEntity(_0x5679e8,null))[_0x6fa7('0x3c')](handleError(_0x5679e8,null));};function widgetAttributes(_0x1013b6){try{switch(_0x1013b6[_0x6fa7('0x3e')]){case _0x6fa7('0x3f'):return[{'name':_0x6fa7('0x40'),'value':_0x1013b6['attrUrl']||(_0x1013b6[_0x6fa7('0x41')]&&_0x1013b6[_0x6fa7('0x41')][0x0]?_0x1013b6['attrs'][0x0][_0x6fa7('0x42')]:undefined)||_0x6fa7('0x43')}];case'custom':return[{'name':_0x6fa7('0x44'),'value':_0x1013b6['attrPath']||(_0x1013b6['attrs']&&_0x1013b6[_0x6fa7('0x41')][0x0]?_0x1013b6[_0x6fa7('0x41')][0x0][_0x6fa7('0x42')]:undefined)||''}];case _0x6fa7('0x45'):return[{'name':'attrHourFormat','value':_0x1013b6[_0x6fa7('0x46')]||(_0x1013b6[_0x6fa7('0x41')]&&_0x1013b6[_0x6fa7('0x41')][0x0]?_0x1013b6[_0x6fa7('0x41')][0x0][_0x6fa7('0x42')]:undefined)||_0x6fa7('0x47')},{'name':'attrTimezone','value':_0x1013b6[_0x6fa7('0x48')]||(_0x1013b6['attrs']&&_0x1013b6[_0x6fa7('0x41')][0x1]?_0x1013b6['attrs'][0x1][_0x6fa7('0x42')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0x1013b6[_0x6fa7('0x49')]||(_0x1013b6[_0x6fa7('0x41')]&&_0x1013b6[_0x6fa7('0x41')][0x2]?_0x1013b6[_0x6fa7('0x41')][0x2][_0x6fa7('0x42')]:undefined)||0xc}];case _0x6fa7('0x4a'):return[{'name':_0x6fa7('0x4b'),'value':_0x1013b6[_0x6fa7('0x4b')]||(_0x1013b6[_0x6fa7('0x41')]&&_0x1013b6[_0x6fa7('0x41')][0x0]?_0x1013b6[_0x6fa7('0x41')][0x0][_0x6fa7('0x42')]:undefined)||_0x6fa7('0x4c')},{'name':'attrVoiceQueues','value':_0x1013b6['attrVoiceQueues']||(_0x1013b6[_0x6fa7('0x41')]&&_0x1013b6[_0x6fa7('0x41')][0x1]?_0x1013b6['attrs'][0x1][_0x6fa7('0x42')]:undefined)||[]},{'name':'attrFontSize','value':_0x1013b6[_0x6fa7('0x49')]||(_0x1013b6[_0x6fa7('0x41')]&&_0x1013b6['attrs'][0x2]?_0x1013b6[_0x6fa7('0x41')][0x2][_0x6fa7('0x42')]:undefined)||0x14}];case _0x6fa7('0x4d'):case'pie-chart':return[{'name':_0x6fa7('0x4e'),'value':_0x1013b6[_0x6fa7('0x4e')]||(_0x1013b6['attrs']&&_0x1013b6[_0x6fa7('0x41')][0x0]?_0x1013b6[_0x6fa7('0x41')][0x0]['value']:undefined)||_0x6fa7('0x4c')},{'name':_0x6fa7('0x4f'),'value':_0x1013b6[_0x6fa7('0x4f')]||(_0x1013b6[_0x6fa7('0x41')]&&_0x1013b6[_0x6fa7('0x41')][0x1]?_0x1013b6[_0x6fa7('0x41')][0x1][_0x6fa7('0x42')]:undefined)||null},{'name':_0x6fa7('0x50'),'value':_0x1013b6['attrSerie3']||(_0x1013b6['attrs']&&_0x1013b6[_0x6fa7('0x41')][0x2]?_0x1013b6[_0x6fa7('0x41')][0x2][_0x6fa7('0x42')]:undefined)||null},{'name':_0x6fa7('0x51'),'value':_0x1013b6[_0x6fa7('0x51')]||(_0x1013b6[_0x6fa7('0x41')]&&_0x1013b6[_0x6fa7('0x41')][0x3]?_0x1013b6[_0x6fa7('0x41')][0x3][_0x6fa7('0x42')]:undefined)||[]}];case _0x6fa7('0x52'):return[{'name':_0x6fa7('0x53'),'type':_0x1013b6['reportType']||(_0x1013b6[_0x6fa7('0x41')]&&_0x1013b6[_0x6fa7('0x41')][0x0]?_0x1013b6[_0x6fa7('0x41')][0x0]['type']:undefined)||null,'value':_0x1013b6[_0x6fa7('0x53')]||(_0x1013b6['attrs']&&_0x1013b6['attrs'][0x0]?_0x1013b6[_0x6fa7('0x41')][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x1013b6['attrRefresh']||(_0x1013b6[_0x6fa7('0x41')]&&_0x1013b6[_0x6fa7('0x41')][0x1]?_0x1013b6[_0x6fa7('0x41')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x3acadf){logger[_0x6fa7('0x2c')](_0x6fa7('0x54'),JSON['stringify'](_0x3acadf));return[];}}exports['create']=function(_0x38f55c,_0x1a98cc){if(_0x38f55c[_0x6fa7('0x55')]){_0x38f55c[_0x6fa7('0x55')][_0x6fa7('0x41')]=widgetAttributes(_0x38f55c[_0x6fa7('0x55')]);}return db[_0x6fa7('0x56')]['create'](_0x38f55c[_0x6fa7('0x55')],{})[_0x6fa7('0x2a')](respondWithResult(_0x1a98cc,0xc9))[_0x6fa7('0x3c')](handleError(_0x1a98cc,null));};exports[_0x6fa7('0x29')]=function(_0x10999b,_0x39cc69){if(_0x10999b[_0x6fa7('0x55')]['id']){delete _0x10999b['body']['id'];}_0x10999b['body']['attrs']=widgetAttributes(_0x10999b[_0x6fa7('0x55')]);return db['DashboardItem'][_0x6fa7('0x3b')]({'where':{'id':_0x10999b[_0x6fa7('0x3d')]['id']}})[_0x6fa7('0x2a')](handleEntityNotFound(_0x39cc69,null))[_0x6fa7('0x2a')](saveUpdates(_0x10999b[_0x6fa7('0x55')],null))[_0x6fa7('0x2a')](respondWithResult(_0x39cc69,null))['catch'](handleError(_0x39cc69,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 8e3f0bb..dfaa50d 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 _0x8c04=['remove','emit','hasOwnProperty','events','../../mysqldb','DashboardItem','setMaxListeners'];(function(_0x45ef80,_0x3065f3){var _0x3ff300=function(_0x520452){while(--_0x520452){_0x45ef80['push'](_0x45ef80['shift']());}};_0x3ff300(++_0x3065f3);}(_0x8c04,0x1a7));var _0x48c0=function(_0x1b21ad,_0x491ee8){_0x1b21ad=_0x1b21ad-0x0;var _0x4624d3=_0x8c04[_0x1b21ad];return _0x4624d3;};'use strict';var EventEmitter=require(_0x48c0('0x0'));var DashboardItem=require(_0x48c0('0x1'))['db'][_0x48c0('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x48c0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x48c0('0x4')};function emitEvent(_0x47fe5c){return function(_0x43c89d,_0x42abe1,_0x2bb46d){DashboardItemEvents[_0x48c0('0x5')](_0x47fe5c+':'+_0x43c89d['id'],_0x43c89d);DashboardItemEvents[_0x48c0('0x5')](_0x47fe5c,_0x43c89d);_0x2bb46d(null);};}for(var e in events){if(events[_0x48c0('0x6')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x9d73=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','DashboardItem','setMaxListeners','save'];(function(_0x1890c5,_0x259670){var _0xdb33ac=function(_0x4ea523){while(--_0x4ea523){_0x1890c5['push'](_0x1890c5['shift']());}};_0xdb33ac(++_0x259670);}(_0x9d73,0x1ef));var _0x39d7=function(_0x1c89cd,_0x43cacb){_0x1c89cd=_0x1c89cd-0x0;var _0x315597=_0x9d73[_0x1c89cd];return _0x315597;};'use strict';var EventEmitter=require(_0x39d7('0x0'));var DashboardItem=require(_0x39d7('0x1'))['db'][_0x39d7('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x39d7('0x3')](0x0);var events={'afterCreate':_0x39d7('0x4'),'afterUpdate':_0x39d7('0x5'),'afterDestroy':_0x39d7('0x6')};function emitEvent(_0x45974b){return function(_0x4aa5aa,_0xa40de5,_0x1cb188){DashboardItemEvents['emit'](_0x45974b+':'+_0x4aa5aa['id'],_0x4aa5aa);DashboardItemEvents[_0x39d7('0x7')](_0x45974b,_0x4aa5aa);_0x1cb188(null);};}for(var e in events){if(events[_0x39d7('0x8')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x39d7('0x9')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 81ed14d..44ba8db 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 _0x5dfc=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','DashboardItem','lodash'];(function(_0x10f877,_0x55e4d1){var _0x4c9ba1=function(_0x95507f){while(--_0x95507f){_0x10f877['push'](_0x10f877['shift']());}};_0x4c9ba1(++_0x55e4d1);}(_0x5dfc,0xa4));var _0xc5df=function(_0x1196b0,_0x36c47a){_0x1196b0=_0x1196b0-0x0;var _0x111c52=_0x5dfc[_0x1196b0];return _0x111c52;};'use strict';var _=require(_0xc5df('0x0'));var util=require('util');var logger=require(_0xc5df('0x1'))(_0xc5df('0x2'));var moment=require(_0xc5df('0x3'));var BPromise=require(_0xc5df('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc5df('0x5'));var rimraf=require(_0xc5df('0x6'));var config=require(_0xc5df('0x7'));var attributes=require('./dashboardItem.attributes');module[_0xc5df('0x8')]=function(_0x414d0e,_0x94bd94){return _0x414d0e[_0xc5df('0x9')](_0xc5df('0xa'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7917=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','dashboard_items','lodash','util','../../config/logger'];(function(_0xb7cb72,_0x19d391){var _0x4b7570=function(_0x5a4a93){while(--_0x5a4a93){_0xb7cb72['push'](_0xb7cb72['shift']());}};_0x4b7570(++_0x19d391);}(_0x7917,0xf4));var _0x7791=function(_0x535f79,_0x5ecfdc){_0x535f79=_0x535f79-0x0;var _0x521167=_0x7917[_0x535f79];return _0x521167;};'use strict';var _=require(_0x7791('0x0'));var util=require(_0x7791('0x1'));var logger=require(_0x7791('0x2'))('api');var moment=require(_0x7791('0x3'));var BPromise=require(_0x7791('0x4'));var rp=require(_0x7791('0x5'));var fs=require('fs');var path=require(_0x7791('0x6'));var rimraf=require(_0x7791('0x7'));var config=require(_0x7791('0x8'));var attributes=require(_0x7791('0x9'));module[_0x7791('0xa')]=function(_0x4e0201,_0x19d58b){return _0x4e0201[_0x7791('0xb')]('DashboardItem',attributes,{'tableName':_0x7791('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 2627059..fd9b85a 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 _0xe8b0=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./dashboardItem.socket','register','request','info','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x196416,_0x14f3bf){var _0x9284=function(_0x254ee6){while(--_0x254ee6){_0x196416['push'](_0x196416['shift']());}};_0x9284(++_0x14f3bf);}(_0xe8b0,0x104));var _0x0e8b=function(_0x1c89ad,_0x1fd275){_0x1c89ad=_0x1c89ad-0x0;var _0x31d39f=_0xe8b0[_0x1c89ad];return _0x31d39f;};'use strict';var _=require(_0x0e8b('0x0'));var util=require(_0x0e8b('0x1'));var moment=require('moment');var BPromise=require(_0x0e8b('0x2'));var rs=require(_0x0e8b('0x3'));var fs=require('fs');var Redis=require(_0x0e8b('0x4'));var db=require(_0x0e8b('0x5'))['db'];var utils=require(_0x0e8b('0x6'));var logger=require(_0x0e8b('0x7'))(_0x0e8b('0x8'));var config=require(_0x0e8b('0x9'));var jayson=require(_0x0e8b('0xa'));var client=jayson[_0x0e8b('0xb')]['http']({'port':0x232a});config[_0x0e8b('0xc')]=_[_0x0e8b('0xd')](config[_0x0e8b('0xc')],{'host':_0x0e8b('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0e8b('0xc')]));require(_0x0e8b('0xf'))[_0x0e8b('0x10')](socket);function respondWithRpcPromise(_0x522ae7,_0x3edde1,_0x583dd6){return new BPromise(function(_0x41dbdf,_0x16fe21){return client[_0x0e8b('0x11')](_0x522ae7,_0x583dd6)['then'](function(_0x4e5ae7){logger[_0x0e8b('0x12')](_0x0e8b('0x13'),_0x3edde1,'request\x20sent');logger[_0x0e8b('0x14')](_0x0e8b('0x15'),_0x3edde1,_0x0e8b('0x16'),JSON[_0x0e8b('0x17')](_0x4e5ae7));if(_0x4e5ae7['error']){if(_0x4e5ae7[_0x0e8b('0x18')][_0x0e8b('0x19')]===0x1f4){logger[_0x0e8b('0x18')](_0x0e8b('0x13'),_0x3edde1,_0x4e5ae7[_0x0e8b('0x18')][_0x0e8b('0x1a')]);return _0x16fe21(_0x4e5ae7[_0x0e8b('0x18')]['message']);}logger[_0x0e8b('0x18')]('DashboardItem,\x20%s,\x20%s',_0x3edde1,_0x4e5ae7[_0x0e8b('0x18')][_0x0e8b('0x1a')]);return _0x41dbdf(_0x4e5ae7[_0x0e8b('0x18')][_0x0e8b('0x1a')]);}else{logger['info'](_0x0e8b('0x13'),_0x3edde1,_0x0e8b('0x16'));_0x41dbdf(_0x4e5ae7[_0x0e8b('0x1b')][_0x0e8b('0x1a')]);}})[_0x0e8b('0x1c')](function(_0x42be61){logger[_0x0e8b('0x18')](_0x0e8b('0x13'),_0x3edde1,_0x42be61);_0x16fe21(_0x42be61);});});} \ No newline at end of file +var _0xf6b3=['code','DashboardItem,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','then','info','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xf6b3,0x113));var _0x3f6b=function(_0x15009e,_0x5af79b){_0x15009e=_0x15009e-0x0;var _0x1dde11=_0xf6b3[_0x15009e];return _0x1dde11;};'use strict';var _=require(_0x3f6b('0x0'));var util=require(_0x3f6b('0x1'));var moment=require('moment');var BPromise=require(_0x3f6b('0x2'));var rs=require(_0x3f6b('0x3'));var fs=require('fs');var Redis=require(_0x3f6b('0x4'));var db=require(_0x3f6b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3f6b('0x6'))(_0x3f6b('0x7'));var config=require(_0x3f6b('0x8'));var jayson=require(_0x3f6b('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x3f6b('0xa')]=_[_0x3f6b('0xb')](config[_0x3f6b('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x3f6b('0xc'))(new Redis(config[_0x3f6b('0xa')]));require(_0x3f6b('0xd'))[_0x3f6b('0xe')](socket);function respondWithRpcPromise(_0x27f771,_0x504632,_0x52a6ee){return new BPromise(function(_0x373264,_0x48cbe4){return client['request'](_0x27f771,_0x52a6ee)[_0x3f6b('0xf')](function(_0x4b0689){logger[_0x3f6b('0x10')]('DashboardItem,\x20%s,\x20%s',_0x504632,_0x3f6b('0x11'));logger[_0x3f6b('0x12')](_0x3f6b('0x13'),_0x504632,_0x3f6b('0x11'),JSON[_0x3f6b('0x14')](_0x4b0689));if(_0x4b0689[_0x3f6b('0x15')]){if(_0x4b0689[_0x3f6b('0x15')][_0x3f6b('0x16')]===0x1f4){logger['error'](_0x3f6b('0x17'),_0x504632,_0x4b0689[_0x3f6b('0x15')][_0x3f6b('0x18')]);return _0x48cbe4(_0x4b0689[_0x3f6b('0x15')]['message']);}logger[_0x3f6b('0x15')](_0x3f6b('0x17'),_0x504632,_0x4b0689[_0x3f6b('0x15')][_0x3f6b('0x18')]);return _0x373264(_0x4b0689[_0x3f6b('0x15')]['message']);}else{logger[_0x3f6b('0x10')](_0x3f6b('0x17'),_0x504632,'request\x20sent');_0x373264(_0x4b0689[_0x3f6b('0x19')][_0x3f6b('0x18')]);}})[_0x3f6b('0x1a')](function(_0x28b0a9){logger[_0x3f6b('0x15')](_0x3f6b('0x17'),_0x504632,_0x28b0a9);_0x48cbe4(_0x28b0a9);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index de9ce27..94ed024 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 _0x83ec=['update','emit','removeListener','register','length','dashboardItem:','./dashboardItem.events','remove'];(function(_0x5cfa6c,_0x200774){var _0x44e16d=function(_0x42d9c8){while(--_0x42d9c8){_0x5cfa6c['push'](_0x5cfa6c['shift']());}};_0x44e16d(++_0x200774);}(_0x83ec,0xde));var _0xc83e=function(_0x1d61a4,_0x55d3da){_0x1d61a4=_0x1d61a4-0x0;var _0x4b2a86=_0x83ec[_0x1d61a4];return _0x4b2a86;};'use strict';var DashboardItemEvents=require(_0xc83e('0x0'));var events=['save',_0xc83e('0x1'),_0xc83e('0x2')];function createListener(_0x1987a8,_0x3d55f4){return function(_0x4da0c0){_0x3d55f4[_0xc83e('0x3')](_0x1987a8,_0x4da0c0);};}function removeListener(_0xda0b82,_0x222096){return function(){DashboardItemEvents[_0xc83e('0x4')](_0xda0b82,_0x222096);};}exports[_0xc83e('0x5')]=function(_0x54422d){for(var _0x544230=0x0,_0x4e8bc5=events[_0xc83e('0x6')];_0x544230<_0x4e8bc5;_0x544230++){var _0x2785bd=events[_0x544230];var _0x53f055=createListener(_0xc83e('0x7')+_0x2785bd,_0x54422d);DashboardItemEvents['on'](_0x2785bd,_0x53f055);}}; \ No newline at end of file +var _0x3ea4=['emit','removeListener','register','length','dashboardItem:','remove'];(function(_0x255700,_0xb3dea3){var _0x4727d2=function(_0x184aac){while(--_0x184aac){_0x255700['push'](_0x255700['shift']());}};_0x4727d2(++_0xb3dea3);}(_0x3ea4,0xc5));var _0x43ea=function(_0x5a2299,_0x3e2922){_0x5a2299=_0x5a2299-0x0;var _0xedff0f=_0x3ea4[_0x5a2299];return _0xedff0f;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=['save',_0x43ea('0x0'),'update'];function createListener(_0x49bd1d,_0x4c6ef6){return function(_0x4cba62){_0x4c6ef6[_0x43ea('0x1')](_0x49bd1d,_0x4cba62);};}function removeListener(_0x4a572f,_0x13b2e2){return function(){DashboardItemEvents[_0x43ea('0x2')](_0x4a572f,_0x13b2e2);};}exports[_0x43ea('0x3')]=function(_0x5b5fa7){for(var _0x4f729d=0x0,_0x13dd16=events[_0x43ea('0x4')];_0x4f729d<_0x13dd16;_0x4f729d++){var _0x24e9e6=events[_0x4f729d];var _0x51e458=createListener(_0x43ea('0x5')+_0x24e9e6,_0x5b5fa7);DashboardItemEvents['on'](_0x24e9e6,_0x51e458);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 435b21e..f483dc4 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 _0x5fab=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x3e478c,_0x152670){var _0x29ef89=function(_0x3d0d77){while(--_0x3d0d77){_0x3e478c['push'](_0x3e478c['shift']());}};_0x29ef89(++_0x152670);}(_0x5fab,0x177));var _0xb5fa=function(_0x344128,_0x9b9e88){_0x344128=_0x344128-0x0;var _0x693fae=_0x5fab[_0x344128];return _0x693fae;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var auth=require(_0xb5fa('0x5'));var interaction=require(_0xb5fa('0x6'));var config=require(_0xb5fa('0x7'));var controller=require(_0xb5fa('0x8'));router[_0xb5fa('0x9')](_0xb5fa('0xa'),auth[_0xb5fa('0xb')](),controller['show']);router['post']('/',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xc')]);router[_0xb5fa('0xd')]('/:id',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xe')]);router[_0xb5fa('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xb5fa('0x10')]);module[_0xb5fa('0x11')]=router; \ No newline at end of file +var _0xf2ca=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','/:id','isAuthenticated','show','post','create','put','delete'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x292f35,_0x72e859){_0x292f35=_0x292f35-0x0;var _0x288e75=_0xf2ca[_0x292f35];return _0x288e75;};'use strict';var multer=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var path=require(_0xaf2c('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf2c('0x3'));var router=express[_0xaf2c('0x4')]();var auth=require(_0xaf2c('0x5'));var interaction=require(_0xaf2c('0x6'));var config=require(_0xaf2c('0x7'));var controller=require(_0xaf2c('0x8'));router['get'](_0xaf2c('0x9'),auth[_0xaf2c('0xa')](),controller[_0xaf2c('0xb')]);router[_0xaf2c('0xc')]('/',auth['isAuthenticated'](),controller[_0xaf2c('0xd')]);router[_0xaf2c('0xe')]('/:id',auth[_0xaf2c('0xa')](),controller['update']);router[_0xaf2c('0xf')]('/:id',auth[_0xaf2c('0xa')](),controller[_0xaf2c('0x10')]);module[_0xaf2c('0x11')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 2cad0d4..2e18e76 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 _0x5dbe=['exports','STRING','sequelize'];(function(_0x17a754,_0x5f1052){var _0x545d3e=function(_0x24ec39){while(--_0x24ec39){_0x17a754['push'](_0x17a754['shift']());}};_0x545d3e(++_0x5f1052);}(_0x5dbe,0xf5));var _0xe5db=function(_0x2e16d8,_0x1110ff){_0x2e16d8=_0x2e16d8-0x0;var _0xbb0a07=_0x5dbe[_0x2e16d8];return _0xbb0a07;};'use strict';var Sequelize=require(_0xe5db('0x0'));module[_0xe5db('0x1')]={'name':{'type':Sequelize[_0xe5db('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xfe24=['sequelize','STRING'];(function(_0x20122e,_0x5b91f5){var _0x3857be=function(_0x1dcc19){while(--_0x1dcc19){_0x20122e['push'](_0x20122e['shift']());}};_0x3857be(++_0x5b91f5);}(_0xfe24,0xc2));var _0x4fe2=function(_0x40070b,_0x3243ae){_0x40070b=_0x40070b-0x0;var _0x271788=_0xfe24[_0x40070b];return _0x271788;};'use strict';var Sequelize=require(_0x4fe2('0x0'));module['exports']={'name':{'type':Sequelize[_0x4fe2('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index f16f689..dd15e69 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 _0xac79=['merge','filter','includeAll','include','findAll','rows','catch','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','params','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','get','Dispositions','end','error','stack','name','index','map','Disposition','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0xac79,0x106));var _0x9ac7=function(_0x2b51fc,_0x40687d){_0x2b51fc=_0x2b51fc-0x0;var _0x8bb319=_0xac79[_0x2b51fc];return _0x8bb319;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9ac7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9ac7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9ac7('0x2'));var moment=require(_0x9ac7('0x3'));var BPromise=require(_0x9ac7('0x4'));var Mustache=require('mustache');var util=require(_0x9ac7('0x5'));var path=require(_0x9ac7('0x6'));var sox=require(_0x9ac7('0x7'));var csv=require(_0x9ac7('0x8'));var ejs=require(_0x9ac7('0x9'));var fs=require('fs');var _=require(_0x9ac7('0xa'));var squel=require('squel');var crypto=require(_0x9ac7('0xb'));var jsforce=require(_0x9ac7('0xc'));var deskjs=require(_0x9ac7('0xd'));var toCsv=require(_0x9ac7('0x8'));var querystring=require(_0x9ac7('0xe'));var Papa=require(_0x9ac7('0xf'));var Redis=require('ioredis');var authService=require(_0x9ac7('0x10'));var qs=require(_0x9ac7('0x11'));var as=require(_0x9ac7('0x12'));var hardwareService=require(_0x9ac7('0x13'));var logger=require(_0x9ac7('0x14'))('api');var utils=require(_0x9ac7('0x15'));var config=require(_0x9ac7('0x16'));var db=require(_0x9ac7('0x17'))['db'];function respondWithStatusCode(_0x5d17b4,_0x48f53e){_0x48f53e=_0x48f53e||0xcc;return function(_0x2f9700){if(_0x2f9700){return _0x5d17b4[_0x9ac7('0x18')](_0x48f53e);}return _0x5d17b4[_0x9ac7('0x19')](_0x48f53e)['end']();};}function respondWithResult(_0x2cf640,_0x21cb88){_0x21cb88=_0x21cb88||0xc8;return function(_0x186271){if(_0x186271){return _0x2cf640['status'](_0x21cb88)[_0x9ac7('0x1a')](_0x186271);}};}function respondWithFilteredResult(_0x3f184c,_0x26b4e3){return function(_0x11bcd6){if(_0x11bcd6){var _0x31aaf1=_0x11bcd6[_0x9ac7('0x1b')],_0x300bde=_0x26b4e3[_0x9ac7('0x1c')],_0x1dfcc3=_0x26b4e3[_0x9ac7('0x1c')]+_0x26b4e3[_0x9ac7('0x1d')],_0x2cbe30;if(_0x1dfcc3>=_0x31aaf1){_0x1dfcc3=_0x31aaf1;_0x2cbe30=0xc8;}else{_0x2cbe30=0xce;}_0x3f184c[_0x9ac7('0x19')](_0x2cbe30);return _0x3f184c['set'](_0x9ac7('0x1e'),_0x300bde+'-'+_0x1dfcc3+'/'+_0x31aaf1)['json'](_0x11bcd6);}return null;};}function patchUpdates(_0x40058b){return function(_0x4be623){try{jsonpatch[_0x9ac7('0x1f')](_0x4be623,_0x40058b,!![]);}catch(_0x45cb34){return BPromise['reject'](_0x45cb34);}return _0x4be623[_0x9ac7('0x20')]();};}function saveUpdates(_0x3f9913,_0x35738e){return function(_0x56d17c){if(_0x56d17c){return _0x56d17c[_0x9ac7('0x21')](_0x3f9913)[_0x9ac7('0x22')](function(_0x3d98c7){return _0x3d98c7;});}return null;};}function removeEntity(_0x1be713,_0x32bdc6){return function(_0x227c77){if(_0x227c77){return _0x227c77[_0x9ac7('0x23')]()[_0x9ac7('0x22')](function(){var _0x192d2e=_0x227c77[_0x9ac7('0x24')]({'plain':!![]});var _0x4f5ea9=_0x9ac7('0x25');return db['UserProfileResource'][_0x9ac7('0x23')]({'where':{'type':_0x4f5ea9,'resourceId':_0x192d2e['id']}})[_0x9ac7('0x22')](function(){return _0x227c77;});})[_0x9ac7('0x22')](function(){_0x1be713[_0x9ac7('0x19')](0xcc)[_0x9ac7('0x26')]();});}};}function handleEntityNotFound(_0xa0b766,_0x336a42){return function(_0x27d596){if(!_0x27d596){_0xa0b766[_0x9ac7('0x18')](0x194);}return _0x27d596;};}function handleError(_0x954c66,_0x2e97b6){_0x2e97b6=_0x2e97b6||0x1f4;return function(_0x1d1d4c){logger[_0x9ac7('0x27')](_0x1d1d4c[_0x9ac7('0x28')]);if(_0x1d1d4c[_0x9ac7('0x29')]){delete _0x1d1d4c[_0x9ac7('0x29')];}_0x954c66[_0x9ac7('0x19')](_0x2e97b6)['send'](_0x1d1d4c);};}exports[_0x9ac7('0x2a')]=function(_0x288270,_0x3804a3){var _0x2ad04e={},_0x3884d4={},_0x41e0d7={'count':0x0,'rows':[]};var _0x47e2d6=_[_0x9ac7('0x2b')](db[_0x9ac7('0x2c')]['rawAttributes'],function(_0x973e46){return{'name':_0x973e46[_0x9ac7('0x2d')],'type':_0x973e46[_0x9ac7('0x2e')][_0x9ac7('0x2f')]};});_0x3884d4[_0x9ac7('0x30')]=_[_0x9ac7('0x2b')](_0x47e2d6,_0x9ac7('0x29'));_0x3884d4[_0x9ac7('0x31')]=_[_0x9ac7('0x32')](_0x288270['query']);_0x3884d4['filters']=_[_0x9ac7('0x33')](_0x3884d4[_0x9ac7('0x30')],_0x3884d4[_0x9ac7('0x31')]);_0x2ad04e['attributes']=_[_0x9ac7('0x33')](_0x3884d4[_0x9ac7('0x30')],qs[_0x9ac7('0x34')](_0x288270[_0x9ac7('0x31')][_0x9ac7('0x34')]));_0x2ad04e[_0x9ac7('0x35')]=_0x2ad04e[_0x9ac7('0x35')][_0x9ac7('0x36')]?_0x2ad04e[_0x9ac7('0x35')]:_0x3884d4[_0x9ac7('0x30')];if(!_0x288270[_0x9ac7('0x31')][_0x9ac7('0x37')](_0x9ac7('0x38'))){_0x2ad04e[_0x9ac7('0x1d')]=qs[_0x9ac7('0x1d')](_0x288270['query'][_0x9ac7('0x1d')]);_0x2ad04e[_0x9ac7('0x1c')]=qs[_0x9ac7('0x1c')](_0x288270[_0x9ac7('0x31')][_0x9ac7('0x1c')]);}_0x2ad04e[_0x9ac7('0x39')]=qs[_0x9ac7('0x3a')](_0x288270[_0x9ac7('0x31')][_0x9ac7('0x3a')]);_0x2ad04e[_0x9ac7('0x3b')]=qs[_0x9ac7('0x3c')](_[_0x9ac7('0x3d')](_0x288270[_0x9ac7('0x31')],_0x3884d4[_0x9ac7('0x3c')]),_0x47e2d6);if(_0x288270[_0x9ac7('0x31')]['filter']){_0x2ad04e['where']=_[_0x9ac7('0x3e')](_0x2ad04e[_0x9ac7('0x3b')],{'$or':_[_0x9ac7('0x2b')](_0x47e2d6,function(_0x1da1d2){if(_0x1da1d2[_0x9ac7('0x2e')]!=='VIRTUAL'){var _0x4728f6={};_0x4728f6[_0x1da1d2[_0x9ac7('0x29')]]={'$like':'%'+_0x288270[_0x9ac7('0x31')][_0x9ac7('0x3f')]+'%'};return _0x4728f6;}})});}_0x2ad04e=_[_0x9ac7('0x3e')]({},_0x2ad04e,_0x288270['options']);var _0x7d230e={'where':_0x2ad04e['where']};return db[_0x9ac7('0x2c')]['count'](_0x7d230e)[_0x9ac7('0x22')](function(_0x5364e3){_0x41e0d7[_0x9ac7('0x1b')]=_0x5364e3;if(_0x288270[_0x9ac7('0x31')][_0x9ac7('0x40')]){_0x2ad04e[_0x9ac7('0x41')]=[{'all':!![]}];}return db['Disposition'][_0x9ac7('0x42')](_0x2ad04e);})['then'](function(_0x543449){_0x41e0d7[_0x9ac7('0x43')]=_0x543449;return _0x41e0d7;})[_0x9ac7('0x22')](respondWithFilteredResult(_0x3804a3,_0x2ad04e))[_0x9ac7('0x44')](handleError(_0x3804a3,null));};exports['show']=function(_0x195042,_0x3c5ff8){var _0x1e653c={'raw':!![],'where':{'id':_0x195042['params']['id']}},_0x540a88={};_0x540a88[_0x9ac7('0x30')]=_['keys'](db[_0x9ac7('0x2c')][_0x9ac7('0x45')]);_0x540a88[_0x9ac7('0x31')]=_[_0x9ac7('0x32')](_0x195042['query']);_0x540a88[_0x9ac7('0x3c')]=_['intersection'](_0x540a88[_0x9ac7('0x30')],_0x540a88[_0x9ac7('0x31')]);_0x1e653c[_0x9ac7('0x35')]=_[_0x9ac7('0x33')](_0x540a88[_0x9ac7('0x30')],qs[_0x9ac7('0x34')](_0x195042[_0x9ac7('0x31')]['fields']));_0x1e653c['attributes']=_0x1e653c[_0x9ac7('0x35')][_0x9ac7('0x36')]?_0x1e653c[_0x9ac7('0x35')]:_0x540a88['model'];if(_0x195042['query'][_0x9ac7('0x40')]){_0x1e653c[_0x9ac7('0x41')]=[{'all':!![]}];}_0x1e653c=_['merge']({},_0x1e653c,_0x195042['options']);return db[_0x9ac7('0x2c')][_0x9ac7('0x46')](_0x1e653c)[_0x9ac7('0x22')](handleEntityNotFound(_0x3c5ff8,null))[_0x9ac7('0x22')](respondWithResult(_0x3c5ff8,null))[_0x9ac7('0x44')](handleError(_0x3c5ff8,null));};exports[_0x9ac7('0x47')]=function(_0x586a21,_0x53af2e){return db['Disposition'][_0x9ac7('0x47')](_0x586a21['body'],{})[_0x9ac7('0x22')](function(_0x2313a0){var _0x5196b7=_0x586a21[_0x9ac7('0x48')][_0x9ac7('0x24')]({'plain':!![]});if(!_0x5196b7)throw new Error(_0x9ac7('0x49'));if(_0x5196b7[_0x9ac7('0x4a')]===_0x9ac7('0x48')){var _0x4e06a6=_0x2313a0[_0x9ac7('0x24')]({'plain':!![]});var _0x27f112=_0x9ac7('0x25');return db[_0x9ac7('0x4b')]['find']({'where':{'name':_0x27f112,'userProfileId':_0x5196b7[_0x9ac7('0x4c')]},'raw':!![]})['then'](function(_0x24f021){if(_0x24f021&&_0x24f021[_0x9ac7('0x4d')]===0x0){return db[_0x9ac7('0x4e')][_0x9ac7('0x47')]({'name':_0x4e06a6['name'],'resourceId':_0x4e06a6['id'],'type':_0x24f021[_0x9ac7('0x29')],'sectionId':_0x24f021['id']},{})[_0x9ac7('0x22')](function(){return _0x2313a0;});}else{return _0x2313a0;}})['catch'](function(_0x3aaa84){logger[_0x9ac7('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3aaa84);throw _0x3aaa84;});}return _0x2313a0;})[_0x9ac7('0x22')](respondWithResult(_0x53af2e,0xc9))[_0x9ac7('0x44')](handleError(_0x53af2e,null));};exports[_0x9ac7('0x21')]=function(_0x440b42,_0x3e102e){if(_0x440b42[_0x9ac7('0x4f')]['id']){delete _0x440b42[_0x9ac7('0x4f')]['id'];}return db[_0x9ac7('0x2c')]['find']({'where':{'id':_0x440b42['params']['id']}})[_0x9ac7('0x22')](handleEntityNotFound(_0x3e102e,null))[_0x9ac7('0x22')](saveUpdates(_0x440b42[_0x9ac7('0x4f')],null))[_0x9ac7('0x22')](respondWithResult(_0x3e102e,null))[_0x9ac7('0x44')](handleError(_0x3e102e,null));};exports[_0x9ac7('0x23')]=function(_0x29f18a,_0x494273){return db[_0x9ac7('0x2c')][_0x9ac7('0x46')]({'where':{'id':_0x29f18a[_0x9ac7('0x50')]['id']}})['then'](handleEntityNotFound(_0x494273,null))[_0x9ac7('0x22')](removeEntity(_0x494273,null))['catch'](handleError(_0x494273,null));}; \ No newline at end of file +var _0xc4e9=['ejs','lodash','squel','jsforce','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','UserProfileResource','end','error','name','send','index','map','Disposition','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','filter','VIRTUAL','merge','options','include','rows','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Dispositions','UserProfileSection','userProfileId','autoAssociation','update','html-pdf','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv'];(function(_0x49f59c,_0x2d09fc){var _0x515f2f=function(_0x143d50){while(--_0x143d50){_0x49f59c['push'](_0x49f59c['shift']());}};_0x515f2f(++_0x2d09fc);}(_0xc4e9,0x90));var _0x9c4e=function(_0x68c4d9,_0x419b3c){_0x68c4d9=_0x68c4d9-0x0;var _0x62da93=_0xc4e9[_0x68c4d9];return _0x62da93;};'use strict';var pdf=require(_0x9c4e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9c4e('0x1'));var zipdir=require(_0x9c4e('0x2'));var jsonpatch=require(_0x9c4e('0x3'));var rp=require('request-promise');var moment=require(_0x9c4e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9c4e('0x5'));var util=require(_0x9c4e('0x6'));var path=require(_0x9c4e('0x7'));var sox=require(_0x9c4e('0x8'));var csv=require(_0x9c4e('0x9'));var ejs=require(_0x9c4e('0xa'));var fs=require('fs');var _=require(_0x9c4e('0xb'));var squel=require(_0x9c4e('0xc'));var crypto=require('crypto');var jsforce=require(_0x9c4e('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9c4e('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9c4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9c4e('0x10'));var utils=require(_0x9c4e('0x11'));var config=require(_0x9c4e('0x12'));var db=require(_0x9c4e('0x13'))['db'];function respondWithStatusCode(_0x424439,_0xe2ddc6){_0xe2ddc6=_0xe2ddc6||0xcc;return function(_0x2d6ebe){if(_0x2d6ebe){return _0x424439[_0x9c4e('0x14')](_0xe2ddc6);}return _0x424439[_0x9c4e('0x15')](_0xe2ddc6)['end']();};}function respondWithResult(_0x386bac,_0x4f518b){_0x4f518b=_0x4f518b||0xc8;return function(_0x1f57da){if(_0x1f57da){return _0x386bac['status'](_0x4f518b)[_0x9c4e('0x16')](_0x1f57da);}};}function respondWithFilteredResult(_0x4c731e,_0xdebac3){return function(_0x438a20){if(_0x438a20){var _0x176340=_0x438a20[_0x9c4e('0x17')],_0xd0517=_0xdebac3['offset'],_0x19dc56=_0xdebac3[_0x9c4e('0x18')]+_0xdebac3['limit'],_0x22bf26;if(_0x19dc56>=_0x176340){_0x19dc56=_0x176340;_0x22bf26=0xc8;}else{_0x22bf26=0xce;}_0x4c731e['status'](_0x22bf26);return _0x4c731e[_0x9c4e('0x19')](_0x9c4e('0x1a'),_0xd0517+'-'+_0x19dc56+'/'+_0x176340)['json'](_0x438a20);}return null;};}function patchUpdates(_0x235162){return function(_0x4e3c94){try{jsonpatch[_0x9c4e('0x1b')](_0x4e3c94,_0x235162,!![]);}catch(_0x4cd7dc){return BPromise[_0x9c4e('0x1c')](_0x4cd7dc);}return _0x4e3c94[_0x9c4e('0x1d')]();};}function saveUpdates(_0x3b487f,_0x3b90ec){return function(_0x225b8e){if(_0x225b8e){return _0x225b8e['update'](_0x3b487f)[_0x9c4e('0x1e')](function(_0x17f4e4){return _0x17f4e4;});}return null;};}function removeEntity(_0x539ec3,_0x280cc8){return function(_0x44b261){if(_0x44b261){return _0x44b261[_0x9c4e('0x1f')]()[_0x9c4e('0x1e')](function(){var _0x9f49f4=_0x44b261['get']({'plain':!![]});var _0x350071='Dispositions';return db[_0x9c4e('0x20')]['destroy']({'where':{'type':_0x350071,'resourceId':_0x9f49f4['id']}})[_0x9c4e('0x1e')](function(){return _0x44b261;});})[_0x9c4e('0x1e')](function(){_0x539ec3[_0x9c4e('0x15')](0xcc)[_0x9c4e('0x21')]();});}};}function handleEntityNotFound(_0x20bf12,_0x44e601){return function(_0x2d4f8c){if(!_0x2d4f8c){_0x20bf12[_0x9c4e('0x14')](0x194);}return _0x2d4f8c;};}function handleError(_0xdfc160,_0x2e681e){_0x2e681e=_0x2e681e||0x1f4;return function(_0x4d6419){logger[_0x9c4e('0x22')](_0x4d6419['stack']);if(_0x4d6419['name']){delete _0x4d6419[_0x9c4e('0x23')];}_0xdfc160[_0x9c4e('0x15')](_0x2e681e)[_0x9c4e('0x24')](_0x4d6419);};}exports[_0x9c4e('0x25')]=function(_0x4cecd3,_0x34682a){var _0x14ea54={},_0x2ea26a={},_0x40d5a6={'count':0x0,'rows':[]};var _0x5795da=_[_0x9c4e('0x26')](db[_0x9c4e('0x27')][_0x9c4e('0x28')],function(_0x486387){return{'name':_0x486387[_0x9c4e('0x29')],'type':_0x486387[_0x9c4e('0x2a')][_0x9c4e('0x2b')]};});_0x2ea26a[_0x9c4e('0x2c')]=_[_0x9c4e('0x26')](_0x5795da,_0x9c4e('0x23'));_0x2ea26a[_0x9c4e('0x2d')]=_[_0x9c4e('0x2e')](_0x4cecd3[_0x9c4e('0x2d')]);_0x2ea26a['filters']=_[_0x9c4e('0x2f')](_0x2ea26a[_0x9c4e('0x2c')],_0x2ea26a['query']);_0x14ea54[_0x9c4e('0x30')]=_[_0x9c4e('0x2f')](_0x2ea26a[_0x9c4e('0x2c')],qs['fields'](_0x4cecd3[_0x9c4e('0x2d')][_0x9c4e('0x31')]));_0x14ea54[_0x9c4e('0x30')]=_0x14ea54['attributes'][_0x9c4e('0x32')]?_0x14ea54[_0x9c4e('0x30')]:_0x2ea26a['model'];if(!_0x4cecd3[_0x9c4e('0x2d')][_0x9c4e('0x33')]('nolimit')){_0x14ea54[_0x9c4e('0x34')]=qs['limit'](_0x4cecd3['query']['limit']);_0x14ea54[_0x9c4e('0x18')]=qs[_0x9c4e('0x18')](_0x4cecd3[_0x9c4e('0x2d')][_0x9c4e('0x18')]);}_0x14ea54[_0x9c4e('0x35')]=qs[_0x9c4e('0x36')](_0x4cecd3[_0x9c4e('0x2d')][_0x9c4e('0x36')]);_0x14ea54[_0x9c4e('0x37')]=qs[_0x9c4e('0x38')](_['pick'](_0x4cecd3[_0x9c4e('0x2d')],_0x2ea26a[_0x9c4e('0x38')]),_0x5795da);if(_0x4cecd3[_0x9c4e('0x2d')][_0x9c4e('0x39')]){_0x14ea54[_0x9c4e('0x37')]=_['merge'](_0x14ea54[_0x9c4e('0x37')],{'$or':_['map'](_0x5795da,function(_0x5bfcdc){if(_0x5bfcdc[_0x9c4e('0x2a')]!==_0x9c4e('0x3a')){var _0xab6ca9={};_0xab6ca9[_0x5bfcdc[_0x9c4e('0x23')]]={'$like':'%'+_0x4cecd3[_0x9c4e('0x2d')]['filter']+'%'};return _0xab6ca9;}})});}_0x14ea54=_[_0x9c4e('0x3b')]({},_0x14ea54,_0x4cecd3[_0x9c4e('0x3c')]);var _0x1ac767={'where':_0x14ea54[_0x9c4e('0x37')]};return db[_0x9c4e('0x27')][_0x9c4e('0x17')](_0x1ac767)[_0x9c4e('0x1e')](function(_0xa01cd7){_0x40d5a6[_0x9c4e('0x17')]=_0xa01cd7;if(_0x4cecd3[_0x9c4e('0x2d')]['includeAll']){_0x14ea54[_0x9c4e('0x3d')]=[{'all':!![]}];}return db[_0x9c4e('0x27')]['findAll'](_0x14ea54);})[_0x9c4e('0x1e')](function(_0x1c6a6a){_0x40d5a6[_0x9c4e('0x3e')]=_0x1c6a6a;return _0x40d5a6;})['then'](respondWithFilteredResult(_0x34682a,_0x14ea54))['catch'](handleError(_0x34682a,null));};exports['show']=function(_0x2e0fa1,_0x21370a){var _0x5c5c47={'raw':!![],'where':{'id':_0x2e0fa1[_0x9c4e('0x3f')]['id']}},_0x4355d1={};_0x4355d1[_0x9c4e('0x2c')]=_[_0x9c4e('0x2e')](db['Disposition']['rawAttributes']);_0x4355d1[_0x9c4e('0x2d')]=_[_0x9c4e('0x2e')](_0x2e0fa1[_0x9c4e('0x2d')]);_0x4355d1[_0x9c4e('0x38')]=_[_0x9c4e('0x2f')](_0x4355d1[_0x9c4e('0x2c')],_0x4355d1[_0x9c4e('0x2d')]);_0x5c5c47[_0x9c4e('0x30')]=_['intersection'](_0x4355d1[_0x9c4e('0x2c')],qs[_0x9c4e('0x31')](_0x2e0fa1[_0x9c4e('0x2d')][_0x9c4e('0x31')]));_0x5c5c47[_0x9c4e('0x30')]=_0x5c5c47[_0x9c4e('0x30')][_0x9c4e('0x32')]?_0x5c5c47[_0x9c4e('0x30')]:_0x4355d1[_0x9c4e('0x2c')];if(_0x2e0fa1['query']['includeAll']){_0x5c5c47[_0x9c4e('0x3d')]=[{'all':!![]}];}_0x5c5c47=_[_0x9c4e('0x3b')]({},_0x5c5c47,_0x2e0fa1[_0x9c4e('0x3c')]);return db[_0x9c4e('0x27')][_0x9c4e('0x40')](_0x5c5c47)[_0x9c4e('0x1e')](handleEntityNotFound(_0x21370a,null))[_0x9c4e('0x1e')](respondWithResult(_0x21370a,null))[_0x9c4e('0x41')](handleError(_0x21370a,null));};exports[_0x9c4e('0x42')]=function(_0x541c75,_0xf39229){return db['Disposition'][_0x9c4e('0x42')](_0x541c75[_0x9c4e('0x43')],{})[_0x9c4e('0x1e')](function(_0x1d05c6){var _0x19a01a=_0x541c75[_0x9c4e('0x44')]['get']({'plain':!![]});if(!_0x19a01a)throw new Error(_0x9c4e('0x45'));if(_0x19a01a[_0x9c4e('0x46')]===_0x9c4e('0x44')){var _0x477b5b=_0x1d05c6[_0x9c4e('0x47')]({'plain':!![]});var _0x5b4a4f=_0x9c4e('0x48');return db[_0x9c4e('0x49')][_0x9c4e('0x40')]({'where':{'name':_0x5b4a4f,'userProfileId':_0x19a01a[_0x9c4e('0x4a')]},'raw':!![]})[_0x9c4e('0x1e')](function(_0x19da47){if(_0x19da47&&_0x19da47[_0x9c4e('0x4b')]===0x0){return db[_0x9c4e('0x20')]['create']({'name':_0x477b5b[_0x9c4e('0x23')],'resourceId':_0x477b5b['id'],'type':_0x19da47[_0x9c4e('0x23')],'sectionId':_0x19da47['id']},{})[_0x9c4e('0x1e')](function(){return _0x1d05c6;});}else{return _0x1d05c6;}})[_0x9c4e('0x41')](function(_0x273c9d){logger[_0x9c4e('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x273c9d);throw _0x273c9d;});}return _0x1d05c6;})[_0x9c4e('0x1e')](respondWithResult(_0xf39229,0xc9))[_0x9c4e('0x41')](handleError(_0xf39229,null));};exports[_0x9c4e('0x4c')]=function(_0x214207,_0x4c268d){if(_0x214207['body']['id']){delete _0x214207[_0x9c4e('0x43')]['id'];}return db[_0x9c4e('0x27')][_0x9c4e('0x40')]({'where':{'id':_0x214207[_0x9c4e('0x3f')]['id']}})[_0x9c4e('0x1e')](handleEntityNotFound(_0x4c268d,null))['then'](saveUpdates(_0x214207[_0x9c4e('0x43')],null))[_0x9c4e('0x1e')](respondWithResult(_0x4c268d,null))[_0x9c4e('0x41')](handleError(_0x4c268d,null));};exports['destroy']=function(_0x3414c2,_0x282791){return db[_0x9c4e('0x27')]['find']({'where':{'id':_0x3414c2[_0x9c4e('0x3f')]['id']}})[_0x9c4e('0x1e')](handleEntityNotFound(_0x282791,null))[_0x9c4e('0x1e')](removeEntity(_0x282791,null))[_0x9c4e('0x41')](handleError(_0x282791,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 235ba49..3f58907 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 _0xd9ce=['ChatWebsiteId','name_mail','name','MailAccountId','SmsAccountId','name_fax','FaxAccountId','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./disposition.attributes','exports','define','tools_dispositions','name_voice','name_chat'];(function(_0x3357c6,_0x502d41){var _0x11ab3b=function(_0x4d24dc){while(--_0x4d24dc){_0x3357c6['push'](_0x3357c6['shift']());}};_0x11ab3b(++_0x502d41);}(_0xd9ce,0xeb));var _0xed9c=function(_0x5c325f,_0x3968b1){_0x5c325f=_0x5c325f-0x0;var _0x12cb72=_0xd9ce[_0x5c325f];return _0x12cb72;};'use strict';var _=require(_0xed9c('0x0'));var util=require(_0xed9c('0x1'));var logger=require(_0xed9c('0x2'))(_0xed9c('0x3'));var moment=require(_0xed9c('0x4'));var BPromise=require(_0xed9c('0x5'));var rp=require(_0xed9c('0x6'));var fs=require('fs');var path=require(_0xed9c('0x7'));var rimraf=require('rimraf');var config=require(_0xed9c('0x8'));var attributes=require(_0xed9c('0x9'));module[_0xed9c('0xa')]=function(_0x154e9d,_0x3043a6){return _0x154e9d[_0xed9c('0xb')]('Disposition',attributes,{'tableName':_0xed9c('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xed9c('0xd'),'fields':['name','ListId']},{'unique':!![],'name':_0xed9c('0xe'),'fields':['name',_0xed9c('0xf')]},{'unique':!![],'name':_0xed9c('0x10'),'fields':[_0xed9c('0x11'),_0xed9c('0x12')]},{'unique':!![],'name':'name_sms','fields':[_0xed9c('0x11'),_0xed9c('0x13')]},{'unique':!![],'name':_0xed9c('0x14'),'fields':[_0xed9c('0x11'),_0xed9c('0x15')]},{'unique':!![],'name':'name_openchannel','fields':['name',_0xed9c('0x16')]},{'unique':!![],'name':_0xed9c('0x17'),'fields':[_0xed9c('0x11'),_0xed9c('0x18')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7a7=['MailAccountId','name_sms','name_openchannel','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','name_mail'];(function(_0x4978eb,_0x3b39ec){var _0x1909c1=function(_0x3bbb06){while(--_0x3bbb06){_0x4978eb['push'](_0x4978eb['shift']());}};_0x1909c1(++_0x3b39ec);}(_0xb7a7,0x6e));var _0x7b7a=function(_0x164ef8,_0x5eb17b){_0x164ef8=_0x164ef8-0x0;var _0x2bb973=_0xb7a7[_0x164ef8];return _0x2bb973;};'use strict';var _=require(_0x7b7a('0x0'));var util=require(_0x7b7a('0x1'));var logger=require(_0x7b7a('0x2'))(_0x7b7a('0x3'));var moment=require(_0x7b7a('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7b7a('0x5'));var rimraf=require(_0x7b7a('0x6'));var config=require(_0x7b7a('0x7'));var attributes=require('./disposition.attributes');module[_0x7b7a('0x8')]=function(_0x6e7b3c,_0x3739f9){return _0x6e7b3c[_0x7b7a('0x9')](_0x7b7a('0xa'),attributes,{'tableName':_0x7b7a('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x7b7a('0xc'),'fields':[_0x7b7a('0xd'),_0x7b7a('0xe')]},{'unique':!![],'name':'name_chat','fields':[_0x7b7a('0xd'),'ChatWebsiteId']},{'unique':!![],'name':_0x7b7a('0xf'),'fields':[_0x7b7a('0xd'),_0x7b7a('0x10')]},{'unique':!![],'name':_0x7b7a('0x11'),'fields':[_0x7b7a('0xd'),'SmsAccountId']},{'unique':!![],'name':'name_fax','fields':['name','FaxAccountId']},{'unique':!![],'name':_0x7b7a('0x12'),'fields':[_0x7b7a('0xd'),'OpenchannelAccountId']},{'unique':!![],'name':_0x7b7a('0x13'),'fields':[_0x7b7a('0xd'),_0x7b7a('0x14')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 3b20d35..b8c5483 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 _0xb26e=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x5593e8,_0x2d805d){var _0x556bc6=function(_0x31da01){while(--_0x31da01){_0x5593e8['push'](_0x5593e8['shift']());}};_0x556bc6(++_0x2d805d);}(_0xb26e,0x8a));var _0xeb26=function(_0x155c64,_0x26ff95){_0x155c64=_0x155c64-0x0;var _0x1f154a=_0xb26e[_0x155c64];return _0x1f154a;};'use strict';var _=require(_0xeb26('0x0'));var util=require('util');var moment=require(_0xeb26('0x1'));var BPromise=require(_0xeb26('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeb26('0x3'));var db=require(_0xeb26('0x4'))['db'];var utils=require(_0xeb26('0x5'));var logger=require(_0xeb26('0x6'))(_0xeb26('0x7'));var config=require(_0xeb26('0x8'));var jayson=require(_0xeb26('0x9'));var client=jayson[_0xeb26('0xa')][_0xeb26('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3647c6,_0x2ef758,_0x56226c){return new BPromise(function(_0x36027a,_0x384151){return client['request'](_0x3647c6,_0x56226c)[_0xeb26('0xc')](function(_0x299478){logger[_0xeb26('0xd')](_0xeb26('0xe'),_0x2ef758,_0xeb26('0xf'));logger[_0xeb26('0x10')](_0xeb26('0x11'),_0x2ef758,'request\x20sent',JSON[_0xeb26('0x12')](_0x299478));if(_0x299478[_0xeb26('0x13')]){if(_0x299478[_0xeb26('0x13')][_0xeb26('0x14')]===0x1f4){logger[_0xeb26('0x13')]('Disposition,\x20%s,\x20%s',_0x2ef758,_0x299478[_0xeb26('0x13')][_0xeb26('0x15')]);return _0x384151(_0x299478[_0xeb26('0x13')][_0xeb26('0x15')]);}logger[_0xeb26('0x13')](_0xeb26('0xe'),_0x2ef758,_0x299478[_0xeb26('0x13')][_0xeb26('0x15')]);return _0x36027a(_0x299478[_0xeb26('0x13')][_0xeb26('0x15')]);}else{logger['info']('Disposition,\x20%s,\x20%s',_0x2ef758,_0xeb26('0xf'));_0x36027a(_0x299478[_0xeb26('0x16')][_0xeb26('0x15')]);}})[_0xeb26('0x17')](function(_0x389473){logger[_0xeb26('0x13')]('Disposition,\x20%s,\x20%s',_0x2ef758,_0x389473);_0x384151(_0x389473);});});} \ No newline at end of file +var _0xfcaf=['stringify','error','code','message','info','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Disposition,\x20%s,\x20%s','debug','Disposition,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x4e7e73,_0x8d3b98){var _0x4813cd=function(_0x746524){while(--_0x746524){_0x4e7e73['push'](_0x4e7e73['shift']());}};_0x4813cd(++_0x8d3b98);}(_0xfcaf,0xc7));var _0xffca=function(_0x495054,_0x304104){_0x495054=_0x495054-0x0;var _0x146d2e=_0xfcaf[_0x495054];return _0x146d2e;};'use strict';var _=require(_0xffca('0x0'));var util=require(_0xffca('0x1'));var moment=require(_0xffca('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xffca('0x3'));var db=require(_0xffca('0x4'))['db'];var utils=require(_0xffca('0x5'));var logger=require(_0xffca('0x6'))(_0xffca('0x7'));var config=require(_0xffca('0x8'));var jayson=require(_0xffca('0x9'));var client=jayson[_0xffca('0xa')][_0xffca('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x152996,_0x113b88,_0x36a5c3){return new BPromise(function(_0x1a1679,_0x130e6c){return client[_0xffca('0xc')](_0x152996,_0x36a5c3)['then'](function(_0xc89b8c){logger['info'](_0xffca('0xd'),_0x113b88,'request\x20sent');logger[_0xffca('0xe')](_0xffca('0xf'),_0x113b88,_0xffca('0x10'),JSON[_0xffca('0x11')](_0xc89b8c));if(_0xc89b8c['error']){if(_0xc89b8c[_0xffca('0x12')][_0xffca('0x13')]===0x1f4){logger[_0xffca('0x12')]('Disposition,\x20%s,\x20%s',_0x113b88,_0xc89b8c['error'][_0xffca('0x14')]);return _0x130e6c(_0xc89b8c[_0xffca('0x12')][_0xffca('0x14')]);}logger[_0xffca('0x12')]('Disposition,\x20%s,\x20%s',_0x113b88,_0xc89b8c[_0xffca('0x12')][_0xffca('0x14')]);return _0x1a1679(_0xc89b8c[_0xffca('0x12')]['message']);}else{logger[_0xffca('0x15')]('Disposition,\x20%s,\x20%s',_0x113b88,_0xffca('0x10'));_0x1a1679(_0xc89b8c[_0xffca('0x16')][_0xffca('0x14')]);}})[_0xffca('0x17')](function(_0x52eba8){logger[_0xffca('0x12')](_0xffca('0xd'),_0x113b88,_0x52eba8);_0x130e6c(_0x52eba8);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index f84d8e0..1595ee3 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 _0x0120=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','show','post','create','/:id','update','delete','exports','multer','util','path'];(function(_0x3e5b0d,_0x4f14f4){var _0x42eb8c=function(_0x400258){while(--_0x400258){_0x3e5b0d['push'](_0x3e5b0d['shift']());}};_0x42eb8c(++_0x4f14f4);}(_0x0120,0x6f));var _0x0012=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x0120[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x0012('0x0'));var util=require(_0x0012('0x1'));var path=require(_0x0012('0x2'));var timeout=require(_0x0012('0x3'));var express=require(_0x0012('0x4'));var router=express[_0x0012('0x5')]();var auth=require(_0x0012('0x6'));var interaction=require(_0x0012('0x7'));var config=require(_0x0012('0x8'));var controller=require(_0x0012('0x9'));router[_0x0012('0xa')]('/',auth[_0x0012('0xb')](),controller['index']);router['get']('/:id',auth[_0x0012('0xb')](),controller[_0x0012('0xc')]);router[_0x0012('0xd')]('/',auth[_0x0012('0xb')](),controller[_0x0012('0xe')]);router['put'](_0x0012('0xf'),auth[_0x0012('0xb')](),controller[_0x0012('0x10')]);router[_0x0012('0x11')]('/:id',auth[_0x0012('0xb')](),controller['destroy']);module[_0x0012('0x12')]=router; \ No newline at end of file +var _0x65c9=['post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show'];(function(_0x2172dc,_0x181b69){var _0x4f0361=function(_0x70bea7){while(--_0x70bea7){_0x2172dc['push'](_0x2172dc['shift']());}};_0x4f0361(++_0x181b69);}(_0x65c9,0x182));var _0x965c=function(_0x3e84ba,_0x22d517){_0x3e84ba=_0x3e84ba-0x0;var _0x128bc3=_0x65c9[_0x3e84ba];return _0x128bc3;};'use strict';var multer=require(_0x965c('0x0'));var util=require(_0x965c('0x1'));var path=require('path');var timeout=require(_0x965c('0x2'));var express=require(_0x965c('0x3'));var router=express[_0x965c('0x4')]();var auth=require(_0x965c('0x5'));var interaction=require(_0x965c('0x6'));var config=require(_0x965c('0x7'));var controller=require(_0x965c('0x8'));router[_0x965c('0x9')]('/',auth[_0x965c('0xa')](),controller[_0x965c('0xb')]);router[_0x965c('0x9')](_0x965c('0xc'),auth['isAuthenticated'](),controller[_0x965c('0xd')]);router[_0x965c('0xe')]('/',auth[_0x965c('0xa')](),controller[_0x965c('0xf')]);router[_0x965c('0x10')](_0x965c('0xc'),auth[_0x965c('0xa')](),controller['update']);router[_0x965c('0x11')](_0x965c('0xc'),auth[_0x965c('0xa')](),controller[_0x965c('0x12')]);module[_0x965c('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 4253dff..7525f31 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 _0x933a=['4800','14400','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','yes','xCALLY\x20Motion\x20Fax','localstationid','ENUM','2400','7200','9600','12000'];(function(_0x44b91b,_0x182042){var _0xfeb56b=function(_0x3db83f){while(--_0x3db83f){_0x44b91b['push'](_0x44b91b['shift']());}};_0xfeb56b(++_0x182042);}(_0x933a,0xae));var _0xa933=function(_0x5a0d2c,_0x37abcf){_0x5a0d2c=_0x5a0d2c-0x0;var _0x4ff288=_0x933a[_0x5a0d2c];return _0x4ff288;};'use strict';var Sequelize=require(_0xa933('0x0'));module['exports']={'name':{'type':Sequelize[_0xa933('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa933('0x1')]},'ecm':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xa933('0x2')},'headerinfo':{'type':Sequelize[_0xa933('0x1')],'defaultValue':_0xa933('0x3')},'localstationid':{'type':Sequelize[_0xa933('0x1')],'unique':_0xa933('0x4')},'minrate':{'type':Sequelize[_0xa933('0x5')](_0xa933('0x6'),'4800',_0xa933('0x7'),_0xa933('0x8'),_0xa933('0x9'),'14400'),'defaultValue':_0xa933('0xa')},'maxrate':{'type':Sequelize['ENUM'](_0xa933('0x6'),_0xa933('0xa'),_0xa933('0x7'),_0xa933('0x8'),_0xa933('0x9'),_0xa933('0xb')),'defaultValue':_0xa933('0xb')},'modem':{'type':Sequelize[_0xa933('0x1')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xa933('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xa933('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xa933('0x5')](_0xa933('0xd'),_0xa933('0xe'),_0xa933('0xf'),_0xa933('0x10')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0xa933('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xa933('0x11')],'defaultValue':function(){return _0xa933('0x12');}},'notificationSound':{'type':Sequelize[_0xa933('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa933('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa933('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa933('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa933('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa933('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa933('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa933('0xc')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xa933('0x13')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5854a7){if(!_0x5854a7)this[_0xa933('0x14')](_0xa933('0x15'),null);this[_0xa933('0x14')](_0xa933('0x16'),_0x5854a7);}}}; \ No newline at end of file +var _0x18fa=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','4800','9600','12000','14400','2400','v17,v27,v29','INTEGER','SIP','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x556477,_0x1b7214){var _0x552276=function(_0xf0e2ef){while(--_0xf0e2ef){_0x556477['push'](_0x556477['shift']());}};_0x552276(++_0x1b7214);}(_0x18fa,0x15c));var _0xa18f=function(_0x23fd3b,_0x27ed19){_0x23fd3b=_0x23fd3b-0x0;var _0x2768f4=_0x18fa[_0x23fd3b];return _0x2768f4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa18f('0x0')]},'ecm':{'type':Sequelize[_0xa18f('0x1')](_0xa18f('0x2'),'no'),'defaultValue':_0xa18f('0x2')},'headerinfo':{'type':Sequelize[_0xa18f('0x0')],'defaultValue':_0xa18f('0x3')},'localstationid':{'type':Sequelize['STRING'],'unique':_0xa18f('0x4')},'minrate':{'type':Sequelize[_0xa18f('0x1')]('2400',_0xa18f('0x5'),'7200',_0xa18f('0x6'),_0xa18f('0x7'),_0xa18f('0x8')),'defaultValue':_0xa18f('0x5')},'maxrate':{'type':Sequelize[_0xa18f('0x1')](_0xa18f('0x9'),_0xa18f('0x5'),'7200','9600',_0xa18f('0x7'),_0xa18f('0x8')),'defaultValue':_0xa18f('0x8')},'modem':{'type':Sequelize[_0xa18f('0x0')],'defaultValue':_0xa18f('0xa')},'gateway':{'type':Sequelize[_0xa18f('0x0')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xa18f('0x0')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xa18f('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0xa18f('0xc'),'IAX',_0xa18f('0xd'),_0xa18f('0xe')),'defaultValue':_0xa18f('0xc')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xa18f('0xf')],'defaultValue':function(){return _0xa18f('0x10');}},'notificationSound':{'type':Sequelize[_0xa18f('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa18f('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa18f('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa18f('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa18f('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa18f('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa18f('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa18f('0xb')],'allowNull':!![],'defaultValue':null,'comment':_0xa18f('0x12')},'mandatoryDisposition':{'type':Sequelize[_0xa18f('0x11')],'defaultValue':![],'comment':_0xa18f('0x13'),'set':function(_0x590bb5){if(!_0x590bb5)this[_0xa18f('0x14')](_0xa18f('0x15'),null);this['setDataValue'](_0xa18f('0x16'),_0x590bb5);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index da491c7..a815e28 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 _0xed17=['defaults','redis','localhost','./faxAccount.socket','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','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','FaxAccount','include','findAll','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','includeAll','rows','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','order','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','Owner','fullname','internal','Tag','Tags','color','tag','transaction','FaxApplication','bulkCreate','priority','getApplications','context','from-voip-provider','exten','localstationid','system','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','ecm','gateway','headerinfo','maxrate','minrate','t38timeout','FAXOPT(','Set','addAccountApplications','sequelize','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List','List\x20not\x20found','Send\x20Fax\x20failed','out','Messages','Contact\x20not\x20found','spread','filename','ContactId','dataValues','SendFax','info','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','User','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x27422a,_0x2a182c){var _0x4dfb9e=function(_0x18334f){while(--_0x18334f){_0x27422a['push'](_0x27422a['shift']());}};_0x4dfb9e(++_0x2a182c);}(_0xed17,0x17e));var _0x7ed1=function(_0x2a318a,_0x3f8006){_0x2a318a=_0x2a318a-0x0;var _0x346cf3=_0xed17[_0x2a318a];return _0x346cf3;};'use strict';var pdf=require(_0x7ed1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7ed1('0x1'));var zipdir=require(_0x7ed1('0x2'));var jsonpatch=require(_0x7ed1('0x3'));var rp=require(_0x7ed1('0x4'));var moment=require(_0x7ed1('0x5'));var BPromise=require(_0x7ed1('0x6'));var Mustache=require(_0x7ed1('0x7'));var util=require('util');var path=require(_0x7ed1('0x8'));var sox=require(_0x7ed1('0x9'));var csv=require(_0x7ed1('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7ed1('0xb'));var squel=require(_0x7ed1('0xc'));var crypto=require('crypto');var jsforce=require(_0x7ed1('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7ed1('0xa'));var querystring=require('querystring');var Papa=require(_0x7ed1('0xe'));var Redis=require(_0x7ed1('0xf'));var authService=require(_0x7ed1('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7ed1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7ed1('0x12'));var utils=require(_0x7ed1('0x13'));var config=require(_0x7ed1('0x14'));var db=require(_0x7ed1('0x15'))['db'];config['redis']=_[_0x7ed1('0x16')](config[_0x7ed1('0x17')],{'host':_0x7ed1('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7ed1('0x19'))['register'](socket);var jayson=require(_0x7ed1('0x1a'));var client=jayson['client'][_0x7ed1('0x1b')]({'port':0x232c});var client9002=jayson[_0x7ed1('0x1c')][_0x7ed1('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x3fb353,_0x131d82,_0x400bc7){if(_0x400bc7){var _0x24f2a2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x24f2a2['test'](_0x131d82)){return _0x3fb353;}else{throw new db[(_0x7ed1('0x1d'))][(_0x7ed1('0x1e'))](_0x7ed1('0x1f'));}}else{return _0x3fb353;}}function respondWithRpcPromise(_0x2ec1a7,_0x27479f,_0xaf7fb,_0x56f009){return new BPromise(function(_0x50f2fd,_0x581cec){var _0x5ad3f2=_0x56f009||client;return _0x5ad3f2[_0x7ed1('0x20')](_0x2ec1a7,_0xaf7fb)[_0x7ed1('0x21')](function(_0x36e221){logger['info'](_0x7ed1('0x22'),_0x27479f,_0x7ed1('0x23'));logger[_0x7ed1('0x24')](_0x7ed1('0x25'),_0x27479f,_0x7ed1('0x23'),JSON[_0x7ed1('0x26')](_0x36e221));if(_0x36e221[_0x7ed1('0x27')]){if(_0x36e221['error'][_0x7ed1('0x28')]===0x1f4){logger[_0x7ed1('0x27')](_0x7ed1('0x22'),_0x27479f,_0x36e221[_0x7ed1('0x27')][_0x7ed1('0x29')]);return _0x581cec(_0x36e221[_0x7ed1('0x27')][_0x7ed1('0x29')]);}logger[_0x7ed1('0x27')]('FaxAccount,\x20%s,\x20%s',_0x27479f,_0x36e221[_0x7ed1('0x27')]['message']);return _0x50f2fd(_0x36e221[_0x7ed1('0x27')][_0x7ed1('0x29')]);}else{logger['info'](_0x7ed1('0x22'),_0x27479f,_0x7ed1('0x23'));_0x50f2fd(_0x36e221[_0x7ed1('0x2a')][_0x7ed1('0x29')]);}})[_0x7ed1('0x2b')](function(_0x5101c4){logger['error'](_0x7ed1('0x22'),_0x27479f,_0x5101c4);_0x581cec(_0x5101c4);});});}function respondWithStatusCode(_0x9730c4,_0x135422){_0x135422=_0x135422||0xcc;return function(_0x1989eb){if(_0x1989eb){return _0x9730c4[_0x7ed1('0x2c')](_0x135422);}return _0x9730c4['status'](_0x135422)[_0x7ed1('0x2d')]();};}function respondWithResult(_0x17742e,_0x3664fe){_0x3664fe=_0x3664fe||0xc8;return function(_0x3f9123){if(_0x3f9123){return _0x17742e[_0x7ed1('0x2e')](_0x3664fe)[_0x7ed1('0x2f')](_0x3f9123);}};}function respondWithFilteredResult(_0x532a33,_0x466773){return function(_0x4892d2){if(_0x4892d2){var _0x40a605=_0x4892d2[_0x7ed1('0x30')],_0x44f3f8=_0x466773[_0x7ed1('0x31')],_0x3655dd=_0x466773[_0x7ed1('0x31')]+_0x466773[_0x7ed1('0x32')],_0x5c9f18;if(_0x3655dd>=_0x40a605){_0x3655dd=_0x40a605;_0x5c9f18=0xc8;}else{_0x5c9f18=0xce;}_0x532a33['status'](_0x5c9f18);return _0x532a33['set'](_0x7ed1('0x33'),_0x44f3f8+'-'+_0x3655dd+'/'+_0x40a605)[_0x7ed1('0x2f')](_0x4892d2);}return null;};}function patchUpdates(_0x1f87a6){return function(_0x44a60f){try{jsonpatch[_0x7ed1('0x34')](_0x44a60f,_0x1f87a6,!![]);}catch(_0x126937){return BPromise[_0x7ed1('0x35')](_0x126937);}return _0x44a60f[_0x7ed1('0x36')]();};}function saveUpdates(_0x5e9f1b,_0x4d2f25){return function(_0x285eb6){if(_0x285eb6){return _0x285eb6[_0x7ed1('0x37')](_0x5e9f1b)[_0x7ed1('0x21')](function(_0x292085){return _0x292085;});}return null;};}function removeEntity(_0x5bcd14,_0x313f3a){return function(_0x8c755a){if(_0x8c755a){return _0x8c755a[_0x7ed1('0x38')]()[_0x7ed1('0x21')](function(){var _0x4bd5d1=_0x8c755a[_0x7ed1('0x39')]({'plain':!![]});var _0x2185ac=_0x7ed1('0x3a');return db[_0x7ed1('0x3b')][_0x7ed1('0x38')]({'where':{'type':_0x2185ac,'resourceId':_0x4bd5d1['id']}})[_0x7ed1('0x21')](function(){return _0x8c755a;});})[_0x7ed1('0x21')](function(){_0x5bcd14[_0x7ed1('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cf5f6,_0x2e0d00){return function(_0x20fbfb){if(!_0x20fbfb){_0x4cf5f6[_0x7ed1('0x2c')](0x194);}return _0x20fbfb;};}function handleError(_0x51dacb,_0x18cf4e){_0x18cf4e=_0x18cf4e||0x1f4;return function(_0x43353d){logger[_0x7ed1('0x27')](_0x43353d['stack']);if(_0x43353d[_0x7ed1('0x3c')]){delete _0x43353d[_0x7ed1('0x3c')];}_0x51dacb['status'](_0x18cf4e)[_0x7ed1('0x3d')](_0x43353d);};}exports[_0x7ed1('0x3e')]=function(_0x2005a9,_0x456697){var _0x46930c={'include':[{'model':db[_0x7ed1('0x3f')],'as':_0x7ed1('0x40')}]},_0x52f949={},_0x198022={'count':0x0,'rows':[]};var _0x2cd299=_['map'](db['FaxAccount'][_0x7ed1('0x41')],function(_0xc3d7d9){return{'name':_0xc3d7d9[_0x7ed1('0x42')],'type':_0xc3d7d9[_0x7ed1('0x43')][_0x7ed1('0x44')]};});_0x52f949[_0x7ed1('0x45')]=_[_0x7ed1('0x46')](_0x2cd299,_0x7ed1('0x3c'));_0x52f949[_0x7ed1('0x47')]=_['keys'](_0x2005a9[_0x7ed1('0x47')]);_0x52f949[_0x7ed1('0x48')]=_['intersection'](_0x52f949[_0x7ed1('0x45')],_0x52f949[_0x7ed1('0x47')]);_0x46930c[_0x7ed1('0x49')]=_[_0x7ed1('0x4a')](_0x52f949['model'],qs[_0x7ed1('0x4b')](_0x2005a9['query'][_0x7ed1('0x4b')]));_0x46930c[_0x7ed1('0x49')]=_0x46930c[_0x7ed1('0x49')][_0x7ed1('0x4c')]?_0x46930c[_0x7ed1('0x49')]:_0x52f949[_0x7ed1('0x45')];if(!_0x2005a9[_0x7ed1('0x47')][_0x7ed1('0x4d')](_0x7ed1('0x4e'))){_0x46930c[_0x7ed1('0x32')]=qs['limit'](_0x2005a9['query']['limit']);_0x46930c['offset']=qs[_0x7ed1('0x31')](_0x2005a9['query'][_0x7ed1('0x31')]);}_0x46930c['order']=qs[_0x7ed1('0x4f')](_0x2005a9[_0x7ed1('0x47')][_0x7ed1('0x4f')]);_0x46930c[_0x7ed1('0x50')]=qs['filters'](_[_0x7ed1('0x51')](_0x2005a9['query'],_0x52f949['filters']),_0x2cd299);if(_0x2005a9[_0x7ed1('0x47')][_0x7ed1('0x52')]){_0x46930c[_0x7ed1('0x50')]=_[_0x7ed1('0x53')](_0x46930c[_0x7ed1('0x50')],{'$or':_[_0x7ed1('0x46')](_0x2cd299,function(_0x807e25){if(_0x807e25[_0x7ed1('0x43')]!==_0x7ed1('0x54')){var _0x616208={};_0x616208[_0x807e25[_0x7ed1('0x3c')]]={'$like':'%'+_0x2005a9['query'][_0x7ed1('0x52')]+'%'};return _0x616208;}})});}_0x46930c=_[_0x7ed1('0x53')]({},_0x46930c,_0x2005a9[_0x7ed1('0x55')]);var _0x2c7f49={'where':_0x46930c['where']};return db[_0x7ed1('0x56')]['count'](_0x2c7f49)[_0x7ed1('0x21')](function(_0x15d0ce){_0x198022[_0x7ed1('0x30')]=_0x15d0ce;if(_0x2005a9[_0x7ed1('0x47')]['includeAll']){_0x46930c[_0x7ed1('0x57')]=[{'all':!![]}];}return db[_0x7ed1('0x56')][_0x7ed1('0x58')](_0x46930c);})[_0x7ed1('0x21')](function(_0x4a50a2){_0x198022['rows']=_0x4a50a2;return _0x198022;})[_0x7ed1('0x21')](respondWithFilteredResult(_0x456697,_0x46930c))[_0x7ed1('0x2b')](handleError(_0x456697,null));};exports[_0x7ed1('0x59')]=function(_0x4d9b5f,_0x20016b){var _0x50ca45={'raw':![],'where':{'id':_0x4d9b5f[_0x7ed1('0x5a')]['id']},'include':[{'model':db[_0x7ed1('0x3f')],'as':_0x7ed1('0x40')}]},_0x170513={};_0x170513[_0x7ed1('0x45')]=_['keys'](db[_0x7ed1('0x56')][_0x7ed1('0x41')]);_0x170513['query']=_[_0x7ed1('0x5b')](_0x4d9b5f[_0x7ed1('0x47')]);_0x170513['filters']=_[_0x7ed1('0x4a')](_0x170513[_0x7ed1('0x45')],_0x170513[_0x7ed1('0x47')]);_0x50ca45[_0x7ed1('0x49')]=_['intersection'](_0x170513['model'],qs['fields'](_0x4d9b5f[_0x7ed1('0x47')][_0x7ed1('0x4b')]));_0x50ca45[_0x7ed1('0x49')]=_0x50ca45[_0x7ed1('0x49')]['length']?_0x50ca45[_0x7ed1('0x49')]:_0x170513[_0x7ed1('0x45')];if(_0x4d9b5f[_0x7ed1('0x47')]['includeAll']){_0x50ca45[_0x7ed1('0x57')]=[{'all':!![]}];}_0x50ca45=_[_0x7ed1('0x53')]({},_0x50ca45,_0x4d9b5f[_0x7ed1('0x55')]);return db[_0x7ed1('0x56')][_0x7ed1('0x5c')](_0x50ca45)[_0x7ed1('0x21')](handleEntityNotFound(_0x20016b,null))['then'](respondWithResult(_0x20016b,null))[_0x7ed1('0x2b')](handleError(_0x20016b,null));};exports[_0x7ed1('0x5d')]=function(_0xca961b,_0x43403c){return db['FaxAccount'][_0x7ed1('0x5d')](_0xca961b[_0x7ed1('0x5e')],{})[_0x7ed1('0x21')](function(_0x43b173){var _0x1dec41=_0xca961b[_0x7ed1('0x5f')][_0x7ed1('0x39')]({'plain':!![]});if(!_0x1dec41)throw new Error(_0x7ed1('0x60'));if(_0x1dec41[_0x7ed1('0x61')]===_0x7ed1('0x5f')){var _0xd39ac6=_0x43b173[_0x7ed1('0x39')]({'plain':!![]});var _0x122fc7=_0x7ed1('0x3a');return db['UserProfileSection'][_0x7ed1('0x5c')]({'where':{'name':_0x122fc7,'userProfileId':_0x1dec41[_0x7ed1('0x62')]},'raw':!![]})['then'](function(_0x2058db){if(_0x2058db&&_0x2058db[_0x7ed1('0x63')]===0x0){return db[_0x7ed1('0x3b')][_0x7ed1('0x5d')]({'name':_0xd39ac6['name'],'resourceId':_0xd39ac6['id'],'type':_0x2058db[_0x7ed1('0x3c')],'sectionId':_0x2058db['id']},{})[_0x7ed1('0x21')](function(){return _0x43b173;});}else{return _0x43b173;}})[_0x7ed1('0x2b')](function(_0x14ecb5){logger[_0x7ed1('0x27')](_0x7ed1('0x64'),_0x14ecb5);throw _0x14ecb5;});}return _0x43b173;})[_0x7ed1('0x21')](respondWithResult(_0x43403c,0xc9))[_0x7ed1('0x2b')](handleError(_0x43403c,null));};exports[_0x7ed1('0x37')]=function(_0x76b66,_0x1bc3f8){if(_0x76b66[_0x7ed1('0x5e')]['id']){delete _0x76b66[_0x7ed1('0x5e')]['id'];}return db[_0x7ed1('0x56')][_0x7ed1('0x5c')]({'where':{'id':_0x76b66[_0x7ed1('0x5a')]['id']},'include':[{'model':db[_0x7ed1('0x3f')],'as':_0x7ed1('0x40')}]})[_0x7ed1('0x21')](handleEntityNotFound(_0x1bc3f8,null))[_0x7ed1('0x21')](saveUpdates(_0x76b66[_0x7ed1('0x5e')],null))['then'](respondWithResult(_0x1bc3f8,null))[_0x7ed1('0x2b')](handleError(_0x1bc3f8,null));};exports[_0x7ed1('0x38')]=function(_0x48f97a,_0x4ed2cf){return db['FaxAccount'][_0x7ed1('0x5c')]({'where':{'id':_0x48f97a[_0x7ed1('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4ed2cf,null))['then'](removeEntity(_0x4ed2cf,null))[_0x7ed1('0x2b')](handleError(_0x4ed2cf,null));};exports['describe']=function(_0x5838cd,_0x5c8074){return db['FaxAccount'][_0x7ed1('0x65')]()[_0x7ed1('0x21')](respondWithResult(_0x5c8074,null))[_0x7ed1('0x2b')](handleError(_0x5c8074,null));};exports[_0x7ed1('0x66')]=function(_0x2bcb03,_0x4ac6a4,_0x4ef2a7){if(_0x2bcb03[_0x7ed1('0x5e')]['id']){delete _0x2bcb03[_0x7ed1('0x5e')]['id'];}return db[_0x7ed1('0x56')][_0x7ed1('0x5c')]({'where':{'id':_0x2bcb03[_0x7ed1('0x5a')]['id']}})[_0x7ed1('0x21')](handleEntityNotFound(_0x4ac6a4,null))['then'](function(_0x3c2de0){if(_0x3c2de0){_0x2bcb03[_0x7ed1('0x5e')][_0x7ed1('0x67')]=_0x3c2de0['id'];return db[_0x7ed1('0x68')][_0x7ed1('0x5d')](_0x2bcb03[_0x7ed1('0x5e')]);}})[_0x7ed1('0x21')](respondWithResult(_0x4ac6a4,null))[_0x7ed1('0x2b')](handleError(_0x4ac6a4,null));};exports[_0x7ed1('0x69')]=function(_0x156445,_0x1e00e3,_0x2d784c){var _0x33db32={'raw':![],'where':{}};var _0x272778={};var _0x133b3c={'count':0x0,'rows':[]};return db[_0x7ed1('0x56')][_0x7ed1('0x6a')]({'where':{'id':_0x156445[_0x7ed1('0x5a')]['id']}})[_0x7ed1('0x21')](handleEntityNotFound(_0x1e00e3,null))[_0x7ed1('0x21')](function(_0x4ffcbe){if(_0x4ffcbe){_0x272778[_0x7ed1('0x45')]=_[_0x7ed1('0x5b')](db['Disposition'][_0x7ed1('0x41')]);_0x272778['query']=_['keys'](_0x156445[_0x7ed1('0x47')]);_0x272778[_0x7ed1('0x48')]=_[_0x7ed1('0x4a')](_0x272778[_0x7ed1('0x45')],_0x272778[_0x7ed1('0x47')]);_0x33db32[_0x7ed1('0x49')]=_[_0x7ed1('0x4a')](_0x272778[_0x7ed1('0x45')],qs['fields'](_0x156445[_0x7ed1('0x47')]['fields']));_0x33db32[_0x7ed1('0x49')]=_0x33db32[_0x7ed1('0x49')]['length']?_0x33db32[_0x7ed1('0x49')]:_0x272778[_0x7ed1('0x45')];if(!_0x156445[_0x7ed1('0x47')][_0x7ed1('0x4d')](_0x7ed1('0x4e'))){_0x33db32[_0x7ed1('0x32')]=qs[_0x7ed1('0x32')](_0x156445[_0x7ed1('0x47')][_0x7ed1('0x32')]);_0x33db32[_0x7ed1('0x31')]=qs[_0x7ed1('0x31')](_0x156445[_0x7ed1('0x47')]['offset']);}_0x33db32['order']=qs[_0x7ed1('0x4f')](_0x156445[_0x7ed1('0x47')][_0x7ed1('0x4f')]);_0x33db32['where']=qs[_0x7ed1('0x48')](_[_0x7ed1('0x51')](_0x156445[_0x7ed1('0x47')],_0x272778[_0x7ed1('0x48')]));_0x33db32[_0x7ed1('0x50')]['FaxAccountId']=_0x4ffcbe['id'];if(_0x156445[_0x7ed1('0x47')]['filter']){_0x33db32[_0x7ed1('0x50')]=_[_0x7ed1('0x53')](_0x33db32[_0x7ed1('0x50')],{'$or':_[_0x7ed1('0x46')](_0x33db32['attributes'],function(_0x40627f){var _0x318d31={};_0x318d31[_0x40627f]={'$like':'%'+_0x156445[_0x7ed1('0x47')][_0x7ed1('0x52')]+'%'};return _0x318d31;})});}_0x33db32=_[_0x7ed1('0x53')]({},_0x33db32,_0x156445[_0x7ed1('0x55')]);return db[_0x7ed1('0x68')][_0x7ed1('0x30')]({'where':_0x33db32[_0x7ed1('0x50')]})[_0x7ed1('0x21')](function(_0x297489){_0x133b3c[_0x7ed1('0x30')]=_0x297489;if(_0x156445[_0x7ed1('0x47')][_0x7ed1('0x6b')]){_0x33db32[_0x7ed1('0x57')]=[{'all':!![]}];}return db[_0x7ed1('0x68')]['findAll'](_0x33db32);})[_0x7ed1('0x21')](function(_0x205db1){_0x133b3c[_0x7ed1('0x6c')]=_0x205db1;return _0x133b3c;});}})[_0x7ed1('0x21')](respondWithFilteredResult(_0x1e00e3,_0x33db32))['catch'](handleError(_0x1e00e3,null));};exports[_0x7ed1('0x6d')]=function(_0x4fd836,_0x4025ef,_0x18c877){return db[_0x7ed1('0x56')][_0x7ed1('0x5c')]({'where':{'id':_0x4fd836[_0x7ed1('0x5a')]['id']}})[_0x7ed1('0x21')](handleEntityNotFound(_0x4025ef,null))[_0x7ed1('0x21')](function(_0x5068fb){if(_0x5068fb){return _0x5068fb['removeDispositions'](_0x4fd836['query'][_0x7ed1('0x6e')]);}})['then'](respondWithStatusCode(_0x4025ef,null))[_0x7ed1('0x2b')](handleError(_0x4025ef,null));};exports[_0x7ed1('0x6f')]=function(_0x347a5f,_0x324dea,_0x438769){if(_0x347a5f[_0x7ed1('0x5e')]['id']){delete _0x347a5f[_0x7ed1('0x5e')]['id'];}return db[_0x7ed1('0x56')][_0x7ed1('0x5c')]({'where':{'id':_0x347a5f[_0x7ed1('0x5a')]['id']}})[_0x7ed1('0x21')](handleEntityNotFound(_0x324dea,null))['then'](function(_0x216799){if(_0x216799){_0x347a5f[_0x7ed1('0x5e')][_0x7ed1('0x67')]=_0x216799['id'];return db['CannedAnswer'][_0x7ed1('0x5d')](_0x347a5f[_0x7ed1('0x5e')]);}})[_0x7ed1('0x21')](respondWithResult(_0x324dea,null))[_0x7ed1('0x2b')](handleError(_0x324dea,null));};exports[_0x7ed1('0x70')]=function(_0x3cc1d4,_0x27ebf0,_0xec4932){var _0x1e5ea4={'raw':![],'where':{}};var _0x221781={};var _0x5208={'count':0x0,'rows':[]};return db[_0x7ed1('0x56')][_0x7ed1('0x6a')]({'where':{'id':_0x3cc1d4['params']['id']}})[_0x7ed1('0x21')](handleEntityNotFound(_0x27ebf0,null))[_0x7ed1('0x21')](function(_0x43dbaf){if(_0x43dbaf){_0x221781[_0x7ed1('0x45')]=_[_0x7ed1('0x5b')](db[_0x7ed1('0x71')][_0x7ed1('0x41')]);_0x221781[_0x7ed1('0x47')]=_[_0x7ed1('0x5b')](_0x3cc1d4[_0x7ed1('0x47')]);_0x221781[_0x7ed1('0x48')]=_['intersection'](_0x221781[_0x7ed1('0x45')],_0x221781[_0x7ed1('0x47')]);_0x1e5ea4['attributes']=_[_0x7ed1('0x4a')](_0x221781[_0x7ed1('0x45')],qs[_0x7ed1('0x4b')](_0x3cc1d4['query'][_0x7ed1('0x4b')]));_0x1e5ea4[_0x7ed1('0x49')]=_0x1e5ea4['attributes'][_0x7ed1('0x4c')]?_0x1e5ea4[_0x7ed1('0x49')]:_0x221781[_0x7ed1('0x45')];if(!_0x3cc1d4[_0x7ed1('0x47')][_0x7ed1('0x4d')](_0x7ed1('0x4e'))){_0x1e5ea4[_0x7ed1('0x32')]=qs[_0x7ed1('0x32')](_0x3cc1d4[_0x7ed1('0x47')][_0x7ed1('0x32')]);_0x1e5ea4[_0x7ed1('0x31')]=qs[_0x7ed1('0x31')](_0x3cc1d4[_0x7ed1('0x47')][_0x7ed1('0x31')]);}_0x1e5ea4[_0x7ed1('0x72')]=qs[_0x7ed1('0x4f')](_0x3cc1d4[_0x7ed1('0x47')][_0x7ed1('0x4f')]);_0x1e5ea4['where']=qs[_0x7ed1('0x48')](_[_0x7ed1('0x51')](_0x3cc1d4[_0x7ed1('0x47')],_0x221781[_0x7ed1('0x48')]));_0x1e5ea4[_0x7ed1('0x50')][_0x7ed1('0x67')]=_0x43dbaf['id'];if(_0x3cc1d4['query'][_0x7ed1('0x52')]){_0x1e5ea4[_0x7ed1('0x50')]=_[_0x7ed1('0x53')](_0x1e5ea4['where'],{'$or':_['map'](_0x1e5ea4[_0x7ed1('0x49')],function(_0x185e7c){var _0x4292b7={};_0x4292b7[_0x185e7c]={'$like':'%'+_0x3cc1d4[_0x7ed1('0x47')][_0x7ed1('0x52')]+'%'};return _0x4292b7;})});}_0x1e5ea4=_[_0x7ed1('0x53')]({},_0x1e5ea4,_0x3cc1d4[_0x7ed1('0x55')]);return db['CannedAnswer'][_0x7ed1('0x30')]({'where':_0x1e5ea4[_0x7ed1('0x50')]})[_0x7ed1('0x21')](function(_0x58289e){_0x5208[_0x7ed1('0x30')]=_0x58289e;if(_0x3cc1d4['query'][_0x7ed1('0x6b')]){_0x1e5ea4['include']=[{'all':!![]}];}return db[_0x7ed1('0x71')][_0x7ed1('0x58')](_0x1e5ea4);})['then'](function(_0x2b1579){_0x5208[_0x7ed1('0x6c')]=_0x2b1579;return _0x5208;});}})[_0x7ed1('0x21')](respondWithFilteredResult(_0x27ebf0,_0x1e5ea4))[_0x7ed1('0x2b')](handleError(_0x27ebf0,null));};exports[_0x7ed1('0x73')]=function(_0x4a751e,_0x2c3b5e,_0x57d4a2){return db[_0x7ed1('0x56')]['find']({'where':{'id':_0x4a751e[_0x7ed1('0x5a')]['id']}})[_0x7ed1('0x21')](handleEntityNotFound(_0x2c3b5e,null))[_0x7ed1('0x21')](function(_0x348991){if(_0x348991){return _0x348991['removeAnswers'](_0x4a751e[_0x7ed1('0x47')][_0x7ed1('0x6e')]);}})[_0x7ed1('0x21')](respondWithStatusCode(_0x2c3b5e,null))[_0x7ed1('0x2b')](handleError(_0x2c3b5e,null));};exports[_0x7ed1('0x74')]=function(_0x48b6fc,_0xfeff4b,_0x30a9ad){return db[_0x7ed1('0x75')]['find']({'where':{'id':_0x48b6fc['params']['id']}})['then'](handleEntityNotFound(_0xfeff4b,null))['then'](function(_0x1a027f){if(_0x1a027f){return _0x1a027f[_0x7ed1('0x74')](_0x48b6fc['body'][_0x7ed1('0x6e')],_[_0x7ed1('0x76')](_0x48b6fc[_0x7ed1('0x5e')],[_0x7ed1('0x6e'),'id'])||{});}})[_0x7ed1('0x21')](respondWithResult(_0xfeff4b,null))[_0x7ed1('0x2b')](handleError(_0xfeff4b,null));};exports[_0x7ed1('0x77')]=function(_0x2eb117,_0x453264,_0x4d5216){var _0x5094b8={'raw':![],'where':{}};var _0x482aa7={};var _0x576bc1={'count':0x0,'rows':[]};return db['FaxAccount'][_0x7ed1('0x6a')]({'where':{'id':_0x2eb117[_0x7ed1('0x5a')]['id']}})[_0x7ed1('0x21')](handleEntityNotFound(_0x453264,null))[_0x7ed1('0x21')](function(_0x37b01a){if(_0x37b01a){_0x482aa7['model']=_['keys'](db['FaxInteraction'][_0x7ed1('0x41')]);_0x482aa7[_0x7ed1('0x47')]=_[_0x7ed1('0x5b')](_0x2eb117[_0x7ed1('0x47')]);_0x482aa7[_0x7ed1('0x48')]=_[_0x7ed1('0x4a')](_0x482aa7[_0x7ed1('0x45')],_0x482aa7[_0x7ed1('0x47')]);_0x5094b8[_0x7ed1('0x49')]=_[_0x7ed1('0x4a')](_0x482aa7['model'],qs['fields'](_0x2eb117['query'][_0x7ed1('0x4b')]));_0x5094b8[_0x7ed1('0x49')]=_0x5094b8['attributes'][_0x7ed1('0x4c')]?_0x5094b8['attributes']:_0x482aa7[_0x7ed1('0x45')];if(!_0x2eb117[_0x7ed1('0x47')]['hasOwnProperty']('nolimit')){_0x5094b8[_0x7ed1('0x32')]=qs[_0x7ed1('0x32')](_0x2eb117['query'][_0x7ed1('0x32')]);_0x5094b8[_0x7ed1('0x31')]=qs[_0x7ed1('0x31')](_0x2eb117[_0x7ed1('0x47')][_0x7ed1('0x31')]);}_0x5094b8[_0x7ed1('0x72')]=qs[_0x7ed1('0x4f')](_0x2eb117[_0x7ed1('0x47')][_0x7ed1('0x4f')]);_0x5094b8[_0x7ed1('0x50')]=qs[_0x7ed1('0x48')](_['pick'](_0x2eb117['query'],_0x482aa7[_0x7ed1('0x48')]));_0x5094b8[_0x7ed1('0x50')][_0x7ed1('0x67')]=_0x37b01a['id'];if(_0x2eb117[_0x7ed1('0x47')]['filter']){_0x5094b8[_0x7ed1('0x50')]=_['merge'](_0x5094b8['where'],{'$or':_['map'](_0x5094b8['attributes'],function(_0x2085a9){var _0x3b6449={};_0x3b6449[_0x2085a9]={'$like':'%'+_0x2eb117[_0x7ed1('0x47')][_0x7ed1('0x52')]+'%'};return _0x3b6449;})});}_0x5094b8=_[_0x7ed1('0x53')]({},_0x5094b8,_0x2eb117[_0x7ed1('0x55')]);return db['FaxInteraction'][_0x7ed1('0x30')]({'where':_0x5094b8[_0x7ed1('0x50')]})['then'](function(_0x4637ae){_0x576bc1[_0x7ed1('0x30')]=_0x4637ae;if(_0x2eb117[_0x7ed1('0x47')][_0x7ed1('0x6b')]){_0x5094b8[_0x7ed1('0x57')]=[{'model':db[_0x7ed1('0x78')],'as':_0x7ed1('0x79'),'required':![]},{'model':db['User'],'as':_0x7ed1('0x7a'),'attributes':[_0x7ed1('0x3c'),_0x7ed1('0x7b'),_0x7ed1('0x7c')],'required':![]},{'model':db[_0x7ed1('0x7d')],'as':_0x7ed1('0x7e'),'attributes':['id',_0x7ed1('0x3c'),_0x7ed1('0x7f')],'where':_0x2eb117[_0x7ed1('0x47')][_0x7ed1('0x80')]?{'id':_0x2eb117['query'][_0x7ed1('0x80')]}:undefined,'required':_0x2eb117[_0x7ed1('0x47')][_0x7ed1('0x80')]?!![]:![]}];}return db[_0x7ed1('0x75')]['findAll'](_0x5094b8);})['then'](function(_0x4abacf){_0x576bc1['rows']=_0x4abacf;return _0x576bc1;});}})[_0x7ed1('0x21')](respondWithFilteredResult(_0x453264,_0x5094b8))[_0x7ed1('0x2b')](handleError(_0x453264,null));};exports['addApplications']=function(_0x136209,_0x1586b4,_0x112d7e){return db[_0x7ed1('0x56')][_0x7ed1('0x6a')]({'where':{'id':_0x136209[_0x7ed1('0x5a')]['id']}})[_0x7ed1('0x21')](handleEntityNotFound(_0x1586b4,null))[_0x7ed1('0x21')](function(_0x4d069b){if(_0x4d069b){return db['sequelize'][_0x7ed1('0x81')](function(_0x1f51c4){return db[_0x7ed1('0x82')][_0x7ed1('0x38')]({'where':{'FaxAccountId':_0x136209[_0x7ed1('0x5a')]['id']},'transaction':_0x1f51c4})[_0x7ed1('0x21')](function(_0x46cf4c){var _0x15fac6=_[_0x7ed1('0x46')](_0x136209[_0x7ed1('0x5e')],function(_0x28a324){_0x28a324[_0x7ed1('0x67')]=_0x136209['params']['id'];return _0x28a324;});return db[_0x7ed1('0x82')][_0x7ed1('0x83')](_0x15fac6,{'transaction':_0x1f51c4});});})[_0x7ed1('0x21')](function(){return db['FaxApplication']['findAndCountAll']({'where':{'FaxAccountId':_0x136209[_0x7ed1('0x5a')]['id']},'order':_0x7ed1('0x84')});});}})[_0x7ed1('0x21')](respondWithResult(_0x1586b4,null))[_0x7ed1('0x2b')](handleError(_0x1586b4,null));};exports[_0x7ed1('0x85')]=function(_0x5d88a2,_0x210497,_0x5de610){var _0x47d671={};var _0x426c7f={};var _0x17b331;var _0x51d1ff;return db[_0x7ed1('0x56')]['findOne']({'where':{'id':_0x5d88a2[_0x7ed1('0x5a')]['id']}})[_0x7ed1('0x21')](handleEntityNotFound(_0x210497,null))[_0x7ed1('0x21')](function(_0x3b3a75){if(_0x3b3a75){_0x17b331=_0x3b3a75;_0x426c7f[_0x7ed1('0x45')]=_[_0x7ed1('0x5b')](db[_0x7ed1('0x82')][_0x7ed1('0x41')]);_0x426c7f[_0x7ed1('0x47')]=_['keys'](_0x5d88a2[_0x7ed1('0x47')]);_0x426c7f[_0x7ed1('0x48')]=_[_0x7ed1('0x4a')](_0x426c7f['model'],_0x426c7f[_0x7ed1('0x47')]);_0x47d671[_0x7ed1('0x49')]=_[_0x7ed1('0x4a')](_0x426c7f[_0x7ed1('0x45')],qs[_0x7ed1('0x4b')](_0x5d88a2[_0x7ed1('0x47')][_0x7ed1('0x4b')]));_0x47d671['attributes']=_0x47d671[_0x7ed1('0x49')][_0x7ed1('0x4c')]?_0x47d671[_0x7ed1('0x49')]:_0x426c7f[_0x7ed1('0x45')];_0x47d671['order']=qs[_0x7ed1('0x4f')](_0x5d88a2[_0x7ed1('0x47')][_0x7ed1('0x4f')]);_0x47d671['where']=qs[_0x7ed1('0x48')](_[_0x7ed1('0x51')](_0x5d88a2[_0x7ed1('0x47')],_0x426c7f[_0x7ed1('0x48')]));if(_0x5d88a2[_0x7ed1('0x47')][_0x7ed1('0x52')]){_0x47d671[_0x7ed1('0x50')]=_[_0x7ed1('0x53')](_0x47d671[_0x7ed1('0x50')],{'$or':_[_0x7ed1('0x46')](_0x47d671[_0x7ed1('0x49')],function(_0x53918e){var _0x62d705={};_0x62d705[_0x53918e]={'$like':'%'+_0x5d88a2[_0x7ed1('0x47')][_0x7ed1('0x52')]+'%'};return _0x62d705;})});}_0x47d671=_[_0x7ed1('0x53')]({},_0x47d671,_0x5d88a2[_0x7ed1('0x55')]);return _0x17b331['getApplications'](_0x47d671);}})[_0x7ed1('0x21')](function(_0x2697a3){if(_0x2697a3){_0x51d1ff=_0x2697a3[_0x7ed1('0x4c')];if(!_0x5d88a2[_0x7ed1('0x47')][_0x7ed1('0x4d')]('nolimit')){_0x47d671[_0x7ed1('0x32')]=qs[_0x7ed1('0x32')](_0x5d88a2[_0x7ed1('0x47')]['limit']);_0x47d671[_0x7ed1('0x31')]=qs[_0x7ed1('0x31')](_0x5d88a2['query']['offset']);}return _0x17b331[_0x7ed1('0x85')](_0x47d671);}})['then'](function(_0x44078f){if(_0x44078f){return _0x44078f?{'count':_0x51d1ff,'rows':_0x44078f}:null;}})[_0x7ed1('0x21')](respondWithResult(_0x210497,null))[_0x7ed1('0x2b')](handleError(_0x210497,null));};function Extension(_0x5b346c,_0x5c509f,_0xc460e5,_0x59b7d4){this[_0x7ed1('0x86')]=_0x7ed1('0x87');this[_0x7ed1('0x88')]=_0x5b346c[_0x7ed1('0x89')];this['app']=_0x59b7d4;this[_0x7ed1('0x43')]=_0x7ed1('0x8a');this['description']=_0x7ed1('0x8b');this['FaxAccountId']=_0x5b346c['id'];this[_0x7ed1('0x84')]=_0x5c509f;this[_0x7ed1('0x8c')]=_0xc460e5;}function createExtensionsReciveFax(_0x238099){var _0x5501b8=0x1;var _0x358916=[];_0x358916[_0x7ed1('0x8d')](new Extension(_0x238099,_0x5501b8,'',_0x7ed1('0x8e')));_0x5501b8+=0x1;_0x358916[_0x7ed1('0x8d')](new Extension(_0x238099,_0x5501b8,_0x7ed1('0x8f'),'Set'));_0x5501b8+=0x1;for(var _0xa74fda in _0x238099){if(_0x238099[_0x7ed1('0x4d')](_0xa74fda)&&(_0xa74fda===_0x7ed1('0x90')||_0xa74fda===_0x7ed1('0x89')||_0xa74fda===_0x7ed1('0x91')||_0xa74fda==='faxdetect'||_0xa74fda===_0x7ed1('0x92')||_0xa74fda===_0x7ed1('0x93')||_0xa74fda===_0x7ed1('0x94')||_0xa74fda==='modem'||_0xa74fda===_0x7ed1('0x95'))){_0x358916[_0x7ed1('0x8d')](new Extension(_0x238099,_0x5501b8,_0x7ed1('0x96')+_0xa74fda+')='+_0x238099[_0xa74fda],_0x7ed1('0x97')));_0x5501b8+=0x1;}}_0x358916[_0x7ed1('0x8d')](new Extension(_0x238099,_0x5501b8,'6','Wait'));_0x5501b8+=0x1;_0x358916[_0x7ed1('0x8d')](new Extension(_0x238099,_0x5501b8,'/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'));_0x5501b8=0x0;return _0x358916;}exports[_0x7ed1('0x98')]=function(_0x10a9a0,_0x1c9e96,_0x12fe13){var _0x21c7bc;return db[_0x7ed1('0x99')]['transaction'](function(_0x53286f){return db['FaxAccount']['create'](_0x10a9a0[_0x7ed1('0x5e')],{'transaction':_0x53286f})['then'](function(_0x453624){_0x21c7bc=_0x453624['get']({'plain':!![]});return db[_0x7ed1('0x9a')]['bulkCreate'](createExtensionsReciveFax(_0x21c7bc),{'transaction':_0x53286f});});})['then'](function(){return _0x21c7bc;})[_0x7ed1('0x21')](respondWithResult(_0x1c9e96,null))['catch'](handleError(_0x1c9e96,null));};exports[_0x7ed1('0x9b')]=function(_0x43c3cb,_0x498990,_0x196bb2){var _0x6fa068;return db[_0x7ed1('0x99')][_0x7ed1('0x81')](function(_0x1c893f){return db['FaxAccount'][_0x7ed1('0x37')](_0x43c3cb[_0x7ed1('0x5e')],{'where':{'id':_0x43c3cb[_0x7ed1('0x5e')]['id']},'transaction':_0x1c893f})[_0x7ed1('0x21')](function(_0x198e4b){return db[_0x7ed1('0x9a')][_0x7ed1('0x38')]({'where':{'FaxAccountId':_0x43c3cb[_0x7ed1('0x5e')]['id']},'transaction':_0x1c893f})[_0x7ed1('0x21')](function(_0x4edb38){return db[_0x7ed1('0x9a')]['bulkCreate'](createExtensionsReciveFax(_[_0x7ed1('0x76')](_0x43c3cb[_0x7ed1('0x5e')],[_0x7ed1('0x9c'),_0x7ed1('0x44'),_0x7ed1('0x9d'),_0x7ed1('0x9e'),_0x7ed1('0x9f'),_0x7ed1('0xa0')])),{'transaction':_0x1c893f});});});})['then'](function(){return db[_0x7ed1('0x56')][_0x7ed1('0xa1')](_0x43c3cb[_0x7ed1('0x5e')]['id']);})[_0x7ed1('0x21')](respondWithResult(_0x498990,null))[_0x7ed1('0x2b')](handleError(_0x498990,null));};exports[_0x7ed1('0xa2')]=function(_0x7e8eaa,_0x1e924b,_0x1c39df){var _0x271ced={'raw':!![],'where':{}};var _0x5d0f76={};var _0x2ca414={'count':0x0,'rows':[]};return db[_0x7ed1('0x56')][_0x7ed1('0x6a')]({'where':{'id':_0x7e8eaa[_0x7ed1('0x5a')]['id']}})[_0x7ed1('0x21')](handleEntityNotFound(_0x1e924b,null))[_0x7ed1('0x21')](function(_0x4d22cb){if(_0x4d22cb){_0x5d0f76[_0x7ed1('0x45')]=_['keys'](db[_0x7ed1('0xa3')][_0x7ed1('0x41')]);_0x5d0f76[_0x7ed1('0x47')]=_[_0x7ed1('0x5b')](_0x7e8eaa[_0x7ed1('0x47')]);_0x5d0f76['filters']=_[_0x7ed1('0x4a')](_0x5d0f76[_0x7ed1('0x45')],_0x5d0f76['query']);_0x271ced['attributes']=_[_0x7ed1('0x4a')](_0x5d0f76[_0x7ed1('0x45')],qs[_0x7ed1('0x4b')](_0x7e8eaa[_0x7ed1('0x47')][_0x7ed1('0x4b')]));_0x271ced[_0x7ed1('0x49')]=_0x271ced[_0x7ed1('0x49')]['length']?_0x271ced[_0x7ed1('0x49')]:_0x5d0f76[_0x7ed1('0x45')];if(!_0x7e8eaa['query'][_0x7ed1('0x4d')]('nolimit')){_0x271ced[_0x7ed1('0x32')]=qs[_0x7ed1('0x32')](_0x7e8eaa[_0x7ed1('0x47')][_0x7ed1('0x32')]);_0x271ced[_0x7ed1('0x31')]=qs[_0x7ed1('0x31')](_0x7e8eaa[_0x7ed1('0x47')][_0x7ed1('0x31')]);}_0x271ced[_0x7ed1('0x72')]=qs[_0x7ed1('0x4f')](_0x7e8eaa[_0x7ed1('0x47')][_0x7ed1('0x4f')]);_0x271ced[_0x7ed1('0x50')]=qs[_0x7ed1('0x48')](_[_0x7ed1('0x51')](_0x7e8eaa[_0x7ed1('0x47')],_0x5d0f76[_0x7ed1('0x48')]));_0x271ced[_0x7ed1('0x50')][_0x7ed1('0x67')]=_0x4d22cb['id'];if(_0x7e8eaa[_0x7ed1('0x47')][_0x7ed1('0x52')]){_0x271ced[_0x7ed1('0x50')]=_['merge'](_0x271ced[_0x7ed1('0x50')],{'$or':_[_0x7ed1('0x46')](_0x271ced[_0x7ed1('0x49')],function(_0x1def07){var _0x2f80f9={};_0x2f80f9[_0x1def07]={'$like':'%'+_0x7e8eaa[_0x7ed1('0x47')]['filter']+'%'};return _0x2f80f9;})});}if(_0x7e8eaa[_0x7ed1('0x47')][_0x7ed1('0xa4')]){var _0xeebef5=_0x7e8eaa[_0x7ed1('0x47')][_0x7ed1('0xa4')][_0x7ed1('0xa5')](',');var _0x168330={};_0x168330[_0xeebef5[0x0]]={'$gte':moment(_0xeebef5[0x1])[_0x7ed1('0xa6')](_0x7ed1('0xa7'))};_0x271ced[_0x7ed1('0x50')]=_[_0x7ed1('0x53')](_0x271ced['where'],_0x168330);}_0x271ced=_[_0x7ed1('0x53')]({},_0x271ced,_0x7e8eaa[_0x7ed1('0x55')]);return db['FaxMessage'][_0x7ed1('0x30')]({'where':_0x271ced[_0x7ed1('0x50')]})[_0x7ed1('0x21')](function(_0xf89103){_0x2ca414['count']=_0xf89103;if(_0x7e8eaa[_0x7ed1('0x47')][_0x7ed1('0x6b')]){_0x271ced[_0x7ed1('0x57')]=[{'all':!![]}];}return db[_0x7ed1('0xa3')][_0x7ed1('0x58')](_0x271ced);})['then'](function(_0x50f4d4){_0x2ca414[_0x7ed1('0x6c')]=_0x50f4d4;return _0x2ca414;});}})['then'](respondWithFilteredResult(_0x1e924b,_0x271ced))[_0x7ed1('0x2b')](handleError(_0x1e924b,null));};exports[_0x7ed1('0x3d')]=function(_0x51e181,_0x57f114,_0x586220){var _0x158ea4,_0x46cbea={},_0x3b2217;if(_0x51e181[_0x7ed1('0x5e')]['to']){_0x3b2217=_0x51e181[_0x7ed1('0x5e')]['to'][0x0];}return db[_0x7ed1('0x56')][_0x7ed1('0x5c')]({'where':{'id':_0x51e181['params']['id']},'include':[{'model':db[_0x7ed1('0xa8')],'as':'List','include':[{'model':db[_0x7ed1('0x78')],'as':_0x7ed1('0xa9'),'where':{'fax':_0x3b2217},'limit':0x1,'order':[[_0x7ed1('0x9e'),_0x7ed1('0xaa')]]}]}]})[_0x7ed1('0x21')](handleEntityNotFound(_0x57f114,null))[_0x7ed1('0x21')](function(_0x3f4c47){_0x158ea4=_0x3f4c47;if(_0x51e181[_0x7ed1('0x5e')]['attachments']&&_0x51e181[_0x7ed1('0x5e')][_0x7ed1('0xab')][_0x7ed1('0x4c')]){for(var _0x1c7548=0x0;_0x1c7548<_0x51e181[_0x7ed1('0x5e')][_0x7ed1('0xab')][_0x7ed1('0x4c')];_0x1c7548+=0x1){_0x51e181[_0x7ed1('0x5e')][_0x7ed1('0xab')][_0x1c7548]={'filename':_0x51e181[_0x7ed1('0x5e')][_0x7ed1('0xab')][_0x1c7548][_0x7ed1('0x3c')],'id':_0x51e181[_0x7ed1('0x5e')]['attachments'][_0x1c7548]['id'],'path':path[_0x7ed1('0xac')](config[_0x7ed1('0xad')],_0x7ed1('0xae'),_0x51e181[_0x7ed1('0x5e')][_0x7ed1('0xab')][_0x1c7548][_0x7ed1('0xaf')])};}}return respondWithRpcPromise(_0x7ed1('0xb0'),_0x7ed1('0xb0'),{'FaxAccountId':_[_0x7ed1('0xb1')](_0x51e181[_0x7ed1('0x5a')]['id'])?undefined:_0x51e181['params']['id'],'path':_[_0x7ed1('0xb1')](_0x51e181[_0x7ed1('0x5e')]['attachments'][0x0][_0x7ed1('0x8')])?undefined:_0x51e181[_0x7ed1('0x5e')][_0x7ed1('0xab')][0x0]['path'],'fax':_['isNil'](_0x51e181['body']['to'][0x0])?undefined:_0x51e181[_0x7ed1('0x5e')]['to'][0x0]},client9002);})[_0x7ed1('0x21')](function(){if(_0x158ea4){if(_['isNil'](_0x51e181[_0x7ed1('0x5e')][_0x7ed1('0xb2')])){_0x51e181[_0x7ed1('0x5e')][_0x7ed1('0xb2')]=util[_0x7ed1('0xa6')](_0x7ed1('0xb3'),_0x158ea4['name'],_0x158ea4[_0x7ed1('0xb4')]);}if(_0x158ea4[_0x7ed1('0xb5')]){if(_0x158ea4[_0x7ed1('0xb5')][_0x7ed1('0xa9')][_0x7ed1('0x4c')]){return _0x158ea4[_0x7ed1('0xb5')][_0x7ed1('0xa9')][0x0];}else{return db[_0x7ed1('0x78')][_0x7ed1('0x5d')](_[_0x7ed1('0x16')](_0x51e181[_0x7ed1('0x5e')],{'firstName':_0x51e181[_0x7ed1('0x5e')]['to'][0x0],'phone':_0x51e181[_0x7ed1('0x5e')]['to'][0x0],'fax':_0x51e181[_0x7ed1('0x5e')]['to'][0x0],'ListId':_0x158ea4['ListId']}));}}else{throw new Error(_0x7ed1('0xb6'));}}else{throw new Error(_0x7ed1('0xb7'));}})[_0x7ed1('0x21')](function(_0x2134f2){if(_0x2134f2){return db['FaxInteraction'][_0x7ed1('0x5c')]({'where':{'ContactId':_0x2134f2['id'],'closed':![],'FaxAccountId':_0x158ea4['id']}})['then'](function(_0x19bd0e){if(_0x19bd0e){return[_0x19bd0e,![]];}return db[_0x7ed1('0x75')][_0x7ed1('0x5d')]({'UserId':_0x51e181[_0x7ed1('0x5f')]['id'],'ContactId':_0x2134f2['id'],'FaxAccountId':_0x158ea4['id'],'fax':_0x51e181[_0x7ed1('0x5e')]['to'][0x0],'firstMsgDirection':_0x7ed1('0xb8'),'Messages':[_[_0x7ed1('0x53')](_0x51e181[_0x7ed1('0x5e')],{'read':![],'body':_0x51e181['body']['attachments'][0x0]['filename'],'FaxAccountId':_0x158ea4['id'],'UserId':_0x51e181[_0x7ed1('0x5f')]['id'],'ContactId':_0x2134f2['id'],'AttachmentId':_0x51e181[_0x7ed1('0x5e')][_0x7ed1('0xab')][0x0]['id']})]},{'include':[{'model':db[_0x7ed1('0xa3')],'as':_0x7ed1('0xb9')}]})['then'](function(_0x1e0bd8){return[_0x1e0bd8,!![]];});});}else{throw new Error(_0x7ed1('0xba'));}})[_0x7ed1('0xbb')](function(_0x338028,_0x3e6c02){if(_0x3e6c02){return _0x338028;}return db[_0x7ed1('0xa3')]['create']({'direction':_0x7ed1('0xb8'),'read':![],'body':_0x51e181[_0x7ed1('0x5e')]['attachments'][0x0][_0x7ed1('0xbc')],'FaxAccountId':_0x158ea4['id'],'FaxInteractionId':_0x338028['id'],'UserId':_0x51e181[_0x7ed1('0x5f')]['id'],'ContactId':_0x338028[_0x7ed1('0xbd')],'AttachmentId':_0x51e181[_0x7ed1('0x5e')][_0x7ed1('0xab')][0x0]['id']})[_0x7ed1('0x21')](function(_0x22b3d3){_0x338028[_0x7ed1('0xbe')][_0x7ed1('0xb9')]=[];_0x338028[_0x7ed1('0xbe')][_0x7ed1('0xb9')][_0x7ed1('0x8d')](_0x22b3d3[_0x7ed1('0xbe')]);return _0x338028;});})[_0x7ed1('0x21')](function(_0x3e2bf5){respondWithRpcPromise(_0x7ed1('0xbf'),'SendFax',{'FaxAccountId':_[_0x7ed1('0xb1')](_0x51e181[_0x7ed1('0x5a')]['id'])?undefined:_0x51e181[_0x7ed1('0x5a')]['id'],'path':_[_0x7ed1('0xb1')](_0x51e181[_0x7ed1('0x5e')][_0x7ed1('0xab')][0x0][_0x7ed1('0x8')])?undefined:_0x51e181['body'][_0x7ed1('0xab')][0x0][_0x7ed1('0x8')],'fax':_[_0x7ed1('0xb1')](_0x51e181[_0x7ed1('0x5e')]['to'][0x0])?undefined:_0x51e181['body']['to'][0x0],'AttachmentId':_0x51e181[_0x7ed1('0x5e')][_0x7ed1('0xab')][0x0]['id']},client9002)[_0x7ed1('0x21')](function(_0x1c3007){logger[_0x7ed1('0xc0')](_0x7ed1('0xc1'),_0x1c3007);})[_0x7ed1('0x2b')](function(_0x3222a6){logger['info'](_0x7ed1('0xc1'),_0x3222a6);});return _0x3e2bf5;})[_0x7ed1('0x21')](respondWithResult(_0x57f114,null))[_0x7ed1('0x2b')](handleError(_0x57f114,null));};exports[_0x7ed1('0xc2')]=function(_0x2280dc,_0x56bbbd,_0x524d91){return db['FaxAccount']['find']({'where':{'id':_0x2280dc['params']['id']}})[_0x7ed1('0x21')](handleEntityNotFound(_0x56bbbd,null))[_0x7ed1('0x21')](function(_0x5ef47b){if(_0x5ef47b){return _0x5ef47b[_0x7ed1('0xc2')](_0x2280dc[_0x7ed1('0x5e')]['ids'],_['omit'](_0x2280dc[_0x7ed1('0x5e')],[_0x7ed1('0x6e'),'id'])||{})['spread'](function(_0x4f3a64){for(var _0x1a9405=0x0;_0x1a9405<_0x2280dc[_0x7ed1('0x5e')][_0x7ed1('0x6e')][_0x7ed1('0x4c')];_0x1a9405+=0x1){socket[_0x7ed1('0xc3')](_0x7ed1('0xc4'),{'UserId':_0x2280dc[_0x7ed1('0x5e')][_0x7ed1('0x6e')][_0x1a9405],'FaxAccountId':_0x2280dc[_0x7ed1('0x5a')]['id']});}return _0x4f3a64;});}})[_0x7ed1('0x21')](respondWithResult(_0x56bbbd,null))['catch'](handleError(_0x56bbbd,null));};exports[_0x7ed1('0xc5')]=function(_0x5b8031,_0x1e6776,_0x18ffc7){return db[_0x7ed1('0x56')][_0x7ed1('0x5c')]({'where':{'id':_0x5b8031[_0x7ed1('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1e6776,null))[_0x7ed1('0x21')](function(_0x2bcdab){if(_0x2bcdab){return _0x2bcdab['removeAgents'](_0x5b8031[_0x7ed1('0x47')]['ids'])[_0x7ed1('0x21')](function(){if(_[_0x7ed1('0xc6')](_0x5b8031[_0x7ed1('0x47')][_0x7ed1('0x6e')])){for(var _0x30c43c=0x0;_0x30c43c<_0x5b8031[_0x7ed1('0x47')][_0x7ed1('0x6e')][_0x7ed1('0x4c')];_0x30c43c+=0x1){socket['emit'](_0x7ed1('0xc7'),{'UserId':Number(_0x5b8031[_0x7ed1('0x47')][_0x7ed1('0x6e')][_0x30c43c]),'FaxAccountId':Number(_0x5b8031['params']['id'])});}}else{socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x5b8031[_0x7ed1('0x47')][_0x7ed1('0x6e')]),'FaxAccountId':Number(_0x5b8031[_0x7ed1('0x5a')]['id'])});}});}})[_0x7ed1('0x21')](respondWithStatusCode(_0x1e6776,null))[_0x7ed1('0x2b')](handleError(_0x1e6776,null));};exports['getAgents']=function(_0x479350,_0x52d414,_0x506d77){var _0x82f1b={};var _0x33f413={};var _0x1f0096;var _0x14f8fe;return db[_0x7ed1('0x56')][_0x7ed1('0x6a')]({'where':{'id':_0x479350['params']['id']}})[_0x7ed1('0x21')](handleEntityNotFound(_0x52d414,null))['then'](function(_0x1146ec){if(_0x1146ec){_0x1f0096=_0x1146ec;_0x33f413[_0x7ed1('0x45')]=_[_0x7ed1('0x5b')](db[_0x7ed1('0xc8')][_0x7ed1('0x41')]);_0x33f413[_0x7ed1('0x47')]=_[_0x7ed1('0x5b')](_0x479350['query']);_0x33f413[_0x7ed1('0x48')]=_['intersection'](_0x33f413['model'],_0x33f413[_0x7ed1('0x47')]);_0x82f1b[_0x7ed1('0x49')]=_[_0x7ed1('0x4a')](_0x33f413[_0x7ed1('0x45')],qs[_0x7ed1('0x4b')](_0x479350[_0x7ed1('0x47')][_0x7ed1('0x4b')]));_0x82f1b[_0x7ed1('0x49')]=_0x82f1b[_0x7ed1('0x49')][_0x7ed1('0x4c')]?_0x82f1b['attributes']:_0x33f413[_0x7ed1('0x45')];_0x82f1b['order']=qs[_0x7ed1('0x4f')](_0x479350[_0x7ed1('0x47')]['sort']);_0x82f1b[_0x7ed1('0x50')]=qs[_0x7ed1('0x48')](_[_0x7ed1('0x51')](_0x479350[_0x7ed1('0x47')],_0x33f413[_0x7ed1('0x48')]));if(_0x479350[_0x7ed1('0x47')][_0x7ed1('0x52')]){_0x82f1b[_0x7ed1('0x50')]=_[_0x7ed1('0x53')](_0x82f1b[_0x7ed1('0x50')],{'$or':_[_0x7ed1('0x46')](_0x82f1b[_0x7ed1('0x49')],function(_0x286b6a){var _0x5c317d={};_0x5c317d[_0x286b6a]={'$like':'%'+_0x479350[_0x7ed1('0x47')][_0x7ed1('0x52')]+'%'};return _0x5c317d;})});}_0x82f1b=_[_0x7ed1('0x53')]({},_0x82f1b,_0x479350[_0x7ed1('0x55')]);return _0x1f0096[_0x7ed1('0xc9')](_0x82f1b);}})[_0x7ed1('0x21')](function(_0x14d9b5){if(_0x14d9b5){_0x14f8fe=_0x14d9b5['length'];if(!_0x479350[_0x7ed1('0x47')][_0x7ed1('0x4d')](_0x7ed1('0x4e'))){_0x82f1b[_0x7ed1('0x32')]=qs[_0x7ed1('0x32')](_0x479350['query']['limit']);_0x82f1b[_0x7ed1('0x31')]=qs[_0x7ed1('0x31')](_0x479350[_0x7ed1('0x47')][_0x7ed1('0x31')]);}return _0x1f0096[_0x7ed1('0xc9')](_0x82f1b);}})[_0x7ed1('0x21')](function(_0x477975){if(_0x477975){return _0x477975?{'count':_0x14f8fe,'rows':_0x477975}:null;}})[_0x7ed1('0x21')](respondWithResult(_0x52d414,null))[_0x7ed1('0x2b')](handleError(_0x52d414,null));}; \ No newline at end of file +var _0x9771=['merge','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','rawAttributes','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','removeDispositions','addAnswer','findOne','CannedAnswer','hasOwnProperty','removeAnswers','ids','addInteraction','omit','FaxInteraction','CmContact','User','internal','Tag','Tags','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','getApplications','exten','localstationid','system','description','Fax\x20Extension','priority','appdata','push','Answer','CDR(type)=inbound-fax','gateway','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Set','Wait','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','format','CmList','Contacts','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','List','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','spread','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','socket.io-emitter','redis','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','FaxAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','update','destroy','FaxAccounts','UserProfileResource','name','send','index','Pause','map','FaxAccount','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter'];(function(_0x1cbf75,_0x5af501){var _0x4118ae=function(_0x117990){while(--_0x117990){_0x1cbf75['push'](_0x1cbf75['shift']());}};_0x4118ae(++_0x5af501);}(_0x9771,0x12c));var _0x1977=function(_0x5b0832,_0x3f3865){_0x5b0832=_0x5b0832-0x0;var _0x36edc1=_0x9771[_0x5b0832];return _0x36edc1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1977('0x0'));var rimraf=require(_0x1977('0x1'));var zipdir=require(_0x1977('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1977('0x3'));var moment=require('moment');var BPromise=require(_0x1977('0x4'));var Mustache=require(_0x1977('0x5'));var util=require(_0x1977('0x6'));var path=require('path');var sox=require(_0x1977('0x7'));var csv=require(_0x1977('0x8'));var ejs=require(_0x1977('0x9'));var fs=require('fs');var _=require(_0x1977('0xa'));var squel=require(_0x1977('0xb'));var crypto=require('crypto');var jsforce=require(_0x1977('0xc'));var deskjs=require(_0x1977('0xd'));var toCsv=require(_0x1977('0x8'));var querystring=require(_0x1977('0xe'));var Papa=require(_0x1977('0xf'));var Redis=require(_0x1977('0x10'));var authService=require(_0x1977('0x11'));var qs=require(_0x1977('0x12'));var as=require(_0x1977('0x13'));var hardwareService=require(_0x1977('0x14'));var logger=require(_0x1977('0x15'))(_0x1977('0x16'));var utils=require(_0x1977('0x17'));var config=require(_0x1977('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x1977('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1977('0x1a'))(new Redis(config[_0x1977('0x1b')]));require('./faxAccount.socket')[_0x1977('0x1c')](socket);var jayson=require(_0x1977('0x1d'));var client=jayson[_0x1977('0x1e')][_0x1977('0x1f')]({'port':0x232c});var client9002=jayson[_0x1977('0x1e')][_0x1977('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x1ae7fa,_0x1d447d,_0xf03e2b){if(_0xf03e2b){var _0x5dd658=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5dd658[_0x1977('0x20')](_0x1d447d)){return _0x1ae7fa;}else{throw new db[(_0x1977('0x21'))][(_0x1977('0x22'))](_0x1977('0x23'));}}else{return _0x1ae7fa;}}function respondWithRpcPromise(_0x400b9d,_0xc667aa,_0x1a1cc1,_0x2b5a85){return new BPromise(function(_0x581c8e,_0x991c2b){var _0x331975=_0x2b5a85||client;return _0x331975[_0x1977('0x24')](_0x400b9d,_0x1a1cc1)[_0x1977('0x25')](function(_0x3fd9cb){logger['info'](_0x1977('0x26'),_0xc667aa,_0x1977('0x27'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0xc667aa,_0x1977('0x27'),JSON[_0x1977('0x28')](_0x3fd9cb));if(_0x3fd9cb[_0x1977('0x29')]){if(_0x3fd9cb[_0x1977('0x29')][_0x1977('0x2a')]===0x1f4){logger[_0x1977('0x29')](_0x1977('0x26'),_0xc667aa,_0x3fd9cb['error']['message']);return _0x991c2b(_0x3fd9cb['error']['message']);}logger[_0x1977('0x29')](_0x1977('0x26'),_0xc667aa,_0x3fd9cb[_0x1977('0x29')][_0x1977('0x2b')]);return _0x581c8e(_0x3fd9cb['error'][_0x1977('0x2b')]);}else{logger[_0x1977('0x2c')](_0x1977('0x26'),_0xc667aa,'request\x20sent');_0x581c8e(_0x3fd9cb[_0x1977('0x2d')]['message']);}})[_0x1977('0x2e')](function(_0x45cd03){logger['error'](_0x1977('0x26'),_0xc667aa,_0x45cd03);_0x991c2b(_0x45cd03);});});}function respondWithStatusCode(_0x2b75c3,_0x4c61df){_0x4c61df=_0x4c61df||0xcc;return function(_0x3f2e1b){if(_0x3f2e1b){return _0x2b75c3[_0x1977('0x2f')](_0x4c61df);}return _0x2b75c3['status'](_0x4c61df)[_0x1977('0x30')]();};}function respondWithResult(_0x1ee489,_0xf7faac){_0xf7faac=_0xf7faac||0xc8;return function(_0x16b18f){if(_0x16b18f){return _0x1ee489[_0x1977('0x31')](_0xf7faac)[_0x1977('0x32')](_0x16b18f);}};}function respondWithFilteredResult(_0x4637e0,_0x1d220c){return function(_0x30ad88){if(_0x30ad88){var _0x45ecf3=_0x30ad88[_0x1977('0x33')],_0x5eab08=_0x1d220c[_0x1977('0x34')],_0x3fa75e=_0x1d220c['offset']+_0x1d220c[_0x1977('0x35')],_0xe19685;if(_0x3fa75e>=_0x45ecf3){_0x3fa75e=_0x45ecf3;_0xe19685=0xc8;}else{_0xe19685=0xce;}_0x4637e0[_0x1977('0x31')](_0xe19685);return _0x4637e0[_0x1977('0x36')]('Content-Range',_0x5eab08+'-'+_0x3fa75e+'/'+_0x45ecf3)['json'](_0x30ad88);}return null;};}function patchUpdates(_0x227d85){return function(_0x290cad){try{jsonpatch[_0x1977('0x37')](_0x290cad,_0x227d85,!![]);}catch(_0x5e7449){return BPromise[_0x1977('0x38')](_0x5e7449);}return _0x290cad[_0x1977('0x39')]();};}function saveUpdates(_0x2fdc90,_0xf7d7fa){return function(_0x416574){if(_0x416574){return _0x416574[_0x1977('0x3a')](_0x2fdc90)[_0x1977('0x25')](function(_0x4d771f){return _0x4d771f;});}return null;};}function removeEntity(_0x37c51e,_0x23c75c){return function(_0x495f29){if(_0x495f29){return _0x495f29[_0x1977('0x3b')]()[_0x1977('0x25')](function(){var _0xf12ede=_0x495f29['get']({'plain':!![]});var _0x103263=_0x1977('0x3c');return db[_0x1977('0x3d')][_0x1977('0x3b')]({'where':{'type':_0x103263,'resourceId':_0xf12ede['id']}})[_0x1977('0x25')](function(){return _0x495f29;});})['then'](function(){_0x37c51e[_0x1977('0x31')](0xcc)[_0x1977('0x30')]();});}};}function handleEntityNotFound(_0x4d48f7,_0x4a6bcc){return function(_0x3384f3){if(!_0x3384f3){_0x4d48f7['sendStatus'](0x194);}return _0x3384f3;};}function handleError(_0x12e23a,_0x55ebfa){_0x55ebfa=_0x55ebfa||0x1f4;return function(_0x5b5fcc){logger['error'](_0x5b5fcc['stack']);if(_0x5b5fcc[_0x1977('0x3e')]){delete _0x5b5fcc['name'];}_0x12e23a[_0x1977('0x31')](_0x55ebfa)[_0x1977('0x3f')](_0x5b5fcc);};}exports[_0x1977('0x40')]=function(_0x155eb3,_0x1f5ea6){var _0x331cb8={'include':[{'model':db[_0x1977('0x41')],'as':'mandatoryDispositionPause'}]},_0x29d9bf={},_0x2440f3={'count':0x0,'rows':[]};var _0x343481=_[_0x1977('0x42')](db[_0x1977('0x43')]['rawAttributes'],function(_0x1c88cd){return{'name':_0x1c88cd['fieldName'],'type':_0x1c88cd[_0x1977('0x44')][_0x1977('0x45')]};});_0x29d9bf[_0x1977('0x46')]=_['map'](_0x343481,_0x1977('0x3e'));_0x29d9bf[_0x1977('0x47')]=_[_0x1977('0x48')](_0x155eb3[_0x1977('0x47')]);_0x29d9bf['filters']=_[_0x1977('0x49')](_0x29d9bf[_0x1977('0x46')],_0x29d9bf[_0x1977('0x47')]);_0x331cb8[_0x1977('0x4a')]=_['intersection'](_0x29d9bf[_0x1977('0x46')],qs[_0x1977('0x4b')](_0x155eb3[_0x1977('0x47')][_0x1977('0x4b')]));_0x331cb8['attributes']=_0x331cb8[_0x1977('0x4a')][_0x1977('0x4c')]?_0x331cb8[_0x1977('0x4a')]:_0x29d9bf[_0x1977('0x46')];if(!_0x155eb3['query']['hasOwnProperty'](_0x1977('0x4d'))){_0x331cb8[_0x1977('0x35')]=qs[_0x1977('0x35')](_0x155eb3[_0x1977('0x47')][_0x1977('0x35')]);_0x331cb8[_0x1977('0x34')]=qs[_0x1977('0x34')](_0x155eb3[_0x1977('0x47')][_0x1977('0x34')]);}_0x331cb8[_0x1977('0x4e')]=qs[_0x1977('0x4f')](_0x155eb3['query'][_0x1977('0x4f')]);_0x331cb8[_0x1977('0x50')]=qs[_0x1977('0x51')](_[_0x1977('0x52')](_0x155eb3[_0x1977('0x47')],_0x29d9bf[_0x1977('0x51')]),_0x343481);if(_0x155eb3[_0x1977('0x47')][_0x1977('0x53')]){_0x331cb8[_0x1977('0x50')]=_[_0x1977('0x54')](_0x331cb8[_0x1977('0x50')],{'$or':_[_0x1977('0x42')](_0x343481,function(_0x325f41){if(_0x325f41[_0x1977('0x44')]!=='VIRTUAL'){var _0x5aec06={};_0x5aec06[_0x325f41['name']]={'$like':'%'+_0x155eb3['query']['filter']+'%'};return _0x5aec06;}})});}_0x331cb8=_[_0x1977('0x54')]({},_0x331cb8,_0x155eb3['options']);var _0x4ff89a={'where':_0x331cb8['where']};return db[_0x1977('0x43')][_0x1977('0x33')](_0x4ff89a)[_0x1977('0x25')](function(_0x5b4677){_0x2440f3[_0x1977('0x33')]=_0x5b4677;if(_0x155eb3[_0x1977('0x47')][_0x1977('0x55')]){_0x331cb8[_0x1977('0x56')]=[{'all':!![]}];}return db[_0x1977('0x43')][_0x1977('0x57')](_0x331cb8);})[_0x1977('0x25')](function(_0x2a4470){_0x2440f3[_0x1977('0x58')]=_0x2a4470;return _0x2440f3;})[_0x1977('0x25')](respondWithFilteredResult(_0x1f5ea6,_0x331cb8))['catch'](handleError(_0x1f5ea6,null));};exports[_0x1977('0x59')]=function(_0x2b5d3e,_0x1b28bb){var _0x51fa14={'raw':![],'where':{'id':_0x2b5d3e[_0x1977('0x5a')]['id']},'include':[{'model':db[_0x1977('0x41')],'as':_0x1977('0x5b')}]},_0x5649d3={};_0x5649d3['model']=_['keys'](db['FaxAccount'][_0x1977('0x5c')]);_0x5649d3[_0x1977('0x47')]=_[_0x1977('0x48')](_0x2b5d3e[_0x1977('0x47')]);_0x5649d3['filters']=_['intersection'](_0x5649d3[_0x1977('0x46')],_0x5649d3['query']);_0x51fa14['attributes']=_[_0x1977('0x49')](_0x5649d3[_0x1977('0x46')],qs[_0x1977('0x4b')](_0x2b5d3e['query'][_0x1977('0x4b')]));_0x51fa14[_0x1977('0x4a')]=_0x51fa14[_0x1977('0x4a')][_0x1977('0x4c')]?_0x51fa14[_0x1977('0x4a')]:_0x5649d3[_0x1977('0x46')];if(_0x2b5d3e[_0x1977('0x47')][_0x1977('0x55')]){_0x51fa14[_0x1977('0x56')]=[{'all':!![]}];}_0x51fa14=_[_0x1977('0x54')]({},_0x51fa14,_0x2b5d3e[_0x1977('0x5d')]);return db[_0x1977('0x43')][_0x1977('0x5e')](_0x51fa14)[_0x1977('0x25')](handleEntityNotFound(_0x1b28bb,null))[_0x1977('0x25')](respondWithResult(_0x1b28bb,null))[_0x1977('0x2e')](handleError(_0x1b28bb,null));};exports[_0x1977('0x5f')]=function(_0x53754c,_0xff2664){return db[_0x1977('0x43')][_0x1977('0x5f')](_0x53754c[_0x1977('0x60')],{})[_0x1977('0x25')](function(_0xefb7ae){var _0x8812eb=_0x53754c[_0x1977('0x61')]['get']({'plain':!![]});if(!_0x8812eb)throw new Error(_0x1977('0x62'));if(_0x8812eb[_0x1977('0x63')]==='user'){var _0xf14e6e=_0xefb7ae[_0x1977('0x64')]({'plain':!![]});var _0x20c40a=_0x1977('0x3c');return db[_0x1977('0x65')][_0x1977('0x5e')]({'where':{'name':_0x20c40a,'userProfileId':_0x8812eb[_0x1977('0x66')]},'raw':!![]})[_0x1977('0x25')](function(_0x2c295d){if(_0x2c295d&&_0x2c295d['autoAssociation']===0x0){return db[_0x1977('0x3d')]['create']({'name':_0xf14e6e[_0x1977('0x3e')],'resourceId':_0xf14e6e['id'],'type':_0x2c295d[_0x1977('0x3e')],'sectionId':_0x2c295d['id']},{})[_0x1977('0x25')](function(){return _0xefb7ae;});}else{return _0xefb7ae;}})[_0x1977('0x2e')](function(_0x367583){logger[_0x1977('0x29')](_0x1977('0x67'),_0x367583);throw _0x367583;});}return _0xefb7ae;})[_0x1977('0x25')](respondWithResult(_0xff2664,0xc9))[_0x1977('0x2e')](handleError(_0xff2664,null));};exports['update']=function(_0x430114,_0x3602f8){if(_0x430114['body']['id']){delete _0x430114['body']['id'];}return db[_0x1977('0x43')][_0x1977('0x5e')]({'where':{'id':_0x430114[_0x1977('0x5a')]['id']},'include':[{'model':db[_0x1977('0x41')],'as':_0x1977('0x5b')}]})['then'](handleEntityNotFound(_0x3602f8,null))['then'](saveUpdates(_0x430114[_0x1977('0x60')],null))[_0x1977('0x25')](respondWithResult(_0x3602f8,null))[_0x1977('0x2e')](handleError(_0x3602f8,null));};exports[_0x1977('0x3b')]=function(_0xb19b48,_0x14451d){return db['FaxAccount'][_0x1977('0x5e')]({'where':{'id':_0xb19b48[_0x1977('0x5a')]['id']}})[_0x1977('0x25')](handleEntityNotFound(_0x14451d,null))['then'](removeEntity(_0x14451d,null))[_0x1977('0x2e')](handleError(_0x14451d,null));};exports[_0x1977('0x68')]=function(_0x3de621,_0xcfccf9){return db[_0x1977('0x43')][_0x1977('0x68')]()['then'](respondWithResult(_0xcfccf9,null))[_0x1977('0x2e')](handleError(_0xcfccf9,null));};exports[_0x1977('0x69')]=function(_0x29a6e1,_0x367596,_0x2ee1bc){if(_0x29a6e1[_0x1977('0x60')]['id']){delete _0x29a6e1[_0x1977('0x60')]['id'];}return db[_0x1977('0x43')][_0x1977('0x5e')]({'where':{'id':_0x29a6e1[_0x1977('0x5a')]['id']}})[_0x1977('0x25')](handleEntityNotFound(_0x367596,null))[_0x1977('0x25')](function(_0x3b1a67){if(_0x3b1a67){_0x29a6e1[_0x1977('0x60')][_0x1977('0x6a')]=_0x3b1a67['id'];return db[_0x1977('0x6b')][_0x1977('0x5f')](_0x29a6e1[_0x1977('0x60')]);}})['then'](respondWithResult(_0x367596,null))[_0x1977('0x2e')](handleError(_0x367596,null));};exports['getDispositions']=function(_0x36ba91,_0x3f91d5,_0x444632){var _0x15b8e2={'raw':![],'where':{}};var _0x5ea328={};var _0x1d0789={'count':0x0,'rows':[]};return db[_0x1977('0x43')]['findOne']({'where':{'id':_0x36ba91[_0x1977('0x5a')]['id']}})[_0x1977('0x25')](handleEntityNotFound(_0x3f91d5,null))[_0x1977('0x25')](function(_0x533f03){if(_0x533f03){_0x5ea328['model']=_[_0x1977('0x48')](db[_0x1977('0x6b')][_0x1977('0x5c')]);_0x5ea328[_0x1977('0x47')]=_[_0x1977('0x48')](_0x36ba91[_0x1977('0x47')]);_0x5ea328[_0x1977('0x51')]=_[_0x1977('0x49')](_0x5ea328['model'],_0x5ea328[_0x1977('0x47')]);_0x15b8e2[_0x1977('0x4a')]=_[_0x1977('0x49')](_0x5ea328[_0x1977('0x46')],qs['fields'](_0x36ba91[_0x1977('0x47')][_0x1977('0x4b')]));_0x15b8e2[_0x1977('0x4a')]=_0x15b8e2[_0x1977('0x4a')][_0x1977('0x4c')]?_0x15b8e2[_0x1977('0x4a')]:_0x5ea328[_0x1977('0x46')];if(!_0x36ba91[_0x1977('0x47')]['hasOwnProperty'](_0x1977('0x4d'))){_0x15b8e2['limit']=qs[_0x1977('0x35')](_0x36ba91[_0x1977('0x47')]['limit']);_0x15b8e2[_0x1977('0x34')]=qs['offset'](_0x36ba91[_0x1977('0x47')][_0x1977('0x34')]);}_0x15b8e2[_0x1977('0x4e')]=qs['sort'](_0x36ba91[_0x1977('0x47')]['sort']);_0x15b8e2[_0x1977('0x50')]=qs['filters'](_['pick'](_0x36ba91[_0x1977('0x47')],_0x5ea328[_0x1977('0x51')]));_0x15b8e2[_0x1977('0x50')][_0x1977('0x6a')]=_0x533f03['id'];if(_0x36ba91[_0x1977('0x47')][_0x1977('0x53')]){_0x15b8e2[_0x1977('0x50')]=_['merge'](_0x15b8e2[_0x1977('0x50')],{'$or':_['map'](_0x15b8e2[_0x1977('0x4a')],function(_0x380890){var _0x59d370={};_0x59d370[_0x380890]={'$like':'%'+_0x36ba91[_0x1977('0x47')][_0x1977('0x53')]+'%'};return _0x59d370;})});}_0x15b8e2=_[_0x1977('0x54')]({},_0x15b8e2,_0x36ba91['options']);return db['Disposition'][_0x1977('0x33')]({'where':_0x15b8e2['where']})['then'](function(_0x2e6bcb){_0x1d0789[_0x1977('0x33')]=_0x2e6bcb;if(_0x36ba91[_0x1977('0x47')][_0x1977('0x55')]){_0x15b8e2['include']=[{'all':!![]}];}return db[_0x1977('0x6b')][_0x1977('0x57')](_0x15b8e2);})[_0x1977('0x25')](function(_0x317c08){_0x1d0789[_0x1977('0x58')]=_0x317c08;return _0x1d0789;});}})[_0x1977('0x25')](respondWithFilteredResult(_0x3f91d5,_0x15b8e2))[_0x1977('0x2e')](handleError(_0x3f91d5,null));};exports[_0x1977('0x6c')]=function(_0x2bb0d0,_0x118cf7,_0x4be183){return db[_0x1977('0x43')]['find']({'where':{'id':_0x2bb0d0[_0x1977('0x5a')]['id']}})['then'](handleEntityNotFound(_0x118cf7,null))['then'](function(_0x2e9c2f){if(_0x2e9c2f){return _0x2e9c2f['removeDispositions'](_0x2bb0d0[_0x1977('0x47')]['ids']);}})[_0x1977('0x25')](respondWithStatusCode(_0x118cf7,null))['catch'](handleError(_0x118cf7,null));};exports[_0x1977('0x6d')]=function(_0x276fcb,_0x316f3d,_0x1dbdf7){if(_0x276fcb[_0x1977('0x60')]['id']){delete _0x276fcb[_0x1977('0x60')]['id'];}return db[_0x1977('0x43')]['find']({'where':{'id':_0x276fcb[_0x1977('0x5a')]['id']}})[_0x1977('0x25')](handleEntityNotFound(_0x316f3d,null))['then'](function(_0x265c69){if(_0x265c69){_0x276fcb[_0x1977('0x60')][_0x1977('0x6a')]=_0x265c69['id'];return db['CannedAnswer']['create'](_0x276fcb[_0x1977('0x60')]);}})[_0x1977('0x25')](respondWithResult(_0x316f3d,null))[_0x1977('0x2e')](handleError(_0x316f3d,null));};exports['getAnswers']=function(_0x123e0e,_0x2255fc,_0x33945d){var _0x10931c={'raw':![],'where':{}};var _0x32329d={};var _0x1f508b={'count':0x0,'rows':[]};return db[_0x1977('0x43')][_0x1977('0x6e')]({'where':{'id':_0x123e0e[_0x1977('0x5a')]['id']}})[_0x1977('0x25')](handleEntityNotFound(_0x2255fc,null))[_0x1977('0x25')](function(_0x6f1c5c){if(_0x6f1c5c){_0x32329d[_0x1977('0x46')]=_[_0x1977('0x48')](db[_0x1977('0x6f')][_0x1977('0x5c')]);_0x32329d[_0x1977('0x47')]=_['keys'](_0x123e0e[_0x1977('0x47')]);_0x32329d[_0x1977('0x51')]=_[_0x1977('0x49')](_0x32329d[_0x1977('0x46')],_0x32329d[_0x1977('0x47')]);_0x10931c[_0x1977('0x4a')]=_[_0x1977('0x49')](_0x32329d[_0x1977('0x46')],qs[_0x1977('0x4b')](_0x123e0e[_0x1977('0x47')]['fields']));_0x10931c['attributes']=_0x10931c['attributes'][_0x1977('0x4c')]?_0x10931c['attributes']:_0x32329d[_0x1977('0x46')];if(!_0x123e0e['query'][_0x1977('0x70')](_0x1977('0x4d'))){_0x10931c[_0x1977('0x35')]=qs['limit'](_0x123e0e[_0x1977('0x47')]['limit']);_0x10931c[_0x1977('0x34')]=qs[_0x1977('0x34')](_0x123e0e[_0x1977('0x47')][_0x1977('0x34')]);}_0x10931c['order']=qs['sort'](_0x123e0e['query']['sort']);_0x10931c['where']=qs[_0x1977('0x51')](_[_0x1977('0x52')](_0x123e0e[_0x1977('0x47')],_0x32329d['filters']));_0x10931c[_0x1977('0x50')][_0x1977('0x6a')]=_0x6f1c5c['id'];if(_0x123e0e[_0x1977('0x47')]['filter']){_0x10931c[_0x1977('0x50')]=_[_0x1977('0x54')](_0x10931c[_0x1977('0x50')],{'$or':_['map'](_0x10931c['attributes'],function(_0x53d532){var _0x2cf382={};_0x2cf382[_0x53d532]={'$like':'%'+_0x123e0e[_0x1977('0x47')]['filter']+'%'};return _0x2cf382;})});}_0x10931c=_[_0x1977('0x54')]({},_0x10931c,_0x123e0e[_0x1977('0x5d')]);return db[_0x1977('0x6f')][_0x1977('0x33')]({'where':_0x10931c[_0x1977('0x50')]})[_0x1977('0x25')](function(_0x164aee){_0x1f508b[_0x1977('0x33')]=_0x164aee;if(_0x123e0e[_0x1977('0x47')]['includeAll']){_0x10931c[_0x1977('0x56')]=[{'all':!![]}];}return db[_0x1977('0x6f')][_0x1977('0x57')](_0x10931c);})['then'](function(_0x5a7976){_0x1f508b['rows']=_0x5a7976;return _0x1f508b;});}})[_0x1977('0x25')](respondWithFilteredResult(_0x2255fc,_0x10931c))['catch'](handleError(_0x2255fc,null));};exports[_0x1977('0x71')]=function(_0x17d8f9,_0x371b0a,_0x4b688a){return db[_0x1977('0x43')][_0x1977('0x5e')]({'where':{'id':_0x17d8f9[_0x1977('0x5a')]['id']}})[_0x1977('0x25')](handleEntityNotFound(_0x371b0a,null))['then'](function(_0x5ad129){if(_0x5ad129){return _0x5ad129[_0x1977('0x71')](_0x17d8f9[_0x1977('0x47')][_0x1977('0x72')]);}})[_0x1977('0x25')](respondWithStatusCode(_0x371b0a,null))[_0x1977('0x2e')](handleError(_0x371b0a,null));};exports[_0x1977('0x73')]=function(_0x273b08,_0x1fcd11,_0x22607a){return db['FaxInteraction'][_0x1977('0x5e')]({'where':{'id':_0x273b08[_0x1977('0x5a')]['id']}})[_0x1977('0x25')](handleEntityNotFound(_0x1fcd11,null))[_0x1977('0x25')](function(_0x21f79c){if(_0x21f79c){return _0x21f79c[_0x1977('0x73')](_0x273b08['body'][_0x1977('0x72')],_[_0x1977('0x74')](_0x273b08[_0x1977('0x60')],[_0x1977('0x72'),'id'])||{});}})['then'](respondWithResult(_0x1fcd11,null))[_0x1977('0x2e')](handleError(_0x1fcd11,null));};exports['getInteractions']=function(_0x1018c3,_0x1394ed,_0x20039b){var _0x15790e={'raw':![],'where':{}};var _0x1a0aa4={};var _0x86b915={'count':0x0,'rows':[]};return db[_0x1977('0x43')][_0x1977('0x6e')]({'where':{'id':_0x1018c3['params']['id']}})[_0x1977('0x25')](handleEntityNotFound(_0x1394ed,null))[_0x1977('0x25')](function(_0x1d1e4a){if(_0x1d1e4a){_0x1a0aa4['model']=_[_0x1977('0x48')](db[_0x1977('0x75')][_0x1977('0x5c')]);_0x1a0aa4['query']=_['keys'](_0x1018c3['query']);_0x1a0aa4['filters']=_[_0x1977('0x49')](_0x1a0aa4['model'],_0x1a0aa4['query']);_0x15790e[_0x1977('0x4a')]=_[_0x1977('0x49')](_0x1a0aa4[_0x1977('0x46')],qs['fields'](_0x1018c3[_0x1977('0x47')]['fields']));_0x15790e[_0x1977('0x4a')]=_0x15790e['attributes'][_0x1977('0x4c')]?_0x15790e[_0x1977('0x4a')]:_0x1a0aa4[_0x1977('0x46')];if(!_0x1018c3['query'][_0x1977('0x70')]('nolimit')){_0x15790e[_0x1977('0x35')]=qs['limit'](_0x1018c3[_0x1977('0x47')][_0x1977('0x35')]);_0x15790e[_0x1977('0x34')]=qs[_0x1977('0x34')](_0x1018c3[_0x1977('0x47')][_0x1977('0x34')]);}_0x15790e[_0x1977('0x4e')]=qs[_0x1977('0x4f')](_0x1018c3[_0x1977('0x47')][_0x1977('0x4f')]);_0x15790e['where']=qs[_0x1977('0x51')](_[_0x1977('0x52')](_0x1018c3['query'],_0x1a0aa4[_0x1977('0x51')]));_0x15790e['where']['FaxAccountId']=_0x1d1e4a['id'];if(_0x1018c3['query'][_0x1977('0x53')]){_0x15790e[_0x1977('0x50')]=_[_0x1977('0x54')](_0x15790e[_0x1977('0x50')],{'$or':_[_0x1977('0x42')](_0x15790e[_0x1977('0x4a')],function(_0x263bfd){var _0x28fde1={};_0x28fde1[_0x263bfd]={'$like':'%'+_0x1018c3[_0x1977('0x47')][_0x1977('0x53')]+'%'};return _0x28fde1;})});}_0x15790e=_['merge']({},_0x15790e,_0x1018c3['options']);return db[_0x1977('0x75')]['count']({'where':_0x15790e[_0x1977('0x50')]})[_0x1977('0x25')](function(_0x53901f){_0x86b915[_0x1977('0x33')]=_0x53901f;if(_0x1018c3[_0x1977('0x47')]['includeAll']){_0x15790e[_0x1977('0x56')]=[{'model':db[_0x1977('0x76')],'as':'Contact','required':![]},{'model':db[_0x1977('0x77')],'as':'Owner','attributes':['name','fullname',_0x1977('0x78')],'required':![]},{'model':db[_0x1977('0x79')],'as':_0x1977('0x7a'),'attributes':['id',_0x1977('0x3e'),'color'],'where':_0x1018c3[_0x1977('0x47')][_0x1977('0x7b')]?{'id':_0x1018c3[_0x1977('0x47')][_0x1977('0x7b')]}:undefined,'required':_0x1018c3[_0x1977('0x47')][_0x1977('0x7b')]?!![]:![]}];}return db[_0x1977('0x75')][_0x1977('0x57')](_0x15790e);})[_0x1977('0x25')](function(_0x56e337){_0x86b915[_0x1977('0x58')]=_0x56e337;return _0x86b915;});}})[_0x1977('0x25')](respondWithFilteredResult(_0x1394ed,_0x15790e))['catch'](handleError(_0x1394ed,null));};exports[_0x1977('0x7c')]=function(_0x106b58,_0x5365fc,_0x43e904){return db[_0x1977('0x43')][_0x1977('0x6e')]({'where':{'id':_0x106b58[_0x1977('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5365fc,null))[_0x1977('0x25')](function(_0x27393b){if(_0x27393b){return db[_0x1977('0x7d')][_0x1977('0x7e')](function(_0x2a40d7){return db[_0x1977('0x7f')][_0x1977('0x3b')]({'where':{'FaxAccountId':_0x106b58[_0x1977('0x5a')]['id']},'transaction':_0x2a40d7})['then'](function(_0x5c3cfd){var _0x29a28e=_[_0x1977('0x42')](_0x106b58['body'],function(_0x1e8ab4){_0x1e8ab4[_0x1977('0x6a')]=_0x106b58['params']['id'];return _0x1e8ab4;});return db['FaxApplication'][_0x1977('0x80')](_0x29a28e,{'transaction':_0x2a40d7});});})[_0x1977('0x25')](function(){return db[_0x1977('0x7f')][_0x1977('0x81')]({'where':{'FaxAccountId':_0x106b58['params']['id']},'order':'priority'});});}})[_0x1977('0x25')](respondWithResult(_0x5365fc,null))[_0x1977('0x2e')](handleError(_0x5365fc,null));};exports[_0x1977('0x82')]=function(_0xc40327,_0x53cff6,_0x22d3b9){var _0x25b6ed={};var _0x47d761={};var _0x5da87b;var _0xf4e8ed;return db[_0x1977('0x43')]['findOne']({'where':{'id':_0xc40327[_0x1977('0x5a')]['id']}})[_0x1977('0x25')](handleEntityNotFound(_0x53cff6,null))[_0x1977('0x25')](function(_0x39a340){if(_0x39a340){_0x5da87b=_0x39a340;_0x47d761[_0x1977('0x46')]=_[_0x1977('0x48')](db[_0x1977('0x7f')][_0x1977('0x5c')]);_0x47d761[_0x1977('0x47')]=_[_0x1977('0x48')](_0xc40327[_0x1977('0x47')]);_0x47d761['filters']=_[_0x1977('0x49')](_0x47d761['model'],_0x47d761[_0x1977('0x47')]);_0x25b6ed[_0x1977('0x4a')]=_[_0x1977('0x49')](_0x47d761[_0x1977('0x46')],qs[_0x1977('0x4b')](_0xc40327[_0x1977('0x47')][_0x1977('0x4b')]));_0x25b6ed[_0x1977('0x4a')]=_0x25b6ed['attributes'][_0x1977('0x4c')]?_0x25b6ed['attributes']:_0x47d761['model'];_0x25b6ed[_0x1977('0x4e')]=qs[_0x1977('0x4f')](_0xc40327[_0x1977('0x47')]['sort']);_0x25b6ed[_0x1977('0x50')]=qs['filters'](_[_0x1977('0x52')](_0xc40327[_0x1977('0x47')],_0x47d761[_0x1977('0x51')]));if(_0xc40327[_0x1977('0x47')][_0x1977('0x53')]){_0x25b6ed[_0x1977('0x50')]=_[_0x1977('0x54')](_0x25b6ed[_0x1977('0x50')],{'$or':_['map'](_0x25b6ed[_0x1977('0x4a')],function(_0x58ae43){var _0xf586fd={};_0xf586fd[_0x58ae43]={'$like':'%'+_0xc40327[_0x1977('0x47')][_0x1977('0x53')]+'%'};return _0xf586fd;})});}_0x25b6ed=_[_0x1977('0x54')]({},_0x25b6ed,_0xc40327[_0x1977('0x5d')]);return _0x5da87b[_0x1977('0x82')](_0x25b6ed);}})[_0x1977('0x25')](function(_0x93645){if(_0x93645){_0xf4e8ed=_0x93645[_0x1977('0x4c')];if(!_0xc40327[_0x1977('0x47')][_0x1977('0x70')](_0x1977('0x4d'))){_0x25b6ed['limit']=qs[_0x1977('0x35')](_0xc40327[_0x1977('0x47')][_0x1977('0x35')]);_0x25b6ed[_0x1977('0x34')]=qs[_0x1977('0x34')](_0xc40327[_0x1977('0x47')][_0x1977('0x34')]);}return _0x5da87b[_0x1977('0x82')](_0x25b6ed);}})['then'](function(_0x27ce27){if(_0x27ce27){return _0x27ce27?{'count':_0xf4e8ed,'rows':_0x27ce27}:null;}})[_0x1977('0x25')](respondWithResult(_0x53cff6,null))['catch'](handleError(_0x53cff6,null));};function Extension(_0xf74ae5,_0x1a6112,_0x37cc3c,_0x26d8c3){this['context']='from-voip-provider';this[_0x1977('0x83')]=_0xf74ae5[_0x1977('0x84')];this['app']=_0x26d8c3;this[_0x1977('0x44')]=_0x1977('0x85');this[_0x1977('0x86')]=_0x1977('0x87');this[_0x1977('0x6a')]=_0xf74ae5['id'];this[_0x1977('0x88')]=_0x1a6112;this[_0x1977('0x89')]=_0x37cc3c;}function createExtensionsReciveFax(_0x4b4311){var _0xbcb096=0x1;var _0x44d124=[];_0x44d124[_0x1977('0x8a')](new Extension(_0x4b4311,_0xbcb096,'',_0x1977('0x8b')));_0xbcb096+=0x1;_0x44d124[_0x1977('0x8a')](new Extension(_0x4b4311,_0xbcb096,_0x1977('0x8c'),'Set'));_0xbcb096+=0x1;for(var _0x597b78 in _0x4b4311){if(_0x4b4311[_0x1977('0x70')](_0x597b78)&&(_0x597b78==='ecm'||_0x597b78===_0x1977('0x84')||_0x597b78===_0x1977('0x8d')||_0x597b78==='faxdetect'||_0x597b78===_0x1977('0x8e')||_0x597b78===_0x1977('0x8f')||_0x597b78===_0x1977('0x90')||_0x597b78===_0x1977('0x91')||_0x597b78===_0x1977('0x92'))){_0x44d124[_0x1977('0x8a')](new Extension(_0x4b4311,_0xbcb096,_0x1977('0x93')+_0x597b78+')='+_0x4b4311[_0x597b78],_0x1977('0x94')));_0xbcb096+=0x1;}}_0x44d124['push'](new Extension(_0x4b4311,_0xbcb096,'6',_0x1977('0x95')));_0xbcb096+=0x1;_0x44d124[_0x1977('0x8a')](new Extension(_0x4b4311,_0xbcb096,'/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',_0x1977('0x96')));_0xbcb096=0x0;return _0x44d124;}exports[_0x1977('0x97')]=function(_0xf4364a,_0x102a71,_0x1c9e02){var _0x590aa7;return db[_0x1977('0x7d')]['transaction'](function(_0x1293e1){return db[_0x1977('0x43')][_0x1977('0x5f')](_0xf4364a[_0x1977('0x60')],{'transaction':_0x1293e1})[_0x1977('0x25')](function(_0x405f5b){_0x590aa7=_0x405f5b[_0x1977('0x64')]({'plain':!![]});return db[_0x1977('0x98')]['bulkCreate'](createExtensionsReciveFax(_0x590aa7),{'transaction':_0x1293e1});});})['then'](function(){return _0x590aa7;})[_0x1977('0x25')](respondWithResult(_0x102a71,null))[_0x1977('0x2e')](handleError(_0x102a71,null));};exports[_0x1977('0x99')]=function(_0x446013,_0x33361d,_0x5f1782){var _0x574573;return db[_0x1977('0x7d')][_0x1977('0x7e')](function(_0x9b7073){return db[_0x1977('0x43')][_0x1977('0x3a')](_0x446013['body'],{'where':{'id':_0x446013['body']['id']},'transaction':_0x9b7073})[_0x1977('0x25')](function(_0x4e6665){return db[_0x1977('0x98')][_0x1977('0x3b')]({'where':{'FaxAccountId':_0x446013[_0x1977('0x60')]['id']},'transaction':_0x9b7073})['then'](function(_0x1065d0){return db['VoiceExtension'][_0x1977('0x80')](createExtensionsReciveFax(_[_0x1977('0x74')](_0x446013[_0x1977('0x60')],['tech',_0x1977('0x45'),'createdAt',_0x1977('0x9a'),_0x1977('0x9b'),_0x1977('0x9c')])),{'transaction':_0x9b7073});});});})[_0x1977('0x25')](function(){return db[_0x1977('0x43')][_0x1977('0x9d')](_0x446013['body']['id']);})[_0x1977('0x25')](respondWithResult(_0x33361d,null))[_0x1977('0x2e')](handleError(_0x33361d,null));};exports[_0x1977('0x9e')]=function(_0x3a58f5,_0x311881,_0x39c012){var _0x3f169e={'raw':!![],'where':{}};var _0xc25be5={};var _0x2e745d={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x3a58f5[_0x1977('0x5a')]['id']}})[_0x1977('0x25')](handleEntityNotFound(_0x311881,null))[_0x1977('0x25')](function(_0x3c163f){if(_0x3c163f){_0xc25be5[_0x1977('0x46')]=_[_0x1977('0x48')](db[_0x1977('0x9f')][_0x1977('0x5c')]);_0xc25be5[_0x1977('0x47')]=_[_0x1977('0x48')](_0x3a58f5[_0x1977('0x47')]);_0xc25be5['filters']=_[_0x1977('0x49')](_0xc25be5[_0x1977('0x46')],_0xc25be5[_0x1977('0x47')]);_0x3f169e[_0x1977('0x4a')]=_[_0x1977('0x49')](_0xc25be5['model'],qs[_0x1977('0x4b')](_0x3a58f5['query']['fields']));_0x3f169e['attributes']=_0x3f169e['attributes'][_0x1977('0x4c')]?_0x3f169e[_0x1977('0x4a')]:_0xc25be5['model'];if(!_0x3a58f5[_0x1977('0x47')][_0x1977('0x70')]('nolimit')){_0x3f169e[_0x1977('0x35')]=qs[_0x1977('0x35')](_0x3a58f5[_0x1977('0x47')][_0x1977('0x35')]);_0x3f169e['offset']=qs[_0x1977('0x34')](_0x3a58f5['query'][_0x1977('0x34')]);}_0x3f169e[_0x1977('0x4e')]=qs[_0x1977('0x4f')](_0x3a58f5[_0x1977('0x47')][_0x1977('0x4f')]);_0x3f169e[_0x1977('0x50')]=qs[_0x1977('0x51')](_[_0x1977('0x52')](_0x3a58f5['query'],_0xc25be5[_0x1977('0x51')]));_0x3f169e['where'][_0x1977('0x6a')]=_0x3c163f['id'];if(_0x3a58f5[_0x1977('0x47')][_0x1977('0x53')]){_0x3f169e[_0x1977('0x50')]=_['merge'](_0x3f169e[_0x1977('0x50')],{'$or':_[_0x1977('0x42')](_0x3f169e[_0x1977('0x4a')],function(_0x1263d1){var _0x5f00f9={};_0x5f00f9[_0x1263d1]={'$like':'%'+_0x3a58f5[_0x1977('0x47')][_0x1977('0x53')]+'%'};return _0x5f00f9;})});}if(_0x3a58f5['query'][_0x1977('0xa0')]){var _0x1f91d1=_0x3a58f5[_0x1977('0x47')][_0x1977('0xa0')]['split'](',');var _0x43b538={};_0x43b538[_0x1f91d1[0x0]]={'$gte':moment(_0x1f91d1[0x1])[_0x1977('0xa1')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3f169e[_0x1977('0x50')]=_['merge'](_0x3f169e[_0x1977('0x50')],_0x43b538);}_0x3f169e=_['merge']({},_0x3f169e,_0x3a58f5[_0x1977('0x5d')]);return db[_0x1977('0x9f')][_0x1977('0x33')]({'where':_0x3f169e['where']})['then'](function(_0xa07a5b){_0x2e745d[_0x1977('0x33')]=_0xa07a5b;if(_0x3a58f5[_0x1977('0x47')]['includeAll']){_0x3f169e[_0x1977('0x56')]=[{'all':!![]}];}return db[_0x1977('0x9f')]['findAll'](_0x3f169e);})[_0x1977('0x25')](function(_0x3021c7){_0x2e745d['rows']=_0x3021c7;return _0x2e745d;});}})[_0x1977('0x25')](respondWithFilteredResult(_0x311881,_0x3f169e))[_0x1977('0x2e')](handleError(_0x311881,null));};exports[_0x1977('0x3f')]=function(_0x2fa156,_0x5aecf4,_0x4b9bba){var _0x272beb,_0x43c036={},_0xbd6e33;if(_0x2fa156[_0x1977('0x60')]['to']){_0xbd6e33=_0x2fa156[_0x1977('0x60')]['to'][0x0];}return db['FaxAccount']['find']({'where':{'id':_0x2fa156[_0x1977('0x5a')]['id']},'include':[{'model':db[_0x1977('0xa2')],'as':'List','include':[{'model':db[_0x1977('0x76')],'as':_0x1977('0xa3'),'where':{'fax':_0xbd6e33},'limit':0x1,'order':[[_0x1977('0x9a'),_0x1977('0xa4')]]}]}]})[_0x1977('0x25')](handleEntityNotFound(_0x5aecf4,null))[_0x1977('0x25')](function(_0x4ddc55){_0x272beb=_0x4ddc55;if(_0x2fa156['body'][_0x1977('0xa5')]&&_0x2fa156[_0x1977('0x60')]['attachments']['length']){for(var _0x2811ff=0x0;_0x2811ff<_0x2fa156['body']['attachments'][_0x1977('0x4c')];_0x2811ff+=0x1){_0x2fa156[_0x1977('0x60')]['attachments'][_0x2811ff]={'filename':_0x2fa156[_0x1977('0x60')][_0x1977('0xa5')][_0x2811ff][_0x1977('0x3e')],'id':_0x2fa156[_0x1977('0x60')]['attachments'][_0x2811ff]['id'],'path':path['join'](config[_0x1977('0xa6')],_0x1977('0xa7'),_0x2fa156[_0x1977('0x60')]['attachments'][_0x2811ff][_0x1977('0xa8')])};}}return respondWithRpcPromise(_0x1977('0xa9'),_0x1977('0xa9'),{'FaxAccountId':_['isNil'](_0x2fa156['params']['id'])?undefined:_0x2fa156[_0x1977('0x5a')]['id'],'path':_[_0x1977('0xaa')](_0x2fa156['body'][_0x1977('0xa5')][0x0][_0x1977('0xab')])?undefined:_0x2fa156[_0x1977('0x60')][_0x1977('0xa5')][0x0][_0x1977('0xab')],'fax':_['isNil'](_0x2fa156['body']['to'][0x0])?undefined:_0x2fa156[_0x1977('0x60')]['to'][0x0]},client9002);})['then'](function(){if(_0x272beb){if(_['isNil'](_0x2fa156[_0x1977('0x60')]['from'])){_0x2fa156[_0x1977('0x60')][_0x1977('0xac')]=util[_0x1977('0xa1')](_0x1977('0xad'),_0x272beb[_0x1977('0x3e')],_0x272beb[_0x1977('0xae')]);}if(_0x272beb[_0x1977('0xaf')]){if(_0x272beb[_0x1977('0xaf')][_0x1977('0xa3')]['length']){return _0x272beb[_0x1977('0xaf')][_0x1977('0xa3')][0x0];}else{return db[_0x1977('0x76')][_0x1977('0x5f')](_['defaults'](_0x2fa156['body'],{'firstName':_0x2fa156[_0x1977('0x60')]['to'][0x0],'phone':_0x2fa156[_0x1977('0x60')]['to'][0x0],'fax':_0x2fa156[_0x1977('0x60')]['to'][0x0],'ListId':_0x272beb[_0x1977('0x9c')]}));}}else{throw new Error(_0x1977('0xb0'));}}else{throw new Error(_0x1977('0xb1'));}})[_0x1977('0x25')](function(_0xd0c369){if(_0xd0c369){return db[_0x1977('0x75')][_0x1977('0x5e')]({'where':{'ContactId':_0xd0c369['id'],'closed':![],'FaxAccountId':_0x272beb['id']}})['then'](function(_0x19dc49){if(_0x19dc49){return[_0x19dc49,![]];}return db['FaxInteraction']['create']({'UserId':_0x2fa156[_0x1977('0x61')]['id'],'ContactId':_0xd0c369['id'],'FaxAccountId':_0x272beb['id'],'fax':_0x2fa156[_0x1977('0x60')]['to'][0x0],'firstMsgDirection':_0x1977('0xb2'),'Messages':[_[_0x1977('0x54')](_0x2fa156[_0x1977('0x60')],{'read':![],'body':_0x2fa156[_0x1977('0x60')]['attachments'][0x0][_0x1977('0xb3')],'FaxAccountId':_0x272beb['id'],'UserId':_0x2fa156[_0x1977('0x61')]['id'],'ContactId':_0xd0c369['id'],'AttachmentId':_0x2fa156[_0x1977('0x60')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x1977('0x9f')],'as':_0x1977('0xb4')}]})[_0x1977('0x25')](function(_0x213cc8){return[_0x213cc8,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x1977('0xb5')](function(_0x234a9e,_0x30cae3){if(_0x30cae3){return _0x234a9e;}return db['FaxMessage'][_0x1977('0x5f')]({'direction':'out','read':![],'body':_0x2fa156[_0x1977('0x60')][_0x1977('0xa5')][0x0][_0x1977('0xb3')],'FaxAccountId':_0x272beb['id'],'FaxInteractionId':_0x234a9e['id'],'UserId':_0x2fa156[_0x1977('0x61')]['id'],'ContactId':_0x234a9e['ContactId'],'AttachmentId':_0x2fa156['body'][_0x1977('0xa5')][0x0]['id']})[_0x1977('0x25')](function(_0x511145){_0x234a9e[_0x1977('0xb6')][_0x1977('0xb4')]=[];_0x234a9e['dataValues'][_0x1977('0xb4')][_0x1977('0x8a')](_0x511145[_0x1977('0xb6')]);return _0x234a9e;});})['then'](function(_0x33dbc3){respondWithRpcPromise(_0x1977('0xb7'),_0x1977('0xb7'),{'FaxAccountId':_['isNil'](_0x2fa156['params']['id'])?undefined:_0x2fa156[_0x1977('0x5a')]['id'],'path':_[_0x1977('0xaa')](_0x2fa156[_0x1977('0x60')][_0x1977('0xa5')][0x0][_0x1977('0xab')])?undefined:_0x2fa156['body'][_0x1977('0xa5')][0x0][_0x1977('0xab')],'fax':_[_0x1977('0xaa')](_0x2fa156[_0x1977('0x60')]['to'][0x0])?undefined:_0x2fa156[_0x1977('0x60')]['to'][0x0],'AttachmentId':_0x2fa156[_0x1977('0x60')]['attachments'][0x0]['id']},client9002)[_0x1977('0x25')](function(_0x24aaf5){logger[_0x1977('0x2c')](_0x1977('0xb8'),_0x24aaf5);})[_0x1977('0x2e')](function(_0x23e39b){logger[_0x1977('0x2c')](_0x1977('0xb8'),_0x23e39b);});return _0x33dbc3;})[_0x1977('0x25')](respondWithResult(_0x5aecf4,null))[_0x1977('0x2e')](handleError(_0x5aecf4,null));};exports[_0x1977('0xb9')]=function(_0x1dcb23,_0x351ee4,_0x271e31){return db['FaxAccount'][_0x1977('0x5e')]({'where':{'id':_0x1dcb23[_0x1977('0x5a')]['id']}})[_0x1977('0x25')](handleEntityNotFound(_0x351ee4,null))[_0x1977('0x25')](function(_0xf9c16e){if(_0xf9c16e){return _0xf9c16e['addAgents'](_0x1dcb23[_0x1977('0x60')][_0x1977('0x72')],_[_0x1977('0x74')](_0x1dcb23[_0x1977('0x60')],[_0x1977('0x72'),'id'])||{})[_0x1977('0xb5')](function(_0x288814){for(var _0x1a0577=0x0;_0x1a0577<_0x1dcb23[_0x1977('0x60')]['ids'][_0x1977('0x4c')];_0x1a0577+=0x1){socket[_0x1977('0xba')](_0x1977('0xbb'),{'UserId':_0x1dcb23['body'][_0x1977('0x72')][_0x1a0577],'FaxAccountId':_0x1dcb23[_0x1977('0x5a')]['id']});}return _0x288814;});}})[_0x1977('0x25')](respondWithResult(_0x351ee4,null))[_0x1977('0x2e')](handleError(_0x351ee4,null));};exports[_0x1977('0xbc')]=function(_0xb7b2d8,_0x148ec1,_0x355a36){return db[_0x1977('0x43')][_0x1977('0x5e')]({'where':{'id':_0xb7b2d8[_0x1977('0x5a')]['id']}})[_0x1977('0x25')](handleEntityNotFound(_0x148ec1,null))[_0x1977('0x25')](function(_0x3009ef){if(_0x3009ef){return _0x3009ef[_0x1977('0xbc')](_0xb7b2d8['query'][_0x1977('0x72')])[_0x1977('0x25')](function(){if(_[_0x1977('0xbd')](_0xb7b2d8[_0x1977('0x47')][_0x1977('0x72')])){for(var _0x3563e0=0x0;_0x3563e0<_0xb7b2d8['query'][_0x1977('0x72')][_0x1977('0x4c')];_0x3563e0+=0x1){socket[_0x1977('0xba')]('userFaxAccount:remove',{'UserId':Number(_0xb7b2d8[_0x1977('0x47')]['ids'][_0x3563e0]),'FaxAccountId':Number(_0xb7b2d8[_0x1977('0x5a')]['id'])});}}else{socket['emit'](_0x1977('0xbe'),{'UserId':Number(_0xb7b2d8[_0x1977('0x47')][_0x1977('0x72')]),'FaxAccountId':Number(_0xb7b2d8[_0x1977('0x5a')]['id'])});}});}})[_0x1977('0x25')](respondWithStatusCode(_0x148ec1,null))[_0x1977('0x2e')](handleError(_0x148ec1,null));};exports['getAgents']=function(_0x401500,_0x51476d,_0x279d50){var _0x3f3b01={};var _0x372ea9={};var _0x133bfc;var _0x55966e;return db[_0x1977('0x43')][_0x1977('0x6e')]({'where':{'id':_0x401500[_0x1977('0x5a')]['id']}})[_0x1977('0x25')](handleEntityNotFound(_0x51476d,null))[_0x1977('0x25')](function(_0x31f71a){if(_0x31f71a){_0x133bfc=_0x31f71a;_0x372ea9['model']=_[_0x1977('0x48')](db[_0x1977('0x77')][_0x1977('0x5c')]);_0x372ea9['query']=_[_0x1977('0x48')](_0x401500[_0x1977('0x47')]);_0x372ea9[_0x1977('0x51')]=_[_0x1977('0x49')](_0x372ea9[_0x1977('0x46')],_0x372ea9['query']);_0x3f3b01[_0x1977('0x4a')]=_[_0x1977('0x49')](_0x372ea9[_0x1977('0x46')],qs[_0x1977('0x4b')](_0x401500[_0x1977('0x47')][_0x1977('0x4b')]));_0x3f3b01[_0x1977('0x4a')]=_0x3f3b01[_0x1977('0x4a')]['length']?_0x3f3b01[_0x1977('0x4a')]:_0x372ea9['model'];_0x3f3b01[_0x1977('0x4e')]=qs[_0x1977('0x4f')](_0x401500['query'][_0x1977('0x4f')]);_0x3f3b01[_0x1977('0x50')]=qs[_0x1977('0x51')](_[_0x1977('0x52')](_0x401500[_0x1977('0x47')],_0x372ea9[_0x1977('0x51')]));if(_0x401500[_0x1977('0x47')][_0x1977('0x53')]){_0x3f3b01[_0x1977('0x50')]=_[_0x1977('0x54')](_0x3f3b01[_0x1977('0x50')],{'$or':_[_0x1977('0x42')](_0x3f3b01[_0x1977('0x4a')],function(_0x352cde){var _0x564440={};_0x564440[_0x352cde]={'$like':'%'+_0x401500['query'][_0x1977('0x53')]+'%'};return _0x564440;})});}_0x3f3b01=_[_0x1977('0x54')]({},_0x3f3b01,_0x401500[_0x1977('0x5d')]);return _0x133bfc[_0x1977('0xbf')](_0x3f3b01);}})['then'](function(_0x9cded9){if(_0x9cded9){_0x55966e=_0x9cded9[_0x1977('0x4c')];if(!_0x401500[_0x1977('0x47')][_0x1977('0x70')](_0x1977('0x4d'))){_0x3f3b01[_0x1977('0x35')]=qs[_0x1977('0x35')](_0x401500[_0x1977('0x47')][_0x1977('0x35')]);_0x3f3b01[_0x1977('0x34')]=qs['offset'](_0x401500[_0x1977('0x47')]['offset']);}return _0x133bfc[_0x1977('0xbf')](_0x3f3b01);}})[_0x1977('0x25')](function(_0x1101f8){if(_0x1101f8){return _0x1101f8?{'count':_0x55966e,'rows':_0x1101f8}:null;}})[_0x1977('0x25')](respondWithResult(_0x51476d,null))[_0x1977('0x2e')](handleError(_0x51476d,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 3bade09..77f04e0 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 _0x374f=['../../mysqldb','FaxAccount','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x3d591e,_0x26c163){var _0xa7f7d7=function(_0x537881){while(--_0x537881){_0x3d591e['push'](_0x3d591e['shift']());}};_0xa7f7d7(++_0x26c163);}(_0x374f,0xdb));var _0xf374=function(_0x22bd37,_0x5ec397){_0x22bd37=_0x22bd37-0x0;var _0x442981=_0x374f[_0x22bd37];return _0x442981;};'use strict';var EventEmitter=require(_0xf374('0x0'));var FaxAccount=require(_0xf374('0x1'))['db'][_0xf374('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xf374('0x3')](0x0);var events={'afterCreate':_0xf374('0x4'),'afterUpdate':_0xf374('0x5'),'afterDestroy':_0xf374('0x6')};function emitEvent(_0x1165c1){return function(_0x4e7457,_0xa53531,_0x54f072){FaxAccountEvents['emit'](_0x1165c1+':'+_0x4e7457['id'],_0x4e7457);FaxAccountEvents[_0xf374('0x7')](_0x1165c1,_0x4e7457);_0x54f072(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0xf374('0x8')](e,emitEvent(event));}}module[_0xf374('0x9')]=FaxAccountEvents; \ No newline at end of file +var _0xa5ad=['remove','hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners','save'];(function(_0x2c19f4,_0x17dc48){var _0x4009cb=function(_0x20e925){while(--_0x20e925){_0x2c19f4['push'](_0x2c19f4['shift']());}};_0x4009cb(++_0x17dc48);}(_0xa5ad,0x67));var _0xda5a=function(_0x3e69c6,_0x19744a){_0x3e69c6=_0x3e69c6-0x0;var _0x58d8d8=_0xa5ad[_0x3e69c6];return _0x58d8d8;};'use strict';var EventEmitter=require(_0xda5a('0x0'));var FaxAccount=require(_0xda5a('0x1'))['db'][_0xda5a('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xda5a('0x3')](0x0);var events={'afterCreate':_0xda5a('0x4'),'afterUpdate':'update','afterDestroy':_0xda5a('0x5')};function emitEvent(_0x58ecf4){return function(_0x53cd3a,_0x45b22c,_0x21182f){FaxAccountEvents['emit'](_0x58ecf4+':'+_0x53cd3a['id'],_0x53cd3a);FaxAccountEvents['emit'](_0x58ecf4,_0x53cd3a);_0x21182f(null);};}for(var e in events){if(events[_0xda5a('0x6')](e)){var event=events[e];FaxAccount[_0xda5a('0x7')](e,emitEvent(event));}}module[_0xda5a('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index dde950b..5a43c4a 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 _0x7688=['rimraf','../../config/environment','./faxAccount.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xb8ad63,_0x1fc5a5){var _0x2ec669=function(_0x5dd5c7){while(--_0x5dd5c7){_0xb8ad63['push'](_0xb8ad63['shift']());}};_0x2ec669(++_0x1fc5a5);}(_0x7688,0xe2));var _0x8768=function(_0x5614b8,_0x34963e){_0x5614b8=_0x5614b8-0x0;var _0x3d6acb=_0x7688[_0x5614b8];return _0x3d6acb;};'use strict';var _=require(_0x8768('0x0'));var util=require(_0x8768('0x1'));var logger=require(_0x8768('0x2'))(_0x8768('0x3'));var moment=require(_0x8768('0x4'));var BPromise=require(_0x8768('0x5'));var rp=require(_0x8768('0x6'));var fs=require('fs');var path=require(_0x8768('0x7'));var rimraf=require(_0x8768('0x8'));var config=require(_0x8768('0x9'));var attributes=require(_0x8768('0xa'));module[_0x8768('0xb')]=function(_0x15bd36,_0x4b83ed){return _0x15bd36[_0x8768('0xc')]('FaxAccount',attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8205=['path','rimraf','./faxAccount.attributes','exports','FaxAccount','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x8205,0x68));var _0x5820=function(_0x39c7c0,_0x544a91){_0x39c7c0=_0x39c7c0-0x0;var _0x329745=_0x8205[_0x39c7c0];return _0x329745;};'use strict';var _=require('lodash');var util=require(_0x5820('0x0'));var logger=require(_0x5820('0x1'))(_0x5820('0x2'));var moment=require(_0x5820('0x3'));var BPromise=require(_0x5820('0x4'));var rp=require(_0x5820('0x5'));var fs=require('fs');var path=require(_0x5820('0x6'));var rimraf=require(_0x5820('0x7'));var config=require('../../config/environment');var attributes=require(_0x5820('0x8'));module[_0x5820('0x9')]=function(_0x3a2a8b,_0x2c16e8){return _0x3a2a8b['define'](_0x5820('0xa'),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 9080734..914b14a 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 _0xdcf6=['error','code','message','result','catch','GetFaxAccount','FaxAccount','options','raw','where','attributes','limit','map','include','model','then','NotifyFaxAccount','body','fax','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','CmContact','Contacts','DESC','FaxApplication','Applications','get','applications','list','orderBy','priority','defaults','from','mapKey','create','contact','FaxInteraction','Contact\x20not\x20found','spread','length','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','AttachmentId','UserId','User','name','unshift','agent','Start','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','localhost','redis','./faxAccount.socket','register','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x24fa88,_0x4007b2){var _0x2a7377=function(_0x32b955){while(--_0x32b955){_0x24fa88['push'](_0x24fa88['shift']());}};_0x2a7377(++_0x4007b2);}(_0xdcf6,0x1b6));var _0x6dcf=function(_0x18fe54,_0xff789){_0x18fe54=_0x18fe54-0x0;var _0xccb1ee=_0xdcf6[_0x18fe54];return _0xccb1ee;};'use strict';var _=require('lodash');var util=require(_0x6dcf('0x0'));var moment=require(_0x6dcf('0x1'));var BPromise=require(_0x6dcf('0x2'));var rs=require(_0x6dcf('0x3'));var fs=require('fs');var Redis=require(_0x6dcf('0x4'));var db=require(_0x6dcf('0x5'))['db'];var utils=require(_0x6dcf('0x6'));var logger=require('../../config/logger')(_0x6dcf('0x7'));var config=require(_0x6dcf('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6dcf('0x9')][_0x6dcf('0xa')]({'port':0x232c});config['redis']=_['defaults'](config['redis'],{'host':_0x6dcf('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6dcf('0xc')]));require(_0x6dcf('0xd'))[_0x6dcf('0xe')](socket);function respondWithRpcPromise(_0x4eda69,_0x527a65,_0x5b65a7){return new BPromise(function(_0x443c93,_0x23f052){return client[_0x6dcf('0xf')](_0x4eda69,_0x5b65a7)['then'](function(_0x23fce1){logger[_0x6dcf('0x10')](_0x6dcf('0x11'),_0x527a65,_0x6dcf('0x12'));logger[_0x6dcf('0x13')](_0x6dcf('0x14'),_0x527a65,_0x6dcf('0x12'),JSON[_0x6dcf('0x15')](_0x23fce1));if(_0x23fce1[_0x6dcf('0x16')]){if(_0x23fce1[_0x6dcf('0x16')][_0x6dcf('0x17')]===0x1f4){logger[_0x6dcf('0x16')](_0x6dcf('0x11'),_0x527a65,_0x23fce1[_0x6dcf('0x16')][_0x6dcf('0x18')]);return _0x23f052(_0x23fce1[_0x6dcf('0x16')][_0x6dcf('0x18')]);}logger['error'](_0x6dcf('0x11'),_0x527a65,_0x23fce1[_0x6dcf('0x16')][_0x6dcf('0x18')]);return _0x443c93(_0x23fce1['error'][_0x6dcf('0x18')]);}else{logger[_0x6dcf('0x10')](_0x6dcf('0x11'),_0x527a65,_0x6dcf('0x12'));_0x443c93(_0x23fce1[_0x6dcf('0x19')][_0x6dcf('0x18')]);}})[_0x6dcf('0x1a')](function(_0x2b5cd4){logger['error'](_0x6dcf('0x11'),_0x527a65,_0x2b5cd4);_0x23f052(_0x2b5cd4);});});}exports[_0x6dcf('0x1b')]=function(_0x35c30b){var _0x2d2169=this;return new Promise(function(_0x3c9cbb,_0x200994){return db[_0x6dcf('0x1c')]['findAll']({'raw':_0x35c30b[_0x6dcf('0x1d')]?_0x35c30b['options'][_0x6dcf('0x1e')]===undefined?!![]:![]:!![],'where':_0x35c30b[_0x6dcf('0x1d')]?_0x35c30b[_0x6dcf('0x1d')][_0x6dcf('0x1f')]||null:null,'attributes':_0x35c30b['options']?_0x35c30b['options'][_0x6dcf('0x20')]||null:null,'limit':_0x35c30b['options']?_0x35c30b[_0x6dcf('0x1d')][_0x6dcf('0x21')]||null:null,'include':_0x35c30b[_0x6dcf('0x1d')]?_0x35c30b[_0x6dcf('0x1d')]['include']?_[_0x6dcf('0x22')](_0x35c30b[_0x6dcf('0x1d')][_0x6dcf('0x23')],function(_0x124853){return{'model':db[_0x124853['model']],'as':_0x124853['as'],'attributes':_0x124853[_0x6dcf('0x20')],'include':_0x124853[_0x6dcf('0x23')]?_[_0x6dcf('0x22')](_0x124853[_0x6dcf('0x23')],function(_0x16e8c4){return{'model':db[_0x16e8c4[_0x6dcf('0x24')]],'as':_0x16e8c4['as'],'attributes':_0x16e8c4[_0x6dcf('0x20')],'include':_0x16e8c4[_0x6dcf('0x23')]?_[_0x6dcf('0x22')](_0x16e8c4[_0x6dcf('0x23')],function(_0x2f9558){return{'model':db[_0x2f9558[_0x6dcf('0x24')]],'as':_0x2f9558['as'],'attributes':_0x2f9558['attributes']};}):[]};}):[]};}):[]:[]})[_0x6dcf('0x25')](function(_0x1d3b73){logger['info']('GetFaxAccount',_0x35c30b);logger['debug']('GetFaxAccount',_0x35c30b,JSON[_0x6dcf('0x15')](_0x1d3b73));_0x3c9cbb(_0x1d3b73);})[_0x6dcf('0x1a')](function(_0x4c106c){logger[_0x6dcf('0x16')](_0x6dcf('0x1b'),_0x4c106c[_0x6dcf('0x18')],_0x35c30b);_0x200994(_0x2d2169[_0x6dcf('0x16')](0x1f4,_0x4c106c['message']));});});};exports[_0x6dcf('0x26')]=function(_0x7730b0,_0x1031d5,_0x24a56e){var _0x1dd58c=this;return new Promise(function(_0x1c78d4,_0x7f01d4){var _0x18dc28={'body':_0x7730b0[_0x6dcf('0x27')],'channel':_0x6dcf('0x28')};var _0x3ef3c8=[];var _0x20f59d=[];var _0x1591cf={};return db['CmContact'][_0x6dcf('0x29')]()[_0x6dcf('0x25')](function(_0x4f8dd1){if(!_0x4f8dd1){throw new db[(_0x6dcf('0x2a'))][(_0x6dcf('0x2b'))](_0x6dcf('0x2c'));}_0x3ef3c8=_[_0x6dcf('0x2d')](_[_0x6dcf('0x2e')](_0x4f8dd1),[_0x6dcf('0x2f'),_0x6dcf('0x30')]);_0x20f59d=_[_0x6dcf('0x2d')](_['keys'](_0x4f8dd1),[_0x6dcf('0x2f'),'updatedAt',_0x6dcf('0x31'),_0x6dcf('0x32')]);if(_0x7730b0[_0x6dcf('0x27')]['id']){delete _0x7730b0[_0x6dcf('0x27')]['id'];}if(_[_0x6dcf('0x33')](_0x7730b0[_0x6dcf('0x27')]['from'])){throw new db[(_0x6dcf('0x2a'))]['ValidationError'](_0x6dcf('0x34'));}if(_['isNil'](_0x7730b0[_0x6dcf('0x27')][_0x6dcf('0x27')])||_0x7730b0[_0x6dcf('0x27')]['body']===''){throw new db[(_0x6dcf('0x2a'))]['ValidationError'](_0x6dcf('0x35'));}if(_['isNil'](_0x7730b0[_0x6dcf('0x27')]['mapKey'])){throw new db[(_0x6dcf('0x2a'))][(_0x6dcf('0x2b'))](_0x6dcf('0x36')+_0x20f59d);}if(!_['includes'](_0x20f59d,_0x7730b0[_0x6dcf('0x27')]['mapKey'])){throw new db[(_0x6dcf('0x2a'))][(_0x6dcf('0x2b'))](_0x6dcf('0x37')+_0x20f59d);}_0x1591cf[_0x7730b0[_0x6dcf('0x27')]['mapKey']]=_0x7730b0[_0x6dcf('0x27')]['from'];})[_0x6dcf('0x25')](function(){return db[_0x6dcf('0x1c')][_0x6dcf('0x38')]({'where':{'id':_0x7730b0[_0x6dcf('0x39')]['id']},'include':[{'model':db[_0x6dcf('0x3a')],'as':_0x6dcf('0x3b'),'include':[{'model':db[_0x6dcf('0x3c')],'as':_0x6dcf('0x3d'),'where':_0x1591cf,'limit':0x1,'order':[[_0x6dcf('0x30'),_0x6dcf('0x3e')]]}]},{'model':db[_0x6dcf('0x3f')],'as':_0x6dcf('0x40')}]});})[_0x6dcf('0x25')](function(_0x2dba6b){if(_0x2dba6b&&_0x2dba6b[_0x6dcf('0x3b')]){var _0x1a9d07=_0x2dba6b[_0x6dcf('0x41')]({'plain':!![]});_0x18dc28[_0x6dcf('0x39')]=_0x1a9d07;_0x18dc28[_0x6dcf('0x42')]=_0x1a9d07[_0x6dcf('0x40')];_0x18dc28[_0x6dcf('0x43')]=_0x1a9d07[_0x6dcf('0x3b')];_0x18dc28[_0x6dcf('0x42')]=_[_0x6dcf('0x44')](_0x18dc28[_0x6dcf('0x42')],[_0x6dcf('0x45')],['asc']);if(_0x18dc28['account'][_0x6dcf('0x40')]){delete _0x18dc28[_0x6dcf('0x39')][_0x6dcf('0x40')];}if(_0x18dc28['account'][_0x6dcf('0x3b')]&&_0x18dc28[_0x6dcf('0x39')]['List'][_0x6dcf('0x3d')]['length']){return _0x18dc28[_0x6dcf('0x39')][_0x6dcf('0x3b')][_0x6dcf('0x3d')][0x0];}var _0x39b3f8=_[_0x6dcf('0x46')](_0x7730b0[_0x6dcf('0x27')],{'firstName':_0x7730b0[_0x6dcf('0x27')][_0x6dcf('0x47')],'ListId':_0x1a9d07[_0x6dcf('0x32')]});_0x39b3f8[_0x7730b0[_0x6dcf('0x27')][_0x6dcf('0x48')]]=_0x7730b0[_0x6dcf('0x27')]['from'];return db[_0x6dcf('0x3c')][_0x6dcf('0x49')](_0x39b3f8,{'fields':_0x3ef3c8,'raw':!![]});}})[_0x6dcf('0x25')](function(_0x114d13){_0x18dc28[_0x6dcf('0x4a')]=_0x114d13;if(_0x114d13){var _0x27debd={'ContactId':_0x114d13['id'],'FaxAccountId':_0x7730b0[_0x6dcf('0x39')]['id'],'fax':_0x114d13[_0x6dcf('0x28')]};return db[_0x6dcf('0x4b')][_0x6dcf('0x38')]({'where':{'ContactId':_0x114d13['id'],'closed':![],'FaxAccountId':_0x7730b0[_0x6dcf('0x39')]['id']}})[_0x6dcf('0x25')](function(_0x324a41){if(_0x324a41){return[_0x324a41,![]];}return db[_0x6dcf('0x4b')]['create'](_0x27debd)['then'](function(_0x220047){return[_0x220047,!![]];});});}else{throw new Error(_0x6dcf('0x4c'));}})[_0x6dcf('0x4d')](function(_0x5aa12f,_0x3918b4){var _0x2d4534=_0x5aa12f[_0x6dcf('0x41')]({'plain':!![]});if(_0x3918b4){if(_0x18dc28['account']['autoclose']){_0x18dc28[_0x6dcf('0x42')]['push']({'id':0x0,'priority':_0x18dc28['applications'][_0x6dcf('0x4e')]+0x1,'app':_0x6dcf('0x4f'),'appdata':_0x6dcf('0x50'),'interval':_0x6dcf('0x51')});}_0x2d4534['created']=!![];}else{_0x2d4534[_0x6dcf('0x52')]=![];}_0x18dc28[_0x6dcf('0x53')]=_0x2d4534;return db[_0x6dcf('0x54')][_0x6dcf('0x49')]({'body':_0x7730b0[_0x6dcf('0x27')][_0x6dcf('0x27')],'FaxAccountId':_0x7730b0['account']['id'],'FaxInteractionId':_0x5aa12f['id'],'direction':'in','ContactId':_0x5aa12f['ContactId'],'AttachmentId':_0x7730b0[_0x6dcf('0x27')][_0x6dcf('0x55')]});})[_0x6dcf('0x25')](function(_0x458fd1){_0x18dc28['message']=_0x458fd1;if(_0x18dc28['interaction'][_0x6dcf('0x56')]){return db[_0x6dcf('0x57')]['find']({'attributes':['id',_0x6dcf('0x58')],'where':{'id':_0x18dc28[_0x6dcf('0x53')][_0x6dcf('0x56')]}})['then'](function(_0x4dd9a7){if(_0x4dd9a7){_0x18dc28[_0x6dcf('0x42')][_0x6dcf('0x59')]({'id':0x0,'priority':0x0,'app':_0x6dcf('0x5a'),'appdata':_0x4dd9a7['name']+','+(_0x18dc28[_0x6dcf('0x39')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x6dcf('0x5b'),'startRouting',_0x18dc28);});}return respondWithRpcPromise(_0x6dcf('0x5b'),'startRouting',_0x18dc28);})[_0x6dcf('0x25')](function(_0x47978d){_0x1c78d4(_0x47978d);})[_0x6dcf('0x1a')](function(_0x136d0c){_0x7f01d4(_0x1dd58c[_0x6dcf('0x16')](0x1f4,_0x136d0c['message']));});});}; \ No newline at end of file +var _0x54ff=['body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','find','CmList','Contacts','FaxApplication','Applications','List','applications','list','orderBy','asc','account','length','create','contact','FaxInteraction','spread','get','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x54ff,0x1ed));var _0xf54f=function(_0x24e60c,_0x4dd1f4){_0x24e60c=_0x24e60c-0x0;var _0x1eef63=_0x54ff[_0x24e60c];return _0x1eef63;};'use strict';var _=require('lodash');var util=require(_0xf54f('0x0'));var moment=require(_0xf54f('0x1'));var BPromise=require(_0xf54f('0x2'));var rs=require(_0xf54f('0x3'));var fs=require('fs');var Redis=require(_0xf54f('0x4'));var db=require(_0xf54f('0x5'))['db'];var utils=require(_0xf54f('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xf54f('0x7'));var client=jayson['client']['http']({'port':0x232c});config[_0xf54f('0x8')]=_['defaults'](config[_0xf54f('0x8')],{'host':_0xf54f('0x9'),'port':0x18eb});var socket=require(_0xf54f('0xa'))(new Redis(config[_0xf54f('0x8')]));require(_0xf54f('0xb'))[_0xf54f('0xc')](socket);function respondWithRpcPromise(_0x410d6e,_0xc61a5a,_0x551cdf){return new BPromise(function(_0x23414d,_0x3484fc){return client[_0xf54f('0xd')](_0x410d6e,_0x551cdf)[_0xf54f('0xe')](function(_0x139ced){logger[_0xf54f('0xf')](_0xf54f('0x10'),_0xc61a5a,'request\x20sent');logger['debug'](_0xf54f('0x11'),_0xc61a5a,'request\x20sent',JSON[_0xf54f('0x12')](_0x139ced));if(_0x139ced[_0xf54f('0x13')]){if(_0x139ced[_0xf54f('0x13')][_0xf54f('0x14')]===0x1f4){logger[_0xf54f('0x13')](_0xf54f('0x10'),_0xc61a5a,_0x139ced[_0xf54f('0x13')][_0xf54f('0x15')]);return _0x3484fc(_0x139ced['error'][_0xf54f('0x15')]);}logger[_0xf54f('0x13')](_0xf54f('0x10'),_0xc61a5a,_0x139ced[_0xf54f('0x13')][_0xf54f('0x15')]);return _0x23414d(_0x139ced[_0xf54f('0x13')][_0xf54f('0x15')]);}else{logger[_0xf54f('0xf')](_0xf54f('0x10'),_0xc61a5a,_0xf54f('0x16'));_0x23414d(_0x139ced[_0xf54f('0x17')][_0xf54f('0x15')]);}})[_0xf54f('0x18')](function(_0x480f88){logger[_0xf54f('0x13')]('FaxAccount,\x20%s,\x20%s',_0xc61a5a,_0x480f88);_0x3484fc(_0x480f88);});});}exports[_0xf54f('0x19')]=function(_0xdf2422){var _0x433826=this;return new Promise(function(_0x2b683b,_0x2bfbd0){return db[_0xf54f('0x1a')][_0xf54f('0x1b')]({'raw':_0xdf2422[_0xf54f('0x1c')]?_0xdf2422['options'][_0xf54f('0x1d')]===undefined?!![]:![]:!![],'where':_0xdf2422['options']?_0xdf2422[_0xf54f('0x1c')][_0xf54f('0x1e')]||null:null,'attributes':_0xdf2422[_0xf54f('0x1c')]?_0xdf2422['options'][_0xf54f('0x1f')]||null:null,'limit':_0xdf2422[_0xf54f('0x1c')]?_0xdf2422[_0xf54f('0x1c')][_0xf54f('0x20')]||null:null,'include':_0xdf2422[_0xf54f('0x1c')]?_0xdf2422[_0xf54f('0x1c')][_0xf54f('0x21')]?_[_0xf54f('0x22')](_0xdf2422[_0xf54f('0x1c')][_0xf54f('0x21')],function(_0x4c8bcf){return{'model':db[_0x4c8bcf[_0xf54f('0x23')]],'as':_0x4c8bcf['as'],'attributes':_0x4c8bcf[_0xf54f('0x1f')],'include':_0x4c8bcf['include']?_['map'](_0x4c8bcf[_0xf54f('0x21')],function(_0x4ff4b2){return{'model':db[_0x4ff4b2[_0xf54f('0x23')]],'as':_0x4ff4b2['as'],'attributes':_0x4ff4b2[_0xf54f('0x1f')],'include':_0x4ff4b2[_0xf54f('0x21')]?_[_0xf54f('0x22')](_0x4ff4b2[_0xf54f('0x21')],function(_0x299083){return{'model':db[_0x299083['model']],'as':_0x299083['as'],'attributes':_0x299083['attributes']};}):[]};}):[]};}):[]:[]})[_0xf54f('0xe')](function(_0x569ddf){logger[_0xf54f('0xf')](_0xf54f('0x19'),_0xdf2422);logger[_0xf54f('0x24')](_0xf54f('0x19'),_0xdf2422,JSON[_0xf54f('0x12')](_0x569ddf));_0x2b683b(_0x569ddf);})[_0xf54f('0x18')](function(_0x258a64){logger[_0xf54f('0x13')]('GetFaxAccount',_0x258a64[_0xf54f('0x15')],_0xdf2422);_0x2bfbd0(_0x433826[_0xf54f('0x13')](0x1f4,_0x258a64[_0xf54f('0x15')]));});});};exports['NotifyFaxAccount']=function(_0x3e8988,_0x4e87ba,_0x704e9a){var _0x5508a3=this;return new Promise(function(_0x41bc04,_0x3546a1){var _0x57b16e={'body':_0x3e8988[_0xf54f('0x25')],'channel':_0xf54f('0x26')};var _0x326310=[];var _0x1222a7=[];var _0x9bc934={};return db[_0xf54f('0x27')][_0xf54f('0x28')]()[_0xf54f('0xe')](function(_0x45cd6d){if(!_0x45cd6d){throw new db[(_0xf54f('0x29'))][(_0xf54f('0x2a'))](_0xf54f('0x2b'));}_0x326310=_[_0xf54f('0x2c')](_[_0xf54f('0x2d')](_0x45cd6d),[_0xf54f('0x2e'),_0xf54f('0x2f')]);_0x1222a7=_[_0xf54f('0x2c')](_[_0xf54f('0x2d')](_0x45cd6d),[_0xf54f('0x2e'),_0xf54f('0x2f'),_0xf54f('0x30'),_0xf54f('0x31')]);if(_0x3e8988[_0xf54f('0x25')]['id']){delete _0x3e8988[_0xf54f('0x25')]['id'];}if(_[_0xf54f('0x32')](_0x3e8988[_0xf54f('0x25')][_0xf54f('0x33')])){throw new db[(_0xf54f('0x29'))][(_0xf54f('0x2a'))](_0xf54f('0x34'));}if(_['isNil'](_0x3e8988['body'][_0xf54f('0x25')])||_0x3e8988[_0xf54f('0x25')]['body']===''){throw new db[(_0xf54f('0x29'))][(_0xf54f('0x2a'))](_0xf54f('0x35'));}if(_['isNil'](_0x3e8988['body']['mapKey'])){throw new db['Sequelize'][(_0xf54f('0x2a'))](_0xf54f('0x36')+_0x1222a7);}if(!_[_0xf54f('0x37')](_0x1222a7,_0x3e8988[_0xf54f('0x25')][_0xf54f('0x38')])){throw new db[(_0xf54f('0x29'))][(_0xf54f('0x2a'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1222a7);}_0x9bc934[_0x3e8988[_0xf54f('0x25')][_0xf54f('0x38')]]=_0x3e8988[_0xf54f('0x25')][_0xf54f('0x33')];})[_0xf54f('0xe')](function(){return db[_0xf54f('0x1a')][_0xf54f('0x39')]({'where':{'id':_0x3e8988['account']['id']},'include':[{'model':db[_0xf54f('0x3a')],'as':'List','include':[{'model':db[_0xf54f('0x27')],'as':_0xf54f('0x3b'),'where':_0x9bc934,'limit':0x1,'order':[[_0xf54f('0x2f'),'DESC']]}]},{'model':db[_0xf54f('0x3c')],'as':_0xf54f('0x3d')}]});})[_0xf54f('0xe')](function(_0x4b30dd){if(_0x4b30dd&&_0x4b30dd[_0xf54f('0x3e')]){var _0x10b368=_0x4b30dd['get']({'plain':!![]});_0x57b16e['account']=_0x10b368;_0x57b16e[_0xf54f('0x3f')]=_0x10b368['Applications'];_0x57b16e[_0xf54f('0x40')]=_0x10b368['List'];_0x57b16e['applications']=_[_0xf54f('0x41')](_0x57b16e[_0xf54f('0x3f')],['priority'],[_0xf54f('0x42')]);if(_0x57b16e[_0xf54f('0x43')]['Applications']){delete _0x57b16e[_0xf54f('0x43')][_0xf54f('0x3d')];}if(_0x57b16e[_0xf54f('0x43')]['List']&&_0x57b16e[_0xf54f('0x43')][_0xf54f('0x3e')][_0xf54f('0x3b')][_0xf54f('0x44')]){return _0x57b16e[_0xf54f('0x43')][_0xf54f('0x3e')]['Contacts'][0x0];}var _0x504176=_['defaults'](_0x3e8988[_0xf54f('0x25')],{'firstName':_0x3e8988[_0xf54f('0x25')][_0xf54f('0x33')],'ListId':_0x10b368[_0xf54f('0x31')]});_0x504176[_0x3e8988[_0xf54f('0x25')][_0xf54f('0x38')]]=_0x3e8988[_0xf54f('0x25')][_0xf54f('0x33')];return db[_0xf54f('0x27')][_0xf54f('0x45')](_0x504176,{'fields':_0x326310,'raw':!![]});}})[_0xf54f('0xe')](function(_0x3cacb6){_0x57b16e[_0xf54f('0x46')]=_0x3cacb6;if(_0x3cacb6){var _0x581437={'ContactId':_0x3cacb6['id'],'FaxAccountId':_0x3e8988['account']['id'],'fax':_0x3cacb6[_0xf54f('0x26')]};return db[_0xf54f('0x47')][_0xf54f('0x39')]({'where':{'ContactId':_0x3cacb6['id'],'closed':![],'FaxAccountId':_0x3e8988[_0xf54f('0x43')]['id']}})['then'](function(_0x253bb5){if(_0x253bb5){return[_0x253bb5,![]];}return db[_0xf54f('0x47')]['create'](_0x581437)[_0xf54f('0xe')](function(_0x46a083){return[_0x46a083,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xf54f('0x48')](function(_0x58026f,_0x535e3f){var _0x5612b0=_0x58026f[_0xf54f('0x49')]({'plain':!![]});if(_0x535e3f){if(_0x57b16e['account'][_0xf54f('0x4a')]){_0x57b16e['applications'][_0xf54f('0x4b')]({'id':0x0,'priority':_0x57b16e['applications'][_0xf54f('0x44')]+0x1,'app':_0xf54f('0x4c'),'appdata':_0xf54f('0x4d'),'interval':_0xf54f('0x4e')});}_0x5612b0[_0xf54f('0x4f')]=!![];}else{_0x5612b0['created']=![];}_0x57b16e[_0xf54f('0x50')]=_0x5612b0;return db[_0xf54f('0x51')][_0xf54f('0x45')]({'body':_0x3e8988[_0xf54f('0x25')]['body'],'FaxAccountId':_0x3e8988[_0xf54f('0x43')]['id'],'FaxInteractionId':_0x58026f['id'],'direction':'in','ContactId':_0x58026f[_0xf54f('0x52')],'AttachmentId':_0x3e8988[_0xf54f('0x25')]['AttachmentId']});})[_0xf54f('0xe')](function(_0x4ea057){_0x57b16e[_0xf54f('0x15')]=_0x4ea057;if(_0x57b16e[_0xf54f('0x50')][_0xf54f('0x53')]){return db[_0xf54f('0x54')][_0xf54f('0x39')]({'attributes':['id',_0xf54f('0x55')],'where':{'id':_0x57b16e[_0xf54f('0x50')][_0xf54f('0x53')]}})[_0xf54f('0xe')](function(_0x390d1d){if(_0x390d1d){_0x57b16e[_0xf54f('0x3f')][_0xf54f('0x56')]({'id':0x0,'priority':0x0,'app':_0xf54f('0x57'),'appdata':_0x390d1d[_0xf54f('0x55')]+','+(_0x57b16e['account'][_0xf54f('0x58')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start','startRouting',_0x57b16e);});}return respondWithRpcPromise(_0xf54f('0x59'),_0xf54f('0x5a'),_0x57b16e);})[_0xf54f('0xe')](function(_0xc12a4d){_0x41bc04(_0xc12a4d);})['catch'](function(_0x1b889a){_0x3546a1(_0x5508a3[_0xf54f('0x13')](0x1f4,_0x1b889a['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 718a72d..4db40dc 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 _0xfb11=['length','faxAccount:','./faxAccount.events','remove','update','emit','removeListener'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xfb11[_0x24237f];return _0x48298e;};'use strict';var FaxAccountEvents=require(_0x1fb1('0x0'));var events=['save',_0x1fb1('0x1'),_0x1fb1('0x2')];function createListener(_0x51c055,_0x1461ad){return function(_0x5af9cc){_0x1461ad[_0x1fb1('0x3')](_0x51c055,_0x5af9cc);};}function removeListener(_0x5a830e,_0x190f74){return function(){FaxAccountEvents[_0x1fb1('0x4')](_0x5a830e,_0x190f74);};}exports['register']=function(_0x25d44f){for(var _0x133727=0x0,_0x4c098d=events[_0x1fb1('0x5')];_0x133727<_0x4c098d;_0x133727++){var _0x2596c2=events[_0x133727];var _0x34e61a=createListener(_0x1fb1('0x6')+_0x2596c2,_0x25d44f);FaxAccountEvents['on'](_0x2596c2,_0x34e61a);}}; \ No newline at end of file +var _0xa6b0=['faxAccount:','./faxAccount.events','save','removeListener','register','length'];(function(_0xb4cc12,_0x41436e){var _0x8593b5=function(_0x13b840){while(--_0x13b840){_0xb4cc12['push'](_0xb4cc12['shift']());}};_0x8593b5(++_0x41436e);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x4ac58d,_0xe6808b){_0x4ac58d=_0x4ac58d-0x0;var _0x422429=_0xa6b0[_0x4ac58d];return _0x422429;};'use strict';var FaxAccountEvents=require(_0x0a6b('0x0'));var events=[_0x0a6b('0x1'),'remove','update'];function createListener(_0x4597d6,_0x2c0d7f){return function(_0x13d4d5){_0x2c0d7f['emit'](_0x4597d6,_0x13d4d5);};}function removeListener(_0x29ff80,_0x33e8c3){return function(){FaxAccountEvents[_0x0a6b('0x2')](_0x29ff80,_0x33e8c3);};}exports[_0x0a6b('0x3')]=function(_0x3dc2b0){for(var _0x3b6967=0x0,_0x1b5fb5=events[_0x0a6b('0x4')];_0x3b6967<_0x1b5fb5;_0x3b6967++){var _0x26f761=events[_0x3b6967];var _0x340a33=createListener(_0x0a6b('0x5')+_0x26f761,_0x3dc2b0);FaxAccountEvents['on'](_0x26f761,_0x340a33);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 201aaea..820648f 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 _0x9705=['addInteraction','/addaccountapplications','/updateaccountapplications','updateAccountApplications','send','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','describe','/:id','isAuthenticated','show','getDispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/messages','/:id/users','getAgents','create','post','/:id/dispositions','addAnswer','/:id/interactions'];(function(_0x4054fe,_0x18f33e){var _0x4f9bee=function(_0x3c304d){while(--_0x3c304d){_0x4054fe['push'](_0x4054fe['shift']());}};_0x4f9bee(++_0x18f33e);}(_0x9705,0x8f));var _0x5970=function(_0xd23a84,_0x90743f){_0xd23a84=_0xd23a84-0x0;var _0x3ab724=_0x9705[_0xd23a84];return _0x3ab724;};'use strict';var multer=require(_0x5970('0x0'));var util=require(_0x5970('0x1'));var path=require(_0x5970('0x2'));var timeout=require(_0x5970('0x3'));var express=require(_0x5970('0x4'));var router=express[_0x5970('0x5')]();var auth=require(_0x5970('0x6'));var interaction=require(_0x5970('0x7'));var config=require(_0x5970('0x8'));var controller=require(_0x5970('0x9'));router[_0x5970('0xa')]('/',auth['isAuthenticated'](),controller[_0x5970('0xb')]);router['get'](_0x5970('0xc'),auth['isAuthenticated'](),controller[_0x5970('0xd')]);router[_0x5970('0xa')](_0x5970('0xe'),auth[_0x5970('0xf')](),controller[_0x5970('0x10')]);router[_0x5970('0xa')]('/:id/dispositions',auth[_0x5970('0xf')](),controller[_0x5970('0x11')]);router[_0x5970('0xa')](_0x5970('0x12'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x5970('0xa')]('/:id/interactions',auth[_0x5970('0xf')](),controller['getInteractions']);router[_0x5970('0xa')](_0x5970('0x13'),auth[_0x5970('0xf')](),controller[_0x5970('0x14')]);router[_0x5970('0xa')](_0x5970('0x15'),auth[_0x5970('0xf')](),controller['getMessages']);router[_0x5970('0xa')](_0x5970('0x16'),auth[_0x5970('0xf')](),controller[_0x5970('0x17')]);router['post']('/',auth[_0x5970('0xf')](),controller[_0x5970('0x18')]);router[_0x5970('0x19')](_0x5970('0x1a'),auth[_0x5970('0xf')](),controller['addDisposition']);router[_0x5970('0x19')]('/:id/canned_answers',auth[_0x5970('0xf')](),controller[_0x5970('0x1b')]);router[_0x5970('0x19')](_0x5970('0x1c'),auth[_0x5970('0xf')](),controller[_0x5970('0x1d')]);router['post'](_0x5970('0x13'),auth[_0x5970('0xf')](),controller['addApplications']);router[_0x5970('0x19')](_0x5970('0x1e'),auth[_0x5970('0xf')](),controller['addAccountApplications']);router['post'](_0x5970('0x1f'),auth[_0x5970('0xf')](),controller[_0x5970('0x20')]);router[_0x5970('0x19')]('/:id/send',auth['isAuthenticated'](),controller[_0x5970('0x21')]);router[_0x5970('0x19')](_0x5970('0x16'),auth[_0x5970('0xf')](),controller[_0x5970('0x22')]);router[_0x5970('0x23')]('/:id',auth['isAuthenticated'](),controller[_0x5970('0x24')]);router[_0x5970('0x25')](_0x5970('0xe'),auth['isAuthenticated'](),controller[_0x5970('0x26')]);router[_0x5970('0x25')](_0x5970('0x1a'),auth[_0x5970('0xf')](),controller[_0x5970('0x27')]);router[_0x5970('0x25')](_0x5970('0x12'),auth[_0x5970('0xf')](),controller[_0x5970('0x28')]);router[_0x5970('0x25')](_0x5970('0x16'),auth['isAuthenticated'](),controller[_0x5970('0x29')]);module[_0x5970('0x2a')]=router; \ No newline at end of file +var _0x4212=['put','removeDispositions','delete','removeAnswers','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id/canned_answers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','/:id/dispositions','addDisposition','addAnswer','addInteraction','addApplications','/addaccountapplications','/updateaccountapplications','updateAccountApplications','/:id/send','addAgents'];(function(_0x12d951,_0x249808){var _0x44de17=function(_0x182fd9){while(--_0x182fd9){_0x12d951['push'](_0x12d951['shift']());}};_0x44de17(++_0x249808);}(_0x4212,0x15b));var _0x2421=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0x4212[_0x4ae625];return _0x31accf;};'use strict';var multer=require(_0x2421('0x0'));var util=require(_0x2421('0x1'));var path=require(_0x2421('0x2'));var timeout=require(_0x2421('0x3'));var express=require('express');var router=express[_0x2421('0x4')]();var auth=require(_0x2421('0x5'));var interaction=require(_0x2421('0x6'));var config=require(_0x2421('0x7'));var controller=require('./faxAccount.controller');router[_0x2421('0x8')]('/',auth[_0x2421('0x9')](),controller[_0x2421('0xa')]);router['get'](_0x2421('0xb'),auth['isAuthenticated'](),controller[_0x2421('0xc')]);router[_0x2421('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x2421('0x8')]('/:id/dispositions',auth[_0x2421('0x9')](),controller['getDispositions']);router[_0x2421('0x8')](_0x2421('0xd'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x2421('0x8')](_0x2421('0xe'),auth['isAuthenticated'](),controller[_0x2421('0xf')]);router['get'](_0x2421('0x10'),auth['isAuthenticated'](),controller[_0x2421('0x11')]);router[_0x2421('0x8')](_0x2421('0x12'),auth[_0x2421('0x9')](),controller[_0x2421('0x13')]);router[_0x2421('0x8')](_0x2421('0x14'),auth['isAuthenticated'](),controller[_0x2421('0x15')]);router['post']('/',auth[_0x2421('0x9')](),controller['create']);router[_0x2421('0x16')](_0x2421('0x17'),auth['isAuthenticated'](),controller[_0x2421('0x18')]);router[_0x2421('0x16')](_0x2421('0xd'),auth[_0x2421('0x9')](),controller[_0x2421('0x19')]);router['post'](_0x2421('0xe'),auth['isAuthenticated'](),controller[_0x2421('0x1a')]);router['post'](_0x2421('0x10'),auth['isAuthenticated'](),controller[_0x2421('0x1b')]);router['post'](_0x2421('0x1c'),auth[_0x2421('0x9')](),controller['addAccountApplications']);router[_0x2421('0x16')](_0x2421('0x1d'),auth[_0x2421('0x9')](),controller[_0x2421('0x1e')]);router[_0x2421('0x16')](_0x2421('0x1f'),auth[_0x2421('0x9')](),controller['send']);router[_0x2421('0x16')](_0x2421('0x14'),auth['isAuthenticated'](),controller[_0x2421('0x20')]);router[_0x2421('0x21')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x2421('0x9')](),controller['destroy']);router['delete'](_0x2421('0x17'),auth[_0x2421('0x9')](),controller[_0x2421('0x22')]);router[_0x2421('0x23')](_0x2421('0xd'),auth[_0x2421('0x9')](),controller[_0x2421('0x24')]);router[_0x2421('0x23')](_0x2421('0x14'),auth[_0x2421('0x9')](),controller['removeAgents']);module[_0x2421('0x25')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index d7b8926..2317495 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 _0x014c=['STRING','noop','TEXT','*,*,*,*','exports'];(function(_0x327c00,_0x5d43a3){var _0xc2ec69=function(_0x4dfbeb){while(--_0x4dfbeb){_0x327c00['push'](_0x327c00['shift']());}};_0xc2ec69(++_0x5d43a3);}(_0x014c,0x17b));var _0xc014=function(_0x18d631,_0x4376d2){_0x18d631=_0x18d631-0x0;var _0x50d708=_0x014c[_0x18d631];return _0x50d708;};'use strict';var Sequelize=require('sequelize');module[_0xc014('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xc014('0x1')],'allowNull':![],'defaultValue':_0xc014('0x2')},'appdata':{'type':Sequelize[_0xc014('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xc014('0x4')}}; \ No newline at end of file +var _0x7e3e=['sequelize','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x5bfee7,_0x48c30e){var _0x4d2fad=function(_0x2723f0){while(--_0x2723f0){_0x5bfee7['push'](_0x5bfee7['shift']());}};_0x4d2fad(++_0x48c30e);}(_0x7e3e,0x126));var _0xe7e3=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x7e3e[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require(_0xe7e3('0x0'));module['exports']={'priority':{'type':Sequelize[_0xe7e3('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xe7e3('0x2')],'allowNull':![],'defaultValue':_0xe7e3('0x3')},'appdata':{'type':Sequelize[_0xe7e3('0x4')]()},'description':{'type':Sequelize[_0xe7e3('0x2')]},'interval':{'type':Sequelize[_0xe7e3('0x2')],'defaultValue':_0xe7e3('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 5dbbe1e..ea68258 100644 --- a/server/api/faxApplication/faxApplication.controller.js +++ b/server/api/faxApplication/faxApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4975=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','FaxApplication','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','filter','map','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','to-csv','papaparse','ioredis'];(function(_0x9a3e0f,_0x2f796d){var _0x3d2a9a=function(_0x3aeb03){while(--_0x3aeb03){_0x9a3e0f['push'](_0x9a3e0f['shift']());}};_0x3d2a9a(++_0x2f796d);}(_0x4975,0x86));var _0x5497=function(_0xcba418,_0x1807f3){_0xcba418=_0xcba418-0x0;var _0x596908=_0x4975[_0xcba418];return _0x596908;};'use strict';var pdf=require(_0x5497('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5497('0x1'));var zipdir=require(_0x5497('0x2'));var jsonpatch=require(_0x5497('0x3'));var rp=require(_0x5497('0x4'));var moment=require(_0x5497('0x5'));var BPromise=require(_0x5497('0x6'));var Mustache=require(_0x5497('0x7'));var util=require(_0x5497('0x8'));var path=require(_0x5497('0x9'));var sox=require(_0x5497('0xa'));var csv=require('to-csv');var ejs=require(_0x5497('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xf'));var querystring=require('querystring');var Papa=require(_0x5497('0x10'));var Redis=require(_0x5497('0x11'));var authService=require(_0x5497('0x12'));var qs=require(_0x5497('0x13'));var as=require(_0x5497('0x14'));var hardwareService=require(_0x5497('0x15'));var logger=require(_0x5497('0x16'))(_0x5497('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc250bb,_0x1b23df){_0x1b23df=_0x1b23df||0xcc;return function(_0x1bb794){if(_0x1bb794){return _0xc250bb[_0x5497('0x18')](_0x1b23df);}return _0xc250bb[_0x5497('0x19')](_0x1b23df)[_0x5497('0x1a')]();};}function respondWithResult(_0x1f7169,_0xaca97d){_0xaca97d=_0xaca97d||0xc8;return function(_0x363a5b){if(_0x363a5b){return _0x1f7169[_0x5497('0x19')](_0xaca97d)['json'](_0x363a5b);}};}function respondWithFilteredResult(_0x11b0a9,_0x4fb8e9){return function(_0x4237a9){if(_0x4237a9){var _0x2bfd8a=_0x4237a9[_0x5497('0x1b')],_0x19e5f3=_0x4fb8e9[_0x5497('0x1c')],_0x3ce50b=_0x4fb8e9['offset']+_0x4fb8e9['limit'],_0x37c18e;if(_0x3ce50b>=_0x2bfd8a){_0x3ce50b=_0x2bfd8a;_0x37c18e=0xc8;}else{_0x37c18e=0xce;}_0x11b0a9[_0x5497('0x19')](_0x37c18e);return _0x11b0a9[_0x5497('0x1d')](_0x5497('0x1e'),_0x19e5f3+'-'+_0x3ce50b+'/'+_0x2bfd8a)['json'](_0x4237a9);}return null;};}function patchUpdates(_0xbf1ba7){return function(_0xcbd71d){try{jsonpatch[_0x5497('0x1f')](_0xcbd71d,_0xbf1ba7,!![]);}catch(_0x43da2c){return BPromise[_0x5497('0x20')](_0x43da2c);}return _0xcbd71d[_0x5497('0x21')]();};}function saveUpdates(_0x16d378,_0x10226f){return function(_0x2e3960){if(_0x2e3960){return _0x2e3960[_0x5497('0x22')](_0x16d378)[_0x5497('0x23')](function(_0x52c049){return _0x52c049;});}return null;};}function removeEntity(_0x720767,_0x4d1b27){return function(_0x19200a){if(_0x19200a){return _0x19200a[_0x5497('0x24')]()[_0x5497('0x23')](function(){_0x720767[_0x5497('0x19')](0xcc)[_0x5497('0x1a')]();});}};}function handleEntityNotFound(_0x3b2fbc,_0x5018fa){return function(_0x54043a){if(!_0x54043a){_0x3b2fbc[_0x5497('0x18')](0x194);}return _0x54043a;};}function handleError(_0x34b97f,_0x24482a){_0x24482a=_0x24482a||0x1f4;return function(_0x281155){logger['error'](_0x281155[_0x5497('0x25')]);if(_0x281155['name']){delete _0x281155[_0x5497('0x26')];}_0x34b97f[_0x5497('0x19')](_0x24482a)[_0x5497('0x27')](_0x281155);};}exports[_0x5497('0x28')]=function(_0x163a30,_0x31cd01){var _0x48b835={},_0x4af5f4={},_0x5406e2={'count':0x0,'rows':[]};var _0x583d06=_['map'](db[_0x5497('0x29')]['rawAttributes'],function(_0x5e9356){return{'name':_0x5e9356[_0x5497('0x2a')],'type':_0x5e9356[_0x5497('0x2b')][_0x5497('0x2c')]};});_0x4af5f4['model']=_['map'](_0x583d06,'name');_0x4af5f4[_0x5497('0x2d')]=_[_0x5497('0x2e')](_0x163a30[_0x5497('0x2d')]);_0x4af5f4['filters']=_['intersection'](_0x4af5f4['model'],_0x4af5f4[_0x5497('0x2d')]);_0x48b835['attributes']=_[_0x5497('0x2f')](_0x4af5f4[_0x5497('0x30')],qs[_0x5497('0x31')](_0x163a30['query'][_0x5497('0x31')]));_0x48b835[_0x5497('0x32')]=_0x48b835['attributes'][_0x5497('0x33')]?_0x48b835[_0x5497('0x32')]:_0x4af5f4[_0x5497('0x30')];if(!_0x163a30['query'][_0x5497('0x34')](_0x5497('0x35'))){_0x48b835[_0x5497('0x36')]=qs[_0x5497('0x36')](_0x163a30[_0x5497('0x2d')]['limit']);_0x48b835[_0x5497('0x1c')]=qs[_0x5497('0x1c')](_0x163a30['query'][_0x5497('0x1c')]);}_0x48b835[_0x5497('0x37')]=qs[_0x5497('0x38')](_0x163a30[_0x5497('0x2d')][_0x5497('0x38')]);_0x48b835[_0x5497('0x39')]=qs['filters'](_[_0x5497('0x3a')](_0x163a30['query'],_0x4af5f4[_0x5497('0x3b')]),_0x583d06);if(_0x163a30[_0x5497('0x2d')][_0x5497('0x3c')]){_0x48b835['where']=_['merge'](_0x48b835[_0x5497('0x39')],{'$or':_[_0x5497('0x3d')](_0x583d06,function(_0x326d48){if(_0x326d48[_0x5497('0x2b')]!==_0x5497('0x3e')){var _0xc8a689={};_0xc8a689[_0x326d48['name']]={'$like':'%'+_0x163a30[_0x5497('0x2d')][_0x5497('0x3c')]+'%'};return _0xc8a689;}})});}_0x48b835=_[_0x5497('0x3f')]({},_0x48b835,_0x163a30[_0x5497('0x40')]);var _0x275aa7={'where':_0x48b835[_0x5497('0x39')]};return db[_0x5497('0x29')][_0x5497('0x1b')](_0x275aa7)[_0x5497('0x23')](function(_0x544065){_0x5406e2[_0x5497('0x1b')]=_0x544065;if(_0x163a30[_0x5497('0x2d')][_0x5497('0x41')]){_0x48b835[_0x5497('0x42')]=[{'all':!![]}];}return db[_0x5497('0x29')][_0x5497('0x43')](_0x48b835);})[_0x5497('0x23')](function(_0x59ed13){_0x5406e2[_0x5497('0x44')]=_0x59ed13;return _0x5406e2;})[_0x5497('0x23')](respondWithFilteredResult(_0x31cd01,_0x48b835))[_0x5497('0x45')](handleError(_0x31cd01,null));};exports[_0x5497('0x46')]=function(_0x1b251b,_0x125526){var _0x114471={'raw':!![],'where':{'id':_0x1b251b[_0x5497('0x47')]['id']}},_0x547437={};_0x547437[_0x5497('0x30')]=_[_0x5497('0x2e')](db[_0x5497('0x29')][_0x5497('0x48')]);_0x547437[_0x5497('0x2d')]=_[_0x5497('0x2e')](_0x1b251b[_0x5497('0x2d')]);_0x547437[_0x5497('0x3b')]=_[_0x5497('0x2f')](_0x547437['model'],_0x547437[_0x5497('0x2d')]);_0x114471['attributes']=_[_0x5497('0x2f')](_0x547437[_0x5497('0x30')],qs[_0x5497('0x31')](_0x1b251b[_0x5497('0x2d')][_0x5497('0x31')]));_0x114471['attributes']=_0x114471[_0x5497('0x32')][_0x5497('0x33')]?_0x114471['attributes']:_0x547437[_0x5497('0x30')];if(_0x1b251b['query'][_0x5497('0x41')]){_0x114471['include']=[{'all':!![]}];}_0x114471=_[_0x5497('0x3f')]({},_0x114471,_0x1b251b[_0x5497('0x40')]);return db[_0x5497('0x29')][_0x5497('0x49')](_0x114471)[_0x5497('0x23')](handleEntityNotFound(_0x125526,null))['then'](respondWithResult(_0x125526,null))['catch'](handleError(_0x125526,null));};exports['create']=function(_0x55f654,_0x3cbe4b){return db[_0x5497('0x29')][_0x5497('0x4a')](_0x55f654[_0x5497('0x4b')],{})[_0x5497('0x23')](respondWithResult(_0x3cbe4b,0xc9))[_0x5497('0x45')](handleError(_0x3cbe4b,null));};exports[_0x5497('0x22')]=function(_0x466287,_0x2626bf){if(_0x466287['body']['id']){delete _0x466287[_0x5497('0x4b')]['id'];}return db[_0x5497('0x29')][_0x5497('0x49')]({'where':{'id':_0x466287['params']['id']}})[_0x5497('0x23')](handleEntityNotFound(_0x2626bf,null))['then'](saveUpdates(_0x466287[_0x5497('0x4b')],null))[_0x5497('0x23')](respondWithResult(_0x2626bf,null))[_0x5497('0x45')](handleError(_0x2626bf,null));};exports['destroy']=function(_0x43bebe,_0x356d61){return db['FaxApplication'][_0x5497('0x49')]({'where':{'id':_0x43bebe['params']['id']}})[_0x5497('0x23')](handleEntityNotFound(_0x356d61,null))['then'](removeEntity(_0x356d61,null))[_0x5497('0x45')](handleError(_0x356d61,null));}; \ No newline at end of file +var _0xe14b=['options','includeAll','include','findAll','rows','catch','find','create','body','params','destroy','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','reject','update','then','error','stack','name','index','FaxApplication','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','order','sort','filter','where','merge','VIRTUAL'];(function(_0x2574dc,_0x5241c9){var _0x238405=function(_0xf02570){while(--_0xf02570){_0x2574dc['push'](_0x2574dc['shift']());}};_0x238405(++_0x5241c9);}(_0xe14b,0x93));var _0xbe14=function(_0x4b0b39,_0x15a3aa){_0x4b0b39=_0x4b0b39-0x0;var _0xa2829b=_0xe14b[_0x4b0b39];return _0xa2829b;};'use strict';var pdf=require(_0xbe14('0x0'));var emlformat=require(_0xbe14('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbe14('0x2'));var rp=require(_0xbe14('0x3'));var moment=require('moment');var BPromise=require(_0xbe14('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbe14('0x5'));var sox=require(_0xbe14('0x6'));var csv=require(_0xbe14('0x7'));var ejs=require(_0xbe14('0x8'));var fs=require('fs');var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var db=require(_0xbe14('0x14'))['db'];function respondWithStatusCode(_0x3d38c2,_0x27792f){_0x27792f=_0x27792f||0xcc;return function(_0x3b898d){if(_0x3b898d){return _0x3d38c2[_0xbe14('0x15')](_0x27792f);}return _0x3d38c2[_0xbe14('0x16')](_0x27792f)[_0xbe14('0x17')]();};}function respondWithResult(_0xa2cf72,_0x1e4826){_0x1e4826=_0x1e4826||0xc8;return function(_0x33fd54){if(_0x33fd54){return _0xa2cf72[_0xbe14('0x16')](_0x1e4826)['json'](_0x33fd54);}};}function respondWithFilteredResult(_0x55b3a7,_0x3f58f5){return function(_0x3dc4a9){if(_0x3dc4a9){var _0xf4ac9=_0x3dc4a9[_0xbe14('0x18')],_0x37ce4e=_0x3f58f5[_0xbe14('0x19')],_0x4e8f34=_0x3f58f5[_0xbe14('0x19')]+_0x3f58f5[_0xbe14('0x1a')],_0x21c789;if(_0x4e8f34>=_0xf4ac9){_0x4e8f34=_0xf4ac9;_0x21c789=0xc8;}else{_0x21c789=0xce;}_0x55b3a7[_0xbe14('0x16')](_0x21c789);return _0x55b3a7[_0xbe14('0x1b')]('Content-Range',_0x37ce4e+'-'+_0x4e8f34+'/'+_0xf4ac9)[_0xbe14('0x1c')](_0x3dc4a9);}return null;};}function patchUpdates(_0x456ca8){return function(_0x329588){try{jsonpatch[_0xbe14('0x1d')](_0x329588,_0x456ca8,!![]);}catch(_0x3249da){return BPromise[_0xbe14('0x1e')](_0x3249da);}return _0x329588['save']();};}function saveUpdates(_0x24f820,_0x4a1bbd){return function(_0x417c8d){if(_0x417c8d){return _0x417c8d[_0xbe14('0x1f')](_0x24f820)[_0xbe14('0x20')](function(_0x51dc0b){return _0x51dc0b;});}return null;};}function removeEntity(_0xe60f42,_0x56d845){return function(_0x3c1c85){if(_0x3c1c85){return _0x3c1c85['destroy']()[_0xbe14('0x20')](function(){_0xe60f42['status'](0xcc)[_0xbe14('0x17')]();});}};}function handleEntityNotFound(_0x3d3608,_0x505dbd){return function(_0x2da350){if(!_0x2da350){_0x3d3608['sendStatus'](0x194);}return _0x2da350;};}function handleError(_0x4587a8,_0x4851f8){_0x4851f8=_0x4851f8||0x1f4;return function(_0x36a21e){logger[_0xbe14('0x21')](_0x36a21e[_0xbe14('0x22')]);if(_0x36a21e[_0xbe14('0x23')]){delete _0x36a21e[_0xbe14('0x23')];}_0x4587a8[_0xbe14('0x16')](_0x4851f8)['send'](_0x36a21e);};}exports[_0xbe14('0x24')]=function(_0x1ba46a,_0x391556){var _0x169369={},_0x5dd475={},_0x16f884={'count':0x0,'rows':[]};var _0x29fc64=_['map'](db[_0xbe14('0x25')][_0xbe14('0x26')],function(_0x1c7cc7){return{'name':_0x1c7cc7[_0xbe14('0x27')],'type':_0x1c7cc7[_0xbe14('0x28')][_0xbe14('0x29')]};});_0x5dd475[_0xbe14('0x2a')]=_[_0xbe14('0x2b')](_0x29fc64,_0xbe14('0x23'));_0x5dd475[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](_0x1ba46a[_0xbe14('0x2c')]);_0x5dd475[_0xbe14('0x2e')]=_[_0xbe14('0x2f')](_0x5dd475[_0xbe14('0x2a')],_0x5dd475[_0xbe14('0x2c')]);_0x169369[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x5dd475[_0xbe14('0x2a')],qs[_0xbe14('0x31')](_0x1ba46a['query'][_0xbe14('0x31')]));_0x169369['attributes']=_0x169369['attributes'][_0xbe14('0x32')]?_0x169369['attributes']:_0x5dd475[_0xbe14('0x2a')];if(!_0x1ba46a[_0xbe14('0x2c')]['hasOwnProperty']('nolimit')){_0x169369['limit']=qs[_0xbe14('0x1a')](_0x1ba46a[_0xbe14('0x2c')]['limit']);_0x169369[_0xbe14('0x19')]=qs[_0xbe14('0x19')](_0x1ba46a[_0xbe14('0x2c')][_0xbe14('0x19')]);}_0x169369[_0xbe14('0x33')]=qs['sort'](_0x1ba46a['query'][_0xbe14('0x34')]);_0x169369['where']=qs['filters'](_['pick'](_0x1ba46a[_0xbe14('0x2c')],_0x5dd475[_0xbe14('0x2e')]),_0x29fc64);if(_0x1ba46a[_0xbe14('0x2c')][_0xbe14('0x35')]){_0x169369[_0xbe14('0x36')]=_[_0xbe14('0x37')](_0x169369[_0xbe14('0x36')],{'$or':_[_0xbe14('0x2b')](_0x29fc64,function(_0x2d9c12){if(_0x2d9c12[_0xbe14('0x28')]!==_0xbe14('0x38')){var _0x32c59d={};_0x32c59d[_0x2d9c12['name']]={'$like':'%'+_0x1ba46a['query'][_0xbe14('0x35')]+'%'};return _0x32c59d;}})});}_0x169369=_[_0xbe14('0x37')]({},_0x169369,_0x1ba46a[_0xbe14('0x39')]);var _0x520e09={'where':_0x169369[_0xbe14('0x36')]};return db[_0xbe14('0x25')][_0xbe14('0x18')](_0x520e09)[_0xbe14('0x20')](function(_0x3bd454){_0x16f884[_0xbe14('0x18')]=_0x3bd454;if(_0x1ba46a[_0xbe14('0x2c')][_0xbe14('0x3a')]){_0x169369[_0xbe14('0x3b')]=[{'all':!![]}];}return db['FaxApplication'][_0xbe14('0x3c')](_0x169369);})[_0xbe14('0x20')](function(_0x3463c4){_0x16f884[_0xbe14('0x3d')]=_0x3463c4;return _0x16f884;})[_0xbe14('0x20')](respondWithFilteredResult(_0x391556,_0x169369))[_0xbe14('0x3e')](handleError(_0x391556,null));};exports['show']=function(_0xb0f143,_0x1974a4){var _0x1220c9={'raw':!![],'where':{'id':_0xb0f143['params']['id']}},_0x36263c={};_0x36263c['model']=_[_0xbe14('0x2d')](db[_0xbe14('0x25')][_0xbe14('0x26')]);_0x36263c['query']=_['keys'](_0xb0f143[_0xbe14('0x2c')]);_0x36263c['filters']=_['intersection'](_0x36263c[_0xbe14('0x2a')],_0x36263c[_0xbe14('0x2c')]);_0x1220c9[_0xbe14('0x30')]=_['intersection'](_0x36263c['model'],qs['fields'](_0xb0f143[_0xbe14('0x2c')][_0xbe14('0x31')]));_0x1220c9[_0xbe14('0x30')]=_0x1220c9['attributes'][_0xbe14('0x32')]?_0x1220c9[_0xbe14('0x30')]:_0x36263c[_0xbe14('0x2a')];if(_0xb0f143[_0xbe14('0x2c')]['includeAll']){_0x1220c9['include']=[{'all':!![]}];}_0x1220c9=_[_0xbe14('0x37')]({},_0x1220c9,_0xb0f143[_0xbe14('0x39')]);return db[_0xbe14('0x25')][_0xbe14('0x3f')](_0x1220c9)[_0xbe14('0x20')](handleEntityNotFound(_0x1974a4,null))['then'](respondWithResult(_0x1974a4,null))['catch'](handleError(_0x1974a4,null));};exports[_0xbe14('0x40')]=function(_0x2a3623,_0x238c60){return db[_0xbe14('0x25')]['create'](_0x2a3623[_0xbe14('0x41')],{})[_0xbe14('0x20')](respondWithResult(_0x238c60,0xc9))['catch'](handleError(_0x238c60,null));};exports[_0xbe14('0x1f')]=function(_0x2a35e5,_0x2d6ee8){if(_0x2a35e5[_0xbe14('0x41')]['id']){delete _0x2a35e5['body']['id'];}return db['FaxApplication'][_0xbe14('0x3f')]({'where':{'id':_0x2a35e5[_0xbe14('0x42')]['id']}})['then'](handleEntityNotFound(_0x2d6ee8,null))['then'](saveUpdates(_0x2a35e5[_0xbe14('0x41')],null))[_0xbe14('0x20')](respondWithResult(_0x2d6ee8,null))[_0xbe14('0x3e')](handleError(_0x2d6ee8,null));};exports[_0xbe14('0x43')]=function(_0xdbc6e1,_0xd04fd5){return db[_0xbe14('0x25')]['find']({'where':{'id':_0xdbc6e1[_0xbe14('0x42')]['id']}})[_0xbe14('0x20')](handleEntityNotFound(_0xd04fd5,null))[_0xbe14('0x20')](removeEntity(_0xd04fd5,null))[_0xbe14('0x3e')](handleError(_0xd04fd5,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index dda7a9a..3d2ac03 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 _0xe743=['fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','define','FaxApplication'];(function(_0x4c4d07,_0x48512b){var _0x278851=function(_0x507727){while(--_0x507727){_0x4c4d07['push'](_0x4c4d07['shift']());}};_0x278851(++_0x48512b);}(_0xe743,0x137));var _0x3e74=function(_0x114322,_0x4ea7e6){_0x114322=_0x114322-0x0;var _0x3b8fc1=_0xe743[_0x114322];return _0x3b8fc1;};'use strict';var _=require(_0x3e74('0x0'));var util=require(_0x3e74('0x1'));var logger=require(_0x3e74('0x2'))('api');var moment=require(_0x3e74('0x3'));var BPromise=require(_0x3e74('0x4'));var rp=require(_0x3e74('0x5'));var fs=require('fs');var path=require(_0x3e74('0x6'));var rimraf=require(_0x3e74('0x7'));var config=require('../../config/environment');var attributes=require('./faxApplication.attributes');module[_0x3e74('0x8')]=function(_0x56cda3,_0x2c796c){return _0x56cda3[_0x3e74('0x9')](_0x3e74('0xa'),attributes,{'tableName':_0x3e74('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3e74('0xc'),'collate':_0x3e74('0xd')});}; \ No newline at end of file +var _0xd5fb=['bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4_unicode_ci','../../config/logger','moment'];(function(_0x4393f1,_0x414f2f){var _0x35b28e=function(_0x2499b9){while(--_0x2499b9){_0x4393f1['push'](_0x4393f1['shift']());}};_0x35b28e(++_0x414f2f);}(_0xd5fb,0x1df));var _0xbd5f=function(_0x26742c,_0xe241ee){_0x26742c=_0x26742c-0x0;var _0x4d9df4=_0xd5fb[_0x26742c];return _0x4d9df4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbd5f('0x0'))('api');var moment=require(_0xbd5f('0x1'));var BPromise=require(_0xbd5f('0x2'));var rp=require(_0xbd5f('0x3'));var fs=require('fs');var path=require(_0xbd5f('0x4'));var rimraf=require(_0xbd5f('0x5'));var config=require(_0xbd5f('0x6'));var attributes=require(_0xbd5f('0x7'));module[_0xbd5f('0x8')]=function(_0x1b885e,_0x24f622){return _0x1b885e[_0xbd5f('0x9')](_0xbd5f('0xa'),attributes,{'tableName':_0xbd5f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xbd5f('0xc')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 89beb22..e8641d2 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 _0x4372=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../config/logger'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x4372,0x17a));var _0x2437=function(_0xe13e13,_0x402131){_0xe13e13=_0xe13e13-0x0;var _0x3b3d61=_0x4372[_0xe13e13];return _0x3b3d61;};'use strict';var _=require(_0x2437('0x0'));var util=require('util');var moment=require(_0x2437('0x1'));var BPromise=require(_0x2437('0x2'));var rs=require(_0x2437('0x3'));var fs=require('fs');var Redis=require(_0x2437('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2437('0x5'))(_0x2437('0x6'));var config=require(_0x2437('0x7'));var jayson=require(_0x2437('0x8'));var client=jayson[_0x2437('0x9')][_0x2437('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ba888,_0x34f559,_0x5a4e57){return new BPromise(function(_0x57bfe1,_0x1d44d8){return client[_0x2437('0xb')](_0x4ba888,_0x5a4e57)[_0x2437('0xc')](function(_0x39ac05){logger[_0x2437('0xd')](_0x2437('0xe'),_0x34f559,_0x2437('0xf'));logger[_0x2437('0x10')](_0x2437('0x11'),_0x34f559,_0x2437('0xf'),JSON[_0x2437('0x12')](_0x39ac05));if(_0x39ac05[_0x2437('0x13')]){if(_0x39ac05[_0x2437('0x13')][_0x2437('0x14')]===0x1f4){logger['error'](_0x2437('0xe'),_0x34f559,_0x39ac05[_0x2437('0x13')][_0x2437('0x15')]);return _0x1d44d8(_0x39ac05[_0x2437('0x13')][_0x2437('0x15')]);}logger[_0x2437('0x13')](_0x2437('0xe'),_0x34f559,_0x39ac05[_0x2437('0x13')][_0x2437('0x15')]);return _0x57bfe1(_0x39ac05[_0x2437('0x13')][_0x2437('0x15')]);}else{logger[_0x2437('0xd')]('FaxApplication,\x20%s,\x20%s',_0x34f559,'request\x20sent');_0x57bfe1(_0x39ac05[_0x2437('0x16')][_0x2437('0x15')]);}})[_0x2437('0x17')](function(_0x29c5a6){logger[_0x2437('0x13')](_0x2437('0xe'),_0x34f559,_0x29c5a6);_0x1d44d8(_0x29c5a6);});});}exports[_0x2437('0x18')]=function(_0x49d22b){var _0x366146=this;return new Promise(function(_0x22b8b2,_0x888222){return db[_0x2437('0x19')][_0x2437('0x1a')](_0x49d22b[_0x2437('0x1b')],{'raw':_0x49d22b[_0x2437('0x1c')]?_0x49d22b[_0x2437('0x1c')][_0x2437('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49d22b[_0x2437('0x1c')]?_0x49d22b[_0x2437('0x1c')]['where']||null:null,'attributes':_0x49d22b[_0x2437('0x1c')]?_0x49d22b[_0x2437('0x1c')][_0x2437('0x1e')]||null:null,'limit':_0x49d22b[_0x2437('0x1c')]?_0x49d22b[_0x2437('0x1c')][_0x2437('0x1f')]||null:null})[_0x2437('0xc')](function(_0x5c3b36){logger[_0x2437('0xd')]('UpdateFaxApplication',_0x49d22b);logger[_0x2437('0x10')]('UpdateFaxApplication',_0x49d22b,JSON[_0x2437('0x12')](_0x5c3b36));_0x22b8b2(_0x5c3b36);})[_0x2437('0x17')](function(_0x2938fe){logger[_0x2437('0x13')](_0x2437('0x18'),_0x2938fe[_0x2437('0x15')],_0x49d22b);_0x888222(_0x366146['error'](0x1f4,_0x2938fe[_0x2437('0x15')]));});});}; \ No newline at end of file +var _0xff63=['UpdateFaxApplication','FaxApplication','update','body','options','limit','catch','util','moment','bluebird','../../config/logger','rpc','jayson/promise','request','then','info','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent'];(function(_0x73caba,_0x42f145){var _0x134e0d=function(_0x33bf94){while(--_0x33bf94){_0x73caba['push'](_0x73caba['shift']());}};_0x134e0d(++_0x42f145);}(_0xff63,0x1ea));var _0x3ff6=function(_0x36c18e,_0x6c19ab){_0x36c18e=_0x36c18e-0x0;var _0xad4d44=_0xff63[_0x36c18e];return _0xad4d44;};'use strict';var _=require('lodash');var util=require(_0x3ff6('0x0'));var moment=require(_0x3ff6('0x1'));var BPromise=require(_0x3ff6('0x2'));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(_0x3ff6('0x3'))(_0x3ff6('0x4'));var config=require('../../config/environment');var jayson=require(_0x3ff6('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x25bc94,_0x1f4e2e,_0x11cb38){return new BPromise(function(_0x487c4c,_0x15c551){return client[_0x3ff6('0x6')](_0x25bc94,_0x11cb38)[_0x3ff6('0x7')](function(_0x3a9d3b){logger[_0x3ff6('0x8')](_0x3ff6('0x9'),_0x1f4e2e,'request\x20sent');logger[_0x3ff6('0xa')](_0x3ff6('0xb'),_0x1f4e2e,'request\x20sent',JSON[_0x3ff6('0xc')](_0x3a9d3b));if(_0x3a9d3b[_0x3ff6('0xd')]){if(_0x3a9d3b[_0x3ff6('0xd')]['code']===0x1f4){logger[_0x3ff6('0xd')](_0x3ff6('0x9'),_0x1f4e2e,_0x3a9d3b[_0x3ff6('0xd')]['message']);return _0x15c551(_0x3a9d3b['error'][_0x3ff6('0xe')]);}logger[_0x3ff6('0xd')]('FaxApplication,\x20%s,\x20%s',_0x1f4e2e,_0x3a9d3b[_0x3ff6('0xd')][_0x3ff6('0xe')]);return _0x487c4c(_0x3a9d3b[_0x3ff6('0xd')][_0x3ff6('0xe')]);}else{logger[_0x3ff6('0x8')](_0x3ff6('0x9'),_0x1f4e2e,_0x3ff6('0xf'));_0x487c4c(_0x3a9d3b['result']['message']);}})['catch'](function(_0x59384b){logger[_0x3ff6('0xd')](_0x3ff6('0x9'),_0x1f4e2e,_0x59384b);_0x15c551(_0x59384b);});});}exports[_0x3ff6('0x10')]=function(_0x393583){var _0x542da8=this;return new Promise(function(_0x2307c8,_0x20e362){return db[_0x3ff6('0x11')][_0x3ff6('0x12')](_0x393583[_0x3ff6('0x13')],{'raw':_0x393583[_0x3ff6('0x14')]?_0x393583[_0x3ff6('0x14')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x393583[_0x3ff6('0x14')]?_0x393583[_0x3ff6('0x14')]['where']||null:null,'attributes':_0x393583['options']?_0x393583['options']['attributes']||null:null,'limit':_0x393583[_0x3ff6('0x14')]?_0x393583[_0x3ff6('0x14')][_0x3ff6('0x15')]||null:null})['then'](function(_0x217237){logger['info'](_0x3ff6('0x10'),_0x393583);logger[_0x3ff6('0xa')](_0x3ff6('0x10'),_0x393583,JSON[_0x3ff6('0xc')](_0x217237));_0x2307c8(_0x217237);})[_0x3ff6('0x16')](function(_0x8bebc1){logger['error'](_0x3ff6('0x10'),_0x8bebc1[_0x3ff6('0xe')],_0x393583);_0x20e362(_0x542da8['error'](0x1f4,_0x8bebc1[_0x3ff6('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 890dcb6..7a01ff4 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 _0x9c5a=['isAuthenticated','get','/:id','post','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxApplication.controller'];(function(_0x333767,_0x3e6f9c){var _0x51661b=function(_0x46e5d6){while(--_0x46e5d6){_0x333767['push'](_0x333767['shift']());}};_0x51661b(++_0x3e6f9c);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x1e1cb3,_0x67a267){_0x1e1cb3=_0x1e1cb3-0x0;var _0x53537a=_0x9c5a[_0x1e1cb3];return _0x53537a;};'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['show']);router[_0xa9c5('0xb')]('/',auth[_0xa9c5('0x8')](),controller['create']);router[_0xa9c5('0xc')](_0xa9c5('0xa'),auth['isAuthenticated'](),controller[_0xa9c5('0xd')]);router[_0xa9c5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xa9c5('0xf')]);module[_0xa9c5('0x10')]=router; \ No newline at end of file +var _0x5496=['util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./faxApplication.controller','get','/:id','show','post','isAuthenticated','put','update','delete','exports','multer'];(function(_0x66983a,_0x271b99){var _0x154058=function(_0x3618fc){while(--_0x3618fc){_0x66983a['push'](_0x66983a['shift']());}};_0x154058(++_0x271b99);}(_0x5496,0x175));var _0x6549=function(_0x235eca,_0x50f5ec){_0x235eca=_0x235eca-0x0;var _0x1c9302=_0x5496[_0x235eca];return _0x1c9302;};'use strict';var multer=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var path=require(_0x6549('0x2'));var timeout=require(_0x6549('0x3'));var express=require(_0x6549('0x4'));var router=express['Router']();var auth=require(_0x6549('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6549('0x6'));var controller=require(_0x6549('0x7'));router[_0x6549('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6549('0x8')](_0x6549('0x9'),auth['isAuthenticated'](),controller[_0x6549('0xa')]);router[_0x6549('0xb')]('/',auth[_0x6549('0xc')](),controller['create']);router[_0x6549('0xd')](_0x6549('0x9'),auth[_0x6549('0xc')](),controller[_0x6549('0xe')]);router[_0x6549('0xf')](_0x6549('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x6549('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 1e839e3..b84ed41 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 _0xb011=['sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x347334,_0x170cb5){var _0x5e4769=function(_0xd92fd5){while(--_0xd92fd5){_0x347334['push'](_0x347334['shift']());}};_0x5e4769(++_0x170cb5);}(_0xb011,0xb4));var _0x1b01=function(_0x5a9f38,_0x24856e){_0x5a9f38=_0x5a9f38-0x0;var _0x2bbde4=_0xb011[_0x5a9f38];return _0x2bbde4;};'use strict';var Sequelize=require(_0x1b01('0x0'));module[_0x1b01('0x1')]={'closed':{'type':Sequelize[_0x1b01('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1b01('0x3')]},'disposition':{'type':Sequelize[_0x1b01('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x1b01('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x1b01('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1b01('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x1b01('0x5')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x8017=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x3d27a,_0x31311d){var _0x314fd7=function(_0x20ac55){while(--_0x20ac55){_0x3d27a['push'](_0x3d27a['shift']());}};_0x314fd7(++_0x31311d);}(_0x8017,0x148));var _0x7801=function(_0xe45118,_0x5dffbc){_0xe45118=_0xe45118-0x0;var _0x15e15d=_0x8017[_0xe45118];return _0x15e15d;};'use strict';var Sequelize=require(_0x7801('0x0'));module[_0x7801('0x1')]={'closed':{'type':Sequelize[_0x7801('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7801('0x3')]},'disposition':{'type':Sequelize[_0x7801('0x4')]},'note':{'type':Sequelize[_0x7801('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x7801('0x5')]('in',_0x7801('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7801('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x7801('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 5131efa..e980289 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 _0x6ea9=['nolimit','limit','order','sort','where','pick','select','field','color','u.fullname','from','user_has_fax_interactions','left_join','users','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','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','Contact','operator','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.fax\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','DESC','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','i.FaxAccountId\x20IS\x20NULL','sequelize','keyBy','merge','fields','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','i.*','c.firstName','c.email','Contact.email','c.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.FaxInteractionId\x20IN\x20?','FaxInteractionId','rows','show','params','includeAll','include','options','create','destroy','describe','addMessage','FaxMessage','ids','getMessages','findOne','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','omit','emit','faxInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','transcript-%d-%s.zip','Attachment','Messages','createdAt','mkdirSync','basename','pipe','createWriteStream','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','register','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','error','name','send','Users','map','fullname','TagIds','Tags','split','push','catch','index','FaxInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty'];(function(_0x32a254,_0x14e1d0){var _0x799afb=function(_0x47e462){while(--_0x47e462){_0x32a254['push'](_0x32a254['shift']());}};_0x799afb(++_0x14e1d0);}(_0x6ea9,0x89));var _0x96ea=function(_0x4ecdb7,_0x5ef62a){_0x4ecdb7=_0x4ecdb7-0x0;var _0x1dae76=_0x6ea9[_0x4ecdb7];return _0x1dae76;};'use strict';var pdf=require(_0x96ea('0x0'));var emlformat=require(_0x96ea('0x1'));var rimraf=require(_0x96ea('0x2'));var zipdir=require(_0x96ea('0x3'));var jsonpatch=require(_0x96ea('0x4'));var rp=require('request-promise');var moment=require(_0x96ea('0x5'));var BPromise=require(_0x96ea('0x6'));var Mustache=require(_0x96ea('0x7'));var util=require('util');var path=require(_0x96ea('0x8'));var sox=require('sox');var csv=require(_0x96ea('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x96ea('0xa'));var squel=require('squel');var crypto=require(_0x96ea('0xb'));var jsforce=require(_0x96ea('0xc'));var deskjs=require(_0x96ea('0xd'));var toCsv=require(_0x96ea('0x9'));var querystring=require(_0x96ea('0xe'));var Papa=require(_0x96ea('0xf'));var Redis=require('ioredis');var authService=require(_0x96ea('0x10'));var qs=require(_0x96ea('0x11'));var as=require(_0x96ea('0x12'));var hardwareService=require(_0x96ea('0x13'));var logger=require(_0x96ea('0x14'))(_0x96ea('0x15'));var utils=require(_0x96ea('0x16'));var config=require(_0x96ea('0x17'));var db=require(_0x96ea('0x18'))['db'];config[_0x96ea('0x19')]=_['defaults'](config[_0x96ea('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x96ea('0x1a'))(new Redis(config[_0x96ea('0x19')]));require('./faxInteraction.socket')[_0x96ea('0x1b')](socket);function respondWithStatusCode(_0x1ce6e9,_0xc1059e){_0xc1059e=_0xc1059e||0xcc;return function(_0x328c5a){if(_0x328c5a){return _0x1ce6e9[_0x96ea('0x1c')](_0xc1059e);}return _0x1ce6e9[_0x96ea('0x1d')](_0xc1059e)[_0x96ea('0x1e')]();};}function respondWithResult(_0x237f2c,_0x4a847d){_0x4a847d=_0x4a847d||0xc8;return function(_0x3ce6ad){if(_0x3ce6ad){return _0x237f2c['status'](_0x4a847d)['json'](_0x3ce6ad);}};}function respondWithFilteredResult(_0xadf4fb,_0x3cb1e0){return function(_0x4d61aa){if(_0x4d61aa){var _0x47444c=_0x4d61aa[_0x96ea('0x1f')],_0x4476da=_0x3cb1e0[_0x96ea('0x20')],_0x24c940=_0x3cb1e0[_0x96ea('0x20')]+_0x3cb1e0['limit'],_0x3b7811;if(_0x24c940>=_0x47444c){_0x24c940=_0x47444c;_0x3b7811=0xc8;}else{_0x3b7811=0xce;}_0xadf4fb['status'](_0x3b7811);return _0xadf4fb[_0x96ea('0x21')](_0x96ea('0x22'),_0x4476da+'-'+_0x24c940+'/'+_0x47444c)[_0x96ea('0x23')](_0x4d61aa);}return null;};}function patchUpdates(_0x1e1bcd){return function(_0x26c4b5){try{jsonpatch[_0x96ea('0x24')](_0x26c4b5,_0x1e1bcd,!![]);}catch(_0x26df9b){return BPromise[_0x96ea('0x25')](_0x26df9b);}return _0x26c4b5[_0x96ea('0x26')]();};}function saveUpdates(_0x3a618c,_0x3a99f6){return function(_0x4a53a6){if(_0x4a53a6){return _0x4a53a6[_0x96ea('0x27')](_0x3a618c)[_0x96ea('0x28')](function(_0x3dc8bd){return _0x3dc8bd;});}return null;};}function removeEntity(_0x3634e7,_0x396117){return function(_0x1676e7){if(_0x1676e7){return _0x1676e7['destroy']()[_0x96ea('0x28')](function(){_0x3634e7['status'](0xcc)[_0x96ea('0x1e')]();});}};}function handleEntityNotFound(_0x29580d,_0x5e7734){return function(_0x592b4f){if(!_0x592b4f){_0x29580d[_0x96ea('0x1c')](0x194);}return _0x592b4f;};}function handleError(_0x105733,_0x15c3e6){_0x15c3e6=_0x15c3e6||0x1f4;return function(_0x21995c){logger[_0x96ea('0x29')](_0x21995c['stack']);if(_0x21995c[_0x96ea('0x2a')]){delete _0x21995c[_0x96ea('0x2a')];}_0x105733[_0x96ea('0x1d')](_0x15c3e6)[_0x96ea('0x2b')](_0x21995c);};}function getInteractionUsers(_0x2aa9e9,_0x1b5ca7){return new BPromise(function(_0x45cca7,_0x13d1c5){try{if(_0x1b5ca7[_0x2aa9e9['id']]){_0x2aa9e9[_0x96ea('0x2c')]=_[_0x96ea('0x2d')](_0x1b5ca7[_0x2aa9e9['id']],function(_0x2469ae){return{'id':_0x2469ae['id'],'fullname':_0x2469ae[_0x96ea('0x2e')]};});}}catch(_0x91a2a2){_0x13d1c5(_0x91a2a2);}_0x45cca7(_0x2aa9e9);});}function getInteractionTags(_0x30ec3f,_0x1c6f08){return new BPromise(function(_0x5a73a2,_0x114450){try{if(_0x30ec3f[_0x96ea('0x2f')]){_0x30ec3f[_0x96ea('0x30')]=[];_0x30ec3f['TagIds'][_0x96ea('0x31')](',')['forEach'](function(_0x4be49e){_0x30ec3f[_0x96ea('0x30')][_0x96ea('0x32')](_0x1c6f08[_0x4be49e]);});}delete _0x30ec3f['TagIds'];}catch(_0x7fc185){_0x114450(_0x7fc185);}_0x5a73a2(_0x30ec3f);});}function updateFaxInteraction(_0x260b4c,_0xa73379,_0x1798fd){return new BPromise(function(_0xf5b90a,_0x2e020f){return getInteractionUsers(_0x260b4c,_0x1798fd)[_0x96ea('0x28')](function(_0x231ff1){return getInteractionTags(_0x231ff1,_0xa73379);})['then'](function(_0xbb61e5){_0xf5b90a(_0xbb61e5);})[_0x96ea('0x33')](function(_0x5c8361){_0x2e020f(_0x5c8361);});});}exports[_0x96ea('0x34')]=function(_0xbeb8d0,_0x334ba1){var _0x1ac94b={},_0x830686={},_0x3a1b61={'count':0x0,'rows':[]};var _0x17dbd0=_['map'](db[_0x96ea('0x35')][_0x96ea('0x36')],function(_0x327c85){return{'name':_0x327c85[_0x96ea('0x37')],'type':_0x327c85[_0x96ea('0x38')][_0x96ea('0x39')]};});_0x830686[_0x96ea('0x3a')]=_[_0x96ea('0x2d')](_0x17dbd0,_0x96ea('0x2a'));_0x830686[_0x96ea('0x3b')]=_[_0x96ea('0x3c')](_0xbeb8d0[_0x96ea('0x3b')]);_0x830686[_0x96ea('0x3d')]=_[_0x96ea('0x3e')](_0x830686[_0x96ea('0x3a')],_0x830686[_0x96ea('0x3b')]);_0x1ac94b[_0x96ea('0x3f')]=_[_0x96ea('0x3e')](_0x830686[_0x96ea('0x3a')],qs['fields'](_0xbeb8d0[_0x96ea('0x3b')]['fields']));_0x1ac94b[_0x96ea('0x3f')]=_0x1ac94b[_0x96ea('0x3f')][_0x96ea('0x40')]?_0x1ac94b[_0x96ea('0x3f')]:_0x830686[_0x96ea('0x3a')];if(!_0xbeb8d0['query'][_0x96ea('0x41')](_0x96ea('0x42'))){_0x1ac94b[_0x96ea('0x43')]=qs['limit'](_0xbeb8d0[_0x96ea('0x3b')]['limit']);_0x1ac94b[_0x96ea('0x20')]=qs['offset'](_0xbeb8d0['query'][_0x96ea('0x20')]);}_0x1ac94b[_0x96ea('0x44')]=qs[_0x96ea('0x45')](_0xbeb8d0[_0x96ea('0x3b')]['sort']);_0x1ac94b[_0x96ea('0x46')]=qs[_0x96ea('0x3d')](_[_0x96ea('0x47')](_0xbeb8d0[_0x96ea('0x3b')],_0x830686[_0x96ea('0x3d')]),_0x17dbd0);var _0x4b387a=[];var _0x5a346a=squel[_0x96ea('0x48')]()[_0x96ea('0x49')]('id')[_0x96ea('0x49')]('name')[_0x96ea('0x49')](_0x96ea('0x4a'))['from']('tools_tags');var _0x46ff36=squel[_0x96ea('0x48')]()['field']('u.id')[_0x96ea('0x49')](_0x96ea('0x4b'))[_0x96ea('0x49')]('ui.FaxInteractionId')[_0x96ea('0x4c')](_0x96ea('0x4d'),'ui')[_0x96ea('0x4e')](_0x96ea('0x4f'),'u','u.id\x20=\x20ui.UserId');var _0x149f62=squel[_0x96ea('0x48')]()[_0x96ea('0x4c')]('fax_interactions','i')[_0x96ea('0x4e')](_0x96ea('0x50'),'c',_0x96ea('0x51'))['left_join'](_0x96ea('0x4f'),'o',_0x96ea('0x52'))[_0x96ea('0x4e')](_0x96ea('0x53'),'a',_0x96ea('0x54'))[_0x96ea('0x4e')](_0x96ea('0x55'),'me','me.FaxInteractionId\x20=\x20i.id')['left_join'](_0x96ea('0x56'),'it',_0x96ea('0x57'))[_0x96ea('0x4e')](_0x96ea('0x58'),'t',_0x96ea('0x59'));var _0xf921c5=squel[_0x96ea('0x5a')]();var _0x5eb358=[];var _0x4d7c06=squel[_0x96ea('0x5a')]();var _0x131395;if(_0xbeb8d0[_0x96ea('0x3b')][_0x96ea('0x5b')]){_0x131395=as[_0x96ea('0x5c')](_0xbeb8d0[_0x96ea('0x3b')][_0x96ea('0x5b')]);var _0x4b83c4=_0x131395[_0x96ea('0x5d')];for(var _0x12f409=0x0;_0x12f409<_0x131395['conditions'][_0x96ea('0x40')];_0x12f409++){var _0x2f0a2a=_0x131395[_0x96ea('0x5e')][_0x12f409];var _0x516692='i';var _0x501f5b=_['find'](_0x17dbd0,[_0x96ea('0x2a'),_0x2f0a2a[_0x96ea('0x49')]]);if(!_0x501f5b){switch(_0x2f0a2a[_0x96ea('0x49')]){case _0x96ea('0x5f'):if(_0x2f0a2a[_0x96ea('0x60')]==0x1){_0x149f62[_0x96ea('0x61')]('`'+_0x2f0a2a['field']+_0x96ea('0x62'));}else{_0x149f62[_0x96ea('0x61')]('`'+_0x2f0a2a[_0x96ea('0x49')]+'`\x20>\x200');}break;case _0x96ea('0x63'):if(_0x2f0a2a[_0x96ea('0x64')]===_0x96ea('0x65')){if(_0x2f0a2a[_0x96ea('0x60')][_0x96ea('0x31')]('\x20')[_0x96ea('0x40')]>0x1){_0xf921c5[_0x4b83c4]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x2f0a2a['value']),null);}else{var _0x1e2ba5='%'+_0x2f0a2a['value']+'%';_0xf921c5[_0x4b83c4](_0x96ea('0x66'),_0x1e2ba5,_0x1e2ba5,_0x1e2ba5);}}else{_0x501f5b=_[_0x96ea('0x67')](_0x17dbd0,[_0x96ea('0x2a'),_0x96ea('0x68')]);_0x2f0a2a[_0x96ea('0x49')]='ContactId';_0x73a0f6=as[_0x96ea('0x69')](_0x516692,_0x501f5b['type'],_0x2f0a2a);_0xf921c5[_0x4b83c4](_0x73a0f6[_0x96ea('0x6a')],_0x73a0f6['value'][_0x96ea('0x6b')],_0x73a0f6[_0x96ea('0x60')][_0x96ea('0x1e')]);}break;case _0x96ea('0x6c'):var _0x33cb52=_0x2f0a2a[_0x96ea('0x60')]['split'](',')[_0x96ea('0x2d')](function(_0x2c2944){return Number(_0x2c2944);});_0x33cb52[_0x96ea('0x6d')](function(_0x31a532){_0x4d7c06['or'](_0x96ea('0x6e'),'%,'+_0x31a532+',%');});_0x5eb358=_[_0x96ea('0x6f')](_0x5eb358,_0x33cb52);break;case'User':if(_0x2f0a2a[_0x96ea('0x64')]===_0x96ea('0x65')){_0xf921c5[_0x4b83c4](_0x96ea('0x70'),'%'+_0x2f0a2a[_0x96ea('0x60')]+'%',null);}else{_0x501f5b=_['find'](_0x17dbd0,[_0x96ea('0x2a'),_0x96ea('0x71')]);_0x2f0a2a[_0x96ea('0x49')]=_0x96ea('0x71');_0x73a0f6=as[_0x96ea('0x69')](_0x516692,_0x501f5b[_0x96ea('0x38')],_0x2f0a2a);_0xf921c5[_0x4b83c4](_0x73a0f6[_0x96ea('0x6a')],_0x73a0f6[_0x96ea('0x60')]['start'],_0x73a0f6['value'][_0x96ea('0x1e')]);}break;case _0x96ea('0x72'):_0x73a0f6=as['buildExpression']('me',null,_0x2f0a2a);_0xf921c5[_0x4b83c4](_0x73a0f6[_0x96ea('0x6a')],_0x73a0f6[_0x96ea('0x60')][_0x96ea('0x6b')],_0x73a0f6[_0x96ea('0x60')]['end']);break;}}else{var _0x73a0f6=as[_0x96ea('0x69')](_0x516692,_0x501f5b['type'],_0x2f0a2a);_0xf921c5[_0x4b83c4](_0x73a0f6[_0x96ea('0x6a')],_0x73a0f6[_0x96ea('0x60')]['start'],_0x73a0f6[_0x96ea('0x60')]['end']);}}}else{var _0x8e9633=_(_0xbeb8d0[_0x96ea('0x3b')])[_0x96ea('0x3c')]()[_0x96ea('0x2d')](function(_0x12028b){return _[_0x96ea('0x73')](_0x17dbd0,[_0x96ea('0x2a'),_0x12028b])?_0x12028b:undefined;})[_0x96ea('0x74')]()[_0x96ea('0x60')]();if(!_[_0x96ea('0x75')](_0x8e9633)){_0x8e9633['forEach'](function(_0x2a8f91){if(_0x2a8f91===_0x96ea('0x76')){_0x149f62[_0x96ea('0x46')](_0x96ea('0x77'),[]['concat'](_0xbeb8d0['query'][_0x2a8f91]));}else if(_0x2a8f91==='createdAt'){var _0x34002e=JSON[_0x96ea('0x78')](_0xbeb8d0['query'][_0x2a8f91])[_0x96ea('0x79')];var _0x5bc708=JSON['parse'](_0xbeb8d0[_0x96ea('0x3b')][_0x2a8f91])[_0x96ea('0x7a')];_0x149f62[_0x96ea('0x46')](_0x96ea('0x7b'),_0x34002e,_0x5bc708);}else{if(_0xbeb8d0[_0x96ea('0x3b')][_0x2a8f91]===_0x96ea('0x7c')){_0x149f62[_0x96ea('0x46')]('i.'+_0x2a8f91+'\x20IS\x20NULL');}else{_0x149f62[_0x96ea('0x46')]('i.'+_0x2a8f91+_0x96ea('0x7d'),_0xbeb8d0[_0x96ea('0x3b')][_0x2a8f91]);}}});}if(_0xbeb8d0['query']['read']){if(_0xbeb8d0[_0x96ea('0x3b')][_0x96ea('0x7e')]==0x1){_0x149f62[_0x96ea('0x61')](_0x96ea('0x7f'));}else{_0x149f62[_0x96ea('0x61')](_0x96ea('0x80'));}}if(_0xbeb8d0[_0x96ea('0x3b')][_0x96ea('0x81')]){_0x5eb358=_[_0x96ea('0x82')](_0xbeb8d0['query'][_0x96ea('0x81')])?_0xbeb8d0[_0x96ea('0x3b')][_0x96ea('0x81')]:new Array(_0xbeb8d0['query'][_0x96ea('0x81')]);_0x5eb358['forEach'](function(_0x1ccf95){_0x4d7c06['or'](_0x96ea('0x6e'),'%,'+_0x1ccf95+',%');});}if(_0xbeb8d0[_0x96ea('0x3b')][_0x96ea('0x83')]){var _0x40370f=_0xbeb8d0[_0x96ea('0x3b')][_0x96ea('0x83')]['replace']('\x5c','\x5c\x5c')[_0x96ea('0x84')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0x96ea('0x85')](_0x40370f)){_0xf921c5['or']('i.id\x20LIKE\x20?',_0x40370f+'%')['or'](_0x96ea('0x86'),_0x40370f+'%');}_0xf921c5['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x40370f+'%');}}_0x149f62['where'](_0xf921c5);_0x149f62[_0x96ea('0x87')]('i.id');var _0x44e59e={'type':db[_0x96ea('0x88')][_0x96ea('0x89')][_0x96ea('0x8a')],'raw':!![]};var _0x2acd08=_0x149f62['clone']();_0x2acd08['field']('i.id');_0x2acd08['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x96ea('0x5f'));if(_0x1ac94b['order']){_0x1ac94b[_0x96ea('0x44')][_0x96ea('0x6d')](function(_0x3b2944){_0x149f62['order']('i.'+_0x3b2944[0x0],_0x3b2944[0x1]===_0x96ea('0x8b')?![]:!![]);});}if(!_[_0x96ea('0x75')](_0x5eb358)){_0x149f62[_0x96ea('0x61')](_0x4d7c06);_0x2acd08['where']('t.id\x20IN\x20?',_0x5eb358);}BPromise[_0x96ea('0x8c')]()[_0x96ea('0x28')](function(){if(!_0x131395){if(_0xbeb8d0[_0x96ea('0x3b')][_0x96ea('0x76')]||_0xbeb8d0[_0x96ea('0x3b')]['journey'])return;_0x2acd08[_0x96ea('0x46')](_0x96ea('0x8d'));_0x149f62['where'](_0x96ea('0x8d'));return;}return _0xbeb8d0['user']['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0x96ea('0x28')](function(_0x4f881c){if(_[_0x96ea('0x75')](_0x4f881c)){_0x2acd08[_0x96ea('0x46')](_0x96ea('0x8e'));_0x149f62[_0x96ea('0x46')](_0x96ea('0x8e'));}else{_0x2acd08[_0x96ea('0x46')](_0x96ea('0x77'),_[_0x96ea('0x2d')](_0x4f881c,'id'));_0x149f62[_0x96ea('0x46')]('i.FaxAccountId\x20IN\x20?',_[_0x96ea('0x2d')](_0x4f881c,'id'));}});})['then'](function(){db[_0x96ea('0x8f')][_0x96ea('0x3b')](_0x2acd08['toString'](),_0x44e59e)[_0x96ea('0x28')](function(_0x53ab95){_0x3a1b61[_0x96ea('0x1f')]=_0x53ab95[_0x96ea('0x40')];if(_0x3a1b61[_0x96ea('0x1f')]===0x0)return[];return db[_0x96ea('0x8f')][_0x96ea('0x3b')](_0x5a346a['toString'](),_0x44e59e)[_0x96ea('0x28')](function(_0x1a28f1){_0x4b387a=_[_0x96ea('0x90')](_0x1a28f1,'id');_0x44e59e=_[_0x96ea('0x91')](_0x44e59e,{'model':db[_0x96ea('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xbeb8d0[_0x96ea('0x3b')][_0x96ea('0x92')]){_0x1ac94b[_0x96ea('0x3f')][_0x96ea('0x6d')](function(_0x571b7c){_0x149f62[_0x96ea('0x49')]('i.'+_0x571b7c);});}else{_0x149f62[_0x96ea('0x49')](_0x96ea('0x93'),'unreadMessages');_0x149f62[_0x96ea('0x49')](_0x96ea('0x94'),_0x96ea('0x95'));_0x149f62[_0x96ea('0x49')](_0x96ea('0x96'),'Account.mandatoryDisposition');_0x149f62[_0x96ea('0x49')](_0x96ea('0x97'));_0x149f62['field'](_0x96ea('0x98'),'Contact.firstName');_0x149f62['field']('c.lastName','Contact.lastName');_0x149f62[_0x96ea('0x49')](_0x96ea('0x99'),_0x96ea('0x9a'));_0x149f62['field'](_0x96ea('0x9b'),'Contact.phone');_0x149f62['field'](_0x96ea('0x9c'),'Contact.mobile');_0x149f62[_0x96ea('0x49')](_0x96ea('0x9d'),_0x96ea('0x9e'));_0x149f62[_0x96ea('0x49')](_0x96ea('0x9f'),_0x96ea('0xa0'));_0x149f62[_0x96ea('0x49')](_0x96ea('0xa1'),_0x96ea('0xa2'));_0x149f62['field'](_0x96ea('0xa3'),_0x96ea('0x2f'));}if(_0x1ac94b['limit'])_0x149f62[_0x96ea('0x43')](_0x1ac94b['limit']);if(_0x1ac94b[_0x96ea('0x20')])_0x149f62[_0x96ea('0x20')](_0x1ac94b[_0x96ea('0x20')]);return db[_0x96ea('0x8f')][_0x96ea('0x3b')](_0x149f62[_0x96ea('0xa4')](),_0x44e59e);})['then'](function(_0x2da8b1){_0x46ff36[_0x96ea('0x46')](_0x96ea('0xa5'),_[_0x96ea('0x2d')](_0x2da8b1,'id'));return db[_0x96ea('0x8f')][_0x96ea('0x3b')](_0x46ff36[_0x96ea('0xa4')](),_0x44e59e)['then'](function(_0x175ad5){var _0x5931cd=_['groupBy'](_0x175ad5,_0x96ea('0xa6'));var _0x1d8453=[];_0x2da8b1[_0x96ea('0x6d')](function(_0x53833a){_0x1d8453[_0x96ea('0x32')](updateFaxInteraction(_0x53833a,_0x4b387a,_0x5931cd));});return BPromise['all'](_0x1d8453);});});})[_0x96ea('0x28')](function(_0x171e94){_0x3a1b61[_0x96ea('0xa7')]=_0x171e94;return _0x3a1b61;})[_0x96ea('0x28')](respondWithFilteredResult(_0x334ba1,_0x1ac94b));})[_0x96ea('0x33')](handleError(_0x334ba1,null));};exports[_0x96ea('0xa8')]=function(_0x9049e9,_0x13f92a){var _0x5ee8af={'raw':![],'where':{'id':_0x9049e9[_0x96ea('0xa9')]['id']}},_0x3b531c={};_0x3b531c[_0x96ea('0x3a')]=_['keys'](db['FaxInteraction'][_0x96ea('0x36')]);_0x3b531c[_0x96ea('0x3b')]=_['keys'](_0x9049e9[_0x96ea('0x3b')]);_0x3b531c[_0x96ea('0x3d')]=_[_0x96ea('0x3e')](_0x3b531c['model'],_0x3b531c[_0x96ea('0x3b')]);_0x5ee8af[_0x96ea('0x3f')]=_[_0x96ea('0x3e')](_0x3b531c[_0x96ea('0x3a')],qs[_0x96ea('0x92')](_0x9049e9[_0x96ea('0x3b')][_0x96ea('0x92')]));_0x5ee8af['attributes']=_0x5ee8af[_0x96ea('0x3f')][_0x96ea('0x40')]?_0x5ee8af[_0x96ea('0x3f')]:_0x3b531c[_0x96ea('0x3a')];if(_0x9049e9[_0x96ea('0x3b')][_0x96ea('0xaa')]){_0x5ee8af[_0x96ea('0xab')]=[{'all':!![]}];}_0x5ee8af=_[_0x96ea('0x91')]({},_0x5ee8af,_0x9049e9[_0x96ea('0xac')]);return db[_0x96ea('0x35')][_0x96ea('0x67')](_0x5ee8af)['then'](handleEntityNotFound(_0x13f92a,null))[_0x96ea('0x28')](respondWithResult(_0x13f92a,null))['catch'](handleError(_0x13f92a,null));};exports['create']=function(_0x25beee,_0x516b54){return db[_0x96ea('0x35')][_0x96ea('0xad')](_0x25beee[_0x96ea('0x72')],{})[_0x96ea('0x28')](respondWithResult(_0x516b54,0xc9))[_0x96ea('0x33')](handleError(_0x516b54,null));};exports['update']=function(_0x342a92,_0x3c132b){if(_0x342a92[_0x96ea('0x72')]['id']){delete _0x342a92[_0x96ea('0x72')]['id'];}return db[_0x96ea('0x35')][_0x96ea('0x67')]({'where':{'id':_0x342a92[_0x96ea('0xa9')]['id']}})[_0x96ea('0x28')](handleEntityNotFound(_0x3c132b,null))['then'](saveUpdates(_0x342a92[_0x96ea('0x72')],null))[_0x96ea('0x28')](respondWithResult(_0x3c132b,null))[_0x96ea('0x33')](handleError(_0x3c132b,null));};exports[_0x96ea('0xae')]=function(_0x5bf426,_0x23cde4){return db[_0x96ea('0x35')][_0x96ea('0x67')]({'where':{'id':_0x5bf426['params']['id']}})[_0x96ea('0x28')](handleEntityNotFound(_0x23cde4,null))[_0x96ea('0x28')](removeEntity(_0x23cde4,null))[_0x96ea('0x33')](handleError(_0x23cde4,null));};exports[_0x96ea('0xaf')]=function(_0x38f42d,_0x5ecf7f){return db[_0x96ea('0x35')][_0x96ea('0xaf')]()['then'](respondWithResult(_0x5ecf7f,null))[_0x96ea('0x33')](handleError(_0x5ecf7f,null));};exports[_0x96ea('0xb0')]=function(_0x5ef086,_0x370cbe,_0x1e4586){return db[_0x96ea('0xb1')][_0x96ea('0x67')]({'where':{'id':_0x5ef086['params']['id']}})[_0x96ea('0x28')](handleEntityNotFound(_0x370cbe,null))[_0x96ea('0x28')](function(_0x34b07e){if(_0x34b07e){return _0x34b07e[_0x96ea('0xb0')](_0x5ef086[_0x96ea('0x72')][_0x96ea('0xb2')],_['omit'](_0x5ef086[_0x96ea('0x72')],['ids','id'])||{});}})['then'](respondWithResult(_0x370cbe,null))[_0x96ea('0x33')](handleError(_0x370cbe,null));};exports[_0x96ea('0xb3')]=function(_0x76dab4,_0xd20963,_0x56b8f1){var _0x48ca92={'raw':![],'where':{}};var _0x263425={};var _0x3126ce={'count':0x0,'rows':[]};return db[_0x96ea('0x35')][_0x96ea('0xb4')]({'where':{'id':_0x76dab4['params']['id']}})[_0x96ea('0x28')](handleEntityNotFound(_0xd20963,null))[_0x96ea('0x28')](function(_0x4669f1){if(_0x4669f1){_0x263425[_0x96ea('0x3a')]=_[_0x96ea('0x3c')](db[_0x96ea('0xb1')][_0x96ea('0x36')]);_0x263425['query']=_['keys'](_0x76dab4['query']);_0x263425['filters']=_[_0x96ea('0x3e')](_0x263425['model'],_0x263425['query']);_0x48ca92[_0x96ea('0x3f')]=_[_0x96ea('0x3e')](_0x263425[_0x96ea('0x3a')],qs[_0x96ea('0x92')](_0x76dab4['query'][_0x96ea('0x92')]));_0x48ca92[_0x96ea('0x3f')]=_0x48ca92[_0x96ea('0x3f')][_0x96ea('0x40')]?_0x48ca92[_0x96ea('0x3f')]:_0x263425['model'];if(!_0x76dab4[_0x96ea('0x3b')][_0x96ea('0x41')]('nolimit')){_0x48ca92[_0x96ea('0x43')]=qs[_0x96ea('0x43')](_0x76dab4['query']['limit']);_0x48ca92[_0x96ea('0x20')]=qs[_0x96ea('0x20')](_0x76dab4[_0x96ea('0x3b')][_0x96ea('0x20')]);}_0x48ca92[_0x96ea('0x44')]=qs[_0x96ea('0x45')](_0x76dab4[_0x96ea('0x3b')][_0x96ea('0x45')]);_0x48ca92[_0x96ea('0x46')]=qs[_0x96ea('0x3d')](_[_0x96ea('0x47')](_0x76dab4[_0x96ea('0x3b')],_0x263425[_0x96ea('0x3d')]));_0x48ca92[_0x96ea('0x46')]['FaxInteractionId']=_0x4669f1['id'];if(_0x76dab4['query'][_0x96ea('0x83')]){_0x48ca92[_0x96ea('0x46')]=_[_0x96ea('0x91')](_0x48ca92[_0x96ea('0x46')],{'$or':_['map'](_0x48ca92[_0x96ea('0x3f')],function(_0x4bdc56){var _0x80c333={};_0x80c333[_0x4bdc56]={'$like':'%'+_0x76dab4[_0x96ea('0x3b')][_0x96ea('0x83')]+'%'};return _0x80c333;})});}if(_0x76dab4[_0x96ea('0x3b')]['$gte']){var _0x50aee6=_0x76dab4[_0x96ea('0x3b')][_0x96ea('0x79')][_0x96ea('0x31')](',');var _0x435671={};_0x435671[_0x50aee6[0x0]]={'$gte':moment(_0x50aee6[0x1])['format'](_0x96ea('0xb5'))};_0x48ca92['where']=_[_0x96ea('0x91')](_0x48ca92[_0x96ea('0x46')],_0x435671);}_0x48ca92=_[_0x96ea('0x91')]({},_0x48ca92,_0x76dab4[_0x96ea('0xac')]);return db[_0x96ea('0xb1')][_0x96ea('0x1f')]({'where':_0x48ca92['where']})[_0x96ea('0x28')](function(_0x52c3b4){_0x3126ce[_0x96ea('0x1f')]=_0x52c3b4;if(_0x76dab4[_0x96ea('0x3b')][_0x96ea('0xaa')]){_0x48ca92[_0x96ea('0xab')]=[{'all':!![]}];}return db[_0x96ea('0xb1')][_0x96ea('0xb6')](_0x48ca92);})[_0x96ea('0x28')](function(_0x535d9c){_0x3126ce[_0x96ea('0xa7')]=_0x535d9c;return _0x3126ce;});}})[_0x96ea('0x28')](respondWithFilteredResult(_0xd20963,_0x48ca92))[_0x96ea('0x33')](handleError(_0xd20963,null));};exports[_0x96ea('0xb7')]=function(_0x12b37d,_0x2260f0,_0x15dd44){return db[_0x96ea('0x35')]['find']({'where':{'id':_0x12b37d['params']['id']}})[_0x96ea('0x28')](handleEntityNotFound(_0x2260f0,null))[_0x96ea('0x28')](function(_0x1c2c0c){if(_0x1c2c0c){return _0x1c2c0c['setTags'](_0x12b37d[_0x96ea('0x72')][_0x96ea('0xb2')],_[_0x96ea('0xb8')](_0x12b37d[_0x96ea('0x72')],['ids','id'])||{})['spread'](function(){return db[_0x96ea('0x6c')][_0x96ea('0xb6')]({'attributes':['id',_0x96ea('0x2a'),_0x96ea('0x4a')],'where':{'id':_0x12b37d[_0x96ea('0x72')][_0x96ea('0xb2')]}});})['then'](function(_0x18468f){socket[_0x96ea('0xb9')](_0x96ea('0xba'),{'id':Number(_0x12b37d[_0x96ea('0xa9')]['id']),'tags':_0x18468f||[]});return{'id':Number(_0x12b37d[_0x96ea('0xa9')]['id']),'tags':_0x18468f||[]};});}})[_0x96ea('0x28')](respondWithResult(_0x2260f0,null))[_0x96ea('0x33')](handleError(_0x2260f0,null));};exports['removeTags']=function(_0x4cc346,_0x3adc27,_0x1e3071){return db[_0x96ea('0x35')][_0x96ea('0x67')]({'where':{'id':_0x4cc346[_0x96ea('0xa9')]['id']}})[_0x96ea('0x28')](handleEntityNotFound(_0x3adc27,null))[_0x96ea('0x28')](function(_0x33410f){if(_0x33410f){return _0x33410f[_0x96ea('0xbb')](_0x4cc346['query']['ids']);}})[_0x96ea('0x28')](respondWithStatusCode(_0x3adc27,null))[_0x96ea('0x33')](handleError(_0x3adc27,null));};exports[_0x96ea('0xbc')]=function(_0x3a9838,_0x3ff477){var _0x438a96=moment()[_0x96ea('0xbd')]()[_0x96ea('0xa4')]();var _0x26e153=path['join'](config[_0x96ea('0xbe')],_0x96ea('0xbf'),_0x96ea('0xc0'),_0x96ea('0xc1'));var _0x4bd69e=path['join'](config['root'],_0x96ea('0xbf'),'files','attachments');var _0x33896e=path[_0x96ea('0xc2')](_0x26e153,_0x438a96);var _0x491e22=util['format'](_0x96ea('0xc3'),_0x3a9838[_0x96ea('0xa9')]['id'],_0x438a96);var _0x3a2a31=path[_0x96ea('0xc2')](_0x26e153,_0x491e22);var _0x1e5ee8=[];_0x1e5ee8['push']({'model':db[_0x96ea('0xc4')],'as':_0x96ea('0xc4'),'raw':!![]});var _0xc9fe8c=[{'model':db['FaxMessage'],'as':_0x96ea('0xc5'),'attributes':['id',_0x96ea('0x72'),_0x96ea('0xc6')],'include':_0x1e5ee8}];return db[_0x96ea('0x35')][_0x96ea('0x67')]({'where':{'id':_0x3a9838[_0x96ea('0xa9')]['id']},'include':_0xc9fe8c})[_0x96ea('0x28')](handleEntityNotFound(_0x3ff477,null))[_0x96ea('0x28')](function(_0x2a1257){if(_0x2a1257&&_0x2a1257['Messages']){var _0x3fca2f=_0x2a1257['get']({'plain':!![]});fs[_0x96ea('0xc7')](_0x33896e);for(var _0xa101d0=0x0;_0xa101d0<_0x3fca2f[_0x96ea('0xc5')][_0x96ea('0x40')];_0xa101d0++){var _0x11638b=_0x3fca2f[_0x96ea('0xc5')][_0xa101d0][_0x96ea('0xc4')];if(_0x11638b){var _0x446c93=path[_0x96ea('0xc2')](_0x4bd69e,_0x11638b[_0x96ea('0xc8')]);if(fs['existsSync'](_0x446c93)){fs['createReadStream'](_0x446c93)[_0x96ea('0xc9')](fs[_0x96ea('0xca')](path[_0x96ea('0xc2')](_0x33896e,_0x11638b[_0x96ea('0xc8')])));}}}return BPromise['resolve']()[_0x96ea('0x28')](function(){return new BPromise(function(_0x24810d,_0x4ce75d){zipdir(_0x33896e,{'saveTo':_0x3a2a31},function(_0x563c9a,_0x4ff8d3){if(_0x563c9a)return _0x4ce75d(_0x563c9a);return _0x24810d(_0x4ff8d3);});})[_0x96ea('0x28')](function(){return new BPromise(function(_0x2f801f,_0x3c526b){rimraf(_0x33896e,function(_0x6589cd){if(_0x6589cd)_0x3c526b(_0x6589cd);return _0x2f801f();});});})['then'](function(){return _0x3ff477['download'](_0x3a2a31,_0x491e22,function(_0x24f88d){if(_0x24f88d){console['log']('err',_0x24f88d);}else{fs['unlinkSync'](_0x3a2a31);}});});});}else{return _0x3ff477[_0x96ea('0x1c')](0xc8);}})[_0x96ea('0x33')](handleError(_0x3ff477,null));}; \ No newline at end of file +var _0x19e1=['type','key','model','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','select','field','from','tools_tags','u.id','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','having','`\x20>\x200','Contact','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','start','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','filter','replace','\x27\x27\x27\x27','isNumeric','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','resolve','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','unreadMessages','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','show','includeAll','merge','options','create','update','params','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','format','YYYY-MM-DD\x20HH:mm:ss','include','spread','color','emit','faxInteractionTags:save','removeTags','download','join','root','server','files','tmp','transcript-%d-%s.zip','Attachment','Messages','get','basename','existsSync','createReadStream','log','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','count','offset','limit','set','json','apply','save','then','error','name','send','Users','map','fullname','TagIds','Tags','push','catch','index','FaxInteraction','rawAttributes'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x19e1,0x163));var _0x119e=function(_0x1c6089,_0x3816e2){_0x1c6089=_0x1c6089-0x0;var _0x4d97c1=_0x19e1[_0x1c6089];return _0x4d97c1;};'use strict';var pdf=require(_0x119e('0x0'));var emlformat=require(_0x119e('0x1'));var rimraf=require(_0x119e('0x2'));var zipdir=require(_0x119e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x119e('0x4'));var BPromise=require(_0x119e('0x5'));var Mustache=require('mustache');var util=require(_0x119e('0x6'));var path=require(_0x119e('0x7'));var sox=require('sox');var csv=require(_0x119e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x119e('0x9'));var squel=require(_0x119e('0xa'));var crypto=require(_0x119e('0xb'));var jsforce=require(_0x119e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x119e('0x8'));var querystring=require(_0x119e('0xd'));var Papa=require(_0x119e('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x119e('0xf'));var as=require(_0x119e('0x10'));var hardwareService=require(_0x119e('0x11'));var logger=require(_0x119e('0x12'))(_0x119e('0x13'));var utils=require(_0x119e('0x14'));var config=require(_0x119e('0x15'));var db=require('../../mysqldb')['db'];config[_0x119e('0x16')]=_[_0x119e('0x17')](config[_0x119e('0x16')],{'host':_0x119e('0x18'),'port':0x18eb});var socket=require(_0x119e('0x19'))(new Redis(config[_0x119e('0x16')]));require('./faxInteraction.socket')[_0x119e('0x1a')](socket);function respondWithStatusCode(_0x8a9fad,_0x1c6fd5){_0x1c6fd5=_0x1c6fd5||0xcc;return function(_0x881816){if(_0x881816){return _0x8a9fad[_0x119e('0x1b')](_0x1c6fd5);}return _0x8a9fad[_0x119e('0x1c')](_0x1c6fd5)[_0x119e('0x1d')]();};}function respondWithResult(_0x791000,_0x2c5902){_0x2c5902=_0x2c5902||0xc8;return function(_0x42acfd){if(_0x42acfd){return _0x791000[_0x119e('0x1c')](_0x2c5902)['json'](_0x42acfd);}};}function respondWithFilteredResult(_0x1820ff,_0x393759){return function(_0x3d5260){if(_0x3d5260){var _0xb3375c=_0x3d5260[_0x119e('0x1e')],_0x348ae3=_0x393759[_0x119e('0x1f')],_0xedc945=_0x393759[_0x119e('0x1f')]+_0x393759[_0x119e('0x20')],_0x2848fa;if(_0xedc945>=_0xb3375c){_0xedc945=_0xb3375c;_0x2848fa=0xc8;}else{_0x2848fa=0xce;}_0x1820ff['status'](_0x2848fa);return _0x1820ff[_0x119e('0x21')]('Content-Range',_0x348ae3+'-'+_0xedc945+'/'+_0xb3375c)[_0x119e('0x22')](_0x3d5260);}return null;};}function patchUpdates(_0x523a8d){return function(_0x3cb1bb){try{jsonpatch[_0x119e('0x23')](_0x3cb1bb,_0x523a8d,!![]);}catch(_0x5b7ba0){return BPromise['reject'](_0x5b7ba0);}return _0x3cb1bb[_0x119e('0x24')]();};}function saveUpdates(_0x29de19,_0x37b07e){return function(_0x5b11ca){if(_0x5b11ca){return _0x5b11ca['update'](_0x29de19)[_0x119e('0x25')](function(_0x52d69b){return _0x52d69b;});}return null;};}function removeEntity(_0x1a8a24,_0x21fb19){return function(_0x198f7b){if(_0x198f7b){return _0x198f7b['destroy']()[_0x119e('0x25')](function(){_0x1a8a24['status'](0xcc)[_0x119e('0x1d')]();});}};}function handleEntityNotFound(_0x5398e6,_0x5c57a2){return function(_0xdc170f){if(!_0xdc170f){_0x5398e6[_0x119e('0x1b')](0x194);}return _0xdc170f;};}function handleError(_0x1a7dea,_0x2770ac){_0x2770ac=_0x2770ac||0x1f4;return function(_0x476f0){logger[_0x119e('0x26')](_0x476f0['stack']);if(_0x476f0[_0x119e('0x27')]){delete _0x476f0[_0x119e('0x27')];}_0x1a7dea['status'](_0x2770ac)[_0x119e('0x28')](_0x476f0);};}function getInteractionUsers(_0x1ca670,_0x49b965){return new BPromise(function(_0x18f2d4,_0x513843){try{if(_0x49b965[_0x1ca670['id']]){_0x1ca670[_0x119e('0x29')]=_[_0x119e('0x2a')](_0x49b965[_0x1ca670['id']],function(_0x4211fb){return{'id':_0x4211fb['id'],'fullname':_0x4211fb[_0x119e('0x2b')]};});}}catch(_0x3df7e9){_0x513843(_0x3df7e9);}_0x18f2d4(_0x1ca670);});}function getInteractionTags(_0x509f0a,_0x1853f9){return new BPromise(function(_0x51f157,_0x2743d9){try{if(_0x509f0a[_0x119e('0x2c')]){_0x509f0a[_0x119e('0x2d')]=[];_0x509f0a[_0x119e('0x2c')]['split'](',')['forEach'](function(_0x4dcf5f){_0x509f0a['Tags'][_0x119e('0x2e')](_0x1853f9[_0x4dcf5f]);});}delete _0x509f0a[_0x119e('0x2c')];}catch(_0x48fae5){_0x2743d9(_0x48fae5);}_0x51f157(_0x509f0a);});}function updateFaxInteraction(_0x5d22be,_0x3cc2cc,_0x3dc17f){return new BPromise(function(_0x5f021d,_0x1a9d07){return getInteractionUsers(_0x5d22be,_0x3dc17f)[_0x119e('0x25')](function(_0x47e0d8){return getInteractionTags(_0x47e0d8,_0x3cc2cc);})[_0x119e('0x25')](function(_0x2a196d){_0x5f021d(_0x2a196d);})[_0x119e('0x2f')](function(_0x1b4458){_0x1a9d07(_0x1b4458);});});}exports[_0x119e('0x30')]=function(_0x3cfb7f,_0x1f05e8){var _0x3af549={},_0x7f1e56={},_0xf4755={'count':0x0,'rows':[]};var _0x35f1fd=_[_0x119e('0x2a')](db[_0x119e('0x31')][_0x119e('0x32')],function(_0xcb54ec){return{'name':_0xcb54ec['fieldName'],'type':_0xcb54ec[_0x119e('0x33')][_0x119e('0x34')]};});_0x7f1e56[_0x119e('0x35')]=_['map'](_0x35f1fd,_0x119e('0x27'));_0x7f1e56[_0x119e('0x36')]=_[_0x119e('0x37')](_0x3cfb7f[_0x119e('0x36')]);_0x7f1e56[_0x119e('0x38')]=_['intersection'](_0x7f1e56['model'],_0x7f1e56[_0x119e('0x36')]);_0x3af549[_0x119e('0x39')]=_[_0x119e('0x3a')](_0x7f1e56[_0x119e('0x35')],qs[_0x119e('0x3b')](_0x3cfb7f[_0x119e('0x36')][_0x119e('0x3b')]));_0x3af549['attributes']=_0x3af549['attributes'][_0x119e('0x3c')]?_0x3af549['attributes']:_0x7f1e56['model'];if(!_0x3cfb7f[_0x119e('0x36')]['hasOwnProperty']('nolimit')){_0x3af549['limit']=qs[_0x119e('0x20')](_0x3cfb7f[_0x119e('0x36')][_0x119e('0x20')]);_0x3af549[_0x119e('0x1f')]=qs[_0x119e('0x1f')](_0x3cfb7f[_0x119e('0x36')][_0x119e('0x1f')]);}_0x3af549[_0x119e('0x3d')]=qs[_0x119e('0x3e')](_0x3cfb7f[_0x119e('0x36')][_0x119e('0x3e')]);_0x3af549[_0x119e('0x3f')]=qs[_0x119e('0x38')](_[_0x119e('0x40')](_0x3cfb7f['query'],_0x7f1e56[_0x119e('0x38')]),_0x35f1fd);var _0x3fb1f0=[];var _0x3a55b3=squel[_0x119e('0x41')]()[_0x119e('0x42')]('id')[_0x119e('0x42')]('name')[_0x119e('0x42')]('color')[_0x119e('0x43')](_0x119e('0x44'));var _0x3b58ec=squel[_0x119e('0x41')]()[_0x119e('0x42')](_0x119e('0x45'))[_0x119e('0x42')]('u.fullname')['field'](_0x119e('0x46'))[_0x119e('0x43')](_0x119e('0x47'),'ui')[_0x119e('0x48')](_0x119e('0x49'),'u',_0x119e('0x4a'));var _0xf94dac=squel[_0x119e('0x41')]()[_0x119e('0x43')](_0x119e('0x4b'),'i')[_0x119e('0x48')](_0x119e('0x4c'),'c',_0x119e('0x4d'))[_0x119e('0x48')]('users','o',_0x119e('0x4e'))[_0x119e('0x48')]('fax_accounts','a',_0x119e('0x4f'))['left_join'](_0x119e('0x50'),'me',_0x119e('0x51'))[_0x119e('0x48')]('fax_interaction_has_tags','it',_0x119e('0x52'))[_0x119e('0x48')]('tools_tags','t',_0x119e('0x53'));var _0x178531=squel[_0x119e('0x54')]();var _0x494c4f=[];var _0x4d36b4=squel['expr']();var _0x1f79cd;if(_0x3cfb7f[_0x119e('0x36')]['search']){_0x1f79cd=as[_0x119e('0x55')](_0x3cfb7f['query'][_0x119e('0x56')]);var _0x5b701d=_0x1f79cd[_0x119e('0x57')];for(var _0x1980f9=0x0;_0x1980f9<_0x1f79cd['conditions']['length'];_0x1980f9++){var _0x4caed1=_0x1f79cd[_0x119e('0x58')][_0x1980f9];var _0x3bed73='i';var _0x5dab0e=_[_0x119e('0x59')](_0x35f1fd,[_0x119e('0x27'),_0x4caed1[_0x119e('0x42')]]);if(!_0x5dab0e){switch(_0x4caed1['field']){case'unreadMessages':if(_0x4caed1['value']==0x1){_0xf94dac[_0x119e('0x5a')]('`'+_0x4caed1[_0x119e('0x42')]+'`\x20=\x200');}else{_0xf94dac[_0x119e('0x5a')]('`'+_0x4caed1[_0x119e('0x42')]+_0x119e('0x5b'));}break;case _0x119e('0x5c'):if(_0x4caed1['operator']===_0x119e('0x5d')){if(_0x4caed1['value'][_0x119e('0x5e')]('\x20')[_0x119e('0x3c')]>0x1){_0x178531[_0x5b701d](_0x119e('0x5f'),qs[_0x119e('0x60')](_0x4caed1[_0x119e('0x61')]),null);}else{var _0x5da020='%'+_0x4caed1[_0x119e('0x61')]+'%';_0x178531[_0x5b701d](_0x119e('0x62'),_0x5da020,_0x5da020,_0x5da020);}}else{_0x5dab0e=_[_0x119e('0x59')](_0x35f1fd,[_0x119e('0x27'),_0x119e('0x63')]);_0x4caed1['field']=_0x119e('0x63');_0xe24f19=as[_0x119e('0x64')](_0x3bed73,_0x5dab0e[_0x119e('0x33')],_0x4caed1);_0x178531[_0x5b701d](_0xe24f19[_0x119e('0x65')],_0xe24f19[_0x119e('0x61')]['start'],_0xe24f19[_0x119e('0x61')][_0x119e('0x1d')]);}break;case _0x119e('0x66'):var _0x491ecb=_0x4caed1['value'][_0x119e('0x5e')](',')[_0x119e('0x2a')](function(_0x513c58){return Number(_0x513c58);});_0x491ecb[_0x119e('0x67')](function(_0x16807b){_0x4d36b4['or'](_0x119e('0x68'),'%,'+_0x16807b+',%');});_0x494c4f=_['union'](_0x494c4f,_0x491ecb);break;case _0x119e('0x69'):if(_0x4caed1[_0x119e('0x6a')]===_0x119e('0x5d')){_0x178531[_0x5b701d](_0x119e('0x6b'),'%'+_0x4caed1[_0x119e('0x61')]+'%',null);}else{_0x5dab0e=_[_0x119e('0x59')](_0x35f1fd,['name',_0x119e('0x6c')]);_0x4caed1['field']=_0x119e('0x6c');_0xe24f19=as['buildExpression'](_0x3bed73,_0x5dab0e[_0x119e('0x33')],_0x4caed1);_0x178531[_0x5b701d](_0xe24f19[_0x119e('0x65')],_0xe24f19[_0x119e('0x61')]['start'],_0xe24f19['value'][_0x119e('0x1d')]);}break;case _0x119e('0x6d'):_0xe24f19=as[_0x119e('0x64')]('me',null,_0x4caed1);_0x178531[_0x5b701d](_0xe24f19['text'],_0xe24f19[_0x119e('0x61')][_0x119e('0x6e')],_0xe24f19[_0x119e('0x61')][_0x119e('0x1d')]);break;}}else{var _0xe24f19=as[_0x119e('0x64')](_0x3bed73,_0x5dab0e[_0x119e('0x33')],_0x4caed1);_0x178531[_0x5b701d](_0xe24f19[_0x119e('0x65')],_0xe24f19[_0x119e('0x61')][_0x119e('0x6e')],_0xe24f19[_0x119e('0x61')][_0x119e('0x1d')]);}}}else{var _0x10d0b3=_(_0x3cfb7f['query'])[_0x119e('0x37')]()[_0x119e('0x2a')](function(_0x3190c8){return _['some'](_0x35f1fd,[_0x119e('0x27'),_0x3190c8])?_0x3190c8:undefined;})['compact']()[_0x119e('0x61')]();if(!_[_0x119e('0x6f')](_0x10d0b3)){_0x10d0b3[_0x119e('0x67')](function(_0x199557){if(_0x199557===_0x119e('0x70')){_0xf94dac[_0x119e('0x3f')](_0x119e('0x71'),[][_0x119e('0x72')](_0x3cfb7f['query'][_0x199557]));}else if(_0x199557===_0x119e('0x73')){var _0x51ba57=JSON[_0x119e('0x74')](_0x3cfb7f['query'][_0x199557])[_0x119e('0x75')];var _0x3828bc=JSON['parse'](_0x3cfb7f[_0x119e('0x36')][_0x199557])[_0x119e('0x76')];_0xf94dac['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x51ba57,_0x3828bc);}else{if(_0x3cfb7f['query'][_0x199557]===_0x119e('0x77')){_0xf94dac['where']('i.'+_0x199557+_0x119e('0x78'));}else{_0xf94dac[_0x119e('0x3f')]('i.'+_0x199557+_0x119e('0x79'),_0x3cfb7f[_0x119e('0x36')][_0x199557]);}}});}if(_0x3cfb7f[_0x119e('0x36')][_0x119e('0x7a')]){if(_0x3cfb7f[_0x119e('0x36')][_0x119e('0x7a')]==0x1){_0xf94dac[_0x119e('0x5a')]('`unreadMessages`\x20=\x200');}else{_0xf94dac[_0x119e('0x5a')](_0x119e('0x7b'));}}if(_0x3cfb7f[_0x119e('0x36')]['tag']){_0x494c4f=_['isArray'](_0x3cfb7f['query'][_0x119e('0x7c')])?_0x3cfb7f[_0x119e('0x36')][_0x119e('0x7c')]:new Array(_0x3cfb7f[_0x119e('0x36')][_0x119e('0x7c')]);_0x494c4f[_0x119e('0x67')](function(_0x13c63c){_0x4d36b4['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x13c63c+',%');});}if(_0x3cfb7f[_0x119e('0x36')][_0x119e('0x7d')]){var _0x1746f8=_0x3cfb7f[_0x119e('0x36')][_0x119e('0x7d')][_0x119e('0x7e')]('\x5c','\x5c\x5c')[_0x119e('0x7e')]('\x27\x27',_0x119e('0x7f'));if(qs[_0x119e('0x80')](_0x1746f8)){_0x178531['or']('i.id\x20LIKE\x20?',_0x1746f8+'%')['or'](_0x119e('0x81'),_0x1746f8+'%');}_0x178531['or'](_0x119e('0x82'),_0x1746f8+'%');}}_0xf94dac[_0x119e('0x3f')](_0x178531);_0xf94dac[_0x119e('0x83')](_0x119e('0x84'));var _0x26ba86={'type':db[_0x119e('0x85')]['QueryTypes']['SELECT'],'raw':!![]};var _0x59a772=_0xf94dac[_0x119e('0x86')]();_0x59a772['field']('i.id');_0x59a772[_0x119e('0x42')](_0x119e('0x87'),'unreadMessages');if(_0x3af549[_0x119e('0x3d')]){_0x3af549[_0x119e('0x3d')][_0x119e('0x67')](function(_0xc8fca0){_0xf94dac[_0x119e('0x3d')]('i.'+_0xc8fca0[0x0],_0xc8fca0[0x1]===_0x119e('0x88')?![]:!![]);});}if(!_[_0x119e('0x6f')](_0x494c4f)){_0xf94dac[_0x119e('0x5a')](_0x4d36b4);_0x59a772[_0x119e('0x3f')]('t.id\x20IN\x20?',_0x494c4f);}BPromise[_0x119e('0x89')]()[_0x119e('0x25')](function(){if(!_0x1f79cd){if(_0x3cfb7f[_0x119e('0x36')]['FaxAccountId']||_0x3cfb7f[_0x119e('0x36')][_0x119e('0x8a')])return;_0x59a772[_0x119e('0x3f')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0xf94dac[_0x119e('0x3f')](_0x119e('0x8b'));return;}return _0x3cfb7f[_0x119e('0x8c')][_0x119e('0x8d')]({'attributes':['id'],'raw':!![]})[_0x119e('0x25')](function(_0x274146){if(_[_0x119e('0x6f')](_0x274146)){_0x59a772[_0x119e('0x3f')](_0x119e('0x8e'));_0xf94dac[_0x119e('0x3f')]('i.FaxAccountId\x20IS\x20NULL');}else{_0x59a772[_0x119e('0x3f')](_0x119e('0x71'),_['map'](_0x274146,'id'));_0xf94dac['where']('i.FaxAccountId\x20IN\x20?',_['map'](_0x274146,'id'));}});})['then'](function(){db[_0x119e('0x8f')][_0x119e('0x36')](_0x59a772[_0x119e('0x90')](),_0x26ba86)[_0x119e('0x25')](function(_0x315f8a){_0xf4755[_0x119e('0x1e')]=_0x315f8a[_0x119e('0x3c')];if(_0xf4755['count']===0x0)return[];return db['sequelize'][_0x119e('0x36')](_0x3a55b3[_0x119e('0x90')](),_0x26ba86)[_0x119e('0x25')](function(_0x5d1ccb){_0x3fb1f0=_['keyBy'](_0x5d1ccb,'id');_0x26ba86=_['merge'](_0x26ba86,{'model':db[_0x119e('0x31')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3cfb7f['query']['fields']){_0x3af549[_0x119e('0x39')][_0x119e('0x67')](function(_0x13550b){_0xf94dac[_0x119e('0x42')]('i.'+_0x13550b);});}else{_0xf94dac['field'](_0x119e('0x87'),_0x119e('0x91'));_0xf94dac[_0x119e('0x42')](_0x119e('0x92'),'Account.key');_0xf94dac[_0x119e('0x42')](_0x119e('0x93'),_0x119e('0x94'));_0xf94dac[_0x119e('0x42')](_0x119e('0x95'));_0xf94dac['field'](_0x119e('0x96'),'Contact.firstName');_0xf94dac['field'](_0x119e('0x97'),_0x119e('0x98'));_0xf94dac['field']('c.email',_0x119e('0x99'));_0xf94dac[_0x119e('0x42')](_0x119e('0x9a'),_0x119e('0x9b'));_0xf94dac[_0x119e('0x42')](_0x119e('0x9c'),_0x119e('0x9d'));_0xf94dac[_0x119e('0x42')]('c.fax',_0x119e('0x9e'));_0xf94dac[_0x119e('0x42')]('o.fullname',_0x119e('0x9f'));_0xf94dac[_0x119e('0x42')]('o.internal',_0x119e('0xa0'));_0xf94dac['field'](_0x119e('0xa1'),_0x119e('0x2c'));}if(_0x3af549[_0x119e('0x20')])_0xf94dac['limit'](_0x3af549[_0x119e('0x20')]);if(_0x3af549[_0x119e('0x1f')])_0xf94dac[_0x119e('0x1f')](_0x3af549[_0x119e('0x1f')]);return db[_0x119e('0x8f')][_0x119e('0x36')](_0xf94dac[_0x119e('0x90')](),_0x26ba86);})[_0x119e('0x25')](function(_0xe52745){_0x3b58ec[_0x119e('0x3f')](_0x119e('0xa2'),_[_0x119e('0x2a')](_0xe52745,'id'));return db[_0x119e('0x8f')][_0x119e('0x36')](_0x3b58ec[_0x119e('0x90')](),_0x26ba86)['then'](function(_0x198a69){var _0x5b598d=_[_0x119e('0xa3')](_0x198a69,_0x119e('0xa4'));var _0x5093ea=[];_0xe52745[_0x119e('0x67')](function(_0x31c437){_0x5093ea[_0x119e('0x2e')](updateFaxInteraction(_0x31c437,_0x3fb1f0,_0x5b598d));});return BPromise['all'](_0x5093ea);});});})[_0x119e('0x25')](function(_0xd1c35c){_0xf4755['rows']=_0xd1c35c;return _0xf4755;})[_0x119e('0x25')](respondWithFilteredResult(_0x1f05e8,_0x3af549));})[_0x119e('0x2f')](handleError(_0x1f05e8,null));};exports[_0x119e('0xa5')]=function(_0x7a7fa6,_0x1965d4){var _0x1962a9={'raw':![],'where':{'id':_0x7a7fa6['params']['id']}},_0x2e49c2={};_0x2e49c2[_0x119e('0x35')]=_['keys'](db[_0x119e('0x31')][_0x119e('0x32')]);_0x2e49c2[_0x119e('0x36')]=_[_0x119e('0x37')](_0x7a7fa6[_0x119e('0x36')]);_0x2e49c2[_0x119e('0x38')]=_[_0x119e('0x3a')](_0x2e49c2[_0x119e('0x35')],_0x2e49c2[_0x119e('0x36')]);_0x1962a9[_0x119e('0x39')]=_[_0x119e('0x3a')](_0x2e49c2[_0x119e('0x35')],qs[_0x119e('0x3b')](_0x7a7fa6[_0x119e('0x36')][_0x119e('0x3b')]));_0x1962a9[_0x119e('0x39')]=_0x1962a9[_0x119e('0x39')][_0x119e('0x3c')]?_0x1962a9['attributes']:_0x2e49c2[_0x119e('0x35')];if(_0x7a7fa6[_0x119e('0x36')][_0x119e('0xa6')]){_0x1962a9['include']=[{'all':!![]}];}_0x1962a9=_[_0x119e('0xa7')]({},_0x1962a9,_0x7a7fa6[_0x119e('0xa8')]);return db[_0x119e('0x31')][_0x119e('0x59')](_0x1962a9)['then'](handleEntityNotFound(_0x1965d4,null))[_0x119e('0x25')](respondWithResult(_0x1965d4,null))[_0x119e('0x2f')](handleError(_0x1965d4,null));};exports[_0x119e('0xa9')]=function(_0x417354,_0x1d12a0){return db['FaxInteraction'][_0x119e('0xa9')](_0x417354[_0x119e('0x6d')],{})[_0x119e('0x25')](respondWithResult(_0x1d12a0,0xc9))[_0x119e('0x2f')](handleError(_0x1d12a0,null));};exports[_0x119e('0xaa')]=function(_0x388422,_0x1b4e56){if(_0x388422['body']['id']){delete _0x388422[_0x119e('0x6d')]['id'];}return db[_0x119e('0x31')][_0x119e('0x59')]({'where':{'id':_0x388422[_0x119e('0xab')]['id']}})[_0x119e('0x25')](handleEntityNotFound(_0x1b4e56,null))[_0x119e('0x25')](saveUpdates(_0x388422[_0x119e('0x6d')],null))[_0x119e('0x25')](respondWithResult(_0x1b4e56,null))['catch'](handleError(_0x1b4e56,null));};exports['destroy']=function(_0x1963a3,_0x3bc57c){return db[_0x119e('0x31')]['find']({'where':{'id':_0x1963a3[_0x119e('0xab')]['id']}})[_0x119e('0x25')](handleEntityNotFound(_0x3bc57c,null))['then'](removeEntity(_0x3bc57c,null))[_0x119e('0x2f')](handleError(_0x3bc57c,null));};exports['describe']=function(_0x38a655,_0x52bbe9){return db[_0x119e('0x31')][_0x119e('0xac')]()[_0x119e('0x25')](respondWithResult(_0x52bbe9,null))[_0x119e('0x2f')](handleError(_0x52bbe9,null));};exports[_0x119e('0xad')]=function(_0x359059,_0x3707e1,_0x54ee34){return db[_0x119e('0xae')][_0x119e('0x59')]({'where':{'id':_0x359059['params']['id']}})[_0x119e('0x25')](handleEntityNotFound(_0x3707e1,null))[_0x119e('0x25')](function(_0x1c2034){if(_0x1c2034){return _0x1c2034[_0x119e('0xad')](_0x359059['body'][_0x119e('0xaf')],_[_0x119e('0xb0')](_0x359059[_0x119e('0x6d')],[_0x119e('0xaf'),'id'])||{});}})[_0x119e('0x25')](respondWithResult(_0x3707e1,null))['catch'](handleError(_0x3707e1,null));};exports[_0x119e('0xb1')]=function(_0x2d5423,_0x19eb26,_0x1c9d2f){var _0xffa53f={'raw':![],'where':{}};var _0x30ebcf={};var _0x1c5d8d={'count':0x0,'rows':[]};return db[_0x119e('0x31')][_0x119e('0xb2')]({'where':{'id':_0x2d5423[_0x119e('0xab')]['id']}})[_0x119e('0x25')](handleEntityNotFound(_0x19eb26,null))[_0x119e('0x25')](function(_0x34c52b){if(_0x34c52b){_0x30ebcf[_0x119e('0x35')]=_[_0x119e('0x37')](db[_0x119e('0xae')][_0x119e('0x32')]);_0x30ebcf[_0x119e('0x36')]=_[_0x119e('0x37')](_0x2d5423['query']);_0x30ebcf[_0x119e('0x38')]=_['intersection'](_0x30ebcf[_0x119e('0x35')],_0x30ebcf[_0x119e('0x36')]);_0xffa53f['attributes']=_[_0x119e('0x3a')](_0x30ebcf[_0x119e('0x35')],qs[_0x119e('0x3b')](_0x2d5423['query'][_0x119e('0x3b')]));_0xffa53f['attributes']=_0xffa53f[_0x119e('0x39')][_0x119e('0x3c')]?_0xffa53f['attributes']:_0x30ebcf[_0x119e('0x35')];if(!_0x2d5423[_0x119e('0x36')][_0x119e('0xb3')](_0x119e('0xb4'))){_0xffa53f[_0x119e('0x20')]=qs[_0x119e('0x20')](_0x2d5423[_0x119e('0x36')][_0x119e('0x20')]);_0xffa53f[_0x119e('0x1f')]=qs['offset'](_0x2d5423[_0x119e('0x36')][_0x119e('0x1f')]);}_0xffa53f[_0x119e('0x3d')]=qs['sort'](_0x2d5423[_0x119e('0x36')]['sort']);_0xffa53f[_0x119e('0x3f')]=qs[_0x119e('0x38')](_[_0x119e('0x40')](_0x2d5423[_0x119e('0x36')],_0x30ebcf[_0x119e('0x38')]));_0xffa53f[_0x119e('0x3f')][_0x119e('0xa4')]=_0x34c52b['id'];if(_0x2d5423[_0x119e('0x36')][_0x119e('0x7d')]){_0xffa53f[_0x119e('0x3f')]=_[_0x119e('0xa7')](_0xffa53f[_0x119e('0x3f')],{'$or':_[_0x119e('0x2a')](_0xffa53f[_0x119e('0x39')],function(_0x525529){var _0x4a62d1={};_0x4a62d1[_0x525529]={'$like':'%'+_0x2d5423[_0x119e('0x36')]['filter']+'%'};return _0x4a62d1;})});}if(_0x2d5423[_0x119e('0x36')][_0x119e('0x75')]){var _0x2914e5=_0x2d5423[_0x119e('0x36')][_0x119e('0x75')][_0x119e('0x5e')](',');var _0xdf366b={};_0xdf366b[_0x2914e5[0x0]]={'$gte':moment(_0x2914e5[0x1])[_0x119e('0xb5')](_0x119e('0xb6'))};_0xffa53f[_0x119e('0x3f')]=_[_0x119e('0xa7')](_0xffa53f['where'],_0xdf366b);}_0xffa53f=_['merge']({},_0xffa53f,_0x2d5423[_0x119e('0xa8')]);return db[_0x119e('0xae')][_0x119e('0x1e')]({'where':_0xffa53f[_0x119e('0x3f')]})[_0x119e('0x25')](function(_0x2ded4b){_0x1c5d8d[_0x119e('0x1e')]=_0x2ded4b;if(_0x2d5423[_0x119e('0x36')][_0x119e('0xa6')]){_0xffa53f[_0x119e('0xb7')]=[{'all':!![]}];}return db[_0x119e('0xae')]['findAll'](_0xffa53f);})[_0x119e('0x25')](function(_0x2a8bf7){_0x1c5d8d['rows']=_0x2a8bf7;return _0x1c5d8d;});}})[_0x119e('0x25')](respondWithFilteredResult(_0x19eb26,_0xffa53f))[_0x119e('0x2f')](handleError(_0x19eb26,null));};exports['addTags']=function(_0x42d9ad,_0x464c73,_0x2ca4e9){return db['FaxInteraction']['find']({'where':{'id':_0x42d9ad['params']['id']}})[_0x119e('0x25')](handleEntityNotFound(_0x464c73,null))[_0x119e('0x25')](function(_0x463982){if(_0x463982){return _0x463982['setTags'](_0x42d9ad['body'][_0x119e('0xaf')],_['omit'](_0x42d9ad['body'],[_0x119e('0xaf'),'id'])||{})[_0x119e('0xb8')](function(){return db[_0x119e('0x66')]['findAll']({'attributes':['id',_0x119e('0x27'),_0x119e('0xb9')],'where':{'id':_0x42d9ad[_0x119e('0x6d')]['ids']}});})[_0x119e('0x25')](function(_0xd7fb0b){socket[_0x119e('0xba')](_0x119e('0xbb'),{'id':Number(_0x42d9ad[_0x119e('0xab')]['id']),'tags':_0xd7fb0b||[]});return{'id':Number(_0x42d9ad[_0x119e('0xab')]['id']),'tags':_0xd7fb0b||[]};});}})[_0x119e('0x25')](respondWithResult(_0x464c73,null))[_0x119e('0x2f')](handleError(_0x464c73,null));};exports[_0x119e('0xbc')]=function(_0x43439c,_0x1034e4,_0x41c496){return db[_0x119e('0x31')][_0x119e('0x59')]({'where':{'id':_0x43439c[_0x119e('0xab')]['id']}})[_0x119e('0x25')](handleEntityNotFound(_0x1034e4,null))[_0x119e('0x25')](function(_0x47b97f){if(_0x47b97f){return _0x47b97f[_0x119e('0xbc')](_0x43439c[_0x119e('0x36')]['ids']);}})[_0x119e('0x25')](respondWithStatusCode(_0x1034e4,null))[_0x119e('0x2f')](handleError(_0x1034e4,null));};exports[_0x119e('0xbd')]=function(_0x27bd5d,_0x26141e){var _0x2dd26f=moment()['unix']()[_0x119e('0x90')]();var _0x12bfc9=path[_0x119e('0xbe')](config[_0x119e('0xbf')],_0x119e('0xc0'),_0x119e('0xc1'),_0x119e('0xc2'));var _0x3c094b=path[_0x119e('0xbe')](config[_0x119e('0xbf')],_0x119e('0xc0'),_0x119e('0xc1'),'attachments');var _0x483f33=path[_0x119e('0xbe')](_0x12bfc9,_0x2dd26f);var _0x464c54=util[_0x119e('0xb5')](_0x119e('0xc3'),_0x27bd5d['params']['id'],_0x2dd26f);var _0x66f1dd=path[_0x119e('0xbe')](_0x12bfc9,_0x464c54);var _0x18639d=[];_0x18639d['push']({'model':db[_0x119e('0xc4')],'as':_0x119e('0xc4'),'raw':!![]});var _0x518155=[{'model':db['FaxMessage'],'as':'Messages','attributes':['id',_0x119e('0x6d'),_0x119e('0x73')],'include':_0x18639d}];return db[_0x119e('0x31')]['find']({'where':{'id':_0x27bd5d[_0x119e('0xab')]['id']},'include':_0x518155})[_0x119e('0x25')](handleEntityNotFound(_0x26141e,null))[_0x119e('0x25')](function(_0x54f445){if(_0x54f445&&_0x54f445[_0x119e('0xc5')]){var _0x30e970=_0x54f445[_0x119e('0xc6')]({'plain':!![]});fs['mkdirSync'](_0x483f33);for(var _0x304e15=0x0;_0x304e15<_0x30e970[_0x119e('0xc5')]['length'];_0x304e15++){var _0x25567f=_0x30e970[_0x119e('0xc5')][_0x304e15][_0x119e('0xc4')];if(_0x25567f){var _0x147d38=path[_0x119e('0xbe')](_0x3c094b,_0x25567f[_0x119e('0xc7')]);if(fs[_0x119e('0xc8')](_0x147d38)){fs[_0x119e('0xc9')](_0x147d38)['pipe'](fs['createWriteStream'](path[_0x119e('0xbe')](_0x483f33,_0x25567f[_0x119e('0xc7')])));}}}return BPromise[_0x119e('0x89')]()[_0x119e('0x25')](function(){return new BPromise(function(_0x39e4ec,_0x2da19b){zipdir(_0x483f33,{'saveTo':_0x66f1dd},function(_0x5154b7,_0x4b178b){if(_0x5154b7)return _0x2da19b(_0x5154b7);return _0x39e4ec(_0x4b178b);});})['then'](function(){return new BPromise(function(_0x27aaf4,_0x3a3205){rimraf(_0x483f33,function(_0x4d8105){if(_0x4d8105)_0x3a3205(_0x4d8105);return _0x27aaf4();});});})['then'](function(){return _0x26141e[_0x119e('0xbd')](_0x66f1dd,_0x464c54,function(_0x5b1173){if(_0x5b1173){console[_0x119e('0xca')]('err',_0x5b1173);}else{fs['unlinkSync'](_0x66f1dd);}});});});}else{return _0x26141e['sendStatus'](0xc8);}})[_0x119e('0x2f')](handleError(_0x26141e,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 19908f3..852a9f5 100644 --- a/server/api/faxInteraction/faxInteraction.events.js +++ b/server/api/faxInteraction/faxInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','hasOwnProperty'];(function(_0x39ee2c,_0x7074a9){var _0x207751=function(_0x1cebc4){while(--_0x1cebc4){_0x39ee2c['push'](_0x39ee2c['shift']());}};_0x207751(++_0x7074a9);}(_0x1261,0x144));var _0x1126=function(_0x21aafd,_0x1f0fa6){_0x21aafd=_0x21aafd-0x0;var _0x9f2800=_0x1261[_0x21aafd];return _0x9f2800;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x1126('0x0'))['db'][_0x1126('0x1')];var FaxMessage=require(_0x1126('0x0'))['db'][_0x1126('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x1126('0x3')](0x0);var events={'afterCreate':_0x1126('0x4'),'afterUpdate':_0x1126('0x5'),'afterDestroy':_0x1126('0x6')};function emitEvent(_0x21a480){return function(_0x75a851,_0x5a2189,_0x5c68c8){_0x75a851[_0x1126('0x7')]({'attributes':['id'],'raw':!![]})[_0x1126('0x8')](function(_0x4f239c){_0x75a851[_0x1126('0x9')](_0x1126('0xa'),_0x4f239c[_0x1126('0xb')](function(_0x3abb0b){return{'id':_0x3abb0b['id']};}));return FaxMessage[_0x1126('0xc')]({'where':{'FaxInteractionId':_0x75a851['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3f09ac){_0x75a851[_0x1126('0x9')](_0x1126('0xd'),_0x3f09ac['length']);FaxInteractionEvents[_0x1126('0xe')](_0x21a480+':'+_0x75a851['id'],_0x75a851);FaxInteractionEvents['emit'](_0x21a480,_0x75a851);_0x5c68c8(null);})['catch'](_0x5c68c8(null));};}for(var e in events){if(events[_0x1126('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x1126('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0x814b=['then','Users','map','findAll','setDataValue','unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove'];(function(_0x36c935,_0x4e302b){var _0x480133=function(_0x8cbb30){while(--_0x8cbb30){_0x36c935['push'](_0x36c935['shift']());}};_0x480133(++_0x4e302b);}(_0x814b,0x1a2));var _0xb814=function(_0x1baa84,_0x3c938e){_0x1baa84=_0x1baa84-0x0;var _0x18523b=_0x814b[_0x1baa84];return _0x18523b;};'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 bd13b6d..7d9ee19 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 _0x1d17=['api','moment','bluebird','request-promise','path','../../config/environment','./faxInteraction.attributes','exports','FaxInteraction','fax_interactions','changed','closed','closedAt','format','lodash','util','../../config/logger'];(function(_0x47dac5,_0x3edb97){var _0x2049ae=function(_0x31f815){while(--_0x31f815){_0x47dac5['push'](_0x47dac5['shift']());}};_0x2049ae(++_0x3edb97);}(_0x1d17,0x140));var _0x71d1=function(_0x3deb2e,_0x22319b){_0x3deb2e=_0x3deb2e-0x0;var _0x8a1956=_0x1d17[_0x3deb2e];return _0x8a1956;};'use strict';var _=require(_0x71d1('0x0'));var util=require(_0x71d1('0x1'));var logger=require(_0x71d1('0x2'))(_0x71d1('0x3'));var moment=require(_0x71d1('0x4'));var BPromise=require(_0x71d1('0x5'));var rp=require(_0x71d1('0x6'));var fs=require('fs');var path=require(_0x71d1('0x7'));var rimraf=require('rimraf');var config=require(_0x71d1('0x8'));var attributes=require(_0x71d1('0x9'));module[_0x71d1('0xa')]=function(_0x55b2b1,_0x34476e){return _0x55b2b1['define'](_0x71d1('0xb'),attributes,{'tableName':_0x71d1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4ab9aa,_0x1a270d,_0x1d9290){if(_0x4ab9aa[_0x71d1('0xd')](_0x71d1('0xe'))){_0x4ab9aa[_0x71d1('0xf')]=moment()[_0x71d1('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1d9290(null,_0x4ab9aa);}}});}; \ No newline at end of file +var _0x8397=['../../config/environment','./faxInteraction.attributes','define','FaxInteraction','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x8397,0x1ca));var _0x7839=function(_0x2b0397,_0x524af8){_0x2b0397=_0x2b0397-0x0;var _0x1a0ac9=_0x8397[_0x2b0397];return _0x1a0ac9;};'use strict';var _=require(_0x7839('0x0'));var util=require(_0x7839('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7839('0x2'));var BPromise=require(_0x7839('0x3'));var rp=require(_0x7839('0x4'));var fs=require('fs');var path=require(_0x7839('0x5'));var rimraf=require(_0x7839('0x6'));var config=require(_0x7839('0x7'));var attributes=require(_0x7839('0x8'));module['exports']=function(_0x483b22,_0xdba872){return _0x483b22[_0x7839('0x9')](_0x7839('0xa'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x52761e,_0x1551fc,_0x1a88a3){if(_0x52761e[_0x7839('0xb')](_0x7839('0xc'))){_0x52761e['closedAt']=moment()[_0x7839('0xd')](_0x7839('0xe'));}_0x1a88a3(null,_0x52761e);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 661f8ef..8df2a69 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 _0xff04=['../../config/logger','rpc','../../config/environment','redis','localhost','socket.io-emitter','register','request','then','info','FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','FaxInteraction','options','raw','attributes','UpdateFaxInteraction','catch','find','addTags','omit','body','ids','AddTags','util','bluebird','randomstring','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xff04,0xce));var _0x4ff0=function(_0x7a17c2,_0xd56995){_0x7a17c2=_0x7a17c2-0x0;var _0x13e2f6=_0xff04[_0x7a17c2];return _0x13e2f6;};'use strict';var _=require('lodash');var util=require(_0x4ff0('0x0'));var moment=require('moment');var BPromise=require(_0x4ff0('0x1'));var rs=require(_0x4ff0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4ff0('0x3'));var logger=require(_0x4ff0('0x4'))(_0x4ff0('0x5'));var config=require(_0x4ff0('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x4ff0('0x7')],{'host':_0x4ff0('0x8'),'port':0x18eb});var socket=require(_0x4ff0('0x9'))(new Redis(config[_0x4ff0('0x7')]));require('./faxInteraction.socket')[_0x4ff0('0xa')](socket);function respondWithRpcPromise(_0x5af6c5,_0x1b6934,_0x4924c4){return new BPromise(function(_0x43f1e6,_0x2fcbaa){return client[_0x4ff0('0xb')](_0x5af6c5,_0x4924c4)[_0x4ff0('0xc')](function(_0x289486){logger[_0x4ff0('0xd')](_0x4ff0('0xe'),_0x1b6934,'request\x20sent');logger[_0x4ff0('0xf')](_0x4ff0('0x10'),_0x1b6934,_0x4ff0('0x11'),JSON[_0x4ff0('0x12')](_0x289486));if(_0x289486[_0x4ff0('0x13')]){if(_0x289486['error'][_0x4ff0('0x14')]===0x1f4){logger[_0x4ff0('0x13')]('FaxInteraction,\x20%s,\x20%s',_0x1b6934,_0x289486[_0x4ff0('0x13')][_0x4ff0('0x15')]);return _0x2fcbaa(_0x289486[_0x4ff0('0x13')][_0x4ff0('0x15')]);}logger[_0x4ff0('0x13')](_0x4ff0('0xe'),_0x1b6934,_0x289486[_0x4ff0('0x13')][_0x4ff0('0x15')]);return _0x43f1e6(_0x289486[_0x4ff0('0x13')][_0x4ff0('0x15')]);}else{logger[_0x4ff0('0xd')](_0x4ff0('0xe'),_0x1b6934,_0x4ff0('0x11'));_0x43f1e6(_0x289486[_0x4ff0('0x16')][_0x4ff0('0x15')]);}})['catch'](function(_0x3c06cb){logger[_0x4ff0('0x13')](_0x4ff0('0xe'),_0x1b6934,_0x3c06cb);_0x2fcbaa(_0x3c06cb);});});}exports['UpdateFaxInteraction']=function(_0x311ae5){var _0x3a8775=this;return new Promise(function(_0x497c2d,_0x56f4a9){return db[_0x4ff0('0x17')]['update'](_0x311ae5['body'],{'raw':_0x311ae5[_0x4ff0('0x18')]?_0x311ae5[_0x4ff0('0x18')][_0x4ff0('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x311ae5[_0x4ff0('0x18')]?_0x311ae5[_0x4ff0('0x18')]['where']||null:null,'attributes':_0x311ae5['options']?_0x311ae5[_0x4ff0('0x18')][_0x4ff0('0x1a')]||null:null,'limit':_0x311ae5[_0x4ff0('0x18')]?_0x311ae5[_0x4ff0('0x18')]['limit']||null:null})[_0x4ff0('0xc')](function(_0x1a0615){logger[_0x4ff0('0xd')](_0x4ff0('0x1b'),_0x311ae5);logger[_0x4ff0('0xf')](_0x4ff0('0x1b'),_0x311ae5,JSON['stringify'](_0x1a0615));_0x497c2d(_0x1a0615);})[_0x4ff0('0x1c')](function(_0x46e8d9){logger[_0x4ff0('0x13')]('UpdateFaxInteraction',_0x46e8d9[_0x4ff0('0x15')],_0x311ae5);_0x56f4a9(_0x3a8775[_0x4ff0('0x13')](0x1f4,_0x46e8d9[_0x4ff0('0x15')]));});});};exports['AddTagsToFaxInteraction']=function(_0x306685){return new Promise(function(_0x8d0787,_0x5d3cbb){return db['FaxInteraction'][_0x4ff0('0x1d')]({'where':_0x306685['options']?_0x306685['options']['where']||null:null})['then'](function(_0x5ae23c){if(_0x5ae23c){return _0x5ae23c[_0x4ff0('0x1e')](_0x306685['body']['ids'],_[_0x4ff0('0x1f')](_0x306685[_0x4ff0('0x20')],[_0x4ff0('0x21'),'id'])||{});}})['spread'](function(_0x569a38){logger[_0x4ff0('0xd')](_0x4ff0('0x22'),_0x306685);logger[_0x4ff0('0xf')]('AddTags',_0x306685,JSON[_0x4ff0('0x12')](_0x569a38));_0x8d0787(_0x569a38);})[_0x4ff0('0x1c')](function(_0x2d26e2){logger[_0x4ff0('0x13')]('AddTags',_0x2d26e2[_0x4ff0('0x15')],_0x306685);_0x5d3cbb(_this['error'](0x1f4,_0x2d26e2[_0x4ff0('0x15')]));});});}; \ No newline at end of file +var _0x791b=['FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxInteraction','update','options','where','attributes','debug','FaxInteraction','find','ids','omit','body','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent'];(function(_0x12dbf6,_0x2c381c){var _0x3adcc6=function(_0x24b23d){while(--_0x24b23d){_0x12dbf6['push'](_0x12dbf6['shift']());}};_0x3adcc6(++_0x2c381c);}(_0x791b,0x1e2));var _0xb791=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x791b[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0xb791('0x0'));var util=require(_0xb791('0x1'));var moment=require(_0xb791('0x2'));var BPromise=require(_0xb791('0x3'));var rs=require(_0xb791('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb791('0x5'))['db'];var utils=require(_0xb791('0x6'));var logger=require(_0xb791('0x7'))(_0xb791('0x8'));var config=require(_0xb791('0x9'));var jayson=require(_0xb791('0xa'));var client=jayson[_0xb791('0xb')]['http']({'port':0x232a});config[_0xb791('0xc')]=_[_0xb791('0xd')](config['redis'],{'host':_0xb791('0xe'),'port':0x18eb});var socket=require(_0xb791('0xf'))(new Redis(config['redis']));require('./faxInteraction.socket')[_0xb791('0x10')](socket);function respondWithRpcPromise(_0x32a5f0,_0x52fa5d,_0x4b17f8){return new BPromise(function(_0x11f5d2,_0x4792d0){return client[_0xb791('0x11')](_0x32a5f0,_0x4b17f8)[_0xb791('0x12')](function(_0x4811a2){logger[_0xb791('0x13')](_0xb791('0x14'),_0x52fa5d,_0xb791('0x15'));logger['debug'](_0xb791('0x16'),_0x52fa5d,_0xb791('0x15'),JSON[_0xb791('0x17')](_0x4811a2));if(_0x4811a2[_0xb791('0x18')]){if(_0x4811a2[_0xb791('0x18')][_0xb791('0x19')]===0x1f4){logger[_0xb791('0x18')](_0xb791('0x14'),_0x52fa5d,_0x4811a2[_0xb791('0x18')][_0xb791('0x1a')]);return _0x4792d0(_0x4811a2[_0xb791('0x18')][_0xb791('0x1a')]);}logger[_0xb791('0x18')]('FaxInteraction,\x20%s,\x20%s',_0x52fa5d,_0x4811a2[_0xb791('0x18')][_0xb791('0x1a')]);return _0x11f5d2(_0x4811a2[_0xb791('0x18')][_0xb791('0x1a')]);}else{logger[_0xb791('0x13')](_0xb791('0x14'),_0x52fa5d,_0xb791('0x15'));_0x11f5d2(_0x4811a2[_0xb791('0x1b')][_0xb791('0x1a')]);}})[_0xb791('0x1c')](function(_0x238ee6){logger[_0xb791('0x18')]('FaxInteraction,\x20%s,\x20%s',_0x52fa5d,_0x238ee6);_0x4792d0(_0x238ee6);});});}exports[_0xb791('0x1d')]=function(_0x5ac658){var _0x962870=this;return new Promise(function(_0x227fae,_0x2cfad7){return db['FaxInteraction'][_0xb791('0x1e')](_0x5ac658['body'],{'raw':_0x5ac658['options']?_0x5ac658['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ac658[_0xb791('0x1f')]?_0x5ac658[_0xb791('0x1f')][_0xb791('0x20')]||null:null,'attributes':_0x5ac658['options']?_0x5ac658[_0xb791('0x1f')][_0xb791('0x21')]||null:null,'limit':_0x5ac658['options']?_0x5ac658['options']['limit']||null:null})[_0xb791('0x12')](function(_0x5cc41d){logger['info'](_0xb791('0x1d'),_0x5ac658);logger[_0xb791('0x22')](_0xb791('0x1d'),_0x5ac658,JSON[_0xb791('0x17')](_0x5cc41d));_0x227fae(_0x5cc41d);})['catch'](function(_0x5299b7){logger[_0xb791('0x18')](_0xb791('0x1d'),_0x5299b7[_0xb791('0x1a')],_0x5ac658);_0x2cfad7(_0x962870[_0xb791('0x18')](0x1f4,_0x5299b7[_0xb791('0x1a')]));});});};exports['AddTagsToFaxInteraction']=function(_0x596ff1){return new Promise(function(_0xaa5d0c,_0x2c23e5){return db[_0xb791('0x23')][_0xb791('0x24')]({'where':_0x596ff1['options']?_0x596ff1[_0xb791('0x1f')]['where']||null:null})[_0xb791('0x12')](function(_0x4dfde0){if(_0x4dfde0){return _0x4dfde0['addTags'](_0x596ff1['body'][_0xb791('0x25')],_[_0xb791('0x26')](_0x596ff1[_0xb791('0x27')],[_0xb791('0x25'),'id'])||{});}})[_0xb791('0x28')](function(_0x67fb52){logger['info'](_0xb791('0x29'),_0x596ff1);logger['debug'](_0xb791('0x29'),_0x596ff1,JSON[_0xb791('0x17')](_0x67fb52));_0xaa5d0c(_0x67fb52);})[_0xb791('0x1c')](function(_0x9a9fc2){logger['error'](_0xb791('0x29'),_0x9a9fc2[_0xb791('0x1a')],_0x596ff1);_0x2c23e5(_this[_0xb791('0x18')](0x1f4,_0x9a9fc2[_0xb791('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 5e59bf1..c9e903a 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 _0x66a5=['faxInteraction:','./faxInteraction.events','save','remove','update','emit','register','length'];(function(_0x11aaf9,_0x276a82){var _0x6bcddc=function(_0x37cc8b){while(--_0x37cc8b){_0x11aaf9['push'](_0x11aaf9['shift']());}};_0x6bcddc(++_0x276a82);}(_0x66a5,0x1b1));var _0x566a=function(_0x25e934,_0x4757dd){_0x25e934=_0x25e934-0x0;var _0x162c25=_0x66a5[_0x25e934];return _0x162c25;};'use strict';var FaxInteractionEvents=require(_0x566a('0x0'));var events=[_0x566a('0x1'),_0x566a('0x2'),_0x566a('0x3')];function createListener(_0x137a79,_0x25ffa8){return function(_0xfbc7d0){_0x25ffa8[_0x566a('0x4')](_0x137a79,_0xfbc7d0);};}function removeListener(_0x1662ee,_0x807fcb){return function(){FaxInteractionEvents['removeListener'](_0x1662ee,_0x807fcb);};}exports[_0x566a('0x5')]=function(_0x1c4f07){for(var _0x2080fc=0x0,_0x4cba49=events[_0x566a('0x6')];_0x2080fc<_0x4cba49;_0x2080fc++){var _0x56c752=events[_0x2080fc];var _0x590fdc=createListener(_0x566a('0x7')+_0x56c752,_0x1c4f07);FaxInteractionEvents['on'](_0x56c752,_0x590fdc);}}; \ No newline at end of file +var _0x0efa=['length','./faxInteraction.events','save','emit','removeListener','register'];(function(_0x19a10f,_0x4a9f7d){var _0x153553=function(_0x443a12){while(--_0x443a12){_0x19a10f['push'](_0x19a10f['shift']());}};_0x153553(++_0x4a9f7d);}(_0x0efa,0xfd));var _0xa0ef=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0x0efa[_0x1cb18a];return _0x22442e;};'use strict';var FaxInteractionEvents=require(_0xa0ef('0x0'));var events=[_0xa0ef('0x1'),'remove','update'];function createListener(_0x51ff01,_0x3005d9){return function(_0x4ff393){_0x3005d9[_0xa0ef('0x2')](_0x51ff01,_0x4ff393);};}function removeListener(_0x2fff6e,_0x463461){return function(){FaxInteractionEvents[_0xa0ef('0x3')](_0x2fff6e,_0x463461);};}exports[_0xa0ef('0x4')]=function(_0x4f43e0){for(var _0x575c75=0x0,_0x21e9a5=events[_0xa0ef('0x5')];_0x575c75<_0x21e9a5;_0x575c75++){var _0x3cc70c=events[_0x575c75];var _0x35de17=createListener('faxInteraction:'+_0x3cc70c,_0x4f43e0);FaxInteractionEvents['on'](_0x3cc70c,_0x35de17);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index c228ecc..6bdc0d5 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 _0xfb3f=['put','faxinteraction:update','update','delete','destroy','removeTags','exports','multer','util','connect-timeout','../../components/auth/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','getMessages','/:id/download','download','post','/:id/messages','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags'];(function(_0x262081,_0x40ab09){var _0x1826ba=function(_0x164b27){while(--_0x164b27){_0x262081['push'](_0x262081['shift']());}};_0x1826ba(++_0x40ab09);}(_0xfb3f,0xd9));var _0xffb3=function(_0x4c3b5c,_0x1da01e){_0x4c3b5c=_0x4c3b5c-0x0;var _0xa08c3=_0xfb3f[_0x4c3b5c];return _0xa08c3;};'use strict';var multer=require(_0xffb3('0x0'));var util=require(_0xffb3('0x1'));var path=require('path');var timeout=require(_0xffb3('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xffb3('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xffb3('0x4'));var controller=require(_0xffb3('0x5'));router[_0xffb3('0x6')]('/',auth[_0xffb3('0x7')](),controller[_0xffb3('0x8')]);router[_0xffb3('0x6')](_0xffb3('0x9'),auth[_0xffb3('0x7')](),controller['describe']);router[_0xffb3('0x6')](_0xffb3('0xa'),auth[_0xffb3('0x7')](),controller[_0xffb3('0xb')]);router[_0xffb3('0x6')]('/:id/messages',auth[_0xffb3('0x7')](),controller[_0xffb3('0xc')]);router[_0xffb3('0x6')](_0xffb3('0xd'),auth[_0xffb3('0x7')](),controller[_0xffb3('0xe')]);router[_0xffb3('0xf')]('/',auth[_0xffb3('0x7')](),controller['create']);router[_0xffb3('0xf')](_0xffb3('0x10'),auth['isAuthenticated'](),controller[_0xffb3('0x11')]);router[_0xffb3('0xf')](_0xffb3('0x12'),auth[_0xffb3('0x7')](),interaction[_0xffb3('0x13')](_0xffb3('0x14'),_0xffb3('0x15')),controller[_0xffb3('0x16')]);router[_0xffb3('0x17')](_0xffb3('0xa'),auth[_0xffb3('0x7')](),interaction[_0xffb3('0x13')]('fax',_0xffb3('0x18')),controller[_0xffb3('0x19')]);router[_0xffb3('0x1a')]('/:id',auth['isAuthenticated'](),interaction[_0xffb3('0x13')](_0xffb3('0x14'),'faxinteraction:destroy'),controller[_0xffb3('0x1b')]);router[_0xffb3('0x1a')](_0xffb3('0x12'),auth['isAuthenticated'](),controller[_0xffb3('0x1c')]);module[_0xffb3('0x1d')]=router; \ No newline at end of file +var _0xd9d9=['put','fax','faxinteraction:update','update','delete','removeTags','util','path','express','../../components/auth/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','describe','/:id','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','addTags'];(function(_0x4dbff0,_0xd80451){var _0xf762b6=function(_0x3b5c4f){while(--_0x3b5c4f){_0x4dbff0['push'](_0x4dbff0['shift']());}};_0xf762b6(++_0xd80451);}(_0xd9d9,0xa2));var _0x9d9d=function(_0xb41c12,_0x26d976){_0xb41c12=_0xb41c12-0x0;var _0x1d7ff0=_0xd9d9[_0xb41c12];return _0x1d7ff0;};'use strict';var multer=require('multer');var util=require(_0x9d9d('0x0'));var path=require(_0x9d9d('0x1'));var timeout=require('connect-timeout');var express=require(_0x9d9d('0x2'));var router=express['Router']();var auth=require(_0x9d9d('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x9d9d('0x4'));var controller=require(_0x9d9d('0x5'));router[_0x9d9d('0x6')]('/',auth[_0x9d9d('0x7')](),controller['index']);router[_0x9d9d('0x6')]('/describe',auth[_0x9d9d('0x7')](),controller[_0x9d9d('0x8')]);router[_0x9d9d('0x6')](_0x9d9d('0x9'),auth['isAuthenticated'](),controller['show']);router['get'](_0x9d9d('0xa'),auth['isAuthenticated'](),controller[_0x9d9d('0xb')]);router['get'](_0x9d9d('0xc'),auth[_0x9d9d('0x7')](),controller[_0x9d9d('0xd')]);router[_0x9d9d('0xe')]('/',auth[_0x9d9d('0x7')](),controller[_0x9d9d('0xf')]);router[_0x9d9d('0xe')]('/:id/messages',auth['isAuthenticated'](),controller[_0x9d9d('0x10')]);router[_0x9d9d('0xe')](_0x9d9d('0x11'),auth[_0x9d9d('0x7')](),interaction[_0x9d9d('0x12')]('fax','faxinteraction:addtags'),controller[_0x9d9d('0x13')]);router[_0x9d9d('0x14')](_0x9d9d('0x9'),auth[_0x9d9d('0x7')](),interaction[_0x9d9d('0x12')](_0x9d9d('0x15'),_0x9d9d('0x16')),controller[_0x9d9d('0x17')]);router[_0x9d9d('0x18')](_0x9d9d('0x9'),auth[_0x9d9d('0x7')](),interaction[_0x9d9d('0x12')]('fax','faxinteraction:destroy'),controller['destroy']);router[_0x9d9d('0x18')](_0x9d9d('0x11'),auth[_0x9d9d('0x7')](),controller[_0x9d9d('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index bb14ba0..74ca195 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 _0x5486=['out','DATE','exports','TEXT','BOOLEAN'];(function(_0x2012f2,_0x2c92c9){var _0x10973a=function(_0xdf474d){while(--_0xdf474d){_0x2012f2['push'](_0x2012f2['shift']());}};_0x10973a(++_0x2c92c9);}(_0x5486,0x129));var _0x6548=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5486[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x6548('0x0')]={'body':{'type':Sequelize[_0x6548('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x6548('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x6548('0x3')),'defaultValue':_0x6548('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x6548('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x6548('0x4')]}}; \ No newline at end of file +var _0xfe14=['ENUM','out','TEXT','DATE','sequelize','exports','medium'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xfe14,0x9e));var _0x4fe1=function(_0x5618c4,_0x4e8f57){_0x5618c4=_0x5618c4-0x0;var _0xdf390f=_0xfe14[_0x5618c4];return _0xdf390f;};'use strict';var Sequelize=require(_0x4fe1('0x0'));module[_0x4fe1('0x1')]={'body':{'type':Sequelize['TEXT'](_0x4fe1('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x4fe1('0x3')]('in','out'),'defaultValue':_0x4fe1('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x4fe1('0x5')],'defaultValue':null},'readAt':{'type':Sequelize[_0x4fe1('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index e808add..ac8fd7b 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 _0x500e=['../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','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','FaxMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','destroy','stack','name','send','index','FaxMessage','rawAttributes','key','map','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','findAll','rows','show','params','find','body','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','user','Contact','FaxInteraction','FaxInteractionId','update','UserId','isNil','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','interface','SIP/%s','channel','event','EventManager','acceptmessage','agent','get','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectmessage','create','CmContact','findOne','ContactId','Attachment','AttachmentId','SendFax','basename','download','root','files','attachments','join','html-pdf','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x5e690b,_0x5ed4b7){var _0x15681e=function(_0xe60d3d){while(--_0xe60d3d){_0x5e690b['push'](_0x5e690b['shift']());}};_0x15681e(++_0x5ed4b7);}(_0x500e,0x1ec));var _0xe500=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x500e[_0x3947c9];return _0x2e7871;};'use strict';var pdf=require(_0xe500('0x0'));var emlformat=require(_0xe500('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe500('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe500('0x3'));var Mustache=require(_0xe500('0x4'));var util=require(_0xe500('0x5'));var path=require(_0xe500('0x6'));var sox=require(_0xe500('0x7'));var csv=require(_0xe500('0x8'));var ejs=require(_0xe500('0x9'));var fs=require('fs');var _=require(_0xe500('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe500('0xb'));var deskjs=require(_0xe500('0xc'));var toCsv=require(_0xe500('0x8'));var querystring=require(_0xe500('0xd'));var Papa=require(_0xe500('0xe'));var Redis=require('ioredis');var authService=require(_0xe500('0xf'));var qs=require(_0xe500('0x10'));var as=require(_0xe500('0x11'));var hardwareService=require(_0xe500('0x12'));var logger=require(_0xe500('0x13'))('api');var utils=require(_0xe500('0x14'));var config=require(_0xe500('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xe500('0x16')](config[_0xe500('0x17')],{'host':_0xe500('0x18'),'port':0x18eb});var socket=require(_0xe500('0x19'))(new Redis(config[_0xe500('0x17')]));require('./faxMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xe500('0x1a')][_0xe500('0x1b')]({'port':0x232c});var client9002=jayson[_0xe500('0x1a')][_0xe500('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x3ae75d,_0x2fa300,_0x2b37bc){if(_0x2b37bc){var _0xb123f3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xb123f3[_0xe500('0x1c')](_0x2fa300)){return _0x3ae75d;}else{throw new db[(_0xe500('0x1d'))]['ValidationError'](_0xe500('0x1e'));}}else{return _0x3ae75d;}}function respondWithRpcPromise(_0xddbc17,_0x2f7397,_0x1baacd,_0x29bbd0){return new BPromise(function(_0x39c1de,_0x4634b1){var _0x1cf2cc=_0x29bbd0||client;return _0x1cf2cc['request'](_0xddbc17,_0x1baacd)[_0xe500('0x1f')](function(_0x5b4472){logger[_0xe500('0x20')](_0xe500('0x21'),_0x2f7397,'request\x20sent');logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x2f7397,_0xe500('0x22'),JSON[_0xe500('0x23')](_0x5b4472));if(_0x5b4472['error']){if(_0x5b4472[_0xe500('0x24')]['code']===0x1f4){logger[_0xe500('0x24')](_0xe500('0x21'),_0x2f7397,_0x5b4472[_0xe500('0x24')][_0xe500('0x25')]);return _0x4634b1(_0x5b4472[_0xe500('0x24')]['message']);}logger[_0xe500('0x24')](_0xe500('0x21'),_0x2f7397,_0x5b4472['error'][_0xe500('0x25')]);return _0x39c1de(_0x5b4472[_0xe500('0x24')]['message']);}else{logger[_0xe500('0x20')](_0xe500('0x21'),_0x2f7397,_0xe500('0x22'));_0x39c1de(_0x5b4472[_0xe500('0x26')]['message']);}})[_0xe500('0x27')](function(_0x49c6a8){logger[_0xe500('0x24')](_0xe500('0x21'),_0x2f7397,_0x49c6a8);_0x4634b1(_0x49c6a8);});});}function respondWithStatusCode(_0x2e8ab6,_0x17fb23){_0x17fb23=_0x17fb23||0xcc;return function(_0x9741d5){if(_0x9741d5){return _0x2e8ab6[_0xe500('0x28')](_0x17fb23);}return _0x2e8ab6['status'](_0x17fb23)[_0xe500('0x29')]();};}function respondWithResult(_0x14d65d,_0x5a38ef){_0x5a38ef=_0x5a38ef||0xc8;return function(_0x30d5c5){if(_0x30d5c5){return _0x14d65d[_0xe500('0x2a')](_0x5a38ef)['json'](_0x30d5c5);}};}function respondWithFilteredResult(_0x3ada29,_0x562323){return function(_0x4044db){if(_0x4044db){var _0x2c5ffe=_0x4044db[_0xe500('0x2b')],_0x42e2d1=_0x562323[_0xe500('0x2c')],_0x17cd5a=_0x562323['offset']+_0x562323[_0xe500('0x2d')],_0x227c28;if(_0x17cd5a>=_0x2c5ffe){_0x17cd5a=_0x2c5ffe;_0x227c28=0xc8;}else{_0x227c28=0xce;}_0x3ada29[_0xe500('0x2a')](_0x227c28);return _0x3ada29[_0xe500('0x2e')](_0xe500('0x2f'),_0x42e2d1+'-'+_0x17cd5a+'/'+_0x2c5ffe)[_0xe500('0x30')](_0x4044db);}return null;};}function patchUpdates(_0x25cbaa){return function(_0x25f31c){try{jsonpatch[_0xe500('0x31')](_0x25f31c,_0x25cbaa,!![]);}catch(_0x2e9658){return BPromise[_0xe500('0x32')](_0x2e9658);}return _0x25f31c[_0xe500('0x33')]();};}function saveUpdates(_0x34b69d,_0x49816c){return function(_0x1629d3){if(_0x1629d3){return _0x1629d3['update'](_0x34b69d)[_0xe500('0x1f')](function(_0x2c8456){return _0x2c8456;});}return null;};}function removeEntity(_0x488e26,_0x4427c0){return function(_0x137719){if(_0x137719){return _0x137719[_0xe500('0x34')]()[_0xe500('0x1f')](function(){_0x488e26[_0xe500('0x2a')](0xcc)[_0xe500('0x29')]();});}};}function handleEntityNotFound(_0x3234f8,_0x1cab8d){return function(_0x37b107){if(!_0x37b107){_0x3234f8[_0xe500('0x28')](0x194);}return _0x37b107;};}function handleError(_0x5e2342,_0x237fa6){_0x237fa6=_0x237fa6||0x1f4;return function(_0x56ae53){logger[_0xe500('0x24')](_0x56ae53[_0xe500('0x35')]);if(_0x56ae53[_0xe500('0x36')]){delete _0x56ae53[_0xe500('0x36')];}_0x5e2342[_0xe500('0x2a')](_0x237fa6)[_0xe500('0x37')](_0x56ae53);};}exports[_0xe500('0x38')]=function(_0x182050,_0x159e42){var _0x184368={},_0x2934a9={},_0xcbcd0e={'count':0x0,'rows':[]};var _0x5bf3ac=_['map'](db[_0xe500('0x39')][_0xe500('0x3a')],function(_0x52b584){return{'name':_0x52b584['fieldName'],'type':_0x52b584['type'][_0xe500('0x3b')]};});_0x2934a9['model']=_[_0xe500('0x3c')](_0x5bf3ac,'name');_0x2934a9['query']=_[_0xe500('0x3d')](_0x182050[_0xe500('0x3e')]);_0x2934a9[_0xe500('0x3f')]=_[_0xe500('0x40')](_0x2934a9[_0xe500('0x41')],_0x2934a9['query']);_0x184368[_0xe500('0x42')]=_[_0xe500('0x40')](_0x2934a9[_0xe500('0x41')],qs[_0xe500('0x43')](_0x182050[_0xe500('0x3e')]['fields']));_0x184368['attributes']=_0x184368[_0xe500('0x42')][_0xe500('0x44')]?_0x184368[_0xe500('0x42')]:_0x2934a9[_0xe500('0x41')];if(!_0x182050[_0xe500('0x3e')]['hasOwnProperty'](_0xe500('0x45'))){_0x184368[_0xe500('0x2d')]=qs[_0xe500('0x2d')](_0x182050['query']['limit']);_0x184368[_0xe500('0x2c')]=qs['offset'](_0x182050[_0xe500('0x3e')][_0xe500('0x2c')]);}_0x184368[_0xe500('0x46')]=qs[_0xe500('0x47')](_0x182050['query'][_0xe500('0x47')]);_0x184368[_0xe500('0x48')]=qs[_0xe500('0x3f')](_[_0xe500('0x49')](_0x182050[_0xe500('0x3e')],_0x2934a9[_0xe500('0x3f')]),_0x5bf3ac);if(_0x182050['query'][_0xe500('0x4a')]){_0x184368['where']=_[_0xe500('0x4b')](_0x184368['where'],{'$or':_['map'](_0x5bf3ac,function(_0x3b8fa0){if(_0x3b8fa0[_0xe500('0x4c')]!=='VIRTUAL'){var _0x45984d={};_0x45984d[_0x3b8fa0[_0xe500('0x36')]]={'$like':'%'+_0x182050[_0xe500('0x3e')]['filter']+'%'};return _0x45984d;}})});}_0x184368=_[_0xe500('0x4b')]({},_0x184368,_0x182050[_0xe500('0x4d')]);var _0x545802={'where':_0x184368[_0xe500('0x48')]};return db[_0xe500('0x39')][_0xe500('0x2b')](_0x545802)[_0xe500('0x1f')](function(_0x5ba81a){_0xcbcd0e[_0xe500('0x2b')]=_0x5ba81a;if(_0x182050[_0xe500('0x3e')][_0xe500('0x4e')]){_0x184368['include']=[{'all':!![]}];}return db[_0xe500('0x39')][_0xe500('0x4f')](_0x184368);})[_0xe500('0x1f')](function(_0x33e056){_0xcbcd0e[_0xe500('0x50')]=_0x33e056;return _0xcbcd0e;})[_0xe500('0x1f')](respondWithFilteredResult(_0x159e42,_0x184368))[_0xe500('0x27')](handleError(_0x159e42,null));};exports[_0xe500('0x51')]=function(_0x4883f8,_0x215407){var _0x2a973c={'raw':!![],'where':{'id':_0x4883f8[_0xe500('0x52')]['id']}},_0x386946={};_0x386946[_0xe500('0x41')]=_[_0xe500('0x3d')](db[_0xe500('0x39')][_0xe500('0x3a')]);_0x386946[_0xe500('0x3e')]=_[_0xe500('0x3d')](_0x4883f8[_0xe500('0x3e')]);_0x386946['filters']=_[_0xe500('0x40')](_0x386946[_0xe500('0x41')],_0x386946[_0xe500('0x3e')]);_0x2a973c[_0xe500('0x42')]=_['intersection'](_0x386946[_0xe500('0x41')],qs[_0xe500('0x43')](_0x4883f8['query'][_0xe500('0x43')]));_0x2a973c[_0xe500('0x42')]=_0x2a973c[_0xe500('0x42')][_0xe500('0x44')]?_0x2a973c[_0xe500('0x42')]:_0x386946['model'];if(_0x4883f8[_0xe500('0x3e')][_0xe500('0x4e')]){_0x2a973c['include']=[{'all':!![]}];}_0x2a973c=_[_0xe500('0x4b')]({},_0x2a973c,_0x4883f8[_0xe500('0x4d')]);return db[_0xe500('0x39')][_0xe500('0x53')](_0x2a973c)[_0xe500('0x1f')](handleEntityNotFound(_0x215407,null))[_0xe500('0x1f')](respondWithResult(_0x215407,null))[_0xe500('0x27')](handleError(_0x215407,null));};exports['update']=function(_0x4f5958,_0x4eb683){if(_0x4f5958['body']['id']){delete _0x4f5958['body']['id'];}return db[_0xe500('0x39')][_0xe500('0x53')]({'where':{'id':_0x4f5958[_0xe500('0x52')]['id']}})[_0xe500('0x1f')](handleEntityNotFound(_0x4eb683,null))[_0xe500('0x1f')](saveUpdates(_0x4f5958[_0xe500('0x54')],null))[_0xe500('0x1f')](respondWithResult(_0x4eb683,null))[_0xe500('0x27')](handleError(_0x4eb683,null));};exports[_0xe500('0x34')]=function(_0x184a97,_0x3caf9f){return db[_0xe500('0x39')]['find']({'where':{'id':_0x184a97[_0xe500('0x52')]['id']}})[_0xe500('0x1f')](handleEntityNotFound(_0x3caf9f,null))[_0xe500('0x1f')](removeEntity(_0x3caf9f,null))[_0xe500('0x27')](handleError(_0x3caf9f,null));};exports[_0xe500('0x55')]=function(_0x451a06,_0x3d3521){return db[_0xe500('0x39')][_0xe500('0x55')]()[_0xe500('0x1f')](respondWithResult(_0x3d3521,null))['catch'](handleError(_0x3d3521,null));};var interaction_log=require('../../config/logger')(_0xe500('0x56'));exports[_0xe500('0x57')]=function(_0xa4f5c,_0x2dc73e,_0x3be969){var _0x4e6919={'channel':_0xe500('0x58')};if(_0xa4f5c[_0xe500('0x54')]['id']){delete _0xa4f5c[_0xe500('0x54')]['id'];}_0xa4f5c[_0xe500('0x54')][_0xe500('0x59')]=!![];_0xa4f5c[_0xe500('0x54')][_0xe500('0x5a')]=moment()[_0xe500('0x5b')](_0xe500('0x5c'));_0xa4f5c[_0xe500('0x54')]['UserId']=_0xa4f5c[_0xe500('0x54')]['UserId']||_0xa4f5c[_0xe500('0x5d')]['id'];return db[_0xe500('0x39')][_0xe500('0x53')]({'where':{'id':_0xa4f5c[_0xe500('0x52')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xe500('0x5e')}]})[_0xe500('0x1f')](handleEntityNotFound(_0x2dc73e,null))['then'](saveUpdates(_0xa4f5c[_0xe500('0x54')],null))['then'](function(_0x53fcea){if(_0x53fcea){_0x4e6919['message']=_0x53fcea['get']({'plain':!![]});return db[_0xe500('0x5f')]['find']({'where':{'id':_0x53fcea[_0xe500('0x60')]}});}return null;})[_0xe500('0x1f')](handleEntityNotFound(_0x2dc73e,null))[_0xe500('0x1f')](function(_0x497b83){if(_0x497b83){return _0x497b83[_0xe500('0x61')]({'UserId':_0xa4f5c[_0xe500('0x54')][_0xe500('0x62')],'read1stAt':_[_0xe500('0x63')](_0x497b83['read1stAt'])?moment()[_0xe500('0x5b')](_0xe500('0x5c')):undefined});}return null;})[_0xe500('0x1f')](function(_0x3aa5c5){if(_0x3aa5c5){_0x4e6919[_0xe500('0x64')]=_0x3aa5c5['get']({'plain':!![]});interaction_log[_0xe500('0x20')](_0xe500('0x65'),_0xa4f5c[_0xe500('0x5d')]['id'],_0xa4f5c[_0xe500('0x5d')][_0xe500('0x36')],_0xa4f5c[_0xe500('0x5d')][_0xe500('0x66')],_0x4e6919[_0xe500('0x64')]['id'],_0xa4f5c['body']?JSON[_0xe500('0x23')](_0xa4f5c['body']):_0xe500('0x67'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x4e6919);}return null;})[_0xe500('0x1f')](function(_0x35d9d5){if(_0x35d9d5){if(_0xa4f5c['body']['manual']){_0x4e6919[_0xe500('0x25')][_0xe500('0x68')]=util['format'](_0xe500('0x69'),_0xa4f5c['user'][_0xe500('0x36')]);_0x4e6919[_0xe500('0x25')][_0xe500('0x6a')]=_0x4e6919['channel'];_0x4e6919[_0xe500('0x25')][_0xe500('0x6b')]=_0xe500('0x57');return respondWithRpcPromise(_0xe500('0x6c'),'EventManager',{'event':_0xe500('0x6d'),'message':_0x4e6919[_0xe500('0x25')]},client9002)['then'](function(){return _0x4e6919;});}return _0x4e6919;}return null;})[_0xe500('0x1f')](respondWithResult(_0x2dc73e,null))[_0xe500('0x27')](handleError(_0x2dc73e,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0xe500('0x32')]=function(_0x22a9f,_0x1e8152,_0x15ad38){var _0x3e7886={'agent':{},'channel':'fax'};if(_0x22a9f[_0xe500('0x54')]['id']){delete _0x22a9f['body']['id'];}_0x22a9f[_0xe500('0x54')][_0xe500('0x62')]=_0x22a9f['body']['UserId']||_0x22a9f[_0xe500('0x5d')]['id'];_0x3e7886[_0xe500('0x6e')]['id']=_0x22a9f[_0xe500('0x54')]['UserId'];return db[_0xe500('0x39')]['find']({'where':{'id':_0x22a9f[_0xe500('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1e8152,null))[_0xe500('0x1f')](function(_0x5e9576){if(_0x5e9576){_0x3e7886['message']=_0x5e9576[_0xe500('0x6f')]({'plain':!![]});return db[_0xe500('0x5f')]['find']({'where':{'id':_0x5e9576[_0xe500('0x60')]}});}return null;})[_0xe500('0x1f')](handleEntityNotFound(_0x1e8152,null))[_0xe500('0x1f')](function(_0x51c07c){if(_0x51c07c){_0x3e7886[_0xe500('0x64')]=_0x51c07c[_0xe500('0x6f')]({'plain':!![]});interaction_log[_0xe500('0x20')](_0xe500('0x70'),_0x22a9f[_0xe500('0x5d')]['id'],_0x22a9f['user'][_0xe500('0x36')],_0x22a9f['user'][_0xe500('0x66')],_0x3e7886['interaction']['id'],_0x22a9f['body']?JSON[_0xe500('0x23')](_0x22a9f[_0xe500('0x54')]):'null');return respondWithRpcPromise(_0xe500('0x71'),'rejectMessage',_0x3e7886);}return null;})[_0xe500('0x1f')](function(_0x5a566b){if(_0x5a566b){_0x5a566b[_0xe500('0x25')][_0xe500('0x68')]=util[_0xe500('0x5b')](_0xe500('0x69'),_0x22a9f[_0xe500('0x5d')]['name']);_0x5a566b[_0xe500('0x25')][_0xe500('0x6a')]=_0x3e7886[_0xe500('0x6a')];_0x5a566b[_0xe500('0x25')][_0xe500('0x6b')]=_0xe500('0x32');respondWithRpcPromise(_0xe500('0x6c'),'EventManager',{'event':_0xe500('0x72'),'message':_0x5a566b[_0xe500('0x25')]},client9002);return _0x3e7886;}return null;})['then'](respondWithResult(_0x1e8152,null))[_0xe500('0x27')](handleError(_0x1e8152,null));};exports[_0xe500('0x73')]=function(_0x40c061,_0x246eb3){var _0x50224d;return db[_0xe500('0x39')]['create'](_0x40c061[_0xe500('0x54')],{})[_0xe500('0x1f')](function(_0x1c8e97){_0x50224d=_0x1c8e97;return db[_0xe500('0x74')][_0xe500('0x75')]({'where':{'id':_0x50224d[_0xe500('0x76')]}});})['then'](function(_0x27ee84){if(_[_0xe500('0x63')](_0x27ee84)){return;}else{_0x50224d['fax']=_0x27ee84[_0xe500('0x58')];return db[_0xe500('0x77')][_0xe500('0x75')]({'where':{'id':_0x50224d[_0xe500('0x78')]}});}})[_0xe500('0x1f')](function(_0x4d27a9){return respondWithRpcPromise(_0xe500('0x79'),'SendFax',{'FaxAccountId':_[_0xe500('0x63')](_0x40c061[_0xe500('0x54')])?undefined:_0x40c061[_0xe500('0x54')]['FaxAccountId'],'path':_[_0xe500('0x63')](_0x4d27a9)?undefined:util[_0xe500('0x5b')]('/var/opt/motion2/server/files/attachments/%s',_0x4d27a9[_0xe500('0x7a')]),'fax':_[_0xe500('0x63')](_0x50224d[_0xe500('0x58')])?undefined:_0x50224d[_0xe500('0x58')],'AttachmentId':_0x50224d[_0xe500('0x78')]},client9002);})[_0xe500('0x1f')](respondWithResult(_0x246eb3,0xc9))[_0xe500('0x27')](handleError(_0x246eb3,null));};exports[_0xe500('0x7b')]=function(_0x21ae4e,_0x4c8bf3){var _0x4be786=path['join'](config[_0xe500('0x7c')],'server',_0xe500('0x7d'),_0xe500('0x7e'));return db[_0xe500('0x39')][_0xe500('0x53')]({'where':{'id':_0x21ae4e['params']['id']},'include':[{'model':db[_0xe500('0x77')],'as':_0xe500('0x77')}]})[_0xe500('0x1f')](handleEntityNotFound(_0x4c8bf3,null))[_0xe500('0x1f')](function(_0x57cb51){if(_0x57cb51){return _0x4c8bf3[_0xe500('0x7b')](path[_0xe500('0x7f')](_0x4be786,_0x57cb51[_0xe500('0x77')]['basename']));}})[_0xe500('0x27')](handleError(_0x4c8bf3,null));}; \ No newline at end of file +var _0xeaa2=['redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','status','json','count','offset','Content-Range','apply','reject','update','destroy','name','index','map','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','merge','options','FaxMessage','includeAll','include','findAll','rows','find','body','params','catch','describe','accept','fax','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','manual','interface','format','SIP/%s','event','EventManager','acceptmessage','agent','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','channel','create','ContactId','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','download','join','server','files','attachments','Attachment','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','util','sox','to-csv','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x24ed7c,_0x24c7a5){var _0x510146=function(_0x2f86f4){while(--_0x2f86f4){_0x24ed7c['push'](_0x24ed7c['shift']());}};_0x510146(++_0x24c7a5);}(_0xeaa2,0x6f));var _0x2eaa=function(_0x36e059,_0x19ee27){_0x36e059=_0x36e059-0x0;var _0x52ee13=_0xeaa2[_0x36e059];return _0x52ee13;};'use strict';var pdf=require(_0x2eaa('0x0'));var emlformat=require(_0x2eaa('0x1'));var rimraf=require(_0x2eaa('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2eaa('0x3'));var rp=require(_0x2eaa('0x4'));var moment=require(_0x2eaa('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2eaa('0x6'));var path=require('path');var sox=require(_0x2eaa('0x7'));var csv=require(_0x2eaa('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2eaa('0x9'));var squel=require('squel');var crypto=require(_0x2eaa('0xa'));var jsforce=require(_0x2eaa('0xb'));var deskjs=require(_0x2eaa('0xc'));var toCsv=require(_0x2eaa('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2eaa('0xd'));var authService=require(_0x2eaa('0xe'));var qs=require(_0x2eaa('0xf'));var as=require(_0x2eaa('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2eaa('0x11'))(_0x2eaa('0x12'));var utils=require(_0x2eaa('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x2eaa('0x14')]=_[_0x2eaa('0x15')](config[_0x2eaa('0x14')],{'host':_0x2eaa('0x16'),'port':0x18eb});var socket=require(_0x2eaa('0x17'))(new Redis(config['redis']));require(_0x2eaa('0x18'))['register'](socket);var jayson=require(_0x2eaa('0x19'));var client=jayson[_0x2eaa('0x1a')][_0x2eaa('0x1b')]({'port':0x232c});var client9002=jayson[_0x2eaa('0x1a')][_0x2eaa('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x29252c,_0x570b72,_0x4c05e6){if(_0x4c05e6){var _0x575cd9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x575cd9[_0x2eaa('0x1c')](_0x570b72)){return _0x29252c;}else{throw new db[(_0x2eaa('0x1d'))][(_0x2eaa('0x1e'))](_0x2eaa('0x1f'));}}else{return _0x29252c;}}function respondWithRpcPromise(_0x3c93fb,_0x3adff3,_0x1f81e6,_0x12bcdb){return new BPromise(function(_0x33272a,_0x55d5f0){var _0x41305f=_0x12bcdb||client;return _0x41305f[_0x2eaa('0x20')](_0x3c93fb,_0x1f81e6)[_0x2eaa('0x21')](function(_0x108960){logger[_0x2eaa('0x22')](_0x2eaa('0x23'),_0x3adff3,_0x2eaa('0x24'));logger[_0x2eaa('0x25')](_0x2eaa('0x26'),_0x3adff3,_0x2eaa('0x24'),JSON[_0x2eaa('0x27')](_0x108960));if(_0x108960[_0x2eaa('0x28')]){if(_0x108960[_0x2eaa('0x28')][_0x2eaa('0x29')]===0x1f4){logger['error'](_0x2eaa('0x23'),_0x3adff3,_0x108960[_0x2eaa('0x28')][_0x2eaa('0x2a')]);return _0x55d5f0(_0x108960[_0x2eaa('0x28')][_0x2eaa('0x2a')]);}logger[_0x2eaa('0x28')](_0x2eaa('0x23'),_0x3adff3,_0x108960['error'][_0x2eaa('0x2a')]);return _0x33272a(_0x108960['error'][_0x2eaa('0x2a')]);}else{logger[_0x2eaa('0x22')](_0x2eaa('0x23'),_0x3adff3,_0x2eaa('0x24'));_0x33272a(_0x108960[_0x2eaa('0x2b')][_0x2eaa('0x2a')]);}})['catch'](function(_0xfec41d){logger[_0x2eaa('0x28')](_0x2eaa('0x23'),_0x3adff3,_0xfec41d);_0x55d5f0(_0xfec41d);});});}function respondWithStatusCode(_0x24f0b0,_0x1a6c9b){_0x1a6c9b=_0x1a6c9b||0xcc;return function(_0x2480b4){if(_0x2480b4){return _0x24f0b0[_0x2eaa('0x2c')](_0x1a6c9b);}return _0x24f0b0['status'](_0x1a6c9b)[_0x2eaa('0x2d')]();};}function respondWithResult(_0x368ecc,_0x1007e9){_0x1007e9=_0x1007e9||0xc8;return function(_0x43aa62){if(_0x43aa62){return _0x368ecc[_0x2eaa('0x2e')](_0x1007e9)[_0x2eaa('0x2f')](_0x43aa62);}};}function respondWithFilteredResult(_0xc08dcd,_0x4283e8){return function(_0x305bdf){if(_0x305bdf){var _0x35339f=_0x305bdf[_0x2eaa('0x30')],_0x40095d=_0x4283e8[_0x2eaa('0x31')],_0x5883b2=_0x4283e8['offset']+_0x4283e8['limit'],_0x5e05f6;if(_0x5883b2>=_0x35339f){_0x5883b2=_0x35339f;_0x5e05f6=0xc8;}else{_0x5e05f6=0xce;}_0xc08dcd[_0x2eaa('0x2e')](_0x5e05f6);return _0xc08dcd['set'](_0x2eaa('0x32'),_0x40095d+'-'+_0x5883b2+'/'+_0x35339f)[_0x2eaa('0x2f')](_0x305bdf);}return null;};}function patchUpdates(_0x28862a){return function(_0x3cf454){try{jsonpatch[_0x2eaa('0x33')](_0x3cf454,_0x28862a,!![]);}catch(_0x2457a6){return BPromise[_0x2eaa('0x34')](_0x2457a6);}return _0x3cf454['save']();};}function saveUpdates(_0xf2282d,_0x41932e){return function(_0x43bca7){if(_0x43bca7){return _0x43bca7[_0x2eaa('0x35')](_0xf2282d)['then'](function(_0x48ebdd){return _0x48ebdd;});}return null;};}function removeEntity(_0x37665f,_0x550910){return function(_0x199372){if(_0x199372){return _0x199372[_0x2eaa('0x36')]()[_0x2eaa('0x21')](function(){_0x37665f[_0x2eaa('0x2e')](0xcc)[_0x2eaa('0x2d')]();});}};}function handleEntityNotFound(_0x2b40bc,_0xec1418){return function(_0x5816bc){if(!_0x5816bc){_0x2b40bc[_0x2eaa('0x2c')](0x194);}return _0x5816bc;};}function handleError(_0x4baa31,_0x326df9){_0x326df9=_0x326df9||0x1f4;return function(_0x5930e0){logger[_0x2eaa('0x28')](_0x5930e0['stack']);if(_0x5930e0[_0x2eaa('0x37')]){delete _0x5930e0['name'];}_0x4baa31[_0x2eaa('0x2e')](_0x326df9)['send'](_0x5930e0);};}exports[_0x2eaa('0x38')]=function(_0x194eac,_0x30878f){var _0x1bb925={},_0x12e8be={},_0x275b51={'count':0x0,'rows':[]};var _0x3e5120=_[_0x2eaa('0x39')](db['FaxMessage']['rawAttributes'],function(_0x32bc6c){return{'name':_0x32bc6c[_0x2eaa('0x3a')],'type':_0x32bc6c[_0x2eaa('0x3b')][_0x2eaa('0x3c')]};});_0x12e8be['model']=_[_0x2eaa('0x39')](_0x3e5120,_0x2eaa('0x37'));_0x12e8be[_0x2eaa('0x3d')]=_[_0x2eaa('0x3e')](_0x194eac['query']);_0x12e8be[_0x2eaa('0x3f')]=_[_0x2eaa('0x40')](_0x12e8be['model'],_0x12e8be[_0x2eaa('0x3d')]);_0x1bb925[_0x2eaa('0x41')]=_['intersection'](_0x12e8be[_0x2eaa('0x42')],qs[_0x2eaa('0x43')](_0x194eac[_0x2eaa('0x3d')][_0x2eaa('0x43')]));_0x1bb925[_0x2eaa('0x41')]=_0x1bb925[_0x2eaa('0x41')][_0x2eaa('0x44')]?_0x1bb925[_0x2eaa('0x41')]:_0x12e8be[_0x2eaa('0x42')];if(!_0x194eac['query'][_0x2eaa('0x45')](_0x2eaa('0x46'))){_0x1bb925['limit']=qs[_0x2eaa('0x47')](_0x194eac[_0x2eaa('0x3d')]['limit']);_0x1bb925[_0x2eaa('0x31')]=qs[_0x2eaa('0x31')](_0x194eac[_0x2eaa('0x3d')][_0x2eaa('0x31')]);}_0x1bb925[_0x2eaa('0x48')]=qs['sort'](_0x194eac[_0x2eaa('0x3d')][_0x2eaa('0x49')]);_0x1bb925['where']=qs['filters'](_[_0x2eaa('0x4a')](_0x194eac[_0x2eaa('0x3d')],_0x12e8be[_0x2eaa('0x3f')]),_0x3e5120);if(_0x194eac[_0x2eaa('0x3d')][_0x2eaa('0x4b')]){_0x1bb925[_0x2eaa('0x4c')]=_['merge'](_0x1bb925['where'],{'$or':_['map'](_0x3e5120,function(_0x5b65c1){if(_0x5b65c1[_0x2eaa('0x3b')]!==_0x2eaa('0x4d')){var _0x577e6d={};_0x577e6d[_0x5b65c1['name']]={'$like':'%'+_0x194eac['query']['filter']+'%'};return _0x577e6d;}})});}_0x1bb925=_[_0x2eaa('0x4e')]({},_0x1bb925,_0x194eac[_0x2eaa('0x4f')]);var _0xbc20b1={'where':_0x1bb925[_0x2eaa('0x4c')]};return db[_0x2eaa('0x50')][_0x2eaa('0x30')](_0xbc20b1)['then'](function(_0x4b9127){_0x275b51[_0x2eaa('0x30')]=_0x4b9127;if(_0x194eac[_0x2eaa('0x3d')][_0x2eaa('0x51')]){_0x1bb925[_0x2eaa('0x52')]=[{'all':!![]}];}return db['FaxMessage'][_0x2eaa('0x53')](_0x1bb925);})['then'](function(_0x56b813){_0x275b51[_0x2eaa('0x54')]=_0x56b813;return _0x275b51;})['then'](respondWithFilteredResult(_0x30878f,_0x1bb925))['catch'](handleError(_0x30878f,null));};exports['show']=function(_0x59712f,_0x420168){var _0x508b06={'raw':!![],'where':{'id':_0x59712f['params']['id']}},_0x50c1a1={};_0x50c1a1['model']=_[_0x2eaa('0x3e')](db[_0x2eaa('0x50')]['rawAttributes']);_0x50c1a1[_0x2eaa('0x3d')]=_[_0x2eaa('0x3e')](_0x59712f['query']);_0x50c1a1['filters']=_[_0x2eaa('0x40')](_0x50c1a1[_0x2eaa('0x42')],_0x50c1a1['query']);_0x508b06[_0x2eaa('0x41')]=_[_0x2eaa('0x40')](_0x50c1a1['model'],qs[_0x2eaa('0x43')](_0x59712f[_0x2eaa('0x3d')]['fields']));_0x508b06[_0x2eaa('0x41')]=_0x508b06[_0x2eaa('0x41')][_0x2eaa('0x44')]?_0x508b06[_0x2eaa('0x41')]:_0x50c1a1[_0x2eaa('0x42')];if(_0x59712f['query'][_0x2eaa('0x51')]){_0x508b06[_0x2eaa('0x52')]=[{'all':!![]}];}_0x508b06=_[_0x2eaa('0x4e')]({},_0x508b06,_0x59712f['options']);return db[_0x2eaa('0x50')][_0x2eaa('0x55')](_0x508b06)[_0x2eaa('0x21')](handleEntityNotFound(_0x420168,null))[_0x2eaa('0x21')](respondWithResult(_0x420168,null))['catch'](handleError(_0x420168,null));};exports[_0x2eaa('0x35')]=function(_0x27d765,_0x18544f){if(_0x27d765[_0x2eaa('0x56')]['id']){delete _0x27d765['body']['id'];}return db[_0x2eaa('0x50')][_0x2eaa('0x55')]({'where':{'id':_0x27d765[_0x2eaa('0x57')]['id']}})[_0x2eaa('0x21')](handleEntityNotFound(_0x18544f,null))['then'](saveUpdates(_0x27d765[_0x2eaa('0x56')],null))[_0x2eaa('0x21')](respondWithResult(_0x18544f,null))[_0x2eaa('0x58')](handleError(_0x18544f,null));};exports[_0x2eaa('0x36')]=function(_0x3cb361,_0x442cae){return db['FaxMessage']['find']({'where':{'id':_0x3cb361['params']['id']}})['then'](handleEntityNotFound(_0x442cae,null))[_0x2eaa('0x21')](removeEntity(_0x442cae,null))['catch'](handleError(_0x442cae,null));};exports[_0x2eaa('0x59')]=function(_0x186ae8,_0x25fe30){return db['FaxMessage']['describe']()['then'](respondWithResult(_0x25fe30,null))[_0x2eaa('0x58')](handleError(_0x25fe30,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0x2eaa('0x5a')]=function(_0x22d957,_0x51ca39,_0x3d79b4){var _0x28a0a3={'channel':_0x2eaa('0x5b')};if(_0x22d957['body']['id']){delete _0x22d957[_0x2eaa('0x56')]['id'];}_0x22d957[_0x2eaa('0x56')][_0x2eaa('0x5c')]=!![];_0x22d957[_0x2eaa('0x56')]['readAt']=moment()['format'](_0x2eaa('0x5d'));_0x22d957[_0x2eaa('0x56')][_0x2eaa('0x5e')]=_0x22d957['body'][_0x2eaa('0x5e')]||_0x22d957[_0x2eaa('0x5f')]['id'];return db[_0x2eaa('0x50')][_0x2eaa('0x55')]({'where':{'id':_0x22d957[_0x2eaa('0x57')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x2eaa('0x60')}]})[_0x2eaa('0x21')](handleEntityNotFound(_0x51ca39,null))[_0x2eaa('0x21')](saveUpdates(_0x22d957['body'],null))['then'](function(_0x5e7f1d){if(_0x5e7f1d){_0x28a0a3[_0x2eaa('0x2a')]=_0x5e7f1d[_0x2eaa('0x61')]({'plain':!![]});return db[_0x2eaa('0x62')][_0x2eaa('0x55')]({'where':{'id':_0x5e7f1d[_0x2eaa('0x63')]}});}return null;})[_0x2eaa('0x21')](handleEntityNotFound(_0x51ca39,null))[_0x2eaa('0x21')](function(_0x46ddff){if(_0x46ddff){return _0x46ddff[_0x2eaa('0x35')]({'UserId':_0x22d957[_0x2eaa('0x56')]['UserId'],'read1stAt':_[_0x2eaa('0x64')](_0x46ddff[_0x2eaa('0x65')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x2eaa('0x21')](function(_0x2c6be6){if(_0x2c6be6){_0x28a0a3[_0x2eaa('0x66')]=_0x2c6be6[_0x2eaa('0x61')]({'plain':!![]});interaction_log[_0x2eaa('0x22')](_0x2eaa('0x67'),_0x22d957[_0x2eaa('0x5f')]['id'],_0x22d957[_0x2eaa('0x5f')][_0x2eaa('0x37')],_0x22d957[_0x2eaa('0x5f')][_0x2eaa('0x68')],_0x28a0a3[_0x2eaa('0x66')]['id'],_0x22d957[_0x2eaa('0x56')]?JSON[_0x2eaa('0x27')](_0x22d957[_0x2eaa('0x56')]):'null');return respondWithRpcPromise(_0x2eaa('0x69'),_0x2eaa('0x6a'),_0x28a0a3);}return null;})[_0x2eaa('0x21')](function(_0x8ad18){if(_0x8ad18){if(_0x22d957[_0x2eaa('0x56')][_0x2eaa('0x6b')]){_0x28a0a3[_0x2eaa('0x2a')][_0x2eaa('0x6c')]=util[_0x2eaa('0x6d')](_0x2eaa('0x6e'),_0x22d957['user']['name']);_0x28a0a3[_0x2eaa('0x2a')]['channel']=_0x28a0a3['channel'];_0x28a0a3[_0x2eaa('0x2a')][_0x2eaa('0x6f')]=_0x2eaa('0x5a');return respondWithRpcPromise(_0x2eaa('0x70'),_0x2eaa('0x70'),{'event':_0x2eaa('0x71'),'message':_0x28a0a3[_0x2eaa('0x2a')]},client9002)[_0x2eaa('0x21')](function(){return _0x28a0a3;});}return _0x28a0a3;}return null;})[_0x2eaa('0x21')](respondWithResult(_0x51ca39,null))['catch'](handleError(_0x51ca39,null));};var interaction_log=require(_0x2eaa('0x11'))('fax-interactions');exports[_0x2eaa('0x34')]=function(_0x1556bb,_0x229569,_0x219ee3){var _0x33ff28={'agent':{},'channel':'fax'};if(_0x1556bb[_0x2eaa('0x56')]['id']){delete _0x1556bb['body']['id'];}_0x1556bb[_0x2eaa('0x56')][_0x2eaa('0x5e')]=_0x1556bb[_0x2eaa('0x56')]['UserId']||_0x1556bb['user']['id'];_0x33ff28[_0x2eaa('0x72')]['id']=_0x1556bb['body'][_0x2eaa('0x5e')];return db['FaxMessage'][_0x2eaa('0x55')]({'where':{'id':_0x1556bb[_0x2eaa('0x57')]['id'],'UserId':null}})[_0x2eaa('0x21')](handleEntityNotFound(_0x229569,null))[_0x2eaa('0x21')](function(_0x40798c){if(_0x40798c){_0x33ff28[_0x2eaa('0x2a')]=_0x40798c[_0x2eaa('0x61')]({'plain':!![]});return db['FaxInteraction'][_0x2eaa('0x55')]({'where':{'id':_0x40798c[_0x2eaa('0x63')]}});}return null;})[_0x2eaa('0x21')](handleEntityNotFound(_0x229569,null))[_0x2eaa('0x21')](function(_0x2e11d8){if(_0x2e11d8){_0x33ff28['interaction']=_0x2e11d8['get']({'plain':!![]});interaction_log[_0x2eaa('0x22')](_0x2eaa('0x73'),_0x1556bb[_0x2eaa('0x5f')]['id'],_0x1556bb[_0x2eaa('0x5f')][_0x2eaa('0x37')],_0x1556bb[_0x2eaa('0x5f')][_0x2eaa('0x68')],_0x33ff28[_0x2eaa('0x66')]['id'],_0x1556bb[_0x2eaa('0x56')]?JSON['stringify'](_0x1556bb['body']):'null');return respondWithRpcPromise(_0x2eaa('0x74'),'rejectMessage',_0x33ff28);}return null;})['then'](function(_0x3ca6be){if(_0x3ca6be){_0x3ca6be[_0x2eaa('0x2a')][_0x2eaa('0x6c')]=util[_0x2eaa('0x6d')](_0x2eaa('0x6e'),_0x1556bb[_0x2eaa('0x5f')][_0x2eaa('0x37')]);_0x3ca6be['message'][_0x2eaa('0x75')]=_0x33ff28['channel'];_0x3ca6be[_0x2eaa('0x2a')][_0x2eaa('0x6f')]=_0x2eaa('0x34');respondWithRpcPromise(_0x2eaa('0x70'),_0x2eaa('0x70'),{'event':'rejectmessage','message':_0x3ca6be[_0x2eaa('0x2a')]},client9002);return _0x33ff28;}return null;})[_0x2eaa('0x21')](respondWithResult(_0x229569,null))[_0x2eaa('0x58')](handleError(_0x229569,null));};exports[_0x2eaa('0x76')]=function(_0x4c78df,_0x5c6ba2){var _0x64ba70;return db[_0x2eaa('0x50')]['create'](_0x4c78df[_0x2eaa('0x56')],{})[_0x2eaa('0x21')](function(_0x17daea){_0x64ba70=_0x17daea;return db['CmContact']['findOne']({'where':{'id':_0x64ba70[_0x2eaa('0x77')]}});})[_0x2eaa('0x21')](function(_0x302a04){if(_[_0x2eaa('0x64')](_0x302a04)){return;}else{_0x64ba70[_0x2eaa('0x5b')]=_0x302a04[_0x2eaa('0x5b')];return db['Attachment'][_0x2eaa('0x78')]({'where':{'id':_0x64ba70[_0x2eaa('0x79')]}});}})[_0x2eaa('0x21')](function(_0x4b1ac7){return respondWithRpcPromise(_0x2eaa('0x7a'),_0x2eaa('0x7a'),{'FaxAccountId':_[_0x2eaa('0x64')](_0x4c78df[_0x2eaa('0x56')])?undefined:_0x4c78df[_0x2eaa('0x56')][_0x2eaa('0x7b')],'path':_['isNil'](_0x4b1ac7)?undefined:util[_0x2eaa('0x6d')](_0x2eaa('0x7c'),_0x4b1ac7['basename']),'fax':_[_0x2eaa('0x64')](_0x64ba70[_0x2eaa('0x5b')])?undefined:_0x64ba70[_0x2eaa('0x5b')],'AttachmentId':_0x64ba70[_0x2eaa('0x79')]},client9002);})[_0x2eaa('0x21')](respondWithResult(_0x5c6ba2,0xc9))[_0x2eaa('0x58')](handleError(_0x5c6ba2,null));};exports[_0x2eaa('0x7d')]=function(_0x8b3316,_0x395c39){var _0x5b1097=path[_0x2eaa('0x7e')](config['root'],_0x2eaa('0x7f'),_0x2eaa('0x80'),_0x2eaa('0x81'));return db[_0x2eaa('0x50')][_0x2eaa('0x55')]({'where':{'id':_0x8b3316['params']['id']},'include':[{'model':db[_0x2eaa('0x82')],'as':'Attachment'}]})[_0x2eaa('0x21')](handleEntityNotFound(_0x395c39,null))[_0x2eaa('0x21')](function(_0x172756){if(_0x172756){return _0x395c39[_0x2eaa('0x7d')](path[_0x2eaa('0x7e')](_0x5b1097,_0x172756[_0x2eaa('0x82')]['basename']));}})[_0x2eaa('0x58')](handleError(_0x395c39,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 4526984..a63ce85 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 _0x7217=['emit','hasOwnProperty','hook','exports','events','FaxMessage','setMaxListeners','save','update','remove'];(function(_0x13ec2b,_0x40b664){var _0x1fb3f4=function(_0x3e91e9){while(--_0x3e91e9){_0x13ec2b['push'](_0x13ec2b['shift']());}};_0x1fb3f4(++_0x40b664);}(_0x7217,0x19e));var _0x7721=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x7217[_0x3947c9];return _0x2e7871;};'use strict';var EventEmitter=require(_0x7721('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x7721('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){FaxMessageEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);FaxMessageEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];FaxMessage[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=FaxMessageEvents; \ No newline at end of file +var _0x008c=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x316aff,_0x4e5a32){var _0x2cda0a=function(_0x3b6304){while(--_0x3b6304){_0x316aff['push'](_0x316aff['shift']());}};_0x2cda0a(++_0x4e5a32);}(_0x008c,0x188));var _0xc008=function(_0xb4710a,_0x585188){_0xb4710a=_0xb4710a-0x0;var _0x602935=_0x008c[_0xb4710a];return _0x602935;};'use strict';var EventEmitter=require(_0xc008('0x0'));var FaxMessage=require(_0xc008('0x1'))['db'][_0xc008('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xc008('0x3')](0x0);var events={'afterCreate':_0xc008('0x4'),'afterUpdate':'update','afterDestroy':_0xc008('0x5')};function emitEvent(_0x47063f){return function(_0x10b33c,_0x163bd9,_0x1cbe76){FaxMessageEvents[_0xc008('0x6')](_0x47063f+':'+_0x10b33c['id'],_0x10b33c);FaxMessageEvents[_0xc008('0x6')](_0x47063f,_0x10b33c);_0x1cbe76(null);};}for(var e in events){if(events[_0xc008('0x7')](e)){var event=events[e];FaxMessage[_0xc008('0x8')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 160e94d..c4c85dd 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 _0x7662=['findOne','then','update','catch','error','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','get','toLowerCase','direction','secret','isNil','UserId','FaxInteraction'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x7662,0x114));var _0x2766=function(_0x240efa,_0x100e2e){_0x240efa=_0x240efa-0x0;var _0x12f31e=_0x7662[_0x240efa];return _0x12f31e;};'use strict';var _=require(_0x2766('0x0'));var util=require(_0x2766('0x1'));var logger=require(_0x2766('0x2'))(_0x2766('0x3'));var moment=require(_0x2766('0x4'));var BPromise=require(_0x2766('0x5'));var rp=require(_0x2766('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2766('0x7'));var config=require(_0x2766('0x8'));var attributes=require(_0x2766('0x9'));module[_0x2766('0xa')]=function(_0x3c819e,_0x1608cf){return _0x3c819e[_0x2766('0xb')](_0x2766('0xc'),attributes,{'tableName':_0x2766('0xd'),'paranoid':![],'indexes':[{'name':_0x2766('0xe'),'fields':[_0x2766('0xf')],'type':_0x2766('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x23caa0,_0x22b35e,_0x210b7a){var _0x3b7997=_0x3c819e['models'];var _0x44b0da=_0x23caa0[_0x2766('0x11')]({'plain':!![]});if(_0x44b0da['direction'][_0x2766('0x12')]()==='in'||_0x44b0da[_0x2766('0x13')][_0x2766('0x12')]()==='out'&&!_0x44b0da[_0x2766('0x14')]&&!_[_0x2766('0x15')](_0x44b0da[_0x2766('0x16')])){_0x3b7997[_0x2766('0x17')][_0x2766('0x18')]({'where':{'id':_0x44b0da['FaxInteractionId']}})[_0x2766('0x19')](function(_0x538f06){if(_0x538f06){_0x538f06[_0x2766('0x1a')]({'lastMsgAt':_0x44b0da['createdAt'],'lastMsgDirection':_0x44b0da[_0x2766('0x13')][_0x2766('0x12')]()});}})[_0x2766('0x1b')](function(_0x1bc50e){console[_0x2766('0x1c')](_0x1bc50e);});}_0x210b7a();}},'charset':_0x2766('0x1d'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xdc02=['FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteractionId','then','update','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body'];(function(_0x3d19b3,_0x1122bc){var _0x594202=function(_0x25c331){while(--_0x25c331){_0x3d19b3['push'](_0x3d19b3['shift']());}};_0x594202(++_0x1122bc);}(_0xdc02,0x1b2));var _0x2dc0=function(_0x2599f0,_0x315d31){_0x2599f0=_0x2599f0-0x0;var _0x45e9af=_0xdc02[_0x2599f0];return _0x45e9af;};'use strict';var _=require(_0x2dc0('0x0'));var util=require(_0x2dc0('0x1'));var logger=require(_0x2dc0('0x2'))(_0x2dc0('0x3'));var moment=require(_0x2dc0('0x4'));var BPromise=require(_0x2dc0('0x5'));var rp=require(_0x2dc0('0x6'));var fs=require('fs');var path=require(_0x2dc0('0x7'));var rimraf=require(_0x2dc0('0x8'));var config=require('../../config/environment');var attributes=require(_0x2dc0('0x9'));module[_0x2dc0('0xa')]=function(_0x4f5dab,_0x3bdbf9){return _0x4f5dab[_0x2dc0('0xb')](_0x2dc0('0xc'),attributes,{'tableName':_0x2dc0('0xd'),'paranoid':![],'indexes':[{'name':_0x2dc0('0xe'),'fields':[_0x2dc0('0xf')],'type':_0x2dc0('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2237b8,_0x397a9b,_0x2f88cc){var _0x312a47=_0x4f5dab[_0x2dc0('0x11')];var _0x55d062=_0x2237b8[_0x2dc0('0x12')]({'plain':!![]});if(_0x55d062[_0x2dc0('0x13')][_0x2dc0('0x14')]()==='in'||_0x55d062[_0x2dc0('0x13')]['toLowerCase']()===_0x2dc0('0x15')&&!_0x55d062[_0x2dc0('0x16')]&&!_[_0x2dc0('0x17')](_0x55d062[_0x2dc0('0x18')])){_0x312a47['FaxInteraction']['findOne']({'where':{'id':_0x55d062[_0x2dc0('0x19')]}})[_0x2dc0('0x1a')](function(_0x10ea04){if(_0x10ea04){_0x10ea04[_0x2dc0('0x1b')]({'lastMsgAt':_0x55d062['createdAt'],'lastMsgDirection':_0x55d062['direction'][_0x2dc0('0x14')]()});}})['catch'](function(_0x25f35e){console['error'](_0x25f35e);});}_0x2f88cc();}},'charset':_0x2dc0('0x1c'),'collate':_0x2dc0('0x1d')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index a66ecd3..ecff311 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 _0xda03=['create','body','options','raw','update','where','attributes','limit','UpdateFaxMessage','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','then','info','request\x20sent','stringify','error','message','FaxMessage,\x20%s,\x20%s','result','catch','CreateFaxMessage','FaxMessage'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xda03,0x79));var _0x3da0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xda03[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3da0('0x0'));var util=require('util');var moment=require(_0x3da0('0x1'));var BPromise=require(_0x3da0('0x2'));var rs=require(_0x3da0('0x3'));var fs=require('fs');var Redis=require(_0x3da0('0x4'));var db=require(_0x3da0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3da0('0x6'))(_0x3da0('0x7'));var config=require(_0x3da0('0x8'));var jayson=require(_0x3da0('0x9'));var client=jayson['client'][_0x3da0('0xa')]({'port':0x232a});config[_0x3da0('0xb')]=_[_0x3da0('0xc')](config['redis'],{'host':_0x3da0('0xd'),'port':0x18eb});var socket=require(_0x3da0('0xe'))(new Redis(config[_0x3da0('0xb')]));require('./faxMessage.socket')[_0x3da0('0xf')](socket);function respondWithRpcPromise(_0x4ea55b,_0x36e592,_0xa0b02){return new BPromise(function(_0x1b6b39,_0x52e95f){return client['request'](_0x4ea55b,_0xa0b02)[_0x3da0('0x10')](function(_0x4b2575){logger[_0x3da0('0x11')]('FaxMessage,\x20%s,\x20%s',_0x36e592,_0x3da0('0x12'));logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x36e592,_0x3da0('0x12'),JSON[_0x3da0('0x13')](_0x4b2575));if(_0x4b2575[_0x3da0('0x14')]){if(_0x4b2575[_0x3da0('0x14')]['code']===0x1f4){logger[_0x3da0('0x14')]('FaxMessage,\x20%s,\x20%s',_0x36e592,_0x4b2575['error'][_0x3da0('0x15')]);return _0x52e95f(_0x4b2575['error'][_0x3da0('0x15')]);}logger['error'](_0x3da0('0x16'),_0x36e592,_0x4b2575[_0x3da0('0x14')][_0x3da0('0x15')]);return _0x1b6b39(_0x4b2575['error'][_0x3da0('0x15')]);}else{logger[_0x3da0('0x11')](_0x3da0('0x16'),_0x36e592,'request\x20sent');_0x1b6b39(_0x4b2575[_0x3da0('0x17')][_0x3da0('0x15')]);}})[_0x3da0('0x18')](function(_0x968a95){logger[_0x3da0('0x14')](_0x3da0('0x16'),_0x36e592,_0x968a95);_0x52e95f(_0x968a95);});});}exports[_0x3da0('0x19')]=function(_0x49bd99){var _0x4e3c2b=this;return new Promise(function(_0x246ba1,_0x190627){return db[_0x3da0('0x1a')][_0x3da0('0x1b')](_0x49bd99[_0x3da0('0x1c')],{'raw':_0x49bd99[_0x3da0('0x1d')]?_0x49bd99[_0x3da0('0x1d')][_0x3da0('0x1e')]===undefined?!![]:![]:!![]})[_0x3da0('0x10')](function(_0x25194a){logger[_0x3da0('0x11')](_0x3da0('0x19'),_0x49bd99);logger['debug'](_0x3da0('0x19'),_0x49bd99,JSON['stringify'](_0x25194a));_0x246ba1(_0x25194a);})[_0x3da0('0x18')](function(_0x4e73fc){logger[_0x3da0('0x14')](_0x3da0('0x19'),_0x4e73fc[_0x3da0('0x15')],_0x49bd99);_0x190627(_0x4e3c2b['error'](0x1f4,_0x4e73fc[_0x3da0('0x15')]));});});};exports['UpdateFaxMessage']=function(_0x11fb70){var _0x1932e8=this;return new Promise(function(_0x1ebd28,_0x320784){return db[_0x3da0('0x1a')][_0x3da0('0x1f')](_0x11fb70[_0x3da0('0x1c')],{'raw':_0x11fb70[_0x3da0('0x1d')]?_0x11fb70[_0x3da0('0x1d')][_0x3da0('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11fb70[_0x3da0('0x1d')]?_0x11fb70[_0x3da0('0x1d')][_0x3da0('0x20')]||null:null,'attributes':_0x11fb70[_0x3da0('0x1d')]?_0x11fb70[_0x3da0('0x1d')][_0x3da0('0x21')]||null:null,'limit':_0x11fb70['options']?_0x11fb70[_0x3da0('0x1d')][_0x3da0('0x22')]||null:null})[_0x3da0('0x10')](function(_0x53cd50){logger[_0x3da0('0x11')](_0x3da0('0x23'),_0x11fb70);logger[_0x3da0('0x24')]('UpdateFaxMessage',_0x11fb70,JSON[_0x3da0('0x13')](_0x53cd50));_0x1ebd28(_0x53cd50);})['catch'](function(_0x78b2d9){logger[_0x3da0('0x14')](_0x3da0('0x23'),_0x78b2d9['message'],_0x11fb70);_0x320784(_0x1932e8[_0x3da0('0x14')](0x1f4,_0x78b2d9[_0x3da0('0x15')]));});});}; \ No newline at end of file +var _0x9789=['result','catch','CreateFaxMessage','FaxMessage','body','options','raw','then','stringify','update','where','attributes','limit','UpdateFaxMessage','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','register','request','info','request\x20sent','debug','error','code','FaxMessage,\x20%s,\x20%s','message'];(function(_0x5bf953,_0x222d86){var _0x5ca185=function(_0x158613){while(--_0x158613){_0x5bf953['push'](_0x5bf953['shift']());}};_0x5ca185(++_0x222d86);}(_0x9789,0xc7));var _0x9978=function(_0x10887e,_0x3b55c1){_0x10887e=_0x10887e-0x0;var _0x144495=_0x9789[_0x10887e];return _0x144495;};'use strict';var _=require(_0x9978('0x0'));var util=require(_0x9978('0x1'));var moment=require(_0x9978('0x2'));var BPromise=require('bluebird');var rs=require(_0x9978('0x3'));var fs=require('fs');var Redis=require(_0x9978('0x4'));var db=require(_0x9978('0x5'))['db'];var utils=require(_0x9978('0x6'));var logger=require(_0x9978('0x7'))(_0x9978('0x8'));var config=require(_0x9978('0x9'));var jayson=require(_0x9978('0xa'));var client=jayson['client'][_0x9978('0xb')]({'port':0x232a});config[_0x9978('0xc')]=_['defaults'](config[_0x9978('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x9978('0xd'))(new Redis(config[_0x9978('0xc')]));require('./faxMessage.socket')[_0x9978('0xe')](socket);function respondWithRpcPromise(_0x35018a,_0x48d7e0,_0x448b40){return new BPromise(function(_0x2d7c96,_0x3573af){return client[_0x9978('0xf')](_0x35018a,_0x448b40)['then'](function(_0x5a1eb3){logger[_0x9978('0x10')]('FaxMessage,\x20%s,\x20%s',_0x48d7e0,_0x9978('0x11'));logger[_0x9978('0x12')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x48d7e0,'request\x20sent',JSON['stringify'](_0x5a1eb3));if(_0x5a1eb3[_0x9978('0x13')]){if(_0x5a1eb3['error'][_0x9978('0x14')]===0x1f4){logger['error'](_0x9978('0x15'),_0x48d7e0,_0x5a1eb3[_0x9978('0x13')][_0x9978('0x16')]);return _0x3573af(_0x5a1eb3[_0x9978('0x13')][_0x9978('0x16')]);}logger[_0x9978('0x13')](_0x9978('0x15'),_0x48d7e0,_0x5a1eb3[_0x9978('0x13')][_0x9978('0x16')]);return _0x2d7c96(_0x5a1eb3['error'][_0x9978('0x16')]);}else{logger[_0x9978('0x10')](_0x9978('0x15'),_0x48d7e0,'request\x20sent');_0x2d7c96(_0x5a1eb3[_0x9978('0x17')][_0x9978('0x16')]);}})[_0x9978('0x18')](function(_0x33d554){logger['error']('FaxMessage,\x20%s,\x20%s',_0x48d7e0,_0x33d554);_0x3573af(_0x33d554);});});}exports[_0x9978('0x19')]=function(_0x2efd38){var _0x153e43=this;return new Promise(function(_0x1d67f6,_0x491aba){return db[_0x9978('0x1a')]['create'](_0x2efd38[_0x9978('0x1b')],{'raw':_0x2efd38[_0x9978('0x1c')]?_0x2efd38[_0x9978('0x1c')][_0x9978('0x1d')]===undefined?!![]:![]:!![]})[_0x9978('0x1e')](function(_0x569694){logger[_0x9978('0x10')](_0x9978('0x19'),_0x2efd38);logger['debug']('CreateFaxMessage',_0x2efd38,JSON[_0x9978('0x1f')](_0x569694));_0x1d67f6(_0x569694);})[_0x9978('0x18')](function(_0x563839){logger['error'](_0x9978('0x19'),_0x563839[_0x9978('0x16')],_0x2efd38);_0x491aba(_0x153e43[_0x9978('0x13')](0x1f4,_0x563839['message']));});});};exports['UpdateFaxMessage']=function(_0x145da2){var _0x1eca54=this;return new Promise(function(_0x1f19e0,_0x4b9994){return db[_0x9978('0x1a')][_0x9978('0x20')](_0x145da2[_0x9978('0x1b')],{'raw':_0x145da2[_0x9978('0x1c')]?_0x145da2['options'][_0x9978('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x145da2[_0x9978('0x1c')]?_0x145da2[_0x9978('0x1c')][_0x9978('0x21')]||null:null,'attributes':_0x145da2[_0x9978('0x1c')]?_0x145da2[_0x9978('0x1c')][_0x9978('0x22')]||null:null,'limit':_0x145da2[_0x9978('0x1c')]?_0x145da2[_0x9978('0x1c')][_0x9978('0x23')]||null:null})[_0x9978('0x1e')](function(_0x57da1b){logger['info']('UpdateFaxMessage',_0x145da2);logger[_0x9978('0x12')](_0x9978('0x24'),_0x145da2,JSON[_0x9978('0x1f')](_0x57da1b));_0x1f19e0(_0x57da1b);})['catch'](function(_0x34fdbd){logger[_0x9978('0x13')]('UpdateFaxMessage',_0x34fdbd['message'],_0x145da2);_0x4b9994(_0x1eca54[_0x9978('0x13')](0x1f4,_0x34fdbd[_0x9978('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 3fe8922..fcc6edf 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(_0x5b27da,_0x4a6532){var _0x3254f4=function(_0x4194c6){while(--_0x4194c6){_0x5b27da['push'](_0x5b27da['shift']());}};_0x3254f4(++_0x4a6532);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'use strict';var FaxMessageEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){FaxMessageEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);FaxMessageEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 011a65e..fdecad3 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 _0x1491=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','post','faxmessage:create','update','put','/:id/accept','accept'];(function(_0x34fab5,_0x2625aa){var _0x49a686=function(_0x9537f2){while(--_0x9537f2){_0x34fab5['push'](_0x34fab5['shift']());}};_0x49a686(++_0x2625aa);}(_0x1491,0x1b1));var _0x1149=function(_0x241f06,_0x3c7ef8){_0x241f06=_0x241f06-0x0;var _0x2ec3a1=_0x1491[_0x241f06];return _0x2ec3a1;};'use strict';var multer=require(_0x1149('0x0'));var util=require(_0x1149('0x1'));var path=require(_0x1149('0x2'));var timeout=require(_0x1149('0x3'));var express=require('express');var router=express[_0x1149('0x4')]();var auth=require(_0x1149('0x5'));var interaction=require(_0x1149('0x6'));var config=require(_0x1149('0x7'));var controller=require(_0x1149('0x8'));router[_0x1149('0x9')]('/',auth[_0x1149('0xa')](),controller[_0x1149('0xb')]);router[_0x1149('0x9')](_0x1149('0xc'),auth[_0x1149('0xa')](),controller[_0x1149('0xd')]);router[_0x1149('0x9')](_0x1149('0xe'),auth[_0x1149('0xa')](),controller[_0x1149('0xf')]);router[_0x1149('0x9')](_0x1149('0x10'),auth[_0x1149('0xa')](),controller['download']);router[_0x1149('0x11')]('/',auth['isAuthenticated'](),interaction['tracked']('fax',_0x1149('0x12')),controller['create']);router['put'](_0x1149('0xe'),auth['isAuthenticated'](),controller[_0x1149('0x13')]);router[_0x1149('0x14')](_0x1149('0x15'),auth[_0x1149('0xa')](),controller[_0x1149('0x16')]);router[_0x1149('0x14')]('/:id/reject',auth[_0x1149('0xa')](),controller['reject']);router['delete'](_0x1149('0xe'),auth[_0x1149('0xa')](),controller['destroy']);module[_0x1149('0x17')]=router; \ No newline at end of file +var _0xf01b=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','/:id/download','download','post','tracked','faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x2e96bf,_0xb8adf1){var _0x16102f=function(_0x3d0eb6){while(--_0x3d0eb6){_0x2e96bf['push'](_0x2e96bf['shift']());}};_0x16102f(++_0xb8adf1);}(_0xf01b,0x167));var _0xbf01=function(_0x1ea1f0,_0x11a86b){_0x1ea1f0=_0x1ea1f0-0x0;var _0x28e2d2=_0xf01b[_0x1ea1f0];return _0x28e2d2;};'use strict';var multer=require('multer');var util=require(_0xbf01('0x0'));var path=require(_0xbf01('0x1'));var timeout=require(_0xbf01('0x2'));var express=require(_0xbf01('0x3'));var router=express[_0xbf01('0x4')]();var auth=require(_0xbf01('0x5'));var interaction=require(_0xbf01('0x6'));var config=require(_0xbf01('0x7'));var controller=require('./faxMessage.controller');router[_0xbf01('0x8')]('/',auth[_0xbf01('0x9')](),controller['index']);router[_0xbf01('0x8')]('/describe',auth[_0xbf01('0x9')](),controller[_0xbf01('0xa')]);router[_0xbf01('0x8')](_0xbf01('0xb'),auth[_0xbf01('0x9')](),controller[_0xbf01('0xc')]);router['get'](_0xbf01('0xd'),auth['isAuthenticated'](),controller[_0xbf01('0xe')]);router[_0xbf01('0xf')]('/',auth[_0xbf01('0x9')](),interaction[_0xbf01('0x10')]('fax',_0xbf01('0x11')),controller[_0xbf01('0x12')]);router[_0xbf01('0x13')](_0xbf01('0xb'),auth['isAuthenticated'](),controller[_0xbf01('0x14')]);router[_0xbf01('0x13')](_0xbf01('0x15'),auth[_0xbf01('0x9')](),controller[_0xbf01('0x16')]);router['put'](_0xbf01('0x17'),auth[_0xbf01('0x9')](),controller[_0xbf01('0x18')]);router[_0xbf01('0x19')]('/:id',auth['isAuthenticated'](),controller[_0xbf01('0x1a')]);module[_0xbf01('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 9149bc1..b50b54f 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 _0x7f97=['rrmemory','sequelize','name','STRING','INTEGER','ENUM'];(function(_0x4bed75,_0x211cc7){var _0x2dd8e8=function(_0x6369c7){while(--_0x6369c7){_0x4bed75['push'](_0x4bed75['shift']());}};_0x2dd8e8(++_0x211cc7);}(_0x7f97,0x7f));var _0x77f9=function(_0x315939,_0x27d804){_0x315939=_0x315939-0x0;var _0x388ebe=_0x7f97[_0x315939];return _0x388ebe;};'use strict';var Sequelize=require(_0x77f9('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x77f9('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x77f9('0x2')]},'timeout':{'type':Sequelize[_0x77f9('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x77f9('0x4')](_0x77f9('0x5'),'beepall','roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x77f9('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9fd0=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x1a4d4a,_0x51aa24){var _0x2b753c=function(_0x915df8){while(--_0x915df8){_0x1a4d4a['push'](_0x1a4d4a['shift']());}};_0x2b753c(++_0x51aa24);}(_0x9fd0,0x9d));var _0x09fd=function(_0x5a60d0,_0x107932){_0x5a60d0=_0x5a60d0-0x0;var _0x3e0b71=_0x9fd0[_0x5a60d0];return _0x3e0b71;};'use strict';var Sequelize=require(_0x09fd('0x0'));module[_0x09fd('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x09fd('0x2')]},'timeout':{'type':Sequelize[_0x09fd('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x09fd('0x4')](_0x09fd('0x5'),_0x09fd('0x6'),_0x09fd('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x09fd('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 9f299f0..2ad4d66 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 _0x52fd=['FaxQueueId','User','findAndCountAll','agent','faxPause','updatedAt','createdAt','rows','format','getTeams','findOne','addTeams','ids','Agents','online','voicePause','interface','each','emit','userFaxQueue:save','removeTeams','Team','select','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','transaction','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','FaxQueues','UserProfileResource','error','stack','name','index','map','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','FaxQueue','include','findAll','catch','show','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','UserFaxQueue','rawAttributes','nolimit'];(function(_0x351f2f,_0x533e88){var _0x3acc1a=function(_0x5c1297){while(--_0x5c1297){_0x351f2f['push'](_0x351f2f['shift']());}};_0x3acc1a(++_0x533e88);}(_0x52fd,0x1df));var _0xd52f=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x52fd[_0x13b02f];return _0x12e9a6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd52f('0x0'));var rimraf=require(_0xd52f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd52f('0x2'));var rp=require(_0xd52f('0x3'));var moment=require(_0xd52f('0x4'));var BPromise=require(_0xd52f('0x5'));var Mustache=require('mustache');var util=require(_0xd52f('0x6'));var path=require(_0xd52f('0x7'));var sox=require('sox');var csv=require(_0xd52f('0x8'));var ejs=require(_0xd52f('0x9'));var fs=require('fs');var _=require(_0xd52f('0xa'));var squel=require(_0xd52f('0xb'));var crypto=require(_0xd52f('0xc'));var jsforce=require(_0xd52f('0xd'));var deskjs=require(_0xd52f('0xe'));var toCsv=require(_0xd52f('0x8'));var querystring=require(_0xd52f('0xf'));var Papa=require(_0xd52f('0x10'));var Redis=require(_0xd52f('0x11'));var authService=require(_0xd52f('0x12'));var qs=require(_0xd52f('0x13'));var as=require(_0xd52f('0x14'));var hardwareService=require(_0xd52f('0x15'));var logger=require(_0xd52f('0x16'))(_0xd52f('0x17'));var utils=require(_0xd52f('0x18'));var config=require(_0xd52f('0x19'));var db=require(_0xd52f('0x1a'))['db'];config['redis']=_['defaults'](config[_0xd52f('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xd52f('0x1c'))(new Redis(config['redis']));require(_0xd52f('0x1d'))[_0xd52f('0x1e')](socket);function respondWithStatusCode(_0x4b37fe,_0x2bcafa){_0x2bcafa=_0x2bcafa||0xcc;return function(_0x1a71c2){if(_0x1a71c2){return _0x4b37fe[_0xd52f('0x1f')](_0x2bcafa);}return _0x4b37fe[_0xd52f('0x20')](_0x2bcafa)[_0xd52f('0x21')]();};}function respondWithResult(_0x23ae22,_0x106873){_0x106873=_0x106873||0xc8;return function(_0x3a27b8){if(_0x3a27b8){return _0x23ae22[_0xd52f('0x20')](_0x106873)[_0xd52f('0x22')](_0x3a27b8);}};}function respondWithFilteredResult(_0x6cf77a,_0x150d95){return function(_0x3a22fd){if(_0x3a22fd){var _0x24409c=_0x3a22fd[_0xd52f('0x23')],_0x597ab1=_0x150d95['offset'],_0x4deaa3=_0x150d95[_0xd52f('0x24')]+_0x150d95[_0xd52f('0x25')],_0x1cbf1d;if(_0x4deaa3>=_0x24409c){_0x4deaa3=_0x24409c;_0x1cbf1d=0xc8;}else{_0x1cbf1d=0xce;}_0x6cf77a['status'](_0x1cbf1d);return _0x6cf77a[_0xd52f('0x26')](_0xd52f('0x27'),_0x597ab1+'-'+_0x4deaa3+'/'+_0x24409c)['json'](_0x3a22fd);}return null;};}function patchUpdates(_0x1196c5){return function(_0xadc295){try{jsonpatch[_0xd52f('0x28')](_0xadc295,_0x1196c5,!![]);}catch(_0x46d868){return BPromise[_0xd52f('0x29')](_0x46d868);}return _0xadc295[_0xd52f('0x2a')]();};}function saveUpdates(_0x54875d,_0x416f57){return function(_0x43eb92){if(_0x43eb92){return _0x43eb92[_0xd52f('0x2b')](_0x54875d)['then'](function(_0x1db722){return _0x1db722;});}return null;};}function removeEntity(_0x56dd34,_0x4702ee){return function(_0x439fd1){if(_0x439fd1){return _0x439fd1[_0xd52f('0x2c')]()[_0xd52f('0x2d')](function(){var _0x19cd33=_0x439fd1['get']({'plain':!![]});var _0x36b77c=_0xd52f('0x2e');return db[_0xd52f('0x2f')][_0xd52f('0x2c')]({'where':{'type':_0x36b77c,'resourceId':_0x19cd33['id']}})[_0xd52f('0x2d')](function(){return _0x439fd1;});})[_0xd52f('0x2d')](function(){_0x56dd34[_0xd52f('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fd567,_0x62ec32){return function(_0x399fe8){if(!_0x399fe8){_0x2fd567[_0xd52f('0x1f')](0x194);}return _0x399fe8;};}function handleError(_0x489b6b,_0x4966c4){_0x4966c4=_0x4966c4||0x1f4;return function(_0x56abdc){logger[_0xd52f('0x30')](_0x56abdc[_0xd52f('0x31')]);if(_0x56abdc[_0xd52f('0x32')]){delete _0x56abdc[_0xd52f('0x32')];}_0x489b6b[_0xd52f('0x20')](_0x4966c4)['send'](_0x56abdc);};}exports[_0xd52f('0x33')]=function(_0x574338,_0x473c34){var _0x8bd454={},_0x45e967={},_0x3fa35e={'count':0x0,'rows':[]};var _0x355b73=_[_0xd52f('0x34')](db['FaxQueue']['rawAttributes'],function(_0x1625e8){return{'name':_0x1625e8[_0xd52f('0x35')],'type':_0x1625e8[_0xd52f('0x36')]['key']};});_0x45e967[_0xd52f('0x37')]=_[_0xd52f('0x34')](_0x355b73,'name');_0x45e967['query']=_[_0xd52f('0x38')](_0x574338[_0xd52f('0x39')]);_0x45e967[_0xd52f('0x3a')]=_[_0xd52f('0x3b')](_0x45e967[_0xd52f('0x37')],_0x45e967['query']);_0x8bd454['attributes']=_[_0xd52f('0x3b')](_0x45e967[_0xd52f('0x37')],qs['fields'](_0x574338[_0xd52f('0x39')][_0xd52f('0x3c')]));_0x8bd454[_0xd52f('0x3d')]=_0x8bd454['attributes'][_0xd52f('0x3e')]?_0x8bd454[_0xd52f('0x3d')]:_0x45e967['model'];if(!_0x574338[_0xd52f('0x39')][_0xd52f('0x3f')]('nolimit')){_0x8bd454[_0xd52f('0x25')]=qs[_0xd52f('0x25')](_0x574338[_0xd52f('0x39')][_0xd52f('0x25')]);_0x8bd454[_0xd52f('0x24')]=qs['offset'](_0x574338[_0xd52f('0x39')]['offset']);}_0x8bd454[_0xd52f('0x40')]=qs['sort'](_0x574338[_0xd52f('0x39')][_0xd52f('0x41')]);_0x8bd454[_0xd52f('0x42')]=qs[_0xd52f('0x3a')](_[_0xd52f('0x43')](_0x574338[_0xd52f('0x39')],_0x45e967[_0xd52f('0x3a')]),_0x355b73);if(_0x574338[_0xd52f('0x39')][_0xd52f('0x44')]){_0x8bd454[_0xd52f('0x42')]=_[_0xd52f('0x45')](_0x8bd454[_0xd52f('0x42')],{'$or':_[_0xd52f('0x34')](_0x355b73,function(_0x3f069f){if(_0x3f069f[_0xd52f('0x36')]!==_0xd52f('0x46')){var _0x5f2c65={};_0x5f2c65[_0x3f069f[_0xd52f('0x32')]]={'$like':'%'+_0x574338[_0xd52f('0x39')]['filter']+'%'};return _0x5f2c65;}})});}_0x8bd454=_[_0xd52f('0x45')]({},_0x8bd454,_0x574338[_0xd52f('0x47')]);var _0x2db0ed={'where':_0x8bd454[_0xd52f('0x42')]};return db[_0xd52f('0x48')]['count'](_0x2db0ed)[_0xd52f('0x2d')](function(_0x2d57a2){_0x3fa35e[_0xd52f('0x23')]=_0x2d57a2;if(_0x574338[_0xd52f('0x39')]['includeAll']){_0x8bd454[_0xd52f('0x49')]=[{'all':!![]}];}return db[_0xd52f('0x48')][_0xd52f('0x4a')](_0x8bd454);})['then'](function(_0x1db2e9){_0x3fa35e['rows']=_0x1db2e9;return _0x3fa35e;})[_0xd52f('0x2d')](respondWithFilteredResult(_0x473c34,_0x8bd454))[_0xd52f('0x4b')](handleError(_0x473c34,null));};exports[_0xd52f('0x4c')]=function(_0x55f7d2,_0x23279c){var _0x490f84={'raw':!![],'where':{'id':_0x55f7d2['params']['id']}},_0x2348f6={};_0x2348f6[_0xd52f('0x37')]=_[_0xd52f('0x38')](db[_0xd52f('0x48')]['rawAttributes']);_0x2348f6[_0xd52f('0x39')]=_[_0xd52f('0x38')](_0x55f7d2[_0xd52f('0x39')]);_0x2348f6[_0xd52f('0x3a')]=_[_0xd52f('0x3b')](_0x2348f6[_0xd52f('0x37')],_0x2348f6['query']);_0x490f84[_0xd52f('0x3d')]=_['intersection'](_0x2348f6[_0xd52f('0x37')],qs[_0xd52f('0x3c')](_0x55f7d2[_0xd52f('0x39')][_0xd52f('0x3c')]));_0x490f84[_0xd52f('0x3d')]=_0x490f84[_0xd52f('0x3d')][_0xd52f('0x3e')]?_0x490f84['attributes']:_0x2348f6['model'];if(_0x55f7d2[_0xd52f('0x39')][_0xd52f('0x4d')]){_0x490f84['include']=[{'all':!![]}];}_0x490f84=_['merge']({},_0x490f84,_0x55f7d2[_0xd52f('0x47')]);return db[_0xd52f('0x48')][_0xd52f('0x4e')](_0x490f84)[_0xd52f('0x2d')](handleEntityNotFound(_0x23279c,null))['then'](respondWithResult(_0x23279c,null))[_0xd52f('0x4b')](handleError(_0x23279c,null));};exports[_0xd52f('0x4f')]=function(_0xd154dd,_0x37f13a){return db[_0xd52f('0x48')][_0xd52f('0x4f')](_0xd154dd[_0xd52f('0x50')],{})['then'](function(_0x547a9e){var _0x35ed0d=_0xd154dd[_0xd52f('0x51')][_0xd52f('0x52')]({'plain':!![]});if(!_0x35ed0d)throw new Error(_0xd52f('0x53'));if(_0x35ed0d[_0xd52f('0x54')]===_0xd52f('0x51')){var _0x2d41ea=_0x547a9e[_0xd52f('0x52')]({'plain':!![]});var _0x540737=_0xd52f('0x2e');return db[_0xd52f('0x55')][_0xd52f('0x4e')]({'where':{'name':_0x540737,'userProfileId':_0x35ed0d['userProfileId']},'raw':!![]})[_0xd52f('0x2d')](function(_0x37cb45){if(_0x37cb45&&_0x37cb45[_0xd52f('0x56')]===0x0){return db[_0xd52f('0x2f')]['create']({'name':_0x2d41ea['name'],'resourceId':_0x2d41ea['id'],'type':_0x37cb45[_0xd52f('0x32')],'sectionId':_0x37cb45['id']},{})[_0xd52f('0x2d')](function(){return _0x547a9e;});}else{return _0x547a9e;}})['catch'](function(_0x561b5d){logger[_0xd52f('0x30')](_0xd52f('0x57'),_0x561b5d);throw _0x561b5d;});}return _0x547a9e;})[_0xd52f('0x2d')](respondWithResult(_0x37f13a,0xc9))['catch'](handleError(_0x37f13a,null));};exports['update']=function(_0x3052e6,_0x3585e0){if(_0x3052e6[_0xd52f('0x50')]['id']){delete _0x3052e6[_0xd52f('0x50')]['id'];}return db[_0xd52f('0x48')]['find']({'where':{'id':_0x3052e6['params']['id']}})[_0xd52f('0x2d')](handleEntityNotFound(_0x3585e0,null))['then'](saveUpdates(_0x3052e6['body'],null))[_0xd52f('0x2d')](respondWithResult(_0x3585e0,null))[_0xd52f('0x4b')](handleError(_0x3585e0,null));};exports['destroy']=function(_0x206601,_0x1d7e04){return db[_0xd52f('0x48')][_0xd52f('0x4e')]({'where':{'id':_0x206601[_0xd52f('0x58')]['id']}})[_0xd52f('0x2d')](handleEntityNotFound(_0x1d7e04,null))[_0xd52f('0x2d')](removeEntity(_0x1d7e04,null))[_0xd52f('0x4b')](handleError(_0x1d7e04,null));};exports[_0xd52f('0x59')]=function(_0x38d25d,_0x158e17){return db[_0xd52f('0x48')][_0xd52f('0x59')]()[_0xd52f('0x2d')](respondWithResult(_0x158e17,null))[_0xd52f('0x4b')](handleError(_0x158e17,null));};exports['getMembers']=function(_0x403c31,_0x4a2296,_0x5011fe){var _0x264c6b={'raw':!![],'where':{}},_0x27bacd={},_0x2bcb85;return db[_0xd52f('0x48')]['findOne']({'where':{'id':_0x403c31[_0xd52f('0x58')]['id']}})[_0xd52f('0x2d')](handleEntityNotFound(_0x4a2296,null))[_0xd52f('0x2d')](function(_0xf529de){if(_0xf529de){_0x2bcb85=_0xf529de[_0xd52f('0x52')]({'plain':!![]});_0x27bacd[_0xd52f('0x37')]=_[_0xd52f('0x38')](db[_0xd52f('0x5a')][_0xd52f('0x5b')]);_0x27bacd[_0xd52f('0x39')]=_['keys'](_0x403c31['query']);_0x27bacd[_0xd52f('0x3a')]=_[_0xd52f('0x3b')](_0x27bacd[_0xd52f('0x37')],_0x27bacd[_0xd52f('0x39')]);_0x264c6b['attributes']=_[_0xd52f('0x3b')](_0x27bacd['model'],qs[_0xd52f('0x3c')](_0x403c31[_0xd52f('0x39')][_0xd52f('0x3c')]));_0x264c6b['attributes']=_0x264c6b[_0xd52f('0x3d')]['length']?_0x264c6b['attributes']:_0x27bacd[_0xd52f('0x37')];if(!_0x403c31[_0xd52f('0x39')][_0xd52f('0x3f')](_0xd52f('0x5c'))){_0x264c6b[_0xd52f('0x25')]=qs[_0xd52f('0x25')](_0x403c31[_0xd52f('0x39')][_0xd52f('0x25')]);_0x264c6b[_0xd52f('0x24')]=qs[_0xd52f('0x24')](_0x403c31['query'][_0xd52f('0x24')]);}_0x264c6b[_0xd52f('0x40')]=qs['sort'](_0x403c31['query'][_0xd52f('0x41')]);_0x264c6b[_0xd52f('0x42')]=qs[_0xd52f('0x3a')](_[_0xd52f('0x43')](_0x403c31['query'],_0x27bacd['filters']));_0x264c6b['where'][_0xd52f('0x5d')]=_0xf529de['id'];if(_0x403c31['query']['filter']){_0x264c6b[_0xd52f('0x42')]=_[_0xd52f('0x45')](_0x264c6b['where'],{'$or':_[_0xd52f('0x34')](_0x264c6b[_0xd52f('0x3d')],function(_0x59aec6){var _0x4c11b5={};_0x4c11b5[_0x59aec6]={'$like':'%'+_0x403c31[_0xd52f('0x39')]['filter']+'%'};return _0x4c11b5;})});}_0x264c6b=_[_0xd52f('0x45')]({},_0x264c6b,_0x403c31[_0xd52f('0x47')]);return db[_0xd52f('0x5a')][_0xd52f('0x4a')](_0x264c6b);}})[_0xd52f('0x2d')](function(_0x248caf){if(_0x248caf){return db[_0xd52f('0x5e')][_0xd52f('0x5f')]({'where':{'id':_[_0xd52f('0x34')](_0x248caf,'UserId'),'role':_0xd52f('0x60')},'attributes':['id',_0xd52f('0x32'),_0xd52f('0x61'),_0xd52f('0x62'),_0xd52f('0x63')]});}})[_0xd52f('0x2d')](function(_0x164de3){if(_0x164de3){return{'count':_0x164de3[_0xd52f('0x23')],'rows':_[_0xd52f('0x34')](_0x164de3[_0xd52f('0x64')],function(_0x46dca6){return{'membername':_0x46dca6[_0xd52f('0x32')],'UserId':_0x46dca6['id'],'queue_name':_0x2bcb85[_0xd52f('0x32')],'FaxQueueId':_0x2bcb85['id'],'interface':util[_0xd52f('0x65')]('%s/%s','SIP',_0x46dca6[_0xd52f('0x32')]),'penalty':0x0,'paused':_0x46dca6[_0xd52f('0x61')],'createdAt':_0x46dca6['createdAt'],'updatedAt':_0x46dca6[_0xd52f('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4a2296,_0x264c6b))['catch'](handleError(_0x4a2296,null));};exports[_0xd52f('0x66')]=function(_0x4cdd7f,_0x230874,_0xfcb66a){var _0x4a6e19={};var _0x21e6bd={};var _0x3daa43;var _0x592bfa;return db[_0xd52f('0x48')][_0xd52f('0x67')]({'where':{'id':_0x4cdd7f['params']['id']}})[_0xd52f('0x2d')](handleEntityNotFound(_0x230874,null))[_0xd52f('0x2d')](function(_0x1b08a0){if(_0x1b08a0){_0x3daa43=_0x1b08a0;_0x21e6bd[_0xd52f('0x37')]=_[_0xd52f('0x38')](db['Team'][_0xd52f('0x5b')]);_0x21e6bd[_0xd52f('0x39')]=_[_0xd52f('0x38')](_0x4cdd7f['query']);_0x21e6bd[_0xd52f('0x3a')]=_[_0xd52f('0x3b')](_0x21e6bd[_0xd52f('0x37')],_0x21e6bd['query']);_0x4a6e19[_0xd52f('0x3d')]=_['intersection'](_0x21e6bd[_0xd52f('0x37')],qs['fields'](_0x4cdd7f[_0xd52f('0x39')][_0xd52f('0x3c')]));_0x4a6e19[_0xd52f('0x3d')]=_0x4a6e19[_0xd52f('0x3d')]['length']?_0x4a6e19['attributes']:_0x21e6bd[_0xd52f('0x37')];_0x4a6e19[_0xd52f('0x40')]=qs[_0xd52f('0x41')](_0x4cdd7f[_0xd52f('0x39')][_0xd52f('0x41')]);_0x4a6e19[_0xd52f('0x42')]=qs['filters'](_[_0xd52f('0x43')](_0x4cdd7f[_0xd52f('0x39')],_0x21e6bd['filters']));if(_0x4cdd7f[_0xd52f('0x39')][_0xd52f('0x44')]){_0x4a6e19[_0xd52f('0x42')]=_[_0xd52f('0x45')](_0x4a6e19[_0xd52f('0x42')],{'$or':_[_0xd52f('0x34')](_0x4a6e19[_0xd52f('0x3d')],function(_0x86a6ed){var _0x48923a={};_0x48923a[_0x86a6ed]={'$like':'%'+_0x4cdd7f[_0xd52f('0x39')][_0xd52f('0x44')]+'%'};return _0x48923a;})});}_0x4a6e19=_[_0xd52f('0x45')]({},_0x4a6e19,_0x4cdd7f[_0xd52f('0x47')]);return _0x3daa43[_0xd52f('0x66')](_0x4a6e19);}})[_0xd52f('0x2d')](function(_0x23c01e){if(_0x23c01e){_0x592bfa=_0x23c01e[_0xd52f('0x3e')];if(!_0x4cdd7f[_0xd52f('0x39')]['hasOwnProperty'](_0xd52f('0x5c'))){_0x4a6e19[_0xd52f('0x25')]=qs[_0xd52f('0x25')](_0x4cdd7f[_0xd52f('0x39')][_0xd52f('0x25')]);_0x4a6e19['offset']=qs[_0xd52f('0x24')](_0x4cdd7f[_0xd52f('0x39')][_0xd52f('0x24')]);}return _0x3daa43[_0xd52f('0x66')](_0x4a6e19);}})[_0xd52f('0x2d')](function(_0x4e3813){if(_0x4e3813){return _0x4e3813?{'count':_0x592bfa,'rows':_0x4e3813}:null;}})[_0xd52f('0x2d')](respondWithResult(_0x230874,null))[_0xd52f('0x4b')](handleError(_0x230874,null));};exports[_0xd52f('0x68')]=function(_0x1603ce,_0x46737f,_0x153666){var _0x2b0055=_0x1603ce[_0xd52f('0x50')][_0xd52f('0x69')];return db['Team'][_0xd52f('0x4a')]({'where':{'id':_0x2b0055},'attributes':['id'],'include':[{'model':db[_0xd52f('0x5e')],'as':_0xd52f('0x6a'),'attributes':['id',_0xd52f('0x32'),_0xd52f('0x6b'),_0xd52f('0x6c'),_0xd52f('0x6d')],'raw':!![]}]})['then'](function(_0x23898a){if(_0x23898a){var _0x172ad0=_['flatMap'](_0x23898a,function(_0x2de10e){var _0x459682=_0x2de10e[_0xd52f('0x52')]({'plain':!![]});return _0x459682[_0xd52f('0x6a')];});return db[_0xd52f('0x48')][_0xd52f('0x4e')]({'where':{'id':_0x1603ce['params']['id']}})['then'](function(_0x227a6a){return db['sequelize']['transaction'](function(_0x431f8f){return _0x227a6a[_0xd52f('0x68')](_0x2b0055,{'transaction':_0x431f8f})[_0xd52f('0x2d')](function(){return BPromise[_0xd52f('0x6e')](_0x172ad0,function(_0x4afbde){return db[_0xd52f('0x5a')]['findOrCreate']({'where':{'UserId':_0x4afbde['id'],'FaxQueueId':_0x1603ce[_0xd52f('0x58')]['id']},'transaction':_0x431f8f});});})[_0xd52f('0x2d')](function(){_0x172ad0['forEach'](function(_0x18b5c8){socket[_0xd52f('0x6f')](_0xd52f('0x70'),{'UserId':_0x18b5c8['id'],'FaxQueueId':_0x227a6a['id']});});});});});}})[_0xd52f('0x2d')](respondWithStatusCode(_0x46737f,null))[_0xd52f('0x4b')](handleError(_0x46737f,null));};exports[_0xd52f('0x71')]=function(_0x12bcbf,_0x572a89,_0x5d9884){return db[_0xd52f('0x72')][_0xd52f('0x4a')]({'where':{'id':_0x12bcbf['query'][_0xd52f('0x69')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd52f('0x6a'),'attributes':['id'],'raw':!![]}]})[_0xd52f('0x2d')](handleEntityNotFound(_0x572a89,null))[_0xd52f('0x2d')](function(_0x343306){var _0x4a6259=_[_0xd52f('0x34')](_0x343306,'id');var _0x4cfb4e=[];var _0x1c6d2d=[];var _0x6b9592=squel[_0xd52f('0x73')]();_0x6b9592['field'](_0xd52f('0x74'))[_0xd52f('0x75')](_0xd52f('0x76'),'tq')[_0xd52f('0x77')](_0xd52f('0x78'),'ut',_0xd52f('0x79'))[_0xd52f('0x42')](_0xd52f('0x7a'),_0x12bcbf[_0xd52f('0x58')]['id']);for(var _0x388970=0x0;_0x388970<_0x343306[_0xd52f('0x3e')];_0x388970+=0x1){let _0x2298a4=_0x343306[_0x388970];for(var _0x31e2d7=0x0;_0x31e2d7<_0x2298a4[_0xd52f('0x6a')][_0xd52f('0x3e')];_0x31e2d7+=0x1){let _0x40a2f8=_0x2298a4['Agents'][_0x31e2d7];var _0x36a51c=_0x6b9592['clone']();_0x36a51c['where'](_0xd52f('0x7b'),_0x40a2f8['id']);_0x1c6d2d[_0xd52f('0x7c')](db['sequelize']['query'](_0x36a51c['toString'](),{'type':db[_0xd52f('0x7d')][_0xd52f('0x7e')][_0xd52f('0x7f')]})[_0xd52f('0x2d')](function(_0xda1827){if(_0xda1827[_0xd52f('0x3e')]===0x1){return _0x40a2f8['id'];}else{var _0x40c204=_[_0xd52f('0x80')](_[_0xd52f('0x34')](_0xda1827,_0xd52f('0x81')),function(_0x2fee4b){return _[_0xd52f('0x82')](_0x4a6259,_0x2fee4b);});if(_0x40c204){return _0x40a2f8['id'];}}}));}}return BPromise[_0xd52f('0x83')](_0x1c6d2d)['then'](function(_0x115159){_0x4cfb4e=_(_0x4cfb4e)[_0xd52f('0x84')](_0x115159)[_0xd52f('0x85')]()['value']();return db[_0xd52f('0x48')][_0xd52f('0x4e')]({'where':{'id':_0x12bcbf[_0xd52f('0x58')]['id']}})['then'](function(_0x461bf5){return db[_0xd52f('0x7d')][_0xd52f('0x86')](function(_0x10be6e){return _0x461bf5[_0xd52f('0x71')](_0x12bcbf[_0xd52f('0x39')][_0xd52f('0x69')],{'transaction':_0x10be6e})[_0xd52f('0x2d')](function(){if(!_[_0xd52f('0x87')](_0x4cfb4e)){return _0x461bf5[_0xd52f('0x88')](_0x4cfb4e,{'transaction':_0x10be6e});}})['then'](function(){_0x4cfb4e['forEach'](function(_0x5dcb18){socket['emit'](_0xd52f('0x89'),{'UserId':_0x5dcb18,'FaxQueueId':_0x461bf5['id']});});});});});});})[_0xd52f('0x2d')](respondWithStatusCode(_0x572a89,null))[_0xd52f('0x4b')](handleError(_0x572a89,null));};exports[_0xd52f('0x8a')]=function(_0x357c64,_0xffca92,_0x401983){return db['FaxQueue'][_0xd52f('0x4e')]({'where':{'id':_0x357c64[_0xd52f('0x58')]['id']}})[_0xd52f('0x2d')](handleEntityNotFound(_0xffca92,null))['then'](function(_0x572f09){if(_0x572f09){return _0x572f09[_0xd52f('0x8a')](_0x357c64['body'][_0xd52f('0x69')],_[_0xd52f('0x8b')](_0x357c64['body'],[_0xd52f('0x69'),'id'])||{})[_0xd52f('0x8c')](function(_0x42adff){for(var _0x2901da=0x0;_0x2901da<_0x357c64[_0xd52f('0x50')][_0xd52f('0x69')]['length'];_0x2901da+=0x1){socket[_0xd52f('0x6f')](_0xd52f('0x70'),{'UserId':_0x357c64[_0xd52f('0x50')][_0xd52f('0x69')][_0x2901da],'FaxQueueId':_0x357c64[_0xd52f('0x58')]['id']});}return _0x42adff;});}})[_0xd52f('0x2d')](respondWithResult(_0xffca92,null))[_0xd52f('0x4b')](handleError(_0xffca92,null));};exports[_0xd52f('0x88')]=function(_0x44a8fe,_0x75e02b,_0x52a01a){return db[_0xd52f('0x48')][_0xd52f('0x4e')]({'where':{'id':_0x44a8fe[_0xd52f('0x58')]['id']}})[_0xd52f('0x2d')](handleEntityNotFound(_0x75e02b,null))[_0xd52f('0x2d')](function(_0x555050){if(_0x555050){return _0x555050[_0xd52f('0x88')](_0x44a8fe[_0xd52f('0x39')][_0xd52f('0x69')])[_0xd52f('0x2d')](function(){if(_[_0xd52f('0x8d')](_0x44a8fe[_0xd52f('0x39')][_0xd52f('0x69')])){for(var _0x13ae5e=0x0;_0x13ae5e<_0x44a8fe[_0xd52f('0x39')][_0xd52f('0x69')][_0xd52f('0x3e')];_0x13ae5e+=0x1){socket[_0xd52f('0x6f')]('userFaxQueue:remove',{'UserId':Number(_0x44a8fe[_0xd52f('0x39')]['ids'][_0x13ae5e]),'FaxQueueId':Number(_0x44a8fe[_0xd52f('0x58')]['id'])});}}else{socket[_0xd52f('0x6f')]('userFaxQueue:remove',{'UserId':Number(_0x44a8fe['query'][_0xd52f('0x69')]),'FaxQueueId':Number(_0x44a8fe[_0xd52f('0x58')]['id'])});}});}})[_0xd52f('0x2d')](respondWithStatusCode(_0x75e02b,null))[_0xd52f('0x4b')](handleError(_0x75e02b,null));};exports[_0xd52f('0x8e')]=function(_0x3d3633,_0x19f066,_0x587031){var _0x3dae55={};var _0x4804e2={};var _0x3450de;var _0x2d5cf2;return db[_0xd52f('0x48')][_0xd52f('0x67')]({'where':{'id':_0x3d3633[_0xd52f('0x58')]['id']}})[_0xd52f('0x2d')](handleEntityNotFound(_0x19f066,null))[_0xd52f('0x2d')](function(_0x66cdd){if(_0x66cdd){_0x3450de=_0x66cdd;_0x4804e2[_0xd52f('0x37')]=_[_0xd52f('0x38')](db[_0xd52f('0x5e')][_0xd52f('0x5b')]);_0x4804e2[_0xd52f('0x39')]=_[_0xd52f('0x38')](_0x3d3633[_0xd52f('0x39')]);_0x4804e2[_0xd52f('0x3a')]=_['intersection'](_0x4804e2[_0xd52f('0x37')],_0x4804e2[_0xd52f('0x39')]);_0x3dae55['attributes']=_[_0xd52f('0x3b')](_0x4804e2['model'],qs[_0xd52f('0x3c')](_0x3d3633[_0xd52f('0x39')][_0xd52f('0x3c')]));_0x3dae55['attributes']=_0x3dae55[_0xd52f('0x3d')][_0xd52f('0x3e')]?_0x3dae55[_0xd52f('0x3d')]:_0x4804e2[_0xd52f('0x37')];_0x3dae55[_0xd52f('0x40')]=qs['sort'](_0x3d3633[_0xd52f('0x39')]['sort']);_0x3dae55[_0xd52f('0x42')]=qs['filters'](_[_0xd52f('0x43')](_0x3d3633[_0xd52f('0x39')],_0x4804e2['filters']));if(_0x3d3633[_0xd52f('0x39')][_0xd52f('0x44')]){_0x3dae55[_0xd52f('0x42')]=_[_0xd52f('0x45')](_0x3dae55['where'],{'$or':_[_0xd52f('0x34')](_0x3dae55[_0xd52f('0x3d')],function(_0x4c5616){var _0x54e809={};_0x54e809[_0x4c5616]={'$like':'%'+_0x3d3633[_0xd52f('0x39')][_0xd52f('0x44')]+'%'};return _0x54e809;})});}_0x3dae55=_[_0xd52f('0x45')]({},_0x3dae55,_0x3d3633[_0xd52f('0x47')]);return _0x3450de[_0xd52f('0x8e')](_0x3dae55);}})[_0xd52f('0x2d')](function(_0x1d37ab){if(_0x1d37ab){_0x2d5cf2=_0x1d37ab[_0xd52f('0x3e')];if(!_0x3d3633[_0xd52f('0x39')][_0xd52f('0x3f')](_0xd52f('0x5c'))){_0x3dae55[_0xd52f('0x25')]=qs[_0xd52f('0x25')](_0x3d3633[_0xd52f('0x39')]['limit']);_0x3dae55[_0xd52f('0x24')]=qs[_0xd52f('0x24')](_0x3d3633[_0xd52f('0x39')][_0xd52f('0x24')]);}return _0x3450de['getAgents'](_0x3dae55);}})[_0xd52f('0x2d')](function(_0x30662c){if(_0x30662c){return _0x30662c?{'count':_0x2d5cf2,'rows':_0x30662c}:null;}})[_0xd52f('0x2d')](respondWithResult(_0x19f066,null))[_0xd52f('0x4b')](handleError(_0x19f066,null));}; \ No newline at end of file +var _0x8d5e=['json','offset','limit','set','Content-Range','apply','reject','update','then','get','FaxQueues','UserProfileResource','error','stack','send','map','FaxQueue','rawAttributes','fieldName','key','model','name','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','count','includeAll','include','rows','catch','show','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','destroy','describe','findOne','UserFaxQueue','pick','FaxQueueId','findAll','UserId','faxPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','ids','Agents','interface','flatMap','transaction','addTeams','each','forEach','emit','userFaxQueue:save','removeTeams','User','select','tq.TeamId','from','team_has_fax_queues','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','toString','SELECT','every','TeamId','includes','all','union','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','end','status'];(function(_0x3990d0,_0x52c0ec){var _0x5e6eb8=function(_0xea36d9){while(--_0xea36d9){_0x3990d0['push'](_0x3990d0['shift']());}};_0x5e6eb8(++_0x52c0ec);}(_0x8d5e,0xf6));var _0xe8d5=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x8d5e[_0x13ea00];return _0x1f7347;};'use strict';var pdf=require(_0xe8d5('0x0'));var emlformat=require(_0xe8d5('0x1'));var rimraf=require(_0xe8d5('0x2'));var zipdir=require(_0xe8d5('0x3'));var jsonpatch=require(_0xe8d5('0x4'));var rp=require(_0xe8d5('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe8d5('0x6'));var util=require(_0xe8d5('0x7'));var path=require(_0xe8d5('0x8'));var sox=require(_0xe8d5('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xe8d5('0xa'));var squel=require(_0xe8d5('0xb'));var crypto=require('crypto');var jsforce=require(_0xe8d5('0xc'));var deskjs=require(_0xe8d5('0xd'));var toCsv=require(_0xe8d5('0xe'));var querystring=require(_0xe8d5('0xf'));var Papa=require('papaparse');var Redis=require(_0xe8d5('0x10'));var authService=require(_0xe8d5('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe8d5('0x12'));var logger=require(_0xe8d5('0x13'))('api');var utils=require(_0xe8d5('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0xe8d5('0x15')](config[_0xe8d5('0x16')],{'host':_0xe8d5('0x17'),'port':0x18eb});var socket=require(_0xe8d5('0x18'))(new Redis(config[_0xe8d5('0x16')]));require(_0xe8d5('0x19'))[_0xe8d5('0x1a')](socket);function respondWithStatusCode(_0x1f8bf7,_0x32153d){_0x32153d=_0x32153d||0xcc;return function(_0x40c7e9){if(_0x40c7e9){return _0x1f8bf7[_0xe8d5('0x1b')](_0x32153d);}return _0x1f8bf7['status'](_0x32153d)[_0xe8d5('0x1c')]();};}function respondWithResult(_0xd213e1,_0x5c2f3e){_0x5c2f3e=_0x5c2f3e||0xc8;return function(_0x2f6445){if(_0x2f6445){return _0xd213e1[_0xe8d5('0x1d')](_0x5c2f3e)[_0xe8d5('0x1e')](_0x2f6445);}};}function respondWithFilteredResult(_0x180a99,_0x5e6933){return function(_0x46713f){if(_0x46713f){var _0x4660f2=_0x46713f['count'],_0x5c40c4=_0x5e6933[_0xe8d5('0x1f')],_0x529770=_0x5e6933['offset']+_0x5e6933[_0xe8d5('0x20')],_0x46d8a6;if(_0x529770>=_0x4660f2){_0x529770=_0x4660f2;_0x46d8a6=0xc8;}else{_0x46d8a6=0xce;}_0x180a99[_0xe8d5('0x1d')](_0x46d8a6);return _0x180a99[_0xe8d5('0x21')](_0xe8d5('0x22'),_0x5c40c4+'-'+_0x529770+'/'+_0x4660f2)[_0xe8d5('0x1e')](_0x46713f);}return null;};}function patchUpdates(_0x481083){return function(_0x545514){try{jsonpatch[_0xe8d5('0x23')](_0x545514,_0x481083,!![]);}catch(_0x5cc8b7){return BPromise[_0xe8d5('0x24')](_0x5cc8b7);}return _0x545514['save']();};}function saveUpdates(_0x3f4f18,_0x2d0c75){return function(_0x314452){if(_0x314452){return _0x314452[_0xe8d5('0x25')](_0x3f4f18)[_0xe8d5('0x26')](function(_0x13e7c9){return _0x13e7c9;});}return null;};}function removeEntity(_0x5c8c96,_0x231605){return function(_0x351f51){if(_0x351f51){return _0x351f51['destroy']()[_0xe8d5('0x26')](function(){var _0x6db699=_0x351f51[_0xe8d5('0x27')]({'plain':!![]});var _0x1532e8=_0xe8d5('0x28');return db[_0xe8d5('0x29')]['destroy']({'where':{'type':_0x1532e8,'resourceId':_0x6db699['id']}})[_0xe8d5('0x26')](function(){return _0x351f51;});})[_0xe8d5('0x26')](function(){_0x5c8c96[_0xe8d5('0x1d')](0xcc)[_0xe8d5('0x1c')]();});}};}function handleEntityNotFound(_0x442326,_0x1b8f2e){return function(_0x71007f){if(!_0x71007f){_0x442326['sendStatus'](0x194);}return _0x71007f;};}function handleError(_0x49a069,_0x3fd052){_0x3fd052=_0x3fd052||0x1f4;return function(_0x2263a6){logger[_0xe8d5('0x2a')](_0x2263a6[_0xe8d5('0x2b')]);if(_0x2263a6['name']){delete _0x2263a6['name'];}_0x49a069[_0xe8d5('0x1d')](_0x3fd052)[_0xe8d5('0x2c')](_0x2263a6);};}exports['index']=function(_0x3c1c9a,_0x5a2766){var _0x2d84e2={},_0x29a001={},_0x55fa58={'count':0x0,'rows':[]};var _0xdc3aa8=_[_0xe8d5('0x2d')](db[_0xe8d5('0x2e')][_0xe8d5('0x2f')],function(_0x1e98f1){return{'name':_0x1e98f1[_0xe8d5('0x30')],'type':_0x1e98f1['type'][_0xe8d5('0x31')]};});_0x29a001[_0xe8d5('0x32')]=_['map'](_0xdc3aa8,_0xe8d5('0x33'));_0x29a001[_0xe8d5('0x34')]=_[_0xe8d5('0x35')](_0x3c1c9a[_0xe8d5('0x34')]);_0x29a001['filters']=_[_0xe8d5('0x36')](_0x29a001[_0xe8d5('0x32')],_0x29a001[_0xe8d5('0x34')]);_0x2d84e2['attributes']=_['intersection'](_0x29a001['model'],qs[_0xe8d5('0x37')](_0x3c1c9a['query'][_0xe8d5('0x37')]));_0x2d84e2[_0xe8d5('0x38')]=_0x2d84e2['attributes'][_0xe8d5('0x39')]?_0x2d84e2[_0xe8d5('0x38')]:_0x29a001['model'];if(!_0x3c1c9a[_0xe8d5('0x34')][_0xe8d5('0x3a')](_0xe8d5('0x3b'))){_0x2d84e2[_0xe8d5('0x20')]=qs['limit'](_0x3c1c9a[_0xe8d5('0x34')]['limit']);_0x2d84e2[_0xe8d5('0x1f')]=qs[_0xe8d5('0x1f')](_0x3c1c9a[_0xe8d5('0x34')]['offset']);}_0x2d84e2[_0xe8d5('0x3c')]=qs[_0xe8d5('0x3d')](_0x3c1c9a[_0xe8d5('0x34')][_0xe8d5('0x3d')]);_0x2d84e2[_0xe8d5('0x3e')]=qs[_0xe8d5('0x3f')](_['pick'](_0x3c1c9a[_0xe8d5('0x34')],_0x29a001[_0xe8d5('0x3f')]),_0xdc3aa8);if(_0x3c1c9a[_0xe8d5('0x34')][_0xe8d5('0x40')]){_0x2d84e2[_0xe8d5('0x3e')]=_[_0xe8d5('0x41')](_0x2d84e2[_0xe8d5('0x3e')],{'$or':_[_0xe8d5('0x2d')](_0xdc3aa8,function(_0x529756){if(_0x529756[_0xe8d5('0x42')]!==_0xe8d5('0x43')){var _0x284d11={};_0x284d11[_0x529756[_0xe8d5('0x33')]]={'$like':'%'+_0x3c1c9a[_0xe8d5('0x34')][_0xe8d5('0x40')]+'%'};return _0x284d11;}})});}_0x2d84e2=_[_0xe8d5('0x41')]({},_0x2d84e2,_0x3c1c9a[_0xe8d5('0x44')]);var _0x4ea713={'where':_0x2d84e2[_0xe8d5('0x3e')]};return db[_0xe8d5('0x2e')]['count'](_0x4ea713)[_0xe8d5('0x26')](function(_0x5ccf1a){_0x55fa58[_0xe8d5('0x45')]=_0x5ccf1a;if(_0x3c1c9a[_0xe8d5('0x34')][_0xe8d5('0x46')]){_0x2d84e2[_0xe8d5('0x47')]=[{'all':!![]}];}return db[_0xe8d5('0x2e')]['findAll'](_0x2d84e2);})['then'](function(_0x205f04){_0x55fa58[_0xe8d5('0x48')]=_0x205f04;return _0x55fa58;})['then'](respondWithFilteredResult(_0x5a2766,_0x2d84e2))[_0xe8d5('0x49')](handleError(_0x5a2766,null));};exports[_0xe8d5('0x4a')]=function(_0x532d12,_0x36fc87){var _0x51644d={'raw':!![],'where':{'id':_0x532d12['params']['id']}},_0x22c903={};_0x22c903[_0xe8d5('0x32')]=_[_0xe8d5('0x35')](db['FaxQueue'][_0xe8d5('0x2f')]);_0x22c903[_0xe8d5('0x34')]=_[_0xe8d5('0x35')](_0x532d12[_0xe8d5('0x34')]);_0x22c903[_0xe8d5('0x3f')]=_[_0xe8d5('0x36')](_0x22c903[_0xe8d5('0x32')],_0x22c903[_0xe8d5('0x34')]);_0x51644d[_0xe8d5('0x38')]=_[_0xe8d5('0x36')](_0x22c903[_0xe8d5('0x32')],qs[_0xe8d5('0x37')](_0x532d12[_0xe8d5('0x34')]['fields']));_0x51644d[_0xe8d5('0x38')]=_0x51644d[_0xe8d5('0x38')][_0xe8d5('0x39')]?_0x51644d[_0xe8d5('0x38')]:_0x22c903[_0xe8d5('0x32')];if(_0x532d12[_0xe8d5('0x34')][_0xe8d5('0x46')]){_0x51644d['include']=[{'all':!![]}];}_0x51644d=_[_0xe8d5('0x41')]({},_0x51644d,_0x532d12[_0xe8d5('0x44')]);return db[_0xe8d5('0x2e')][_0xe8d5('0x4b')](_0x51644d)[_0xe8d5('0x26')](handleEntityNotFound(_0x36fc87,null))[_0xe8d5('0x26')](respondWithResult(_0x36fc87,null))[_0xe8d5('0x49')](handleError(_0x36fc87,null));};exports[_0xe8d5('0x4c')]=function(_0x26ea7d,_0x1a0795){return db[_0xe8d5('0x2e')]['create'](_0x26ea7d[_0xe8d5('0x4d')],{})[_0xe8d5('0x26')](function(_0xb93aee){var _0x499792=_0x26ea7d['user'][_0xe8d5('0x27')]({'plain':!![]});if(!_0x499792)throw new Error(_0xe8d5('0x4e'));if(_0x499792[_0xe8d5('0x4f')]===_0xe8d5('0x50')){var _0x4d9840=_0xb93aee[_0xe8d5('0x27')]({'plain':!![]});var _0x215cab=_0xe8d5('0x28');return db[_0xe8d5('0x51')][_0xe8d5('0x4b')]({'where':{'name':_0x215cab,'userProfileId':_0x499792[_0xe8d5('0x52')]},'raw':!![]})[_0xe8d5('0x26')](function(_0x2812fe){if(_0x2812fe&&_0x2812fe[_0xe8d5('0x53')]===0x0){return db['UserProfileResource'][_0xe8d5('0x4c')]({'name':_0x4d9840[_0xe8d5('0x33')],'resourceId':_0x4d9840['id'],'type':_0x2812fe[_0xe8d5('0x33')],'sectionId':_0x2812fe['id']},{})[_0xe8d5('0x26')](function(){return _0xb93aee;});}else{return _0xb93aee;}})['catch'](function(_0x38cd36){logger['error'](_0xe8d5('0x54'),_0x38cd36);throw _0x38cd36;});}return _0xb93aee;})[_0xe8d5('0x26')](respondWithResult(_0x1a0795,0xc9))['catch'](handleError(_0x1a0795,null));};exports['update']=function(_0x1a8733,_0x5a64ca){if(_0x1a8733[_0xe8d5('0x4d')]['id']){delete _0x1a8733[_0xe8d5('0x4d')]['id'];}return db[_0xe8d5('0x2e')][_0xe8d5('0x4b')]({'where':{'id':_0x1a8733[_0xe8d5('0x55')]['id']}})[_0xe8d5('0x26')](handleEntityNotFound(_0x5a64ca,null))['then'](saveUpdates(_0x1a8733['body'],null))[_0xe8d5('0x26')](respondWithResult(_0x5a64ca,null))[_0xe8d5('0x49')](handleError(_0x5a64ca,null));};exports[_0xe8d5('0x56')]=function(_0x23f2cc,_0x51e31e){return db['FaxQueue'][_0xe8d5('0x4b')]({'where':{'id':_0x23f2cc['params']['id']}})[_0xe8d5('0x26')](handleEntityNotFound(_0x51e31e,null))[_0xe8d5('0x26')](removeEntity(_0x51e31e,null))[_0xe8d5('0x49')](handleError(_0x51e31e,null));};exports['describe']=function(_0x18a746,_0xe7bbf1){return db[_0xe8d5('0x2e')][_0xe8d5('0x57')]()[_0xe8d5('0x26')](respondWithResult(_0xe7bbf1,null))[_0xe8d5('0x49')](handleError(_0xe7bbf1,null));};exports['getMembers']=function(_0x23de30,_0x2d1330,_0x21aaf6){var _0x1bfbba={'raw':!![],'where':{}},_0x18c7fa={},_0x3e2ebe;return db[_0xe8d5('0x2e')][_0xe8d5('0x58')]({'where':{'id':_0x23de30[_0xe8d5('0x55')]['id']}})[_0xe8d5('0x26')](handleEntityNotFound(_0x2d1330,null))[_0xe8d5('0x26')](function(_0x1e1e29){if(_0x1e1e29){_0x3e2ebe=_0x1e1e29[_0xe8d5('0x27')]({'plain':!![]});_0x18c7fa[_0xe8d5('0x32')]=_[_0xe8d5('0x35')](db[_0xe8d5('0x59')]['rawAttributes']);_0x18c7fa[_0xe8d5('0x34')]=_['keys'](_0x23de30['query']);_0x18c7fa[_0xe8d5('0x3f')]=_['intersection'](_0x18c7fa[_0xe8d5('0x32')],_0x18c7fa[_0xe8d5('0x34')]);_0x1bfbba['attributes']=_[_0xe8d5('0x36')](_0x18c7fa[_0xe8d5('0x32')],qs[_0xe8d5('0x37')](_0x23de30[_0xe8d5('0x34')][_0xe8d5('0x37')]));_0x1bfbba[_0xe8d5('0x38')]=_0x1bfbba[_0xe8d5('0x38')][_0xe8d5('0x39')]?_0x1bfbba[_0xe8d5('0x38')]:_0x18c7fa[_0xe8d5('0x32')];if(!_0x23de30[_0xe8d5('0x34')][_0xe8d5('0x3a')](_0xe8d5('0x3b'))){_0x1bfbba[_0xe8d5('0x20')]=qs['limit'](_0x23de30['query'][_0xe8d5('0x20')]);_0x1bfbba[_0xe8d5('0x1f')]=qs[_0xe8d5('0x1f')](_0x23de30[_0xe8d5('0x34')][_0xe8d5('0x1f')]);}_0x1bfbba[_0xe8d5('0x3c')]=qs['sort'](_0x23de30[_0xe8d5('0x34')]['sort']);_0x1bfbba[_0xe8d5('0x3e')]=qs['filters'](_[_0xe8d5('0x5a')](_0x23de30['query'],_0x18c7fa[_0xe8d5('0x3f')]));_0x1bfbba[_0xe8d5('0x3e')][_0xe8d5('0x5b')]=_0x1e1e29['id'];if(_0x23de30[_0xe8d5('0x34')]['filter']){_0x1bfbba[_0xe8d5('0x3e')]=_[_0xe8d5('0x41')](_0x1bfbba[_0xe8d5('0x3e')],{'$or':_[_0xe8d5('0x2d')](_0x1bfbba[_0xe8d5('0x38')],function(_0x454beb){var _0x55d593={};_0x55d593[_0x454beb]={'$like':'%'+_0x23de30[_0xe8d5('0x34')][_0xe8d5('0x40')]+'%'};return _0x55d593;})});}_0x1bfbba=_[_0xe8d5('0x41')]({},_0x1bfbba,_0x23de30[_0xe8d5('0x44')]);return db[_0xe8d5('0x59')][_0xe8d5('0x5c')](_0x1bfbba);}})[_0xe8d5('0x26')](function(_0x4f13c4){if(_0x4f13c4){return db['User']['findAndCountAll']({'where':{'id':_[_0xe8d5('0x2d')](_0x4f13c4,_0xe8d5('0x5d')),'role':'agent'},'attributes':['id',_0xe8d5('0x33'),_0xe8d5('0x5e'),_0xe8d5('0x5f'),_0xe8d5('0x60')]});}})['then'](function(_0x193c2a){if(_0x193c2a){return{'count':_0x193c2a[_0xe8d5('0x45')],'rows':_[_0xe8d5('0x2d')](_0x193c2a['rows'],function(_0x15ad2d){return{'membername':_0x15ad2d[_0xe8d5('0x33')],'UserId':_0x15ad2d['id'],'queue_name':_0x3e2ebe['name'],'FaxQueueId':_0x3e2ebe['id'],'interface':util[_0xe8d5('0x61')](_0xe8d5('0x62'),_0xe8d5('0x63'),_0x15ad2d['name']),'penalty':0x0,'paused':_0x15ad2d[_0xe8d5('0x5e')],'createdAt':_0x15ad2d[_0xe8d5('0x60')],'updatedAt':_0x15ad2d[_0xe8d5('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2d1330,_0x1bfbba))[_0xe8d5('0x49')](handleError(_0x2d1330,null));};exports['getTeams']=function(_0xe521c8,_0x1e80c2,_0x50ea16){var _0x3b0ff6={};var _0x6734e9={};var _0x32e29e;var _0x25d8c6;return db[_0xe8d5('0x2e')][_0xe8d5('0x58')]({'where':{'id':_0xe521c8[_0xe8d5('0x55')]['id']}})[_0xe8d5('0x26')](handleEntityNotFound(_0x1e80c2,null))[_0xe8d5('0x26')](function(_0xf8d989){if(_0xf8d989){_0x32e29e=_0xf8d989;_0x6734e9[_0xe8d5('0x32')]=_[_0xe8d5('0x35')](db[_0xe8d5('0x64')][_0xe8d5('0x2f')]);_0x6734e9[_0xe8d5('0x34')]=_[_0xe8d5('0x35')](_0xe521c8[_0xe8d5('0x34')]);_0x6734e9[_0xe8d5('0x3f')]=_[_0xe8d5('0x36')](_0x6734e9[_0xe8d5('0x32')],_0x6734e9[_0xe8d5('0x34')]);_0x3b0ff6['attributes']=_['intersection'](_0x6734e9['model'],qs[_0xe8d5('0x37')](_0xe521c8[_0xe8d5('0x34')][_0xe8d5('0x37')]));_0x3b0ff6['attributes']=_0x3b0ff6[_0xe8d5('0x38')][_0xe8d5('0x39')]?_0x3b0ff6[_0xe8d5('0x38')]:_0x6734e9[_0xe8d5('0x32')];_0x3b0ff6[_0xe8d5('0x3c')]=qs['sort'](_0xe521c8[_0xe8d5('0x34')][_0xe8d5('0x3d')]);_0x3b0ff6['where']=qs[_0xe8d5('0x3f')](_[_0xe8d5('0x5a')](_0xe521c8[_0xe8d5('0x34')],_0x6734e9[_0xe8d5('0x3f')]));if(_0xe521c8[_0xe8d5('0x34')][_0xe8d5('0x40')]){_0x3b0ff6[_0xe8d5('0x3e')]=_['merge'](_0x3b0ff6[_0xe8d5('0x3e')],{'$or':_[_0xe8d5('0x2d')](_0x3b0ff6[_0xe8d5('0x38')],function(_0x594283){var _0x12b662={};_0x12b662[_0x594283]={'$like':'%'+_0xe521c8[_0xe8d5('0x34')][_0xe8d5('0x40')]+'%'};return _0x12b662;})});}_0x3b0ff6=_[_0xe8d5('0x41')]({},_0x3b0ff6,_0xe521c8[_0xe8d5('0x44')]);return _0x32e29e[_0xe8d5('0x65')](_0x3b0ff6);}})[_0xe8d5('0x26')](function(_0xdeaf83){if(_0xdeaf83){_0x25d8c6=_0xdeaf83['length'];if(!_0xe521c8[_0xe8d5('0x34')][_0xe8d5('0x3a')](_0xe8d5('0x3b'))){_0x3b0ff6[_0xe8d5('0x20')]=qs['limit'](_0xe521c8[_0xe8d5('0x34')][_0xe8d5('0x20')]);_0x3b0ff6[_0xe8d5('0x1f')]=qs[_0xe8d5('0x1f')](_0xe521c8[_0xe8d5('0x34')]['offset']);}return _0x32e29e['getTeams'](_0x3b0ff6);}})[_0xe8d5('0x26')](function(_0x1e15e3){if(_0x1e15e3){return _0x1e15e3?{'count':_0x25d8c6,'rows':_0x1e15e3}:null;}})['then'](respondWithResult(_0x1e80c2,null))[_0xe8d5('0x49')](handleError(_0x1e80c2,null));};exports['addTeams']=function(_0x559335,_0x305d9a,_0x39fc68){var _0x40c333=_0x559335[_0xe8d5('0x4d')][_0xe8d5('0x66')];return db[_0xe8d5('0x64')][_0xe8d5('0x5c')]({'where':{'id':_0x40c333},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe8d5('0x67'),'attributes':['id','name','online','voicePause',_0xe8d5('0x68')],'raw':!![]}]})[_0xe8d5('0x26')](function(_0x38e46c){if(_0x38e46c){var _0x17e526=_[_0xe8d5('0x69')](_0x38e46c,function(_0x479ce2){var _0x23f15b=_0x479ce2['get']({'plain':!![]});return _0x23f15b[_0xe8d5('0x67')];});return db['FaxQueue'][_0xe8d5('0x4b')]({'where':{'id':_0x559335['params']['id']}})[_0xe8d5('0x26')](function(_0x2037ce){return db['sequelize'][_0xe8d5('0x6a')](function(_0x45e598){return _0x2037ce[_0xe8d5('0x6b')](_0x40c333,{'transaction':_0x45e598})[_0xe8d5('0x26')](function(){return BPromise[_0xe8d5('0x6c')](_0x17e526,function(_0x49a90f){return db[_0xe8d5('0x59')]['findOrCreate']({'where':{'UserId':_0x49a90f['id'],'FaxQueueId':_0x559335[_0xe8d5('0x55')]['id']},'transaction':_0x45e598});});})[_0xe8d5('0x26')](function(){_0x17e526[_0xe8d5('0x6d')](function(_0x59ae52){socket[_0xe8d5('0x6e')](_0xe8d5('0x6f'),{'UserId':_0x59ae52['id'],'FaxQueueId':_0x2037ce['id']});});});});});}})[_0xe8d5('0x26')](respondWithStatusCode(_0x305d9a,null))['catch'](handleError(_0x305d9a,null));};exports[_0xe8d5('0x70')]=function(_0x4c2959,_0x2a5cb4,_0x4f732d){return db[_0xe8d5('0x64')][_0xe8d5('0x5c')]({'where':{'id':_0x4c2959[_0xe8d5('0x34')]['ids']},'attributes':['id'],'include':[{'model':db[_0xe8d5('0x71')],'as':_0xe8d5('0x67'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2a5cb4,null))[_0xe8d5('0x26')](function(_0x1c00ec){var _0x4c545d=_['map'](_0x1c00ec,'id');var _0x9fc36=[];var _0x5c946e=[];var _0x2b6b44=squel[_0xe8d5('0x72')]();_0x2b6b44['field'](_0xe8d5('0x73'))[_0xe8d5('0x74')](_0xe8d5('0x75'),'tq')['join']('user_has_teams','ut',_0xe8d5('0x76'))['where'](_0xe8d5('0x77'),_0x4c2959[_0xe8d5('0x55')]['id']);for(var _0x3520e2=0x0;_0x3520e2<_0x1c00ec[_0xe8d5('0x39')];_0x3520e2+=0x1){let _0x291612=_0x1c00ec[_0x3520e2];for(var _0x5f03f5=0x0;_0x5f03f5<_0x291612['Agents']['length'];_0x5f03f5+=0x1){let _0x2efafa=_0x291612['Agents'][_0x5f03f5];var _0x222d6a=_0x2b6b44[_0xe8d5('0x78')]();_0x222d6a[_0xe8d5('0x3e')](_0xe8d5('0x79'),_0x2efafa['id']);_0x5c946e['push'](db[_0xe8d5('0x7a')][_0xe8d5('0x34')](_0x222d6a[_0xe8d5('0x7b')](),{'type':db[_0xe8d5('0x7a')]['QueryTypes'][_0xe8d5('0x7c')]})[_0xe8d5('0x26')](function(_0x5023ae){if(_0x5023ae[_0xe8d5('0x39')]===0x1){return _0x2efafa['id'];}else{var _0x34dffb=_[_0xe8d5('0x7d')](_[_0xe8d5('0x2d')](_0x5023ae,_0xe8d5('0x7e')),function(_0xd9b43b){return _[_0xe8d5('0x7f')](_0x4c545d,_0xd9b43b);});if(_0x34dffb){return _0x2efafa['id'];}}}));}}return BPromise[_0xe8d5('0x80')](_0x5c946e)[_0xe8d5('0x26')](function(_0x4d87f6){_0x9fc36=_(_0x9fc36)[_0xe8d5('0x81')](_0x4d87f6)['compact']()[_0xe8d5('0x82')]();return db[_0xe8d5('0x2e')][_0xe8d5('0x4b')]({'where':{'id':_0x4c2959[_0xe8d5('0x55')]['id']}})[_0xe8d5('0x26')](function(_0x19da32){return db[_0xe8d5('0x7a')]['transaction'](function(_0x3f4174){return _0x19da32[_0xe8d5('0x70')](_0x4c2959[_0xe8d5('0x34')][_0xe8d5('0x66')],{'transaction':_0x3f4174})['then'](function(){if(!_[_0xe8d5('0x83')](_0x9fc36)){return _0x19da32[_0xe8d5('0x84')](_0x9fc36,{'transaction':_0x3f4174});}})[_0xe8d5('0x26')](function(){_0x9fc36[_0xe8d5('0x6d')](function(_0xd8ccbb){socket[_0xe8d5('0x6e')](_0xe8d5('0x85'),{'UserId':_0xd8ccbb,'FaxQueueId':_0x19da32['id']});});});});});});})[_0xe8d5('0x26')](respondWithStatusCode(_0x2a5cb4,null))[_0xe8d5('0x49')](handleError(_0x2a5cb4,null));};exports[_0xe8d5('0x86')]=function(_0x332c3d,_0xeefe0a,_0x517ebd){return db['FaxQueue'][_0xe8d5('0x4b')]({'where':{'id':_0x332c3d['params']['id']}})[_0xe8d5('0x26')](handleEntityNotFound(_0xeefe0a,null))[_0xe8d5('0x26')](function(_0x3c2a7c){if(_0x3c2a7c){return _0x3c2a7c['addAgents'](_0x332c3d['body']['ids'],_[_0xe8d5('0x87')](_0x332c3d['body'],[_0xe8d5('0x66'),'id'])||{})['spread'](function(_0x6f757f){for(var _0x28e97e=0x0;_0x28e97e<_0x332c3d[_0xe8d5('0x4d')][_0xe8d5('0x66')]['length'];_0x28e97e+=0x1){socket[_0xe8d5('0x6e')](_0xe8d5('0x6f'),{'UserId':_0x332c3d[_0xe8d5('0x4d')][_0xe8d5('0x66')][_0x28e97e],'FaxQueueId':_0x332c3d[_0xe8d5('0x55')]['id']});}return _0x6f757f;});}})[_0xe8d5('0x26')](respondWithResult(_0xeefe0a,null))[_0xe8d5('0x49')](handleError(_0xeefe0a,null));};exports[_0xe8d5('0x84')]=function(_0x19f2af,_0xb8a84f,_0x31b5a8){return db[_0xe8d5('0x2e')]['find']({'where':{'id':_0x19f2af[_0xe8d5('0x55')]['id']}})['then'](handleEntityNotFound(_0xb8a84f,null))['then'](function(_0x3fc61c){if(_0x3fc61c){return _0x3fc61c[_0xe8d5('0x84')](_0x19f2af['query'][_0xe8d5('0x66')])[_0xe8d5('0x26')](function(){if(_[_0xe8d5('0x88')](_0x19f2af[_0xe8d5('0x34')][_0xe8d5('0x66')])){for(var _0xbf0840=0x0;_0xbf0840<_0x19f2af[_0xe8d5('0x34')]['ids'][_0xe8d5('0x39')];_0xbf0840+=0x1){socket[_0xe8d5('0x6e')](_0xe8d5('0x85'),{'UserId':Number(_0x19f2af[_0xe8d5('0x34')][_0xe8d5('0x66')][_0xbf0840]),'FaxQueueId':Number(_0x19f2af[_0xe8d5('0x55')]['id'])});}}else{socket[_0xe8d5('0x6e')](_0xe8d5('0x85'),{'UserId':Number(_0x19f2af[_0xe8d5('0x34')][_0xe8d5('0x66')]),'FaxQueueId':Number(_0x19f2af[_0xe8d5('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0xb8a84f,null))[_0xe8d5('0x49')](handleError(_0xb8a84f,null));};exports['getAgents']=function(_0x1f7d3f,_0x4b95b5,_0x39c453){var _0xc3a381={};var _0x184def={};var _0xddd4ad;var _0x282b67;return db['FaxQueue'][_0xe8d5('0x58')]({'where':{'id':_0x1f7d3f[_0xe8d5('0x55')]['id']}})['then'](handleEntityNotFound(_0x4b95b5,null))['then'](function(_0xbae53a){if(_0xbae53a){_0xddd4ad=_0xbae53a;_0x184def['model']=_['keys'](db[_0xe8d5('0x71')][_0xe8d5('0x2f')]);_0x184def[_0xe8d5('0x34')]=_['keys'](_0x1f7d3f[_0xe8d5('0x34')]);_0x184def[_0xe8d5('0x3f')]=_[_0xe8d5('0x36')](_0x184def[_0xe8d5('0x32')],_0x184def[_0xe8d5('0x34')]);_0xc3a381[_0xe8d5('0x38')]=_['intersection'](_0x184def[_0xe8d5('0x32')],qs[_0xe8d5('0x37')](_0x1f7d3f[_0xe8d5('0x34')][_0xe8d5('0x37')]));_0xc3a381[_0xe8d5('0x38')]=_0xc3a381[_0xe8d5('0x38')][_0xe8d5('0x39')]?_0xc3a381[_0xe8d5('0x38')]:_0x184def[_0xe8d5('0x32')];_0xc3a381['order']=qs['sort'](_0x1f7d3f[_0xe8d5('0x34')]['sort']);_0xc3a381[_0xe8d5('0x3e')]=qs[_0xe8d5('0x3f')](_[_0xe8d5('0x5a')](_0x1f7d3f[_0xe8d5('0x34')],_0x184def[_0xe8d5('0x3f')]));if(_0x1f7d3f['query'][_0xe8d5('0x40')]){_0xc3a381[_0xe8d5('0x3e')]=_[_0xe8d5('0x41')](_0xc3a381[_0xe8d5('0x3e')],{'$or':_[_0xe8d5('0x2d')](_0xc3a381['attributes'],function(_0x455b43){var _0x20ef0a={};_0x20ef0a[_0x455b43]={'$like':'%'+_0x1f7d3f[_0xe8d5('0x34')]['filter']+'%'};return _0x20ef0a;})});}_0xc3a381=_[_0xe8d5('0x41')]({},_0xc3a381,_0x1f7d3f[_0xe8d5('0x44')]);return _0xddd4ad['getAgents'](_0xc3a381);}})[_0xe8d5('0x26')](function(_0x323266){if(_0x323266){_0x282b67=_0x323266['length'];if(!_0x1f7d3f[_0xe8d5('0x34')][_0xe8d5('0x3a')](_0xe8d5('0x3b'))){_0xc3a381['limit']=qs[_0xe8d5('0x20')](_0x1f7d3f['query'][_0xe8d5('0x20')]);_0xc3a381[_0xe8d5('0x1f')]=qs[_0xe8d5('0x1f')](_0x1f7d3f['query'][_0xe8d5('0x1f')]);}return _0xddd4ad[_0xe8d5('0x89')](_0xc3a381);}})[_0xe8d5('0x26')](function(_0x23734a){if(_0x23734a){return _0x23734a?{'count':_0x282b67,'rows':_0x23734a}:null;}})[_0xe8d5('0x26')](respondWithResult(_0x4b95b5,null))[_0xe8d5('0x49')](handleError(_0x4b95b5,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index fa991d7..f42f0d9 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 _0xc736=['events','../../mysqldb','FaxQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x176b3c,_0x3016ca){var _0x459e58=function(_0x49dd1b){while(--_0x49dd1b){_0x176b3c['push'](_0x176b3c['shift']());}};_0x459e58(++_0x3016ca);}(_0xc736,0xf2));var _0x6c73=function(_0x4b01c0,_0x199466){_0x4b01c0=_0x4b01c0-0x0;var _0x33c771=_0xc736[_0x4b01c0];return _0x33c771;};'use strict';var EventEmitter=require(_0x6c73('0x0'));var FaxQueue=require(_0x6c73('0x1'))['db'][_0x6c73('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x6c73('0x3')](0x0);var events={'afterCreate':_0x6c73('0x4'),'afterUpdate':_0x6c73('0x5'),'afterDestroy':_0x6c73('0x6')};function emitEvent(_0x4414ad){return function(_0x1652bf,_0x21980c,_0x2a885d){FaxQueueEvents[_0x6c73('0x7')](_0x4414ad+':'+_0x1652bf['id'],_0x1652bf);FaxQueueEvents[_0x6c73('0x7')](_0x4414ad,_0x1652bf);_0x2a885d(null);};}for(var e in events){if(events[_0x6c73('0x8')](e)){var event=events[e];FaxQueue[_0x6c73('0x9')](e,emitEvent(event));}}module[_0x6c73('0xa')]=FaxQueueEvents; \ No newline at end of file +var _0x1daa=['../../mysqldb','setMaxListeners','save','update','remove','hasOwnProperty','hook','exports','events'];(function(_0x420a73,_0x5e1d56){var _0x1dca20=function(_0x2d2ca3){while(--_0x2d2ca3){_0x420a73['push'](_0x420a73['shift']());}};_0x1dca20(++_0x5e1d56);}(_0x1daa,0x131));var _0xa1da=function(_0x1f146c,_0xfb86d6){_0x1f146c=_0x1f146c-0x0;var _0x2354fb=_0x1daa[_0x1f146c];return _0x2354fb;};'use strict';var EventEmitter=require(_0xa1da('0x0'));var FaxQueue=require(_0xa1da('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xa1da('0x2')](0x0);var events={'afterCreate':_0xa1da('0x3'),'afterUpdate':_0xa1da('0x4'),'afterDestroy':_0xa1da('0x5')};function emitEvent(_0x259014){return function(_0x10eae0,_0x51b029,_0x4c7415){FaxQueueEvents['emit'](_0x259014+':'+_0x10eae0['id'],_0x10eae0);FaxQueueEvents['emit'](_0x259014,_0x10eae0);_0x4c7415(null);};}for(var e in events){if(events[_0xa1da('0x6')](e)){var event=events[e];FaxQueue[_0xa1da('0x7')](e,emitEvent(event));}}module[_0xa1da('0x8')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 4c82448..d525800 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 _0x7551=['fax_queues','lodash','util','api','moment','../../config/environment','exports','define','FaxQueue'];(function(_0x24a6bb,_0x50032e){var _0x2b2f66=function(_0x5b8739){while(--_0x5b8739){_0x24a6bb['push'](_0x24a6bb['shift']());}};_0x2b2f66(++_0x50032e);}(_0x7551,0x64));var _0x1755=function(_0x317eec,_0x3ee146){_0x317eec=_0x317eec-0x0;var _0x35a465=_0x7551[_0x317eec];return _0x35a465;};'use strict';var _=require(_0x1755('0x0'));var util=require(_0x1755('0x1'));var logger=require('../../config/logger')(_0x1755('0x2'));var moment=require(_0x1755('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1755('0x4'));var attributes=require('./faxQueue.attributes');module[_0x1755('0x5')]=function(_0x3832cd,_0x1fceb7){return _0x3832cd[_0x1755('0x6')](_0x1755('0x7'),attributes,{'tableName':_0x1755('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x623e=['fax_queues','lodash','util','api','bluebird','path','rimraf','exports','FaxQueue'];(function(_0x3fe6df,_0x5a04d4){var _0x372a0e=function(_0x144b98){while(--_0x144b98){_0x3fe6df['push'](_0x3fe6df['shift']());}};_0x372a0e(++_0x5a04d4);}(_0x623e,0x184));var _0xe623=function(_0x44e239,_0x35c138){_0x44e239=_0x44e239-0x0;var _0x2df409=_0x623e[_0x44e239];return _0x2df409;};'use strict';var _=require(_0xe623('0x0'));var util=require(_0xe623('0x1'));var logger=require('../../config/logger')(_0xe623('0x2'));var moment=require('moment');var BPromise=require(_0xe623('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe623('0x4'));var rimraf=require(_0xe623('0x5'));var config=require('../../config/environment');var attributes=require('./faxQueue.attributes');module[_0xe623('0x6')]=function(_0x2417fe,_0x2948ce){return _0x2417fe['define'](_0xe623('0x7'),attributes,{'tableName':_0xe623('0x8'),'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 f4a9a6e..f85b465 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 _0xf9b4=['ShowFaxQueue','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','redis','socket.io-emitter','./faxQueue.socket','register','request','then','info','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','FaxQueue,\x20%s,\x20%s','message','result','catch','FaxQueue','findAll','options','raw','where','attributes','limit','include','model','map','debug','GetFaxQueue'];(function(_0x45bb9c,_0x3a1bf0){var _0x510cfc=function(_0x190ac6){while(--_0x190ac6){_0x45bb9c['push'](_0x45bb9c['shift']());}};_0x510cfc(++_0x3a1bf0);}(_0xf9b4,0x161));var _0x4f9b=function(_0xf73390,_0x14c109){_0xf73390=_0xf73390-0x0;var _0x4b212f=_0xf9b4[_0xf73390];return _0x4b212f;};'use strict';var _=require('lodash');var util=require(_0x4f9b('0x0'));var moment=require(_0x4f9b('0x1'));var BPromise=require(_0x4f9b('0x2'));var rs=require(_0x4f9b('0x3'));var fs=require('fs');var Redis=require(_0x4f9b('0x4'));var db=require(_0x4f9b('0x5'))['db'];var utils=require(_0x4f9b('0x6'));var logger=require('../../config/logger')(_0x4f9b('0x7'));var config=require('../../config/environment');var jayson=require(_0x4f9b('0x8'));var client=jayson[_0x4f9b('0x9')]['http']({'port':0x232a});config[_0x4f9b('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4f9b('0xb'))(new Redis(config[_0x4f9b('0xa')]));require(_0x4f9b('0xc'))[_0x4f9b('0xd')](socket);function respondWithRpcPromise(_0x20ba59,_0x2773ac,_0x539636){return new BPromise(function(_0x40bb6d,_0x427cd6){return client[_0x4f9b('0xe')](_0x20ba59,_0x539636)[_0x4f9b('0xf')](function(_0x5ee327){logger[_0x4f9b('0x10')]('FaxQueue,\x20%s,\x20%s',_0x2773ac,_0x4f9b('0x11'));logger['debug'](_0x4f9b('0x12'),_0x2773ac,_0x4f9b('0x11'),JSON[_0x4f9b('0x13')](_0x5ee327));if(_0x5ee327['error']){if(_0x5ee327[_0x4f9b('0x14')]['code']===0x1f4){logger[_0x4f9b('0x14')](_0x4f9b('0x15'),_0x2773ac,_0x5ee327[_0x4f9b('0x14')]['message']);return _0x427cd6(_0x5ee327['error'][_0x4f9b('0x16')]);}logger[_0x4f9b('0x14')](_0x4f9b('0x15'),_0x2773ac,_0x5ee327[_0x4f9b('0x14')][_0x4f9b('0x16')]);return _0x40bb6d(_0x5ee327['error'][_0x4f9b('0x16')]);}else{logger[_0x4f9b('0x10')](_0x4f9b('0x15'),_0x2773ac,'request\x20sent');_0x40bb6d(_0x5ee327[_0x4f9b('0x17')][_0x4f9b('0x16')]);}})[_0x4f9b('0x18')](function(_0x2af3f1){logger[_0x4f9b('0x14')](_0x4f9b('0x15'),_0x2773ac,_0x2af3f1);_0x427cd6(_0x2af3f1);});});}exports['GetFaxQueue']=function(_0x55f6e4){var _0x3cea39=this;return new Promise(function(_0xd1adce,_0x18c888){return db[_0x4f9b('0x19')][_0x4f9b('0x1a')]({'raw':_0x55f6e4[_0x4f9b('0x1b')]?_0x55f6e4[_0x4f9b('0x1b')][_0x4f9b('0x1c')]===undefined?!![]:![]:!![],'where':_0x55f6e4[_0x4f9b('0x1b')]?_0x55f6e4[_0x4f9b('0x1b')][_0x4f9b('0x1d')]||null:null,'attributes':_0x55f6e4[_0x4f9b('0x1b')]?_0x55f6e4[_0x4f9b('0x1b')][_0x4f9b('0x1e')]||null:null,'limit':_0x55f6e4[_0x4f9b('0x1b')]?_0x55f6e4[_0x4f9b('0x1b')][_0x4f9b('0x1f')]||null:null,'include':_0x55f6e4[_0x4f9b('0x1b')]?_0x55f6e4[_0x4f9b('0x1b')][_0x4f9b('0x20')]?_['map'](_0x55f6e4[_0x4f9b('0x1b')]['include'],function(_0x34c159){return{'model':db[_0x34c159[_0x4f9b('0x21')]],'as':_0x34c159['as'],'attributes':_0x34c159[_0x4f9b('0x1e')],'include':_0x34c159[_0x4f9b('0x20')]?_['map'](_0x34c159[_0x4f9b('0x20')],function(_0x4925d1){return{'model':db[_0x4925d1['model']],'as':_0x4925d1['as'],'attributes':_0x4925d1['attributes'],'include':_0x4925d1[_0x4f9b('0x20')]?_[_0x4f9b('0x22')](_0x4925d1[_0x4f9b('0x20')],function(_0xcd28f7){return{'model':db[_0xcd28f7[_0x4f9b('0x21')]],'as':_0xcd28f7['as'],'attributes':_0xcd28f7['attributes']};}):[]};}):[]};}):[]:[]})[_0x4f9b('0xf')](function(_0x301049){logger['info']('GetFaxQueue',_0x55f6e4);logger[_0x4f9b('0x23')](_0x4f9b('0x24'),_0x55f6e4,JSON[_0x4f9b('0x13')](_0x301049));_0xd1adce(_0x301049);})[_0x4f9b('0x18')](function(_0xf89649){logger[_0x4f9b('0x14')](_0x4f9b('0x24'),_0xf89649[_0x4f9b('0x16')],_0x55f6e4);_0x18c888(_0x3cea39['error'](0x1f4,_0xf89649['message']));});});};exports[_0x4f9b('0x25')]=function(_0x456a23){var _0x442d07=this;return new Promise(function(_0x236fe8,_0x1a7a4a){return db['FaxQueue'][_0x4f9b('0x26')]({'raw':_0x456a23[_0x4f9b('0x1b')]?_0x456a23[_0x4f9b('0x1b')][_0x4f9b('0x1c')]===undefined?!![]:![]:!![],'where':_0x456a23[_0x4f9b('0x1b')]?_0x456a23[_0x4f9b('0x1b')][_0x4f9b('0x1d')]||null:null,'attributes':_0x456a23['options']?_0x456a23['options'][_0x4f9b('0x1e')]||null:null,'include':_0x456a23[_0x4f9b('0x1b')]?_0x456a23[_0x4f9b('0x1b')]['include']?_['map'](_0x456a23[_0x4f9b('0x1b')][_0x4f9b('0x20')],function(_0x3eb111){return{'model':db[_0x3eb111['model']],'as':_0x3eb111['as'],'attributes':_0x3eb111[_0x4f9b('0x1e')],'include':_0x3eb111[_0x4f9b('0x20')]?_[_0x4f9b('0x22')](_0x3eb111['include'],function(_0xa451e0){return{'model':db[_0xa451e0[_0x4f9b('0x21')]],'as':_0xa451e0['as'],'attributes':_0xa451e0[_0x4f9b('0x1e')],'include':_0xa451e0[_0x4f9b('0x20')]?_[_0x4f9b('0x22')](_0xa451e0[_0x4f9b('0x20')],function(_0x12981){return{'model':db[_0x12981[_0x4f9b('0x21')]],'as':_0x12981['as'],'attributes':_0x12981[_0x4f9b('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3545bb){logger[_0x4f9b('0x10')](_0x4f9b('0x25'),_0x456a23);logger['debug'](_0x4f9b('0x25'),_0x456a23,JSON[_0x4f9b('0x13')](_0x3545bb));_0x236fe8(_0x3545bb);})[_0x4f9b('0x18')](function(_0x112fd3){logger['error'](_0x4f9b('0x25'),_0x112fd3[_0x4f9b('0x16')],_0x456a23);_0x1a7a4a(_0x442d07['error'](0x1f4,_0x112fd3[_0x4f9b('0x16')]));});});}; \ No newline at end of file +var _0xb8e9=['ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter','./faxQueue.socket','register','request','then','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','result','FaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetFaxQueue','catch','ShowFaxQueue','find','util','bluebird'];(function(_0x4b8180,_0x4f7fbb){var _0x5d4076=function(_0x37639b){while(--_0x37639b){_0x4b8180['push'](_0x4b8180['shift']());}};_0x5d4076(++_0x4f7fbb);}(_0xb8e9,0x1d2));var _0x9b8e=function(_0x116482,_0x35ddae){_0x116482=_0x116482-0x0;var _0x56db37=_0xb8e9[_0x116482];return _0x56db37;};'use strict';var _=require('lodash');var util=require(_0x9b8e('0x0'));var moment=require('moment');var BPromise=require(_0x9b8e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9b8e('0x2'));var db=require(_0x9b8e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9b8e('0x4'))('rpc');var config=require(_0x9b8e('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x9b8e('0x6')][_0x9b8e('0x7')]({'port':0x232a});config[_0x9b8e('0x8')]=_[_0x9b8e('0x9')](config[_0x9b8e('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x9b8e('0xa'))(new Redis(config['redis']));require(_0x9b8e('0xb'))[_0x9b8e('0xc')](socket);function respondWithRpcPromise(_0x3fb5ad,_0x3725d2,_0x73ab6b){return new BPromise(function(_0x5ca7f8,_0x260980){return client[_0x9b8e('0xd')](_0x3fb5ad,_0x73ab6b)[_0x9b8e('0xe')](function(_0x32a70e){logger[_0x9b8e('0xf')]('FaxQueue,\x20%s,\x20%s',_0x3725d2,_0x9b8e('0x10'));logger[_0x9b8e('0x11')](_0x9b8e('0x12'),_0x3725d2,_0x9b8e('0x10'),JSON[_0x9b8e('0x13')](_0x32a70e));if(_0x32a70e[_0x9b8e('0x14')]){if(_0x32a70e[_0x9b8e('0x14')][_0x9b8e('0x15')]===0x1f4){logger[_0x9b8e('0x14')](_0x9b8e('0x16'),_0x3725d2,_0x32a70e[_0x9b8e('0x14')][_0x9b8e('0x17')]);return _0x260980(_0x32a70e[_0x9b8e('0x14')][_0x9b8e('0x17')]);}logger[_0x9b8e('0x14')](_0x9b8e('0x16'),_0x3725d2,_0x32a70e['error']['message']);return _0x5ca7f8(_0x32a70e[_0x9b8e('0x14')][_0x9b8e('0x17')]);}else{logger[_0x9b8e('0xf')](_0x9b8e('0x16'),_0x3725d2,_0x9b8e('0x10'));_0x5ca7f8(_0x32a70e[_0x9b8e('0x18')][_0x9b8e('0x17')]);}})['catch'](function(_0x20e6de){logger[_0x9b8e('0x14')](_0x9b8e('0x16'),_0x3725d2,_0x20e6de);_0x260980(_0x20e6de);});});}exports['GetFaxQueue']=function(_0x4f9e32){var _0x1fc997=this;return new Promise(function(_0x3aac69,_0xdca64f){return db[_0x9b8e('0x19')][_0x9b8e('0x1a')]({'raw':_0x4f9e32[_0x9b8e('0x1b')]?_0x4f9e32[_0x9b8e('0x1b')][_0x9b8e('0x1c')]===undefined?!![]:![]:!![],'where':_0x4f9e32[_0x9b8e('0x1b')]?_0x4f9e32[_0x9b8e('0x1b')][_0x9b8e('0x1d')]||null:null,'attributes':_0x4f9e32[_0x9b8e('0x1b')]?_0x4f9e32['options'][_0x9b8e('0x1e')]||null:null,'limit':_0x4f9e32[_0x9b8e('0x1b')]?_0x4f9e32[_0x9b8e('0x1b')][_0x9b8e('0x1f')]||null:null,'include':_0x4f9e32['options']?_0x4f9e32[_0x9b8e('0x1b')][_0x9b8e('0x20')]?_[_0x9b8e('0x21')](_0x4f9e32[_0x9b8e('0x1b')][_0x9b8e('0x20')],function(_0x3958df){return{'model':db[_0x3958df[_0x9b8e('0x22')]],'as':_0x3958df['as'],'attributes':_0x3958df[_0x9b8e('0x1e')],'include':_0x3958df['include']?_[_0x9b8e('0x21')](_0x3958df[_0x9b8e('0x20')],function(_0x1f1da7){return{'model':db[_0x1f1da7[_0x9b8e('0x22')]],'as':_0x1f1da7['as'],'attributes':_0x1f1da7[_0x9b8e('0x1e')],'include':_0x1f1da7[_0x9b8e('0x20')]?_[_0x9b8e('0x21')](_0x1f1da7[_0x9b8e('0x20')],function(_0x231008){return{'model':db[_0x231008[_0x9b8e('0x22')]],'as':_0x231008['as'],'attributes':_0x231008[_0x9b8e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9b8e('0xe')](function(_0x3017ea){logger[_0x9b8e('0xf')](_0x9b8e('0x23'),_0x4f9e32);logger[_0x9b8e('0x11')](_0x9b8e('0x23'),_0x4f9e32,JSON[_0x9b8e('0x13')](_0x3017ea));_0x3aac69(_0x3017ea);})[_0x9b8e('0x24')](function(_0x550154){logger['error'](_0x9b8e('0x23'),_0x550154[_0x9b8e('0x17')],_0x4f9e32);_0xdca64f(_0x1fc997['error'](0x1f4,_0x550154[_0x9b8e('0x17')]));});});};exports[_0x9b8e('0x25')]=function(_0x1fb8cb){var _0x40880c=this;return new Promise(function(_0x4b03a1,_0x300b18){return db[_0x9b8e('0x19')][_0x9b8e('0x26')]({'raw':_0x1fb8cb[_0x9b8e('0x1b')]?_0x1fb8cb['options']['raw']===undefined?!![]:![]:!![],'where':_0x1fb8cb[_0x9b8e('0x1b')]?_0x1fb8cb[_0x9b8e('0x1b')][_0x9b8e('0x1d')]||null:null,'attributes':_0x1fb8cb['options']?_0x1fb8cb[_0x9b8e('0x1b')][_0x9b8e('0x1e')]||null:null,'include':_0x1fb8cb[_0x9b8e('0x1b')]?_0x1fb8cb[_0x9b8e('0x1b')][_0x9b8e('0x20')]?_[_0x9b8e('0x21')](_0x1fb8cb[_0x9b8e('0x1b')][_0x9b8e('0x20')],function(_0x3321ea){return{'model':db[_0x3321ea[_0x9b8e('0x22')]],'as':_0x3321ea['as'],'attributes':_0x3321ea['attributes'],'include':_0x3321ea['include']?_[_0x9b8e('0x21')](_0x3321ea['include'],function(_0x380fad){return{'model':db[_0x380fad[_0x9b8e('0x22')]],'as':_0x380fad['as'],'attributes':_0x380fad[_0x9b8e('0x1e')],'include':_0x380fad[_0x9b8e('0x20')]?_[_0x9b8e('0x21')](_0x380fad[_0x9b8e('0x20')],function(_0x55b1eb){return{'model':db[_0x55b1eb['model']],'as':_0x55b1eb['as'],'attributes':_0x55b1eb['attributes']};}):[]};}):[]};}):[]:[]})[_0x9b8e('0xe')](function(_0x365eb6){logger['info'](_0x9b8e('0x25'),_0x1fb8cb);logger[_0x9b8e('0x11')](_0x9b8e('0x25'),_0x1fb8cb,JSON[_0x9b8e('0x13')](_0x365eb6));_0x4b03a1(_0x365eb6);})[_0x9b8e('0x24')](function(_0x5d7701){logger['error'](_0x9b8e('0x25'),_0x5d7701[_0x9b8e('0x17')],_0x1fb8cb);_0x300b18(_0x40880c[_0x9b8e('0x14')](0x1f4,_0x5d7701[_0x9b8e('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index e405c46..5e11fab 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 _0xdf80=['./faxQueue.events','emit','register','length'];(function(_0x59ca71,_0x5a0cc1){var _0x5bc869=function(_0x4ed78f){while(--_0x4ed78f){_0x59ca71['push'](_0x59ca71['shift']());}};_0x5bc869(++_0x5a0cc1);}(_0xdf80,0x84));var _0x0df8=function(_0x17ca23,_0x11c7d3){_0x17ca23=_0x17ca23-0x0;var _0x385e5c=_0xdf80[_0x17ca23];return _0x385e5c;};'use strict';var FaxQueueEvents=require(_0x0df8('0x0'));var events=['save','remove','update'];function createListener(_0x21f364,_0x2c4e4e){return function(_0x573df1){_0x2c4e4e[_0x0df8('0x1')](_0x21f364,_0x573df1);};}function removeListener(_0x2ccb0a,_0x27f5b9){return function(){FaxQueueEvents['removeListener'](_0x2ccb0a,_0x27f5b9);};}exports[_0x0df8('0x2')]=function(_0xec8161){for(var _0x34b025=0x0,_0x2707bc=events[_0x0df8('0x3')];_0x34b025<_0x2707bc;_0x34b025++){var _0x5dd10f=events[_0x34b025];var _0x3d5a76=createListener('faxQueue:'+_0x5dd10f,_0xec8161);FaxQueueEvents['on'](_0x5dd10f,_0x3d5a76);}}; \ No newline at end of file +var _0x746c=['./faxQueue.events','emit','removeListener','register','length','faxQueue:'];(function(_0x3c8d72,_0x53e186){var _0xa8f7c=function(_0xea98c6){while(--_0xea98c6){_0x3c8d72['push'](_0x3c8d72['shift']());}};_0xa8f7c(++_0x53e186);}(_0x746c,0x19e));var _0xc746=function(_0x179fd7,_0x298f8a){_0x179fd7=_0x179fd7-0x0;var _0x5a13bd=_0x746c[_0x179fd7];return _0x5a13bd;};'use strict';var FaxQueueEvents=require(_0xc746('0x0'));var events=['save','remove','update'];function createListener(_0x5ace70,_0x2edb83){return function(_0x558f13){_0x2edb83[_0xc746('0x1')](_0x5ace70,_0x558f13);};}function removeListener(_0x5101b4,_0x2195ca){return function(){FaxQueueEvents[_0xc746('0x2')](_0x5101b4,_0x2195ca);};}exports[_0xc746('0x3')]=function(_0x129da2){for(var _0x27c9fc=0x0,_0x5484ba=events[_0xc746('0x4')];_0x27c9fc<_0x5484ba;_0x27c9fc++){var _0x136ebf=events[_0x27c9fc];var _0xefc833=createListener(_0xc746('0x5')+_0x136ebf,_0x129da2);FaxQueueEvents['on'](_0x136ebf,_0xefc833);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index e4d3ea6..9b5eb33 100644 --- a/server/api/faxQueue/index.js +++ b/server/api/faxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['create','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post'];(function(_0x48845d,_0x4338c2){var _0x5bad7d=function(_0x1bf3f4){while(--_0x1bf3f4){_0x48845d['push'](_0x48845d['shift']());}};_0x5bad7d(++_0x4338c2);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var auth=require(_0x0baf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0baf('0x6'));var controller=require(_0x0baf('0x7'));router[_0x0baf('0x8')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0xa')]);router[_0x0baf('0x8')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0xc')]);router['get'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0x8')](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x8')](_0x0baf('0x11'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x8')](_0x0baf('0x13'),auth['isAuthenticated'](),controller['getAgents']);router[_0x0baf('0x14')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0x15')]);router[_0x0baf('0x14')]('/:id/teams',auth[_0x0baf('0x9')](),controller['addTeams']);router[_0x0baf('0x14')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x16')]);router[_0x0baf('0x17')](_0x0baf('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x0baf('0x18')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x19')]);router[_0x0baf('0x18')](_0x0baf('0x11'),auth['isAuthenticated'](),controller[_0x0baf('0x1a')]);router[_0x0baf('0x18')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x1b')]);module[_0x0baf('0x1c')]=router; \ No newline at end of file +var _0xd8b0=['util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','index','get','/describe','describe','isAuthenticated','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','/:id','update','delete','destroy','removeTeams','exports','multer'];(function(_0x2331d6,_0x40eb9b){var _0xc68743=function(_0x14c593){while(--_0x14c593){_0x2331d6['push'](_0x2331d6['shift']());}};_0xc68743(++_0x40eb9b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/:id',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x8')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0x8')](_0x0d8b('0xf'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['get'](_0x0d8b('0x11'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x13')]('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x13')](_0x0d8b('0xf'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x15')]);router[_0x0d8b('0x13')](_0x0d8b('0x11'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x16')]);router['put'](_0x0d8b('0x17'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x18')]);router[_0x0d8b('0x19')](_0x0d8b('0x17'),auth['isAuthenticated'](),controller[_0x0d8b('0x1a')]);router[_0x0d8b('0x19')](_0x0d8b('0xf'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x1b')]);router[_0x0d8b('0x19')](_0x0d8b('0x11'),auth[_0x0d8b('0xb')](),controller['removeAgents']);module[_0x0d8b('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 38f6b67..bde6619 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 _0x66fd=['exports','STRING','DATE','moment','sequelize'];(function(_0x5e3880,_0x1ad106){var _0x3b52cc=function(_0x528578){while(--_0x528578){_0x5e3880['push'](_0x5e3880['shift']());}};_0x3b52cc(++_0x1ad106);}(_0x66fd,0x7b));var _0xd66f=function(_0x1dfbdf,_0x459d58){_0x1dfbdf=_0x1dfbdf-0x0;var _0x2893a6=_0x66fd[_0x1dfbdf];return _0x2893a6;};'use strict';var moment=require(_0xd66f('0x0'));var Sequelize=require(_0xd66f('0x1'));module[_0xd66f('0x2')]={'uniqueid':{'type':Sequelize[_0xd66f('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xd66f('0x3')]},'joinAt':{'type':Sequelize[_0xd66f('0x4')]},'leaveAt':{'type':Sequelize[_0xd66f('0x4')]},'acceptAt':{'type':Sequelize[_0xd66f('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8dbe=['moment','sequelize','exports','STRING','DATE'];(function(_0x26d9b3,_0x591f4e){var _0x15c226=function(_0x17bbdb){while(--_0x17bbdb){_0x26d9b3['push'](_0x26d9b3['shift']());}};_0x15c226(++_0x591f4e);}(_0x8dbe,0x73));var _0xe8db=function(_0x3483a4,_0x2de378){_0x3483a4=_0x3483a4-0x0;var _0x30b8f2=_0x8dbe[_0x3483a4];return _0x30b8f2;};'use strict';var moment=require(_0xe8db('0x0'));var Sequelize=require(_0xe8db('0x1'));module[_0xe8db('0x2')]={'uniqueid':{'type':Sequelize[_0xe8db('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xe8db('0x3')]},'joinAt':{'type':Sequelize[_0xe8db('0x4')]},'leaveAt':{'type':Sequelize[_0xe8db('0x4')]},'acceptAt':{'type':Sequelize[_0xe8db('0x4')]},'exitAt':{'type':Sequelize[_0xe8db('0x4')]},'reason':{'type':Sequelize[_0xe8db('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 906f64c..105265d 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 _0x0b21=['rows','catch','show','params','keys','includeAll','merge','create','body','find','describe','rimraf','fast-json-patch','request-promise','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','count','include','findAll'];(function(_0x568039,_0x570f8e){var _0x1595fc=function(_0x50ac8f){while(--_0x50ac8f){_0x568039['push'](_0x568039['shift']());}};_0x1595fc(++_0x570f8e);}(_0x0b21,0x182));var _0x10b2=function(_0x13eea8,_0x1edfc5){_0x13eea8=_0x13eea8-0x0;var _0x3e84d0=_0x0b21[_0x13eea8];return _0x3e84d0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x10b2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x10b2('0x1'));var rp=require(_0x10b2('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x10b2('0x3'));var util=require('util');var path=require(_0x10b2('0x4'));var sox=require(_0x10b2('0x5'));var csv=require('to-csv');var ejs=require(_0x10b2('0x6'));var fs=require('fs');var _=require(_0x10b2('0x7'));var squel=require(_0x10b2('0x8'));var crypto=require(_0x10b2('0x9'));var jsforce=require(_0x10b2('0xa'));var deskjs=require(_0x10b2('0xb'));var toCsv=require(_0x10b2('0xc'));var querystring=require(_0x10b2('0xd'));var Papa=require(_0x10b2('0xe'));var Redis=require(_0x10b2('0xf'));var authService=require(_0x10b2('0x10'));var qs=require(_0x10b2('0x11'));var as=require(_0x10b2('0x12'));var hardwareService=require(_0x10b2('0x13'));var logger=require(_0x10b2('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x10b2('0x15'));var db=require(_0x10b2('0x16'))['db'];function respondWithStatusCode(_0x4b779b,_0x5bc655){_0x5bc655=_0x5bc655||0xcc;return function(_0x3f43b9){if(_0x3f43b9){return _0x4b779b['sendStatus'](_0x5bc655);}return _0x4b779b[_0x10b2('0x17')](_0x5bc655)['end']();};}function respondWithResult(_0x1652c8,_0x2c8ef7){_0x2c8ef7=_0x2c8ef7||0xc8;return function(_0x455d34){if(_0x455d34){return _0x1652c8[_0x10b2('0x17')](_0x2c8ef7)['json'](_0x455d34);}};}function respondWithFilteredResult(_0x46104f,_0x38b95a){return function(_0x343f48){if(_0x343f48){var _0x5814b0=_0x343f48['count'],_0x2b92d0=_0x38b95a[_0x10b2('0x18')],_0x35ee60=_0x38b95a[_0x10b2('0x18')]+_0x38b95a[_0x10b2('0x19')],_0x3e6853;if(_0x35ee60>=_0x5814b0){_0x35ee60=_0x5814b0;_0x3e6853=0xc8;}else{_0x3e6853=0xce;}_0x46104f[_0x10b2('0x17')](_0x3e6853);return _0x46104f[_0x10b2('0x1a')](_0x10b2('0x1b'),_0x2b92d0+'-'+_0x35ee60+'/'+_0x5814b0)['json'](_0x343f48);}return null;};}function patchUpdates(_0x1a94e8){return function(_0x49b304){try{jsonpatch[_0x10b2('0x1c')](_0x49b304,_0x1a94e8,!![]);}catch(_0x5ac7b6){return BPromise[_0x10b2('0x1d')](_0x5ac7b6);}return _0x49b304[_0x10b2('0x1e')]();};}function saveUpdates(_0x2ddfad,_0x10df29){return function(_0xd8145f){if(_0xd8145f){return _0xd8145f[_0x10b2('0x1f')](_0x2ddfad)[_0x10b2('0x20')](function(_0x4db063){return _0x4db063;});}return null;};}function removeEntity(_0x137b6b,_0x138b93){return function(_0xa02384){if(_0xa02384){return _0xa02384[_0x10b2('0x21')]()['then'](function(){_0x137b6b[_0x10b2('0x17')](0xcc)[_0x10b2('0x22')]();});}};}function handleEntityNotFound(_0x2530c3,_0x3bc567){return function(_0x31a013){if(!_0x31a013){_0x2530c3[_0x10b2('0x23')](0x194);}return _0x31a013;};}function handleError(_0x4e846c,_0x118782){_0x118782=_0x118782||0x1f4;return function(_0x306fbc){logger[_0x10b2('0x24')](_0x306fbc[_0x10b2('0x25')]);if(_0x306fbc[_0x10b2('0x26')]){delete _0x306fbc[_0x10b2('0x26')];}_0x4e846c[_0x10b2('0x17')](_0x118782)[_0x10b2('0x27')](_0x306fbc);};}exports[_0x10b2('0x28')]=function(_0x5ce25a,_0x185397){var _0x15d049={},_0x1c2011={},_0x15409f={'count':0x0,'rows':[]};var _0xe1958=_[_0x10b2('0x29')](db[_0x10b2('0x2a')][_0x10b2('0x2b')],function(_0x859b05){return{'name':_0x859b05['fieldName'],'type':_0x859b05[_0x10b2('0x2c')][_0x10b2('0x2d')]};});_0x1c2011[_0x10b2('0x2e')]=_['map'](_0xe1958,_0x10b2('0x26'));_0x1c2011['query']=_['keys'](_0x5ce25a[_0x10b2('0x2f')]);_0x1c2011[_0x10b2('0x30')]=_[_0x10b2('0x31')](_0x1c2011[_0x10b2('0x2e')],_0x1c2011[_0x10b2('0x2f')]);_0x15d049[_0x10b2('0x32')]=_['intersection'](_0x1c2011[_0x10b2('0x2e')],qs[_0x10b2('0x33')](_0x5ce25a['query'][_0x10b2('0x33')]));_0x15d049[_0x10b2('0x32')]=_0x15d049[_0x10b2('0x32')][_0x10b2('0x34')]?_0x15d049[_0x10b2('0x32')]:_0x1c2011[_0x10b2('0x2e')];if(!_0x5ce25a[_0x10b2('0x2f')][_0x10b2('0x35')](_0x10b2('0x36'))){_0x15d049['limit']=qs[_0x10b2('0x19')](_0x5ce25a[_0x10b2('0x2f')][_0x10b2('0x19')]);_0x15d049['offset']=qs[_0x10b2('0x18')](_0x5ce25a[_0x10b2('0x2f')]['offset']);}_0x15d049[_0x10b2('0x37')]=qs[_0x10b2('0x38')](_0x5ce25a[_0x10b2('0x2f')][_0x10b2('0x38')]);_0x15d049[_0x10b2('0x39')]=qs[_0x10b2('0x30')](_['pick'](_0x5ce25a['query'],_0x1c2011[_0x10b2('0x30')]),_0xe1958);if(_0x5ce25a[_0x10b2('0x2f')][_0x10b2('0x3a')]){_0x15d049[_0x10b2('0x39')]=_['merge'](_0x15d049[_0x10b2('0x39')],{'$or':_[_0x10b2('0x29')](_0xe1958,function(_0x16d91d){if(_0x16d91d[_0x10b2('0x2c')]!==_0x10b2('0x3b')){var _0x4332b8={};_0x4332b8[_0x16d91d[_0x10b2('0x26')]]={'$like':'%'+_0x5ce25a[_0x10b2('0x2f')][_0x10b2('0x3a')]+'%'};return _0x4332b8;}})});}_0x15d049=_['merge']({},_0x15d049,_0x5ce25a[_0x10b2('0x3c')]);var _0x4088db={'where':_0x15d049[_0x10b2('0x39')]};return db[_0x10b2('0x2a')][_0x10b2('0x3d')](_0x4088db)[_0x10b2('0x20')](function(_0x408d4a){_0x15409f['count']=_0x408d4a;if(_0x5ce25a[_0x10b2('0x2f')]['includeAll']){_0x15d049[_0x10b2('0x3e')]=[{'all':!![]}];}return db[_0x10b2('0x2a')][_0x10b2('0x3f')](_0x15d049);})['then'](function(_0x4d524c){_0x15409f[_0x10b2('0x40')]=_0x4d524c;return _0x15409f;})[_0x10b2('0x20')](respondWithFilteredResult(_0x185397,_0x15d049))[_0x10b2('0x41')](handleError(_0x185397,null));};exports[_0x10b2('0x42')]=function(_0x2289a3,_0xc4415){var _0x5ce17b={'raw':!![],'where':{'id':_0x2289a3[_0x10b2('0x43')]['id']}},_0x367e21={};_0x367e21[_0x10b2('0x2e')]=_[_0x10b2('0x44')](db[_0x10b2('0x2a')][_0x10b2('0x2b')]);_0x367e21[_0x10b2('0x2f')]=_[_0x10b2('0x44')](_0x2289a3['query']);_0x367e21[_0x10b2('0x30')]=_[_0x10b2('0x31')](_0x367e21[_0x10b2('0x2e')],_0x367e21[_0x10b2('0x2f')]);_0x5ce17b['attributes']=_[_0x10b2('0x31')](_0x367e21[_0x10b2('0x2e')],qs['fields'](_0x2289a3[_0x10b2('0x2f')]['fields']));_0x5ce17b[_0x10b2('0x32')]=_0x5ce17b[_0x10b2('0x32')]['length']?_0x5ce17b['attributes']:_0x367e21['model'];if(_0x2289a3[_0x10b2('0x2f')][_0x10b2('0x45')]){_0x5ce17b[_0x10b2('0x3e')]=[{'all':!![]}];}_0x5ce17b=_[_0x10b2('0x46')]({},_0x5ce17b,_0x2289a3['options']);return db[_0x10b2('0x2a')]['find'](_0x5ce17b)['then'](handleEntityNotFound(_0xc4415,null))['then'](respondWithResult(_0xc4415,null))[_0x10b2('0x41')](handleError(_0xc4415,null));};exports[_0x10b2('0x47')]=function(_0x53ea39,_0x5aa49f){return db['FaxQueueReport']['create'](_0x53ea39['body'],{})[_0x10b2('0x20')](respondWithResult(_0x5aa49f,0xc9))[_0x10b2('0x41')](handleError(_0x5aa49f,null));};exports[_0x10b2('0x1f')]=function(_0x584f70,_0x13ebfc){if(_0x584f70['body']['id']){delete _0x584f70[_0x10b2('0x48')]['id'];}return db[_0x10b2('0x2a')][_0x10b2('0x49')]({'where':{'id':_0x584f70[_0x10b2('0x43')]['id']}})['then'](handleEntityNotFound(_0x13ebfc,null))[_0x10b2('0x20')](saveUpdates(_0x584f70[_0x10b2('0x48')],null))[_0x10b2('0x20')](respondWithResult(_0x13ebfc,null))[_0x10b2('0x41')](handleError(_0x13ebfc,null));};exports[_0x10b2('0x21')]=function(_0x3e6dfc,_0x592eb6){return db[_0x10b2('0x2a')][_0x10b2('0x49')]({'where':{'id':_0x3e6dfc[_0x10b2('0x43')]['id']}})[_0x10b2('0x20')](handleEntityNotFound(_0x592eb6,null))['then'](removeEntity(_0x592eb6,null))[_0x10b2('0x41')](handleError(_0x592eb6,null));};exports[_0x10b2('0x4a')]=function(_0x370524,_0x25499e){return db[_0x10b2('0x2a')][_0x10b2('0x4a')]()[_0x10b2('0x20')](respondWithResult(_0x25499e,null))['catch'](handleError(_0x25499e,null));}; \ No newline at end of file +var _0xce5c=['map','FaxQueueReport','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','params','rawAttributes','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xce5c,0x69));var _0xcce5=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xce5c[_0x11005e];return _0x29338f;};'use strict';var pdf=require(_0xcce5('0x0'));var emlformat=require(_0xcce5('0x1'));var rimraf=require(_0xcce5('0x2'));var zipdir=require(_0xcce5('0x3'));var jsonpatch=require(_0xcce5('0x4'));var rp=require(_0xcce5('0x5'));var moment=require(_0xcce5('0x6'));var BPromise=require(_0xcce5('0x7'));var Mustache=require(_0xcce5('0x8'));var util=require(_0xcce5('0x9'));var path=require(_0xcce5('0xa'));var sox=require(_0xcce5('0xb'));var csv=require('to-csv');var ejs=require(_0xcce5('0xc'));var fs=require('fs');var _=require(_0xcce5('0xd'));var squel=require(_0xcce5('0xe'));var crypto=require(_0xcce5('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xcce5('0x10'));var toCsv=require(_0xcce5('0x11'));var querystring=require(_0xcce5('0x12'));var Papa=require('papaparse');var Redis=require(_0xcce5('0x13'));var authService=require(_0xcce5('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xcce5('0x15'));var hardwareService=require(_0xcce5('0x16'));var logger=require(_0xcce5('0x17'))(_0xcce5('0x18'));var utils=require('../../config/utils');var config=require(_0xcce5('0x19'));var db=require(_0xcce5('0x1a'))['db'];function respondWithStatusCode(_0x222a87,_0x4dc6bd){_0x4dc6bd=_0x4dc6bd||0xcc;return function(_0x33b84a){if(_0x33b84a){return _0x222a87[_0xcce5('0x1b')](_0x4dc6bd);}return _0x222a87[_0xcce5('0x1c')](_0x4dc6bd)['end']();};}function respondWithResult(_0x474a0f,_0x21b2c9){_0x21b2c9=_0x21b2c9||0xc8;return function(_0x1bc41c){if(_0x1bc41c){return _0x474a0f[_0xcce5('0x1c')](_0x21b2c9)['json'](_0x1bc41c);}};}function respondWithFilteredResult(_0x4f7d78,_0x1f348d){return function(_0x357600){if(_0x357600){var _0x42f555=_0x357600[_0xcce5('0x1d')],_0x46e580=_0x1f348d[_0xcce5('0x1e')],_0xe6f66=_0x1f348d['offset']+_0x1f348d[_0xcce5('0x1f')],_0x3bcee4;if(_0xe6f66>=_0x42f555){_0xe6f66=_0x42f555;_0x3bcee4=0xc8;}else{_0x3bcee4=0xce;}_0x4f7d78[_0xcce5('0x1c')](_0x3bcee4);return _0x4f7d78[_0xcce5('0x20')](_0xcce5('0x21'),_0x46e580+'-'+_0xe6f66+'/'+_0x42f555)[_0xcce5('0x22')](_0x357600);}return null;};}function patchUpdates(_0x4c02b8){return function(_0x2072f2){try{jsonpatch[_0xcce5('0x23')](_0x2072f2,_0x4c02b8,!![]);}catch(_0x5b0447){return BPromise['reject'](_0x5b0447);}return _0x2072f2[_0xcce5('0x24')]();};}function saveUpdates(_0x195f67,_0x4d6abb){return function(_0x58cfe1){if(_0x58cfe1){return _0x58cfe1[_0xcce5('0x25')](_0x195f67)[_0xcce5('0x26')](function(_0x24946f){return _0x24946f;});}return null;};}function removeEntity(_0x4d56cd,_0xa18b34){return function(_0x32d946){if(_0x32d946){return _0x32d946[_0xcce5('0x27')]()[_0xcce5('0x26')](function(){_0x4d56cd[_0xcce5('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x259915,_0x590847){return function(_0x554a8e){if(!_0x554a8e){_0x259915[_0xcce5('0x1b')](0x194);}return _0x554a8e;};}function handleError(_0x3e3eeb,_0x412e5b){_0x412e5b=_0x412e5b||0x1f4;return function(_0x35e97c){logger[_0xcce5('0x28')](_0x35e97c[_0xcce5('0x29')]);if(_0x35e97c[_0xcce5('0x2a')]){delete _0x35e97c[_0xcce5('0x2a')];}_0x3e3eeb[_0xcce5('0x1c')](_0x412e5b)[_0xcce5('0x2b')](_0x35e97c);};}exports[_0xcce5('0x2c')]=function(_0xf1dfb5,_0x4d63e6){var _0x4e0d8e={},_0x2a8d80={},_0x39534c={'count':0x0,'rows':[]};var _0x4c9185=_[_0xcce5('0x2d')](db[_0xcce5('0x2e')]['rawAttributes'],function(_0x150464){return{'name':_0x150464['fieldName'],'type':_0x150464[_0xcce5('0x2f')][_0xcce5('0x30')]};});_0x2a8d80[_0xcce5('0x31')]=_[_0xcce5('0x2d')](_0x4c9185,_0xcce5('0x2a'));_0x2a8d80['query']=_[_0xcce5('0x32')](_0xf1dfb5[_0xcce5('0x33')]);_0x2a8d80[_0xcce5('0x34')]=_[_0xcce5('0x35')](_0x2a8d80[_0xcce5('0x31')],_0x2a8d80['query']);_0x4e0d8e[_0xcce5('0x36')]=_[_0xcce5('0x35')](_0x2a8d80[_0xcce5('0x31')],qs[_0xcce5('0x37')](_0xf1dfb5[_0xcce5('0x33')][_0xcce5('0x37')]));_0x4e0d8e['attributes']=_0x4e0d8e[_0xcce5('0x36')][_0xcce5('0x38')]?_0x4e0d8e[_0xcce5('0x36')]:_0x2a8d80[_0xcce5('0x31')];if(!_0xf1dfb5[_0xcce5('0x33')][_0xcce5('0x39')]('nolimit')){_0x4e0d8e[_0xcce5('0x1f')]=qs['limit'](_0xf1dfb5['query'][_0xcce5('0x1f')]);_0x4e0d8e[_0xcce5('0x1e')]=qs['offset'](_0xf1dfb5['query'][_0xcce5('0x1e')]);}_0x4e0d8e[_0xcce5('0x3a')]=qs[_0xcce5('0x3b')](_0xf1dfb5[_0xcce5('0x33')][_0xcce5('0x3b')]);_0x4e0d8e[_0xcce5('0x3c')]=qs[_0xcce5('0x34')](_['pick'](_0xf1dfb5[_0xcce5('0x33')],_0x2a8d80[_0xcce5('0x34')]),_0x4c9185);if(_0xf1dfb5[_0xcce5('0x33')][_0xcce5('0x3d')]){_0x4e0d8e[_0xcce5('0x3c')]=_['merge'](_0x4e0d8e[_0xcce5('0x3c')],{'$or':_[_0xcce5('0x2d')](_0x4c9185,function(_0x1842f6){if(_0x1842f6[_0xcce5('0x2f')]!==_0xcce5('0x3e')){var _0x194430={};_0x194430[_0x1842f6['name']]={'$like':'%'+_0xf1dfb5['query'][_0xcce5('0x3d')]+'%'};return _0x194430;}})});}_0x4e0d8e=_[_0xcce5('0x3f')]({},_0x4e0d8e,_0xf1dfb5[_0xcce5('0x40')]);var _0x216a55={'where':_0x4e0d8e[_0xcce5('0x3c')]};return db[_0xcce5('0x2e')][_0xcce5('0x1d')](_0x216a55)[_0xcce5('0x26')](function(_0x577152){_0x39534c[_0xcce5('0x1d')]=_0x577152;if(_0xf1dfb5['query'][_0xcce5('0x41')]){_0x4e0d8e[_0xcce5('0x42')]=[{'all':!![]}];}return db[_0xcce5('0x2e')]['findAll'](_0x4e0d8e);})[_0xcce5('0x26')](function(_0xd84b8){_0x39534c[_0xcce5('0x43')]=_0xd84b8;return _0x39534c;})[_0xcce5('0x26')](respondWithFilteredResult(_0x4d63e6,_0x4e0d8e))[_0xcce5('0x44')](handleError(_0x4d63e6,null));};exports['show']=function(_0x3a236c,_0x3958c2){var _0xa1be40={'raw':!![],'where':{'id':_0x3a236c[_0xcce5('0x45')]['id']}},_0x4f547d={};_0x4f547d[_0xcce5('0x31')]=_[_0xcce5('0x32')](db['FaxQueueReport'][_0xcce5('0x46')]);_0x4f547d['query']=_['keys'](_0x3a236c[_0xcce5('0x33')]);_0x4f547d[_0xcce5('0x34')]=_['intersection'](_0x4f547d[_0xcce5('0x31')],_0x4f547d['query']);_0xa1be40[_0xcce5('0x36')]=_[_0xcce5('0x35')](_0x4f547d[_0xcce5('0x31')],qs[_0xcce5('0x37')](_0x3a236c['query']['fields']));_0xa1be40[_0xcce5('0x36')]=_0xa1be40['attributes'][_0xcce5('0x38')]?_0xa1be40[_0xcce5('0x36')]:_0x4f547d[_0xcce5('0x31')];if(_0x3a236c['query'][_0xcce5('0x41')]){_0xa1be40[_0xcce5('0x42')]=[{'all':!![]}];}_0xa1be40=_['merge']({},_0xa1be40,_0x3a236c[_0xcce5('0x40')]);return db[_0xcce5('0x2e')]['find'](_0xa1be40)['then'](handleEntityNotFound(_0x3958c2,null))['then'](respondWithResult(_0x3958c2,null))[_0xcce5('0x44')](handleError(_0x3958c2,null));};exports[_0xcce5('0x47')]=function(_0x3a02d4,_0x58c283){return db['FaxQueueReport'][_0xcce5('0x47')](_0x3a02d4[_0xcce5('0x48')],{})[_0xcce5('0x26')](respondWithResult(_0x58c283,0xc9))[_0xcce5('0x44')](handleError(_0x58c283,null));};exports[_0xcce5('0x25')]=function(_0x67d23,_0x25c93a){if(_0x67d23['body']['id']){delete _0x67d23[_0xcce5('0x48')]['id'];}return db[_0xcce5('0x2e')][_0xcce5('0x49')]({'where':{'id':_0x67d23['params']['id']}})[_0xcce5('0x26')](handleEntityNotFound(_0x25c93a,null))[_0xcce5('0x26')](saveUpdates(_0x67d23[_0xcce5('0x48')],null))[_0xcce5('0x26')](respondWithResult(_0x25c93a,null))[_0xcce5('0x44')](handleError(_0x25c93a,null));};exports[_0xcce5('0x27')]=function(_0x58113f,_0x6e1de2){return db[_0xcce5('0x2e')][_0xcce5('0x49')]({'where':{'id':_0x58113f[_0xcce5('0x45')]['id']}})[_0xcce5('0x26')](handleEntityNotFound(_0x6e1de2,null))[_0xcce5('0x26')](removeEntity(_0x6e1de2,null))[_0xcce5('0x44')](handleError(_0x6e1de2,null));};exports['describe']=function(_0x360e0b,_0x275a5b){return db[_0xcce5('0x2e')][_0xcce5('0x4a')]()[_0xcce5('0x26')](respondWithResult(_0x275a5b,null))[_0xcce5('0x44')](handleError(_0x275a5b,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index cb7bc4c..b4c0542 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 _0x5b87=['define','FaxQueueReport','report_fax_queue','uniqueid','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports'];(function(_0x251d9c,_0x580977){var _0x16ae64=function(_0x4d3b53){while(--_0x4d3b53){_0x251d9c['push'](_0x251d9c['shift']());}};_0x16ae64(++_0x580977);}(_0x5b87,0x1a8));var _0x75b8=function(_0x518f2e,_0x75134f){_0x518f2e=_0x518f2e-0x0;var _0x1edff0=_0x5b87[_0x518f2e];return _0x1edff0;};'use strict';var _=require(_0x75b8('0x0'));var util=require(_0x75b8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x75b8('0x2'));var BPromise=require(_0x75b8('0x3'));var rp=require(_0x75b8('0x4'));var fs=require('fs');var path=require(_0x75b8('0x5'));var rimraf=require(_0x75b8('0x6'));var config=require(_0x75b8('0x7'));var attributes=require(_0x75b8('0x8'));module[_0x75b8('0x9')]=function(_0x59726b,_0xcd9861){return _0x59726b[_0x75b8('0xa')](_0x75b8('0xb'),attributes,{'tableName':_0x75b8('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x75b8('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8b67=['exports','define','FaxQueueReport','uniqueid','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./faxQueueReport.attributes'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x8b67,0x1a8));var _0x78b6=function(_0x16629d,_0x492375){_0x16629d=_0x16629d-0x0;var _0x56ccee=_0x8b67[_0x16629d];return _0x56ccee;};'use strict';var _=require(_0x78b6('0x0'));var util=require(_0x78b6('0x1'));var logger=require('../../config/logger')(_0x78b6('0x2'));var moment=require(_0x78b6('0x3'));var BPromise=require(_0x78b6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x78b6('0x5'));var config=require(_0x78b6('0x6'));var attributes=require(_0x78b6('0x7'));module[_0x78b6('0x8')]=function(_0x67e49b,_0x5e820f){return _0x67e49b[_0x78b6('0x9')](_0x78b6('0xa'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x78b6('0xb'),'fields':[_0x78b6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 89b7817..12e75b8 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 _0xc33a=['then','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','result','catch','CreateFaxQueueReport','FaxQueueReport','body','options','raw','update','where','limit','UpdateFaxQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x57477c,_0x24a185){var _0x38b4e3=function(_0x2d9f16){while(--_0x2d9f16){_0x57477c['push'](_0x57477c['shift']());}};_0x38b4e3(++_0x24a185);}(_0xc33a,0x7e));var _0xac33=function(_0x4bacb6,_0x2b299d){_0x4bacb6=_0x4bacb6-0x0;var _0x58c029=_0xc33a[_0x4bacb6];return _0x58c029;};'use strict';var _=require(_0xac33('0x0'));var util=require(_0xac33('0x1'));var moment=require(_0xac33('0x2'));var BPromise=require(_0xac33('0x3'));var rs=require(_0xac33('0x4'));var fs=require('fs');var Redis=require(_0xac33('0x5'));var db=require(_0xac33('0x6'))['db'];var utils=require(_0xac33('0x7'));var logger=require(_0xac33('0x8'))(_0xac33('0x9'));var config=require('../../config/environment');var jayson=require(_0xac33('0xa'));var client=jayson[_0xac33('0xb')][_0xac33('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xc057a4,_0x38ce21,_0x581925){return new BPromise(function(_0x2eb481,_0x4d85a7){return client[_0xac33('0xd')](_0xc057a4,_0x581925)[_0xac33('0xe')](function(_0x1cf61c){logger[_0xac33('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x38ce21,_0xac33('0x10'));logger[_0xac33('0x11')](_0xac33('0x12'),_0x38ce21,_0xac33('0x10'),JSON[_0xac33('0x13')](_0x1cf61c));if(_0x1cf61c[_0xac33('0x14')]){if(_0x1cf61c['error'][_0xac33('0x15')]===0x1f4){logger[_0xac33('0x14')](_0xac33('0x16'),_0x38ce21,_0x1cf61c['error']['message']);return _0x4d85a7(_0x1cf61c[_0xac33('0x14')][_0xac33('0x17')]);}logger['error'](_0xac33('0x16'),_0x38ce21,_0x1cf61c['error'][_0xac33('0x17')]);return _0x2eb481(_0x1cf61c[_0xac33('0x14')][_0xac33('0x17')]);}else{logger[_0xac33('0xf')](_0xac33('0x16'),_0x38ce21,_0xac33('0x10'));_0x2eb481(_0x1cf61c[_0xac33('0x18')][_0xac33('0x17')]);}})[_0xac33('0x19')](function(_0x47cefb){logger[_0xac33('0x14')](_0xac33('0x16'),_0x38ce21,_0x47cefb);_0x4d85a7(_0x47cefb);});});}exports[_0xac33('0x1a')]=function(_0xa8ae86){var _0x3c0502=this;return new Promise(function(_0x107c88,_0x4bdc9a){return db[_0xac33('0x1b')]['create'](_0xa8ae86[_0xac33('0x1c')],{'raw':_0xa8ae86['options']?_0xa8ae86[_0xac33('0x1d')][_0xac33('0x1e')]===undefined?!![]:![]:!![]})[_0xac33('0xe')](function(_0x3757ae){logger[_0xac33('0xf')](_0xac33('0x1a'),_0xa8ae86);logger[_0xac33('0x11')](_0xac33('0x1a'),_0xa8ae86,JSON[_0xac33('0x13')](_0x3757ae));_0x107c88(_0x3757ae);})[_0xac33('0x19')](function(_0xc87c31){logger['error'](_0xac33('0x1a'),_0xc87c31[_0xac33('0x17')],_0xa8ae86);_0x4bdc9a(_0x3c0502[_0xac33('0x14')](0x1f4,_0xc87c31[_0xac33('0x17')]));});});};exports['UpdateFaxQueueReport']=function(_0x2d53a2){var _0x35eda0=this;return new Promise(function(_0x2a9a6d,_0x39e374){return db[_0xac33('0x1b')][_0xac33('0x1f')](_0x2d53a2['body'],{'raw':_0x2d53a2['options']?_0x2d53a2[_0xac33('0x1d')][_0xac33('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d53a2['options']?_0x2d53a2['options'][_0xac33('0x20')]||null:null,'attributes':_0x2d53a2[_0xac33('0x1d')]?_0x2d53a2[_0xac33('0x1d')]['attributes']||null:null,'limit':_0x2d53a2['options']?_0x2d53a2[_0xac33('0x1d')][_0xac33('0x21')]||null:null})[_0xac33('0xe')](function(_0x53d674){logger[_0xac33('0xf')](_0xac33('0x22'),_0x2d53a2);logger['debug'](_0xac33('0x22'),_0x2d53a2,JSON[_0xac33('0x13')](_0x53d674));_0x2a9a6d(_0x53d674);})['catch'](function(_0x4b51b2){logger[_0xac33('0x14')]('UpdateFaxQueueReport',_0x4b51b2[_0xac33('0x17')],_0x2d53a2);_0x39e374(_0x35eda0['error'](0x1f4,_0x4b51b2[_0xac33('0x17')]));});});}; \ No newline at end of file +var _0x70d9=['FaxQueueReport','create','body','options','CreateFaxQueueReport','catch','UpdateFaxQueueReport','raw','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x542cc2,_0x378024){var _0x44a95a=function(_0x1de392){while(--_0x1de392){_0x542cc2['push'](_0x542cc2['shift']());}};_0x44a95a(++_0x378024);}(_0x70d9,0x102));var _0x970d=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x70d9[_0x122096];return _0x3d1966;};'use strict';var _=require(_0x970d('0x0'));var util=require('util');var moment=require(_0x970d('0x1'));var BPromise=require(_0x970d('0x2'));var rs=require(_0x970d('0x3'));var fs=require('fs');var Redis=require(_0x970d('0x4'));var db=require(_0x970d('0x5'))['db'];var utils=require(_0x970d('0x6'));var logger=require(_0x970d('0x7'))('rpc');var config=require(_0x970d('0x8'));var jayson=require(_0x970d('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1522e9,_0x20fcf2,_0x39a564){return new BPromise(function(_0x1b7cab,_0x17b0ef){return client[_0x970d('0xa')](_0x1522e9,_0x39a564)[_0x970d('0xb')](function(_0x5393a1){logger[_0x970d('0xc')](_0x970d('0xd'),_0x20fcf2,_0x970d('0xe'));logger[_0x970d('0xf')](_0x970d('0x10'),_0x20fcf2,_0x970d('0xe'),JSON[_0x970d('0x11')](_0x5393a1));if(_0x5393a1[_0x970d('0x12')]){if(_0x5393a1[_0x970d('0x12')][_0x970d('0x13')]===0x1f4){logger['error'](_0x970d('0xd'),_0x20fcf2,_0x5393a1[_0x970d('0x12')][_0x970d('0x14')]);return _0x17b0ef(_0x5393a1[_0x970d('0x12')][_0x970d('0x14')]);}logger[_0x970d('0x12')](_0x970d('0xd'),_0x20fcf2,_0x5393a1[_0x970d('0x12')][_0x970d('0x14')]);return _0x1b7cab(_0x5393a1[_0x970d('0x12')][_0x970d('0x14')]);}else{logger[_0x970d('0xc')](_0x970d('0xd'),_0x20fcf2,'request\x20sent');_0x1b7cab(_0x5393a1['result'][_0x970d('0x14')]);}})['catch'](function(_0x364e03){logger[_0x970d('0x12')](_0x970d('0xd'),_0x20fcf2,_0x364e03);_0x17b0ef(_0x364e03);});});}exports['CreateFaxQueueReport']=function(_0x5946e4){var _0x4d5b91=this;return new Promise(function(_0x43f9b9,_0x36ba69){return db[_0x970d('0x15')][_0x970d('0x16')](_0x5946e4[_0x970d('0x17')],{'raw':_0x5946e4[_0x970d('0x18')]?_0x5946e4[_0x970d('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x970d('0xb')](function(_0xcdfb9c){logger[_0x970d('0xc')](_0x970d('0x19'),_0x5946e4);logger['debug'](_0x970d('0x19'),_0x5946e4,JSON[_0x970d('0x11')](_0xcdfb9c));_0x43f9b9(_0xcdfb9c);})[_0x970d('0x1a')](function(_0x24241b){logger[_0x970d('0x12')](_0x970d('0x19'),_0x24241b['message'],_0x5946e4);_0x36ba69(_0x4d5b91[_0x970d('0x12')](0x1f4,_0x24241b[_0x970d('0x14')]));});});};exports[_0x970d('0x1b')]=function(_0x202385){var _0x4aecd3=this;return new Promise(function(_0x295cc6,_0x5b62e9){return db[_0x970d('0x15')]['update'](_0x202385[_0x970d('0x17')],{'raw':_0x202385['options']?_0x202385[_0x970d('0x18')][_0x970d('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x202385[_0x970d('0x18')]?_0x202385['options']['where']||null:null,'attributes':_0x202385[_0x970d('0x18')]?_0x202385[_0x970d('0x18')][_0x970d('0x1d')]||null:null,'limit':_0x202385['options']?_0x202385[_0x970d('0x18')][_0x970d('0x1e')]||null:null})[_0x970d('0xb')](function(_0x81d1d3){logger['info'](_0x970d('0x1b'),_0x202385);logger[_0x970d('0xf')](_0x970d('0x1b'),_0x202385,JSON[_0x970d('0x11')](_0x81d1d3));_0x295cc6(_0x81d1d3);})[_0x970d('0x1a')](function(_0x1f1115){logger[_0x970d('0x12')](_0x970d('0x1b'),_0x1f1115[_0x970d('0x14')],_0x202385);_0x5b62e9(_0x4aecd3['error'](0x1f4,_0x1f1115[_0x970d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 087c256..ffdec74 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 _0xbe85=['put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./faxQueueReport.controller','get','/describe','isAuthenticated','show','create'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0xbe85,0xc4));var _0x5be8=function(_0x223613,_0x5f2714){_0x223613=_0x223613-0x0;var _0x17ef63=_0xbe85[_0x223613];return _0x17ef63;};'use strict';var multer=require(_0x5be8('0x0'));var util=require(_0x5be8('0x1'));var path=require(_0x5be8('0x2'));var timeout=require(_0x5be8('0x3'));var express=require(_0x5be8('0x4'));var router=express[_0x5be8('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5be8('0x6'));var controller=require(_0x5be8('0x7'));router[_0x5be8('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5be8('0x8')](_0x5be8('0x9'),auth[_0x5be8('0xa')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x5be8('0xb')]);router['post']('/',auth[_0x5be8('0xa')](),controller[_0x5be8('0xc')]);router[_0x5be8('0xd')](_0x5be8('0xe'),auth[_0x5be8('0xa')](),controller[_0x5be8('0xf')]);router[_0x5be8('0x10')](_0x5be8('0xe'),auth['isAuthenticated'](),controller[_0x5be8('0x11')]);module[_0x5be8('0x12')]=router; \ No newline at end of file +var _0x407e=['post','create','update','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x407e,0xc9));var _0xe407=function(_0x48999d,_0x1e02cb){_0x48999d=_0x48999d-0x0;var _0x1ad0d1=_0x407e[_0x48999d];return _0x1ad0d1;};'use strict';var multer=require(_0xe407('0x0'));var util=require(_0xe407('0x1'));var path=require(_0xe407('0x2'));var timeout=require(_0xe407('0x3'));var express=require(_0xe407('0x4'));var router=express[_0xe407('0x5')]();var auth=require(_0xe407('0x6'));var interaction=require(_0xe407('0x7'));var config=require('../../config/environment');var controller=require(_0xe407('0x8'));router[_0xe407('0x9')]('/',auth[_0xe407('0xa')](),controller[_0xe407('0xb')]);router[_0xe407('0x9')](_0xe407('0xc'),auth[_0xe407('0xa')](),controller[_0xe407('0xd')]);router[_0xe407('0x9')](_0xe407('0xe'),auth[_0xe407('0xa')](),controller['show']);router[_0xe407('0xf')]('/',auth[_0xe407('0xa')](),controller[_0xe407('0x10')]);router['put'](_0xe407('0xe'),auth[_0xe407('0xa')](),controller[_0xe407('0x11')]);router['delete'](_0xe407('0xe'),auth[_0xe407('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index b709dbf..e499ab5 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 _0xd850=['queue','DATE','exports','STRING','ENUM','agent'];(function(_0x3183f3,_0x56ea53){var _0x28e684=function(_0x360c66){while(--_0x360c66){_0x3183f3['push'](_0x3183f3['shift']());}};_0x28e684(++_0x56ea53);}(_0xd850,0x1c4));var _0x0d85=function(_0x32313f,_0x26ffa0){_0x32313f=_0x32313f-0x0;var _0x1726d6=_0xd850[_0x32313f];return _0x1726d6;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x0d85('0x0')]={'uniqueid':{'type':Sequelize[_0x0d85('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x0d85('0x2')]('account',_0x0d85('0x3'),_0x0d85('0x4')),'allowNull':![],'defaultValue':_0x0d85('0x4')},'transferredAt':{'type':Sequelize[_0x0d85('0x5')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xcb6f=['agent','queue','DATE','moment','exports','STRING','account'];(function(_0x5ef35e,_0x329db7){var _0x4cdc0c=function(_0x20bda0){while(--_0x20bda0){_0x5ef35e['push'](_0x5ef35e['shift']());}};_0x4cdc0c(++_0x329db7);}(_0xcb6f,0xc0));var _0xfcb6=function(_0x2e41d7,_0x5d807f){_0x2e41d7=_0x2e41d7-0x0;var _0x962285=_0xcb6f[_0x2e41d7];return _0x962285;};'use strict';var moment=require(_0xfcb6('0x0'));var Sequelize=require('sequelize');module[_0xfcb6('0x1')]={'uniqueid':{'type':Sequelize[_0xfcb6('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xfcb6('0x3'),_0xfcb6('0x4'),_0xfcb6('0x5')),'allowNull':![],'defaultValue':_0xfcb6('0x5')},'transferredAt':{'type':Sequelize[_0xfcb6('0x6')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 8120e36..9b2161c 100644 --- a/server/api/faxTransferReport/faxTransferReport.controller.js +++ b/server/api/faxTransferReport/faxTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','filter','merge','VIRTUAL','options','where','count','includeAll','include','findAll','rows','show','find','catch','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','end','status','json','offset','limit','set'];(function(_0x5226c3,_0x5b006f){var _0x355991=function(_0x5953c3){while(--_0x5953c3){_0x5226c3['push'](_0x5226c3['shift']());}};_0x355991(++_0x5b006f);}(_0xdb28,0x106));var _0x8db2=function(_0x457a89,_0x2065b1){_0x457a89=_0x457a89-0x0;var _0x245ee0=_0xdb28[_0x457a89];return _0x245ee0;};'use strict';var pdf=require(_0x8db2('0x0'));var emlformat=require(_0x8db2('0x1'));var rimraf=require(_0x8db2('0x2'));var zipdir=require(_0x8db2('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8db2('0x4'));var moment=require(_0x8db2('0x5'));var BPromise=require(_0x8db2('0x6'));var Mustache=require(_0x8db2('0x7'));var util=require(_0x8db2('0x8'));var path=require('path');var sox=require(_0x8db2('0x9'));var csv=require(_0x8db2('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0xa'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var db=require(_0x8db2('0x17'))['db'];function respondWithStatusCode(_0x1349f6,_0x204f49){_0x204f49=_0x204f49||0xcc;return function(_0x37d017){if(_0x37d017){return _0x1349f6['sendStatus'](_0x204f49);}return _0x1349f6['status'](_0x204f49)[_0x8db2('0x18')]();};}function respondWithResult(_0x15e87c,_0x350d61){_0x350d61=_0x350d61||0xc8;return function(_0x1d6a15){if(_0x1d6a15){return _0x15e87c[_0x8db2('0x19')](_0x350d61)[_0x8db2('0x1a')](_0x1d6a15);}};}function respondWithFilteredResult(_0x2f177a,_0x3c96a7){return function(_0x131252){if(_0x131252){var _0x16c8c2=_0x131252['count'],_0x5489a9=_0x3c96a7[_0x8db2('0x1b')],_0x13b0f5=_0x3c96a7[_0x8db2('0x1b')]+_0x3c96a7[_0x8db2('0x1c')],_0x24da1b;if(_0x13b0f5>=_0x16c8c2){_0x13b0f5=_0x16c8c2;_0x24da1b=0xc8;}else{_0x24da1b=0xce;}_0x2f177a[_0x8db2('0x19')](_0x24da1b);return _0x2f177a[_0x8db2('0x1d')](_0x8db2('0x1e'),_0x5489a9+'-'+_0x13b0f5+'/'+_0x16c8c2)['json'](_0x131252);}return null;};}function patchUpdates(_0x5df464){return function(_0x77789){try{jsonpatch[_0x8db2('0x1f')](_0x77789,_0x5df464,!![]);}catch(_0x1310d3){return BPromise[_0x8db2('0x20')](_0x1310d3);}return _0x77789['save']();};}function saveUpdates(_0x431d60,_0x36a9ff){return function(_0x260940){if(_0x260940){return _0x260940[_0x8db2('0x21')](_0x431d60)[_0x8db2('0x22')](function(_0x597260){return _0x597260;});}return null;};}function removeEntity(_0x124467,_0x3e30e6){return function(_0x18f69c){if(_0x18f69c){return _0x18f69c[_0x8db2('0x23')]()[_0x8db2('0x22')](function(){_0x124467[_0x8db2('0x19')](0xcc)[_0x8db2('0x18')]();});}};}function handleEntityNotFound(_0x5c6614,_0x256202){return function(_0x4f6516){if(!_0x4f6516){_0x5c6614['sendStatus'](0x194);}return _0x4f6516;};}function handleError(_0x52a9ca,_0x4d923c){_0x4d923c=_0x4d923c||0x1f4;return function(_0xec8cd2){logger[_0x8db2('0x24')](_0xec8cd2[_0x8db2('0x25')]);if(_0xec8cd2[_0x8db2('0x26')]){delete _0xec8cd2[_0x8db2('0x26')];}_0x52a9ca[_0x8db2('0x19')](_0x4d923c)['send'](_0xec8cd2);};}exports[_0x8db2('0x27')]=function(_0x372311,_0x430dd5){var _0x8b7cec={},_0x483aee={},_0x2e0691={'count':0x0,'rows':[]};var _0x11f398=_[_0x8db2('0x28')](db[_0x8db2('0x29')][_0x8db2('0x2a')],function(_0x21bae5){return{'name':_0x21bae5[_0x8db2('0x2b')],'type':_0x21bae5[_0x8db2('0x2c')][_0x8db2('0x2d')]};});_0x483aee['model']=_[_0x8db2('0x28')](_0x11f398,'name');_0x483aee['query']=_[_0x8db2('0x2e')](_0x372311[_0x8db2('0x2f')]);_0x483aee[_0x8db2('0x30')]=_['intersection'](_0x483aee[_0x8db2('0x31')],_0x483aee['query']);_0x8b7cec[_0x8db2('0x32')]=_[_0x8db2('0x33')](_0x483aee[_0x8db2('0x31')],qs['fields'](_0x372311['query'][_0x8db2('0x34')]));_0x8b7cec[_0x8db2('0x32')]=_0x8b7cec['attributes']['length']?_0x8b7cec[_0x8db2('0x32')]:_0x483aee[_0x8db2('0x31')];if(!_0x372311[_0x8db2('0x2f')][_0x8db2('0x35')](_0x8db2('0x36'))){_0x8b7cec[_0x8db2('0x1c')]=qs[_0x8db2('0x1c')](_0x372311[_0x8db2('0x2f')][_0x8db2('0x1c')]);_0x8b7cec[_0x8db2('0x1b')]=qs['offset'](_0x372311[_0x8db2('0x2f')][_0x8db2('0x1b')]);}_0x8b7cec['order']=qs[_0x8db2('0x37')](_0x372311[_0x8db2('0x2f')]['sort']);_0x8b7cec['where']=qs[_0x8db2('0x30')](_['pick'](_0x372311[_0x8db2('0x2f')],_0x483aee[_0x8db2('0x30')]),_0x11f398);if(_0x372311[_0x8db2('0x2f')][_0x8db2('0x38')]){_0x8b7cec['where']=_[_0x8db2('0x39')](_0x8b7cec['where'],{'$or':_[_0x8db2('0x28')](_0x11f398,function(_0xd550ae){if(_0xd550ae[_0x8db2('0x2c')]!==_0x8db2('0x3a')){var _0x50e88a={};_0x50e88a[_0xd550ae['name']]={'$like':'%'+_0x372311[_0x8db2('0x2f')][_0x8db2('0x38')]+'%'};return _0x50e88a;}})});}_0x8b7cec=_['merge']({},_0x8b7cec,_0x372311[_0x8db2('0x3b')]);var _0x24bcfe={'where':_0x8b7cec[_0x8db2('0x3c')]};return db['FaxTransferReport'][_0x8db2('0x3d')](_0x24bcfe)[_0x8db2('0x22')](function(_0x953349){_0x2e0691[_0x8db2('0x3d')]=_0x953349;if(_0x372311[_0x8db2('0x2f')][_0x8db2('0x3e')]){_0x8b7cec[_0x8db2('0x3f')]=[{'all':!![]}];}return db[_0x8db2('0x29')][_0x8db2('0x40')](_0x8b7cec);})[_0x8db2('0x22')](function(_0x21cf7c){_0x2e0691[_0x8db2('0x41')]=_0x21cf7c;return _0x2e0691;})[_0x8db2('0x22')](respondWithFilteredResult(_0x430dd5,_0x8b7cec))['catch'](handleError(_0x430dd5,null));};exports[_0x8db2('0x42')]=function(_0x2b2472,_0x5e0382){var _0x49a7ae={'raw':!![],'where':{'id':_0x2b2472['params']['id']}},_0x249c73={};_0x249c73[_0x8db2('0x31')]=_[_0x8db2('0x2e')](db[_0x8db2('0x29')][_0x8db2('0x2a')]);_0x249c73[_0x8db2('0x2f')]=_[_0x8db2('0x2e')](_0x2b2472[_0x8db2('0x2f')]);_0x249c73['filters']=_[_0x8db2('0x33')](_0x249c73[_0x8db2('0x31')],_0x249c73[_0x8db2('0x2f')]);_0x49a7ae[_0x8db2('0x32')]=_['intersection'](_0x249c73[_0x8db2('0x31')],qs[_0x8db2('0x34')](_0x2b2472[_0x8db2('0x2f')][_0x8db2('0x34')]));_0x49a7ae['attributes']=_0x49a7ae[_0x8db2('0x32')]['length']?_0x49a7ae[_0x8db2('0x32')]:_0x249c73[_0x8db2('0x31')];if(_0x2b2472[_0x8db2('0x2f')]['includeAll']){_0x49a7ae['include']=[{'all':!![]}];}_0x49a7ae=_[_0x8db2('0x39')]({},_0x49a7ae,_0x2b2472['options']);return db[_0x8db2('0x29')][_0x8db2('0x43')](_0x49a7ae)[_0x8db2('0x22')](handleEntityNotFound(_0x5e0382,null))[_0x8db2('0x22')](respondWithResult(_0x5e0382,null))[_0x8db2('0x44')](handleError(_0x5e0382,null));};exports[_0x8db2('0x45')]=function(_0x4355e2,_0xab6bdd){return db[_0x8db2('0x29')][_0x8db2('0x45')](_0x4355e2[_0x8db2('0x46')],{})[_0x8db2('0x22')](respondWithResult(_0xab6bdd,0xc9))['catch'](handleError(_0xab6bdd,null));};exports[_0x8db2('0x21')]=function(_0x2ada52,_0xdbba64){if(_0x2ada52[_0x8db2('0x46')]['id']){delete _0x2ada52['body']['id'];}return db['FaxTransferReport'][_0x8db2('0x43')]({'where':{'id':_0x2ada52[_0x8db2('0x47')]['id']}})[_0x8db2('0x22')](handleEntityNotFound(_0xdbba64,null))['then'](saveUpdates(_0x2ada52['body'],null))['then'](respondWithResult(_0xdbba64,null))[_0x8db2('0x44')](handleError(_0xdbba64,null));};exports[_0x8db2('0x23')]=function(_0x55c7dd,_0x383fa1){return db[_0x8db2('0x29')][_0x8db2('0x43')]({'where':{'id':_0x55c7dd[_0x8db2('0x47')]['id']}})['then'](handleEntityNotFound(_0x383fa1,null))['then'](removeEntity(_0x383fa1,null))[_0x8db2('0x44')](handleError(_0x383fa1,null));};exports[_0x8db2('0x48')]=function(_0x2908e4,_0x2f0bd0){return db[_0x8db2('0x29')][_0x8db2('0x48')]()[_0x8db2('0x22')](respondWithResult(_0x2f0bd0,null))[_0x8db2('0x44')](handleError(_0x2f0bd0,null));}; \ No newline at end of file +var _0x2ef3=['send','index','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','offset','sort','pick','where','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','limit','set','apply','reject','save','update','destroy','then','stack','name'];(function(_0x27cc90,_0x5bd896){var _0x3845f3=function(_0x509083){while(--_0x509083){_0x27cc90['push'](_0x27cc90['shift']());}};_0x3845f3(++_0x5bd896);}(_0x2ef3,0xba));var _0x32ef=function(_0x7410a0,_0x4f0d76){_0x7410a0=_0x7410a0-0x0;var _0x2ba229=_0x2ef3[_0x7410a0];return _0x2ba229;};'use strict';var pdf=require(_0x32ef('0x0'));var emlformat=require(_0x32ef('0x1'));var rimraf=require(_0x32ef('0x2'));var zipdir=require(_0x32ef('0x3'));var jsonpatch=require(_0x32ef('0x4'));var rp=require(_0x32ef('0x5'));var moment=require('moment');var BPromise=require(_0x32ef('0x6'));var Mustache=require(_0x32ef('0x7'));var util=require('util');var path=require(_0x32ef('0x8'));var sox=require(_0x32ef('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0xf'));var querystring=require(_0x32ef('0x10'));var Papa=require(_0x32ef('0x11'));var Redis=require(_0x32ef('0x12'));var authService=require(_0x32ef('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x14'));var logger=require(_0x32ef('0x15'))(_0x32ef('0x16'));var utils=require(_0x32ef('0x17'));var config=require('../../config/environment');var db=require(_0x32ef('0x18'))['db'];function respondWithStatusCode(_0x5afcc2,_0x1a5106){_0x1a5106=_0x1a5106||0xcc;return function(_0x49d590){if(_0x49d590){return _0x5afcc2[_0x32ef('0x19')](_0x1a5106);}return _0x5afcc2[_0x32ef('0x1a')](_0x1a5106)['end']();};}function respondWithResult(_0x539d18,_0x19ce1){_0x19ce1=_0x19ce1||0xc8;return function(_0x4d8009){if(_0x4d8009){return _0x539d18[_0x32ef('0x1a')](_0x19ce1)[_0x32ef('0x1b')](_0x4d8009);}};}function respondWithFilteredResult(_0x93d492,_0x54c7f5){return function(_0x57aff1){if(_0x57aff1){var _0x55bf0b=_0x57aff1[_0x32ef('0x1c')],_0x531e30=_0x54c7f5['offset'],_0x13db1a=_0x54c7f5['offset']+_0x54c7f5[_0x32ef('0x1d')],_0x3950e6;if(_0x13db1a>=_0x55bf0b){_0x13db1a=_0x55bf0b;_0x3950e6=0xc8;}else{_0x3950e6=0xce;}_0x93d492[_0x32ef('0x1a')](_0x3950e6);return _0x93d492[_0x32ef('0x1e')]('Content-Range',_0x531e30+'-'+_0x13db1a+'/'+_0x55bf0b)[_0x32ef('0x1b')](_0x57aff1);}return null;};}function patchUpdates(_0x33e230){return function(_0x4f4c98){try{jsonpatch[_0x32ef('0x1f')](_0x4f4c98,_0x33e230,!![]);}catch(_0x314ef1){return BPromise[_0x32ef('0x20')](_0x314ef1);}return _0x4f4c98[_0x32ef('0x21')]();};}function saveUpdates(_0x445cda,_0x3aec05){return function(_0x4de441){if(_0x4de441){return _0x4de441[_0x32ef('0x22')](_0x445cda)['then'](function(_0x309866){return _0x309866;});}return null;};}function removeEntity(_0x3a20ca,_0x49f2d8){return function(_0x1af371){if(_0x1af371){return _0x1af371[_0x32ef('0x23')]()[_0x32ef('0x24')](function(){_0x3a20ca['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(!_0x225feb){_0x22f2d7['sendStatus'](0x194);}return _0x225feb;};}function handleError(_0x59585f,_0x19ea6){_0x19ea6=_0x19ea6||0x1f4;return function(_0x4d584b){logger['error'](_0x4d584b[_0x32ef('0x25')]);if(_0x4d584b[_0x32ef('0x26')]){delete _0x4d584b[_0x32ef('0x26')];}_0x59585f[_0x32ef('0x1a')](_0x19ea6)[_0x32ef('0x27')](_0x4d584b);};}exports[_0x32ef('0x28')]=function(_0x1874ea,_0x38aed5){var _0x338f19={},_0x2f52d7={},_0x1335e2={'count':0x0,'rows':[]};var _0xba4b3f=_['map'](db[_0x32ef('0x29')][_0x32ef('0x2a')],function(_0x5a04cd){return{'name':_0x5a04cd[_0x32ef('0x2b')],'type':_0x5a04cd[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x2f52d7[_0x32ef('0x2e')]=_['map'](_0xba4b3f,_0x32ef('0x26'));_0x2f52d7[_0x32ef('0x2f')]=_[_0x32ef('0x30')](_0x1874ea[_0x32ef('0x2f')]);_0x2f52d7[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x2f52d7[_0x32ef('0x2e')],_0x2f52d7['query']);_0x338f19[_0x32ef('0x33')]=_['intersection'](_0x2f52d7[_0x32ef('0x2e')],qs[_0x32ef('0x34')](_0x1874ea['query'][_0x32ef('0x34')]));_0x338f19[_0x32ef('0x33')]=_0x338f19[_0x32ef('0x33')][_0x32ef('0x35')]?_0x338f19[_0x32ef('0x33')]:_0x2f52d7['model'];if(!_0x1874ea['query'][_0x32ef('0x36')]('nolimit')){_0x338f19[_0x32ef('0x1d')]=qs[_0x32ef('0x1d')](_0x1874ea[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x338f19[_0x32ef('0x37')]=qs[_0x32ef('0x37')](_0x1874ea['query']['offset']);}_0x338f19['order']=qs[_0x32ef('0x38')](_0x1874ea[_0x32ef('0x2f')][_0x32ef('0x38')]);_0x338f19['where']=qs['filters'](_[_0x32ef('0x39')](_0x1874ea[_0x32ef('0x2f')],_0x2f52d7[_0x32ef('0x31')]),_0xba4b3f);if(_0x1874ea['query']['filter']){_0x338f19[_0x32ef('0x3a')]=_[_0x32ef('0x3b')](_0x338f19[_0x32ef('0x3a')],{'$or':_[_0x32ef('0x3c')](_0xba4b3f,function(_0x3a7c49){if(_0x3a7c49[_0x32ef('0x2c')]!==_0x32ef('0x3d')){var _0x21da90={};_0x21da90[_0x3a7c49[_0x32ef('0x26')]]={'$like':'%'+_0x1874ea['query'][_0x32ef('0x3e')]+'%'};return _0x21da90;}})});}_0x338f19=_[_0x32ef('0x3b')]({},_0x338f19,_0x1874ea[_0x32ef('0x3f')]);var _0x4b97dc={'where':_0x338f19[_0x32ef('0x3a')]};return db[_0x32ef('0x29')][_0x32ef('0x1c')](_0x4b97dc)[_0x32ef('0x24')](function(_0x1faf72){_0x1335e2[_0x32ef('0x1c')]=_0x1faf72;if(_0x1874ea[_0x32ef('0x2f')][_0x32ef('0x40')]){_0x338f19[_0x32ef('0x41')]=[{'all':!![]}];}return db[_0x32ef('0x29')][_0x32ef('0x42')](_0x338f19);})[_0x32ef('0x24')](function(_0x48e071){_0x1335e2[_0x32ef('0x43')]=_0x48e071;return _0x1335e2;})[_0x32ef('0x24')](respondWithFilteredResult(_0x38aed5,_0x338f19))[_0x32ef('0x44')](handleError(_0x38aed5,null));};exports[_0x32ef('0x45')]=function(_0x2f92f5,_0x2ca66b){var _0x3c0e44={'raw':!![],'where':{'id':_0x2f92f5['params']['id']}},_0x596d5a={};_0x596d5a[_0x32ef('0x2e')]=_[_0x32ef('0x30')](db[_0x32ef('0x29')][_0x32ef('0x2a')]);_0x596d5a['query']=_[_0x32ef('0x30')](_0x2f92f5[_0x32ef('0x2f')]);_0x596d5a['filters']=_[_0x32ef('0x32')](_0x596d5a['model'],_0x596d5a[_0x32ef('0x2f')]);_0x3c0e44[_0x32ef('0x33')]=_[_0x32ef('0x32')](_0x596d5a[_0x32ef('0x2e')],qs[_0x32ef('0x34')](_0x2f92f5[_0x32ef('0x2f')][_0x32ef('0x34')]));_0x3c0e44[_0x32ef('0x33')]=_0x3c0e44[_0x32ef('0x33')][_0x32ef('0x35')]?_0x3c0e44['attributes']:_0x596d5a[_0x32ef('0x2e')];if(_0x2f92f5['query'][_0x32ef('0x40')]){_0x3c0e44[_0x32ef('0x41')]=[{'all':!![]}];}_0x3c0e44=_[_0x32ef('0x3b')]({},_0x3c0e44,_0x2f92f5['options']);return db[_0x32ef('0x29')][_0x32ef('0x46')](_0x3c0e44)[_0x32ef('0x24')](handleEntityNotFound(_0x2ca66b,null))[_0x32ef('0x24')](respondWithResult(_0x2ca66b,null))[_0x32ef('0x44')](handleError(_0x2ca66b,null));};exports[_0x32ef('0x47')]=function(_0x12c9e6,_0x47dbe1){return db['FaxTransferReport'][_0x32ef('0x47')](_0x12c9e6[_0x32ef('0x48')],{})[_0x32ef('0x24')](respondWithResult(_0x47dbe1,0xc9))[_0x32ef('0x44')](handleError(_0x47dbe1,null));};exports[_0x32ef('0x22')]=function(_0xd67dc9,_0x44ad11){if(_0xd67dc9[_0x32ef('0x48')]['id']){delete _0xd67dc9[_0x32ef('0x48')]['id'];}return db[_0x32ef('0x29')][_0x32ef('0x46')]({'where':{'id':_0xd67dc9[_0x32ef('0x49')]['id']}})[_0x32ef('0x24')](handleEntityNotFound(_0x44ad11,null))['then'](saveUpdates(_0xd67dc9[_0x32ef('0x48')],null))[_0x32ef('0x24')](respondWithResult(_0x44ad11,null))[_0x32ef('0x44')](handleError(_0x44ad11,null));};exports[_0x32ef('0x23')]=function(_0x1cc9f3,_0x4353f0){return db[_0x32ef('0x29')][_0x32ef('0x46')]({'where':{'id':_0x1cc9f3[_0x32ef('0x49')]['id']}})[_0x32ef('0x24')](handleEntityNotFound(_0x4353f0,null))[_0x32ef('0x24')](removeEntity(_0x4353f0,null))[_0x32ef('0x44')](handleError(_0x4353f0,null));};exports[_0x32ef('0x4a')]=function(_0x326445,_0x307ac8){return db[_0x32ef('0x29')][_0x32ef('0x4a')]()[_0x32ef('0x24')](respondWithResult(_0x307ac8,null))['catch'](handleError(_0x307ac8,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index bfd7374..1b89326 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 _0xf4db=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util'];(function(_0x13524d,_0x505b49){var _0x9918b4=function(_0xef1f0a){while(--_0xef1f0a){_0x13524d['push'](_0x13524d['shift']());}};_0x9918b4(++_0x505b49);}(_0xf4db,0x19e));var _0xbf4d=function(_0x32874f,_0x2b45c6){_0x32874f=_0x32874f-0x0;var _0x5a89c6=_0xf4db[_0x32874f];return _0x5a89c6;};'use strict';var _=require(_0xbf4d('0x0'));var util=require(_0xbf4d('0x1'));var logger=require(_0xbf4d('0x2'))(_0xbf4d('0x3'));var moment=require(_0xbf4d('0x4'));var BPromise=require(_0xbf4d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbf4d('0x6'));var rimraf=require(_0xbf4d('0x7'));var config=require(_0xbf4d('0x8'));var attributes=require('./faxTransferReport.attributes');module[_0xbf4d('0x9')]=function(_0x40689c,_0x400377){return _0x40689c['define'](_0xbf4d('0xa'),attributes,{'tableName':_0xbf4d('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xbf4d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x38fd=['FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','define'];(function(_0x4439c5,_0x4c65f8){var _0x257daa=function(_0x29ebbe){while(--_0x29ebbe){_0x4439c5['push'](_0x4439c5['shift']());}};_0x257daa(++_0x4c65f8);}(_0x38fd,0xab));var _0xd38f=function(_0x46a193,_0x306060){_0x46a193=_0x46a193-0x0;var _0x5429aa=_0x38fd[_0x46a193];return _0x5429aa;};'use strict';var _=require(_0xd38f('0x0'));var util=require(_0xd38f('0x1'));var logger=require('../../config/logger')(_0xd38f('0x2'));var moment=require(_0xd38f('0x3'));var BPromise=require(_0xd38f('0x4'));var rp=require(_0xd38f('0x5'));var fs=require('fs');var path=require(_0xd38f('0x6'));var rimraf=require(_0xd38f('0x7'));var config=require(_0xd38f('0x8'));var attributes=require(_0xd38f('0x9'));module['exports']=function(_0x316352,_0x37461a){return _0x316352[_0xd38f('0xa')](_0xd38f('0xb'),attributes,{'tableName':_0xd38f('0xc'),'paranoid':![],'indexes':[{'name':_0xd38f('0xd'),'fields':[_0xd38f('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 4f95994..83ac0a4 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 _0x31bc=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','FaxTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x31bc,0x10e));var _0xc31b=function(_0x329611,_0x44a854){_0x329611=_0x329611-0x0;var _0x3e0fb3=_0x31bc[_0x329611];return _0x3e0fb3;};'use strict';var _=require(_0xc31b('0x0'));var util=require(_0xc31b('0x1'));var moment=require(_0xc31b('0x2'));var BPromise=require(_0xc31b('0x3'));var rs=require(_0xc31b('0x4'));var fs=require('fs');var Redis=require(_0xc31b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc31b('0x6'));var logger=require(_0xc31b('0x7'))(_0xc31b('0x8'));var config=require(_0xc31b('0x9'));var jayson=require(_0xc31b('0xa'));var client=jayson[_0xc31b('0xb')][_0xc31b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b04b,_0x5a6bb3,_0x5dd7c2){return new BPromise(function(_0x535a29,_0x275318){return client[_0xc31b('0xd')](_0x42b04b,_0x5dd7c2)[_0xc31b('0xe')](function(_0x261b81){logger[_0xc31b('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x5a6bb3,_0xc31b('0x10'));logger[_0xc31b('0x11')](_0xc31b('0x12'),_0x5a6bb3,_0xc31b('0x10'),JSON[_0xc31b('0x13')](_0x261b81));if(_0x261b81['error']){if(_0x261b81['error']['code']===0x1f4){logger[_0xc31b('0x14')](_0xc31b('0x15'),_0x5a6bb3,_0x261b81['error']['message']);return _0x275318(_0x261b81['error'][_0xc31b('0x16')]);}logger[_0xc31b('0x14')](_0xc31b('0x15'),_0x5a6bb3,_0x261b81['error']['message']);return _0x535a29(_0x261b81[_0xc31b('0x14')][_0xc31b('0x16')]);}else{logger['info'](_0xc31b('0x15'),_0x5a6bb3,_0xc31b('0x10'));_0x535a29(_0x261b81[_0xc31b('0x17')][_0xc31b('0x16')]);}})[_0xc31b('0x18')](function(_0x588898){logger[_0xc31b('0x14')]('FaxTransferReport,\x20%s,\x20%s',_0x5a6bb3,_0x588898);_0x275318(_0x588898);});});} \ No newline at end of file +var _0xd267=['../../config/environment','jayson/promise','client','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x510570,_0x1c60fb){var _0x2b31b2=function(_0x30def4){while(--_0x30def4){_0x510570['push'](_0x510570['shift']());}};_0x2b31b2(++_0x1c60fb);}(_0xd267,0x1ac));var _0x7d26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd267[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7d26('0x0'));var util=require(_0x7d26('0x1'));var moment=require('moment');var BPromise=require(_0x7d26('0x2'));var rs=require(_0x7d26('0x3'));var fs=require('fs');var Redis=require(_0x7d26('0x4'));var db=require(_0x7d26('0x5'))['db'];var utils=require(_0x7d26('0x6'));var logger=require(_0x7d26('0x7'))(_0x7d26('0x8'));var config=require(_0x7d26('0x9'));var jayson=require(_0x7d26('0xa'));var client=jayson[_0x7d26('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43a57f,_0x269a91,_0x3b8262){return new BPromise(function(_0x3d09d1,_0xcca50c){return client[_0x7d26('0xc')](_0x43a57f,_0x3b8262)[_0x7d26('0xd')](function(_0x4be7b9){logger[_0x7d26('0xe')](_0x7d26('0xf'),_0x269a91,_0x7d26('0x10'));logger['debug'](_0x7d26('0x11'),_0x269a91,_0x7d26('0x10'),JSON[_0x7d26('0x12')](_0x4be7b9));if(_0x4be7b9['error']){if(_0x4be7b9[_0x7d26('0x13')][_0x7d26('0x14')]===0x1f4){logger[_0x7d26('0x13')](_0x7d26('0xf'),_0x269a91,_0x4be7b9[_0x7d26('0x13')][_0x7d26('0x15')]);return _0xcca50c(_0x4be7b9[_0x7d26('0x13')]['message']);}logger['error'](_0x7d26('0xf'),_0x269a91,_0x4be7b9[_0x7d26('0x13')]['message']);return _0x3d09d1(_0x4be7b9[_0x7d26('0x13')][_0x7d26('0x15')]);}else{logger[_0x7d26('0xe')]('FaxTransferReport,\x20%s,\x20%s',_0x269a91,'request\x20sent');_0x3d09d1(_0x4be7b9['result'][_0x7d26('0x15')]);}})[_0x7d26('0x16')](function(_0x92dfff){logger['error'](_0x7d26('0xf'),_0x269a91,_0x92dfff);_0xcca50c(_0x92dfff);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 113d9ab..da3d464 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 _0xad66=['destroy','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','index','/describe','/:id','show','isAuthenticated','update','delete'];(function(_0x11b05b,_0x2c94ba){var _0x2ba447=function(_0x43a29c){while(--_0x43a29c){_0x11b05b['push'](_0x11b05b['shift']());}};_0x2ba447(++_0x2c94ba);}(_0xad66,0x167));var _0x6ad6=function(_0x1c7db8,_0x11d16f){_0x1c7db8=_0x1c7db8-0x0;var _0x32af18=_0xad66[_0x1c7db8];return _0x32af18;};'use strict';var multer=require('multer');var util=require(_0x6ad6('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6ad6('0x1'));var router=express[_0x6ad6('0x2')]();var auth=require(_0x6ad6('0x3'));var interaction=require(_0x6ad6('0x4'));var config=require(_0x6ad6('0x5'));var controller=require(_0x6ad6('0x6'));router[_0x6ad6('0x7')]('/',auth['isAuthenticated'](),controller[_0x6ad6('0x8')]);router[_0x6ad6('0x7')](_0x6ad6('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x6ad6('0x7')](_0x6ad6('0xa'),auth['isAuthenticated'](),controller[_0x6ad6('0xb')]);router['post']('/',auth[_0x6ad6('0xc')](),controller['create']);router['put'](_0x6ad6('0xa'),auth[_0x6ad6('0xc')](),controller[_0x6ad6('0xd')]);router[_0x6ad6('0xe')]('/:id',auth[_0x6ad6('0xc')](),controller[_0x6ad6('0xf')]);module[_0x6ad6('0x10')]=router; \ No newline at end of file +var _0xe74d=['isAuthenticated','index','get','/describe','describe','show','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./faxTransferReport.controller'];(function(_0x359567,_0x4b7d3e){var _0x2a6f19=function(_0x1e65d2){while(--_0x1e65d2){_0x359567['push'](_0x359567['shift']());}};_0x2a6f19(++_0x4b7d3e);}(_0xe74d,0xdd));var _0xde74=function(_0x415603,_0x21320c){_0x415603=_0x415603-0x0;var _0x131e72=_0xe74d[_0x415603];return _0x131e72;};'use strict';var multer=require(_0xde74('0x0'));var util=require(_0xde74('0x1'));var path=require(_0xde74('0x2'));var timeout=require(_0xde74('0x3'));var express=require(_0xde74('0x4'));var router=express[_0xde74('0x5')]();var auth=require(_0xde74('0x6'));var interaction=require(_0xde74('0x7'));var config=require('../../config/environment');var controller=require(_0xde74('0x8'));router['get']('/',auth[_0xde74('0x9')](),controller[_0xde74('0xa')]);router[_0xde74('0xb')](_0xde74('0xc'),auth['isAuthenticated'](),controller[_0xde74('0xd')]);router[_0xde74('0xb')]('/:id',auth[_0xde74('0x9')](),controller[_0xde74('0xe')]);router[_0xde74('0xf')]('/',auth['isAuthenticated'](),controller[_0xde74('0x10')]);router[_0xde74('0x11')]('/:id',auth[_0xde74('0x9')](),controller[_0xde74('0x12')]);router[_0xde74('0x13')](_0xde74('0x14'),auth[_0xde74('0x9')](),controller[_0xde74('0x15')]);module[_0xde74('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index fb18476..c209c4c 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 _0xd8b1=['getFields','post','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intDeskAccount.controller','get','isAuthenticated','show','/:id/configurations'];(function(_0x42c7d1,_0x43778a){var _0x21bce5=function(_0x2d3050){while(--_0x2d3050){_0x42c7d1['push'](_0x42c7d1['shift']());}};_0x21bce5(++_0x43778a);}(_0xd8b1,0x105));var _0x1d8b=function(_0x280f2e,_0x116cca){_0x280f2e=_0x280f2e-0x0;var _0x140302=_0xd8b1[_0x280f2e];return _0x140302;};'use strict';var multer=require(_0x1d8b('0x0'));var util=require(_0x1d8b('0x1'));var path=require(_0x1d8b('0x2'));var timeout=require(_0x1d8b('0x3'));var express=require(_0x1d8b('0x4'));var router=express['Router']();var auth=require(_0x1d8b('0x5'));var interaction=require(_0x1d8b('0x6'));var config=require('../../config/environment');var controller=require(_0x1d8b('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x1d8b('0x8')]('/:id',auth[_0x1d8b('0x9')](),controller[_0x1d8b('0xa')]);router[_0x1d8b('0x8')](_0x1d8b('0xb'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x1d8b('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x1d8b('0xc')]);router['post']('/',auth[_0x1d8b('0x9')](),controller['create']);router[_0x1d8b('0xd')](_0x1d8b('0xb'),auth[_0x1d8b('0x9')](),controller[_0x1d8b('0xe')]);router[_0x1d8b('0xf')](_0x1d8b('0x10'),auth['isAuthenticated'](),controller[_0x1d8b('0x11')]);router[_0x1d8b('0x12')](_0x1d8b('0x10'),auth[_0x1d8b('0x9')](),controller[_0x1d8b('0x13')]);module[_0x1d8b('0x14')]=router; \ No newline at end of file +var _0x1db9=['../../components/interaction/service','../../config/environment','isAuthenticated','/:id','show','get','/:id/configurations','getConfigurations','/:id/fields','getFields','addConfiguration','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3eec6d,_0x54044e){var _0x18c559=function(_0x216011){while(--_0x216011){_0x3eec6d['push'](_0x3eec6d['shift']());}};_0x18c559(++_0x54044e);}(_0x1db9,0x176));var _0x91db=function(_0x1e4586,_0x3181a0){_0x1e4586=_0x1e4586-0x0;var _0x1cdda6=_0x1db9[_0x1e4586];return _0x1cdda6;};'use strict';var multer=require(_0x91db('0x0'));var util=require(_0x91db('0x1'));var path=require(_0x91db('0x2'));var timeout=require(_0x91db('0x3'));var express=require(_0x91db('0x4'));var router=express[_0x91db('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x91db('0x6'));var config=require(_0x91db('0x7'));var controller=require('./intDeskAccount.controller');router['get']('/',auth[_0x91db('0x8')](),controller['index']);router['get'](_0x91db('0x9'),auth[_0x91db('0x8')](),controller[_0x91db('0xa')]);router[_0x91db('0xb')](_0x91db('0xc'),auth['isAuthenticated'](),controller[_0x91db('0xd')]);router['get'](_0x91db('0xe'),auth[_0x91db('0x8')](),controller[_0x91db('0xf')]);router['post']('/',auth[_0x91db('0x8')](),controller['create']);router['post']('/:id/configurations',auth[_0x91db('0x8')](),controller[_0x91db('0x10')]);router['put']('/:id',auth[_0x91db('0x8')](),controller[_0x91db('0x11')]);router[_0x91db('0x12')](_0x91db('0x9'),auth[_0x91db('0x8')](),controller['destroy']);module[_0x91db('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 44534fd..7b60c94 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 _0xc3c3=['exports','STRING','ENUM','basic','integrationTab','newTab','sequelize'];(function(_0x131890,_0x1f8b7e){var _0x461f8f=function(_0x384752){while(--_0x384752){_0x131890['push'](_0x131890['shift']());}};_0x461f8f(++_0x1f8b7e);}(_0xc3c3,0xfb));var _0x3c3c=function(_0x273bbd,_0x2724b5){_0x273bbd=_0x273bbd-0x0;var _0x37c0b1=_0xc3c3[_0x273bbd];return _0x37c0b1;};'use strict';var Sequelize=require(_0x3c3c('0x0'));module[_0x3c3c('0x1')]={'name':{'type':Sequelize[_0x3c3c('0x2')]},'description':{'type':Sequelize[_0x3c3c('0x2')]},'username':{'type':Sequelize[_0x3c3c('0x2')]},'remoteUri':{'type':Sequelize[_0x3c3c('0x2')]},'authType':{'type':Sequelize[_0x3c3c('0x3')](_0x3c3c('0x4')),'defaultValue':_0x3c3c('0x4')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x3c3c('0x2')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x3c3c('0x2')]},'serverUrl':{'type':Sequelize[_0x3c3c('0x2')]},'type':{'type':Sequelize[_0x3c3c('0x3')](_0x3c3c('0x5'),_0x3c3c('0x6')),'defaultValue':_0x3c3c('0x5')}}; \ No newline at end of file +var _0x9da7=['exports','STRING','ENUM','basic','integrationTab','newTab'];(function(_0x11746d,_0x9e53a6){var _0xc0044c=function(_0x3cd365){while(--_0x3cd365){_0x11746d['push'](_0x11746d['shift']());}};_0xc0044c(++_0x9e53a6);}(_0x9da7,0x1c8));var _0x79da=function(_0x561049,_0x330926){_0x561049=_0x561049-0x0;var _0x52f109=_0x9da7[_0x561049];return _0x52f109;};'use strict';var Sequelize=require('sequelize');module[_0x79da('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x79da('0x1')]},'username':{'type':Sequelize[_0x79da('0x1')]},'remoteUri':{'type':Sequelize[_0x79da('0x1')]},'authType':{'type':Sequelize[_0x79da('0x2')]('basic'),'defaultValue':_0x79da('0x3')},'password':{'type':Sequelize[_0x79da('0x1')]},'consumerKey':{'type':Sequelize[_0x79da('0x1')]},'consumerSecret':{'type':Sequelize[_0x79da('0x1')]},'token':{'type':Sequelize[_0x79da('0x1')]},'tokenSecret':{'type':Sequelize[_0x79da('0x1')]},'serverUrl':{'type':Sequelize[_0x79da('0x1')]},'type':{'type':Sequelize[_0x79da('0x2')](_0x79da('0x4'),_0x79da('0x5')),'defaultValue':_0x79da('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 6bae37e..c960016 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 _0xf5d6=['eml-format','rimraf','fast-json-patch','moment','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../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~!@#$%^&-_=+[{]}.','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','DeskAccount,\x20%s,\x20%s','message','catch','status','end','json','count','offset','set','apply','reject','save','update','then','destroy','sendStatus','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','VIRTUAL','options','include','rows','show','params','keys','includeAll','merge','find','create','body','getConfigurations','order','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','DeskConfiguration','DeskField','getFields','priority','remoteUri','username','password','consumerSecret','token','substring','lastIndexOf','format','%s/custom_fields','authType','headers','Authorization','toString','base64','_embedded','entries','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf'];(function(_0x1c5d08,_0x63120c){var _0xe2681d=function(_0x21166c){while(--_0x21166c){_0x1c5d08['push'](_0x1c5d08['shift']());}};_0xe2681d(++_0x63120c);}(_0xf5d6,0x79));var _0x6f5d=function(_0x4abb0b,_0x23e4ac){_0x4abb0b=_0x4abb0b-0x0;var _0x343fc1=_0xf5d6[_0x4abb0b];return _0x343fc1;};'use strict';var pdf=require(_0x6f5d('0x0'));var emlformat=require(_0x6f5d('0x1'));var rimraf=require(_0x6f5d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6f5d('0x3'));var rp=require('request-promise');var moment=require(_0x6f5d('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x6f5d('0x5'));var sox=require(_0x6f5d('0x6'));var csv=require(_0x6f5d('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6f5d('0x8'));var squel=require(_0x6f5d('0x9'));var crypto=require(_0x6f5d('0xa'));var jsforce=require(_0x6f5d('0xb'));var deskjs=require(_0x6f5d('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6f5d('0xd'));var Papa=require(_0x6f5d('0xe'));var Redis=require('ioredis');var authService=require(_0x6f5d('0xf'));var qs=require(_0x6f5d('0x10'));var as=require(_0x6f5d('0x11'));var hardwareService=require(_0x6f5d('0x12'));var logger=require(_0x6f5d('0x13'))(_0x6f5d('0x14'));var utils=require('../../config/utils');var config=require(_0x6f5d('0x15'));var db=require(_0x6f5d('0x16'))['db'];var integrations=require(_0x6f5d('0x17'));var jayson=require(_0x6f5d('0x18'));var client=jayson[_0x6f5d('0x19')][_0x6f5d('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x107d1e,_0xbca5a3,_0x1cc1c8){if(_0x1cc1c8){var _0x12eb0a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x12eb0a[_0x6f5d('0x1b')](_0xbca5a3)){return _0x107d1e;}else{throw new db[(_0x6f5d('0x1c'))]['ValidationError'](_0x6f5d('0x1d'));}}else{return _0x107d1e;}}function respondWithRpcPromise(_0x95ac0,_0x3d958a,_0x495269,_0x5d2b82){return new BPromise(function(_0xcecde0,_0x3dd6c5){var _0x575009=_0x5d2b82||client;return _0x575009['request'](_0x95ac0,_0x495269)['then'](function(_0x5bf4c6){logger[_0x6f5d('0x1e')]('DeskAccount,\x20%s,\x20%s',_0x3d958a,_0x6f5d('0x1f'));logger[_0x6f5d('0x20')](_0x6f5d('0x21'),_0x3d958a,'request\x20sent',JSON[_0x6f5d('0x22')](_0x5bf4c6));if(_0x5bf4c6['error']){if(_0x5bf4c6['error'][_0x6f5d('0x23')]===0x1f4){logger[_0x6f5d('0x24')](_0x6f5d('0x25'),_0x3d958a,_0x5bf4c6[_0x6f5d('0x24')][_0x6f5d('0x26')]);return _0x3dd6c5(_0x5bf4c6[_0x6f5d('0x24')]['message']);}logger['error'](_0x6f5d('0x25'),_0x3d958a,_0x5bf4c6[_0x6f5d('0x24')][_0x6f5d('0x26')]);return _0xcecde0(_0x5bf4c6[_0x6f5d('0x24')][_0x6f5d('0x26')]);}else{logger[_0x6f5d('0x1e')](_0x6f5d('0x25'),_0x3d958a,_0x6f5d('0x1f'));_0xcecde0(_0x5bf4c6['result'][_0x6f5d('0x26')]);}})[_0x6f5d('0x27')](function(_0x5da669){logger[_0x6f5d('0x24')]('DeskAccount,\x20%s,\x20%s',_0x3d958a,_0x5da669);_0x3dd6c5(_0x5da669);});});}function respondWithStatusCode(_0x7b9b2f,_0x5b96c0){_0x5b96c0=_0x5b96c0||0xcc;return function(_0x12f213){if(_0x12f213){return _0x7b9b2f['sendStatus'](_0x5b96c0);}return _0x7b9b2f[_0x6f5d('0x28')](_0x5b96c0)[_0x6f5d('0x29')]();};}function respondWithResult(_0x1c30cc,_0x43e4af){_0x43e4af=_0x43e4af||0xc8;return function(_0x5bd27d){if(_0x5bd27d){return _0x1c30cc[_0x6f5d('0x28')](_0x43e4af)[_0x6f5d('0x2a')](_0x5bd27d);}};}function respondWithFilteredResult(_0x2060ad,_0x332299){return function(_0x2c143a){if(_0x2c143a){var _0x295a25=_0x2c143a[_0x6f5d('0x2b')],_0x4c18b8=_0x332299['offset'],_0x5ae5ca=_0x332299[_0x6f5d('0x2c')]+_0x332299['limit'],_0x33bc0a;if(_0x5ae5ca>=_0x295a25){_0x5ae5ca=_0x295a25;_0x33bc0a=0xc8;}else{_0x33bc0a=0xce;}_0x2060ad[_0x6f5d('0x28')](_0x33bc0a);return _0x2060ad[_0x6f5d('0x2d')]('Content-Range',_0x4c18b8+'-'+_0x5ae5ca+'/'+_0x295a25)['json'](_0x2c143a);}return null;};}function patchUpdates(_0x4926d4){return function(_0x29b1df){try{jsonpatch[_0x6f5d('0x2e')](_0x29b1df,_0x4926d4,!![]);}catch(_0x5b6a6c){return BPromise[_0x6f5d('0x2f')](_0x5b6a6c);}return _0x29b1df[_0x6f5d('0x30')]();};}function saveUpdates(_0x2e8c88,_0x16be7d){return function(_0x157658){if(_0x157658){return _0x157658[_0x6f5d('0x31')](_0x2e8c88)[_0x6f5d('0x32')](function(_0x221911){return _0x221911;});}return null;};}function removeEntity(_0x9f85d1,_0x4393d7){return function(_0x1db184){if(_0x1db184){return _0x1db184[_0x6f5d('0x33')]()[_0x6f5d('0x32')](function(){_0x9f85d1[_0x6f5d('0x28')](0xcc)[_0x6f5d('0x29')]();});}};}function handleEntityNotFound(_0x8d5b60,_0x40a373){return function(_0x1dee6e){if(!_0x1dee6e){_0x8d5b60[_0x6f5d('0x34')](0x194);}return _0x1dee6e;};}function handleError(_0x1ae09d,_0x186f9c){_0x186f9c=_0x186f9c||0x1f4;return function(_0x3f99b9){logger[_0x6f5d('0x24')](_0x3f99b9['stack']);if(_0x3f99b9[_0x6f5d('0x35')]){delete _0x3f99b9[_0x6f5d('0x35')];}_0x1ae09d['status'](_0x186f9c)[_0x6f5d('0x36')](_0x3f99b9);};}exports[_0x6f5d('0x37')]=function(_0x569f8f,_0x2ab4f5){var _0x61c16a={},_0xdf85f7={},_0x2bb720={'count':0x0,'rows':[]};var _0x5c711b=_[_0x6f5d('0x38')](db[_0x6f5d('0x39')][_0x6f5d('0x3a')],function(_0x337131){return{'name':_0x337131[_0x6f5d('0x3b')],'type':_0x337131[_0x6f5d('0x3c')]['key']};});_0xdf85f7[_0x6f5d('0x3d')]=_[_0x6f5d('0x38')](_0x5c711b,_0x6f5d('0x35'));_0xdf85f7[_0x6f5d('0x3e')]=_['keys'](_0x569f8f[_0x6f5d('0x3e')]);_0xdf85f7[_0x6f5d('0x3f')]=_[_0x6f5d('0x40')](_0xdf85f7[_0x6f5d('0x3d')],_0xdf85f7[_0x6f5d('0x3e')]);_0x61c16a['attributes']=_['intersection'](_0xdf85f7[_0x6f5d('0x3d')],qs[_0x6f5d('0x41')](_0x569f8f['query'][_0x6f5d('0x41')]));_0x61c16a[_0x6f5d('0x42')]=_0x61c16a[_0x6f5d('0x42')][_0x6f5d('0x43')]?_0x61c16a[_0x6f5d('0x42')]:_0xdf85f7[_0x6f5d('0x3d')];if(!_0x569f8f[_0x6f5d('0x3e')][_0x6f5d('0x44')](_0x6f5d('0x45'))){_0x61c16a[_0x6f5d('0x46')]=qs[_0x6f5d('0x46')](_0x569f8f[_0x6f5d('0x3e')][_0x6f5d('0x46')]);_0x61c16a[_0x6f5d('0x2c')]=qs[_0x6f5d('0x2c')](_0x569f8f[_0x6f5d('0x3e')][_0x6f5d('0x2c')]);}_0x61c16a['order']=qs[_0x6f5d('0x47')](_0x569f8f['query']['sort']);_0x61c16a[_0x6f5d('0x48')]=qs[_0x6f5d('0x3f')](_[_0x6f5d('0x49')](_0x569f8f[_0x6f5d('0x3e')],_0xdf85f7[_0x6f5d('0x3f')]),_0x5c711b);if(_0x569f8f[_0x6f5d('0x3e')][_0x6f5d('0x4a')]){_0x61c16a[_0x6f5d('0x48')]=_['merge'](_0x61c16a[_0x6f5d('0x48')],{'$or':_[_0x6f5d('0x38')](_0x5c711b,function(_0x421fc8){if(_0x421fc8[_0x6f5d('0x3c')]!==_0x6f5d('0x4b')){var _0x51de12={};_0x51de12[_0x421fc8[_0x6f5d('0x35')]]={'$like':'%'+_0x569f8f['query'][_0x6f5d('0x4a')]+'%'};return _0x51de12;}})});}_0x61c16a=_['merge']({},_0x61c16a,_0x569f8f[_0x6f5d('0x4c')]);var _0x78f008={'where':_0x61c16a[_0x6f5d('0x48')]};return db[_0x6f5d('0x39')][_0x6f5d('0x2b')](_0x78f008)['then'](function(_0x4d4edf){_0x2bb720[_0x6f5d('0x2b')]=_0x4d4edf;if(_0x569f8f[_0x6f5d('0x3e')]['includeAll']){_0x61c16a[_0x6f5d('0x4d')]=[{'all':!![]}];}return db['DeskAccount']['findAll'](_0x61c16a);})[_0x6f5d('0x32')](function(_0x15538b){_0x2bb720[_0x6f5d('0x4e')]=_0x15538b;return _0x2bb720;})[_0x6f5d('0x32')](respondWithFilteredResult(_0x2ab4f5,_0x61c16a))['catch'](handleError(_0x2ab4f5,null));};exports[_0x6f5d('0x4f')]=function(_0x2be51b,_0x5eca1c){var _0x236a71={'raw':![],'where':{'id':_0x2be51b[_0x6f5d('0x50')]['id']}},_0x462248={};_0x462248[_0x6f5d('0x3d')]=_['keys'](db['DeskAccount'][_0x6f5d('0x3a')]);_0x462248[_0x6f5d('0x3e')]=_[_0x6f5d('0x51')](_0x2be51b['query']);_0x462248[_0x6f5d('0x3f')]=_[_0x6f5d('0x40')](_0x462248[_0x6f5d('0x3d')],_0x462248['query']);_0x236a71[_0x6f5d('0x42')]=_[_0x6f5d('0x40')](_0x462248['model'],qs['fields'](_0x2be51b[_0x6f5d('0x3e')][_0x6f5d('0x41')]));_0x236a71['attributes']=_0x236a71['attributes']['length']?_0x236a71[_0x6f5d('0x42')]:_0x462248['model'];if(_0x2be51b[_0x6f5d('0x3e')][_0x6f5d('0x52')]){_0x236a71[_0x6f5d('0x4d')]=[{'all':!![]}];}_0x236a71=_[_0x6f5d('0x53')]({},_0x236a71,_0x2be51b['options']);return db[_0x6f5d('0x39')][_0x6f5d('0x54')](_0x236a71)[_0x6f5d('0x32')](handleEntityNotFound(_0x5eca1c,null))['then'](respondWithResult(_0x5eca1c,null))['catch'](handleError(_0x5eca1c,null));};exports['create']=function(_0x2cd822,_0x5863b4){return db[_0x6f5d('0x39')][_0x6f5d('0x55')](_0x2cd822[_0x6f5d('0x56')],{})[_0x6f5d('0x32')](respondWithResult(_0x5863b4,0xc9))[_0x6f5d('0x27')](handleError(_0x5863b4,null));};exports[_0x6f5d('0x31')]=function(_0x537397,_0x595c47){if(_0x537397['body']['id']){delete _0x537397[_0x6f5d('0x56')]['id'];}return db[_0x6f5d('0x39')][_0x6f5d('0x54')]({'where':{'id':_0x537397['params']['id']}})[_0x6f5d('0x32')](handleEntityNotFound(_0x595c47,null))[_0x6f5d('0x32')](saveUpdates(_0x537397['body'],null))[_0x6f5d('0x32')](respondWithResult(_0x595c47,null))[_0x6f5d('0x27')](handleError(_0x595c47,null));};exports['destroy']=function(_0x56ce2e,_0x299a62){return db['DeskAccount'][_0x6f5d('0x54')]({'where':{'id':_0x56ce2e[_0x6f5d('0x50')]['id']}})[_0x6f5d('0x32')](handleEntityNotFound(_0x299a62,null))[_0x6f5d('0x32')](removeEntity(_0x299a62,null))[_0x6f5d('0x27')](handleError(_0x299a62,null));};exports[_0x6f5d('0x57')]=function(_0xcad2ab,_0x263a62,_0x54bd45){var _0x473460={};var _0x49de64={};var _0x422c9a;var _0x2566e0;return db[_0x6f5d('0x39')]['findOne']({'where':{'id':_0xcad2ab['params']['id']}})[_0x6f5d('0x32')](handleEntityNotFound(_0x263a62,null))[_0x6f5d('0x32')](function(_0x1cfe1c){if(_0x1cfe1c){_0x422c9a=_0x1cfe1c;_0x49de64[_0x6f5d('0x3d')]=_[_0x6f5d('0x51')](db['DeskConfiguration'][_0x6f5d('0x3a')]);_0x49de64['query']=_[_0x6f5d('0x51')](_0xcad2ab[_0x6f5d('0x3e')]);_0x49de64[_0x6f5d('0x3f')]=_[_0x6f5d('0x40')](_0x49de64[_0x6f5d('0x3d')],_0x49de64[_0x6f5d('0x3e')]);_0x473460[_0x6f5d('0x42')]=_['intersection'](_0x49de64[_0x6f5d('0x3d')],qs[_0x6f5d('0x41')](_0xcad2ab[_0x6f5d('0x3e')][_0x6f5d('0x41')]));_0x473460[_0x6f5d('0x42')]=_0x473460['attributes'][_0x6f5d('0x43')]?_0x473460['attributes']:_0x49de64['model'];_0x473460[_0x6f5d('0x58')]=qs['sort'](_0xcad2ab[_0x6f5d('0x3e')]['sort']);_0x473460[_0x6f5d('0x48')]=qs[_0x6f5d('0x3f')](_['pick'](_0xcad2ab['query'],_0x49de64[_0x6f5d('0x3f')]));if(_0xcad2ab['query']['filter']){_0x473460[_0x6f5d('0x48')]=_[_0x6f5d('0x53')](_0x473460[_0x6f5d('0x48')],{'$or':_[_0x6f5d('0x38')](_0x473460['attributes'],function(_0x232afa){var _0x435031={};_0x435031[_0x232afa]={'$like':'%'+_0xcad2ab[_0x6f5d('0x3e')][_0x6f5d('0x4a')]+'%'};return _0x435031;})});}_0x473460=_[_0x6f5d('0x53')]({},_0x473460,_0xcad2ab[_0x6f5d('0x4c')]);return _0x422c9a[_0x6f5d('0x57')](_0x473460);}})[_0x6f5d('0x32')](function(_0x5687f5){if(_0x5687f5){_0x2566e0=_0x5687f5[_0x6f5d('0x43')];if(!_0xcad2ab[_0x6f5d('0x3e')][_0x6f5d('0x44')](_0x6f5d('0x45'))){_0x473460[_0x6f5d('0x46')]=qs['limit'](_0xcad2ab[_0x6f5d('0x3e')]['limit']);_0x473460[_0x6f5d('0x2c')]=qs[_0x6f5d('0x2c')](_0xcad2ab[_0x6f5d('0x3e')][_0x6f5d('0x2c')]);}return _0x422c9a['getConfigurations'](_0x473460);}})[_0x6f5d('0x32')](function(_0x170885){if(_0x170885){return _0x170885?{'count':_0x2566e0,'rows':_0x170885}:null;}})['then'](respondWithResult(_0x263a62,null))[_0x6f5d('0x27')](handleError(_0x263a62,null));};exports[_0x6f5d('0x59')]=function(_0x17b2e1,_0x39e72a,_0x249eea){if(_0x17b2e1['body']['id']){delete _0x17b2e1[_0x6f5d('0x56')]['id'];}return db[_0x6f5d('0x39')][_0x6f5d('0x5a')]({'where':{'id':_0x17b2e1[_0x6f5d('0x50')]['id']}})[_0x6f5d('0x32')](handleEntityNotFound(_0x39e72a,null))[_0x6f5d('0x32')](function(_0x356ce7){if(_0x356ce7){_0x17b2e1[_0x6f5d('0x56')][_0x6f5d('0x5b')]=_0x356ce7['id'];_0x17b2e1[_0x6f5d('0x56')][_0x6f5d('0x5c')]=integrations[_0x6f5d('0x5d')](_0x17b2e1['body']['channel'],_0x17b2e1[_0x6f5d('0x56')]['type']);_0x17b2e1[_0x6f5d('0x56')][_0x6f5d('0x5e')]=integrations[_0x6f5d('0x5f')](_0x17b2e1[_0x6f5d('0x56')][_0x6f5d('0x60')],_0x17b2e1[_0x6f5d('0x56')][_0x6f5d('0x3c')]);return db[_0x6f5d('0x61')][_0x6f5d('0x55')](_0x17b2e1[_0x6f5d('0x56')],{'include':[{'model':db[_0x6f5d('0x62')],'as':_0x6f5d('0x5c')},{'model':db[_0x6f5d('0x62')],'as':'Descriptions'}]});}return null;})[_0x6f5d('0x32')](respondWithResult(_0x39e72a,null))[_0x6f5d('0x27')](handleError(_0x39e72a,null));};exports[_0x6f5d('0x63')]=function(_0x7dd6be,_0x5815d0,_0x160551){var _0x272ac7=[{'name':_0x6f5d('0x64'),'label':_0x6f5d('0x64'),'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 _0x4c82c5='';return db[_0x6f5d('0x39')][_0x6f5d('0x5a')]({'where':{'id':_0x7dd6be[_0x6f5d('0x50')]['id']},'attributes':['id',_0x6f5d('0x65'),'authType',_0x6f5d('0x66'),_0x6f5d('0x67'),'consumerKey',_0x6f5d('0x68'),_0x6f5d('0x69'),'tokenSecret']})[_0x6f5d('0x32')](handleEntityNotFound(_0x5815d0,null))[_0x6f5d('0x32')](function(_0x4d7f46){if(_0x4d7f46){_0x4c82c5=_0x4d7f46[_0x6f5d('0x65')];var _0x3b96df=_0x4c82c5['slice'](-0x1);if(_0x3b96df==='/'){_0x4c82c5=_0x4c82c5[_0x6f5d('0x6a')](0x0,_0x4c82c5[_0x6f5d('0x6b')](_0x3b96df));}var _0x5b2d1f={'method':'GET','uri':util[_0x6f5d('0x6c')](_0x6f5d('0x6d'),_0x4c82c5),'headers':{'Content-Type':'application/json','Accept':'application/json'},'json':!![]};if(_0x4d7f46[_0x6f5d('0x6e')]==='basic'){_0x5b2d1f[_0x6f5d('0x6f')][_0x6f5d('0x70')]=util[_0x6f5d('0x6c')]('Basic\x20%s',new Buffer(util['format']('%s:%s',_0x4d7f46[_0x6f5d('0x66')],_0x4d7f46[_0x6f5d('0x67')]))[_0x6f5d('0x71')](_0x6f5d('0x72')));}return rp(_0x5b2d1f)['then'](function(_0x46bbf5){return _0x272ac7['concat'](_[_0x6f5d('0x38')](_0x46bbf5[_0x6f5d('0x73')][_0x6f5d('0x74')],function(_0xe0a2d0){return{'id':_0xe0a2d0[_0x6f5d('0x35')],'name':_0xe0a2d0[_0x6f5d('0x35')],'type':_0xe0a2d0[_0x6f5d('0x3c')],'active':_0xe0a2d0[_0x6f5d('0x75')],'label':_0xe0a2d0[_0x6f5d('0x76')],'custom':!![]};}));});}})['then'](function(_0x7e56d7){return{'count':_0x7e56d7[_0x6f5d('0x43')],'rows':_0x7e56d7};})[_0x6f5d('0x32')](respondWithResult(_0x5815d0,null))[_0x6f5d('0x27')](function(_0x121ba7){var _0x5cf129=_0x7dd6be[_0x6f5d('0x3e')]['test']?0x1f4:_0x121ba7[_0x6f5d('0x77')]||0x1f4;logger[_0x6f5d('0x24')](_0x6f5d('0x78'),_0x6f5d('0x63'),_0x5cf129,JSON['stringify'](_0x121ba7));delete _0x121ba7[_0x6f5d('0x35')];if(_0x5cf129===0x191){_0x5cf129=0x190;}_0x5815d0[_0x6f5d('0x28')](_0x5cf129)['send'](_0x7dd6be[_0x6f5d('0x3e')][_0x6f5d('0x1b')]?{'message':_0x6f5d('0x79'),'statusCode':_0x121ba7[_0x6f5d('0x77')]}:_0x121ba7);});}; \ No newline at end of file +var _0x250e=['toString','base64','concat','_embedded','active','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','util','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','jayson/promise','client','http','test','ValidationError','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','destroy','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','DeskAccount','findAll','show','include','create','body','update','params','findOne','DeskConfiguration','fields','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','getFields','priority','remoteUri','authType','username','password','consumerKey','token','tokenSecret','slice','substring','lastIndexOf','application/json','headers','format','Basic\x20%s','%s:%s'];(function(_0x3d2c7f,_0x29bfb1){var _0x3358eb=function(_0x4bb5e7){while(--_0x4bb5e7){_0x3d2c7f['push'](_0x3d2c7f['shift']());}};_0x3358eb(++_0x29bfb1);}(_0x250e,0xf0));var _0xe250=function(_0x2fff50,_0x11ba1f){_0x2fff50=_0x2fff50-0x0;var _0x597a0a=_0x250e[_0x2fff50];return _0x597a0a;};'use strict';var pdf=require(_0xe250('0x0'));var emlformat=require(_0xe250('0x1'));var rimraf=require(_0xe250('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe250('0x3'));var rp=require('request-promise');var moment=require(_0xe250('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe250('0x5'));var util=require(_0xe250('0x6'));var path=require('path');var sox=require(_0xe250('0x7'));var csv=require('to-csv');var ejs=require(_0xe250('0x8'));var fs=require('fs');var _=require(_0xe250('0x9'));var squel=require(_0xe250('0xa'));var crypto=require(_0xe250('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe250('0xc'));var querystring=require(_0xe250('0xd'));var Papa=require(_0xe250('0xe'));var Redis=require(_0xe250('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe250('0x10'));var as=require(_0xe250('0x11'));var hardwareService=require(_0xe250('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xe250('0x13'));var db=require(_0xe250('0x14'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xe250('0x15'));var client=jayson[_0xe250('0x16')][_0xe250('0x17')]({'port':0x232a});function checkPasswordPattern(_0x2da2bb,_0x6543b3,_0x158c49){if(_0x158c49){var _0x3e3b84=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3e3b84[_0xe250('0x18')](_0x6543b3)){return _0x2da2bb;}else{throw new db['Sequelize'][(_0xe250('0x19'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x2da2bb;}}function respondWithRpcPromise(_0x1634d5,_0x4081c7,_0x345e0a,_0x4f72d6){return new BPromise(function(_0x5929e8,_0x18db11){var _0x3ba7bd=_0x4f72d6||client;return _0x3ba7bd['request'](_0x1634d5,_0x345e0a)[_0xe250('0x1a')](function(_0xe4d29d){logger[_0xe250('0x1b')](_0xe250('0x1c'),_0x4081c7,_0xe250('0x1d'));logger['debug'](_0xe250('0x1e'),_0x4081c7,_0xe250('0x1d'),JSON[_0xe250('0x1f')](_0xe4d29d));if(_0xe4d29d[_0xe250('0x20')]){if(_0xe4d29d[_0xe250('0x20')]['code']===0x1f4){logger[_0xe250('0x20')](_0xe250('0x1c'),_0x4081c7,_0xe4d29d[_0xe250('0x20')][_0xe250('0x21')]);return _0x18db11(_0xe4d29d[_0xe250('0x20')][_0xe250('0x21')]);}logger[_0xe250('0x20')](_0xe250('0x1c'),_0x4081c7,_0xe4d29d['error'][_0xe250('0x21')]);return _0x5929e8(_0xe4d29d['error'][_0xe250('0x21')]);}else{logger[_0xe250('0x1b')](_0xe250('0x1c'),_0x4081c7,'request\x20sent');_0x5929e8(_0xe4d29d[_0xe250('0x22')]['message']);}})[_0xe250('0x23')](function(_0x3c3730){logger['error'](_0xe250('0x1c'),_0x4081c7,_0x3c3730);_0x18db11(_0x3c3730);});});}function respondWithStatusCode(_0x4a929d,_0x1f5847){_0x1f5847=_0x1f5847||0xcc;return function(_0x5d8d96){if(_0x5d8d96){return _0x4a929d[_0xe250('0x24')](_0x1f5847);}return _0x4a929d[_0xe250('0x25')](_0x1f5847)[_0xe250('0x26')]();};}function respondWithResult(_0x583c69,_0x4375ce){_0x4375ce=_0x4375ce||0xc8;return function(_0x1e0e09){if(_0x1e0e09){return _0x583c69[_0xe250('0x25')](_0x4375ce)[_0xe250('0x27')](_0x1e0e09);}};}function respondWithFilteredResult(_0xcc0bbc,_0x269149){return function(_0x19cc72){if(_0x19cc72){var _0x3599e5=_0x19cc72[_0xe250('0x28')],_0xf16e01=_0x269149[_0xe250('0x29')],_0x2478a4=_0x269149[_0xe250('0x29')]+_0x269149[_0xe250('0x2a')],_0x36062d;if(_0x2478a4>=_0x3599e5){_0x2478a4=_0x3599e5;_0x36062d=0xc8;}else{_0x36062d=0xce;}_0xcc0bbc[_0xe250('0x25')](_0x36062d);return _0xcc0bbc['set'](_0xe250('0x2b'),_0xf16e01+'-'+_0x2478a4+'/'+_0x3599e5)[_0xe250('0x27')](_0x19cc72);}return null;};}function patchUpdates(_0x3705fc){return function(_0x8ca49d){try{jsonpatch[_0xe250('0x2c')](_0x8ca49d,_0x3705fc,!![]);}catch(_0x56e79c){return BPromise[_0xe250('0x2d')](_0x56e79c);}return _0x8ca49d[_0xe250('0x2e')]();};}function saveUpdates(_0x3e60c6,_0x443a5d){return function(_0x270ab6){if(_0x270ab6){return _0x270ab6['update'](_0x3e60c6)['then'](function(_0x49e227){return _0x49e227;});}return null;};}function removeEntity(_0x249ccd,_0x1c4502){return function(_0x138286){if(_0x138286){return _0x138286[_0xe250('0x2f')]()[_0xe250('0x1a')](function(){_0x249ccd['status'](0xcc)[_0xe250('0x26')]();});}};}function handleEntityNotFound(_0x287fe3,_0x372f04){return function(_0x3866bc){if(!_0x3866bc){_0x287fe3[_0xe250('0x24')](0x194);}return _0x3866bc;};}function handleError(_0x41481b,_0x5995f6){_0x5995f6=_0x5995f6||0x1f4;return function(_0x2d3bc2){logger[_0xe250('0x20')](_0x2d3bc2['stack']);if(_0x2d3bc2[_0xe250('0x30')]){delete _0x2d3bc2[_0xe250('0x30')];}_0x41481b[_0xe250('0x25')](_0x5995f6)[_0xe250('0x31')](_0x2d3bc2);};}exports[_0xe250('0x32')]=function(_0x10b398,_0x5ce272){var _0x39fc4d={},_0x465b13={},_0x31c237={'count':0x0,'rows':[]};var _0x547809=_[_0xe250('0x33')](db['DeskAccount'][_0xe250('0x34')],function(_0x1e141c){return{'name':_0x1e141c[_0xe250('0x35')],'type':_0x1e141c[_0xe250('0x36')]['key']};});_0x465b13['model']=_['map'](_0x547809,_0xe250('0x30'));_0x465b13[_0xe250('0x37')]=_[_0xe250('0x38')](_0x10b398[_0xe250('0x37')]);_0x465b13[_0xe250('0x39')]=_[_0xe250('0x3a')](_0x465b13[_0xe250('0x3b')],_0x465b13[_0xe250('0x37')]);_0x39fc4d[_0xe250('0x3c')]=_[_0xe250('0x3a')](_0x465b13[_0xe250('0x3b')],qs['fields'](_0x10b398['query']['fields']));_0x39fc4d[_0xe250('0x3c')]=_0x39fc4d['attributes'][_0xe250('0x3d')]?_0x39fc4d['attributes']:_0x465b13[_0xe250('0x3b')];if(!_0x10b398[_0xe250('0x37')][_0xe250('0x3e')](_0xe250('0x3f'))){_0x39fc4d['limit']=qs['limit'](_0x10b398['query'][_0xe250('0x2a')]);_0x39fc4d[_0xe250('0x29')]=qs['offset'](_0x10b398[_0xe250('0x37')][_0xe250('0x29')]);}_0x39fc4d[_0xe250('0x40')]=qs[_0xe250('0x41')](_0x10b398[_0xe250('0x37')][_0xe250('0x41')]);_0x39fc4d[_0xe250('0x42')]=qs[_0xe250('0x39')](_[_0xe250('0x43')](_0x10b398['query'],_0x465b13[_0xe250('0x39')]),_0x547809);if(_0x10b398[_0xe250('0x37')][_0xe250('0x44')]){_0x39fc4d[_0xe250('0x42')]=_['merge'](_0x39fc4d[_0xe250('0x42')],{'$or':_[_0xe250('0x33')](_0x547809,function(_0x21390f){if(_0x21390f[_0xe250('0x36')]!==_0xe250('0x45')){var _0x45420a={};_0x45420a[_0x21390f['name']]={'$like':'%'+_0x10b398[_0xe250('0x37')]['filter']+'%'};return _0x45420a;}})});}_0x39fc4d=_[_0xe250('0x46')]({},_0x39fc4d,_0x10b398[_0xe250('0x47')]);var _0x18d825={'where':_0x39fc4d['where']};return db['DeskAccount'][_0xe250('0x28')](_0x18d825)[_0xe250('0x1a')](function(_0x3cbc59){_0x31c237[_0xe250('0x28')]=_0x3cbc59;if(_0x10b398[_0xe250('0x37')][_0xe250('0x48')]){_0x39fc4d['include']=[{'all':!![]}];}return db[_0xe250('0x49')][_0xe250('0x4a')](_0x39fc4d);})['then'](function(_0x12d8b8){_0x31c237['rows']=_0x12d8b8;return _0x31c237;})['then'](respondWithFilteredResult(_0x5ce272,_0x39fc4d))['catch'](handleError(_0x5ce272,null));};exports[_0xe250('0x4b')]=function(_0x1e1281,_0x269715){var _0x40b391={'raw':![],'where':{'id':_0x1e1281['params']['id']}},_0x471f0f={};_0x471f0f[_0xe250('0x3b')]=_[_0xe250('0x38')](db[_0xe250('0x49')]['rawAttributes']);_0x471f0f[_0xe250('0x37')]=_[_0xe250('0x38')](_0x1e1281['query']);_0x471f0f[_0xe250('0x39')]=_[_0xe250('0x3a')](_0x471f0f[_0xe250('0x3b')],_0x471f0f[_0xe250('0x37')]);_0x40b391[_0xe250('0x3c')]=_[_0xe250('0x3a')](_0x471f0f[_0xe250('0x3b')],qs['fields'](_0x1e1281[_0xe250('0x37')]['fields']));_0x40b391['attributes']=_0x40b391[_0xe250('0x3c')][_0xe250('0x3d')]?_0x40b391[_0xe250('0x3c')]:_0x471f0f[_0xe250('0x3b')];if(_0x1e1281[_0xe250('0x37')]['includeAll']){_0x40b391[_0xe250('0x4c')]=[{'all':!![]}];}_0x40b391=_[_0xe250('0x46')]({},_0x40b391,_0x1e1281[_0xe250('0x47')]);return db[_0xe250('0x49')]['find'](_0x40b391)[_0xe250('0x1a')](handleEntityNotFound(_0x269715,null))['then'](respondWithResult(_0x269715,null))[_0xe250('0x23')](handleError(_0x269715,null));};exports['create']=function(_0x4f897c,_0x4fcc5c){return db[_0xe250('0x49')][_0xe250('0x4d')](_0x4f897c[_0xe250('0x4e')],{})[_0xe250('0x1a')](respondWithResult(_0x4fcc5c,0xc9))[_0xe250('0x23')](handleError(_0x4fcc5c,null));};exports[_0xe250('0x4f')]=function(_0x39b578,_0x5e34f0){if(_0x39b578[_0xe250('0x4e')]['id']){delete _0x39b578[_0xe250('0x4e')]['id'];}return db[_0xe250('0x49')]['find']({'where':{'id':_0x39b578[_0xe250('0x50')]['id']}})[_0xe250('0x1a')](handleEntityNotFound(_0x5e34f0,null))[_0xe250('0x1a')](saveUpdates(_0x39b578['body'],null))[_0xe250('0x1a')](respondWithResult(_0x5e34f0,null))['catch'](handleError(_0x5e34f0,null));};exports[_0xe250('0x2f')]=function(_0xb6ecf4,_0x1c3331){return db[_0xe250('0x49')]['find']({'where':{'id':_0xb6ecf4['params']['id']}})['then'](handleEntityNotFound(_0x1c3331,null))[_0xe250('0x1a')](removeEntity(_0x1c3331,null))[_0xe250('0x23')](handleError(_0x1c3331,null));};exports['getConfigurations']=function(_0x299cbf,_0x2a319f,_0x39bd4a){var _0x3b7934={};var _0x38d1f1={};var _0x4b41e0;var _0x312a9a;return db['DeskAccount'][_0xe250('0x51')]({'where':{'id':_0x299cbf[_0xe250('0x50')]['id']}})['then'](handleEntityNotFound(_0x2a319f,null))['then'](function(_0x4fad14){if(_0x4fad14){_0x4b41e0=_0x4fad14;_0x38d1f1[_0xe250('0x3b')]=_[_0xe250('0x38')](db[_0xe250('0x52')][_0xe250('0x34')]);_0x38d1f1[_0xe250('0x37')]=_[_0xe250('0x38')](_0x299cbf[_0xe250('0x37')]);_0x38d1f1['filters']=_[_0xe250('0x3a')](_0x38d1f1[_0xe250('0x3b')],_0x38d1f1[_0xe250('0x37')]);_0x3b7934['attributes']=_[_0xe250('0x3a')](_0x38d1f1[_0xe250('0x3b')],qs[_0xe250('0x53')](_0x299cbf[_0xe250('0x37')][_0xe250('0x53')]));_0x3b7934[_0xe250('0x3c')]=_0x3b7934[_0xe250('0x3c')][_0xe250('0x3d')]?_0x3b7934['attributes']:_0x38d1f1[_0xe250('0x3b')];_0x3b7934[_0xe250('0x40')]=qs[_0xe250('0x41')](_0x299cbf[_0xe250('0x37')]['sort']);_0x3b7934[_0xe250('0x42')]=qs[_0xe250('0x39')](_['pick'](_0x299cbf[_0xe250('0x37')],_0x38d1f1[_0xe250('0x39')]));if(_0x299cbf[_0xe250('0x37')]['filter']){_0x3b7934[_0xe250('0x42')]=_[_0xe250('0x46')](_0x3b7934[_0xe250('0x42')],{'$or':_[_0xe250('0x33')](_0x3b7934[_0xe250('0x3c')],function(_0x30326f){var _0x5cae3f={};_0x5cae3f[_0x30326f]={'$like':'%'+_0x299cbf['query'][_0xe250('0x44')]+'%'};return _0x5cae3f;})});}_0x3b7934=_[_0xe250('0x46')]({},_0x3b7934,_0x299cbf[_0xe250('0x47')]);return _0x4b41e0['getConfigurations'](_0x3b7934);}})[_0xe250('0x1a')](function(_0xa1b57b){if(_0xa1b57b){_0x312a9a=_0xa1b57b[_0xe250('0x3d')];if(!_0x299cbf['query']['hasOwnProperty'](_0xe250('0x3f'))){_0x3b7934[_0xe250('0x2a')]=qs['limit'](_0x299cbf[_0xe250('0x37')][_0xe250('0x2a')]);_0x3b7934[_0xe250('0x29')]=qs[_0xe250('0x29')](_0x299cbf[_0xe250('0x37')][_0xe250('0x29')]);}return _0x4b41e0['getConfigurations'](_0x3b7934);}})[_0xe250('0x1a')](function(_0x35cb6a){if(_0x35cb6a){return _0x35cb6a?{'count':_0x312a9a,'rows':_0x35cb6a}:null;}})[_0xe250('0x1a')](respondWithResult(_0x2a319f,null))[_0xe250('0x23')](handleError(_0x2a319f,null));};exports[_0xe250('0x54')]=function(_0x43d6bd,_0x2316f9,_0x1f5fa9){if(_0x43d6bd[_0xe250('0x4e')]['id']){delete _0x43d6bd[_0xe250('0x4e')]['id'];}return db[_0xe250('0x49')][_0xe250('0x51')]({'where':{'id':_0x43d6bd[_0xe250('0x50')]['id']}})[_0xe250('0x1a')](handleEntityNotFound(_0x2316f9,null))['then'](function(_0x107eb6){if(_0x107eb6){_0x43d6bd[_0xe250('0x4e')][_0xe250('0x55')]=_0x107eb6['id'];_0x43d6bd[_0xe250('0x4e')][_0xe250('0x56')]=integrations[_0xe250('0x57')](_0x43d6bd[_0xe250('0x4e')][_0xe250('0x58')],_0x43d6bd['body'][_0xe250('0x36')]);_0x43d6bd[_0xe250('0x4e')][_0xe250('0x59')]=integrations[_0xe250('0x5a')](_0x43d6bd[_0xe250('0x4e')]['channel'],_0x43d6bd['body'][_0xe250('0x36')]);return db[_0xe250('0x52')]['create'](_0x43d6bd['body'],{'include':[{'model':db['DeskField'],'as':_0xe250('0x56')},{'model':db['DeskField'],'as':_0xe250('0x59')}]});}return null;})[_0xe250('0x1a')](respondWithResult(_0x2316f9,null))[_0xe250('0x23')](handleError(_0x2316f9,null));};exports[_0xe250('0x5b')]=function(_0x50a5df,_0x306d9c,_0x5e23df){var _0x3f2d40=[{'name':'priority','label':_0xe250('0x5c'),'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 _0x38a97d='';return db[_0xe250('0x49')]['findOne']({'where':{'id':_0x50a5df['params']['id']},'attributes':['id',_0xe250('0x5d'),_0xe250('0x5e'),_0xe250('0x5f'),_0xe250('0x60'),_0xe250('0x61'),'consumerSecret',_0xe250('0x62'),_0xe250('0x63')]})[_0xe250('0x1a')](handleEntityNotFound(_0x306d9c,null))[_0xe250('0x1a')](function(_0x2dca74){if(_0x2dca74){_0x38a97d=_0x2dca74['remoteUri'];var _0x354b0c=_0x38a97d[_0xe250('0x64')](-0x1);if(_0x354b0c==='/'){_0x38a97d=_0x38a97d[_0xe250('0x65')](0x0,_0x38a97d[_0xe250('0x66')](_0x354b0c));}var _0x4bc201={'method':'GET','uri':util['format']('%s/custom_fields',_0x38a97d),'headers':{'Content-Type':_0xe250('0x67'),'Accept':_0xe250('0x67')},'json':!![]};if(_0x2dca74['authType']==='basic'){_0x4bc201[_0xe250('0x68')]['Authorization']=util[_0xe250('0x69')](_0xe250('0x6a'),new Buffer(util['format'](_0xe250('0x6b'),_0x2dca74[_0xe250('0x5f')],_0x2dca74[_0xe250('0x60')]))[_0xe250('0x6c')](_0xe250('0x6d')));}return rp(_0x4bc201)[_0xe250('0x1a')](function(_0x270631){return _0x3f2d40[_0xe250('0x6e')](_[_0xe250('0x33')](_0x270631[_0xe250('0x6f')]['entries'],function(_0xb0764c){return{'id':_0xb0764c[_0xe250('0x30')],'name':_0xb0764c[_0xe250('0x30')],'type':_0xb0764c[_0xe250('0x36')],'active':_0xb0764c[_0xe250('0x70')],'label':_0xb0764c['label'],'custom':!![]};}));});}})[_0xe250('0x1a')](function(_0x48edc4){return{'count':_0x48edc4['length'],'rows':_0x48edc4};})[_0xe250('0x1a')](respondWithResult(_0x306d9c,null))[_0xe250('0x23')](function(_0x4bf4fb){var _0x3f276e=_0x50a5df[_0xe250('0x37')]['test']?0x1f4:_0x4bf4fb[_0xe250('0x71')]||0x1f4;logger[_0xe250('0x20')](_0xe250('0x72'),_0xe250('0x5b'),_0x3f276e,JSON[_0xe250('0x1f')](_0x4bf4fb));delete _0x4bf4fb[_0xe250('0x30')];if(_0x3f276e===0x191){_0x3f276e=0x190;}_0x306d9c[_0xe250('0x25')](_0x3f276e)[_0xe250('0x31')](_0x50a5df[_0xe250('0x37')][_0xe250('0x18')]?{'message':_0xe250('0x73'),'statusCode':_0x4bf4fb[_0xe250('0x71')]}:_0x4bf4fb);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 65e9b94..e859377 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 _0x738d=['api','bluebird','request-promise','path','rimraf','../../components/integrations/configuration','exports','DeskAccount','lodash','../../config/logger'];(function(_0x20a88e,_0x389e6d){var _0x579f34=function(_0x197cc4){while(--_0x197cc4){_0x20a88e['push'](_0x20a88e['shift']());}};_0x579f34(++_0x389e6d);}(_0x738d,0x9e));var _0xd738=function(_0x52c0ad,_0x566464){_0x52c0ad=_0x52c0ad-0x0;var _0x1d6a79=_0x738d[_0x52c0ad];return _0x1d6a79;};'use strict';var _=require(_0xd738('0x0'));var util=require('util');var logger=require(_0xd738('0x1'))(_0xd738('0x2'));var moment=require('moment');var BPromise=require(_0xd738('0x3'));var rp=require(_0xd738('0x4'));var fs=require('fs');var path=require(_0xd738('0x5'));var rimraf=require(_0xd738('0x6'));var config=require('../../config/environment');var attributes=require('./intDeskAccount.attributes');var integrations=require(_0xd738('0x7'));module[_0xd738('0x8')]=function(_0x441ed7,_0x335b9d){return _0x441ed7['define'](_0xd738('0x9'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x40f8=['../../components/integrations/configuration','exports','define','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes'];(function(_0xf22490,_0x427c8e){var _0x5a2241=function(_0x853c48){while(--_0x853c48){_0xf22490['push'](_0xf22490['shift']());}};_0x5a2241(++_0x427c8e);}(_0x40f8,0xab));var _0x840f=function(_0x17c192,_0x4e792e){_0x17c192=_0x17c192-0x0;var _0x44a167=_0x40f8[_0x17c192];return _0x44a167;};'use strict';var _=require(_0x840f('0x0'));var util=require('util');var logger=require(_0x840f('0x1'))(_0x840f('0x2'));var moment=require(_0x840f('0x3'));var BPromise=require('bluebird');var rp=require(_0x840f('0x4'));var fs=require('fs');var path=require(_0x840f('0x5'));var rimraf=require(_0x840f('0x6'));var config=require(_0x840f('0x7'));var attributes=require(_0x840f('0x8'));var integrations=require(_0x840f('0x9'));module[_0x840f('0xa')]=function(_0x354da8,_0x314dee){return _0x354da8[_0x840f('0xb')]('DeskAccount',attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index ef7bac1..d00c7a2 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 _0x9bd9=['find','raw','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetDeskAccount','DeskAccount','findAll','options','where','attributes','limit','map','model','include','then','ShowDeskAccount'];(function(_0xf7058b,_0x22c9b7){var _0x24cbf0=function(_0x2997ac){while(--_0x2997ac){_0xf7058b['push'](_0xf7058b['shift']());}};_0x24cbf0(++_0x22c9b7);}(_0x9bd9,0x92));var _0x99bd=function(_0x407a3e,_0x15acb0){_0x407a3e=_0x407a3e-0x0;var _0x129fe3=_0x9bd9[_0x407a3e];return _0x129fe3;};'use strict';var _=require('lodash');var util=require(_0x99bd('0x0'));var moment=require(_0x99bd('0x1'));var BPromise=require('bluebird');var rs=require(_0x99bd('0x2'));var fs=require('fs');var Redis=require(_0x99bd('0x3'));var db=require(_0x99bd('0x4'))['db'];var utils=require(_0x99bd('0x5'));var logger=require('../../config/logger')(_0x99bd('0x6'));var config=require(_0x99bd('0x7'));var jayson=require(_0x99bd('0x8'));var client=jayson[_0x99bd('0x9')][_0x99bd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x166af9,_0x41bdff,_0x4add39){return new BPromise(function(_0x519656,_0x1075b){return client[_0x99bd('0xb')](_0x166af9,_0x4add39)['then'](function(_0x1dc954){logger['info'](_0x99bd('0xc'),_0x41bdff,_0x99bd('0xd'));logger[_0x99bd('0xe')](_0x99bd('0xf'),_0x41bdff,_0x99bd('0xd'),JSON[_0x99bd('0x10')](_0x1dc954));if(_0x1dc954['error']){if(_0x1dc954[_0x99bd('0x11')]['code']===0x1f4){logger['error'](_0x99bd('0xc'),_0x41bdff,_0x1dc954[_0x99bd('0x11')][_0x99bd('0x12')]);return _0x1075b(_0x1dc954['error'][_0x99bd('0x12')]);}logger[_0x99bd('0x11')]('DeskAccount,\x20%s,\x20%s',_0x41bdff,_0x1dc954['error'][_0x99bd('0x12')]);return _0x519656(_0x1dc954[_0x99bd('0x11')]['message']);}else{logger[_0x99bd('0x13')](_0x99bd('0xc'),_0x41bdff,_0x99bd('0xd'));_0x519656(_0x1dc954[_0x99bd('0x14')][_0x99bd('0x12')]);}})[_0x99bd('0x15')](function(_0x3ecaf8){logger[_0x99bd('0x11')]('DeskAccount,\x20%s,\x20%s',_0x41bdff,_0x3ecaf8);_0x1075b(_0x3ecaf8);});});}exports[_0x99bd('0x16')]=function(_0x28c36a){var _0x380080=this;return new Promise(function(_0x10ddc4,_0x5912c2){return db[_0x99bd('0x17')][_0x99bd('0x18')]({'raw':_0x28c36a[_0x99bd('0x19')]?_0x28c36a[_0x99bd('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x28c36a[_0x99bd('0x19')]?_0x28c36a[_0x99bd('0x19')][_0x99bd('0x1a')]||null:null,'attributes':_0x28c36a[_0x99bd('0x19')]?_0x28c36a[_0x99bd('0x19')][_0x99bd('0x1b')]||null:null,'limit':_0x28c36a['options']?_0x28c36a[_0x99bd('0x19')][_0x99bd('0x1c')]||null:null,'include':_0x28c36a['options']?_0x28c36a[_0x99bd('0x19')]['include']?_[_0x99bd('0x1d')](_0x28c36a[_0x99bd('0x19')]['include'],function(_0x597779){return{'model':db[_0x597779[_0x99bd('0x1e')]],'as':_0x597779['as'],'attributes':_0x597779[_0x99bd('0x1b')],'include':_0x597779[_0x99bd('0x1f')]?_[_0x99bd('0x1d')](_0x597779['include'],function(_0x18a7c2){return{'model':db[_0x18a7c2[_0x99bd('0x1e')]],'as':_0x18a7c2['as'],'attributes':_0x18a7c2[_0x99bd('0x1b')],'include':_0x18a7c2[_0x99bd('0x1f')]?_[_0x99bd('0x1d')](_0x18a7c2[_0x99bd('0x1f')],function(_0x580ec5){return{'model':db[_0x580ec5['model']],'as':_0x580ec5['as'],'attributes':_0x580ec5[_0x99bd('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x99bd('0x20')](function(_0x1f5538){logger[_0x99bd('0x13')](_0x99bd('0x16'),_0x28c36a);logger[_0x99bd('0xe')](_0x99bd('0x16'),_0x28c36a,JSON['stringify'](_0x1f5538));_0x10ddc4(_0x1f5538);})[_0x99bd('0x15')](function(_0xb2e95c){logger[_0x99bd('0x11')](_0x99bd('0x16'),_0xb2e95c['message'],_0x28c36a);_0x5912c2(_0x380080[_0x99bd('0x11')](0x1f4,_0xb2e95c['message']));});});};exports[_0x99bd('0x21')]=function(_0x1c5da7){var _0x455049=this;return new Promise(function(_0x149666,_0x1c0a7c){return db[_0x99bd('0x17')][_0x99bd('0x22')]({'raw':_0x1c5da7[_0x99bd('0x19')]?_0x1c5da7[_0x99bd('0x19')][_0x99bd('0x23')]===undefined?!![]:![]:!![],'where':_0x1c5da7[_0x99bd('0x19')]?_0x1c5da7[_0x99bd('0x19')][_0x99bd('0x1a')]||null:null,'attributes':_0x1c5da7[_0x99bd('0x19')]?_0x1c5da7[_0x99bd('0x19')]['attributes']||null:null,'include':_0x1c5da7[_0x99bd('0x19')]?_0x1c5da7[_0x99bd('0x19')]['include']?_[_0x99bd('0x1d')](_0x1c5da7[_0x99bd('0x19')]['include'],function(_0x8532b2){return{'model':db[_0x8532b2[_0x99bd('0x1e')]],'as':_0x8532b2['as'],'attributes':_0x8532b2[_0x99bd('0x1b')],'include':_0x8532b2['include']?_[_0x99bd('0x1d')](_0x8532b2[_0x99bd('0x1f')],function(_0x592d1b){return{'model':db[_0x592d1b['model']],'as':_0x592d1b['as'],'attributes':_0x592d1b[_0x99bd('0x1b')],'include':_0x592d1b[_0x99bd('0x1f')]?_[_0x99bd('0x1d')](_0x592d1b[_0x99bd('0x1f')],function(_0x466475){return{'model':db[_0x466475[_0x99bd('0x1e')]],'as':_0x466475['as'],'attributes':_0x466475['attributes']};}):[]};}):[]};}):[]:[]})[_0x99bd('0x20')](function(_0x199dea){logger[_0x99bd('0x13')](_0x99bd('0x21'),_0x1c5da7);logger[_0x99bd('0xe')](_0x99bd('0x21'),_0x1c5da7,JSON[_0x99bd('0x10')](_0x199dea));_0x149666(_0x199dea);})[_0x99bd('0x15')](function(_0x5468cc){logger[_0x99bd('0x11')]('ShowDeskAccount',_0x5468cc[_0x99bd('0x12')],_0x1c5da7);_0x1c0a7c(_0x455049[_0x99bd('0x11')](0x1f4,_0x5468cc[_0x99bd('0x12')]));});});}; \ No newline at end of file +var _0x257d=['attributes','limit','include','model','map','ShowDeskAccount','DeskAccount','find','raw','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDeskAccount','findAll','options','where'];(function(_0x5bff9c,_0x16d3f0){var _0x1d584b=function(_0x4ea633){while(--_0x4ea633){_0x5bff9c['push'](_0x5bff9c['shift']());}};_0x1d584b(++_0x16d3f0);}(_0x257d,0x113));var _0xd257=function(_0x715691,_0x48a466){_0x715691=_0x715691-0x0;var _0x27743e=_0x257d[_0x715691];return _0x27743e;};'use strict';var _=require(_0xd257('0x0'));var util=require(_0xd257('0x1'));var moment=require(_0xd257('0x2'));var BPromise=require('bluebird');var rs=require(_0xd257('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd257('0x4'))['db'];var utils=require(_0xd257('0x5'));var logger=require(_0xd257('0x6'))(_0xd257('0x7'));var config=require(_0xd257('0x8'));var jayson=require(_0xd257('0x9'));var client=jayson[_0xd257('0xa')][_0xd257('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54ecdb,_0x110eaf,_0x367374){return new BPromise(function(_0xf43c12,_0x517ef6){return client[_0xd257('0xc')](_0x54ecdb,_0x367374)[_0xd257('0xd')](function(_0x367e24){logger[_0xd257('0xe')](_0xd257('0xf'),_0x110eaf,_0xd257('0x10'));logger[_0xd257('0x11')](_0xd257('0x12'),_0x110eaf,_0xd257('0x10'),JSON[_0xd257('0x13')](_0x367e24));if(_0x367e24[_0xd257('0x14')]){if(_0x367e24['error'][_0xd257('0x15')]===0x1f4){logger[_0xd257('0x14')](_0xd257('0xf'),_0x110eaf,_0x367e24[_0xd257('0x14')][_0xd257('0x16')]);return _0x517ef6(_0x367e24[_0xd257('0x14')]['message']);}logger[_0xd257('0x14')](_0xd257('0xf'),_0x110eaf,_0x367e24['error']['message']);return _0xf43c12(_0x367e24[_0xd257('0x14')][_0xd257('0x16')]);}else{logger[_0xd257('0xe')]('DeskAccount,\x20%s,\x20%s',_0x110eaf,'request\x20sent');_0xf43c12(_0x367e24[_0xd257('0x17')][_0xd257('0x16')]);}})[_0xd257('0x18')](function(_0x3ee052){logger['error'](_0xd257('0xf'),_0x110eaf,_0x3ee052);_0x517ef6(_0x3ee052);});});}exports[_0xd257('0x19')]=function(_0x47b0ee){var _0x5de212=this;return new Promise(function(_0x29b7d2,_0x29b4d4){return db['DeskAccount'][_0xd257('0x1a')]({'raw':_0x47b0ee[_0xd257('0x1b')]?_0x47b0ee['options']['raw']===undefined?!![]:![]:!![],'where':_0x47b0ee[_0xd257('0x1b')]?_0x47b0ee[_0xd257('0x1b')][_0xd257('0x1c')]||null:null,'attributes':_0x47b0ee['options']?_0x47b0ee[_0xd257('0x1b')][_0xd257('0x1d')]||null:null,'limit':_0x47b0ee[_0xd257('0x1b')]?_0x47b0ee['options'][_0xd257('0x1e')]||null:null,'include':_0x47b0ee[_0xd257('0x1b')]?_0x47b0ee['options'][_0xd257('0x1f')]?_['map'](_0x47b0ee[_0xd257('0x1b')][_0xd257('0x1f')],function(_0x50eee5){return{'model':db[_0x50eee5[_0xd257('0x20')]],'as':_0x50eee5['as'],'attributes':_0x50eee5[_0xd257('0x1d')],'include':_0x50eee5[_0xd257('0x1f')]?_[_0xd257('0x21')](_0x50eee5['include'],function(_0x5cd0a2){return{'model':db[_0x5cd0a2[_0xd257('0x20')]],'as':_0x5cd0a2['as'],'attributes':_0x5cd0a2[_0xd257('0x1d')],'include':_0x5cd0a2[_0xd257('0x1f')]?_[_0xd257('0x21')](_0x5cd0a2[_0xd257('0x1f')],function(_0x1c9a01){return{'model':db[_0x1c9a01[_0xd257('0x20')]],'as':_0x1c9a01['as'],'attributes':_0x1c9a01[_0xd257('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd257('0xd')](function(_0x2608b0){logger[_0xd257('0xe')](_0xd257('0x19'),_0x47b0ee);logger[_0xd257('0x11')](_0xd257('0x19'),_0x47b0ee,JSON[_0xd257('0x13')](_0x2608b0));_0x29b7d2(_0x2608b0);})[_0xd257('0x18')](function(_0x49e619){logger[_0xd257('0x14')]('GetDeskAccount',_0x49e619[_0xd257('0x16')],_0x47b0ee);_0x29b4d4(_0x5de212[_0xd257('0x14')](0x1f4,_0x49e619[_0xd257('0x16')]));});});};exports[_0xd257('0x22')]=function(_0x22b104){var _0x4e61ba=this;return new Promise(function(_0x1294f4,_0x5a39e2){return db[_0xd257('0x23')][_0xd257('0x24')]({'raw':_0x22b104['options']?_0x22b104['options'][_0xd257('0x25')]===undefined?!![]:![]:!![],'where':_0x22b104[_0xd257('0x1b')]?_0x22b104[_0xd257('0x1b')][_0xd257('0x1c')]||null:null,'attributes':_0x22b104[_0xd257('0x1b')]?_0x22b104['options'][_0xd257('0x1d')]||null:null,'include':_0x22b104[_0xd257('0x1b')]?_0x22b104[_0xd257('0x1b')][_0xd257('0x1f')]?_[_0xd257('0x21')](_0x22b104[_0xd257('0x1b')][_0xd257('0x1f')],function(_0x23890e){return{'model':db[_0x23890e[_0xd257('0x20')]],'as':_0x23890e['as'],'attributes':_0x23890e[_0xd257('0x1d')],'include':_0x23890e[_0xd257('0x1f')]?_[_0xd257('0x21')](_0x23890e[_0xd257('0x1f')],function(_0x3cd016){return{'model':db[_0x3cd016[_0xd257('0x20')]],'as':_0x3cd016['as'],'attributes':_0x3cd016[_0xd257('0x1d')],'include':_0x3cd016[_0xd257('0x1f')]?_[_0xd257('0x21')](_0x3cd016[_0xd257('0x1f')],function(_0xc4519){return{'model':db[_0xc4519[_0xd257('0x20')]],'as':_0xc4519['as'],'attributes':_0xc4519[_0xd257('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd257('0xd')](function(_0x143e2e){logger[_0xd257('0xe')](_0xd257('0x22'),_0x22b104);logger[_0xd257('0x11')](_0xd257('0x22'),_0x22b104,JSON[_0xd257('0x13')](_0x143e2e));_0x1294f4(_0x143e2e);})['catch'](function(_0x479cab){logger[_0xd257('0x14')](_0xd257('0x22'),_0x479cab[_0xd257('0x16')],_0x22b104);_0x5a39e2(_0x4e61ba['error'](0x1f4,_0x479cab[_0xd257('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index c68b328..9e4b1a0 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 _0x5d4e=['getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','/:id','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','isAuthenticated','show','get','/:id/fields'];(function(_0x404d3e,_0x1027db){var _0x3a3acd=function(_0x3d07b3){while(--_0x3d07b3){_0x404d3e['push'](_0x404d3e['shift']());}};_0x3a3acd(++_0x1027db);}(_0x5d4e,0x138));var _0xe5d4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5d4e[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0xe5d4('0x0'));var path=require(_0xe5d4('0x1'));var timeout=require(_0xe5d4('0x2'));var express=require(_0xe5d4('0x3'));var router=express[_0xe5d4('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xe5d4('0x5'));var config=require(_0xe5d4('0x6'));var controller=require(_0xe5d4('0x7'));router['get']('/',auth[_0xe5d4('0x8')](),controller['index']);router['get']('/:id',auth[_0xe5d4('0x8')](),controller[_0xe5d4('0x9')]);router[_0xe5d4('0xa')](_0xe5d4('0xb'),auth[_0xe5d4('0x8')](),controller[_0xe5d4('0xc')]);router[_0xe5d4('0xa')](_0xe5d4('0xd'),auth[_0xe5d4('0x8')](),controller[_0xe5d4('0xe')]);router[_0xe5d4('0xa')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xe5d4('0xf')]);router[_0xe5d4('0xa')](_0xe5d4('0x10'),auth[_0xe5d4('0x8')](),controller[_0xe5d4('0x11')]);router[_0xe5d4('0x12')]('/',auth[_0xe5d4('0x8')](),controller[_0xe5d4('0x13')]);router[_0xe5d4('0x12')]('/:id/tags',auth['isAuthenticated'](),controller[_0xe5d4('0x14')]);router[_0xe5d4('0x15')]('/:id',auth[_0xe5d4('0x8')](),controller[_0xe5d4('0x16')]);router[_0xe5d4('0x17')](_0xe5d4('0x18'),auth[_0xe5d4('0x8')](),controller[_0xe5d4('0x19')]);module[_0xe5d4('0x1a')]=router; \ No newline at end of file +var _0xf470=['/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects'];(function(_0x4d7065,_0x4279f5){var _0x5d30cb=function(_0x2c4af9){while(--_0x2c4af9){_0x4d7065['push'](_0x4d7065['shift']());}};_0x5d30cb(++_0x4279f5);}(_0xf470,0xfd));var _0x0f47=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0xf470[_0x231e16];return _0x570a7c;};'use strict';var multer=require(_0x0f47('0x0'));var util=require(_0x0f47('0x1'));var path=require(_0x0f47('0x2'));var timeout=require(_0x0f47('0x3'));var express=require(_0x0f47('0x4'));var router=express[_0x0f47('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x0f47('0x6'));var config=require(_0x0f47('0x7'));var controller=require('./intDeskConfiguration.controller');router[_0x0f47('0x8')]('/',auth[_0x0f47('0x9')](),controller[_0x0f47('0xa')]);router[_0x0f47('0x8')](_0x0f47('0xb'),auth[_0x0f47('0x9')](),controller[_0x0f47('0xc')]);router[_0x0f47('0x8')](_0x0f47('0xd'),auth[_0x0f47('0x9')](),controller[_0x0f47('0xe')]);router[_0x0f47('0x8')](_0x0f47('0xf'),auth[_0x0f47('0x9')](),controller[_0x0f47('0x10')]);router[_0x0f47('0x8')](_0x0f47('0x11'),auth[_0x0f47('0x9')](),controller[_0x0f47('0x12')]);router['get'](_0x0f47('0x13'),auth[_0x0f47('0x9')](),controller[_0x0f47('0x14')]);router[_0x0f47('0x15')]('/',auth[_0x0f47('0x9')](),controller['create']);router['post'](_0x0f47('0x13'),auth[_0x0f47('0x9')](),controller[_0x0f47('0x16')]);router[_0x0f47('0x17')](_0x0f47('0xb'),auth['isAuthenticated'](),controller[_0x0f47('0x18')]);router['delete']('/:id',auth[_0x0f47('0x9')](),controller[_0x0f47('0x19')]);module[_0x0f47('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 609dd54..035617a 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 _0x657f=['exports','STRING'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x657f,0x94));var _0xf657=function(_0x54da5b,_0x12fd71){_0x54da5b=_0x54da5b-0x0;var _0x285d3b=_0x657f[_0x54da5b];return _0x285d3b;};'use strict';var Sequelize=require('sequelize');module[_0xf657('0x0')]={'name':{'type':Sequelize[_0xf657('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbcad=['exports','sequelize'];(function(_0xedad88,_0x198763){var _0x222222=function(_0x123ac0){while(--_0x123ac0){_0xedad88['push'](_0xedad88['shift']());}};_0x222222(++_0x198763);}(_0xbcad,0x1b9));var _0xdbca=function(_0x284f98,_0x303091){_0x284f98=_0x284f98-0x0;var _0x4ba48d=_0xbcad[_0x284f98];return _0x4ba48d;};'use strict';var Sequelize=require(_0xdbca('0x0'));module[_0xdbca('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index c9a09f1..189aa98 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 _0x899a=['offset','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','DeskConfiguration','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','rawAttributes','create','body','find','findOne','DeskField','order','getFields','hasOwnProperty','getSubjects','getDescriptions','Tag','getTags','setTags','ids','html-pdf','eml-format','zip-dir','fast-json-patch','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','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','sendStatus','status','end','json','count'];(function(_0x1e09a1,_0x1c14f9){var _0x24ac77=function(_0x272fa1){while(--_0x272fa1){_0x1e09a1['push'](_0x1e09a1['shift']());}};_0x24ac77(++_0x1c14f9);}(_0x899a,0x1b6));var _0xa899=function(_0x2db2f5,_0x2dafa1){_0x2db2f5=_0x2db2f5-0x0;var _0x48cb99=_0x899a[_0x2db2f5];return _0x48cb99;};'use strict';var pdf=require(_0xa899('0x0'));var emlformat=require(_0xa899('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa899('0x2'));var jsonpatch=require(_0xa899('0x3'));var rp=require('request-promise');var moment=require(_0xa899('0x4'));var BPromise=require(_0xa899('0x5'));var Mustache=require(_0xa899('0x6'));var util=require(_0xa899('0x7'));var path=require('path');var sox=require(_0xa899('0x8'));var csv=require(_0xa899('0x9'));var ejs=require(_0xa899('0xa'));var fs=require('fs');var _=require(_0xa899('0xb'));var squel=require('squel');var crypto=require(_0xa899('0xc'));var jsforce=require(_0xa899('0xd'));var deskjs=require(_0xa899('0xe'));var toCsv=require(_0xa899('0x9'));var querystring=require(_0xa899('0xf'));var Papa=require(_0xa899('0x10'));var Redis=require(_0xa899('0x11'));var authService=require(_0xa899('0x12'));var qs=require(_0xa899('0x13'));var as=require(_0xa899('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa899('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0xa899('0x16'));var client=jayson[_0xa899('0x17')][_0xa899('0x18')]({'port':0x232a});function checkPasswordPattern(_0x52b4ac,_0x19a08c,_0x198c32){if(_0x198c32){var _0x56d838=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x56d838[_0xa899('0x19')](_0x19a08c)){return _0x52b4ac;}else{throw new db[(_0xa899('0x1a'))][(_0xa899('0x1b'))](_0xa899('0x1c'));}}else{return _0x52b4ac;}}function respondWithRpcPromise(_0x5cb055,_0x7a13b2,_0x205601,_0x4c08cc){return new BPromise(function(_0xf809a7,_0x252611){var _0x152d42=_0x4c08cc||client;return _0x152d42['request'](_0x5cb055,_0x205601)['then'](function(_0x72e6b7){logger[_0xa899('0x1d')](_0xa899('0x1e'),_0x7a13b2,_0xa899('0x1f'));logger[_0xa899('0x20')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x7a13b2,_0xa899('0x1f'),JSON['stringify'](_0x72e6b7));if(_0x72e6b7[_0xa899('0x21')]){if(_0x72e6b7[_0xa899('0x21')]['code']===0x1f4){logger[_0xa899('0x21')](_0xa899('0x1e'),_0x7a13b2,_0x72e6b7[_0xa899('0x21')][_0xa899('0x22')]);return _0x252611(_0x72e6b7[_0xa899('0x21')]['message']);}logger[_0xa899('0x21')](_0xa899('0x1e'),_0x7a13b2,_0x72e6b7['error'][_0xa899('0x22')]);return _0xf809a7(_0x72e6b7[_0xa899('0x21')][_0xa899('0x22')]);}else{logger[_0xa899('0x1d')](_0xa899('0x1e'),_0x7a13b2,'request\x20sent');_0xf809a7(_0x72e6b7[_0xa899('0x23')][_0xa899('0x22')]);}})[_0xa899('0x24')](function(_0x5100b3){logger[_0xa899('0x21')](_0xa899('0x1e'),_0x7a13b2,_0x5100b3);_0x252611(_0x5100b3);});});}function respondWithStatusCode(_0xdacfa4,_0x5ae02f){_0x5ae02f=_0x5ae02f||0xcc;return function(_0x306fc8){if(_0x306fc8){return _0xdacfa4[_0xa899('0x25')](_0x5ae02f);}return _0xdacfa4[_0xa899('0x26')](_0x5ae02f)[_0xa899('0x27')]();};}function respondWithResult(_0x3d108c,_0x3a1abb){_0x3a1abb=_0x3a1abb||0xc8;return function(_0x3cecb3){if(_0x3cecb3){return _0x3d108c[_0xa899('0x26')](_0x3a1abb)[_0xa899('0x28')](_0x3cecb3);}};}function respondWithFilteredResult(_0x31b7e4,_0x5a261a){return function(_0x49312a){if(_0x49312a){var _0x103777=_0x49312a[_0xa899('0x29')],_0x7ac8e2=_0x5a261a[_0xa899('0x2a')],_0x4cd259=_0x5a261a['offset']+_0x5a261a[_0xa899('0x2b')],_0x5d0362;if(_0x4cd259>=_0x103777){_0x4cd259=_0x103777;_0x5d0362=0xc8;}else{_0x5d0362=0xce;}_0x31b7e4[_0xa899('0x26')](_0x5d0362);return _0x31b7e4[_0xa899('0x2c')](_0xa899('0x2d'),_0x7ac8e2+'-'+_0x4cd259+'/'+_0x103777)[_0xa899('0x28')](_0x49312a);}return null;};}function patchUpdates(_0x8ae6ee){return function(_0x4bee1a){try{jsonpatch['apply'](_0x4bee1a,_0x8ae6ee,!![]);}catch(_0x47eac8){return BPromise[_0xa899('0x2e')](_0x47eac8);}return _0x4bee1a[_0xa899('0x2f')]();};}function saveUpdates(_0x35d25f,_0x3421cc){return function(_0x575e6a){if(_0x575e6a){return _0x575e6a[_0xa899('0x30')](_0x35d25f)[_0xa899('0x31')](function(_0x4d14d4){return _0x4d14d4;});}return null;};}function removeEntity(_0x2b5838,_0x4faaea){return function(_0x11ee48){if(_0x11ee48){return _0x11ee48[_0xa899('0x32')]()['then'](function(){_0x2b5838[_0xa899('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f3acc,_0x86232){return function(_0x1ab1a8){if(!_0x1ab1a8){_0x2f3acc[_0xa899('0x25')](0x194);}return _0x1ab1a8;};}function handleError(_0x46c75d,_0x1346a1){_0x1346a1=_0x1346a1||0x1f4;return function(_0x3c0e49){logger[_0xa899('0x21')](_0x3c0e49[_0xa899('0x33')]);if(_0x3c0e49[_0xa899('0x34')]){delete _0x3c0e49['name'];}_0x46c75d[_0xa899('0x26')](_0x1346a1)[_0xa899('0x35')](_0x3c0e49);};}exports[_0xa899('0x36')]=function(_0x5b5fb2,_0x43bff2){var _0x1ba5a8={},_0x22ca27={},_0x4e94d2={'count':0x0,'rows':[]};var _0xd385c6=_[_0xa899('0x37')](db[_0xa899('0x38')]['rawAttributes'],function(_0xa1f29c){return{'name':_0xa1f29c[_0xa899('0x39')],'type':_0xa1f29c[_0xa899('0x3a')][_0xa899('0x3b')]};});_0x22ca27[_0xa899('0x3c')]=_[_0xa899('0x37')](_0xd385c6,_0xa899('0x34'));_0x22ca27[_0xa899('0x3d')]=_[_0xa899('0x3e')](_0x5b5fb2[_0xa899('0x3d')]);_0x22ca27[_0xa899('0x3f')]=_['intersection'](_0x22ca27['model'],_0x22ca27[_0xa899('0x3d')]);_0x1ba5a8[_0xa899('0x40')]=_[_0xa899('0x41')](_0x22ca27[_0xa899('0x3c')],qs['fields'](_0x5b5fb2[_0xa899('0x3d')][_0xa899('0x42')]));_0x1ba5a8[_0xa899('0x40')]=_0x1ba5a8[_0xa899('0x40')][_0xa899('0x43')]?_0x1ba5a8[_0xa899('0x40')]:_0x22ca27['model'];if(!_0x5b5fb2['query']['hasOwnProperty'](_0xa899('0x44'))){_0x1ba5a8[_0xa899('0x2b')]=qs[_0xa899('0x2b')](_0x5b5fb2[_0xa899('0x3d')][_0xa899('0x2b')]);_0x1ba5a8['offset']=qs['offset'](_0x5b5fb2[_0xa899('0x3d')][_0xa899('0x2a')]);}_0x1ba5a8['order']=qs[_0xa899('0x45')](_0x5b5fb2[_0xa899('0x3d')][_0xa899('0x45')]);_0x1ba5a8['where']=qs[_0xa899('0x3f')](_[_0xa899('0x46')](_0x5b5fb2[_0xa899('0x3d')],_0x22ca27['filters']),_0xd385c6);if(_0x5b5fb2[_0xa899('0x3d')]['filter']){_0x1ba5a8[_0xa899('0x47')]=_[_0xa899('0x48')](_0x1ba5a8[_0xa899('0x47')],{'$or':_[_0xa899('0x37')](_0xd385c6,function(_0x766bcc){if(_0x766bcc[_0xa899('0x3a')]!==_0xa899('0x49')){var _0x41dd32={};_0x41dd32[_0x766bcc[_0xa899('0x34')]]={'$like':'%'+_0x5b5fb2[_0xa899('0x3d')][_0xa899('0x4a')]+'%'};return _0x41dd32;}})});}_0x1ba5a8=_[_0xa899('0x48')]({},_0x1ba5a8,_0x5b5fb2[_0xa899('0x4b')]);var _0x547d1b={'where':_0x1ba5a8[_0xa899('0x47')]};return db[_0xa899('0x38')][_0xa899('0x29')](_0x547d1b)['then'](function(_0x4b8e16){_0x4e94d2[_0xa899('0x29')]=_0x4b8e16;if(_0x5b5fb2[_0xa899('0x3d')][_0xa899('0x4c')]){_0x1ba5a8[_0xa899('0x4d')]=[{'all':!![]}];}return db[_0xa899('0x38')][_0xa899('0x4e')](_0x1ba5a8);})[_0xa899('0x31')](function(_0x20d57f){_0x4e94d2['rows']=_0x20d57f;return _0x4e94d2;})[_0xa899('0x31')](respondWithFilteredResult(_0x43bff2,_0x1ba5a8))[_0xa899('0x24')](handleError(_0x43bff2,null));};exports[_0xa899('0x4f')]=function(_0x536fe1,_0x16ec9e){var _0x695f94={'raw':![],'where':{'id':_0x536fe1[_0xa899('0x50')]['id']}},_0x1ccc34={};_0x1ccc34[_0xa899('0x3c')]=_['keys'](db[_0xa899('0x38')][_0xa899('0x51')]);_0x1ccc34[_0xa899('0x3d')]=_['keys'](_0x536fe1['query']);_0x1ccc34[_0xa899('0x3f')]=_[_0xa899('0x41')](_0x1ccc34[_0xa899('0x3c')],_0x1ccc34[_0xa899('0x3d')]);_0x695f94[_0xa899('0x40')]=_['intersection'](_0x1ccc34[_0xa899('0x3c')],qs[_0xa899('0x42')](_0x536fe1[_0xa899('0x3d')]['fields']));_0x695f94['attributes']=_0x695f94[_0xa899('0x40')][_0xa899('0x43')]?_0x695f94[_0xa899('0x40')]:_0x1ccc34['model'];if(_0x536fe1[_0xa899('0x3d')][_0xa899('0x4c')]){_0x695f94[_0xa899('0x4d')]=[{'all':!![]}];}_0x695f94=_['merge']({},_0x695f94,_0x536fe1['options']);return db[_0xa899('0x38')]['find'](_0x695f94)[_0xa899('0x31')](handleEntityNotFound(_0x16ec9e,null))[_0xa899('0x31')](respondWithResult(_0x16ec9e,null))['catch'](handleError(_0x16ec9e,null));};exports[_0xa899('0x52')]=function(_0x1a8b1b,_0x404038){return db[_0xa899('0x38')][_0xa899('0x52')](_0x1a8b1b[_0xa899('0x53')],{})[_0xa899('0x31')](respondWithResult(_0x404038,0xc9))[_0xa899('0x24')](handleError(_0x404038,null));};exports[_0xa899('0x30')]=function(_0x2eea43,_0xd4f2ca){if(_0x2eea43[_0xa899('0x53')]['id']){delete _0x2eea43[_0xa899('0x53')]['id'];}return db[_0xa899('0x38')][_0xa899('0x54')]({'where':{'id':_0x2eea43[_0xa899('0x50')]['id']}})[_0xa899('0x31')](handleEntityNotFound(_0xd4f2ca,null))[_0xa899('0x31')](saveUpdates(_0x2eea43[_0xa899('0x53')],null))[_0xa899('0x31')](respondWithResult(_0xd4f2ca,null))[_0xa899('0x24')](handleError(_0xd4f2ca,null));};exports[_0xa899('0x32')]=function(_0x1d9893,_0x1607b9){return db[_0xa899('0x38')][_0xa899('0x54')]({'where':{'id':_0x1d9893['params']['id']}})['then'](handleEntityNotFound(_0x1607b9,null))[_0xa899('0x31')](removeEntity(_0x1607b9,null))[_0xa899('0x24')](handleError(_0x1607b9,null));};exports['getFields']=function(_0x22b8f3,_0x412a69,_0x21a1a1){var _0xbbca13={};var _0x1f0e71={};var _0x1478bd;var _0x201d6c;return db[_0xa899('0x38')][_0xa899('0x55')]({'where':{'id':_0x22b8f3[_0xa899('0x50')]['id']}})[_0xa899('0x31')](handleEntityNotFound(_0x412a69,null))[_0xa899('0x31')](function(_0x4994d7){if(_0x4994d7){_0x1478bd=_0x4994d7;_0x1f0e71[_0xa899('0x3c')]=_[_0xa899('0x3e')](db[_0xa899('0x56')][_0xa899('0x51')]);_0x1f0e71[_0xa899('0x3d')]=_[_0xa899('0x3e')](_0x22b8f3[_0xa899('0x3d')]);_0x1f0e71[_0xa899('0x3f')]=_['intersection'](_0x1f0e71[_0xa899('0x3c')],_0x1f0e71['query']);_0xbbca13[_0xa899('0x40')]=_[_0xa899('0x41')](_0x1f0e71['model'],qs[_0xa899('0x42')](_0x22b8f3[_0xa899('0x3d')]['fields']));_0xbbca13[_0xa899('0x40')]=_0xbbca13[_0xa899('0x40')][_0xa899('0x43')]?_0xbbca13[_0xa899('0x40')]:_0x1f0e71[_0xa899('0x3c')];_0xbbca13[_0xa899('0x57')]=qs[_0xa899('0x45')](_0x22b8f3[_0xa899('0x3d')][_0xa899('0x45')]);_0xbbca13[_0xa899('0x47')]=qs['filters'](_[_0xa899('0x46')](_0x22b8f3[_0xa899('0x3d')],_0x1f0e71[_0xa899('0x3f')]));if(_0x22b8f3[_0xa899('0x3d')][_0xa899('0x4a')]){_0xbbca13['where']=_['merge'](_0xbbca13['where'],{'$or':_[_0xa899('0x37')](_0xbbca13['attributes'],function(_0x3d9f28){var _0x265ecf={};_0x265ecf[_0x3d9f28]={'$like':'%'+_0x22b8f3['query'][_0xa899('0x4a')]+'%'};return _0x265ecf;})});}_0xbbca13=_[_0xa899('0x48')]({},_0xbbca13,_0x22b8f3[_0xa899('0x4b')]);return _0x1478bd[_0xa899('0x58')](_0xbbca13);}})[_0xa899('0x31')](function(_0x189f0c){if(_0x189f0c){_0x201d6c=_0x189f0c[_0xa899('0x43')];if(!_0x22b8f3[_0xa899('0x3d')][_0xa899('0x59')](_0xa899('0x44'))){_0xbbca13[_0xa899('0x2b')]=qs[_0xa899('0x2b')](_0x22b8f3[_0xa899('0x3d')][_0xa899('0x2b')]);_0xbbca13[_0xa899('0x2a')]=qs[_0xa899('0x2a')](_0x22b8f3[_0xa899('0x3d')][_0xa899('0x2a')]);}return _0x1478bd[_0xa899('0x58')](_0xbbca13);}})['then'](function(_0x3ae54b){if(_0x3ae54b){return _0x3ae54b?{'count':_0x201d6c,'rows':_0x3ae54b}:null;}})[_0xa899('0x31')](respondWithResult(_0x412a69,null))[_0xa899('0x24')](handleError(_0x412a69,null));};exports[_0xa899('0x5a')]=function(_0x5851c8,_0x226ec9,_0x602ba8){var _0x380b3c={};var _0x3d7d7a={};var _0x3a56be;var _0x56acbe;return db['DeskConfiguration'][_0xa899('0x55')]({'where':{'id':_0x5851c8[_0xa899('0x50')]['id']}})[_0xa899('0x31')](handleEntityNotFound(_0x226ec9,null))[_0xa899('0x31')](function(_0x3e4bac){if(_0x3e4bac){_0x3a56be=_0x3e4bac;_0x3d7d7a[_0xa899('0x3c')]=_[_0xa899('0x3e')](db[_0xa899('0x56')][_0xa899('0x51')]);_0x3d7d7a[_0xa899('0x3d')]=_[_0xa899('0x3e')](_0x5851c8[_0xa899('0x3d')]);_0x3d7d7a[_0xa899('0x3f')]=_['intersection'](_0x3d7d7a[_0xa899('0x3c')],_0x3d7d7a['query']);_0x380b3c[_0xa899('0x40')]=_[_0xa899('0x41')](_0x3d7d7a['model'],qs[_0xa899('0x42')](_0x5851c8[_0xa899('0x3d')][_0xa899('0x42')]));_0x380b3c[_0xa899('0x40')]=_0x380b3c['attributes']['length']?_0x380b3c['attributes']:_0x3d7d7a[_0xa899('0x3c')];_0x380b3c[_0xa899('0x57')]=qs[_0xa899('0x45')](_0x5851c8[_0xa899('0x3d')][_0xa899('0x45')]);_0x380b3c[_0xa899('0x47')]=qs[_0xa899('0x3f')](_[_0xa899('0x46')](_0x5851c8[_0xa899('0x3d')],_0x3d7d7a['filters']));if(_0x5851c8[_0xa899('0x3d')]['filter']){_0x380b3c[_0xa899('0x47')]=_[_0xa899('0x48')](_0x380b3c[_0xa899('0x47')],{'$or':_[_0xa899('0x37')](_0x380b3c['attributes'],function(_0x36803e){var _0x19e6d7={};_0x19e6d7[_0x36803e]={'$like':'%'+_0x5851c8['query']['filter']+'%'};return _0x19e6d7;})});}_0x380b3c=_[_0xa899('0x48')]({},_0x380b3c,_0x5851c8[_0xa899('0x4b')]);return _0x3a56be['getSubjects'](_0x380b3c);}})[_0xa899('0x31')](function(_0x50dec0){if(_0x50dec0){_0x56acbe=_0x50dec0['length'];if(!_0x5851c8['query'][_0xa899('0x59')](_0xa899('0x44'))){_0x380b3c[_0xa899('0x2b')]=qs[_0xa899('0x2b')](_0x5851c8[_0xa899('0x3d')][_0xa899('0x2b')]);_0x380b3c[_0xa899('0x2a')]=qs[_0xa899('0x2a')](_0x5851c8[_0xa899('0x3d')][_0xa899('0x2a')]);}return _0x3a56be[_0xa899('0x5a')](_0x380b3c);}})['then'](function(_0xeed329){if(_0xeed329){return _0xeed329?{'count':_0x56acbe,'rows':_0xeed329}:null;}})[_0xa899('0x31')](respondWithResult(_0x226ec9,null))[_0xa899('0x24')](handleError(_0x226ec9,null));};exports['getDescriptions']=function(_0x173b89,_0xfc797b,_0x4b2506){var _0x398df5={};var _0x31c04d={};var _0x4aef54;var _0xb2665d;return db['DeskConfiguration'][_0xa899('0x55')]({'where':{'id':_0x173b89[_0xa899('0x50')]['id']}})[_0xa899('0x31')](handleEntityNotFound(_0xfc797b,null))[_0xa899('0x31')](function(_0x2632fb){if(_0x2632fb){_0x4aef54=_0x2632fb;_0x31c04d[_0xa899('0x3c')]=_['keys'](db[_0xa899('0x56')][_0xa899('0x51')]);_0x31c04d[_0xa899('0x3d')]=_['keys'](_0x173b89[_0xa899('0x3d')]);_0x31c04d[_0xa899('0x3f')]=_[_0xa899('0x41')](_0x31c04d['model'],_0x31c04d[_0xa899('0x3d')]);_0x398df5['attributes']=_[_0xa899('0x41')](_0x31c04d[_0xa899('0x3c')],qs[_0xa899('0x42')](_0x173b89['query'][_0xa899('0x42')]));_0x398df5[_0xa899('0x40')]=_0x398df5[_0xa899('0x40')][_0xa899('0x43')]?_0x398df5['attributes']:_0x31c04d['model'];_0x398df5[_0xa899('0x57')]=qs[_0xa899('0x45')](_0x173b89[_0xa899('0x3d')][_0xa899('0x45')]);_0x398df5[_0xa899('0x47')]=qs[_0xa899('0x3f')](_['pick'](_0x173b89[_0xa899('0x3d')],_0x31c04d[_0xa899('0x3f')]));if(_0x173b89[_0xa899('0x3d')][_0xa899('0x4a')]){_0x398df5['where']=_[_0xa899('0x48')](_0x398df5[_0xa899('0x47')],{'$or':_[_0xa899('0x37')](_0x398df5[_0xa899('0x40')],function(_0x3f53a8){var _0x3045d2={};_0x3045d2[_0x3f53a8]={'$like':'%'+_0x173b89['query'][_0xa899('0x4a')]+'%'};return _0x3045d2;})});}_0x398df5=_[_0xa899('0x48')]({},_0x398df5,_0x173b89[_0xa899('0x4b')]);return _0x4aef54['getDescriptions'](_0x398df5);}})[_0xa899('0x31')](function(_0x5d3a36){if(_0x5d3a36){_0xb2665d=_0x5d3a36['length'];if(!_0x173b89[_0xa899('0x3d')][_0xa899('0x59')]('nolimit')){_0x398df5['limit']=qs[_0xa899('0x2b')](_0x173b89[_0xa899('0x3d')][_0xa899('0x2b')]);_0x398df5[_0xa899('0x2a')]=qs[_0xa899('0x2a')](_0x173b89['query'][_0xa899('0x2a')]);}return _0x4aef54[_0xa899('0x5b')](_0x398df5);}})[_0xa899('0x31')](function(_0x51f8d7){if(_0x51f8d7){return _0x51f8d7?{'count':_0xb2665d,'rows':_0x51f8d7}:null;}})[_0xa899('0x31')](respondWithResult(_0xfc797b,null))[_0xa899('0x24')](handleError(_0xfc797b,null));};exports['getTags']=function(_0xa8a878,_0x665754,_0x590ce6){var _0x1889f0={};var _0x5c39ca={};var _0xbe99cb;var _0x523af7;return db[_0xa899('0x38')]['findOne']({'where':{'id':_0xa8a878[_0xa899('0x50')]['id']}})[_0xa899('0x31')](handleEntityNotFound(_0x665754,null))[_0xa899('0x31')](function(_0x2a39fd){if(_0x2a39fd){_0xbe99cb=_0x2a39fd;_0x5c39ca['model']=_['keys'](db[_0xa899('0x5c')][_0xa899('0x51')]);_0x5c39ca[_0xa899('0x3d')]=_['keys'](_0xa8a878[_0xa899('0x3d')]);_0x5c39ca[_0xa899('0x3f')]=_[_0xa899('0x41')](_0x5c39ca['model'],_0x5c39ca[_0xa899('0x3d')]);_0x1889f0['attributes']=_[_0xa899('0x41')](_0x5c39ca[_0xa899('0x3c')],qs[_0xa899('0x42')](_0xa8a878['query'][_0xa899('0x42')]));_0x1889f0[_0xa899('0x40')]=_0x1889f0[_0xa899('0x40')]['length']?_0x1889f0[_0xa899('0x40')]:_0x5c39ca[_0xa899('0x3c')];_0x1889f0[_0xa899('0x57')]=qs[_0xa899('0x45')](_0xa8a878['query'][_0xa899('0x45')]);_0x1889f0[_0xa899('0x47')]=qs[_0xa899('0x3f')](_['pick'](_0xa8a878['query'],_0x5c39ca[_0xa899('0x3f')]));if(_0xa8a878[_0xa899('0x3d')][_0xa899('0x4a')]){_0x1889f0[_0xa899('0x47')]=_[_0xa899('0x48')](_0x1889f0[_0xa899('0x47')],{'$or':_[_0xa899('0x37')](_0x1889f0[_0xa899('0x40')],function(_0x39183c){var _0x39cb42={};_0x39cb42[_0x39183c]={'$like':'%'+_0xa8a878['query'][_0xa899('0x4a')]+'%'};return _0x39cb42;})});}_0x1889f0=_['merge']({},_0x1889f0,_0xa8a878['options']);return _0xbe99cb[_0xa899('0x5d')](_0x1889f0);}})[_0xa899('0x31')](function(_0x23e9f7){if(_0x23e9f7){_0x523af7=_0x23e9f7[_0xa899('0x43')];if(!_0xa8a878[_0xa899('0x3d')][_0xa899('0x59')]('nolimit')){_0x1889f0[_0xa899('0x2b')]=qs['limit'](_0xa8a878[_0xa899('0x3d')][_0xa899('0x2b')]);_0x1889f0['offset']=qs['offset'](_0xa8a878[_0xa899('0x3d')][_0xa899('0x2a')]);}return _0xbe99cb[_0xa899('0x5d')](_0x1889f0);}})['then'](function(_0x1e785e){if(_0x1e785e){return _0x1e785e?{'count':_0x523af7,'rows':_0x1e785e}:null;}})[_0xa899('0x31')](respondWithResult(_0x665754,null))[_0xa899('0x24')](handleError(_0x665754,null));};exports[_0xa899('0x5e')]=function(_0x4fcea2,_0x44bf53,_0x372e11){if(_0x4fcea2[_0xa899('0x53')]['id']){delete _0x4fcea2['body']['id'];}return db[_0xa899('0x38')][_0xa899('0x55')]({'where':{'id':_0x4fcea2[_0xa899('0x50')]['id']}})[_0xa899('0x31')](handleEntityNotFound(_0x44bf53,null))[_0xa899('0x31')](function(_0x589569){if(_0x589569){return _0x589569['setTags'](_0x4fcea2[_0xa899('0x53')][_0xa899('0x5f')]||[]);}return null;})['then'](respondWithResult(_0x44bf53,null))[_0xa899('0x24')](handleError(_0x44bf53,null));}; \ No newline at end of file +var _0x1052=['limit','set','Content-Range','apply','reject','save','update','stack','name','send','DeskConfiguration','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','params','find','catch','create','body','destroy','getFields','DeskField','findOne','pick','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../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','info','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','sendStatus','status','end','json','count'];(function(_0x4690e1,_0xd851d3){var _0xcd938f=function(_0x34d390){while(--_0x34d390){_0x4690e1['push'](_0x4690e1['shift']());}};_0xcd938f(++_0xd851d3);}(_0x1052,0xf4));var _0x2105=function(_0x4fa559,_0x5e7a03){_0x4fa559=_0x4fa559-0x0;var _0x59a8ed=_0x1052[_0x4fa559];return _0x59a8ed;};'use strict';var pdf=require(_0x2105('0x0'));var emlformat=require(_0x2105('0x1'));var rimraf=require(_0x2105('0x2'));var zipdir=require(_0x2105('0x3'));var jsonpatch=require(_0x2105('0x4'));var rp=require(_0x2105('0x5'));var moment=require(_0x2105('0x6'));var BPromise=require(_0x2105('0x7'));var Mustache=require(_0x2105('0x8'));var util=require('util');var path=require('path');var sox=require(_0x2105('0x9'));var csv=require('to-csv');var ejs=require(_0x2105('0xa'));var fs=require('fs');var _=require(_0x2105('0xb'));var squel=require('squel');var crypto=require(_0x2105('0xc'));var jsforce=require(_0x2105('0xd'));var deskjs=require(_0x2105('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2105('0xf'));var Redis=require(_0x2105('0x10'));var authService=require(_0x2105('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2105('0x12'));var hardwareService=require(_0x2105('0x13'));var logger=require(_0x2105('0x14'))(_0x2105('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x2105('0x16'))['db'];var jayson=require(_0x2105('0x17'));var client=jayson[_0x2105('0x18')][_0x2105('0x19')]({'port':0x232a});function checkPasswordPattern(_0x983ad,_0x1becf2,_0x382ea5){if(_0x382ea5){var _0x2aa0dc=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2aa0dc[_0x2105('0x1a')](_0x1becf2)){return _0x983ad;}else{throw new db[(_0x2105('0x1b'))]['ValidationError'](_0x2105('0x1c'));}}else{return _0x983ad;}}function respondWithRpcPromise(_0x3bd83d,_0x1a3fa3,_0x25e0c7,_0x576c51){return new BPromise(function(_0x42526b,_0x32e574){var _0x1d514b=_0x576c51||client;return _0x1d514b[_0x2105('0x1d')](_0x3bd83d,_0x25e0c7)[_0x2105('0x1e')](function(_0x499942){logger[_0x2105('0x1f')](_0x2105('0x20'),_0x1a3fa3,'request\x20sent');logger[_0x2105('0x21')](_0x2105('0x22'),_0x1a3fa3,_0x2105('0x23'),JSON[_0x2105('0x24')](_0x499942));if(_0x499942[_0x2105('0x25')]){if(_0x499942[_0x2105('0x25')]['code']===0x1f4){logger['error'](_0x2105('0x20'),_0x1a3fa3,_0x499942[_0x2105('0x25')][_0x2105('0x26')]);return _0x32e574(_0x499942[_0x2105('0x25')][_0x2105('0x26')]);}logger[_0x2105('0x25')]('DeskConfiguration,\x20%s,\x20%s',_0x1a3fa3,_0x499942[_0x2105('0x25')][_0x2105('0x26')]);return _0x42526b(_0x499942['error'][_0x2105('0x26')]);}else{logger[_0x2105('0x1f')](_0x2105('0x20'),_0x1a3fa3,_0x2105('0x23'));_0x42526b(_0x499942['result'][_0x2105('0x26')]);}})['catch'](function(_0x54feec){logger[_0x2105('0x25')](_0x2105('0x20'),_0x1a3fa3,_0x54feec);_0x32e574(_0x54feec);});});}function respondWithStatusCode(_0x25eb8c,_0x124a22){_0x124a22=_0x124a22||0xcc;return function(_0x531f14){if(_0x531f14){return _0x25eb8c[_0x2105('0x27')](_0x124a22);}return _0x25eb8c[_0x2105('0x28')](_0x124a22)[_0x2105('0x29')]();};}function respondWithResult(_0x3a4af1,_0x151eef){_0x151eef=_0x151eef||0xc8;return function(_0x6f1a86){if(_0x6f1a86){return _0x3a4af1[_0x2105('0x28')](_0x151eef)[_0x2105('0x2a')](_0x6f1a86);}};}function respondWithFilteredResult(_0x5a8589,_0x1b41f7){return function(_0x531aa9){if(_0x531aa9){var _0x20a564=_0x531aa9[_0x2105('0x2b')],_0x1c1df3=_0x1b41f7['offset'],_0x110973=_0x1b41f7['offset']+_0x1b41f7[_0x2105('0x2c')],_0x2deb12;if(_0x110973>=_0x20a564){_0x110973=_0x20a564;_0x2deb12=0xc8;}else{_0x2deb12=0xce;}_0x5a8589[_0x2105('0x28')](_0x2deb12);return _0x5a8589[_0x2105('0x2d')](_0x2105('0x2e'),_0x1c1df3+'-'+_0x110973+'/'+_0x20a564)[_0x2105('0x2a')](_0x531aa9);}return null;};}function patchUpdates(_0x2a910c){return function(_0x2148ef){try{jsonpatch[_0x2105('0x2f')](_0x2148ef,_0x2a910c,!![]);}catch(_0x4f0328){return BPromise[_0x2105('0x30')](_0x4f0328);}return _0x2148ef[_0x2105('0x31')]();};}function saveUpdates(_0x1f7cba,_0x4aaf8f){return function(_0x5ade60){if(_0x5ade60){return _0x5ade60[_0x2105('0x32')](_0x1f7cba)[_0x2105('0x1e')](function(_0x2e1712){return _0x2e1712;});}return null;};}function removeEntity(_0x106fe0,_0xd3f21){return function(_0x577fb2){if(_0x577fb2){return _0x577fb2['destroy']()['then'](function(){_0x106fe0[_0x2105('0x28')](0xcc)[_0x2105('0x29')]();});}};}function handleEntityNotFound(_0x5a8e39,_0x52a6d3){return function(_0x514844){if(!_0x514844){_0x5a8e39[_0x2105('0x27')](0x194);}return _0x514844;};}function handleError(_0x2615bb,_0x5ed25e){_0x5ed25e=_0x5ed25e||0x1f4;return function(_0x380379){logger[_0x2105('0x25')](_0x380379[_0x2105('0x33')]);if(_0x380379['name']){delete _0x380379[_0x2105('0x34')];}_0x2615bb[_0x2105('0x28')](_0x5ed25e)[_0x2105('0x35')](_0x380379);};}exports['index']=function(_0x32c9f1,_0x40f13a){var _0x5cc639={},_0x19a72a={},_0x2a59e6={'count':0x0,'rows':[]};var _0x27269d=_['map'](db[_0x2105('0x36')][_0x2105('0x37')],function(_0x237d46){return{'name':_0x237d46[_0x2105('0x38')],'type':_0x237d46[_0x2105('0x39')]['key']};});_0x19a72a[_0x2105('0x3a')]=_[_0x2105('0x3b')](_0x27269d,'name');_0x19a72a[_0x2105('0x3c')]=_[_0x2105('0x3d')](_0x32c9f1[_0x2105('0x3c')]);_0x19a72a[_0x2105('0x3e')]=_[_0x2105('0x3f')](_0x19a72a[_0x2105('0x3a')],_0x19a72a['query']);_0x5cc639[_0x2105('0x40')]=_[_0x2105('0x3f')](_0x19a72a[_0x2105('0x3a')],qs['fields'](_0x32c9f1[_0x2105('0x3c')][_0x2105('0x41')]));_0x5cc639[_0x2105('0x40')]=_0x5cc639['attributes'][_0x2105('0x42')]?_0x5cc639[_0x2105('0x40')]:_0x19a72a[_0x2105('0x3a')];if(!_0x32c9f1['query'][_0x2105('0x43')](_0x2105('0x44'))){_0x5cc639[_0x2105('0x2c')]=qs[_0x2105('0x2c')](_0x32c9f1[_0x2105('0x3c')]['limit']);_0x5cc639[_0x2105('0x45')]=qs[_0x2105('0x45')](_0x32c9f1[_0x2105('0x3c')][_0x2105('0x45')]);}_0x5cc639[_0x2105('0x46')]=qs[_0x2105('0x47')](_0x32c9f1['query'][_0x2105('0x47')]);_0x5cc639[_0x2105('0x48')]=qs[_0x2105('0x3e')](_['pick'](_0x32c9f1[_0x2105('0x3c')],_0x19a72a[_0x2105('0x3e')]),_0x27269d);if(_0x32c9f1[_0x2105('0x3c')][_0x2105('0x49')]){_0x5cc639['where']=_[_0x2105('0x4a')](_0x5cc639[_0x2105('0x48')],{'$or':_[_0x2105('0x3b')](_0x27269d,function(_0x403b88){if(_0x403b88[_0x2105('0x39')]!==_0x2105('0x4b')){var _0x43977f={};_0x43977f[_0x403b88[_0x2105('0x34')]]={'$like':'%'+_0x32c9f1['query'][_0x2105('0x49')]+'%'};return _0x43977f;}})});}_0x5cc639=_[_0x2105('0x4a')]({},_0x5cc639,_0x32c9f1[_0x2105('0x4c')]);var _0x18bd77={'where':_0x5cc639['where']};return db[_0x2105('0x36')][_0x2105('0x2b')](_0x18bd77)[_0x2105('0x1e')](function(_0x12d565){_0x2a59e6[_0x2105('0x2b')]=_0x12d565;if(_0x32c9f1[_0x2105('0x3c')][_0x2105('0x4d')]){_0x5cc639[_0x2105('0x4e')]=[{'all':!![]}];}return db[_0x2105('0x36')][_0x2105('0x4f')](_0x5cc639);})[_0x2105('0x1e')](function(_0x48f475){_0x2a59e6['rows']=_0x48f475;return _0x2a59e6;})[_0x2105('0x1e')](respondWithFilteredResult(_0x40f13a,_0x5cc639))['catch'](handleError(_0x40f13a,null));};exports['show']=function(_0x4596b7,_0x4ec449){var _0x367560={'raw':![],'where':{'id':_0x4596b7[_0x2105('0x50')]['id']}},_0x1989cc={};_0x1989cc[_0x2105('0x3a')]=_[_0x2105('0x3d')](db['DeskConfiguration']['rawAttributes']);_0x1989cc[_0x2105('0x3c')]=_['keys'](_0x4596b7[_0x2105('0x3c')]);_0x1989cc[_0x2105('0x3e')]=_[_0x2105('0x3f')](_0x1989cc['model'],_0x1989cc['query']);_0x367560['attributes']=_[_0x2105('0x3f')](_0x1989cc[_0x2105('0x3a')],qs[_0x2105('0x41')](_0x4596b7[_0x2105('0x3c')][_0x2105('0x41')]));_0x367560[_0x2105('0x40')]=_0x367560[_0x2105('0x40')][_0x2105('0x42')]?_0x367560[_0x2105('0x40')]:_0x1989cc[_0x2105('0x3a')];if(_0x4596b7[_0x2105('0x3c')][_0x2105('0x4d')]){_0x367560['include']=[{'all':!![]}];}_0x367560=_['merge']({},_0x367560,_0x4596b7[_0x2105('0x4c')]);return db[_0x2105('0x36')][_0x2105('0x51')](_0x367560)[_0x2105('0x1e')](handleEntityNotFound(_0x4ec449,null))[_0x2105('0x1e')](respondWithResult(_0x4ec449,null))[_0x2105('0x52')](handleError(_0x4ec449,null));};exports[_0x2105('0x53')]=function(_0x1b8edf,_0x18ea9a){return db['DeskConfiguration'][_0x2105('0x53')](_0x1b8edf[_0x2105('0x54')],{})[_0x2105('0x1e')](respondWithResult(_0x18ea9a,0xc9))['catch'](handleError(_0x18ea9a,null));};exports[_0x2105('0x32')]=function(_0x136734,_0x47492c){if(_0x136734[_0x2105('0x54')]['id']){delete _0x136734[_0x2105('0x54')]['id'];}return db[_0x2105('0x36')][_0x2105('0x51')]({'where':{'id':_0x136734[_0x2105('0x50')]['id']}})[_0x2105('0x1e')](handleEntityNotFound(_0x47492c,null))[_0x2105('0x1e')](saveUpdates(_0x136734[_0x2105('0x54')],null))[_0x2105('0x1e')](respondWithResult(_0x47492c,null))[_0x2105('0x52')](handleError(_0x47492c,null));};exports[_0x2105('0x55')]=function(_0x23c072,_0x51ade7){return db['DeskConfiguration']['find']({'where':{'id':_0x23c072[_0x2105('0x50')]['id']}})['then'](handleEntityNotFound(_0x51ade7,null))[_0x2105('0x1e')](removeEntity(_0x51ade7,null))[_0x2105('0x52')](handleError(_0x51ade7,null));};exports[_0x2105('0x56')]=function(_0x3b2376,_0x47df71,_0x3e412e){var _0x525d01={};var _0x7cafd6={};var _0x59fb86;var _0x121a8a;return db['DeskConfiguration']['findOne']({'where':{'id':_0x3b2376[_0x2105('0x50')]['id']}})[_0x2105('0x1e')](handleEntityNotFound(_0x47df71,null))[_0x2105('0x1e')](function(_0x27d59c){if(_0x27d59c){_0x59fb86=_0x27d59c;_0x7cafd6[_0x2105('0x3a')]=_[_0x2105('0x3d')](db[_0x2105('0x57')][_0x2105('0x37')]);_0x7cafd6[_0x2105('0x3c')]=_[_0x2105('0x3d')](_0x3b2376[_0x2105('0x3c')]);_0x7cafd6[_0x2105('0x3e')]=_[_0x2105('0x3f')](_0x7cafd6[_0x2105('0x3a')],_0x7cafd6[_0x2105('0x3c')]);_0x525d01['attributes']=_[_0x2105('0x3f')](_0x7cafd6[_0x2105('0x3a')],qs[_0x2105('0x41')](_0x3b2376[_0x2105('0x3c')][_0x2105('0x41')]));_0x525d01[_0x2105('0x40')]=_0x525d01[_0x2105('0x40')][_0x2105('0x42')]?_0x525d01[_0x2105('0x40')]:_0x7cafd6['model'];_0x525d01[_0x2105('0x46')]=qs[_0x2105('0x47')](_0x3b2376[_0x2105('0x3c')]['sort']);_0x525d01['where']=qs[_0x2105('0x3e')](_['pick'](_0x3b2376[_0x2105('0x3c')],_0x7cafd6[_0x2105('0x3e')]));if(_0x3b2376['query'][_0x2105('0x49')]){_0x525d01['where']=_[_0x2105('0x4a')](_0x525d01[_0x2105('0x48')],{'$or':_[_0x2105('0x3b')](_0x525d01[_0x2105('0x40')],function(_0x43bd28){var _0x22d489={};_0x22d489[_0x43bd28]={'$like':'%'+_0x3b2376[_0x2105('0x3c')][_0x2105('0x49')]+'%'};return _0x22d489;})});}_0x525d01=_[_0x2105('0x4a')]({},_0x525d01,_0x3b2376[_0x2105('0x4c')]);return _0x59fb86[_0x2105('0x56')](_0x525d01);}})['then'](function(_0x339d37){if(_0x339d37){_0x121a8a=_0x339d37[_0x2105('0x42')];if(!_0x3b2376['query'][_0x2105('0x43')]('nolimit')){_0x525d01['limit']=qs[_0x2105('0x2c')](_0x3b2376[_0x2105('0x3c')]['limit']);_0x525d01['offset']=qs[_0x2105('0x45')](_0x3b2376[_0x2105('0x3c')][_0x2105('0x45')]);}return _0x59fb86[_0x2105('0x56')](_0x525d01);}})[_0x2105('0x1e')](function(_0x1e4219){if(_0x1e4219){return _0x1e4219?{'count':_0x121a8a,'rows':_0x1e4219}:null;}})[_0x2105('0x1e')](respondWithResult(_0x47df71,null))[_0x2105('0x52')](handleError(_0x47df71,null));};exports['getSubjects']=function(_0x2f0e70,_0x1dc6ad,_0x4b6872){var _0x51d885={};var _0x4a106c={};var _0x11da52;var _0x34c216;return db[_0x2105('0x36')][_0x2105('0x58')]({'where':{'id':_0x2f0e70['params']['id']}})[_0x2105('0x1e')](handleEntityNotFound(_0x1dc6ad,null))[_0x2105('0x1e')](function(_0x516706){if(_0x516706){_0x11da52=_0x516706;_0x4a106c[_0x2105('0x3a')]=_['keys'](db[_0x2105('0x57')]['rawAttributes']);_0x4a106c[_0x2105('0x3c')]=_[_0x2105('0x3d')](_0x2f0e70['query']);_0x4a106c[_0x2105('0x3e')]=_['intersection'](_0x4a106c[_0x2105('0x3a')],_0x4a106c[_0x2105('0x3c')]);_0x51d885[_0x2105('0x40')]=_[_0x2105('0x3f')](_0x4a106c['model'],qs['fields'](_0x2f0e70[_0x2105('0x3c')]['fields']));_0x51d885[_0x2105('0x40')]=_0x51d885[_0x2105('0x40')]['length']?_0x51d885[_0x2105('0x40')]:_0x4a106c[_0x2105('0x3a')];_0x51d885[_0x2105('0x46')]=qs[_0x2105('0x47')](_0x2f0e70[_0x2105('0x3c')][_0x2105('0x47')]);_0x51d885[_0x2105('0x48')]=qs[_0x2105('0x3e')](_[_0x2105('0x59')](_0x2f0e70['query'],_0x4a106c['filters']));if(_0x2f0e70[_0x2105('0x3c')][_0x2105('0x49')]){_0x51d885[_0x2105('0x48')]=_['merge'](_0x51d885[_0x2105('0x48')],{'$or':_[_0x2105('0x3b')](_0x51d885['attributes'],function(_0x2c6f36){var _0x709e4a={};_0x709e4a[_0x2c6f36]={'$like':'%'+_0x2f0e70[_0x2105('0x3c')][_0x2105('0x49')]+'%'};return _0x709e4a;})});}_0x51d885=_[_0x2105('0x4a')]({},_0x51d885,_0x2f0e70[_0x2105('0x4c')]);return _0x11da52['getSubjects'](_0x51d885);}})[_0x2105('0x1e')](function(_0x4f894e){if(_0x4f894e){_0x34c216=_0x4f894e['length'];if(!_0x2f0e70['query']['hasOwnProperty']('nolimit')){_0x51d885[_0x2105('0x2c')]=qs[_0x2105('0x2c')](_0x2f0e70[_0x2105('0x3c')]['limit']);_0x51d885['offset']=qs[_0x2105('0x45')](_0x2f0e70['query']['offset']);}return _0x11da52[_0x2105('0x5a')](_0x51d885);}})[_0x2105('0x1e')](function(_0x9d5e76){if(_0x9d5e76){return _0x9d5e76?{'count':_0x34c216,'rows':_0x9d5e76}:null;}})[_0x2105('0x1e')](respondWithResult(_0x1dc6ad,null))[_0x2105('0x52')](handleError(_0x1dc6ad,null));};exports[_0x2105('0x5b')]=function(_0x47f633,_0x5a39b5,_0x281152){var _0x169761={};var _0x26077f={};var _0x1d257b;var _0x29d7ae;return db[_0x2105('0x36')][_0x2105('0x58')]({'where':{'id':_0x47f633[_0x2105('0x50')]['id']}})[_0x2105('0x1e')](handleEntityNotFound(_0x5a39b5,null))['then'](function(_0xb4e66d){if(_0xb4e66d){_0x1d257b=_0xb4e66d;_0x26077f['model']=_['keys'](db['DeskField'][_0x2105('0x37')]);_0x26077f[_0x2105('0x3c')]=_[_0x2105('0x3d')](_0x47f633[_0x2105('0x3c')]);_0x26077f[_0x2105('0x3e')]=_[_0x2105('0x3f')](_0x26077f[_0x2105('0x3a')],_0x26077f[_0x2105('0x3c')]);_0x169761[_0x2105('0x40')]=_['intersection'](_0x26077f[_0x2105('0x3a')],qs[_0x2105('0x41')](_0x47f633[_0x2105('0x3c')]['fields']));_0x169761[_0x2105('0x40')]=_0x169761[_0x2105('0x40')][_0x2105('0x42')]?_0x169761[_0x2105('0x40')]:_0x26077f[_0x2105('0x3a')];_0x169761['order']=qs[_0x2105('0x47')](_0x47f633[_0x2105('0x3c')][_0x2105('0x47')]);_0x169761[_0x2105('0x48')]=qs['filters'](_[_0x2105('0x59')](_0x47f633['query'],_0x26077f[_0x2105('0x3e')]));if(_0x47f633['query'][_0x2105('0x49')]){_0x169761[_0x2105('0x48')]=_[_0x2105('0x4a')](_0x169761[_0x2105('0x48')],{'$or':_[_0x2105('0x3b')](_0x169761[_0x2105('0x40')],function(_0x3427b0){var _0x57deba={};_0x57deba[_0x3427b0]={'$like':'%'+_0x47f633[_0x2105('0x3c')]['filter']+'%'};return _0x57deba;})});}_0x169761=_[_0x2105('0x4a')]({},_0x169761,_0x47f633[_0x2105('0x4c')]);return _0x1d257b['getDescriptions'](_0x169761);}})[_0x2105('0x1e')](function(_0x5584c2){if(_0x5584c2){_0x29d7ae=_0x5584c2[_0x2105('0x42')];if(!_0x47f633[_0x2105('0x3c')][_0x2105('0x43')](_0x2105('0x44'))){_0x169761['limit']=qs[_0x2105('0x2c')](_0x47f633[_0x2105('0x3c')][_0x2105('0x2c')]);_0x169761[_0x2105('0x45')]=qs[_0x2105('0x45')](_0x47f633['query'][_0x2105('0x45')]);}return _0x1d257b[_0x2105('0x5b')](_0x169761);}})[_0x2105('0x1e')](function(_0x4c797f){if(_0x4c797f){return _0x4c797f?{'count':_0x29d7ae,'rows':_0x4c797f}:null;}})[_0x2105('0x1e')](respondWithResult(_0x5a39b5,null))[_0x2105('0x52')](handleError(_0x5a39b5,null));};exports[_0x2105('0x5c')]=function(_0x3da0eb,_0x66d5ab,_0x3bd30a){var _0x20cb5b={};var _0x212de6={};var _0x34205d;var _0xa2f5f1;return db[_0x2105('0x36')]['findOne']({'where':{'id':_0x3da0eb[_0x2105('0x50')]['id']}})[_0x2105('0x1e')](handleEntityNotFound(_0x66d5ab,null))[_0x2105('0x1e')](function(_0x5ddeda){if(_0x5ddeda){_0x34205d=_0x5ddeda;_0x212de6[_0x2105('0x3a')]=_[_0x2105('0x3d')](db[_0x2105('0x5d')][_0x2105('0x37')]);_0x212de6[_0x2105('0x3c')]=_[_0x2105('0x3d')](_0x3da0eb[_0x2105('0x3c')]);_0x212de6[_0x2105('0x3e')]=_[_0x2105('0x3f')](_0x212de6[_0x2105('0x3a')],_0x212de6[_0x2105('0x3c')]);_0x20cb5b[_0x2105('0x40')]=_[_0x2105('0x3f')](_0x212de6[_0x2105('0x3a')],qs[_0x2105('0x41')](_0x3da0eb[_0x2105('0x3c')][_0x2105('0x41')]));_0x20cb5b[_0x2105('0x40')]=_0x20cb5b[_0x2105('0x40')][_0x2105('0x42')]?_0x20cb5b[_0x2105('0x40')]:_0x212de6['model'];_0x20cb5b[_0x2105('0x46')]=qs[_0x2105('0x47')](_0x3da0eb[_0x2105('0x3c')][_0x2105('0x47')]);_0x20cb5b['where']=qs[_0x2105('0x3e')](_[_0x2105('0x59')](_0x3da0eb[_0x2105('0x3c')],_0x212de6['filters']));if(_0x3da0eb[_0x2105('0x3c')][_0x2105('0x49')]){_0x20cb5b[_0x2105('0x48')]=_[_0x2105('0x4a')](_0x20cb5b['where'],{'$or':_['map'](_0x20cb5b[_0x2105('0x40')],function(_0x975e0d){var _0x3802c2={};_0x3802c2[_0x975e0d]={'$like':'%'+_0x3da0eb['query'][_0x2105('0x49')]+'%'};return _0x3802c2;})});}_0x20cb5b=_[_0x2105('0x4a')]({},_0x20cb5b,_0x3da0eb[_0x2105('0x4c')]);return _0x34205d[_0x2105('0x5c')](_0x20cb5b);}})[_0x2105('0x1e')](function(_0xa68787){if(_0xa68787){_0xa2f5f1=_0xa68787['length'];if(!_0x3da0eb[_0x2105('0x3c')][_0x2105('0x43')](_0x2105('0x44'))){_0x20cb5b[_0x2105('0x2c')]=qs['limit'](_0x3da0eb[_0x2105('0x3c')][_0x2105('0x2c')]);_0x20cb5b[_0x2105('0x45')]=qs[_0x2105('0x45')](_0x3da0eb['query'][_0x2105('0x45')]);}return _0x34205d[_0x2105('0x5c')](_0x20cb5b);}})[_0x2105('0x1e')](function(_0x4b1a4b){if(_0x4b1a4b){return _0x4b1a4b?{'count':_0xa2f5f1,'rows':_0x4b1a4b}:null;}})[_0x2105('0x1e')](respondWithResult(_0x66d5ab,null))[_0x2105('0x52')](handleError(_0x66d5ab,null));};exports['setTags']=function(_0x11578e,_0x54429b,_0x101d3b){if(_0x11578e[_0x2105('0x54')]['id']){delete _0x11578e['body']['id'];}return db[_0x2105('0x36')]['findOne']({'where':{'id':_0x11578e[_0x2105('0x50')]['id']}})[_0x2105('0x1e')](handleEntityNotFound(_0x54429b,null))[_0x2105('0x1e')](function(_0x594686){if(_0x594686){return _0x594686[_0x2105('0x5e')](_0x11578e[_0x2105('0x54')][_0x2105('0x5f')]||[]);}return null;})[_0x2105('0x1e')](respondWithResult(_0x54429b,null))[_0x2105('0x52')](handleError(_0x54429b,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 1f1ae9c..db1e466 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 _0x7533=['define','int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports'];(function(_0x386c9d,_0x1cf2ef){var _0x2f74d2=function(_0x5c96aa){while(--_0x5c96aa){_0x386c9d['push'](_0x386c9d['shift']());}};_0x2f74d2(++_0x1cf2ef);}(_0x7533,0x188));var _0x3753=function(_0x2733fd,_0x180bcb){_0x2733fd=_0x2733fd-0x0;var _0x2f4e9a=_0x7533[_0x2733fd];return _0x2f4e9a;};'use strict';var _=require(_0x3753('0x0'));var util=require(_0x3753('0x1'));var logger=require(_0x3753('0x2'))(_0x3753('0x3'));var moment=require(_0x3753('0x4'));var BPromise=require(_0x3753('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3753('0x6'));var rimraf=require(_0x3753('0x7'));var config=require(_0x3753('0x8'));var attributes=require(_0x3753('0x9'));module[_0x3753('0xa')]=function(_0x3412b7,_0x4a2a0c){return _0x3412b7[_0x3753('0xb')]('DeskConfiguration',attributes,{'tableName':_0x3753('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf10c=['rimraf','./intDeskConfiguration.attributes','int_desk_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x49b8a5,_0xbe7f21){var _0x11f7ab=function(_0x4d1dda){while(--_0x4d1dda){_0x49b8a5['push'](_0x49b8a5['shift']());}};_0x11f7ab(++_0xbe7f21);}(_0xf10c,0x1c5));var _0xcf10=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf10c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcf10('0x0'));var util=require(_0xcf10('0x1'));var logger=require(_0xcf10('0x2'))(_0xcf10('0x3'));var moment=require('moment');var BPromise=require(_0xcf10('0x4'));var rp=require(_0xcf10('0x5'));var fs=require('fs');var path=require(_0xcf10('0x6'));var rimraf=require(_0xcf10('0x7'));var config=require('../../config/environment');var attributes=require(_0xcf10('0x8'));module['exports']=function(_0x1dbb2c,_0x2f5c8){return _0x1dbb2c['define']('DeskConfiguration',attributes,{'tableName':_0xcf10('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 48d44e0..c38f20c 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 _0x902b=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x2a5dcf,_0x44cb37){var _0x4e3618=function(_0x9ef66d){while(--_0x9ef66d){_0x2a5dcf['push'](_0x2a5dcf['shift']());}};_0x4e3618(++_0x44cb37);}(_0x902b,0x6a));var _0xb902=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x902b[_0x45783c];return _0x1161da;};'use strict';var _=require(_0xb902('0x0'));var util=require('util');var moment=require(_0xb902('0x1'));var BPromise=require(_0xb902('0x2'));var rs=require(_0xb902('0x3'));var fs=require('fs');var Redis=require(_0xb902('0x4'));var db=require(_0xb902('0x5'))['db'];var utils=require(_0xb902('0x6'));var logger=require('../../config/logger')(_0xb902('0x7'));var config=require('../../config/environment');var jayson=require(_0xb902('0x8'));var client=jayson['client'][_0xb902('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e7240,_0x49f60d,_0x5b0b74){return new BPromise(function(_0x55331d,_0x534c79){return client[_0xb902('0xa')](_0x5e7240,_0x5b0b74)[_0xb902('0xb')](function(_0x573fa5){logger['info'](_0xb902('0xc'),_0x49f60d,_0xb902('0xd'));logger[_0xb902('0xe')](_0xb902('0xf'),_0x49f60d,_0xb902('0xd'),JSON[_0xb902('0x10')](_0x573fa5));if(_0x573fa5[_0xb902('0x11')]){if(_0x573fa5[_0xb902('0x11')]['code']===0x1f4){logger[_0xb902('0x11')](_0xb902('0xc'),_0x49f60d,_0x573fa5[_0xb902('0x11')][_0xb902('0x12')]);return _0x534c79(_0x573fa5['error']['message']);}logger[_0xb902('0x11')](_0xb902('0xc'),_0x49f60d,_0x573fa5['error'][_0xb902('0x12')]);return _0x55331d(_0x573fa5[_0xb902('0x11')][_0xb902('0x12')]);}else{logger[_0xb902('0x13')](_0xb902('0xc'),_0x49f60d,_0xb902('0xd'));_0x55331d(_0x573fa5['result'][_0xb902('0x12')]);}})[_0xb902('0x14')](function(_0x32d4c1){logger[_0xb902('0x11')](_0xb902('0xc'),_0x49f60d,_0x32d4c1);_0x534c79(_0x32d4c1);});});} \ No newline at end of file +var _0x3ef0=['http','info','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x509c83,_0x511882){var _0x534626=function(_0x9d21cf){while(--_0x9d21cf){_0x509c83['push'](_0x509c83['shift']());}};_0x534626(++_0x511882);}(_0x3ef0,0x19a));var _0x03ef=function(_0x179a63,_0x4ff6c4){_0x179a63=_0x179a63-0x0;var _0x5b7d7e=_0x3ef0[_0x179a63];return _0x5b7d7e;};'use strict';var _=require(_0x03ef('0x0'));var util=require('util');var moment=require(_0x03ef('0x1'));var BPromise=require('bluebird');var rs=require(_0x03ef('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x03ef('0x3'))['db'];var utils=require(_0x03ef('0x4'));var logger=require(_0x03ef('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x03ef('0x6'));var client=jayson[_0x03ef('0x7')][_0x03ef('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x47e561,_0x357971,_0x3c06ee){return new BPromise(function(_0x2d54e7,_0x61669){return client['request'](_0x47e561,_0x3c06ee)['then'](function(_0x399e94){logger[_0x03ef('0x9')](_0x03ef('0xa'),_0x357971,'request\x20sent');logger[_0x03ef('0xb')](_0x03ef('0xc'),_0x357971,'request\x20sent',JSON[_0x03ef('0xd')](_0x399e94));if(_0x399e94[_0x03ef('0xe')]){if(_0x399e94[_0x03ef('0xe')]['code']===0x1f4){logger[_0x03ef('0xe')](_0x03ef('0xa'),_0x357971,_0x399e94[_0x03ef('0xe')][_0x03ef('0xf')]);return _0x61669(_0x399e94[_0x03ef('0xe')][_0x03ef('0xf')]);}logger[_0x03ef('0xe')](_0x03ef('0xa'),_0x357971,_0x399e94[_0x03ef('0xe')][_0x03ef('0xf')]);return _0x2d54e7(_0x399e94[_0x03ef('0xe')]['message']);}else{logger['info'](_0x03ef('0xa'),_0x357971,_0x03ef('0x10'));_0x2d54e7(_0x399e94[_0x03ef('0x11')][_0x03ef('0xf')]);}})[_0x03ef('0x12')](function(_0x590152){logger['error'](_0x03ef('0xa'),_0x357971,_0x590152);_0x61669(_0x590152);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 88c372c..63b5830 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 _0xd405=['show','post','isAuthenticated','create','update','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','/:id'];(function(_0x13ef98,_0xc30b23){var _0xe3b7a7=function(_0x1ac5d6){while(--_0x1ac5d6){_0x13ef98['push'](_0x13ef98['shift']());}};_0xe3b7a7(++_0xc30b23);}(_0xd405,0xc2));var _0x5d40=function(_0x2e50a2,_0x27f31e){_0x2e50a2=_0x2e50a2-0x0;var _0x47e5de=_0xd405[_0x2e50a2];return _0x47e5de;};'use strict';var multer=require(_0x5d40('0x0'));var util=require(_0x5d40('0x1'));var path=require(_0x5d40('0x2'));var timeout=require(_0x5d40('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x5d40('0x4'));var interaction=require(_0x5d40('0x5'));var config=require(_0x5d40('0x6'));var controller=require(_0x5d40('0x7'));router[_0x5d40('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x5d40('0x9'),auth['isAuthenticated'](),controller[_0x5d40('0xa')]);router[_0x5d40('0xb')]('/',auth[_0x5d40('0xc')](),controller[_0x5d40('0xd')]);router['put'](_0x5d40('0x9'),auth['isAuthenticated'](),controller[_0x5d40('0xe')]);router['delete'](_0x5d40('0x9'),auth[_0x5d40('0xc')](),controller[_0x5d40('0xf')]);module[_0x5d40('0x10')]=router; \ No newline at end of file +var _0xf9c9=['util','path','../../components/auth/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xf9c9,0x18b));var _0x9f9c=function(_0x23ef1f,_0x127dd2){_0x23ef1f=_0x23ef1f-0x0;var _0x234192=_0xf9c9[_0x23ef1f];return _0x234192;};'use strict';var multer=require(_0x9f9c('0x0'));var util=require(_0x9f9c('0x1'));var path=require(_0x9f9c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x9f9c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x9f9c('0x4'));var controller=require(_0x9f9c('0x5'));router[_0x9f9c('0x6')]('/',auth[_0x9f9c('0x7')](),controller[_0x9f9c('0x8')]);router[_0x9f9c('0x6')](_0x9f9c('0x9'),auth[_0x9f9c('0x7')](),controller[_0x9f9c('0xa')]);router[_0x9f9c('0xb')]('/',auth[_0x9f9c('0x7')](),controller[_0x9f9c('0xc')]);router[_0x9f9c('0xd')](_0x9f9c('0x9'),auth[_0x9f9c('0x7')](),controller[_0x9f9c('0xe')]);router[_0x9f9c('0xf')](_0x9f9c('0x9'),auth['isAuthenticated'](),controller[_0x9f9c('0x10')]);module[_0x9f9c('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 1cc5dd6..e8456c1 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 _0x306a=['STRING','string','variable','BOOLEAN','sequelize','exports','ENUM','customVariable'];(function(_0x57f659,_0x38baba){var _0x373059=function(_0x471c91){while(--_0x471c91){_0x57f659['push'](_0x57f659['shift']());}};_0x373059(++_0x38baba);}(_0x306a,0x174));var _0xa306=function(_0x22cbcb,_0x413899){_0x22cbcb=_0x22cbcb-0x0;var _0x484301=_0x306a[_0x22cbcb];return _0x484301;};'use strict';var Sequelize=require(_0xa306('0x0'));module[_0xa306('0x1')]={'type':{'type':Sequelize[_0xa306('0x2')]('string','variable',_0xa306('0x3'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa306('0x4')]},'keyType':{'type':Sequelize[_0xa306('0x2')](_0xa306('0x5'),_0xa306('0x6'),_0xa306('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xa306('0x4')]},'nameField':{'type':Sequelize[_0xa306('0x4')]},'customField':{'type':Sequelize[_0xa306('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf856=['sequelize','exports','ENUM','string','keyValue','STRING','variable','customVariable'];(function(_0x49feab,_0x184ca4){var _0x5b7a85=function(_0x58542c){while(--_0x58542c){_0x49feab['push'](_0x49feab['shift']());}};_0x5b7a85(++_0x184ca4);}(_0xf856,0x190));var _0x6f85=function(_0x4159a9,_0x2bcce1){_0x4159a9=_0x4159a9-0x0;var _0x1faa79=_0xf856[_0x4159a9];return _0x1faa79;};'use strict';var Sequelize=require(_0x6f85('0x0'));module[_0x6f85('0x1')]={'type':{'type':Sequelize[_0x6f85('0x2')](_0x6f85('0x3'),'variable','customVariable',_0x6f85('0x4')),'defaultValue':_0x6f85('0x3')},'content':{'type':Sequelize[_0x6f85('0x5')]},'key':{'type':Sequelize[_0x6f85('0x5')]},'keyType':{'type':Sequelize['ENUM']('string',_0x6f85('0x6'),_0x6f85('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x6f85('0x5')]},'nameField':{'type':Sequelize[_0x6f85('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'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 4c6d074..2981d8f 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 _0xf2e4=['filter','VIRTUAL','merge','options','count','includeAll','DeskField','findAll','rows','show','keys','include','find','catch','create','body','destroy','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','apply','save','update','then','stack','name','send','index','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick'];(function(_0x322ee0,_0x2e2f29){var _0x4f519a=function(_0x64d2d2){while(--_0x64d2d2){_0x322ee0['push'](_0x322ee0['shift']());}};_0x4f519a(++_0x2e2f29);}(_0xf2e4,0x9e));var _0x4f2e=function(_0x1d099e,_0x4249cc){_0x1d099e=_0x1d099e-0x0;var _0x3cf24c=_0xf2e4[_0x1d099e];return _0x3cf24c;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x4f2e('0x0'));var zipdir=require(_0x4f2e('0x1'));var jsonpatch=require(_0x4f2e('0x2'));var rp=require(_0x4f2e('0x3'));var moment=require(_0x4f2e('0x4'));var BPromise=require(_0x4f2e('0x5'));var Mustache=require('mustache');var util=require(_0x4f2e('0x6'));var path=require(_0x4f2e('0x7'));var sox=require(_0x4f2e('0x8'));var csv=require(_0x4f2e('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4f2e('0xa'));var squel=require(_0x4f2e('0xb'));var crypto=require('crypto');var jsforce=require(_0x4f2e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4f2e('0xd'));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(_0x4f2e('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x4f2e('0x14'));var db=require(_0x4f2e('0x15'))['db'];function respondWithStatusCode(_0xa2b864,_0x21010b){_0x21010b=_0x21010b||0xcc;return function(_0x927f94){if(_0x927f94){return _0xa2b864[_0x4f2e('0x16')](_0x21010b);}return _0xa2b864[_0x4f2e('0x17')](_0x21010b)[_0x4f2e('0x18')]();};}function respondWithResult(_0x4b1d31,_0x39c2da){_0x39c2da=_0x39c2da||0xc8;return function(_0x35c2e1){if(_0x35c2e1){return _0x4b1d31[_0x4f2e('0x17')](_0x39c2da)['json'](_0x35c2e1);}};}function respondWithFilteredResult(_0x129512,_0x3e00d7){return function(_0x3b3973){if(_0x3b3973){var _0x58258e=_0x3b3973['count'],_0x413f6e=_0x3e00d7[_0x4f2e('0x19')],_0x475502=_0x3e00d7['offset']+_0x3e00d7[_0x4f2e('0x1a')],_0x34b58b;if(_0x475502>=_0x58258e){_0x475502=_0x58258e;_0x34b58b=0xc8;}else{_0x34b58b=0xce;}_0x129512[_0x4f2e('0x17')](_0x34b58b);return _0x129512[_0x4f2e('0x1b')](_0x4f2e('0x1c'),_0x413f6e+'-'+_0x475502+'/'+_0x58258e)['json'](_0x3b3973);}return null;};}function patchUpdates(_0x41999f){return function(_0x2b0000){try{jsonpatch[_0x4f2e('0x1d')](_0x2b0000,_0x41999f,!![]);}catch(_0x2323ad){return BPromise['reject'](_0x2323ad);}return _0x2b0000[_0x4f2e('0x1e')]();};}function saveUpdates(_0xc5c369,_0x44b734){return function(_0x1c4d7d){if(_0x1c4d7d){return _0x1c4d7d[_0x4f2e('0x1f')](_0xc5c369)[_0x4f2e('0x20')](function(_0x3f8811){return _0x3f8811;});}return null;};}function removeEntity(_0x3ac7ff,_0x55d03b){return function(_0x5618ba){if(_0x5618ba){return _0x5618ba['destroy']()[_0x4f2e('0x20')](function(){_0x3ac7ff[_0x4f2e('0x17')](0xcc)[_0x4f2e('0x18')]();});}};}function handleEntityNotFound(_0x2b8bd0,_0x568e30){return function(_0x18ca6c){if(!_0x18ca6c){_0x2b8bd0['sendStatus'](0x194);}return _0x18ca6c;};}function handleError(_0x9de0fa,_0x401295){_0x401295=_0x401295||0x1f4;return function(_0x24d438){logger['error'](_0x24d438[_0x4f2e('0x21')]);if(_0x24d438[_0x4f2e('0x22')]){delete _0x24d438[_0x4f2e('0x22')];}_0x9de0fa['status'](_0x401295)[_0x4f2e('0x23')](_0x24d438);};}exports[_0x4f2e('0x24')]=function(_0x19e9d0,_0x58f760){var _0x16262c={},_0x3fd4a8={},_0x393041={'count':0x0,'rows':[]};var _0x1b965c=_['map'](db['DeskField'][_0x4f2e('0x25')],function(_0x5d9eb4){return{'name':_0x5d9eb4[_0x4f2e('0x26')],'type':_0x5d9eb4[_0x4f2e('0x27')]['key']};});_0x3fd4a8[_0x4f2e('0x28')]=_['map'](_0x1b965c,_0x4f2e('0x22'));_0x3fd4a8[_0x4f2e('0x29')]=_['keys'](_0x19e9d0[_0x4f2e('0x29')]);_0x3fd4a8['filters']=_[_0x4f2e('0x2a')](_0x3fd4a8[_0x4f2e('0x28')],_0x3fd4a8['query']);_0x16262c[_0x4f2e('0x2b')]=_[_0x4f2e('0x2a')](_0x3fd4a8[_0x4f2e('0x28')],qs[_0x4f2e('0x2c')](_0x19e9d0['query'][_0x4f2e('0x2c')]));_0x16262c['attributes']=_0x16262c[_0x4f2e('0x2b')][_0x4f2e('0x2d')]?_0x16262c['attributes']:_0x3fd4a8[_0x4f2e('0x28')];if(!_0x19e9d0[_0x4f2e('0x29')]['hasOwnProperty'](_0x4f2e('0x2e'))){_0x16262c[_0x4f2e('0x1a')]=qs[_0x4f2e('0x1a')](_0x19e9d0['query']['limit']);_0x16262c[_0x4f2e('0x19')]=qs[_0x4f2e('0x19')](_0x19e9d0['query'][_0x4f2e('0x19')]);}_0x16262c[_0x4f2e('0x2f')]=qs[_0x4f2e('0x30')](_0x19e9d0[_0x4f2e('0x29')]['sort']);_0x16262c[_0x4f2e('0x31')]=qs[_0x4f2e('0x32')](_[_0x4f2e('0x33')](_0x19e9d0[_0x4f2e('0x29')],_0x3fd4a8[_0x4f2e('0x32')]),_0x1b965c);if(_0x19e9d0[_0x4f2e('0x29')][_0x4f2e('0x34')]){_0x16262c[_0x4f2e('0x31')]=_['merge'](_0x16262c['where'],{'$or':_['map'](_0x1b965c,function(_0x6067d2){if(_0x6067d2[_0x4f2e('0x27')]!==_0x4f2e('0x35')){var _0x22af68={};_0x22af68[_0x6067d2[_0x4f2e('0x22')]]={'$like':'%'+_0x19e9d0[_0x4f2e('0x29')]['filter']+'%'};return _0x22af68;}})});}_0x16262c=_[_0x4f2e('0x36')]({},_0x16262c,_0x19e9d0[_0x4f2e('0x37')]);var _0x11f7e8={'where':_0x16262c[_0x4f2e('0x31')]};return db['DeskField'][_0x4f2e('0x38')](_0x11f7e8)[_0x4f2e('0x20')](function(_0x752999){_0x393041[_0x4f2e('0x38')]=_0x752999;if(_0x19e9d0[_0x4f2e('0x29')][_0x4f2e('0x39')]){_0x16262c['include']=[{'all':!![]}];}return db[_0x4f2e('0x3a')][_0x4f2e('0x3b')](_0x16262c);})[_0x4f2e('0x20')](function(_0x509ac2){_0x393041[_0x4f2e('0x3c')]=_0x509ac2;return _0x393041;})[_0x4f2e('0x20')](respondWithFilteredResult(_0x58f760,_0x16262c))['catch'](handleError(_0x58f760,null));};exports[_0x4f2e('0x3d')]=function(_0x55ef5f,_0x315c59){var _0xdb1a47={'raw':!![],'where':{'id':_0x55ef5f['params']['id']}},_0x8e76e5={};_0x8e76e5[_0x4f2e('0x28')]=_[_0x4f2e('0x3e')](db[_0x4f2e('0x3a')][_0x4f2e('0x25')]);_0x8e76e5['query']=_[_0x4f2e('0x3e')](_0x55ef5f[_0x4f2e('0x29')]);_0x8e76e5[_0x4f2e('0x32')]=_[_0x4f2e('0x2a')](_0x8e76e5[_0x4f2e('0x28')],_0x8e76e5[_0x4f2e('0x29')]);_0xdb1a47[_0x4f2e('0x2b')]=_[_0x4f2e('0x2a')](_0x8e76e5[_0x4f2e('0x28')],qs[_0x4f2e('0x2c')](_0x55ef5f[_0x4f2e('0x29')]['fields']));_0xdb1a47[_0x4f2e('0x2b')]=_0xdb1a47[_0x4f2e('0x2b')]['length']?_0xdb1a47[_0x4f2e('0x2b')]:_0x8e76e5[_0x4f2e('0x28')];if(_0x55ef5f[_0x4f2e('0x29')][_0x4f2e('0x39')]){_0xdb1a47[_0x4f2e('0x3f')]=[{'all':!![]}];}_0xdb1a47=_['merge']({},_0xdb1a47,_0x55ef5f['options']);return db[_0x4f2e('0x3a')][_0x4f2e('0x40')](_0xdb1a47)['then'](handleEntityNotFound(_0x315c59,null))[_0x4f2e('0x20')](respondWithResult(_0x315c59,null))[_0x4f2e('0x41')](handleError(_0x315c59,null));};exports[_0x4f2e('0x42')]=function(_0x1fc622,_0x454b51){return db['DeskField'][_0x4f2e('0x42')](_0x1fc622['body'],{})[_0x4f2e('0x20')](respondWithResult(_0x454b51,0xc9))['catch'](handleError(_0x454b51,null));};exports[_0x4f2e('0x1f')]=function(_0x16ff36,_0x57b05b){if(_0x16ff36[_0x4f2e('0x43')]['id']){delete _0x16ff36[_0x4f2e('0x43')]['id'];}return db[_0x4f2e('0x3a')][_0x4f2e('0x40')]({'where':{'id':_0x16ff36['params']['id']}})[_0x4f2e('0x20')](handleEntityNotFound(_0x57b05b,null))[_0x4f2e('0x20')](saveUpdates(_0x16ff36[_0x4f2e('0x43')],null))['then'](respondWithResult(_0x57b05b,null))[_0x4f2e('0x41')](handleError(_0x57b05b,null));};exports[_0x4f2e('0x44')]=function(_0x235915,_0x1fa961){return db[_0x4f2e('0x3a')][_0x4f2e('0x40')]({'where':{'id':_0x235915[_0x4f2e('0x45')]['id']}})[_0x4f2e('0x20')](handleEntityNotFound(_0x1fa961,null))[_0x4f2e('0x20')](removeEntity(_0x1fa961,null))[_0x4f2e('0x41')](handleError(_0x1fa961,null));}; \ No newline at end of file +var _0xeca9=['api','../../config/utils','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','DeskField','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x39c96c,_0x744843){var _0x1d8366=function(_0x5bea7f){while(--_0x5bea7f){_0x39c96c['push'](_0x39c96c['shift']());}};_0x1d8366(++_0x744843);}(_0xeca9,0x15e));var _0x9eca=function(_0x36d639,_0x3a9310){_0x36d639=_0x36d639-0x0;var _0x433ef5=_0xeca9[_0x36d639];return _0x433ef5;};'use strict';var pdf=require(_0x9eca('0x0'));var emlformat=require(_0x9eca('0x1'));var rimraf=require(_0x9eca('0x2'));var zipdir=require(_0x9eca('0x3'));var jsonpatch=require(_0x9eca('0x4'));var rp=require(_0x9eca('0x5'));var moment=require(_0x9eca('0x6'));var BPromise=require(_0x9eca('0x7'));var Mustache=require(_0x9eca('0x8'));var util=require(_0x9eca('0x9'));var path=require(_0x9eca('0xa'));var sox=require('sox');var csv=require(_0x9eca('0xb'));var ejs=require(_0x9eca('0xc'));var fs=require('fs');var _=require(_0x9eca('0xd'));var squel=require(_0x9eca('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9eca('0xf'));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(_0x9eca('0x10'));var as=require(_0x9eca('0x11'));var hardwareService=require(_0x9eca('0x12'));var logger=require(_0x9eca('0x13'))(_0x9eca('0x14'));var utils=require(_0x9eca('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27c908,_0x1ff4a2){_0x1ff4a2=_0x1ff4a2||0xcc;return function(_0x5ab220){if(_0x5ab220){return _0x27c908[_0x9eca('0x16')](_0x1ff4a2);}return _0x27c908[_0x9eca('0x17')](_0x1ff4a2)['end']();};}function respondWithResult(_0x1edf7d,_0x3cc3d2){_0x3cc3d2=_0x3cc3d2||0xc8;return function(_0x463774){if(_0x463774){return _0x1edf7d[_0x9eca('0x17')](_0x3cc3d2)[_0x9eca('0x18')](_0x463774);}};}function respondWithFilteredResult(_0x2fe9bc,_0x4ff082){return function(_0x3c149d){if(_0x3c149d){var _0x1469ab=_0x3c149d[_0x9eca('0x19')],_0x418026=_0x4ff082[_0x9eca('0x1a')],_0x591268=_0x4ff082[_0x9eca('0x1a')]+_0x4ff082[_0x9eca('0x1b')],_0x4ed327;if(_0x591268>=_0x1469ab){_0x591268=_0x1469ab;_0x4ed327=0xc8;}else{_0x4ed327=0xce;}_0x2fe9bc['status'](_0x4ed327);return _0x2fe9bc[_0x9eca('0x1c')](_0x9eca('0x1d'),_0x418026+'-'+_0x591268+'/'+_0x1469ab)['json'](_0x3c149d);}return null;};}function patchUpdates(_0x4c9b17){return function(_0x328c72){try{jsonpatch[_0x9eca('0x1e')](_0x328c72,_0x4c9b17,!![]);}catch(_0x325c6e){return BPromise[_0x9eca('0x1f')](_0x325c6e);}return _0x328c72[_0x9eca('0x20')]();};}function saveUpdates(_0x1d6931,_0x2c7289){return function(_0x41a07c){if(_0x41a07c){return _0x41a07c[_0x9eca('0x21')](_0x1d6931)[_0x9eca('0x22')](function(_0x1c760d){return _0x1c760d;});}return null;};}function removeEntity(_0x2f04c0,_0x423dc1){return function(_0x318700){if(_0x318700){return _0x318700[_0x9eca('0x23')]()[_0x9eca('0x22')](function(){_0x2f04c0[_0x9eca('0x17')](0xcc)[_0x9eca('0x24')]();});}};}function handleEntityNotFound(_0x5ef2d5,_0x6e4230){return function(_0xeb7d72){if(!_0xeb7d72){_0x5ef2d5[_0x9eca('0x16')](0x194);}return _0xeb7d72;};}function handleError(_0x4febe0,_0xaead8){_0xaead8=_0xaead8||0x1f4;return function(_0x488132){logger[_0x9eca('0x25')](_0x488132[_0x9eca('0x26')]);if(_0x488132[_0x9eca('0x27')]){delete _0x488132[_0x9eca('0x27')];}_0x4febe0[_0x9eca('0x17')](_0xaead8)[_0x9eca('0x28')](_0x488132);};}exports[_0x9eca('0x29')]=function(_0x1bdab0,_0x5bf780){var _0x301392={},_0x16a430={},_0x5dff2d={'count':0x0,'rows':[]};var _0x219a36=_[_0x9eca('0x2a')](db[_0x9eca('0x2b')]['rawAttributes'],function(_0x136ea4){return{'name':_0x136ea4['fieldName'],'type':_0x136ea4[_0x9eca('0x2c')][_0x9eca('0x2d')]};});_0x16a430[_0x9eca('0x2e')]=_[_0x9eca('0x2a')](_0x219a36,_0x9eca('0x27'));_0x16a430[_0x9eca('0x2f')]=_[_0x9eca('0x30')](_0x1bdab0['query']);_0x16a430['filters']=_['intersection'](_0x16a430[_0x9eca('0x2e')],_0x16a430[_0x9eca('0x2f')]);_0x301392[_0x9eca('0x31')]=_[_0x9eca('0x32')](_0x16a430[_0x9eca('0x2e')],qs[_0x9eca('0x33')](_0x1bdab0[_0x9eca('0x2f')][_0x9eca('0x33')]));_0x301392[_0x9eca('0x31')]=_0x301392[_0x9eca('0x31')][_0x9eca('0x34')]?_0x301392['attributes']:_0x16a430[_0x9eca('0x2e')];if(!_0x1bdab0[_0x9eca('0x2f')][_0x9eca('0x35')](_0x9eca('0x36'))){_0x301392[_0x9eca('0x1b')]=qs['limit'](_0x1bdab0[_0x9eca('0x2f')]['limit']);_0x301392[_0x9eca('0x1a')]=qs['offset'](_0x1bdab0['query']['offset']);}_0x301392[_0x9eca('0x37')]=qs['sort'](_0x1bdab0[_0x9eca('0x2f')][_0x9eca('0x38')]);_0x301392[_0x9eca('0x39')]=qs[_0x9eca('0x3a')](_[_0x9eca('0x3b')](_0x1bdab0[_0x9eca('0x2f')],_0x16a430[_0x9eca('0x3a')]),_0x219a36);if(_0x1bdab0[_0x9eca('0x2f')][_0x9eca('0x3c')]){_0x301392[_0x9eca('0x39')]=_['merge'](_0x301392[_0x9eca('0x39')],{'$or':_['map'](_0x219a36,function(_0x3b4c13){if(_0x3b4c13[_0x9eca('0x2c')]!==_0x9eca('0x3d')){var _0xe02dae={};_0xe02dae[_0x3b4c13[_0x9eca('0x27')]]={'$like':'%'+_0x1bdab0['query'][_0x9eca('0x3c')]+'%'};return _0xe02dae;}})});}_0x301392=_[_0x9eca('0x3e')]({},_0x301392,_0x1bdab0[_0x9eca('0x3f')]);var _0x3bc2f7={'where':_0x301392['where']};return db['DeskField'][_0x9eca('0x19')](_0x3bc2f7)[_0x9eca('0x22')](function(_0x43fadc){_0x5dff2d[_0x9eca('0x19')]=_0x43fadc;if(_0x1bdab0['query'][_0x9eca('0x40')]){_0x301392[_0x9eca('0x41')]=[{'all':!![]}];}return db['DeskField'][_0x9eca('0x42')](_0x301392);})[_0x9eca('0x22')](function(_0x11bc48){_0x5dff2d['rows']=_0x11bc48;return _0x5dff2d;})[_0x9eca('0x22')](respondWithFilteredResult(_0x5bf780,_0x301392))[_0x9eca('0x43')](handleError(_0x5bf780,null));};exports[_0x9eca('0x44')]=function(_0x3e9d02,_0x2ce6c9){var _0x2dad7f={'raw':!![],'where':{'id':_0x3e9d02[_0x9eca('0x45')]['id']}},_0x297629={};_0x297629[_0x9eca('0x2e')]=_[_0x9eca('0x30')](db['DeskField'][_0x9eca('0x46')]);_0x297629[_0x9eca('0x2f')]=_[_0x9eca('0x30')](_0x3e9d02[_0x9eca('0x2f')]);_0x297629[_0x9eca('0x3a')]=_[_0x9eca('0x32')](_0x297629[_0x9eca('0x2e')],_0x297629['query']);_0x2dad7f[_0x9eca('0x31')]=_[_0x9eca('0x32')](_0x297629[_0x9eca('0x2e')],qs['fields'](_0x3e9d02[_0x9eca('0x2f')][_0x9eca('0x33')]));_0x2dad7f[_0x9eca('0x31')]=_0x2dad7f['attributes'][_0x9eca('0x34')]?_0x2dad7f[_0x9eca('0x31')]:_0x297629[_0x9eca('0x2e')];if(_0x3e9d02[_0x9eca('0x2f')][_0x9eca('0x40')]){_0x2dad7f[_0x9eca('0x41')]=[{'all':!![]}];}_0x2dad7f=_[_0x9eca('0x3e')]({},_0x2dad7f,_0x3e9d02[_0x9eca('0x3f')]);return db['DeskField']['find'](_0x2dad7f)['then'](handleEntityNotFound(_0x2ce6c9,null))[_0x9eca('0x22')](respondWithResult(_0x2ce6c9,null))['catch'](handleError(_0x2ce6c9,null));};exports[_0x9eca('0x47')]=function(_0x57888f,_0x5bcff6){return db[_0x9eca('0x2b')][_0x9eca('0x47')](_0x57888f[_0x9eca('0x48')],{})[_0x9eca('0x22')](respondWithResult(_0x5bcff6,0xc9))[_0x9eca('0x43')](handleError(_0x5bcff6,null));};exports[_0x9eca('0x21')]=function(_0x5da82c,_0x213995){if(_0x5da82c['body']['id']){delete _0x5da82c[_0x9eca('0x48')]['id'];}return db[_0x9eca('0x2b')][_0x9eca('0x49')]({'where':{'id':_0x5da82c[_0x9eca('0x45')]['id']}})[_0x9eca('0x22')](handleEntityNotFound(_0x213995,null))[_0x9eca('0x22')](saveUpdates(_0x5da82c[_0x9eca('0x48')],null))['then'](respondWithResult(_0x213995,null))[_0x9eca('0x43')](handleError(_0x213995,null));};exports['destroy']=function(_0x5d45a6,_0x16b201){return db[_0x9eca('0x2b')]['find']({'where':{'id':_0x5d45a6[_0x9eca('0x45')]['id']}})[_0x9eca('0x22')](handleEntityNotFound(_0x16b201,null))[_0x9eca('0x22')](removeEntity(_0x16b201,null))[_0x9eca('0x43')](handleError(_0x16b201,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index e3cf99e..aa92174 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 _0x1775=['FieldId','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','int_desk_fields','desk_unique_index','idField'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x1775,0xa9));var _0x5177=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1775[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x5177('0x0'));var util=require('util');var logger=require(_0x5177('0x1'))('api');var moment=require(_0x5177('0x2'));var BPromise=require('bluebird');var rp=require(_0x5177('0x3'));var fs=require('fs');var path=require(_0x5177('0x4'));var rimraf=require(_0x5177('0x5'));var config=require(_0x5177('0x6'));var attributes=require(_0x5177('0x7'));module[_0x5177('0x8')]=function(_0x4796f8,_0x454120){return _0x4796f8[_0x5177('0x9')]('DeskField',attributes,{'tableName':_0x5177('0xa'),'paranoid':![],'indexes':[{'name':_0x5177('0xb'),'fields':[_0x5177('0xc'),_0x5177('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x05df=['DeskField','int_desk_fields','desk_unique_index','idField','lodash','util','moment','bluebird','rimraf','../../config/environment','./intDeskField.attributes','exports','define'];(function(_0x4f4ff3,_0x3b311e){var _0x4dba1f=function(_0x2823bb){while(--_0x2823bb){_0x4f4ff3['push'](_0x4f4ff3['shift']());}};_0x4dba1f(++_0x3b311e);}(_0x05df,0xad));var _0xf05d=function(_0xb1edcf,_0x342814){_0xb1edcf=_0xb1edcf-0x0;var _0x26ff0e=_0x05df[_0xb1edcf];return _0x26ff0e;};'use strict';var _=require(_0xf05d('0x0'));var util=require(_0xf05d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf05d('0x2'));var BPromise=require(_0xf05d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf05d('0x4'));var config=require(_0xf05d('0x5'));var attributes=require(_0xf05d('0x6'));module[_0xf05d('0x7')]=function(_0x3e770f,_0x866cbd){return _0x3e770f[_0xf05d('0x8')](_0xf05d('0x9'),attributes,{'tableName':_0xf05d('0xa'),'paranoid':![],'indexes':[{'name':_0xf05d('0xb'),'fields':[_0xf05d('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 9a4aead..4fd5a31 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 _0xab36=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','DeskField,\x20%s,\x20%s,\x20%s','error','code','DeskField,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1d5fa9,_0xe54e51){var _0x30587d=function(_0x3bf93f){while(--_0x3bf93f){_0x1d5fa9['push'](_0x1d5fa9['shift']());}};_0x30587d(++_0xe54e51);}(_0xab36,0x1f4));var _0x6ab3=function(_0x534b70,_0x673fc0){_0x534b70=_0x534b70-0x0;var _0x386aef=_0xab36[_0x534b70];return _0x386aef;};'use strict';var _=require(_0x6ab3('0x0'));var util=require('util');var moment=require(_0x6ab3('0x1'));var BPromise=require(_0x6ab3('0x2'));var rs=require(_0x6ab3('0x3'));var fs=require('fs');var Redis=require(_0x6ab3('0x4'));var db=require(_0x6ab3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6ab3('0x6'))(_0x6ab3('0x7'));var config=require(_0x6ab3('0x8'));var jayson=require(_0x6ab3('0x9'));var client=jayson[_0x6ab3('0xa')][_0x6ab3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e47a7,_0x42cfef,_0x57319d){return new BPromise(function(_0x5b4d9b,_0x18bdbf){return client[_0x6ab3('0xc')](_0x4e47a7,_0x57319d)['then'](function(_0x2c225c){logger[_0x6ab3('0xd')]('DeskField,\x20%s,\x20%s',_0x42cfef,'request\x20sent');logger[_0x6ab3('0xe')](_0x6ab3('0xf'),_0x42cfef,'request\x20sent',JSON['stringify'](_0x2c225c));if(_0x2c225c[_0x6ab3('0x10')]){if(_0x2c225c['error'][_0x6ab3('0x11')]===0x1f4){logger[_0x6ab3('0x10')](_0x6ab3('0x12'),_0x42cfef,_0x2c225c[_0x6ab3('0x10')]['message']);return _0x18bdbf(_0x2c225c['error'][_0x6ab3('0x13')]);}logger[_0x6ab3('0x10')]('DeskField,\x20%s,\x20%s',_0x42cfef,_0x2c225c['error'][_0x6ab3('0x13')]);return _0x5b4d9b(_0x2c225c[_0x6ab3('0x10')]['message']);}else{logger[_0x6ab3('0xd')]('DeskField,\x20%s,\x20%s',_0x42cfef,_0x6ab3('0x14'));_0x5b4d9b(_0x2c225c[_0x6ab3('0x15')][_0x6ab3('0x13')]);}})[_0x6ab3('0x16')](function(_0x378267){logger['error'](_0x6ab3('0x12'),_0x42cfef,_0x378267);_0x18bdbf(_0x378267);});});} \ No newline at end of file +var _0x7399=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','debug','stringify','error','DeskField,\x20%s,\x20%s','message','request\x20sent','catch','lodash'];(function(_0xde429,_0x4b63a6){var _0x59feac=function(_0x1a34f2){while(--_0x1a34f2){_0xde429['push'](_0xde429['shift']());}};_0x59feac(++_0x4b63a6);}(_0x7399,0x1e2));var _0x9739=function(_0x51aee0,_0x253ba6){_0x51aee0=_0x51aee0-0x0;var _0x483ac7=_0x7399[_0x51aee0];return _0x483ac7;};'use strict';var _=require(_0x9739('0x0'));var util=require(_0x9739('0x1'));var moment=require(_0x9739('0x2'));var BPromise=require(_0x9739('0x3'));var rs=require(_0x9739('0x4'));var fs=require('fs');var Redis=require(_0x9739('0x5'));var db=require(_0x9739('0x6'))['db'];var utils=require(_0x9739('0x7'));var logger=require(_0x9739('0x8'))(_0x9739('0x9'));var config=require(_0x9739('0xa'));var jayson=require(_0x9739('0xb'));var client=jayson['client'][_0x9739('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3c34fa,_0x34c2bf,_0x372bb8){return new BPromise(function(_0xcccd23,_0x483655){return client['request'](_0x3c34fa,_0x372bb8)['then'](function(_0x5983de){logger[_0x9739('0xd')]('DeskField,\x20%s,\x20%s',_0x34c2bf,'request\x20sent');logger[_0x9739('0xe')]('DeskField,\x20%s,\x20%s,\x20%s',_0x34c2bf,'request\x20sent',JSON[_0x9739('0xf')](_0x5983de));if(_0x5983de['error']){if(_0x5983de['error']['code']===0x1f4){logger[_0x9739('0x10')](_0x9739('0x11'),_0x34c2bf,_0x5983de[_0x9739('0x10')][_0x9739('0x12')]);return _0x483655(_0x5983de[_0x9739('0x10')]['message']);}logger[_0x9739('0x10')](_0x9739('0x11'),_0x34c2bf,_0x5983de['error'][_0x9739('0x12')]);return _0xcccd23(_0x5983de[_0x9739('0x10')][_0x9739('0x12')]);}else{logger['info'](_0x9739('0x11'),_0x34c2bf,_0x9739('0x13'));_0xcccd23(_0x5983de['result'][_0x9739('0x12')]);}})[_0x9739('0x14')](function(_0x3bf671){logger[_0x9739('0x10')](_0x9739('0x11'),_0x34c2bf,_0x3bf671);_0x483655(_0x3bf671);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 6545121..2010744 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 _0x62c5=['create','addConfiguration','put','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','isAuthenticated','index','get','/:id','show','getConfigurations','getFields','post'];(function(_0x52aba5,_0x467f8f){var _0x3c7fd6=function(_0x4bafe9){while(--_0x4bafe9){_0x52aba5['push'](_0x52aba5['shift']());}};_0x3c7fd6(++_0x467f8f);}(_0x62c5,0xd4));var _0x562c=function(_0x3ce4a5,_0x50bc4b){_0x3ce4a5=_0x3ce4a5-0x0;var _0x3f5809=_0x62c5[_0x3ce4a5];return _0x3f5809;};'use strict';var multer=require(_0x562c('0x0'));var util=require(_0x562c('0x1'));var path=require(_0x562c('0x2'));var timeout=require(_0x562c('0x3'));var express=require(_0x562c('0x4'));var router=express[_0x562c('0x5')]();var auth=require(_0x562c('0x6'));var interaction=require(_0x562c('0x7'));var config=require(_0x562c('0x8'));var controller=require(_0x562c('0x9'));router['get']('/',auth[_0x562c('0xa')](),controller[_0x562c('0xb')]);router[_0x562c('0xc')](_0x562c('0xd'),auth[_0x562c('0xa')](),controller[_0x562c('0xe')]);router[_0x562c('0xc')]('/:id/configurations',auth[_0x562c('0xa')](),controller[_0x562c('0xf')]);router[_0x562c('0xc')]('/:id/fields',auth[_0x562c('0xa')](),controller[_0x562c('0x10')]);router[_0x562c('0x11')]('/',auth[_0x562c('0xa')](),controller[_0x562c('0x12')]);router[_0x562c('0x11')]('/:id/configurations',auth[_0x562c('0xa')](),controller[_0x562c('0x13')]);router[_0x562c('0x14')](_0x562c('0xd'),auth[_0x562c('0xa')](),controller[_0x562c('0x15')]);router['delete'](_0x562c('0xd'),auth['isAuthenticated'](),controller[_0x562c('0x16')]);module['exports']=router; \ No newline at end of file +var _0x2ec1=['isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','/:id','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','index','get'];(function(_0x35ff34,_0x279c41){var _0x9a2693=function(_0x3a9937){while(--_0x3a9937){_0x35ff34['push'](_0x35ff34['shift']());}};_0x9a2693(++_0x279c41);}(_0x2ec1,0x64));var _0x12ec=function(_0x37357f,_0x3b23bb){_0x37357f=_0x37357f-0x0;var _0x505ef9=_0x2ec1[_0x37357f];return _0x505ef9;};'use strict';var multer=require(_0x12ec('0x0'));var util=require('util');var path=require(_0x12ec('0x1'));var timeout=require(_0x12ec('0x2'));var express=require(_0x12ec('0x3'));var router=express[_0x12ec('0x4')]();var auth=require(_0x12ec('0x5'));var interaction=require(_0x12ec('0x6'));var config=require('../../config/environment');var controller=require(_0x12ec('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x12ec('0x8')]);router[_0x12ec('0x9')]('/:id',auth[_0x12ec('0xa')](),controller['show']);router[_0x12ec('0x9')](_0x12ec('0xb'),auth[_0x12ec('0xa')](),controller[_0x12ec('0xc')]);router[_0x12ec('0x9')](_0x12ec('0xd'),auth[_0x12ec('0xa')](),controller[_0x12ec('0xe')]);router[_0x12ec('0xf')]('/',auth[_0x12ec('0xa')](),controller[_0x12ec('0x10')]);router[_0x12ec('0xf')](_0x12ec('0xb'),auth[_0x12ec('0xa')](),controller['addConfiguration']);router[_0x12ec('0x11')]('/:id',auth[_0x12ec('0xa')](),controller[_0x12ec('0x12')]);router[_0x12ec('0x13')](_0x12ec('0x14'),auth['isAuthenticated'](),controller['destroy']);module[_0x12ec('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 4814828..116e909 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 _0x6cab=['STRING','sequelize','exports'];(function(_0x962fc5,_0x58f074){var _0x43667c=function(_0x5e6ec0){while(--_0x5e6ec0){_0x962fc5['push'](_0x962fc5['shift']());}};_0x43667c(++_0x58f074);}(_0x6cab,0x1c6));var _0xb6ca=function(_0x3e6729,_0x16d4af){_0x3e6729=_0x3e6729-0x0;var _0x535bcd=_0x6cab[_0x3e6729];return _0x535bcd;};'use strict';var Sequelize=require(_0xb6ca('0x0'));module[_0xb6ca('0x1')]={'name':{'type':Sequelize[_0xb6ca('0x2')]},'username':{'type':Sequelize[_0xb6ca('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xb6ca('0x2')]},'tenantId':{'type':Sequelize[_0xb6ca('0x2')]},'clientId':{'type':Sequelize[_0xb6ca('0x2')]},'clientSecret':{'type':Sequelize[_0xb6ca('0x2')]},'serverUrl':{'type':Sequelize[_0xb6ca('0x2')]},'description':{'type':Sequelize[_0xb6ca('0x2')]}}; \ No newline at end of file +var _0x6d9b=['exports','STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6d9b,0x179));var _0xb6d9=function(_0x4072e6,_0x47b693){_0x4072e6=_0x4072e6-0x0;var _0x1c5980=_0x6d9b[_0x4072e6];return _0x1c5980;};'use strict';var Sequelize=require(_0xb6d9('0x0'));module[_0xb6d9('0x1')]={'name':{'type':Sequelize[_0xb6d9('0x2')]},'username':{'type':Sequelize[_0xb6d9('0x2')]},'password':{'type':Sequelize[_0xb6d9('0x2')]},'remoteUri':{'type':Sequelize[_0xb6d9('0x2')]},'tenantId':{'type':Sequelize[_0xb6d9('0x2')]},'clientId':{'type':Sequelize[_0xb6d9('0x2')]},'clientSecret':{'type':Sequelize[_0xb6d9('0x2')]},'serverUrl':{'type':Sequelize[_0xb6d9('0x2')]},'description':{'type':Sequelize[_0xb6d9('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 8c5d5c7..e0e7ba9 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 _0xdfef=['order','sort','filters','pick','filter','where','type','VIRTUAL','merge','count','includeAll','include','findAll','show','params','length','options','catch','create','body','find','findOne','Dynamics365Configuration','getConfigurations','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','getFields','ticketType','incident','Incident','title','description','customerid','ownerid','phonenumber','directioncode','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','owneridname','owneridtype','owneridyominame','prioritycodename','productserialnumber','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','slaname','socialprofileidname','statecode','subjectidname','ticketnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','remoteUri','clientId','clientSecret','slice','lastIndexOf','format','%s/api/data/v9.0/','POST','tenantId','/oauth2/token','password','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','EntityDefinitions(','4.0','Attributes','remove','includes','@odata.type','PicklistAttributeMetadata','push','MetadataId','isNil','substring','BooleanAttributeMetadata','all','forEach','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','send','Wrong\x20credentials','statusCode',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','Bearer\x20','OptionSet','Options','Label','UserLocalizedLabel','Value','LogicalName',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false','DisplayName','?$select=DisplayName,LogicalName','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','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','json','offset','limit','set','Content-Range','destroy','stack','name','index','Dynamics365Account','rawAttributes','fieldName','key','model','map','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit'];(function(_0x54442f,_0x58012f){var _0x4b7517=function(_0x362cf5){while(--_0x362cf5){_0x54442f['push'](_0x54442f['shift']());}};_0x4b7517(++_0x58012f);}(_0xdfef,0x95));var _0xfdfe=function(_0x30acaa,_0x3972b8){_0x30acaa=_0x30acaa-0x0;var _0x4ec91b=_0xdfef[_0x30acaa];return _0x4ec91b;};'use strict';var pdf=require(_0xfdfe('0x0'));var emlformat=require(_0xfdfe('0x1'));var rimraf=require(_0xfdfe('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfdfe('0x3'));var rp=require(_0xfdfe('0x4'));var moment=require(_0xfdfe('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfdfe('0x6'));var util=require(_0xfdfe('0x7'));var path=require(_0xfdfe('0x8'));var sox=require(_0xfdfe('0x9'));var csv=require(_0xfdfe('0xa'));var ejs=require(_0xfdfe('0xb'));var fs=require('fs');var _=require(_0xfdfe('0xc'));var squel=require(_0xfdfe('0xd'));var crypto=require(_0xfdfe('0xe'));var jsforce=require(_0xfdfe('0xf'));var deskjs=require(_0xfdfe('0x10'));var toCsv=require(_0xfdfe('0xa'));var querystring=require(_0xfdfe('0x11'));var Papa=require(_0xfdfe('0x12'));var Redis=require(_0xfdfe('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xfdfe('0x14'));var as=require(_0xfdfe('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfdfe('0x16'))(_0xfdfe('0x17'));var utils=require('../../config/utils');var config=require(_0xfdfe('0x18'));var db=require(_0xfdfe('0x19'))['db'];var integrations=require(_0xfdfe('0x1a'));var jayson=require(_0xfdfe('0x1b'));var client=jayson[_0xfdfe('0x1c')]['http']({'port':0x232a});function checkPasswordPattern(_0x1f97ef,_0x3c24ce,_0x94ce85){if(_0x94ce85){var _0xf40e8f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xf40e8f[_0xfdfe('0x1d')](_0x3c24ce)){return _0x1f97ef;}else{throw new db['Sequelize']['ValidationError'](_0xfdfe('0x1e'));}}else{return _0x1f97ef;}}function respondWithRpcPromise(_0x479afb,_0x41a355,_0x35a8bd,_0x4f228d){return new BPromise(function(_0x30d0be,_0x14f14f){var _0x21868a=_0x4f228d||client;return _0x21868a[_0xfdfe('0x1f')](_0x479afb,_0x35a8bd)[_0xfdfe('0x20')](function(_0x41d322){logger[_0xfdfe('0x21')](_0xfdfe('0x22'),_0x41a355,_0xfdfe('0x23'));logger[_0xfdfe('0x24')](_0xfdfe('0x25'),_0x41a355,_0xfdfe('0x23'),JSON[_0xfdfe('0x26')](_0x41d322));if(_0x41d322[_0xfdfe('0x27')]){if(_0x41d322[_0xfdfe('0x27')]['code']===0x1f4){logger[_0xfdfe('0x27')](_0xfdfe('0x22'),_0x41a355,_0x41d322[_0xfdfe('0x27')]['message']);return _0x14f14f(_0x41d322[_0xfdfe('0x27')][_0xfdfe('0x28')]);}logger['error'](_0xfdfe('0x22'),_0x41a355,_0x41d322[_0xfdfe('0x27')]['message']);return _0x30d0be(_0x41d322['error'][_0xfdfe('0x28')]);}else{logger['info'](_0xfdfe('0x22'),_0x41a355,_0xfdfe('0x23'));_0x30d0be(_0x41d322[_0xfdfe('0x29')][_0xfdfe('0x28')]);}})['catch'](function(_0x29e56b){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x41a355,_0x29e56b);_0x14f14f(_0x29e56b);});});}function respondWithStatusCode(_0x1a462,_0x241cb7){_0x241cb7=_0x241cb7||0xcc;return function(_0x43576a){if(_0x43576a){return _0x1a462[_0xfdfe('0x2a')](_0x241cb7);}return _0x1a462[_0xfdfe('0x2b')](_0x241cb7)[_0xfdfe('0x2c')]();};}function respondWithResult(_0x2f7266,_0xd2ae34){_0xd2ae34=_0xd2ae34||0xc8;return function(_0x13765f){if(_0x13765f){return _0x2f7266[_0xfdfe('0x2b')](_0xd2ae34)[_0xfdfe('0x2d')](_0x13765f);}};}function respondWithFilteredResult(_0x294875,_0x22896a){return function(_0x1df4f6){if(_0x1df4f6){var _0x86be90=_0x1df4f6['count'],_0x3dc3c1=_0x22896a[_0xfdfe('0x2e')],_0x56ace6=_0x22896a['offset']+_0x22896a[_0xfdfe('0x2f')],_0x480d2e;if(_0x56ace6>=_0x86be90){_0x56ace6=_0x86be90;_0x480d2e=0xc8;}else{_0x480d2e=0xce;}_0x294875[_0xfdfe('0x2b')](_0x480d2e);return _0x294875[_0xfdfe('0x30')](_0xfdfe('0x31'),_0x3dc3c1+'-'+_0x56ace6+'/'+_0x86be90)[_0xfdfe('0x2d')](_0x1df4f6);}return null;};}function patchUpdates(_0xdd4514){return function(_0x5b57c1){try{jsonpatch['apply'](_0x5b57c1,_0xdd4514,!![]);}catch(_0x1c8c07){return BPromise['reject'](_0x1c8c07);}return _0x5b57c1['save']();};}function saveUpdates(_0x54564c,_0x5b3e94){return function(_0x2d0829){if(_0x2d0829){return _0x2d0829['update'](_0x54564c)[_0xfdfe('0x20')](function(_0x1e6eb8){return _0x1e6eb8;});}return null;};}function removeEntity(_0x4e1c0c,_0x11dda0){return function(_0x5a0759){if(_0x5a0759){return _0x5a0759[_0xfdfe('0x32')]()[_0xfdfe('0x20')](function(){_0x4e1c0c[_0xfdfe('0x2b')](0xcc)[_0xfdfe('0x2c')]();});}};}function handleEntityNotFound(_0x29e0d1,_0x3fa3f0){return function(_0x3ec196){if(!_0x3ec196){_0x29e0d1[_0xfdfe('0x2a')](0x194);}return _0x3ec196;};}function handleError(_0x28e460,_0x5573ed){_0x5573ed=_0x5573ed||0x1f4;return function(_0x1005c2){logger['error'](_0x1005c2[_0xfdfe('0x33')]);if(_0x1005c2[_0xfdfe('0x34')]){delete _0x1005c2[_0xfdfe('0x34')];}_0x28e460['status'](_0x5573ed)['send'](_0x1005c2);};}exports[_0xfdfe('0x35')]=function(_0x48c9dc,_0x32fe55){var _0x1140f1={},_0x970be3={},_0xd16694={'count':0x0,'rows':[]};var _0x381ca7=_['map'](db[_0xfdfe('0x36')][_0xfdfe('0x37')],function(_0x408186){return{'name':_0x408186[_0xfdfe('0x38')],'type':_0x408186['type'][_0xfdfe('0x39')]};});_0x970be3[_0xfdfe('0x3a')]=_[_0xfdfe('0x3b')](_0x381ca7,_0xfdfe('0x34'));_0x970be3[_0xfdfe('0x3c')]=_[_0xfdfe('0x3d')](_0x48c9dc[_0xfdfe('0x3c')]);_0x970be3['filters']=_[_0xfdfe('0x3e')](_0x970be3['model'],_0x970be3[_0xfdfe('0x3c')]);_0x1140f1['attributes']=_['intersection'](_0x970be3[_0xfdfe('0x3a')],qs[_0xfdfe('0x3f')](_0x48c9dc[_0xfdfe('0x3c')][_0xfdfe('0x3f')]));_0x1140f1[_0xfdfe('0x40')]=_0x1140f1[_0xfdfe('0x40')]['length']?_0x1140f1[_0xfdfe('0x40')]:_0x970be3[_0xfdfe('0x3a')];if(!_0x48c9dc[_0xfdfe('0x3c')][_0xfdfe('0x41')](_0xfdfe('0x42'))){_0x1140f1['limit']=qs[_0xfdfe('0x2f')](_0x48c9dc['query'][_0xfdfe('0x2f')]);_0x1140f1[_0xfdfe('0x2e')]=qs['offset'](_0x48c9dc[_0xfdfe('0x3c')][_0xfdfe('0x2e')]);}_0x1140f1[_0xfdfe('0x43')]=qs[_0xfdfe('0x44')](_0x48c9dc[_0xfdfe('0x3c')][_0xfdfe('0x44')]);_0x1140f1['where']=qs[_0xfdfe('0x45')](_[_0xfdfe('0x46')](_0x48c9dc[_0xfdfe('0x3c')],_0x970be3['filters']),_0x381ca7);if(_0x48c9dc[_0xfdfe('0x3c')][_0xfdfe('0x47')]){_0x1140f1[_0xfdfe('0x48')]=_['merge'](_0x1140f1['where'],{'$or':_[_0xfdfe('0x3b')](_0x381ca7,function(_0x4eb0c4){if(_0x4eb0c4[_0xfdfe('0x49')]!==_0xfdfe('0x4a')){var _0x1ffe52={};_0x1ffe52[_0x4eb0c4['name']]={'$like':'%'+_0x48c9dc[_0xfdfe('0x3c')][_0xfdfe('0x47')]+'%'};return _0x1ffe52;}})});}_0x1140f1=_[_0xfdfe('0x4b')]({},_0x1140f1,_0x48c9dc['options']);var _0x20a578={'where':_0x1140f1[_0xfdfe('0x48')]};return db['Dynamics365Account'][_0xfdfe('0x4c')](_0x20a578)[_0xfdfe('0x20')](function(_0x4c3ac0){_0xd16694['count']=_0x4c3ac0;if(_0x48c9dc[_0xfdfe('0x3c')][_0xfdfe('0x4d')]){_0x1140f1[_0xfdfe('0x4e')]=[{'all':!![]}];}return db['Dynamics365Account'][_0xfdfe('0x4f')](_0x1140f1);})[_0xfdfe('0x20')](function(_0x5c8ec7){_0xd16694['rows']=_0x5c8ec7;return _0xd16694;})[_0xfdfe('0x20')](respondWithFilteredResult(_0x32fe55,_0x1140f1))['catch'](handleError(_0x32fe55,null));};exports[_0xfdfe('0x50')]=function(_0x4c1a3b,_0x599408){var _0x2adfd={'raw':![],'where':{'id':_0x4c1a3b[_0xfdfe('0x51')]['id']}},_0x23ac06={};_0x23ac06[_0xfdfe('0x3a')]=_[_0xfdfe('0x3d')](db[_0xfdfe('0x36')]['rawAttributes']);_0x23ac06[_0xfdfe('0x3c')]=_['keys'](_0x4c1a3b['query']);_0x23ac06[_0xfdfe('0x45')]=_[_0xfdfe('0x3e')](_0x23ac06[_0xfdfe('0x3a')],_0x23ac06[_0xfdfe('0x3c')]);_0x2adfd['attributes']=_[_0xfdfe('0x3e')](_0x23ac06[_0xfdfe('0x3a')],qs[_0xfdfe('0x3f')](_0x4c1a3b[_0xfdfe('0x3c')]['fields']));_0x2adfd[_0xfdfe('0x40')]=_0x2adfd[_0xfdfe('0x40')][_0xfdfe('0x52')]?_0x2adfd[_0xfdfe('0x40')]:_0x23ac06[_0xfdfe('0x3a')];if(_0x4c1a3b[_0xfdfe('0x3c')]['includeAll']){_0x2adfd[_0xfdfe('0x4e')]=[{'all':!![]}];}_0x2adfd=_['merge']({},_0x2adfd,_0x4c1a3b[_0xfdfe('0x53')]);return db[_0xfdfe('0x36')]['find'](_0x2adfd)[_0xfdfe('0x20')](handleEntityNotFound(_0x599408,null))['then'](respondWithResult(_0x599408,null))[_0xfdfe('0x54')](handleError(_0x599408,null));};exports['create']=function(_0x17c42c,_0x1aed67){return db['Dynamics365Account'][_0xfdfe('0x55')](_0x17c42c[_0xfdfe('0x56')],{})[_0xfdfe('0x20')](respondWithResult(_0x1aed67,0xc9))[_0xfdfe('0x54')](handleError(_0x1aed67,null));};exports['update']=function(_0x5a254f,_0x30df07){if(_0x5a254f[_0xfdfe('0x56')]['id']){delete _0x5a254f[_0xfdfe('0x56')]['id'];}return db['Dynamics365Account'][_0xfdfe('0x57')]({'where':{'id':_0x5a254f['params']['id']}})[_0xfdfe('0x20')](handleEntityNotFound(_0x30df07,null))[_0xfdfe('0x20')](saveUpdates(_0x5a254f[_0xfdfe('0x56')],null))['then'](respondWithResult(_0x30df07,null))[_0xfdfe('0x54')](handleError(_0x30df07,null));};exports[_0xfdfe('0x32')]=function(_0xcbe6fd,_0x2dc2d4){return db[_0xfdfe('0x36')]['find']({'where':{'id':_0xcbe6fd[_0xfdfe('0x51')]['id']}})[_0xfdfe('0x20')](handleEntityNotFound(_0x2dc2d4,null))[_0xfdfe('0x20')](removeEntity(_0x2dc2d4,null))[_0xfdfe('0x54')](handleError(_0x2dc2d4,null));};exports['getConfigurations']=function(_0x491c7e,_0x8fa2c0,_0x3fbafc){var _0x48d590={};var _0x3acd73={};var _0x121dc1;var _0x1833c0;return db['Dynamics365Account'][_0xfdfe('0x58')]({'where':{'id':_0x491c7e['params']['id']}})[_0xfdfe('0x20')](handleEntityNotFound(_0x8fa2c0,null))[_0xfdfe('0x20')](function(_0x3a70d7){if(_0x3a70d7){_0x121dc1=_0x3a70d7;_0x3acd73['model']=_[_0xfdfe('0x3d')](db[_0xfdfe('0x59')][_0xfdfe('0x37')]);_0x3acd73[_0xfdfe('0x3c')]=_[_0xfdfe('0x3d')](_0x491c7e[_0xfdfe('0x3c')]);_0x3acd73[_0xfdfe('0x45')]=_[_0xfdfe('0x3e')](_0x3acd73[_0xfdfe('0x3a')],_0x3acd73[_0xfdfe('0x3c')]);_0x48d590[_0xfdfe('0x40')]=_['intersection'](_0x3acd73[_0xfdfe('0x3a')],qs[_0xfdfe('0x3f')](_0x491c7e['query'][_0xfdfe('0x3f')]));_0x48d590[_0xfdfe('0x40')]=_0x48d590[_0xfdfe('0x40')][_0xfdfe('0x52')]?_0x48d590[_0xfdfe('0x40')]:_0x3acd73[_0xfdfe('0x3a')];_0x48d590['order']=qs[_0xfdfe('0x44')](_0x491c7e[_0xfdfe('0x3c')][_0xfdfe('0x44')]);_0x48d590[_0xfdfe('0x48')]=qs[_0xfdfe('0x45')](_[_0xfdfe('0x46')](_0x491c7e[_0xfdfe('0x3c')],_0x3acd73[_0xfdfe('0x45')]));if(_0x491c7e[_0xfdfe('0x3c')][_0xfdfe('0x47')]){_0x48d590[_0xfdfe('0x48')]=_[_0xfdfe('0x4b')](_0x48d590[_0xfdfe('0x48')],{'$or':_[_0xfdfe('0x3b')](_0x48d590[_0xfdfe('0x40')],function(_0x91714b){var _0x453e78={};_0x453e78[_0x91714b]={'$like':'%'+_0x491c7e[_0xfdfe('0x3c')]['filter']+'%'};return _0x453e78;})});}_0x48d590=_[_0xfdfe('0x4b')]({},_0x48d590,_0x491c7e[_0xfdfe('0x53')]);return _0x121dc1['getConfigurations'](_0x48d590);}})[_0xfdfe('0x20')](function(_0x2a21ff){if(_0x2a21ff){_0x1833c0=_0x2a21ff['length'];if(!_0x491c7e[_0xfdfe('0x3c')]['hasOwnProperty'](_0xfdfe('0x42'))){_0x48d590[_0xfdfe('0x2f')]=qs[_0xfdfe('0x2f')](_0x491c7e[_0xfdfe('0x3c')]['limit']);_0x48d590['offset']=qs[_0xfdfe('0x2e')](_0x491c7e[_0xfdfe('0x3c')][_0xfdfe('0x2e')]);}return _0x121dc1[_0xfdfe('0x5a')](_0x48d590);}})['then'](function(_0x54297a){if(_0x54297a){return _0x54297a?{'count':_0x1833c0,'rows':_0x54297a}:null;}})[_0xfdfe('0x20')](respondWithResult(_0x8fa2c0,null))[_0xfdfe('0x54')](handleError(_0x8fa2c0,null));};exports[_0xfdfe('0x5b')]=function(_0x317c3e,_0x5f1e25,_0x1a7293){if(_0x317c3e[_0xfdfe('0x56')]['id']){delete _0x317c3e['body']['id'];}return db[_0xfdfe('0x36')][_0xfdfe('0x58')]({'where':{'id':_0x317c3e[_0xfdfe('0x51')]['id']}})[_0xfdfe('0x20')](handleEntityNotFound(_0x5f1e25,null))[_0xfdfe('0x20')](function(_0x395689){if(_0x395689){_0x317c3e[_0xfdfe('0x56')]['AccountId']=_0x395689['id'];_0x317c3e[_0xfdfe('0x56')][_0xfdfe('0x5c')]=integrations[_0xfdfe('0x5d')](_0x317c3e['body'][_0xfdfe('0x5e')],_0x317c3e[_0xfdfe('0x56')][_0xfdfe('0x49')]);_0x317c3e[_0xfdfe('0x56')][_0xfdfe('0x5f')]=integrations[_0xfdfe('0x60')](_0x317c3e['body']['channel'],_0x317c3e['body']['type']);return db[_0xfdfe('0x59')][_0xfdfe('0x55')](_0x317c3e['body'],{'include':[{'model':db[_0xfdfe('0x61')],'as':_0xfdfe('0x5c')},{'model':db[_0xfdfe('0x61')],'as':_0xfdfe('0x5f')}]});}return null;})['then'](respondWithResult(_0x5f1e25,null))['catch'](handleError(_0x5f1e25,null));};exports[_0xfdfe('0x62')]=function(_0x1d83a8,_0x467942,_0x1db17b){var _0x41a62e=_0x1d83a8[_0xfdfe('0x3c')][_0xfdfe('0x63')];var _0x5a3233=_0x41a62e===_0xfdfe('0x64')?_0xfdfe('0x65'):'PhoneCall';var _0x4106ee='';var _0x2a7be2='';var _0x5b06c8='';var _0x4e8aea='';var _0x1adc32='';var _0x435112='';var _0xd64aa3='';var _0x26e36b='';var _0x168d8c=[_0xfdfe('0x66'),_0xfdfe('0x67'),_0xfdfe('0x68'),_0xfdfe('0x69'),'caseorigincode','subject',_0xfdfe('0x6a'),'regardingobjectid',_0xfdfe('0x6b'),'phonecall_activity_parties'];var _0x1dce0f=[_0xfdfe('0x6c'),_0xfdfe('0x6d'),_0xfdfe('0x6e'),_0xfdfe('0x6f'),_0xfdfe('0x70'),_0xfdfe('0x71'),_0xfdfe('0x72'),_0xfdfe('0x73'),'createdbyexternalpartyname','createdbyexternalpartyyominame',_0xfdfe('0x74'),_0xfdfe('0x75'),_0xfdfe('0x76'),_0xfdfe('0x77'),_0xfdfe('0x78'),'customeridname',_0xfdfe('0x79'),_0xfdfe('0x7a'),_0xfdfe('0x7b'),'entitlementidname',_0xfdfe('0x7c'),_0xfdfe('0x7d'),_0xfdfe('0x7e'),_0xfdfe('0x7f'),_0xfdfe('0x80'),_0xfdfe('0x81'),_0xfdfe('0x82'),_0xfdfe('0x83'),'kbarticleidname',_0xfdfe('0x84'),'masteridname',_0xfdfe('0x85'),_0xfdfe('0x86'),_0xfdfe('0x87'),'modifiedbyyominame',_0xfdfe('0x88'),'modifiedonbehalfbyname','modifiedonbehalfbyyominame',_0xfdfe('0x89'),_0xfdfe('0x8a'),'numberofchildincidents',_0xfdfe('0x8b'),'overriddencreatedon',_0xfdfe('0x8c'),_0xfdfe('0x8d'),_0xfdfe('0x8e'),'parentcaseidname','primarycontactidname','primarycontactidyominame',_0xfdfe('0x8f'),'productidname',_0xfdfe('0x90'),'resolveby',_0xfdfe('0x91'),_0xfdfe('0x92'),_0xfdfe('0x93'),_0xfdfe('0x94'),'sentimentvalue',_0xfdfe('0x95'),_0xfdfe('0x96'),_0xfdfe('0x97'),_0xfdfe('0x98'),'statuscode',_0xfdfe('0x99'),_0xfdfe('0x9a'),'timezoneruleversionnumber',_0xfdfe('0x9b'),_0xfdfe('0x9c'),_0xfdfe('0x9d'),_0xfdfe('0x9e')];var _0x93915c=_0x168d8c[_0xfdfe('0x9f')](_0x1dce0f);return db[_0xfdfe('0x36')][_0xfdfe('0x58')]({'where':{'id':_0x1d83a8[_0xfdfe('0x51')]['id']},'attributes':['id',_0xfdfe('0xa0'),'password',_0xfdfe('0xa1'),'tenantId',_0xfdfe('0xa2'),_0xfdfe('0xa3')]})[_0xfdfe('0x20')](handleEntityNotFound(_0x467942,null))[_0xfdfe('0x20')](function(_0x4d980e){if(_0x4d980e){_0x26e36b=_0x4d980e[_0xfdfe('0xa1')];var _0x2cc65b=_0x26e36b[_0xfdfe('0xa4')](-0x1);if(_0x2cc65b==='/'){_0x26e36b=_0x26e36b['substring'](0x0,_0x26e36b[_0xfdfe('0xa5')](_0x2cc65b));}_0xd64aa3=util[_0xfdfe('0xa6')](_0xfdfe('0xa7'),_0x26e36b);var _0x7091c1={'method':_0xfdfe('0xa8'),'uri':'https://login.microsoftonline.com/'+_0x4d980e[_0xfdfe('0xa9')]+_0xfdfe('0xaa'),'form':{'client_id':_0x4d980e[_0xfdfe('0xa2')],'resource':_0x26e36b,'username':_0x4d980e[_0xfdfe('0xa0')],'password':_0x4d980e['password'],'grant_type':_0xfdfe('0xab'),'client_secret':_0x4d980e[_0xfdfe('0xa3')]},'json':!![]};return rp(_0x7091c1);}})[_0xfdfe('0x20')](function(_0x192807){_0x435112=_0x192807[_0xfdfe('0xac')];var _0x3ead41={'method':_0xfdfe('0xad'),'uri':encodeURI(_0xd64aa3+_0xfdfe('0xae')+_0x5a3233+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x435112,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3ead41);})[_0xfdfe('0x20')](function(_0x5f57a7){var _0x56266b=_0x5f57a7['value'][0x0];var _0x285664=_0x56266b['MetadataId'];var _0x1ba88b={'method':_0xfdfe('0xad'),'uri':_0xd64aa3+_0xfdfe('0xaf')+_0x285664+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':'Bearer\x20'+_0x435112,'If-None-Match':null,'OData-Version':_0xfdfe('0xb0')},'json':!![]};return rp(_0x1ba88b);})[_0xfdfe('0x20')](function(_0x227320){_0x4106ee=_0x227320;_0x2a7be2=_0x4106ee[_0xfdfe('0xb1')];_0x2a7be2=_[_0xfdfe('0xb2')](_0x2a7be2,function(_0x25cf50){return!_0x93915c[_0xfdfe('0xb3')](_0x25cf50['LogicalName']);});var _0x3a8eb3=[];var _0x41e750=[];_0x2a7be2['forEach'](function(_0x5bf418){if(_0x5bf418[_0xfdfe('0xb4')]){var _0x3773b3=_0x5bf418[_0xfdfe('0xb4')]['substring'](_0x5bf418['@odata.type'][_0xfdfe('0xa5')]('.')+0x1);if(_0x3773b3===_0xfdfe('0xb5')){_0x3a8eb3[_0xfdfe('0xb6')](getSelectList(_0xd64aa3,_0x41a62e,_0x41e750,_0x4106ee[_0xfdfe('0xb7')],_0x5bf418[_0xfdfe('0xb7')],_0x435112));}}});return Promise['all'](_0x3a8eb3);})[_0xfdfe('0x20')](function(_0x1a71b9){_0x5b06c8=_0x1a71b9[0x0];var _0x55fba1=[];var _0x459c68=[];_0x2a7be2['forEach'](function(_0x180f17){if(!_[_0xfdfe('0xb8')](_0x180f17[_0xfdfe('0xb4')])){var _0x398f5d=_0x180f17[_0xfdfe('0xb4')][_0xfdfe('0xb9')](_0x180f17['@odata.type']['lastIndexOf']('.')+0x1);if(_0x398f5d===_0xfdfe('0xba')){_0x55fba1['push'](getBooleanList(_0xd64aa3,_0x41a62e,_0x459c68,_0x4106ee['MetadataId'],_0x180f17[_0xfdfe('0xb7')],_0x435112));}}});return Promise[_0xfdfe('0xbb')](_0x55fba1);})[_0xfdfe('0x20')](function(_0x4f64b6){_0x4e8aea=_0x4f64b6[0x0];var _0x597720=[];var _0x53b87b=[];_0x2a7be2[_0xfdfe('0xbc')](function(_0x5c9083){if(_0x5c9083[_0xfdfe('0xb4')]){var _0x7b9fee=_0x5c9083['@odata.type']['substring'](_0x5c9083[_0xfdfe('0xb4')][_0xfdfe('0xa5')]('.')+0x1);if(_0x7b9fee===_0xfdfe('0xbd')||_0x7b9fee===_0xfdfe('0xbe')||_0x7b9fee===_0xfdfe('0xbf')||_0x7b9fee===_0xfdfe('0xc0')||_0x7b9fee==='MemoAttributeMetadata'||_0x7b9fee===_0xfdfe('0xc1')||_0x7b9fee==='StatusAttributeMetadata'||_0x7b9fee===_0xfdfe('0xc2')||_0x7b9fee===_0xfdfe('0xc3')||_0x7b9fee===_0xfdfe('0xc4')){_0x597720[_0xfdfe('0xb6')](getInputList(_0xd64aa3,_0x41a62e,_0x7b9fee,_0x53b87b,_0x4106ee['MetadataId'],_0x5c9083['MetadataId'],_0x435112));}}});return Promise[_0xfdfe('0xbb')](_0x597720);})[_0xfdfe('0x20')](function(_0x22c94a){_0x1adc32=_0x22c94a[0x0];var _0x2ee53c=_0x5b06c8['concat'](_0x4e8aea)[_0xfdfe('0x9f')](_0x1adc32);var _0x225b12={'count':_0x2ee53c['length'],'rows':_0x2ee53c};return _0x225b12;})[_0xfdfe('0x20')](respondWithResult(_0x467942,null))[_0xfdfe('0x54')](function(_0x56ea86){var _0x3b00cd=_0x1d83a8['query'][_0xfdfe('0x1d')]?0x1f4:_0x56ea86['statusCode']||0x1f4;logger[_0xfdfe('0x27')](_0x56ea86[_0xfdfe('0x33')]);delete _0x56ea86[_0xfdfe('0x34')];if(_0x3b00cd===0x191){_0x3b00cd=0x190;}_0x467942['status'](_0x3b00cd)[_0xfdfe('0xc5')](_0x1d83a8['query'][_0xfdfe('0x1d')]?{'message':_0xfdfe('0xc6'),'statusCode':_0x56ea86[_0xfdfe('0xc7')]}:_0x56ea86);});};function getSelectList(_0xb4d435,_0x5f1556,_0xd064b4,_0x1ee46b,_0xd88b11,_0x3e421a){var _0x1b1727={'method':_0xfdfe('0xad'),'uri':_0xb4d435+_0xfdfe('0xaf')+_0x1ee46b+')/Attributes('+_0xd88b11+_0xfdfe('0xc8')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0xfdfe('0xc9')+_0x3e421a,'If-None-Match':null,'OData-Version':_0xfdfe('0xb0')},'json':!![]};return rp(_0x1b1727)['then'](function(_0xb994f6){var _0x45768e=[];var _0x453014=_0xb994f6[_0xfdfe('0xca')][_0xfdfe('0xcb')];_0x453014[_0xfdfe('0xbc')](function(_0x463b89){_0x45768e['push']({'name':_0x463b89[_0xfdfe('0xcc')][_0xfdfe('0xcd')][_0xfdfe('0xcc')],'value':String(_0x463b89[_0xfdfe('0xce')])});});var _0x4a78d5={'id':_0x5f1556+'_'+_0xb994f6[_0xfdfe('0xcf')],'name':_0xb994f6['DisplayName']['UserLocalizedLabel']['Label'],'custom':![],'options':_0x45768e};_0xd064b4[_0xfdfe('0xb6')](_0x4a78d5);return _0xd064b4;});}function getBooleanList(_0x320b80,_0x979bd1,_0x128730,_0x3994a4,_0x4f9499,_0x499b20){var _0x597faf={'method':_0xfdfe('0xad'),'uri':_0x320b80+_0xfdfe('0xaf')+_0x3994a4+_0xfdfe('0xd0')+_0x4f9499+_0xfdfe('0xd1'),'headers':{'Authorization':_0xfdfe('0xc9')+_0x499b20,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x597faf)['then'](function(_0x5a23b3){var _0x38389a=[];_0x38389a[_0xfdfe('0xb6')]({'name':_0x5a23b3[_0xfdfe('0xca')][_0xfdfe('0xd2')][_0xfdfe('0xcc')][_0xfdfe('0xcd')][_0xfdfe('0xcc')],'value':_0xfdfe('0xd3')},{'name':_0x5a23b3[_0xfdfe('0xca')][_0xfdfe('0xd4')][_0xfdfe('0xcc')][_0xfdfe('0xcd')][_0xfdfe('0xcc')],'value':_0xfdfe('0xd5')});var _0x762612={'id':_0x979bd1+'_'+_0x5a23b3[_0xfdfe('0xcf')],'name':_0x5a23b3[_0xfdfe('0xd6')][_0xfdfe('0xcd')][_0xfdfe('0xcc')],'custom':![],'options':_0x38389a};_0x128730[_0xfdfe('0xb6')](_0x762612);return _0x128730;});}function getInputList(_0x1b9e9c,_0x2e06e8,_0x3212d1,_0x2f961b,_0x7b3eda,_0xba4044,_0x4dd1b6){var _0x5a7d5f={'method':_0xfdfe('0xad'),'uri':_0x1b9e9c+_0xfdfe('0xaf')+_0x7b3eda+_0xfdfe('0xd0')+_0xba4044+')/Microsoft.Dynamics.CRM.'+_0x3212d1+_0xfdfe('0xd7'),'headers':{'Authorization':_0xfdfe('0xc9')+_0x4dd1b6,'If-None-Match':null,'OData-Version':_0xfdfe('0xb0')},'json':!![]};return rp(_0x5a7d5f)[_0xfdfe('0x20')](function(_0x473d1d){var _0x29b6c1={'id':_0x2e06e8+'_'+_0x473d1d[_0xfdfe('0xcf')],'name':_0x473d1d[_0xfdfe('0xd6')][_0xfdfe('0xcd')]?_0x473d1d[_0xfdfe('0xd6')][_0xfdfe('0xcd')][_0xfdfe('0xcc')]:_0x473d1d[_0xfdfe('0xcf')],'custom':![],'options':[]};_0x2f961b[_0xfdfe('0xb6')](_0x29b6c1);return _0x2f961b;});} \ No newline at end of file +var _0xee29=['actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyyominame','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','primarycontactidname','primarycontactidyominame','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidyominame','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','username','password','remoteUri','tenantId','clientId','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','clientSecret','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','MetadataId','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','Attributes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','all','BooleanAttributeMetadata','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','test','statusCode','Wrong\x20credentials','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','FalseOption','DisplayName',')/Attributes(',')/Microsoft.Dynamics.CRM.','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../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','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','sendStatus','status','json','count','offset','apply','save','update','destroy','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','intersection','create','body','find','getConfigurations','addConfiguration','findOne','Subjects','getSubjects','Descriptions','getDescriptions','channel','Dynamics365Field','getFields','ticketType','Incident','PhoneCall','title','description','customerid','ownerid','subject','phonenumber','regardingobjectid','phonecall_activity_parties','accountidname','accountidyominame'];(function(_0x33aa12,_0x124178){var _0xed2764=function(_0x29d98a){while(--_0x29d98a){_0x33aa12['push'](_0x33aa12['shift']());}};_0xed2764(++_0x124178);}(_0xee29,0x142));var _0x9ee2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xee29[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x9ee2('0x0'));var emlformat=require(_0x9ee2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9ee2('0x2'));var jsonpatch=require(_0x9ee2('0x3'));var rp=require('request-promise');var moment=require(_0x9ee2('0x4'));var BPromise=require(_0x9ee2('0x5'));var Mustache=require(_0x9ee2('0x6'));var util=require(_0x9ee2('0x7'));var path=require('path');var sox=require(_0x9ee2('0x8'));var csv=require(_0x9ee2('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9ee2('0xa'));var squel=require(_0x9ee2('0xb'));var crypto=require('crypto');var jsforce=require(_0x9ee2('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9ee2('0x9'));var querystring=require('querystring');var Papa=require(_0x9ee2('0xd'));var Redis=require(_0x9ee2('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x9ee2('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9ee2('0x10'));var logger=require(_0x9ee2('0x11'))(_0x9ee2('0x12'));var utils=require(_0x9ee2('0x13'));var config=require(_0x9ee2('0x14'));var db=require(_0x9ee2('0x15'))['db'];var integrations=require(_0x9ee2('0x16'));var jayson=require(_0x9ee2('0x17'));var client=jayson[_0x9ee2('0x18')][_0x9ee2('0x19')]({'port':0x232a});function checkPasswordPattern(_0x49dfa2,_0x490c5a,_0x1f2feb){if(_0x1f2feb){var _0x47bf43=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x47bf43['test'](_0x490c5a)){return _0x49dfa2;}else{throw new db[(_0x9ee2('0x1a'))]['ValidationError'](_0x9ee2('0x1b'));}}else{return _0x49dfa2;}}function respondWithRpcPromise(_0x29b6ff,_0x1c4e76,_0x144951,_0x542644){return new BPromise(function(_0x2e41f4,_0x56b152){var _0x41188b=_0x542644||client;return _0x41188b[_0x9ee2('0x1c')](_0x29b6ff,_0x144951)[_0x9ee2('0x1d')](function(_0x24bf1e){logger['info'](_0x9ee2('0x1e'),_0x1c4e76,_0x9ee2('0x1f'));logger[_0x9ee2('0x20')](_0x9ee2('0x21'),_0x1c4e76,_0x9ee2('0x1f'),JSON['stringify'](_0x24bf1e));if(_0x24bf1e[_0x9ee2('0x22')]){if(_0x24bf1e[_0x9ee2('0x22')][_0x9ee2('0x23')]===0x1f4){logger[_0x9ee2('0x22')]('Dynamics365Account,\x20%s,\x20%s',_0x1c4e76,_0x24bf1e[_0x9ee2('0x22')][_0x9ee2('0x24')]);return _0x56b152(_0x24bf1e[_0x9ee2('0x22')][_0x9ee2('0x24')]);}logger['error'](_0x9ee2('0x1e'),_0x1c4e76,_0x24bf1e[_0x9ee2('0x22')]['message']);return _0x2e41f4(_0x24bf1e[_0x9ee2('0x22')][_0x9ee2('0x24')]);}else{logger[_0x9ee2('0x25')](_0x9ee2('0x1e'),_0x1c4e76,_0x9ee2('0x1f'));_0x2e41f4(_0x24bf1e['result'][_0x9ee2('0x24')]);}})[_0x9ee2('0x26')](function(_0x348cbb){logger[_0x9ee2('0x22')](_0x9ee2('0x1e'),_0x1c4e76,_0x348cbb);_0x56b152(_0x348cbb);});});}function respondWithStatusCode(_0x51e283,_0x524497){_0x524497=_0x524497||0xcc;return function(_0x48564a){if(_0x48564a){return _0x51e283[_0x9ee2('0x27')](_0x524497);}return _0x51e283[_0x9ee2('0x28')](_0x524497)['end']();};}function respondWithResult(_0x486929,_0x64ab15){_0x64ab15=_0x64ab15||0xc8;return function(_0x3b1955){if(_0x3b1955){return _0x486929[_0x9ee2('0x28')](_0x64ab15)[_0x9ee2('0x29')](_0x3b1955);}};}function respondWithFilteredResult(_0x5e3712,_0xb74e09){return function(_0x32aaa6){if(_0x32aaa6){var _0xb540db=_0x32aaa6[_0x9ee2('0x2a')],_0x309ffd=_0xb74e09[_0x9ee2('0x2b')],_0x4dfa7c=_0xb74e09['offset']+_0xb74e09['limit'],_0x575fd8;if(_0x4dfa7c>=_0xb540db){_0x4dfa7c=_0xb540db;_0x575fd8=0xc8;}else{_0x575fd8=0xce;}_0x5e3712[_0x9ee2('0x28')](_0x575fd8);return _0x5e3712['set']('Content-Range',_0x309ffd+'-'+_0x4dfa7c+'/'+_0xb540db)[_0x9ee2('0x29')](_0x32aaa6);}return null;};}function patchUpdates(_0x51dbb7){return function(_0x20d8bf){try{jsonpatch[_0x9ee2('0x2c')](_0x20d8bf,_0x51dbb7,!![]);}catch(_0x22e54b){return BPromise['reject'](_0x22e54b);}return _0x20d8bf[_0x9ee2('0x2d')]();};}function saveUpdates(_0x1c6a46,_0x9b7e8c){return function(_0x595ac0){if(_0x595ac0){return _0x595ac0[_0x9ee2('0x2e')](_0x1c6a46)[_0x9ee2('0x1d')](function(_0x2c93b0){return _0x2c93b0;});}return null;};}function removeEntity(_0xb6c1bd,_0x48e02b){return function(_0x1569ac){if(_0x1569ac){return _0x1569ac[_0x9ee2('0x2f')]()[_0x9ee2('0x1d')](function(){_0xb6c1bd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b79e4,_0x3efb3d){return function(_0xf774cb){if(!_0xf774cb){_0x4b79e4[_0x9ee2('0x27')](0x194);}return _0xf774cb;};}function handleError(_0x382125,_0x509d7c){_0x509d7c=_0x509d7c||0x1f4;return function(_0x5d8dc2){logger[_0x9ee2('0x22')](_0x5d8dc2[_0x9ee2('0x30')]);if(_0x5d8dc2[_0x9ee2('0x31')]){delete _0x5d8dc2[_0x9ee2('0x31')];}_0x382125[_0x9ee2('0x28')](_0x509d7c)[_0x9ee2('0x32')](_0x5d8dc2);};}exports[_0x9ee2('0x33')]=function(_0x57ddfe,_0x2f5a6b){var _0x1211cd={},_0x463135={},_0xe6bc1d={'count':0x0,'rows':[]};var _0x56e8cc=_[_0x9ee2('0x34')](db[_0x9ee2('0x35')][_0x9ee2('0x36')],function(_0x33e184){return{'name':_0x33e184[_0x9ee2('0x37')],'type':_0x33e184[_0x9ee2('0x38')][_0x9ee2('0x39')]};});_0x463135[_0x9ee2('0x3a')]=_['map'](_0x56e8cc,'name');_0x463135['query']=_['keys'](_0x57ddfe[_0x9ee2('0x3b')]);_0x463135[_0x9ee2('0x3c')]=_['intersection'](_0x463135[_0x9ee2('0x3a')],_0x463135[_0x9ee2('0x3b')]);_0x1211cd[_0x9ee2('0x3d')]=_['intersection'](_0x463135[_0x9ee2('0x3a')],qs[_0x9ee2('0x3e')](_0x57ddfe[_0x9ee2('0x3b')][_0x9ee2('0x3e')]));_0x1211cd[_0x9ee2('0x3d')]=_0x1211cd['attributes'][_0x9ee2('0x3f')]?_0x1211cd[_0x9ee2('0x3d')]:_0x463135['model'];if(!_0x57ddfe['query'][_0x9ee2('0x40')](_0x9ee2('0x41'))){_0x1211cd[_0x9ee2('0x42')]=qs['limit'](_0x57ddfe[_0x9ee2('0x3b')][_0x9ee2('0x42')]);_0x1211cd[_0x9ee2('0x2b')]=qs[_0x9ee2('0x2b')](_0x57ddfe['query'][_0x9ee2('0x2b')]);}_0x1211cd[_0x9ee2('0x43')]=qs[_0x9ee2('0x44')](_0x57ddfe[_0x9ee2('0x3b')][_0x9ee2('0x44')]);_0x1211cd[_0x9ee2('0x45')]=qs['filters'](_[_0x9ee2('0x46')](_0x57ddfe[_0x9ee2('0x3b')],_0x463135[_0x9ee2('0x3c')]),_0x56e8cc);if(_0x57ddfe['query'][_0x9ee2('0x47')]){_0x1211cd[_0x9ee2('0x45')]=_[_0x9ee2('0x48')](_0x1211cd['where'],{'$or':_[_0x9ee2('0x34')](_0x56e8cc,function(_0x88588){if(_0x88588['type']!=='VIRTUAL'){var _0x212f61={};_0x212f61[_0x88588['name']]={'$like':'%'+_0x57ddfe[_0x9ee2('0x3b')][_0x9ee2('0x47')]+'%'};return _0x212f61;}})});}_0x1211cd=_['merge']({},_0x1211cd,_0x57ddfe[_0x9ee2('0x49')]);var _0x3c3743={'where':_0x1211cd[_0x9ee2('0x45')]};return db[_0x9ee2('0x35')][_0x9ee2('0x2a')](_0x3c3743)[_0x9ee2('0x1d')](function(_0x278d3f){_0xe6bc1d[_0x9ee2('0x2a')]=_0x278d3f;if(_0x57ddfe[_0x9ee2('0x3b')][_0x9ee2('0x4a')]){_0x1211cd[_0x9ee2('0x4b')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x9ee2('0x4c')](_0x1211cd);})['then'](function(_0xd68421){_0xe6bc1d[_0x9ee2('0x4d')]=_0xd68421;return _0xe6bc1d;})[_0x9ee2('0x1d')](respondWithFilteredResult(_0x2f5a6b,_0x1211cd))[_0x9ee2('0x26')](handleError(_0x2f5a6b,null));};exports[_0x9ee2('0x4e')]=function(_0x1d64d2,_0x23ca77){var _0x185781={'raw':![],'where':{'id':_0x1d64d2[_0x9ee2('0x4f')]['id']}},_0x3828aa={};_0x3828aa[_0x9ee2('0x3a')]=_[_0x9ee2('0x50')](db['Dynamics365Account']['rawAttributes']);_0x3828aa['query']=_[_0x9ee2('0x50')](_0x1d64d2['query']);_0x3828aa['filters']=_[_0x9ee2('0x51')](_0x3828aa[_0x9ee2('0x3a')],_0x3828aa[_0x9ee2('0x3b')]);_0x185781[_0x9ee2('0x3d')]=_[_0x9ee2('0x51')](_0x3828aa[_0x9ee2('0x3a')],qs['fields'](_0x1d64d2[_0x9ee2('0x3b')][_0x9ee2('0x3e')]));_0x185781[_0x9ee2('0x3d')]=_0x185781['attributes'][_0x9ee2('0x3f')]?_0x185781[_0x9ee2('0x3d')]:_0x3828aa[_0x9ee2('0x3a')];if(_0x1d64d2[_0x9ee2('0x3b')][_0x9ee2('0x4a')]){_0x185781['include']=[{'all':!![]}];}_0x185781=_[_0x9ee2('0x48')]({},_0x185781,_0x1d64d2[_0x9ee2('0x49')]);return db[_0x9ee2('0x35')]['find'](_0x185781)['then'](handleEntityNotFound(_0x23ca77,null))[_0x9ee2('0x1d')](respondWithResult(_0x23ca77,null))['catch'](handleError(_0x23ca77,null));};exports['create']=function(_0x2a2a52,_0xc5c84e){return db[_0x9ee2('0x35')][_0x9ee2('0x52')](_0x2a2a52['body'],{})[_0x9ee2('0x1d')](respondWithResult(_0xc5c84e,0xc9))[_0x9ee2('0x26')](handleError(_0xc5c84e,null));};exports[_0x9ee2('0x2e')]=function(_0x35c022,_0x4f3403){if(_0x35c022[_0x9ee2('0x53')]['id']){delete _0x35c022[_0x9ee2('0x53')]['id'];}return db[_0x9ee2('0x35')][_0x9ee2('0x54')]({'where':{'id':_0x35c022[_0x9ee2('0x4f')]['id']}})[_0x9ee2('0x1d')](handleEntityNotFound(_0x4f3403,null))[_0x9ee2('0x1d')](saveUpdates(_0x35c022[_0x9ee2('0x53')],null))[_0x9ee2('0x1d')](respondWithResult(_0x4f3403,null))[_0x9ee2('0x26')](handleError(_0x4f3403,null));};exports[_0x9ee2('0x2f')]=function(_0x330efd,_0x6eb3a5){return db['Dynamics365Account'][_0x9ee2('0x54')]({'where':{'id':_0x330efd[_0x9ee2('0x4f')]['id']}})[_0x9ee2('0x1d')](handleEntityNotFound(_0x6eb3a5,null))[_0x9ee2('0x1d')](removeEntity(_0x6eb3a5,null))[_0x9ee2('0x26')](handleError(_0x6eb3a5,null));};exports['getConfigurations']=function(_0x340dea,_0x58bdbb,_0x363dc9){var _0x37dcb1={};var _0x5ca532={};var _0x2556d5;var _0x892a13;return db['Dynamics365Account']['findOne']({'where':{'id':_0x340dea[_0x9ee2('0x4f')]['id']}})[_0x9ee2('0x1d')](handleEntityNotFound(_0x58bdbb,null))[_0x9ee2('0x1d')](function(_0x3c6c7d){if(_0x3c6c7d){_0x2556d5=_0x3c6c7d;_0x5ca532['model']=_['keys'](db['Dynamics365Configuration'][_0x9ee2('0x36')]);_0x5ca532[_0x9ee2('0x3b')]=_[_0x9ee2('0x50')](_0x340dea[_0x9ee2('0x3b')]);_0x5ca532[_0x9ee2('0x3c')]=_['intersection'](_0x5ca532[_0x9ee2('0x3a')],_0x5ca532['query']);_0x37dcb1[_0x9ee2('0x3d')]=_['intersection'](_0x5ca532[_0x9ee2('0x3a')],qs['fields'](_0x340dea['query'][_0x9ee2('0x3e')]));_0x37dcb1[_0x9ee2('0x3d')]=_0x37dcb1[_0x9ee2('0x3d')][_0x9ee2('0x3f')]?_0x37dcb1['attributes']:_0x5ca532[_0x9ee2('0x3a')];_0x37dcb1[_0x9ee2('0x43')]=qs[_0x9ee2('0x44')](_0x340dea[_0x9ee2('0x3b')][_0x9ee2('0x44')]);_0x37dcb1[_0x9ee2('0x45')]=qs[_0x9ee2('0x3c')](_[_0x9ee2('0x46')](_0x340dea[_0x9ee2('0x3b')],_0x5ca532[_0x9ee2('0x3c')]));if(_0x340dea['query'][_0x9ee2('0x47')]){_0x37dcb1[_0x9ee2('0x45')]=_['merge'](_0x37dcb1[_0x9ee2('0x45')],{'$or':_['map'](_0x37dcb1['attributes'],function(_0x1c1bd0){var _0x3a9ea8={};_0x3a9ea8[_0x1c1bd0]={'$like':'%'+_0x340dea[_0x9ee2('0x3b')]['filter']+'%'};return _0x3a9ea8;})});}_0x37dcb1=_[_0x9ee2('0x48')]({},_0x37dcb1,_0x340dea[_0x9ee2('0x49')]);return _0x2556d5[_0x9ee2('0x55')](_0x37dcb1);}})['then'](function(_0x4e00d0){if(_0x4e00d0){_0x892a13=_0x4e00d0[_0x9ee2('0x3f')];if(!_0x340dea[_0x9ee2('0x3b')][_0x9ee2('0x40')](_0x9ee2('0x41'))){_0x37dcb1[_0x9ee2('0x42')]=qs[_0x9ee2('0x42')](_0x340dea[_0x9ee2('0x3b')][_0x9ee2('0x42')]);_0x37dcb1[_0x9ee2('0x2b')]=qs[_0x9ee2('0x2b')](_0x340dea['query'][_0x9ee2('0x2b')]);}return _0x2556d5[_0x9ee2('0x55')](_0x37dcb1);}})[_0x9ee2('0x1d')](function(_0x486c9b){if(_0x486c9b){return _0x486c9b?{'count':_0x892a13,'rows':_0x486c9b}:null;}})[_0x9ee2('0x1d')](respondWithResult(_0x58bdbb,null))['catch'](handleError(_0x58bdbb,null));};exports[_0x9ee2('0x56')]=function(_0x50198e,_0x29220e,_0x538abb){if(_0x50198e[_0x9ee2('0x53')]['id']){delete _0x50198e[_0x9ee2('0x53')]['id'];}return db[_0x9ee2('0x35')][_0x9ee2('0x57')]({'where':{'id':_0x50198e['params']['id']}})['then'](handleEntityNotFound(_0x29220e,null))['then'](function(_0x3d3363){if(_0x3d3363){_0x50198e[_0x9ee2('0x53')]['AccountId']=_0x3d3363['id'];_0x50198e[_0x9ee2('0x53')][_0x9ee2('0x58')]=integrations[_0x9ee2('0x59')](_0x50198e[_0x9ee2('0x53')]['channel'],_0x50198e[_0x9ee2('0x53')][_0x9ee2('0x38')]);_0x50198e['body'][_0x9ee2('0x5a')]=integrations[_0x9ee2('0x5b')](_0x50198e['body'][_0x9ee2('0x5c')],_0x50198e['body']['type']);return db['Dynamics365Configuration'][_0x9ee2('0x52')](_0x50198e[_0x9ee2('0x53')],{'include':[{'model':db[_0x9ee2('0x5d')],'as':_0x9ee2('0x58')},{'model':db['Dynamics365Field'],'as':_0x9ee2('0x5a')}]});}return null;})[_0x9ee2('0x1d')](respondWithResult(_0x29220e,null))[_0x9ee2('0x26')](handleError(_0x29220e,null));};exports[_0x9ee2('0x5e')]=function(_0x49bcbe,_0x59edee,_0x5e0098){var _0x53f653=_0x49bcbe[_0x9ee2('0x3b')][_0x9ee2('0x5f')];var _0x40add6=_0x53f653==='incident'?_0x9ee2('0x60'):_0x9ee2('0x61');var _0x5b6d74='';var _0x7ee165='';var _0xd34bfb='';var _0x256fcf='';var _0xa48772='';var _0x46229a='';var _0x57c52d='';var _0x175114='';var _0x2a4223=[_0x9ee2('0x62'),_0x9ee2('0x63'),_0x9ee2('0x64'),_0x9ee2('0x65'),'caseorigincode',_0x9ee2('0x66'),_0x9ee2('0x67'),_0x9ee2('0x68'),'directioncode',_0x9ee2('0x69')];var _0x48b481=[_0x9ee2('0x6a'),_0x9ee2('0x6b'),_0x9ee2('0x6c'),_0x9ee2('0x6d'),'contactidname',_0x9ee2('0x6e'),_0x9ee2('0x6f'),_0x9ee2('0x70'),_0x9ee2('0x71'),_0x9ee2('0x72'),_0x9ee2('0x73'),_0x9ee2('0x74'),_0x9ee2('0x75'),_0x9ee2('0x76'),_0x9ee2('0x77'),_0x9ee2('0x78'),'customeridtype',_0x9ee2('0x79'),_0x9ee2('0x7a'),_0x9ee2('0x7b'),_0x9ee2('0x7c'),_0x9ee2('0x7d'),_0x9ee2('0x7e'),_0x9ee2('0x7f'),_0x9ee2('0x80'),_0x9ee2('0x81'),_0x9ee2('0x82'),'influencescore',_0x9ee2('0x83'),'lastonholdtime',_0x9ee2('0x84'),_0x9ee2('0x85'),'modifiedbyexternalpartyyominame','modifiedbyname',_0x9ee2('0x86'),'modifiedon','modifiedonbehalfbyname',_0x9ee2('0x87'),_0x9ee2('0x88'),_0x9ee2('0x89'),_0x9ee2('0x8a'),_0x9ee2('0x8b'),_0x9ee2('0x8c'),_0x9ee2('0x8d'),_0x9ee2('0x8e'),_0x9ee2('0x8f'),'parentcaseidname',_0x9ee2('0x90'),_0x9ee2('0x91'),'prioritycodename','productidname',_0x9ee2('0x92'),_0x9ee2('0x93'),_0x9ee2('0x94'),_0x9ee2('0x95'),'responsiblecontactidname',_0x9ee2('0x96'),'sentimentvalue','slainvokedidname','slaname',_0x9ee2('0x97'),_0x9ee2('0x98'),_0x9ee2('0x99'),_0x9ee2('0x9a'),_0x9ee2('0x9b'),_0x9ee2('0x9c'),'transactioncurrencyidname',_0x9ee2('0x9d'),_0x9ee2('0x9e'),'versionnumber'];var _0x23c5b1=_0x2a4223['concat'](_0x48b481);return db[_0x9ee2('0x35')][_0x9ee2('0x57')]({'where':{'id':_0x49bcbe[_0x9ee2('0x4f')]['id']},'attributes':['id',_0x9ee2('0x9f'),_0x9ee2('0xa0'),_0x9ee2('0xa1'),_0x9ee2('0xa2'),_0x9ee2('0xa3'),'clientSecret']})['then'](handleEntityNotFound(_0x59edee,null))['then'](function(_0x1c8967){if(_0x1c8967){_0x175114=_0x1c8967[_0x9ee2('0xa1')];var _0x4bc94c=_0x175114[_0x9ee2('0xa4')](-0x1);if(_0x4bc94c==='/'){_0x175114=_0x175114[_0x9ee2('0xa5')](0x0,_0x175114[_0x9ee2('0xa6')](_0x4bc94c));}_0x57c52d=util[_0x9ee2('0xa7')](_0x9ee2('0xa8'),_0x175114);var _0x4f6863={'method':_0x9ee2('0xa9'),'uri':_0x9ee2('0xaa')+_0x1c8967[_0x9ee2('0xa2')]+_0x9ee2('0xab'),'form':{'client_id':_0x1c8967[_0x9ee2('0xa3')],'resource':_0x175114,'username':_0x1c8967[_0x9ee2('0x9f')],'password':_0x1c8967[_0x9ee2('0xa0')],'grant_type':'password','client_secret':_0x1c8967[_0x9ee2('0xac')]},'json':!![]};return rp(_0x4f6863);}})[_0x9ee2('0x1d')](function(_0x23ddcf){_0x46229a=_0x23ddcf['access_token'];var _0x2d683b={'method':'GET','uri':encodeURI(_0x57c52d+_0x9ee2('0xad')+_0x40add6+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x46229a,'If-None-Match':null,'OData-Version':_0x9ee2('0xae')},'json':!![]};return rp(_0x2d683b);})['then'](function(_0x38559f){var _0xf16ac9=_0x38559f[_0x9ee2('0xaf')][0x0];var _0x446b69=_0xf16ac9[_0x9ee2('0xb0')];var _0x1e2648={'method':_0x9ee2('0xb1'),'uri':_0x57c52d+_0x9ee2('0xb2')+_0x446b69+_0x9ee2('0xb3'),'headers':{'Authorization':_0x9ee2('0xb4')+_0x46229a,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1e2648);})['then'](function(_0x4884d7){_0x5b6d74=_0x4884d7;_0x7ee165=_0x5b6d74[_0x9ee2('0xb5')];_0x7ee165=_['remove'](_0x7ee165,function(_0xfac6be){return!_0x23c5b1['includes'](_0xfac6be[_0x9ee2('0xb6')]);});var _0x378a8c=[];var _0x29990f=[];_0x7ee165[_0x9ee2('0xb7')](function(_0x4e6bb1){if(_0x4e6bb1[_0x9ee2('0xb8')]){var _0x2166ea=_0x4e6bb1[_0x9ee2('0xb8')][_0x9ee2('0xa5')](_0x4e6bb1[_0x9ee2('0xb8')][_0x9ee2('0xa6')]('.')+0x1);if(_0x2166ea===_0x9ee2('0xb9')){_0x378a8c['push'](getSelectList(_0x57c52d,_0x53f653,_0x29990f,_0x5b6d74['MetadataId'],_0x4e6bb1['MetadataId'],_0x46229a));}}});return Promise[_0x9ee2('0xba')](_0x378a8c);})[_0x9ee2('0x1d')](function(_0xebe6ba){_0xd34bfb=_0xebe6ba[0x0];var _0x3ed3d6=[];var _0x3bcd77=[];_0x7ee165['forEach'](function(_0x2f78aa){if(!_['isNil'](_0x2f78aa['@odata.type'])){var _0x26c958=_0x2f78aa[_0x9ee2('0xb8')][_0x9ee2('0xa5')](_0x2f78aa[_0x9ee2('0xb8')][_0x9ee2('0xa6')]('.')+0x1);if(_0x26c958===_0x9ee2('0xbb')){_0x3ed3d6[_0x9ee2('0xbc')](getBooleanList(_0x57c52d,_0x53f653,_0x3bcd77,_0x5b6d74['MetadataId'],_0x2f78aa[_0x9ee2('0xb0')],_0x46229a));}}});return Promise[_0x9ee2('0xba')](_0x3ed3d6);})[_0x9ee2('0x1d')](function(_0x361044){_0x256fcf=_0x361044[0x0];var _0x4bcc90=[];var _0x1acd91=[];_0x7ee165[_0x9ee2('0xb7')](function(_0xead94d){if(_0xead94d[_0x9ee2('0xb8')]){var _0x10bab3=_0xead94d[_0x9ee2('0xb8')][_0x9ee2('0xa5')](_0xead94d['@odata.type'][_0x9ee2('0xa6')]('.')+0x1);if(_0x10bab3===_0x9ee2('0xbd')||_0x10bab3===_0x9ee2('0xbe')||_0x10bab3===_0x9ee2('0xbf')||_0x10bab3===_0x9ee2('0xc0')||_0x10bab3===_0x9ee2('0xc1')||_0x10bab3===_0x9ee2('0xc2')||_0x10bab3===_0x9ee2('0xc3')||_0x10bab3===_0x9ee2('0xc4')||_0x10bab3===_0x9ee2('0xc5')||_0x10bab3===_0x9ee2('0xc6')){_0x4bcc90['push'](getInputList(_0x57c52d,_0x53f653,_0x10bab3,_0x1acd91,_0x5b6d74['MetadataId'],_0xead94d[_0x9ee2('0xb0')],_0x46229a));}}});return Promise[_0x9ee2('0xba')](_0x4bcc90);})[_0x9ee2('0x1d')](function(_0x4f9753){_0xa48772=_0x4f9753[0x0];var _0x59f840=_0xd34bfb[_0x9ee2('0xc7')](_0x256fcf)['concat'](_0xa48772);var _0x13e561={'count':_0x59f840[_0x9ee2('0x3f')],'rows':_0x59f840};return _0x13e561;})[_0x9ee2('0x1d')](respondWithResult(_0x59edee,null))['catch'](function(_0x41d691){var _0x4d19fc=_0x49bcbe['query'][_0x9ee2('0xc8')]?0x1f4:_0x41d691[_0x9ee2('0xc9')]||0x1f4;logger['error'](_0x41d691[_0x9ee2('0x30')]);delete _0x41d691[_0x9ee2('0x31')];if(_0x4d19fc===0x191){_0x4d19fc=0x190;}_0x59edee[_0x9ee2('0x28')](_0x4d19fc)[_0x9ee2('0x32')](_0x49bcbe['query']['test']?{'message':_0x9ee2('0xca'),'statusCode':_0x41d691[_0x9ee2('0xc9')]}:_0x41d691);});};function getSelectList(_0x1239ba,_0x341139,_0x45a927,_0xdd41af,_0x751fd8,_0x44627b){var _0x32a217={'method':'GET','uri':_0x1239ba+_0x9ee2('0xb2')+_0xdd41af+')/Attributes('+_0x751fd8+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x9ee2('0xcb'),'headers':{'Authorization':'Bearer\x20'+_0x44627b,'If-None-Match':null,'OData-Version':_0x9ee2('0xae')},'json':!![]};return rp(_0x32a217)[_0x9ee2('0x1d')](function(_0x17ea0b){var _0x55399f=[];var _0x4c0f36=_0x17ea0b[_0x9ee2('0xcc')][_0x9ee2('0xcd')];_0x4c0f36[_0x9ee2('0xb7')](function(_0x3a3190){_0x55399f[_0x9ee2('0xbc')]({'name':_0x3a3190[_0x9ee2('0xce')][_0x9ee2('0xcf')][_0x9ee2('0xce')],'value':String(_0x3a3190[_0x9ee2('0xd0')])});});var _0x257fa4={'id':_0x341139+'_'+_0x17ea0b[_0x9ee2('0xb6')],'name':_0x17ea0b['DisplayName'][_0x9ee2('0xcf')]['Label'],'custom':![],'options':_0x55399f};_0x45a927['push'](_0x257fa4);return _0x45a927;});}function getBooleanList(_0x25b8d4,_0x5cc9cb,_0x3b04bf,_0x1e8187,_0x3af4e2,_0x25bffb){var _0x2466fa={'method':_0x9ee2('0xb1'),'uri':_0x25b8d4+'EntityDefinitions('+_0x1e8187+')/Attributes('+_0x3af4e2+_0x9ee2('0xd1'),'headers':{'Authorization':_0x9ee2('0xb4')+_0x25bffb,'If-None-Match':null,'OData-Version':_0x9ee2('0xae')},'json':!![]};return rp(_0x2466fa)[_0x9ee2('0x1d')](function(_0x59cf3d){var _0x42da2a=[];_0x42da2a[_0x9ee2('0xbc')]({'name':_0x59cf3d[_0x9ee2('0xcc')][_0x9ee2('0xd2')][_0x9ee2('0xce')][_0x9ee2('0xcf')]['Label'],'value':'true'},{'name':_0x59cf3d[_0x9ee2('0xcc')][_0x9ee2('0xd3')][_0x9ee2('0xce')][_0x9ee2('0xcf')][_0x9ee2('0xce')],'value':'false'});var _0x1b376a={'id':_0x5cc9cb+'_'+_0x59cf3d[_0x9ee2('0xb6')],'name':_0x59cf3d[_0x9ee2('0xd4')][_0x9ee2('0xcf')][_0x9ee2('0xce')],'custom':![],'options':_0x42da2a};_0x3b04bf[_0x9ee2('0xbc')](_0x1b376a);return _0x3b04bf;});}function getInputList(_0x4dcb3f,_0xfa46b8,_0x20d183,_0x2d7a36,_0x145c80,_0x3fe2ea,_0x22c522){var _0x54eb91={'method':'GET','uri':_0x4dcb3f+'EntityDefinitions('+_0x145c80+_0x9ee2('0xd5')+_0x3fe2ea+_0x9ee2('0xd6')+_0x20d183+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x9ee2('0xb4')+_0x22c522,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x54eb91)[_0x9ee2('0x1d')](function(_0x67ae59){var _0x3ae4d2={'id':_0xfa46b8+'_'+_0x67ae59[_0x9ee2('0xb6')],'name':_0x67ae59[_0x9ee2('0xd4')][_0x9ee2('0xcf')]?_0x67ae59['DisplayName']['UserLocalizedLabel']['Label']:_0x67ae59[_0x9ee2('0xb6')],'custom':![],'options':[]};_0x2d7a36['push'](_0x3ae4d2);return _0x2d7a36;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index caaf4d3..d55a9e2 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 _0x6e78=['../../components/integrations/configuration','exports','Dynamics365Account','util','../../config/logger','api','bluebird','request-promise','rimraf','./intDynamics365Account.attributes'];(function(_0x22f658,_0x3fbe14){var _0x5ac5db=function(_0x4870be){while(--_0x4870be){_0x22f658['push'](_0x22f658['shift']());}};_0x5ac5db(++_0x3fbe14);}(_0x6e78,0x143));var _0x86e7=function(_0x11128e,_0x2799a3){_0x11128e=_0x11128e-0x0;var _0x509ca2=_0x6e78[_0x11128e];return _0x509ca2;};'use strict';var _=require('lodash');var util=require(_0x86e7('0x0'));var logger=require(_0x86e7('0x1'))(_0x86e7('0x2'));var moment=require('moment');var BPromise=require(_0x86e7('0x3'));var rp=require(_0x86e7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x86e7('0x5'));var config=require('../../config/environment');var attributes=require(_0x86e7('0x6'));var integrations=require(_0x86e7('0x7'));module[_0x86e7('0x8')]=function(_0x5be236,_0x5950aa){return _0x5be236['define'](_0x86e7('0x9'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbff8=['util','api','moment','bluebird','request-promise','path','rimraf','./intDynamics365Account.attributes','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash'];(function(_0x55969b,_0x1ebe62){var _0x3d7fc1=function(_0x5f2dbe){while(--_0x5f2dbe){_0x55969b['push'](_0x55969b['shift']());}};_0x3d7fc1(++_0x1ebe62);}(_0xbff8,0xdc));var _0x8bff=function(_0x488f13,_0x33a322){_0x488f13=_0x488f13-0x0;var _0x2eb8df=_0xbff8[_0x488f13];return _0x2eb8df;};'use strict';var _=require(_0x8bff('0x0'));var util=require(_0x8bff('0x1'));var logger=require('../../config/logger')(_0x8bff('0x2'));var moment=require(_0x8bff('0x3'));var BPromise=require(_0x8bff('0x4'));var rp=require(_0x8bff('0x5'));var fs=require('fs');var path=require(_0x8bff('0x6'));var rimraf=require(_0x8bff('0x7'));var config=require('../../config/environment');var attributes=require(_0x8bff('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x8bff('0x9')]=function(_0x16af0e,_0x58c1df){return _0x16af0e[_0x8bff('0xa')](_0x8bff('0xb'),attributes,{'tableName':_0x8bff('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 3918673..cbe1462 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 _0x9576=['catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','Dynamics365Account,\x20%s,\x20%s','result','GetDynamics365Account','findAll','options','raw','where','limit','include','map','model','attributes','then','ShowDynamics365Account'];(function(_0x18c6ec,_0x27f083){var _0x3c2367=function(_0x8f3201){while(--_0x8f3201){_0x18c6ec['push'](_0x18c6ec['shift']());}};_0x3c2367(++_0x27f083);}(_0x9576,0x182));var _0x6957=function(_0x53fd4d,_0x53226d){_0x53fd4d=_0x53fd4d-0x0;var _0x14a43d=_0x9576[_0x53fd4d];return _0x14a43d;};'use strict';var _=require(_0x6957('0x0'));var util=require(_0x6957('0x1'));var moment=require(_0x6957('0x2'));var BPromise=require(_0x6957('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6957('0x4'))['db'];var utils=require(_0x6957('0x5'));var logger=require(_0x6957('0x6'))(_0x6957('0x7'));var config=require(_0x6957('0x8'));var jayson=require(_0x6957('0x9'));var client=jayson[_0x6957('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6d8af8,_0x3425fe,_0x70b8c4){return new BPromise(function(_0x2e5727,_0x6397fe){return client[_0x6957('0xb')](_0x6d8af8,_0x70b8c4)['then'](function(_0x28a4c6){logger[_0x6957('0xc')]('Dynamics365Account,\x20%s,\x20%s',_0x3425fe,'request\x20sent');logger[_0x6957('0xd')](_0x6957('0xe'),_0x3425fe,_0x6957('0xf'),JSON[_0x6957('0x10')](_0x28a4c6));if(_0x28a4c6[_0x6957('0x11')]){if(_0x28a4c6[_0x6957('0x11')][_0x6957('0x12')]===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x3425fe,_0x28a4c6['error'][_0x6957('0x13')]);return _0x6397fe(_0x28a4c6[_0x6957('0x11')][_0x6957('0x13')]);}logger[_0x6957('0x11')](_0x6957('0x14'),_0x3425fe,_0x28a4c6[_0x6957('0x11')][_0x6957('0x13')]);return _0x2e5727(_0x28a4c6['error']['message']);}else{logger['info'](_0x6957('0x14'),_0x3425fe,_0x6957('0xf'));_0x2e5727(_0x28a4c6[_0x6957('0x15')][_0x6957('0x13')]);}})['catch'](function(_0x14422d){logger['error'](_0x6957('0x14'),_0x3425fe,_0x14422d);_0x6397fe(_0x14422d);});});}exports[_0x6957('0x16')]=function(_0x49aa31){var _0x2ccd8e=this;return new Promise(function(_0x448ff6,_0x26b577){return db['Dynamics365Account'][_0x6957('0x17')]({'raw':_0x49aa31[_0x6957('0x18')]?_0x49aa31[_0x6957('0x18')][_0x6957('0x19')]===undefined?!![]:![]:!![],'where':_0x49aa31[_0x6957('0x18')]?_0x49aa31[_0x6957('0x18')][_0x6957('0x1a')]||null:null,'attributes':_0x49aa31[_0x6957('0x18')]?_0x49aa31['options']['attributes']||null:null,'limit':_0x49aa31[_0x6957('0x18')]?_0x49aa31[_0x6957('0x18')][_0x6957('0x1b')]||null:null,'include':_0x49aa31[_0x6957('0x18')]?_0x49aa31[_0x6957('0x18')][_0x6957('0x1c')]?_[_0x6957('0x1d')](_0x49aa31[_0x6957('0x18')]['include'],function(_0x2b2dcd){return{'model':db[_0x2b2dcd[_0x6957('0x1e')]],'as':_0x2b2dcd['as'],'attributes':_0x2b2dcd[_0x6957('0x1f')],'include':_0x2b2dcd[_0x6957('0x1c')]?_['map'](_0x2b2dcd['include'],function(_0xa1e6af){return{'model':db[_0xa1e6af[_0x6957('0x1e')]],'as':_0xa1e6af['as'],'attributes':_0xa1e6af['attributes'],'include':_0xa1e6af['include']?_[_0x6957('0x1d')](_0xa1e6af[_0x6957('0x1c')],function(_0x3bc22f){return{'model':db[_0x3bc22f['model']],'as':_0x3bc22f['as'],'attributes':_0x3bc22f[_0x6957('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6957('0x20')](function(_0x35ba67){logger[_0x6957('0xc')](_0x6957('0x16'),_0x49aa31);logger[_0x6957('0xd')](_0x6957('0x16'),_0x49aa31,JSON[_0x6957('0x10')](_0x35ba67));_0x448ff6(_0x35ba67);})['catch'](function(_0x2e7fe1){logger[_0x6957('0x11')](_0x6957('0x16'),_0x2e7fe1[_0x6957('0x13')],_0x49aa31);_0x26b577(_0x2ccd8e[_0x6957('0x11')](0x1f4,_0x2e7fe1[_0x6957('0x13')]));});});};exports[_0x6957('0x21')]=function(_0xef7f63){var _0x1300b1=this;return new Promise(function(_0x28994a,_0x3de770){return db['Dynamics365Account']['find']({'raw':_0xef7f63[_0x6957('0x18')]?_0xef7f63[_0x6957('0x18')][_0x6957('0x19')]===undefined?!![]:![]:!![],'where':_0xef7f63[_0x6957('0x18')]?_0xef7f63['options'][_0x6957('0x1a')]||null:null,'attributes':_0xef7f63[_0x6957('0x18')]?_0xef7f63[_0x6957('0x18')]['attributes']||null:null,'include':_0xef7f63['options']?_0xef7f63[_0x6957('0x18')][_0x6957('0x1c')]?_[_0x6957('0x1d')](_0xef7f63['options'][_0x6957('0x1c')],function(_0x1d40a7){return{'model':db[_0x1d40a7[_0x6957('0x1e')]],'as':_0x1d40a7['as'],'attributes':_0x1d40a7[_0x6957('0x1f')],'include':_0x1d40a7[_0x6957('0x1c')]?_[_0x6957('0x1d')](_0x1d40a7[_0x6957('0x1c')],function(_0xcbfba9){return{'model':db[_0xcbfba9[_0x6957('0x1e')]],'as':_0xcbfba9['as'],'attributes':_0xcbfba9['attributes'],'include':_0xcbfba9[_0x6957('0x1c')]?_[_0x6957('0x1d')](_0xcbfba9[_0x6957('0x1c')],function(_0x5edcae){return{'model':db[_0x5edcae['model']],'as':_0x5edcae['as'],'attributes':_0x5edcae['attributes']};}):[]};}):[]};}):[]:[]})[_0x6957('0x20')](function(_0x59a58e){logger['info'](_0x6957('0x21'),_0xef7f63);logger[_0x6957('0xd')]('ShowDynamics365Account',_0xef7f63,JSON['stringify'](_0x59a58e));_0x28994a(_0x59a58e);})[_0x6957('0x22')](function(_0x1fa233){logger[_0x6957('0x11')](_0x6957('0x21'),_0x1fa233[_0x6957('0x13')],_0xef7f63);_0x3de770(_0x1300b1['error'](0x1f4,_0x1fa233[_0x6957('0x13')]));});});}; \ No newline at end of file +var _0xcb04=['Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetDynamics365Account','options','attributes','include','map','model','catch','ShowDynamics365Account','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x23542b,_0x2eb861){var _0x3e6083=function(_0x4f5b21){while(--_0x4f5b21){_0x23542b['push'](_0x23542b['shift']());}};_0x3e6083(++_0x2eb861);}(_0xcb04,0x9a));var _0x4cb0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xcb04[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x4cb0('0x0'));var util=require(_0x4cb0('0x1'));var moment=require(_0x4cb0('0x2'));var BPromise=require(_0x4cb0('0x3'));var rs=require(_0x4cb0('0x4'));var fs=require('fs');var Redis=require(_0x4cb0('0x5'));var db=require(_0x4cb0('0x6'))['db'];var utils=require(_0x4cb0('0x7'));var logger=require(_0x4cb0('0x8'))(_0x4cb0('0x9'));var config=require('../../config/environment');var jayson=require(_0x4cb0('0xa'));var client=jayson[_0x4cb0('0xb')][_0x4cb0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1ddb52,_0x184a0a,_0x10f98a){return new BPromise(function(_0x362863,_0x3c5793){return client[_0x4cb0('0xd')](_0x1ddb52,_0x10f98a)[_0x4cb0('0xe')](function(_0x143072){logger[_0x4cb0('0xf')](_0x4cb0('0x10'),_0x184a0a,_0x4cb0('0x11'));logger[_0x4cb0('0x12')](_0x4cb0('0x13'),_0x184a0a,_0x4cb0('0x11'),JSON[_0x4cb0('0x14')](_0x143072));if(_0x143072['error']){if(_0x143072[_0x4cb0('0x15')][_0x4cb0('0x16')]===0x1f4){logger[_0x4cb0('0x15')](_0x4cb0('0x10'),_0x184a0a,_0x143072['error'][_0x4cb0('0x17')]);return _0x3c5793(_0x143072[_0x4cb0('0x15')][_0x4cb0('0x17')]);}logger[_0x4cb0('0x15')](_0x4cb0('0x10'),_0x184a0a,_0x143072[_0x4cb0('0x15')][_0x4cb0('0x17')]);return _0x362863(_0x143072[_0x4cb0('0x15')][_0x4cb0('0x17')]);}else{logger['info'](_0x4cb0('0x10'),_0x184a0a,_0x4cb0('0x11'));_0x362863(_0x143072[_0x4cb0('0x18')][_0x4cb0('0x17')]);}})['catch'](function(_0x5a7295){logger[_0x4cb0('0x15')](_0x4cb0('0x10'),_0x184a0a,_0x5a7295);_0x3c5793(_0x5a7295);});});}exports[_0x4cb0('0x19')]=function(_0x91d3b){var _0x248e22=this;return new Promise(function(_0x2a3a34,_0x9575ab){return db['Dynamics365Account']['findAll']({'raw':_0x91d3b[_0x4cb0('0x1a')]?_0x91d3b['options']['raw']===undefined?!![]:![]:!![],'where':_0x91d3b[_0x4cb0('0x1a')]?_0x91d3b[_0x4cb0('0x1a')]['where']||null:null,'attributes':_0x91d3b[_0x4cb0('0x1a')]?_0x91d3b[_0x4cb0('0x1a')][_0x4cb0('0x1b')]||null:null,'limit':_0x91d3b['options']?_0x91d3b[_0x4cb0('0x1a')]['limit']||null:null,'include':_0x91d3b[_0x4cb0('0x1a')]?_0x91d3b[_0x4cb0('0x1a')][_0x4cb0('0x1c')]?_[_0x4cb0('0x1d')](_0x91d3b['options'][_0x4cb0('0x1c')],function(_0xa1fd65){return{'model':db[_0xa1fd65['model']],'as':_0xa1fd65['as'],'attributes':_0xa1fd65['attributes'],'include':_0xa1fd65[_0x4cb0('0x1c')]?_[_0x4cb0('0x1d')](_0xa1fd65[_0x4cb0('0x1c')],function(_0x188623){return{'model':db[_0x188623[_0x4cb0('0x1e')]],'as':_0x188623['as'],'attributes':_0x188623[_0x4cb0('0x1b')],'include':_0x188623[_0x4cb0('0x1c')]?_[_0x4cb0('0x1d')](_0x188623[_0x4cb0('0x1c')],function(_0x3e28c0){return{'model':db[_0x3e28c0[_0x4cb0('0x1e')]],'as':_0x3e28c0['as'],'attributes':_0x3e28c0[_0x4cb0('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f3b9f){logger[_0x4cb0('0xf')](_0x4cb0('0x19'),_0x91d3b);logger[_0x4cb0('0x12')](_0x4cb0('0x19'),_0x91d3b,JSON['stringify'](_0x2f3b9f));_0x2a3a34(_0x2f3b9f);})[_0x4cb0('0x1f')](function(_0x4ba17a){logger[_0x4cb0('0x15')](_0x4cb0('0x19'),_0x4ba17a[_0x4cb0('0x17')],_0x91d3b);_0x9575ab(_0x248e22['error'](0x1f4,_0x4ba17a[_0x4cb0('0x17')]));});});};exports[_0x4cb0('0x20')]=function(_0x1abab2){var _0xe3ae3a=this;return new Promise(function(_0x501f41,_0x42ef6e){return db['Dynamics365Account']['find']({'raw':_0x1abab2[_0x4cb0('0x1a')]?_0x1abab2[_0x4cb0('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1abab2[_0x4cb0('0x1a')]?_0x1abab2['options'][_0x4cb0('0x21')]||null:null,'attributes':_0x1abab2[_0x4cb0('0x1a')]?_0x1abab2[_0x4cb0('0x1a')][_0x4cb0('0x1b')]||null:null,'include':_0x1abab2['options']?_0x1abab2[_0x4cb0('0x1a')][_0x4cb0('0x1c')]?_[_0x4cb0('0x1d')](_0x1abab2[_0x4cb0('0x1a')][_0x4cb0('0x1c')],function(_0xd2917c){return{'model':db[_0xd2917c[_0x4cb0('0x1e')]],'as':_0xd2917c['as'],'attributes':_0xd2917c['attributes'],'include':_0xd2917c[_0x4cb0('0x1c')]?_[_0x4cb0('0x1d')](_0xd2917c[_0x4cb0('0x1c')],function(_0x54624a){return{'model':db[_0x54624a['model']],'as':_0x54624a['as'],'attributes':_0x54624a['attributes'],'include':_0x54624a[_0x4cb0('0x1c')]?_['map'](_0x54624a[_0x4cb0('0x1c')],function(_0xd31fc6){return{'model':db[_0xd31fc6['model']],'as':_0xd31fc6['as'],'attributes':_0xd31fc6[_0x4cb0('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x444d7e){logger[_0x4cb0('0xf')](_0x4cb0('0x20'),_0x1abab2);logger[_0x4cb0('0x12')]('ShowDynamics365Account',_0x1abab2,JSON[_0x4cb0('0x14')](_0x444d7e));_0x501f41(_0x444d7e);})[_0x4cb0('0x1f')](function(_0x139efc){logger[_0x4cb0('0x15')](_0x4cb0('0x20'),_0x139efc[_0x4cb0('0x17')],_0x1abab2);_0x42ef6e(_0xe3ae3a[_0x4cb0('0x15')](0x1f4,_0x139efc[_0x4cb0('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 93ae31f..782e21b 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 _0x8b38=['/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x1badc1,_0x19fd91){var _0x37e23d=function(_0x2a4983){while(--_0x2a4983){_0x1badc1['push'](_0x1badc1['shift']());}};_0x37e23d(++_0x19fd91);}(_0x8b38,0xf8));var _0x88b3=function(_0x18b2a3,_0x2a639b){_0x18b2a3=_0x18b2a3-0x0;var _0x50659f=_0x8b38[_0x18b2a3];return _0x50659f;};'use strict';var multer=require(_0x88b3('0x0'));var util=require(_0x88b3('0x1'));var path=require('path');var timeout=require(_0x88b3('0x2'));var express=require(_0x88b3('0x3'));var router=express[_0x88b3('0x4')]();var auth=require(_0x88b3('0x5'));var interaction=require(_0x88b3('0x6'));var config=require(_0x88b3('0x7'));var controller=require('./intDynamics365Configuration.controller');router[_0x88b3('0x8')]('/',auth[_0x88b3('0x9')](),controller[_0x88b3('0xa')]);router['get'](_0x88b3('0xb'),auth[_0x88b3('0x9')](),controller['show']);router[_0x88b3('0x8')](_0x88b3('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0x88b3('0x8')](_0x88b3('0xd'),auth[_0x88b3('0x9')](),controller[_0x88b3('0xe')]);router[_0x88b3('0x8')](_0x88b3('0xf'),auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth[_0x88b3('0x9')](),controller['create']);router['put'](_0x88b3('0xb'),auth[_0x88b3('0x9')](),controller[_0x88b3('0x10')]);router[_0x88b3('0x11')](_0x88b3('0xb'),auth[_0x88b3('0x9')](),controller[_0x88b3('0x12')]);module[_0x88b3('0x13')]=router; \ No newline at end of file +var _0x74c3=['isAuthenticated','show','/:id/fields','/:id/subjects','get','/:id/descriptions','getDescriptions','create','put','/:id','update','delete','destroy','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','index'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x74c3,0xca));var _0x374c=function(_0x5f4bb8,_0x38035b){_0x5f4bb8=_0x5f4bb8-0x0;var _0x5a3788=_0x74c3[_0x5f4bb8];return _0x5a3788;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x374c('0x0'));var timeout=require('connect-timeout');var express=require(_0x374c('0x1'));var router=express[_0x374c('0x2')]();var auth=require(_0x374c('0x3'));var interaction=require(_0x374c('0x4'));var config=require(_0x374c('0x5'));var controller=require(_0x374c('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x374c('0x7')]);router['get']('/:id',auth[_0x374c('0x8')](),controller[_0x374c('0x9')]);router['get'](_0x374c('0xa'),auth[_0x374c('0x8')](),controller['getFields']);router['get'](_0x374c('0xb'),auth[_0x374c('0x8')](),controller['getSubjects']);router[_0x374c('0xc')](_0x374c('0xd'),auth['isAuthenticated'](),controller[_0x374c('0xe')]);router['post']('/',auth[_0x374c('0x8')](),controller[_0x374c('0xf')]);router[_0x374c('0x10')](_0x374c('0x11'),auth[_0x374c('0x8')](),controller[_0x374c('0x12')]);router[_0x374c('0x13')](_0x374c('0x11'),auth['isAuthenticated'](),controller[_0x374c('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index d8a2be0..8a81f2a 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 _0x295b=['STRING','ENUM','incident','phonecall','exports'];(function(_0x557079,_0x4adad5){var _0x39d8fa=function(_0x4e04c8){while(--_0x4e04c8){_0x557079['push'](_0x557079['shift']());}};_0x39d8fa(++_0x4adad5);}(_0x295b,0xcc));var _0xb295=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x295b[_0x25e7cb];return _0x375d92;};'use strict';var Sequelize=require('sequelize');module[_0xb295('0x0')]={'name':{'type':Sequelize[_0xb295('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xb295('0x2')](_0xb295('0x3'),_0xb295('0x4')),'defaultValue':_0xb295('0x3')}}; \ No newline at end of file +var _0x6341=['STRING','incident','phonecall','exports'];(function(_0x4441a3,_0x1b9ce9){var _0x2e2516=function(_0x6da140){while(--_0x6da140){_0x4441a3['push'](_0x4441a3['shift']());}};_0x2e2516(++_0x1b9ce9);}(_0x6341,0x1af));var _0x1634=function(_0x455ff4,_0x3a7819){_0x455ff4=_0x455ff4-0x0;var _0x3c1714=_0x6341[_0x455ff4];return _0x3c1714;};'use strict';var Sequelize=require('sequelize');module[_0x1634('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1634('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0x1634('0x2'),_0x1634('0x3')),'defaultValue':_0x1634('0x2')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 492e2a7..3c5aa3f 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 _0x74e2=['offset','limit','Content-Range','json','apply','reject','destroy','stack','name','send','map','Dynamics365Configuration','type','key','query','keys','filters','intersection','attributes','model','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','show','params','length','find','create','body','update','getFields','findOne','Dynamics365Field','rawAttributes','hasOwnProperty','getSubjects','order','getDescriptions','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','sendStatus','status','end','count'];(function(_0x1849c0,_0x43d6f5){var _0x569897=function(_0x1361a0){while(--_0x1361a0){_0x1849c0['push'](_0x1849c0['shift']());}};_0x569897(++_0x43d6f5);}(_0x74e2,0x142));var _0x274e=function(_0x18f8c2,_0x7834c9){_0x18f8c2=_0x18f8c2-0x0;var _0x1f3f47=_0x74e2[_0x18f8c2];return _0x1f3f47;};'use strict';var pdf=require(_0x274e('0x0'));var emlformat=require(_0x274e('0x1'));var rimraf=require(_0x274e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x274e('0x3'));var moment=require(_0x274e('0x4'));var BPromise=require(_0x274e('0x5'));var Mustache=require(_0x274e('0x6'));var util=require('util');var path=require(_0x274e('0x7'));var sox=require(_0x274e('0x8'));var csv=require(_0x274e('0x9'));var ejs=require(_0x274e('0xa'));var fs=require('fs');var _=require(_0x274e('0xb'));var squel=require('squel');var crypto=require(_0x274e('0xc'));var jsforce=require(_0x274e('0xd'));var deskjs=require(_0x274e('0xe'));var toCsv=require('to-csv');var querystring=require(_0x274e('0xf'));var Papa=require(_0x274e('0x10'));var Redis=require(_0x274e('0x11'));var authService=require(_0x274e('0x12'));var qs=require(_0x274e('0x13'));var as=require(_0x274e('0x14'));var hardwareService=require(_0x274e('0x15'));var logger=require(_0x274e('0x16'))('api');var utils=require(_0x274e('0x17'));var config=require('../../config/environment');var db=require(_0x274e('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x274e('0x19')][_0x274e('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x5e3bd4,_0x4c6bc0,_0x5c31cd){if(_0x5c31cd){var _0x4bb300=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4bb300[_0x274e('0x1b')](_0x4c6bc0)){return _0x5e3bd4;}else{throw new db[(_0x274e('0x1c'))]['ValidationError'](_0x274e('0x1d'));}}else{return _0x5e3bd4;}}function respondWithRpcPromise(_0x4d7b7a,_0x2ac007,_0x43db0f,_0x200991){return new BPromise(function(_0x33dce6,_0x6b0f8c){var _0x2c522a=_0x200991||client;return _0x2c522a[_0x274e('0x1e')](_0x4d7b7a,_0x43db0f)[_0x274e('0x1f')](function(_0x5964d7){logger['info'](_0x274e('0x20'),_0x2ac007,'request\x20sent');logger[_0x274e('0x21')](_0x274e('0x22'),_0x2ac007,_0x274e('0x23'),JSON['stringify'](_0x5964d7));if(_0x5964d7[_0x274e('0x24')]){if(_0x5964d7[_0x274e('0x24')][_0x274e('0x25')]===0x1f4){logger['error'](_0x274e('0x20'),_0x2ac007,_0x5964d7[_0x274e('0x24')][_0x274e('0x26')]);return _0x6b0f8c(_0x5964d7[_0x274e('0x24')][_0x274e('0x26')]);}logger[_0x274e('0x24')](_0x274e('0x20'),_0x2ac007,_0x5964d7[_0x274e('0x24')]['message']);return _0x33dce6(_0x5964d7['error'][_0x274e('0x26')]);}else{logger[_0x274e('0x27')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2ac007,_0x274e('0x23'));_0x33dce6(_0x5964d7[_0x274e('0x28')][_0x274e('0x26')]);}})[_0x274e('0x29')](function(_0x317334){logger[_0x274e('0x24')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2ac007,_0x317334);_0x6b0f8c(_0x317334);});});}function respondWithStatusCode(_0x4d8131,_0x2d974f){_0x2d974f=_0x2d974f||0xcc;return function(_0x35ce86){if(_0x35ce86){return _0x4d8131[_0x274e('0x2a')](_0x2d974f);}return _0x4d8131[_0x274e('0x2b')](_0x2d974f)[_0x274e('0x2c')]();};}function respondWithResult(_0x21bc34,_0x511e32){_0x511e32=_0x511e32||0xc8;return function(_0x18065e){if(_0x18065e){return _0x21bc34['status'](_0x511e32)['json'](_0x18065e);}};}function respondWithFilteredResult(_0x2a9f65,_0x5a2ba7){return function(_0x52cad5){if(_0x52cad5){var _0x5c8db0=_0x52cad5[_0x274e('0x2d')],_0x371ab5=_0x5a2ba7[_0x274e('0x2e')],_0x34fb81=_0x5a2ba7['offset']+_0x5a2ba7[_0x274e('0x2f')],_0x1c1f6c;if(_0x34fb81>=_0x5c8db0){_0x34fb81=_0x5c8db0;_0x1c1f6c=0xc8;}else{_0x1c1f6c=0xce;}_0x2a9f65[_0x274e('0x2b')](_0x1c1f6c);return _0x2a9f65['set'](_0x274e('0x30'),_0x371ab5+'-'+_0x34fb81+'/'+_0x5c8db0)[_0x274e('0x31')](_0x52cad5);}return null;};}function patchUpdates(_0x3971c1){return function(_0x1523b8){try{jsonpatch[_0x274e('0x32')](_0x1523b8,_0x3971c1,!![]);}catch(_0x2cd1e4){return BPromise[_0x274e('0x33')](_0x2cd1e4);}return _0x1523b8['save']();};}function saveUpdates(_0x1dc685,_0x3b46f2){return function(_0x3c3c18){if(_0x3c3c18){return _0x3c3c18['update'](_0x1dc685)[_0x274e('0x1f')](function(_0x34e81d){return _0x34e81d;});}return null;};}function removeEntity(_0x505dce,_0x25783d){return function(_0x5c0d45){if(_0x5c0d45){return _0x5c0d45[_0x274e('0x34')]()[_0x274e('0x1f')](function(){_0x505dce[_0x274e('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a9410,_0x2f0eb3){return function(_0x26d815){if(!_0x26d815){_0x4a9410[_0x274e('0x2a')](0x194);}return _0x26d815;};}function handleError(_0x291a3d,_0x9e1d30){_0x9e1d30=_0x9e1d30||0x1f4;return function(_0x3305f8){logger[_0x274e('0x24')](_0x3305f8[_0x274e('0x35')]);if(_0x3305f8[_0x274e('0x36')]){delete _0x3305f8[_0x274e('0x36')];}_0x291a3d['status'](_0x9e1d30)[_0x274e('0x37')](_0x3305f8);};}exports['index']=function(_0x2cd870,_0x2b89ba){var _0x9525={},_0x4da0f7={},_0x4dad4c={'count':0x0,'rows':[]};var _0x5eb61d=_[_0x274e('0x38')](db[_0x274e('0x39')]['rawAttributes'],function(_0x18fdca){return{'name':_0x18fdca['fieldName'],'type':_0x18fdca[_0x274e('0x3a')][_0x274e('0x3b')]};});_0x4da0f7['model']=_[_0x274e('0x38')](_0x5eb61d,_0x274e('0x36'));_0x4da0f7[_0x274e('0x3c')]=_[_0x274e('0x3d')](_0x2cd870['query']);_0x4da0f7[_0x274e('0x3e')]=_[_0x274e('0x3f')](_0x4da0f7['model'],_0x4da0f7[_0x274e('0x3c')]);_0x9525[_0x274e('0x40')]=_[_0x274e('0x3f')](_0x4da0f7[_0x274e('0x41')],qs['fields'](_0x2cd870[_0x274e('0x3c')][_0x274e('0x42')]));_0x9525[_0x274e('0x40')]=_0x9525[_0x274e('0x40')]['length']?_0x9525[_0x274e('0x40')]:_0x4da0f7[_0x274e('0x41')];if(!_0x2cd870[_0x274e('0x3c')]['hasOwnProperty'](_0x274e('0x43'))){_0x9525['limit']=qs[_0x274e('0x2f')](_0x2cd870[_0x274e('0x3c')]['limit']);_0x9525[_0x274e('0x2e')]=qs[_0x274e('0x2e')](_0x2cd870['query'][_0x274e('0x2e')]);}_0x9525['order']=qs[_0x274e('0x44')](_0x2cd870[_0x274e('0x3c')][_0x274e('0x44')]);_0x9525[_0x274e('0x45')]=qs[_0x274e('0x3e')](_[_0x274e('0x46')](_0x2cd870[_0x274e('0x3c')],_0x4da0f7[_0x274e('0x3e')]),_0x5eb61d);if(_0x2cd870['query'][_0x274e('0x47')]){_0x9525[_0x274e('0x45')]=_[_0x274e('0x48')](_0x9525[_0x274e('0x45')],{'$or':_['map'](_0x5eb61d,function(_0x2e0be4){if(_0x2e0be4[_0x274e('0x3a')]!==_0x274e('0x49')){var _0x3753c6={};_0x3753c6[_0x2e0be4['name']]={'$like':'%'+_0x2cd870[_0x274e('0x3c')][_0x274e('0x47')]+'%'};return _0x3753c6;}})});}_0x9525=_[_0x274e('0x48')]({},_0x9525,_0x2cd870[_0x274e('0x4a')]);var _0x547e9b={'where':_0x9525[_0x274e('0x45')]};return db[_0x274e('0x39')][_0x274e('0x2d')](_0x547e9b)[_0x274e('0x1f')](function(_0x4b2c1a){_0x4dad4c['count']=_0x4b2c1a;if(_0x2cd870[_0x274e('0x3c')][_0x274e('0x4b')]){_0x9525[_0x274e('0x4c')]=[{'all':!![]}];}return db[_0x274e('0x39')]['findAll'](_0x9525);})[_0x274e('0x1f')](function(_0x34131b){_0x4dad4c['rows']=_0x34131b;return _0x4dad4c;})[_0x274e('0x1f')](respondWithFilteredResult(_0x2b89ba,_0x9525))[_0x274e('0x29')](handleError(_0x2b89ba,null));};exports[_0x274e('0x4d')]=function(_0x5e0d14,_0x124b8d){var _0x366811={'raw':![],'where':{'id':_0x5e0d14[_0x274e('0x4e')]['id']}},_0x241554={};_0x241554[_0x274e('0x41')]=_[_0x274e('0x3d')](db[_0x274e('0x39')]['rawAttributes']);_0x241554['query']=_[_0x274e('0x3d')](_0x5e0d14[_0x274e('0x3c')]);_0x241554[_0x274e('0x3e')]=_['intersection'](_0x241554['model'],_0x241554[_0x274e('0x3c')]);_0x366811[_0x274e('0x40')]=_[_0x274e('0x3f')](_0x241554[_0x274e('0x41')],qs[_0x274e('0x42')](_0x5e0d14['query'][_0x274e('0x42')]));_0x366811['attributes']=_0x366811['attributes'][_0x274e('0x4f')]?_0x366811['attributes']:_0x241554[_0x274e('0x41')];if(_0x5e0d14['query'][_0x274e('0x4b')]){_0x366811['include']=[{'all':!![]}];}_0x366811=_[_0x274e('0x48')]({},_0x366811,_0x5e0d14['options']);return db[_0x274e('0x39')][_0x274e('0x50')](_0x366811)[_0x274e('0x1f')](handleEntityNotFound(_0x124b8d,null))[_0x274e('0x1f')](respondWithResult(_0x124b8d,null))['catch'](handleError(_0x124b8d,null));};exports[_0x274e('0x51')]=function(_0x17b3db,_0x456b42){return db[_0x274e('0x39')][_0x274e('0x51')](_0x17b3db[_0x274e('0x52')],{})[_0x274e('0x1f')](respondWithResult(_0x456b42,0xc9))[_0x274e('0x29')](handleError(_0x456b42,null));};exports[_0x274e('0x53')]=function(_0x4d7a3b,_0x30d984){if(_0x4d7a3b[_0x274e('0x52')]['id']){delete _0x4d7a3b[_0x274e('0x52')]['id'];}return db['Dynamics365Configuration'][_0x274e('0x50')]({'where':{'id':_0x4d7a3b['params']['id']}})[_0x274e('0x1f')](handleEntityNotFound(_0x30d984,null))[_0x274e('0x1f')](saveUpdates(_0x4d7a3b['body'],null))[_0x274e('0x1f')](respondWithResult(_0x30d984,null))['catch'](handleError(_0x30d984,null));};exports['destroy']=function(_0x244726,_0x16c5d1){return db[_0x274e('0x39')][_0x274e('0x50')]({'where':{'id':_0x244726[_0x274e('0x4e')]['id']}})[_0x274e('0x1f')](handleEntityNotFound(_0x16c5d1,null))[_0x274e('0x1f')](removeEntity(_0x16c5d1,null))[_0x274e('0x29')](handleError(_0x16c5d1,null));};exports[_0x274e('0x54')]=function(_0x1ae10e,_0xfb6779,_0x3df288){var _0x2ca2c2={};var _0x4054c9={};var _0x3180cf;var _0x80472f;return db[_0x274e('0x39')][_0x274e('0x55')]({'where':{'id':_0x1ae10e[_0x274e('0x4e')]['id']}})[_0x274e('0x1f')](handleEntityNotFound(_0xfb6779,null))[_0x274e('0x1f')](function(_0x2eca43){if(_0x2eca43){_0x3180cf=_0x2eca43;_0x4054c9[_0x274e('0x41')]=_['keys'](db[_0x274e('0x56')][_0x274e('0x57')]);_0x4054c9['query']=_[_0x274e('0x3d')](_0x1ae10e[_0x274e('0x3c')]);_0x4054c9[_0x274e('0x3e')]=_[_0x274e('0x3f')](_0x4054c9[_0x274e('0x41')],_0x4054c9[_0x274e('0x3c')]);_0x2ca2c2['attributes']=_[_0x274e('0x3f')](_0x4054c9[_0x274e('0x41')],qs[_0x274e('0x42')](_0x1ae10e[_0x274e('0x3c')][_0x274e('0x42')]));_0x2ca2c2[_0x274e('0x40')]=_0x2ca2c2['attributes']['length']?_0x2ca2c2['attributes']:_0x4054c9[_0x274e('0x41')];_0x2ca2c2['order']=qs[_0x274e('0x44')](_0x1ae10e['query'][_0x274e('0x44')]);_0x2ca2c2['where']=qs[_0x274e('0x3e')](_[_0x274e('0x46')](_0x1ae10e['query'],_0x4054c9[_0x274e('0x3e')]));if(_0x1ae10e[_0x274e('0x3c')][_0x274e('0x47')]){_0x2ca2c2[_0x274e('0x45')]=_[_0x274e('0x48')](_0x2ca2c2[_0x274e('0x45')],{'$or':_[_0x274e('0x38')](_0x2ca2c2[_0x274e('0x40')],function(_0x1aeb78){var _0x36b110={};_0x36b110[_0x1aeb78]={'$like':'%'+_0x1ae10e[_0x274e('0x3c')][_0x274e('0x47')]+'%'};return _0x36b110;})});}_0x2ca2c2=_[_0x274e('0x48')]({},_0x2ca2c2,_0x1ae10e['options']);return _0x3180cf[_0x274e('0x54')](_0x2ca2c2);}})['then'](function(_0x21315a){if(_0x21315a){_0x80472f=_0x21315a[_0x274e('0x4f')];if(!_0x1ae10e[_0x274e('0x3c')][_0x274e('0x58')](_0x274e('0x43'))){_0x2ca2c2[_0x274e('0x2f')]=qs[_0x274e('0x2f')](_0x1ae10e[_0x274e('0x3c')][_0x274e('0x2f')]);_0x2ca2c2[_0x274e('0x2e')]=qs[_0x274e('0x2e')](_0x1ae10e[_0x274e('0x3c')][_0x274e('0x2e')]);}return _0x3180cf[_0x274e('0x54')](_0x2ca2c2);}})[_0x274e('0x1f')](function(_0xe2da9d){if(_0xe2da9d){return _0xe2da9d?{'count':_0x80472f,'rows':_0xe2da9d}:null;}})[_0x274e('0x1f')](respondWithResult(_0xfb6779,null))[_0x274e('0x29')](handleError(_0xfb6779,null));};exports[_0x274e('0x59')]=function(_0x114672,_0xfb96c8,_0x1642f5){var _0x3ab7eb={};var _0x427073={};var _0x281bef;var _0x50dadf;return db['Dynamics365Configuration'][_0x274e('0x55')]({'where':{'id':_0x114672[_0x274e('0x4e')]['id']}})['then'](handleEntityNotFound(_0xfb96c8,null))['then'](function(_0x2c128f){if(_0x2c128f){_0x281bef=_0x2c128f;_0x427073[_0x274e('0x41')]=_[_0x274e('0x3d')](db[_0x274e('0x56')][_0x274e('0x57')]);_0x427073[_0x274e('0x3c')]=_[_0x274e('0x3d')](_0x114672[_0x274e('0x3c')]);_0x427073[_0x274e('0x3e')]=_[_0x274e('0x3f')](_0x427073[_0x274e('0x41')],_0x427073[_0x274e('0x3c')]);_0x3ab7eb[_0x274e('0x40')]=_[_0x274e('0x3f')](_0x427073['model'],qs[_0x274e('0x42')](_0x114672['query'][_0x274e('0x42')]));_0x3ab7eb[_0x274e('0x40')]=_0x3ab7eb[_0x274e('0x40')][_0x274e('0x4f')]?_0x3ab7eb['attributes']:_0x427073['model'];_0x3ab7eb[_0x274e('0x5a')]=qs[_0x274e('0x44')](_0x114672[_0x274e('0x3c')][_0x274e('0x44')]);_0x3ab7eb[_0x274e('0x45')]=qs[_0x274e('0x3e')](_[_0x274e('0x46')](_0x114672[_0x274e('0x3c')],_0x427073['filters']));if(_0x114672['query']['filter']){_0x3ab7eb['where']=_[_0x274e('0x48')](_0x3ab7eb['where'],{'$or':_[_0x274e('0x38')](_0x3ab7eb['attributes'],function(_0x39d12f){var _0x826688={};_0x826688[_0x39d12f]={'$like':'%'+_0x114672[_0x274e('0x3c')][_0x274e('0x47')]+'%'};return _0x826688;})});}_0x3ab7eb=_[_0x274e('0x48')]({},_0x3ab7eb,_0x114672['options']);return _0x281bef[_0x274e('0x59')](_0x3ab7eb);}})[_0x274e('0x1f')](function(_0x41ad15){if(_0x41ad15){_0x50dadf=_0x41ad15[_0x274e('0x4f')];if(!_0x114672[_0x274e('0x3c')]['hasOwnProperty'](_0x274e('0x43'))){_0x3ab7eb['limit']=qs[_0x274e('0x2f')](_0x114672['query'][_0x274e('0x2f')]);_0x3ab7eb['offset']=qs[_0x274e('0x2e')](_0x114672[_0x274e('0x3c')]['offset']);}return _0x281bef[_0x274e('0x59')](_0x3ab7eb);}})[_0x274e('0x1f')](function(_0x23df44){if(_0x23df44){return _0x23df44?{'count':_0x50dadf,'rows':_0x23df44}:null;}})[_0x274e('0x1f')](respondWithResult(_0xfb96c8,null))[_0x274e('0x29')](handleError(_0xfb96c8,null));};exports[_0x274e('0x5b')]=function(_0x114bed,_0x245b8e,_0x3097bf){var _0x4ac1cd={};var _0x42d804={};var _0x89a0a6;var _0x46db49;return db[_0x274e('0x39')][_0x274e('0x55')]({'where':{'id':_0x114bed['params']['id']}})[_0x274e('0x1f')](handleEntityNotFound(_0x245b8e,null))[_0x274e('0x1f')](function(_0x330740){if(_0x330740){_0x89a0a6=_0x330740;_0x42d804['model']=_[_0x274e('0x3d')](db[_0x274e('0x56')][_0x274e('0x57')]);_0x42d804[_0x274e('0x3c')]=_['keys'](_0x114bed[_0x274e('0x3c')]);_0x42d804[_0x274e('0x3e')]=_[_0x274e('0x3f')](_0x42d804['model'],_0x42d804[_0x274e('0x3c')]);_0x4ac1cd[_0x274e('0x40')]=_[_0x274e('0x3f')](_0x42d804[_0x274e('0x41')],qs['fields'](_0x114bed['query'][_0x274e('0x42')]));_0x4ac1cd['attributes']=_0x4ac1cd[_0x274e('0x40')]['length']?_0x4ac1cd[_0x274e('0x40')]:_0x42d804[_0x274e('0x41')];_0x4ac1cd[_0x274e('0x5a')]=qs[_0x274e('0x44')](_0x114bed['query']['sort']);_0x4ac1cd[_0x274e('0x45')]=qs[_0x274e('0x3e')](_[_0x274e('0x46')](_0x114bed[_0x274e('0x3c')],_0x42d804['filters']));if(_0x114bed[_0x274e('0x3c')][_0x274e('0x47')]){_0x4ac1cd['where']=_[_0x274e('0x48')](_0x4ac1cd[_0x274e('0x45')],{'$or':_[_0x274e('0x38')](_0x4ac1cd[_0x274e('0x40')],function(_0x307a91){var _0x15b97d={};_0x15b97d[_0x307a91]={'$like':'%'+_0x114bed[_0x274e('0x3c')][_0x274e('0x47')]+'%'};return _0x15b97d;})});}_0x4ac1cd=_[_0x274e('0x48')]({},_0x4ac1cd,_0x114bed[_0x274e('0x4a')]);return _0x89a0a6['getDescriptions'](_0x4ac1cd);}})[_0x274e('0x1f')](function(_0x51a96b){if(_0x51a96b){_0x46db49=_0x51a96b[_0x274e('0x4f')];if(!_0x114bed['query'][_0x274e('0x58')]('nolimit')){_0x4ac1cd[_0x274e('0x2f')]=qs[_0x274e('0x2f')](_0x114bed[_0x274e('0x3c')][_0x274e('0x2f')]);_0x4ac1cd[_0x274e('0x2e')]=qs[_0x274e('0x2e')](_0x114bed['query']['offset']);}return _0x89a0a6[_0x274e('0x5b')](_0x4ac1cd);}})[_0x274e('0x1f')](function(_0xbdca87){if(_0xbdca87){return _0xbdca87?{'count':_0x46db49,'rows':_0xbdca87}:null;}})['then'](respondWithResult(_0x245b8e,null))[_0x274e('0x29')](handleError(_0x245b8e,null));}; \ No newline at end of file +var _0x0f67=['key','map','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','show','params','include','create','body','update','find','destroy','Dynamics365Field','hasOwnProperty','getFields','getSubjects','findOne','getDescriptions','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','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','stack','name','index','Dynamics365Configuration','rawAttributes','fieldName'];(function(_0x5b23e7,_0x109b47){var _0x142766=function(_0x145ad5){while(--_0x145ad5){_0x5b23e7['push'](_0x5b23e7['shift']());}};_0x142766(++_0x109b47);}(_0x0f67,0x80));var _0x70f6=function(_0x30af97,_0x5c6bb2){_0x30af97=_0x30af97-0x0;var _0x2bf87a=_0x0f67[_0x30af97];return _0x2bf87a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x70f6('0x0'));var rimraf=require(_0x70f6('0x1'));var zipdir=require(_0x70f6('0x2'));var jsonpatch=require(_0x70f6('0x3'));var rp=require(_0x70f6('0x4'));var moment=require(_0x70f6('0x5'));var BPromise=require(_0x70f6('0x6'));var Mustache=require(_0x70f6('0x7'));var util=require(_0x70f6('0x8'));var path=require('path');var sox=require(_0x70f6('0x9'));var csv=require('to-csv');var ejs=require(_0x70f6('0xa'));var fs=require('fs');var _=require(_0x70f6('0xb'));var squel=require(_0x70f6('0xc'));var crypto=require(_0x70f6('0xd'));var jsforce=require(_0x70f6('0xe'));var deskjs=require(_0x70f6('0xf'));var toCsv=require(_0x70f6('0x10'));var querystring=require(_0x70f6('0x11'));var Papa=require(_0x70f6('0x12'));var Redis=require(_0x70f6('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x70f6('0x14'));var as=require(_0x70f6('0x15'));var hardwareService=require(_0x70f6('0x16'));var logger=require(_0x70f6('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x70f6('0x18'));var db=require(_0x70f6('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x70f6('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x302e27,_0x37deb4,_0x519bfc){if(_0x519bfc){var _0x2cea0d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2cea0d[_0x70f6('0x1b')](_0x37deb4)){return _0x302e27;}else{throw new db[(_0x70f6('0x1c'))]['ValidationError'](_0x70f6('0x1d'));}}else{return _0x302e27;}}function respondWithRpcPromise(_0x1cee9e,_0xc892fc,_0x1ebb87,_0xf96285){return new BPromise(function(_0x213973,_0x58b2ea){var _0x1f736b=_0xf96285||client;return _0x1f736b[_0x70f6('0x1e')](_0x1cee9e,_0x1ebb87)[_0x70f6('0x1f')](function(_0x4635b1){logger[_0x70f6('0x20')](_0x70f6('0x21'),_0xc892fc,_0x70f6('0x22'));logger[_0x70f6('0x23')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0xc892fc,_0x70f6('0x22'),JSON[_0x70f6('0x24')](_0x4635b1));if(_0x4635b1[_0x70f6('0x25')]){if(_0x4635b1[_0x70f6('0x25')][_0x70f6('0x26')]===0x1f4){logger[_0x70f6('0x25')]('Dynamics365Configuration,\x20%s,\x20%s',_0xc892fc,_0x4635b1['error'][_0x70f6('0x27')]);return _0x58b2ea(_0x4635b1[_0x70f6('0x25')][_0x70f6('0x27')]);}logger[_0x70f6('0x25')](_0x70f6('0x21'),_0xc892fc,_0x4635b1['error'][_0x70f6('0x27')]);return _0x213973(_0x4635b1[_0x70f6('0x25')]['message']);}else{logger[_0x70f6('0x20')](_0x70f6('0x21'),_0xc892fc,'request\x20sent');_0x213973(_0x4635b1['result'][_0x70f6('0x27')]);}})[_0x70f6('0x28')](function(_0x13e6c2){logger[_0x70f6('0x25')](_0x70f6('0x21'),_0xc892fc,_0x13e6c2);_0x58b2ea(_0x13e6c2);});});}function respondWithStatusCode(_0x2f05ce,_0x288df1){_0x288df1=_0x288df1||0xcc;return function(_0x43f0d2){if(_0x43f0d2){return _0x2f05ce[_0x70f6('0x29')](_0x288df1);}return _0x2f05ce[_0x70f6('0x2a')](_0x288df1)[_0x70f6('0x2b')]();};}function respondWithResult(_0x2bb7e7,_0x514392){_0x514392=_0x514392||0xc8;return function(_0xdf145b){if(_0xdf145b){return _0x2bb7e7[_0x70f6('0x2a')](_0x514392)[_0x70f6('0x2c')](_0xdf145b);}};}function respondWithFilteredResult(_0x428216,_0xd63718){return function(_0x226c3f){if(_0x226c3f){var _0x57ed2e=_0x226c3f[_0x70f6('0x2d')],_0x398694=_0xd63718[_0x70f6('0x2e')],_0x73474d=_0xd63718[_0x70f6('0x2e')]+_0xd63718[_0x70f6('0x2f')],_0x4cb862;if(_0x73474d>=_0x57ed2e){_0x73474d=_0x57ed2e;_0x4cb862=0xc8;}else{_0x4cb862=0xce;}_0x428216[_0x70f6('0x2a')](_0x4cb862);return _0x428216[_0x70f6('0x30')](_0x70f6('0x31'),_0x398694+'-'+_0x73474d+'/'+_0x57ed2e)['json'](_0x226c3f);}return null;};}function patchUpdates(_0x4fe6e0){return function(_0x509ae0){try{jsonpatch[_0x70f6('0x32')](_0x509ae0,_0x4fe6e0,!![]);}catch(_0x450f66){return BPromise['reject'](_0x450f66);}return _0x509ae0[_0x70f6('0x33')]();};}function saveUpdates(_0x2777e1,_0x53e578){return function(_0x4f98f1){if(_0x4f98f1){return _0x4f98f1['update'](_0x2777e1)[_0x70f6('0x1f')](function(_0x38bdac){return _0x38bdac;});}return null;};}function removeEntity(_0x536081,_0x32dca5){return function(_0xc371eb){if(_0xc371eb){return _0xc371eb['destroy']()[_0x70f6('0x1f')](function(){_0x536081[_0x70f6('0x2a')](0xcc)[_0x70f6('0x2b')]();});}};}function handleEntityNotFound(_0x40cd14,_0x4a72da){return function(_0x24dfa4){if(!_0x24dfa4){_0x40cd14[_0x70f6('0x29')](0x194);}return _0x24dfa4;};}function handleError(_0x3e9806,_0xae6bad){_0xae6bad=_0xae6bad||0x1f4;return function(_0x4fb22b){logger[_0x70f6('0x25')](_0x4fb22b[_0x70f6('0x34')]);if(_0x4fb22b[_0x70f6('0x35')]){delete _0x4fb22b[_0x70f6('0x35')];}_0x3e9806[_0x70f6('0x2a')](_0xae6bad)['send'](_0x4fb22b);};}exports[_0x70f6('0x36')]=function(_0x5d8535,_0x1c5e0c){var _0x3f3c36={},_0x5b3a13={},_0x2a2c79={'count':0x0,'rows':[]};var _0x59e5e0=_['map'](db[_0x70f6('0x37')][_0x70f6('0x38')],function(_0x981a5a){return{'name':_0x981a5a[_0x70f6('0x39')],'type':_0x981a5a['type'][_0x70f6('0x3a')]};});_0x5b3a13['model']=_[_0x70f6('0x3b')](_0x59e5e0,_0x70f6('0x35'));_0x5b3a13['query']=_[_0x70f6('0x3c')](_0x5d8535[_0x70f6('0x3d')]);_0x5b3a13[_0x70f6('0x3e')]=_[_0x70f6('0x3f')](_0x5b3a13[_0x70f6('0x40')],_0x5b3a13['query']);_0x3f3c36[_0x70f6('0x41')]=_[_0x70f6('0x3f')](_0x5b3a13[_0x70f6('0x40')],qs['fields'](_0x5d8535[_0x70f6('0x3d')][_0x70f6('0x42')]));_0x3f3c36['attributes']=_0x3f3c36['attributes'][_0x70f6('0x43')]?_0x3f3c36[_0x70f6('0x41')]:_0x5b3a13[_0x70f6('0x40')];if(!_0x5d8535[_0x70f6('0x3d')]['hasOwnProperty'](_0x70f6('0x44'))){_0x3f3c36[_0x70f6('0x2f')]=qs[_0x70f6('0x2f')](_0x5d8535[_0x70f6('0x3d')][_0x70f6('0x2f')]);_0x3f3c36[_0x70f6('0x2e')]=qs['offset'](_0x5d8535['query'][_0x70f6('0x2e')]);}_0x3f3c36[_0x70f6('0x45')]=qs[_0x70f6('0x46')](_0x5d8535[_0x70f6('0x3d')]['sort']);_0x3f3c36[_0x70f6('0x47')]=qs[_0x70f6('0x3e')](_[_0x70f6('0x48')](_0x5d8535[_0x70f6('0x3d')],_0x5b3a13[_0x70f6('0x3e')]),_0x59e5e0);if(_0x5d8535['query'][_0x70f6('0x49')]){_0x3f3c36[_0x70f6('0x47')]=_[_0x70f6('0x4a')](_0x3f3c36[_0x70f6('0x47')],{'$or':_[_0x70f6('0x3b')](_0x59e5e0,function(_0x2a242a){if(_0x2a242a['type']!==_0x70f6('0x4b')){var _0x1e32d8={};_0x1e32d8[_0x2a242a[_0x70f6('0x35')]]={'$like':'%'+_0x5d8535[_0x70f6('0x3d')][_0x70f6('0x49')]+'%'};return _0x1e32d8;}})});}_0x3f3c36=_[_0x70f6('0x4a')]({},_0x3f3c36,_0x5d8535[_0x70f6('0x4c')]);var _0x2f6996={'where':_0x3f3c36[_0x70f6('0x47')]};return db[_0x70f6('0x37')][_0x70f6('0x2d')](_0x2f6996)[_0x70f6('0x1f')](function(_0x4b49b4){_0x2a2c79[_0x70f6('0x2d')]=_0x4b49b4;if(_0x5d8535[_0x70f6('0x3d')][_0x70f6('0x4d')]){_0x3f3c36['include']=[{'all':!![]}];}return db[_0x70f6('0x37')]['findAll'](_0x3f3c36);})[_0x70f6('0x1f')](function(_0x1368fe){_0x2a2c79[_0x70f6('0x4e')]=_0x1368fe;return _0x2a2c79;})[_0x70f6('0x1f')](respondWithFilteredResult(_0x1c5e0c,_0x3f3c36))[_0x70f6('0x28')](handleError(_0x1c5e0c,null));};exports[_0x70f6('0x4f')]=function(_0x4db7ec,_0x2f3726){var _0x1aaf43={'raw':![],'where':{'id':_0x4db7ec[_0x70f6('0x50')]['id']}},_0x13426d={};_0x13426d[_0x70f6('0x40')]=_[_0x70f6('0x3c')](db[_0x70f6('0x37')][_0x70f6('0x38')]);_0x13426d['query']=_['keys'](_0x4db7ec[_0x70f6('0x3d')]);_0x13426d['filters']=_[_0x70f6('0x3f')](_0x13426d[_0x70f6('0x40')],_0x13426d['query']);_0x1aaf43[_0x70f6('0x41')]=_[_0x70f6('0x3f')](_0x13426d[_0x70f6('0x40')],qs[_0x70f6('0x42')](_0x4db7ec[_0x70f6('0x3d')][_0x70f6('0x42')]));_0x1aaf43[_0x70f6('0x41')]=_0x1aaf43['attributes']['length']?_0x1aaf43[_0x70f6('0x41')]:_0x13426d[_0x70f6('0x40')];if(_0x4db7ec[_0x70f6('0x3d')]['includeAll']){_0x1aaf43[_0x70f6('0x51')]=[{'all':!![]}];}_0x1aaf43=_[_0x70f6('0x4a')]({},_0x1aaf43,_0x4db7ec[_0x70f6('0x4c')]);return db['Dynamics365Configuration']['find'](_0x1aaf43)['then'](handleEntityNotFound(_0x2f3726,null))[_0x70f6('0x1f')](respondWithResult(_0x2f3726,null))[_0x70f6('0x28')](handleError(_0x2f3726,null));};exports[_0x70f6('0x52')]=function(_0x2a7d61,_0x457e0f){return db['Dynamics365Configuration'][_0x70f6('0x52')](_0x2a7d61[_0x70f6('0x53')],{})['then'](respondWithResult(_0x457e0f,0xc9))[_0x70f6('0x28')](handleError(_0x457e0f,null));};exports[_0x70f6('0x54')]=function(_0x5aa97d,_0x14317b){if(_0x5aa97d[_0x70f6('0x53')]['id']){delete _0x5aa97d['body']['id'];}return db['Dynamics365Configuration'][_0x70f6('0x55')]({'where':{'id':_0x5aa97d[_0x70f6('0x50')]['id']}})[_0x70f6('0x1f')](handleEntityNotFound(_0x14317b,null))[_0x70f6('0x1f')](saveUpdates(_0x5aa97d[_0x70f6('0x53')],null))[_0x70f6('0x1f')](respondWithResult(_0x14317b,null))[_0x70f6('0x28')](handleError(_0x14317b,null));};exports[_0x70f6('0x56')]=function(_0xd2593,_0x26a6f6){return db[_0x70f6('0x37')][_0x70f6('0x55')]({'where':{'id':_0xd2593['params']['id']}})[_0x70f6('0x1f')](handleEntityNotFound(_0x26a6f6,null))[_0x70f6('0x1f')](removeEntity(_0x26a6f6,null))[_0x70f6('0x28')](handleError(_0x26a6f6,null));};exports['getFields']=function(_0x4eb9ca,_0x3a7d60,_0x56e29c){var _0x8850af={};var _0x1ba387={};var _0x8f5267;var _0x14389d;return db[_0x70f6('0x37')]['findOne']({'where':{'id':_0x4eb9ca[_0x70f6('0x50')]['id']}})[_0x70f6('0x1f')](handleEntityNotFound(_0x3a7d60,null))[_0x70f6('0x1f')](function(_0x5a16b0){if(_0x5a16b0){_0x8f5267=_0x5a16b0;_0x1ba387[_0x70f6('0x40')]=_[_0x70f6('0x3c')](db[_0x70f6('0x57')][_0x70f6('0x38')]);_0x1ba387[_0x70f6('0x3d')]=_[_0x70f6('0x3c')](_0x4eb9ca[_0x70f6('0x3d')]);_0x1ba387[_0x70f6('0x3e')]=_[_0x70f6('0x3f')](_0x1ba387[_0x70f6('0x40')],_0x1ba387[_0x70f6('0x3d')]);_0x8850af['attributes']=_[_0x70f6('0x3f')](_0x1ba387[_0x70f6('0x40')],qs[_0x70f6('0x42')](_0x4eb9ca[_0x70f6('0x3d')][_0x70f6('0x42')]));_0x8850af[_0x70f6('0x41')]=_0x8850af[_0x70f6('0x41')][_0x70f6('0x43')]?_0x8850af[_0x70f6('0x41')]:_0x1ba387[_0x70f6('0x40')];_0x8850af[_0x70f6('0x45')]=qs[_0x70f6('0x46')](_0x4eb9ca[_0x70f6('0x3d')][_0x70f6('0x46')]);_0x8850af[_0x70f6('0x47')]=qs[_0x70f6('0x3e')](_[_0x70f6('0x48')](_0x4eb9ca['query'],_0x1ba387['filters']));if(_0x4eb9ca[_0x70f6('0x3d')][_0x70f6('0x49')]){_0x8850af[_0x70f6('0x47')]=_['merge'](_0x8850af['where'],{'$or':_[_0x70f6('0x3b')](_0x8850af['attributes'],function(_0xf997d){var _0x1d3cbe={};_0x1d3cbe[_0xf997d]={'$like':'%'+_0x4eb9ca['query'][_0x70f6('0x49')]+'%'};return _0x1d3cbe;})});}_0x8850af=_[_0x70f6('0x4a')]({},_0x8850af,_0x4eb9ca['options']);return _0x8f5267['getFields'](_0x8850af);}})[_0x70f6('0x1f')](function(_0x45bc00){if(_0x45bc00){_0x14389d=_0x45bc00[_0x70f6('0x43')];if(!_0x4eb9ca[_0x70f6('0x3d')][_0x70f6('0x58')]('nolimit')){_0x8850af[_0x70f6('0x2f')]=qs['limit'](_0x4eb9ca[_0x70f6('0x3d')][_0x70f6('0x2f')]);_0x8850af[_0x70f6('0x2e')]=qs[_0x70f6('0x2e')](_0x4eb9ca[_0x70f6('0x3d')][_0x70f6('0x2e')]);}return _0x8f5267[_0x70f6('0x59')](_0x8850af);}})['then'](function(_0xa2b792){if(_0xa2b792){return _0xa2b792?{'count':_0x14389d,'rows':_0xa2b792}:null;}})[_0x70f6('0x1f')](respondWithResult(_0x3a7d60,null))[_0x70f6('0x28')](handleError(_0x3a7d60,null));};exports[_0x70f6('0x5a')]=function(_0x3c51e9,_0x8a18a3,_0x55489d){var _0xe064c2={};var _0x1837c8={};var _0x1e8758;var _0x115dc0;return db[_0x70f6('0x37')][_0x70f6('0x5b')]({'where':{'id':_0x3c51e9[_0x70f6('0x50')]['id']}})['then'](handleEntityNotFound(_0x8a18a3,null))[_0x70f6('0x1f')](function(_0x5e79d6){if(_0x5e79d6){_0x1e8758=_0x5e79d6;_0x1837c8[_0x70f6('0x40')]=_['keys'](db[_0x70f6('0x57')]['rawAttributes']);_0x1837c8['query']=_[_0x70f6('0x3c')](_0x3c51e9[_0x70f6('0x3d')]);_0x1837c8[_0x70f6('0x3e')]=_[_0x70f6('0x3f')](_0x1837c8[_0x70f6('0x40')],_0x1837c8['query']);_0xe064c2[_0x70f6('0x41')]=_[_0x70f6('0x3f')](_0x1837c8[_0x70f6('0x40')],qs[_0x70f6('0x42')](_0x3c51e9['query'][_0x70f6('0x42')]));_0xe064c2['attributes']=_0xe064c2[_0x70f6('0x41')]['length']?_0xe064c2['attributes']:_0x1837c8['model'];_0xe064c2[_0x70f6('0x45')]=qs[_0x70f6('0x46')](_0x3c51e9[_0x70f6('0x3d')][_0x70f6('0x46')]);_0xe064c2['where']=qs[_0x70f6('0x3e')](_[_0x70f6('0x48')](_0x3c51e9[_0x70f6('0x3d')],_0x1837c8[_0x70f6('0x3e')]));if(_0x3c51e9[_0x70f6('0x3d')]['filter']){_0xe064c2[_0x70f6('0x47')]=_[_0x70f6('0x4a')](_0xe064c2['where'],{'$or':_[_0x70f6('0x3b')](_0xe064c2['attributes'],function(_0x8a7a64){var _0x47928a={};_0x47928a[_0x8a7a64]={'$like':'%'+_0x3c51e9['query']['filter']+'%'};return _0x47928a;})});}_0xe064c2=_[_0x70f6('0x4a')]({},_0xe064c2,_0x3c51e9[_0x70f6('0x4c')]);return _0x1e8758[_0x70f6('0x5a')](_0xe064c2);}})['then'](function(_0x3f10e5){if(_0x3f10e5){_0x115dc0=_0x3f10e5[_0x70f6('0x43')];if(!_0x3c51e9[_0x70f6('0x3d')][_0x70f6('0x58')](_0x70f6('0x44'))){_0xe064c2[_0x70f6('0x2f')]=qs[_0x70f6('0x2f')](_0x3c51e9[_0x70f6('0x3d')][_0x70f6('0x2f')]);_0xe064c2[_0x70f6('0x2e')]=qs[_0x70f6('0x2e')](_0x3c51e9['query'][_0x70f6('0x2e')]);}return _0x1e8758[_0x70f6('0x5a')](_0xe064c2);}})['then'](function(_0x54bdf0){if(_0x54bdf0){return _0x54bdf0?{'count':_0x115dc0,'rows':_0x54bdf0}:null;}})[_0x70f6('0x1f')](respondWithResult(_0x8a18a3,null))['catch'](handleError(_0x8a18a3,null));};exports[_0x70f6('0x5c')]=function(_0x558013,_0x8aace1,_0x212a4a){var _0x39d42c={};var _0x111e05={};var _0x3b8b5a;var _0x313001;return db[_0x70f6('0x37')][_0x70f6('0x5b')]({'where':{'id':_0x558013['params']['id']}})['then'](handleEntityNotFound(_0x8aace1,null))[_0x70f6('0x1f')](function(_0x12d560){if(_0x12d560){_0x3b8b5a=_0x12d560;_0x111e05[_0x70f6('0x40')]=_['keys'](db[_0x70f6('0x57')][_0x70f6('0x38')]);_0x111e05[_0x70f6('0x3d')]=_['keys'](_0x558013['query']);_0x111e05[_0x70f6('0x3e')]=_[_0x70f6('0x3f')](_0x111e05[_0x70f6('0x40')],_0x111e05[_0x70f6('0x3d')]);_0x39d42c[_0x70f6('0x41')]=_['intersection'](_0x111e05['model'],qs[_0x70f6('0x42')](_0x558013[_0x70f6('0x3d')]['fields']));_0x39d42c['attributes']=_0x39d42c['attributes'][_0x70f6('0x43')]?_0x39d42c[_0x70f6('0x41')]:_0x111e05[_0x70f6('0x40')];_0x39d42c[_0x70f6('0x45')]=qs[_0x70f6('0x46')](_0x558013[_0x70f6('0x3d')][_0x70f6('0x46')]);_0x39d42c[_0x70f6('0x47')]=qs[_0x70f6('0x3e')](_[_0x70f6('0x48')](_0x558013['query'],_0x111e05[_0x70f6('0x3e')]));if(_0x558013[_0x70f6('0x3d')][_0x70f6('0x49')]){_0x39d42c[_0x70f6('0x47')]=_[_0x70f6('0x4a')](_0x39d42c[_0x70f6('0x47')],{'$or':_[_0x70f6('0x3b')](_0x39d42c[_0x70f6('0x41')],function(_0x164057){var _0x2369f6={};_0x2369f6[_0x164057]={'$like':'%'+_0x558013[_0x70f6('0x3d')]['filter']+'%'};return _0x2369f6;})});}_0x39d42c=_['merge']({},_0x39d42c,_0x558013['options']);return _0x3b8b5a[_0x70f6('0x5c')](_0x39d42c);}})[_0x70f6('0x1f')](function(_0x118c02){if(_0x118c02){_0x313001=_0x118c02[_0x70f6('0x43')];if(!_0x558013[_0x70f6('0x3d')][_0x70f6('0x58')](_0x70f6('0x44'))){_0x39d42c[_0x70f6('0x2f')]=qs['limit'](_0x558013[_0x70f6('0x3d')][_0x70f6('0x2f')]);_0x39d42c[_0x70f6('0x2e')]=qs[_0x70f6('0x2e')](_0x558013[_0x70f6('0x3d')][_0x70f6('0x2e')]);}return _0x3b8b5a[_0x70f6('0x5c')](_0x39d42c);}})['then'](function(_0x596e18){if(_0x596e18){return _0x596e18?{'count':_0x313001,'rows':_0x596e18}:null;}})['then'](respondWithResult(_0x8aace1,null))['catch'](handleError(_0x8aace1,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 7877890..0483277 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 _0x9bee=['exports','define','Dynamics365Configuration','int_dynamics365_configurations','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes'];(function(_0x21b038,_0xed8de6){var _0x2e8af3=function(_0x4da8b8){while(--_0x4da8b8){_0x21b038['push'](_0x21b038['shift']());}};_0x2e8af3(++_0xed8de6);}(_0x9bee,0xf4));var _0xe9be=function(_0xb953a,_0x3d230e){_0xb953a=_0xb953a-0x0;var _0x27ea69=_0x9bee[_0xb953a];return _0x27ea69;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe9be('0x0'))(_0xe9be('0x1'));var moment=require('moment');var BPromise=require(_0xe9be('0x2'));var rp=require(_0xe9be('0x3'));var fs=require('fs');var path=require(_0xe9be('0x4'));var rimraf=require(_0xe9be('0x5'));var config=require(_0xe9be('0x6'));var attributes=require(_0xe9be('0x7'));module[_0xe9be('0x8')]=function(_0x1d5c7a,_0x5bbaad){return _0x1d5c7a[_0xe9be('0x9')](_0xe9be('0xa'),attributes,{'tableName':_0xe9be('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3896=['Dynamics365Configuration','int_dynamics365_configurations','lodash','api','moment','bluebird','request-promise','path','./intDynamics365Configuration.attributes','exports','define'];(function(_0x170f87,_0x3cc843){var _0x6a3734=function(_0x20f6a0){while(--_0x20f6a0){_0x170f87['push'](_0x170f87['shift']());}};_0x6a3734(++_0x3cc843);}(_0x3896,0x65));var _0x6389=function(_0x193cc1,_0x27dc0f){_0x193cc1=_0x193cc1-0x0;var _0x3c1de5=_0x3896[_0x193cc1];return _0x3c1de5;};'use strict';var _=require(_0x6389('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6389('0x1'));var moment=require(_0x6389('0x2'));var BPromise=require(_0x6389('0x3'));var rp=require(_0x6389('0x4'));var fs=require('fs');var path=require(_0x6389('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6389('0x6'));module[_0x6389('0x7')]=function(_0x59a16a,_0x24b728){return _0x59a16a[_0x6389('0x8')](_0x6389('0x9'),attributes,{'tableName':_0x6389('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 18a8267..1d024cb 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 _0xff43=['then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x3728d4,_0x4a170e){var _0x3ef589=function(_0xe780d9){while(--_0xe780d9){_0x3728d4['push'](_0x3728d4['shift']());}};_0x3ef589(++_0x4a170e);}(_0xff43,0x83));var _0x3ff4=function(_0x25a94a,_0xf765e3){_0x25a94a=_0x25a94a-0x0;var _0x2d16b2=_0xff43[_0x25a94a];return _0x2d16b2;};'use strict';var _=require(_0x3ff4('0x0'));var util=require(_0x3ff4('0x1'));var moment=require(_0x3ff4('0x2'));var BPromise=require(_0x3ff4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3ff4('0x4'));var db=require(_0x3ff4('0x5'))['db'];var utils=require(_0x3ff4('0x6'));var logger=require(_0x3ff4('0x7'))(_0x3ff4('0x8'));var config=require(_0x3ff4('0x9'));var jayson=require(_0x3ff4('0xa'));var client=jayson[_0x3ff4('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1dbed9,_0x2a32f7,_0x9f2b20){return new BPromise(function(_0x5a6fd3,_0x3dc3cd){return client[_0x3ff4('0xc')](_0x1dbed9,_0x9f2b20)[_0x3ff4('0xd')](function(_0x1bcb5c){logger[_0x3ff4('0xe')](_0x3ff4('0xf'),_0x2a32f7,_0x3ff4('0x10'));logger[_0x3ff4('0x11')](_0x3ff4('0x12'),_0x2a32f7,_0x3ff4('0x10'),JSON[_0x3ff4('0x13')](_0x1bcb5c));if(_0x1bcb5c[_0x3ff4('0x14')]){if(_0x1bcb5c['error'][_0x3ff4('0x15')]===0x1f4){logger[_0x3ff4('0x14')](_0x3ff4('0xf'),_0x2a32f7,_0x1bcb5c[_0x3ff4('0x14')][_0x3ff4('0x16')]);return _0x3dc3cd(_0x1bcb5c[_0x3ff4('0x14')][_0x3ff4('0x16')]);}logger[_0x3ff4('0x14')](_0x3ff4('0xf'),_0x2a32f7,_0x1bcb5c['error']['message']);return _0x5a6fd3(_0x1bcb5c[_0x3ff4('0x14')]['message']);}else{logger[_0x3ff4('0xe')](_0x3ff4('0xf'),_0x2a32f7,_0x3ff4('0x10'));_0x5a6fd3(_0x1bcb5c['result'][_0x3ff4('0x16')]);}})[_0x3ff4('0x17')](function(_0x227c95){logger[_0x3ff4('0x14')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2a32f7,_0x227c95);_0x3dc3cd(_0x227c95);});});} \ No newline at end of file +var _0x2fbf=['error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2d23e5,_0x32495a){var _0x38823a=function(_0x21809b){while(--_0x21809b){_0x2d23e5['push'](_0x2d23e5['shift']());}};_0x38823a(++_0x32495a);}(_0x2fbf,0x18c));var _0xf2fb=function(_0x449828,_0x3f1211){_0x449828=_0x449828-0x0;var _0x4c06c4=_0x2fbf[_0x449828];return _0x4c06c4;};'use strict';var _=require(_0xf2fb('0x0'));var util=require(_0xf2fb('0x1'));var moment=require(_0xf2fb('0x2'));var BPromise=require('bluebird');var rs=require(_0xf2fb('0x3'));var fs=require('fs');var Redis=require(_0xf2fb('0x4'));var db=require(_0xf2fb('0x5'))['db'];var utils=require(_0xf2fb('0x6'));var logger=require(_0xf2fb('0x7'))('rpc');var config=require(_0xf2fb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf2fb('0x9')][_0xf2fb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57cead,_0x15e2e9,_0x3ca9b7){return new BPromise(function(_0x501163,_0x313cfc){return client[_0xf2fb('0xb')](_0x57cead,_0x3ca9b7)['then'](function(_0x34fc25){logger[_0xf2fb('0xc')](_0xf2fb('0xd'),_0x15e2e9,_0xf2fb('0xe'));logger[_0xf2fb('0xf')](_0xf2fb('0x10'),_0x15e2e9,_0xf2fb('0xe'),JSON[_0xf2fb('0x11')](_0x34fc25));if(_0x34fc25[_0xf2fb('0x12')]){if(_0x34fc25[_0xf2fb('0x12')][_0xf2fb('0x13')]===0x1f4){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x15e2e9,_0x34fc25[_0xf2fb('0x12')][_0xf2fb('0x14')]);return _0x313cfc(_0x34fc25[_0xf2fb('0x12')][_0xf2fb('0x14')]);}logger[_0xf2fb('0x12')](_0xf2fb('0xd'),_0x15e2e9,_0x34fc25['error']['message']);return _0x501163(_0x34fc25['error'][_0xf2fb('0x14')]);}else{logger[_0xf2fb('0xc')](_0xf2fb('0xd'),_0x15e2e9,'request\x20sent');_0x501163(_0x34fc25[_0xf2fb('0x15')]['message']);}})[_0xf2fb('0x16')](function(_0x3cad20){logger[_0xf2fb('0x12')](_0xf2fb('0xd'),_0x15e2e9,_0x3cad20);_0x313cfc(_0x3cad20);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index edb6193..a46527f 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 _0x2121=['util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x2121,0x1b4));var _0x1212=function(_0x14b29c,_0x38d9ce){_0x14b29c=_0x14b29c-0x0;var _0x2aa8c0=_0x2121[_0x14b29c];return _0x2aa8c0;};'use strict';var multer=require(_0x1212('0x0'));var util=require(_0x1212('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1212('0x2'));var router=express[_0x1212('0x3')]();var auth=require(_0x1212('0x4'));var interaction=require(_0x1212('0x5'));var config=require(_0x1212('0x6'));var controller=require('./intDynamics365Field.controller');router[_0x1212('0x7')]('/',auth['isAuthenticated'](),controller[_0x1212('0x8')]);router[_0x1212('0x7')](_0x1212('0x9'),auth[_0x1212('0xa')](),controller[_0x1212('0xb')]);router[_0x1212('0xc')]('/',auth['isAuthenticated'](),controller[_0x1212('0xd')]);router[_0x1212('0xe')](_0x1212('0x9'),auth[_0x1212('0xa')](),controller[_0x1212('0xf')]);router[_0x1212('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x1212('0x11')]);module[_0x1212('0x12')]=router; \ No newline at end of file +var _0x0713=['isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intDynamics365Field.controller','get'];(function(_0x307c4d,_0x2e1754){var _0x311517=function(_0x3119f8){while(--_0x3119f8){_0x307c4d['push'](_0x307c4d['shift']());}};_0x311517(++_0x2e1754);}(_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('0xc')]('/',auth[_0x3071('0x8')](),controller[_0x3071('0xd')]);router[_0x3071('0xe')]('/:id',auth[_0x3071('0x8')](),controller[_0x3071('0xf')]);router[_0x3071('0x10')](_0x3071('0xa'),auth[_0x3071('0x8')](),controller['destroy']);module[_0x3071('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 33cc5f7..ea97e82 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 _0x710e=['variable','customVariable','keyValue','STRING','ENUM','BOOLEAN','sequelize','string'];(function(_0x5a11ad,_0x3323b1){var _0x5cf950=function(_0x3c0974){while(--_0x3c0974){_0x5a11ad['push'](_0x5a11ad['shift']());}};_0x5cf950(++_0x3323b1);}(_0x710e,0xb6));var _0xe710=function(_0x9c1a55,_0x40be09){_0x9c1a55=_0x9c1a55-0x0;var _0x5a13bb=_0x710e[_0x9c1a55];return _0x5a13bb;};'use strict';var Sequelize=require(_0xe710('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xe710('0x1'),_0xe710('0x2'),_0xe710('0x3'),_0xe710('0x4')),'defaultValue':_0xe710('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xe710('0x5')]},'keyType':{'type':Sequelize[_0xe710('0x6')]('string','variable',_0xe710('0x3'))},'keyContent':{'type':Sequelize[_0xe710('0x5')]},'idField':{'type':Sequelize[_0xe710('0x5')]},'nameField':{'type':Sequelize[_0xe710('0x5')]},'customField':{'type':Sequelize[_0xe710('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe710('0x5')]}}; \ No newline at end of file +var _0x5d7b=['keyValue','STRING','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x5d7b,0x1e2));var _0xb5d7=function(_0x5e3b18,_0x198773){_0x5e3b18=_0x5e3b18-0x0;var _0x2d3391=_0x5d7b[_0x5e3b18];return _0x2d3391;};'use strict';var Sequelize=require(_0xb5d7('0x0'));module[_0xb5d7('0x1')]={'type':{'type':Sequelize[_0xb5d7('0x2')](_0xb5d7('0x3'),_0xb5d7('0x4'),_0xb5d7('0x5'),_0xb5d7('0x6')),'defaultValue':_0xb5d7('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xb5d7('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xb5d7('0x3'),_0xb5d7('0x4'),_0xb5d7('0x5'))},'keyContent':{'type':Sequelize[_0xb5d7('0x7')]},'idField':{'type':Sequelize[_0xb5d7('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb5d7('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index eb9b6d1..6631980 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 _0xba35=['desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','limit','set','apply','reject','save','update','destroy','then','error','name','map','Dynamics365Field','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','html-pdf','eml-format','rimraf','zip-dir','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce'];(function(_0x139b63,_0x389ca8){var _0x2493f2=function(_0x137a08){while(--_0x137a08){_0x139b63['push'](_0x139b63['shift']());}};_0x2493f2(++_0x389ca8);}(_0xba35,0x190));var _0x5ba3=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xba35[_0x167cc1];return _0x10bc4b;};'use strict';var pdf=require(_0x5ba3('0x0'));var emlformat=require(_0x5ba3('0x1'));var rimraf=require(_0x5ba3('0x2'));var zipdir=require(_0x5ba3('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5ba3('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5ba3('0x5'));var path=require(_0x5ba3('0x6'));var sox=require(_0x5ba3('0x7'));var csv=require(_0x5ba3('0x8'));var ejs=require(_0x5ba3('0x9'));var fs=require('fs');var _=require(_0x5ba3('0xa'));var squel=require(_0x5ba3('0xb'));var crypto=require(_0x5ba3('0xc'));var jsforce=require(_0x5ba3('0xd'));var deskjs=require(_0x5ba3('0xe'));var toCsv=require(_0x5ba3('0x8'));var querystring=require(_0x5ba3('0xf'));var Papa=require(_0x5ba3('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5ba3('0x11'));var as=require(_0x5ba3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5ba3('0x13'))(_0x5ba3('0x14'));var utils=require(_0x5ba3('0x15'));var config=require(_0x5ba3('0x16'));var db=require(_0x5ba3('0x17'))['db'];function respondWithStatusCode(_0x3f8f38,_0x3c988a){_0x3c988a=_0x3c988a||0xcc;return function(_0x3306da){if(_0x3306da){return _0x3f8f38['sendStatus'](_0x3c988a);}return _0x3f8f38['status'](_0x3c988a)[_0x5ba3('0x18')]();};}function respondWithResult(_0x6d6703,_0x3a7491){_0x3a7491=_0x3a7491||0xc8;return function(_0x339932){if(_0x339932){return _0x6d6703[_0x5ba3('0x19')](_0x3a7491)[_0x5ba3('0x1a')](_0x339932);}};}function respondWithFilteredResult(_0xdc5314,_0x9abfb0){return function(_0x33ccd9){if(_0x33ccd9){var _0x33be06=_0x33ccd9[_0x5ba3('0x1b')],_0x171532=_0x9abfb0[_0x5ba3('0x1c')],_0x5d3850=_0x9abfb0[_0x5ba3('0x1c')]+_0x9abfb0[_0x5ba3('0x1d')],_0x2a8f89;if(_0x5d3850>=_0x33be06){_0x5d3850=_0x33be06;_0x2a8f89=0xc8;}else{_0x2a8f89=0xce;}_0xdc5314[_0x5ba3('0x19')](_0x2a8f89);return _0xdc5314[_0x5ba3('0x1e')]('Content-Range',_0x171532+'-'+_0x5d3850+'/'+_0x33be06)[_0x5ba3('0x1a')](_0x33ccd9);}return null;};}function patchUpdates(_0x4bc7f2){return function(_0x47c76b){try{jsonpatch[_0x5ba3('0x1f')](_0x47c76b,_0x4bc7f2,!![]);}catch(_0x2b5406){return BPromise[_0x5ba3('0x20')](_0x2b5406);}return _0x47c76b[_0x5ba3('0x21')]();};}function saveUpdates(_0x2a0d6b,_0x5781e3){return function(_0x25fb4a){if(_0x25fb4a){return _0x25fb4a[_0x5ba3('0x22')](_0x2a0d6b)['then'](function(_0x24ff38){return _0x24ff38;});}return null;};}function removeEntity(_0x1a2646,_0x134ccb){return function(_0xe2f84){if(_0xe2f84){return _0xe2f84[_0x5ba3('0x23')]()[_0x5ba3('0x24')](function(){_0x1a2646['status'](0xcc)[_0x5ba3('0x18')]();});}};}function handleEntityNotFound(_0x13cbd4,_0x4f97e5){return function(_0x137915){if(!_0x137915){_0x13cbd4['sendStatus'](0x194);}return _0x137915;};}function handleError(_0x16e1b3,_0x547708){_0x547708=_0x547708||0x1f4;return function(_0x5549e2){logger[_0x5ba3('0x25')](_0x5549e2['stack']);if(_0x5549e2[_0x5ba3('0x26')]){delete _0x5549e2[_0x5ba3('0x26')];}_0x16e1b3[_0x5ba3('0x19')](_0x547708)['send'](_0x5549e2);};}exports['index']=function(_0x214f1d,_0x286cbf){var _0x198a0e={},_0x4e5a33={},_0x116f12={'count':0x0,'rows':[]};var _0x33530f=_[_0x5ba3('0x27')](db[_0x5ba3('0x28')][_0x5ba3('0x29')],function(_0x56d89f){return{'name':_0x56d89f[_0x5ba3('0x2a')],'type':_0x56d89f[_0x5ba3('0x2b')]['key']};});_0x4e5a33[_0x5ba3('0x2c')]=_['map'](_0x33530f,'name');_0x4e5a33[_0x5ba3('0x2d')]=_['keys'](_0x214f1d[_0x5ba3('0x2d')]);_0x4e5a33[_0x5ba3('0x2e')]=_[_0x5ba3('0x2f')](_0x4e5a33['model'],_0x4e5a33[_0x5ba3('0x2d')]);_0x198a0e[_0x5ba3('0x30')]=_['intersection'](_0x4e5a33[_0x5ba3('0x2c')],qs[_0x5ba3('0x31')](_0x214f1d['query'][_0x5ba3('0x31')]));_0x198a0e['attributes']=_0x198a0e[_0x5ba3('0x30')][_0x5ba3('0x32')]?_0x198a0e[_0x5ba3('0x30')]:_0x4e5a33[_0x5ba3('0x2c')];if(!_0x214f1d[_0x5ba3('0x2d')]['hasOwnProperty'](_0x5ba3('0x33'))){_0x198a0e['limit']=qs[_0x5ba3('0x1d')](_0x214f1d[_0x5ba3('0x2d')][_0x5ba3('0x1d')]);_0x198a0e['offset']=qs['offset'](_0x214f1d[_0x5ba3('0x2d')][_0x5ba3('0x1c')]);}_0x198a0e['order']=qs[_0x5ba3('0x34')](_0x214f1d[_0x5ba3('0x2d')][_0x5ba3('0x34')]);_0x198a0e[_0x5ba3('0x35')]=qs['filters'](_[_0x5ba3('0x36')](_0x214f1d[_0x5ba3('0x2d')],_0x4e5a33[_0x5ba3('0x2e')]),_0x33530f);if(_0x214f1d[_0x5ba3('0x2d')]['filter']){_0x198a0e[_0x5ba3('0x35')]=_[_0x5ba3('0x37')](_0x198a0e[_0x5ba3('0x35')],{'$or':_['map'](_0x33530f,function(_0x4206f0){if(_0x4206f0['type']!==_0x5ba3('0x38')){var _0x45177c={};_0x45177c[_0x4206f0['name']]={'$like':'%'+_0x214f1d[_0x5ba3('0x2d')][_0x5ba3('0x39')]+'%'};return _0x45177c;}})});}_0x198a0e=_[_0x5ba3('0x37')]({},_0x198a0e,_0x214f1d[_0x5ba3('0x3a')]);var _0x3dce1d={'where':_0x198a0e['where']};return db[_0x5ba3('0x28')][_0x5ba3('0x1b')](_0x3dce1d)[_0x5ba3('0x24')](function(_0x15bc65){_0x116f12[_0x5ba3('0x1b')]=_0x15bc65;if(_0x214f1d[_0x5ba3('0x2d')][_0x5ba3('0x3b')]){_0x198a0e[_0x5ba3('0x3c')]=[{'all':!![]}];}return db['Dynamics365Field'][_0x5ba3('0x3d')](_0x198a0e);})[_0x5ba3('0x24')](function(_0x58cf24){_0x116f12['rows']=_0x58cf24;return _0x116f12;})['then'](respondWithFilteredResult(_0x286cbf,_0x198a0e))[_0x5ba3('0x3e')](handleError(_0x286cbf,null));};exports[_0x5ba3('0x3f')]=function(_0x3f4b71,_0x27b8f3){var _0x5c7b5a={'raw':!![],'where':{'id':_0x3f4b71[_0x5ba3('0x40')]['id']}},_0x5da2c8={};_0x5da2c8['model']=_['keys'](db['Dynamics365Field'][_0x5ba3('0x29')]);_0x5da2c8[_0x5ba3('0x2d')]=_[_0x5ba3('0x41')](_0x3f4b71[_0x5ba3('0x2d')]);_0x5da2c8[_0x5ba3('0x2e')]=_[_0x5ba3('0x2f')](_0x5da2c8[_0x5ba3('0x2c')],_0x5da2c8[_0x5ba3('0x2d')]);_0x5c7b5a[_0x5ba3('0x30')]=_['intersection'](_0x5da2c8[_0x5ba3('0x2c')],qs[_0x5ba3('0x31')](_0x3f4b71[_0x5ba3('0x2d')]['fields']));_0x5c7b5a['attributes']=_0x5c7b5a['attributes']['length']?_0x5c7b5a[_0x5ba3('0x30')]:_0x5da2c8['model'];if(_0x3f4b71['query'][_0x5ba3('0x3b')]){_0x5c7b5a[_0x5ba3('0x3c')]=[{'all':!![]}];}_0x5c7b5a=_[_0x5ba3('0x37')]({},_0x5c7b5a,_0x3f4b71['options']);return db[_0x5ba3('0x28')][_0x5ba3('0x42')](_0x5c7b5a)[_0x5ba3('0x24')](handleEntityNotFound(_0x27b8f3,null))[_0x5ba3('0x24')](respondWithResult(_0x27b8f3,null))[_0x5ba3('0x3e')](handleError(_0x27b8f3,null));};exports[_0x5ba3('0x43')]=function(_0x3bd761,_0x452487){return db[_0x5ba3('0x28')][_0x5ba3('0x43')](_0x3bd761[_0x5ba3('0x44')],{})['then'](respondWithResult(_0x452487,0xc9))['catch'](handleError(_0x452487,null));};exports[_0x5ba3('0x22')]=function(_0x24d164,_0x3f98bf){if(_0x24d164[_0x5ba3('0x44')]['id']){delete _0x24d164[_0x5ba3('0x44')]['id'];}return db[_0x5ba3('0x28')][_0x5ba3('0x42')]({'where':{'id':_0x24d164[_0x5ba3('0x40')]['id']}})[_0x5ba3('0x24')](handleEntityNotFound(_0x3f98bf,null))[_0x5ba3('0x24')](saveUpdates(_0x24d164[_0x5ba3('0x44')],null))[_0x5ba3('0x24')](respondWithResult(_0x3f98bf,null))['catch'](handleError(_0x3f98bf,null));};exports['destroy']=function(_0x80c229,_0x180893){return db['Dynamics365Field'][_0x5ba3('0x42')]({'where':{'id':_0x80c229[_0x5ba3('0x40')]['id']}})['then'](handleEntityNotFound(_0x180893,null))[_0x5ba3('0x24')](removeEntity(_0x180893,null))[_0x5ba3('0x3e')](handleError(_0x180893,null));}; \ No newline at end of file +var _0x010f=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Dynamics365Field','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','status','end','json','offset','limit','set','apply','reject','save','update','destroy','then','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes'];(function(_0x5143b7,_0x3d8b63){var _0x32b654=function(_0x441f5a){while(--_0x441f5a){_0x5143b7['push'](_0x5143b7['shift']());}};_0x32b654(++_0x3d8b63);}(_0x010f,0xa4));var _0xf010=function(_0x444240,_0x33d773){_0x444240=_0x444240-0x0;var _0x331df6=_0x010f[_0x444240];return _0x331df6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf010('0x0'));var rimraf=require(_0xf010('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf010('0x2'));var rp=require(_0xf010('0x3'));var moment=require('moment');var BPromise=require(_0xf010('0x4'));var Mustache=require('mustache');var util=require(_0xf010('0x5'));var path=require(_0xf010('0x6'));var sox=require(_0xf010('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xf010('0x8'));var squel=require(_0xf010('0x9'));var crypto=require(_0xf010('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf010('0xb'));var toCsv=require(_0xf010('0xc'));var querystring=require(_0xf010('0xd'));var Papa=require(_0xf010('0xe'));var Redis=require(_0xf010('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf010('0x10'));var hardwareService=require(_0xf010('0x11'));var logger=require(_0xf010('0x12'))(_0xf010('0x13'));var utils=require('../../config/utils');var config=require(_0xf010('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11f4c6,_0x44a961){_0x44a961=_0x44a961||0xcc;return function(_0x325046){if(_0x325046){return _0x11f4c6['sendStatus'](_0x44a961);}return _0x11f4c6[_0xf010('0x15')](_0x44a961)[_0xf010('0x16')]();};}function respondWithResult(_0x138c5a,_0x31eb75){_0x31eb75=_0x31eb75||0xc8;return function(_0x3c6fe2){if(_0x3c6fe2){return _0x138c5a[_0xf010('0x15')](_0x31eb75)[_0xf010('0x17')](_0x3c6fe2);}};}function respondWithFilteredResult(_0x255746,_0x3629e8){return function(_0x8df04b){if(_0x8df04b){var _0x64aa66=_0x8df04b['count'],_0x27b58e=_0x3629e8[_0xf010('0x18')],_0x5a0f66=_0x3629e8[_0xf010('0x18')]+_0x3629e8[_0xf010('0x19')],_0x41c1a9;if(_0x5a0f66>=_0x64aa66){_0x5a0f66=_0x64aa66;_0x41c1a9=0xc8;}else{_0x41c1a9=0xce;}_0x255746[_0xf010('0x15')](_0x41c1a9);return _0x255746[_0xf010('0x1a')]('Content-Range',_0x27b58e+'-'+_0x5a0f66+'/'+_0x64aa66)[_0xf010('0x17')](_0x8df04b);}return null;};}function patchUpdates(_0x5d2dd9){return function(_0x3bf894){try{jsonpatch[_0xf010('0x1b')](_0x3bf894,_0x5d2dd9,!![]);}catch(_0x50ff70){return BPromise[_0xf010('0x1c')](_0x50ff70);}return _0x3bf894[_0xf010('0x1d')]();};}function saveUpdates(_0x55df64,_0x5e356c){return function(_0x5c79c9){if(_0x5c79c9){return _0x5c79c9[_0xf010('0x1e')](_0x55df64)['then'](function(_0x278d5a){return _0x278d5a;});}return null;};}function removeEntity(_0x3c6acf,_0x48f406){return function(_0x5c2dda){if(_0x5c2dda){return _0x5c2dda[_0xf010('0x1f')]()[_0xf010('0x20')](function(){_0x3c6acf[_0xf010('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4804bd,_0x5dccfb){return function(_0xefabcc){if(!_0xefabcc){_0x4804bd['sendStatus'](0x194);}return _0xefabcc;};}function handleError(_0xf9f0fb,_0x5abe34){_0x5abe34=_0x5abe34||0x1f4;return function(_0x4c38cf){logger['error'](_0x4c38cf[_0xf010('0x21')]);if(_0x4c38cf['name']){delete _0x4c38cf[_0xf010('0x22')];}_0xf9f0fb[_0xf010('0x15')](_0x5abe34)['send'](_0x4c38cf);};}exports[_0xf010('0x23')]=function(_0x377f14,_0x265ba3){var _0x4d1bf9={},_0x1003cf={},_0x3972eb={'count':0x0,'rows':[]};var _0x4a4b34=_[_0xf010('0x24')](db['Dynamics365Field'][_0xf010('0x25')],function(_0x1a550b){return{'name':_0x1a550b[_0xf010('0x26')],'type':_0x1a550b[_0xf010('0x27')]['key']};});_0x1003cf[_0xf010('0x28')]=_['map'](_0x4a4b34,'name');_0x1003cf[_0xf010('0x29')]=_[_0xf010('0x2a')](_0x377f14[_0xf010('0x29')]);_0x1003cf[_0xf010('0x2b')]=_[_0xf010('0x2c')](_0x1003cf[_0xf010('0x28')],_0x1003cf[_0xf010('0x29')]);_0x4d1bf9[_0xf010('0x2d')]=_[_0xf010('0x2c')](_0x1003cf[_0xf010('0x28')],qs[_0xf010('0x2e')](_0x377f14[_0xf010('0x29')]['fields']));_0x4d1bf9['attributes']=_0x4d1bf9[_0xf010('0x2d')][_0xf010('0x2f')]?_0x4d1bf9[_0xf010('0x2d')]:_0x1003cf['model'];if(!_0x377f14['query'][_0xf010('0x30')](_0xf010('0x31'))){_0x4d1bf9[_0xf010('0x19')]=qs[_0xf010('0x19')](_0x377f14['query'][_0xf010('0x19')]);_0x4d1bf9[_0xf010('0x18')]=qs[_0xf010('0x18')](_0x377f14[_0xf010('0x29')][_0xf010('0x18')]);}_0x4d1bf9[_0xf010('0x32')]=qs[_0xf010('0x33')](_0x377f14[_0xf010('0x29')][_0xf010('0x33')]);_0x4d1bf9[_0xf010('0x34')]=qs[_0xf010('0x2b')](_[_0xf010('0x35')](_0x377f14['query'],_0x1003cf['filters']),_0x4a4b34);if(_0x377f14['query'][_0xf010('0x36')]){_0x4d1bf9[_0xf010('0x34')]=_[_0xf010('0x37')](_0x4d1bf9[_0xf010('0x34')],{'$or':_[_0xf010('0x24')](_0x4a4b34,function(_0x54940a){if(_0x54940a['type']!==_0xf010('0x38')){var _0x13dedd={};_0x13dedd[_0x54940a[_0xf010('0x22')]]={'$like':'%'+_0x377f14[_0xf010('0x29')]['filter']+'%'};return _0x13dedd;}})});}_0x4d1bf9=_[_0xf010('0x37')]({},_0x4d1bf9,_0x377f14[_0xf010('0x39')]);var _0x564839={'where':_0x4d1bf9['where']};return db[_0xf010('0x3a')][_0xf010('0x3b')](_0x564839)['then'](function(_0x27abca){_0x3972eb['count']=_0x27abca;if(_0x377f14[_0xf010('0x29')][_0xf010('0x3c')]){_0x4d1bf9[_0xf010('0x3d')]=[{'all':!![]}];}return db[_0xf010('0x3a')][_0xf010('0x3e')](_0x4d1bf9);})[_0xf010('0x20')](function(_0x256adf){_0x3972eb[_0xf010('0x3f')]=_0x256adf;return _0x3972eb;})[_0xf010('0x20')](respondWithFilteredResult(_0x265ba3,_0x4d1bf9))[_0xf010('0x40')](handleError(_0x265ba3,null));};exports[_0xf010('0x41')]=function(_0x43dc4c,_0x273173){var _0x112046={'raw':!![],'where':{'id':_0x43dc4c[_0xf010('0x42')]['id']}},_0x267436={};_0x267436[_0xf010('0x28')]=_[_0xf010('0x2a')](db['Dynamics365Field'][_0xf010('0x25')]);_0x267436['query']=_['keys'](_0x43dc4c['query']);_0x267436[_0xf010('0x2b')]=_[_0xf010('0x2c')](_0x267436[_0xf010('0x28')],_0x267436[_0xf010('0x29')]);_0x112046[_0xf010('0x2d')]=_[_0xf010('0x2c')](_0x267436[_0xf010('0x28')],qs[_0xf010('0x2e')](_0x43dc4c[_0xf010('0x29')][_0xf010('0x2e')]));_0x112046['attributes']=_0x112046[_0xf010('0x2d')]['length']?_0x112046[_0xf010('0x2d')]:_0x267436[_0xf010('0x28')];if(_0x43dc4c[_0xf010('0x29')][_0xf010('0x3c')]){_0x112046[_0xf010('0x3d')]=[{'all':!![]}];}_0x112046=_[_0xf010('0x37')]({},_0x112046,_0x43dc4c['options']);return db[_0xf010('0x3a')][_0xf010('0x43')](_0x112046)['then'](handleEntityNotFound(_0x273173,null))[_0xf010('0x20')](respondWithResult(_0x273173,null))[_0xf010('0x40')](handleError(_0x273173,null));};exports['create']=function(_0x575dc1,_0x253141){return db[_0xf010('0x3a')][_0xf010('0x44')](_0x575dc1[_0xf010('0x45')],{})[_0xf010('0x20')](respondWithResult(_0x253141,0xc9))['catch'](handleError(_0x253141,null));};exports[_0xf010('0x1e')]=function(_0xc7fed0,_0x250e65){if(_0xc7fed0[_0xf010('0x45')]['id']){delete _0xc7fed0[_0xf010('0x45')]['id'];}return db[_0xf010('0x3a')][_0xf010('0x43')]({'where':{'id':_0xc7fed0[_0xf010('0x42')]['id']}})['then'](handleEntityNotFound(_0x250e65,null))[_0xf010('0x20')](saveUpdates(_0xc7fed0[_0xf010('0x45')],null))[_0xf010('0x20')](respondWithResult(_0x250e65,null))[_0xf010('0x40')](handleError(_0x250e65,null));};exports[_0xf010('0x1f')]=function(_0x3e9536,_0x184af0){return db['Dynamics365Field']['find']({'where':{'id':_0x3e9536['params']['id']}})['then'](handleEntityNotFound(_0x184af0,null))[_0xf010('0x20')](removeEntity(_0x184af0,null))['catch'](handleError(_0x184af0,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index fcb68a7..a60b6ca 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 _0xaddd=['define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports'];(function(_0x1d8820,_0x1851f7){var _0x191963=function(_0x5bae4e){while(--_0x5bae4e){_0x1d8820['push'](_0x1d8820['shift']());}};_0x191963(++_0x1851f7);}(_0xaddd,0x1f0));var _0xdadd=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xaddd[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xdadd('0x0'));var util=require('util');var logger=require(_0xdadd('0x1'))('api');var moment=require(_0xdadd('0x2'));var BPromise=require(_0xdadd('0x3'));var rp=require(_0xdadd('0x4'));var fs=require('fs');var path=require(_0xdadd('0x5'));var rimraf=require(_0xdadd('0x6'));var config=require('../../config/environment');var attributes=require('./intDynamics365Field.attributes');module[_0xdadd('0x7')]=function(_0x5fc773,_0xb6f73a){return _0x5fc773[_0xdadd('0x8')](_0xdadd('0x9'),attributes,{'tableName':_0xdadd('0xa'),'paranoid':![],'indexes':[{'name':_0xdadd('0xb'),'fields':[_0xdadd('0xc'),_0xdadd('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdc8c=['./intDynamics365Field.attributes','exports','define','Dynamics365Field','dynamics365_unique_index','idField','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1cb831,_0x54cb40){var _0x15777d=function(_0x4afb01){while(--_0x4afb01){_0x1cb831['push'](_0x1cb831['shift']());}};_0x15777d(++_0x54cb40);}(_0xdc8c,0x6f));var _0xcdc8=function(_0x470e24,_0x424998){_0x470e24=_0x470e24-0x0;var _0x2750a0=_0xdc8c[_0x470e24];return _0x2750a0;};'use strict';var _=require(_0xcdc8('0x0'));var util=require('util');var logger=require(_0xcdc8('0x1'))(_0xcdc8('0x2'));var moment=require(_0xcdc8('0x3'));var BPromise=require(_0xcdc8('0x4'));var rp=require(_0xcdc8('0x5'));var fs=require('fs');var path=require(_0xcdc8('0x6'));var rimraf=require(_0xcdc8('0x7'));var config=require(_0xcdc8('0x8'));var attributes=require(_0xcdc8('0x9'));module[_0xcdc8('0xa')]=function(_0x31a319,_0x10f27b){return _0x31a319[_0xcdc8('0xb')](_0xcdc8('0xc'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0xcdc8('0xd'),'fields':[_0xcdc8('0xe'),'FieldId'],'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 e895115..f58e0ec 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 _0xe0c1=['then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','http','request'];(function(_0x13e453,_0x4ab30c){var _0x26aad2=function(_0x3387a1){while(--_0x3387a1){_0x13e453['push'](_0x13e453['shift']());}};_0x26aad2(++_0x4ab30c);}(_0xe0c1,0x10f));var _0x1e0c=function(_0xde4490,_0x3a7e5e){_0xde4490=_0xde4490-0x0;var _0xc951c9=_0xe0c1[_0xde4490];return _0xc951c9;};'use strict';var _=require(_0x1e0c('0x0'));var util=require(_0x1e0c('0x1'));var moment=require(_0x1e0c('0x2'));var BPromise=require(_0x1e0c('0x3'));var rs=require(_0x1e0c('0x4'));var fs=require('fs');var Redis=require(_0x1e0c('0x5'));var db=require(_0x1e0c('0x6'))['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['client'][_0x1e0c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3ccad8,_0x876ada,_0x3d4bf5){return new BPromise(function(_0x21f9d0,_0x2241a2){return client[_0x1e0c('0x8')](_0x3ccad8,_0x3d4bf5)[_0x1e0c('0x9')](function(_0x5182bb){logger[_0x1e0c('0xa')](_0x1e0c('0xb'),_0x876ada,_0x1e0c('0xc'));logger[_0x1e0c('0xd')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x876ada,_0x1e0c('0xc'),JSON[_0x1e0c('0xe')](_0x5182bb));if(_0x5182bb[_0x1e0c('0xf')]){if(_0x5182bb['error'][_0x1e0c('0x10')]===0x1f4){logger['error'](_0x1e0c('0xb'),_0x876ada,_0x5182bb[_0x1e0c('0xf')][_0x1e0c('0x11')]);return _0x2241a2(_0x5182bb[_0x1e0c('0xf')][_0x1e0c('0x11')]);}logger[_0x1e0c('0xf')](_0x1e0c('0xb'),_0x876ada,_0x5182bb[_0x1e0c('0xf')][_0x1e0c('0x11')]);return _0x21f9d0(_0x5182bb[_0x1e0c('0xf')]['message']);}else{logger[_0x1e0c('0xa')]('Dynamics365Field,\x20%s,\x20%s',_0x876ada,_0x1e0c('0xc'));_0x21f9d0(_0x5182bb[_0x1e0c('0x12')][_0x1e0c('0x11')]);}})[_0x1e0c('0x13')](function(_0x3dfe8e){logger[_0x1e0c('0xf')](_0x1e0c('0xb'),_0x876ada,_0x3dfe8e);_0x2241a2(_0x3dfe8e);});});} \ No newline at end of file +var _0x565e=['stringify','error','code','Dynamics365Field,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s'];(function(_0x5a46f8,_0x522877){var _0x46360e=function(_0x5b329a){while(--_0x5b329a){_0x5a46f8['push'](_0x5a46f8['shift']());}};_0x46360e(++_0x522877);}(_0x565e,0x7f));var _0xe565=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x565e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe565('0x0'));var util=require('util');var moment=require(_0xe565('0x1'));var BPromise=require(_0xe565('0x2'));var rs=require(_0xe565('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe565('0x4'));var logger=require(_0xe565('0x5'))(_0xe565('0x6'));var config=require(_0xe565('0x7'));var jayson=require(_0xe565('0x8'));var client=jayson[_0xe565('0x9')][_0xe565('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a9d48,_0x470daf,_0x359a05){return new BPromise(function(_0x1204c8,_0x14f3df){return client[_0xe565('0xb')](_0x1a9d48,_0x359a05)[_0xe565('0xc')](function(_0x1d3d48){logger[_0xe565('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x470daf,_0xe565('0xe'));logger[_0xe565('0xf')](_0xe565('0x10'),_0x470daf,'request\x20sent',JSON[_0xe565('0x11')](_0x1d3d48));if(_0x1d3d48[_0xe565('0x12')]){if(_0x1d3d48[_0xe565('0x12')][_0xe565('0x13')]===0x1f4){logger['error'](_0xe565('0x14'),_0x470daf,_0x1d3d48['error'][_0xe565('0x15')]);return _0x14f3df(_0x1d3d48['error'][_0xe565('0x15')]);}logger[_0xe565('0x12')](_0xe565('0x14'),_0x470daf,_0x1d3d48['error'][_0xe565('0x15')]);return _0x1204c8(_0x1d3d48[_0xe565('0x12')][_0xe565('0x15')]);}else{logger[_0xe565('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x470daf,_0xe565('0xe'));_0x1204c8(_0x1d3d48[_0xe565('0x16')][_0xe565('0x15')]);}})[_0xe565('0x17')](function(_0x3899de){logger[_0xe565('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0x470daf,_0x3899de);_0x14f3df(_0x3899de);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index df4a625..f41e947 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 _0xdf33=['destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','update','delete'];(function(_0x46b2f0,_0x52ad70){var _0x423fb3=function(_0x2b9799){while(--_0x2b9799){_0x46b2f0['push'](_0x46b2f0['shift']());}};_0x423fb3(++_0x52ad70);}(_0xdf33,0x1a4));var _0x3df3=function(_0x194511,_0x352b46){_0x194511=_0x194511-0x0;var _0x4877b5=_0xdf33[_0x194511];return _0x4877b5;};'use strict';var multer=require(_0x3df3('0x0'));var util=require(_0x3df3('0x1'));var path=require(_0x3df3('0x2'));var timeout=require(_0x3df3('0x3'));var express=require(_0x3df3('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x3df3('0x5'));var config=require(_0x3df3('0x6'));var controller=require(_0x3df3('0x7'));router[_0x3df3('0x8')]('/',auth[_0x3df3('0x9')](),controller[_0x3df3('0xa')]);router[_0x3df3('0x8')](_0x3df3('0xb'),auth[_0x3df3('0x9')](),controller[_0x3df3('0xc')]);router[_0x3df3('0x8')](_0x3df3('0xd'),auth['isAuthenticated'](),controller[_0x3df3('0xe')]);router[_0x3df3('0x8')](_0x3df3('0xf'),auth[_0x3df3('0x9')](),controller[_0x3df3('0x10')]);router[_0x3df3('0x11')]('/',auth[_0x3df3('0x9')](),controller['create']);router[_0x3df3('0x11')](_0x3df3('0xd'),auth[_0x3df3('0x9')](),controller['addConfiguration']);router['put'](_0x3df3('0xb'),auth[_0x3df3('0x9')](),controller[_0x3df3('0x12')]);router[_0x3df3('0x13')](_0x3df3('0xb'),auth['isAuthenticated'](),controller[_0x3df3('0x14')]);module[_0x3df3('0x15')]=router; \ No newline at end of file +var _0xbde4=['put','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','index','/:id','show','get','isAuthenticated','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations'];(function(_0x586b53,_0x52adc7){var _0x52ed8a=function(_0x1a34bd){while(--_0x1a34bd){_0x586b53['push'](_0x586b53['shift']());}};_0x52ed8a(++_0x52adc7);}(_0xbde4,0x1a5));var _0x4bde=function(_0x22c0db,_0x3ca913){_0x22c0db=_0x22c0db-0x0;var _0x2b81bc=_0xbde4[_0x22c0db];return _0x2b81bc;};'use strict';var multer=require(_0x4bde('0x0'));var util=require(_0x4bde('0x1'));var path=require(_0x4bde('0x2'));var timeout=require(_0x4bde('0x3'));var express=require(_0x4bde('0x4'));var router=express[_0x4bde('0x5')]();var auth=require(_0x4bde('0x6'));var interaction=require(_0x4bde('0x7'));var config=require('../../config/environment');var controller=require('./intFreshdeskAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x4bde('0x8')]);router['get'](_0x4bde('0x9'),auth['isAuthenticated'](),controller[_0x4bde('0xa')]);router[_0x4bde('0xb')]('/:id/configurations',auth[_0x4bde('0xc')](),controller[_0x4bde('0xd')]);router[_0x4bde('0xb')](_0x4bde('0xe'),auth[_0x4bde('0xc')](),controller[_0x4bde('0xf')]);router[_0x4bde('0x10')]('/',auth[_0x4bde('0xc')](),controller[_0x4bde('0x11')]);router[_0x4bde('0x10')](_0x4bde('0x12'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x4bde('0x13')](_0x4bde('0x9'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x4bde('0xc')](),controller[_0x4bde('0x14')]);module[_0x4bde('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index bd1188e..311ffc7 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 _0x2c16=['sequelize','exports','STRING','username','remoteUri'];(function(_0xb6160,_0x206fdb){var _0xce706e=function(_0x581daa){while(--_0x581daa){_0xb6160['push'](_0xb6160['shift']());}};_0xce706e(++_0x206fdb);}(_0x2c16,0xf0));var _0x62c1=function(_0x506e0c,_0x4c1ad2){_0x506e0c=_0x506e0c-0x0;var _0x26bc22=_0x2c16[_0x506e0c];return _0x26bc22;};'use strict';var Sequelize=require(_0x62c1('0x0'));module[_0x62c1('0x1')]={'name':{'type':Sequelize[_0x62c1('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x62c1('0x2')],'unique':_0x62c1('0x3')},'apiKey':{'type':Sequelize[_0x62c1('0x2')]},'remoteUri':{'type':Sequelize[_0x62c1('0x2')],'unique':_0x62c1('0x4')},'serverUrl':{'type':Sequelize[_0x62c1('0x2')]}}; \ No newline at end of file +var _0x5a3c=['exports','STRING','username','remoteUri','sequelize'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0x5a3c,0x176));var _0xc5a3=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x5a3c[_0x13b8f3];return _0x1a6d06;};'use strict';var Sequelize=require(_0xc5a3('0x0'));module[_0xc5a3('0x1')]={'name':{'type':Sequelize[_0xc5a3('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xc5a3('0x2')],'unique':_0xc5a3('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xc5a3('0x2')],'unique':_0xc5a3('0x4')},'serverUrl':{'type':Sequelize[_0xc5a3('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 32fbc5d..30241be 100644 --- a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js +++ b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['requester','subject','agent','priority','group','source','ticket_type','company','remove','includes','custom_text','custom_dropdown','label','choices','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','json','count','set','Content-Range','reject','update','end','stack','send','map','FreshdeskAccount','rawAttributes','type','key','model','name','query','filters','intersection','attributes','fields','limit','offset','sort','where','pick','filter','merge','VIRTUAL','include','findAll','params','keys','length','options','find','create','body','destroy','getConfigurations','findOne','FreshdeskConfiguration','order','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X'];(function(_0x107b75,_0x34e51a){var _0x4a94fb=function(_0x562f39){while(--_0x562f39){_0x107b75['push'](_0x107b75['shift']());}};_0x4a94fb(++_0x34e51a);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];var integrations=require(_0x7995('0x1a'));var jayson=require(_0x7995('0x1b'));var client=jayson[_0x7995('0x1c')][_0x7995('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x23999f,_0x2bbe7a,_0x4cc004){if(_0x4cc004){var _0x58f5ad=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x58f5ad[_0x7995('0x1e')](_0x2bbe7a)){return _0x23999f;}else{throw new db[(_0x7995('0x1f'))][(_0x7995('0x20'))](_0x7995('0x21'));}}else{return _0x23999f;}}function respondWithRpcPromise(_0x3f1d3e,_0x1a5310,_0x2202ce,_0x41cbf0){return new BPromise(function(_0x5377e5,_0x2eeacc){var _0x565d97=_0x41cbf0||client;return _0x565d97[_0x7995('0x22')](_0x3f1d3e,_0x2202ce)[_0x7995('0x23')](function(_0x43d4b8){logger[_0x7995('0x24')](_0x7995('0x25'),_0x1a5310,_0x7995('0x26'));logger['debug']('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x1a5310,_0x7995('0x26'),JSON['stringify'](_0x43d4b8));if(_0x43d4b8['error']){if(_0x43d4b8[_0x7995('0x27')][_0x7995('0x28')]===0x1f4){logger['error'](_0x7995('0x25'),_0x1a5310,_0x43d4b8['error']['message']);return _0x2eeacc(_0x43d4b8[_0x7995('0x27')][_0x7995('0x29')]);}logger[_0x7995('0x27')](_0x7995('0x25'),_0x1a5310,_0x43d4b8[_0x7995('0x27')][_0x7995('0x29')]);return _0x5377e5(_0x43d4b8['error'][_0x7995('0x29')]);}else{logger[_0x7995('0x24')](_0x7995('0x25'),_0x1a5310,_0x7995('0x26'));_0x5377e5(_0x43d4b8[_0x7995('0x2a')][_0x7995('0x29')]);}})[_0x7995('0x2b')](function(_0x472195){logger['error'](_0x7995('0x25'),_0x1a5310,_0x472195);_0x2eeacc(_0x472195);});});}function respondWithStatusCode(_0x34e70c,_0x401dc3){_0x401dc3=_0x401dc3||0xcc;return function(_0x268ce7){if(_0x268ce7){return _0x34e70c[_0x7995('0x2c')](_0x401dc3);}return _0x34e70c[_0x7995('0x2d')](_0x401dc3)['end']();};}function respondWithResult(_0x47625f,_0x5911c3){_0x5911c3=_0x5911c3||0xc8;return function(_0x229742){if(_0x229742){return _0x47625f[_0x7995('0x2d')](_0x5911c3)[_0x7995('0x2e')](_0x229742);}};}function respondWithFilteredResult(_0x132a42,_0x11c1eb){return function(_0x4b6f99){if(_0x4b6f99){var _0x9b2a15=_0x4b6f99[_0x7995('0x2f')],_0x514445=_0x11c1eb['offset'],_0x456a28=_0x11c1eb['offset']+_0x11c1eb['limit'],_0x3250e0;if(_0x456a28>=_0x9b2a15){_0x456a28=_0x9b2a15;_0x3250e0=0xc8;}else{_0x3250e0=0xce;}_0x132a42[_0x7995('0x2d')](_0x3250e0);return _0x132a42[_0x7995('0x30')](_0x7995('0x31'),_0x514445+'-'+_0x456a28+'/'+_0x9b2a15)[_0x7995('0x2e')](_0x4b6f99);}return null;};}function patchUpdates(_0x2e3493){return function(_0x1ca460){try{jsonpatch['apply'](_0x1ca460,_0x2e3493,!![]);}catch(_0x481c74){return BPromise[_0x7995('0x32')](_0x481c74);}return _0x1ca460['save']();};}function saveUpdates(_0x553671,_0x3eb566){return function(_0x29fac5){if(_0x29fac5){return _0x29fac5[_0x7995('0x33')](_0x553671)[_0x7995('0x23')](function(_0x510841){return _0x510841;});}return null;};}function removeEntity(_0x44309d,_0x33e24e){return function(_0x5dd802){if(_0x5dd802){return _0x5dd802['destroy']()['then'](function(){_0x44309d[_0x7995('0x2d')](0xcc)[_0x7995('0x34')]();});}};}function handleEntityNotFound(_0x4a176f,_0x3e7020){return function(_0x51b95d){if(!_0x51b95d){_0x4a176f[_0x7995('0x2c')](0x194);}return _0x51b95d;};}function handleError(_0x1cb058,_0x177cb4){_0x177cb4=_0x177cb4||0x1f4;return function(_0x5014d2){logger['error'](_0x5014d2[_0x7995('0x35')]);if(_0x5014d2['name']){delete _0x5014d2['name'];}_0x1cb058[_0x7995('0x2d')](_0x177cb4)[_0x7995('0x36')](_0x5014d2);};}exports['index']=function(_0x1baa15,_0x1922b4){var _0x2b772f={},_0x18667c={},_0x1e3dbf={'count':0x0,'rows':[]};var _0x53002a=_[_0x7995('0x37')](db[_0x7995('0x38')][_0x7995('0x39')],function(_0x1d60b8){return{'name':_0x1d60b8['fieldName'],'type':_0x1d60b8[_0x7995('0x3a')][_0x7995('0x3b')]};});_0x18667c[_0x7995('0x3c')]=_[_0x7995('0x37')](_0x53002a,_0x7995('0x3d'));_0x18667c[_0x7995('0x3e')]=_['keys'](_0x1baa15[_0x7995('0x3e')]);_0x18667c[_0x7995('0x3f')]=_[_0x7995('0x40')](_0x18667c[_0x7995('0x3c')],_0x18667c[_0x7995('0x3e')]);_0x2b772f[_0x7995('0x41')]=_[_0x7995('0x40')](_0x18667c[_0x7995('0x3c')],qs[_0x7995('0x42')](_0x1baa15[_0x7995('0x3e')][_0x7995('0x42')]));_0x2b772f[_0x7995('0x41')]=_0x2b772f[_0x7995('0x41')]['length']?_0x2b772f['attributes']:_0x18667c[_0x7995('0x3c')];if(!_0x1baa15[_0x7995('0x3e')]['hasOwnProperty']('nolimit')){_0x2b772f[_0x7995('0x43')]=qs['limit'](_0x1baa15['query'][_0x7995('0x43')]);_0x2b772f[_0x7995('0x44')]=qs[_0x7995('0x44')](_0x1baa15['query'][_0x7995('0x44')]);}_0x2b772f['order']=qs[_0x7995('0x45')](_0x1baa15['query']['sort']);_0x2b772f[_0x7995('0x46')]=qs[_0x7995('0x3f')](_[_0x7995('0x47')](_0x1baa15[_0x7995('0x3e')],_0x18667c['filters']),_0x53002a);if(_0x1baa15[_0x7995('0x3e')][_0x7995('0x48')]){_0x2b772f[_0x7995('0x46')]=_[_0x7995('0x49')](_0x2b772f['where'],{'$or':_['map'](_0x53002a,function(_0x1c37c6){if(_0x1c37c6['type']!==_0x7995('0x4a')){var _0x59c153={};_0x59c153[_0x1c37c6[_0x7995('0x3d')]]={'$like':'%'+_0x1baa15['query'][_0x7995('0x48')]+'%'};return _0x59c153;}})});}_0x2b772f=_[_0x7995('0x49')]({},_0x2b772f,_0x1baa15['options']);var _0x3e9e62={'where':_0x2b772f[_0x7995('0x46')]};return db[_0x7995('0x38')][_0x7995('0x2f')](_0x3e9e62)['then'](function(_0x2458cb){_0x1e3dbf[_0x7995('0x2f')]=_0x2458cb;if(_0x1baa15[_0x7995('0x3e')]['includeAll']){_0x2b772f[_0x7995('0x4b')]=[{'all':!![]}];}return db[_0x7995('0x38')][_0x7995('0x4c')](_0x2b772f);})[_0x7995('0x23')](function(_0x255313){_0x1e3dbf['rows']=_0x255313;return _0x1e3dbf;})[_0x7995('0x23')](respondWithFilteredResult(_0x1922b4,_0x2b772f))[_0x7995('0x2b')](handleError(_0x1922b4,null));};exports['show']=function(_0x3d1dbb,_0x5843ba){var _0x1d87f9={'raw':![],'where':{'id':_0x3d1dbb[_0x7995('0x4d')]['id']}},_0x187735={};_0x187735[_0x7995('0x3c')]=_[_0x7995('0x4e')](db[_0x7995('0x38')][_0x7995('0x39')]);_0x187735['query']=_[_0x7995('0x4e')](_0x3d1dbb[_0x7995('0x3e')]);_0x187735[_0x7995('0x3f')]=_['intersection'](_0x187735[_0x7995('0x3c')],_0x187735[_0x7995('0x3e')]);_0x1d87f9[_0x7995('0x41')]=_['intersection'](_0x187735['model'],qs['fields'](_0x3d1dbb[_0x7995('0x3e')][_0x7995('0x42')]));_0x1d87f9['attributes']=_0x1d87f9[_0x7995('0x41')][_0x7995('0x4f')]?_0x1d87f9[_0x7995('0x41')]:_0x187735[_0x7995('0x3c')];if(_0x3d1dbb[_0x7995('0x3e')]['includeAll']){_0x1d87f9[_0x7995('0x4b')]=[{'all':!![]}];}_0x1d87f9=_['merge']({},_0x1d87f9,_0x3d1dbb[_0x7995('0x50')]);return db[_0x7995('0x38')][_0x7995('0x51')](_0x1d87f9)['then'](handleEntityNotFound(_0x5843ba,null))['then'](respondWithResult(_0x5843ba,null))['catch'](handleError(_0x5843ba,null));};exports['create']=function(_0x2e13b0,_0x3709de){return db[_0x7995('0x38')][_0x7995('0x52')](_0x2e13b0[_0x7995('0x53')],{})[_0x7995('0x23')](respondWithResult(_0x3709de,0xc9))[_0x7995('0x2b')](handleError(_0x3709de,null));};exports[_0x7995('0x33')]=function(_0x328671,_0x17ecd3){if(_0x328671[_0x7995('0x53')]['id']){delete _0x328671[_0x7995('0x53')]['id'];}return db[_0x7995('0x38')][_0x7995('0x51')]({'where':{'id':_0x328671[_0x7995('0x4d')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x17ecd3,null))[_0x7995('0x23')](saveUpdates(_0x328671[_0x7995('0x53')],null))[_0x7995('0x23')](respondWithResult(_0x17ecd3,null))['catch'](handleError(_0x17ecd3,null));};exports[_0x7995('0x54')]=function(_0x630737,_0x3b8a54){return db[_0x7995('0x38')]['find']({'where':{'id':_0x630737['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x3b8a54,null))[_0x7995('0x23')](removeEntity(_0x3b8a54,null))[_0x7995('0x2b')](handleError(_0x3b8a54,null));};exports[_0x7995('0x55')]=function(_0x51c50b,_0x13cd7b,_0x74ff38){var _0xef5044={};var _0x33c49c={};var _0x502d43;var _0x5e2d97;return db[_0x7995('0x38')][_0x7995('0x56')]({'where':{'id':_0x51c50b[_0x7995('0x4d')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x13cd7b,null))[_0x7995('0x23')](function(_0x27c5cd){if(_0x27c5cd){_0x502d43=_0x27c5cd;_0x33c49c[_0x7995('0x3c')]=_[_0x7995('0x4e')](db[_0x7995('0x57')]['rawAttributes']);_0x33c49c[_0x7995('0x3e')]=_[_0x7995('0x4e')](_0x51c50b[_0x7995('0x3e')]);_0x33c49c[_0x7995('0x3f')]=_['intersection'](_0x33c49c['model'],_0x33c49c[_0x7995('0x3e')]);_0xef5044[_0x7995('0x41')]=_['intersection'](_0x33c49c[_0x7995('0x3c')],qs[_0x7995('0x42')](_0x51c50b[_0x7995('0x3e')][_0x7995('0x42')]));_0xef5044[_0x7995('0x41')]=_0xef5044['attributes'][_0x7995('0x4f')]?_0xef5044['attributes']:_0x33c49c[_0x7995('0x3c')];_0xef5044[_0x7995('0x58')]=qs[_0x7995('0x45')](_0x51c50b[_0x7995('0x3e')][_0x7995('0x45')]);_0xef5044[_0x7995('0x46')]=qs[_0x7995('0x3f')](_[_0x7995('0x47')](_0x51c50b[_0x7995('0x3e')],_0x33c49c[_0x7995('0x3f')]));if(_0x51c50b[_0x7995('0x3e')][_0x7995('0x48')]){_0xef5044['where']=_[_0x7995('0x49')](_0xef5044[_0x7995('0x46')],{'$or':_[_0x7995('0x37')](_0xef5044[_0x7995('0x41')],function(_0x2c6548){var _0x54a2e0={};_0x54a2e0[_0x2c6548]={'$like':'%'+_0x51c50b['query'][_0x7995('0x48')]+'%'};return _0x54a2e0;})});}_0xef5044=_[_0x7995('0x49')]({},_0xef5044,_0x51c50b[_0x7995('0x50')]);return _0x502d43[_0x7995('0x55')](_0xef5044);}})['then'](function(_0x22d317){if(_0x22d317){_0x5e2d97=_0x22d317['length'];if(!_0x51c50b['query'][_0x7995('0x59')](_0x7995('0x5a'))){_0xef5044[_0x7995('0x43')]=qs[_0x7995('0x43')](_0x51c50b[_0x7995('0x3e')][_0x7995('0x43')]);_0xef5044[_0x7995('0x44')]=qs[_0x7995('0x44')](_0x51c50b[_0x7995('0x3e')][_0x7995('0x44')]);}return _0x502d43['getConfigurations'](_0xef5044);}})[_0x7995('0x23')](function(_0x8908cd){if(_0x8908cd){return _0x8908cd?{'count':_0x5e2d97,'rows':_0x8908cd}:null;}})[_0x7995('0x23')](respondWithResult(_0x13cd7b,null))['catch'](handleError(_0x13cd7b,null));};exports[_0x7995('0x5b')]=function(_0x1d2f9d,_0x705f0,_0x3a7d9d){if(_0x1d2f9d[_0x7995('0x53')]['id']){delete _0x1d2f9d[_0x7995('0x53')]['id'];}return db[_0x7995('0x38')][_0x7995('0x56')]({'where':{'id':_0x1d2f9d[_0x7995('0x4d')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x705f0,null))[_0x7995('0x23')](function(_0x535131){if(_0x535131){_0x1d2f9d['body'][_0x7995('0x5c')]=_0x535131['id'];_0x1d2f9d[_0x7995('0x53')][_0x7995('0x5d')]=integrations[_0x7995('0x5e')](_0x1d2f9d['body'][_0x7995('0x5f')],_0x1d2f9d[_0x7995('0x53')]['type']);_0x1d2f9d['body'][_0x7995('0x60')]=integrations[_0x7995('0x61')](_0x1d2f9d['body'][_0x7995('0x5f')],_0x1d2f9d['body'][_0x7995('0x3a')]);return db[_0x7995('0x57')]['create'](_0x1d2f9d['body'],{'include':[{'model':db[_0x7995('0x62')],'as':'Subjects'},{'model':db[_0x7995('0x62')],'as':_0x7995('0x60')}]});}return null;})[_0x7995('0x23')](respondWithResult(_0x705f0,null))[_0x7995('0x2b')](handleError(_0x705f0,null));};exports[_0x7995('0x63')]=function(_0x18cff7,_0x8af865,_0x14cb17){var _0x29e0ee='';return db[_0x7995('0x38')][_0x7995('0x56')]({'where':{'id':_0x18cff7[_0x7995('0x4d')]['id']},'attributes':['id',_0x7995('0x64'),_0x7995('0x65')]})[_0x7995('0x23')](handleEntityNotFound(_0x8af865,null))[_0x7995('0x23')](function(_0x6ad274){if(_0x6ad274){_0x29e0ee=_0x6ad274[_0x7995('0x64')];var _0x2ff7ba=_0x29e0ee[_0x7995('0x66')](-0x1);if(_0x2ff7ba==='/'){_0x29e0ee=_0x29e0ee[_0x7995('0x67')](0x0,_0x29e0ee[_0x7995('0x68')](_0x2ff7ba));}return rp({'method':_0x7995('0x69'),'uri':util[_0x7995('0x6a')](_0x7995('0x6b'),_0x29e0ee,_0x7995('0x6c')),'headers':{'Authorization':util[_0x7995('0x6a')](_0x7995('0x6d'),new Buffer(util['format'](_0x7995('0x6e'),_0x6ad274[_0x7995('0x65')]))['toString']('base64'))},'json':!![]});}})[_0x7995('0x23')](function(_0x3fe8fc){if(_0x3fe8fc){var _0x2d45d5=[_0x7995('0x6f'),_0x7995('0x70'),_0x7995('0x71'),'description',_0x7995('0x2d'),_0x7995('0x72'),_0x7995('0x73'),_0x7995('0x74'),_0x7995('0x75'),_0x7995('0x73'),_0x7995('0x76')];_[_0x7995('0x77')](_0x3fe8fc,function(_0x560095){return _0x2d45d5[_0x7995('0x78')](_0x560095[_0x7995('0x3d')])||!_0x560095['default']&&_0x560095['type']!==_0x7995('0x79')&&_0x560095[_0x7995('0x3a')]!==_0x7995('0x7a');});return{'count':_0x3fe8fc[_0x7995('0x4f')],'rows':_[_0x7995('0x37')](_0x3fe8fc,function(_0x4a02ea){return{'id':_0x4a02ea[_0x7995('0x3d')],'name':_0x4a02ea[_0x7995('0x7b')],'custom':!_0x4a02ea['default'],'options':_0x4a02ea[_0x7995('0x7c')]?_[_0x7995('0x37')](_0x4a02ea['choices'],function(_0x1535a3){return{'name':_['capitalize'](_0x1535a3),'value':_0x1535a3};}):[]};})};}})[_0x7995('0x23')](respondWithResult(_0x8af865,null))[_0x7995('0x2b')](function(_0x3ab421){var _0x428a1b=_0x18cff7[_0x7995('0x3e')]['test']?0x1f4:_0x3ab421[_0x7995('0x7d')]||0x1f4;logger[_0x7995('0x27')](_0x7995('0x7e'),'getFields',_0x428a1b,JSON[_0x7995('0x7f')](_0x3ab421));delete _0x3ab421[_0x7995('0x3d')];if(_0x428a1b===0x191){_0x428a1b=0x190;}_0x8af865[_0x7995('0x2d')](_0x428a1b)[_0x7995('0x36')](_0x18cff7['query'][_0x7995('0x1e')]?{'message':_0x7995('0x80'),'statusCode':_0x3ab421[_0x7995('0x7d')]}:_0x3ab421);});}; \ No newline at end of file +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(_0x350dfd,_0xad33d){var _0xc90b98=function(_0x68420b){while(--_0x68420b){_0x350dfd['push'](_0x350dfd['shift']());}};_0xc90b98(++_0xad33d);}(_0xe14b,0x93));var _0xbe14=function(_0x458f2b,_0x30aa90){_0x458f2b=_0x458f2b-0x0;var _0x442607=_0xe14b[_0x458f2b];return _0x442607;};'use strict';var pdf=require(_0xbe14('0x0'));var emlformat=require(_0xbe14('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbe14('0x2'));var rp=require(_0xbe14('0x3'));var moment=require('moment');var BPromise=require(_0xbe14('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbe14('0x5'));var sox=require(_0xbe14('0x6'));var csv=require(_0xbe14('0x7'));var ejs=require(_0xbe14('0x8'));var fs=require('fs');var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var db=require(_0xbe14('0x14'))['db'];var integrations=require(_0xbe14('0x15'));var jayson=require(_0xbe14('0x16'));var client=jayson[_0xbe14('0x17')][_0xbe14('0x18')]({'port':0x232a});function checkPasswordPattern(_0x2850cb,_0x16893f,_0xa2cf72){if(_0xa2cf72){var _0x1e4826=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1e4826[_0xbe14('0x19')](_0x16893f)){return _0x2850cb;}else{throw new db[(_0xbe14('0x1a'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x2850cb;}}function respondWithRpcPromise(_0x3f58f5,_0x3dc4a9,_0xf4ac9,_0x37ce4e){return new BPromise(function(_0x4e8f34,_0x21c789){var _0xe9c3ec=_0x37ce4e||client;return _0xe9c3ec[_0xbe14('0x1b')](_0x3f58f5,_0xf4ac9)[_0xbe14('0x1c')](function(_0x38f1ea){logger[_0xbe14('0x1d')](_0xbe14('0x1e'),_0x3dc4a9,'request\x20sent');logger[_0xbe14('0x1f')](_0xbe14('0x20'),_0x3dc4a9,_0xbe14('0x21'),JSON[_0xbe14('0x22')](_0x38f1ea));if(_0x38f1ea[_0xbe14('0x23')]){if(_0x38f1ea[_0xbe14('0x23')]['code']===0x1f4){logger[_0xbe14('0x23')](_0xbe14('0x1e'),_0x3dc4a9,_0x38f1ea[_0xbe14('0x23')][_0xbe14('0x24')]);return _0x21c789(_0x38f1ea[_0xbe14('0x23')]['message']);}logger[_0xbe14('0x23')]('FreshdeskAccount,\x20%s,\x20%s',_0x3dc4a9,_0x38f1ea[_0xbe14('0x23')]['message']);return _0x4e8f34(_0x38f1ea[_0xbe14('0x23')]['message']);}else{logger[_0xbe14('0x1d')](_0xbe14('0x1e'),_0x3dc4a9,'request\x20sent');_0x4e8f34(_0x38f1ea[_0xbe14('0x25')]['message']);}})[_0xbe14('0x26')](function(_0x4851f8){logger[_0xbe14('0x23')](_0xbe14('0x1e'),_0x3dc4a9,_0x4851f8);_0x21c789(_0x4851f8);});});}function respondWithStatusCode(_0x1ee9c1,_0x39cc81){_0x39cc81=_0x39cc81||0xcc;return function(_0x15ef02){if(_0x15ef02){return _0x1ee9c1[_0xbe14('0x27')](_0x39cc81);}return _0x1ee9c1['status'](_0x39cc81)[_0xbe14('0x28')]();};}function respondWithResult(_0x1ba46a,_0x391556){_0x391556=_0x391556||0xc8;return function(_0x169369){if(_0x169369){return _0x1ba46a['status'](_0x391556)[_0xbe14('0x29')](_0x169369);}};}function respondWithFilteredResult(_0x29fc64,_0x59bf34){return function(_0x3c3613){if(_0x3c3613){var _0x3b3e84=_0x3c3613[_0xbe14('0x2a')],_0x1c7cc7=_0x59bf34[_0xbe14('0x2b')],_0x19252f=_0x59bf34[_0xbe14('0x2b')]+_0x59bf34[_0xbe14('0x2c')],_0x34d648;if(_0x19252f>=_0x3b3e84){_0x19252f=_0x3b3e84;_0x34d648=0xc8;}else{_0x34d648=0xce;}_0x29fc64[_0xbe14('0x2d')](_0x34d648);return _0x29fc64[_0xbe14('0x2e')](_0xbe14('0x2f'),_0x1c7cc7+'-'+_0x19252f+'/'+_0x3b3e84)[_0xbe14('0x29')](_0x3c3613);}return null;};}function patchUpdates(_0x10ae36){return function(_0x223f7a){try{jsonpatch[_0xbe14('0x30')](_0x223f7a,_0x10ae36,!![]);}catch(_0x6ba36c){return BPromise[_0xbe14('0x31')](_0x6ba36c);}return _0x223f7a[_0xbe14('0x32')]();};}function saveUpdates(_0x14e7c4,_0x581e86){return function(_0x2e33e1){if(_0x2e33e1){return _0x2e33e1['update'](_0x14e7c4)['then'](function(_0x46c2d1){return _0x46c2d1;});}return null;};}function removeEntity(_0x4c1e7e,_0x243524){return function(_0x345b0){if(_0x345b0){return _0x345b0['destroy']()['then'](function(){_0x4c1e7e['status'](0xcc)[_0xbe14('0x28')]();});}};}function handleEntityNotFound(_0xa3d24,_0x5f27b6){return function(_0x46c570){if(!_0x46c570){_0xa3d24[_0xbe14('0x27')](0x194);}return _0x46c570;};}function handleError(_0x452635,_0x1aa849){_0x1aa849=_0x1aa849||0x1f4;return function(_0x29c23e){logger['error'](_0x29c23e['stack']);if(_0x29c23e[_0xbe14('0x33')]){delete _0x29c23e['name'];}_0x452635['status'](_0x1aa849)['send'](_0x29c23e);};}exports[_0xbe14('0x34')]=function(_0x393f6b,_0x2bb45){var _0x3dbacb={},_0x172e79={},_0x29356f={'count':0x0,'rows':[]};var _0xcdc50=_[_0xbe14('0x35')](db[_0xbe14('0x36')][_0xbe14('0x37')],function(_0x41652d){return{'name':_0x41652d[_0xbe14('0x38')],'type':_0x41652d['type']['key']};});_0x172e79[_0xbe14('0x39')]=_[_0xbe14('0x35')](_0xcdc50,_0xbe14('0x33'));_0x172e79['query']=_[_0xbe14('0x3a')](_0x393f6b[_0xbe14('0x3b')]);_0x172e79[_0xbe14('0x3c')]=_[_0xbe14('0x3d')](_0x172e79[_0xbe14('0x39')],_0x172e79[_0xbe14('0x3b')]);_0x3dbacb[_0xbe14('0x3e')]=_[_0xbe14('0x3d')](_0x172e79[_0xbe14('0x39')],qs['fields'](_0x393f6b[_0xbe14('0x3b')][_0xbe14('0x3f')]));_0x3dbacb[_0xbe14('0x3e')]=_0x3dbacb[_0xbe14('0x3e')][_0xbe14('0x40')]?_0x3dbacb[_0xbe14('0x3e')]:_0x172e79['model'];if(!_0x393f6b[_0xbe14('0x3b')][_0xbe14('0x41')](_0xbe14('0x42'))){_0x3dbacb[_0xbe14('0x2c')]=qs['limit'](_0x393f6b['query'][_0xbe14('0x2c')]);_0x3dbacb[_0xbe14('0x2b')]=qs[_0xbe14('0x2b')](_0x393f6b['query']['offset']);}_0x3dbacb[_0xbe14('0x43')]=qs['sort'](_0x393f6b['query'][_0xbe14('0x44')]);_0x3dbacb[_0xbe14('0x45')]=qs[_0xbe14('0x3c')](_['pick'](_0x393f6b['query'],_0x172e79['filters']),_0xcdc50);if(_0x393f6b[_0xbe14('0x3b')][_0xbe14('0x46')]){_0x3dbacb[_0xbe14('0x45')]=_['merge'](_0x3dbacb[_0xbe14('0x45')],{'$or':_[_0xbe14('0x35')](_0xcdc50,function(_0x32f22e){if(_0x32f22e[_0xbe14('0x47')]!=='VIRTUAL'){var _0x4a1a4b={};_0x4a1a4b[_0x32f22e[_0xbe14('0x33')]]={'$like':'%'+_0x393f6b[_0xbe14('0x3b')][_0xbe14('0x46')]+'%'};return _0x4a1a4b;}})});}_0x3dbacb=_[_0xbe14('0x48')]({},_0x3dbacb,_0x393f6b[_0xbe14('0x49')]);var _0x4f2d95={'where':_0x3dbacb['where']};return db[_0xbe14('0x36')][_0xbe14('0x2a')](_0x4f2d95)[_0xbe14('0x1c')](function(_0x2a3b35){_0x29356f['count']=_0x2a3b35;if(_0x393f6b[_0xbe14('0x3b')][_0xbe14('0x4a')]){_0x3dbacb['include']=[{'all':!![]}];}return db[_0xbe14('0x36')][_0xbe14('0x4b')](_0x3dbacb);})[_0xbe14('0x1c')](function(_0x36c20c){_0x29356f['rows']=_0x36c20c;return _0x29356f;})['then'](respondWithFilteredResult(_0x2bb45,_0x3dbacb))[_0xbe14('0x26')](handleError(_0x2bb45,null));};exports[_0xbe14('0x4c')]=function(_0x4a1a37,_0x5acf90){var _0xca8cdb={'raw':![],'where':{'id':_0x4a1a37[_0xbe14('0x4d')]['id']}},_0x5d3726={};_0x5d3726[_0xbe14('0x39')]=_[_0xbe14('0x3a')](db[_0xbe14('0x36')][_0xbe14('0x37')]);_0x5d3726['query']=_[_0xbe14('0x3a')](_0x4a1a37[_0xbe14('0x3b')]);_0x5d3726[_0xbe14('0x3c')]=_[_0xbe14('0x3d')](_0x5d3726[_0xbe14('0x39')],_0x5d3726['query']);_0xca8cdb[_0xbe14('0x3e')]=_[_0xbe14('0x3d')](_0x5d3726[_0xbe14('0x39')],qs[_0xbe14('0x3f')](_0x4a1a37[_0xbe14('0x3b')][_0xbe14('0x3f')]));_0xca8cdb['attributes']=_0xca8cdb['attributes'][_0xbe14('0x40')]?_0xca8cdb[_0xbe14('0x3e')]:_0x5d3726[_0xbe14('0x39')];if(_0x4a1a37['query']['includeAll']){_0xca8cdb[_0xbe14('0x4e')]=[{'all':!![]}];}_0xca8cdb=_[_0xbe14('0x48')]({},_0xca8cdb,_0x4a1a37['options']);return db[_0xbe14('0x36')][_0xbe14('0x4f')](_0xca8cdb)['then'](handleEntityNotFound(_0x5acf90,null))[_0xbe14('0x1c')](respondWithResult(_0x5acf90,null))['catch'](handleError(_0x5acf90,null));};exports[_0xbe14('0x50')]=function(_0x410c59,_0x12a9de){return db['FreshdeskAccount'][_0xbe14('0x50')](_0x410c59[_0xbe14('0x51')],{})['then'](respondWithResult(_0x12a9de,0xc9))[_0xbe14('0x26')](handleError(_0x12a9de,null));};exports[_0xbe14('0x52')]=function(_0x2210cc,_0x20c48d){if(_0x2210cc[_0xbe14('0x51')]['id']){delete _0x2210cc['body']['id'];}return db[_0xbe14('0x36')][_0xbe14('0x4f')]({'where':{'id':_0x2210cc[_0xbe14('0x4d')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x20c48d,null))[_0xbe14('0x1c')](saveUpdates(_0x2210cc[_0xbe14('0x51')],null))[_0xbe14('0x1c')](respondWithResult(_0x20c48d,null))['catch'](handleError(_0x20c48d,null));};exports[_0xbe14('0x53')]=function(_0x1b47a4,_0x941ee2){return db[_0xbe14('0x36')][_0xbe14('0x4f')]({'where':{'id':_0x1b47a4[_0xbe14('0x4d')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x941ee2,null))[_0xbe14('0x1c')](removeEntity(_0x941ee2,null))[_0xbe14('0x26')](handleError(_0x941ee2,null));};exports[_0xbe14('0x54')]=function(_0x358950,_0x4bccfc,_0x56bcd3){var _0x58dd79={};var _0x10c0bc={};var _0x1bfcbf;var _0x2f4e52;return db[_0xbe14('0x36')][_0xbe14('0x55')]({'where':{'id':_0x358950[_0xbe14('0x4d')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x4bccfc,null))[_0xbe14('0x1c')](function(_0x31d015){if(_0x31d015){_0x1bfcbf=_0x31d015;_0x10c0bc[_0xbe14('0x39')]=_[_0xbe14('0x3a')](db[_0xbe14('0x56')][_0xbe14('0x37')]);_0x10c0bc[_0xbe14('0x3b')]=_[_0xbe14('0x3a')](_0x358950[_0xbe14('0x3b')]);_0x10c0bc[_0xbe14('0x3c')]=_[_0xbe14('0x3d')](_0x10c0bc[_0xbe14('0x39')],_0x10c0bc[_0xbe14('0x3b')]);_0x58dd79['attributes']=_[_0xbe14('0x3d')](_0x10c0bc[_0xbe14('0x39')],qs[_0xbe14('0x3f')](_0x358950[_0xbe14('0x3b')][_0xbe14('0x3f')]));_0x58dd79[_0xbe14('0x3e')]=_0x58dd79[_0xbe14('0x3e')][_0xbe14('0x40')]?_0x58dd79[_0xbe14('0x3e')]:_0x10c0bc[_0xbe14('0x39')];_0x58dd79['order']=qs[_0xbe14('0x44')](_0x358950[_0xbe14('0x3b')][_0xbe14('0x44')]);_0x58dd79[_0xbe14('0x45')]=qs[_0xbe14('0x3c')](_['pick'](_0x358950[_0xbe14('0x3b')],_0x10c0bc[_0xbe14('0x3c')]));if(_0x358950[_0xbe14('0x3b')][_0xbe14('0x46')]){_0x58dd79[_0xbe14('0x45')]=_['merge'](_0x58dd79[_0xbe14('0x45')],{'$or':_[_0xbe14('0x35')](_0x58dd79[_0xbe14('0x3e')],function(_0x29bb26){var _0xaebce8={};_0xaebce8[_0x29bb26]={'$like':'%'+_0x358950[_0xbe14('0x3b')][_0xbe14('0x46')]+'%'};return _0xaebce8;})});}_0x58dd79=_[_0xbe14('0x48')]({},_0x58dd79,_0x358950['options']);return _0x1bfcbf[_0xbe14('0x54')](_0x58dd79);}})[_0xbe14('0x1c')](function(_0x2fdf5d){if(_0x2fdf5d){_0x2f4e52=_0x2fdf5d[_0xbe14('0x40')];if(!_0x358950[_0xbe14('0x3b')][_0xbe14('0x41')](_0xbe14('0x42'))){_0x58dd79['limit']=qs['limit'](_0x358950[_0xbe14('0x3b')][_0xbe14('0x2c')]);_0x58dd79[_0xbe14('0x2b')]=qs[_0xbe14('0x2b')](_0x358950[_0xbe14('0x3b')][_0xbe14('0x2b')]);}return _0x1bfcbf[_0xbe14('0x54')](_0x58dd79);}})[_0xbe14('0x1c')](function(_0x50e644){if(_0x50e644){return _0x50e644?{'count':_0x2f4e52,'rows':_0x50e644}:null;}})['then'](respondWithResult(_0x4bccfc,null))[_0xbe14('0x26')](handleError(_0x4bccfc,null));};exports[_0xbe14('0x57')]=function(_0x29aa52,_0x57729f,_0x76e91e){if(_0x29aa52[_0xbe14('0x51')]['id']){delete _0x29aa52[_0xbe14('0x51')]['id'];}return db[_0xbe14('0x36')][_0xbe14('0x55')]({'where':{'id':_0x29aa52[_0xbe14('0x4d')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x57729f,null))['then'](function(_0x43b817){if(_0x43b817){_0x29aa52[_0xbe14('0x51')][_0xbe14('0x58')]=_0x43b817['id'];_0x29aa52[_0xbe14('0x51')][_0xbe14('0x59')]=integrations[_0xbe14('0x5a')](_0x29aa52[_0xbe14('0x51')]['channel'],_0x29aa52[_0xbe14('0x51')][_0xbe14('0x47')]);_0x29aa52[_0xbe14('0x51')][_0xbe14('0x5b')]=integrations[_0xbe14('0x5c')](_0x29aa52[_0xbe14('0x51')][_0xbe14('0x5d')],_0x29aa52[_0xbe14('0x51')]['type']);return db[_0xbe14('0x56')][_0xbe14('0x50')](_0x29aa52[_0xbe14('0x51')],{'include':[{'model':db[_0xbe14('0x5e')],'as':_0xbe14('0x59')},{'model':db[_0xbe14('0x5e')],'as':'Descriptions'}]});}return null;})[_0xbe14('0x1c')](respondWithResult(_0x57729f,null))[_0xbe14('0x26')](handleError(_0x57729f,null));};exports[_0xbe14('0x5f')]=function(_0x1b23a1,_0x508455,_0x7e9e5c){var _0x1578b6='';return db[_0xbe14('0x36')][_0xbe14('0x55')]({'where':{'id':_0x1b23a1[_0xbe14('0x4d')]['id']},'attributes':['id',_0xbe14('0x60'),_0xbe14('0x61')]})['then'](handleEntityNotFound(_0x508455,null))[_0xbe14('0x1c')](function(_0x589197){if(_0x589197){_0x1578b6=_0x589197[_0xbe14('0x60')];var _0x5d85d3=_0x1578b6[_0xbe14('0x62')](-0x1);if(_0x5d85d3==='/'){_0x1578b6=_0x1578b6[_0xbe14('0x63')](0x0,_0x1578b6[_0xbe14('0x64')](_0x5d85d3));}return rp({'method':'GET','uri':util[_0xbe14('0x65')](_0xbe14('0x66'),_0x1578b6,_0xbe14('0x67')),'headers':{'Authorization':util['format'](_0xbe14('0x68'),new Buffer(util[_0xbe14('0x65')](_0xbe14('0x69'),_0x589197[_0xbe14('0x61')]))['toString'](_0xbe14('0x6a')))},'json':!![]});}})[_0xbe14('0x1c')](function(_0x34f90b){if(_0x34f90b){var _0x2b2e0e=[_0xbe14('0x6b'),_0xbe14('0x6c'),_0xbe14('0x6d'),'description',_0xbe14('0x2d'),_0xbe14('0x6e'),_0xbe14('0x6f'),'source',_0xbe14('0x70'),_0xbe14('0x6f'),_0xbe14('0x71')];_['remove'](_0x34f90b,function(_0xa53262){return _0x2b2e0e[_0xbe14('0x72')](_0xa53262['name'])||!_0xa53262[_0xbe14('0x73')]&&_0xa53262['type']!==_0xbe14('0x74')&&_0xa53262[_0xbe14('0x47')]!=='custom_dropdown';});return{'count':_0x34f90b['length'],'rows':_[_0xbe14('0x35')](_0x34f90b,function(_0x3db955){return{'id':_0x3db955[_0xbe14('0x33')],'name':_0x3db955['label'],'custom':!_0x3db955[_0xbe14('0x73')],'options':_0x3db955[_0xbe14('0x75')]?_[_0xbe14('0x35')](_0x3db955[_0xbe14('0x75')],function(_0x5ee624){return{'name':_['capitalize'](_0x5ee624),'value':_0x5ee624};}):[]};})};}})[_0xbe14('0x1c')](respondWithResult(_0x508455,null))[_0xbe14('0x26')](function(_0xc8d0f6){var _0x215d5b=_0x1b23a1[_0xbe14('0x3b')][_0xbe14('0x19')]?0x1f4:_0xc8d0f6[_0xbe14('0x76')]||0x1f4;logger['error'](_0xbe14('0x77'),'getFields',_0x215d5b,JSON[_0xbe14('0x22')](_0xc8d0f6));delete _0xc8d0f6[_0xbe14('0x33')];if(_0x215d5b===0x191){_0x215d5b=0x190;}_0x508455[_0xbe14('0x2d')](_0x215d5b)[_0xbe14('0x78')](_0x1b23a1['query'][_0xbe14('0x19')]?{'message':_0xbe14('0x79'),'statusCode':_0xc8d0f6[_0xbe14('0x76')]}:_0xc8d0f6);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 7f823b3..c48f8c4 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 _0xd001=['FreshdeskAccount','int_freshdesk_accounts','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x39cb9c,_0x45e494){var _0x29e2d1=function(_0x3a6318){while(--_0x3a6318){_0x39cb9c['push'](_0x39cb9c['shift']());}};_0x29e2d1(++_0x45e494);}(_0xd001,0x152));var _0x1d00=function(_0x4f6d32,_0x20eb17){_0x4f6d32=_0x4f6d32-0x0;var _0x2bd505=_0xd001[_0x4f6d32];return _0x2bd505;};'use strict';var _=require('lodash');var util=require(_0x1d00('0x0'));var logger=require(_0x1d00('0x1'))(_0x1d00('0x2'));var moment=require('moment');var BPromise=require(_0x1d00('0x3'));var rp=require(_0x1d00('0x4'));var fs=require('fs');var path=require(_0x1d00('0x5'));var rimraf=require(_0x1d00('0x6'));var config=require(_0x1d00('0x7'));var attributes=require(_0x1d00('0x8'));var integrations=require(_0x1d00('0x9'));module[_0x1d00('0xa')]=function(_0x1dddbb,_0x3a79c1){return _0x1dddbb[_0x1d00('0xb')](_0x1d00('0xc'),attributes,{'tableName':_0x1d00('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf035=['lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts'];(function(_0x223dc2,_0x152bb8){var _0x2408e8=function(_0x5d7417){while(--_0x5d7417){_0x223dc2['push'](_0x223dc2['shift']());}};_0x2408e8(++_0x152bb8);}(_0xf035,0x8c));var _0x5f03=function(_0x39b438,_0x6abc0f){_0x39b438=_0x39b438-0x0;var _0x384ce9=_0xf035[_0x39b438];return _0x384ce9;};'use strict';var _=require(_0x5f03('0x0'));var util=require(_0x5f03('0x1'));var logger=require(_0x5f03('0x2'))(_0x5f03('0x3'));var moment=require(_0x5f03('0x4'));var BPromise=require(_0x5f03('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5f03('0x6'));var rimraf=require('rimraf');var config=require(_0x5f03('0x7'));var attributes=require(_0x5f03('0x8'));var integrations=require(_0x5f03('0x9'));module[_0x5f03('0xa')]=function(_0x549410,_0x67e839){return _0x549410[_0x5f03('0xb')](_0x5f03('0xc'),attributes,{'tableName':_0x5f03('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index a59c539..e0f3541 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 _0x5214=['GetFreshdeskAccount','debug','ShowFreshdeskAccount','find','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','FreshdeskAccount','findAll','options','raw','attributes','limit','include','map','model'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5214,0x10c));var _0x4521=function(_0x2fbedc,_0x25d163){_0x2fbedc=_0x2fbedc-0x0;var _0x56b33e=_0x5214[_0x2fbedc];return _0x56b33e;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x4521('0x0'));var rs=require(_0x4521('0x1'));var fs=require('fs');var Redis=require(_0x4521('0x2'));var db=require(_0x4521('0x3'))['db'];var utils=require(_0x4521('0x4'));var logger=require('../../config/logger')(_0x4521('0x5'));var config=require(_0x4521('0x6'));var jayson=require(_0x4521('0x7'));var client=jayson[_0x4521('0x8')][_0x4521('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x42fb2d,_0x2fe603,_0x31e60c){return new BPromise(function(_0x5e0e21,_0xd3091f){return client['request'](_0x42fb2d,_0x31e60c)[_0x4521('0xa')](function(_0x9364c8){logger[_0x4521('0xb')](_0x4521('0xc'),_0x2fe603,_0x4521('0xd'));logger['debug'](_0x4521('0xe'),_0x2fe603,_0x4521('0xd'),JSON[_0x4521('0xf')](_0x9364c8));if(_0x9364c8['error']){if(_0x9364c8[_0x4521('0x10')]['code']===0x1f4){logger[_0x4521('0x10')](_0x4521('0xc'),_0x2fe603,_0x9364c8[_0x4521('0x10')][_0x4521('0x11')]);return _0xd3091f(_0x9364c8[_0x4521('0x10')]['message']);}logger[_0x4521('0x10')](_0x4521('0xc'),_0x2fe603,_0x9364c8[_0x4521('0x10')]['message']);return _0x5e0e21(_0x9364c8[_0x4521('0x10')][_0x4521('0x11')]);}else{logger[_0x4521('0xb')](_0x4521('0xc'),_0x2fe603,_0x4521('0xd'));_0x5e0e21(_0x9364c8[_0x4521('0x12')][_0x4521('0x11')]);}})[_0x4521('0x13')](function(_0x49847c){logger[_0x4521('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x2fe603,_0x49847c);_0xd3091f(_0x49847c);});});}exports['GetFreshdeskAccount']=function(_0x1e53d3){var _0x5c3c16=this;return new Promise(function(_0x59f039,_0x2de530){return db[_0x4521('0x14')][_0x4521('0x15')]({'raw':_0x1e53d3[_0x4521('0x16')]?_0x1e53d3[_0x4521('0x16')][_0x4521('0x17')]===undefined?!![]:![]:!![],'where':_0x1e53d3[_0x4521('0x16')]?_0x1e53d3[_0x4521('0x16')]['where']||null:null,'attributes':_0x1e53d3['options']?_0x1e53d3[_0x4521('0x16')][_0x4521('0x18')]||null:null,'limit':_0x1e53d3[_0x4521('0x16')]?_0x1e53d3[_0x4521('0x16')][_0x4521('0x19')]||null:null,'include':_0x1e53d3[_0x4521('0x16')]?_0x1e53d3['options'][_0x4521('0x1a')]?_[_0x4521('0x1b')](_0x1e53d3[_0x4521('0x16')]['include'],function(_0xbfb50d){return{'model':db[_0xbfb50d[_0x4521('0x1c')]],'as':_0xbfb50d['as'],'attributes':_0xbfb50d[_0x4521('0x18')],'include':_0xbfb50d[_0x4521('0x1a')]?_['map'](_0xbfb50d['include'],function(_0x46847d){return{'model':db[_0x46847d[_0x4521('0x1c')]],'as':_0x46847d['as'],'attributes':_0x46847d[_0x4521('0x18')],'include':_0x46847d['include']?_[_0x4521('0x1b')](_0x46847d[_0x4521('0x1a')],function(_0x1b4492){return{'model':db[_0x1b4492[_0x4521('0x1c')]],'as':_0x1b4492['as'],'attributes':_0x1b4492['attributes']};}):[]};}):[]};}):[]:[]})[_0x4521('0xa')](function(_0x28005e){logger['info'](_0x4521('0x1d'),_0x1e53d3);logger[_0x4521('0x1e')](_0x4521('0x1d'),_0x1e53d3,JSON['stringify'](_0x28005e));_0x59f039(_0x28005e);})[_0x4521('0x13')](function(_0x1fe93a){logger['error'](_0x4521('0x1d'),_0x1fe93a[_0x4521('0x11')],_0x1e53d3);_0x2de530(_0x5c3c16[_0x4521('0x10')](0x1f4,_0x1fe93a[_0x4521('0x11')]));});});};exports[_0x4521('0x1f')]=function(_0x2a3eff){var _0x57a18b=this;return new Promise(function(_0x392082,_0x46cebc){return db['FreshdeskAccount'][_0x4521('0x20')]({'raw':_0x2a3eff[_0x4521('0x16')]?_0x2a3eff['options'][_0x4521('0x17')]===undefined?!![]:![]:!![],'where':_0x2a3eff['options']?_0x2a3eff[_0x4521('0x16')]['where']||null:null,'attributes':_0x2a3eff[_0x4521('0x16')]?_0x2a3eff[_0x4521('0x16')][_0x4521('0x18')]||null:null,'include':_0x2a3eff['options']?_0x2a3eff[_0x4521('0x16')][_0x4521('0x1a')]?_[_0x4521('0x1b')](_0x2a3eff[_0x4521('0x16')][_0x4521('0x1a')],function(_0x31c5cc){return{'model':db[_0x31c5cc[_0x4521('0x1c')]],'as':_0x31c5cc['as'],'attributes':_0x31c5cc['attributes'],'include':_0x31c5cc[_0x4521('0x1a')]?_[_0x4521('0x1b')](_0x31c5cc['include'],function(_0x352f2b){return{'model':db[_0x352f2b[_0x4521('0x1c')]],'as':_0x352f2b['as'],'attributes':_0x352f2b['attributes'],'include':_0x352f2b[_0x4521('0x1a')]?_['map'](_0x352f2b[_0x4521('0x1a')],function(_0x1cf097){return{'model':db[_0x1cf097[_0x4521('0x1c')]],'as':_0x1cf097['as'],'attributes':_0x1cf097[_0x4521('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a4c8b){logger[_0x4521('0xb')](_0x4521('0x1f'),_0x2a3eff);logger[_0x4521('0x1e')](_0x4521('0x1f'),_0x2a3eff,JSON[_0x4521('0xf')](_0x1a4c8b));_0x392082(_0x1a4c8b);})['catch'](function(_0x21f98d){logger[_0x4521('0x10')](_0x4521('0x1f'),_0x21f98d['message'],_0x2a3eff);_0x46cebc(_0x57a18b[_0x4521('0x10')](0x1f4,_0x21f98d[_0x4521('0x11')]));});});}; \ No newline at end of file +var _0x6880=['ShowFreshdeskAccount','find','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','FreshdeskAccount','findAll','options','where','attributes','limit','include','model','map','then','GetFreshdeskAccount'];(function(_0x2fbd62,_0x283239){var _0x17531c=function(_0x2423a5){while(--_0x2423a5){_0x2fbd62['push'](_0x2fbd62['shift']());}};_0x17531c(++_0x283239);}(_0x6880,0x8a));var _0x0688=function(_0x5ed606,_0xffe57e){_0x5ed606=_0x5ed606-0x0;var _0x3f3b7c=_0x6880[_0x5ed606];return _0x3f3b7c;};'use strict';var _=require('lodash');var util=require(_0x0688('0x0'));var moment=require(_0x0688('0x1'));var BPromise=require(_0x0688('0x2'));var rs=require(_0x0688('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0688('0x4'))['db'];var utils=require(_0x0688('0x5'));var logger=require('../../config/logger')(_0x0688('0x6'));var config=require(_0x0688('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0688('0x8')][_0x0688('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f9ba3,_0x36af0a,_0x586f7a){return new BPromise(function(_0xaa3a5d,_0x3fc3ec){return client[_0x0688('0xa')](_0x4f9ba3,_0x586f7a)['then'](function(_0x476599){logger[_0x0688('0xb')]('FreshdeskAccount,\x20%s,\x20%s',_0x36af0a,_0x0688('0xc'));logger[_0x0688('0xd')](_0x0688('0xe'),_0x36af0a,'request\x20sent',JSON[_0x0688('0xf')](_0x476599));if(_0x476599['error']){if(_0x476599[_0x0688('0x10')]['code']===0x1f4){logger[_0x0688('0x10')](_0x0688('0x11'),_0x36af0a,_0x476599['error'][_0x0688('0x12')]);return _0x3fc3ec(_0x476599[_0x0688('0x10')][_0x0688('0x12')]);}logger[_0x0688('0x10')](_0x0688('0x11'),_0x36af0a,_0x476599[_0x0688('0x10')][_0x0688('0x12')]);return _0xaa3a5d(_0x476599[_0x0688('0x10')][_0x0688('0x12')]);}else{logger[_0x0688('0xb')](_0x0688('0x11'),_0x36af0a,'request\x20sent');_0xaa3a5d(_0x476599[_0x0688('0x13')]['message']);}})[_0x0688('0x14')](function(_0xc51aad){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x36af0a,_0xc51aad);_0x3fc3ec(_0xc51aad);});});}exports['GetFreshdeskAccount']=function(_0x4216b4){var _0x27f469=this;return new Promise(function(_0x36a2f9,_0x4a1425){return db[_0x0688('0x15')][_0x0688('0x16')]({'raw':_0x4216b4[_0x0688('0x17')]?_0x4216b4[_0x0688('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x4216b4[_0x0688('0x17')]?_0x4216b4[_0x0688('0x17')][_0x0688('0x18')]||null:null,'attributes':_0x4216b4[_0x0688('0x17')]?_0x4216b4[_0x0688('0x17')][_0x0688('0x19')]||null:null,'limit':_0x4216b4[_0x0688('0x17')]?_0x4216b4['options'][_0x0688('0x1a')]||null:null,'include':_0x4216b4[_0x0688('0x17')]?_0x4216b4['options'][_0x0688('0x1b')]?_['map'](_0x4216b4[_0x0688('0x17')][_0x0688('0x1b')],function(_0x1e3352){return{'model':db[_0x1e3352[_0x0688('0x1c')]],'as':_0x1e3352['as'],'attributes':_0x1e3352[_0x0688('0x19')],'include':_0x1e3352[_0x0688('0x1b')]?_['map'](_0x1e3352['include'],function(_0x1ee7fe){return{'model':db[_0x1ee7fe[_0x0688('0x1c')]],'as':_0x1ee7fe['as'],'attributes':_0x1ee7fe[_0x0688('0x19')],'include':_0x1ee7fe[_0x0688('0x1b')]?_[_0x0688('0x1d')](_0x1ee7fe[_0x0688('0x1b')],function(_0x176e1e){return{'model':db[_0x176e1e[_0x0688('0x1c')]],'as':_0x176e1e['as'],'attributes':_0x176e1e[_0x0688('0x19')]};}):[]};}):[]};}):[]:[]})[_0x0688('0x1e')](function(_0x2cd4c9){logger[_0x0688('0xb')](_0x0688('0x1f'),_0x4216b4);logger[_0x0688('0xd')](_0x0688('0x1f'),_0x4216b4,JSON['stringify'](_0x2cd4c9));_0x36a2f9(_0x2cd4c9);})[_0x0688('0x14')](function(_0x9241b0){logger[_0x0688('0x10')](_0x0688('0x1f'),_0x9241b0['message'],_0x4216b4);_0x4a1425(_0x27f469[_0x0688('0x10')](0x1f4,_0x9241b0[_0x0688('0x12')]));});});};exports[_0x0688('0x20')]=function(_0x3b3fa3){var _0x38011d=this;return new Promise(function(_0x4e6a3e,_0x475c99){return db['FreshdeskAccount'][_0x0688('0x21')]({'raw':_0x3b3fa3[_0x0688('0x17')]?_0x3b3fa3[_0x0688('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3b3fa3[_0x0688('0x17')]?_0x3b3fa3[_0x0688('0x17')]['where']||null:null,'attributes':_0x3b3fa3['options']?_0x3b3fa3['options'][_0x0688('0x19')]||null:null,'include':_0x3b3fa3[_0x0688('0x17')]?_0x3b3fa3[_0x0688('0x17')][_0x0688('0x1b')]?_['map'](_0x3b3fa3[_0x0688('0x17')][_0x0688('0x1b')],function(_0xa086a5){return{'model':db[_0xa086a5[_0x0688('0x1c')]],'as':_0xa086a5['as'],'attributes':_0xa086a5[_0x0688('0x19')],'include':_0xa086a5['include']?_[_0x0688('0x1d')](_0xa086a5[_0x0688('0x1b')],function(_0x58fd91){return{'model':db[_0x58fd91[_0x0688('0x1c')]],'as':_0x58fd91['as'],'attributes':_0x58fd91[_0x0688('0x19')],'include':_0x58fd91[_0x0688('0x1b')]?_[_0x0688('0x1d')](_0x58fd91['include'],function(_0xeff961){return{'model':db[_0xeff961['model']],'as':_0xeff961['as'],'attributes':_0xeff961[_0x0688('0x19')]};}):[]};}):[]};}):[]:[]})[_0x0688('0x1e')](function(_0x4854a1){logger['info'](_0x0688('0x20'),_0x3b3fa3);logger['debug'](_0x0688('0x20'),_0x3b3fa3,JSON[_0x0688('0xf')](_0x4854a1));_0x4e6a3e(_0x4854a1);})['catch'](function(_0x56fd71){logger[_0x0688('0x10')](_0x0688('0x20'),_0x56fd71[_0x0688('0x12')],_0x3b3fa3);_0x475c99(_0x38011d[_0x0688('0x10')](0x1f4,_0x56fd71[_0x0688('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 3e60df0..2f57051 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 _0xc073=['../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','create','post','/:id/tags','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x284ad3,_0x4c239f){var _0x579e38=function(_0x707415){while(--_0x707415){_0x284ad3['push'](_0x284ad3['shift']());}};_0x579e38(++_0x4c239f);}(_0xc073,0xdd));var _0x3c07=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc073[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x3c07('0x0'));var path=require(_0x3c07('0x1'));var timeout=require(_0x3c07('0x2'));var express=require(_0x3c07('0x3'));var router=express['Router']();var auth=require(_0x3c07('0x4'));var interaction=require(_0x3c07('0x5'));var config=require('../../config/environment');var controller=require(_0x3c07('0x6'));router['get']('/',auth[_0x3c07('0x7')](),controller[_0x3c07('0x8')]);router[_0x3c07('0x9')](_0x3c07('0xa'),auth[_0x3c07('0x7')](),controller['show']);router['get'](_0x3c07('0xb'),auth[_0x3c07('0x7')](),controller[_0x3c07('0xc')]);router['get'](_0x3c07('0xd'),auth[_0x3c07('0x7')](),controller['getSubjects']);router[_0x3c07('0x9')](_0x3c07('0xe'),auth[_0x3c07('0x7')](),controller[_0x3c07('0xf')]);router[_0x3c07('0x9')]('/:id/tags',auth[_0x3c07('0x7')](),controller['getTags']);router['post']('/',auth[_0x3c07('0x7')](),controller[_0x3c07('0x10')]);router[_0x3c07('0x11')](_0x3c07('0x12'),auth['isAuthenticated'](),controller[_0x3c07('0x13')]);router[_0x3c07('0x14')](_0x3c07('0xa'),auth[_0x3c07('0x7')](),controller[_0x3c07('0x15')]);router[_0x3c07('0x16')](_0x3c07('0xa'),auth[_0x3c07('0x7')](),controller[_0x3c07('0x17')]);module[_0x3c07('0x18')]=router; \ No newline at end of file +var _0x6190=['/:id/tags','post','create','setTags','put','/:id','destroy','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id/fields','getFields','/:id/subjects'];(function(_0x3ba7c7,_0x3e3980){var _0x1f71fb=function(_0x3c97d5){while(--_0x3c97d5){_0x3ba7c7['push'](_0x3ba7c7['shift']());}};_0x1f71fb(++_0x3e3980);}(_0x6190,0x183));var _0x0619=function(_0x3a8533,_0x4a6d19){_0x3a8533=_0x3a8533-0x0;var _0x4ee3ae=_0x6190[_0x3a8533];return _0x4ee3ae;};'use strict';var multer=require(_0x0619('0x0'));var util=require('util');var path=require(_0x0619('0x1'));var timeout=require('connect-timeout');var express=require(_0x0619('0x2'));var router=express['Router']();var auth=require(_0x0619('0x3'));var interaction=require(_0x0619('0x4'));var config=require(_0x0619('0x5'));var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth[_0x0619('0x6')](),controller[_0x0619('0x7')]);router[_0x0619('0x8')]('/:id',auth[_0x0619('0x6')](),controller['show']);router[_0x0619('0x8')](_0x0619('0x9'),auth[_0x0619('0x6')](),controller[_0x0619('0xa')]);router['get'](_0x0619('0xb'),auth[_0x0619('0x6')](),controller['getSubjects']);router[_0x0619('0x8')]('/:id/descriptions',auth[_0x0619('0x6')](),controller['getDescriptions']);router[_0x0619('0x8')](_0x0619('0xc'),auth[_0x0619('0x6')](),controller['getTags']);router[_0x0619('0xd')]('/',auth['isAuthenticated'](),controller[_0x0619('0xe')]);router[_0x0619('0xd')](_0x0619('0xc'),auth[_0x0619('0x6')](),controller[_0x0619('0xf')]);router[_0x0619('0x10')](_0x0619('0x11'),auth[_0x0619('0x6')](),controller['update']);router['delete']('/:id',auth[_0x0619('0x6')](),controller[_0x0619('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index f5f2ebc..519b354 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 _0x0334=['STRING','sequelize','exports'];(function(_0xa3fadc,_0xd1e16){var _0x23ecb8=function(_0x2c71f7){while(--_0x2c71f7){_0xa3fadc['push'](_0xa3fadc['shift']());}};_0x23ecb8(++_0xd1e16);}(_0x0334,0xb2));var _0x4033=function(_0x189636,_0x4987a9){_0x189636=_0x189636-0x0;var _0x177ccd=_0x0334[_0x189636];return _0x177ccd;};'use strict';var Sequelize=require(_0x4033('0x0'));module[_0x4033('0x1')]={'name':{'type':Sequelize[_0x4033('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd070=['exports','sequelize'];(function(_0x1e6a48,_0x3091b4){var _0x5e2df2=function(_0x5ba684){while(--_0x5ba684){_0x1e6a48['push'](_0x1e6a48['shift']());}};_0x5e2df2(++_0x3091b4);}(_0xd070,0xb9));var _0x0d07=function(_0x3a49aa,_0x155c3e){_0x3a49aa=_0x3a49aa-0x0;var _0x4ab552=_0xd070[_0x3a49aa];return _0x4ab552;};'use strict';var Sequelize=require(_0x0d07('0x0'));module[_0x0d07('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 730d4fe..1337e86 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 _0x394e=['fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','length','nolimit','sort','where','pick','filter','merge','count','includeAll','findAll','include','create','body','find','params','getFields','findOne','FreshdeskField','order','getSubjects','options','hasOwnProperty','getDescriptions','Tag','getTags','setTags','ids','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','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','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','FreshdeskConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','limit','set','apply','reject','update','destroy','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes'];(function(_0x336df4,_0x52c1dc){var _0x580d8c=function(_0x2febf1){while(--_0x2febf1){_0x336df4['push'](_0x336df4['shift']());}};_0x580d8c(++_0x52c1dc);}(_0x394e,0x88));var _0xe394=function(_0x51a13a,_0x9b9ee5){_0x51a13a=_0x51a13a-0x0;var _0x579f61=_0x394e[_0x51a13a];return _0x579f61;};'use strict';var pdf=require(_0xe394('0x0'));var emlformat=require(_0xe394('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe394('0x2'));var jsonpatch=require(_0xe394('0x3'));var rp=require(_0xe394('0x4'));var moment=require(_0xe394('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe394('0x6'));var util=require(_0xe394('0x7'));var path=require(_0xe394('0x8'));var sox=require(_0xe394('0x9'));var csv=require(_0xe394('0xa'));var ejs=require(_0xe394('0xb'));var fs=require('fs');var _=require(_0xe394('0xc'));var squel=require(_0xe394('0xd'));var crypto=require(_0xe394('0xe'));var jsforce=require(_0xe394('0xf'));var deskjs=require(_0xe394('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe394('0x11'));var authService=require(_0xe394('0x12'));var qs=require(_0xe394('0x13'));var as=require(_0xe394('0x14'));var hardwareService=require(_0xe394('0x15'));var logger=require(_0xe394('0x16'))(_0xe394('0x17'));var utils=require(_0xe394('0x18'));var config=require(_0xe394('0x19'));var db=require(_0xe394('0x1a'))['db'];var jayson=require(_0xe394('0x1b'));var client=jayson[_0xe394('0x1c')]['http']({'port':0x232a});function checkPasswordPattern(_0x5730b5,_0x4c2357,_0x227017){if(_0x227017){var _0x40b7e1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x40b7e1['test'](_0x4c2357)){return _0x5730b5;}else{throw new db[(_0xe394('0x1d'))][(_0xe394('0x1e'))](_0xe394('0x1f'));}}else{return _0x5730b5;}}function respondWithRpcPromise(_0xb0a8c,_0x1f4f71,_0x1c26db,_0x56aafa){return new BPromise(function(_0x47afc4,_0x1b8777){var _0x3196d0=_0x56aafa||client;return _0x3196d0[_0xe394('0x20')](_0xb0a8c,_0x1c26db)[_0xe394('0x21')](function(_0x4a7a5b){logger[_0xe394('0x22')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1f4f71,_0xe394('0x23'));logger[_0xe394('0x24')](_0xe394('0x25'),_0x1f4f71,'request\x20sent',JSON[_0xe394('0x26')](_0x4a7a5b));if(_0x4a7a5b[_0xe394('0x27')]){if(_0x4a7a5b[_0xe394('0x27')]['code']===0x1f4){logger[_0xe394('0x27')](_0xe394('0x28'),_0x1f4f71,_0x4a7a5b[_0xe394('0x27')][_0xe394('0x29')]);return _0x1b8777(_0x4a7a5b[_0xe394('0x27')][_0xe394('0x29')]);}logger[_0xe394('0x27')](_0xe394('0x28'),_0x1f4f71,_0x4a7a5b[_0xe394('0x27')][_0xe394('0x29')]);return _0x47afc4(_0x4a7a5b[_0xe394('0x27')][_0xe394('0x29')]);}else{logger['info'](_0xe394('0x28'),_0x1f4f71,_0xe394('0x23'));_0x47afc4(_0x4a7a5b[_0xe394('0x2a')][_0xe394('0x29')]);}})[_0xe394('0x2b')](function(_0x5ecdc6){logger[_0xe394('0x27')](_0xe394('0x28'),_0x1f4f71,_0x5ecdc6);_0x1b8777(_0x5ecdc6);});});}function respondWithStatusCode(_0x156f6b,_0x44c3e7){_0x44c3e7=_0x44c3e7||0xcc;return function(_0x4ebf7d){if(_0x4ebf7d){return _0x156f6b[_0xe394('0x2c')](_0x44c3e7);}return _0x156f6b[_0xe394('0x2d')](_0x44c3e7)[_0xe394('0x2e')]();};}function respondWithResult(_0xc6cb2d,_0x3b713c){_0x3b713c=_0x3b713c||0xc8;return function(_0x4a8683){if(_0x4a8683){return _0xc6cb2d[_0xe394('0x2d')](_0x3b713c)[_0xe394('0x2f')](_0x4a8683);}};}function respondWithFilteredResult(_0x1ca899,_0x1bd85c){return function(_0x2a7a82){if(_0x2a7a82){var _0x24146d=_0x2a7a82['count'],_0x3d7693=_0x1bd85c[_0xe394('0x30')],_0xdd67a6=_0x1bd85c[_0xe394('0x30')]+_0x1bd85c[_0xe394('0x31')],_0x1abc74;if(_0xdd67a6>=_0x24146d){_0xdd67a6=_0x24146d;_0x1abc74=0xc8;}else{_0x1abc74=0xce;}_0x1ca899[_0xe394('0x2d')](_0x1abc74);return _0x1ca899[_0xe394('0x32')]('Content-Range',_0x3d7693+'-'+_0xdd67a6+'/'+_0x24146d)['json'](_0x2a7a82);}return null;};}function patchUpdates(_0x382308){return function(_0x3ecc7f){try{jsonpatch[_0xe394('0x33')](_0x3ecc7f,_0x382308,!![]);}catch(_0x538820){return BPromise[_0xe394('0x34')](_0x538820);}return _0x3ecc7f['save']();};}function saveUpdates(_0x5edf7f,_0x3e0f66){return function(_0x406380){if(_0x406380){return _0x406380[_0xe394('0x35')](_0x5edf7f)[_0xe394('0x21')](function(_0x296ba4){return _0x296ba4;});}return null;};}function removeEntity(_0x1b21c2,_0x8f7605){return function(_0x9c783){if(_0x9c783){return _0x9c783[_0xe394('0x36')]()[_0xe394('0x21')](function(){_0x1b21c2[_0xe394('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b7b85,_0x3c7d79){return function(_0x42a3b6){if(!_0x42a3b6){_0x2b7b85[_0xe394('0x2c')](0x194);}return _0x42a3b6;};}function handleError(_0xee4b4,_0xa16b5a){_0xa16b5a=_0xa16b5a||0x1f4;return function(_0x48381a){logger['error'](_0x48381a[_0xe394('0x37')]);if(_0x48381a[_0xe394('0x38')]){delete _0x48381a[_0xe394('0x38')];}_0xee4b4[_0xe394('0x2d')](_0xa16b5a)[_0xe394('0x39')](_0x48381a);};}exports[_0xe394('0x3a')]=function(_0x376dee,_0x36c37f){var _0x2e3a1e={},_0x1fa755={},_0x42a38e={'count':0x0,'rows':[]};var _0x45ac13=_[_0xe394('0x3b')](db[_0xe394('0x3c')][_0xe394('0x3d')],function(_0x4ef2bf){return{'name':_0x4ef2bf[_0xe394('0x3e')],'type':_0x4ef2bf[_0xe394('0x3f')][_0xe394('0x40')]};});_0x1fa755[_0xe394('0x41')]=_[_0xe394('0x3b')](_0x45ac13,'name');_0x1fa755['query']=_[_0xe394('0x42')](_0x376dee['query']);_0x1fa755[_0xe394('0x43')]=_[_0xe394('0x44')](_0x1fa755[_0xe394('0x41')],_0x1fa755['query']);_0x2e3a1e[_0xe394('0x45')]=_['intersection'](_0x1fa755['model'],qs[_0xe394('0x46')](_0x376dee[_0xe394('0x47')][_0xe394('0x46')]));_0x2e3a1e['attributes']=_0x2e3a1e[_0xe394('0x45')][_0xe394('0x48')]?_0x2e3a1e['attributes']:_0x1fa755[_0xe394('0x41')];if(!_0x376dee[_0xe394('0x47')]['hasOwnProperty'](_0xe394('0x49'))){_0x2e3a1e[_0xe394('0x31')]=qs[_0xe394('0x31')](_0x376dee[_0xe394('0x47')][_0xe394('0x31')]);_0x2e3a1e['offset']=qs[_0xe394('0x30')](_0x376dee[_0xe394('0x47')]['offset']);}_0x2e3a1e['order']=qs[_0xe394('0x4a')](_0x376dee[_0xe394('0x47')][_0xe394('0x4a')]);_0x2e3a1e[_0xe394('0x4b')]=qs[_0xe394('0x43')](_[_0xe394('0x4c')](_0x376dee[_0xe394('0x47')],_0x1fa755[_0xe394('0x43')]),_0x45ac13);if(_0x376dee[_0xe394('0x47')][_0xe394('0x4d')]){_0x2e3a1e['where']=_[_0xe394('0x4e')](_0x2e3a1e[_0xe394('0x4b')],{'$or':_[_0xe394('0x3b')](_0x45ac13,function(_0xaecf99){if(_0xaecf99['type']!=='VIRTUAL'){var _0x29daea={};_0x29daea[_0xaecf99[_0xe394('0x38')]]={'$like':'%'+_0x376dee['query'][_0xe394('0x4d')]+'%'};return _0x29daea;}})});}_0x2e3a1e=_[_0xe394('0x4e')]({},_0x2e3a1e,_0x376dee['options']);var _0x14debc={'where':_0x2e3a1e[_0xe394('0x4b')]};return db[_0xe394('0x3c')][_0xe394('0x4f')](_0x14debc)[_0xe394('0x21')](function(_0x1a9e66){_0x42a38e[_0xe394('0x4f')]=_0x1a9e66;if(_0x376dee[_0xe394('0x47')][_0xe394('0x50')]){_0x2e3a1e['include']=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0xe394('0x51')](_0x2e3a1e);})[_0xe394('0x21')](function(_0x1bf28c){_0x42a38e['rows']=_0x1bf28c;return _0x42a38e;})[_0xe394('0x21')](respondWithFilteredResult(_0x36c37f,_0x2e3a1e))['catch'](handleError(_0x36c37f,null));};exports['show']=function(_0x2b45a0,_0x3a1974){var _0x4a5550={'raw':![],'where':{'id':_0x2b45a0['params']['id']}},_0x2e8cd2={};_0x2e8cd2['model']=_['keys'](db[_0xe394('0x3c')][_0xe394('0x3d')]);_0x2e8cd2['query']=_[_0xe394('0x42')](_0x2b45a0['query']);_0x2e8cd2[_0xe394('0x43')]=_[_0xe394('0x44')](_0x2e8cd2[_0xe394('0x41')],_0x2e8cd2[_0xe394('0x47')]);_0x4a5550[_0xe394('0x45')]=_[_0xe394('0x44')](_0x2e8cd2[_0xe394('0x41')],qs[_0xe394('0x46')](_0x2b45a0[_0xe394('0x47')][_0xe394('0x46')]));_0x4a5550[_0xe394('0x45')]=_0x4a5550[_0xe394('0x45')][_0xe394('0x48')]?_0x4a5550[_0xe394('0x45')]:_0x2e8cd2['model'];if(_0x2b45a0['query'][_0xe394('0x50')]){_0x4a5550[_0xe394('0x52')]=[{'all':!![]}];}_0x4a5550=_[_0xe394('0x4e')]({},_0x4a5550,_0x2b45a0['options']);return db['FreshdeskConfiguration']['find'](_0x4a5550)[_0xe394('0x21')](handleEntityNotFound(_0x3a1974,null))['then'](respondWithResult(_0x3a1974,null))[_0xe394('0x2b')](handleError(_0x3a1974,null));};exports['create']=function(_0x318135,_0x27f67f){return db[_0xe394('0x3c')][_0xe394('0x53')](_0x318135[_0xe394('0x54')],{})[_0xe394('0x21')](respondWithResult(_0x27f67f,0xc9))[_0xe394('0x2b')](handleError(_0x27f67f,null));};exports[_0xe394('0x35')]=function(_0x214636,_0x45c8d1){if(_0x214636[_0xe394('0x54')]['id']){delete _0x214636[_0xe394('0x54')]['id'];}return db['FreshdeskConfiguration'][_0xe394('0x55')]({'where':{'id':_0x214636[_0xe394('0x56')]['id']}})[_0xe394('0x21')](handleEntityNotFound(_0x45c8d1,null))[_0xe394('0x21')](saveUpdates(_0x214636['body'],null))[_0xe394('0x21')](respondWithResult(_0x45c8d1,null))[_0xe394('0x2b')](handleError(_0x45c8d1,null));};exports[_0xe394('0x36')]=function(_0x4f2a7e,_0x4044d5){return db[_0xe394('0x3c')]['find']({'where':{'id':_0x4f2a7e[_0xe394('0x56')]['id']}})[_0xe394('0x21')](handleEntityNotFound(_0x4044d5,null))[_0xe394('0x21')](removeEntity(_0x4044d5,null))[_0xe394('0x2b')](handleError(_0x4044d5,null));};exports[_0xe394('0x57')]=function(_0x22a171,_0x2be2c9,_0x241042){var _0xd0ddad={};var _0x513de0={};var _0x1d3d2e;var _0x8f289d;return db['FreshdeskConfiguration'][_0xe394('0x58')]({'where':{'id':_0x22a171['params']['id']}})['then'](handleEntityNotFound(_0x2be2c9,null))['then'](function(_0x364fe0){if(_0x364fe0){_0x1d3d2e=_0x364fe0;_0x513de0['model']=_['keys'](db[_0xe394('0x59')]['rawAttributes']);_0x513de0[_0xe394('0x47')]=_[_0xe394('0x42')](_0x22a171[_0xe394('0x47')]);_0x513de0['filters']=_[_0xe394('0x44')](_0x513de0['model'],_0x513de0[_0xe394('0x47')]);_0xd0ddad['attributes']=_[_0xe394('0x44')](_0x513de0[_0xe394('0x41')],qs[_0xe394('0x46')](_0x22a171[_0xe394('0x47')]['fields']));_0xd0ddad['attributes']=_0xd0ddad['attributes'][_0xe394('0x48')]?_0xd0ddad[_0xe394('0x45')]:_0x513de0[_0xe394('0x41')];_0xd0ddad[_0xe394('0x5a')]=qs[_0xe394('0x4a')](_0x22a171[_0xe394('0x47')][_0xe394('0x4a')]);_0xd0ddad[_0xe394('0x4b')]=qs['filters'](_[_0xe394('0x4c')](_0x22a171[_0xe394('0x47')],_0x513de0[_0xe394('0x43')]));if(_0x22a171[_0xe394('0x47')]['filter']){_0xd0ddad[_0xe394('0x4b')]=_[_0xe394('0x4e')](_0xd0ddad[_0xe394('0x4b')],{'$or':_['map'](_0xd0ddad['attributes'],function(_0x2f8698){var _0x3ddfa8={};_0x3ddfa8[_0x2f8698]={'$like':'%'+_0x22a171[_0xe394('0x47')][_0xe394('0x4d')]+'%'};return _0x3ddfa8;})});}_0xd0ddad=_[_0xe394('0x4e')]({},_0xd0ddad,_0x22a171['options']);return _0x1d3d2e[_0xe394('0x57')](_0xd0ddad);}})['then'](function(_0x2a7c7b){if(_0x2a7c7b){_0x8f289d=_0x2a7c7b[_0xe394('0x48')];if(!_0x22a171[_0xe394('0x47')]['hasOwnProperty'](_0xe394('0x49'))){_0xd0ddad[_0xe394('0x31')]=qs[_0xe394('0x31')](_0x22a171[_0xe394('0x47')][_0xe394('0x31')]);_0xd0ddad['offset']=qs['offset'](_0x22a171[_0xe394('0x47')][_0xe394('0x30')]);}return _0x1d3d2e['getFields'](_0xd0ddad);}})[_0xe394('0x21')](function(_0x25ae46){if(_0x25ae46){return _0x25ae46?{'count':_0x8f289d,'rows':_0x25ae46}:null;}})['then'](respondWithResult(_0x2be2c9,null))[_0xe394('0x2b')](handleError(_0x2be2c9,null));};exports[_0xe394('0x5b')]=function(_0x27074b,_0x32e868,_0x562aae){var _0xab747a={};var _0x2fee95={};var _0x2338b6;var _0x543c1e;return db[_0xe394('0x3c')][_0xe394('0x58')]({'where':{'id':_0x27074b['params']['id']}})[_0xe394('0x21')](handleEntityNotFound(_0x32e868,null))[_0xe394('0x21')](function(_0x1c5ea4){if(_0x1c5ea4){_0x2338b6=_0x1c5ea4;_0x2fee95[_0xe394('0x41')]=_[_0xe394('0x42')](db[_0xe394('0x59')][_0xe394('0x3d')]);_0x2fee95[_0xe394('0x47')]=_[_0xe394('0x42')](_0x27074b[_0xe394('0x47')]);_0x2fee95[_0xe394('0x43')]=_[_0xe394('0x44')](_0x2fee95[_0xe394('0x41')],_0x2fee95[_0xe394('0x47')]);_0xab747a[_0xe394('0x45')]=_[_0xe394('0x44')](_0x2fee95[_0xe394('0x41')],qs['fields'](_0x27074b[_0xe394('0x47')]['fields']));_0xab747a['attributes']=_0xab747a[_0xe394('0x45')][_0xe394('0x48')]?_0xab747a[_0xe394('0x45')]:_0x2fee95['model'];_0xab747a[_0xe394('0x5a')]=qs[_0xe394('0x4a')](_0x27074b[_0xe394('0x47')][_0xe394('0x4a')]);_0xab747a[_0xe394('0x4b')]=qs[_0xe394('0x43')](_['pick'](_0x27074b[_0xe394('0x47')],_0x2fee95[_0xe394('0x43')]));if(_0x27074b[_0xe394('0x47')]['filter']){_0xab747a[_0xe394('0x4b')]=_[_0xe394('0x4e')](_0xab747a[_0xe394('0x4b')],{'$or':_[_0xe394('0x3b')](_0xab747a[_0xe394('0x45')],function(_0x1e90ef){var _0x5c7105={};_0x5c7105[_0x1e90ef]={'$like':'%'+_0x27074b['query'][_0xe394('0x4d')]+'%'};return _0x5c7105;})});}_0xab747a=_['merge']({},_0xab747a,_0x27074b[_0xe394('0x5c')]);return _0x2338b6[_0xe394('0x5b')](_0xab747a);}})['then'](function(_0x3fe1bd){if(_0x3fe1bd){_0x543c1e=_0x3fe1bd[_0xe394('0x48')];if(!_0x27074b[_0xe394('0x47')][_0xe394('0x5d')]('nolimit')){_0xab747a[_0xe394('0x31')]=qs[_0xe394('0x31')](_0x27074b[_0xe394('0x47')]['limit']);_0xab747a[_0xe394('0x30')]=qs['offset'](_0x27074b['query'][_0xe394('0x30')]);}return _0x2338b6[_0xe394('0x5b')](_0xab747a);}})[_0xe394('0x21')](function(_0x32ef02){if(_0x32ef02){return _0x32ef02?{'count':_0x543c1e,'rows':_0x32ef02}:null;}})[_0xe394('0x21')](respondWithResult(_0x32e868,null))['catch'](handleError(_0x32e868,null));};exports[_0xe394('0x5e')]=function(_0x29d694,_0x4df442,_0x3c9c11){var _0x16e6f1={};var _0x3f72a0={};var _0x5c0c74;var _0x1fc8c3;return db[_0xe394('0x3c')][_0xe394('0x58')]({'where':{'id':_0x29d694['params']['id']}})[_0xe394('0x21')](handleEntityNotFound(_0x4df442,null))[_0xe394('0x21')](function(_0x579b7b){if(_0x579b7b){_0x5c0c74=_0x579b7b;_0x3f72a0[_0xe394('0x41')]=_[_0xe394('0x42')](db[_0xe394('0x59')][_0xe394('0x3d')]);_0x3f72a0[_0xe394('0x47')]=_['keys'](_0x29d694['query']);_0x3f72a0[_0xe394('0x43')]=_['intersection'](_0x3f72a0[_0xe394('0x41')],_0x3f72a0[_0xe394('0x47')]);_0x16e6f1[_0xe394('0x45')]=_[_0xe394('0x44')](_0x3f72a0[_0xe394('0x41')],qs[_0xe394('0x46')](_0x29d694[_0xe394('0x47')][_0xe394('0x46')]));_0x16e6f1[_0xe394('0x45')]=_0x16e6f1[_0xe394('0x45')][_0xe394('0x48')]?_0x16e6f1[_0xe394('0x45')]:_0x3f72a0['model'];_0x16e6f1['order']=qs['sort'](_0x29d694['query'][_0xe394('0x4a')]);_0x16e6f1['where']=qs[_0xe394('0x43')](_['pick'](_0x29d694['query'],_0x3f72a0[_0xe394('0x43')]));if(_0x29d694[_0xe394('0x47')][_0xe394('0x4d')]){_0x16e6f1['where']=_['merge'](_0x16e6f1['where'],{'$or':_[_0xe394('0x3b')](_0x16e6f1[_0xe394('0x45')],function(_0x10820b){var _0x1d230b={};_0x1d230b[_0x10820b]={'$like':'%'+_0x29d694[_0xe394('0x47')][_0xe394('0x4d')]+'%'};return _0x1d230b;})});}_0x16e6f1=_['merge']({},_0x16e6f1,_0x29d694[_0xe394('0x5c')]);return _0x5c0c74[_0xe394('0x5e')](_0x16e6f1);}})['then'](function(_0x5355dd){if(_0x5355dd){_0x1fc8c3=_0x5355dd[_0xe394('0x48')];if(!_0x29d694['query'][_0xe394('0x5d')]('nolimit')){_0x16e6f1[_0xe394('0x31')]=qs[_0xe394('0x31')](_0x29d694['query'][_0xe394('0x31')]);_0x16e6f1[_0xe394('0x30')]=qs[_0xe394('0x30')](_0x29d694[_0xe394('0x47')]['offset']);}return _0x5c0c74[_0xe394('0x5e')](_0x16e6f1);}})['then'](function(_0x13ef50){if(_0x13ef50){return _0x13ef50?{'count':_0x1fc8c3,'rows':_0x13ef50}:null;}})[_0xe394('0x21')](respondWithResult(_0x4df442,null))[_0xe394('0x2b')](handleError(_0x4df442,null));};exports['getTags']=function(_0x3ffe73,_0x5db0ae,_0x350d82){var _0x38e004={};var _0x230018={};var _0x501ce7;var _0x427063;return db[_0xe394('0x3c')][_0xe394('0x58')]({'where':{'id':_0x3ffe73[_0xe394('0x56')]['id']}})[_0xe394('0x21')](handleEntityNotFound(_0x5db0ae,null))[_0xe394('0x21')](function(_0x145f4f){if(_0x145f4f){_0x501ce7=_0x145f4f;_0x230018[_0xe394('0x41')]=_[_0xe394('0x42')](db[_0xe394('0x5f')][_0xe394('0x3d')]);_0x230018[_0xe394('0x47')]=_['keys'](_0x3ffe73['query']);_0x230018[_0xe394('0x43')]=_[_0xe394('0x44')](_0x230018['model'],_0x230018[_0xe394('0x47')]);_0x38e004['attributes']=_[_0xe394('0x44')](_0x230018[_0xe394('0x41')],qs[_0xe394('0x46')](_0x3ffe73[_0xe394('0x47')][_0xe394('0x46')]));_0x38e004['attributes']=_0x38e004[_0xe394('0x45')]['length']?_0x38e004[_0xe394('0x45')]:_0x230018[_0xe394('0x41')];_0x38e004['order']=qs[_0xe394('0x4a')](_0x3ffe73[_0xe394('0x47')]['sort']);_0x38e004[_0xe394('0x4b')]=qs[_0xe394('0x43')](_[_0xe394('0x4c')](_0x3ffe73[_0xe394('0x47')],_0x230018['filters']));if(_0x3ffe73[_0xe394('0x47')][_0xe394('0x4d')]){_0x38e004[_0xe394('0x4b')]=_['merge'](_0x38e004[_0xe394('0x4b')],{'$or':_['map'](_0x38e004['attributes'],function(_0xaaf49){var _0x54a83e={};_0x54a83e[_0xaaf49]={'$like':'%'+_0x3ffe73[_0xe394('0x47')][_0xe394('0x4d')]+'%'};return _0x54a83e;})});}_0x38e004=_[_0xe394('0x4e')]({},_0x38e004,_0x3ffe73['options']);return _0x501ce7['getTags'](_0x38e004);}})[_0xe394('0x21')](function(_0xf93088){if(_0xf93088){_0x427063=_0xf93088[_0xe394('0x48')];if(!_0x3ffe73[_0xe394('0x47')][_0xe394('0x5d')](_0xe394('0x49'))){_0x38e004[_0xe394('0x31')]=qs[_0xe394('0x31')](_0x3ffe73[_0xe394('0x47')][_0xe394('0x31')]);_0x38e004[_0xe394('0x30')]=qs['offset'](_0x3ffe73['query']['offset']);}return _0x501ce7[_0xe394('0x60')](_0x38e004);}})[_0xe394('0x21')](function(_0x581ddc){if(_0x581ddc){return _0x581ddc?{'count':_0x427063,'rows':_0x581ddc}:null;}})[_0xe394('0x21')](respondWithResult(_0x5db0ae,null))[_0xe394('0x2b')](handleError(_0x5db0ae,null));};exports[_0xe394('0x61')]=function(_0x2968a7,_0x4a04d3,_0x3583c5){if(_0x2968a7[_0xe394('0x54')]['id']){delete _0x2968a7[_0xe394('0x54')]['id'];}return db['FreshdeskConfiguration'][_0xe394('0x58')]({'where':{'id':_0x2968a7[_0xe394('0x56')]['id']}})['then'](handleEntityNotFound(_0x4a04d3,null))[_0xe394('0x21')](function(_0x52ad84){if(_0x52ad84){return _0x52ad84[_0xe394('0x61')](_0x2968a7['body'][_0xe394('0x62')]||[]);}return null;})[_0xe394('0x21')](respondWithResult(_0x4a04d3,null))[_0xe394('0x2b')](handleError(_0x4a04d3,null));}; \ No newline at end of file +var _0x3bd7=['offset','set','apply','save','update','destroy','stack','name','send','index','map','FreshdeskConfiguration','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','rows','rawAttributes','find','create','body','params','findOne','FreshdeskField','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','squel','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','count'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x3bd7,0x199));var _0x73bd=function(_0x146837,_0x2aa6a2){_0x146837=_0x146837-0x0;var _0x3d7e60=_0x3bd7[_0x146837];return _0x3d7e60;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x73bd('0x0'));var zipdir=require(_0x73bd('0x1'));var jsonpatch=require(_0x73bd('0x2'));var rp=require('request-promise');var moment=require(_0x73bd('0x3'));var BPromise=require(_0x73bd('0x4'));var Mustache=require(_0x73bd('0x5'));var util=require('util');var path=require(_0x73bd('0x6'));var sox=require('sox');var csv=require(_0x73bd('0x7'));var ejs=require(_0x73bd('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x73bd('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x73bd('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x73bd('0xa'));var authService=require('../../components/auth/service');var qs=require(_0x73bd('0xb'));var as=require(_0x73bd('0xc'));var hardwareService=require(_0x73bd('0xd'));var logger=require(_0x73bd('0xe'))(_0x73bd('0xf'));var utils=require(_0x73bd('0x10'));var config=require('../../config/environment');var db=require(_0x73bd('0x11'))['db'];var jayson=require(_0x73bd('0x12'));var client=jayson[_0x73bd('0x13')][_0x73bd('0x14')]({'port':0x232a});function checkPasswordPattern(_0x2a5dea,_0x415fc4,_0x50ec11){if(_0x50ec11){var _0x45be59=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x45be59['test'](_0x415fc4)){return _0x2a5dea;}else{throw new db[(_0x73bd('0x15'))][(_0x73bd('0x16'))](_0x73bd('0x17'));}}else{return _0x2a5dea;}}function respondWithRpcPromise(_0x3d8ef6,_0x3e628a,_0x5ea8db,_0x41663e){return new BPromise(function(_0xfdf66,_0x1c5366){var _0x3e5933=_0x41663e||client;return _0x3e5933[_0x73bd('0x18')](_0x3d8ef6,_0x5ea8db)[_0x73bd('0x19')](function(_0x10e371){logger[_0x73bd('0x1a')](_0x73bd('0x1b'),_0x3e628a,'request\x20sent');logger[_0x73bd('0x1c')](_0x73bd('0x1d'),_0x3e628a,_0x73bd('0x1e'),JSON[_0x73bd('0x1f')](_0x10e371));if(_0x10e371[_0x73bd('0x20')]){if(_0x10e371[_0x73bd('0x20')][_0x73bd('0x21')]===0x1f4){logger[_0x73bd('0x20')](_0x73bd('0x1b'),_0x3e628a,_0x10e371['error'][_0x73bd('0x22')]);return _0x1c5366(_0x10e371[_0x73bd('0x20')][_0x73bd('0x22')]);}logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x3e628a,_0x10e371['error'][_0x73bd('0x22')]);return _0xfdf66(_0x10e371[_0x73bd('0x20')]['message']);}else{logger[_0x73bd('0x1a')](_0x73bd('0x1b'),_0x3e628a,_0x73bd('0x1e'));_0xfdf66(_0x10e371[_0x73bd('0x23')][_0x73bd('0x22')]);}})[_0x73bd('0x24')](function(_0x2bcd5f){logger[_0x73bd('0x20')](_0x73bd('0x1b'),_0x3e628a,_0x2bcd5f);_0x1c5366(_0x2bcd5f);});});}function respondWithStatusCode(_0x2dd70b,_0x36f7e0){_0x36f7e0=_0x36f7e0||0xcc;return function(_0x840215){if(_0x840215){return _0x2dd70b[_0x73bd('0x25')](_0x36f7e0);}return _0x2dd70b[_0x73bd('0x26')](_0x36f7e0)[_0x73bd('0x27')]();};}function respondWithResult(_0x52e910,_0x50957c){_0x50957c=_0x50957c||0xc8;return function(_0x191727){if(_0x191727){return _0x52e910[_0x73bd('0x26')](_0x50957c)['json'](_0x191727);}};}function respondWithFilteredResult(_0x30117b,_0x330ee3){return function(_0x193fe1){if(_0x193fe1){var _0x5ada8d=_0x193fe1[_0x73bd('0x28')],_0x5ae04e=_0x330ee3['offset'],_0x2f38fe=_0x330ee3[_0x73bd('0x29')]+_0x330ee3['limit'],_0x3f15f8;if(_0x2f38fe>=_0x5ada8d){_0x2f38fe=_0x5ada8d;_0x3f15f8=0xc8;}else{_0x3f15f8=0xce;}_0x30117b[_0x73bd('0x26')](_0x3f15f8);return _0x30117b[_0x73bd('0x2a')]('Content-Range',_0x5ae04e+'-'+_0x2f38fe+'/'+_0x5ada8d)['json'](_0x193fe1);}return null;};}function patchUpdates(_0x2b13c3){return function(_0x2a2144){try{jsonpatch[_0x73bd('0x2b')](_0x2a2144,_0x2b13c3,!![]);}catch(_0x1042e8){return BPromise['reject'](_0x1042e8);}return _0x2a2144[_0x73bd('0x2c')]();};}function saveUpdates(_0x5218dc,_0x295300){return function(_0x2815a3){if(_0x2815a3){return _0x2815a3[_0x73bd('0x2d')](_0x5218dc)[_0x73bd('0x19')](function(_0x4a0efd){return _0x4a0efd;});}return null;};}function removeEntity(_0x3ba328,_0x2653f8){return function(_0x3ee469){if(_0x3ee469){return _0x3ee469[_0x73bd('0x2e')]()[_0x73bd('0x19')](function(){_0x3ba328[_0x73bd('0x26')](0xcc)[_0x73bd('0x27')]();});}};}function handleEntityNotFound(_0x2c4362,_0x531cbe){return function(_0x19b583){if(!_0x19b583){_0x2c4362[_0x73bd('0x25')](0x194);}return _0x19b583;};}function handleError(_0x533af0,_0x3dac1d){_0x3dac1d=_0x3dac1d||0x1f4;return function(_0x177c03){logger['error'](_0x177c03[_0x73bd('0x2f')]);if(_0x177c03['name']){delete _0x177c03[_0x73bd('0x30')];}_0x533af0['status'](_0x3dac1d)[_0x73bd('0x31')](_0x177c03);};}exports[_0x73bd('0x32')]=function(_0x261b4d,_0x1acfb0){var _0x5db723={},_0x772254={},_0x4772fb={'count':0x0,'rows':[]};var _0x4df36c=_[_0x73bd('0x33')](db[_0x73bd('0x34')]['rawAttributes'],function(_0x17041d){return{'name':_0x17041d['fieldName'],'type':_0x17041d[_0x73bd('0x35')][_0x73bd('0x36')]};});_0x772254[_0x73bd('0x37')]=_[_0x73bd('0x33')](_0x4df36c,_0x73bd('0x30'));_0x772254['query']=_[_0x73bd('0x38')](_0x261b4d[_0x73bd('0x39')]);_0x772254[_0x73bd('0x3a')]=_['intersection'](_0x772254[_0x73bd('0x37')],_0x772254[_0x73bd('0x39')]);_0x5db723[_0x73bd('0x3b')]=_[_0x73bd('0x3c')](_0x772254[_0x73bd('0x37')],qs[_0x73bd('0x3d')](_0x261b4d[_0x73bd('0x39')][_0x73bd('0x3d')]));_0x5db723['attributes']=_0x5db723[_0x73bd('0x3b')][_0x73bd('0x3e')]?_0x5db723[_0x73bd('0x3b')]:_0x772254[_0x73bd('0x37')];if(!_0x261b4d[_0x73bd('0x39')][_0x73bd('0x3f')](_0x73bd('0x40'))){_0x5db723['limit']=qs[_0x73bd('0x41')](_0x261b4d[_0x73bd('0x39')][_0x73bd('0x41')]);_0x5db723[_0x73bd('0x29')]=qs['offset'](_0x261b4d[_0x73bd('0x39')][_0x73bd('0x29')]);}_0x5db723[_0x73bd('0x42')]=qs[_0x73bd('0x43')](_0x261b4d[_0x73bd('0x39')]['sort']);_0x5db723[_0x73bd('0x44')]=qs['filters'](_[_0x73bd('0x45')](_0x261b4d['query'],_0x772254[_0x73bd('0x3a')]),_0x4df36c);if(_0x261b4d[_0x73bd('0x39')]['filter']){_0x5db723[_0x73bd('0x44')]=_[_0x73bd('0x46')](_0x5db723[_0x73bd('0x44')],{'$or':_[_0x73bd('0x33')](_0x4df36c,function(_0x2f79b1){if(_0x2f79b1['type']!==_0x73bd('0x47')){var _0x276f3b={};_0x276f3b[_0x2f79b1[_0x73bd('0x30')]]={'$like':'%'+_0x261b4d[_0x73bd('0x39')][_0x73bd('0x48')]+'%'};return _0x276f3b;}})});}_0x5db723=_[_0x73bd('0x46')]({},_0x5db723,_0x261b4d[_0x73bd('0x49')]);var _0x29d5c6={'where':_0x5db723['where']};return db['FreshdeskConfiguration'][_0x73bd('0x28')](_0x29d5c6)[_0x73bd('0x19')](function(_0xd8c1b4){_0x4772fb['count']=_0xd8c1b4;if(_0x261b4d[_0x73bd('0x39')]['includeAll']){_0x5db723[_0x73bd('0x4a')]=[{'all':!![]}];}return db[_0x73bd('0x34')]['findAll'](_0x5db723);})['then'](function(_0x53e0ab){_0x4772fb[_0x73bd('0x4b')]=_0x53e0ab;return _0x4772fb;})['then'](respondWithFilteredResult(_0x1acfb0,_0x5db723))[_0x73bd('0x24')](handleError(_0x1acfb0,null));};exports['show']=function(_0x1d5f30,_0x1e2e28){var _0x7b4baf={'raw':![],'where':{'id':_0x1d5f30['params']['id']}},_0x2a3c76={};_0x2a3c76[_0x73bd('0x37')]=_[_0x73bd('0x38')](db[_0x73bd('0x34')][_0x73bd('0x4c')]);_0x2a3c76[_0x73bd('0x39')]=_[_0x73bd('0x38')](_0x1d5f30[_0x73bd('0x39')]);_0x2a3c76[_0x73bd('0x3a')]=_['intersection'](_0x2a3c76[_0x73bd('0x37')],_0x2a3c76[_0x73bd('0x39')]);_0x7b4baf['attributes']=_[_0x73bd('0x3c')](_0x2a3c76[_0x73bd('0x37')],qs[_0x73bd('0x3d')](_0x1d5f30['query'][_0x73bd('0x3d')]));_0x7b4baf[_0x73bd('0x3b')]=_0x7b4baf[_0x73bd('0x3b')][_0x73bd('0x3e')]?_0x7b4baf[_0x73bd('0x3b')]:_0x2a3c76['model'];if(_0x1d5f30['query']['includeAll']){_0x7b4baf['include']=[{'all':!![]}];}_0x7b4baf=_[_0x73bd('0x46')]({},_0x7b4baf,_0x1d5f30[_0x73bd('0x49')]);return db[_0x73bd('0x34')][_0x73bd('0x4d')](_0x7b4baf)['then'](handleEntityNotFound(_0x1e2e28,null))['then'](respondWithResult(_0x1e2e28,null))['catch'](handleError(_0x1e2e28,null));};exports[_0x73bd('0x4e')]=function(_0x51ee38,_0xa7bd38){return db['FreshdeskConfiguration']['create'](_0x51ee38['body'],{})[_0x73bd('0x19')](respondWithResult(_0xa7bd38,0xc9))[_0x73bd('0x24')](handleError(_0xa7bd38,null));};exports[_0x73bd('0x2d')]=function(_0x5615ba,_0x49e6e3){if(_0x5615ba[_0x73bd('0x4f')]['id']){delete _0x5615ba[_0x73bd('0x4f')]['id'];}return db[_0x73bd('0x34')]['find']({'where':{'id':_0x5615ba[_0x73bd('0x50')]['id']}})[_0x73bd('0x19')](handleEntityNotFound(_0x49e6e3,null))[_0x73bd('0x19')](saveUpdates(_0x5615ba[_0x73bd('0x4f')],null))[_0x73bd('0x19')](respondWithResult(_0x49e6e3,null))[_0x73bd('0x24')](handleError(_0x49e6e3,null));};exports[_0x73bd('0x2e')]=function(_0x12c55d,_0x217f23){return db[_0x73bd('0x34')]['find']({'where':{'id':_0x12c55d['params']['id']}})['then'](handleEntityNotFound(_0x217f23,null))[_0x73bd('0x19')](removeEntity(_0x217f23,null))[_0x73bd('0x24')](handleError(_0x217f23,null));};exports['getFields']=function(_0x2bc8d1,_0x3d4437,_0x27c0d7){var _0x67e2a8={};var _0x5e3f66={};var _0x4621fd;var _0x4b22d5;return db['FreshdeskConfiguration'][_0x73bd('0x51')]({'where':{'id':_0x2bc8d1[_0x73bd('0x50')]['id']}})['then'](handleEntityNotFound(_0x3d4437,null))[_0x73bd('0x19')](function(_0x4002f7){if(_0x4002f7){_0x4621fd=_0x4002f7;_0x5e3f66[_0x73bd('0x37')]=_[_0x73bd('0x38')](db[_0x73bd('0x52')]['rawAttributes']);_0x5e3f66[_0x73bd('0x39')]=_[_0x73bd('0x38')](_0x2bc8d1[_0x73bd('0x39')]);_0x5e3f66[_0x73bd('0x3a')]=_[_0x73bd('0x3c')](_0x5e3f66[_0x73bd('0x37')],_0x5e3f66[_0x73bd('0x39')]);_0x67e2a8[_0x73bd('0x3b')]=_[_0x73bd('0x3c')](_0x5e3f66[_0x73bd('0x37')],qs[_0x73bd('0x3d')](_0x2bc8d1[_0x73bd('0x39')][_0x73bd('0x3d')]));_0x67e2a8['attributes']=_0x67e2a8[_0x73bd('0x3b')][_0x73bd('0x3e')]?_0x67e2a8[_0x73bd('0x3b')]:_0x5e3f66[_0x73bd('0x37')];_0x67e2a8[_0x73bd('0x42')]=qs[_0x73bd('0x43')](_0x2bc8d1[_0x73bd('0x39')][_0x73bd('0x43')]);_0x67e2a8[_0x73bd('0x44')]=qs[_0x73bd('0x3a')](_[_0x73bd('0x45')](_0x2bc8d1['query'],_0x5e3f66[_0x73bd('0x3a')]));if(_0x2bc8d1[_0x73bd('0x39')][_0x73bd('0x48')]){_0x67e2a8['where']=_['merge'](_0x67e2a8[_0x73bd('0x44')],{'$or':_[_0x73bd('0x33')](_0x67e2a8[_0x73bd('0x3b')],function(_0x13a915){var _0x172248={};_0x172248[_0x13a915]={'$like':'%'+_0x2bc8d1[_0x73bd('0x39')][_0x73bd('0x48')]+'%'};return _0x172248;})});}_0x67e2a8=_[_0x73bd('0x46')]({},_0x67e2a8,_0x2bc8d1['options']);return _0x4621fd[_0x73bd('0x53')](_0x67e2a8);}})[_0x73bd('0x19')](function(_0x5df063){if(_0x5df063){_0x4b22d5=_0x5df063[_0x73bd('0x3e')];if(!_0x2bc8d1[_0x73bd('0x39')][_0x73bd('0x3f')](_0x73bd('0x40'))){_0x67e2a8[_0x73bd('0x41')]=qs['limit'](_0x2bc8d1[_0x73bd('0x39')][_0x73bd('0x41')]);_0x67e2a8['offset']=qs[_0x73bd('0x29')](_0x2bc8d1[_0x73bd('0x39')][_0x73bd('0x29')]);}return _0x4621fd['getFields'](_0x67e2a8);}})['then'](function(_0x299fb1){if(_0x299fb1){return _0x299fb1?{'count':_0x4b22d5,'rows':_0x299fb1}:null;}})['then'](respondWithResult(_0x3d4437,null))[_0x73bd('0x24')](handleError(_0x3d4437,null));};exports[_0x73bd('0x54')]=function(_0x5a1f4c,_0x5e73ad,_0x1f1519){var _0x2ba573={};var _0x228ed1={};var _0x533395;var _0x5ca16f;return db[_0x73bd('0x34')][_0x73bd('0x51')]({'where':{'id':_0x5a1f4c[_0x73bd('0x50')]['id']}})[_0x73bd('0x19')](handleEntityNotFound(_0x5e73ad,null))[_0x73bd('0x19')](function(_0x5cf04d){if(_0x5cf04d){_0x533395=_0x5cf04d;_0x228ed1[_0x73bd('0x37')]=_[_0x73bd('0x38')](db['FreshdeskField'][_0x73bd('0x4c')]);_0x228ed1[_0x73bd('0x39')]=_[_0x73bd('0x38')](_0x5a1f4c[_0x73bd('0x39')]);_0x228ed1[_0x73bd('0x3a')]=_['intersection'](_0x228ed1['model'],_0x228ed1[_0x73bd('0x39')]);_0x2ba573[_0x73bd('0x3b')]=_[_0x73bd('0x3c')](_0x228ed1[_0x73bd('0x37')],qs[_0x73bd('0x3d')](_0x5a1f4c[_0x73bd('0x39')][_0x73bd('0x3d')]));_0x2ba573[_0x73bd('0x3b')]=_0x2ba573[_0x73bd('0x3b')][_0x73bd('0x3e')]?_0x2ba573['attributes']:_0x228ed1[_0x73bd('0x37')];_0x2ba573[_0x73bd('0x42')]=qs['sort'](_0x5a1f4c[_0x73bd('0x39')][_0x73bd('0x43')]);_0x2ba573[_0x73bd('0x44')]=qs[_0x73bd('0x3a')](_[_0x73bd('0x45')](_0x5a1f4c[_0x73bd('0x39')],_0x228ed1['filters']));if(_0x5a1f4c[_0x73bd('0x39')][_0x73bd('0x48')]){_0x2ba573[_0x73bd('0x44')]=_[_0x73bd('0x46')](_0x2ba573[_0x73bd('0x44')],{'$or':_[_0x73bd('0x33')](_0x2ba573[_0x73bd('0x3b')],function(_0x4c6f0d){var _0x5ec091={};_0x5ec091[_0x4c6f0d]={'$like':'%'+_0x5a1f4c['query'][_0x73bd('0x48')]+'%'};return _0x5ec091;})});}_0x2ba573=_['merge']({},_0x2ba573,_0x5a1f4c[_0x73bd('0x49')]);return _0x533395[_0x73bd('0x54')](_0x2ba573);}})['then'](function(_0x264046){if(_0x264046){_0x5ca16f=_0x264046[_0x73bd('0x3e')];if(!_0x5a1f4c[_0x73bd('0x39')]['hasOwnProperty'](_0x73bd('0x40'))){_0x2ba573[_0x73bd('0x41')]=qs[_0x73bd('0x41')](_0x5a1f4c[_0x73bd('0x39')]['limit']);_0x2ba573['offset']=qs[_0x73bd('0x29')](_0x5a1f4c['query']['offset']);}return _0x533395[_0x73bd('0x54')](_0x2ba573);}})[_0x73bd('0x19')](function(_0x49b39b){if(_0x49b39b){return _0x49b39b?{'count':_0x5ca16f,'rows':_0x49b39b}:null;}})[_0x73bd('0x19')](respondWithResult(_0x5e73ad,null))['catch'](handleError(_0x5e73ad,null));};exports['getDescriptions']=function(_0x5eabd1,_0x116354,_0x5e2397){var _0x3f06c4={};var _0x48beea={};var _0x3f51b8;var _0x598c35;return db[_0x73bd('0x34')][_0x73bd('0x51')]({'where':{'id':_0x5eabd1[_0x73bd('0x50')]['id']}})[_0x73bd('0x19')](handleEntityNotFound(_0x116354,null))[_0x73bd('0x19')](function(_0x57c5a3){if(_0x57c5a3){_0x3f51b8=_0x57c5a3;_0x48beea[_0x73bd('0x37')]=_['keys'](db['FreshdeskField'][_0x73bd('0x4c')]);_0x48beea[_0x73bd('0x39')]=_[_0x73bd('0x38')](_0x5eabd1[_0x73bd('0x39')]);_0x48beea[_0x73bd('0x3a')]=_[_0x73bd('0x3c')](_0x48beea[_0x73bd('0x37')],_0x48beea['query']);_0x3f06c4['attributes']=_[_0x73bd('0x3c')](_0x48beea[_0x73bd('0x37')],qs[_0x73bd('0x3d')](_0x5eabd1['query'][_0x73bd('0x3d')]));_0x3f06c4[_0x73bd('0x3b')]=_0x3f06c4[_0x73bd('0x3b')][_0x73bd('0x3e')]?_0x3f06c4[_0x73bd('0x3b')]:_0x48beea[_0x73bd('0x37')];_0x3f06c4[_0x73bd('0x42')]=qs[_0x73bd('0x43')](_0x5eabd1[_0x73bd('0x39')]['sort']);_0x3f06c4[_0x73bd('0x44')]=qs[_0x73bd('0x3a')](_['pick'](_0x5eabd1[_0x73bd('0x39')],_0x48beea['filters']));if(_0x5eabd1[_0x73bd('0x39')][_0x73bd('0x48')]){_0x3f06c4[_0x73bd('0x44')]=_[_0x73bd('0x46')](_0x3f06c4[_0x73bd('0x44')],{'$or':_[_0x73bd('0x33')](_0x3f06c4[_0x73bd('0x3b')],function(_0x191925){var _0x6c3404={};_0x6c3404[_0x191925]={'$like':'%'+_0x5eabd1[_0x73bd('0x39')][_0x73bd('0x48')]+'%'};return _0x6c3404;})});}_0x3f06c4=_[_0x73bd('0x46')]({},_0x3f06c4,_0x5eabd1[_0x73bd('0x49')]);return _0x3f51b8[_0x73bd('0x55')](_0x3f06c4);}})[_0x73bd('0x19')](function(_0x132791){if(_0x132791){_0x598c35=_0x132791['length'];if(!_0x5eabd1[_0x73bd('0x39')]['hasOwnProperty'](_0x73bd('0x40'))){_0x3f06c4['limit']=qs[_0x73bd('0x41')](_0x5eabd1[_0x73bd('0x39')][_0x73bd('0x41')]);_0x3f06c4[_0x73bd('0x29')]=qs[_0x73bd('0x29')](_0x5eabd1[_0x73bd('0x39')]['offset']);}return _0x3f51b8[_0x73bd('0x55')](_0x3f06c4);}})[_0x73bd('0x19')](function(_0x1c5d6e){if(_0x1c5d6e){return _0x1c5d6e?{'count':_0x598c35,'rows':_0x1c5d6e}:null;}})[_0x73bd('0x19')](respondWithResult(_0x116354,null))[_0x73bd('0x24')](handleError(_0x116354,null));};exports[_0x73bd('0x56')]=function(_0x536a8b,_0x283cca,_0x4b8c4f){var _0x21a9cc={};var _0x100953={};var _0x249598;var _0x47cfe7;return db[_0x73bd('0x34')][_0x73bd('0x51')]({'where':{'id':_0x536a8b['params']['id']}})[_0x73bd('0x19')](handleEntityNotFound(_0x283cca,null))['then'](function(_0x3acf51){if(_0x3acf51){_0x249598=_0x3acf51;_0x100953[_0x73bd('0x37')]=_[_0x73bd('0x38')](db[_0x73bd('0x57')][_0x73bd('0x4c')]);_0x100953[_0x73bd('0x39')]=_['keys'](_0x536a8b[_0x73bd('0x39')]);_0x100953[_0x73bd('0x3a')]=_[_0x73bd('0x3c')](_0x100953['model'],_0x100953['query']);_0x21a9cc[_0x73bd('0x3b')]=_[_0x73bd('0x3c')](_0x100953[_0x73bd('0x37')],qs[_0x73bd('0x3d')](_0x536a8b[_0x73bd('0x39')][_0x73bd('0x3d')]));_0x21a9cc[_0x73bd('0x3b')]=_0x21a9cc['attributes'][_0x73bd('0x3e')]?_0x21a9cc[_0x73bd('0x3b')]:_0x100953[_0x73bd('0x37')];_0x21a9cc[_0x73bd('0x42')]=qs[_0x73bd('0x43')](_0x536a8b['query'][_0x73bd('0x43')]);_0x21a9cc[_0x73bd('0x44')]=qs[_0x73bd('0x3a')](_[_0x73bd('0x45')](_0x536a8b[_0x73bd('0x39')],_0x100953[_0x73bd('0x3a')]));if(_0x536a8b[_0x73bd('0x39')][_0x73bd('0x48')]){_0x21a9cc[_0x73bd('0x44')]=_[_0x73bd('0x46')](_0x21a9cc[_0x73bd('0x44')],{'$or':_[_0x73bd('0x33')](_0x21a9cc[_0x73bd('0x3b')],function(_0x2f8b5c){var _0x3664af={};_0x3664af[_0x2f8b5c]={'$like':'%'+_0x536a8b[_0x73bd('0x39')][_0x73bd('0x48')]+'%'};return _0x3664af;})});}_0x21a9cc=_[_0x73bd('0x46')]({},_0x21a9cc,_0x536a8b['options']);return _0x249598[_0x73bd('0x56')](_0x21a9cc);}})[_0x73bd('0x19')](function(_0x40554d){if(_0x40554d){_0x47cfe7=_0x40554d[_0x73bd('0x3e')];if(!_0x536a8b[_0x73bd('0x39')][_0x73bd('0x3f')]('nolimit')){_0x21a9cc[_0x73bd('0x41')]=qs[_0x73bd('0x41')](_0x536a8b[_0x73bd('0x39')][_0x73bd('0x41')]);_0x21a9cc[_0x73bd('0x29')]=qs['offset'](_0x536a8b[_0x73bd('0x39')][_0x73bd('0x29')]);}return _0x249598[_0x73bd('0x56')](_0x21a9cc);}})['then'](function(_0x15b3fe){if(_0x15b3fe){return _0x15b3fe?{'count':_0x47cfe7,'rows':_0x15b3fe}:null;}})[_0x73bd('0x19')](respondWithResult(_0x283cca,null))[_0x73bd('0x24')](handleError(_0x283cca,null));};exports[_0x73bd('0x58')]=function(_0x1565f4,_0x5e5fa0,_0x6ff9ad){if(_0x1565f4['body']['id']){delete _0x1565f4[_0x73bd('0x4f')]['id'];}return db[_0x73bd('0x34')]['findOne']({'where':{'id':_0x1565f4['params']['id']}})['then'](handleEntityNotFound(_0x5e5fa0,null))['then'](function(_0x15604d){if(_0x15604d){return _0x15604d[_0x73bd('0x58')](_0x1565f4['body'][_0x73bd('0x59')]||[]);}return null;})[_0x73bd('0x19')](respondWithResult(_0x5e5fa0,null))[_0x73bd('0x24')](handleError(_0x5e5fa0,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 376f99c..0019297 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 _0xa0e5=['define','FreshdeskConfiguration','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x581537,_0x69d09e){var _0x5d64e0=function(_0x2c320c){while(--_0x2c320c){_0x581537['push'](_0x581537['shift']());}};_0x5d64e0(++_0x69d09e);}(_0xa0e5,0x182));var _0x5a0e=function(_0x54d7b7,_0x363165){_0x54d7b7=_0x54d7b7-0x0;var _0x436a72=_0xa0e5[_0x54d7b7];return _0x436a72;};'use strict';var _=require(_0x5a0e('0x0'));var util=require(_0x5a0e('0x1'));var logger=require('../../config/logger')(_0x5a0e('0x2'));var moment=require(_0x5a0e('0x3'));var BPromise=require(_0x5a0e('0x4'));var rp=require(_0x5a0e('0x5'));var fs=require('fs');var path=require(_0x5a0e('0x6'));var rimraf=require(_0x5a0e('0x7'));var config=require(_0x5a0e('0x8'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x5a0e('0x9')]=function(_0x8f3ec6,_0x28114b){return _0x8f3ec6[_0x5a0e('0xa')](_0x5a0e('0xb'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0aa2=['define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x33a0f3,_0x10ea2c){var _0x3e1c06=function(_0x3bb45d){while(--_0x3bb45d){_0x33a0f3['push'](_0x33a0f3['shift']());}};_0x3e1c06(++_0x10ea2c);}(_0x0aa2,0x157));var _0x20aa=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x0aa2[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x20aa('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x20aa('0x1'));var rp=require(_0x20aa('0x2'));var fs=require('fs');var path=require(_0x20aa('0x3'));var rimraf=require(_0x20aa('0x4'));var config=require(_0x20aa('0x5'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x20aa('0x6')]=function(_0x9d6a8d,_0xdcf453){return _0x9d6a8d[_0x20aa('0x7')](_0x20aa('0x8'),attributes,{'tableName':_0x20aa('0x9'),'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 ed21756..3f68340 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 _0xcf34=['util','moment','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0xcf34,0x13b));var _0x4cf3=function(_0x180ac2,_0x219d65){_0x180ac2=_0x180ac2-0x0;var _0xfcaede=_0xcf34[_0x180ac2];return _0xfcaede;};'use strict';var _=require('lodash');var util=require(_0x4cf3('0x0'));var moment=require(_0x4cf3('0x1'));var BPromise=require('bluebird');var rs=require(_0x4cf3('0x2'));var fs=require('fs');var Redis=require(_0x4cf3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4cf3('0x4'));var logger=require(_0x4cf3('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4cf3('0x6'));var client=jayson[_0x4cf3('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x134053,_0x3a1468,_0x1ae566){return new BPromise(function(_0x1fbfff,_0x5c4101){return client[_0x4cf3('0x8')](_0x134053,_0x1ae566)[_0x4cf3('0x9')](function(_0x53c206){logger[_0x4cf3('0xa')](_0x4cf3('0xb'),_0x3a1468,_0x4cf3('0xc'));logger[_0x4cf3('0xd')](_0x4cf3('0xe'),_0x3a1468,_0x4cf3('0xc'),JSON[_0x4cf3('0xf')](_0x53c206));if(_0x53c206['error']){if(_0x53c206[_0x4cf3('0x10')][_0x4cf3('0x11')]===0x1f4){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x3a1468,_0x53c206[_0x4cf3('0x10')]['message']);return _0x5c4101(_0x53c206['error'][_0x4cf3('0x12')]);}logger[_0x4cf3('0x10')](_0x4cf3('0xb'),_0x3a1468,_0x53c206['error'][_0x4cf3('0x12')]);return _0x1fbfff(_0x53c206[_0x4cf3('0x10')][_0x4cf3('0x12')]);}else{logger[_0x4cf3('0xa')](_0x4cf3('0xb'),_0x3a1468,_0x4cf3('0xc'));_0x1fbfff(_0x53c206[_0x4cf3('0x13')][_0x4cf3('0x12')]);}})[_0x4cf3('0x14')](function(_0x14fdb7){logger[_0x4cf3('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x3a1468,_0x14fdb7);_0x5c4101(_0x14fdb7);});});} \ No newline at end of file +var _0xe242=['FreshdeskConfiguration,\x20%s,\x20%s','message','info','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','request\x20sent','debug','stringify','error'];(function(_0x59bcb1,_0x5a4b6c){var _0x4a737f=function(_0x546a49){while(--_0x546a49){_0x59bcb1['push'](_0x59bcb1['shift']());}};_0x4a737f(++_0x5a4b6c);}(_0xe242,0xa4));var _0x2e24=function(_0x2d997f,_0x3ce10b){_0x2d997f=_0x2d997f-0x0;var _0x21898e=_0xe242[_0x2d997f];return _0x21898e;};'use strict';var _=require(_0x2e24('0x0'));var util=require(_0x2e24('0x1'));var moment=require('moment');var BPromise=require(_0x2e24('0x2'));var rs=require(_0x2e24('0x3'));var fs=require('fs');var Redis=require(_0x2e24('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2e24('0x5'));var logger=require(_0x2e24('0x6'))(_0x2e24('0x7'));var config=require(_0x2e24('0x8'));var jayson=require(_0x2e24('0x9'));var client=jayson[_0x2e24('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2dfaaa,_0x3e1f27,_0x14eddc){return new BPromise(function(_0xde7706,_0xafc26c){return client[_0x2e24('0xb')](_0x2dfaaa,_0x14eddc)['then'](function(_0x26be8c){logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x3e1f27,_0x2e24('0xc'));logger[_0x2e24('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x3e1f27,_0x2e24('0xc'),JSON[_0x2e24('0xe')](_0x26be8c));if(_0x26be8c[_0x2e24('0xf')]){if(_0x26be8c['error']['code']===0x1f4){logger[_0x2e24('0xf')](_0x2e24('0x10'),_0x3e1f27,_0x26be8c[_0x2e24('0xf')][_0x2e24('0x11')]);return _0xafc26c(_0x26be8c[_0x2e24('0xf')]['message']);}logger[_0x2e24('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x3e1f27,_0x26be8c[_0x2e24('0xf')][_0x2e24('0x11')]);return _0xde7706(_0x26be8c[_0x2e24('0xf')][_0x2e24('0x11')]);}else{logger[_0x2e24('0x12')](_0x2e24('0x10'),_0x3e1f27,_0x2e24('0xc'));_0xde7706(_0x26be8c[_0x2e24('0x13')]['message']);}})['catch'](function(_0xe66f07){logger[_0x2e24('0xf')](_0x2e24('0x10'),_0x3e1f27,_0xe66f07);_0xafc26c(_0xe66f07);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 943f2fe..6bb7ef6 100644 --- a/server/api/intFreshdeskField/index.js +++ b/server/api/intFreshdeskField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['connect-timeout','express','../../components/interaction/service','./intFreshdeskField.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','multer','path'];(function(_0x43b029,_0x12bba0){var _0x386682=function(_0x16c405){while(--_0x16c405){_0x43b029['push'](_0x43b029['shift']());}};_0x386682(++_0x12bba0);}(_0x3e74,0x175));var _0x43e7=function(_0x54ec54,_0x5970bb){_0x54ec54=_0x54ec54-0x0;var _0x2a55fc=_0x3e74[_0x54ec54];return _0x2a55fc;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x43e7('0x4'));var config=require('../../config/environment');var controller=require(_0x43e7('0x5'));router[_0x43e7('0x6')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0x8')]);router[_0x43e7('0x6')]('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0xa')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0xb')]);router['put'](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0xd')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xe')]);module['exports']=router; \ No newline at end of file +var _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(_0xf73c09,_0x4e424e){var _0xa8923c=function(_0x4831c1){while(--_0x4831c1){_0xf73c09['push'](_0xf73c09['shift']());}};_0xa8923c(++_0x4e424e);}(_0xedd9,0xfc));var _0x9edd=function(_0x57d741,_0x1bbb8b){_0x57d741=_0x57d741-0x0;var _0x43c326=_0xedd9[_0x57d741];return _0x43c326;};'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 5324729..b081bba 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 _0x0689=['BOOLEAN','exports','string','variable','customVariable','keyValue','STRING','ENUM'];(function(_0x5bbd71,_0x33d9e8){var _0x3a3da9=function(_0x51226a){while(--_0x51226a){_0x5bbd71['push'](_0x5bbd71['shift']());}};_0x3a3da9(++_0x33d9e8);}(_0x0689,0x161));var _0x9068=function(_0x4435c2,_0x3c12f2){_0x4435c2=_0x4435c2-0x0;var _0x160402=_0x0689[_0x4435c2];return _0x160402;};'use strict';var Sequelize=require('sequelize');module[_0x9068('0x0')]={'type':{'type':Sequelize['ENUM'](_0x9068('0x1'),_0x9068('0x2'),_0x9068('0x3'),_0x9068('0x4')),'defaultValue':_0x9068('0x1')},'content':{'type':Sequelize[_0x9068('0x5')]},'key':{'type':Sequelize[_0x9068('0x5')]},'keyType':{'type':Sequelize[_0x9068('0x6')](_0x9068('0x1'),_0x9068('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x9068('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x9068('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9068('0x5')]}}; \ No newline at end of file +var _0x79e5=['variable','customVariable','STRING','BOOLEAN','sequelize','ENUM','string'];(function(_0x576078,_0x5a16b3){var _0x4bd52=function(_0x171b51){while(--_0x171b51){_0x576078['push'](_0x576078['shift']());}};_0x4bd52(++_0x5a16b3);}(_0x79e5,0x170));var _0x579e=function(_0x1306db,_0x46f9a8){_0x1306db=_0x1306db-0x0;var _0x1dc0f9=_0x79e5[_0x1306db];return _0x1dc0f9;};'use strict';var Sequelize=require(_0x579e('0x0'));module['exports']={'type':{'type':Sequelize[_0x579e('0x1')](_0x579e('0x2'),_0x579e('0x3'),_0x579e('0x4'),'keyValue'),'defaultValue':_0x579e('0x2')},'content':{'type':Sequelize[_0x579e('0x5')]},'key':{'type':Sequelize[_0x579e('0x5')]},'keyType':{'type':Sequelize[_0x579e('0x1')](_0x579e('0x2'),'variable',_0x579e('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x579e('0x5')]},'nameField':{'type':Sequelize[_0x579e('0x5')]},'customField':{'type':Sequelize[_0x579e('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index b92bc0f..9de3366 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 _0xbfc4=['pick','merge','VIRTUAL','filter','options','FreshdeskField','includeAll','include','rows','show','params','length','find','catch','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','type','keys','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters'];(function(_0x5205d4,_0xf78d10){var _0x4f2b78=function(_0x55d177){while(--_0x55d177){_0x5205d4['push'](_0x5205d4['shift']());}};_0x4f2b78(++_0xf78d10);}(_0xbfc4,0x1ba));var _0x4bfc=function(_0x4b2d01,_0x358bf4){_0x4b2d01=_0x4b2d01-0x0;var _0x4d586b=_0xbfc4[_0x4b2d01];return _0x4d586b;};'use strict';var pdf=require(_0x4bfc('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4bfc('0x1'));var zipdir=require(_0x4bfc('0x2'));var jsonpatch=require(_0x4bfc('0x3'));var rp=require(_0x4bfc('0x4'));var moment=require(_0x4bfc('0x5'));var BPromise=require(_0x4bfc('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4bfc('0x7'));var sox=require(_0x4bfc('0x8'));var csv=require(_0x4bfc('0x9'));var ejs=require(_0x4bfc('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4bfc('0xb'));var crypto=require(_0x4bfc('0xc'));var jsforce=require(_0x4bfc('0xd'));var deskjs=require(_0x4bfc('0xe'));var toCsv=require(_0x4bfc('0x9'));var querystring=require(_0x4bfc('0xf'));var Papa=require(_0x4bfc('0x10'));var Redis=require(_0x4bfc('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4bfc('0x12'));var hardwareService=require(_0x4bfc('0x13'));var logger=require(_0x4bfc('0x14'))('api');var utils=require(_0x4bfc('0x15'));var config=require('../../config/environment');var db=require(_0x4bfc('0x16'))['db'];function respondWithStatusCode(_0x46ecab,_0x2333bf){_0x2333bf=_0x2333bf||0xcc;return function(_0x16034d){if(_0x16034d){return _0x46ecab[_0x4bfc('0x17')](_0x2333bf);}return _0x46ecab['status'](_0x2333bf)[_0x4bfc('0x18')]();};}function respondWithResult(_0x5ee8b3,_0x4297f5){_0x4297f5=_0x4297f5||0xc8;return function(_0x45df70){if(_0x45df70){return _0x5ee8b3[_0x4bfc('0x19')](_0x4297f5)[_0x4bfc('0x1a')](_0x45df70);}};}function respondWithFilteredResult(_0x1bd177,_0x24eb0d){return function(_0x5afd85){if(_0x5afd85){var _0x38c025=_0x5afd85[_0x4bfc('0x1b')],_0x5b7b73=_0x24eb0d[_0x4bfc('0x1c')],_0x191cfc=_0x24eb0d[_0x4bfc('0x1c')]+_0x24eb0d[_0x4bfc('0x1d')],_0x2fbcf3;if(_0x191cfc>=_0x38c025){_0x191cfc=_0x38c025;_0x2fbcf3=0xc8;}else{_0x2fbcf3=0xce;}_0x1bd177['status'](_0x2fbcf3);return _0x1bd177[_0x4bfc('0x1e')]('Content-Range',_0x5b7b73+'-'+_0x191cfc+'/'+_0x38c025)[_0x4bfc('0x1a')](_0x5afd85);}return null;};}function patchUpdates(_0x6c84b6){return function(_0x415da3){try{jsonpatch['apply'](_0x415da3,_0x6c84b6,!![]);}catch(_0x5b0cb0){return BPromise[_0x4bfc('0x1f')](_0x5b0cb0);}return _0x415da3[_0x4bfc('0x20')]();};}function saveUpdates(_0x32bb22,_0x3ee199){return function(_0x2a6e01){if(_0x2a6e01){return _0x2a6e01[_0x4bfc('0x21')](_0x32bb22)[_0x4bfc('0x22')](function(_0x198fe5){return _0x198fe5;});}return null;};}function removeEntity(_0x159845,_0x593da5){return function(_0x30d677){if(_0x30d677){return _0x30d677[_0x4bfc('0x23')]()[_0x4bfc('0x22')](function(){_0x159845[_0x4bfc('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d773e,_0x14741c){return function(_0x31d05c){if(!_0x31d05c){_0x5d773e[_0x4bfc('0x17')](0x194);}return _0x31d05c;};}function handleError(_0xf0fb07,_0x2f34eb){_0x2f34eb=_0x2f34eb||0x1f4;return function(_0x1175ee){logger[_0x4bfc('0x24')](_0x1175ee[_0x4bfc('0x25')]);if(_0x1175ee[_0x4bfc('0x26')]){delete _0x1175ee[_0x4bfc('0x26')];}_0xf0fb07['status'](_0x2f34eb)[_0x4bfc('0x27')](_0x1175ee);};}exports['index']=function(_0x248bb0,_0x353a0a){var _0x42065b={},_0x42d198={},_0x3cb6d3={'count':0x0,'rows':[]};var _0x3d3950=_[_0x4bfc('0x28')](db['FreshdeskField'][_0x4bfc('0x29')],function(_0x4c9746){return{'name':_0x4c9746['fieldName'],'type':_0x4c9746[_0x4bfc('0x2a')]['key']};});_0x42d198['model']=_[_0x4bfc('0x28')](_0x3d3950,_0x4bfc('0x26'));_0x42d198['query']=_[_0x4bfc('0x2b')](_0x248bb0['query']);_0x42d198['filters']=_[_0x4bfc('0x2c')](_0x42d198[_0x4bfc('0x2d')],_0x42d198[_0x4bfc('0x2e')]);_0x42065b[_0x4bfc('0x2f')]=_['intersection'](_0x42d198['model'],qs[_0x4bfc('0x30')](_0x248bb0['query'][_0x4bfc('0x30')]));_0x42065b[_0x4bfc('0x2f')]=_0x42065b[_0x4bfc('0x2f')]['length']?_0x42065b[_0x4bfc('0x2f')]:_0x42d198[_0x4bfc('0x2d')];if(!_0x248bb0[_0x4bfc('0x2e')][_0x4bfc('0x31')](_0x4bfc('0x32'))){_0x42065b[_0x4bfc('0x1d')]=qs['limit'](_0x248bb0[_0x4bfc('0x2e')][_0x4bfc('0x1d')]);_0x42065b[_0x4bfc('0x1c')]=qs[_0x4bfc('0x1c')](_0x248bb0[_0x4bfc('0x2e')][_0x4bfc('0x1c')]);}_0x42065b[_0x4bfc('0x33')]=qs[_0x4bfc('0x34')](_0x248bb0['query']['sort']);_0x42065b[_0x4bfc('0x35')]=qs[_0x4bfc('0x36')](_[_0x4bfc('0x37')](_0x248bb0['query'],_0x42d198['filters']),_0x3d3950);if(_0x248bb0[_0x4bfc('0x2e')]['filter']){_0x42065b[_0x4bfc('0x35')]=_[_0x4bfc('0x38')](_0x42065b[_0x4bfc('0x35')],{'$or':_[_0x4bfc('0x28')](_0x3d3950,function(_0x379239){if(_0x379239[_0x4bfc('0x2a')]!==_0x4bfc('0x39')){var _0x4e4a7c={};_0x4e4a7c[_0x379239[_0x4bfc('0x26')]]={'$like':'%'+_0x248bb0[_0x4bfc('0x2e')][_0x4bfc('0x3a')]+'%'};return _0x4e4a7c;}})});}_0x42065b=_[_0x4bfc('0x38')]({},_0x42065b,_0x248bb0[_0x4bfc('0x3b')]);var _0x5609e5={'where':_0x42065b[_0x4bfc('0x35')]};return db[_0x4bfc('0x3c')][_0x4bfc('0x1b')](_0x5609e5)[_0x4bfc('0x22')](function(_0x3e1f06){_0x3cb6d3[_0x4bfc('0x1b')]=_0x3e1f06;if(_0x248bb0['query'][_0x4bfc('0x3d')]){_0x42065b[_0x4bfc('0x3e')]=[{'all':!![]}];}return db[_0x4bfc('0x3c')]['findAll'](_0x42065b);})[_0x4bfc('0x22')](function(_0x1d793a){_0x3cb6d3[_0x4bfc('0x3f')]=_0x1d793a;return _0x3cb6d3;})['then'](respondWithFilteredResult(_0x353a0a,_0x42065b))['catch'](handleError(_0x353a0a,null));};exports[_0x4bfc('0x40')]=function(_0x246989,_0x5ebdf1){var _0x525f18={'raw':!![],'where':{'id':_0x246989[_0x4bfc('0x41')]['id']}},_0x176c75={};_0x176c75[_0x4bfc('0x2d')]=_['keys'](db[_0x4bfc('0x3c')][_0x4bfc('0x29')]);_0x176c75[_0x4bfc('0x2e')]=_[_0x4bfc('0x2b')](_0x246989['query']);_0x176c75[_0x4bfc('0x36')]=_[_0x4bfc('0x2c')](_0x176c75[_0x4bfc('0x2d')],_0x176c75[_0x4bfc('0x2e')]);_0x525f18[_0x4bfc('0x2f')]=_[_0x4bfc('0x2c')](_0x176c75['model'],qs[_0x4bfc('0x30')](_0x246989[_0x4bfc('0x2e')][_0x4bfc('0x30')]));_0x525f18['attributes']=_0x525f18['attributes'][_0x4bfc('0x42')]?_0x525f18[_0x4bfc('0x2f')]:_0x176c75[_0x4bfc('0x2d')];if(_0x246989['query'][_0x4bfc('0x3d')]){_0x525f18[_0x4bfc('0x3e')]=[{'all':!![]}];}_0x525f18=_[_0x4bfc('0x38')]({},_0x525f18,_0x246989[_0x4bfc('0x3b')]);return db[_0x4bfc('0x3c')][_0x4bfc('0x43')](_0x525f18)[_0x4bfc('0x22')](handleEntityNotFound(_0x5ebdf1,null))[_0x4bfc('0x22')](respondWithResult(_0x5ebdf1,null))[_0x4bfc('0x44')](handleError(_0x5ebdf1,null));};exports[_0x4bfc('0x45')]=function(_0x910a5a,_0x17f0c3){return db['FreshdeskField'][_0x4bfc('0x45')](_0x910a5a[_0x4bfc('0x46')],{})['then'](respondWithResult(_0x17f0c3,0xc9))[_0x4bfc('0x44')](handleError(_0x17f0c3,null));};exports[_0x4bfc('0x21')]=function(_0x42db3e,_0x33aa95){if(_0x42db3e[_0x4bfc('0x46')]['id']){delete _0x42db3e['body']['id'];}return db[_0x4bfc('0x3c')][_0x4bfc('0x43')]({'where':{'id':_0x42db3e[_0x4bfc('0x41')]['id']}})[_0x4bfc('0x22')](handleEntityNotFound(_0x33aa95,null))['then'](saveUpdates(_0x42db3e[_0x4bfc('0x46')],null))['then'](respondWithResult(_0x33aa95,null))[_0x4bfc('0x44')](handleError(_0x33aa95,null));};exports[_0x4bfc('0x23')]=function(_0x10409f,_0x171965){return db[_0x4bfc('0x3c')][_0x4bfc('0x43')]({'where':{'id':_0x10409f['params']['id']}})['then'](handleEntityNotFound(_0x171965,null))['then'](removeEntity(_0x171965,null))[_0x4bfc('0x44')](handleError(_0x171965,null));}; \ No newline at end of file +var _0x8baa=['filter','merge','options','includeAll','include','findAll','rows','catch','params','find','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','set','Content-Range','save','update','then','stack','name','send','index','map','FreshdeskField','rawAttributes','type','key','query','keys','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick'];(function(_0x1b22f1,_0x2b3551){var _0x50696a=function(_0x2b46ea){while(--_0x2b46ea){_0x1b22f1['push'](_0x1b22f1['shift']());}};_0x50696a(++_0x2b3551);}(_0x8baa,0x1e0));var _0xa8ba=function(_0x4f5fd4,_0x165898){_0x4f5fd4=_0x4f5fd4-0x0;var _0x58705f=_0x8baa[_0x4f5fd4];return _0x58705f;};'use strict';var pdf=require(_0xa8ba('0x0'));var emlformat=require(_0xa8ba('0x1'));var rimraf=require(_0xa8ba('0x2'));var zipdir=require(_0xa8ba('0x3'));var jsonpatch=require(_0xa8ba('0x4'));var rp=require(_0xa8ba('0x5'));var moment=require(_0xa8ba('0x6'));var BPromise=require(_0xa8ba('0x7'));var Mustache=require(_0xa8ba('0x8'));var util=require(_0xa8ba('0x9'));var path=require(_0xa8ba('0xa'));var sox=require(_0xa8ba('0xb'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xa8ba('0xc'));var squel=require(_0xa8ba('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa8ba('0xe'));var toCsv=require(_0xa8ba('0xf'));var querystring=require(_0xa8ba('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa8ba('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa8ba('0x12'));var hardwareService=require(_0xa8ba('0x13'));var logger=require('../../config/logger')(_0xa8ba('0x14'));var utils=require('../../config/utils');var config=require(_0xa8ba('0x15'));var db=require(_0xa8ba('0x16'))['db'];function respondWithStatusCode(_0x5ce370,_0x51e4fa){_0x51e4fa=_0x51e4fa||0xcc;return function(_0x3174f7){if(_0x3174f7){return _0x5ce370[_0xa8ba('0x17')](_0x51e4fa);}return _0x5ce370['status'](_0x51e4fa)[_0xa8ba('0x18')]();};}function respondWithResult(_0x49db87,_0x99eb18){_0x99eb18=_0x99eb18||0xc8;return function(_0x3a9b39){if(_0x3a9b39){return _0x49db87[_0xa8ba('0x19')](_0x99eb18)['json'](_0x3a9b39);}};}function respondWithFilteredResult(_0x5dcf78,_0x49f24a){return function(_0xe7f6b1){if(_0xe7f6b1){var _0x61d8ba=_0xe7f6b1[_0xa8ba('0x1a')],_0x19526f=_0x49f24a['offset'],_0x25b00e=_0x49f24a[_0xa8ba('0x1b')]+_0x49f24a['limit'],_0x123850;if(_0x25b00e>=_0x61d8ba){_0x25b00e=_0x61d8ba;_0x123850=0xc8;}else{_0x123850=0xce;}_0x5dcf78[_0xa8ba('0x19')](_0x123850);return _0x5dcf78[_0xa8ba('0x1c')](_0xa8ba('0x1d'),_0x19526f+'-'+_0x25b00e+'/'+_0x61d8ba)['json'](_0xe7f6b1);}return null;};}function patchUpdates(_0x5a4345){return function(_0x27fd59){try{jsonpatch['apply'](_0x27fd59,_0x5a4345,!![]);}catch(_0x3032e4){return BPromise['reject'](_0x3032e4);}return _0x27fd59[_0xa8ba('0x1e')]();};}function saveUpdates(_0x2c2617,_0x3e3f56){return function(_0x25ec5e){if(_0x25ec5e){return _0x25ec5e[_0xa8ba('0x1f')](_0x2c2617)[_0xa8ba('0x20')](function(_0x2dc0a2){return _0x2dc0a2;});}return null;};}function removeEntity(_0x370343,_0x1118be){return function(_0x4ac44c){if(_0x4ac44c){return _0x4ac44c['destroy']()[_0xa8ba('0x20')](function(){_0x370343[_0xa8ba('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b7013,_0x58904a){return function(_0x2d7d0d){if(!_0x2d7d0d){_0x1b7013['sendStatus'](0x194);}return _0x2d7d0d;};}function handleError(_0x2ed58c,_0x3e1030){_0x3e1030=_0x3e1030||0x1f4;return function(_0x2d45d9){logger['error'](_0x2d45d9[_0xa8ba('0x21')]);if(_0x2d45d9['name']){delete _0x2d45d9[_0xa8ba('0x22')];}_0x2ed58c[_0xa8ba('0x19')](_0x3e1030)[_0xa8ba('0x23')](_0x2d45d9);};}exports[_0xa8ba('0x24')]=function(_0x5718c9,_0x1dc648){var _0x3ba034={},_0x579766={},_0x7e1a14={'count':0x0,'rows':[]};var _0x3eedfa=_[_0xa8ba('0x25')](db[_0xa8ba('0x26')][_0xa8ba('0x27')],function(_0x42a26c){return{'name':_0x42a26c['fieldName'],'type':_0x42a26c[_0xa8ba('0x28')][_0xa8ba('0x29')]};});_0x579766['model']=_[_0xa8ba('0x25')](_0x3eedfa,_0xa8ba('0x22'));_0x579766[_0xa8ba('0x2a')]=_[_0xa8ba('0x2b')](_0x5718c9['query']);_0x579766['filters']=_['intersection'](_0x579766['model'],_0x579766[_0xa8ba('0x2a')]);_0x3ba034[_0xa8ba('0x2c')]=_[_0xa8ba('0x2d')](_0x579766[_0xa8ba('0x2e')],qs['fields'](_0x5718c9[_0xa8ba('0x2a')][_0xa8ba('0x2f')]));_0x3ba034[_0xa8ba('0x2c')]=_0x3ba034[_0xa8ba('0x2c')][_0xa8ba('0x30')]?_0x3ba034['attributes']:_0x579766[_0xa8ba('0x2e')];if(!_0x5718c9[_0xa8ba('0x2a')][_0xa8ba('0x31')](_0xa8ba('0x32'))){_0x3ba034[_0xa8ba('0x33')]=qs['limit'](_0x5718c9[_0xa8ba('0x2a')]['limit']);_0x3ba034[_0xa8ba('0x1b')]=qs[_0xa8ba('0x1b')](_0x5718c9[_0xa8ba('0x2a')][_0xa8ba('0x1b')]);}_0x3ba034['order']=qs[_0xa8ba('0x34')](_0x5718c9['query']['sort']);_0x3ba034[_0xa8ba('0x35')]=qs[_0xa8ba('0x36')](_[_0xa8ba('0x37')](_0x5718c9[_0xa8ba('0x2a')],_0x579766['filters']),_0x3eedfa);if(_0x5718c9[_0xa8ba('0x2a')][_0xa8ba('0x38')]){_0x3ba034[_0xa8ba('0x35')]=_[_0xa8ba('0x39')](_0x3ba034[_0xa8ba('0x35')],{'$or':_[_0xa8ba('0x25')](_0x3eedfa,function(_0x24dd54){if(_0x24dd54[_0xa8ba('0x28')]!=='VIRTUAL'){var _0x7d56f1={};_0x7d56f1[_0x24dd54['name']]={'$like':'%'+_0x5718c9[_0xa8ba('0x2a')]['filter']+'%'};return _0x7d56f1;}})});}_0x3ba034=_[_0xa8ba('0x39')]({},_0x3ba034,_0x5718c9[_0xa8ba('0x3a')]);var _0x220a42={'where':_0x3ba034[_0xa8ba('0x35')]};return db[_0xa8ba('0x26')][_0xa8ba('0x1a')](_0x220a42)[_0xa8ba('0x20')](function(_0x2f4d03){_0x7e1a14[_0xa8ba('0x1a')]=_0x2f4d03;if(_0x5718c9[_0xa8ba('0x2a')][_0xa8ba('0x3b')]){_0x3ba034[_0xa8ba('0x3c')]=[{'all':!![]}];}return db[_0xa8ba('0x26')][_0xa8ba('0x3d')](_0x3ba034);})[_0xa8ba('0x20')](function(_0x337689){_0x7e1a14[_0xa8ba('0x3e')]=_0x337689;return _0x7e1a14;})[_0xa8ba('0x20')](respondWithFilteredResult(_0x1dc648,_0x3ba034))[_0xa8ba('0x3f')](handleError(_0x1dc648,null));};exports['show']=function(_0x32fedc,_0x10bb39){var _0x171c35={'raw':!![],'where':{'id':_0x32fedc[_0xa8ba('0x40')]['id']}},_0x5bd99d={};_0x5bd99d[_0xa8ba('0x2e')]=_[_0xa8ba('0x2b')](db[_0xa8ba('0x26')][_0xa8ba('0x27')]);_0x5bd99d[_0xa8ba('0x2a')]=_['keys'](_0x32fedc['query']);_0x5bd99d[_0xa8ba('0x36')]=_[_0xa8ba('0x2d')](_0x5bd99d[_0xa8ba('0x2e')],_0x5bd99d[_0xa8ba('0x2a')]);_0x171c35[_0xa8ba('0x2c')]=_[_0xa8ba('0x2d')](_0x5bd99d[_0xa8ba('0x2e')],qs[_0xa8ba('0x2f')](_0x32fedc[_0xa8ba('0x2a')][_0xa8ba('0x2f')]));_0x171c35['attributes']=_0x171c35[_0xa8ba('0x2c')][_0xa8ba('0x30')]?_0x171c35['attributes']:_0x5bd99d[_0xa8ba('0x2e')];if(_0x32fedc[_0xa8ba('0x2a')][_0xa8ba('0x3b')]){_0x171c35[_0xa8ba('0x3c')]=[{'all':!![]}];}_0x171c35=_[_0xa8ba('0x39')]({},_0x171c35,_0x32fedc['options']);return db[_0xa8ba('0x26')][_0xa8ba('0x41')](_0x171c35)[_0xa8ba('0x20')](handleEntityNotFound(_0x10bb39,null))['then'](respondWithResult(_0x10bb39,null))['catch'](handleError(_0x10bb39,null));};exports['create']=function(_0x142828,_0x4e85e2){return db[_0xa8ba('0x26')]['create'](_0x142828['body'],{})[_0xa8ba('0x20')](respondWithResult(_0x4e85e2,0xc9))[_0xa8ba('0x3f')](handleError(_0x4e85e2,null));};exports['update']=function(_0x190ede,_0x2040aa){if(_0x190ede[_0xa8ba('0x42')]['id']){delete _0x190ede[_0xa8ba('0x42')]['id'];}return db[_0xa8ba('0x26')]['find']({'where':{'id':_0x190ede[_0xa8ba('0x40')]['id']}})[_0xa8ba('0x20')](handleEntityNotFound(_0x2040aa,null))['then'](saveUpdates(_0x190ede['body'],null))[_0xa8ba('0x20')](respondWithResult(_0x2040aa,null))[_0xa8ba('0x3f')](handleError(_0x2040aa,null));};exports['destroy']=function(_0x2fcf98,_0x434186){return db[_0xa8ba('0x26')][_0xa8ba('0x41')]({'where':{'id':_0x2fcf98[_0xa8ba('0x40')]['id']}})[_0xa8ba('0x20')](handleEntityNotFound(_0x434186,null))[_0xa8ba('0x20')](removeEntity(_0x434186,null))[_0xa8ba('0x3f')](handleError(_0x434186,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index fe9fb4f..ffbea7e 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 _0x02cc=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','freshdesk_unique_index','FieldId'];(function(_0x1c64ad,_0x3646f1){var _0x344bf3=function(_0x321441){while(--_0x321441){_0x1c64ad['push'](_0x1c64ad['shift']());}};_0x344bf3(++_0x3646f1);}(_0x02cc,0xd8));var _0xc02c=function(_0x51352f,_0x3f8caa){_0x51352f=_0x51352f-0x0;var _0x21db5c=_0x02cc[_0x51352f];return _0x21db5c;};'use strict';var _=require('lodash');var util=require(_0xc02c('0x0'));var logger=require(_0xc02c('0x1'))('api');var moment=require(_0xc02c('0x2'));var BPromise=require('bluebird');var rp=require(_0xc02c('0x3'));var fs=require('fs');var path=require(_0xc02c('0x4'));var rimraf=require(_0xc02c('0x5'));var config=require(_0xc02c('0x6'));var attributes=require(_0xc02c('0x7'));module[_0xc02c('0x8')]=function(_0x3fc504,_0x6ba5a6){return _0x3fc504[_0xc02c('0x9')]('FreshdeskField',attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0xc02c('0xa'),'fields':['idField',_0xc02c('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x809e=['int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','util','../../config/logger','moment','bluebird','path','../../config/environment','exports','define','FreshdeskField'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0x809e,0x197));var _0xe809=function(_0x58576a,_0x287d93){_0x58576a=_0x58576a-0x0;var _0x1438e9=_0x809e[_0x58576a];return _0x1438e9;};'use strict';var _=require('lodash');var util=require(_0xe809('0x0'));var logger=require(_0xe809('0x1'))('api');var moment=require(_0xe809('0x2'));var BPromise=require(_0xe809('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe809('0x4'));var rimraf=require('rimraf');var config=require(_0xe809('0x5'));var attributes=require('./intFreshdeskField.attributes');module[_0xe809('0x6')]=function(_0x2a7886,_0x4e326c){return _0x2a7886[_0xe809('0x7')](_0xe809('0x8'),attributes,{'tableName':_0xe809('0x9'),'paranoid':![],'indexes':[{'name':_0xe809('0xa'),'fields':[_0xe809('0xb'),_0xe809('0xc')],'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 868fbc2..4dc3569 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(_0x3432c1,_0x3c0025){var _0x35f215=function(_0x4cc24c){while(--_0x4cc24c){_0x3432c1['push'](_0x3432c1['shift']());}};_0x35f215(++_0x3c0025);}(_0xb10b,0x12a));var _0xbb10=function(_0x1979d8,_0x10d8f2){_0x1979d8=_0x1979d8-0x0;var _0x1d5bb3=_0xb10b[_0x1979d8];return _0x1d5bb3;};'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(_0x58913c,_0x4c3544){var _0x1dd50e=function(_0x411387){while(--_0x411387){_0x58913c['push'](_0x58913c['shift']());}};_0x1dd50e(++_0x4c3544);}(_0xb10b,0x12a));var _0xbb10=function(_0x597484,_0x199340){_0x597484=_0x597484-0x0;var _0x218e64=_0xb10b[_0x597484];return _0x218e64;};'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 7a4850e..d6ace11 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 _0xb92b=['delete','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put'];(function(_0x2128ae,_0x190a65){var _0x90694f=function(_0x547304){while(--_0x547304){_0x2128ae['push'](_0x2128ae['shift']());}};_0x90694f(++_0x190a65);}(_0xb92b,0xdd));var _0xbb92=function(_0x28df27,_0x32db76){_0x28df27=_0x28df27-0x0;var _0x414251=_0xb92b[_0x28df27];return _0x414251;};'use strict';var multer=require(_0xbb92('0x0'));var util=require(_0xbb92('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbb92('0x2'));var router=express[_0xbb92('0x3')]();var auth=require(_0xbb92('0x4'));var interaction=require(_0xbb92('0x5'));var config=require(_0xbb92('0x6'));var controller=require(_0xbb92('0x7'));router[_0xbb92('0x8')]('/',auth['isAuthenticated'](),controller[_0xbb92('0x9')]);router[_0xbb92('0x8')](_0xbb92('0xa'),auth[_0xbb92('0xb')](),controller[_0xbb92('0xc')]);router[_0xbb92('0x8')](_0xbb92('0xd'),auth[_0xbb92('0xb')](),controller[_0xbb92('0xe')]);router[_0xbb92('0x8')](_0xbb92('0xf'),auth[_0xbb92('0xb')](),controller[_0xbb92('0x10')]);router[_0xbb92('0x11')]('/',auth[_0xbb92('0xb')](),controller[_0xbb92('0x12')]);router[_0xbb92('0x11')](_0xbb92('0xd'),auth[_0xbb92('0xb')](),controller[_0xbb92('0x13')]);router[_0xbb92('0x14')](_0xbb92('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xbb92('0x15')]('/:id',auth[_0xbb92('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe8c3=['../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','post','addConfiguration','put','update','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x46afb1,_0x165a9f){var _0x2661d0=function(_0x5a1838){while(--_0x5a1838){_0x46afb1['push'](_0x46afb1['shift']());}};_0x2661d0(++_0x165a9f);}(_0xe8c3,0x121));var _0x3e8c=function(_0x2eb5bc,_0x4634c6){_0x2eb5bc=_0x2eb5bc-0x0;var _0x51c7b1=_0xe8c3[_0x2eb5bc];return _0x51c7b1;};'use strict';var multer=require('multer');var util=require(_0x3e8c('0x0'));var path=require(_0x3e8c('0x1'));var timeout=require(_0x3e8c('0x2'));var express=require(_0x3e8c('0x3'));var router=express[_0x3e8c('0x4')]();var auth=require(_0x3e8c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3e8c('0x6'));var controller=require('./intFreshsalesAccount.controller');router[_0x3e8c('0x7')]('/',auth['isAuthenticated'](),controller[_0x3e8c('0x8')]);router['get'](_0x3e8c('0x9'),auth[_0x3e8c('0xa')](),controller[_0x3e8c('0xb')]);router[_0x3e8c('0x7')](_0x3e8c('0xc'),auth[_0x3e8c('0xa')](),controller[_0x3e8c('0xd')]);router[_0x3e8c('0x7')]('/:id/fields',auth[_0x3e8c('0xa')](),controller[_0x3e8c('0xe')]);router[_0x3e8c('0xf')]('/',auth[_0x3e8c('0xa')](),controller['create']);router[_0x3e8c('0xf')](_0x3e8c('0xc'),auth[_0x3e8c('0xa')](),controller[_0x3e8c('0x10')]);router[_0x3e8c('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x3e8c('0x12')]);router['delete'](_0x3e8c('0x9'),auth['isAuthenticated'](),controller[_0x3e8c('0x13')]);module[_0x3e8c('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 5c2773a..c960605 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 _0xb94c=['STRING','remoteUri','sequelize','exports'];(function(_0x2172c6,_0xb03756){var _0x1ea290=function(_0x5698af){while(--_0x5698af){_0x2172c6['push'](_0x2172c6['shift']());}};_0x1ea290(++_0xb03756);}(_0xb94c,0x176));var _0xcb94=function(_0x4b38c2,_0x54550d){_0x4b38c2=_0x4b38c2-0x0;var _0x3081fe=_0xb94c[_0x4b38c2];return _0x3081fe;};'use strict';var Sequelize=require(_0xcb94('0x0'));module[_0xcb94('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xcb94('0x2')]},'username':{'type':Sequelize[_0xcb94('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0xcb94('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xcb94('0x3')},'serverUrl':{'type':Sequelize[_0xcb94('0x2')]}}; \ No newline at end of file +var _0x3e94=['STRING','username','remoteUri','sequelize','exports'];(function(_0x131205,_0x57575c){var _0x305300=function(_0x179eea){while(--_0x179eea){_0x131205['push'](_0x131205['shift']());}};_0x305300(++_0x57575c);}(_0x3e94,0x67));var _0x43e9=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x3e94[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0x43e9('0x0'));module[_0x43e9('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x43e9('0x2')]},'username':{'type':Sequelize[_0x43e9('0x2')],'unique':_0x43e9('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x43e9('0x2')],'unique':_0x43e9('0x4')},'serverUrl':{'type':Sequelize[_0x43e9('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 2336204..7fe4f1e 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 _0x78ba=['attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','params','find','catch','create','body','getConfigurations','pick','hasOwnProperty','findOne','getSubjects','channel','FreshsalesField','Subjects','Descriptions','username','remoteUri','apiKey','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','getFields','Wrong\x20credentials','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','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','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','info','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','sendStatus','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0x78ba,0x16e));var _0xa78b=function(_0x332d45,_0x1090fa){_0x332d45=_0x332d45-0x0;var _0x1a0506=_0x78ba[_0x332d45];return _0x1a0506;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa78b('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa78b('0x1'));var moment=require('moment');var BPromise=require(_0xa78b('0x2'));var Mustache=require(_0xa78b('0x3'));var util=require(_0xa78b('0x4'));var path=require(_0xa78b('0x5'));var sox=require(_0xa78b('0x6'));var csv=require(_0xa78b('0x7'));var ejs=require(_0xa78b('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa78b('0x9'));var jsforce=require(_0xa78b('0xa'));var deskjs=require(_0xa78b('0xb'));var toCsv=require('to-csv');var querystring=require(_0xa78b('0xc'));var Papa=require(_0xa78b('0xd'));var Redis=require(_0xa78b('0xe'));var authService=require(_0xa78b('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa78b('0x10'));var logger=require(_0xa78b('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xa78b('0x12'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xa78b('0x13'));var client=jayson[_0xa78b('0x14')]['http']({'port':0x232a});function checkPasswordPattern(_0x5f3017,_0x1ba2cc,_0x48344e){if(_0x48344e){var _0x49f325=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x49f325[_0xa78b('0x15')](_0x1ba2cc)){return _0x5f3017;}else{throw new db['Sequelize'][(_0xa78b('0x16'))](_0xa78b('0x17'));}}else{return _0x5f3017;}}function respondWithRpcPromise(_0x416239,_0x15e5be,_0x42afd4,_0x2774b0){return new BPromise(function(_0x3ccc4f,_0xfacf3d){var _0x56cc2c=_0x2774b0||client;return _0x56cc2c[_0xa78b('0x18')](_0x416239,_0x42afd4)['then'](function(_0x252a22){logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x15e5be,_0xa78b('0x19'));logger[_0xa78b('0x1a')](_0xa78b('0x1b'),_0x15e5be,_0xa78b('0x19'),JSON[_0xa78b('0x1c')](_0x252a22));if(_0x252a22['error']){if(_0x252a22[_0xa78b('0x1d')][_0xa78b('0x1e')]===0x1f4){logger[_0xa78b('0x1d')](_0xa78b('0x1f'),_0x15e5be,_0x252a22[_0xa78b('0x1d')][_0xa78b('0x20')]);return _0xfacf3d(_0x252a22[_0xa78b('0x1d')]['message']);}logger[_0xa78b('0x1d')](_0xa78b('0x1f'),_0x15e5be,_0x252a22['error'][_0xa78b('0x20')]);return _0x3ccc4f(_0x252a22['error'][_0xa78b('0x20')]);}else{logger[_0xa78b('0x21')](_0xa78b('0x1f'),_0x15e5be,'request\x20sent');_0x3ccc4f(_0x252a22['result']['message']);}})['catch'](function(_0x5e201e){logger[_0xa78b('0x1d')](_0xa78b('0x1f'),_0x15e5be,_0x5e201e);_0xfacf3d(_0x5e201e);});});}function respondWithStatusCode(_0x26a5b1,_0x563a83){_0x563a83=_0x563a83||0xcc;return function(_0x548ed6){if(_0x548ed6){return _0x26a5b1['sendStatus'](_0x563a83);}return _0x26a5b1[_0xa78b('0x22')](_0x563a83)[_0xa78b('0x23')]();};}function respondWithResult(_0x6b02e0,_0x1c95eb){_0x1c95eb=_0x1c95eb||0xc8;return function(_0x28456d){if(_0x28456d){return _0x6b02e0['status'](_0x1c95eb)[_0xa78b('0x24')](_0x28456d);}};}function respondWithFilteredResult(_0x2e7a82,_0xc10b2f){return function(_0xcb4270){if(_0xcb4270){var _0x5ede7e=_0xcb4270[_0xa78b('0x25')],_0x54e710=_0xc10b2f[_0xa78b('0x26')],_0x57cdae=_0xc10b2f['offset']+_0xc10b2f[_0xa78b('0x27')],_0x5b9a52;if(_0x57cdae>=_0x5ede7e){_0x57cdae=_0x5ede7e;_0x5b9a52=0xc8;}else{_0x5b9a52=0xce;}_0x2e7a82[_0xa78b('0x22')](_0x5b9a52);return _0x2e7a82[_0xa78b('0x28')](_0xa78b('0x29'),_0x54e710+'-'+_0x57cdae+'/'+_0x5ede7e)[_0xa78b('0x24')](_0xcb4270);}return null;};}function patchUpdates(_0x1b22b1){return function(_0x42f7bb){try{jsonpatch[_0xa78b('0x2a')](_0x42f7bb,_0x1b22b1,!![]);}catch(_0x447172){return BPromise['reject'](_0x447172);}return _0x42f7bb[_0xa78b('0x2b')]();};}function saveUpdates(_0x477775,_0x2f3b33){return function(_0x3a27a0){if(_0x3a27a0){return _0x3a27a0[_0xa78b('0x2c')](_0x477775)['then'](function(_0x2ec8a5){return _0x2ec8a5;});}return null;};}function removeEntity(_0x11d772,_0xd626f9){return function(_0x551842){if(_0x551842){return _0x551842['destroy']()[_0xa78b('0x2d')](function(){_0x11d772['status'](0xcc)[_0xa78b('0x23')]();});}};}function handleEntityNotFound(_0x225fe0,_0x26bc6f){return function(_0x5dbb1b){if(!_0x5dbb1b){_0x225fe0[_0xa78b('0x2e')](0x194);}return _0x5dbb1b;};}function handleError(_0x2b05d9,_0xd20c96){_0xd20c96=_0xd20c96||0x1f4;return function(_0x5c5a1f){logger['error'](_0x5c5a1f[_0xa78b('0x2f')]);if(_0x5c5a1f[_0xa78b('0x30')]){delete _0x5c5a1f[_0xa78b('0x30')];}_0x2b05d9['status'](_0xd20c96)[_0xa78b('0x31')](_0x5c5a1f);};}exports[_0xa78b('0x32')]=function(_0x3f1b00,_0x238811){var _0x429e0a={},_0x59f1aa={},_0x23d454={'count':0x0,'rows':[]};var _0x431da5=_[_0xa78b('0x33')](db[_0xa78b('0x34')][_0xa78b('0x35')],function(_0x18d975){return{'name':_0x18d975[_0xa78b('0x36')],'type':_0x18d975[_0xa78b('0x37')][_0xa78b('0x38')]};});_0x59f1aa[_0xa78b('0x39')]=_['map'](_0x431da5,_0xa78b('0x30'));_0x59f1aa[_0xa78b('0x3a')]=_[_0xa78b('0x3b')](_0x3f1b00[_0xa78b('0x3a')]);_0x59f1aa[_0xa78b('0x3c')]=_[_0xa78b('0x3d')](_0x59f1aa[_0xa78b('0x39')],_0x59f1aa['query']);_0x429e0a[_0xa78b('0x3e')]=_['intersection'](_0x59f1aa[_0xa78b('0x39')],qs[_0xa78b('0x3f')](_0x3f1b00[_0xa78b('0x3a')]['fields']));_0x429e0a[_0xa78b('0x3e')]=_0x429e0a[_0xa78b('0x3e')][_0xa78b('0x40')]?_0x429e0a[_0xa78b('0x3e')]:_0x59f1aa['model'];if(!_0x3f1b00['query']['hasOwnProperty'](_0xa78b('0x41'))){_0x429e0a['limit']=qs[_0xa78b('0x27')](_0x3f1b00[_0xa78b('0x3a')][_0xa78b('0x27')]);_0x429e0a['offset']=qs[_0xa78b('0x26')](_0x3f1b00[_0xa78b('0x3a')][_0xa78b('0x26')]);}_0x429e0a[_0xa78b('0x42')]=qs[_0xa78b('0x43')](_0x3f1b00[_0xa78b('0x3a')][_0xa78b('0x43')]);_0x429e0a[_0xa78b('0x44')]=qs[_0xa78b('0x3c')](_['pick'](_0x3f1b00[_0xa78b('0x3a')],_0x59f1aa[_0xa78b('0x3c')]),_0x431da5);if(_0x3f1b00[_0xa78b('0x3a')][_0xa78b('0x45')]){_0x429e0a['where']=_[_0xa78b('0x46')](_0x429e0a[_0xa78b('0x44')],{'$or':_[_0xa78b('0x33')](_0x431da5,function(_0x3c2845){if(_0x3c2845[_0xa78b('0x37')]!==_0xa78b('0x47')){var _0x2038ce={};_0x2038ce[_0x3c2845['name']]={'$like':'%'+_0x3f1b00[_0xa78b('0x3a')]['filter']+'%'};return _0x2038ce;}})});}_0x429e0a=_['merge']({},_0x429e0a,_0x3f1b00[_0xa78b('0x48')]);var _0x418106={'where':_0x429e0a[_0xa78b('0x44')]};return db[_0xa78b('0x34')][_0xa78b('0x25')](_0x418106)[_0xa78b('0x2d')](function(_0x3f7fd0){_0x23d454[_0xa78b('0x25')]=_0x3f7fd0;if(_0x3f1b00['query'][_0xa78b('0x49')]){_0x429e0a[_0xa78b('0x4a')]=[{'all':!![]}];}return db[_0xa78b('0x34')]['findAll'](_0x429e0a);})[_0xa78b('0x2d')](function(_0x48ac3c){_0x23d454[_0xa78b('0x4b')]=_0x48ac3c;return _0x23d454;})[_0xa78b('0x2d')](respondWithFilteredResult(_0x238811,_0x429e0a))['catch'](handleError(_0x238811,null));};exports['show']=function(_0x533ab8,_0xa64111){var _0x5a37c7={'raw':![],'where':{'id':_0x533ab8[_0xa78b('0x4c')]['id']}},_0x308e59={};_0x308e59[_0xa78b('0x39')]=_[_0xa78b('0x3b')](db[_0xa78b('0x34')]['rawAttributes']);_0x308e59[_0xa78b('0x3a')]=_[_0xa78b('0x3b')](_0x533ab8[_0xa78b('0x3a')]);_0x308e59[_0xa78b('0x3c')]=_[_0xa78b('0x3d')](_0x308e59['model'],_0x308e59[_0xa78b('0x3a')]);_0x5a37c7[_0xa78b('0x3e')]=_[_0xa78b('0x3d')](_0x308e59['model'],qs['fields'](_0x533ab8[_0xa78b('0x3a')][_0xa78b('0x3f')]));_0x5a37c7['attributes']=_0x5a37c7[_0xa78b('0x3e')][_0xa78b('0x40')]?_0x5a37c7[_0xa78b('0x3e')]:_0x308e59['model'];if(_0x533ab8['query'][_0xa78b('0x49')]){_0x5a37c7[_0xa78b('0x4a')]=[{'all':!![]}];}_0x5a37c7=_[_0xa78b('0x46')]({},_0x5a37c7,_0x533ab8[_0xa78b('0x48')]);return db[_0xa78b('0x34')][_0xa78b('0x4d')](_0x5a37c7)[_0xa78b('0x2d')](handleEntityNotFound(_0xa64111,null))['then'](respondWithResult(_0xa64111,null))[_0xa78b('0x4e')](handleError(_0xa64111,null));};exports['create']=function(_0x2736e3,_0x247a24){return db[_0xa78b('0x34')][_0xa78b('0x4f')](_0x2736e3[_0xa78b('0x50')],{})[_0xa78b('0x2d')](respondWithResult(_0x247a24,0xc9))[_0xa78b('0x4e')](handleError(_0x247a24,null));};exports[_0xa78b('0x2c')]=function(_0x6f0fcd,_0x4bf53b){if(_0x6f0fcd[_0xa78b('0x50')]['id']){delete _0x6f0fcd[_0xa78b('0x50')]['id'];}return db[_0xa78b('0x34')]['find']({'where':{'id':_0x6f0fcd[_0xa78b('0x4c')]['id']}})[_0xa78b('0x2d')](handleEntityNotFound(_0x4bf53b,null))[_0xa78b('0x2d')](saveUpdates(_0x6f0fcd['body'],null))[_0xa78b('0x2d')](respondWithResult(_0x4bf53b,null))[_0xa78b('0x4e')](handleError(_0x4bf53b,null));};exports['destroy']=function(_0xc185b,_0x327588){return db[_0xa78b('0x34')]['find']({'where':{'id':_0xc185b[_0xa78b('0x4c')]['id']}})[_0xa78b('0x2d')](handleEntityNotFound(_0x327588,null))['then'](removeEntity(_0x327588,null))[_0xa78b('0x4e')](handleError(_0x327588,null));};exports[_0xa78b('0x51')]=function(_0x31f8a1,_0x15021f,_0x3ae3e2){var _0x481c69={};var _0x1a66f={};var _0x3e74c6;var _0x45da8a;return db['FreshsalesAccount']['findOne']({'where':{'id':_0x31f8a1[_0xa78b('0x4c')]['id']}})['then'](handleEntityNotFound(_0x15021f,null))[_0xa78b('0x2d')](function(_0x3edfb6){if(_0x3edfb6){_0x3e74c6=_0x3edfb6;_0x1a66f[_0xa78b('0x39')]=_[_0xa78b('0x3b')](db['FreshsalesConfiguration'][_0xa78b('0x35')]);_0x1a66f[_0xa78b('0x3a')]=_[_0xa78b('0x3b')](_0x31f8a1[_0xa78b('0x3a')]);_0x1a66f['filters']=_['intersection'](_0x1a66f[_0xa78b('0x39')],_0x1a66f[_0xa78b('0x3a')]);_0x481c69[_0xa78b('0x3e')]=_[_0xa78b('0x3d')](_0x1a66f[_0xa78b('0x39')],qs[_0xa78b('0x3f')](_0x31f8a1[_0xa78b('0x3a')][_0xa78b('0x3f')]));_0x481c69['attributes']=_0x481c69[_0xa78b('0x3e')][_0xa78b('0x40')]?_0x481c69[_0xa78b('0x3e')]:_0x1a66f[_0xa78b('0x39')];_0x481c69[_0xa78b('0x42')]=qs['sort'](_0x31f8a1['query'][_0xa78b('0x43')]);_0x481c69[_0xa78b('0x44')]=qs['filters'](_[_0xa78b('0x52')](_0x31f8a1[_0xa78b('0x3a')],_0x1a66f[_0xa78b('0x3c')]));if(_0x31f8a1[_0xa78b('0x3a')][_0xa78b('0x45')]){_0x481c69[_0xa78b('0x44')]=_[_0xa78b('0x46')](_0x481c69['where'],{'$or':_[_0xa78b('0x33')](_0x481c69[_0xa78b('0x3e')],function(_0xeb73bc){var _0xdda11c={};_0xdda11c[_0xeb73bc]={'$like':'%'+_0x31f8a1[_0xa78b('0x3a')][_0xa78b('0x45')]+'%'};return _0xdda11c;})});}_0x481c69=_['merge']({},_0x481c69,_0x31f8a1[_0xa78b('0x48')]);return _0x3e74c6[_0xa78b('0x51')](_0x481c69);}})['then'](function(_0xe2a8b7){if(_0xe2a8b7){_0x45da8a=_0xe2a8b7['length'];if(!_0x31f8a1[_0xa78b('0x3a')][_0xa78b('0x53')](_0xa78b('0x41'))){_0x481c69[_0xa78b('0x27')]=qs[_0xa78b('0x27')](_0x31f8a1['query']['limit']);_0x481c69[_0xa78b('0x26')]=qs[_0xa78b('0x26')](_0x31f8a1[_0xa78b('0x3a')][_0xa78b('0x26')]);}return _0x3e74c6[_0xa78b('0x51')](_0x481c69);}})[_0xa78b('0x2d')](function(_0x4e446d){if(_0x4e446d){return _0x4e446d?{'count':_0x45da8a,'rows':_0x4e446d}:null;}})[_0xa78b('0x2d')](respondWithResult(_0x15021f,null))['catch'](handleError(_0x15021f,null));};exports['addConfiguration']=function(_0x5ad3af,_0x39ee47,_0x2dae84){if(_0x5ad3af[_0xa78b('0x50')]['id']){delete _0x5ad3af[_0xa78b('0x50')]['id'];}return db['FreshsalesAccount'][_0xa78b('0x54')]({'where':{'id':_0x5ad3af[_0xa78b('0x4c')]['id']}})[_0xa78b('0x2d')](handleEntityNotFound(_0x39ee47,null))[_0xa78b('0x2d')](function(_0x909a44){if(_0x909a44){_0x5ad3af[_0xa78b('0x50')]['AccountId']=_0x909a44['id'];_0x5ad3af[_0xa78b('0x50')]['Subjects']=integrations[_0xa78b('0x55')](_0x5ad3af[_0xa78b('0x50')][_0xa78b('0x56')],_0x5ad3af[_0xa78b('0x50')][_0xa78b('0x37')]);_0x5ad3af['body']['Descriptions']=integrations['getDescriptions'](_0x5ad3af[_0xa78b('0x50')][_0xa78b('0x56')],_0x5ad3af['body'][_0xa78b('0x37')]);return db['FreshsalesConfiguration']['create'](_0x5ad3af[_0xa78b('0x50')],{'include':[{'model':db[_0xa78b('0x57')],'as':_0xa78b('0x58')},{'model':db['FreshsalesField'],'as':_0xa78b('0x59')}]});}return null;})[_0xa78b('0x2d')](respondWithResult(_0x39ee47,null))[_0xa78b('0x4e')](handleError(_0x39ee47,null));};exports['getFields']=function(_0x24fb05,_0x22affd,_0x3cbe9e){var _0x5b2fb7='';var _0x302375='';return db[_0xa78b('0x34')][_0xa78b('0x54')]({'where':{'id':_0x24fb05[_0xa78b('0x4c')]['id']},'attributes':['id',_0xa78b('0x5a'),_0xa78b('0x5b'),_0xa78b('0x5c')]})[_0xa78b('0x2d')](handleEntityNotFound(_0x22affd,null))[_0xa78b('0x2d')](function(_0x55e7cd){if(_0x55e7cd){_0x302375=_0x55e7cd[_0xa78b('0x5a')];_0x5b2fb7=_0x55e7cd[_0xa78b('0x5b')];var _0x466a11=_0x55e7cd[_0xa78b('0x5b')][_0xa78b('0x5d')](-0x1);if(_0x466a11==='/'){_0x5b2fb7=_0x5b2fb7[_0xa78b('0x5e')](0x0,_0x5b2fb7[_0xa78b('0x5f')](_0x466a11));}return rp({'method':_0xa78b('0x60'),'uri':util[_0xa78b('0x61')](_0xa78b('0x62'),_0x5b2fb7,_0xa78b('0x63')),'headers':{'Authorization':_0xa78b('0x64')+_0x55e7cd[_0xa78b('0x5c')]},'json':!![]});}})[_0xa78b('0x2d')](function(_0x2bfae0){if(_0x2bfae0){var _0x1411b4=_0x2bfae0['users'];var _0x4e4773=![];var _0x55d1c1=null;for(_0x55d1c1=0x0;_0x55d1c1<_0x1411b4[_0xa78b('0x40')];_0x55d1c1++){if(_0x1411b4[_0x55d1c1][_0xa78b('0x65')]===_0x302375){_0x4e4773=!![];}}if(_0x4e4773){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xa78b('0x66')});}}})[_0xa78b('0x2d')](respondWithResult(_0x22affd,null))[_0xa78b('0x4e')](function(_0x32871c){var _0x186b3a=_0x24fb05[_0xa78b('0x3a')][_0xa78b('0x15')]?0x1f4:_0x32871c[_0xa78b('0x67')]||0x1f4;logger[_0xa78b('0x1d')](_0xa78b('0x68'),_0xa78b('0x69'),_0x186b3a,JSON['stringify'](_0x32871c));delete _0x32871c['name'];if(_0x186b3a===0x191){_0x186b3a=0x190;}_0x22affd[_0xa78b('0x22')](_0x186b3a)[_0xa78b('0x31')](_0x24fb05['query'][_0xa78b('0x15')]?{'message':_0xa78b('0x6a'),'statusCode':_0x32871c[_0xa78b('0x67')]}:_0x32871c);});}; \ No newline at end of file +var _0xf513=['rows','catch','show','params','keys','merge','options','find','create','destroy','getConfigurations','findOne','pick','filter','addConfiguration','body','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshsalesField','Descriptions','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','email','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../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~!@#$%^&-_=+[{]}.','info','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','status','end','json','offset','Content-Range','apply','reject','save','update','then','sendStatus','name','send','rawAttributes','fieldName','type','key','model','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','where','map','VIRTUAL','count','includeAll','include','FreshsalesAccount','findAll'];(function(_0xe593fe,_0x587956){var _0x49fe42=function(_0x5eb9fe){while(--_0x5eb9fe){_0xe593fe['push'](_0xe593fe['shift']());}};_0x49fe42(++_0x587956);}(_0xf513,0x109));var _0x3f51=function(_0x2807e5,_0x546ac7){_0x2807e5=_0x2807e5-0x0;var _0xa79a26=_0xf513[_0x2807e5];return _0xa79a26;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3f51('0x0'));var zipdir=require(_0x3f51('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3f51('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3f51('0x3'));var util=require(_0x3f51('0x4'));var path=require(_0x3f51('0x5'));var sox=require(_0x3f51('0x6'));var csv=require(_0x3f51('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3f51('0x8'));var squel=require(_0x3f51('0x9'));var crypto=require(_0x3f51('0xa'));var jsforce=require(_0x3f51('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x3f51('0x7'));var querystring=require(_0x3f51('0xc'));var Papa=require(_0x3f51('0xd'));var Redis=require(_0x3f51('0xe'));var authService=require(_0x3f51('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3f51('0x10'))(_0x3f51('0x11'));var utils=require(_0x3f51('0x12'));var config=require(_0x3f51('0x13'));var db=require(_0x3f51('0x14'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x3f51('0x15'));var client=jayson[_0x3f51('0x16')][_0x3f51('0x17')]({'port':0x232a});function checkPasswordPattern(_0x24a556,_0x5e23ce,_0x905f25){if(_0x905f25){var _0x5ef30a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5ef30a[_0x3f51('0x18')](_0x5e23ce)){return _0x24a556;}else{throw new db[(_0x3f51('0x19'))][(_0x3f51('0x1a'))](_0x3f51('0x1b'));}}else{return _0x24a556;}}function respondWithRpcPromise(_0x2536dd,_0x42b650,_0x32e771,_0x4b8d4f){return new BPromise(function(_0x45ec9f,_0x464d74){var _0x4f0a=_0x4b8d4f||client;return _0x4f0a['request'](_0x2536dd,_0x32e771)['then'](function(_0x2d6a6b){logger[_0x3f51('0x1c')]('FreshsalesAccount,\x20%s,\x20%s',_0x42b650,_0x3f51('0x1d'));logger[_0x3f51('0x1e')](_0x3f51('0x1f'),_0x42b650,_0x3f51('0x1d'),JSON[_0x3f51('0x20')](_0x2d6a6b));if(_0x2d6a6b['error']){if(_0x2d6a6b[_0x3f51('0x21')][_0x3f51('0x22')]===0x1f4){logger[_0x3f51('0x21')](_0x3f51('0x23'),_0x42b650,_0x2d6a6b[_0x3f51('0x21')][_0x3f51('0x24')]);return _0x464d74(_0x2d6a6b[_0x3f51('0x21')][_0x3f51('0x24')]);}logger['error'](_0x3f51('0x23'),_0x42b650,_0x2d6a6b[_0x3f51('0x21')]['message']);return _0x45ec9f(_0x2d6a6b['error'][_0x3f51('0x24')]);}else{logger[_0x3f51('0x1c')]('FreshsalesAccount,\x20%s,\x20%s',_0x42b650,_0x3f51('0x1d'));_0x45ec9f(_0x2d6a6b['result'][_0x3f51('0x24')]);}})['catch'](function(_0x1f4224){logger[_0x3f51('0x21')](_0x3f51('0x23'),_0x42b650,_0x1f4224);_0x464d74(_0x1f4224);});});}function respondWithStatusCode(_0xbe09d8,_0xdf73f1){_0xdf73f1=_0xdf73f1||0xcc;return function(_0x2f4eae){if(_0x2f4eae){return _0xbe09d8['sendStatus'](_0xdf73f1);}return _0xbe09d8[_0x3f51('0x25')](_0xdf73f1)[_0x3f51('0x26')]();};}function respondWithResult(_0x4d99fe,_0x20da02){_0x20da02=_0x20da02||0xc8;return function(_0x226ca4){if(_0x226ca4){return _0x4d99fe['status'](_0x20da02)[_0x3f51('0x27')](_0x226ca4);}};}function respondWithFilteredResult(_0x40c0cb,_0x370b22){return function(_0xd7611){if(_0xd7611){var _0x1d0bb2=_0xd7611['count'],_0x52fb47=_0x370b22['offset'],_0x314089=_0x370b22[_0x3f51('0x28')]+_0x370b22['limit'],_0x30a151;if(_0x314089>=_0x1d0bb2){_0x314089=_0x1d0bb2;_0x30a151=0xc8;}else{_0x30a151=0xce;}_0x40c0cb[_0x3f51('0x25')](_0x30a151);return _0x40c0cb['set'](_0x3f51('0x29'),_0x52fb47+'-'+_0x314089+'/'+_0x1d0bb2)[_0x3f51('0x27')](_0xd7611);}return null;};}function patchUpdates(_0x9d5f2){return function(_0x4bc431){try{jsonpatch[_0x3f51('0x2a')](_0x4bc431,_0x9d5f2,!![]);}catch(_0x431262){return BPromise[_0x3f51('0x2b')](_0x431262);}return _0x4bc431[_0x3f51('0x2c')]();};}function saveUpdates(_0x4c72bd,_0x2f4359){return function(_0x3fa37e){if(_0x3fa37e){return _0x3fa37e[_0x3f51('0x2d')](_0x4c72bd)[_0x3f51('0x2e')](function(_0x29fee3){return _0x29fee3;});}return null;};}function removeEntity(_0x3433c0,_0x3bccf0){return function(_0x486f39){if(_0x486f39){return _0x486f39['destroy']()[_0x3f51('0x2e')](function(){_0x3433c0[_0x3f51('0x25')](0xcc)[_0x3f51('0x26')]();});}};}function handleEntityNotFound(_0xf82638,_0x186563){return function(_0x49c3aa){if(!_0x49c3aa){_0xf82638[_0x3f51('0x2f')](0x194);}return _0x49c3aa;};}function handleError(_0x53db17,_0x22299a){_0x22299a=_0x22299a||0x1f4;return function(_0x222bc0){logger[_0x3f51('0x21')](_0x222bc0['stack']);if(_0x222bc0[_0x3f51('0x30')]){delete _0x222bc0[_0x3f51('0x30')];}_0x53db17[_0x3f51('0x25')](_0x22299a)[_0x3f51('0x31')](_0x222bc0);};}exports['index']=function(_0x56eae5,_0x6583b8){var _0x1acbc6={},_0x174e8b={},_0x2d6a2b={'count':0x0,'rows':[]};var _0x1f5dbb=_['map'](db['FreshsalesAccount'][_0x3f51('0x32')],function(_0x14f9f9){return{'name':_0x14f9f9[_0x3f51('0x33')],'type':_0x14f9f9[_0x3f51('0x34')][_0x3f51('0x35')]};});_0x174e8b[_0x3f51('0x36')]=_['map'](_0x1f5dbb,_0x3f51('0x30'));_0x174e8b['query']=_['keys'](_0x56eae5['query']);_0x174e8b['filters']=_[_0x3f51('0x37')](_0x174e8b[_0x3f51('0x36')],_0x174e8b[_0x3f51('0x38')]);_0x1acbc6[_0x3f51('0x39')]=_[_0x3f51('0x37')](_0x174e8b[_0x3f51('0x36')],qs[_0x3f51('0x3a')](_0x56eae5['query'][_0x3f51('0x3a')]));_0x1acbc6[_0x3f51('0x39')]=_0x1acbc6['attributes'][_0x3f51('0x3b')]?_0x1acbc6['attributes']:_0x174e8b[_0x3f51('0x36')];if(!_0x56eae5[_0x3f51('0x38')][_0x3f51('0x3c')](_0x3f51('0x3d'))){_0x1acbc6[_0x3f51('0x3e')]=qs[_0x3f51('0x3e')](_0x56eae5[_0x3f51('0x38')][_0x3f51('0x3e')]);_0x1acbc6[_0x3f51('0x28')]=qs[_0x3f51('0x28')](_0x56eae5[_0x3f51('0x38')][_0x3f51('0x28')]);}_0x1acbc6[_0x3f51('0x3f')]=qs[_0x3f51('0x40')](_0x56eae5['query']['sort']);_0x1acbc6['where']=qs[_0x3f51('0x41')](_['pick'](_0x56eae5['query'],_0x174e8b[_0x3f51('0x41')]),_0x1f5dbb);if(_0x56eae5[_0x3f51('0x38')]['filter']){_0x1acbc6[_0x3f51('0x42')]=_['merge'](_0x1acbc6[_0x3f51('0x42')],{'$or':_[_0x3f51('0x43')](_0x1f5dbb,function(_0x4342c9){if(_0x4342c9['type']!==_0x3f51('0x44')){var _0x5e08d5={};_0x5e08d5[_0x4342c9[_0x3f51('0x30')]]={'$like':'%'+_0x56eae5[_0x3f51('0x38')]['filter']+'%'};return _0x5e08d5;}})});}_0x1acbc6=_['merge']({},_0x1acbc6,_0x56eae5['options']);var _0x532e8e={'where':_0x1acbc6[_0x3f51('0x42')]};return db['FreshsalesAccount']['count'](_0x532e8e)[_0x3f51('0x2e')](function(_0x47af1d){_0x2d6a2b[_0x3f51('0x45')]=_0x47af1d;if(_0x56eae5[_0x3f51('0x38')][_0x3f51('0x46')]){_0x1acbc6[_0x3f51('0x47')]=[{'all':!![]}];}return db[_0x3f51('0x48')][_0x3f51('0x49')](_0x1acbc6);})[_0x3f51('0x2e')](function(_0x5679fc){_0x2d6a2b[_0x3f51('0x4a')]=_0x5679fc;return _0x2d6a2b;})[_0x3f51('0x2e')](respondWithFilteredResult(_0x6583b8,_0x1acbc6))[_0x3f51('0x4b')](handleError(_0x6583b8,null));};exports[_0x3f51('0x4c')]=function(_0x3d0bd4,_0x1a74ba){var _0xd4c44e={'raw':![],'where':{'id':_0x3d0bd4[_0x3f51('0x4d')]['id']}},_0xbd552b={};_0xbd552b[_0x3f51('0x36')]=_[_0x3f51('0x4e')](db[_0x3f51('0x48')][_0x3f51('0x32')]);_0xbd552b[_0x3f51('0x38')]=_[_0x3f51('0x4e')](_0x3d0bd4['query']);_0xbd552b[_0x3f51('0x41')]=_[_0x3f51('0x37')](_0xbd552b[_0x3f51('0x36')],_0xbd552b[_0x3f51('0x38')]);_0xd4c44e[_0x3f51('0x39')]=_['intersection'](_0xbd552b['model'],qs['fields'](_0x3d0bd4[_0x3f51('0x38')][_0x3f51('0x3a')]));_0xd4c44e['attributes']=_0xd4c44e[_0x3f51('0x39')]['length']?_0xd4c44e[_0x3f51('0x39')]:_0xbd552b[_0x3f51('0x36')];if(_0x3d0bd4['query'][_0x3f51('0x46')]){_0xd4c44e['include']=[{'all':!![]}];}_0xd4c44e=_[_0x3f51('0x4f')]({},_0xd4c44e,_0x3d0bd4[_0x3f51('0x50')]);return db[_0x3f51('0x48')][_0x3f51('0x51')](_0xd4c44e)[_0x3f51('0x2e')](handleEntityNotFound(_0x1a74ba,null))[_0x3f51('0x2e')](respondWithResult(_0x1a74ba,null))[_0x3f51('0x4b')](handleError(_0x1a74ba,null));};exports[_0x3f51('0x52')]=function(_0x3ab3ff,_0x5dd84a){return db[_0x3f51('0x48')]['create'](_0x3ab3ff['body'],{})[_0x3f51('0x2e')](respondWithResult(_0x5dd84a,0xc9))['catch'](handleError(_0x5dd84a,null));};exports['update']=function(_0x13e87f,_0x4375ff){if(_0x13e87f['body']['id']){delete _0x13e87f['body']['id'];}return db[_0x3f51('0x48')][_0x3f51('0x51')]({'where':{'id':_0x13e87f[_0x3f51('0x4d')]['id']}})[_0x3f51('0x2e')](handleEntityNotFound(_0x4375ff,null))[_0x3f51('0x2e')](saveUpdates(_0x13e87f['body'],null))[_0x3f51('0x2e')](respondWithResult(_0x4375ff,null))[_0x3f51('0x4b')](handleError(_0x4375ff,null));};exports[_0x3f51('0x53')]=function(_0x6b0407,_0x407c24){return db[_0x3f51('0x48')][_0x3f51('0x51')]({'where':{'id':_0x6b0407[_0x3f51('0x4d')]['id']}})[_0x3f51('0x2e')](handleEntityNotFound(_0x407c24,null))[_0x3f51('0x2e')](removeEntity(_0x407c24,null))[_0x3f51('0x4b')](handleError(_0x407c24,null));};exports[_0x3f51('0x54')]=function(_0xea93e,_0x1f5338,_0x1fc78b){var _0x29f407={};var _0x592a97={};var _0x326d01;var _0x51c591;return db['FreshsalesAccount'][_0x3f51('0x55')]({'where':{'id':_0xea93e[_0x3f51('0x4d')]['id']}})[_0x3f51('0x2e')](handleEntityNotFound(_0x1f5338,null))[_0x3f51('0x2e')](function(_0x13ab19){if(_0x13ab19){_0x326d01=_0x13ab19;_0x592a97[_0x3f51('0x36')]=_['keys'](db['FreshsalesConfiguration'][_0x3f51('0x32')]);_0x592a97[_0x3f51('0x38')]=_[_0x3f51('0x4e')](_0xea93e['query']);_0x592a97['filters']=_[_0x3f51('0x37')](_0x592a97[_0x3f51('0x36')],_0x592a97['query']);_0x29f407[_0x3f51('0x39')]=_['intersection'](_0x592a97[_0x3f51('0x36')],qs[_0x3f51('0x3a')](_0xea93e['query']['fields']));_0x29f407['attributes']=_0x29f407[_0x3f51('0x39')][_0x3f51('0x3b')]?_0x29f407[_0x3f51('0x39')]:_0x592a97[_0x3f51('0x36')];_0x29f407[_0x3f51('0x3f')]=qs[_0x3f51('0x40')](_0xea93e[_0x3f51('0x38')][_0x3f51('0x40')]);_0x29f407[_0x3f51('0x42')]=qs[_0x3f51('0x41')](_[_0x3f51('0x56')](_0xea93e[_0x3f51('0x38')],_0x592a97['filters']));if(_0xea93e[_0x3f51('0x38')][_0x3f51('0x57')]){_0x29f407[_0x3f51('0x42')]=_['merge'](_0x29f407[_0x3f51('0x42')],{'$or':_[_0x3f51('0x43')](_0x29f407[_0x3f51('0x39')],function(_0x12bb30){var _0x9c61c1={};_0x9c61c1[_0x12bb30]={'$like':'%'+_0xea93e[_0x3f51('0x38')][_0x3f51('0x57')]+'%'};return _0x9c61c1;})});}_0x29f407=_[_0x3f51('0x4f')]({},_0x29f407,_0xea93e['options']);return _0x326d01[_0x3f51('0x54')](_0x29f407);}})['then'](function(_0x16ffa0){if(_0x16ffa0){_0x51c591=_0x16ffa0[_0x3f51('0x3b')];if(!_0xea93e['query'][_0x3f51('0x3c')](_0x3f51('0x3d'))){_0x29f407[_0x3f51('0x3e')]=qs[_0x3f51('0x3e')](_0xea93e[_0x3f51('0x38')][_0x3f51('0x3e')]);_0x29f407[_0x3f51('0x28')]=qs['offset'](_0xea93e[_0x3f51('0x38')][_0x3f51('0x28')]);}return _0x326d01['getConfigurations'](_0x29f407);}})[_0x3f51('0x2e')](function(_0x5bdafd){if(_0x5bdafd){return _0x5bdafd?{'count':_0x51c591,'rows':_0x5bdafd}:null;}})[_0x3f51('0x2e')](respondWithResult(_0x1f5338,null))[_0x3f51('0x4b')](handleError(_0x1f5338,null));};exports[_0x3f51('0x58')]=function(_0x2346f1,_0x5aaf4f,_0x3216b3){if(_0x2346f1[_0x3f51('0x59')]['id']){delete _0x2346f1[_0x3f51('0x59')]['id'];}return db['FreshsalesAccount'][_0x3f51('0x55')]({'where':{'id':_0x2346f1[_0x3f51('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5aaf4f,null))['then'](function(_0x40616b){if(_0x40616b){_0x2346f1['body'][_0x3f51('0x5a')]=_0x40616b['id'];_0x2346f1['body'][_0x3f51('0x5b')]=integrations[_0x3f51('0x5c')](_0x2346f1[_0x3f51('0x59')][_0x3f51('0x5d')],_0x2346f1['body'][_0x3f51('0x34')]);_0x2346f1[_0x3f51('0x59')]['Descriptions']=integrations[_0x3f51('0x5e')](_0x2346f1['body'][_0x3f51('0x5d')],_0x2346f1['body'][_0x3f51('0x34')]);return db['FreshsalesConfiguration'][_0x3f51('0x52')](_0x2346f1[_0x3f51('0x59')],{'include':[{'model':db[_0x3f51('0x5f')],'as':_0x3f51('0x5b')},{'model':db['FreshsalesField'],'as':_0x3f51('0x60')}]});}return null;})['then'](respondWithResult(_0x5aaf4f,null))[_0x3f51('0x4b')](handleError(_0x5aaf4f,null));};exports[_0x3f51('0x61')]=function(_0x677899,_0x5355d8,_0x4a11e7){var _0x5b2d1e='';var _0x183fe8='';return db['FreshsalesAccount']['findOne']({'where':{'id':_0x677899[_0x3f51('0x4d')]['id']},'attributes':['id',_0x3f51('0x62'),_0x3f51('0x63'),_0x3f51('0x64')]})[_0x3f51('0x2e')](handleEntityNotFound(_0x5355d8,null))[_0x3f51('0x2e')](function(_0xbc024c){if(_0xbc024c){_0x183fe8=_0xbc024c['username'];_0x5b2d1e=_0xbc024c[_0x3f51('0x63')];var _0x485cd2=_0xbc024c[_0x3f51('0x63')][_0x3f51('0x65')](-0x1);if(_0x485cd2==='/'){_0x5b2d1e=_0x5b2d1e[_0x3f51('0x66')](0x0,_0x5b2d1e[_0x3f51('0x67')](_0x485cd2));}return rp({'method':_0x3f51('0x68'),'uri':util[_0x3f51('0x69')](_0x3f51('0x6a'),_0x5b2d1e,_0x3f51('0x6b')),'headers':{'Authorization':_0x3f51('0x6c')+_0xbc024c[_0x3f51('0x64')]},'json':!![]});}})['then'](function(_0x8197f5){if(_0x8197f5){var _0x57fc18=_0x8197f5['users'];var _0x575ed8=![];var _0x58fe9d=null;for(_0x58fe9d=0x0;_0x58fe9d<_0x57fc18[_0x3f51('0x3b')];_0x58fe9d++){if(_0x57fc18[_0x58fe9d][_0x3f51('0x6d')]===_0x183fe8){_0x575ed8=!![];}}if(_0x575ed8){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})['then'](respondWithResult(_0x5355d8,null))['catch'](function(_0x57c116){var _0x61246e=_0x677899[_0x3f51('0x38')]['test']?0x1f4:_0x57c116[_0x3f51('0x6e')]||0x1f4;logger['error'](_0x3f51('0x6f'),'getFields',_0x61246e,JSON['stringify'](_0x57c116));delete _0x57c116[_0x3f51('0x30')];if(_0x61246e===0x191){_0x61246e=0x190;}_0x5355d8[_0x3f51('0x25')](_0x61246e)[_0x3f51('0x31')](_0x677899['query'][_0x3f51('0x18')]?{'message':_0x3f51('0x70'),'statusCode':_0x57c116[_0x3f51('0x6e')]}:_0x57c116);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index a8b257e..87a2b70 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 _0xf9fd=['rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','int_freshsales_accounts','util','../../config/logger','api','moment','path'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xf9fd,0x14f));var _0xdf9f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf9fd[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xdf9f('0x0'));var logger=require(_0xdf9f('0x1'))(_0xdf9f('0x2'));var moment=require(_0xdf9f('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf9f('0x4'));var rimraf=require(_0xdf9f('0x5'));var config=require(_0xdf9f('0x6'));var attributes=require(_0xdf9f('0x7'));var integrations=require(_0xdf9f('0x8'));module['exports']=function(_0x4734df,_0x41d712){return _0x4734df['define']('FreshsalesAccount',attributes,{'tableName':_0xdf9f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5edd=['exports','define','FreshsalesAccount','util','../../config/logger','moment','bluebird','path','rimraf','./intFreshsalesAccount.attributes'];(function(_0x47501e,_0x35623b){var _0x5713df=function(_0x40745f){while(--_0x40745f){_0x47501e['push'](_0x47501e['shift']());}};_0x5713df(++_0x35623b);}(_0x5edd,0xf3));var _0xd5ed=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x5edd[_0xa148b7];return _0x51efd3;};'use strict';var _=require('lodash');var util=require(_0xd5ed('0x0'));var logger=require(_0xd5ed('0x1'))('api');var moment=require(_0xd5ed('0x2'));var BPromise=require(_0xd5ed('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd5ed('0x4'));var rimraf=require(_0xd5ed('0x5'));var config=require('../../config/environment');var attributes=require(_0xd5ed('0x6'));var integrations=require('../../components/integrations/configuration');module[_0xd5ed('0x7')]=function(_0x41b3eb,_0x3a91d8){return _0x41b3eb[_0xd5ed('0x8')](_0xd5ed('0x9'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 5cffd76..29eeb1a 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 _0x8f25=['find','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFreshsalesAccount','findAll','options','raw','include','map','model','attributes','ShowFreshsalesAccount','FreshsalesAccount'];(function(_0x4ca485,_0xdd7c1d){var _0x31d7a8=function(_0xf2029){while(--_0xf2029){_0x4ca485['push'](_0x4ca485['shift']());}};_0x31d7a8(++_0xdd7c1d);}(_0x8f25,0x14b));var _0x58f2=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x8f25[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x58f2('0x0'));var util=require(_0x58f2('0x1'));var moment=require(_0x58f2('0x2'));var BPromise=require(_0x58f2('0x3'));var rs=require(_0x58f2('0x4'));var fs=require('fs');var Redis=require(_0x58f2('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x58f2('0x6'));var config=require(_0x58f2('0x7'));var jayson=require(_0x58f2('0x8'));var client=jayson['client'][_0x58f2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26f94f,_0x3d5efe,_0x107b61){return new BPromise(function(_0xf47f9,_0x1209e2){return client[_0x58f2('0xa')](_0x26f94f,_0x107b61)[_0x58f2('0xb')](function(_0x4b56c1){logger[_0x58f2('0xc')](_0x58f2('0xd'),_0x3d5efe,_0x58f2('0xe'));logger[_0x58f2('0xf')](_0x58f2('0x10'),_0x3d5efe,'request\x20sent',JSON[_0x58f2('0x11')](_0x4b56c1));if(_0x4b56c1[_0x58f2('0x12')]){if(_0x4b56c1[_0x58f2('0x12')]['code']===0x1f4){logger[_0x58f2('0x12')](_0x58f2('0xd'),_0x3d5efe,_0x4b56c1['error'][_0x58f2('0x13')]);return _0x1209e2(_0x4b56c1[_0x58f2('0x12')]['message']);}logger[_0x58f2('0x12')](_0x58f2('0xd'),_0x3d5efe,_0x4b56c1[_0x58f2('0x12')][_0x58f2('0x13')]);return _0xf47f9(_0x4b56c1[_0x58f2('0x12')][_0x58f2('0x13')]);}else{logger[_0x58f2('0xc')](_0x58f2('0xd'),_0x3d5efe,_0x58f2('0xe'));_0xf47f9(_0x4b56c1[_0x58f2('0x14')][_0x58f2('0x13')]);}})[_0x58f2('0x15')](function(_0x4af52c){logger[_0x58f2('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x3d5efe,_0x4af52c);_0x1209e2(_0x4af52c);});});}exports[_0x58f2('0x16')]=function(_0x1db4ad){var _0x4e66a4=this;return new Promise(function(_0x5f0b9c,_0x5e0393){return db['FreshsalesAccount'][_0x58f2('0x17')]({'raw':_0x1db4ad[_0x58f2('0x18')]?_0x1db4ad[_0x58f2('0x18')][_0x58f2('0x19')]===undefined?!![]:![]:!![],'where':_0x1db4ad[_0x58f2('0x18')]?_0x1db4ad[_0x58f2('0x18')]['where']||null:null,'attributes':_0x1db4ad[_0x58f2('0x18')]?_0x1db4ad[_0x58f2('0x18')]['attributes']||null:null,'limit':_0x1db4ad[_0x58f2('0x18')]?_0x1db4ad[_0x58f2('0x18')]['limit']||null:null,'include':_0x1db4ad[_0x58f2('0x18')]?_0x1db4ad[_0x58f2('0x18')][_0x58f2('0x1a')]?_[_0x58f2('0x1b')](_0x1db4ad[_0x58f2('0x18')][_0x58f2('0x1a')],function(_0x2e83cf){return{'model':db[_0x2e83cf[_0x58f2('0x1c')]],'as':_0x2e83cf['as'],'attributes':_0x2e83cf[_0x58f2('0x1d')],'include':_0x2e83cf[_0x58f2('0x1a')]?_[_0x58f2('0x1b')](_0x2e83cf[_0x58f2('0x1a')],function(_0x34a2e2){return{'model':db[_0x34a2e2[_0x58f2('0x1c')]],'as':_0x34a2e2['as'],'attributes':_0x34a2e2[_0x58f2('0x1d')],'include':_0x34a2e2[_0x58f2('0x1a')]?_['map'](_0x34a2e2[_0x58f2('0x1a')],function(_0x50c4c1){return{'model':db[_0x50c4c1[_0x58f2('0x1c')]],'as':_0x50c4c1['as'],'attributes':_0x50c4c1[_0x58f2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x58f2('0xb')](function(_0x55e50a){logger[_0x58f2('0xc')](_0x58f2('0x16'),_0x1db4ad);logger[_0x58f2('0xf')]('GetFreshsalesAccount',_0x1db4ad,JSON[_0x58f2('0x11')](_0x55e50a));_0x5f0b9c(_0x55e50a);})[_0x58f2('0x15')](function(_0x4b2b78){logger[_0x58f2('0x12')](_0x58f2('0x16'),_0x4b2b78[_0x58f2('0x13')],_0x1db4ad);_0x5e0393(_0x4e66a4[_0x58f2('0x12')](0x1f4,_0x4b2b78['message']));});});};exports[_0x58f2('0x1e')]=function(_0x492db5){var _0x2633f8=this;return new Promise(function(_0x128af8,_0x8f339d){return db[_0x58f2('0x1f')][_0x58f2('0x20')]({'raw':_0x492db5[_0x58f2('0x18')]?_0x492db5['options'][_0x58f2('0x19')]===undefined?!![]:![]:!![],'where':_0x492db5[_0x58f2('0x18')]?_0x492db5[_0x58f2('0x18')]['where']||null:null,'attributes':_0x492db5[_0x58f2('0x18')]?_0x492db5[_0x58f2('0x18')]['attributes']||null:null,'include':_0x492db5[_0x58f2('0x18')]?_0x492db5[_0x58f2('0x18')][_0x58f2('0x1a')]?_[_0x58f2('0x1b')](_0x492db5[_0x58f2('0x18')]['include'],function(_0x2cd36a){return{'model':db[_0x2cd36a[_0x58f2('0x1c')]],'as':_0x2cd36a['as'],'attributes':_0x2cd36a[_0x58f2('0x1d')],'include':_0x2cd36a[_0x58f2('0x1a')]?_[_0x58f2('0x1b')](_0x2cd36a[_0x58f2('0x1a')],function(_0x3bede5){return{'model':db[_0x3bede5['model']],'as':_0x3bede5['as'],'attributes':_0x3bede5['attributes'],'include':_0x3bede5[_0x58f2('0x1a')]?_[_0x58f2('0x1b')](_0x3bede5[_0x58f2('0x1a')],function(_0x91f87c){return{'model':db[_0x91f87c['model']],'as':_0x91f87c['as'],'attributes':_0x91f87c[_0x58f2('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x595078){logger[_0x58f2('0xc')](_0x58f2('0x1e'),_0x492db5);logger['debug'](_0x58f2('0x1e'),_0x492db5,JSON[_0x58f2('0x11')](_0x595078));_0x128af8(_0x595078);})[_0x58f2('0x15')](function(_0x2a3120){logger[_0x58f2('0x12')](_0x58f2('0x1e'),_0x2a3120[_0x58f2('0x13')],_0x492db5);_0x8f339d(_0x2633f8['error'](0x1f4,_0x2a3120[_0x58f2('0x13')]));});});}; \ No newline at end of file +var _0x7b77=['FreshsalesAccount','find','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','info','result','catch','GetFreshsalesAccount','findAll','options','attributes','include','map','model','ShowFreshsalesAccount'];(function(_0x115651,_0x346e39){var _0x13878c=function(_0x5366ff){while(--_0x5366ff){_0x115651['push'](_0x115651['shift']());}};_0x13878c(++_0x346e39);}(_0x7b77,0x179));var _0x77b7=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0x7b77[_0x172747];return _0x509692;};'use strict';var _=require(_0x77b7('0x0'));var util=require(_0x77b7('0x1'));var moment=require(_0x77b7('0x2'));var BPromise=require(_0x77b7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x77b7('0x4'));var db=require(_0x77b7('0x5'))['db'];var utils=require(_0x77b7('0x6'));var logger=require('../../config/logger')(_0x77b7('0x7'));var config=require(_0x77b7('0x8'));var jayson=require(_0x77b7('0x9'));var client=jayson[_0x77b7('0xa')][_0x77b7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe3c16b,_0x5c9387,_0x39d8e4){return new BPromise(function(_0x32b8ab,_0x33d439){return client['request'](_0xe3c16b,_0x39d8e4)[_0x77b7('0xc')](function(_0x4cfd3f){logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x5c9387,_0x77b7('0xd'));logger[_0x77b7('0xe')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x5c9387,_0x77b7('0xd'),JSON[_0x77b7('0xf')](_0x4cfd3f));if(_0x4cfd3f[_0x77b7('0x10')]){if(_0x4cfd3f[_0x77b7('0x10')][_0x77b7('0x11')]===0x1f4){logger[_0x77b7('0x10')](_0x77b7('0x12'),_0x5c9387,_0x4cfd3f['error'][_0x77b7('0x13')]);return _0x33d439(_0x4cfd3f[_0x77b7('0x10')]['message']);}logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x5c9387,_0x4cfd3f[_0x77b7('0x10')][_0x77b7('0x13')]);return _0x32b8ab(_0x4cfd3f[_0x77b7('0x10')][_0x77b7('0x13')]);}else{logger[_0x77b7('0x14')](_0x77b7('0x12'),_0x5c9387,'request\x20sent');_0x32b8ab(_0x4cfd3f[_0x77b7('0x15')][_0x77b7('0x13')]);}})[_0x77b7('0x16')](function(_0x2060df){logger[_0x77b7('0x10')](_0x77b7('0x12'),_0x5c9387,_0x2060df);_0x33d439(_0x2060df);});});}exports[_0x77b7('0x17')]=function(_0x12caf0){var _0x286046=this;return new Promise(function(_0x4a0005,_0x511d88){return db['FreshsalesAccount'][_0x77b7('0x18')]({'raw':_0x12caf0['options']?_0x12caf0['options']['raw']===undefined?!![]:![]:!![],'where':_0x12caf0['options']?_0x12caf0[_0x77b7('0x19')]['where']||null:null,'attributes':_0x12caf0[_0x77b7('0x19')]?_0x12caf0['options'][_0x77b7('0x1a')]||null:null,'limit':_0x12caf0['options']?_0x12caf0[_0x77b7('0x19')]['limit']||null:null,'include':_0x12caf0[_0x77b7('0x19')]?_0x12caf0[_0x77b7('0x19')][_0x77b7('0x1b')]?_[_0x77b7('0x1c')](_0x12caf0[_0x77b7('0x19')][_0x77b7('0x1b')],function(_0x29a892){return{'model':db[_0x29a892[_0x77b7('0x1d')]],'as':_0x29a892['as'],'attributes':_0x29a892[_0x77b7('0x1a')],'include':_0x29a892[_0x77b7('0x1b')]?_[_0x77b7('0x1c')](_0x29a892[_0x77b7('0x1b')],function(_0x29c2aa){return{'model':db[_0x29c2aa[_0x77b7('0x1d')]],'as':_0x29c2aa['as'],'attributes':_0x29c2aa[_0x77b7('0x1a')],'include':_0x29c2aa[_0x77b7('0x1b')]?_[_0x77b7('0x1c')](_0x29c2aa[_0x77b7('0x1b')],function(_0x47971f){return{'model':db[_0x47971f['model']],'as':_0x47971f['as'],'attributes':_0x47971f[_0x77b7('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x77b7('0xc')](function(_0x3cae5a){logger['info'](_0x77b7('0x17'),_0x12caf0);logger[_0x77b7('0xe')](_0x77b7('0x17'),_0x12caf0,JSON[_0x77b7('0xf')](_0x3cae5a));_0x4a0005(_0x3cae5a);})[_0x77b7('0x16')](function(_0x323363){logger[_0x77b7('0x10')](_0x77b7('0x17'),_0x323363[_0x77b7('0x13')],_0x12caf0);_0x511d88(_0x286046['error'](0x1f4,_0x323363[_0x77b7('0x13')]));});});};exports[_0x77b7('0x1e')]=function(_0x23aa7e){var _0x3f21dd=this;return new Promise(function(_0x2e87e6,_0x3f63a){return db[_0x77b7('0x1f')][_0x77b7('0x20')]({'raw':_0x23aa7e[_0x77b7('0x19')]?_0x23aa7e[_0x77b7('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x23aa7e[_0x77b7('0x19')]?_0x23aa7e[_0x77b7('0x19')][_0x77b7('0x21')]||null:null,'attributes':_0x23aa7e['options']?_0x23aa7e[_0x77b7('0x19')]['attributes']||null:null,'include':_0x23aa7e[_0x77b7('0x19')]?_0x23aa7e[_0x77b7('0x19')]['include']?_[_0x77b7('0x1c')](_0x23aa7e['options'][_0x77b7('0x1b')],function(_0x27b835){return{'model':db[_0x27b835[_0x77b7('0x1d')]],'as':_0x27b835['as'],'attributes':_0x27b835['attributes'],'include':_0x27b835[_0x77b7('0x1b')]?_[_0x77b7('0x1c')](_0x27b835[_0x77b7('0x1b')],function(_0x31a1b0){return{'model':db[_0x31a1b0[_0x77b7('0x1d')]],'as':_0x31a1b0['as'],'attributes':_0x31a1b0[_0x77b7('0x1a')],'include':_0x31a1b0[_0x77b7('0x1b')]?_[_0x77b7('0x1c')](_0x31a1b0[_0x77b7('0x1b')],function(_0x2e23fb){return{'model':db[_0x2e23fb[_0x77b7('0x1d')]],'as':_0x2e23fb['as'],'attributes':_0x2e23fb[_0x77b7('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x77b7('0xc')](function(_0x4f157c){logger[_0x77b7('0x14')](_0x77b7('0x1e'),_0x23aa7e);logger[_0x77b7('0xe')]('ShowFreshsalesAccount',_0x23aa7e,JSON['stringify'](_0x4f157c));_0x2e87e6(_0x4f157c);})[_0x77b7('0x16')](function(_0x2c5c77){logger[_0x77b7('0x10')](_0x77b7('0x1e'),_0x2c5c77[_0x77b7('0x13')],_0x23aa7e);_0x3f63a(_0x3f21dd[_0x77b7('0x10')](0x1f4,_0x2c5c77[_0x77b7('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 3b8be05..7ae6fbb 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 _0x4ac1=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','/:id/subjects','getSubjects','/:id/descriptions','/:id/fields','getFields','create','put','update','delete','destroy'];(function(_0x835e03,_0x3ee527){var _0x23d63=function(_0x169ef9){while(--_0x169ef9){_0x835e03['push'](_0x835e03['shift']());}};_0x23d63(++_0x3ee527);}(_0x4ac1,0xf1));var _0x14ac=function(_0x51f9a6,_0x3bd1aa){_0x51f9a6=_0x51f9a6-0x0;var _0x59edae=_0x4ac1[_0x51f9a6];return _0x59edae;};'use strict';var multer=require(_0x14ac('0x0'));var util=require(_0x14ac('0x1'));var path=require(_0x14ac('0x2'));var timeout=require('connect-timeout');var express=require(_0x14ac('0x3'));var router=express[_0x14ac('0x4')]();var auth=require(_0x14ac('0x5'));var interaction=require(_0x14ac('0x6'));var config=require(_0x14ac('0x7'));var controller=require(_0x14ac('0x8'));router[_0x14ac('0x9')]('/',auth[_0x14ac('0xa')](),controller[_0x14ac('0xb')]);router[_0x14ac('0x9')](_0x14ac('0xc'),auth[_0x14ac('0xa')](),controller['show']);router[_0x14ac('0x9')](_0x14ac('0xd'),auth['isAuthenticated'](),controller[_0x14ac('0xe')]);router[_0x14ac('0x9')](_0x14ac('0xf'),auth[_0x14ac('0xa')](),controller['getDescriptions']);router[_0x14ac('0x9')](_0x14ac('0x10'),auth[_0x14ac('0xa')](),controller[_0x14ac('0x11')]);router['post']('/',auth[_0x14ac('0xa')](),controller[_0x14ac('0x12')]);router[_0x14ac('0x13')]('/:id',auth[_0x14ac('0xa')](),controller[_0x14ac('0x14')]);router[_0x14ac('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x14ac('0x16')]);module[_0x14ac('0x17')]=router; \ No newline at end of file +var _0x67ed=['getFields','put','update','delete','exports','util','express','Router','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/fields'];(function(_0x5389a4,_0x492cda){var _0x2e85fa=function(_0x4e4aa3){while(--_0x4e4aa3){_0x5389a4['push'](_0x5389a4['shift']());}};_0x2e85fa(++_0x492cda);}(_0x67ed,0x113));var _0xd67e=function(_0x3e9fb5,_0x2e3489){_0x3e9fb5=_0x3e9fb5-0x0;var _0x33e47b=_0x67ed[_0x3e9fb5];return _0x33e47b;};'use strict';var multer=require('multer');var util=require(_0xd67e('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd67e('0x1'));var router=express[_0xd67e('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xd67e('0x3'));var config=require('../../config/environment');var controller=require(_0xd67e('0x4'));router[_0xd67e('0x5')]('/',auth[_0xd67e('0x6')](),controller[_0xd67e('0x7')]);router[_0xd67e('0x5')](_0xd67e('0x8'),auth[_0xd67e('0x6')](),controller[_0xd67e('0x9')]);router[_0xd67e('0x5')](_0xd67e('0xa'),auth[_0xd67e('0x6')](),controller[_0xd67e('0xb')]);router[_0xd67e('0x5')]('/:id/descriptions',auth[_0xd67e('0x6')](),controller['getDescriptions']);router['get'](_0xd67e('0xc'),auth['isAuthenticated'](),controller[_0xd67e('0xd')]);router['post']('/',auth[_0xd67e('0x6')](),controller['create']);router[_0xd67e('0xe')](_0xd67e('0x8'),auth[_0xd67e('0x6')](),controller[_0xd67e('0xf')]);router[_0xd67e('0x10')](_0xd67e('0x8'),auth[_0xd67e('0x6')](),controller['destroy']);module[_0xd67e('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index fa03174..a07810b 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 _0x6cd3=['sequelize','STRING'];(function(_0x1e9424,_0x191cba){var _0x1bd96c=function(_0x5e952d){while(--_0x5e952d){_0x1e9424['push'](_0x1e9424['shift']());}};_0x1bd96c(++_0x191cba);}(_0x6cd3,0x15c));var _0x36cd=function(_0x2a0738,_0x3c0bc5){_0x2a0738=_0x2a0738-0x0;var _0x159679=_0x6cd3[_0x2a0738];return _0x159679;};'use strict';var Sequelize=require(_0x36cd('0x0'));module['exports']={'name':{'type':Sequelize[_0x36cd('0x1')]},'description':{'type':Sequelize[_0x36cd('0x1')]}}; \ No newline at end of file +var _0x8343=['exports','STRING','sequelize'];(function(_0x1f95d3,_0x22ea11){var _0x17dded=function(_0x5ea03f){while(--_0x5ea03f){_0x1f95d3['push'](_0x1f95d3['shift']());}};_0x17dded(++_0x22ea11);}(_0x8343,0x18e));var _0x3834=function(_0x24de8c,_0x17336f){_0x24de8c=_0x24de8c-0x0;var _0x4497a5=_0x8343[_0x24de8c];return _0x4497a5;};'use strict';var Sequelize=require(_0x3834('0x0'));module[_0x3834('0x1')]={'name':{'type':Sequelize[_0x3834('0x2')]},'description':{'type':Sequelize[_0x3834('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 36b7bce..a75fb0a 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 _0x04a4=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','count','offset','limit','set','Content-Range','json','reject','save','update','destroy','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filters','filter','VIRTUAL','options','include','findAll','rows','show','params','merge','create','body','find','getSubjects','findOne','FreshsalesField','order','nolimit','getDescriptions','getFields','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3dc538,_0x4f7702){var _0x72c2fd=function(_0x5a7260){while(--_0x5a7260){_0x3dc538['push'](_0x3dc538['shift']());}};_0x72c2fd(++_0x4f7702);}(_0x04a4,0x1bc));var _0x404a=function(_0xe934d0,_0x107c20){_0xe934d0=_0xe934d0-0x0;var _0x304707=_0x04a4[_0xe934d0];return _0x304707;};'use strict';var pdf=require(_0x404a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x404a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x404a('0x2'));var rp=require(_0x404a('0x3'));var moment=require(_0x404a('0x4'));var BPromise=require(_0x404a('0x5'));var Mustache=require('mustache');var util=require(_0x404a('0x6'));var path=require(_0x404a('0x7'));var sox=require(_0x404a('0x8'));var csv=require(_0x404a('0x9'));var ejs=require(_0x404a('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x404a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x404a('0xc'));var toCsv=require(_0x404a('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x404a('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x404a('0xe'));var as=require(_0x404a('0xf'));var hardwareService=require(_0x404a('0x10'));var logger=require(_0x404a('0x11'))(_0x404a('0x12'));var utils=require(_0x404a('0x13'));var config=require(_0x404a('0x14'));var db=require(_0x404a('0x15'))['db'];var jayson=require(_0x404a('0x16'));var client=jayson[_0x404a('0x17')][_0x404a('0x18')]({'port':0x232a});function checkPasswordPattern(_0x38ddb3,_0x576797,_0x5d135){if(_0x5d135){var _0x412565=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x412565['test'](_0x576797)){return _0x38ddb3;}else{throw new db[(_0x404a('0x19'))]['ValidationError'](_0x404a('0x1a'));}}else{return _0x38ddb3;}}function respondWithRpcPromise(_0x143672,_0x476e90,_0xf13f0,_0x440b7e){return new BPromise(function(_0x484587,_0x21d322){var _0x9f7c72=_0x440b7e||client;return _0x9f7c72[_0x404a('0x1b')](_0x143672,_0xf13f0)[_0x404a('0x1c')](function(_0x124317){logger[_0x404a('0x1d')](_0x404a('0x1e'),_0x476e90,_0x404a('0x1f'));logger[_0x404a('0x20')](_0x404a('0x21'),_0x476e90,_0x404a('0x1f'),JSON[_0x404a('0x22')](_0x124317));if(_0x124317['error']){if(_0x124317[_0x404a('0x23')][_0x404a('0x24')]===0x1f4){logger[_0x404a('0x23')](_0x404a('0x1e'),_0x476e90,_0x124317[_0x404a('0x23')][_0x404a('0x25')]);return _0x21d322(_0x124317[_0x404a('0x23')][_0x404a('0x25')]);}logger[_0x404a('0x23')](_0x404a('0x1e'),_0x476e90,_0x124317[_0x404a('0x23')][_0x404a('0x25')]);return _0x484587(_0x124317[_0x404a('0x23')][_0x404a('0x25')]);}else{logger[_0x404a('0x1d')](_0x404a('0x1e'),_0x476e90,_0x404a('0x1f'));_0x484587(_0x124317[_0x404a('0x26')][_0x404a('0x25')]);}})[_0x404a('0x27')](function(_0x485e68){logger[_0x404a('0x23')](_0x404a('0x1e'),_0x476e90,_0x485e68);_0x21d322(_0x485e68);});});}function respondWithStatusCode(_0x582f34,_0x52e9da){_0x52e9da=_0x52e9da||0xcc;return function(_0x4b3cbd){if(_0x4b3cbd){return _0x582f34[_0x404a('0x28')](_0x52e9da);}return _0x582f34['status'](_0x52e9da)[_0x404a('0x29')]();};}function respondWithResult(_0x597fea,_0x25f719){_0x25f719=_0x25f719||0xc8;return function(_0x1ccf79){if(_0x1ccf79){return _0x597fea[_0x404a('0x2a')](_0x25f719)['json'](_0x1ccf79);}};}function respondWithFilteredResult(_0x3e97e0,_0x2eb6e6){return function(_0xe05f66){if(_0xe05f66){var _0x6bcb93=_0xe05f66[_0x404a('0x2b')],_0x4d7036=_0x2eb6e6['offset'],_0x434a21=_0x2eb6e6[_0x404a('0x2c')]+_0x2eb6e6[_0x404a('0x2d')],_0x4005bc;if(_0x434a21>=_0x6bcb93){_0x434a21=_0x6bcb93;_0x4005bc=0xc8;}else{_0x4005bc=0xce;}_0x3e97e0[_0x404a('0x2a')](_0x4005bc);return _0x3e97e0[_0x404a('0x2e')](_0x404a('0x2f'),_0x4d7036+'-'+_0x434a21+'/'+_0x6bcb93)[_0x404a('0x30')](_0xe05f66);}return null;};}function patchUpdates(_0x53c7d4){return function(_0x297d64){try{jsonpatch['apply'](_0x297d64,_0x53c7d4,!![]);}catch(_0x5a6b55){return BPromise[_0x404a('0x31')](_0x5a6b55);}return _0x297d64[_0x404a('0x32')]();};}function saveUpdates(_0x212b8b,_0x44a4f1){return function(_0x25f3ad){if(_0x25f3ad){return _0x25f3ad[_0x404a('0x33')](_0x212b8b)[_0x404a('0x1c')](function(_0x5247f4){return _0x5247f4;});}return null;};}function removeEntity(_0x5020a3,_0x991272){return function(_0x20e263){if(_0x20e263){return _0x20e263[_0x404a('0x34')]()[_0x404a('0x1c')](function(){_0x5020a3[_0x404a('0x2a')](0xcc)[_0x404a('0x29')]();});}};}function handleEntityNotFound(_0x115bde,_0x427a55){return function(_0x76dc9b){if(!_0x76dc9b){_0x115bde['sendStatus'](0x194);}return _0x76dc9b;};}function handleError(_0x455da4,_0x12a13f){_0x12a13f=_0x12a13f||0x1f4;return function(_0x364f22){logger[_0x404a('0x23')](_0x364f22[_0x404a('0x35')]);if(_0x364f22[_0x404a('0x36')]){delete _0x364f22[_0x404a('0x36')];}_0x455da4['status'](_0x12a13f)[_0x404a('0x37')](_0x364f22);};}exports[_0x404a('0x38')]=function(_0x314d94,_0x43ddac){var _0x3a2139={},_0x2e4f32={},_0x19f17b={'count':0x0,'rows':[]};var _0x4c1e47=_[_0x404a('0x39')](db[_0x404a('0x3a')][_0x404a('0x3b')],function(_0x10708c){return{'name':_0x10708c['fieldName'],'type':_0x10708c[_0x404a('0x3c')]['key']};});_0x2e4f32[_0x404a('0x3d')]=_[_0x404a('0x39')](_0x4c1e47,_0x404a('0x36'));_0x2e4f32[_0x404a('0x3e')]=_[_0x404a('0x3f')](_0x314d94[_0x404a('0x3e')]);_0x2e4f32['filters']=_[_0x404a('0x40')](_0x2e4f32[_0x404a('0x3d')],_0x2e4f32[_0x404a('0x3e')]);_0x3a2139[_0x404a('0x41')]=_['intersection'](_0x2e4f32['model'],qs[_0x404a('0x42')](_0x314d94[_0x404a('0x3e')][_0x404a('0x42')]));_0x3a2139[_0x404a('0x41')]=_0x3a2139[_0x404a('0x41')][_0x404a('0x43')]?_0x3a2139['attributes']:_0x2e4f32[_0x404a('0x3d')];if(!_0x314d94['query'][_0x404a('0x44')]('nolimit')){_0x3a2139[_0x404a('0x2d')]=qs[_0x404a('0x2d')](_0x314d94['query'][_0x404a('0x2d')]);_0x3a2139[_0x404a('0x2c')]=qs['offset'](_0x314d94[_0x404a('0x3e')]['offset']);}_0x3a2139['order']=qs[_0x404a('0x45')](_0x314d94[_0x404a('0x3e')][_0x404a('0x45')]);_0x3a2139[_0x404a('0x46')]=qs['filters'](_[_0x404a('0x47')](_0x314d94['query'],_0x2e4f32[_0x404a('0x48')]),_0x4c1e47);if(_0x314d94[_0x404a('0x3e')][_0x404a('0x49')]){_0x3a2139[_0x404a('0x46')]=_['merge'](_0x3a2139['where'],{'$or':_['map'](_0x4c1e47,function(_0x3bf4f5){if(_0x3bf4f5['type']!==_0x404a('0x4a')){var _0x3394b5={};_0x3394b5[_0x3bf4f5['name']]={'$like':'%'+_0x314d94[_0x404a('0x3e')][_0x404a('0x49')]+'%'};return _0x3394b5;}})});}_0x3a2139=_['merge']({},_0x3a2139,_0x314d94[_0x404a('0x4b')]);var _0x319858={'where':_0x3a2139[_0x404a('0x46')]};return db[_0x404a('0x3a')][_0x404a('0x2b')](_0x319858)[_0x404a('0x1c')](function(_0x5ca51a){_0x19f17b[_0x404a('0x2b')]=_0x5ca51a;if(_0x314d94[_0x404a('0x3e')]['includeAll']){_0x3a2139[_0x404a('0x4c')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x404a('0x4d')](_0x3a2139);})[_0x404a('0x1c')](function(_0x5cdf43){_0x19f17b[_0x404a('0x4e')]=_0x5cdf43;return _0x19f17b;})[_0x404a('0x1c')](respondWithFilteredResult(_0x43ddac,_0x3a2139))['catch'](handleError(_0x43ddac,null));};exports[_0x404a('0x4f')]=function(_0x18a24c,_0x4d77b7){var _0x14ab27={'raw':![],'where':{'id':_0x18a24c[_0x404a('0x50')]['id']}},_0x578d05={};_0x578d05['model']=_['keys'](db[_0x404a('0x3a')]['rawAttributes']);_0x578d05[_0x404a('0x3e')]=_['keys'](_0x18a24c[_0x404a('0x3e')]);_0x578d05[_0x404a('0x48')]=_[_0x404a('0x40')](_0x578d05[_0x404a('0x3d')],_0x578d05['query']);_0x14ab27[_0x404a('0x41')]=_[_0x404a('0x40')](_0x578d05[_0x404a('0x3d')],qs[_0x404a('0x42')](_0x18a24c[_0x404a('0x3e')][_0x404a('0x42')]));_0x14ab27[_0x404a('0x41')]=_0x14ab27[_0x404a('0x41')]['length']?_0x14ab27[_0x404a('0x41')]:_0x578d05[_0x404a('0x3d')];if(_0x18a24c['query']['includeAll']){_0x14ab27['include']=[{'all':!![]}];}_0x14ab27=_[_0x404a('0x51')]({},_0x14ab27,_0x18a24c[_0x404a('0x4b')]);return db[_0x404a('0x3a')]['find'](_0x14ab27)['then'](handleEntityNotFound(_0x4d77b7,null))[_0x404a('0x1c')](respondWithResult(_0x4d77b7,null))[_0x404a('0x27')](handleError(_0x4d77b7,null));};exports[_0x404a('0x52')]=function(_0x514087,_0x41c882){return db[_0x404a('0x3a')][_0x404a('0x52')](_0x514087[_0x404a('0x53')],{})[_0x404a('0x1c')](respondWithResult(_0x41c882,0xc9))[_0x404a('0x27')](handleError(_0x41c882,null));};exports['update']=function(_0x312ba7,_0x1e2b45){if(_0x312ba7[_0x404a('0x53')]['id']){delete _0x312ba7[_0x404a('0x53')]['id'];}return db[_0x404a('0x3a')][_0x404a('0x54')]({'where':{'id':_0x312ba7['params']['id']}})[_0x404a('0x1c')](handleEntityNotFound(_0x1e2b45,null))[_0x404a('0x1c')](saveUpdates(_0x312ba7['body'],null))[_0x404a('0x1c')](respondWithResult(_0x1e2b45,null))['catch'](handleError(_0x1e2b45,null));};exports[_0x404a('0x34')]=function(_0x570aa6,_0x4d1d29){return db['FreshsalesConfiguration'][_0x404a('0x54')]({'where':{'id':_0x570aa6[_0x404a('0x50')]['id']}})['then'](handleEntityNotFound(_0x4d1d29,null))[_0x404a('0x1c')](removeEntity(_0x4d1d29,null))[_0x404a('0x27')](handleError(_0x4d1d29,null));};exports[_0x404a('0x55')]=function(_0x540609,_0x70b737,_0x52d629){var _0x3f2ba1={};var _0x42ea4c={};var _0x332d0d;var _0x3958c3;return db['FreshsalesConfiguration'][_0x404a('0x56')]({'where':{'id':_0x540609[_0x404a('0x50')]['id']}})[_0x404a('0x1c')](handleEntityNotFound(_0x70b737,null))[_0x404a('0x1c')](function(_0x25323a){if(_0x25323a){_0x332d0d=_0x25323a;_0x42ea4c[_0x404a('0x3d')]=_[_0x404a('0x3f')](db[_0x404a('0x57')][_0x404a('0x3b')]);_0x42ea4c[_0x404a('0x3e')]=_[_0x404a('0x3f')](_0x540609['query']);_0x42ea4c['filters']=_[_0x404a('0x40')](_0x42ea4c[_0x404a('0x3d')],_0x42ea4c[_0x404a('0x3e')]);_0x3f2ba1['attributes']=_[_0x404a('0x40')](_0x42ea4c[_0x404a('0x3d')],qs['fields'](_0x540609[_0x404a('0x3e')]['fields']));_0x3f2ba1[_0x404a('0x41')]=_0x3f2ba1[_0x404a('0x41')][_0x404a('0x43')]?_0x3f2ba1[_0x404a('0x41')]:_0x42ea4c['model'];_0x3f2ba1[_0x404a('0x58')]=qs[_0x404a('0x45')](_0x540609[_0x404a('0x3e')][_0x404a('0x45')]);_0x3f2ba1[_0x404a('0x46')]=qs[_0x404a('0x48')](_[_0x404a('0x47')](_0x540609['query'],_0x42ea4c[_0x404a('0x48')]));if(_0x540609[_0x404a('0x3e')][_0x404a('0x49')]){_0x3f2ba1[_0x404a('0x46')]=_['merge'](_0x3f2ba1[_0x404a('0x46')],{'$or':_[_0x404a('0x39')](_0x3f2ba1[_0x404a('0x41')],function(_0x2b8428){var _0x23887e={};_0x23887e[_0x2b8428]={'$like':'%'+_0x540609[_0x404a('0x3e')]['filter']+'%'};return _0x23887e;})});}_0x3f2ba1=_[_0x404a('0x51')]({},_0x3f2ba1,_0x540609[_0x404a('0x4b')]);return _0x332d0d['getSubjects'](_0x3f2ba1);}})[_0x404a('0x1c')](function(_0x5aab21){if(_0x5aab21){_0x3958c3=_0x5aab21['length'];if(!_0x540609[_0x404a('0x3e')][_0x404a('0x44')]('nolimit')){_0x3f2ba1[_0x404a('0x2d')]=qs['limit'](_0x540609['query'][_0x404a('0x2d')]);_0x3f2ba1[_0x404a('0x2c')]=qs[_0x404a('0x2c')](_0x540609[_0x404a('0x3e')][_0x404a('0x2c')]);}return _0x332d0d[_0x404a('0x55')](_0x3f2ba1);}})[_0x404a('0x1c')](function(_0xb159fa){if(_0xb159fa){return _0xb159fa?{'count':_0x3958c3,'rows':_0xb159fa}:null;}})[_0x404a('0x1c')](respondWithResult(_0x70b737,null))[_0x404a('0x27')](handleError(_0x70b737,null));};exports['getDescriptions']=function(_0x4012ed,_0x1016f9,_0x39a963){var _0x132c70={};var _0x5466c9={};var _0xe099c4;var _0x3a2e14;return db[_0x404a('0x3a')][_0x404a('0x56')]({'where':{'id':_0x4012ed[_0x404a('0x50')]['id']}})[_0x404a('0x1c')](handleEntityNotFound(_0x1016f9,null))['then'](function(_0x103497){if(_0x103497){_0xe099c4=_0x103497;_0x5466c9[_0x404a('0x3d')]=_[_0x404a('0x3f')](db[_0x404a('0x57')]['rawAttributes']);_0x5466c9[_0x404a('0x3e')]=_[_0x404a('0x3f')](_0x4012ed['query']);_0x5466c9[_0x404a('0x48')]=_['intersection'](_0x5466c9[_0x404a('0x3d')],_0x5466c9[_0x404a('0x3e')]);_0x132c70[_0x404a('0x41')]=_['intersection'](_0x5466c9[_0x404a('0x3d')],qs[_0x404a('0x42')](_0x4012ed[_0x404a('0x3e')][_0x404a('0x42')]));_0x132c70[_0x404a('0x41')]=_0x132c70[_0x404a('0x41')][_0x404a('0x43')]?_0x132c70['attributes']:_0x5466c9['model'];_0x132c70[_0x404a('0x58')]=qs[_0x404a('0x45')](_0x4012ed[_0x404a('0x3e')]['sort']);_0x132c70[_0x404a('0x46')]=qs[_0x404a('0x48')](_[_0x404a('0x47')](_0x4012ed[_0x404a('0x3e')],_0x5466c9[_0x404a('0x48')]));if(_0x4012ed[_0x404a('0x3e')][_0x404a('0x49')]){_0x132c70['where']=_['merge'](_0x132c70[_0x404a('0x46')],{'$or':_[_0x404a('0x39')](_0x132c70[_0x404a('0x41')],function(_0x17a4d6){var _0x199a6a={};_0x199a6a[_0x17a4d6]={'$like':'%'+_0x4012ed['query'][_0x404a('0x49')]+'%'};return _0x199a6a;})});}_0x132c70=_['merge']({},_0x132c70,_0x4012ed[_0x404a('0x4b')]);return _0xe099c4['getDescriptions'](_0x132c70);}})[_0x404a('0x1c')](function(_0xfdc1d8){if(_0xfdc1d8){_0x3a2e14=_0xfdc1d8[_0x404a('0x43')];if(!_0x4012ed[_0x404a('0x3e')][_0x404a('0x44')](_0x404a('0x59'))){_0x132c70[_0x404a('0x2d')]=qs[_0x404a('0x2d')](_0x4012ed[_0x404a('0x3e')][_0x404a('0x2d')]);_0x132c70[_0x404a('0x2c')]=qs[_0x404a('0x2c')](_0x4012ed[_0x404a('0x3e')]['offset']);}return _0xe099c4[_0x404a('0x5a')](_0x132c70);}})[_0x404a('0x1c')](function(_0x30a7ff){if(_0x30a7ff){return _0x30a7ff?{'count':_0x3a2e14,'rows':_0x30a7ff}:null;}})[_0x404a('0x1c')](respondWithResult(_0x1016f9,null))[_0x404a('0x27')](handleError(_0x1016f9,null));};exports[_0x404a('0x5b')]=function(_0x6a7e16,_0x17eb8d,_0x2b39df){var _0x4c0101={};var _0x41fbef={};var _0x1a58f6;var _0x19afad;return db[_0x404a('0x3a')][_0x404a('0x56')]({'where':{'id':_0x6a7e16[_0x404a('0x50')]['id']}})[_0x404a('0x1c')](handleEntityNotFound(_0x17eb8d,null))['then'](function(_0x49f7fb){if(_0x49f7fb){_0x1a58f6=_0x49f7fb;_0x41fbef['model']=_[_0x404a('0x3f')](db[_0x404a('0x57')][_0x404a('0x3b')]);_0x41fbef['query']=_['keys'](_0x6a7e16[_0x404a('0x3e')]);_0x41fbef['filters']=_[_0x404a('0x40')](_0x41fbef[_0x404a('0x3d')],_0x41fbef[_0x404a('0x3e')]);_0x4c0101['attributes']=_[_0x404a('0x40')](_0x41fbef['model'],qs[_0x404a('0x42')](_0x6a7e16['query'][_0x404a('0x42')]));_0x4c0101[_0x404a('0x41')]=_0x4c0101[_0x404a('0x41')]['length']?_0x4c0101[_0x404a('0x41')]:_0x41fbef[_0x404a('0x3d')];_0x4c0101[_0x404a('0x58')]=qs['sort'](_0x6a7e16[_0x404a('0x3e')][_0x404a('0x45')]);_0x4c0101['where']=qs['filters'](_[_0x404a('0x47')](_0x6a7e16[_0x404a('0x3e')],_0x41fbef[_0x404a('0x48')]));if(_0x6a7e16[_0x404a('0x3e')][_0x404a('0x49')]){_0x4c0101[_0x404a('0x46')]=_['merge'](_0x4c0101[_0x404a('0x46')],{'$or':_[_0x404a('0x39')](_0x4c0101[_0x404a('0x41')],function(_0x1124de){var _0x3242f0={};_0x3242f0[_0x1124de]={'$like':'%'+_0x6a7e16['query'][_0x404a('0x49')]+'%'};return _0x3242f0;})});}_0x4c0101=_[_0x404a('0x51')]({},_0x4c0101,_0x6a7e16[_0x404a('0x4b')]);return _0x1a58f6[_0x404a('0x5b')](_0x4c0101);}})['then'](function(_0x3e8f69){if(_0x3e8f69){_0x19afad=_0x3e8f69['length'];if(!_0x6a7e16['query'][_0x404a('0x44')](_0x404a('0x59'))){_0x4c0101[_0x404a('0x2d')]=qs[_0x404a('0x2d')](_0x6a7e16[_0x404a('0x3e')][_0x404a('0x2d')]);_0x4c0101[_0x404a('0x2c')]=qs[_0x404a('0x2c')](_0x6a7e16['query'][_0x404a('0x2c')]);}return _0x1a58f6[_0x404a('0x5b')](_0x4c0101);}})['then'](function(_0x14de6b){if(_0x14de6b){return _0x14de6b?{'count':_0x19afad,'rows':_0x14de6b}:null;}})['then'](respondWithResult(_0x17eb8d,null))[_0x404a('0x27')](handleError(_0x17eb8d,null));}; \ No newline at end of file +var _0xbaa5=['../../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','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','save','update','destroy','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','options','include','findAll','rows','params','length','includeAll','merge','find','create','body','getSubjects','findOne','FreshsalesField','nolimit','getDescriptions','getFields','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils'];(function(_0x16e57d,_0x2cb7ba){var _0x40239c=function(_0x3cc8f0){while(--_0x3cc8f0){_0x16e57d['push'](_0x16e57d['shift']());}};_0x40239c(++_0x2cb7ba);}(_0xbaa5,0xa7));var _0x5baa=function(_0x4e2eee,_0x3fd265){_0x4e2eee=_0x4e2eee-0x0;var _0x104bb0=_0xbaa5[_0x4e2eee];return _0x104bb0;};'use strict';var pdf=require(_0x5baa('0x0'));var emlformat=require(_0x5baa('0x1'));var rimraf=require(_0x5baa('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5baa('0x3'));var moment=require('moment');var BPromise=require(_0x5baa('0x4'));var Mustache=require(_0x5baa('0x5'));var util=require(_0x5baa('0x6'));var path=require(_0x5baa('0x7'));var sox=require('sox');var csv=require(_0x5baa('0x8'));var ejs=require(_0x5baa('0x9'));var fs=require('fs');var _=require(_0x5baa('0xa'));var squel=require('squel');var crypto=require(_0x5baa('0xb'));var jsforce=require(_0x5baa('0xc'));var deskjs=require(_0x5baa('0xd'));var toCsv=require(_0x5baa('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5baa('0xe'));var authService=require(_0x5baa('0xf'));var qs=require(_0x5baa('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5baa('0x11'))('api');var utils=require(_0x5baa('0x12'));var config=require(_0x5baa('0x13'));var db=require(_0x5baa('0x14'))['db'];var jayson=require(_0x5baa('0x15'));var client=jayson[_0x5baa('0x16')][_0x5baa('0x17')]({'port':0x232a});function checkPasswordPattern(_0x2cf9dd,_0x30cfef,_0x34f7fd){if(_0x34f7fd){var _0x5a1e95=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5a1e95[_0x5baa('0x18')](_0x30cfef)){return _0x2cf9dd;}else{throw new db[(_0x5baa('0x19'))][(_0x5baa('0x1a'))](_0x5baa('0x1b'));}}else{return _0x2cf9dd;}}function respondWithRpcPromise(_0x3d512b,_0x4299c0,_0xcbf10a,_0x358bc3){return new BPromise(function(_0x33baf5,_0x19ced5){var _0x583ee9=_0x358bc3||client;return _0x583ee9['request'](_0x3d512b,_0xcbf10a)[_0x5baa('0x1c')](function(_0x559d01){logger[_0x5baa('0x1d')](_0x5baa('0x1e'),_0x4299c0,_0x5baa('0x1f'));logger[_0x5baa('0x20')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x4299c0,_0x5baa('0x1f'),JSON[_0x5baa('0x21')](_0x559d01));if(_0x559d01[_0x5baa('0x22')]){if(_0x559d01['error'][_0x5baa('0x23')]===0x1f4){logger['error'](_0x5baa('0x1e'),_0x4299c0,_0x559d01[_0x5baa('0x22')][_0x5baa('0x24')]);return _0x19ced5(_0x559d01['error']['message']);}logger[_0x5baa('0x22')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4299c0,_0x559d01[_0x5baa('0x22')]['message']);return _0x33baf5(_0x559d01['error']['message']);}else{logger[_0x5baa('0x1d')](_0x5baa('0x1e'),_0x4299c0,'request\x20sent');_0x33baf5(_0x559d01[_0x5baa('0x25')][_0x5baa('0x24')]);}})[_0x5baa('0x26')](function(_0x3136a3){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x4299c0,_0x3136a3);_0x19ced5(_0x3136a3);});});}function respondWithStatusCode(_0x130a06,_0x3f6a0a){_0x3f6a0a=_0x3f6a0a||0xcc;return function(_0x3dbde0){if(_0x3dbde0){return _0x130a06[_0x5baa('0x27')](_0x3f6a0a);}return _0x130a06['status'](_0x3f6a0a)[_0x5baa('0x28')]();};}function respondWithResult(_0x56d2cf,_0x16ea80){_0x16ea80=_0x16ea80||0xc8;return function(_0x177654){if(_0x177654){return _0x56d2cf['status'](_0x16ea80)[_0x5baa('0x29')](_0x177654);}};}function respondWithFilteredResult(_0x3560ce,_0x3d0bd5){return function(_0x15dfd1){if(_0x15dfd1){var _0xcedc45=_0x15dfd1[_0x5baa('0x2a')],_0xe2d8bf=_0x3d0bd5[_0x5baa('0x2b')],_0x275b11=_0x3d0bd5[_0x5baa('0x2b')]+_0x3d0bd5[_0x5baa('0x2c')],_0xcaddf;if(_0x275b11>=_0xcedc45){_0x275b11=_0xcedc45;_0xcaddf=0xc8;}else{_0xcaddf=0xce;}_0x3560ce[_0x5baa('0x2d')](_0xcaddf);return _0x3560ce[_0x5baa('0x2e')](_0x5baa('0x2f'),_0xe2d8bf+'-'+_0x275b11+'/'+_0xcedc45)[_0x5baa('0x29')](_0x15dfd1);}return null;};}function patchUpdates(_0x3c6015){return function(_0x1c85cf){try{jsonpatch[_0x5baa('0x30')](_0x1c85cf,_0x3c6015,!![]);}catch(_0x531bdb){return BPromise['reject'](_0x531bdb);}return _0x1c85cf[_0x5baa('0x31')]();};}function saveUpdates(_0x162e61,_0x3ed545){return function(_0x104ba4){if(_0x104ba4){return _0x104ba4[_0x5baa('0x32')](_0x162e61)['then'](function(_0x7d4f83){return _0x7d4f83;});}return null;};}function removeEntity(_0x31d73e,_0x7d89fd){return function(_0x4b7baa){if(_0x4b7baa){return _0x4b7baa[_0x5baa('0x33')]()[_0x5baa('0x1c')](function(){_0x31d73e[_0x5baa('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6bdff4,_0x5ced0f){return function(_0x4bc5b4){if(!_0x4bc5b4){_0x6bdff4[_0x5baa('0x27')](0x194);}return _0x4bc5b4;};}function handleError(_0x148545,_0x373880){_0x373880=_0x373880||0x1f4;return function(_0x56083d){logger[_0x5baa('0x22')](_0x56083d[_0x5baa('0x34')]);if(_0x56083d[_0x5baa('0x35')]){delete _0x56083d['name'];}_0x148545[_0x5baa('0x2d')](_0x373880)[_0x5baa('0x36')](_0x56083d);};}exports[_0x5baa('0x37')]=function(_0x3afd3d,_0x213905){var _0x28f549={},_0xc08de3={},_0x2181b9={'count':0x0,'rows':[]};var _0x842800=_[_0x5baa('0x38')](db[_0x5baa('0x39')][_0x5baa('0x3a')],function(_0x2c845b){return{'name':_0x2c845b[_0x5baa('0x3b')],'type':_0x2c845b[_0x5baa('0x3c')][_0x5baa('0x3d')]};});_0xc08de3[_0x5baa('0x3e')]=_[_0x5baa('0x38')](_0x842800,_0x5baa('0x35'));_0xc08de3[_0x5baa('0x3f')]=_[_0x5baa('0x40')](_0x3afd3d[_0x5baa('0x3f')]);_0xc08de3['filters']=_['intersection'](_0xc08de3[_0x5baa('0x3e')],_0xc08de3[_0x5baa('0x3f')]);_0x28f549[_0x5baa('0x41')]=_[_0x5baa('0x42')](_0xc08de3['model'],qs[_0x5baa('0x43')](_0x3afd3d[_0x5baa('0x3f')][_0x5baa('0x43')]));_0x28f549[_0x5baa('0x41')]=_0x28f549[_0x5baa('0x41')]['length']?_0x28f549[_0x5baa('0x41')]:_0xc08de3[_0x5baa('0x3e')];if(!_0x3afd3d[_0x5baa('0x3f')][_0x5baa('0x44')]('nolimit')){_0x28f549[_0x5baa('0x2c')]=qs[_0x5baa('0x2c')](_0x3afd3d[_0x5baa('0x3f')][_0x5baa('0x2c')]);_0x28f549[_0x5baa('0x2b')]=qs[_0x5baa('0x2b')](_0x3afd3d[_0x5baa('0x3f')][_0x5baa('0x2b')]);}_0x28f549[_0x5baa('0x45')]=qs[_0x5baa('0x46')](_0x3afd3d['query']['sort']);_0x28f549[_0x5baa('0x47')]=qs[_0x5baa('0x48')](_[_0x5baa('0x49')](_0x3afd3d[_0x5baa('0x3f')],_0xc08de3[_0x5baa('0x48')]),_0x842800);if(_0x3afd3d[_0x5baa('0x3f')][_0x5baa('0x4a')]){_0x28f549[_0x5baa('0x47')]=_['merge'](_0x28f549[_0x5baa('0x47')],{'$or':_[_0x5baa('0x38')](_0x842800,function(_0x4d0252){if(_0x4d0252['type']!==_0x5baa('0x4b')){var _0x1acee4={};_0x1acee4[_0x4d0252[_0x5baa('0x35')]]={'$like':'%'+_0x3afd3d['query'][_0x5baa('0x4a')]+'%'};return _0x1acee4;}})});}_0x28f549=_['merge']({},_0x28f549,_0x3afd3d[_0x5baa('0x4c')]);var _0x290434={'where':_0x28f549[_0x5baa('0x47')]};return db['FreshsalesConfiguration'][_0x5baa('0x2a')](_0x290434)[_0x5baa('0x1c')](function(_0x21d993){_0x2181b9[_0x5baa('0x2a')]=_0x21d993;if(_0x3afd3d[_0x5baa('0x3f')]['includeAll']){_0x28f549[_0x5baa('0x4d')]=[{'all':!![]}];}return db[_0x5baa('0x39')][_0x5baa('0x4e')](_0x28f549);})['then'](function(_0x399dbc){_0x2181b9[_0x5baa('0x4f')]=_0x399dbc;return _0x2181b9;})[_0x5baa('0x1c')](respondWithFilteredResult(_0x213905,_0x28f549))[_0x5baa('0x26')](handleError(_0x213905,null));};exports['show']=function(_0x4b14f7,_0x119526){var _0x3f03ae={'raw':![],'where':{'id':_0x4b14f7[_0x5baa('0x50')]['id']}},_0x3f0e0b={};_0x3f0e0b[_0x5baa('0x3e')]=_[_0x5baa('0x40')](db[_0x5baa('0x39')][_0x5baa('0x3a')]);_0x3f0e0b[_0x5baa('0x3f')]=_[_0x5baa('0x40')](_0x4b14f7[_0x5baa('0x3f')]);_0x3f0e0b['filters']=_['intersection'](_0x3f0e0b['model'],_0x3f0e0b['query']);_0x3f03ae[_0x5baa('0x41')]=_[_0x5baa('0x42')](_0x3f0e0b[_0x5baa('0x3e')],qs[_0x5baa('0x43')](_0x4b14f7[_0x5baa('0x3f')]['fields']));_0x3f03ae[_0x5baa('0x41')]=_0x3f03ae['attributes'][_0x5baa('0x51')]?_0x3f03ae[_0x5baa('0x41')]:_0x3f0e0b[_0x5baa('0x3e')];if(_0x4b14f7[_0x5baa('0x3f')][_0x5baa('0x52')]){_0x3f03ae[_0x5baa('0x4d')]=[{'all':!![]}];}_0x3f03ae=_[_0x5baa('0x53')]({},_0x3f03ae,_0x4b14f7['options']);return db[_0x5baa('0x39')][_0x5baa('0x54')](_0x3f03ae)[_0x5baa('0x1c')](handleEntityNotFound(_0x119526,null))[_0x5baa('0x1c')](respondWithResult(_0x119526,null))['catch'](handleError(_0x119526,null));};exports[_0x5baa('0x55')]=function(_0x1b2ceb,_0x5a3842){return db[_0x5baa('0x39')][_0x5baa('0x55')](_0x1b2ceb[_0x5baa('0x56')],{})[_0x5baa('0x1c')](respondWithResult(_0x5a3842,0xc9))[_0x5baa('0x26')](handleError(_0x5a3842,null));};exports[_0x5baa('0x32')]=function(_0x260cbb,_0x41c5f9){if(_0x260cbb['body']['id']){delete _0x260cbb[_0x5baa('0x56')]['id'];}return db['FreshsalesConfiguration']['find']({'where':{'id':_0x260cbb[_0x5baa('0x50')]['id']}})['then'](handleEntityNotFound(_0x41c5f9,null))[_0x5baa('0x1c')](saveUpdates(_0x260cbb[_0x5baa('0x56')],null))[_0x5baa('0x1c')](respondWithResult(_0x41c5f9,null))[_0x5baa('0x26')](handleError(_0x41c5f9,null));};exports[_0x5baa('0x33')]=function(_0x2e2512,_0x249075){return db[_0x5baa('0x39')][_0x5baa('0x54')]({'where':{'id':_0x2e2512[_0x5baa('0x50')]['id']}})[_0x5baa('0x1c')](handleEntityNotFound(_0x249075,null))[_0x5baa('0x1c')](removeEntity(_0x249075,null))['catch'](handleError(_0x249075,null));};exports[_0x5baa('0x57')]=function(_0x58e419,_0x4f6cb1,_0x4d8a59){var _0x2a5f27={};var _0x3cfbff={};var _0x377c28;var _0x494578;return db['FreshsalesConfiguration'][_0x5baa('0x58')]({'where':{'id':_0x58e419[_0x5baa('0x50')]['id']}})[_0x5baa('0x1c')](handleEntityNotFound(_0x4f6cb1,null))['then'](function(_0x3506f9){if(_0x3506f9){_0x377c28=_0x3506f9;_0x3cfbff[_0x5baa('0x3e')]=_['keys'](db[_0x5baa('0x59')][_0x5baa('0x3a')]);_0x3cfbff[_0x5baa('0x3f')]=_[_0x5baa('0x40')](_0x58e419[_0x5baa('0x3f')]);_0x3cfbff[_0x5baa('0x48')]=_[_0x5baa('0x42')](_0x3cfbff['model'],_0x3cfbff[_0x5baa('0x3f')]);_0x2a5f27[_0x5baa('0x41')]=_[_0x5baa('0x42')](_0x3cfbff[_0x5baa('0x3e')],qs[_0x5baa('0x43')](_0x58e419[_0x5baa('0x3f')][_0x5baa('0x43')]));_0x2a5f27['attributes']=_0x2a5f27[_0x5baa('0x41')][_0x5baa('0x51')]?_0x2a5f27[_0x5baa('0x41')]:_0x3cfbff['model'];_0x2a5f27[_0x5baa('0x45')]=qs[_0x5baa('0x46')](_0x58e419['query']['sort']);_0x2a5f27['where']=qs[_0x5baa('0x48')](_[_0x5baa('0x49')](_0x58e419[_0x5baa('0x3f')],_0x3cfbff['filters']));if(_0x58e419['query'][_0x5baa('0x4a')]){_0x2a5f27['where']=_[_0x5baa('0x53')](_0x2a5f27[_0x5baa('0x47')],{'$or':_['map'](_0x2a5f27[_0x5baa('0x41')],function(_0x4d3107){var _0x551635={};_0x551635[_0x4d3107]={'$like':'%'+_0x58e419[_0x5baa('0x3f')]['filter']+'%'};return _0x551635;})});}_0x2a5f27=_[_0x5baa('0x53')]({},_0x2a5f27,_0x58e419[_0x5baa('0x4c')]);return _0x377c28[_0x5baa('0x57')](_0x2a5f27);}})[_0x5baa('0x1c')](function(_0x2d0242){if(_0x2d0242){_0x494578=_0x2d0242[_0x5baa('0x51')];if(!_0x58e419[_0x5baa('0x3f')][_0x5baa('0x44')](_0x5baa('0x5a'))){_0x2a5f27[_0x5baa('0x2c')]=qs[_0x5baa('0x2c')](_0x58e419[_0x5baa('0x3f')][_0x5baa('0x2c')]);_0x2a5f27[_0x5baa('0x2b')]=qs[_0x5baa('0x2b')](_0x58e419[_0x5baa('0x3f')][_0x5baa('0x2b')]);}return _0x377c28[_0x5baa('0x57')](_0x2a5f27);}})[_0x5baa('0x1c')](function(_0x53d240){if(_0x53d240){return _0x53d240?{'count':_0x494578,'rows':_0x53d240}:null;}})[_0x5baa('0x1c')](respondWithResult(_0x4f6cb1,null))[_0x5baa('0x26')](handleError(_0x4f6cb1,null));};exports[_0x5baa('0x5b')]=function(_0x311e1c,_0x718c12,_0x2ba89a){var _0x2a81e8={};var _0x51677c={};var _0x55665d;var _0x57ba13;return db[_0x5baa('0x39')][_0x5baa('0x58')]({'where':{'id':_0x311e1c[_0x5baa('0x50')]['id']}})['then'](handleEntityNotFound(_0x718c12,null))['then'](function(_0x18e836){if(_0x18e836){_0x55665d=_0x18e836;_0x51677c[_0x5baa('0x3e')]=_[_0x5baa('0x40')](db[_0x5baa('0x59')]['rawAttributes']);_0x51677c[_0x5baa('0x3f')]=_[_0x5baa('0x40')](_0x311e1c['query']);_0x51677c[_0x5baa('0x48')]=_[_0x5baa('0x42')](_0x51677c[_0x5baa('0x3e')],_0x51677c[_0x5baa('0x3f')]);_0x2a81e8[_0x5baa('0x41')]=_[_0x5baa('0x42')](_0x51677c['model'],qs[_0x5baa('0x43')](_0x311e1c['query'][_0x5baa('0x43')]));_0x2a81e8[_0x5baa('0x41')]=_0x2a81e8[_0x5baa('0x41')][_0x5baa('0x51')]?_0x2a81e8[_0x5baa('0x41')]:_0x51677c[_0x5baa('0x3e')];_0x2a81e8[_0x5baa('0x45')]=qs['sort'](_0x311e1c[_0x5baa('0x3f')][_0x5baa('0x46')]);_0x2a81e8[_0x5baa('0x47')]=qs[_0x5baa('0x48')](_[_0x5baa('0x49')](_0x311e1c['query'],_0x51677c[_0x5baa('0x48')]));if(_0x311e1c['query'][_0x5baa('0x4a')]){_0x2a81e8['where']=_[_0x5baa('0x53')](_0x2a81e8[_0x5baa('0x47')],{'$or':_[_0x5baa('0x38')](_0x2a81e8[_0x5baa('0x41')],function(_0x4de6ef){var _0xe93650={};_0xe93650[_0x4de6ef]={'$like':'%'+_0x311e1c[_0x5baa('0x3f')]['filter']+'%'};return _0xe93650;})});}_0x2a81e8=_['merge']({},_0x2a81e8,_0x311e1c[_0x5baa('0x4c')]);return _0x55665d[_0x5baa('0x5b')](_0x2a81e8);}})[_0x5baa('0x1c')](function(_0x2c83cf){if(_0x2c83cf){_0x57ba13=_0x2c83cf[_0x5baa('0x51')];if(!_0x311e1c[_0x5baa('0x3f')][_0x5baa('0x44')](_0x5baa('0x5a'))){_0x2a81e8[_0x5baa('0x2c')]=qs[_0x5baa('0x2c')](_0x311e1c[_0x5baa('0x3f')][_0x5baa('0x2c')]);_0x2a81e8[_0x5baa('0x2b')]=qs[_0x5baa('0x2b')](_0x311e1c['query'][_0x5baa('0x2b')]);}return _0x55665d[_0x5baa('0x5b')](_0x2a81e8);}})['then'](function(_0x4f5eba){if(_0x4f5eba){return _0x4f5eba?{'count':_0x57ba13,'rows':_0x4f5eba}:null;}})[_0x5baa('0x1c')](respondWithResult(_0x718c12,null))['catch'](handleError(_0x718c12,null));};exports[_0x5baa('0x5c')]=function(_0x1fc99d,_0x454cdc,_0x5a2973){var _0x7ddf89={};var _0x39d5f8={};var _0x335934;var _0x42ca79;return db['FreshsalesConfiguration'][_0x5baa('0x58')]({'where':{'id':_0x1fc99d['params']['id']}})[_0x5baa('0x1c')](handleEntityNotFound(_0x454cdc,null))[_0x5baa('0x1c')](function(_0xe00d80){if(_0xe00d80){_0x335934=_0xe00d80;_0x39d5f8[_0x5baa('0x3e')]=_[_0x5baa('0x40')](db['FreshsalesField'][_0x5baa('0x3a')]);_0x39d5f8[_0x5baa('0x3f')]=_[_0x5baa('0x40')](_0x1fc99d[_0x5baa('0x3f')]);_0x39d5f8['filters']=_[_0x5baa('0x42')](_0x39d5f8[_0x5baa('0x3e')],_0x39d5f8[_0x5baa('0x3f')]);_0x7ddf89['attributes']=_[_0x5baa('0x42')](_0x39d5f8[_0x5baa('0x3e')],qs[_0x5baa('0x43')](_0x1fc99d[_0x5baa('0x3f')][_0x5baa('0x43')]));_0x7ddf89[_0x5baa('0x41')]=_0x7ddf89[_0x5baa('0x41')]['length']?_0x7ddf89['attributes']:_0x39d5f8['model'];_0x7ddf89[_0x5baa('0x45')]=qs[_0x5baa('0x46')](_0x1fc99d['query'][_0x5baa('0x46')]);_0x7ddf89[_0x5baa('0x47')]=qs[_0x5baa('0x48')](_['pick'](_0x1fc99d[_0x5baa('0x3f')],_0x39d5f8[_0x5baa('0x48')]));if(_0x1fc99d['query'][_0x5baa('0x4a')]){_0x7ddf89[_0x5baa('0x47')]=_[_0x5baa('0x53')](_0x7ddf89[_0x5baa('0x47')],{'$or':_['map'](_0x7ddf89[_0x5baa('0x41')],function(_0x5a6ebf){var _0x132078={};_0x132078[_0x5a6ebf]={'$like':'%'+_0x1fc99d[_0x5baa('0x3f')][_0x5baa('0x4a')]+'%'};return _0x132078;})});}_0x7ddf89=_[_0x5baa('0x53')]({},_0x7ddf89,_0x1fc99d[_0x5baa('0x4c')]);return _0x335934[_0x5baa('0x5c')](_0x7ddf89);}})[_0x5baa('0x1c')](function(_0x2dd2ac){if(_0x2dd2ac){_0x42ca79=_0x2dd2ac['length'];if(!_0x1fc99d[_0x5baa('0x3f')]['hasOwnProperty'](_0x5baa('0x5a'))){_0x7ddf89[_0x5baa('0x2c')]=qs[_0x5baa('0x2c')](_0x1fc99d[_0x5baa('0x3f')][_0x5baa('0x2c')]);_0x7ddf89[_0x5baa('0x2b')]=qs[_0x5baa('0x2b')](_0x1fc99d['query'][_0x5baa('0x2b')]);}return _0x335934[_0x5baa('0x5c')](_0x7ddf89);}})[_0x5baa('0x1c')](function(_0xc80d3a){if(_0xc80d3a){return _0xc80d3a?{'count':_0x42ca79,'rows':_0xc80d3a}:null;}})[_0x5baa('0x1c')](respondWithResult(_0x454cdc,null))[_0x5baa('0x26')](handleError(_0x454cdc,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index de9706d..29636a5 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 _0x3b46=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','int_freshsales_configurations'];(function(_0x17f80f,_0x15e0c7){var _0x2ddd72=function(_0xcf477d){while(--_0xcf477d){_0x17f80f['push'](_0x17f80f['shift']());}};_0x2ddd72(++_0x15e0c7);}(_0x3b46,0x1a2));var _0x63b4=function(_0x5959c9,_0x2ed153){_0x5959c9=_0x5959c9-0x0;var _0x4ffcbc=_0x3b46[_0x5959c9];return _0x4ffcbc;};'use strict';var _=require(_0x63b4('0x0'));var util=require(_0x63b4('0x1'));var logger=require(_0x63b4('0x2'))(_0x63b4('0x3'));var moment=require('moment');var BPromise=require(_0x63b4('0x4'));var rp=require(_0x63b4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x63b4('0x6'));var config=require(_0x63b4('0x7'));var attributes=require(_0x63b4('0x8'));module[_0x63b4('0x9')]=function(_0xeab6e8,_0x3a7607){return _0xeab6e8['define']('FreshsalesConfiguration',attributes,{'tableName':_0x63b4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc078=['int_freshsales_configurations','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','FreshsalesConfiguration'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xc078,0xfd));var _0x8c07=function(_0x1e87fe,_0x3707d6){_0x1e87fe=_0x1e87fe-0x0;var _0x558d64=_0xc078[_0x1e87fe];return _0x558d64;};'use strict';var _=require('lodash');var util=require(_0x8c07('0x0'));var logger=require(_0x8c07('0x1'))(_0x8c07('0x2'));var moment=require(_0x8c07('0x3'));var BPromise=require(_0x8c07('0x4'));var rp=require(_0x8c07('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8c07('0x6'));var config=require(_0x8c07('0x7'));var attributes=require(_0x8c07('0x8'));module[_0x8c07('0x9')]=function(_0x304920,_0x585966){return _0x304920['define'](_0x8c07('0xa'),attributes,{'tableName':_0x8c07('0xb'),'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 7d9eafc..b60c106 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 _0x5c00=['request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','FreshsalesConfiguration,\x20%s,\x20%s'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x5c00,0x17e));var _0x05c0=function(_0x24ae93,_0x364bd5){_0x24ae93=_0x24ae93-0x0;var _0x2fc1f3=_0x5c00[_0x24ae93];return _0x2fc1f3;};'use strict';var _=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var moment=require(_0x05c0('0x2'));var BPromise=require('bluebird');var rs=require(_0x05c0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x05c0('0x4'))['db'];var utils=require(_0x05c0('0x5'));var logger=require(_0x05c0('0x6'))(_0x05c0('0x7'));var config=require('../../config/environment');var jayson=require(_0x05c0('0x8'));var client=jayson[_0x05c0('0x9')][_0x05c0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27dc10,_0x5b9f09,_0x3a3b1b){return new BPromise(function(_0x34eb5f,_0x3ad5b7){return client['request'](_0x27dc10,_0x3a3b1b)[_0x05c0('0xb')](function(_0x32cdfa){logger[_0x05c0('0xc')](_0x05c0('0xd'),_0x5b9f09,_0x05c0('0xe'));logger[_0x05c0('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x5b9f09,'request\x20sent',JSON[_0x05c0('0x10')](_0x32cdfa));if(_0x32cdfa['error']){if(_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x12')]===0x1f4){logger[_0x05c0('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5b9f09,_0x32cdfa[_0x05c0('0x11')]['message']);return _0x3ad5b7(_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x13')]);}logger[_0x05c0('0x11')](_0x05c0('0xd'),_0x5b9f09,_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x13')]);return _0x34eb5f(_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x13')]);}else{logger['info'](_0x05c0('0xd'),_0x5b9f09,_0x05c0('0xe'));_0x34eb5f(_0x32cdfa[_0x05c0('0x14')][_0x05c0('0x13')]);}})[_0x05c0('0x15')](function(_0x40153e){logger[_0x05c0('0x11')](_0x05c0('0xd'),_0x5b9f09,_0x40153e);_0x3ad5b7(_0x40153e);});});} \ No newline at end of file +var _0x3c1a=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','result','lodash','util'];(function(_0x4d525c,_0x277dac){var _0x3f0655=function(_0x5e8102){while(--_0x5e8102){_0x4d525c['push'](_0x4d525c['shift']());}};_0x3f0655(++_0x277dac);}(_0x3c1a,0xda));var _0xa3c1=function(_0x126f47,_0x2199e9){_0x126f47=_0x126f47-0x0;var _0x49508a=_0x3c1a[_0x126f47];return _0x49508a;};'use strict';var _=require(_0xa3c1('0x0'));var util=require(_0xa3c1('0x1'));var moment=require(_0xa3c1('0x2'));var BPromise=require(_0xa3c1('0x3'));var rs=require(_0xa3c1('0x4'));var fs=require('fs');var Redis=require(_0xa3c1('0x5'));var db=require(_0xa3c1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa3c1('0x7'))('rpc');var config=require(_0xa3c1('0x8'));var jayson=require(_0xa3c1('0x9'));var client=jayson[_0xa3c1('0xa')][_0xa3c1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x546253,_0x549d7d,_0x3a42ed){return new BPromise(function(_0x1aa471,_0x3a4718){return client[_0xa3c1('0xc')](_0x546253,_0x3a42ed)[_0xa3c1('0xd')](function(_0x4fac66){logger[_0xa3c1('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x549d7d,'request\x20sent');logger['debug']('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x549d7d,_0xa3c1('0xf'),JSON[_0xa3c1('0x10')](_0x4fac66));if(_0x4fac66[_0xa3c1('0x11')]){if(_0x4fac66[_0xa3c1('0x11')][_0xa3c1('0x12')]===0x1f4){logger[_0xa3c1('0x11')](_0xa3c1('0x13'),_0x549d7d,_0x4fac66['error'][_0xa3c1('0x14')]);return _0x3a4718(_0x4fac66[_0xa3c1('0x11')][_0xa3c1('0x14')]);}logger[_0xa3c1('0x11')](_0xa3c1('0x13'),_0x549d7d,_0x4fac66[_0xa3c1('0x11')][_0xa3c1('0x14')]);return _0x1aa471(_0x4fac66['error'][_0xa3c1('0x14')]);}else{logger[_0xa3c1('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x549d7d,_0xa3c1('0xf'));_0x1aa471(_0x4fac66[_0xa3c1('0x15')]['message']);}})['catch'](function(_0x37d3a6){logger['error'](_0xa3c1('0x13'),_0x549d7d,_0x37d3a6);_0x3a4718(_0x37d3a6);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index a162e22..827e5b9 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 _0x3f90=['show','post','create','put','update','delete','exports','connect-timeout','express','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id'];(function(_0x354016,_0x318b0e){var _0x5ded38=function(_0xb55790){while(--_0xb55790){_0x354016['push'](_0x354016['shift']());}};_0x5ded38(++_0x318b0e);}(_0x3f90,0xb7));var _0x03f9=function(_0xc4555f,_0x3f45a2){_0xc4555f=_0xc4555f-0x0;var _0x2121ab=_0x3f90[_0xc4555f];return _0x2121ab;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x03f9('0x0'));var express=require(_0x03f9('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x03f9('0x2'));var config=require(_0x03f9('0x3'));var controller=require(_0x03f9('0x4'));router[_0x03f9('0x5')]('/',auth[_0x03f9('0x6')](),controller[_0x03f9('0x7')]);router[_0x03f9('0x5')](_0x03f9('0x8'),auth[_0x03f9('0x6')](),controller[_0x03f9('0x9')]);router[_0x03f9('0xa')]('/',auth['isAuthenticated'](),controller[_0x03f9('0xb')]);router[_0x03f9('0xc')](_0x03f9('0x8'),auth[_0x03f9('0x6')](),controller[_0x03f9('0xd')]);router[_0x03f9('0xe')](_0x03f9('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x03f9('0xf')]=router; \ No newline at end of file +var _0x975a=['/:id','post','isAuthenticated','create','put','update','delete','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x285c85,_0x132c21){var _0x2f81cd=function(_0x9b9962){while(--_0x9b9962){_0x285c85['push'](_0x285c85['shift']());}};_0x2f81cd(++_0x132c21);}(_0x975a,0xd7));var _0xa975=function(_0x4525af,_0x758101){_0x4525af=_0x4525af-0x0;var _0x5e6d84=_0x975a[_0x4525af];return _0x5e6d84;};'use strict';var multer=require('multer');var util=require(_0xa975('0x0'));var path=require(_0xa975('0x1'));var timeout=require(_0xa975('0x2'));var express=require('express');var router=express[_0xa975('0x3')]();var auth=require(_0xa975('0x4'));var interaction=require(_0xa975('0x5'));var config=require(_0xa975('0x6'));var controller=require('./intFreshsalesField.controller');router[_0xa975('0x7')]('/',auth['isAuthenticated'](),controller[_0xa975('0x8')]);router['get'](_0xa975('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xa975('0xa')]('/',auth[_0xa975('0xb')](),controller[_0xa975('0xc')]);router[_0xa975('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xa975('0xe')]);router[_0xa975('0xf')](_0xa975('0x9'),auth[_0xa975('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 8b2114b..41e9e6b 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 _0x9a47=['customVariable','keyValue','STRING','BOOLEAN','sequelize','ENUM','string','variable'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x9a47,0x14c));var _0x79a4=function(_0x10736f,_0x33c07a){_0x10736f=_0x10736f-0x0;var _0x16fa36=_0x9a47[_0x10736f];return _0x16fa36;};'use strict';var Sequelize=require(_0x79a4('0x0'));module['exports']={'type':{'type':Sequelize[_0x79a4('0x1')](_0x79a4('0x2'),_0x79a4('0x3'),_0x79a4('0x4'),_0x79a4('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x79a4('0x6')]},'key':{'type':Sequelize[_0x79a4('0x6')]},'keyType':{'type':Sequelize[_0x79a4('0x1')](_0x79a4('0x2'),_0x79a4('0x3'),_0x79a4('0x4'))},'keyContent':{'type':Sequelize[_0x79a4('0x6')]},'idField':{'type':Sequelize[_0x79a4('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x79a4('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x79a4('0x6')]}}; \ No newline at end of file +var _0xd52d=['exports','ENUM','variable','string','STRING','customVariable','BOOLEAN'];(function(_0x1c06f4,_0x2feba6){var _0x1a727e=function(_0x2e83af){while(--_0x2e83af){_0x1c06f4['push'](_0x1c06f4['shift']());}};_0x1a727e(++_0x2feba6);}(_0xd52d,0x1c7));var _0xdd52=function(_0x16f218,_0x33f47b){_0x16f218=_0x16f218-0x0;var _0x68dd57=_0xd52d[_0x16f218];return _0x68dd57;};'use strict';var Sequelize=require('sequelize');module[_0xdd52('0x0')]={'type':{'type':Sequelize[_0xdd52('0x1')]('string',_0xdd52('0x2'),'customVariable','keyValue'),'defaultValue':_0xdd52('0x3')},'content':{'type':Sequelize[_0xdd52('0x4')]},'key':{'type':Sequelize[_0xdd52('0x4')]},'keyType':{'type':Sequelize[_0xdd52('0x1')](_0xdd52('0x3'),_0xdd52('0x2'),_0xdd52('0x5'))},'keyContent':{'type':Sequelize[_0xdd52('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xdd52('0x4')]},'customField':{'type':Sequelize[_0xdd52('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdd52('0x4')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 5cbff2b..ddd8d04 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 _0x6e72=['fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','create','body','catch','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','json','reject','save','then','destroy','end','stack','name','send','FreshsalesField','rawAttributes'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x6e72,0x68));var _0x26e7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6e72[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x26e7('0x0'));var emlformat=require(_0x26e7('0x1'));var rimraf=require(_0x26e7('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x26e7('0x3'));var rp=require(_0x26e7('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x26e7('0x5'));var util=require(_0x26e7('0x6'));var path=require(_0x26e7('0x7'));var sox=require(_0x26e7('0x8'));var csv=require(_0x26e7('0x9'));var ejs=require(_0x26e7('0xa'));var fs=require('fs');var _=require(_0x26e7('0xb'));var squel=require(_0x26e7('0xc'));var crypto=require(_0x26e7('0xd'));var jsforce=require(_0x26e7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x26e7('0x9'));var querystring=require(_0x26e7('0xf'));var Papa=require('papaparse');var Redis=require(_0x26e7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x26e7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x26e7('0x12'));var logger=require(_0x26e7('0x13'))(_0x26e7('0x14'));var utils=require('../../config/utils');var config=require(_0x26e7('0x15'));var db=require(_0x26e7('0x16'))['db'];function respondWithStatusCode(_0x5e3abf,_0x43a733){_0x43a733=_0x43a733||0xcc;return function(_0x5dc7ad){if(_0x5dc7ad){return _0x5e3abf[_0x26e7('0x17')](_0x43a733);}return _0x5e3abf[_0x26e7('0x18')](_0x43a733)['end']();};}function respondWithResult(_0xd11f18,_0x54d06a){_0x54d06a=_0x54d06a||0xc8;return function(_0x408e2d){if(_0x408e2d){return _0xd11f18['status'](_0x54d06a)['json'](_0x408e2d);}};}function respondWithFilteredResult(_0x44fed4,_0x35c67c){return function(_0x1e16c9){if(_0x1e16c9){var _0x2231a3=_0x1e16c9[_0x26e7('0x19')],_0x539a0b=_0x35c67c['offset'],_0x4732f1=_0x35c67c[_0x26e7('0x1a')]+_0x35c67c[_0x26e7('0x1b')],_0x2026a6;if(_0x4732f1>=_0x2231a3){_0x4732f1=_0x2231a3;_0x2026a6=0xc8;}else{_0x2026a6=0xce;}_0x44fed4[_0x26e7('0x18')](_0x2026a6);return _0x44fed4[_0x26e7('0x1c')]('Content-Range',_0x539a0b+'-'+_0x4732f1+'/'+_0x2231a3)[_0x26e7('0x1d')](_0x1e16c9);}return null;};}function patchUpdates(_0x186cdf){return function(_0x576bb1){try{jsonpatch['apply'](_0x576bb1,_0x186cdf,!![]);}catch(_0x3eaf23){return BPromise[_0x26e7('0x1e')](_0x3eaf23);}return _0x576bb1[_0x26e7('0x1f')]();};}function saveUpdates(_0xe83b4f,_0x35f6c9){return function(_0x351951){if(_0x351951){return _0x351951['update'](_0xe83b4f)[_0x26e7('0x20')](function(_0x6a70ba){return _0x6a70ba;});}return null;};}function removeEntity(_0xb4c41d,_0x183745){return function(_0x18f3ad){if(_0x18f3ad){return _0x18f3ad[_0x26e7('0x21')]()[_0x26e7('0x20')](function(){_0xb4c41d[_0x26e7('0x18')](0xcc)[_0x26e7('0x22')]();});}};}function handleEntityNotFound(_0x2b1bbb,_0x55919f){return function(_0x36c6e5){if(!_0x36c6e5){_0x2b1bbb[_0x26e7('0x17')](0x194);}return _0x36c6e5;};}function handleError(_0x410f18,_0x4a94c4){_0x4a94c4=_0x4a94c4||0x1f4;return function(_0x2e3bad){logger['error'](_0x2e3bad[_0x26e7('0x23')]);if(_0x2e3bad[_0x26e7('0x24')]){delete _0x2e3bad[_0x26e7('0x24')];}_0x410f18[_0x26e7('0x18')](_0x4a94c4)[_0x26e7('0x25')](_0x2e3bad);};}exports['index']=function(_0x21cd90,_0x1921e5){var _0x5ddeef={},_0x4ff7f2={},_0x192458={'count':0x0,'rows':[]};var _0x9a8bf7=_['map'](db[_0x26e7('0x26')][_0x26e7('0x27')],function(_0x2d74f2){return{'name':_0x2d74f2[_0x26e7('0x28')],'type':_0x2d74f2[_0x26e7('0x29')][_0x26e7('0x2a')]};});_0x4ff7f2[_0x26e7('0x2b')]=_[_0x26e7('0x2c')](_0x9a8bf7,_0x26e7('0x24'));_0x4ff7f2[_0x26e7('0x2d')]=_[_0x26e7('0x2e')](_0x21cd90[_0x26e7('0x2d')]);_0x4ff7f2[_0x26e7('0x2f')]=_[_0x26e7('0x30')](_0x4ff7f2['model'],_0x4ff7f2[_0x26e7('0x2d')]);_0x5ddeef[_0x26e7('0x31')]=_[_0x26e7('0x30')](_0x4ff7f2[_0x26e7('0x2b')],qs[_0x26e7('0x32')](_0x21cd90[_0x26e7('0x2d')][_0x26e7('0x32')]));_0x5ddeef[_0x26e7('0x31')]=_0x5ddeef[_0x26e7('0x31')][_0x26e7('0x33')]?_0x5ddeef[_0x26e7('0x31')]:_0x4ff7f2[_0x26e7('0x2b')];if(!_0x21cd90[_0x26e7('0x2d')][_0x26e7('0x34')](_0x26e7('0x35'))){_0x5ddeef[_0x26e7('0x1b')]=qs['limit'](_0x21cd90[_0x26e7('0x2d')]['limit']);_0x5ddeef[_0x26e7('0x1a')]=qs[_0x26e7('0x1a')](_0x21cd90[_0x26e7('0x2d')][_0x26e7('0x1a')]);}_0x5ddeef[_0x26e7('0x36')]=qs[_0x26e7('0x37')](_0x21cd90[_0x26e7('0x2d')]['sort']);_0x5ddeef[_0x26e7('0x38')]=qs[_0x26e7('0x2f')](_[_0x26e7('0x39')](_0x21cd90[_0x26e7('0x2d')],_0x4ff7f2[_0x26e7('0x2f')]),_0x9a8bf7);if(_0x21cd90[_0x26e7('0x2d')][_0x26e7('0x3a')]){_0x5ddeef['where']=_[_0x26e7('0x3b')](_0x5ddeef['where'],{'$or':_[_0x26e7('0x2c')](_0x9a8bf7,function(_0x39f2b7){if(_0x39f2b7[_0x26e7('0x29')]!==_0x26e7('0x3c')){var _0x1ee171={};_0x1ee171[_0x39f2b7['name']]={'$like':'%'+_0x21cd90[_0x26e7('0x2d')]['filter']+'%'};return _0x1ee171;}})});}_0x5ddeef=_[_0x26e7('0x3b')]({},_0x5ddeef,_0x21cd90[_0x26e7('0x3d')]);var _0x4604eb={'where':_0x5ddeef['where']};return db['FreshsalesField'][_0x26e7('0x19')](_0x4604eb)[_0x26e7('0x20')](function(_0x48cabe){_0x192458[_0x26e7('0x19')]=_0x48cabe;if(_0x21cd90[_0x26e7('0x2d')][_0x26e7('0x3e')]){_0x5ddeef[_0x26e7('0x3f')]=[{'all':!![]}];}return db[_0x26e7('0x26')][_0x26e7('0x40')](_0x5ddeef);})[_0x26e7('0x20')](function(_0x4e46c0){_0x192458[_0x26e7('0x41')]=_0x4e46c0;return _0x192458;})[_0x26e7('0x20')](respondWithFilteredResult(_0x1921e5,_0x5ddeef))['catch'](handleError(_0x1921e5,null));};exports[_0x26e7('0x42')]=function(_0x3ffe7e,_0x53613a){var _0x303edb={'raw':!![],'where':{'id':_0x3ffe7e['params']['id']}},_0xfbb263={};_0xfbb263[_0x26e7('0x2b')]=_[_0x26e7('0x2e')](db[_0x26e7('0x26')]['rawAttributes']);_0xfbb263[_0x26e7('0x2d')]=_[_0x26e7('0x2e')](_0x3ffe7e[_0x26e7('0x2d')]);_0xfbb263[_0x26e7('0x2f')]=_[_0x26e7('0x30')](_0xfbb263[_0x26e7('0x2b')],_0xfbb263[_0x26e7('0x2d')]);_0x303edb['attributes']=_[_0x26e7('0x30')](_0xfbb263[_0x26e7('0x2b')],qs[_0x26e7('0x32')](_0x3ffe7e['query'][_0x26e7('0x32')]));_0x303edb['attributes']=_0x303edb[_0x26e7('0x31')][_0x26e7('0x33')]?_0x303edb[_0x26e7('0x31')]:_0xfbb263[_0x26e7('0x2b')];if(_0x3ffe7e[_0x26e7('0x2d')][_0x26e7('0x3e')]){_0x303edb[_0x26e7('0x3f')]=[{'all':!![]}];}_0x303edb=_[_0x26e7('0x3b')]({},_0x303edb,_0x3ffe7e[_0x26e7('0x3d')]);return db[_0x26e7('0x26')][_0x26e7('0x43')](_0x303edb)[_0x26e7('0x20')](handleEntityNotFound(_0x53613a,null))[_0x26e7('0x20')](respondWithResult(_0x53613a,null))['catch'](handleError(_0x53613a,null));};exports['create']=function(_0x569aae,_0x304958){return db[_0x26e7('0x26')][_0x26e7('0x44')](_0x569aae[_0x26e7('0x45')],{})[_0x26e7('0x20')](respondWithResult(_0x304958,0xc9))[_0x26e7('0x46')](handleError(_0x304958,null));};exports['update']=function(_0x3ad5f8,_0x550368){if(_0x3ad5f8[_0x26e7('0x45')]['id']){delete _0x3ad5f8['body']['id'];}return db[_0x26e7('0x26')][_0x26e7('0x43')]({'where':{'id':_0x3ad5f8['params']['id']}})['then'](handleEntityNotFound(_0x550368,null))[_0x26e7('0x20')](saveUpdates(_0x3ad5f8[_0x26e7('0x45')],null))[_0x26e7('0x20')](respondWithResult(_0x550368,null))[_0x26e7('0x46')](handleError(_0x550368,null));};exports['destroy']=function(_0x245555,_0x2d9d2d){return db['FreshsalesField'][_0x26e7('0x43')]({'where':{'id':_0x245555[_0x26e7('0x47')]['id']}})['then'](handleEntityNotFound(_0x2d9d2d,null))['then'](removeEntity(_0x2d9d2d,null))[_0x26e7('0x46')](handleError(_0x2d9d2d,null));}; \ No newline at end of file +var _0x1aae=['catch','show','length','includeAll','find','create','body','params','html-pdf','eml-format','rimraf','fast-json-patch','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','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','rawAttributes','fieldName','type','map','query','keys','intersection','model','fields','attributes','nolimit','order','sort','filters','pick','filter','where','merge','FreshsalesField','include','findAll','rows'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x1aae,0xe3));var _0xe1aa=function(_0x129893,_0x46cb1c){_0x129893=_0x129893-0x0;var _0xe061d0=_0x1aae[_0x129893];return _0xe061d0;};'use strict';var pdf=require(_0xe1aa('0x0'));var emlformat=require(_0xe1aa('0x1'));var rimraf=require(_0xe1aa('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe1aa('0x3'));var rp=require('request-promise');var moment=require(_0xe1aa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe1aa('0x5'));var util=require(_0xe1aa('0x6'));var path=require('path');var sox=require(_0xe1aa('0x7'));var csv=require(_0xe1aa('0x8'));var ejs=require(_0xe1aa('0x9'));var fs=require('fs');var _=require(_0xe1aa('0xa'));var squel=require(_0xe1aa('0xb'));var crypto=require(_0xe1aa('0xc'));var jsforce=require(_0xe1aa('0xd'));var deskjs=require(_0xe1aa('0xe'));var toCsv=require(_0xe1aa('0x8'));var querystring=require(_0xe1aa('0xf'));var Papa=require(_0xe1aa('0x10'));var Redis=require(_0xe1aa('0x11'));var authService=require(_0xe1aa('0x12'));var qs=require(_0xe1aa('0x13'));var as=require(_0xe1aa('0x14'));var hardwareService=require(_0xe1aa('0x15'));var logger=require('../../config/logger')(_0xe1aa('0x16'));var utils=require(_0xe1aa('0x17'));var config=require(_0xe1aa('0x18'));var db=require(_0xe1aa('0x19'))['db'];function respondWithStatusCode(_0x7de390,_0x38fc91){_0x38fc91=_0x38fc91||0xcc;return function(_0x54d066){if(_0x54d066){return _0x7de390['sendStatus'](_0x38fc91);}return _0x7de390[_0xe1aa('0x1a')](_0x38fc91)[_0xe1aa('0x1b')]();};}function respondWithResult(_0x5eb1b7,_0x2a6398){_0x2a6398=_0x2a6398||0xc8;return function(_0x186781){if(_0x186781){return _0x5eb1b7['status'](_0x2a6398)[_0xe1aa('0x1c')](_0x186781);}};}function respondWithFilteredResult(_0x24a3bb,_0xfee8bf){return function(_0x2914c1){if(_0x2914c1){var _0x162929=_0x2914c1[_0xe1aa('0x1d')],_0x2671de=_0xfee8bf[_0xe1aa('0x1e')],_0x2d5817=_0xfee8bf[_0xe1aa('0x1e')]+_0xfee8bf[_0xe1aa('0x1f')],_0x427da2;if(_0x2d5817>=_0x162929){_0x2d5817=_0x162929;_0x427da2=0xc8;}else{_0x427da2=0xce;}_0x24a3bb['status'](_0x427da2);return _0x24a3bb[_0xe1aa('0x20')](_0xe1aa('0x21'),_0x2671de+'-'+_0x2d5817+'/'+_0x162929)['json'](_0x2914c1);}return null;};}function patchUpdates(_0x431a57){return function(_0x419955){try{jsonpatch['apply'](_0x419955,_0x431a57,!![]);}catch(_0x20dd23){return BPromise[_0xe1aa('0x22')](_0x20dd23);}return _0x419955[_0xe1aa('0x23')]();};}function saveUpdates(_0x810d12,_0x464e93){return function(_0x53ba95){if(_0x53ba95){return _0x53ba95[_0xe1aa('0x24')](_0x810d12)[_0xe1aa('0x25')](function(_0x5c6fe3){return _0x5c6fe3;});}return null;};}function removeEntity(_0x4b542c,_0x451fe7){return function(_0x2f3dbd){if(_0x2f3dbd){return _0x2f3dbd[_0xe1aa('0x26')]()[_0xe1aa('0x25')](function(){_0x4b542c[_0xe1aa('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4341e7,_0xee2e3b){return function(_0x4a2fc2){if(!_0x4a2fc2){_0x4341e7['sendStatus'](0x194);}return _0x4a2fc2;};}function handleError(_0x3c81ba,_0x2e9fd0){_0x2e9fd0=_0x2e9fd0||0x1f4;return function(_0x230b75){logger[_0xe1aa('0x27')](_0x230b75[_0xe1aa('0x28')]);if(_0x230b75[_0xe1aa('0x29')]){delete _0x230b75[_0xe1aa('0x29')];}_0x3c81ba[_0xe1aa('0x1a')](_0x2e9fd0)['send'](_0x230b75);};}exports[_0xe1aa('0x2a')]=function(_0x585e09,_0x35bab8){var _0x38225f={},_0x336f3f={},_0x14154a={'count':0x0,'rows':[]};var _0x40b93b=_['map'](db['FreshsalesField'][_0xe1aa('0x2b')],function(_0x568376){return{'name':_0x568376[_0xe1aa('0x2c')],'type':_0x568376[_0xe1aa('0x2d')]['key']};});_0x336f3f['model']=_[_0xe1aa('0x2e')](_0x40b93b,_0xe1aa('0x29'));_0x336f3f[_0xe1aa('0x2f')]=_[_0xe1aa('0x30')](_0x585e09[_0xe1aa('0x2f')]);_0x336f3f['filters']=_[_0xe1aa('0x31')](_0x336f3f['model'],_0x336f3f[_0xe1aa('0x2f')]);_0x38225f['attributes']=_[_0xe1aa('0x31')](_0x336f3f[_0xe1aa('0x32')],qs[_0xe1aa('0x33')](_0x585e09['query']['fields']));_0x38225f['attributes']=_0x38225f[_0xe1aa('0x34')]['length']?_0x38225f[_0xe1aa('0x34')]:_0x336f3f[_0xe1aa('0x32')];if(!_0x585e09[_0xe1aa('0x2f')]['hasOwnProperty'](_0xe1aa('0x35'))){_0x38225f['limit']=qs[_0xe1aa('0x1f')](_0x585e09[_0xe1aa('0x2f')][_0xe1aa('0x1f')]);_0x38225f[_0xe1aa('0x1e')]=qs[_0xe1aa('0x1e')](_0x585e09['query'][_0xe1aa('0x1e')]);}_0x38225f[_0xe1aa('0x36')]=qs[_0xe1aa('0x37')](_0x585e09[_0xe1aa('0x2f')][_0xe1aa('0x37')]);_0x38225f['where']=qs[_0xe1aa('0x38')](_[_0xe1aa('0x39')](_0x585e09['query'],_0x336f3f[_0xe1aa('0x38')]),_0x40b93b);if(_0x585e09[_0xe1aa('0x2f')][_0xe1aa('0x3a')]){_0x38225f[_0xe1aa('0x3b')]=_[_0xe1aa('0x3c')](_0x38225f[_0xe1aa('0x3b')],{'$or':_['map'](_0x40b93b,function(_0x443ddd){if(_0x443ddd[_0xe1aa('0x2d')]!=='VIRTUAL'){var _0x3d8423={};_0x3d8423[_0x443ddd[_0xe1aa('0x29')]]={'$like':'%'+_0x585e09['query'][_0xe1aa('0x3a')]+'%'};return _0x3d8423;}})});}_0x38225f=_[_0xe1aa('0x3c')]({},_0x38225f,_0x585e09['options']);var _0x20a017={'where':_0x38225f[_0xe1aa('0x3b')]};return db[_0xe1aa('0x3d')][_0xe1aa('0x1d')](_0x20a017)['then'](function(_0x1d3522){_0x14154a[_0xe1aa('0x1d')]=_0x1d3522;if(_0x585e09['query']['includeAll']){_0x38225f[_0xe1aa('0x3e')]=[{'all':!![]}];}return db[_0xe1aa('0x3d')][_0xe1aa('0x3f')](_0x38225f);})[_0xe1aa('0x25')](function(_0x3efa42){_0x14154a[_0xe1aa('0x40')]=_0x3efa42;return _0x14154a;})['then'](respondWithFilteredResult(_0x35bab8,_0x38225f))[_0xe1aa('0x41')](handleError(_0x35bab8,null));};exports[_0xe1aa('0x42')]=function(_0x2ad554,_0x197a07){var _0x9d05c={'raw':!![],'where':{'id':_0x2ad554['params']['id']}},_0x56f627={};_0x56f627[_0xe1aa('0x32')]=_[_0xe1aa('0x30')](db[_0xe1aa('0x3d')][_0xe1aa('0x2b')]);_0x56f627[_0xe1aa('0x2f')]=_['keys'](_0x2ad554[_0xe1aa('0x2f')]);_0x56f627[_0xe1aa('0x38')]=_['intersection'](_0x56f627[_0xe1aa('0x32')],_0x56f627['query']);_0x9d05c[_0xe1aa('0x34')]=_['intersection'](_0x56f627[_0xe1aa('0x32')],qs[_0xe1aa('0x33')](_0x2ad554[_0xe1aa('0x2f')][_0xe1aa('0x33')]));_0x9d05c[_0xe1aa('0x34')]=_0x9d05c['attributes'][_0xe1aa('0x43')]?_0x9d05c[_0xe1aa('0x34')]:_0x56f627[_0xe1aa('0x32')];if(_0x2ad554['query'][_0xe1aa('0x44')]){_0x9d05c[_0xe1aa('0x3e')]=[{'all':!![]}];}_0x9d05c=_[_0xe1aa('0x3c')]({},_0x9d05c,_0x2ad554['options']);return db['FreshsalesField'][_0xe1aa('0x45')](_0x9d05c)[_0xe1aa('0x25')](handleEntityNotFound(_0x197a07,null))[_0xe1aa('0x25')](respondWithResult(_0x197a07,null))[_0xe1aa('0x41')](handleError(_0x197a07,null));};exports[_0xe1aa('0x46')]=function(_0x167081,_0x26202e){return db['FreshsalesField'][_0xe1aa('0x46')](_0x167081[_0xe1aa('0x47')],{})['then'](respondWithResult(_0x26202e,0xc9))[_0xe1aa('0x41')](handleError(_0x26202e,null));};exports[_0xe1aa('0x24')]=function(_0x451da1,_0x53a7da){if(_0x451da1[_0xe1aa('0x47')]['id']){delete _0x451da1['body']['id'];}return db['FreshsalesField'][_0xe1aa('0x45')]({'where':{'id':_0x451da1[_0xe1aa('0x48')]['id']}})[_0xe1aa('0x25')](handleEntityNotFound(_0x53a7da,null))[_0xe1aa('0x25')](saveUpdates(_0x451da1[_0xe1aa('0x47')],null))[_0xe1aa('0x25')](respondWithResult(_0x53a7da,null))[_0xe1aa('0x41')](handleError(_0x53a7da,null));};exports[_0xe1aa('0x26')]=function(_0x2ca7d8,_0x391d72){return db['FreshsalesField'][_0xe1aa('0x45')]({'where':{'id':_0x2ca7d8[_0xe1aa('0x48')]['id']}})[_0xe1aa('0x25')](handleEntityNotFound(_0x391d72,null))[_0xe1aa('0x25')](removeEntity(_0x391d72,null))[_0xe1aa('0x41')](handleError(_0x391d72,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 6e86e1b..5fc79b5 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 _0xf48d=['request-promise','path','rimraf','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','idField','FieldId','lodash','util','../../config/logger','api','bluebird'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xf48d,0xeb));var _0xdf48=function(_0x25f334,_0x44aab9){_0x25f334=_0x25f334-0x0;var _0x11fb6e=_0xf48d[_0x25f334];return _0x11fb6e;};'use strict';var _=require(_0xdf48('0x0'));var util=require(_0xdf48('0x1'));var logger=require(_0xdf48('0x2'))(_0xdf48('0x3'));var moment=require('moment');var BPromise=require(_0xdf48('0x4'));var rp=require(_0xdf48('0x5'));var fs=require('fs');var path=require(_0xdf48('0x6'));var rimraf=require(_0xdf48('0x7'));var config=require('../../config/environment');var attributes=require(_0xdf48('0x8'));module[_0xdf48('0x9')]=function(_0x51428e,_0x234565){return _0x51428e[_0xdf48('0xa')](_0xdf48('0xb'),attributes,{'tableName':_0xdf48('0xc'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xdf48('0xd'),_0xdf48('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbf38=['bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x42dbc4,_0x523fb0){var _0x3ef3ab=function(_0x5c5999){while(--_0x5c5999){_0x42dbc4['push'](_0x42dbc4['shift']());}};_0x3ef3ab(++_0x523fb0);}(_0xbf38,0xfa));var _0x8bf3=function(_0x4df59e,_0x3a96ac){_0x4df59e=_0x4df59e-0x0;var _0x2a888a=_0xbf38[_0x4df59e];return _0x2a888a;};'use strict';var _=require(_0x8bf3('0x0'));var util=require(_0x8bf3('0x1'));var logger=require(_0x8bf3('0x2'))(_0x8bf3('0x3'));var moment=require(_0x8bf3('0x4'));var BPromise=require(_0x8bf3('0x5'));var rp=require(_0x8bf3('0x6'));var fs=require('fs');var path=require(_0x8bf3('0x7'));var rimraf=require(_0x8bf3('0x8'));var config=require(_0x8bf3('0x9'));var attributes=require(_0x8bf3('0xa'));module[_0x8bf3('0xb')]=function(_0x52a204,_0x339eb7){return _0x52a204[_0x8bf3('0xc')](_0x8bf3('0xd'),attributes,{'tableName':_0x8bf3('0xe'),'paranoid':![],'indexes':[{'name':_0x8bf3('0xf'),'fields':['idField',_0x8bf3('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 1dd4cfd..6684994 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 _0xf687=['catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x51674a,_0x77ccff){var _0x13fca6=function(_0x3d6c27){while(--_0x3d6c27){_0x51674a['push'](_0x51674a['shift']());}};_0x13fca6(++_0x77ccff);}(_0xf687,0x1cf));var _0x7f68=function(_0x431970,_0x3d390b){_0x431970=_0x431970-0x0;var _0x3a347a=_0xf687[_0x431970];return _0x3a347a;};'use strict';var _=require(_0x7f68('0x0'));var util=require(_0x7f68('0x1'));var moment=require(_0x7f68('0x2'));var BPromise=require('bluebird');var rs=require(_0x7f68('0x3'));var fs=require('fs');var Redis=require(_0x7f68('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7f68('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x7f68('0x6'));var jayson=require(_0x7f68('0x7'));var client=jayson[_0x7f68('0x8')][_0x7f68('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4af3ac,_0x33294c,_0x10ad14){return new BPromise(function(_0x159091,_0x4f135c){return client[_0x7f68('0xa')](_0x4af3ac,_0x10ad14)['then'](function(_0x14e878){logger[_0x7f68('0xb')](_0x7f68('0xc'),_0x33294c,_0x7f68('0xd'));logger[_0x7f68('0xe')](_0x7f68('0xf'),_0x33294c,_0x7f68('0xd'),JSON['stringify'](_0x14e878));if(_0x14e878[_0x7f68('0x10')]){if(_0x14e878[_0x7f68('0x10')][_0x7f68('0x11')]===0x1f4){logger[_0x7f68('0x10')](_0x7f68('0xc'),_0x33294c,_0x14e878['error']['message']);return _0x4f135c(_0x14e878['error'][_0x7f68('0x12')]);}logger[_0x7f68('0x10')](_0x7f68('0xc'),_0x33294c,_0x14e878[_0x7f68('0x10')]['message']);return _0x159091(_0x14e878[_0x7f68('0x10')][_0x7f68('0x12')]);}else{logger[_0x7f68('0xb')](_0x7f68('0xc'),_0x33294c,_0x7f68('0xd'));_0x159091(_0x14e878[_0x7f68('0x13')][_0x7f68('0x12')]);}})[_0x7f68('0x14')](function(_0x7ea0b4){logger[_0x7f68('0x10')](_0x7f68('0xc'),_0x33294c,_0x7ea0b4);_0x4f135c(_0x7ea0b4);});});} \ No newline at end of file +var _0x9173=['debug','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x9173,0x7e));var _0x3917=function(_0x53ae5b,_0xf7f0a3){_0x53ae5b=_0x53ae5b-0x0;var _0x25ac8b=_0x9173[_0x53ae5b];return _0x25ac8b;};'use strict';var _=require(_0x3917('0x0'));var util=require(_0x3917('0x1'));var moment=require(_0x3917('0x2'));var BPromise=require(_0x3917('0x3'));var rs=require(_0x3917('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3917('0x5'))['db'];var utils=require(_0x3917('0x6'));var logger=require('../../config/logger')(_0x3917('0x7'));var config=require('../../config/environment');var jayson=require(_0x3917('0x8'));var client=jayson['client'][_0x3917('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x280d8f,_0xe3dcdb,_0x448429){return new BPromise(function(_0x558e86,_0x4284c1){return client[_0x3917('0xa')](_0x280d8f,_0x448429)['then'](function(_0x424d39){logger[_0x3917('0xb')](_0x3917('0xc'),_0xe3dcdb,_0x3917('0xd'));logger[_0x3917('0xe')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0xe3dcdb,_0x3917('0xd'),JSON['stringify'](_0x424d39));if(_0x424d39['error']){if(_0x424d39['error'][_0x3917('0xf')]===0x1f4){logger['error'](_0x3917('0xc'),_0xe3dcdb,_0x424d39[_0x3917('0x10')][_0x3917('0x11')]);return _0x4284c1(_0x424d39[_0x3917('0x10')][_0x3917('0x11')]);}logger[_0x3917('0x10')](_0x3917('0xc'),_0xe3dcdb,_0x424d39[_0x3917('0x10')][_0x3917('0x11')]);return _0x558e86(_0x424d39[_0x3917('0x10')][_0x3917('0x11')]);}else{logger[_0x3917('0xb')](_0x3917('0xc'),_0xe3dcdb,'request\x20sent');_0x558e86(_0x424d39[_0x3917('0x12')][_0x3917('0x11')]);}})[_0x3917('0x13')](function(_0x21f405){logger[_0x3917('0x10')]('FreshsalesField,\x20%s,\x20%s',_0xe3dcdb,_0x21f405);_0x4284c1(_0x21f405);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 5e51b45..cd7db72 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 _0x7fec=['index','show','/:id/fields','getFields','post','/:id/configurations','put','update','delete','/:id','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0x7fec,0x6e));var _0xc7fe=function(_0xe786c6,_0x3ebef3){_0xe786c6=_0xe786c6-0x0;var _0x10ef03=_0x7fec[_0xe786c6];return _0x10ef03;};'use strict';var multer=require(_0xc7fe('0x0'));var util=require(_0xc7fe('0x1'));var path=require(_0xc7fe('0x2'));var timeout=require(_0xc7fe('0x3'));var express=require(_0xc7fe('0x4'));var router=express[_0xc7fe('0x5')]();var auth=require(_0xc7fe('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc7fe('0x7'));var controller=require('./intSalesforceAccount.controller');router[_0xc7fe('0x8')]('/',auth[_0xc7fe('0x9')](),controller[_0xc7fe('0xa')]);router['get']('/:id',auth[_0xc7fe('0x9')](),controller[_0xc7fe('0xb')]);router[_0xc7fe('0x8')]('/:id/configurations',auth[_0xc7fe('0x9')](),controller['getConfigurations']);router['get'](_0xc7fe('0xc'),auth[_0xc7fe('0x9')](),controller[_0xc7fe('0xd')]);router['post']('/',auth[_0xc7fe('0x9')](),controller['create']);router[_0xc7fe('0xe')](_0xc7fe('0xf'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xc7fe('0x10')]('/:id',auth[_0xc7fe('0x9')](),controller[_0xc7fe('0x11')]);router[_0xc7fe('0x12')](_0xc7fe('0x13'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x78ee=['addConfiguration','put','/:id','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','isAuthenticated','index','get','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create'];(function(_0x546bf4,_0x293a4d){var _0x23ecd5=function(_0x55a6c1){while(--_0x55a6c1){_0x546bf4['push'](_0x546bf4['shift']());}};_0x23ecd5(++_0x293a4d);}(_0x78ee,0x1d2));var _0xe78e=function(_0x4c0c03,_0x2d5db1){_0x4c0c03=_0x4c0c03-0x0;var _0x4d1916=_0x78ee[_0x4c0c03];return _0x4d1916;};'use strict';var multer=require(_0xe78e('0x0'));var util=require(_0xe78e('0x1'));var path=require(_0xe78e('0x2'));var timeout=require(_0xe78e('0x3'));var express=require('express');var router=express[_0xe78e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xe78e('0x5'));var config=require(_0xe78e('0x6'));var controller=require(_0xe78e('0x7'));router['get']('/',auth[_0xe78e('0x8')](),controller[_0xe78e('0x9')]);router[_0xe78e('0xa')]('/:id',auth[_0xe78e('0x8')](),controller[_0xe78e('0xb')]);router[_0xe78e('0xa')](_0xe78e('0xc'),auth['isAuthenticated'](),controller[_0xe78e('0xd')]);router['get'](_0xe78e('0xe'),auth[_0xe78e('0x8')](),controller[_0xe78e('0xf')]);router[_0xe78e('0x10')]('/',auth[_0xe78e('0x8')](),controller[_0xe78e('0x11')]);router[_0xe78e('0x10')]('/:id/configurations',auth[_0xe78e('0x8')](),controller[_0xe78e('0x12')]);router[_0xe78e('0x13')](_0xe78e('0x14'),auth[_0xe78e('0x8')](),controller['update']);router['delete'](_0xe78e('0x14'),auth['isAuthenticated'](),controller['destroy']);module[_0xe78e('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 880e84f..70643bc 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(_0x23e2bb,_0xd82b6d){var _0x2dd8ed=function(_0x4af0ce){while(--_0x4af0ce){_0x23e2bb['push'](_0x23e2bb['shift']());}};_0x2dd8ed(++_0xd82b6d);}(_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 _0x53ec=['ENUM','newTab','integrationTab','sequelize','exports','STRING','username'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x53ec,0x192));var _0xc53e=function(_0x5a123f,_0x14cb93){_0x5a123f=_0x5a123f-0x0;var _0x40f3e8=_0x53ec[_0x5a123f];return _0x40f3e8;};'use strict';var Sequelize=require(_0xc53e('0x0'));module[_0xc53e('0x1')]={'name':{'type':Sequelize[_0xc53e('0x2')]},'description':{'type':Sequelize[_0xc53e('0x2')]},'username':{'type':Sequelize[_0xc53e('0x2')],'unique':_0xc53e('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xc53e('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xc53e('0x2')]},'securityToken':{'type':Sequelize[_0xc53e('0x2')]},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xc53e('0x4')]('integrationTab',_0xc53e('0x5')),'defaultValue':_0xc53e('0x6')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 7574c12..806040b 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 _0x2987=['findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','clientId','clientSecret','password','securityToken','remoteUri','slice','substring','Connection','login','concat','ticketType','sobject','describe','CallDisposition','CallObject','CallType','IsArchived','Priority','Status','Type','isNil','Case','Reason','IsEscalated','SuppliedName','SuppliedCompany','remove','custom','includes','label','picklistValues','value','boolean','True','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','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','../../components/integrations/configuration','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','stack','name','send','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','SalesforceAccount','includeAll','findAll','rows','show','params','keys','rawAttributes','include','find','create','body','destroy','getConfigurations','SalesforceConfiguration','addConfiguration'];(function(_0x38a7e7,_0x3fd3ad){var _0x5c6a2c=function(_0x48cc68){while(--_0x48cc68){_0x38a7e7['push'](_0x38a7e7['shift']());}};_0x5c6a2c(++_0x3fd3ad);}(_0x2987,0xbf));var _0x7298=function(_0xdff763,_0x477c10){_0xdff763=_0xdff763-0x0;var _0x99390e=_0x2987[_0xdff763];return _0x99390e;};'use strict';var pdf=require(_0x7298('0x0'));var emlformat=require(_0x7298('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7298('0x2'));var jsonpatch=require(_0x7298('0x3'));var rp=require(_0x7298('0x4'));var moment=require(_0x7298('0x5'));var BPromise=require(_0x7298('0x6'));var Mustache=require('mustache');var util=require(_0x7298('0x7'));var path=require(_0x7298('0x8'));var sox=require('sox');var csv=require(_0x7298('0x9'));var ejs=require(_0x7298('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7298('0xb'));var crypto=require(_0x7298('0xc'));var jsforce=require(_0x7298('0xd'));var deskjs=require(_0x7298('0xe'));var toCsv=require(_0x7298('0x9'));var querystring=require(_0x7298('0xf'));var Papa=require(_0x7298('0x10'));var Redis=require(_0x7298('0x11'));var authService=require(_0x7298('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7298('0x13'));var hardwareService=require(_0x7298('0x14'));var logger=require('../../config/logger')(_0x7298('0x15'));var utils=require(_0x7298('0x16'));var config=require(_0x7298('0x17'));var db=require(_0x7298('0x18'))['db'];var integrations=require(_0x7298('0x19'));var jayson=require(_0x7298('0x1a'));var client=jayson['client'][_0x7298('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x4e5c1f,_0x45c74f,_0x1996b8){if(_0x1996b8){var _0x157fed=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x157fed[_0x7298('0x1c')](_0x45c74f)){return _0x4e5c1f;}else{throw new db[(_0x7298('0x1d'))][(_0x7298('0x1e'))](_0x7298('0x1f'));}}else{return _0x4e5c1f;}}function respondWithRpcPromise(_0x564d0e,_0x40ac01,_0x35d002,_0x3aa799){return new BPromise(function(_0x1fb771,_0x1a07bb){var _0x21b0bb=_0x3aa799||client;return _0x21b0bb[_0x7298('0x20')](_0x564d0e,_0x35d002)['then'](function(_0x2b4f2d){logger[_0x7298('0x21')](_0x7298('0x22'),_0x40ac01,_0x7298('0x23'));logger['debug'](_0x7298('0x24'),_0x40ac01,_0x7298('0x23'),JSON[_0x7298('0x25')](_0x2b4f2d));if(_0x2b4f2d[_0x7298('0x26')]){if(_0x2b4f2d['error'][_0x7298('0x27')]===0x1f4){logger[_0x7298('0x26')](_0x7298('0x22'),_0x40ac01,_0x2b4f2d[_0x7298('0x26')][_0x7298('0x28')]);return _0x1a07bb(_0x2b4f2d['error'][_0x7298('0x28')]);}logger[_0x7298('0x26')](_0x7298('0x22'),_0x40ac01,_0x2b4f2d[_0x7298('0x26')][_0x7298('0x28')]);return _0x1fb771(_0x2b4f2d[_0x7298('0x26')][_0x7298('0x28')]);}else{logger[_0x7298('0x21')](_0x7298('0x22'),_0x40ac01,'request\x20sent');_0x1fb771(_0x2b4f2d['result'][_0x7298('0x28')]);}})[_0x7298('0x29')](function(_0x3d249b){logger[_0x7298('0x26')](_0x7298('0x22'),_0x40ac01,_0x3d249b);_0x1a07bb(_0x3d249b);});});}function respondWithStatusCode(_0x163eb6,_0x3a64d0){_0x3a64d0=_0x3a64d0||0xcc;return function(_0x42887e){if(_0x42887e){return _0x163eb6[_0x7298('0x2a')](_0x3a64d0);}return _0x163eb6[_0x7298('0x2b')](_0x3a64d0)[_0x7298('0x2c')]();};}function respondWithResult(_0xf2104b,_0x1df152){_0x1df152=_0x1df152||0xc8;return function(_0x2dfef3){if(_0x2dfef3){return _0xf2104b[_0x7298('0x2b')](_0x1df152)[_0x7298('0x2d')](_0x2dfef3);}};}function respondWithFilteredResult(_0x8dec6a,_0x24b163){return function(_0x392a43){if(_0x392a43){var _0x2af10a=_0x392a43[_0x7298('0x2e')],_0x2c9e4d=_0x24b163[_0x7298('0x2f')],_0x9e7971=_0x24b163[_0x7298('0x2f')]+_0x24b163[_0x7298('0x30')],_0x3ccb99;if(_0x9e7971>=_0x2af10a){_0x9e7971=_0x2af10a;_0x3ccb99=0xc8;}else{_0x3ccb99=0xce;}_0x8dec6a['status'](_0x3ccb99);return _0x8dec6a['set'](_0x7298('0x31'),_0x2c9e4d+'-'+_0x9e7971+'/'+_0x2af10a)[_0x7298('0x2d')](_0x392a43);}return null;};}function patchUpdates(_0x226534){return function(_0x188fd6){try{jsonpatch[_0x7298('0x32')](_0x188fd6,_0x226534,!![]);}catch(_0x15887c){return BPromise[_0x7298('0x33')](_0x15887c);}return _0x188fd6[_0x7298('0x34')]();};}function saveUpdates(_0x1116aa,_0x4f91aa){return function(_0x282fdc){if(_0x282fdc){return _0x282fdc['update'](_0x1116aa)['then'](function(_0x34428a){return _0x34428a;});}return null;};}function removeEntity(_0x4ed628,_0x3e967b){return function(_0x4c543b){if(_0x4c543b){return _0x4c543b['destroy']()[_0x7298('0x35')](function(){_0x4ed628[_0x7298('0x2b')](0xcc)[_0x7298('0x2c')]();});}};}function handleEntityNotFound(_0x23f01f,_0x3121b9){return function(_0x369446){if(!_0x369446){_0x23f01f[_0x7298('0x2a')](0x194);}return _0x369446;};}function handleError(_0x2519b,_0xa83cd4){_0xa83cd4=_0xa83cd4||0x1f4;return function(_0x35cfc2){logger['error'](_0x35cfc2[_0x7298('0x36')]);if(_0x35cfc2[_0x7298('0x37')]){delete _0x35cfc2[_0x7298('0x37')];}_0x2519b[_0x7298('0x2b')](_0xa83cd4)[_0x7298('0x38')](_0x35cfc2);};}exports['index']=function(_0x506ea4,_0x311c94){var _0x47c0a9={},_0x33f012={},_0x1fdc34={'count':0x0,'rows':[]};var _0x1fc23c=_[_0x7298('0x39')](db['SalesforceAccount']['rawAttributes'],function(_0x336859){return{'name':_0x336859[_0x7298('0x3a')],'type':_0x336859[_0x7298('0x3b')][_0x7298('0x3c')]};});_0x33f012[_0x7298('0x3d')]=_['map'](_0x1fc23c,_0x7298('0x37'));_0x33f012[_0x7298('0x3e')]=_['keys'](_0x506ea4['query']);_0x33f012[_0x7298('0x3f')]=_[_0x7298('0x40')](_0x33f012[_0x7298('0x3d')],_0x33f012[_0x7298('0x3e')]);_0x47c0a9['attributes']=_[_0x7298('0x40')](_0x33f012[_0x7298('0x3d')],qs[_0x7298('0x41')](_0x506ea4[_0x7298('0x3e')][_0x7298('0x41')]));_0x47c0a9[_0x7298('0x42')]=_0x47c0a9['attributes'][_0x7298('0x43')]?_0x47c0a9[_0x7298('0x42')]:_0x33f012['model'];if(!_0x506ea4['query'][_0x7298('0x44')](_0x7298('0x45'))){_0x47c0a9['limit']=qs[_0x7298('0x30')](_0x506ea4[_0x7298('0x3e')][_0x7298('0x30')]);_0x47c0a9['offset']=qs[_0x7298('0x2f')](_0x506ea4[_0x7298('0x3e')]['offset']);}_0x47c0a9[_0x7298('0x46')]=qs[_0x7298('0x47')](_0x506ea4['query'][_0x7298('0x47')]);_0x47c0a9[_0x7298('0x48')]=qs[_0x7298('0x3f')](_[_0x7298('0x49')](_0x506ea4[_0x7298('0x3e')],_0x33f012[_0x7298('0x3f')]),_0x1fc23c);if(_0x506ea4[_0x7298('0x3e')][_0x7298('0x4a')]){_0x47c0a9[_0x7298('0x48')]=_['merge'](_0x47c0a9[_0x7298('0x48')],{'$or':_[_0x7298('0x39')](_0x1fc23c,function(_0x4b5c07){if(_0x4b5c07[_0x7298('0x3b')]!=='VIRTUAL'){var _0x22ce41={};_0x22ce41[_0x4b5c07[_0x7298('0x37')]]={'$like':'%'+_0x506ea4[_0x7298('0x3e')][_0x7298('0x4a')]+'%'};return _0x22ce41;}})});}_0x47c0a9=_[_0x7298('0x4b')]({},_0x47c0a9,_0x506ea4[_0x7298('0x4c')]);var _0x4e8c1b={'where':_0x47c0a9[_0x7298('0x48')]};return db[_0x7298('0x4d')][_0x7298('0x2e')](_0x4e8c1b)[_0x7298('0x35')](function(_0x52a23d){_0x1fdc34[_0x7298('0x2e')]=_0x52a23d;if(_0x506ea4[_0x7298('0x3e')][_0x7298('0x4e')]){_0x47c0a9['include']=[{'all':!![]}];}return db['SalesforceAccount'][_0x7298('0x4f')](_0x47c0a9);})['then'](function(_0x194e37){_0x1fdc34[_0x7298('0x50')]=_0x194e37;return _0x1fdc34;})[_0x7298('0x35')](respondWithFilteredResult(_0x311c94,_0x47c0a9))[_0x7298('0x29')](handleError(_0x311c94,null));};exports[_0x7298('0x51')]=function(_0x566f70,_0x1872c9){var _0x347d96={'raw':![],'where':{'id':_0x566f70[_0x7298('0x52')]['id']}},_0x22d0e8={};_0x22d0e8[_0x7298('0x3d')]=_[_0x7298('0x53')](db[_0x7298('0x4d')][_0x7298('0x54')]);_0x22d0e8[_0x7298('0x3e')]=_[_0x7298('0x53')](_0x566f70[_0x7298('0x3e')]);_0x22d0e8[_0x7298('0x3f')]=_['intersection'](_0x22d0e8[_0x7298('0x3d')],_0x22d0e8[_0x7298('0x3e')]);_0x347d96[_0x7298('0x42')]=_[_0x7298('0x40')](_0x22d0e8[_0x7298('0x3d')],qs[_0x7298('0x41')](_0x566f70[_0x7298('0x3e')][_0x7298('0x41')]));_0x347d96['attributes']=_0x347d96[_0x7298('0x42')][_0x7298('0x43')]?_0x347d96[_0x7298('0x42')]:_0x22d0e8[_0x7298('0x3d')];if(_0x566f70[_0x7298('0x3e')][_0x7298('0x4e')]){_0x347d96[_0x7298('0x55')]=[{'all':!![]}];}_0x347d96=_[_0x7298('0x4b')]({},_0x347d96,_0x566f70[_0x7298('0x4c')]);return db[_0x7298('0x4d')][_0x7298('0x56')](_0x347d96)[_0x7298('0x35')](handleEntityNotFound(_0x1872c9,null))['then'](respondWithResult(_0x1872c9,null))[_0x7298('0x29')](handleError(_0x1872c9,null));};exports[_0x7298('0x57')]=function(_0x44c00f,_0x1d66bb){return db[_0x7298('0x4d')][_0x7298('0x57')](_0x44c00f[_0x7298('0x58')],{})[_0x7298('0x35')](respondWithResult(_0x1d66bb,0xc9))[_0x7298('0x29')](handleError(_0x1d66bb,null));};exports['update']=function(_0x442984,_0x22b262){if(_0x442984['body']['id']){delete _0x442984[_0x7298('0x58')]['id'];}return db[_0x7298('0x4d')][_0x7298('0x56')]({'where':{'id':_0x442984[_0x7298('0x52')]['id']}})[_0x7298('0x35')](handleEntityNotFound(_0x22b262,null))['then'](saveUpdates(_0x442984['body'],null))[_0x7298('0x35')](respondWithResult(_0x22b262,null))['catch'](handleError(_0x22b262,null));};exports[_0x7298('0x59')]=function(_0x49e2bd,_0x273831){return db[_0x7298('0x4d')][_0x7298('0x56')]({'where':{'id':_0x49e2bd[_0x7298('0x52')]['id']}})['then'](handleEntityNotFound(_0x273831,null))['then'](removeEntity(_0x273831,null))[_0x7298('0x29')](handleError(_0x273831,null));};exports[_0x7298('0x5a')]=function(_0x53f91b,_0x320212,_0x4cb863){var _0xf3b0eb={};var _0x42697e={};var _0x461731;var _0x18fec0;return db['SalesforceAccount']['findOne']({'where':{'id':_0x53f91b['params']['id']}})[_0x7298('0x35')](handleEntityNotFound(_0x320212,null))[_0x7298('0x35')](function(_0x294e6e){if(_0x294e6e){_0x461731=_0x294e6e;_0x42697e[_0x7298('0x3d')]=_['keys'](db[_0x7298('0x5b')][_0x7298('0x54')]);_0x42697e[_0x7298('0x3e')]=_[_0x7298('0x53')](_0x53f91b['query']);_0x42697e['filters']=_[_0x7298('0x40')](_0x42697e['model'],_0x42697e[_0x7298('0x3e')]);_0xf3b0eb['attributes']=_[_0x7298('0x40')](_0x42697e[_0x7298('0x3d')],qs[_0x7298('0x41')](_0x53f91b['query']['fields']));_0xf3b0eb[_0x7298('0x42')]=_0xf3b0eb[_0x7298('0x42')][_0x7298('0x43')]?_0xf3b0eb[_0x7298('0x42')]:_0x42697e['model'];_0xf3b0eb['order']=qs[_0x7298('0x47')](_0x53f91b['query']['sort']);_0xf3b0eb['where']=qs[_0x7298('0x3f')](_[_0x7298('0x49')](_0x53f91b[_0x7298('0x3e')],_0x42697e[_0x7298('0x3f')]));if(_0x53f91b['query']['filter']){_0xf3b0eb[_0x7298('0x48')]=_[_0x7298('0x4b')](_0xf3b0eb[_0x7298('0x48')],{'$or':_[_0x7298('0x39')](_0xf3b0eb[_0x7298('0x42')],function(_0x3f9502){var _0x346228={};_0x346228[_0x3f9502]={'$like':'%'+_0x53f91b['query']['filter']+'%'};return _0x346228;})});}_0xf3b0eb=_[_0x7298('0x4b')]({},_0xf3b0eb,_0x53f91b['options']);return _0x461731['getConfigurations'](_0xf3b0eb);}})[_0x7298('0x35')](function(_0x37dd60){if(_0x37dd60){_0x18fec0=_0x37dd60['length'];if(!_0x53f91b[_0x7298('0x3e')][_0x7298('0x44')]('nolimit')){_0xf3b0eb['limit']=qs[_0x7298('0x30')](_0x53f91b['query'][_0x7298('0x30')]);_0xf3b0eb['offset']=qs['offset'](_0x53f91b[_0x7298('0x3e')][_0x7298('0x2f')]);}return _0x461731[_0x7298('0x5a')](_0xf3b0eb);}})[_0x7298('0x35')](function(_0x1701b7){if(_0x1701b7){return _0x1701b7?{'count':_0x18fec0,'rows':_0x1701b7}:null;}})[_0x7298('0x35')](respondWithResult(_0x320212,null))[_0x7298('0x29')](handleError(_0x320212,null));};exports[_0x7298('0x5c')]=function(_0xbffb02,_0x552116,_0x55d2a7){if(_0xbffb02['body']['id']){delete _0xbffb02['body']['id'];}return db[_0x7298('0x4d')][_0x7298('0x5d')]({'where':{'id':_0xbffb02[_0x7298('0x52')]['id']}})[_0x7298('0x35')](handleEntityNotFound(_0x552116,null))['then'](function(_0x38279f){if(_0x38279f){_0xbffb02[_0x7298('0x58')][_0x7298('0x5e')]=_0x38279f['id'];_0xbffb02[_0x7298('0x58')][_0x7298('0x5f')]=integrations['getSubjects'](_0xbffb02[_0x7298('0x58')][_0x7298('0x60')],_0xbffb02[_0x7298('0x58')][_0x7298('0x3b')]);_0xbffb02[_0x7298('0x58')][_0x7298('0x61')]=integrations[_0x7298('0x62')](_0xbffb02[_0x7298('0x58')]['channel'],_0xbffb02[_0x7298('0x58')][_0x7298('0x3b')]);return db['SalesforceConfiguration']['create'](_0xbffb02[_0x7298('0x58')],{'include':[{'model':db[_0x7298('0x63')],'as':_0x7298('0x5f')},{'model':db['SalesforceField'],'as':_0x7298('0x61')}]});}return null;})[_0x7298('0x35')](respondWithResult(_0x552116,null))[_0x7298('0x29')](handleError(_0x552116,null));};exports[_0x7298('0x64')]=function(_0x4a6e9a,_0xe4a2e9,_0x16a939){var _0x81e8e0;var _0x41699f='';var _0x24706d=_0x7298('0x65');return db[_0x7298('0x4d')][_0x7298('0x5d')]({'where':{'id':_0x4a6e9a[_0x7298('0x52')]['id']},'attributes':['id','remoteUri',_0x7298('0x66'),_0x7298('0x67'),'username',_0x7298('0x68'),_0x7298('0x69')]})[_0x7298('0x35')](handleEntityNotFound(_0xe4a2e9,null))[_0x7298('0x35')](function(_0xd009b1){if(_0xd009b1){_0x41699f=_0xd009b1[_0x7298('0x6a')];var _0x5533fd=_0x41699f[_0x7298('0x6b')](-0x1);if(_0x5533fd==='/'){_0x41699f=_0x41699f[_0x7298('0x6c')](0x0,_0x41699f['lastIndexOf'](_0x5533fd));}_0x81e8e0=new jsforce[(_0x7298('0x6d'))]({'oauth2':{'loginUrl':_0x41699f,'clientId':_0xd009b1['clientId'],'clientSecret':_0xd009b1[_0x7298('0x67')]}});return _0x81e8e0[_0x7298('0x6e')](_0xd009b1['username'],_0xd009b1['password'][_0x7298('0x6f')](_0xd009b1['securityToken']));}})[_0x7298('0x35')](function(_0x9e63cb){if(_0x9e63cb){if(!_['isNil'](_0x4a6e9a[_0x7298('0x3e')]['ticketType'])){_0x24706d=_0x4a6e9a['query'][_0x7298('0x70')];}return _0x81e8e0[_0x7298('0x71')](_0x24706d)[_0x7298('0x72')]();}})['then'](function(_0x9a4566){var _0x5b916d=[_0x7298('0x73'),'CallDurationInSeconds',_0x7298('0x74'),_0x7298('0x75'),_0x7298('0x76'),_0x7298('0x77'),_0x7298('0x78'),_0x7298('0x79')];if(!_[_0x7298('0x7a')](_0x4a6e9a[_0x7298('0x3e')]['ticketType'])&&_0x4a6e9a[_0x7298('0x3e')][_0x7298('0x70')]===_0x7298('0x7b')){_0x5b916d=['Type','Origin',_0x7298('0x7c'),_0x7298('0x78'),_0x7298('0x77'),_0x7298('0x7d'),_0x7298('0x7e'),_0x7298('0x7f')];}if(_0x9a4566){_[_0x7298('0x80')](_0x9a4566[_0x7298('0x41')],function(_0x664ad8){return _0x664ad8[_0x7298('0x81')]===![]&&!_0x5b916d[_0x7298('0x82')](_0x664ad8[_0x7298('0x37')]);});return{'count':_0x9a4566['fields'][_0x7298('0x43')],'rows':_[_0x7298('0x39')](_0x9a4566[_0x7298('0x41')],function(_0x4e6e9f){return{'id':_0x4e6e9f[_0x7298('0x37')],'name':_0x4e6e9f[_0x7298('0x83')],'custom':_0x4e6e9f[_0x7298('0x81')],'options':_0x4e6e9f[_0x7298('0x84')][_0x7298('0x43')]>0x0?_[_0x7298('0x39')](_0x4e6e9f[_0x7298('0x84')],function(_0x372968){return{'name':_0x372968['label'],'value':_0x372968[_0x7298('0x85')]};}):_0x4e6e9f[_0x7298('0x3b')]==_0x7298('0x86')?[{'name':_0x7298('0x87'),'value':_0x7298('0x88')},{'name':_0x7298('0x89'),'value':_0x7298('0x8a')}]:[]};})};}})[_0x7298('0x35')](respondWithResult(_0xe4a2e9,null))[_0x7298('0x29')](function(_0x37f4c6){var _0x2565c8=_0x4a6e9a[_0x7298('0x3e')][_0x7298('0x1c')]?0x1f4:_0x37f4c6[_0x7298('0x8b')]||0x1f4;logger[_0x7298('0x26')](_0x7298('0x8c'),_0x7298('0x64'),_0x2565c8,JSON[_0x7298('0x25')](_0x37f4c6));delete _0x37f4c6[_0x7298('0x37')];if(_0x2565c8===0x191){_0x2565c8=0x190;}_0xe4a2e9[_0x7298('0x2b')](_0x2565c8)[_0x7298('0x38')](_0x4a6e9a[_0x7298('0x3e')]['test']?{'message':_0x7298('0x8d'),'statusCode':_0x37f4c6['statusCode']}:_0x37f4c6);});}; \ No newline at end of file +var _0x816f=['offset','limit','set','apply','reject','update','end','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','SalesforceAccount','includeAll','include','rows','show','options','find','create','body','destroy','params','findOne','merge','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceConfiguration','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','password','securityToken','slice','substring','lastIndexOf','login','username','concat','isNil','sobject','CallDisposition','CallDurationInSeconds','CallObject','IsArchived','Type','ticketType','Case','Status','Priority','SuppliedName','SuppliedCompany','custom','includes','label','picklistValues','value','True','true','False','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','client','test','Sequelize','ValidationError','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count'];(function(_0x15d1d0,_0x55632c){var _0x423617=function(_0xffa69e){while(--_0xffa69e){_0x15d1d0['push'](_0x15d1d0['shift']());}};_0x423617(++_0x55632c);}(_0x816f,0xdc));var _0xf816=function(_0x1ebe01,_0x2279f2){_0x1ebe01=_0x1ebe01-0x0;var _0x381a13=_0x816f[_0x1ebe01];return _0x381a13;};'use strict';var pdf=require(_0xf816('0x0'));var emlformat=require(_0xf816('0x1'));var rimraf=require(_0xf816('0x2'));var zipdir=require(_0xf816('0x3'));var jsonpatch=require(_0xf816('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf816('0x5'));var util=require(_0xf816('0x6'));var path=require(_0xf816('0x7'));var sox=require(_0xf816('0x8'));var csv=require(_0xf816('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf816('0xa'));var squel=require(_0xf816('0xb'));var crypto=require(_0xf816('0xc'));var jsforce=require(_0xf816('0xd'));var deskjs=require(_0xf816('0xe'));var toCsv=require(_0xf816('0x9'));var querystring=require(_0xf816('0xf'));var Papa=require('papaparse');var Redis=require(_0xf816('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf816('0x11'));var as=require(_0xf816('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf816('0x13'));var utils=require(_0xf816('0x14'));var config=require('../../config/environment');var db=require(_0xf816('0x15'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0xf816('0x16')]['http']({'port':0x232a});function checkPasswordPattern(_0x4186fc,_0x3f6c7b,_0x102ce0){if(_0x102ce0){var _0x312c6d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x312c6d[_0xf816('0x17')](_0x3f6c7b)){return _0x4186fc;}else{throw new db[(_0xf816('0x18'))][(_0xf816('0x19'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x4186fc;}}function respondWithRpcPromise(_0x162d0e,_0x5a2102,_0x1de17f,_0x5ac1e7){return new BPromise(function(_0x218118,_0x5c3144){var _0xc70568=_0x5ac1e7||client;return _0xc70568[_0xf816('0x1a')](_0x162d0e,_0x1de17f)[_0xf816('0x1b')](function(_0xf12382){logger[_0xf816('0x1c')](_0xf816('0x1d'),_0x5a2102,_0xf816('0x1e'));logger['debug'](_0xf816('0x1f'),_0x5a2102,_0xf816('0x1e'),JSON[_0xf816('0x20')](_0xf12382));if(_0xf12382['error']){if(_0xf12382[_0xf816('0x21')][_0xf816('0x22')]===0x1f4){logger[_0xf816('0x21')](_0xf816('0x1d'),_0x5a2102,_0xf12382[_0xf816('0x21')][_0xf816('0x23')]);return _0x5c3144(_0xf12382['error'][_0xf816('0x23')]);}logger[_0xf816('0x21')](_0xf816('0x1d'),_0x5a2102,_0xf12382[_0xf816('0x21')][_0xf816('0x23')]);return _0x218118(_0xf12382[_0xf816('0x21')][_0xf816('0x23')]);}else{logger[_0xf816('0x1c')](_0xf816('0x1d'),_0x5a2102,_0xf816('0x1e'));_0x218118(_0xf12382[_0xf816('0x24')][_0xf816('0x23')]);}})[_0xf816('0x25')](function(_0x31245a){logger[_0xf816('0x21')](_0xf816('0x1d'),_0x5a2102,_0x31245a);_0x5c3144(_0x31245a);});});}function respondWithStatusCode(_0x217e42,_0x498a31){_0x498a31=_0x498a31||0xcc;return function(_0x4fd8ef){if(_0x4fd8ef){return _0x217e42[_0xf816('0x26')](_0x498a31);}return _0x217e42[_0xf816('0x27')](_0x498a31)['end']();};}function respondWithResult(_0x2844c6,_0x1f8180){_0x1f8180=_0x1f8180||0xc8;return function(_0x473e82){if(_0x473e82){return _0x2844c6[_0xf816('0x27')](_0x1f8180)[_0xf816('0x28')](_0x473e82);}};}function respondWithFilteredResult(_0x2c2528,_0x4828b1){return function(_0x45385e){if(_0x45385e){var _0x469599=_0x45385e[_0xf816('0x29')],_0x28c32d=_0x4828b1[_0xf816('0x2a')],_0x3d443b=_0x4828b1[_0xf816('0x2a')]+_0x4828b1[_0xf816('0x2b')],_0x1ca774;if(_0x3d443b>=_0x469599){_0x3d443b=_0x469599;_0x1ca774=0xc8;}else{_0x1ca774=0xce;}_0x2c2528[_0xf816('0x27')](_0x1ca774);return _0x2c2528[_0xf816('0x2c')]('Content-Range',_0x28c32d+'-'+_0x3d443b+'/'+_0x469599)[_0xf816('0x28')](_0x45385e);}return null;};}function patchUpdates(_0x5298c1){return function(_0x3565f4){try{jsonpatch[_0xf816('0x2d')](_0x3565f4,_0x5298c1,!![]);}catch(_0x22d5cd){return BPromise[_0xf816('0x2e')](_0x22d5cd);}return _0x3565f4['save']();};}function saveUpdates(_0x3410ce,_0x31771a){return function(_0x31d696){if(_0x31d696){return _0x31d696[_0xf816('0x2f')](_0x3410ce)[_0xf816('0x1b')](function(_0x5c1535){return _0x5c1535;});}return null;};}function removeEntity(_0x56d79d,_0x199340){return function(_0xe86705){if(_0xe86705){return _0xe86705['destroy']()[_0xf816('0x1b')](function(){_0x56d79d[_0xf816('0x27')](0xcc)[_0xf816('0x30')]();});}};}function handleEntityNotFound(_0x310b75,_0x5c9495){return function(_0x4a82ee){if(!_0x4a82ee){_0x310b75[_0xf816('0x26')](0x194);}return _0x4a82ee;};}function handleError(_0x4801d2,_0x5cdcb0){_0x5cdcb0=_0x5cdcb0||0x1f4;return function(_0xd4f351){logger['error'](_0xd4f351['stack']);if(_0xd4f351['name']){delete _0xd4f351[_0xf816('0x31')];}_0x4801d2[_0xf816('0x27')](_0x5cdcb0)[_0xf816('0x32')](_0xd4f351);};}exports[_0xf816('0x33')]=function(_0x413ace,_0x5a1271){var _0x486e7a={},_0x5e146a={},_0xbd37a={'count':0x0,'rows':[]};var _0x35c6d3=_[_0xf816('0x34')](db['SalesforceAccount'][_0xf816('0x35')],function(_0x384c37){return{'name':_0x384c37[_0xf816('0x36')],'type':_0x384c37[_0xf816('0x37')][_0xf816('0x38')]};});_0x5e146a[_0xf816('0x39')]=_['map'](_0x35c6d3,_0xf816('0x31'));_0x5e146a[_0xf816('0x3a')]=_[_0xf816('0x3b')](_0x413ace['query']);_0x5e146a[_0xf816('0x3c')]=_[_0xf816('0x3d')](_0x5e146a[_0xf816('0x39')],_0x5e146a['query']);_0x486e7a[_0xf816('0x3e')]=_['intersection'](_0x5e146a['model'],qs[_0xf816('0x3f')](_0x413ace[_0xf816('0x3a')][_0xf816('0x3f')]));_0x486e7a[_0xf816('0x3e')]=_0x486e7a[_0xf816('0x3e')][_0xf816('0x40')]?_0x486e7a['attributes']:_0x5e146a[_0xf816('0x39')];if(!_0x413ace['query'][_0xf816('0x41')]('nolimit')){_0x486e7a[_0xf816('0x2b')]=qs[_0xf816('0x2b')](_0x413ace['query'][_0xf816('0x2b')]);_0x486e7a[_0xf816('0x2a')]=qs['offset'](_0x413ace[_0xf816('0x3a')]['offset']);}_0x486e7a[_0xf816('0x42')]=qs[_0xf816('0x43')](_0x413ace[_0xf816('0x3a')][_0xf816('0x43')]);_0x486e7a[_0xf816('0x44')]=qs[_0xf816('0x3c')](_[_0xf816('0x45')](_0x413ace[_0xf816('0x3a')],_0x5e146a[_0xf816('0x3c')]),_0x35c6d3);if(_0x413ace[_0xf816('0x3a')]['filter']){_0x486e7a[_0xf816('0x44')]=_['merge'](_0x486e7a[_0xf816('0x44')],{'$or':_[_0xf816('0x34')](_0x35c6d3,function(_0x4a59e5){if(_0x4a59e5[_0xf816('0x37')]!=='VIRTUAL'){var _0x2539ad={};_0x2539ad[_0x4a59e5[_0xf816('0x31')]]={'$like':'%'+_0x413ace[_0xf816('0x3a')][_0xf816('0x46')]+'%'};return _0x2539ad;}})});}_0x486e7a=_['merge']({},_0x486e7a,_0x413ace['options']);var _0x42af7e={'where':_0x486e7a[_0xf816('0x44')]};return db[_0xf816('0x47')][_0xf816('0x29')](_0x42af7e)[_0xf816('0x1b')](function(_0x4ec3d1){_0xbd37a[_0xf816('0x29')]=_0x4ec3d1;if(_0x413ace['query'][_0xf816('0x48')]){_0x486e7a[_0xf816('0x49')]=[{'all':!![]}];}return db[_0xf816('0x47')]['findAll'](_0x486e7a);})['then'](function(_0x2a31ea){_0xbd37a[_0xf816('0x4a')]=_0x2a31ea;return _0xbd37a;})[_0xf816('0x1b')](respondWithFilteredResult(_0x5a1271,_0x486e7a))['catch'](handleError(_0x5a1271,null));};exports[_0xf816('0x4b')]=function(_0x3449da,_0xb80aaa){var _0x54d1f2={'raw':![],'where':{'id':_0x3449da['params']['id']}},_0x228a95={};_0x228a95['model']=_['keys'](db[_0xf816('0x47')][_0xf816('0x35')]);_0x228a95[_0xf816('0x3a')]=_[_0xf816('0x3b')](_0x3449da[_0xf816('0x3a')]);_0x228a95[_0xf816('0x3c')]=_[_0xf816('0x3d')](_0x228a95[_0xf816('0x39')],_0x228a95['query']);_0x54d1f2[_0xf816('0x3e')]=_['intersection'](_0x228a95[_0xf816('0x39')],qs['fields'](_0x3449da[_0xf816('0x3a')][_0xf816('0x3f')]));_0x54d1f2[_0xf816('0x3e')]=_0x54d1f2[_0xf816('0x3e')][_0xf816('0x40')]?_0x54d1f2[_0xf816('0x3e')]:_0x228a95[_0xf816('0x39')];if(_0x3449da[_0xf816('0x3a')][_0xf816('0x48')]){_0x54d1f2[_0xf816('0x49')]=[{'all':!![]}];}_0x54d1f2=_['merge']({},_0x54d1f2,_0x3449da[_0xf816('0x4c')]);return db['SalesforceAccount'][_0xf816('0x4d')](_0x54d1f2)[_0xf816('0x1b')](handleEntityNotFound(_0xb80aaa,null))[_0xf816('0x1b')](respondWithResult(_0xb80aaa,null))[_0xf816('0x25')](handleError(_0xb80aaa,null));};exports[_0xf816('0x4e')]=function(_0xc99d44,_0x136935){return db[_0xf816('0x47')][_0xf816('0x4e')](_0xc99d44[_0xf816('0x4f')],{})[_0xf816('0x1b')](respondWithResult(_0x136935,0xc9))[_0xf816('0x25')](handleError(_0x136935,null));};exports['update']=function(_0x3e0ec3,_0x405784){if(_0x3e0ec3[_0xf816('0x4f')]['id']){delete _0x3e0ec3['body']['id'];}return db[_0xf816('0x47')][_0xf816('0x4d')]({'where':{'id':_0x3e0ec3['params']['id']}})[_0xf816('0x1b')](handleEntityNotFound(_0x405784,null))['then'](saveUpdates(_0x3e0ec3[_0xf816('0x4f')],null))[_0xf816('0x1b')](respondWithResult(_0x405784,null))[_0xf816('0x25')](handleError(_0x405784,null));};exports[_0xf816('0x50')]=function(_0xd8f310,_0x18fde0){return db[_0xf816('0x47')]['find']({'where':{'id':_0xd8f310[_0xf816('0x51')]['id']}})[_0xf816('0x1b')](handleEntityNotFound(_0x18fde0,null))[_0xf816('0x1b')](removeEntity(_0x18fde0,null))[_0xf816('0x25')](handleError(_0x18fde0,null));};exports['getConfigurations']=function(_0xd80659,_0x6743e7,_0x20086b){var _0x18f5b2={};var _0x1e9299={};var _0x171874;var _0x158ef7;return db[_0xf816('0x47')][_0xf816('0x52')]({'where':{'id':_0xd80659[_0xf816('0x51')]['id']}})[_0xf816('0x1b')](handleEntityNotFound(_0x6743e7,null))[_0xf816('0x1b')](function(_0x363e65){if(_0x363e65){_0x171874=_0x363e65;_0x1e9299[_0xf816('0x39')]=_[_0xf816('0x3b')](db['SalesforceConfiguration']['rawAttributes']);_0x1e9299['query']=_['keys'](_0xd80659[_0xf816('0x3a')]);_0x1e9299['filters']=_[_0xf816('0x3d')](_0x1e9299['model'],_0x1e9299[_0xf816('0x3a')]);_0x18f5b2[_0xf816('0x3e')]=_[_0xf816('0x3d')](_0x1e9299['model'],qs[_0xf816('0x3f')](_0xd80659['query'][_0xf816('0x3f')]));_0x18f5b2[_0xf816('0x3e')]=_0x18f5b2['attributes'][_0xf816('0x40')]?_0x18f5b2['attributes']:_0x1e9299[_0xf816('0x39')];_0x18f5b2[_0xf816('0x42')]=qs[_0xf816('0x43')](_0xd80659['query'][_0xf816('0x43')]);_0x18f5b2['where']=qs[_0xf816('0x3c')](_[_0xf816('0x45')](_0xd80659[_0xf816('0x3a')],_0x1e9299[_0xf816('0x3c')]));if(_0xd80659[_0xf816('0x3a')][_0xf816('0x46')]){_0x18f5b2[_0xf816('0x44')]=_[_0xf816('0x53')](_0x18f5b2[_0xf816('0x44')],{'$or':_[_0xf816('0x34')](_0x18f5b2[_0xf816('0x3e')],function(_0x10fd86){var _0xcccd9a={};_0xcccd9a[_0x10fd86]={'$like':'%'+_0xd80659['query'][_0xf816('0x46')]+'%'};return _0xcccd9a;})});}_0x18f5b2=_[_0xf816('0x53')]({},_0x18f5b2,_0xd80659[_0xf816('0x4c')]);return _0x171874[_0xf816('0x54')](_0x18f5b2);}})['then'](function(_0xf151af){if(_0xf151af){_0x158ef7=_0xf151af[_0xf816('0x40')];if(!_0xd80659['query']['hasOwnProperty']('nolimit')){_0x18f5b2[_0xf816('0x2b')]=qs[_0xf816('0x2b')](_0xd80659['query'][_0xf816('0x2b')]);_0x18f5b2[_0xf816('0x2a')]=qs[_0xf816('0x2a')](_0xd80659[_0xf816('0x3a')][_0xf816('0x2a')]);}return _0x171874['getConfigurations'](_0x18f5b2);}})[_0xf816('0x1b')](function(_0x2ae6ea){if(_0x2ae6ea){return _0x2ae6ea?{'count':_0x158ef7,'rows':_0x2ae6ea}:null;}})[_0xf816('0x1b')](respondWithResult(_0x6743e7,null))['catch'](handleError(_0x6743e7,null));};exports[_0xf816('0x55')]=function(_0x1890c5,_0x554478,_0x2e8027){if(_0x1890c5[_0xf816('0x4f')]['id']){delete _0x1890c5[_0xf816('0x4f')]['id'];}return db[_0xf816('0x47')][_0xf816('0x52')]({'where':{'id':_0x1890c5[_0xf816('0x51')]['id']}})['then'](handleEntityNotFound(_0x554478,null))['then'](function(_0x5bf2e5){if(_0x5bf2e5){_0x1890c5['body'][_0xf816('0x56')]=_0x5bf2e5['id'];_0x1890c5[_0xf816('0x4f')][_0xf816('0x57')]=integrations[_0xf816('0x58')](_0x1890c5[_0xf816('0x4f')][_0xf816('0x59')],_0x1890c5['body'][_0xf816('0x37')]);_0x1890c5['body'][_0xf816('0x5a')]=integrations[_0xf816('0x5b')](_0x1890c5[_0xf816('0x4f')][_0xf816('0x59')],_0x1890c5[_0xf816('0x4f')][_0xf816('0x37')]);return db[_0xf816('0x5c')]['create'](_0x1890c5[_0xf816('0x4f')],{'include':[{'model':db[_0xf816('0x5d')],'as':_0xf816('0x57')},{'model':db[_0xf816('0x5d')],'as':'Descriptions'}]});}return null;})[_0xf816('0x1b')](respondWithResult(_0x554478,null))['catch'](handleError(_0x554478,null));};exports[_0xf816('0x5e')]=function(_0xddc199,_0x1673b4,_0x3bbe0a){var _0x3aca1a;var _0x228835='';var _0x29c2e2=_0xf816('0x5f');return db[_0xf816('0x47')]['findOne']({'where':{'id':_0xddc199[_0xf816('0x51')]['id']},'attributes':['id',_0xf816('0x60'),_0xf816('0x61'),_0xf816('0x62'),'username',_0xf816('0x63'),_0xf816('0x64')]})[_0xf816('0x1b')](handleEntityNotFound(_0x1673b4,null))[_0xf816('0x1b')](function(_0x106912){if(_0x106912){_0x228835=_0x106912[_0xf816('0x60')];var _0x4e6c33=_0x228835[_0xf816('0x65')](-0x1);if(_0x4e6c33==='/'){_0x228835=_0x228835[_0xf816('0x66')](0x0,_0x228835[_0xf816('0x67')](_0x4e6c33));}_0x3aca1a=new jsforce['Connection']({'oauth2':{'loginUrl':_0x228835,'clientId':_0x106912['clientId'],'clientSecret':_0x106912[_0xf816('0x62')]}});return _0x3aca1a[_0xf816('0x68')](_0x106912[_0xf816('0x69')],_0x106912[_0xf816('0x63')][_0xf816('0x6a')](_0x106912[_0xf816('0x64')]));}})[_0xf816('0x1b')](function(_0x46ec79){if(_0x46ec79){if(!_[_0xf816('0x6b')](_0xddc199[_0xf816('0x3a')]['ticketType'])){_0x29c2e2=_0xddc199['query']['ticketType'];}return _0x3aca1a[_0xf816('0x6c')](_0x29c2e2)['describe']();}})[_0xf816('0x1b')](function(_0x39c107){var _0x2a09c2=[_0xf816('0x6d'),_0xf816('0x6e'),_0xf816('0x6f'),'CallType',_0xf816('0x70'),'Priority','Status',_0xf816('0x71')];if(!_[_0xf816('0x6b')](_0xddc199[_0xf816('0x3a')][_0xf816('0x72')])&&_0xddc199[_0xf816('0x3a')][_0xf816('0x72')]===_0xf816('0x73')){_0x2a09c2=[_0xf816('0x71'),'Origin','Reason',_0xf816('0x74'),_0xf816('0x75'),'IsEscalated',_0xf816('0x76'),_0xf816('0x77')];}if(_0x39c107){_['remove'](_0x39c107[_0xf816('0x3f')],function(_0x1f4f91){return _0x1f4f91[_0xf816('0x78')]===![]&&!_0x2a09c2[_0xf816('0x79')](_0x1f4f91[_0xf816('0x31')]);});return{'count':_0x39c107[_0xf816('0x3f')][_0xf816('0x40')],'rows':_['map'](_0x39c107['fields'],function(_0x135740){return{'id':_0x135740[_0xf816('0x31')],'name':_0x135740[_0xf816('0x7a')],'custom':_0x135740['custom'],'options':_0x135740[_0xf816('0x7b')][_0xf816('0x40')]>0x0?_['map'](_0x135740[_0xf816('0x7b')],function(_0x3b4bc8){return{'name':_0x3b4bc8[_0xf816('0x7a')],'value':_0x3b4bc8[_0xf816('0x7c')]};}):_0x135740['type']=='boolean'?[{'name':_0xf816('0x7d'),'value':_0xf816('0x7e')},{'name':_0xf816('0x7f'),'value':'false'}]:[]};})};}})[_0xf816('0x1b')](respondWithResult(_0x1673b4,null))[_0xf816('0x25')](function(_0x179983){var _0x3edb69=_0xddc199[_0xf816('0x3a')][_0xf816('0x17')]?0x1f4:_0x179983[_0xf816('0x80')]||0x1f4;logger['error'](_0xf816('0x81'),_0xf816('0x5e'),_0x3edb69,JSON[_0xf816('0x20')](_0x179983));delete _0x179983[_0xf816('0x31')];if(_0x3edb69===0x191){_0x3edb69=0x190;}_0x1673b4[_0xf816('0x27')](_0x3edb69)[_0xf816('0x32')](_0xddc199[_0xf816('0x3a')][_0xf816('0x17')]?{'message':_0xf816('0x82'),'statusCode':_0x179983[_0xf816('0x80')]}:_0x179983);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 395505c..412bbe6 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 _0xfdde=['../../config/logger','api','moment','bluebird','request-promise','path','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','int_salesforce_accounts','lodash','util'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xfdde,0x12a));var _0xefdd=function(_0x1c6c5c,_0xba1097){_0x1c6c5c=_0x1c6c5c-0x0;var _0x17d772=_0xfdde[_0x1c6c5c];return _0x17d772;};'use strict';var _=require(_0xefdd('0x0'));var util=require(_0xefdd('0x1'));var logger=require(_0xefdd('0x2'))(_0xefdd('0x3'));var moment=require(_0xefdd('0x4'));var BPromise=require(_0xefdd('0x5'));var rp=require(_0xefdd('0x6'));var fs=require('fs');var path=require(_0xefdd('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xefdd('0x8'));var integrations=require(_0xefdd('0x9'));module[_0xefdd('0xa')]=function(_0x298427,_0x2d4ca9){return _0x298427['define']('SalesforceAccount',attributes,{'tableName':_0xefdd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf514=['./intSalesforceAccount.attributes','../../components/integrations/configuration','int_salesforce_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x2e3f40,_0x47410c){var _0x28abc1=function(_0x472028){while(--_0x472028){_0x2e3f40['push'](_0x2e3f40['shift']());}};_0x28abc1(++_0x47410c);}(_0xf514,0xa3));var _0x4f51=function(_0x53e19d,_0x2fe131){_0x53e19d=_0x53e19d-0x0;var _0x5a8c9f=_0xf514[_0x53e19d];return _0x5a8c9f;};'use strict';var _=require(_0x4f51('0x0'));var util=require('util');var logger=require(_0x4f51('0x1'))(_0x4f51('0x2'));var moment=require(_0x4f51('0x3'));var BPromise=require(_0x4f51('0x4'));var rp=require(_0x4f51('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4f51('0x6'));var config=require('../../config/environment');var attributes=require(_0x4f51('0x7'));var integrations=require(_0x4f51('0x8'));module['exports']=function(_0x5488c5,_0x1d1502){return _0x5488c5['define']('SalesforceAccount',attributes,{'tableName':_0x4f51('0x9'),'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 0e5a682..940bb43 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 _0xcea2=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','SalesforceAccount','findAll','options','where','attributes','limit','map','include','model','then','GetSalesforceAccount','ShowSalesforceAccount','find','raw','lodash','moment','randomstring','ioredis'];(function(_0x32f120,_0x114c35){var _0x19b8f7=function(_0x4c489a){while(--_0x4c489a){_0x32f120['push'](_0x32f120['shift']());}};_0x19b8f7(++_0x114c35);}(_0xcea2,0x15a));var _0x2cea=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0xcea2[_0x50007c];return _0x5c1ec7;};'use strict';var _=require(_0x2cea('0x0'));var util=require('util');var moment=require(_0x2cea('0x1'));var BPromise=require('bluebird');var rs=require(_0x2cea('0x2'));var fs=require('fs');var Redis=require(_0x2cea('0x3'));var db=require(_0x2cea('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2cea('0x5'))(_0x2cea('0x6'));var config=require(_0x2cea('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2cea('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d69ff,_0xc04963,_0x805a1b){return new BPromise(function(_0x160cca,_0x11c5c0){return client[_0x2cea('0x9')](_0x2d69ff,_0x805a1b)['then'](function(_0x1f4d90){logger[_0x2cea('0xa')](_0x2cea('0xb'),_0xc04963,_0x2cea('0xc'));logger[_0x2cea('0xd')](_0x2cea('0xe'),_0xc04963,_0x2cea('0xc'),JSON[_0x2cea('0xf')](_0x1f4d90));if(_0x1f4d90['error']){if(_0x1f4d90['error'][_0x2cea('0x10')]===0x1f4){logger[_0x2cea('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0xc04963,_0x1f4d90['error'][_0x2cea('0x12')]);return _0x11c5c0(_0x1f4d90['error'][_0x2cea('0x12')]);}logger[_0x2cea('0x11')](_0x2cea('0xb'),_0xc04963,_0x1f4d90['error']['message']);return _0x160cca(_0x1f4d90['error'][_0x2cea('0x12')]);}else{logger['info'](_0x2cea('0xb'),_0xc04963,_0x2cea('0xc'));_0x160cca(_0x1f4d90[_0x2cea('0x13')][_0x2cea('0x12')]);}})[_0x2cea('0x14')](function(_0x1bbfdb){logger[_0x2cea('0x11')](_0x2cea('0xb'),_0xc04963,_0x1bbfdb);_0x11c5c0(_0x1bbfdb);});});}exports['GetSalesforceAccount']=function(_0x19927a){var _0x464f7d=this;return new Promise(function(_0x20c46c,_0x43ae15){return db[_0x2cea('0x15')][_0x2cea('0x16')]({'raw':_0x19927a['options']?_0x19927a[_0x2cea('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x19927a[_0x2cea('0x17')]?_0x19927a[_0x2cea('0x17')][_0x2cea('0x18')]||null:null,'attributes':_0x19927a['options']?_0x19927a[_0x2cea('0x17')][_0x2cea('0x19')]||null:null,'limit':_0x19927a[_0x2cea('0x17')]?_0x19927a[_0x2cea('0x17')][_0x2cea('0x1a')]||null:null,'include':_0x19927a[_0x2cea('0x17')]?_0x19927a[_0x2cea('0x17')]['include']?_[_0x2cea('0x1b')](_0x19927a['options'][_0x2cea('0x1c')],function(_0x4926ff){return{'model':db[_0x4926ff[_0x2cea('0x1d')]],'as':_0x4926ff['as'],'attributes':_0x4926ff[_0x2cea('0x19')],'include':_0x4926ff['include']?_[_0x2cea('0x1b')](_0x4926ff[_0x2cea('0x1c')],function(_0x101314){return{'model':db[_0x101314[_0x2cea('0x1d')]],'as':_0x101314['as'],'attributes':_0x101314[_0x2cea('0x19')],'include':_0x101314[_0x2cea('0x1c')]?_['map'](_0x101314[_0x2cea('0x1c')],function(_0x32b6a3){return{'model':db[_0x32b6a3[_0x2cea('0x1d')]],'as':_0x32b6a3['as'],'attributes':_0x32b6a3[_0x2cea('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2cea('0x1e')](function(_0x3ea40c){logger[_0x2cea('0xa')](_0x2cea('0x1f'),_0x19927a);logger['debug'](_0x2cea('0x1f'),_0x19927a,JSON[_0x2cea('0xf')](_0x3ea40c));_0x20c46c(_0x3ea40c);})['catch'](function(_0xfeb8bd){logger[_0x2cea('0x11')](_0x2cea('0x1f'),_0xfeb8bd[_0x2cea('0x12')],_0x19927a);_0x43ae15(_0x464f7d['error'](0x1f4,_0xfeb8bd[_0x2cea('0x12')]));});});};exports[_0x2cea('0x20')]=function(_0x4a51e5){var _0x2bf4e9=this;return new Promise(function(_0x2e3d44,_0xa8f660){return db[_0x2cea('0x15')][_0x2cea('0x21')]({'raw':_0x4a51e5[_0x2cea('0x17')]?_0x4a51e5[_0x2cea('0x17')][_0x2cea('0x22')]===undefined?!![]:![]:!![],'where':_0x4a51e5[_0x2cea('0x17')]?_0x4a51e5[_0x2cea('0x17')][_0x2cea('0x18')]||null:null,'attributes':_0x4a51e5['options']?_0x4a51e5[_0x2cea('0x17')][_0x2cea('0x19')]||null:null,'include':_0x4a51e5[_0x2cea('0x17')]?_0x4a51e5[_0x2cea('0x17')]['include']?_['map'](_0x4a51e5[_0x2cea('0x17')][_0x2cea('0x1c')],function(_0x5eefbf){return{'model':db[_0x5eefbf[_0x2cea('0x1d')]],'as':_0x5eefbf['as'],'attributes':_0x5eefbf['attributes'],'include':_0x5eefbf[_0x2cea('0x1c')]?_['map'](_0x5eefbf[_0x2cea('0x1c')],function(_0x5bd36b){return{'model':db[_0x5bd36b[_0x2cea('0x1d')]],'as':_0x5bd36b['as'],'attributes':_0x5bd36b[_0x2cea('0x19')],'include':_0x5bd36b['include']?_[_0x2cea('0x1b')](_0x5bd36b[_0x2cea('0x1c')],function(_0x55b4d1){return{'model':db[_0x55b4d1[_0x2cea('0x1d')]],'as':_0x55b4d1['as'],'attributes':_0x55b4d1[_0x2cea('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2cea('0x1e')](function(_0x3c9f6e){logger[_0x2cea('0xa')]('ShowSalesforceAccount',_0x4a51e5);logger[_0x2cea('0xd')](_0x2cea('0x20'),_0x4a51e5,JSON['stringify'](_0x3c9f6e));_0x2e3d44(_0x3c9f6e);})['catch'](function(_0x1913a2){logger['error']('ShowSalesforceAccount',_0x1913a2['message'],_0x4a51e5);_0xa8f660(_0x2bf4e9['error'](0x1f4,_0x1913a2[_0x2cea('0x12')]));});});}; \ No newline at end of file +var _0x4ea3=['options','raw','where','attributes','include','map','find','model','ShowSalesforceAccount','debug','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetSalesforceAccount','SalesforceAccount','findAll'];(function(_0x1b735a,_0x481843){var _0x3b14dc=function(_0x50aa50){while(--_0x50aa50){_0x1b735a['push'](_0x1b735a['shift']());}};_0x3b14dc(++_0x481843);}(_0x4ea3,0x70));var _0x34ea=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x4ea3[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x34ea('0x0'));var util=require(_0x34ea('0x1'));var moment=require(_0x34ea('0x2'));var BPromise=require(_0x34ea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34ea('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x34ea('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x34ea('0x6'));var jayson=require(_0x34ea('0x7'));var client=jayson[_0x34ea('0x8')][_0x34ea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40434e,_0x18b461,_0x22b09e){return new BPromise(function(_0x5bec7c,_0x341727){return client[_0x34ea('0xa')](_0x40434e,_0x22b09e)[_0x34ea('0xb')](function(_0x5132c4){logger[_0x34ea('0xc')](_0x34ea('0xd'),_0x18b461,'request\x20sent');logger['debug'](_0x34ea('0xe'),_0x18b461,_0x34ea('0xf'),JSON[_0x34ea('0x10')](_0x5132c4));if(_0x5132c4['error']){if(_0x5132c4[_0x34ea('0x11')][_0x34ea('0x12')]===0x1f4){logger[_0x34ea('0x11')](_0x34ea('0xd'),_0x18b461,_0x5132c4[_0x34ea('0x11')][_0x34ea('0x13')]);return _0x341727(_0x5132c4[_0x34ea('0x11')][_0x34ea('0x13')]);}logger[_0x34ea('0x11')](_0x34ea('0xd'),_0x18b461,_0x5132c4[_0x34ea('0x11')]['message']);return _0x5bec7c(_0x5132c4[_0x34ea('0x11')][_0x34ea('0x13')]);}else{logger[_0x34ea('0xc')](_0x34ea('0xd'),_0x18b461,_0x34ea('0xf'));_0x5bec7c(_0x5132c4['result'][_0x34ea('0x13')]);}})[_0x34ea('0x14')](function(_0x3fa3b0){logger[_0x34ea('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x18b461,_0x3fa3b0);_0x341727(_0x3fa3b0);});});}exports[_0x34ea('0x15')]=function(_0x34caea){var _0x5aeea3=this;return new Promise(function(_0x5340a4,_0x72fef0){return db[_0x34ea('0x16')][_0x34ea('0x17')]({'raw':_0x34caea[_0x34ea('0x18')]?_0x34caea['options'][_0x34ea('0x19')]===undefined?!![]:![]:!![],'where':_0x34caea[_0x34ea('0x18')]?_0x34caea[_0x34ea('0x18')][_0x34ea('0x1a')]||null:null,'attributes':_0x34caea['options']?_0x34caea['options'][_0x34ea('0x1b')]||null:null,'limit':_0x34caea[_0x34ea('0x18')]?_0x34caea[_0x34ea('0x18')]['limit']||null:null,'include':_0x34caea['options']?_0x34caea[_0x34ea('0x18')][_0x34ea('0x1c')]?_[_0x34ea('0x1d')](_0x34caea[_0x34ea('0x18')][_0x34ea('0x1c')],function(_0x697475){return{'model':db[_0x697475['model']],'as':_0x697475['as'],'attributes':_0x697475[_0x34ea('0x1b')],'include':_0x697475[_0x34ea('0x1c')]?_[_0x34ea('0x1d')](_0x697475[_0x34ea('0x1c')],function(_0x5b5885){return{'model':db[_0x5b5885['model']],'as':_0x5b5885['as'],'attributes':_0x5b5885['attributes'],'include':_0x5b5885[_0x34ea('0x1c')]?_[_0x34ea('0x1d')](_0x5b5885[_0x34ea('0x1c')],function(_0x4204d7){return{'model':db[_0x4204d7['model']],'as':_0x4204d7['as'],'attributes':_0x4204d7[_0x34ea('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x34ea('0xb')](function(_0x27c6f7){logger['info']('GetSalesforceAccount',_0x34caea);logger['debug']('GetSalesforceAccount',_0x34caea,JSON[_0x34ea('0x10')](_0x27c6f7));_0x5340a4(_0x27c6f7);})[_0x34ea('0x14')](function(_0x859b7e){logger[_0x34ea('0x11')]('GetSalesforceAccount',_0x859b7e[_0x34ea('0x13')],_0x34caea);_0x72fef0(_0x5aeea3['error'](0x1f4,_0x859b7e[_0x34ea('0x13')]));});});};exports['ShowSalesforceAccount']=function(_0x3272f9){var _0x14e018=this;return new Promise(function(_0x3cb968,_0x57b19d){return db[_0x34ea('0x16')][_0x34ea('0x1e')]({'raw':_0x3272f9['options']?_0x3272f9[_0x34ea('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3272f9[_0x34ea('0x18')]?_0x3272f9[_0x34ea('0x18')][_0x34ea('0x1a')]||null:null,'attributes':_0x3272f9['options']?_0x3272f9['options'][_0x34ea('0x1b')]||null:null,'include':_0x3272f9['options']?_0x3272f9[_0x34ea('0x18')][_0x34ea('0x1c')]?_['map'](_0x3272f9[_0x34ea('0x18')][_0x34ea('0x1c')],function(_0x2cdde6){return{'model':db[_0x2cdde6[_0x34ea('0x1f')]],'as':_0x2cdde6['as'],'attributes':_0x2cdde6['attributes'],'include':_0x2cdde6['include']?_['map'](_0x2cdde6[_0x34ea('0x1c')],function(_0x6668cd){return{'model':db[_0x6668cd[_0x34ea('0x1f')]],'as':_0x6668cd['as'],'attributes':_0x6668cd['attributes'],'include':_0x6668cd['include']?_['map'](_0x6668cd[_0x34ea('0x1c')],function(_0x39fe11){return{'model':db[_0x39fe11['model']],'as':_0x39fe11['as'],'attributes':_0x39fe11[_0x34ea('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x34ea('0xb')](function(_0x2db107){logger[_0x34ea('0xc')](_0x34ea('0x20'),_0x3272f9);logger[_0x34ea('0x21')]('ShowSalesforceAccount',_0x3272f9,JSON[_0x34ea('0x10')](_0x2db107));_0x3cb968(_0x2db107);})[_0x34ea('0x14')](function(_0x60f384){logger[_0x34ea('0x11')]('ShowSalesforceAccount',_0x60f384['message'],_0x3272f9);_0x57b19d(_0x14e018[_0x34ea('0x11')](0x1f4,_0x60f384[_0x34ea('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 9a6d23a..990a12e 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 _0x7a35=['./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','create','put','/:id','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x7a35,0x173));var _0x57a3=function(_0x3dee92,_0x55e1eb){_0x3dee92=_0x3dee92-0x0;var _0x44d36e=_0x7a35[_0x3dee92];return _0x44d36e;};'use strict';var multer=require('multer');var util=require(_0x57a3('0x0'));var path=require(_0x57a3('0x1'));var timeout=require(_0x57a3('0x2'));var express=require(_0x57a3('0x3'));var router=express[_0x57a3('0x4')]();var auth=require(_0x57a3('0x5'));var interaction=require(_0x57a3('0x6'));var config=require('../../config/environment');var controller=require(_0x57a3('0x7'));router[_0x57a3('0x8')]('/',auth[_0x57a3('0x9')](),controller[_0x57a3('0xa')]);router[_0x57a3('0x8')]('/:id',auth[_0x57a3('0x9')](),controller['show']);router[_0x57a3('0x8')](_0x57a3('0xb'),auth[_0x57a3('0x9')](),controller[_0x57a3('0xc')]);router[_0x57a3('0x8')]('/:id/subjects',auth[_0x57a3('0x9')](),controller[_0x57a3('0xd')]);router[_0x57a3('0x8')](_0x57a3('0xe'),auth[_0x57a3('0x9')](),controller[_0x57a3('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x57a3('0x10')]);router[_0x57a3('0x11')](_0x57a3('0x12'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x57a3('0x12'),auth[_0x57a3('0x9')](),controller[_0x57a3('0x13')]);module[_0x57a3('0x14')]=router; \ No newline at end of file +var _0x6f02=['./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','getSubjects','getDescriptions','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service'];(function(_0x2bc406,_0x40863f){var _0xee761d=function(_0x23fa43){while(--_0x23fa43){_0x2bc406['push'](_0x2bc406['shift']());}};_0xee761d(++_0x40863f);}(_0x6f02,0x79));var _0x26f0=function(_0x41d9e4,_0x187199){_0x41d9e4=_0x41d9e4-0x0;var _0x3768c3=_0x6f02[_0x41d9e4];return _0x3768c3;};'use strict';var multer=require('multer');var util=require(_0x26f0('0x0'));var path=require(_0x26f0('0x1'));var timeout=require(_0x26f0('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x26f0('0x3'));var interaction=require(_0x26f0('0x4'));var config=require('../../config/environment');var controller=require(_0x26f0('0x5'));router[_0x26f0('0x6')]('/',auth[_0x26f0('0x7')](),controller[_0x26f0('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x26f0('0x9')]);router['get'](_0x26f0('0xa'),auth[_0x26f0('0x7')](),controller[_0x26f0('0xb')]);router['get']('/:id/subjects',auth[_0x26f0('0x7')](),controller[_0x26f0('0xc')]);router[_0x26f0('0x6')]('/:id/descriptions',auth[_0x26f0('0x7')](),controller[_0x26f0('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x26f0('0xe')]);router[_0x26f0('0xf')](_0x26f0('0x10'),auth['isAuthenticated'](),controller[_0x26f0('0x11')]);router[_0x26f0('0x12')](_0x26f0('0x10'),auth[_0x26f0('0x7')](),controller[_0x26f0('0x13')]);module[_0x26f0('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 e8c56ba..baf9e2b 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 _0x7de2=['Task','ENUM','contact_lead','contact','lead','nothing','sequelize','exports'];(function(_0x47dd33,_0x4d77dc){var _0x56ef95=function(_0x51726a){while(--_0x51726a){_0x47dd33['push'](_0x47dd33['shift']());}};_0x56ef95(++_0x4d77dc);}(_0x7de2,0x126));var _0x27de=function(_0x5a84af,_0x1639ea){_0x5a84af=_0x5a84af-0x0;var _0x490774=_0x7de2[_0x5a84af];return _0x490774;};'use strict';var Sequelize=require(_0x27de('0x0'));module[_0x27de('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0x27de('0x2'),'Case'),'defaultValue':_0x27de('0x2')},'moduleSearch':{'type':Sequelize[_0x27de('0x3')](_0x27de('0x4'),_0x27de('0x5'),_0x27de('0x6')),'defaultValue':_0x27de('0x4')},'moduleCreate':{'type':Sequelize[_0x27de('0x3')](_0x27de('0x7'),_0x27de('0x5'),_0x27de('0x6')),'defaultValue':_0x27de('0x6')}}; \ No newline at end of file +var _0x53e6=['sequelize','exports','STRING','ENUM','Task','Case','contact_lead','lead','nothing','contact'];(function(_0x4bbd88,_0x342d64){var _0x9843e=function(_0x3cc63c){while(--_0x3cc63c){_0x4bbd88['push'](_0x4bbd88['shift']());}};_0x9843e(++_0x342d64);}(_0x53e6,0xf0));var _0x653e=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x53e6[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0x653e('0x0'));module[_0x653e('0x1')]={'name':{'type':Sequelize[_0x653e('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x653e('0x3')](_0x653e('0x4'),_0x653e('0x5')),'defaultValue':_0x653e('0x4')},'moduleSearch':{'type':Sequelize[_0x653e('0x3')](_0x653e('0x6'),'contact',_0x653e('0x7')),'defaultValue':_0x653e('0x6')},'moduleCreate':{'type':Sequelize['ENUM'](_0x653e('0x8'),_0x653e('0x9'),'lead'),'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 a1d6b9a..726152c 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 _0x4e1c=['sox','to-csv','ejs','lodash','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','jayson/promise','test','Sequelize','ValidationError','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','sendStatus','status','json','offset','Content-Range','save','update','destroy','end','stack','name','send','map','rawAttributes','model','keys','query','filters','intersection','fields','attributes','limit','order','sort','where','filter','merge','type','options','SalesforceConfiguration','count','include','findAll','rows','catch','show','params','find','create','body','findOne','SalesforceField','getFields','length','hasOwnProperty','nolimit','getSubjects','getDescriptions','html-pdf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x37d573,_0x4678d4){var _0x459238=function(_0x5a291e){while(--_0x5a291e){_0x37d573['push'](_0x37d573['shift']());}};_0x459238(++_0x4678d4);}(_0x4e1c,0x140));var _0xc4e1=function(_0x4855a7,_0x133b87){_0x4855a7=_0x4855a7-0x0;var _0x2d3855=_0x4e1c[_0x4855a7];return _0x2d3855;};'use strict';var pdf=require(_0xc4e1('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc4e1('0x1'));var rp=require(_0xc4e1('0x2'));var moment=require(_0xc4e1('0x3'));var BPromise=require(_0xc4e1('0x4'));var Mustache=require(_0xc4e1('0x5'));var util=require(_0xc4e1('0x6'));var path=require(_0xc4e1('0x7'));var sox=require(_0xc4e1('0x8'));var csv=require(_0xc4e1('0x9'));var ejs=require(_0xc4e1('0xa'));var fs=require('fs');var _=require(_0xc4e1('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc4e1('0x9'));var querystring=require(_0xc4e1('0xc'));var Papa=require('papaparse');var Redis=require(_0xc4e1('0xd'));var authService=require(_0xc4e1('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xc4e1('0xf'));var hardwareService=require(_0xc4e1('0x10'));var logger=require('../../config/logger')(_0xc4e1('0x11'));var utils=require(_0xc4e1('0x12'));var config=require('../../config/environment');var db=require(_0xc4e1('0x13'))['db'];var jayson=require(_0xc4e1('0x14'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x250b15,_0x3cd461,_0x1b594d){if(_0x1b594d){var _0x5899ae=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5899ae[_0xc4e1('0x15')](_0x3cd461)){return _0x250b15;}else{throw new db[(_0xc4e1('0x16'))][(_0xc4e1('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 _0x250b15;}}function respondWithRpcPromise(_0xbe3646,_0x304a1,_0x5d23e,_0x30ce3a){return new BPromise(function(_0xd4c068,_0x324d26){var _0x407b1c=_0x30ce3a||client;return _0x407b1c[_0xc4e1('0x18')](_0xbe3646,_0x5d23e)[_0xc4e1('0x19')](function(_0x4095a7){logger[_0xc4e1('0x1a')](_0xc4e1('0x1b'),_0x304a1,_0xc4e1('0x1c'));logger[_0xc4e1('0x1d')](_0xc4e1('0x1e'),_0x304a1,'request\x20sent',JSON['stringify'](_0x4095a7));if(_0x4095a7[_0xc4e1('0x1f')]){if(_0x4095a7['error'][_0xc4e1('0x20')]===0x1f4){logger['error'](_0xc4e1('0x1b'),_0x304a1,_0x4095a7[_0xc4e1('0x1f')][_0xc4e1('0x21')]);return _0x324d26(_0x4095a7[_0xc4e1('0x1f')][_0xc4e1('0x21')]);}logger[_0xc4e1('0x1f')]('SalesforceConfiguration,\x20%s,\x20%s',_0x304a1,_0x4095a7['error'][_0xc4e1('0x21')]);return _0xd4c068(_0x4095a7[_0xc4e1('0x1f')][_0xc4e1('0x21')]);}else{logger[_0xc4e1('0x1a')](_0xc4e1('0x1b'),_0x304a1,_0xc4e1('0x1c'));_0xd4c068(_0x4095a7['result'][_0xc4e1('0x21')]);}})['catch'](function(_0x4ab20c){logger[_0xc4e1('0x1f')](_0xc4e1('0x1b'),_0x304a1,_0x4ab20c);_0x324d26(_0x4ab20c);});});}function respondWithStatusCode(_0x41efa9,_0x5b8719){_0x5b8719=_0x5b8719||0xcc;return function(_0x31d7f7){if(_0x31d7f7){return _0x41efa9[_0xc4e1('0x22')](_0x5b8719);}return _0x41efa9[_0xc4e1('0x23')](_0x5b8719)['end']();};}function respondWithResult(_0x5487a0,_0xe6acb3){_0xe6acb3=_0xe6acb3||0xc8;return function(_0x4cccb5){if(_0x4cccb5){return _0x5487a0[_0xc4e1('0x23')](_0xe6acb3)[_0xc4e1('0x24')](_0x4cccb5);}};}function respondWithFilteredResult(_0x2c5994,_0xe4dd9f){return function(_0x4ef123){if(_0x4ef123){var _0x5a4965=_0x4ef123['count'],_0x2d5fbb=_0xe4dd9f[_0xc4e1('0x25')],_0x1d29bd=_0xe4dd9f[_0xc4e1('0x25')]+_0xe4dd9f['limit'],_0xe5047c;if(_0x1d29bd>=_0x5a4965){_0x1d29bd=_0x5a4965;_0xe5047c=0xc8;}else{_0xe5047c=0xce;}_0x2c5994[_0xc4e1('0x23')](_0xe5047c);return _0x2c5994['set'](_0xc4e1('0x26'),_0x2d5fbb+'-'+_0x1d29bd+'/'+_0x5a4965)[_0xc4e1('0x24')](_0x4ef123);}return null;};}function patchUpdates(_0x112ef4){return function(_0xc33568){try{jsonpatch['apply'](_0xc33568,_0x112ef4,!![]);}catch(_0x5db10e){return BPromise['reject'](_0x5db10e);}return _0xc33568[_0xc4e1('0x27')]();};}function saveUpdates(_0x4adb5b,_0x2022b6){return function(_0x2061a1){if(_0x2061a1){return _0x2061a1[_0xc4e1('0x28')](_0x4adb5b)[_0xc4e1('0x19')](function(_0xfc8813){return _0xfc8813;});}return null;};}function removeEntity(_0x3e6b06,_0x48326c){return function(_0x2c43d3){if(_0x2c43d3){return _0x2c43d3[_0xc4e1('0x29')]()[_0xc4e1('0x19')](function(){_0x3e6b06[_0xc4e1('0x23')](0xcc)[_0xc4e1('0x2a')]();});}};}function handleEntityNotFound(_0xb12f14,_0x3d0aef){return function(_0x2fe065){if(!_0x2fe065){_0xb12f14[_0xc4e1('0x22')](0x194);}return _0x2fe065;};}function handleError(_0x45c801,_0xcac7b0){_0xcac7b0=_0xcac7b0||0x1f4;return function(_0xb996a3){logger[_0xc4e1('0x1f')](_0xb996a3[_0xc4e1('0x2b')]);if(_0xb996a3[_0xc4e1('0x2c')]){delete _0xb996a3['name'];}_0x45c801[_0xc4e1('0x23')](_0xcac7b0)[_0xc4e1('0x2d')](_0xb996a3);};}exports['index']=function(_0x307b4a,_0x29eb99){var _0x2057ef={},_0x1d2b8a={},_0x32bb23={'count':0x0,'rows':[]};var _0x5c6f7c=_[_0xc4e1('0x2e')](db['SalesforceConfiguration'][_0xc4e1('0x2f')],function(_0x3c3cdc){return{'name':_0x3c3cdc['fieldName'],'type':_0x3c3cdc['type']['key']};});_0x1d2b8a[_0xc4e1('0x30')]=_[_0xc4e1('0x2e')](_0x5c6f7c,_0xc4e1('0x2c'));_0x1d2b8a['query']=_[_0xc4e1('0x31')](_0x307b4a[_0xc4e1('0x32')]);_0x1d2b8a[_0xc4e1('0x33')]=_[_0xc4e1('0x34')](_0x1d2b8a[_0xc4e1('0x30')],_0x1d2b8a[_0xc4e1('0x32')]);_0x2057ef['attributes']=_[_0xc4e1('0x34')](_0x1d2b8a[_0xc4e1('0x30')],qs[_0xc4e1('0x35')](_0x307b4a[_0xc4e1('0x32')][_0xc4e1('0x35')]));_0x2057ef[_0xc4e1('0x36')]=_0x2057ef[_0xc4e1('0x36')]['length']?_0x2057ef[_0xc4e1('0x36')]:_0x1d2b8a['model'];if(!_0x307b4a['query']['hasOwnProperty']('nolimit')){_0x2057ef[_0xc4e1('0x37')]=qs[_0xc4e1('0x37')](_0x307b4a[_0xc4e1('0x32')][_0xc4e1('0x37')]);_0x2057ef[_0xc4e1('0x25')]=qs[_0xc4e1('0x25')](_0x307b4a[_0xc4e1('0x32')][_0xc4e1('0x25')]);}_0x2057ef[_0xc4e1('0x38')]=qs[_0xc4e1('0x39')](_0x307b4a[_0xc4e1('0x32')][_0xc4e1('0x39')]);_0x2057ef[_0xc4e1('0x3a')]=qs[_0xc4e1('0x33')](_['pick'](_0x307b4a['query'],_0x1d2b8a[_0xc4e1('0x33')]),_0x5c6f7c);if(_0x307b4a[_0xc4e1('0x32')][_0xc4e1('0x3b')]){_0x2057ef[_0xc4e1('0x3a')]=_[_0xc4e1('0x3c')](_0x2057ef[_0xc4e1('0x3a')],{'$or':_[_0xc4e1('0x2e')](_0x5c6f7c,function(_0x401b5c){if(_0x401b5c[_0xc4e1('0x3d')]!=='VIRTUAL'){var _0xe32110={};_0xe32110[_0x401b5c[_0xc4e1('0x2c')]]={'$like':'%'+_0x307b4a[_0xc4e1('0x32')]['filter']+'%'};return _0xe32110;}})});}_0x2057ef=_[_0xc4e1('0x3c')]({},_0x2057ef,_0x307b4a[_0xc4e1('0x3e')]);var _0x4edfc0={'where':_0x2057ef[_0xc4e1('0x3a')]};return db[_0xc4e1('0x3f')][_0xc4e1('0x40')](_0x4edfc0)[_0xc4e1('0x19')](function(_0x3c6780){_0x32bb23['count']=_0x3c6780;if(_0x307b4a[_0xc4e1('0x32')]['includeAll']){_0x2057ef[_0xc4e1('0x41')]=[{'all':!![]}];}return db[_0xc4e1('0x3f')][_0xc4e1('0x42')](_0x2057ef);})[_0xc4e1('0x19')](function(_0x4547cb){_0x32bb23[_0xc4e1('0x43')]=_0x4547cb;return _0x32bb23;})[_0xc4e1('0x19')](respondWithFilteredResult(_0x29eb99,_0x2057ef))[_0xc4e1('0x44')](handleError(_0x29eb99,null));};exports[_0xc4e1('0x45')]=function(_0x3ae703,_0x1deeed){var _0x876d0c={'raw':![],'where':{'id':_0x3ae703[_0xc4e1('0x46')]['id']}},_0x426fc9={};_0x426fc9[_0xc4e1('0x30')]=_['keys'](db[_0xc4e1('0x3f')]['rawAttributes']);_0x426fc9[_0xc4e1('0x32')]=_[_0xc4e1('0x31')](_0x3ae703[_0xc4e1('0x32')]);_0x426fc9[_0xc4e1('0x33')]=_[_0xc4e1('0x34')](_0x426fc9[_0xc4e1('0x30')],_0x426fc9[_0xc4e1('0x32')]);_0x876d0c[_0xc4e1('0x36')]=_[_0xc4e1('0x34')](_0x426fc9['model'],qs[_0xc4e1('0x35')](_0x3ae703[_0xc4e1('0x32')][_0xc4e1('0x35')]));_0x876d0c[_0xc4e1('0x36')]=_0x876d0c['attributes']['length']?_0x876d0c[_0xc4e1('0x36')]:_0x426fc9['model'];if(_0x3ae703['query']['includeAll']){_0x876d0c[_0xc4e1('0x41')]=[{'all':!![]}];}_0x876d0c=_[_0xc4e1('0x3c')]({},_0x876d0c,_0x3ae703[_0xc4e1('0x3e')]);return db[_0xc4e1('0x3f')][_0xc4e1('0x47')](_0x876d0c)[_0xc4e1('0x19')](handleEntityNotFound(_0x1deeed,null))[_0xc4e1('0x19')](respondWithResult(_0x1deeed,null))[_0xc4e1('0x44')](handleError(_0x1deeed,null));};exports[_0xc4e1('0x48')]=function(_0x11868b,_0x52262e){return db[_0xc4e1('0x3f')][_0xc4e1('0x48')](_0x11868b['body'],{})['then'](respondWithResult(_0x52262e,0xc9))[_0xc4e1('0x44')](handleError(_0x52262e,null));};exports['update']=function(_0x91f081,_0x16a776){if(_0x91f081['body']['id']){delete _0x91f081['body']['id'];}return db[_0xc4e1('0x3f')][_0xc4e1('0x47')]({'where':{'id':_0x91f081[_0xc4e1('0x46')]['id']}})[_0xc4e1('0x19')](handleEntityNotFound(_0x16a776,null))[_0xc4e1('0x19')](saveUpdates(_0x91f081[_0xc4e1('0x49')],null))[_0xc4e1('0x19')](respondWithResult(_0x16a776,null))['catch'](handleError(_0x16a776,null));};exports[_0xc4e1('0x29')]=function(_0x16be51,_0x469ac5){return db[_0xc4e1('0x3f')][_0xc4e1('0x47')]({'where':{'id':_0x16be51[_0xc4e1('0x46')]['id']}})[_0xc4e1('0x19')](handleEntityNotFound(_0x469ac5,null))[_0xc4e1('0x19')](removeEntity(_0x469ac5,null))[_0xc4e1('0x44')](handleError(_0x469ac5,null));};exports['getFields']=function(_0x47e6e1,_0x220466,_0x26b948){var _0x5beabf={};var _0x1c618e={};var _0xeb8be5;var _0x9514fd;return db[_0xc4e1('0x3f')][_0xc4e1('0x4a')]({'where':{'id':_0x47e6e1[_0xc4e1('0x46')]['id']}})[_0xc4e1('0x19')](handleEntityNotFound(_0x220466,null))[_0xc4e1('0x19')](function(_0x29a994){if(_0x29a994){_0xeb8be5=_0x29a994;_0x1c618e['model']=_[_0xc4e1('0x31')](db[_0xc4e1('0x4b')][_0xc4e1('0x2f')]);_0x1c618e[_0xc4e1('0x32')]=_['keys'](_0x47e6e1[_0xc4e1('0x32')]);_0x1c618e[_0xc4e1('0x33')]=_[_0xc4e1('0x34')](_0x1c618e[_0xc4e1('0x30')],_0x1c618e['query']);_0x5beabf['attributes']=_[_0xc4e1('0x34')](_0x1c618e[_0xc4e1('0x30')],qs[_0xc4e1('0x35')](_0x47e6e1[_0xc4e1('0x32')][_0xc4e1('0x35')]));_0x5beabf['attributes']=_0x5beabf[_0xc4e1('0x36')]['length']?_0x5beabf['attributes']:_0x1c618e['model'];_0x5beabf[_0xc4e1('0x38')]=qs[_0xc4e1('0x39')](_0x47e6e1[_0xc4e1('0x32')][_0xc4e1('0x39')]);_0x5beabf[_0xc4e1('0x3a')]=qs[_0xc4e1('0x33')](_['pick'](_0x47e6e1[_0xc4e1('0x32')],_0x1c618e[_0xc4e1('0x33')]));if(_0x47e6e1[_0xc4e1('0x32')][_0xc4e1('0x3b')]){_0x5beabf['where']=_[_0xc4e1('0x3c')](_0x5beabf[_0xc4e1('0x3a')],{'$or':_[_0xc4e1('0x2e')](_0x5beabf[_0xc4e1('0x36')],function(_0x1a5c03){var _0x7d7bea={};_0x7d7bea[_0x1a5c03]={'$like':'%'+_0x47e6e1['query'][_0xc4e1('0x3b')]+'%'};return _0x7d7bea;})});}_0x5beabf=_[_0xc4e1('0x3c')]({},_0x5beabf,_0x47e6e1[_0xc4e1('0x3e')]);return _0xeb8be5[_0xc4e1('0x4c')](_0x5beabf);}})['then'](function(_0x15b663){if(_0x15b663){_0x9514fd=_0x15b663[_0xc4e1('0x4d')];if(!_0x47e6e1[_0xc4e1('0x32')][_0xc4e1('0x4e')](_0xc4e1('0x4f'))){_0x5beabf[_0xc4e1('0x37')]=qs[_0xc4e1('0x37')](_0x47e6e1['query'][_0xc4e1('0x37')]);_0x5beabf[_0xc4e1('0x25')]=qs['offset'](_0x47e6e1['query'][_0xc4e1('0x25')]);}return _0xeb8be5[_0xc4e1('0x4c')](_0x5beabf);}})[_0xc4e1('0x19')](function(_0x317d04){if(_0x317d04){return _0x317d04?{'count':_0x9514fd,'rows':_0x317d04}:null;}})[_0xc4e1('0x19')](respondWithResult(_0x220466,null))[_0xc4e1('0x44')](handleError(_0x220466,null));};exports[_0xc4e1('0x50')]=function(_0x53b8f3,_0x37a824,_0x514d9f){var _0x305aa9={};var _0x39c46b={};var _0x27cc40;var _0x3e3d7f;return db[_0xc4e1('0x3f')][_0xc4e1('0x4a')]({'where':{'id':_0x53b8f3[_0xc4e1('0x46')]['id']}})['then'](handleEntityNotFound(_0x37a824,null))[_0xc4e1('0x19')](function(_0x27532a){if(_0x27532a){_0x27cc40=_0x27532a;_0x39c46b[_0xc4e1('0x30')]=_[_0xc4e1('0x31')](db['SalesforceField'][_0xc4e1('0x2f')]);_0x39c46b[_0xc4e1('0x32')]=_[_0xc4e1('0x31')](_0x53b8f3['query']);_0x39c46b[_0xc4e1('0x33')]=_['intersection'](_0x39c46b[_0xc4e1('0x30')],_0x39c46b['query']);_0x305aa9['attributes']=_[_0xc4e1('0x34')](_0x39c46b[_0xc4e1('0x30')],qs[_0xc4e1('0x35')](_0x53b8f3[_0xc4e1('0x32')][_0xc4e1('0x35')]));_0x305aa9[_0xc4e1('0x36')]=_0x305aa9[_0xc4e1('0x36')]['length']?_0x305aa9[_0xc4e1('0x36')]:_0x39c46b[_0xc4e1('0x30')];_0x305aa9[_0xc4e1('0x38')]=qs['sort'](_0x53b8f3[_0xc4e1('0x32')][_0xc4e1('0x39')]);_0x305aa9[_0xc4e1('0x3a')]=qs['filters'](_['pick'](_0x53b8f3['query'],_0x39c46b['filters']));if(_0x53b8f3[_0xc4e1('0x32')][_0xc4e1('0x3b')]){_0x305aa9[_0xc4e1('0x3a')]=_[_0xc4e1('0x3c')](_0x305aa9[_0xc4e1('0x3a')],{'$or':_[_0xc4e1('0x2e')](_0x305aa9[_0xc4e1('0x36')],function(_0x5aad12){var _0x47b4d6={};_0x47b4d6[_0x5aad12]={'$like':'%'+_0x53b8f3[_0xc4e1('0x32')][_0xc4e1('0x3b')]+'%'};return _0x47b4d6;})});}_0x305aa9=_[_0xc4e1('0x3c')]({},_0x305aa9,_0x53b8f3['options']);return _0x27cc40[_0xc4e1('0x50')](_0x305aa9);}})['then'](function(_0x15c0bd){if(_0x15c0bd){_0x3e3d7f=_0x15c0bd[_0xc4e1('0x4d')];if(!_0x53b8f3[_0xc4e1('0x32')][_0xc4e1('0x4e')]('nolimit')){_0x305aa9[_0xc4e1('0x37')]=qs[_0xc4e1('0x37')](_0x53b8f3[_0xc4e1('0x32')]['limit']);_0x305aa9['offset']=qs[_0xc4e1('0x25')](_0x53b8f3[_0xc4e1('0x32')][_0xc4e1('0x25')]);}return _0x27cc40['getSubjects'](_0x305aa9);}})[_0xc4e1('0x19')](function(_0x177cbe){if(_0x177cbe){return _0x177cbe?{'count':_0x3e3d7f,'rows':_0x177cbe}:null;}})[_0xc4e1('0x19')](respondWithResult(_0x37a824,null))[_0xc4e1('0x44')](handleError(_0x37a824,null));};exports['getDescriptions']=function(_0x46a327,_0x4caade,_0x14bba3){var _0xc87716={};var _0x5e508e={};var _0x583dc9;var _0x45feb6;return db[_0xc4e1('0x3f')][_0xc4e1('0x4a')]({'where':{'id':_0x46a327[_0xc4e1('0x46')]['id']}})[_0xc4e1('0x19')](handleEntityNotFound(_0x4caade,null))[_0xc4e1('0x19')](function(_0x4e1391){if(_0x4e1391){_0x583dc9=_0x4e1391;_0x5e508e[_0xc4e1('0x30')]=_['keys'](db[_0xc4e1('0x4b')]['rawAttributes']);_0x5e508e[_0xc4e1('0x32')]=_[_0xc4e1('0x31')](_0x46a327[_0xc4e1('0x32')]);_0x5e508e['filters']=_['intersection'](_0x5e508e['model'],_0x5e508e[_0xc4e1('0x32')]);_0xc87716[_0xc4e1('0x36')]=_['intersection'](_0x5e508e[_0xc4e1('0x30')],qs['fields'](_0x46a327['query'][_0xc4e1('0x35')]));_0xc87716[_0xc4e1('0x36')]=_0xc87716[_0xc4e1('0x36')][_0xc4e1('0x4d')]?_0xc87716[_0xc4e1('0x36')]:_0x5e508e[_0xc4e1('0x30')];_0xc87716[_0xc4e1('0x38')]=qs['sort'](_0x46a327[_0xc4e1('0x32')][_0xc4e1('0x39')]);_0xc87716[_0xc4e1('0x3a')]=qs[_0xc4e1('0x33')](_['pick'](_0x46a327[_0xc4e1('0x32')],_0x5e508e[_0xc4e1('0x33')]));if(_0x46a327['query']['filter']){_0xc87716[_0xc4e1('0x3a')]=_['merge'](_0xc87716[_0xc4e1('0x3a')],{'$or':_['map'](_0xc87716['attributes'],function(_0x4180c5){var _0x164532={};_0x164532[_0x4180c5]={'$like':'%'+_0x46a327[_0xc4e1('0x32')][_0xc4e1('0x3b')]+'%'};return _0x164532;})});}_0xc87716=_['merge']({},_0xc87716,_0x46a327[_0xc4e1('0x3e')]);return _0x583dc9[_0xc4e1('0x51')](_0xc87716);}})['then'](function(_0x2404d1){if(_0x2404d1){_0x45feb6=_0x2404d1[_0xc4e1('0x4d')];if(!_0x46a327[_0xc4e1('0x32')][_0xc4e1('0x4e')]('nolimit')){_0xc87716[_0xc4e1('0x37')]=qs[_0xc4e1('0x37')](_0x46a327['query'][_0xc4e1('0x37')]);_0xc87716[_0xc4e1('0x25')]=qs['offset'](_0x46a327[_0xc4e1('0x32')][_0xc4e1('0x25')]);}return _0x583dc9['getDescriptions'](_0xc87716);}})[_0xc4e1('0x19')](function(_0x18804f){if(_0x18804f){return _0x18804f?{'count':_0x45feb6,'rows':_0x18804f}:null;}})[_0xc4e1('0x19')](respondWithResult(_0x4caade,null))['catch'](handleError(_0x4caade,null));}; \ No newline at end of file +var _0xc4a1=['order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','getFields','SalesforceField','hasOwnProperty','getSubjects','findOne','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','apply','save','update','name','send','index','SalesforceConfiguration','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','nolimit'];(function(_0x4b2bc3,_0x5f36c1){var _0x15391e=function(_0x4c2c7d){while(--_0x4c2c7d){_0x4b2bc3['push'](_0x4b2bc3['shift']());}};_0x15391e(++_0x5f36c1);}(_0xc4a1,0x1ef));var _0x1c4a=function(_0x45dde5,_0x587317){_0x45dde5=_0x45dde5-0x0;var _0x5a9801=_0xc4a1[_0x45dde5];return _0x5a9801;};'use strict';var pdf=require(_0x1c4a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1c4a('0x1'));var zipdir=require(_0x1c4a('0x2'));var jsonpatch=require(_0x1c4a('0x3'));var rp=require('request-promise');var moment=require(_0x1c4a('0x4'));var BPromise=require(_0x1c4a('0x5'));var Mustache=require(_0x1c4a('0x6'));var util=require(_0x1c4a('0x7'));var path=require(_0x1c4a('0x8'));var sox=require(_0x1c4a('0x9'));var csv=require(_0x1c4a('0xa'));var ejs=require(_0x1c4a('0xb'));var fs=require('fs');var _=require(_0x1c4a('0xc'));var squel=require(_0x1c4a('0xd'));var crypto=require(_0x1c4a('0xe'));var jsforce=require(_0x1c4a('0xf'));var deskjs=require(_0x1c4a('0x10'));var toCsv=require('to-csv');var querystring=require(_0x1c4a('0x11'));var Papa=require(_0x1c4a('0x12'));var Redis=require('ioredis');var authService=require(_0x1c4a('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1c4a('0x14'));var logger=require(_0x1c4a('0x15'))('api');var utils=require(_0x1c4a('0x16'));var config=require(_0x1c4a('0x17'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x1c4a('0x18')][_0x1c4a('0x19')]({'port':0x232a});function checkPasswordPattern(_0x582ef1,_0x4c82e4,_0x2211e6){if(_0x2211e6){var _0x4137d4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4137d4[_0x1c4a('0x1a')](_0x4c82e4)){return _0x582ef1;}else{throw new db[(_0x1c4a('0x1b'))][(_0x1c4a('0x1c'))](_0x1c4a('0x1d'));}}else{return _0x582ef1;}}function respondWithRpcPromise(_0x9a2091,_0xa6e823,_0x2867d4,_0x22b2f6){return new BPromise(function(_0x48c1af,_0x3be487){var _0x2355f8=_0x22b2f6||client;return _0x2355f8[_0x1c4a('0x1e')](_0x9a2091,_0x2867d4)[_0x1c4a('0x1f')](function(_0x4e7781){logger['info'](_0x1c4a('0x20'),_0xa6e823,_0x1c4a('0x21'));logger[_0x1c4a('0x22')](_0x1c4a('0x23'),_0xa6e823,'request\x20sent',JSON[_0x1c4a('0x24')](_0x4e7781));if(_0x4e7781[_0x1c4a('0x25')]){if(_0x4e7781['error'][_0x1c4a('0x26')]===0x1f4){logger[_0x1c4a('0x25')](_0x1c4a('0x20'),_0xa6e823,_0x4e7781['error']['message']);return _0x3be487(_0x4e7781[_0x1c4a('0x25')][_0x1c4a('0x27')]);}logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0xa6e823,_0x4e7781[_0x1c4a('0x25')][_0x1c4a('0x27')]);return _0x48c1af(_0x4e7781[_0x1c4a('0x25')][_0x1c4a('0x27')]);}else{logger['info'](_0x1c4a('0x20'),_0xa6e823,_0x1c4a('0x21'));_0x48c1af(_0x4e7781[_0x1c4a('0x28')][_0x1c4a('0x27')]);}})[_0x1c4a('0x29')](function(_0x644d50){logger[_0x1c4a('0x25')](_0x1c4a('0x20'),_0xa6e823,_0x644d50);_0x3be487(_0x644d50);});});}function respondWithStatusCode(_0x84fcaf,_0x1a5c34){_0x1a5c34=_0x1a5c34||0xcc;return function(_0xd10444){if(_0xd10444){return _0x84fcaf[_0x1c4a('0x2a')](_0x1a5c34);}return _0x84fcaf['status'](_0x1a5c34)[_0x1c4a('0x2b')]();};}function respondWithResult(_0x41ffbc,_0xa368c8){_0xa368c8=_0xa368c8||0xc8;return function(_0x16feaf){if(_0x16feaf){return _0x41ffbc[_0x1c4a('0x2c')](_0xa368c8)[_0x1c4a('0x2d')](_0x16feaf);}};}function respondWithFilteredResult(_0x291fc8,_0x15ea64){return function(_0x337742){if(_0x337742){var _0x3ef241=_0x337742[_0x1c4a('0x2e')],_0x45ecdb=_0x15ea64[_0x1c4a('0x2f')],_0x9ab900=_0x15ea64[_0x1c4a('0x2f')]+_0x15ea64[_0x1c4a('0x30')],_0x1ebeee;if(_0x9ab900>=_0x3ef241){_0x9ab900=_0x3ef241;_0x1ebeee=0xc8;}else{_0x1ebeee=0xce;}_0x291fc8[_0x1c4a('0x2c')](_0x1ebeee);return _0x291fc8[_0x1c4a('0x31')]('Content-Range',_0x45ecdb+'-'+_0x9ab900+'/'+_0x3ef241)[_0x1c4a('0x2d')](_0x337742);}return null;};}function patchUpdates(_0x5a7c22){return function(_0x2b9dd3){try{jsonpatch[_0x1c4a('0x32')](_0x2b9dd3,_0x5a7c22,!![]);}catch(_0x36863e){return BPromise['reject'](_0x36863e);}return _0x2b9dd3[_0x1c4a('0x33')]();};}function saveUpdates(_0x567b34,_0x1255f5){return function(_0x1f2897){if(_0x1f2897){return _0x1f2897[_0x1c4a('0x34')](_0x567b34)[_0x1c4a('0x1f')](function(_0x176654){return _0x176654;});}return null;};}function removeEntity(_0x485eee,_0x4efdf7){return function(_0x393c8e){if(_0x393c8e){return _0x393c8e['destroy']()[_0x1c4a('0x1f')](function(){_0x485eee[_0x1c4a('0x2c')](0xcc)[_0x1c4a('0x2b')]();});}};}function handleEntityNotFound(_0x6ab0b6,_0x49d785){return function(_0x4eacb8){if(!_0x4eacb8){_0x6ab0b6[_0x1c4a('0x2a')](0x194);}return _0x4eacb8;};}function handleError(_0x1db864,_0xba2cfa){_0xba2cfa=_0xba2cfa||0x1f4;return function(_0x2c2b99){logger[_0x1c4a('0x25')](_0x2c2b99['stack']);if(_0x2c2b99[_0x1c4a('0x35')]){delete _0x2c2b99[_0x1c4a('0x35')];}_0x1db864['status'](_0xba2cfa)[_0x1c4a('0x36')](_0x2c2b99);};}exports[_0x1c4a('0x37')]=function(_0x48b4d5,_0x54409c){var _0x596f60={},_0x45a66f={},_0x142452={'count':0x0,'rows':[]};var _0x45bbac=_['map'](db[_0x1c4a('0x38')][_0x1c4a('0x39')],function(_0x35875d){return{'name':_0x35875d[_0x1c4a('0x3a')],'type':_0x35875d[_0x1c4a('0x3b')][_0x1c4a('0x3c')]};});_0x45a66f['model']=_['map'](_0x45bbac,_0x1c4a('0x35'));_0x45a66f[_0x1c4a('0x3d')]=_['keys'](_0x48b4d5[_0x1c4a('0x3d')]);_0x45a66f[_0x1c4a('0x3e')]=_[_0x1c4a('0x3f')](_0x45a66f['model'],_0x45a66f[_0x1c4a('0x3d')]);_0x596f60['attributes']=_[_0x1c4a('0x3f')](_0x45a66f[_0x1c4a('0x40')],qs[_0x1c4a('0x41')](_0x48b4d5[_0x1c4a('0x3d')][_0x1c4a('0x41')]));_0x596f60[_0x1c4a('0x42')]=_0x596f60[_0x1c4a('0x42')][_0x1c4a('0x43')]?_0x596f60[_0x1c4a('0x42')]:_0x45a66f['model'];if(!_0x48b4d5[_0x1c4a('0x3d')]['hasOwnProperty'](_0x1c4a('0x44'))){_0x596f60[_0x1c4a('0x30')]=qs[_0x1c4a('0x30')](_0x48b4d5[_0x1c4a('0x3d')][_0x1c4a('0x30')]);_0x596f60[_0x1c4a('0x2f')]=qs[_0x1c4a('0x2f')](_0x48b4d5[_0x1c4a('0x3d')][_0x1c4a('0x2f')]);}_0x596f60[_0x1c4a('0x45')]=qs[_0x1c4a('0x46')](_0x48b4d5[_0x1c4a('0x3d')][_0x1c4a('0x46')]);_0x596f60[_0x1c4a('0x47')]=qs[_0x1c4a('0x3e')](_[_0x1c4a('0x48')](_0x48b4d5['query'],_0x45a66f[_0x1c4a('0x3e')]),_0x45bbac);if(_0x48b4d5[_0x1c4a('0x3d')][_0x1c4a('0x49')]){_0x596f60[_0x1c4a('0x47')]=_[_0x1c4a('0x4a')](_0x596f60[_0x1c4a('0x47')],{'$or':_[_0x1c4a('0x4b')](_0x45bbac,function(_0x35e83c){if(_0x35e83c[_0x1c4a('0x3b')]!==_0x1c4a('0x4c')){var _0xac60c6={};_0xac60c6[_0x35e83c[_0x1c4a('0x35')]]={'$like':'%'+_0x48b4d5[_0x1c4a('0x3d')]['filter']+'%'};return _0xac60c6;}})});}_0x596f60=_['merge']({},_0x596f60,_0x48b4d5[_0x1c4a('0x4d')]);var _0x75260={'where':_0x596f60[_0x1c4a('0x47')]};return db[_0x1c4a('0x38')][_0x1c4a('0x2e')](_0x75260)['then'](function(_0x391d9d){_0x142452['count']=_0x391d9d;if(_0x48b4d5['query'][_0x1c4a('0x4e')]){_0x596f60[_0x1c4a('0x4f')]=[{'all':!![]}];}return db[_0x1c4a('0x38')][_0x1c4a('0x50')](_0x596f60);})[_0x1c4a('0x1f')](function(_0x35fb7d){_0x142452[_0x1c4a('0x51')]=_0x35fb7d;return _0x142452;})[_0x1c4a('0x1f')](respondWithFilteredResult(_0x54409c,_0x596f60))[_0x1c4a('0x29')](handleError(_0x54409c,null));};exports[_0x1c4a('0x52')]=function(_0x429bfa,_0x376f68){var _0x10f204={'raw':![],'where':{'id':_0x429bfa[_0x1c4a('0x53')]['id']}},_0x951f26={};_0x951f26[_0x1c4a('0x40')]=_['keys'](db[_0x1c4a('0x38')][_0x1c4a('0x39')]);_0x951f26[_0x1c4a('0x3d')]=_[_0x1c4a('0x54')](_0x429bfa['query']);_0x951f26[_0x1c4a('0x3e')]=_[_0x1c4a('0x3f')](_0x951f26[_0x1c4a('0x40')],_0x951f26['query']);_0x10f204['attributes']=_[_0x1c4a('0x3f')](_0x951f26[_0x1c4a('0x40')],qs[_0x1c4a('0x41')](_0x429bfa['query']['fields']));_0x10f204[_0x1c4a('0x42')]=_0x10f204[_0x1c4a('0x42')][_0x1c4a('0x43')]?_0x10f204[_0x1c4a('0x42')]:_0x951f26[_0x1c4a('0x40')];if(_0x429bfa['query'][_0x1c4a('0x4e')]){_0x10f204[_0x1c4a('0x4f')]=[{'all':!![]}];}_0x10f204=_[_0x1c4a('0x4a')]({},_0x10f204,_0x429bfa[_0x1c4a('0x4d')]);return db[_0x1c4a('0x38')][_0x1c4a('0x55')](_0x10f204)[_0x1c4a('0x1f')](handleEntityNotFound(_0x376f68,null))[_0x1c4a('0x1f')](respondWithResult(_0x376f68,null))[_0x1c4a('0x29')](handleError(_0x376f68,null));};exports[_0x1c4a('0x56')]=function(_0x442ddb,_0x37324d){return db[_0x1c4a('0x38')][_0x1c4a('0x56')](_0x442ddb[_0x1c4a('0x57')],{})[_0x1c4a('0x1f')](respondWithResult(_0x37324d,0xc9))[_0x1c4a('0x29')](handleError(_0x37324d,null));};exports[_0x1c4a('0x34')]=function(_0x6280b5,_0xd9b33c){if(_0x6280b5[_0x1c4a('0x57')]['id']){delete _0x6280b5[_0x1c4a('0x57')]['id'];}return db[_0x1c4a('0x38')][_0x1c4a('0x55')]({'where':{'id':_0x6280b5['params']['id']}})[_0x1c4a('0x1f')](handleEntityNotFound(_0xd9b33c,null))[_0x1c4a('0x1f')](saveUpdates(_0x6280b5[_0x1c4a('0x57')],null))['then'](respondWithResult(_0xd9b33c,null))[_0x1c4a('0x29')](handleError(_0xd9b33c,null));};exports['destroy']=function(_0x3061df,_0xda81ea){return db[_0x1c4a('0x38')][_0x1c4a('0x55')]({'where':{'id':_0x3061df[_0x1c4a('0x53')]['id']}})[_0x1c4a('0x1f')](handleEntityNotFound(_0xda81ea,null))[_0x1c4a('0x1f')](removeEntity(_0xda81ea,null))[_0x1c4a('0x29')](handleError(_0xda81ea,null));};exports[_0x1c4a('0x58')]=function(_0x1f79c3,_0x4746ff,_0x7c0604){var _0x4c2178={};var _0x2cefed={};var _0x3e8ca1;var _0x2d3d0a;return db[_0x1c4a('0x38')]['findOne']({'where':{'id':_0x1f79c3['params']['id']}})['then'](handleEntityNotFound(_0x4746ff,null))[_0x1c4a('0x1f')](function(_0xb32d4c){if(_0xb32d4c){_0x3e8ca1=_0xb32d4c;_0x2cefed[_0x1c4a('0x40')]=_['keys'](db[_0x1c4a('0x59')][_0x1c4a('0x39')]);_0x2cefed[_0x1c4a('0x3d')]=_[_0x1c4a('0x54')](_0x1f79c3[_0x1c4a('0x3d')]);_0x2cefed[_0x1c4a('0x3e')]=_[_0x1c4a('0x3f')](_0x2cefed[_0x1c4a('0x40')],_0x2cefed[_0x1c4a('0x3d')]);_0x4c2178['attributes']=_[_0x1c4a('0x3f')](_0x2cefed[_0x1c4a('0x40')],qs['fields'](_0x1f79c3[_0x1c4a('0x3d')][_0x1c4a('0x41')]));_0x4c2178['attributes']=_0x4c2178[_0x1c4a('0x42')][_0x1c4a('0x43')]?_0x4c2178[_0x1c4a('0x42')]:_0x2cefed[_0x1c4a('0x40')];_0x4c2178[_0x1c4a('0x45')]=qs['sort'](_0x1f79c3[_0x1c4a('0x3d')]['sort']);_0x4c2178[_0x1c4a('0x47')]=qs['filters'](_[_0x1c4a('0x48')](_0x1f79c3['query'],_0x2cefed[_0x1c4a('0x3e')]));if(_0x1f79c3[_0x1c4a('0x3d')][_0x1c4a('0x49')]){_0x4c2178[_0x1c4a('0x47')]=_[_0x1c4a('0x4a')](_0x4c2178[_0x1c4a('0x47')],{'$or':_[_0x1c4a('0x4b')](_0x4c2178[_0x1c4a('0x42')],function(_0x53d637){var _0x49b655={};_0x49b655[_0x53d637]={'$like':'%'+_0x1f79c3[_0x1c4a('0x3d')][_0x1c4a('0x49')]+'%'};return _0x49b655;})});}_0x4c2178=_[_0x1c4a('0x4a')]({},_0x4c2178,_0x1f79c3[_0x1c4a('0x4d')]);return _0x3e8ca1[_0x1c4a('0x58')](_0x4c2178);}})[_0x1c4a('0x1f')](function(_0x403fb8){if(_0x403fb8){_0x2d3d0a=_0x403fb8['length'];if(!_0x1f79c3[_0x1c4a('0x3d')][_0x1c4a('0x5a')]('nolimit')){_0x4c2178['limit']=qs[_0x1c4a('0x30')](_0x1f79c3['query'][_0x1c4a('0x30')]);_0x4c2178[_0x1c4a('0x2f')]=qs['offset'](_0x1f79c3['query'][_0x1c4a('0x2f')]);}return _0x3e8ca1[_0x1c4a('0x58')](_0x4c2178);}})[_0x1c4a('0x1f')](function(_0x35ea75){if(_0x35ea75){return _0x35ea75?{'count':_0x2d3d0a,'rows':_0x35ea75}:null;}})[_0x1c4a('0x1f')](respondWithResult(_0x4746ff,null))[_0x1c4a('0x29')](handleError(_0x4746ff,null));};exports[_0x1c4a('0x5b')]=function(_0xf5db32,_0x37e50e,_0x386ac8){var _0x36b215={};var _0x4e5126={};var _0x35ee06;var _0x24e639;return db[_0x1c4a('0x38')][_0x1c4a('0x5c')]({'where':{'id':_0xf5db32['params']['id']}})[_0x1c4a('0x1f')](handleEntityNotFound(_0x37e50e,null))[_0x1c4a('0x1f')](function(_0xc58aed){if(_0xc58aed){_0x35ee06=_0xc58aed;_0x4e5126[_0x1c4a('0x40')]=_[_0x1c4a('0x54')](db[_0x1c4a('0x59')][_0x1c4a('0x39')]);_0x4e5126[_0x1c4a('0x3d')]=_[_0x1c4a('0x54')](_0xf5db32['query']);_0x4e5126[_0x1c4a('0x3e')]=_['intersection'](_0x4e5126[_0x1c4a('0x40')],_0x4e5126['query']);_0x36b215[_0x1c4a('0x42')]=_['intersection'](_0x4e5126[_0x1c4a('0x40')],qs[_0x1c4a('0x41')](_0xf5db32[_0x1c4a('0x3d')][_0x1c4a('0x41')]));_0x36b215[_0x1c4a('0x42')]=_0x36b215[_0x1c4a('0x42')]['length']?_0x36b215[_0x1c4a('0x42')]:_0x4e5126[_0x1c4a('0x40')];_0x36b215[_0x1c4a('0x45')]=qs[_0x1c4a('0x46')](_0xf5db32[_0x1c4a('0x3d')][_0x1c4a('0x46')]);_0x36b215[_0x1c4a('0x47')]=qs[_0x1c4a('0x3e')](_[_0x1c4a('0x48')](_0xf5db32[_0x1c4a('0x3d')],_0x4e5126[_0x1c4a('0x3e')]));if(_0xf5db32[_0x1c4a('0x3d')][_0x1c4a('0x49')]){_0x36b215['where']=_[_0x1c4a('0x4a')](_0x36b215['where'],{'$or':_[_0x1c4a('0x4b')](_0x36b215[_0x1c4a('0x42')],function(_0x16a024){var _0x118459={};_0x118459[_0x16a024]={'$like':'%'+_0xf5db32[_0x1c4a('0x3d')][_0x1c4a('0x49')]+'%'};return _0x118459;})});}_0x36b215=_[_0x1c4a('0x4a')]({},_0x36b215,_0xf5db32['options']);return _0x35ee06[_0x1c4a('0x5b')](_0x36b215);}})[_0x1c4a('0x1f')](function(_0xf732d0){if(_0xf732d0){_0x24e639=_0xf732d0[_0x1c4a('0x43')];if(!_0xf5db32[_0x1c4a('0x3d')]['hasOwnProperty'](_0x1c4a('0x44'))){_0x36b215[_0x1c4a('0x30')]=qs[_0x1c4a('0x30')](_0xf5db32[_0x1c4a('0x3d')][_0x1c4a('0x30')]);_0x36b215[_0x1c4a('0x2f')]=qs[_0x1c4a('0x2f')](_0xf5db32[_0x1c4a('0x3d')][_0x1c4a('0x2f')]);}return _0x35ee06[_0x1c4a('0x5b')](_0x36b215);}})[_0x1c4a('0x1f')](function(_0x5c39a2){if(_0x5c39a2){return _0x5c39a2?{'count':_0x24e639,'rows':_0x5c39a2}:null;}})['then'](respondWithResult(_0x37e50e,null))[_0x1c4a('0x29')](handleError(_0x37e50e,null));};exports[_0x1c4a('0x5d')]=function(_0x499736,_0x205992,_0xefc98e){var _0x325971={};var _0xec1d7c={};var _0x5e2a92;var _0xec2908;return db[_0x1c4a('0x38')][_0x1c4a('0x5c')]({'where':{'id':_0x499736[_0x1c4a('0x53')]['id']}})[_0x1c4a('0x1f')](handleEntityNotFound(_0x205992,null))['then'](function(_0x132b43){if(_0x132b43){_0x5e2a92=_0x132b43;_0xec1d7c[_0x1c4a('0x40')]=_['keys'](db[_0x1c4a('0x59')][_0x1c4a('0x39')]);_0xec1d7c[_0x1c4a('0x3d')]=_[_0x1c4a('0x54')](_0x499736[_0x1c4a('0x3d')]);_0xec1d7c[_0x1c4a('0x3e')]=_['intersection'](_0xec1d7c[_0x1c4a('0x40')],_0xec1d7c[_0x1c4a('0x3d')]);_0x325971[_0x1c4a('0x42')]=_[_0x1c4a('0x3f')](_0xec1d7c[_0x1c4a('0x40')],qs[_0x1c4a('0x41')](_0x499736['query'][_0x1c4a('0x41')]));_0x325971[_0x1c4a('0x42')]=_0x325971[_0x1c4a('0x42')][_0x1c4a('0x43')]?_0x325971[_0x1c4a('0x42')]:_0xec1d7c[_0x1c4a('0x40')];_0x325971[_0x1c4a('0x45')]=qs[_0x1c4a('0x46')](_0x499736[_0x1c4a('0x3d')][_0x1c4a('0x46')]);_0x325971['where']=qs['filters'](_[_0x1c4a('0x48')](_0x499736[_0x1c4a('0x3d')],_0xec1d7c[_0x1c4a('0x3e')]));if(_0x499736[_0x1c4a('0x3d')]['filter']){_0x325971[_0x1c4a('0x47')]=_[_0x1c4a('0x4a')](_0x325971[_0x1c4a('0x47')],{'$or':_['map'](_0x325971[_0x1c4a('0x42')],function(_0x422ac6){var _0x3cac3f={};_0x3cac3f[_0x422ac6]={'$like':'%'+_0x499736['query'][_0x1c4a('0x49')]+'%'};return _0x3cac3f;})});}_0x325971=_[_0x1c4a('0x4a')]({},_0x325971,_0x499736[_0x1c4a('0x4d')]);return _0x5e2a92[_0x1c4a('0x5d')](_0x325971);}})[_0x1c4a('0x1f')](function(_0xc5e9d9){if(_0xc5e9d9){_0xec2908=_0xc5e9d9[_0x1c4a('0x43')];if(!_0x499736[_0x1c4a('0x3d')]['hasOwnProperty'](_0x1c4a('0x44'))){_0x325971[_0x1c4a('0x30')]=qs[_0x1c4a('0x30')](_0x499736[_0x1c4a('0x3d')][_0x1c4a('0x30')]);_0x325971['offset']=qs[_0x1c4a('0x2f')](_0x499736[_0x1c4a('0x3d')][_0x1c4a('0x2f')]);}return _0x5e2a92[_0x1c4a('0x5d')](_0x325971);}})['then'](function(_0x35e2e8){if(_0x35e2e8){return _0x35e2e8?{'count':_0xec2908,'rows':_0x35e2e8}:null;}})[_0x1c4a('0x1f')](respondWithResult(_0x205992,null))[_0x1c4a('0x29')](handleError(_0x205992,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 78d31dc..def1f17 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 _0xf86c=['request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','moment'];(function(_0x2e32d7,_0x591a19){var _0x1d1bc9=function(_0x41d83b){while(--_0x41d83b){_0x2e32d7['push'](_0x2e32d7['shift']());}};_0x1d1bc9(++_0x591a19);}(_0xf86c,0x128));var _0xcf86=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf86c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcf86('0x0'));var util=require(_0xcf86('0x1'));var logger=require(_0xcf86('0x2'))('api');var moment=require(_0xcf86('0x3'));var BPromise=require('bluebird');var rp=require(_0xcf86('0x4'));var fs=require('fs');var path=require(_0xcf86('0x5'));var rimraf=require(_0xcf86('0x6'));var config=require(_0xcf86('0x7'));var attributes=require(_0xcf86('0x8'));module[_0xcf86('0x9')]=function(_0x5e6335,_0x2977e8){return _0x5e6335['define'](_0xcf86('0xa'),attributes,{'tableName':_0xcf86('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x60dd=['moment','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api'];(function(_0x45f406,_0x4b1332){var _0x4b7540=function(_0xadd89){while(--_0xadd89){_0x45f406['push'](_0x45f406['shift']());}};_0x4b7540(++_0x4b1332);}(_0x60dd,0xcc));var _0xd60d=function(_0x51b58a,_0xad7ba7){_0x51b58a=_0x51b58a-0x0;var _0x467486=_0x60dd[_0x51b58a];return _0x467486;};'use strict';var _=require(_0xd60d('0x0'));var util=require(_0xd60d('0x1'));var logger=require(_0xd60d('0x2'))(_0xd60d('0x3'));var moment=require(_0xd60d('0x4'));var BPromise=require('bluebird');var rp=require(_0xd60d('0x5'));var fs=require('fs');var path=require(_0xd60d('0x6'));var rimraf=require(_0xd60d('0x7'));var config=require(_0xd60d('0x8'));var attributes=require(_0xd60d('0x9'));module[_0xd60d('0xa')]=function(_0x39d066,_0x386eaf){return _0x39d066['define'](_0xd60d('0xb'),attributes,{'tableName':_0xd60d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index b88062d..d1762de 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 _0x9346=['SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9346,0x1c0));var _0x6934=function(_0xd662d,_0x5b52ea){_0xd662d=_0xd662d-0x0;var _0x336d4d=_0x9346[_0xd662d];return _0x336d4d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6934('0x0'));var BPromise=require(_0x6934('0x1'));var rs=require(_0x6934('0x2'));var fs=require('fs');var Redis=require(_0x6934('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6934('0x4'));var logger=require('../../config/logger')(_0x6934('0x5'));var config=require(_0x6934('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6934('0x7')][_0x6934('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45f153,_0x3ce91c,_0x4d087a){return new BPromise(function(_0x2691af,_0x54f4f7){return client[_0x6934('0x9')](_0x45f153,_0x4d087a)[_0x6934('0xa')](function(_0x53366b){logger[_0x6934('0xb')](_0x6934('0xc'),_0x3ce91c,_0x6934('0xd'));logger['debug'](_0x6934('0xe'),_0x3ce91c,_0x6934('0xd'),JSON[_0x6934('0xf')](_0x53366b));if(_0x53366b[_0x6934('0x10')]){if(_0x53366b[_0x6934('0x10')]['code']===0x1f4){logger[_0x6934('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3ce91c,_0x53366b[_0x6934('0x10')][_0x6934('0x11')]);return _0x54f4f7(_0x53366b[_0x6934('0x10')][_0x6934('0x11')]);}logger['error'](_0x6934('0xc'),_0x3ce91c,_0x53366b[_0x6934('0x10')][_0x6934('0x11')]);return _0x2691af(_0x53366b[_0x6934('0x10')][_0x6934('0x11')]);}else{logger[_0x6934('0xb')](_0x6934('0xc'),_0x3ce91c,_0x6934('0xd'));_0x2691af(_0x53366b[_0x6934('0x12')][_0x6934('0x11')]);}})[_0x6934('0x13')](function(_0x500a69){logger[_0x6934('0x10')](_0x6934('0xc'),_0x3ce91c,_0x500a69);_0x54f4f7(_0x500a69);});});} \ No newline at end of file +var _0xb81c=['message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x57c61d,_0x25f5e0){var _0x124046=function(_0x664e7a){while(--_0x664e7a){_0x57c61d['push'](_0x57c61d['shift']());}};_0x124046(++_0x25f5e0);}(_0xb81c,0xd4));var _0xcb81=function(_0x5ee9f5,_0xdbca0a){_0x5ee9f5=_0x5ee9f5-0x0;var _0x5469cc=_0xb81c[_0x5ee9f5];return _0x5469cc;};'use strict';var _=require('lodash');var util=require(_0xcb81('0x0'));var moment=require(_0xcb81('0x1'));var BPromise=require(_0xcb81('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb81('0x3'));var db=require(_0xcb81('0x4'))['db'];var utils=require(_0xcb81('0x5'));var logger=require('../../config/logger')(_0xcb81('0x6'));var config=require(_0xcb81('0x7'));var jayson=require(_0xcb81('0x8'));var client=jayson[_0xcb81('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd9a89c,_0x5cd8a2,_0x1f5b29){return new BPromise(function(_0x4fbde4,_0x380b4e){return client[_0xcb81('0xa')](_0xd9a89c,_0x1f5b29)['then'](function(_0xeb333f){logger[_0xcb81('0xb')](_0xcb81('0xc'),_0x5cd8a2,_0xcb81('0xd'));logger[_0xcb81('0xe')](_0xcb81('0xf'),_0x5cd8a2,_0xcb81('0xd'),JSON[_0xcb81('0x10')](_0xeb333f));if(_0xeb333f[_0xcb81('0x11')]){if(_0xeb333f[_0xcb81('0x11')][_0xcb81('0x12')]===0x1f4){logger[_0xcb81('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x5cd8a2,_0xeb333f['error'][_0xcb81('0x13')]);return _0x380b4e(_0xeb333f[_0xcb81('0x11')][_0xcb81('0x13')]);}logger[_0xcb81('0x11')](_0xcb81('0xc'),_0x5cd8a2,_0xeb333f[_0xcb81('0x11')][_0xcb81('0x13')]);return _0x4fbde4(_0xeb333f[_0xcb81('0x11')]['message']);}else{logger[_0xcb81('0xb')](_0xcb81('0xc'),_0x5cd8a2,'request\x20sent');_0x4fbde4(_0xeb333f[_0xcb81('0x14')][_0xcb81('0x13')]);}})['catch'](function(_0x29ae1c){logger[_0xcb81('0x11')](_0xcb81('0xc'),_0x5cd8a2,_0x29ae1c);_0x380b4e(_0x29ae1c);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index d0eac6d..7598ae1 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 _0x5162=['put','/:id','update','delete','multer','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','show','post','create'];(function(_0x3aef0f,_0x4dd6b9){var _0x2fdade=function(_0x58096a){while(--_0x58096a){_0x3aef0f['push'](_0x3aef0f['shift']());}};_0x2fdade(++_0x4dd6b9);}(_0x5162,0x103));var _0x2516=function(_0x3ba924,_0x3b99f0){_0x3ba924=_0x3ba924-0x0;var _0x4cc1df=_0x5162[_0x3ba924];return _0x4cc1df;};'use strict';var multer=require(_0x2516('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2516('0x1')]();var auth=require(_0x2516('0x2'));var interaction=require(_0x2516('0x3'));var config=require(_0x2516('0x4'));var controller=require(_0x2516('0x5'));router[_0x2516('0x6')]('/',auth[_0x2516('0x7')](),controller['index']);router['get']('/:id',auth[_0x2516('0x7')](),controller[_0x2516('0x8')]);router[_0x2516('0x9')]('/',auth[_0x2516('0x7')](),controller[_0x2516('0xa')]);router[_0x2516('0xb')](_0x2516('0xc'),auth['isAuthenticated'](),controller[_0x2516('0xd')]);router[_0x2516('0xe')](_0x2516('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xfb65=['./intSalesforceField.controller','get','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1727b1,_0x59cd2d){var _0x45b565=function(_0x562152){while(--_0x562152){_0x1727b1['push'](_0x1727b1['shift']());}};_0x45b565(++_0x59cd2d);}(_0xfb65,0x82));var _0x5fb6=function(_0x37bf1b,_0x493987){_0x37bf1b=_0x37bf1b-0x0;var _0x34603d=_0xfb65[_0x37bf1b];return _0x34603d;};'use strict';var multer=require('multer');var util=require(_0x5fb6('0x0'));var path=require(_0x5fb6('0x1'));var timeout=require('connect-timeout');var express=require(_0x5fb6('0x2'));var router=express['Router']();var auth=require(_0x5fb6('0x3'));var interaction=require(_0x5fb6('0x4'));var config=require(_0x5fb6('0x5'));var controller=require(_0x5fb6('0x6'));router[_0x5fb6('0x7')]('/',auth[_0x5fb6('0x8')](),controller['index']);router['get'](_0x5fb6('0x9'),auth[_0x5fb6('0x8')](),controller[_0x5fb6('0xa')]);router[_0x5fb6('0xb')]('/',auth['isAuthenticated'](),controller[_0x5fb6('0xc')]);router[_0x5fb6('0xd')](_0x5fb6('0x9'),auth[_0x5fb6('0x8')](),controller['update']);router[_0x5fb6('0xe')](_0x5fb6('0x9'),auth['isAuthenticated'](),controller[_0x5fb6('0xf')]);module[_0x5fb6('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index afc80c2..44fcda0 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 _0x8c14=['variable','customVariable','keyValue','STRING','ENUM','sequelize','exports','string'];(function(_0x382f26,_0x4742f8){var _0x4a25fd=function(_0xd47b90){while(--_0xd47b90){_0x382f26['push'](_0x382f26['shift']());}};_0x4a25fd(++_0x4742f8);}(_0x8c14,0x13d));var _0x48c1=function(_0x580883,_0x3b1a50){_0x580883=_0x580883-0x0;var _0x57fc71=_0x8c14[_0x580883];return _0x57fc71;};'use strict';var Sequelize=require(_0x48c1('0x0'));module[_0x48c1('0x1')]={'type':{'type':Sequelize['ENUM'](_0x48c1('0x2'),_0x48c1('0x3'),_0x48c1('0x4'),_0x48c1('0x5')),'defaultValue':_0x48c1('0x2')},'content':{'type':Sequelize[_0x48c1('0x6')]},'key':{'type':Sequelize[_0x48c1('0x6')]},'keyType':{'type':Sequelize[_0x48c1('0x7')](_0x48c1('0x2'),'variable',_0x48c1('0x4'))},'keyContent':{'type':Sequelize[_0x48c1('0x6')]},'idField':{'type':Sequelize[_0x48c1('0x6')]},'variableName':{'type':Sequelize[_0x48c1('0x6')]}}; \ No newline at end of file +var _0x7c1f=['STRING','sequelize','ENUM','string','variable','customVariable','keyValue'];(function(_0x495d6b,_0x3c5fd0){var _0x1c2204=function(_0x5bca7d){while(--_0x5bca7d){_0x495d6b['push'](_0x495d6b['shift']());}};_0x1c2204(++_0x3c5fd0);}(_0x7c1f,0xd3));var _0xf7c1=function(_0x2f5c3a,_0x448678){_0x2f5c3a=_0x2f5c3a-0x0;var _0x173649=_0x7c1f[_0x2f5c3a];return _0x173649;};'use strict';var Sequelize=require(_0xf7c1('0x0'));module['exports']={'type':{'type':Sequelize[_0xf7c1('0x1')](_0xf7c1('0x2'),_0xf7c1('0x3'),_0xf7c1('0x4'),_0xf7c1('0x5')),'defaultValue':_0xf7c1('0x2')},'content':{'type':Sequelize[_0xf7c1('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xf7c1('0x1')](_0xf7c1('0x2'),_0xf7c1('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xf7c1('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 5d6bcf6..911c05c 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 _0xc486=['html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','json','offset','set','Content-Range','apply','reject','save','update','then','error','name','send','index','SalesforceField','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','length','include','create','body','find','destroy'];(function(_0x5a1587,_0x57010){var _0xac74a7=function(_0x508371){while(--_0x508371){_0x5a1587['push'](_0x5a1587['shift']());}};_0xac74a7(++_0x57010);}(_0xc486,0x90));var _0x6c48=function(_0x5ea60d,_0xf1b6f3){_0x5ea60d=_0x5ea60d-0x0;var _0x1d14eb=_0xc486[_0x5ea60d];return _0x1d14eb;};'use strict';var pdf=require(_0x6c48('0x0'));var emlformat=require(_0x6c48('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6c48('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6c48('0x3'));var moment=require(_0x6c48('0x4'));var BPromise=require(_0x6c48('0x5'));var Mustache=require(_0x6c48('0x6'));var util=require(_0x6c48('0x7'));var path=require(_0x6c48('0x8'));var sox=require(_0x6c48('0x9'));var csv=require(_0x6c48('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6c48('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6c48('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6c48('0xd'));var Papa=require(_0x6c48('0xe'));var Redis=require(_0x6c48('0xf'));var authService=require(_0x6c48('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6c48('0x11'));var hardwareService=require(_0x6c48('0x12'));var logger=require('../../config/logger')(_0x6c48('0x13'));var utils=require('../../config/utils');var config=require(_0x6c48('0x14'));var db=require(_0x6c48('0x15'))['db'];function respondWithStatusCode(_0x38a418,_0x185e13){_0x185e13=_0x185e13||0xcc;return function(_0x52218b){if(_0x52218b){return _0x38a418['sendStatus'](_0x185e13);}return _0x38a418[_0x6c48('0x16')](_0x185e13)['end']();};}function respondWithResult(_0x2de8e5,_0x28f1e9){_0x28f1e9=_0x28f1e9||0xc8;return function(_0x23a482){if(_0x23a482){return _0x2de8e5[_0x6c48('0x16')](_0x28f1e9)[_0x6c48('0x17')](_0x23a482);}};}function respondWithFilteredResult(_0x32b69c,_0x158490){return function(_0x5deb13){if(_0x5deb13){var _0x1398a8=_0x5deb13['count'],_0x5c47cd=_0x158490[_0x6c48('0x18')],_0x449656=_0x158490[_0x6c48('0x18')]+_0x158490['limit'],_0x1c5098;if(_0x449656>=_0x1398a8){_0x449656=_0x1398a8;_0x1c5098=0xc8;}else{_0x1c5098=0xce;}_0x32b69c[_0x6c48('0x16')](_0x1c5098);return _0x32b69c[_0x6c48('0x19')](_0x6c48('0x1a'),_0x5c47cd+'-'+_0x449656+'/'+_0x1398a8)[_0x6c48('0x17')](_0x5deb13);}return null;};}function patchUpdates(_0x3cfa1d){return function(_0x4d970e){try{jsonpatch[_0x6c48('0x1b')](_0x4d970e,_0x3cfa1d,!![]);}catch(_0x514c32){return BPromise[_0x6c48('0x1c')](_0x514c32);}return _0x4d970e[_0x6c48('0x1d')]();};}function saveUpdates(_0x439f64,_0x3ae41a){return function(_0x4e63dc){if(_0x4e63dc){return _0x4e63dc[_0x6c48('0x1e')](_0x439f64)[_0x6c48('0x1f')](function(_0xa6add7){return _0xa6add7;});}return null;};}function removeEntity(_0x481e21,_0x5b5e97){return function(_0x2c64a2){if(_0x2c64a2){return _0x2c64a2['destroy']()[_0x6c48('0x1f')](function(){_0x481e21['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5edfcd,_0x232bc3){return function(_0x49987b){if(!_0x49987b){_0x5edfcd['sendStatus'](0x194);}return _0x49987b;};}function handleError(_0x157f89,_0x57dd11){_0x57dd11=_0x57dd11||0x1f4;return function(_0x98aa00){logger[_0x6c48('0x20')](_0x98aa00['stack']);if(_0x98aa00[_0x6c48('0x21')]){delete _0x98aa00[_0x6c48('0x21')];}_0x157f89[_0x6c48('0x16')](_0x57dd11)[_0x6c48('0x22')](_0x98aa00);};}exports[_0x6c48('0x23')]=function(_0x22f7d3,_0x3633ff){var _0x4a5035={},_0x20b06b={},_0x146c3a={'count':0x0,'rows':[]};var _0x51872e=_['map'](db[_0x6c48('0x24')][_0x6c48('0x25')],function(_0x27eb80){return{'name':_0x27eb80[_0x6c48('0x26')],'type':_0x27eb80['type'][_0x6c48('0x27')]};});_0x20b06b[_0x6c48('0x28')]=_[_0x6c48('0x29')](_0x51872e,_0x6c48('0x21'));_0x20b06b[_0x6c48('0x2a')]=_[_0x6c48('0x2b')](_0x22f7d3[_0x6c48('0x2a')]);_0x20b06b[_0x6c48('0x2c')]=_[_0x6c48('0x2d')](_0x20b06b[_0x6c48('0x28')],_0x20b06b['query']);_0x4a5035[_0x6c48('0x2e')]=_[_0x6c48('0x2d')](_0x20b06b[_0x6c48('0x28')],qs[_0x6c48('0x2f')](_0x22f7d3[_0x6c48('0x2a')][_0x6c48('0x2f')]));_0x4a5035[_0x6c48('0x2e')]=_0x4a5035[_0x6c48('0x2e')]['length']?_0x4a5035[_0x6c48('0x2e')]:_0x20b06b[_0x6c48('0x28')];if(!_0x22f7d3[_0x6c48('0x2a')][_0x6c48('0x30')](_0x6c48('0x31'))){_0x4a5035[_0x6c48('0x32')]=qs[_0x6c48('0x32')](_0x22f7d3[_0x6c48('0x2a')]['limit']);_0x4a5035[_0x6c48('0x18')]=qs[_0x6c48('0x18')](_0x22f7d3[_0x6c48('0x2a')][_0x6c48('0x18')]);}_0x4a5035[_0x6c48('0x33')]=qs[_0x6c48('0x34')](_0x22f7d3[_0x6c48('0x2a')][_0x6c48('0x34')]);_0x4a5035[_0x6c48('0x35')]=qs['filters'](_[_0x6c48('0x36')](_0x22f7d3[_0x6c48('0x2a')],_0x20b06b[_0x6c48('0x2c')]),_0x51872e);if(_0x22f7d3[_0x6c48('0x2a')][_0x6c48('0x37')]){_0x4a5035[_0x6c48('0x35')]=_[_0x6c48('0x38')](_0x4a5035[_0x6c48('0x35')],{'$or':_[_0x6c48('0x29')](_0x51872e,function(_0x445817){if(_0x445817['type']!==_0x6c48('0x39')){var _0x3ff6b1={};_0x3ff6b1[_0x445817[_0x6c48('0x21')]]={'$like':'%'+_0x22f7d3['query'][_0x6c48('0x37')]+'%'};return _0x3ff6b1;}})});}_0x4a5035=_['merge']({},_0x4a5035,_0x22f7d3[_0x6c48('0x3a')]);var _0xfef8e4={'where':_0x4a5035[_0x6c48('0x35')]};return db[_0x6c48('0x24')]['count'](_0xfef8e4)['then'](function(_0x427aae){_0x146c3a[_0x6c48('0x3b')]=_0x427aae;if(_0x22f7d3[_0x6c48('0x2a')][_0x6c48('0x3c')]){_0x4a5035['include']=[{'all':!![]}];}return db[_0x6c48('0x24')][_0x6c48('0x3d')](_0x4a5035);})[_0x6c48('0x1f')](function(_0x441640){_0x146c3a[_0x6c48('0x3e')]=_0x441640;return _0x146c3a;})[_0x6c48('0x1f')](respondWithFilteredResult(_0x3633ff,_0x4a5035))[_0x6c48('0x3f')](handleError(_0x3633ff,null));};exports[_0x6c48('0x40')]=function(_0x5858f7,_0x5eb4fc){var _0x3de9db={'raw':!![],'where':{'id':_0x5858f7[_0x6c48('0x41')]['id']}},_0x54ac88={};_0x54ac88['model']=_[_0x6c48('0x2b')](db['SalesforceField'][_0x6c48('0x25')]);_0x54ac88['query']=_[_0x6c48('0x2b')](_0x5858f7[_0x6c48('0x2a')]);_0x54ac88[_0x6c48('0x2c')]=_[_0x6c48('0x2d')](_0x54ac88[_0x6c48('0x28')],_0x54ac88[_0x6c48('0x2a')]);_0x3de9db[_0x6c48('0x2e')]=_[_0x6c48('0x2d')](_0x54ac88[_0x6c48('0x28')],qs[_0x6c48('0x2f')](_0x5858f7[_0x6c48('0x2a')][_0x6c48('0x2f')]));_0x3de9db[_0x6c48('0x2e')]=_0x3de9db['attributes'][_0x6c48('0x42')]?_0x3de9db[_0x6c48('0x2e')]:_0x54ac88[_0x6c48('0x28')];if(_0x5858f7[_0x6c48('0x2a')][_0x6c48('0x3c')]){_0x3de9db[_0x6c48('0x43')]=[{'all':!![]}];}_0x3de9db=_[_0x6c48('0x38')]({},_0x3de9db,_0x5858f7[_0x6c48('0x3a')]);return db[_0x6c48('0x24')]['find'](_0x3de9db)[_0x6c48('0x1f')](handleEntityNotFound(_0x5eb4fc,null))['then'](respondWithResult(_0x5eb4fc,null))[_0x6c48('0x3f')](handleError(_0x5eb4fc,null));};exports[_0x6c48('0x44')]=function(_0x45ddc0,_0x2d3894){return db['SalesforceField'][_0x6c48('0x44')](_0x45ddc0['body'],{})[_0x6c48('0x1f')](respondWithResult(_0x2d3894,0xc9))[_0x6c48('0x3f')](handleError(_0x2d3894,null));};exports[_0x6c48('0x1e')]=function(_0x2860af,_0x51c596){if(_0x2860af[_0x6c48('0x45')]['id']){delete _0x2860af[_0x6c48('0x45')]['id'];}return db[_0x6c48('0x24')][_0x6c48('0x46')]({'where':{'id':_0x2860af[_0x6c48('0x41')]['id']}})[_0x6c48('0x1f')](handleEntityNotFound(_0x51c596,null))[_0x6c48('0x1f')](saveUpdates(_0x2860af[_0x6c48('0x45')],null))[_0x6c48('0x1f')](respondWithResult(_0x51c596,null))[_0x6c48('0x3f')](handleError(_0x51c596,null));};exports[_0x6c48('0x47')]=function(_0x290805,_0x2da04e){return db[_0x6c48('0x24')]['find']({'where':{'id':_0x290805[_0x6c48('0x41')]['id']}})['then'](handleEntityNotFound(_0x2da04e,null))[_0x6c48('0x1f')](removeEntity(_0x2da04e,null))[_0x6c48('0x3f')](handleError(_0x2da04e,null));}; \ No newline at end of file +var _0x471b=['hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','SalesforceField','findAll','rows','catch','params','length','include','find','create','body','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','Content-Range','reject','save','update','then','destroy','name','map','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes'];(function(_0x4c858f,_0xcd21d1){var _0x322921=function(_0x137464){while(--_0x137464){_0x4c858f['push'](_0x4c858f['shift']());}};_0x322921(++_0xcd21d1);}(_0x471b,0x172));var _0xb471=function(_0x19e212,_0x2c31b4){_0x19e212=_0x19e212-0x0;var _0x16b70b=_0x471b[_0x19e212];return _0x16b70b;};'use strict';var pdf=require(_0xb471('0x0'));var emlformat=require(_0xb471('0x1'));var rimraf=require(_0xb471('0x2'));var zipdir=require(_0xb471('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb471('0x4'));var BPromise=require(_0xb471('0x5'));var Mustache=require(_0xb471('0x6'));var util=require(_0xb471('0x7'));var path=require('path');var sox=require(_0xb471('0x8'));var csv=require(_0xb471('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb471('0xa'));var squel=require(_0xb471('0xb'));var crypto=require(_0xb471('0xc'));var jsforce=require(_0xb471('0xd'));var deskjs=require(_0xb471('0xe'));var toCsv=require(_0xb471('0x9'));var querystring=require(_0xb471('0xf'));var Papa=require(_0xb471('0x10'));var Redis=require(_0xb471('0x11'));var authService=require(_0xb471('0x12'));var qs=require(_0xb471('0x13'));var as=require(_0xb471('0x14'));var hardwareService=require(_0xb471('0x15'));var logger=require('../../config/logger')(_0xb471('0x16'));var utils=require(_0xb471('0x17'));var config=require(_0xb471('0x18'));var db=require(_0xb471('0x19'))['db'];function respondWithStatusCode(_0x122640,_0x52ece8){_0x52ece8=_0x52ece8||0xcc;return function(_0x177186){if(_0x177186){return _0x122640[_0xb471('0x1a')](_0x52ece8);}return _0x122640['status'](_0x52ece8)[_0xb471('0x1b')]();};}function respondWithResult(_0x1dbcf1,_0x5935a7){_0x5935a7=_0x5935a7||0xc8;return function(_0x436ced){if(_0x436ced){return _0x1dbcf1['status'](_0x5935a7)[_0xb471('0x1c')](_0x436ced);}};}function respondWithFilteredResult(_0x12ea27,_0xc0e208){return function(_0x470e24){if(_0x470e24){var _0x53bae0=_0x470e24[_0xb471('0x1d')],_0x2c0d46=_0xc0e208[_0xb471('0x1e')],_0x174a0a=_0xc0e208[_0xb471('0x1e')]+_0xc0e208[_0xb471('0x1f')],_0xd050db;if(_0x174a0a>=_0x53bae0){_0x174a0a=_0x53bae0;_0xd050db=0xc8;}else{_0xd050db=0xce;}_0x12ea27[_0xb471('0x20')](_0xd050db);return _0x12ea27['set'](_0xb471('0x21'),_0x2c0d46+'-'+_0x174a0a+'/'+_0x53bae0)[_0xb471('0x1c')](_0x470e24);}return null;};}function patchUpdates(_0x38a190){return function(_0x59e14e){try{jsonpatch['apply'](_0x59e14e,_0x38a190,!![]);}catch(_0x150539){return BPromise[_0xb471('0x22')](_0x150539);}return _0x59e14e[_0xb471('0x23')]();};}function saveUpdates(_0x2af0f7,_0x31ccd1){return function(_0x2fcd10){if(_0x2fcd10){return _0x2fcd10[_0xb471('0x24')](_0x2af0f7)[_0xb471('0x25')](function(_0x4445cd){return _0x4445cd;});}return null;};}function removeEntity(_0x1f77e2,_0x17049d){return function(_0x1a06f3){if(_0x1a06f3){return _0x1a06f3[_0xb471('0x26')]()[_0xb471('0x25')](function(){_0x1f77e2[_0xb471('0x20')](0xcc)[_0xb471('0x1b')]();});}};}function handleEntityNotFound(_0x1f57ed,_0x389693){return function(_0x3be38a){if(!_0x3be38a){_0x1f57ed['sendStatus'](0x194);}return _0x3be38a;};}function handleError(_0x50f5ea,_0x1529ed){_0x1529ed=_0x1529ed||0x1f4;return function(_0x492850){logger['error'](_0x492850['stack']);if(_0x492850[_0xb471('0x27')]){delete _0x492850['name'];}_0x50f5ea[_0xb471('0x20')](_0x1529ed)['send'](_0x492850);};}exports['index']=function(_0x2e4326,_0x38b681){var _0x471654={},_0x437f96={},_0x4ff4df={'count':0x0,'rows':[]};var _0x4fe2e8=_[_0xb471('0x28')](db['SalesforceField'][_0xb471('0x29')],function(_0x1de07d){return{'name':_0x1de07d[_0xb471('0x2a')],'type':_0x1de07d['type']['key']};});_0x437f96[_0xb471('0x2b')]=_[_0xb471('0x28')](_0x4fe2e8,_0xb471('0x27'));_0x437f96[_0xb471('0x2c')]=_[_0xb471('0x2d')](_0x2e4326[_0xb471('0x2c')]);_0x437f96[_0xb471('0x2e')]=_[_0xb471('0x2f')](_0x437f96[_0xb471('0x2b')],_0x437f96[_0xb471('0x2c')]);_0x471654['attributes']=_['intersection'](_0x437f96['model'],qs[_0xb471('0x30')](_0x2e4326[_0xb471('0x2c')][_0xb471('0x30')]));_0x471654[_0xb471('0x31')]=_0x471654['attributes']['length']?_0x471654[_0xb471('0x31')]:_0x437f96['model'];if(!_0x2e4326[_0xb471('0x2c')][_0xb471('0x32')](_0xb471('0x33'))){_0x471654[_0xb471('0x1f')]=qs[_0xb471('0x1f')](_0x2e4326[_0xb471('0x2c')]['limit']);_0x471654[_0xb471('0x1e')]=qs[_0xb471('0x1e')](_0x2e4326[_0xb471('0x2c')]['offset']);}_0x471654['order']=qs['sort'](_0x2e4326['query'][_0xb471('0x34')]);_0x471654[_0xb471('0x35')]=qs['filters'](_[_0xb471('0x36')](_0x2e4326[_0xb471('0x2c')],_0x437f96[_0xb471('0x2e')]),_0x4fe2e8);if(_0x2e4326[_0xb471('0x2c')][_0xb471('0x37')]){_0x471654[_0xb471('0x35')]=_[_0xb471('0x38')](_0x471654['where'],{'$or':_[_0xb471('0x28')](_0x4fe2e8,function(_0x3e2987){if(_0x3e2987[_0xb471('0x39')]!==_0xb471('0x3a')){var _0xada579={};_0xada579[_0x3e2987[_0xb471('0x27')]]={'$like':'%'+_0x2e4326[_0xb471('0x2c')][_0xb471('0x37')]+'%'};return _0xada579;}})});}_0x471654=_[_0xb471('0x38')]({},_0x471654,_0x2e4326[_0xb471('0x3b')]);var _0x25afdd={'where':_0x471654[_0xb471('0x35')]};return db[_0xb471('0x3c')][_0xb471('0x1d')](_0x25afdd)[_0xb471('0x25')](function(_0x41bf25){_0x4ff4df[_0xb471('0x1d')]=_0x41bf25;if(_0x2e4326[_0xb471('0x2c')]['includeAll']){_0x471654['include']=[{'all':!![]}];}return db[_0xb471('0x3c')][_0xb471('0x3d')](_0x471654);})[_0xb471('0x25')](function(_0xd80d0d){_0x4ff4df[_0xb471('0x3e')]=_0xd80d0d;return _0x4ff4df;})[_0xb471('0x25')](respondWithFilteredResult(_0x38b681,_0x471654))[_0xb471('0x3f')](handleError(_0x38b681,null));};exports['show']=function(_0x13477a,_0x1531a2){var _0x2d772f={'raw':!![],'where':{'id':_0x13477a[_0xb471('0x40')]['id']}},_0x3c1ccf={};_0x3c1ccf['model']=_[_0xb471('0x2d')](db[_0xb471('0x3c')][_0xb471('0x29')]);_0x3c1ccf[_0xb471('0x2c')]=_[_0xb471('0x2d')](_0x13477a['query']);_0x3c1ccf[_0xb471('0x2e')]=_[_0xb471('0x2f')](_0x3c1ccf[_0xb471('0x2b')],_0x3c1ccf[_0xb471('0x2c')]);_0x2d772f['attributes']=_['intersection'](_0x3c1ccf[_0xb471('0x2b')],qs[_0xb471('0x30')](_0x13477a[_0xb471('0x2c')][_0xb471('0x30')]));_0x2d772f['attributes']=_0x2d772f[_0xb471('0x31')][_0xb471('0x41')]?_0x2d772f[_0xb471('0x31')]:_0x3c1ccf[_0xb471('0x2b')];if(_0x13477a['query']['includeAll']){_0x2d772f[_0xb471('0x42')]=[{'all':!![]}];}_0x2d772f=_[_0xb471('0x38')]({},_0x2d772f,_0x13477a[_0xb471('0x3b')]);return db[_0xb471('0x3c')][_0xb471('0x43')](_0x2d772f)[_0xb471('0x25')](handleEntityNotFound(_0x1531a2,null))[_0xb471('0x25')](respondWithResult(_0x1531a2,null))[_0xb471('0x3f')](handleError(_0x1531a2,null));};exports[_0xb471('0x44')]=function(_0x52deb9,_0x41a1ab){return db['SalesforceField']['create'](_0x52deb9['body'],{})[_0xb471('0x25')](respondWithResult(_0x41a1ab,0xc9))['catch'](handleError(_0x41a1ab,null));};exports[_0xb471('0x24')]=function(_0x1cea58,_0x2dcb1b){if(_0x1cea58['body']['id']){delete _0x1cea58[_0xb471('0x45')]['id'];}return db[_0xb471('0x3c')][_0xb471('0x43')]({'where':{'id':_0x1cea58[_0xb471('0x40')]['id']}})[_0xb471('0x25')](handleEntityNotFound(_0x2dcb1b,null))[_0xb471('0x25')](saveUpdates(_0x1cea58[_0xb471('0x45')],null))['then'](respondWithResult(_0x2dcb1b,null))[_0xb471('0x3f')](handleError(_0x2dcb1b,null));};exports[_0xb471('0x26')]=function(_0x511bb4,_0xc822b3){return db[_0xb471('0x3c')][_0xb471('0x43')]({'where':{'id':_0x511bb4[_0xb471('0x40')]['id']}})[_0xb471('0x25')](handleEntityNotFound(_0xc822b3,null))[_0xb471('0x25')](removeEntity(_0xc822b3,null))[_0xb471('0x3f')](handleError(_0xc822b3,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 7d93e40..4a8db6e 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 _0x8c39=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceField.attributes','SalesforceField','salesforce_unique_index','idField','lodash'];(function(_0x46489e,_0x21b63f){var _0x145e7b=function(_0x47f35f){while(--_0x47f35f){_0x46489e['push'](_0x46489e['shift']());}};_0x145e7b(++_0x21b63f);}(_0x8c39,0x1df));var _0x98c3=function(_0xb2b3a8,_0x44b68d){_0xb2b3a8=_0xb2b3a8-0x0;var _0x1a2865=_0x8c39[_0xb2b3a8];return _0x1a2865;};'use strict';var _=require(_0x98c3('0x0'));var util=require('util');var logger=require(_0x98c3('0x1'))(_0x98c3('0x2'));var moment=require(_0x98c3('0x3'));var BPromise=require(_0x98c3('0x4'));var rp=require(_0x98c3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x98c3('0x6'));var config=require(_0x98c3('0x7'));var attributes=require(_0x98c3('0x8'));module['exports']=function(_0x1bee5c,_0xfc9011){return _0x1bee5c['define'](_0x98c3('0x9'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x98c3('0xa'),'fields':[_0x98c3('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb99=['path','../../config/environment','./intSalesforceField.attributes','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','../../config/logger','bluebird','request-promise'];(function(_0x51a8b3,_0x35a867){var _0x370673=function(_0x39750d){while(--_0x39750d){_0x51a8b3['push'](_0x51a8b3['shift']());}};_0x370673(++_0x35a867);}(_0xcb99,0x8b));var _0x9cb9=function(_0x4f21cd,_0x30f06f){_0x4f21cd=_0x4f21cd-0x0;var _0x1af331=_0xcb99[_0x4f21cd];return _0x1af331;};'use strict';var _=require(_0x9cb9('0x0'));var util=require('util');var logger=require(_0x9cb9('0x1'))('api');var moment=require('moment');var BPromise=require(_0x9cb9('0x2'));var rp=require(_0x9cb9('0x3'));var fs=require('fs');var path=require(_0x9cb9('0x4'));var rimraf=require('rimraf');var config=require(_0x9cb9('0x5'));var attributes=require(_0x9cb9('0x6'));module['exports']=function(_0x214b72,_0x509cfc){return _0x214b72[_0x9cb9('0x7')](_0x9cb9('0x8'),attributes,{'tableName':_0x9cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x9cb9('0xa'),'fields':[_0x9cb9('0xb'),_0x9cb9('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index c704e74..c0e931d 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 _0x5b02=['client','then','info','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5caf7e,_0x52e1bc){var _0x5c3435=function(_0xb77e11){while(--_0xb77e11){_0x5caf7e['push'](_0x5caf7e['shift']());}};_0x5c3435(++_0x52e1bc);}(_0x5b02,0xe9));var _0x25b0=function(_0x23abc4,_0x3e2bed){_0x23abc4=_0x23abc4-0x0;var _0x40c953=_0x5b02[_0x23abc4];return _0x40c953;};'use strict';var _=require(_0x25b0('0x0'));var util=require(_0x25b0('0x1'));var moment=require(_0x25b0('0x2'));var BPromise=require(_0x25b0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x25b0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x25b0('0x5'))(_0x25b0('0x6'));var config=require(_0x25b0('0x7'));var jayson=require(_0x25b0('0x8'));var client=jayson[_0x25b0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d82c6,_0xd8276d,_0x49ef3a){return new BPromise(function(_0x412954,_0x4d3e71){return client['request'](_0x1d82c6,_0x49ef3a)[_0x25b0('0xa')](function(_0x45429b){logger[_0x25b0('0xb')]('SalesforceField,\x20%s,\x20%s',_0xd8276d,_0x25b0('0xc'));logger[_0x25b0('0xd')](_0x25b0('0xe'),_0xd8276d,_0x25b0('0xc'),JSON[_0x25b0('0xf')](_0x45429b));if(_0x45429b[_0x25b0('0x10')]){if(_0x45429b[_0x25b0('0x10')][_0x25b0('0x11')]===0x1f4){logger[_0x25b0('0x10')](_0x25b0('0x12'),_0xd8276d,_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);return _0x4d3e71(_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);}logger[_0x25b0('0x10')](_0x25b0('0x12'),_0xd8276d,_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);return _0x412954(_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);}else{logger[_0x25b0('0xb')]('SalesforceField,\x20%s,\x20%s',_0xd8276d,'request\x20sent');_0x412954(_0x45429b[_0x25b0('0x14')]['message']);}})[_0x25b0('0x15')](function(_0x1d009f){logger[_0x25b0('0x10')](_0x25b0('0x12'),_0xd8276d,_0x1d009f);_0x4d3e71(_0x1d009f);});});} \ No newline at end of file +var _0xe5b5=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','SalesforceField,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x401676,_0x3f1436){var _0x4f13fe=function(_0xd2f197){while(--_0xd2f197){_0x401676['push'](_0x401676['shift']());}};_0x4f13fe(++_0x3f1436);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x350182,_0x2a9feb){_0x350182=_0x350182-0x0;var _0x4a0892=_0xe5b5[_0x350182];return _0x4a0892;};'use strict';var _=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var moment=require(_0x5e5b('0x2'));var BPromise=require(_0x5e5b('0x3'));var rs=require(_0x5e5b('0x4'));var fs=require('fs');var Redis=require(_0x5e5b('0x5'));var db=require(_0x5e5b('0x6'))['db'];var utils=require(_0x5e5b('0x7'));var logger=require(_0x5e5b('0x8'))(_0x5e5b('0x9'));var config=require(_0x5e5b('0xa'));var jayson=require(_0x5e5b('0xb'));var client=jayson[_0x5e5b('0xc')][_0x5e5b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x545eb3,_0x29db2c,_0xe089b1){return new BPromise(function(_0xcbd478,_0x258414){return client[_0x5e5b('0xe')](_0x545eb3,_0xe089b1)[_0x5e5b('0xf')](function(_0x3a37db){logger[_0x5e5b('0x10')]('SalesforceField,\x20%s,\x20%s',_0x29db2c,_0x5e5b('0x11'));logger['debug'](_0x5e5b('0x12'),_0x29db2c,_0x5e5b('0x11'),JSON[_0x5e5b('0x13')](_0x3a37db));if(_0x3a37db[_0x5e5b('0x14')]){if(_0x3a37db['error']['code']===0x1f4){logger['error'](_0x5e5b('0x15'),_0x29db2c,_0x3a37db[_0x5e5b('0x14')][_0x5e5b('0x16')]);return _0x258414(_0x3a37db[_0x5e5b('0x14')][_0x5e5b('0x16')]);}logger[_0x5e5b('0x14')](_0x5e5b('0x15'),_0x29db2c,_0x3a37db['error'][_0x5e5b('0x16')]);return _0xcbd478(_0x3a37db[_0x5e5b('0x14')]['message']);}else{logger[_0x5e5b('0x10')]('SalesforceField,\x20%s,\x20%s',_0x29db2c,'request\x20sent');_0xcbd478(_0x3a37db[_0x5e5b('0x17')][_0x5e5b('0x16')]);}})[_0x5e5b('0x18')](function(_0x5c7148){logger[_0x5e5b('0x14')]('SalesforceField,\x20%s,\x20%s',_0x29db2c,_0x5c7148);_0x258414(_0x5c7148);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 9ecbb7f..2a82438 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 _0xac47=['isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','put','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get'];(function(_0x32ac3c,_0x5e79c4){var _0x1ba6ca=function(_0x2808d2){while(--_0x2808d2){_0x32ac3c['push'](_0x32ac3c['shift']());}};_0x1ba6ca(++_0x5e79c4);}(_0xac47,0x1af));var _0x7ac4=function(_0x4d0bca,_0x4711aa){_0x4d0bca=_0x4d0bca-0x0;var _0x3a1dbd=_0xac47[_0x4d0bca];return _0x3a1dbd;};'use strict';var multer=require(_0x7ac4('0x0'));var util=require(_0x7ac4('0x1'));var path=require(_0x7ac4('0x2'));var timeout=require(_0x7ac4('0x3'));var express=require(_0x7ac4('0x4'));var router=express[_0x7ac4('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x7ac4('0x6'));var config=require(_0x7ac4('0x7'));var controller=require('./intServicenowAccount.controller');router[_0x7ac4('0x8')]('/',auth[_0x7ac4('0x9')](),controller[_0x7ac4('0xa')]);router[_0x7ac4('0x8')](_0x7ac4('0xb'),auth['isAuthenticated'](),controller[_0x7ac4('0xc')]);router[_0x7ac4('0x8')](_0x7ac4('0xd'),auth[_0x7ac4('0x9')](),controller[_0x7ac4('0xe')]);router[_0x7ac4('0x8')](_0x7ac4('0xf'),auth[_0x7ac4('0x9')](),controller[_0x7ac4('0x10')]);router[_0x7ac4('0x11')]('/',auth[_0x7ac4('0x9')](),controller['create']);router[_0x7ac4('0x11')](_0x7ac4('0xd'),auth[_0x7ac4('0x9')](),controller['addConfiguration']);router[_0x7ac4('0x12')](_0x7ac4('0xb'),auth[_0x7ac4('0x9')](),controller['update']);router['delete'](_0x7ac4('0xb'),auth[_0x7ac4('0x9')](),controller['destroy']);module[_0x7ac4('0x13')]=router; \ No newline at end of file +var _0x40dd=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id/configurations','getFields','post','put','/:id','update','destroy','exports','multer','util','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x40dd,0x18d));var _0xd40d=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x40dd[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0xd40d('0x0'));var util=require(_0xd40d('0x1'));var path=require('path');var timeout=require(_0xd40d('0x2'));var express=require(_0xd40d('0x3'));var router=express[_0xd40d('0x4')]();var auth=require(_0xd40d('0x5'));var interaction=require(_0xd40d('0x6'));var config=require(_0xd40d('0x7'));var controller=require(_0xd40d('0x8'));router[_0xd40d('0x9')]('/',auth[_0xd40d('0xa')](),controller[_0xd40d('0xb')]);router['get']('/:id',auth[_0xd40d('0xa')](),controller['show']);router[_0xd40d('0x9')](_0xd40d('0xc'),auth[_0xd40d('0xa')](),controller['getConfigurations']);router[_0xd40d('0x9')]('/:id/fields',auth[_0xd40d('0xa')](),controller[_0xd40d('0xd')]);router[_0xd40d('0xe')]('/',auth[_0xd40d('0xa')](),controller['create']);router[_0xd40d('0xe')](_0xd40d('0xc'),auth[_0xd40d('0xa')](),controller['addConfiguration']);router[_0xd40d('0xf')](_0xd40d('0x10'),auth[_0xd40d('0xa')](),controller[_0xd40d('0x11')]);router['delete'](_0xd40d('0x10'),auth[_0xd40d('0xa')](),controller[_0xd40d('0x12')]);module[_0xd40d('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index cead01c..7f1d8f0 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 _0x029e=['remoteUri','username','STRING'];(function(_0x4bb581,_0x6f7037){var _0x316bf5=function(_0x1f6ed0){while(--_0x1f6ed0){_0x4bb581['push'](_0x4bb581['shift']());}};_0x316bf5(++_0x6f7037);}(_0x029e,0x16c));var _0xe029=function(_0x3aee94,_0xe799e5){_0x3aee94=_0x3aee94-0x0;var _0x7019df=_0x029e[_0x3aee94];return _0x7019df;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0xe029('0x0')},'password':{'type':Sequelize[_0xe029('0x1')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xe029('0x1')],'unique':_0xe029('0x2')},'serverUrl':{'type':Sequelize[_0xe029('0x1')]}}; \ No newline at end of file +var _0xe594=['STRING','username','remoteUri','exports'];(function(_0x1c3b41,_0x50f776){var _0x41e3fe=function(_0x512069){while(--_0x512069){_0x1c3b41['push'](_0x1c3b41['shift']());}};_0x41e3fe(++_0x50f776);}(_0xe594,0xef));var _0x4e59=function(_0xfab345,_0x43fc6e){_0xfab345=_0xfab345-0x0;var _0x1a60fd=_0xe594[_0xfab345];return _0x1a60fd;};'use strict';var Sequelize=require('sequelize');module[_0x4e59('0x0')]={'name':{'type':Sequelize[_0x4e59('0x1')]},'description':{'type':Sequelize[_0x4e59('0x1')]},'username':{'type':Sequelize[_0x4e59('0x1')],'unique':_0x4e59('0x2')},'password':{'type':Sequelize[_0x4e59('0x1')]},'email':{'type':Sequelize[_0x4e59('0x1')]},'remoteUri':{'type':Sequelize[_0x4e59('0x1')],'unique':_0x4e59('0x3')},'serverUrl':{'type':Sequelize[_0x4e59('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 933a1f8..5f11e25 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 _0xd4f0=['../../config/logger','api','../../config/environment','../../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','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','name','send','index','ServicenowAccount','fieldName','type','map','query','keys','filters','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','create','body','find','getConfigurations','length','pick','filter','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','made_sla','knowledge','subcategory','close_code','notify','incident_state','severity','parent','watch_list','child_incidents','approval_history','number','sys_updated_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','cmdb_ci','delivery_plan','active','work_notes_list','business_service','priority','time_worked','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','work_start','assignment_group','description','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','problem_id','company','reassignment_count','activity_due','assigned_to','comments','approval','comments_and_work_notes','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','findOne','username','password','remoteUri','serverUrl','slice','substring','lastIndexOf','%s/api/now/doc/table/schema/','format','%s/api/now/table/','GET','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','log','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','ServiceNow\x20error:\x20','statusCode','stack','Wrong\x20credentials','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','html-pdf','rimraf','fast-json-patch','request-promise','moment','mustache','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x466aa2,_0x27b9c1){var _0x1a3bff=function(_0x450148){while(--_0x450148){_0x466aa2['push'](_0x466aa2['shift']());}};_0x1a3bff(++_0x27b9c1);}(_0xd4f0,0xa8));var _0x0d4f=function(_0x15dbca,_0x1d7c3c){_0x15dbca=_0x15dbca-0x0;var _0x326533=_0xd4f0[_0x15dbca];return _0x326533;};'use strict';var pdf=require(_0x0d4f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0d4f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0d4f('0x2'));var rp=require(_0x0d4f('0x3'));var moment=require(_0x0d4f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0d4f('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x0d4f('0x6'));var crypto=require(_0x0d4f('0x7'));var jsforce=require('jsforce');var deskjs=require(_0x0d4f('0x8'));var toCsv=require('to-csv');var querystring=require(_0x0d4f('0x9'));var Papa=require(_0x0d4f('0xa'));var Redis=require('ioredis');var authService=require(_0x0d4f('0xb'));var qs=require(_0x0d4f('0xc'));var as=require(_0x0d4f('0xd'));var hardwareService=require(_0x0d4f('0xe'));var logger=require(_0x0d4f('0xf'))(_0x0d4f('0x10'));var utils=require('../../config/utils');var config=require(_0x0d4f('0x11'));var db=require('../../mysqldb')['db'];var integrations=require(_0x0d4f('0x12'));var jayson=require('jayson/promise');var client=jayson[_0x0d4f('0x13')][_0x0d4f('0x14')]({'port':0x232a});function checkPasswordPattern(_0x28710a,_0x1d021c,_0x118842){if(_0x118842){var _0x44ca73=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x44ca73[_0x0d4f('0x15')](_0x1d021c)){return _0x28710a;}else{throw new db['Sequelize'][(_0x0d4f('0x16'))](_0x0d4f('0x17'));}}else{return _0x28710a;}}function respondWithRpcPromise(_0x5529d1,_0x3512f6,_0x8a8eb8,_0x202dd1){return new BPromise(function(_0x984c9e,_0x5ec31a){var _0x27e1ad=_0x202dd1||client;return _0x27e1ad[_0x0d4f('0x18')](_0x5529d1,_0x8a8eb8)[_0x0d4f('0x19')](function(_0x226a44){logger[_0x0d4f('0x1a')](_0x0d4f('0x1b'),_0x3512f6,_0x0d4f('0x1c'));logger[_0x0d4f('0x1d')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x3512f6,_0x0d4f('0x1c'),JSON[_0x0d4f('0x1e')](_0x226a44));if(_0x226a44['error']){if(_0x226a44[_0x0d4f('0x1f')][_0x0d4f('0x20')]===0x1f4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x3512f6,_0x226a44[_0x0d4f('0x1f')]['message']);return _0x5ec31a(_0x226a44[_0x0d4f('0x1f')]['message']);}logger[_0x0d4f('0x1f')](_0x0d4f('0x1b'),_0x3512f6,_0x226a44['error'][_0x0d4f('0x21')]);return _0x984c9e(_0x226a44['error'][_0x0d4f('0x21')]);}else{logger['info'](_0x0d4f('0x1b'),_0x3512f6,_0x0d4f('0x1c'));_0x984c9e(_0x226a44[_0x0d4f('0x22')][_0x0d4f('0x21')]);}})['catch'](function(_0x9bc993){logger['error'](_0x0d4f('0x1b'),_0x3512f6,_0x9bc993);_0x5ec31a(_0x9bc993);});});}function respondWithStatusCode(_0x4300f7,_0x327382){_0x327382=_0x327382||0xcc;return function(_0x2cdf83){if(_0x2cdf83){return _0x4300f7[_0x0d4f('0x23')](_0x327382);}return _0x4300f7[_0x0d4f('0x24')](_0x327382)[_0x0d4f('0x25')]();};}function respondWithResult(_0x30a8bf,_0x2cfb75){_0x2cfb75=_0x2cfb75||0xc8;return function(_0x76a648){if(_0x76a648){return _0x30a8bf[_0x0d4f('0x24')](_0x2cfb75)[_0x0d4f('0x26')](_0x76a648);}};}function respondWithFilteredResult(_0x1f527d,_0xed6d0c){return function(_0x37a51a){if(_0x37a51a){var _0x27321e=_0x37a51a[_0x0d4f('0x27')],_0x1008b4=_0xed6d0c[_0x0d4f('0x28')],_0x3f9e75=_0xed6d0c['offset']+_0xed6d0c[_0x0d4f('0x29')],_0xdb4d03;if(_0x3f9e75>=_0x27321e){_0x3f9e75=_0x27321e;_0xdb4d03=0xc8;}else{_0xdb4d03=0xce;}_0x1f527d[_0x0d4f('0x24')](_0xdb4d03);return _0x1f527d[_0x0d4f('0x2a')]('Content-Range',_0x1008b4+'-'+_0x3f9e75+'/'+_0x27321e)[_0x0d4f('0x26')](_0x37a51a);}return null;};}function patchUpdates(_0x31f5ec){return function(_0x3183be){try{jsonpatch[_0x0d4f('0x2b')](_0x3183be,_0x31f5ec,!![]);}catch(_0x258036){return BPromise[_0x0d4f('0x2c')](_0x258036);}return _0x3183be[_0x0d4f('0x2d')]();};}function saveUpdates(_0x21fe0a,_0x55fa4a){return function(_0x24c31b){if(_0x24c31b){return _0x24c31b[_0x0d4f('0x2e')](_0x21fe0a)[_0x0d4f('0x19')](function(_0x3cc849){return _0x3cc849;});}return null;};}function removeEntity(_0x5bd101,_0x4628dc){return function(_0x549050){if(_0x549050){return _0x549050[_0x0d4f('0x2f')]()[_0x0d4f('0x19')](function(){_0x5bd101['status'](0xcc)[_0x0d4f('0x25')]();});}};}function handleEntityNotFound(_0x59c5a9,_0x40b3f8){return function(_0x2c31b6){if(!_0x2c31b6){_0x59c5a9[_0x0d4f('0x23')](0x194);}return _0x2c31b6;};}function handleError(_0x1f5f1e,_0x5f0ac8){_0x5f0ac8=_0x5f0ac8||0x1f4;return function(_0x489f41){logger[_0x0d4f('0x1f')](_0x489f41['stack']);if(_0x489f41['name']){delete _0x489f41[_0x0d4f('0x30')];}_0x1f5f1e[_0x0d4f('0x24')](_0x5f0ac8)[_0x0d4f('0x31')](_0x489f41);};}exports[_0x0d4f('0x32')]=function(_0x405817,_0xcc072b){var _0x442635={},_0x3d0f1c={},_0x5e0a59={'count':0x0,'rows':[]};var _0x3ee73d=_['map'](db[_0x0d4f('0x33')]['rawAttributes'],function(_0x4b4845){return{'name':_0x4b4845[_0x0d4f('0x34')],'type':_0x4b4845[_0x0d4f('0x35')]['key']};});_0x3d0f1c['model']=_[_0x0d4f('0x36')](_0x3ee73d,'name');_0x3d0f1c[_0x0d4f('0x37')]=_[_0x0d4f('0x38')](_0x405817['query']);_0x3d0f1c[_0x0d4f('0x39')]=_[_0x0d4f('0x3a')](_0x3d0f1c[_0x0d4f('0x3b')],_0x3d0f1c['query']);_0x442635['attributes']=_['intersection'](_0x3d0f1c['model'],qs['fields'](_0x405817[_0x0d4f('0x37')]['fields']));_0x442635[_0x0d4f('0x3c')]=_0x442635[_0x0d4f('0x3c')]['length']?_0x442635[_0x0d4f('0x3c')]:_0x3d0f1c[_0x0d4f('0x3b')];if(!_0x405817[_0x0d4f('0x37')][_0x0d4f('0x3d')](_0x0d4f('0x3e'))){_0x442635[_0x0d4f('0x29')]=qs['limit'](_0x405817[_0x0d4f('0x37')]['limit']);_0x442635[_0x0d4f('0x28')]=qs[_0x0d4f('0x28')](_0x405817[_0x0d4f('0x37')]['offset']);}_0x442635[_0x0d4f('0x3f')]=qs[_0x0d4f('0x40')](_0x405817['query'][_0x0d4f('0x40')]);_0x442635['where']=qs[_0x0d4f('0x39')](_['pick'](_0x405817[_0x0d4f('0x37')],_0x3d0f1c[_0x0d4f('0x39')]),_0x3ee73d);if(_0x405817[_0x0d4f('0x37')]['filter']){_0x442635[_0x0d4f('0x41')]=_[_0x0d4f('0x42')](_0x442635[_0x0d4f('0x41')],{'$or':_[_0x0d4f('0x36')](_0x3ee73d,function(_0x20fe99){if(_0x20fe99[_0x0d4f('0x35')]!==_0x0d4f('0x43')){var _0x97ccca={};_0x97ccca[_0x20fe99['name']]={'$like':'%'+_0x405817[_0x0d4f('0x37')]['filter']+'%'};return _0x97ccca;}})});}_0x442635=_[_0x0d4f('0x42')]({},_0x442635,_0x405817[_0x0d4f('0x44')]);var _0x248394={'where':_0x442635[_0x0d4f('0x41')]};return db[_0x0d4f('0x33')][_0x0d4f('0x27')](_0x248394)[_0x0d4f('0x19')](function(_0x57ccaa){_0x5e0a59[_0x0d4f('0x27')]=_0x57ccaa;if(_0x405817[_0x0d4f('0x37')][_0x0d4f('0x45')]){_0x442635[_0x0d4f('0x46')]=[{'all':!![]}];}return db[_0x0d4f('0x33')][_0x0d4f('0x47')](_0x442635);})[_0x0d4f('0x19')](function(_0x467ecf){_0x5e0a59[_0x0d4f('0x48')]=_0x467ecf;return _0x5e0a59;})[_0x0d4f('0x19')](respondWithFilteredResult(_0xcc072b,_0x442635))[_0x0d4f('0x49')](handleError(_0xcc072b,null));};exports[_0x0d4f('0x4a')]=function(_0x285afd,_0x64503b){var _0xaac05a={'raw':![],'where':{'id':_0x285afd[_0x0d4f('0x4b')]['id']}},_0x226866={};_0x226866['model']=_['keys'](db[_0x0d4f('0x33')][_0x0d4f('0x4c')]);_0x226866[_0x0d4f('0x37')]=_[_0x0d4f('0x38')](_0x285afd[_0x0d4f('0x37')]);_0x226866[_0x0d4f('0x39')]=_[_0x0d4f('0x3a')](_0x226866[_0x0d4f('0x3b')],_0x226866[_0x0d4f('0x37')]);_0xaac05a[_0x0d4f('0x3c')]=_[_0x0d4f('0x3a')](_0x226866[_0x0d4f('0x3b')],qs[_0x0d4f('0x4d')](_0x285afd[_0x0d4f('0x37')][_0x0d4f('0x4d')]));_0xaac05a['attributes']=_0xaac05a[_0x0d4f('0x3c')]['length']?_0xaac05a[_0x0d4f('0x3c')]:_0x226866['model'];if(_0x285afd[_0x0d4f('0x37')][_0x0d4f('0x45')]){_0xaac05a[_0x0d4f('0x46')]=[{'all':!![]}];}_0xaac05a=_[_0x0d4f('0x42')]({},_0xaac05a,_0x285afd['options']);return db['ServicenowAccount']['find'](_0xaac05a)[_0x0d4f('0x19')](handleEntityNotFound(_0x64503b,null))[_0x0d4f('0x19')](respondWithResult(_0x64503b,null))[_0x0d4f('0x49')](handleError(_0x64503b,null));};exports[_0x0d4f('0x4e')]=function(_0x1e69b7,_0x44c835){return db[_0x0d4f('0x33')][_0x0d4f('0x4e')](_0x1e69b7[_0x0d4f('0x4f')],{})[_0x0d4f('0x19')](respondWithResult(_0x44c835,0xc9))['catch'](handleError(_0x44c835,null));};exports[_0x0d4f('0x2e')]=function(_0x1a79e4,_0x2befcf){if(_0x1a79e4[_0x0d4f('0x4f')]['id']){delete _0x1a79e4[_0x0d4f('0x4f')]['id'];}return db[_0x0d4f('0x33')][_0x0d4f('0x50')]({'where':{'id':_0x1a79e4[_0x0d4f('0x4b')]['id']}})[_0x0d4f('0x19')](handleEntityNotFound(_0x2befcf,null))[_0x0d4f('0x19')](saveUpdates(_0x1a79e4['body'],null))[_0x0d4f('0x19')](respondWithResult(_0x2befcf,null))['catch'](handleError(_0x2befcf,null));};exports[_0x0d4f('0x2f')]=function(_0x388d07,_0x27ad62){return db[_0x0d4f('0x33')]['find']({'where':{'id':_0x388d07[_0x0d4f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x27ad62,null))[_0x0d4f('0x19')](removeEntity(_0x27ad62,null))['catch'](handleError(_0x27ad62,null));};exports[_0x0d4f('0x51')]=function(_0x16d742,_0x51a567,_0x2e0caa){var _0x590cee={};var _0x1cf033={};var _0x3b4491;var _0x3a86cf;return db[_0x0d4f('0x33')]['findOne']({'where':{'id':_0x16d742[_0x0d4f('0x4b')]['id']}})[_0x0d4f('0x19')](handleEntityNotFound(_0x51a567,null))[_0x0d4f('0x19')](function(_0x2ebf1a){if(_0x2ebf1a){_0x3b4491=_0x2ebf1a;_0x1cf033[_0x0d4f('0x3b')]=_[_0x0d4f('0x38')](db['ServicenowConfiguration'][_0x0d4f('0x4c')]);_0x1cf033[_0x0d4f('0x37')]=_['keys'](_0x16d742[_0x0d4f('0x37')]);_0x1cf033[_0x0d4f('0x39')]=_[_0x0d4f('0x3a')](_0x1cf033[_0x0d4f('0x3b')],_0x1cf033[_0x0d4f('0x37')]);_0x590cee[_0x0d4f('0x3c')]=_[_0x0d4f('0x3a')](_0x1cf033[_0x0d4f('0x3b')],qs['fields'](_0x16d742['query']['fields']));_0x590cee[_0x0d4f('0x3c')]=_0x590cee[_0x0d4f('0x3c')][_0x0d4f('0x52')]?_0x590cee[_0x0d4f('0x3c')]:_0x1cf033[_0x0d4f('0x3b')];_0x590cee['order']=qs['sort'](_0x16d742['query'][_0x0d4f('0x40')]);_0x590cee[_0x0d4f('0x41')]=qs[_0x0d4f('0x39')](_[_0x0d4f('0x53')](_0x16d742['query'],_0x1cf033[_0x0d4f('0x39')]));if(_0x16d742[_0x0d4f('0x37')][_0x0d4f('0x54')]){_0x590cee[_0x0d4f('0x41')]=_[_0x0d4f('0x42')](_0x590cee[_0x0d4f('0x41')],{'$or':_['map'](_0x590cee[_0x0d4f('0x3c')],function(_0x5db7d6){var _0x5cc6ad={};_0x5cc6ad[_0x5db7d6]={'$like':'%'+_0x16d742[_0x0d4f('0x37')]['filter']+'%'};return _0x5cc6ad;})});}_0x590cee=_[_0x0d4f('0x42')]({},_0x590cee,_0x16d742[_0x0d4f('0x44')]);return _0x3b4491[_0x0d4f('0x51')](_0x590cee);}})[_0x0d4f('0x19')](function(_0x1d9a15){if(_0x1d9a15){_0x3a86cf=_0x1d9a15[_0x0d4f('0x52')];if(!_0x16d742[_0x0d4f('0x37')][_0x0d4f('0x3d')]('nolimit')){_0x590cee[_0x0d4f('0x29')]=qs[_0x0d4f('0x29')](_0x16d742[_0x0d4f('0x37')]['limit']);_0x590cee[_0x0d4f('0x28')]=qs[_0x0d4f('0x28')](_0x16d742[_0x0d4f('0x37')][_0x0d4f('0x28')]);}return _0x3b4491[_0x0d4f('0x51')](_0x590cee);}})[_0x0d4f('0x19')](function(_0xcd794b){if(_0xcd794b){return _0xcd794b?{'count':_0x3a86cf,'rows':_0xcd794b}:null;}})[_0x0d4f('0x19')](respondWithResult(_0x51a567,null))['catch'](handleError(_0x51a567,null));};exports[_0x0d4f('0x55')]=function(_0x13d59c,_0x225bf9,_0x458bf9){if(_0x13d59c[_0x0d4f('0x4f')]['id']){delete _0x13d59c[_0x0d4f('0x4f')]['id'];}return db['ServicenowAccount']['findOne']({'where':{'id':_0x13d59c[_0x0d4f('0x4b')]['id']}})[_0x0d4f('0x19')](handleEntityNotFound(_0x225bf9,null))[_0x0d4f('0x19')](function(_0x297498){if(_0x297498){_0x13d59c[_0x0d4f('0x4f')][_0x0d4f('0x56')]=_0x297498['id'];_0x13d59c[_0x0d4f('0x4f')][_0x0d4f('0x57')]=integrations['getSubjects'](_0x13d59c[_0x0d4f('0x4f')][_0x0d4f('0x58')],_0x13d59c[_0x0d4f('0x4f')]['type']);_0x13d59c[_0x0d4f('0x4f')][_0x0d4f('0x59')]=integrations[_0x0d4f('0x5a')](_0x13d59c[_0x0d4f('0x4f')]['channel'],_0x13d59c['body']['type']);return db[_0x0d4f('0x5b')][_0x0d4f('0x4e')](_0x13d59c['body'],{'include':[{'model':db[_0x0d4f('0x5c')],'as':_0x0d4f('0x57')},{'model':db[_0x0d4f('0x5c')],'as':'Descriptions'}]});}return null;})[_0x0d4f('0x19')](respondWithResult(_0x225bf9,null))[_0x0d4f('0x49')](handleError(_0x225bf9,null));};exports['getFields']=function(_0xe72ddf,_0x14d1e1,_0x52305f){var _0xb501df=[_0x0d4f('0x5d'),'hold_reason',_0x0d4f('0x5e'),_0x0d4f('0x5f'),_0x0d4f('0x60'),_0x0d4f('0x61'),_0x0d4f('0x62'),_0x0d4f('0x63'),'category'];var _0x49afeb=[_0x0d4f('0x64'),_0x0d4f('0x5d'),'caused_by',_0x0d4f('0x65'),'upon_reject','sys_updated_on',_0x0d4f('0x66'),'hold_reason',_0x0d4f('0x67'),_0x0d4f('0x68'),'resolved_by',_0x0d4f('0x69'),'opened_by',_0x0d4f('0x6a'),_0x0d4f('0x6b'),_0x0d4f('0x6c'),_0x0d4f('0x6d'),_0x0d4f('0x6e'),_0x0d4f('0x5e'),_0x0d4f('0x3f'),_0x0d4f('0x6f'),'closed_at',_0x0d4f('0x70'),_0x0d4f('0x71'),'impact',_0x0d4f('0x72'),_0x0d4f('0x73'),_0x0d4f('0x74'),_0x0d4f('0x75'),'sys_domain_path','rfc',_0x0d4f('0x76'),'expected_start',_0x0d4f('0x77'),_0x0d4f('0x78'),_0x0d4f('0x79'),_0x0d4f('0x7a'),_0x0d4f('0x7b'),_0x0d4f('0x7c'),'caller_id','approval_set',_0x0d4f('0x5f'),'work_notes','short_description',_0x0d4f('0x60'),'correlation_display','delivery_task',_0x0d4f('0x7d'),_0x0d4f('0x7e'),'business_stc','additional_assignee_list',_0x0d4f('0x7f'),'calendar_duration',_0x0d4f('0x61'),_0x0d4f('0x80'),_0x0d4f('0x81'),_0x0d4f('0x82'),_0x0d4f('0x83'),_0x0d4f('0x84'),_0x0d4f('0x85'),_0x0d4f('0x86'),'reopened_by',_0x0d4f('0x62'),'urgency',_0x0d4f('0x87'),_0x0d4f('0x88'),_0x0d4f('0x89'),_0x0d4f('0x8a'),_0x0d4f('0x8b'),_0x0d4f('0x63'),_0x0d4f('0x8c'),'sla_due',_0x0d4f('0x8d'),_0x0d4f('0x8e'),'due_date',_0x0d4f('0x8f'),_0x0d4f('0x90'),_0x0d4f('0x91'),_0x0d4f('0x92'),_0x0d4f('0x93'),_0x0d4f('0x94'),_0x0d4f('0x95'),'category'];var _0x112004='';var _0x94061a='';var _0x5132cb=[];var _0x4ea441='';var _0x5d22f8='';var _0x576a6e=[];var _0x6a8e6b='';var _0x2a14a3='';var _0x2f9b61={};var _0x36391b='';return db[_0x0d4f('0x33')][_0x0d4f('0x96')]({'where':{'id':_0xe72ddf[_0x0d4f('0x4b')]['id']},'attributes':['id',_0x0d4f('0x97'),_0x0d4f('0x98'),'email',_0x0d4f('0x99'),_0x0d4f('0x9a')]})[_0x0d4f('0x19')](handleEntityNotFound(_0x14d1e1,null))[_0x0d4f('0x19')](function(_0x130284){if(_0x130284){_0x36391b=_0x130284[_0x0d4f('0x99')];var _0x19b022=_0x36391b[_0x0d4f('0x9b')](-0x1);if(_0x19b022==='/'){_0x36391b=_0x36391b[_0x0d4f('0x9c')](0x0,_0x36391b[_0x0d4f('0x9d')](_0x19b022));}_0x2a14a3=util['format'](_0x0d4f('0x9e'),_0x36391b);_0x6a8e6b=util[_0x0d4f('0x9f')](_0x0d4f('0xa0'),_0x36391b);_0x2f9b61={'user':_0x130284[_0x0d4f('0x97')],'pass':_0x130284['password']};var _0x55b767={'method':_0x0d4f('0xa1'),'uri':_0x2a14a3+'incident?sysparm_display_value=all','auth':_0x2f9b61,'json':!![]};return rp(_0x55b767);}})['then'](function(_0x5230c0){if(_0x5230c0[_0x0d4f('0x22')][_0x0d4f('0x52')]>0x0){_0x112004=_0x5230c0[_0x0d4f('0x22')];}console['log'](_0x0d4f('0xa2'),_0x112004);_0x576a6e=[];_0x94061a=Object[_0x0d4f('0xa3')]([],_0x112004);_[_0x0d4f('0xa4')](_0x94061a,function(_0x593fa5){return!_0xb501df[_0x0d4f('0xa5')](_0x593fa5['name']);});_0x94061a[_0x0d4f('0xa6')](function(_0x4dc167){var _0x5b0d0f=createFieldObject(_0x6a8e6b,_0x2f9b61,_0x4dc167[_0x0d4f('0xa7')],_0x4dc167[_0x0d4f('0x30')],_0x4dc167[_0x0d4f('0xa8')],![]);_0x576a6e[_0x0d4f('0xa9')](_0x5b0d0f);});return Promise['all'](_0x576a6e);})[_0x0d4f('0x19')](function(_0x112524){_0x5132cb=_0x112524;_0x4ea441=Object[_0x0d4f('0xa3')]([],_0x112004);console[_0x0d4f('0xaa')]('TCL:\x20_object',_0x112004);_[_0x0d4f('0xa4')](_0x4ea441,function(_0x277a0d){return _0x49afeb[_0x0d4f('0xa5')](_0x277a0d[_0x0d4f('0x30')]);});console[_0x0d4f('0xaa')](_0x0d4f('0xab'),_0x4ea441);_0x576a6e=[];_0x4ea441[_0x0d4f('0xa6')](function(_0x98db64){var _0x52b754=createFieldObject(_0x6a8e6b,_0x2f9b61,_0x98db64['internalType'],_0x98db64['name'],_0x98db64[_0x0d4f('0xa8')],!![]);_0x576a6e['push'](_0x52b754);});return Promise['all'](_0x576a6e);})['then'](function(_0x372dac){_0x5d22f8=_0x372dac;var _0x538243=_0x5132cb['concat'](_0x5d22f8);return{'count':_0x538243[_0x0d4f('0x52')],'rows':_0x538243};})[_0x0d4f('0x19')](respondWithResult(_0x14d1e1,null))[_0x0d4f('0x49')](function(_0x5da675){console[_0x0d4f('0xaa')](_0x0d4f('0xac')+_0x5da675);var _0x35db9d=_0xe72ddf['query'][_0x0d4f('0x15')]?0x1f4:_0x5da675[_0x0d4f('0xad')]||0x1f4;logger[_0x0d4f('0x1f')](_0x5da675[_0x0d4f('0xae')]);delete _0x5da675[_0x0d4f('0x30')];if(_0x35db9d===0x191){_0x35db9d=0x190;}_0x14d1e1[_0x0d4f('0x24')](_0x35db9d)[_0x0d4f('0x31')](_0xe72ddf[_0x0d4f('0x37')][_0x0d4f('0x15')]?{'message':_0x0d4f('0xaf'),'statusCode':_0x5da675[_0x0d4f('0xad')]}:_0x5da675);});};function createFieldObject(_0x221524,_0x53b66d,_0x40c226,_0x219729,_0x4f2772,_0x406d33){return new Promise(function(_0x5081f9,_0xd04920){var _0x45b5ed={'id':_0x219729,'name':_0x4f2772,'custom':_0x406d33};if(_0x40c226==='boolean'){_0x45b5ed[_0x0d4f('0x44')]=[{'name':_0x0d4f('0xb0'),'value':_0x0d4f('0xb1')},{'name':_0x0d4f('0xb2'),'value':_0x0d4f('0xb3')}];_0x5081f9(_0x45b5ed);}else{var _0x12cc36={'method':_0x0d4f('0xa1'),'uri':_0x221524+_0x0d4f('0xb4')+_0x219729,'auth':_0x53b66d,'json':!![]};return rp(_0x12cc36)[_0x0d4f('0x19')](function(_0x45e01d){var _0x1064d4=[];if(_0x45e01d[_0x0d4f('0x22')][_0x0d4f('0x52')]>0x0){_0x45e01d[_0x0d4f('0x22')]['forEach'](function(_0x2d207d){if(_0x2d207d[_0x0d4f('0xb5')]===_0x0d4f('0xb3')){var _0x403452={'name':_0x2d207d['label'],'value':_0x2d207d[_0x0d4f('0xb6')]};_0x1064d4[_0x0d4f('0xa9')](_0x403452);}});}_0x45b5ed[_0x0d4f('0x44')]=_0x1064d4;if(_0x45b5ed[_0x0d4f('0x44')][_0x0d4f('0x52')]>0x0){_0x5081f9(_0x45b5ed);}else{if(_0x406d33==![]){_0x5081f9();}else{_0x5081f9(_0x45b5ed);}}});}});} \ No newline at end of file +var _0x8ce1=['ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','end','json','offset','limit','Content-Range','reject','save','update','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','count','includeAll','include','findAll','rows','show','options','find','create','body','params','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','severity','category','parent','watch_list','upon_reject','sys_updated_on','number','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','impact','active','work_notes_list','business_service','priority','time_worked','expected_start','opened_at','business_duration','group_list','work_end','caller_id','work_notes','correlation_display','delivery_task','work_start','assignment_group','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','parent_incident','sys_id','reopened_by','incident_state','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','approval','sys_mod_count','reopen_count','escalation','upon_approval','correlation_id','location','username','password','remoteUri','serverUrl','slice','substring','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','statusCode','Wrong\x20credentials','True','true','false','sys_choice?sysparm_query=name=incident^element=','value','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x194cf8,_0x2ef69a){var _0x50e00c=function(_0x43603d){while(--_0x43603d){_0x194cf8['push'](_0x194cf8['shift']());}};_0x50e00c(++_0x2ef69a);}(_0x8ce1,0x183));var _0x18ce=function(_0x391f3b,_0xd26565){_0x391f3b=_0x391f3b-0x0;var _0x2bd134=_0x8ce1[_0x391f3b];return _0x2bd134;};'use strict';var pdf=require(_0x18ce('0x0'));var emlformat=require(_0x18ce('0x1'));var rimraf=require(_0x18ce('0x2'));var zipdir=require(_0x18ce('0x3'));var jsonpatch=require(_0x18ce('0x4'));var rp=require(_0x18ce('0x5'));var moment=require(_0x18ce('0x6'));var BPromise=require(_0x18ce('0x7'));var Mustache=require(_0x18ce('0x8'));var util=require(_0x18ce('0x9'));var path=require(_0x18ce('0xa'));var sox=require(_0x18ce('0xb'));var csv=require(_0x18ce('0xc'));var ejs=require(_0x18ce('0xd'));var fs=require('fs');var _=require(_0x18ce('0xe'));var squel=require(_0x18ce('0xf'));var crypto=require('crypto');var jsforce=require(_0x18ce('0x10'));var deskjs=require(_0x18ce('0x11'));var toCsv=require(_0x18ce('0xc'));var querystring=require(_0x18ce('0x12'));var Papa=require('papaparse');var Redis=require(_0x18ce('0x13'));var authService=require(_0x18ce('0x14'));var qs=require(_0x18ce('0x15'));var as=require(_0x18ce('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x18ce('0x17'));var utils=require(_0x18ce('0x18'));var config=require(_0x18ce('0x19'));var db=require(_0x18ce('0x1a'))['db'];var integrations=require(_0x18ce('0x1b'));var jayson=require('jayson/promise');var client=jayson[_0x18ce('0x1c')][_0x18ce('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x3b94f7,_0x2b4caa,_0x2158aa){if(_0x2158aa){var _0x5daf04=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5daf04[_0x18ce('0x1e')](_0x2b4caa)){return _0x3b94f7;}else{throw new db[(_0x18ce('0x1f'))][(_0x18ce('0x20'))](_0x18ce('0x21'));}}else{return _0x3b94f7;}}function respondWithRpcPromise(_0x46e346,_0x36b5da,_0x17460e,_0x4a934f){return new BPromise(function(_0x959ce,_0x1357ef){var _0x204d1a=_0x4a934f||client;return _0x204d1a[_0x18ce('0x22')](_0x46e346,_0x17460e)[_0x18ce('0x23')](function(_0x287880){logger['info'](_0x18ce('0x24'),_0x36b5da,_0x18ce('0x25'));logger[_0x18ce('0x26')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x36b5da,_0x18ce('0x25'),JSON[_0x18ce('0x27')](_0x287880));if(_0x287880[_0x18ce('0x28')]){if(_0x287880['error'][_0x18ce('0x29')]===0x1f4){logger[_0x18ce('0x28')]('ServicenowAccount,\x20%s,\x20%s',_0x36b5da,_0x287880[_0x18ce('0x28')][_0x18ce('0x2a')]);return _0x1357ef(_0x287880[_0x18ce('0x28')][_0x18ce('0x2a')]);}logger[_0x18ce('0x28')](_0x18ce('0x24'),_0x36b5da,_0x287880[_0x18ce('0x28')][_0x18ce('0x2a')]);return _0x959ce(_0x287880[_0x18ce('0x28')]['message']);}else{logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x36b5da,_0x18ce('0x25'));_0x959ce(_0x287880['result'][_0x18ce('0x2a')]);}})[_0x18ce('0x2b')](function(_0x3fe231){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x36b5da,_0x3fe231);_0x1357ef(_0x3fe231);});});}function respondWithStatusCode(_0x55e17c,_0x317812){_0x317812=_0x317812||0xcc;return function(_0x12b1ed){if(_0x12b1ed){return _0x55e17c[_0x18ce('0x2c')](_0x317812);}return _0x55e17c[_0x18ce('0x2d')](_0x317812)[_0x18ce('0x2e')]();};}function respondWithResult(_0xc3cd4,_0x5583c6){_0x5583c6=_0x5583c6||0xc8;return function(_0x5279f8){if(_0x5279f8){return _0xc3cd4['status'](_0x5583c6)[_0x18ce('0x2f')](_0x5279f8);}};}function respondWithFilteredResult(_0x3719a2,_0x34c694){return function(_0x5f3ec2){if(_0x5f3ec2){var _0x1a87f6=_0x5f3ec2['count'],_0xf2683f=_0x34c694['offset'],_0x1988e4=_0x34c694[_0x18ce('0x30')]+_0x34c694[_0x18ce('0x31')],_0x5ef96c;if(_0x1988e4>=_0x1a87f6){_0x1988e4=_0x1a87f6;_0x5ef96c=0xc8;}else{_0x5ef96c=0xce;}_0x3719a2['status'](_0x5ef96c);return _0x3719a2['set'](_0x18ce('0x32'),_0xf2683f+'-'+_0x1988e4+'/'+_0x1a87f6)[_0x18ce('0x2f')](_0x5f3ec2);}return null;};}function patchUpdates(_0x91c42f){return function(_0x57e11e){try{jsonpatch['apply'](_0x57e11e,_0x91c42f,!![]);}catch(_0x46b593){return BPromise[_0x18ce('0x33')](_0x46b593);}return _0x57e11e[_0x18ce('0x34')]();};}function saveUpdates(_0xe81dd,_0x24672c){return function(_0xce2077){if(_0xce2077){return _0xce2077[_0x18ce('0x35')](_0xe81dd)[_0x18ce('0x23')](function(_0x4dfe2f){return _0x4dfe2f;});}return null;};}function removeEntity(_0x51e7e3,_0x13c8ae){return function(_0x3e05d4){if(_0x3e05d4){return _0x3e05d4['destroy']()[_0x18ce('0x23')](function(){_0x51e7e3['status'](0xcc)[_0x18ce('0x2e')]();});}};}function handleEntityNotFound(_0x4e340b,_0x465434){return function(_0x408a66){if(!_0x408a66){_0x4e340b[_0x18ce('0x2c')](0x194);}return _0x408a66;};}function handleError(_0x532dab,_0x4c2d04){_0x4c2d04=_0x4c2d04||0x1f4;return function(_0x3f2fdf){logger[_0x18ce('0x28')](_0x3f2fdf['stack']);if(_0x3f2fdf['name']){delete _0x3f2fdf[_0x18ce('0x36')];}_0x532dab[_0x18ce('0x2d')](_0x4c2d04)[_0x18ce('0x37')](_0x3f2fdf);};}exports[_0x18ce('0x38')]=function(_0x2b21cf,_0x461ef0){var _0x3ca677={},_0x34cec3={},_0x22662b={'count':0x0,'rows':[]};var _0x230a54=_[_0x18ce('0x39')](db[_0x18ce('0x3a')][_0x18ce('0x3b')],function(_0x557c87){return{'name':_0x557c87[_0x18ce('0x3c')],'type':_0x557c87[_0x18ce('0x3d')][_0x18ce('0x3e')]};});_0x34cec3[_0x18ce('0x3f')]=_[_0x18ce('0x39')](_0x230a54,_0x18ce('0x36'));_0x34cec3[_0x18ce('0x40')]=_[_0x18ce('0x41')](_0x2b21cf[_0x18ce('0x40')]);_0x34cec3[_0x18ce('0x42')]=_['intersection'](_0x34cec3['model'],_0x34cec3[_0x18ce('0x40')]);_0x3ca677[_0x18ce('0x43')]=_[_0x18ce('0x44')](_0x34cec3[_0x18ce('0x3f')],qs[_0x18ce('0x45')](_0x2b21cf[_0x18ce('0x40')][_0x18ce('0x45')]));_0x3ca677['attributes']=_0x3ca677['attributes'][_0x18ce('0x46')]?_0x3ca677[_0x18ce('0x43')]:_0x34cec3['model'];if(!_0x2b21cf[_0x18ce('0x40')][_0x18ce('0x47')](_0x18ce('0x48'))){_0x3ca677[_0x18ce('0x31')]=qs[_0x18ce('0x31')](_0x2b21cf[_0x18ce('0x40')][_0x18ce('0x31')]);_0x3ca677[_0x18ce('0x30')]=qs[_0x18ce('0x30')](_0x2b21cf[_0x18ce('0x40')][_0x18ce('0x30')]);}_0x3ca677[_0x18ce('0x49')]=qs['sort'](_0x2b21cf[_0x18ce('0x40')][_0x18ce('0x4a')]);_0x3ca677[_0x18ce('0x4b')]=qs[_0x18ce('0x42')](_[_0x18ce('0x4c')](_0x2b21cf[_0x18ce('0x40')],_0x34cec3[_0x18ce('0x42')]),_0x230a54);if(_0x2b21cf['query']['filter']){_0x3ca677[_0x18ce('0x4b')]=_[_0x18ce('0x4d')](_0x3ca677[_0x18ce('0x4b')],{'$or':_[_0x18ce('0x39')](_0x230a54,function(_0x5b5c42){if(_0x5b5c42[_0x18ce('0x3d')]!==_0x18ce('0x4e')){var _0x2a26eb={};_0x2a26eb[_0x5b5c42['name']]={'$like':'%'+_0x2b21cf['query'][_0x18ce('0x4f')]+'%'};return _0x2a26eb;}})});}_0x3ca677=_[_0x18ce('0x4d')]({},_0x3ca677,_0x2b21cf['options']);var _0x45ba08={'where':_0x3ca677[_0x18ce('0x4b')]};return db[_0x18ce('0x3a')][_0x18ce('0x50')](_0x45ba08)[_0x18ce('0x23')](function(_0x269b68){_0x22662b[_0x18ce('0x50')]=_0x269b68;if(_0x2b21cf['query'][_0x18ce('0x51')]){_0x3ca677[_0x18ce('0x52')]=[{'all':!![]}];}return db[_0x18ce('0x3a')][_0x18ce('0x53')](_0x3ca677);})[_0x18ce('0x23')](function(_0xae0547){_0x22662b[_0x18ce('0x54')]=_0xae0547;return _0x22662b;})[_0x18ce('0x23')](respondWithFilteredResult(_0x461ef0,_0x3ca677))[_0x18ce('0x2b')](handleError(_0x461ef0,null));};exports[_0x18ce('0x55')]=function(_0x1211d0,_0x3f9960){var _0x37bbed={'raw':![],'where':{'id':_0x1211d0['params']['id']}},_0x2ba2c1={};_0x2ba2c1[_0x18ce('0x3f')]=_[_0x18ce('0x41')](db['ServicenowAccount'][_0x18ce('0x3b')]);_0x2ba2c1['query']=_[_0x18ce('0x41')](_0x1211d0['query']);_0x2ba2c1[_0x18ce('0x42')]=_[_0x18ce('0x44')](_0x2ba2c1[_0x18ce('0x3f')],_0x2ba2c1[_0x18ce('0x40')]);_0x37bbed['attributes']=_[_0x18ce('0x44')](_0x2ba2c1['model'],qs['fields'](_0x1211d0[_0x18ce('0x40')][_0x18ce('0x45')]));_0x37bbed[_0x18ce('0x43')]=_0x37bbed['attributes']['length']?_0x37bbed[_0x18ce('0x43')]:_0x2ba2c1[_0x18ce('0x3f')];if(_0x1211d0[_0x18ce('0x40')][_0x18ce('0x51')]){_0x37bbed['include']=[{'all':!![]}];}_0x37bbed=_['merge']({},_0x37bbed,_0x1211d0[_0x18ce('0x56')]);return db['ServicenowAccount'][_0x18ce('0x57')](_0x37bbed)[_0x18ce('0x23')](handleEntityNotFound(_0x3f9960,null))[_0x18ce('0x23')](respondWithResult(_0x3f9960,null))['catch'](handleError(_0x3f9960,null));};exports[_0x18ce('0x58')]=function(_0x3d0520,_0x2da2d1){return db['ServicenowAccount'][_0x18ce('0x58')](_0x3d0520[_0x18ce('0x59')],{})[_0x18ce('0x23')](respondWithResult(_0x2da2d1,0xc9))['catch'](handleError(_0x2da2d1,null));};exports[_0x18ce('0x35')]=function(_0x109a70,_0x166c60){if(_0x109a70[_0x18ce('0x59')]['id']){delete _0x109a70['body']['id'];}return db['ServicenowAccount'][_0x18ce('0x57')]({'where':{'id':_0x109a70[_0x18ce('0x5a')]['id']}})[_0x18ce('0x23')](handleEntityNotFound(_0x166c60,null))[_0x18ce('0x23')](saveUpdates(_0x109a70[_0x18ce('0x59')],null))[_0x18ce('0x23')](respondWithResult(_0x166c60,null))[_0x18ce('0x2b')](handleError(_0x166c60,null));};exports['destroy']=function(_0x14ffaf,_0x3f7591){return db['ServicenowAccount'][_0x18ce('0x57')]({'where':{'id':_0x14ffaf['params']['id']}})['then'](handleEntityNotFound(_0x3f7591,null))[_0x18ce('0x23')](removeEntity(_0x3f7591,null))[_0x18ce('0x2b')](handleError(_0x3f7591,null));};exports[_0x18ce('0x5b')]=function(_0x36970c,_0x33a611,_0x377e56){var _0x4ca5a4={};var _0x3f5171={};var _0x101c7b;var _0x304e16;return db['ServicenowAccount'][_0x18ce('0x5c')]({'where':{'id':_0x36970c['params']['id']}})[_0x18ce('0x23')](handleEntityNotFound(_0x33a611,null))[_0x18ce('0x23')](function(_0x5abfd4){if(_0x5abfd4){_0x101c7b=_0x5abfd4;_0x3f5171['model']=_[_0x18ce('0x41')](db[_0x18ce('0x5d')]['rawAttributes']);_0x3f5171[_0x18ce('0x40')]=_[_0x18ce('0x41')](_0x36970c[_0x18ce('0x40')]);_0x3f5171[_0x18ce('0x42')]=_[_0x18ce('0x44')](_0x3f5171['model'],_0x3f5171[_0x18ce('0x40')]);_0x4ca5a4[_0x18ce('0x43')]=_['intersection'](_0x3f5171['model'],qs[_0x18ce('0x45')](_0x36970c[_0x18ce('0x40')][_0x18ce('0x45')]));_0x4ca5a4[_0x18ce('0x43')]=_0x4ca5a4[_0x18ce('0x43')][_0x18ce('0x46')]?_0x4ca5a4['attributes']:_0x3f5171['model'];_0x4ca5a4[_0x18ce('0x49')]=qs[_0x18ce('0x4a')](_0x36970c[_0x18ce('0x40')]['sort']);_0x4ca5a4[_0x18ce('0x4b')]=qs[_0x18ce('0x42')](_['pick'](_0x36970c[_0x18ce('0x40')],_0x3f5171[_0x18ce('0x42')]));if(_0x36970c['query'][_0x18ce('0x4f')]){_0x4ca5a4['where']=_['merge'](_0x4ca5a4[_0x18ce('0x4b')],{'$or':_[_0x18ce('0x39')](_0x4ca5a4[_0x18ce('0x43')],function(_0x44d6d7){var _0x38d6ec={};_0x38d6ec[_0x44d6d7]={'$like':'%'+_0x36970c['query'][_0x18ce('0x4f')]+'%'};return _0x38d6ec;})});}_0x4ca5a4=_['merge']({},_0x4ca5a4,_0x36970c[_0x18ce('0x56')]);return _0x101c7b['getConfigurations'](_0x4ca5a4);}})['then'](function(_0x35d9c3){if(_0x35d9c3){_0x304e16=_0x35d9c3['length'];if(!_0x36970c[_0x18ce('0x40')][_0x18ce('0x47')]('nolimit')){_0x4ca5a4[_0x18ce('0x31')]=qs[_0x18ce('0x31')](_0x36970c[_0x18ce('0x40')][_0x18ce('0x31')]);_0x4ca5a4[_0x18ce('0x30')]=qs[_0x18ce('0x30')](_0x36970c[_0x18ce('0x40')][_0x18ce('0x30')]);}return _0x101c7b[_0x18ce('0x5b')](_0x4ca5a4);}})[_0x18ce('0x23')](function(_0x58d4d6){if(_0x58d4d6){return _0x58d4d6?{'count':_0x304e16,'rows':_0x58d4d6}:null;}})[_0x18ce('0x23')](respondWithResult(_0x33a611,null))[_0x18ce('0x2b')](handleError(_0x33a611,null));};exports[_0x18ce('0x5e')]=function(_0x280863,_0x417b08,_0x161dbd){if(_0x280863[_0x18ce('0x59')]['id']){delete _0x280863['body']['id'];}return db['ServicenowAccount'][_0x18ce('0x5c')]({'where':{'id':_0x280863[_0x18ce('0x5a')]['id']}})[_0x18ce('0x23')](handleEntityNotFound(_0x417b08,null))[_0x18ce('0x23')](function(_0x490149){if(_0x490149){_0x280863[_0x18ce('0x59')][_0x18ce('0x5f')]=_0x490149['id'];_0x280863[_0x18ce('0x59')][_0x18ce('0x60')]=integrations[_0x18ce('0x61')](_0x280863[_0x18ce('0x59')][_0x18ce('0x62')],_0x280863[_0x18ce('0x59')][_0x18ce('0x3d')]);_0x280863[_0x18ce('0x59')][_0x18ce('0x63')]=integrations[_0x18ce('0x64')](_0x280863[_0x18ce('0x59')]['channel'],_0x280863['body'][_0x18ce('0x3d')]);return db[_0x18ce('0x5d')]['create'](_0x280863[_0x18ce('0x59')],{'include':[{'model':db[_0x18ce('0x65')],'as':_0x18ce('0x60')},{'model':db[_0x18ce('0x65')],'as':_0x18ce('0x63')}]});}return null;})['then'](respondWithResult(_0x417b08,null))[_0x18ce('0x2b')](handleError(_0x417b08,null));};exports[_0x18ce('0x66')]=function(_0x565947,_0x54a3d0,_0xf4ff26){var _0x1ba30f=[_0x18ce('0x67'),_0x18ce('0x68'),_0x18ce('0x69'),_0x18ce('0x6a'),_0x18ce('0x6b'),_0x18ce('0x6c'),'incident_state',_0x18ce('0x6d'),_0x18ce('0x6e')];var _0x4aa31f=[_0x18ce('0x6f'),_0x18ce('0x67'),'caused_by',_0x18ce('0x70'),_0x18ce('0x71'),_0x18ce('0x72'),'child_incidents',_0x18ce('0x68'),'approval_history',_0x18ce('0x73'),'resolved_by',_0x18ce('0x74'),_0x18ce('0x75'),_0x18ce('0x76'),_0x18ce('0x77'),_0x18ce('0x78'),_0x18ce('0x79'),_0x18ce('0x7a'),_0x18ce('0x69'),_0x18ce('0x49'),_0x18ce('0x7b'),_0x18ce('0x7c'),_0x18ce('0x7d'),'delivery_plan',_0x18ce('0x7e'),_0x18ce('0x7f'),_0x18ce('0x80'),_0x18ce('0x81'),_0x18ce('0x82'),'sys_domain_path','rfc',_0x18ce('0x83'),_0x18ce('0x84'),_0x18ce('0x85'),_0x18ce('0x86'),_0x18ce('0x87'),_0x18ce('0x88'),'reopened_time','resolved_at',_0x18ce('0x89'),'approval_set',_0x18ce('0x6a'),_0x18ce('0x8a'),'short_description',_0x18ce('0x6b'),_0x18ce('0x8b'),_0x18ce('0x8c'),_0x18ce('0x8d'),_0x18ce('0x8e'),'business_stc',_0x18ce('0x8f'),_0x18ce('0x90'),_0x18ce('0x91'),_0x18ce('0x6c'),_0x18ce('0x92'),_0x18ce('0x93'),_0x18ce('0x94'),'follow_up',_0x18ce('0x95'),_0x18ce('0x96'),'contact_type',_0x18ce('0x97'),_0x18ce('0x98'),_0x18ce('0x99'),_0x18ce('0x9a'),_0x18ce('0x9b'),_0x18ce('0x9c'),_0x18ce('0x9d'),_0x18ce('0x9e'),_0x18ce('0x6d'),_0x18ce('0x9f'),'sla_due',_0x18ce('0xa0'),'comments_and_work_notes','due_date',_0x18ce('0xa1'),_0x18ce('0xa2'),'sys_tags',_0x18ce('0xa3'),_0x18ce('0xa4'),_0x18ce('0xa5'),_0x18ce('0xa6'),'category'];var _0x46e4d2='';var _0x3a5a50='';var _0x4a8730=[];var _0x84eec9='';var _0x355829='';var _0x5ba222=[];var _0x465796='';var _0x37f7a3='';var _0x6bbf3e={};var _0xf9c3ab='';return db[_0x18ce('0x3a')]['findOne']({'where':{'id':_0x565947[_0x18ce('0x5a')]['id']},'attributes':['id',_0x18ce('0xa7'),_0x18ce('0xa8'),'email',_0x18ce('0xa9'),_0x18ce('0xaa')]})[_0x18ce('0x23')](handleEntityNotFound(_0x54a3d0,null))[_0x18ce('0x23')](function(_0x2b9fce){if(_0x2b9fce){_0xf9c3ab=_0x2b9fce[_0x18ce('0xa9')];var _0x2297ea=_0xf9c3ab[_0x18ce('0xab')](-0x1);if(_0x2297ea==='/'){_0xf9c3ab=_0xf9c3ab[_0x18ce('0xac')](0x0,_0xf9c3ab['lastIndexOf'](_0x2297ea));}_0x37f7a3=util[_0x18ce('0xad')](_0x18ce('0xae'),_0xf9c3ab);_0x465796=util[_0x18ce('0xad')](_0x18ce('0xaf'),_0xf9c3ab);_0x6bbf3e={'user':_0x2b9fce[_0x18ce('0xa7')],'pass':_0x2b9fce[_0x18ce('0xa8')]};var _0x2f9cc0={'method':_0x18ce('0xb0'),'uri':_0x37f7a3+_0x18ce('0xb1'),'auth':_0x6bbf3e,'json':!![]};return rp(_0x2f9cc0);}})[_0x18ce('0x23')](function(_0x297ba9){if(_0x297ba9[_0x18ce('0xb2')]['length']>0x0){_0x46e4d2=_0x297ba9[_0x18ce('0xb2')];}console[_0x18ce('0xb3')](_0x18ce('0xb4'),_0x46e4d2);_0x5ba222=[];_0x3a5a50=Object[_0x18ce('0xb5')]([],_0x46e4d2);_[_0x18ce('0xb6')](_0x3a5a50,function(_0x5cf5c6){return!_0x1ba30f[_0x18ce('0xb7')](_0x5cf5c6[_0x18ce('0x36')]);});_0x3a5a50[_0x18ce('0xb8')](function(_0x30378e){var _0xea5021=createFieldObject(_0x465796,_0x6bbf3e,_0x30378e[_0x18ce('0xb9')],_0x30378e[_0x18ce('0x36')],_0x30378e[_0x18ce('0xba')],![]);_0x5ba222[_0x18ce('0xbb')](_0xea5021);});return Promise[_0x18ce('0xbc')](_0x5ba222);})[_0x18ce('0x23')](function(_0x1d8b42){_0x4a8730=_0x1d8b42;_0x84eec9=Object[_0x18ce('0xb5')]([],_0x46e4d2);console[_0x18ce('0xb3')](_0x18ce('0xbd'),_0x46e4d2);_[_0x18ce('0xb6')](_0x84eec9,function(_0x46c86c){return _0x4aa31f[_0x18ce('0xb7')](_0x46c86c['name']);});console[_0x18ce('0xb3')](_0x18ce('0xbe'),_0x84eec9);_0x5ba222=[];_0x84eec9[_0x18ce('0xb8')](function(_0x3cebbe){var _0x507b3e=createFieldObject(_0x465796,_0x6bbf3e,_0x3cebbe[_0x18ce('0xb9')],_0x3cebbe[_0x18ce('0x36')],_0x3cebbe[_0x18ce('0xba')],!![]);_0x5ba222[_0x18ce('0xbb')](_0x507b3e);});return Promise[_0x18ce('0xbc')](_0x5ba222);})[_0x18ce('0x23')](function(_0x3812f4){_0x355829=_0x3812f4;var _0xb91ae5=_0x4a8730[_0x18ce('0xbf')](_0x355829);return{'count':_0xb91ae5['length'],'rows':_0xb91ae5};})['then'](respondWithResult(_0x54a3d0,null))[_0x18ce('0x2b')](function(_0x4ca02e){console[_0x18ce('0xb3')](_0x18ce('0xc0')+_0x4ca02e);var _0x5e8095=_0x565947[_0x18ce('0x40')][_0x18ce('0x1e')]?0x1f4:_0x4ca02e[_0x18ce('0xc1')]||0x1f4;logger[_0x18ce('0x28')](_0x4ca02e['stack']);delete _0x4ca02e[_0x18ce('0x36')];if(_0x5e8095===0x191){_0x5e8095=0x190;}_0x54a3d0['status'](_0x5e8095)[_0x18ce('0x37')](_0x565947[_0x18ce('0x40')][_0x18ce('0x1e')]?{'message':_0x18ce('0xc2'),'statusCode':_0x4ca02e[_0x18ce('0xc1')]}:_0x4ca02e);});};function createFieldObject(_0x46c605,_0x1f57c3,_0x25cc82,_0x9907da,_0xcc049f,_0x2dfa6f){return new Promise(function(_0x4c34ec,_0x5e50f1){var _0x35c2bd={'id':_0x9907da,'name':_0xcc049f,'custom':_0x2dfa6f};if(_0x25cc82==='boolean'){_0x35c2bd[_0x18ce('0x56')]=[{'name':_0x18ce('0xc3'),'value':_0x18ce('0xc4')},{'name':'False','value':_0x18ce('0xc5')}];_0x4c34ec(_0x35c2bd);}else{var _0x5b5e7b={'method':'GET','uri':_0x46c605+_0x18ce('0xc6')+_0x9907da,'auth':_0x1f57c3,'json':!![]};return rp(_0x5b5e7b)[_0x18ce('0x23')](function(_0x6c0346){var _0x1ec9fb=[];if(_0x6c0346[_0x18ce('0xb2')]['length']>0x0){_0x6c0346['result']['forEach'](function(_0x35add2){if(_0x35add2['inactive']==='false'){var _0x163ddc={'name':_0x35add2[_0x18ce('0xba')],'value':_0x35add2[_0x18ce('0xc7')]};_0x1ec9fb['push'](_0x163ddc);}});}_0x35c2bd[_0x18ce('0x56')]=_0x1ec9fb;if(_0x35c2bd[_0x18ce('0x56')]['length']>0x0){_0x4c34ec(_0x35c2bd);}else{if(_0x2dfa6f==![]){_0x4c34ec();}else{_0x4c34ec(_0x35c2bd);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 6163663..f630167 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 _0x7dfd=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount'];(function(_0x3248bd,_0x1958d6){var _0x4cd15d=function(_0x2605aa){while(--_0x2605aa){_0x3248bd['push'](_0x3248bd['shift']());}};_0x4cd15d(++_0x1958d6);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var logger=require(_0xd7df('0x2'))(_0xd7df('0x3'));var moment=require(_0xd7df('0x4'));var BPromise=require(_0xd7df('0x5'));var rp=require(_0xd7df('0x6'));var fs=require('fs');var path=require(_0xd7df('0x7'));var rimraf=require(_0xd7df('0x8'));var config=require(_0xd7df('0x9'));var attributes=require(_0xd7df('0xa'));var integrations=require(_0xd7df('0xb'));module[_0xd7df('0xc')]=function(_0x39ce98,_0x354ea7){return _0x39ce98[_0xd7df('0xd')](_0xd7df('0xe'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5089=['util','api','moment','bluebird','request-promise','path','../../config/environment','../../components/integrations/configuration','exports','define','ServicenowAccount','lodash'];(function(_0x91384,_0x545eef){var _0x44daa0=function(_0x5a0cc5){while(--_0x5a0cc5){_0x91384['push'](_0x91384['shift']());}};_0x44daa0(++_0x545eef);}(_0x5089,0x1bb));var _0x9508=function(_0x5a2d3f,_0x27b04e){_0x5a2d3f=_0x5a2d3f-0x0;var _0x5c65d8=_0x5089[_0x5a2d3f];return _0x5c65d8;};'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('./intServicenowAccount.attributes');var integrations=require(_0x9508('0x8'));module[_0x9508('0x9')]=function(_0x257318,_0x4ab3c6){return _0x257318[_0x9508('0xa')](_0x9508('0xb'),attributes,{'tableName':'int_servicenow_accounts','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 a84f419..2c07d3c 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 _0xdcb2=['include','model','attributes','debug','ShowServicenowAccount','find','map','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetServicenowAccount','findAll','options','raw','where','limit'];(function(_0xa013a4,_0x2ff249){var _0x27f4a2=function(_0x1a5a6f){while(--_0x1a5a6f){_0xa013a4['push'](_0xa013a4['shift']());}};_0x27f4a2(++_0x2ff249);}(_0xdcb2,0x17e));var _0x2dcb=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xdcb2[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x2dcb('0x0'));var util=require(_0x2dcb('0x1'));var moment=require('moment');var BPromise=require(_0x2dcb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2dcb('0x3'));var db=require(_0x2dcb('0x4'))['db'];var utils=require(_0x2dcb('0x5'));var logger=require(_0x2dcb('0x6'))(_0x2dcb('0x7'));var config=require(_0x2dcb('0x8'));var jayson=require(_0x2dcb('0x9'));var client=jayson[_0x2dcb('0xa')][_0x2dcb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18dcff,_0x367ddb,_0xa0ebac){return new BPromise(function(_0x4949d9,_0x38451c){return client['request'](_0x18dcff,_0xa0ebac)[_0x2dcb('0xc')](function(_0x4b29fa){logger[_0x2dcb('0xd')](_0x2dcb('0xe'),_0x367ddb,'request\x20sent');logger['debug']('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x367ddb,_0x2dcb('0xf'),JSON[_0x2dcb('0x10')](_0x4b29fa));if(_0x4b29fa[_0x2dcb('0x11')]){if(_0x4b29fa['error'][_0x2dcb('0x12')]===0x1f4){logger['error'](_0x2dcb('0xe'),_0x367ddb,_0x4b29fa[_0x2dcb('0x11')]['message']);return _0x38451c(_0x4b29fa['error'][_0x2dcb('0x13')]);}logger[_0x2dcb('0x11')](_0x2dcb('0xe'),_0x367ddb,_0x4b29fa[_0x2dcb('0x11')]['message']);return _0x4949d9(_0x4b29fa[_0x2dcb('0x11')][_0x2dcb('0x13')]);}else{logger[_0x2dcb('0xd')](_0x2dcb('0xe'),_0x367ddb,_0x2dcb('0xf'));_0x4949d9(_0x4b29fa['result'][_0x2dcb('0x13')]);}})['catch'](function(_0x364e37){logger['error'](_0x2dcb('0xe'),_0x367ddb,_0x364e37);_0x38451c(_0x364e37);});});}exports[_0x2dcb('0x14')]=function(_0x248998){var _0x10f126=this;return new Promise(function(_0x5d481f,_0x4dd879){return db['ServicenowAccount'][_0x2dcb('0x15')]({'raw':_0x248998[_0x2dcb('0x16')]?_0x248998[_0x2dcb('0x16')][_0x2dcb('0x17')]===undefined?!![]:![]:!![],'where':_0x248998[_0x2dcb('0x16')]?_0x248998[_0x2dcb('0x16')][_0x2dcb('0x18')]||null:null,'attributes':_0x248998[_0x2dcb('0x16')]?_0x248998[_0x2dcb('0x16')]['attributes']||null:null,'limit':_0x248998['options']?_0x248998[_0x2dcb('0x16')][_0x2dcb('0x19')]||null:null,'include':_0x248998[_0x2dcb('0x16')]?_0x248998[_0x2dcb('0x16')][_0x2dcb('0x1a')]?_['map'](_0x248998[_0x2dcb('0x16')][_0x2dcb('0x1a')],function(_0x28eab3){return{'model':db[_0x28eab3[_0x2dcb('0x1b')]],'as':_0x28eab3['as'],'attributes':_0x28eab3[_0x2dcb('0x1c')],'include':_0x28eab3[_0x2dcb('0x1a')]?_['map'](_0x28eab3[_0x2dcb('0x1a')],function(_0xce7a4a){return{'model':db[_0xce7a4a[_0x2dcb('0x1b')]],'as':_0xce7a4a['as'],'attributes':_0xce7a4a[_0x2dcb('0x1c')],'include':_0xce7a4a['include']?_['map'](_0xce7a4a[_0x2dcb('0x1a')],function(_0x569210){return{'model':db[_0x569210[_0x2dcb('0x1b')]],'as':_0x569210['as'],'attributes':_0x569210[_0x2dcb('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b2b1b){logger[_0x2dcb('0xd')](_0x2dcb('0x14'),_0x248998);logger[_0x2dcb('0x1d')](_0x2dcb('0x14'),_0x248998,JSON['stringify'](_0x4b2b1b));_0x5d481f(_0x4b2b1b);})['catch'](function(_0x3890c3){logger[_0x2dcb('0x11')](_0x2dcb('0x14'),_0x3890c3['message'],_0x248998);_0x4dd879(_0x10f126[_0x2dcb('0x11')](0x1f4,_0x3890c3['message']));});});};exports[_0x2dcb('0x1e')]=function(_0x4c1c74){var _0x4a5ded=this;return new Promise(function(_0x18590a,_0x4ca9e8){return db['ServicenowAccount'][_0x2dcb('0x1f')]({'raw':_0x4c1c74[_0x2dcb('0x16')]?_0x4c1c74[_0x2dcb('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x4c1c74[_0x2dcb('0x16')]?_0x4c1c74[_0x2dcb('0x16')]['where']||null:null,'attributes':_0x4c1c74[_0x2dcb('0x16')]?_0x4c1c74[_0x2dcb('0x16')][_0x2dcb('0x1c')]||null:null,'include':_0x4c1c74['options']?_0x4c1c74[_0x2dcb('0x16')][_0x2dcb('0x1a')]?_[_0x2dcb('0x20')](_0x4c1c74[_0x2dcb('0x16')][_0x2dcb('0x1a')],function(_0x306743){return{'model':db[_0x306743[_0x2dcb('0x1b')]],'as':_0x306743['as'],'attributes':_0x306743[_0x2dcb('0x1c')],'include':_0x306743[_0x2dcb('0x1a')]?_[_0x2dcb('0x20')](_0x306743[_0x2dcb('0x1a')],function(_0x565260){return{'model':db[_0x565260['model']],'as':_0x565260['as'],'attributes':_0x565260[_0x2dcb('0x1c')],'include':_0x565260['include']?_[_0x2dcb('0x20')](_0x565260[_0x2dcb('0x1a')],function(_0x51c69d){return{'model':db[_0x51c69d[_0x2dcb('0x1b')]],'as':_0x51c69d['as'],'attributes':_0x51c69d[_0x2dcb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2dcb('0xc')](function(_0x3bc80b){logger[_0x2dcb('0xd')]('ShowServicenowAccount',_0x4c1c74);logger[_0x2dcb('0x1d')](_0x2dcb('0x1e'),_0x4c1c74,JSON['stringify'](_0x3bc80b));_0x18590a(_0x3bc80b);})[_0x2dcb('0x21')](function(_0x408a2c){logger[_0x2dcb('0x11')](_0x2dcb('0x1e'),_0x408a2c[_0x2dcb('0x13')],_0x4c1c74);_0x4ca9e8(_0x4a5ded[_0x2dcb('0x11')](0x1f4,_0x408a2c[_0x2dcb('0x13')]));});});}; \ No newline at end of file +var _0x3f88=['findAll','options','raw','where','attributes','limit','include','map','model','then','ShowServicenowAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetServicenowAccount','ServicenowAccount'];(function(_0x5be9ba,_0x26d58e){var _0x50b543=function(_0x370f48){while(--_0x370f48){_0x5be9ba['push'](_0x5be9ba['shift']());}};_0x50b543(++_0x26d58e);}(_0x3f88,0x1ae));var _0x83f8=function(_0x10a7c7,_0x57bdb9){_0x10a7c7=_0x10a7c7-0x0;var _0x35c8d3=_0x3f88[_0x10a7c7];return _0x35c8d3;};'use strict';var _=require(_0x83f8('0x0'));var util=require(_0x83f8('0x1'));var moment=require('moment');var BPromise=require(_0x83f8('0x2'));var rs=require(_0x83f8('0x3'));var fs=require('fs');var Redis=require(_0x83f8('0x4'));var db=require(_0x83f8('0x5'))['db'];var utils=require(_0x83f8('0x6'));var logger=require(_0x83f8('0x7'))(_0x83f8('0x8'));var config=require(_0x83f8('0x9'));var jayson=require(_0x83f8('0xa'));var client=jayson[_0x83f8('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xee2fb0,_0x17a4df,_0x13c036){return new BPromise(function(_0x436f3f,_0x4fbe88){return client[_0x83f8('0xc')](_0xee2fb0,_0x13c036)['then'](function(_0x275dbd){logger[_0x83f8('0xd')](_0x83f8('0xe'),_0x17a4df,_0x83f8('0xf'));logger[_0x83f8('0x10')](_0x83f8('0x11'),_0x17a4df,'request\x20sent',JSON[_0x83f8('0x12')](_0x275dbd));if(_0x275dbd[_0x83f8('0x13')]){if(_0x275dbd['error'][_0x83f8('0x14')]===0x1f4){logger[_0x83f8('0x13')](_0x83f8('0xe'),_0x17a4df,_0x275dbd[_0x83f8('0x13')][_0x83f8('0x15')]);return _0x4fbe88(_0x275dbd[_0x83f8('0x13')][_0x83f8('0x15')]);}logger[_0x83f8('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x17a4df,_0x275dbd[_0x83f8('0x13')][_0x83f8('0x15')]);return _0x436f3f(_0x275dbd[_0x83f8('0x13')][_0x83f8('0x15')]);}else{logger[_0x83f8('0xd')](_0x83f8('0xe'),_0x17a4df,_0x83f8('0xf'));_0x436f3f(_0x275dbd[_0x83f8('0x16')][_0x83f8('0x15')]);}})[_0x83f8('0x17')](function(_0xd1443a){logger[_0x83f8('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x17a4df,_0xd1443a);_0x4fbe88(_0xd1443a);});});}exports[_0x83f8('0x18')]=function(_0x178816){var _0x68592b=this;return new Promise(function(_0x59cd09,_0x39faaf){return db[_0x83f8('0x19')][_0x83f8('0x1a')]({'raw':_0x178816[_0x83f8('0x1b')]?_0x178816['options'][_0x83f8('0x1c')]===undefined?!![]:![]:!![],'where':_0x178816[_0x83f8('0x1b')]?_0x178816[_0x83f8('0x1b')][_0x83f8('0x1d')]||null:null,'attributes':_0x178816[_0x83f8('0x1b')]?_0x178816['options'][_0x83f8('0x1e')]||null:null,'limit':_0x178816[_0x83f8('0x1b')]?_0x178816['options'][_0x83f8('0x1f')]||null:null,'include':_0x178816['options']?_0x178816[_0x83f8('0x1b')][_0x83f8('0x20')]?_[_0x83f8('0x21')](_0x178816[_0x83f8('0x1b')][_0x83f8('0x20')],function(_0x3e38cf){return{'model':db[_0x3e38cf[_0x83f8('0x22')]],'as':_0x3e38cf['as'],'attributes':_0x3e38cf['attributes'],'include':_0x3e38cf[_0x83f8('0x20')]?_[_0x83f8('0x21')](_0x3e38cf[_0x83f8('0x20')],function(_0x4ce8b0){return{'model':db[_0x4ce8b0[_0x83f8('0x22')]],'as':_0x4ce8b0['as'],'attributes':_0x4ce8b0[_0x83f8('0x1e')],'include':_0x4ce8b0['include']?_[_0x83f8('0x21')](_0x4ce8b0[_0x83f8('0x20')],function(_0x4413b0){return{'model':db[_0x4413b0[_0x83f8('0x22')]],'as':_0x4413b0['as'],'attributes':_0x4413b0[_0x83f8('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x83f8('0x23')](function(_0x4618a9){logger[_0x83f8('0xd')](_0x83f8('0x18'),_0x178816);logger[_0x83f8('0x10')](_0x83f8('0x18'),_0x178816,JSON[_0x83f8('0x12')](_0x4618a9));_0x59cd09(_0x4618a9);})[_0x83f8('0x17')](function(_0x429d98){logger['error']('GetServicenowAccount',_0x429d98[_0x83f8('0x15')],_0x178816);_0x39faaf(_0x68592b[_0x83f8('0x13')](0x1f4,_0x429d98[_0x83f8('0x15')]));});});};exports[_0x83f8('0x24')]=function(_0x51c6e5){var _0x172b70=this;return new Promise(function(_0x13af24,_0x51d9ae){return db[_0x83f8('0x19')][_0x83f8('0x25')]({'raw':_0x51c6e5['options']?_0x51c6e5[_0x83f8('0x1b')][_0x83f8('0x1c')]===undefined?!![]:![]:!![],'where':_0x51c6e5['options']?_0x51c6e5[_0x83f8('0x1b')]['where']||null:null,'attributes':_0x51c6e5[_0x83f8('0x1b')]?_0x51c6e5[_0x83f8('0x1b')][_0x83f8('0x1e')]||null:null,'include':_0x51c6e5[_0x83f8('0x1b')]?_0x51c6e5[_0x83f8('0x1b')][_0x83f8('0x20')]?_['map'](_0x51c6e5[_0x83f8('0x1b')][_0x83f8('0x20')],function(_0x1d7736){return{'model':db[_0x1d7736[_0x83f8('0x22')]],'as':_0x1d7736['as'],'attributes':_0x1d7736[_0x83f8('0x1e')],'include':_0x1d7736[_0x83f8('0x20')]?_['map'](_0x1d7736[_0x83f8('0x20')],function(_0x169836){return{'model':db[_0x169836[_0x83f8('0x22')]],'as':_0x169836['as'],'attributes':_0x169836[_0x83f8('0x1e')],'include':_0x169836[_0x83f8('0x20')]?_[_0x83f8('0x21')](_0x169836['include'],function(_0x375f61){return{'model':db[_0x375f61['model']],'as':_0x375f61['as'],'attributes':_0x375f61[_0x83f8('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x83f8('0x23')](function(_0x366967){logger[_0x83f8('0xd')](_0x83f8('0x24'),_0x51c6e5);logger['debug'](_0x83f8('0x24'),_0x51c6e5,JSON[_0x83f8('0x12')](_0x366967));_0x13af24(_0x366967);})['catch'](function(_0x46d952){logger[_0x83f8('0x13')]('ShowServicenowAccount',_0x46d952[_0x83f8('0x15')],_0x51c6e5);_0x51d9ae(_0x172b70[_0x83f8('0x13')](0x1f4,_0x46d952['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index ef8d3b8..1e0ebdc 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 _0x56a0=['isAuthenticated','index','/:id','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','get'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x56a0,0x19d));var _0x056a=function(_0x51beba,_0x202d19){_0x51beba=_0x51beba-0x0;var _0x167ee0=_0x56a0[_0x51beba];return _0x167ee0;};'use strict';var multer=require(_0x056a('0x0'));var util=require(_0x056a('0x1'));var path=require(_0x056a('0x2'));var timeout=require(_0x056a('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x056a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x056a('0x5'));var controller=require('./intServicenowConfiguration.controller');router[_0x056a('0x6')]('/',auth[_0x056a('0x7')](),controller[_0x056a('0x8')]);router[_0x056a('0x6')](_0x056a('0x9'),auth[_0x056a('0x7')](),controller['show']);router[_0x056a('0x6')]('/:id/fields',auth[_0x056a('0x7')](),controller[_0x056a('0xa')]);router[_0x056a('0x6')](_0x056a('0xb'),auth['isAuthenticated'](),controller[_0x056a('0xc')]);router[_0x056a('0x6')](_0x056a('0xd'),auth['isAuthenticated'](),controller[_0x056a('0xe')]);router['post']('/',auth[_0x056a('0x7')](),controller[_0x056a('0xf')]);router[_0x056a('0x10')](_0x056a('0x9'),auth[_0x056a('0x7')](),controller[_0x056a('0x11')]);router[_0x056a('0x12')](_0x056a('0x9'),auth[_0x056a('0x7')](),controller[_0x056a('0x13')]);module[_0x056a('0x14')]=router; \ No newline at end of file +var _0xc1bf=['get','/:id','isAuthenticated','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0xc1bf,0x187));var _0xfc1b=function(_0x57add2,_0x4f2b7d){_0x57add2=_0x57add2-0x0;var _0x4e3670=_0xc1bf[_0x57add2];return _0x4e3670;};'use strict';var multer=require(_0xfc1b('0x0'));var util=require(_0xfc1b('0x1'));var path=require(_0xfc1b('0x2'));var timeout=require('connect-timeout');var express=require(_0xfc1b('0x3'));var router=express[_0xfc1b('0x4')]();var auth=require(_0xfc1b('0x5'));var interaction=require(_0xfc1b('0x6'));var config=require(_0xfc1b('0x7'));var controller=require(_0xfc1b('0x8'));router[_0xfc1b('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xfc1b('0xa'),auth[_0xfc1b('0xb')](),controller['show']);router['get']('/:id/fields',auth[_0xfc1b('0xb')](),controller[_0xfc1b('0xc')]);router[_0xfc1b('0x9')](_0xfc1b('0xd'),auth['isAuthenticated'](),controller[_0xfc1b('0xe')]);router['get']('/:id/descriptions',auth[_0xfc1b('0xb')](),controller[_0xfc1b('0xf')]);router[_0xfc1b('0x10')]('/',auth[_0xfc1b('0xb')](),controller[_0xfc1b('0x11')]);router[_0xfc1b('0x12')](_0xfc1b('0xa'),auth['isAuthenticated'](),controller[_0xfc1b('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index b5376a1..50be4a6 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 _0xe62e=['exports','STRING','sequelize'];(function(_0x1befd5,_0x4abdc0){var _0x477b13=function(_0x44e7ea){while(--_0x44e7ea){_0x1befd5['push'](_0x1befd5['shift']());}};_0x477b13(++_0x4abdc0);}(_0xe62e,0x11c));var _0xee62=function(_0x576cd5,_0x48085b){_0x576cd5=_0x576cd5-0x0;var _0x1b1bb1=_0xe62e[_0x576cd5];return _0x1b1bb1;};'use strict';var Sequelize=require(_0xee62('0x0'));module[_0xee62('0x1')]={'name':{'type':Sequelize[_0xee62('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xde99=['exports','STRING','sequelize'];(function(_0x5d4f12,_0x11e67c){var _0x4eb577=function(_0x4d7a2d){while(--_0x4d7a2d){_0x5d4f12['push'](_0x5d4f12['shift']());}};_0x4eb577(++_0x11e67c);}(_0xde99,0xa7));var _0x9de9=function(_0x5dbaa9,_0xa1eb2f){_0x5dbaa9=_0x5dbaa9-0x0;var _0x52abe0=_0xde99[_0x5dbaa9];return _0x52abe0;};'use strict';var Sequelize=require(_0x9de9('0x0'));module[_0x9de9('0x1')]={'name':{'type':Sequelize[_0x9de9('0x2')]},'description':{'type':Sequelize[_0x9de9('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 6776936..c588ec5 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 _0x1339=['sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','params','ServicenowConfiguration','length','find','create','update','body','getFields','findOne','nolimit','getSubjects','getDescriptions','ServicenowField','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','ServicenowConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','apply','reject','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order'];(function(_0x7dfd37,_0x6a8efc){var _0x4cf35b=function(_0x584ede){while(--_0x584ede){_0x7dfd37['push'](_0x7dfd37['shift']());}};_0x4cf35b(++_0x6a8efc);}(_0x1339,0x1ed));var _0x9133=function(_0x4498ff,_0x2cc0b4){_0x4498ff=_0x4498ff-0x0;var _0x2bd56e=_0x1339[_0x4498ff];return _0x2bd56e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x9133('0x0'));var zipdir=require(_0x9133('0x1'));var jsonpatch=require(_0x9133('0x2'));var rp=require(_0x9133('0x3'));var moment=require(_0x9133('0x4'));var BPromise=require(_0x9133('0x5'));var Mustache=require(_0x9133('0x6'));var util=require(_0x9133('0x7'));var path=require('path');var sox=require(_0x9133('0x8'));var csv=require(_0x9133('0x9'));var ejs=require(_0x9133('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9133('0xb'));var crypto=require(_0x9133('0xc'));var jsforce=require(_0x9133('0xd'));var deskjs=require(_0x9133('0xe'));var toCsv=require(_0x9133('0x9'));var querystring=require(_0x9133('0xf'));var Papa=require(_0x9133('0x10'));var Redis=require(_0x9133('0x11'));var authService=require(_0x9133('0x12'));var qs=require(_0x9133('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9133('0x14'));var logger=require(_0x9133('0x15'))(_0x9133('0x16'));var utils=require(_0x9133('0x17'));var config=require(_0x9133('0x18'));var db=require(_0x9133('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x9133('0x1a')][_0x9133('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x4bbfdc,_0x5283a3,_0x10475c){if(_0x10475c){var _0x4bf947=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4bf947[_0x9133('0x1c')](_0x5283a3)){return _0x4bbfdc;}else{throw new db[(_0x9133('0x1d'))][(_0x9133('0x1e'))](_0x9133('0x1f'));}}else{return _0x4bbfdc;}}function respondWithRpcPromise(_0x31847a,_0x4327b3,_0x49cc5d,_0x13f8fc){return new BPromise(function(_0x1e23ce,_0x4f4f14){var _0x28ffcb=_0x13f8fc||client;return _0x28ffcb[_0x9133('0x20')](_0x31847a,_0x49cc5d)[_0x9133('0x21')](function(_0x427663){logger['info'](_0x9133('0x22'),_0x4327b3,'request\x20sent');logger[_0x9133('0x23')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x4327b3,_0x9133('0x24'),JSON[_0x9133('0x25')](_0x427663));if(_0x427663['error']){if(_0x427663[_0x9133('0x26')]['code']===0x1f4){logger[_0x9133('0x26')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4327b3,_0x427663['error'][_0x9133('0x27')]);return _0x4f4f14(_0x427663['error'][_0x9133('0x27')]);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x4327b3,_0x427663['error'][_0x9133('0x27')]);return _0x1e23ce(_0x427663[_0x9133('0x26')]['message']);}else{logger[_0x9133('0x28')](_0x9133('0x22'),_0x4327b3,_0x9133('0x24'));_0x1e23ce(_0x427663[_0x9133('0x29')]['message']);}})[_0x9133('0x2a')](function(_0x5c4614){logger[_0x9133('0x26')](_0x9133('0x22'),_0x4327b3,_0x5c4614);_0x4f4f14(_0x5c4614);});});}function respondWithStatusCode(_0x3f278d,_0x14c1cb){_0x14c1cb=_0x14c1cb||0xcc;return function(_0x4483ef){if(_0x4483ef){return _0x3f278d[_0x9133('0x2b')](_0x14c1cb);}return _0x3f278d[_0x9133('0x2c')](_0x14c1cb)[_0x9133('0x2d')]();};}function respondWithResult(_0x1b6b3e,_0x46050b){_0x46050b=_0x46050b||0xc8;return function(_0x51de62){if(_0x51de62){return _0x1b6b3e['status'](_0x46050b)[_0x9133('0x2e')](_0x51de62);}};}function respondWithFilteredResult(_0x3dfdc2,_0x428e18){return function(_0x348486){if(_0x348486){var _0x4de894=_0x348486[_0x9133('0x2f')],_0x4ecd9e=_0x428e18[_0x9133('0x30')],_0x3e2404=_0x428e18[_0x9133('0x30')]+_0x428e18[_0x9133('0x31')],_0x45966d;if(_0x3e2404>=_0x4de894){_0x3e2404=_0x4de894;_0x45966d=0xc8;}else{_0x45966d=0xce;}_0x3dfdc2['status'](_0x45966d);return _0x3dfdc2['set']('Content-Range',_0x4ecd9e+'-'+_0x3e2404+'/'+_0x4de894)[_0x9133('0x2e')](_0x348486);}return null;};}function patchUpdates(_0x4a4a8e){return function(_0x43b5f3){try{jsonpatch[_0x9133('0x32')](_0x43b5f3,_0x4a4a8e,!![]);}catch(_0x540c79){return BPromise[_0x9133('0x33')](_0x540c79);}return _0x43b5f3['save']();};}function saveUpdates(_0xf0aec4,_0x26ca56){return function(_0x4020d1){if(_0x4020d1){return _0x4020d1['update'](_0xf0aec4)[_0x9133('0x21')](function(_0x41cfbe){return _0x41cfbe;});}return null;};}function removeEntity(_0x3f189c,_0x5f12b9){return function(_0x10cea6){if(_0x10cea6){return _0x10cea6[_0x9133('0x34')]()[_0x9133('0x21')](function(){_0x3f189c['status'](0xcc)[_0x9133('0x2d')]();});}};}function handleEntityNotFound(_0x20da68,_0x1b5700){return function(_0x1471bb){if(!_0x1471bb){_0x20da68['sendStatus'](0x194);}return _0x1471bb;};}function handleError(_0x3ccd89,_0xea26a3){_0xea26a3=_0xea26a3||0x1f4;return function(_0x56719e){logger[_0x9133('0x26')](_0x56719e[_0x9133('0x35')]);if(_0x56719e[_0x9133('0x36')]){delete _0x56719e[_0x9133('0x36')];}_0x3ccd89[_0x9133('0x2c')](_0xea26a3)[_0x9133('0x37')](_0x56719e);};}exports[_0x9133('0x38')]=function(_0x167e45,_0x4172e3){var _0x335217={},_0x40d92f={},_0x4f3fa6={'count':0x0,'rows':[]};var _0x17bb4c=_[_0x9133('0x39')](db['ServicenowConfiguration'][_0x9133('0x3a')],function(_0x3a2d1f){return{'name':_0x3a2d1f[_0x9133('0x3b')],'type':_0x3a2d1f[_0x9133('0x3c')][_0x9133('0x3d')]};});_0x40d92f[_0x9133('0x3e')]=_['map'](_0x17bb4c,'name');_0x40d92f[_0x9133('0x3f')]=_[_0x9133('0x40')](_0x167e45[_0x9133('0x3f')]);_0x40d92f[_0x9133('0x41')]=_[_0x9133('0x42')](_0x40d92f[_0x9133('0x3e')],_0x40d92f[_0x9133('0x3f')]);_0x335217[_0x9133('0x43')]=_[_0x9133('0x42')](_0x40d92f['model'],qs[_0x9133('0x44')](_0x167e45[_0x9133('0x3f')][_0x9133('0x44')]));_0x335217[_0x9133('0x43')]=_0x335217[_0x9133('0x43')]['length']?_0x335217[_0x9133('0x43')]:_0x40d92f[_0x9133('0x3e')];if(!_0x167e45[_0x9133('0x3f')][_0x9133('0x45')]('nolimit')){_0x335217[_0x9133('0x31')]=qs[_0x9133('0x31')](_0x167e45[_0x9133('0x3f')][_0x9133('0x31')]);_0x335217[_0x9133('0x30')]=qs[_0x9133('0x30')](_0x167e45[_0x9133('0x3f')]['offset']);}_0x335217[_0x9133('0x46')]=qs['sort'](_0x167e45['query'][_0x9133('0x47')]);_0x335217[_0x9133('0x48')]=qs[_0x9133('0x41')](_[_0x9133('0x49')](_0x167e45[_0x9133('0x3f')],_0x40d92f[_0x9133('0x41')]),_0x17bb4c);if(_0x167e45[_0x9133('0x3f')][_0x9133('0x4a')]){_0x335217[_0x9133('0x48')]=_['merge'](_0x335217[_0x9133('0x48')],{'$or':_[_0x9133('0x39')](_0x17bb4c,function(_0x2928bd){if(_0x2928bd['type']!=='VIRTUAL'){var _0x4fae70={};_0x4fae70[_0x2928bd[_0x9133('0x36')]]={'$like':'%'+_0x167e45['query'][_0x9133('0x4a')]+'%'};return _0x4fae70;}})});}_0x335217=_[_0x9133('0x4b')]({},_0x335217,_0x167e45[_0x9133('0x4c')]);var _0x1a71f0={'where':_0x335217[_0x9133('0x48')]};return db['ServicenowConfiguration'][_0x9133('0x2f')](_0x1a71f0)[_0x9133('0x21')](function(_0x1acf51){_0x4f3fa6['count']=_0x1acf51;if(_0x167e45[_0x9133('0x3f')][_0x9133('0x4d')]){_0x335217['include']=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x9133('0x4e')](_0x335217);})[_0x9133('0x21')](function(_0x4446fe){_0x4f3fa6[_0x9133('0x4f')]=_0x4446fe;return _0x4f3fa6;})[_0x9133('0x21')](respondWithFilteredResult(_0x4172e3,_0x335217))[_0x9133('0x2a')](handleError(_0x4172e3,null));};exports[_0x9133('0x50')]=function(_0x21177a,_0x23f134){var _0xf07fbb={'raw':![],'where':{'id':_0x21177a[_0x9133('0x51')]['id']}},_0x3d6a49={};_0x3d6a49['model']=_['keys'](db[_0x9133('0x52')]['rawAttributes']);_0x3d6a49[_0x9133('0x3f')]=_[_0x9133('0x40')](_0x21177a[_0x9133('0x3f')]);_0x3d6a49[_0x9133('0x41')]=_['intersection'](_0x3d6a49[_0x9133('0x3e')],_0x3d6a49[_0x9133('0x3f')]);_0xf07fbb[_0x9133('0x43')]=_['intersection'](_0x3d6a49[_0x9133('0x3e')],qs[_0x9133('0x44')](_0x21177a[_0x9133('0x3f')]['fields']));_0xf07fbb[_0x9133('0x43')]=_0xf07fbb['attributes'][_0x9133('0x53')]?_0xf07fbb[_0x9133('0x43')]:_0x3d6a49[_0x9133('0x3e')];if(_0x21177a[_0x9133('0x3f')]['includeAll']){_0xf07fbb['include']=[{'all':!![]}];}_0xf07fbb=_[_0x9133('0x4b')]({},_0xf07fbb,_0x21177a[_0x9133('0x4c')]);return db[_0x9133('0x52')][_0x9133('0x54')](_0xf07fbb)[_0x9133('0x21')](handleEntityNotFound(_0x23f134,null))['then'](respondWithResult(_0x23f134,null))['catch'](handleError(_0x23f134,null));};exports[_0x9133('0x55')]=function(_0x16f889,_0x4abefd){return db[_0x9133('0x52')][_0x9133('0x55')](_0x16f889['body'],{})['then'](respondWithResult(_0x4abefd,0xc9))['catch'](handleError(_0x4abefd,null));};exports[_0x9133('0x56')]=function(_0x537046,_0x12d9e1){if(_0x537046[_0x9133('0x57')]['id']){delete _0x537046[_0x9133('0x57')]['id'];}return db[_0x9133('0x52')]['find']({'where':{'id':_0x537046[_0x9133('0x51')]['id']}})['then'](handleEntityNotFound(_0x12d9e1,null))[_0x9133('0x21')](saveUpdates(_0x537046[_0x9133('0x57')],null))[_0x9133('0x21')](respondWithResult(_0x12d9e1,null))[_0x9133('0x2a')](handleError(_0x12d9e1,null));};exports[_0x9133('0x34')]=function(_0x3534bf,_0x56861c){return db['ServicenowConfiguration']['find']({'where':{'id':_0x3534bf[_0x9133('0x51')]['id']}})[_0x9133('0x21')](handleEntityNotFound(_0x56861c,null))[_0x9133('0x21')](removeEntity(_0x56861c,null))['catch'](handleError(_0x56861c,null));};exports[_0x9133('0x58')]=function(_0x1f6684,_0x415d55,_0x240dbf){var _0x4430dc={};var _0x356103={};var _0x43dd0a;var _0x218d8e;return db['ServicenowConfiguration'][_0x9133('0x59')]({'where':{'id':_0x1f6684['params']['id']}})[_0x9133('0x21')](handleEntityNotFound(_0x415d55,null))['then'](function(_0x3a77be){if(_0x3a77be){_0x43dd0a=_0x3a77be;_0x356103[_0x9133('0x3e')]=_['keys'](db['ServicenowField'][_0x9133('0x3a')]);_0x356103[_0x9133('0x3f')]=_[_0x9133('0x40')](_0x1f6684[_0x9133('0x3f')]);_0x356103[_0x9133('0x41')]=_[_0x9133('0x42')](_0x356103[_0x9133('0x3e')],_0x356103[_0x9133('0x3f')]);_0x4430dc[_0x9133('0x43')]=_[_0x9133('0x42')](_0x356103[_0x9133('0x3e')],qs['fields'](_0x1f6684[_0x9133('0x3f')]['fields']));_0x4430dc[_0x9133('0x43')]=_0x4430dc[_0x9133('0x43')][_0x9133('0x53')]?_0x4430dc[_0x9133('0x43')]:_0x356103[_0x9133('0x3e')];_0x4430dc['order']=qs[_0x9133('0x47')](_0x1f6684[_0x9133('0x3f')][_0x9133('0x47')]);_0x4430dc[_0x9133('0x48')]=qs['filters'](_[_0x9133('0x49')](_0x1f6684[_0x9133('0x3f')],_0x356103[_0x9133('0x41')]));if(_0x1f6684[_0x9133('0x3f')]['filter']){_0x4430dc['where']=_[_0x9133('0x4b')](_0x4430dc[_0x9133('0x48')],{'$or':_[_0x9133('0x39')](_0x4430dc[_0x9133('0x43')],function(_0x28cc46){var _0x2cfaf8={};_0x2cfaf8[_0x28cc46]={'$like':'%'+_0x1f6684['query'][_0x9133('0x4a')]+'%'};return _0x2cfaf8;})});}_0x4430dc=_[_0x9133('0x4b')]({},_0x4430dc,_0x1f6684[_0x9133('0x4c')]);return _0x43dd0a[_0x9133('0x58')](_0x4430dc);}})['then'](function(_0x47342a){if(_0x47342a){_0x218d8e=_0x47342a['length'];if(!_0x1f6684[_0x9133('0x3f')][_0x9133('0x45')](_0x9133('0x5a'))){_0x4430dc[_0x9133('0x31')]=qs[_0x9133('0x31')](_0x1f6684[_0x9133('0x3f')][_0x9133('0x31')]);_0x4430dc[_0x9133('0x30')]=qs['offset'](_0x1f6684[_0x9133('0x3f')][_0x9133('0x30')]);}return _0x43dd0a[_0x9133('0x58')](_0x4430dc);}})[_0x9133('0x21')](function(_0x406861){if(_0x406861){return _0x406861?{'count':_0x218d8e,'rows':_0x406861}:null;}})['then'](respondWithResult(_0x415d55,null))['catch'](handleError(_0x415d55,null));};exports['getSubjects']=function(_0x7e0f3c,_0x1ea18c,_0x3d7a07){var _0x4c0225={};var _0xcbc942={};var _0x3bf109;var _0x36aa57;return db[_0x9133('0x52')][_0x9133('0x59')]({'where':{'id':_0x7e0f3c[_0x9133('0x51')]['id']}})[_0x9133('0x21')](handleEntityNotFound(_0x1ea18c,null))[_0x9133('0x21')](function(_0x50c174){if(_0x50c174){_0x3bf109=_0x50c174;_0xcbc942[_0x9133('0x3e')]=_[_0x9133('0x40')](db['ServicenowField'][_0x9133('0x3a')]);_0xcbc942['query']=_[_0x9133('0x40')](_0x7e0f3c[_0x9133('0x3f')]);_0xcbc942[_0x9133('0x41')]=_[_0x9133('0x42')](_0xcbc942[_0x9133('0x3e')],_0xcbc942['query']);_0x4c0225[_0x9133('0x43')]=_[_0x9133('0x42')](_0xcbc942[_0x9133('0x3e')],qs[_0x9133('0x44')](_0x7e0f3c['query'][_0x9133('0x44')]));_0x4c0225[_0x9133('0x43')]=_0x4c0225[_0x9133('0x43')][_0x9133('0x53')]?_0x4c0225[_0x9133('0x43')]:_0xcbc942[_0x9133('0x3e')];_0x4c0225[_0x9133('0x46')]=qs[_0x9133('0x47')](_0x7e0f3c[_0x9133('0x3f')][_0x9133('0x47')]);_0x4c0225[_0x9133('0x48')]=qs['filters'](_[_0x9133('0x49')](_0x7e0f3c[_0x9133('0x3f')],_0xcbc942[_0x9133('0x41')]));if(_0x7e0f3c[_0x9133('0x3f')]['filter']){_0x4c0225[_0x9133('0x48')]=_['merge'](_0x4c0225[_0x9133('0x48')],{'$or':_[_0x9133('0x39')](_0x4c0225[_0x9133('0x43')],function(_0x530984){var _0x183298={};_0x183298[_0x530984]={'$like':'%'+_0x7e0f3c[_0x9133('0x3f')][_0x9133('0x4a')]+'%'};return _0x183298;})});}_0x4c0225=_['merge']({},_0x4c0225,_0x7e0f3c[_0x9133('0x4c')]);return _0x3bf109[_0x9133('0x5b')](_0x4c0225);}})['then'](function(_0x255bcd){if(_0x255bcd){_0x36aa57=_0x255bcd[_0x9133('0x53')];if(!_0x7e0f3c[_0x9133('0x3f')]['hasOwnProperty'](_0x9133('0x5a'))){_0x4c0225['limit']=qs[_0x9133('0x31')](_0x7e0f3c[_0x9133('0x3f')][_0x9133('0x31')]);_0x4c0225['offset']=qs[_0x9133('0x30')](_0x7e0f3c['query'][_0x9133('0x30')]);}return _0x3bf109[_0x9133('0x5b')](_0x4c0225);}})[_0x9133('0x21')](function(_0x3f11a7){if(_0x3f11a7){return _0x3f11a7?{'count':_0x36aa57,'rows':_0x3f11a7}:null;}})[_0x9133('0x21')](respondWithResult(_0x1ea18c,null))[_0x9133('0x2a')](handleError(_0x1ea18c,null));};exports[_0x9133('0x5c')]=function(_0x3b854d,_0x47edda,_0x6e98a2){var _0xa616b0={};var _0x1e507e={};var _0x29262f;var _0x12b9c0;return db['ServicenowConfiguration'][_0x9133('0x59')]({'where':{'id':_0x3b854d[_0x9133('0x51')]['id']}})[_0x9133('0x21')](handleEntityNotFound(_0x47edda,null))[_0x9133('0x21')](function(_0x5ad5db){if(_0x5ad5db){_0x29262f=_0x5ad5db;_0x1e507e[_0x9133('0x3e')]=_['keys'](db[_0x9133('0x5d')][_0x9133('0x3a')]);_0x1e507e[_0x9133('0x3f')]=_[_0x9133('0x40')](_0x3b854d['query']);_0x1e507e[_0x9133('0x41')]=_[_0x9133('0x42')](_0x1e507e[_0x9133('0x3e')],_0x1e507e[_0x9133('0x3f')]);_0xa616b0[_0x9133('0x43')]=_['intersection'](_0x1e507e['model'],qs['fields'](_0x3b854d['query'][_0x9133('0x44')]));_0xa616b0[_0x9133('0x43')]=_0xa616b0[_0x9133('0x43')]['length']?_0xa616b0[_0x9133('0x43')]:_0x1e507e[_0x9133('0x3e')];_0xa616b0[_0x9133('0x46')]=qs[_0x9133('0x47')](_0x3b854d[_0x9133('0x3f')]['sort']);_0xa616b0[_0x9133('0x48')]=qs['filters'](_[_0x9133('0x49')](_0x3b854d[_0x9133('0x3f')],_0x1e507e[_0x9133('0x41')]));if(_0x3b854d[_0x9133('0x3f')][_0x9133('0x4a')]){_0xa616b0['where']=_[_0x9133('0x4b')](_0xa616b0[_0x9133('0x48')],{'$or':_[_0x9133('0x39')](_0xa616b0['attributes'],function(_0x311728){var _0x4b5eb0={};_0x4b5eb0[_0x311728]={'$like':'%'+_0x3b854d[_0x9133('0x3f')][_0x9133('0x4a')]+'%'};return _0x4b5eb0;})});}_0xa616b0=_[_0x9133('0x4b')]({},_0xa616b0,_0x3b854d[_0x9133('0x4c')]);return _0x29262f[_0x9133('0x5c')](_0xa616b0);}})[_0x9133('0x21')](function(_0x4b7615){if(_0x4b7615){_0x12b9c0=_0x4b7615[_0x9133('0x53')];if(!_0x3b854d[_0x9133('0x3f')][_0x9133('0x45')](_0x9133('0x5a'))){_0xa616b0[_0x9133('0x31')]=qs[_0x9133('0x31')](_0x3b854d['query']['limit']);_0xa616b0[_0x9133('0x30')]=qs[_0x9133('0x30')](_0x3b854d['query'][_0x9133('0x30')]);}return _0x29262f['getDescriptions'](_0xa616b0);}})[_0x9133('0x21')](function(_0x4418a8){if(_0x4418a8){return _0x4418a8?{'count':_0x12b9c0,'rows':_0x4418a8}:null;}})['then'](respondWithResult(_0x47edda,null))[_0x9133('0x2a')](handleError(_0x47edda,null));}; \ No newline at end of file +var _0xa571=['../../config/utils','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','pick','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','destroy','filter','hasOwnProperty','getFields','getSubjects','findOne','ServicenowField','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0xa571,0x107));var _0x1a57=function(_0x1fda2e,_0xc15bc9){_0x1fda2e=_0x1fda2e-0x0;var _0x35f4eb=_0xa571[_0x1fda2e];return _0x35f4eb;};'use strict';var pdf=require(_0x1a57('0x0'));var emlformat=require(_0x1a57('0x1'));var rimraf=require(_0x1a57('0x2'));var zipdir=require(_0x1a57('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1a57('0x4'));var moment=require(_0x1a57('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1a57('0x6'));var path=require('path');var sox=require(_0x1a57('0x7'));var csv=require(_0x1a57('0x8'));var ejs=require(_0x1a57('0x9'));var fs=require('fs');var _=require(_0x1a57('0xa'));var squel=require(_0x1a57('0xb'));var crypto=require(_0x1a57('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1a57('0xd'));var toCsv=require(_0x1a57('0x8'));var querystring=require(_0x1a57('0xe'));var Papa=require('papaparse');var Redis=require(_0x1a57('0xf'));var authService=require(_0x1a57('0x10'));var qs=require(_0x1a57('0x11'));var as=require(_0x1a57('0x12'));var hardwareService=require(_0x1a57('0x13'));var logger=require(_0x1a57('0x14'))(_0x1a57('0x15'));var utils=require(_0x1a57('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0x1a57('0x17'));var client=jayson[_0x1a57('0x18')][_0x1a57('0x19')]({'port':0x232a});function checkPasswordPattern(_0x5ae643,_0x3de36a,_0x18eec5){if(_0x18eec5){var _0x4c5ed4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4c5ed4[_0x1a57('0x1a')](_0x3de36a)){return _0x5ae643;}else{throw new db['Sequelize'][(_0x1a57('0x1b'))](_0x1a57('0x1c'));}}else{return _0x5ae643;}}function respondWithRpcPromise(_0x27e824,_0x153d01,_0x5802d6,_0x20f7ad){return new BPromise(function(_0x53c61f,_0x49ee05){var _0x1b58d7=_0x20f7ad||client;return _0x1b58d7[_0x1a57('0x1d')](_0x27e824,_0x5802d6)[_0x1a57('0x1e')](function(_0x51b4c2){logger[_0x1a57('0x1f')](_0x1a57('0x20'),_0x153d01,_0x1a57('0x21'));logger['debug'](_0x1a57('0x22'),_0x153d01,_0x1a57('0x21'),JSON[_0x1a57('0x23')](_0x51b4c2));if(_0x51b4c2[_0x1a57('0x24')]){if(_0x51b4c2[_0x1a57('0x24')]['code']===0x1f4){logger['error'](_0x1a57('0x20'),_0x153d01,_0x51b4c2[_0x1a57('0x24')][_0x1a57('0x25')]);return _0x49ee05(_0x51b4c2['error']['message']);}logger['error'](_0x1a57('0x20'),_0x153d01,_0x51b4c2[_0x1a57('0x24')][_0x1a57('0x25')]);return _0x53c61f(_0x51b4c2[_0x1a57('0x24')][_0x1a57('0x25')]);}else{logger[_0x1a57('0x1f')](_0x1a57('0x20'),_0x153d01,_0x1a57('0x21'));_0x53c61f(_0x51b4c2[_0x1a57('0x26')][_0x1a57('0x25')]);}})[_0x1a57('0x27')](function(_0x36b17e){logger[_0x1a57('0x24')](_0x1a57('0x20'),_0x153d01,_0x36b17e);_0x49ee05(_0x36b17e);});});}function respondWithStatusCode(_0x2f9454,_0x182649){_0x182649=_0x182649||0xcc;return function(_0x25c1e9){if(_0x25c1e9){return _0x2f9454[_0x1a57('0x28')](_0x182649);}return _0x2f9454[_0x1a57('0x29')](_0x182649)[_0x1a57('0x2a')]();};}function respondWithResult(_0x26584b,_0x1dd939){_0x1dd939=_0x1dd939||0xc8;return function(_0x5a53c8){if(_0x5a53c8){return _0x26584b['status'](_0x1dd939)[_0x1a57('0x2b')](_0x5a53c8);}};}function respondWithFilteredResult(_0x22549f,_0x545041){return function(_0x46dac6){if(_0x46dac6){var _0x54f6a5=_0x46dac6[_0x1a57('0x2c')],_0x2d8738=_0x545041[_0x1a57('0x2d')],_0x4a2901=_0x545041[_0x1a57('0x2d')]+_0x545041[_0x1a57('0x2e')],_0x53bf6e;if(_0x4a2901>=_0x54f6a5){_0x4a2901=_0x54f6a5;_0x53bf6e=0xc8;}else{_0x53bf6e=0xce;}_0x22549f['status'](_0x53bf6e);return _0x22549f[_0x1a57('0x2f')](_0x1a57('0x30'),_0x2d8738+'-'+_0x4a2901+'/'+_0x54f6a5)[_0x1a57('0x2b')](_0x46dac6);}return null;};}function patchUpdates(_0x160536){return function(_0x5763ba){try{jsonpatch[_0x1a57('0x31')](_0x5763ba,_0x160536,!![]);}catch(_0x251a54){return BPromise[_0x1a57('0x32')](_0x251a54);}return _0x5763ba[_0x1a57('0x33')]();};}function saveUpdates(_0x3ac6ff,_0x335c14){return function(_0x35df7d){if(_0x35df7d){return _0x35df7d[_0x1a57('0x34')](_0x3ac6ff)[_0x1a57('0x1e')](function(_0x4c1acc){return _0x4c1acc;});}return null;};}function removeEntity(_0x28e829,_0x1e27b4){return function(_0x497488){if(_0x497488){return _0x497488['destroy']()[_0x1a57('0x1e')](function(){_0x28e829[_0x1a57('0x29')](0xcc)[_0x1a57('0x2a')]();});}};}function handleEntityNotFound(_0x170bf7,_0x146473){return function(_0x1905f8){if(!_0x1905f8){_0x170bf7[_0x1a57('0x28')](0x194);}return _0x1905f8;};}function handleError(_0x41e466,_0x3f14ca){_0x3f14ca=_0x3f14ca||0x1f4;return function(_0x2a6feb){logger[_0x1a57('0x24')](_0x2a6feb[_0x1a57('0x35')]);if(_0x2a6feb[_0x1a57('0x36')]){delete _0x2a6feb[_0x1a57('0x36')];}_0x41e466[_0x1a57('0x29')](_0x3f14ca)[_0x1a57('0x37')](_0x2a6feb);};}exports[_0x1a57('0x38')]=function(_0x43880d,_0x53432f){var _0x3cd160={},_0x173671={},_0x137920={'count':0x0,'rows':[]};var _0x3dad7c=_[_0x1a57('0x39')](db[_0x1a57('0x3a')][_0x1a57('0x3b')],function(_0x23d087){return{'name':_0x23d087[_0x1a57('0x3c')],'type':_0x23d087['type']['key']};});_0x173671['model']=_['map'](_0x3dad7c,_0x1a57('0x36'));_0x173671[_0x1a57('0x3d')]=_[_0x1a57('0x3e')](_0x43880d['query']);_0x173671[_0x1a57('0x3f')]=_[_0x1a57('0x40')](_0x173671[_0x1a57('0x41')],_0x173671[_0x1a57('0x3d')]);_0x3cd160['attributes']=_[_0x1a57('0x40')](_0x173671['model'],qs[_0x1a57('0x42')](_0x43880d[_0x1a57('0x3d')][_0x1a57('0x42')]));_0x3cd160['attributes']=_0x3cd160[_0x1a57('0x43')][_0x1a57('0x44')]?_0x3cd160[_0x1a57('0x43')]:_0x173671[_0x1a57('0x41')];if(!_0x43880d[_0x1a57('0x3d')]['hasOwnProperty'](_0x1a57('0x45'))){_0x3cd160['limit']=qs['limit'](_0x43880d[_0x1a57('0x3d')]['limit']);_0x3cd160[_0x1a57('0x2d')]=qs[_0x1a57('0x2d')](_0x43880d[_0x1a57('0x3d')]['offset']);}_0x3cd160[_0x1a57('0x46')]=qs[_0x1a57('0x47')](_0x43880d[_0x1a57('0x3d')][_0x1a57('0x47')]);_0x3cd160['where']=qs[_0x1a57('0x3f')](_[_0x1a57('0x48')](_0x43880d['query'],_0x173671[_0x1a57('0x3f')]),_0x3dad7c);if(_0x43880d['query']['filter']){_0x3cd160[_0x1a57('0x49')]=_[_0x1a57('0x4a')](_0x3cd160[_0x1a57('0x49')],{'$or':_[_0x1a57('0x39')](_0x3dad7c,function(_0x5c0f5d){if(_0x5c0f5d[_0x1a57('0x4b')]!==_0x1a57('0x4c')){var _0x20517c={};_0x20517c[_0x5c0f5d[_0x1a57('0x36')]]={'$like':'%'+_0x43880d[_0x1a57('0x3d')]['filter']+'%'};return _0x20517c;}})});}_0x3cd160=_[_0x1a57('0x4a')]({},_0x3cd160,_0x43880d[_0x1a57('0x4d')]);var _0x3b9660={'where':_0x3cd160[_0x1a57('0x49')]};return db['ServicenowConfiguration'][_0x1a57('0x2c')](_0x3b9660)['then'](function(_0x4bbfc3){_0x137920[_0x1a57('0x2c')]=_0x4bbfc3;if(_0x43880d[_0x1a57('0x3d')][_0x1a57('0x4e')]){_0x3cd160[_0x1a57('0x4f')]=[{'all':!![]}];}return db[_0x1a57('0x3a')][_0x1a57('0x50')](_0x3cd160);})[_0x1a57('0x1e')](function(_0x29fe1f){_0x137920[_0x1a57('0x51')]=_0x29fe1f;return _0x137920;})[_0x1a57('0x1e')](respondWithFilteredResult(_0x53432f,_0x3cd160))[_0x1a57('0x27')](handleError(_0x53432f,null));};exports[_0x1a57('0x52')]=function(_0x47f9da,_0xf4d056){var _0x480aff={'raw':![],'where':{'id':_0x47f9da[_0x1a57('0x53')]['id']}},_0x3bf103={};_0x3bf103[_0x1a57('0x41')]=_[_0x1a57('0x3e')](db[_0x1a57('0x3a')][_0x1a57('0x3b')]);_0x3bf103[_0x1a57('0x3d')]=_[_0x1a57('0x3e')](_0x47f9da[_0x1a57('0x3d')]);_0x3bf103['filters']=_[_0x1a57('0x40')](_0x3bf103[_0x1a57('0x41')],_0x3bf103['query']);_0x480aff[_0x1a57('0x43')]=_[_0x1a57('0x40')](_0x3bf103['model'],qs[_0x1a57('0x42')](_0x47f9da[_0x1a57('0x3d')]['fields']));_0x480aff['attributes']=_0x480aff['attributes'][_0x1a57('0x44')]?_0x480aff[_0x1a57('0x43')]:_0x3bf103['model'];if(_0x47f9da[_0x1a57('0x3d')][_0x1a57('0x4e')]){_0x480aff['include']=[{'all':!![]}];}_0x480aff=_['merge']({},_0x480aff,_0x47f9da['options']);return db[_0x1a57('0x3a')][_0x1a57('0x54')](_0x480aff)[_0x1a57('0x1e')](handleEntityNotFound(_0xf4d056,null))[_0x1a57('0x1e')](respondWithResult(_0xf4d056,null))[_0x1a57('0x27')](handleError(_0xf4d056,null));};exports[_0x1a57('0x55')]=function(_0xd64b3a,_0x1f705b){return db['ServicenowConfiguration']['create'](_0xd64b3a['body'],{})['then'](respondWithResult(_0x1f705b,0xc9))['catch'](handleError(_0x1f705b,null));};exports[_0x1a57('0x34')]=function(_0x13c04d,_0xcba9f0){if(_0x13c04d[_0x1a57('0x56')]['id']){delete _0x13c04d[_0x1a57('0x56')]['id'];}return db[_0x1a57('0x3a')][_0x1a57('0x54')]({'where':{'id':_0x13c04d[_0x1a57('0x53')]['id']}})['then'](handleEntityNotFound(_0xcba9f0,null))['then'](saveUpdates(_0x13c04d['body'],null))[_0x1a57('0x1e')](respondWithResult(_0xcba9f0,null))['catch'](handleError(_0xcba9f0,null));};exports[_0x1a57('0x57')]=function(_0x10c058,_0x408e67){return db[_0x1a57('0x3a')][_0x1a57('0x54')]({'where':{'id':_0x10c058[_0x1a57('0x53')]['id']}})[_0x1a57('0x1e')](handleEntityNotFound(_0x408e67,null))['then'](removeEntity(_0x408e67,null))['catch'](handleError(_0x408e67,null));};exports['getFields']=function(_0xc936a7,_0x562775,_0x212440){var _0x34efb6={};var _0x2db770={};var _0xdade74;var _0x2ca029;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0xc936a7[_0x1a57('0x53')]['id']}})[_0x1a57('0x1e')](handleEntityNotFound(_0x562775,null))[_0x1a57('0x1e')](function(_0x6544ec){if(_0x6544ec){_0xdade74=_0x6544ec;_0x2db770[_0x1a57('0x41')]=_[_0x1a57('0x3e')](db['ServicenowField']['rawAttributes']);_0x2db770[_0x1a57('0x3d')]=_[_0x1a57('0x3e')](_0xc936a7['query']);_0x2db770['filters']=_[_0x1a57('0x40')](_0x2db770[_0x1a57('0x41')],_0x2db770[_0x1a57('0x3d')]);_0x34efb6[_0x1a57('0x43')]=_[_0x1a57('0x40')](_0x2db770[_0x1a57('0x41')],qs[_0x1a57('0x42')](_0xc936a7['query']['fields']));_0x34efb6[_0x1a57('0x43')]=_0x34efb6[_0x1a57('0x43')][_0x1a57('0x44')]?_0x34efb6[_0x1a57('0x43')]:_0x2db770['model'];_0x34efb6[_0x1a57('0x46')]=qs[_0x1a57('0x47')](_0xc936a7[_0x1a57('0x3d')][_0x1a57('0x47')]);_0x34efb6[_0x1a57('0x49')]=qs['filters'](_['pick'](_0xc936a7['query'],_0x2db770[_0x1a57('0x3f')]));if(_0xc936a7[_0x1a57('0x3d')][_0x1a57('0x58')]){_0x34efb6[_0x1a57('0x49')]=_[_0x1a57('0x4a')](_0x34efb6[_0x1a57('0x49')],{'$or':_[_0x1a57('0x39')](_0x34efb6[_0x1a57('0x43')],function(_0x482508){var _0xe8ef76={};_0xe8ef76[_0x482508]={'$like':'%'+_0xc936a7[_0x1a57('0x3d')]['filter']+'%'};return _0xe8ef76;})});}_0x34efb6=_['merge']({},_0x34efb6,_0xc936a7[_0x1a57('0x4d')]);return _0xdade74['getFields'](_0x34efb6);}})[_0x1a57('0x1e')](function(_0x9379e3){if(_0x9379e3){_0x2ca029=_0x9379e3[_0x1a57('0x44')];if(!_0xc936a7[_0x1a57('0x3d')][_0x1a57('0x59')](_0x1a57('0x45'))){_0x34efb6[_0x1a57('0x2e')]=qs[_0x1a57('0x2e')](_0xc936a7['query'][_0x1a57('0x2e')]);_0x34efb6[_0x1a57('0x2d')]=qs['offset'](_0xc936a7[_0x1a57('0x3d')][_0x1a57('0x2d')]);}return _0xdade74[_0x1a57('0x5a')](_0x34efb6);}})['then'](function(_0x5c3eb8){if(_0x5c3eb8){return _0x5c3eb8?{'count':_0x2ca029,'rows':_0x5c3eb8}:null;}})[_0x1a57('0x1e')](respondWithResult(_0x562775,null))[_0x1a57('0x27')](handleError(_0x562775,null));};exports[_0x1a57('0x5b')]=function(_0x26b8dc,_0x59f1a7,_0x113375){var _0x37b824={};var _0x12d4cc={};var _0x246505;var _0x277367;return db['ServicenowConfiguration'][_0x1a57('0x5c')]({'where':{'id':_0x26b8dc[_0x1a57('0x53')]['id']}})[_0x1a57('0x1e')](handleEntityNotFound(_0x59f1a7,null))[_0x1a57('0x1e')](function(_0xd1e276){if(_0xd1e276){_0x246505=_0xd1e276;_0x12d4cc[_0x1a57('0x41')]=_[_0x1a57('0x3e')](db[_0x1a57('0x5d')][_0x1a57('0x3b')]);_0x12d4cc[_0x1a57('0x3d')]=_[_0x1a57('0x3e')](_0x26b8dc['query']);_0x12d4cc[_0x1a57('0x3f')]=_[_0x1a57('0x40')](_0x12d4cc['model'],_0x12d4cc[_0x1a57('0x3d')]);_0x37b824[_0x1a57('0x43')]=_['intersection'](_0x12d4cc[_0x1a57('0x41')],qs[_0x1a57('0x42')](_0x26b8dc[_0x1a57('0x3d')][_0x1a57('0x42')]));_0x37b824[_0x1a57('0x43')]=_0x37b824[_0x1a57('0x43')][_0x1a57('0x44')]?_0x37b824[_0x1a57('0x43')]:_0x12d4cc['model'];_0x37b824[_0x1a57('0x46')]=qs[_0x1a57('0x47')](_0x26b8dc['query'][_0x1a57('0x47')]);_0x37b824[_0x1a57('0x49')]=qs[_0x1a57('0x3f')](_[_0x1a57('0x48')](_0x26b8dc[_0x1a57('0x3d')],_0x12d4cc[_0x1a57('0x3f')]));if(_0x26b8dc[_0x1a57('0x3d')][_0x1a57('0x58')]){_0x37b824[_0x1a57('0x49')]=_['merge'](_0x37b824[_0x1a57('0x49')],{'$or':_[_0x1a57('0x39')](_0x37b824[_0x1a57('0x43')],function(_0x1e4d4e){var _0x12ae08={};_0x12ae08[_0x1e4d4e]={'$like':'%'+_0x26b8dc['query'][_0x1a57('0x58')]+'%'};return _0x12ae08;})});}_0x37b824=_[_0x1a57('0x4a')]({},_0x37b824,_0x26b8dc[_0x1a57('0x4d')]);return _0x246505[_0x1a57('0x5b')](_0x37b824);}})[_0x1a57('0x1e')](function(_0x3e5411){if(_0x3e5411){_0x277367=_0x3e5411[_0x1a57('0x44')];if(!_0x26b8dc[_0x1a57('0x3d')]['hasOwnProperty'](_0x1a57('0x45'))){_0x37b824[_0x1a57('0x2e')]=qs[_0x1a57('0x2e')](_0x26b8dc[_0x1a57('0x3d')]['limit']);_0x37b824['offset']=qs['offset'](_0x26b8dc['query']['offset']);}return _0x246505[_0x1a57('0x5b')](_0x37b824);}})[_0x1a57('0x1e')](function(_0x5e640b){if(_0x5e640b){return _0x5e640b?{'count':_0x277367,'rows':_0x5e640b}:null;}})[_0x1a57('0x1e')](respondWithResult(_0x59f1a7,null))[_0x1a57('0x27')](handleError(_0x59f1a7,null));};exports['getDescriptions']=function(_0x758985,_0x1fbcb1,_0x1783ef){var _0x9ceb94={};var _0x56ddf7={};var _0x444d60;var _0x1064a9;return db['ServicenowConfiguration'][_0x1a57('0x5c')]({'where':{'id':_0x758985[_0x1a57('0x53')]['id']}})[_0x1a57('0x1e')](handleEntityNotFound(_0x1fbcb1,null))[_0x1a57('0x1e')](function(_0x3bb254){if(_0x3bb254){_0x444d60=_0x3bb254;_0x56ddf7[_0x1a57('0x41')]=_[_0x1a57('0x3e')](db['ServicenowField'][_0x1a57('0x3b')]);_0x56ddf7['query']=_[_0x1a57('0x3e')](_0x758985[_0x1a57('0x3d')]);_0x56ddf7[_0x1a57('0x3f')]=_[_0x1a57('0x40')](_0x56ddf7['model'],_0x56ddf7[_0x1a57('0x3d')]);_0x9ceb94[_0x1a57('0x43')]=_[_0x1a57('0x40')](_0x56ddf7['model'],qs[_0x1a57('0x42')](_0x758985[_0x1a57('0x3d')][_0x1a57('0x42')]));_0x9ceb94['attributes']=_0x9ceb94[_0x1a57('0x43')][_0x1a57('0x44')]?_0x9ceb94[_0x1a57('0x43')]:_0x56ddf7[_0x1a57('0x41')];_0x9ceb94[_0x1a57('0x46')]=qs[_0x1a57('0x47')](_0x758985[_0x1a57('0x3d')][_0x1a57('0x47')]);_0x9ceb94[_0x1a57('0x49')]=qs[_0x1a57('0x3f')](_[_0x1a57('0x48')](_0x758985['query'],_0x56ddf7[_0x1a57('0x3f')]));if(_0x758985['query'][_0x1a57('0x58')]){_0x9ceb94['where']=_['merge'](_0x9ceb94['where'],{'$or':_['map'](_0x9ceb94[_0x1a57('0x43')],function(_0x9bb457){var _0x361c20={};_0x361c20[_0x9bb457]={'$like':'%'+_0x758985['query'][_0x1a57('0x58')]+'%'};return _0x361c20;})});}_0x9ceb94=_['merge']({},_0x9ceb94,_0x758985[_0x1a57('0x4d')]);return _0x444d60[_0x1a57('0x5e')](_0x9ceb94);}})[_0x1a57('0x1e')](function(_0x597c28){if(_0x597c28){_0x1064a9=_0x597c28[_0x1a57('0x44')];if(!_0x758985[_0x1a57('0x3d')]['hasOwnProperty']('nolimit')){_0x9ceb94[_0x1a57('0x2e')]=qs['limit'](_0x758985[_0x1a57('0x3d')][_0x1a57('0x2e')]);_0x9ceb94['offset']=qs[_0x1a57('0x2d')](_0x758985[_0x1a57('0x3d')]['offset']);}return _0x444d60[_0x1a57('0x5e')](_0x9ceb94);}})[_0x1a57('0x1e')](function(_0x5d5982){if(_0x5d5982){return _0x5d5982?{'count':_0x1064a9,'rows':_0x5d5982}:null;}})['then'](respondWithResult(_0x1fbcb1,null))[_0x1a57('0x27')](handleError(_0x1fbcb1,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 66e34a4..79da5e2 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 _0x9b31=['int_servicenow_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x38a9cb,_0xfd8b2b){var _0xfa7687=function(_0x8b1b6){while(--_0x8b1b6){_0x38a9cb['push'](_0x38a9cb['shift']());}};_0xfa7687(++_0xfd8b2b);}(_0x9b31,0x1c4));var _0x19b3=function(_0x21342a,_0x4cf68f){_0x21342a=_0x21342a-0x0;var _0x22a117=_0x9b31[_0x21342a];return _0x22a117;};'use strict';var _=require(_0x19b3('0x0'));var util=require(_0x19b3('0x1'));var logger=require(_0x19b3('0x2'))('api');var moment=require(_0x19b3('0x3'));var BPromise=require(_0x19b3('0x4'));var rp=require(_0x19b3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x19b3('0x6'));var config=require(_0x19b3('0x7'));var attributes=require('./intServicenowConfiguration.attributes');module[_0x19b3('0x8')]=function(_0x5d379d,_0x2f7b2e){return _0x5d379d[_0x19b3('0x9')]('ServicenowConfiguration',attributes,{'tableName':_0x19b3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa46e=['lodash','util','api','moment','bluebird','request-promise','rimraf','exports','define','ServicenowConfiguration'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0xa46e,0x19a));var _0xea46=function(_0x5e42a7,_0x3eba35){_0x5e42a7=_0x5e42a7-0x0;var _0x36d21b=_0xa46e[_0x5e42a7];return _0x36d21b;};'use strict';var _=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var logger=require('../../config/logger')(_0xea46('0x2'));var moment=require(_0xea46('0x3'));var BPromise=require(_0xea46('0x4'));var rp=require(_0xea46('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xea46('0x6'));var config=require('../../config/environment');var attributes=require('./intServicenowConfiguration.attributes');module[_0xea46('0x7')]=function(_0x3b89dc,_0x2ea7fb){return _0x3b89dc[_0xea46('0x8')](_0xea46('0x9'),attributes,{'tableName':'int_servicenow_configurations','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 febc370..39bfa00 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 _0xc5fd=['debug','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x5c7812,_0x50d92d){var _0x2ed4a4=function(_0xf2cfe5){while(--_0xf2cfe5){_0x5c7812['push'](_0x5c7812['shift']());}};_0x2ed4a4(++_0x50d92d);}(_0xc5fd,0x160));var _0xdc5f=function(_0x301dab,_0x38050a){_0x301dab=_0x301dab-0x0;var _0x2500a2=_0xc5fd[_0x301dab];return _0x2500a2;};'use strict';var _=require(_0xdc5f('0x0'));var util=require(_0xdc5f('0x1'));var moment=require(_0xdc5f('0x2'));var BPromise=require(_0xdc5f('0x3'));var rs=require(_0xdc5f('0x4'));var fs=require('fs');var Redis=require(_0xdc5f('0x5'));var db=require(_0xdc5f('0x6'))['db'];var utils=require(_0xdc5f('0x7'));var logger=require('../../config/logger')(_0xdc5f('0x8'));var config=require(_0xdc5f('0x9'));var jayson=require(_0xdc5f('0xa'));var client=jayson[_0xdc5f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d2649,_0x59854e,_0x5b5014){return new BPromise(function(_0x183cf4,_0xdeb8dd){return client[_0xdc5f('0xc')](_0x5d2649,_0x5b5014)[_0xdc5f('0xd')](function(_0x494aa){logger['info'](_0xdc5f('0xe'),_0x59854e,_0xdc5f('0xf'));logger[_0xdc5f('0x10')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x59854e,'request\x20sent',JSON[_0xdc5f('0x11')](_0x494aa));if(_0x494aa['error']){if(_0x494aa[_0xdc5f('0x12')][_0xdc5f('0x13')]===0x1f4){logger['error'](_0xdc5f('0xe'),_0x59854e,_0x494aa[_0xdc5f('0x12')][_0xdc5f('0x14')]);return _0xdeb8dd(_0x494aa[_0xdc5f('0x12')][_0xdc5f('0x14')]);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x59854e,_0x494aa[_0xdc5f('0x12')]['message']);return _0x183cf4(_0x494aa[_0xdc5f('0x12')]['message']);}else{logger[_0xdc5f('0x15')](_0xdc5f('0xe'),_0x59854e,_0xdc5f('0xf'));_0x183cf4(_0x494aa[_0xdc5f('0x16')][_0xdc5f('0x14')]);}})['catch'](function(_0x51a4a4){logger[_0xdc5f('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x59854e,_0x51a4a4);_0xdeb8dd(_0x51a4a4);});});} \ No newline at end of file +var _0x7ee7=['client','http','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0x510ccc,_0x3b997d){var _0x32c374=function(_0x970e92){while(--_0x970e92){_0x510ccc['push'](_0x510ccc['shift']());}};_0x32c374(++_0x3b997d);}(_0x7ee7,0x138));var _0x77ee=function(_0x4372eb,_0xc67b0a){_0x4372eb=_0x4372eb-0x0;var _0x28c5f1=_0x7ee7[_0x4372eb];return _0x28c5f1;};'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(_0x77ee('0x6'))['db'];var utils=require(_0x77ee('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x77ee('0x8'));var jayson=require(_0x77ee('0x9'));var client=jayson[_0x77ee('0xa')][_0x77ee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbbd4e2,_0x267f18,_0x21e872){return new BPromise(function(_0x4b1c0c,_0x47867d){return client['request'](_0xbbd4e2,_0x21e872)[_0x77ee('0xc')](function(_0x1edb75){logger[_0x77ee('0xd')](_0x77ee('0xe'),_0x267f18,_0x77ee('0xf'));logger[_0x77ee('0x10')](_0x77ee('0x11'),_0x267f18,'request\x20sent',JSON[_0x77ee('0x12')](_0x1edb75));if(_0x1edb75['error']){if(_0x1edb75[_0x77ee('0x13')][_0x77ee('0x14')]===0x1f4){logger[_0x77ee('0x13')](_0x77ee('0xe'),_0x267f18,_0x1edb75['error'][_0x77ee('0x15')]);return _0x47867d(_0x1edb75['error'][_0x77ee('0x15')]);}logger[_0x77ee('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0x267f18,_0x1edb75[_0x77ee('0x13')][_0x77ee('0x15')]);return _0x4b1c0c(_0x1edb75[_0x77ee('0x13')][_0x77ee('0x15')]);}else{logger['info'](_0x77ee('0xe'),_0x267f18,_0x77ee('0xf'));_0x4b1c0c(_0x1edb75[_0x77ee('0x16')][_0x77ee('0x15')]);}})['catch'](function(_0xbb7429){logger[_0x77ee('0x13')](_0x77ee('0xe'),_0x267f18,_0xbb7429);_0x47867d(_0xbb7429);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 8629d27..952a434 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 _0x1d87=['put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x1d87,0x11c));var _0x71d8=function(_0x146a85,_0x529b52){_0x146a85=_0x146a85-0x0;var _0x1b59bf=_0x1d87[_0x146a85];return _0x1b59bf;};'use strict';var multer=require(_0x71d8('0x0'));var util=require(_0x71d8('0x1'));var path=require(_0x71d8('0x2'));var timeout=require(_0x71d8('0x3'));var express=require(_0x71d8('0x4'));var router=express[_0x71d8('0x5')]();var auth=require(_0x71d8('0x6'));var interaction=require(_0x71d8('0x7'));var config=require(_0x71d8('0x8'));var controller=require('./intServicenowField.controller');router[_0x71d8('0x9')]('/',auth[_0x71d8('0xa')](),controller[_0x71d8('0xb')]);router[_0x71d8('0x9')](_0x71d8('0xc'),auth[_0x71d8('0xa')](),controller[_0x71d8('0xd')]);router[_0x71d8('0xe')]('/',auth['isAuthenticated'](),controller[_0x71d8('0xf')]);router[_0x71d8('0x10')](_0x71d8('0xc'),auth['isAuthenticated'](),controller[_0x71d8('0x11')]);router['delete'](_0x71d8('0xc'),auth[_0x71d8('0xa')](),controller[_0x71d8('0x12')]);module[_0x71d8('0x13')]=router; \ No newline at end of file +var _0x915d=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','exports','multer','util'];(function(_0x2e7a43,_0x3b3df4){var _0x52e9e1=function(_0x2c08cf){while(--_0x2c08cf){_0x2e7a43['push'](_0x2e7a43['shift']());}};_0x52e9e1(++_0x3b3df4);}(_0x915d,0xcf));var _0xd915=function(_0x2fd036,_0x2d89ad){_0x2fd036=_0x2fd036-0x0;var _0x58d512=_0x915d[_0x2fd036];return _0x58d512;};'use strict';var multer=require(_0xd915('0x0'));var util=require(_0xd915('0x1'));var path=require(_0xd915('0x2'));var timeout=require(_0xd915('0x3'));var express=require('express');var router=express[_0xd915('0x4')]();var auth=require(_0xd915('0x5'));var interaction=require(_0xd915('0x6'));var config=require(_0xd915('0x7'));var controller=require(_0xd915('0x8'));router[_0xd915('0x9')]('/',auth[_0xd915('0xa')](),controller[_0xd915('0xb')]);router[_0xd915('0x9')](_0xd915('0xc'),auth[_0xd915('0xa')](),controller[_0xd915('0xd')]);router[_0xd915('0xe')]('/',auth[_0xd915('0xa')](),controller[_0xd915('0xf')]);router['put'](_0xd915('0xc'),auth[_0xd915('0xa')](),controller[_0xd915('0x10')]);router[_0xd915('0x11')](_0xd915('0xc'),auth[_0xd915('0xa')](),controller['destroy']);module[_0xd915('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 51d701f..67fee16 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 _0x5fcd=['BOOLEAN','sequelize','exports','string','keyValue','STRING','ENUM'];(function(_0x915908,_0x333bc8){var _0x26a3ea=function(_0x4def06){while(--_0x4def06){_0x915908['push'](_0x915908['shift']());}};_0x26a3ea(++_0x333bc8);}(_0x5fcd,0x189));var _0xd5fc=function(_0x517a09,_0x38885c){_0x517a09=_0x517a09-0x0;var _0x3eed15=_0x5fcd[_0x517a09];return _0x3eed15;};'use strict';var Sequelize=require(_0xd5fc('0x0'));module[_0xd5fc('0x1')]={'type':{'type':Sequelize['ENUM'](_0xd5fc('0x2'),'variable','customVariable',_0xd5fc('0x3')),'defaultValue':_0xd5fc('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xd5fc('0x4')]},'keyType':{'type':Sequelize[_0xd5fc('0x5')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0xd5fc('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xd5fc('0x4')]},'customField':{'type':Sequelize[_0xd5fc('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd5fc('0x4')]}}; \ No newline at end of file +var _0xe81b=['variable','customVariable','keyValue','STRING','ENUM','BOOLEAN','sequelize','exports','string'];(function(_0x20dea6,_0xcc3d12){var _0x14955b=function(_0x3bdc83){while(--_0x3bdc83){_0x20dea6['push'](_0x20dea6['shift']());}};_0x14955b(++_0xcc3d12);}(_0xe81b,0xde));var _0xbe81=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0xe81b[_0x2aea9e];return _0x430b92;};'use strict';var Sequelize=require(_0xbe81('0x0'));module[_0xbe81('0x1')]={'type':{'type':Sequelize['ENUM'](_0xbe81('0x2'),_0xbe81('0x3'),_0xbe81('0x4'),_0xbe81('0x5')),'defaultValue':_0xbe81('0x2')},'content':{'type':Sequelize[_0xbe81('0x6')]},'key':{'type':Sequelize[_0xbe81('0x6')]},'keyType':{'type':Sequelize[_0xbe81('0x7')]('string','variable',_0xbe81('0x4'))},'keyContent':{'type':Sequelize[_0xbe81('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xbe81('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index b873a73..40bd76a 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(_0x4d8f3b,_0x56480c){var _0x5535d6=function(_0x21480e){while(--_0x21480e){_0x4d8f3b['push'](_0x4d8f3b['shift']());}};_0x5535d6(++_0x56480c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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(_0x34cbdb,_0xa53f6){var _0x2fc43d=function(_0x45068b){while(--_0x45068b){_0x34cbdb['push'](_0x34cbdb['shift']());}};_0x2fc43d(++_0xa53f6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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 fe6e85a..bf05a3e 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 _0xf440=['../../config/environment','./intServicenowField.attributes','exports','define','int_servicenow_fields','idField','FieldId','util','../../config/logger','api','bluebird','path'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0xf440,0x11b));var _0x0f44=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xf440[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require(_0x0f44('0x0'));var logger=require(_0x0f44('0x1'))(_0x0f44('0x2'));var moment=require('moment');var BPromise=require(_0x0f44('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0f44('0x4'));var rimraf=require('rimraf');var config=require(_0x0f44('0x5'));var attributes=require(_0x0f44('0x6'));module[_0x0f44('0x7')]=function(_0x398723,_0x162152){return _0x398723[_0x0f44('0x8')]('ServicenowField',attributes,{'tableName':_0x0f44('0x9'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x0f44('0xa'),_0x0f44('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4888=['exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4888,0x9d));var _0x8488=function(_0x5c65ee,_0x57b017){_0x5c65ee=_0x5c65ee-0x0;var _0x4b8689=_0x4888[_0x5c65ee];return _0x4b8689;};'use strict';var _=require('lodash');var util=require(_0x8488('0x0'));var logger=require(_0x8488('0x1'))('api');var moment=require(_0x8488('0x2'));var BPromise=require(_0x8488('0x3'));var rp=require(_0x8488('0x4'));var fs=require('fs');var path=require(_0x8488('0x5'));var rimraf=require(_0x8488('0x6'));var config=require(_0x8488('0x7'));var attributes=require('./intServicenowField.attributes');module[_0x8488('0x8')]=function(_0x4fc9c6,_0x367201){return _0x4fc9c6[_0x8488('0x9')](_0x8488('0xa'),attributes,{'tableName':_0x8488('0xb'),'paranoid':![],'indexes':[{'name':_0x8488('0xc'),'fields':[_0x8488('0xd'),_0x8488('0xe')],'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 f6e051e..a4f93bb 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 _0x88c0=['then','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','ServicenowField,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x589dd5,_0xbfebb7){var _0x978d4a=function(_0x1f1428){while(--_0x1f1428){_0x589dd5['push'](_0x589dd5['shift']());}};_0x978d4a(++_0xbfebb7);}(_0x88c0,0xd0));var _0x088c=function(_0x22947d,_0x2177ca){_0x22947d=_0x22947d-0x0;var _0x489b7b=_0x88c0[_0x22947d];return _0x489b7b;};'use strict';var _=require(_0x088c('0x0'));var util=require(_0x088c('0x1'));var moment=require(_0x088c('0x2'));var BPromise=require(_0x088c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x088c('0x4'));var db=require(_0x088c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x088c('0x6'))(_0x088c('0x7'));var config=require(_0x088c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x088c('0x9')][_0x088c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14a452,_0x1cda65,_0x51f2da){return new BPromise(function(_0x4462c2,_0x5d069c){return client[_0x088c('0xb')](_0x14a452,_0x51f2da)[_0x088c('0xc')](function(_0x29c36a){logger['info']('ServicenowField,\x20%s,\x20%s',_0x1cda65,'request\x20sent');logger['debug'](_0x088c('0xd'),_0x1cda65,_0x088c('0xe'),JSON['stringify'](_0x29c36a));if(_0x29c36a[_0x088c('0xf')]){if(_0x29c36a[_0x088c('0xf')][_0x088c('0x10')]===0x1f4){logger[_0x088c('0xf')]('ServicenowField,\x20%s,\x20%s',_0x1cda65,_0x29c36a['error'][_0x088c('0x11')]);return _0x5d069c(_0x29c36a['error']['message']);}logger[_0x088c('0xf')](_0x088c('0x12'),_0x1cda65,_0x29c36a[_0x088c('0xf')][_0x088c('0x11')]);return _0x4462c2(_0x29c36a[_0x088c('0xf')][_0x088c('0x11')]);}else{logger['info'](_0x088c('0x12'),_0x1cda65,_0x088c('0xe'));_0x4462c2(_0x29c36a['result'][_0x088c('0x11')]);}})[_0x088c('0x13')](function(_0x144d01){logger[_0x088c('0xf')](_0x088c('0x12'),_0x1cda65,_0x144d01);_0x5d069c(_0x144d01);});});} \ No newline at end of file +var _0xa3c7=['error','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4148e6,_0x5a9ae1){var _0x93bd1f=function(_0x4ec91f){while(--_0x4ec91f){_0x4148e6['push'](_0x4148e6['shift']());}};_0x93bd1f(++_0x5a9ae1);}(_0xa3c7,0x123));var _0x7a3c=function(_0xd5f137,_0x4c77ff){_0xd5f137=_0xd5f137-0x0;var _0xbb3f7f=_0xa3c7[_0xd5f137];return _0xbb3f7f;};'use strict';var _=require(_0x7a3c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7a3c('0x1'));var rs=require(_0x7a3c('0x2'));var fs=require('fs');var Redis=require(_0x7a3c('0x3'));var db=require(_0x7a3c('0x4'))['db'];var utils=require(_0x7a3c('0x5'));var logger=require(_0x7a3c('0x6'))(_0x7a3c('0x7'));var config=require(_0x7a3c('0x8'));var jayson=require(_0x7a3c('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x127268,_0x2cf059,_0x397c3c){return new BPromise(function(_0x4bfd20,_0x36225a){return client[_0x7a3c('0xa')](_0x127268,_0x397c3c)[_0x7a3c('0xb')](function(_0x51e3f5){logger[_0x7a3c('0xc')]('ServicenowField,\x20%s,\x20%s',_0x2cf059,_0x7a3c('0xd'));logger[_0x7a3c('0xe')](_0x7a3c('0xf'),_0x2cf059,_0x7a3c('0xd'),JSON[_0x7a3c('0x10')](_0x51e3f5));if(_0x51e3f5[_0x7a3c('0x11')]){if(_0x51e3f5['error']['code']===0x1f4){logger[_0x7a3c('0x11')](_0x7a3c('0x12'),_0x2cf059,_0x51e3f5[_0x7a3c('0x11')]['message']);return _0x36225a(_0x51e3f5[_0x7a3c('0x11')][_0x7a3c('0x13')]);}logger[_0x7a3c('0x11')]('ServicenowField,\x20%s,\x20%s',_0x2cf059,_0x51e3f5[_0x7a3c('0x11')][_0x7a3c('0x13')]);return _0x4bfd20(_0x51e3f5[_0x7a3c('0x11')][_0x7a3c('0x13')]);}else{logger[_0x7a3c('0xc')](_0x7a3c('0x12'),_0x2cf059,'request\x20sent');_0x4bfd20(_0x51e3f5[_0x7a3c('0x14')][_0x7a3c('0x13')]);}})[_0x7a3c('0x15')](function(_0x2bf176){logger[_0x7a3c('0x11')](_0x7a3c('0x12'),_0x2cf059,_0x2bf176);_0x36225a(_0x2bf176);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index ede095b..0f409dc 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 _0x7811=['isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','delete','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get'];(function(_0x29d74f,_0x524926){var _0x49e8f2=function(_0x3a9abd){while(--_0x3a9abd){_0x29d74f['push'](_0x29d74f['shift']());}};_0x49e8f2(++_0x524926);}(_0x7811,0x15f));var _0x1781=function(_0x16fdeb,_0x46d28e){_0x16fdeb=_0x16fdeb-0x0;var _0x1ea06f=_0x7811[_0x16fdeb];return _0x1ea06f;};'use strict';var multer=require(_0x1781('0x0'));var util=require('util');var path=require(_0x1781('0x1'));var timeout=require(_0x1781('0x2'));var express=require(_0x1781('0x3'));var router=express[_0x1781('0x4')]();var auth=require(_0x1781('0x5'));var interaction=require(_0x1781('0x6'));var config=require(_0x1781('0x7'));var controller=require(_0x1781('0x8'));router[_0x1781('0x9')]('/',auth[_0x1781('0xa')](),controller['index']);router['get'](_0x1781('0xb'),auth[_0x1781('0xa')](),controller[_0x1781('0xc')]);router['get'](_0x1781('0xd'),auth[_0x1781('0xa')](),controller[_0x1781('0xe')]);router[_0x1781('0x9')](_0x1781('0xf'),auth[_0x1781('0xa')](),controller['getFields']);router[_0x1781('0x10')]('/',auth[_0x1781('0xa')](),controller['create']);router[_0x1781('0x10')](_0x1781('0xd'),auth['isAuthenticated'](),controller[_0x1781('0x11')]);router['put'](_0x1781('0xb'),auth[_0x1781('0xa')](),controller['update']);router[_0x1781('0x12')](_0x1781('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb432=['Router','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','/:id','update','delete','exports','multer','util'];(function(_0x367fb9,_0x10abe1){var _0x40d927=function(_0x32c2e7){while(--_0x32c2e7){_0x367fb9['push'](_0x367fb9['shift']());}};_0x40d927(++_0x10abe1);}(_0xb432,0x17a));var _0x2b43=function(_0x1cbd1f,_0x2f2340){_0x1cbd1f=_0x1cbd1f-0x0;var _0x24c434=_0xb432[_0x1cbd1f];return _0x24c434;};'use strict';var multer=require(_0x2b43('0x0'));var util=require(_0x2b43('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2b43('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x2b43('0x3'));var config=require(_0x2b43('0x4'));var controller=require('./intSugarcrmAccount.controller');router[_0x2b43('0x5')]('/',auth['isAuthenticated'](),controller[_0x2b43('0x6')]);router[_0x2b43('0x5')]('/:id',auth[_0x2b43('0x7')](),controller[_0x2b43('0x8')]);router['get'](_0x2b43('0x9'),auth[_0x2b43('0x7')](),controller[_0x2b43('0xa')]);router[_0x2b43('0x5')](_0x2b43('0xb'),auth[_0x2b43('0x7')](),controller[_0x2b43('0xc')]);router['post']('/',auth[_0x2b43('0x7')](),controller['create']);router[_0x2b43('0xd')](_0x2b43('0x9'),auth[_0x2b43('0x7')](),controller[_0x2b43('0xe')]);router['put'](_0x2b43('0xf'),auth[_0x2b43('0x7')](),controller[_0x2b43('0x10')]);router[_0x2b43('0x11')](_0x2b43('0xf'),auth[_0x2b43('0x7')](),controller['destroy']);module[_0x2b43('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 2d2f5c3..ff85406 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 _0x8d93=['exports','STRING','remoteUri'];(function(_0x403916,_0x374658){var _0x5baf40=function(_0x2b5d0b){while(--_0x2b5d0b){_0x403916['push'](_0x403916['shift']());}};_0x5baf40(++_0x374658);}(_0x8d93,0x96));var _0x38d9=function(_0x266098,_0x10fbbb){_0x266098=_0x266098-0x0;var _0x492415=_0x8d93[_0x266098];return _0x492415;};'use strict';var Sequelize=require('sequelize');module[_0x38d9('0x0')]={'name':{'type':Sequelize[_0x38d9('0x1')]},'description':{'type':Sequelize[_0x38d9('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize[_0x38d9('0x1')]},'remoteUri':{'type':Sequelize[_0x38d9('0x1')],'unique':_0x38d9('0x2')},'serverUrl':{'type':Sequelize[_0x38d9('0x1')]}}; \ No newline at end of file +var _0xfd87=['STRING','username','remoteUri','sequelize','exports'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xfd87,0x80));var _0x7fd8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd87[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7fd8('0x0'));module[_0x7fd8('0x1')]={'name':{'type':Sequelize[_0x7fd8('0x2')]},'description':{'type':Sequelize[_0x7fd8('0x2')]},'username':{'type':Sequelize[_0x7fd8('0x2')],'unique':_0x7fd8('0x3')},'password':{'type':Sequelize[_0x7fd8('0x2')]},'remoteUri':{'type':Sequelize[_0x7fd8('0x2')],'unique':_0x7fd8('0x4')},'serverUrl':{'type':Sequelize[_0x7fd8('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 867e822..a806be2 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 _0x26d6=['username','password','remoteUri','substring','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','Calls','values','remove','includes','label','endsWith','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','update','destroy','stack','name','index','map','SugarcrmAccount','rawAttributes','type','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','params','fields','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','nolimit','addConfiguration','getSubjects','Descriptions','getDescriptions','channel','Subjects','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','direction'];(function(_0x481e9c,_0x500606){var _0x2c4ff0=function(_0x6cbed9){while(--_0x6cbed9){_0x481e9c['push'](_0x481e9c['shift']());}};_0x2c4ff0(++_0x500606);}(_0x26d6,0x1ac));var _0x626d=function(_0x5c609f,_0x121078){_0x5c609f=_0x5c609f-0x0;var _0x3e934d=_0x26d6[_0x5c609f];return _0x3e934d;};'use strict';var pdf=require(_0x626d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x626d('0x1'));var zipdir=require(_0x626d('0x2'));var jsonpatch=require(_0x626d('0x3'));var rp=require(_0x626d('0x4'));var moment=require('moment');var BPromise=require(_0x626d('0x5'));var Mustache=require(_0x626d('0x6'));var util=require(_0x626d('0x7'));var path=require(_0x626d('0x8'));var sox=require(_0x626d('0x9'));var csv=require('to-csv');var ejs=require(_0x626d('0xa'));var fs=require('fs');var _=require(_0x626d('0xb'));var squel=require(_0x626d('0xc'));var crypto=require(_0x626d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x626d('0xe'));var toCsv=require(_0x626d('0xf'));var querystring=require(_0x626d('0x10'));var Papa=require(_0x626d('0x11'));var Redis=require(_0x626d('0x12'));var authService=require(_0x626d('0x13'));var qs=require(_0x626d('0x14'));var as=require(_0x626d('0x15'));var hardwareService=require(_0x626d('0x16'));var logger=require(_0x626d('0x17'))(_0x626d('0x18'));var utils=require(_0x626d('0x19'));var config=require('../../config/environment');var db=require(_0x626d('0x1a'))['db'];var integrations=require(_0x626d('0x1b'));var jayson=require(_0x626d('0x1c'));var client=jayson[_0x626d('0x1d')]['http']({'port':0x232a});function checkPasswordPattern(_0x177a8d,_0x1eeff0,_0x45626a){if(_0x45626a){var _0x371681=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x371681[_0x626d('0x1e')](_0x1eeff0)){return _0x177a8d;}else{throw new db[(_0x626d('0x1f'))][(_0x626d('0x20'))](_0x626d('0x21'));}}else{return _0x177a8d;}}function respondWithRpcPromise(_0x5a099b,_0x2ab5db,_0x299c62,_0x2fcacb){return new BPromise(function(_0x161794,_0x222e03){var _0x3ea5cb=_0x2fcacb||client;return _0x3ea5cb[_0x626d('0x22')](_0x5a099b,_0x299c62)[_0x626d('0x23')](function(_0x492c09){logger[_0x626d('0x24')](_0x626d('0x25'),_0x2ab5db,_0x626d('0x26'));logger[_0x626d('0x27')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x2ab5db,_0x626d('0x26'),JSON['stringify'](_0x492c09));if(_0x492c09[_0x626d('0x28')]){if(_0x492c09[_0x626d('0x28')][_0x626d('0x29')]===0x1f4){logger[_0x626d('0x28')](_0x626d('0x25'),_0x2ab5db,_0x492c09[_0x626d('0x28')][_0x626d('0x2a')]);return _0x222e03(_0x492c09[_0x626d('0x28')][_0x626d('0x2a')]);}logger[_0x626d('0x28')]('SugarcrmAccount,\x20%s,\x20%s',_0x2ab5db,_0x492c09[_0x626d('0x28')][_0x626d('0x2a')]);return _0x161794(_0x492c09[_0x626d('0x28')][_0x626d('0x2a')]);}else{logger['info'](_0x626d('0x25'),_0x2ab5db,_0x626d('0x26'));_0x161794(_0x492c09[_0x626d('0x2b')][_0x626d('0x2a')]);}})[_0x626d('0x2c')](function(_0xbaecd5){logger[_0x626d('0x28')]('SugarcrmAccount,\x20%s,\x20%s',_0x2ab5db,_0xbaecd5);_0x222e03(_0xbaecd5);});});}function respondWithStatusCode(_0x519b69,_0xd21ea1){_0xd21ea1=_0xd21ea1||0xcc;return function(_0x319eab){if(_0x319eab){return _0x519b69[_0x626d('0x2d')](_0xd21ea1);}return _0x519b69[_0x626d('0x2e')](_0xd21ea1)[_0x626d('0x2f')]();};}function respondWithResult(_0x4cd4ab,_0x23e97a){_0x23e97a=_0x23e97a||0xc8;return function(_0x3fd58b){if(_0x3fd58b){return _0x4cd4ab['status'](_0x23e97a)[_0x626d('0x30')](_0x3fd58b);}};}function respondWithFilteredResult(_0x3d5369,_0x51d261){return function(_0x283853){if(_0x283853){var _0x46f2ba=_0x283853[_0x626d('0x31')],_0x484804=_0x51d261[_0x626d('0x32')],_0x571441=_0x51d261['offset']+_0x51d261[_0x626d('0x33')],_0x1568c5;if(_0x571441>=_0x46f2ba){_0x571441=_0x46f2ba;_0x1568c5=0xc8;}else{_0x1568c5=0xce;}_0x3d5369[_0x626d('0x2e')](_0x1568c5);return _0x3d5369[_0x626d('0x34')](_0x626d('0x35'),_0x484804+'-'+_0x571441+'/'+_0x46f2ba)['json'](_0x283853);}return null;};}function patchUpdates(_0x16764e){return function(_0x394e3d){try{jsonpatch['apply'](_0x394e3d,_0x16764e,!![]);}catch(_0x49ad21){return BPromise['reject'](_0x49ad21);}return _0x394e3d['save']();};}function saveUpdates(_0x4154b0,_0x2ba358){return function(_0x1e693c){if(_0x1e693c){return _0x1e693c[_0x626d('0x36')](_0x4154b0)['then'](function(_0x53fcc9){return _0x53fcc9;});}return null;};}function removeEntity(_0x40f93d,_0xd18b32){return function(_0x1801bf){if(_0x1801bf){return _0x1801bf[_0x626d('0x37')]()[_0x626d('0x23')](function(){_0x40f93d[_0x626d('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc66fdc,_0xe92395){return function(_0x2077cd){if(!_0x2077cd){_0xc66fdc[_0x626d('0x2d')](0x194);}return _0x2077cd;};}function handleError(_0x2aa87b,_0x3f3794){_0x3f3794=_0x3f3794||0x1f4;return function(_0x12ea7a){logger['error'](_0x12ea7a[_0x626d('0x38')]);if(_0x12ea7a[_0x626d('0x39')]){delete _0x12ea7a[_0x626d('0x39')];}_0x2aa87b[_0x626d('0x2e')](_0x3f3794)['send'](_0x12ea7a);};}exports[_0x626d('0x3a')]=function(_0x4e9b50,_0x572b62){var _0x337585={},_0x3c6774={},_0x234f2b={'count':0x0,'rows':[]};var _0x4724b2=_[_0x626d('0x3b')](db[_0x626d('0x3c')][_0x626d('0x3d')],function(_0x4aa992){return{'name':_0x4aa992['fieldName'],'type':_0x4aa992[_0x626d('0x3e')]['key']};});_0x3c6774[_0x626d('0x3f')]=_['map'](_0x4724b2,_0x626d('0x39'));_0x3c6774[_0x626d('0x40')]=_[_0x626d('0x41')](_0x4e9b50[_0x626d('0x40')]);_0x3c6774[_0x626d('0x42')]=_['intersection'](_0x3c6774['model'],_0x3c6774['query']);_0x337585[_0x626d('0x43')]=_[_0x626d('0x44')](_0x3c6774[_0x626d('0x3f')],qs['fields'](_0x4e9b50[_0x626d('0x40')]['fields']));_0x337585[_0x626d('0x43')]=_0x337585[_0x626d('0x43')][_0x626d('0x45')]?_0x337585[_0x626d('0x43')]:_0x3c6774[_0x626d('0x3f')];if(!_0x4e9b50[_0x626d('0x40')][_0x626d('0x46')]('nolimit')){_0x337585[_0x626d('0x33')]=qs[_0x626d('0x33')](_0x4e9b50[_0x626d('0x40')][_0x626d('0x33')]);_0x337585[_0x626d('0x32')]=qs[_0x626d('0x32')](_0x4e9b50['query'][_0x626d('0x32')]);}_0x337585[_0x626d('0x47')]=qs[_0x626d('0x48')](_0x4e9b50[_0x626d('0x40')][_0x626d('0x48')]);_0x337585[_0x626d('0x49')]=qs[_0x626d('0x42')](_[_0x626d('0x4a')](_0x4e9b50[_0x626d('0x40')],_0x3c6774[_0x626d('0x42')]),_0x4724b2);if(_0x4e9b50['query'][_0x626d('0x4b')]){_0x337585[_0x626d('0x49')]=_[_0x626d('0x4c')](_0x337585[_0x626d('0x49')],{'$or':_[_0x626d('0x3b')](_0x4724b2,function(_0x21028b){if(_0x21028b[_0x626d('0x3e')]!=='VIRTUAL'){var _0xf7fd22={};_0xf7fd22[_0x21028b[_0x626d('0x39')]]={'$like':'%'+_0x4e9b50[_0x626d('0x40')][_0x626d('0x4b')]+'%'};return _0xf7fd22;}})});}_0x337585=_['merge']({},_0x337585,_0x4e9b50[_0x626d('0x4d')]);var _0x1a8c84={'where':_0x337585[_0x626d('0x49')]};return db['SugarcrmAccount']['count'](_0x1a8c84)[_0x626d('0x23')](function(_0x474474){_0x234f2b[_0x626d('0x31')]=_0x474474;if(_0x4e9b50['query'][_0x626d('0x4e')]){_0x337585[_0x626d('0x4f')]=[{'all':!![]}];}return db[_0x626d('0x3c')][_0x626d('0x50')](_0x337585);})['then'](function(_0x1fdf71){_0x234f2b[_0x626d('0x51')]=_0x1fdf71;return _0x234f2b;})[_0x626d('0x23')](respondWithFilteredResult(_0x572b62,_0x337585))['catch'](handleError(_0x572b62,null));};exports['show']=function(_0x15d6ff,_0x250e7d){var _0x2321bc={'raw':![],'where':{'id':_0x15d6ff[_0x626d('0x52')]['id']}},_0x167dd1={};_0x167dd1[_0x626d('0x3f')]=_[_0x626d('0x41')](db[_0x626d('0x3c')][_0x626d('0x3d')]);_0x167dd1[_0x626d('0x40')]=_[_0x626d('0x41')](_0x15d6ff[_0x626d('0x40')]);_0x167dd1['filters']=_['intersection'](_0x167dd1[_0x626d('0x3f')],_0x167dd1[_0x626d('0x40')]);_0x2321bc['attributes']=_[_0x626d('0x44')](_0x167dd1[_0x626d('0x3f')],qs[_0x626d('0x53')](_0x15d6ff[_0x626d('0x40')][_0x626d('0x53')]));_0x2321bc[_0x626d('0x43')]=_0x2321bc[_0x626d('0x43')]['length']?_0x2321bc[_0x626d('0x43')]:_0x167dd1['model'];if(_0x15d6ff[_0x626d('0x40')][_0x626d('0x4e')]){_0x2321bc[_0x626d('0x4f')]=[{'all':!![]}];}_0x2321bc=_[_0x626d('0x4c')]({},_0x2321bc,_0x15d6ff[_0x626d('0x4d')]);return db[_0x626d('0x3c')][_0x626d('0x54')](_0x2321bc)[_0x626d('0x23')](handleEntityNotFound(_0x250e7d,null))[_0x626d('0x23')](respondWithResult(_0x250e7d,null))[_0x626d('0x2c')](handleError(_0x250e7d,null));};exports[_0x626d('0x55')]=function(_0x295dc8,_0x338fc6){return db[_0x626d('0x3c')][_0x626d('0x55')](_0x295dc8[_0x626d('0x56')],{})['then'](respondWithResult(_0x338fc6,0xc9))[_0x626d('0x2c')](handleError(_0x338fc6,null));};exports[_0x626d('0x36')]=function(_0x23613f,_0x3f2384){if(_0x23613f[_0x626d('0x56')]['id']){delete _0x23613f[_0x626d('0x56')]['id'];}return db[_0x626d('0x3c')][_0x626d('0x54')]({'where':{'id':_0x23613f[_0x626d('0x52')]['id']}})[_0x626d('0x23')](handleEntityNotFound(_0x3f2384,null))[_0x626d('0x23')](saveUpdates(_0x23613f[_0x626d('0x56')],null))[_0x626d('0x23')](respondWithResult(_0x3f2384,null))[_0x626d('0x2c')](handleError(_0x3f2384,null));};exports[_0x626d('0x37')]=function(_0x5d9805,_0x25c111){return db[_0x626d('0x3c')][_0x626d('0x54')]({'where':{'id':_0x5d9805['params']['id']}})[_0x626d('0x23')](handleEntityNotFound(_0x25c111,null))[_0x626d('0x23')](removeEntity(_0x25c111,null))[_0x626d('0x2c')](handleError(_0x25c111,null));};exports[_0x626d('0x57')]=function(_0x55006e,_0x4b5eda,_0x8c8973){var _0x327828={};var _0x4e7e23={};var _0x23da98;var _0x25e27d;return db['SugarcrmAccount'][_0x626d('0x58')]({'where':{'id':_0x55006e[_0x626d('0x52')]['id']}})[_0x626d('0x23')](handleEntityNotFound(_0x4b5eda,null))[_0x626d('0x23')](function(_0x206fff){if(_0x206fff){_0x23da98=_0x206fff;_0x4e7e23['model']=_[_0x626d('0x41')](db[_0x626d('0x59')][_0x626d('0x3d')]);_0x4e7e23[_0x626d('0x40')]=_[_0x626d('0x41')](_0x55006e[_0x626d('0x40')]);_0x4e7e23[_0x626d('0x42')]=_[_0x626d('0x44')](_0x4e7e23['model'],_0x4e7e23['query']);_0x327828[_0x626d('0x43')]=_[_0x626d('0x44')](_0x4e7e23[_0x626d('0x3f')],qs['fields'](_0x55006e[_0x626d('0x40')][_0x626d('0x53')]));_0x327828[_0x626d('0x43')]=_0x327828[_0x626d('0x43')][_0x626d('0x45')]?_0x327828[_0x626d('0x43')]:_0x4e7e23[_0x626d('0x3f')];_0x327828[_0x626d('0x47')]=qs[_0x626d('0x48')](_0x55006e[_0x626d('0x40')][_0x626d('0x48')]);_0x327828[_0x626d('0x49')]=qs[_0x626d('0x42')](_[_0x626d('0x4a')](_0x55006e['query'],_0x4e7e23['filters']));if(_0x55006e[_0x626d('0x40')][_0x626d('0x4b')]){_0x327828['where']=_['merge'](_0x327828[_0x626d('0x49')],{'$or':_[_0x626d('0x3b')](_0x327828[_0x626d('0x43')],function(_0x38adf3){var _0x11236a={};_0x11236a[_0x38adf3]={'$like':'%'+_0x55006e[_0x626d('0x40')][_0x626d('0x4b')]+'%'};return _0x11236a;})});}_0x327828=_['merge']({},_0x327828,_0x55006e['options']);return _0x23da98[_0x626d('0x57')](_0x327828);}})['then'](function(_0x3087e6){if(_0x3087e6){_0x25e27d=_0x3087e6['length'];if(!_0x55006e[_0x626d('0x40')][_0x626d('0x46')](_0x626d('0x5a'))){_0x327828[_0x626d('0x33')]=qs[_0x626d('0x33')](_0x55006e[_0x626d('0x40')][_0x626d('0x33')]);_0x327828[_0x626d('0x32')]=qs[_0x626d('0x32')](_0x55006e[_0x626d('0x40')][_0x626d('0x32')]);}return _0x23da98[_0x626d('0x57')](_0x327828);}})['then'](function(_0x5d1403){if(_0x5d1403){return _0x5d1403?{'count':_0x25e27d,'rows':_0x5d1403}:null;}})[_0x626d('0x23')](respondWithResult(_0x4b5eda,null))[_0x626d('0x2c')](handleError(_0x4b5eda,null));};exports[_0x626d('0x5b')]=function(_0x5ed773,_0x562f0a,_0x28f333){if(_0x5ed773[_0x626d('0x56')]['id']){delete _0x5ed773[_0x626d('0x56')]['id'];}return db[_0x626d('0x3c')][_0x626d('0x58')]({'where':{'id':_0x5ed773[_0x626d('0x52')]['id']}})['then'](handleEntityNotFound(_0x562f0a,null))[_0x626d('0x23')](function(_0x310de3){if(_0x310de3){_0x5ed773[_0x626d('0x56')]['AccountId']=_0x310de3['id'];_0x5ed773['body']['Subjects']=integrations[_0x626d('0x5c')](_0x5ed773[_0x626d('0x56')]['channel'],_0x5ed773[_0x626d('0x56')][_0x626d('0x3e')]);_0x5ed773[_0x626d('0x56')][_0x626d('0x5d')]=integrations[_0x626d('0x5e')](_0x5ed773['body'][_0x626d('0x5f')],_0x5ed773[_0x626d('0x56')][_0x626d('0x3e')]);return db['SugarcrmConfiguration'][_0x626d('0x55')](_0x5ed773[_0x626d('0x56')],{'include':[{'model':db['SugarcrmField'],'as':_0x626d('0x60')},{'model':db[_0x626d('0x61')],'as':_0x626d('0x5d')}]});}return null;})[_0x626d('0x23')](respondWithResult(_0x562f0a,null))['catch'](handleError(_0x562f0a,null));};exports[_0x626d('0x62')]=function(_0x1aa853,_0x5c1485,_0x30b2d6){var _0x53184b='';var _0xb68080=['id','name',_0x626d('0x63'),_0x626d('0x64'),_0x626d('0x65'),_0x626d('0x66'),_0x626d('0x67'),_0x626d('0x68'),_0x626d('0x69'),_0x626d('0x6a'),'parent_name',_0x626d('0x6b')];return db[_0x626d('0x3c')][_0x626d('0x58')]({'where':{'id':_0x1aa853['params']['id']},'attributes':['id',_0x626d('0x6c'),_0x626d('0x6d'),_0x626d('0x6e')]})['then'](handleEntityNotFound(_0x5c1485,null))[_0x626d('0x23')](function(_0x498e20){if(_0x498e20){_0x53184b=_0x498e20[_0x626d('0x6e')];var _0x561442=_0x53184b['slice'](-0x1);if(_0x561442==='/'){_0x53184b=_0x53184b[_0x626d('0x6f')](0x0,_0x53184b['lastIndexOf'](_0x561442));}return rp({'method':_0x626d('0x70'),'uri':util[_0x626d('0x71')](_0x626d('0x72'),_0x53184b,_0x626d('0x73')),'json':!![],'form':{'method':_0x626d('0x74'),'input_type':_0x626d('0x75'),'response_type':_0x626d('0x75'),'rest_data':JSON[_0x626d('0x76')]({'user_auth':{'user_name':_0x498e20['username'],'password':_0x498e20[_0x626d('0x6d')],'encryption':_0x626d('0x77')},'application':_0x626d('0x78')})}});}})[_0x626d('0x23')](function(_0x31c958){if(_0x31c958&&_0x31c958[_0x626d('0x39')]!==_0x626d('0x79')&&_0x31c958['name']!==_0x626d('0x7a')){return rp({'method':_0x626d('0x70'),'uri':util[_0x626d('0x71')](_0x626d('0x72'),_0x53184b,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'get_module_fields','input_type':_0x626d('0x75'),'response_type':_0x626d('0x75'),'rest_data':JSON['stringify']({'session':_0x31c958['id'],'module_name':_0x626d('0x7b')})}})[_0x626d('0x23')](function(_0x23ce14){if(_0x23ce14){var _0xf9f2ae=_[_0x626d('0x7c')](_0x23ce14['module_fields']);_[_0x626d('0x7d')](_0xf9f2ae,function(_0x2943bc){return _0xb68080[_0x626d('0x7e')](_0x2943bc[_0x626d('0x39')]);});return{'count':_0xf9f2ae[_0x626d('0x45')],'rows':_[_0x626d('0x3b')](_0xf9f2ae,function(_0x3c7c5f){return{'id':_0x3c7c5f['name'],'name':_0x3c7c5f[_0x626d('0x7f')],'custom':_[_0x626d('0x80')](_0x3c7c5f[_0x626d('0x39')],'_c')?!![]:![],'options':_0x3c7c5f[_0x626d('0x4d')]?_[_0x626d('0x3b')](_[_0x626d('0x7c')](_0x3c7c5f[_0x626d('0x4d')]),function(_0xbe806d){return{'name':_0xbe806d[_0x626d('0x81')],'value':_0xbe806d[_0x626d('0x39')]};}):[]};})};}})[_0x626d('0x23')](respondWithResult(_0x5c1485,null))[_0x626d('0x2c')](function(_0x3ec836){var _0x213e9b=_0x1aa853[_0x626d('0x40')][_0x626d('0x1e')]?0x1f4:_0x3ec836[_0x626d('0x82')]||0x1f4;logger[_0x626d('0x28')](_0x626d('0x83'),_0x626d('0x62'),_0x213e9b,JSON['stringify'](_0x3ec836));delete _0x3ec836[_0x626d('0x39')];if(_0x213e9b===0x191){_0x213e9b=0x190;}_0x5c1485[_0x626d('0x2e')](_0x213e9b)[_0x626d('0x84')](_0x1aa853[_0x626d('0x40')][_0x626d('0x1e')]?{'message':_0x626d('0x85'),'statusCode':_0x3ec836['statusCode']}:_0x3ec836);});}else{var _0x7087ce=0x1f4;_0x5c1485['status'](_0x7087ce)[_0x626d('0x84')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0x4d2a=['findAll','rows','show','params','rawAttributes','options','find','create','body','destroy','SugarcrmConfiguration','order','getConfigurations','hasOwnProperty','limit','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','assigned_user_id','created_by','description','duration_hours','duration_minutes','parent_id','parent_name','username','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','JSON','stringify','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','/service/v4_1/rest.php','get_module_fields','Calls','values','module_fields','remove','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','send','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','SugarcrmAccount,\x20%s,\x20%s','debug','error','message','info','request\x20sent','result','catch','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','stack','name','index','SugarcrmAccount','type','model','query','keys','attributes','intersection','fields','length','nolimit','sort','where','filters','pick','filter','map','VIRTUAL','merge','includeAll','include'];(function(_0xfa847c,_0x444a8c){var _0x3b22bf=function(_0x32de11){while(--_0x32de11){_0xfa847c['push'](_0xfa847c['shift']());}};_0x3b22bf(++_0x444a8c);}(_0x4d2a,0x1cc));var _0xa4d2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4d2a[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xa4d2('0x0'));var emlformat=require(_0xa4d2('0x1'));var rimraf=require(_0xa4d2('0x2'));var zipdir=require(_0xa4d2('0x3'));var jsonpatch=require(_0xa4d2('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa4d2('0x5'));var Mustache=require('mustache');var util=require(_0xa4d2('0x6'));var path=require(_0xa4d2('0x7'));var sox=require(_0xa4d2('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xa4d2('0x9'));var squel=require(_0xa4d2('0xa'));var crypto=require(_0xa4d2('0xb'));var jsforce=require(_0xa4d2('0xc'));var deskjs=require(_0xa4d2('0xd'));var toCsv=require(_0xa4d2('0xe'));var querystring=require(_0xa4d2('0xf'));var Papa=require('papaparse');var Redis=require(_0xa4d2('0x10'));var authService=require(_0xa4d2('0x11'));var qs=require(_0xa4d2('0x12'));var as=require(_0xa4d2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa4d2('0x14'))(_0xa4d2('0x15'));var utils=require(_0xa4d2('0x16'));var config=require(_0xa4d2('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xa4d2('0x18'));var jayson=require(_0xa4d2('0x19'));var client=jayson[_0xa4d2('0x1a')][_0xa4d2('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x104f8c,_0x43bfad,_0x399280){if(_0x399280){var _0x58b969=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x58b969['test'](_0x43bfad)){return _0x104f8c;}else{throw new db[(_0xa4d2('0x1c'))][(_0xa4d2('0x1d'))](_0xa4d2('0x1e'));}}else{return _0x104f8c;}}function respondWithRpcPromise(_0xf8584f,_0x223bbc,_0x1f11c4,_0x1d4c87){return new BPromise(function(_0x36598f,_0x45c97f){var _0xe4f0b6=_0x1d4c87||client;return _0xe4f0b6[_0xa4d2('0x1f')](_0xf8584f,_0x1f11c4)[_0xa4d2('0x20')](function(_0x3aa417){logger['info'](_0xa4d2('0x21'),_0x223bbc,'request\x20sent');logger[_0xa4d2('0x22')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x223bbc,'request\x20sent',JSON['stringify'](_0x3aa417));if(_0x3aa417['error']){if(_0x3aa417[_0xa4d2('0x23')]['code']===0x1f4){logger[_0xa4d2('0x23')](_0xa4d2('0x21'),_0x223bbc,_0x3aa417[_0xa4d2('0x23')]['message']);return _0x45c97f(_0x3aa417['error'][_0xa4d2('0x24')]);}logger[_0xa4d2('0x23')]('SugarcrmAccount,\x20%s,\x20%s',_0x223bbc,_0x3aa417[_0xa4d2('0x23')][_0xa4d2('0x24')]);return _0x36598f(_0x3aa417[_0xa4d2('0x23')][_0xa4d2('0x24')]);}else{logger[_0xa4d2('0x25')](_0xa4d2('0x21'),_0x223bbc,_0xa4d2('0x26'));_0x36598f(_0x3aa417[_0xa4d2('0x27')]['message']);}})[_0xa4d2('0x28')](function(_0x493ebd){logger[_0xa4d2('0x23')](_0xa4d2('0x21'),_0x223bbc,_0x493ebd);_0x45c97f(_0x493ebd);});});}function respondWithStatusCode(_0x4248c7,_0x15f74f){_0x15f74f=_0x15f74f||0xcc;return function(_0x519c39){if(_0x519c39){return _0x4248c7[_0xa4d2('0x29')](_0x15f74f);}return _0x4248c7['status'](_0x15f74f)[_0xa4d2('0x2a')]();};}function respondWithResult(_0x22ce66,_0x53d649){_0x53d649=_0x53d649||0xc8;return function(_0x444327){if(_0x444327){return _0x22ce66[_0xa4d2('0x2b')](_0x53d649)[_0xa4d2('0x2c')](_0x444327);}};}function respondWithFilteredResult(_0x3ef30f,_0x5c4124){return function(_0x5d6953){if(_0x5d6953){var _0xbe737c=_0x5d6953[_0xa4d2('0x2d')],_0x1b548c=_0x5c4124[_0xa4d2('0x2e')],_0x1baea1=_0x5c4124[_0xa4d2('0x2e')]+_0x5c4124['limit'],_0x4083c8;if(_0x1baea1>=_0xbe737c){_0x1baea1=_0xbe737c;_0x4083c8=0xc8;}else{_0x4083c8=0xce;}_0x3ef30f[_0xa4d2('0x2b')](_0x4083c8);return _0x3ef30f[_0xa4d2('0x2f')](_0xa4d2('0x30'),_0x1b548c+'-'+_0x1baea1+'/'+_0xbe737c)['json'](_0x5d6953);}return null;};}function patchUpdates(_0x27f898){return function(_0x204a94){try{jsonpatch[_0xa4d2('0x31')](_0x204a94,_0x27f898,!![]);}catch(_0x20062b){return BPromise[_0xa4d2('0x32')](_0x20062b);}return _0x204a94[_0xa4d2('0x33')]();};}function saveUpdates(_0x2b529b,_0x30917a){return function(_0x531ada){if(_0x531ada){return _0x531ada[_0xa4d2('0x34')](_0x2b529b)[_0xa4d2('0x20')](function(_0xc34e27){return _0xc34e27;});}return null;};}function removeEntity(_0x52fe29,_0x222a82){return function(_0x4f6521){if(_0x4f6521){return _0x4f6521['destroy']()[_0xa4d2('0x20')](function(){_0x52fe29['status'](0xcc)[_0xa4d2('0x2a')]();});}};}function handleEntityNotFound(_0x4357ab,_0x2681eb){return function(_0x9fb2e2){if(!_0x9fb2e2){_0x4357ab['sendStatus'](0x194);}return _0x9fb2e2;};}function handleError(_0x491b6d,_0x474fde){_0x474fde=_0x474fde||0x1f4;return function(_0x38a6a4){logger[_0xa4d2('0x23')](_0x38a6a4[_0xa4d2('0x35')]);if(_0x38a6a4[_0xa4d2('0x36')]){delete _0x38a6a4[_0xa4d2('0x36')];}_0x491b6d[_0xa4d2('0x2b')](_0x474fde)['send'](_0x38a6a4);};}exports[_0xa4d2('0x37')]=function(_0x4aa904,_0xf829d8){var _0x1def39={},_0x4e9133={},_0x29c428={'count':0x0,'rows':[]};var _0x49065d=_['map'](db[_0xa4d2('0x38')]['rawAttributes'],function(_0x107440){return{'name':_0x107440['fieldName'],'type':_0x107440[_0xa4d2('0x39')]['key']};});_0x4e9133[_0xa4d2('0x3a')]=_['map'](_0x49065d,_0xa4d2('0x36'));_0x4e9133[_0xa4d2('0x3b')]=_[_0xa4d2('0x3c')](_0x4aa904[_0xa4d2('0x3b')]);_0x4e9133['filters']=_['intersection'](_0x4e9133[_0xa4d2('0x3a')],_0x4e9133[_0xa4d2('0x3b')]);_0x1def39[_0xa4d2('0x3d')]=_[_0xa4d2('0x3e')](_0x4e9133[_0xa4d2('0x3a')],qs['fields'](_0x4aa904[_0xa4d2('0x3b')][_0xa4d2('0x3f')]));_0x1def39[_0xa4d2('0x3d')]=_0x1def39[_0xa4d2('0x3d')][_0xa4d2('0x40')]?_0x1def39[_0xa4d2('0x3d')]:_0x4e9133[_0xa4d2('0x3a')];if(!_0x4aa904[_0xa4d2('0x3b')]['hasOwnProperty'](_0xa4d2('0x41'))){_0x1def39['limit']=qs['limit'](_0x4aa904[_0xa4d2('0x3b')]['limit']);_0x1def39[_0xa4d2('0x2e')]=qs[_0xa4d2('0x2e')](_0x4aa904[_0xa4d2('0x3b')][_0xa4d2('0x2e')]);}_0x1def39['order']=qs['sort'](_0x4aa904[_0xa4d2('0x3b')][_0xa4d2('0x42')]);_0x1def39[_0xa4d2('0x43')]=qs[_0xa4d2('0x44')](_[_0xa4d2('0x45')](_0x4aa904[_0xa4d2('0x3b')],_0x4e9133['filters']),_0x49065d);if(_0x4aa904[_0xa4d2('0x3b')][_0xa4d2('0x46')]){_0x1def39[_0xa4d2('0x43')]=_['merge'](_0x1def39[_0xa4d2('0x43')],{'$or':_[_0xa4d2('0x47')](_0x49065d,function(_0x42e38f){if(_0x42e38f['type']!==_0xa4d2('0x48')){var _0x34b841={};_0x34b841[_0x42e38f[_0xa4d2('0x36')]]={'$like':'%'+_0x4aa904[_0xa4d2('0x3b')][_0xa4d2('0x46')]+'%'};return _0x34b841;}})});}_0x1def39=_[_0xa4d2('0x49')]({},_0x1def39,_0x4aa904['options']);var _0x37dbc7={'where':_0x1def39[_0xa4d2('0x43')]};return db[_0xa4d2('0x38')][_0xa4d2('0x2d')](_0x37dbc7)[_0xa4d2('0x20')](function(_0x4fed11){_0x29c428[_0xa4d2('0x2d')]=_0x4fed11;if(_0x4aa904[_0xa4d2('0x3b')][_0xa4d2('0x4a')]){_0x1def39[_0xa4d2('0x4b')]=[{'all':!![]}];}return db[_0xa4d2('0x38')][_0xa4d2('0x4c')](_0x1def39);})['then'](function(_0x302f29){_0x29c428[_0xa4d2('0x4d')]=_0x302f29;return _0x29c428;})[_0xa4d2('0x20')](respondWithFilteredResult(_0xf829d8,_0x1def39))[_0xa4d2('0x28')](handleError(_0xf829d8,null));};exports[_0xa4d2('0x4e')]=function(_0x2856d1,_0x3d0836){var _0x4113c4={'raw':![],'where':{'id':_0x2856d1[_0xa4d2('0x4f')]['id']}},_0x48a432={};_0x48a432[_0xa4d2('0x3a')]=_['keys'](db[_0xa4d2('0x38')][_0xa4d2('0x50')]);_0x48a432['query']=_[_0xa4d2('0x3c')](_0x2856d1[_0xa4d2('0x3b')]);_0x48a432['filters']=_[_0xa4d2('0x3e')](_0x48a432[_0xa4d2('0x3a')],_0x48a432['query']);_0x4113c4[_0xa4d2('0x3d')]=_[_0xa4d2('0x3e')](_0x48a432[_0xa4d2('0x3a')],qs[_0xa4d2('0x3f')](_0x2856d1[_0xa4d2('0x3b')][_0xa4d2('0x3f')]));_0x4113c4[_0xa4d2('0x3d')]=_0x4113c4[_0xa4d2('0x3d')][_0xa4d2('0x40')]?_0x4113c4[_0xa4d2('0x3d')]:_0x48a432[_0xa4d2('0x3a')];if(_0x2856d1[_0xa4d2('0x3b')][_0xa4d2('0x4a')]){_0x4113c4[_0xa4d2('0x4b')]=[{'all':!![]}];}_0x4113c4=_['merge']({},_0x4113c4,_0x2856d1[_0xa4d2('0x51')]);return db[_0xa4d2('0x38')][_0xa4d2('0x52')](_0x4113c4)[_0xa4d2('0x20')](handleEntityNotFound(_0x3d0836,null))[_0xa4d2('0x20')](respondWithResult(_0x3d0836,null))['catch'](handleError(_0x3d0836,null));};exports[_0xa4d2('0x53')]=function(_0x23f575,_0x16a58a){return db[_0xa4d2('0x38')][_0xa4d2('0x53')](_0x23f575[_0xa4d2('0x54')],{})['then'](respondWithResult(_0x16a58a,0xc9))['catch'](handleError(_0x16a58a,null));};exports[_0xa4d2('0x34')]=function(_0x2fb732,_0x59d595){if(_0x2fb732[_0xa4d2('0x54')]['id']){delete _0x2fb732['body']['id'];}return db['SugarcrmAccount'][_0xa4d2('0x52')]({'where':{'id':_0x2fb732['params']['id']}})[_0xa4d2('0x20')](handleEntityNotFound(_0x59d595,null))['then'](saveUpdates(_0x2fb732['body'],null))[_0xa4d2('0x20')](respondWithResult(_0x59d595,null))[_0xa4d2('0x28')](handleError(_0x59d595,null));};exports[_0xa4d2('0x55')]=function(_0x59c524,_0x13d59b){return db['SugarcrmAccount']['find']({'where':{'id':_0x59c524['params']['id']}})[_0xa4d2('0x20')](handleEntityNotFound(_0x13d59b,null))[_0xa4d2('0x20')](removeEntity(_0x13d59b,null))['catch'](handleError(_0x13d59b,null));};exports['getConfigurations']=function(_0x1e737f,_0x4637ac,_0x42e9c5){var _0x24118a={};var _0x24143f={};var _0x4532e7;var _0x52bd7b;return db[_0xa4d2('0x38')]['findOne']({'where':{'id':_0x1e737f[_0xa4d2('0x4f')]['id']}})[_0xa4d2('0x20')](handleEntityNotFound(_0x4637ac,null))[_0xa4d2('0x20')](function(_0x275374){if(_0x275374){_0x4532e7=_0x275374;_0x24143f['model']=_['keys'](db[_0xa4d2('0x56')][_0xa4d2('0x50')]);_0x24143f[_0xa4d2('0x3b')]=_['keys'](_0x1e737f[_0xa4d2('0x3b')]);_0x24143f['filters']=_[_0xa4d2('0x3e')](_0x24143f[_0xa4d2('0x3a')],_0x24143f['query']);_0x24118a[_0xa4d2('0x3d')]=_[_0xa4d2('0x3e')](_0x24143f[_0xa4d2('0x3a')],qs[_0xa4d2('0x3f')](_0x1e737f[_0xa4d2('0x3b')][_0xa4d2('0x3f')]));_0x24118a[_0xa4d2('0x3d')]=_0x24118a['attributes'][_0xa4d2('0x40')]?_0x24118a[_0xa4d2('0x3d')]:_0x24143f[_0xa4d2('0x3a')];_0x24118a[_0xa4d2('0x57')]=qs[_0xa4d2('0x42')](_0x1e737f['query'][_0xa4d2('0x42')]);_0x24118a[_0xa4d2('0x43')]=qs['filters'](_[_0xa4d2('0x45')](_0x1e737f[_0xa4d2('0x3b')],_0x24143f[_0xa4d2('0x44')]));if(_0x1e737f[_0xa4d2('0x3b')][_0xa4d2('0x46')]){_0x24118a[_0xa4d2('0x43')]=_['merge'](_0x24118a['where'],{'$or':_[_0xa4d2('0x47')](_0x24118a['attributes'],function(_0x196b63){var _0x5be476={};_0x5be476[_0x196b63]={'$like':'%'+_0x1e737f[_0xa4d2('0x3b')]['filter']+'%'};return _0x5be476;})});}_0x24118a=_[_0xa4d2('0x49')]({},_0x24118a,_0x1e737f['options']);return _0x4532e7[_0xa4d2('0x58')](_0x24118a);}})['then'](function(_0xc4248d){if(_0xc4248d){_0x52bd7b=_0xc4248d['length'];if(!_0x1e737f[_0xa4d2('0x3b')][_0xa4d2('0x59')](_0xa4d2('0x41'))){_0x24118a[_0xa4d2('0x5a')]=qs[_0xa4d2('0x5a')](_0x1e737f[_0xa4d2('0x3b')]['limit']);_0x24118a[_0xa4d2('0x2e')]=qs['offset'](_0x1e737f[_0xa4d2('0x3b')][_0xa4d2('0x2e')]);}return _0x4532e7['getConfigurations'](_0x24118a);}})[_0xa4d2('0x20')](function(_0x45dba5){if(_0x45dba5){return _0x45dba5?{'count':_0x52bd7b,'rows':_0x45dba5}:null;}})[_0xa4d2('0x20')](respondWithResult(_0x4637ac,null))[_0xa4d2('0x28')](handleError(_0x4637ac,null));};exports[_0xa4d2('0x5b')]=function(_0x396d92,_0x5721c4,_0x51580e){if(_0x396d92[_0xa4d2('0x54')]['id']){delete _0x396d92[_0xa4d2('0x54')]['id'];}return db['SugarcrmAccount'][_0xa4d2('0x5c')]({'where':{'id':_0x396d92[_0xa4d2('0x4f')]['id']}})[_0xa4d2('0x20')](handleEntityNotFound(_0x5721c4,null))[_0xa4d2('0x20')](function(_0x29d22d){if(_0x29d22d){_0x396d92[_0xa4d2('0x54')][_0xa4d2('0x5d')]=_0x29d22d['id'];_0x396d92[_0xa4d2('0x54')][_0xa4d2('0x5e')]=integrations[_0xa4d2('0x5f')](_0x396d92[_0xa4d2('0x54')][_0xa4d2('0x60')],_0x396d92[_0xa4d2('0x54')]['type']);_0x396d92['body'][_0xa4d2('0x61')]=integrations[_0xa4d2('0x62')](_0x396d92[_0xa4d2('0x54')][_0xa4d2('0x60')],_0x396d92[_0xa4d2('0x54')][_0xa4d2('0x39')]);return db['SugarcrmConfiguration'][_0xa4d2('0x53')](_0x396d92[_0xa4d2('0x54')],{'include':[{'model':db[_0xa4d2('0x63')],'as':'Subjects'},{'model':db[_0xa4d2('0x63')],'as':_0xa4d2('0x61')}]});}return null;})[_0xa4d2('0x20')](respondWithResult(_0x5721c4,null))[_0xa4d2('0x28')](handleError(_0x5721c4,null));};exports['getFields']=function(_0x17baf4,_0x71ed6c,_0x231316){var _0x2d0ca2='';var _0x190805=['id','name',_0xa4d2('0x64'),_0xa4d2('0x65'),_0xa4d2('0x66'),'date_start',_0xa4d2('0x67'),_0xa4d2('0x68'),_0xa4d2('0x69'),'parent_type',_0xa4d2('0x6a'),'direction'];return db[_0xa4d2('0x38')][_0xa4d2('0x5c')]({'where':{'id':_0x17baf4['params']['id']},'attributes':['id',_0xa4d2('0x6b'),'password',_0xa4d2('0x6c')]})[_0xa4d2('0x20')](handleEntityNotFound(_0x71ed6c,null))[_0xa4d2('0x20')](function(_0x4192c0){if(_0x4192c0){_0x2d0ca2=_0x4192c0[_0xa4d2('0x6c')];var _0x3c187d=_0x2d0ca2[_0xa4d2('0x6d')](-0x1);if(_0x3c187d==='/'){_0x2d0ca2=_0x2d0ca2[_0xa4d2('0x6e')](0x0,_0x2d0ca2[_0xa4d2('0x6f')](_0x3c187d));}return rp({'method':_0xa4d2('0x70'),'uri':util[_0xa4d2('0x71')](_0xa4d2('0x72'),_0x2d0ca2,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'login','input_type':_0xa4d2('0x73'),'response_type':_0xa4d2('0x73'),'rest_data':JSON[_0xa4d2('0x74')]({'user_auth':{'user_name':_0x4192c0['username'],'password':_0x4192c0['password'],'encryption':'PLAIN'},'application':_0xa4d2('0x75')})}});}})[_0xa4d2('0x20')](function(_0x3772d6){if(_0x3772d6&&_0x3772d6[_0xa4d2('0x36')]!==_0xa4d2('0x76')&&_0x3772d6[_0xa4d2('0x36')]!==_0xa4d2('0x77')){return rp({'method':_0xa4d2('0x70'),'uri':util[_0xa4d2('0x71')](_0xa4d2('0x72'),_0x2d0ca2,_0xa4d2('0x78')),'json':!![],'form':{'method':_0xa4d2('0x79'),'input_type':_0xa4d2('0x73'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x3772d6['id'],'module_name':_0xa4d2('0x7a')})}})[_0xa4d2('0x20')](function(_0x55a2f7){if(_0x55a2f7){var _0x2be6ea=_[_0xa4d2('0x7b')](_0x55a2f7[_0xa4d2('0x7c')]);_[_0xa4d2('0x7d')](_0x2be6ea,function(_0x1d144e){return _0x190805['includes'](_0x1d144e[_0xa4d2('0x36')]);});return{'count':_0x2be6ea[_0xa4d2('0x40')],'rows':_[_0xa4d2('0x47')](_0x2be6ea,function(_0x3a80f6){return{'id':_0x3a80f6['name'],'name':_0x3a80f6['label'],'custom':_[_0xa4d2('0x7e')](_0x3a80f6[_0xa4d2('0x36')],'_c')?!![]:![],'options':_0x3a80f6['options']?_[_0xa4d2('0x47')](_[_0xa4d2('0x7b')](_0x3a80f6[_0xa4d2('0x51')]),function(_0x34664c){return{'name':_0x34664c[_0xa4d2('0x7f')],'value':_0x34664c['name']};}):[]};})};}})['then'](respondWithResult(_0x71ed6c,null))[_0xa4d2('0x28')](function(_0x5e7dcd){var _0x37d644=_0x17baf4[_0xa4d2('0x3b')][_0xa4d2('0x80')]?0x1f4:_0x5e7dcd[_0xa4d2('0x81')]||0x1f4;logger['error'](_0xa4d2('0x82'),_0xa4d2('0x83'),_0x37d644,JSON[_0xa4d2('0x74')](_0x5e7dcd));delete _0x5e7dcd['name'];if(_0x37d644===0x191){_0x37d644=0x190;}_0x71ed6c[_0xa4d2('0x2b')](_0x37d644)[_0xa4d2('0x84')](_0x17baf4[_0xa4d2('0x3b')][_0xa4d2('0x80')]?{'message':_0xa4d2('0x85'),'statusCode':_0x5e7dcd['statusCode']}:_0x5e7dcd);});}else{var _0x451004=0x1f4;_0x71ed6c['status'](_0x451004)[_0xa4d2('0x84')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 1865e16..eaad64d 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 _0x1edd=['../../config/logger','api','bluebird','request-promise','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','SugarcrmAccount','lodash','util'];(function(_0x27e29c,_0x58529a){var _0x55aa56=function(_0x1d9e81){while(--_0x1d9e81){_0x27e29c['push'](_0x27e29c['shift']());}};_0x55aa56(++_0x58529a);}(_0x1edd,0x111));var _0xd1ed=function(_0x43d701,_0x4bb2e9){_0x43d701=_0x43d701-0x0;var _0x2ec4c6=_0x1edd[_0x43d701];return _0x2ec4c6;};'use strict';var _=require(_0xd1ed('0x0'));var util=require(_0xd1ed('0x1'));var logger=require(_0xd1ed('0x2'))(_0xd1ed('0x3'));var moment=require('moment');var BPromise=require(_0xd1ed('0x4'));var rp=require(_0xd1ed('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd1ed('0x6'));var attributes=require(_0xd1ed('0x7'));var integrations=require(_0xd1ed('0x8'));module['exports']=function(_0x150321,_0x14d081){return _0x150321[_0xd1ed('0x9')](_0xd1ed('0xa'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x81e8=['request-promise','rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','../../config/logger','api','bluebird'];(function(_0x6c22d4,_0x198583){var _0x1a3824=function(_0x46baad){while(--_0x46baad){_0x6c22d4['push'](_0x6c22d4['shift']());}};_0x1a3824(++_0x198583);}(_0x81e8,0x168));var _0x881e=function(_0x3bd7c9,_0x20e3b7){_0x3bd7c9=_0x3bd7c9-0x0;var _0x582ad5=_0x81e8[_0x3bd7c9];return _0x582ad5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x881e('0x0'))(_0x881e('0x1'));var moment=require('moment');var BPromise=require(_0x881e('0x2'));var rp=require(_0x881e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x881e('0x4'));var config=require('../../config/environment');var attributes=require(_0x881e('0x5'));var integrations=require(_0x881e('0x6'));module[_0x881e('0x7')]=function(_0x3fe35a,_0x318dcd){return _0x3fe35a[_0x881e('0x8')](_0x881e('0x9'),attributes,{'tableName':_0x881e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index e510799..7fe4fbf 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 _0x9c49=['../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetSugarcrmAccount','findAll','options','raw','where','attributes','limit','map','model','include','stringify','ShowSugarcrmAccount','SugarcrmAccount','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x5c15d0,_0x37d203){var _0x4a701c=function(_0x5c4e7d){while(--_0x5c4e7d){_0x5c15d0['push'](_0x5c15d0['shift']());}};_0x4a701c(++_0x37d203);}(_0x9c49,0x65));var _0x99c4=function(_0x136d61,_0x15999f){_0x136d61=_0x136d61-0x0;var _0x2e8dfb=_0x9c49[_0x136d61];return _0x2e8dfb;};'use strict';var _=require(_0x99c4('0x0'));var util=require(_0x99c4('0x1'));var moment=require(_0x99c4('0x2'));var BPromise=require(_0x99c4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x99c4('0x4'));var db=require(_0x99c4('0x5'))['db'];var utils=require(_0x99c4('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x99c4('0x7'));var jayson=require(_0x99c4('0x8'));var client=jayson[_0x99c4('0x9')][_0x99c4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a8c72,_0x1d8066,_0x523221){return new BPromise(function(_0x1c4efc,_0x2606f2){return client[_0x99c4('0xb')](_0x3a8c72,_0x523221)[_0x99c4('0xc')](function(_0x9dc207){logger[_0x99c4('0xd')](_0x99c4('0xe'),_0x1d8066,_0x99c4('0xf'));logger[_0x99c4('0x10')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x1d8066,_0x99c4('0xf'),JSON['stringify'](_0x9dc207));if(_0x9dc207[_0x99c4('0x11')]){if(_0x9dc207[_0x99c4('0x11')][_0x99c4('0x12')]===0x1f4){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x1d8066,_0x9dc207[_0x99c4('0x11')]['message']);return _0x2606f2(_0x9dc207[_0x99c4('0x11')][_0x99c4('0x13')]);}logger[_0x99c4('0x11')](_0x99c4('0xe'),_0x1d8066,_0x9dc207[_0x99c4('0x11')][_0x99c4('0x13')]);return _0x1c4efc(_0x9dc207[_0x99c4('0x11')][_0x99c4('0x13')]);}else{logger['info'](_0x99c4('0xe'),_0x1d8066,_0x99c4('0xf'));_0x1c4efc(_0x9dc207[_0x99c4('0x14')]['message']);}})[_0x99c4('0x15')](function(_0x24c478){logger['error'](_0x99c4('0xe'),_0x1d8066,_0x24c478);_0x2606f2(_0x24c478);});});}exports[_0x99c4('0x16')]=function(_0x16aac2){var _0x4597b5=this;return new Promise(function(_0x1f627e,_0x1ae91a){return db['SugarcrmAccount'][_0x99c4('0x17')]({'raw':_0x16aac2[_0x99c4('0x18')]?_0x16aac2[_0x99c4('0x18')][_0x99c4('0x19')]===undefined?!![]:![]:!![],'where':_0x16aac2[_0x99c4('0x18')]?_0x16aac2['options'][_0x99c4('0x1a')]||null:null,'attributes':_0x16aac2[_0x99c4('0x18')]?_0x16aac2['options'][_0x99c4('0x1b')]||null:null,'limit':_0x16aac2['options']?_0x16aac2['options'][_0x99c4('0x1c')]||null:null,'include':_0x16aac2[_0x99c4('0x18')]?_0x16aac2[_0x99c4('0x18')]['include']?_[_0x99c4('0x1d')](_0x16aac2[_0x99c4('0x18')]['include'],function(_0x279c9d){return{'model':db[_0x279c9d[_0x99c4('0x1e')]],'as':_0x279c9d['as'],'attributes':_0x279c9d[_0x99c4('0x1b')],'include':_0x279c9d[_0x99c4('0x1f')]?_[_0x99c4('0x1d')](_0x279c9d[_0x99c4('0x1f')],function(_0x44d052){return{'model':db[_0x44d052[_0x99c4('0x1e')]],'as':_0x44d052['as'],'attributes':_0x44d052[_0x99c4('0x1b')],'include':_0x44d052[_0x99c4('0x1f')]?_['map'](_0x44d052['include'],function(_0x218f38){return{'model':db[_0x218f38[_0x99c4('0x1e')]],'as':_0x218f38['as'],'attributes':_0x218f38[_0x99c4('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x21c47b){logger['info'](_0x99c4('0x16'),_0x16aac2);logger[_0x99c4('0x10')](_0x99c4('0x16'),_0x16aac2,JSON[_0x99c4('0x20')](_0x21c47b));_0x1f627e(_0x21c47b);})[_0x99c4('0x15')](function(_0x8587b4){logger[_0x99c4('0x11')](_0x99c4('0x16'),_0x8587b4[_0x99c4('0x13')],_0x16aac2);_0x1ae91a(_0x4597b5[_0x99c4('0x11')](0x1f4,_0x8587b4['message']));});});};exports[_0x99c4('0x21')]=function(_0x511e1c){var _0x401f0a=this;return new Promise(function(_0x47eef4,_0x4b9f33){return db[_0x99c4('0x22')][_0x99c4('0x23')]({'raw':_0x511e1c['options']?_0x511e1c[_0x99c4('0x18')][_0x99c4('0x19')]===undefined?!![]:![]:!![],'where':_0x511e1c['options']?_0x511e1c[_0x99c4('0x18')][_0x99c4('0x1a')]||null:null,'attributes':_0x511e1c[_0x99c4('0x18')]?_0x511e1c[_0x99c4('0x18')][_0x99c4('0x1b')]||null:null,'include':_0x511e1c[_0x99c4('0x18')]?_0x511e1c[_0x99c4('0x18')][_0x99c4('0x1f')]?_['map'](_0x511e1c[_0x99c4('0x18')][_0x99c4('0x1f')],function(_0x8016a2){return{'model':db[_0x8016a2[_0x99c4('0x1e')]],'as':_0x8016a2['as'],'attributes':_0x8016a2[_0x99c4('0x1b')],'include':_0x8016a2[_0x99c4('0x1f')]?_[_0x99c4('0x1d')](_0x8016a2['include'],function(_0x152639){return{'model':db[_0x152639[_0x99c4('0x1e')]],'as':_0x152639['as'],'attributes':_0x152639[_0x99c4('0x1b')],'include':_0x152639[_0x99c4('0x1f')]?_['map'](_0x152639['include'],function(_0x2f6a12){return{'model':db[_0x2f6a12[_0x99c4('0x1e')]],'as':_0x2f6a12['as'],'attributes':_0x2f6a12[_0x99c4('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x131cfd){logger[_0x99c4('0xd')](_0x99c4('0x21'),_0x511e1c);logger[_0x99c4('0x10')](_0x99c4('0x21'),_0x511e1c,JSON[_0x99c4('0x20')](_0x131cfd));_0x47eef4(_0x131cfd);})[_0x99c4('0x15')](function(_0x3423eb){logger[_0x99c4('0x11')]('ShowSugarcrmAccount',_0x3423eb[_0x99c4('0x13')],_0x511e1c);_0x4b9f33(_0x401f0a[_0x99c4('0x11')](0x1f4,_0x3423eb['message']));});});}; \ No newline at end of file +var _0x30d2=['SugarcrmAccount','options','raw','where','include','map','model','attributes','then','find','ShowSugarcrmAccount','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','GetSugarcrmAccount'];(function(_0x4cbce7,_0x139ba2){var _0x127bf5=function(_0x50eaf7){while(--_0x50eaf7){_0x4cbce7['push'](_0x4cbce7['shift']());}};_0x127bf5(++_0x139ba2);}(_0x30d2,0x160));var _0x230d=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x30d2[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x230d('0x0'));var moment=require(_0x230d('0x1'));var BPromise=require('bluebird');var rs=require(_0x230d('0x2'));var fs=require('fs');var Redis=require(_0x230d('0x3'));var db=require(_0x230d('0x4'))['db'];var utils=require(_0x230d('0x5'));var logger=require(_0x230d('0x6'))(_0x230d('0x7'));var config=require('../../config/environment');var jayson=require(_0x230d('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2fa0e3,_0x5af1cc,_0xa8df69){return new BPromise(function(_0x273e8f,_0x56290e){return client[_0x230d('0x9')](_0x2fa0e3,_0xa8df69)['then'](function(_0x11e6ff){logger[_0x230d('0xa')](_0x230d('0xb'),_0x5af1cc,'request\x20sent');logger[_0x230d('0xc')](_0x230d('0xd'),_0x5af1cc,_0x230d('0xe'),JSON[_0x230d('0xf')](_0x11e6ff));if(_0x11e6ff[_0x230d('0x10')]){if(_0x11e6ff[_0x230d('0x10')]['code']===0x1f4){logger[_0x230d('0x10')](_0x230d('0xb'),_0x5af1cc,_0x11e6ff[_0x230d('0x10')]['message']);return _0x56290e(_0x11e6ff[_0x230d('0x10')]['message']);}logger[_0x230d('0x10')](_0x230d('0xb'),_0x5af1cc,_0x11e6ff['error'][_0x230d('0x11')]);return _0x273e8f(_0x11e6ff[_0x230d('0x10')][_0x230d('0x11')]);}else{logger[_0x230d('0xa')](_0x230d('0xb'),_0x5af1cc,'request\x20sent');_0x273e8f(_0x11e6ff['result'][_0x230d('0x11')]);}})[_0x230d('0x12')](function(_0x4f4f19){logger[_0x230d('0x10')](_0x230d('0xb'),_0x5af1cc,_0x4f4f19);_0x56290e(_0x4f4f19);});});}exports[_0x230d('0x13')]=function(_0x821d14){var _0xe8a166=this;return new Promise(function(_0x1d31c8,_0x2a7f80){return db[_0x230d('0x14')]['findAll']({'raw':_0x821d14[_0x230d('0x15')]?_0x821d14[_0x230d('0x15')][_0x230d('0x16')]===undefined?!![]:![]:!![],'where':_0x821d14[_0x230d('0x15')]?_0x821d14[_0x230d('0x15')][_0x230d('0x17')]||null:null,'attributes':_0x821d14['options']?_0x821d14['options']['attributes']||null:null,'limit':_0x821d14[_0x230d('0x15')]?_0x821d14[_0x230d('0x15')]['limit']||null:null,'include':_0x821d14[_0x230d('0x15')]?_0x821d14[_0x230d('0x15')][_0x230d('0x18')]?_[_0x230d('0x19')](_0x821d14['options'][_0x230d('0x18')],function(_0x253cc3){return{'model':db[_0x253cc3[_0x230d('0x1a')]],'as':_0x253cc3['as'],'attributes':_0x253cc3[_0x230d('0x1b')],'include':_0x253cc3['include']?_[_0x230d('0x19')](_0x253cc3['include'],function(_0x340531){return{'model':db[_0x340531[_0x230d('0x1a')]],'as':_0x340531['as'],'attributes':_0x340531[_0x230d('0x1b')],'include':_0x340531[_0x230d('0x18')]?_[_0x230d('0x19')](_0x340531[_0x230d('0x18')],function(_0x5b25eb){return{'model':db[_0x5b25eb['model']],'as':_0x5b25eb['as'],'attributes':_0x5b25eb[_0x230d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x230d('0x1c')](function(_0x25efb2){logger[_0x230d('0xa')](_0x230d('0x13'),_0x821d14);logger['debug'](_0x230d('0x13'),_0x821d14,JSON['stringify'](_0x25efb2));_0x1d31c8(_0x25efb2);})['catch'](function(_0x2b662c){logger[_0x230d('0x10')](_0x230d('0x13'),_0x2b662c[_0x230d('0x11')],_0x821d14);_0x2a7f80(_0xe8a166['error'](0x1f4,_0x2b662c['message']));});});};exports['ShowSugarcrmAccount']=function(_0x5981cc){var _0x3b3eb6=this;return new Promise(function(_0x2ba57d,_0x3dac18){return db[_0x230d('0x14')][_0x230d('0x1d')]({'raw':_0x5981cc['options']?_0x5981cc['options'][_0x230d('0x16')]===undefined?!![]:![]:!![],'where':_0x5981cc[_0x230d('0x15')]?_0x5981cc[_0x230d('0x15')][_0x230d('0x17')]||null:null,'attributes':_0x5981cc[_0x230d('0x15')]?_0x5981cc[_0x230d('0x15')][_0x230d('0x1b')]||null:null,'include':_0x5981cc[_0x230d('0x15')]?_0x5981cc[_0x230d('0x15')][_0x230d('0x18')]?_['map'](_0x5981cc[_0x230d('0x15')][_0x230d('0x18')],function(_0x20a113){return{'model':db[_0x20a113[_0x230d('0x1a')]],'as':_0x20a113['as'],'attributes':_0x20a113[_0x230d('0x1b')],'include':_0x20a113[_0x230d('0x18')]?_[_0x230d('0x19')](_0x20a113[_0x230d('0x18')],function(_0x495da8){return{'model':db[_0x495da8[_0x230d('0x1a')]],'as':_0x495da8['as'],'attributes':_0x495da8[_0x230d('0x1b')],'include':_0x495da8[_0x230d('0x18')]?_[_0x230d('0x19')](_0x495da8[_0x230d('0x18')],function(_0x2c6027){return{'model':db[_0x2c6027[_0x230d('0x1a')]],'as':_0x2c6027['as'],'attributes':_0x2c6027[_0x230d('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ab353){logger['info'](_0x230d('0x1e'),_0x5981cc);logger['debug'](_0x230d('0x1e'),_0x5981cc,JSON['stringify'](_0x2ab353));_0x2ba57d(_0x2ab353);})[_0x230d('0x12')](function(_0x3c6b21){logger['error'](_0x230d('0x1e'),_0x3c6b21[_0x230d('0x11')],_0x5981cc);_0x3dac18(_0x3b3eb6[_0x230d('0x10')](0x1f4,_0x3c6b21['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 8de16a4..9f9632a 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 _0x1de5=['put','update','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','index','/:id','isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0x1de5,0xf4));var _0x51de=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0x1de5[_0x44bcb0];return _0xfaf881;};'use strict';var multer=require('multer');var util=require(_0x51de('0x0'));var path=require(_0x51de('0x1'));var timeout=require(_0x51de('0x2'));var express=require(_0x51de('0x3'));var router=express[_0x51de('0x4')]();var auth=require(_0x51de('0x5'));var interaction=require(_0x51de('0x6'));var config=require(_0x51de('0x7'));var controller=require(_0x51de('0x8'));router[_0x51de('0x9')]('/',auth['isAuthenticated'](),controller[_0x51de('0xa')]);router[_0x51de('0x9')](_0x51de('0xb'),auth[_0x51de('0xc')](),controller['show']);router[_0x51de('0x9')](_0x51de('0xd'),auth[_0x51de('0xc')](),controller[_0x51de('0xe')]);router['get'](_0x51de('0xf'),auth[_0x51de('0xc')](),controller[_0x51de('0x10')]);router[_0x51de('0x9')](_0x51de('0x11'),auth[_0x51de('0xc')](),controller[_0x51de('0x12')]);router[_0x51de('0x13')]('/',auth[_0x51de('0xc')](),controller['create']);router[_0x51de('0x14')](_0x51de('0xb'),auth[_0x51de('0xc')](),controller[_0x51de('0x15')]);router['delete'](_0x51de('0xb'),auth[_0x51de('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8ed5=['index','get','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','/:id','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','isAuthenticated'];(function(_0x1e6a7a,_0x3c6b91){var _0x41e153=function(_0x1c4ab5){while(--_0x1c4ab5){_0x1e6a7a['push'](_0x1e6a7a['shift']());}};_0x41e153(++_0x3c6b91);}(_0x8ed5,0xe6));var _0x58ed=function(_0x185b03,_0x2add24){_0x185b03=_0x185b03-0x0;var _0x2ab563=_0x8ed5[_0x185b03];return _0x2ab563;};'use strict';var multer=require(_0x58ed('0x0'));var util=require(_0x58ed('0x1'));var path=require(_0x58ed('0x2'));var timeout=require(_0x58ed('0x3'));var express=require(_0x58ed('0x4'));var router=express[_0x58ed('0x5')]();var auth=require(_0x58ed('0x6'));var interaction=require(_0x58ed('0x7'));var config=require('../../config/environment');var controller=require(_0x58ed('0x8'));router['get']('/',auth[_0x58ed('0x9')](),controller[_0x58ed('0xa')]);router[_0x58ed('0xb')]('/:id',auth[_0x58ed('0x9')](),controller[_0x58ed('0xc')]);router[_0x58ed('0xb')](_0x58ed('0xd'),auth[_0x58ed('0x9')](),controller[_0x58ed('0xe')]);router[_0x58ed('0xb')](_0x58ed('0xf'),auth[_0x58ed('0x9')](),controller[_0x58ed('0x10')]);router[_0x58ed('0xb')]('/:id/descriptions',auth[_0x58ed('0x9')](),controller[_0x58ed('0x11')]);router[_0x58ed('0x12')]('/',auth['isAuthenticated'](),controller[_0x58ed('0x13')]);router[_0x58ed('0x14')](_0x58ed('0x15'),auth[_0x58ed('0x9')](),controller['update']);router[_0x58ed('0x16')]('/:id',auth[_0x58ed('0x9')](),controller[_0x58ed('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 0bf6e5c..2b55103 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 _0x82bf=['STRING','sequelize','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x82bf,0x17b));var _0xf82b=function(_0x344e09,_0x4307fb){_0x344e09=_0x344e09-0x0;var _0x43032b=_0x82bf[_0x344e09];return _0x43032b;};'use strict';var Sequelize=require(_0xf82b('0x0'));module[_0xf82b('0x1')]={'name':{'type':Sequelize[_0xf82b('0x2')]},'description':{'type':Sequelize[_0xf82b('0x2')]}}; \ No newline at end of file +var _0x33a8=['sequelize','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x33a8,0x172));var _0x833a=function(_0xe90ce4,_0x2795e0){_0xe90ce4=_0xe90ce4-0x0;var _0x408f52=_0x33a8[_0xe90ce4];return _0x408f52;};'use strict';var Sequelize=require(_0x833a('0x0'));module[_0x833a('0x1')]={'name':{'type':Sequelize['STRING']},'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 b658913..14b51df 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 _0x8c1f=['zip-dir','request-promise','moment','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','jayson/promise','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','filter','where','merge','VIRTUAL','options','include','SugarcrmConfiguration','findAll','rows','show','rawAttributes','find','create','body','params','getFields','findOne','SugarcrmField','order','pick','hasOwnProperty','getSubjects','getDescriptions','html-pdf','eml-format','rimraf'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8c1f,0x17d));var _0xf8c1=function(_0x377203,_0x258c59){_0x377203=_0x377203-0x0;var _0x4328e5=_0x8c1f[_0x377203];return _0x4328e5;};'use strict';var pdf=require(_0xf8c1('0x0'));var emlformat=require(_0xf8c1('0x1'));var rimraf=require(_0xf8c1('0x2'));var zipdir=require(_0xf8c1('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf8c1('0x4'));var moment=require(_0xf8c1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf8c1('0x6'));var util=require(_0xf8c1('0x7'));var path=require(_0xf8c1('0x8'));var sox=require(_0xf8c1('0x9'));var csv=require('to-csv');var ejs=require(_0xf8c1('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf8c1('0xb'));var crypto=require(_0xf8c1('0xc'));var jsforce=require(_0xf8c1('0xd'));var deskjs=require(_0xf8c1('0xe'));var toCsv=require(_0xf8c1('0xf'));var querystring=require('querystring');var Papa=require(_0xf8c1('0x10'));var Redis=require(_0xf8c1('0x11'));var authService=require(_0xf8c1('0x12'));var qs=require(_0xf8c1('0x13'));var as=require(_0xf8c1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf8c1('0x15'))(_0xf8c1('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xf8c1('0x17'))['db'];var jayson=require(_0xf8c1('0x18'));var client=jayson['client'][_0xf8c1('0x19')]({'port':0x232a});function checkPasswordPattern(_0x4fe03f,_0x45c099,_0x478b99){if(_0x478b99){var _0x4ff447=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4ff447[_0xf8c1('0x1a')](_0x45c099)){return _0x4fe03f;}else{throw new db[(_0xf8c1('0x1b'))]['ValidationError'](_0xf8c1('0x1c'));}}else{return _0x4fe03f;}}function respondWithRpcPromise(_0x20da98,_0x1f7135,_0x3286a9,_0x486ff4){return new BPromise(function(_0x3f8f33,_0x460dd3){var _0x43c615=_0x486ff4||client;return _0x43c615[_0xf8c1('0x1d')](_0x20da98,_0x3286a9)[_0xf8c1('0x1e')](function(_0x25fc3a){logger[_0xf8c1('0x1f')](_0xf8c1('0x20'),_0x1f7135,_0xf8c1('0x21'));logger[_0xf8c1('0x22')](_0xf8c1('0x23'),_0x1f7135,_0xf8c1('0x21'),JSON[_0xf8c1('0x24')](_0x25fc3a));if(_0x25fc3a['error']){if(_0x25fc3a[_0xf8c1('0x25')][_0xf8c1('0x26')]===0x1f4){logger['error'](_0xf8c1('0x20'),_0x1f7135,_0x25fc3a[_0xf8c1('0x25')][_0xf8c1('0x27')]);return _0x460dd3(_0x25fc3a[_0xf8c1('0x25')][_0xf8c1('0x27')]);}logger['error'](_0xf8c1('0x20'),_0x1f7135,_0x25fc3a[_0xf8c1('0x25')]['message']);return _0x3f8f33(_0x25fc3a['error'][_0xf8c1('0x27')]);}else{logger[_0xf8c1('0x1f')](_0xf8c1('0x20'),_0x1f7135,_0xf8c1('0x21'));_0x3f8f33(_0x25fc3a[_0xf8c1('0x28')][_0xf8c1('0x27')]);}})[_0xf8c1('0x29')](function(_0x357433){logger['error'](_0xf8c1('0x20'),_0x1f7135,_0x357433);_0x460dd3(_0x357433);});});}function respondWithStatusCode(_0x467371,_0x24715a){_0x24715a=_0x24715a||0xcc;return function(_0xd50f48){if(_0xd50f48){return _0x467371['sendStatus'](_0x24715a);}return _0x467371[_0xf8c1('0x2a')](_0x24715a)[_0xf8c1('0x2b')]();};}function respondWithResult(_0x3da6ad,_0x47703b){_0x47703b=_0x47703b||0xc8;return function(_0x45ab8a){if(_0x45ab8a){return _0x3da6ad['status'](_0x47703b)[_0xf8c1('0x2c')](_0x45ab8a);}};}function respondWithFilteredResult(_0x399184,_0x3b5511){return function(_0x23f9e5){if(_0x23f9e5){var _0x244d7f=_0x23f9e5[_0xf8c1('0x2d')],_0x4a1401=_0x3b5511['offset'],_0x5b7787=_0x3b5511[_0xf8c1('0x2e')]+_0x3b5511[_0xf8c1('0x2f')],_0x118bd1;if(_0x5b7787>=_0x244d7f){_0x5b7787=_0x244d7f;_0x118bd1=0xc8;}else{_0x118bd1=0xce;}_0x399184[_0xf8c1('0x2a')](_0x118bd1);return _0x399184['set'](_0xf8c1('0x30'),_0x4a1401+'-'+_0x5b7787+'/'+_0x244d7f)[_0xf8c1('0x2c')](_0x23f9e5);}return null;};}function patchUpdates(_0x5837ad){return function(_0x5d1900){try{jsonpatch[_0xf8c1('0x31')](_0x5d1900,_0x5837ad,!![]);}catch(_0x429d82){return BPromise[_0xf8c1('0x32')](_0x429d82);}return _0x5d1900[_0xf8c1('0x33')]();};}function saveUpdates(_0x7ab527,_0x8f6b51){return function(_0x5cdecd){if(_0x5cdecd){return _0x5cdecd[_0xf8c1('0x34')](_0x7ab527)[_0xf8c1('0x1e')](function(_0x61dbd9){return _0x61dbd9;});}return null;};}function removeEntity(_0x32d1a2,_0x15d42f){return function(_0x70a4ee){if(_0x70a4ee){return _0x70a4ee[_0xf8c1('0x35')]()[_0xf8c1('0x1e')](function(){_0x32d1a2['status'](0xcc)[_0xf8c1('0x2b')]();});}};}function handleEntityNotFound(_0x226207,_0x2dc4ff){return function(_0x4495b1){if(!_0x4495b1){_0x226207[_0xf8c1('0x36')](0x194);}return _0x4495b1;};}function handleError(_0x38e83e,_0x2bb1bf){_0x2bb1bf=_0x2bb1bf||0x1f4;return function(_0x2b4d85){logger[_0xf8c1('0x25')](_0x2b4d85[_0xf8c1('0x37')]);if(_0x2b4d85['name']){delete _0x2b4d85[_0xf8c1('0x38')];}_0x38e83e[_0xf8c1('0x2a')](_0x2bb1bf)[_0xf8c1('0x39')](_0x2b4d85);};}exports[_0xf8c1('0x3a')]=function(_0x5b9e02,_0x3ccb05){var _0x38c231={},_0x582dd9={},_0x2f2389={'count':0x0,'rows':[]};var _0x25bcff=_[_0xf8c1('0x3b')](db['SugarcrmConfiguration']['rawAttributes'],function(_0x39c480){return{'name':_0x39c480[_0xf8c1('0x3c')],'type':_0x39c480[_0xf8c1('0x3d')][_0xf8c1('0x3e')]};});_0x582dd9[_0xf8c1('0x3f')]=_[_0xf8c1('0x3b')](_0x25bcff,'name');_0x582dd9[_0xf8c1('0x40')]=_[_0xf8c1('0x41')](_0x5b9e02[_0xf8c1('0x40')]);_0x582dd9[_0xf8c1('0x42')]=_['intersection'](_0x582dd9[_0xf8c1('0x3f')],_0x582dd9[_0xf8c1('0x40')]);_0x38c231[_0xf8c1('0x43')]=_[_0xf8c1('0x44')](_0x582dd9[_0xf8c1('0x3f')],qs[_0xf8c1('0x45')](_0x5b9e02[_0xf8c1('0x40')][_0xf8c1('0x45')]));_0x38c231[_0xf8c1('0x43')]=_0x38c231['attributes'][_0xf8c1('0x46')]?_0x38c231['attributes']:_0x582dd9[_0xf8c1('0x3f')];if(!_0x5b9e02['query']['hasOwnProperty'](_0xf8c1('0x47'))){_0x38c231['limit']=qs['limit'](_0x5b9e02[_0xf8c1('0x40')][_0xf8c1('0x2f')]);_0x38c231[_0xf8c1('0x2e')]=qs[_0xf8c1('0x2e')](_0x5b9e02['query'][_0xf8c1('0x2e')]);}_0x38c231['order']=qs[_0xf8c1('0x48')](_0x5b9e02[_0xf8c1('0x40')]['sort']);_0x38c231['where']=qs['filters'](_['pick'](_0x5b9e02[_0xf8c1('0x40')],_0x582dd9[_0xf8c1('0x42')]),_0x25bcff);if(_0x5b9e02['query'][_0xf8c1('0x49')]){_0x38c231[_0xf8c1('0x4a')]=_[_0xf8c1('0x4b')](_0x38c231['where'],{'$or':_[_0xf8c1('0x3b')](_0x25bcff,function(_0x5bc7c8){if(_0x5bc7c8[_0xf8c1('0x3d')]!==_0xf8c1('0x4c')){var _0x39a698={};_0x39a698[_0x5bc7c8[_0xf8c1('0x38')]]={'$like':'%'+_0x5b9e02[_0xf8c1('0x40')][_0xf8c1('0x49')]+'%'};return _0x39a698;}})});}_0x38c231=_[_0xf8c1('0x4b')]({},_0x38c231,_0x5b9e02[_0xf8c1('0x4d')]);var _0x264ae2={'where':_0x38c231[_0xf8c1('0x4a')]};return db['SugarcrmConfiguration'][_0xf8c1('0x2d')](_0x264ae2)['then'](function(_0x40516f){_0x2f2389[_0xf8c1('0x2d')]=_0x40516f;if(_0x5b9e02['query']['includeAll']){_0x38c231[_0xf8c1('0x4e')]=[{'all':!![]}];}return db[_0xf8c1('0x4f')][_0xf8c1('0x50')](_0x38c231);})[_0xf8c1('0x1e')](function(_0xa74c50){_0x2f2389[_0xf8c1('0x51')]=_0xa74c50;return _0x2f2389;})[_0xf8c1('0x1e')](respondWithFilteredResult(_0x3ccb05,_0x38c231))[_0xf8c1('0x29')](handleError(_0x3ccb05,null));};exports[_0xf8c1('0x52')]=function(_0x14d02d,_0x32fa5d){var _0x34dd54={'raw':![],'where':{'id':_0x14d02d['params']['id']}},_0x6cd588={};_0x6cd588[_0xf8c1('0x3f')]=_[_0xf8c1('0x41')](db[_0xf8c1('0x4f')][_0xf8c1('0x53')]);_0x6cd588[_0xf8c1('0x40')]=_['keys'](_0x14d02d[_0xf8c1('0x40')]);_0x6cd588[_0xf8c1('0x42')]=_[_0xf8c1('0x44')](_0x6cd588['model'],_0x6cd588[_0xf8c1('0x40')]);_0x34dd54[_0xf8c1('0x43')]=_['intersection'](_0x6cd588[_0xf8c1('0x3f')],qs[_0xf8c1('0x45')](_0x14d02d[_0xf8c1('0x40')]['fields']));_0x34dd54[_0xf8c1('0x43')]=_0x34dd54[_0xf8c1('0x43')][_0xf8c1('0x46')]?_0x34dd54[_0xf8c1('0x43')]:_0x6cd588[_0xf8c1('0x3f')];if(_0x14d02d[_0xf8c1('0x40')]['includeAll']){_0x34dd54[_0xf8c1('0x4e')]=[{'all':!![]}];}_0x34dd54=_['merge']({},_0x34dd54,_0x14d02d['options']);return db[_0xf8c1('0x4f')][_0xf8c1('0x54')](_0x34dd54)[_0xf8c1('0x1e')](handleEntityNotFound(_0x32fa5d,null))[_0xf8c1('0x1e')](respondWithResult(_0x32fa5d,null))[_0xf8c1('0x29')](handleError(_0x32fa5d,null));};exports[_0xf8c1('0x55')]=function(_0x3d3274,_0x55b72c){return db['SugarcrmConfiguration']['create'](_0x3d3274[_0xf8c1('0x56')],{})[_0xf8c1('0x1e')](respondWithResult(_0x55b72c,0xc9))['catch'](handleError(_0x55b72c,null));};exports[_0xf8c1('0x34')]=function(_0x24df80,_0x450058){if(_0x24df80[_0xf8c1('0x56')]['id']){delete _0x24df80['body']['id'];}return db[_0xf8c1('0x4f')][_0xf8c1('0x54')]({'where':{'id':_0x24df80[_0xf8c1('0x57')]['id']}})[_0xf8c1('0x1e')](handleEntityNotFound(_0x450058,null))[_0xf8c1('0x1e')](saveUpdates(_0x24df80[_0xf8c1('0x56')],null))[_0xf8c1('0x1e')](respondWithResult(_0x450058,null))[_0xf8c1('0x29')](handleError(_0x450058,null));};exports[_0xf8c1('0x35')]=function(_0x201b5b,_0x281a52){return db['SugarcrmConfiguration'][_0xf8c1('0x54')]({'where':{'id':_0x201b5b[_0xf8c1('0x57')]['id']}})[_0xf8c1('0x1e')](handleEntityNotFound(_0x281a52,null))[_0xf8c1('0x1e')](removeEntity(_0x281a52,null))[_0xf8c1('0x29')](handleError(_0x281a52,null));};exports[_0xf8c1('0x58')]=function(_0x47540d,_0x16322d,_0xb1c00a){var _0x2328cd={};var _0x11bc3f={};var _0x179e28;var _0x1d3bfc;return db[_0xf8c1('0x4f')][_0xf8c1('0x59')]({'where':{'id':_0x47540d[_0xf8c1('0x57')]['id']}})['then'](handleEntityNotFound(_0x16322d,null))['then'](function(_0x1c5c51){if(_0x1c5c51){_0x179e28=_0x1c5c51;_0x11bc3f['model']=_['keys'](db[_0xf8c1('0x5a')]['rawAttributes']);_0x11bc3f[_0xf8c1('0x40')]=_['keys'](_0x47540d[_0xf8c1('0x40')]);_0x11bc3f[_0xf8c1('0x42')]=_[_0xf8c1('0x44')](_0x11bc3f[_0xf8c1('0x3f')],_0x11bc3f[_0xf8c1('0x40')]);_0x2328cd[_0xf8c1('0x43')]=_[_0xf8c1('0x44')](_0x11bc3f[_0xf8c1('0x3f')],qs['fields'](_0x47540d[_0xf8c1('0x40')][_0xf8c1('0x45')]));_0x2328cd[_0xf8c1('0x43')]=_0x2328cd[_0xf8c1('0x43')][_0xf8c1('0x46')]?_0x2328cd[_0xf8c1('0x43')]:_0x11bc3f[_0xf8c1('0x3f')];_0x2328cd[_0xf8c1('0x5b')]=qs[_0xf8c1('0x48')](_0x47540d['query']['sort']);_0x2328cd[_0xf8c1('0x4a')]=qs[_0xf8c1('0x42')](_[_0xf8c1('0x5c')](_0x47540d[_0xf8c1('0x40')],_0x11bc3f[_0xf8c1('0x42')]));if(_0x47540d['query'][_0xf8c1('0x49')]){_0x2328cd[_0xf8c1('0x4a')]=_[_0xf8c1('0x4b')](_0x2328cd[_0xf8c1('0x4a')],{'$or':_[_0xf8c1('0x3b')](_0x2328cd['attributes'],function(_0x362e0f){var _0x5e3066={};_0x5e3066[_0x362e0f]={'$like':'%'+_0x47540d[_0xf8c1('0x40')]['filter']+'%'};return _0x5e3066;})});}_0x2328cd=_[_0xf8c1('0x4b')]({},_0x2328cd,_0x47540d[_0xf8c1('0x4d')]);return _0x179e28[_0xf8c1('0x58')](_0x2328cd);}})['then'](function(_0x383439){if(_0x383439){_0x1d3bfc=_0x383439[_0xf8c1('0x46')];if(!_0x47540d[_0xf8c1('0x40')][_0xf8c1('0x5d')](_0xf8c1('0x47'))){_0x2328cd[_0xf8c1('0x2f')]=qs[_0xf8c1('0x2f')](_0x47540d[_0xf8c1('0x40')][_0xf8c1('0x2f')]);_0x2328cd['offset']=qs[_0xf8c1('0x2e')](_0x47540d[_0xf8c1('0x40')][_0xf8c1('0x2e')]);}return _0x179e28[_0xf8c1('0x58')](_0x2328cd);}})[_0xf8c1('0x1e')](function(_0x3ed6d7){if(_0x3ed6d7){return _0x3ed6d7?{'count':_0x1d3bfc,'rows':_0x3ed6d7}:null;}})[_0xf8c1('0x1e')](respondWithResult(_0x16322d,null))[_0xf8c1('0x29')](handleError(_0x16322d,null));};exports[_0xf8c1('0x5e')]=function(_0xe97e22,_0x232739,_0x32c13e){var _0x3564a3={};var _0x157e67={};var _0x14dab9;var _0xb284c1;return db[_0xf8c1('0x4f')][_0xf8c1('0x59')]({'where':{'id':_0xe97e22[_0xf8c1('0x57')]['id']}})['then'](handleEntityNotFound(_0x232739,null))[_0xf8c1('0x1e')](function(_0x3ab2b4){if(_0x3ab2b4){_0x14dab9=_0x3ab2b4;_0x157e67['model']=_[_0xf8c1('0x41')](db[_0xf8c1('0x5a')][_0xf8c1('0x53')]);_0x157e67[_0xf8c1('0x40')]=_[_0xf8c1('0x41')](_0xe97e22[_0xf8c1('0x40')]);_0x157e67[_0xf8c1('0x42')]=_[_0xf8c1('0x44')](_0x157e67[_0xf8c1('0x3f')],_0x157e67[_0xf8c1('0x40')]);_0x3564a3['attributes']=_[_0xf8c1('0x44')](_0x157e67[_0xf8c1('0x3f')],qs['fields'](_0xe97e22['query'][_0xf8c1('0x45')]));_0x3564a3[_0xf8c1('0x43')]=_0x3564a3[_0xf8c1('0x43')]['length']?_0x3564a3[_0xf8c1('0x43')]:_0x157e67[_0xf8c1('0x3f')];_0x3564a3[_0xf8c1('0x5b')]=qs[_0xf8c1('0x48')](_0xe97e22['query']['sort']);_0x3564a3[_0xf8c1('0x4a')]=qs['filters'](_['pick'](_0xe97e22[_0xf8c1('0x40')],_0x157e67[_0xf8c1('0x42')]));if(_0xe97e22[_0xf8c1('0x40')][_0xf8c1('0x49')]){_0x3564a3[_0xf8c1('0x4a')]=_['merge'](_0x3564a3[_0xf8c1('0x4a')],{'$or':_[_0xf8c1('0x3b')](_0x3564a3[_0xf8c1('0x43')],function(_0xf035b6){var _0x14981e={};_0x14981e[_0xf035b6]={'$like':'%'+_0xe97e22[_0xf8c1('0x40')][_0xf8c1('0x49')]+'%'};return _0x14981e;})});}_0x3564a3=_['merge']({},_0x3564a3,_0xe97e22[_0xf8c1('0x4d')]);return _0x14dab9[_0xf8c1('0x5e')](_0x3564a3);}})['then'](function(_0x12e24f){if(_0x12e24f){_0xb284c1=_0x12e24f[_0xf8c1('0x46')];if(!_0xe97e22[_0xf8c1('0x40')][_0xf8c1('0x5d')](_0xf8c1('0x47'))){_0x3564a3[_0xf8c1('0x2f')]=qs[_0xf8c1('0x2f')](_0xe97e22['query']['limit']);_0x3564a3['offset']=qs[_0xf8c1('0x2e')](_0xe97e22['query'][_0xf8c1('0x2e')]);}return _0x14dab9[_0xf8c1('0x5e')](_0x3564a3);}})[_0xf8c1('0x1e')](function(_0x4ecf42){if(_0x4ecf42){return _0x4ecf42?{'count':_0xb284c1,'rows':_0x4ecf42}:null;}})[_0xf8c1('0x1e')](respondWithResult(_0x232739,null))[_0xf8c1('0x29')](handleError(_0x232739,null));};exports[_0xf8c1('0x5f')]=function(_0x440d73,_0x11ec55,_0x569b03){var _0x204d9a={};var _0x419918={};var _0x4a88c4;var _0x26ca39;return db[_0xf8c1('0x4f')]['findOne']({'where':{'id':_0x440d73['params']['id']}})['then'](handleEntityNotFound(_0x11ec55,null))[_0xf8c1('0x1e')](function(_0x49a2fb){if(_0x49a2fb){_0x4a88c4=_0x49a2fb;_0x419918['model']=_[_0xf8c1('0x41')](db[_0xf8c1('0x5a')][_0xf8c1('0x53')]);_0x419918[_0xf8c1('0x40')]=_[_0xf8c1('0x41')](_0x440d73[_0xf8c1('0x40')]);_0x419918[_0xf8c1('0x42')]=_['intersection'](_0x419918['model'],_0x419918[_0xf8c1('0x40')]);_0x204d9a[_0xf8c1('0x43')]=_[_0xf8c1('0x44')](_0x419918[_0xf8c1('0x3f')],qs[_0xf8c1('0x45')](_0x440d73[_0xf8c1('0x40')][_0xf8c1('0x45')]));_0x204d9a[_0xf8c1('0x43')]=_0x204d9a[_0xf8c1('0x43')][_0xf8c1('0x46')]?_0x204d9a['attributes']:_0x419918['model'];_0x204d9a[_0xf8c1('0x5b')]=qs[_0xf8c1('0x48')](_0x440d73['query'][_0xf8c1('0x48')]);_0x204d9a[_0xf8c1('0x4a')]=qs[_0xf8c1('0x42')](_[_0xf8c1('0x5c')](_0x440d73['query'],_0x419918[_0xf8c1('0x42')]));if(_0x440d73[_0xf8c1('0x40')]['filter']){_0x204d9a['where']=_[_0xf8c1('0x4b')](_0x204d9a[_0xf8c1('0x4a')],{'$or':_[_0xf8c1('0x3b')](_0x204d9a['attributes'],function(_0x414bd7){var _0x2ce5cc={};_0x2ce5cc[_0x414bd7]={'$like':'%'+_0x440d73['query']['filter']+'%'};return _0x2ce5cc;})});}_0x204d9a=_[_0xf8c1('0x4b')]({},_0x204d9a,_0x440d73[_0xf8c1('0x4d')]);return _0x4a88c4['getDescriptions'](_0x204d9a);}})[_0xf8c1('0x1e')](function(_0x3e5746){if(_0x3e5746){_0x26ca39=_0x3e5746['length'];if(!_0x440d73[_0xf8c1('0x40')][_0xf8c1('0x5d')](_0xf8c1('0x47'))){_0x204d9a[_0xf8c1('0x2f')]=qs[_0xf8c1('0x2f')](_0x440d73['query'][_0xf8c1('0x2f')]);_0x204d9a['offset']=qs[_0xf8c1('0x2e')](_0x440d73[_0xf8c1('0x40')][_0xf8c1('0x2e')]);}return _0x4a88c4[_0xf8c1('0x5f')](_0x204d9a);}})[_0xf8c1('0x1e')](function(_0x4bc9bd){if(_0x4bc9bd){return _0x4bc9bd?{'count':_0x26ca39,'rows':_0x4bc9bd}:null;}})[_0xf8c1('0x1e')](respondWithResult(_0x11ec55,null))[_0xf8c1('0x29')](handleError(_0x11ec55,null));}; \ No newline at end of file +var _0x3998=['getFields','findOne','rawAttributes','order','sort','getSubjects','SugarcrmField','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','update','destroy','name','send','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','options','SugarcrmConfiguration','includeAll','show','params','keys','include','find','create','body'];(function(_0xd11e5e,_0x578bba){var _0x362769=function(_0x464a0e){while(--_0x464a0e){_0xd11e5e['push'](_0xd11e5e['shift']());}};_0x362769(++_0x578bba);}(_0x3998,0xbb));var _0x8399=function(_0x2db3cf,_0x2e42e3){_0x2db3cf=_0x2db3cf-0x0;var _0x3c0cc0=_0x3998[_0x2db3cf];return _0x3c0cc0;};'use strict';var pdf=require(_0x8399('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8399('0x1'));var zipdir=require(_0x8399('0x2'));var jsonpatch=require(_0x8399('0x3'));var rp=require('request-promise');var moment=require(_0x8399('0x4'));var BPromise=require(_0x8399('0x5'));var Mustache=require(_0x8399('0x6'));var util=require(_0x8399('0x7'));var path=require(_0x8399('0x8'));var sox=require('sox');var csv=require(_0x8399('0x9'));var ejs=require(_0x8399('0xa'));var fs=require('fs');var _=require(_0x8399('0xb'));var squel=require(_0x8399('0xc'));var crypto=require(_0x8399('0xd'));var jsforce=require(_0x8399('0xe'));var deskjs=require(_0x8399('0xf'));var toCsv=require(_0x8399('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8399('0x10'));var authService=require(_0x8399('0x11'));var qs=require(_0x8399('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8399('0x13'));var logger=require('../../config/logger')(_0x8399('0x14'));var utils=require('../../config/utils');var config=require(_0x8399('0x15'));var db=require(_0x8399('0x16'))['db'];var jayson=require(_0x8399('0x17'));var client=jayson[_0x8399('0x18')][_0x8399('0x19')]({'port':0x232a});function checkPasswordPattern(_0x39325d,_0x5ea7d8,_0x2175b3){if(_0x2175b3){var _0x1c56b4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1c56b4['test'](_0x5ea7d8)){return _0x39325d;}else{throw new db[(_0x8399('0x1a'))][(_0x8399('0x1b'))](_0x8399('0x1c'));}}else{return _0x39325d;}}function respondWithRpcPromise(_0x46b3b7,_0x42c3b9,_0x5b4c64,_0x926141){return new BPromise(function(_0x4cd176,_0xad1d4f){var _0x6ccc10=_0x926141||client;return _0x6ccc10[_0x8399('0x1d')](_0x46b3b7,_0x5b4c64)[_0x8399('0x1e')](function(_0x3055d1){logger[_0x8399('0x1f')](_0x8399('0x20'),_0x42c3b9,_0x8399('0x21'));logger['debug'](_0x8399('0x22'),_0x42c3b9,_0x8399('0x21'),JSON[_0x8399('0x23')](_0x3055d1));if(_0x3055d1['error']){if(_0x3055d1['error'][_0x8399('0x24')]===0x1f4){logger[_0x8399('0x25')](_0x8399('0x20'),_0x42c3b9,_0x3055d1[_0x8399('0x25')][_0x8399('0x26')]);return _0xad1d4f(_0x3055d1[_0x8399('0x25')]['message']);}logger[_0x8399('0x25')](_0x8399('0x20'),_0x42c3b9,_0x3055d1[_0x8399('0x25')][_0x8399('0x26')]);return _0x4cd176(_0x3055d1[_0x8399('0x25')]['message']);}else{logger['info'](_0x8399('0x20'),_0x42c3b9,_0x8399('0x21'));_0x4cd176(_0x3055d1[_0x8399('0x27')][_0x8399('0x26')]);}})[_0x8399('0x28')](function(_0x28e257){logger[_0x8399('0x25')](_0x8399('0x20'),_0x42c3b9,_0x28e257);_0xad1d4f(_0x28e257);});});}function respondWithStatusCode(_0x59cbc0,_0x834251){_0x834251=_0x834251||0xcc;return function(_0x557b82){if(_0x557b82){return _0x59cbc0[_0x8399('0x29')](_0x834251);}return _0x59cbc0['status'](_0x834251)['end']();};}function respondWithResult(_0x10570a,_0xa996b9){_0xa996b9=_0xa996b9||0xc8;return function(_0x44cb8a){if(_0x44cb8a){return _0x10570a[_0x8399('0x2a')](_0xa996b9)[_0x8399('0x2b')](_0x44cb8a);}};}function respondWithFilteredResult(_0x3dd067,_0x56e9fd){return function(_0x100b58){if(_0x100b58){var _0x1c8549=_0x100b58[_0x8399('0x2c')],_0x1144fa=_0x56e9fd[_0x8399('0x2d')],_0x2c788c=_0x56e9fd[_0x8399('0x2d')]+_0x56e9fd[_0x8399('0x2e')],_0x3f125f;if(_0x2c788c>=_0x1c8549){_0x2c788c=_0x1c8549;_0x3f125f=0xc8;}else{_0x3f125f=0xce;}_0x3dd067[_0x8399('0x2a')](_0x3f125f);return _0x3dd067['set'](_0x8399('0x2f'),_0x1144fa+'-'+_0x2c788c+'/'+_0x1c8549)['json'](_0x100b58);}return null;};}function patchUpdates(_0x56db18){return function(_0x276d2d){try{jsonpatch[_0x8399('0x30')](_0x276d2d,_0x56db18,!![]);}catch(_0x2531f2){return BPromise[_0x8399('0x31')](_0x2531f2);}return _0x276d2d['save']();};}function saveUpdates(_0x5b63b5,_0x3f5d7a){return function(_0x884c7c){if(_0x884c7c){return _0x884c7c[_0x8399('0x32')](_0x5b63b5)[_0x8399('0x1e')](function(_0x59d3ef){return _0x59d3ef;});}return null;};}function removeEntity(_0x5201c4,_0x1079eb){return function(_0x4a607e){if(_0x4a607e){return _0x4a607e[_0x8399('0x33')]()[_0x8399('0x1e')](function(){_0x5201c4[_0x8399('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x228f76,_0x14af40){return function(_0x2260ff){if(!_0x2260ff){_0x228f76[_0x8399('0x29')](0x194);}return _0x2260ff;};}function handleError(_0x2e90f3,_0x593fe6){_0x593fe6=_0x593fe6||0x1f4;return function(_0x5f34ed){logger[_0x8399('0x25')](_0x5f34ed['stack']);if(_0x5f34ed[_0x8399('0x34')]){delete _0x5f34ed[_0x8399('0x34')];}_0x2e90f3[_0x8399('0x2a')](_0x593fe6)[_0x8399('0x35')](_0x5f34ed);};}exports[_0x8399('0x36')]=function(_0x1f3a2e,_0x1df595){var _0x3c7636={},_0x336c9d={},_0x2c3b5d={'count':0x0,'rows':[]};var _0x4e6d36=_[_0x8399('0x37')](db['SugarcrmConfiguration']['rawAttributes'],function(_0x45eb32){return{'name':_0x45eb32[_0x8399('0x38')],'type':_0x45eb32[_0x8399('0x39')][_0x8399('0x3a')]};});_0x336c9d[_0x8399('0x3b')]=_[_0x8399('0x37')](_0x4e6d36,_0x8399('0x34'));_0x336c9d[_0x8399('0x3c')]=_['keys'](_0x1f3a2e['query']);_0x336c9d[_0x8399('0x3d')]=_[_0x8399('0x3e')](_0x336c9d[_0x8399('0x3b')],_0x336c9d[_0x8399('0x3c')]);_0x3c7636[_0x8399('0x3f')]=_[_0x8399('0x3e')](_0x336c9d[_0x8399('0x3b')],qs[_0x8399('0x40')](_0x1f3a2e[_0x8399('0x3c')]['fields']));_0x3c7636[_0x8399('0x3f')]=_0x3c7636[_0x8399('0x3f')][_0x8399('0x41')]?_0x3c7636['attributes']:_0x336c9d['model'];if(!_0x1f3a2e[_0x8399('0x3c')][_0x8399('0x42')](_0x8399('0x43'))){_0x3c7636[_0x8399('0x2e')]=qs[_0x8399('0x2e')](_0x1f3a2e[_0x8399('0x3c')][_0x8399('0x2e')]);_0x3c7636['offset']=qs[_0x8399('0x2d')](_0x1f3a2e['query'][_0x8399('0x2d')]);}_0x3c7636['order']=qs['sort'](_0x1f3a2e['query']['sort']);_0x3c7636[_0x8399('0x44')]=qs[_0x8399('0x3d')](_[_0x8399('0x45')](_0x1f3a2e[_0x8399('0x3c')],_0x336c9d['filters']),_0x4e6d36);if(_0x1f3a2e[_0x8399('0x3c')][_0x8399('0x46')]){_0x3c7636[_0x8399('0x44')]=_[_0x8399('0x47')](_0x3c7636[_0x8399('0x44')],{'$or':_['map'](_0x4e6d36,function(_0xea154b){if(_0xea154b[_0x8399('0x39')]!==_0x8399('0x48')){var _0x2ccc26={};_0x2ccc26[_0xea154b['name']]={'$like':'%'+_0x1f3a2e[_0x8399('0x3c')][_0x8399('0x46')]+'%'};return _0x2ccc26;}})});}_0x3c7636=_['merge']({},_0x3c7636,_0x1f3a2e[_0x8399('0x49')]);var _0x4111a8={'where':_0x3c7636['where']};return db[_0x8399('0x4a')][_0x8399('0x2c')](_0x4111a8)[_0x8399('0x1e')](function(_0x4bd7b2){_0x2c3b5d[_0x8399('0x2c')]=_0x4bd7b2;if(_0x1f3a2e[_0x8399('0x3c')][_0x8399('0x4b')]){_0x3c7636['include']=[{'all':!![]}];}return db['SugarcrmConfiguration']['findAll'](_0x3c7636);})[_0x8399('0x1e')](function(_0x1fe27a){_0x2c3b5d['rows']=_0x1fe27a;return _0x2c3b5d;})[_0x8399('0x1e')](respondWithFilteredResult(_0x1df595,_0x3c7636))['catch'](handleError(_0x1df595,null));};exports[_0x8399('0x4c')]=function(_0x1c4988,_0x2276f9){var _0xba8f88={'raw':![],'where':{'id':_0x1c4988[_0x8399('0x4d')]['id']}},_0x512905={};_0x512905['model']=_[_0x8399('0x4e')](db[_0x8399('0x4a')]['rawAttributes']);_0x512905[_0x8399('0x3c')]=_['keys'](_0x1c4988[_0x8399('0x3c')]);_0x512905['filters']=_[_0x8399('0x3e')](_0x512905[_0x8399('0x3b')],_0x512905[_0x8399('0x3c')]);_0xba8f88[_0x8399('0x3f')]=_['intersection'](_0x512905[_0x8399('0x3b')],qs[_0x8399('0x40')](_0x1c4988['query'][_0x8399('0x40')]));_0xba8f88[_0x8399('0x3f')]=_0xba8f88[_0x8399('0x3f')][_0x8399('0x41')]?_0xba8f88[_0x8399('0x3f')]:_0x512905[_0x8399('0x3b')];if(_0x1c4988[_0x8399('0x3c')][_0x8399('0x4b')]){_0xba8f88[_0x8399('0x4f')]=[{'all':!![]}];}_0xba8f88=_['merge']({},_0xba8f88,_0x1c4988['options']);return db[_0x8399('0x4a')][_0x8399('0x50')](_0xba8f88)[_0x8399('0x1e')](handleEntityNotFound(_0x2276f9,null))[_0x8399('0x1e')](respondWithResult(_0x2276f9,null))[_0x8399('0x28')](handleError(_0x2276f9,null));};exports[_0x8399('0x51')]=function(_0x5cd35b,_0x30a328){return db[_0x8399('0x4a')][_0x8399('0x51')](_0x5cd35b['body'],{})[_0x8399('0x1e')](respondWithResult(_0x30a328,0xc9))[_0x8399('0x28')](handleError(_0x30a328,null));};exports[_0x8399('0x32')]=function(_0x1eb3b8,_0x18ad1a){if(_0x1eb3b8[_0x8399('0x52')]['id']){delete _0x1eb3b8['body']['id'];}return db[_0x8399('0x4a')][_0x8399('0x50')]({'where':{'id':_0x1eb3b8[_0x8399('0x4d')]['id']}})[_0x8399('0x1e')](handleEntityNotFound(_0x18ad1a,null))['then'](saveUpdates(_0x1eb3b8['body'],null))[_0x8399('0x1e')](respondWithResult(_0x18ad1a,null))[_0x8399('0x28')](handleError(_0x18ad1a,null));};exports[_0x8399('0x33')]=function(_0x31e556,_0x2dfe92){return db[_0x8399('0x4a')][_0x8399('0x50')]({'where':{'id':_0x31e556[_0x8399('0x4d')]['id']}})[_0x8399('0x1e')](handleEntityNotFound(_0x2dfe92,null))['then'](removeEntity(_0x2dfe92,null))['catch'](handleError(_0x2dfe92,null));};exports[_0x8399('0x53')]=function(_0x14391e,_0x2c8f66,_0x13918a){var _0xc2c750={};var _0x1d4368={};var _0x43ab32;var _0xa2610a;return db[_0x8399('0x4a')][_0x8399('0x54')]({'where':{'id':_0x14391e[_0x8399('0x4d')]['id']}})[_0x8399('0x1e')](handleEntityNotFound(_0x2c8f66,null))[_0x8399('0x1e')](function(_0x2126be){if(_0x2126be){_0x43ab32=_0x2126be;_0x1d4368[_0x8399('0x3b')]=_['keys'](db['SugarcrmField'][_0x8399('0x55')]);_0x1d4368[_0x8399('0x3c')]=_[_0x8399('0x4e')](_0x14391e[_0x8399('0x3c')]);_0x1d4368['filters']=_['intersection'](_0x1d4368['model'],_0x1d4368[_0x8399('0x3c')]);_0xc2c750[_0x8399('0x3f')]=_['intersection'](_0x1d4368[_0x8399('0x3b')],qs['fields'](_0x14391e[_0x8399('0x3c')][_0x8399('0x40')]));_0xc2c750[_0x8399('0x3f')]=_0xc2c750[_0x8399('0x3f')][_0x8399('0x41')]?_0xc2c750[_0x8399('0x3f')]:_0x1d4368[_0x8399('0x3b')];_0xc2c750[_0x8399('0x56')]=qs[_0x8399('0x57')](_0x14391e[_0x8399('0x3c')][_0x8399('0x57')]);_0xc2c750['where']=qs['filters'](_[_0x8399('0x45')](_0x14391e[_0x8399('0x3c')],_0x1d4368[_0x8399('0x3d')]));if(_0x14391e[_0x8399('0x3c')][_0x8399('0x46')]){_0xc2c750[_0x8399('0x44')]=_['merge'](_0xc2c750[_0x8399('0x44')],{'$or':_[_0x8399('0x37')](_0xc2c750['attributes'],function(_0xbec72c){var _0x26d7dc={};_0x26d7dc[_0xbec72c]={'$like':'%'+_0x14391e[_0x8399('0x3c')]['filter']+'%'};return _0x26d7dc;})});}_0xc2c750=_[_0x8399('0x47')]({},_0xc2c750,_0x14391e[_0x8399('0x49')]);return _0x43ab32[_0x8399('0x53')](_0xc2c750);}})['then'](function(_0x3c2cd5){if(_0x3c2cd5){_0xa2610a=_0x3c2cd5[_0x8399('0x41')];if(!_0x14391e['query'][_0x8399('0x42')](_0x8399('0x43'))){_0xc2c750[_0x8399('0x2e')]=qs[_0x8399('0x2e')](_0x14391e['query']['limit']);_0xc2c750['offset']=qs['offset'](_0x14391e[_0x8399('0x3c')]['offset']);}return _0x43ab32[_0x8399('0x53')](_0xc2c750);}})[_0x8399('0x1e')](function(_0x1c22a3){if(_0x1c22a3){return _0x1c22a3?{'count':_0xa2610a,'rows':_0x1c22a3}:null;}})['then'](respondWithResult(_0x2c8f66,null))[_0x8399('0x28')](handleError(_0x2c8f66,null));};exports[_0x8399('0x58')]=function(_0x284a45,_0x1adc60,_0x2b347b){var _0x38769c={};var _0x4b47e9={};var _0x4d6518;var _0x3fa69c;return db[_0x8399('0x4a')][_0x8399('0x54')]({'where':{'id':_0x284a45[_0x8399('0x4d')]['id']}})[_0x8399('0x1e')](handleEntityNotFound(_0x1adc60,null))['then'](function(_0x4181b2){if(_0x4181b2){_0x4d6518=_0x4181b2;_0x4b47e9[_0x8399('0x3b')]=_[_0x8399('0x4e')](db[_0x8399('0x59')][_0x8399('0x55')]);_0x4b47e9[_0x8399('0x3c')]=_[_0x8399('0x4e')](_0x284a45[_0x8399('0x3c')]);_0x4b47e9[_0x8399('0x3d')]=_['intersection'](_0x4b47e9[_0x8399('0x3b')],_0x4b47e9[_0x8399('0x3c')]);_0x38769c[_0x8399('0x3f')]=_[_0x8399('0x3e')](_0x4b47e9[_0x8399('0x3b')],qs[_0x8399('0x40')](_0x284a45['query'][_0x8399('0x40')]));_0x38769c['attributes']=_0x38769c['attributes']['length']?_0x38769c[_0x8399('0x3f')]:_0x4b47e9['model'];_0x38769c['order']=qs[_0x8399('0x57')](_0x284a45[_0x8399('0x3c')][_0x8399('0x57')]);_0x38769c['where']=qs[_0x8399('0x3d')](_[_0x8399('0x45')](_0x284a45[_0x8399('0x3c')],_0x4b47e9[_0x8399('0x3d')]));if(_0x284a45[_0x8399('0x3c')][_0x8399('0x46')]){_0x38769c[_0x8399('0x44')]=_[_0x8399('0x47')](_0x38769c[_0x8399('0x44')],{'$or':_[_0x8399('0x37')](_0x38769c[_0x8399('0x3f')],function(_0x35315a){var _0x57f22b={};_0x57f22b[_0x35315a]={'$like':'%'+_0x284a45[_0x8399('0x3c')][_0x8399('0x46')]+'%'};return _0x57f22b;})});}_0x38769c=_['merge']({},_0x38769c,_0x284a45[_0x8399('0x49')]);return _0x4d6518[_0x8399('0x58')](_0x38769c);}})[_0x8399('0x1e')](function(_0x210f0a){if(_0x210f0a){_0x3fa69c=_0x210f0a[_0x8399('0x41')];if(!_0x284a45[_0x8399('0x3c')][_0x8399('0x42')](_0x8399('0x43'))){_0x38769c[_0x8399('0x2e')]=qs[_0x8399('0x2e')](_0x284a45[_0x8399('0x3c')][_0x8399('0x2e')]);_0x38769c[_0x8399('0x2d')]=qs[_0x8399('0x2d')](_0x284a45[_0x8399('0x3c')][_0x8399('0x2d')]);}return _0x4d6518[_0x8399('0x58')](_0x38769c);}})['then'](function(_0x43089e){if(_0x43089e){return _0x43089e?{'count':_0x3fa69c,'rows':_0x43089e}:null;}})['then'](respondWithResult(_0x1adc60,null))[_0x8399('0x28')](handleError(_0x1adc60,null));};exports['getDescriptions']=function(_0x3ba7aa,_0x174e34,_0xa75fff){var _0x48a5ba={};var _0x2588f5={};var _0x7cb138;var _0x5207da;return db['SugarcrmConfiguration'][_0x8399('0x54')]({'where':{'id':_0x3ba7aa[_0x8399('0x4d')]['id']}})[_0x8399('0x1e')](handleEntityNotFound(_0x174e34,null))[_0x8399('0x1e')](function(_0x2aa9cc){if(_0x2aa9cc){_0x7cb138=_0x2aa9cc;_0x2588f5[_0x8399('0x3b')]=_[_0x8399('0x4e')](db['SugarcrmField'][_0x8399('0x55')]);_0x2588f5[_0x8399('0x3c')]=_['keys'](_0x3ba7aa[_0x8399('0x3c')]);_0x2588f5[_0x8399('0x3d')]=_[_0x8399('0x3e')](_0x2588f5['model'],_0x2588f5[_0x8399('0x3c')]);_0x48a5ba['attributes']=_[_0x8399('0x3e')](_0x2588f5['model'],qs[_0x8399('0x40')](_0x3ba7aa[_0x8399('0x3c')][_0x8399('0x40')]));_0x48a5ba[_0x8399('0x3f')]=_0x48a5ba[_0x8399('0x3f')][_0x8399('0x41')]?_0x48a5ba[_0x8399('0x3f')]:_0x2588f5[_0x8399('0x3b')];_0x48a5ba[_0x8399('0x56')]=qs['sort'](_0x3ba7aa[_0x8399('0x3c')][_0x8399('0x57')]);_0x48a5ba[_0x8399('0x44')]=qs[_0x8399('0x3d')](_[_0x8399('0x45')](_0x3ba7aa[_0x8399('0x3c')],_0x2588f5[_0x8399('0x3d')]));if(_0x3ba7aa[_0x8399('0x3c')][_0x8399('0x46')]){_0x48a5ba[_0x8399('0x44')]=_[_0x8399('0x47')](_0x48a5ba['where'],{'$or':_['map'](_0x48a5ba['attributes'],function(_0x55c534){var _0x5f1d4a={};_0x5f1d4a[_0x55c534]={'$like':'%'+_0x3ba7aa['query'][_0x8399('0x46')]+'%'};return _0x5f1d4a;})});}_0x48a5ba=_['merge']({},_0x48a5ba,_0x3ba7aa['options']);return _0x7cb138['getDescriptions'](_0x48a5ba);}})[_0x8399('0x1e')](function(_0x1190e3){if(_0x1190e3){_0x5207da=_0x1190e3['length'];if(!_0x3ba7aa['query']['hasOwnProperty'](_0x8399('0x43'))){_0x48a5ba['limit']=qs['limit'](_0x3ba7aa[_0x8399('0x3c')]['limit']);_0x48a5ba['offset']=qs[_0x8399('0x2d')](_0x3ba7aa[_0x8399('0x3c')]['offset']);}return _0x7cb138['getDescriptions'](_0x48a5ba);}})[_0x8399('0x1e')](function(_0x5b2d91){if(_0x5b2d91){return _0x5b2d91?{'count':_0x5207da,'rows':_0x5b2d91}:null;}})[_0x8399('0x1e')](respondWithResult(_0x174e34,null))[_0x8399('0x28')](handleError(_0x174e34,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 0dea4c0..9bd8589 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 _0x46d9=['int_sugarcrm_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration'];(function(_0x19a90e,_0xe14b0b){var _0xa49b11=function(_0x560f76){while(--_0x560f76){_0x19a90e['push'](_0x19a90e['shift']());}};_0xa49b11(++_0xe14b0b);}(_0x46d9,0x16d));var _0x946d=function(_0x3d65ff,_0x33d4ce){_0x3d65ff=_0x3d65ff-0x0;var _0x439740=_0x46d9[_0x3d65ff];return _0x439740;};'use strict';var _=require(_0x946d('0x0'));var util=require(_0x946d('0x1'));var logger=require(_0x946d('0x2'))(_0x946d('0x3'));var moment=require('moment');var BPromise=require(_0x946d('0x4'));var rp=require(_0x946d('0x5'));var fs=require('fs');var path=require(_0x946d('0x6'));var rimraf=require(_0x946d('0x7'));var config=require('../../config/environment');var attributes=require(_0x946d('0x8'));module[_0x946d('0x9')]=function(_0x583c91,_0x21b6e7){return _0x583c91[_0x946d('0xa')](_0x946d('0xb'),attributes,{'tableName':_0x946d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c6b=['bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x51a645,_0xa9458d){var _0x3e6d1b=function(_0x53bc9b){while(--_0x53bc9b){_0x51a645['push'](_0x51a645['shift']());}};_0x3e6d1b(++_0xa9458d);}(_0x3c6b,0x91));var _0xb3c6=function(_0x970068,_0x3e4142){_0x970068=_0x970068-0x0;var _0x51063d=_0x3c6b[_0x970068];return _0x51063d;};'use strict';var _=require(_0xb3c6('0x0'));var util=require(_0xb3c6('0x1'));var logger=require(_0xb3c6('0x2'))(_0xb3c6('0x3'));var moment=require(_0xb3c6('0x4'));var BPromise=require(_0xb3c6('0x5'));var rp=require(_0xb3c6('0x6'));var fs=require('fs');var path=require(_0xb3c6('0x7'));var rimraf=require(_0xb3c6('0x8'));var config=require(_0xb3c6('0x9'));var attributes=require(_0xb3c6('0xa'));module[_0xb3c6('0xb')]=function(_0x223f9b,_0x5f5a23){return _0x223f9b[_0xb3c6('0xc')](_0xb3c6('0xd'),attributes,{'tableName':_0xb3c6('0xe'),'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 dd38052..112542e 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 _0x61b6=['jayson/promise','client','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1300b6,_0x1b4efe){var _0x23a0e3=function(_0x22ae84){while(--_0x22ae84){_0x1300b6['push'](_0x1300b6['shift']());}};_0x23a0e3(++_0x1b4efe);}(_0x61b6,0xfa));var _0x661b=function(_0x2e3554,_0x32a66d){_0x2e3554=_0x2e3554-0x0;var _0x3870d2=_0x61b6[_0x2e3554];return _0x3870d2;};'use strict';var _=require(_0x661b('0x0'));var util=require(_0x661b('0x1'));var moment=require(_0x661b('0x2'));var BPromise=require(_0x661b('0x3'));var rs=require(_0x661b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x661b('0x5'))['db'];var utils=require(_0x661b('0x6'));var logger=require(_0x661b('0x7'))(_0x661b('0x8'));var config=require(_0x661b('0x9'));var jayson=require(_0x661b('0xa'));var client=jayson[_0x661b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2913a0,_0x405d96,_0x548c29){return new BPromise(function(_0x3e959f,_0x129041){return client['request'](_0x2913a0,_0x548c29)[_0x661b('0xc')](function(_0x1f2a8a){logger['info'](_0x661b('0xd'),_0x405d96,_0x661b('0xe'));logger[_0x661b('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x405d96,_0x661b('0xe'),JSON['stringify'](_0x1f2a8a));if(_0x1f2a8a[_0x661b('0x10')]){if(_0x1f2a8a[_0x661b('0x10')][_0x661b('0x11')]===0x1f4){logger[_0x661b('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x405d96,_0x1f2a8a['error'][_0x661b('0x12')]);return _0x129041(_0x1f2a8a[_0x661b('0x10')]['message']);}logger[_0x661b('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x405d96,_0x1f2a8a[_0x661b('0x10')]['message']);return _0x3e959f(_0x1f2a8a[_0x661b('0x10')][_0x661b('0x12')]);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x405d96,'request\x20sent');_0x3e959f(_0x1f2a8a[_0x661b('0x13')][_0x661b('0x12')]);}})['catch'](function(_0x29ee53){logger['error'](_0x661b('0xd'),_0x405d96,_0x29ee53);_0x129041(_0x29ee53);});});} \ No newline at end of file +var _0xf2ba=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x4b8701,_0x138308){var _0x27c0a7=function(_0x4e0d0a){while(--_0x4e0d0a){_0x4b8701['push'](_0x4b8701['shift']());}};_0x27c0a7(++_0x138308);}(_0xf2ba,0x65));var _0xaf2b=function(_0x386b03,_0x5d0000){_0x386b03=_0x386b03-0x0;var _0xd3d524=_0xf2ba[_0x386b03];return _0xd3d524;};'use strict';var _=require(_0xaf2b('0x0'));var util=require(_0xaf2b('0x1'));var moment=require('moment');var BPromise=require(_0xaf2b('0x2'));var rs=require(_0xaf2b('0x3'));var fs=require('fs');var Redis=require(_0xaf2b('0x4'));var db=require(_0xaf2b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaf2b('0x6'))(_0xaf2b('0x7'));var config=require('../../config/environment');var jayson=require(_0xaf2b('0x8'));var client=jayson[_0xaf2b('0x9')][_0xaf2b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52bea1,_0x388946,_0x143c95){return new BPromise(function(_0x1f0a68,_0x4b9654){return client[_0xaf2b('0xb')](_0x52bea1,_0x143c95)['then'](function(_0x496379){logger[_0xaf2b('0xc')](_0xaf2b('0xd'),_0x388946,_0xaf2b('0xe'));logger['debug']('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x388946,_0xaf2b('0xe'),JSON[_0xaf2b('0xf')](_0x496379));if(_0x496379['error']){if(_0x496379[_0xaf2b('0x10')][_0xaf2b('0x11')]===0x1f4){logger[_0xaf2b('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x388946,_0x496379[_0xaf2b('0x10')][_0xaf2b('0x12')]);return _0x4b9654(_0x496379[_0xaf2b('0x10')][_0xaf2b('0x12')]);}logger[_0xaf2b('0x10')](_0xaf2b('0xd'),_0x388946,_0x496379[_0xaf2b('0x10')][_0xaf2b('0x12')]);return _0x1f0a68(_0x496379[_0xaf2b('0x10')][_0xaf2b('0x12')]);}else{logger['info'](_0xaf2b('0xd'),_0x388946,_0xaf2b('0xe'));_0x1f0a68(_0x496379[_0xaf2b('0x13')][_0xaf2b('0x12')]);}})[_0xaf2b('0x14')](function(_0x526759){logger[_0xaf2b('0x10')](_0xaf2b('0xd'),_0x388946,_0x526759);_0x4b9654(_0x526759);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 49a6af9..26f91e3 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 _0x7d8b=['../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','/:id','show','create','update','delete','destroy','multer','path','express'];(function(_0x31b8e4,_0x4613a8){var _0x53ffd0=function(_0x31b8e7){while(--_0x31b8e7){_0x31b8e4['push'](_0x31b8e4['shift']());}};_0x53ffd0(++_0x4613a8);}(_0x7d8b,0x10e));var _0xb7d8=function(_0x403c8d,_0x5e3825){_0x403c8d=_0x403c8d-0x0;var _0x4ca60d=_0x7d8b[_0x403c8d];return _0x4ca60d;};'use strict';var multer=require(_0xb7d8('0x0'));var util=require('util');var path=require(_0xb7d8('0x1'));var timeout=require('connect-timeout');var express=require(_0xb7d8('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb7d8('0x3'));var controller=require(_0xb7d8('0x4'));router[_0xb7d8('0x5')]('/',auth[_0xb7d8('0x6')](),controller['index']);router[_0xb7d8('0x5')](_0xb7d8('0x7'),auth[_0xb7d8('0x6')](),controller[_0xb7d8('0x8')]);router['post']('/',auth[_0xb7d8('0x6')](),controller[_0xb7d8('0x9')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xb7d8('0xa')]);router[_0xb7d8('0xb')](_0xb7d8('0x7'),auth['isAuthenticated'](),controller[_0xb7d8('0xc')]);module['exports']=router; \ No newline at end of file +var _0xe4b3=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','get','index','/:id','show','isAuthenticated','create','put'];(function(_0x207393,_0x494bb9){var _0x1a48b1=function(_0x22f33c){while(--_0x22f33c){_0x207393['push'](_0x207393['shift']());}};_0x1a48b1(++_0x494bb9);}(_0xe4b3,0xae));var _0x3e4b=function(_0x4568b7,_0x2f8c0b){_0x4568b7=_0x4568b7-0x0;var _0x1fd2c8=_0xe4b3[_0x4568b7];return _0x1fd2c8;};'use strict';var multer=require(_0x3e4b('0x0'));var util=require(_0x3e4b('0x1'));var path=require(_0x3e4b('0x2'));var timeout=require(_0x3e4b('0x3'));var express=require(_0x3e4b('0x4'));var router=express[_0x3e4b('0x5')]();var auth=require(_0x3e4b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3e4b('0x7'));var controller=require(_0x3e4b('0x8'));router[_0x3e4b('0x9')]('/',auth['isAuthenticated'](),controller[_0x3e4b('0xa')]);router[_0x3e4b('0x9')](_0x3e4b('0xb'),auth['isAuthenticated'](),controller[_0x3e4b('0xc')]);router['post']('/',auth[_0x3e4b('0xd')](),controller[_0x3e4b('0xe')]);router[_0x3e4b('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x3e4b('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x3e4b('0x11')]);module[_0x3e4b('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 30db68f..32d874f 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 _0x1c5b=['variable','STRING','BOOLEAN','ENUM','string'];(function(_0x36f4b4,_0x260f17){var _0x46b4a8=function(_0x516a65){while(--_0x516a65){_0x36f4b4['push'](_0x36f4b4['shift']());}};_0x46b4a8(++_0x260f17);}(_0x1c5b,0x184));var _0xb1c5=function(_0x54aee5,_0x3bf93e){_0x54aee5=_0x54aee5-0x0;var _0xb9d998=_0x1c5b[_0x54aee5];return _0xb9d998;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xb1c5('0x0')](_0xb1c5('0x1'),_0xb1c5('0x2'),'customVariable','keyValue'),'defaultValue':_0xb1c5('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xb1c5('0x3')]},'keyType':{'type':Sequelize[_0xb1c5('0x0')](_0xb1c5('0x1'),_0xb1c5('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0xb1c5('0x3')]},'idField':{'type':Sequelize[_0xb1c5('0x3')]},'nameField':{'type':Sequelize[_0xb1c5('0x3')]},'customField':{'type':Sequelize[_0xb1c5('0x4')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb1c5('0x3')]}}; \ No newline at end of file +var _0xad26=['sequelize','ENUM','string','variable','customVariable','STRING','BOOLEAN'];(function(_0x529fe8,_0x3b5196){var _0x5d45e5=function(_0x31a939){while(--_0x31a939){_0x529fe8['push'](_0x529fe8['shift']());}};_0x5d45e5(++_0x3b5196);}(_0xad26,0x1ab));var _0x6ad2=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xad26[_0x18ab2a];return _0x16dcee;};'use strict';var Sequelize=require(_0x6ad2('0x0'));module['exports']={'type':{'type':Sequelize[_0x6ad2('0x1')](_0x6ad2('0x2'),_0x6ad2('0x3'),_0x6ad2('0x4'),'keyValue'),'defaultValue':_0x6ad2('0x2')},'content':{'type':Sequelize[_0x6ad2('0x5')]},'key':{'type':Sequelize[_0x6ad2('0x5')]},'keyType':{'type':Sequelize[_0x6ad2('0x1')](_0x6ad2('0x2'),'variable',_0x6ad2('0x4'))},'keyContent':{'type':Sequelize[_0x6ad2('0x5')]},'idField':{'type':Sequelize[_0x6ad2('0x5')]},'nameField':{'type':Sequelize[_0x6ad2('0x5')]},'customField':{'type':Sequelize[_0x6ad2('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 3b41db7..e45ccca 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 _0xabc8=['bluebird','util','path','to-csv','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','map','SugarcrmField','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','html-pdf','rimraf','fast-json-patch','request-promise','moment'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0xabc8,0x117));var _0x8abc=function(_0x37a7c6,_0x3a84b6){_0x37a7c6=_0x37a7c6-0x0;var _0x539905=_0xabc8[_0x37a7c6];return _0x539905;};'use strict';var pdf=require(_0x8abc('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8abc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8abc('0x2'));var rp=require(_0x8abc('0x3'));var moment=require(_0x8abc('0x4'));var BPromise=require(_0x8abc('0x5'));var Mustache=require('mustache');var util=require(_0x8abc('0x6'));var path=require(_0x8abc('0x7'));var sox=require('sox');var csv=require(_0x8abc('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8abc('0x9'));var deskjs=require(_0x8abc('0xa'));var toCsv=require(_0x8abc('0x8'));var querystring=require(_0x8abc('0xb'));var Papa=require('papaparse');var Redis=require(_0x8abc('0xc'));var authService=require(_0x8abc('0xd'));var qs=require(_0x8abc('0xe'));var as=require(_0x8abc('0xf'));var hardwareService=require(_0x8abc('0x10'));var logger=require(_0x8abc('0x11'))(_0x8abc('0x12'));var utils=require(_0x8abc('0x13'));var config=require(_0x8abc('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x569c7a,_0x47af3e){_0x47af3e=_0x47af3e||0xcc;return function(_0xa17c2e){if(_0xa17c2e){return _0x569c7a['sendStatus'](_0x47af3e);}return _0x569c7a[_0x8abc('0x15')](_0x47af3e)['end']();};}function respondWithResult(_0x3e3354,_0x5c4402){_0x5c4402=_0x5c4402||0xc8;return function(_0x4bd87a){if(_0x4bd87a){return _0x3e3354[_0x8abc('0x15')](_0x5c4402)[_0x8abc('0x16')](_0x4bd87a);}};}function respondWithFilteredResult(_0x18459a,_0x531638){return function(_0x316ef5){if(_0x316ef5){var _0x409874=_0x316ef5[_0x8abc('0x17')],_0x1a384c=_0x531638[_0x8abc('0x18')],_0x249b43=_0x531638[_0x8abc('0x18')]+_0x531638[_0x8abc('0x19')],_0x14922c;if(_0x249b43>=_0x409874){_0x249b43=_0x409874;_0x14922c=0xc8;}else{_0x14922c=0xce;}_0x18459a['status'](_0x14922c);return _0x18459a[_0x8abc('0x1a')](_0x8abc('0x1b'),_0x1a384c+'-'+_0x249b43+'/'+_0x409874)[_0x8abc('0x16')](_0x316ef5);}return null;};}function patchUpdates(_0x499702){return function(_0xd91d85){try{jsonpatch[_0x8abc('0x1c')](_0xd91d85,_0x499702,!![]);}catch(_0x56a87c){return BPromise[_0x8abc('0x1d')](_0x56a87c);}return _0xd91d85[_0x8abc('0x1e')]();};}function saveUpdates(_0xa03d3f,_0x53a8bb){return function(_0x502913){if(_0x502913){return _0x502913[_0x8abc('0x1f')](_0xa03d3f)[_0x8abc('0x20')](function(_0x40ec60){return _0x40ec60;});}return null;};}function removeEntity(_0x1f1984,_0xcd3afe){return function(_0x14b990){if(_0x14b990){return _0x14b990[_0x8abc('0x21')]()[_0x8abc('0x20')](function(){_0x1f1984[_0x8abc('0x15')](0xcc)[_0x8abc('0x22')]();});}};}function handleEntityNotFound(_0x2d67a3,_0x248c5c){return function(_0x58f5a6){if(!_0x58f5a6){_0x2d67a3[_0x8abc('0x23')](0x194);}return _0x58f5a6;};}function handleError(_0x49c4c1,_0x137536){_0x137536=_0x137536||0x1f4;return function(_0x48743b){logger[_0x8abc('0x24')](_0x48743b[_0x8abc('0x25')]);if(_0x48743b[_0x8abc('0x26')]){delete _0x48743b[_0x8abc('0x26')];}_0x49c4c1[_0x8abc('0x15')](_0x137536)['send'](_0x48743b);};}exports['index']=function(_0x7a79b,_0x46eb8f){var _0x219e0b={},_0x5ca550={},_0x81bc01={'count':0x0,'rows':[]};var _0x473f46=_[_0x8abc('0x27')](db[_0x8abc('0x28')][_0x8abc('0x29')],function(_0x414e7c){return{'name':_0x414e7c[_0x8abc('0x2a')],'type':_0x414e7c[_0x8abc('0x2b')]['key']};});_0x5ca550[_0x8abc('0x2c')]=_['map'](_0x473f46,_0x8abc('0x26'));_0x5ca550['query']=_[_0x8abc('0x2d')](_0x7a79b[_0x8abc('0x2e')]);_0x5ca550[_0x8abc('0x2f')]=_[_0x8abc('0x30')](_0x5ca550[_0x8abc('0x2c')],_0x5ca550[_0x8abc('0x2e')]);_0x219e0b[_0x8abc('0x31')]=_['intersection'](_0x5ca550['model'],qs[_0x8abc('0x32')](_0x7a79b[_0x8abc('0x2e')]['fields']));_0x219e0b['attributes']=_0x219e0b['attributes'][_0x8abc('0x33')]?_0x219e0b[_0x8abc('0x31')]:_0x5ca550[_0x8abc('0x2c')];if(!_0x7a79b[_0x8abc('0x2e')][_0x8abc('0x34')]('nolimit')){_0x219e0b[_0x8abc('0x19')]=qs['limit'](_0x7a79b[_0x8abc('0x2e')][_0x8abc('0x19')]);_0x219e0b[_0x8abc('0x18')]=qs['offset'](_0x7a79b[_0x8abc('0x2e')][_0x8abc('0x18')]);}_0x219e0b[_0x8abc('0x35')]=qs[_0x8abc('0x36')](_0x7a79b[_0x8abc('0x2e')][_0x8abc('0x36')]);_0x219e0b['where']=qs[_0x8abc('0x2f')](_[_0x8abc('0x37')](_0x7a79b['query'],_0x5ca550[_0x8abc('0x2f')]),_0x473f46);if(_0x7a79b['query'][_0x8abc('0x38')]){_0x219e0b[_0x8abc('0x39')]=_[_0x8abc('0x3a')](_0x219e0b['where'],{'$or':_[_0x8abc('0x27')](_0x473f46,function(_0x1c07d4){if(_0x1c07d4['type']!==_0x8abc('0x3b')){var _0x4e7fe5={};_0x4e7fe5[_0x1c07d4[_0x8abc('0x26')]]={'$like':'%'+_0x7a79b[_0x8abc('0x2e')][_0x8abc('0x38')]+'%'};return _0x4e7fe5;}})});}_0x219e0b=_[_0x8abc('0x3a')]({},_0x219e0b,_0x7a79b[_0x8abc('0x3c')]);var _0x5e77a8={'where':_0x219e0b[_0x8abc('0x39')]};return db[_0x8abc('0x28')][_0x8abc('0x17')](_0x5e77a8)[_0x8abc('0x20')](function(_0x50ff62){_0x81bc01[_0x8abc('0x17')]=_0x50ff62;if(_0x7a79b[_0x8abc('0x2e')][_0x8abc('0x3d')]){_0x219e0b['include']=[{'all':!![]}];}return db[_0x8abc('0x28')][_0x8abc('0x3e')](_0x219e0b);})[_0x8abc('0x20')](function(_0x44272c){_0x81bc01[_0x8abc('0x3f')]=_0x44272c;return _0x81bc01;})[_0x8abc('0x20')](respondWithFilteredResult(_0x46eb8f,_0x219e0b))[_0x8abc('0x40')](handleError(_0x46eb8f,null));};exports[_0x8abc('0x41')]=function(_0x11a09e,_0xc0ead3){var _0xe10830={'raw':!![],'where':{'id':_0x11a09e[_0x8abc('0x42')]['id']}},_0x880e1={};_0x880e1['model']=_[_0x8abc('0x2d')](db[_0x8abc('0x28')][_0x8abc('0x29')]);_0x880e1[_0x8abc('0x2e')]=_[_0x8abc('0x2d')](_0x11a09e['query']);_0x880e1[_0x8abc('0x2f')]=_[_0x8abc('0x30')](_0x880e1[_0x8abc('0x2c')],_0x880e1[_0x8abc('0x2e')]);_0xe10830[_0x8abc('0x31')]=_[_0x8abc('0x30')](_0x880e1[_0x8abc('0x2c')],qs[_0x8abc('0x32')](_0x11a09e[_0x8abc('0x2e')][_0x8abc('0x32')]));_0xe10830[_0x8abc('0x31')]=_0xe10830['attributes'][_0x8abc('0x33')]?_0xe10830[_0x8abc('0x31')]:_0x880e1[_0x8abc('0x2c')];if(_0x11a09e[_0x8abc('0x2e')][_0x8abc('0x3d')]){_0xe10830[_0x8abc('0x43')]=[{'all':!![]}];}_0xe10830=_[_0x8abc('0x3a')]({},_0xe10830,_0x11a09e['options']);return db[_0x8abc('0x28')][_0x8abc('0x44')](_0xe10830)[_0x8abc('0x20')](handleEntityNotFound(_0xc0ead3,null))['then'](respondWithResult(_0xc0ead3,null))[_0x8abc('0x40')](handleError(_0xc0ead3,null));};exports[_0x8abc('0x45')]=function(_0x440887,_0x26f70a){return db['SugarcrmField'][_0x8abc('0x45')](_0x440887[_0x8abc('0x46')],{})[_0x8abc('0x20')](respondWithResult(_0x26f70a,0xc9))[_0x8abc('0x40')](handleError(_0x26f70a,null));};exports['update']=function(_0x86654a,_0x128a1f){if(_0x86654a[_0x8abc('0x46')]['id']){delete _0x86654a[_0x8abc('0x46')]['id'];}return db[_0x8abc('0x28')]['find']({'where':{'id':_0x86654a[_0x8abc('0x42')]['id']}})[_0x8abc('0x20')](handleEntityNotFound(_0x128a1f,null))['then'](saveUpdates(_0x86654a[_0x8abc('0x46')],null))[_0x8abc('0x20')](respondWithResult(_0x128a1f,null))['catch'](handleError(_0x128a1f,null));};exports['destroy']=function(_0x2f0608,_0x449fd6){return db['SugarcrmField'][_0x8abc('0x44')]({'where':{'id':_0x2f0608[_0x8abc('0x42')]['id']}})['then'](handleEntityNotFound(_0x449fd6,null))[_0x8abc('0x20')](removeEntity(_0x449fd6,null))[_0x8abc('0x40')](handleError(_0x449fd6,null));}; \ No newline at end of file +var _0x7f31=['../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','then','destroy','error','stack','name','map','SugarcrmField','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','includeAll','include','findAll','show','rawAttributes','options','find','create','body','catch','update','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','ejs','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x5df2ff,_0x48300e){var _0x594f25=function(_0x1f5788){while(--_0x1f5788){_0x5df2ff['push'](_0x5df2ff['shift']());}};_0x594f25(++_0x48300e);}(_0x7f31,0x194));var _0x17f3=function(_0x59befa,_0x4af99b){_0x59befa=_0x59befa-0x0;var _0x1dd63d=_0x7f31[_0x59befa];return _0x1dd63d;};'use strict';var pdf=require(_0x17f3('0x0'));var emlformat=require(_0x17f3('0x1'));var rimraf=require(_0x17f3('0x2'));var zipdir=require(_0x17f3('0x3'));var jsonpatch=require(_0x17f3('0x4'));var rp=require('request-promise');var moment=require(_0x17f3('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x17f3('0x6'));var path=require(_0x17f3('0x7'));var sox=require(_0x17f3('0x8'));var csv=require('to-csv');var ejs=require(_0x17f3('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x17f3('0xa'));var crypto=require('crypto');var jsforce=require(_0x17f3('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x17f3('0xc'));var querystring=require(_0x17f3('0xd'));var Papa=require(_0x17f3('0xe'));var Redis=require(_0x17f3('0xf'));var authService=require(_0x17f3('0x10'));var qs=require(_0x17f3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x17f3('0x12'));var logger=require('../../config/logger')(_0x17f3('0x13'));var utils=require(_0x17f3('0x14'));var config=require(_0x17f3('0x15'));var db=require(_0x17f3('0x16'))['db'];function respondWithStatusCode(_0xd99fa1,_0x4fda29){_0x4fda29=_0x4fda29||0xcc;return function(_0x158ce9){if(_0x158ce9){return _0xd99fa1[_0x17f3('0x17')](_0x4fda29);}return _0xd99fa1[_0x17f3('0x18')](_0x4fda29)[_0x17f3('0x19')]();};}function respondWithResult(_0x29098a,_0x100008){_0x100008=_0x100008||0xc8;return function(_0x4ef7bf){if(_0x4ef7bf){return _0x29098a[_0x17f3('0x18')](_0x100008)[_0x17f3('0x1a')](_0x4ef7bf);}};}function respondWithFilteredResult(_0x2b8d0a,_0x453176){return function(_0x2b0d5d){if(_0x2b0d5d){var _0x42500f=_0x2b0d5d[_0x17f3('0x1b')],_0x5d2e1c=_0x453176[_0x17f3('0x1c')],_0x392028=_0x453176['offset']+_0x453176[_0x17f3('0x1d')],_0x215f5c;if(_0x392028>=_0x42500f){_0x392028=_0x42500f;_0x215f5c=0xc8;}else{_0x215f5c=0xce;}_0x2b8d0a[_0x17f3('0x18')](_0x215f5c);return _0x2b8d0a[_0x17f3('0x1e')]('Content-Range',_0x5d2e1c+'-'+_0x392028+'/'+_0x42500f)[_0x17f3('0x1a')](_0x2b0d5d);}return null;};}function patchUpdates(_0x361515){return function(_0x1cc03a){try{jsonpatch[_0x17f3('0x1f')](_0x1cc03a,_0x361515,!![]);}catch(_0x2972e9){return BPromise[_0x17f3('0x20')](_0x2972e9);}return _0x1cc03a['save']();};}function saveUpdates(_0x265b18,_0x2b8a1e){return function(_0x44d628){if(_0x44d628){return _0x44d628['update'](_0x265b18)[_0x17f3('0x21')](function(_0x58c735){return _0x58c735;});}return null;};}function removeEntity(_0x467730,_0x16a575){return function(_0x78aa9f){if(_0x78aa9f){return _0x78aa9f[_0x17f3('0x22')]()['then'](function(){_0x467730[_0x17f3('0x18')](0xcc)[_0x17f3('0x19')]();});}};}function handleEntityNotFound(_0x40c002,_0x3ef64f){return function(_0x5657e4){if(!_0x5657e4){_0x40c002[_0x17f3('0x17')](0x194);}return _0x5657e4;};}function handleError(_0x4cb711,_0x2fb03e){_0x2fb03e=_0x2fb03e||0x1f4;return function(_0x30b9f6){logger[_0x17f3('0x23')](_0x30b9f6[_0x17f3('0x24')]);if(_0x30b9f6[_0x17f3('0x25')]){delete _0x30b9f6['name'];}_0x4cb711[_0x17f3('0x18')](_0x2fb03e)['send'](_0x30b9f6);};}exports['index']=function(_0xfed94b,_0x1fcf50){var _0x4024b5={},_0x442514={},_0x5dabcd={'count':0x0,'rows':[]};var _0x90ae2b=_[_0x17f3('0x26')](db[_0x17f3('0x27')]['rawAttributes'],function(_0x5f10f9){return{'name':_0x5f10f9[_0x17f3('0x28')],'type':_0x5f10f9['type'][_0x17f3('0x29')]};});_0x442514[_0x17f3('0x2a')]=_[_0x17f3('0x26')](_0x90ae2b,_0x17f3('0x25'));_0x442514[_0x17f3('0x2b')]=_[_0x17f3('0x2c')](_0xfed94b[_0x17f3('0x2b')]);_0x442514['filters']=_[_0x17f3('0x2d')](_0x442514[_0x17f3('0x2a')],_0x442514['query']);_0x4024b5[_0x17f3('0x2e')]=_[_0x17f3('0x2d')](_0x442514[_0x17f3('0x2a')],qs[_0x17f3('0x2f')](_0xfed94b[_0x17f3('0x2b')]['fields']));_0x4024b5[_0x17f3('0x2e')]=_0x4024b5[_0x17f3('0x2e')][_0x17f3('0x30')]?_0x4024b5[_0x17f3('0x2e')]:_0x442514['model'];if(!_0xfed94b['query'][_0x17f3('0x31')]('nolimit')){_0x4024b5[_0x17f3('0x1d')]=qs['limit'](_0xfed94b[_0x17f3('0x2b')][_0x17f3('0x1d')]);_0x4024b5[_0x17f3('0x1c')]=qs['offset'](_0xfed94b[_0x17f3('0x2b')][_0x17f3('0x1c')]);}_0x4024b5[_0x17f3('0x32')]=qs[_0x17f3('0x33')](_0xfed94b[_0x17f3('0x2b')][_0x17f3('0x33')]);_0x4024b5[_0x17f3('0x34')]=qs[_0x17f3('0x35')](_[_0x17f3('0x36')](_0xfed94b[_0x17f3('0x2b')],_0x442514[_0x17f3('0x35')]),_0x90ae2b);if(_0xfed94b[_0x17f3('0x2b')]['filter']){_0x4024b5[_0x17f3('0x34')]=_[_0x17f3('0x37')](_0x4024b5['where'],{'$or':_[_0x17f3('0x26')](_0x90ae2b,function(_0x5f1098){if(_0x5f1098[_0x17f3('0x38')]!==_0x17f3('0x39')){var _0x18b3f8={};_0x18b3f8[_0x5f1098[_0x17f3('0x25')]]={'$like':'%'+_0xfed94b['query'][_0x17f3('0x3a')]+'%'};return _0x18b3f8;}})});}_0x4024b5=_['merge']({},_0x4024b5,_0xfed94b['options']);var _0x51d915={'where':_0x4024b5['where']};return db['SugarcrmField'][_0x17f3('0x1b')](_0x51d915)['then'](function(_0x41867d){_0x5dabcd['count']=_0x41867d;if(_0xfed94b[_0x17f3('0x2b')][_0x17f3('0x3b')]){_0x4024b5[_0x17f3('0x3c')]=[{'all':!![]}];}return db[_0x17f3('0x27')][_0x17f3('0x3d')](_0x4024b5);})[_0x17f3('0x21')](function(_0x3221f1){_0x5dabcd['rows']=_0x3221f1;return _0x5dabcd;})['then'](respondWithFilteredResult(_0x1fcf50,_0x4024b5))['catch'](handleError(_0x1fcf50,null));};exports[_0x17f3('0x3e')]=function(_0x31439b,_0x842d4a){var _0x2180af={'raw':!![],'where':{'id':_0x31439b['params']['id']}},_0x272ca4={};_0x272ca4[_0x17f3('0x2a')]=_[_0x17f3('0x2c')](db['SugarcrmField'][_0x17f3('0x3f')]);_0x272ca4[_0x17f3('0x2b')]=_['keys'](_0x31439b[_0x17f3('0x2b')]);_0x272ca4[_0x17f3('0x35')]=_['intersection'](_0x272ca4[_0x17f3('0x2a')],_0x272ca4[_0x17f3('0x2b')]);_0x2180af[_0x17f3('0x2e')]=_[_0x17f3('0x2d')](_0x272ca4[_0x17f3('0x2a')],qs[_0x17f3('0x2f')](_0x31439b[_0x17f3('0x2b')][_0x17f3('0x2f')]));_0x2180af[_0x17f3('0x2e')]=_0x2180af[_0x17f3('0x2e')][_0x17f3('0x30')]?_0x2180af[_0x17f3('0x2e')]:_0x272ca4['model'];if(_0x31439b[_0x17f3('0x2b')][_0x17f3('0x3b')]){_0x2180af['include']=[{'all':!![]}];}_0x2180af=_[_0x17f3('0x37')]({},_0x2180af,_0x31439b[_0x17f3('0x40')]);return db[_0x17f3('0x27')][_0x17f3('0x41')](_0x2180af)[_0x17f3('0x21')](handleEntityNotFound(_0x842d4a,null))[_0x17f3('0x21')](respondWithResult(_0x842d4a,null))['catch'](handleError(_0x842d4a,null));};exports[_0x17f3('0x42')]=function(_0x300876,_0x36318f){return db[_0x17f3('0x27')][_0x17f3('0x42')](_0x300876[_0x17f3('0x43')],{})[_0x17f3('0x21')](respondWithResult(_0x36318f,0xc9))[_0x17f3('0x44')](handleError(_0x36318f,null));};exports[_0x17f3('0x45')]=function(_0x41ff71,_0x5b31b7){if(_0x41ff71[_0x17f3('0x43')]['id']){delete _0x41ff71[_0x17f3('0x43')]['id'];}return db[_0x17f3('0x27')][_0x17f3('0x41')]({'where':{'id':_0x41ff71['params']['id']}})[_0x17f3('0x21')](handleEntityNotFound(_0x5b31b7,null))[_0x17f3('0x21')](saveUpdates(_0x41ff71[_0x17f3('0x43')],null))['then'](respondWithResult(_0x5b31b7,null))['catch'](handleError(_0x5b31b7,null));};exports[_0x17f3('0x22')]=function(_0x5edaa7,_0x5b002b){return db[_0x17f3('0x27')]['find']({'where':{'id':_0x5edaa7[_0x17f3('0x46')]['id']}})[_0x17f3('0x21')](handleEntityNotFound(_0x5b002b,null))[_0x17f3('0x21')](removeEntity(_0x5b002b,null))[_0x17f3('0x44')](handleError(_0x5b002b,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 7d7f248..b7cd784 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 _0x128c=['./intSugarcrmField.attributes','exports','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x5573e6,_0x48b98c){var _0x43dfb3=function(_0x98fd17){while(--_0x98fd17){_0x5573e6['push'](_0x5573e6['shift']());}};_0x43dfb3(++_0x48b98c);}(_0x128c,0x6f));var _0xc128=function(_0x5db667,_0x4e2cc5){_0x5db667=_0x5db667-0x0;var _0x51e38b=_0x128c[_0x5db667];return _0x51e38b;};'use strict';var _=require(_0xc128('0x0'));var util=require(_0xc128('0x1'));var logger=require(_0xc128('0x2'))(_0xc128('0x3'));var moment=require(_0xc128('0x4'));var BPromise=require(_0xc128('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc128('0x6'));var rimraf=require(_0xc128('0x7'));var config=require(_0xc128('0x8'));var attributes=require(_0xc128('0x9'));module[_0xc128('0xa')]=function(_0x41660b,_0x13401b){return _0x41660b['define']('SugarcrmField',attributes,{'tableName':_0xc128('0xb'),'paranoid':![],'indexes':[{'name':_0xc128('0xc'),'fields':[_0xc128('0xd'),_0xc128('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x47be=['int_sugarcrm_fields','idField','FieldId','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmField.attributes'];(function(_0x566d9a,_0x3230c3){var _0x4d5740=function(_0x1a7857){while(--_0x1a7857){_0x566d9a['push'](_0x566d9a['shift']());}};_0x4d5740(++_0x3230c3);}(_0x47be,0xd4));var _0xe47b=function(_0x4d95db,_0x28b7e9){_0x4d95db=_0x4d95db-0x0;var _0x1cc484=_0x47be[_0x4d95db];return _0x1cc484;};'use strict';var _=require(_0xe47b('0x0'));var util=require('util');var logger=require(_0xe47b('0x1'))(_0xe47b('0x2'));var moment=require('moment');var BPromise=require(_0xe47b('0x3'));var rp=require(_0xe47b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe47b('0x5'));var config=require(_0xe47b('0x6'));var attributes=require(_0xe47b('0x7'));module['exports']=function(_0x1c5609,_0x46828b){return _0x1c5609['define']('SugarcrmField',attributes,{'tableName':_0xe47b('0x8'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0xe47b('0x9'),_0xe47b('0xa')],'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 696dcd2..13a5f65 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 _0x1a85=['../../config/logger','rpc','jayson/promise','http','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../config/utils'];(function(_0x50b5f6,_0x461121){var _0xdd3512=function(_0x4e3655){while(--_0x4e3655){_0x50b5f6['push'](_0x50b5f6['shift']());}};_0xdd3512(++_0x461121);}(_0x1a85,0x178));var _0x51a8=function(_0x843880,_0x1516d1){_0x843880=_0x843880-0x0;var _0x49943f=_0x1a85[_0x843880];return _0x49943f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cf430,_0x331117,_0x16a21e){return new BPromise(function(_0x4f3919,_0x228c64){return client['request'](_0x5cf430,_0x16a21e)['then'](function(_0x39e06a){logger[_0x51a8('0x8')](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x331117,_0x51a8('0xa'),JSON[_0x51a8('0xd')](_0x39e06a));if(_0x39e06a[_0x51a8('0xe')]){if(_0x39e06a[_0x51a8('0xe')][_0x51a8('0xf')]===0x1f4){logger[_0x51a8('0xe')](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x228c64(_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);}logger['error'](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x4f3919(_0x39e06a['error'][_0x51a8('0x10')]);}else{logger['info'](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));_0x4f3919(_0x39e06a[_0x51a8('0x11')][_0x51a8('0x10')]);}})[_0x51a8('0x12')](function(_0x3e0603){logger[_0x51a8('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});} \ No newline at end of file +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(_0x3d3a67,_0x1d75c6){var _0x12d015=function(_0x3476ec){while(--_0x3476ec){_0x3d3a67['push'](_0x3d3a67['shift']());}};_0x12d015(++_0x1d75c6);}(_0x5eb8,0xb0));var _0x85eb=function(_0xb47dc0,_0x407032){_0xb47dc0=_0xb47dc0-0x0;var _0x57f0b0=_0x5eb8[_0xb47dc0];return _0x57f0b0;};'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 6b4986f..0912f45 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 _0x3000=['index','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intVtigerAccount.controller','get','isAuthenticated'];(function(_0x96a742,_0x5dfcf9){var _0x2ed181=function(_0x539206){while(--_0x539206){_0x96a742['push'](_0x96a742['shift']());}};_0x2ed181(++_0x5dfcf9);}(_0x3000,0x9e));var _0x0300=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x3000[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x0300('0x0'));var util=require(_0x0300('0x1'));var path=require('path');var timeout=require(_0x0300('0x2'));var express=require(_0x0300('0x3'));var router=express[_0x0300('0x4')]();var auth=require(_0x0300('0x5'));var interaction=require(_0x0300('0x6'));var config=require('../../config/environment');var controller=require(_0x0300('0x7'));router[_0x0300('0x8')]('/',auth[_0x0300('0x9')](),controller[_0x0300('0xa')]);router[_0x0300('0x8')]('/:id',auth[_0x0300('0x9')](),controller['show']);router['get'](_0x0300('0xb'),auth[_0x0300('0x9')](),controller[_0x0300('0xc')]);router[_0x0300('0x8')](_0x0300('0xd'),auth[_0x0300('0x9')](),controller[_0x0300('0xe')]);router[_0x0300('0xf')]('/',auth[_0x0300('0x9')](),controller[_0x0300('0x10')]);router[_0x0300('0xf')]('/:id/configurations',auth[_0x0300('0x9')](),controller[_0x0300('0x11')]);router[_0x0300('0x12')](_0x0300('0x13'),auth['isAuthenticated'](),controller[_0x0300('0x14')]);router[_0x0300('0x15')](_0x0300('0x13'),auth['isAuthenticated'](),controller[_0x0300('0x16')]);module[_0x0300('0x17')]=router; \ No newline at end of file +var _0x4641=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete','destroy','exports','util'];(function(_0x1cdd81,_0x46ee80){var _0x35be0c=function(_0x3ce395){while(--_0x3ce395){_0x1cdd81['push'](_0x1cdd81['shift']());}};_0x35be0c(++_0x46ee80);}(_0x4641,0x19d));var _0x1464=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x4641[_0x126558];return _0x1f6d14;};'use strict';var multer=require('multer');var util=require(_0x1464('0x0'));var path=require('path');var timeout=require(_0x1464('0x1'));var express=require(_0x1464('0x2'));var router=express[_0x1464('0x3')]();var auth=require(_0x1464('0x4'));var interaction=require(_0x1464('0x5'));var config=require(_0x1464('0x6'));var controller=require(_0x1464('0x7'));router[_0x1464('0x8')]('/',auth[_0x1464('0x9')](),controller['index']);router[_0x1464('0x8')](_0x1464('0xa'),auth[_0x1464('0x9')](),controller['show']);router[_0x1464('0x8')](_0x1464('0xb'),auth['isAuthenticated'](),controller[_0x1464('0xc')]);router['get'](_0x1464('0xd'),auth[_0x1464('0x9')](),controller[_0x1464('0xe')]);router['post']('/',auth[_0x1464('0x9')](),controller[_0x1464('0xf')]);router[_0x1464('0x10')](_0x1464('0xb'),auth[_0x1464('0x9')](),controller[_0x1464('0x11')]);router[_0x1464('0x12')](_0x1464('0xa'),auth[_0x1464('0x9')](),controller[_0x1464('0x13')]);router[_0x1464('0x14')](_0x1464('0xa'),auth[_0x1464('0x9')](),controller[_0x1464('0x15')]);module[_0x1464('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 40b098c..001a6c0 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 _0x14f5=['exports','STRING','sequelize'];(function(_0x46dc29,_0x51130b){var _0x14725b=function(_0x1d34ba){while(--_0x1d34ba){_0x46dc29['push'](_0x46dc29['shift']());}};_0x14725b(++_0x51130b);}(_0x14f5,0x1a6));var _0x514f=function(_0x560589,_0x3889f0){_0x560589=_0x560589-0x0;var _0x386054=_0x14f5[_0x560589];return _0x386054;};'use strict';var Sequelize=require(_0x514f('0x0'));module[_0x514f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x514f('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x514f('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING']},'accessKey':{'type':Sequelize[_0x514f('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xb917=['sequelize','STRING','HelpDesk'];(function(_0x4b9add,_0x9b253e){var _0x1af6f5=function(_0x47416a){while(--_0x47416a){_0x4b9add['push'](_0x4b9add['shift']());}};_0x1af6f5(++_0x9b253e);}(_0xb917,0x7b));var _0x7b91=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xb917[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x7b91('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b91('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x7b91('0x1')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x7b91('0x1')],'allowNull':![],'defaultValue':_0x7b91('0x2')},'remoteUri':{'type':Sequelize[_0x7b91('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x7b91('0x1')]},'accessKey':{'type':Sequelize[_0x7b91('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 5aee456..703b0c7 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 _0xe7d7=['count','offset','limit','Content-Range','update','destroy','sendStatus','stack','send','map','VtigerAccount','rawAttributes','model','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','merge','then','includeAll','findAll','rows','show','params','include','options','find','create','body','getConfigurations','findOne','VtigerConfiguration','AccountId','Subjects','getSubjects','channel','VtigerField','Descriptions','md5','getFields','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','username','success','POST','login','token','describe','sessionName','autogenerated','reference','owner','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','client','http','test','ValidationError','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0xe7d7,0x153));var _0x7e7d=function(_0x48897b,_0x2ccea9){_0x48897b=_0x48897b-0x0;var _0x2ede58=_0xe7d7[_0x48897b];return _0x2ede58;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x7e7d('0x0'));var zipdir=require(_0x7e7d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7e7d('0x2'));var moment=require(_0x7e7d('0x3'));var BPromise=require(_0x7e7d('0x4'));var Mustache=require(_0x7e7d('0x5'));var util=require(_0x7e7d('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x7e7d('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x7e7d('0x8'));var crypto=require(_0x7e7d('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7e7d('0x7'));var querystring=require(_0x7e7d('0xa'));var Papa=require(_0x7e7d('0xb'));var Redis=require('ioredis');var authService=require(_0x7e7d('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x7e7d('0xd'));var hardwareService=require(_0x7e7d('0xe'));var logger=require('../../config/logger')(_0x7e7d('0xf'));var utils=require(_0x7e7d('0x10'));var config=require(_0x7e7d('0x11'));var db=require('../../mysqldb')['db'];var integrations=require(_0x7e7d('0x12'));var jayson=require(_0x7e7d('0x13'));var client=jayson[_0x7e7d('0x14')][_0x7e7d('0x15')]({'port':0x232a});function checkPasswordPattern(_0x4c2fc6,_0x28e5f6,_0x6264a9){if(_0x6264a9){var _0xaf8ee7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xaf8ee7[_0x7e7d('0x16')](_0x28e5f6)){return _0x4c2fc6;}else{throw new db['Sequelize'][(_0x7e7d('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 _0x4c2fc6;}}function respondWithRpcPromise(_0x23a4c7,_0xcf4e67,_0x5db844,_0x43df61){return new BPromise(function(_0x1f1031,_0x15f820){var _0x1dcdeb=_0x43df61||client;return _0x1dcdeb[_0x7e7d('0x18')](_0x23a4c7,_0x5db844)['then'](function(_0x3e6335){logger[_0x7e7d('0x19')](_0x7e7d('0x1a'),_0xcf4e67,_0x7e7d('0x1b'));logger[_0x7e7d('0x1c')](_0x7e7d('0x1d'),_0xcf4e67,_0x7e7d('0x1b'),JSON[_0x7e7d('0x1e')](_0x3e6335));if(_0x3e6335[_0x7e7d('0x1f')]){if(_0x3e6335['error'][_0x7e7d('0x20')]===0x1f4){logger[_0x7e7d('0x1f')]('VtigerAccount,\x20%s,\x20%s',_0xcf4e67,_0x3e6335[_0x7e7d('0x1f')][_0x7e7d('0x21')]);return _0x15f820(_0x3e6335[_0x7e7d('0x1f')][_0x7e7d('0x21')]);}logger[_0x7e7d('0x1f')](_0x7e7d('0x1a'),_0xcf4e67,_0x3e6335[_0x7e7d('0x1f')][_0x7e7d('0x21')]);return _0x1f1031(_0x3e6335[_0x7e7d('0x1f')][_0x7e7d('0x21')]);}else{logger[_0x7e7d('0x19')](_0x7e7d('0x1a'),_0xcf4e67,_0x7e7d('0x1b'));_0x1f1031(_0x3e6335[_0x7e7d('0x22')][_0x7e7d('0x21')]);}})[_0x7e7d('0x23')](function(_0x3d5db6){logger[_0x7e7d('0x1f')](_0x7e7d('0x1a'),_0xcf4e67,_0x3d5db6);_0x15f820(_0x3d5db6);});});}function respondWithStatusCode(_0x52bada,_0x1b5066){_0x1b5066=_0x1b5066||0xcc;return function(_0x5ada94){if(_0x5ada94){return _0x52bada['sendStatus'](_0x1b5066);}return _0x52bada[_0x7e7d('0x24')](_0x1b5066)[_0x7e7d('0x25')]();};}function respondWithResult(_0x30c679,_0x35f010){_0x35f010=_0x35f010||0xc8;return function(_0x1ac740){if(_0x1ac740){return _0x30c679[_0x7e7d('0x24')](_0x35f010)[_0x7e7d('0x26')](_0x1ac740);}};}function respondWithFilteredResult(_0x5e1472,_0x1d5de4){return function(_0x2e4026){if(_0x2e4026){var _0x407bd3=_0x2e4026[_0x7e7d('0x27')],_0x589184=_0x1d5de4['offset'],_0xdf535c=_0x1d5de4[_0x7e7d('0x28')]+_0x1d5de4[_0x7e7d('0x29')],_0x5c96ba;if(_0xdf535c>=_0x407bd3){_0xdf535c=_0x407bd3;_0x5c96ba=0xc8;}else{_0x5c96ba=0xce;}_0x5e1472[_0x7e7d('0x24')](_0x5c96ba);return _0x5e1472['set'](_0x7e7d('0x2a'),_0x589184+'-'+_0xdf535c+'/'+_0x407bd3)[_0x7e7d('0x26')](_0x2e4026);}return null;};}function patchUpdates(_0x107041){return function(_0x5ad8c8){try{jsonpatch['apply'](_0x5ad8c8,_0x107041,!![]);}catch(_0x4f009f){return BPromise['reject'](_0x4f009f);}return _0x5ad8c8['save']();};}function saveUpdates(_0x27ab5a,_0x537e4d){return function(_0x367511){if(_0x367511){return _0x367511[_0x7e7d('0x2b')](_0x27ab5a)['then'](function(_0x27788c){return _0x27788c;});}return null;};}function removeEntity(_0x298d3c,_0x183d85){return function(_0x542f8b){if(_0x542f8b){return _0x542f8b[_0x7e7d('0x2c')]()['then'](function(){_0x298d3c['status'](0xcc)[_0x7e7d('0x25')]();});}};}function handleEntityNotFound(_0x5a528b,_0x4a26d7){return function(_0x115b27){if(!_0x115b27){_0x5a528b[_0x7e7d('0x2d')](0x194);}return _0x115b27;};}function handleError(_0x106fa9,_0x17d469){_0x17d469=_0x17d469||0x1f4;return function(_0x37a4d3){logger[_0x7e7d('0x1f')](_0x37a4d3[_0x7e7d('0x2e')]);if(_0x37a4d3['name']){delete _0x37a4d3['name'];}_0x106fa9[_0x7e7d('0x24')](_0x17d469)[_0x7e7d('0x2f')](_0x37a4d3);};}exports['index']=function(_0x316058,_0x4a9a99){var _0x1e4bfd={},_0x28ca8f={},_0x52119c={'count':0x0,'rows':[]};var _0x38df37=_[_0x7e7d('0x30')](db[_0x7e7d('0x31')][_0x7e7d('0x32')],function(_0x2d55e0){return{'name':_0x2d55e0['fieldName'],'type':_0x2d55e0['type']['key']};});_0x28ca8f[_0x7e7d('0x33')]=_['map'](_0x38df37,_0x7e7d('0x34'));_0x28ca8f['query']=_[_0x7e7d('0x35')](_0x316058[_0x7e7d('0x36')]);_0x28ca8f[_0x7e7d('0x37')]=_[_0x7e7d('0x38')](_0x28ca8f[_0x7e7d('0x33')],_0x28ca8f['query']);_0x1e4bfd[_0x7e7d('0x39')]=_[_0x7e7d('0x38')](_0x28ca8f[_0x7e7d('0x33')],qs[_0x7e7d('0x3a')](_0x316058['query'][_0x7e7d('0x3a')]));_0x1e4bfd[_0x7e7d('0x39')]=_0x1e4bfd[_0x7e7d('0x39')][_0x7e7d('0x3b')]?_0x1e4bfd[_0x7e7d('0x39')]:_0x28ca8f[_0x7e7d('0x33')];if(!_0x316058[_0x7e7d('0x36')][_0x7e7d('0x3c')](_0x7e7d('0x3d'))){_0x1e4bfd[_0x7e7d('0x29')]=qs['limit'](_0x316058[_0x7e7d('0x36')][_0x7e7d('0x29')]);_0x1e4bfd[_0x7e7d('0x28')]=qs[_0x7e7d('0x28')](_0x316058['query'][_0x7e7d('0x28')]);}_0x1e4bfd[_0x7e7d('0x3e')]=qs[_0x7e7d('0x3f')](_0x316058[_0x7e7d('0x36')][_0x7e7d('0x3f')]);_0x1e4bfd[_0x7e7d('0x40')]=qs['filters'](_['pick'](_0x316058[_0x7e7d('0x36')],_0x28ca8f[_0x7e7d('0x37')]),_0x38df37);if(_0x316058[_0x7e7d('0x36')][_0x7e7d('0x41')]){_0x1e4bfd[_0x7e7d('0x40')]=_['merge'](_0x1e4bfd[_0x7e7d('0x40')],{'$or':_[_0x7e7d('0x30')](_0x38df37,function(_0x317b85){if(_0x317b85[_0x7e7d('0x42')]!=='VIRTUAL'){var _0x50885e={};_0x50885e[_0x317b85[_0x7e7d('0x34')]]={'$like':'%'+_0x316058[_0x7e7d('0x36')][_0x7e7d('0x41')]+'%'};return _0x50885e;}})});}_0x1e4bfd=_[_0x7e7d('0x43')]({},_0x1e4bfd,_0x316058['options']);var _0x313a30={'where':_0x1e4bfd[_0x7e7d('0x40')]};return db[_0x7e7d('0x31')][_0x7e7d('0x27')](_0x313a30)[_0x7e7d('0x44')](function(_0x108e71){_0x52119c[_0x7e7d('0x27')]=_0x108e71;if(_0x316058['query'][_0x7e7d('0x45')]){_0x1e4bfd['include']=[{'all':!![]}];}return db[_0x7e7d('0x31')][_0x7e7d('0x46')](_0x1e4bfd);})[_0x7e7d('0x44')](function(_0xbd8ba5){_0x52119c[_0x7e7d('0x47')]=_0xbd8ba5;return _0x52119c;})[_0x7e7d('0x44')](respondWithFilteredResult(_0x4a9a99,_0x1e4bfd))[_0x7e7d('0x23')](handleError(_0x4a9a99,null));};exports[_0x7e7d('0x48')]=function(_0x4793fe,_0x5dd579){var _0x2ef50b={'raw':![],'where':{'id':_0x4793fe[_0x7e7d('0x49')]['id']}},_0x3c9cdf={};_0x3c9cdf[_0x7e7d('0x33')]=_[_0x7e7d('0x35')](db[_0x7e7d('0x31')][_0x7e7d('0x32')]);_0x3c9cdf[_0x7e7d('0x36')]=_[_0x7e7d('0x35')](_0x4793fe[_0x7e7d('0x36')]);_0x3c9cdf[_0x7e7d('0x37')]=_[_0x7e7d('0x38')](_0x3c9cdf[_0x7e7d('0x33')],_0x3c9cdf[_0x7e7d('0x36')]);_0x2ef50b[_0x7e7d('0x39')]=_[_0x7e7d('0x38')](_0x3c9cdf[_0x7e7d('0x33')],qs[_0x7e7d('0x3a')](_0x4793fe[_0x7e7d('0x36')][_0x7e7d('0x3a')]));_0x2ef50b['attributes']=_0x2ef50b['attributes'][_0x7e7d('0x3b')]?_0x2ef50b[_0x7e7d('0x39')]:_0x3c9cdf['model'];if(_0x4793fe['query'][_0x7e7d('0x45')]){_0x2ef50b[_0x7e7d('0x4a')]=[{'all':!![]}];}_0x2ef50b=_[_0x7e7d('0x43')]({},_0x2ef50b,_0x4793fe[_0x7e7d('0x4b')]);return db[_0x7e7d('0x31')][_0x7e7d('0x4c')](_0x2ef50b)['then'](handleEntityNotFound(_0x5dd579,null))[_0x7e7d('0x44')](respondWithResult(_0x5dd579,null))[_0x7e7d('0x23')](handleError(_0x5dd579,null));};exports[_0x7e7d('0x4d')]=function(_0x73da62,_0x3bd34a){return db[_0x7e7d('0x31')][_0x7e7d('0x4d')](_0x73da62[_0x7e7d('0x4e')],{})[_0x7e7d('0x44')](respondWithResult(_0x3bd34a,0xc9))[_0x7e7d('0x23')](handleError(_0x3bd34a,null));};exports[_0x7e7d('0x2b')]=function(_0x4e8c8e,_0x23f23a){if(_0x4e8c8e[_0x7e7d('0x4e')]['id']){delete _0x4e8c8e[_0x7e7d('0x4e')]['id'];}return db[_0x7e7d('0x31')][_0x7e7d('0x4c')]({'where':{'id':_0x4e8c8e['params']['id']}})[_0x7e7d('0x44')](handleEntityNotFound(_0x23f23a,null))['then'](saveUpdates(_0x4e8c8e[_0x7e7d('0x4e')],null))[_0x7e7d('0x44')](respondWithResult(_0x23f23a,null))['catch'](handleError(_0x23f23a,null));};exports['destroy']=function(_0x45ecca,_0xfeabeb){return db[_0x7e7d('0x31')][_0x7e7d('0x4c')]({'where':{'id':_0x45ecca[_0x7e7d('0x49')]['id']}})[_0x7e7d('0x44')](handleEntityNotFound(_0xfeabeb,null))[_0x7e7d('0x44')](removeEntity(_0xfeabeb,null))[_0x7e7d('0x23')](handleError(_0xfeabeb,null));};exports[_0x7e7d('0x4f')]=function(_0x12cbd,_0xbf6216,_0x5f05c3){var _0x5160d8={};var _0x41ff83={};var _0x3fe488;var _0x2bbb4b;return db['VtigerAccount'][_0x7e7d('0x50')]({'where':{'id':_0x12cbd[_0x7e7d('0x49')]['id']}})['then'](handleEntityNotFound(_0xbf6216,null))[_0x7e7d('0x44')](function(_0x164eac){if(_0x164eac){_0x3fe488=_0x164eac;_0x41ff83[_0x7e7d('0x33')]=_[_0x7e7d('0x35')](db[_0x7e7d('0x51')]['rawAttributes']);_0x41ff83[_0x7e7d('0x36')]=_[_0x7e7d('0x35')](_0x12cbd[_0x7e7d('0x36')]);_0x41ff83[_0x7e7d('0x37')]=_[_0x7e7d('0x38')](_0x41ff83[_0x7e7d('0x33')],_0x41ff83[_0x7e7d('0x36')]);_0x5160d8[_0x7e7d('0x39')]=_[_0x7e7d('0x38')](_0x41ff83['model'],qs[_0x7e7d('0x3a')](_0x12cbd[_0x7e7d('0x36')]['fields']));_0x5160d8[_0x7e7d('0x39')]=_0x5160d8[_0x7e7d('0x39')][_0x7e7d('0x3b')]?_0x5160d8[_0x7e7d('0x39')]:_0x41ff83[_0x7e7d('0x33')];_0x5160d8[_0x7e7d('0x3e')]=qs[_0x7e7d('0x3f')](_0x12cbd[_0x7e7d('0x36')][_0x7e7d('0x3f')]);_0x5160d8[_0x7e7d('0x40')]=qs[_0x7e7d('0x37')](_['pick'](_0x12cbd[_0x7e7d('0x36')],_0x41ff83[_0x7e7d('0x37')]));if(_0x12cbd[_0x7e7d('0x36')][_0x7e7d('0x41')]){_0x5160d8[_0x7e7d('0x40')]=_[_0x7e7d('0x43')](_0x5160d8[_0x7e7d('0x40')],{'$or':_[_0x7e7d('0x30')](_0x5160d8[_0x7e7d('0x39')],function(_0x49e1e0){var _0x14e8cb={};_0x14e8cb[_0x49e1e0]={'$like':'%'+_0x12cbd[_0x7e7d('0x36')][_0x7e7d('0x41')]+'%'};return _0x14e8cb;})});}_0x5160d8=_['merge']({},_0x5160d8,_0x12cbd['options']);return _0x3fe488[_0x7e7d('0x4f')](_0x5160d8);}})['then'](function(_0x1d411b){if(_0x1d411b){_0x2bbb4b=_0x1d411b[_0x7e7d('0x3b')];if(!_0x12cbd[_0x7e7d('0x36')][_0x7e7d('0x3c')](_0x7e7d('0x3d'))){_0x5160d8['limit']=qs[_0x7e7d('0x29')](_0x12cbd[_0x7e7d('0x36')][_0x7e7d('0x29')]);_0x5160d8[_0x7e7d('0x28')]=qs['offset'](_0x12cbd[_0x7e7d('0x36')][_0x7e7d('0x28')]);}return _0x3fe488[_0x7e7d('0x4f')](_0x5160d8);}})[_0x7e7d('0x44')](function(_0x2e58d9){if(_0x2e58d9){return _0x2e58d9?{'count':_0x2bbb4b,'rows':_0x2e58d9}:null;}})['then'](respondWithResult(_0xbf6216,null))[_0x7e7d('0x23')](handleError(_0xbf6216,null));};exports['addConfiguration']=function(_0x31dbda,_0x6cb3e7,_0x10a717){if(_0x31dbda['body']['id']){delete _0x31dbda[_0x7e7d('0x4e')]['id'];}return db[_0x7e7d('0x31')][_0x7e7d('0x50')]({'where':{'id':_0x31dbda[_0x7e7d('0x49')]['id']}})[_0x7e7d('0x44')](handleEntityNotFound(_0x6cb3e7,null))[_0x7e7d('0x44')](function(_0x39436a){if(_0x39436a){_0x31dbda[_0x7e7d('0x4e')][_0x7e7d('0x52')]=_0x39436a['id'];_0x31dbda[_0x7e7d('0x4e')][_0x7e7d('0x53')]=integrations[_0x7e7d('0x54')](_0x31dbda[_0x7e7d('0x4e')]['channel'],_0x31dbda['body']['type']);_0x31dbda[_0x7e7d('0x4e')]['Descriptions']=integrations['getDescriptions'](_0x31dbda['body'][_0x7e7d('0x55')],_0x31dbda[_0x7e7d('0x4e')]['type']);return db['VtigerConfiguration']['create'](_0x31dbda[_0x7e7d('0x4e')],{'include':[{'model':db[_0x7e7d('0x56')],'as':_0x7e7d('0x53')},{'model':db[_0x7e7d('0x56')],'as':_0x7e7d('0x57')}]});}return null;})[_0x7e7d('0x44')](respondWithResult(_0x6cb3e7,null))['catch'](handleError(_0x6cb3e7,null));};var md5=require(_0x7e7d('0x58'));exports[_0x7e7d('0x59')]=function(_0x66ffec,_0x45fd84,_0x1e1763){var _0x3241b4=null;var _0x38eb48=null;var _0x225673=null;var _0x529c09=null;var _0x5eacee='';return db['VtigerAccount'][_0x7e7d('0x50')]({'where':{'id':_0x66ffec[_0x7e7d('0x49')]['id']},'attributes':['id',_0x7e7d('0x34'),'username','description',_0x7e7d('0x5a'),_0x7e7d('0x5b'),_0x7e7d('0x5c'),_0x7e7d('0x5d')]})[_0x7e7d('0x44')](handleEntityNotFound(_0x45fd84,null))['then'](function(_0x466a98){if(_0x466a98){_0x3241b4=_0x466a98['username'];_0x38eb48=_0x466a98[_0x7e7d('0x5d')];_0x225673=_0x466a98['moduleName'];_0x5eacee=_0x466a98[_0x7e7d('0x5b')];var _0x59a939=_0x5eacee[_0x7e7d('0x5e')](-0x1);if(_0x59a939==='/'){_0x5eacee=_0x5eacee[_0x7e7d('0x5f')](0x0,_0x5eacee[_0x7e7d('0x60')](_0x59a939));}_0x529c09=util[_0x7e7d('0x61')](_0x7e7d('0x62'),_0x5eacee);var _0x42e0e5={'method':_0x7e7d('0x63'),'uri':_0x529c09,'qs':{'operation':_0x7e7d('0x64'),'username':_0x466a98[_0x7e7d('0x65')]},'json':!![]};return rp(_0x42e0e5);}})[_0x7e7d('0x44')](function(_0xda3fa8){if(_0xda3fa8[_0x7e7d('0x66')]){var _0x1ff17b={'method':_0x7e7d('0x67'),'uri':_0x529c09,'form':{'operation':_0x7e7d('0x68'),'username':_0x3241b4,'accessKey':md5(_0xda3fa8[_0x7e7d('0x22')][_0x7e7d('0x69')]+_0x38eb48)},'json':!![]};return rp(_0x1ff17b);}})[_0x7e7d('0x44')](function(_0x57cc6c){if(_0x57cc6c[_0x7e7d('0x66')]){var _0x19940d={'method':'GET','uri':_0x529c09,'qs':{'operation':_0x7e7d('0x6a'),'username':_0x3241b4,'sessionName':_0x57cc6c[_0x7e7d('0x22')][_0x7e7d('0x6b')],'elementType':_0x225673},'json':!![]};return rp(_0x19940d);}})[_0x7e7d('0x44')](function(_0x5370c0){if(_0x5370c0[_0x7e7d('0x66')]){var _0x1cc4e3=[_0x7e7d('0x6c'),_0x7e7d('0x6d'),_0x7e7d('0x6e')];_[_0x7e7d('0x6f')](_0x5370c0['result']['fields'],function(_0x16c276){return _0x1cc4e3[_0x7e7d('0x70')](_0x16c276[_0x7e7d('0x42')]['name']);});_[_0x7e7d('0x6f')](_0x5370c0['result'][_0x7e7d('0x3a')],function(_0x4ca1aa){return _0x4ca1aa[_0x7e7d('0x71')]===_0x7e7d('0x72');});return{'count':_0x5370c0[_0x7e7d('0x22')]['fields'][_0x7e7d('0x3b')],'rows':_['map'](_0x5370c0[_0x7e7d('0x22')][_0x7e7d('0x3a')],function(_0x4a1864){return{'id':_0x4a1864[_0x7e7d('0x34')],'name':_0x4a1864[_0x7e7d('0x73')],'custom':_[_0x7e7d('0x74')](_0x4a1864[_0x7e7d('0x34')],_0x7e7d('0x75'))?!![]:![],'options':_0x4a1864[_0x7e7d('0x42')][_0x7e7d('0x34')]===_0x7e7d('0x76')&&_0x4a1864[_0x7e7d('0x42')]['picklistValues'][_0x7e7d('0x3b')]>0x0?_[_0x7e7d('0x30')](_0x4a1864[_0x7e7d('0x42')][_0x7e7d('0x77')],function(_0xb278b2){return{'name':_0xb278b2[_0x7e7d('0x73')],'value':_0xb278b2[_0x7e7d('0x78')]};}):[]};})};}})[_0x7e7d('0x44')](respondWithResult(_0x45fd84,null))[_0x7e7d('0x23')](function(_0x304e86){console[_0x7e7d('0x79')](_0x7e7d('0x7a')+_0x304e86);var _0x13e360=_0x66ffec['query'][_0x7e7d('0x16')]?0x1f4:_0x304e86[_0x7e7d('0x7b')]||0x1f4;logger[_0x7e7d('0x1f')](_0x7e7d('0x7c'),'getFields',_0x13e360,JSON[_0x7e7d('0x1e')](_0x304e86));delete _0x304e86[_0x7e7d('0x34')];if(_0x13e360===0x191){_0x13e360=0x190;}_0x45fd84['status'](_0x13e360)[_0x7e7d('0x2f')](_0x66ffec[_0x7e7d('0x36')][_0x7e7d('0x16')]?{'message':_0x7e7d('0x7d'),'statusCode':_0x304e86[_0x7e7d('0x7b')]}:_0x304e86);});}; \ No newline at end of file +var _0x68a3=['lastIndexOf','format','getchallenge','success','POST','login','result','token','describe','sessionName','autogenerated','includes','remove','editable','startsWith','cf_','picklist','picklistValues','label','value','log','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','html-pdf','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../components/integrations/configuration','jayson/promise','client','test','Sequelize','ValidationError','request','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','sendStatus','end','status','json','count','offset','set','Content-Range','apply','update','then','destroy','stack','send','index','map','VtigerAccount','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','name','options','includeAll','include','params','keys','find','create','body','getConfigurations','addConfiguration','findOne','Subjects','getSubjects','Descriptions','getDescriptions','channel','VtigerConfiguration','VtigerField','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','substring'];(function(_0x5504cb,_0xc91a32){var _0x1f34c4=function(_0xe33fed){while(--_0xe33fed){_0x5504cb['push'](_0x5504cb['shift']());}};_0x1f34c4(++_0xc91a32);}(_0x68a3,0x111));var _0x368a=function(_0x2ef75a,_0x2f58a0){_0x2ef75a=_0x2ef75a-0x0;var _0x3fa519=_0x68a3[_0x2ef75a];return _0x3fa519;};'use strict';var pdf=require(_0x368a('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x368a('0x1'));var Mustache=require(_0x368a('0x2'));var util=require(_0x368a('0x3'));var path=require(_0x368a('0x4'));var sox=require(_0x368a('0x5'));var csv=require('to-csv');var ejs=require(_0x368a('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x368a('0x7'));var crypto=require(_0x368a('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x368a('0x9'));var toCsv=require(_0x368a('0xa'));var querystring=require(_0x368a('0xb'));var Papa=require(_0x368a('0xc'));var Redis=require('ioredis');var authService=require(_0x368a('0xd'));var qs=require(_0x368a('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x368a('0xf'));var logger=require(_0x368a('0x10'))(_0x368a('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require(_0x368a('0x12'));var jayson=require(_0x368a('0x13'));var client=jayson[_0x368a('0x14')]['http']({'port':0x232a});function checkPasswordPattern(_0x3e51d6,_0x2a6b3a,_0x224ac7){if(_0x224ac7){var _0x4d0a51=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4d0a51[_0x368a('0x15')](_0x2a6b3a)){return _0x3e51d6;}else{throw new db[(_0x368a('0x16'))][(_0x368a('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 _0x3e51d6;}}function respondWithRpcPromise(_0xa7dc21,_0x5a74f7,_0x346fe4,_0x5e7e93){return new BPromise(function(_0x17363c,_0x3ab503){var _0x1b479d=_0x5e7e93||client;return _0x1b479d[_0x368a('0x18')](_0xa7dc21,_0x346fe4)['then'](function(_0x50822e){logger['info'](_0x368a('0x19'),_0x5a74f7,_0x368a('0x1a'));logger['debug'](_0x368a('0x1b'),_0x5a74f7,_0x368a('0x1a'),JSON['stringify'](_0x50822e));if(_0x50822e['error']){if(_0x50822e[_0x368a('0x1c')][_0x368a('0x1d')]===0x1f4){logger[_0x368a('0x1c')](_0x368a('0x19'),_0x5a74f7,_0x50822e[_0x368a('0x1c')][_0x368a('0x1e')]);return _0x3ab503(_0x50822e['error'][_0x368a('0x1e')]);}logger[_0x368a('0x1c')](_0x368a('0x19'),_0x5a74f7,_0x50822e[_0x368a('0x1c')]['message']);return _0x17363c(_0x50822e[_0x368a('0x1c')]['message']);}else{logger[_0x368a('0x1f')](_0x368a('0x19'),_0x5a74f7,'request\x20sent');_0x17363c(_0x50822e['result'][_0x368a('0x1e')]);}})[_0x368a('0x20')](function(_0x227b09){logger['error'](_0x368a('0x19'),_0x5a74f7,_0x227b09);_0x3ab503(_0x227b09);});});}function respondWithStatusCode(_0xa7f16d,_0x101d4a){_0x101d4a=_0x101d4a||0xcc;return function(_0x16dbfe){if(_0x16dbfe){return _0xa7f16d[_0x368a('0x21')](_0x101d4a);}return _0xa7f16d['status'](_0x101d4a)[_0x368a('0x22')]();};}function respondWithResult(_0x33b3d3,_0x1a47de){_0x1a47de=_0x1a47de||0xc8;return function(_0x1664b4){if(_0x1664b4){return _0x33b3d3[_0x368a('0x23')](_0x1a47de)[_0x368a('0x24')](_0x1664b4);}};}function respondWithFilteredResult(_0x4a54df,_0x4073a5){return function(_0x42d2d8){if(_0x42d2d8){var _0x45efeb=_0x42d2d8[_0x368a('0x25')],_0x4df62f=_0x4073a5[_0x368a('0x26')],_0x24dda4=_0x4073a5[_0x368a('0x26')]+_0x4073a5['limit'],_0x53a41d;if(_0x24dda4>=_0x45efeb){_0x24dda4=_0x45efeb;_0x53a41d=0xc8;}else{_0x53a41d=0xce;}_0x4a54df['status'](_0x53a41d);return _0x4a54df[_0x368a('0x27')](_0x368a('0x28'),_0x4df62f+'-'+_0x24dda4+'/'+_0x45efeb)[_0x368a('0x24')](_0x42d2d8);}return null;};}function patchUpdates(_0x5e2e4){return function(_0x482325){try{jsonpatch[_0x368a('0x29')](_0x482325,_0x5e2e4,!![]);}catch(_0x2736d2){return BPromise['reject'](_0x2736d2);}return _0x482325['save']();};}function saveUpdates(_0x3127de,_0x4e37b0){return function(_0x9b0fbc){if(_0x9b0fbc){return _0x9b0fbc[_0x368a('0x2a')](_0x3127de)[_0x368a('0x2b')](function(_0xb62edb){return _0xb62edb;});}return null;};}function removeEntity(_0x4d0abd,_0x1f82cf){return function(_0x1ab368){if(_0x1ab368){return _0x1ab368[_0x368a('0x2c')]()[_0x368a('0x2b')](function(){_0x4d0abd[_0x368a('0x23')](0xcc)[_0x368a('0x22')]();});}};}function handleEntityNotFound(_0x37dcbc,_0xa98a4c){return function(_0x2cf26c){if(!_0x2cf26c){_0x37dcbc[_0x368a('0x21')](0x194);}return _0x2cf26c;};}function handleError(_0x2548d8,_0x4e42ee){_0x4e42ee=_0x4e42ee||0x1f4;return function(_0x318bd2){logger[_0x368a('0x1c')](_0x318bd2[_0x368a('0x2d')]);if(_0x318bd2['name']){delete _0x318bd2['name'];}_0x2548d8[_0x368a('0x23')](_0x4e42ee)[_0x368a('0x2e')](_0x318bd2);};}exports[_0x368a('0x2f')]=function(_0x3a3f85,_0x3c78f6){var _0x364655={},_0x4ca68a={},_0x27fc58={'count':0x0,'rows':[]};var _0x8a8f26=_[_0x368a('0x30')](db[_0x368a('0x31')][_0x368a('0x32')],function(_0x43a333){return{'name':_0x43a333[_0x368a('0x33')],'type':_0x43a333['type'][_0x368a('0x34')]};});_0x4ca68a['model']=_[_0x368a('0x30')](_0x8a8f26,'name');_0x4ca68a[_0x368a('0x35')]=_['keys'](_0x3a3f85[_0x368a('0x35')]);_0x4ca68a[_0x368a('0x36')]=_[_0x368a('0x37')](_0x4ca68a[_0x368a('0x38')],_0x4ca68a[_0x368a('0x35')]);_0x364655[_0x368a('0x39')]=_[_0x368a('0x37')](_0x4ca68a[_0x368a('0x38')],qs[_0x368a('0x3a')](_0x3a3f85[_0x368a('0x35')]['fields']));_0x364655[_0x368a('0x39')]=_0x364655[_0x368a('0x39')][_0x368a('0x3b')]?_0x364655[_0x368a('0x39')]:_0x4ca68a[_0x368a('0x38')];if(!_0x3a3f85[_0x368a('0x35')][_0x368a('0x3c')](_0x368a('0x3d'))){_0x364655[_0x368a('0x3e')]=qs[_0x368a('0x3e')](_0x3a3f85['query'][_0x368a('0x3e')]);_0x364655[_0x368a('0x26')]=qs[_0x368a('0x26')](_0x3a3f85[_0x368a('0x35')][_0x368a('0x26')]);}_0x364655[_0x368a('0x3f')]=qs['sort'](_0x3a3f85[_0x368a('0x35')][_0x368a('0x40')]);_0x364655[_0x368a('0x41')]=qs[_0x368a('0x36')](_[_0x368a('0x42')](_0x3a3f85[_0x368a('0x35')],_0x4ca68a[_0x368a('0x36')]),_0x8a8f26);if(_0x3a3f85[_0x368a('0x35')][_0x368a('0x43')]){_0x364655[_0x368a('0x41')]=_[_0x368a('0x44')](_0x364655['where'],{'$or':_[_0x368a('0x30')](_0x8a8f26,function(_0x46f3bb){if(_0x46f3bb[_0x368a('0x45')]!==_0x368a('0x46')){var _0x17c909={};_0x17c909[_0x46f3bb[_0x368a('0x47')]]={'$like':'%'+_0x3a3f85['query'][_0x368a('0x43')]+'%'};return _0x17c909;}})});}_0x364655=_['merge']({},_0x364655,_0x3a3f85[_0x368a('0x48')]);var _0x7e3b5c={'where':_0x364655['where']};return db[_0x368a('0x31')][_0x368a('0x25')](_0x7e3b5c)[_0x368a('0x2b')](function(_0x1e1b75){_0x27fc58['count']=_0x1e1b75;if(_0x3a3f85[_0x368a('0x35')][_0x368a('0x49')]){_0x364655[_0x368a('0x4a')]=[{'all':!![]}];}return db[_0x368a('0x31')]['findAll'](_0x364655);})[_0x368a('0x2b')](function(_0x18e2f2){_0x27fc58['rows']=_0x18e2f2;return _0x27fc58;})[_0x368a('0x2b')](respondWithFilteredResult(_0x3c78f6,_0x364655))['catch'](handleError(_0x3c78f6,null));};exports['show']=function(_0x15b541,_0x373a3e){var _0x4d3614={'raw':![],'where':{'id':_0x15b541[_0x368a('0x4b')]['id']}},_0x46475e={};_0x46475e[_0x368a('0x38')]=_[_0x368a('0x4c')](db['VtigerAccount']['rawAttributes']);_0x46475e['query']=_['keys'](_0x15b541[_0x368a('0x35')]);_0x46475e[_0x368a('0x36')]=_['intersection'](_0x46475e[_0x368a('0x38')],_0x46475e[_0x368a('0x35')]);_0x4d3614['attributes']=_[_0x368a('0x37')](_0x46475e['model'],qs['fields'](_0x15b541[_0x368a('0x35')][_0x368a('0x3a')]));_0x4d3614['attributes']=_0x4d3614[_0x368a('0x39')]['length']?_0x4d3614['attributes']:_0x46475e[_0x368a('0x38')];if(_0x15b541[_0x368a('0x35')][_0x368a('0x49')]){_0x4d3614[_0x368a('0x4a')]=[{'all':!![]}];}_0x4d3614=_['merge']({},_0x4d3614,_0x15b541[_0x368a('0x48')]);return db[_0x368a('0x31')][_0x368a('0x4d')](_0x4d3614)[_0x368a('0x2b')](handleEntityNotFound(_0x373a3e,null))[_0x368a('0x2b')](respondWithResult(_0x373a3e,null))['catch'](handleError(_0x373a3e,null));};exports[_0x368a('0x4e')]=function(_0x21ac1b,_0x3c7f24){return db['VtigerAccount'][_0x368a('0x4e')](_0x21ac1b[_0x368a('0x4f')],{})[_0x368a('0x2b')](respondWithResult(_0x3c7f24,0xc9))[_0x368a('0x20')](handleError(_0x3c7f24,null));};exports['update']=function(_0x562412,_0x3215b5){if(_0x562412['body']['id']){delete _0x562412[_0x368a('0x4f')]['id'];}return db[_0x368a('0x31')][_0x368a('0x4d')]({'where':{'id':_0x562412[_0x368a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3215b5,null))[_0x368a('0x2b')](saveUpdates(_0x562412['body'],null))[_0x368a('0x2b')](respondWithResult(_0x3215b5,null))[_0x368a('0x20')](handleError(_0x3215b5,null));};exports[_0x368a('0x2c')]=function(_0x1c8721,_0x4828d9){return db[_0x368a('0x31')]['find']({'where':{'id':_0x1c8721[_0x368a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4828d9,null))[_0x368a('0x2b')](removeEntity(_0x4828d9,null))[_0x368a('0x20')](handleError(_0x4828d9,null));};exports[_0x368a('0x50')]=function(_0x2c58f6,_0x16fafc,_0x56ac57){var _0x4c7bf7={};var _0x4aa004={};var _0x12ac57;var _0x3aa9e8;return db[_0x368a('0x31')]['findOne']({'where':{'id':_0x2c58f6['params']['id']}})['then'](handleEntityNotFound(_0x16fafc,null))['then'](function(_0x49e39a){if(_0x49e39a){_0x12ac57=_0x49e39a;_0x4aa004[_0x368a('0x38')]=_['keys'](db['VtigerConfiguration']['rawAttributes']);_0x4aa004[_0x368a('0x35')]=_[_0x368a('0x4c')](_0x2c58f6['query']);_0x4aa004[_0x368a('0x36')]=_[_0x368a('0x37')](_0x4aa004[_0x368a('0x38')],_0x4aa004[_0x368a('0x35')]);_0x4c7bf7[_0x368a('0x39')]=_[_0x368a('0x37')](_0x4aa004['model'],qs[_0x368a('0x3a')](_0x2c58f6[_0x368a('0x35')]['fields']));_0x4c7bf7[_0x368a('0x39')]=_0x4c7bf7[_0x368a('0x39')]['length']?_0x4c7bf7[_0x368a('0x39')]:_0x4aa004[_0x368a('0x38')];_0x4c7bf7['order']=qs[_0x368a('0x40')](_0x2c58f6[_0x368a('0x35')][_0x368a('0x40')]);_0x4c7bf7[_0x368a('0x41')]=qs[_0x368a('0x36')](_[_0x368a('0x42')](_0x2c58f6[_0x368a('0x35')],_0x4aa004['filters']));if(_0x2c58f6[_0x368a('0x35')]['filter']){_0x4c7bf7[_0x368a('0x41')]=_['merge'](_0x4c7bf7[_0x368a('0x41')],{'$or':_['map'](_0x4c7bf7[_0x368a('0x39')],function(_0xf3e31d){var _0x2cca20={};_0x2cca20[_0xf3e31d]={'$like':'%'+_0x2c58f6[_0x368a('0x35')][_0x368a('0x43')]+'%'};return _0x2cca20;})});}_0x4c7bf7=_[_0x368a('0x44')]({},_0x4c7bf7,_0x2c58f6['options']);return _0x12ac57[_0x368a('0x50')](_0x4c7bf7);}})[_0x368a('0x2b')](function(_0x178482){if(_0x178482){_0x3aa9e8=_0x178482[_0x368a('0x3b')];if(!_0x2c58f6[_0x368a('0x35')][_0x368a('0x3c')](_0x368a('0x3d'))){_0x4c7bf7['limit']=qs[_0x368a('0x3e')](_0x2c58f6[_0x368a('0x35')][_0x368a('0x3e')]);_0x4c7bf7[_0x368a('0x26')]=qs[_0x368a('0x26')](_0x2c58f6['query'][_0x368a('0x26')]);}return _0x12ac57['getConfigurations'](_0x4c7bf7);}})[_0x368a('0x2b')](function(_0xdbbcfe){if(_0xdbbcfe){return _0xdbbcfe?{'count':_0x3aa9e8,'rows':_0xdbbcfe}:null;}})[_0x368a('0x2b')](respondWithResult(_0x16fafc,null))[_0x368a('0x20')](handleError(_0x16fafc,null));};exports[_0x368a('0x51')]=function(_0x1fe4aa,_0x150d98,_0x51566a){if(_0x1fe4aa[_0x368a('0x4f')]['id']){delete _0x1fe4aa['body']['id'];}return db['VtigerAccount'][_0x368a('0x52')]({'where':{'id':_0x1fe4aa['params']['id']}})['then'](handleEntityNotFound(_0x150d98,null))[_0x368a('0x2b')](function(_0x10661e){if(_0x10661e){_0x1fe4aa['body']['AccountId']=_0x10661e['id'];_0x1fe4aa[_0x368a('0x4f')][_0x368a('0x53')]=integrations[_0x368a('0x54')](_0x1fe4aa[_0x368a('0x4f')]['channel'],_0x1fe4aa[_0x368a('0x4f')]['type']);_0x1fe4aa[_0x368a('0x4f')][_0x368a('0x55')]=integrations[_0x368a('0x56')](_0x1fe4aa[_0x368a('0x4f')][_0x368a('0x57')],_0x1fe4aa[_0x368a('0x4f')][_0x368a('0x45')]);return db[_0x368a('0x58')][_0x368a('0x4e')](_0x1fe4aa[_0x368a('0x4f')],{'include':[{'model':db[_0x368a('0x59')],'as':_0x368a('0x53')},{'model':db[_0x368a('0x59')],'as':_0x368a('0x55')}]});}return null;})['then'](respondWithResult(_0x150d98,null))[_0x368a('0x20')](handleError(_0x150d98,null));};var md5=require(_0x368a('0x5a'));exports[_0x368a('0x5b')]=function(_0x4b4879,_0xdf071d,_0x5001ad){var _0x388ec3=null;var _0x27ff17=null;var _0x4f8eea=null;var _0x246bcf=null;var _0x8d3cea='';return db[_0x368a('0x31')][_0x368a('0x52')]({'where':{'id':_0x4b4879[_0x368a('0x4b')]['id']},'attributes':['id',_0x368a('0x47'),_0x368a('0x5c'),_0x368a('0x5d'),_0x368a('0x5e'),_0x368a('0x5f'),_0x368a('0x60'),'accessKey']})[_0x368a('0x2b')](handleEntityNotFound(_0xdf071d,null))[_0x368a('0x2b')](function(_0x2f90cd){if(_0x2f90cd){_0x388ec3=_0x2f90cd['username'];_0x27ff17=_0x2f90cd[_0x368a('0x61')];_0x4f8eea=_0x2f90cd[_0x368a('0x5e')];_0x8d3cea=_0x2f90cd[_0x368a('0x5f')];var _0x5e8369=_0x8d3cea['slice'](-0x1);if(_0x5e8369==='/'){_0x8d3cea=_0x8d3cea[_0x368a('0x62')](0x0,_0x8d3cea[_0x368a('0x63')](_0x5e8369));}_0x246bcf=util[_0x368a('0x64')]('%s/webservice.php',_0x8d3cea);var _0x33e2a0={'method':'GET','uri':_0x246bcf,'qs':{'operation':_0x368a('0x65'),'username':_0x2f90cd[_0x368a('0x5c')]},'json':!![]};return rp(_0x33e2a0);}})['then'](function(_0x18828b){if(_0x18828b[_0x368a('0x66')]){var _0x2060aa={'method':_0x368a('0x67'),'uri':_0x246bcf,'form':{'operation':_0x368a('0x68'),'username':_0x388ec3,'accessKey':md5(_0x18828b[_0x368a('0x69')][_0x368a('0x6a')]+_0x27ff17)},'json':!![]};return rp(_0x2060aa);}})[_0x368a('0x2b')](function(_0x36dc63){if(_0x36dc63['success']){var _0x2abf51={'method':'GET','uri':_0x246bcf,'qs':{'operation':_0x368a('0x6b'),'username':_0x388ec3,'sessionName':_0x36dc63[_0x368a('0x69')][_0x368a('0x6c')],'elementType':_0x4f8eea},'json':!![]};return rp(_0x2abf51);}})[_0x368a('0x2b')](function(_0x49ca7f){if(_0x49ca7f[_0x368a('0x66')]){var _0x5c5d39=[_0x368a('0x6d'),'reference','owner'];_['remove'](_0x49ca7f['result'][_0x368a('0x3a')],function(_0x5c0ada){return _0x5c5d39[_0x368a('0x6e')](_0x5c0ada[_0x368a('0x45')][_0x368a('0x47')]);});_[_0x368a('0x6f')](_0x49ca7f['result']['fields'],function(_0x2381f4){return _0x2381f4[_0x368a('0x70')]==='false';});return{'count':_0x49ca7f['result']['fields'][_0x368a('0x3b')],'rows':_['map'](_0x49ca7f[_0x368a('0x69')][_0x368a('0x3a')],function(_0x4d7dcd){return{'id':_0x4d7dcd['name'],'name':_0x4d7dcd['label'],'custom':_[_0x368a('0x71')](_0x4d7dcd[_0x368a('0x47')],_0x368a('0x72'))?!![]:![],'options':_0x4d7dcd['type'][_0x368a('0x47')]===_0x368a('0x73')&&_0x4d7dcd[_0x368a('0x45')][_0x368a('0x74')]['length']>0x0?_[_0x368a('0x30')](_0x4d7dcd[_0x368a('0x45')][_0x368a('0x74')],function(_0x130e10){return{'name':_0x130e10[_0x368a('0x75')],'value':_0x130e10[_0x368a('0x76')]};}):[]};})};}})['then'](respondWithResult(_0xdf071d,null))['catch'](function(_0x29b76c){console[_0x368a('0x77')]('vTiger\x20error:\x20'+_0x29b76c);var _0x597028=_0x4b4879[_0x368a('0x35')][_0x368a('0x15')]?0x1f4:_0x29b76c[_0x368a('0x78')]||0x1f4;logger[_0x368a('0x1c')](_0x368a('0x79'),_0x368a('0x5b'),_0x597028,JSON[_0x368a('0x7a')](_0x29b76c));delete _0x29b76c[_0x368a('0x47')];if(_0x597028===0x191){_0x597028=0x190;}_0xdf071d[_0x368a('0x23')](_0x597028)[_0x368a('0x2e')](_0x4b4879[_0x368a('0x35')]['test']?{'message':_0x368a('0x7b'),'statusCode':_0x29b76c['statusCode']}:_0x29b76c);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 790b638..800b8e8 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 _0xc438=['../../config/logger','bluebird','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util'];(function(_0x473645,_0x587f2d){var _0x67c89e=function(_0x512178){while(--_0x512178){_0x473645['push'](_0x473645['shift']());}};_0x67c89e(++_0x587f2d);}(_0xc438,0x177));var _0x8c43=function(_0x488e64,_0x2a71ac){_0x488e64=_0x488e64-0x0;var _0x1e66ca=_0xc438[_0x488e64];return _0x1e66ca;};'use strict';var _=require(_0x8c43('0x0'));var util=require(_0x8c43('0x1'));var logger=require(_0x8c43('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8c43('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8c43('0x4'));var rimraf=require(_0x8c43('0x5'));var config=require(_0x8c43('0x6'));var attributes=require(_0x8c43('0x7'));var integrations=require(_0x8c43('0x8'));module[_0x8c43('0x9')]=function(_0x2e17a9,_0x2f2883){return _0x2e17a9[_0x8c43('0xa')](_0x8c43('0xb'),attributes,{'tableName':_0x8c43('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8652=['api','moment','request-promise','path','rimraf','./intVtigerAccount.attributes','exports','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger'];(function(_0x22a1b0,_0x235470){var _0x99019e=function(_0x5be81d){while(--_0x5be81d){_0x22a1b0['push'](_0x22a1b0['shift']());}};_0x99019e(++_0x235470);}(_0x8652,0xb1));var _0x2865=function(_0x77fd25,_0x226ea2){_0x77fd25=_0x77fd25-0x0;var _0xe14528=_0x8652[_0x77fd25];return _0xe14528;};'use strict';var _=require(_0x2865('0x0'));var util=require(_0x2865('0x1'));var logger=require(_0x2865('0x2'))(_0x2865('0x3'));var moment=require(_0x2865('0x4'));var BPromise=require('bluebird');var rp=require(_0x2865('0x5'));var fs=require('fs');var path=require(_0x2865('0x6'));var rimraf=require(_0x2865('0x7'));var config=require('../../config/environment');var attributes=require(_0x2865('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x2865('0x9')]=function(_0x10e614,_0x5a22b4){return _0x10e614['define'](_0x2865('0xa'),attributes,{'tableName':_0x2865('0xb'),'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 0d6d194..e7585a4 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 _0x861c=['http','request','then','info','request\x20sent','debug','stringify','code','error','VtigerAccount,\x20%s,\x20%s','message','GetVtigerAccount','findAll','raw','options','where','attributes','limit','include','map','model','catch','ShowVtigerAccount','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client'];(function(_0x2a2011,_0x4877bb){var _0x209df8=function(_0x768eac){while(--_0x768eac){_0x2a2011['push'](_0x2a2011['shift']());}};_0x209df8(++_0x4877bb);}(_0x861c,0x77));var _0xc861=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x861c[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xc861('0x0'));var util=require(_0xc861('0x1'));var moment=require('moment');var BPromise=require(_0xc861('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc861('0x3'));var db=require(_0xc861('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc861('0x5'))(_0xc861('0x6'));var config=require('../../config/environment');var jayson=require(_0xc861('0x7'));var client=jayson[_0xc861('0x8')][_0xc861('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40aa71,_0x10d52f,_0x183820){return new BPromise(function(_0x11869a,_0x5399f7){return client[_0xc861('0xa')](_0x40aa71,_0x183820)[_0xc861('0xb')](function(_0x2957a9){logger[_0xc861('0xc')]('VtigerAccount,\x20%s,\x20%s',_0x10d52f,_0xc861('0xd'));logger[_0xc861('0xe')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x10d52f,_0xc861('0xd'),JSON[_0xc861('0xf')](_0x2957a9));if(_0x2957a9['error']){if(_0x2957a9['error'][_0xc861('0x10')]===0x1f4){logger[_0xc861('0x11')](_0xc861('0x12'),_0x10d52f,_0x2957a9['error'][_0xc861('0x13')]);return _0x5399f7(_0x2957a9[_0xc861('0x11')][_0xc861('0x13')]);}logger[_0xc861('0x11')](_0xc861('0x12'),_0x10d52f,_0x2957a9[_0xc861('0x11')][_0xc861('0x13')]);return _0x11869a(_0x2957a9[_0xc861('0x11')][_0xc861('0x13')]);}else{logger[_0xc861('0xc')](_0xc861('0x12'),_0x10d52f,_0xc861('0xd'));_0x11869a(_0x2957a9['result'][_0xc861('0x13')]);}})['catch'](function(_0x23ee58){logger[_0xc861('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x10d52f,_0x23ee58);_0x5399f7(_0x23ee58);});});}exports[_0xc861('0x14')]=function(_0x154103){var _0x489525=this;return new Promise(function(_0x21eae9,_0x262b16){return db['VtigerAccount'][_0xc861('0x15')]({'raw':_0x154103['options']?_0x154103['options'][_0xc861('0x16')]===undefined?!![]:![]:!![],'where':_0x154103[_0xc861('0x17')]?_0x154103['options'][_0xc861('0x18')]||null:null,'attributes':_0x154103['options']?_0x154103[_0xc861('0x17')][_0xc861('0x19')]||null:null,'limit':_0x154103[_0xc861('0x17')]?_0x154103['options'][_0xc861('0x1a')]||null:null,'include':_0x154103[_0xc861('0x17')]?_0x154103[_0xc861('0x17')]['include']?_['map'](_0x154103[_0xc861('0x17')][_0xc861('0x1b')],function(_0x2b9730){return{'model':db[_0x2b9730['model']],'as':_0x2b9730['as'],'attributes':_0x2b9730['attributes'],'include':_0x2b9730[_0xc861('0x1b')]?_[_0xc861('0x1c')](_0x2b9730[_0xc861('0x1b')],function(_0x5db521){return{'model':db[_0x5db521[_0xc861('0x1d')]],'as':_0x5db521['as'],'attributes':_0x5db521[_0xc861('0x19')],'include':_0x5db521['include']?_[_0xc861('0x1c')](_0x5db521[_0xc861('0x1b')],function(_0x4b10c6){return{'model':db[_0x4b10c6[_0xc861('0x1d')]],'as':_0x4b10c6['as'],'attributes':_0x4b10c6[_0xc861('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc861('0xb')](function(_0x3083fa){logger[_0xc861('0xc')](_0xc861('0x14'),_0x154103);logger['debug'](_0xc861('0x14'),_0x154103,JSON[_0xc861('0xf')](_0x3083fa));_0x21eae9(_0x3083fa);})[_0xc861('0x1e')](function(_0x4614f5){logger['error']('GetVtigerAccount',_0x4614f5[_0xc861('0x13')],_0x154103);_0x262b16(_0x489525[_0xc861('0x11')](0x1f4,_0x4614f5['message']));});});};exports['ShowVtigerAccount']=function(_0x27d7bd){var _0x43e691=this;return new Promise(function(_0xf2fe70,_0x4f4730){return db['VtigerAccount']['find']({'raw':_0x27d7bd[_0xc861('0x17')]?_0x27d7bd['options'][_0xc861('0x16')]===undefined?!![]:![]:!![],'where':_0x27d7bd[_0xc861('0x17')]?_0x27d7bd['options'][_0xc861('0x18')]||null:null,'attributes':_0x27d7bd[_0xc861('0x17')]?_0x27d7bd['options']['attributes']||null:null,'include':_0x27d7bd[_0xc861('0x17')]?_0x27d7bd[_0xc861('0x17')][_0xc861('0x1b')]?_[_0xc861('0x1c')](_0x27d7bd[_0xc861('0x17')][_0xc861('0x1b')],function(_0x4fd211){return{'model':db[_0x4fd211[_0xc861('0x1d')]],'as':_0x4fd211['as'],'attributes':_0x4fd211['attributes'],'include':_0x4fd211[_0xc861('0x1b')]?_[_0xc861('0x1c')](_0x4fd211[_0xc861('0x1b')],function(_0x1a1604){return{'model':db[_0x1a1604[_0xc861('0x1d')]],'as':_0x1a1604['as'],'attributes':_0x1a1604[_0xc861('0x19')],'include':_0x1a1604[_0xc861('0x1b')]?_[_0xc861('0x1c')](_0x1a1604[_0xc861('0x1b')],function(_0x51d781){return{'model':db[_0x51d781[_0xc861('0x1d')]],'as':_0x51d781['as'],'attributes':_0x51d781[_0xc861('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc861('0xb')](function(_0x57d680){logger[_0xc861('0xc')](_0xc861('0x1f'),_0x27d7bd);logger['debug'](_0xc861('0x1f'),_0x27d7bd,JSON['stringify'](_0x57d680));_0xf2fe70(_0x57d680);})[_0xc861('0x1e')](function(_0x2617d5){logger[_0xc861('0x11')](_0xc861('0x1f'),_0x2617d5[_0xc861('0x13')],_0x27d7bd);_0x4f4730(_0x43e691[_0xc861('0x11')](0x1f4,_0x2617d5[_0xc861('0x13')]));});});}; \ No newline at end of file +var _0x01c2=['GetVtigerAccount','ShowVtigerAccount','VtigerAccount','where','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','findAll','options','attributes','limit','include','map','model'];(function(_0x30ea4f,_0x345cdc){var _0x3427f2=function(_0x49fdc2){while(--_0x49fdc2){_0x30ea4f['push'](_0x30ea4f['shift']());}};_0x3427f2(++_0x345cdc);}(_0x01c2,0x197));var _0x201c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x01c2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x201c('0x0'));var moment=require(_0x201c('0x1'));var BPromise=require(_0x201c('0x2'));var rs=require(_0x201c('0x3'));var fs=require('fs');var Redis=require(_0x201c('0x4'));var db=require(_0x201c('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x201c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x201c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e88d0,_0x56a319,_0x46fc15){return new BPromise(function(_0x1fd203,_0x1fd76b){return client[_0x201c('0x8')](_0x5e88d0,_0x46fc15)[_0x201c('0x9')](function(_0x48a6f1){logger[_0x201c('0xa')](_0x201c('0xb'),_0x56a319,_0x201c('0xc'));logger[_0x201c('0xd')](_0x201c('0xe'),_0x56a319,_0x201c('0xc'),JSON[_0x201c('0xf')](_0x48a6f1));if(_0x48a6f1['error']){if(_0x48a6f1[_0x201c('0x10')][_0x201c('0x11')]===0x1f4){logger[_0x201c('0x10')]('VtigerAccount,\x20%s,\x20%s',_0x56a319,_0x48a6f1[_0x201c('0x10')][_0x201c('0x12')]);return _0x1fd76b(_0x48a6f1['error']['message']);}logger['error'](_0x201c('0xb'),_0x56a319,_0x48a6f1[_0x201c('0x10')][_0x201c('0x12')]);return _0x1fd203(_0x48a6f1[_0x201c('0x10')][_0x201c('0x12')]);}else{logger['info'](_0x201c('0xb'),_0x56a319,_0x201c('0xc'));_0x1fd203(_0x48a6f1['result'][_0x201c('0x12')]);}})[_0x201c('0x13')](function(_0xa8211c){logger[_0x201c('0x10')](_0x201c('0xb'),_0x56a319,_0xa8211c);_0x1fd76b(_0xa8211c);});});}exports['GetVtigerAccount']=function(_0x4e43a5){var _0x3ce635=this;return new Promise(function(_0x447879,_0x15bfec){return db['VtigerAccount'][_0x201c('0x14')]({'raw':_0x4e43a5[_0x201c('0x15')]?_0x4e43a5['options']['raw']===undefined?!![]:![]:!![],'where':_0x4e43a5[_0x201c('0x15')]?_0x4e43a5[_0x201c('0x15')]['where']||null:null,'attributes':_0x4e43a5[_0x201c('0x15')]?_0x4e43a5[_0x201c('0x15')][_0x201c('0x16')]||null:null,'limit':_0x4e43a5['options']?_0x4e43a5['options'][_0x201c('0x17')]||null:null,'include':_0x4e43a5[_0x201c('0x15')]?_0x4e43a5[_0x201c('0x15')][_0x201c('0x18')]?_[_0x201c('0x19')](_0x4e43a5[_0x201c('0x15')][_0x201c('0x18')],function(_0x50650f){return{'model':db[_0x50650f[_0x201c('0x1a')]],'as':_0x50650f['as'],'attributes':_0x50650f[_0x201c('0x16')],'include':_0x50650f[_0x201c('0x18')]?_[_0x201c('0x19')](_0x50650f['include'],function(_0xa7e416){return{'model':db[_0xa7e416[_0x201c('0x1a')]],'as':_0xa7e416['as'],'attributes':_0xa7e416[_0x201c('0x16')],'include':_0xa7e416[_0x201c('0x18')]?_[_0x201c('0x19')](_0xa7e416[_0x201c('0x18')],function(_0x403398){return{'model':db[_0x403398[_0x201c('0x1a')]],'as':_0x403398['as'],'attributes':_0x403398[_0x201c('0x16')]};}):[]};}):[]};}):[]:[]})[_0x201c('0x9')](function(_0x438ead){logger['info'](_0x201c('0x1b'),_0x4e43a5);logger['debug'](_0x201c('0x1b'),_0x4e43a5,JSON[_0x201c('0xf')](_0x438ead));_0x447879(_0x438ead);})['catch'](function(_0x2c5e49){logger['error'](_0x201c('0x1b'),_0x2c5e49[_0x201c('0x12')],_0x4e43a5);_0x15bfec(_0x3ce635[_0x201c('0x10')](0x1f4,_0x2c5e49['message']));});});};exports[_0x201c('0x1c')]=function(_0x35bbb9){var _0x4fa371=this;return new Promise(function(_0x58f867,_0x41ed65){return db[_0x201c('0x1d')]['find']({'raw':_0x35bbb9[_0x201c('0x15')]?_0x35bbb9[_0x201c('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x35bbb9[_0x201c('0x15')]?_0x35bbb9[_0x201c('0x15')][_0x201c('0x1e')]||null:null,'attributes':_0x35bbb9['options']?_0x35bbb9[_0x201c('0x15')][_0x201c('0x16')]||null:null,'include':_0x35bbb9[_0x201c('0x15')]?_0x35bbb9['options']['include']?_[_0x201c('0x19')](_0x35bbb9[_0x201c('0x15')]['include'],function(_0x3b4fd2){return{'model':db[_0x3b4fd2[_0x201c('0x1a')]],'as':_0x3b4fd2['as'],'attributes':_0x3b4fd2[_0x201c('0x16')],'include':_0x3b4fd2[_0x201c('0x18')]?_[_0x201c('0x19')](_0x3b4fd2[_0x201c('0x18')],function(_0x556334){return{'model':db[_0x556334[_0x201c('0x1a')]],'as':_0x556334['as'],'attributes':_0x556334['attributes'],'include':_0x556334[_0x201c('0x18')]?_[_0x201c('0x19')](_0x556334[_0x201c('0x18')],function(_0x48e09b){return{'model':db[_0x48e09b[_0x201c('0x1a')]],'as':_0x48e09b['as'],'attributes':_0x48e09b['attributes']};}):[]};}):[]};}):[]:[]})[_0x201c('0x9')](function(_0xf4b6d9){logger[_0x201c('0xa')](_0x201c('0x1c'),_0x35bbb9);logger[_0x201c('0xd')]('ShowVtigerAccount',_0x35bbb9,JSON[_0x201c('0xf')](_0xf4b6d9));_0x58f867(_0xf4b6d9);})[_0x201c('0x13')](function(_0x1f1909){logger[_0x201c('0x10')](_0x201c('0x1c'),_0x1f1909['message'],_0x35bbb9);_0x41ed65(_0x4fa371[_0x201c('0x10')](0x1f4,_0x1f1909[_0x201c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 83aa307..811fd5f 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(_0x307086,_0x3bfe4e){var _0x699043=function(_0x1a7677){while(--_0x1a7677){_0x307086['push'](_0x307086['shift']());}};_0x699043(++_0x3bfe4e);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/:id/fields',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x8')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0x8')](_0x0d8b('0xf'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['post']('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x11')]);router[_0x0d8b('0x12')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x13')]);router[_0x0d8b('0x14')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x15')]);module[_0x0d8b('0x16')]=router; \ No newline at end of file +var _0xb10b=['/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated'];(function(_0x384bbc,_0x50cf87){var _0x1e2eaa=function(_0x233cf3){while(--_0x233cf3){_0x384bbc['push'](_0x384bbc['shift']());}};_0x1e2eaa(++_0x50cf87);}(_0xb10b,0x12a));var _0xbb10=function(_0x31eb67,_0x9bc8c0){_0x31eb67=_0x31eb67-0x0;var _0x2a8cb8=_0xb10b[_0x31eb67];return _0x2a8cb8;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getSubjects']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['post']('/',auth[_0xbb10('0x9')](),controller['create']);router[_0xbb10('0x11')](_0xbb10('0xa'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0x14')]);module[_0xbb10('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 5236110..4b1cb1d 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 _0x9505=['sequelize','exports','STRING'];(function(_0x153e07,_0x407706){var _0x29cbc7=function(_0x3b4c58){while(--_0x3b4c58){_0x153e07['push'](_0x153e07['shift']());}};_0x29cbc7(++_0x407706);}(_0x9505,0x1b9));var _0x5950=function(_0x2c6c4f,_0x2344fb){_0x2c6c4f=_0x2c6c4f-0x0;var _0x3d9847=_0x9505[_0x2c6c4f];return _0x3d9847;};'use strict';var Sequelize=require(_0x5950('0x0'));module[_0x5950('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5950('0x2')]}}; \ No newline at end of file +var _0x9d1d=['exports','STRING'];(function(_0x43f0f3,_0x105565){var _0x4926db=function(_0x471ad5){while(--_0x471ad5){_0x43f0f3['push'](_0x43f0f3['shift']());}};_0x4926db(++_0x105565);}(_0x9d1d,0x158));var _0xd9d1=function(_0x584f9f,_0x1efe32){_0x584f9f=_0x584f9f-0x0;var _0x3d08c1=_0x9d1d[_0x584f9f];return _0x3d08c1;};'use strict';var Sequelize=require('sequelize');module[_0xd9d1('0x0')]={'name':{'type':Sequelize[_0xd9d1('0x1')]},'description':{'type':Sequelize[_0xd9d1('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 7f11338..ba6a9e0 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 _0x5e5b=['create','body','findOne','VtigerField','getFields','getSubjects','getDescriptions','merge','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','name','index','map','rawAttributes','fieldName','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','VtigerConfiguration','include','params','includeAll','find'];(function(_0x3f86d7,_0x37a9c9){var _0x1afc5f=function(_0x148610){while(--_0x148610){_0x3f86d7['push'](_0x3f86d7['shift']());}};_0x1afc5f(++_0x37a9c9);}(_0x5e5b,0x113));var _0xb5e5=function(_0x372ca0,_0x598311){_0x372ca0=_0x372ca0-0x0;var _0x332594=_0x5e5b[_0x372ca0];return _0x332594;};'use strict';var pdf=require(_0xb5e5('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb5e5('0x1'));var jsonpatch=require(_0xb5e5('0x2'));var rp=require(_0xb5e5('0x3'));var moment=require(_0xb5e5('0x4'));var BPromise=require(_0xb5e5('0x5'));var Mustache=require(_0xb5e5('0x6'));var util=require(_0xb5e5('0x7'));var path=require(_0xb5e5('0x8'));var sox=require(_0xb5e5('0x9'));var csv=require(_0xb5e5('0xa'));var ejs=require(_0xb5e5('0xb'));var fs=require('fs');var _=require(_0xb5e5('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb5e5('0xd'));var deskjs=require(_0xb5e5('0xe'));var toCsv=require(_0xb5e5('0xa'));var querystring=require(_0xb5e5('0xf'));var Papa=require('papaparse');var Redis=require(_0xb5e5('0x10'));var authService=require(_0xb5e5('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb5e5('0x12'));var logger=require(_0xb5e5('0x13'))(_0xb5e5('0x14'));var utils=require(_0xb5e5('0x15'));var config=require(_0xb5e5('0x16'));var db=require(_0xb5e5('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xb5e5('0x18')]({'port':0x232a});function checkPasswordPattern(_0x447ec4,_0x3d5aac,_0x5eaa26){if(_0x5eaa26){var _0x3333c3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3333c3[_0xb5e5('0x19')](_0x3d5aac)){return _0x447ec4;}else{throw new db[(_0xb5e5('0x1a'))]['ValidationError'](_0xb5e5('0x1b'));}}else{return _0x447ec4;}}function respondWithRpcPromise(_0x36ce71,_0x176b22,_0x4fef32,_0x33086d){return new BPromise(function(_0x236b38,_0x2dc667){var _0x111dc8=_0x33086d||client;return _0x111dc8[_0xb5e5('0x1c')](_0x36ce71,_0x4fef32)[_0xb5e5('0x1d')](function(_0x34e821){logger[_0xb5e5('0x1e')](_0xb5e5('0x1f'),_0x176b22,_0xb5e5('0x20'));logger[_0xb5e5('0x21')](_0xb5e5('0x22'),_0x176b22,_0xb5e5('0x20'),JSON[_0xb5e5('0x23')](_0x34e821));if(_0x34e821[_0xb5e5('0x24')]){if(_0x34e821['error'][_0xb5e5('0x25')]===0x1f4){logger[_0xb5e5('0x24')](_0xb5e5('0x1f'),_0x176b22,_0x34e821['error'][_0xb5e5('0x26')]);return _0x2dc667(_0x34e821[_0xb5e5('0x24')][_0xb5e5('0x26')]);}logger[_0xb5e5('0x24')](_0xb5e5('0x1f'),_0x176b22,_0x34e821[_0xb5e5('0x24')][_0xb5e5('0x26')]);return _0x236b38(_0x34e821[_0xb5e5('0x24')][_0xb5e5('0x26')]);}else{logger[_0xb5e5('0x1e')](_0xb5e5('0x1f'),_0x176b22,_0xb5e5('0x20'));_0x236b38(_0x34e821[_0xb5e5('0x27')]['message']);}})[_0xb5e5('0x28')](function(_0xf52f0){logger[_0xb5e5('0x24')](_0xb5e5('0x1f'),_0x176b22,_0xf52f0);_0x2dc667(_0xf52f0);});});}function respondWithStatusCode(_0x2d9c30,_0x358226){_0x358226=_0x358226||0xcc;return function(_0x2c4fbe){if(_0x2c4fbe){return _0x2d9c30[_0xb5e5('0x29')](_0x358226);}return _0x2d9c30[_0xb5e5('0x2a')](_0x358226)[_0xb5e5('0x2b')]();};}function respondWithResult(_0xa414d3,_0x39d21b){_0x39d21b=_0x39d21b||0xc8;return function(_0x348165){if(_0x348165){return _0xa414d3['status'](_0x39d21b)[_0xb5e5('0x2c')](_0x348165);}};}function respondWithFilteredResult(_0xcdbca5,_0x50f7d6){return function(_0x2b47a4){if(_0x2b47a4){var _0x5e73c1=_0x2b47a4[_0xb5e5('0x2d')],_0x131e88=_0x50f7d6[_0xb5e5('0x2e')],_0x5d665a=_0x50f7d6[_0xb5e5('0x2e')]+_0x50f7d6[_0xb5e5('0x2f')],_0x569c64;if(_0x5d665a>=_0x5e73c1){_0x5d665a=_0x5e73c1;_0x569c64=0xc8;}else{_0x569c64=0xce;}_0xcdbca5['status'](_0x569c64);return _0xcdbca5['set'](_0xb5e5('0x30'),_0x131e88+'-'+_0x5d665a+'/'+_0x5e73c1)[_0xb5e5('0x2c')](_0x2b47a4);}return null;};}function patchUpdates(_0x57f1b2){return function(_0x11da82){try{jsonpatch[_0xb5e5('0x31')](_0x11da82,_0x57f1b2,!![]);}catch(_0x3e38fe){return BPromise[_0xb5e5('0x32')](_0x3e38fe);}return _0x11da82[_0xb5e5('0x33')]();};}function saveUpdates(_0x4981c3,_0x37836a){return function(_0x542278){if(_0x542278){return _0x542278[_0xb5e5('0x34')](_0x4981c3)[_0xb5e5('0x1d')](function(_0x29095c){return _0x29095c;});}return null;};}function removeEntity(_0x1d1885,_0x29181b){return function(_0x1e2dc8){if(_0x1e2dc8){return _0x1e2dc8[_0xb5e5('0x35')]()[_0xb5e5('0x1d')](function(){_0x1d1885[_0xb5e5('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x236249,_0x23d83d){return function(_0x39eb5d){if(!_0x39eb5d){_0x236249[_0xb5e5('0x29')](0x194);}return _0x39eb5d;};}function handleError(_0xf98c8d,_0x51f36a){_0x51f36a=_0x51f36a||0x1f4;return function(_0x4dba0){logger['error'](_0x4dba0['stack']);if(_0x4dba0[_0xb5e5('0x36')]){delete _0x4dba0['name'];}_0xf98c8d[_0xb5e5('0x2a')](_0x51f36a)['send'](_0x4dba0);};}exports[_0xb5e5('0x37')]=function(_0x3b027e,_0x1f9690){var _0x2b61fa={},_0x55ebe5={},_0x5c85b1={'count':0x0,'rows':[]};var _0x2a40d6=_[_0xb5e5('0x38')](db['VtigerConfiguration'][_0xb5e5('0x39')],function(_0x413403){return{'name':_0x413403[_0xb5e5('0x3a')],'type':_0x413403['type']['key']};});_0x55ebe5['model']=_['map'](_0x2a40d6,'name');_0x55ebe5[_0xb5e5('0x3b')]=_[_0xb5e5('0x3c')](_0x3b027e[_0xb5e5('0x3b')]);_0x55ebe5[_0xb5e5('0x3d')]=_[_0xb5e5('0x3e')](_0x55ebe5[_0xb5e5('0x3f')],_0x55ebe5[_0xb5e5('0x3b')]);_0x2b61fa['attributes']=_['intersection'](_0x55ebe5[_0xb5e5('0x3f')],qs[_0xb5e5('0x40')](_0x3b027e[_0xb5e5('0x3b')]['fields']));_0x2b61fa[_0xb5e5('0x41')]=_0x2b61fa[_0xb5e5('0x41')][_0xb5e5('0x42')]?_0x2b61fa['attributes']:_0x55ebe5['model'];if(!_0x3b027e['query'][_0xb5e5('0x43')](_0xb5e5('0x44'))){_0x2b61fa[_0xb5e5('0x2f')]=qs[_0xb5e5('0x2f')](_0x3b027e['query'][_0xb5e5('0x2f')]);_0x2b61fa['offset']=qs[_0xb5e5('0x2e')](_0x3b027e[_0xb5e5('0x3b')]['offset']);}_0x2b61fa[_0xb5e5('0x45')]=qs[_0xb5e5('0x46')](_0x3b027e['query'][_0xb5e5('0x46')]);_0x2b61fa[_0xb5e5('0x47')]=qs['filters'](_[_0xb5e5('0x48')](_0x3b027e[_0xb5e5('0x3b')],_0x55ebe5[_0xb5e5('0x3d')]),_0x2a40d6);if(_0x3b027e['query'][_0xb5e5('0x49')]){_0x2b61fa[_0xb5e5('0x47')]=_['merge'](_0x2b61fa[_0xb5e5('0x47')],{'$or':_['map'](_0x2a40d6,function(_0x18bffc){if(_0x18bffc['type']!==_0xb5e5('0x4a')){var _0x29671e={};_0x29671e[_0x18bffc[_0xb5e5('0x36')]]={'$like':'%'+_0x3b027e[_0xb5e5('0x3b')][_0xb5e5('0x49')]+'%'};return _0x29671e;}})});}_0x2b61fa=_['merge']({},_0x2b61fa,_0x3b027e[_0xb5e5('0x4b')]);var _0x266ab1={'where':_0x2b61fa[_0xb5e5('0x47')]};return db[_0xb5e5('0x4c')][_0xb5e5('0x2d')](_0x266ab1)['then'](function(_0x3c161f){_0x5c85b1[_0xb5e5('0x2d')]=_0x3c161f;if(_0x3b027e[_0xb5e5('0x3b')]['includeAll']){_0x2b61fa[_0xb5e5('0x4d')]=[{'all':!![]}];}return db[_0xb5e5('0x4c')]['findAll'](_0x2b61fa);})[_0xb5e5('0x1d')](function(_0x310a10){_0x5c85b1['rows']=_0x310a10;return _0x5c85b1;})['then'](respondWithFilteredResult(_0x1f9690,_0x2b61fa))['catch'](handleError(_0x1f9690,null));};exports['show']=function(_0x2204f1,_0x1d7390){var _0x18b6ec={'raw':![],'where':{'id':_0x2204f1[_0xb5e5('0x4e')]['id']}},_0x54e127={};_0x54e127[_0xb5e5('0x3f')]=_[_0xb5e5('0x3c')](db[_0xb5e5('0x4c')][_0xb5e5('0x39')]);_0x54e127[_0xb5e5('0x3b')]=_[_0xb5e5('0x3c')](_0x2204f1[_0xb5e5('0x3b')]);_0x54e127[_0xb5e5('0x3d')]=_['intersection'](_0x54e127[_0xb5e5('0x3f')],_0x54e127[_0xb5e5('0x3b')]);_0x18b6ec[_0xb5e5('0x41')]=_[_0xb5e5('0x3e')](_0x54e127[_0xb5e5('0x3f')],qs[_0xb5e5('0x40')](_0x2204f1[_0xb5e5('0x3b')][_0xb5e5('0x40')]));_0x18b6ec[_0xb5e5('0x41')]=_0x18b6ec[_0xb5e5('0x41')]['length']?_0x18b6ec[_0xb5e5('0x41')]:_0x54e127[_0xb5e5('0x3f')];if(_0x2204f1['query'][_0xb5e5('0x4f')]){_0x18b6ec['include']=[{'all':!![]}];}_0x18b6ec=_['merge']({},_0x18b6ec,_0x2204f1[_0xb5e5('0x4b')]);return db[_0xb5e5('0x4c')][_0xb5e5('0x50')](_0x18b6ec)[_0xb5e5('0x1d')](handleEntityNotFound(_0x1d7390,null))[_0xb5e5('0x1d')](respondWithResult(_0x1d7390,null))[_0xb5e5('0x28')](handleError(_0x1d7390,null));};exports[_0xb5e5('0x51')]=function(_0x341307,_0x51c8e2){return db[_0xb5e5('0x4c')]['create'](_0x341307['body'],{})[_0xb5e5('0x1d')](respondWithResult(_0x51c8e2,0xc9))[_0xb5e5('0x28')](handleError(_0x51c8e2,null));};exports[_0xb5e5('0x34')]=function(_0x3eb2cd,_0x4ee207){if(_0x3eb2cd[_0xb5e5('0x52')]['id']){delete _0x3eb2cd['body']['id'];}return db['VtigerConfiguration'][_0xb5e5('0x50')]({'where':{'id':_0x3eb2cd['params']['id']}})[_0xb5e5('0x1d')](handleEntityNotFound(_0x4ee207,null))[_0xb5e5('0x1d')](saveUpdates(_0x3eb2cd[_0xb5e5('0x52')],null))[_0xb5e5('0x1d')](respondWithResult(_0x4ee207,null))[_0xb5e5('0x28')](handleError(_0x4ee207,null));};exports[_0xb5e5('0x35')]=function(_0x231f9e,_0x5dc190){return db[_0xb5e5('0x4c')][_0xb5e5('0x50')]({'where':{'id':_0x231f9e[_0xb5e5('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5dc190,null))[_0xb5e5('0x1d')](removeEntity(_0x5dc190,null))['catch'](handleError(_0x5dc190,null));};exports['getFields']=function(_0xb07f17,_0x5c3df5,_0x2e7e5c){var _0x8e9ae9={};var _0x1dccb9={};var _0x2d8df6;var _0x3b5e81;return db[_0xb5e5('0x4c')][_0xb5e5('0x53')]({'where':{'id':_0xb07f17[_0xb5e5('0x4e')]['id']}})[_0xb5e5('0x1d')](handleEntityNotFound(_0x5c3df5,null))[_0xb5e5('0x1d')](function(_0x35a707){if(_0x35a707){_0x2d8df6=_0x35a707;_0x1dccb9[_0xb5e5('0x3f')]=_[_0xb5e5('0x3c')](db[_0xb5e5('0x54')][_0xb5e5('0x39')]);_0x1dccb9[_0xb5e5('0x3b')]=_['keys'](_0xb07f17[_0xb5e5('0x3b')]);_0x1dccb9[_0xb5e5('0x3d')]=_[_0xb5e5('0x3e')](_0x1dccb9[_0xb5e5('0x3f')],_0x1dccb9[_0xb5e5('0x3b')]);_0x8e9ae9[_0xb5e5('0x41')]=_[_0xb5e5('0x3e')](_0x1dccb9[_0xb5e5('0x3f')],qs[_0xb5e5('0x40')](_0xb07f17[_0xb5e5('0x3b')]['fields']));_0x8e9ae9[_0xb5e5('0x41')]=_0x8e9ae9[_0xb5e5('0x41')][_0xb5e5('0x42')]?_0x8e9ae9['attributes']:_0x1dccb9[_0xb5e5('0x3f')];_0x8e9ae9[_0xb5e5('0x45')]=qs[_0xb5e5('0x46')](_0xb07f17[_0xb5e5('0x3b')][_0xb5e5('0x46')]);_0x8e9ae9[_0xb5e5('0x47')]=qs[_0xb5e5('0x3d')](_[_0xb5e5('0x48')](_0xb07f17['query'],_0x1dccb9[_0xb5e5('0x3d')]));if(_0xb07f17[_0xb5e5('0x3b')]['filter']){_0x8e9ae9[_0xb5e5('0x47')]=_['merge'](_0x8e9ae9[_0xb5e5('0x47')],{'$or':_[_0xb5e5('0x38')](_0x8e9ae9['attributes'],function(_0x1a3af6){var _0x54ab6b={};_0x54ab6b[_0x1a3af6]={'$like':'%'+_0xb07f17[_0xb5e5('0x3b')][_0xb5e5('0x49')]+'%'};return _0x54ab6b;})});}_0x8e9ae9=_['merge']({},_0x8e9ae9,_0xb07f17[_0xb5e5('0x4b')]);return _0x2d8df6[_0xb5e5('0x55')](_0x8e9ae9);}})[_0xb5e5('0x1d')](function(_0x49ccfc){if(_0x49ccfc){_0x3b5e81=_0x49ccfc['length'];if(!_0xb07f17['query'][_0xb5e5('0x43')](_0xb5e5('0x44'))){_0x8e9ae9[_0xb5e5('0x2f')]=qs[_0xb5e5('0x2f')](_0xb07f17['query'][_0xb5e5('0x2f')]);_0x8e9ae9[_0xb5e5('0x2e')]=qs['offset'](_0xb07f17['query'][_0xb5e5('0x2e')]);}return _0x2d8df6['getFields'](_0x8e9ae9);}})['then'](function(_0x4bf127){if(_0x4bf127){return _0x4bf127?{'count':_0x3b5e81,'rows':_0x4bf127}:null;}})[_0xb5e5('0x1d')](respondWithResult(_0x5c3df5,null))[_0xb5e5('0x28')](handleError(_0x5c3df5,null));};exports[_0xb5e5('0x56')]=function(_0x1c8456,_0x3bdf93,_0x5e21e3){var _0x279284={};var _0x113cb0={};var _0x560a16;var _0x7e708a;return db[_0xb5e5('0x4c')][_0xb5e5('0x53')]({'where':{'id':_0x1c8456[_0xb5e5('0x4e')]['id']}})[_0xb5e5('0x1d')](handleEntityNotFound(_0x3bdf93,null))[_0xb5e5('0x1d')](function(_0x5e8471){if(_0x5e8471){_0x560a16=_0x5e8471;_0x113cb0[_0xb5e5('0x3f')]=_['keys'](db[_0xb5e5('0x54')][_0xb5e5('0x39')]);_0x113cb0[_0xb5e5('0x3b')]=_[_0xb5e5('0x3c')](_0x1c8456[_0xb5e5('0x3b')]);_0x113cb0['filters']=_[_0xb5e5('0x3e')](_0x113cb0['model'],_0x113cb0['query']);_0x279284[_0xb5e5('0x41')]=_[_0xb5e5('0x3e')](_0x113cb0[_0xb5e5('0x3f')],qs[_0xb5e5('0x40')](_0x1c8456[_0xb5e5('0x3b')][_0xb5e5('0x40')]));_0x279284[_0xb5e5('0x41')]=_0x279284[_0xb5e5('0x41')][_0xb5e5('0x42')]?_0x279284[_0xb5e5('0x41')]:_0x113cb0[_0xb5e5('0x3f')];_0x279284['order']=qs[_0xb5e5('0x46')](_0x1c8456['query'][_0xb5e5('0x46')]);_0x279284[_0xb5e5('0x47')]=qs[_0xb5e5('0x3d')](_[_0xb5e5('0x48')](_0x1c8456[_0xb5e5('0x3b')],_0x113cb0[_0xb5e5('0x3d')]));if(_0x1c8456['query']['filter']){_0x279284[_0xb5e5('0x47')]=_['merge'](_0x279284[_0xb5e5('0x47')],{'$or':_[_0xb5e5('0x38')](_0x279284[_0xb5e5('0x41')],function(_0x239be5){var _0xbfeeec={};_0xbfeeec[_0x239be5]={'$like':'%'+_0x1c8456[_0xb5e5('0x3b')][_0xb5e5('0x49')]+'%'};return _0xbfeeec;})});}_0x279284=_['merge']({},_0x279284,_0x1c8456['options']);return _0x560a16[_0xb5e5('0x56')](_0x279284);}})[_0xb5e5('0x1d')](function(_0x33f519){if(_0x33f519){_0x7e708a=_0x33f519[_0xb5e5('0x42')];if(!_0x1c8456['query']['hasOwnProperty'](_0xb5e5('0x44'))){_0x279284[_0xb5e5('0x2f')]=qs[_0xb5e5('0x2f')](_0x1c8456[_0xb5e5('0x3b')][_0xb5e5('0x2f')]);_0x279284[_0xb5e5('0x2e')]=qs[_0xb5e5('0x2e')](_0x1c8456[_0xb5e5('0x3b')][_0xb5e5('0x2e')]);}return _0x560a16[_0xb5e5('0x56')](_0x279284);}})['then'](function(_0x508ab6){if(_0x508ab6){return _0x508ab6?{'count':_0x7e708a,'rows':_0x508ab6}:null;}})['then'](respondWithResult(_0x3bdf93,null))[_0xb5e5('0x28')](handleError(_0x3bdf93,null));};exports[_0xb5e5('0x57')]=function(_0x1a4390,_0x4d16ed,_0x3c9e65){var _0x373353={};var _0x3346bc={};var _0x417ca8;var _0x30462e;return db[_0xb5e5('0x4c')][_0xb5e5('0x53')]({'where':{'id':_0x1a4390[_0xb5e5('0x4e')]['id']}})[_0xb5e5('0x1d')](handleEntityNotFound(_0x4d16ed,null))['then'](function(_0x4a46e6){if(_0x4a46e6){_0x417ca8=_0x4a46e6;_0x3346bc[_0xb5e5('0x3f')]=_[_0xb5e5('0x3c')](db[_0xb5e5('0x54')][_0xb5e5('0x39')]);_0x3346bc[_0xb5e5('0x3b')]=_['keys'](_0x1a4390['query']);_0x3346bc[_0xb5e5('0x3d')]=_[_0xb5e5('0x3e')](_0x3346bc['model'],_0x3346bc[_0xb5e5('0x3b')]);_0x373353[_0xb5e5('0x41')]=_[_0xb5e5('0x3e')](_0x3346bc[_0xb5e5('0x3f')],qs[_0xb5e5('0x40')](_0x1a4390['query'][_0xb5e5('0x40')]));_0x373353[_0xb5e5('0x41')]=_0x373353[_0xb5e5('0x41')]['length']?_0x373353[_0xb5e5('0x41')]:_0x3346bc[_0xb5e5('0x3f')];_0x373353[_0xb5e5('0x45')]=qs[_0xb5e5('0x46')](_0x1a4390[_0xb5e5('0x3b')][_0xb5e5('0x46')]);_0x373353[_0xb5e5('0x47')]=qs[_0xb5e5('0x3d')](_[_0xb5e5('0x48')](_0x1a4390[_0xb5e5('0x3b')],_0x3346bc[_0xb5e5('0x3d')]));if(_0x1a4390[_0xb5e5('0x3b')][_0xb5e5('0x49')]){_0x373353[_0xb5e5('0x47')]=_[_0xb5e5('0x58')](_0x373353['where'],{'$or':_[_0xb5e5('0x38')](_0x373353['attributes'],function(_0x515561){var _0x4dae2f={};_0x4dae2f[_0x515561]={'$like':'%'+_0x1a4390[_0xb5e5('0x3b')][_0xb5e5('0x49')]+'%'};return _0x4dae2f;})});}_0x373353=_[_0xb5e5('0x58')]({},_0x373353,_0x1a4390[_0xb5e5('0x4b')]);return _0x417ca8[_0xb5e5('0x57')](_0x373353);}})[_0xb5e5('0x1d')](function(_0x4c4ca7){if(_0x4c4ca7){_0x30462e=_0x4c4ca7[_0xb5e5('0x42')];if(!_0x1a4390[_0xb5e5('0x3b')]['hasOwnProperty'](_0xb5e5('0x44'))){_0x373353[_0xb5e5('0x2f')]=qs[_0xb5e5('0x2f')](_0x1a4390['query'][_0xb5e5('0x2f')]);_0x373353[_0xb5e5('0x2e')]=qs[_0xb5e5('0x2e')](_0x1a4390[_0xb5e5('0x3b')][_0xb5e5('0x2e')]);}return _0x417ca8[_0xb5e5('0x57')](_0x373353);}})['then'](function(_0x3a46b0){if(_0x3a46b0){return _0x3a46b0?{'count':_0x30462e,'rows':_0x3a46b0}:null;}})[_0xb5e5('0x1d')](respondWithResult(_0x4d16ed,null))[_0xb5e5('0x28')](handleError(_0x4d16ed,null));}; \ No newline at end of file +var _0x64dd=['create','body','find','getFields','VtigerField','rawAttributes','options','getSubjects','findOne','order','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../mysqldb','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','destroy','stack','name','VtigerConfiguration','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','map','VIRTUAL','merge','includeAll','include','findAll','rows','show','params'];(function(_0x1236b9,_0x35a9f0){var _0x5d273f=function(_0x488933){while(--_0x488933){_0x1236b9['push'](_0x1236b9['shift']());}};_0x5d273f(++_0x35a9f0);}(_0x64dd,0xc3));var _0xd64d=function(_0x5b3078,_0x37935d){_0x5b3078=_0x5b3078-0x0;var _0x22892c=_0x64dd[_0x5b3078];return _0x22892c;};'use strict';var pdf=require(_0xd64d('0x0'));var emlformat=require(_0xd64d('0x1'));var rimraf=require(_0xd64d('0x2'));var zipdir=require(_0xd64d('0x3'));var jsonpatch=require(_0xd64d('0x4'));var rp=require('request-promise');var moment=require(_0xd64d('0x5'));var BPromise=require(_0xd64d('0x6'));var Mustache=require(_0xd64d('0x7'));var util=require(_0xd64d('0x8'));var path=require(_0xd64d('0x9'));var sox=require('sox');var csv=require(_0xd64d('0xa'));var ejs=require(_0xd64d('0xb'));var fs=require('fs');var _=require(_0xd64d('0xc'));var squel=require(_0xd64d('0xd'));var crypto=require('crypto');var jsforce=require(_0xd64d('0xe'));var deskjs=require(_0xd64d('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd64d('0x10'));var Papa=require(_0xd64d('0x11'));var Redis=require(_0xd64d('0x12'));var authService=require(_0xd64d('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd64d('0x14'));var logger=require(_0xd64d('0x15'))(_0xd64d('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xd64d('0x17'))['db'];var jayson=require(_0xd64d('0x18'));var client=jayson[_0xd64d('0x19')][_0xd64d('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x61b248,_0x3229d4,_0x44bea6){if(_0x44bea6){var _0x5168f8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5168f8['test'](_0x3229d4)){return _0x61b248;}else{throw new db[(_0xd64d('0x1b'))][(_0xd64d('0x1c'))](_0xd64d('0x1d'));}}else{return _0x61b248;}}function respondWithRpcPromise(_0x2c94bb,_0x5ccb16,_0x38efae,_0x580362){return new BPromise(function(_0x5aa3b8,_0x182ef8){var _0x115c4b=_0x580362||client;return _0x115c4b['request'](_0x2c94bb,_0x38efae)[_0xd64d('0x1e')](function(_0x2b443c){logger[_0xd64d('0x1f')](_0xd64d('0x20'),_0x5ccb16,'request\x20sent');logger[_0xd64d('0x21')](_0xd64d('0x22'),_0x5ccb16,_0xd64d('0x23'),JSON[_0xd64d('0x24')](_0x2b443c));if(_0x2b443c[_0xd64d('0x25')]){if(_0x2b443c['error'][_0xd64d('0x26')]===0x1f4){logger[_0xd64d('0x25')](_0xd64d('0x20'),_0x5ccb16,_0x2b443c[_0xd64d('0x25')][_0xd64d('0x27')]);return _0x182ef8(_0x2b443c[_0xd64d('0x25')][_0xd64d('0x27')]);}logger[_0xd64d('0x25')]('VtigerConfiguration,\x20%s,\x20%s',_0x5ccb16,_0x2b443c[_0xd64d('0x25')]['message']);return _0x5aa3b8(_0x2b443c[_0xd64d('0x25')][_0xd64d('0x27')]);}else{logger[_0xd64d('0x1f')]('VtigerConfiguration,\x20%s,\x20%s',_0x5ccb16,_0xd64d('0x23'));_0x5aa3b8(_0x2b443c[_0xd64d('0x28')]['message']);}})[_0xd64d('0x29')](function(_0x25ec0d){logger[_0xd64d('0x25')](_0xd64d('0x20'),_0x5ccb16,_0x25ec0d);_0x182ef8(_0x25ec0d);});});}function respondWithStatusCode(_0x53138a,_0xa9f6db){_0xa9f6db=_0xa9f6db||0xcc;return function(_0x4d6e27){if(_0x4d6e27){return _0x53138a[_0xd64d('0x2a')](_0xa9f6db);}return _0x53138a[_0xd64d('0x2b')](_0xa9f6db)['end']();};}function respondWithResult(_0x11a6f2,_0xa62557){_0xa62557=_0xa62557||0xc8;return function(_0x2a50e7){if(_0x2a50e7){return _0x11a6f2[_0xd64d('0x2b')](_0xa62557)[_0xd64d('0x2c')](_0x2a50e7);}};}function respondWithFilteredResult(_0x56622b,_0x20b575){return function(_0xe43cf){if(_0xe43cf){var _0x2e13dd=_0xe43cf[_0xd64d('0x2d')],_0x1c58c0=_0x20b575[_0xd64d('0x2e')],_0x147eed=_0x20b575[_0xd64d('0x2e')]+_0x20b575[_0xd64d('0x2f')],_0x1683f1;if(_0x147eed>=_0x2e13dd){_0x147eed=_0x2e13dd;_0x1683f1=0xc8;}else{_0x1683f1=0xce;}_0x56622b[_0xd64d('0x2b')](_0x1683f1);return _0x56622b['set'](_0xd64d('0x30'),_0x1c58c0+'-'+_0x147eed+'/'+_0x2e13dd)[_0xd64d('0x2c')](_0xe43cf);}return null;};}function patchUpdates(_0x1d9cae){return function(_0x390080){try{jsonpatch[_0xd64d('0x31')](_0x390080,_0x1d9cae,!![]);}catch(_0x584c0e){return BPromise[_0xd64d('0x32')](_0x584c0e);}return _0x390080[_0xd64d('0x33')]();};}function saveUpdates(_0x3097cb,_0x108826){return function(_0x360de4){if(_0x360de4){return _0x360de4['update'](_0x3097cb)[_0xd64d('0x1e')](function(_0x360f24){return _0x360f24;});}return null;};}function removeEntity(_0x57d80d,_0x59f1aa){return function(_0x2e7eac){if(_0x2e7eac){return _0x2e7eac[_0xd64d('0x34')]()['then'](function(){_0x57d80d[_0xd64d('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26ff59,_0x3d1dc4){return function(_0xa6a715){if(!_0xa6a715){_0x26ff59['sendStatus'](0x194);}return _0xa6a715;};}function handleError(_0x547b57,_0x54b71c){_0x54b71c=_0x54b71c||0x1f4;return function(_0x5728b0){logger[_0xd64d('0x25')](_0x5728b0[_0xd64d('0x35')]);if(_0x5728b0['name']){delete _0x5728b0[_0xd64d('0x36')];}_0x547b57[_0xd64d('0x2b')](_0x54b71c)['send'](_0x5728b0);};}exports['index']=function(_0xc52787,_0x2cd07e){var _0x171ace={},_0x33cfb2={},_0x439224={'count':0x0,'rows':[]};var _0x4be686=_['map'](db[_0xd64d('0x37')]['rawAttributes'],function(_0x427444){return{'name':_0x427444['fieldName'],'type':_0x427444[_0xd64d('0x38')][_0xd64d('0x39')]};});_0x33cfb2[_0xd64d('0x3a')]=_['map'](_0x4be686,_0xd64d('0x36'));_0x33cfb2[_0xd64d('0x3b')]=_[_0xd64d('0x3c')](_0xc52787[_0xd64d('0x3b')]);_0x33cfb2[_0xd64d('0x3d')]=_[_0xd64d('0x3e')](_0x33cfb2[_0xd64d('0x3a')],_0x33cfb2[_0xd64d('0x3b')]);_0x171ace[_0xd64d('0x3f')]=_[_0xd64d('0x3e')](_0x33cfb2[_0xd64d('0x3a')],qs[_0xd64d('0x40')](_0xc52787[_0xd64d('0x3b')][_0xd64d('0x40')]));_0x171ace[_0xd64d('0x3f')]=_0x171ace[_0xd64d('0x3f')][_0xd64d('0x41')]?_0x171ace[_0xd64d('0x3f')]:_0x33cfb2[_0xd64d('0x3a')];if(!_0xc52787[_0xd64d('0x3b')][_0xd64d('0x42')](_0xd64d('0x43'))){_0x171ace['limit']=qs[_0xd64d('0x2f')](_0xc52787['query'][_0xd64d('0x2f')]);_0x171ace[_0xd64d('0x2e')]=qs[_0xd64d('0x2e')](_0xc52787[_0xd64d('0x3b')][_0xd64d('0x2e')]);}_0x171ace['order']=qs['sort'](_0xc52787[_0xd64d('0x3b')][_0xd64d('0x44')]);_0x171ace[_0xd64d('0x45')]=qs[_0xd64d('0x3d')](_[_0xd64d('0x46')](_0xc52787[_0xd64d('0x3b')],_0x33cfb2['filters']),_0x4be686);if(_0xc52787['query'][_0xd64d('0x47')]){_0x171ace['where']=_['merge'](_0x171ace[_0xd64d('0x45')],{'$or':_[_0xd64d('0x48')](_0x4be686,function(_0x51d5f6){if(_0x51d5f6[_0xd64d('0x38')]!==_0xd64d('0x49')){var _0x3944bd={};_0x3944bd[_0x51d5f6[_0xd64d('0x36')]]={'$like':'%'+_0xc52787[_0xd64d('0x3b')][_0xd64d('0x47')]+'%'};return _0x3944bd;}})});}_0x171ace=_[_0xd64d('0x4a')]({},_0x171ace,_0xc52787['options']);var _0x3cbb5f={'where':_0x171ace[_0xd64d('0x45')]};return db[_0xd64d('0x37')][_0xd64d('0x2d')](_0x3cbb5f)[_0xd64d('0x1e')](function(_0x56d4cf){_0x439224[_0xd64d('0x2d')]=_0x56d4cf;if(_0xc52787[_0xd64d('0x3b')][_0xd64d('0x4b')]){_0x171ace[_0xd64d('0x4c')]=[{'all':!![]}];}return db[_0xd64d('0x37')][_0xd64d('0x4d')](_0x171ace);})['then'](function(_0xbb4e8e){_0x439224[_0xd64d('0x4e')]=_0xbb4e8e;return _0x439224;})['then'](respondWithFilteredResult(_0x2cd07e,_0x171ace))[_0xd64d('0x29')](handleError(_0x2cd07e,null));};exports[_0xd64d('0x4f')]=function(_0x303d69,_0x46cc66){var _0x28f9f2={'raw':![],'where':{'id':_0x303d69[_0xd64d('0x50')]['id']}},_0x4486d7={};_0x4486d7['model']=_[_0xd64d('0x3c')](db['VtigerConfiguration']['rawAttributes']);_0x4486d7[_0xd64d('0x3b')]=_[_0xd64d('0x3c')](_0x303d69[_0xd64d('0x3b')]);_0x4486d7['filters']=_[_0xd64d('0x3e')](_0x4486d7['model'],_0x4486d7[_0xd64d('0x3b')]);_0x28f9f2['attributes']=_[_0xd64d('0x3e')](_0x4486d7[_0xd64d('0x3a')],qs['fields'](_0x303d69['query'][_0xd64d('0x40')]));_0x28f9f2[_0xd64d('0x3f')]=_0x28f9f2[_0xd64d('0x3f')][_0xd64d('0x41')]?_0x28f9f2[_0xd64d('0x3f')]:_0x4486d7[_0xd64d('0x3a')];if(_0x303d69[_0xd64d('0x3b')]['includeAll']){_0x28f9f2[_0xd64d('0x4c')]=[{'all':!![]}];}_0x28f9f2=_[_0xd64d('0x4a')]({},_0x28f9f2,_0x303d69['options']);return db[_0xd64d('0x37')]['find'](_0x28f9f2)[_0xd64d('0x1e')](handleEntityNotFound(_0x46cc66,null))[_0xd64d('0x1e')](respondWithResult(_0x46cc66,null))[_0xd64d('0x29')](handleError(_0x46cc66,null));};exports[_0xd64d('0x51')]=function(_0x41addb,_0x32c11b){return db[_0xd64d('0x37')][_0xd64d('0x51')](_0x41addb[_0xd64d('0x52')],{})[_0xd64d('0x1e')](respondWithResult(_0x32c11b,0xc9))['catch'](handleError(_0x32c11b,null));};exports['update']=function(_0x49743f,_0x216ec1){if(_0x49743f[_0xd64d('0x52')]['id']){delete _0x49743f[_0xd64d('0x52')]['id'];}return db[_0xd64d('0x37')][_0xd64d('0x53')]({'where':{'id':_0x49743f[_0xd64d('0x50')]['id']}})['then'](handleEntityNotFound(_0x216ec1,null))[_0xd64d('0x1e')](saveUpdates(_0x49743f[_0xd64d('0x52')],null))['then'](respondWithResult(_0x216ec1,null))[_0xd64d('0x29')](handleError(_0x216ec1,null));};exports['destroy']=function(_0x5e355f,_0x1df6cd){return db['VtigerConfiguration'][_0xd64d('0x53')]({'where':{'id':_0x5e355f['params']['id']}})[_0xd64d('0x1e')](handleEntityNotFound(_0x1df6cd,null))[_0xd64d('0x1e')](removeEntity(_0x1df6cd,null))['catch'](handleError(_0x1df6cd,null));};exports[_0xd64d('0x54')]=function(_0x3eed66,_0x3a2dd4,_0x167b76){var _0x463034={};var _0x460efc={};var _0x1a3bb9;var _0x4fa8d8;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x3eed66[_0xd64d('0x50')]['id']}})[_0xd64d('0x1e')](handleEntityNotFound(_0x3a2dd4,null))[_0xd64d('0x1e')](function(_0x5dcf9c){if(_0x5dcf9c){_0x1a3bb9=_0x5dcf9c;_0x460efc['model']=_[_0xd64d('0x3c')](db[_0xd64d('0x55')][_0xd64d('0x56')]);_0x460efc['query']=_[_0xd64d('0x3c')](_0x3eed66[_0xd64d('0x3b')]);_0x460efc[_0xd64d('0x3d')]=_[_0xd64d('0x3e')](_0x460efc[_0xd64d('0x3a')],_0x460efc[_0xd64d('0x3b')]);_0x463034[_0xd64d('0x3f')]=_[_0xd64d('0x3e')](_0x460efc['model'],qs[_0xd64d('0x40')](_0x3eed66[_0xd64d('0x3b')][_0xd64d('0x40')]));_0x463034[_0xd64d('0x3f')]=_0x463034[_0xd64d('0x3f')][_0xd64d('0x41')]?_0x463034['attributes']:_0x460efc[_0xd64d('0x3a')];_0x463034['order']=qs[_0xd64d('0x44')](_0x3eed66[_0xd64d('0x3b')][_0xd64d('0x44')]);_0x463034[_0xd64d('0x45')]=qs['filters'](_[_0xd64d('0x46')](_0x3eed66[_0xd64d('0x3b')],_0x460efc[_0xd64d('0x3d')]));if(_0x3eed66[_0xd64d('0x3b')]['filter']){_0x463034[_0xd64d('0x45')]=_['merge'](_0x463034['where'],{'$or':_['map'](_0x463034[_0xd64d('0x3f')],function(_0x58baf5){var _0x4b1a4f={};_0x4b1a4f[_0x58baf5]={'$like':'%'+_0x3eed66['query']['filter']+'%'};return _0x4b1a4f;})});}_0x463034=_[_0xd64d('0x4a')]({},_0x463034,_0x3eed66[_0xd64d('0x57')]);return _0x1a3bb9[_0xd64d('0x54')](_0x463034);}})[_0xd64d('0x1e')](function(_0x3e0f0a){if(_0x3e0f0a){_0x4fa8d8=_0x3e0f0a[_0xd64d('0x41')];if(!_0x3eed66['query']['hasOwnProperty'](_0xd64d('0x43'))){_0x463034[_0xd64d('0x2f')]=qs[_0xd64d('0x2f')](_0x3eed66[_0xd64d('0x3b')][_0xd64d('0x2f')]);_0x463034[_0xd64d('0x2e')]=qs[_0xd64d('0x2e')](_0x3eed66['query'][_0xd64d('0x2e')]);}return _0x1a3bb9['getFields'](_0x463034);}})['then'](function(_0x448768){if(_0x448768){return _0x448768?{'count':_0x4fa8d8,'rows':_0x448768}:null;}})['then'](respondWithResult(_0x3a2dd4,null))[_0xd64d('0x29')](handleError(_0x3a2dd4,null));};exports[_0xd64d('0x58')]=function(_0x480b4d,_0x4539a4,_0x44d7fa){var _0x2731d3={};var _0x3549bf={};var _0xbf84dd;var _0x14afb5;return db[_0xd64d('0x37')][_0xd64d('0x59')]({'where':{'id':_0x480b4d[_0xd64d('0x50')]['id']}})['then'](handleEntityNotFound(_0x4539a4,null))['then'](function(_0x2676e6){if(_0x2676e6){_0xbf84dd=_0x2676e6;_0x3549bf[_0xd64d('0x3a')]=_[_0xd64d('0x3c')](db['VtigerField'][_0xd64d('0x56')]);_0x3549bf[_0xd64d('0x3b')]=_[_0xd64d('0x3c')](_0x480b4d[_0xd64d('0x3b')]);_0x3549bf[_0xd64d('0x3d')]=_[_0xd64d('0x3e')](_0x3549bf['model'],_0x3549bf[_0xd64d('0x3b')]);_0x2731d3[_0xd64d('0x3f')]=_['intersection'](_0x3549bf[_0xd64d('0x3a')],qs['fields'](_0x480b4d['query'][_0xd64d('0x40')]));_0x2731d3['attributes']=_0x2731d3[_0xd64d('0x3f')][_0xd64d('0x41')]?_0x2731d3[_0xd64d('0x3f')]:_0x3549bf[_0xd64d('0x3a')];_0x2731d3[_0xd64d('0x5a')]=qs[_0xd64d('0x44')](_0x480b4d[_0xd64d('0x3b')][_0xd64d('0x44')]);_0x2731d3[_0xd64d('0x45')]=qs[_0xd64d('0x3d')](_[_0xd64d('0x46')](_0x480b4d['query'],_0x3549bf[_0xd64d('0x3d')]));if(_0x480b4d['query'][_0xd64d('0x47')]){_0x2731d3[_0xd64d('0x45')]=_[_0xd64d('0x4a')](_0x2731d3[_0xd64d('0x45')],{'$or':_[_0xd64d('0x48')](_0x2731d3[_0xd64d('0x3f')],function(_0x3fddca){var _0x303c4c={};_0x303c4c[_0x3fddca]={'$like':'%'+_0x480b4d[_0xd64d('0x3b')][_0xd64d('0x47')]+'%'};return _0x303c4c;})});}_0x2731d3=_['merge']({},_0x2731d3,_0x480b4d[_0xd64d('0x57')]);return _0xbf84dd['getSubjects'](_0x2731d3);}})[_0xd64d('0x1e')](function(_0x2c8889){if(_0x2c8889){_0x14afb5=_0x2c8889[_0xd64d('0x41')];if(!_0x480b4d['query']['hasOwnProperty'](_0xd64d('0x43'))){_0x2731d3['limit']=qs[_0xd64d('0x2f')](_0x480b4d[_0xd64d('0x3b')][_0xd64d('0x2f')]);_0x2731d3[_0xd64d('0x2e')]=qs[_0xd64d('0x2e')](_0x480b4d['query']['offset']);}return _0xbf84dd['getSubjects'](_0x2731d3);}})[_0xd64d('0x1e')](function(_0x2f652b){if(_0x2f652b){return _0x2f652b?{'count':_0x14afb5,'rows':_0x2f652b}:null;}})[_0xd64d('0x1e')](respondWithResult(_0x4539a4,null))[_0xd64d('0x29')](handleError(_0x4539a4,null));};exports[_0xd64d('0x5b')]=function(_0x5062d6,_0x1c3ee5,_0x304370){var _0x1fdab3={};var _0xd2b536={};var _0x1b09ec;var _0x4864a7;return db[_0xd64d('0x37')][_0xd64d('0x59')]({'where':{'id':_0x5062d6[_0xd64d('0x50')]['id']}})[_0xd64d('0x1e')](handleEntityNotFound(_0x1c3ee5,null))[_0xd64d('0x1e')](function(_0x3613de){if(_0x3613de){_0x1b09ec=_0x3613de;_0xd2b536[_0xd64d('0x3a')]=_[_0xd64d('0x3c')](db[_0xd64d('0x55')][_0xd64d('0x56')]);_0xd2b536[_0xd64d('0x3b')]=_['keys'](_0x5062d6[_0xd64d('0x3b')]);_0xd2b536['filters']=_[_0xd64d('0x3e')](_0xd2b536[_0xd64d('0x3a')],_0xd2b536[_0xd64d('0x3b')]);_0x1fdab3[_0xd64d('0x3f')]=_['intersection'](_0xd2b536[_0xd64d('0x3a')],qs[_0xd64d('0x40')](_0x5062d6[_0xd64d('0x3b')][_0xd64d('0x40')]));_0x1fdab3[_0xd64d('0x3f')]=_0x1fdab3[_0xd64d('0x3f')]['length']?_0x1fdab3[_0xd64d('0x3f')]:_0xd2b536['model'];_0x1fdab3['order']=qs['sort'](_0x5062d6[_0xd64d('0x3b')][_0xd64d('0x44')]);_0x1fdab3[_0xd64d('0x45')]=qs['filters'](_[_0xd64d('0x46')](_0x5062d6['query'],_0xd2b536[_0xd64d('0x3d')]));if(_0x5062d6[_0xd64d('0x3b')][_0xd64d('0x47')]){_0x1fdab3[_0xd64d('0x45')]=_[_0xd64d('0x4a')](_0x1fdab3[_0xd64d('0x45')],{'$or':_[_0xd64d('0x48')](_0x1fdab3['attributes'],function(_0x21c53d){var _0x351a6f={};_0x351a6f[_0x21c53d]={'$like':'%'+_0x5062d6[_0xd64d('0x3b')][_0xd64d('0x47')]+'%'};return _0x351a6f;})});}_0x1fdab3=_[_0xd64d('0x4a')]({},_0x1fdab3,_0x5062d6['options']);return _0x1b09ec[_0xd64d('0x5b')](_0x1fdab3);}})[_0xd64d('0x1e')](function(_0x2d6081){if(_0x2d6081){_0x4864a7=_0x2d6081[_0xd64d('0x41')];if(!_0x5062d6[_0xd64d('0x3b')][_0xd64d('0x42')](_0xd64d('0x43'))){_0x1fdab3[_0xd64d('0x2f')]=qs[_0xd64d('0x2f')](_0x5062d6[_0xd64d('0x3b')]['limit']);_0x1fdab3[_0xd64d('0x2e')]=qs['offset'](_0x5062d6['query'][_0xd64d('0x2e')]);}return _0x1b09ec['getDescriptions'](_0x1fdab3);}})[_0xd64d('0x1e')](function(_0x37a232){if(_0x37a232){return _0x37a232?{'count':_0x4864a7,'rows':_0x37a232}:null;}})[_0xd64d('0x1e')](respondWithResult(_0x1c3ee5,null))[_0xd64d('0x29')](handleError(_0x1c3ee5,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 3e80b39..add8bd8 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 _0x0bb1=['rimraf','./intVtigerConfiguration.attributes','define','VtigerConfiguration','int_vtiger_configurations','util','../../config/logger','moment','request-promise','path'];(function(_0x47dd05,_0x4aa69a){var _0x1ac7c7=function(_0x5dbca1){while(--_0x5dbca1){_0x47dd05['push'](_0x47dd05['shift']());}};_0x1ac7c7(++_0x4aa69a);}(_0x0bb1,0x1db));var _0x10bb=function(_0x490be3,_0xf0fca3){_0x490be3=_0x490be3-0x0;var _0x3f5140=_0x0bb1[_0x490be3];return _0x3f5140;};'use strict';var _=require('lodash');var util=require(_0x10bb('0x0'));var logger=require(_0x10bb('0x1'))('api');var moment=require(_0x10bb('0x2'));var BPromise=require('bluebird');var rp=require(_0x10bb('0x3'));var fs=require('fs');var path=require(_0x10bb('0x4'));var rimraf=require(_0x10bb('0x5'));var config=require('../../config/environment');var attributes=require(_0x10bb('0x6'));module['exports']=function(_0x22af16,_0x7c70ff){return _0x22af16[_0x10bb('0x7')](_0x10bb('0x8'),attributes,{'tableName':_0x10bb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0956=['util','../../config/logger','bluebird','request-promise','path','./intVtigerConfiguration.attributes','define','int_vtiger_configurations','lodash'];(function(_0xf31767,_0x381746){var _0x24bd0c=function(_0x3b3472){while(--_0x3b3472){_0xf31767['push'](_0xf31767['shift']());}};_0x24bd0c(++_0x381746);}(_0x0956,0xce));var _0x6095=function(_0x24bdbd,_0x24d593){_0x24bdbd=_0x24bdbd-0x0;var _0x512f19=_0x0956[_0x24bdbd];return _0x512f19;};'use strict';var _=require(_0x6095('0x0'));var util=require(_0x6095('0x1'));var logger=require(_0x6095('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6095('0x3'));var rp=require(_0x6095('0x4'));var fs=require('fs');var path=require(_0x6095('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6095('0x6'));module['exports']=function(_0x34f1c5,_0xe3e983){return _0x34f1c5[_0x6095('0x7')]('VtigerConfiguration',attributes,{'tableName':_0x6095('0x8'),'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 1077d47..f901dd0 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 _0x940f=['../../config/environment','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash','util','bluebird','../../config/utils','../../config/logger','rpc'];(function(_0x48f969,_0x72e01d){var _0x470dfc=function(_0x5ea75b){while(--_0x5ea75b){_0x48f969['push'](_0x48f969['shift']());}};_0x470dfc(++_0x72e01d);}(_0x940f,0xd6));var _0xf940=function(_0x27934a,_0x198480){_0x27934a=_0x27934a-0x0;var _0x80e180=_0x940f[_0x27934a];return _0x80e180;};'use strict';var _=require(_0xf940('0x0'));var util=require(_0xf940('0x1'));var moment=require('moment');var BPromise=require(_0xf940('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf940('0x3'));var logger=require(_0xf940('0x4'))(_0xf940('0x5'));var config=require(_0xf940('0x6'));var jayson=require(_0xf940('0x7'));var client=jayson[_0xf940('0x8')][_0xf940('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x193ddc,_0x1b20ff,_0x3875ab){return new BPromise(function(_0x48910c,_0xb6fb29){return client[_0xf940('0xa')](_0x193ddc,_0x3875ab)[_0xf940('0xb')](function(_0x11b11e){logger[_0xf940('0xc')](_0xf940('0xd'),_0x1b20ff,_0xf940('0xe'));logger[_0xf940('0xf')](_0xf940('0x10'),_0x1b20ff,_0xf940('0xe'),JSON[_0xf940('0x11')](_0x11b11e));if(_0x11b11e['error']){if(_0x11b11e['error'][_0xf940('0x12')]===0x1f4){logger[_0xf940('0x13')]('VtigerConfiguration,\x20%s,\x20%s',_0x1b20ff,_0x11b11e[_0xf940('0x13')][_0xf940('0x14')]);return _0xb6fb29(_0x11b11e[_0xf940('0x13')][_0xf940('0x14')]);}logger[_0xf940('0x13')](_0xf940('0xd'),_0x1b20ff,_0x11b11e[_0xf940('0x13')][_0xf940('0x14')]);return _0x48910c(_0x11b11e['error'][_0xf940('0x14')]);}else{logger['info'](_0xf940('0xd'),_0x1b20ff,_0xf940('0xe'));_0x48910c(_0x11b11e['result'][_0xf940('0x14')]);}})[_0xf940('0x15')](function(_0x488c2c){logger[_0xf940('0x13')](_0xf940('0xd'),_0x1b20ff,_0x488c2c);_0xb6fb29(_0x488c2c);});});} \ No newline at end of file +var _0x74de=['info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x274638,_0x578968){var _0x5755df=function(_0x3227d5){while(--_0x3227d5){_0x274638['push'](_0x274638['shift']());}};_0x5755df(++_0x578968);}(_0x74de,0x193));var _0xe74d=function(_0x4d3f07,_0x4da22a){_0x4d3f07=_0x4d3f07-0x0;var _0x31e128=_0x74de[_0x4d3f07];return _0x31e128;};'use strict';var _=require(_0xe74d('0x0'));var util=require(_0xe74d('0x1'));var moment=require(_0xe74d('0x2'));var BPromise=require(_0xe74d('0x3'));var rs=require(_0xe74d('0x4'));var fs=require('fs');var Redis=require(_0xe74d('0x5'));var db=require(_0xe74d('0x6'))['db'];var utils=require(_0xe74d('0x7'));var logger=require(_0xe74d('0x8'))(_0xe74d('0x9'));var config=require(_0xe74d('0xa'));var jayson=require(_0xe74d('0xb'));var client=jayson[_0xe74d('0xc')][_0xe74d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x44cc3f,_0x21acba,_0x384673){return new BPromise(function(_0x4edfc1,_0x533fb5){return client['request'](_0x44cc3f,_0x384673)[_0xe74d('0xe')](function(_0x7e1033){logger['info'](_0xe74d('0xf'),_0x21acba,_0xe74d('0x10'));logger[_0xe74d('0x11')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x21acba,_0xe74d('0x10'),JSON[_0xe74d('0x12')](_0x7e1033));if(_0x7e1033[_0xe74d('0x13')]){if(_0x7e1033[_0xe74d('0x13')][_0xe74d('0x14')]===0x1f4){logger[_0xe74d('0x13')]('VtigerConfiguration,\x20%s,\x20%s',_0x21acba,_0x7e1033[_0xe74d('0x13')][_0xe74d('0x15')]);return _0x533fb5(_0x7e1033[_0xe74d('0x13')][_0xe74d('0x15')]);}logger[_0xe74d('0x13')](_0xe74d('0xf'),_0x21acba,_0x7e1033[_0xe74d('0x13')]['message']);return _0x4edfc1(_0x7e1033[_0xe74d('0x13')][_0xe74d('0x15')]);}else{logger[_0xe74d('0x16')]('VtigerConfiguration,\x20%s,\x20%s',_0x21acba,'request\x20sent');_0x4edfc1(_0x7e1033[_0xe74d('0x17')][_0xe74d('0x15')]);}})[_0xe74d('0x18')](function(_0xb79fc){logger[_0xe74d('0x13')]('VtigerConfiguration,\x20%s,\x20%s',_0x21acba,_0xb79fc);_0x533fb5(_0xb79fc);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 341e7bf..8a93d04 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 _0x5b06=['create','put','update','delete','exports','multer','util','connect-timeout','express','../../components/auth/service','get','/:id','isAuthenticated','post'];(function(_0x5b3725,_0x3803ad){var _0x3f5531=function(_0x6d2e4f){while(--_0x6d2e4f){_0x5b3725['push'](_0x5b3725['shift']());}};_0x3f5531(++_0x3803ad);}(_0x5b06,0xf3));var _0x65b0=function(_0x5b8a9e,_0x5f3281){_0x5b8a9e=_0x5b8a9e-0x0;var _0x319514=_0x5b06[_0x5b8a9e];return _0x319514;};'use strict';var multer=require(_0x65b0('0x0'));var util=require(_0x65b0('0x1'));var path=require('path');var timeout=require(_0x65b0('0x2'));var express=require(_0x65b0('0x3'));var router=express['Router']();var auth=require(_0x65b0('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intVtigerField.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x65b0('0x5')](_0x65b0('0x6'),auth[_0x65b0('0x7')](),controller['show']);router[_0x65b0('0x8')]('/',auth[_0x65b0('0x7')](),controller[_0x65b0('0x9')]);router[_0x65b0('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x65b0('0xb')]);router[_0x65b0('0xc')]('/:id',auth[_0x65b0('0x7')](),controller['destroy']);module[_0x65b0('0xd')]=router; \ No newline at end of file +var _0xa3f7=['../../components/interaction/service','get','index','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x451d67,_0x2a04a5){var _0x346d4b=function(_0x1cecf8){while(--_0x1cecf8){_0x451d67['push'](_0x451d67['shift']());}};_0x346d4b(++_0x2a04a5);}(_0xa3f7,0x13e));var _0x7a3f=function(_0x27eb71,_0x26d4b1){_0x27eb71=_0x27eb71-0x0;var _0x2a3d12=_0xa3f7[_0x27eb71];return _0x2a3d12;};'use strict';var multer=require(_0x7a3f('0x0'));var util=require(_0x7a3f('0x1'));var path=require(_0x7a3f('0x2'));var timeout=require(_0x7a3f('0x3'));var express=require(_0x7a3f('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x7a3f('0x5'));var config=require('../../config/environment');var controller=require('./intVtigerField.controller');router[_0x7a3f('0x6')]('/',auth['isAuthenticated'](),controller[_0x7a3f('0x7')]);router[_0x7a3f('0x6')](_0x7a3f('0x8'),auth[_0x7a3f('0x9')](),controller[_0x7a3f('0xa')]);router[_0x7a3f('0xb')]('/',auth[_0x7a3f('0x9')](),controller[_0x7a3f('0xc')]);router[_0x7a3f('0xd')](_0x7a3f('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x7a3f('0xe')](_0x7a3f('0x8'),auth[_0x7a3f('0x9')](),controller[_0x7a3f('0xf')]);module[_0x7a3f('0x10')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 91e337d..ce7cc4f 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 _0x8456=['BOOLEAN','sequelize','exports','ENUM','variable','keyValue','string','STRING','customVariable'];(function(_0x5eb22e,_0x27cbac){var _0x27fed5=function(_0x565467){while(--_0x565467){_0x5eb22e['push'](_0x5eb22e['shift']());}};_0x27fed5(++_0x27cbac);}(_0x8456,0xfd));var _0x6845=function(_0x296e39,_0x16cf58){_0x296e39=_0x296e39-0x0;var _0x423f73=_0x8456[_0x296e39];return _0x423f73;};'use strict';var Sequelize=require(_0x6845('0x0'));module[_0x6845('0x1')]={'type':{'type':Sequelize[_0x6845('0x2')]('string',_0x6845('0x3'),'customVariable',_0x6845('0x4')),'defaultValue':_0x6845('0x5')},'content':{'type':Sequelize[_0x6845('0x6')]},'key':{'type':Sequelize[_0x6845('0x6')]},'keyType':{'type':Sequelize[_0x6845('0x2')](_0x6845('0x5'),_0x6845('0x3'),_0x6845('0x7'))},'keyContent':{'type':Sequelize[_0x6845('0x6')]},'idField':{'type':Sequelize[_0x6845('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x6845('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1159=['STRING','ENUM','BOOLEAN','sequelize','string','variable','customVariable','keyValue'];(function(_0x3feefa,_0x15293a){var _0x51fb21=function(_0x71bff6){while(--_0x71bff6){_0x3feefa['push'](_0x3feefa['shift']());}};_0x51fb21(++_0x15293a);}(_0x1159,0xf3));var _0x9115=function(_0x42fc8e,_0x2f9131){_0x42fc8e=_0x42fc8e-0x0;var _0x3b78db=_0x1159[_0x42fc8e];return _0x3b78db;};'use strict';var Sequelize=require(_0x9115('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x9115('0x1'),_0x9115('0x2'),_0x9115('0x3'),_0x9115('0x4')),'defaultValue':_0x9115('0x1')},'content':{'type':Sequelize[_0x9115('0x5')]},'key':{'type':Sequelize[_0x9115('0x5')]},'keyType':{'type':Sequelize[_0x9115('0x6')]('string',_0x9115('0x2'),_0x9115('0x3'))},'keyContent':{'type':Sequelize[_0x9115('0x5')]},'idField':{'type':Sequelize[_0x9115('0x5')]},'nameField':{'type':Sequelize[_0x9115('0x5')]},'customField':{'type':Sequelize[_0x9115('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9115('0x5')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 1793223..38f8e2c 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 _0x195e=['pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','keys','length','options','find','create','body','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','update','then','destroy','error','stack','name','map','VtigerField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where'];(function(_0x4910b1,_0x11b0a3){var _0x2b8d1d=function(_0x4a0891){while(--_0x4a0891){_0x4910b1['push'](_0x4910b1['shift']());}};_0x2b8d1d(++_0x11b0a3);}(_0x195e,0xa1));var _0xe195=function(_0x437c49,_0x3bb4ac){_0x437c49=_0x437c49-0x0;var _0x12cc63=_0x195e[_0x437c49];return _0x12cc63;};'use strict';var pdf=require(_0xe195('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe195('0x1'));var jsonpatch=require(_0xe195('0x2'));var rp=require(_0xe195('0x3'));var moment=require(_0xe195('0x4'));var BPromise=require(_0xe195('0x5'));var Mustache=require('mustache');var util=require(_0xe195('0x6'));var path=require(_0xe195('0x7'));var sox=require(_0xe195('0x8'));var csv=require(_0xe195('0x9'));var ejs=require(_0xe195('0xa'));var fs=require('fs');var _=require(_0xe195('0xb'));var squel=require(_0xe195('0xc'));var crypto=require(_0xe195('0xd'));var jsforce=require(_0xe195('0xe'));var deskjs=require(_0xe195('0xf'));var toCsv=require(_0xe195('0x9'));var querystring=require(_0xe195('0x10'));var Papa=require(_0xe195('0x11'));var Redis=require(_0xe195('0x12'));var authService=require(_0xe195('0x13'));var qs=require(_0xe195('0x14'));var as=require(_0xe195('0x15'));var hardwareService=require(_0xe195('0x16'));var logger=require(_0xe195('0x17'))(_0xe195('0x18'));var utils=require(_0xe195('0x19'));var config=require('../../config/environment');var db=require(_0xe195('0x1a'))['db'];function respondWithStatusCode(_0xc83ffe,_0x6e7a23){_0x6e7a23=_0x6e7a23||0xcc;return function(_0x14afac){if(_0x14afac){return _0xc83ffe[_0xe195('0x1b')](_0x6e7a23);}return _0xc83ffe[_0xe195('0x1c')](_0x6e7a23)[_0xe195('0x1d')]();};}function respondWithResult(_0x53c31e,_0x3ee6ab){_0x3ee6ab=_0x3ee6ab||0xc8;return function(_0x3ecd51){if(_0x3ecd51){return _0x53c31e[_0xe195('0x1c')](_0x3ee6ab)[_0xe195('0x1e')](_0x3ecd51);}};}function respondWithFilteredResult(_0x3d6c0a,_0x4c129d){return function(_0x45c293){if(_0x45c293){var _0xf92100=_0x45c293[_0xe195('0x1f')],_0x35176e=_0x4c129d['offset'],_0x10d228=_0x4c129d[_0xe195('0x20')]+_0x4c129d[_0xe195('0x21')],_0x1e8b85;if(_0x10d228>=_0xf92100){_0x10d228=_0xf92100;_0x1e8b85=0xc8;}else{_0x1e8b85=0xce;}_0x3d6c0a[_0xe195('0x1c')](_0x1e8b85);return _0x3d6c0a[_0xe195('0x22')]('Content-Range',_0x35176e+'-'+_0x10d228+'/'+_0xf92100)['json'](_0x45c293);}return null;};}function patchUpdates(_0x3d4074){return function(_0x4768f3){try{jsonpatch['apply'](_0x4768f3,_0x3d4074,!![]);}catch(_0x5a9c52){return BPromise[_0xe195('0x23')](_0x5a9c52);}return _0x4768f3['save']();};}function saveUpdates(_0x1249f8,_0x1774aa){return function(_0x11a403){if(_0x11a403){return _0x11a403[_0xe195('0x24')](_0x1249f8)[_0xe195('0x25')](function(_0x9c6bac){return _0x9c6bac;});}return null;};}function removeEntity(_0x2ff544,_0x2a5181){return function(_0x4b91ee){if(_0x4b91ee){return _0x4b91ee[_0xe195('0x26')]()['then'](function(){_0x2ff544[_0xe195('0x1c')](0xcc)[_0xe195('0x1d')]();});}};}function handleEntityNotFound(_0x45f56f,_0x5ba444){return function(_0x44fec6){if(!_0x44fec6){_0x45f56f[_0xe195('0x1b')](0x194);}return _0x44fec6;};}function handleError(_0x306069,_0x2cf211){_0x2cf211=_0x2cf211||0x1f4;return function(_0x5e0419){logger[_0xe195('0x27')](_0x5e0419[_0xe195('0x28')]);if(_0x5e0419[_0xe195('0x29')]){delete _0x5e0419['name'];}_0x306069[_0xe195('0x1c')](_0x2cf211)['send'](_0x5e0419);};}exports['index']=function(_0x415484,_0x422e35){var _0x1f6144={},_0x41981c={},_0x338713={'count':0x0,'rows':[]};var _0x56016b=_[_0xe195('0x2a')](db[_0xe195('0x2b')][_0xe195('0x2c')],function(_0x4a105f){return{'name':_0x4a105f[_0xe195('0x2d')],'type':_0x4a105f[_0xe195('0x2e')][_0xe195('0x2f')]};});_0x41981c[_0xe195('0x30')]=_['map'](_0x56016b,_0xe195('0x29'));_0x41981c[_0xe195('0x31')]=_['keys'](_0x415484['query']);_0x41981c[_0xe195('0x32')]=_[_0xe195('0x33')](_0x41981c[_0xe195('0x30')],_0x41981c[_0xe195('0x31')]);_0x1f6144[_0xe195('0x34')]=_[_0xe195('0x33')](_0x41981c[_0xe195('0x30')],qs['fields'](_0x415484[_0xe195('0x31')]['fields']));_0x1f6144[_0xe195('0x34')]=_0x1f6144[_0xe195('0x34')]['length']?_0x1f6144[_0xe195('0x34')]:_0x41981c[_0xe195('0x30')];if(!_0x415484[_0xe195('0x31')][_0xe195('0x35')](_0xe195('0x36'))){_0x1f6144[_0xe195('0x21')]=qs[_0xe195('0x21')](_0x415484[_0xe195('0x31')][_0xe195('0x21')]);_0x1f6144[_0xe195('0x20')]=qs[_0xe195('0x20')](_0x415484[_0xe195('0x31')][_0xe195('0x20')]);}_0x1f6144[_0xe195('0x37')]=qs[_0xe195('0x38')](_0x415484[_0xe195('0x31')][_0xe195('0x38')]);_0x1f6144[_0xe195('0x39')]=qs[_0xe195('0x32')](_[_0xe195('0x3a')](_0x415484[_0xe195('0x31')],_0x41981c[_0xe195('0x32')]),_0x56016b);if(_0x415484[_0xe195('0x31')][_0xe195('0x3b')]){_0x1f6144['where']=_[_0xe195('0x3c')](_0x1f6144[_0xe195('0x39')],{'$or':_['map'](_0x56016b,function(_0x430f6e){if(_0x430f6e['type']!==_0xe195('0x3d')){var _0xeef9ce={};_0xeef9ce[_0x430f6e['name']]={'$like':'%'+_0x415484[_0xe195('0x31')][_0xe195('0x3b')]+'%'};return _0xeef9ce;}})});}_0x1f6144=_[_0xe195('0x3c')]({},_0x1f6144,_0x415484['options']);var _0x4ff07d={'where':_0x1f6144[_0xe195('0x39')]};return db['VtigerField'][_0xe195('0x1f')](_0x4ff07d)[_0xe195('0x25')](function(_0x175d88){_0x338713[_0xe195('0x1f')]=_0x175d88;if(_0x415484[_0xe195('0x31')][_0xe195('0x3e')]){_0x1f6144[_0xe195('0x3f')]=[{'all':!![]}];}return db[_0xe195('0x2b')][_0xe195('0x40')](_0x1f6144);})[_0xe195('0x25')](function(_0x1d3281){_0x338713['rows']=_0x1d3281;return _0x338713;})[_0xe195('0x25')](respondWithFilteredResult(_0x422e35,_0x1f6144))[_0xe195('0x41')](handleError(_0x422e35,null));};exports[_0xe195('0x42')]=function(_0x4b0f11,_0x3ad19c){var _0xe315d={'raw':!![],'where':{'id':_0x4b0f11['params']['id']}},_0x1e37e1={};_0x1e37e1[_0xe195('0x30')]=_['keys'](db[_0xe195('0x2b')][_0xe195('0x2c')]);_0x1e37e1[_0xe195('0x31')]=_[_0xe195('0x43')](_0x4b0f11[_0xe195('0x31')]);_0x1e37e1['filters']=_[_0xe195('0x33')](_0x1e37e1['model'],_0x1e37e1[_0xe195('0x31')]);_0xe315d[_0xe195('0x34')]=_['intersection'](_0x1e37e1[_0xe195('0x30')],qs['fields'](_0x4b0f11['query']['fields']));_0xe315d[_0xe195('0x34')]=_0xe315d['attributes'][_0xe195('0x44')]?_0xe315d[_0xe195('0x34')]:_0x1e37e1[_0xe195('0x30')];if(_0x4b0f11[_0xe195('0x31')]['includeAll']){_0xe315d[_0xe195('0x3f')]=[{'all':!![]}];}_0xe315d=_[_0xe195('0x3c')]({},_0xe315d,_0x4b0f11[_0xe195('0x45')]);return db[_0xe195('0x2b')][_0xe195('0x46')](_0xe315d)[_0xe195('0x25')](handleEntityNotFound(_0x3ad19c,null))['then'](respondWithResult(_0x3ad19c,null))[_0xe195('0x41')](handleError(_0x3ad19c,null));};exports[_0xe195('0x47')]=function(_0x3e390d,_0x156185){return db[_0xe195('0x2b')][_0xe195('0x47')](_0x3e390d[_0xe195('0x48')],{})['then'](respondWithResult(_0x156185,0xc9))[_0xe195('0x41')](handleError(_0x156185,null));};exports[_0xe195('0x24')]=function(_0x33d53c,_0x5caea3){if(_0x33d53c[_0xe195('0x48')]['id']){delete _0x33d53c[_0xe195('0x48')]['id'];}return db['VtigerField'][_0xe195('0x46')]({'where':{'id':_0x33d53c['params']['id']}})[_0xe195('0x25')](handleEntityNotFound(_0x5caea3,null))[_0xe195('0x25')](saveUpdates(_0x33d53c[_0xe195('0x48')],null))['then'](respondWithResult(_0x5caea3,null))['catch'](handleError(_0x5caea3,null));};exports[_0xe195('0x26')]=function(_0x24786e,_0x599ac5){return db['VtigerField']['find']({'where':{'id':_0x24786e['params']['id']}})[_0xe195('0x25')](handleEntityNotFound(_0x599ac5,null))[_0xe195('0x25')](removeEntity(_0x599ac5,null))[_0xe195('0x41')](handleError(_0x599ac5,null));}; \ No newline at end of file +var _0xf79b=['findAll','rows','catch','show','params','keys','includeAll','include','options','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../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','error','stack','name','index','map','VtigerField','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','type','VIRTUAL','filter'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0xf79b,0xa0));var _0xbf79=function(_0x24be86,_0x33d6ff){_0x24be86=_0x24be86-0x0;var _0x2c7d38=_0xf79b[_0x24be86];return _0x2c7d38;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbf79('0x0'));var rimraf=require(_0xbf79('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbf79('0x2'));var rp=require(_0xbf79('0x3'));var moment=require(_0xbf79('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbf79('0x5'));var util=require(_0xbf79('0x6'));var path=require(_0xbf79('0x7'));var sox=require(_0xbf79('0x8'));var csv=require(_0xbf79('0x9'));var ejs=require(_0xbf79('0xa'));var fs=require('fs');var _=require(_0xbf79('0xb'));var squel=require(_0xbf79('0xc'));var crypto=require('crypto');var jsforce=require(_0xbf79('0xd'));var deskjs=require(_0xbf79('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbf79('0xf'));var Papa=require('papaparse');var Redis=require(_0xbf79('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbf79('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbf79('0x12'))(_0xbf79('0x13'));var utils=require(_0xbf79('0x14'));var config=require(_0xbf79('0x15'));var db=require(_0xbf79('0x16'))['db'];function respondWithStatusCode(_0x343ddc,_0x27ac2e){_0x27ac2e=_0x27ac2e||0xcc;return function(_0x1d2bd3){if(_0x1d2bd3){return _0x343ddc[_0xbf79('0x17')](_0x27ac2e);}return _0x343ddc[_0xbf79('0x18')](_0x27ac2e)[_0xbf79('0x19')]();};}function respondWithResult(_0x97f300,_0x23fe13){_0x23fe13=_0x23fe13||0xc8;return function(_0x26ea5f){if(_0x26ea5f){return _0x97f300['status'](_0x23fe13)[_0xbf79('0x1a')](_0x26ea5f);}};}function respondWithFilteredResult(_0x3171b8,_0x2f4e55){return function(_0x3b88dc){if(_0x3b88dc){var _0x5f4b96=_0x3b88dc[_0xbf79('0x1b')],_0x5474f1=_0x2f4e55[_0xbf79('0x1c')],_0x27c409=_0x2f4e55[_0xbf79('0x1c')]+_0x2f4e55['limit'],_0x4b0c1a;if(_0x27c409>=_0x5f4b96){_0x27c409=_0x5f4b96;_0x4b0c1a=0xc8;}else{_0x4b0c1a=0xce;}_0x3171b8[_0xbf79('0x18')](_0x4b0c1a);return _0x3171b8[_0xbf79('0x1d')](_0xbf79('0x1e'),_0x5474f1+'-'+_0x27c409+'/'+_0x5f4b96)['json'](_0x3b88dc);}return null;};}function patchUpdates(_0x26cb87){return function(_0x235bbe){try{jsonpatch[_0xbf79('0x1f')](_0x235bbe,_0x26cb87,!![]);}catch(_0x38b78d){return BPromise[_0xbf79('0x20')](_0x38b78d);}return _0x235bbe[_0xbf79('0x21')]();};}function saveUpdates(_0x353f12,_0xf36665){return function(_0x19a504){if(_0x19a504){return _0x19a504[_0xbf79('0x22')](_0x353f12)[_0xbf79('0x23')](function(_0x5a122a){return _0x5a122a;});}return null;};}function removeEntity(_0x2c3017,_0x379aed){return function(_0x10e8e9){if(_0x10e8e9){return _0x10e8e9['destroy']()['then'](function(){_0x2c3017[_0xbf79('0x18')](0xcc)[_0xbf79('0x19')]();});}};}function handleEntityNotFound(_0x5badd1,_0x4ed375){return function(_0x187a86){if(!_0x187a86){_0x5badd1['sendStatus'](0x194);}return _0x187a86;};}function handleError(_0x437499,_0x1c6d07){_0x1c6d07=_0x1c6d07||0x1f4;return function(_0x1fb682){logger[_0xbf79('0x24')](_0x1fb682[_0xbf79('0x25')]);if(_0x1fb682['name']){delete _0x1fb682[_0xbf79('0x26')];}_0x437499['status'](_0x1c6d07)['send'](_0x1fb682);};}exports[_0xbf79('0x27')]=function(_0x4db121,_0x1317c0){var _0x1c03b7={},_0x50bc5f={},_0x2f40ba={'count':0x0,'rows':[]};var _0x5aa22d=_[_0xbf79('0x28')](db[_0xbf79('0x29')][_0xbf79('0x2a')],function(_0x35e80e){return{'name':_0x35e80e[_0xbf79('0x2b')],'type':_0x35e80e['type']['key']};});_0x50bc5f[_0xbf79('0x2c')]=_[_0xbf79('0x28')](_0x5aa22d,_0xbf79('0x26'));_0x50bc5f['query']=_['keys'](_0x4db121[_0xbf79('0x2d')]);_0x50bc5f[_0xbf79('0x2e')]=_[_0xbf79('0x2f')](_0x50bc5f[_0xbf79('0x2c')],_0x50bc5f[_0xbf79('0x2d')]);_0x1c03b7[_0xbf79('0x30')]=_[_0xbf79('0x2f')](_0x50bc5f[_0xbf79('0x2c')],qs[_0xbf79('0x31')](_0x4db121[_0xbf79('0x2d')][_0xbf79('0x31')]));_0x1c03b7[_0xbf79('0x30')]=_0x1c03b7[_0xbf79('0x30')][_0xbf79('0x32')]?_0x1c03b7[_0xbf79('0x30')]:_0x50bc5f[_0xbf79('0x2c')];if(!_0x4db121[_0xbf79('0x2d')][_0xbf79('0x33')](_0xbf79('0x34'))){_0x1c03b7[_0xbf79('0x35')]=qs[_0xbf79('0x35')](_0x4db121[_0xbf79('0x2d')][_0xbf79('0x35')]);_0x1c03b7['offset']=qs[_0xbf79('0x1c')](_0x4db121[_0xbf79('0x2d')][_0xbf79('0x1c')]);}_0x1c03b7[_0xbf79('0x36')]=qs[_0xbf79('0x37')](_0x4db121[_0xbf79('0x2d')][_0xbf79('0x37')]);_0x1c03b7[_0xbf79('0x38')]=qs['filters'](_[_0xbf79('0x39')](_0x4db121[_0xbf79('0x2d')],_0x50bc5f['filters']),_0x5aa22d);if(_0x4db121['query']['filter']){_0x1c03b7[_0xbf79('0x38')]=_[_0xbf79('0x3a')](_0x1c03b7['where'],{'$or':_['map'](_0x5aa22d,function(_0x284800){if(_0x284800[_0xbf79('0x3b')]!==_0xbf79('0x3c')){var _0x2de776={};_0x2de776[_0x284800[_0xbf79('0x26')]]={'$like':'%'+_0x4db121['query'][_0xbf79('0x3d')]+'%'};return _0x2de776;}})});}_0x1c03b7=_[_0xbf79('0x3a')]({},_0x1c03b7,_0x4db121['options']);var _0x192b49={'where':_0x1c03b7[_0xbf79('0x38')]};return db['VtigerField'][_0xbf79('0x1b')](_0x192b49)[_0xbf79('0x23')](function(_0x55db17){_0x2f40ba['count']=_0x55db17;if(_0x4db121[_0xbf79('0x2d')]['includeAll']){_0x1c03b7['include']=[{'all':!![]}];}return db[_0xbf79('0x29')][_0xbf79('0x3e')](_0x1c03b7);})['then'](function(_0x38ec8b){_0x2f40ba[_0xbf79('0x3f')]=_0x38ec8b;return _0x2f40ba;})[_0xbf79('0x23')](respondWithFilteredResult(_0x1317c0,_0x1c03b7))[_0xbf79('0x40')](handleError(_0x1317c0,null));};exports[_0xbf79('0x41')]=function(_0x3e6eff,_0x114cef){var _0x390de0={'raw':!![],'where':{'id':_0x3e6eff[_0xbf79('0x42')]['id']}},_0x1568af={};_0x1568af[_0xbf79('0x2c')]=_[_0xbf79('0x43')](db[_0xbf79('0x29')][_0xbf79('0x2a')]);_0x1568af[_0xbf79('0x2d')]=_[_0xbf79('0x43')](_0x3e6eff['query']);_0x1568af[_0xbf79('0x2e')]=_[_0xbf79('0x2f')](_0x1568af[_0xbf79('0x2c')],_0x1568af[_0xbf79('0x2d')]);_0x390de0[_0xbf79('0x30')]=_[_0xbf79('0x2f')](_0x1568af[_0xbf79('0x2c')],qs['fields'](_0x3e6eff[_0xbf79('0x2d')]['fields']));_0x390de0['attributes']=_0x390de0[_0xbf79('0x30')][_0xbf79('0x32')]?_0x390de0[_0xbf79('0x30')]:_0x1568af[_0xbf79('0x2c')];if(_0x3e6eff['query'][_0xbf79('0x44')]){_0x390de0[_0xbf79('0x45')]=[{'all':!![]}];}_0x390de0=_['merge']({},_0x390de0,_0x3e6eff[_0xbf79('0x46')]);return db[_0xbf79('0x29')][_0xbf79('0x47')](_0x390de0)[_0xbf79('0x23')](handleEntityNotFound(_0x114cef,null))[_0xbf79('0x23')](respondWithResult(_0x114cef,null))['catch'](handleError(_0x114cef,null));};exports[_0xbf79('0x48')]=function(_0x3ec5bb,_0x4ac6d7){return db[_0xbf79('0x29')][_0xbf79('0x48')](_0x3ec5bb[_0xbf79('0x49')],{})[_0xbf79('0x23')](respondWithResult(_0x4ac6d7,0xc9))[_0xbf79('0x40')](handleError(_0x4ac6d7,null));};exports['update']=function(_0x5c999d,_0x1258f6){if(_0x5c999d[_0xbf79('0x49')]['id']){delete _0x5c999d[_0xbf79('0x49')]['id'];}return db['VtigerField'][_0xbf79('0x47')]({'where':{'id':_0x5c999d[_0xbf79('0x42')]['id']}})[_0xbf79('0x23')](handleEntityNotFound(_0x1258f6,null))[_0xbf79('0x23')](saveUpdates(_0x5c999d[_0xbf79('0x49')],null))[_0xbf79('0x23')](respondWithResult(_0x1258f6,null))['catch'](handleError(_0x1258f6,null));};exports['destroy']=function(_0x16ad20,_0x10bc47){return db[_0xbf79('0x29')]['find']({'where':{'id':_0x16ad20[_0xbf79('0x42')]['id']}})[_0xbf79('0x23')](handleEntityNotFound(_0x10bc47,null))[_0xbf79('0x23')](removeEntity(_0x10bc47,null))['catch'](handleError(_0x10bc47,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 2f80cb6..206b524 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 _0x9957=['rimraf','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0xc145a,_0x2c702a){var _0x1e5553=function(_0x1e0b7e){while(--_0x1e0b7e){_0xc145a['push'](_0xc145a['shift']());}};_0x1e5553(++_0x2c702a);}(_0x7a54,0x106));var _0x47a5=function(_0x1e505f,_0x309017){_0x1e505f=_0x1e505f-0x0;var _0x263bcd=_0x7a54[_0x1e505f];return _0x263bcd;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x47a5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 10133d7..3efc6f7 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 _0xdc91=['client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1a227b,_0x1534bb){var _0x1819f7=function(_0x38197f){while(--_0x38197f){_0x1a227b['push'](_0x1a227b['shift']());}};_0x1819f7(++_0x1534bb);}(_0xdc91,0x8b));var _0x1dc9=function(_0x5360b9,_0xaa2c02){_0x5360b9=_0x5360b9-0x0;var _0x1b8e7f=_0xdc91[_0x5360b9];return _0x1b8e7f;};'use strict';var _=require(_0x1dc9('0x0'));var util=require(_0x1dc9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1dc9('0x2'))['db'];var utils=require(_0x1dc9('0x3'));var logger=require(_0x1dc9('0x4'))(_0x1dc9('0x5'));var config=require(_0x1dc9('0x6'));var jayson=require(_0x1dc9('0x7'));var client=jayson[_0x1dc9('0x8')][_0x1dc9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ac058,_0x2c6e6c,_0x25a752){return new BPromise(function(_0x316995,_0x3d1772){return client[_0x1dc9('0xa')](_0x5ac058,_0x25a752)[_0x1dc9('0xb')](function(_0x43c405){logger[_0x1dc9('0xc')](_0x1dc9('0xd'),_0x2c6e6c,_0x1dc9('0xe'));logger['debug'](_0x1dc9('0xf'),_0x2c6e6c,'request\x20sent',JSON[_0x1dc9('0x10')](_0x43c405));if(_0x43c405['error']){if(_0x43c405[_0x1dc9('0x11')][_0x1dc9('0x12')]===0x1f4){logger[_0x1dc9('0x11')](_0x1dc9('0xd'),_0x2c6e6c,_0x43c405['error'][_0x1dc9('0x13')]);return _0x3d1772(_0x43c405[_0x1dc9('0x11')]['message']);}logger[_0x1dc9('0x11')](_0x1dc9('0xd'),_0x2c6e6c,_0x43c405['error']['message']);return _0x316995(_0x43c405[_0x1dc9('0x11')][_0x1dc9('0x13')]);}else{logger[_0x1dc9('0xc')](_0x1dc9('0xd'),_0x2c6e6c,'request\x20sent');_0x316995(_0x43c405['result'][_0x1dc9('0x13')]);}})[_0x1dc9('0x14')](function(_0x5cccb9){logger[_0x1dc9('0x11')](_0x1dc9('0xd'),_0x2c6e6c,_0x5cccb9);_0x3d1772(_0x5cccb9);});});} \ No newline at end of file +var _0xb4f8=['client','http','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x595a09,_0x1d043c){var _0x30ff42=function(_0x2dd733){while(--_0x2dd733){_0x595a09['push'](_0x595a09['shift']());}};_0x30ff42(++_0x1d043c);}(_0xb4f8,0x83));var _0x8b4f=function(_0x2962d5,_0x38deda){_0x2962d5=_0x2962d5-0x0;var _0x273406=_0xb4f8[_0x2962d5];return _0x273406;};'use strict';var _=require('lodash');var util=require(_0x8b4f('0x0'));var moment=require(_0x8b4f('0x1'));var BPromise=require(_0x8b4f('0x2'));var rs=require(_0x8b4f('0x3'));var fs=require('fs');var Redis=require(_0x8b4f('0x4'));var db=require(_0x8b4f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8b4f('0x6'))('rpc');var config=require(_0x8b4f('0x7'));var jayson=require(_0x8b4f('0x8'));var client=jayson[_0x8b4f('0x9')][_0x8b4f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2eefde,_0x557bc0,_0x2dfe1c){return new BPromise(function(_0xa91c09,_0x40042b){return client['request'](_0x2eefde,_0x2dfe1c)[_0x8b4f('0xb')](function(_0x13d37a){logger[_0x8b4f('0xc')](_0x8b4f('0xd'),_0x557bc0,_0x8b4f('0xe'));logger['debug'](_0x8b4f('0xf'),_0x557bc0,_0x8b4f('0xe'),JSON['stringify'](_0x13d37a));if(_0x13d37a[_0x8b4f('0x10')]){if(_0x13d37a[_0x8b4f('0x10')]['code']===0x1f4){logger[_0x8b4f('0x10')](_0x8b4f('0xd'),_0x557bc0,_0x13d37a['error'][_0x8b4f('0x11')]);return _0x40042b(_0x13d37a[_0x8b4f('0x10')][_0x8b4f('0x11')]);}logger[_0x8b4f('0x10')]('VtigerField,\x20%s,\x20%s',_0x557bc0,_0x13d37a[_0x8b4f('0x10')][_0x8b4f('0x11')]);return _0xa91c09(_0x13d37a[_0x8b4f('0x10')][_0x8b4f('0x11')]);}else{logger[_0x8b4f('0xc')](_0x8b4f('0xd'),_0x557bc0,'request\x20sent');_0xa91c09(_0x13d37a[_0x8b4f('0x12')][_0x8b4f('0x11')]);}})[_0x8b4f('0x13')](function(_0x1b4b9f){logger[_0x8b4f('0x10')](_0x8b4f('0xd'),_0x557bc0,_0x1b4b9f);_0x40042b(_0x1b4b9f);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index a2e32ed..f0005e3 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 _0x1df3=['express','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get','index','show','/:id/configurations','getConfigurations','/:id/fields','isAuthenticated','getFields','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout'];(function(_0x50b2da,_0x9f4363){var _0x9f30d9=function(_0x1b3e37){while(--_0x1b3e37){_0x50b2da['push'](_0x50b2da['shift']());}};_0x9f30d9(++_0x9f4363);}(_0x1df3,0x134));var _0x31df=function(_0x174d3f,_0x35b95a){_0x174d3f=_0x174d3f-0x0;var _0x33daf8=_0x1df3[_0x174d3f];return _0x33daf8;};'use strict';var multer=require(_0x31df('0x0'));var util=require(_0x31df('0x1'));var path=require(_0x31df('0x2'));var timeout=require(_0x31df('0x3'));var express=require(_0x31df('0x4'));var router=express['Router']();var auth=require(_0x31df('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x31df('0x6'));var controller=require(_0x31df('0x7'));router[_0x31df('0x8')]('/',auth['isAuthenticated'](),controller[_0x31df('0x9')]);router[_0x31df('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x31df('0xa')]);router[_0x31df('0x8')](_0x31df('0xb'),auth['isAuthenticated'](),controller[_0x31df('0xc')]);router[_0x31df('0x8')](_0x31df('0xd'),auth[_0x31df('0xe')](),controller[_0x31df('0xf')]);router[_0x31df('0x10')]('/',auth['isAuthenticated'](),controller[_0x31df('0x11')]);router['post'](_0x31df('0xb'),auth[_0x31df('0xe')](),controller['addConfiguration']);router[_0x31df('0x12')]('/:id',auth[_0x31df('0xe')](),controller[_0x31df('0x13')]);router[_0x31df('0x14')](_0x31df('0x15'),auth[_0x31df('0xe')](),controller[_0x31df('0x16')]);module[_0x31df('0x17')]=router; \ No newline at end of file +var _0xc456=['getFields','create','post','addConfiguration','put','delete','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','/:id/fields'];(function(_0xd6c85b,_0x57091b){var _0xbe0e1e=function(_0x285c9a){while(--_0x285c9a){_0xd6c85b['push'](_0xd6c85b['shift']());}};_0xbe0e1e(++_0x57091b);}(_0xc456,0x1ea));var _0x6c45=function(_0x50ab5b,_0x84a389){_0x50ab5b=_0x50ab5b-0x0;var _0x1df6cb=_0xc456[_0x50ab5b];return _0x1df6cb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6c45('0x0'));var timeout=require(_0x6c45('0x1'));var express=require(_0x6c45('0x2'));var router=express[_0x6c45('0x3')]();var auth=require(_0x6c45('0x4'));var interaction=require(_0x6c45('0x5'));var config=require(_0x6c45('0x6'));var controller=require(_0x6c45('0x7'));router[_0x6c45('0x8')]('/',auth[_0x6c45('0x9')](),controller[_0x6c45('0xa')]);router[_0x6c45('0x8')](_0x6c45('0xb'),auth[_0x6c45('0x9')](),controller['show']);router[_0x6c45('0x8')](_0x6c45('0xc'),auth[_0x6c45('0x9')](),controller['getConfigurations']);router[_0x6c45('0x8')](_0x6c45('0xd'),auth[_0x6c45('0x9')](),controller[_0x6c45('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6c45('0xf')]);router[_0x6c45('0x10')](_0x6c45('0xc'),auth[_0x6c45('0x9')](),controller[_0x6c45('0x11')]);router[_0x6c45('0x12')](_0x6c45('0xb'),auth[_0x6c45('0x9')](),controller['update']);router[_0x6c45('0x13')](_0x6c45('0xb'),auth['isAuthenticated'](),controller[_0x6c45('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 9e2f83c..19bc6f1 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 _0x0978=['remoteUri','ENUM','password','newTab','sequelize','exports','STRING','username'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x0978,0x12c));var _0x8097=function(_0x4d75c3,_0x22bddb){_0x4d75c3=_0x4d75c3-0x0;var _0xac4115=_0x0978[_0x4d75c3];return _0xac4115;};'use strict';var Sequelize=require(_0x8097('0x0'));module[_0x8097('0x1')]={'name':{'type':Sequelize[_0x8097('0x2')]},'description':{'type':Sequelize[_0x8097('0x2')]},'username':{'type':Sequelize[_0x8097('0x2')],'unique':_0x8097('0x3')},'password':{'type':Sequelize[_0x8097('0x2')]},'token':{'type':Sequelize[_0x8097('0x2')]},'remoteUri':{'type':Sequelize[_0x8097('0x2')],'unique':_0x8097('0x4')},'authType':{'type':Sequelize[_0x8097('0x5')]('password','token'),'defaultValue':_0x8097('0x6')},'serverUrl':{'type':Sequelize[_0x8097('0x2')]},'type':{'type':Sequelize[_0x8097('0x5')]('integrationTab',_0x8097('0x7')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x064f=['integrationTab','exports','STRING','username','remoteUri','password','ENUM','newTab'];(function(_0xb3b542,_0x28d1e9){var _0x2c2184=function(_0x5506ac){while(--_0x5506ac){_0xb3b542['push'](_0xb3b542['shift']());}};_0x2c2184(++_0x28d1e9);}(_0x064f,0x191));var _0xf064=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x064f[_0xaa1b3e];return _0x454d7d;};'use strict';var Sequelize=require('sequelize');module[_0xf064('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf064('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xf064('0x2')},'password':{'type':Sequelize[_0xf064('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xf064('0x1')],'unique':_0xf064('0x3')},'authType':{'type':Sequelize['ENUM'](_0xf064('0x4'),'token'),'defaultValue':_0xf064('0x4')},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xf064('0x5')]('integrationTab',_0xf064('0x6')),'defaultValue':_0xf064('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index abbcbe2..9bb0c25 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 _0x86a5=['../../mysqldb','../../components/integrations/configuration','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','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','ZendeskAccount','rawAttributes','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','findAll','catch','show','include','find','create','body','params','findOne','ZendeskConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','token','authType','remoteUri','slice','substring','GET','%s/%s','ticket_fields','password','format','headers','Basic\x20%s','%s/token:%s','base64','Unknown\x20authentication\x20type','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment'];(function(_0xf913b7,_0x25885f){var _0x3d489d=function(_0x5dff3c){while(--_0x5dff3c){_0xf913b7['push'](_0xf913b7['shift']());}};_0x3d489d(++_0x25885f);}(_0x86a5,0x69));var _0x586a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x86a5[_0xa464c9];return _0x3d73c4;};'use strict';var pdf=require(_0x586a('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x586a('0x1'));var jsonpatch=require(_0x586a('0x2'));var rp=require(_0x586a('0x3'));var moment=require(_0x586a('0x4'));var BPromise=require(_0x586a('0x5'));var Mustache=require('mustache');var util=require(_0x586a('0x6'));var path=require(_0x586a('0x7'));var sox=require(_0x586a('0x8'));var csv=require(_0x586a('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x586a('0xa'));var squel=require(_0x586a('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x586a('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x586a('0xd'));var Redis=require('ioredis');var authService=require(_0x586a('0xe'));var qs=require(_0x586a('0xf'));var as=require(_0x586a('0x10'));var hardwareService=require(_0x586a('0x11'));var logger=require('../../config/logger')(_0x586a('0x12'));var utils=require('../../config/utils');var config=require(_0x586a('0x13'));var db=require(_0x586a('0x14'))['db'];var integrations=require(_0x586a('0x15'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x4de2af,_0x51a176,_0x235103){if(_0x235103){var _0x4fba68=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4fba68[_0x586a('0x16')](_0x51a176)){return _0x4de2af;}else{throw new db[(_0x586a('0x17'))][(_0x586a('0x18'))](_0x586a('0x19'));}}else{return _0x4de2af;}}function respondWithRpcPromise(_0x21bc59,_0x2a75a7,_0x16ec5f,_0x57b9d9){return new BPromise(function(_0x4b7e86,_0x56d23a){var _0x27698b=_0x57b9d9||client;return _0x27698b[_0x586a('0x1a')](_0x21bc59,_0x16ec5f)['then'](function(_0x295a75){logger[_0x586a('0x1b')](_0x586a('0x1c'),_0x2a75a7,_0x586a('0x1d'));logger[_0x586a('0x1e')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x2a75a7,_0x586a('0x1d'),JSON[_0x586a('0x1f')](_0x295a75));if(_0x295a75[_0x586a('0x20')]){if(_0x295a75[_0x586a('0x20')][_0x586a('0x21')]===0x1f4){logger[_0x586a('0x20')](_0x586a('0x1c'),_0x2a75a7,_0x295a75[_0x586a('0x20')]['message']);return _0x56d23a(_0x295a75['error']['message']);}logger[_0x586a('0x20')](_0x586a('0x1c'),_0x2a75a7,_0x295a75[_0x586a('0x20')][_0x586a('0x22')]);return _0x4b7e86(_0x295a75[_0x586a('0x20')][_0x586a('0x22')]);}else{logger['info'](_0x586a('0x1c'),_0x2a75a7,_0x586a('0x1d'));_0x4b7e86(_0x295a75[_0x586a('0x23')][_0x586a('0x22')]);}})['catch'](function(_0x50ebc3){logger[_0x586a('0x20')](_0x586a('0x1c'),_0x2a75a7,_0x50ebc3);_0x56d23a(_0x50ebc3);});});}function respondWithStatusCode(_0x2173b3,_0xa90d81){_0xa90d81=_0xa90d81||0xcc;return function(_0x1cc1e2){if(_0x1cc1e2){return _0x2173b3[_0x586a('0x24')](_0xa90d81);}return _0x2173b3[_0x586a('0x25')](_0xa90d81)[_0x586a('0x26')]();};}function respondWithResult(_0x135794,_0x2acb03){_0x2acb03=_0x2acb03||0xc8;return function(_0x39aa3d){if(_0x39aa3d){return _0x135794[_0x586a('0x25')](_0x2acb03)[_0x586a('0x27')](_0x39aa3d);}};}function respondWithFilteredResult(_0x2a2ad5,_0x3b7c50){return function(_0x107d95){if(_0x107d95){var _0x258726=_0x107d95[_0x586a('0x28')],_0x4848b0=_0x3b7c50[_0x586a('0x29')],_0x1fa7c3=_0x3b7c50['offset']+_0x3b7c50[_0x586a('0x2a')],_0x5d0be2;if(_0x1fa7c3>=_0x258726){_0x1fa7c3=_0x258726;_0x5d0be2=0xc8;}else{_0x5d0be2=0xce;}_0x2a2ad5[_0x586a('0x25')](_0x5d0be2);return _0x2a2ad5[_0x586a('0x2b')]('Content-Range',_0x4848b0+'-'+_0x1fa7c3+'/'+_0x258726)[_0x586a('0x27')](_0x107d95);}return null;};}function patchUpdates(_0x5f5aa4){return function(_0x54b110){try{jsonpatch[_0x586a('0x2c')](_0x54b110,_0x5f5aa4,!![]);}catch(_0x4b6eaa){return BPromise[_0x586a('0x2d')](_0x4b6eaa);}return _0x54b110[_0x586a('0x2e')]();};}function saveUpdates(_0x38f41b,_0x492320){return function(_0x2d1505){if(_0x2d1505){return _0x2d1505[_0x586a('0x2f')](_0x38f41b)[_0x586a('0x30')](function(_0x234511){return _0x234511;});}return null;};}function removeEntity(_0x23ae75,_0x3ef4db){return function(_0x460d79){if(_0x460d79){return _0x460d79[_0x586a('0x31')]()[_0x586a('0x30')](function(){_0x23ae75[_0x586a('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a8afc,_0x2f183e){return function(_0xc7dfdc){if(!_0xc7dfdc){_0x2a8afc[_0x586a('0x24')](0x194);}return _0xc7dfdc;};}function handleError(_0x1c90fa,_0x45b9b5){_0x45b9b5=_0x45b9b5||0x1f4;return function(_0x4faf04){logger[_0x586a('0x20')](_0x4faf04[_0x586a('0x32')]);if(_0x4faf04[_0x586a('0x33')]){delete _0x4faf04['name'];}_0x1c90fa[_0x586a('0x25')](_0x45b9b5)[_0x586a('0x34')](_0x4faf04);};}exports[_0x586a('0x35')]=function(_0xb519ff,_0x1d11d7){var _0x241002={},_0x11f36b={},_0x179d02={'count':0x0,'rows':[]};var _0x22bfbb=_[_0x586a('0x36')](db[_0x586a('0x37')][_0x586a('0x38')],function(_0x38bf4e){return{'name':_0x38bf4e['fieldName'],'type':_0x38bf4e['type'][_0x586a('0x39')]};});_0x11f36b[_0x586a('0x3a')]=_[_0x586a('0x36')](_0x22bfbb,_0x586a('0x33'));_0x11f36b[_0x586a('0x3b')]=_[_0x586a('0x3c')](_0xb519ff[_0x586a('0x3b')]);_0x11f36b['filters']=_[_0x586a('0x3d')](_0x11f36b[_0x586a('0x3a')],_0x11f36b['query']);_0x241002[_0x586a('0x3e')]=_[_0x586a('0x3d')](_0x11f36b[_0x586a('0x3a')],qs[_0x586a('0x3f')](_0xb519ff[_0x586a('0x3b')]['fields']));_0x241002[_0x586a('0x3e')]=_0x241002[_0x586a('0x3e')][_0x586a('0x40')]?_0x241002[_0x586a('0x3e')]:_0x11f36b[_0x586a('0x3a')];if(!_0xb519ff['query'][_0x586a('0x41')](_0x586a('0x42'))){_0x241002[_0x586a('0x2a')]=qs[_0x586a('0x2a')](_0xb519ff['query']['limit']);_0x241002[_0x586a('0x29')]=qs[_0x586a('0x29')](_0xb519ff[_0x586a('0x3b')][_0x586a('0x29')]);}_0x241002[_0x586a('0x43')]=qs[_0x586a('0x44')](_0xb519ff['query']['sort']);_0x241002[_0x586a('0x45')]=qs[_0x586a('0x46')](_['pick'](_0xb519ff[_0x586a('0x3b')],_0x11f36b[_0x586a('0x46')]),_0x22bfbb);if(_0xb519ff[_0x586a('0x3b')][_0x586a('0x47')]){_0x241002['where']=_[_0x586a('0x48')](_0x241002[_0x586a('0x45')],{'$or':_[_0x586a('0x36')](_0x22bfbb,function(_0x381ce8){if(_0x381ce8[_0x586a('0x49')]!==_0x586a('0x4a')){var _0x4d7a59={};_0x4d7a59[_0x381ce8[_0x586a('0x33')]]={'$like':'%'+_0xb519ff['query'][_0x586a('0x47')]+'%'};return _0x4d7a59;}})});}_0x241002=_['merge']({},_0x241002,_0xb519ff[_0x586a('0x4b')]);var _0x13a8a4={'where':_0x241002[_0x586a('0x45')]};return db[_0x586a('0x37')][_0x586a('0x28')](_0x13a8a4)[_0x586a('0x30')](function(_0x3c757b){_0x179d02[_0x586a('0x28')]=_0x3c757b;if(_0xb519ff[_0x586a('0x3b')][_0x586a('0x4c')]){_0x241002['include']=[{'all':!![]}];}return db['ZendeskAccount'][_0x586a('0x4d')](_0x241002);})[_0x586a('0x30')](function(_0xbd992b){_0x179d02['rows']=_0xbd992b;return _0x179d02;})[_0x586a('0x30')](respondWithFilteredResult(_0x1d11d7,_0x241002))[_0x586a('0x4e')](handleError(_0x1d11d7,null));};exports[_0x586a('0x4f')]=function(_0x15ec1c,_0x2185f1){var _0x3367c0={'raw':![],'where':{'id':_0x15ec1c['params']['id']}},_0x4d371d={};_0x4d371d[_0x586a('0x3a')]=_[_0x586a('0x3c')](db['ZendeskAccount'][_0x586a('0x38')]);_0x4d371d['query']=_['keys'](_0x15ec1c[_0x586a('0x3b')]);_0x4d371d[_0x586a('0x46')]=_[_0x586a('0x3d')](_0x4d371d[_0x586a('0x3a')],_0x4d371d[_0x586a('0x3b')]);_0x3367c0[_0x586a('0x3e')]=_[_0x586a('0x3d')](_0x4d371d['model'],qs['fields'](_0x15ec1c[_0x586a('0x3b')][_0x586a('0x3f')]));_0x3367c0[_0x586a('0x3e')]=_0x3367c0[_0x586a('0x3e')][_0x586a('0x40')]?_0x3367c0[_0x586a('0x3e')]:_0x4d371d[_0x586a('0x3a')];if(_0x15ec1c[_0x586a('0x3b')][_0x586a('0x4c')]){_0x3367c0[_0x586a('0x50')]=[{'all':!![]}];}_0x3367c0=_['merge']({},_0x3367c0,_0x15ec1c[_0x586a('0x4b')]);return db[_0x586a('0x37')][_0x586a('0x51')](_0x3367c0)[_0x586a('0x30')](handleEntityNotFound(_0x2185f1,null))['then'](respondWithResult(_0x2185f1,null))['catch'](handleError(_0x2185f1,null));};exports[_0x586a('0x52')]=function(_0x3f6792,_0x46500a){return db[_0x586a('0x37')]['create'](_0x3f6792[_0x586a('0x53')],{})[_0x586a('0x30')](respondWithResult(_0x46500a,0xc9))['catch'](handleError(_0x46500a,null));};exports[_0x586a('0x2f')]=function(_0x5b3fbb,_0x248459){if(_0x5b3fbb[_0x586a('0x53')]['id']){delete _0x5b3fbb[_0x586a('0x53')]['id'];}return db[_0x586a('0x37')][_0x586a('0x51')]({'where':{'id':_0x5b3fbb[_0x586a('0x54')]['id']}})[_0x586a('0x30')](handleEntityNotFound(_0x248459,null))[_0x586a('0x30')](saveUpdates(_0x5b3fbb[_0x586a('0x53')],null))[_0x586a('0x30')](respondWithResult(_0x248459,null))[_0x586a('0x4e')](handleError(_0x248459,null));};exports['destroy']=function(_0x128aa8,_0x29b1b5){return db[_0x586a('0x37')][_0x586a('0x51')]({'where':{'id':_0x128aa8[_0x586a('0x54')]['id']}})['then'](handleEntityNotFound(_0x29b1b5,null))[_0x586a('0x30')](removeEntity(_0x29b1b5,null))[_0x586a('0x4e')](handleError(_0x29b1b5,null));};exports['getConfigurations']=function(_0x4e88d6,_0x34a777,_0x476245){var _0x3357a7={};var _0x4ac814={};var _0x7b4498;var _0x47b0bc;return db[_0x586a('0x37')][_0x586a('0x55')]({'where':{'id':_0x4e88d6[_0x586a('0x54')]['id']}})[_0x586a('0x30')](handleEntityNotFound(_0x34a777,null))['then'](function(_0x59e580){if(_0x59e580){_0x7b4498=_0x59e580;_0x4ac814[_0x586a('0x3a')]=_['keys'](db[_0x586a('0x56')][_0x586a('0x38')]);_0x4ac814[_0x586a('0x3b')]=_[_0x586a('0x3c')](_0x4e88d6[_0x586a('0x3b')]);_0x4ac814[_0x586a('0x46')]=_[_0x586a('0x3d')](_0x4ac814[_0x586a('0x3a')],_0x4ac814[_0x586a('0x3b')]);_0x3357a7[_0x586a('0x3e')]=_[_0x586a('0x3d')](_0x4ac814['model'],qs['fields'](_0x4e88d6[_0x586a('0x3b')][_0x586a('0x3f')]));_0x3357a7[_0x586a('0x3e')]=_0x3357a7[_0x586a('0x3e')][_0x586a('0x40')]?_0x3357a7[_0x586a('0x3e')]:_0x4ac814[_0x586a('0x3a')];_0x3357a7[_0x586a('0x43')]=qs[_0x586a('0x44')](_0x4e88d6[_0x586a('0x3b')][_0x586a('0x44')]);_0x3357a7[_0x586a('0x45')]=qs[_0x586a('0x46')](_['pick'](_0x4e88d6[_0x586a('0x3b')],_0x4ac814[_0x586a('0x46')]));if(_0x4e88d6['query'][_0x586a('0x47')]){_0x3357a7['where']=_[_0x586a('0x48')](_0x3357a7[_0x586a('0x45')],{'$or':_['map'](_0x3357a7['attributes'],function(_0x1b99d6){var _0x1b7d95={};_0x1b7d95[_0x1b99d6]={'$like':'%'+_0x4e88d6['query']['filter']+'%'};return _0x1b7d95;})});}_0x3357a7=_['merge']({},_0x3357a7,_0x4e88d6[_0x586a('0x4b')]);return _0x7b4498[_0x586a('0x57')](_0x3357a7);}})[_0x586a('0x30')](function(_0x40f7f3){if(_0x40f7f3){_0x47b0bc=_0x40f7f3[_0x586a('0x40')];if(!_0x4e88d6[_0x586a('0x3b')][_0x586a('0x41')](_0x586a('0x42'))){_0x3357a7[_0x586a('0x2a')]=qs[_0x586a('0x2a')](_0x4e88d6[_0x586a('0x3b')][_0x586a('0x2a')]);_0x3357a7[_0x586a('0x29')]=qs[_0x586a('0x29')](_0x4e88d6[_0x586a('0x3b')][_0x586a('0x29')]);}return _0x7b4498['getConfigurations'](_0x3357a7);}})[_0x586a('0x30')](function(_0x399d5f){if(_0x399d5f){return _0x399d5f?{'count':_0x47b0bc,'rows':_0x399d5f}:null;}})['then'](respondWithResult(_0x34a777,null))[_0x586a('0x4e')](handleError(_0x34a777,null));};exports[_0x586a('0x58')]=function(_0x424d96,_0x4f3cf6,_0xf66c2b){if(_0x424d96[_0x586a('0x53')]['id']){delete _0x424d96[_0x586a('0x53')]['id'];}return db[_0x586a('0x37')]['findOne']({'where':{'id':_0x424d96[_0x586a('0x54')]['id']}})[_0x586a('0x30')](handleEntityNotFound(_0x4f3cf6,null))[_0x586a('0x30')](function(_0x3e4ce8){if(_0x3e4ce8){_0x424d96[_0x586a('0x53')][_0x586a('0x59')]=_0x3e4ce8['id'];_0x424d96[_0x586a('0x53')][_0x586a('0x5a')]=integrations[_0x586a('0x5b')](_0x424d96[_0x586a('0x53')][_0x586a('0x5c')],_0x424d96['body'][_0x586a('0x49')]);_0x424d96[_0x586a('0x53')][_0x586a('0x5d')]=integrations[_0x586a('0x5e')](_0x424d96[_0x586a('0x53')][_0x586a('0x5c')],_0x424d96[_0x586a('0x53')]['type']);return db['ZendeskConfiguration'][_0x586a('0x52')](_0x424d96['body'],{'include':[{'model':db[_0x586a('0x5f')],'as':_0x586a('0x5a')},{'model':db['ZendeskField'],'as':_0x586a('0x5d')}]});}return null;})[_0x586a('0x30')](respondWithResult(_0x4f3cf6,null))[_0x586a('0x4e')](handleError(_0x4f3cf6,null));};exports[_0x586a('0x60')]=function(_0x1d23c5,_0x3cc389,_0x3ae97a){var _0x545e10='';return db['ZendeskAccount'][_0x586a('0x55')]({'where':{'id':_0x1d23c5[_0x586a('0x54')]['id']},'attributes':['id',_0x586a('0x61'),'password',_0x586a('0x62'),_0x586a('0x63'),_0x586a('0x64')]})[_0x586a('0x30')](handleEntityNotFound(_0x3cc389,null))[_0x586a('0x30')](function(_0x1363b8){if(_0x1363b8){_0x545e10=_0x1363b8[_0x586a('0x64')];var _0x237312=_0x545e10[_0x586a('0x65')](-0x1);if(_0x237312==='/'){_0x545e10=_0x545e10[_0x586a('0x66')](0x0,_0x545e10['lastIndexOf'](_0x237312));}var _0x3c6dc9={'method':_0x586a('0x67'),'uri':util['format'](_0x586a('0x68'),_0x545e10,_0x586a('0x69')),'json':!![]};switch(_0x1363b8[_0x586a('0x63')]){case _0x586a('0x6a'):_0x3c6dc9['headers']={'Authorization':util[_0x586a('0x6b')]('Basic\x20%s',new Buffer(util[_0x586a('0x6b')]('%s:%s',_0x1363b8[_0x586a('0x61')],_0x1363b8['password']))['toString']('base64'))};break;case _0x586a('0x62'):_0x3c6dc9[_0x586a('0x6c')]={'Authorization':util['format'](_0x586a('0x6d'),new Buffer(util[_0x586a('0x6b')](_0x586a('0x6e'),_0x1363b8[_0x586a('0x61')],_0x1363b8[_0x586a('0x62')]))['toString'](_0x586a('0x6f')))};break;default:throw new db[(_0x586a('0x17'))][(_0x586a('0x18'))](_0x586a('0x70'));}return rp(_0x3c6dc9);}})[_0x586a('0x30')](function(_0x56eaac){if(_0x56eaac){var _0xcd931c=['subject',_0x586a('0x71'),_0x586a('0x72'),_0x586a('0x73')];_[_0x586a('0x74')](_0x56eaac[_0x586a('0x69')],function(_0x3097bb){return _0xcd931c[_0x586a('0x75')](_0x3097bb['type']);});return{'count':_0x56eaac[_0x586a('0x69')]['length'],'rows':_[_0x586a('0x36')](_0x56eaac[_0x586a('0x69')],function(_0x2ab938){return{'id':_0x2ab938['id'],'name':_0x2ab938[_0x586a('0x76')]>0x7?_0x2ab938[_0x586a('0x77')]:_0x2ab938[_0x586a('0x49')],'custom':_0x2ab938[_0x586a('0x76')]>0x7?!![]:![],'options':_0x2ab938[_0x586a('0x78')]?_0x2ab938[_0x586a('0x78')]:_0x2ab938['custom_field_options']?_0x2ab938[_0x586a('0x79')]:[]};})};}})[_0x586a('0x30')](respondWithResult(_0x3cc389,null))['catch'](function(_0x1077f6){var _0x3e0fb7=_0x1d23c5['query']['test']?0x1f4:_0x1077f6['statusCode']||0x1f4;logger[_0x586a('0x20')](_0x586a('0x7a'),_0x586a('0x60'),_0x3e0fb7,JSON[_0x586a('0x1f')](_0x1077f6));delete _0x1077f6['name'];if(_0x3e0fb7===0x191){_0x3e0fb7=0x190;}_0x3cc389[_0x586a('0x25')](_0x3e0fb7)['send'](_0x1d23c5['query'][_0x586a('0x16')]?{'message':_0x586a('0x7b'),'statusCode':_0x1077f6[_0x586a('0x7c')]}:_0x1077f6);});}; \ No newline at end of file +var _0x128e=['ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','stack','name','send','index','map','ZendeskAccount','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','rawAttributes','filters','length','find','create','body','destroy','getConfigurations','findOne','order','sort','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','channel','ZendeskConfiguration','username','token','authType','remoteUri','slice','substring','lastIndexOf','GET','%s/%s','ticket_fields','password','Basic\x20%s','%s:%s','toString','headers','format','base64','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','position','title','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','fast-json-patch','moment','bluebird','mustache','sox','to-csv'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x128e,0x179));var _0xe128=function(_0x49bf97,_0x483e6e){_0x49bf97=_0x49bf97-0x0;var _0x34ae91=_0x128e[_0x49bf97];return _0x34ae91;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe128('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe128('0x1'));var rp=require('request-promise');var moment=require(_0xe128('0x2'));var BPromise=require(_0xe128('0x3'));var Mustache=require(_0xe128('0x4'));var util=require('util');var path=require('path');var sox=require(_0xe128('0x5'));var csv=require(_0xe128('0x6'));var ejs=require(_0xe128('0x7'));var fs=require('fs');var _=require(_0xe128('0x8'));var squel=require(_0xe128('0x9'));var crypto=require(_0xe128('0xa'));var jsforce=require(_0xe128('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xe128('0x6'));var querystring=require(_0xe128('0xc'));var Papa=require(_0xe128('0xd'));var Redis=require('ioredis');var authService=require(_0xe128('0xe'));var qs=require(_0xe128('0xf'));var as=require(_0xe128('0x10'));var hardwareService=require(_0xe128('0x11'));var logger=require(_0xe128('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xe128('0x13'));var db=require(_0xe128('0x14'))['db'];var integrations=require(_0xe128('0x15'));var jayson=require(_0xe128('0x16'));var client=jayson['client'][_0xe128('0x17')]({'port':0x232a});function checkPasswordPattern(_0x571ffc,_0x3a8291,_0x25dc81){if(_0x25dc81){var _0x1b4648=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1b4648[_0xe128('0x18')](_0x3a8291)){return _0x571ffc;}else{throw new db[(_0xe128('0x19'))][(_0xe128('0x1a'))](_0xe128('0x1b'));}}else{return _0x571ffc;}}function respondWithRpcPromise(_0x2a5539,_0x5ede8d,_0x490d6c,_0x5cad81){return new BPromise(function(_0x5827f5,_0x1e83c6){var _0x484e1e=_0x5cad81||client;return _0x484e1e[_0xe128('0x1c')](_0x2a5539,_0x490d6c)[_0xe128('0x1d')](function(_0xfb7902){logger[_0xe128('0x1e')](_0xe128('0x1f'),_0x5ede8d,'request\x20sent');logger[_0xe128('0x20')](_0xe128('0x21'),_0x5ede8d,_0xe128('0x22'),JSON['stringify'](_0xfb7902));if(_0xfb7902['error']){if(_0xfb7902[_0xe128('0x23')][_0xe128('0x24')]===0x1f4){logger[_0xe128('0x23')](_0xe128('0x1f'),_0x5ede8d,_0xfb7902[_0xe128('0x23')][_0xe128('0x25')]);return _0x1e83c6(_0xfb7902[_0xe128('0x23')]['message']);}logger['error'](_0xe128('0x1f'),_0x5ede8d,_0xfb7902['error']['message']);return _0x5827f5(_0xfb7902[_0xe128('0x23')]['message']);}else{logger[_0xe128('0x1e')](_0xe128('0x1f'),_0x5ede8d,_0xe128('0x22'));_0x5827f5(_0xfb7902[_0xe128('0x26')][_0xe128('0x25')]);}})[_0xe128('0x27')](function(_0xa42532){logger[_0xe128('0x23')](_0xe128('0x1f'),_0x5ede8d,_0xa42532);_0x1e83c6(_0xa42532);});});}function respondWithStatusCode(_0x9e435c,_0x58644a){_0x58644a=_0x58644a||0xcc;return function(_0xeb4f69){if(_0xeb4f69){return _0x9e435c[_0xe128('0x28')](_0x58644a);}return _0x9e435c[_0xe128('0x29')](_0x58644a)[_0xe128('0x2a')]();};}function respondWithResult(_0x3656dc,_0x861b44){_0x861b44=_0x861b44||0xc8;return function(_0x241c7a){if(_0x241c7a){return _0x3656dc[_0xe128('0x29')](_0x861b44)[_0xe128('0x2b')](_0x241c7a);}};}function respondWithFilteredResult(_0x3d2a99,_0x4e2bb0){return function(_0x3b4082){if(_0x3b4082){var _0x439371=_0x3b4082[_0xe128('0x2c')],_0xac8fd2=_0x4e2bb0['offset'],_0x5c24dd=_0x4e2bb0[_0xe128('0x2d')]+_0x4e2bb0[_0xe128('0x2e')],_0x1598a5;if(_0x5c24dd>=_0x439371){_0x5c24dd=_0x439371;_0x1598a5=0xc8;}else{_0x1598a5=0xce;}_0x3d2a99['status'](_0x1598a5);return _0x3d2a99[_0xe128('0x2f')]('Content-Range',_0xac8fd2+'-'+_0x5c24dd+'/'+_0x439371)['json'](_0x3b4082);}return null;};}function patchUpdates(_0x969259){return function(_0x3f2613){try{jsonpatch[_0xe128('0x30')](_0x3f2613,_0x969259,!![]);}catch(_0x4ee682){return BPromise[_0xe128('0x31')](_0x4ee682);}return _0x3f2613[_0xe128('0x32')]();};}function saveUpdates(_0x58bff2,_0x4ff93f){return function(_0x3f46b5){if(_0x3f46b5){return _0x3f46b5[_0xe128('0x33')](_0x58bff2)[_0xe128('0x1d')](function(_0x41a094){return _0x41a094;});}return null;};}function removeEntity(_0x4698b9,_0x30ca27){return function(_0x51af31){if(_0x51af31){return _0x51af31['destroy']()[_0xe128('0x1d')](function(){_0x4698b9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d5132,_0x39817a){return function(_0x38c213){if(!_0x38c213){_0x2d5132[_0xe128('0x28')](0x194);}return _0x38c213;};}function handleError(_0x5f218a,_0x24b8c9){_0x24b8c9=_0x24b8c9||0x1f4;return function(_0x13446f){logger[_0xe128('0x23')](_0x13446f[_0xe128('0x34')]);if(_0x13446f[_0xe128('0x35')]){delete _0x13446f['name'];}_0x5f218a[_0xe128('0x29')](_0x24b8c9)[_0xe128('0x36')](_0x13446f);};}exports[_0xe128('0x37')]=function(_0x37b21e,_0x15d9fc){var _0x3bd798={},_0x431dc2={},_0x3acaab={'count':0x0,'rows':[]};var _0x1513d1=_[_0xe128('0x38')](db[_0xe128('0x39')]['rawAttributes'],function(_0x6c5617){return{'name':_0x6c5617[_0xe128('0x3a')],'type':_0x6c5617[_0xe128('0x3b')][_0xe128('0x3c')]};});_0x431dc2[_0xe128('0x3d')]=_[_0xe128('0x38')](_0x1513d1,_0xe128('0x35'));_0x431dc2[_0xe128('0x3e')]=_[_0xe128('0x3f')](_0x37b21e[_0xe128('0x3e')]);_0x431dc2['filters']=_[_0xe128('0x40')](_0x431dc2[_0xe128('0x3d')],_0x431dc2['query']);_0x3bd798[_0xe128('0x41')]=_[_0xe128('0x40')](_0x431dc2['model'],qs[_0xe128('0x42')](_0x37b21e[_0xe128('0x3e')][_0xe128('0x42')]));_0x3bd798['attributes']=_0x3bd798[_0xe128('0x41')]['length']?_0x3bd798[_0xe128('0x41')]:_0x431dc2[_0xe128('0x3d')];if(!_0x37b21e[_0xe128('0x3e')][_0xe128('0x43')]('nolimit')){_0x3bd798[_0xe128('0x2e')]=qs[_0xe128('0x2e')](_0x37b21e[_0xe128('0x3e')][_0xe128('0x2e')]);_0x3bd798['offset']=qs[_0xe128('0x2d')](_0x37b21e[_0xe128('0x3e')][_0xe128('0x2d')]);}_0x3bd798['order']=qs['sort'](_0x37b21e[_0xe128('0x3e')]['sort']);_0x3bd798[_0xe128('0x44')]=qs['filters'](_[_0xe128('0x45')](_0x37b21e[_0xe128('0x3e')],_0x431dc2['filters']),_0x1513d1);if(_0x37b21e[_0xe128('0x3e')][_0xe128('0x46')]){_0x3bd798[_0xe128('0x44')]=_[_0xe128('0x47')](_0x3bd798['where'],{'$or':_[_0xe128('0x38')](_0x1513d1,function(_0x585be7){if(_0x585be7[_0xe128('0x3b')]!==_0xe128('0x48')){var _0x330f56={};_0x330f56[_0x585be7['name']]={'$like':'%'+_0x37b21e[_0xe128('0x3e')][_0xe128('0x46')]+'%'};return _0x330f56;}})});}_0x3bd798=_[_0xe128('0x47')]({},_0x3bd798,_0x37b21e[_0xe128('0x49')]);var _0x159e96={'where':_0x3bd798[_0xe128('0x44')]};return db[_0xe128('0x39')]['count'](_0x159e96)[_0xe128('0x1d')](function(_0xdc656b){_0x3acaab[_0xe128('0x2c')]=_0xdc656b;if(_0x37b21e[_0xe128('0x3e')][_0xe128('0x4a')]){_0x3bd798[_0xe128('0x4b')]=[{'all':!![]}];}return db[_0xe128('0x39')][_0xe128('0x4c')](_0x3bd798);})[_0xe128('0x1d')](function(_0x4573d1){_0x3acaab[_0xe128('0x4d')]=_0x4573d1;return _0x3acaab;})['then'](respondWithFilteredResult(_0x15d9fc,_0x3bd798))['catch'](handleError(_0x15d9fc,null));};exports['show']=function(_0x8d353c,_0x155980){var _0x509090={'raw':![],'where':{'id':_0x8d353c[_0xe128('0x4e')]['id']}},_0x2e657b={};_0x2e657b[_0xe128('0x3d')]=_[_0xe128('0x3f')](db[_0xe128('0x39')][_0xe128('0x4f')]);_0x2e657b[_0xe128('0x3e')]=_['keys'](_0x8d353c[_0xe128('0x3e')]);_0x2e657b[_0xe128('0x50')]=_[_0xe128('0x40')](_0x2e657b[_0xe128('0x3d')],_0x2e657b[_0xe128('0x3e')]);_0x509090['attributes']=_[_0xe128('0x40')](_0x2e657b[_0xe128('0x3d')],qs[_0xe128('0x42')](_0x8d353c[_0xe128('0x3e')][_0xe128('0x42')]));_0x509090[_0xe128('0x41')]=_0x509090[_0xe128('0x41')][_0xe128('0x51')]?_0x509090['attributes']:_0x2e657b[_0xe128('0x3d')];if(_0x8d353c[_0xe128('0x3e')][_0xe128('0x4a')]){_0x509090['include']=[{'all':!![]}];}_0x509090=_[_0xe128('0x47')]({},_0x509090,_0x8d353c[_0xe128('0x49')]);return db[_0xe128('0x39')][_0xe128('0x52')](_0x509090)[_0xe128('0x1d')](handleEntityNotFound(_0x155980,null))['then'](respondWithResult(_0x155980,null))[_0xe128('0x27')](handleError(_0x155980,null));};exports[_0xe128('0x53')]=function(_0x38bbf9,_0x3e7713){return db[_0xe128('0x39')][_0xe128('0x53')](_0x38bbf9[_0xe128('0x54')],{})[_0xe128('0x1d')](respondWithResult(_0x3e7713,0xc9))[_0xe128('0x27')](handleError(_0x3e7713,null));};exports[_0xe128('0x33')]=function(_0x30000a,_0x27c8d1){if(_0x30000a[_0xe128('0x54')]['id']){delete _0x30000a[_0xe128('0x54')]['id'];}return db[_0xe128('0x39')][_0xe128('0x52')]({'where':{'id':_0x30000a[_0xe128('0x4e')]['id']}})['then'](handleEntityNotFound(_0x27c8d1,null))[_0xe128('0x1d')](saveUpdates(_0x30000a[_0xe128('0x54')],null))[_0xe128('0x1d')](respondWithResult(_0x27c8d1,null))[_0xe128('0x27')](handleError(_0x27c8d1,null));};exports[_0xe128('0x55')]=function(_0x55326d,_0x376e9b){return db[_0xe128('0x39')]['find']({'where':{'id':_0x55326d[_0xe128('0x4e')]['id']}})['then'](handleEntityNotFound(_0x376e9b,null))[_0xe128('0x1d')](removeEntity(_0x376e9b,null))[_0xe128('0x27')](handleError(_0x376e9b,null));};exports[_0xe128('0x56')]=function(_0x28b8d7,_0x2c8a2b,_0xd9af18){var _0x1a8fc1={};var _0x58cc7d={};var _0x3de095;var _0x1735f9;return db['ZendeskAccount'][_0xe128('0x57')]({'where':{'id':_0x28b8d7[_0xe128('0x4e')]['id']}})[_0xe128('0x1d')](handleEntityNotFound(_0x2c8a2b,null))[_0xe128('0x1d')](function(_0xa8f363){if(_0xa8f363){_0x3de095=_0xa8f363;_0x58cc7d[_0xe128('0x3d')]=_[_0xe128('0x3f')](db['ZendeskConfiguration'][_0xe128('0x4f')]);_0x58cc7d['query']=_[_0xe128('0x3f')](_0x28b8d7[_0xe128('0x3e')]);_0x58cc7d[_0xe128('0x50')]=_['intersection'](_0x58cc7d[_0xe128('0x3d')],_0x58cc7d['query']);_0x1a8fc1[_0xe128('0x41')]=_[_0xe128('0x40')](_0x58cc7d[_0xe128('0x3d')],qs[_0xe128('0x42')](_0x28b8d7[_0xe128('0x3e')][_0xe128('0x42')]));_0x1a8fc1[_0xe128('0x41')]=_0x1a8fc1['attributes'][_0xe128('0x51')]?_0x1a8fc1[_0xe128('0x41')]:_0x58cc7d['model'];_0x1a8fc1[_0xe128('0x58')]=qs[_0xe128('0x59')](_0x28b8d7[_0xe128('0x3e')][_0xe128('0x59')]);_0x1a8fc1[_0xe128('0x44')]=qs[_0xe128('0x50')](_[_0xe128('0x45')](_0x28b8d7[_0xe128('0x3e')],_0x58cc7d[_0xe128('0x50')]));if(_0x28b8d7['query']['filter']){_0x1a8fc1['where']=_[_0xe128('0x47')](_0x1a8fc1[_0xe128('0x44')],{'$or':_[_0xe128('0x38')](_0x1a8fc1[_0xe128('0x41')],function(_0x38c1b7){var _0x5e0d72={};_0x5e0d72[_0x38c1b7]={'$like':'%'+_0x28b8d7[_0xe128('0x3e')][_0xe128('0x46')]+'%'};return _0x5e0d72;})});}_0x1a8fc1=_['merge']({},_0x1a8fc1,_0x28b8d7[_0xe128('0x49')]);return _0x3de095[_0xe128('0x56')](_0x1a8fc1);}})[_0xe128('0x1d')](function(_0x56ac93){if(_0x56ac93){_0x1735f9=_0x56ac93[_0xe128('0x51')];if(!_0x28b8d7[_0xe128('0x3e')]['hasOwnProperty']('nolimit')){_0x1a8fc1['limit']=qs['limit'](_0x28b8d7['query']['limit']);_0x1a8fc1[_0xe128('0x2d')]=qs['offset'](_0x28b8d7[_0xe128('0x3e')][_0xe128('0x2d')]);}return _0x3de095['getConfigurations'](_0x1a8fc1);}})['then'](function(_0x2c8ced){if(_0x2c8ced){return _0x2c8ced?{'count':_0x1735f9,'rows':_0x2c8ced}:null;}})[_0xe128('0x1d')](respondWithResult(_0x2c8a2b,null))[_0xe128('0x27')](handleError(_0x2c8a2b,null));};exports[_0xe128('0x5a')]=function(_0x8c4e01,_0x135466,_0x2f6f1e){if(_0x8c4e01['body']['id']){delete _0x8c4e01[_0xe128('0x54')]['id'];}return db[_0xe128('0x39')][_0xe128('0x57')]({'where':{'id':_0x8c4e01[_0xe128('0x4e')]['id']}})[_0xe128('0x1d')](handleEntityNotFound(_0x135466,null))[_0xe128('0x1d')](function(_0x4dcfe6){if(_0x4dcfe6){_0x8c4e01[_0xe128('0x54')][_0xe128('0x5b')]=_0x4dcfe6['id'];_0x8c4e01['body'][_0xe128('0x5c')]=integrations[_0xe128('0x5d')](_0x8c4e01[_0xe128('0x54')]['channel'],_0x8c4e01[_0xe128('0x54')]['type']);_0x8c4e01['body'][_0xe128('0x5e')]=integrations['getDescriptions'](_0x8c4e01['body'][_0xe128('0x5f')],_0x8c4e01[_0xe128('0x54')]['type']);return db[_0xe128('0x60')][_0xe128('0x53')](_0x8c4e01['body'],{'include':[{'model':db['ZendeskField'],'as':_0xe128('0x5c')},{'model':db['ZendeskField'],'as':_0xe128('0x5e')}]});}return null;})[_0xe128('0x1d')](respondWithResult(_0x135466,null))[_0xe128('0x27')](handleError(_0x135466,null));};exports['getFields']=function(_0x473895,_0x10d736,_0x45a294){var _0x50acba='';return db[_0xe128('0x39')][_0xe128('0x57')]({'where':{'id':_0x473895[_0xe128('0x4e')]['id']},'attributes':['id',_0xe128('0x61'),'password',_0xe128('0x62'),_0xe128('0x63'),'remoteUri']})['then'](handleEntityNotFound(_0x10d736,null))[_0xe128('0x1d')](function(_0x5e8ddc){if(_0x5e8ddc){_0x50acba=_0x5e8ddc[_0xe128('0x64')];var _0x5220ea=_0x50acba[_0xe128('0x65')](-0x1);if(_0x5220ea==='/'){_0x50acba=_0x50acba[_0xe128('0x66')](0x0,_0x50acba[_0xe128('0x67')](_0x5220ea));}var _0x379a23={'method':_0xe128('0x68'),'uri':util['format'](_0xe128('0x69'),_0x50acba,_0xe128('0x6a')),'json':!![]};switch(_0x5e8ddc[_0xe128('0x63')]){case _0xe128('0x6b'):_0x379a23['headers']={'Authorization':util['format'](_0xe128('0x6c'),new Buffer(util['format'](_0xe128('0x6d'),_0x5e8ddc[_0xe128('0x61')],_0x5e8ddc[_0xe128('0x6b')]))[_0xe128('0x6e')]('base64'))};break;case _0xe128('0x62'):_0x379a23[_0xe128('0x6f')]={'Authorization':util[_0xe128('0x70')]('Basic\x20%s',new Buffer(util[_0xe128('0x70')]('%s/token:%s',_0x5e8ddc[_0xe128('0x61')],_0x5e8ddc['token']))[_0xe128('0x6e')](_0xe128('0x71')))};break;default:throw new db[(_0xe128('0x19'))]['ValidationError'](_0xe128('0x72'));}return rp(_0x379a23);}})[_0xe128('0x1d')](function(_0x4746e9){if(_0x4746e9){var _0x3e4241=[_0xe128('0x73'),_0xe128('0x74'),_0xe128('0x75'),_0xe128('0x76')];_[_0xe128('0x77')](_0x4746e9[_0xe128('0x6a')],function(_0x37086f){return _0x3e4241['includes'](_0x37086f[_0xe128('0x3b')]);});return{'count':_0x4746e9['ticket_fields'][_0xe128('0x51')],'rows':_[_0xe128('0x38')](_0x4746e9['ticket_fields'],function(_0x33732f){return{'id':_0x33732f['id'],'name':_0x33732f[_0xe128('0x78')]>0x7?_0x33732f[_0xe128('0x79')]:_0x33732f[_0xe128('0x3b')],'custom':_0x33732f[_0xe128('0x78')]>0x7?!![]:![],'options':_0x33732f[_0xe128('0x7a')]?_0x33732f[_0xe128('0x7a')]:_0x33732f[_0xe128('0x7b')]?_0x33732f['custom_field_options']:[]};})};}})[_0xe128('0x1d')](respondWithResult(_0x10d736,null))[_0xe128('0x27')](function(_0x2daa56){var _0x2da069=_0x473895['query'][_0xe128('0x18')]?0x1f4:_0x2daa56[_0xe128('0x7c')]||0x1f4;logger[_0xe128('0x23')](_0xe128('0x7d'),'getFields',_0x2da069,JSON[_0xe128('0x7e')](_0x2daa56));delete _0x2daa56[_0xe128('0x35')];if(_0x2da069===0x191){_0x2da069=0x190;}_0x10d736[_0xe128('0x29')](_0x2da069)[_0xe128('0x36')](_0x473895[_0xe128('0x3e')][_0xe128('0x18')]?{'message':_0xe128('0x7f'),'statusCode':_0x2daa56[_0xe128('0x7c')]}:_0x2daa56);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index ac8183c..3e66c96 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 _0xe9b9=['int_zendesk_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount'];(function(_0x368587,_0x1b6554){var _0x42d33c=function(_0xfdccf){while(--_0xfdccf){_0x368587['push'](_0x368587['shift']());}};_0x42d33c(++_0x1b6554);}(_0xe9b9,0x83));var _0x9e9b=function(_0x4a0174,_0x527af9){_0x4a0174=_0x4a0174-0x0;var _0x116e55=_0xe9b9[_0x4a0174];return _0x116e55;};'use strict';var _=require('lodash');var util=require(_0x9e9b('0x0'));var logger=require(_0x9e9b('0x1'))(_0x9e9b('0x2'));var moment=require(_0x9e9b('0x3'));var BPromise=require(_0x9e9b('0x4'));var rp=require(_0x9e9b('0x5'));var fs=require('fs');var path=require(_0x9e9b('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9e9b('0x7'));var integrations=require(_0x9e9b('0x8'));module[_0x9e9b('0x9')]=function(_0x349592,_0x2b42cb){return _0x349592[_0x9e9b('0xa')](_0x9e9b('0xb'),attributes,{'tableName':_0x9e9b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc36a=['define','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x115423,_0x4a65a5){var _0x2262f7=function(_0x4cb6d1){while(--_0x4cb6d1){_0x115423['push'](_0x115423['shift']());}};_0x2262f7(++_0x4a65a5);}(_0xc36a,0x1e7));var _0xac36=function(_0x4cbc30,_0x4a1fe8){_0x4cbc30=_0x4cbc30-0x0;var _0x569e0a=_0xc36a[_0x4cbc30];return _0x569e0a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xac36('0x0'))(_0xac36('0x1'));var moment=require(_0xac36('0x2'));var BPromise=require(_0xac36('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xac36('0x4'));var config=require(_0xac36('0x5'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0xac36('0x6'));module[_0xac36('0x7')]=function(_0x2361f4,_0x888ded){return _0x2361f4[_0xac36('0x8')]('ZendeskAccount',attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 6a57a85..2693648 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.rpc.js +++ b/server/api/intZendeskAccount/intZendeskAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['code','error','message','result','catch','ZendeskAccount','findAll','options','raw','where','attributes','include','map','model','GetZendeskAccount','stringify','ShowZendeskAccount','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x1db251,_0xf0443d){var _0x56685a=function(_0x6ec6b7){while(--_0x6ec6b7){_0x1db251['push'](_0x1db251['shift']());}};_0x56685a(++_0xf0443d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetZendeskAccount']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowZendeskAccount',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xd8b0=['raw','where','include','map','model','attributes','ShowZendeskAccount','find','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount','options'];(function(_0x4a11a9,_0x292eb6){var _0x3b2e98=function(_0x69aa35){while(--_0x69aa35){_0x4a11a9['push'](_0x4a11a9['shift']());}};_0x3b2e98(++_0x292eb6);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});}exports[_0x0d8b('0x16')]=function(_0x5fecbd){var _0x333674=this;return new Promise(function(_0x18dd2d,_0x264b39){return db[_0x0d8b('0x17')]['findAll']({'raw':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')][_0x0d8b('0x19')]===undefined?!![]:![]:!![],'where':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')][_0x0d8b('0x1a')]||null:null,'attributes':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')]['attributes']||null:null,'limit':_0x5fecbd['options']?_0x5fecbd[_0x0d8b('0x18')]['limit']||null:null,'include':_0x5fecbd['options']?_0x5fecbd['options'][_0x0d8b('0x1b')]?_[_0x0d8b('0x1c')](_0x5fecbd[_0x0d8b('0x18')][_0x0d8b('0x1b')],function(_0x221071){return{'model':db[_0x221071[_0x0d8b('0x1d')]],'as':_0x221071['as'],'attributes':_0x221071[_0x0d8b('0x1e')],'include':_0x221071[_0x0d8b('0x1b')]?_[_0x0d8b('0x1c')](_0x221071['include'],function(_0xe8bbee){return{'model':db[_0xe8bbee[_0x0d8b('0x1d')]],'as':_0xe8bbee['as'],'attributes':_0xe8bbee['attributes'],'include':_0xe8bbee[_0x0d8b('0x1b')]?_['map'](_0xe8bbee[_0x0d8b('0x1b')],function(_0x234bdd){return{'model':db[_0x234bdd[_0x0d8b('0x1d')]],'as':_0x234bdd['as'],'attributes':_0x234bdd['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x28f639){logger[_0x0d8b('0xb')]('GetZendeskAccount',_0x5fecbd);logger[_0x0d8b('0xe')]('GetZendeskAccount',_0x5fecbd,JSON[_0x0d8b('0x10')](_0x28f639));_0x18dd2d(_0x28f639);})['catch'](function(_0x97050a){logger['error'](_0x0d8b('0x16'),_0x97050a['message'],_0x5fecbd);_0x264b39(_0x333674[_0x0d8b('0x11')](0x1f4,_0x97050a['message']));});});};exports[_0x0d8b('0x1f')]=function(_0x106e4c){var _0x2c058d=this;return new Promise(function(_0x56120a,_0x4c80a2){return db['ZendeskAccount'][_0x0d8b('0x20')]({'raw':_0x106e4c['options']?_0x106e4c[_0x0d8b('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x106e4c['options']?_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1a')]||null:null,'attributes':_0x106e4c[_0x0d8b('0x18')]?_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1e')]||null:null,'include':_0x106e4c[_0x0d8b('0x18')]?_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1b')]?_['map'](_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1b')],function(_0x4b3ea0){return{'model':db[_0x4b3ea0[_0x0d8b('0x1d')]],'as':_0x4b3ea0['as'],'attributes':_0x4b3ea0[_0x0d8b('0x1e')],'include':_0x4b3ea0[_0x0d8b('0x1b')]?_['map'](_0x4b3ea0[_0x0d8b('0x1b')],function(_0x2c507e){return{'model':db[_0x2c507e[_0x0d8b('0x1d')]],'as':_0x2c507e['as'],'attributes':_0x2c507e[_0x0d8b('0x1e')],'include':_0x2c507e[_0x0d8b('0x1b')]?_['map'](_0x2c507e[_0x0d8b('0x1b')],function(_0x1649fc){return{'model':db[_0x1649fc['model']],'as':_0x1649fc['as'],'attributes':_0x1649fc[_0x0d8b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0d8b('0xa')](function(_0x188af2){logger[_0x0d8b('0xb')](_0x0d8b('0x1f'),_0x106e4c);logger['debug']('ShowZendeskAccount',_0x106e4c,JSON[_0x0d8b('0x10')](_0x188af2));_0x56120a(_0x188af2);})['catch'](function(_0x531c55){logger[_0x0d8b('0x11')](_0x0d8b('0x1f'),_0x531c55[_0x0d8b('0x13')],_0x106e4c);_0x4c80a2(_0x2c058d[_0x0d8b('0x11')](0x1f4,_0x531c55[_0x0d8b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 67616b3..25a1cb2 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 _0x574e=['/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','show','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','/:id/tags','setTags'];(function(_0xc59496,_0x50364c){var _0x19917d=function(_0x534b19){while(--_0x534b19){_0xc59496['push'](_0xc59496['shift']());}};_0x19917d(++_0x50364c);}(_0x574e,0x130));var _0xe574=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x574e[_0x17b6e3];return _0x3906f3;};'use strict';var multer=require(_0xe574('0x0'));var util=require(_0xe574('0x1'));var path=require(_0xe574('0x2'));var timeout=require(_0xe574('0x3'));var express=require(_0xe574('0x4'));var router=express[_0xe574('0x5')]();var auth=require(_0xe574('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe574('0x7'));var controller=require(_0xe574('0x8'));router[_0xe574('0x9')]('/',auth[_0xe574('0xa')](),controller[_0xe574('0xb')]);router[_0xe574('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe574('0xc')]);router[_0xe574('0x9')]('/:id/fields',auth[_0xe574('0xa')](),controller[_0xe574('0xd')]);router['get'](_0xe574('0xe'),auth[_0xe574('0xa')](),controller['getSubjects']);router[_0xe574('0x9')](_0xe574('0xf'),auth[_0xe574('0xa')](),controller[_0xe574('0x10')]);router['get']('/:id/tags',auth[_0xe574('0xa')](),controller['getTags']);router[_0xe574('0x11')]('/',auth[_0xe574('0xa')](),controller[_0xe574('0x12')]);router[_0xe574('0x11')](_0xe574('0x13'),auth[_0xe574('0xa')](),controller[_0xe574('0x14')]);router['put'](_0xe574('0x15'),auth[_0xe574('0xa')](),controller[_0xe574('0x16')]);router['delete'](_0xe574('0x15'),auth[_0xe574('0xa')](),controller[_0xe574('0x17')]);module[_0xe574('0x18')]=router; \ No newline at end of file +var _0xd51f=['./intZendeskConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','/:id/tags','setTags','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xd51f,0x179));var _0xfd51=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xd51f[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0xfd51('0x0'));var util=require(_0xfd51('0x1'));var path=require(_0xfd51('0x2'));var timeout=require(_0xfd51('0x3'));var express=require('express');var router=express[_0xfd51('0x4')]();var auth=require(_0xfd51('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfd51('0x6'));var controller=require(_0xfd51('0x7'));router[_0xfd51('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xfd51('0x9'),auth[_0xfd51('0xa')](),controller[_0xfd51('0xb')]);router[_0xfd51('0x8')](_0xfd51('0xc'),auth[_0xfd51('0xa')](),controller[_0xfd51('0xd')]);router[_0xfd51('0x8')](_0xfd51('0xe'),auth['isAuthenticated'](),controller[_0xfd51('0xf')]);router[_0xfd51('0x8')](_0xfd51('0x10'),auth[_0xfd51('0xa')](),controller['getDescriptions']);router[_0xfd51('0x8')]('/:id/tags',auth[_0xfd51('0xa')](),controller['getTags']);router[_0xfd51('0x11')]('/',auth[_0xfd51('0xa')](),controller[_0xfd51('0x12')]);router['post'](_0xfd51('0x13'),auth['isAuthenticated'](),controller[_0xfd51('0x14')]);router['put']('/:id',auth[_0xfd51('0xa')](),controller[_0xfd51('0x15')]);router['delete'](_0xfd51('0x9'),auth[_0xfd51('0xa')](),controller[_0xfd51('0x16')]);module[_0xfd51('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 db27753..159fc1b 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 _0xc5a8=['STRING','exports'];(function(_0x3742bb,_0x2ab08c){var _0x5d91e1=function(_0x84c06b){while(--_0x84c06b){_0x3742bb['push'](_0x3742bb['shift']());}};_0x5d91e1(++_0x2ab08c);}(_0xc5a8,0x12f));var _0x8c5a=function(_0x23ad5d,_0x3047c5){_0x23ad5d=_0x23ad5d-0x0;var _0x51eda1=_0xc5a8[_0x23ad5d];return _0x51eda1;};'use strict';var Sequelize=require('sequelize');module[_0x8c5a('0x0')]={'name':{'type':Sequelize[_0x8c5a('0x1')]},'description':{'type':Sequelize[_0x8c5a('0x1')]}}; \ No newline at end of file +var _0xa4de=['exports','STRING','sequelize'];(function(_0x562493,_0x154116){var _0x23540a=function(_0x6938ac){while(--_0x6938ac){_0x562493['push'](_0x562493['shift']());}};_0x23540a(++_0x154116);}(_0xa4de,0xe0));var _0xea4d=function(_0x281dc2,_0x17f49b){_0x281dc2=_0x281dc2-0x0;var _0x5b3401=_0xa4de[_0x281dc2];return _0x5b3401;};'use strict';var Sequelize=require(_0xea4d('0x0'));module[_0xea4d('0x1')]={'name':{'type':Sequelize[_0xea4d('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index a7ebbbb..a5370b3 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 _0xfd32=['name','send','index','map','ZendeskConfiguration','fieldName','type','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','count','findAll','rows','show','params','rawAttributes','intersection','include','create','body','find','getFields','findOne','ZendeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','request','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','status','end','offset','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus'];(function(_0x162780,_0x47f2e2){var _0x1ea2dc=function(_0x123898){while(--_0x123898){_0x162780['push'](_0x162780['shift']());}};_0x1ea2dc(++_0x47f2e2);}(_0xfd32,0xe9));var _0x2fd3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd32[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x2fd3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2fd3('0x1'));var zipdir=require(_0x2fd3('0x2'));var jsonpatch=require(_0x2fd3('0x3'));var rp=require('request-promise');var moment=require(_0x2fd3('0x4'));var BPromise=require(_0x2fd3('0x5'));var Mustache=require(_0x2fd3('0x6'));var util=require(_0x2fd3('0x7'));var path=require(_0x2fd3('0x8'));var sox=require('sox');var csv=require(_0x2fd3('0x9'));var ejs=require(_0x2fd3('0xa'));var fs=require('fs');var _=require(_0x2fd3('0xb'));var squel=require(_0x2fd3('0xc'));var crypto=require('crypto');var jsforce=require(_0x2fd3('0xd'));var deskjs=require(_0x2fd3('0xe'));var toCsv=require(_0x2fd3('0x9'));var querystring=require(_0x2fd3('0xf'));var Papa=require(_0x2fd3('0x10'));var Redis=require(_0x2fd3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2fd3('0x12'));var as=require(_0x2fd3('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2fd3('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x2fd3('0x15'));var db=require(_0x2fd3('0x16'))['db'];var jayson=require(_0x2fd3('0x17'));var client=jayson[_0x2fd3('0x18')][_0x2fd3('0x19')]({'port':0x232a});function checkPasswordPattern(_0x5c4d8d,_0x4f9b77,_0x3c5879){if(_0x3c5879){var _0x1d762c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1d762c[_0x2fd3('0x1a')](_0x4f9b77)){return _0x5c4d8d;}else{throw new db[(_0x2fd3('0x1b'))][(_0x2fd3('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 _0x5c4d8d;}}function respondWithRpcPromise(_0x4596f5,_0x33bc61,_0x5c5e8d,_0x5b75ae){return new BPromise(function(_0x7d6212,_0x28ab41){var _0x132e4e=_0x5b75ae||client;return _0x132e4e[_0x2fd3('0x1d')](_0x4596f5,_0x5c5e8d)['then'](function(_0x367929){logger['info'](_0x2fd3('0x1e'),_0x33bc61,_0x2fd3('0x1f'));logger[_0x2fd3('0x20')](_0x2fd3('0x21'),_0x33bc61,_0x2fd3('0x1f'),JSON['stringify'](_0x367929));if(_0x367929[_0x2fd3('0x22')]){if(_0x367929[_0x2fd3('0x22')][_0x2fd3('0x23')]===0x1f4){logger[_0x2fd3('0x22')](_0x2fd3('0x1e'),_0x33bc61,_0x367929['error'][_0x2fd3('0x24')]);return _0x28ab41(_0x367929[_0x2fd3('0x22')][_0x2fd3('0x24')]);}logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x33bc61,_0x367929[_0x2fd3('0x22')]['message']);return _0x7d6212(_0x367929[_0x2fd3('0x22')][_0x2fd3('0x24')]);}else{logger[_0x2fd3('0x25')](_0x2fd3('0x1e'),_0x33bc61,_0x2fd3('0x1f'));_0x7d6212(_0x367929[_0x2fd3('0x26')][_0x2fd3('0x24')]);}})[_0x2fd3('0x27')](function(_0x36b07f){logger[_0x2fd3('0x22')](_0x2fd3('0x1e'),_0x33bc61,_0x36b07f);_0x28ab41(_0x36b07f);});});}function respondWithStatusCode(_0x472ed0,_0xd6e3af){_0xd6e3af=_0xd6e3af||0xcc;return function(_0x3512e5){if(_0x3512e5){return _0x472ed0['sendStatus'](_0xd6e3af);}return _0x472ed0[_0x2fd3('0x28')](_0xd6e3af)[_0x2fd3('0x29')]();};}function respondWithResult(_0x345bbb,_0xfc597c){_0xfc597c=_0xfc597c||0xc8;return function(_0x483a97){if(_0x483a97){return _0x345bbb[_0x2fd3('0x28')](_0xfc597c)['json'](_0x483a97);}};}function respondWithFilteredResult(_0x3799f5,_0x46bca1){return function(_0xdf7546){if(_0xdf7546){var _0x26b6be=_0xdf7546['count'],_0x352ff8=_0x46bca1[_0x2fd3('0x2a')],_0x217b28=_0x46bca1[_0x2fd3('0x2a')]+_0x46bca1[_0x2fd3('0x2b')],_0x13b373;if(_0x217b28>=_0x26b6be){_0x217b28=_0x26b6be;_0x13b373=0xc8;}else{_0x13b373=0xce;}_0x3799f5['status'](_0x13b373);return _0x3799f5[_0x2fd3('0x2c')](_0x2fd3('0x2d'),_0x352ff8+'-'+_0x217b28+'/'+_0x26b6be)['json'](_0xdf7546);}return null;};}function patchUpdates(_0x5988ec){return function(_0x214b18){try{jsonpatch[_0x2fd3('0x2e')](_0x214b18,_0x5988ec,!![]);}catch(_0x35cec4){return BPromise['reject'](_0x35cec4);}return _0x214b18[_0x2fd3('0x2f')]();};}function saveUpdates(_0x5eb6c0,_0x169cbc){return function(_0x1bba42){if(_0x1bba42){return _0x1bba42[_0x2fd3('0x30')](_0x5eb6c0)[_0x2fd3('0x31')](function(_0x458373){return _0x458373;});}return null;};}function removeEntity(_0x515162,_0x2c933d){return function(_0x4466fb){if(_0x4466fb){return _0x4466fb[_0x2fd3('0x32')]()[_0x2fd3('0x31')](function(){_0x515162['status'](0xcc)[_0x2fd3('0x29')]();});}};}function handleEntityNotFound(_0x482988,_0x4b9c25){return function(_0x264170){if(!_0x264170){_0x482988[_0x2fd3('0x33')](0x194);}return _0x264170;};}function handleError(_0x21687f,_0x476562){_0x476562=_0x476562||0x1f4;return function(_0x2d8084){logger[_0x2fd3('0x22')](_0x2d8084['stack']);if(_0x2d8084[_0x2fd3('0x34')]){delete _0x2d8084['name'];}_0x21687f[_0x2fd3('0x28')](_0x476562)[_0x2fd3('0x35')](_0x2d8084);};}exports[_0x2fd3('0x36')]=function(_0x3e2976,_0xf9d194){var _0x1ba550={},_0x22094d={},_0x1a66f2={'count':0x0,'rows':[]};var _0x34bcff=_[_0x2fd3('0x37')](db[_0x2fd3('0x38')]['rawAttributes'],function(_0xb46a58){return{'name':_0xb46a58[_0x2fd3('0x39')],'type':_0xb46a58[_0x2fd3('0x3a')]['key']};});_0x22094d[_0x2fd3('0x3b')]=_[_0x2fd3('0x37')](_0x34bcff,_0x2fd3('0x34'));_0x22094d[_0x2fd3('0x3c')]=_[_0x2fd3('0x3d')](_0x3e2976[_0x2fd3('0x3c')]);_0x22094d[_0x2fd3('0x3e')]=_['intersection'](_0x22094d['model'],_0x22094d[_0x2fd3('0x3c')]);_0x1ba550['attributes']=_['intersection'](_0x22094d[_0x2fd3('0x3b')],qs[_0x2fd3('0x3f')](_0x3e2976['query'][_0x2fd3('0x3f')]));_0x1ba550[_0x2fd3('0x40')]=_0x1ba550[_0x2fd3('0x40')][_0x2fd3('0x41')]?_0x1ba550[_0x2fd3('0x40')]:_0x22094d[_0x2fd3('0x3b')];if(!_0x3e2976[_0x2fd3('0x3c')][_0x2fd3('0x42')](_0x2fd3('0x43'))){_0x1ba550[_0x2fd3('0x2b')]=qs[_0x2fd3('0x2b')](_0x3e2976['query']['limit']);_0x1ba550[_0x2fd3('0x2a')]=qs[_0x2fd3('0x2a')](_0x3e2976[_0x2fd3('0x3c')][_0x2fd3('0x2a')]);}_0x1ba550[_0x2fd3('0x44')]=qs[_0x2fd3('0x45')](_0x3e2976[_0x2fd3('0x3c')][_0x2fd3('0x45')]);_0x1ba550['where']=qs[_0x2fd3('0x3e')](_[_0x2fd3('0x46')](_0x3e2976[_0x2fd3('0x3c')],_0x22094d['filters']),_0x34bcff);if(_0x3e2976[_0x2fd3('0x3c')][_0x2fd3('0x47')]){_0x1ba550[_0x2fd3('0x48')]=_[_0x2fd3('0x49')](_0x1ba550[_0x2fd3('0x48')],{'$or':_[_0x2fd3('0x37')](_0x34bcff,function(_0x2f0dc1){if(_0x2f0dc1[_0x2fd3('0x3a')]!=='VIRTUAL'){var _0x5c96f6={};_0x5c96f6[_0x2f0dc1[_0x2fd3('0x34')]]={'$like':'%'+_0x3e2976[_0x2fd3('0x3c')][_0x2fd3('0x47')]+'%'};return _0x5c96f6;}})});}_0x1ba550=_[_0x2fd3('0x49')]({},_0x1ba550,_0x3e2976[_0x2fd3('0x4a')]);var _0x26766a={'where':_0x1ba550[_0x2fd3('0x48')]};return db[_0x2fd3('0x38')]['count'](_0x26766a)[_0x2fd3('0x31')](function(_0x44be34){_0x1a66f2[_0x2fd3('0x4b')]=_0x44be34;if(_0x3e2976[_0x2fd3('0x3c')]['includeAll']){_0x1ba550['include']=[{'all':!![]}];}return db[_0x2fd3('0x38')][_0x2fd3('0x4c')](_0x1ba550);})[_0x2fd3('0x31')](function(_0x2b52fc){_0x1a66f2[_0x2fd3('0x4d')]=_0x2b52fc;return _0x1a66f2;})[_0x2fd3('0x31')](respondWithFilteredResult(_0xf9d194,_0x1ba550))['catch'](handleError(_0xf9d194,null));};exports[_0x2fd3('0x4e')]=function(_0x5026e8,_0xcc63cd){var _0x403f8f={'raw':![],'where':{'id':_0x5026e8[_0x2fd3('0x4f')]['id']}},_0x308844={};_0x308844['model']=_[_0x2fd3('0x3d')](db[_0x2fd3('0x38')][_0x2fd3('0x50')]);_0x308844[_0x2fd3('0x3c')]=_[_0x2fd3('0x3d')](_0x5026e8['query']);_0x308844[_0x2fd3('0x3e')]=_['intersection'](_0x308844[_0x2fd3('0x3b')],_0x308844[_0x2fd3('0x3c')]);_0x403f8f[_0x2fd3('0x40')]=_[_0x2fd3('0x51')](_0x308844[_0x2fd3('0x3b')],qs[_0x2fd3('0x3f')](_0x5026e8[_0x2fd3('0x3c')][_0x2fd3('0x3f')]));_0x403f8f[_0x2fd3('0x40')]=_0x403f8f[_0x2fd3('0x40')][_0x2fd3('0x41')]?_0x403f8f['attributes']:_0x308844[_0x2fd3('0x3b')];if(_0x5026e8[_0x2fd3('0x3c')]['includeAll']){_0x403f8f[_0x2fd3('0x52')]=[{'all':!![]}];}_0x403f8f=_['merge']({},_0x403f8f,_0x5026e8[_0x2fd3('0x4a')]);return db[_0x2fd3('0x38')]['find'](_0x403f8f)['then'](handleEntityNotFound(_0xcc63cd,null))[_0x2fd3('0x31')](respondWithResult(_0xcc63cd,null))['catch'](handleError(_0xcc63cd,null));};exports[_0x2fd3('0x53')]=function(_0x2b1093,_0x46d163){return db['ZendeskConfiguration']['create'](_0x2b1093[_0x2fd3('0x54')],{})[_0x2fd3('0x31')](respondWithResult(_0x46d163,0xc9))[_0x2fd3('0x27')](handleError(_0x46d163,null));};exports[_0x2fd3('0x30')]=function(_0xe145d4,_0x35d6b7){if(_0xe145d4['body']['id']){delete _0xe145d4[_0x2fd3('0x54')]['id'];}return db[_0x2fd3('0x38')][_0x2fd3('0x55')]({'where':{'id':_0xe145d4[_0x2fd3('0x4f')]['id']}})[_0x2fd3('0x31')](handleEntityNotFound(_0x35d6b7,null))[_0x2fd3('0x31')](saveUpdates(_0xe145d4[_0x2fd3('0x54')],null))['then'](respondWithResult(_0x35d6b7,null))[_0x2fd3('0x27')](handleError(_0x35d6b7,null));};exports[_0x2fd3('0x32')]=function(_0x5f4c35,_0x1c279f){return db['ZendeskConfiguration'][_0x2fd3('0x55')]({'where':{'id':_0x5f4c35[_0x2fd3('0x4f')]['id']}})[_0x2fd3('0x31')](handleEntityNotFound(_0x1c279f,null))['then'](removeEntity(_0x1c279f,null))['catch'](handleError(_0x1c279f,null));};exports[_0x2fd3('0x56')]=function(_0xedf9a9,_0x138095,_0x4e0e21){var _0x5bbbe2={};var _0x272b86={};var _0x348e00;var _0x3f95fd;return db[_0x2fd3('0x38')][_0x2fd3('0x57')]({'where':{'id':_0xedf9a9['params']['id']}})[_0x2fd3('0x31')](handleEntityNotFound(_0x138095,null))[_0x2fd3('0x31')](function(_0x3f351d){if(_0x3f351d){_0x348e00=_0x3f351d;_0x272b86[_0x2fd3('0x3b')]=_[_0x2fd3('0x3d')](db[_0x2fd3('0x58')][_0x2fd3('0x50')]);_0x272b86['query']=_[_0x2fd3('0x3d')](_0xedf9a9[_0x2fd3('0x3c')]);_0x272b86[_0x2fd3('0x3e')]=_[_0x2fd3('0x51')](_0x272b86[_0x2fd3('0x3b')],_0x272b86[_0x2fd3('0x3c')]);_0x5bbbe2['attributes']=_['intersection'](_0x272b86['model'],qs[_0x2fd3('0x3f')](_0xedf9a9[_0x2fd3('0x3c')][_0x2fd3('0x3f')]));_0x5bbbe2[_0x2fd3('0x40')]=_0x5bbbe2[_0x2fd3('0x40')][_0x2fd3('0x41')]?_0x5bbbe2['attributes']:_0x272b86[_0x2fd3('0x3b')];_0x5bbbe2[_0x2fd3('0x44')]=qs[_0x2fd3('0x45')](_0xedf9a9[_0x2fd3('0x3c')][_0x2fd3('0x45')]);_0x5bbbe2[_0x2fd3('0x48')]=qs['filters'](_[_0x2fd3('0x46')](_0xedf9a9['query'],_0x272b86[_0x2fd3('0x3e')]));if(_0xedf9a9[_0x2fd3('0x3c')]['filter']){_0x5bbbe2[_0x2fd3('0x48')]=_['merge'](_0x5bbbe2['where'],{'$or':_[_0x2fd3('0x37')](_0x5bbbe2['attributes'],function(_0x21380e){var _0x470cf7={};_0x470cf7[_0x21380e]={'$like':'%'+_0xedf9a9[_0x2fd3('0x3c')][_0x2fd3('0x47')]+'%'};return _0x470cf7;})});}_0x5bbbe2=_[_0x2fd3('0x49')]({},_0x5bbbe2,_0xedf9a9[_0x2fd3('0x4a')]);return _0x348e00[_0x2fd3('0x56')](_0x5bbbe2);}})[_0x2fd3('0x31')](function(_0x3abdcd){if(_0x3abdcd){_0x3f95fd=_0x3abdcd[_0x2fd3('0x41')];if(!_0xedf9a9[_0x2fd3('0x3c')]['hasOwnProperty'](_0x2fd3('0x43'))){_0x5bbbe2[_0x2fd3('0x2b')]=qs[_0x2fd3('0x2b')](_0xedf9a9['query'][_0x2fd3('0x2b')]);_0x5bbbe2[_0x2fd3('0x2a')]=qs['offset'](_0xedf9a9[_0x2fd3('0x3c')][_0x2fd3('0x2a')]);}return _0x348e00[_0x2fd3('0x56')](_0x5bbbe2);}})[_0x2fd3('0x31')](function(_0x2fb39b){if(_0x2fb39b){return _0x2fb39b?{'count':_0x3f95fd,'rows':_0x2fb39b}:null;}})[_0x2fd3('0x31')](respondWithResult(_0x138095,null))[_0x2fd3('0x27')](handleError(_0x138095,null));};exports[_0x2fd3('0x59')]=function(_0x62d251,_0x43107e,_0x10ffdd){var _0x32fed2={};var _0x32ee6={};var _0x27b92b;var _0x33d7a5;return db['ZendeskConfiguration'][_0x2fd3('0x57')]({'where':{'id':_0x62d251[_0x2fd3('0x4f')]['id']}})[_0x2fd3('0x31')](handleEntityNotFound(_0x43107e,null))[_0x2fd3('0x31')](function(_0x2d513b){if(_0x2d513b){_0x27b92b=_0x2d513b;_0x32ee6[_0x2fd3('0x3b')]=_[_0x2fd3('0x3d')](db[_0x2fd3('0x58')]['rawAttributes']);_0x32ee6[_0x2fd3('0x3c')]=_[_0x2fd3('0x3d')](_0x62d251[_0x2fd3('0x3c')]);_0x32ee6[_0x2fd3('0x3e')]=_[_0x2fd3('0x51')](_0x32ee6[_0x2fd3('0x3b')],_0x32ee6[_0x2fd3('0x3c')]);_0x32fed2['attributes']=_[_0x2fd3('0x51')](_0x32ee6[_0x2fd3('0x3b')],qs['fields'](_0x62d251['query']['fields']));_0x32fed2['attributes']=_0x32fed2[_0x2fd3('0x40')][_0x2fd3('0x41')]?_0x32fed2[_0x2fd3('0x40')]:_0x32ee6['model'];_0x32fed2['order']=qs[_0x2fd3('0x45')](_0x62d251[_0x2fd3('0x3c')]['sort']);_0x32fed2[_0x2fd3('0x48')]=qs[_0x2fd3('0x3e')](_[_0x2fd3('0x46')](_0x62d251[_0x2fd3('0x3c')],_0x32ee6[_0x2fd3('0x3e')]));if(_0x62d251[_0x2fd3('0x3c')]['filter']){_0x32fed2['where']=_[_0x2fd3('0x49')](_0x32fed2[_0x2fd3('0x48')],{'$or':_[_0x2fd3('0x37')](_0x32fed2[_0x2fd3('0x40')],function(_0x4deeea){var _0x111113={};_0x111113[_0x4deeea]={'$like':'%'+_0x62d251[_0x2fd3('0x3c')]['filter']+'%'};return _0x111113;})});}_0x32fed2=_[_0x2fd3('0x49')]({},_0x32fed2,_0x62d251[_0x2fd3('0x4a')]);return _0x27b92b['getSubjects'](_0x32fed2);}})['then'](function(_0x13f820){if(_0x13f820){_0x33d7a5=_0x13f820[_0x2fd3('0x41')];if(!_0x62d251[_0x2fd3('0x3c')]['hasOwnProperty'](_0x2fd3('0x43'))){_0x32fed2[_0x2fd3('0x2b')]=qs[_0x2fd3('0x2b')](_0x62d251[_0x2fd3('0x3c')]['limit']);_0x32fed2[_0x2fd3('0x2a')]=qs[_0x2fd3('0x2a')](_0x62d251[_0x2fd3('0x3c')]['offset']);}return _0x27b92b[_0x2fd3('0x59')](_0x32fed2);}})[_0x2fd3('0x31')](function(_0x32b699){if(_0x32b699){return _0x32b699?{'count':_0x33d7a5,'rows':_0x32b699}:null;}})[_0x2fd3('0x31')](respondWithResult(_0x43107e,null))[_0x2fd3('0x27')](handleError(_0x43107e,null));};exports[_0x2fd3('0x5a')]=function(_0xe60b97,_0x4174f2,_0x2a3255){var _0x270d49={};var _0x483d89={};var _0x5810ce;var _0x48cfa7;return db[_0x2fd3('0x38')][_0x2fd3('0x57')]({'where':{'id':_0xe60b97[_0x2fd3('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4174f2,null))[_0x2fd3('0x31')](function(_0x41172b){if(_0x41172b){_0x5810ce=_0x41172b;_0x483d89[_0x2fd3('0x3b')]=_[_0x2fd3('0x3d')](db['ZendeskField'][_0x2fd3('0x50')]);_0x483d89[_0x2fd3('0x3c')]=_[_0x2fd3('0x3d')](_0xe60b97[_0x2fd3('0x3c')]);_0x483d89['filters']=_[_0x2fd3('0x51')](_0x483d89[_0x2fd3('0x3b')],_0x483d89[_0x2fd3('0x3c')]);_0x270d49['attributes']=_['intersection'](_0x483d89['model'],qs[_0x2fd3('0x3f')](_0xe60b97[_0x2fd3('0x3c')][_0x2fd3('0x3f')]));_0x270d49[_0x2fd3('0x40')]=_0x270d49[_0x2fd3('0x40')]['length']?_0x270d49['attributes']:_0x483d89['model'];_0x270d49[_0x2fd3('0x44')]=qs['sort'](_0xe60b97[_0x2fd3('0x3c')][_0x2fd3('0x45')]);_0x270d49[_0x2fd3('0x48')]=qs[_0x2fd3('0x3e')](_[_0x2fd3('0x46')](_0xe60b97[_0x2fd3('0x3c')],_0x483d89[_0x2fd3('0x3e')]));if(_0xe60b97['query'][_0x2fd3('0x47')]){_0x270d49[_0x2fd3('0x48')]=_[_0x2fd3('0x49')](_0x270d49[_0x2fd3('0x48')],{'$or':_[_0x2fd3('0x37')](_0x270d49[_0x2fd3('0x40')],function(_0x25470c){var _0x3ba606={};_0x3ba606[_0x25470c]={'$like':'%'+_0xe60b97[_0x2fd3('0x3c')][_0x2fd3('0x47')]+'%'};return _0x3ba606;})});}_0x270d49=_[_0x2fd3('0x49')]({},_0x270d49,_0xe60b97[_0x2fd3('0x4a')]);return _0x5810ce[_0x2fd3('0x5a')](_0x270d49);}})[_0x2fd3('0x31')](function(_0x4abd56){if(_0x4abd56){_0x48cfa7=_0x4abd56[_0x2fd3('0x41')];if(!_0xe60b97['query']['hasOwnProperty'](_0x2fd3('0x43'))){_0x270d49[_0x2fd3('0x2b')]=qs['limit'](_0xe60b97[_0x2fd3('0x3c')][_0x2fd3('0x2b')]);_0x270d49[_0x2fd3('0x2a')]=qs[_0x2fd3('0x2a')](_0xe60b97[_0x2fd3('0x3c')]['offset']);}return _0x5810ce[_0x2fd3('0x5a')](_0x270d49);}})[_0x2fd3('0x31')](function(_0x209820){if(_0x209820){return _0x209820?{'count':_0x48cfa7,'rows':_0x209820}:null;}})[_0x2fd3('0x31')](respondWithResult(_0x4174f2,null))[_0x2fd3('0x27')](handleError(_0x4174f2,null));};exports[_0x2fd3('0x5b')]=function(_0x5453fb,_0x45a196,_0x241a5d){var _0x26c495={};var _0x29db53={};var _0x4124d1;var _0x97e8be;return db[_0x2fd3('0x38')][_0x2fd3('0x57')]({'where':{'id':_0x5453fb['params']['id']}})[_0x2fd3('0x31')](handleEntityNotFound(_0x45a196,null))[_0x2fd3('0x31')](function(_0x2db3af){if(_0x2db3af){_0x4124d1=_0x2db3af;_0x29db53[_0x2fd3('0x3b')]=_[_0x2fd3('0x3d')](db[_0x2fd3('0x5c')][_0x2fd3('0x50')]);_0x29db53[_0x2fd3('0x3c')]=_[_0x2fd3('0x3d')](_0x5453fb[_0x2fd3('0x3c')]);_0x29db53[_0x2fd3('0x3e')]=_[_0x2fd3('0x51')](_0x29db53['model'],_0x29db53[_0x2fd3('0x3c')]);_0x26c495['attributes']=_[_0x2fd3('0x51')](_0x29db53[_0x2fd3('0x3b')],qs[_0x2fd3('0x3f')](_0x5453fb[_0x2fd3('0x3c')]['fields']));_0x26c495['attributes']=_0x26c495[_0x2fd3('0x40')][_0x2fd3('0x41')]?_0x26c495[_0x2fd3('0x40')]:_0x29db53[_0x2fd3('0x3b')];_0x26c495[_0x2fd3('0x44')]=qs[_0x2fd3('0x45')](_0x5453fb[_0x2fd3('0x3c')]['sort']);_0x26c495[_0x2fd3('0x48')]=qs['filters'](_[_0x2fd3('0x46')](_0x5453fb[_0x2fd3('0x3c')],_0x29db53['filters']));if(_0x5453fb[_0x2fd3('0x3c')][_0x2fd3('0x47')]){_0x26c495[_0x2fd3('0x48')]=_[_0x2fd3('0x49')](_0x26c495['where'],{'$or':_[_0x2fd3('0x37')](_0x26c495['attributes'],function(_0x4da686){var _0x3ba334={};_0x3ba334[_0x4da686]={'$like':'%'+_0x5453fb['query']['filter']+'%'};return _0x3ba334;})});}_0x26c495=_[_0x2fd3('0x49')]({},_0x26c495,_0x5453fb[_0x2fd3('0x4a')]);return _0x4124d1['getTags'](_0x26c495);}})[_0x2fd3('0x31')](function(_0x29ba0c){if(_0x29ba0c){_0x97e8be=_0x29ba0c[_0x2fd3('0x41')];if(!_0x5453fb[_0x2fd3('0x3c')]['hasOwnProperty']('nolimit')){_0x26c495[_0x2fd3('0x2b')]=qs[_0x2fd3('0x2b')](_0x5453fb[_0x2fd3('0x3c')][_0x2fd3('0x2b')]);_0x26c495[_0x2fd3('0x2a')]=qs[_0x2fd3('0x2a')](_0x5453fb[_0x2fd3('0x3c')][_0x2fd3('0x2a')]);}return _0x4124d1['getTags'](_0x26c495);}})['then'](function(_0x5d3f22){if(_0x5d3f22){return _0x5d3f22?{'count':_0x97e8be,'rows':_0x5d3f22}:null;}})[_0x2fd3('0x31')](respondWithResult(_0x45a196,null))[_0x2fd3('0x27')](handleError(_0x45a196,null));};exports[_0x2fd3('0x5d')]=function(_0x324020,_0x4899a4,_0x486f00){if(_0x324020[_0x2fd3('0x54')]['id']){delete _0x324020[_0x2fd3('0x54')]['id'];}return db[_0x2fd3('0x38')]['findOne']({'where':{'id':_0x324020[_0x2fd3('0x4f')]['id']}})[_0x2fd3('0x31')](handleEntityNotFound(_0x4899a4,null))[_0x2fd3('0x31')](function(_0x55ce84){if(_0x55ce84){return _0x55ce84[_0x2fd3('0x5d')](_0x324020[_0x2fd3('0x54')][_0x2fd3('0x5e')]||[]);}return null;})[_0x2fd3('0x31')](respondWithResult(_0x4899a4,null))[_0x2fd3('0x27')](handleError(_0x4899a4,null));}; \ No newline at end of file +var _0x92aa=['order','where','pick','filter','merge','options','includeAll','include','rows','show','create','body','params','find','getFields','ZendeskField','rawAttributes','sort','getSubjects','findOne','getTags','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','ValidationError','request','then','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','end','status','json','count','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','index','map','ZendeskConfiguration','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x92aa,0x193));var _0xa92a=function(_0x5b0847,_0x438ae0){_0x5b0847=_0x5b0847-0x0;var _0x3e7b7a=_0x92aa[_0x5b0847];return _0x3e7b7a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa92a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa92a('0x1'));var jsonpatch=require(_0xa92a('0x2'));var rp=require(_0xa92a('0x3'));var moment=require('moment');var BPromise=require(_0xa92a('0x4'));var Mustache=require(_0xa92a('0x5'));var util=require(_0xa92a('0x6'));var path=require(_0xa92a('0x7'));var sox=require(_0xa92a('0x8'));var csv=require(_0xa92a('0x9'));var ejs=require(_0xa92a('0xa'));var fs=require('fs');var _=require(_0xa92a('0xb'));var squel=require(_0xa92a('0xc'));var crypto=require(_0xa92a('0xd'));var jsforce=require(_0xa92a('0xe'));var deskjs=require(_0xa92a('0xf'));var toCsv=require(_0xa92a('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa92a('0x10'));var as=require(_0xa92a('0x11'));var hardwareService=require(_0xa92a('0x12'));var logger=require(_0xa92a('0x13'))('api');var utils=require(_0xa92a('0x14'));var config=require(_0xa92a('0x15'));var db=require(_0xa92a('0x16'))['db'];var jayson=require(_0xa92a('0x17'));var client=jayson[_0xa92a('0x18')][_0xa92a('0x19')]({'port':0x232a});function checkPasswordPattern(_0x51f8ff,_0x59fe05,_0x4a3171){if(_0x4a3171){var _0x5c50e1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5c50e1['test'](_0x59fe05)){return _0x51f8ff;}else{throw new db['Sequelize'][(_0xa92a('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 _0x51f8ff;}}function respondWithRpcPromise(_0x773fff,_0x1e05e8,_0x490562,_0x420347){return new BPromise(function(_0x10a6ee,_0x3d8c08){var _0x36d261=_0x420347||client;return _0x36d261[_0xa92a('0x1b')](_0x773fff,_0x490562)[_0xa92a('0x1c')](function(_0x542ae9){logger['info'](_0xa92a('0x1d'),_0x1e05e8,'request\x20sent');logger[_0xa92a('0x1e')](_0xa92a('0x1f'),_0x1e05e8,_0xa92a('0x20'),JSON[_0xa92a('0x21')](_0x542ae9));if(_0x542ae9['error']){if(_0x542ae9[_0xa92a('0x22')][_0xa92a('0x23')]===0x1f4){logger[_0xa92a('0x22')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1e05e8,_0x542ae9[_0xa92a('0x22')]['message']);return _0x3d8c08(_0x542ae9[_0xa92a('0x22')][_0xa92a('0x24')]);}logger[_0xa92a('0x22')](_0xa92a('0x1d'),_0x1e05e8,_0x542ae9[_0xa92a('0x22')][_0xa92a('0x24')]);return _0x10a6ee(_0x542ae9[_0xa92a('0x22')][_0xa92a('0x24')]);}else{logger[_0xa92a('0x25')](_0xa92a('0x1d'),_0x1e05e8,'request\x20sent');_0x10a6ee(_0x542ae9[_0xa92a('0x26')]['message']);}})[_0xa92a('0x27')](function(_0xdd7f53){logger[_0xa92a('0x22')](_0xa92a('0x1d'),_0x1e05e8,_0xdd7f53);_0x3d8c08(_0xdd7f53);});});}function respondWithStatusCode(_0x2673f2,_0x11cfa0){_0x11cfa0=_0x11cfa0||0xcc;return function(_0x3cad6e){if(_0x3cad6e){return _0x2673f2[_0xa92a('0x28')](_0x11cfa0);}return _0x2673f2['status'](_0x11cfa0)[_0xa92a('0x29')]();};}function respondWithResult(_0x5c66cd,_0x15676f){_0x15676f=_0x15676f||0xc8;return function(_0xc7da92){if(_0xc7da92){return _0x5c66cd[_0xa92a('0x2a')](_0x15676f)[_0xa92a('0x2b')](_0xc7da92);}};}function respondWithFilteredResult(_0x555199,_0x121395){return function(_0x4cf11c){if(_0x4cf11c){var _0x4227f3=_0x4cf11c[_0xa92a('0x2c')],_0x349c62=_0x121395['offset'],_0x49517c=_0x121395['offset']+_0x121395[_0xa92a('0x2d')],_0x2292de;if(_0x49517c>=_0x4227f3){_0x49517c=_0x4227f3;_0x2292de=0xc8;}else{_0x2292de=0xce;}_0x555199['status'](_0x2292de);return _0x555199[_0xa92a('0x2e')](_0xa92a('0x2f'),_0x349c62+'-'+_0x49517c+'/'+_0x4227f3)[_0xa92a('0x2b')](_0x4cf11c);}return null;};}function patchUpdates(_0x46ab4d){return function(_0x30fcc4){try{jsonpatch[_0xa92a('0x30')](_0x30fcc4,_0x46ab4d,!![]);}catch(_0x2ad9e7){return BPromise['reject'](_0x2ad9e7);}return _0x30fcc4[_0xa92a('0x31')]();};}function saveUpdates(_0x85220,_0x291148){return function(_0x2a070a){if(_0x2a070a){return _0x2a070a[_0xa92a('0x32')](_0x85220)[_0xa92a('0x1c')](function(_0x2fdca6){return _0x2fdca6;});}return null;};}function removeEntity(_0x5747f1,_0x5e8b53){return function(_0x4a1dd2){if(_0x4a1dd2){return _0x4a1dd2[_0xa92a('0x33')]()['then'](function(){_0x5747f1[_0xa92a('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf29b8b,_0x5caec3){return function(_0x304e32){if(!_0x304e32){_0xf29b8b[_0xa92a('0x28')](0x194);}return _0x304e32;};}function handleError(_0x3ecb50,_0x35a679){_0x35a679=_0x35a679||0x1f4;return function(_0x3be7ee){logger['error'](_0x3be7ee[_0xa92a('0x34')]);if(_0x3be7ee[_0xa92a('0x35')]){delete _0x3be7ee[_0xa92a('0x35')];}_0x3ecb50[_0xa92a('0x2a')](_0x35a679)[_0xa92a('0x36')](_0x3be7ee);};}exports[_0xa92a('0x37')]=function(_0x4e019c,_0x28b0b8){var _0x383083={},_0x5252fc={},_0x5cc4cb={'count':0x0,'rows':[]};var _0x15242c=_[_0xa92a('0x38')](db[_0xa92a('0x39')]['rawAttributes'],function(_0x22b7d1){return{'name':_0x22b7d1[_0xa92a('0x3a')],'type':_0x22b7d1[_0xa92a('0x3b')][_0xa92a('0x3c')]};});_0x5252fc[_0xa92a('0x3d')]=_[_0xa92a('0x38')](_0x15242c,'name');_0x5252fc[_0xa92a('0x3e')]=_[_0xa92a('0x3f')](_0x4e019c['query']);_0x5252fc[_0xa92a('0x40')]=_[_0xa92a('0x41')](_0x5252fc[_0xa92a('0x3d')],_0x5252fc[_0xa92a('0x3e')]);_0x383083[_0xa92a('0x42')]=_['intersection'](_0x5252fc[_0xa92a('0x3d')],qs[_0xa92a('0x43')](_0x4e019c['query'][_0xa92a('0x43')]));_0x383083[_0xa92a('0x42')]=_0x383083[_0xa92a('0x42')][_0xa92a('0x44')]?_0x383083[_0xa92a('0x42')]:_0x5252fc[_0xa92a('0x3d')];if(!_0x4e019c['query'][_0xa92a('0x45')](_0xa92a('0x46'))){_0x383083[_0xa92a('0x2d')]=qs[_0xa92a('0x2d')](_0x4e019c[_0xa92a('0x3e')][_0xa92a('0x2d')]);_0x383083[_0xa92a('0x47')]=qs[_0xa92a('0x47')](_0x4e019c[_0xa92a('0x3e')][_0xa92a('0x47')]);}_0x383083[_0xa92a('0x48')]=qs['sort'](_0x4e019c[_0xa92a('0x3e')]['sort']);_0x383083[_0xa92a('0x49')]=qs['filters'](_[_0xa92a('0x4a')](_0x4e019c[_0xa92a('0x3e')],_0x5252fc[_0xa92a('0x40')]),_0x15242c);if(_0x4e019c['query'][_0xa92a('0x4b')]){_0x383083[_0xa92a('0x49')]=_['merge'](_0x383083[_0xa92a('0x49')],{'$or':_[_0xa92a('0x38')](_0x15242c,function(_0xec9614){if(_0xec9614[_0xa92a('0x3b')]!=='VIRTUAL'){var _0x3463a3={};_0x3463a3[_0xec9614[_0xa92a('0x35')]]={'$like':'%'+_0x4e019c['query'][_0xa92a('0x4b')]+'%'};return _0x3463a3;}})});}_0x383083=_[_0xa92a('0x4c')]({},_0x383083,_0x4e019c[_0xa92a('0x4d')]);var _0x2ad69d={'where':_0x383083[_0xa92a('0x49')]};return db[_0xa92a('0x39')]['count'](_0x2ad69d)['then'](function(_0x374027){_0x5cc4cb['count']=_0x374027;if(_0x4e019c[_0xa92a('0x3e')][_0xa92a('0x4e')]){_0x383083[_0xa92a('0x4f')]=[{'all':!![]}];}return db[_0xa92a('0x39')]['findAll'](_0x383083);})[_0xa92a('0x1c')](function(_0x48c812){_0x5cc4cb[_0xa92a('0x50')]=_0x48c812;return _0x5cc4cb;})[_0xa92a('0x1c')](respondWithFilteredResult(_0x28b0b8,_0x383083))[_0xa92a('0x27')](handleError(_0x28b0b8,null));};exports[_0xa92a('0x51')]=function(_0x303c20,_0x35791e){var _0x2e5a20={'raw':![],'where':{'id':_0x303c20['params']['id']}},_0x52cad0={};_0x52cad0[_0xa92a('0x3d')]=_['keys'](db[_0xa92a('0x39')]['rawAttributes']);_0x52cad0['query']=_['keys'](_0x303c20[_0xa92a('0x3e')]);_0x52cad0[_0xa92a('0x40')]=_['intersection'](_0x52cad0['model'],_0x52cad0[_0xa92a('0x3e')]);_0x2e5a20[_0xa92a('0x42')]=_[_0xa92a('0x41')](_0x52cad0[_0xa92a('0x3d')],qs[_0xa92a('0x43')](_0x303c20['query'][_0xa92a('0x43')]));_0x2e5a20['attributes']=_0x2e5a20['attributes']['length']?_0x2e5a20[_0xa92a('0x42')]:_0x52cad0[_0xa92a('0x3d')];if(_0x303c20[_0xa92a('0x3e')][_0xa92a('0x4e')]){_0x2e5a20['include']=[{'all':!![]}];}_0x2e5a20=_[_0xa92a('0x4c')]({},_0x2e5a20,_0x303c20[_0xa92a('0x4d')]);return db[_0xa92a('0x39')]['find'](_0x2e5a20)['then'](handleEntityNotFound(_0x35791e,null))['then'](respondWithResult(_0x35791e,null))['catch'](handleError(_0x35791e,null));};exports[_0xa92a('0x52')]=function(_0x27638d,_0x3b2642){return db[_0xa92a('0x39')][_0xa92a('0x52')](_0x27638d[_0xa92a('0x53')],{})['then'](respondWithResult(_0x3b2642,0xc9))[_0xa92a('0x27')](handleError(_0x3b2642,null));};exports[_0xa92a('0x32')]=function(_0x5f22cf,_0x1bae7b){if(_0x5f22cf['body']['id']){delete _0x5f22cf[_0xa92a('0x53')]['id'];}return db[_0xa92a('0x39')]['find']({'where':{'id':_0x5f22cf[_0xa92a('0x54')]['id']}})[_0xa92a('0x1c')](handleEntityNotFound(_0x1bae7b,null))[_0xa92a('0x1c')](saveUpdates(_0x5f22cf[_0xa92a('0x53')],null))[_0xa92a('0x1c')](respondWithResult(_0x1bae7b,null))['catch'](handleError(_0x1bae7b,null));};exports[_0xa92a('0x33')]=function(_0x417948,_0x1054ab){return db[_0xa92a('0x39')][_0xa92a('0x55')]({'where':{'id':_0x417948['params']['id']}})[_0xa92a('0x1c')](handleEntityNotFound(_0x1054ab,null))[_0xa92a('0x1c')](removeEntity(_0x1054ab,null))['catch'](handleError(_0x1054ab,null));};exports[_0xa92a('0x56')]=function(_0x357a55,_0x12e856,_0x462e5f){var _0x17abd5={};var _0x23648b={};var _0x197c2c;var _0x4a9239;return db[_0xa92a('0x39')]['findOne']({'where':{'id':_0x357a55[_0xa92a('0x54')]['id']}})[_0xa92a('0x1c')](handleEntityNotFound(_0x12e856,null))['then'](function(_0x1a8117){if(_0x1a8117){_0x197c2c=_0x1a8117;_0x23648b[_0xa92a('0x3d')]=_['keys'](db[_0xa92a('0x57')][_0xa92a('0x58')]);_0x23648b[_0xa92a('0x3e')]=_[_0xa92a('0x3f')](_0x357a55[_0xa92a('0x3e')]);_0x23648b[_0xa92a('0x40')]=_[_0xa92a('0x41')](_0x23648b[_0xa92a('0x3d')],_0x23648b[_0xa92a('0x3e')]);_0x17abd5[_0xa92a('0x42')]=_[_0xa92a('0x41')](_0x23648b[_0xa92a('0x3d')],qs['fields'](_0x357a55[_0xa92a('0x3e')]['fields']));_0x17abd5[_0xa92a('0x42')]=_0x17abd5['attributes'][_0xa92a('0x44')]?_0x17abd5[_0xa92a('0x42')]:_0x23648b[_0xa92a('0x3d')];_0x17abd5[_0xa92a('0x48')]=qs[_0xa92a('0x59')](_0x357a55[_0xa92a('0x3e')][_0xa92a('0x59')]);_0x17abd5['where']=qs[_0xa92a('0x40')](_[_0xa92a('0x4a')](_0x357a55[_0xa92a('0x3e')],_0x23648b[_0xa92a('0x40')]));if(_0x357a55[_0xa92a('0x3e')][_0xa92a('0x4b')]){_0x17abd5[_0xa92a('0x49')]=_[_0xa92a('0x4c')](_0x17abd5[_0xa92a('0x49')],{'$or':_[_0xa92a('0x38')](_0x17abd5[_0xa92a('0x42')],function(_0x41fe50){var _0x2fef4f={};_0x2fef4f[_0x41fe50]={'$like':'%'+_0x357a55[_0xa92a('0x3e')][_0xa92a('0x4b')]+'%'};return _0x2fef4f;})});}_0x17abd5=_[_0xa92a('0x4c')]({},_0x17abd5,_0x357a55[_0xa92a('0x4d')]);return _0x197c2c[_0xa92a('0x56')](_0x17abd5);}})['then'](function(_0xf8efdf){if(_0xf8efdf){_0x4a9239=_0xf8efdf[_0xa92a('0x44')];if(!_0x357a55['query'][_0xa92a('0x45')](_0xa92a('0x46'))){_0x17abd5['limit']=qs[_0xa92a('0x2d')](_0x357a55[_0xa92a('0x3e')]['limit']);_0x17abd5[_0xa92a('0x47')]=qs['offset'](_0x357a55[_0xa92a('0x3e')][_0xa92a('0x47')]);}return _0x197c2c['getFields'](_0x17abd5);}})[_0xa92a('0x1c')](function(_0x28ed44){if(_0x28ed44){return _0x28ed44?{'count':_0x4a9239,'rows':_0x28ed44}:null;}})['then'](respondWithResult(_0x12e856,null))['catch'](handleError(_0x12e856,null));};exports[_0xa92a('0x5a')]=function(_0x3a4371,_0x17de39,_0x5b5023){var _0x41a30c={};var _0x148df6={};var _0x45ccef;var _0x22fb4d;return db[_0xa92a('0x39')][_0xa92a('0x5b')]({'where':{'id':_0x3a4371['params']['id']}})['then'](handleEntityNotFound(_0x17de39,null))[_0xa92a('0x1c')](function(_0x5d403f){if(_0x5d403f){_0x45ccef=_0x5d403f;_0x148df6['model']=_['keys'](db[_0xa92a('0x57')]['rawAttributes']);_0x148df6[_0xa92a('0x3e')]=_[_0xa92a('0x3f')](_0x3a4371['query']);_0x148df6['filters']=_[_0xa92a('0x41')](_0x148df6[_0xa92a('0x3d')],_0x148df6[_0xa92a('0x3e')]);_0x41a30c[_0xa92a('0x42')]=_[_0xa92a('0x41')](_0x148df6[_0xa92a('0x3d')],qs['fields'](_0x3a4371[_0xa92a('0x3e')]['fields']));_0x41a30c[_0xa92a('0x42')]=_0x41a30c[_0xa92a('0x42')][_0xa92a('0x44')]?_0x41a30c[_0xa92a('0x42')]:_0x148df6['model'];_0x41a30c[_0xa92a('0x48')]=qs[_0xa92a('0x59')](_0x3a4371[_0xa92a('0x3e')][_0xa92a('0x59')]);_0x41a30c[_0xa92a('0x49')]=qs[_0xa92a('0x40')](_['pick'](_0x3a4371[_0xa92a('0x3e')],_0x148df6[_0xa92a('0x40')]));if(_0x3a4371[_0xa92a('0x3e')][_0xa92a('0x4b')]){_0x41a30c[_0xa92a('0x49')]=_[_0xa92a('0x4c')](_0x41a30c[_0xa92a('0x49')],{'$or':_['map'](_0x41a30c[_0xa92a('0x42')],function(_0x5b040e){var _0x5839c5={};_0x5839c5[_0x5b040e]={'$like':'%'+_0x3a4371['query']['filter']+'%'};return _0x5839c5;})});}_0x41a30c=_['merge']({},_0x41a30c,_0x3a4371[_0xa92a('0x4d')]);return _0x45ccef[_0xa92a('0x5a')](_0x41a30c);}})[_0xa92a('0x1c')](function(_0x56effd){if(_0x56effd){_0x22fb4d=_0x56effd[_0xa92a('0x44')];if(!_0x3a4371[_0xa92a('0x3e')][_0xa92a('0x45')](_0xa92a('0x46'))){_0x41a30c['limit']=qs[_0xa92a('0x2d')](_0x3a4371[_0xa92a('0x3e')][_0xa92a('0x2d')]);_0x41a30c[_0xa92a('0x47')]=qs[_0xa92a('0x47')](_0x3a4371[_0xa92a('0x3e')]['offset']);}return _0x45ccef[_0xa92a('0x5a')](_0x41a30c);}})['then'](function(_0x2543ca){if(_0x2543ca){return _0x2543ca?{'count':_0x22fb4d,'rows':_0x2543ca}:null;}})[_0xa92a('0x1c')](respondWithResult(_0x17de39,null))[_0xa92a('0x27')](handleError(_0x17de39,null));};exports['getDescriptions']=function(_0x564233,_0x41f849,_0x30099c){var _0x5562c6={};var _0x5b4244={};var _0x114387;var _0x44c3d0;return db[_0xa92a('0x39')][_0xa92a('0x5b')]({'where':{'id':_0x564233[_0xa92a('0x54')]['id']}})[_0xa92a('0x1c')](handleEntityNotFound(_0x41f849,null))[_0xa92a('0x1c')](function(_0x10bb1f){if(_0x10bb1f){_0x114387=_0x10bb1f;_0x5b4244['model']=_[_0xa92a('0x3f')](db[_0xa92a('0x57')][_0xa92a('0x58')]);_0x5b4244[_0xa92a('0x3e')]=_[_0xa92a('0x3f')](_0x564233[_0xa92a('0x3e')]);_0x5b4244[_0xa92a('0x40')]=_[_0xa92a('0x41')](_0x5b4244[_0xa92a('0x3d')],_0x5b4244[_0xa92a('0x3e')]);_0x5562c6[_0xa92a('0x42')]=_[_0xa92a('0x41')](_0x5b4244['model'],qs[_0xa92a('0x43')](_0x564233[_0xa92a('0x3e')][_0xa92a('0x43')]));_0x5562c6['attributes']=_0x5562c6[_0xa92a('0x42')][_0xa92a('0x44')]?_0x5562c6['attributes']:_0x5b4244[_0xa92a('0x3d')];_0x5562c6[_0xa92a('0x48')]=qs[_0xa92a('0x59')](_0x564233[_0xa92a('0x3e')]['sort']);_0x5562c6[_0xa92a('0x49')]=qs[_0xa92a('0x40')](_[_0xa92a('0x4a')](_0x564233[_0xa92a('0x3e')],_0x5b4244[_0xa92a('0x40')]));if(_0x564233['query']['filter']){_0x5562c6[_0xa92a('0x49')]=_[_0xa92a('0x4c')](_0x5562c6[_0xa92a('0x49')],{'$or':_[_0xa92a('0x38')](_0x5562c6[_0xa92a('0x42')],function(_0xa15fda){var _0x427788={};_0x427788[_0xa15fda]={'$like':'%'+_0x564233[_0xa92a('0x3e')][_0xa92a('0x4b')]+'%'};return _0x427788;})});}_0x5562c6=_[_0xa92a('0x4c')]({},_0x5562c6,_0x564233[_0xa92a('0x4d')]);return _0x114387['getDescriptions'](_0x5562c6);}})[_0xa92a('0x1c')](function(_0x416a22){if(_0x416a22){_0x44c3d0=_0x416a22[_0xa92a('0x44')];if(!_0x564233[_0xa92a('0x3e')]['hasOwnProperty'](_0xa92a('0x46'))){_0x5562c6[_0xa92a('0x2d')]=qs[_0xa92a('0x2d')](_0x564233[_0xa92a('0x3e')][_0xa92a('0x2d')]);_0x5562c6['offset']=qs[_0xa92a('0x47')](_0x564233[_0xa92a('0x3e')][_0xa92a('0x47')]);}return _0x114387['getDescriptions'](_0x5562c6);}})[_0xa92a('0x1c')](function(_0x270af1){if(_0x270af1){return _0x270af1?{'count':_0x44c3d0,'rows':_0x270af1}:null;}})[_0xa92a('0x1c')](respondWithResult(_0x41f849,null))[_0xa92a('0x27')](handleError(_0x41f849,null));};exports[_0xa92a('0x5c')]=function(_0x3083b4,_0x57128b,_0x3a36e1){var _0x556af5={};var _0x442d50={};var _0x369789;var _0x756926;return db[_0xa92a('0x39')]['findOne']({'where':{'id':_0x3083b4[_0xa92a('0x54')]['id']}})[_0xa92a('0x1c')](handleEntityNotFound(_0x57128b,null))['then'](function(_0x4772e4){if(_0x4772e4){_0x369789=_0x4772e4;_0x442d50['model']=_[_0xa92a('0x3f')](db['Tag'][_0xa92a('0x58')]);_0x442d50[_0xa92a('0x3e')]=_[_0xa92a('0x3f')](_0x3083b4[_0xa92a('0x3e')]);_0x442d50['filters']=_[_0xa92a('0x41')](_0x442d50['model'],_0x442d50[_0xa92a('0x3e')]);_0x556af5[_0xa92a('0x42')]=_['intersection'](_0x442d50[_0xa92a('0x3d')],qs[_0xa92a('0x43')](_0x3083b4[_0xa92a('0x3e')][_0xa92a('0x43')]));_0x556af5[_0xa92a('0x42')]=_0x556af5[_0xa92a('0x42')]['length']?_0x556af5[_0xa92a('0x42')]:_0x442d50[_0xa92a('0x3d')];_0x556af5[_0xa92a('0x48')]=qs[_0xa92a('0x59')](_0x3083b4[_0xa92a('0x3e')]['sort']);_0x556af5['where']=qs[_0xa92a('0x40')](_[_0xa92a('0x4a')](_0x3083b4['query'],_0x442d50['filters']));if(_0x3083b4[_0xa92a('0x3e')]['filter']){_0x556af5[_0xa92a('0x49')]=_[_0xa92a('0x4c')](_0x556af5[_0xa92a('0x49')],{'$or':_[_0xa92a('0x38')](_0x556af5[_0xa92a('0x42')],function(_0x207ea8){var _0x52bef1={};_0x52bef1[_0x207ea8]={'$like':'%'+_0x3083b4[_0xa92a('0x3e')][_0xa92a('0x4b')]+'%'};return _0x52bef1;})});}_0x556af5=_[_0xa92a('0x4c')]({},_0x556af5,_0x3083b4[_0xa92a('0x4d')]);return _0x369789['getTags'](_0x556af5);}})[_0xa92a('0x1c')](function(_0x4d9969){if(_0x4d9969){_0x756926=_0x4d9969[_0xa92a('0x44')];if(!_0x3083b4[_0xa92a('0x3e')]['hasOwnProperty']('nolimit')){_0x556af5['limit']=qs[_0xa92a('0x2d')](_0x3083b4['query'][_0xa92a('0x2d')]);_0x556af5[_0xa92a('0x47')]=qs[_0xa92a('0x47')](_0x3083b4[_0xa92a('0x3e')][_0xa92a('0x47')]);}return _0x369789[_0xa92a('0x5c')](_0x556af5);}})[_0xa92a('0x1c')](function(_0xd5fc73){if(_0xd5fc73){return _0xd5fc73?{'count':_0x756926,'rows':_0xd5fc73}:null;}})[_0xa92a('0x1c')](respondWithResult(_0x57128b,null))[_0xa92a('0x27')](handleError(_0x57128b,null));};exports['setTags']=function(_0x4d5677,_0x54bd50,_0x400d7c){if(_0x4d5677[_0xa92a('0x53')]['id']){delete _0x4d5677[_0xa92a('0x53')]['id'];}return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x4d5677[_0xa92a('0x54')]['id']}})[_0xa92a('0x1c')](handleEntityNotFound(_0x54bd50,null))[_0xa92a('0x1c')](function(_0x1c648d){if(_0x1c648d){return _0x1c648d[_0xa92a('0x5d')](_0x4d5677[_0xa92a('0x53')][_0xa92a('0x5e')]||[]);}return null;})['then'](respondWithResult(_0x54bd50,null))['catch'](handleError(_0x54bd50,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 256e752..7500f25 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 _0x9085=['int_zendesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define'];(function(_0x23da0c,_0x4ddae5){var _0x30f0d5=function(_0x432ec1){while(--_0x432ec1){_0x23da0c['push'](_0x23da0c['shift']());}};_0x30f0d5(++_0x4ddae5);}(_0x9085,0xd3));var _0x5908=function(_0x239875,_0x52a793){_0x239875=_0x239875-0x0;var _0x55a8d6=_0x9085[_0x239875];return _0x55a8d6;};'use strict';var _=require(_0x5908('0x0'));var util=require(_0x5908('0x1'));var logger=require(_0x5908('0x2'))(_0x5908('0x3'));var moment=require(_0x5908('0x4'));var BPromise=require(_0x5908('0x5'));var rp=require(_0x5908('0x6'));var fs=require('fs');var path=require(_0x5908('0x7'));var rimraf=require(_0x5908('0x8'));var config=require(_0x5908('0x9'));var attributes=require(_0x5908('0xa'));module[_0x5908('0xb')]=function(_0x3fdfef,_0x1e1174){return _0x3fdfef[_0x5908('0xc')]('ZendeskConfiguration',attributes,{'tableName':_0x5908('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb011=['api','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','../../config/logger'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0xb011,0x1a3));var _0x1b01=function(_0x3215b8,_0x691a05){_0x3215b8=_0x3215b8-0x0;var _0x4a4514=_0xb011[_0x3215b8];return _0x4a4514;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1b01('0x0'))(_0x1b01('0x1'));var moment=require('moment');var BPromise=require(_0x1b01('0x2'));var rp=require(_0x1b01('0x3'));var fs=require('fs');var path=require(_0x1b01('0x4'));var rimraf=require(_0x1b01('0x5'));var config=require(_0x1b01('0x6'));var attributes=require(_0x1b01('0x7'));module[_0x1b01('0x8')]=function(_0x29ed1a,_0x52dc0c){return _0x29ed1a[_0x1b01('0x9')](_0x1b01('0xa'),attributes,{'tableName':_0x1b01('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index fbe7ade..74b2103 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 _0x27fc=['result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x3bf2d5,_0x36116c){var _0x29e958=function(_0x18ba76){while(--_0x18ba76){_0x3bf2d5['push'](_0x3bf2d5['shift']());}};_0x29e958(++_0x36116c);}(_0x27fc,0x92));var _0xc27f=function(_0x2f2ff5,_0x352b1c){_0x2f2ff5=_0x2f2ff5-0x0;var _0x1df50c=_0x27fc[_0x2f2ff5];return _0x1df50c;};'use strict';var _=require('lodash');var util=require(_0xc27f('0x0'));var moment=require(_0xc27f('0x1'));var BPromise=require(_0xc27f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc27f('0x3'));var db=require(_0xc27f('0x4'))['db'];var utils=require(_0xc27f('0x5'));var logger=require(_0xc27f('0x6'))(_0xc27f('0x7'));var config=require(_0xc27f('0x8'));var jayson=require(_0xc27f('0x9'));var client=jayson[_0xc27f('0xa')][_0xc27f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x166b99,_0x4600ac,_0x2ee55d){return new BPromise(function(_0x3b9c8f,_0x6c4786){return client[_0xc27f('0xc')](_0x166b99,_0x2ee55d)[_0xc27f('0xd')](function(_0x20ea97){logger[_0xc27f('0xe')](_0xc27f('0xf'),_0x4600ac,'request\x20sent');logger[_0xc27f('0x10')](_0xc27f('0x11'),_0x4600ac,_0xc27f('0x12'),JSON['stringify'](_0x20ea97));if(_0x20ea97[_0xc27f('0x13')]){if(_0x20ea97[_0xc27f('0x13')][_0xc27f('0x14')]===0x1f4){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x4600ac,_0x20ea97[_0xc27f('0x13')][_0xc27f('0x15')]);return _0x6c4786(_0x20ea97[_0xc27f('0x13')][_0xc27f('0x15')]);}logger[_0xc27f('0x13')](_0xc27f('0xf'),_0x4600ac,_0x20ea97[_0xc27f('0x13')]['message']);return _0x3b9c8f(_0x20ea97[_0xc27f('0x13')][_0xc27f('0x15')]);}else{logger[_0xc27f('0xe')](_0xc27f('0xf'),_0x4600ac,_0xc27f('0x12'));_0x3b9c8f(_0x20ea97[_0xc27f('0x16')][_0xc27f('0x15')]);}})[_0xc27f('0x17')](function(_0x29c689){logger['error'](_0xc27f('0xf'),_0x4600ac,_0x29c689);_0x6c4786(_0x29c689);});});} \ No newline at end of file +var _0x261f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment'];(function(_0x39c191,_0x58377f){var _0x1884de=function(_0x378575){while(--_0x378575){_0x39c191['push'](_0x39c191['shift']());}};_0x1884de(++_0x58377f);}(_0x261f,0x1ca));var _0xf261=function(_0x41a663,_0xe68b27){_0x41a663=_0x41a663-0x0;var _0x4920f8=_0x261f[_0x41a663];return _0x4920f8;};'use strict';var _=require('lodash');var util=require(_0xf261('0x0'));var moment=require(_0xf261('0x1'));var BPromise=require(_0xf261('0x2'));var rs=require(_0xf261('0x3'));var fs=require('fs');var Redis=require(_0xf261('0x4'));var db=require(_0xf261('0x5'))['db'];var utils=require(_0xf261('0x6'));var logger=require('../../config/logger')(_0xf261('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1b091e,_0x2355c8,_0x215842){return new BPromise(function(_0x23def2,_0x52afe1){return client[_0xf261('0x8')](_0x1b091e,_0x215842)[_0xf261('0x9')](function(_0x41cdfd){logger['info'](_0xf261('0xa'),_0x2355c8,_0xf261('0xb'));logger['debug'](_0xf261('0xc'),_0x2355c8,_0xf261('0xb'),JSON[_0xf261('0xd')](_0x41cdfd));if(_0x41cdfd[_0xf261('0xe')]){if(_0x41cdfd[_0xf261('0xe')][_0xf261('0xf')]===0x1f4){logger[_0xf261('0xe')](_0xf261('0xa'),_0x2355c8,_0x41cdfd[_0xf261('0xe')][_0xf261('0x10')]);return _0x52afe1(_0x41cdfd[_0xf261('0xe')][_0xf261('0x10')]);}logger['error'](_0xf261('0xa'),_0x2355c8,_0x41cdfd[_0xf261('0xe')][_0xf261('0x10')]);return _0x23def2(_0x41cdfd[_0xf261('0xe')][_0xf261('0x10')]);}else{logger[_0xf261('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2355c8,_0xf261('0xb'));_0x23def2(_0x41cdfd[_0xf261('0x12')][_0xf261('0x10')]);}})[_0xf261('0x13')](function(_0x5607f6){logger[_0xf261('0xe')](_0xf261('0xa'),_0x2355c8,_0x5607f6);_0x52afe1(_0x5607f6);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 6f6ad6d..3361bb3 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 _0x2bce=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','get','isAuthenticated','index','/:id','post','create','put','update'];(function(_0x2ce230,_0x5308ed){var _0x4dbaf0=function(_0x20feb8){while(--_0x20feb8){_0x2ce230['push'](_0x2ce230['shift']());}};_0x4dbaf0(++_0x5308ed);}(_0x2bce,0xd3));var _0xe2bc=function(_0x2f8a9f,_0x33ad58){_0x2f8a9f=_0x2f8a9f-0x0;var _0x4b3a98=_0x2bce[_0x2f8a9f];return _0x4b3a98;};'use strict';var multer=require(_0xe2bc('0x0'));var util=require(_0xe2bc('0x1'));var path=require(_0xe2bc('0x2'));var timeout=require(_0xe2bc('0x3'));var express=require(_0xe2bc('0x4'));var router=express[_0xe2bc('0x5')]();var auth=require(_0xe2bc('0x6'));var interaction=require(_0xe2bc('0x7'));var config=require('../../config/environment');var controller=require(_0xe2bc('0x8'));router[_0xe2bc('0x9')]('/',auth[_0xe2bc('0xa')](),controller[_0xe2bc('0xb')]);router[_0xe2bc('0x9')](_0xe2bc('0xc'),auth[_0xe2bc('0xa')](),controller['show']);router[_0xe2bc('0xd')]('/',auth[_0xe2bc('0xa')](),controller[_0xe2bc('0xe')]);router[_0xe2bc('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xe2bc('0x10')]);router['delete']('/:id',auth[_0xe2bc('0xa')](),controller[_0xe2bc('0x11')]);module[_0xe2bc('0x12')]=router; \ No newline at end of file +var _0x61df=['../../components/interaction/service','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','connect-timeout','express','../../components/auth/service'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x61df,0xbd));var _0xf61d=function(_0x4f8b00,_0x45ab7b){_0x4f8b00=_0x4f8b00-0x0;var _0x4e3841=_0x61df[_0x4f8b00];return _0x4e3841;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xf61d('0x0'));var express=require(_0xf61d('0x1'));var router=express['Router']();var auth=require(_0xf61d('0x2'));var interaction=require(_0xf61d('0x3'));var config=require('../../config/environment');var controller=require(_0xf61d('0x4'));router[_0xf61d('0x5')]('/',auth[_0xf61d('0x6')](),controller[_0xf61d('0x7')]);router[_0xf61d('0x5')](_0xf61d('0x8'),auth['isAuthenticated'](),controller[_0xf61d('0x9')]);router['post']('/',auth[_0xf61d('0x6')](),controller[_0xf61d('0xa')]);router[_0xf61d('0xb')](_0xf61d('0x8'),auth[_0xf61d('0x6')](),controller[_0xf61d('0xc')]);router[_0xf61d('0xd')](_0xf61d('0x8'),auth[_0xf61d('0x6')](),controller[_0xf61d('0xe')]);module[_0xf61d('0xf')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 7a9f477..40551fb 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 _0xf675=['customVariable','sequelize','exports','ENUM','variable','keyValue','string','STRING'];(function(_0x2bce7c,_0x52e164){var _0x5d285d=function(_0x5e3adc){while(--_0x5e3adc){_0x2bce7c['push'](_0x2bce7c['shift']());}};_0x5d285d(++_0x52e164);}(_0xf675,0x199));var _0x5f67=function(_0x90e575,_0x48c2ec){_0x90e575=_0x90e575-0x0;var _0x1aae60=_0xf675[_0x90e575];return _0x1aae60;};'use strict';var Sequelize=require(_0x5f67('0x0'));module[_0x5f67('0x1')]={'type':{'type':Sequelize[_0x5f67('0x2')]('string',_0x5f67('0x3'),'customVariable',_0x5f67('0x4')),'defaultValue':_0x5f67('0x5')},'content':{'type':Sequelize[_0x5f67('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x5f67('0x2')](_0x5f67('0x5'),_0x5f67('0x3'),_0x5f67('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x5f67('0x6')]},'nameField':{'type':Sequelize[_0x5f67('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x590c=['sequelize','string','variable','customVariable','keyValue','STRING','ENUM','BOOLEAN'];(function(_0x438e18,_0x52e2c5){var _0x50c6ea=function(_0x7ae358){while(--_0x7ae358){_0x438e18['push'](_0x438e18['shift']());}};_0x50c6ea(++_0x52e2c5);}(_0x590c,0x80));var _0xc590=function(_0x1b20bd,_0x474417){_0x1b20bd=_0x1b20bd-0x0;var _0x463f0c=_0x590c[_0x1b20bd];return _0x463f0c;};'use strict';var Sequelize=require(_0xc590('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xc590('0x1'),_0xc590('0x2'),_0xc590('0x3'),_0xc590('0x4')),'defaultValue':_0xc590('0x1')},'content':{'type':Sequelize[_0xc590('0x5')]},'key':{'type':Sequelize[_0xc590('0x5')]},'keyType':{'type':Sequelize[_0xc590('0x6')](_0xc590('0x1'),_0xc590('0x2'),_0xc590('0x3'))},'keyContent':{'type':Sequelize[_0xc590('0x5')]},'idField':{'type':Sequelize[_0xc590('0x5')]},'nameField':{'type':Sequelize[_0xc590('0x5')]},'customField':{'type':Sequelize[_0xc590('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 96f9c3c..9d23498 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 _0xfd2c=['apply','reject','destroy','error','name','index','ZendeskField','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','then','includeAll','include','findAll','rows','show','keys','find','create','body','catch','update','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range'];(function(_0x25e10c,_0x49596a){var _0x5dfd94=function(_0x2f4bfb){while(--_0x2f4bfb){_0x25e10c['push'](_0x25e10c['shift']());}};_0x5dfd94(++_0x49596a);}(_0xfd2c,0x143));var _0xcfd2=function(_0x4d456d,_0x35071d){_0x4d456d=_0x4d456d-0x0;var _0x1d90eb=_0xfd2c[_0x4d456d];return _0x1d90eb;};'use strict';var pdf=require(_0xcfd2('0x0'));var emlformat=require(_0xcfd2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xcfd2('0x2'));var jsonpatch=require(_0xcfd2('0x3'));var rp=require(_0xcfd2('0x4'));var moment=require('moment');var BPromise=require(_0xcfd2('0x5'));var Mustache=require('mustache');var util=require(_0xcfd2('0x6'));var path=require(_0xcfd2('0x7'));var sox=require(_0xcfd2('0x8'));var csv=require(_0xcfd2('0x9'));var ejs=require(_0xcfd2('0xa'));var fs=require('fs');var _=require(_0xcfd2('0xb'));var squel=require('squel');var crypto=require(_0xcfd2('0xc'));var jsforce=require(_0xcfd2('0xd'));var deskjs=require(_0xcfd2('0xe'));var toCsv=require(_0xcfd2('0x9'));var querystring=require(_0xcfd2('0xf'));var Papa=require(_0xcfd2('0x10'));var Redis=require(_0xcfd2('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcfd2('0x12'));var hardwareService=require(_0xcfd2('0x13'));var logger=require(_0xcfd2('0x14'))(_0xcfd2('0x15'));var utils=require(_0xcfd2('0x16'));var config=require('../../config/environment');var db=require(_0xcfd2('0x17'))['db'];function respondWithStatusCode(_0xb79be4,_0x186c85){_0x186c85=_0x186c85||0xcc;return function(_0x2fe782){if(_0x2fe782){return _0xb79be4[_0xcfd2('0x18')](_0x186c85);}return _0xb79be4[_0xcfd2('0x19')](_0x186c85)[_0xcfd2('0x1a')]();};}function respondWithResult(_0x594c6f,_0x33b773){_0x33b773=_0x33b773||0xc8;return function(_0x281ad1){if(_0x281ad1){return _0x594c6f[_0xcfd2('0x19')](_0x33b773)[_0xcfd2('0x1b')](_0x281ad1);}};}function respondWithFilteredResult(_0xe05381,_0x2c1718){return function(_0x2036a0){if(_0x2036a0){var _0x249645=_0x2036a0[_0xcfd2('0x1c')],_0x3333d0=_0x2c1718[_0xcfd2('0x1d')],_0x4ac7bd=_0x2c1718[_0xcfd2('0x1d')]+_0x2c1718[_0xcfd2('0x1e')],_0x290d0f;if(_0x4ac7bd>=_0x249645){_0x4ac7bd=_0x249645;_0x290d0f=0xc8;}else{_0x290d0f=0xce;}_0xe05381[_0xcfd2('0x19')](_0x290d0f);return _0xe05381['set'](_0xcfd2('0x1f'),_0x3333d0+'-'+_0x4ac7bd+'/'+_0x249645)[_0xcfd2('0x1b')](_0x2036a0);}return null;};}function patchUpdates(_0x16a79e){return function(_0x35cabf){try{jsonpatch[_0xcfd2('0x20')](_0x35cabf,_0x16a79e,!![]);}catch(_0x2c2b42){return BPromise[_0xcfd2('0x21')](_0x2c2b42);}return _0x35cabf['save']();};}function saveUpdates(_0x342f8d,_0x24f10f){return function(_0x161190){if(_0x161190){return _0x161190['update'](_0x342f8d)['then'](function(_0x146602){return _0x146602;});}return null;};}function removeEntity(_0x4d4a27,_0xb6dae6){return function(_0x4794a7){if(_0x4794a7){return _0x4794a7[_0xcfd2('0x22')]()['then'](function(){_0x4d4a27[_0xcfd2('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x318b90,_0x4b7df0){return function(_0x5fcd9b){if(!_0x5fcd9b){_0x318b90[_0xcfd2('0x18')](0x194);}return _0x5fcd9b;};}function handleError(_0x4756cc,_0x65109b){_0x65109b=_0x65109b||0x1f4;return function(_0x3949c7){logger[_0xcfd2('0x23')](_0x3949c7['stack']);if(_0x3949c7[_0xcfd2('0x24')]){delete _0x3949c7['name'];}_0x4756cc[_0xcfd2('0x19')](_0x65109b)['send'](_0x3949c7);};}exports[_0xcfd2('0x25')]=function(_0x1bea15,_0x3ef8dc){var _0x4b402d={},_0x29d26c={},_0x4abcaf={'count':0x0,'rows':[]};var _0x10a6f0=_['map'](db[_0xcfd2('0x26')][_0xcfd2('0x27')],function(_0x408c9f){return{'name':_0x408c9f[_0xcfd2('0x28')],'type':_0x408c9f[_0xcfd2('0x29')][_0xcfd2('0x2a')]};});_0x29d26c[_0xcfd2('0x2b')]=_[_0xcfd2('0x2c')](_0x10a6f0,_0xcfd2('0x24'));_0x29d26c[_0xcfd2('0x2d')]=_['keys'](_0x1bea15[_0xcfd2('0x2d')]);_0x29d26c[_0xcfd2('0x2e')]=_['intersection'](_0x29d26c['model'],_0x29d26c[_0xcfd2('0x2d')]);_0x4b402d[_0xcfd2('0x2f')]=_[_0xcfd2('0x30')](_0x29d26c[_0xcfd2('0x2b')],qs['fields'](_0x1bea15['query'][_0xcfd2('0x31')]));_0x4b402d[_0xcfd2('0x2f')]=_0x4b402d[_0xcfd2('0x2f')][_0xcfd2('0x32')]?_0x4b402d['attributes']:_0x29d26c[_0xcfd2('0x2b')];if(!_0x1bea15[_0xcfd2('0x2d')][_0xcfd2('0x33')]('nolimit')){_0x4b402d[_0xcfd2('0x1e')]=qs[_0xcfd2('0x1e')](_0x1bea15['query'][_0xcfd2('0x1e')]);_0x4b402d[_0xcfd2('0x1d')]=qs['offset'](_0x1bea15['query']['offset']);}_0x4b402d['order']=qs[_0xcfd2('0x34')](_0x1bea15['query'][_0xcfd2('0x34')]);_0x4b402d[_0xcfd2('0x35')]=qs['filters'](_[_0xcfd2('0x36')](_0x1bea15[_0xcfd2('0x2d')],_0x29d26c[_0xcfd2('0x2e')]),_0x10a6f0);if(_0x1bea15['query'][_0xcfd2('0x37')]){_0x4b402d[_0xcfd2('0x35')]=_[_0xcfd2('0x38')](_0x4b402d[_0xcfd2('0x35')],{'$or':_[_0xcfd2('0x2c')](_0x10a6f0,function(_0x2dcf00){if(_0x2dcf00[_0xcfd2('0x29')]!=='VIRTUAL'){var _0x1d3908={};_0x1d3908[_0x2dcf00[_0xcfd2('0x24')]]={'$like':'%'+_0x1bea15[_0xcfd2('0x2d')]['filter']+'%'};return _0x1d3908;}})});}_0x4b402d=_['merge']({},_0x4b402d,_0x1bea15[_0xcfd2('0x39')]);var _0x398dac={'where':_0x4b402d[_0xcfd2('0x35')]};return db[_0xcfd2('0x26')][_0xcfd2('0x1c')](_0x398dac)[_0xcfd2('0x3a')](function(_0x3178ca){_0x4abcaf[_0xcfd2('0x1c')]=_0x3178ca;if(_0x1bea15['query'][_0xcfd2('0x3b')]){_0x4b402d[_0xcfd2('0x3c')]=[{'all':!![]}];}return db[_0xcfd2('0x26')][_0xcfd2('0x3d')](_0x4b402d);})[_0xcfd2('0x3a')](function(_0x3111e5){_0x4abcaf[_0xcfd2('0x3e')]=_0x3111e5;return _0x4abcaf;})[_0xcfd2('0x3a')](respondWithFilteredResult(_0x3ef8dc,_0x4b402d))['catch'](handleError(_0x3ef8dc,null));};exports[_0xcfd2('0x3f')]=function(_0x24dbff,_0x309812){var _0x51c5aa={'raw':!![],'where':{'id':_0x24dbff['params']['id']}},_0x3f065b={};_0x3f065b[_0xcfd2('0x2b')]=_[_0xcfd2('0x40')](db['ZendeskField'][_0xcfd2('0x27')]);_0x3f065b['query']=_['keys'](_0x24dbff[_0xcfd2('0x2d')]);_0x3f065b[_0xcfd2('0x2e')]=_[_0xcfd2('0x30')](_0x3f065b[_0xcfd2('0x2b')],_0x3f065b[_0xcfd2('0x2d')]);_0x51c5aa[_0xcfd2('0x2f')]=_[_0xcfd2('0x30')](_0x3f065b[_0xcfd2('0x2b')],qs['fields'](_0x24dbff[_0xcfd2('0x2d')][_0xcfd2('0x31')]));_0x51c5aa[_0xcfd2('0x2f')]=_0x51c5aa[_0xcfd2('0x2f')][_0xcfd2('0x32')]?_0x51c5aa[_0xcfd2('0x2f')]:_0x3f065b[_0xcfd2('0x2b')];if(_0x24dbff[_0xcfd2('0x2d')][_0xcfd2('0x3b')]){_0x51c5aa[_0xcfd2('0x3c')]=[{'all':!![]}];}_0x51c5aa=_[_0xcfd2('0x38')]({},_0x51c5aa,_0x24dbff[_0xcfd2('0x39')]);return db[_0xcfd2('0x26')][_0xcfd2('0x41')](_0x51c5aa)[_0xcfd2('0x3a')](handleEntityNotFound(_0x309812,null))[_0xcfd2('0x3a')](respondWithResult(_0x309812,null))['catch'](handleError(_0x309812,null));};exports[_0xcfd2('0x42')]=function(_0x9cc99,_0x43a95b){return db[_0xcfd2('0x26')][_0xcfd2('0x42')](_0x9cc99[_0xcfd2('0x43')],{})[_0xcfd2('0x3a')](respondWithResult(_0x43a95b,0xc9))[_0xcfd2('0x44')](handleError(_0x43a95b,null));};exports[_0xcfd2('0x45')]=function(_0x13c046,_0x1e4115){if(_0x13c046[_0xcfd2('0x43')]['id']){delete _0x13c046[_0xcfd2('0x43')]['id'];}return db[_0xcfd2('0x26')][_0xcfd2('0x41')]({'where':{'id':_0x13c046[_0xcfd2('0x46')]['id']}})['then'](handleEntityNotFound(_0x1e4115,null))[_0xcfd2('0x3a')](saveUpdates(_0x13c046[_0xcfd2('0x43')],null))['then'](respondWithResult(_0x1e4115,null))[_0xcfd2('0x44')](handleError(_0x1e4115,null));};exports['destroy']=function(_0x211aa3,_0x2e7b7e){return db[_0xcfd2('0x26')][_0xcfd2('0x41')]({'where':{'id':_0x211aa3[_0xcfd2('0x46')]['id']}})[_0xcfd2('0x3a')](handleEntityNotFound(_0x2e7b7e,null))[_0xcfd2('0x3a')](removeEntity(_0x2e7b7e,null))[_0xcfd2('0x44')](handleError(_0x2e7b7e,null));}; \ No newline at end of file +var _0xae6f=['intersection','fields','attributes','length','nolimit','order','sort','pick','where','merge','VIRTUAL','includeAll','include','ZendeskField','findAll','rows','show','params','options','find','catch','create','body','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','path','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','end','stack','name','send','map','rawAttributes','type','key','model','query','keys','filters'];(function(_0x4664db,_0x1de672){var _0x5615b4=function(_0x54fb5a){while(--_0x54fb5a){_0x4664db['push'](_0x4664db['shift']());}};_0x5615b4(++_0x1de672);}(_0xae6f,0xe3));var _0xfae6=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xae6f[_0x4b055c];return _0x4b62bb;};'use strict';var pdf=require(_0xfae6('0x0'));var emlformat=require(_0xfae6('0x1'));var rimraf=require(_0xfae6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfae6('0x3'));var rp=require('request-promise');var moment=require(_0xfae6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xfae6('0x5'));var util=require('util');var path=require(_0xfae6('0x6'));var sox=require('sox');var csv=require(_0xfae6('0x7'));var ejs=require(_0xfae6('0x8'));var fs=require('fs');var _=require(_0xfae6('0x9'));var squel=require(_0xfae6('0xa'));var crypto=require('crypto');var jsforce=require(_0xfae6('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xfae6('0x7'));var querystring=require(_0xfae6('0xc'));var Papa=require('papaparse');var Redis=require(_0xfae6('0xd'));var authService=require(_0xfae6('0xe'));var qs=require(_0xfae6('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfae6('0x10'));var logger=require(_0xfae6('0x11'))(_0xfae6('0x12'));var utils=require('../../config/utils');var config=require(_0xfae6('0x13'));var db=require(_0xfae6('0x14'))['db'];function respondWithStatusCode(_0x46e4af,_0x45c714){_0x45c714=_0x45c714||0xcc;return function(_0x2070c2){if(_0x2070c2){return _0x46e4af[_0xfae6('0x15')](_0x45c714);}return _0x46e4af[_0xfae6('0x16')](_0x45c714)['end']();};}function respondWithResult(_0x4993f9,_0x32972e){_0x32972e=_0x32972e||0xc8;return function(_0x35459c){if(_0x35459c){return _0x4993f9[_0xfae6('0x16')](_0x32972e)[_0xfae6('0x17')](_0x35459c);}};}function respondWithFilteredResult(_0x17fbb7,_0x246bc1){return function(_0x1a6ef6){if(_0x1a6ef6){var _0x41f4a8=_0x1a6ef6[_0xfae6('0x18')],_0x3f5b26=_0x246bc1['offset'],_0x59e0b8=_0x246bc1[_0xfae6('0x19')]+_0x246bc1[_0xfae6('0x1a')],_0x4a7e1e;if(_0x59e0b8>=_0x41f4a8){_0x59e0b8=_0x41f4a8;_0x4a7e1e=0xc8;}else{_0x4a7e1e=0xce;}_0x17fbb7[_0xfae6('0x16')](_0x4a7e1e);return _0x17fbb7['set'](_0xfae6('0x1b'),_0x3f5b26+'-'+_0x59e0b8+'/'+_0x41f4a8)[_0xfae6('0x17')](_0x1a6ef6);}return null;};}function patchUpdates(_0x1b5f0e){return function(_0x467b79){try{jsonpatch['apply'](_0x467b79,_0x1b5f0e,!![]);}catch(_0x3c5c5c){return BPromise[_0xfae6('0x1c')](_0x3c5c5c);}return _0x467b79[_0xfae6('0x1d')]();};}function saveUpdates(_0x8fa67c,_0x18afb6){return function(_0x162a76){if(_0x162a76){return _0x162a76[_0xfae6('0x1e')](_0x8fa67c)[_0xfae6('0x1f')](function(_0x1a181a){return _0x1a181a;});}return null;};}function removeEntity(_0x41d16c,_0x4495e4){return function(_0x5f4431){if(_0x5f4431){return _0x5f4431[_0xfae6('0x20')]()[_0xfae6('0x1f')](function(){_0x41d16c['status'](0xcc)[_0xfae6('0x21')]();});}};}function handleEntityNotFound(_0x103d22,_0x544f5e){return function(_0x4a36eb){if(!_0x4a36eb){_0x103d22[_0xfae6('0x15')](0x194);}return _0x4a36eb;};}function handleError(_0xa8b7f5,_0x5e350d){_0x5e350d=_0x5e350d||0x1f4;return function(_0x5e1189){logger['error'](_0x5e1189[_0xfae6('0x22')]);if(_0x5e1189['name']){delete _0x5e1189[_0xfae6('0x23')];}_0xa8b7f5['status'](_0x5e350d)[_0xfae6('0x24')](_0x5e1189);};}exports['index']=function(_0x39e7f6,_0xf48da1){var _0x129369={},_0x2b69b0={},_0x47e3aa={'count':0x0,'rows':[]};var _0x359dd1=_[_0xfae6('0x25')](db['ZendeskField'][_0xfae6('0x26')],function(_0x45204b){return{'name':_0x45204b['fieldName'],'type':_0x45204b[_0xfae6('0x27')][_0xfae6('0x28')]};});_0x2b69b0[_0xfae6('0x29')]=_[_0xfae6('0x25')](_0x359dd1,_0xfae6('0x23'));_0x2b69b0[_0xfae6('0x2a')]=_[_0xfae6('0x2b')](_0x39e7f6[_0xfae6('0x2a')]);_0x2b69b0[_0xfae6('0x2c')]=_[_0xfae6('0x2d')](_0x2b69b0[_0xfae6('0x29')],_0x2b69b0[_0xfae6('0x2a')]);_0x129369['attributes']=_[_0xfae6('0x2d')](_0x2b69b0[_0xfae6('0x29')],qs[_0xfae6('0x2e')](_0x39e7f6[_0xfae6('0x2a')][_0xfae6('0x2e')]));_0x129369[_0xfae6('0x2f')]=_0x129369['attributes'][_0xfae6('0x30')]?_0x129369[_0xfae6('0x2f')]:_0x2b69b0[_0xfae6('0x29')];if(!_0x39e7f6['query']['hasOwnProperty'](_0xfae6('0x31'))){_0x129369[_0xfae6('0x1a')]=qs[_0xfae6('0x1a')](_0x39e7f6[_0xfae6('0x2a')][_0xfae6('0x1a')]);_0x129369[_0xfae6('0x19')]=qs['offset'](_0x39e7f6[_0xfae6('0x2a')][_0xfae6('0x19')]);}_0x129369[_0xfae6('0x32')]=qs[_0xfae6('0x33')](_0x39e7f6['query'][_0xfae6('0x33')]);_0x129369['where']=qs[_0xfae6('0x2c')](_[_0xfae6('0x34')](_0x39e7f6['query'],_0x2b69b0[_0xfae6('0x2c')]),_0x359dd1);if(_0x39e7f6[_0xfae6('0x2a')]['filter']){_0x129369[_0xfae6('0x35')]=_[_0xfae6('0x36')](_0x129369['where'],{'$or':_[_0xfae6('0x25')](_0x359dd1,function(_0x15d10a){if(_0x15d10a['type']!==_0xfae6('0x37')){var _0x2afdb6={};_0x2afdb6[_0x15d10a[_0xfae6('0x23')]]={'$like':'%'+_0x39e7f6[_0xfae6('0x2a')]['filter']+'%'};return _0x2afdb6;}})});}_0x129369=_[_0xfae6('0x36')]({},_0x129369,_0x39e7f6['options']);var _0x1a852b={'where':_0x129369['where']};return db['ZendeskField'][_0xfae6('0x18')](_0x1a852b)['then'](function(_0x41764c){_0x47e3aa['count']=_0x41764c;if(_0x39e7f6['query'][_0xfae6('0x38')]){_0x129369[_0xfae6('0x39')]=[{'all':!![]}];}return db[_0xfae6('0x3a')][_0xfae6('0x3b')](_0x129369);})[_0xfae6('0x1f')](function(_0xa408cf){_0x47e3aa[_0xfae6('0x3c')]=_0xa408cf;return _0x47e3aa;})[_0xfae6('0x1f')](respondWithFilteredResult(_0xf48da1,_0x129369))['catch'](handleError(_0xf48da1,null));};exports[_0xfae6('0x3d')]=function(_0x48a060,_0x814a37){var _0x533e1f={'raw':!![],'where':{'id':_0x48a060[_0xfae6('0x3e')]['id']}},_0x244e06={};_0x244e06[_0xfae6('0x29')]=_[_0xfae6('0x2b')](db[_0xfae6('0x3a')][_0xfae6('0x26')]);_0x244e06[_0xfae6('0x2a')]=_[_0xfae6('0x2b')](_0x48a060[_0xfae6('0x2a')]);_0x244e06[_0xfae6('0x2c')]=_[_0xfae6('0x2d')](_0x244e06['model'],_0x244e06[_0xfae6('0x2a')]);_0x533e1f['attributes']=_[_0xfae6('0x2d')](_0x244e06[_0xfae6('0x29')],qs[_0xfae6('0x2e')](_0x48a060[_0xfae6('0x2a')][_0xfae6('0x2e')]));_0x533e1f[_0xfae6('0x2f')]=_0x533e1f[_0xfae6('0x2f')][_0xfae6('0x30')]?_0x533e1f[_0xfae6('0x2f')]:_0x244e06[_0xfae6('0x29')];if(_0x48a060[_0xfae6('0x2a')][_0xfae6('0x38')]){_0x533e1f[_0xfae6('0x39')]=[{'all':!![]}];}_0x533e1f=_['merge']({},_0x533e1f,_0x48a060[_0xfae6('0x3f')]);return db[_0xfae6('0x3a')][_0xfae6('0x40')](_0x533e1f)[_0xfae6('0x1f')](handleEntityNotFound(_0x814a37,null))[_0xfae6('0x1f')](respondWithResult(_0x814a37,null))[_0xfae6('0x41')](handleError(_0x814a37,null));};exports[_0xfae6('0x42')]=function(_0x2cd046,_0x452c74){return db[_0xfae6('0x3a')][_0xfae6('0x42')](_0x2cd046['body'],{})[_0xfae6('0x1f')](respondWithResult(_0x452c74,0xc9))[_0xfae6('0x41')](handleError(_0x452c74,null));};exports[_0xfae6('0x1e')]=function(_0x4ac58c,_0xc256f8){if(_0x4ac58c['body']['id']){delete _0x4ac58c[_0xfae6('0x43')]['id'];}return db[_0xfae6('0x3a')][_0xfae6('0x40')]({'where':{'id':_0x4ac58c['params']['id']}})['then'](handleEntityNotFound(_0xc256f8,null))[_0xfae6('0x1f')](saveUpdates(_0x4ac58c['body'],null))['then'](respondWithResult(_0xc256f8,null))[_0xfae6('0x41')](handleError(_0xc256f8,null));};exports[_0xfae6('0x20')]=function(_0x3347ea,_0x26caf6){return db['ZendeskField'][_0xfae6('0x40')]({'where':{'id':_0x3347ea[_0xfae6('0x3e')]['id']}})[_0xfae6('0x1f')](handleEntityNotFound(_0x26caf6,null))[_0xfae6('0x1f')](removeEntity(_0x26caf6,null))['catch'](handleError(_0x26caf6,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index b74a6a5..24f5c41 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 _0xaf4c=['zendesk_unique_index','idField','FieldId','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskField.attributes','define','ZendeskField','int_zendesk_fields'];(function(_0x102881,_0x58d723){var _0x5c63d0=function(_0x955c59){while(--_0x955c59){_0x102881['push'](_0x102881['shift']());}};_0x5c63d0(++_0x58d723);}(_0xaf4c,0x1ed));var _0xcaf4=function(_0x21bf82,_0x548558){_0x21bf82=_0x21bf82-0x0;var _0x2e837c=_0xaf4c[_0x21bf82];return _0x2e837c;};'use strict';var _=require('lodash');var util=require(_0xcaf4('0x0'));var logger=require(_0xcaf4('0x1'))('api');var moment=require(_0xcaf4('0x2'));var BPromise=require(_0xcaf4('0x3'));var rp=require(_0xcaf4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcaf4('0x5'));var config=require(_0xcaf4('0x6'));var attributes=require(_0xcaf4('0x7'));module['exports']=function(_0x21ad95,_0x548527){return _0x21ad95[_0xcaf4('0x8')](_0xcaf4('0x9'),attributes,{'tableName':_0xcaf4('0xa'),'paranoid':![],'indexes':[{'name':_0xcaf4('0xb'),'fields':[_0xcaf4('0xc'),_0xcaf4('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4345=['./intZendeskField.attributes','exports','define','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x49ef81,_0x5d3fd2){var _0x2e74b7=function(_0x57af59){while(--_0x57af59){_0x49ef81['push'](_0x49ef81['shift']());}};_0x2e74b7(++_0x5d3fd2);}(_0x4345,0x77));var _0x5434=function(_0x1dff03,_0x1548bb){_0x1dff03=_0x1dff03-0x0;var _0x22906e=_0x4345[_0x1dff03];return _0x22906e;};'use strict';var _=require(_0x5434('0x0'));var util=require(_0x5434('0x1'));var logger=require('../../config/logger')(_0x5434('0x2'));var moment=require(_0x5434('0x3'));var BPromise=require(_0x5434('0x4'));var rp=require(_0x5434('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5434('0x6'));var config=require('../../config/environment');var attributes=require(_0x5434('0x7'));module[_0x5434('0x8')]=function(_0x14d339,_0x5001cc){return _0x14d339[_0x5434('0x9')]('ZendeskField',attributes,{'tableName':_0x5434('0xa'),'paranoid':![],'indexes':[{'name':_0x5434('0xb'),'fields':[_0x5434('0xc'),_0x5434('0xd')],'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 aaee007..a46f720 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 _0x1399=['ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info'];(function(_0x37de3d,_0x4393d3){var _0x3aa726=function(_0x5d8fb0){while(--_0x5d8fb0){_0x37de3d['push'](_0x37de3d['shift']());}};_0x3aa726(++_0x4393d3);}(_0x1399,0xbe));var _0x9139=function(_0xe3cfba,_0x14d39e){_0xe3cfba=_0xe3cfba-0x0;var _0x3feb92=_0x1399[_0xe3cfba];return _0x3feb92;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x9139('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9139('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x9139('0x2'));var logger=require('../../config/logger')(_0x9139('0x3'));var config=require(_0x9139('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x9139('0x5')][_0x9139('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x35cb49,_0x2832a9,_0x96e1e5){return new BPromise(function(_0x3e0af4,_0x5c7f9e){return client[_0x9139('0x7')](_0x35cb49,_0x96e1e5)[_0x9139('0x8')](function(_0x1bccd9){logger[_0x9139('0x9')](_0x9139('0xa'),_0x2832a9,_0x9139('0xb'));logger[_0x9139('0xc')](_0x9139('0xd'),_0x2832a9,_0x9139('0xb'),JSON[_0x9139('0xe')](_0x1bccd9));if(_0x1bccd9['error']){if(_0x1bccd9[_0x9139('0xf')][_0x9139('0x10')]===0x1f4){logger[_0x9139('0xf')](_0x9139('0xa'),_0x2832a9,_0x1bccd9[_0x9139('0xf')][_0x9139('0x11')]);return _0x5c7f9e(_0x1bccd9['error'][_0x9139('0x11')]);}logger['error'](_0x9139('0xa'),_0x2832a9,_0x1bccd9[_0x9139('0xf')][_0x9139('0x11')]);return _0x3e0af4(_0x1bccd9[_0x9139('0xf')]['message']);}else{logger[_0x9139('0x9')](_0x9139('0xa'),_0x2832a9,_0x9139('0xb'));_0x3e0af4(_0x1bccd9[_0x9139('0x12')][_0x9139('0x11')]);}})[_0x9139('0x13')](function(_0xbcccd1){logger['error'](_0x9139('0xa'),_0x2832a9,_0xbcccd1);_0x5c7f9e(_0xbcccd1);});});} \ No newline at end of file +var _0xeb22=['../../config/logger','../../config/environment','jayson/promise','client','then','info','ZendeskField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0xeb22,0xbf));var _0x2eb2=function(_0x4d9d1e,_0x3c2d20){_0x4d9d1e=_0x4d9d1e-0x0;var _0x1b9d54=_0xeb22[_0x4d9d1e];return _0x1b9d54;};'use strict';var _=require(_0x2eb2('0x0'));var util=require('util');var moment=require(_0x2eb2('0x1'));var BPromise=require(_0x2eb2('0x2'));var rs=require(_0x2eb2('0x3'));var fs=require('fs');var Redis=require(_0x2eb2('0x4'));var db=require(_0x2eb2('0x5'))['db'];var utils=require(_0x2eb2('0x6'));var logger=require(_0x2eb2('0x7'))('rpc');var config=require(_0x2eb2('0x8'));var jayson=require(_0x2eb2('0x9'));var client=jayson[_0x2eb2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x266aee,_0x1057e9,_0xe225e){return new BPromise(function(_0x289be5,_0x547299){return client['request'](_0x266aee,_0xe225e)[_0x2eb2('0xb')](function(_0x13c60b){logger[_0x2eb2('0xc')](_0x2eb2('0xd'),_0x1057e9,'request\x20sent');logger[_0x2eb2('0xe')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x1057e9,_0x2eb2('0xf'),JSON[_0x2eb2('0x10')](_0x13c60b));if(_0x13c60b['error']){if(_0x13c60b[_0x2eb2('0x11')][_0x2eb2('0x12')]===0x1f4){logger['error'](_0x2eb2('0xd'),_0x1057e9,_0x13c60b[_0x2eb2('0x11')][_0x2eb2('0x13')]);return _0x547299(_0x13c60b[_0x2eb2('0x11')][_0x2eb2('0x13')]);}logger['error'](_0x2eb2('0xd'),_0x1057e9,_0x13c60b[_0x2eb2('0x11')][_0x2eb2('0x13')]);return _0x289be5(_0x13c60b['error'][_0x2eb2('0x13')]);}else{logger[_0x2eb2('0xc')](_0x2eb2('0xd'),_0x1057e9,'request\x20sent');_0x289be5(_0x13c60b[_0x2eb2('0x14')]['message']);}})[_0x2eb2('0x15')](function(_0x280d03){logger[_0x2eb2('0x11')](_0x2eb2('0xd'),_0x1057e9,_0x280d03);_0x547299(_0x280d03);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 9464d52..dfb4668 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 _0x3258=['express','Router','../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller','isAuthenticated','get','/:id','/:id/configurations','getConfigurations','post','create','addConfiguration','update','delete','destroy','exports','multer','util'];(function(_0x2093d1,_0x3f9327){var _0x4c9762=function(_0x37b54f){while(--_0x37b54f){_0x2093d1['push'](_0x2093d1['shift']());}};_0x4c9762(++_0x3f9327);}(_0x3258,0x1ec));var _0x8325=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3258[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x8325('0x0'));var util=require(_0x8325('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8325('0x2'));var router=express[_0x8325('0x3')]();var auth=require(_0x8325('0x4'));var interaction=require(_0x8325('0x5'));var config=require('../../config/environment');var controller=require(_0x8325('0x6'));router['get']('/',auth[_0x8325('0x7')](),controller['index']);router[_0x8325('0x8')](_0x8325('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x8325('0x8')](_0x8325('0xa'),auth['isAuthenticated'](),controller[_0x8325('0xb')]);router[_0x8325('0x8')]('/:id/fields',auth[_0x8325('0x7')](),controller['getFields']);router[_0x8325('0xc')]('/',auth['isAuthenticated'](),controller[_0x8325('0xd')]);router[_0x8325('0xc')](_0x8325('0xa'),auth[_0x8325('0x7')](),controller[_0x8325('0xe')]);router['put'](_0x8325('0x9'),auth['isAuthenticated'](),controller[_0x8325('0xf')]);router[_0x8325('0x10')](_0x8325('0x9'),auth['isAuthenticated'](),controller[_0x8325('0x11')]);module[_0x8325('0x12')]=router; \ No newline at end of file +var _0xaf55=['/:id/configurations','put','delete','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','create','post'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0xaf55,0xd5));var _0x5af5=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0xaf55[_0x556bb1];return _0x45455f;};'use strict';var multer=require(_0x5af5('0x0'));var util=require(_0x5af5('0x1'));var path=require(_0x5af5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5af5('0x3')]();var auth=require(_0x5af5('0x4'));var interaction=require(_0x5af5('0x5'));var config=require('../../config/environment');var controller=require(_0x5af5('0x6'));router[_0x5af5('0x7')]('/',auth[_0x5af5('0x8')](),controller[_0x5af5('0x9')]);router[_0x5af5('0x7')](_0x5af5('0xa'),auth[_0x5af5('0x8')](),controller['show']);router[_0x5af5('0x7')]('/:id/configurations',auth[_0x5af5('0x8')](),controller['getConfigurations']);router['get'](_0x5af5('0xb'),auth[_0x5af5('0x8')](),controller[_0x5af5('0xc')]);router['post']('/',auth[_0x5af5('0x8')](),controller[_0x5af5('0xd')]);router[_0x5af5('0xe')](_0x5af5('0xf'),auth[_0x5af5('0x8')](),controller['addConfiguration']);router[_0x5af5('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x5af5('0x11')](_0x5af5('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x5af5('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 13c36e4..5cb8403 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 _0xfb1a=['exports','STRING','sequelize'];(function(_0x29638f,_0x5dfb8a){var _0x4c2121=function(_0x4d32ea){while(--_0x4d32ea){_0x29638f['push'](_0x29638f['shift']());}};_0x4c2121(++_0x5dfb8a);}(_0xfb1a,0x131));var _0xafb1=function(_0xb70040,_0x45702a){_0xb70040=_0xb70040-0x0;var _0x3cc22a=_0xfb1a[_0xb70040];return _0x3cc22a;};'use strict';var Sequelize=require(_0xafb1('0x0'));module[_0xafb1('0x1')]={'name':{'type':Sequelize[_0xafb1('0x2')]},'description':{'type':Sequelize[_0xafb1('0x2')]},'host':{'type':Sequelize[_0xafb1('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xafb1('0x2')]},'clientSecret':{'type':Sequelize[_0xafb1('0x2')]},'serverUrl':{'type':Sequelize[_0xafb1('0x2')]},'code':{'type':Sequelize[_0xafb1('0x2')]},'refreshToken':{'type':Sequelize[_0xafb1('0x2')]}}; \ No newline at end of file +var _0xaf39=['STRING','exports'];(function(_0x4db49d,_0x27014e){var _0x1ebd33=function(_0x29b337){while(--_0x29b337){_0x4db49d['push'](_0x4db49d['shift']());}};_0x1ebd33(++_0x27014e);}(_0xaf39,0x13f));var _0x9af3=function(_0x27906a,_0x3d58c8){_0x27906a=_0x27906a-0x0;var _0x3c956b=_0xaf39[_0x27906a];return _0x3c956b;};'use strict';var Sequelize=require('sequelize');module[_0x9af3('0x0')]={'name':{'type':Sequelize[_0x9af3('0x1')]},'description':{'type':Sequelize[_0x9af3('0x1')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x9af3('0x1')]},'clientId':{'type':Sequelize[_0x9af3('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x9af3('0x1')]},'code':{'type':Sequelize[_0x9af3('0x1')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 230382e..bfce8f0 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 _0x075e=['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','ZohoAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','end','sendStatus','stack','name','send','index','map','ZohoAccount','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','catch','show','rawAttributes','find','create','body','params','getConfigurations','findOne','ZohoConfiguration','pick','addConfiguration','Subjects','getSubjects','channel','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','zoho.eu','com','slice','substring','GET','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Type','remove','api_name','system_mandatory','push','display_label','custom_field','data_type','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client'];(function(_0x5b072d,_0x2fdcf2){var _0xe8576d=function(_0x189960){while(--_0x189960){_0x5b072d['push'](_0x5b072d['shift']());}};_0xe8576d(++_0x2fdcf2);}(_0x075e,0x17b));var _0xe075=function(_0x553aa6,_0x1cdd15){_0x553aa6=_0x553aa6-0x0;var _0x380951=_0x075e[_0x553aa6];return _0x380951;};'use strict';var pdf=require(_0xe075('0x0'));var emlformat=require(_0xe075('0x1'));var rimraf=require(_0xe075('0x2'));var zipdir=require(_0xe075('0x3'));var jsonpatch=require(_0xe075('0x4'));var rp=require('request-promise');var moment=require(_0xe075('0x5'));var BPromise=require(_0xe075('0x6'));var Mustache=require(_0xe075('0x7'));var util=require('util');var path=require(_0xe075('0x8'));var sox=require(_0xe075('0x9'));var csv=require(_0xe075('0xa'));var ejs=require(_0xe075('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe075('0xc'));var crypto=require('crypto');var jsforce=require(_0xe075('0xd'));var deskjs=require(_0xe075('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe075('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe075('0x10'))(_0xe075('0x11'));var utils=require('../../config/utils');var config=require(_0xe075('0x12'));var db=require(_0xe075('0x13'))['db'];var integrations=require(_0xe075('0x14'));var jayson=require(_0xe075('0x15'));var client=jayson[_0xe075('0x16')][_0xe075('0x17')]({'port':0x232a});function checkPasswordPattern(_0x147962,_0x542b48,_0x6ff50f){if(_0x6ff50f){var _0x107e8f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x107e8f[_0xe075('0x18')](_0x542b48)){return _0x147962;}else{throw new db[(_0xe075('0x19'))][(_0xe075('0x1a'))](_0xe075('0x1b'));}}else{return _0x147962;}}function respondWithRpcPromise(_0x2c048b,_0x5818d6,_0x4af8af,_0x55267c){return new BPromise(function(_0x1daa1c,_0x536197){var _0x2e2140=_0x55267c||client;return _0x2e2140[_0xe075('0x1c')](_0x2c048b,_0x4af8af)['then'](function(_0xb4860){logger[_0xe075('0x1d')](_0xe075('0x1e'),_0x5818d6,'request\x20sent');logger[_0xe075('0x1f')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x5818d6,_0xe075('0x20'),JSON[_0xe075('0x21')](_0xb4860));if(_0xb4860[_0xe075('0x22')]){if(_0xb4860[_0xe075('0x22')][_0xe075('0x23')]===0x1f4){logger[_0xe075('0x22')](_0xe075('0x1e'),_0x5818d6,_0xb4860[_0xe075('0x22')][_0xe075('0x24')]);return _0x536197(_0xb4860[_0xe075('0x22')][_0xe075('0x24')]);}logger[_0xe075('0x22')](_0xe075('0x1e'),_0x5818d6,_0xb4860[_0xe075('0x22')]['message']);return _0x1daa1c(_0xb4860['error']['message']);}else{logger[_0xe075('0x1d')]('ZohoAccount,\x20%s,\x20%s',_0x5818d6,'request\x20sent');_0x1daa1c(_0xb4860['result']['message']);}})['catch'](function(_0x6d753d){logger[_0xe075('0x22')](_0xe075('0x1e'),_0x5818d6,_0x6d753d);_0x536197(_0x6d753d);});});}function respondWithStatusCode(_0xbf8536,_0x139c5c){_0x139c5c=_0x139c5c||0xcc;return function(_0x257a6f){if(_0x257a6f){return _0xbf8536['sendStatus'](_0x139c5c);}return _0xbf8536[_0xe075('0x25')](_0x139c5c)['end']();};}function respondWithResult(_0x3ae7b9,_0x5367bd){_0x5367bd=_0x5367bd||0xc8;return function(_0x4d3abf){if(_0x4d3abf){return _0x3ae7b9['status'](_0x5367bd)[_0xe075('0x26')](_0x4d3abf);}};}function respondWithFilteredResult(_0x3d1ca1,_0x52278d){return function(_0x83cb2c){if(_0x83cb2c){var _0x57f585=_0x83cb2c[_0xe075('0x27')],_0x316871=_0x52278d[_0xe075('0x28')],_0x1903b1=_0x52278d[_0xe075('0x28')]+_0x52278d[_0xe075('0x29')],_0x200a8f;if(_0x1903b1>=_0x57f585){_0x1903b1=_0x57f585;_0x200a8f=0xc8;}else{_0x200a8f=0xce;}_0x3d1ca1['status'](_0x200a8f);return _0x3d1ca1[_0xe075('0x2a')](_0xe075('0x2b'),_0x316871+'-'+_0x1903b1+'/'+_0x57f585)['json'](_0x83cb2c);}return null;};}function patchUpdates(_0x5778fc){return function(_0x3c7e89){try{jsonpatch['apply'](_0x3c7e89,_0x5778fc,!![]);}catch(_0xf0e73a){return BPromise[_0xe075('0x2c')](_0xf0e73a);}return _0x3c7e89[_0xe075('0x2d')]();};}function saveUpdates(_0xd3e43d,_0x3e4ae2){return function(_0x47c219){if(_0x47c219){return _0x47c219[_0xe075('0x2e')](_0xd3e43d)[_0xe075('0x2f')](function(_0x38c8f0){return _0x38c8f0;});}return null;};}function removeEntity(_0x967d43,_0x12603d){return function(_0x2b5c90){if(_0x2b5c90){return _0x2b5c90[_0xe075('0x30')]()['then'](function(){_0x967d43[_0xe075('0x25')](0xcc)[_0xe075('0x31')]();});}};}function handleEntityNotFound(_0x1f6c3d,_0x3c92cc){return function(_0x4b0666){if(!_0x4b0666){_0x1f6c3d[_0xe075('0x32')](0x194);}return _0x4b0666;};}function handleError(_0xb1566b,_0x1b068a){_0x1b068a=_0x1b068a||0x1f4;return function(_0xa52288){logger[_0xe075('0x22')](_0xa52288[_0xe075('0x33')]);if(_0xa52288[_0xe075('0x34')]){delete _0xa52288['name'];}_0xb1566b['status'](_0x1b068a)[_0xe075('0x35')](_0xa52288);};}exports[_0xe075('0x36')]=function(_0x558b8a,_0x66746b){var _0x13e640={},_0xa4a20c={},_0x41e0a7={'count':0x0,'rows':[]};var _0x10ccab=_[_0xe075('0x37')](db[_0xe075('0x38')]['rawAttributes'],function(_0x372a36){return{'name':_0x372a36[_0xe075('0x39')],'type':_0x372a36[_0xe075('0x3a')][_0xe075('0x3b')]};});_0xa4a20c['model']=_['map'](_0x10ccab,_0xe075('0x34'));_0xa4a20c['query']=_[_0xe075('0x3c')](_0x558b8a[_0xe075('0x3d')]);_0xa4a20c['filters']=_[_0xe075('0x3e')](_0xa4a20c[_0xe075('0x3f')],_0xa4a20c[_0xe075('0x3d')]);_0x13e640[_0xe075('0x40')]=_[_0xe075('0x3e')](_0xa4a20c[_0xe075('0x3f')],qs[_0xe075('0x41')](_0x558b8a['query']['fields']));_0x13e640[_0xe075('0x40')]=_0x13e640[_0xe075('0x40')][_0xe075('0x42')]?_0x13e640[_0xe075('0x40')]:_0xa4a20c[_0xe075('0x3f')];if(!_0x558b8a[_0xe075('0x3d')][_0xe075('0x43')](_0xe075('0x44'))){_0x13e640[_0xe075('0x29')]=qs[_0xe075('0x29')](_0x558b8a[_0xe075('0x3d')][_0xe075('0x29')]);_0x13e640[_0xe075('0x28')]=qs['offset'](_0x558b8a[_0xe075('0x3d')][_0xe075('0x28')]);}_0x13e640[_0xe075('0x45')]=qs[_0xe075('0x46')](_0x558b8a[_0xe075('0x3d')][_0xe075('0x46')]);_0x13e640['where']=qs[_0xe075('0x47')](_['pick'](_0x558b8a['query'],_0xa4a20c[_0xe075('0x47')]),_0x10ccab);if(_0x558b8a[_0xe075('0x3d')][_0xe075('0x48')]){_0x13e640[_0xe075('0x49')]=_[_0xe075('0x4a')](_0x13e640['where'],{'$or':_[_0xe075('0x37')](_0x10ccab,function(_0x400431){if(_0x400431['type']!==_0xe075('0x4b')){var _0x98fbb4={};_0x98fbb4[_0x400431[_0xe075('0x34')]]={'$like':'%'+_0x558b8a[_0xe075('0x3d')][_0xe075('0x48')]+'%'};return _0x98fbb4;}})});}_0x13e640=_[_0xe075('0x4a')]({},_0x13e640,_0x558b8a[_0xe075('0x4c')]);var _0x1176e7={'where':_0x13e640[_0xe075('0x49')]};return db[_0xe075('0x38')][_0xe075('0x27')](_0x1176e7)[_0xe075('0x2f')](function(_0x4669a9){_0x41e0a7['count']=_0x4669a9;if(_0x558b8a[_0xe075('0x3d')][_0xe075('0x4d')]){_0x13e640[_0xe075('0x4e')]=[{'all':!![]}];}return db['ZohoAccount']['findAll'](_0x13e640);})[_0xe075('0x2f')](function(_0x150853){_0x41e0a7['rows']=_0x150853;return _0x41e0a7;})['then'](respondWithFilteredResult(_0x66746b,_0x13e640))[_0xe075('0x4f')](handleError(_0x66746b,null));};exports[_0xe075('0x50')]=function(_0x376591,_0x2f5814){var _0x153806={'raw':![],'where':{'id':_0x376591['params']['id']}},_0xecaaf5={};_0xecaaf5[_0xe075('0x3f')]=_[_0xe075('0x3c')](db[_0xe075('0x38')][_0xe075('0x51')]);_0xecaaf5[_0xe075('0x3d')]=_['keys'](_0x376591['query']);_0xecaaf5['filters']=_['intersection'](_0xecaaf5[_0xe075('0x3f')],_0xecaaf5['query']);_0x153806[_0xe075('0x40')]=_['intersection'](_0xecaaf5[_0xe075('0x3f')],qs['fields'](_0x376591[_0xe075('0x3d')][_0xe075('0x41')]));_0x153806[_0xe075('0x40')]=_0x153806[_0xe075('0x40')][_0xe075('0x42')]?_0x153806['attributes']:_0xecaaf5[_0xe075('0x3f')];if(_0x376591[_0xe075('0x3d')][_0xe075('0x4d')]){_0x153806[_0xe075('0x4e')]=[{'all':!![]}];}_0x153806=_['merge']({},_0x153806,_0x376591[_0xe075('0x4c')]);return db[_0xe075('0x38')][_0xe075('0x52')](_0x153806)[_0xe075('0x2f')](handleEntityNotFound(_0x2f5814,null))[_0xe075('0x2f')](respondWithResult(_0x2f5814,null))['catch'](handleError(_0x2f5814,null));};exports[_0xe075('0x53')]=function(_0x15e9c2,_0x28b5e3){return db[_0xe075('0x38')][_0xe075('0x53')](_0x15e9c2[_0xe075('0x54')],{})['then'](respondWithResult(_0x28b5e3,0xc9))['catch'](handleError(_0x28b5e3,null));};exports[_0xe075('0x2e')]=function(_0x1d5e14,_0x4f8147){if(_0x1d5e14['body']['id']){delete _0x1d5e14[_0xe075('0x54')]['id'];}return db[_0xe075('0x38')]['find']({'where':{'id':_0x1d5e14[_0xe075('0x55')]['id']}})['then'](handleEntityNotFound(_0x4f8147,null))[_0xe075('0x2f')](saveUpdates(_0x1d5e14[_0xe075('0x54')],null))[_0xe075('0x2f')](respondWithResult(_0x4f8147,null))['catch'](handleError(_0x4f8147,null));};exports[_0xe075('0x30')]=function(_0x1e15ed,_0x19c1fb){return db[_0xe075('0x38')]['find']({'where':{'id':_0x1e15ed['params']['id']}})[_0xe075('0x2f')](handleEntityNotFound(_0x19c1fb,null))[_0xe075('0x2f')](removeEntity(_0x19c1fb,null))[_0xe075('0x4f')](handleError(_0x19c1fb,null));};exports[_0xe075('0x56')]=function(_0x1c8ffd,_0x127b19,_0x211b91){var _0x17b437={};var _0x514432={};var _0x3d9c8b;var _0x9f042d;return db[_0xe075('0x38')][_0xe075('0x57')]({'where':{'id':_0x1c8ffd[_0xe075('0x55')]['id']}})[_0xe075('0x2f')](handleEntityNotFound(_0x127b19,null))[_0xe075('0x2f')](function(_0xcfeb07){if(_0xcfeb07){_0x3d9c8b=_0xcfeb07;_0x514432['model']=_[_0xe075('0x3c')](db[_0xe075('0x58')][_0xe075('0x51')]);_0x514432['query']=_[_0xe075('0x3c')](_0x1c8ffd['query']);_0x514432[_0xe075('0x47')]=_['intersection'](_0x514432[_0xe075('0x3f')],_0x514432[_0xe075('0x3d')]);_0x17b437[_0xe075('0x40')]=_[_0xe075('0x3e')](_0x514432[_0xe075('0x3f')],qs[_0xe075('0x41')](_0x1c8ffd[_0xe075('0x3d')][_0xe075('0x41')]));_0x17b437[_0xe075('0x40')]=_0x17b437[_0xe075('0x40')]['length']?_0x17b437['attributes']:_0x514432[_0xe075('0x3f')];_0x17b437[_0xe075('0x45')]=qs['sort'](_0x1c8ffd['query'][_0xe075('0x46')]);_0x17b437[_0xe075('0x49')]=qs[_0xe075('0x47')](_[_0xe075('0x59')](_0x1c8ffd['query'],_0x514432['filters']));if(_0x1c8ffd[_0xe075('0x3d')][_0xe075('0x48')]){_0x17b437[_0xe075('0x49')]=_[_0xe075('0x4a')](_0x17b437['where'],{'$or':_[_0xe075('0x37')](_0x17b437[_0xe075('0x40')],function(_0x2987f8){var _0x3a43bc={};_0x3a43bc[_0x2987f8]={'$like':'%'+_0x1c8ffd['query'][_0xe075('0x48')]+'%'};return _0x3a43bc;})});}_0x17b437=_[_0xe075('0x4a')]({},_0x17b437,_0x1c8ffd[_0xe075('0x4c')]);return _0x3d9c8b[_0xe075('0x56')](_0x17b437);}})[_0xe075('0x2f')](function(_0x37c91f){if(_0x37c91f){_0x9f042d=_0x37c91f['length'];if(!_0x1c8ffd[_0xe075('0x3d')]['hasOwnProperty']('nolimit')){_0x17b437[_0xe075('0x29')]=qs[_0xe075('0x29')](_0x1c8ffd[_0xe075('0x3d')][_0xe075('0x29')]);_0x17b437[_0xe075('0x28')]=qs[_0xe075('0x28')](_0x1c8ffd[_0xe075('0x3d')][_0xe075('0x28')]);}return _0x3d9c8b['getConfigurations'](_0x17b437);}})[_0xe075('0x2f')](function(_0x373a29){if(_0x373a29){return _0x373a29?{'count':_0x9f042d,'rows':_0x373a29}:null;}})['then'](respondWithResult(_0x127b19,null))[_0xe075('0x4f')](handleError(_0x127b19,null));};exports[_0xe075('0x5a')]=function(_0x2e6338,_0x537396,_0x3331f3){if(_0x2e6338[_0xe075('0x54')]['id']){delete _0x2e6338[_0xe075('0x54')]['id'];}return db[_0xe075('0x38')][_0xe075('0x57')]({'where':{'id':_0x2e6338[_0xe075('0x55')]['id']}})[_0xe075('0x2f')](handleEntityNotFound(_0x537396,null))['then'](function(_0x2a9e87){if(_0x2a9e87){_0x2e6338['body']['AccountId']=_0x2a9e87['id'];_0x2e6338[_0xe075('0x54')][_0xe075('0x5b')]=integrations[_0xe075('0x5c')](_0x2e6338[_0xe075('0x54')][_0xe075('0x5d')],_0x2e6338[_0xe075('0x54')][_0xe075('0x3a')]);_0x2e6338['body']['Descriptions']=integrations['getDescriptions'](_0x2e6338['body'][_0xe075('0x5d')],_0x2e6338[_0xe075('0x54')][_0xe075('0x3a')]);return db['ZohoConfiguration'][_0xe075('0x53')](_0x2e6338[_0xe075('0x54')],{'include':[{'model':db[_0xe075('0x5e')],'as':'Subjects'},{'model':db[_0xe075('0x5e')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x537396,null))['catch'](handleError(_0x537396,null));};function getAccessToken(_0x4d6d73){return new Promise(function(_0x3dec87,_0x58df42){var _0x84d8ec;switch(_0x4d6d73[_0xe075('0x5f')]){case'US':_0x84d8ec=_0xe075('0x60');break;case'AU':_0x84d8ec='https://accounts.zoho.com.au';break;case'EU':_0x84d8ec=_0xe075('0x61');break;case'IN':_0x84d8ec=_0xe075('0x62');break;case'CN':_0x84d8ec=_0xe075('0x63');break;default:_0x84d8ec=_0xe075('0x61');break;}var _0xa85506={'method':_0xe075('0x64'),'uri':_0x84d8ec+_0xe075('0x65'),'qs':{'refresh_token':_0x4d6d73[_0xe075('0x66')],'client_id':_0x4d6d73[_0xe075('0x67')],'client_secret':_0x4d6d73[_0xe075('0x68')],'grant_type':_0xe075('0x69')},'json':!![]};return rp(_0xa85506)[_0xe075('0x2f')](function(_0xb40e95){if(_0xb40e95[_0xe075('0x6a')]){_0x3dec87(_0xb40e95['access_token']);}else{_0x58df42(_0xe075('0x6b'));}})[_0xe075('0x4f')](function(_0xc41274){_0x58df42(_0xc41274);});});}exports[_0xe075('0x6c')]=function(_0x4c6470,_0x1775f6,_0x5ae181){var _0x4ee38d,_0x3744a7,_0x2d5e3a,_0x4e74b9,_0x25d9e9;return db[_0xe075('0x38')][_0xe075('0x57')]({'where':{'id':_0x4c6470[_0xe075('0x55')]['id']},'attributes':['id','host',_0xe075('0x5f'),_0xe075('0x67'),_0xe075('0x68'),'serverUrl',_0xe075('0x23'),_0xe075('0x66')]})[_0xe075('0x2f')](handleEntityNotFound(_0x1775f6,null))[_0xe075('0x2f')](function(_0x5c059b){_0x25d9e9=_0x5c059b;_0x4ee38d=_0x25d9e9[_0xe075('0x6d')];_0x3744a7=_0x4ee38d===_0xe075('0x6e')?'eu':_0xe075('0x6f');_0x2d5e3a=_0x25d9e9['serverUrl'];var _0x23c5e4=_0x2d5e3a[_0xe075('0x70')](-0x1);if(_0x23c5e4==='/'||_0x23c5e4==='\x5c'||_0x23c5e4===':'){_0x2d5e3a=_0x2d5e3a[_0xe075('0x71')](0x0,_0x2d5e3a['lastIndexOf'](_0x23c5e4));}if(!_0x25d9e9[_0xe075('0x66')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x25d9e9);})[_0xe075('0x2f')](function(_0x361770){if(_0x361770){return rp({'method':_0xe075('0x72'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/settings/fields',_0x3744a7),'qs':{'module':'Calls'},'headers':{'Authorization':_0xe075('0x73')+_0x361770},'json':!![]});}})[_0xe075('0x2f')](function(_0x26545c){if(_0x26545c){if(_0x26545c[_0xe075('0x74')]&&_0x26545c[_0xe075('0x74')][_0xe075('0x22')]){throw new Error(_0x26545c['response'][_0xe075('0x22')][_0xe075('0x24')]);}var _0x387199=[];var _0x1e664f=[];var _0x33ed21=[_0xe075('0x75'),_0xe075('0x76'),_0xe075('0x77'),_0xe075('0x78'),_0xe075('0x79'),'Call_Result','Call_Start_Time',_0xe075('0x7a')];_0x1e664f=_[_0xe075('0x7b')](_0x26545c[_0xe075('0x41')],function(_0x11e9d9){return _0x33ed21['includes'](_0x11e9d9[_0xe075('0x7c')]);});for(var _0x31e8ea=0x0;_0x31e8ea<_0x1e664f['length'];_0x31e8ea++){if(_0x1e664f[_0x31e8ea][_0xe075('0x7d')]===![]){_0x387199[_0xe075('0x7e')]({'id':_0x1e664f[_0x31e8ea]['id'],'name':_0x1e664f[_0x31e8ea][_0xe075('0x7f')],'custom':_0x1e664f[_0x31e8ea][_0xe075('0x80')],'options':_0x1e664f[_0x31e8ea][_0xe075('0x81')]==='picklist'&&_0x1e664f[_0x31e8ea]['pick_list_values'][_0xe075('0x42')]>-0x1?_['map'](_0x1e664f[_0x31e8ea][_0xe075('0x82')],function(_0x135263){return{'name':_0x135263,'value':_0x135263};}):[]});}}return{'count':_0x387199['length'],'rows':_0x387199};}else{return{'count':0x0,'rows':[]};}})[_0xe075('0x2f')](respondWithResult(_0x1775f6,null))[_0xe075('0x4f')](function(_0x1e9eb5){var _0x15d424=_0x4c6470['query'][_0xe075('0x18')]?0x1f4:_0x1e9eb5[_0xe075('0x83')]||0x1f4;logger[_0xe075('0x22')](_0xe075('0x84'),_0xe075('0x6c'),_0x15d424,JSON['stringify'](_0x1e9eb5));delete _0x1e9eb5['name'];if(_0x15d424===0x191){_0x15d424=0x190;}_0x1775f6[_0xe075('0x25')](_0x15d424)[_0xe075('0x35')](_0x4c6470[_0xe075('0x3d')][_0xe075('0x18')]?{'message':_0xe075('0x85'),'statusCode':_0x1e9eb5['statusCode']}:_0x1e9eb5);});}; \ No newline at end of file +var _0x3b46=['sort','where','filter','merge','options','count','includeAll','include','rows','show','params','find','create','body','findOne','getConfigurations','nolimit','addConfiguration','Subjects','channel','Descriptions','getDescriptions','ZohoConfiguration','ZohoField','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','custom_field','picklist','pick_list_values','test','statusCode','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','Sequelize','request','ZohoAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','json','offset','set','Content-Range','apply','reject','save','update','then','end','stack','name','send','index','ZohoAccount','rawAttributes','type','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order'];(function(_0x2610f5,_0x396de9){var _0x223bdd=function(_0x52bd57){while(--_0x52bd57){_0x2610f5['push'](_0x2610f5['shift']());}};_0x223bdd(++_0x396de9);}(_0x3b46,0x15f));var _0x63b4=function(_0x242a98,_0x13988e){_0x242a98=_0x242a98-0x0;var _0x580999=_0x3b46[_0x242a98];return _0x580999;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x63b4('0x0'));var rimraf=require(_0x63b4('0x1'));var zipdir=require(_0x63b4('0x2'));var jsonpatch=require(_0x63b4('0x3'));var rp=require(_0x63b4('0x4'));var moment=require(_0x63b4('0x5'));var BPromise=require(_0x63b4('0x6'));var Mustache=require('mustache');var util=require(_0x63b4('0x7'));var path=require(_0x63b4('0x8'));var sox=require('sox');var csv=require(_0x63b4('0x9'));var ejs=require(_0x63b4('0xa'));var fs=require('fs');var _=require(_0x63b4('0xb'));var squel=require(_0x63b4('0xc'));var crypto=require('crypto');var jsforce=require(_0x63b4('0xd'));var deskjs=require(_0x63b4('0xe'));var toCsv=require(_0x63b4('0x9'));var querystring=require(_0x63b4('0xf'));var Papa=require('papaparse');var Redis=require(_0x63b4('0x10'));var authService=require(_0x63b4('0x11'));var qs=require(_0x63b4('0x12'));var as=require(_0x63b4('0x13'));var hardwareService=require(_0x63b4('0x14'));var logger=require(_0x63b4('0x15'))('api');var utils=require(_0x63b4('0x16'));var config=require(_0x63b4('0x17'));var db=require(_0x63b4('0x18'))['db'];var integrations=require(_0x63b4('0x19'));var jayson=require(_0x63b4('0x1a'));var client=jayson['client'][_0x63b4('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x1c3e20,_0x2dc116,_0x3d9c6f){if(_0x3d9c6f){var _0x3d971f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3d971f['test'](_0x2dc116)){return _0x1c3e20;}else{throw new db[(_0x63b4('0x1c'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x1c3e20;}}function respondWithRpcPromise(_0x1c15d4,_0x35fe79,_0x970fb1,_0x5af333){return new BPromise(function(_0x79ea74,_0x3b4a5d){var _0x41ded3=_0x5af333||client;return _0x41ded3[_0x63b4('0x1d')](_0x1c15d4,_0x970fb1)['then'](function(_0x12327b){logger['info'](_0x63b4('0x1e'),_0x35fe79,'request\x20sent');logger[_0x63b4('0x1f')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x35fe79,_0x63b4('0x20'),JSON[_0x63b4('0x21')](_0x12327b));if(_0x12327b[_0x63b4('0x22')]){if(_0x12327b[_0x63b4('0x22')][_0x63b4('0x23')]===0x1f4){logger[_0x63b4('0x22')](_0x63b4('0x1e'),_0x35fe79,_0x12327b[_0x63b4('0x22')][_0x63b4('0x24')]);return _0x3b4a5d(_0x12327b['error']['message']);}logger[_0x63b4('0x22')]('ZohoAccount,\x20%s,\x20%s',_0x35fe79,_0x12327b[_0x63b4('0x22')][_0x63b4('0x24')]);return _0x79ea74(_0x12327b[_0x63b4('0x22')][_0x63b4('0x24')]);}else{logger[_0x63b4('0x25')](_0x63b4('0x1e'),_0x35fe79,_0x63b4('0x20'));_0x79ea74(_0x12327b[_0x63b4('0x26')][_0x63b4('0x24')]);}})[_0x63b4('0x27')](function(_0x4c13a4){logger[_0x63b4('0x22')](_0x63b4('0x1e'),_0x35fe79,_0x4c13a4);_0x3b4a5d(_0x4c13a4);});});}function respondWithStatusCode(_0x53c6ad,_0x25c9bd){_0x25c9bd=_0x25c9bd||0xcc;return function(_0x22a79d){if(_0x22a79d){return _0x53c6ad[_0x63b4('0x28')](_0x25c9bd);}return _0x53c6ad[_0x63b4('0x29')](_0x25c9bd)['end']();};}function respondWithResult(_0x30c120,_0x14d8b2){_0x14d8b2=_0x14d8b2||0xc8;return function(_0x32f72b){if(_0x32f72b){return _0x30c120[_0x63b4('0x29')](_0x14d8b2)[_0x63b4('0x2a')](_0x32f72b);}};}function respondWithFilteredResult(_0x3b9430,_0x3aa6ae){return function(_0x11f3c3){if(_0x11f3c3){var _0x739b13=_0x11f3c3['count'],_0x484678=_0x3aa6ae[_0x63b4('0x2b')],_0x197325=_0x3aa6ae[_0x63b4('0x2b')]+_0x3aa6ae['limit'],_0x4c0cc5;if(_0x197325>=_0x739b13){_0x197325=_0x739b13;_0x4c0cc5=0xc8;}else{_0x4c0cc5=0xce;}_0x3b9430[_0x63b4('0x29')](_0x4c0cc5);return _0x3b9430[_0x63b4('0x2c')](_0x63b4('0x2d'),_0x484678+'-'+_0x197325+'/'+_0x739b13)['json'](_0x11f3c3);}return null;};}function patchUpdates(_0x4cee1c){return function(_0x918085){try{jsonpatch[_0x63b4('0x2e')](_0x918085,_0x4cee1c,!![]);}catch(_0x53b03e){return BPromise[_0x63b4('0x2f')](_0x53b03e);}return _0x918085[_0x63b4('0x30')]();};}function saveUpdates(_0x21a624,_0x2d619f){return function(_0x464029){if(_0x464029){return _0x464029[_0x63b4('0x31')](_0x21a624)['then'](function(_0x3de102){return _0x3de102;});}return null;};}function removeEntity(_0x3e7f2d,_0x3d92dc){return function(_0x54a3b5){if(_0x54a3b5){return _0x54a3b5['destroy']()[_0x63b4('0x32')](function(){_0x3e7f2d['status'](0xcc)[_0x63b4('0x33')]();});}};}function handleEntityNotFound(_0x236664,_0xcd7fe4){return function(_0x465e10){if(!_0x465e10){_0x236664[_0x63b4('0x28')](0x194);}return _0x465e10;};}function handleError(_0x50973a,_0x49e61c){_0x49e61c=_0x49e61c||0x1f4;return function(_0x251211){logger[_0x63b4('0x22')](_0x251211[_0x63b4('0x34')]);if(_0x251211['name']){delete _0x251211[_0x63b4('0x35')];}_0x50973a[_0x63b4('0x29')](_0x49e61c)[_0x63b4('0x36')](_0x251211);};}exports[_0x63b4('0x37')]=function(_0x37cc05,_0x1efa1a){var _0x87c234={},_0x2fac09={},_0x1c8da2={'count':0x0,'rows':[]};var _0x3167b9=_['map'](db[_0x63b4('0x38')][_0x63b4('0x39')],function(_0x3df722){return{'name':_0x3df722['fieldName'],'type':_0x3df722[_0x63b4('0x3a')][_0x63b4('0x3b')]};});_0x2fac09[_0x63b4('0x3c')]=_[_0x63b4('0x3d')](_0x3167b9,_0x63b4('0x35'));_0x2fac09['query']=_[_0x63b4('0x3e')](_0x37cc05[_0x63b4('0x3f')]);_0x2fac09[_0x63b4('0x40')]=_['intersection'](_0x2fac09[_0x63b4('0x3c')],_0x2fac09[_0x63b4('0x3f')]);_0x87c234[_0x63b4('0x41')]=_[_0x63b4('0x42')](_0x2fac09[_0x63b4('0x3c')],qs['fields'](_0x37cc05[_0x63b4('0x3f')][_0x63b4('0x43')]));_0x87c234[_0x63b4('0x41')]=_0x87c234[_0x63b4('0x41')][_0x63b4('0x44')]?_0x87c234[_0x63b4('0x41')]:_0x2fac09['model'];if(!_0x37cc05['query'][_0x63b4('0x45')]('nolimit')){_0x87c234[_0x63b4('0x46')]=qs[_0x63b4('0x46')](_0x37cc05[_0x63b4('0x3f')][_0x63b4('0x46')]);_0x87c234[_0x63b4('0x2b')]=qs[_0x63b4('0x2b')](_0x37cc05[_0x63b4('0x3f')][_0x63b4('0x2b')]);}_0x87c234[_0x63b4('0x47')]=qs['sort'](_0x37cc05[_0x63b4('0x3f')][_0x63b4('0x48')]);_0x87c234[_0x63b4('0x49')]=qs[_0x63b4('0x40')](_['pick'](_0x37cc05[_0x63b4('0x3f')],_0x2fac09['filters']),_0x3167b9);if(_0x37cc05[_0x63b4('0x3f')][_0x63b4('0x4a')]){_0x87c234['where']=_[_0x63b4('0x4b')](_0x87c234[_0x63b4('0x49')],{'$or':_['map'](_0x3167b9,function(_0x1bd59c){if(_0x1bd59c[_0x63b4('0x3a')]!=='VIRTUAL'){var _0x1fc41c={};_0x1fc41c[_0x1bd59c[_0x63b4('0x35')]]={'$like':'%'+_0x37cc05[_0x63b4('0x3f')]['filter']+'%'};return _0x1fc41c;}})});}_0x87c234=_[_0x63b4('0x4b')]({},_0x87c234,_0x37cc05[_0x63b4('0x4c')]);var _0x1839e7={'where':_0x87c234[_0x63b4('0x49')]};return db[_0x63b4('0x38')][_0x63b4('0x4d')](_0x1839e7)[_0x63b4('0x32')](function(_0x2ce65e){_0x1c8da2['count']=_0x2ce65e;if(_0x37cc05[_0x63b4('0x3f')][_0x63b4('0x4e')]){_0x87c234[_0x63b4('0x4f')]=[{'all':!![]}];}return db[_0x63b4('0x38')]['findAll'](_0x87c234);})[_0x63b4('0x32')](function(_0x21082a){_0x1c8da2[_0x63b4('0x50')]=_0x21082a;return _0x1c8da2;})['then'](respondWithFilteredResult(_0x1efa1a,_0x87c234))[_0x63b4('0x27')](handleError(_0x1efa1a,null));};exports[_0x63b4('0x51')]=function(_0x2697d3,_0x44d048){var _0x493a70={'raw':![],'where':{'id':_0x2697d3[_0x63b4('0x52')]['id']}},_0x4eeb36={};_0x4eeb36[_0x63b4('0x3c')]=_['keys'](db[_0x63b4('0x38')][_0x63b4('0x39')]);_0x4eeb36[_0x63b4('0x3f')]=_[_0x63b4('0x3e')](_0x2697d3[_0x63b4('0x3f')]);_0x4eeb36[_0x63b4('0x40')]=_[_0x63b4('0x42')](_0x4eeb36['model'],_0x4eeb36[_0x63b4('0x3f')]);_0x493a70[_0x63b4('0x41')]=_[_0x63b4('0x42')](_0x4eeb36[_0x63b4('0x3c')],qs[_0x63b4('0x43')](_0x2697d3[_0x63b4('0x3f')][_0x63b4('0x43')]));_0x493a70[_0x63b4('0x41')]=_0x493a70[_0x63b4('0x41')][_0x63b4('0x44')]?_0x493a70[_0x63b4('0x41')]:_0x4eeb36[_0x63b4('0x3c')];if(_0x2697d3[_0x63b4('0x3f')][_0x63b4('0x4e')]){_0x493a70['include']=[{'all':!![]}];}_0x493a70=_['merge']({},_0x493a70,_0x2697d3[_0x63b4('0x4c')]);return db[_0x63b4('0x38')][_0x63b4('0x53')](_0x493a70)[_0x63b4('0x32')](handleEntityNotFound(_0x44d048,null))[_0x63b4('0x32')](respondWithResult(_0x44d048,null))[_0x63b4('0x27')](handleError(_0x44d048,null));};exports['create']=function(_0x37bcbd,_0x31e577){return db[_0x63b4('0x38')][_0x63b4('0x54')](_0x37bcbd[_0x63b4('0x55')],{})[_0x63b4('0x32')](respondWithResult(_0x31e577,0xc9))[_0x63b4('0x27')](handleError(_0x31e577,null));};exports[_0x63b4('0x31')]=function(_0x31130d,_0x42aba1){if(_0x31130d[_0x63b4('0x55')]['id']){delete _0x31130d[_0x63b4('0x55')]['id'];}return db['ZohoAccount'][_0x63b4('0x53')]({'where':{'id':_0x31130d[_0x63b4('0x52')]['id']}})[_0x63b4('0x32')](handleEntityNotFound(_0x42aba1,null))[_0x63b4('0x32')](saveUpdates(_0x31130d[_0x63b4('0x55')],null))['then'](respondWithResult(_0x42aba1,null))[_0x63b4('0x27')](handleError(_0x42aba1,null));};exports['destroy']=function(_0x183ab9,_0x5a6b55){return db[_0x63b4('0x38')][_0x63b4('0x53')]({'where':{'id':_0x183ab9[_0x63b4('0x52')]['id']}})['then'](handleEntityNotFound(_0x5a6b55,null))[_0x63b4('0x32')](removeEntity(_0x5a6b55,null))[_0x63b4('0x27')](handleError(_0x5a6b55,null));};exports['getConfigurations']=function(_0x405926,_0x1caad9,_0x1bf5ed){var _0x2ca242={};var _0x2dc2b1={};var _0x3fc780;var _0x519c6e;return db[_0x63b4('0x38')][_0x63b4('0x56')]({'where':{'id':_0x405926[_0x63b4('0x52')]['id']}})[_0x63b4('0x32')](handleEntityNotFound(_0x1caad9,null))[_0x63b4('0x32')](function(_0x59411c){if(_0x59411c){_0x3fc780=_0x59411c;_0x2dc2b1['model']=_[_0x63b4('0x3e')](db['ZohoConfiguration'][_0x63b4('0x39')]);_0x2dc2b1[_0x63b4('0x3f')]=_[_0x63b4('0x3e')](_0x405926[_0x63b4('0x3f')]);_0x2dc2b1[_0x63b4('0x40')]=_[_0x63b4('0x42')](_0x2dc2b1['model'],_0x2dc2b1[_0x63b4('0x3f')]);_0x2ca242[_0x63b4('0x41')]=_['intersection'](_0x2dc2b1[_0x63b4('0x3c')],qs[_0x63b4('0x43')](_0x405926[_0x63b4('0x3f')][_0x63b4('0x43')]));_0x2ca242[_0x63b4('0x41')]=_0x2ca242[_0x63b4('0x41')][_0x63b4('0x44')]?_0x2ca242[_0x63b4('0x41')]:_0x2dc2b1[_0x63b4('0x3c')];_0x2ca242[_0x63b4('0x47')]=qs['sort'](_0x405926[_0x63b4('0x3f')][_0x63b4('0x48')]);_0x2ca242[_0x63b4('0x49')]=qs[_0x63b4('0x40')](_['pick'](_0x405926[_0x63b4('0x3f')],_0x2dc2b1[_0x63b4('0x40')]));if(_0x405926['query'][_0x63b4('0x4a')]){_0x2ca242['where']=_[_0x63b4('0x4b')](_0x2ca242['where'],{'$or':_[_0x63b4('0x3d')](_0x2ca242['attributes'],function(_0x5adebe){var _0xab1c6c={};_0xab1c6c[_0x5adebe]={'$like':'%'+_0x405926[_0x63b4('0x3f')][_0x63b4('0x4a')]+'%'};return _0xab1c6c;})});}_0x2ca242=_[_0x63b4('0x4b')]({},_0x2ca242,_0x405926[_0x63b4('0x4c')]);return _0x3fc780[_0x63b4('0x57')](_0x2ca242);}})['then'](function(_0x505674){if(_0x505674){_0x519c6e=_0x505674[_0x63b4('0x44')];if(!_0x405926[_0x63b4('0x3f')][_0x63b4('0x45')](_0x63b4('0x58'))){_0x2ca242[_0x63b4('0x46')]=qs[_0x63b4('0x46')](_0x405926[_0x63b4('0x3f')]['limit']);_0x2ca242['offset']=qs[_0x63b4('0x2b')](_0x405926[_0x63b4('0x3f')]['offset']);}return _0x3fc780['getConfigurations'](_0x2ca242);}})[_0x63b4('0x32')](function(_0x29598a){if(_0x29598a){return _0x29598a?{'count':_0x519c6e,'rows':_0x29598a}:null;}})[_0x63b4('0x32')](respondWithResult(_0x1caad9,null))['catch'](handleError(_0x1caad9,null));};exports[_0x63b4('0x59')]=function(_0x2b67a9,_0x8ff800,_0x38896f){if(_0x2b67a9[_0x63b4('0x55')]['id']){delete _0x2b67a9['body']['id'];}return db[_0x63b4('0x38')]['findOne']({'where':{'id':_0x2b67a9[_0x63b4('0x52')]['id']}})[_0x63b4('0x32')](handleEntityNotFound(_0x8ff800,null))['then'](function(_0x7920ce){if(_0x7920ce){_0x2b67a9['body']['AccountId']=_0x7920ce['id'];_0x2b67a9[_0x63b4('0x55')][_0x63b4('0x5a')]=integrations['getSubjects'](_0x2b67a9['body'][_0x63b4('0x5b')],_0x2b67a9[_0x63b4('0x55')][_0x63b4('0x3a')]);_0x2b67a9[_0x63b4('0x55')][_0x63b4('0x5c')]=integrations[_0x63b4('0x5d')](_0x2b67a9[_0x63b4('0x55')][_0x63b4('0x5b')],_0x2b67a9[_0x63b4('0x55')][_0x63b4('0x3a')]);return db[_0x63b4('0x5e')]['create'](_0x2b67a9[_0x63b4('0x55')],{'include':[{'model':db[_0x63b4('0x5f')],'as':_0x63b4('0x5a')},{'model':db[_0x63b4('0x5f')],'as':_0x63b4('0x5c')}]});}return null;})[_0x63b4('0x32')](respondWithResult(_0x8ff800,null))[_0x63b4('0x27')](handleError(_0x8ff800,null));};function getAccessToken(_0x313d33){return new Promise(function(_0x264905,_0x2265ec){var _0x2a3c8b;switch(_0x313d33[_0x63b4('0x60')]){case'US':_0x2a3c8b='https://accounts.zoho.com';break;case'AU':_0x2a3c8b=_0x63b4('0x61');break;case'EU':_0x2a3c8b=_0x63b4('0x62');break;case'IN':_0x2a3c8b=_0x63b4('0x63');break;case'CN':_0x2a3c8b=_0x63b4('0x64');break;default:_0x2a3c8b=_0x63b4('0x62');break;}var _0x354f14={'method':'POST','uri':_0x2a3c8b+_0x63b4('0x65'),'qs':{'refresh_token':_0x313d33[_0x63b4('0x66')],'client_id':_0x313d33[_0x63b4('0x67')],'client_secret':_0x313d33[_0x63b4('0x68')],'grant_type':_0x63b4('0x69')},'json':!![]};return rp(_0x354f14)[_0x63b4('0x32')](function(_0x5668ff){if(_0x5668ff[_0x63b4('0x6a')]){_0x264905(_0x5668ff[_0x63b4('0x6a')]);}else{_0x2265ec(_0x63b4('0x6b'));}})['catch'](function(_0x4a6cc0){_0x2265ec(_0x4a6cc0);});});}exports[_0x63b4('0x6c')]=function(_0x3865d6,_0x1317c,_0xad45b){var _0x41596d,_0x403d87,_0x13e7e3,_0x4781e8,_0x12a0d9;return db[_0x63b4('0x38')][_0x63b4('0x56')]({'where':{'id':_0x3865d6[_0x63b4('0x52')]['id']},'attributes':['id',_0x63b4('0x6d'),'zone',_0x63b4('0x67'),_0x63b4('0x68'),_0x63b4('0x6e'),_0x63b4('0x23'),_0x63b4('0x66')]})[_0x63b4('0x32')](handleEntityNotFound(_0x1317c,null))[_0x63b4('0x32')](function(_0x213150){_0x12a0d9=_0x213150;_0x41596d=_0x12a0d9[_0x63b4('0x6d')];_0x403d87=_0x41596d===_0x63b4('0x6f')?'eu':_0x63b4('0x70');_0x13e7e3=_0x12a0d9[_0x63b4('0x6e')];var _0x17543d=_0x13e7e3[_0x63b4('0x71')](-0x1);if(_0x17543d==='/'||_0x17543d==='\x5c'||_0x17543d===':'){_0x13e7e3=_0x13e7e3[_0x63b4('0x72')](0x0,_0x13e7e3[_0x63b4('0x73')](_0x17543d));}if(!_0x12a0d9['refreshToken']){throw new Error(_0x63b4('0x74'));}return getAccessToken(_0x12a0d9);})[_0x63b4('0x32')](function(_0x32d5c6){if(_0x32d5c6){return rp({'method':_0x63b4('0x75'),'uri':util[_0x63b4('0x76')](_0x63b4('0x77'),_0x403d87),'qs':{'module':_0x63b4('0x78')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x32d5c6},'json':!![]});}})[_0x63b4('0x32')](function(_0x208678){if(_0x208678){if(_0x208678[_0x63b4('0x79')]&&_0x208678['response']['error']){throw new Error(_0x208678['response'][_0x63b4('0x22')]['message']);}var _0xd50a7d=[];var _0x600e60=[];var _0x2e94de=[_0x63b4('0x7a'),_0x63b4('0x7b'),_0x63b4('0x7c'),_0x63b4('0x7d'),_0x63b4('0x7e'),'Call_Result',_0x63b4('0x7f'),_0x63b4('0x80')];_0x600e60=_[_0x63b4('0x81')](_0x208678[_0x63b4('0x43')],function(_0x1a8de7){return _0x2e94de[_0x63b4('0x82')](_0x1a8de7[_0x63b4('0x83')]);});for(var _0x49e9e1=0x0;_0x49e9e1<_0x600e60['length'];_0x49e9e1++){if(_0x600e60[_0x49e9e1][_0x63b4('0x84')]===![]){_0xd50a7d[_0x63b4('0x85')]({'id':_0x600e60[_0x49e9e1]['id'],'name':_0x600e60[_0x49e9e1][_0x63b4('0x86')],'custom':_0x600e60[_0x49e9e1][_0x63b4('0x87')],'options':_0x600e60[_0x49e9e1]['data_type']===_0x63b4('0x88')&&_0x600e60[_0x49e9e1][_0x63b4('0x89')][_0x63b4('0x44')]>-0x1?_['map'](_0x600e60[_0x49e9e1][_0x63b4('0x89')],function(_0x533ac1){return{'name':_0x533ac1,'value':_0x533ac1};}):[]});}}return{'count':_0xd50a7d[_0x63b4('0x44')],'rows':_0xd50a7d};}else{return{'count':0x0,'rows':[]};}})[_0x63b4('0x32')](respondWithResult(_0x1317c,null))[_0x63b4('0x27')](function(_0x294539){var _0x4fd184=_0x3865d6[_0x63b4('0x3f')][_0x63b4('0x8a')]?0x1f4:_0x294539[_0x63b4('0x8b')]||0x1f4;logger[_0x63b4('0x22')]('getFields,\x20%s,\x20%s,\x20%s',_0x63b4('0x6c'),_0x4fd184,JSON[_0x63b4('0x21')](_0x294539));delete _0x294539[_0x63b4('0x35')];if(_0x4fd184===0x191){_0x4fd184=0x190;}_0x1317c[_0x63b4('0x29')](_0x4fd184)[_0x63b4('0x36')](_0x3865d6[_0x63b4('0x3f')]['test']?{'message':_0x63b4('0x8c'),'statusCode':_0x294539[_0x63b4('0x8b')]}:_0x294539);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index cdd124b..0a023b9 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 _0xbf3b=['exports','define','ZohoAccount','int_zoho_accounts','zone','changed','serverUrl','clientId','clientSecret','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','authorization_code','code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','https://accounts.zoho.eu','lodash','util','api','moment','bluebird','request-promise','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xbf3b,0xa7));var _0xbbf3=function(_0x4df587,_0x53b86d){_0x4df587=_0x4df587-0x0;var _0x593d5f=_0xbf3b[_0x4df587];return _0x593d5f;};'use strict';var _=require(_0xbbf3('0x0'));var util=require(_0xbbf3('0x1'));var logger=require('../../config/logger')(_0xbbf3('0x2'));var moment=require(_0xbbf3('0x3'));var BPromise=require(_0xbbf3('0x4'));var rp=require(_0xbbf3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbbf3('0x6'));var config=require('../../config/environment');var attributes=require(_0xbbf3('0x7'));var integrations=require(_0xbbf3('0x8'));module[_0xbbf3('0x9')]=function(_0x5c0e80,_0xa892c8){return _0x5c0e80[_0xbbf3('0xa')](_0xbbf3('0xb'),attributes,{'tableName':_0xbbf3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3c012e,_0x16d538,_0x1af27d){if(_0x3c012e['changed'](_0xbbf3('0xd'))||_0x3c012e[_0xbbf3('0xe')](_0xbbf3('0xf'))||_0x3c012e[_0xbbf3('0xe')](_0xbbf3('0x10'))||_0x3c012e[_0xbbf3('0xe')](_0xbbf3('0x11'))||_0x3c012e[_0xbbf3('0xe')]('code')||_0x3c012e[_0xbbf3('0xe')](_0xbbf3('0x12'))){var _0xb0dca6,_0x386547;_0xb0dca6=_0x3c012e['serverUrl'];var _0x45be0e=_0xb0dca6[_0xbbf3('0x13')](-0x1);if(_0x45be0e==='/'||_0x45be0e==='\x5c'||_0x45be0e===':'){_0xb0dca6=_0xb0dca6[_0xbbf3('0x14')](0x0,_0xb0dca6[_0xbbf3('0x15')](_0x45be0e));}switch(_0x3c012e[_0xbbf3('0xd')]){case'US':_0x386547=_0xbbf3('0x16');break;case'AU':_0x386547=_0xbbf3('0x17');break;case'IN':_0x386547=_0xbbf3('0x18');break;case'CN':_0x386547=_0xbbf3('0x19');break;default:_0x386547='https://accounts.zoho.eu';break;}var _0xf3583c={'method':_0xbbf3('0x1a'),'uri':_0x386547+_0xbbf3('0x1b'),'form':{'grant_type':_0xbbf3('0x1c'),'client_id':_0x3c012e[_0xbbf3('0x10')],'client_secret':_0x3c012e[_0xbbf3('0x11')],'redirect_uri':_0x3c012e[_0xbbf3('0xf')],'code':_0x3c012e[_0xbbf3('0x1d')]},'headers':{'Content-Type':_0xbbf3('0x1e')}};return rp(_0xf3583c)[_0xbbf3('0x1f')](function(_0x231e7b){var _0x5f8d8c=JSON[_0xbbf3('0x20')](_0x231e7b);if(_0x5f8d8c[_0xbbf3('0x21')]){_0x3c012e[_0xbbf3('0x22')]=_0x5f8d8c[_0xbbf3('0x21')];logger[_0xbbf3('0x23')](util['format'](_0xbbf3('0x24'),_0x3c012e[_0xbbf3('0x25')],_0x3c012e['id']));}else{logger[_0xbbf3('0x26')](util[_0xbbf3('0x27')](_0xbbf3('0x28'),_0x3c012e[_0xbbf3('0x25')],_0x3c012e['id']),util[_0xbbf3('0x29')](_0x5f8d8c,{'showHidden':![],'depth':null}));}return _0x1af27d(null,_0x16d538);})[_0xbbf3('0x2a')](function(_0x522356){logger[_0xbbf3('0x26')](util[_0xbbf3('0x27')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3c012e[_0xbbf3('0x25')],_0x3c012e['id']),util[_0xbbf3('0x29')](parsedResult,{'showHidden':![],'depth':null}));return _0x1af27d(_0x522356);});}else{return _0x1af27d(null,_0x16d538);}},'beforeUpdate':function(_0x19fce0,_0x14a056,_0x8b2b3f){if(_0x19fce0[_0xbbf3('0xe')]('zone')||_0x19fce0['changed']('serverUrl')||_0x19fce0[_0xbbf3('0xe')]('clientId')||_0x19fce0['changed'](_0xbbf3('0x11'))||_0x19fce0[_0xbbf3('0xe')](_0xbbf3('0x1d'))||_0x19fce0[_0xbbf3('0xe')]('host')){var _0xbad036,_0x5e22eb;_0xbad036=_0x19fce0['serverUrl'];var _0x542b21=_0xbad036[_0xbbf3('0x13')](-0x1);if(_0x542b21==='/'||_0x542b21==='\x5c'||_0x542b21===':'){_0xbad036=_0xbad036[_0xbbf3('0x14')](0x0,_0xbad036['lastIndexOf'](_0x542b21));}switch(_0x19fce0['zone']){case'US':_0x5e22eb='https://accounts.zoho.com';break;case'AU':_0x5e22eb=_0xbbf3('0x17');break;case'IN':_0x5e22eb=_0xbbf3('0x18');break;case'CN':_0x5e22eb=_0xbbf3('0x19');break;default:_0x5e22eb=_0xbbf3('0x2b');break;}var _0x3a5ab8={'method':_0xbbf3('0x1a'),'uri':_0x5e22eb+_0xbbf3('0x1b'),'form':{'grant_type':_0xbbf3('0x1c'),'client_id':_0x19fce0[_0xbbf3('0x10')],'client_secret':_0x19fce0[_0xbbf3('0x11')],'redirect_uri':_0x19fce0[_0xbbf3('0xf')],'code':_0x19fce0[_0xbbf3('0x1d')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x3a5ab8)[_0xbbf3('0x1f')](function(_0x251f07){var _0x136850=JSON[_0xbbf3('0x20')](_0x251f07);if(_0x136850[_0xbbf3('0x21')]){_0x19fce0[_0xbbf3('0x22')]=_0x136850['refresh_token'];logger['info'](util[_0xbbf3('0x27')](_0xbbf3('0x24'),_0x19fce0[_0xbbf3('0x25')],_0x19fce0['id']));}else{logger[_0xbbf3('0x26')](util[_0xbbf3('0x27')](_0xbbf3('0x28'),_0x19fce0[_0xbbf3('0x25')],_0x19fce0['id']),util[_0xbbf3('0x29')](_0x136850,{'showHidden':![],'depth':null}));}return _0x8b2b3f(null,_0x14a056);})[_0xbbf3('0x2a')](function(_0x41e9e0){logger['error'](util['format'](_0xbbf3('0x28'),_0x19fce0[_0xbbf3('0x25')],_0x19fce0['id']),util[_0xbbf3('0x29')](parsedResult,{'showHidden':![],'depth':null}));return _0x8b2b3f(_0x41e9e0);});}else{return _0x8b2b3f(null,_0x14a056);}}}});}; \ No newline at end of file +var _0x3fdb=['exports','define','int_zoho_accounts','changed','serverUrl','clientId','code','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.eu','POST','clientSecret','application/x-www-form-urlencoded','then','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','zone','host','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','/oauth/v2/token','parse','name','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','../../components/integrations/configuration'];(function(_0xad379c,_0x437b42){var _0x4324d5=function(_0x18531a){while(--_0x18531a){_0xad379c['push'](_0xad379c['shift']());}};_0x4324d5(++_0x437b42);}(_0x3fdb,0x171));var _0xb3fd=function(_0x29b514,_0x50e5a4){_0x29b514=_0x29b514-0x0;var _0x397e48=_0x3fdb[_0x29b514];return _0x397e48;};'use strict';var _=require(_0xb3fd('0x0'));var util=require(_0xb3fd('0x1'));var logger=require(_0xb3fd('0x2'))(_0xb3fd('0x3'));var moment=require('moment');var BPromise=require(_0xb3fd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb3fd('0x5'));var rimraf=require(_0xb3fd('0x6'));var config=require(_0xb3fd('0x7'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0xb3fd('0x8'));module[_0xb3fd('0x9')]=function(_0x2e96f1,_0x289221){return _0x2e96f1[_0xb3fd('0xa')]('ZohoAccount',attributes,{'tableName':_0xb3fd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3f2d47,_0x204fdf,_0x4db03f){if(_0x3f2d47[_0xb3fd('0xc')]('zone')||_0x3f2d47[_0xb3fd('0xc')](_0xb3fd('0xd'))||_0x3f2d47[_0xb3fd('0xc')](_0xb3fd('0xe'))||_0x3f2d47[_0xb3fd('0xc')]('clientSecret')||_0x3f2d47['changed'](_0xb3fd('0xf'))||_0x3f2d47[_0xb3fd('0xc')]('host')){var _0x4cf2cd,_0x402930;_0x4cf2cd=_0x3f2d47[_0xb3fd('0xd')];var _0x3277df=_0x4cf2cd[_0xb3fd('0x10')](-0x1);if(_0x3277df==='/'||_0x3277df==='\x5c'||_0x3277df===':'){_0x4cf2cd=_0x4cf2cd[_0xb3fd('0x11')](0x0,_0x4cf2cd[_0xb3fd('0x12')](_0x3277df));}switch(_0x3f2d47['zone']){case'US':_0x402930=_0xb3fd('0x13');break;case'AU':_0x402930='https://accounts.zoho.com.au';break;case'IN':_0x402930=_0xb3fd('0x14');break;case'CN':_0x402930='https://accounts.zoho.com.cn';break;default:_0x402930=_0xb3fd('0x15');break;}var _0x12169c={'method':_0xb3fd('0x16'),'uri':_0x402930+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x3f2d47[_0xb3fd('0xe')],'client_secret':_0x3f2d47[_0xb3fd('0x17')],'redirect_uri':_0x3f2d47[_0xb3fd('0xd')],'code':_0x3f2d47['code']},'headers':{'Content-Type':_0xb3fd('0x18')}};return rp(_0x12169c)[_0xb3fd('0x19')](function(_0x2765ad){var _0x30f8c6=JSON['parse'](_0x2765ad);if(_0x30f8c6[_0xb3fd('0x1a')]){_0x3f2d47[_0xb3fd('0x1b')]=_0x30f8c6[_0xb3fd('0x1a')];logger[_0xb3fd('0x1c')](util[_0xb3fd('0x1d')](_0xb3fd('0x1e'),_0x3f2d47['name'],_0x3f2d47['id']));}else{logger[_0xb3fd('0x1f')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3f2d47['name'],_0x3f2d47['id']),util['inspect'](_0x30f8c6,{'showHidden':![],'depth':null}));}return _0x4db03f(null,_0x204fdf);})[_0xb3fd('0x20')](function(_0x234818){logger[_0xb3fd('0x1f')](util[_0xb3fd('0x1d')](_0xb3fd('0x21'),_0x3f2d47['name'],_0x3f2d47['id']),util[_0xb3fd('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x4db03f(_0x234818);});}else{return _0x4db03f(null,_0x204fdf);}},'beforeUpdate':function(_0x40a66d,_0x5a8e8e,_0x86e01f){if(_0x40a66d[_0xb3fd('0xc')](_0xb3fd('0x23'))||_0x40a66d[_0xb3fd('0xc')](_0xb3fd('0xd'))||_0x40a66d['changed']('clientId')||_0x40a66d[_0xb3fd('0xc')](_0xb3fd('0x17'))||_0x40a66d[_0xb3fd('0xc')]('code')||_0x40a66d[_0xb3fd('0xc')](_0xb3fd('0x24'))){var _0x52122c,_0x499d31;_0x52122c=_0x40a66d[_0xb3fd('0xd')];var _0x2d1daa=_0x52122c[_0xb3fd('0x10')](-0x1);if(_0x2d1daa==='/'||_0x2d1daa==='\x5c'||_0x2d1daa===':'){_0x52122c=_0x52122c[_0xb3fd('0x11')](0x0,_0x52122c[_0xb3fd('0x12')](_0x2d1daa));}switch(_0x40a66d[_0xb3fd('0x23')]){case'US':_0x499d31=_0xb3fd('0x13');break;case'AU':_0x499d31=_0xb3fd('0x25');break;case'IN':_0x499d31='https://accounts.zoho.in';break;case'CN':_0x499d31=_0xb3fd('0x26');break;default:_0x499d31='https://accounts.zoho.eu';break;}var _0x583ba2={'method':_0xb3fd('0x16'),'uri':_0x499d31+_0xb3fd('0x27'),'form':{'grant_type':'authorization_code','client_id':_0x40a66d[_0xb3fd('0xe')],'client_secret':_0x40a66d[_0xb3fd('0x17')],'redirect_uri':_0x40a66d[_0xb3fd('0xd')],'code':_0x40a66d[_0xb3fd('0xf')]},'headers':{'Content-Type':_0xb3fd('0x18')}};return rp(_0x583ba2)['then'](function(_0x37fbe8){var _0x470b2d=JSON[_0xb3fd('0x28')](_0x37fbe8);if(_0x470b2d[_0xb3fd('0x1a')]){_0x40a66d['refreshToken']=_0x470b2d['refresh_token'];logger[_0xb3fd('0x1c')](util[_0xb3fd('0x1d')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x40a66d['name'],_0x40a66d['id']));}else{logger[_0xb3fd('0x1f')](util['format'](_0xb3fd('0x21'),_0x40a66d[_0xb3fd('0x29')],_0x40a66d['id']),util[_0xb3fd('0x22')](_0x470b2d,{'showHidden':![],'depth':null}));}return _0x86e01f(null,_0x5a8e8e);})[_0xb3fd('0x20')](function(_0x40e7a0){logger[_0xb3fd('0x1f')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x40a66d[_0xb3fd('0x29')],_0x40a66d['id']),util[_0xb3fd('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x86e01f(_0x40e7a0);});}else{return _0x86e01f(null,_0x5a8e8e);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 003abe4..7c7497c 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 _0x9d3d=['request\x20sent','debug','error','message','info','ZohoAccount,\x20%s,\x20%s','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowZohoAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x1702b8,_0x28c7da){var _0x50028a=function(_0x4135b1){while(--_0x4135b1){_0x1702b8['push'](_0x1702b8['shift']());}};_0x50028a(++_0x28c7da);}(_0x9d3d,0x77));var _0xd9d3=function(_0x521910,_0xd24a3c){_0x521910=_0x521910-0x0;var _0x4dda55=_0x9d3d[_0x521910];return _0x4dda55;};'use strict';var _=require(_0xd9d3('0x0'));var util=require(_0xd9d3('0x1'));var moment=require(_0xd9d3('0x2'));var BPromise=require(_0xd9d3('0x3'));var rs=require(_0xd9d3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd9d3('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd9d3('0x6'));var config=require(_0xd9d3('0x7'));var jayson=require(_0xd9d3('0x8'));var client=jayson[_0xd9d3('0x9')][_0xd9d3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x42eb8b,_0x42b486,_0x7048d1){return new BPromise(function(_0x4fe370,_0x39f53f){return client[_0xd9d3('0xb')](_0x42eb8b,_0x7048d1)[_0xd9d3('0xc')](function(_0x1641e0){logger['info']('ZohoAccount,\x20%s,\x20%s',_0x42b486,_0xd9d3('0xd'));logger[_0xd9d3('0xe')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x42b486,_0xd9d3('0xd'),JSON['stringify'](_0x1641e0));if(_0x1641e0['error']){if(_0x1641e0[_0xd9d3('0xf')]['code']===0x1f4){logger[_0xd9d3('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x42b486,_0x1641e0[_0xd9d3('0xf')][_0xd9d3('0x10')]);return _0x39f53f(_0x1641e0[_0xd9d3('0xf')][_0xd9d3('0x10')]);}logger[_0xd9d3('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x42b486,_0x1641e0['error'][_0xd9d3('0x10')]);return _0x4fe370(_0x1641e0[_0xd9d3('0xf')]['message']);}else{logger[_0xd9d3('0x11')](_0xd9d3('0x12'),_0x42b486,_0xd9d3('0xd'));_0x4fe370(_0x1641e0['result']['message']);}})[_0xd9d3('0x13')](function(_0x4db08b){logger[_0xd9d3('0xf')](_0xd9d3('0x12'),_0x42b486,_0x4db08b);_0x39f53f(_0x4db08b);});});}exports[_0xd9d3('0x14')]=function(_0xcf7324){var _0x267665=this;return new Promise(function(_0x40332b,_0xcc6854){return db[_0xd9d3('0x15')][_0xd9d3('0x16')]({'raw':_0xcf7324[_0xd9d3('0x17')]?_0xcf7324[_0xd9d3('0x17')][_0xd9d3('0x18')]===undefined?!![]:![]:!![],'where':_0xcf7324['options']?_0xcf7324[_0xd9d3('0x17')][_0xd9d3('0x19')]||null:null,'attributes':_0xcf7324['options']?_0xcf7324[_0xd9d3('0x17')][_0xd9d3('0x1a')]||null:null,'limit':_0xcf7324[_0xd9d3('0x17')]?_0xcf7324[_0xd9d3('0x17')][_0xd9d3('0x1b')]||null:null,'include':_0xcf7324[_0xd9d3('0x17')]?_0xcf7324[_0xd9d3('0x17')][_0xd9d3('0x1c')]?_[_0xd9d3('0x1d')](_0xcf7324[_0xd9d3('0x17')]['include'],function(_0x1b05d5){return{'model':db[_0x1b05d5['model']],'as':_0x1b05d5['as'],'attributes':_0x1b05d5['attributes'],'include':_0x1b05d5[_0xd9d3('0x1c')]?_[_0xd9d3('0x1d')](_0x1b05d5[_0xd9d3('0x1c')],function(_0x4608db){return{'model':db[_0x4608db[_0xd9d3('0x1e')]],'as':_0x4608db['as'],'attributes':_0x4608db[_0xd9d3('0x1a')],'include':_0x4608db[_0xd9d3('0x1c')]?_[_0xd9d3('0x1d')](_0x4608db[_0xd9d3('0x1c')],function(_0x4e0628){return{'model':db[_0x4e0628['model']],'as':_0x4e0628['as'],'attributes':_0x4e0628[_0xd9d3('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd9d3('0xc')](function(_0x31d8d4){logger[_0xd9d3('0x11')](_0xd9d3('0x14'),_0xcf7324);logger[_0xd9d3('0xe')](_0xd9d3('0x14'),_0xcf7324,JSON[_0xd9d3('0x1f')](_0x31d8d4));_0x40332b(_0x31d8d4);})[_0xd9d3('0x13')](function(_0x33fd92){logger['error'](_0xd9d3('0x14'),_0x33fd92[_0xd9d3('0x10')],_0xcf7324);_0xcc6854(_0x267665[_0xd9d3('0xf')](0x1f4,_0x33fd92['message']));});});};exports[_0xd9d3('0x20')]=function(_0x180122){var _0x4eeecb=this;return new Promise(function(_0x3327df,_0x27f5e4){return db[_0xd9d3('0x15')]['find']({'raw':_0x180122[_0xd9d3('0x17')]?_0x180122['options']['raw']===undefined?!![]:![]:!![],'where':_0x180122['options']?_0x180122[_0xd9d3('0x17')]['where']||null:null,'attributes':_0x180122['options']?_0x180122['options']['attributes']||null:null,'include':_0x180122['options']?_0x180122[_0xd9d3('0x17')][_0xd9d3('0x1c')]?_[_0xd9d3('0x1d')](_0x180122['options'][_0xd9d3('0x1c')],function(_0x4cb61c){return{'model':db[_0x4cb61c[_0xd9d3('0x1e')]],'as':_0x4cb61c['as'],'attributes':_0x4cb61c[_0xd9d3('0x1a')],'include':_0x4cb61c[_0xd9d3('0x1c')]?_[_0xd9d3('0x1d')](_0x4cb61c[_0xd9d3('0x1c')],function(_0xb96da9){return{'model':db[_0xb96da9[_0xd9d3('0x1e')]],'as':_0xb96da9['as'],'attributes':_0xb96da9['attributes'],'include':_0xb96da9[_0xd9d3('0x1c')]?_[_0xd9d3('0x1d')](_0xb96da9['include'],function(_0x3afbbe){return{'model':db[_0x3afbbe[_0xd9d3('0x1e')]],'as':_0x3afbbe['as'],'attributes':_0x3afbbe[_0xd9d3('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd9d3('0xc')](function(_0x4125fe){logger['info'](_0xd9d3('0x20'),_0x180122);logger[_0xd9d3('0xe')](_0xd9d3('0x20'),_0x180122,JSON[_0xd9d3('0x1f')](_0x4125fe));_0x3327df(_0x4125fe);})['catch'](function(_0x4a34c9){logger[_0xd9d3('0xf')]('ShowZohoAccount',_0x4a34c9['message'],_0x180122);_0x27f5e4(_0x4eeecb[_0xd9d3('0xf')](0x1f4,_0x4a34c9[_0xd9d3('0x10')]));});});}; \ No newline at end of file +var _0xf1fd=['where','attributes','limit','include','map','model','ShowZohoAccount','find','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','ZohoAccount,\x20%s,\x20%s','result','catch','GetZohoAccount','findAll','raw','options'];(function(_0x2a4834,_0x1e5015){var _0x146b43=function(_0x455318){while(--_0x455318){_0x2a4834['push'](_0x2a4834['shift']());}};_0x146b43(++_0x1e5015);}(_0xf1fd,0x1e4));var _0xdf1f=function(_0x782d78,_0x5ec4fe){_0x782d78=_0x782d78-0x0;var _0x4ef52b=_0xf1fd[_0x782d78];return _0x4ef52b;};'use strict';var _=require(_0xdf1f('0x0'));var util=require(_0xdf1f('0x1'));var moment=require('moment');var BPromise=require(_0xdf1f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf1f('0x3'))['db'];var utils=require(_0xdf1f('0x4'));var logger=require(_0xdf1f('0x5'))(_0xdf1f('0x6'));var config=require(_0xdf1f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdf1f('0x8')][_0xdf1f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4748b3,_0x42eff0,_0x1eaca0){return new BPromise(function(_0xde00c9,_0x5ba304){return client[_0xdf1f('0xa')](_0x4748b3,_0x1eaca0)[_0xdf1f('0xb')](function(_0x3d3102){logger[_0xdf1f('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x42eff0,_0xdf1f('0xd'));logger[_0xdf1f('0xe')](_0xdf1f('0xf'),_0x42eff0,_0xdf1f('0xd'),JSON[_0xdf1f('0x10')](_0x3d3102));if(_0x3d3102[_0xdf1f('0x11')]){if(_0x3d3102[_0xdf1f('0x11')]['code']===0x1f4){logger[_0xdf1f('0x11')]('ZohoAccount,\x20%s,\x20%s',_0x42eff0,_0x3d3102[_0xdf1f('0x11')]['message']);return _0x5ba304(_0x3d3102[_0xdf1f('0x11')][_0xdf1f('0x12')]);}logger[_0xdf1f('0x11')](_0xdf1f('0x13'),_0x42eff0,_0x3d3102[_0xdf1f('0x11')]['message']);return _0xde00c9(_0x3d3102[_0xdf1f('0x11')][_0xdf1f('0x12')]);}else{logger[_0xdf1f('0xc')](_0xdf1f('0x13'),_0x42eff0,'request\x20sent');_0xde00c9(_0x3d3102[_0xdf1f('0x14')][_0xdf1f('0x12')]);}})[_0xdf1f('0x15')](function(_0x29a9b2){logger[_0xdf1f('0x11')](_0xdf1f('0x13'),_0x42eff0,_0x29a9b2);_0x5ba304(_0x29a9b2);});});}exports[_0xdf1f('0x16')]=function(_0x3a3c99){var _0x50ec1f=this;return new Promise(function(_0x335d6a,_0x2cfdf1){return db['ZohoAccount'][_0xdf1f('0x17')]({'raw':_0x3a3c99['options']?_0x3a3c99['options'][_0xdf1f('0x18')]===undefined?!![]:![]:!![],'where':_0x3a3c99[_0xdf1f('0x19')]?_0x3a3c99[_0xdf1f('0x19')][_0xdf1f('0x1a')]||null:null,'attributes':_0x3a3c99[_0xdf1f('0x19')]?_0x3a3c99[_0xdf1f('0x19')][_0xdf1f('0x1b')]||null:null,'limit':_0x3a3c99['options']?_0x3a3c99[_0xdf1f('0x19')][_0xdf1f('0x1c')]||null:null,'include':_0x3a3c99[_0xdf1f('0x19')]?_0x3a3c99[_0xdf1f('0x19')][_0xdf1f('0x1d')]?_[_0xdf1f('0x1e')](_0x3a3c99['options'][_0xdf1f('0x1d')],function(_0x587d6f){return{'model':db[_0x587d6f[_0xdf1f('0x1f')]],'as':_0x587d6f['as'],'attributes':_0x587d6f['attributes'],'include':_0x587d6f[_0xdf1f('0x1d')]?_[_0xdf1f('0x1e')](_0x587d6f['include'],function(_0x5b4567){return{'model':db[_0x5b4567[_0xdf1f('0x1f')]],'as':_0x5b4567['as'],'attributes':_0x5b4567[_0xdf1f('0x1b')],'include':_0x5b4567[_0xdf1f('0x1d')]?_[_0xdf1f('0x1e')](_0x5b4567['include'],function(_0x42726a){return{'model':db[_0x42726a[_0xdf1f('0x1f')]],'as':_0x42726a['as'],'attributes':_0x42726a[_0xdf1f('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x58d8b5){logger[_0xdf1f('0xc')](_0xdf1f('0x16'),_0x3a3c99);logger[_0xdf1f('0xe')](_0xdf1f('0x16'),_0x3a3c99,JSON[_0xdf1f('0x10')](_0x58d8b5));_0x335d6a(_0x58d8b5);})[_0xdf1f('0x15')](function(_0x2c9164){logger[_0xdf1f('0x11')](_0xdf1f('0x16'),_0x2c9164[_0xdf1f('0x12')],_0x3a3c99);_0x2cfdf1(_0x50ec1f[_0xdf1f('0x11')](0x1f4,_0x2c9164[_0xdf1f('0x12')]));});});};exports[_0xdf1f('0x20')]=function(_0x451e89){var _0x3bd9f7=this;return new Promise(function(_0x4a8a1,_0x11b56d){return db['ZohoAccount'][_0xdf1f('0x21')]({'raw':_0x451e89[_0xdf1f('0x19')]?_0x451e89[_0xdf1f('0x19')][_0xdf1f('0x18')]===undefined?!![]:![]:!![],'where':_0x451e89[_0xdf1f('0x19')]?_0x451e89[_0xdf1f('0x19')][_0xdf1f('0x1a')]||null:null,'attributes':_0x451e89[_0xdf1f('0x19')]?_0x451e89[_0xdf1f('0x19')][_0xdf1f('0x1b')]||null:null,'include':_0x451e89['options']?_0x451e89[_0xdf1f('0x19')][_0xdf1f('0x1d')]?_[_0xdf1f('0x1e')](_0x451e89['options'][_0xdf1f('0x1d')],function(_0x9f2d0){return{'model':db[_0x9f2d0[_0xdf1f('0x1f')]],'as':_0x9f2d0['as'],'attributes':_0x9f2d0['attributes'],'include':_0x9f2d0[_0xdf1f('0x1d')]?_[_0xdf1f('0x1e')](_0x9f2d0[_0xdf1f('0x1d')],function(_0x43d07f){return{'model':db[_0x43d07f[_0xdf1f('0x1f')]],'as':_0x43d07f['as'],'attributes':_0x43d07f[_0xdf1f('0x1b')],'include':_0x43d07f[_0xdf1f('0x1d')]?_[_0xdf1f('0x1e')](_0x43d07f[_0xdf1f('0x1d')],function(_0x2c531e){return{'model':db[_0x2c531e[_0xdf1f('0x1f')]],'as':_0x2c531e['as'],'attributes':_0x2c531e[_0xdf1f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xdf1f('0xb')](function(_0x35619d){logger[_0xdf1f('0xc')](_0xdf1f('0x20'),_0x451e89);logger[_0xdf1f('0xe')](_0xdf1f('0x20'),_0x451e89,JSON[_0xdf1f('0x10')](_0x35619d));_0x4a8a1(_0x35619d);})[_0xdf1f('0x15')](function(_0xe254d2){logger[_0xdf1f('0x11')](_0xdf1f('0x20'),_0xe254d2[_0xdf1f('0x12')],_0x451e89);_0x11b56d(_0x3bd9f7[_0xdf1f('0x11')](0x1f4,_0xe254d2[_0xdf1f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 48dd68f..733c9af 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 _0x4522=['../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','getDescriptions','post','create','put','exports','path','connect-timeout','express','../../components/auth/service'];(function(_0x4c0658,_0x833e86){var _0x1ebcd7=function(_0x86b365){while(--_0x86b365){_0x4c0658['push'](_0x4c0658['shift']());}};_0x1ebcd7(++_0x833e86);}(_0x4522,0x1a0));var _0x2452=function(_0x5c8fe5,_0x3461d0){_0x5c8fe5=_0x5c8fe5-0x0;var _0x42928a=_0x4522[_0x5c8fe5];return _0x42928a;};'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')]('/',auth[_0x2452('0x8')](),controller[_0x2452('0x9')]);router[_0x2452('0x7')](_0x2452('0xa'),auth[_0x2452('0x8')](),controller[_0x2452('0xb')]);router[_0x2452('0x7')](_0x2452('0xc'),auth[_0x2452('0x8')](),controller[_0x2452('0xd')]);router[_0x2452('0x7')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x2452('0xe')]);router['get']('/:id/descriptions',auth[_0x2452('0x8')](),controller[_0x2452('0xf')]);router[_0x2452('0x10')]('/',auth[_0x2452('0x8')](),controller[_0x2452('0x11')]);router[_0x2452('0x12')](_0x2452('0xa'),auth[_0x2452('0x8')](),controller['update']);router['delete']('/:id',auth[_0x2452('0x8')](),controller['destroy']);module[_0x2452('0x13')]=router; \ No newline at end of file +var _0xce3a=['get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller'];(function(_0x144cb5,_0x4df03d){var _0x32991a=function(_0x4c4e77){while(--_0x4c4e77){_0x144cb5['push'](_0x144cb5['shift']());}};_0x32991a(++_0x4df03d);}(_0xce3a,0x194));var _0xace3=function(_0x4f4ce3,_0x12fdda){_0x4f4ce3=_0x4f4ce3-0x0;var _0x2f0eba=_0xce3a[_0x4f4ce3];return _0x2f0eba;};'use strict';var multer=require(_0xace3('0x0'));var util=require(_0xace3('0x1'));var path=require(_0xace3('0x2'));var timeout=require(_0xace3('0x3'));var express=require(_0xace3('0x4'));var router=express[_0xace3('0x5')]();var auth=require(_0xace3('0x6'));var interaction=require(_0xace3('0x7'));var config=require(_0xace3('0x8'));var controller=require(_0xace3('0x9'));router[_0xace3('0xa')]('/',auth[_0xace3('0xb')](),controller['index']);router[_0xace3('0xa')](_0xace3('0xc'),auth[_0xace3('0xb')](),controller[_0xace3('0xd')]);router['get'](_0xace3('0xe'),auth['isAuthenticated'](),controller[_0xace3('0xf')]);router[_0xace3('0xa')](_0xace3('0x10'),auth[_0xace3('0xb')](),controller[_0xace3('0x11')]);router[_0xace3('0xa')](_0xace3('0x12'),auth[_0xace3('0xb')](),controller['getDescriptions']);router['post']('/',auth['isAuthenticated'](),controller[_0xace3('0x13')]);router['put']('/:id',auth[_0xace3('0xb')](),controller['update']);router[_0xace3('0x14')]('/:id',auth[_0xace3('0xb')](),controller[_0xace3('0x15')]);module[_0xace3('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 9d10e36..03a87b0 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 _0xdacc=['sequelize','STRING','ENUM','lead','nothing','contact_lead','contact'];(function(_0x2c329e,_0x5c9860){var _0x329902=function(_0x7bd77a){while(--_0x7bd77a){_0x2c329e['push'](_0x2c329e['shift']());}};_0x329902(++_0x5c9860);}(_0xdacc,0x134));var _0xcdac=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xdacc[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xcdac('0x0'));module['exports']={'name':{'type':Sequelize[_0xcdac('0x1')]},'moduleCreate':{'type':Sequelize[_0xcdac('0x2')](_0xcdac('0x3'),'contact',_0xcdac('0x4')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize['ENUM'](_0xcdac('0x5'),_0xcdac('0x6'),_0xcdac('0x3')),'defaultValue':_0xcdac('0x5')},'description':{'type':Sequelize[_0xcdac('0x1')]}}; \ No newline at end of file +var _0x5d72=['exports','STRING','ENUM','contact','lead','contact_lead'];(function(_0x3c2901,_0x27254b){var _0x1bc97c=function(_0x4080b9){while(--_0x4080b9){_0x3c2901['push'](_0x3c2901['shift']());}};_0x1bc97c(++_0x27254b);}(_0x5d72,0x84));var _0x25d7=function(_0x5e28c2,_0x1e48ab){_0x5e28c2=_0x5e28c2-0x0;var _0x1a8cc6=_0x5d72[_0x5e28c2];return _0x1a8cc6;};'use strict';var Sequelize=require('sequelize');module[_0x25d7('0x0')]={'name':{'type':Sequelize[_0x25d7('0x1')]},'moduleCreate':{'type':Sequelize[_0x25d7('0x2')]('lead',_0x25d7('0x3'),'nothing'),'defaultValue':_0x25d7('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0x25d7('0x5'),_0x25d7('0x3'),_0x25d7('0x4')),'defaultValue':_0x25d7('0x5')},'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 9b50306..1756e56 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 _0xfbf4=['merge','type','options','includeAll','findAll','catch','show','keys','include','find','create','body','params','findOne','ZohoField','pick','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','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~!@#$%^&-_=+[{]}.','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','status','json','count','limit','set','Content-Range','apply','reject','save','destroy','stack','name','map','ZohoConfiguration','rawAttributes','fieldName','key','query','filters','attributes','intersection','fields','length','model','hasOwnProperty','nolimit','offset','order','sort','where','filter'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xfbf4,0x6f));var _0x4fbf=function(_0x35c5c8,_0x1b671a){_0x35c5c8=_0x35c5c8-0x0;var _0x52f3cf=_0xfbf4[_0x35c5c8];return _0x52f3cf;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4fbf('0x0'));var rimraf=require(_0x4fbf('0x1'));var zipdir=require(_0x4fbf('0x2'));var jsonpatch=require(_0x4fbf('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4fbf('0x4'));var Mustache=require(_0x4fbf('0x5'));var util=require(_0x4fbf('0x6'));var path=require(_0x4fbf('0x7'));var sox=require(_0x4fbf('0x8'));var csv=require(_0x4fbf('0x9'));var ejs=require(_0x4fbf('0xa'));var fs=require('fs');var _=require(_0x4fbf('0xb'));var squel=require(_0x4fbf('0xc'));var crypto=require(_0x4fbf('0xd'));var jsforce=require(_0x4fbf('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4fbf('0x9'));var querystring=require(_0x4fbf('0xf'));var Papa=require(_0x4fbf('0x10'));var Redis=require(_0x4fbf('0x11'));var authService=require(_0x4fbf('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4fbf('0x13'));var logger=require(_0x4fbf('0x14'))('api');var utils=require(_0x4fbf('0x15'));var config=require(_0x4fbf('0x16'));var db=require(_0x4fbf('0x17'))['db'];var jayson=require(_0x4fbf('0x18'));var client=jayson[_0x4fbf('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x2dfdaf,_0xe9ccca,_0x46a7fa){if(_0x46a7fa){var _0x3f5cce=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3f5cce[_0x4fbf('0x1a')](_0xe9ccca)){return _0x2dfdaf;}else{throw new db['Sequelize'][(_0x4fbf('0x1b'))](_0x4fbf('0x1c'));}}else{return _0x2dfdaf;}}function respondWithRpcPromise(_0x4ec018,_0x295a83,_0x4307c7,_0x7db0c){return new BPromise(function(_0x40a2a2,_0x3370d4){var _0x182ae0=_0x7db0c||client;return _0x182ae0['request'](_0x4ec018,_0x4307c7)[_0x4fbf('0x1d')](function(_0x3a2fdd){logger[_0x4fbf('0x1e')](_0x4fbf('0x1f'),_0x295a83,_0x4fbf('0x20'));logger[_0x4fbf('0x21')](_0x4fbf('0x22'),_0x295a83,_0x4fbf('0x20'),JSON[_0x4fbf('0x23')](_0x3a2fdd));if(_0x3a2fdd['error']){if(_0x3a2fdd[_0x4fbf('0x24')][_0x4fbf('0x25')]===0x1f4){logger[_0x4fbf('0x24')](_0x4fbf('0x1f'),_0x295a83,_0x3a2fdd[_0x4fbf('0x24')][_0x4fbf('0x26')]);return _0x3370d4(_0x3a2fdd[_0x4fbf('0x24')]['message']);}logger['error'](_0x4fbf('0x1f'),_0x295a83,_0x3a2fdd['error'][_0x4fbf('0x26')]);return _0x40a2a2(_0x3a2fdd[_0x4fbf('0x24')][_0x4fbf('0x26')]);}else{logger[_0x4fbf('0x1e')](_0x4fbf('0x1f'),_0x295a83,'request\x20sent');_0x40a2a2(_0x3a2fdd[_0x4fbf('0x27')]['message']);}})['catch'](function(_0x4384b9){logger[_0x4fbf('0x24')](_0x4fbf('0x1f'),_0x295a83,_0x4384b9);_0x3370d4(_0x4384b9);});});}function respondWithStatusCode(_0x3a1c5e,_0xc3f577){_0xc3f577=_0xc3f577||0xcc;return function(_0x41721b){if(_0x41721b){return _0x3a1c5e[_0x4fbf('0x28')](_0xc3f577);}return _0x3a1c5e['status'](_0xc3f577)[_0x4fbf('0x29')]();};}function respondWithResult(_0x525ff2,_0x2c5c3a){_0x2c5c3a=_0x2c5c3a||0xc8;return function(_0x52a637){if(_0x52a637){return _0x525ff2[_0x4fbf('0x2a')](_0x2c5c3a)[_0x4fbf('0x2b')](_0x52a637);}};}function respondWithFilteredResult(_0x391a9f,_0x5b8875){return function(_0x57f127){if(_0x57f127){var _0x619d1f=_0x57f127[_0x4fbf('0x2c')],_0x105288=_0x5b8875['offset'],_0x1b6972=_0x5b8875['offset']+_0x5b8875[_0x4fbf('0x2d')],_0xc193e8;if(_0x1b6972>=_0x619d1f){_0x1b6972=_0x619d1f;_0xc193e8=0xc8;}else{_0xc193e8=0xce;}_0x391a9f['status'](_0xc193e8);return _0x391a9f[_0x4fbf('0x2e')](_0x4fbf('0x2f'),_0x105288+'-'+_0x1b6972+'/'+_0x619d1f)[_0x4fbf('0x2b')](_0x57f127);}return null;};}function patchUpdates(_0x2f6b21){return function(_0x5fa1bb){try{jsonpatch[_0x4fbf('0x30')](_0x5fa1bb,_0x2f6b21,!![]);}catch(_0x315a41){return BPromise[_0x4fbf('0x31')](_0x315a41);}return _0x5fa1bb[_0x4fbf('0x32')]();};}function saveUpdates(_0x30ec06,_0x31e5ea){return function(_0x284154){if(_0x284154){return _0x284154['update'](_0x30ec06)['then'](function(_0x4158a6){return _0x4158a6;});}return null;};}function removeEntity(_0x45c5b4,_0x47825c){return function(_0x31f70c){if(_0x31f70c){return _0x31f70c[_0x4fbf('0x33')]()[_0x4fbf('0x1d')](function(){_0x45c5b4[_0x4fbf('0x2a')](0xcc)[_0x4fbf('0x29')]();});}};}function handleEntityNotFound(_0x703f34,_0x88fa01){return function(_0x3acf72){if(!_0x3acf72){_0x703f34[_0x4fbf('0x28')](0x194);}return _0x3acf72;};}function handleError(_0xb8e56e,_0x718e7d){_0x718e7d=_0x718e7d||0x1f4;return function(_0x1375fa){logger['error'](_0x1375fa[_0x4fbf('0x34')]);if(_0x1375fa[_0x4fbf('0x35')]){delete _0x1375fa[_0x4fbf('0x35')];}_0xb8e56e[_0x4fbf('0x2a')](_0x718e7d)['send'](_0x1375fa);};}exports['index']=function(_0x226658,_0x3a5cc4){var _0x3d0d4b={},_0x26cdfe={},_0xa9e5d3={'count':0x0,'rows':[]};var _0x3b3182=_[_0x4fbf('0x36')](db[_0x4fbf('0x37')][_0x4fbf('0x38')],function(_0x1c3690){return{'name':_0x1c3690[_0x4fbf('0x39')],'type':_0x1c3690['type'][_0x4fbf('0x3a')]};});_0x26cdfe['model']=_[_0x4fbf('0x36')](_0x3b3182,_0x4fbf('0x35'));_0x26cdfe[_0x4fbf('0x3b')]=_['keys'](_0x226658[_0x4fbf('0x3b')]);_0x26cdfe[_0x4fbf('0x3c')]=_['intersection'](_0x26cdfe['model'],_0x26cdfe[_0x4fbf('0x3b')]);_0x3d0d4b[_0x4fbf('0x3d')]=_[_0x4fbf('0x3e')](_0x26cdfe['model'],qs[_0x4fbf('0x3f')](_0x226658[_0x4fbf('0x3b')]['fields']));_0x3d0d4b[_0x4fbf('0x3d')]=_0x3d0d4b[_0x4fbf('0x3d')][_0x4fbf('0x40')]?_0x3d0d4b['attributes']:_0x26cdfe[_0x4fbf('0x41')];if(!_0x226658['query'][_0x4fbf('0x42')](_0x4fbf('0x43'))){_0x3d0d4b[_0x4fbf('0x2d')]=qs[_0x4fbf('0x2d')](_0x226658['query'][_0x4fbf('0x2d')]);_0x3d0d4b[_0x4fbf('0x44')]=qs[_0x4fbf('0x44')](_0x226658[_0x4fbf('0x3b')][_0x4fbf('0x44')]);}_0x3d0d4b[_0x4fbf('0x45')]=qs[_0x4fbf('0x46')](_0x226658['query'][_0x4fbf('0x46')]);_0x3d0d4b[_0x4fbf('0x47')]=qs[_0x4fbf('0x3c')](_['pick'](_0x226658['query'],_0x26cdfe['filters']),_0x3b3182);if(_0x226658[_0x4fbf('0x3b')][_0x4fbf('0x48')]){_0x3d0d4b[_0x4fbf('0x47')]=_[_0x4fbf('0x49')](_0x3d0d4b[_0x4fbf('0x47')],{'$or':_[_0x4fbf('0x36')](_0x3b3182,function(_0x3363ce){if(_0x3363ce[_0x4fbf('0x4a')]!=='VIRTUAL'){var _0x1ababc={};_0x1ababc[_0x3363ce['name']]={'$like':'%'+_0x226658[_0x4fbf('0x3b')][_0x4fbf('0x48')]+'%'};return _0x1ababc;}})});}_0x3d0d4b=_['merge']({},_0x3d0d4b,_0x226658[_0x4fbf('0x4b')]);var _0x1dded7={'where':_0x3d0d4b[_0x4fbf('0x47')]};return db[_0x4fbf('0x37')][_0x4fbf('0x2c')](_0x1dded7)['then'](function(_0x102588){_0xa9e5d3[_0x4fbf('0x2c')]=_0x102588;if(_0x226658[_0x4fbf('0x3b')][_0x4fbf('0x4c')]){_0x3d0d4b['include']=[{'all':!![]}];}return db[_0x4fbf('0x37')][_0x4fbf('0x4d')](_0x3d0d4b);})[_0x4fbf('0x1d')](function(_0x3965ef){_0xa9e5d3['rows']=_0x3965ef;return _0xa9e5d3;})[_0x4fbf('0x1d')](respondWithFilteredResult(_0x3a5cc4,_0x3d0d4b))[_0x4fbf('0x4e')](handleError(_0x3a5cc4,null));};exports[_0x4fbf('0x4f')]=function(_0x2e8189,_0x5b230c){var _0x4a15af={'raw':![],'where':{'id':_0x2e8189['params']['id']}},_0x20e54f={};_0x20e54f[_0x4fbf('0x41')]=_[_0x4fbf('0x50')](db['ZohoConfiguration'][_0x4fbf('0x38')]);_0x20e54f[_0x4fbf('0x3b')]=_[_0x4fbf('0x50')](_0x2e8189[_0x4fbf('0x3b')]);_0x20e54f[_0x4fbf('0x3c')]=_[_0x4fbf('0x3e')](_0x20e54f[_0x4fbf('0x41')],_0x20e54f['query']);_0x4a15af[_0x4fbf('0x3d')]=_[_0x4fbf('0x3e')](_0x20e54f[_0x4fbf('0x41')],qs[_0x4fbf('0x3f')](_0x2e8189[_0x4fbf('0x3b')]['fields']));_0x4a15af['attributes']=_0x4a15af[_0x4fbf('0x3d')][_0x4fbf('0x40')]?_0x4a15af[_0x4fbf('0x3d')]:_0x20e54f['model'];if(_0x2e8189[_0x4fbf('0x3b')][_0x4fbf('0x4c')]){_0x4a15af[_0x4fbf('0x51')]=[{'all':!![]}];}_0x4a15af=_[_0x4fbf('0x49')]({},_0x4a15af,_0x2e8189['options']);return db[_0x4fbf('0x37')][_0x4fbf('0x52')](_0x4a15af)[_0x4fbf('0x1d')](handleEntityNotFound(_0x5b230c,null))[_0x4fbf('0x1d')](respondWithResult(_0x5b230c,null))[_0x4fbf('0x4e')](handleError(_0x5b230c,null));};exports[_0x4fbf('0x53')]=function(_0x1dc004,_0x4a201e){return db[_0x4fbf('0x37')][_0x4fbf('0x53')](_0x1dc004[_0x4fbf('0x54')],{})[_0x4fbf('0x1d')](respondWithResult(_0x4a201e,0xc9))[_0x4fbf('0x4e')](handleError(_0x4a201e,null));};exports['update']=function(_0x3a0f08,_0x3b5820){if(_0x3a0f08['body']['id']){delete _0x3a0f08['body']['id'];}return db['ZohoConfiguration']['find']({'where':{'id':_0x3a0f08[_0x4fbf('0x55')]['id']}})[_0x4fbf('0x1d')](handleEntityNotFound(_0x3b5820,null))[_0x4fbf('0x1d')](saveUpdates(_0x3a0f08[_0x4fbf('0x54')],null))['then'](respondWithResult(_0x3b5820,null))[_0x4fbf('0x4e')](handleError(_0x3b5820,null));};exports['destroy']=function(_0x22b533,_0x47bb6f){return db[_0x4fbf('0x37')][_0x4fbf('0x52')]({'where':{'id':_0x22b533['params']['id']}})[_0x4fbf('0x1d')](handleEntityNotFound(_0x47bb6f,null))['then'](removeEntity(_0x47bb6f,null))[_0x4fbf('0x4e')](handleError(_0x47bb6f,null));};exports['getFields']=function(_0x50c814,_0x2e04a9,_0x2d4f36){var _0x196bfe={};var _0x19b671={};var _0x23a3f2;var _0x3fcfb0;return db['ZohoConfiguration'][_0x4fbf('0x56')]({'where':{'id':_0x50c814[_0x4fbf('0x55')]['id']}})[_0x4fbf('0x1d')](handleEntityNotFound(_0x2e04a9,null))[_0x4fbf('0x1d')](function(_0x456ea0){if(_0x456ea0){_0x23a3f2=_0x456ea0;_0x19b671[_0x4fbf('0x41')]=_['keys'](db[_0x4fbf('0x57')][_0x4fbf('0x38')]);_0x19b671['query']=_[_0x4fbf('0x50')](_0x50c814['query']);_0x19b671['filters']=_[_0x4fbf('0x3e')](_0x19b671[_0x4fbf('0x41')],_0x19b671[_0x4fbf('0x3b')]);_0x196bfe[_0x4fbf('0x3d')]=_[_0x4fbf('0x3e')](_0x19b671[_0x4fbf('0x41')],qs[_0x4fbf('0x3f')](_0x50c814['query'][_0x4fbf('0x3f')]));_0x196bfe[_0x4fbf('0x3d')]=_0x196bfe[_0x4fbf('0x3d')]['length']?_0x196bfe[_0x4fbf('0x3d')]:_0x19b671[_0x4fbf('0x41')];_0x196bfe[_0x4fbf('0x45')]=qs[_0x4fbf('0x46')](_0x50c814[_0x4fbf('0x3b')][_0x4fbf('0x46')]);_0x196bfe[_0x4fbf('0x47')]=qs[_0x4fbf('0x3c')](_[_0x4fbf('0x58')](_0x50c814[_0x4fbf('0x3b')],_0x19b671[_0x4fbf('0x3c')]));if(_0x50c814['query'][_0x4fbf('0x48')]){_0x196bfe[_0x4fbf('0x47')]=_['merge'](_0x196bfe[_0x4fbf('0x47')],{'$or':_['map'](_0x196bfe[_0x4fbf('0x3d')],function(_0x10f762){var _0x402122={};_0x402122[_0x10f762]={'$like':'%'+_0x50c814[_0x4fbf('0x3b')][_0x4fbf('0x48')]+'%'};return _0x402122;})});}_0x196bfe=_[_0x4fbf('0x49')]({},_0x196bfe,_0x50c814[_0x4fbf('0x4b')]);return _0x23a3f2['getFields'](_0x196bfe);}})[_0x4fbf('0x1d')](function(_0x1bcb5a){if(_0x1bcb5a){_0x3fcfb0=_0x1bcb5a[_0x4fbf('0x40')];if(!_0x50c814[_0x4fbf('0x3b')][_0x4fbf('0x42')](_0x4fbf('0x43'))){_0x196bfe['limit']=qs[_0x4fbf('0x2d')](_0x50c814['query'][_0x4fbf('0x2d')]);_0x196bfe[_0x4fbf('0x44')]=qs[_0x4fbf('0x44')](_0x50c814[_0x4fbf('0x3b')][_0x4fbf('0x44')]);}return _0x23a3f2[_0x4fbf('0x59')](_0x196bfe);}})['then'](function(_0x3fbf46){if(_0x3fbf46){return _0x3fbf46?{'count':_0x3fcfb0,'rows':_0x3fbf46}:null;}})[_0x4fbf('0x1d')](respondWithResult(_0x2e04a9,null))[_0x4fbf('0x4e')](handleError(_0x2e04a9,null));};exports[_0x4fbf('0x5a')]=function(_0x5955b9,_0x318a0d,_0x50edc8){var _0x3c8c23={};var _0xcbce8d={};var _0x25cbd2;var _0x5c411c;return db[_0x4fbf('0x37')]['findOne']({'where':{'id':_0x5955b9[_0x4fbf('0x55')]['id']}})[_0x4fbf('0x1d')](handleEntityNotFound(_0x318a0d,null))['then'](function(_0x39ca60){if(_0x39ca60){_0x25cbd2=_0x39ca60;_0xcbce8d[_0x4fbf('0x41')]=_[_0x4fbf('0x50')](db[_0x4fbf('0x57')][_0x4fbf('0x38')]);_0xcbce8d[_0x4fbf('0x3b')]=_['keys'](_0x5955b9[_0x4fbf('0x3b')]);_0xcbce8d[_0x4fbf('0x3c')]=_[_0x4fbf('0x3e')](_0xcbce8d[_0x4fbf('0x41')],_0xcbce8d[_0x4fbf('0x3b')]);_0x3c8c23[_0x4fbf('0x3d')]=_['intersection'](_0xcbce8d[_0x4fbf('0x41')],qs[_0x4fbf('0x3f')](_0x5955b9['query'][_0x4fbf('0x3f')]));_0x3c8c23[_0x4fbf('0x3d')]=_0x3c8c23[_0x4fbf('0x3d')][_0x4fbf('0x40')]?_0x3c8c23[_0x4fbf('0x3d')]:_0xcbce8d[_0x4fbf('0x41')];_0x3c8c23['order']=qs[_0x4fbf('0x46')](_0x5955b9[_0x4fbf('0x3b')][_0x4fbf('0x46')]);_0x3c8c23['where']=qs['filters'](_['pick'](_0x5955b9['query'],_0xcbce8d['filters']));if(_0x5955b9[_0x4fbf('0x3b')][_0x4fbf('0x48')]){_0x3c8c23[_0x4fbf('0x47')]=_[_0x4fbf('0x49')](_0x3c8c23[_0x4fbf('0x47')],{'$or':_[_0x4fbf('0x36')](_0x3c8c23[_0x4fbf('0x3d')],function(_0x1cf581){var _0x5519c9={};_0x5519c9[_0x1cf581]={'$like':'%'+_0x5955b9['query'][_0x4fbf('0x48')]+'%'};return _0x5519c9;})});}_0x3c8c23=_[_0x4fbf('0x49')]({},_0x3c8c23,_0x5955b9['options']);return _0x25cbd2[_0x4fbf('0x5a')](_0x3c8c23);}})[_0x4fbf('0x1d')](function(_0x402414){if(_0x402414){_0x5c411c=_0x402414[_0x4fbf('0x40')];if(!_0x5955b9[_0x4fbf('0x3b')][_0x4fbf('0x42')](_0x4fbf('0x43'))){_0x3c8c23[_0x4fbf('0x2d')]=qs[_0x4fbf('0x2d')](_0x5955b9[_0x4fbf('0x3b')]['limit']);_0x3c8c23[_0x4fbf('0x44')]=qs[_0x4fbf('0x44')](_0x5955b9[_0x4fbf('0x3b')][_0x4fbf('0x44')]);}return _0x25cbd2[_0x4fbf('0x5a')](_0x3c8c23);}})['then'](function(_0xd27506){if(_0xd27506){return _0xd27506?{'count':_0x5c411c,'rows':_0xd27506}:null;}})['then'](respondWithResult(_0x318a0d,null))['catch'](handleError(_0x318a0d,null));};exports[_0x4fbf('0x5b')]=function(_0xb8529b,_0x4ccbdb,_0x3b5cab){var _0x553dd8={};var _0x40939f={};var _0x2f5b9b;var _0x5bb4bd;return db[_0x4fbf('0x37')]['findOne']({'where':{'id':_0xb8529b[_0x4fbf('0x55')]['id']}})[_0x4fbf('0x1d')](handleEntityNotFound(_0x4ccbdb,null))[_0x4fbf('0x1d')](function(_0x524e0a){if(_0x524e0a){_0x2f5b9b=_0x524e0a;_0x40939f[_0x4fbf('0x41')]=_[_0x4fbf('0x50')](db[_0x4fbf('0x57')][_0x4fbf('0x38')]);_0x40939f[_0x4fbf('0x3b')]=_['keys'](_0xb8529b['query']);_0x40939f['filters']=_[_0x4fbf('0x3e')](_0x40939f[_0x4fbf('0x41')],_0x40939f[_0x4fbf('0x3b')]);_0x553dd8[_0x4fbf('0x3d')]=_[_0x4fbf('0x3e')](_0x40939f[_0x4fbf('0x41')],qs[_0x4fbf('0x3f')](_0xb8529b[_0x4fbf('0x3b')][_0x4fbf('0x3f')]));_0x553dd8[_0x4fbf('0x3d')]=_0x553dd8[_0x4fbf('0x3d')]['length']?_0x553dd8['attributes']:_0x40939f[_0x4fbf('0x41')];_0x553dd8[_0x4fbf('0x45')]=qs[_0x4fbf('0x46')](_0xb8529b[_0x4fbf('0x3b')][_0x4fbf('0x46')]);_0x553dd8[_0x4fbf('0x47')]=qs['filters'](_[_0x4fbf('0x58')](_0xb8529b[_0x4fbf('0x3b')],_0x40939f[_0x4fbf('0x3c')]));if(_0xb8529b[_0x4fbf('0x3b')]['filter']){_0x553dd8[_0x4fbf('0x47')]=_[_0x4fbf('0x49')](_0x553dd8[_0x4fbf('0x47')],{'$or':_[_0x4fbf('0x36')](_0x553dd8['attributes'],function(_0x1bea00){var _0x485171={};_0x485171[_0x1bea00]={'$like':'%'+_0xb8529b['query']['filter']+'%'};return _0x485171;})});}_0x553dd8=_['merge']({},_0x553dd8,_0xb8529b[_0x4fbf('0x4b')]);return _0x2f5b9b[_0x4fbf('0x5b')](_0x553dd8);}})[_0x4fbf('0x1d')](function(_0x3fb15a){if(_0x3fb15a){_0x5bb4bd=_0x3fb15a[_0x4fbf('0x40')];if(!_0xb8529b[_0x4fbf('0x3b')]['hasOwnProperty'](_0x4fbf('0x43'))){_0x553dd8[_0x4fbf('0x2d')]=qs['limit'](_0xb8529b[_0x4fbf('0x3b')][_0x4fbf('0x2d')]);_0x553dd8['offset']=qs[_0x4fbf('0x44')](_0xb8529b[_0x4fbf('0x3b')][_0x4fbf('0x44')]);}return _0x2f5b9b[_0x4fbf('0x5b')](_0x553dd8);}})[_0x4fbf('0x1d')](function(_0x136a60){if(_0x136a60){return _0x136a60?{'count':_0x5bb4bd,'rows':_0x136a60}:null;}})[_0x4fbf('0x1d')](respondWithResult(_0x4ccbdb,null))[_0x4fbf('0x4e')](handleError(_0x4ccbdb,null));}; \ No newline at end of file +var _0x1ea1=['reject','destroy','then','end','stack','name','index','map','ZohoConfiguration','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','include','findAll','rows','show','fields','length','options','find','create','body','params','findOne','ZohoField','getFields','nolimit','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','client','http','test','Sequelize','ValidationError','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','json','count','offset','limit','Content-Range','apply'];(function(_0x4d28c4,_0x395975){var _0x2f8c67=function(_0x1bbe7d){while(--_0x1bbe7d){_0x4d28c4['push'](_0x4d28c4['shift']());}};_0x2f8c67(++_0x395975);}(_0x1ea1,0xdd));var _0x11ea=function(_0x4548bb,_0x3cb9b3){_0x4548bb=_0x4548bb-0x0;var _0x310687=_0x1ea1[_0x4548bb];return _0x310687;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x11ea('0x0'));var rimraf=require(_0x11ea('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x11ea('0x2'));var rp=require(_0x11ea('0x3'));var moment=require(_0x11ea('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x11ea('0x5'));var util=require(_0x11ea('0x6'));var path=require(_0x11ea('0x7'));var sox=require('sox');var csv=require(_0x11ea('0x8'));var ejs=require(_0x11ea('0x9'));var fs=require('fs');var _=require(_0x11ea('0xa'));var squel=require(_0x11ea('0xb'));var crypto=require(_0x11ea('0xc'));var jsforce=require(_0x11ea('0xd'));var deskjs=require(_0x11ea('0xe'));var toCsv=require(_0x11ea('0x8'));var querystring=require(_0x11ea('0xf'));var Papa=require(_0x11ea('0x10'));var Redis=require(_0x11ea('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x11ea('0x12'));var as=require(_0x11ea('0x13'));var hardwareService=require(_0x11ea('0x14'));var logger=require(_0x11ea('0x15'))('api');var utils=require(_0x11ea('0x16'));var config=require(_0x11ea('0x17'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x11ea('0x18')][_0x11ea('0x19')]({'port':0x232a});function checkPasswordPattern(_0x589850,_0x1233a9,_0x256a77){if(_0x256a77){var _0x590b2d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x590b2d[_0x11ea('0x1a')](_0x1233a9)){return _0x589850;}else{throw new db[(_0x11ea('0x1b'))][(_0x11ea('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 _0x589850;}}function respondWithRpcPromise(_0x13a119,_0x16d651,_0x8b1ba6,_0x41e12e){return new BPromise(function(_0x5eb2ff,_0x592fdb){var _0x1a2def=_0x41e12e||client;return _0x1a2def['request'](_0x13a119,_0x8b1ba6)['then'](function(_0x3a5a4b){logger[_0x11ea('0x1d')](_0x11ea('0x1e'),_0x16d651,_0x11ea('0x1f'));logger['debug'](_0x11ea('0x20'),_0x16d651,_0x11ea('0x1f'),JSON[_0x11ea('0x21')](_0x3a5a4b));if(_0x3a5a4b['error']){if(_0x3a5a4b[_0x11ea('0x22')][_0x11ea('0x23')]===0x1f4){logger[_0x11ea('0x22')]('ZohoConfiguration,\x20%s,\x20%s',_0x16d651,_0x3a5a4b[_0x11ea('0x22')][_0x11ea('0x24')]);return _0x592fdb(_0x3a5a4b[_0x11ea('0x22')][_0x11ea('0x24')]);}logger[_0x11ea('0x22')]('ZohoConfiguration,\x20%s,\x20%s',_0x16d651,_0x3a5a4b[_0x11ea('0x22')]['message']);return _0x5eb2ff(_0x3a5a4b[_0x11ea('0x22')][_0x11ea('0x24')]);}else{logger[_0x11ea('0x1d')]('ZohoConfiguration,\x20%s,\x20%s',_0x16d651,'request\x20sent');_0x5eb2ff(_0x3a5a4b['result']['message']);}})[_0x11ea('0x25')](function(_0x5d2a42){logger['error'](_0x11ea('0x1e'),_0x16d651,_0x5d2a42);_0x592fdb(_0x5d2a42);});});}function respondWithStatusCode(_0x3f8af7,_0x37759a){_0x37759a=_0x37759a||0xcc;return function(_0x46f410){if(_0x46f410){return _0x3f8af7[_0x11ea('0x26')](_0x37759a);}return _0x3f8af7[_0x11ea('0x27')](_0x37759a)['end']();};}function respondWithResult(_0x4813f5,_0x3b5d4c){_0x3b5d4c=_0x3b5d4c||0xc8;return function(_0x2dec89){if(_0x2dec89){return _0x4813f5[_0x11ea('0x27')](_0x3b5d4c)[_0x11ea('0x28')](_0x2dec89);}};}function respondWithFilteredResult(_0x455f2a,_0x305f26){return function(_0x3a2fe4){if(_0x3a2fe4){var _0x5513d2=_0x3a2fe4[_0x11ea('0x29')],_0x1b7667=_0x305f26['offset'],_0x4e1223=_0x305f26[_0x11ea('0x2a')]+_0x305f26[_0x11ea('0x2b')],_0x1642f6;if(_0x4e1223>=_0x5513d2){_0x4e1223=_0x5513d2;_0x1642f6=0xc8;}else{_0x1642f6=0xce;}_0x455f2a[_0x11ea('0x27')](_0x1642f6);return _0x455f2a['set'](_0x11ea('0x2c'),_0x1b7667+'-'+_0x4e1223+'/'+_0x5513d2)[_0x11ea('0x28')](_0x3a2fe4);}return null;};}function patchUpdates(_0x41dd01){return function(_0x578da3){try{jsonpatch[_0x11ea('0x2d')](_0x578da3,_0x41dd01,!![]);}catch(_0x1a3fc6){return BPromise[_0x11ea('0x2e')](_0x1a3fc6);}return _0x578da3['save']();};}function saveUpdates(_0x477526,_0x53e389){return function(_0x45d29d){if(_0x45d29d){return _0x45d29d['update'](_0x477526)['then'](function(_0x41f044){return _0x41f044;});}return null;};}function removeEntity(_0x5eeea4,_0x343885){return function(_0x4039ef){if(_0x4039ef){return _0x4039ef[_0x11ea('0x2f')]()[_0x11ea('0x30')](function(){_0x5eeea4[_0x11ea('0x27')](0xcc)[_0x11ea('0x31')]();});}};}function handleEntityNotFound(_0x4ec292,_0x56e041){return function(_0x49cc47){if(!_0x49cc47){_0x4ec292[_0x11ea('0x26')](0x194);}return _0x49cc47;};}function handleError(_0x49bfc0,_0xf3c34a){_0xf3c34a=_0xf3c34a||0x1f4;return function(_0x2fdc1d){logger[_0x11ea('0x22')](_0x2fdc1d[_0x11ea('0x32')]);if(_0x2fdc1d[_0x11ea('0x33')]){delete _0x2fdc1d[_0x11ea('0x33')];}_0x49bfc0[_0x11ea('0x27')](_0xf3c34a)['send'](_0x2fdc1d);};}exports[_0x11ea('0x34')]=function(_0x3f551b,_0x1163fd){var _0x556f0e={},_0x1a35bc={},_0x4bfe55={'count':0x0,'rows':[]};var _0x1b2ea6=_[_0x11ea('0x35')](db[_0x11ea('0x36')][_0x11ea('0x37')],function(_0x2cff2a){return{'name':_0x2cff2a[_0x11ea('0x38')],'type':_0x2cff2a[_0x11ea('0x39')]['key']};});_0x1a35bc['model']=_[_0x11ea('0x35')](_0x1b2ea6,'name');_0x1a35bc['query']=_[_0x11ea('0x3a')](_0x3f551b[_0x11ea('0x3b')]);_0x1a35bc[_0x11ea('0x3c')]=_[_0x11ea('0x3d')](_0x1a35bc[_0x11ea('0x3e')],_0x1a35bc[_0x11ea('0x3b')]);_0x556f0e[_0x11ea('0x3f')]=_['intersection'](_0x1a35bc[_0x11ea('0x3e')],qs['fields'](_0x3f551b[_0x11ea('0x3b')]['fields']));_0x556f0e[_0x11ea('0x3f')]=_0x556f0e[_0x11ea('0x3f')]['length']?_0x556f0e['attributes']:_0x1a35bc[_0x11ea('0x3e')];if(!_0x3f551b[_0x11ea('0x3b')][_0x11ea('0x40')]('nolimit')){_0x556f0e[_0x11ea('0x2b')]=qs['limit'](_0x3f551b[_0x11ea('0x3b')][_0x11ea('0x2b')]);_0x556f0e[_0x11ea('0x2a')]=qs[_0x11ea('0x2a')](_0x3f551b['query']['offset']);}_0x556f0e[_0x11ea('0x41')]=qs['sort'](_0x3f551b[_0x11ea('0x3b')][_0x11ea('0x42')]);_0x556f0e[_0x11ea('0x43')]=qs[_0x11ea('0x3c')](_[_0x11ea('0x44')](_0x3f551b[_0x11ea('0x3b')],_0x1a35bc[_0x11ea('0x3c')]),_0x1b2ea6);if(_0x3f551b[_0x11ea('0x3b')]['filter']){_0x556f0e[_0x11ea('0x43')]=_['merge'](_0x556f0e[_0x11ea('0x43')],{'$or':_[_0x11ea('0x35')](_0x1b2ea6,function(_0x473582){if(_0x473582[_0x11ea('0x39')]!==_0x11ea('0x45')){var _0x373d96={};_0x373d96[_0x473582[_0x11ea('0x33')]]={'$like':'%'+_0x3f551b['query'][_0x11ea('0x46')]+'%'};return _0x373d96;}})});}_0x556f0e=_[_0x11ea('0x47')]({},_0x556f0e,_0x3f551b['options']);var _0x1f9c2a={'where':_0x556f0e[_0x11ea('0x43')]};return db['ZohoConfiguration'][_0x11ea('0x29')](_0x1f9c2a)[_0x11ea('0x30')](function(_0x6b3c3d){_0x4bfe55[_0x11ea('0x29')]=_0x6b3c3d;if(_0x3f551b[_0x11ea('0x3b')]['includeAll']){_0x556f0e[_0x11ea('0x48')]=[{'all':!![]}];}return db[_0x11ea('0x36')][_0x11ea('0x49')](_0x556f0e);})[_0x11ea('0x30')](function(_0x47badf){_0x4bfe55[_0x11ea('0x4a')]=_0x47badf;return _0x4bfe55;})[_0x11ea('0x30')](respondWithFilteredResult(_0x1163fd,_0x556f0e))[_0x11ea('0x25')](handleError(_0x1163fd,null));};exports[_0x11ea('0x4b')]=function(_0x32ef69,_0x4f5d19){var _0x5bb297={'raw':![],'where':{'id':_0x32ef69['params']['id']}},_0x59c87b={};_0x59c87b['model']=_[_0x11ea('0x3a')](db[_0x11ea('0x36')]['rawAttributes']);_0x59c87b[_0x11ea('0x3b')]=_['keys'](_0x32ef69['query']);_0x59c87b[_0x11ea('0x3c')]=_[_0x11ea('0x3d')](_0x59c87b[_0x11ea('0x3e')],_0x59c87b['query']);_0x5bb297[_0x11ea('0x3f')]=_[_0x11ea('0x3d')](_0x59c87b[_0x11ea('0x3e')],qs[_0x11ea('0x4c')](_0x32ef69[_0x11ea('0x3b')]['fields']));_0x5bb297[_0x11ea('0x3f')]=_0x5bb297[_0x11ea('0x3f')][_0x11ea('0x4d')]?_0x5bb297[_0x11ea('0x3f')]:_0x59c87b['model'];if(_0x32ef69[_0x11ea('0x3b')]['includeAll']){_0x5bb297[_0x11ea('0x48')]=[{'all':!![]}];}_0x5bb297=_[_0x11ea('0x47')]({},_0x5bb297,_0x32ef69[_0x11ea('0x4e')]);return db[_0x11ea('0x36')][_0x11ea('0x4f')](_0x5bb297)[_0x11ea('0x30')](handleEntityNotFound(_0x4f5d19,null))['then'](respondWithResult(_0x4f5d19,null))[_0x11ea('0x25')](handleError(_0x4f5d19,null));};exports[_0x11ea('0x50')]=function(_0x531a88,_0x131eb9){return db['ZohoConfiguration'][_0x11ea('0x50')](_0x531a88[_0x11ea('0x51')],{})[_0x11ea('0x30')](respondWithResult(_0x131eb9,0xc9))[_0x11ea('0x25')](handleError(_0x131eb9,null));};exports['update']=function(_0x25cf2e,_0x335625){if(_0x25cf2e['body']['id']){delete _0x25cf2e[_0x11ea('0x51')]['id'];}return db[_0x11ea('0x36')][_0x11ea('0x4f')]({'where':{'id':_0x25cf2e[_0x11ea('0x52')]['id']}})['then'](handleEntityNotFound(_0x335625,null))[_0x11ea('0x30')](saveUpdates(_0x25cf2e[_0x11ea('0x51')],null))[_0x11ea('0x30')](respondWithResult(_0x335625,null))[_0x11ea('0x25')](handleError(_0x335625,null));};exports[_0x11ea('0x2f')]=function(_0xba6b01,_0xaadee6){return db[_0x11ea('0x36')]['find']({'where':{'id':_0xba6b01[_0x11ea('0x52')]['id']}})[_0x11ea('0x30')](handleEntityNotFound(_0xaadee6,null))[_0x11ea('0x30')](removeEntity(_0xaadee6,null))[_0x11ea('0x25')](handleError(_0xaadee6,null));};exports['getFields']=function(_0x207d48,_0x5600a4,_0x3ff23a){var _0x2f4882={};var _0x111a69={};var _0x5988ce;var _0x32d411;return db[_0x11ea('0x36')][_0x11ea('0x53')]({'where':{'id':_0x207d48[_0x11ea('0x52')]['id']}})[_0x11ea('0x30')](handleEntityNotFound(_0x5600a4,null))[_0x11ea('0x30')](function(_0x29d86d){if(_0x29d86d){_0x5988ce=_0x29d86d;_0x111a69[_0x11ea('0x3e')]=_[_0x11ea('0x3a')](db[_0x11ea('0x54')]['rawAttributes']);_0x111a69[_0x11ea('0x3b')]=_[_0x11ea('0x3a')](_0x207d48[_0x11ea('0x3b')]);_0x111a69[_0x11ea('0x3c')]=_[_0x11ea('0x3d')](_0x111a69['model'],_0x111a69['query']);_0x2f4882[_0x11ea('0x3f')]=_[_0x11ea('0x3d')](_0x111a69['model'],qs[_0x11ea('0x4c')](_0x207d48[_0x11ea('0x3b')][_0x11ea('0x4c')]));_0x2f4882[_0x11ea('0x3f')]=_0x2f4882['attributes'][_0x11ea('0x4d')]?_0x2f4882['attributes']:_0x111a69['model'];_0x2f4882[_0x11ea('0x41')]=qs['sort'](_0x207d48[_0x11ea('0x3b')][_0x11ea('0x42')]);_0x2f4882[_0x11ea('0x43')]=qs['filters'](_[_0x11ea('0x44')](_0x207d48[_0x11ea('0x3b')],_0x111a69[_0x11ea('0x3c')]));if(_0x207d48[_0x11ea('0x3b')][_0x11ea('0x46')]){_0x2f4882['where']=_[_0x11ea('0x47')](_0x2f4882['where'],{'$or':_[_0x11ea('0x35')](_0x2f4882[_0x11ea('0x3f')],function(_0xb73814){var _0x4c1f53={};_0x4c1f53[_0xb73814]={'$like':'%'+_0x207d48['query'][_0x11ea('0x46')]+'%'};return _0x4c1f53;})});}_0x2f4882=_['merge']({},_0x2f4882,_0x207d48['options']);return _0x5988ce[_0x11ea('0x55')](_0x2f4882);}})[_0x11ea('0x30')](function(_0x166d2a){if(_0x166d2a){_0x32d411=_0x166d2a['length'];if(!_0x207d48[_0x11ea('0x3b')][_0x11ea('0x40')](_0x11ea('0x56'))){_0x2f4882['limit']=qs[_0x11ea('0x2b')](_0x207d48[_0x11ea('0x3b')][_0x11ea('0x2b')]);_0x2f4882[_0x11ea('0x2a')]=qs[_0x11ea('0x2a')](_0x207d48['query'][_0x11ea('0x2a')]);}return _0x5988ce[_0x11ea('0x55')](_0x2f4882);}})[_0x11ea('0x30')](function(_0x422960){if(_0x422960){return _0x422960?{'count':_0x32d411,'rows':_0x422960}:null;}})[_0x11ea('0x30')](respondWithResult(_0x5600a4,null))[_0x11ea('0x25')](handleError(_0x5600a4,null));};exports['getSubjects']=function(_0x1f8637,_0x1ccc60,_0x4c19a4){var _0x27e663={};var _0x166e0d={};var _0x149c94;var _0xca1e8;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x1f8637[_0x11ea('0x52')]['id']}})[_0x11ea('0x30')](handleEntityNotFound(_0x1ccc60,null))['then'](function(_0x43761a){if(_0x43761a){_0x149c94=_0x43761a;_0x166e0d[_0x11ea('0x3e')]=_[_0x11ea('0x3a')](db[_0x11ea('0x54')][_0x11ea('0x37')]);_0x166e0d[_0x11ea('0x3b')]=_[_0x11ea('0x3a')](_0x1f8637[_0x11ea('0x3b')]);_0x166e0d[_0x11ea('0x3c')]=_[_0x11ea('0x3d')](_0x166e0d[_0x11ea('0x3e')],_0x166e0d[_0x11ea('0x3b')]);_0x27e663[_0x11ea('0x3f')]=_[_0x11ea('0x3d')](_0x166e0d[_0x11ea('0x3e')],qs['fields'](_0x1f8637['query']['fields']));_0x27e663[_0x11ea('0x3f')]=_0x27e663['attributes'][_0x11ea('0x4d')]?_0x27e663[_0x11ea('0x3f')]:_0x166e0d['model'];_0x27e663[_0x11ea('0x41')]=qs[_0x11ea('0x42')](_0x1f8637[_0x11ea('0x3b')][_0x11ea('0x42')]);_0x27e663[_0x11ea('0x43')]=qs[_0x11ea('0x3c')](_[_0x11ea('0x44')](_0x1f8637[_0x11ea('0x3b')],_0x166e0d[_0x11ea('0x3c')]));if(_0x1f8637['query'][_0x11ea('0x46')]){_0x27e663[_0x11ea('0x43')]=_[_0x11ea('0x47')](_0x27e663[_0x11ea('0x43')],{'$or':_['map'](_0x27e663[_0x11ea('0x3f')],function(_0x13ad7e){var _0x54c395={};_0x54c395[_0x13ad7e]={'$like':'%'+_0x1f8637['query'][_0x11ea('0x46')]+'%'};return _0x54c395;})});}_0x27e663=_['merge']({},_0x27e663,_0x1f8637[_0x11ea('0x4e')]);return _0x149c94[_0x11ea('0x57')](_0x27e663);}})[_0x11ea('0x30')](function(_0x22a0bb){if(_0x22a0bb){_0xca1e8=_0x22a0bb['length'];if(!_0x1f8637[_0x11ea('0x3b')][_0x11ea('0x40')](_0x11ea('0x56'))){_0x27e663[_0x11ea('0x2b')]=qs[_0x11ea('0x2b')](_0x1f8637['query']['limit']);_0x27e663[_0x11ea('0x2a')]=qs[_0x11ea('0x2a')](_0x1f8637[_0x11ea('0x3b')][_0x11ea('0x2a')]);}return _0x149c94[_0x11ea('0x57')](_0x27e663);}})[_0x11ea('0x30')](function(_0x28b59b){if(_0x28b59b){return _0x28b59b?{'count':_0xca1e8,'rows':_0x28b59b}:null;}})[_0x11ea('0x30')](respondWithResult(_0x1ccc60,null))[_0x11ea('0x25')](handleError(_0x1ccc60,null));};exports[_0x11ea('0x58')]=function(_0xbb2315,_0x2e7bc3,_0x43e5bc){var _0x3fb023={};var _0x5da5c7={};var _0x9c35fa;var _0x58b551;return db['ZohoConfiguration'][_0x11ea('0x53')]({'where':{'id':_0xbb2315[_0x11ea('0x52')]['id']}})[_0x11ea('0x30')](handleEntityNotFound(_0x2e7bc3,null))[_0x11ea('0x30')](function(_0xc9d7fb){if(_0xc9d7fb){_0x9c35fa=_0xc9d7fb;_0x5da5c7[_0x11ea('0x3e')]=_[_0x11ea('0x3a')](db['ZohoField'][_0x11ea('0x37')]);_0x5da5c7['query']=_[_0x11ea('0x3a')](_0xbb2315[_0x11ea('0x3b')]);_0x5da5c7[_0x11ea('0x3c')]=_['intersection'](_0x5da5c7[_0x11ea('0x3e')],_0x5da5c7[_0x11ea('0x3b')]);_0x3fb023[_0x11ea('0x3f')]=_['intersection'](_0x5da5c7[_0x11ea('0x3e')],qs[_0x11ea('0x4c')](_0xbb2315['query'][_0x11ea('0x4c')]));_0x3fb023[_0x11ea('0x3f')]=_0x3fb023['attributes'][_0x11ea('0x4d')]?_0x3fb023[_0x11ea('0x3f')]:_0x5da5c7[_0x11ea('0x3e')];_0x3fb023[_0x11ea('0x41')]=qs['sort'](_0xbb2315[_0x11ea('0x3b')][_0x11ea('0x42')]);_0x3fb023[_0x11ea('0x43')]=qs[_0x11ea('0x3c')](_[_0x11ea('0x44')](_0xbb2315['query'],_0x5da5c7[_0x11ea('0x3c')]));if(_0xbb2315['query']['filter']){_0x3fb023['where']=_[_0x11ea('0x47')](_0x3fb023['where'],{'$or':_['map'](_0x3fb023[_0x11ea('0x3f')],function(_0x40b8a4){var _0x5200b4={};_0x5200b4[_0x40b8a4]={'$like':'%'+_0xbb2315[_0x11ea('0x3b')][_0x11ea('0x46')]+'%'};return _0x5200b4;})});}_0x3fb023=_[_0x11ea('0x47')]({},_0x3fb023,_0xbb2315[_0x11ea('0x4e')]);return _0x9c35fa[_0x11ea('0x58')](_0x3fb023);}})[_0x11ea('0x30')](function(_0x368808){if(_0x368808){_0x58b551=_0x368808[_0x11ea('0x4d')];if(!_0xbb2315[_0x11ea('0x3b')][_0x11ea('0x40')]('nolimit')){_0x3fb023[_0x11ea('0x2b')]=qs['limit'](_0xbb2315[_0x11ea('0x3b')][_0x11ea('0x2b')]);_0x3fb023['offset']=qs[_0x11ea('0x2a')](_0xbb2315[_0x11ea('0x3b')][_0x11ea('0x2a')]);}return _0x9c35fa['getDescriptions'](_0x3fb023);}})[_0x11ea('0x30')](function(_0x46f645){if(_0x46f645){return _0x46f645?{'count':_0x58b551,'rows':_0x46f645}:null;}})[_0x11ea('0x30')](respondWithResult(_0x2e7bc3,null))[_0x11ea('0x25')](handleError(_0x2e7bc3,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index c06ea9e..60ffe3c 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 _0x21fe=['lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','define','int_zoho_configurations'];(function(_0x49a418,_0x2f23c6){var _0x4b9a82=function(_0x1f8501){while(--_0x1f8501){_0x49a418['push'](_0x49a418['shift']());}};_0x4b9a82(++_0x2f23c6);}(_0x21fe,0x19a));var _0xe21f=function(_0x574bb0,_0x3c05e7){_0x574bb0=_0x574bb0-0x0;var _0xc8e20c=_0x21fe[_0x574bb0];return _0xc8e20c;};'use strict';var _=require(_0xe21f('0x0'));var util=require('util');var logger=require(_0xe21f('0x1'))(_0xe21f('0x2'));var moment=require('moment');var BPromise=require(_0xe21f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe21f('0x4'));var rimraf=require(_0xe21f('0x5'));var config=require(_0xe21f('0x6'));var attributes=require(_0xe21f('0x7'));module['exports']=function(_0x57bb35,_0x30d8e5){return _0x57bb35[_0xe21f('0x8')]('ZohoConfiguration',attributes,{'tableName':_0xe21f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf09d=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','lodash'];(function(_0xfdb7fd,_0x2a9523){var _0x2bcd75=function(_0x5906ac){while(--_0x5906ac){_0xfdb7fd['push'](_0xfdb7fd['shift']());}};_0x2bcd75(++_0x2a9523);}(_0xf09d,0x1c7));var _0xdf09=function(_0x4a0ba6,_0x1c1502){_0x4a0ba6=_0x4a0ba6-0x0;var _0x121ac0=_0xf09d[_0x4a0ba6];return _0x121ac0;};'use strict';var _=require(_0xdf09('0x0'));var util=require(_0xdf09('0x1'));var logger=require(_0xdf09('0x2'))(_0xdf09('0x3'));var moment=require('moment');var BPromise=require(_0xdf09('0x4'));var rp=require(_0xdf09('0x5'));var fs=require('fs');var path=require(_0xdf09('0x6'));var rimraf=require(_0xdf09('0x7'));var config=require(_0xdf09('0x8'));var attributes=require(_0xdf09('0x9'));module[_0xdf09('0xa')]=function(_0x49b385,_0x4c4404){return _0x49b385[_0xdf09('0xb')]('ZohoConfiguration',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 8d49715..560289f 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 _0xa0b6=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash'];(function(_0x4404ff,_0x13d7a9){var _0x5e7b19=function(_0x13847a){while(--_0x13847a){_0x4404ff['push'](_0x4404ff['shift']());}};_0x5e7b19(++_0x13d7a9);}(_0xa0b6,0x1a3));var _0x6a0b=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xa0b6[_0x580576];return _0x3f55a0;};'use strict';var _=require(_0x6a0b('0x0'));var util=require(_0x6a0b('0x1'));var moment=require(_0x6a0b('0x2'));var BPromise=require(_0x6a0b('0x3'));var rs=require(_0x6a0b('0x4'));var fs=require('fs');var Redis=require(_0x6a0b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6a0b('0x6'));var logger=require(_0x6a0b('0x7'))('rpc');var config=require(_0x6a0b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6a0b('0x9')][_0x6a0b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10f2fe,_0x347e35,_0x41bd4c){return new BPromise(function(_0x1e7791,_0x551ebb){return client['request'](_0x10f2fe,_0x41bd4c)['then'](function(_0x4ea6d9){logger[_0x6a0b('0xb')](_0x6a0b('0xc'),_0x347e35,_0x6a0b('0xd'));logger[_0x6a0b('0xe')](_0x6a0b('0xf'),_0x347e35,_0x6a0b('0xd'),JSON[_0x6a0b('0x10')](_0x4ea6d9));if(_0x4ea6d9[_0x6a0b('0x11')]){if(_0x4ea6d9['error']['code']===0x1f4){logger[_0x6a0b('0x11')](_0x6a0b('0xc'),_0x347e35,_0x4ea6d9[_0x6a0b('0x11')][_0x6a0b('0x12')]);return _0x551ebb(_0x4ea6d9[_0x6a0b('0x11')]['message']);}logger[_0x6a0b('0x11')](_0x6a0b('0xc'),_0x347e35,_0x4ea6d9[_0x6a0b('0x11')][_0x6a0b('0x12')]);return _0x1e7791(_0x4ea6d9[_0x6a0b('0x11')]['message']);}else{logger[_0x6a0b('0xb')](_0x6a0b('0xc'),_0x347e35,_0x6a0b('0xd'));_0x1e7791(_0x4ea6d9[_0x6a0b('0x13')]['message']);}})[_0x6a0b('0x14')](function(_0x253c8f){logger[_0x6a0b('0x11')](_0x6a0b('0xc'),_0x347e35,_0x253c8f);_0x551ebb(_0x253c8f);});});} \ No newline at end of file +var _0xb632=['http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xb632,0x194));var _0x2b63=function(_0x28625b,_0x3e6da1){_0x28625b=_0x28625b-0x0;var _0x2bbfba=_0xb632[_0x28625b];return _0x2bbfba;};'use strict';var _=require(_0x2b63('0x0'));var util=require(_0x2b63('0x1'));var moment=require(_0x2b63('0x2'));var BPromise=require('bluebird');var rs=require(_0x2b63('0x3'));var fs=require('fs');var Redis=require(_0x2b63('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2b63('0x5'));var logger=require(_0x2b63('0x6'))(_0x2b63('0x7'));var config=require('../../config/environment');var jayson=require(_0x2b63('0x8'));var client=jayson[_0x2b63('0x9')][_0x2b63('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ba0d8,_0x27e689,_0x4a1c95){return new BPromise(function(_0x54c707,_0x11846c){return client[_0x2b63('0xb')](_0x2ba0d8,_0x4a1c95)[_0x2b63('0xc')](function(_0x1e593f){logger[_0x2b63('0xd')](_0x2b63('0xe'),_0x27e689,'request\x20sent');logger[_0x2b63('0xf')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x27e689,_0x2b63('0x10'),JSON[_0x2b63('0x11')](_0x1e593f));if(_0x1e593f['error']){if(_0x1e593f[_0x2b63('0x12')][_0x2b63('0x13')]===0x1f4){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x27e689,_0x1e593f[_0x2b63('0x12')][_0x2b63('0x14')]);return _0x11846c(_0x1e593f[_0x2b63('0x12')]['message']);}logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x27e689,_0x1e593f[_0x2b63('0x12')][_0x2b63('0x14')]);return _0x54c707(_0x1e593f[_0x2b63('0x12')][_0x2b63('0x14')]);}else{logger[_0x2b63('0xd')](_0x2b63('0xe'),_0x27e689,_0x2b63('0x10'));_0x54c707(_0x1e593f[_0x2b63('0x15')][_0x2b63('0x14')]);}})[_0x2b63('0x16')](function(_0x3021ce){logger[_0x2b63('0x12')](_0x2b63('0xe'),_0x27e689,_0x3021ce);_0x11846c(_0x3021ce);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index a74bc91..dbe2609 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 _0xbbbc=['../../components/auth/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','post','create','put','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x165857,_0x7bfc15){_0x165857=_0x165857-0x0;var _0x37e412=_0xbbbc[_0x165857];return _0x37e412;};'use strict';var multer=require(_0xcbbb('0x0'));var util=require(_0xcbbb('0x1'));var path=require(_0xcbbb('0x2'));var timeout=require(_0xcbbb('0x3'));var express=require(_0xcbbb('0x4'));var router=express[_0xcbbb('0x5')]();var auth=require(_0xcbbb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcbbb('0x7'));var controller=require(_0xcbbb('0x8'));router[_0xcbbb('0x9')]('/',auth[_0xcbbb('0xa')](),controller[_0xcbbb('0xb')]);router['get'](_0xcbbb('0xc'),auth[_0xcbbb('0xa')](),controller[_0xcbbb('0xd')]);router[_0xcbbb('0xe')]('/',auth[_0xcbbb('0xa')](),controller[_0xcbbb('0xf')]);router[_0xcbbb('0x10')]('/:id',auth[_0xcbbb('0xa')](),controller['update']);router['delete'](_0xcbbb('0xc'),auth['isAuthenticated'](),controller[_0xcbbb('0x11')]);module['exports']=router; \ No newline at end of file +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(_0x8d9f54,_0x5ab84f){var _0x3513f5=function(_0x593d0f){while(--_0x593d0f){_0x8d9f54['push'](_0x8d9f54['shift']());}};_0x3513f5(++_0x5ab84f);}(_0x4888,0x198));var _0x8488=function(_0x1f6f84,_0x2bab55){_0x1f6f84=_0x1f6f84-0x0;var _0x177f40=_0x4888[_0x1f6f84];return _0x177f40;};'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 diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index b4cc826..f3fe6dd 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 _0x1e6c=['STRING','BOOLEAN','sequelize','ENUM','string','variable','customVariable','keyValue'];(function(_0x4dd6f7,_0x5c8872){var _0x3538ff=function(_0x597230){while(--_0x597230){_0x4dd6f7['push'](_0x4dd6f7['shift']());}};_0x3538ff(++_0x5c8872);}(_0x1e6c,0x11a));var _0xc1e6=function(_0x1a6007,_0x350755){_0x1a6007=_0x1a6007-0x0;var _0x120665=_0x1e6c[_0x1a6007];return _0x120665;};'use strict';var Sequelize=require(_0xc1e6('0x0'));module['exports']={'type':{'type':Sequelize[_0xc1e6('0x1')](_0xc1e6('0x2'),_0xc1e6('0x3'),_0xc1e6('0x4'),_0xc1e6('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xc1e6('0x6')]},'keyType':{'type':Sequelize[_0xc1e6('0x1')](_0xc1e6('0x2'),_0xc1e6('0x3'),_0xc1e6('0x4'))},'keyContent':{'type':Sequelize[_0xc1e6('0x6')]},'idField':{'type':Sequelize[_0xc1e6('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xc1e6('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc534=['string','BOOLEAN','exports','ENUM','variable','customVariable','keyValue','STRING'];(function(_0x25e29f,_0x4111a8){var _0x2c3524=function(_0x2d42b9){while(--_0x2d42b9){_0x25e29f['push'](_0x25e29f['shift']());}};_0x2c3524(++_0x4111a8);}(_0xc534,0x1ca));var _0x4c53=function(_0x1d8a5d,_0x59a110){_0x1d8a5d=_0x1d8a5d-0x0;var _0x54d59f=_0xc534[_0x1d8a5d];return _0x54d59f;};'use strict';var Sequelize=require('sequelize');module[_0x4c53('0x0')]={'type':{'type':Sequelize[_0x4c53('0x1')]('string',_0x4c53('0x2'),_0x4c53('0x3'),_0x4c53('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x4c53('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x4c53('0x1')](_0x4c53('0x6'),_0x4c53('0x2'),_0x4c53('0x3'))},'keyContent':{'type':Sequelize[_0x4c53('0x5')]},'idField':{'type':Sequelize[_0x4c53('0x5')]},'nameField':{'type':Sequelize[_0x4c53('0x5')]},'customField':{'type':Sequelize[_0x4c53('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 2e24e81..ec4a943 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(_0x3d9ce8,_0xd8d033){var _0xd1947c=function(_0x777125){while(--_0x777125){_0x3d9ce8['push'](_0x3d9ce8['shift']());}};_0xd1947c(++_0xd8d033);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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(_0x5554e6,_0x4e220f){var _0x1d7301=function(_0x48bc71){while(--_0x48bc71){_0x5554e6['push'](_0x5554e6['shift']());}};_0x1d7301(++_0x4e220f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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 7f51f9d..d0261c5 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 _0xe2c4=['bluebird','path','rimraf','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','moment'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xe2c4,0x177));var _0x4e2c=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xe2c4[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require(_0x4e2c('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x4e2c('0x1'));var BPromise=require(_0x4e2c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e2c('0x3'));var rimraf=require(_0x4e2c('0x4'));var config=require('../../config/environment');var attributes=require(_0x4e2c('0x5'));module[_0x4e2c('0x6')]=function(_0x6615d0,_0x3003a1){return _0x6615d0[_0x4e2c('0x7')](_0x4e2c('0x8'),attributes,{'tableName':_0x4e2c('0x9'),'paranoid':![],'indexes':[{'name':_0x4e2c('0xa'),'fields':[_0x4e2c('0xb'),_0x4e2c('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x53fa=['zoho_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','ZohoField'];(function(_0xa4b18d,_0x270c11){var _0x21c1ed=function(_0x436d7f){while(--_0x436d7f){_0xa4b18d['push'](_0xa4b18d['shift']());}};_0x21c1ed(++_0x270c11);}(_0x53fa,0x1d4));var _0xa53f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x53fa[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa53f('0x0'));var util=require(_0xa53f('0x1'));var logger=require('../../config/logger')(_0xa53f('0x2'));var moment=require(_0xa53f('0x3'));var BPromise=require(_0xa53f('0x4'));var rp=require(_0xa53f('0x5'));var fs=require('fs');var path=require(_0xa53f('0x6'));var rimraf=require(_0xa53f('0x7'));var config=require(_0xa53f('0x8'));var attributes=require(_0xa53f('0x9'));module[_0xa53f('0xa')]=function(_0x5ea39b,_0x3155e9){return _0x5ea39b['define'](_0xa53f('0xb'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0xa53f('0xc'),'fields':[_0xa53f('0xd'),_0xa53f('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index a49c7c6..8f7bb6c 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 _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(_0x3bdea8,_0x4355d9){var _0x4ddf93=function(_0x322516){while(--_0x322516){_0x3bdea8['push'](_0x3bdea8['shift']());}};_0x4ddf93(++_0x4355d9);}(_0x17ba,0xab));var _0xa17b=function(_0x26c75a,_0x42e035){_0x26c75a=_0x26c75a-0x0;var _0x52ee3e=_0x17ba[_0x26c75a];return _0x52ee3e;};'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 +var _0xee14=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','error','code','ZohoField,\x20%s,\x20%s','message','result','catch','moment'];(function(_0x3780bc,_0x198624){var _0x135127=function(_0x3b1f22){while(--_0x3b1f22){_0x3780bc['push'](_0x3780bc['shift']());}};_0x135127(++_0x198624);}(_0xee14,0x13a));var _0x4ee1=function(_0x166d08,_0xe43842){_0x166d08=_0x166d08-0x0;var _0x2a8eff=_0xee14[_0x166d08];return _0x2a8eff;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4ee1('0x0'));var BPromise=require(_0x4ee1('0x1'));var rs=require(_0x4ee1('0x2'));var fs=require('fs');var Redis=require(_0x4ee1('0x3'));var db=require(_0x4ee1('0x4'))['db'];var utils=require(_0x4ee1('0x5'));var logger=require(_0x4ee1('0x6'))(_0x4ee1('0x7'));var config=require(_0x4ee1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4ee1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x327c18,_0x3a45a3,_0x187656){return new BPromise(function(_0x293d5f,_0xdfe9c1){return client[_0x4ee1('0xa')](_0x327c18,_0x187656)['then'](function(_0x33dbe6){logger[_0x4ee1('0xb')]('ZohoField,\x20%s,\x20%s',_0x3a45a3,_0x4ee1('0xc'));logger[_0x4ee1('0xd')](_0x4ee1('0xe'),_0x3a45a3,_0x4ee1('0xc'),JSON['stringify'](_0x33dbe6));if(_0x33dbe6[_0x4ee1('0xf')]){if(_0x33dbe6[_0x4ee1('0xf')][_0x4ee1('0x10')]===0x1f4){logger[_0x4ee1('0xf')](_0x4ee1('0x11'),_0x3a45a3,_0x33dbe6[_0x4ee1('0xf')]['message']);return _0xdfe9c1(_0x33dbe6[_0x4ee1('0xf')][_0x4ee1('0x12')]);}logger[_0x4ee1('0xf')](_0x4ee1('0x11'),_0x3a45a3,_0x33dbe6[_0x4ee1('0xf')][_0x4ee1('0x12')]);return _0x293d5f(_0x33dbe6[_0x4ee1('0xf')][_0x4ee1('0x12')]);}else{logger[_0x4ee1('0xb')]('ZohoField,\x20%s,\x20%s',_0x3a45a3,_0x4ee1('0xc'));_0x293d5f(_0x33dbe6[_0x4ee1('0x13')][_0x4ee1('0x12')]);}})[_0x4ee1('0x14')](function(_0x123c5e){logger[_0x4ee1('0xf')](_0x4ee1('0x11'),_0x3a45a3,_0x123c5e);_0xdfe9c1(_0x123c5e);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index dad70ef..0326320 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 _0x354a=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','util','path','connect-timeout'];(function(_0x53aa24,_0x1856d1){var _0x1575bb=function(_0x248b33){while(--_0x248b33){_0x53aa24['push'](_0x53aa24['shift']());}};_0x1575bb(++_0x1856d1);}(_0x354a,0x1ec));var _0xa354=function(_0x15c166,_0xc6050f){_0x15c166=_0x15c166-0x0;var _0x55987e=_0x354a[_0x15c166];return _0x55987e;};'use strict';var multer=require('multer');var util=require(_0xa354('0x0'));var path=require(_0xa354('0x1'));var timeout=require(_0xa354('0x2'));var express=require(_0xa354('0x3'));var router=express[_0xa354('0x4')]();var auth=require(_0xa354('0x5'));var interaction=require(_0xa354('0x6'));var config=require(_0xa354('0x7'));module[_0xa354('0x8')]=router; \ No newline at end of file +var _0xc009=['path','express','Router','../../components/auth/service','../../config/environment','exports','multer','util'];(function(_0x14f1c3,_0x59d654){var _0x393ee1=function(_0x4cbb14){while(--_0x4cbb14){_0x14f1c3['push'](_0x14f1c3['shift']());}};_0x393ee1(++_0x59d654);}(_0xc009,0x1de));var _0x9c00=function(_0x14d0e3,_0x153a06){_0x14d0e3=_0x14d0e3-0x0;var _0x3b409a=_0xc009[_0x14d0e3];return _0x3b409a;};'use strict';var multer=require(_0x9c00('0x0'));var util=require(_0x9c00('0x1'));var path=require(_0x9c00('0x2'));var timeout=require('connect-timeout');var express=require(_0x9c00('0x3'));var router=express[_0x9c00('0x4')]();var auth=require(_0x9c00('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9c00('0x6'));module[_0x9c00('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 458cdbb..49528e5 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 _0x694f=['INTEGER','state','sequelize','exports','unique_name_and_version','STRING','app.js'];(function(_0x552e6a,_0x249b42){var _0x1c38bd=function(_0x595987){while(--_0x595987){_0x552e6a['push'](_0x552e6a['shift']());}};_0x1c38bd(++_0x249b42);}(_0x694f,0x160));var _0xf694=function(_0xd743d0,_0x40aa03){_0xd743d0=_0xd743d0-0x0;var _0x41ac5e=_0x694f[_0xd743d0];return _0x41ac5e;};'use strict';var Sequelize=require(_0xf694('0x0'));module[_0xf694('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf694('0x2')},'version':{'type':Sequelize[_0xf694('0x3')],'allowNull':![],'unique':_0xf694('0x2')},'main':{'type':Sequelize[_0xf694('0x3')],'defaultValue':_0xf694('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0xf694('0x3')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0xf694('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0xf694('0x3')]},'state':{'type':Sequelize[_0xf694('0x3')],'unique':_0xf694('0x6')},'description':{'type':Sequelize[_0xf694('0x3')]},'title':{'type':Sequelize[_0xf694('0x3')]},'remoteUri':{'type':Sequelize[_0xf694('0x3')]},'link':{'type':Sequelize[_0xf694('0x3')],'defaultValue':'#'}}; \ No newline at end of file +var _0x393f=['exports','STRING','unique_name_and_version','app.js','BOOLEAN','state','sequelize'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x393f,0x1cd));var _0xf393=function(_0x2443ac,_0x3ccad9){_0x2443ac=_0x2443ac-0x0;var _0x1452b7=_0x393f[_0x2443ac];return _0x1452b7;};'use strict';var Sequelize=require(_0xf393('0x0'));module[_0xf393('0x1')]={'name':{'type':Sequelize[_0xf393('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0xf393('0x2')],'allowNull':![],'unique':_0xf393('0x3')},'main':{'type':Sequelize[_0xf393('0x2')],'defaultValue':_0xf393('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0xf393('0x2')]},'type':{'type':Sequelize[_0xf393('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0xf393('0x5')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize['STRING'],'unique':_0xf393('0x6')},'description':{'type':Sequelize[_0xf393('0x2')]},'title':{'type':Sequelize[_0xf393('0x2')]},'remoteUri':{'type':Sequelize[_0xf393('0x2')]},'link':{'type':Sequelize[_0xf393('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 441a952..da64c7c 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 _0xbd05=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','Content-Range','apply','update','then','error','stack','name','send','map','Integration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','fields','length','options','find','create','body','destroy','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0x123623,_0x9694e2){var _0x3b00d1=function(_0x7e48e0){while(--_0x7e48e0){_0x123623['push'](_0x123623['shift']());}};_0x3b00d1(++_0x9694e2);}(_0xbd05,0x158));var _0x5bd0=function(_0x4dcc2d,_0x422839){_0x4dcc2d=_0x4dcc2d-0x0;var _0x1bbd79=_0xbd05[_0x4dcc2d];return _0x1bbd79;};'use strict';var pdf=require(_0x5bd0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5bd0('0x1'));var zipdir=require(_0x5bd0('0x2'));var jsonpatch=require(_0x5bd0('0x3'));var rp=require(_0x5bd0('0x4'));var moment=require(_0x5bd0('0x5'));var BPromise=require(_0x5bd0('0x6'));var Mustache=require(_0x5bd0('0x7'));var util=require('util');var path=require(_0x5bd0('0x8'));var sox=require('sox');var csv=require(_0x5bd0('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5bd0('0xa'));var jsforce=require(_0x5bd0('0xb'));var deskjs=require(_0x5bd0('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5bd0('0xd'));var Papa=require(_0x5bd0('0xe'));var Redis=require('ioredis');var authService=require(_0x5bd0('0xf'));var qs=require(_0x5bd0('0x10'));var as=require(_0x5bd0('0x11'));var hardwareService=require(_0x5bd0('0x12'));var logger=require(_0x5bd0('0x13'))(_0x5bd0('0x14'));var utils=require(_0x5bd0('0x15'));var config=require(_0x5bd0('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x595718,_0x1023e0){_0x1023e0=_0x1023e0||0xcc;return function(_0x2f06f9){if(_0x2f06f9){return _0x595718[_0x5bd0('0x17')](_0x1023e0);}return _0x595718['status'](_0x1023e0)[_0x5bd0('0x18')]();};}function respondWithResult(_0x42b8aa,_0x8148f5){_0x8148f5=_0x8148f5||0xc8;return function(_0x39e06b){if(_0x39e06b){return _0x42b8aa[_0x5bd0('0x19')](_0x8148f5)[_0x5bd0('0x1a')](_0x39e06b);}};}function respondWithFilteredResult(_0x3bef6f,_0x3c22aa){return function(_0x3ccfe){if(_0x3ccfe){var _0x2bd23c=_0x3ccfe[_0x5bd0('0x1b')],_0x54abb1=_0x3c22aa[_0x5bd0('0x1c')],_0x114871=_0x3c22aa[_0x5bd0('0x1c')]+_0x3c22aa['limit'],_0x2db630;if(_0x114871>=_0x2bd23c){_0x114871=_0x2bd23c;_0x2db630=0xc8;}else{_0x2db630=0xce;}_0x3bef6f['status'](_0x2db630);return _0x3bef6f['set'](_0x5bd0('0x1d'),_0x54abb1+'-'+_0x114871+'/'+_0x2bd23c)[_0x5bd0('0x1a')](_0x3ccfe);}return null;};}function patchUpdates(_0x43af83){return function(_0x45b33d){try{jsonpatch[_0x5bd0('0x1e')](_0x45b33d,_0x43af83,!![]);}catch(_0x29140b){return BPromise['reject'](_0x29140b);}return _0x45b33d['save']();};}function saveUpdates(_0x2d5f90,_0x3aaab5){return function(_0xb738d4){if(_0xb738d4){return _0xb738d4[_0x5bd0('0x1f')](_0x2d5f90)['then'](function(_0x310a63){return _0x310a63;});}return null;};}function removeEntity(_0x5431f2,_0x4340fd){return function(_0x94566b){if(_0x94566b){return _0x94566b['destroy']()[_0x5bd0('0x20')](function(){_0x5431f2['status'](0xcc)[_0x5bd0('0x18')]();});}};}function handleEntityNotFound(_0x1cb898,_0x49d07b){return function(_0x2b5499){if(!_0x2b5499){_0x1cb898[_0x5bd0('0x17')](0x194);}return _0x2b5499;};}function handleError(_0x225868,_0x383d40){_0x383d40=_0x383d40||0x1f4;return function(_0x3c4956){logger[_0x5bd0('0x21')](_0x3c4956[_0x5bd0('0x22')]);if(_0x3c4956[_0x5bd0('0x23')]){delete _0x3c4956[_0x5bd0('0x23')];}_0x225868[_0x5bd0('0x19')](_0x383d40)[_0x5bd0('0x24')](_0x3c4956);};}exports['index']=function(_0x3efba8,_0x1e4df1){var _0x4224b4={},_0x549e67={},_0x45e77a={'count':0x0,'rows':[]};var _0x5147e5=_[_0x5bd0('0x25')](db[_0x5bd0('0x26')][_0x5bd0('0x27')],function(_0x271f36){return{'name':_0x271f36[_0x5bd0('0x28')],'type':_0x271f36[_0x5bd0('0x29')][_0x5bd0('0x2a')]};});_0x549e67[_0x5bd0('0x2b')]=_[_0x5bd0('0x25')](_0x5147e5,'name');_0x549e67[_0x5bd0('0x2c')]=_[_0x5bd0('0x2d')](_0x3efba8[_0x5bd0('0x2c')]);_0x549e67[_0x5bd0('0x2e')]=_['intersection'](_0x549e67[_0x5bd0('0x2b')],_0x549e67[_0x5bd0('0x2c')]);_0x4224b4[_0x5bd0('0x2f')]=_[_0x5bd0('0x30')](_0x549e67['model'],qs['fields'](_0x3efba8[_0x5bd0('0x2c')]['fields']));_0x4224b4[_0x5bd0('0x2f')]=_0x4224b4[_0x5bd0('0x2f')]['length']?_0x4224b4[_0x5bd0('0x2f')]:_0x549e67[_0x5bd0('0x2b')];if(!_0x3efba8[_0x5bd0('0x2c')][_0x5bd0('0x31')](_0x5bd0('0x32'))){_0x4224b4['limit']=qs[_0x5bd0('0x33')](_0x3efba8['query'][_0x5bd0('0x33')]);_0x4224b4[_0x5bd0('0x1c')]=qs[_0x5bd0('0x1c')](_0x3efba8['query'][_0x5bd0('0x1c')]);}_0x4224b4[_0x5bd0('0x34')]=qs[_0x5bd0('0x35')](_0x3efba8[_0x5bd0('0x2c')][_0x5bd0('0x35')]);_0x4224b4[_0x5bd0('0x36')]=qs[_0x5bd0('0x2e')](_[_0x5bd0('0x37')](_0x3efba8['query'],_0x549e67[_0x5bd0('0x2e')]),_0x5147e5);if(_0x3efba8[_0x5bd0('0x2c')][_0x5bd0('0x38')]){_0x4224b4['where']=_[_0x5bd0('0x39')](_0x4224b4[_0x5bd0('0x36')],{'$or':_[_0x5bd0('0x25')](_0x5147e5,function(_0x267f4d){if(_0x267f4d[_0x5bd0('0x29')]!==_0x5bd0('0x3a')){var _0x5a6f4e={};_0x5a6f4e[_0x267f4d[_0x5bd0('0x23')]]={'$like':'%'+_0x3efba8[_0x5bd0('0x2c')][_0x5bd0('0x38')]+'%'};return _0x5a6f4e;}})});}_0x4224b4=_[_0x5bd0('0x39')]({},_0x4224b4,_0x3efba8['options']);var _0x5ecbbe={'where':_0x4224b4['where']};return db[_0x5bd0('0x26')][_0x5bd0('0x1b')](_0x5ecbbe)[_0x5bd0('0x20')](function(_0x11c8ea){_0x45e77a[_0x5bd0('0x1b')]=_0x11c8ea;if(_0x3efba8['query'][_0x5bd0('0x3b')]){_0x4224b4[_0x5bd0('0x3c')]=[{'all':!![]}];}return db[_0x5bd0('0x26')][_0x5bd0('0x3d')](_0x4224b4);})[_0x5bd0('0x20')](function(_0x4ae278){_0x45e77a['rows']=_0x4ae278;return _0x45e77a;})[_0x5bd0('0x20')](respondWithFilteredResult(_0x1e4df1,_0x4224b4))[_0x5bd0('0x3e')](handleError(_0x1e4df1,null));};exports[_0x5bd0('0x3f')]=function(_0xe00372,_0xedf26a){var _0x93599b={'raw':![],'where':{'id':_0xe00372[_0x5bd0('0x40')]['id']}},_0x5da8ad={};_0x5da8ad[_0x5bd0('0x2b')]=_['keys'](db['Integration'][_0x5bd0('0x27')]);_0x5da8ad['query']=_['keys'](_0xe00372[_0x5bd0('0x2c')]);_0x5da8ad[_0x5bd0('0x2e')]=_[_0x5bd0('0x30')](_0x5da8ad['model'],_0x5da8ad[_0x5bd0('0x2c')]);_0x93599b[_0x5bd0('0x2f')]=_[_0x5bd0('0x30')](_0x5da8ad[_0x5bd0('0x2b')],qs['fields'](_0xe00372[_0x5bd0('0x2c')][_0x5bd0('0x41')]));_0x93599b[_0x5bd0('0x2f')]=_0x93599b[_0x5bd0('0x2f')][_0x5bd0('0x42')]?_0x93599b[_0x5bd0('0x2f')]:_0x5da8ad[_0x5bd0('0x2b')];if(_0xe00372[_0x5bd0('0x2c')][_0x5bd0('0x3b')]){_0x93599b['include']=[{'all':!![]}];}_0x93599b=_[_0x5bd0('0x39')]({},_0x93599b,_0xe00372[_0x5bd0('0x43')]);return db[_0x5bd0('0x26')][_0x5bd0('0x44')](_0x93599b)[_0x5bd0('0x20')](handleEntityNotFound(_0xedf26a,null))[_0x5bd0('0x20')](respondWithResult(_0xedf26a,null))[_0x5bd0('0x3e')](handleError(_0xedf26a,null));};exports[_0x5bd0('0x45')]=function(_0x1339cf,_0x30e1d2){return db[_0x5bd0('0x26')][_0x5bd0('0x45')](_0x1339cf[_0x5bd0('0x46')],{})[_0x5bd0('0x20')](respondWithResult(_0x30e1d2,0xc9))[_0x5bd0('0x3e')](handleError(_0x30e1d2,null));};exports[_0x5bd0('0x1f')]=function(_0x246e59,_0x12b3b2){if(_0x246e59[_0x5bd0('0x46')]['id']){delete _0x246e59['body']['id'];}return db[_0x5bd0('0x26')]['find']({'where':{'id':_0x246e59['params']['id']}})[_0x5bd0('0x20')](handleEntityNotFound(_0x12b3b2,null))[_0x5bd0('0x20')](saveUpdates(_0x246e59[_0x5bd0('0x46')],null))['then'](respondWithResult(_0x12b3b2,null))[_0x5bd0('0x3e')](handleError(_0x12b3b2,null));};exports[_0x5bd0('0x47')]=function(_0x3d8ae6,_0x12c368){return db[_0x5bd0('0x26')][_0x5bd0('0x44')]({'where':{'id':_0x3d8ae6['params']['id']}})[_0x5bd0('0x20')](handleEntityNotFound(_0x12c368,null))[_0x5bd0('0x20')](removeEntity(_0x12c368,null))[_0x5bd0('0x3e')](handleError(_0x12c368,null));}; \ No newline at end of file +var _0xcbd4=['hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','find','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','Integration','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xcbd4,0x1c9));var _0x4cbd=function(_0x4c1a00,_0x217754){_0x4c1a00=_0x4c1a00-0x0;var _0x560d09=_0xcbd4[_0x4c1a00];return _0x560d09;};'use strict';var pdf=require(_0x4cbd('0x0'));var emlformat=require(_0x4cbd('0x1'));var rimraf=require(_0x4cbd('0x2'));var zipdir=require(_0x4cbd('0x3'));var jsonpatch=require(_0x4cbd('0x4'));var rp=require('request-promise');var moment=require(_0x4cbd('0x5'));var BPromise=require(_0x4cbd('0x6'));var Mustache=require('mustache');var util=require(_0x4cbd('0x7'));var path=require(_0x4cbd('0x8'));var sox=require('sox');var csv=require(_0x4cbd('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4cbd('0xa'));var squel=require(_0x4cbd('0xb'));var crypto=require(_0x4cbd('0xc'));var jsforce=require(_0x4cbd('0xd'));var deskjs=require(_0x4cbd('0xe'));var toCsv=require(_0x4cbd('0x9'));var querystring=require(_0x4cbd('0xf'));var Papa=require(_0x4cbd('0x10'));var Redis=require(_0x4cbd('0x11'));var authService=require(_0x4cbd('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x4cbd('0x13'));var hardwareService=require(_0x4cbd('0x14'));var logger=require(_0x4cbd('0x15'))(_0x4cbd('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x4cbd('0x17'))['db'];function respondWithStatusCode(_0xf3ba39,_0x77910c){_0x77910c=_0x77910c||0xcc;return function(_0x2778da){if(_0x2778da){return _0xf3ba39[_0x4cbd('0x18')](_0x77910c);}return _0xf3ba39[_0x4cbd('0x19')](_0x77910c)[_0x4cbd('0x1a')]();};}function respondWithResult(_0x987cc8,_0x5fc958){_0x5fc958=_0x5fc958||0xc8;return function(_0x3ee88b){if(_0x3ee88b){return _0x987cc8['status'](_0x5fc958)[_0x4cbd('0x1b')](_0x3ee88b);}};}function respondWithFilteredResult(_0xe539c0,_0x582897){return function(_0x3eb2ae){if(_0x3eb2ae){var _0x53c99e=_0x3eb2ae[_0x4cbd('0x1c')],_0xded45c=_0x582897[_0x4cbd('0x1d')],_0x1d0243=_0x582897[_0x4cbd('0x1d')]+_0x582897[_0x4cbd('0x1e')],_0x35ea23;if(_0x1d0243>=_0x53c99e){_0x1d0243=_0x53c99e;_0x35ea23=0xc8;}else{_0x35ea23=0xce;}_0xe539c0['status'](_0x35ea23);return _0xe539c0[_0x4cbd('0x1f')](_0x4cbd('0x20'),_0xded45c+'-'+_0x1d0243+'/'+_0x53c99e)[_0x4cbd('0x1b')](_0x3eb2ae);}return null;};}function patchUpdates(_0x52a65d){return function(_0xc4bf33){try{jsonpatch[_0x4cbd('0x21')](_0xc4bf33,_0x52a65d,!![]);}catch(_0x1adcff){return BPromise[_0x4cbd('0x22')](_0x1adcff);}return _0xc4bf33[_0x4cbd('0x23')]();};}function saveUpdates(_0x43889f,_0xd96028){return function(_0x54f7aa){if(_0x54f7aa){return _0x54f7aa[_0x4cbd('0x24')](_0x43889f)[_0x4cbd('0x25')](function(_0x2dd5a8){return _0x2dd5a8;});}return null;};}function removeEntity(_0x330dae,_0x56b54f){return function(_0x302238){if(_0x302238){return _0x302238[_0x4cbd('0x26')]()['then'](function(){_0x330dae[_0x4cbd('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x327a3d,_0x590001){return function(_0xa2aef8){if(!_0xa2aef8){_0x327a3d[_0x4cbd('0x18')](0x194);}return _0xa2aef8;};}function handleError(_0x20a57a,_0x375ca4){_0x375ca4=_0x375ca4||0x1f4;return function(_0x40a64e){logger[_0x4cbd('0x27')](_0x40a64e['stack']);if(_0x40a64e[_0x4cbd('0x28')]){delete _0x40a64e[_0x4cbd('0x28')];}_0x20a57a[_0x4cbd('0x19')](_0x375ca4)[_0x4cbd('0x29')](_0x40a64e);};}exports['index']=function(_0x222fad,_0x338ca1){var _0x42e313={},_0x34b6e5={},_0x493a89={'count':0x0,'rows':[]};var _0x48a2bb=_[_0x4cbd('0x2a')](db[_0x4cbd('0x2b')][_0x4cbd('0x2c')],function(_0x100f6d){return{'name':_0x100f6d['fieldName'],'type':_0x100f6d['type'][_0x4cbd('0x2d')]};});_0x34b6e5[_0x4cbd('0x2e')]=_[_0x4cbd('0x2a')](_0x48a2bb,_0x4cbd('0x28'));_0x34b6e5[_0x4cbd('0x2f')]=_[_0x4cbd('0x30')](_0x222fad[_0x4cbd('0x2f')]);_0x34b6e5[_0x4cbd('0x31')]=_[_0x4cbd('0x32')](_0x34b6e5['model'],_0x34b6e5[_0x4cbd('0x2f')]);_0x42e313[_0x4cbd('0x33')]=_[_0x4cbd('0x32')](_0x34b6e5[_0x4cbd('0x2e')],qs[_0x4cbd('0x34')](_0x222fad[_0x4cbd('0x2f')][_0x4cbd('0x34')]));_0x42e313[_0x4cbd('0x33')]=_0x42e313['attributes'][_0x4cbd('0x35')]?_0x42e313[_0x4cbd('0x33')]:_0x34b6e5[_0x4cbd('0x2e')];if(!_0x222fad[_0x4cbd('0x2f')][_0x4cbd('0x36')](_0x4cbd('0x37'))){_0x42e313[_0x4cbd('0x1e')]=qs['limit'](_0x222fad[_0x4cbd('0x2f')]['limit']);_0x42e313[_0x4cbd('0x1d')]=qs[_0x4cbd('0x1d')](_0x222fad[_0x4cbd('0x2f')][_0x4cbd('0x1d')]);}_0x42e313['order']=qs[_0x4cbd('0x38')](_0x222fad[_0x4cbd('0x2f')]['sort']);_0x42e313[_0x4cbd('0x39')]=qs[_0x4cbd('0x31')](_[_0x4cbd('0x3a')](_0x222fad[_0x4cbd('0x2f')],_0x34b6e5[_0x4cbd('0x31')]),_0x48a2bb);if(_0x222fad['query']['filter']){_0x42e313[_0x4cbd('0x39')]=_[_0x4cbd('0x3b')](_0x42e313[_0x4cbd('0x39')],{'$or':_[_0x4cbd('0x2a')](_0x48a2bb,function(_0x130032){if(_0x130032[_0x4cbd('0x3c')]!==_0x4cbd('0x3d')){var _0x225b66={};_0x225b66[_0x130032['name']]={'$like':'%'+_0x222fad[_0x4cbd('0x2f')][_0x4cbd('0x3e')]+'%'};return _0x225b66;}})});}_0x42e313=_['merge']({},_0x42e313,_0x222fad[_0x4cbd('0x3f')]);var _0x4c3d87={'where':_0x42e313[_0x4cbd('0x39')]};return db[_0x4cbd('0x2b')][_0x4cbd('0x1c')](_0x4c3d87)[_0x4cbd('0x25')](function(_0x13dfa2){_0x493a89['count']=_0x13dfa2;if(_0x222fad[_0x4cbd('0x2f')]['includeAll']){_0x42e313[_0x4cbd('0x40')]=[{'all':!![]}];}return db[_0x4cbd('0x2b')][_0x4cbd('0x41')](_0x42e313);})['then'](function(_0x342499){_0x493a89[_0x4cbd('0x42')]=_0x342499;return _0x493a89;})[_0x4cbd('0x25')](respondWithFilteredResult(_0x338ca1,_0x42e313))[_0x4cbd('0x43')](handleError(_0x338ca1,null));};exports[_0x4cbd('0x44')]=function(_0x14199b,_0x50cca8){var _0x306578={'raw':![],'where':{'id':_0x14199b[_0x4cbd('0x45')]['id']}},_0x4616bf={};_0x4616bf[_0x4cbd('0x2e')]=_[_0x4cbd('0x30')](db['Integration'][_0x4cbd('0x2c')]);_0x4616bf['query']=_['keys'](_0x14199b[_0x4cbd('0x2f')]);_0x4616bf[_0x4cbd('0x31')]=_[_0x4cbd('0x32')](_0x4616bf[_0x4cbd('0x2e')],_0x4616bf[_0x4cbd('0x2f')]);_0x306578[_0x4cbd('0x33')]=_[_0x4cbd('0x32')](_0x4616bf['model'],qs['fields'](_0x14199b[_0x4cbd('0x2f')]['fields']));_0x306578[_0x4cbd('0x33')]=_0x306578[_0x4cbd('0x33')][_0x4cbd('0x35')]?_0x306578[_0x4cbd('0x33')]:_0x4616bf[_0x4cbd('0x2e')];if(_0x14199b[_0x4cbd('0x2f')][_0x4cbd('0x46')]){_0x306578[_0x4cbd('0x40')]=[{'all':!![]}];}_0x306578=_[_0x4cbd('0x3b')]({},_0x306578,_0x14199b[_0x4cbd('0x3f')]);return db['Integration'][_0x4cbd('0x47')](_0x306578)['then'](handleEntityNotFound(_0x50cca8,null))[_0x4cbd('0x25')](respondWithResult(_0x50cca8,null))['catch'](handleError(_0x50cca8,null));};exports['create']=function(_0x85b54d,_0x3e885c){return db['Integration']['create'](_0x85b54d[_0x4cbd('0x48')],{})['then'](respondWithResult(_0x3e885c,0xc9))['catch'](handleError(_0x3e885c,null));};exports[_0x4cbd('0x24')]=function(_0x3d9812,_0x5bf0b6){if(_0x3d9812[_0x4cbd('0x48')]['id']){delete _0x3d9812['body']['id'];}return db[_0x4cbd('0x2b')][_0x4cbd('0x47')]({'where':{'id':_0x3d9812[_0x4cbd('0x45')]['id']}})[_0x4cbd('0x25')](handleEntityNotFound(_0x5bf0b6,null))[_0x4cbd('0x25')](saveUpdates(_0x3d9812['body'],null))[_0x4cbd('0x25')](respondWithResult(_0x5bf0b6,null))[_0x4cbd('0x43')](handleError(_0x5bf0b6,null));};exports[_0x4cbd('0x26')]=function(_0x3f552a,_0x3c6db2){return db[_0x4cbd('0x2b')][_0x4cbd('0x47')]({'where':{'id':_0x3f552a['params']['id']}})[_0x4cbd('0x25')](handleEntityNotFound(_0x3c6db2,null))[_0x4cbd('0x25')](removeEntity(_0x3c6db2,null))[_0x4cbd('0x43')](handleError(_0x3c6db2,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index ac12c0c..54255ca 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 _0x36d2=['../../config/environment','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5df57e,_0x2f5712){var _0x17705e=function(_0x1b9e8c){while(--_0x1b9e8c){_0x5df57e['push'](_0x5df57e['shift']());}};_0x17705e(++_0x2f5712);}(_0x36d2,0x9d));var _0x236d=function(_0x1ccbcc,_0x5c948b){_0x1ccbcc=_0x1ccbcc-0x0;var _0x1e873f=_0x36d2[_0x1ccbcc];return _0x1e873f;};'use strict';var _=require(_0x236d('0x0'));var util=require('util');var logger=require(_0x236d('0x1'))(_0x236d('0x2'));var moment=require(_0x236d('0x3'));var BPromise=require(_0x236d('0x4'));var rp=require(_0x236d('0x5'));var fs=require('fs');var path=require(_0x236d('0x6'));var rimraf=require(_0x236d('0x7'));var config=require(_0x236d('0x8'));var attributes=require('./integration.attributes');module[_0x236d('0x9')]=function(_0x115c63,_0x19423f){return _0x115c63[_0x236d('0xa')]('Integration',attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x016b=['exports','Integration','integrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./integration.attributes'];(function(_0x18e3e7,_0x39886c){var _0x211dee=function(_0x1dc34b){while(--_0x1dc34b){_0x18e3e7['push'](_0x18e3e7['shift']());}};_0x211dee(++_0x39886c);}(_0x016b,0x1b0));var _0xb016=function(_0x58380f,_0x4b8696){_0x58380f=_0x58380f-0x0;var _0x33215a=_0x016b[_0x58380f];return _0x33215a;};'use strict';var _=require(_0xb016('0x0'));var util=require(_0xb016('0x1'));var logger=require(_0xb016('0x2'))(_0xb016('0x3'));var moment=require(_0xb016('0x4'));var BPromise=require(_0xb016('0x5'));var rp=require(_0xb016('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb016('0x7'));var config=require(_0xb016('0x8'));var attributes=require(_0xb016('0x9'));module[_0xb016('0xa')]=function(_0x5ef53a,_0x1001bb){return _0x5ef53a['define'](_0xb016('0xb'),attributes,{'tableName':_0xb016('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 2c7b82b..044f99a 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 _0xc5b4=['bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment'];(function(_0x2a31d1,_0x18e3e6){var _0x4bb2e7=function(_0x12fc50){while(--_0x12fc50){_0x2a31d1['push'](_0x2a31d1['shift']());}};_0x4bb2e7(++_0x18e3e6);}(_0xc5b4,0x1cb));var _0x4c5b=function(_0x1b347c,_0x5d400d){_0x1b347c=_0x1b347c-0x0;var _0x1ebb4f=_0xc5b4[_0x1b347c];return _0x1ebb4f;};'use strict';var _=require(_0x4c5b('0x0'));var util=require(_0x4c5b('0x1'));var moment=require(_0x4c5b('0x2'));var BPromise=require(_0x4c5b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4c5b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4c5b('0x5'));var logger=require('../../config/logger')(_0x4c5b('0x6'));var config=require(_0x4c5b('0x7'));var jayson=require(_0x4c5b('0x8'));var client=jayson[_0x4c5b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ada7a,_0x386e51,_0x233674){return new BPromise(function(_0xba50f6,_0x441922){return client[_0x4c5b('0xa')](_0x4ada7a,_0x233674)[_0x4c5b('0xb')](function(_0x211dc3){logger['info'](_0x4c5b('0xc'),_0x386e51,_0x4c5b('0xd'));logger[_0x4c5b('0xe')](_0x4c5b('0xf'),_0x386e51,_0x4c5b('0xd'),JSON['stringify'](_0x211dc3));if(_0x211dc3[_0x4c5b('0x10')]){if(_0x211dc3[_0x4c5b('0x10')][_0x4c5b('0x11')]===0x1f4){logger[_0x4c5b('0x10')](_0x4c5b('0xc'),_0x386e51,_0x211dc3[_0x4c5b('0x10')][_0x4c5b('0x12')]);return _0x441922(_0x211dc3[_0x4c5b('0x10')][_0x4c5b('0x12')]);}logger['error'](_0x4c5b('0xc'),_0x386e51,_0x211dc3[_0x4c5b('0x10')][_0x4c5b('0x12')]);return _0xba50f6(_0x211dc3[_0x4c5b('0x10')][_0x4c5b('0x12')]);}else{logger['info'](_0x4c5b('0xc'),_0x386e51,_0x4c5b('0xd'));_0xba50f6(_0x211dc3[_0x4c5b('0x13')][_0x4c5b('0x12')]);}})[_0x4c5b('0x14')](function(_0x3371a0){logger[_0x4c5b('0x10')](_0x4c5b('0xc'),_0x386e51,_0x3371a0);_0x441922(_0x3371a0);});});} \ No newline at end of file +var _0x0faf=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x243610,_0x63f260){var _0x38e258=function(_0x28bcf8){while(--_0x28bcf8){_0x243610['push'](_0x243610['shift']());}};_0x38e258(++_0x63f260);}(_0x0faf,0x132));var _0xf0fa=function(_0x509083,_0xa6676b){_0x509083=_0x509083-0x0;var _0x4b2495=_0x0faf[_0x509083];return _0x4b2495;};'use strict';var _=require(_0xf0fa('0x0'));var util=require('util');var moment=require(_0xf0fa('0x1'));var BPromise=require(_0xf0fa('0x2'));var rs=require(_0xf0fa('0x3'));var fs=require('fs');var Redis=require(_0xf0fa('0x4'));var db=require(_0xf0fa('0x5'))['db'];var utils=require(_0xf0fa('0x6'));var logger=require(_0xf0fa('0x7'))(_0xf0fa('0x8'));var config=require(_0xf0fa('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf0fa('0xa')][_0xf0fa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x25b5c4,_0x3a703b,_0x2db1d9){return new BPromise(function(_0x587865,_0x42f7fd){return client[_0xf0fa('0xc')](_0x25b5c4,_0x2db1d9)['then'](function(_0x4df4d1){logger[_0xf0fa('0xd')](_0xf0fa('0xe'),_0x3a703b,_0xf0fa('0xf'));logger[_0xf0fa('0x10')](_0xf0fa('0x11'),_0x3a703b,_0xf0fa('0xf'),JSON[_0xf0fa('0x12')](_0x4df4d1));if(_0x4df4d1[_0xf0fa('0x13')]){if(_0x4df4d1['error'][_0xf0fa('0x14')]===0x1f4){logger['error'](_0xf0fa('0xe'),_0x3a703b,_0x4df4d1['error'][_0xf0fa('0x15')]);return _0x42f7fd(_0x4df4d1[_0xf0fa('0x13')][_0xf0fa('0x15')]);}logger['error']('Integration,\x20%s,\x20%s',_0x3a703b,_0x4df4d1[_0xf0fa('0x13')]['message']);return _0x587865(_0x4df4d1[_0xf0fa('0x13')][_0xf0fa('0x15')]);}else{logger[_0xf0fa('0xd')](_0xf0fa('0xe'),_0x3a703b,_0xf0fa('0xf'));_0x587865(_0x4df4d1[_0xf0fa('0x16')][_0xf0fa('0x15')]);}})[_0xf0fa('0x17')](function(_0x497542){logger[_0xf0fa('0x13')](_0xf0fa('0xe'),_0x3a703b,_0x497542);_0x42f7fd(_0x497542);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 684b580..307b29c 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 _0xc35b=['/describe','isAuthenticated','describe','show','create','put','update','delete','/:id','exports','util','path','express','../../config/environment','./integrationReport.controller','index','get'];(function(_0x5e8b7e,_0x258072){var _0x19d445=function(_0xf028e8){while(--_0xf028e8){_0x5e8b7e['push'](_0x5e8b7e['shift']());}};_0x19d445(++_0x258072);}(_0xc35b,0xa3));var _0xbc35=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0xc35b[_0x256b72];return _0x2183e3;};'use strict';var multer=require('multer');var util=require(_0xbc35('0x0'));var path=require(_0xbc35('0x1'));var timeout=require('connect-timeout');var express=require(_0xbc35('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbc35('0x3'));var controller=require(_0xbc35('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0xbc35('0x5')]);router[_0xbc35('0x6')](_0xbc35('0x7'),auth[_0xbc35('0x8')](),controller[_0xbc35('0x9')]);router[_0xbc35('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xbc35('0xa')]);router['post']('/',auth[_0xbc35('0x8')](),controller[_0xbc35('0xb')]);router[_0xbc35('0xc')]('/:id',auth[_0xbc35('0x8')](),controller[_0xbc35('0xd')]);router[_0xbc35('0xe')](_0xbc35('0xf'),auth[_0xbc35('0x8')](),controller['destroy']);module[_0xbc35('0x10')]=router; \ No newline at end of file +var _0x6ef1=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','/:id','show','create'];(function(_0x4d3a6b,_0x52dc40){var _0x5692ca=function(_0x53f5fb){while(--_0x53f5fb){_0x4d3a6b['push'](_0x4d3a6b['shift']());}};_0x5692ca(++_0x52dc40);}(_0x6ef1,0xac));var _0x16ef=function(_0x4f25b4,_0x52f357){_0x4f25b4=_0x4f25b4-0x0;var _0x13b3fd=_0x6ef1[_0x4f25b4];return _0x13b3fd;};'use strict';var multer=require(_0x16ef('0x0'));var util=require(_0x16ef('0x1'));var path=require(_0x16ef('0x2'));var timeout=require(_0x16ef('0x3'));var express=require(_0x16ef('0x4'));var router=express[_0x16ef('0x5')]();var auth=require(_0x16ef('0x6'));var interaction=require(_0x16ef('0x7'));var config=require(_0x16ef('0x8'));var controller=require(_0x16ef('0x9'));router[_0x16ef('0xa')]('/',auth['isAuthenticated'](),controller[_0x16ef('0xb')]);router[_0x16ef('0xa')](_0x16ef('0xc'),auth[_0x16ef('0xd')](),controller['describe']);router[_0x16ef('0xa')](_0x16ef('0xe'),auth[_0x16ef('0xd')](),controller[_0x16ef('0xf')]);router['post']('/',auth[_0x16ef('0xd')](),controller[_0x16ef('0x10')]);router['put'](_0x16ef('0xe'),auth[_0x16ef('0xd')](),controller[_0x16ef('0x11')]);router[_0x16ef('0x12')]('/:id',auth[_0x16ef('0xd')](),controller[_0x16ef('0x13')]);module[_0x16ef('0x14')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 452bd4e..6391548 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 _0xdb44=['sequelize','exports','STRING','DATE','BOOLEAN','INTEGER','ENUM','SENT','SENDING'];(function(_0x17479d,_0x593129){var _0x2d461c=function(_0x347164){while(--_0x347164){_0x17479d['push'](_0x17479d['shift']());}};_0x2d461c(++_0x593129);}(_0xdb44,0x1a7));var _0x4db4=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0xdb44[_0x1c8c28];return _0x1f59b4;};'use strict';var Sequelize=require(_0x4db4('0x0'));module[_0x4db4('0x1')]={'integration':{'type':Sequelize[_0x4db4('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x4db4('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x4db4('0x2')]},'uniqueid':{'type':Sequelize[_0x4db4('0x2')]},'calleridnum':{'type':Sequelize[_0x4db4('0x2')]},'calleridname':{'type':Sequelize[_0x4db4('0x2')]},'queue':{'type':Sequelize[_0x4db4('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x4db4('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x4db4('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x4db4('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x4db4('0x3')]},'talktime':{'type':Sequelize[_0x4db4('0x5')]},'agentacw':{'type':Sequelize[_0x4db4('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x4db4('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x4db4('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x4db4('0x3')]},'agentdump':{'type':Sequelize[_0x4db4('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x4db4('0x2')]},'channelstate':{'type':Sequelize[_0x4db4('0x5')]},'channelstatedesc':{'type':Sequelize[_0x4db4('0x2')]},'connectedlinenum':{'type':Sequelize[_0x4db4('0x2')]},'connectedlinename':{'type':Sequelize[_0x4db4('0x2')]},'language':{'type':Sequelize[_0x4db4('0x2')]},'accountcode':{'type':Sequelize[_0x4db4('0x2')]},'context':{'type':Sequelize[_0x4db4('0x2')]},'exten':{'type':Sequelize[_0x4db4('0x2')]},'priority':{'type':Sequelize[_0x4db4('0x2')]},'destchannel':{'type':Sequelize[_0x4db4('0x2')]},'destchannelstate':{'type':Sequelize[_0x4db4('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0x4db4('0x2')]},'destcalleridnum':{'type':Sequelize[_0x4db4('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x4db4('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x4db4('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x4db4('0x2')]},'destcontext':{'type':Sequelize[_0x4db4('0x2')]},'destexten':{'type':Sequelize[_0x4db4('0x2')]},'destpriority':{'type':Sequelize[_0x4db4('0x2')]},'destuniqueid':{'type':Sequelize[_0x4db4('0x2')]},'messageId':{'type':Sequelize[_0x4db4('0x2')]},'inReplyTo':{'type':Sequelize[_0x4db4('0x2')]},'subject':{'type':Sequelize[_0x4db4('0x2')]},'from':{'type':Sequelize[_0x4db4('0x2')]},'to':{'type':Sequelize[_0x4db4('0x2')]},'cc':{'type':Sequelize[_0x4db4('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x4db4('0x6')](_0x4db4('0x7'),_0x4db4('0x8'),'RECEIVED','FAILED')},'url':{'type':Sequelize[_0x4db4('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x4db4('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x4d8a=['BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','STRING','INTEGER','DATE'];(function(_0x2441b2,_0x55e94f){var _0x24ca0f=function(_0x4de21a){while(--_0x4de21a){_0x2441b2['push'](_0x2441b2['shift']());}};_0x24ca0f(++_0x55e94f);}(_0x4d8a,0x151));var _0xa4d8=function(_0x3b4e63,_0x6777a1){_0x3b4e63=_0x3b4e63-0x0;var _0xb1c2bf=_0x4d8a[_0x3b4e63];return _0xb1c2bf;};'use strict';var Sequelize=require(_0xa4d8('0x0'));module['exports']={'integration':{'type':Sequelize[_0xa4d8('0x1')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0xa4d8('0x1')]},'ticketId':{'type':Sequelize[_0xa4d8('0x1')]},'integrationId':{'type':Sequelize[_0xa4d8('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xa4d8('0x1')]},'calleridnum':{'type':Sequelize[_0xa4d8('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xa4d8('0x1')]},'interface':{'type':Sequelize[_0xa4d8('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xa4d8('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xa4d8('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xa4d8('0x3')]},'talktime':{'type':Sequelize[_0xa4d8('0x2')]},'agentacw':{'type':Sequelize[_0xa4d8('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xa4d8('0x3')]},'agentdump':{'type':Sequelize[_0xa4d8('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xa4d8('0x3')]},'lastevent':{'type':Sequelize[_0xa4d8('0x1')]},'channel':{'type':Sequelize[_0xa4d8('0x1')]},'channelstate':{'type':Sequelize[_0xa4d8('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xa4d8('0x1')]},'connectedlinename':{'type':Sequelize[_0xa4d8('0x1')]},'language':{'type':Sequelize[_0xa4d8('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xa4d8('0x1')]},'exten':{'type':Sequelize[_0xa4d8('0x1')]},'priority':{'type':Sequelize[_0xa4d8('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xa4d8('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xa4d8('0x1')]},'destcalleridnum':{'type':Sequelize[_0xa4d8('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xa4d8('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xa4d8('0x1')]},'destlanguage':{'type':Sequelize[_0xa4d8('0x1')]},'destaccountcode':{'type':Sequelize[_0xa4d8('0x1')]},'destcontext':{'type':Sequelize[_0xa4d8('0x1')]},'destexten':{'type':Sequelize[_0xa4d8('0x1')]},'destpriority':{'type':Sequelize[_0xa4d8('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xa4d8('0x1')]},'inReplyTo':{'type':Sequelize[_0xa4d8('0x1')]},'subject':{'type':Sequelize[_0xa4d8('0x1')]},'from':{'type':Sequelize[_0xa4d8('0x1')]},'to':{'type':Sequelize[_0xa4d8('0x1')]},'cc':{'type':Sequelize[_0xa4d8('0x1')]},'attachment':{'type':Sequelize[_0xa4d8('0x5')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0xa4d8('0x5')]},'status':{'type':Sequelize[_0xa4d8('0x6')](_0xa4d8('0x7'),_0xa4d8('0x8'),_0xa4d8('0x9'),_0xa4d8('0xa'))},'url':{'type':Sequelize[_0xa4d8('0x1')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xa4d8('0x1')]},'projectId':{'type':Sequelize[_0xa4d8('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 51af2cc..e826204 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 _0x06b1=['merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter'];(function(_0x5d44d7,_0x3c13ea){var _0xf7b8e7=function(_0xc0a7ed){while(--_0xc0a7ed){_0x5d44d7['push'](_0x5d44d7['shift']());}};_0xf7b8e7(++_0x3c13ea);}(_0x06b1,0x129));var _0x106b=function(_0x5c1ddc,_0x538533){_0x5c1ddc=_0x5c1ddc-0x0;var _0x32f4d5=_0x06b1[_0x5c1ddc];return _0x32f4d5;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x106b('0x0'));var zipdir=require(_0x106b('0x1'));var jsonpatch=require(_0x106b('0x2'));var rp=require(_0x106b('0x3'));var moment=require('moment');var BPromise=require(_0x106b('0x4'));var Mustache=require(_0x106b('0x5'));var util=require('util');var path=require('path');var sox=require(_0x106b('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x106b('0x7'));var squel=require(_0x106b('0x8'));var crypto=require('crypto');var jsforce=require(_0x106b('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x106b('0xa'));var querystring=require(_0x106b('0xb'));var Papa=require('papaparse');var Redis=require(_0x106b('0xc'));var authService=require(_0x106b('0xd'));var qs=require(_0x106b('0xe'));var as=require(_0x106b('0xf'));var hardwareService=require(_0x106b('0x10'));var logger=require('../../config/logger')(_0x106b('0x11'));var utils=require(_0x106b('0x12'));var config=require(_0x106b('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50667a,_0x254415){_0x254415=_0x254415||0xcc;return function(_0x1880d9){if(_0x1880d9){return _0x50667a[_0x106b('0x14')](_0x254415);}return _0x50667a[_0x106b('0x15')](_0x254415)[_0x106b('0x16')]();};}function respondWithResult(_0x466811,_0xf24440){_0xf24440=_0xf24440||0xc8;return function(_0x56b094){if(_0x56b094){return _0x466811[_0x106b('0x15')](_0xf24440)[_0x106b('0x17')](_0x56b094);}};}function respondWithFilteredResult(_0xac81ec,_0x2d711d){return function(_0x1aeca6){if(_0x1aeca6){var _0x12d79a=_0x1aeca6[_0x106b('0x18')],_0x45dad8=_0x2d711d[_0x106b('0x19')],_0x22f255=_0x2d711d[_0x106b('0x19')]+_0x2d711d['limit'],_0x3ed83c;if(_0x22f255>=_0x12d79a){_0x22f255=_0x12d79a;_0x3ed83c=0xc8;}else{_0x3ed83c=0xce;}_0xac81ec[_0x106b('0x15')](_0x3ed83c);return _0xac81ec[_0x106b('0x1a')](_0x106b('0x1b'),_0x45dad8+'-'+_0x22f255+'/'+_0x12d79a)[_0x106b('0x17')](_0x1aeca6);}return null;};}function patchUpdates(_0x30a771){return function(_0x239d09){try{jsonpatch[_0x106b('0x1c')](_0x239d09,_0x30a771,!![]);}catch(_0x58c5bd){return BPromise['reject'](_0x58c5bd);}return _0x239d09[_0x106b('0x1d')]();};}function saveUpdates(_0x151bd7,_0x417324){return function(_0x16c691){if(_0x16c691){return _0x16c691[_0x106b('0x1e')](_0x151bd7)[_0x106b('0x1f')](function(_0x2b20bd){return _0x2b20bd;});}return null;};}function removeEntity(_0x4f9aa9,_0x5c27e1){return function(_0x51df84){if(_0x51df84){return _0x51df84[_0x106b('0x20')]()['then'](function(){_0x4f9aa9[_0x106b('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ce925,_0xc4745e){return function(_0x3892ad){if(!_0x3892ad){_0x2ce925[_0x106b('0x14')](0x194);}return _0x3892ad;};}function handleError(_0x4b0825,_0x383c7c){_0x383c7c=_0x383c7c||0x1f4;return function(_0x5ad718){logger[_0x106b('0x21')](_0x5ad718['stack']);if(_0x5ad718[_0x106b('0x22')]){delete _0x5ad718['name'];}_0x4b0825[_0x106b('0x15')](_0x383c7c)[_0x106b('0x23')](_0x5ad718);};}exports[_0x106b('0x24')]=function(_0x13eb7b,_0x4c2672){var _0x341a34={},_0x49a7a2={},_0x2a301b={'count':0x0,'rows':[]};var _0x3c596c=_[_0x106b('0x25')](db[_0x106b('0x26')][_0x106b('0x27')],function(_0x2cc252){return{'name':_0x2cc252[_0x106b('0x28')],'type':_0x2cc252[_0x106b('0x29')]['key']};});_0x49a7a2[_0x106b('0x2a')]=_[_0x106b('0x25')](_0x3c596c,_0x106b('0x22'));_0x49a7a2[_0x106b('0x2b')]=_[_0x106b('0x2c')](_0x13eb7b[_0x106b('0x2b')]);_0x49a7a2[_0x106b('0x2d')]=_[_0x106b('0x2e')](_0x49a7a2[_0x106b('0x2a')],_0x49a7a2['query']);_0x341a34[_0x106b('0x2f')]=_['intersection'](_0x49a7a2[_0x106b('0x2a')],qs[_0x106b('0x30')](_0x13eb7b['query'][_0x106b('0x30')]));_0x341a34[_0x106b('0x2f')]=_0x341a34['attributes'][_0x106b('0x31')]?_0x341a34[_0x106b('0x2f')]:_0x49a7a2[_0x106b('0x2a')];if(!_0x13eb7b['query'][_0x106b('0x32')](_0x106b('0x33'))){_0x341a34['limit']=qs[_0x106b('0x34')](_0x13eb7b['query'][_0x106b('0x34')]);_0x341a34['offset']=qs[_0x106b('0x19')](_0x13eb7b[_0x106b('0x2b')]['offset']);}_0x341a34[_0x106b('0x35')]=qs[_0x106b('0x36')](_0x13eb7b['query']['sort']);_0x341a34[_0x106b('0x37')]=qs[_0x106b('0x2d')](_[_0x106b('0x38')](_0x13eb7b[_0x106b('0x2b')],_0x49a7a2[_0x106b('0x2d')]),_0x3c596c);if(_0x13eb7b[_0x106b('0x2b')][_0x106b('0x39')]){_0x341a34[_0x106b('0x37')]=_[_0x106b('0x3a')](_0x341a34['where'],{'$or':_['map'](_0x3c596c,function(_0x29314a){if(_0x29314a['type']!==_0x106b('0x3b')){var _0x29763f={};_0x29763f[_0x29314a['name']]={'$like':'%'+_0x13eb7b[_0x106b('0x2b')][_0x106b('0x39')]+'%'};return _0x29763f;}})});}_0x341a34=_['merge']({},_0x341a34,_0x13eb7b[_0x106b('0x3c')]);var _0x417bce={'where':_0x341a34[_0x106b('0x37')]};return db[_0x106b('0x26')][_0x106b('0x18')](_0x417bce)[_0x106b('0x1f')](function(_0x152a15){_0x2a301b[_0x106b('0x18')]=_0x152a15;if(_0x13eb7b[_0x106b('0x2b')][_0x106b('0x3d')]){_0x341a34[_0x106b('0x3e')]=[{'all':!![]}];}return db[_0x106b('0x26')][_0x106b('0x3f')](_0x341a34);})['then'](function(_0xd90025){_0x2a301b[_0x106b('0x40')]=_0xd90025;return _0x2a301b;})[_0x106b('0x1f')](respondWithFilteredResult(_0x4c2672,_0x341a34))[_0x106b('0x41')](handleError(_0x4c2672,null));};exports[_0x106b('0x42')]=function(_0x4308aa,_0x4f5084){var _0x2ba8c8={'raw':![],'where':{'id':_0x4308aa['params']['id']}},_0x1ec3f2={};_0x1ec3f2[_0x106b('0x2a')]=_[_0x106b('0x2c')](db[_0x106b('0x26')]['rawAttributes']);_0x1ec3f2[_0x106b('0x2b')]=_['keys'](_0x4308aa['query']);_0x1ec3f2[_0x106b('0x2d')]=_[_0x106b('0x2e')](_0x1ec3f2[_0x106b('0x2a')],_0x1ec3f2[_0x106b('0x2b')]);_0x2ba8c8[_0x106b('0x2f')]=_[_0x106b('0x2e')](_0x1ec3f2['model'],qs['fields'](_0x4308aa[_0x106b('0x2b')]['fields']));_0x2ba8c8['attributes']=_0x2ba8c8[_0x106b('0x2f')][_0x106b('0x31')]?_0x2ba8c8[_0x106b('0x2f')]:_0x1ec3f2[_0x106b('0x2a')];if(_0x4308aa[_0x106b('0x2b')]['includeAll']){_0x2ba8c8[_0x106b('0x3e')]=[{'all':!![]}];}_0x2ba8c8=_[_0x106b('0x3a')]({},_0x2ba8c8,_0x4308aa[_0x106b('0x3c')]);return db[_0x106b('0x26')]['find'](_0x2ba8c8)[_0x106b('0x1f')](handleEntityNotFound(_0x4f5084,null))[_0x106b('0x1f')](respondWithResult(_0x4f5084,null))[_0x106b('0x41')](handleError(_0x4f5084,null));};exports[_0x106b('0x43')]=function(_0x1a3294,_0x126f83){return db[_0x106b('0x26')]['create'](_0x1a3294[_0x106b('0x44')],{})[_0x106b('0x1f')](respondWithResult(_0x126f83,0xc9))[_0x106b('0x41')](handleError(_0x126f83,null));};exports['update']=function(_0x27b1af,_0xc3c5dd){if(_0x27b1af[_0x106b('0x44')]['id']){delete _0x27b1af[_0x106b('0x44')]['id'];}return db[_0x106b('0x26')][_0x106b('0x45')]({'where':{'id':_0x27b1af['params']['id']}})[_0x106b('0x1f')](handleEntityNotFound(_0xc3c5dd,null))[_0x106b('0x1f')](saveUpdates(_0x27b1af[_0x106b('0x44')],null))['then'](respondWithResult(_0xc3c5dd,null))['catch'](handleError(_0xc3c5dd,null));};exports[_0x106b('0x20')]=function(_0x5abc4b,_0x408b5c){return db['IntegrationReport'][_0x106b('0x45')]({'where':{'id':_0x5abc4b['params']['id']}})['then'](handleEntityNotFound(_0x408b5c,null))[_0x106b('0x1f')](removeEntity(_0x408b5c,null))[_0x106b('0x41')](handleError(_0x408b5c,null));};exports[_0x106b('0x46')]=function(_0x245764,_0x406818){return db['IntegrationReport'][_0x106b('0x46')]()[_0x106b('0x1f')](respondWithResult(_0x406818,null))[_0x106b('0x41')](handleError(_0x406818,null));}; \ No newline at end of file +var _0x3ace=['then','destroy','sendStatus','error','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','type','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','include','merge','find','create','body','params','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','limit','Content-Range','json','apply','reject','save','update'];(function(_0x3ae367,_0x425496){var _0x438738=function(_0x4a3fc0){while(--_0x4a3fc0){_0x3ae367['push'](_0x3ae367['shift']());}};_0x438738(++_0x425496);}(_0x3ace,0x1b7));var _0xe3ac=function(_0x1e45ff,_0x23546b){_0x1e45ff=_0x1e45ff-0x0;var _0x2bfbc7=_0x3ace[_0x1e45ff];return _0x2bfbc7;};'use strict';var pdf=require(_0xe3ac('0x0'));var emlformat=require(_0xe3ac('0x1'));var rimraf=require(_0xe3ac('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe3ac('0x3'));var rp=require(_0xe3ac('0x4'));var moment=require(_0xe3ac('0x5'));var BPromise=require(_0xe3ac('0x6'));var Mustache=require(_0xe3ac('0x7'));var util=require(_0xe3ac('0x8'));var path=require(_0xe3ac('0x9'));var sox=require(_0xe3ac('0xa'));var csv=require(_0xe3ac('0xb'));var ejs=require(_0xe3ac('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe3ac('0xd'));var jsforce=require(_0xe3ac('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe3ac('0xb'));var querystring=require(_0xe3ac('0xf'));var Papa=require(_0xe3ac('0x10'));var Redis=require(_0xe3ac('0x11'));var authService=require(_0xe3ac('0x12'));var qs=require(_0xe3ac('0x13'));var as=require(_0xe3ac('0x14'));var hardwareService=require(_0xe3ac('0x15'));var logger=require(_0xe3ac('0x16'))('api');var utils=require(_0xe3ac('0x17'));var config=require(_0xe3ac('0x18'));var db=require(_0xe3ac('0x19'))['db'];function respondWithStatusCode(_0x1f0b19,_0x2b40f8){_0x2b40f8=_0x2b40f8||0xcc;return function(_0x2647c8){if(_0x2647c8){return _0x1f0b19['sendStatus'](_0x2b40f8);}return _0x1f0b19[_0xe3ac('0x1a')](_0x2b40f8)[_0xe3ac('0x1b')]();};}function respondWithResult(_0x2f1362,_0x328552){_0x328552=_0x328552||0xc8;return function(_0x32cad6){if(_0x32cad6){return _0x2f1362[_0xe3ac('0x1a')](_0x328552)['json'](_0x32cad6);}};}function respondWithFilteredResult(_0x36b342,_0x55b40e){return function(_0x981457){if(_0x981457){var _0x21cf5f=_0x981457['count'],_0x1eee0e=_0x55b40e['offset'],_0x7c6ae8=_0x55b40e['offset']+_0x55b40e[_0xe3ac('0x1c')],_0x4fd678;if(_0x7c6ae8>=_0x21cf5f){_0x7c6ae8=_0x21cf5f;_0x4fd678=0xc8;}else{_0x4fd678=0xce;}_0x36b342[_0xe3ac('0x1a')](_0x4fd678);return _0x36b342['set'](_0xe3ac('0x1d'),_0x1eee0e+'-'+_0x7c6ae8+'/'+_0x21cf5f)[_0xe3ac('0x1e')](_0x981457);}return null;};}function patchUpdates(_0x2422b8){return function(_0x44489e){try{jsonpatch[_0xe3ac('0x1f')](_0x44489e,_0x2422b8,!![]);}catch(_0x4ba6e5){return BPromise[_0xe3ac('0x20')](_0x4ba6e5);}return _0x44489e[_0xe3ac('0x21')]();};}function saveUpdates(_0x36c234,_0x46bb66){return function(_0x332cf2){if(_0x332cf2){return _0x332cf2[_0xe3ac('0x22')](_0x36c234)[_0xe3ac('0x23')](function(_0x3c0479){return _0x3c0479;});}return null;};}function removeEntity(_0x27156d,_0x51d738){return function(_0x4ad338){if(_0x4ad338){return _0x4ad338[_0xe3ac('0x24')]()[_0xe3ac('0x23')](function(){_0x27156d['status'](0xcc)[_0xe3ac('0x1b')]();});}};}function handleEntityNotFound(_0x52f412,_0x179453){return function(_0x5df838){if(!_0x5df838){_0x52f412[_0xe3ac('0x25')](0x194);}return _0x5df838;};}function handleError(_0x2c1322,_0x1906d1){_0x1906d1=_0x1906d1||0x1f4;return function(_0x356694){logger[_0xe3ac('0x26')](_0x356694[_0xe3ac('0x27')]);if(_0x356694[_0xe3ac('0x28')]){delete _0x356694['name'];}_0x2c1322[_0xe3ac('0x1a')](_0x1906d1)[_0xe3ac('0x29')](_0x356694);};}exports[_0xe3ac('0x2a')]=function(_0x13abd5,_0x34e511){var _0x1b2f52={},_0x50f75f={},_0x2832ec={'count':0x0,'rows':[]};var _0x5b1e32=_[_0xe3ac('0x2b')](db[_0xe3ac('0x2c')][_0xe3ac('0x2d')],function(_0x5cb1c4){return{'name':_0x5cb1c4[_0xe3ac('0x2e')],'type':_0x5cb1c4['type']['key']};});_0x50f75f[_0xe3ac('0x2f')]=_['map'](_0x5b1e32,_0xe3ac('0x28'));_0x50f75f[_0xe3ac('0x30')]=_[_0xe3ac('0x31')](_0x13abd5[_0xe3ac('0x30')]);_0x50f75f['filters']=_['intersection'](_0x50f75f['model'],_0x50f75f[_0xe3ac('0x30')]);_0x1b2f52[_0xe3ac('0x32')]=_[_0xe3ac('0x33')](_0x50f75f[_0xe3ac('0x2f')],qs[_0xe3ac('0x34')](_0x13abd5[_0xe3ac('0x30')]['fields']));_0x1b2f52['attributes']=_0x1b2f52['attributes'][_0xe3ac('0x35')]?_0x1b2f52[_0xe3ac('0x32')]:_0x50f75f['model'];if(!_0x13abd5['query'][_0xe3ac('0x36')](_0xe3ac('0x37'))){_0x1b2f52[_0xe3ac('0x1c')]=qs[_0xe3ac('0x1c')](_0x13abd5[_0xe3ac('0x30')][_0xe3ac('0x1c')]);_0x1b2f52[_0xe3ac('0x38')]=qs[_0xe3ac('0x38')](_0x13abd5[_0xe3ac('0x30')]['offset']);}_0x1b2f52[_0xe3ac('0x39')]=qs[_0xe3ac('0x3a')](_0x13abd5['query']['sort']);_0x1b2f52[_0xe3ac('0x3b')]=qs[_0xe3ac('0x3c')](_[_0xe3ac('0x3d')](_0x13abd5[_0xe3ac('0x30')],_0x50f75f[_0xe3ac('0x3c')]),_0x5b1e32);if(_0x13abd5[_0xe3ac('0x30')][_0xe3ac('0x3e')]){_0x1b2f52[_0xe3ac('0x3b')]=_['merge'](_0x1b2f52[_0xe3ac('0x3b')],{'$or':_[_0xe3ac('0x2b')](_0x5b1e32,function(_0x397170){if(_0x397170[_0xe3ac('0x3f')]!==_0xe3ac('0x40')){var _0x18572c={};_0x18572c[_0x397170[_0xe3ac('0x28')]]={'$like':'%'+_0x13abd5[_0xe3ac('0x30')][_0xe3ac('0x3e')]+'%'};return _0x18572c;}})});}_0x1b2f52=_['merge']({},_0x1b2f52,_0x13abd5[_0xe3ac('0x41')]);var _0x42058d={'where':_0x1b2f52[_0xe3ac('0x3b')]};return db['IntegrationReport'][_0xe3ac('0x42')](_0x42058d)[_0xe3ac('0x23')](function(_0x38e78c){_0x2832ec[_0xe3ac('0x42')]=_0x38e78c;if(_0x13abd5[_0xe3ac('0x30')][_0xe3ac('0x43')]){_0x1b2f52['include']=[{'all':!![]}];}return db[_0xe3ac('0x2c')][_0xe3ac('0x44')](_0x1b2f52);})['then'](function(_0x3be4fb){_0x2832ec[_0xe3ac('0x45')]=_0x3be4fb;return _0x2832ec;})['then'](respondWithFilteredResult(_0x34e511,_0x1b2f52))[_0xe3ac('0x46')](handleError(_0x34e511,null));};exports[_0xe3ac('0x47')]=function(_0x268720,_0x496d9a){var _0x48b341={'raw':![],'where':{'id':_0x268720['params']['id']}},_0x35f7ef={};_0x35f7ef['model']=_['keys'](db[_0xe3ac('0x2c')][_0xe3ac('0x2d')]);_0x35f7ef[_0xe3ac('0x30')]=_['keys'](_0x268720['query']);_0x35f7ef[_0xe3ac('0x3c')]=_[_0xe3ac('0x33')](_0x35f7ef['model'],_0x35f7ef[_0xe3ac('0x30')]);_0x48b341[_0xe3ac('0x32')]=_[_0xe3ac('0x33')](_0x35f7ef[_0xe3ac('0x2f')],qs[_0xe3ac('0x34')](_0x268720[_0xe3ac('0x30')][_0xe3ac('0x34')]));_0x48b341[_0xe3ac('0x32')]=_0x48b341[_0xe3ac('0x32')]['length']?_0x48b341[_0xe3ac('0x32')]:_0x35f7ef['model'];if(_0x268720[_0xe3ac('0x30')]['includeAll']){_0x48b341[_0xe3ac('0x48')]=[{'all':!![]}];}_0x48b341=_[_0xe3ac('0x49')]({},_0x48b341,_0x268720[_0xe3ac('0x41')]);return db[_0xe3ac('0x2c')][_0xe3ac('0x4a')](_0x48b341)[_0xe3ac('0x23')](handleEntityNotFound(_0x496d9a,null))[_0xe3ac('0x23')](respondWithResult(_0x496d9a,null))[_0xe3ac('0x46')](handleError(_0x496d9a,null));};exports[_0xe3ac('0x4b')]=function(_0x41c352,_0x56cd56){return db['IntegrationReport'][_0xe3ac('0x4b')](_0x41c352[_0xe3ac('0x4c')],{})['then'](respondWithResult(_0x56cd56,0xc9))[_0xe3ac('0x46')](handleError(_0x56cd56,null));};exports[_0xe3ac('0x22')]=function(_0x4081c6,_0x213259){if(_0x4081c6['body']['id']){delete _0x4081c6[_0xe3ac('0x4c')]['id'];}return db[_0xe3ac('0x2c')][_0xe3ac('0x4a')]({'where':{'id':_0x4081c6[_0xe3ac('0x4d')]['id']}})[_0xe3ac('0x23')](handleEntityNotFound(_0x213259,null))[_0xe3ac('0x23')](saveUpdates(_0x4081c6[_0xe3ac('0x4c')],null))[_0xe3ac('0x23')](respondWithResult(_0x213259,null))['catch'](handleError(_0x213259,null));};exports['destroy']=function(_0x89a987,_0xd2f9b5){return db[_0xe3ac('0x2c')][_0xe3ac('0x4a')]({'where':{'id':_0x89a987[_0xe3ac('0x4d')]['id']}})[_0xe3ac('0x23')](handleEntityNotFound(_0xd2f9b5,null))[_0xe3ac('0x23')](removeEntity(_0xd2f9b5,null))['catch'](handleError(_0xd2f9b5,null));};exports['describe']=function(_0x5c61f5,_0x3020a9){return db[_0xe3ac('0x2c')][_0xe3ac('0x4e')]()[_0xe3ac('0x23')](respondWithResult(_0x3020a9,null))[_0xe3ac('0x46')](handleError(_0x3020a9,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 33589f1..f3d3d44 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 _0xcb70=['lodash','../../config/logger','api','path','rimraf','../../config/environment','exports','define','IntegrationReport','report_integration'];(function(_0x5e4c4e,_0x4925b2){var _0x2d6477=function(_0x527d0a){while(--_0x527d0a){_0x5e4c4e['push'](_0x5e4c4e['shift']());}};_0x2d6477(++_0x4925b2);}(_0xcb70,0x1d6));var _0x0cb7=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0xcb70[_0x1deb03];return _0x189fe7;};'use strict';var _=require(_0x0cb7('0x0'));var util=require('util');var logger=require(_0x0cb7('0x1'))(_0x0cb7('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0cb7('0x3'));var rimraf=require(_0x0cb7('0x4'));var config=require(_0x0cb7('0x5'));var attributes=require('./integrationReport.attributes');module[_0x0cb7('0x6')]=function(_0x766628,_0x2e42ab){return _0x766628[_0x0cb7('0x7')](_0x0cb7('0x8'),attributes,{'tableName':_0x0cb7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ed9=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','IntegrationReport','report_integration','util','../../config/logger','api','moment'];(function(_0x3f4857,_0x5a41a0){var _0x1b0d7c=function(_0x3a6311){while(--_0x3a6311){_0x3f4857['push'](_0x3f4857['shift']());}};_0x1b0d7c(++_0x5a41a0);}(_0x8ed9,0x18f));var _0x98ed=function(_0x5e146f,_0x5c04f9){_0x5e146f=_0x5e146f-0x0;var _0x44ce4d=_0x8ed9[_0x5e146f];return _0x44ce4d;};'use strict';var _=require('lodash');var util=require(_0x98ed('0x0'));var logger=require(_0x98ed('0x1'))(_0x98ed('0x2'));var moment=require(_0x98ed('0x3'));var BPromise=require(_0x98ed('0x4'));var rp=require(_0x98ed('0x5'));var fs=require('fs');var path=require(_0x98ed('0x6'));var rimraf=require(_0x98ed('0x7'));var config=require(_0x98ed('0x8'));var attributes=require('./integrationReport.attributes');module[_0x98ed('0x9')]=function(_0x16a4c6,_0x3d828c){return _0x16a4c6[_0x98ed('0xa')](_0x98ed('0xb'),attributes,{'tableName':_0x98ed('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 8c7d54a..4313fcb 100644 --- a/server/api/integrationReport/integrationReport.rpc.js +++ b/server/api/integrationReport/integrationReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','IntegrationReport,\x20%s,\x20%s','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x1184ce,_0x478240){var _0x1e1ec3=function(_0x352848){while(--_0x352848){_0x1184ce['push'](_0x1184ce['shift']());}};_0x1e1ec3(++_0x478240);}(_0xb10b,0x12a));var _0xbb10=function(_0x100770,_0x2a6617){_0x100770=_0x100770-0x0;var _0x26c777=_0xb10b[_0x100770];return _0x26c777;};'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 _0xda3f=['rpc','jayson/promise','client','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x35a274,_0x98b399){var _0x40d905=function(_0x5c8455){while(--_0x5c8455){_0x35a274['push'](_0x35a274['shift']());}};_0x40d905(++_0x98b399);}(_0xda3f,0xec));var _0xfda3=function(_0x488274,_0xda1dd9){_0x488274=_0x488274-0x0;var _0x3a3a01=_0xda3f[_0x488274];return _0x3a3a01;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('IntegrationReport,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('IntegrationReport,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 13d2078..4d7b49b 100644 --- a/server/api/interval/index.js +++ b/server/api/interval/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','addInterval','addIntervals','put','update','destroy','exports','path','connect-timeout','express','Router'];(function(_0x205414,_0x16abb4){var _0x25f806=function(_0x1b1361){while(--_0x1b1361){_0x205414['push'](_0x205414['shift']());}};_0x25f806(++_0x16abb4);}(_0x9c44,0x178));var _0x49c4=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x9c44[_0x255d5b];return _0x3e141a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var auth=require(_0x49c4('0x4'));var interaction=require(_0x49c4('0x5'));var config=require('../../config/environment');var controller=require('./interval.controller');router[_0x49c4('0x6')]('/',auth['isAuthenticated'](),controller[_0x49c4('0x7')]);router[_0x49c4('0x6')](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xa')]);router['get'](_0x49c4('0xb'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xc')]);router[_0x49c4('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x49c4('0xd')](_0x49c4('0xb'),auth['isAuthenticated'](),controller[_0x49c4('0xe')]);router[_0x49c4('0xd')]('/:id/sub_intervals/create_many',auth['isAuthenticated'](),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth[_0x49c4('0x9')](),controller[_0x49c4('0x11')]);router['delete'](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0x12')]);module[_0x49c4('0x13')]=router; \ No newline at end of file +var _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(_0x14a2f4,_0x308abe){var _0x8ac57f=function(_0x46b726){while(--_0x46b726){_0x14a2f4['push'](_0x14a2f4['shift']());}};_0x8ac57f(++_0x308abe);}(_0x008c,0x188));var _0xc008=function(_0x482b74,_0x4ff641){_0x482b74=_0x482b74-0x0;var _0x3c478f=_0x008c[_0x482b74];return _0x3c478f;};'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 3290eb0..822f0d1 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 _0xe0ba=['exports','STRING'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0xe0ba,0x1a8));var _0xae0b=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xe0ba[_0x36eaaa];return _0x461349;};'use strict';var Sequelize=require('sequelize');module[_0xae0b('0x0')]={'name':{'type':Sequelize[_0xae0b('0x1')]},'description':{'type':Sequelize[_0xae0b('0x1')]},'interval':{'type':Sequelize[_0xae0b('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x5f62=['STRING','sequelize'];(function(_0x18a069,_0x4f80a2){var _0x4fc8a2=function(_0x2150e8){while(--_0x2150e8){_0x18a069['push'](_0x18a069['shift']());}};_0x4fc8a2(++_0x4f80a2);}(_0x5f62,0x1bf));var _0x25f6=function(_0x38b297,_0x27dcd0){_0x38b297=_0x38b297-0x0;var _0x5e8157=_0x5f62[_0x38b297];return _0x5e8157;};'use strict';var Sequelize=require(_0x25f6('0x0'));module['exports']={'name':{'type':Sequelize[_0x25f6('0x1')]},'description':{'type':Sequelize[_0x25f6('0x1')]},'interval':{'type':Sequelize[_0x25f6('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index bacddd9..2659ee5 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 _0x7837=['status','set','Content-Range','apply','reject','save','update','then','destroy','get','Intervals','UserProfileResource','error','name','index','Interval','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','IntervalId','getIntervals','findOne','length','pick','sequelize','transaction','bulkCreate','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','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','sendStatus','end','json','count','offset','limit'];(function(_0xe4e05c,_0x1e8921){var _0x4e956f=function(_0x4ef592){while(--_0x4ef592){_0xe4e05c['push'](_0xe4e05c['shift']());}};_0x4e956f(++_0x1e8921);}(_0x7837,0xf3));var _0x7783=function(_0x1befb6,_0x45c9ad){_0x1befb6=_0x1befb6-0x0;var _0xcfa81=_0x7837[_0x1befb6];return _0xcfa81;};'use strict';var pdf=require(_0x7783('0x0'));var emlformat=require(_0x7783('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7783('0x2'));var rp=require(_0x7783('0x3'));var moment=require(_0x7783('0x4'));var BPromise=require(_0x7783('0x5'));var Mustache=require(_0x7783('0x6'));var util=require(_0x7783('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x7783('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x7783('0x9'));var crypto=require(_0x7783('0xa'));var jsforce=require(_0x7783('0xb'));var deskjs=require(_0x7783('0xc'));var toCsv=require(_0x7783('0x8'));var querystring=require(_0x7783('0xd'));var Papa=require(_0x7783('0xe'));var Redis=require('ioredis');var authService=require(_0x7783('0xf'));var qs=require(_0x7783('0x10'));var as=require(_0x7783('0x11'));var hardwareService=require(_0x7783('0x12'));var logger=require(_0x7783('0x13'))(_0x7783('0x14'));var utils=require(_0x7783('0x15'));var config=require(_0x7783('0x16'));var db=require(_0x7783('0x17'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x4f3dd4,_0xedf2af){_0xedf2af=_0xedf2af||0xcc;return function(_0x479d3b){if(_0x479d3b){return _0x4f3dd4[_0x7783('0x18')](_0xedf2af);}return _0x4f3dd4['status'](_0xedf2af)[_0x7783('0x19')]();};}function respondWithResult(_0x2837d4,_0x20908b){_0x20908b=_0x20908b||0xc8;return function(_0x22ee69){if(_0x22ee69){return _0x2837d4['status'](_0x20908b)[_0x7783('0x1a')](_0x22ee69);}};}function respondWithFilteredResult(_0x49a8da,_0x374a78){return function(_0x502540){if(_0x502540){var _0x394813=_0x502540[_0x7783('0x1b')],_0x384e1e=_0x374a78[_0x7783('0x1c')],_0x14bd89=_0x374a78[_0x7783('0x1c')]+_0x374a78[_0x7783('0x1d')],_0xef698;if(_0x14bd89>=_0x394813){_0x14bd89=_0x394813;_0xef698=0xc8;}else{_0xef698=0xce;}_0x49a8da[_0x7783('0x1e')](_0xef698);return _0x49a8da[_0x7783('0x1f')](_0x7783('0x20'),_0x384e1e+'-'+_0x14bd89+'/'+_0x394813)[_0x7783('0x1a')](_0x502540);}return null;};}function patchUpdates(_0xfcecf9){return function(_0x64a9fe){try{jsonpatch[_0x7783('0x21')](_0x64a9fe,_0xfcecf9,!![]);}catch(_0xfe1f5a){return BPromise[_0x7783('0x22')](_0xfe1f5a);}return _0x64a9fe[_0x7783('0x23')]();};}function saveUpdates(_0x4ca52a,_0xc1b2de){return function(_0x3d982d){if(_0x3d982d){return _0x3d982d[_0x7783('0x24')](_0x4ca52a)[_0x7783('0x25')](function(_0x5da28e){return _0x5da28e;});}return null;};}function removeEntity(_0x20ba02,_0x4a1d24){return function(_0x1368cd){if(_0x1368cd){return _0x1368cd[_0x7783('0x26')]()['then'](function(){var _0x126d55=_0x1368cd[_0x7783('0x27')]({'plain':!![]});var _0x5ae057=_0x7783('0x28');return db[_0x7783('0x29')]['destroy']({'where':{'type':_0x5ae057,'resourceId':_0x126d55['id']}})['then'](function(){return _0x1368cd;});})[_0x7783('0x25')](function(){_0x20ba02[_0x7783('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2949ab,_0x174672){return function(_0x2125e2){if(!_0x2125e2){_0x2949ab[_0x7783('0x18')](0x194);}return _0x2125e2;};}function handleError(_0x3a6294,_0x2c57d3){_0x2c57d3=_0x2c57d3||0x1f4;return function(_0xf38da5){logger[_0x7783('0x2a')](_0xf38da5['stack']);if(_0xf38da5[_0x7783('0x2b')]){delete _0xf38da5[_0x7783('0x2b')];}_0x3a6294[_0x7783('0x1e')](_0x2c57d3)['send'](_0xf38da5);};}exports[_0x7783('0x2c')]=function(_0x34b83c,_0x401778){var _0x12fffa={},_0x372662={},_0x1d0447={'count':0x0,'rows':[]};var _0x1c7a98=_['map'](db[_0x7783('0x2d')][_0x7783('0x2e')],function(_0x3cbe28){return{'name':_0x3cbe28[_0x7783('0x2f')],'type':_0x3cbe28[_0x7783('0x30')][_0x7783('0x31')]};});_0x372662[_0x7783('0x32')]=_[_0x7783('0x33')](_0x1c7a98,_0x7783('0x2b'));_0x372662[_0x7783('0x34')]=_[_0x7783('0x35')](_0x34b83c[_0x7783('0x34')]);_0x372662[_0x7783('0x36')]=_[_0x7783('0x37')](_0x372662[_0x7783('0x32')],_0x372662[_0x7783('0x34')]);_0x12fffa[_0x7783('0x38')]=_['intersection'](_0x372662[_0x7783('0x32')],qs['fields'](_0x34b83c[_0x7783('0x34')][_0x7783('0x39')]));_0x12fffa[_0x7783('0x38')]=_0x12fffa[_0x7783('0x38')]['length']?_0x12fffa[_0x7783('0x38')]:_0x372662[_0x7783('0x32')];if(!_0x34b83c[_0x7783('0x34')][_0x7783('0x3a')](_0x7783('0x3b'))){_0x12fffa[_0x7783('0x1d')]=qs[_0x7783('0x1d')](_0x34b83c[_0x7783('0x34')][_0x7783('0x1d')]);_0x12fffa[_0x7783('0x1c')]=qs['offset'](_0x34b83c[_0x7783('0x34')]['offset']);}_0x12fffa[_0x7783('0x3c')]=qs['sort'](_0x34b83c['query'][_0x7783('0x3d')]);_0x12fffa[_0x7783('0x3e')]=qs[_0x7783('0x36')](_['pick'](_0x34b83c['query'],_0x372662[_0x7783('0x36')]),_0x1c7a98);if(_0x34b83c[_0x7783('0x34')][_0x7783('0x3f')]){_0x12fffa[_0x7783('0x3e')]=_['merge'](_0x12fffa['where'],{'$or':_[_0x7783('0x33')](_0x1c7a98,function(_0x847b56){if(_0x847b56[_0x7783('0x30')]!==_0x7783('0x40')){var _0x5b7352={};_0x5b7352[_0x847b56[_0x7783('0x2b')]]={'$like':'%'+_0x34b83c['query'][_0x7783('0x3f')]+'%'};return _0x5b7352;}})});}_0x12fffa=_[_0x7783('0x41')]({},_0x12fffa,_0x34b83c[_0x7783('0x42')]);var _0x554b6d={'where':_0x12fffa[_0x7783('0x3e')]};return db[_0x7783('0x2d')][_0x7783('0x1b')](_0x554b6d)[_0x7783('0x25')](function(_0x240491){_0x1d0447[_0x7783('0x1b')]=_0x240491;if(_0x34b83c[_0x7783('0x34')][_0x7783('0x43')]){_0x12fffa['include']=[{'all':!![]}];}return db[_0x7783('0x2d')][_0x7783('0x44')](_0x12fffa);})['then'](function(_0x59626a){_0x1d0447[_0x7783('0x45')]=_0x59626a;return _0x1d0447;})['then'](respondWithFilteredResult(_0x401778,_0x12fffa))[_0x7783('0x46')](handleError(_0x401778,null));};exports['show']=function(_0x14b951,_0x3ac78f){var _0x53b3a8={'raw':!![],'where':{'id':_0x14b951['params']['id']}},_0x525e66={};_0x525e66[_0x7783('0x32')]=_[_0x7783('0x35')](db[_0x7783('0x2d')][_0x7783('0x2e')]);_0x525e66[_0x7783('0x34')]=_[_0x7783('0x35')](_0x14b951[_0x7783('0x34')]);_0x525e66[_0x7783('0x36')]=_[_0x7783('0x37')](_0x525e66[_0x7783('0x32')],_0x525e66[_0x7783('0x34')]);_0x53b3a8[_0x7783('0x38')]=_[_0x7783('0x37')](_0x525e66['model'],qs['fields'](_0x14b951[_0x7783('0x34')][_0x7783('0x39')]));_0x53b3a8[_0x7783('0x38')]=_0x53b3a8[_0x7783('0x38')]['length']?_0x53b3a8['attributes']:_0x525e66[_0x7783('0x32')];if(_0x14b951['query'][_0x7783('0x43')]){_0x53b3a8[_0x7783('0x47')]=[{'all':!![]}];}_0x53b3a8=_['merge']({},_0x53b3a8,_0x14b951['options']);return db[_0x7783('0x2d')][_0x7783('0x48')](_0x53b3a8)[_0x7783('0x25')](handleEntityNotFound(_0x3ac78f,null))[_0x7783('0x25')](respondWithResult(_0x3ac78f,null))[_0x7783('0x46')](handleError(_0x3ac78f,null));};exports['create']=function(_0x193e51,_0x53437d){return db[_0x7783('0x2d')][_0x7783('0x49')](_0x193e51[_0x7783('0x4a')],{})[_0x7783('0x25')](function(_0x5237fd){var _0x37cf16=_0x193e51[_0x7783('0x4b')][_0x7783('0x27')]({'plain':!![]});if(!_0x37cf16)throw new Error(_0x7783('0x4c'));if(_0x37cf16[_0x7783('0x4d')]===_0x7783('0x4b')){var _0x7684c6=_0x5237fd[_0x7783('0x27')]({'plain':!![]});var _0x35b302=_0x7783('0x28');return db[_0x7783('0x4e')][_0x7783('0x48')]({'where':{'name':_0x35b302,'userProfileId':_0x37cf16[_0x7783('0x4f')]},'raw':!![]})[_0x7783('0x25')](function(_0x1a7c9e){if(_0x1a7c9e&&_0x1a7c9e[_0x7783('0x50')]===0x0){return db[_0x7783('0x29')][_0x7783('0x49')]({'name':_0x7684c6[_0x7783('0x2b')],'resourceId':_0x7684c6['id'],'type':_0x1a7c9e['name'],'sectionId':_0x1a7c9e['id']},{})[_0x7783('0x25')](function(){return _0x5237fd;});}else{return _0x5237fd;}})[_0x7783('0x46')](function(_0x51473c){logger[_0x7783('0x2a')](_0x7783('0x51'),_0x51473c);throw _0x51473c;});}return _0x5237fd;})[_0x7783('0x25')](respondWithResult(_0x53437d,0xc9))[_0x7783('0x46')](handleError(_0x53437d,null));};exports[_0x7783('0x24')]=function(_0x1ffd33,_0x37fc01){if(_0x1ffd33[_0x7783('0x4a')]['id']){delete _0x1ffd33[_0x7783('0x4a')]['id'];}return db[_0x7783('0x2d')]['find']({'where':{'id':_0x1ffd33[_0x7783('0x52')]['id']}})['then'](handleEntityNotFound(_0x37fc01,null))[_0x7783('0x25')](saveUpdates(_0x1ffd33[_0x7783('0x4a')],null))[_0x7783('0x25')](respondWithResult(_0x37fc01,null))[_0x7783('0x46')](handleError(_0x37fc01,null));};exports[_0x7783('0x26')]=function(_0x2f9db6,_0x327cbc){return db[_0x7783('0x2d')]['find']({'where':{'id':_0x2f9db6[_0x7783('0x52')]['id']}})['then'](handleEntityNotFound(_0x327cbc,null))[_0x7783('0x25')](removeEntity(_0x327cbc,null))[_0x7783('0x46')](handleError(_0x327cbc,null));};exports['addInterval']=function(_0x368088,_0xb22ae7,_0x2dfb7d){if(_0x368088[_0x7783('0x4a')]['id']){delete _0x368088[_0x7783('0x4a')]['id'];}return db['Interval'][_0x7783('0x48')]({'where':{'id':_0x368088[_0x7783('0x52')]['id']}})[_0x7783('0x25')](handleEntityNotFound(_0xb22ae7,null))[_0x7783('0x25')](function(_0x37e3ca){if(_0x37e3ca){_0x368088[_0x7783('0x4a')][_0x7783('0x53')]=_0x37e3ca['id'];return db[_0x7783('0x2d')][_0x7783('0x49')](_0x368088[_0x7783('0x4a')]);}})[_0x7783('0x25')](respondWithResult(_0xb22ae7,null))[_0x7783('0x46')](handleError(_0xb22ae7,null));};exports[_0x7783('0x54')]=function(_0x251ffd,_0x1db76b,_0x4d445d){var _0x34dcef={};var _0x296648={};var _0x79f722;var _0x3c70be;return db[_0x7783('0x2d')][_0x7783('0x55')]({'where':{'id':_0x251ffd[_0x7783('0x52')]['id']}})[_0x7783('0x25')](handleEntityNotFound(_0x1db76b,null))[_0x7783('0x25')](function(_0x5d084b){if(_0x5d084b){_0x79f722=_0x5d084b;_0x296648[_0x7783('0x32')]=_[_0x7783('0x35')](db['Interval']['rawAttributes']);_0x296648[_0x7783('0x34')]=_['keys'](_0x251ffd['query']);_0x296648[_0x7783('0x36')]=_[_0x7783('0x37')](_0x296648[_0x7783('0x32')],_0x296648[_0x7783('0x34')]);_0x34dcef[_0x7783('0x38')]=_[_0x7783('0x37')](_0x296648[_0x7783('0x32')],qs[_0x7783('0x39')](_0x251ffd[_0x7783('0x34')][_0x7783('0x39')]));_0x34dcef['attributes']=_0x34dcef[_0x7783('0x38')][_0x7783('0x56')]?_0x34dcef['attributes']:_0x296648['model'];_0x34dcef[_0x7783('0x3c')]=qs[_0x7783('0x3d')](_0x251ffd['query']['sort']);_0x34dcef[_0x7783('0x3e')]=qs[_0x7783('0x36')](_[_0x7783('0x57')](_0x251ffd[_0x7783('0x34')],_0x296648['filters']));if(_0x251ffd['query']['filter']){_0x34dcef[_0x7783('0x3e')]=_[_0x7783('0x41')](_0x34dcef[_0x7783('0x3e')],{'$or':_[_0x7783('0x33')](_0x34dcef[_0x7783('0x38')],function(_0x5f2656){var _0x7740cc={};_0x7740cc[_0x5f2656]={'$like':'%'+_0x251ffd[_0x7783('0x34')]['filter']+'%'};return _0x7740cc;})});}_0x34dcef=_[_0x7783('0x41')]({},_0x34dcef,_0x251ffd[_0x7783('0x42')]);return _0x79f722[_0x7783('0x54')](_0x34dcef);}})[_0x7783('0x25')](function(_0x58be42){if(_0x58be42){_0x3c70be=_0x58be42[_0x7783('0x56')];if(!_0x251ffd[_0x7783('0x34')][_0x7783('0x3a')](_0x7783('0x3b'))){_0x34dcef['limit']=qs[_0x7783('0x1d')](_0x251ffd['query'][_0x7783('0x1d')]);_0x34dcef['offset']=qs['offset'](_0x251ffd[_0x7783('0x34')]['offset']);}return _0x79f722['getIntervals'](_0x34dcef);}})[_0x7783('0x25')](function(_0x1f3729){if(_0x1f3729){return _0x1f3729?{'count':_0x3c70be,'rows':_0x1f3729}:null;}})[_0x7783('0x25')](respondWithResult(_0x1db76b,null))[_0x7783('0x46')](handleError(_0x1db76b,null));};exports['addIntervals']=function(_0x5bec27,_0xd4e9eb,_0x4c7938){return db['Interval'][_0x7783('0x55')]({'where':{'id':_0x5bec27['params']['id']}})['then'](handleEntityNotFound(_0xd4e9eb,null))[_0x7783('0x25')](function(_0x1583cf){if(_0x1583cf){return db[_0x7783('0x58')][_0x7783('0x59')](function(_0x58cc07){return db['Interval'][_0x7783('0x26')]({'where':{'IntervalId':_0x5bec27[_0x7783('0x52')]['id']},'transaction':_0x58cc07})['then'](function(_0x5aafa2){var _0x28c571=_[_0x7783('0x33')](_0x5bec27[_0x7783('0x4a')],function(_0x9bd27f){delete _0x9bd27f['id'];_0x9bd27f[_0x7783('0x53')]=_0x5bec27[_0x7783('0x52')]['id'];return _0x9bd27f;});return db[_0x7783('0x2d')][_0x7783('0x5a')](_0x28c571,{'transaction':_0x58cc07});});})[_0x7783('0x25')](function(){return db[_0x7783('0x2d')][_0x7783('0x44')]({'where':{'IntervalId':_0x5bec27[_0x7783('0x52')]['id']}});});}})[_0x7783('0x25')](respondWithResult(_0xd4e9eb,null))['catch'](handleError(_0xd4e9eb,null));}; \ No newline at end of file +var _0x271d=['stack','name','index','map','rawAttributes','fieldName','keys','filters','model','intersection','fields','query','attributes','length','nolimit','order','where','pick','merge','type','VIRTUAL','Interval','count','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','findOne','sort','filter','options','hasOwnProperty','addIntervals','sequelize','transaction','findAll','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','update','then','destroy','get','Intervals','error'];(function(_0x72895a,_0x433607){var _0x5226d5=function(_0x5b7d21){while(--_0x5b7d21){_0x72895a['push'](_0x72895a['shift']());}};_0x5226d5(++_0x433607);}(_0x271d,0x12e));var _0xd271=function(_0x5c7746,_0x307707){_0x5c7746=_0x5c7746-0x0;var _0x56756=_0x271d[_0x5c7746];return _0x56756;};'use strict';var pdf=require(_0xd271('0x0'));var emlformat=require(_0xd271('0x1'));var rimraf=require(_0xd271('0x2'));var zipdir=require(_0xd271('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd271('0x4'));var moment=require(_0xd271('0x5'));var BPromise=require(_0xd271('0x6'));var Mustache=require(_0xd271('0x7'));var util=require(_0xd271('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xd271('0x9'));var ejs=require(_0xd271('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd271('0xb'));var crypto=require(_0xd271('0xc'));var jsforce=require(_0xd271('0xd'));var deskjs=require(_0xd271('0xe'));var toCsv=require(_0xd271('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd271('0xf'));var authService=require(_0xd271('0x10'));var qs=require(_0xd271('0x11'));var as=require(_0xd271('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd271('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xd271('0x14'));var db=require(_0xd271('0x15'))['db'];var extensions=require(_0xd271('0x16'));function respondWithStatusCode(_0x51a214,_0x1706ff){_0x1706ff=_0x1706ff||0xcc;return function(_0x3fb9ea){if(_0x3fb9ea){return _0x51a214[_0xd271('0x17')](_0x1706ff);}return _0x51a214[_0xd271('0x18')](_0x1706ff)[_0xd271('0x19')]();};}function respondWithResult(_0x210f7c,_0x51a9b3){_0x51a9b3=_0x51a9b3||0xc8;return function(_0x4aec33){if(_0x4aec33){return _0x210f7c['status'](_0x51a9b3)[_0xd271('0x1a')](_0x4aec33);}};}function respondWithFilteredResult(_0x2fc2ad,_0x3ffada){return function(_0x19fecb){if(_0x19fecb){var _0x2f8073=_0x19fecb['count'],_0x52f930=_0x3ffada['offset'],_0x4964c6=_0x3ffada[_0xd271('0x1b')]+_0x3ffada[_0xd271('0x1c')],_0x500496;if(_0x4964c6>=_0x2f8073){_0x4964c6=_0x2f8073;_0x500496=0xc8;}else{_0x500496=0xce;}_0x2fc2ad[_0xd271('0x18')](_0x500496);return _0x2fc2ad[_0xd271('0x1d')](_0xd271('0x1e'),_0x52f930+'-'+_0x4964c6+'/'+_0x2f8073)[_0xd271('0x1a')](_0x19fecb);}return null;};}function patchUpdates(_0x214491){return function(_0x178304){try{jsonpatch[_0xd271('0x1f')](_0x178304,_0x214491,!![]);}catch(_0x53ffd6){return BPromise['reject'](_0x53ffd6);}return _0x178304['save']();};}function saveUpdates(_0x5b5fb8,_0x510819){return function(_0x3efded){if(_0x3efded){return _0x3efded[_0xd271('0x20')](_0x5b5fb8)[_0xd271('0x21')](function(_0x5aa20e){return _0x5aa20e;});}return null;};}function removeEntity(_0x4b2bbe,_0x4c5990){return function(_0x559029){if(_0x559029){return _0x559029[_0xd271('0x22')]()[_0xd271('0x21')](function(){var _0x5db292=_0x559029[_0xd271('0x23')]({'plain':!![]});var _0x12d329=_0xd271('0x24');return db['UserProfileResource'][_0xd271('0x22')]({'where':{'type':_0x12d329,'resourceId':_0x5db292['id']}})[_0xd271('0x21')](function(){return _0x559029;});})['then'](function(){_0x4b2bbe[_0xd271('0x18')](0xcc)[_0xd271('0x19')]();});}};}function handleEntityNotFound(_0x434099,_0x25a358){return function(_0x5713f1){if(!_0x5713f1){_0x434099[_0xd271('0x17')](0x194);}return _0x5713f1;};}function handleError(_0x4c84a5,_0x3613d0){_0x3613d0=_0x3613d0||0x1f4;return function(_0x38f106){logger[_0xd271('0x25')](_0x38f106[_0xd271('0x26')]);if(_0x38f106[_0xd271('0x27')]){delete _0x38f106[_0xd271('0x27')];}_0x4c84a5[_0xd271('0x18')](_0x3613d0)['send'](_0x38f106);};}exports[_0xd271('0x28')]=function(_0x4dac88,_0x1a6066){var _0x4ae881={},_0x90af78={},_0x46db9={'count':0x0,'rows':[]};var _0x3d8594=_[_0xd271('0x29')](db['Interval'][_0xd271('0x2a')],function(_0x400508){return{'name':_0x400508[_0xd271('0x2b')],'type':_0x400508['type']['key']};});_0x90af78['model']=_['map'](_0x3d8594,'name');_0x90af78['query']=_[_0xd271('0x2c')](_0x4dac88['query']);_0x90af78[_0xd271('0x2d')]=_['intersection'](_0x90af78[_0xd271('0x2e')],_0x90af78['query']);_0x4ae881['attributes']=_[_0xd271('0x2f')](_0x90af78[_0xd271('0x2e')],qs[_0xd271('0x30')](_0x4dac88[_0xd271('0x31')][_0xd271('0x30')]));_0x4ae881[_0xd271('0x32')]=_0x4ae881[_0xd271('0x32')][_0xd271('0x33')]?_0x4ae881[_0xd271('0x32')]:_0x90af78[_0xd271('0x2e')];if(!_0x4dac88[_0xd271('0x31')]['hasOwnProperty'](_0xd271('0x34'))){_0x4ae881[_0xd271('0x1c')]=qs['limit'](_0x4dac88[_0xd271('0x31')][_0xd271('0x1c')]);_0x4ae881[_0xd271('0x1b')]=qs['offset'](_0x4dac88[_0xd271('0x31')]['offset']);}_0x4ae881[_0xd271('0x35')]=qs['sort'](_0x4dac88[_0xd271('0x31')]['sort']);_0x4ae881[_0xd271('0x36')]=qs[_0xd271('0x2d')](_[_0xd271('0x37')](_0x4dac88[_0xd271('0x31')],_0x90af78[_0xd271('0x2d')]),_0x3d8594);if(_0x4dac88[_0xd271('0x31')]['filter']){_0x4ae881['where']=_[_0xd271('0x38')](_0x4ae881[_0xd271('0x36')],{'$or':_[_0xd271('0x29')](_0x3d8594,function(_0x30aa2c){if(_0x30aa2c[_0xd271('0x39')]!==_0xd271('0x3a')){var _0x40c775={};_0x40c775[_0x30aa2c[_0xd271('0x27')]]={'$like':'%'+_0x4dac88['query']['filter']+'%'};return _0x40c775;}})});}_0x4ae881=_[_0xd271('0x38')]({},_0x4ae881,_0x4dac88['options']);var _0x16278d={'where':_0x4ae881[_0xd271('0x36')]};return db[_0xd271('0x3b')][_0xd271('0x3c')](_0x16278d)[_0xd271('0x21')](function(_0x392c6a){_0x46db9[_0xd271('0x3c')]=_0x392c6a;if(_0x4dac88[_0xd271('0x31')]['includeAll']){_0x4ae881['include']=[{'all':!![]}];}return db[_0xd271('0x3b')]['findAll'](_0x4ae881);})[_0xd271('0x21')](function(_0xcdcda4){_0x46db9['rows']=_0xcdcda4;return _0x46db9;})[_0xd271('0x21')](respondWithFilteredResult(_0x1a6066,_0x4ae881))['catch'](handleError(_0x1a6066,null));};exports[_0xd271('0x3d')]=function(_0x2cb01b,_0x5902af){var _0x342921={'raw':!![],'where':{'id':_0x2cb01b[_0xd271('0x3e')]['id']}},_0x518ca4={};_0x518ca4[_0xd271('0x2e')]=_[_0xd271('0x2c')](db['Interval'][_0xd271('0x2a')]);_0x518ca4['query']=_[_0xd271('0x2c')](_0x2cb01b[_0xd271('0x31')]);_0x518ca4[_0xd271('0x2d')]=_['intersection'](_0x518ca4[_0xd271('0x2e')],_0x518ca4[_0xd271('0x31')]);_0x342921[_0xd271('0x32')]=_[_0xd271('0x2f')](_0x518ca4['model'],qs[_0xd271('0x30')](_0x2cb01b[_0xd271('0x31')][_0xd271('0x30')]));_0x342921[_0xd271('0x32')]=_0x342921[_0xd271('0x32')]['length']?_0x342921['attributes']:_0x518ca4[_0xd271('0x2e')];if(_0x2cb01b['query'][_0xd271('0x3f')]){_0x342921['include']=[{'all':!![]}];}_0x342921=_['merge']({},_0x342921,_0x2cb01b['options']);return db['Interval'][_0xd271('0x40')](_0x342921)[_0xd271('0x21')](handleEntityNotFound(_0x5902af,null))[_0xd271('0x21')](respondWithResult(_0x5902af,null))['catch'](handleError(_0x5902af,null));};exports['create']=function(_0x30cb12,_0x4d9679){return db[_0xd271('0x3b')][_0xd271('0x41')](_0x30cb12[_0xd271('0x42')],{})[_0xd271('0x21')](function(_0x120622){var _0x5df5a4=_0x30cb12[_0xd271('0x43')][_0xd271('0x23')]({'plain':!![]});if(!_0x5df5a4)throw new Error(_0xd271('0x44'));if(_0x5df5a4[_0xd271('0x45')]===_0xd271('0x43')){var _0x291828=_0x120622['get']({'plain':!![]});var _0x3bfbc6=_0xd271('0x24');return db['UserProfileSection'][_0xd271('0x40')]({'where':{'name':_0x3bfbc6,'userProfileId':_0x5df5a4[_0xd271('0x46')]},'raw':!![]})['then'](function(_0x254334){if(_0x254334&&_0x254334[_0xd271('0x47')]===0x0){return db['UserProfileResource']['create']({'name':_0x291828['name'],'resourceId':_0x291828['id'],'type':_0x254334[_0xd271('0x27')],'sectionId':_0x254334['id']},{})['then'](function(){return _0x120622;});}else{return _0x120622;}})[_0xd271('0x48')](function(_0xd0cb01){logger[_0xd271('0x25')](_0xd271('0x49'),_0xd0cb01);throw _0xd0cb01;});}return _0x120622;})['then'](respondWithResult(_0x4d9679,0xc9))[_0xd271('0x48')](handleError(_0x4d9679,null));};exports['update']=function(_0x1e94fc,_0x5b9ee8){if(_0x1e94fc[_0xd271('0x42')]['id']){delete _0x1e94fc[_0xd271('0x42')]['id'];}return db['Interval'][_0xd271('0x40')]({'where':{'id':_0x1e94fc[_0xd271('0x3e')]['id']}})[_0xd271('0x21')](handleEntityNotFound(_0x5b9ee8,null))[_0xd271('0x21')](saveUpdates(_0x1e94fc[_0xd271('0x42')],null))[_0xd271('0x21')](respondWithResult(_0x5b9ee8,null))[_0xd271('0x48')](handleError(_0x5b9ee8,null));};exports['destroy']=function(_0x20109d,_0xba336f){return db[_0xd271('0x3b')][_0xd271('0x40')]({'where':{'id':_0x20109d[_0xd271('0x3e')]['id']}})['then'](handleEntityNotFound(_0xba336f,null))[_0xd271('0x21')](removeEntity(_0xba336f,null))[_0xd271('0x48')](handleError(_0xba336f,null));};exports[_0xd271('0x4a')]=function(_0x127ce3,_0x30296a,_0x2cfd93){if(_0x127ce3[_0xd271('0x42')]['id']){delete _0x127ce3[_0xd271('0x42')]['id'];}return db['Interval'][_0xd271('0x40')]({'where':{'id':_0x127ce3[_0xd271('0x3e')]['id']}})['then'](handleEntityNotFound(_0x30296a,null))[_0xd271('0x21')](function(_0x3d8b1a){if(_0x3d8b1a){_0x127ce3[_0xd271('0x42')][_0xd271('0x4b')]=_0x3d8b1a['id'];return db[_0xd271('0x3b')][_0xd271('0x41')](_0x127ce3[_0xd271('0x42')]);}})[_0xd271('0x21')](respondWithResult(_0x30296a,null))[_0xd271('0x48')](handleError(_0x30296a,null));};exports['getIntervals']=function(_0xbdd1e3,_0x3d7b03,_0x2920fc){var _0x321765={};var _0x625eaa={};var _0x378cf6;var _0x26f246;return db[_0xd271('0x3b')][_0xd271('0x4c')]({'where':{'id':_0xbdd1e3[_0xd271('0x3e')]['id']}})[_0xd271('0x21')](handleEntityNotFound(_0x3d7b03,null))[_0xd271('0x21')](function(_0x40b382){if(_0x40b382){_0x378cf6=_0x40b382;_0x625eaa['model']=_['keys'](db['Interval'][_0xd271('0x2a')]);_0x625eaa['query']=_[_0xd271('0x2c')](_0xbdd1e3[_0xd271('0x31')]);_0x625eaa[_0xd271('0x2d')]=_[_0xd271('0x2f')](_0x625eaa[_0xd271('0x2e')],_0x625eaa[_0xd271('0x31')]);_0x321765['attributes']=_[_0xd271('0x2f')](_0x625eaa[_0xd271('0x2e')],qs[_0xd271('0x30')](_0xbdd1e3[_0xd271('0x31')][_0xd271('0x30')]));_0x321765[_0xd271('0x32')]=_0x321765[_0xd271('0x32')][_0xd271('0x33')]?_0x321765[_0xd271('0x32')]:_0x625eaa[_0xd271('0x2e')];_0x321765[_0xd271('0x35')]=qs[_0xd271('0x4d')](_0xbdd1e3['query'][_0xd271('0x4d')]);_0x321765[_0xd271('0x36')]=qs['filters'](_['pick'](_0xbdd1e3[_0xd271('0x31')],_0x625eaa[_0xd271('0x2d')]));if(_0xbdd1e3[_0xd271('0x31')][_0xd271('0x4e')]){_0x321765[_0xd271('0x36')]=_['merge'](_0x321765[_0xd271('0x36')],{'$or':_['map'](_0x321765[_0xd271('0x32')],function(_0x5a5499){var _0x42bb1d={};_0x42bb1d[_0x5a5499]={'$like':'%'+_0xbdd1e3[_0xd271('0x31')]['filter']+'%'};return _0x42bb1d;})});}_0x321765=_[_0xd271('0x38')]({},_0x321765,_0xbdd1e3[_0xd271('0x4f')]);return _0x378cf6['getIntervals'](_0x321765);}})[_0xd271('0x21')](function(_0x19b2c2){if(_0x19b2c2){_0x26f246=_0x19b2c2[_0xd271('0x33')];if(!_0xbdd1e3['query'][_0xd271('0x50')]('nolimit')){_0x321765[_0xd271('0x1c')]=qs['limit'](_0xbdd1e3[_0xd271('0x31')][_0xd271('0x1c')]);_0x321765[_0xd271('0x1b')]=qs[_0xd271('0x1b')](_0xbdd1e3[_0xd271('0x31')][_0xd271('0x1b')]);}return _0x378cf6['getIntervals'](_0x321765);}})[_0xd271('0x21')](function(_0x3acb8c){if(_0x3acb8c){return _0x3acb8c?{'count':_0x26f246,'rows':_0x3acb8c}:null;}})[_0xd271('0x21')](respondWithResult(_0x3d7b03,null))['catch'](handleError(_0x3d7b03,null));};exports[_0xd271('0x51')]=function(_0x5e6db4,_0x52ef5f,_0x4cb47a){return db['Interval'][_0xd271('0x4c')]({'where':{'id':_0x5e6db4[_0xd271('0x3e')]['id']}})['then'](handleEntityNotFound(_0x52ef5f,null))[_0xd271('0x21')](function(_0x316487){if(_0x316487){return db[_0xd271('0x52')][_0xd271('0x53')](function(_0x940346){return db[_0xd271('0x3b')][_0xd271('0x22')]({'where':{'IntervalId':_0x5e6db4['params']['id']},'transaction':_0x940346})[_0xd271('0x21')](function(_0x8413ac){var _0x1f3387=_[_0xd271('0x29')](_0x5e6db4[_0xd271('0x42')],function(_0x48fb03){delete _0x48fb03['id'];_0x48fb03[_0xd271('0x4b')]=_0x5e6db4[_0xd271('0x3e')]['id'];return _0x48fb03;});return db[_0xd271('0x3b')]['bulkCreate'](_0x1f3387,{'transaction':_0x940346});});})['then'](function(){return db['Interval'][_0xd271('0x54')]({'where':{'IntervalId':_0x5e6db4['params']['id']}});});}})['then'](respondWithResult(_0x52ef5f,null))[_0xd271('0x48')](handleError(_0x52ef5f,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 95a2a18..eafc6f2 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 _0x0b25=['define','tools_intervals','rewrite','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','../../components/extensions/rewrite','exports'];(function(_0x348c09,_0x539458){var _0x22d339=function(_0x3be039){while(--_0x3be039){_0x348c09['push'](_0x348c09['shift']());}};_0x22d339(++_0x539458);}(_0x0b25,0x155));var _0x50b2=function(_0x4358f5,_0x5b1ac6){_0x4358f5=_0x4358f5-0x0;var _0x4d8104=_0x0b25[_0x4358f5];return _0x4d8104;};'use strict';var _=require(_0x50b2('0x0'));var util=require(_0x50b2('0x1'));var logger=require(_0x50b2('0x2'))(_0x50b2('0x3'));var moment=require(_0x50b2('0x4'));var BPromise=require(_0x50b2('0x5'));var rp=require(_0x50b2('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x50b2('0x7'));var attributes=require('./interval.attributes');var extensions=require(_0x50b2('0x8'));module[_0x50b2('0x9')]=function(_0x3cbc65,_0x29278f){return _0x3cbc65[_0x50b2('0xa')]('Interval',attributes,{'tableName':_0x50b2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2b7400,_0x319f6f){extensions[_0x50b2('0xc')](_0x3cbc65,_0x2b7400);},'afterBulkCreate':function(_0x54d618,_0x37811b,_0x593825){_0x593825();extensions[_0x50b2('0xc')](_0x3cbc65,_0x54d618[0x0]);},'afterUpdate':function(_0x3ace08,_0x4f9d1b){extensions[_0x50b2('0xc')](_0x3cbc65,_0x3ace08);},'afterDestroy':function(_0x494e53,_0x5b0f2a){extensions[_0x50b2('0xc')](_0x3cbc65,_0x494e53);}}});}; \ No newline at end of file +var _0x2504=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','Interval','tools_intervals','rewrite','lodash','util'];(function(_0x2b4ff3,_0x3398b7){var _0x45b5a6=function(_0x22cce){while(--_0x22cce){_0x2b4ff3['push'](_0x2b4ff3['shift']());}};_0x45b5a6(++_0x3398b7);}(_0x2504,0xee));var _0x4250=function(_0x3b0573,_0x5adcd2){_0x3b0573=_0x3b0573-0x0;var _0x267f9c=_0x2504[_0x3b0573];return _0x267f9c;};'use strict';var _=require(_0x4250('0x0'));var util=require(_0x4250('0x1'));var logger=require(_0x4250('0x2'))(_0x4250('0x3'));var moment=require(_0x4250('0x4'));var BPromise=require(_0x4250('0x5'));var rp=require(_0x4250('0x6'));var fs=require('fs');var path=require(_0x4250('0x7'));var rimraf=require(_0x4250('0x8'));var config=require(_0x4250('0x9'));var attributes=require(_0x4250('0xa'));var extensions=require(_0x4250('0xb'));module['exports']=function(_0x473cb8,_0x4e177e){return _0x473cb8['define'](_0x4250('0xc'),attributes,{'tableName':_0x4250('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1a3b57,_0x3c5dba){extensions[_0x4250('0xe')](_0x473cb8,_0x1a3b57);},'afterBulkCreate':function(_0x51ea6f,_0x1016b9,_0x49bf26){_0x49bf26();extensions[_0x4250('0xe')](_0x473cb8,_0x51ea6f[0x0]);},'afterUpdate':function(_0x2ff5ca,_0x55a792){extensions[_0x4250('0xe')](_0x473cb8,_0x2ff5ca);},'afterDestroy':function(_0x583057,_0x535015){extensions[_0x4250('0xe')](_0x473cb8,_0x583057);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 9a6b04d..b64f21b 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 _0xf80f=['client','http','request','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetInterval','Interval','findAll','raw','options','where','attributes','limit','include','model','map','then','info','ShowInterval','find','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf80f,0x14d));var _0xff80=function(_0x5003f9,_0x24cd27){_0x5003f9=_0x5003f9-0x0;var _0x955af7=_0xf80f[_0x5003f9];return _0x955af7;};'use strict';var _=require(_0xff80('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xff80('0x1'));var rs=require(_0xff80('0x2'));var fs=require('fs');var Redis=require(_0xff80('0x3'));var db=require(_0xff80('0x4'))['db'];var utils=require(_0xff80('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xff80('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xff80('0x7')][_0xff80('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1e2357,_0x546c49,_0x3afe31){return new BPromise(function(_0x56f2f9,_0x4a1b9e){return client[_0xff80('0x9')](_0x1e2357,_0x3afe31)['then'](function(_0x17368f){logger['info'](_0xff80('0xa'),_0x546c49,_0xff80('0xb'));logger[_0xff80('0xc')](_0xff80('0xd'),_0x546c49,_0xff80('0xb'),JSON[_0xff80('0xe')](_0x17368f));if(_0x17368f[_0xff80('0xf')]){if(_0x17368f['error']['code']===0x1f4){logger[_0xff80('0xf')](_0xff80('0xa'),_0x546c49,_0x17368f[_0xff80('0xf')][_0xff80('0x10')]);return _0x4a1b9e(_0x17368f[_0xff80('0xf')][_0xff80('0x10')]);}logger[_0xff80('0xf')](_0xff80('0xa'),_0x546c49,_0x17368f['error'][_0xff80('0x10')]);return _0x56f2f9(_0x17368f[_0xff80('0xf')][_0xff80('0x10')]);}else{logger['info'](_0xff80('0xa'),_0x546c49,_0xff80('0xb'));_0x56f2f9(_0x17368f[_0xff80('0x11')]['message']);}})[_0xff80('0x12')](function(_0x4be2e1){logger['error'](_0xff80('0xa'),_0x546c49,_0x4be2e1);_0x4a1b9e(_0x4be2e1);});});}exports[_0xff80('0x13')]=function(_0x5100bd){var _0x32d6fb=this;return new Promise(function(_0x23699a,_0x2af695){return db[_0xff80('0x14')][_0xff80('0x15')]({'raw':_0x5100bd['options']?_0x5100bd['options'][_0xff80('0x16')]===undefined?!![]:![]:!![],'where':_0x5100bd[_0xff80('0x17')]?_0x5100bd[_0xff80('0x17')][_0xff80('0x18')]||null:null,'attributes':_0x5100bd['options']?_0x5100bd[_0xff80('0x17')][_0xff80('0x19')]||null:null,'limit':_0x5100bd['options']?_0x5100bd['options'][_0xff80('0x1a')]||null:null,'include':_0x5100bd[_0xff80('0x17')]?_0x5100bd[_0xff80('0x17')][_0xff80('0x1b')]?_['map'](_0x5100bd[_0xff80('0x17')][_0xff80('0x1b')],function(_0x4a96e5){return{'model':db[_0x4a96e5[_0xff80('0x1c')]],'as':_0x4a96e5['as'],'attributes':_0x4a96e5[_0xff80('0x19')],'include':_0x4a96e5[_0xff80('0x1b')]?_[_0xff80('0x1d')](_0x4a96e5[_0xff80('0x1b')],function(_0x230bb3){return{'model':db[_0x230bb3[_0xff80('0x1c')]],'as':_0x230bb3['as'],'attributes':_0x230bb3[_0xff80('0x19')],'include':_0x230bb3['include']?_[_0xff80('0x1d')](_0x230bb3[_0xff80('0x1b')],function(_0x1a982d){return{'model':db[_0x1a982d[_0xff80('0x1c')]],'as':_0x1a982d['as'],'attributes':_0x1a982d['attributes']};}):[]};}):[]};}):[]:[]})[_0xff80('0x1e')](function(_0x46b5b0){logger[_0xff80('0x1f')](_0xff80('0x13'),_0x5100bd);logger[_0xff80('0xc')]('GetInterval',_0x5100bd,JSON['stringify'](_0x46b5b0));_0x23699a(_0x46b5b0);})[_0xff80('0x12')](function(_0x3815e7){logger['error'](_0xff80('0x13'),_0x3815e7[_0xff80('0x10')],_0x5100bd);_0x2af695(_0x32d6fb[_0xff80('0xf')](0x1f4,_0x3815e7[_0xff80('0x10')]));});});};exports[_0xff80('0x20')]=function(_0x3521bc){var _0x12bc75=this;return new Promise(function(_0x42dcf1,_0x52167d){return db[_0xff80('0x14')][_0xff80('0x21')]({'raw':_0x3521bc[_0xff80('0x17')]?_0x3521bc[_0xff80('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3521bc['options']?_0x3521bc['options']['where']||null:null,'attributes':_0x3521bc[_0xff80('0x17')]?_0x3521bc[_0xff80('0x17')][_0xff80('0x19')]||null:null,'include':_0x3521bc[_0xff80('0x17')]?_0x3521bc['options'][_0xff80('0x1b')]?_['map'](_0x3521bc[_0xff80('0x17')][_0xff80('0x1b')],function(_0x5939bb){return{'model':db[_0x5939bb[_0xff80('0x1c')]],'as':_0x5939bb['as'],'attributes':_0x5939bb['attributes'],'include':_0x5939bb['include']?_[_0xff80('0x1d')](_0x5939bb['include'],function(_0x1fa825){return{'model':db[_0x1fa825[_0xff80('0x1c')]],'as':_0x1fa825['as'],'attributes':_0x1fa825[_0xff80('0x19')],'include':_0x1fa825[_0xff80('0x1b')]?_[_0xff80('0x1d')](_0x1fa825[_0xff80('0x1b')],function(_0x184eac){return{'model':db[_0x184eac['model']],'as':_0x184eac['as'],'attributes':_0x184eac[_0xff80('0x19')]};}):[]};}):[]};}):[]:[]})[_0xff80('0x1e')](function(_0x2eb779){logger[_0xff80('0x1f')](_0xff80('0x20'),_0x3521bc);logger[_0xff80('0xc')]('ShowInterval',_0x3521bc,JSON[_0xff80('0xe')](_0x2eb779));_0x42dcf1(_0x2eb779);})[_0xff80('0x12')](function(_0x1aca1d){logger[_0xff80('0xf')]('ShowInterval',_0x1aca1d[_0xff80('0x10')],_0x3521bc);_0x52167d(_0x12bc75[_0xff80('0xf')](0x1f4,_0x1aca1d[_0xff80('0x10')]));});});}; \ No newline at end of file +var _0x1f15=['model','then','catch','ShowInterval','Interval','raw','info','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request\x20sent','debug','stringify','error','code','Interval,\x20%s,\x20%s','message','GetInterval','findAll','options','where','attributes','limit','include','map'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x1f15,0x10f));var _0x51f1=function(_0x35156b,_0x4f47e1){_0x35156b=_0x35156b-0x0;var _0x5e9bee=_0x1f15[_0x35156b];return _0x5e9bee;};'use strict';var _=require(_0x51f1('0x0'));var util=require('util');var moment=require(_0x51f1('0x1'));var BPromise=require(_0x51f1('0x2'));var rs=require(_0x51f1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x51f1('0x4'))['db'];var utils=require(_0x51f1('0x5'));var logger=require('../../config/logger')(_0x51f1('0x6'));var config=require(_0x51f1('0x7'));var jayson=require(_0x51f1('0x8'));var client=jayson[_0x51f1('0x9')][_0x51f1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa6b38f,_0x157f34,_0x55a3df){return new BPromise(function(_0x333c15,_0x33321c){return client['request'](_0xa6b38f,_0x55a3df)['then'](function(_0x2d0bdf){logger['info']('Interval,\x20%s,\x20%s',_0x157f34,_0x51f1('0xb'));logger[_0x51f1('0xc')]('Interval,\x20%s,\x20%s,\x20%s',_0x157f34,'request\x20sent',JSON[_0x51f1('0xd')](_0x2d0bdf));if(_0x2d0bdf[_0x51f1('0xe')]){if(_0x2d0bdf[_0x51f1('0xe')][_0x51f1('0xf')]===0x1f4){logger[_0x51f1('0xe')](_0x51f1('0x10'),_0x157f34,_0x2d0bdf[_0x51f1('0xe')]['message']);return _0x33321c(_0x2d0bdf[_0x51f1('0xe')][_0x51f1('0x11')]);}logger[_0x51f1('0xe')](_0x51f1('0x10'),_0x157f34,_0x2d0bdf[_0x51f1('0xe')][_0x51f1('0x11')]);return _0x333c15(_0x2d0bdf['error'][_0x51f1('0x11')]);}else{logger['info'](_0x51f1('0x10'),_0x157f34,_0x51f1('0xb'));_0x333c15(_0x2d0bdf['result'][_0x51f1('0x11')]);}})['catch'](function(_0x2813e1){logger[_0x51f1('0xe')]('Interval,\x20%s,\x20%s',_0x157f34,_0x2813e1);_0x33321c(_0x2813e1);});});}exports[_0x51f1('0x12')]=function(_0x5aa09a){var _0x210679=this;return new Promise(function(_0x14df7f,_0x4fbc39){return db['Interval'][_0x51f1('0x13')]({'raw':_0x5aa09a[_0x51f1('0x14')]?_0x5aa09a[_0x51f1('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x5aa09a[_0x51f1('0x14')]?_0x5aa09a[_0x51f1('0x14')][_0x51f1('0x15')]||null:null,'attributes':_0x5aa09a['options']?_0x5aa09a[_0x51f1('0x14')][_0x51f1('0x16')]||null:null,'limit':_0x5aa09a[_0x51f1('0x14')]?_0x5aa09a[_0x51f1('0x14')][_0x51f1('0x17')]||null:null,'include':_0x5aa09a[_0x51f1('0x14')]?_0x5aa09a[_0x51f1('0x14')][_0x51f1('0x18')]?_[_0x51f1('0x19')](_0x5aa09a[_0x51f1('0x14')]['include'],function(_0x416827){return{'model':db[_0x416827[_0x51f1('0x1a')]],'as':_0x416827['as'],'attributes':_0x416827[_0x51f1('0x16')],'include':_0x416827[_0x51f1('0x18')]?_['map'](_0x416827[_0x51f1('0x18')],function(_0x2ed0e2){return{'model':db[_0x2ed0e2[_0x51f1('0x1a')]],'as':_0x2ed0e2['as'],'attributes':_0x2ed0e2['attributes'],'include':_0x2ed0e2['include']?_[_0x51f1('0x19')](_0x2ed0e2[_0x51f1('0x18')],function(_0x424d3a){return{'model':db[_0x424d3a[_0x51f1('0x1a')]],'as':_0x424d3a['as'],'attributes':_0x424d3a[_0x51f1('0x16')]};}):[]};}):[]};}):[]:[]})[_0x51f1('0x1b')](function(_0x564a08){logger['info'](_0x51f1('0x12'),_0x5aa09a);logger[_0x51f1('0xc')](_0x51f1('0x12'),_0x5aa09a,JSON['stringify'](_0x564a08));_0x14df7f(_0x564a08);})[_0x51f1('0x1c')](function(_0x58c44c){logger['error'](_0x51f1('0x12'),_0x58c44c[_0x51f1('0x11')],_0x5aa09a);_0x4fbc39(_0x210679['error'](0x1f4,_0x58c44c['message']));});});};exports[_0x51f1('0x1d')]=function(_0x2ba711){var _0x402bd3=this;return new Promise(function(_0x2f18b5,_0x2f65e8){return db[_0x51f1('0x1e')]['find']({'raw':_0x2ba711[_0x51f1('0x14')]?_0x2ba711['options'][_0x51f1('0x1f')]===undefined?!![]:![]:!![],'where':_0x2ba711[_0x51f1('0x14')]?_0x2ba711[_0x51f1('0x14')][_0x51f1('0x15')]||null:null,'attributes':_0x2ba711[_0x51f1('0x14')]?_0x2ba711[_0x51f1('0x14')][_0x51f1('0x16')]||null:null,'include':_0x2ba711[_0x51f1('0x14')]?_0x2ba711[_0x51f1('0x14')][_0x51f1('0x18')]?_[_0x51f1('0x19')](_0x2ba711['options'][_0x51f1('0x18')],function(_0x45bd6a){return{'model':db[_0x45bd6a['model']],'as':_0x45bd6a['as'],'attributes':_0x45bd6a[_0x51f1('0x16')],'include':_0x45bd6a[_0x51f1('0x18')]?_['map'](_0x45bd6a['include'],function(_0x52b821){return{'model':db[_0x52b821['model']],'as':_0x52b821['as'],'attributes':_0x52b821[_0x51f1('0x16')],'include':_0x52b821['include']?_[_0x51f1('0x19')](_0x52b821[_0x51f1('0x18')],function(_0x484996){return{'model':db[_0x484996[_0x51f1('0x1a')]],'as':_0x484996['as'],'attributes':_0x484996[_0x51f1('0x16')]};}):[]};}):[]};}):[]:[]})[_0x51f1('0x1b')](function(_0x4778cd){logger[_0x51f1('0x20')]('ShowInterval',_0x2ba711);logger[_0x51f1('0xc')](_0x51f1('0x1d'),_0x2ba711,JSON[_0x51f1('0xd')](_0x4778cd));_0x2f18b5(_0x4778cd);})['catch'](function(_0x4f8a54){logger[_0x51f1('0xe')]('ShowInterval',_0x4f8a54['message'],_0x2ba711);_0x2f65e8(_0x402bd3['error'](0x1f4,_0x4f8a54[_0x51f1('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 1c42cfc..12789d2 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 _0x6157=['../../components/auth/service','./jira.controller','post','isAuthenticated','Router'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x6157,0xea));var _0x7615=function(_0x201839,_0x22b860){_0x201839=_0x201839-0x0;var _0x2f1a1b=_0x6157[_0x201839];return _0x2f1a1b;};'use strict';var express=require('express');var router=express[_0x7615('0x0')]();var auth=require(_0x7615('0x1'));var controller=require(_0x7615('0x2'));router[_0x7615('0x3')]('/',auth[_0x7615('0x4')](),controller['send']);module['exports']=router; \ No newline at end of file +var _0x21d1=['isAuthenticated','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x43f08b,_0x30c1d6){var _0x149b51=function(_0x425fa6){while(--_0x425fa6){_0x43f08b['push'](_0x43f08b['shift']());}};_0x149b51(++_0x30c1d6);}(_0x21d1,0x1c9));var _0x121d=function(_0x18446b,_0x15aa70){_0x18446b=_0x18446b-0x0;var _0x477b90=_0x21d1[_0x18446b];return _0x477b90;};'use strict';var express=require(_0x121d('0x0'));var router=express[_0x121d('0x1')]();var auth=require(_0x121d('0x2'));var controller=require(_0x121d('0x3'));router[_0x121d('0x4')]('/',auth[_0x121d('0x5')](),controller['send']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 201c596..79fdfc6 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 _0xbc42=['error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','email','fields','oldToken','customfield_11502','customfield_11503','customfield_11504','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','base64','request','setEncoding','data','end','status','statusCode','json','parse'];(function(_0x2ee0ab,_0x4142a4){var _0x572da1=function(_0x3ea56a){while(--_0x3ea56a){_0x2ee0ab['push'](_0x2ee0ab['shift']());}};_0x572da1(++_0x4142a4);}(_0xbc42,0x119));var _0x2bc4=function(_0x1d6fac,_0x5b806b){_0x1d6fac=_0x1d6fac-0x0;var _0x2cd4f6=_0xbc42[_0x1d6fac];return _0x2cd4f6;};'use strict';var BPromise=require(_0x2bc4('0x0'));var https=require(_0x2bc4('0x1'));var logger=require(_0x2bc4('0x2'))('api');var USERNAME='support';var PASSWORD=_0x2bc4('0x3');function openIssue(_0x9ccb1d,_0x44bbc0){var _0x7671={'fields':{'project':{'key':_0x9ccb1d[_0x2bc4('0x4')]||_0x2bc4('0x5')},'summary':(_0x9ccb1d[_0x2bc4('0x6')]||_0x2bc4('0x7'))+_0x2bc4('0x8')+_0x9ccb1d['ip'],'description':_0x9ccb1d[_0x2bc4('0x9')]||JSON[_0x2bc4('0xa')](_0x9ccb1d),'issuetype':{'name':_0x9ccb1d[_0x2bc4('0xb')]||_0x2bc4('0xc')}}};_0x7671['fields']['customfield_11500']=_0x9ccb1d[_0x2bc4('0xd')];_0x7671[_0x2bc4('0xe')]['customfield_11501']=_0x9ccb1d[_0x2bc4('0xf')];_0x7671[_0x2bc4('0xe')][_0x2bc4('0x10')]=_0x9ccb1d['newToken'];_0x7671[_0x2bc4('0xe')][_0x2bc4('0x11')]=_0x9ccb1d['name'];_0x7671[_0x2bc4('0xe')][_0x2bc4('0x12')]=_0x9ccb1d['reason'];_0x7671[_0x2bc4('0xe')][_0x2bc4('0x13')]=_0x9ccb1d['ip'];var _0x8e7df6={'host':_0x2bc4('0x14'),'port':0x1bb,'path':_0x2bc4('0x15'),'method':_0x2bc4('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0x2bc4('0x17'),'Authorization':_0x2bc4('0x18')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x2bc4('0x19'))}};var _0x14bc1c=JSON[_0x2bc4('0xa')](_0x7671);var _0x1b7ad6=https[_0x2bc4('0x1a')](_0x8e7df6,function(_0x5da6b7){_0x5da6b7[_0x2bc4('0x1b')]('utf8');var _0xb53406='';_0x5da6b7['on'](_0x2bc4('0x1c'),function(_0x1c8135){_0xb53406+=_0x1c8135;});_0x5da6b7['on'](_0x2bc4('0x1d'),function(){if(_0x44bbc0){return _0x44bbc0[_0x2bc4('0x1e')](_0x5da6b7[_0x2bc4('0x1f')])[_0x2bc4('0x20')](JSON[_0x2bc4('0x21')](_0xb53406));}});});_0x1b7ad6['on'](_0x2bc4('0x22'),function(_0xd61d10){if(_0x44bbc0){return _0x44bbc0['status'](0x1f4)[_0x2bc4('0x20')]({'errors':[{'message':_0x2bc4('0x23'),'type':_0x2bc4('0x24')}]});}});_0x1b7ad6[_0x2bc4('0x25')](_0x14bc1c);_0x1b7ad6[_0x2bc4('0x1d')]();}exports['openIssue']=openIssue;exports[_0x2bc4('0x26')]=function(_0x5ecf7d,_0x49a5c9){_0x5ecf7d[_0x2bc4('0x27')]['ip']=_0x5ecf7d[_0x2bc4('0x28')][_0x2bc4('0x29')]||_0x5ecf7d[_0x2bc4('0x2a')][_0x2bc4('0x2b')]||_0x5ecf7d[_0x2bc4('0x2c')][_0x2bc4('0x2b')]||_0x5ecf7d[_0x2bc4('0x2a')][_0x2bc4('0x2c')]['remoteAddress'];return openIssue(_0x5ecf7d[_0x2bc4('0x27')],_0x49a5c9);}; \ No newline at end of file +var _0x130e=['status','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','../../config/logger','api','3eAmWpBVP0','key','Report','\x20from\x20','description','issuetype','Bug','fields','customfield_11500','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','toString','stringify','request','setEncoding','utf8','data','end','json','parse','error'];(function(_0xc0213d,_0x4a3b1d){var _0x1a93c4=function(_0xc683f3){while(--_0xc683f3){_0xc0213d['push'](_0xc0213d['shift']());}};_0x1a93c4(++_0x4a3b1d);}(_0x130e,0x93));var _0xe130=function(_0x1ace72,_0x274a09){_0x1ace72=_0x1ace72-0x0;var _0x38e16e=_0x130e[_0x1ace72];return _0x38e16e;};'use strict';var BPromise=require(_0xe130('0x0'));var https=require('https');var logger=require(_0xe130('0x1'))(_0xe130('0x2'));var USERNAME='support';var PASSWORD=_0xe130('0x3');function openIssue(_0x35eda3,_0x358c42){var _0x1c20e1={'fields':{'project':{'key':_0x35eda3[_0xe130('0x4')]||'MOTGUI'},'summary':(_0x35eda3['summary']||_0xe130('0x5'))+_0xe130('0x6')+_0x35eda3['ip'],'description':_0x35eda3[_0xe130('0x7')]||JSON['stringify'](_0x35eda3),'issuetype':{'name':_0x35eda3[_0xe130('0x8')]||_0xe130('0x9')}}};_0x1c20e1[_0xe130('0xa')][_0xe130('0xb')]=_0x35eda3['email'];_0x1c20e1[_0xe130('0xa')]['customfield_11501']=_0x35eda3[_0xe130('0xc')];_0x1c20e1[_0xe130('0xa')][_0xe130('0xd')]=_0x35eda3[_0xe130('0xe')];_0x1c20e1['fields'][_0xe130('0xf')]=_0x35eda3[_0xe130('0x10')];_0x1c20e1['fields'][_0xe130('0x11')]=_0x35eda3['reason'];_0x1c20e1[_0xe130('0xa')][_0xe130('0x12')]=_0x35eda3['ip'];var _0x355b9a={'host':_0xe130('0x13'),'port':0x1bb,'path':_0xe130('0x14'),'method':_0xe130('0x15'),'timeout':0x4e20,'headers':{'Content-Type':_0xe130('0x16'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0xe130('0x17')]('base64')}};var _0x170aed=JSON[_0xe130('0x18')](_0x1c20e1);var _0x1734df=https[_0xe130('0x19')](_0x355b9a,function(_0x4219b2){_0x4219b2[_0xe130('0x1a')](_0xe130('0x1b'));var _0x12072a='';_0x4219b2['on'](_0xe130('0x1c'),function(_0x3459a1){_0x12072a+=_0x3459a1;});_0x4219b2['on'](_0xe130('0x1d'),function(){if(_0x358c42){return _0x358c42['status'](_0x4219b2['statusCode'])[_0xe130('0x1e')](JSON[_0xe130('0x1f')](_0x12072a));}});});_0x1734df['on'](_0xe130('0x20'),function(_0xc872b9){if(_0x358c42){return _0x358c42[_0xe130('0x21')](0x1f4)[_0xe130('0x1e')]({'errors':[{'message':_0xe130('0x22'),'type':_0xe130('0x23')}]});}});_0x1734df[_0xe130('0x24')](_0x170aed);_0x1734df['end']();}exports[_0xe130('0x25')]=openIssue;exports[_0xe130('0x26')]=function(_0x1590d5,_0x17641b){_0x1590d5[_0xe130('0x27')]['ip']=_0x1590d5[_0xe130('0x28')][_0xe130('0x29')]||_0x1590d5[_0xe130('0x2a')][_0xe130('0x2b')]||_0x1590d5[_0xe130('0x2c')][_0xe130('0x2b')]||_0x1590d5[_0xe130('0x2a')][_0xe130('0x2c')][_0xe130('0x2b')];return openIssue(_0x1590d5[_0xe130('0x27')],_0x17641b);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index a171788..ac81224 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 _0x803a=['./jscriptyAnswerReport.controller','index','get','isAuthenticated','describe','/:id','show','put','update','delete','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x25adbb,_0x18fe04){var _0x2826d0=function(_0x125738){while(--_0x125738){_0x25adbb['push'](_0x25adbb['shift']());}};_0x2826d0(++_0x18fe04);}(_0x803a,0x13b));var _0xa803=function(_0x1ef1f2,_0x40743e){_0x1ef1f2=_0x1ef1f2-0x0;var _0x1f33be=_0x803a[_0x1ef1f2];return _0x1f33be;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xa803('0x0'));var express=require(_0xa803('0x1'));var router=express[_0xa803('0x2')]();var auth=require(_0xa803('0x3'));var interaction=require(_0xa803('0x4'));var config=require('../../config/environment');var controller=require(_0xa803('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xa803('0x6')]);router[_0xa803('0x7')]('/describe',auth[_0xa803('0x8')](),controller[_0xa803('0x9')]);router['get'](_0xa803('0xa'),auth[_0xa803('0x8')](),controller[_0xa803('0xb')]);router['post']('/',auth[_0xa803('0x8')](),controller['create']);router[_0xa803('0xc')](_0xa803('0xa'),auth['isAuthenticated'](),controller[_0xa803('0xd')]);router[_0xa803('0xe')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xa803('0xf')]=router; \ No newline at end of file +var _0xcc60=['describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','isAuthenticated','index','get','/describe'];(function(_0x1618c4,_0x360999){var _0x14719d=function(_0x57bae4){while(--_0x57bae4){_0x1618c4['push'](_0x1618c4['shift']());}};_0x14719d(++_0x360999);}(_0xcc60,0x186));var _0x0cc6=function(_0x5b0f07,_0x2ad42c){_0x5b0f07=_0x5b0f07-0x0;var _0x59e162=_0xcc60[_0x5b0f07];return _0x59e162;};'use strict';var multer=require(_0x0cc6('0x0'));var util=require(_0x0cc6('0x1'));var path=require(_0x0cc6('0x2'));var timeout=require('connect-timeout');var express=require(_0x0cc6('0x3'));var router=express[_0x0cc6('0x4')]();var auth=require(_0x0cc6('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./jscriptyAnswerReport.controller');router['get']('/',auth[_0x0cc6('0x6')](),controller[_0x0cc6('0x7')]);router[_0x0cc6('0x8')](_0x0cc6('0x9'),auth['isAuthenticated'](),controller[_0x0cc6('0xa')]);router[_0x0cc6('0x8')](_0x0cc6('0xb'),auth['isAuthenticated'](),controller[_0x0cc6('0xc')]);router[_0x0cc6('0xd')]('/',auth['isAuthenticated'](),controller[_0x0cc6('0xe')]);router[_0x0cc6('0xf')]('/:id',auth[_0x0cc6('0x6')](),controller[_0x0cc6('0x10')]);router[_0x0cc6('0x11')](_0x0cc6('0xb'),auth[_0x0cc6('0x6')](),controller[_0x0cc6('0x12')]);module[_0x0cc6('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 960425f..4a042fb 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 _0x904c=['TEXT','sequelize','exports','STRING'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x904c,0x131));var _0xc904=function(_0x3f0c09,_0x41d069){_0x3f0c09=_0x3f0c09-0x0;var _0x339eda=_0x904c[_0x3f0c09];return _0x339eda;};'use strict';var Sequelize=require(_0xc904('0x0'));module[_0xc904('0x1')]={'question':{'type':Sequelize[_0xc904('0x2')]},'answer':{'type':Sequelize[_0xc904('0x3')]('long')},'membername':{'type':Sequelize[_0xc904('0x2')]},'projectname':{'type':Sequelize[_0xc904('0x2')]},'queue':{'type':Sequelize[_0xc904('0x2')]},'uniqueid':{'type':Sequelize[_0xc904('0x2')]},'calleridname':{'type':Sequelize[_0xc904('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x153e=['TEXT','long','sequelize','STRING'];(function(_0x19369b,_0x3de510){var _0x569e39=function(_0x109a66){while(--_0x109a66){_0x19369b['push'](_0x19369b['shift']());}};_0x569e39(++_0x3de510);}(_0x153e,0xf2));var _0xe153=function(_0x152fe3,_0x12b0c8){_0x152fe3=_0x152fe3-0x0;var _0xc5bb39=_0x153e[_0x152fe3];return _0xc5bb39;};'use strict';var Sequelize=require(_0xe153('0x0'));module['exports']={'question':{'type':Sequelize[_0xe153('0x1')]},'answer':{'type':Sequelize[_0xe153('0x2')](_0xe153('0x3'))},'membername':{'type':Sequelize[_0xe153('0x1')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xe153('0x1')]},'calleridnum':{'type':Sequelize[_0xe153('0x1')]},'questionId':{'type':Sequelize[_0xe153('0x1')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 8b26981..77820a6 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 _0xea2b=['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/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','map','JscriptyAnswerReport','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','then','includeAll','findAll','rows','catch','params','rawAttributes','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment'];(function(_0x16967c,_0xd556cd){var _0x35a680=function(_0x294f53){while(--_0x294f53){_0x16967c['push'](_0x16967c['shift']());}};_0x35a680(++_0xd556cd);}(_0xea2b,0xdc));var _0xbea2=function(_0x6face9,_0xba6b95){_0x6face9=_0x6face9-0x0;var _0x563155=_0xea2b[_0x6face9];return _0x563155;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbea2('0x0'));var rimraf=require(_0xbea2('0x1'));var zipdir=require(_0xbea2('0x2'));var jsonpatch=require(_0xbea2('0x3'));var rp=require('request-promise');var moment=require(_0xbea2('0x4'));var BPromise=require(_0xbea2('0x5'));var Mustache=require(_0xbea2('0x6'));var util=require(_0xbea2('0x7'));var path=require(_0xbea2('0x8'));var sox=require(_0xbea2('0x9'));var csv=require(_0xbea2('0xa'));var ejs=require(_0xbea2('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xbea2('0xc'));var jsforce=require(_0xbea2('0xd'));var deskjs=require(_0xbea2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbea2('0xf'));var Papa=require(_0xbea2('0x10'));var Redis=require(_0xbea2('0x11'));var authService=require(_0xbea2('0x12'));var qs=require(_0xbea2('0x13'));var as=require(_0xbea2('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbea2('0x15'))(_0xbea2('0x16'));var utils=require(_0xbea2('0x17'));var config=require('../../config/environment');var db=require(_0xbea2('0x18'))['db'];function respondWithStatusCode(_0x271141,_0x11472c){_0x11472c=_0x11472c||0xcc;return function(_0x1aedb9){if(_0x1aedb9){return _0x271141[_0xbea2('0x19')](_0x11472c);}return _0x271141[_0xbea2('0x1a')](_0x11472c)[_0xbea2('0x1b')]();};}function respondWithResult(_0x3b0266,_0x485fc4){_0x485fc4=_0x485fc4||0xc8;return function(_0x3d54f3){if(_0x3d54f3){return _0x3b0266[_0xbea2('0x1a')](_0x485fc4)['json'](_0x3d54f3);}};}function respondWithFilteredResult(_0x463b16,_0x16a88d){return function(_0x17b6d6){if(_0x17b6d6){var _0x127a53=_0x17b6d6[_0xbea2('0x1c')],_0x4f6b9c=_0x16a88d[_0xbea2('0x1d')],_0xd85473=_0x16a88d[_0xbea2('0x1d')]+_0x16a88d[_0xbea2('0x1e')],_0x4348ca;if(_0xd85473>=_0x127a53){_0xd85473=_0x127a53;_0x4348ca=0xc8;}else{_0x4348ca=0xce;}_0x463b16[_0xbea2('0x1a')](_0x4348ca);return _0x463b16[_0xbea2('0x1f')](_0xbea2('0x20'),_0x4f6b9c+'-'+_0xd85473+'/'+_0x127a53)['json'](_0x17b6d6);}return null;};}function patchUpdates(_0x47c5fe){return function(_0x59efa8){try{jsonpatch[_0xbea2('0x21')](_0x59efa8,_0x47c5fe,!![]);}catch(_0x55a029){return BPromise[_0xbea2('0x22')](_0x55a029);}return _0x59efa8[_0xbea2('0x23')]();};}function saveUpdates(_0x3ce35d,_0x317d11){return function(_0x15b690){if(_0x15b690){return _0x15b690[_0xbea2('0x24')](_0x3ce35d)['then'](function(_0x39fe7b){return _0x39fe7b;});}return null;};}function removeEntity(_0x565d6a,_0x327bd9){return function(_0x3126c6){if(_0x3126c6){return _0x3126c6[_0xbea2('0x25')]()['then'](function(){_0x565d6a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x31643d,_0x1dc3d5){return function(_0x7e02a5){if(!_0x7e02a5){_0x31643d['sendStatus'](0x194);}return _0x7e02a5;};}function handleError(_0x1f2214,_0xe64a68){_0xe64a68=_0xe64a68||0x1f4;return function(_0x114e7d){logger[_0xbea2('0x26')](_0x114e7d[_0xbea2('0x27')]);if(_0x114e7d[_0xbea2('0x28')]){delete _0x114e7d[_0xbea2('0x28')];}_0x1f2214[_0xbea2('0x1a')](_0xe64a68)[_0xbea2('0x29')](_0x114e7d);};}exports[_0xbea2('0x2a')]=function(_0x9c51c0,_0x1bdec0){var _0x568999={},_0x217833={},_0x426f97={'count':0x0,'rows':[]};var _0x55f523=_[_0xbea2('0x2b')](db[_0xbea2('0x2c')]['rawAttributes'],function(_0x247350){return{'name':_0x247350[_0xbea2('0x2d')],'type':_0x247350[_0xbea2('0x2e')]['key']};});_0x217833[_0xbea2('0x2f')]=_[_0xbea2('0x2b')](_0x55f523,_0xbea2('0x28'));_0x217833[_0xbea2('0x30')]=_['keys'](_0x9c51c0['query']);_0x217833[_0xbea2('0x31')]=_[_0xbea2('0x32')](_0x217833[_0xbea2('0x2f')],_0x217833['query']);_0x568999[_0xbea2('0x33')]=_[_0xbea2('0x32')](_0x217833['model'],qs[_0xbea2('0x34')](_0x9c51c0[_0xbea2('0x30')][_0xbea2('0x34')]));_0x568999[_0xbea2('0x33')]=_0x568999['attributes'][_0xbea2('0x35')]?_0x568999[_0xbea2('0x33')]:_0x217833['model'];if(!_0x9c51c0['query'][_0xbea2('0x36')](_0xbea2('0x37'))){_0x568999[_0xbea2('0x1e')]=qs[_0xbea2('0x1e')](_0x9c51c0[_0xbea2('0x30')]['limit']);_0x568999[_0xbea2('0x1d')]=qs[_0xbea2('0x1d')](_0x9c51c0['query'][_0xbea2('0x1d')]);}_0x568999['order']=qs[_0xbea2('0x38')](_0x9c51c0['query'][_0xbea2('0x38')]);_0x568999[_0xbea2('0x39')]=qs[_0xbea2('0x31')](_[_0xbea2('0x3a')](_0x9c51c0['query'],_0x217833[_0xbea2('0x31')]),_0x55f523);if(_0x9c51c0[_0xbea2('0x30')][_0xbea2('0x3b')]){_0x568999['where']=_[_0xbea2('0x3c')](_0x568999[_0xbea2('0x39')],{'$or':_['map'](_0x55f523,function(_0x87dfe){if(_0x87dfe[_0xbea2('0x2e')]!==_0xbea2('0x3d')){var _0x458b15={};_0x458b15[_0x87dfe[_0xbea2('0x28')]]={'$like':'%'+_0x9c51c0[_0xbea2('0x30')]['filter']+'%'};return _0x458b15;}})});}_0x568999=_['merge']({},_0x568999,_0x9c51c0['options']);var _0x3b8e20={'where':_0x568999[_0xbea2('0x39')]};return db[_0xbea2('0x2c')][_0xbea2('0x1c')](_0x3b8e20)[_0xbea2('0x3e')](function(_0x8781a0){_0x426f97['count']=_0x8781a0;if(_0x9c51c0[_0xbea2('0x30')][_0xbea2('0x3f')]){_0x568999['include']=[{'all':!![]}];}return db[_0xbea2('0x2c')][_0xbea2('0x40')](_0x568999);})[_0xbea2('0x3e')](function(_0x535046){_0x426f97[_0xbea2('0x41')]=_0x535046;return _0x426f97;})['then'](respondWithFilteredResult(_0x1bdec0,_0x568999))[_0xbea2('0x42')](handleError(_0x1bdec0,null));};exports['show']=function(_0x8fad0d,_0x214f7){var _0x218eaf={'raw':!![],'where':{'id':_0x8fad0d[_0xbea2('0x43')]['id']}},_0x4ee594={};_0x4ee594[_0xbea2('0x2f')]=_['keys'](db[_0xbea2('0x2c')][_0xbea2('0x44')]);_0x4ee594['query']=_[_0xbea2('0x45')](_0x8fad0d[_0xbea2('0x30')]);_0x4ee594['filters']=_[_0xbea2('0x32')](_0x4ee594[_0xbea2('0x2f')],_0x4ee594[_0xbea2('0x30')]);_0x218eaf[_0xbea2('0x33')]=_[_0xbea2('0x32')](_0x4ee594[_0xbea2('0x2f')],qs[_0xbea2('0x34')](_0x8fad0d[_0xbea2('0x30')][_0xbea2('0x34')]));_0x218eaf['attributes']=_0x218eaf[_0xbea2('0x33')]['length']?_0x218eaf['attributes']:_0x4ee594[_0xbea2('0x2f')];if(_0x8fad0d[_0xbea2('0x30')][_0xbea2('0x3f')]){_0x218eaf[_0xbea2('0x46')]=[{'all':!![]}];}_0x218eaf=_[_0xbea2('0x3c')]({},_0x218eaf,_0x8fad0d['options']);return db['JscriptyAnswerReport'][_0xbea2('0x47')](_0x218eaf)[_0xbea2('0x3e')](handleEntityNotFound(_0x214f7,null))[_0xbea2('0x3e')](respondWithResult(_0x214f7,null))[_0xbea2('0x42')](handleError(_0x214f7,null));};exports[_0xbea2('0x48')]=function(_0x34dc4d,_0x320ee3){return db['JscriptyAnswerReport'][_0xbea2('0x48')](_0x34dc4d['body'],{})[_0xbea2('0x3e')](respondWithResult(_0x320ee3,0xc9))[_0xbea2('0x42')](handleError(_0x320ee3,null));};exports['update']=function(_0x4dd153,_0x13bc5b){if(_0x4dd153[_0xbea2('0x49')]['id']){delete _0x4dd153[_0xbea2('0x49')]['id'];}return db[_0xbea2('0x2c')][_0xbea2('0x47')]({'where':{'id':_0x4dd153[_0xbea2('0x43')]['id']}})[_0xbea2('0x3e')](handleEntityNotFound(_0x13bc5b,null))[_0xbea2('0x3e')](saveUpdates(_0x4dd153[_0xbea2('0x49')],null))[_0xbea2('0x3e')](respondWithResult(_0x13bc5b,null))[_0xbea2('0x42')](handleError(_0x13bc5b,null));};exports[_0xbea2('0x25')]=function(_0x34836a,_0xebb7e1){return db[_0xbea2('0x2c')][_0xbea2('0x47')]({'where':{'id':_0x34836a[_0xbea2('0x43')]['id']}})[_0xbea2('0x3e')](handleEntityNotFound(_0xebb7e1,null))[_0xbea2('0x3e')](removeEntity(_0xebb7e1,null))[_0xbea2('0x42')](handleError(_0xebb7e1,null));};exports[_0xbea2('0x4a')]=function(_0x4d73f8,_0x3a389c){return db['JscriptyAnswerReport']['describe']()[_0xbea2('0x3e')](respondWithResult(_0x3a389c,null))[_0xbea2('0x42')](handleError(_0x3a389c,null));}; \ No newline at end of file +var _0xa4c0=['../../config/environment','../../mysqldb','end','status','count','offset','limit','set','Content-Range','json','apply','reject','destroy','then','sendStatus','error','stack','name','send','JscriptyAnswerReport','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','VIRTUAL','includeAll','rows','catch','show','params','rawAttributes','find','create','body','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils'];(function(_0x3fc68e,_0x47556b){var _0x1ae6a1=function(_0x452e66){while(--_0x452e66){_0x3fc68e['push'](_0x3fc68e['shift']());}};_0x1ae6a1(++_0x47556b);}(_0xa4c0,0x77));var _0x0a4c=function(_0x3161b1,_0x54b542){_0x3161b1=_0x3161b1-0x0;var _0x13f1b9=_0xa4c0[_0x3161b1];return _0x13f1b9;};'use strict';var pdf=require(_0x0a4c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0a4c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0a4c('0x2'));var rp=require(_0x0a4c('0x3'));var moment=require(_0x0a4c('0x4'));var BPromise=require(_0x0a4c('0x5'));var Mustache=require(_0x0a4c('0x6'));var util=require(_0x0a4c('0x7'));var path=require(_0x0a4c('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0a4c('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0a4c('0xa'));var jsforce=require(_0x0a4c('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0a4c('0xc'));var querystring=require(_0x0a4c('0xd'));var Papa=require(_0x0a4c('0xe'));var Redis=require(_0x0a4c('0xf'));var authService=require(_0x0a4c('0x10'));var qs=require(_0x0a4c('0x11'));var as=require(_0x0a4c('0x12'));var hardwareService=require(_0x0a4c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x0a4c('0x14'));var config=require(_0x0a4c('0x15'));var db=require(_0x0a4c('0x16'))['db'];function respondWithStatusCode(_0x24a61e,_0x4cd79c){_0x4cd79c=_0x4cd79c||0xcc;return function(_0x1091cb){if(_0x1091cb){return _0x24a61e['sendStatus'](_0x4cd79c);}return _0x24a61e['status'](_0x4cd79c)[_0x0a4c('0x17')]();};}function respondWithResult(_0x2cf831,_0x13130f){_0x13130f=_0x13130f||0xc8;return function(_0x3fcfc3){if(_0x3fcfc3){return _0x2cf831[_0x0a4c('0x18')](_0x13130f)['json'](_0x3fcfc3);}};}function respondWithFilteredResult(_0x12b2f9,_0x597b4){return function(_0x5836c5){if(_0x5836c5){var _0x3c5ac7=_0x5836c5[_0x0a4c('0x19')],_0x522572=_0x597b4[_0x0a4c('0x1a')],_0x2ba644=_0x597b4[_0x0a4c('0x1a')]+_0x597b4[_0x0a4c('0x1b')],_0x5e0654;if(_0x2ba644>=_0x3c5ac7){_0x2ba644=_0x3c5ac7;_0x5e0654=0xc8;}else{_0x5e0654=0xce;}_0x12b2f9[_0x0a4c('0x18')](_0x5e0654);return _0x12b2f9[_0x0a4c('0x1c')](_0x0a4c('0x1d'),_0x522572+'-'+_0x2ba644+'/'+_0x3c5ac7)[_0x0a4c('0x1e')](_0x5836c5);}return null;};}function patchUpdates(_0x6cba6d){return function(_0x3ad157){try{jsonpatch[_0x0a4c('0x1f')](_0x3ad157,_0x6cba6d,!![]);}catch(_0x4199ae){return BPromise[_0x0a4c('0x20')](_0x4199ae);}return _0x3ad157['save']();};}function saveUpdates(_0x1c6df7,_0x291737){return function(_0x4381c7){if(_0x4381c7){return _0x4381c7['update'](_0x1c6df7)['then'](function(_0x31b398){return _0x31b398;});}return null;};}function removeEntity(_0x245b90,_0x39937){return function(_0x5304df){if(_0x5304df){return _0x5304df[_0x0a4c('0x21')]()[_0x0a4c('0x22')](function(){_0x245b90['status'](0xcc)[_0x0a4c('0x17')]();});}};}function handleEntityNotFound(_0x3d3b34,_0x5a2824){return function(_0x2854b2){if(!_0x2854b2){_0x3d3b34[_0x0a4c('0x23')](0x194);}return _0x2854b2;};}function handleError(_0x42dfc0,_0x4cbfb8){_0x4cbfb8=_0x4cbfb8||0x1f4;return function(_0x34c30e){logger[_0x0a4c('0x24')](_0x34c30e[_0x0a4c('0x25')]);if(_0x34c30e[_0x0a4c('0x26')]){delete _0x34c30e[_0x0a4c('0x26')];}_0x42dfc0[_0x0a4c('0x18')](_0x4cbfb8)[_0x0a4c('0x27')](_0x34c30e);};}exports['index']=function(_0x17201f,_0x1b7137){var _0x1fb19f={},_0x16e528={},_0x2889af={'count':0x0,'rows':[]};var _0x4bd00d=_['map'](db[_0x0a4c('0x28')]['rawAttributes'],function(_0x55682d){return{'name':_0x55682d['fieldName'],'type':_0x55682d[_0x0a4c('0x29')][_0x0a4c('0x2a')]};});_0x16e528[_0x0a4c('0x2b')]=_['map'](_0x4bd00d,_0x0a4c('0x26'));_0x16e528[_0x0a4c('0x2c')]=_[_0x0a4c('0x2d')](_0x17201f['query']);_0x16e528[_0x0a4c('0x2e')]=_[_0x0a4c('0x2f')](_0x16e528[_0x0a4c('0x2b')],_0x16e528[_0x0a4c('0x2c')]);_0x1fb19f[_0x0a4c('0x30')]=_[_0x0a4c('0x2f')](_0x16e528[_0x0a4c('0x2b')],qs[_0x0a4c('0x31')](_0x17201f[_0x0a4c('0x2c')][_0x0a4c('0x31')]));_0x1fb19f['attributes']=_0x1fb19f[_0x0a4c('0x30')][_0x0a4c('0x32')]?_0x1fb19f['attributes']:_0x16e528[_0x0a4c('0x2b')];if(!_0x17201f['query'][_0x0a4c('0x33')](_0x0a4c('0x34'))){_0x1fb19f[_0x0a4c('0x1b')]=qs['limit'](_0x17201f['query'][_0x0a4c('0x1b')]);_0x1fb19f[_0x0a4c('0x1a')]=qs[_0x0a4c('0x1a')](_0x17201f[_0x0a4c('0x2c')]['offset']);}_0x1fb19f[_0x0a4c('0x35')]=qs[_0x0a4c('0x36')](_0x17201f[_0x0a4c('0x2c')][_0x0a4c('0x36')]);_0x1fb19f[_0x0a4c('0x37')]=qs[_0x0a4c('0x2e')](_[_0x0a4c('0x38')](_0x17201f[_0x0a4c('0x2c')],_0x16e528[_0x0a4c('0x2e')]),_0x4bd00d);if(_0x17201f['query']['filter']){_0x1fb19f['where']=_[_0x0a4c('0x39')](_0x1fb19f[_0x0a4c('0x37')],{'$or':_[_0x0a4c('0x3a')](_0x4bd00d,function(_0x4b75c9){if(_0x4b75c9['type']!==_0x0a4c('0x3b')){var _0x2fb7d6={};_0x2fb7d6[_0x4b75c9[_0x0a4c('0x26')]]={'$like':'%'+_0x17201f['query']['filter']+'%'};return _0x2fb7d6;}})});}_0x1fb19f=_['merge']({},_0x1fb19f,_0x17201f['options']);var _0x4615ac={'where':_0x1fb19f[_0x0a4c('0x37')]};return db[_0x0a4c('0x28')][_0x0a4c('0x19')](_0x4615ac)['then'](function(_0xc479cd){_0x2889af[_0x0a4c('0x19')]=_0xc479cd;if(_0x17201f[_0x0a4c('0x2c')][_0x0a4c('0x3c')]){_0x1fb19f['include']=[{'all':!![]}];}return db[_0x0a4c('0x28')]['findAll'](_0x1fb19f);})['then'](function(_0x7a4958){_0x2889af[_0x0a4c('0x3d')]=_0x7a4958;return _0x2889af;})[_0x0a4c('0x22')](respondWithFilteredResult(_0x1b7137,_0x1fb19f))[_0x0a4c('0x3e')](handleError(_0x1b7137,null));};exports[_0x0a4c('0x3f')]=function(_0x4a97c1,_0x342386){var _0x3d87a1={'raw':!![],'where':{'id':_0x4a97c1[_0x0a4c('0x40')]['id']}},_0x38ba1d={};_0x38ba1d[_0x0a4c('0x2b')]=_[_0x0a4c('0x2d')](db['JscriptyAnswerReport'][_0x0a4c('0x41')]);_0x38ba1d[_0x0a4c('0x2c')]=_[_0x0a4c('0x2d')](_0x4a97c1[_0x0a4c('0x2c')]);_0x38ba1d['filters']=_[_0x0a4c('0x2f')](_0x38ba1d[_0x0a4c('0x2b')],_0x38ba1d[_0x0a4c('0x2c')]);_0x3d87a1[_0x0a4c('0x30')]=_['intersection'](_0x38ba1d[_0x0a4c('0x2b')],qs[_0x0a4c('0x31')](_0x4a97c1[_0x0a4c('0x2c')][_0x0a4c('0x31')]));_0x3d87a1[_0x0a4c('0x30')]=_0x3d87a1[_0x0a4c('0x30')][_0x0a4c('0x32')]?_0x3d87a1[_0x0a4c('0x30')]:_0x38ba1d['model'];if(_0x4a97c1[_0x0a4c('0x2c')][_0x0a4c('0x3c')]){_0x3d87a1['include']=[{'all':!![]}];}_0x3d87a1=_[_0x0a4c('0x39')]({},_0x3d87a1,_0x4a97c1['options']);return db[_0x0a4c('0x28')][_0x0a4c('0x42')](_0x3d87a1)['then'](handleEntityNotFound(_0x342386,null))['then'](respondWithResult(_0x342386,null))[_0x0a4c('0x3e')](handleError(_0x342386,null));};exports[_0x0a4c('0x43')]=function(_0x36f55d,_0x4db147){return db[_0x0a4c('0x28')][_0x0a4c('0x43')](_0x36f55d[_0x0a4c('0x44')],{})[_0x0a4c('0x22')](respondWithResult(_0x4db147,0xc9))['catch'](handleError(_0x4db147,null));};exports['update']=function(_0x1fbd28,_0x2170c7){if(_0x1fbd28['body']['id']){delete _0x1fbd28[_0x0a4c('0x44')]['id'];}return db['JscriptyAnswerReport'][_0x0a4c('0x42')]({'where':{'id':_0x1fbd28[_0x0a4c('0x40')]['id']}})[_0x0a4c('0x22')](handleEntityNotFound(_0x2170c7,null))[_0x0a4c('0x22')](saveUpdates(_0x1fbd28['body'],null))[_0x0a4c('0x22')](respondWithResult(_0x2170c7,null))[_0x0a4c('0x3e')](handleError(_0x2170c7,null));};exports['destroy']=function(_0x7992d0,_0x1a52ea){return db[_0x0a4c('0x28')][_0x0a4c('0x42')]({'where':{'id':_0x7992d0[_0x0a4c('0x40')]['id']}})[_0x0a4c('0x22')](handleEntityNotFound(_0x1a52ea,null))[_0x0a4c('0x22')](removeEntity(_0x1a52ea,null))[_0x0a4c('0x3e')](handleError(_0x1a52ea,null));};exports['describe']=function(_0x865044,_0x360636){return db[_0x0a4c('0x28')][_0x0a4c('0x45')]()[_0x0a4c('0x22')](respondWithResult(_0x360636,null))['catch'](handleError(_0x360636,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 1fa3df3..20dc5f8 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 _0x727f=['JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./jscriptyAnswerReport.attributes','define'];(function(_0x51c72c,_0x2f787e){var _0xd28f2d=function(_0x3b1500){while(--_0x3b1500){_0x51c72c['push'](_0x51c72c['shift']());}};_0xd28f2d(++_0x2f787e);}(_0x727f,0x1b2));var _0xf727=function(_0x37e899,_0x36a067){_0x37e899=_0x37e899-0x0;var _0x916440=_0x727f[_0x37e899];return _0x916440;};'use strict';var _=require(_0xf727('0x0'));var util=require(_0xf727('0x1'));var logger=require(_0xf727('0x2'))(_0xf727('0x3'));var moment=require(_0xf727('0x4'));var BPromise=require(_0xf727('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf727('0x6'));var rimraf=require(_0xf727('0x7'));var config=require('../../config/environment');var attributes=require(_0xf727('0x8'));module['exports']=function(_0x3339b4,_0x20b377){return _0x3339b4[_0xf727('0x9')](_0xf727('0xa'),attributes,{'tableName':_0xf727('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd6fc=['../../config/environment','./jscriptyAnswerReport.attributes','lodash','util','../../config/logger','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd6fc,0x1ca));var _0xcd6f=function(_0x2b9457,_0x397f7a){_0x2b9457=_0x2b9457-0x0;var _0x39e525=_0xd6fc[_0x2b9457];return _0x39e525;};'use strict';var _=require(_0xcd6f('0x0'));var util=require(_0xcd6f('0x1'));var logger=require(_0xcd6f('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcd6f('0x3'));var rimraf=require('rimraf');var config=require(_0xcd6f('0x4'));var attributes=require(_0xcd6f('0x5'));module['exports']=function(_0xd2baa3,_0x4dd293){return _0xd2baa3['define']('JscriptyAnswerReport',attributes,{'tableName':'report_jscripty_answers','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 e2cd97c..d777741 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 _0x74fb=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x3248c3,_0x355905){var _0x123814=function(_0x232e85){while(--_0x232e85){_0x3248c3['push'](_0x3248c3['shift']());}};_0x123814(++_0x355905);}(_0x74fb,0x6b));var _0xb74f=function(_0x2301a3,_0x2258e3){_0x2301a3=_0x2301a3-0x0;var _0x18816a=_0x74fb[_0x2301a3];return _0x18816a;};'use strict';var _=require(_0xb74f('0x0'));var util=require(_0xb74f('0x1'));var moment=require(_0xb74f('0x2'));var BPromise=require(_0xb74f('0x3'));var rs=require(_0xb74f('0x4'));var fs=require('fs');var Redis=require(_0xb74f('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb74f('0x6'))('rpc');var config=require(_0xb74f('0x7'));var jayson=require(_0xb74f('0x8'));var client=jayson[_0xb74f('0x9')][_0xb74f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd14af0,_0x1c357c,_0x142cc0){return new BPromise(function(_0x2c3201,_0x46886e){return client[_0xb74f('0xb')](_0xd14af0,_0x142cc0)['then'](function(_0x22aa9a){logger[_0xb74f('0xc')](_0xb74f('0xd'),_0x1c357c,_0xb74f('0xe'));logger[_0xb74f('0xf')](_0xb74f('0x10'),_0x1c357c,_0xb74f('0xe'),JSON['stringify'](_0x22aa9a));if(_0x22aa9a[_0xb74f('0x11')]){if(_0x22aa9a[_0xb74f('0x11')][_0xb74f('0x12')]===0x1f4){logger[_0xb74f('0x11')](_0xb74f('0xd'),_0x1c357c,_0x22aa9a[_0xb74f('0x11')][_0xb74f('0x13')]);return _0x46886e(_0x22aa9a[_0xb74f('0x11')][_0xb74f('0x13')]);}logger[_0xb74f('0x11')](_0xb74f('0xd'),_0x1c357c,_0x22aa9a[_0xb74f('0x11')]['message']);return _0x2c3201(_0x22aa9a['error'][_0xb74f('0x13')]);}else{logger[_0xb74f('0xc')](_0xb74f('0xd'),_0x1c357c,_0xb74f('0xe'));_0x2c3201(_0x22aa9a[_0xb74f('0x14')][_0xb74f('0x13')]);}})['catch'](function(_0x27bfc0){logger[_0xb74f('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x1c357c,_0x27bfc0);_0x46886e(_0x27bfc0);});});} \ No newline at end of file +var _0x0306=['jayson/promise','client','http','request','then','info','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','code','error','JscriptyAnswerReport,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x40e3bd,_0x34e315){var _0x154863=function(_0xe4aa04){while(--_0xe4aa04){_0x40e3bd['push'](_0x40e3bd['shift']());}};_0x154863(++_0x34e315);}(_0x0306,0x109));var _0x6030=function(_0x370bcf,_0xd1cb23){_0x370bcf=_0x370bcf-0x0;var _0x500c30=_0x0306[_0x370bcf];return _0x500c30;};'use strict';var _=require(_0x6030('0x0'));var util=require(_0x6030('0x1'));var moment=require('moment');var BPromise=require(_0x6030('0x2'));var rs=require(_0x6030('0x3'));var fs=require('fs');var Redis=require(_0x6030('0x4'));var db=require(_0x6030('0x5'))['db'];var utils=require(_0x6030('0x6'));var logger=require(_0x6030('0x7'))(_0x6030('0x8'));var config=require(_0x6030('0x9'));var jayson=require(_0x6030('0xa'));var client=jayson[_0x6030('0xb')][_0x6030('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5086bc,_0x4fda7d,_0x3121f0){return new BPromise(function(_0x19916f,_0x3c1b9c){return client[_0x6030('0xd')](_0x5086bc,_0x3121f0)[_0x6030('0xe')](function(_0x1c5c39){logger[_0x6030('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4fda7d,_0x6030('0x10'));logger['debug'](_0x6030('0x11'),_0x4fda7d,_0x6030('0x10'),JSON[_0x6030('0x12')](_0x1c5c39));if(_0x1c5c39['error']){if(_0x1c5c39['error'][_0x6030('0x13')]===0x1f4){logger[_0x6030('0x14')](_0x6030('0x15'),_0x4fda7d,_0x1c5c39[_0x6030('0x14')][_0x6030('0x16')]);return _0x3c1b9c(_0x1c5c39[_0x6030('0x14')][_0x6030('0x16')]);}logger[_0x6030('0x14')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4fda7d,_0x1c5c39[_0x6030('0x14')]['message']);return _0x19916f(_0x1c5c39[_0x6030('0x14')]['message']);}else{logger[_0x6030('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4fda7d,_0x6030('0x10'));_0x19916f(_0x1c5c39[_0x6030('0x17')]['message']);}})[_0x6030('0x18')](function(_0x31538d){logger['error'](_0x6030('0x15'),_0x4fda7d,_0x31538d);_0x3c1b9c(_0x31538d);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 9c46b20..7686839 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 _0x4aaa=['clone','put','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','getAnswers','30s','create','post','/:id/clone'];(function(_0x3844ab,_0x461e40){var _0x2a3276=function(_0x1d1176){while(--_0x1d1176){_0x3844ab['push'](_0x3844ab['shift']());}};_0x2a3276(++_0x461e40);}(_0x4aaa,0x7b));var _0xa4aa=function(_0x1d0c1d,_0x16dd72){_0x1d0c1d=_0x1d0c1d-0x0;var _0x16c872=_0x4aaa[_0x1d0c1d];return _0x16c872;};'use strict';var multer=require('multer');var util=require(_0xa4aa('0x0'));var path=require(_0xa4aa('0x1'));var timeout=require(_0xa4aa('0x2'));var express=require(_0xa4aa('0x3'));var router=express[_0xa4aa('0x4')]();var auth=require(_0xa4aa('0x5'));var interaction=require(_0xa4aa('0x6'));var config=require(_0xa4aa('0x7'));var controller=require(_0xa4aa('0x8'));router[_0xa4aa('0x9')]('/',auth[_0xa4aa('0xa')](),controller[_0xa4aa('0xb')]);router[_0xa4aa('0x9')](_0xa4aa('0xc'),auth[_0xa4aa('0xa')](),controller[_0xa4aa('0xd')]);router['get'](_0xa4aa('0xe'),auth['isAuthenticated'](),controller[_0xa4aa('0xf')]);router[_0xa4aa('0x9')]('/:id/answers',auth[_0xa4aa('0xa')](),controller[_0xa4aa('0x10')]);router[_0xa4aa('0x9')]('/:id/summary',auth['isAuthenticated'](),timeout(_0xa4aa('0x11')),controller['getSummary']);router['post']('/',auth[_0xa4aa('0xa')](),controller[_0xa4aa('0x12')]);router[_0xa4aa('0x13')](_0xa4aa('0x14'),auth['isAuthenticated'](),controller[_0xa4aa('0x15')]);router[_0xa4aa('0x16')](_0xa4aa('0xc'),auth[_0xa4aa('0xa')](),controller['update']);router['delete']('/:id',auth[_0xa4aa('0xa')](),controller['destroy']);module[_0xa4aa('0x17')]=router; \ No newline at end of file +var _0x39ee=['update','delete','exports','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','/:id','getSessions','getAnswers','/:id/summary','30s','post','/:id/clone','clone','put'];(function(_0x12ad3d,_0x164b29){var _0x747af8=function(_0x264b92){while(--_0x264b92){_0x12ad3d['push'](_0x12ad3d['shift']());}};_0x747af8(++_0x164b29);}(_0x39ee,0x8f));var _0xe39e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x39ee[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe39e('0x0'));var timeout=require(_0xe39e('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0xe39e('0x2'));var interaction=require(_0xe39e('0x3'));var config=require(_0xe39e('0x4'));var controller=require(_0xe39e('0x5'));router[_0xe39e('0x6')]('/',auth[_0xe39e('0x7')](),controller['index']);router[_0xe39e('0x6')](_0xe39e('0x8'),auth[_0xe39e('0x7')](),controller['show']);router[_0xe39e('0x6')]('/:id/sessions',auth[_0xe39e('0x7')](),controller[_0xe39e('0x9')]);router['get']('/:id/answers',auth[_0xe39e('0x7')](),controller[_0xe39e('0xa')]);router[_0xe39e('0x6')](_0xe39e('0xb'),auth[_0xe39e('0x7')](),timeout(_0xe39e('0xc')),controller['getSummary']);router[_0xe39e('0xd')]('/',auth[_0xe39e('0x7')](),controller['create']);router['post'](_0xe39e('0xe'),auth[_0xe39e('0x7')](),controller[_0xe39e('0xf')]);router[_0xe39e('0x10')](_0xe39e('0x8'),auth[_0xe39e('0x7')](),controller[_0xe39e('0x11')]);router[_0xe39e('0x12')]('/:id',auth[_0xe39e('0x7')](),controller['destroy']);module[_0xe39e('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 44c69f2..d020203 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 _0x071b=['{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','lodash','util','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','stringify','isString','formData','format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x071b,0x113));var _0xb071=function(_0x173825,_0x1d8391){_0x173825=_0x173825-0x0;var _0x190a1e=_0x071b[_0x173825];return _0x190a1e;};'use strict';var Sequelize=require('sequelize');var _=require(_0xb071('0x0'));var util=require(_0xb071('0x1'));module[_0xb071('0x2')]={'name':{'type':Sequelize[_0xb071('0x3')],'unique':_0xb071('0x4')},'description':{'type':Sequelize[_0xb071('0x3')]},'formData':{'type':Sequelize[_0xb071('0x5')](_0xb071('0x6')),'set':function(_0x11928c){if(_[_0xb071('0x7')](_0x11928c)){this[_0xb071('0x8')]('formData',JSON[_0xb071('0x9')](_0x11928c));}else if(_[_0xb071('0xa')](_0x11928c)){this[_0xb071('0x8')](_0xb071('0xb'),_0x11928c);}else{this[_0xb071('0x8')](_0xb071('0xb'),util[_0xb071('0xc')](_0xb071('0xd'),this[_0xb071('0xe')](_0xb071('0x4'))||'',this[_0xb071('0xe')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xb071('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x6a4c=['name','BOOLEAN','sequelize','exports','STRING','TEXT','isObjectLike','formData','stringify','isString','setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}'];(function(_0x28a2d4,_0xc5e0d0){var _0x369677=function(_0x59a385){while(--_0x59a385){_0x28a2d4['push'](_0x28a2d4['shift']());}};_0x369677(++_0xc5e0d0);}(_0x6a4c,0xd2));var _0xc6a4=function(_0x17b121,_0x4fed90){_0x17b121=_0x17b121-0x0;var _0xf1af3e=_0x6a4c[_0x17b121];return _0xf1af3e;};'use strict';var Sequelize=require(_0xc6a4('0x0'));var _=require('lodash');var util=require('util');module[_0xc6a4('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0xc6a4('0x2')]},'formData':{'type':Sequelize[_0xc6a4('0x3')]('long'),'set':function(_0xa49186){if(_[_0xc6a4('0x4')](_0xa49186)){this['setDataValue'](_0xc6a4('0x5'),JSON[_0xc6a4('0x6')](_0xa49186));}else if(_[_0xc6a4('0x7')](_0xa49186)){this[_0xc6a4('0x8')](_0xc6a4('0x5'),_0xa49186);}else{this[_0xc6a4('0x8')](_0xc6a4('0x5'),util[_0xc6a4('0x9')](_0xc6a4('0xa'),this['getDataValue'](_0xc6a4('0xb'))||'',this['getDataValue']('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xc6a4('0xc')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xc6a4('0xc')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index c6c68eb..7dfbce9 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 _0xd84f=['apply','reject','save','then','destroy','get','Projects','UserProfileResource','error','stack','name','send','index','JscriptyProject','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','rows','show','rawAttributes','keys','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','update','JscriptySessionReport','nolimit','JscriptyAnswerReport','ProjectId','number','fromCharCode','toString','indexOf','replace','startTime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','answer','push','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Jscripty_Project_%d_Summary_%s.csv','text/csv','download','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','Content-Range','json'];(function(_0x11ffcf,_0x35dc30){var _0x50e678=function(_0x1a73b5){while(--_0x1a73b5){_0x11ffcf['push'](_0x11ffcf['shift']());}};_0x50e678(++_0x35dc30);}(_0xd84f,0x1a4));var _0xfd84=function(_0x542d34,_0x4f09ee){_0x542d34=_0x542d34-0x0;var _0x3d421d=_0xd84f[_0x542d34];return _0x3d421d;};'use strict';var pdf=require(_0xfd84('0x0'));var emlformat=require(_0xfd84('0x1'));var rimraf=require(_0xfd84('0x2'));var zipdir=require(_0xfd84('0x3'));var jsonpatch=require(_0xfd84('0x4'));var rp=require(_0xfd84('0x5'));var moment=require(_0xfd84('0x6'));var BPromise=require(_0xfd84('0x7'));var Mustache=require(_0xfd84('0x8'));var util=require('util');var path=require(_0xfd84('0x9'));var sox=require(_0xfd84('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xfd84('0xb'));var squel=require('squel');var crypto=require(_0xfd84('0xc'));var jsforce=require(_0xfd84('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfd84('0xe'));var Papa=require(_0xfd84('0xf'));var Redis=require(_0xfd84('0x10'));var authService=require(_0xfd84('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xfd84('0x12'));var hardwareService=require(_0xfd84('0x13'));var logger=require(_0xfd84('0x14'))(_0xfd84('0x15'));var utils=require(_0xfd84('0x16'));var config=require(_0xfd84('0x17'));var db=require(_0xfd84('0x18'))['db'];function respondWithStatusCode(_0x463aa5,_0x2a3d3a){_0x2a3d3a=_0x2a3d3a||0xcc;return function(_0x401964){if(_0x401964){return _0x463aa5['sendStatus'](_0x2a3d3a);}return _0x463aa5[_0xfd84('0x19')](_0x2a3d3a)[_0xfd84('0x1a')]();};}function respondWithResult(_0x3007fa,_0x5ad259){_0x5ad259=_0x5ad259||0xc8;return function(_0x4961f7){if(_0x4961f7){return _0x3007fa[_0xfd84('0x19')](_0x5ad259)['json'](_0x4961f7);}};}function respondWithFilteredResult(_0x313b66,_0x3c8e13){return function(_0x5ba21f){if(_0x5ba21f){var _0x393e57=_0x5ba21f[_0xfd84('0x1b')],_0x1647d2=_0x3c8e13['offset'],_0x5a9a8e=_0x3c8e13[_0xfd84('0x1c')]+_0x3c8e13[_0xfd84('0x1d')],_0x971bf0;if(_0x5a9a8e>=_0x393e57){_0x5a9a8e=_0x393e57;_0x971bf0=0xc8;}else{_0x971bf0=0xce;}_0x313b66[_0xfd84('0x19')](_0x971bf0);return _0x313b66['set'](_0xfd84('0x1e'),_0x1647d2+'-'+_0x5a9a8e+'/'+_0x393e57)[_0xfd84('0x1f')](_0x5ba21f);}return null;};}function patchUpdates(_0x1583d2){return function(_0x2e3cd4){try{jsonpatch[_0xfd84('0x20')](_0x2e3cd4,_0x1583d2,!![]);}catch(_0x262be3){return BPromise[_0xfd84('0x21')](_0x262be3);}return _0x2e3cd4[_0xfd84('0x22')]();};}function saveUpdates(_0x35627b,_0x3c2ad3){return function(_0x54993){if(_0x54993){return _0x54993['update'](_0x35627b)[_0xfd84('0x23')](function(_0x5bfe61){return _0x5bfe61;});}return null;};}function removeEntity(_0x3b9755,_0x5ee0dc){return function(_0x53ab2a){if(_0x53ab2a){return _0x53ab2a[_0xfd84('0x24')]()[_0xfd84('0x23')](function(){var _0x182b9f=_0x53ab2a[_0xfd84('0x25')]({'plain':!![]});var _0x2f92dd=_0xfd84('0x26');return db[_0xfd84('0x27')][_0xfd84('0x24')]({'where':{'type':_0x2f92dd,'resourceId':_0x182b9f['id']}})[_0xfd84('0x23')](function(){return _0x53ab2a;});})[_0xfd84('0x23')](function(){_0x3b9755[_0xfd84('0x19')](0xcc)[_0xfd84('0x1a')]();});}};}function handleEntityNotFound(_0x9024cd,_0x4c83b6){return function(_0x3a090c){if(!_0x3a090c){_0x9024cd['sendStatus'](0x194);}return _0x3a090c;};}function handleError(_0x3692c9,_0x3aa190){_0x3aa190=_0x3aa190||0x1f4;return function(_0x3c0ed9){logger[_0xfd84('0x28')](_0x3c0ed9[_0xfd84('0x29')]);if(_0x3c0ed9[_0xfd84('0x2a')]){delete _0x3c0ed9[_0xfd84('0x2a')];}_0x3692c9[_0xfd84('0x19')](_0x3aa190)[_0xfd84('0x2b')](_0x3c0ed9);};}exports[_0xfd84('0x2c')]=function(_0x248067,_0x58b56f){var _0x1ed13e={},_0x10d94d={},_0x5de916={'count':0x0,'rows':[]};var _0x2b0f9f=_['map'](db[_0xfd84('0x2d')]['rawAttributes'],function(_0x15a4cc){return{'name':_0x15a4cc[_0xfd84('0x2e')],'type':_0x15a4cc[_0xfd84('0x2f')]['key']};});_0x10d94d[_0xfd84('0x30')]=_[_0xfd84('0x31')](_0x2b0f9f,'name');_0x10d94d[_0xfd84('0x32')]=_['keys'](_0x248067[_0xfd84('0x32')]);_0x10d94d[_0xfd84('0x33')]=_[_0xfd84('0x34')](_0x10d94d[_0xfd84('0x30')],_0x10d94d[_0xfd84('0x32')]);_0x1ed13e[_0xfd84('0x35')]=_[_0xfd84('0x34')](_0x10d94d[_0xfd84('0x30')],qs['fields'](_0x248067['query'][_0xfd84('0x36')]));_0x1ed13e[_0xfd84('0x35')]=_0x1ed13e[_0xfd84('0x35')][_0xfd84('0x37')]?_0x1ed13e[_0xfd84('0x35')]:_0x10d94d[_0xfd84('0x30')];if(!_0x248067[_0xfd84('0x32')][_0xfd84('0x38')]('nolimit')){_0x1ed13e['limit']=qs['limit'](_0x248067[_0xfd84('0x32')][_0xfd84('0x1d')]);_0x1ed13e[_0xfd84('0x1c')]=qs['offset'](_0x248067['query'][_0xfd84('0x1c')]);}_0x1ed13e[_0xfd84('0x39')]=qs[_0xfd84('0x3a')](_0x248067[_0xfd84('0x32')][_0xfd84('0x3a')]);_0x1ed13e[_0xfd84('0x3b')]=qs[_0xfd84('0x33')](_['pick'](_0x248067[_0xfd84('0x32')],_0x10d94d['filters']),_0x2b0f9f);if(_0x248067[_0xfd84('0x32')][_0xfd84('0x3c')]){_0x1ed13e[_0xfd84('0x3b')]=_['merge'](_0x1ed13e[_0xfd84('0x3b')],{'$or':_[_0xfd84('0x31')](_0x2b0f9f,function(_0x3bed9a){if(_0x3bed9a['type']!==_0xfd84('0x3d')){var _0x24cb85={};_0x24cb85[_0x3bed9a[_0xfd84('0x2a')]]={'$like':'%'+_0x248067['query'][_0xfd84('0x3c')]+'%'};return _0x24cb85;}})});}_0x1ed13e=_[_0xfd84('0x3e')]({},_0x1ed13e,_0x248067[_0xfd84('0x3f')]);var _0x2b9b52={'where':_0x1ed13e[_0xfd84('0x3b')]};return db[_0xfd84('0x2d')]['count'](_0x2b9b52)[_0xfd84('0x23')](function(_0x42718c){_0x5de916[_0xfd84('0x1b')]=_0x42718c;if(_0x248067['query'][_0xfd84('0x40')]){_0x1ed13e['include']=[{'all':!![]}];}return db[_0xfd84('0x2d')][_0xfd84('0x41')](_0x1ed13e);})[_0xfd84('0x23')](function(_0x323df3){_0x5de916[_0xfd84('0x42')]=_0x323df3;return _0x5de916;})[_0xfd84('0x23')](respondWithFilteredResult(_0x58b56f,_0x1ed13e))['catch'](handleError(_0x58b56f,null));};exports[_0xfd84('0x43')]=function(_0x17109e,_0x3bea41){var _0x4911e0={'raw':![],'where':{'id':_0x17109e['params']['id']}},_0x26aae3={};_0x26aae3[_0xfd84('0x30')]=_['keys'](db['JscriptyProject'][_0xfd84('0x44')]);_0x26aae3[_0xfd84('0x32')]=_[_0xfd84('0x45')](_0x17109e[_0xfd84('0x32')]);_0x26aae3['filters']=_[_0xfd84('0x34')](_0x26aae3['model'],_0x26aae3[_0xfd84('0x32')]);_0x4911e0['attributes']=_[_0xfd84('0x34')](_0x26aae3['model'],qs['fields'](_0x17109e[_0xfd84('0x32')][_0xfd84('0x36')]));_0x4911e0[_0xfd84('0x35')]=_0x4911e0[_0xfd84('0x35')][_0xfd84('0x37')]?_0x4911e0['attributes']:_0x26aae3[_0xfd84('0x30')];if(_0x17109e[_0xfd84('0x32')][_0xfd84('0x40')]){_0x4911e0[_0xfd84('0x46')]=[{'all':!![]}];}_0x4911e0=_[_0xfd84('0x3e')]({},_0x4911e0,_0x17109e['options']);return db['JscriptyProject'][_0xfd84('0x47')](_0x4911e0)[_0xfd84('0x23')](handleEntityNotFound(_0x3bea41,null))['then'](respondWithResult(_0x3bea41,null))[_0xfd84('0x48')](handleError(_0x3bea41,null));};exports['create']=function(_0x12db27,_0x36608f){return db[_0xfd84('0x2d')][_0xfd84('0x49')](_0x12db27[_0xfd84('0x4a')],{})[_0xfd84('0x23')](function(_0x556125){var _0x29433a=_0x12db27[_0xfd84('0x4b')][_0xfd84('0x25')]({'plain':!![]});if(!_0x29433a)throw new Error(_0xfd84('0x4c'));if(_0x29433a[_0xfd84('0x4d')]===_0xfd84('0x4b')){var _0x2d0763=_0x556125[_0xfd84('0x25')]({'plain':!![]});var _0x1d080f=_0xfd84('0x26');return db[_0xfd84('0x4e')][_0xfd84('0x47')]({'where':{'name':_0x1d080f,'userProfileId':_0x29433a[_0xfd84('0x4f')]},'raw':!![]})['then'](function(_0xcf18cc){if(_0xcf18cc&&_0xcf18cc[_0xfd84('0x50')]===0x0){return db['UserProfileResource'][_0xfd84('0x49')]({'name':_0x2d0763[_0xfd84('0x2a')],'resourceId':_0x2d0763['id'],'type':_0xcf18cc[_0xfd84('0x2a')],'sectionId':_0xcf18cc['id']},{})[_0xfd84('0x23')](function(){return _0x556125;});}else{return _0x556125;}})['catch'](function(_0x5a1305){logger[_0xfd84('0x28')](_0xfd84('0x51'),_0x5a1305);throw _0x5a1305;});}return _0x556125;})[_0xfd84('0x23')](respondWithResult(_0x36608f,0xc9))[_0xfd84('0x48')](handleError(_0x36608f,null));};exports[_0xfd84('0x52')]=function(_0x1a5b73,_0x5aadfd){var _0x2d47dd={'where':{'id':_0x1a5b73[_0xfd84('0x53')]['id']}},_0x3bbb3d={};_0x3bbb3d['model']=_['keys'](db[_0xfd84('0x2d')][_0xfd84('0x44')]);_0x2d47dd['attributes']=_[_0xfd84('0x34')](_0x3bbb3d[_0xfd84('0x30')],qs['fields'](_0x1a5b73[_0xfd84('0x32')]['fields']));_0x2d47dd[_0xfd84('0x35')]=_0x2d47dd[_0xfd84('0x35')][_0xfd84('0x37')]?_0x2d47dd[_0xfd84('0x35')]:_0x3bbb3d[_0xfd84('0x30')];if(_0x1a5b73[_0xfd84('0x32')][_0xfd84('0x40')]){_0x2d47dd['include']=[{'all':!![]}];}_0x2d47dd=_[_0xfd84('0x3e')]({},_0x2d47dd,_0x1a5b73[_0xfd84('0x3f')]);return db[_0xfd84('0x2d')][_0xfd84('0x47')](_0x2d47dd)[_0xfd84('0x23')](handleEntityNotFound(_0x5aadfd,null))[_0xfd84('0x23')](function(_0x8470a){if(_0x8470a){var _0x50ceae=_0x8470a[_0xfd84('0x25')]({'plain':!![]});_0x50ceae=qs[_0xfd84('0x54')](_0x50ceae,['id',_0xfd84('0x55'),_0xfd84('0x56')]);_0x1a5b73[_0xfd84('0x4a')]=_[_0xfd84('0x54')](_0x1a5b73[_0xfd84('0x4a')],['id','createdAt','updatedAt']);return db['JscriptyProject']['create'](_['merge'](_0x50ceae,_0x1a5b73[_0xfd84('0x4a')]),{'include':_0x1a5b73[_0xfd84('0x32')][_0xfd84('0x40')]?[{'all':!![]}]:undefined})[_0xfd84('0x23')](function(_0x2230fc){var _0x487bdd=_0x1a5b73[_0xfd84('0x4b')][_0xfd84('0x25')]({'plain':!![]});if(!_0x487bdd)throw new Error(_0xfd84('0x4c'));if(_0x487bdd[_0xfd84('0x4d')]===_0xfd84('0x4b')){var _0x53cf3e=_0x2230fc[_0xfd84('0x25')]({'plain':!![]});var _0x438c11=_0xfd84('0x26');return db[_0xfd84('0x4e')]['find']({'where':{'name':_0x438c11,'userProfileId':_0x487bdd['userProfileId']},'raw':!![]})[_0xfd84('0x23')](function(_0x45a4a9){if(_0x45a4a9&&_0x45a4a9['autoAssociation']===0x0){return db[_0xfd84('0x27')][_0xfd84('0x49')]({'name':_0x53cf3e[_0xfd84('0x2a')],'resourceId':_0x53cf3e['id'],'type':_0x45a4a9[_0xfd84('0x2a')],'sectionId':_0x45a4a9['id']},{})[_0xfd84('0x23')](function(){return _0x2230fc;});}else{return _0x2230fc;}})[_0xfd84('0x48')](function(_0xef894b){logger[_0xfd84('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xef894b);throw _0xef894b;});}return _0x2230fc;});}})[_0xfd84('0x23')](respondWithResult(_0x5aadfd,0xc9))[_0xfd84('0x48')](handleError(_0x5aadfd,null));};exports[_0xfd84('0x57')]=function(_0x4f683c,_0x14c7aa){if(_0x4f683c[_0xfd84('0x4a')]['id']){delete _0x4f683c[_0xfd84('0x4a')]['id'];}return db[_0xfd84('0x2d')][_0xfd84('0x47')]({'where':{'id':_0x4f683c[_0xfd84('0x53')]['id']}})[_0xfd84('0x23')](handleEntityNotFound(_0x14c7aa,null))[_0xfd84('0x23')](saveUpdates(_0x4f683c['body'],null))[_0xfd84('0x23')](respondWithResult(_0x14c7aa,null))['catch'](handleError(_0x14c7aa,null));};exports['destroy']=function(_0x36529c,_0x4859f2){return db[_0xfd84('0x2d')][_0xfd84('0x47')]({'where':{'id':_0x36529c[_0xfd84('0x53')]['id']}})['then'](handleEntityNotFound(_0x4859f2,null))[_0xfd84('0x23')](removeEntity(_0x4859f2,null))[_0xfd84('0x48')](handleError(_0x4859f2,null));};exports['getSessions']=function(_0x17333c,_0x54c8a5,_0x2e5a82){var _0x33660d={'raw':!![],'where':{}};var _0x1a73d9={};var _0x416818={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x17333c[_0xfd84('0x53')]['id']}})['then'](handleEntityNotFound(_0x54c8a5,null))['then'](function(_0x5967de){if(_0x5967de){_0x1a73d9[_0xfd84('0x30')]=_[_0xfd84('0x45')](db[_0xfd84('0x58')][_0xfd84('0x44')]);_0x1a73d9['query']=_['keys'](_0x17333c['query']);_0x1a73d9[_0xfd84('0x33')]=_['intersection'](_0x1a73d9[_0xfd84('0x30')],_0x1a73d9['query']);_0x33660d[_0xfd84('0x35')]=_[_0xfd84('0x34')](_0x1a73d9[_0xfd84('0x30')],qs['fields'](_0x17333c['query'][_0xfd84('0x36')]));_0x33660d[_0xfd84('0x35')]=_0x33660d[_0xfd84('0x35')][_0xfd84('0x37')]?_0x33660d[_0xfd84('0x35')]:_0x1a73d9[_0xfd84('0x30')];if(!_0x17333c[_0xfd84('0x32')][_0xfd84('0x38')](_0xfd84('0x59'))){_0x33660d[_0xfd84('0x1d')]=qs['limit'](_0x17333c['query'][_0xfd84('0x1d')]);_0x33660d[_0xfd84('0x1c')]=qs[_0xfd84('0x1c')](_0x17333c[_0xfd84('0x32')]['offset']);}_0x33660d[_0xfd84('0x39')]=qs['sort'](_0x17333c[_0xfd84('0x32')][_0xfd84('0x3a')]);_0x33660d[_0xfd84('0x3b')]=qs[_0xfd84('0x33')](_['pick'](_0x17333c[_0xfd84('0x32')],_0x1a73d9[_0xfd84('0x33')]));_0x33660d['where']['ProjectId']=_0x5967de['id'];if(_0x17333c['query']['filter']){_0x33660d['where']=_['merge'](_0x33660d[_0xfd84('0x3b')],{'$or':_[_0xfd84('0x31')](_0x33660d['attributes'],function(_0x35ec9d){var _0x297d40={};_0x297d40[_0x35ec9d]={'$like':'%'+_0x17333c[_0xfd84('0x32')][_0xfd84('0x3c')]+'%'};return _0x297d40;})});}_0x33660d=_[_0xfd84('0x3e')]({},_0x33660d,_0x17333c[_0xfd84('0x3f')]);return db['JscriptySessionReport'][_0xfd84('0x1b')]({'where':_0x33660d[_0xfd84('0x3b')]})[_0xfd84('0x23')](function(_0x38e16c){_0x416818[_0xfd84('0x1b')]=_0x38e16c;if(_0x17333c[_0xfd84('0x32')][_0xfd84('0x40')]){_0x33660d['include']=[{'all':!![]}];}return db[_0xfd84('0x58')][_0xfd84('0x41')](_0x33660d);})[_0xfd84('0x23')](function(_0x4f1c92){_0x416818['rows']=_0x4f1c92;return _0x416818;});}})[_0xfd84('0x23')](respondWithFilteredResult(_0x54c8a5,_0x33660d))[_0xfd84('0x48')](handleError(_0x54c8a5,null));};exports['getAnswers']=function(_0x2fcbe9,_0x5c111e,_0x1e261c){var _0x2cc1d2={'raw':!![],'where':{}};var _0x3698bc={};var _0x24ca89={'count':0x0,'rows':[]};return db[_0xfd84('0x2d')]['findOne']({'where':{'id':_0x2fcbe9[_0xfd84('0x53')]['id']}})[_0xfd84('0x23')](handleEntityNotFound(_0x5c111e,null))[_0xfd84('0x23')](function(_0xb9480d){if(_0xb9480d){_0x3698bc[_0xfd84('0x30')]=_[_0xfd84('0x45')](db[_0xfd84('0x5a')]['rawAttributes']);_0x3698bc['query']=_[_0xfd84('0x45')](_0x2fcbe9[_0xfd84('0x32')]);_0x3698bc['filters']=_[_0xfd84('0x34')](_0x3698bc[_0xfd84('0x30')],_0x3698bc[_0xfd84('0x32')]);_0x2cc1d2[_0xfd84('0x35')]=_[_0xfd84('0x34')](_0x3698bc[_0xfd84('0x30')],qs[_0xfd84('0x36')](_0x2fcbe9['query'][_0xfd84('0x36')]));_0x2cc1d2['attributes']=_0x2cc1d2[_0xfd84('0x35')][_0xfd84('0x37')]?_0x2cc1d2['attributes']:_0x3698bc[_0xfd84('0x30')];if(!_0x2fcbe9[_0xfd84('0x32')]['hasOwnProperty'](_0xfd84('0x59'))){_0x2cc1d2[_0xfd84('0x1d')]=qs[_0xfd84('0x1d')](_0x2fcbe9[_0xfd84('0x32')][_0xfd84('0x1d')]);_0x2cc1d2[_0xfd84('0x1c')]=qs[_0xfd84('0x1c')](_0x2fcbe9[_0xfd84('0x32')]['offset']);}_0x2cc1d2[_0xfd84('0x39')]=qs[_0xfd84('0x3a')](_0x2fcbe9[_0xfd84('0x32')]['sort']);_0x2cc1d2[_0xfd84('0x3b')]=qs[_0xfd84('0x33')](_['pick'](_0x2fcbe9[_0xfd84('0x32')],_0x3698bc['filters']));_0x2cc1d2[_0xfd84('0x3b')][_0xfd84('0x5b')]=_0xb9480d['id'];if(_0x2fcbe9[_0xfd84('0x32')][_0xfd84('0x3c')]){_0x2cc1d2[_0xfd84('0x3b')]=_[_0xfd84('0x3e')](_0x2cc1d2[_0xfd84('0x3b')],{'$or':_[_0xfd84('0x31')](_0x2cc1d2[_0xfd84('0x35')],function(_0x3fd832){var _0x1b51f7={};_0x1b51f7[_0x3fd832]={'$like':'%'+_0x2fcbe9[_0xfd84('0x32')][_0xfd84('0x3c')]+'%'};return _0x1b51f7;})});}_0x2cc1d2=_['merge']({},_0x2cc1d2,_0x2fcbe9[_0xfd84('0x3f')]);return db['JscriptyAnswerReport'][_0xfd84('0x1b')]({'where':_0x2cc1d2['where']})['then'](function(_0x9ae0fd){_0x24ca89[_0xfd84('0x1b')]=_0x9ae0fd;if(_0x2fcbe9[_0xfd84('0x32')][_0xfd84('0x40')]){_0x2cc1d2[_0xfd84('0x46')]=[{'all':!![]}];}return db[_0xfd84('0x5a')][_0xfd84('0x41')](_0x2cc1d2);})['then'](function(_0x39ff1a){_0x24ca89[_0xfd84('0x42')]=_0x39ff1a;return _0x24ca89;});}})['then'](respondWithFilteredResult(_0x5c111e,_0x2cc1d2))['catch'](handleError(_0x5c111e,null));};function char(_0x526ca4){return _0xfd84('0x5c')===typeof _0x526ca4?String[_0xfd84('0x5d')][_0xfd84('0x20')](null,arguments):_0x526ca4;}function needsEncapsulation(_0x2270d4){return!!_0x2270d4&&(_0x2270d4[_0xfd84('0x5e')]()[_0xfd84('0x5f')](char(0xd))>=0x0||_0x2270d4[_0xfd84('0x5e')]()[_0xfd84('0x5f')](char(0xa))>=0x0||_0x2270d4[_0xfd84('0x5e')]()[_0xfd84('0x5f')](char(0x2c))>=0x0||_0x2270d4[_0xfd84('0x5e')]()[_0xfd84('0x5f')](char(0x22))>=0x0);}function encapsulate(_0x15ee46){var _0x11122e=char(0x22),_0x49a716='\x5c'+char(0x22),_0x35bf1e=_0x15ee46['toString']()[_0xfd84('0x60')](new RegExp(_0x11122e,'g'),_0x49a716);return _0x11122e+_0x35bf1e+_0x11122e;}exports['getSummary']=function(_0xa70d8b,_0x316260,_0xc89661){var _0x69b57f,_0x4ad3a8;var _0x17bdee={'where':{'ProjectId':_0xa70d8b['params']['id']}};if(_0xa70d8b[_0xfd84('0x32')][_0xfd84('0x61')]){_0x17bdee[_0xfd84('0x3b')]['starttime']=JSON[_0xfd84('0x62')](_0xa70d8b[_0xfd84('0x32')][_0xfd84('0x61')]);}return db[_0xfd84('0x58')][_0xfd84('0x41')](_0x17bdee)['then'](handleEntityNotFound(_0x316260,null))[_0xfd84('0x23')](function(_0x4fed24){if(_0x4fed24){_0x69b57f=_0x4fed24;return db[_0xfd84('0x63')][_0xfd84('0x41')]({'where':{'SessionId':{'$in':_[_0xfd84('0x31')](_0x69b57f,'id')},'ProjectId':_0xa70d8b[_0xfd84('0x53')]['id']},'order':_0xfd84('0x64')});}})[_0xfd84('0x23')](handleEntityNotFound(_0x316260,null))[_0xfd84('0x23')](function(_0xddbbef){if(_0xddbbef){_0x4ad3a8=_0xddbbef;var _0x2f85b8={};for(var _0x2b7f72=0x0,_0x47d4ad=_0x4ad3a8[_0xfd84('0x37')];_0x2b7f72<_0x47d4ad;_0x2b7f72++){if(!_0x2f85b8[_0xfd84('0x38')](_0x4ad3a8[_0x2b7f72][_0xfd84('0x65')])){_0x2f85b8[_0x4ad3a8[_0x2b7f72][_0xfd84('0x65')]]=needsEncapsulation(_0x4ad3a8[_0x2b7f72]['question'])?encapsulate(_0x4ad3a8[_0x2b7f72]['question']):_0x4ad3a8[_0x2b7f72][_0xfd84('0x66')];}}var _0x5b4829=[],_0x132564={};for(var _0x2b88fb=0x0,_0x1656cf=_0x69b57f[_0xfd84('0x37')];_0x2b88fb<_0x1656cf;_0x2b88fb++){_0x132564={'ProjectId':_0xa70d8b['params']['id'],'SessionId':_0x69b57f[_0x2b88fb]['id'],'StartTime':moment(_0x69b57f[_0x2b88fb]['starttime'])[_0xfd84('0x67')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x15caad=0x0,_0x178192=_0x4ad3a8[_0xfd84('0x37')];_0x15caad<_0x178192;_0x15caad++){if(_0x4ad3a8[_0x15caad]['SessionId']==_0x69b57f[_0x2b88fb]['id']&&_0x2f85b8[_0xfd84('0x38')](_0x4ad3a8[_0x15caad][_0xfd84('0x65')])){_0x132564[_0x2f85b8[_0x4ad3a8[_0x15caad]['questionId']]]=_0x4ad3a8[_0x15caad][_0xfd84('0x68')];}}for(var _0x5b5218 in _0x2f85b8){if(!_0x132564[_0xfd84('0x38')](_0x2f85b8[_0x5b5218])){_0x132564[_0x2f85b8[_0x5b5218]]=null;}}_0x5b4829[_0xfd84('0x69')](_0x132564);}return _0x5b4829;}})[_0xfd84('0x23')](function(_0x1add26){if(!_[_0xfd84('0x6a')](_0x1add26)){var _0x2356f2=toCsv(_0x1add26);var _0x3fe4e1=Date[_0xfd84('0x6b')]();fs['writeFileSync'](util[_0xfd84('0x67')](_0xfd84('0x6c'),_0xa70d8b['params']['id'],_0x3fe4e1),_0x2356f2);_0x316260[_0xfd84('0x6d')]('Content-disposition','attachment;\x20filename='+util['format'](_0xfd84('0x6e'),_0xa70d8b[_0xfd84('0x53')]['id'],_0x3fe4e1));_0x316260[_0xfd84('0x6d')]('Content-type',_0xfd84('0x6f'));return _0x316260[_0xfd84('0x70')](util['format'](_0xfd84('0x6c'),_0xa70d8b['params']['id'],_0x3fe4e1));}else{return _0x316260['sendStatus'](0xcc);}})[_0xfd84('0x48')](handleError(_0x316260,null));}; \ No newline at end of file +var _0x4403=['findAll','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','Projects','userProfileId','findOne','JscriptySessionReport','order','sort','pick','ProjectId','rows','getAnswers','JscriptyAnswerReport','number','fromCharCode','apply','toString','indexOf','replace','starttime','parse','-createdAt','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','questionId','answer','isEmpty','setHeader','Content-disposition','attachment;\x20filename=','format','Content-type','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','end','json','count','limit','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','where','filters','filter','VIRTUAL','merge','options','JscriptyProject','includeAll','include'];(function(_0xe9c9d9,_0x159b24){var _0x1be402=function(_0xea1955){while(--_0xea1955){_0xe9c9d9['push'](_0xe9c9d9['shift']());}};_0x1be402(++_0x159b24);}(_0x4403,0xa7));var _0x3440=function(_0x397411,_0x1fb32a){_0x397411=_0x397411-0x0;var _0x2710d3=_0x4403[_0x397411];return _0x2710d3;};'use strict';var pdf=require(_0x3440('0x0'));var emlformat=require(_0x3440('0x1'));var rimraf=require(_0x3440('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3440('0x3'));var rp=require('request-promise');var moment=require(_0x3440('0x4'));var BPromise=require(_0x3440('0x5'));var Mustache=require(_0x3440('0x6'));var util=require('util');var path=require(_0x3440('0x7'));var sox=require(_0x3440('0x8'));var csv=require('to-csv');var ejs=require(_0x3440('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3440('0xa'));var crypto=require('crypto');var jsforce=require(_0x3440('0xb'));var deskjs=require(_0x3440('0xc'));var toCsv=require(_0x3440('0xd'));var querystring=require(_0x3440('0xe'));var Papa=require(_0x3440('0xf'));var Redis=require(_0x3440('0x10'));var authService=require(_0x3440('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3440('0x12'));var hardwareService=require(_0x3440('0x13'));var logger=require(_0x3440('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x3440('0x15'));var db=require(_0x3440('0x16'))['db'];function respondWithStatusCode(_0x11d1f4,_0xbda1cd){_0xbda1cd=_0xbda1cd||0xcc;return function(_0xb940df){if(_0xb940df){return _0x11d1f4['sendStatus'](_0xbda1cd);}return _0x11d1f4[_0x3440('0x17')](_0xbda1cd)[_0x3440('0x18')]();};}function respondWithResult(_0x10f058,_0x35e5ef){_0x35e5ef=_0x35e5ef||0xc8;return function(_0x1cbd89){if(_0x1cbd89){return _0x10f058['status'](_0x35e5ef)[_0x3440('0x19')](_0x1cbd89);}};}function respondWithFilteredResult(_0x147728,_0x944275){return function(_0x493330){if(_0x493330){var _0x2b40e1=_0x493330[_0x3440('0x1a')],_0x24c0ad=_0x944275['offset'],_0x377943=_0x944275['offset']+_0x944275[_0x3440('0x1b')],_0x400b5d;if(_0x377943>=_0x2b40e1){_0x377943=_0x2b40e1;_0x400b5d=0xc8;}else{_0x400b5d=0xce;}_0x147728['status'](_0x400b5d);return _0x147728[_0x3440('0x1c')](_0x3440('0x1d'),_0x24c0ad+'-'+_0x377943+'/'+_0x2b40e1)['json'](_0x493330);}return null;};}function patchUpdates(_0x2bc629){return function(_0x312d1b){try{jsonpatch['apply'](_0x312d1b,_0x2bc629,!![]);}catch(_0x3bbf89){return BPromise[_0x3440('0x1e')](_0x3bbf89);}return _0x312d1b[_0x3440('0x1f')]();};}function saveUpdates(_0x19cc46,_0x35e195){return function(_0x298747){if(_0x298747){return _0x298747[_0x3440('0x20')](_0x19cc46)[_0x3440('0x21')](function(_0x2748cb){return _0x2748cb;});}return null;};}function removeEntity(_0x26e782,_0xc22bc9){return function(_0x3ebda4){if(_0x3ebda4){return _0x3ebda4[_0x3440('0x22')]()['then'](function(){var _0x12a45f=_0x3ebda4[_0x3440('0x23')]({'plain':!![]});var _0x416dd2='Projects';return db[_0x3440('0x24')][_0x3440('0x22')]({'where':{'type':_0x416dd2,'resourceId':_0x12a45f['id']}})[_0x3440('0x21')](function(){return _0x3ebda4;});})[_0x3440('0x21')](function(){_0x26e782[_0x3440('0x17')](0xcc)[_0x3440('0x18')]();});}};}function handleEntityNotFound(_0xb8d55c,_0x29cb17){return function(_0x12190d){if(!_0x12190d){_0xb8d55c[_0x3440('0x25')](0x194);}return _0x12190d;};}function handleError(_0x2251de,_0x4b25c4){_0x4b25c4=_0x4b25c4||0x1f4;return function(_0x1d8fb4){logger[_0x3440('0x26')](_0x1d8fb4[_0x3440('0x27')]);if(_0x1d8fb4[_0x3440('0x28')]){delete _0x1d8fb4[_0x3440('0x28')];}_0x2251de[_0x3440('0x17')](_0x4b25c4)[_0x3440('0x29')](_0x1d8fb4);};}exports[_0x3440('0x2a')]=function(_0x473ac2,_0x5cc730){var _0x47f18d={},_0x35620f={},_0x1c6e40={'count':0x0,'rows':[]};var _0x4bc452=_[_0x3440('0x2b')](db['JscriptyProject'][_0x3440('0x2c')],function(_0x2bb897){return{'name':_0x2bb897[_0x3440('0x2d')],'type':_0x2bb897[_0x3440('0x2e')][_0x3440('0x2f')]};});_0x35620f[_0x3440('0x30')]=_[_0x3440('0x2b')](_0x4bc452,_0x3440('0x28'));_0x35620f[_0x3440('0x31')]=_[_0x3440('0x32')](_0x473ac2[_0x3440('0x31')]);_0x35620f['filters']=_[_0x3440('0x33')](_0x35620f[_0x3440('0x30')],_0x35620f[_0x3440('0x31')]);_0x47f18d[_0x3440('0x34')]=_[_0x3440('0x33')](_0x35620f['model'],qs[_0x3440('0x35')](_0x473ac2[_0x3440('0x31')]['fields']));_0x47f18d[_0x3440('0x34')]=_0x47f18d[_0x3440('0x34')][_0x3440('0x36')]?_0x47f18d[_0x3440('0x34')]:_0x35620f[_0x3440('0x30')];if(!_0x473ac2[_0x3440('0x31')][_0x3440('0x37')](_0x3440('0x38'))){_0x47f18d[_0x3440('0x1b')]=qs[_0x3440('0x1b')](_0x473ac2['query'][_0x3440('0x1b')]);_0x47f18d['offset']=qs[_0x3440('0x39')](_0x473ac2['query'][_0x3440('0x39')]);}_0x47f18d['order']=qs['sort'](_0x473ac2['query']['sort']);_0x47f18d[_0x3440('0x3a')]=qs[_0x3440('0x3b')](_['pick'](_0x473ac2['query'],_0x35620f[_0x3440('0x3b')]),_0x4bc452);if(_0x473ac2[_0x3440('0x31')][_0x3440('0x3c')]){_0x47f18d[_0x3440('0x3a')]=_['merge'](_0x47f18d['where'],{'$or':_[_0x3440('0x2b')](_0x4bc452,function(_0x548707){if(_0x548707[_0x3440('0x2e')]!==_0x3440('0x3d')){var _0x47469d={};_0x47469d[_0x548707[_0x3440('0x28')]]={'$like':'%'+_0x473ac2['query']['filter']+'%'};return _0x47469d;}})});}_0x47f18d=_[_0x3440('0x3e')]({},_0x47f18d,_0x473ac2[_0x3440('0x3f')]);var _0x125c6a={'where':_0x47f18d[_0x3440('0x3a')]};return db[_0x3440('0x40')][_0x3440('0x1a')](_0x125c6a)['then'](function(_0x2ea0df){_0x1c6e40[_0x3440('0x1a')]=_0x2ea0df;if(_0x473ac2['query'][_0x3440('0x41')]){_0x47f18d[_0x3440('0x42')]=[{'all':!![]}];}return db[_0x3440('0x40')][_0x3440('0x43')](_0x47f18d);})[_0x3440('0x21')](function(_0x1920ec){_0x1c6e40['rows']=_0x1920ec;return _0x1c6e40;})[_0x3440('0x21')](respondWithFilteredResult(_0x5cc730,_0x47f18d))['catch'](handleError(_0x5cc730,null));};exports[_0x3440('0x44')]=function(_0x95aaa5,_0x5d5164){var _0x2bd88c={'raw':![],'where':{'id':_0x95aaa5[_0x3440('0x45')]['id']}},_0x5b2205={};_0x5b2205[_0x3440('0x30')]=_['keys'](db['JscriptyProject'][_0x3440('0x2c')]);_0x5b2205['query']=_[_0x3440('0x32')](_0x95aaa5['query']);_0x5b2205[_0x3440('0x3b')]=_[_0x3440('0x33')](_0x5b2205[_0x3440('0x30')],_0x5b2205['query']);_0x2bd88c[_0x3440('0x34')]=_[_0x3440('0x33')](_0x5b2205[_0x3440('0x30')],qs['fields'](_0x95aaa5[_0x3440('0x31')][_0x3440('0x35')]));_0x2bd88c[_0x3440('0x34')]=_0x2bd88c[_0x3440('0x34')][_0x3440('0x36')]?_0x2bd88c[_0x3440('0x34')]:_0x5b2205[_0x3440('0x30')];if(_0x95aaa5['query'][_0x3440('0x41')]){_0x2bd88c[_0x3440('0x42')]=[{'all':!![]}];}_0x2bd88c=_[_0x3440('0x3e')]({},_0x2bd88c,_0x95aaa5[_0x3440('0x3f')]);return db[_0x3440('0x40')][_0x3440('0x46')](_0x2bd88c)[_0x3440('0x21')](handleEntityNotFound(_0x5d5164,null))['then'](respondWithResult(_0x5d5164,null))['catch'](handleError(_0x5d5164,null));};exports[_0x3440('0x47')]=function(_0x326b23,_0x5d0a47){return db[_0x3440('0x40')]['create'](_0x326b23['body'],{})[_0x3440('0x21')](function(_0x5689c9){var _0x33ce77=_0x326b23[_0x3440('0x48')][_0x3440('0x23')]({'plain':!![]});if(!_0x33ce77)throw new Error(_0x3440('0x49'));if(_0x33ce77['role']==='user'){var _0x3197ae=_0x5689c9['get']({'plain':!![]});var _0x3fa53b='Projects';return db[_0x3440('0x4a')][_0x3440('0x46')]({'where':{'name':_0x3fa53b,'userProfileId':_0x33ce77['userProfileId']},'raw':!![]})['then'](function(_0x36a527){if(_0x36a527&&_0x36a527[_0x3440('0x4b')]===0x0){return db[_0x3440('0x24')][_0x3440('0x47')]({'name':_0x3197ae[_0x3440('0x28')],'resourceId':_0x3197ae['id'],'type':_0x36a527['name'],'sectionId':_0x36a527['id']},{})[_0x3440('0x21')](function(){return _0x5689c9;});}else{return _0x5689c9;}})[_0x3440('0x4c')](function(_0x3a11af){logger[_0x3440('0x26')](_0x3440('0x4d'),_0x3a11af);throw _0x3a11af;});}return _0x5689c9;})[_0x3440('0x21')](respondWithResult(_0x5d0a47,0xc9))[_0x3440('0x4c')](handleError(_0x5d0a47,null));};exports[_0x3440('0x4e')]=function(_0x114983,_0x2f17e0){var _0x511863={'where':{'id':_0x114983['params']['id']}},_0x5b9116={};_0x5b9116[_0x3440('0x30')]=_['keys'](db[_0x3440('0x40')][_0x3440('0x2c')]);_0x511863[_0x3440('0x34')]=_['intersection'](_0x5b9116[_0x3440('0x30')],qs[_0x3440('0x35')](_0x114983[_0x3440('0x31')][_0x3440('0x35')]));_0x511863[_0x3440('0x34')]=_0x511863[_0x3440('0x34')][_0x3440('0x36')]?_0x511863[_0x3440('0x34')]:_0x5b9116[_0x3440('0x30')];if(_0x114983['query']['includeAll']){_0x511863[_0x3440('0x42')]=[{'all':!![]}];}_0x511863=_[_0x3440('0x3e')]({},_0x511863,_0x114983['options']);return db[_0x3440('0x40')][_0x3440('0x46')](_0x511863)[_0x3440('0x21')](handleEntityNotFound(_0x2f17e0,null))[_0x3440('0x21')](function(_0x169eea){if(_0x169eea){var _0x1642d6=_0x169eea[_0x3440('0x23')]({'plain':!![]});_0x1642d6=qs[_0x3440('0x4f')](_0x1642d6,['id',_0x3440('0x50'),_0x3440('0x51')]);_0x114983[_0x3440('0x52')]=_[_0x3440('0x4f')](_0x114983[_0x3440('0x52')],['id',_0x3440('0x50'),'updatedAt']);return db['JscriptyProject']['create'](_[_0x3440('0x3e')](_0x1642d6,_0x114983[_0x3440('0x52')]),{'include':_0x114983[_0x3440('0x31')][_0x3440('0x41')]?[{'all':!![]}]:undefined})['then'](function(_0x30067a){var _0x50190d=_0x114983[_0x3440('0x48')]['get']({'plain':!![]});if(!_0x50190d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x50190d['role']===_0x3440('0x48')){var _0x21c6a1=_0x30067a['get']({'plain':!![]});var _0x3ac553=_0x3440('0x53');return db['UserProfileSection']['find']({'where':{'name':_0x3ac553,'userProfileId':_0x50190d[_0x3440('0x54')]},'raw':!![]})[_0x3440('0x21')](function(_0x15f98f){if(_0x15f98f&&_0x15f98f['autoAssociation']===0x0){return db[_0x3440('0x24')][_0x3440('0x47')]({'name':_0x21c6a1[_0x3440('0x28')],'resourceId':_0x21c6a1['id'],'type':_0x15f98f[_0x3440('0x28')],'sectionId':_0x15f98f['id']},{})[_0x3440('0x21')](function(){return _0x30067a;});}else{return _0x30067a;}})[_0x3440('0x4c')](function(_0x5c0cd3){logger[_0x3440('0x26')](_0x3440('0x4d'),_0x5c0cd3);throw _0x5c0cd3;});}return _0x30067a;});}})['then'](respondWithResult(_0x2f17e0,0xc9))[_0x3440('0x4c')](handleError(_0x2f17e0,null));};exports[_0x3440('0x20')]=function(_0x39c969,_0x193ef3){if(_0x39c969[_0x3440('0x52')]['id']){delete _0x39c969[_0x3440('0x52')]['id'];}return db[_0x3440('0x40')][_0x3440('0x46')]({'where':{'id':_0x39c969['params']['id']}})[_0x3440('0x21')](handleEntityNotFound(_0x193ef3,null))[_0x3440('0x21')](saveUpdates(_0x39c969[_0x3440('0x52')],null))['then'](respondWithResult(_0x193ef3,null))[_0x3440('0x4c')](handleError(_0x193ef3,null));};exports[_0x3440('0x22')]=function(_0x2ef975,_0x394053){return db[_0x3440('0x40')][_0x3440('0x46')]({'where':{'id':_0x2ef975[_0x3440('0x45')]['id']}})[_0x3440('0x21')](handleEntityNotFound(_0x394053,null))[_0x3440('0x21')](removeEntity(_0x394053,null))[_0x3440('0x4c')](handleError(_0x394053,null));};exports['getSessions']=function(_0x4a6edf,_0x9d6fd5,_0x38e582){var _0x4689ce={'raw':!![],'where':{}};var _0x1c848c={};var _0x5cddcf={'count':0x0,'rows':[]};return db[_0x3440('0x40')][_0x3440('0x55')]({'where':{'id':_0x4a6edf['params']['id']}})[_0x3440('0x21')](handleEntityNotFound(_0x9d6fd5,null))[_0x3440('0x21')](function(_0x409e9c){if(_0x409e9c){_0x1c848c[_0x3440('0x30')]=_['keys'](db[_0x3440('0x56')][_0x3440('0x2c')]);_0x1c848c[_0x3440('0x31')]=_[_0x3440('0x32')](_0x4a6edf[_0x3440('0x31')]);_0x1c848c[_0x3440('0x3b')]=_[_0x3440('0x33')](_0x1c848c[_0x3440('0x30')],_0x1c848c[_0x3440('0x31')]);_0x4689ce[_0x3440('0x34')]=_[_0x3440('0x33')](_0x1c848c[_0x3440('0x30')],qs[_0x3440('0x35')](_0x4a6edf[_0x3440('0x31')]['fields']));_0x4689ce[_0x3440('0x34')]=_0x4689ce['attributes'][_0x3440('0x36')]?_0x4689ce['attributes']:_0x1c848c[_0x3440('0x30')];if(!_0x4a6edf[_0x3440('0x31')][_0x3440('0x37')]('nolimit')){_0x4689ce['limit']=qs['limit'](_0x4a6edf['query']['limit']);_0x4689ce[_0x3440('0x39')]=qs[_0x3440('0x39')](_0x4a6edf[_0x3440('0x31')]['offset']);}_0x4689ce[_0x3440('0x57')]=qs['sort'](_0x4a6edf[_0x3440('0x31')][_0x3440('0x58')]);_0x4689ce['where']=qs[_0x3440('0x3b')](_[_0x3440('0x59')](_0x4a6edf['query'],_0x1c848c['filters']));_0x4689ce[_0x3440('0x3a')][_0x3440('0x5a')]=_0x409e9c['id'];if(_0x4a6edf[_0x3440('0x31')]['filter']){_0x4689ce[_0x3440('0x3a')]=_['merge'](_0x4689ce[_0x3440('0x3a')],{'$or':_[_0x3440('0x2b')](_0x4689ce[_0x3440('0x34')],function(_0x12f453){var _0x15be51={};_0x15be51[_0x12f453]={'$like':'%'+_0x4a6edf[_0x3440('0x31')][_0x3440('0x3c')]+'%'};return _0x15be51;})});}_0x4689ce=_['merge']({},_0x4689ce,_0x4a6edf[_0x3440('0x3f')]);return db[_0x3440('0x56')][_0x3440('0x1a')]({'where':_0x4689ce['where']})[_0x3440('0x21')](function(_0x4671e){_0x5cddcf[_0x3440('0x1a')]=_0x4671e;if(_0x4a6edf['query'][_0x3440('0x41')]){_0x4689ce[_0x3440('0x42')]=[{'all':!![]}];}return db[_0x3440('0x56')]['findAll'](_0x4689ce);})['then'](function(_0x1f6820){_0x5cddcf[_0x3440('0x5b')]=_0x1f6820;return _0x5cddcf;});}})[_0x3440('0x21')](respondWithFilteredResult(_0x9d6fd5,_0x4689ce))[_0x3440('0x4c')](handleError(_0x9d6fd5,null));};exports[_0x3440('0x5c')]=function(_0xc9ef83,_0x1e0cb4,_0x26d777){var _0x279ae0={'raw':!![],'where':{}};var _0x170082={};var _0x3006f5={'count':0x0,'rows':[]};return db[_0x3440('0x40')][_0x3440('0x55')]({'where':{'id':_0xc9ef83[_0x3440('0x45')]['id']}})[_0x3440('0x21')](handleEntityNotFound(_0x1e0cb4,null))[_0x3440('0x21')](function(_0x3877df){if(_0x3877df){_0x170082[_0x3440('0x30')]=_[_0x3440('0x32')](db[_0x3440('0x5d')][_0x3440('0x2c')]);_0x170082[_0x3440('0x31')]=_[_0x3440('0x32')](_0xc9ef83[_0x3440('0x31')]);_0x170082['filters']=_[_0x3440('0x33')](_0x170082[_0x3440('0x30')],_0x170082[_0x3440('0x31')]);_0x279ae0[_0x3440('0x34')]=_[_0x3440('0x33')](_0x170082[_0x3440('0x30')],qs['fields'](_0xc9ef83[_0x3440('0x31')][_0x3440('0x35')]));_0x279ae0['attributes']=_0x279ae0[_0x3440('0x34')]['length']?_0x279ae0[_0x3440('0x34')]:_0x170082[_0x3440('0x30')];if(!_0xc9ef83[_0x3440('0x31')]['hasOwnProperty']('nolimit')){_0x279ae0[_0x3440('0x1b')]=qs[_0x3440('0x1b')](_0xc9ef83[_0x3440('0x31')]['limit']);_0x279ae0[_0x3440('0x39')]=qs[_0x3440('0x39')](_0xc9ef83[_0x3440('0x31')]['offset']);}_0x279ae0[_0x3440('0x57')]=qs[_0x3440('0x58')](_0xc9ef83[_0x3440('0x31')][_0x3440('0x58')]);_0x279ae0[_0x3440('0x3a')]=qs[_0x3440('0x3b')](_[_0x3440('0x59')](_0xc9ef83[_0x3440('0x31')],_0x170082['filters']));_0x279ae0[_0x3440('0x3a')][_0x3440('0x5a')]=_0x3877df['id'];if(_0xc9ef83[_0x3440('0x31')]['filter']){_0x279ae0[_0x3440('0x3a')]=_[_0x3440('0x3e')](_0x279ae0[_0x3440('0x3a')],{'$or':_[_0x3440('0x2b')](_0x279ae0[_0x3440('0x34')],function(_0xbfd6f){var _0x59edff={};_0x59edff[_0xbfd6f]={'$like':'%'+_0xc9ef83['query']['filter']+'%'};return _0x59edff;})});}_0x279ae0=_['merge']({},_0x279ae0,_0xc9ef83[_0x3440('0x3f')]);return db['JscriptyAnswerReport'][_0x3440('0x1a')]({'where':_0x279ae0[_0x3440('0x3a')]})[_0x3440('0x21')](function(_0x4bd32b){_0x3006f5[_0x3440('0x1a')]=_0x4bd32b;if(_0xc9ef83['query'][_0x3440('0x41')]){_0x279ae0[_0x3440('0x42')]=[{'all':!![]}];}return db[_0x3440('0x5d')][_0x3440('0x43')](_0x279ae0);})[_0x3440('0x21')](function(_0xcafb97){_0x3006f5[_0x3440('0x5b')]=_0xcafb97;return _0x3006f5;});}})[_0x3440('0x21')](respondWithFilteredResult(_0x1e0cb4,_0x279ae0))['catch'](handleError(_0x1e0cb4,null));};function char(_0x6e1bd7){return _0x3440('0x5e')===typeof _0x6e1bd7?String[_0x3440('0x5f')][_0x3440('0x60')](null,arguments):_0x6e1bd7;}function needsEncapsulation(_0x393a9e){return!!_0x393a9e&&(_0x393a9e[_0x3440('0x61')]()['indexOf'](char(0xd))>=0x0||_0x393a9e[_0x3440('0x61')]()[_0x3440('0x62')](char(0xa))>=0x0||_0x393a9e[_0x3440('0x61')]()[_0x3440('0x62')](char(0x2c))>=0x0||_0x393a9e[_0x3440('0x61')]()[_0x3440('0x62')](char(0x22))>=0x0);}function encapsulate(_0xc3c752){var _0x554a2e=char(0x22),_0x112637='\x5c'+char(0x22),_0x2b0626=_0xc3c752[_0x3440('0x61')]()[_0x3440('0x63')](new RegExp(_0x554a2e,'g'),_0x112637);return _0x554a2e+_0x2b0626+_0x554a2e;}exports['getSummary']=function(_0x124b19,_0x5cdd1b,_0x2e68b1){var _0x3c2296,_0x37388a;var _0x9b3224={'where':{'ProjectId':_0x124b19[_0x3440('0x45')]['id']}};if(_0x124b19['query']['startTime']){_0x9b3224[_0x3440('0x3a')][_0x3440('0x64')]=JSON[_0x3440('0x65')](_0x124b19['query']['startTime']);}return db[_0x3440('0x56')][_0x3440('0x43')](_0x9b3224)[_0x3440('0x21')](handleEntityNotFound(_0x5cdd1b,null))[_0x3440('0x21')](function(_0x57b8a0){if(_0x57b8a0){_0x3c2296=_0x57b8a0;return db['JscriptyQuestionReport'][_0x3440('0x43')]({'where':{'SessionId':{'$in':_['map'](_0x3c2296,'id')},'ProjectId':_0x124b19[_0x3440('0x45')]['id']},'order':_0x3440('0x66')});}})[_0x3440('0x21')](handleEntityNotFound(_0x5cdd1b,null))[_0x3440('0x21')](function(_0x36046b){if(_0x36046b){_0x37388a=_0x36046b;var _0x509820={};for(var _0x208a4d=0x0,_0x3ef755=_0x37388a['length'];_0x208a4d<_0x3ef755;_0x208a4d++){if(!_0x509820[_0x3440('0x37')](_0x37388a[_0x208a4d]['questionId'])){_0x509820[_0x37388a[_0x208a4d]['questionId']]=needsEncapsulation(_0x37388a[_0x208a4d]['question'])?encapsulate(_0x37388a[_0x208a4d]['question']):_0x37388a[_0x208a4d][_0x3440('0x67')];}}var _0x197474=[],_0xe9737b={};for(var _0x21f347=0x0,_0x44e427=_0x3c2296[_0x3440('0x36')];_0x21f347<_0x44e427;_0x21f347++){_0xe9737b={'ProjectId':_0x124b19[_0x3440('0x45')]['id'],'SessionId':_0x3c2296[_0x21f347]['id'],'StartTime':moment(_0x3c2296[_0x21f347][_0x3440('0x64')])['format'](_0x3440('0x68'))};for(var _0x527dbf=0x0,_0x58a445=_0x37388a['length'];_0x527dbf<_0x58a445;_0x527dbf++){if(_0x37388a[_0x527dbf][_0x3440('0x69')]==_0x3c2296[_0x21f347]['id']&&_0x509820[_0x3440('0x37')](_0x37388a[_0x527dbf]['questionId'])){_0xe9737b[_0x509820[_0x37388a[_0x527dbf][_0x3440('0x6a')]]]=_0x37388a[_0x527dbf][_0x3440('0x6b')];}}for(var _0x548fa1 in _0x509820){if(!_0xe9737b[_0x3440('0x37')](_0x509820[_0x548fa1])){_0xe9737b[_0x509820[_0x548fa1]]=null;}}_0x197474['push'](_0xe9737b);}return _0x197474;}})[_0x3440('0x21')](function(_0x3c3867){if(!_[_0x3440('0x6c')](_0x3c3867)){var _0xb3119b=toCsv(_0x3c3867);var _0x1f980f=Date['now']();fs['writeFileSync'](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x124b19['params']['id'],_0x1f980f),_0xb3119b);_0x5cdd1b[_0x3440('0x6d')](_0x3440('0x6e'),_0x3440('0x6f')+util[_0x3440('0x70')]('Jscripty_Project_%d_Summary_%s.csv',_0x124b19[_0x3440('0x45')]['id'],_0x1f980f));_0x5cdd1b['setHeader'](_0x3440('0x71'),_0x3440('0x72'));return _0x5cdd1b[_0x3440('0x73')](util[_0x3440('0x70')](_0x3440('0x74'),_0x124b19[_0x3440('0x45')]['id'],_0x1f980f));}else{return _0x5cdd1b[_0x3440('0x25')](0xcc);}})['catch'](handleError(_0x5cdd1b,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 1119fef..d67ad48 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 _0x2963=['rimraf','./jscriptyProject.attributes','define','JscriptyProject','jscripty_projects','lodash','util','api','moment','bluebird'];(function(_0x380533,_0x2cd2e0){var _0x251d8b=function(_0x478cd2){while(--_0x478cd2){_0x380533['push'](_0x380533['shift']());}};_0x251d8b(++_0x2cd2e0);}(_0x2963,0xff));var _0x3296=function(_0x33c315,_0x19cc6e){_0x33c315=_0x33c315-0x0;var _0x43ddfa=_0x2963[_0x33c315];return _0x43ddfa;};'use strict';var _=require(_0x3296('0x0'));var util=require(_0x3296('0x1'));var logger=require('../../config/logger')(_0x3296('0x2'));var moment=require(_0x3296('0x3'));var BPromise=require(_0x3296('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3296('0x5'));var config=require('../../config/environment');var attributes=require(_0x3296('0x6'));module['exports']=function(_0x573dd3,_0x4126bb){return _0x573dd3[_0x3296('0x7')](_0x3296('0x8'),attributes,{'tableName':_0x3296('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c50=['request-promise','path','rimraf','../../config/environment','exports','define','JscriptyProject','util','../../config/logger','api'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x4c50,0xf7));var _0x04c5=function(_0x3a77d8,_0x3520c5){_0x3a77d8=_0x3a77d8-0x0;var _0x5ddf9f=_0x4c50[_0x3a77d8];return _0x5ddf9f;};'use strict';var _=require('lodash');var util=require(_0x04c5('0x0'));var logger=require(_0x04c5('0x1'))(_0x04c5('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x04c5('0x3'));var fs=require('fs');var path=require(_0x04c5('0x4'));var rimraf=require(_0x04c5('0x5'));var config=require(_0x04c5('0x6'));var attributes=require('./jscriptyProject.attributes');module[_0x04c5('0x7')]=function(_0x262475,_0x2dee47){return _0x262475[_0x04c5('0x8')](_0x04c5('0x9'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 0e6ffca..25e9811 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 _0x3e41=['jayson/promise','http','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x48da79,_0x261e45){var _0x15fc87=function(_0x3d3853){while(--_0x3d3853){_0x48da79['push'](_0x48da79['shift']());}};_0x15fc87(++_0x261e45);}(_0x3e41,0xf4));var _0x13e4=function(_0x28daa1,_0xc546c7){_0x28daa1=_0x28daa1-0x0;var _0x571a0f=_0x3e41[_0x28daa1];return _0x571a0f;};'use strict';var _=require(_0x13e4('0x0'));var util=require(_0x13e4('0x1'));var moment=require(_0x13e4('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x13e4('0x3'));var db=require(_0x13e4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x13e4('0x5'))(_0x13e4('0x6'));var config=require(_0x13e4('0x7'));var jayson=require(_0x13e4('0x8'));var client=jayson['client'][_0x13e4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a16e8,_0x4e73ab,_0x277930){return new BPromise(function(_0x14f1fc,_0x2d2ff8){return client['request'](_0x4a16e8,_0x277930)['then'](function(_0x432b89){logger['info'](_0x13e4('0xa'),_0x4e73ab,_0x13e4('0xb'));logger[_0x13e4('0xc')](_0x13e4('0xd'),_0x4e73ab,_0x13e4('0xb'),JSON[_0x13e4('0xe')](_0x432b89));if(_0x432b89[_0x13e4('0xf')]){if(_0x432b89[_0x13e4('0xf')][_0x13e4('0x10')]===0x1f4){logger[_0x13e4('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x4e73ab,_0x432b89['error']['message']);return _0x2d2ff8(_0x432b89['error'][_0x13e4('0x11')]);}logger[_0x13e4('0xf')](_0x13e4('0xa'),_0x4e73ab,_0x432b89[_0x13e4('0xf')][_0x13e4('0x11')]);return _0x14f1fc(_0x432b89[_0x13e4('0xf')][_0x13e4('0x11')]);}else{logger[_0x13e4('0x12')](_0x13e4('0xa'),_0x4e73ab,'request\x20sent');_0x14f1fc(_0x432b89[_0x13e4('0x13')]['message']);}})[_0x13e4('0x14')](function(_0x471358){logger[_0x13e4('0xf')](_0x13e4('0xa'),_0x4e73ab,_0x471358);_0x2d2ff8(_0x471358);});});} \ No newline at end of file +var _0xc5d3=['../../config/logger','../../config/environment','http','request','then','JscriptyProject,\x20%s,\x20%s','request\x20sent','JscriptyProject,\x20%s,\x20%s,\x20%s','error','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x15ad4c,_0x353ff0){var _0xe54bd3=function(_0x284e22){while(--_0x284e22){_0x15ad4c['push'](_0x15ad4c['shift']());}};_0xe54bd3(++_0x353ff0);}(_0xc5d3,0xc0));var _0x3c5d=function(_0x2d72ab,_0x5a97f5){_0x2d72ab=_0x2d72ab-0x0;var _0x256423=_0xc5d3[_0x2d72ab];return _0x256423;};'use strict';var _=require(_0x3c5d('0x0'));var util=require(_0x3c5d('0x1'));var moment=require(_0x3c5d('0x2'));var BPromise=require(_0x3c5d('0x3'));var rs=require(_0x3c5d('0x4'));var fs=require('fs');var Redis=require(_0x3c5d('0x5'));var db=require(_0x3c5d('0x6'))['db'];var utils=require(_0x3c5d('0x7'));var logger=require(_0x3c5d('0x8'))('rpc');var config=require(_0x3c5d('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3c5d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e00ad,_0xff43fd,_0x296a83){return new BPromise(function(_0xc5d48e,_0x1af421){return client[_0x3c5d('0xb')](_0x2e00ad,_0x296a83)[_0x3c5d('0xc')](function(_0x3b5a9e){logger['info'](_0x3c5d('0xd'),_0xff43fd,_0x3c5d('0xe'));logger['debug'](_0x3c5d('0xf'),_0xff43fd,_0x3c5d('0xe'),JSON['stringify'](_0x3b5a9e));if(_0x3b5a9e[_0x3c5d('0x10')]){if(_0x3b5a9e[_0x3c5d('0x10')]['code']===0x1f4){logger[_0x3c5d('0x10')](_0x3c5d('0xd'),_0xff43fd,_0x3b5a9e['error']['message']);return _0x1af421(_0x3b5a9e[_0x3c5d('0x10')]['message']);}logger[_0x3c5d('0x10')]('JscriptyProject,\x20%s,\x20%s',_0xff43fd,_0x3b5a9e['error'][_0x3c5d('0x11')]);return _0xc5d48e(_0x3b5a9e[_0x3c5d('0x10')][_0x3c5d('0x11')]);}else{logger[_0x3c5d('0x12')](_0x3c5d('0xd'),_0xff43fd,_0x3c5d('0xe'));_0xc5d48e(_0x3b5a9e[_0x3c5d('0x13')][_0x3c5d('0x11')]);}})['catch'](function(_0x286bc9){logger['error'](_0x3c5d('0xd'),_0xff43fd,_0x286bc9);_0x1af421(_0x286bc9);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index eb37321..46c9459 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 _0x250c=['Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','post','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x250c,0x8c));var _0xc250=function(_0x48493d,_0xd71ad1){_0x48493d=_0x48493d-0x0;var _0x2516d0=_0x250c[_0x48493d];return _0x2516d0;};'use strict';var multer=require(_0xc250('0x0'));var util=require('util');var path=require(_0xc250('0x1'));var timeout=require(_0xc250('0x2'));var express=require(_0xc250('0x3'));var router=express[_0xc250('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xc250('0x5'));var config=require(_0xc250('0x6'));var controller=require('./jscriptyQuestionReport.controller');router[_0xc250('0x7')]('/',auth[_0xc250('0x8')](),controller['index']);router['get']('/describe',auth[_0xc250('0x8')](),controller[_0xc250('0x9')]);router['get'](_0xc250('0xa'),auth['isAuthenticated'](),controller[_0xc250('0xb')]);router[_0xc250('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0xc250('0x8')](),controller['update']);router[_0xc250('0xd')]('/:id',auth[_0xc250('0x8')](),controller[_0xc250('0xe')]);module[_0xc250('0xf')]=router; \ No newline at end of file +var _0x0609=['/describe','show','post','create','put','delete','/:id','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x5f49a2,_0x54b7ed){var _0x2e49ac=function(_0x5d3c59){while(--_0x5d3c59){_0x5f49a2['push'](_0x5f49a2['shift']());}};_0x2e49ac(++_0x54b7ed);}(_0x0609,0x1c9));var _0x9060=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x0609[_0x3ff085];return _0x2b68c3;};'use strict';var multer=require(_0x9060('0x0'));var util=require(_0x9060('0x1'));var path=require(_0x9060('0x2'));var timeout=require(_0x9060('0x3'));var express=require(_0x9060('0x4'));var router=express[_0x9060('0x5')]();var auth=require(_0x9060('0x6'));var interaction=require(_0x9060('0x7'));var config=require(_0x9060('0x8'));var controller=require('./jscriptyQuestionReport.controller');router[_0x9060('0x9')]('/',auth[_0x9060('0xa')](),controller['index']);router[_0x9060('0x9')](_0x9060('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x9060('0x9')]('/:id',auth[_0x9060('0xa')](),controller[_0x9060('0xc')]);router[_0x9060('0xd')]('/',auth[_0x9060('0xa')](),controller[_0x9060('0xe')]);router[_0x9060('0xf')]('/:id',auth[_0x9060('0xa')](),controller['update']);router[_0x9060('0x10')](_0x9060('0x11'),auth[_0x9060('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index dac456e..a5194e0 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 _0x4a8e=['sequelize','exports','long','STRING'];(function(_0x3ebce5,_0x34ac95){var _0x24c895=function(_0x31fc66){while(--_0x31fc66){_0x3ebce5['push'](_0x3ebce5['shift']());}};_0x24c895(++_0x34ac95);}(_0x4a8e,0x98));var _0xe4a8=function(_0x1c6664,_0x45566e){_0x1c6664=_0x1c6664-0x0;var _0x33124b=_0x4a8e[_0x1c6664];return _0x33124b;};'use strict';var Sequelize=require(_0xe4a8('0x0'));module[_0xe4a8('0x1')]={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize['TEXT'](_0xe4a8('0x2'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xe4a8('0x3')]},'queue':{'type':Sequelize[_0xe4a8('0x3')]},'uniqueid':{'type':Sequelize[_0xe4a8('0x3')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize[_0xe4a8('0x3')]}}; \ No newline at end of file +var _0xa706=['long','exports','STRING','TEXT'];(function(_0x46ce18,_0x529b5a){var _0x1de18f=function(_0x4a476c){while(--_0x4a476c){_0x46ce18['push'](_0x46ce18['shift']());}};_0x1de18f(++_0x529b5a);}(_0xa706,0x159));var _0x6a70=function(_0x3824c0,_0x3e0954){_0x3824c0=_0x3824c0-0x0;var _0x3fb51c=_0xa706[_0x3824c0];return _0x3fb51c;};'use strict';var Sequelize=require('sequelize');module[_0x6a70('0x0')]={'question':{'type':Sequelize[_0x6a70('0x1')]},'answer':{'type':Sequelize[_0x6a70('0x2')](_0x6a70('0x3'))},'membername':{'type':Sequelize[_0x6a70('0x1')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x6a70('0x1')]},'calleridnum':{'type':Sequelize[_0x6a70('0x1')]},'questionId':{'type':Sequelize[_0x6a70('0x1')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index d372c79..78a4d89 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 _0x3a66=['intersection','attributes','fields','length','model','hasOwnProperty','limit','order','sort','where','pick','filters','merge','VIRTUAL','filter','then','include','rows','catch','includeAll','options','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','set','Content-Range','apply','reject','update','destroy','sendStatus','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','keys','query'];(function(_0x543bcc,_0x2a77fc){var _0x279cb5=function(_0x37ca65){while(--_0x37ca65){_0x543bcc['push'](_0x543bcc['shift']());}};_0x279cb5(++_0x2a77fc);}(_0x3a66,0x13d));var _0x63a6=function(_0x172133,_0x10246b){_0x172133=_0x172133-0x0;var _0x2460e5=_0x3a66[_0x172133];return _0x2460e5;};'use strict';var pdf=require(_0x63a6('0x0'));var emlformat=require(_0x63a6('0x1'));var rimraf=require(_0x63a6('0x2'));var zipdir=require(_0x63a6('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x63a6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x63a6('0x5'));var util=require(_0x63a6('0x6'));var path=require(_0x63a6('0x7'));var sox=require(_0x63a6('0x8'));var csv=require(_0x63a6('0x9'));var ejs=require(_0x63a6('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x63a6('0xb'));var crypto=require(_0x63a6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x63a6('0xd'));var toCsv=require('to-csv');var querystring=require(_0x63a6('0xe'));var Papa=require(_0x63a6('0xf'));var Redis=require(_0x63a6('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x63a6('0x11'));var as=require(_0x63a6('0x12'));var hardwareService=require(_0x63a6('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x63a6('0x14'));var config=require(_0x63a6('0x15'));var db=require(_0x63a6('0x16'))['db'];function respondWithStatusCode(_0x5b15b,_0x9d21fa){_0x9d21fa=_0x9d21fa||0xcc;return function(_0x31d6a8){if(_0x31d6a8){return _0x5b15b['sendStatus'](_0x9d21fa);}return _0x5b15b['status'](_0x9d21fa)[_0x63a6('0x17')]();};}function respondWithResult(_0x11139e,_0x44747d){_0x44747d=_0x44747d||0xc8;return function(_0x5d7c9b){if(_0x5d7c9b){return _0x11139e[_0x63a6('0x18')](_0x44747d)[_0x63a6('0x19')](_0x5d7c9b);}};}function respondWithFilteredResult(_0xec3704,_0x2eb5f6){return function(_0x580828){if(_0x580828){var _0xd62bf3=_0x580828[_0x63a6('0x1a')],_0x58ab77=_0x2eb5f6[_0x63a6('0x1b')],_0x48b38b=_0x2eb5f6['offset']+_0x2eb5f6['limit'],_0x5061bc;if(_0x48b38b>=_0xd62bf3){_0x48b38b=_0xd62bf3;_0x5061bc=0xc8;}else{_0x5061bc=0xce;}_0xec3704[_0x63a6('0x18')](_0x5061bc);return _0xec3704[_0x63a6('0x1c')](_0x63a6('0x1d'),_0x58ab77+'-'+_0x48b38b+'/'+_0xd62bf3)[_0x63a6('0x19')](_0x580828);}return null;};}function patchUpdates(_0x594b6b){return function(_0x14c8af){try{jsonpatch[_0x63a6('0x1e')](_0x14c8af,_0x594b6b,!![]);}catch(_0x4bd8f3){return BPromise[_0x63a6('0x1f')](_0x4bd8f3);}return _0x14c8af['save']();};}function saveUpdates(_0x1d222a,_0x13ebaa){return function(_0x445dc9){if(_0x445dc9){return _0x445dc9[_0x63a6('0x20')](_0x1d222a)['then'](function(_0x957582){return _0x957582;});}return null;};}function removeEntity(_0x41d5bc,_0x17d845){return function(_0x44543a){if(_0x44543a){return _0x44543a[_0x63a6('0x21')]()['then'](function(){_0x41d5bc[_0x63a6('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35b223,_0x3d4cdc){return function(_0x476ed1){if(!_0x476ed1){_0x35b223[_0x63a6('0x22')](0x194);}return _0x476ed1;};}function handleError(_0x2d3b34,_0x1a3968){_0x1a3968=_0x1a3968||0x1f4;return function(_0x3d7fd1){logger[_0x63a6('0x23')](_0x3d7fd1[_0x63a6('0x24')]);if(_0x3d7fd1[_0x63a6('0x25')]){delete _0x3d7fd1[_0x63a6('0x25')];}_0x2d3b34[_0x63a6('0x18')](_0x1a3968)[_0x63a6('0x26')](_0x3d7fd1);};}exports[_0x63a6('0x27')]=function(_0x146006,_0x2f6ff2){var _0x599f6a={},_0x5d029e={},_0x3dcf50={'count':0x0,'rows':[]};var _0xc959dd=_[_0x63a6('0x28')](db[_0x63a6('0x29')][_0x63a6('0x2a')],function(_0x3a29e2){return{'name':_0x3a29e2[_0x63a6('0x2b')],'type':_0x3a29e2[_0x63a6('0x2c')][_0x63a6('0x2d')]};});_0x5d029e['model']=_[_0x63a6('0x28')](_0xc959dd,'name');_0x5d029e['query']=_[_0x63a6('0x2e')](_0x146006[_0x63a6('0x2f')]);_0x5d029e['filters']=_[_0x63a6('0x30')](_0x5d029e['model'],_0x5d029e[_0x63a6('0x2f')]);_0x599f6a[_0x63a6('0x31')]=_['intersection'](_0x5d029e['model'],qs[_0x63a6('0x32')](_0x146006[_0x63a6('0x2f')][_0x63a6('0x32')]));_0x599f6a[_0x63a6('0x31')]=_0x599f6a[_0x63a6('0x31')][_0x63a6('0x33')]?_0x599f6a[_0x63a6('0x31')]:_0x5d029e[_0x63a6('0x34')];if(!_0x146006[_0x63a6('0x2f')][_0x63a6('0x35')]('nolimit')){_0x599f6a[_0x63a6('0x36')]=qs[_0x63a6('0x36')](_0x146006['query'][_0x63a6('0x36')]);_0x599f6a[_0x63a6('0x1b')]=qs['offset'](_0x146006[_0x63a6('0x2f')]['offset']);}_0x599f6a[_0x63a6('0x37')]=qs['sort'](_0x146006[_0x63a6('0x2f')][_0x63a6('0x38')]);_0x599f6a[_0x63a6('0x39')]=qs['filters'](_[_0x63a6('0x3a')](_0x146006[_0x63a6('0x2f')],_0x5d029e[_0x63a6('0x3b')]),_0xc959dd);if(_0x146006[_0x63a6('0x2f')]['filter']){_0x599f6a[_0x63a6('0x39')]=_[_0x63a6('0x3c')](_0x599f6a[_0x63a6('0x39')],{'$or':_[_0x63a6('0x28')](_0xc959dd,function(_0x31a375){if(_0x31a375[_0x63a6('0x2c')]!==_0x63a6('0x3d')){var _0x51fb2d={};_0x51fb2d[_0x31a375['name']]={'$like':'%'+_0x146006[_0x63a6('0x2f')][_0x63a6('0x3e')]+'%'};return _0x51fb2d;}})});}_0x599f6a=_[_0x63a6('0x3c')]({},_0x599f6a,_0x146006['options']);var _0x1b69b9={'where':_0x599f6a[_0x63a6('0x39')]};return db[_0x63a6('0x29')][_0x63a6('0x1a')](_0x1b69b9)[_0x63a6('0x3f')](function(_0x13a822){_0x3dcf50['count']=_0x13a822;if(_0x146006[_0x63a6('0x2f')]['includeAll']){_0x599f6a[_0x63a6('0x40')]=[{'all':!![]}];}return db[_0x63a6('0x29')]['findAll'](_0x599f6a);})[_0x63a6('0x3f')](function(_0x35cb84){_0x3dcf50[_0x63a6('0x41')]=_0x35cb84;return _0x3dcf50;})['then'](respondWithFilteredResult(_0x2f6ff2,_0x599f6a))[_0x63a6('0x42')](handleError(_0x2f6ff2,null));};exports['show']=function(_0x511e26,_0x38e179){var _0x26d740={'raw':!![],'where':{'id':_0x511e26['params']['id']}},_0x2c9ebb={};_0x2c9ebb['model']=_[_0x63a6('0x2e')](db[_0x63a6('0x29')][_0x63a6('0x2a')]);_0x2c9ebb[_0x63a6('0x2f')]=_['keys'](_0x511e26['query']);_0x2c9ebb[_0x63a6('0x3b')]=_[_0x63a6('0x30')](_0x2c9ebb[_0x63a6('0x34')],_0x2c9ebb['query']);_0x26d740['attributes']=_[_0x63a6('0x30')](_0x2c9ebb[_0x63a6('0x34')],qs[_0x63a6('0x32')](_0x511e26[_0x63a6('0x2f')][_0x63a6('0x32')]));_0x26d740[_0x63a6('0x31')]=_0x26d740[_0x63a6('0x31')]['length']?_0x26d740[_0x63a6('0x31')]:_0x2c9ebb[_0x63a6('0x34')];if(_0x511e26[_0x63a6('0x2f')][_0x63a6('0x43')]){_0x26d740[_0x63a6('0x40')]=[{'all':!![]}];}_0x26d740=_['merge']({},_0x26d740,_0x511e26[_0x63a6('0x44')]);return db[_0x63a6('0x29')]['find'](_0x26d740)[_0x63a6('0x3f')](handleEntityNotFound(_0x38e179,null))[_0x63a6('0x3f')](respondWithResult(_0x38e179,null))[_0x63a6('0x42')](handleError(_0x38e179,null));};exports[_0x63a6('0x45')]=function(_0x4f3e0e,_0x2b5268){return db['JscriptyQuestionReport'][_0x63a6('0x45')](_0x4f3e0e[_0x63a6('0x46')],{})[_0x63a6('0x3f')](respondWithResult(_0x2b5268,0xc9))[_0x63a6('0x42')](handleError(_0x2b5268,null));};exports[_0x63a6('0x20')]=function(_0x18bbc0,_0x5461a8){if(_0x18bbc0[_0x63a6('0x46')]['id']){delete _0x18bbc0[_0x63a6('0x46')]['id'];}return db[_0x63a6('0x29')]['find']({'where':{'id':_0x18bbc0['params']['id']}})[_0x63a6('0x3f')](handleEntityNotFound(_0x5461a8,null))[_0x63a6('0x3f')](saveUpdates(_0x18bbc0['body'],null))[_0x63a6('0x3f')](respondWithResult(_0x5461a8,null))['catch'](handleError(_0x5461a8,null));};exports[_0x63a6('0x21')]=function(_0x5d65b9,_0x4d21e2){return db[_0x63a6('0x29')][_0x63a6('0x47')]({'where':{'id':_0x5d65b9['params']['id']}})[_0x63a6('0x3f')](handleEntityNotFound(_0x4d21e2,null))[_0x63a6('0x3f')](removeEntity(_0x4d21e2,null))['catch'](handleError(_0x4d21e2,null));};exports[_0x63a6('0x48')]=function(_0x562c94,_0x2b9f1f){return db[_0x63a6('0x29')][_0x63a6('0x48')]()['then'](respondWithResult(_0x2b9f1f,null))[_0x63a6('0x42')](handleError(_0x2b9f1f,null));}; \ No newline at end of file +var _0x9b9b=['json','offset','limit','set','Content-Range','apply','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','nolimit','sort','where','filters','filter','merge','JscriptyQuestionReport','count','include','findAll','rows','catch','show','includeAll','options','find','create','body','describe','html-pdf','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x3ca6f6,_0x3e9153){var _0x5e24d6=function(_0x45078d){while(--_0x45078d){_0x3ca6f6['push'](_0x3ca6f6['shift']());}};_0x5e24d6(++_0x3e9153);}(_0x9b9b,0x146));var _0xb9b9=function(_0x115d8d,_0xacde78){_0x115d8d=_0x115d8d-0x0;var _0x250c76=_0x9b9b[_0x115d8d];return _0x250c76;};'use strict';var pdf=require(_0xb9b9('0x0'));var emlformat=require(_0xb9b9('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb9b9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb9b9('0x3'));var moment=require('moment');var BPromise=require(_0xb9b9('0x4'));var Mustache=require(_0xb9b9('0x5'));var util=require(_0xb9b9('0x6'));var path=require(_0xb9b9('0x7'));var sox=require(_0xb9b9('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xb9b9('0x9'));var crypto=require(_0xb9b9('0xa'));var jsforce=require(_0xb9b9('0xb'));var deskjs=require(_0xb9b9('0xc'));var toCsv=require(_0xb9b9('0xd'));var querystring=require(_0xb9b9('0xe'));var Papa=require('papaparse');var Redis=require(_0xb9b9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb9b9('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb9b9('0x11'));var logger=require(_0xb9b9('0x12'))('api');var utils=require(_0xb9b9('0x13'));var config=require(_0xb9b9('0x14'));var db=require(_0xb9b9('0x15'))['db'];function respondWithStatusCode(_0x44abcf,_0x230c31){_0x230c31=_0x230c31||0xcc;return function(_0x655a71){if(_0x655a71){return _0x44abcf[_0xb9b9('0x16')](_0x230c31);}return _0x44abcf[_0xb9b9('0x17')](_0x230c31)['end']();};}function respondWithResult(_0x24da77,_0x29b314){_0x29b314=_0x29b314||0xc8;return function(_0x4a60ae){if(_0x4a60ae){return _0x24da77[_0xb9b9('0x17')](_0x29b314)[_0xb9b9('0x18')](_0x4a60ae);}};}function respondWithFilteredResult(_0x263c44,_0x3932b9){return function(_0x3d759b){if(_0x3d759b){var _0x1dac79=_0x3d759b['count'],_0xa4f62b=_0x3932b9[_0xb9b9('0x19')],_0x4639de=_0x3932b9[_0xb9b9('0x19')]+_0x3932b9[_0xb9b9('0x1a')],_0xab76f1;if(_0x4639de>=_0x1dac79){_0x4639de=_0x1dac79;_0xab76f1=0xc8;}else{_0xab76f1=0xce;}_0x263c44['status'](_0xab76f1);return _0x263c44[_0xb9b9('0x1b')](_0xb9b9('0x1c'),_0xa4f62b+'-'+_0x4639de+'/'+_0x1dac79)[_0xb9b9('0x18')](_0x3d759b);}return null;};}function patchUpdates(_0x228b58){return function(_0x45ff39){try{jsonpatch[_0xb9b9('0x1d')](_0x45ff39,_0x228b58,!![]);}catch(_0x541508){return BPromise['reject'](_0x541508);}return _0x45ff39['save']();};}function saveUpdates(_0x1ad2fe,_0x14ec3e){return function(_0x1cd15a){if(_0x1cd15a){return _0x1cd15a[_0xb9b9('0x1e')](_0x1ad2fe)[_0xb9b9('0x1f')](function(_0x340d45){return _0x340d45;});}return null;};}function removeEntity(_0x5c2e72,_0x30e0f3){return function(_0x29192b){if(_0x29192b){return _0x29192b[_0xb9b9('0x20')]()['then'](function(){_0x5c2e72['status'](0xcc)[_0xb9b9('0x21')]();});}};}function handleEntityNotFound(_0x4988e0,_0x519ce4){return function(_0x136765){if(!_0x136765){_0x4988e0[_0xb9b9('0x16')](0x194);}return _0x136765;};}function handleError(_0x5db5c5,_0x14608b){_0x14608b=_0x14608b||0x1f4;return function(_0x4122b8){logger[_0xb9b9('0x22')](_0x4122b8[_0xb9b9('0x23')]);if(_0x4122b8[_0xb9b9('0x24')]){delete _0x4122b8[_0xb9b9('0x24')];}_0x5db5c5[_0xb9b9('0x17')](_0x14608b)[_0xb9b9('0x25')](_0x4122b8);};}exports[_0xb9b9('0x26')]=function(_0x2a8f2a,_0x42eb0e){var _0x3b2e66={},_0x647dc5={},_0x5896e9={'count':0x0,'rows':[]};var _0x3721bc=_[_0xb9b9('0x27')](db['JscriptyQuestionReport'][_0xb9b9('0x28')],function(_0x33e651){return{'name':_0x33e651[_0xb9b9('0x29')],'type':_0x33e651[_0xb9b9('0x2a')][_0xb9b9('0x2b')]};});_0x647dc5[_0xb9b9('0x2c')]=_[_0xb9b9('0x27')](_0x3721bc,_0xb9b9('0x24'));_0x647dc5['query']=_[_0xb9b9('0x2d')](_0x2a8f2a[_0xb9b9('0x2e')]);_0x647dc5['filters']=_['intersection'](_0x647dc5[_0xb9b9('0x2c')],_0x647dc5[_0xb9b9('0x2e')]);_0x3b2e66[_0xb9b9('0x2f')]=_[_0xb9b9('0x30')](_0x647dc5['model'],qs[_0xb9b9('0x31')](_0x2a8f2a[_0xb9b9('0x2e')][_0xb9b9('0x31')]));_0x3b2e66['attributes']=_0x3b2e66[_0xb9b9('0x2f')][_0xb9b9('0x32')]?_0x3b2e66[_0xb9b9('0x2f')]:_0x647dc5[_0xb9b9('0x2c')];if(!_0x2a8f2a[_0xb9b9('0x2e')]['hasOwnProperty'](_0xb9b9('0x33'))){_0x3b2e66[_0xb9b9('0x1a')]=qs[_0xb9b9('0x1a')](_0x2a8f2a[_0xb9b9('0x2e')]['limit']);_0x3b2e66[_0xb9b9('0x19')]=qs[_0xb9b9('0x19')](_0x2a8f2a[_0xb9b9('0x2e')][_0xb9b9('0x19')]);}_0x3b2e66['order']=qs[_0xb9b9('0x34')](_0x2a8f2a[_0xb9b9('0x2e')][_0xb9b9('0x34')]);_0x3b2e66[_0xb9b9('0x35')]=qs[_0xb9b9('0x36')](_['pick'](_0x2a8f2a['query'],_0x647dc5[_0xb9b9('0x36')]),_0x3721bc);if(_0x2a8f2a[_0xb9b9('0x2e')][_0xb9b9('0x37')]){_0x3b2e66[_0xb9b9('0x35')]=_[_0xb9b9('0x38')](_0x3b2e66[_0xb9b9('0x35')],{'$or':_['map'](_0x3721bc,function(_0x21cf31){if(_0x21cf31[_0xb9b9('0x2a')]!=='VIRTUAL'){var _0x2337eb={};_0x2337eb[_0x21cf31['name']]={'$like':'%'+_0x2a8f2a['query'][_0xb9b9('0x37')]+'%'};return _0x2337eb;}})});}_0x3b2e66=_[_0xb9b9('0x38')]({},_0x3b2e66,_0x2a8f2a['options']);var _0xeec36a={'where':_0x3b2e66[_0xb9b9('0x35')]};return db[_0xb9b9('0x39')]['count'](_0xeec36a)[_0xb9b9('0x1f')](function(_0x15c585){_0x5896e9[_0xb9b9('0x3a')]=_0x15c585;if(_0x2a8f2a['query']['includeAll']){_0x3b2e66[_0xb9b9('0x3b')]=[{'all':!![]}];}return db[_0xb9b9('0x39')][_0xb9b9('0x3c')](_0x3b2e66);})[_0xb9b9('0x1f')](function(_0x1772ea){_0x5896e9[_0xb9b9('0x3d')]=_0x1772ea;return _0x5896e9;})['then'](respondWithFilteredResult(_0x42eb0e,_0x3b2e66))[_0xb9b9('0x3e')](handleError(_0x42eb0e,null));};exports[_0xb9b9('0x3f')]=function(_0x473b43,_0x546a66){var _0x3493c1={'raw':!![],'where':{'id':_0x473b43['params']['id']}},_0x45eb0f={};_0x45eb0f[_0xb9b9('0x2c')]=_[_0xb9b9('0x2d')](db[_0xb9b9('0x39')]['rawAttributes']);_0x45eb0f[_0xb9b9('0x2e')]=_[_0xb9b9('0x2d')](_0x473b43['query']);_0x45eb0f[_0xb9b9('0x36')]=_['intersection'](_0x45eb0f[_0xb9b9('0x2c')],_0x45eb0f[_0xb9b9('0x2e')]);_0x3493c1[_0xb9b9('0x2f')]=_[_0xb9b9('0x30')](_0x45eb0f['model'],qs['fields'](_0x473b43[_0xb9b9('0x2e')]['fields']));_0x3493c1[_0xb9b9('0x2f')]=_0x3493c1[_0xb9b9('0x2f')][_0xb9b9('0x32')]?_0x3493c1['attributes']:_0x45eb0f['model'];if(_0x473b43['query'][_0xb9b9('0x40')]){_0x3493c1[_0xb9b9('0x3b')]=[{'all':!![]}];}_0x3493c1=_['merge']({},_0x3493c1,_0x473b43[_0xb9b9('0x41')]);return db['JscriptyQuestionReport'][_0xb9b9('0x42')](_0x3493c1)['then'](handleEntityNotFound(_0x546a66,null))[_0xb9b9('0x1f')](respondWithResult(_0x546a66,null))[_0xb9b9('0x3e')](handleError(_0x546a66,null));};exports['create']=function(_0x3a2dc1,_0x251dcb){return db[_0xb9b9('0x39')][_0xb9b9('0x43')](_0x3a2dc1[_0xb9b9('0x44')],{})[_0xb9b9('0x1f')](respondWithResult(_0x251dcb,0xc9))[_0xb9b9('0x3e')](handleError(_0x251dcb,null));};exports[_0xb9b9('0x1e')]=function(_0x2fd6c2,_0x2a830e){if(_0x2fd6c2['body']['id']){delete _0x2fd6c2[_0xb9b9('0x44')]['id'];}return db[_0xb9b9('0x39')][_0xb9b9('0x42')]({'where':{'id':_0x2fd6c2['params']['id']}})[_0xb9b9('0x1f')](handleEntityNotFound(_0x2a830e,null))['then'](saveUpdates(_0x2fd6c2[_0xb9b9('0x44')],null))[_0xb9b9('0x1f')](respondWithResult(_0x2a830e,null))[_0xb9b9('0x3e')](handleError(_0x2a830e,null));};exports[_0xb9b9('0x20')]=function(_0x4da22d,_0x256e43){return db[_0xb9b9('0x39')]['find']({'where':{'id':_0x4da22d['params']['id']}})['then'](handleEntityNotFound(_0x256e43,null))['then'](removeEntity(_0x256e43,null))[_0xb9b9('0x3e')](handleError(_0x256e43,null));};exports[_0xb9b9('0x45')]=function(_0x301717,_0x89d825){return db[_0xb9b9('0x39')][_0xb9b9('0x45')]()[_0xb9b9('0x1f')](respondWithResult(_0x89d825,null))[_0xb9b9('0x3e')](handleError(_0x89d825,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index b79ed63..1342e0e 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 _0x8512=['report_jscripty_questions','util','../../config/logger','api','moment','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport'];(function(_0x445f59,_0x487385){var _0xc513f3=function(_0x43685d){while(--_0x43685d){_0x445f59['push'](_0x445f59['shift']());}};_0xc513f3(++_0x487385);}(_0x8512,0x6f));var _0x2851=function(_0xae513f,_0x483fd1){_0xae513f=_0xae513f-0x0;var _0x39fd4f=_0x8512[_0xae513f];return _0x39fd4f;};'use strict';var _=require('lodash');var util=require(_0x2851('0x0'));var logger=require(_0x2851('0x1'))(_0x2851('0x2'));var moment=require(_0x2851('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2851('0x4'));var config=require(_0x2851('0x5'));var attributes=require(_0x2851('0x6'));module[_0x2851('0x7')]=function(_0x3fd78e,_0x1a4024){return _0x3fd78e[_0x2851('0x8')](_0x2851('0x9'),attributes,{'tableName':_0x2851('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9474=['./jscriptyQuestionReport.attributes','exports','define','report_jscripty_questions','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9474,0x184));var _0x4947=function(_0x4e074e,_0x35a42e){_0x4e074e=_0x4e074e-0x0;var _0x1fb96a=_0x9474[_0x4e074e];return _0x1fb96a;};'use strict';var _=require(_0x4947('0x0'));var util=require(_0x4947('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4947('0x2'));var BPromise=require(_0x4947('0x3'));var rp=require(_0x4947('0x4'));var fs=require('fs');var path=require(_0x4947('0x5'));var rimraf=require(_0x4947('0x6'));var config=require(_0x4947('0x7'));var attributes=require(_0x4947('0x8'));module[_0x4947('0x9')]=function(_0x32570c,_0x599850){return _0x32570c[_0x4947('0xa')]('JscriptyQuestionReport',attributes,{'tableName':_0x4947('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 61b84b3..ace1da9 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 _0x8816=['error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2c1114,_0x2a5c50){var _0x2b877c=function(_0x4f356d){while(--_0x4f356d){_0x2c1114['push'](_0x2c1114['shift']());}};_0x2b877c(++_0x2a5c50);}(_0x8816,0x155));var _0x6881=function(_0x2b17d0,_0x5431d8){_0x2b17d0=_0x2b17d0-0x0;var _0x287b77=_0x8816[_0x2b17d0];return _0x287b77;};'use strict';var _=require(_0x6881('0x0'));var util=require(_0x6881('0x1'));var moment=require('moment');var BPromise=require(_0x6881('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6881('0x3'));var db=require(_0x6881('0x4'))['db'];var utils=require(_0x6881('0x5'));var logger=require('../../config/logger')(_0x6881('0x6'));var config=require(_0x6881('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6881('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x20c165,_0x28d33a,_0x350a8e){return new BPromise(function(_0x454333,_0x641d4d){return client[_0x6881('0x9')](_0x20c165,_0x350a8e)[_0x6881('0xa')](function(_0x3d3fdb){logger[_0x6881('0xb')](_0x6881('0xc'),_0x28d33a,_0x6881('0xd'));logger['debug'](_0x6881('0xe'),_0x28d33a,_0x6881('0xd'),JSON[_0x6881('0xf')](_0x3d3fdb));if(_0x3d3fdb['error']){if(_0x3d3fdb[_0x6881('0x10')][_0x6881('0x11')]===0x1f4){logger[_0x6881('0x10')](_0x6881('0xc'),_0x28d33a,_0x3d3fdb['error'][_0x6881('0x12')]);return _0x641d4d(_0x3d3fdb[_0x6881('0x10')][_0x6881('0x12')]);}logger[_0x6881('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x28d33a,_0x3d3fdb[_0x6881('0x10')][_0x6881('0x12')]);return _0x454333(_0x3d3fdb[_0x6881('0x10')][_0x6881('0x12')]);}else{logger[_0x6881('0xb')](_0x6881('0xc'),_0x28d33a,'request\x20sent');_0x454333(_0x3d3fdb[_0x6881('0x13')][_0x6881('0x12')]);}})[_0x6881('0x14')](function(_0x13580b){logger[_0x6881('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x28d33a,_0x13580b);_0x641d4d(_0x13580b);});});} \ No newline at end of file +var _0x4b8a=['request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x3dd92b,_0x4d1139){var _0x5e1d23=function(_0x5d866f){while(--_0x5d866f){_0x3dd92b['push'](_0x3dd92b['shift']());}};_0x5e1d23(++_0x4d1139);}(_0x4b8a,0x1ec));var _0xa4b8=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4b8a[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xa4b8('0x0'));var util=require(_0xa4b8('0x1'));var moment=require(_0xa4b8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa4b8('0x3'));var db=require(_0xa4b8('0x4'))['db'];var utils=require(_0xa4b8('0x5'));var logger=require(_0xa4b8('0x6'))(_0xa4b8('0x7'));var config=require(_0xa4b8('0x8'));var jayson=require(_0xa4b8('0x9'));var client=jayson[_0xa4b8('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32c189,_0x3795ed,_0x3446c7){return new BPromise(function(_0x151e90,_0x2be29e){return client[_0xa4b8('0xb')](_0x32c189,_0x3446c7)[_0xa4b8('0xc')](function(_0x99f7cb){logger[_0xa4b8('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3795ed,_0xa4b8('0xe'));logger['debug'](_0xa4b8('0xf'),_0x3795ed,_0xa4b8('0xe'),JSON[_0xa4b8('0x10')](_0x99f7cb));if(_0x99f7cb[_0xa4b8('0x11')]){if(_0x99f7cb[_0xa4b8('0x11')][_0xa4b8('0x12')]===0x1f4){logger[_0xa4b8('0x11')](_0xa4b8('0x13'),_0x3795ed,_0x99f7cb[_0xa4b8('0x11')][_0xa4b8('0x14')]);return _0x2be29e(_0x99f7cb['error']['message']);}logger[_0xa4b8('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3795ed,_0x99f7cb['error'][_0xa4b8('0x14')]);return _0x151e90(_0x99f7cb[_0xa4b8('0x11')][_0xa4b8('0x14')]);}else{logger['info'](_0xa4b8('0x13'),_0x3795ed,_0xa4b8('0xe'));_0x151e90(_0x99f7cb[_0xa4b8('0x15')]['message']);}})[_0xa4b8('0x16')](function(_0x584e70){logger[_0xa4b8('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3795ed,_0x584e70);_0x2be29e(_0x584e70);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index e91317f..72e74af 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 _0x6ddd=['isAuthenticated','index','get','describe','/:id','show','/:id/questions','getQuestions','post','create','put','update','destroy','exports','path','connect-timeout','express','Router','../../components/interaction/service','./jscriptySessionReport.controller'];(function(_0x41e81d,_0x2be61e){var _0x40292d=function(_0xbef560){while(--_0xbef560){_0x41e81d['push'](_0x41e81d['shift']());}};_0x40292d(++_0x2be61e);}(_0x6ddd,0xae));var _0xd6dd=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x6ddd[_0x465028];return _0xb783d4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd6dd('0x0'));var timeout=require(_0xd6dd('0x1'));var express=require(_0xd6dd('0x2'));var router=express[_0xd6dd('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xd6dd('0x4'));var config=require('../../config/environment');var controller=require(_0xd6dd('0x5'));router['get']('/',auth[_0xd6dd('0x6')](),controller[_0xd6dd('0x7')]);router[_0xd6dd('0x8')]('/describe',auth[_0xd6dd('0x6')](),controller[_0xd6dd('0x9')]);router[_0xd6dd('0x8')](_0xd6dd('0xa'),auth['isAuthenticated'](),controller[_0xd6dd('0xb')]);router[_0xd6dd('0x8')](_0xd6dd('0xc'),auth[_0xd6dd('0x6')](),controller[_0xd6dd('0xd')]);router[_0xd6dd('0xe')]('/',auth[_0xd6dd('0x6')](),controller[_0xd6dd('0xf')]);router[_0xd6dd('0x10')](_0xd6dd('0xa'),auth[_0xd6dd('0x6')](),controller[_0xd6dd('0x11')]);router['delete'](_0xd6dd('0xa'),auth[_0xd6dd('0x6')](),controller[_0xd6dd('0x12')]);module[_0xd6dd('0x13')]=router; \ No newline at end of file +var _0xb7fc=['/:id/questions','post','create','put','/:id','delete','destroy','exports','multer','connect-timeout','express','Router','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','describe','show'];(function(_0x10c174,_0x2cf333){var _0x4d4464=function(_0x33db2d){while(--_0x33db2d){_0x10c174['push'](_0x10c174['shift']());}};_0x4d4464(++_0x2cf333);}(_0xb7fc,0x1e3));var _0xcb7f=function(_0x4f6afc,_0x4dfa88){_0x4f6afc=_0x4f6afc-0x0;var _0x256eeb=_0xb7fc[_0x4f6afc];return _0x256eeb;};'use strict';var multer=require(_0xcb7f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xcb7f('0x1'));var express=require(_0xcb7f('0x2'));var router=express[_0xcb7f('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcb7f('0x4'));var controller=require(_0xcb7f('0x5'));router[_0xcb7f('0x6')]('/',auth[_0xcb7f('0x7')](),controller[_0xcb7f('0x8')]);router[_0xcb7f('0x6')]('/describe',auth[_0xcb7f('0x7')](),controller[_0xcb7f('0x9')]);router[_0xcb7f('0x6')]('/:id',auth[_0xcb7f('0x7')](),controller[_0xcb7f('0xa')]);router['get'](_0xcb7f('0xb'),auth[_0xcb7f('0x7')](),controller['getQuestions']);router[_0xcb7f('0xc')]('/',auth[_0xcb7f('0x7')](),controller[_0xcb7f('0xd')]);router[_0xcb7f('0xe')](_0xcb7f('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xcb7f('0x10')](_0xcb7f('0xf'),auth[_0xcb7f('0x7')](),controller[_0xcb7f('0x11')]);module[_0xcb7f('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 1521db0..a5e9130 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 _0x8903=['starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','sequelize','exports','DATE','setDataValue'];(function(_0x8a5a59,_0x1a9f88){var _0xe6f700=function(_0x55b3d0){while(--_0x55b3d0){_0x8a5a59['push'](_0x8a5a59['shift']());}};_0xe6f700(++_0x1a9f88);}(_0x8903,0x18c));var _0x3890=function(_0x49d48d,_0xf1fdaa){_0x49d48d=_0x49d48d-0x0;var _0x46e093=_0x8903[_0x49d48d];return _0x46e093;};'use strict';var moment=require('moment');var Sequelize=require(_0x3890('0x0'));module[_0x3890('0x1')]={'starttime':{'type':Sequelize[_0x3890('0x2')],'set':function(_0x1d4f3f){this[_0x3890('0x3')](_0x3890('0x4'),_0x1d4f3f);this[_0x3890('0x3')](_0x3890('0x5'),moment()[_0x3890('0x6')](_0x3890('0x7')));}},'endtime':{'type':Sequelize[_0x3890('0x2')]},'membername':{'type':Sequelize[_0x3890('0x8')]},'projectname':{'type':Sequelize[_0x3890('0x8')]},'queue':{'type':Sequelize[_0x3890('0x8')]},'uniqueid':{'type':Sequelize[_0x3890('0x8')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x3890('0x8')]},'completed':{'type':Sequelize[_0x3890('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0x47cb=['endtime','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','DATE','setDataValue','starttime'];(function(_0x3050ca,_0x3e36b0){var _0x1eed1d=function(_0x195e8f){while(--_0x195e8f){_0x3050ca['push'](_0x3050ca['shift']());}};_0x1eed1d(++_0x3e36b0);}(_0x47cb,0xbc));var _0xb47c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x47cb[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xb47c('0x0'));var Sequelize=require('sequelize');module['exports']={'starttime':{'type':Sequelize[_0xb47c('0x1')],'set':function(_0x3c5a63){this[_0xb47c('0x2')](_0xb47c('0x3'),_0x3c5a63);this[_0xb47c('0x2')](_0xb47c('0x4'),moment()['format'](_0xb47c('0x5')));}},'endtime':{'type':Sequelize[_0xb47c('0x1')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xb47c('0x6')]},'queue':{'type':Sequelize[_0xb47c('0x6')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xb47c('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0xb47c('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 6e76712..90a2767 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 _0x5be1=['filter','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','length','merge','find','create','body','update','params','describe','getQuestions','JscriptyQuestionReport','pick','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','json','apply','save','destroy','error','stack','name','send','map','JscriptySessionReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x154fe9,_0x1119d4){var _0x5def50=function(_0x41fbef){while(--_0x41fbef){_0x154fe9['push'](_0x154fe9['shift']());}};_0x5def50(++_0x1119d4);}(_0x5be1,0x145));var _0x15be=function(_0x5f23e4,_0xcce779){_0x5f23e4=_0x5f23e4-0x0;var _0x40c0ea=_0x5be1[_0x5f23e4];return _0x40c0ea;};'use strict';var pdf=require(_0x15be('0x0'));var emlformat=require(_0x15be('0x1'));var rimraf=require(_0x15be('0x2'));var zipdir=require(_0x15be('0x3'));var jsonpatch=require(_0x15be('0x4'));var rp=require(_0x15be('0x5'));var moment=require(_0x15be('0x6'));var BPromise=require(_0x15be('0x7'));var Mustache=require('mustache');var util=require(_0x15be('0x8'));var path=require('path');var sox=require(_0x15be('0x9'));var csv=require(_0x15be('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x15be('0xb'));var squel=require(_0x15be('0xc'));var crypto=require(_0x15be('0xd'));var jsforce=require(_0x15be('0xe'));var deskjs=require(_0x15be('0xf'));var toCsv=require(_0x15be('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x15be('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x15be('0x11'));var hardwareService=require(_0x15be('0x12'));var logger=require(_0x15be('0x13'))(_0x15be('0x14'));var utils=require(_0x15be('0x15'));var config=require(_0x15be('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a3d94,_0xba3620){_0xba3620=_0xba3620||0xcc;return function(_0x4e230b){if(_0x4e230b){return _0x5a3d94[_0x15be('0x17')](_0xba3620);}return _0x5a3d94[_0x15be('0x18')](_0xba3620)[_0x15be('0x19')]();};}function respondWithResult(_0x21588f,_0x62f57a){_0x62f57a=_0x62f57a||0xc8;return function(_0x4a2900){if(_0x4a2900){return _0x21588f[_0x15be('0x18')](_0x62f57a)['json'](_0x4a2900);}};}function respondWithFilteredResult(_0x29621d,_0x5df5b8){return function(_0x301493){if(_0x301493){var _0x95a273=_0x301493[_0x15be('0x1a')],_0x34c296=_0x5df5b8[_0x15be('0x1b')],_0x1fc220=_0x5df5b8['offset']+_0x5df5b8[_0x15be('0x1c')],_0x4a0d9b;if(_0x1fc220>=_0x95a273){_0x1fc220=_0x95a273;_0x4a0d9b=0xc8;}else{_0x4a0d9b=0xce;}_0x29621d['status'](_0x4a0d9b);return _0x29621d['set']('Content-Range',_0x34c296+'-'+_0x1fc220+'/'+_0x95a273)[_0x15be('0x1d')](_0x301493);}return null;};}function patchUpdates(_0x50d192){return function(_0x41e474){try{jsonpatch[_0x15be('0x1e')](_0x41e474,_0x50d192,!![]);}catch(_0x4a3394){return BPromise['reject'](_0x4a3394);}return _0x41e474[_0x15be('0x1f')]();};}function saveUpdates(_0x1a88e6,_0x49885c){return function(_0x8e9b16){if(_0x8e9b16){return _0x8e9b16['update'](_0x1a88e6)['then'](function(_0x246d33){return _0x246d33;});}return null;};}function removeEntity(_0x164a91,_0x145ee1){return function(_0x1a01e7){if(_0x1a01e7){return _0x1a01e7[_0x15be('0x20')]()['then'](function(){_0x164a91[_0x15be('0x18')](0xcc)[_0x15be('0x19')]();});}};}function handleEntityNotFound(_0x52e6b8,_0x3573c3){return function(_0x3d8581){if(!_0x3d8581){_0x52e6b8[_0x15be('0x17')](0x194);}return _0x3d8581;};}function handleError(_0x260d5a,_0x4dcadd){_0x4dcadd=_0x4dcadd||0x1f4;return function(_0x449ce9){logger[_0x15be('0x21')](_0x449ce9[_0x15be('0x22')]);if(_0x449ce9[_0x15be('0x23')]){delete _0x449ce9[_0x15be('0x23')];}_0x260d5a[_0x15be('0x18')](_0x4dcadd)[_0x15be('0x24')](_0x449ce9);};}exports['index']=function(_0x315ed7,_0x5e7d5e){var _0x45bcdb={},_0x22914f={},_0x5d5ceb={'count':0x0,'rows':[]};var _0x19f2bf=_[_0x15be('0x25')](db[_0x15be('0x26')][_0x15be('0x27')],function(_0x354f59){return{'name':_0x354f59[_0x15be('0x28')],'type':_0x354f59[_0x15be('0x29')][_0x15be('0x2a')]};});_0x22914f['model']=_[_0x15be('0x25')](_0x19f2bf,_0x15be('0x23'));_0x22914f[_0x15be('0x2b')]=_[_0x15be('0x2c')](_0x315ed7[_0x15be('0x2b')]);_0x22914f[_0x15be('0x2d')]=_[_0x15be('0x2e')](_0x22914f[_0x15be('0x2f')],_0x22914f['query']);_0x45bcdb[_0x15be('0x30')]=_['intersection'](_0x22914f[_0x15be('0x2f')],qs['fields'](_0x315ed7['query'][_0x15be('0x31')]));_0x45bcdb['attributes']=_0x45bcdb[_0x15be('0x30')]['length']?_0x45bcdb['attributes']:_0x22914f[_0x15be('0x2f')];if(!_0x315ed7[_0x15be('0x2b')][_0x15be('0x32')](_0x15be('0x33'))){_0x45bcdb[_0x15be('0x1c')]=qs[_0x15be('0x1c')](_0x315ed7[_0x15be('0x2b')][_0x15be('0x1c')]);_0x45bcdb[_0x15be('0x1b')]=qs['offset'](_0x315ed7['query'][_0x15be('0x1b')]);}_0x45bcdb[_0x15be('0x34')]=qs[_0x15be('0x35')](_0x315ed7[_0x15be('0x2b')]['sort']);_0x45bcdb[_0x15be('0x36')]=qs[_0x15be('0x2d')](_['pick'](_0x315ed7[_0x15be('0x2b')],_0x22914f[_0x15be('0x2d')]),_0x19f2bf);if(_0x315ed7[_0x15be('0x2b')][_0x15be('0x37')]){_0x45bcdb[_0x15be('0x36')]=_['merge'](_0x45bcdb[_0x15be('0x36')],{'$or':_[_0x15be('0x25')](_0x19f2bf,function(_0x3ce160){if(_0x3ce160['type']!==_0x15be('0x38')){var _0x12a4ef={};_0x12a4ef[_0x3ce160[_0x15be('0x23')]]={'$like':'%'+_0x315ed7['query']['filter']+'%'};return _0x12a4ef;}})});}_0x45bcdb=_['merge']({},_0x45bcdb,_0x315ed7[_0x15be('0x39')]);var _0x7ff768={'where':_0x45bcdb[_0x15be('0x36')]};return db[_0x15be('0x26')][_0x15be('0x1a')](_0x7ff768)[_0x15be('0x3a')](function(_0x50c148){_0x5d5ceb[_0x15be('0x1a')]=_0x50c148;if(_0x315ed7[_0x15be('0x2b')][_0x15be('0x3b')]){_0x45bcdb[_0x15be('0x3c')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x15be('0x3d')](_0x45bcdb);})[_0x15be('0x3a')](function(_0xf0a105){_0x5d5ceb[_0x15be('0x3e')]=_0xf0a105;return _0x5d5ceb;})[_0x15be('0x3a')](respondWithFilteredResult(_0x5e7d5e,_0x45bcdb))[_0x15be('0x3f')](handleError(_0x5e7d5e,null));};exports[_0x15be('0x40')]=function(_0x4414a9,_0x693b1b){var _0x314b59={'raw':!![],'where':{'id':_0x4414a9['params']['id']}},_0x43bb77={};_0x43bb77[_0x15be('0x2f')]=_[_0x15be('0x2c')](db['JscriptySessionReport'][_0x15be('0x27')]);_0x43bb77['query']=_[_0x15be('0x2c')](_0x4414a9[_0x15be('0x2b')]);_0x43bb77['filters']=_[_0x15be('0x2e')](_0x43bb77[_0x15be('0x2f')],_0x43bb77[_0x15be('0x2b')]);_0x314b59['attributes']=_[_0x15be('0x2e')](_0x43bb77[_0x15be('0x2f')],qs[_0x15be('0x31')](_0x4414a9[_0x15be('0x2b')][_0x15be('0x31')]));_0x314b59['attributes']=_0x314b59[_0x15be('0x30')][_0x15be('0x41')]?_0x314b59['attributes']:_0x43bb77['model'];if(_0x4414a9[_0x15be('0x2b')][_0x15be('0x3b')]){_0x314b59[_0x15be('0x3c')]=[{'all':!![]}];}_0x314b59=_[_0x15be('0x42')]({},_0x314b59,_0x4414a9[_0x15be('0x39')]);return db[_0x15be('0x26')][_0x15be('0x43')](_0x314b59)[_0x15be('0x3a')](handleEntityNotFound(_0x693b1b,null))['then'](respondWithResult(_0x693b1b,null))[_0x15be('0x3f')](handleError(_0x693b1b,null));};exports[_0x15be('0x44')]=function(_0x43b2c9,_0x59de44){return db[_0x15be('0x26')][_0x15be('0x44')](_0x43b2c9[_0x15be('0x45')],{})[_0x15be('0x3a')](respondWithResult(_0x59de44,0xc9))['catch'](handleError(_0x59de44,null));};exports[_0x15be('0x46')]=function(_0x4d5dc3,_0x934dc0){if(_0x4d5dc3[_0x15be('0x45')]['id']){delete _0x4d5dc3[_0x15be('0x45')]['id'];}return db[_0x15be('0x26')]['find']({'where':{'id':_0x4d5dc3[_0x15be('0x47')]['id']}})[_0x15be('0x3a')](handleEntityNotFound(_0x934dc0,null))[_0x15be('0x3a')](saveUpdates(_0x4d5dc3[_0x15be('0x45')],null))['then'](respondWithResult(_0x934dc0,null))[_0x15be('0x3f')](handleError(_0x934dc0,null));};exports[_0x15be('0x20')]=function(_0x448cdb,_0xbbe1da){return db['JscriptySessionReport'][_0x15be('0x43')]({'where':{'id':_0x448cdb[_0x15be('0x47')]['id']}})[_0x15be('0x3a')](handleEntityNotFound(_0xbbe1da,null))[_0x15be('0x3a')](removeEntity(_0xbbe1da,null))['catch'](handleError(_0xbbe1da,null));};exports[_0x15be('0x48')]=function(_0x2fbbc5,_0x50bf4b){return db[_0x15be('0x26')][_0x15be('0x48')]()[_0x15be('0x3a')](respondWithResult(_0x50bf4b,null))[_0x15be('0x3f')](handleError(_0x50bf4b,null));};exports[_0x15be('0x49')]=function(_0x3b446c,_0x51b99b,_0x27a2c1){var _0x5debd4={'raw':!![],'where':{}};var _0x4702ca={};var _0x4dd0cc={'count':0x0,'rows':[]};return db[_0x15be('0x26')]['findOne']({'where':{'id':_0x3b446c[_0x15be('0x47')]['id']}})['then'](handleEntityNotFound(_0x51b99b,null))[_0x15be('0x3a')](function(_0x3f33bc){if(_0x3f33bc){_0x4702ca['model']=_[_0x15be('0x2c')](db[_0x15be('0x4a')][_0x15be('0x27')]);_0x4702ca[_0x15be('0x2b')]=_['keys'](_0x3b446c[_0x15be('0x2b')]);_0x4702ca[_0x15be('0x2d')]=_['intersection'](_0x4702ca[_0x15be('0x2f')],_0x4702ca['query']);_0x5debd4[_0x15be('0x30')]=_[_0x15be('0x2e')](_0x4702ca[_0x15be('0x2f')],qs[_0x15be('0x31')](_0x3b446c[_0x15be('0x2b')][_0x15be('0x31')]));_0x5debd4[_0x15be('0x30')]=_0x5debd4[_0x15be('0x30')][_0x15be('0x41')]?_0x5debd4[_0x15be('0x30')]:_0x4702ca['model'];if(!_0x3b446c['query'][_0x15be('0x32')](_0x15be('0x33'))){_0x5debd4['limit']=qs[_0x15be('0x1c')](_0x3b446c[_0x15be('0x2b')][_0x15be('0x1c')]);_0x5debd4[_0x15be('0x1b')]=qs[_0x15be('0x1b')](_0x3b446c[_0x15be('0x2b')][_0x15be('0x1b')]);}_0x5debd4[_0x15be('0x34')]=qs[_0x15be('0x35')](_0x3b446c['query']['sort']);_0x5debd4['where']=qs['filters'](_[_0x15be('0x4b')](_0x3b446c[_0x15be('0x2b')],_0x4702ca[_0x15be('0x2d')]));_0x5debd4[_0x15be('0x36')]['SessionId']=_0x3f33bc['id'];if(_0x3b446c[_0x15be('0x2b')]['filter']){_0x5debd4[_0x15be('0x36')]=_[_0x15be('0x42')](_0x5debd4[_0x15be('0x36')],{'$or':_['map'](_0x5debd4[_0x15be('0x30')],function(_0x2e4204){var _0x99d057={};_0x99d057[_0x2e4204]={'$like':'%'+_0x3b446c[_0x15be('0x2b')][_0x15be('0x37')]+'%'};return _0x99d057;})});}_0x5debd4=_[_0x15be('0x42')]({},_0x5debd4,_0x3b446c[_0x15be('0x39')]);return db[_0x15be('0x4a')][_0x15be('0x1a')]({'where':_0x5debd4[_0x15be('0x36')]})[_0x15be('0x3a')](function(_0xb6ac3b){_0x4dd0cc[_0x15be('0x1a')]=_0xb6ac3b;if(_0x3b446c[_0x15be('0x2b')]['includeAll']){_0x5debd4[_0x15be('0x3c')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x5debd4);})['then'](function(_0x5d9d13){_0x4dd0cc[_0x15be('0x3e')]=_0x5d9d13;return _0x4dd0cc;});}})[_0x15be('0x3a')](respondWithFilteredResult(_0x51b99b,_0x5debd4))[_0x15be('0x3f')](handleError(_0x51b99b,null));}; \ No newline at end of file +var _0x6243=['SessionId','includeAll','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','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','../../mysqldb','sendStatus','status','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','JscriptySessionReport','fieldName','type','key','model','query','intersection','attributes','nolimit','limit','order','sort','filters','pick','filter','where','merge','options','count','include','findAll','rows','catch','show','params','keys','fields','create','body','find','describe','getQuestions','findOne','JscriptyQuestionReport','length'];(function(_0xc12edc,_0x245ba6){var _0x30df28=function(_0x4d0c3a){while(--_0x4d0c3a){_0xc12edc['push'](_0xc12edc['shift']());}};_0x30df28(++_0x245ba6);}(_0x6243,0x1d0));var _0x3624=function(_0x237d4e,_0x20ac2c){_0x237d4e=_0x237d4e-0x0;var _0x3cb7a9=_0x6243[_0x237d4e];return _0x3cb7a9;};'use strict';var pdf=require(_0x3624('0x0'));var emlformat=require(_0x3624('0x1'));var rimraf=require(_0x3624('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3624('0x3'));var rp=require(_0x3624('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3624('0x5'));var util=require(_0x3624('0x6'));var path=require('path');var sox=require(_0x3624('0x7'));var csv=require(_0x3624('0x8'));var ejs=require(_0x3624('0x9'));var fs=require('fs');var _=require(_0x3624('0xa'));var squel=require(_0x3624('0xb'));var crypto=require(_0x3624('0xc'));var jsforce=require(_0x3624('0xd'));var deskjs=require(_0x3624('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3624('0xf'));var Redis=require(_0x3624('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3624('0x11'));var as=require(_0x3624('0x12'));var hardwareService=require(_0x3624('0x13'));var logger=require(_0x3624('0x14'))(_0x3624('0x15'));var utils=require(_0x3624('0x16'));var config=require('../../config/environment');var db=require(_0x3624('0x17'))['db'];function respondWithStatusCode(_0x15b4ca,_0x371ec9){_0x371ec9=_0x371ec9||0xcc;return function(_0x2c3aaf){if(_0x2c3aaf){return _0x15b4ca[_0x3624('0x18')](_0x371ec9);}return _0x15b4ca[_0x3624('0x19')](_0x371ec9)['end']();};}function respondWithResult(_0x38d6aa,_0x9bc199){_0x9bc199=_0x9bc199||0xc8;return function(_0x212656){if(_0x212656){return _0x38d6aa[_0x3624('0x19')](_0x9bc199)[_0x3624('0x1a')](_0x212656);}};}function respondWithFilteredResult(_0x41762e,_0x137d8c){return function(_0x258597){if(_0x258597){var _0x45e9f7=_0x258597['count'],_0x4c470e=_0x137d8c[_0x3624('0x1b')],_0x2226ab=_0x137d8c[_0x3624('0x1b')]+_0x137d8c['limit'],_0x3b3dfb;if(_0x2226ab>=_0x45e9f7){_0x2226ab=_0x45e9f7;_0x3b3dfb=0xc8;}else{_0x3b3dfb=0xce;}_0x41762e[_0x3624('0x19')](_0x3b3dfb);return _0x41762e[_0x3624('0x1c')](_0x3624('0x1d'),_0x4c470e+'-'+_0x2226ab+'/'+_0x45e9f7)[_0x3624('0x1a')](_0x258597);}return null;};}function patchUpdates(_0x3c98bc){return function(_0x17f588){try{jsonpatch[_0x3624('0x1e')](_0x17f588,_0x3c98bc,!![]);}catch(_0x2c5c9d){return BPromise[_0x3624('0x1f')](_0x2c5c9d);}return _0x17f588[_0x3624('0x20')]();};}function saveUpdates(_0x400fa6,_0x294e3d){return function(_0x5c669a){if(_0x5c669a){return _0x5c669a[_0x3624('0x21')](_0x400fa6)[_0x3624('0x22')](function(_0x2bd35c){return _0x2bd35c;});}return null;};}function removeEntity(_0x12d48f,_0x26cd6f){return function(_0x58e961){if(_0x58e961){return _0x58e961[_0x3624('0x23')]()[_0x3624('0x22')](function(){_0x12d48f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3061b3,_0xe14d1e){return function(_0x4ef449){if(!_0x4ef449){_0x3061b3[_0x3624('0x18')](0x194);}return _0x4ef449;};}function handleError(_0x14bfe1,_0x213771){_0x213771=_0x213771||0x1f4;return function(_0x57ee36){logger[_0x3624('0x24')](_0x57ee36['stack']);if(_0x57ee36['name']){delete _0x57ee36[_0x3624('0x25')];}_0x14bfe1['status'](_0x213771)['send'](_0x57ee36);};}exports[_0x3624('0x26')]=function(_0x582353,_0x487f61){var _0x25d9d6={},_0x2b02e6={},_0x1f1e23={'count':0x0,'rows':[]};var _0x3c9316=_[_0x3624('0x27')](db[_0x3624('0x28')]['rawAttributes'],function(_0x5ea2cc){return{'name':_0x5ea2cc[_0x3624('0x29')],'type':_0x5ea2cc[_0x3624('0x2a')][_0x3624('0x2b')]};});_0x2b02e6[_0x3624('0x2c')]=_['map'](_0x3c9316,'name');_0x2b02e6[_0x3624('0x2d')]=_['keys'](_0x582353[_0x3624('0x2d')]);_0x2b02e6['filters']=_['intersection'](_0x2b02e6[_0x3624('0x2c')],_0x2b02e6[_0x3624('0x2d')]);_0x25d9d6['attributes']=_[_0x3624('0x2e')](_0x2b02e6[_0x3624('0x2c')],qs['fields'](_0x582353[_0x3624('0x2d')]['fields']));_0x25d9d6[_0x3624('0x2f')]=_0x25d9d6['attributes']['length']?_0x25d9d6[_0x3624('0x2f')]:_0x2b02e6['model'];if(!_0x582353[_0x3624('0x2d')]['hasOwnProperty'](_0x3624('0x30'))){_0x25d9d6[_0x3624('0x31')]=qs[_0x3624('0x31')](_0x582353[_0x3624('0x2d')][_0x3624('0x31')]);_0x25d9d6[_0x3624('0x1b')]=qs[_0x3624('0x1b')](_0x582353[_0x3624('0x2d')]['offset']);}_0x25d9d6[_0x3624('0x32')]=qs[_0x3624('0x33')](_0x582353[_0x3624('0x2d')][_0x3624('0x33')]);_0x25d9d6['where']=qs[_0x3624('0x34')](_[_0x3624('0x35')](_0x582353[_0x3624('0x2d')],_0x2b02e6[_0x3624('0x34')]),_0x3c9316);if(_0x582353['query'][_0x3624('0x36')]){_0x25d9d6[_0x3624('0x37')]=_[_0x3624('0x38')](_0x25d9d6[_0x3624('0x37')],{'$or':_[_0x3624('0x27')](_0x3c9316,function(_0x15647a){if(_0x15647a['type']!=='VIRTUAL'){var _0x5922f7={};_0x5922f7[_0x15647a[_0x3624('0x25')]]={'$like':'%'+_0x582353[_0x3624('0x2d')][_0x3624('0x36')]+'%'};return _0x5922f7;}})});}_0x25d9d6=_[_0x3624('0x38')]({},_0x25d9d6,_0x582353[_0x3624('0x39')]);var _0x4bcc78={'where':_0x25d9d6[_0x3624('0x37')]};return db[_0x3624('0x28')][_0x3624('0x3a')](_0x4bcc78)[_0x3624('0x22')](function(_0x4cd5f2){_0x1f1e23['count']=_0x4cd5f2;if(_0x582353[_0x3624('0x2d')]['includeAll']){_0x25d9d6[_0x3624('0x3b')]=[{'all':!![]}];}return db[_0x3624('0x28')][_0x3624('0x3c')](_0x25d9d6);})['then'](function(_0x576db0){_0x1f1e23[_0x3624('0x3d')]=_0x576db0;return _0x1f1e23;})[_0x3624('0x22')](respondWithFilteredResult(_0x487f61,_0x25d9d6))[_0x3624('0x3e')](handleError(_0x487f61,null));};exports[_0x3624('0x3f')]=function(_0x5667a6,_0xd81e5e){var _0x1f0f2e={'raw':!![],'where':{'id':_0x5667a6[_0x3624('0x40')]['id']}},_0x3afbb1={};_0x3afbb1[_0x3624('0x2c')]=_[_0x3624('0x41')](db[_0x3624('0x28')]['rawAttributes']);_0x3afbb1['query']=_['keys'](_0x5667a6[_0x3624('0x2d')]);_0x3afbb1[_0x3624('0x34')]=_[_0x3624('0x2e')](_0x3afbb1['model'],_0x3afbb1[_0x3624('0x2d')]);_0x1f0f2e[_0x3624('0x2f')]=_['intersection'](_0x3afbb1[_0x3624('0x2c')],qs[_0x3624('0x42')](_0x5667a6[_0x3624('0x2d')][_0x3624('0x42')]));_0x1f0f2e[_0x3624('0x2f')]=_0x1f0f2e[_0x3624('0x2f')]['length']?_0x1f0f2e[_0x3624('0x2f')]:_0x3afbb1['model'];if(_0x5667a6[_0x3624('0x2d')]['includeAll']){_0x1f0f2e[_0x3624('0x3b')]=[{'all':!![]}];}_0x1f0f2e=_[_0x3624('0x38')]({},_0x1f0f2e,_0x5667a6['options']);return db['JscriptySessionReport']['find'](_0x1f0f2e)[_0x3624('0x22')](handleEntityNotFound(_0xd81e5e,null))[_0x3624('0x22')](respondWithResult(_0xd81e5e,null))[_0x3624('0x3e')](handleError(_0xd81e5e,null));};exports[_0x3624('0x43')]=function(_0x17c155,_0x3728cc){return db[_0x3624('0x28')]['create'](_0x17c155['body'],{})[_0x3624('0x22')](respondWithResult(_0x3728cc,0xc9))[_0x3624('0x3e')](handleError(_0x3728cc,null));};exports[_0x3624('0x21')]=function(_0x152157,_0x4ae814){if(_0x152157['body']['id']){delete _0x152157[_0x3624('0x44')]['id'];}return db[_0x3624('0x28')][_0x3624('0x45')]({'where':{'id':_0x152157['params']['id']}})[_0x3624('0x22')](handleEntityNotFound(_0x4ae814,null))[_0x3624('0x22')](saveUpdates(_0x152157[_0x3624('0x44')],null))[_0x3624('0x22')](respondWithResult(_0x4ae814,null))[_0x3624('0x3e')](handleError(_0x4ae814,null));};exports['destroy']=function(_0x4b1790,_0x41b5c8){return db[_0x3624('0x28')][_0x3624('0x45')]({'where':{'id':_0x4b1790[_0x3624('0x40')]['id']}})['then'](handleEntityNotFound(_0x41b5c8,null))[_0x3624('0x22')](removeEntity(_0x41b5c8,null))[_0x3624('0x3e')](handleError(_0x41b5c8,null));};exports[_0x3624('0x46')]=function(_0x88485a,_0x5268f3){return db[_0x3624('0x28')][_0x3624('0x46')]()[_0x3624('0x22')](respondWithResult(_0x5268f3,null))[_0x3624('0x3e')](handleError(_0x5268f3,null));};exports[_0x3624('0x47')]=function(_0x28cbff,_0x9b1ff6,_0x7b5877){var _0x876ced={'raw':!![],'where':{}};var _0x4cbe1f={};var _0x58e038={'count':0x0,'rows':[]};return db[_0x3624('0x28')][_0x3624('0x48')]({'where':{'id':_0x28cbff['params']['id']}})[_0x3624('0x22')](handleEntityNotFound(_0x9b1ff6,null))['then'](function(_0x5ee965){if(_0x5ee965){_0x4cbe1f[_0x3624('0x2c')]=_[_0x3624('0x41')](db[_0x3624('0x49')]['rawAttributes']);_0x4cbe1f[_0x3624('0x2d')]=_[_0x3624('0x41')](_0x28cbff[_0x3624('0x2d')]);_0x4cbe1f['filters']=_['intersection'](_0x4cbe1f[_0x3624('0x2c')],_0x4cbe1f[_0x3624('0x2d')]);_0x876ced[_0x3624('0x2f')]=_[_0x3624('0x2e')](_0x4cbe1f[_0x3624('0x2c')],qs[_0x3624('0x42')](_0x28cbff[_0x3624('0x2d')][_0x3624('0x42')]));_0x876ced[_0x3624('0x2f')]=_0x876ced[_0x3624('0x2f')][_0x3624('0x4a')]?_0x876ced['attributes']:_0x4cbe1f[_0x3624('0x2c')];if(!_0x28cbff[_0x3624('0x2d')]['hasOwnProperty'](_0x3624('0x30'))){_0x876ced[_0x3624('0x31')]=qs['limit'](_0x28cbff[_0x3624('0x2d')][_0x3624('0x31')]);_0x876ced[_0x3624('0x1b')]=qs['offset'](_0x28cbff[_0x3624('0x2d')][_0x3624('0x1b')]);}_0x876ced[_0x3624('0x32')]=qs[_0x3624('0x33')](_0x28cbff[_0x3624('0x2d')][_0x3624('0x33')]);_0x876ced[_0x3624('0x37')]=qs[_0x3624('0x34')](_[_0x3624('0x35')](_0x28cbff['query'],_0x4cbe1f[_0x3624('0x34')]));_0x876ced['where'][_0x3624('0x4b')]=_0x5ee965['id'];if(_0x28cbff[_0x3624('0x2d')]['filter']){_0x876ced['where']=_['merge'](_0x876ced[_0x3624('0x37')],{'$or':_['map'](_0x876ced['attributes'],function(_0x504d29){var _0x172c44={};_0x172c44[_0x504d29]={'$like':'%'+_0x28cbff[_0x3624('0x2d')][_0x3624('0x36')]+'%'};return _0x172c44;})});}_0x876ced=_['merge']({},_0x876ced,_0x28cbff['options']);return db[_0x3624('0x49')][_0x3624('0x3a')]({'where':_0x876ced[_0x3624('0x37')]})['then'](function(_0x131242){_0x58e038['count']=_0x131242;if(_0x28cbff[_0x3624('0x2d')][_0x3624('0x4c')]){_0x876ced[_0x3624('0x3b')]=[{'all':!![]}];}return db[_0x3624('0x49')][_0x3624('0x3c')](_0x876ced);})['then'](function(_0x516dc1){_0x58e038['rows']=_0x516dc1;return _0x58e038;});}})[_0x3624('0x22')](respondWithFilteredResult(_0x9b1ff6,_0x876ced))[_0x3624('0x3e')](handleError(_0x9b1ff6,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index b460474..21c92f1 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 _0xa882=['report_jscripty_sessions','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','define'];(function(_0x4ee2f2,_0x416932){var _0x1d5161=function(_0x2f683b){while(--_0x2f683b){_0x4ee2f2['push'](_0x4ee2f2['shift']());}};_0x1d5161(++_0x416932);}(_0xa882,0x135));var _0x2a88=function(_0x2f3794,_0x3c3bec){_0x2f3794=_0x2f3794-0x0;var _0x1c9fbe=_0xa882[_0x2f3794];return _0x1c9fbe;};'use strict';var _=require(_0x2a88('0x0'));var util=require(_0x2a88('0x1'));var logger=require(_0x2a88('0x2'))('api');var moment=require(_0x2a88('0x3'));var BPromise=require('bluebird');var rp=require(_0x2a88('0x4'));var fs=require('fs');var path=require(_0x2a88('0x5'));var rimraf=require(_0x2a88('0x6'));var config=require(_0x2a88('0x7'));var attributes=require(_0x2a88('0x8'));module['exports']=function(_0x106b35,_0x58339c){return _0x106b35[_0x2a88('0x9')]('JscriptySessionReport',attributes,{'tableName':_0x2a88('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1013=['../../config/environment','exports','define','report_jscripty_sessions','api','moment','bluebird','request-promise','rimraf'];(function(_0x420fcc,_0x7209e4){var _0x50e306=function(_0x3e98f9){while(--_0x3e98f9){_0x420fcc['push'](_0x420fcc['shift']());}};_0x50e306(++_0x7209e4);}(_0x1013,0x1a2));var _0x3101=function(_0xadb766,_0x15ef79){_0xadb766=_0xadb766-0x0;var _0x413ed5=_0x1013[_0xadb766];return _0x413ed5;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x3101('0x0'));var moment=require(_0x3101('0x1'));var BPromise=require(_0x3101('0x2'));var rp=require(_0x3101('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3101('0x4'));var config=require(_0x3101('0x5'));var attributes=require('./jscriptySessionReport.attributes');module[_0x3101('0x6')]=function(_0xdf41af,_0x55fea9){return _0xdf41af[_0x3101('0x7')]('JscriptySessionReport',attributes,{'tableName':_0x3101('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index b2feac4..80466b1 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 _0x6cdd=['rpc','jayson/promise','client','request','info','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptySessionReport,\x20%s,\x20%s','message','result','moment','ioredis','../../config/utils'];(function(_0x56b138,_0x2396d6){var _0x3df878=function(_0x4b3ccc){while(--_0x4b3ccc){_0x56b138['push'](_0x56b138['shift']());}};_0x3df878(++_0x2396d6);}(_0x6cdd,0x140));var _0xd6cd=function(_0x1983e8,_0x2d179b){_0x1983e8=_0x1983e8-0x0;var _0x8dd5a=_0x6cdd[_0x1983e8];return _0x8dd5a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd6cd('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd6cd('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xd6cd('0x2'));var logger=require('../../config/logger')(_0xd6cd('0x3'));var config=require('../../config/environment');var jayson=require(_0xd6cd('0x4'));var client=jayson[_0xd6cd('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26a420,_0x1b1b9a,_0x5d8dbc){return new BPromise(function(_0x340afc,_0x2ddd44){return client[_0xd6cd('0x6')](_0x26a420,_0x5d8dbc)['then'](function(_0x46619b){logger[_0xd6cd('0x7')]('JscriptySessionReport,\x20%s,\x20%s',_0x1b1b9a,_0xd6cd('0x8'));logger[_0xd6cd('0x9')](_0xd6cd('0xa'),_0x1b1b9a,_0xd6cd('0x8'),JSON[_0xd6cd('0xb')](_0x46619b));if(_0x46619b[_0xd6cd('0xc')]){if(_0x46619b[_0xd6cd('0xc')][_0xd6cd('0xd')]===0x1f4){logger[_0xd6cd('0xc')](_0xd6cd('0xe'),_0x1b1b9a,_0x46619b[_0xd6cd('0xc')][_0xd6cd('0xf')]);return _0x2ddd44(_0x46619b['error'][_0xd6cd('0xf')]);}logger['error'](_0xd6cd('0xe'),_0x1b1b9a,_0x46619b[_0xd6cd('0xc')][_0xd6cd('0xf')]);return _0x340afc(_0x46619b['error'][_0xd6cd('0xf')]);}else{logger[_0xd6cd('0x7')]('JscriptySessionReport,\x20%s,\x20%s',_0x1b1b9a,_0xd6cd('0x8'));_0x340afc(_0x46619b[_0xd6cd('0x10')][_0xd6cd('0xf')]);}})['catch'](function(_0x548ba9){logger[_0xd6cd('0xc')](_0xd6cd('0xe'),_0x1b1b9a,_0x548ba9);_0x2ddd44(_0x548ba9);});});} \ No newline at end of file +var _0xbb50=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4d82bb,_0x5ccd17){var _0x4531ff=function(_0x54c060){while(--_0x54c060){_0x4d82bb['push'](_0x4d82bb['shift']());}};_0x4531ff(++_0x5ccd17);}(_0xbb50,0x11b));var _0x0bb5=function(_0xbb9dbf,_0x5dafa4){_0xbb9dbf=_0xbb9dbf-0x0;var _0x30223c=_0xbb50[_0xbb9dbf];return _0x30223c;};'use strict';var _=require(_0x0bb5('0x0'));var util=require(_0x0bb5('0x1'));var moment=require(_0x0bb5('0x2'));var BPromise=require(_0x0bb5('0x3'));var rs=require(_0x0bb5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0bb5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0bb5('0x6'))('rpc');var config=require(_0x0bb5('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3efc5e,_0x4f5873,_0x68048b){return new BPromise(function(_0x39f686,_0x2f3d34){return client['request'](_0x3efc5e,_0x68048b)[_0x0bb5('0x8')](function(_0x2b814e){logger[_0x0bb5('0x9')](_0x0bb5('0xa'),_0x4f5873,_0x0bb5('0xb'));logger[_0x0bb5('0xc')](_0x0bb5('0xd'),_0x4f5873,_0x0bb5('0xb'),JSON[_0x0bb5('0xe')](_0x2b814e));if(_0x2b814e[_0x0bb5('0xf')]){if(_0x2b814e['error'][_0x0bb5('0x10')]===0x1f4){logger[_0x0bb5('0xf')](_0x0bb5('0xa'),_0x4f5873,_0x2b814e[_0x0bb5('0xf')][_0x0bb5('0x11')]);return _0x2f3d34(_0x2b814e[_0x0bb5('0xf')][_0x0bb5('0x11')]);}logger[_0x0bb5('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0x4f5873,_0x2b814e[_0x0bb5('0xf')][_0x0bb5('0x11')]);return _0x39f686(_0x2b814e[_0x0bb5('0xf')][_0x0bb5('0x11')]);}else{logger['info'](_0x0bb5('0xa'),_0x4f5873,_0x0bb5('0xb'));_0x39f686(_0x2b814e[_0x0bb5('0x12')]['message']);}})[_0x0bb5('0x13')](function(_0x54b2a0){logger[_0x0bb5('0xf')](_0x0bb5('0xa'),_0x4f5873,_0x54b2a0);_0x2f3d34(_0x54b2a0);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 14af197..4bbc613 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 _0x2a0a=['/:id','isAuthenticated','update','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./license.controller','get','index','put'];(function(_0x3c22e0,_0x1dc6ea){var _0x215811=function(_0x1b453c){while(--_0x1b453c){_0x3c22e0['push'](_0x3c22e0['shift']());}};_0x215811(++_0x1dc6ea);}(_0x2a0a,0xa9));var _0xa2a0=function(_0x753ac6,_0x4605ff){_0x753ac6=_0x753ac6-0x0;var _0x5a4dc7=_0x2a0a[_0x753ac6];return _0x5a4dc7;};'use strict';var multer=require(_0xa2a0('0x0'));var util=require(_0xa2a0('0x1'));var path=require('path');var timeout=require(_0xa2a0('0x2'));var express=require(_0xa2a0('0x3'));var router=express[_0xa2a0('0x4')]();var auth=require(_0xa2a0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa2a0('0x6'));var controller=require(_0xa2a0('0x7'));router[_0xa2a0('0x8')]('/',controller[_0xa2a0('0x9')]);router[_0xa2a0('0xa')](_0xa2a0('0xb'),auth[_0xa2a0('0xc')](),controller[_0xa2a0('0xd')]);module[_0xa2a0('0xe')]=router; \ No newline at end of file +var _0xf36a=['path','connect-timeout','express','../../components/interaction/service','../../config/environment','./license.controller','get','put','/:id','isAuthenticated','exports','multer','util'];(function(_0x1d7300,_0x17f109){var _0x46ee98=function(_0x5ee16a){while(--_0x5ee16a){_0x1d7300['push'](_0x1d7300['shift']());}};_0x46ee98(++_0x17f109);}(_0xf36a,0x1b8));var _0xaf36=function(_0x54bffc,_0xb521af){_0x54bffc=_0x54bffc-0x0;var _0x47f239=_0xf36a[_0x54bffc];return _0x47f239;};'use strict';var multer=require(_0xaf36('0x0'));var util=require(_0xaf36('0x1'));var path=require(_0xaf36('0x2'));var timeout=require(_0xaf36('0x3'));var express=require(_0xaf36('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xaf36('0x5'));var config=require(_0xaf36('0x6'));var controller=require(_0xaf36('0x7'));router[_0xaf36('0x8')]('/',controller['index']);router[_0xaf36('0x9')](_0xaf36('0xa'),auth[_0xaf36('0xb')](),controller['update']);module[_0xaf36('0xc')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 70d70f5..c536e31 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 _0x4819=['INTEGER','exports','TEXT','STRING'];(function(_0x46efff,_0x56f657){var _0x196cfc=function(_0x5212b1){while(--_0x5212b1){_0x46efff['push'](_0x46efff['shift']());}};_0x196cfc(++_0x56f657);}(_0x4819,0xcd));var _0x9481=function(_0x40b723,_0x118b22){_0x40b723=_0x40b723-0x0;var _0x1981ad=_0x4819[_0x40b723];return _0x1981ad;};'use strict';var Sequelize=require('sequelize');module[_0x9481('0x0')]={'license':{'type':Sequelize[_0x9481('0x1')]},'data1':{'type':Sequelize[_0x9481('0x2')]},'data2':{'type':Sequelize[_0x9481('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x9481('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x46ed=['sequelize','exports','STRING','INTEGER'];(function(_0x39e164,_0x2cb93b){var _0x13fa6b=function(_0x511cb2){while(--_0x511cb2){_0x39e164['push'](_0x39e164['shift']());}};_0x13fa6b(++_0x2cb93b);}(_0x46ed,0x168));var _0xd46e=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x46ed[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0xd46e('0x0'));module[_0xd46e('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xd46e('0x2')]},'data2':{'type':Sequelize[_0xd46e('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xd46e('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index f4c8a9d..d957997 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 _0x8829=['params','get','checkLicense','demo','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','../../config/license/util','model','License','rawAttributes','query','keys','filters','intersection','fields','attributes','length','merge','options','getLicense','catch','body','find'];(function(_0x2c1eeb,_0x4f4092){var _0x8d971=function(_0x5d3bb7){while(--_0x5d3bb7){_0x2c1eeb['push'](_0x2c1eeb['shift']());}};_0x8d971(++_0x4f4092);}(_0x8829,0x12b));var _0x9882=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8829[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x9882('0x0'));var emlformat=require(_0x9882('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9882('0x2'));var jsonpatch=require(_0x9882('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9882('0x4'));var Mustache=require(_0x9882('0x5'));var util=require(_0x9882('0x6'));var path=require(_0x9882('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x9882('0x8'));var crypto=require('crypto');var jsforce=require(_0x9882('0x9'));var deskjs=require(_0x9882('0xa'));var toCsv=require('to-csv');var querystring=require(_0x9882('0xb'));var Papa=require(_0x9882('0xc'));var Redis=require(_0x9882('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x9882('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9882('0xf'));var logger=require(_0x9882('0x10'))(_0x9882('0x11'));var utils=require('../../config/utils');var config=require(_0x9882('0x12'));var db=require(_0x9882('0x13'))['db'];function respondWithStatusCode(_0x28dda4,_0x30cde0){_0x30cde0=_0x30cde0||0xcc;return function(_0x125555){if(_0x125555){return _0x28dda4[_0x9882('0x14')](_0x30cde0);}return _0x28dda4[_0x9882('0x15')](_0x30cde0)[_0x9882('0x16')]();};}function respondWithResult(_0xe45a0b,_0x3873cd){_0x3873cd=_0x3873cd||0xc8;return function(_0x536b3a){if(_0x536b3a){return _0xe45a0b[_0x9882('0x15')](_0x3873cd)[_0x9882('0x17')](_0x536b3a);}};}function respondWithFilteredResult(_0x2be449,_0x3ddc50){return function(_0x4e10bb){if(_0x4e10bb){var _0x1f5954=_0x4e10bb[_0x9882('0x18')],_0x52b5d7=_0x3ddc50['offset'],_0x243aef=_0x3ddc50['offset']+_0x3ddc50[_0x9882('0x19')],_0x582c85;if(_0x243aef>=_0x1f5954){_0x243aef=_0x1f5954;_0x582c85=0xc8;}else{_0x582c85=0xce;}_0x2be449[_0x9882('0x15')](_0x582c85);return _0x2be449[_0x9882('0x1a')](_0x9882('0x1b'),_0x52b5d7+'-'+_0x243aef+'/'+_0x1f5954)[_0x9882('0x17')](_0x4e10bb);}return null;};}function patchUpdates(_0x531a09){return function(_0x4adc82){try{jsonpatch[_0x9882('0x1c')](_0x4adc82,_0x531a09,!![]);}catch(_0x29a356){return BPromise[_0x9882('0x1d')](_0x29a356);}return _0x4adc82[_0x9882('0x1e')]();};}function saveUpdates(_0x18e885,_0x278d05){return function(_0x669651){if(_0x669651){return _0x669651[_0x9882('0x1f')](_0x18e885)[_0x9882('0x20')](function(_0xcb64ba){return _0xcb64ba;});}return null;};}function removeEntity(_0x45cd73,_0x5050e3){return function(_0x4eaccf){if(_0x4eaccf){return _0x4eaccf[_0x9882('0x21')]()[_0x9882('0x20')](function(){_0x45cd73[_0x9882('0x15')](0xcc)[_0x9882('0x16')]();});}};}function handleEntityNotFound(_0x8a34f6,_0x51055c){return function(_0x5eb02b){if(!_0x5eb02b){_0x8a34f6['sendStatus'](0x194);}return _0x5eb02b;};}function handleError(_0x300815,_0x541d72){_0x541d72=_0x541d72||0x1f4;return function(_0x5d3e57){logger[_0x9882('0x22')](_0x5d3e57[_0x9882('0x23')]);if(_0x5d3e57[_0x9882('0x24')]){delete _0x5d3e57['name'];}_0x300815[_0x9882('0x15')](_0x541d72)[_0x9882('0x25')](_0x5d3e57);};}var utilLicense=require(_0x9882('0x26'));exports['index']=function(_0x477c0b,_0x3ad808){var _0x2ceff3={'raw':!![],'where':{'id':0x1}},_0x797abf={};_0x797abf[_0x9882('0x27')]=_['keys'](db[_0x9882('0x28')][_0x9882('0x29')]);_0x797abf[_0x9882('0x2a')]=_[_0x9882('0x2b')](_0x477c0b[_0x9882('0x2a')]);_0x797abf[_0x9882('0x2c')]=_['intersection'](_0x797abf[_0x9882('0x27')],_0x797abf[_0x9882('0x2a')]);_0x2ceff3['attributes']=_[_0x9882('0x2d')](_0x797abf[_0x9882('0x27')],qs[_0x9882('0x2e')](_0x477c0b[_0x9882('0x2a')][_0x9882('0x2e')]));_0x2ceff3[_0x9882('0x2f')]=_0x2ceff3[_0x9882('0x2f')][_0x9882('0x30')]?_0x2ceff3['attributes']:_0x797abf[_0x9882('0x27')];_0x2ceff3=_[_0x9882('0x31')]({},_0x2ceff3,_0x477c0b[_0x9882('0x32')]);return utilLicense[_0x9882('0x33')](_0x2ceff3)[_0x9882('0x20')](respondWithResult(_0x3ad808,null))[_0x9882('0x34')](handleError(_0x3ad808,null));};exports[_0x9882('0x1f')]=function(_0x3bbb62,_0x144457){if(_0x3bbb62['body']['id']){delete _0x3bbb62[_0x9882('0x35')]['id'];}return db[_0x9882('0x28')][_0x9882('0x36')]({'where':{'id':_0x3bbb62[_0x9882('0x37')]['id']}})[_0x9882('0x20')](handleEntityNotFound(_0x144457,null))[_0x9882('0x20')](function(_0x21d1a0){var _0x51bd56=_0x21d1a0[_0x9882('0x38')]({'plain':!![]});return utilLicense[_0x9882('0x39')](_0x51bd56,_0x3bbb62[_0x9882('0x35')]['key']);})['then'](function(_0x434bce){if(!_0x434bce[_0x9882('0x3a')]){return saveUpdates(_0x3bbb62[_0x9882('0x35')],null);}return _0x434bce;})[_0x9882('0x20')](respondWithResult(_0x144457,null))[_0x9882('0x34')](handleError(_0x144457,null));}; \ No newline at end of file +var _0x24d9=['status','json','offset','limit','set','Content-Range','reject','save','update','then','error','stack','name','../../config/license/util','index','model','keys','License','rawAttributes','query','filters','intersection','attributes','fields','length','merge','options','getLicense','catch','body','find','params','get','checkLicense','key','demo','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','util','path','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','sendStatus'];(function(_0x823b40,_0x5e2c7a){var _0x595d26=function(_0x14c0b5){while(--_0x14c0b5){_0x823b40['push'](_0x823b40['shift']());}};_0x595d26(++_0x5e2c7a);}(_0x24d9,0x96));var _0x924d=function(_0x208fb0,_0x579a6f){_0x208fb0=_0x208fb0-0x0;var _0x54fdf7=_0x24d9[_0x208fb0];return _0x54fdf7;};'use strict';var pdf=require(_0x924d('0x0'));var emlformat=require(_0x924d('0x1'));var rimraf=require(_0x924d('0x2'));var zipdir=require(_0x924d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x924d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x924d('0x5'));var util=require(_0x924d('0x6'));var path=require(_0x924d('0x7'));var sox=require('sox');var csv=require(_0x924d('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x924d('0x9'));var squel=require(_0x924d('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x924d('0xb'));var toCsv=require(_0x924d('0x8'));var querystring=require(_0x924d('0xc'));var Papa=require(_0x924d('0xd'));var Redis=require(_0x924d('0xe'));var authService=require(_0x924d('0xf'));var qs=require(_0x924d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x924d('0x11'))('api');var utils=require(_0x924d('0x12'));var config=require('../../config/environment');var db=require(_0x924d('0x13'))['db'];function respondWithStatusCode(_0x569c75,_0xd51282){_0xd51282=_0xd51282||0xcc;return function(_0x56b95c){if(_0x56b95c){return _0x569c75[_0x924d('0x14')](_0xd51282);}return _0x569c75[_0x924d('0x15')](_0xd51282)['end']();};}function respondWithResult(_0xdcca6b,_0x22a3ce){_0x22a3ce=_0x22a3ce||0xc8;return function(_0x1a6193){if(_0x1a6193){return _0xdcca6b[_0x924d('0x15')](_0x22a3ce)[_0x924d('0x16')](_0x1a6193);}};}function respondWithFilteredResult(_0x138e75,_0x704cb5){return function(_0x4a8df4){if(_0x4a8df4){var _0x5466c4=_0x4a8df4['count'],_0x4cd7dc=_0x704cb5[_0x924d('0x17')],_0x36aef9=_0x704cb5[_0x924d('0x17')]+_0x704cb5[_0x924d('0x18')],_0xb1d34f;if(_0x36aef9>=_0x5466c4){_0x36aef9=_0x5466c4;_0xb1d34f=0xc8;}else{_0xb1d34f=0xce;}_0x138e75[_0x924d('0x15')](_0xb1d34f);return _0x138e75[_0x924d('0x19')](_0x924d('0x1a'),_0x4cd7dc+'-'+_0x36aef9+'/'+_0x5466c4)[_0x924d('0x16')](_0x4a8df4);}return null;};}function patchUpdates(_0x11c3d5){return function(_0x1bc313){try{jsonpatch['apply'](_0x1bc313,_0x11c3d5,!![]);}catch(_0x5cc5fc){return BPromise[_0x924d('0x1b')](_0x5cc5fc);}return _0x1bc313[_0x924d('0x1c')]();};}function saveUpdates(_0x36ac38,_0x1056ab){return function(_0x5290d5){if(_0x5290d5){return _0x5290d5[_0x924d('0x1d')](_0x36ac38)[_0x924d('0x1e')](function(_0x65366c){return _0x65366c;});}return null;};}function removeEntity(_0x29ecf0,_0xe32fee){return function(_0x2cac0e){if(_0x2cac0e){return _0x2cac0e['destroy']()['then'](function(){_0x29ecf0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x14d7be,_0x47388a){return function(_0x5cfdfe){if(!_0x5cfdfe){_0x14d7be[_0x924d('0x14')](0x194);}return _0x5cfdfe;};}function handleError(_0x2d187,_0x4378e3){_0x4378e3=_0x4378e3||0x1f4;return function(_0x15e2a9){logger[_0x924d('0x1f')](_0x15e2a9[_0x924d('0x20')]);if(_0x15e2a9[_0x924d('0x21')]){delete _0x15e2a9[_0x924d('0x21')];}_0x2d187[_0x924d('0x15')](_0x4378e3)['send'](_0x15e2a9);};}var utilLicense=require(_0x924d('0x22'));exports[_0x924d('0x23')]=function(_0x592037,_0x229227){var _0x442ab6={'raw':!![],'where':{'id':0x1}},_0x3c1ba3={};_0x3c1ba3[_0x924d('0x24')]=_[_0x924d('0x25')](db[_0x924d('0x26')][_0x924d('0x27')]);_0x3c1ba3[_0x924d('0x28')]=_['keys'](_0x592037[_0x924d('0x28')]);_0x3c1ba3[_0x924d('0x29')]=_[_0x924d('0x2a')](_0x3c1ba3['model'],_0x3c1ba3[_0x924d('0x28')]);_0x442ab6[_0x924d('0x2b')]=_['intersection'](_0x3c1ba3[_0x924d('0x24')],qs['fields'](_0x592037[_0x924d('0x28')][_0x924d('0x2c')]));_0x442ab6[_0x924d('0x2b')]=_0x442ab6[_0x924d('0x2b')][_0x924d('0x2d')]?_0x442ab6[_0x924d('0x2b')]:_0x3c1ba3[_0x924d('0x24')];_0x442ab6=_[_0x924d('0x2e')]({},_0x442ab6,_0x592037[_0x924d('0x2f')]);return utilLicense[_0x924d('0x30')](_0x442ab6)[_0x924d('0x1e')](respondWithResult(_0x229227,null))[_0x924d('0x31')](handleError(_0x229227,null));};exports['update']=function(_0x2eb81c,_0x3613b6){if(_0x2eb81c[_0x924d('0x32')]['id']){delete _0x2eb81c[_0x924d('0x32')]['id'];}return db['License'][_0x924d('0x33')]({'where':{'id':_0x2eb81c[_0x924d('0x34')]['id']}})['then'](handleEntityNotFound(_0x3613b6,null))[_0x924d('0x1e')](function(_0x186387){var _0x23ce1c=_0x186387[_0x924d('0x35')]({'plain':!![]});return utilLicense[_0x924d('0x36')](_0x23ce1c,_0x2eb81c['body'][_0x924d('0x37')]);})['then'](function(_0x25f0e8){if(!_0x25f0e8[_0x924d('0x38')]){return saveUpdates(_0x2eb81c['body'],null);}return _0x25f0e8;})[_0x924d('0x1e')](respondWithResult(_0x3613b6,null))[_0x924d('0x31')](handleError(_0x3613b6,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 8f2833d..f69abd0 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 _0xcacd=['path','rimraf','./license.attributes','exports','define','License','license','lodash','moment','bluebird','request-promise'];(function(_0x19b351,_0x547358){var _0x104803=function(_0x412161){while(--_0x412161){_0x19b351['push'](_0x19b351['shift']());}};_0x104803(++_0x547358);}(_0xcacd,0x1bf));var _0xdcac=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xcacd[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xdcac('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xdcac('0x1'));var BPromise=require(_0xdcac('0x2'));var rp=require(_0xdcac('0x3'));var fs=require('fs');var path=require(_0xdcac('0x4'));var rimraf=require(_0xdcac('0x5'));var config=require('../../config/environment');var attributes=require(_0xdcac('0x6'));module[_0xdcac('0x7')]=function(_0x208907,_0x58af9f){return _0x208907[_0xdcac('0x8')](_0xdcac('0x9'),attributes,{'tableName':_0xdcac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x28eb=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./license.attributes','define','License','lodash','util','../../config/logger'];(function(_0x516eb0,_0x2bf9ee){var _0x4a9a49=function(_0x3142a0){while(--_0x3142a0){_0x516eb0['push'](_0x516eb0['shift']());}};_0x4a9a49(++_0x2bf9ee);}(_0x28eb,0x105));var _0xb28e=function(_0x5a028c,_0x5c1a96){_0x5a028c=_0x5a028c-0x0;var _0x16448c=_0x28eb[_0x5a028c];return _0x16448c;};'use strict';var _=require(_0xb28e('0x0'));var util=require(_0xb28e('0x1'));var logger=require(_0xb28e('0x2'))('api');var moment=require(_0xb28e('0x3'));var BPromise=require(_0xb28e('0x4'));var rp=require(_0xb28e('0x5'));var fs=require('fs');var path=require(_0xb28e('0x6'));var rimraf=require(_0xb28e('0x7'));var config=require(_0xb28e('0x8'));var attributes=require(_0xb28e('0x9'));module['exports']=function(_0x42b823,_0x4638f9){return _0x42b823[_0xb28e('0xa')](_0xb28e('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 6ee560b..db64bb3 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 _0x9b00=['debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','License,\x20%s,\x20%s','request\x20sent'];(function(_0x355d8c,_0x2de949){var _0xd527fa=function(_0x49ca82){while(--_0x49ca82){_0x355d8c['push'](_0x355d8c['shift']());}};_0xd527fa(++_0x2de949);}(_0x9b00,0xcc));var _0x09b0=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x9b00[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x09b0('0x0'));var util=require(_0x09b0('0x1'));var moment=require(_0x09b0('0x2'));var BPromise=require('bluebird');var rs=require(_0x09b0('0x3'));var fs=require('fs');var Redis=require(_0x09b0('0x4'));var db=require(_0x09b0('0x5'))['db'];var utils=require(_0x09b0('0x6'));var logger=require(_0x09b0('0x7'))(_0x09b0('0x8'));var config=require(_0x09b0('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x09b0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20c971,_0x36b4ca,_0x396bd6){return new BPromise(function(_0x4290c7,_0x1bc2ce){return client[_0x09b0('0xb')](_0x20c971,_0x396bd6)[_0x09b0('0xc')](function(_0x541785){logger[_0x09b0('0xd')](_0x09b0('0xe'),_0x36b4ca,_0x09b0('0xf'));logger[_0x09b0('0x10')](_0x09b0('0x11'),_0x36b4ca,_0x09b0('0xf'),JSON[_0x09b0('0x12')](_0x541785));if(_0x541785[_0x09b0('0x13')]){if(_0x541785[_0x09b0('0x13')][_0x09b0('0x14')]===0x1f4){logger[_0x09b0('0x13')]('License,\x20%s,\x20%s',_0x36b4ca,_0x541785[_0x09b0('0x13')][_0x09b0('0x15')]);return _0x1bc2ce(_0x541785[_0x09b0('0x13')]['message']);}logger[_0x09b0('0x13')](_0x09b0('0xe'),_0x36b4ca,_0x541785['error'][_0x09b0('0x15')]);return _0x4290c7(_0x541785['error'][_0x09b0('0x15')]);}else{logger[_0x09b0('0xd')](_0x09b0('0xe'),_0x36b4ca,_0x09b0('0xf'));_0x4290c7(_0x541785['result']['message']);}})['catch'](function(_0xff4b8f){logger[_0x09b0('0x13')]('License,\x20%s,\x20%s',_0x36b4ca,_0xff4b8f);_0x1bc2ce(_0xff4b8f);});});} \ No newline at end of file +var _0x8a55=['client','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x3775ce,_0x580741){var _0x4fe757=function(_0x2428de){while(--_0x2428de){_0x3775ce['push'](_0x3775ce['shift']());}};_0x4fe757(++_0x580741);}(_0x8a55,0x185));var _0x58a5=function(_0x50884a,_0x472512){_0x50884a=_0x50884a-0x0;var _0x5ba850=_0x8a55[_0x50884a];return _0x5ba850;};'use strict';var _=require(_0x58a5('0x0'));var util=require(_0x58a5('0x1'));var moment=require(_0x58a5('0x2'));var BPromise=require(_0x58a5('0x3'));var rs=require(_0x58a5('0x4'));var fs=require('fs');var Redis=require(_0x58a5('0x5'));var db=require(_0x58a5('0x6'))['db'];var utils=require(_0x58a5('0x7'));var logger=require('../../config/logger')(_0x58a5('0x8'));var config=require(_0x58a5('0x9'));var jayson=require(_0x58a5('0xa'));var client=jayson[_0x58a5('0xb')][_0x58a5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1690bc,_0x1f135e,_0xd63fc7){return new BPromise(function(_0x36d8a4,_0x59860d){return client[_0x58a5('0xd')](_0x1690bc,_0xd63fc7)[_0x58a5('0xe')](function(_0x2cca61){logger[_0x58a5('0xf')](_0x58a5('0x10'),_0x1f135e,_0x58a5('0x11'));logger[_0x58a5('0x12')](_0x58a5('0x13'),_0x1f135e,_0x58a5('0x11'),JSON[_0x58a5('0x14')](_0x2cca61));if(_0x2cca61[_0x58a5('0x15')]){if(_0x2cca61[_0x58a5('0x15')][_0x58a5('0x16')]===0x1f4){logger[_0x58a5('0x15')]('License,\x20%s,\x20%s',_0x1f135e,_0x2cca61[_0x58a5('0x15')][_0x58a5('0x17')]);return _0x59860d(_0x2cca61[_0x58a5('0x15')][_0x58a5('0x17')]);}logger[_0x58a5('0x15')]('License,\x20%s,\x20%s',_0x1f135e,_0x2cca61['error'][_0x58a5('0x17')]);return _0x36d8a4(_0x2cca61[_0x58a5('0x15')][_0x58a5('0x17')]);}else{logger[_0x58a5('0xf')](_0x58a5('0x10'),_0x1f135e,'request\x20sent');_0x36d8a4(_0x2cca61[_0x58a5('0x18')][_0x58a5('0x17')]);}})['catch'](function(_0x2594e3){logger[_0x58a5('0x15')]('License,\x20%s,\x20%s',_0x1f135e,_0x2594e3);_0x59860d(_0x2594e3);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 9937880..6691acf 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 _0x9e7f=['../../config/environment','./mailAccount.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','post','addDisposition','addAnswer','addImap','addSmtp','addApplications','/:id/send','send','addAgents','put','delete','removeDispositions','removeAnswers','removeSmtp','destroy','removeAgents','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x118064,_0x37e68d){var _0x21c5cc=function(_0x401411){while(--_0x401411){_0x118064['push'](_0x118064['shift']());}};_0x21c5cc(++_0x37e68d);}(_0x9e7f,0xaa));var _0xf9e7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9e7f[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf9e7('0x0'));var timeout=require(_0xf9e7('0x1'));var express=require(_0xf9e7('0x2'));var router=express[_0xf9e7('0x3')]();var auth=require(_0xf9e7('0x4'));var interaction=require(_0xf9e7('0x5'));var config=require(_0xf9e7('0x6'));var controller=require(_0xf9e7('0x7'));router[_0xf9e7('0x8')]('/',auth['isAuthenticated'](),controller[_0xf9e7('0x9')]);router[_0xf9e7('0x8')](_0xf9e7('0xa'),auth[_0xf9e7('0xb')](),controller['describe']);router[_0xf9e7('0x8')](_0xf9e7('0xc'),auth['isAuthenticated'](),controller[_0xf9e7('0xd')]);router['get'](_0xf9e7('0xe'),auth[_0xf9e7('0xb')](),controller[_0xf9e7('0xf')]);router[_0xf9e7('0x8')](_0xf9e7('0x10'),auth[_0xf9e7('0xb')](),controller[_0xf9e7('0x11')]);router[_0xf9e7('0x8')](_0xf9e7('0x12'),auth[_0xf9e7('0xb')](),controller[_0xf9e7('0x13')]);router[_0xf9e7('0x8')](_0xf9e7('0x14'),auth[_0xf9e7('0xb')](),controller[_0xf9e7('0x15')]);router['get'](_0xf9e7('0x16'),auth[_0xf9e7('0xb')](),controller['getInteractions']);router[_0xf9e7('0x8')](_0xf9e7('0x17'),auth[_0xf9e7('0xb')](),controller[_0xf9e7('0x18')]);router[_0xf9e7('0x8')](_0xf9e7('0x19'),auth[_0xf9e7('0xb')](),controller[_0xf9e7('0x1a')]);router['get']('/:id/verify',auth[_0xf9e7('0xb')](),controller['verifySmtp']);router['get'](_0xf9e7('0x1b'),auth[_0xf9e7('0xb')](),controller['getAgents']);router[_0xf9e7('0x1c')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xf9e7('0x1d')]);router[_0xf9e7('0x1c')](_0xf9e7('0x10'),auth[_0xf9e7('0xb')](),controller[_0xf9e7('0x1e')]);router[_0xf9e7('0x1c')]('/',auth[_0xf9e7('0xb')](),controller['create']);router[_0xf9e7('0x1c')](_0xf9e7('0x12'),auth['isAuthenticated'](),controller[_0xf9e7('0x1f')]);router[_0xf9e7('0x1c')](_0xf9e7('0x14'),auth[_0xf9e7('0xb')](),controller[_0xf9e7('0x20')]);router['post']('/:id/interactions',auth[_0xf9e7('0xb')](),controller['addInteraction']);router[_0xf9e7('0x1c')](_0xf9e7('0x17'),auth['isAuthenticated'](),controller[_0xf9e7('0x21')]);router[_0xf9e7('0x1c')](_0xf9e7('0x22'),auth[_0xf9e7('0xb')](),controller[_0xf9e7('0x23')]);router[_0xf9e7('0x1c')](_0xf9e7('0x1b'),auth[_0xf9e7('0xb')](),controller[_0xf9e7('0x24')]);router[_0xf9e7('0x25')](_0xf9e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xf9e7('0x26')](_0xf9e7('0xe'),auth[_0xf9e7('0xb')](),controller[_0xf9e7('0x27')]);router[_0xf9e7('0x26')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xf9e7('0x28')]);router['delete']('/:id/in_servers',auth['isAuthenticated'](),controller['removeImap']);router['delete'](_0xf9e7('0x14'),auth[_0xf9e7('0xb')](),controller[_0xf9e7('0x29')]);router[_0xf9e7('0x26')](_0xf9e7('0xc'),auth[_0xf9e7('0xb')](),controller[_0xf9e7('0x2a')]);router['delete']('/:id/users',auth[_0xf9e7('0xb')](),controller[_0xf9e7('0x2b')]);module['exports']=router; \ No newline at end of file +var _0x8602=['addAnswer','create','/:id/in_servers','addImap','/:id/out_servers','addSmtp','post','addInteraction','addApplications','/:id/send','send','delete','/:id/dispositions','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','isAuthenticated','index','get','/describe','describe','/:id','/:id/canned_answers','getImap','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents'];(function(_0x729aa,_0x2723d3){var _0x155b85=function(_0x18d9dd){while(--_0x18d9dd){_0x729aa['push'](_0x729aa['shift']());}};_0x155b85(++_0x2723d3);}(_0x8602,0xf4));var _0x2860=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0x8602[_0x50aa2e];return _0x5e07f0;};'use strict';var multer=require(_0x2860('0x0'));var util=require(_0x2860('0x1'));var path=require(_0x2860('0x2'));var timeout=require(_0x2860('0x3'));var express=require(_0x2860('0x4'));var router=express[_0x2860('0x5')]();var auth=require(_0x2860('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailAccount.controller');router['get']('/',auth[_0x2860('0x7')](),controller[_0x2860('0x8')]);router[_0x2860('0x9')](_0x2860('0xa'),auth[_0x2860('0x7')](),controller[_0x2860('0xb')]);router[_0x2860('0x9')](_0x2860('0xc'),auth[_0x2860('0x7')](),controller['show']);router['get']('/:id/dispositions',auth[_0x2860('0x7')](),controller['getDispositions']);router[_0x2860('0x9')](_0x2860('0xd'),auth[_0x2860('0x7')](),controller['getAnswers']);router['get']('/:id/in_servers',auth[_0x2860('0x7')](),controller[_0x2860('0xe')]);router['get']('/:id/out_servers',auth['isAuthenticated'](),controller[_0x2860('0xf')]);router[_0x2860('0x9')](_0x2860('0x10'),auth['isAuthenticated'](),controller[_0x2860('0x11')]);router['get'](_0x2860('0x12'),auth[_0x2860('0x7')](),controller[_0x2860('0x13')]);router[_0x2860('0x9')](_0x2860('0x14'),auth[_0x2860('0x7')](),controller[_0x2860('0x15')]);router['get'](_0x2860('0x16'),auth[_0x2860('0x7')](),controller[_0x2860('0x17')]);router[_0x2860('0x9')](_0x2860('0x18'),auth['isAuthenticated'](),controller[_0x2860('0x19')]);router['post']('/:id/dispositions',auth[_0x2860('0x7')](),controller['addDisposition']);router['post'](_0x2860('0xd'),auth[_0x2860('0x7')](),controller[_0x2860('0x1a')]);router['post']('/',auth[_0x2860('0x7')](),controller[_0x2860('0x1b')]);router['post'](_0x2860('0x1c'),auth['isAuthenticated'](),controller[_0x2860('0x1d')]);router['post'](_0x2860('0x1e'),auth['isAuthenticated'](),controller[_0x2860('0x1f')]);router[_0x2860('0x20')](_0x2860('0x10'),auth[_0x2860('0x7')](),controller[_0x2860('0x21')]);router[_0x2860('0x20')](_0x2860('0x12'),auth[_0x2860('0x7')](),controller[_0x2860('0x22')]);router[_0x2860('0x20')](_0x2860('0x23'),auth[_0x2860('0x7')](),controller[_0x2860('0x24')]);router[_0x2860('0x20')]('/:id/users',auth[_0x2860('0x7')](),controller['addAgents']);router['put']('/:id',auth[_0x2860('0x7')](),controller['update']);router[_0x2860('0x25')](_0x2860('0x26'),auth[_0x2860('0x7')](),controller[_0x2860('0x27')]);router['delete'](_0x2860('0xd'),auth[_0x2860('0x7')](),controller[_0x2860('0x28')]);router[_0x2860('0x25')]('/:id/in_servers',auth[_0x2860('0x7')](),controller[_0x2860('0x29')]);router[_0x2860('0x25')](_0x2860('0x1e'),auth[_0x2860('0x7')](),controller[_0x2860('0x2a')]);router[_0x2860('0x25')](_0x2860('0xc'),auth['isAuthenticated'](),controller[_0x2860('0x2b')]);router['delete'](_0x2860('0x18'),auth[_0x2860('0x7')](),controller[_0x2860('0x2c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index b002dbf..4ed647e 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 _0xb7d6=['BOOLEAN','TEXT','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','STRING'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xb7d6,0x1ab));var _0x6b7d=function(_0x69e89e,_0x1fb302){_0x69e89e=_0x69e89e-0x0;var _0x39b87d=_0xb7d6[_0x69e89e];return _0x39b87d;};'use strict';var Sequelize=require(_0x6b7d('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x6b7d('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x6b7d('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x6b7d('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x6b7d('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x6b7d('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x6b7d('0x3')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x6b7d('0x1')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x6b7d('0x4')](0x2)[_0x6b7d('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x6b7d('0x3')],'defaultValue':function(){return _0x6b7d('0x6');}},'notificationSound':{'type':Sequelize[_0x6b7d('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6b7d('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6b7d('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6b7d('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6b7d('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6b7d('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6b7d('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6b7d('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0x6b7d('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x6b7d('0x8'),'set':function(_0x928663){if(!_0x928663)this[_0x6b7d('0x9')](_0x6b7d('0xa'),null);this[_0x6b7d('0x9')]('mandatoryDisposition',_0x928663);}}}; \ No newline at end of file +var _0x3b17=['BOOLEAN','STRING','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x3b17,0x14f));var _0x73b1=function(_0x237979,_0x2fdb70){_0x237979=_0x237979-0x0;var _0x215c96=_0x3b17[_0x237979];return _0x215c96;};'use strict';var Sequelize=require(_0x73b1('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x73b1('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0x73b1('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x73b1('0x1')],'defaultValue':!![]},'key':{'type':Sequelize[_0x73b1('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x73b1('0x3')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x73b1('0x4')},'fontSize':{'type':Sequelize[_0x73b1('0x5')](0x2)[_0x73b1('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x73b1('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x73b1('0x1')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x73b1('0x1')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x73b1('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x73b1('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x73b1('0x1')],'defaultValue':![],'comment':_0x73b1('0x9'),'set':function(_0x40de86){if(!_0x40de86)this[_0x73b1('0xa')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x73b1('0xb'),_0x40de86);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index dad60ca..56a5cc2 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 _0x1b06=['secure','sendMail','List\x20not\x20found','List','ListId','subject','out','format','Interaction','Messages','verifySmtp','VerifySmtp','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','util','sox','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','client','http','test','Sequelize','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','get','MailAccounts','UserProfileResource','sendStatus','stack','name','index','MailServerIn','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','MailAccount','includeAll','findAll','show','body','find','params','describe','addDisposition','Disposition','create','getDispositions','findOne','rawAttributes','hasOwnProperty','MailAccountId','removeDispositions','ids','CannedAnswer','getAnswers','include','removeAnswers','email','isNil','description','cservice','user','cuser','password','pass','cpassword','authentication','host','port','service','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','getSmtp','addSmtp','setSmtp','MailInteraction','addInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','Tag','Tags','tag','rows','addApplications','MailApplication','destroy','findAndCountAll','priority','getApplications','getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','MailMessage','split','Contacts','updatedAt','from','attachments','join','root','server/files/attachments','basename','auth'];(function(_0x3434a4,_0x4de359){var _0x2a1284=function(_0x24da6c){while(--_0x24da6c){_0x3434a4['push'](_0x3434a4['shift']());}};_0x2a1284(++_0x4de359);}(_0x1b06,0x182));var _0x61b0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1b06[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x61b0('0x0'));var emlformat=require(_0x61b0('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x61b0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x61b0('0x3'));var moment=require(_0x61b0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x61b0('0x5'));var util=require(_0x61b0('0x6'));var path=require('path');var sox=require(_0x61b0('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x61b0('0x8'));var jsforce=require(_0x61b0('0x9'));var deskjs=require(_0x61b0('0xa'));var toCsv=require('to-csv');var querystring=require(_0x61b0('0xb'));var Papa=require(_0x61b0('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x61b0('0xd'));var hardwareService=require(_0x61b0('0xe'));var logger=require(_0x61b0('0xf'))(_0x61b0('0x10'));var utils=require(_0x61b0('0x11'));var config=require('../../config/environment');var db=require(_0x61b0('0x12'))['db'];config[_0x61b0('0x13')]=_[_0x61b0('0x14')](config[_0x61b0('0x13')],{'host':_0x61b0('0x15'),'port':0x18eb});var socket=require(_0x61b0('0x16'))(new Redis(config[_0x61b0('0x13')]));require(_0x61b0('0x17'))[_0x61b0('0x18')](socket);var jayson=require('jayson/promise');var client=jayson[_0x61b0('0x19')][_0x61b0('0x1a')]({'port':0x232b});function checkPasswordPattern(_0x15ec58,_0x4b694b,_0x57c45d){if(_0x57c45d){var _0x32c543=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x32c543[_0x61b0('0x1b')](_0x4b694b)){return _0x15ec58;}else{throw new db[(_0x61b0('0x1c'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x15ec58;}}function respondWithRpcPromise(_0x22c05e,_0x1c6bb7,_0x3a6cdc,_0x229d46){return new BPromise(function(_0x35cc39,_0x1c451d){var _0x5b341f=_0x229d46||client;return _0x5b341f[_0x61b0('0x1d')](_0x22c05e,_0x3a6cdc)[_0x61b0('0x1e')](function(_0x2241a5){logger['info'](_0x61b0('0x1f'),_0x1c6bb7,_0x61b0('0x20'));logger['debug'](_0x61b0('0x21'),_0x1c6bb7,_0x61b0('0x20'),JSON[_0x61b0('0x22')](_0x2241a5));if(_0x2241a5[_0x61b0('0x23')]){if(_0x2241a5['error'][_0x61b0('0x24')]===0x1f4){logger[_0x61b0('0x23')](_0x61b0('0x1f'),_0x1c6bb7,_0x2241a5[_0x61b0('0x23')][_0x61b0('0x25')]);return _0x1c451d(_0x2241a5[_0x61b0('0x23')][_0x61b0('0x25')]);}logger[_0x61b0('0x23')](_0x61b0('0x1f'),_0x1c6bb7,_0x2241a5['error']['message']);return _0x35cc39(_0x2241a5['error'][_0x61b0('0x25')]);}else{logger[_0x61b0('0x26')](_0x61b0('0x1f'),_0x1c6bb7,_0x61b0('0x20'));_0x35cc39(_0x2241a5[_0x61b0('0x27')][_0x61b0('0x25')]);}})[_0x61b0('0x28')](function(_0x4fa28e){logger['error'](_0x61b0('0x1f'),_0x1c6bb7,_0x4fa28e);_0x1c451d(_0x4fa28e);});});}function respondWithStatusCode(_0x396aba,_0x49e659){_0x49e659=_0x49e659||0xcc;return function(_0x26328d){if(_0x26328d){return _0x396aba['sendStatus'](_0x49e659);}return _0x396aba['status'](_0x49e659)[_0x61b0('0x29')]();};}function respondWithResult(_0x1594dc,_0x4e1e36){_0x4e1e36=_0x4e1e36||0xc8;return function(_0x45fc28){if(_0x45fc28){return _0x1594dc[_0x61b0('0x2a')](_0x4e1e36)[_0x61b0('0x2b')](_0x45fc28);}};}function respondWithFilteredResult(_0x3a5565,_0x1eed6b){return function(_0x336058){if(_0x336058){var _0x22a46f=_0x336058[_0x61b0('0x2c')],_0x15df82=_0x1eed6b['offset'],_0x3674c5=_0x1eed6b[_0x61b0('0x2d')]+_0x1eed6b[_0x61b0('0x2e')],_0x38ae8d;if(_0x3674c5>=_0x22a46f){_0x3674c5=_0x22a46f;_0x38ae8d=0xc8;}else{_0x38ae8d=0xce;}_0x3a5565['status'](_0x38ae8d);return _0x3a5565[_0x61b0('0x2f')](_0x61b0('0x30'),_0x15df82+'-'+_0x3674c5+'/'+_0x22a46f)['json'](_0x336058);}return null;};}function patchUpdates(_0x1f70f2){return function(_0x47b074){try{jsonpatch[_0x61b0('0x31')](_0x47b074,_0x1f70f2,!![]);}catch(_0x57f506){return BPromise['reject'](_0x57f506);}return _0x47b074[_0x61b0('0x32')]();};}function saveUpdates(_0x150bab,_0x48c237){return function(_0x3c970f){if(_0x3c970f){return _0x3c970f[_0x61b0('0x33')](_0x150bab)['then'](function(_0x1e63fb){return _0x1e63fb;});}return null;};}function removeEntity(_0x33a70e,_0xda74b2){return function(_0x2c481b){if(_0x2c481b){return _0x2c481b['destroy']()[_0x61b0('0x1e')](function(){var _0x1bdbec=_0x2c481b[_0x61b0('0x34')]({'plain':!![]});var _0x14a79d=_0x61b0('0x35');return db[_0x61b0('0x36')]['destroy']({'where':{'type':_0x14a79d,'resourceId':_0x1bdbec['id']}})[_0x61b0('0x1e')](function(){return _0x2c481b;});})[_0x61b0('0x1e')](function(){_0x33a70e[_0x61b0('0x2a')](0xcc)[_0x61b0('0x29')]();});}};}function handleEntityNotFound(_0xc087d4,_0x1288c0){return function(_0x260cb0){if(!_0x260cb0){_0xc087d4[_0x61b0('0x37')](0x194);}return _0x260cb0;};}function handleError(_0x31ea9b,_0x2f7b55){_0x2f7b55=_0x2f7b55||0x1f4;return function(_0x4d446f){logger['error'](_0x4d446f[_0x61b0('0x38')]);if(_0x4d446f[_0x61b0('0x39')]){delete _0x4d446f[_0x61b0('0x39')];}_0x31ea9b[_0x61b0('0x2a')](_0x2f7b55)['send'](_0x4d446f);};}exports[_0x61b0('0x3a')]=function(_0x2f0580,_0x9e9f91){var _0x369718={'include':[{'model':db[_0x61b0('0x3b')],'as':_0x61b0('0x3c')},{'model':db[_0x61b0('0x3d')],'as':_0x61b0('0x3e')},{'model':db[_0x61b0('0x3f')],'as':_0x61b0('0x40')}]},_0xe966ea={},_0x4308bd={'count':0x0,'rows':[]};var _0x106b25=_[_0x61b0('0x41')](db['MailAccount']['rawAttributes'],function(_0x465f45){return{'name':_0x465f45[_0x61b0('0x42')],'type':_0x465f45[_0x61b0('0x43')][_0x61b0('0x44')]};});_0xe966ea[_0x61b0('0x45')]=_[_0x61b0('0x41')](_0x106b25,_0x61b0('0x39'));_0xe966ea[_0x61b0('0x46')]=_[_0x61b0('0x47')](_0x2f0580['query']);_0xe966ea['filters']=_['intersection'](_0xe966ea[_0x61b0('0x45')],_0xe966ea[_0x61b0('0x46')]);_0x369718[_0x61b0('0x48')]=_[_0x61b0('0x49')](_0xe966ea['model'],qs[_0x61b0('0x4a')](_0x2f0580[_0x61b0('0x46')][_0x61b0('0x4a')]));_0x369718[_0x61b0('0x48')]=_0x369718[_0x61b0('0x48')][_0x61b0('0x4b')]?_0x369718[_0x61b0('0x48')]:_0xe966ea['model'];if(!_0x2f0580[_0x61b0('0x46')]['hasOwnProperty'](_0x61b0('0x4c'))){_0x369718['limit']=qs[_0x61b0('0x2e')](_0x2f0580[_0x61b0('0x46')][_0x61b0('0x2e')]);_0x369718[_0x61b0('0x2d')]=qs[_0x61b0('0x2d')](_0x2f0580[_0x61b0('0x46')][_0x61b0('0x2d')]);}_0x369718[_0x61b0('0x4d')]=qs['sort'](_0x2f0580[_0x61b0('0x46')][_0x61b0('0x4e')]);_0x369718[_0x61b0('0x4f')]=qs[_0x61b0('0x50')](_[_0x61b0('0x51')](_0x2f0580[_0x61b0('0x46')],_0xe966ea[_0x61b0('0x50')]),_0x106b25);if(_0x2f0580[_0x61b0('0x46')]['filter']){_0x369718[_0x61b0('0x4f')]=_['merge'](_0x369718[_0x61b0('0x4f')],{'$or':_['map'](_0x106b25,function(_0x23dff6){if(_0x23dff6[_0x61b0('0x43')]!==_0x61b0('0x52')){var _0x1cec00={};_0x1cec00[_0x23dff6[_0x61b0('0x39')]]={'$like':'%'+_0x2f0580[_0x61b0('0x46')][_0x61b0('0x53')]+'%'};return _0x1cec00;}})});}_0x369718=_[_0x61b0('0x54')]({},_0x369718,_0x2f0580[_0x61b0('0x55')]);var _0x1be55f={'where':_0x369718[_0x61b0('0x4f')]};return db[_0x61b0('0x56')][_0x61b0('0x2c')](_0x1be55f)[_0x61b0('0x1e')](function(_0x564879){_0x4308bd[_0x61b0('0x2c')]=_0x564879;if(_0x2f0580['query'][_0x61b0('0x57')]){_0x369718['include']=[{'all':!![]}];}return db[_0x61b0('0x56')][_0x61b0('0x58')](_0x369718);})[_0x61b0('0x1e')](function(_0x41d8c2){_0x4308bd['rows']=_0x41d8c2;return _0x4308bd;})[_0x61b0('0x1e')](respondWithFilteredResult(_0x9e9f91,_0x369718))[_0x61b0('0x28')](handleError(_0x9e9f91,null));};exports[_0x61b0('0x59')]=function(_0x395771,_0x341f12){var _0x404e93={'raw':![],'where':{'id':_0x395771['params']['id']},'include':[{'model':db[_0x61b0('0x3b')],'as':_0x61b0('0x3c')},{'model':db[_0x61b0('0x3d')],'as':_0x61b0('0x3e')},{'model':db[_0x61b0('0x3f')],'as':_0x61b0('0x40')}]},_0x1cc43f={};_0x1cc43f[_0x61b0('0x45')]=_[_0x61b0('0x47')](db[_0x61b0('0x56')]['rawAttributes']);_0x1cc43f[_0x61b0('0x46')]=_[_0x61b0('0x47')](_0x395771[_0x61b0('0x46')]);_0x1cc43f['filters']=_['intersection'](_0x1cc43f[_0x61b0('0x45')],_0x1cc43f[_0x61b0('0x46')]);_0x404e93[_0x61b0('0x48')]=_[_0x61b0('0x49')](_0x1cc43f[_0x61b0('0x45')],qs[_0x61b0('0x4a')](_0x395771[_0x61b0('0x46')]['fields']));_0x404e93[_0x61b0('0x48')]=_0x404e93['attributes'][_0x61b0('0x4b')]?_0x404e93[_0x61b0('0x48')]:_0x1cc43f[_0x61b0('0x45')];if(_0x395771[_0x61b0('0x46')]['includeAll']){_0x404e93['include']=[{'all':!![]}];}_0x404e93=_[_0x61b0('0x54')]({},_0x404e93,_0x395771['options']);return db[_0x61b0('0x56')]['find'](_0x404e93)[_0x61b0('0x1e')](handleEntityNotFound(_0x341f12,null))['then'](respondWithResult(_0x341f12,null))[_0x61b0('0x28')](handleError(_0x341f12,null));};exports[_0x61b0('0x33')]=function(_0x30d637,_0x384b82){if(_0x30d637['body']['id']){delete _0x30d637[_0x61b0('0x5a')]['id'];}return db[_0x61b0('0x56')][_0x61b0('0x5b')]({'where':{'id':_0x30d637[_0x61b0('0x5c')]['id']},'include':[{'model':db[_0x61b0('0x3b')],'as':_0x61b0('0x3c')},{'model':db[_0x61b0('0x3d')],'as':_0x61b0('0x3e')},{'model':db[_0x61b0('0x3f')],'as':_0x61b0('0x40')}]})[_0x61b0('0x1e')](handleEntityNotFound(_0x384b82,null))['then'](saveUpdates(_0x30d637[_0x61b0('0x5a')],null))[_0x61b0('0x1e')](function(_0x19ff22){if(_0x19ff22&&_0x30d637['body']['Imap']){return db['MailServerIn'][_0x61b0('0x33')](_0x30d637[_0x61b0('0x5a')][_0x61b0('0x3c')],{'where':{'MailAccountId':_0x19ff22['id']}})[_0x61b0('0x1e')](function(){return _0x19ff22;});}return _0x19ff22;})[_0x61b0('0x1e')](function(_0x415dc5){if(_0x415dc5&&_0x30d637[_0x61b0('0x5a')][_0x61b0('0x3e')]){return db[_0x61b0('0x3d')][_0x61b0('0x33')](_0x30d637[_0x61b0('0x5a')][_0x61b0('0x3e')],{'where':{'MailAccountId':_0x415dc5['id']}})['then'](function(){return _0x415dc5;});}return _0x415dc5;})[_0x61b0('0x1e')](respondWithResult(_0x384b82,null))[_0x61b0('0x28')](handleError(_0x384b82,null));};exports[_0x61b0('0x5d')]=function(_0x2d7cb4,_0x5aa47d){return db[_0x61b0('0x56')][_0x61b0('0x5d')]()[_0x61b0('0x1e')](respondWithResult(_0x5aa47d,null))['catch'](handleError(_0x5aa47d,null));};exports[_0x61b0('0x5e')]=function(_0xdb863e,_0x254d5f,_0x550d47){if(_0xdb863e[_0x61b0('0x5a')]['id']){delete _0xdb863e['body']['id'];}return db[_0x61b0('0x56')][_0x61b0('0x5b')]({'where':{'id':_0xdb863e[_0x61b0('0x5c')]['id']}})[_0x61b0('0x1e')](handleEntityNotFound(_0x254d5f,null))[_0x61b0('0x1e')](function(_0xd50e60){if(_0xd50e60){_0xdb863e[_0x61b0('0x5a')]['MailAccountId']=_0xd50e60['id'];return db[_0x61b0('0x5f')][_0x61b0('0x60')](_0xdb863e['body']);}})['then'](respondWithResult(_0x254d5f,null))[_0x61b0('0x28')](handleError(_0x254d5f,null));};exports[_0x61b0('0x61')]=function(_0xb31a32,_0x3133cd,_0x74228b){var _0x1a4140={'raw':![],'where':{}};var _0x219c81={};var _0x2519b1={'count':0x0,'rows':[]};return db[_0x61b0('0x56')][_0x61b0('0x62')]({'where':{'id':_0xb31a32[_0x61b0('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3133cd,null))['then'](function(_0x3d3e7e){if(_0x3d3e7e){_0x219c81[_0x61b0('0x45')]=_[_0x61b0('0x47')](db[_0x61b0('0x5f')][_0x61b0('0x63')]);_0x219c81[_0x61b0('0x46')]=_[_0x61b0('0x47')](_0xb31a32[_0x61b0('0x46')]);_0x219c81[_0x61b0('0x50')]=_['intersection'](_0x219c81[_0x61b0('0x45')],_0x219c81[_0x61b0('0x46')]);_0x1a4140['attributes']=_[_0x61b0('0x49')](_0x219c81['model'],qs[_0x61b0('0x4a')](_0xb31a32['query'][_0x61b0('0x4a')]));_0x1a4140['attributes']=_0x1a4140[_0x61b0('0x48')][_0x61b0('0x4b')]?_0x1a4140['attributes']:_0x219c81['model'];if(!_0xb31a32['query'][_0x61b0('0x64')](_0x61b0('0x4c'))){_0x1a4140['limit']=qs[_0x61b0('0x2e')](_0xb31a32[_0x61b0('0x46')]['limit']);_0x1a4140[_0x61b0('0x2d')]=qs[_0x61b0('0x2d')](_0xb31a32['query'][_0x61b0('0x2d')]);}_0x1a4140[_0x61b0('0x4d')]=qs[_0x61b0('0x4e')](_0xb31a32['query'][_0x61b0('0x4e')]);_0x1a4140[_0x61b0('0x4f')]=qs[_0x61b0('0x50')](_['pick'](_0xb31a32[_0x61b0('0x46')],_0x219c81[_0x61b0('0x50')]));_0x1a4140[_0x61b0('0x4f')][_0x61b0('0x65')]=_0x3d3e7e['id'];if(_0xb31a32[_0x61b0('0x46')][_0x61b0('0x53')]){_0x1a4140[_0x61b0('0x4f')]=_['merge'](_0x1a4140[_0x61b0('0x4f')],{'$or':_[_0x61b0('0x41')](_0x1a4140['attributes'],function(_0x3195ab){var _0x565a4c={};_0x565a4c[_0x3195ab]={'$like':'%'+_0xb31a32['query'][_0x61b0('0x53')]+'%'};return _0x565a4c;})});}_0x1a4140=_[_0x61b0('0x54')]({},_0x1a4140,_0xb31a32[_0x61b0('0x55')]);return db[_0x61b0('0x5f')][_0x61b0('0x2c')]({'where':_0x1a4140['where']})[_0x61b0('0x1e')](function(_0x525893){_0x2519b1[_0x61b0('0x2c')]=_0x525893;if(_0xb31a32['query'][_0x61b0('0x57')]){_0x1a4140['include']=[{'all':!![]}];}return db[_0x61b0('0x5f')][_0x61b0('0x58')](_0x1a4140);})['then'](function(_0x31fa9e){_0x2519b1['rows']=_0x31fa9e;return _0x2519b1;});}})['then'](respondWithFilteredResult(_0x3133cd,_0x1a4140))['catch'](handleError(_0x3133cd,null));};exports[_0x61b0('0x66')]=function(_0x5d1735,_0x48e251,_0x25d476){return db[_0x61b0('0x56')][_0x61b0('0x5b')]({'where':{'id':_0x5d1735['params']['id']}})[_0x61b0('0x1e')](handleEntityNotFound(_0x48e251,null))[_0x61b0('0x1e')](function(_0x516418){if(_0x516418){return _0x516418[_0x61b0('0x66')](_0x5d1735[_0x61b0('0x46')][_0x61b0('0x67')]);}})[_0x61b0('0x1e')](respondWithStatusCode(_0x48e251,null))[_0x61b0('0x28')](handleError(_0x48e251,null));};exports['addAnswer']=function(_0x40716d,_0x540bc5,_0x41770c){if(_0x40716d[_0x61b0('0x5a')]['id']){delete _0x40716d[_0x61b0('0x5a')]['id'];}return db['MailAccount'][_0x61b0('0x5b')]({'where':{'id':_0x40716d[_0x61b0('0x5c')]['id']}})[_0x61b0('0x1e')](handleEntityNotFound(_0x540bc5,null))[_0x61b0('0x1e')](function(_0x57f055){if(_0x57f055){_0x40716d['body'][_0x61b0('0x65')]=_0x57f055['id'];return db[_0x61b0('0x68')][_0x61b0('0x60')](_0x40716d[_0x61b0('0x5a')]);}})['then'](respondWithResult(_0x540bc5,null))[_0x61b0('0x28')](handleError(_0x540bc5,null));};exports[_0x61b0('0x69')]=function(_0x1da89e,_0x8fb685,_0x2759f0){var _0x4f5f65={'raw':![],'where':{}};var _0x148e73={};var _0x29de56={'count':0x0,'rows':[]};return db['MailAccount'][_0x61b0('0x62')]({'where':{'id':_0x1da89e['params']['id']}})[_0x61b0('0x1e')](handleEntityNotFound(_0x8fb685,null))[_0x61b0('0x1e')](function(_0x54d8ca){if(_0x54d8ca){_0x148e73['model']=_['keys'](db[_0x61b0('0x68')][_0x61b0('0x63')]);_0x148e73['query']=_['keys'](_0x1da89e['query']);_0x148e73['filters']=_['intersection'](_0x148e73['model'],_0x148e73[_0x61b0('0x46')]);_0x4f5f65[_0x61b0('0x48')]=_[_0x61b0('0x49')](_0x148e73[_0x61b0('0x45')],qs[_0x61b0('0x4a')](_0x1da89e[_0x61b0('0x46')][_0x61b0('0x4a')]));_0x4f5f65['attributes']=_0x4f5f65[_0x61b0('0x48')][_0x61b0('0x4b')]?_0x4f5f65[_0x61b0('0x48')]:_0x148e73[_0x61b0('0x45')];if(!_0x1da89e[_0x61b0('0x46')][_0x61b0('0x64')](_0x61b0('0x4c'))){_0x4f5f65[_0x61b0('0x2e')]=qs[_0x61b0('0x2e')](_0x1da89e[_0x61b0('0x46')][_0x61b0('0x2e')]);_0x4f5f65[_0x61b0('0x2d')]=qs['offset'](_0x1da89e[_0x61b0('0x46')][_0x61b0('0x2d')]);}_0x4f5f65[_0x61b0('0x4d')]=qs[_0x61b0('0x4e')](_0x1da89e[_0x61b0('0x46')][_0x61b0('0x4e')]);_0x4f5f65[_0x61b0('0x4f')]=qs[_0x61b0('0x50')](_[_0x61b0('0x51')](_0x1da89e['query'],_0x148e73[_0x61b0('0x50')]));_0x4f5f65['where'][_0x61b0('0x65')]=_0x54d8ca['id'];if(_0x1da89e[_0x61b0('0x46')][_0x61b0('0x53')]){_0x4f5f65[_0x61b0('0x4f')]=_[_0x61b0('0x54')](_0x4f5f65[_0x61b0('0x4f')],{'$or':_['map'](_0x4f5f65[_0x61b0('0x48')],function(_0xeabbf5){var _0x4b8c2c={};_0x4b8c2c[_0xeabbf5]={'$like':'%'+_0x1da89e[_0x61b0('0x46')][_0x61b0('0x53')]+'%'};return _0x4b8c2c;})});}_0x4f5f65=_[_0x61b0('0x54')]({},_0x4f5f65,_0x1da89e[_0x61b0('0x55')]);return db['CannedAnswer']['count']({'where':_0x4f5f65[_0x61b0('0x4f')]})[_0x61b0('0x1e')](function(_0x3816ac){_0x29de56['count']=_0x3816ac;if(_0x1da89e['query'][_0x61b0('0x57')]){_0x4f5f65[_0x61b0('0x6a')]=[{'all':!![]}];}return db[_0x61b0('0x68')][_0x61b0('0x58')](_0x4f5f65);})[_0x61b0('0x1e')](function(_0xc07cf8){_0x29de56['rows']=_0xc07cf8;return _0x29de56;});}})[_0x61b0('0x1e')](respondWithFilteredResult(_0x8fb685,_0x4f5f65))['catch'](handleError(_0x8fb685,null));};exports[_0x61b0('0x6b')]=function(_0x3c0683,_0xc94f62,_0x11469e){return db[_0x61b0('0x56')][_0x61b0('0x5b')]({'where':{'id':_0x3c0683[_0x61b0('0x5c')]['id']}})[_0x61b0('0x1e')](handleEntityNotFound(_0xc94f62,null))['then'](function(_0x4e5545){if(_0x4e5545){return _0x4e5545[_0x61b0('0x6b')](_0x3c0683[_0x61b0('0x46')][_0x61b0('0x67')]);}})['then'](respondWithStatusCode(_0xc94f62,null))[_0x61b0('0x28')](handleError(_0xc94f62,null));};exports['create']=function(_0x5d0685,_0x20d7f6){var _0x26a2fe={'name':_0x5d0685['body'][_0x61b0('0x39')],'key':_0x5d0685[_0x61b0('0x5a')][_0x61b0('0x44')],'email':_0x5d0685[_0x61b0('0x5a')][_0x61b0('0x6c')],'ListId':_0x5d0685[_0x61b0('0x5a')]['ListId'],'active':!_[_0x61b0('0x6d')](_0x5d0685[_0x61b0('0x5a')]['active'])?_0x5d0685[_0x61b0('0x5a')]['active']:!![],'description':_0x5d0685[_0x61b0('0x5a')][_0x61b0('0x6e')]||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x5d0685['body'][_0x61b0('0x6f')])){if(_0x5d0685[_0x61b0('0x5a')]['cauthentication']){_0x26a2fe[_0x61b0('0x3c')]['user']=_0x26a2fe['Smtp'][_0x61b0('0x70')]=_0x5d0685[_0x61b0('0x5a')][_0x61b0('0x71')];_0x26a2fe[_0x61b0('0x3c')][_0x61b0('0x72')]=_0x26a2fe['Smtp'][_0x61b0('0x73')]=_0x5d0685[_0x61b0('0x5a')][_0x61b0('0x74')];}else{_0x26a2fe[_0x61b0('0x3c')][_0x61b0('0x75')]=_0x26a2fe['Smtp'][_0x61b0('0x75')]=![];}_0x26a2fe[_0x61b0('0x3c')][_0x61b0('0x76')]=_0x5d0685[_0x61b0('0x5a')][_0x61b0('0x3c')][_0x61b0('0x76')];_0x26a2fe[_0x61b0('0x3c')][_0x61b0('0x77')]=_0x5d0685[_0x61b0('0x5a')]['Imap'][_0x61b0('0x77')];_0x26a2fe[_0x61b0('0x3e')]['host']=_0x5d0685['body'][_0x61b0('0x3e')]['host'];_0x26a2fe[_0x61b0('0x3e')]['port']=_0x5d0685[_0x61b0('0x5a')][_0x61b0('0x3e')][_0x61b0('0x77')];}else{_0x26a2fe[_0x61b0('0x3c')][_0x61b0('0x78')]=_0x26a2fe[_0x61b0('0x3e')][_0x61b0('0x78')]=_0x5d0685['body'][_0x61b0('0x6f')];_0x26a2fe[_0x61b0('0x3c')][_0x61b0('0x70')]=_0x26a2fe[_0x61b0('0x3e')][_0x61b0('0x70')]=_0x5d0685[_0x61b0('0x5a')][_0x61b0('0x71')];_0x26a2fe['Imap']['password']=_0x26a2fe[_0x61b0('0x3e')]['pass']=_0x5d0685[_0x61b0('0x5a')][_0x61b0('0x74')];}return db['MailAccount'][_0x61b0('0x60')](_0x26a2fe,{'include':[{'model':db['MailServerOut'],'as':_0x61b0('0x3e')},{'model':db[_0x61b0('0x3b')],'as':_0x61b0('0x3c')}]})[_0x61b0('0x1e')](function(_0x21efd4){var _0x3c0f55=_0x5d0685[_0x61b0('0x70')][_0x61b0('0x34')]({'plain':!![]});if(!_0x3c0f55)throw new Error(_0x61b0('0x79'));if(_0x3c0f55['role']===_0x61b0('0x70')){var _0x298865=_0x21efd4[_0x61b0('0x34')]({'plain':!![]});return db[_0x61b0('0x7a')][_0x61b0('0x5b')]({'where':{'name':_0x61b0('0x35'),'userProfileId':_0x3c0f55['userProfileId']},'raw':!![]})[_0x61b0('0x1e')](function(_0x3cae80){if(_0x3cae80&&_0x3cae80[_0x61b0('0x7b')]===0x0){return db[_0x61b0('0x36')][_0x61b0('0x60')]({'name':_0x298865['name'],'resourceId':_0x298865['id'],'type':_0x3cae80[_0x61b0('0x39')],'sectionId':_0x3cae80['id']},{})[_0x61b0('0x1e')](function(){return _0x21efd4;});}else{return _0x21efd4;}})[_0x61b0('0x28')](function(_0x3dd65e){logger[_0x61b0('0x23')](_0x61b0('0x7c'),_0x3dd65e);throw _0x3dd65e;});}return _0x21efd4;})['then'](respondWithResult(_0x20d7f6,0xc9))['catch'](handleError(_0x20d7f6,null));};exports[_0x61b0('0x7d')]=function(_0x5a88b0,_0x338a10,_0x4cad60){return db[_0x61b0('0x56')]['findOne']({'where':{'id':_0x5a88b0['params']['id']}})[_0x61b0('0x1e')](handleEntityNotFound(_0x338a10,null))['then'](function(_0x43a4c5){if(_0x43a4c5){return _0x43a4c5['getImap']();}return null;})[_0x61b0('0x1e')](respondWithResult(_0x338a10,null))[_0x61b0('0x28')](handleError(_0x338a10,null));};exports[_0x61b0('0x7e')]=function(_0x4f926e,_0x1b659b,_0x104fd4){if(_0x4f926e[_0x61b0('0x5a')]['id']){delete _0x4f926e[_0x61b0('0x5a')]['id'];}return db[_0x61b0('0x56')][_0x61b0('0x5b')]({'where':{'id':_0x4f926e[_0x61b0('0x5c')]['id']}})[_0x61b0('0x1e')](handleEntityNotFound(_0x1b659b,null))[_0x61b0('0x1e')](function(_0x16b1c8){if(_0x16b1c8){_0x4f926e[_0x61b0('0x5a')]['MailAccountId']=_0x16b1c8['id'];return db[_0x61b0('0x3b')][_0x61b0('0x60')](_0x4f926e[_0x61b0('0x5a')]);}})[_0x61b0('0x1e')](respondWithResult(_0x1b659b,null))[_0x61b0('0x28')](handleError(_0x1b659b,null));};exports['removeImap']=function(_0x4a456b,_0x4fb8c9,_0x3b6d52){return db['MailAccount']['findOne']({'where':{'id':_0x4a456b['params']['id']}})[_0x61b0('0x1e')](handleEntityNotFound(_0x4fb8c9,null))[_0x61b0('0x1e')](function(_0x410064){if(_0x410064){return _0x410064['setImap'](null);}return null;})[_0x61b0('0x1e')](respondWithStatusCode(_0x4fb8c9,null))[_0x61b0('0x28')](handleError(_0x4fb8c9,null));};exports[_0x61b0('0x7f')]=function(_0x434644,_0x439b03,_0xf77fe8){return db[_0x61b0('0x56')][_0x61b0('0x62')]({'where':{'id':_0x434644['params']['id']}})[_0x61b0('0x1e')](handleEntityNotFound(_0x439b03,null))['then'](function(_0x5a2fcf){if(_0x5a2fcf){return _0x5a2fcf[_0x61b0('0x7f')]();}return null;})[_0x61b0('0x1e')](respondWithResult(_0x439b03,null))[_0x61b0('0x28')](handleError(_0x439b03,null));};exports[_0x61b0('0x80')]=function(_0x1e7583,_0x38f36a,_0x36d7ae){if(_0x1e7583['body']['id']){delete _0x1e7583[_0x61b0('0x5a')]['id'];}return db[_0x61b0('0x56')][_0x61b0('0x5b')]({'where':{'id':_0x1e7583[_0x61b0('0x5c')]['id']}})[_0x61b0('0x1e')](handleEntityNotFound(_0x38f36a,null))[_0x61b0('0x1e')](function(_0x6fcaf1){if(_0x6fcaf1){_0x1e7583[_0x61b0('0x5a')][_0x61b0('0x65')]=_0x6fcaf1['id'];return db[_0x61b0('0x3d')][_0x61b0('0x60')](_0x1e7583[_0x61b0('0x5a')]);}})[_0x61b0('0x1e')](respondWithResult(_0x38f36a,null))[_0x61b0('0x28')](handleError(_0x38f36a,null));};exports['removeSmtp']=function(_0x52039d,_0x20b8b3,_0x4f5a8a){return db[_0x61b0('0x56')][_0x61b0('0x62')]({'where':{'id':_0x52039d[_0x61b0('0x5c')]['id']}})[_0x61b0('0x1e')](handleEntityNotFound(_0x20b8b3,null))[_0x61b0('0x1e')](function(_0x47900a){if(_0x47900a){return _0x47900a[_0x61b0('0x81')](null);}return null;})[_0x61b0('0x1e')](respondWithStatusCode(_0x20b8b3,null))[_0x61b0('0x28')](handleError(_0x20b8b3,null));};exports['addInteraction']=function(_0x10c7d9,_0x373080,_0x287f6c){return db[_0x61b0('0x82')]['find']({'where':{'id':_0x10c7d9[_0x61b0('0x5c')]['id']}})[_0x61b0('0x1e')](handleEntityNotFound(_0x373080,null))[_0x61b0('0x1e')](function(_0x5d268b){if(_0x5d268b){return _0x5d268b[_0x61b0('0x83')](_0x10c7d9[_0x61b0('0x5a')][_0x61b0('0x67')],_[_0x61b0('0x84')](_0x10c7d9[_0x61b0('0x5a')],[_0x61b0('0x67'),'id'])||{});}})[_0x61b0('0x1e')](respondWithResult(_0x373080,null))[_0x61b0('0x28')](handleError(_0x373080,null));};exports[_0x61b0('0x85')]=function(_0x483052,_0x306643,_0x20ecba){var _0x4020c8={'raw':![],'where':{}};var _0x3c4352={};var _0x4c8c63={'count':0x0,'rows':[]};return db[_0x61b0('0x56')][_0x61b0('0x62')]({'where':{'id':_0x483052[_0x61b0('0x5c')]['id']}})['then'](handleEntityNotFound(_0x306643,null))[_0x61b0('0x1e')](function(_0x326adb){if(_0x326adb){_0x3c4352[_0x61b0('0x45')]=_[_0x61b0('0x47')](db[_0x61b0('0x82')]['rawAttributes']);_0x3c4352[_0x61b0('0x46')]=_[_0x61b0('0x47')](_0x483052['query']);_0x3c4352[_0x61b0('0x50')]=_['intersection'](_0x3c4352[_0x61b0('0x45')],_0x3c4352[_0x61b0('0x46')]);_0x4020c8['attributes']=_['intersection'](_0x3c4352[_0x61b0('0x45')],qs[_0x61b0('0x4a')](_0x483052[_0x61b0('0x46')]['fields']));_0x4020c8['attributes']=_0x4020c8[_0x61b0('0x48')]['length']?_0x4020c8[_0x61b0('0x48')]:_0x3c4352[_0x61b0('0x45')];if(!_0x483052['query'][_0x61b0('0x64')](_0x61b0('0x4c'))){_0x4020c8[_0x61b0('0x2e')]=qs[_0x61b0('0x2e')](_0x483052[_0x61b0('0x46')][_0x61b0('0x2e')]);_0x4020c8[_0x61b0('0x2d')]=qs[_0x61b0('0x2d')](_0x483052[_0x61b0('0x46')][_0x61b0('0x2d')]);}_0x4020c8['order']=qs[_0x61b0('0x4e')](_0x483052[_0x61b0('0x46')]['sort']);_0x4020c8[_0x61b0('0x4f')]=qs[_0x61b0('0x50')](_[_0x61b0('0x51')](_0x483052[_0x61b0('0x46')],_0x3c4352[_0x61b0('0x50')]));_0x4020c8[_0x61b0('0x4f')][_0x61b0('0x65')]=_0x326adb['id'];if(_0x483052[_0x61b0('0x46')][_0x61b0('0x53')]){_0x4020c8[_0x61b0('0x4f')]=_[_0x61b0('0x54')](_0x4020c8[_0x61b0('0x4f')],{'$or':_[_0x61b0('0x41')](_0x4020c8[_0x61b0('0x48')],function(_0x5274eb){var _0x5dbfe1={};_0x5dbfe1[_0x5274eb]={'$like':'%'+_0x483052['query'][_0x61b0('0x53')]+'%'};return _0x5dbfe1;})});}_0x4020c8=_[_0x61b0('0x54')]({},_0x4020c8,_0x483052[_0x61b0('0x55')]);return db[_0x61b0('0x82')][_0x61b0('0x2c')]({'where':_0x4020c8[_0x61b0('0x4f')]})[_0x61b0('0x1e')](function(_0x2b3987){_0x4c8c63[_0x61b0('0x2c')]=_0x2b3987;if(_0x483052['query'][_0x61b0('0x57')]){_0x4020c8[_0x61b0('0x6a')]=[{'model':db[_0x61b0('0x86')],'as':_0x61b0('0x87'),'required':![]},{'model':db[_0x61b0('0x88')],'as':_0x61b0('0x89'),'attributes':['name',_0x61b0('0x8a'),'internal'],'required':![]},{'model':db[_0x61b0('0x8b')],'as':_0x61b0('0x8c'),'attributes':['id',_0x61b0('0x39'),'color'],'where':_0x483052['query']['tag']?{'id':_0x483052[_0x61b0('0x46')][_0x61b0('0x8d')]}:undefined,'required':_0x483052[_0x61b0('0x46')][_0x61b0('0x8d')]?!![]:![]}];}return db[_0x61b0('0x82')][_0x61b0('0x58')](_0x4020c8);})[_0x61b0('0x1e')](function(_0x5af24b){_0x4c8c63[_0x61b0('0x8e')]=_0x5af24b;return _0x4c8c63;});}})['then'](respondWithFilteredResult(_0x306643,_0x4020c8))['catch'](handleError(_0x306643,null));};exports[_0x61b0('0x8f')]=function(_0x4d6266,_0x1ddee8,_0x446a23){return db[_0x61b0('0x56')][_0x61b0('0x62')]({'where':{'id':_0x4d6266[_0x61b0('0x5c')]['id']}})[_0x61b0('0x1e')](handleEntityNotFound(_0x1ddee8,null))[_0x61b0('0x1e')](function(_0x41effe){if(_0x41effe){return db['sequelize']['transaction'](function(_0x3b8e43){return db[_0x61b0('0x90')][_0x61b0('0x91')]({'where':{'MailAccountId':_0x4d6266[_0x61b0('0x5c')]['id']},'transaction':_0x3b8e43})[_0x61b0('0x1e')](function(_0x594524){var _0x31f71c=_[_0x61b0('0x41')](_0x4d6266[_0x61b0('0x5a')],function(_0x444aad){_0x444aad['MailAccountId']=_0x4d6266[_0x61b0('0x5c')]['id'];return _0x444aad;});return db[_0x61b0('0x90')]['bulkCreate'](_0x31f71c,{'transaction':_0x3b8e43});});})['then'](function(){return db[_0x61b0('0x90')][_0x61b0('0x92')]({'where':{'MailAccountId':_0x4d6266[_0x61b0('0x5c')]['id']},'order':_0x61b0('0x93')});});}})[_0x61b0('0x1e')](respondWithResult(_0x1ddee8,null))[_0x61b0('0x28')](handleError(_0x1ddee8,null));};exports[_0x61b0('0x94')]=function(_0x5ae806,_0x39309a,_0x5469d5){var _0x109e0f={};var _0x3ce664={};var _0x25655f;var _0x112655;return db['MailAccount'][_0x61b0('0x62')]({'where':{'id':_0x5ae806[_0x61b0('0x5c')]['id']}})[_0x61b0('0x1e')](handleEntityNotFound(_0x39309a,null))[_0x61b0('0x1e')](function(_0x3666b5){if(_0x3666b5){_0x25655f=_0x3666b5;_0x3ce664['model']=_[_0x61b0('0x47')](db[_0x61b0('0x90')][_0x61b0('0x63')]);_0x3ce664[_0x61b0('0x46')]=_[_0x61b0('0x47')](_0x5ae806[_0x61b0('0x46')]);_0x3ce664['filters']=_['intersection'](_0x3ce664[_0x61b0('0x45')],_0x3ce664[_0x61b0('0x46')]);_0x109e0f[_0x61b0('0x48')]=_[_0x61b0('0x49')](_0x3ce664[_0x61b0('0x45')],qs[_0x61b0('0x4a')](_0x5ae806['query']['fields']));_0x109e0f[_0x61b0('0x48')]=_0x109e0f[_0x61b0('0x48')][_0x61b0('0x4b')]?_0x109e0f[_0x61b0('0x48')]:_0x3ce664['model'];_0x109e0f['order']=qs[_0x61b0('0x4e')](_0x5ae806[_0x61b0('0x46')]['sort']);_0x109e0f[_0x61b0('0x4f')]=qs['filters'](_['pick'](_0x5ae806['query'],_0x3ce664[_0x61b0('0x50')]));if(_0x5ae806[_0x61b0('0x46')][_0x61b0('0x53')]){_0x109e0f['where']=_[_0x61b0('0x54')](_0x109e0f[_0x61b0('0x4f')],{'$or':_['map'](_0x109e0f[_0x61b0('0x48')],function(_0x2080f9){var _0x2d034e={};_0x2d034e[_0x2080f9]={'$like':'%'+_0x5ae806[_0x61b0('0x46')]['filter']+'%'};return _0x2d034e;})});}_0x109e0f=_[_0x61b0('0x54')]({},_0x109e0f,_0x5ae806[_0x61b0('0x55')]);return _0x25655f[_0x61b0('0x94')](_0x109e0f);}})[_0x61b0('0x1e')](function(_0x2ffef9){if(_0x2ffef9){_0x112655=_0x2ffef9[_0x61b0('0x4b')];if(!_0x5ae806[_0x61b0('0x46')][_0x61b0('0x64')](_0x61b0('0x4c'))){_0x109e0f[_0x61b0('0x2e')]=qs['limit'](_0x5ae806[_0x61b0('0x46')][_0x61b0('0x2e')]);_0x109e0f[_0x61b0('0x2d')]=qs[_0x61b0('0x2d')](_0x5ae806[_0x61b0('0x46')]['offset']);}return _0x25655f['getApplications'](_0x109e0f);}})[_0x61b0('0x1e')](function(_0x4fb41c){if(_0x4fb41c){return _0x4fb41c?{'count':_0x112655,'rows':_0x4fb41c}:null;}})['then'](respondWithResult(_0x39309a,null))[_0x61b0('0x28')](handleError(_0x39309a,null));};exports[_0x61b0('0x95')]=function(_0x27c457,_0x421c75,_0x19dcc7){var _0x2b6976={'raw':!![],'where':{}};var _0x4f50e3={};var _0x2ecce0={'count':0x0,'rows':[]};return db[_0x61b0('0x56')]['findOne']({'where':{'id':_0x27c457[_0x61b0('0x5c')]['id']}})[_0x61b0('0x1e')](handleEntityNotFound(_0x421c75,null))['then'](function(_0x7ebcb0){if(_0x7ebcb0){_0x4f50e3[_0x61b0('0x45')]=_['keys'](db['MailMessage'][_0x61b0('0x63')]);_0x4f50e3['query']=_['keys'](_0x27c457['query']);_0x4f50e3[_0x61b0('0x50')]=_[_0x61b0('0x49')](_0x4f50e3['model'],_0x4f50e3[_0x61b0('0x46')]);_0x2b6976[_0x61b0('0x48')]=_['intersection'](_0x4f50e3['model'],qs[_0x61b0('0x4a')](_0x27c457[_0x61b0('0x46')][_0x61b0('0x4a')]));_0x2b6976[_0x61b0('0x48')]=_0x2b6976[_0x61b0('0x48')][_0x61b0('0x4b')]?_0x2b6976[_0x61b0('0x48')]:_0x4f50e3['model'];if(!_0x27c457[_0x61b0('0x46')][_0x61b0('0x64')](_0x61b0('0x4c'))){_0x2b6976['limit']=qs['limit'](_0x27c457['query'][_0x61b0('0x2e')]);_0x2b6976['offset']=qs[_0x61b0('0x2d')](_0x27c457[_0x61b0('0x46')]['offset']);}_0x2b6976[_0x61b0('0x4d')]=qs[_0x61b0('0x4e')](_0x27c457['query']['sort']);_0x2b6976[_0x61b0('0x4f')]=qs['filters'](_['pick'](_0x27c457[_0x61b0('0x46')],_0x4f50e3[_0x61b0('0x50')]));_0x2b6976[_0x61b0('0x4f')][_0x61b0('0x65')]=_0x7ebcb0['id'];if(_0x27c457[_0x61b0('0x46')]['filter']){_0x2b6976[_0x61b0('0x4f')]=_[_0x61b0('0x54')](_0x2b6976[_0x61b0('0x4f')],{'$or':_['map'](_0x2b6976[_0x61b0('0x48')],function(_0x599392){var _0x2d9d07={};_0x2d9d07[_0x599392]={'$like':'%'+_0x27c457[_0x61b0('0x46')]['filter']+'%'};return _0x2d9d07;})});}if(_0x27c457[_0x61b0('0x46')][_0x61b0('0x96')]){var _0xf148df=_0x27c457[_0x61b0('0x46')][_0x61b0('0x96')]['split'](',');var _0x2cab3f={};_0x2cab3f[_0xf148df[0x0]]={'$gte':moment(_0xf148df[0x1])['format'](_0x61b0('0x97'))};_0x2b6976[_0x61b0('0x4f')]=_['merge'](_0x2b6976[_0x61b0('0x4f')],_0x2cab3f);}_0x2b6976=_[_0x61b0('0x54')]({},_0x2b6976,_0x27c457[_0x61b0('0x55')]);return db[_0x61b0('0x98')][_0x61b0('0x2c')]({'where':_0x2b6976[_0x61b0('0x4f')]})[_0x61b0('0x1e')](function(_0x102212){_0x2ecce0['count']=_0x102212;if(_0x27c457[_0x61b0('0x46')][_0x61b0('0x57')]){_0x2b6976[_0x61b0('0x6a')]=[{'all':!![]}];}return db[_0x61b0('0x98')][_0x61b0('0x58')](_0x2b6976);})[_0x61b0('0x1e')](function(_0x4113b3){_0x2ecce0[_0x61b0('0x8e')]=_0x4113b3;return _0x2ecce0;});}})[_0x61b0('0x1e')](respondWithFilteredResult(_0x421c75,_0x2b6976))[_0x61b0('0x28')](handleError(_0x421c75,null));};exports['send']=function(_0x1798cc,_0x51ed1e,_0x289464){var _0x3d8db0,_0x29486e={},_0x27c559;if(_0x1798cc[_0x61b0('0x5a')]['to']){_0x27c559=_0x1798cc[_0x61b0('0x5a')]['to'][_0x61b0('0x99')](',')[0x0];}return db[_0x61b0('0x56')][_0x61b0('0x5b')]({'where':{'id':_0x1798cc['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x61b0('0x86')],'as':_0x61b0('0x9a'),'where':{'email':_0x27c559},'limit':0x1,'order':[[_0x61b0('0x9b'),'DESC']]}]},{'model':db[_0x61b0('0x3d')],'as':_0x61b0('0x3e'),'raw':!![]}]})[_0x61b0('0x1e')](handleEntityNotFound(_0x51ed1e,null))[_0x61b0('0x1e')](function(_0x1ad0b6){if(_0x1ad0b6){_0x3d8db0=_0x1ad0b6;if(_0x1ad0b6['Smtp']){if(_[_0x61b0('0x6d')](_0x1798cc[_0x61b0('0x5a')]['from'])){_0x1798cc['body'][_0x61b0('0x9c')]=util['format']('%s\x20<%s>',_0x1ad0b6[_0x61b0('0x39')],_0x1ad0b6['email']||_0x1ad0b6[_0x61b0('0x3e')][_0x61b0('0x70')]);}if(_0x1798cc[_0x61b0('0x5a')][_0x61b0('0x9d')]&&_0x1798cc[_0x61b0('0x5a')][_0x61b0('0x9d')][_0x61b0('0x4b')]){for(var _0x3b8abc=0x0;_0x3b8abc<_0x1798cc['body'][_0x61b0('0x9d')][_0x61b0('0x4b')];_0x3b8abc+=0x1){_0x1798cc['body'][_0x61b0('0x9d')][_0x3b8abc]={'filename':_0x1798cc['body']['attachments'][_0x3b8abc][_0x61b0('0x39')],'path':path[_0x61b0('0x9e')](config[_0x61b0('0x9f')],_0x61b0('0xa0'),_0x1798cc[_0x61b0('0x5a')][_0x61b0('0x9d')][_0x3b8abc][_0x61b0('0xa1')])};}}var _0x537fec={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x1ad0b6[_0x61b0('0x3e')]['service'])){if(_0x1ad0b6[_0x61b0('0x3e')][_0x61b0('0x75')]){_0x537fec[_0x61b0('0xa2')]={'user':_0x1ad0b6[_0x61b0('0x3e')][_0x61b0('0x70')],'pass':_0x1ad0b6['Smtp'][_0x61b0('0x73')]};}_0x537fec[_0x61b0('0x76')]=_0x1ad0b6[_0x61b0('0x3e')][_0x61b0('0x76')];_0x537fec[_0x61b0('0x77')]=_0x1ad0b6[_0x61b0('0x3e')][_0x61b0('0x77')];_0x537fec[_0x61b0('0xa3')]=_0x1ad0b6[_0x61b0('0x3e')][_0x61b0('0xa3')];}else{_0x537fec[_0x61b0('0x78')]=_0x1ad0b6[_0x61b0('0x3e')][_0x61b0('0x78')];_0x537fec[_0x61b0('0xa2')]={'user':_0x1ad0b6[_0x61b0('0x3e')][_0x61b0('0x70')],'pass':_0x1ad0b6['Smtp'][_0x61b0('0x73')]};}return respondWithRpcPromise('SendMail',_0x61b0('0xa4'),{'account':_0x537fec,'message':_0x1798cc['body']});}else{throw new Error(_0x61b0('0xa5'));}}})[_0x61b0('0x1e')](function(_0x4a7b4d){if(_0x4a7b4d){_0x29486e=_0x4a7b4d;if(_0x3d8db0[_0x61b0('0xa6')]){if(_0x3d8db0[_0x61b0('0xa6')][_0x61b0('0x9a')][_0x61b0('0x4b')]){return _0x3d8db0[_0x61b0('0xa6')][_0x61b0('0x9a')][0x0];}else{return db[_0x61b0('0x86')][_0x61b0('0x60')](_['defaults'](_0x1798cc[_0x61b0('0x5a')],{'firstName':_0x1798cc[_0x61b0('0x5a')]['to'],'email':_0x1798cc[_0x61b0('0x5a')]['to'],'phone':_0x1798cc['body']['to'],'ListId':_0x3d8db0[_0x61b0('0xa7')]}));}}else{throw new Error('List\x20not\x20found');}}})['then'](function(_0x294208){if(_0x294208){var _0x1a924c={'UserId':_0x1798cc['user']['id'],'ContactId':_0x294208['id'],'MailAccountId':_0x3d8db0['id'],'inReplyTo':_0x29486e['messageId'],'to':_0x1798cc[_0x61b0('0x5a')][_0x61b0('0x9c')],'cc':_0x1798cc['body']['cc'],'subject':_0x1798cc[_0x61b0('0x5a')][_0x61b0('0xa8')],'attach':_0x1798cc[_0x61b0('0x5a')]['attach'],'firstMsgDirection':_0x61b0('0xa9'),'lastMsgAt':moment()[_0x61b0('0xaa')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x61b0('0xa9'),'lastMsgBody':_0x1798cc[_0x61b0('0x5a')][_0x61b0('0x5a')],'Messages':[_[_0x61b0('0x54')](_0x1798cc[_0x61b0('0x5a')],{'messageId':_0x29486e['messageId'],'sentAt':moment()[_0x61b0('0xaa')](_0x61b0('0x97')),'read':!![],'MailAccountId':_0x3d8db0['id'],'UserId':_0x1798cc['user']['id'],'ContactId':_0x294208['id']})]};if(_0x1798cc[_0x61b0('0x5a')][_0x61b0('0xab')]){_0x1a924c=_[_0x61b0('0x54')](_0x1a924c,_0x1798cc['body']['Interaction']);}return db['MailInteraction'][_0x61b0('0x60')](_0x1a924c,{'include':[{'model':db[_0x61b0('0x98')],'as':_0x61b0('0xac')}]});}})[_0x61b0('0x1e')](respondWithResult(_0x51ed1e,null))[_0x61b0('0x28')](handleError(_0x51ed1e,null));};exports[_0x61b0('0xad')]=function(_0x13e084,_0x1c2ae8,_0xf8210f){return db[_0x61b0('0x56')]['find']({'where':{'id':_0x13e084['params']['id']},'include':[{'model':db[_0x61b0('0x3d')],'as':'Smtp','raw':!![]}]})[_0x61b0('0x1e')](handleEntityNotFound(_0x1c2ae8,null))['then'](function(_0x46894a){if(_0x46894a&&_0x46894a[_0x61b0('0x3e')]){var _0x982646={'id':_0x46894a['id'],'tls':{'rejectUnauthorized':![]}};if(_0x46894a[_0x61b0('0x3e')]['service']){_0x982646['service']=_0x46894a[_0x61b0('0x3e')]['service'];}else{_0x982646[_0x61b0('0x76')]=_0x46894a[_0x61b0('0x3e')][_0x61b0('0x76')];_0x982646[_0x61b0('0x77')]=_0x46894a['Smtp'][_0x61b0('0x77')];_0x982646[_0x61b0('0xa3')]=_0x46894a[_0x61b0('0x3e')]['secure'];}if(_0x46894a[_0x61b0('0x3e')][_0x61b0('0x75')]){_0x982646['auth']={'user':_0x46894a[_0x61b0('0x3e')][_0x61b0('0x70')],'pass':_0x46894a['Smtp'][_0x61b0('0x73')]};}return respondWithRpcPromise(_0x61b0('0xae'),_0x61b0('0xad'),{'account':_0x982646});}})['then'](respondWithResult(_0x1c2ae8,null))['catch'](handleError(_0x1c2ae8,null));};exports[_0x61b0('0x91')]=function(_0x5efacb,_0x24477a){return db['MailAccount'][_0x61b0('0x5b')]({'where':{'id':_0x5efacb[_0x61b0('0x5c')]['id']}})[_0x61b0('0x1e')](handleEntityNotFound(_0x24477a,null))['then'](function(_0x228ad5){if(_0x228ad5&&_0x228ad5['service']){throw new db[(_0x61b0('0x1c'))]['ValidationError']('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x228ad5;})[_0x61b0('0x1e')](removeEntity(_0x24477a,null))[_0x61b0('0x28')](handleError(_0x24477a,null));};exports[_0x61b0('0xaf')]=function(_0x111984,_0x1bbff9,_0x13f528){return db['MailAccount'][_0x61b0('0x5b')]({'where':{'id':_0x111984['params']['id']}})[_0x61b0('0x1e')](handleEntityNotFound(_0x1bbff9,null))['then'](function(_0x31e914){if(_0x31e914){return _0x31e914['addAgents'](_0x111984[_0x61b0('0x5a')]['ids'],_[_0x61b0('0x84')](_0x111984[_0x61b0('0x5a')],[_0x61b0('0x67'),'id'])||{})[_0x61b0('0xb0')](function(_0x91f070){for(var _0x32506f=0x0;_0x32506f<_0x111984[_0x61b0('0x5a')][_0x61b0('0x67')][_0x61b0('0x4b')];_0x32506f+=0x1){socket[_0x61b0('0xb1')](_0x61b0('0xb2'),{'UserId':_0x111984[_0x61b0('0x5a')][_0x61b0('0x67')][_0x32506f],'MailAccountId':_0x111984[_0x61b0('0x5c')]['id']});}return _0x91f070;});}})[_0x61b0('0x1e')](respondWithResult(_0x1bbff9,null))[_0x61b0('0x28')](handleError(_0x1bbff9,null));};exports[_0x61b0('0xb3')]=function(_0x42e11b,_0x9ff6c3,_0x2a230f){return db['MailAccount'][_0x61b0('0x5b')]({'where':{'id':_0x42e11b[_0x61b0('0x5c')]['id']}})[_0x61b0('0x1e')](handleEntityNotFound(_0x9ff6c3,null))[_0x61b0('0x1e')](function(_0x14ce54){if(_0x14ce54){return _0x14ce54[_0x61b0('0xb3')](_0x42e11b['query']['ids'])[_0x61b0('0x1e')](function(){if(_[_0x61b0('0xb4')](_0x42e11b[_0x61b0('0x46')][_0x61b0('0x67')])){for(var _0x4db08c=0x0;_0x4db08c<_0x42e11b[_0x61b0('0x46')]['ids'][_0x61b0('0x4b')];_0x4db08c+=0x1){socket[_0x61b0('0xb1')](_0x61b0('0xb5'),{'UserId':Number(_0x42e11b[_0x61b0('0x46')]['ids'][_0x4db08c]),'MailAccountId':Number(_0x42e11b['params']['id'])});}}else{socket['emit'](_0x61b0('0xb5'),{'UserId':Number(_0x42e11b[_0x61b0('0x46')][_0x61b0('0x67')]),'MailAccountId':Number(_0x42e11b[_0x61b0('0x5c')]['id'])});}});}})[_0x61b0('0x1e')](respondWithStatusCode(_0x9ff6c3,null))[_0x61b0('0x28')](handleError(_0x9ff6c3,null));};exports[_0x61b0('0xb6')]=function(_0x3902ed,_0x3ebfc3,_0x4d279d){var _0x1b562d={};var _0x573509={};var _0x19f9c8;var _0x8390cc;return db[_0x61b0('0x56')][_0x61b0('0x62')]({'where':{'id':_0x3902ed[_0x61b0('0x5c')]['id']}})[_0x61b0('0x1e')](handleEntityNotFound(_0x3ebfc3,null))['then'](function(_0xc70262){if(_0xc70262){_0x19f9c8=_0xc70262;_0x573509[_0x61b0('0x45')]=_[_0x61b0('0x47')](db[_0x61b0('0x88')][_0x61b0('0x63')]);_0x573509[_0x61b0('0x46')]=_[_0x61b0('0x47')](_0x3902ed[_0x61b0('0x46')]);_0x573509['filters']=_[_0x61b0('0x49')](_0x573509[_0x61b0('0x45')],_0x573509[_0x61b0('0x46')]);_0x1b562d[_0x61b0('0x48')]=_['intersection'](_0x573509[_0x61b0('0x45')],qs['fields'](_0x3902ed[_0x61b0('0x46')][_0x61b0('0x4a')]));_0x1b562d['attributes']=_0x1b562d[_0x61b0('0x48')]['length']?_0x1b562d[_0x61b0('0x48')]:_0x573509[_0x61b0('0x45')];_0x1b562d[_0x61b0('0x4d')]=qs[_0x61b0('0x4e')](_0x3902ed[_0x61b0('0x46')][_0x61b0('0x4e')]);_0x1b562d[_0x61b0('0x4f')]=qs['filters'](_[_0x61b0('0x51')](_0x3902ed['query'],_0x573509['filters']));if(_0x3902ed[_0x61b0('0x46')][_0x61b0('0x53')]){_0x1b562d[_0x61b0('0x4f')]=_[_0x61b0('0x54')](_0x1b562d[_0x61b0('0x4f')],{'$or':_['map'](_0x1b562d[_0x61b0('0x48')],function(_0x555d1a){var _0xef6cee={};_0xef6cee[_0x555d1a]={'$like':'%'+_0x3902ed[_0x61b0('0x46')][_0x61b0('0x53')]+'%'};return _0xef6cee;})});}_0x1b562d=_[_0x61b0('0x54')]({},_0x1b562d,_0x3902ed['options']);return _0x19f9c8[_0x61b0('0xb6')](_0x1b562d);}})[_0x61b0('0x1e')](function(_0x58e643){if(_0x58e643){_0x8390cc=_0x58e643['length'];if(!_0x3902ed[_0x61b0('0x46')][_0x61b0('0x64')](_0x61b0('0x4c'))){_0x1b562d[_0x61b0('0x2e')]=qs['limit'](_0x3902ed[_0x61b0('0x46')]['limit']);_0x1b562d[_0x61b0('0x2d')]=qs[_0x61b0('0x2d')](_0x3902ed[_0x61b0('0x46')]['offset']);}return _0x19f9c8['getAgents'](_0x1b562d);}})[_0x61b0('0x1e')](function(_0x156798){if(_0x156798){return _0x156798?{'count':_0x8390cc,'rows':_0x156798}:null;}})[_0x61b0('0x1e')](respondWithResult(_0x3ebfc3,null))[_0x61b0('0x28')](handleError(_0x3ebfc3,null));}; \ No newline at end of file +var _0x167b=['addSmtp','removeSmtp','addInteraction','MailInteraction','omit','CmContact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','destroy','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','updatedAt','from','%s\x20<%s>','attachments','join','server/files/attachments','auth','secure','sendMail','List\x20not\x20found','defaults','subject','attach','out','messageId','Interaction','Messages','verifySmtp','VerifySmtp','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','test','Sequelize','ValidationError','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','sendStatus','end','status','json','offset','set','apply','reject','save','update','get','MailAccounts','UserProfileResource','stack','name','send','index','Imap','MailServerOut','Smtp','Pause','map','MailAccount','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','type','count','includeAll','include','findAll','rows','catch','params','mandatoryDispositionPause','fields','find','body','describe','MailAccountId','Disposition','create','getDispositions','findOne','nolimit','options','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','email','ListId','isNil','active','description','user','cuser','password','pass','cpassword','authentication','host','port','service','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','MailServerIn','removeImap','setImap','getSmtp'];(function(_0x4e480f,_0x1dd3b6){var _0x421242=function(_0x54cc00){while(--_0x54cc00){_0x4e480f['push'](_0x4e480f['shift']());}};_0x421242(++_0x1dd3b6);}(_0x167b,0xfe));var _0xb167=function(_0x1aab9e,_0x19826e){_0x1aab9e=_0x1aab9e-0x0;var _0x158238=_0x167b[_0x1aab9e];return _0x158238;};'use strict';var pdf=require(_0xb167('0x0'));var emlformat=require(_0xb167('0x1'));var rimraf=require(_0xb167('0x2'));var zipdir=require(_0xb167('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb167('0x4'));var BPromise=require(_0xb167('0x5'));var Mustache=require(_0xb167('0x6'));var util=require('util');var path=require(_0xb167('0x7'));var sox=require(_0xb167('0x8'));var csv=require(_0xb167('0x9'));var ejs=require(_0xb167('0xa'));var fs=require('fs');var _=require(_0xb167('0xb'));var squel=require('squel');var crypto=require(_0xb167('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb167('0xd'));var toCsv=require(_0xb167('0x9'));var querystring=require(_0xb167('0xe'));var Papa=require(_0xb167('0xf'));var Redis=require(_0xb167('0x10'));var authService=require(_0xb167('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb167('0x12'));var hardwareService=require(_0xb167('0x13'));var logger=require(_0xb167('0x14'))('api');var utils=require(_0xb167('0x15'));var config=require(_0xb167('0x16'));var db=require(_0xb167('0x17'))['db'];config['redis']=_['defaults'](config[_0xb167('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xb167('0x19'))(new Redis(config[_0xb167('0x18')]));require(_0xb167('0x1a'))[_0xb167('0x1b')](socket);var jayson=require(_0xb167('0x1c'));var client=jayson[_0xb167('0x1d')]['http']({'port':0x232b});function checkPasswordPattern(_0x564ae0,_0x25e172,_0x32660b){if(_0x32660b){var _0x33c97d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x33c97d[_0xb167('0x1e')](_0x25e172)){return _0x564ae0;}else{throw new db[(_0xb167('0x1f'))][(_0xb167('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 _0x564ae0;}}function respondWithRpcPromise(_0x45bcaa,_0x48f171,_0x34460b,_0x3ba94d){return new BPromise(function(_0xbe40ae,_0xe89b62){var _0x445a59=_0x3ba94d||client;return _0x445a59[_0xb167('0x21')](_0x45bcaa,_0x34460b)[_0xb167('0x22')](function(_0x40fa80){logger[_0xb167('0x23')](_0xb167('0x24'),_0x48f171,_0xb167('0x25'));logger[_0xb167('0x26')](_0xb167('0x27'),_0x48f171,_0xb167('0x25'),JSON['stringify'](_0x40fa80));if(_0x40fa80['error']){if(_0x40fa80[_0xb167('0x28')][_0xb167('0x29')]===0x1f4){logger[_0xb167('0x28')](_0xb167('0x24'),_0x48f171,_0x40fa80[_0xb167('0x28')][_0xb167('0x2a')]);return _0xe89b62(_0x40fa80[_0xb167('0x28')][_0xb167('0x2a')]);}logger[_0xb167('0x28')](_0xb167('0x24'),_0x48f171,_0x40fa80['error'][_0xb167('0x2a')]);return _0xbe40ae(_0x40fa80[_0xb167('0x28')][_0xb167('0x2a')]);}else{logger[_0xb167('0x23')]('MailAccount,\x20%s,\x20%s',_0x48f171,_0xb167('0x25'));_0xbe40ae(_0x40fa80['result'][_0xb167('0x2a')]);}})['catch'](function(_0x384cd4){logger['error']('MailAccount,\x20%s,\x20%s',_0x48f171,_0x384cd4);_0xe89b62(_0x384cd4);});});}function respondWithStatusCode(_0x193f96,_0x82829c){_0x82829c=_0x82829c||0xcc;return function(_0x2b228d){if(_0x2b228d){return _0x193f96[_0xb167('0x2b')](_0x82829c);}return _0x193f96['status'](_0x82829c)[_0xb167('0x2c')]();};}function respondWithResult(_0x26c0ed,_0x388bf2){_0x388bf2=_0x388bf2||0xc8;return function(_0x7f25d5){if(_0x7f25d5){return _0x26c0ed[_0xb167('0x2d')](_0x388bf2)[_0xb167('0x2e')](_0x7f25d5);}};}function respondWithFilteredResult(_0x22411b,_0x20ee92){return function(_0x4b955d){if(_0x4b955d){var _0x18ba53=_0x4b955d['count'],_0x5835b4=_0x20ee92['offset'],_0x2ed4fa=_0x20ee92[_0xb167('0x2f')]+_0x20ee92['limit'],_0xf512e0;if(_0x2ed4fa>=_0x18ba53){_0x2ed4fa=_0x18ba53;_0xf512e0=0xc8;}else{_0xf512e0=0xce;}_0x22411b[_0xb167('0x2d')](_0xf512e0);return _0x22411b[_0xb167('0x30')]('Content-Range',_0x5835b4+'-'+_0x2ed4fa+'/'+_0x18ba53)[_0xb167('0x2e')](_0x4b955d);}return null;};}function patchUpdates(_0x382777){return function(_0x5d2cad){try{jsonpatch[_0xb167('0x31')](_0x5d2cad,_0x382777,!![]);}catch(_0x589fb6){return BPromise[_0xb167('0x32')](_0x589fb6);}return _0x5d2cad[_0xb167('0x33')]();};}function saveUpdates(_0x572308,_0x5d0de6){return function(_0x481be9){if(_0x481be9){return _0x481be9[_0xb167('0x34')](_0x572308)[_0xb167('0x22')](function(_0x4874d6){return _0x4874d6;});}return null;};}function removeEntity(_0x29bd4e,_0x2550d6){return function(_0x45fa63){if(_0x45fa63){return _0x45fa63['destroy']()[_0xb167('0x22')](function(){var _0x2188fa=_0x45fa63[_0xb167('0x35')]({'plain':!![]});var _0x13e0f3=_0xb167('0x36');return db[_0xb167('0x37')]['destroy']({'where':{'type':_0x13e0f3,'resourceId':_0x2188fa['id']}})[_0xb167('0x22')](function(){return _0x45fa63;});})[_0xb167('0x22')](function(){_0x29bd4e[_0xb167('0x2d')](0xcc)[_0xb167('0x2c')]();});}};}function handleEntityNotFound(_0x471a64,_0x1bd915){return function(_0x4511dc){if(!_0x4511dc){_0x471a64[_0xb167('0x2b')](0x194);}return _0x4511dc;};}function handleError(_0x54a8a4,_0x369463){_0x369463=_0x369463||0x1f4;return function(_0x3fc13d){logger[_0xb167('0x28')](_0x3fc13d[_0xb167('0x38')]);if(_0x3fc13d[_0xb167('0x39')]){delete _0x3fc13d[_0xb167('0x39')];}_0x54a8a4['status'](_0x369463)[_0xb167('0x3a')](_0x3fc13d);};}exports[_0xb167('0x3b')]=function(_0xe46c2,_0x4c69a6){var _0x37e771={'include':[{'model':db['MailServerIn'],'as':_0xb167('0x3c')},{'model':db[_0xb167('0x3d')],'as':_0xb167('0x3e')},{'model':db[_0xb167('0x3f')],'as':'mandatoryDispositionPause'}]},_0x557e49={},_0x59decc={'count':0x0,'rows':[]};var _0x3d9d88=_[_0xb167('0x40')](db[_0xb167('0x41')][_0xb167('0x42')],function(_0x3eae1c){return{'name':_0x3eae1c[_0xb167('0x43')],'type':_0x3eae1c['type'][_0xb167('0x44')]};});_0x557e49[_0xb167('0x45')]=_['map'](_0x3d9d88,_0xb167('0x39'));_0x557e49['query']=_[_0xb167('0x46')](_0xe46c2[_0xb167('0x47')]);_0x557e49[_0xb167('0x48')]=_[_0xb167('0x49')](_0x557e49[_0xb167('0x45')],_0x557e49[_0xb167('0x47')]);_0x37e771['attributes']=_[_0xb167('0x49')](_0x557e49['model'],qs['fields'](_0xe46c2[_0xb167('0x47')]['fields']));_0x37e771[_0xb167('0x4a')]=_0x37e771['attributes'][_0xb167('0x4b')]?_0x37e771[_0xb167('0x4a')]:_0x557e49[_0xb167('0x45')];if(!_0xe46c2['query'][_0xb167('0x4c')]('nolimit')){_0x37e771[_0xb167('0x4d')]=qs[_0xb167('0x4d')](_0xe46c2[_0xb167('0x47')]['limit']);_0x37e771[_0xb167('0x2f')]=qs[_0xb167('0x2f')](_0xe46c2[_0xb167('0x47')][_0xb167('0x2f')]);}_0x37e771[_0xb167('0x4e')]=qs[_0xb167('0x4f')](_0xe46c2[_0xb167('0x47')][_0xb167('0x4f')]);_0x37e771[_0xb167('0x50')]=qs[_0xb167('0x48')](_[_0xb167('0x51')](_0xe46c2[_0xb167('0x47')],_0x557e49[_0xb167('0x48')]),_0x3d9d88);if(_0xe46c2[_0xb167('0x47')][_0xb167('0x52')]){_0x37e771[_0xb167('0x50')]=_[_0xb167('0x53')](_0x37e771[_0xb167('0x50')],{'$or':_[_0xb167('0x40')](_0x3d9d88,function(_0x1c30f5){if(_0x1c30f5[_0xb167('0x54')]!=='VIRTUAL'){var _0x2675eb={};_0x2675eb[_0x1c30f5[_0xb167('0x39')]]={'$like':'%'+_0xe46c2['query'][_0xb167('0x52')]+'%'};return _0x2675eb;}})});}_0x37e771=_[_0xb167('0x53')]({},_0x37e771,_0xe46c2['options']);var _0x243632={'where':_0x37e771[_0xb167('0x50')]};return db[_0xb167('0x41')][_0xb167('0x55')](_0x243632)[_0xb167('0x22')](function(_0xf3dceb){_0x59decc[_0xb167('0x55')]=_0xf3dceb;if(_0xe46c2[_0xb167('0x47')][_0xb167('0x56')]){_0x37e771[_0xb167('0x57')]=[{'all':!![]}];}return db[_0xb167('0x41')][_0xb167('0x58')](_0x37e771);})[_0xb167('0x22')](function(_0x3b1bd9){_0x59decc[_0xb167('0x59')]=_0x3b1bd9;return _0x59decc;})[_0xb167('0x22')](respondWithFilteredResult(_0x4c69a6,_0x37e771))[_0xb167('0x5a')](handleError(_0x4c69a6,null));};exports['show']=function(_0x109108,_0x4e353b){var _0x10b1b3={'raw':![],'where':{'id':_0x109108[_0xb167('0x5b')]['id']},'include':[{'model':db['MailServerIn'],'as':_0xb167('0x3c')},{'model':db['MailServerOut'],'as':_0xb167('0x3e')},{'model':db[_0xb167('0x3f')],'as':_0xb167('0x5c')}]},_0xaef614={};_0xaef614[_0xb167('0x45')]=_[_0xb167('0x46')](db[_0xb167('0x41')][_0xb167('0x42')]);_0xaef614[_0xb167('0x47')]=_['keys'](_0x109108[_0xb167('0x47')]);_0xaef614[_0xb167('0x48')]=_[_0xb167('0x49')](_0xaef614['model'],_0xaef614[_0xb167('0x47')]);_0x10b1b3[_0xb167('0x4a')]=_[_0xb167('0x49')](_0xaef614[_0xb167('0x45')],qs['fields'](_0x109108['query'][_0xb167('0x5d')]));_0x10b1b3[_0xb167('0x4a')]=_0x10b1b3[_0xb167('0x4a')]['length']?_0x10b1b3[_0xb167('0x4a')]:_0xaef614['model'];if(_0x109108[_0xb167('0x47')][_0xb167('0x56')]){_0x10b1b3['include']=[{'all':!![]}];}_0x10b1b3=_[_0xb167('0x53')]({},_0x10b1b3,_0x109108['options']);return db[_0xb167('0x41')][_0xb167('0x5e')](_0x10b1b3)[_0xb167('0x22')](handleEntityNotFound(_0x4e353b,null))[_0xb167('0x22')](respondWithResult(_0x4e353b,null))[_0xb167('0x5a')](handleError(_0x4e353b,null));};exports[_0xb167('0x34')]=function(_0x3b5934,_0x5e5b65){if(_0x3b5934['body']['id']){delete _0x3b5934[_0xb167('0x5f')]['id'];}return db['MailAccount'][_0xb167('0x5e')]({'where':{'id':_0x3b5934[_0xb167('0x5b')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0xb167('0x3d')],'as':_0xb167('0x3e')},{'model':db['Pause'],'as':_0xb167('0x5c')}]})[_0xb167('0x22')](handleEntityNotFound(_0x5e5b65,null))['then'](saveUpdates(_0x3b5934[_0xb167('0x5f')],null))[_0xb167('0x22')](function(_0x18d00d){if(_0x18d00d&&_0x3b5934[_0xb167('0x5f')]['Imap']){return db['MailServerIn'][_0xb167('0x34')](_0x3b5934['body']['Imap'],{'where':{'MailAccountId':_0x18d00d['id']}})['then'](function(){return _0x18d00d;});}return _0x18d00d;})['then'](function(_0x314b78){if(_0x314b78&&_0x3b5934['body'][_0xb167('0x3e')]){return db[_0xb167('0x3d')][_0xb167('0x34')](_0x3b5934['body'][_0xb167('0x3e')],{'where':{'MailAccountId':_0x314b78['id']}})['then'](function(){return _0x314b78;});}return _0x314b78;})[_0xb167('0x22')](respondWithResult(_0x5e5b65,null))['catch'](handleError(_0x5e5b65,null));};exports[_0xb167('0x60')]=function(_0x2dc36f,_0x581365){return db['MailAccount'][_0xb167('0x60')]()[_0xb167('0x22')](respondWithResult(_0x581365,null))[_0xb167('0x5a')](handleError(_0x581365,null));};exports['addDisposition']=function(_0x1c7866,_0x152c4d,_0x60fe87){if(_0x1c7866[_0xb167('0x5f')]['id']){delete _0x1c7866[_0xb167('0x5f')]['id'];}return db[_0xb167('0x41')][_0xb167('0x5e')]({'where':{'id':_0x1c7866[_0xb167('0x5b')]['id']}})[_0xb167('0x22')](handleEntityNotFound(_0x152c4d,null))[_0xb167('0x22')](function(_0x442125){if(_0x442125){_0x1c7866['body'][_0xb167('0x61')]=_0x442125['id'];return db[_0xb167('0x62')][_0xb167('0x63')](_0x1c7866[_0xb167('0x5f')]);}})[_0xb167('0x22')](respondWithResult(_0x152c4d,null))[_0xb167('0x5a')](handleError(_0x152c4d,null));};exports[_0xb167('0x64')]=function(_0x2192af,_0x2e0670,_0x3be9cc){var _0x589d73={'raw':![],'where':{}};var _0xbe4cc4={};var _0x11e02f={'count':0x0,'rows':[]};return db[_0xb167('0x41')][_0xb167('0x65')]({'where':{'id':_0x2192af['params']['id']}})['then'](handleEntityNotFound(_0x2e0670,null))['then'](function(_0x2a0fa2){if(_0x2a0fa2){_0xbe4cc4[_0xb167('0x45')]=_['keys'](db[_0xb167('0x62')][_0xb167('0x42')]);_0xbe4cc4[_0xb167('0x47')]=_[_0xb167('0x46')](_0x2192af['query']);_0xbe4cc4['filters']=_[_0xb167('0x49')](_0xbe4cc4[_0xb167('0x45')],_0xbe4cc4[_0xb167('0x47')]);_0x589d73[_0xb167('0x4a')]=_[_0xb167('0x49')](_0xbe4cc4['model'],qs[_0xb167('0x5d')](_0x2192af[_0xb167('0x47')]['fields']));_0x589d73[_0xb167('0x4a')]=_0x589d73[_0xb167('0x4a')][_0xb167('0x4b')]?_0x589d73['attributes']:_0xbe4cc4[_0xb167('0x45')];if(!_0x2192af[_0xb167('0x47')]['hasOwnProperty'](_0xb167('0x66'))){_0x589d73[_0xb167('0x4d')]=qs[_0xb167('0x4d')](_0x2192af[_0xb167('0x47')][_0xb167('0x4d')]);_0x589d73[_0xb167('0x2f')]=qs[_0xb167('0x2f')](_0x2192af['query'][_0xb167('0x2f')]);}_0x589d73[_0xb167('0x4e')]=qs[_0xb167('0x4f')](_0x2192af[_0xb167('0x47')][_0xb167('0x4f')]);_0x589d73[_0xb167('0x50')]=qs['filters'](_['pick'](_0x2192af[_0xb167('0x47')],_0xbe4cc4[_0xb167('0x48')]));_0x589d73['where'][_0xb167('0x61')]=_0x2a0fa2['id'];if(_0x2192af['query']['filter']){_0x589d73[_0xb167('0x50')]=_[_0xb167('0x53')](_0x589d73[_0xb167('0x50')],{'$or':_['map'](_0x589d73[_0xb167('0x4a')],function(_0x9217c4){var _0x363b9d={};_0x363b9d[_0x9217c4]={'$like':'%'+_0x2192af['query'][_0xb167('0x52')]+'%'};return _0x363b9d;})});}_0x589d73=_[_0xb167('0x53')]({},_0x589d73,_0x2192af[_0xb167('0x67')]);return db['Disposition'][_0xb167('0x55')]({'where':_0x589d73['where']})[_0xb167('0x22')](function(_0x3b0d80){_0x11e02f['count']=_0x3b0d80;if(_0x2192af[_0xb167('0x47')][_0xb167('0x56')]){_0x589d73[_0xb167('0x57')]=[{'all':!![]}];}return db['Disposition'][_0xb167('0x58')](_0x589d73);})[_0xb167('0x22')](function(_0x1e7c36){_0x11e02f[_0xb167('0x59')]=_0x1e7c36;return _0x11e02f;});}})['then'](respondWithFilteredResult(_0x2e0670,_0x589d73))[_0xb167('0x5a')](handleError(_0x2e0670,null));};exports[_0xb167('0x68')]=function(_0x55e777,_0xb08f2c,_0x1a94d2){return db['MailAccount']['find']({'where':{'id':_0x55e777[_0xb167('0x5b')]['id']}})['then'](handleEntityNotFound(_0xb08f2c,null))[_0xb167('0x22')](function(_0x1af4dd){if(_0x1af4dd){return _0x1af4dd[_0xb167('0x68')](_0x55e777[_0xb167('0x47')][_0xb167('0x69')]);}})[_0xb167('0x22')](respondWithStatusCode(_0xb08f2c,null))[_0xb167('0x5a')](handleError(_0xb08f2c,null));};exports[_0xb167('0x6a')]=function(_0x7d917e,_0x232c7c,_0x1c1b00){if(_0x7d917e[_0xb167('0x5f')]['id']){delete _0x7d917e['body']['id'];}return db[_0xb167('0x41')]['find']({'where':{'id':_0x7d917e['params']['id']}})['then'](handleEntityNotFound(_0x232c7c,null))[_0xb167('0x22')](function(_0x16309a){if(_0x16309a){_0x7d917e[_0xb167('0x5f')][_0xb167('0x61')]=_0x16309a['id'];return db['CannedAnswer'][_0xb167('0x63')](_0x7d917e[_0xb167('0x5f')]);}})[_0xb167('0x22')](respondWithResult(_0x232c7c,null))[_0xb167('0x5a')](handleError(_0x232c7c,null));};exports['getAnswers']=function(_0x18ab97,_0x2d7e97,_0x28f7fb){var _0x4c5c65={'raw':![],'where':{}};var _0x10fa48={};var _0x29385a={'count':0x0,'rows':[]};return db[_0xb167('0x41')]['findOne']({'where':{'id':_0x18ab97[_0xb167('0x5b')]['id']}})[_0xb167('0x22')](handleEntityNotFound(_0x2d7e97,null))[_0xb167('0x22')](function(_0xae91e4){if(_0xae91e4){_0x10fa48[_0xb167('0x45')]=_[_0xb167('0x46')](db[_0xb167('0x6b')]['rawAttributes']);_0x10fa48[_0xb167('0x47')]=_[_0xb167('0x46')](_0x18ab97[_0xb167('0x47')]);_0x10fa48[_0xb167('0x48')]=_['intersection'](_0x10fa48[_0xb167('0x45')],_0x10fa48[_0xb167('0x47')]);_0x4c5c65[_0xb167('0x4a')]=_[_0xb167('0x49')](_0x10fa48[_0xb167('0x45')],qs[_0xb167('0x5d')](_0x18ab97[_0xb167('0x47')]['fields']));_0x4c5c65[_0xb167('0x4a')]=_0x4c5c65['attributes']['length']?_0x4c5c65[_0xb167('0x4a')]:_0x10fa48['model'];if(!_0x18ab97[_0xb167('0x47')]['hasOwnProperty'](_0xb167('0x66'))){_0x4c5c65[_0xb167('0x4d')]=qs[_0xb167('0x4d')](_0x18ab97[_0xb167('0x47')][_0xb167('0x4d')]);_0x4c5c65[_0xb167('0x2f')]=qs[_0xb167('0x2f')](_0x18ab97[_0xb167('0x47')][_0xb167('0x2f')]);}_0x4c5c65['order']=qs[_0xb167('0x4f')](_0x18ab97[_0xb167('0x47')][_0xb167('0x4f')]);_0x4c5c65[_0xb167('0x50')]=qs[_0xb167('0x48')](_[_0xb167('0x51')](_0x18ab97[_0xb167('0x47')],_0x10fa48[_0xb167('0x48')]));_0x4c5c65[_0xb167('0x50')]['MailAccountId']=_0xae91e4['id'];if(_0x18ab97[_0xb167('0x47')]['filter']){_0x4c5c65[_0xb167('0x50')]=_[_0xb167('0x53')](_0x4c5c65[_0xb167('0x50')],{'$or':_[_0xb167('0x40')](_0x4c5c65[_0xb167('0x4a')],function(_0xc8793d){var _0x23ed23={};_0x23ed23[_0xc8793d]={'$like':'%'+_0x18ab97[_0xb167('0x47')]['filter']+'%'};return _0x23ed23;})});}_0x4c5c65=_[_0xb167('0x53')]({},_0x4c5c65,_0x18ab97['options']);return db['CannedAnswer'][_0xb167('0x55')]({'where':_0x4c5c65[_0xb167('0x50')]})[_0xb167('0x22')](function(_0x46e41a){_0x29385a[_0xb167('0x55')]=_0x46e41a;if(_0x18ab97[_0xb167('0x47')][_0xb167('0x56')]){_0x4c5c65['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x4c5c65);})[_0xb167('0x22')](function(_0xf21d2){_0x29385a[_0xb167('0x59')]=_0xf21d2;return _0x29385a;});}})[_0xb167('0x22')](respondWithFilteredResult(_0x2d7e97,_0x4c5c65))['catch'](handleError(_0x2d7e97,null));};exports[_0xb167('0x6c')]=function(_0x48e399,_0x2eeb39,_0x2c19d1){return db['MailAccount'][_0xb167('0x5e')]({'where':{'id':_0x48e399['params']['id']}})['then'](handleEntityNotFound(_0x2eeb39,null))[_0xb167('0x22')](function(_0x473ef8){if(_0x473ef8){return _0x473ef8[_0xb167('0x6c')](_0x48e399[_0xb167('0x47')][_0xb167('0x69')]);}})[_0xb167('0x22')](respondWithStatusCode(_0x2eeb39,null))[_0xb167('0x5a')](handleError(_0x2eeb39,null));};exports[_0xb167('0x63')]=function(_0x3abd46,_0x44235d){var _0x5215bf={'name':_0x3abd46[_0xb167('0x5f')][_0xb167('0x39')],'key':_0x3abd46[_0xb167('0x5f')]['key'],'email':_0x3abd46['body'][_0xb167('0x6d')],'ListId':_0x3abd46[_0xb167('0x5f')][_0xb167('0x6e')],'active':!_[_0xb167('0x6f')](_0x3abd46[_0xb167('0x5f')][_0xb167('0x70')])?_0x3abd46[_0xb167('0x5f')]['active']:!![],'description':_0x3abd46[_0xb167('0x5f')][_0xb167('0x71')]||null,'Imap':{},'Smtp':{}};if(_[_0xb167('0x6f')](_0x3abd46[_0xb167('0x5f')]['cservice'])){if(_0x3abd46[_0xb167('0x5f')]['cauthentication']){_0x5215bf[_0xb167('0x3c')][_0xb167('0x72')]=_0x5215bf[_0xb167('0x3e')][_0xb167('0x72')]=_0x3abd46[_0xb167('0x5f')][_0xb167('0x73')];_0x5215bf[_0xb167('0x3c')][_0xb167('0x74')]=_0x5215bf['Smtp'][_0xb167('0x75')]=_0x3abd46[_0xb167('0x5f')][_0xb167('0x76')];}else{_0x5215bf[_0xb167('0x3c')][_0xb167('0x77')]=_0x5215bf[_0xb167('0x3e')]['authentication']=![];}_0x5215bf['Imap'][_0xb167('0x78')]=_0x3abd46[_0xb167('0x5f')][_0xb167('0x3c')]['host'];_0x5215bf[_0xb167('0x3c')][_0xb167('0x79')]=_0x3abd46[_0xb167('0x5f')][_0xb167('0x3c')][_0xb167('0x79')];_0x5215bf[_0xb167('0x3e')][_0xb167('0x78')]=_0x3abd46['body']['Smtp'][_0xb167('0x78')];_0x5215bf[_0xb167('0x3e')][_0xb167('0x79')]=_0x3abd46['body'][_0xb167('0x3e')]['port'];}else{_0x5215bf[_0xb167('0x3c')][_0xb167('0x7a')]=_0x5215bf[_0xb167('0x3e')][_0xb167('0x7a')]=_0x3abd46['body']['cservice'];_0x5215bf[_0xb167('0x3c')][_0xb167('0x72')]=_0x5215bf[_0xb167('0x3e')][_0xb167('0x72')]=_0x3abd46[_0xb167('0x5f')][_0xb167('0x73')];_0x5215bf[_0xb167('0x3c')][_0xb167('0x74')]=_0x5215bf[_0xb167('0x3e')][_0xb167('0x75')]=_0x3abd46[_0xb167('0x5f')][_0xb167('0x76')];}return db['MailAccount'][_0xb167('0x63')](_0x5215bf,{'include':[{'model':db[_0xb167('0x3d')],'as':'Smtp'},{'model':db['MailServerIn'],'as':_0xb167('0x3c')}]})[_0xb167('0x22')](function(_0x3e6f3d){var _0x4c0b10=_0x3abd46[_0xb167('0x72')][_0xb167('0x35')]({'plain':!![]});if(!_0x4c0b10)throw new Error(_0xb167('0x7b'));if(_0x4c0b10['role']===_0xb167('0x72')){var _0x39bf02=_0x3e6f3d[_0xb167('0x35')]({'plain':!![]});return db[_0xb167('0x7c')]['find']({'where':{'name':_0xb167('0x36'),'userProfileId':_0x4c0b10[_0xb167('0x7d')]},'raw':!![]})['then'](function(_0x58c432){if(_0x58c432&&_0x58c432[_0xb167('0x7e')]===0x0){return db[_0xb167('0x37')][_0xb167('0x63')]({'name':_0x39bf02['name'],'resourceId':_0x39bf02['id'],'type':_0x58c432['name'],'sectionId':_0x58c432['id']},{})[_0xb167('0x22')](function(){return _0x3e6f3d;});}else{return _0x3e6f3d;}})[_0xb167('0x5a')](function(_0x593393){logger['error'](_0xb167('0x7f'),_0x593393);throw _0x593393;});}return _0x3e6f3d;})[_0xb167('0x22')](respondWithResult(_0x44235d,0xc9))[_0xb167('0x5a')](handleError(_0x44235d,null));};exports['getImap']=function(_0x5a8283,_0x31af6c,_0x51a41e){return db['MailAccount'][_0xb167('0x65')]({'where':{'id':_0x5a8283['params']['id']}})[_0xb167('0x22')](handleEntityNotFound(_0x31af6c,null))[_0xb167('0x22')](function(_0x3861b9){if(_0x3861b9){return _0x3861b9[_0xb167('0x80')]();}return null;})[_0xb167('0x22')](respondWithResult(_0x31af6c,null))['catch'](handleError(_0x31af6c,null));};exports[_0xb167('0x81')]=function(_0x365a4b,_0x296a77,_0x1d7c32){if(_0x365a4b[_0xb167('0x5f')]['id']){delete _0x365a4b[_0xb167('0x5f')]['id'];}return db[_0xb167('0x41')]['find']({'where':{'id':_0x365a4b[_0xb167('0x5b')]['id']}})[_0xb167('0x22')](handleEntityNotFound(_0x296a77,null))[_0xb167('0x22')](function(_0x3031a4){if(_0x3031a4){_0x365a4b['body'][_0xb167('0x61')]=_0x3031a4['id'];return db[_0xb167('0x82')]['create'](_0x365a4b[_0xb167('0x5f')]);}})[_0xb167('0x22')](respondWithResult(_0x296a77,null))[_0xb167('0x5a')](handleError(_0x296a77,null));};exports[_0xb167('0x83')]=function(_0x190b35,_0x4a17ce,_0x14afca){return db['MailAccount'][_0xb167('0x65')]({'where':{'id':_0x190b35[_0xb167('0x5b')]['id']}})[_0xb167('0x22')](handleEntityNotFound(_0x4a17ce,null))['then'](function(_0x41927b){if(_0x41927b){return _0x41927b[_0xb167('0x84')](null);}return null;})[_0xb167('0x22')](respondWithStatusCode(_0x4a17ce,null))[_0xb167('0x5a')](handleError(_0x4a17ce,null));};exports[_0xb167('0x85')]=function(_0x10e772,_0x2444a3,_0x1c1e5c){return db['MailAccount'][_0xb167('0x65')]({'where':{'id':_0x10e772['params']['id']}})['then'](handleEntityNotFound(_0x2444a3,null))[_0xb167('0x22')](function(_0x3921c1){if(_0x3921c1){return _0x3921c1[_0xb167('0x85')]();}return null;})['then'](respondWithResult(_0x2444a3,null))[_0xb167('0x5a')](handleError(_0x2444a3,null));};exports[_0xb167('0x86')]=function(_0x27d05c,_0xacb1a2,_0x1a2fcf){if(_0x27d05c['body']['id']){delete _0x27d05c[_0xb167('0x5f')]['id'];}return db[_0xb167('0x41')][_0xb167('0x5e')]({'where':{'id':_0x27d05c[_0xb167('0x5b')]['id']}})[_0xb167('0x22')](handleEntityNotFound(_0xacb1a2,null))[_0xb167('0x22')](function(_0x286cba){if(_0x286cba){_0x27d05c[_0xb167('0x5f')][_0xb167('0x61')]=_0x286cba['id'];return db['MailServerOut'][_0xb167('0x63')](_0x27d05c[_0xb167('0x5f')]);}})[_0xb167('0x22')](respondWithResult(_0xacb1a2,null))['catch'](handleError(_0xacb1a2,null));};exports[_0xb167('0x87')]=function(_0x4941ee,_0xbae546,_0x14f4b8){return db[_0xb167('0x41')][_0xb167('0x65')]({'where':{'id':_0x4941ee[_0xb167('0x5b')]['id']}})[_0xb167('0x22')](handleEntityNotFound(_0xbae546,null))[_0xb167('0x22')](function(_0x6d9da1){if(_0x6d9da1){return _0x6d9da1['setSmtp'](null);}return null;})['then'](respondWithStatusCode(_0xbae546,null))[_0xb167('0x5a')](handleError(_0xbae546,null));};exports[_0xb167('0x88')]=function(_0x356164,_0x1d4a2f,_0x5658a4){return db[_0xb167('0x89')]['find']({'where':{'id':_0x356164[_0xb167('0x5b')]['id']}})[_0xb167('0x22')](handleEntityNotFound(_0x1d4a2f,null))[_0xb167('0x22')](function(_0x2dd77b){if(_0x2dd77b){return _0x2dd77b[_0xb167('0x88')](_0x356164['body']['ids'],_[_0xb167('0x8a')](_0x356164[_0xb167('0x5f')],[_0xb167('0x69'),'id'])||{});}})[_0xb167('0x22')](respondWithResult(_0x1d4a2f,null))[_0xb167('0x5a')](handleError(_0x1d4a2f,null));};exports['getInteractions']=function(_0x56e432,_0x5428ab,_0x2e6113){var _0x3c5cda={'raw':![],'where':{}};var _0x1668ac={};var _0x58e6ec={'count':0x0,'rows':[]};return db[_0xb167('0x41')][_0xb167('0x65')]({'where':{'id':_0x56e432[_0xb167('0x5b')]['id']}})[_0xb167('0x22')](handleEntityNotFound(_0x5428ab,null))[_0xb167('0x22')](function(_0x582d9c){if(_0x582d9c){_0x1668ac[_0xb167('0x45')]=_['keys'](db[_0xb167('0x89')][_0xb167('0x42')]);_0x1668ac[_0xb167('0x47')]=_[_0xb167('0x46')](_0x56e432['query']);_0x1668ac[_0xb167('0x48')]=_['intersection'](_0x1668ac[_0xb167('0x45')],_0x1668ac[_0xb167('0x47')]);_0x3c5cda[_0xb167('0x4a')]=_[_0xb167('0x49')](_0x1668ac[_0xb167('0x45')],qs['fields'](_0x56e432[_0xb167('0x47')][_0xb167('0x5d')]));_0x3c5cda[_0xb167('0x4a')]=_0x3c5cda[_0xb167('0x4a')]['length']?_0x3c5cda[_0xb167('0x4a')]:_0x1668ac[_0xb167('0x45')];if(!_0x56e432[_0xb167('0x47')][_0xb167('0x4c')](_0xb167('0x66'))){_0x3c5cda['limit']=qs[_0xb167('0x4d')](_0x56e432[_0xb167('0x47')][_0xb167('0x4d')]);_0x3c5cda[_0xb167('0x2f')]=qs[_0xb167('0x2f')](_0x56e432[_0xb167('0x47')][_0xb167('0x2f')]);}_0x3c5cda[_0xb167('0x4e')]=qs[_0xb167('0x4f')](_0x56e432[_0xb167('0x47')][_0xb167('0x4f')]);_0x3c5cda[_0xb167('0x50')]=qs['filters'](_[_0xb167('0x51')](_0x56e432[_0xb167('0x47')],_0x1668ac['filters']));_0x3c5cda[_0xb167('0x50')]['MailAccountId']=_0x582d9c['id'];if(_0x56e432[_0xb167('0x47')]['filter']){_0x3c5cda[_0xb167('0x50')]=_[_0xb167('0x53')](_0x3c5cda[_0xb167('0x50')],{'$or':_[_0xb167('0x40')](_0x3c5cda[_0xb167('0x4a')],function(_0x5961dd){var _0x54908a={};_0x54908a[_0x5961dd]={'$like':'%'+_0x56e432[_0xb167('0x47')][_0xb167('0x52')]+'%'};return _0x54908a;})});}_0x3c5cda=_[_0xb167('0x53')]({},_0x3c5cda,_0x56e432[_0xb167('0x67')]);return db[_0xb167('0x89')][_0xb167('0x55')]({'where':_0x3c5cda['where']})[_0xb167('0x22')](function(_0x56e7ed){_0x58e6ec[_0xb167('0x55')]=_0x56e7ed;if(_0x56e432[_0xb167('0x47')][_0xb167('0x56')]){_0x3c5cda[_0xb167('0x57')]=[{'model':db[_0xb167('0x8b')],'as':'Contact','required':![]},{'model':db[_0xb167('0x8c')],'as':_0xb167('0x8d'),'attributes':[_0xb167('0x39'),_0xb167('0x8e'),_0xb167('0x8f')],'required':![]},{'model':db[_0xb167('0x90')],'as':_0xb167('0x91'),'attributes':['id',_0xb167('0x39'),_0xb167('0x92')],'where':_0x56e432[_0xb167('0x47')][_0xb167('0x93')]?{'id':_0x56e432[_0xb167('0x47')][_0xb167('0x93')]}:undefined,'required':_0x56e432[_0xb167('0x47')][_0xb167('0x93')]?!![]:![]}];}return db['MailInteraction'][_0xb167('0x58')](_0x3c5cda);})[_0xb167('0x22')](function(_0x19edd2){_0x58e6ec[_0xb167('0x59')]=_0x19edd2;return _0x58e6ec;});}})['then'](respondWithFilteredResult(_0x5428ab,_0x3c5cda))[_0xb167('0x5a')](handleError(_0x5428ab,null));};exports[_0xb167('0x94')]=function(_0x40b934,_0x116734,_0x325d1c){return db[_0xb167('0x41')][_0xb167('0x65')]({'where':{'id':_0x40b934['params']['id']}})[_0xb167('0x22')](handleEntityNotFound(_0x116734,null))[_0xb167('0x22')](function(_0x256184){if(_0x256184){return db[_0xb167('0x95')][_0xb167('0x96')](function(_0x5ec6d6){return db['MailApplication'][_0xb167('0x97')]({'where':{'MailAccountId':_0x40b934[_0xb167('0x5b')]['id']},'transaction':_0x5ec6d6})[_0xb167('0x22')](function(_0x10cba1){var _0x456d54=_[_0xb167('0x40')](_0x40b934[_0xb167('0x5f')],function(_0x52fa0d){_0x52fa0d['MailAccountId']=_0x40b934[_0xb167('0x5b')]['id'];return _0x52fa0d;});return db[_0xb167('0x98')][_0xb167('0x99')](_0x456d54,{'transaction':_0x5ec6d6});});})[_0xb167('0x22')](function(){return db[_0xb167('0x98')][_0xb167('0x9a')]({'where':{'MailAccountId':_0x40b934[_0xb167('0x5b')]['id']},'order':_0xb167('0x9b')});});}})[_0xb167('0x22')](respondWithResult(_0x116734,null))[_0xb167('0x5a')](handleError(_0x116734,null));};exports[_0xb167('0x9c')]=function(_0xcde5e2,_0x312a1b,_0x29d1b0){var _0x1a1cb9={};var _0x3e39d1={};var _0x18339b;var _0x440945;return db[_0xb167('0x41')][_0xb167('0x65')]({'where':{'id':_0xcde5e2[_0xb167('0x5b')]['id']}})['then'](handleEntityNotFound(_0x312a1b,null))[_0xb167('0x22')](function(_0x1157e4){if(_0x1157e4){_0x18339b=_0x1157e4;_0x3e39d1[_0xb167('0x45')]=_['keys'](db[_0xb167('0x98')][_0xb167('0x42')]);_0x3e39d1[_0xb167('0x47')]=_[_0xb167('0x46')](_0xcde5e2[_0xb167('0x47')]);_0x3e39d1['filters']=_['intersection'](_0x3e39d1[_0xb167('0x45')],_0x3e39d1[_0xb167('0x47')]);_0x1a1cb9[_0xb167('0x4a')]=_['intersection'](_0x3e39d1['model'],qs[_0xb167('0x5d')](_0xcde5e2['query'][_0xb167('0x5d')]));_0x1a1cb9[_0xb167('0x4a')]=_0x1a1cb9[_0xb167('0x4a')][_0xb167('0x4b')]?_0x1a1cb9[_0xb167('0x4a')]:_0x3e39d1['model'];_0x1a1cb9[_0xb167('0x4e')]=qs[_0xb167('0x4f')](_0xcde5e2['query'][_0xb167('0x4f')]);_0x1a1cb9['where']=qs[_0xb167('0x48')](_['pick'](_0xcde5e2[_0xb167('0x47')],_0x3e39d1[_0xb167('0x48')]));if(_0xcde5e2['query']['filter']){_0x1a1cb9[_0xb167('0x50')]=_[_0xb167('0x53')](_0x1a1cb9[_0xb167('0x50')],{'$or':_[_0xb167('0x40')](_0x1a1cb9[_0xb167('0x4a')],function(_0x45e480){var _0xd44000={};_0xd44000[_0x45e480]={'$like':'%'+_0xcde5e2['query']['filter']+'%'};return _0xd44000;})});}_0x1a1cb9=_[_0xb167('0x53')]({},_0x1a1cb9,_0xcde5e2[_0xb167('0x67')]);return _0x18339b[_0xb167('0x9c')](_0x1a1cb9);}})[_0xb167('0x22')](function(_0x18192b){if(_0x18192b){_0x440945=_0x18192b[_0xb167('0x4b')];if(!_0xcde5e2[_0xb167('0x47')][_0xb167('0x4c')]('nolimit')){_0x1a1cb9[_0xb167('0x4d')]=qs['limit'](_0xcde5e2[_0xb167('0x47')][_0xb167('0x4d')]);_0x1a1cb9[_0xb167('0x2f')]=qs[_0xb167('0x2f')](_0xcde5e2['query']['offset']);}return _0x18339b[_0xb167('0x9c')](_0x1a1cb9);}})['then'](function(_0x1d7d32){if(_0x1d7d32){return _0x1d7d32?{'count':_0x440945,'rows':_0x1d7d32}:null;}})[_0xb167('0x22')](respondWithResult(_0x312a1b,null))[_0xb167('0x5a')](handleError(_0x312a1b,null));};exports[_0xb167('0x9d')]=function(_0x537d8e,_0x3dd71c,_0x506315){var _0x174157={'raw':!![],'where':{}};var _0x5998ce={};var _0x2ca521={'count':0x0,'rows':[]};return db['MailAccount'][_0xb167('0x65')]({'where':{'id':_0x537d8e[_0xb167('0x5b')]['id']}})[_0xb167('0x22')](handleEntityNotFound(_0x3dd71c,null))['then'](function(_0x528067){if(_0x528067){_0x5998ce[_0xb167('0x45')]=_[_0xb167('0x46')](db[_0xb167('0x9e')][_0xb167('0x42')]);_0x5998ce['query']=_['keys'](_0x537d8e[_0xb167('0x47')]);_0x5998ce[_0xb167('0x48')]=_['intersection'](_0x5998ce[_0xb167('0x45')],_0x5998ce[_0xb167('0x47')]);_0x174157[_0xb167('0x4a')]=_[_0xb167('0x49')](_0x5998ce['model'],qs[_0xb167('0x5d')](_0x537d8e[_0xb167('0x47')][_0xb167('0x5d')]));_0x174157[_0xb167('0x4a')]=_0x174157[_0xb167('0x4a')][_0xb167('0x4b')]?_0x174157[_0xb167('0x4a')]:_0x5998ce[_0xb167('0x45')];if(!_0x537d8e[_0xb167('0x47')]['hasOwnProperty'](_0xb167('0x66'))){_0x174157['limit']=qs[_0xb167('0x4d')](_0x537d8e[_0xb167('0x47')]['limit']);_0x174157[_0xb167('0x2f')]=qs[_0xb167('0x2f')](_0x537d8e[_0xb167('0x47')][_0xb167('0x2f')]);}_0x174157[_0xb167('0x4e')]=qs[_0xb167('0x4f')](_0x537d8e[_0xb167('0x47')]['sort']);_0x174157['where']=qs['filters'](_[_0xb167('0x51')](_0x537d8e['query'],_0x5998ce[_0xb167('0x48')]));_0x174157[_0xb167('0x50')][_0xb167('0x61')]=_0x528067['id'];if(_0x537d8e[_0xb167('0x47')][_0xb167('0x52')]){_0x174157[_0xb167('0x50')]=_[_0xb167('0x53')](_0x174157[_0xb167('0x50')],{'$or':_[_0xb167('0x40')](_0x174157[_0xb167('0x4a')],function(_0x51c760){var _0x3318b5={};_0x3318b5[_0x51c760]={'$like':'%'+_0x537d8e['query'][_0xb167('0x52')]+'%'};return _0x3318b5;})});}if(_0x537d8e['query'][_0xb167('0x9f')]){var _0x186068=_0x537d8e[_0xb167('0x47')]['$gte'][_0xb167('0xa0')](',');var _0x163021={};_0x163021[_0x186068[0x0]]={'$gte':moment(_0x186068[0x1])[_0xb167('0xa1')](_0xb167('0xa2'))};_0x174157['where']=_[_0xb167('0x53')](_0x174157[_0xb167('0x50')],_0x163021);}_0x174157=_[_0xb167('0x53')]({},_0x174157,_0x537d8e[_0xb167('0x67')]);return db[_0xb167('0x9e')]['count']({'where':_0x174157[_0xb167('0x50')]})['then'](function(_0x5e4631){_0x2ca521[_0xb167('0x55')]=_0x5e4631;if(_0x537d8e[_0xb167('0x47')][_0xb167('0x56')]){_0x174157[_0xb167('0x57')]=[{'all':!![]}];}return db['MailMessage'][_0xb167('0x58')](_0x174157);})[_0xb167('0x22')](function(_0x2f967d){_0x2ca521['rows']=_0x2f967d;return _0x2ca521;});}})['then'](respondWithFilteredResult(_0x3dd71c,_0x174157))[_0xb167('0x5a')](handleError(_0x3dd71c,null));};exports[_0xb167('0x3a')]=function(_0x320268,_0x5723d9,_0x1674a8){var _0x2cbc6b,_0xed6a82={},_0x4c62b1;if(_0x320268['body']['to']){_0x4c62b1=_0x320268['body']['to'][_0xb167('0xa0')](',')[0x0];}return db[_0xb167('0x41')]['find']({'where':{'id':_0x320268['params']['id']},'include':[{'model':db[_0xb167('0xa3')],'as':_0xb167('0xa4'),'include':[{'model':db[_0xb167('0x8b')],'as':_0xb167('0xa5'),'where':{'email':_0x4c62b1},'limit':0x1,'order':[[_0xb167('0xa6'),'DESC']]}]},{'model':db[_0xb167('0x3d')],'as':_0xb167('0x3e'),'raw':!![]}]})['then'](handleEntityNotFound(_0x5723d9,null))[_0xb167('0x22')](function(_0x47bef2){if(_0x47bef2){_0x2cbc6b=_0x47bef2;if(_0x47bef2[_0xb167('0x3e')]){if(_[_0xb167('0x6f')](_0x320268[_0xb167('0x5f')][_0xb167('0xa7')])){_0x320268[_0xb167('0x5f')][_0xb167('0xa7')]=util[_0xb167('0xa1')](_0xb167('0xa8'),_0x47bef2[_0xb167('0x39')],_0x47bef2[_0xb167('0x6d')]||_0x47bef2[_0xb167('0x3e')][_0xb167('0x72')]);}if(_0x320268[_0xb167('0x5f')][_0xb167('0xa9')]&&_0x320268[_0xb167('0x5f')][_0xb167('0xa9')]['length']){for(var _0x3bc28a=0x0;_0x3bc28a<_0x320268[_0xb167('0x5f')]['attachments'][_0xb167('0x4b')];_0x3bc28a+=0x1){_0x320268[_0xb167('0x5f')][_0xb167('0xa9')][_0x3bc28a]={'filename':_0x320268[_0xb167('0x5f')][_0xb167('0xa9')][_0x3bc28a][_0xb167('0x39')],'path':path[_0xb167('0xaa')](config['root'],_0xb167('0xab'),_0x320268[_0xb167('0x5f')][_0xb167('0xa9')][_0x3bc28a]['basename'])};}}var _0x22f9ee={'tls':{'rejectUnauthorized':![]}};if(_[_0xb167('0x6f')](_0x47bef2[_0xb167('0x3e')][_0xb167('0x7a')])){if(_0x47bef2[_0xb167('0x3e')][_0xb167('0x77')]){_0x22f9ee[_0xb167('0xac')]={'user':_0x47bef2[_0xb167('0x3e')]['user'],'pass':_0x47bef2[_0xb167('0x3e')][_0xb167('0x75')]};}_0x22f9ee[_0xb167('0x78')]=_0x47bef2['Smtp'][_0xb167('0x78')];_0x22f9ee[_0xb167('0x79')]=_0x47bef2['Smtp']['port'];_0x22f9ee[_0xb167('0xad')]=_0x47bef2[_0xb167('0x3e')][_0xb167('0xad')];}else{_0x22f9ee['service']=_0x47bef2['Smtp'][_0xb167('0x7a')];_0x22f9ee[_0xb167('0xac')]={'user':_0x47bef2[_0xb167('0x3e')][_0xb167('0x72')],'pass':_0x47bef2[_0xb167('0x3e')][_0xb167('0x75')]};}return respondWithRpcPromise('SendMail',_0xb167('0xae'),{'account':_0x22f9ee,'message':_0x320268['body']});}else{throw new Error(_0xb167('0xaf'));}}})[_0xb167('0x22')](function(_0x304a05){if(_0x304a05){_0xed6a82=_0x304a05;if(_0x2cbc6b[_0xb167('0xa4')]){if(_0x2cbc6b[_0xb167('0xa4')][_0xb167('0xa5')]['length']){return _0x2cbc6b[_0xb167('0xa4')]['Contacts'][0x0];}else{return db[_0xb167('0x8b')][_0xb167('0x63')](_[_0xb167('0xb0')](_0x320268[_0xb167('0x5f')],{'firstName':_0x320268[_0xb167('0x5f')]['to'],'email':_0x320268[_0xb167('0x5f')]['to'],'phone':_0x320268[_0xb167('0x5f')]['to'],'ListId':_0x2cbc6b['ListId']}));}}else{throw new Error(_0xb167('0xaf'));}}})[_0xb167('0x22')](function(_0xdf71d6){if(_0xdf71d6){var _0x5787d4={'UserId':_0x320268[_0xb167('0x72')]['id'],'ContactId':_0xdf71d6['id'],'MailAccountId':_0x2cbc6b['id'],'inReplyTo':_0xed6a82['messageId'],'to':_0x320268['body'][_0xb167('0xa7')],'cc':_0x320268[_0xb167('0x5f')]['cc'],'subject':_0x320268[_0xb167('0x5f')][_0xb167('0xb1')],'attach':_0x320268['body'][_0xb167('0xb2')],'firstMsgDirection':'out','lastMsgAt':moment()[_0xb167('0xa1')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0xb167('0xb3'),'lastMsgBody':_0x320268[_0xb167('0x5f')][_0xb167('0x5f')],'Messages':[_[_0xb167('0x53')](_0x320268[_0xb167('0x5f')],{'messageId':_0xed6a82[_0xb167('0xb4')],'sentAt':moment()[_0xb167('0xa1')](_0xb167('0xa2')),'read':!![],'MailAccountId':_0x2cbc6b['id'],'UserId':_0x320268[_0xb167('0x72')]['id'],'ContactId':_0xdf71d6['id']})]};if(_0x320268[_0xb167('0x5f')][_0xb167('0xb5')]){_0x5787d4=_['merge'](_0x5787d4,_0x320268[_0xb167('0x5f')][_0xb167('0xb5')]);}return db['MailInteraction']['create'](_0x5787d4,{'include':[{'model':db[_0xb167('0x9e')],'as':_0xb167('0xb6')}]});}})[_0xb167('0x22')](respondWithResult(_0x5723d9,null))['catch'](handleError(_0x5723d9,null));};exports[_0xb167('0xb7')]=function(_0x4dfce3,_0x5f0254,_0x419663){return db[_0xb167('0x41')][_0xb167('0x5e')]({'where':{'id':_0x4dfce3[_0xb167('0x5b')]['id']},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})['then'](handleEntityNotFound(_0x5f0254,null))['then'](function(_0x180cd2){if(_0x180cd2&&_0x180cd2[_0xb167('0x3e')]){var _0x54a27e={'id':_0x180cd2['id'],'tls':{'rejectUnauthorized':![]}};if(_0x180cd2['Smtp']['service']){_0x54a27e[_0xb167('0x7a')]=_0x180cd2[_0xb167('0x3e')][_0xb167('0x7a')];}else{_0x54a27e['host']=_0x180cd2[_0xb167('0x3e')][_0xb167('0x78')];_0x54a27e[_0xb167('0x79')]=_0x180cd2['Smtp']['port'];_0x54a27e['secure']=_0x180cd2['Smtp']['secure'];}if(_0x180cd2[_0xb167('0x3e')]['authentication']){_0x54a27e[_0xb167('0xac')]={'user':_0x180cd2['Smtp'][_0xb167('0x72')],'pass':_0x180cd2[_0xb167('0x3e')][_0xb167('0x75')]};}return respondWithRpcPromise(_0xb167('0xb8'),_0xb167('0xb7'),{'account':_0x54a27e});}})[_0xb167('0x22')](respondWithResult(_0x5f0254,null))[_0xb167('0x5a')](handleError(_0x5f0254,null));};exports['destroy']=function(_0x211186,_0x17826c){return db['MailAccount'][_0xb167('0x5e')]({'where':{'id':_0x211186[_0xb167('0x5b')]['id']}})[_0xb167('0x22')](handleEntityNotFound(_0x17826c,null))[_0xb167('0x22')](function(_0x268203){if(_0x268203&&_0x268203[_0xb167('0x7a')]){throw new db[(_0xb167('0x1f'))][(_0xb167('0x20'))](_0xb167('0xb9'));}return _0x268203;})[_0xb167('0x22')](removeEntity(_0x17826c,null))[_0xb167('0x5a')](handleError(_0x17826c,null));};exports[_0xb167('0xba')]=function(_0x3b06ae,_0x5095cf,_0x5173db){return db[_0xb167('0x41')][_0xb167('0x5e')]({'where':{'id':_0x3b06ae['params']['id']}})[_0xb167('0x22')](handleEntityNotFound(_0x5095cf,null))[_0xb167('0x22')](function(_0x401b06){if(_0x401b06){return _0x401b06[_0xb167('0xba')](_0x3b06ae[_0xb167('0x5f')][_0xb167('0x69')],_[_0xb167('0x8a')](_0x3b06ae['body'],[_0xb167('0x69'),'id'])||{})[_0xb167('0xbb')](function(_0x2bbe60){for(var _0x81d8f2=0x0;_0x81d8f2<_0x3b06ae[_0xb167('0x5f')][_0xb167('0x69')][_0xb167('0x4b')];_0x81d8f2+=0x1){socket[_0xb167('0xbc')](_0xb167('0xbd'),{'UserId':_0x3b06ae['body'][_0xb167('0x69')][_0x81d8f2],'MailAccountId':_0x3b06ae[_0xb167('0x5b')]['id']});}return _0x2bbe60;});}})[_0xb167('0x22')](respondWithResult(_0x5095cf,null))[_0xb167('0x5a')](handleError(_0x5095cf,null));};exports[_0xb167('0xbe')]=function(_0x10bda7,_0x3377ae,_0x1aafd5){return db['MailAccount'][_0xb167('0x5e')]({'where':{'id':_0x10bda7[_0xb167('0x5b')]['id']}})[_0xb167('0x22')](handleEntityNotFound(_0x3377ae,null))[_0xb167('0x22')](function(_0x39494f){if(_0x39494f){return _0x39494f[_0xb167('0xbe')](_0x10bda7[_0xb167('0x47')][_0xb167('0x69')])[_0xb167('0x22')](function(){if(_[_0xb167('0xbf')](_0x10bda7['query'][_0xb167('0x69')])){for(var _0x144402=0x0;_0x144402<_0x10bda7['query'][_0xb167('0x69')][_0xb167('0x4b')];_0x144402+=0x1){socket[_0xb167('0xbc')](_0xb167('0xc0'),{'UserId':Number(_0x10bda7[_0xb167('0x47')][_0xb167('0x69')][_0x144402]),'MailAccountId':Number(_0x10bda7[_0xb167('0x5b')]['id'])});}}else{socket['emit'](_0xb167('0xc0'),{'UserId':Number(_0x10bda7[_0xb167('0x47')][_0xb167('0x69')]),'MailAccountId':Number(_0x10bda7[_0xb167('0x5b')]['id'])});}});}})[_0xb167('0x22')](respondWithStatusCode(_0x3377ae,null))[_0xb167('0x5a')](handleError(_0x3377ae,null));};exports[_0xb167('0xc1')]=function(_0x2d5063,_0x3919f7,_0x13e38f){var _0x4ba3ea={};var _0x2f20b3={};var _0x47cdbd;var _0x596fa0;return db[_0xb167('0x41')][_0xb167('0x65')]({'where':{'id':_0x2d5063[_0xb167('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3919f7,null))[_0xb167('0x22')](function(_0x7cd520){if(_0x7cd520){_0x47cdbd=_0x7cd520;_0x2f20b3['model']=_['keys'](db['User'][_0xb167('0x42')]);_0x2f20b3[_0xb167('0x47')]=_[_0xb167('0x46')](_0x2d5063[_0xb167('0x47')]);_0x2f20b3[_0xb167('0x48')]=_[_0xb167('0x49')](_0x2f20b3[_0xb167('0x45')],_0x2f20b3['query']);_0x4ba3ea[_0xb167('0x4a')]=_[_0xb167('0x49')](_0x2f20b3[_0xb167('0x45')],qs['fields'](_0x2d5063[_0xb167('0x47')][_0xb167('0x5d')]));_0x4ba3ea[_0xb167('0x4a')]=_0x4ba3ea['attributes']['length']?_0x4ba3ea[_0xb167('0x4a')]:_0x2f20b3['model'];_0x4ba3ea[_0xb167('0x4e')]=qs[_0xb167('0x4f')](_0x2d5063[_0xb167('0x47')][_0xb167('0x4f')]);_0x4ba3ea[_0xb167('0x50')]=qs[_0xb167('0x48')](_[_0xb167('0x51')](_0x2d5063[_0xb167('0x47')],_0x2f20b3[_0xb167('0x48')]));if(_0x2d5063[_0xb167('0x47')][_0xb167('0x52')]){_0x4ba3ea['where']=_[_0xb167('0x53')](_0x4ba3ea[_0xb167('0x50')],{'$or':_['map'](_0x4ba3ea[_0xb167('0x4a')],function(_0x1c2c0f){var _0x1ae6d6={};_0x1ae6d6[_0x1c2c0f]={'$like':'%'+_0x2d5063[_0xb167('0x47')][_0xb167('0x52')]+'%'};return _0x1ae6d6;})});}_0x4ba3ea=_[_0xb167('0x53')]({},_0x4ba3ea,_0x2d5063[_0xb167('0x67')]);return _0x47cdbd[_0xb167('0xc1')](_0x4ba3ea);}})[_0xb167('0x22')](function(_0x3ff521){if(_0x3ff521){_0x596fa0=_0x3ff521['length'];if(!_0x2d5063[_0xb167('0x47')]['hasOwnProperty'](_0xb167('0x66'))){_0x4ba3ea[_0xb167('0x4d')]=qs[_0xb167('0x4d')](_0x2d5063[_0xb167('0x47')][_0xb167('0x4d')]);_0x4ba3ea['offset']=qs[_0xb167('0x2f')](_0x2d5063[_0xb167('0x47')][_0xb167('0x2f')]);}return _0x47cdbd[_0xb167('0xc1')](_0x4ba3ea);}})[_0xb167('0x22')](function(_0x5c45d8){if(_0x5c45d8){return _0x5c45d8?{'count':_0x596fa0,'rows':_0x5c45d8}:null;}})['then'](respondWithResult(_0x3919f7,null))[_0xb167('0x5a')](handleError(_0x3919f7,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 995b782..5b92318 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 _0x47cd=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','MailAccount'];(function(_0x2e6e98,_0x661a12){var _0x4ceb9d=function(_0x30017a){while(--_0x30017a){_0x2e6e98['push'](_0x2e6e98['shift']());}};_0x4ceb9d(++_0x661a12);}(_0x47cd,0xf7));var _0xd47c=function(_0x5491e1,_0x30315a){_0x5491e1=_0x5491e1-0x0;var _0x2a1f6e=_0x47cd[_0x5491e1];return _0x2a1f6e;};'use strict';var EventEmitter=require('events');var MailAccount=require('../../mysqldb')['db'][_0xd47c('0x0')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xd47c('0x1')](0x0);var events={'afterCreate':_0xd47c('0x2'),'afterUpdate':'update','afterDestroy':_0xd47c('0x3')};function emitEvent(_0xe6acf0){return function(_0x36afc2,_0x5e783f,_0x924b15){MailAccountEvents[_0xd47c('0x4')](_0xe6acf0+':'+_0x36afc2['id'],_0x36afc2);MailAccountEvents[_0xd47c('0x4')](_0xe6acf0,_0x36afc2);_0x924b15(null);};}for(var e in events){if(events[_0xd47c('0x5')](e)){var event=events[e];MailAccount[_0xd47c('0x6')](e,emitEvent(event));}}module[_0xd47c('0x7')]=MailAccountEvents; \ No newline at end of file +var _0xf741=['MailAccount','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x172f28,_0x595347){var _0x217ac6=function(_0x296ce7){while(--_0x296ce7){_0x172f28['push'](_0x172f28['shift']());}};_0x217ac6(++_0x595347);}(_0xf741,0xb6));var _0x1f74=function(_0x27f155,_0xed1c35){_0x27f155=_0x27f155-0x0;var _0x4030c1=_0xf741[_0x27f155];return _0x4030c1;};'use strict';var EventEmitter=require(_0x1f74('0x0'));var MailAccount=require(_0x1f74('0x1'))['db'][_0x1f74('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x1f74('0x3'),'afterDestroy':_0x1f74('0x4')};function emitEvent(_0x1f732e){return function(_0x516911,_0x40f151,_0x74125f){MailAccountEvents[_0x1f74('0x5')](_0x1f732e+':'+_0x516911['id'],_0x516911);MailAccountEvents[_0x1f74('0x5')](_0x1f732e,_0x516911);_0x74125f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x1f74('0x6')](e,emitEvent(event));}}module[_0x1f74('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index a1d02e8..f68c444 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 _0x55c0=['path','rimraf','../../config/environment','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','lodash','../../config/logger','api','moment','request-promise'];(function(_0x5cb7de,_0x90f7a2){var _0x199040=function(_0x6c5cb6){while(--_0x6c5cb6){_0x5cb7de['push'](_0x5cb7de['shift']());}};_0x199040(++_0x90f7a2);}(_0x55c0,0x140));var _0x055c=function(_0x304aca,_0x4f8e0b){_0x304aca=_0x304aca-0x0;var _0x3b811c=_0x55c0[_0x304aca];return _0x3b811c;};'use strict';var _=require(_0x055c('0x0'));var util=require('util');var logger=require(_0x055c('0x1'))(_0x055c('0x2'));var moment=require(_0x055c('0x3'));var BPromise=require('bluebird');var rp=require(_0x055c('0x4'));var fs=require('fs');var path=require(_0x055c('0x5'));var rimraf=require(_0x055c('0x6'));var config=require(_0x055c('0x7'));var attributes=require(_0x055c('0x8'));module[_0x055c('0x9')]=function(_0x30d14a,_0x3dba7b){return _0x30d14a[_0x055c('0xa')](_0x055c('0xb'),attributes,{'tableName':_0x055c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x93e7=['api','bluebird','request-promise','path','rimraf','./mailAccount.attributes','define','mail_accounts','lodash','../../config/logger'];(function(_0x1596e2,_0x5e7781){var _0x2d0fb8=function(_0x56a85b){while(--_0x56a85b){_0x1596e2['push'](_0x1596e2['shift']());}};_0x2d0fb8(++_0x5e7781);}(_0x93e7,0x9e));var _0x793e=function(_0x179b74,_0x5dc97d){_0x179b74=_0x179b74-0x0;var _0x268f76=_0x93e7[_0x179b74];return _0x268f76;};'use strict';var _=require(_0x793e('0x0'));var util=require('util');var logger=require(_0x793e('0x1'))(_0x793e('0x2'));var moment=require('moment');var BPromise=require(_0x793e('0x3'));var rp=require(_0x793e('0x4'));var fs=require('fs');var path=require(_0x793e('0x5'));var rimraf=require(_0x793e('0x6'));var config=require('../../config/environment');var attributes=require(_0x793e('0x7'));module['exports']=function(_0x336ce8,_0x58ddb4){return _0x336ce8[_0x793e('0x8')]('MailAccount',attributes,{'tableName':_0x793e('0x9'),'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 2efc3f8..346680a 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 _0x41bb=['Attachment','Attachments','UserId','name','unshift','Start','startRouting','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','./mailAccount.socket','register','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetMailAccount','MailAccount','findAll','options','raw','attributes','limit','include','model','map','then','ShowMailAccount','find','catch','NotifyMailAccount','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','body','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','Contacts','DESC','List','get','omit','Applications','applications','list','orderBy','asc','autoclose','push','length','close','*,*,*,*','defaults','from','create','List\x20not\x20found','contact','messageId','subject','attach','format','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','update','YYYY-MM-DD\x20HH:mm:ss','interaction','originTo','originCc'];(function(_0x1d6e3d,_0x51b0c5){var _0x27d1e4=function(_0x37d6c4){while(--_0x37d6c4){_0x1d6e3d['push'](_0x1d6e3d['shift']());}};_0x27d1e4(++_0x51b0c5);}(_0x41bb,0xc5));var _0xb41b=function(_0x42db0b,_0x2b7c94){_0x42db0b=_0x42db0b-0x0;var _0x5928ca=_0x41bb[_0x42db0b];return _0x5928ca;};'use strict';var _=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var moment=require('moment');var BPromise=require(_0xb41b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb41b('0x3'));var db=require(_0xb41b('0x4'))['db'];var utils=require(_0xb41b('0x5'));var logger=require(_0xb41b('0x6'))('rpc');var config=require(_0xb41b('0x7'));var jayson=require(_0xb41b('0x8'));var client=jayson[_0xb41b('0x9')]['http']({'port':0x232c});config['redis']=_['defaults'](config[_0xb41b('0xa')],{'host':_0xb41b('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb41b('0xa')]));require(_0xb41b('0xc'))[_0xb41b('0xd')](socket);function respondWithRpcPromise(_0xa2aa66,_0x26d531,_0x11f049){return new BPromise(function(_0x5e5c5b,_0x4baa03){return client[_0xb41b('0xe')](_0xa2aa66,_0x11f049)['then'](function(_0x2e906c){logger[_0xb41b('0xf')](_0xb41b('0x10'),_0x26d531,_0xb41b('0x11'));logger[_0xb41b('0x12')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x26d531,_0xb41b('0x11'),JSON[_0xb41b('0x13')](_0x2e906c));if(_0x2e906c[_0xb41b('0x14')]){if(_0x2e906c[_0xb41b('0x14')][_0xb41b('0x15')]===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x26d531,_0x2e906c['error'][_0xb41b('0x16')]);return _0x4baa03(_0x2e906c[_0xb41b('0x14')][_0xb41b('0x16')]);}logger[_0xb41b('0x14')](_0xb41b('0x10'),_0x26d531,_0x2e906c['error'][_0xb41b('0x16')]);return _0x5e5c5b(_0x2e906c[_0xb41b('0x14')][_0xb41b('0x16')]);}else{logger[_0xb41b('0xf')](_0xb41b('0x10'),_0x26d531,_0xb41b('0x11'));_0x5e5c5b(_0x2e906c[_0xb41b('0x17')]['message']);}})['catch'](function(_0x5da8e3){logger[_0xb41b('0x14')]('MailAccount,\x20%s,\x20%s',_0x26d531,_0x5da8e3);_0x4baa03(_0x5da8e3);});});}exports[_0xb41b('0x18')]=function(_0x1de9ea){var _0x23700f=this;return new Promise(function(_0x5b7332,_0x53bc44){return db[_0xb41b('0x19')][_0xb41b('0x1a')]({'raw':_0x1de9ea[_0xb41b('0x1b')]?_0x1de9ea[_0xb41b('0x1b')][_0xb41b('0x1c')]===undefined?!![]:![]:!![],'where':_0x1de9ea[_0xb41b('0x1b')]?_0x1de9ea['options']['where']||null:null,'attributes':_0x1de9ea[_0xb41b('0x1b')]?_0x1de9ea[_0xb41b('0x1b')][_0xb41b('0x1d')]||null:null,'limit':_0x1de9ea['options']?_0x1de9ea[_0xb41b('0x1b')][_0xb41b('0x1e')]||null:null,'include':_0x1de9ea['options']?_0x1de9ea[_0xb41b('0x1b')][_0xb41b('0x1f')]?_['map'](_0x1de9ea[_0xb41b('0x1b')]['include'],function(_0x2d0f27){return{'model':db[_0x2d0f27[_0xb41b('0x20')]],'as':_0x2d0f27['as'],'attributes':_0x2d0f27['attributes'],'include':_0x2d0f27[_0xb41b('0x1f')]?_[_0xb41b('0x21')](_0x2d0f27['include'],function(_0x4c2e41){return{'model':db[_0x4c2e41[_0xb41b('0x20')]],'as':_0x4c2e41['as'],'attributes':_0x4c2e41[_0xb41b('0x1d')],'include':_0x4c2e41[_0xb41b('0x1f')]?_[_0xb41b('0x21')](_0x4c2e41[_0xb41b('0x1f')],function(_0x181cbd){return{'model':db[_0x181cbd[_0xb41b('0x20')]],'as':_0x181cbd['as'],'attributes':_0x181cbd['attributes']};}):[]};}):[]};}):[]:[]})[_0xb41b('0x22')](function(_0xb68029){logger['info'](_0xb41b('0x18'),_0x1de9ea);logger['debug'](_0xb41b('0x18'),_0x1de9ea,JSON[_0xb41b('0x13')](_0xb68029));_0x5b7332(_0xb68029);})['catch'](function(_0x23a6ed){logger['error'](_0xb41b('0x18'),_0x23a6ed[_0xb41b('0x16')],_0x1de9ea);_0x53bc44(_0x23700f['error'](0x1f4,_0x23a6ed[_0xb41b('0x16')]));});});};exports[_0xb41b('0x23')]=function(_0x14c2e7){var _0x4503cf=this;return new Promise(function(_0x260170,_0x195d63){return db[_0xb41b('0x19')][_0xb41b('0x24')]({'raw':_0x14c2e7[_0xb41b('0x1b')]?_0x14c2e7[_0xb41b('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x14c2e7[_0xb41b('0x1b')]?_0x14c2e7['options']['where']||null:null,'attributes':_0x14c2e7[_0xb41b('0x1b')]?_0x14c2e7[_0xb41b('0x1b')][_0xb41b('0x1d')]||null:null,'include':_0x14c2e7[_0xb41b('0x1b')]?_0x14c2e7[_0xb41b('0x1b')][_0xb41b('0x1f')]?_[_0xb41b('0x21')](_0x14c2e7[_0xb41b('0x1b')][_0xb41b('0x1f')],function(_0x1d3e90){return{'model':db[_0x1d3e90[_0xb41b('0x20')]],'as':_0x1d3e90['as'],'attributes':_0x1d3e90['attributes'],'include':_0x1d3e90[_0xb41b('0x1f')]?_[_0xb41b('0x21')](_0x1d3e90[_0xb41b('0x1f')],function(_0x23ac00){return{'model':db[_0x23ac00[_0xb41b('0x20')]],'as':_0x23ac00['as'],'attributes':_0x23ac00[_0xb41b('0x1d')],'include':_0x23ac00['include']?_['map'](_0x23ac00[_0xb41b('0x1f')],function(_0x375bb9){return{'model':db[_0x375bb9['model']],'as':_0x375bb9['as'],'attributes':_0x375bb9[_0xb41b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb41b('0x22')](function(_0x2622fd){logger[_0xb41b('0xf')](_0xb41b('0x23'),_0x14c2e7);logger['debug'](_0xb41b('0x23'),_0x14c2e7,JSON['stringify'](_0x2622fd));_0x260170(_0x2622fd);})[_0xb41b('0x25')](function(_0x22c741){logger[_0xb41b('0x14')](_0xb41b('0x23'),_0x22c741[_0xb41b('0x16')],_0x14c2e7);_0x195d63(_0x4503cf[_0xb41b('0x14')](0x1f4,_0x22c741[_0xb41b('0x16')]));});});};exports[_0xb41b('0x26')]=function(_0x2b0721){var _0x578b67=this;return new Promise(function(_0x49e8c4,_0x4e0a61){var _0x3a4e31={'body':_0x2b0721['body'],'channel':'mail'};var _0x781302=_['difference'](_[_0xb41b('0x27')](db[_0xb41b('0x28')][_0xb41b('0x29')]),[_0xb41b('0x2a'),_0xb41b('0x2b'),_0xb41b('0x2c'),_0xb41b('0x2d')]);var _0x57e043=![];if(_0x2b0721[_0xb41b('0x2e')]['id']){delete _0x2b0721[_0xb41b('0x2e')]['id'];}if(_[_0xb41b('0x2f')](_0x2b0721[_0xb41b('0x2e')]['from'])){return _0x4e0a61(_0x578b67[_0xb41b('0x14')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0xb41b('0x2f')](_0x2b0721[_0xb41b('0x2e')][_0xb41b('0x2e')])||_0x2b0721['body']['body']===''){return _0x4e0a61(_0x578b67[_0xb41b('0x14')](0x1f4,_0xb41b('0x30')));}if(_[_0xb41b('0x2f')](_0x2b0721[_0xb41b('0x2e')][_0xb41b('0x31')])){return _0x4e0a61(_0x578b67[_0xb41b('0x14')](0x1f4,_0xb41b('0x32')+_0x781302));}if(!_['includes'](_0x781302,_0x2b0721['body'][_0xb41b('0x31')])){return _0x4e0a61(_0x578b67['error'](0x1f4,_0xb41b('0x33')+_0x781302));}var _0x5b64b4={};_0x5b64b4[_0x2b0721[_0xb41b('0x2e')]['mapKey']]=_0x2b0721[_0xb41b('0x2e')]['from'];return db[_0xb41b('0x19')][_0xb41b('0x24')]({'where':{'id':_0x2b0721[_0xb41b('0x34')]['id']},'include':[{'model':db[_0xb41b('0x35')],'as':'List','include':[{'model':db[_0xb41b('0x28')],'as':_0xb41b('0x36'),'where':_0x5b64b4,'limit':0x1,'order':[['updatedAt',_0xb41b('0x37')]]}]},{'model':db['MailApplication'],'as':'Applications'},{'model':db['MailServerOut'],'as':'Smtp'}]})[_0xb41b('0x22')](function(_0x23ea63){if(_0x23ea63&&_0x23ea63[_0xb41b('0x38')]){var _0x3128a7=_0x23ea63[_0xb41b('0x39')]({'plain':!![]});_0x3a4e31[_0xb41b('0x34')]=_[_0xb41b('0x3a')](_0x3128a7,[_0xb41b('0x3b'),_0xb41b('0x38')]);_0x3a4e31[_0xb41b('0x3c')]=_0x3128a7[_0xb41b('0x3b')];_0x3a4e31[_0xb41b('0x3d')]=_0x3128a7[_0xb41b('0x38')];_0x3a4e31[_0xb41b('0x3c')]=_[_0xb41b('0x3e')](_0x3a4e31[_0xb41b('0x3c')],['priority'],[_0xb41b('0x3f')]);if(_0x3a4e31['account']&&_0x3a4e31['account'][_0xb41b('0x40')]){_0x3a4e31[_0xb41b('0x3c')][_0xb41b('0x41')]({'id':0x0,'priority':_0x3a4e31[_0xb41b('0x3c')][_0xb41b('0x42')]+0x1,'app':_0xb41b('0x43'),'appdata':_0xb41b('0x40'),'interval':_0xb41b('0x44')});}if(_0x3a4e31[_0xb41b('0x34')][_0xb41b('0x3b')]){delete _0x3a4e31[_0xb41b('0x34')][_0xb41b('0x3b')];}if(_0x3a4e31[_0xb41b('0x34')][_0xb41b('0x38')]){delete _0x3a4e31[_0xb41b('0x34')][_0xb41b('0x38')];}if(_0x3128a7[_0xb41b('0x38')][_0xb41b('0x36')][_0xb41b('0x42')]){return _0x3128a7[_0xb41b('0x38')][_0xb41b('0x36')][0x0];}var _0x571a8c=_[_0xb41b('0x45')](_0x2b0721['body'],{'firstName':_0x2b0721[_0xb41b('0x2e')][_0xb41b('0x46')],'ListId':_0x3128a7[_0xb41b('0x2d')]});_0x571a8c[_0x2b0721[_0xb41b('0x2e')][_0xb41b('0x31')]]=_0x2b0721[_0xb41b('0x2e')][_0xb41b('0x46')];return db['CmContact'][_0xb41b('0x47')](_0x571a8c);}else{throw new Error(_0xb41b('0x48'));}})[_0xb41b('0x22')](function(_0x4ce48e){_0x3a4e31[_0xb41b('0x49')]=_0x4ce48e;if(_0x4ce48e){if(!_0x2b0721[_0xb41b('0x2e')][_0xb41b('0x16')][_0xb41b('0x4a')]){_0x2b0721[_0xb41b('0x2e')][_0xb41b('0x16')][_0xb41b('0x4a')]=rs['generate']()+'\x20'+_0x2b0721['body'][_0xb41b('0x16')][_0xb41b('0x46')];}var _0x50d28c={'ContactId':_0x4ce48e['id'],'MailAccountId':_0x2b0721[_0xb41b('0x34')]['id'],'inReplyTo':_0x2b0721[_0xb41b('0x2e')]['message'][_0xb41b('0x4a')],'to':_0x2b0721[_0xb41b('0x2e')][_0xb41b('0x16')][_0xb41b('0x46')],'cc':_0x2b0721[_0xb41b('0x2e')][_0xb41b('0x16')]['cc'],'subject':_0x2b0721[_0xb41b('0x2e')][_0xb41b('0x16')][_0xb41b('0x4b')],'attach':_0x2b0721[_0xb41b('0x2e')]['message'][_0xb41b('0x4c')],'lastMsgAt':moment()[_0xb41b('0x4d')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x2b0721['body'][_0xb41b('0x2e')]};return db[_0xb41b('0x4e')][_0xb41b('0x24')]({'where':{'closed':![],'MailAccountId':_0x2b0721['account']['id']},'include':[{'model':db[_0xb41b('0x4f')],'as':_0xb41b('0x50'),'attributes':[_0xb41b('0x4a')],'where':{'messageId':_0x2b0721[_0xb41b('0x2e')][_0xb41b('0x16')][_0xb41b('0x51')]}}]})[_0xb41b('0x22')](function(_0x20b91e){if(_0x20b91e){return[_0x20b91e,![]];}return db[_0xb41b('0x4e')][_0xb41b('0x47')](_0x50d28c)['then'](function(_0x44a12e){return[_0x44a12e,!![]];});});}else{throw new Error(_0xb41b('0x52'));}})['spread'](function(_0x2a46ff,_0x32ef07){if(_0x2a46ff){_0x57e043=_0x32ef07;if(!_0x32ef07){return _0x2a46ff[_0xb41b('0x53')]({'inReplyTo':_0x2b0721['body'][_0xb41b('0x16')][_0xb41b('0x4a')],'to':_0x2b0721[_0xb41b('0x2e')][_0xb41b('0x16')][_0xb41b('0x46')],'cc':_0x2b0721[_0xb41b('0x2e')][_0xb41b('0x16')]['cc'],'subject':_0x2b0721[_0xb41b('0x2e')][_0xb41b('0x16')][_0xb41b('0x4b')],'attach':_0x2a46ff['attach']?_0x2a46ff['attach']:_0x2b0721['body']['message'][_0xb41b('0x4c')],'substatus':null,'substatusAt':moment()[_0xb41b('0x4d')](_0xb41b('0x54')),'lastMsgAt':moment()[_0xb41b('0x4d')](_0xb41b('0x54')),'lastMsgDirection':'in','lastMsgBody':_0x2b0721[_0xb41b('0x2e')]['body']});}else{return _0x2a46ff;}}})[_0xb41b('0x22')](function(_0x5e34a2){_0x3a4e31[_0xb41b('0x55')]=_0x5e34a2['get']({'plain':!![]});_0x3a4e31[_0xb41b('0x55')]['created']=_0x57e043;return db[_0xb41b('0x4f')][_0xb41b('0x47')]({'body':_0x2b0721['body'][_0xb41b('0x2e')],'MailAccountId':_0x2b0721[_0xb41b('0x34')]['id'],'MailInteractionId':_0x5e34a2['id'],'direction':'in','ContactId':_0x3a4e31[_0xb41b('0x49')]['id'],'messageId':_0x2b0721[_0xb41b('0x2e')][_0xb41b('0x16')][_0xb41b('0x4a')],'from':_0x2b0721[_0xb41b('0x2e')]['message'][_0xb41b('0x46')],'to':_0x2b0721['body'][_0xb41b('0x16')]['to'],'cc':_0x2b0721[_0xb41b('0x2e')][_0xb41b('0x16')]['cc'],'subject':_0x2b0721['body']['message']['subject'],'attach':_0x2b0721['body'][_0xb41b('0x16')][_0xb41b('0x4c')],'Attachments':_0x2b0721[_0xb41b('0x2e')]['message']['attachments'],'originTo':_0x2b0721[_0xb41b('0x2e')][_0xb41b('0x16')][_0xb41b('0x56')],'originCc':_0x2b0721[_0xb41b('0x2e')][_0xb41b('0x16')][_0xb41b('0x57')],'bcc':_0x2b0721[_0xb41b('0x2e')]['message']['bcc']},{'include':[{'model':db[_0xb41b('0x58')],'as':_0xb41b('0x59')}]});})['then'](function(_0x275e12){_0x3a4e31['message']=_0x275e12;if(_0x3a4e31[_0xb41b('0x55')][_0xb41b('0x5a')]){return db['User'][_0xb41b('0x24')]({'attributes':['id',_0xb41b('0x5b')],'where':{'id':_0x3a4e31['interaction']['UserId']}})[_0xb41b('0x22')](function(_0x17abee){if(_0x17abee){_0x3a4e31['applications'][_0xb41b('0x5c')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x17abee[_0xb41b('0x5b')]+','+(_0x3a4e31[_0xb41b('0x34')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xb41b('0x5d'),_0xb41b('0x5e'),_0x3a4e31);});}return respondWithRpcPromise('Start',_0xb41b('0x5e'),_0x3a4e31);})[_0xb41b('0x22')](function(_0x2ca89b){_0x49e8c4(_0x2ca89b);})['catch'](function(_0x1fb90e){_0x4e0a61(_0x578b67['error'](0x1f4,_0x1fb90e['message']));});});}; \ No newline at end of file +var _0x9649=['code','message','result','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','include','map','model','catch','find','ShowMailAccount','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','account','CmList','List','Contacts','MailApplication','Applications','MailServerOut','omit','list','applications','orderBy','priority','asc','autoclose','push','close','*,*,*,*','length','ListId','List\x20not\x20found','contact','messageId','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inReplyTo','MailInteraction','create','Contact\x20not\x20found','spread','update','subject','interaction','get','created','originTo','bcc','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x242388,_0x28219c){var _0x131e5b=function(_0x4618b4){while(--_0x4618b4){_0x242388['push'](_0x242388['shift']());}};_0x131e5b(++_0x28219c);}(_0x9649,0x118));var _0x9964=function(_0xad578,_0x5700a7){_0xad578=_0xad578-0x0;var _0x513e87=_0x9649[_0xad578];return _0x513e87;};'use strict';var _=require(_0x9964('0x0'));var util=require(_0x9964('0x1'));var moment=require('moment');var BPromise=require(_0x9964('0x2'));var rs=require(_0x9964('0x3'));var fs=require('fs');var Redis=require(_0x9964('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9964('0x5'));var logger=require(_0x9964('0x6'))(_0x9964('0x7'));var config=require(_0x9964('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9964('0x9')]({'port':0x232c});config['redis']=_['defaults'](config[_0x9964('0xa')],{'host':_0x9964('0xb'),'port':0x18eb});var socket=require(_0x9964('0xc'))(new Redis(config['redis']));require(_0x9964('0xd'))[_0x9964('0xe')](socket);function respondWithRpcPromise(_0x29dd6b,_0xc15ae4,_0x59c533){return new BPromise(function(_0xbd5957,_0x5e00cf){return client[_0x9964('0xf')](_0x29dd6b,_0x59c533)[_0x9964('0x10')](function(_0x4e1807){logger[_0x9964('0x11')](_0x9964('0x12'),_0xc15ae4,'request\x20sent');logger[_0x9964('0x13')]('MailAccount,\x20%s,\x20%s,\x20%s',_0xc15ae4,_0x9964('0x14'),JSON[_0x9964('0x15')](_0x4e1807));if(_0x4e1807[_0x9964('0x16')]){if(_0x4e1807[_0x9964('0x16')][_0x9964('0x17')]===0x1f4){logger[_0x9964('0x16')](_0x9964('0x12'),_0xc15ae4,_0x4e1807['error']['message']);return _0x5e00cf(_0x4e1807[_0x9964('0x16')][_0x9964('0x18')]);}logger['error'](_0x9964('0x12'),_0xc15ae4,_0x4e1807[_0x9964('0x16')][_0x9964('0x18')]);return _0xbd5957(_0x4e1807[_0x9964('0x16')][_0x9964('0x18')]);}else{logger[_0x9964('0x11')]('MailAccount,\x20%s,\x20%s',_0xc15ae4,_0x9964('0x14'));_0xbd5957(_0x4e1807[_0x9964('0x19')]['message']);}})['catch'](function(_0x541e4c){logger[_0x9964('0x16')](_0x9964('0x12'),_0xc15ae4,_0x541e4c);_0x5e00cf(_0x541e4c);});});}exports[_0x9964('0x1a')]=function(_0x3661d4){var _0x5bafea=this;return new Promise(function(_0x3813d1,_0x5f2bbd){return db[_0x9964('0x1b')][_0x9964('0x1c')]({'raw':_0x3661d4[_0x9964('0x1d')]?_0x3661d4[_0x9964('0x1d')][_0x9964('0x1e')]===undefined?!![]:![]:!![],'where':_0x3661d4[_0x9964('0x1d')]?_0x3661d4[_0x9964('0x1d')][_0x9964('0x1f')]||null:null,'attributes':_0x3661d4['options']?_0x3661d4[_0x9964('0x1d')][_0x9964('0x20')]||null:null,'limit':_0x3661d4[_0x9964('0x1d')]?_0x3661d4[_0x9964('0x1d')]['limit']||null:null,'include':_0x3661d4[_0x9964('0x1d')]?_0x3661d4[_0x9964('0x1d')][_0x9964('0x21')]?_[_0x9964('0x22')](_0x3661d4['options'][_0x9964('0x21')],function(_0x3911e0){return{'model':db[_0x3911e0[_0x9964('0x23')]],'as':_0x3911e0['as'],'attributes':_0x3911e0[_0x9964('0x20')],'include':_0x3911e0[_0x9964('0x21')]?_[_0x9964('0x22')](_0x3911e0[_0x9964('0x21')],function(_0x33be7b){return{'model':db[_0x33be7b['model']],'as':_0x33be7b['as'],'attributes':_0x33be7b['attributes'],'include':_0x33be7b[_0x9964('0x21')]?_[_0x9964('0x22')](_0x33be7b[_0x9964('0x21')],function(_0x16ec83){return{'model':db[_0x16ec83['model']],'as':_0x16ec83['as'],'attributes':_0x16ec83[_0x9964('0x20')]};}):[]};}):[]};}):[]:[]})[_0x9964('0x10')](function(_0x396054){logger[_0x9964('0x11')](_0x9964('0x1a'),_0x3661d4);logger['debug']('GetMailAccount',_0x3661d4,JSON[_0x9964('0x15')](_0x396054));_0x3813d1(_0x396054);})[_0x9964('0x24')](function(_0x52dbd4){logger['error']('GetMailAccount',_0x52dbd4[_0x9964('0x18')],_0x3661d4);_0x5f2bbd(_0x5bafea[_0x9964('0x16')](0x1f4,_0x52dbd4[_0x9964('0x18')]));});});};exports['ShowMailAccount']=function(_0x322323){var _0x15ff7d=this;return new Promise(function(_0x1876d8,_0x2ed9e0){return db[_0x9964('0x1b')][_0x9964('0x25')]({'raw':_0x322323['options']?_0x322323[_0x9964('0x1d')][_0x9964('0x1e')]===undefined?!![]:![]:!![],'where':_0x322323[_0x9964('0x1d')]?_0x322323['options'][_0x9964('0x1f')]||null:null,'attributes':_0x322323[_0x9964('0x1d')]?_0x322323[_0x9964('0x1d')]['attributes']||null:null,'include':_0x322323[_0x9964('0x1d')]?_0x322323[_0x9964('0x1d')][_0x9964('0x21')]?_[_0x9964('0x22')](_0x322323[_0x9964('0x1d')][_0x9964('0x21')],function(_0x113c6b){return{'model':db[_0x113c6b[_0x9964('0x23')]],'as':_0x113c6b['as'],'attributes':_0x113c6b[_0x9964('0x20')],'include':_0x113c6b[_0x9964('0x21')]?_[_0x9964('0x22')](_0x113c6b[_0x9964('0x21')],function(_0x6ebd06){return{'model':db[_0x6ebd06[_0x9964('0x23')]],'as':_0x6ebd06['as'],'attributes':_0x6ebd06[_0x9964('0x20')],'include':_0x6ebd06[_0x9964('0x21')]?_[_0x9964('0x22')](_0x6ebd06[_0x9964('0x21')],function(_0x539d3d){return{'model':db[_0x539d3d[_0x9964('0x23')]],'as':_0x539d3d['as'],'attributes':_0x539d3d['attributes']};}):[]};}):[]};}):[]:[]})[_0x9964('0x10')](function(_0x42e521){logger['info'](_0x9964('0x26'),_0x322323);logger['debug'](_0x9964('0x26'),_0x322323,JSON[_0x9964('0x15')](_0x42e521));_0x1876d8(_0x42e521);})[_0x9964('0x24')](function(_0x22ebb8){logger[_0x9964('0x16')](_0x9964('0x26'),_0x22ebb8['message'],_0x322323);_0x2ed9e0(_0x15ff7d[_0x9964('0x16')](0x1f4,_0x22ebb8[_0x9964('0x18')]));});});};exports[_0x9964('0x27')]=function(_0x27b3a3){var _0x52d919=this;return new Promise(function(_0x1b3cbe,_0x47bb6e){var _0x2ab34f={'body':_0x27b3a3[_0x9964('0x28')],'channel':_0x9964('0x29')};var _0x2acc2e=_[_0x9964('0x2a')](_[_0x9964('0x2b')](db[_0x9964('0x2c')][_0x9964('0x2d')]),[_0x9964('0x2e'),_0x9964('0x2f'),_0x9964('0x30'),'ListId']);var _0x2a77ce=![];if(_0x27b3a3[_0x9964('0x28')]['id']){delete _0x27b3a3[_0x9964('0x28')]['id'];}if(_[_0x9964('0x31')](_0x27b3a3['body'][_0x9964('0x32')])){return _0x47bb6e(_0x52d919['error'](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x9964('0x31')](_0x27b3a3['body'][_0x9964('0x28')])||_0x27b3a3['body'][_0x9964('0x28')]===''){return _0x47bb6e(_0x52d919[_0x9964('0x16')](0x1f4,_0x9964('0x33')));}if(_['isNil'](_0x27b3a3['body']['mapKey'])){return _0x47bb6e(_0x52d919[_0x9964('0x16')](0x1f4,_0x9964('0x34')+_0x2acc2e));}if(!_['includes'](_0x2acc2e,_0x27b3a3[_0x9964('0x28')][_0x9964('0x35')])){return _0x47bb6e(_0x52d919[_0x9964('0x16')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2acc2e));}var _0x3b988e={};_0x3b988e[_0x27b3a3[_0x9964('0x28')][_0x9964('0x35')]]=_0x27b3a3[_0x9964('0x28')]['from'];return db[_0x9964('0x1b')][_0x9964('0x25')]({'where':{'id':_0x27b3a3[_0x9964('0x36')]['id']},'include':[{'model':db[_0x9964('0x37')],'as':_0x9964('0x38'),'include':[{'model':db['CmContact'],'as':_0x9964('0x39'),'where':_0x3b988e,'limit':0x1,'order':[[_0x9964('0x2f'),'DESC']]}]},{'model':db[_0x9964('0x3a')],'as':_0x9964('0x3b')},{'model':db[_0x9964('0x3c')],'as':'Smtp'}]})[_0x9964('0x10')](function(_0xf37d27){if(_0xf37d27&&_0xf37d27[_0x9964('0x38')]){var _0x169b58=_0xf37d27['get']({'plain':!![]});_0x2ab34f[_0x9964('0x36')]=_[_0x9964('0x3d')](_0x169b58,[_0x9964('0x3b'),_0x9964('0x38')]);_0x2ab34f['applications']=_0x169b58[_0x9964('0x3b')];_0x2ab34f[_0x9964('0x3e')]=_0x169b58[_0x9964('0x38')];_0x2ab34f[_0x9964('0x3f')]=_[_0x9964('0x40')](_0x2ab34f['applications'],[_0x9964('0x41')],[_0x9964('0x42')]);if(_0x2ab34f[_0x9964('0x36')]&&_0x2ab34f[_0x9964('0x36')][_0x9964('0x43')]){_0x2ab34f[_0x9964('0x3f')][_0x9964('0x44')]({'id':0x0,'priority':_0x2ab34f[_0x9964('0x3f')]['length']+0x1,'app':_0x9964('0x45'),'appdata':_0x9964('0x43'),'interval':_0x9964('0x46')});}if(_0x2ab34f[_0x9964('0x36')][_0x9964('0x3b')]){delete _0x2ab34f[_0x9964('0x36')][_0x9964('0x3b')];}if(_0x2ab34f[_0x9964('0x36')]['List']){delete _0x2ab34f[_0x9964('0x36')][_0x9964('0x38')];}if(_0x169b58['List'][_0x9964('0x39')][_0x9964('0x47')]){return _0x169b58['List'][_0x9964('0x39')][0x0];}var _0x49fcd4=_['defaults'](_0x27b3a3[_0x9964('0x28')],{'firstName':_0x27b3a3[_0x9964('0x28')][_0x9964('0x32')],'ListId':_0x169b58[_0x9964('0x48')]});_0x49fcd4[_0x27b3a3[_0x9964('0x28')][_0x9964('0x35')]]=_0x27b3a3[_0x9964('0x28')][_0x9964('0x32')];return db[_0x9964('0x2c')]['create'](_0x49fcd4);}else{throw new Error(_0x9964('0x49'));}})[_0x9964('0x10')](function(_0x15b17e){_0x2ab34f[_0x9964('0x4a')]=_0x15b17e;if(_0x15b17e){if(!_0x27b3a3[_0x9964('0x28')][_0x9964('0x18')]['messageId']){_0x27b3a3[_0x9964('0x28')][_0x9964('0x18')][_0x9964('0x4b')]=rs['generate']()+'\x20'+_0x27b3a3['body'][_0x9964('0x18')]['from'];}var _0x3d8653={'ContactId':_0x15b17e['id'],'MailAccountId':_0x27b3a3['account']['id'],'inReplyTo':_0x27b3a3[_0x9964('0x28')]['message'][_0x9964('0x4b')],'to':_0x27b3a3[_0x9964('0x28')][_0x9964('0x18')][_0x9964('0x32')],'cc':_0x27b3a3['body']['message']['cc'],'subject':_0x27b3a3[_0x9964('0x28')][_0x9964('0x18')]['subject'],'attach':_0x27b3a3[_0x9964('0x28')]['message'][_0x9964('0x4c')],'lastMsgAt':moment()[_0x9964('0x4d')](_0x9964('0x4e')),'lastMsgDirection':'in','lastMsgBody':_0x27b3a3[_0x9964('0x28')][_0x9964('0x28')]};return db['MailInteraction'][_0x9964('0x25')]({'where':{'closed':![],'MailAccountId':_0x27b3a3[_0x9964('0x36')]['id']},'include':[{'model':db[_0x9964('0x4f')],'as':'Messages','attributes':[_0x9964('0x4b')],'where':{'messageId':_0x27b3a3[_0x9964('0x28')]['message'][_0x9964('0x50')]}}]})[_0x9964('0x10')](function(_0x1a4f9e){if(_0x1a4f9e){return[_0x1a4f9e,![]];}return db[_0x9964('0x51')][_0x9964('0x52')](_0x3d8653)['then'](function(_0x3b4b74){return[_0x3b4b74,!![]];});});}else{throw new Error(_0x9964('0x53'));}})[_0x9964('0x54')](function(_0x46ef18,_0x5b86cb){if(_0x46ef18){_0x2a77ce=_0x5b86cb;if(!_0x5b86cb){return _0x46ef18[_0x9964('0x55')]({'inReplyTo':_0x27b3a3[_0x9964('0x28')][_0x9964('0x18')]['messageId'],'to':_0x27b3a3[_0x9964('0x28')][_0x9964('0x18')][_0x9964('0x32')],'cc':_0x27b3a3[_0x9964('0x28')][_0x9964('0x18')]['cc'],'subject':_0x27b3a3[_0x9964('0x28')]['message'][_0x9964('0x56')],'attach':_0x46ef18[_0x9964('0x4c')]?_0x46ef18['attach']:_0x27b3a3['body'][_0x9964('0x18')][_0x9964('0x4c')],'substatus':null,'substatusAt':moment()[_0x9964('0x4d')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()['format'](_0x9964('0x4e')),'lastMsgDirection':'in','lastMsgBody':_0x27b3a3[_0x9964('0x28')][_0x9964('0x28')]});}else{return _0x46ef18;}}})['then'](function(_0x21e264){_0x2ab34f[_0x9964('0x57')]=_0x21e264[_0x9964('0x58')]({'plain':!![]});_0x2ab34f[_0x9964('0x57')][_0x9964('0x59')]=_0x2a77ce;return db[_0x9964('0x4f')][_0x9964('0x52')]({'body':_0x27b3a3['body']['body'],'MailAccountId':_0x27b3a3[_0x9964('0x36')]['id'],'MailInteractionId':_0x21e264['id'],'direction':'in','ContactId':_0x2ab34f[_0x9964('0x4a')]['id'],'messageId':_0x27b3a3[_0x9964('0x28')][_0x9964('0x18')]['messageId'],'from':_0x27b3a3['body']['message'][_0x9964('0x32')],'to':_0x27b3a3['body'][_0x9964('0x18')]['to'],'cc':_0x27b3a3[_0x9964('0x28')]['message']['cc'],'subject':_0x27b3a3[_0x9964('0x28')][_0x9964('0x18')][_0x9964('0x56')],'attach':_0x27b3a3[_0x9964('0x28')][_0x9964('0x18')][_0x9964('0x4c')],'Attachments':_0x27b3a3['body'][_0x9964('0x18')]['attachments'],'originTo':_0x27b3a3[_0x9964('0x28')]['message'][_0x9964('0x5a')],'originCc':_0x27b3a3[_0x9964('0x28')][_0x9964('0x18')]['originCc'],'bcc':_0x27b3a3[_0x9964('0x28')]['message'][_0x9964('0x5b')]},{'include':[{'model':db['Attachment'],'as':_0x9964('0x5c')}]});})[_0x9964('0x10')](function(_0x443dad){_0x2ab34f[_0x9964('0x18')]=_0x443dad;if(_0x2ab34f[_0x9964('0x57')][_0x9964('0x5d')]){return db[_0x9964('0x5e')][_0x9964('0x25')]({'attributes':['id',_0x9964('0x5f')],'where':{'id':_0x2ab34f[_0x9964('0x57')][_0x9964('0x5d')]}})[_0x9964('0x10')](function(_0xcdb731){if(_0xcdb731){_0x2ab34f[_0x9964('0x3f')][_0x9964('0x60')]({'id':0x0,'priority':0x0,'app':_0x9964('0x61'),'appdata':_0xcdb731['name']+','+(_0x2ab34f[_0x9964('0x36')][_0x9964('0x62')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x9964('0x63'),_0x9964('0x64'),_0x2ab34f);});}return respondWithRpcPromise(_0x9964('0x63'),_0x9964('0x64'),_0x2ab34f);})[_0x9964('0x10')](function(_0x16e469){_0x1b3cbe(_0x16e469);})[_0x9964('0x24')](function(_0x3c709f){_0x47bb6e(_0x52d919[_0x9964('0x16')](0x1f4,_0x3c709f['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 3517bf6..82fcb23 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 _0xaa37=['removeListener','register','mailAccount:','./mailAccount.events','save','remove','update','emit'];(function(_0x49a84b,_0x17c1be){var _0x171650=function(_0x1cc9cf){while(--_0x1cc9cf){_0x49a84b['push'](_0x49a84b['shift']());}};_0x171650(++_0x17c1be);}(_0xaa37,0x1d3));var _0x7aa3=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xaa37[_0x53ccf2];return _0x5a2964;};'use strict';var MailAccountEvents=require(_0x7aa3('0x0'));var events=[_0x7aa3('0x1'),_0x7aa3('0x2'),_0x7aa3('0x3')];function createListener(_0x4dcf7a,_0xa0e7e9){return function(_0x27adcf){_0xa0e7e9[_0x7aa3('0x4')](_0x4dcf7a,_0x27adcf);};}function removeListener(_0x11e64c,_0x334919){return function(){MailAccountEvents[_0x7aa3('0x5')](_0x11e64c,_0x334919);};}exports[_0x7aa3('0x6')]=function(_0x5b738a){for(var _0x437b90=0x0,_0xbbcc8a=events['length'];_0x437b90<_0xbbcc8a;_0x437b90++){var _0x100894=events[_0x437b90];var _0x390c82=createListener(_0x7aa3('0x7')+_0x100894,_0x5b738a);MailAccountEvents['on'](_0x100894,_0x390c82);}}; \ No newline at end of file +var _0x1059=['removeListener','length','mailAccount:','./mailAccount.events','save','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1059,0x176));var _0x9105=function(_0x5663c8,_0x3a44af){_0x5663c8=_0x5663c8-0x0;var _0x5a9d1b=_0x1059[_0x5663c8];return _0x5a9d1b;};'use strict';var MailAccountEvents=require(_0x9105('0x0'));var events=[_0x9105('0x1'),'remove',_0x9105('0x2')];function createListener(_0x46ed6a,_0x2592a1){return function(_0x583e67){_0x2592a1[_0x9105('0x3')](_0x46ed6a,_0x583e67);};}function removeListener(_0x59b3db,_0x44878b){return function(){MailAccountEvents[_0x9105('0x4')](_0x59b3db,_0x44878b);};}exports['register']=function(_0x3a0f94){for(var _0x4c573d=0x0,_0x206ebe=events[_0x9105('0x5')];_0x4c573d<_0x206ebe;_0x4c573d++){var _0x49f37f=events[_0x4c573d];var _0x5604f9=createListener(_0x9105('0x6')+_0x49f37f,_0x3a0f94);MailAccountEvents['on'](_0x49f37f,_0x5604f9);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 850f763..b8dafc1 100644 --- a/server/api/mailApplication/index.js +++ b/server/api/mailApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6b20=['util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','multer'];(function(_0x4ac96c,_0x2785d5){var _0x31b35e=function(_0x390915){while(--_0x390915){_0x4ac96c['push'](_0x4ac96c['shift']());}};_0x31b35e(++_0x2785d5);}(_0x6b20,0xd1));var _0x06b2=function(_0x474fe1,_0x312977){_0x474fe1=_0x474fe1-0x0;var _0x3ac2d6=_0x6b20[_0x474fe1];return _0x3ac2d6;};'use strict';var multer=require(_0x06b2('0x0'));var util=require(_0x06b2('0x1'));var path=require('path');var timeout=require(_0x06b2('0x2'));var express=require('express');var router=express[_0x06b2('0x3')]();var auth=require(_0x06b2('0x4'));var interaction=require(_0x06b2('0x5'));var config=require('../../config/environment');var controller=require(_0x06b2('0x6'));router[_0x06b2('0x7')](_0x06b2('0x8'),auth[_0x06b2('0x9')](),controller[_0x06b2('0xa')]);router[_0x06b2('0xb')](_0x06b2('0x8'),auth['isAuthenticated'](),controller[_0x06b2('0xc')]);router[_0x06b2('0xd')](_0x06b2('0x8'),auth['isAuthenticated'](),controller[_0x06b2('0xe')]);module['exports']=router; \ No newline at end of file +var _0xc900=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','exports','path'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xc900,0xb3));var _0x0c90=function(_0x9f9406,_0x4688ca){_0x9f9406=_0x9f9406-0x0;var _0x44ba53=_0xc900[_0x9f9406];return _0x44ba53;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0c90('0x0'));var timeout=require(_0x0c90('0x1'));var express=require(_0x0c90('0x2'));var router=express['Router']();var auth=require(_0x0c90('0x3'));var interaction=require(_0x0c90('0x4'));var config=require('../../config/environment');var controller=require(_0x0c90('0x5'));router[_0x0c90('0x6')](_0x0c90('0x7'),auth[_0x0c90('0x8')](),controller[_0x0c90('0x9')]);router[_0x0c90('0xa')]('/:id',auth[_0x0c90('0x8')](),controller[_0x0c90('0xb')]);router[_0x0c90('0xc')](_0x0c90('0x7'),auth[_0x0c90('0x8')](),controller[_0x0c90('0xd')]);module[_0x0c90('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index bde0f69..7a7e51e 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 _0x4345=['INTEGER','STRING','noop','TEXT','*,*,*,*','exports'];(function(_0x174fae,_0x5d7bad){var _0x5d8970=function(_0x3bfe83){while(--_0x3bfe83){_0x174fae['push'](_0x174fae['shift']());}};_0x5d8970(++_0x5d7bad);}(_0x4345,0x71));var _0x5434=function(_0x33c871,_0x345dc6){_0x33c871=_0x33c871-0x0;var _0x1c083c=_0x4345[_0x33c871];return _0x1c083c;};'use strict';var Sequelize=require('sequelize');module[_0x5434('0x0')]={'priority':{'type':Sequelize[_0x5434('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x5434('0x2')],'allowNull':![],'defaultValue':_0x5434('0x3')},'appdata':{'type':Sequelize[_0x5434('0x4')]()},'description':{'type':Sequelize[_0x5434('0x2')]},'interval':{'type':Sequelize[_0x5434('0x2')],'defaultValue':_0x5434('0x5')}}; \ No newline at end of file +var _0xa979=['*,*,*,*','exports','STRING','noop','TEXT'];(function(_0x2488be,_0x257fc7){var _0xfdbade=function(_0xaf3dba){while(--_0xaf3dba){_0x2488be['push'](_0x2488be['shift']());}};_0xfdbade(++_0x257fc7);}(_0xa979,0x15a));var _0x9a97=function(_0x12e264,_0x4a5b5d){_0x12e264=_0x12e264-0x0;var _0x1a7ad4=_0xa979[_0x12e264];return _0x1a7ad4;};'use strict';var Sequelize=require('sequelize');module[_0x9a97('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x9a97('0x1')],'allowNull':![],'defaultValue':_0x9a97('0x2')},'appdata':{'type':Sequelize[_0x9a97('0x3')]()},'description':{'type':Sequelize[_0x9a97('0x1')]},'interval':{'type':Sequelize[_0x9a97('0x1')],'defaultValue':_0x9a97('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 74e8593..64e5328 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 _0xa66a=['model','attributes','fields','length','includeAll','include','options','MailApplication','find','then','catch','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','stack','name','send','params','keys','rawAttributes','query','filters','intersection'];(function(_0xcb6d64,_0x604e3f){var _0x386710=function(_0x42bd3d){while(--_0x42bd3d){_0xcb6d64['push'](_0xcb6d64['shift']());}};_0x386710(++_0x604e3f);}(_0xa66a,0xf0));var _0xaa66=function(_0x4265ac,_0xe7d35f){_0x4265ac=_0x4265ac-0x0;var _0x35b7ca=_0xa66a[_0x4265ac];return _0x35b7ca;};'use strict';var pdf=require(_0xaa66('0x0'));var emlformat=require(_0xaa66('0x1'));var rimraf=require(_0xaa66('0x2'));var zipdir=require(_0xaa66('0x3'));var jsonpatch=require(_0xaa66('0x4'));var rp=require('request-promise');var moment=require(_0xaa66('0x5'));var BPromise=require(_0xaa66('0x6'));var Mustache=require('mustache');var util=require(_0xaa66('0x7'));var path=require('path');var sox=require(_0xaa66('0x8'));var csv=require('to-csv');var ejs=require(_0xaa66('0x9'));var fs=require('fs');var _=require(_0xaa66('0xa'));var squel=require('squel');var crypto=require(_0xaa66('0xb'));var jsforce=require(_0xaa66('0xc'));var deskjs=require(_0xaa66('0xd'));var toCsv=require(_0xaa66('0xe'));var querystring=require(_0xaa66('0xf'));var Papa=require('papaparse');var Redis=require(_0xaa66('0x10'));var authService=require(_0xaa66('0x11'));var qs=require(_0xaa66('0x12'));var as=require(_0xaa66('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaa66('0x14'))(_0xaa66('0x15'));var utils=require(_0xaa66('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3dbd89,_0x235b58){_0x235b58=_0x235b58||0xcc;return function(_0x24ba45){if(_0x24ba45){return _0x3dbd89[_0xaa66('0x17')](_0x235b58);}return _0x3dbd89[_0xaa66('0x18')](_0x235b58)[_0xaa66('0x19')]();};}function respondWithResult(_0x435a50,_0x3bd064){_0x3bd064=_0x3bd064||0xc8;return function(_0x306123){if(_0x306123){return _0x435a50[_0xaa66('0x18')](_0x3bd064)[_0xaa66('0x1a')](_0x306123);}};}function respondWithFilteredResult(_0x2a931e,_0x1130c4){return function(_0xd7709e){if(_0xd7709e){var _0x5464fe=_0xd7709e[_0xaa66('0x1b')],_0x49b849=_0x1130c4[_0xaa66('0x1c')],_0x1fd44b=_0x1130c4[_0xaa66('0x1c')]+_0x1130c4[_0xaa66('0x1d')],_0x19718f;if(_0x1fd44b>=_0x5464fe){_0x1fd44b=_0x5464fe;_0x19718f=0xc8;}else{_0x19718f=0xce;}_0x2a931e[_0xaa66('0x18')](_0x19718f);return _0x2a931e[_0xaa66('0x1e')](_0xaa66('0x1f'),_0x49b849+'-'+_0x1fd44b+'/'+_0x5464fe)[_0xaa66('0x1a')](_0xd7709e);}return null;};}function patchUpdates(_0x288a7d){return function(_0x5b0928){try{jsonpatch['apply'](_0x5b0928,_0x288a7d,!![]);}catch(_0x55b7c9){return BPromise[_0xaa66('0x20')](_0x55b7c9);}return _0x5b0928[_0xaa66('0x21')]();};}function saveUpdates(_0x263e3e,_0x131f14){return function(_0xfd6aec){if(_0xfd6aec){return _0xfd6aec[_0xaa66('0x22')](_0x263e3e)['then'](function(_0x2ffe5a){return _0x2ffe5a;});}return null;};}function removeEntity(_0xf8176d,_0x269aa1){return function(_0x27402d){if(_0x27402d){return _0x27402d[_0xaa66('0x23')]()['then'](function(){_0xf8176d[_0xaa66('0x18')](0xcc)[_0xaa66('0x19')]();});}};}function handleEntityNotFound(_0xcf141f,_0x5028a2){return function(_0x20cda8){if(!_0x20cda8){_0xcf141f[_0xaa66('0x17')](0x194);}return _0x20cda8;};}function handleError(_0x35784d,_0x3a2bcc){_0x3a2bcc=_0x3a2bcc||0x1f4;return function(_0x2a281d){logger['error'](_0x2a281d[_0xaa66('0x24')]);if(_0x2a281d[_0xaa66('0x25')]){delete _0x2a281d['name'];}_0x35784d[_0xaa66('0x18')](_0x3a2bcc)[_0xaa66('0x26')](_0x2a281d);};}exports['show']=function(_0x31a8e1,_0x2be001){var _0x5ecf3f={'raw':!![],'where':{'id':_0x31a8e1[_0xaa66('0x27')]['id']}},_0x533988={};_0x533988['model']=_[_0xaa66('0x28')](db['MailApplication'][_0xaa66('0x29')]);_0x533988['query']=_[_0xaa66('0x28')](_0x31a8e1[_0xaa66('0x2a')]);_0x533988[_0xaa66('0x2b')]=_[_0xaa66('0x2c')](_0x533988[_0xaa66('0x2d')],_0x533988['query']);_0x5ecf3f[_0xaa66('0x2e')]=_[_0xaa66('0x2c')](_0x533988['model'],qs[_0xaa66('0x2f')](_0x31a8e1[_0xaa66('0x2a')]['fields']));_0x5ecf3f['attributes']=_0x5ecf3f[_0xaa66('0x2e')][_0xaa66('0x30')]?_0x5ecf3f[_0xaa66('0x2e')]:_0x533988['model'];if(_0x31a8e1['query'][_0xaa66('0x31')]){_0x5ecf3f[_0xaa66('0x32')]=[{'all':!![]}];}_0x5ecf3f=_['merge']({},_0x5ecf3f,_0x31a8e1[_0xaa66('0x33')]);return db[_0xaa66('0x34')][_0xaa66('0x35')](_0x5ecf3f)[_0xaa66('0x36')](handleEntityNotFound(_0x2be001,null))[_0xaa66('0x36')](respondWithResult(_0x2be001,null))[_0xaa66('0x37')](handleError(_0x2be001,null));};exports[_0xaa66('0x22')]=function(_0x5e98ff,_0x5e1f47){if(_0x5e98ff[_0xaa66('0x38')]['id']){delete _0x5e98ff['body']['id'];}return db[_0xaa66('0x34')]['find']({'where':{'id':_0x5e98ff[_0xaa66('0x27')]['id']}})[_0xaa66('0x36')](handleEntityNotFound(_0x5e1f47,null))[_0xaa66('0x36')](saveUpdates(_0x5e98ff[_0xaa66('0x38')],null))[_0xaa66('0x36')](respondWithResult(_0x5e1f47,null))['catch'](handleError(_0x5e1f47,null));};exports[_0xaa66('0x23')]=function(_0x2a6bbf,_0x255ea8){return db[_0xaa66('0x34')][_0xaa66('0x35')]({'where':{'id':_0x2a6bbf[_0xaa66('0x27')]['id']}})[_0xaa66('0x36')](handleEntityNotFound(_0x255ea8,null))['then'](removeEntity(_0x255ea8,null))[_0xaa66('0x37')](handleError(_0x255ea8,null));}; \ No newline at end of file +var _0xe1fb=['body','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','then','destroy','error','name','send','show','params','model','keys','MailApplication','rawAttributes','query','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch'];(function(_0xf7ef03,_0x38e9b3){var _0x13df28=function(_0x479729){while(--_0x479729){_0xf7ef03['push'](_0xf7ef03['shift']());}};_0x13df28(++_0x38e9b3);}(_0xe1fb,0x11e));var _0xbe1f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe1fb[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0xbe1f('0x0'));var emlformat=require(_0xbe1f('0x1'));var rimraf=require(_0xbe1f('0x2'));var zipdir=require(_0xbe1f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbe1f('0x4'));var moment=require(_0xbe1f('0x5'));var BPromise=require(_0xbe1f('0x6'));var Mustache=require(_0xbe1f('0x7'));var util=require(_0xbe1f('0x8'));var path=require(_0xbe1f('0x9'));var sox=require(_0xbe1f('0xa'));var csv=require(_0xbe1f('0xb'));var ejs=require(_0xbe1f('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xbe1f('0xd'));var jsforce=require(_0xbe1f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xbe1f('0xb'));var querystring=require(_0xbe1f('0xf'));var Papa=require(_0xbe1f('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbe1f('0x11'));var as=require(_0xbe1f('0x12'));var hardwareService=require(_0xbe1f('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xbe1f('0x14'));var config=require(_0xbe1f('0x15'));var db=require(_0xbe1f('0x16'))['db'];function respondWithStatusCode(_0x2d2122,_0x521c71){_0x521c71=_0x521c71||0xcc;return function(_0x5b5e8d){if(_0x5b5e8d){return _0x2d2122[_0xbe1f('0x17')](_0x521c71);}return _0x2d2122[_0xbe1f('0x18')](_0x521c71)[_0xbe1f('0x19')]();};}function respondWithResult(_0x4c74fd,_0x3e9d55){_0x3e9d55=_0x3e9d55||0xc8;return function(_0x4548e6){if(_0x4548e6){return _0x4c74fd[_0xbe1f('0x18')](_0x3e9d55)[_0xbe1f('0x1a')](_0x4548e6);}};}function respondWithFilteredResult(_0x48a0ff,_0x6c9627){return function(_0x337711){if(_0x337711){var _0x544923=_0x337711[_0xbe1f('0x1b')],_0xae75=_0x6c9627[_0xbe1f('0x1c')],_0x4edacd=_0x6c9627[_0xbe1f('0x1c')]+_0x6c9627['limit'],_0x3b31e4;if(_0x4edacd>=_0x544923){_0x4edacd=_0x544923;_0x3b31e4=0xc8;}else{_0x3b31e4=0xce;}_0x48a0ff['status'](_0x3b31e4);return _0x48a0ff[_0xbe1f('0x1d')](_0xbe1f('0x1e'),_0xae75+'-'+_0x4edacd+'/'+_0x544923)['json'](_0x337711);}return null;};}function patchUpdates(_0xd7ffd2){return function(_0x322480){try{jsonpatch['apply'](_0x322480,_0xd7ffd2,!![]);}catch(_0x11a1da){return BPromise[_0xbe1f('0x1f')](_0x11a1da);}return _0x322480[_0xbe1f('0x20')]();};}function saveUpdates(_0x31e055,_0x1cac42){return function(_0x14c58b){if(_0x14c58b){return _0x14c58b[_0xbe1f('0x21')](_0x31e055)[_0xbe1f('0x22')](function(_0x5ef47c){return _0x5ef47c;});}return null;};}function removeEntity(_0x621df0,_0x462304){return function(_0x570342){if(_0x570342){return _0x570342[_0xbe1f('0x23')]()[_0xbe1f('0x22')](function(){_0x621df0[_0xbe1f('0x18')](0xcc)[_0xbe1f('0x19')]();});}};}function handleEntityNotFound(_0x583acf,_0x591c69){return function(_0x5ae014){if(!_0x5ae014){_0x583acf[_0xbe1f('0x17')](0x194);}return _0x5ae014;};}function handleError(_0x69febd,_0x2bfdd9){_0x2bfdd9=_0x2bfdd9||0x1f4;return function(_0x60969f){logger[_0xbe1f('0x24')](_0x60969f['stack']);if(_0x60969f[_0xbe1f('0x25')]){delete _0x60969f[_0xbe1f('0x25')];}_0x69febd[_0xbe1f('0x18')](_0x2bfdd9)[_0xbe1f('0x26')](_0x60969f);};}exports[_0xbe1f('0x27')]=function(_0x5786f5,_0x3389bc){var _0x2ef3c7={'raw':!![],'where':{'id':_0x5786f5[_0xbe1f('0x28')]['id']}},_0x5c473f={};_0x5c473f[_0xbe1f('0x29')]=_[_0xbe1f('0x2a')](db[_0xbe1f('0x2b')][_0xbe1f('0x2c')]);_0x5c473f[_0xbe1f('0x2d')]=_[_0xbe1f('0x2a')](_0x5786f5['query']);_0x5c473f['filters']=_[_0xbe1f('0x2e')](_0x5c473f[_0xbe1f('0x29')],_0x5c473f['query']);_0x2ef3c7[_0xbe1f('0x2f')]=_[_0xbe1f('0x2e')](_0x5c473f[_0xbe1f('0x29')],qs[_0xbe1f('0x30')](_0x5786f5[_0xbe1f('0x2d')][_0xbe1f('0x30')]));_0x2ef3c7['attributes']=_0x2ef3c7[_0xbe1f('0x2f')][_0xbe1f('0x31')]?_0x2ef3c7[_0xbe1f('0x2f')]:_0x5c473f[_0xbe1f('0x29')];if(_0x5786f5['query'][_0xbe1f('0x32')]){_0x2ef3c7[_0xbe1f('0x33')]=[{'all':!![]}];}_0x2ef3c7=_[_0xbe1f('0x34')]({},_0x2ef3c7,_0x5786f5[_0xbe1f('0x35')]);return db['MailApplication'][_0xbe1f('0x36')](_0x2ef3c7)[_0xbe1f('0x22')](handleEntityNotFound(_0x3389bc,null))[_0xbe1f('0x22')](respondWithResult(_0x3389bc,null))[_0xbe1f('0x37')](handleError(_0x3389bc,null));};exports[_0xbe1f('0x21')]=function(_0x18b25c,_0x50a939){if(_0x18b25c[_0xbe1f('0x38')]['id']){delete _0x18b25c['body']['id'];}return db['MailApplication']['find']({'where':{'id':_0x18b25c[_0xbe1f('0x28')]['id']}})['then'](handleEntityNotFound(_0x50a939,null))[_0xbe1f('0x22')](saveUpdates(_0x18b25c[_0xbe1f('0x38')],null))[_0xbe1f('0x22')](respondWithResult(_0x50a939,null))[_0xbe1f('0x37')](handleError(_0x50a939,null));};exports['destroy']=function(_0x304db8,_0x459b11){return db[_0xbe1f('0x2b')][_0xbe1f('0x36')]({'where':{'id':_0x304db8[_0xbe1f('0x28')]['id']}})[_0xbe1f('0x22')](handleEntityNotFound(_0x459b11,null))['then'](removeEntity(_0x459b11,null))[_0xbe1f('0x37')](handleError(_0x459b11,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index a2961b3..c4cecb3 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 _0x34bd=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','api'];(function(_0x9a138c,_0x2607f8){var _0x3771a3=function(_0x22ebbb){while(--_0x22ebbb){_0x9a138c['push'](_0x9a138c['shift']());}};_0x3771a3(++_0x2607f8);}(_0x34bd,0x1d2));var _0xd34b=function(_0x2a5042,_0x307d04){_0x2a5042=_0x2a5042-0x0;var _0x4bc22f=_0x34bd[_0x2a5042];return _0x4bc22f;};'use strict';var _=require(_0xd34b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd34b('0x1'));var moment=require(_0xd34b('0x2'));var BPromise=require(_0xd34b('0x3'));var rp=require(_0xd34b('0x4'));var fs=require('fs');var path=require(_0xd34b('0x5'));var rimraf=require(_0xd34b('0x6'));var config=require(_0xd34b('0x7'));var attributes=require('./mailApplication.attributes');module[_0xd34b('0x8')]=function(_0x5d161e,_0x4e6e94){return _0x5d161e['define'](_0xd34b('0x9'),attributes,{'tableName':_0xd34b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd34b('0xb'),'collate':_0xd34b('0xc')});}; \ No newline at end of file +var _0xd8d7=['../../config/environment','exports','define','MailApplication','mail_applications','utf8mb4','lodash','util','../../config/logger','api','moment'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0xd8d7,0x1d4));var _0x7d8d=function(_0x1168a1,_0xa0d8c9){_0x1168a1=_0x1168a1-0x0;var _0xcc5ad8=_0xd8d7[_0x1168a1];return _0xcc5ad8;};'use strict';var _=require(_0x7d8d('0x0'));var util=require(_0x7d8d('0x1'));var logger=require(_0x7d8d('0x2'))(_0x7d8d('0x3'));var moment=require(_0x7d8d('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(_0x7d8d('0x5'));var attributes=require('./mailApplication.attributes');module[_0x7d8d('0x6')]=function(_0x35f2b2,_0x1dce79){return _0x35f2b2[_0x7d8d('0x7')](_0x7d8d('0x8'),attributes,{'tableName':_0x7d8d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7d8d('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 4202b8d..491b2c0 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 _0xa23d=['code','MailApplication,\x20%s,\x20%s','message','catch','UpdateMailApplication','MailApplication','options','raw','where','limit','debug','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x80b9b8,_0x2a2163){var _0xb7fe18=function(_0x4db660){while(--_0x4db660){_0x80b9b8['push'](_0x80b9b8['shift']());}};_0xb7fe18(++_0x2a2163);}(_0xa23d,0x1f1));var _0xda23=function(_0x17fbd5,_0x3ff360){_0x17fbd5=_0x17fbd5-0x0;var _0x4c4765=_0xa23d[_0x17fbd5];return _0x4c4765;};'use strict';var _=require('lodash');var util=require(_0xda23('0x0'));var moment=require(_0xda23('0x1'));var BPromise=require(_0xda23('0x2'));var rs=require(_0xda23('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xda23('0x4'));var logger=require(_0xda23('0x5'))(_0xda23('0x6'));var config=require(_0xda23('0x7'));var jayson=require(_0xda23('0x8'));var client=jayson[_0xda23('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x127489,_0x325a28,_0x3fdc87){return new BPromise(function(_0x160163,_0x155eb2){return client[_0xda23('0xa')](_0x127489,_0x3fdc87)['then'](function(_0x3c0275){logger[_0xda23('0xb')]('MailApplication,\x20%s,\x20%s',_0x325a28,_0xda23('0xc'));logger['debug'](_0xda23('0xd'),_0x325a28,_0xda23('0xc'),JSON[_0xda23('0xe')](_0x3c0275));if(_0x3c0275[_0xda23('0xf')]){if(_0x3c0275[_0xda23('0xf')][_0xda23('0x10')]===0x1f4){logger['error'](_0xda23('0x11'),_0x325a28,_0x3c0275['error'][_0xda23('0x12')]);return _0x155eb2(_0x3c0275[_0xda23('0xf')]['message']);}logger[_0xda23('0xf')](_0xda23('0x11'),_0x325a28,_0x3c0275['error']['message']);return _0x160163(_0x3c0275[_0xda23('0xf')][_0xda23('0x12')]);}else{logger[_0xda23('0xb')](_0xda23('0x11'),_0x325a28,'request\x20sent');_0x160163(_0x3c0275['result'][_0xda23('0x12')]);}})[_0xda23('0x13')](function(_0x387d98){logger[_0xda23('0xf')](_0xda23('0x11'),_0x325a28,_0x387d98);_0x155eb2(_0x387d98);});});}exports[_0xda23('0x14')]=function(_0x58e2e0){var _0x37efae=this;return new Promise(function(_0x5f3607,_0x2cf135){return db[_0xda23('0x15')]['update'](_0x58e2e0['body'],{'raw':_0x58e2e0[_0xda23('0x16')]?_0x58e2e0['options'][_0xda23('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58e2e0[_0xda23('0x16')]?_0x58e2e0['options'][_0xda23('0x18')]||null:null,'attributes':_0x58e2e0[_0xda23('0x16')]?_0x58e2e0['options']['attributes']||null:null,'limit':_0x58e2e0[_0xda23('0x16')]?_0x58e2e0[_0xda23('0x16')][_0xda23('0x19')]||null:null})['then'](function(_0x37f1f7){logger[_0xda23('0xb')]('UpdateMailApplication',_0x58e2e0);logger[_0xda23('0x1a')](_0xda23('0x14'),_0x58e2e0,JSON['stringify'](_0x37f1f7));_0x5f3607(_0x37f1f7);})[_0xda23('0x13')](function(_0x264076){logger[_0xda23('0xf')](_0xda23('0x14'),_0x264076[_0xda23('0x12')],_0x58e2e0);_0x2cf135(_0x37efae[_0xda23('0xf')](0x1f4,_0x264076[_0xda23('0x12')]));});});}; \ No newline at end of file +var _0x4a93=['result','catch','UpdateMailApplication','MailApplication','update','options','where','attributes','limit','then','lodash','util','moment','bluebird','randomstring','ioredis','rpc','jayson/promise','client','http','request','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4a93,0xb8));var _0x34a9=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x4a93[_0x1589dd];return _0x1bddd1;};'use strict';var _=require(_0x34a9('0x0'));var util=require(_0x34a9('0x1'));var moment=require(_0x34a9('0x2'));var BPromise=require(_0x34a9('0x3'));var rs=require(_0x34a9('0x4'));var fs=require('fs');var Redis=require(_0x34a9('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x34a9('0x6'));var config=require('../../config/environment');var jayson=require(_0x34a9('0x7'));var client=jayson[_0x34a9('0x8')][_0x34a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1fa3da,_0x585c86,_0x3a7974){return new BPromise(function(_0x537e72,_0x2bfd7e){return client[_0x34a9('0xa')](_0x1fa3da,_0x3a7974)['then'](function(_0x36d7ea){logger[_0x34a9('0xb')](_0x34a9('0xc'),_0x585c86,_0x34a9('0xd'));logger[_0x34a9('0xe')](_0x34a9('0xf'),_0x585c86,_0x34a9('0xd'),JSON[_0x34a9('0x10')](_0x36d7ea));if(_0x36d7ea[_0x34a9('0x11')]){if(_0x36d7ea[_0x34a9('0x11')]['code']===0x1f4){logger[_0x34a9('0x11')](_0x34a9('0xc'),_0x585c86,_0x36d7ea[_0x34a9('0x11')]['message']);return _0x2bfd7e(_0x36d7ea[_0x34a9('0x11')]['message']);}logger['error'](_0x34a9('0xc'),_0x585c86,_0x36d7ea['error'][_0x34a9('0x12')]);return _0x537e72(_0x36d7ea[_0x34a9('0x11')][_0x34a9('0x12')]);}else{logger[_0x34a9('0xb')](_0x34a9('0xc'),_0x585c86,'request\x20sent');_0x537e72(_0x36d7ea[_0x34a9('0x13')][_0x34a9('0x12')]);}})[_0x34a9('0x14')](function(_0x568069){logger['error']('MailApplication,\x20%s,\x20%s',_0x585c86,_0x568069);_0x2bfd7e(_0x568069);});});}exports[_0x34a9('0x15')]=function(_0x560c8b){var _0x9a0871=this;return new Promise(function(_0x359da9,_0x22d636){return db[_0x34a9('0x16')][_0x34a9('0x17')](_0x560c8b['body'],{'raw':_0x560c8b[_0x34a9('0x18')]?_0x560c8b[_0x34a9('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x560c8b[_0x34a9('0x18')]?_0x560c8b['options'][_0x34a9('0x19')]||null:null,'attributes':_0x560c8b[_0x34a9('0x18')]?_0x560c8b[_0x34a9('0x18')][_0x34a9('0x1a')]||null:null,'limit':_0x560c8b[_0x34a9('0x18')]?_0x560c8b['options'][_0x34a9('0x1b')]||null:null})[_0x34a9('0x1c')](function(_0x553d57){logger[_0x34a9('0xb')](_0x34a9('0x15'),_0x560c8b);logger[_0x34a9('0xe')](_0x34a9('0x15'),_0x560c8b,JSON['stringify'](_0x553d57));_0x359da9(_0x553d57);})[_0x34a9('0x14')](function(_0x316fc6){logger['error'](_0x34a9('0x15'),_0x316fc6['message'],_0x560c8b);_0x22d636(_0x9a0871['error'](0x1f4,_0x316fc6['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 19d8376..02be825 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 _0x3d7b=['path','connect-timeout','express','Router','../../components/auth/service','./mailInteraction.controller','get','isAuthenticated','index','describe','/:id','getMessages','/:id/download','post','/:id/messages','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update','mailinteraction:destroy','delete','exports','multer','util'];(function(_0xc5e02a,_0xd9da3c){var _0xbeca77=function(_0x2a7d11){while(--_0x2a7d11){_0xc5e02a['push'](_0xc5e02a['shift']());}};_0xbeca77(++_0xd9da3c);}(_0x3d7b,0x1a2));var _0xb3d7=function(_0x4f7a4f,_0x3c68cf){_0x4f7a4f=_0x4f7a4f-0x0;var _0x41789d=_0x3d7b[_0x4f7a4f];return _0x41789d;};'use strict';var multer=require(_0xb3d7('0x0'));var util=require(_0xb3d7('0x1'));var path=require(_0xb3d7('0x2'));var timeout=require(_0xb3d7('0x3'));var express=require(_0xb3d7('0x4'));var router=express[_0xb3d7('0x5')]();var auth=require(_0xb3d7('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb3d7('0x7'));router[_0xb3d7('0x8')]('/',auth[_0xb3d7('0x9')](),controller[_0xb3d7('0xa')]);router[_0xb3d7('0x8')]('/describe',auth[_0xb3d7('0x9')](),controller[_0xb3d7('0xb')]);router['get'](_0xb3d7('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xb3d7('0x8')]('/:id/messages',auth[_0xb3d7('0x9')](),controller[_0xb3d7('0xd')]);router[_0xb3d7('0x8')](_0xb3d7('0xe'),auth['isAuthenticated'](),controller['download']);router[_0xb3d7('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb3d7('0xf')](_0xb3d7('0x10'),auth[_0xb3d7('0x9')](),controller['addMessage']);router['post'](_0xb3d7('0x11'),auth['isAuthenticated'](),interaction[_0xb3d7('0x12')](_0xb3d7('0x13'),_0xb3d7('0x14')),controller[_0xb3d7('0x15')]);router[_0xb3d7('0x16')](_0xb3d7('0xc'),auth[_0xb3d7('0x9')](),interaction['tracked'](_0xb3d7('0x13'),_0xb3d7('0x17')),controller[_0xb3d7('0x18')]);router['delete']('/:id',auth[_0xb3d7('0x9')](),interaction[_0xb3d7('0x12')]('mail',_0xb3d7('0x19')),controller['destroy']);router[_0xb3d7('0x1a')](_0xb3d7('0x11'),auth[_0xb3d7('0x9')](),controller['removeTags']);module[_0xb3d7('0x1b')]=router; \ No newline at end of file +var _0x33cf=['/:id','/:id/messages','getMessages','/:id/download','isAuthenticated','download','post','create','/:id/tags','mailinteraction:addtags','addTags','put','mail','mailinteraction:update','update','delete','tracked','mailinteraction:destroy','removeTags','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','index','describe'];(function(_0x2714ec,_0x36daa4){var _0x2608e5=function(_0x408468){while(--_0x408468){_0x2714ec['push'](_0x2714ec['shift']());}};_0x2608e5(++_0x36daa4);}(_0x33cf,0x14a));var _0xf33c=function(_0x5af974,_0x459dff){_0x5af974=_0x5af974-0x0;var _0x808a3a=_0x33cf[_0x5af974];return _0x808a3a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf33c('0x0'));var timeout=require(_0xf33c('0x1'));var express=require(_0xf33c('0x2'));var router=express[_0xf33c('0x3')]();var auth=require(_0xf33c('0x4'));var interaction=require(_0xf33c('0x5'));var config=require(_0xf33c('0x6'));var controller=require(_0xf33c('0x7'));router[_0xf33c('0x8')]('/',auth['isAuthenticated'](),controller[_0xf33c('0x9')]);router[_0xf33c('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xf33c('0xa')]);router['get'](_0xf33c('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xf33c('0x8')](_0xf33c('0xc'),auth['isAuthenticated'](),controller[_0xf33c('0xd')]);router[_0xf33c('0x8')](_0xf33c('0xe'),auth[_0xf33c('0xf')](),controller[_0xf33c('0x10')]);router[_0xf33c('0x11')]('/',auth[_0xf33c('0xf')](),controller[_0xf33c('0x12')]);router[_0xf33c('0x11')]('/:id/messages',auth[_0xf33c('0xf')](),controller['addMessage']);router['post'](_0xf33c('0x13'),auth['isAuthenticated'](),interaction['tracked']('mail',_0xf33c('0x14')),controller[_0xf33c('0x15')]);router[_0xf33c('0x16')](_0xf33c('0xb'),auth[_0xf33c('0xf')](),interaction['tracked'](_0xf33c('0x17'),_0xf33c('0x18')),controller[_0xf33c('0x19')]);router[_0xf33c('0x1a')](_0xf33c('0xb'),auth[_0xf33c('0xf')](),interaction[_0xf33c('0x1b')](_0xf33c('0x17'),_0xf33c('0x1c')),controller['destroy']);router[_0xf33c('0x1a')](_0xf33c('0x13'),auth[_0xf33c('0xf')](),controller[_0xf33c('0x1d')]);module[_0xf33c('0x1e')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index ba5bb5c..b0091b8 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 _0x69d2=['BOOLEAN','out','ENUM','sequelize','iconv','exports','DATE','STRING','TEXT','long'];(function(_0x3e4c1c,_0x2daacb){var _0x4bc948=function(_0x17fd7f){while(--_0x17fd7f){_0x3e4c1c['push'](_0x3e4c1c['shift']());}};_0x4bc948(++_0x2daacb);}(_0x69d2,0x1d9));var _0x269d=function(_0x59c6da,_0x215c8d){_0x59c6da=_0x59c6da-0x0;var _0x233650=_0x69d2[_0x59c6da];return _0x233650;};'use strict';var Sequelize=require(_0x269d('0x0'));var iconv=require(_0x269d('0x1'));module[_0x269d('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x269d('0x3')]},'disposition':{'type':Sequelize[_0x269d('0x4')]},'note':{'type':Sequelize[_0x269d('0x4')]},'inReplyTo':{'type':Sequelize[_0x269d('0x4')](0x1fe)},'to':{'type':Sequelize[_0x269d('0x4')]},'cc':{'type':Sequelize[_0x269d('0x5')](_0x269d('0x6'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x269d('0x7')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x269d('0x3')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x269d('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x269d('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x269d('0x9')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x269d('0x5')]('long')},'lastMsgText':{'type':Sequelize[_0x269d('0x5')](_0x269d('0x6'))}}; \ No newline at end of file +var _0x5817=['DATE','STRING','TEXT','long','ENUM','out','sequelize','iconv','exports','BOOLEAN'];(function(_0x55075d,_0x5c4d62){var _0x3c1c0a=function(_0x24218d){while(--_0x24218d){_0x55075d['push'](_0x55075d['shift']());}};_0x3c1c0a(++_0x5c4d62);}(_0x5817,0x9c));var _0x7581=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x5817[_0x160c73];return _0xd9302;};'use strict';var Sequelize=require(_0x7581('0x0'));var iconv=require(_0x7581('0x1'));module[_0x7581('0x2')]={'closed':{'type':Sequelize[_0x7581('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7581('0x4')]},'disposition':{'type':Sequelize[_0x7581('0x5')]},'note':{'type':Sequelize[_0x7581('0x5')]},'inReplyTo':{'type':Sequelize[_0x7581('0x5')](0x1fe)},'to':{'type':Sequelize[_0x7581('0x5')]},'cc':{'type':Sequelize[_0x7581('0x6')](_0x7581('0x7'))},'subject':{'type':Sequelize[_0x7581('0x6')]()},'attach':{'type':Sequelize[_0x7581('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x7581('0x4')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x7581('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x7581('0x8')]('in',_0x7581('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7581('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x7581('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x7581('0x6')](_0x7581('0x7'))},'lastMsgText':{'type':Sequelize[_0x7581('0x6')]('long')}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index c3f2765..7b5be58 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(_0x584ec2,_0x25e4df){var _0x695be7=function(_0x3a90b0){while(--_0x3a90b0){_0x584ec2['push'](_0x584ec2['shift']());}};_0x695be7(++_0x25e4df);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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(_0x5ed70a,_0x2edbcc){var _0x48674f=function(_0x371f6b){while(--_0x371f6b){_0x5ed70a['push'](_0x5ed70a['shift']());}};_0x48674f(++_0x2edbcc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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 cf467da..b68ef5d 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 _0x2d40=['then','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','MailMessage','setMaxListeners','update','remove','getUsers','setDataValue','Users'];(function(_0x40f340,_0x167f80){var _0x2538c5=function(_0x267585){while(--_0x267585){_0x40f340['push'](_0x40f340['shift']());}};_0x2538c5(++_0x167f80);}(_0x2d40,0xb7));var _0x02d4=function(_0x7e3b45,_0x29c4c7){_0x7e3b45=_0x7e3b45-0x0;var _0x150ad6=_0x2d40[_0x7e3b45];return _0x150ad6;};'use strict';var EventEmitter=require(_0x02d4('0x0'));var MailInteraction=require(_0x02d4('0x1'))['db']['MailInteraction'];var MailMessage=require(_0x02d4('0x1'))['db'][_0x02d4('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x02d4('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x02d4('0x4'),'afterDestroy':_0x02d4('0x5')};function emitEvent(_0x2bd472){return function(_0x2570b5,_0x4c477c,_0x793662){_0x2570b5[_0x02d4('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1d2b89){_0x2570b5[_0x02d4('0x7')](_0x02d4('0x8'),_0x1d2b89['map'](function(_0x34b714){return{'id':_0x34b714['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x2570b5['id'],'direction':'in','read':![]},'raw':!![]});})[_0x02d4('0x9')](function(_0x30a93f){_0x2570b5[_0x02d4('0x7')](_0x02d4('0xa'),_0x30a93f[_0x02d4('0xb')]);MailInteractionEvents[_0x02d4('0xc')](_0x2bd472+':'+_0x2570b5['id'],_0x2570b5);MailInteractionEvents[_0x02d4('0xc')](_0x2bd472,_0x2570b5);_0x793662(null);})[_0x02d4('0xd')](_0x793662(null));};}for(var e in events){if(events[_0x02d4('0xe')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x02d4('0xf')]=MailInteractionEvents; \ No newline at end of file +var _0xb0be=['catch','hasOwnProperty','hook','exports','MailInteraction','MailMessage','setMaxListeners','save','update','remove','getUsers','then','map','findAll','length','emit'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xb0be,0x64));var _0xeb0b=function(_0x913af0,_0xf67d98){_0x913af0=_0x913af0-0x0;var _0x466696=_0xb0be[_0x913af0];return _0x466696;};'use strict';var EventEmitter=require('events');var MailInteraction=require('../../mysqldb')['db'][_0xeb0b('0x0')];var MailMessage=require('../../mysqldb')['db'][_0xeb0b('0x1')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xeb0b('0x2')](0x0);var events={'afterCreate':_0xeb0b('0x3'),'afterUpdate':_0xeb0b('0x4'),'afterDestroy':_0xeb0b('0x5')};function emitEvent(_0x150124){return function(_0x165e4a,_0x4557da,_0x4248c3){_0x165e4a[_0xeb0b('0x6')]({'attributes':['id'],'raw':!![]})[_0xeb0b('0x7')](function(_0x16abb5){_0x165e4a['setDataValue']('Users',_0x16abb5[_0xeb0b('0x8')](function(_0x19fb2f){return{'id':_0x19fb2f['id']};}));return MailMessage[_0xeb0b('0x9')]({'where':{'MailInteractionId':_0x165e4a['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5ec3ff){_0x165e4a['setDataValue']('unreadMessages',_0x5ec3ff[_0xeb0b('0xa')]);MailInteractionEvents[_0xeb0b('0xb')](_0x150124+':'+_0x165e4a['id'],_0x165e4a);MailInteractionEvents['emit'](_0x150124,_0x165e4a);_0x4248c3(null);})[_0xeb0b('0xc')](_0x4248c3(null));};}for(var e in events){if(events[_0xeb0b('0xd')](e)){var event=events[e];MailInteraction[_0xeb0b('0xe')](e,emitEvent(event));}}module[_0xeb0b('0xf')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 49caa13..50d9f3b 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 _0xb7f1=['update','then','catch','utf8mb4_unicode_ci','../../config/logger','api','moment','request-promise','../../config/environment','./mailInteraction.attributes','define','MailInteraction','mail_interactions','subject','FULLTEXT','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','format','changed','closed','closedAt','models','MailMessage'];(function(_0x25067a,_0x10cebe){var _0x4b1db7=function(_0x5ca373){while(--_0x5ca373){_0x25067a['push'](_0x25067a['shift']());}};_0x4b1db7(++_0x10cebe);}(_0xb7f1,0xdc));var _0x1b7f=function(_0x4d0e98,_0x1a2e6d){_0x4d0e98=_0x4d0e98-0x0;var _0x23548a=_0xb7f1[_0x4d0e98];return _0x23548a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1b7f('0x0'))(_0x1b7f('0x1'));var moment=require(_0x1b7f('0x2'));var BPromise=require('bluebird');var rp=require(_0x1b7f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1b7f('0x4'));var attributes=require(_0x1b7f('0x5'));module['exports']=function(_0x45f084,_0x3882a7){return _0x45f084[_0x1b7f('0x6')](_0x1b7f('0x7'),attributes,{'tableName':_0x1b7f('0x8'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x1b7f('0x9'),'to'],'type':_0x1b7f('0xa')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x32ba46,_0x1ee997,_0x330582){if(_0x32ba46[_0x1b7f('0xb')]){_0x32ba46[_0x1b7f('0xc')]=moment()['format'](_0x1b7f('0xd'));}if(_0x32ba46['closed']){_0x32ba46['closedAt']=moment()[_0x1b7f('0xe')](_0x1b7f('0xd'));}_0x330582(null,_0x1ee997);},'beforeUpdate':function(_0x2477a3,_0x2226d5,_0x308743){if(_0x2477a3[_0x1b7f('0xf')]('substatus')){_0x2477a3[_0x1b7f('0xc')]=_0x2477a3[_0x1b7f('0xb')]?moment()[_0x1b7f('0xe')](_0x1b7f('0xd')):null;}if(_0x2477a3[_0x1b7f('0xf')](_0x1b7f('0x10'))){_0x2477a3[_0x1b7f('0x11')]=moment()[_0x1b7f('0xe')]('YYYY-MM-DD\x20HH:mm:ss');_0x2477a3['substatus']=null;_0x2477a3[_0x1b7f('0xc')]=null;}_0x308743(null,_0x2477a3);},'afterUpdate':function(_0x389ff7,_0x5d7b55,_0x17afcf){var _0x45735f=_0x45f084[_0x1b7f('0x12')];var _0x3d5922=_0x389ff7['get']({'plain':!![]});if(_0x3d5922[_0x1b7f('0x10')]){return _0x45735f[_0x1b7f('0x13')][_0x1b7f('0x14')]({'read':!![]},{'where':{'MailInteractionId':_0x3d5922['id']}})[_0x1b7f('0x15')](function(){_0x17afcf();})[_0x1b7f('0x16')](function(_0x386386){_0x17afcf(_0x386386);});}else{_0x17afcf();}}},'charset':'utf8mb4','collate':_0x1b7f('0x17')});}; \ No newline at end of file +var _0x5eb1=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','update','then','utf8mb4','util'];(function(_0x29eed1,_0x5e3560){var _0x496164=function(_0x1b23ac){while(--_0x1b23ac){_0x29eed1['push'](_0x29eed1['shift']());}};_0x496164(++_0x5e3560);}(_0x5eb1,0x7c));var _0x15eb=function(_0x5c1930,_0x1b15e7){_0x5c1930=_0x5c1930-0x0;var _0x163a34=_0x5eb1[_0x5c1930];return _0x163a34;};'use strict';var _=require('lodash');var util=require(_0x15eb('0x0'));var logger=require(_0x15eb('0x1'))(_0x15eb('0x2'));var moment=require(_0x15eb('0x3'));var BPromise=require(_0x15eb('0x4'));var rp=require(_0x15eb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x15eb('0x6'));var config=require(_0x15eb('0x7'));var attributes=require(_0x15eb('0x8'));module[_0x15eb('0x9')]=function(_0x47e341,_0x1be042){return _0x47e341[_0x15eb('0xa')]('MailInteraction',attributes,{'tableName':_0x15eb('0xb'),'paranoid':![],'indexes':[{'name':_0x15eb('0xc'),'fields':[_0x15eb('0xd'),'to'],'type':_0x15eb('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2c144a,_0x2ad2c1,_0x412db6){if(_0x2c144a[_0x15eb('0xf')]){_0x2c144a[_0x15eb('0x10')]=moment()[_0x15eb('0x11')](_0x15eb('0x12'));}if(_0x2c144a[_0x15eb('0x13')]){_0x2c144a[_0x15eb('0x14')]=moment()['format'](_0x15eb('0x12'));}_0x412db6(null,_0x2ad2c1);},'beforeUpdate':function(_0x4c814c,_0x5e678a,_0x498a0c){if(_0x4c814c[_0x15eb('0x15')](_0x15eb('0xf'))){_0x4c814c[_0x15eb('0x10')]=_0x4c814c[_0x15eb('0xf')]?moment()['format'](_0x15eb('0x12')):null;}if(_0x4c814c[_0x15eb('0x15')](_0x15eb('0x13'))){_0x4c814c[_0x15eb('0x14')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4c814c['substatus']=null;_0x4c814c['substatusAt']=null;}_0x498a0c(null,_0x4c814c);},'afterUpdate':function(_0x1188e0,_0x52223c,_0x53efa1){var _0x3a78e9=_0x47e341['models'];var _0x2b898c=_0x1188e0['get']({'plain':!![]});if(_0x2b898c[_0x15eb('0x13')]){return _0x3a78e9['MailMessage'][_0x15eb('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x2b898c['id']}})[_0x15eb('0x17')](function(){_0x53efa1();})['catch'](function(_0xa1def8){_0x53efa1(_0xa1def8);});}else{_0x53efa1();}}},'charset':_0x15eb('0x18'),'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 5012aab..f431623 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 _0x1789=['then','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','MailInteraction,\x20%s,\x20%s','message','info','request\x20sent','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','AddTagsToMailInteraction','find','addTags','ids','omit','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','socket.io-emitter'];(function(_0xd204b0,_0x4c7d1d){var _0xfc8310=function(_0x4f4b5a){while(--_0x4f4b5a){_0xd204b0['push'](_0xd204b0['shift']());}};_0xfc8310(++_0x4c7d1d);}(_0x1789,0x92));var _0x9178=function(_0x5b73ff,_0x1cba4d){_0x5b73ff=_0x5b73ff-0x0;var _0x1c4ba4=_0x1789[_0x5b73ff];return _0x1c4ba4;};'use strict';var _=require(_0x9178('0x0'));var util=require(_0x9178('0x1'));var moment=require(_0x9178('0x2'));var BPromise=require('bluebird');var rs=require(_0x9178('0x3'));var fs=require('fs');var Redis=require(_0x9178('0x4'));var db=require(_0x9178('0x5'))['db'];var utils=require(_0x9178('0x6'));var logger=require(_0x9178('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9178('0x8'));var client=jayson[_0x9178('0x9')][_0x9178('0xa')]({'port':0x232a});config[_0x9178('0xb')]=_['defaults'](config[_0x9178('0xb')],{'host':_0x9178('0xc'),'port':0x18eb});var socket=require(_0x9178('0xd'))(new Redis(config[_0x9178('0xb')]));require('./mailInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x537261,_0xdd2085,_0x320615){return new BPromise(function(_0x49efc8,_0x27f968){return client['request'](_0x537261,_0x320615)[_0x9178('0xe')](function(_0x80d440){logger['info']('MailInteraction,\x20%s,\x20%s',_0xdd2085,'request\x20sent');logger[_0x9178('0xf')](_0x9178('0x10'),_0xdd2085,'request\x20sent',JSON[_0x9178('0x11')](_0x80d440));if(_0x80d440[_0x9178('0x12')]){if(_0x80d440[_0x9178('0x12')]['code']===0x1f4){logger[_0x9178('0x12')](_0x9178('0x13'),_0xdd2085,_0x80d440['error'][_0x9178('0x14')]);return _0x27f968(_0x80d440['error'][_0x9178('0x14')]);}logger[_0x9178('0x12')](_0x9178('0x13'),_0xdd2085,_0x80d440[_0x9178('0x12')][_0x9178('0x14')]);return _0x49efc8(_0x80d440[_0x9178('0x12')][_0x9178('0x14')]);}else{logger[_0x9178('0x15')](_0x9178('0x13'),_0xdd2085,_0x9178('0x16'));_0x49efc8(_0x80d440[_0x9178('0x17')][_0x9178('0x14')]);}})[_0x9178('0x18')](function(_0x30c430){logger['error'](_0x9178('0x13'),_0xdd2085,_0x30c430);_0x27f968(_0x30c430);});});}exports[_0x9178('0x19')]=function(_0x567e52){var _0x384b48=this;return new Promise(function(_0x59b1d2,_0x94c136){return db[_0x9178('0x1a')][_0x9178('0x1b')](_0x567e52[_0x9178('0x1c')],{'raw':_0x567e52[_0x9178('0x1d')]?_0x567e52[_0x9178('0x1d')][_0x9178('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x567e52[_0x9178('0x1d')]?_0x567e52['options'][_0x9178('0x1f')]||null:null,'attributes':_0x567e52['options']?_0x567e52['options'][_0x9178('0x20')]||null:null,'limit':_0x567e52[_0x9178('0x1d')]?_0x567e52[_0x9178('0x1d')][_0x9178('0x21')]||null:null})[_0x9178('0xe')](function(_0x2e2723){logger[_0x9178('0x15')](_0x9178('0x19'),_0x567e52);logger[_0x9178('0xf')](_0x9178('0x19'),_0x567e52,JSON[_0x9178('0x11')](_0x2e2723));_0x59b1d2(_0x2e2723);})[_0x9178('0x18')](function(_0x3dccbf){logger[_0x9178('0x12')]('UpdateMailInteraction',_0x3dccbf[_0x9178('0x14')],_0x567e52);_0x94c136(_0x384b48[_0x9178('0x12')](0x1f4,_0x3dccbf['message']));});});};exports[_0x9178('0x22')]=function(_0x14fa42){return new Promise(function(_0x39d309,_0x2b977b){return db[_0x9178('0x1a')][_0x9178('0x23')]({'where':_0x14fa42['options']?_0x14fa42[_0x9178('0x1d')][_0x9178('0x1f')]||null:null})['then'](function(_0x20263c){if(_0x20263c){return _0x20263c[_0x9178('0x24')](_0x14fa42[_0x9178('0x1c')][_0x9178('0x25')],_[_0x9178('0x26')](_0x14fa42[_0x9178('0x1c')],[_0x9178('0x25'),'id'])||{});}})['spread'](function(_0x159900){logger['info'](_0x9178('0x27'),_0x14fa42);logger[_0x9178('0xf')]('AddTags',_0x14fa42,JSON[_0x9178('0x11')](_0x159900));_0x39d309(_0x159900);})[_0x9178('0x18')](function(_0x1e26c1){logger[_0x9178('0x12')]('AddTags',_0x1e26c1[_0x9178('0x14')],_0x14fa42);_0x2b977b(_this[_0x9178('0x12')](0x1f4,_0x1e26c1[_0x9178('0x14')]));});});}; \ No newline at end of file +var _0x3098=['MailInteraction','update','options','raw','where','attributes','AddTagsToMailInteraction','find','addTags','body','ids','spread','AddTags','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateMailInteraction'];(function(_0x2228c2,_0x49e116){var _0x24b1ca=function(_0x44357d){while(--_0x44357d){_0x2228c2['push'](_0x2228c2['shift']());}};_0x24b1ca(++_0x49e116);}(_0x3098,0x86));var _0x8309=function(_0x37ae26,_0x2ecd70){_0x37ae26=_0x37ae26-0x0;var _0x1b1902=_0x3098[_0x37ae26];return _0x1b1902;};'use strict';var _=require(_0x8309('0x0'));var util=require(_0x8309('0x1'));var moment=require(_0x8309('0x2'));var BPromise=require(_0x8309('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8309('0x4'));var db=require(_0x8309('0x5'))['db'];var utils=require(_0x8309('0x6'));var logger=require(_0x8309('0x7'))(_0x8309('0x8'));var config=require(_0x8309('0x9'));var jayson=require(_0x8309('0xa'));var client=jayson[_0x8309('0xb')][_0x8309('0xc')]({'port':0x232a});config[_0x8309('0xd')]=_['defaults'](config[_0x8309('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x8309('0xe'))(new Redis(config[_0x8309('0xd')]));require('./mailInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x13a19f,_0x21b2f1,_0x12d5c9){return new BPromise(function(_0x302195,_0x5d383a){return client['request'](_0x13a19f,_0x12d5c9)[_0x8309('0xf')](function(_0x1cc2fa){logger[_0x8309('0x10')](_0x8309('0x11'),_0x21b2f1,_0x8309('0x12'));logger['debug'](_0x8309('0x13'),_0x21b2f1,'request\x20sent',JSON[_0x8309('0x14')](_0x1cc2fa));if(_0x1cc2fa['error']){if(_0x1cc2fa[_0x8309('0x15')][_0x8309('0x16')]===0x1f4){logger[_0x8309('0x15')](_0x8309('0x11'),_0x21b2f1,_0x1cc2fa[_0x8309('0x15')][_0x8309('0x17')]);return _0x5d383a(_0x1cc2fa[_0x8309('0x15')]['message']);}logger['error'](_0x8309('0x11'),_0x21b2f1,_0x1cc2fa[_0x8309('0x15')][_0x8309('0x17')]);return _0x302195(_0x1cc2fa[_0x8309('0x15')][_0x8309('0x17')]);}else{logger[_0x8309('0x10')](_0x8309('0x11'),_0x21b2f1,_0x8309('0x12'));_0x302195(_0x1cc2fa['result'][_0x8309('0x17')]);}})[_0x8309('0x18')](function(_0x265a03){logger[_0x8309('0x15')](_0x8309('0x11'),_0x21b2f1,_0x265a03);_0x5d383a(_0x265a03);});});}exports[_0x8309('0x19')]=function(_0x1d4ece){var _0x158aec=this;return new Promise(function(_0x181ed6,_0x415490){return db[_0x8309('0x1a')][_0x8309('0x1b')](_0x1d4ece['body'],{'raw':_0x1d4ece['options']?_0x1d4ece[_0x8309('0x1c')][_0x8309('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d4ece[_0x8309('0x1c')]?_0x1d4ece[_0x8309('0x1c')][_0x8309('0x1e')]||null:null,'attributes':_0x1d4ece[_0x8309('0x1c')]?_0x1d4ece['options'][_0x8309('0x1f')]||null:null,'limit':_0x1d4ece[_0x8309('0x1c')]?_0x1d4ece[_0x8309('0x1c')]['limit']||null:null})[_0x8309('0xf')](function(_0x35c0e6){logger['info'](_0x8309('0x19'),_0x1d4ece);logger['debug'](_0x8309('0x19'),_0x1d4ece,JSON['stringify'](_0x35c0e6));_0x181ed6(_0x35c0e6);})[_0x8309('0x18')](function(_0x1ce264){logger[_0x8309('0x15')](_0x8309('0x19'),_0x1ce264['message'],_0x1d4ece);_0x415490(_0x158aec[_0x8309('0x15')](0x1f4,_0x1ce264[_0x8309('0x17')]));});});};exports[_0x8309('0x20')]=function(_0x5f2f68){return new Promise(function(_0xbed74d,_0x573fcd){return db[_0x8309('0x1a')][_0x8309('0x21')]({'where':_0x5f2f68[_0x8309('0x1c')]?_0x5f2f68[_0x8309('0x1c')][_0x8309('0x1e')]||null:null})[_0x8309('0xf')](function(_0x3340f4){if(_0x3340f4){return _0x3340f4[_0x8309('0x22')](_0x5f2f68[_0x8309('0x23')]['ids'],_['omit'](_0x5f2f68[_0x8309('0x23')],[_0x8309('0x24'),'id'])||{});}})[_0x8309('0x25')](function(_0x2d7dd8){logger[_0x8309('0x10')](_0x8309('0x26'),_0x5f2f68);logger[_0x8309('0x27')]('AddTags',_0x5f2f68,JSON[_0x8309('0x14')](_0x2d7dd8));_0xbed74d(_0x2d7dd8);})[_0x8309('0x18')](function(_0x278e42){logger[_0x8309('0x15')](_0x8309('0x26'),_0x278e42[_0x8309('0x17')],_0x5f2f68);_0x573fcd(_this[_0x8309('0x15')](0x1f4,_0x278e42['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 15482e1..43e4c1b 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 _0x233e=['remove','emit','removeListener','register','length','mailInteraction:','./mailInteraction.events','save'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x233e,0xce));var _0xe233=function(_0x270281,_0x1078c5){_0x270281=_0x270281-0x0;var _0x4888dd=_0x233e[_0x270281];return _0x4888dd;};'use strict';var MailInteractionEvents=require(_0xe233('0x0'));var events=[_0xe233('0x1'),_0xe233('0x2'),'update'];function createListener(_0x18cab3,_0x30aa7d){return function(_0x1dacab){_0x30aa7d[_0xe233('0x3')](_0x18cab3,_0x1dacab);};}function removeListener(_0x12ec79,_0x2e40cd){return function(){MailInteractionEvents[_0xe233('0x4')](_0x12ec79,_0x2e40cd);};}exports[_0xe233('0x5')]=function(_0x4c6dc4){for(var _0x5ba46d=0x0,_0xc5ecd=events[_0xe233('0x6')];_0x5ba46d<_0xc5ecd;_0x5ba46d++){var _0x531d92=events[_0x5ba46d];var _0x143664=createListener(_0xe233('0x7')+_0x531d92,_0x4c6dc4);MailInteractionEvents['on'](_0x531d92,_0x143664);}}; \ No newline at end of file +var _0x4baf=['save','update'];(function(_0x280421,_0x238fa1){var _0x328d92=function(_0x44308d){while(--_0x44308d){_0x280421['push'](_0x280421['shift']());}};_0x328d92(++_0x238fa1);}(_0x4baf,0x7a));var _0xf4ba=function(_0x14a526,_0x866ed2){_0x14a526=_0x14a526-0x0;var _0x17c048=_0x4baf[_0x14a526];return _0x17c048;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0xf4ba('0x0'),'remove',_0xf4ba('0x1')];function createListener(_0x4edddb,_0x3460d8){return function(_0x1aeeb4){_0x3460d8['emit'](_0x4edddb,_0x1aeeb4);};}function removeListener(_0x132d47,_0x3e6622){return function(){MailInteractionEvents['removeListener'](_0x132d47,_0x3e6622);};}exports['register']=function(_0x58c6f8){for(var _0x94ce71=0x0,_0x4500c3=events['length'];_0x94ce71<_0x4500c3;_0x94ce71++){var _0x4f5fff=events[_0x94ce71];var _0x21ce11=createListener('mailInteraction:'+_0x4f5fff,_0x58c6f8);MailInteractionEvents['on'](_0x4f5fff,_0x21ce11);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index bc6c85d..d57b43e 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 _0x98a8=['./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','mail','create','update','accept','put','/:id/reject','reject','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x98a8,0x12c));var _0x898a=function(_0x416a90,_0x411042){_0x416a90=_0x416a90-0x0;var _0x25c0b1=_0x98a8[_0x416a90];return _0x25c0b1;};'use strict';var multer=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var path=require(_0x898a('0x2'));var timeout=require(_0x898a('0x3'));var express=require(_0x898a('0x4'));var router=express[_0x898a('0x5')]();var auth=require(_0x898a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x898a('0x7'));var controller=require(_0x898a('0x8'));router[_0x898a('0x9')]('/',auth[_0x898a('0xa')](),controller[_0x898a('0xb')]);router['get'](_0x898a('0xc'),auth['isAuthenticated'](),controller[_0x898a('0xd')]);router['get'](_0x898a('0xe'),auth[_0x898a('0xa')](),controller[_0x898a('0xf')]);router[_0x898a('0x9')](_0x898a('0x10'),auth[_0x898a('0xa')](),controller[_0x898a('0x11')]);router[_0x898a('0x12')]('/',auth[_0x898a('0xa')](),interaction['tracked'](_0x898a('0x13'),'mailmessage:create'),controller[_0x898a('0x14')]);router['put'](_0x898a('0xe'),auth[_0x898a('0xa')](),controller[_0x898a('0x15')]);router['put']('/:id/accept',auth['isAuthenticated'](),controller[_0x898a('0x16')]);router[_0x898a('0x17')](_0x898a('0x18'),auth[_0x898a('0xa')](),controller[_0x898a('0x19')]);router[_0x898a('0x1a')]('/:id',auth[_0x898a('0xa')](),controller['destroy']);module[_0x898a('0x1b')]=router; \ No newline at end of file +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(_0x2afb44,_0x249a57){var _0x15ccc2=function(_0x180748){while(--_0x180748){_0x2afb44['push'](_0x2afb44['shift']());}};_0x15ccc2(++_0x249a57);}(_0x9f62,0x154));var _0x29f6=function(_0x4b9eda,_0x40089b){_0x4b9eda=_0x4b9eda-0x0;var _0x1c691c=_0x9f62[_0x4b9eda];return _0x1c691c;};'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 diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 04807fa..9d13f80 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 _0x853e=['STRING','long','DATE','INTEGER','lodash','TEXT','BOOLEAN','ENUM','out'];(function(_0x1702b0,_0x2a16ae){var _0x29af28=function(_0x5baf8e){while(--_0x5baf8e){_0x1702b0['push'](_0x1702b0['shift']());}};_0x29af28(++_0x2a16ae);}(_0x853e,0x1ea));var _0xe853=function(_0x51c6cb,_0x5f2f62){_0x51c6cb=_0x51c6cb-0x0;var _0x11f87a=_0x853e[_0x51c6cb];return _0x11f87a;};'use strict';var Sequelize=require('sequelize');var _=require(_0xe853('0x0'));module['exports']={'body':{'type':Sequelize[_0xe853('0x1')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe853('0x1')]('medium')},'read':{'type':Sequelize[_0xe853('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe853('0x3')]('in',_0xe853('0x4')),'defaultValue':_0xe853('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xe853('0x5')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xe853('0x1')](_0xe853('0x6'))},'cc':{'type':Sequelize[_0xe853('0x1')](_0xe853('0x6'))},'bcc':{'type':Sequelize[_0xe853('0x1')](_0xe853('0x6'))},'subject':{'type':Sequelize[_0xe853('0x1')]},'sentAt':{'type':Sequelize[_0xe853('0x7')]},'attach':{'type':Sequelize[_0xe853('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xe853('0x2')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize['TEXT']('long')},'originCc':{'type':Sequelize[_0xe853('0x1')]('long')}}; \ No newline at end of file +var _0xff01=['long','DATE','INTEGER','sequelize','lodash','TEXT','medium','BOOLEAN','out','STRING'];(function(_0x549278,_0x450754){var _0x1ea9a1=function(_0x2e559d){while(--_0x2e559d){_0x549278['push'](_0x549278['shift']());}};_0x1ea9a1(++_0x450754);}(_0xff01,0xb7));var _0x1ff0=function(_0x577013,_0x1d2c41){_0x577013=_0x577013-0x0;var _0x10aae5=_0xff01[_0x577013];return _0x10aae5;};'use strict';var Sequelize=require(_0x1ff0('0x0'));var _=require(_0x1ff0('0x1'));module['exports']={'body':{'type':Sequelize[_0x1ff0('0x2')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x1ff0('0x2')](_0x1ff0('0x3'))},'read':{'type':Sequelize[_0x1ff0('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x1ff0('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x1ff0('0x6')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x1ff0('0x2')]('long')},'cc':{'type':Sequelize['TEXT'](_0x1ff0('0x7'))},'bcc':{'type':Sequelize[_0x1ff0('0x2')]('long')},'subject':{'type':Sequelize[_0x1ff0('0x2')]},'sentAt':{'type':Sequelize[_0x1ff0('0x8')]},'attach':{'type':Sequelize[_0x1ff0('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x1ff0('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x1ff0('0x8')]},'originTo':{'type':Sequelize['TEXT'](_0x1ff0('0x7'))},'originCc':{'type':Sequelize['TEXT'](_0x1ff0('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 1b42de5..2735022 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 _0x57c2=['destroy','stack','send','index','map','MailMessage','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','body','describe','create','out','secret','split','findOne','MailAccountId','List','Contacts','updatedAt','MailServerOut','Smtp','service','host','port','secure','auth','user','pass','attachments','join','server/files/attachments','basename','ListId','List\x20not\x20found','SendMail','sendMail','format','mail','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','get','MailInteraction','MailInteractionId','isNil','read1stAt','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','accept','EventManager','mail-interactions','agent','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','rejectmessage','unix','toString','root','server','files','tmp','from','bcc','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','Bcc','existsSync','push','readFileSync','build','writeFileSync','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','ejs','squel','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update'];(function(_0x1a346c,_0x359d1e){var _0x4364c2=function(_0x42c6b5){while(--_0x42c6b5){_0x1a346c['push'](_0x1a346c['shift']());}};_0x4364c2(++_0x359d1e);}(_0x57c2,0x113));var _0x257c=function(_0x4e4aab,_0x4948b9){_0x4e4aab=_0x4e4aab-0x0;var _0x1e6175=_0x57c2[_0x4e4aab];return _0x1e6175;};'use strict';var pdf=require(_0x257c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x257c('0x1'));var zipdir=require(_0x257c('0x2'));var jsonpatch=require(_0x257c('0x3'));var rp=require('request-promise');var moment=require(_0x257c('0x4'));var BPromise=require(_0x257c('0x5'));var Mustache=require('mustache');var util=require(_0x257c('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x257c('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x257c('0x8'));var crypto=require('crypto');var jsforce=require(_0x257c('0x9'));var deskjs=require(_0x257c('0xa'));var toCsv=require(_0x257c('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x257c('0xc'));var qs=require(_0x257c('0xd'));var as=require(_0x257c('0xe'));var hardwareService=require(_0x257c('0xf'));var logger=require(_0x257c('0x10'))('api');var utils=require(_0x257c('0x11'));var config=require('../../config/environment');var db=require(_0x257c('0x12'))['db'];config[_0x257c('0x13')]=_[_0x257c('0x14')](config[_0x257c('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0x257c('0x15'))(new Redis(config[_0x257c('0x13')]));require('./mailMessage.socket')[_0x257c('0x16')](socket);var jayson=require(_0x257c('0x17'));var client=jayson[_0x257c('0x18')][_0x257c('0x19')]({'port':0x232c});var client9003=jayson[_0x257c('0x18')][_0x257c('0x19')]({'port':0x232b});var client9002=jayson['client'][_0x257c('0x19')]({'port':0x232a});function checkPasswordPattern(_0x57769c,_0x1ddb42,_0x429baf){if(_0x429baf){var _0x19750d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x19750d[_0x257c('0x1a')](_0x1ddb42)){return _0x57769c;}else{throw new db[(_0x257c('0x1b'))][(_0x257c('0x1c'))](_0x257c('0x1d'));}}else{return _0x57769c;}}function respondWithRpcPromise(_0x113b73,_0xd3962d,_0x270dc7,_0x281eb6){return new BPromise(function(_0x498b5d,_0x3e41a7){var _0x551a3c=_0x281eb6||client;return _0x551a3c['request'](_0x113b73,_0x270dc7)[_0x257c('0x1e')](function(_0x4a7425){logger[_0x257c('0x1f')](_0x257c('0x20'),_0xd3962d,'request\x20sent');logger[_0x257c('0x21')](_0x257c('0x22'),_0xd3962d,_0x257c('0x23'),JSON[_0x257c('0x24')](_0x4a7425));if(_0x4a7425[_0x257c('0x25')]){if(_0x4a7425['error'][_0x257c('0x26')]===0x1f4){logger[_0x257c('0x25')]('MailMessage,\x20%s,\x20%s',_0xd3962d,_0x4a7425[_0x257c('0x25')]['message']);return _0x3e41a7(_0x4a7425[_0x257c('0x25')][_0x257c('0x27')]);}logger[_0x257c('0x25')](_0x257c('0x20'),_0xd3962d,_0x4a7425[_0x257c('0x25')][_0x257c('0x27')]);return _0x498b5d(_0x4a7425[_0x257c('0x25')][_0x257c('0x27')]);}else{logger[_0x257c('0x1f')]('MailMessage,\x20%s,\x20%s',_0xd3962d,_0x257c('0x23'));_0x498b5d(_0x4a7425['result'][_0x257c('0x27')]);}})[_0x257c('0x28')](function(_0x543233){logger[_0x257c('0x25')]('MailMessage,\x20%s,\x20%s',_0xd3962d,_0x543233);_0x3e41a7(_0x543233);});});}function respondWithStatusCode(_0x3ccb6a,_0x35f99e){_0x35f99e=_0x35f99e||0xcc;return function(_0x24be99){if(_0x24be99){return _0x3ccb6a['sendStatus'](_0x35f99e);}return _0x3ccb6a[_0x257c('0x29')](_0x35f99e)[_0x257c('0x2a')]();};}function respondWithResult(_0x48c915,_0x3937b3){_0x3937b3=_0x3937b3||0xc8;return function(_0x1954d8){if(_0x1954d8){return _0x48c915[_0x257c('0x29')](_0x3937b3)[_0x257c('0x2b')](_0x1954d8);}};}function respondWithFilteredResult(_0x35f1cb,_0x4dc33a){return function(_0x4b41fc){if(_0x4b41fc){var _0x4885c2=_0x4b41fc[_0x257c('0x2c')],_0x1dfa3d=_0x4dc33a[_0x257c('0x2d')],_0xa64f6c=_0x4dc33a[_0x257c('0x2d')]+_0x4dc33a[_0x257c('0x2e')],_0x4a78c1;if(_0xa64f6c>=_0x4885c2){_0xa64f6c=_0x4885c2;_0x4a78c1=0xc8;}else{_0x4a78c1=0xce;}_0x35f1cb[_0x257c('0x29')](_0x4a78c1);return _0x35f1cb[_0x257c('0x2f')](_0x257c('0x30'),_0x1dfa3d+'-'+_0xa64f6c+'/'+_0x4885c2)[_0x257c('0x2b')](_0x4b41fc);}return null;};}function patchUpdates(_0x415df6){return function(_0x1d4f9c){try{jsonpatch[_0x257c('0x31')](_0x1d4f9c,_0x415df6,!![]);}catch(_0x4b0601){return BPromise[_0x257c('0x32')](_0x4b0601);}return _0x1d4f9c[_0x257c('0x33')]();};}function saveUpdates(_0x435f75,_0x39b1a3){return function(_0x158b35){if(_0x158b35){return _0x158b35[_0x257c('0x34')](_0x435f75)[_0x257c('0x1e')](function(_0x1f655a){return _0x1f655a;});}return null;};}function removeEntity(_0x5ef00d,_0xabf10f){return function(_0x493baf){if(_0x493baf){return _0x493baf[_0x257c('0x35')]()[_0x257c('0x1e')](function(){_0x5ef00d['status'](0xcc)[_0x257c('0x2a')]();});}};}function handleEntityNotFound(_0x3d9236,_0x3c77a4){return function(_0x1dad0e){if(!_0x1dad0e){_0x3d9236['sendStatus'](0x194);}return _0x1dad0e;};}function handleError(_0x241156,_0x5597d9){_0x5597d9=_0x5597d9||0x1f4;return function(_0x28b49b){logger[_0x257c('0x25')](_0x28b49b[_0x257c('0x36')]);if(_0x28b49b['name']){delete _0x28b49b['name'];}_0x241156[_0x257c('0x29')](_0x5597d9)[_0x257c('0x37')](_0x28b49b);};}exports[_0x257c('0x38')]=function(_0x3909e2,_0xd8fbfc){var _0x814dab={},_0x149ce4={},_0x1e5810={'count':0x0,'rows':[]};var _0x31f169=_[_0x257c('0x39')](db[_0x257c('0x3a')][_0x257c('0x3b')],function(_0x37f62a){return{'name':_0x37f62a[_0x257c('0x3c')],'type':_0x37f62a[_0x257c('0x3d')][_0x257c('0x3e')]};});_0x149ce4[_0x257c('0x3f')]=_[_0x257c('0x39')](_0x31f169,_0x257c('0x40'));_0x149ce4[_0x257c('0x41')]=_[_0x257c('0x42')](_0x3909e2[_0x257c('0x41')]);_0x149ce4[_0x257c('0x43')]=_['intersection'](_0x149ce4[_0x257c('0x3f')],_0x149ce4['query']);_0x814dab['attributes']=_[_0x257c('0x44')](_0x149ce4[_0x257c('0x3f')],qs['fields'](_0x3909e2[_0x257c('0x41')][_0x257c('0x45')]));_0x814dab['attributes']=_0x814dab[_0x257c('0x46')][_0x257c('0x47')]?_0x814dab['attributes']:_0x149ce4[_0x257c('0x3f')];if(!_0x3909e2['query']['hasOwnProperty']('nolimit')){_0x814dab[_0x257c('0x2e')]=qs[_0x257c('0x2e')](_0x3909e2[_0x257c('0x41')][_0x257c('0x2e')]);_0x814dab['offset']=qs['offset'](_0x3909e2['query'][_0x257c('0x2d')]);}_0x814dab[_0x257c('0x48')]=qs['sort'](_0x3909e2[_0x257c('0x41')][_0x257c('0x49')]);_0x814dab[_0x257c('0x4a')]=qs[_0x257c('0x43')](_[_0x257c('0x4b')](_0x3909e2[_0x257c('0x41')],_0x149ce4[_0x257c('0x43')]),_0x31f169);if(_0x3909e2['query'][_0x257c('0x4c')]){_0x814dab[_0x257c('0x4a')]=_[_0x257c('0x4d')](_0x814dab[_0x257c('0x4a')],{'$or':_['map'](_0x31f169,function(_0x1d7eef){if(_0x1d7eef['type']!==_0x257c('0x4e')){var _0x4ccffa={};_0x4ccffa[_0x1d7eef[_0x257c('0x40')]]={'$like':'%'+_0x3909e2['query']['filter']+'%'};return _0x4ccffa;}})});}_0x814dab=_['merge']({},_0x814dab,_0x3909e2[_0x257c('0x4f')]);var _0x230e89={'where':_0x814dab[_0x257c('0x4a')]};return db[_0x257c('0x3a')]['count'](_0x230e89)[_0x257c('0x1e')](function(_0x10debf){_0x1e5810['count']=_0x10debf;if(_0x3909e2[_0x257c('0x41')][_0x257c('0x50')]){_0x814dab[_0x257c('0x51')]=[{'all':!![]}];}return db['MailMessage'][_0x257c('0x52')](_0x814dab);})['then'](function(_0x439954){_0x1e5810[_0x257c('0x53')]=_0x439954;return _0x1e5810;})[_0x257c('0x1e')](respondWithFilteredResult(_0xd8fbfc,_0x814dab))['catch'](handleError(_0xd8fbfc,null));};exports[_0x257c('0x54')]=function(_0x5c525b,_0x4b076b){var _0x4fc42d={'raw':!![],'where':{'id':_0x5c525b[_0x257c('0x55')]['id']}},_0x1a7cf9={};_0x1a7cf9[_0x257c('0x3f')]=_[_0x257c('0x42')](db[_0x257c('0x3a')]['rawAttributes']);_0x1a7cf9['query']=_['keys'](_0x5c525b[_0x257c('0x41')]);_0x1a7cf9[_0x257c('0x43')]=_[_0x257c('0x44')](_0x1a7cf9[_0x257c('0x3f')],_0x1a7cf9[_0x257c('0x41')]);_0x4fc42d[_0x257c('0x46')]=_[_0x257c('0x44')](_0x1a7cf9[_0x257c('0x3f')],qs['fields'](_0x5c525b[_0x257c('0x41')][_0x257c('0x45')]));_0x4fc42d[_0x257c('0x46')]=_0x4fc42d[_0x257c('0x46')][_0x257c('0x47')]?_0x4fc42d['attributes']:_0x1a7cf9[_0x257c('0x3f')];if(_0x5c525b[_0x257c('0x41')][_0x257c('0x50')]){_0x4fc42d[_0x257c('0x51')]=[{'all':!![]}];}_0x4fc42d=_[_0x257c('0x4d')]({},_0x4fc42d,_0x5c525b[_0x257c('0x4f')]);return db[_0x257c('0x3a')][_0x257c('0x56')](_0x4fc42d)[_0x257c('0x1e')](handleEntityNotFound(_0x4b076b,null))['then'](respondWithResult(_0x4b076b,null))['catch'](handleError(_0x4b076b,null));};exports[_0x257c('0x34')]=function(_0x5b1684,_0x1b609d){if(_0x5b1684[_0x257c('0x57')]['id']){delete _0x5b1684[_0x257c('0x57')]['id'];}return db[_0x257c('0x3a')][_0x257c('0x56')]({'where':{'id':_0x5b1684[_0x257c('0x55')]['id']}})[_0x257c('0x1e')](handleEntityNotFound(_0x1b609d,null))[_0x257c('0x1e')](saveUpdates(_0x5b1684[_0x257c('0x57')],null))[_0x257c('0x1e')](respondWithResult(_0x1b609d,null))[_0x257c('0x28')](handleError(_0x1b609d,null));};exports[_0x257c('0x35')]=function(_0x20a8e6,_0x580341){return db[_0x257c('0x3a')][_0x257c('0x56')]({'where':{'id':_0x20a8e6[_0x257c('0x55')]['id']}})['then'](handleEntityNotFound(_0x580341,null))[_0x257c('0x1e')](removeEntity(_0x580341,null))[_0x257c('0x28')](handleError(_0x580341,null));};exports['describe']=function(_0x503934,_0x1b8556){return db[_0x257c('0x3a')][_0x257c('0x58')]()[_0x257c('0x1e')](respondWithResult(_0x1b8556,null))[_0x257c('0x28')](handleError(_0x1b8556,null));};exports[_0x257c('0x59')]=function(_0x16f2f9,_0x61df2b){return db['MailMessage']['create'](_0x16f2f9[_0x257c('0x57')])[_0x257c('0x1e')](function(_0x5cfec9){if(_0x5cfec9){if(_0x5cfec9['direction']===_0x257c('0x5a')&&!_0x5cfec9[_0x257c('0x5b')]){var _0x31558e,_0x366561,_0x2053ac;if(_0x16f2f9['body']['to']){_0x366561=_0x16f2f9[_0x257c('0x57')]['to'][_0x257c('0x5c')](',')[0x0];}return db['MailAccount'][_0x257c('0x5d')]({'where':{'id':_0x5cfec9[_0x257c('0x5e')]},'include':[{'model':db['CmList'],'as':_0x257c('0x5f'),'include':[{'model':db['CmContact'],'as':_0x257c('0x60'),'where':{'email':_0x366561},'limit':0x1,'order':[[_0x257c('0x61'),'DESC']]}]},{'model':db[_0x257c('0x62')],'as':_0x257c('0x63'),'raw':!![]}]})[_0x257c('0x1e')](function(_0x462152){_0x31558e=_0x462152;if(_0x31558e&&_0x31558e[_0x257c('0x63')]){var _0x43b511={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x31558e['Smtp'][_0x257c('0x64')])){_0x43b511['host']=_0x31558e[_0x257c('0x63')][_0x257c('0x65')];_0x43b511[_0x257c('0x66')]=_0x31558e[_0x257c('0x63')]['port'];_0x43b511[_0x257c('0x67')]=_0x31558e[_0x257c('0x63')][_0x257c('0x67')];if(_0x31558e[_0x257c('0x63')]['authentication']){_0x43b511[_0x257c('0x68')]={'user':_0x31558e['Smtp'][_0x257c('0x69')],'pass':_0x31558e[_0x257c('0x63')][_0x257c('0x6a')]};}}else{_0x43b511[_0x257c('0x64')]=_0x31558e['Smtp'][_0x257c('0x64')];_0x43b511[_0x257c('0x68')]={'user':_0x31558e[_0x257c('0x63')][_0x257c('0x69')],'pass':_0x31558e[_0x257c('0x63')][_0x257c('0x6a')]};_0x43b511['secure']=_0x31558e['Smtp']['secure'];}if(_0x16f2f9[_0x257c('0x57')]['attachments']&&_0x16f2f9[_0x257c('0x57')][_0x257c('0x6b')][_0x257c('0x47')]){for(var _0x15458d=0x0;_0x15458d<_0x16f2f9['body']['attachments'][_0x257c('0x47')];_0x15458d+=0x1){_0x16f2f9[_0x257c('0x57')][_0x257c('0x6b')][_0x15458d]={'filename':_0x16f2f9[_0x257c('0x57')][_0x257c('0x6b')][_0x15458d][_0x257c('0x40')],'path':path[_0x257c('0x6c')](config['root'],_0x257c('0x6d'),_0x16f2f9['body'][_0x257c('0x6b')][_0x15458d][_0x257c('0x6e')])};}}_0x2053ac={'account':_0x43b511,'message':_0x16f2f9['body']};return;}})[_0x257c('0x1e')](function(){if(_0x31558e[_0x257c('0x5f')]){if(_0x31558e[_0x257c('0x5f')][_0x257c('0x60')][_0x257c('0x47')]){return _0x31558e[_0x257c('0x5f')][_0x257c('0x60')][0x0];}else{return db['CmContact'][_0x257c('0x59')](_[_0x257c('0x14')](_0x16f2f9[_0x257c('0x57')],{'firstName':_0x16f2f9[_0x257c('0x57')]['to'],'email':_0x16f2f9[_0x257c('0x57')]['to'],'phone':_0x16f2f9[_0x257c('0x57')]['to'],'ListId':_0x31558e[_0x257c('0x6f')]}));}}else{throw new Error(_0x257c('0x70'));}})[_0x257c('0x1e')](function(){if(_0x2053ac){return respondWithRpcPromise(_0x257c('0x71'),_0x257c('0x72'),_0x2053ac,client9003)[_0x257c('0x1e')](function(_0xcbbf6b){return _0x5cfec9[_0x257c('0x34')]({'read':!![],'messageId':_0xcbbf6b['messageId'],'sentAt':moment()[_0x257c('0x73')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x257c('0x28')](function(_0x152fcd){logger['error']('%s',JSON[_0x257c('0x24')](_0x152fcd));return _0x5cfec9;});}return _0x5cfec9;});}return _0x5cfec9;}})[_0x257c('0x1e')](respondWithResult(_0x61df2b,0xc9))['catch'](handleError(_0x61df2b,null));};var interaction_log=require('../../config/logger')('mail-interactions');exports['accept']=function(_0x5930fa,_0x5e77c0,_0x42d802){var _0x322503={'channel':_0x257c('0x74')};if(_0x5930fa[_0x257c('0x57')]['id']){delete _0x5930fa[_0x257c('0x57')]['id'];}_0x5930fa['body']['read']=!![];_0x5930fa['body'][_0x257c('0x75')]=moment()[_0x257c('0x73')](_0x257c('0x76'));_0x5930fa[_0x257c('0x57')]['UserId']=_0x5930fa['body'][_0x257c('0x77')]||_0x5930fa[_0x257c('0x69')]['id'];return db[_0x257c('0x3a')][_0x257c('0x56')]({'where':{'id':_0x5930fa[_0x257c('0x55')]['id'],'UserId':null},'include':[{'model':db[_0x257c('0x78')],'as':_0x257c('0x79')}]})[_0x257c('0x1e')](handleEntityNotFound(_0x5e77c0,null))['then'](saveUpdates(_0x5930fa['body'],null))[_0x257c('0x1e')](function(_0x9957dc){if(_0x9957dc){_0x322503[_0x257c('0x27')]=_0x9957dc[_0x257c('0x7a')]({'plain':!![]});return db[_0x257c('0x7b')][_0x257c('0x56')]({'where':{'id':_0x9957dc[_0x257c('0x7c')]}});}return null;})[_0x257c('0x1e')](handleEntityNotFound(_0x5e77c0,null))[_0x257c('0x1e')](function(_0x539f14){if(_0x539f14){return _0x539f14[_0x257c('0x34')]({'UserId':_0x5930fa[_0x257c('0x57')]['UserId'],'read1stAt':_[_0x257c('0x7d')](_0x539f14[_0x257c('0x7e')])?moment()[_0x257c('0x73')](_0x257c('0x76')):undefined});}return null;})['then'](function(_0x1a3c01){if(_0x1a3c01){_0x322503['interaction']=_0x1a3c01['get']({'plain':!![]});interaction_log[_0x257c('0x1f')](_0x257c('0x7f'),_0x5930fa[_0x257c('0x69')]['id'],_0x5930fa[_0x257c('0x69')][_0x257c('0x40')],_0x5930fa[_0x257c('0x69')]['role'],_0x322503[_0x257c('0x80')]['id'],_0x5930fa[_0x257c('0x57')]?JSON[_0x257c('0x24')](_0x5930fa[_0x257c('0x57')]):_0x257c('0x81'));return respondWithRpcPromise(_0x257c('0x82'),_0x257c('0x83'),_0x322503);}return null;})[_0x257c('0x1e')](function(_0x47daea){if(_0x47daea){if(_0x5930fa[_0x257c('0x57')][_0x257c('0x84')]){_0x322503[_0x257c('0x27')][_0x257c('0x85')]=util['format'](_0x257c('0x86'),_0x5930fa[_0x257c('0x69')]['name']);_0x322503['message']['channel']=_0x322503[_0x257c('0x87')];_0x322503['message'][_0x257c('0x88')]=_0x257c('0x89');return respondWithRpcPromise(_0x257c('0x8a'),_0x257c('0x8a'),{'event':'acceptmessage','message':_0x322503[_0x257c('0x27')]},client9002)[_0x257c('0x1e')](function(){return _0x322503;});}return _0x322503;}return null;})[_0x257c('0x1e')](respondWithResult(_0x5e77c0,null))[_0x257c('0x28')](handleError(_0x5e77c0,null));};var interaction_log=require(_0x257c('0x10'))(_0x257c('0x8b'));exports[_0x257c('0x32')]=function(_0x2672a0,_0x51a992,_0x3e1c16){var _0x17f1e1={'agent':{},'channel':'mail'};if(_0x2672a0[_0x257c('0x57')]['id']){delete _0x2672a0[_0x257c('0x57')]['id'];}_0x2672a0[_0x257c('0x57')]['UserId']=_0x2672a0[_0x257c('0x57')][_0x257c('0x77')]||_0x2672a0['user']['id'];_0x17f1e1[_0x257c('0x8c')]['id']=_0x2672a0['body'][_0x257c('0x77')];return db[_0x257c('0x3a')][_0x257c('0x56')]({'where':{'id':_0x2672a0[_0x257c('0x55')]['id'],'UserId':null}})[_0x257c('0x1e')](handleEntityNotFound(_0x51a992,null))[_0x257c('0x1e')](function(_0x362f83){if(_0x362f83){_0x17f1e1[_0x257c('0x27')]=_0x362f83[_0x257c('0x7a')]({'plain':!![]});return db[_0x257c('0x7b')][_0x257c('0x56')]({'where':{'id':_0x362f83[_0x257c('0x7c')]}});}return null;})[_0x257c('0x1e')](handleEntityNotFound(_0x51a992,null))['then'](function(_0x95afb1){if(_0x95afb1){_0x17f1e1[_0x257c('0x80')]=_0x95afb1[_0x257c('0x7a')]({'plain':!![]});interaction_log[_0x257c('0x1f')](_0x257c('0x8d'),_0x2672a0[_0x257c('0x69')]['id'],_0x2672a0[_0x257c('0x69')]['name'],_0x2672a0[_0x257c('0x69')][_0x257c('0x8e')],_0x17f1e1[_0x257c('0x80')]['id'],_0x2672a0[_0x257c('0x57')]?JSON[_0x257c('0x24')](_0x2672a0[_0x257c('0x57')]):'null');return respondWithRpcPromise(_0x257c('0x8f'),_0x257c('0x90'),_0x17f1e1);}return null;})[_0x257c('0x1e')](function(_0x160038){if(_0x160038){_0x160038[_0x257c('0x27')][_0x257c('0x85')]=util[_0x257c('0x73')](_0x257c('0x86'),_0x2672a0[_0x257c('0x69')][_0x257c('0x40')]);_0x160038[_0x257c('0x27')][_0x257c('0x87')]=_0x17f1e1[_0x257c('0x87')];_0x160038['message'][_0x257c('0x88')]=_0x257c('0x32');respondWithRpcPromise(_0x257c('0x8a'),_0x257c('0x8a'),{'event':_0x257c('0x91'),'message':_0x160038[_0x257c('0x27')]},client9002);return _0x17f1e1;}return null;})['then'](respondWithResult(_0x51a992,null))[_0x257c('0x28')](handleError(_0x51a992,null));};exports['download']=function(_0x2b2332,_0xb8f413){var _0x6748e4=moment()[_0x257c('0x92')]()[_0x257c('0x93')]();var _0x5cd1f3=path['join'](config[_0x257c('0x94')],_0x257c('0x95'),_0x257c('0x96'),_0x257c('0x97'));var _0x3de237=path[_0x257c('0x6c')](config['root'],_0x257c('0x95'),'files',_0x257c('0x6b'));var _0x336054=util[_0x257c('0x73')]('message-%s.eml',_0x6748e4);return db[_0x257c('0x3a')][_0x257c('0x56')]({'where':{'id':_0x2b2332[_0x257c('0x55')]['id']},'attributes':['id',_0x257c('0x57'),_0x257c('0x98'),'to','cc',_0x257c('0x99'),'subject',_0x257c('0x9a')],'include':_0x2b2332[_0x257c('0x41')][_0x257c('0x6b')]?[{'model':db[_0x257c('0x9b')],'as':_0x257c('0x9c')}]:undefined})[_0x257c('0x1e')](handleEntityNotFound(_0xb8f413,null))['then'](function(_0x377832){if(_0x377832){var _0x2ea6f1=_0x377832;var _0x2fa473={'from':_0x2ea6f1[_0x257c('0x98')],'to':_0x2ea6f1['to'],'subject':_0x2ea6f1['subject'],'html':_0x2ea6f1[_0x257c('0x57')],'headers':{'Date':moment(_0x2ea6f1['createdAt'])['format'](_0x257c('0x9d'))},'attachments':[]};if(_0x377832['cc']){_0x2fa473['headers']['Cc']=_0x377832['cc'];}if(_0x377832[_0x257c('0x99')]){_0x2fa473['headers'][_0x257c('0x9e')]=_0x377832['bcc'];}return new BPromise(function(_0x442e7b,_0x1e3441){if(_0x377832[_0x257c('0x9c')]){for(var _0x24671a=0x0;_0x24671a<_0x377832[_0x257c('0x9c')][_0x257c('0x47')];_0x24671a++){var _0x581510=_0x377832[_0x257c('0x9c')][_0x24671a];var _0x145f45=path[_0x257c('0x6c')](_0x3de237,_0x581510['basename']);if(fs[_0x257c('0x9f')](_0x145f45)){_0x2fa473[_0x257c('0x6b')][_0x257c('0xa0')]({'name':_0x581510['name'],'contentType':_0x581510['type'],'data':fs[_0x257c('0xa1')](_0x145f45)});}}}emlformat[_0x257c('0xa2')](_0x2fa473,function(_0x264beb,_0x671aea){if(_0x264beb)return _0x1e3441(_0x264beb);fs[_0x257c('0xa3')](path[_0x257c('0x6c')](_0x5cd1f3,_0x336054),_0x671aea);return _0x442e7b(_0x671aea);});});}})['then'](function(_0x305931){if(_0x305931){return _0xb8f413['download'](path[_0x257c('0x6c')](_0x5cd1f3,_0x336054),_0x336054,function(_0x3df242){if(_0x3df242){console['log']('err',_0x3df242);}else{fs['unlinkSync'](path[_0x257c('0x6c')](_0x5cd1f3,_0x336054));}});}})[_0x257c('0x28')](handleError(_0xb8f413,null));}; \ No newline at end of file +var _0xc5c7=['json','count','offset','limit','status','set','Content-Range','apply','save','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','query','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','find','update','body','destroy','describe','create','direction','out','secret','split','MailAccount','findOne','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','auth','pass','user','attachments','server/files/attachments','basename','ListId','SendMail','sendMail','messageId','format','mail-interactions','accept','mail','UserId','Contact','get','MailInteraction','MailInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','role','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','../../config/logger','reject','agent','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','download','unix','toString','join','root','files','message-%s.eml','from','subject','Attachment','Attachments','headers','bcc','Bcc','existsSync','readFileSync','build','writeFileSync','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailMessage.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','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','end'];(function(_0x5a6644,_0x45d612){var _0x3a2a5d=function(_0x54159e){while(--_0x54159e){_0x5a6644['push'](_0x5a6644['shift']());}};_0x3a2a5d(++_0x45d612);}(_0xc5c7,0x1cf));var _0x7c5c=function(_0x43a7d2,_0x55b63a){_0x43a7d2=_0x43a7d2-0x0;var _0x6a68d6=_0xc5c7[_0x43a7d2];return _0x6a68d6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7c5c('0x0'));var rimraf=require(_0x7c5c('0x1'));var zipdir=require(_0x7c5c('0x2'));var jsonpatch=require(_0x7c5c('0x3'));var rp=require(_0x7c5c('0x4'));var moment=require(_0x7c5c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7c5c('0x6'));var util=require(_0x7c5c('0x7'));var path=require(_0x7c5c('0x8'));var sox=require(_0x7c5c('0x9'));var csv=require(_0x7c5c('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x7c5c('0xb'));var crypto=require('crypto');var jsforce=require(_0x7c5c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7c5c('0xa'));var querystring=require(_0x7c5c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7c5c('0xe'));var qs=require(_0x7c5c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7c5c('0x10'));var logger=require('../../config/logger')(_0x7c5c('0x11'));var utils=require('../../config/utils');var config=require(_0x7c5c('0x12'));var db=require(_0x7c5c('0x13'))['db'];config['redis']=_[_0x7c5c('0x14')](config[_0x7c5c('0x15')],{'host':_0x7c5c('0x16'),'port':0x18eb});var socket=require(_0x7c5c('0x17'))(new Redis(config[_0x7c5c('0x15')]));require(_0x7c5c('0x18'))[_0x7c5c('0x19')](socket);var jayson=require(_0x7c5c('0x1a'));var client=jayson[_0x7c5c('0x1b')][_0x7c5c('0x1c')]({'port':0x232c});var client9003=jayson[_0x7c5c('0x1b')][_0x7c5c('0x1c')]({'port':0x232b});var client9002=jayson[_0x7c5c('0x1b')][_0x7c5c('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x4c5b9d,_0x4f9688,_0x2ba1a6){if(_0x2ba1a6){var _0x12e92a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x12e92a[_0x7c5c('0x1d')](_0x4f9688)){return _0x4c5b9d;}else{throw new db[(_0x7c5c('0x1e'))]['ValidationError'](_0x7c5c('0x1f'));}}else{return _0x4c5b9d;}}function respondWithRpcPromise(_0x7df960,_0x3f9704,_0x2792f4,_0x1215a3){return new BPromise(function(_0x4c5c93,_0x568a95){var _0x4fa23b=_0x1215a3||client;return _0x4fa23b[_0x7c5c('0x20')](_0x7df960,_0x2792f4)[_0x7c5c('0x21')](function(_0x5e821e){logger[_0x7c5c('0x22')](_0x7c5c('0x23'),_0x3f9704,_0x7c5c('0x24'));logger[_0x7c5c('0x25')](_0x7c5c('0x26'),_0x3f9704,'request\x20sent',JSON[_0x7c5c('0x27')](_0x5e821e));if(_0x5e821e[_0x7c5c('0x28')]){if(_0x5e821e[_0x7c5c('0x28')]['code']===0x1f4){logger[_0x7c5c('0x28')](_0x7c5c('0x23'),_0x3f9704,_0x5e821e['error'][_0x7c5c('0x29')]);return _0x568a95(_0x5e821e[_0x7c5c('0x28')][_0x7c5c('0x29')]);}logger[_0x7c5c('0x28')](_0x7c5c('0x23'),_0x3f9704,_0x5e821e[_0x7c5c('0x28')][_0x7c5c('0x29')]);return _0x4c5c93(_0x5e821e[_0x7c5c('0x28')][_0x7c5c('0x29')]);}else{logger[_0x7c5c('0x22')](_0x7c5c('0x23'),_0x3f9704,'request\x20sent');_0x4c5c93(_0x5e821e[_0x7c5c('0x2a')]['message']);}})['catch'](function(_0xa91aa){logger['error'](_0x7c5c('0x23'),_0x3f9704,_0xa91aa);_0x568a95(_0xa91aa);});});}function respondWithStatusCode(_0x18ad01,_0xe66f02){_0xe66f02=_0xe66f02||0xcc;return function(_0x1b8d20){if(_0x1b8d20){return _0x18ad01['sendStatus'](_0xe66f02);}return _0x18ad01['status'](_0xe66f02)[_0x7c5c('0x2b')]();};}function respondWithResult(_0x1467fa,_0x26d865){_0x26d865=_0x26d865||0xc8;return function(_0x3e4732){if(_0x3e4732){return _0x1467fa['status'](_0x26d865)[_0x7c5c('0x2c')](_0x3e4732);}};}function respondWithFilteredResult(_0x4c3142,_0x4de2d2){return function(_0x36bf25){if(_0x36bf25){var _0x3bc897=_0x36bf25[_0x7c5c('0x2d')],_0x3e4fe1=_0x4de2d2[_0x7c5c('0x2e')],_0xe014c8=_0x4de2d2['offset']+_0x4de2d2[_0x7c5c('0x2f')],_0x5dda1d;if(_0xe014c8>=_0x3bc897){_0xe014c8=_0x3bc897;_0x5dda1d=0xc8;}else{_0x5dda1d=0xce;}_0x4c3142[_0x7c5c('0x30')](_0x5dda1d);return _0x4c3142[_0x7c5c('0x31')](_0x7c5c('0x32'),_0x3e4fe1+'-'+_0xe014c8+'/'+_0x3bc897)['json'](_0x36bf25);}return null;};}function patchUpdates(_0x3a636d){return function(_0x541d88){try{jsonpatch[_0x7c5c('0x33')](_0x541d88,_0x3a636d,!![]);}catch(_0x4729e6){return BPromise['reject'](_0x4729e6);}return _0x541d88[_0x7c5c('0x34')]();};}function saveUpdates(_0x21319a,_0x2994d8){return function(_0x4ea292){if(_0x4ea292){return _0x4ea292['update'](_0x21319a)[_0x7c5c('0x21')](function(_0x112fb9){return _0x112fb9;});}return null;};}function removeEntity(_0x58caf9,_0x5529c9){return function(_0x311f65){if(_0x311f65){return _0x311f65['destroy']()[_0x7c5c('0x21')](function(){_0x58caf9[_0x7c5c('0x30')](0xcc)[_0x7c5c('0x2b')]();});}};}function handleEntityNotFound(_0x3079c5,_0x46eb5f){return function(_0x12c320){if(!_0x12c320){_0x3079c5['sendStatus'](0x194);}return _0x12c320;};}function handleError(_0x27bc9b,_0x4f3506){_0x4f3506=_0x4f3506||0x1f4;return function(_0x220ecc){logger[_0x7c5c('0x28')](_0x220ecc[_0x7c5c('0x35')]);if(_0x220ecc['name']){delete _0x220ecc[_0x7c5c('0x36')];}_0x27bc9b[_0x7c5c('0x30')](_0x4f3506)[_0x7c5c('0x37')](_0x220ecc);};}exports[_0x7c5c('0x38')]=function(_0x2a8fd6,_0x207989){var _0x22e459={},_0x2f1734={},_0x506a14={'count':0x0,'rows':[]};var _0x46076e=_[_0x7c5c('0x39')](db[_0x7c5c('0x3a')][_0x7c5c('0x3b')],function(_0x1fc382){return{'name':_0x1fc382[_0x7c5c('0x3c')],'type':_0x1fc382[_0x7c5c('0x3d')][_0x7c5c('0x3e')]};});_0x2f1734['model']=_[_0x7c5c('0x39')](_0x46076e,_0x7c5c('0x36'));_0x2f1734['query']=_['keys'](_0x2a8fd6[_0x7c5c('0x3f')]);_0x2f1734['filters']=_[_0x7c5c('0x40')](_0x2f1734[_0x7c5c('0x41')],_0x2f1734[_0x7c5c('0x3f')]);_0x22e459['attributes']=_['intersection'](_0x2f1734[_0x7c5c('0x41')],qs[_0x7c5c('0x42')](_0x2a8fd6[_0x7c5c('0x3f')]['fields']));_0x22e459[_0x7c5c('0x43')]=_0x22e459[_0x7c5c('0x43')][_0x7c5c('0x44')]?_0x22e459[_0x7c5c('0x43')]:_0x2f1734['model'];if(!_0x2a8fd6[_0x7c5c('0x3f')][_0x7c5c('0x45')]('nolimit')){_0x22e459[_0x7c5c('0x2f')]=qs[_0x7c5c('0x2f')](_0x2a8fd6['query'][_0x7c5c('0x2f')]);_0x22e459[_0x7c5c('0x2e')]=qs[_0x7c5c('0x2e')](_0x2a8fd6[_0x7c5c('0x3f')]['offset']);}_0x22e459[_0x7c5c('0x46')]=qs[_0x7c5c('0x47')](_0x2a8fd6['query'][_0x7c5c('0x47')]);_0x22e459[_0x7c5c('0x48')]=qs[_0x7c5c('0x49')](_[_0x7c5c('0x4a')](_0x2a8fd6[_0x7c5c('0x3f')],_0x2f1734[_0x7c5c('0x49')]),_0x46076e);if(_0x2a8fd6[_0x7c5c('0x3f')][_0x7c5c('0x4b')]){_0x22e459[_0x7c5c('0x48')]=_['merge'](_0x22e459[_0x7c5c('0x48')],{'$or':_[_0x7c5c('0x39')](_0x46076e,function(_0x3996be){if(_0x3996be[_0x7c5c('0x3d')]!==_0x7c5c('0x4c')){var _0x86e898={};_0x86e898[_0x3996be[_0x7c5c('0x36')]]={'$like':'%'+_0x2a8fd6[_0x7c5c('0x3f')][_0x7c5c('0x4b')]+'%'};return _0x86e898;}})});}_0x22e459=_[_0x7c5c('0x4d')]({},_0x22e459,_0x2a8fd6[_0x7c5c('0x4e')]);var _0x3710ad={'where':_0x22e459[_0x7c5c('0x48')]};return db[_0x7c5c('0x3a')][_0x7c5c('0x2d')](_0x3710ad)[_0x7c5c('0x21')](function(_0x31ed2a){_0x506a14['count']=_0x31ed2a;if(_0x2a8fd6[_0x7c5c('0x3f')][_0x7c5c('0x4f')]){_0x22e459[_0x7c5c('0x50')]=[{'all':!![]}];}return db[_0x7c5c('0x3a')]['findAll'](_0x22e459);})[_0x7c5c('0x21')](function(_0x4c608e){_0x506a14[_0x7c5c('0x51')]=_0x4c608e;return _0x506a14;})[_0x7c5c('0x21')](respondWithFilteredResult(_0x207989,_0x22e459))[_0x7c5c('0x52')](handleError(_0x207989,null));};exports[_0x7c5c('0x53')]=function(_0x2033fc,_0x152b34){var _0x478616={'raw':!![],'where':{'id':_0x2033fc[_0x7c5c('0x54')]['id']}},_0x52d2eb={};_0x52d2eb[_0x7c5c('0x41')]=_['keys'](db[_0x7c5c('0x3a')][_0x7c5c('0x3b')]);_0x52d2eb['query']=_['keys'](_0x2033fc[_0x7c5c('0x3f')]);_0x52d2eb['filters']=_[_0x7c5c('0x40')](_0x52d2eb[_0x7c5c('0x41')],_0x52d2eb[_0x7c5c('0x3f')]);_0x478616['attributes']=_['intersection'](_0x52d2eb['model'],qs[_0x7c5c('0x42')](_0x2033fc[_0x7c5c('0x3f')][_0x7c5c('0x42')]));_0x478616['attributes']=_0x478616[_0x7c5c('0x43')][_0x7c5c('0x44')]?_0x478616[_0x7c5c('0x43')]:_0x52d2eb[_0x7c5c('0x41')];if(_0x2033fc[_0x7c5c('0x3f')][_0x7c5c('0x4f')]){_0x478616[_0x7c5c('0x50')]=[{'all':!![]}];}_0x478616=_[_0x7c5c('0x4d')]({},_0x478616,_0x2033fc['options']);return db[_0x7c5c('0x3a')][_0x7c5c('0x55')](_0x478616)['then'](handleEntityNotFound(_0x152b34,null))[_0x7c5c('0x21')](respondWithResult(_0x152b34,null))[_0x7c5c('0x52')](handleError(_0x152b34,null));};exports[_0x7c5c('0x56')]=function(_0x10aeaa,_0x17ca2c){if(_0x10aeaa[_0x7c5c('0x57')]['id']){delete _0x10aeaa['body']['id'];}return db[_0x7c5c('0x3a')][_0x7c5c('0x55')]({'where':{'id':_0x10aeaa[_0x7c5c('0x54')]['id']}})[_0x7c5c('0x21')](handleEntityNotFound(_0x17ca2c,null))[_0x7c5c('0x21')](saveUpdates(_0x10aeaa[_0x7c5c('0x57')],null))[_0x7c5c('0x21')](respondWithResult(_0x17ca2c,null))[_0x7c5c('0x52')](handleError(_0x17ca2c,null));};exports[_0x7c5c('0x58')]=function(_0x3fa01b,_0x35766e){return db['MailMessage'][_0x7c5c('0x55')]({'where':{'id':_0x3fa01b[_0x7c5c('0x54')]['id']}})[_0x7c5c('0x21')](handleEntityNotFound(_0x35766e,null))[_0x7c5c('0x21')](removeEntity(_0x35766e,null))[_0x7c5c('0x52')](handleError(_0x35766e,null));};exports[_0x7c5c('0x59')]=function(_0x1a012b,_0x570aa7){return db[_0x7c5c('0x3a')][_0x7c5c('0x59')]()[_0x7c5c('0x21')](respondWithResult(_0x570aa7,null))[_0x7c5c('0x52')](handleError(_0x570aa7,null));};exports['create']=function(_0x46498b,_0x541133){return db[_0x7c5c('0x3a')][_0x7c5c('0x5a')](_0x46498b['body'])[_0x7c5c('0x21')](function(_0x184130){if(_0x184130){if(_0x184130[_0x7c5c('0x5b')]===_0x7c5c('0x5c')&&!_0x184130[_0x7c5c('0x5d')]){var _0x11f69f,_0x24b394,_0x2028e7;if(_0x46498b[_0x7c5c('0x57')]['to']){_0x24b394=_0x46498b[_0x7c5c('0x57')]['to'][_0x7c5c('0x5e')](',')[0x0];}return db[_0x7c5c('0x5f')][_0x7c5c('0x60')]({'where':{'id':_0x184130['MailAccountId']},'include':[{'model':db[_0x7c5c('0x61')],'as':_0x7c5c('0x62'),'include':[{'model':db[_0x7c5c('0x63')],'as':_0x7c5c('0x64'),'where':{'email':_0x24b394},'limit':0x1,'order':[[_0x7c5c('0x65'),_0x7c5c('0x66')]]}]},{'model':db[_0x7c5c('0x67')],'as':'Smtp','raw':!![]}]})['then'](function(_0x580223){_0x11f69f=_0x580223;if(_0x11f69f&&_0x11f69f[_0x7c5c('0x68')]){var _0x30eb22={'tls':{'rejectUnauthorized':![]}};if(_[_0x7c5c('0x69')](_0x11f69f[_0x7c5c('0x68')][_0x7c5c('0x6a')])){_0x30eb22[_0x7c5c('0x6b')]=_0x11f69f['Smtp']['host'];_0x30eb22[_0x7c5c('0x6c')]=_0x11f69f[_0x7c5c('0x68')][_0x7c5c('0x6c')];_0x30eb22['secure']=_0x11f69f[_0x7c5c('0x68')][_0x7c5c('0x6d')];if(_0x11f69f[_0x7c5c('0x68')][_0x7c5c('0x6e')]){_0x30eb22[_0x7c5c('0x6f')]={'user':_0x11f69f[_0x7c5c('0x68')]['user'],'pass':_0x11f69f[_0x7c5c('0x68')][_0x7c5c('0x70')]};}}else{_0x30eb22[_0x7c5c('0x6a')]=_0x11f69f[_0x7c5c('0x68')]['service'];_0x30eb22[_0x7c5c('0x6f')]={'user':_0x11f69f['Smtp'][_0x7c5c('0x71')],'pass':_0x11f69f[_0x7c5c('0x68')][_0x7c5c('0x70')]};_0x30eb22[_0x7c5c('0x6d')]=_0x11f69f[_0x7c5c('0x68')][_0x7c5c('0x6d')];}if(_0x46498b[_0x7c5c('0x57')]['attachments']&&_0x46498b[_0x7c5c('0x57')][_0x7c5c('0x72')][_0x7c5c('0x44')]){for(var _0xc8ed55=0x0;_0xc8ed55<_0x46498b[_0x7c5c('0x57')]['attachments']['length'];_0xc8ed55+=0x1){_0x46498b['body']['attachments'][_0xc8ed55]={'filename':_0x46498b[_0x7c5c('0x57')][_0x7c5c('0x72')][_0xc8ed55][_0x7c5c('0x36')],'path':path['join'](config['root'],_0x7c5c('0x73'),_0x46498b[_0x7c5c('0x57')]['attachments'][_0xc8ed55][_0x7c5c('0x74')])};}}_0x2028e7={'account':_0x30eb22,'message':_0x46498b[_0x7c5c('0x57')]};return;}})[_0x7c5c('0x21')](function(){if(_0x11f69f[_0x7c5c('0x62')]){if(_0x11f69f[_0x7c5c('0x62')][_0x7c5c('0x64')]['length']){return _0x11f69f[_0x7c5c('0x62')]['Contacts'][0x0];}else{return db['CmContact'][_0x7c5c('0x5a')](_[_0x7c5c('0x14')](_0x46498b[_0x7c5c('0x57')],{'firstName':_0x46498b[_0x7c5c('0x57')]['to'],'email':_0x46498b[_0x7c5c('0x57')]['to'],'phone':_0x46498b[_0x7c5c('0x57')]['to'],'ListId':_0x11f69f[_0x7c5c('0x75')]}));}}else{throw new Error('List\x20not\x20found');}})[_0x7c5c('0x21')](function(){if(_0x2028e7){return respondWithRpcPromise(_0x7c5c('0x76'),_0x7c5c('0x77'),_0x2028e7,client9003)[_0x7c5c('0x21')](function(_0xdc9f2d){return _0x184130[_0x7c5c('0x56')]({'read':!![],'messageId':_0xdc9f2d[_0x7c5c('0x78')],'sentAt':moment()[_0x7c5c('0x79')]('YYYY-MM-DD\x20HH:mm:ss')});})['catch'](function(_0x192eda){logger[_0x7c5c('0x28')]('%s',JSON[_0x7c5c('0x27')](_0x192eda));return _0x184130;});}return _0x184130;});}return _0x184130;}})[_0x7c5c('0x21')](respondWithResult(_0x541133,0xc9))['catch'](handleError(_0x541133,null));};var interaction_log=require('../../config/logger')(_0x7c5c('0x7a'));exports[_0x7c5c('0x7b')]=function(_0x369bd4,_0x389493,_0x29d55e){var _0x4e1b7c={'channel':_0x7c5c('0x7c')};if(_0x369bd4[_0x7c5c('0x57')]['id']){delete _0x369bd4['body']['id'];}_0x369bd4[_0x7c5c('0x57')]['read']=!![];_0x369bd4['body']['readAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x369bd4[_0x7c5c('0x57')][_0x7c5c('0x7d')]=_0x369bd4[_0x7c5c('0x57')][_0x7c5c('0x7d')]||_0x369bd4[_0x7c5c('0x71')]['id'];return db[_0x7c5c('0x3a')][_0x7c5c('0x55')]({'where':{'id':_0x369bd4[_0x7c5c('0x54')]['id'],'UserId':null},'include':[{'model':db[_0x7c5c('0x63')],'as':_0x7c5c('0x7e')}]})[_0x7c5c('0x21')](handleEntityNotFound(_0x389493,null))[_0x7c5c('0x21')](saveUpdates(_0x369bd4[_0x7c5c('0x57')],null))['then'](function(_0xfa5388){if(_0xfa5388){_0x4e1b7c[_0x7c5c('0x29')]=_0xfa5388[_0x7c5c('0x7f')]({'plain':!![]});return db[_0x7c5c('0x80')]['find']({'where':{'id':_0xfa5388[_0x7c5c('0x81')]}});}return null;})[_0x7c5c('0x21')](handleEntityNotFound(_0x389493,null))[_0x7c5c('0x21')](function(_0x4657bb){if(_0x4657bb){return _0x4657bb[_0x7c5c('0x56')]({'UserId':_0x369bd4[_0x7c5c('0x57')][_0x7c5c('0x7d')],'read1stAt':_[_0x7c5c('0x69')](_0x4657bb[_0x7c5c('0x82')])?moment()[_0x7c5c('0x79')](_0x7c5c('0x83')):undefined});}return null;})['then'](function(_0x4ff4c1){if(_0x4ff4c1){_0x4e1b7c[_0x7c5c('0x84')]=_0x4ff4c1[_0x7c5c('0x7f')]({'plain':!![]});interaction_log[_0x7c5c('0x22')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x369bd4[_0x7c5c('0x71')]['id'],_0x369bd4[_0x7c5c('0x71')][_0x7c5c('0x36')],_0x369bd4['user'][_0x7c5c('0x85')],_0x4e1b7c[_0x7c5c('0x84')]['id'],_0x369bd4[_0x7c5c('0x57')]?JSON[_0x7c5c('0x27')](_0x369bd4[_0x7c5c('0x57')]):_0x7c5c('0x86'));return respondWithRpcPromise(_0x7c5c('0x87'),_0x7c5c('0x88'),_0x4e1b7c);}return null;})[_0x7c5c('0x21')](function(_0x51e6a2){if(_0x51e6a2){if(_0x369bd4[_0x7c5c('0x57')][_0x7c5c('0x89')]){_0x4e1b7c['message']['interface']=util[_0x7c5c('0x79')](_0x7c5c('0x8a'),_0x369bd4[_0x7c5c('0x71')][_0x7c5c('0x36')]);_0x4e1b7c[_0x7c5c('0x29')][_0x7c5c('0x8b')]=_0x4e1b7c[_0x7c5c('0x8b')];_0x4e1b7c[_0x7c5c('0x29')][_0x7c5c('0x8c')]='accept';return respondWithRpcPromise(_0x7c5c('0x8d'),_0x7c5c('0x8d'),{'event':_0x7c5c('0x8e'),'message':_0x4e1b7c[_0x7c5c('0x29')]},client9002)[_0x7c5c('0x21')](function(){return _0x4e1b7c;});}return _0x4e1b7c;}return null;})['then'](respondWithResult(_0x389493,null))[_0x7c5c('0x52')](handleError(_0x389493,null));};var interaction_log=require(_0x7c5c('0x8f'))('mail-interactions');exports[_0x7c5c('0x90')]=function(_0xaa55fa,_0x2e45e0,_0x3c0cb1){var _0x4a23db={'agent':{},'channel':_0x7c5c('0x7c')};if(_0xaa55fa[_0x7c5c('0x57')]['id']){delete _0xaa55fa[_0x7c5c('0x57')]['id'];}_0xaa55fa[_0x7c5c('0x57')][_0x7c5c('0x7d')]=_0xaa55fa[_0x7c5c('0x57')]['UserId']||_0xaa55fa[_0x7c5c('0x71')]['id'];_0x4a23db[_0x7c5c('0x91')]['id']=_0xaa55fa['body'][_0x7c5c('0x7d')];return db[_0x7c5c('0x3a')][_0x7c5c('0x55')]({'where':{'id':_0xaa55fa[_0x7c5c('0x54')]['id'],'UserId':null}})[_0x7c5c('0x21')](handleEntityNotFound(_0x2e45e0,null))[_0x7c5c('0x21')](function(_0xbcccba){if(_0xbcccba){_0x4a23db[_0x7c5c('0x29')]=_0xbcccba[_0x7c5c('0x7f')]({'plain':!![]});return db[_0x7c5c('0x80')][_0x7c5c('0x55')]({'where':{'id':_0xbcccba[_0x7c5c('0x81')]}});}return null;})[_0x7c5c('0x21')](handleEntityNotFound(_0x2e45e0,null))[_0x7c5c('0x21')](function(_0x164f79){if(_0x164f79){_0x4a23db[_0x7c5c('0x84')]=_0x164f79['get']({'plain':!![]});interaction_log[_0x7c5c('0x22')](_0x7c5c('0x92'),_0xaa55fa['user']['id'],_0xaa55fa[_0x7c5c('0x71')][_0x7c5c('0x36')],_0xaa55fa[_0x7c5c('0x71')]['role'],_0x4a23db['interaction']['id'],_0xaa55fa[_0x7c5c('0x57')]?JSON[_0x7c5c('0x27')](_0xaa55fa[_0x7c5c('0x57')]):_0x7c5c('0x86'));return respondWithRpcPromise(_0x7c5c('0x93'),_0x7c5c('0x94'),_0x4a23db);}return null;})[_0x7c5c('0x21')](function(_0x320f79){if(_0x320f79){_0x320f79['message'][_0x7c5c('0x95')]=util[_0x7c5c('0x79')](_0x7c5c('0x8a'),_0xaa55fa[_0x7c5c('0x71')][_0x7c5c('0x36')]);_0x320f79['message'][_0x7c5c('0x8b')]=_0x4a23db[_0x7c5c('0x8b')];_0x320f79['message']['event']=_0x7c5c('0x90');respondWithRpcPromise(_0x7c5c('0x8d'),'EventManager',{'event':'rejectmessage','message':_0x320f79[_0x7c5c('0x29')]},client9002);return _0x4a23db;}return null;})[_0x7c5c('0x21')](respondWithResult(_0x2e45e0,null))[_0x7c5c('0x52')](handleError(_0x2e45e0,null));};exports[_0x7c5c('0x96')]=function(_0x5718e0,_0x3b4f6f){var _0x37cf52=moment()[_0x7c5c('0x97')]()[_0x7c5c('0x98')]();var _0x2b637e=path[_0x7c5c('0x99')](config[_0x7c5c('0x9a')],'server',_0x7c5c('0x9b'),'tmp');var _0x218694=path[_0x7c5c('0x99')](config[_0x7c5c('0x9a')],'server',_0x7c5c('0x9b'),_0x7c5c('0x72'));var _0x32f547=util[_0x7c5c('0x79')](_0x7c5c('0x9c'),_0x37cf52);return db[_0x7c5c('0x3a')]['find']({'where':{'id':_0x5718e0[_0x7c5c('0x54')]['id']},'attributes':['id',_0x7c5c('0x57'),_0x7c5c('0x9d'),'to','cc','bcc',_0x7c5c('0x9e'),'createdAt'],'include':_0x5718e0['query'][_0x7c5c('0x72')]?[{'model':db[_0x7c5c('0x9f')],'as':_0x7c5c('0xa0')}]:undefined})[_0x7c5c('0x21')](handleEntityNotFound(_0x3b4f6f,null))[_0x7c5c('0x21')](function(_0x281f19){if(_0x281f19){var _0x3d0442=_0x281f19;var _0xeaab22={'from':_0x3d0442[_0x7c5c('0x9d')],'to':_0x3d0442['to'],'subject':_0x3d0442[_0x7c5c('0x9e')],'html':_0x3d0442[_0x7c5c('0x57')],'headers':{'Date':moment(_0x3d0442['createdAt'])[_0x7c5c('0x79')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x281f19['cc']){_0xeaab22[_0x7c5c('0xa1')]['Cc']=_0x281f19['cc'];}if(_0x281f19[_0x7c5c('0xa2')]){_0xeaab22[_0x7c5c('0xa1')][_0x7c5c('0xa3')]=_0x281f19['bcc'];}return new BPromise(function(_0x4aa1d9,_0x1de7df){if(_0x281f19[_0x7c5c('0xa0')]){for(var _0x3a5d60=0x0;_0x3a5d60<_0x281f19[_0x7c5c('0xa0')][_0x7c5c('0x44')];_0x3a5d60++){var _0x21ff1e=_0x281f19[_0x7c5c('0xa0')][_0x3a5d60];var _0x20de48=path[_0x7c5c('0x99')](_0x218694,_0x21ff1e[_0x7c5c('0x74')]);if(fs[_0x7c5c('0xa4')](_0x20de48)){_0xeaab22['attachments']['push']({'name':_0x21ff1e['name'],'contentType':_0x21ff1e[_0x7c5c('0x3d')],'data':fs[_0x7c5c('0xa5')](_0x20de48)});}}}emlformat[_0x7c5c('0xa6')](_0xeaab22,function(_0x3a2fed,_0x197722){if(_0x3a2fed)return _0x1de7df(_0x3a2fed);fs[_0x7c5c('0xa7')](path[_0x7c5c('0x99')](_0x2b637e,_0x32f547),_0x197722);return _0x4aa1d9(_0x197722);});});}})[_0x7c5c('0x21')](function(_0x3b9b4a){if(_0x3b9b4a){return _0x3b4f6f['download'](path[_0x7c5c('0x99')](_0x2b637e,_0x32f547),_0x32f547,function(_0x16ce8c){if(_0x16ce8c){console['log']('err',_0x16ce8c);}else{fs[_0x7c5c('0xa8')](path[_0x7c5c('0x99')](_0x2b637e,_0x32f547));}});}})[_0x7c5c('0x52')](handleError(_0x3b4f6f,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 07d5d19..0367de0 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 _0xc6d4=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners'];(function(_0x565f74,_0x7e45f8){var _0x1c0d7c=function(_0x34137b){while(--_0x34137b){_0x565f74['push'](_0x565f74['shift']());}};_0x1c0d7c(++_0x7e45f8);}(_0xc6d4,0xe7));var _0x4c6d=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xc6d4[_0x5b644e];return _0x49c6bf;};'use strict';var EventEmitter=require(_0x4c6d('0x0'));var MailMessage=require(_0x4c6d('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x4c6d('0x2')](0x0);var events={'afterCreate':_0x4c6d('0x3'),'afterUpdate':_0x4c6d('0x4'),'afterDestroy':_0x4c6d('0x5')};function emitEvent(_0x885322){return function(_0x39ec91,_0x6e7df7,_0x58419b){MailMessageEvents[_0x4c6d('0x6')](_0x885322+':'+_0x39ec91['id'],_0x39ec91);MailMessageEvents[_0x4c6d('0x6')](_0x885322,_0x39ec91);_0x58419b(null);};}for(var e in events){if(events[_0x4c6d('0x7')](e)){var event=events[e];MailMessage[_0x4c6d('0x8')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0x2671=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','update'];(function(_0x244f1d,_0x55121b){var _0x3da4b9=function(_0x107ac3){while(--_0x107ac3){_0x244f1d['push'](_0x244f1d['shift']());}};_0x3da4b9(++_0x55121b);}(_0x2671,0x18b));var _0x1267=function(_0xa25342,_0x24522b){_0xa25342=_0xa25342-0x0;var _0x52be43=_0x2671[_0xa25342];return _0x52be43;};'use strict';var EventEmitter=require(_0x1267('0x0'));var MailMessage=require(_0x1267('0x1'))['db'][_0x1267('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x1267('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1267('0x4'),'afterDestroy':_0x1267('0x5')};function emitEvent(_0x561e2b){return function(_0x14d490,_0x3a2fdb,_0x206791){MailMessageEvents[_0x1267('0x6')](_0x561e2b+':'+_0x14d490['id'],_0x14d490);MailMessageEvents[_0x1267('0x6')](_0x561e2b,_0x14d490);_0x206791(null);};}for(var e in events){if(events[_0x1267('0x7')](e)){var event=events[e];MailMessage[_0x1267('0x8')](e,emitEvent(event));}}module[_0x1267('0x9')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index ae7bdce..7baff76 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 _0xacb1=['toLowerCase','out','MailInteraction','findOne','MailInteractionId','update','catch','error','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','MailMessage','mail_messages','messageId','plainBody','subject','body','models','get','direction'];(function(_0x5a7618,_0x3f44c2){var _0x12dc65=function(_0x3cc4cd){while(--_0x3cc4cd){_0x5a7618['push'](_0x5a7618['shift']());}};_0x12dc65(++_0x3f44c2);}(_0xacb1,0x148));var _0x1acb=function(_0x1f6a6f,_0x44acc6){_0x1f6a6f=_0x1f6a6f-0x0;var _0x2cea61=_0xacb1[_0x1f6a6f];return _0x2cea61;};'use strict';var _=require(_0x1acb('0x0'));var util=require('util');var logger=require(_0x1acb('0x1'))(_0x1acb('0x2'));var moment=require(_0x1acb('0x3'));var BPromise=require('bluebird');var rp=require(_0x1acb('0x4'));var htmlToText=require(_0x1acb('0x5'));var fs=require('fs');var path=require(_0x1acb('0x6'));var rimraf=require(_0x1acb('0x7'));var config=require(_0x1acb('0x8'));var attributes=require(_0x1acb('0x9'));module[_0x1acb('0xa')]=function(_0x34bbee,_0x34029d){return _0x34bbee['define'](_0x1acb('0xb'),attributes,{'tableName':_0x1acb('0xc'),'paranoid':![],'indexes':[{'name':_0x1acb('0xd'),'fields':[_0x1acb('0xd')]},{'name':'fti_mail_messages','fields':[_0x1acb('0xe'),_0x1acb('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x223f17,_0x3cd7a6,_0x2769ea){if(_0x223f17[_0x1acb('0x10')]){_0x223f17['plainBody']=htmlToText['fromString'](_0x223f17[_0x1acb('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x2769ea(null,_0x3cd7a6);},'afterCreate':function(_0x969b26,_0x577e5e,_0x4be936){var _0xe5559e=_0x34bbee[_0x1acb('0x11')];var _0x50b94c=_0x969b26[_0x1acb('0x12')]({'plain':!![]});if(_0x50b94c[_0x1acb('0x13')][_0x1acb('0x14')]()==='in'||_0x50b94c[_0x1acb('0x13')]['toLowerCase']()===_0x1acb('0x15')&&!_0x50b94c['secret']&&!_['isNil'](_0x50b94c['UserId'])){_0xe5559e[_0x1acb('0x16')][_0x1acb('0x17')]({'where':{'id':_0x50b94c[_0x1acb('0x18')]}})['then'](function(_0x201df0){if(_0x201df0){_0x201df0[_0x1acb('0x19')]({'lastMsgAt':_0x50b94c['createdAt'],'lastMsgDirection':_0x50b94c['direction'][_0x1acb('0x14')](),'lastMsgBody':_0x50b94c['body']});}})[_0x1acb('0x1a')](function(_0x29ab8b){console[_0x1acb('0x1b')](_0x29ab8b);});}_0x4be936();}},'charset':'utf8mb4','collate':_0x1acb('0x1c')});}; \ No newline at end of file +var _0x54ce=['get','direction','toLowerCase','secret','isNil','findOne','MailInteractionId','then','update','createdAt','body','catch','lodash','util','../../config/logger','moment','request-promise','html-to-text','../../config/environment','./mailMessage.attributes','exports','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','fromString'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x54ce,0xf4));var _0xe54c=function(_0x4e7ded,_0x4a90c7){_0x4e7ded=_0x4e7ded-0x0;var _0x4ebf73=_0x54ce[_0x4e7ded];return _0x4ebf73;};'use strict';var _=require(_0xe54c('0x0'));var util=require(_0xe54c('0x1'));var logger=require(_0xe54c('0x2'))('api');var moment=require(_0xe54c('0x3'));var BPromise=require('bluebird');var rp=require(_0xe54c('0x4'));var htmlToText=require(_0xe54c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe54c('0x6'));var attributes=require(_0xe54c('0x7'));module[_0xe54c('0x8')]=function(_0x4d71d4,_0x1ad32a){return _0x4d71d4['define'](_0xe54c('0x9'),attributes,{'tableName':_0xe54c('0xa'),'paranoid':![],'indexes':[{'name':_0xe54c('0xb'),'fields':[_0xe54c('0xb')]},{'name':_0xe54c('0xc'),'fields':[_0xe54c('0xd'),_0xe54c('0xe')],'type':_0xe54c('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xcd61c0,_0x59e7f4,_0x4ee2c4){if(_0xcd61c0['body']){_0xcd61c0[_0xe54c('0xd')]=htmlToText[_0xe54c('0x10')](_0xcd61c0['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x4ee2c4(null,_0x59e7f4);},'afterCreate':function(_0x419149,_0x19e0f3,_0x4631f7){var _0x1997ce=_0x4d71d4['models'];var _0x4ae74f=_0x419149[_0xe54c('0x11')]({'plain':!![]});if(_0x4ae74f[_0xe54c('0x12')][_0xe54c('0x13')]()==='in'||_0x4ae74f[_0xe54c('0x12')][_0xe54c('0x13')]()==='out'&&!_0x4ae74f[_0xe54c('0x14')]&&!_[_0xe54c('0x15')](_0x4ae74f['UserId'])){_0x1997ce['MailInteraction'][_0xe54c('0x16')]({'where':{'id':_0x4ae74f[_0xe54c('0x17')]}})[_0xe54c('0x18')](function(_0x157cdb){if(_0x157cdb){_0x157cdb[_0xe54c('0x19')]({'lastMsgAt':_0x4ae74f[_0xe54c('0x1a')],'lastMsgDirection':_0x4ae74f[_0xe54c('0x12')][_0xe54c('0x13')](),'lastMsgBody':_0x4ae74f[_0xe54c('0x1b')]});}})[_0xe54c('0x1c')](function(_0xd8148a){console['error'](_0xd8148a);});}_0x4631f7();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index edd458f..8d8e547 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 _0x0c23=['localhost','socket.io-emitter','register','request','then','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailMessage,\x20%s,\x20%s','message','info','result','catch','CreateMailMessage','MailMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis'];(function(_0x39ae31,_0x26a95d){var _0x2016f5=function(_0xe9923e){while(--_0xe9923e){_0x39ae31['push'](_0x39ae31['shift']());}};_0x2016f5(++_0x26a95d);}(_0x0c23,0x13e));var _0x30c2=function(_0x3c29cf,_0x3edfce){_0x3c29cf=_0x3c29cf-0x0;var _0x8e5a9b=_0x0c23[_0x3c29cf];return _0x8e5a9b;};'use strict';var _=require(_0x30c2('0x0'));var util=require(_0x30c2('0x1'));var moment=require(_0x30c2('0x2'));var BPromise=require(_0x30c2('0x3'));var rs=require(_0x30c2('0x4'));var fs=require('fs');var Redis=require(_0x30c2('0x5'));var db=require(_0x30c2('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x30c2('0x7'))(_0x30c2('0x8'));var config=require(_0x30c2('0x9'));var jayson=require(_0x30c2('0xa'));var client=jayson[_0x30c2('0xb')][_0x30c2('0xc')]({'port':0x232a});config['redis']=_[_0x30c2('0xd')](config[_0x30c2('0xe')],{'host':_0x30c2('0xf'),'port':0x18eb});var socket=require(_0x30c2('0x10'))(new Redis(config[_0x30c2('0xe')]));require('./mailMessage.socket')[_0x30c2('0x11')](socket);function respondWithRpcPromise(_0x2b6595,_0x4bd5be,_0x3365c5){return new BPromise(function(_0x44e778,_0x40f639){return client[_0x30c2('0x12')](_0x2b6595,_0x3365c5)[_0x30c2('0x13')](function(_0x17eb67){logger['info']('MailMessage,\x20%s,\x20%s',_0x4bd5be,'request\x20sent');logger[_0x30c2('0x14')](_0x30c2('0x15'),_0x4bd5be,_0x30c2('0x16'),JSON[_0x30c2('0x17')](_0x17eb67));if(_0x17eb67[_0x30c2('0x18')]){if(_0x17eb67[_0x30c2('0x18')][_0x30c2('0x19')]===0x1f4){logger['error'](_0x30c2('0x1a'),_0x4bd5be,_0x17eb67[_0x30c2('0x18')]['message']);return _0x40f639(_0x17eb67[_0x30c2('0x18')][_0x30c2('0x1b')]);}logger[_0x30c2('0x18')](_0x30c2('0x1a'),_0x4bd5be,_0x17eb67[_0x30c2('0x18')][_0x30c2('0x1b')]);return _0x44e778(_0x17eb67[_0x30c2('0x18')][_0x30c2('0x1b')]);}else{logger[_0x30c2('0x1c')](_0x30c2('0x1a'),_0x4bd5be,_0x30c2('0x16'));_0x44e778(_0x17eb67[_0x30c2('0x1d')]['message']);}})[_0x30c2('0x1e')](function(_0x48697c){logger['error'](_0x30c2('0x1a'),_0x4bd5be,_0x48697c);_0x40f639(_0x48697c);});});}exports[_0x30c2('0x1f')]=function(_0x8f7223){var _0x5ac53a=this;return new Promise(function(_0x2875dd,_0x1d0b52){return db[_0x30c2('0x20')][_0x30c2('0x21')](_0x8f7223[_0x30c2('0x22')],{'raw':_0x8f7223[_0x30c2('0x23')]?_0x8f7223[_0x30c2('0x23')][_0x30c2('0x24')]===undefined?!![]:![]:!![]})['then'](function(_0x57b861){logger[_0x30c2('0x1c')](_0x30c2('0x1f'),_0x8f7223);logger[_0x30c2('0x14')](_0x30c2('0x1f'),_0x8f7223,JSON[_0x30c2('0x17')](_0x57b861));_0x2875dd(_0x57b861);})['catch'](function(_0x1c9cbd){logger[_0x30c2('0x18')](_0x30c2('0x1f'),_0x1c9cbd['message'],_0x8f7223);_0x1d0b52(_0x5ac53a[_0x30c2('0x18')](0x1f4,_0x1c9cbd[_0x30c2('0x1b')]));});});}; \ No newline at end of file +var _0x8585=['redis','defaults','socket.io-emitter','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateMailMessage','create','body','options','raw','lodash','util','moment','randomstring','ioredis','rpc','../../config/environment','http'];(function(_0x463c2e,_0x2901e5){var _0xfe809e=function(_0x526341){while(--_0x526341){_0x463c2e['push'](_0x463c2e['shift']());}};_0xfe809e(++_0x2901e5);}(_0x8585,0x64));var _0x5858=function(_0x4b2a59,_0x4c0aed){_0x4b2a59=_0x4b2a59-0x0;var _0x425ef3=_0x8585[_0x4b2a59];return _0x425ef3;};'use strict';var _=require(_0x5858('0x0'));var util=require(_0x5858('0x1'));var moment=require(_0x5858('0x2'));var BPromise=require('bluebird');var rs=require(_0x5858('0x3'));var fs=require('fs');var Redis=require(_0x5858('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5858('0x5'));var config=require(_0x5858('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5858('0x7')]({'port':0x232a});config[_0x5858('0x8')]=_[_0x5858('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5858('0xa'))(new Redis(config[_0x5858('0x8')]));require('./mailMessage.socket')['register'](socket);function respondWithRpcPromise(_0x3b8121,_0x420f75,_0x4f25d6){return new BPromise(function(_0x2c8b1f,_0x264f64){return client[_0x5858('0xb')](_0x3b8121,_0x4f25d6)[_0x5858('0xc')](function(_0x28aa4f){logger[_0x5858('0xd')](_0x5858('0xe'),_0x420f75,_0x5858('0xf'));logger[_0x5858('0x10')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x420f75,_0x5858('0xf'),JSON[_0x5858('0x11')](_0x28aa4f));if(_0x28aa4f[_0x5858('0x12')]){if(_0x28aa4f['error'][_0x5858('0x13')]===0x1f4){logger[_0x5858('0x12')](_0x5858('0xe'),_0x420f75,_0x28aa4f[_0x5858('0x12')][_0x5858('0x14')]);return _0x264f64(_0x28aa4f[_0x5858('0x12')][_0x5858('0x14')]);}logger[_0x5858('0x12')](_0x5858('0xe'),_0x420f75,_0x28aa4f[_0x5858('0x12')][_0x5858('0x14')]);return _0x2c8b1f(_0x28aa4f[_0x5858('0x12')][_0x5858('0x14')]);}else{logger[_0x5858('0xd')](_0x5858('0xe'),_0x420f75,_0x5858('0xf'));_0x2c8b1f(_0x28aa4f['result'][_0x5858('0x14')]);}})[_0x5858('0x15')](function(_0x446ce1){logger['error'](_0x5858('0xe'),_0x420f75,_0x446ce1);_0x264f64(_0x446ce1);});});}exports[_0x5858('0x16')]=function(_0x178f7e){var _0x48a0fb=this;return new Promise(function(_0x23097e,_0x229fe4){return db['MailMessage'][_0x5858('0x17')](_0x178f7e[_0x5858('0x18')],{'raw':_0x178f7e[_0x5858('0x19')]?_0x178f7e[_0x5858('0x19')][_0x5858('0x1a')]===undefined?!![]:![]:!![]})[_0x5858('0xc')](function(_0x1d772c){logger[_0x5858('0xd')](_0x5858('0x16'),_0x178f7e);logger['debug'](_0x5858('0x16'),_0x178f7e,JSON[_0x5858('0x11')](_0x1d772c));_0x23097e(_0x1d772c);})[_0x5858('0x15')](function(_0x33f528){logger['error']('CreateMailMessage',_0x33f528[_0x5858('0x14')],_0x178f7e);_0x229fe4(_0x48a0fb[_0x5858('0x12')](0x1f4,_0x33f528['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 5b4137a..542782a 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 _0xfd65=['emit','removeListener','register','length','mailMessage:','update'];(function(_0x1935f6,_0xee595c){var _0x407257=function(_0x109e2a){while(--_0x109e2a){_0x1935f6['push'](_0x1935f6['shift']());}};_0x407257(++_0xee595c);}(_0xfd65,0x13d));var _0x5fd6=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0xfd65[_0x9c2427];return _0x51984f;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=['save','remove',_0x5fd6('0x0')];function createListener(_0x1769a5,_0x47ea01){return function(_0x469835){_0x47ea01[_0x5fd6('0x1')](_0x1769a5,_0x469835);};}function removeListener(_0x11bdad,_0x3e8384){return function(){MailMessageEvents[_0x5fd6('0x2')](_0x11bdad,_0x3e8384);};}exports[_0x5fd6('0x3')]=function(_0x2daf43){for(var _0x4865ee=0x0,_0x57018f=events[_0x5fd6('0x4')];_0x4865ee<_0x57018f;_0x4865ee++){var _0x23542d=events[_0x4865ee];var _0xd8153e=createListener(_0x5fd6('0x5')+_0x23542d,_0x2daf43);MailMessageEvents['on'](_0x23542d,_0xd8153e);}}; \ No newline at end of file +var _0xa9b1=['mailMessage:','remove','update','emit','register','length'];(function(_0x3476db,_0x5f769c){var _0x535bcb=function(_0x2b799e){while(--_0x2b799e){_0x3476db['push'](_0x3476db['shift']());}};_0x535bcb(++_0x5f769c);}(_0xa9b1,0x133));var _0x1a9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9b1[_0x3dd15e];return _0x231fd0;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=['save',_0x1a9b('0x0'),_0x1a9b('0x1')];function createListener(_0x11c1ff,_0x3f42db){return function(_0xc88712){_0x3f42db[_0x1a9b('0x2')](_0x11c1ff,_0xc88712);};}function removeListener(_0x52f55f,_0x57b453){return function(){MailMessageEvents['removeListener'](_0x52f55f,_0x57b453);};}exports[_0x1a9b('0x3')]=function(_0x15861d){for(var _0x1a78b6=0x0,_0xc55657=events[_0x1a9b('0x4')];_0x1a78b6<_0xc55657;_0x1a78b6++){var _0x16c344=events[_0x1a78b6];var _0x263b84=createListener(_0x1a9b('0x5')+_0x16c344,_0x15861d);MailMessageEvents['on'](_0x16c344,_0x263b84);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index d94207b..7b91459 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 _0x83e0=['addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','/describe','describe','/:id/teams','/:id/users','getAgents','post','create','addTeams'];(function(_0xf124f0,_0x4e1e1c){var _0x291bd7=function(_0x317442){while(--_0x317442){_0xf124f0['push'](_0xf124f0['shift']());}};_0x291bd7(++_0x4e1e1c);}(_0x83e0,0x1cf));var _0x083e=function(_0x3340cf,_0x2ac2d9){_0x3340cf=_0x3340cf-0x0;var _0x14b17=_0x83e0[_0x3340cf];return _0x14b17;};'use strict';var multer=require(_0x083e('0x0'));var util=require('util');var path=require(_0x083e('0x1'));var timeout=require('connect-timeout');var express=require(_0x083e('0x2'));var router=express['Router']();var auth=require(_0x083e('0x3'));var interaction=require(_0x083e('0x4'));var config=require(_0x083e('0x5'));var controller=require(_0x083e('0x6'));router[_0x083e('0x7')]('/',auth[_0x083e('0x8')](),controller['index']);router['get'](_0x083e('0x9'),auth[_0x083e('0x8')](),controller[_0x083e('0xa')]);router[_0x083e('0x7')]('/:id',auth[_0x083e('0x8')](),controller['show']);router[_0x083e('0x7')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0x083e('0x7')](_0x083e('0xb'),auth[_0x083e('0x8')](),controller['getTeams']);router['get'](_0x083e('0xc'),auth[_0x083e('0x8')](),controller[_0x083e('0xd')]);router[_0x083e('0xe')]('/',auth['isAuthenticated'](),controller[_0x083e('0xf')]);router['post'](_0x083e('0xb'),auth['isAuthenticated'](),controller[_0x083e('0x10')]);router[_0x083e('0xe')]('/:id/users',auth['isAuthenticated'](),controller[_0x083e('0x11')]);router[_0x083e('0x12')](_0x083e('0x13'),auth['isAuthenticated'](),controller['update']);router[_0x083e('0x14')]('/:id',auth[_0x083e('0x8')](),controller[_0x083e('0x15')]);router[_0x083e('0x14')](_0x083e('0xb'),auth[_0x083e('0x8')](),controller['removeTeams']);router[_0x083e('0x14')](_0x083e('0xc'),auth[_0x083e('0x8')](),controller[_0x083e('0x16')]);module[_0x083e('0x17')]=router; \ No newline at end of file +var _0xf3c1=['index','get','/describe','isAuthenticated','describe','/:id','show','getMembers','getTeams','/:id/users','getAgents','post','/:id/teams','addTeams','addAgents','put','update','delete','removeTeams','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./mailQueue.controller'];(function(_0x6199ac,_0x459dda){var _0x580def=function(_0x5e654f){while(--_0x5e654f){_0x6199ac['push'](_0x6199ac['shift']());}};_0x580def(++_0x459dda);}(_0xf3c1,0x12c));var _0x1f3c=function(_0x2bfa06,_0x351e03){_0x2bfa06=_0x2bfa06-0x0;var _0x58811b=_0xf3c1[_0x2bfa06];return _0x58811b;};'use strict';var multer=require(_0x1f3c('0x0'));var util=require(_0x1f3c('0x1'));var path=require(_0x1f3c('0x2'));var timeout=require(_0x1f3c('0x3'));var express=require('express');var router=express[_0x1f3c('0x4')]();var auth=require(_0x1f3c('0x5'));var interaction=require(_0x1f3c('0x6'));var config=require('../../config/environment');var controller=require(_0x1f3c('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x1f3c('0x8')]);router[_0x1f3c('0x9')](_0x1f3c('0xa'),auth[_0x1f3c('0xb')](),controller[_0x1f3c('0xc')]);router[_0x1f3c('0x9')](_0x1f3c('0xd'),auth[_0x1f3c('0xb')](),controller[_0x1f3c('0xe')]);router[_0x1f3c('0x9')]('/:id/members',auth[_0x1f3c('0xb')](),controller[_0x1f3c('0xf')]);router[_0x1f3c('0x9')]('/:id/teams',auth['isAuthenticated'](),controller[_0x1f3c('0x10')]);router['get'](_0x1f3c('0x11'),auth['isAuthenticated'](),controller[_0x1f3c('0x12')]);router['post']('/',auth[_0x1f3c('0xb')](),controller['create']);router[_0x1f3c('0x13')](_0x1f3c('0x14'),auth[_0x1f3c('0xb')](),controller[_0x1f3c('0x15')]);router[_0x1f3c('0x13')](_0x1f3c('0x11'),auth[_0x1f3c('0xb')](),controller[_0x1f3c('0x16')]);router[_0x1f3c('0x17')]('/:id',auth[_0x1f3c('0xb')](),controller[_0x1f3c('0x18')]);router[_0x1f3c('0x19')](_0x1f3c('0xd'),auth[_0x1f3c('0xb')](),controller['destroy']);router[_0x1f3c('0x19')]('/:id/teams',auth[_0x1f3c('0xb')](),controller[_0x1f3c('0x1a')]);router[_0x1f3c('0x19')](_0x1f3c('0x11'),auth[_0x1f3c('0xb')](),controller['removeAgents']);module[_0x1f3c('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 4ccdd97..8ed35f2 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 _0x6f8e=['STRING','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x5b576d,_0x34cffd){var _0x12a7b5=function(_0x26ddde){while(--_0x26ddde){_0x5b576d['push'](_0x5b576d['shift']());}};_0x12a7b5(++_0x34cffd);}(_0x6f8e,0x15a));var _0xe6f8=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x6f8e[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0xe6f8('0x0'));module[_0xe6f8('0x1')]={'name':{'type':Sequelize[_0xe6f8('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe6f8('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xe6f8('0x3'),_0xe6f8('0x4'),_0xe6f8('0x5'))}}; \ No newline at end of file +var _0xd9a4=['name','ENUM','rrmemory','roundrobin','sequelize','exports','STRING'];(function(_0x2e6eef,_0x13b333){var _0x5905fd=function(_0x4a196c){while(--_0x4a196c){_0x2e6eef['push'](_0x2e6eef['shift']());}};_0x5905fd(++_0x13b333);}(_0xd9a4,0x82));var _0x4d9a=function(_0x245afe,_0x319cde){_0x245afe=_0x245afe-0x0;var _0x4eefde=_0xd9a4[_0x245afe];return _0x4eefde;};'use strict';var Sequelize=require(_0x4d9a('0x0'));module[_0x4d9a('0x1')]={'name':{'type':Sequelize[_0x4d9a('0x2')],'unique':_0x4d9a('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4d9a('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4d9a('0x4')](_0x4d9a('0x5'),'beepall',_0x4d9a('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 1c7898c..741993d 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 _0x7e80=['getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','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','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','socket.io-emitter','redis','register','status','end','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','MailQueues','UserProfileResource','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','nolimit','sort','pick','where','filter','merge','options','MailQueue','count','includeAll','include','rows','catch','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserMailQueue','length','hasOwnProperty','findAll','findAndCountAll','agent','updatedAt','%s/%s','SIP','mailPause','createdAt','getTeams','order','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','userMailQueue:save','Team','User','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','SELECT','TeamId','includes','all','union','value','removeTeams','removeAgents','forEach','addAgents','omit','spread','isArray','userMailQueue:remove','findOne'];(function(_0x17265e,_0x5ee18f){var _0x29ab1e=function(_0x4bce9f){while(--_0x4bce9f){_0x17265e['push'](_0x17265e['shift']());}};_0x29ab1e(++_0x5ee18f);}(_0x7e80,0x125));var _0x07e8=function(_0x24e73b,_0x3cd8aa){_0x24e73b=_0x24e73b-0x0;var _0x4044b4=_0x7e80[_0x24e73b];return _0x4044b4;};'use strict';var pdf=require(_0x07e8('0x0'));var emlformat=require(_0x07e8('0x1'));var rimraf=require(_0x07e8('0x2'));var zipdir=require(_0x07e8('0x3'));var jsonpatch=require(_0x07e8('0x4'));var rp=require('request-promise');var moment=require(_0x07e8('0x5'));var BPromise=require(_0x07e8('0x6'));var Mustache=require('mustache');var util=require(_0x07e8('0x7'));var path=require(_0x07e8('0x8'));var sox=require(_0x07e8('0x9'));var csv=require(_0x07e8('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x07e8('0xb'));var crypto=require(_0x07e8('0xc'));var jsforce=require(_0x07e8('0xd'));var deskjs=require(_0x07e8('0xe'));var toCsv=require(_0x07e8('0xa'));var querystring=require(_0x07e8('0xf'));var Papa=require(_0x07e8('0x10'));var Redis=require(_0x07e8('0x11'));var authService=require(_0x07e8('0x12'));var qs=require(_0x07e8('0x13'));var as=require(_0x07e8('0x14'));var hardwareService=require(_0x07e8('0x15'));var logger=require(_0x07e8('0x16'))(_0x07e8('0x17'));var utils=require(_0x07e8('0x18'));var config=require(_0x07e8('0x19'));var db=require(_0x07e8('0x1a'))['db'];config['redis']=_[_0x07e8('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x07e8('0x1c'))(new Redis(config[_0x07e8('0x1d')]));require('./mailQueue.socket')[_0x07e8('0x1e')](socket);function respondWithStatusCode(_0x411166,_0x15ad02){_0x15ad02=_0x15ad02||0xcc;return function(_0x2a7837){if(_0x2a7837){return _0x411166['sendStatus'](_0x15ad02);}return _0x411166[_0x07e8('0x1f')](_0x15ad02)[_0x07e8('0x20')]();};}function respondWithResult(_0x15bc40,_0x5521e4){_0x5521e4=_0x5521e4||0xc8;return function(_0x3af52c){if(_0x3af52c){return _0x15bc40[_0x07e8('0x1f')](_0x5521e4)[_0x07e8('0x21')](_0x3af52c);}};}function respondWithFilteredResult(_0x5b9c4c,_0x2f245a){return function(_0x27ff4f){if(_0x27ff4f){var _0x3067a4=_0x27ff4f['count'],_0x333402=_0x2f245a['offset'],_0x30ab8e=_0x2f245a[_0x07e8('0x22')]+_0x2f245a[_0x07e8('0x23')],_0x567228;if(_0x30ab8e>=_0x3067a4){_0x30ab8e=_0x3067a4;_0x567228=0xc8;}else{_0x567228=0xce;}_0x5b9c4c[_0x07e8('0x1f')](_0x567228);return _0x5b9c4c[_0x07e8('0x24')](_0x07e8('0x25'),_0x333402+'-'+_0x30ab8e+'/'+_0x3067a4)['json'](_0x27ff4f);}return null;};}function patchUpdates(_0x5321e4){return function(_0x198352){try{jsonpatch['apply'](_0x198352,_0x5321e4,!![]);}catch(_0x1e0ea8){return BPromise[_0x07e8('0x26')](_0x1e0ea8);}return _0x198352[_0x07e8('0x27')]();};}function saveUpdates(_0x250c31,_0x232af6){return function(_0x52d41f){if(_0x52d41f){return _0x52d41f[_0x07e8('0x28')](_0x250c31)[_0x07e8('0x29')](function(_0x136d95){return _0x136d95;});}return null;};}function removeEntity(_0x2cd993,_0x38d12d){return function(_0x1fc879){if(_0x1fc879){return _0x1fc879[_0x07e8('0x2a')]()['then'](function(){var _0x5e8829=_0x1fc879['get']({'plain':!![]});var _0x380e2f=_0x07e8('0x2b');return db[_0x07e8('0x2c')][_0x07e8('0x2a')]({'where':{'type':_0x380e2f,'resourceId':_0x5e8829['id']}})[_0x07e8('0x29')](function(){return _0x1fc879;});})[_0x07e8('0x29')](function(){_0x2cd993[_0x07e8('0x1f')](0xcc)[_0x07e8('0x20')]();});}};}function handleEntityNotFound(_0x5ce481,_0x39b931){return function(_0x328fdb){if(!_0x328fdb){_0x5ce481[_0x07e8('0x2d')](0x194);}return _0x328fdb;};}function handleError(_0x378038,_0x2749a2){_0x2749a2=_0x2749a2||0x1f4;return function(_0x5326c8){logger['error'](_0x5326c8[_0x07e8('0x2e')]);if(_0x5326c8['name']){delete _0x5326c8[_0x07e8('0x2f')];}_0x378038['status'](_0x2749a2)[_0x07e8('0x30')](_0x5326c8);};}exports[_0x07e8('0x31')]=function(_0x4728fe,_0x25cae3){var _0x5cd330={},_0x27fc9e={},_0x141b84={'count':0x0,'rows':[]};var _0x3488b8=_['map'](db['MailQueue'][_0x07e8('0x32')],function(_0x4116b8){return{'name':_0x4116b8[_0x07e8('0x33')],'type':_0x4116b8[_0x07e8('0x34')][_0x07e8('0x35')]};});_0x27fc9e[_0x07e8('0x36')]=_[_0x07e8('0x37')](_0x3488b8,_0x07e8('0x2f'));_0x27fc9e[_0x07e8('0x38')]=_[_0x07e8('0x39')](_0x4728fe[_0x07e8('0x38')]);_0x27fc9e[_0x07e8('0x3a')]=_['intersection'](_0x27fc9e[_0x07e8('0x36')],_0x27fc9e[_0x07e8('0x38')]);_0x5cd330[_0x07e8('0x3b')]=_[_0x07e8('0x3c')](_0x27fc9e[_0x07e8('0x36')],qs[_0x07e8('0x3d')](_0x4728fe[_0x07e8('0x38')]['fields']));_0x5cd330[_0x07e8('0x3b')]=_0x5cd330[_0x07e8('0x3b')]['length']?_0x5cd330[_0x07e8('0x3b')]:_0x27fc9e[_0x07e8('0x36')];if(!_0x4728fe[_0x07e8('0x38')]['hasOwnProperty'](_0x07e8('0x3e'))){_0x5cd330['limit']=qs['limit'](_0x4728fe[_0x07e8('0x38')][_0x07e8('0x23')]);_0x5cd330['offset']=qs[_0x07e8('0x22')](_0x4728fe[_0x07e8('0x38')]['offset']);}_0x5cd330['order']=qs[_0x07e8('0x3f')](_0x4728fe['query']['sort']);_0x5cd330['where']=qs[_0x07e8('0x3a')](_[_0x07e8('0x40')](_0x4728fe[_0x07e8('0x38')],_0x27fc9e[_0x07e8('0x3a')]),_0x3488b8);if(_0x4728fe[_0x07e8('0x38')]['filter']){_0x5cd330[_0x07e8('0x41')]=_['merge'](_0x5cd330[_0x07e8('0x41')],{'$or':_[_0x07e8('0x37')](_0x3488b8,function(_0x9e1296){if(_0x9e1296['type']!=='VIRTUAL'){var _0x10dcec={};_0x10dcec[_0x9e1296[_0x07e8('0x2f')]]={'$like':'%'+_0x4728fe['query'][_0x07e8('0x42')]+'%'};return _0x10dcec;}})});}_0x5cd330=_[_0x07e8('0x43')]({},_0x5cd330,_0x4728fe[_0x07e8('0x44')]);var _0x10ed01={'where':_0x5cd330[_0x07e8('0x41')]};return db[_0x07e8('0x45')]['count'](_0x10ed01)[_0x07e8('0x29')](function(_0x263f8e){_0x141b84[_0x07e8('0x46')]=_0x263f8e;if(_0x4728fe['query'][_0x07e8('0x47')]){_0x5cd330[_0x07e8('0x48')]=[{'all':!![]}];}return db[_0x07e8('0x45')]['findAll'](_0x5cd330);})[_0x07e8('0x29')](function(_0x2b461b){_0x141b84[_0x07e8('0x49')]=_0x2b461b;return _0x141b84;})['then'](respondWithFilteredResult(_0x25cae3,_0x5cd330))[_0x07e8('0x4a')](handleError(_0x25cae3,null));};exports['show']=function(_0x481c26,_0x275218){var _0xc2637a={'raw':!![],'where':{'id':_0x481c26[_0x07e8('0x4b')]['id']}},_0x152fa2={};_0x152fa2[_0x07e8('0x36')]=_['keys'](db[_0x07e8('0x45')][_0x07e8('0x32')]);_0x152fa2['query']=_['keys'](_0x481c26[_0x07e8('0x38')]);_0x152fa2[_0x07e8('0x3a')]=_[_0x07e8('0x3c')](_0x152fa2[_0x07e8('0x36')],_0x152fa2[_0x07e8('0x38')]);_0xc2637a[_0x07e8('0x3b')]=_[_0x07e8('0x3c')](_0x152fa2[_0x07e8('0x36')],qs[_0x07e8('0x3d')](_0x481c26[_0x07e8('0x38')]['fields']));_0xc2637a['attributes']=_0xc2637a[_0x07e8('0x3b')]['length']?_0xc2637a[_0x07e8('0x3b')]:_0x152fa2[_0x07e8('0x36')];if(_0x481c26[_0x07e8('0x38')]['includeAll']){_0xc2637a[_0x07e8('0x48')]=[{'all':!![]}];}_0xc2637a=_[_0x07e8('0x43')]({},_0xc2637a,_0x481c26[_0x07e8('0x44')]);return db[_0x07e8('0x45')][_0x07e8('0x4c')](_0xc2637a)[_0x07e8('0x29')](handleEntityNotFound(_0x275218,null))[_0x07e8('0x29')](respondWithResult(_0x275218,null))['catch'](handleError(_0x275218,null));};exports[_0x07e8('0x4d')]=function(_0x4dfc71,_0x2b3710){return db['MailQueue']['create'](_0x4dfc71[_0x07e8('0x4e')],{})[_0x07e8('0x29')](function(_0x5507ea){var _0x59abbe=_0x4dfc71[_0x07e8('0x4f')][_0x07e8('0x50')]({'plain':!![]});if(!_0x59abbe)throw new Error(_0x07e8('0x51'));if(_0x59abbe['role']===_0x07e8('0x4f')){var _0x317fbb=_0x5507ea[_0x07e8('0x50')]({'plain':!![]});var _0x317fd2=_0x07e8('0x2b');return db['UserProfileSection'][_0x07e8('0x4c')]({'where':{'name':_0x317fd2,'userProfileId':_0x59abbe[_0x07e8('0x52')]},'raw':!![]})[_0x07e8('0x29')](function(_0x19dd7f){if(_0x19dd7f&&_0x19dd7f[_0x07e8('0x53')]===0x0){return db['UserProfileResource'][_0x07e8('0x4d')]({'name':_0x317fbb['name'],'resourceId':_0x317fbb['id'],'type':_0x19dd7f[_0x07e8('0x2f')],'sectionId':_0x19dd7f['id']},{})['then'](function(){return _0x5507ea;});}else{return _0x5507ea;}})[_0x07e8('0x4a')](function(_0x5bd163){logger[_0x07e8('0x54')](_0x07e8('0x55'),_0x5bd163);throw _0x5bd163;});}return _0x5507ea;})[_0x07e8('0x29')](respondWithResult(_0x2b3710,0xc9))[_0x07e8('0x4a')](handleError(_0x2b3710,null));};exports[_0x07e8('0x28')]=function(_0xb5b41a,_0x585ab2){if(_0xb5b41a[_0x07e8('0x4e')]['id']){delete _0xb5b41a[_0x07e8('0x4e')]['id'];}return db[_0x07e8('0x45')]['find']({'where':{'id':_0xb5b41a[_0x07e8('0x4b')]['id']}})[_0x07e8('0x29')](handleEntityNotFound(_0x585ab2,null))[_0x07e8('0x29')](saveUpdates(_0xb5b41a['body'],null))['then'](respondWithResult(_0x585ab2,null))[_0x07e8('0x4a')](handleError(_0x585ab2,null));};exports[_0x07e8('0x2a')]=function(_0x47c92c,_0x4e2e2a){return db[_0x07e8('0x45')][_0x07e8('0x4c')]({'where':{'id':_0x47c92c[_0x07e8('0x4b')]['id']}})[_0x07e8('0x29')](handleEntityNotFound(_0x4e2e2a,null))[_0x07e8('0x29')](removeEntity(_0x4e2e2a,null))[_0x07e8('0x4a')](handleError(_0x4e2e2a,null));};exports['describe']=function(_0x334ea1,_0x456d17){return db[_0x07e8('0x45')][_0x07e8('0x56')]()['then'](respondWithResult(_0x456d17,null))['catch'](handleError(_0x456d17,null));};exports[_0x07e8('0x57')]=function(_0x254d9b,_0x40842c,_0x42e97b){var _0x583455={'raw':!![],'where':{}},_0x478238={},_0x2d455e;return db[_0x07e8('0x45')]['findOne']({'where':{'id':_0x254d9b[_0x07e8('0x4b')]['id']}})[_0x07e8('0x29')](handleEntityNotFound(_0x40842c,null))['then'](function(_0x4e1ae5){if(_0x4e1ae5){_0x2d455e=_0x4e1ae5[_0x07e8('0x50')]({'plain':!![]});_0x478238[_0x07e8('0x36')]=_[_0x07e8('0x39')](db[_0x07e8('0x58')]['rawAttributes']);_0x478238[_0x07e8('0x38')]=_[_0x07e8('0x39')](_0x254d9b['query']);_0x478238[_0x07e8('0x3a')]=_['intersection'](_0x478238[_0x07e8('0x36')],_0x478238['query']);_0x583455['attributes']=_[_0x07e8('0x3c')](_0x478238[_0x07e8('0x36')],qs[_0x07e8('0x3d')](_0x254d9b[_0x07e8('0x38')]['fields']));_0x583455['attributes']=_0x583455[_0x07e8('0x3b')][_0x07e8('0x59')]?_0x583455[_0x07e8('0x3b')]:_0x478238[_0x07e8('0x36')];if(!_0x254d9b[_0x07e8('0x38')][_0x07e8('0x5a')](_0x07e8('0x3e'))){_0x583455['limit']=qs[_0x07e8('0x23')](_0x254d9b[_0x07e8('0x38')][_0x07e8('0x23')]);_0x583455[_0x07e8('0x22')]=qs[_0x07e8('0x22')](_0x254d9b['query'][_0x07e8('0x22')]);}_0x583455['order']=qs['sort'](_0x254d9b['query'][_0x07e8('0x3f')]);_0x583455['where']=qs[_0x07e8('0x3a')](_[_0x07e8('0x40')](_0x254d9b['query'],_0x478238[_0x07e8('0x3a')]));_0x583455['where']['MailQueueId']=_0x4e1ae5['id'];if(_0x254d9b['query'][_0x07e8('0x42')]){_0x583455[_0x07e8('0x41')]=_[_0x07e8('0x43')](_0x583455[_0x07e8('0x41')],{'$or':_['map'](_0x583455[_0x07e8('0x3b')],function(_0x1810ba){var _0x527e4d={};_0x527e4d[_0x1810ba]={'$like':'%'+_0x254d9b[_0x07e8('0x38')][_0x07e8('0x42')]+'%'};return _0x527e4d;})});}_0x583455=_[_0x07e8('0x43')]({},_0x583455,_0x254d9b[_0x07e8('0x44')]);return db[_0x07e8('0x58')][_0x07e8('0x5b')](_0x583455);}})['then'](function(_0x14fb62){if(_0x14fb62){return db['User'][_0x07e8('0x5c')]({'where':{'id':_[_0x07e8('0x37')](_0x14fb62,'UserId'),'role':_0x07e8('0x5d')},'attributes':['id',_0x07e8('0x2f'),'mailPause',_0x07e8('0x5e'),'createdAt']});}})['then'](function(_0x4aeea1){if(_0x4aeea1){return{'count':_0x4aeea1[_0x07e8('0x46')],'rows':_[_0x07e8('0x37')](_0x4aeea1[_0x07e8('0x49')],function(_0x533269){return{'membername':_0x533269[_0x07e8('0x2f')],'UserId':_0x533269['id'],'queue_name':_0x2d455e['name'],'MailQueueId':_0x2d455e['id'],'interface':util['format'](_0x07e8('0x5f'),_0x07e8('0x60'),_0x533269['name']),'penalty':0x0,'paused':_0x533269[_0x07e8('0x61')],'createdAt':_0x533269[_0x07e8('0x62')],'updatedAt':_0x533269[_0x07e8('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x07e8('0x29')](respondWithFilteredResult(_0x40842c,_0x583455))[_0x07e8('0x4a')](handleError(_0x40842c,null));};exports[_0x07e8('0x63')]=function(_0x2d90f2,_0x437f6a,_0x4e3ee5){var _0x1153ac={};var _0x53da1b={};var _0x387e30;var _0x33d30e;return db['MailQueue']['findOne']({'where':{'id':_0x2d90f2['params']['id']}})[_0x07e8('0x29')](handleEntityNotFound(_0x437f6a,null))[_0x07e8('0x29')](function(_0x502c0c){if(_0x502c0c){_0x387e30=_0x502c0c;_0x53da1b[_0x07e8('0x36')]=_[_0x07e8('0x39')](db['Team'][_0x07e8('0x32')]);_0x53da1b[_0x07e8('0x38')]=_['keys'](_0x2d90f2[_0x07e8('0x38')]);_0x53da1b['filters']=_[_0x07e8('0x3c')](_0x53da1b[_0x07e8('0x36')],_0x53da1b[_0x07e8('0x38')]);_0x1153ac[_0x07e8('0x3b')]=_[_0x07e8('0x3c')](_0x53da1b['model'],qs[_0x07e8('0x3d')](_0x2d90f2['query']['fields']));_0x1153ac[_0x07e8('0x3b')]=_0x1153ac[_0x07e8('0x3b')]['length']?_0x1153ac[_0x07e8('0x3b')]:_0x53da1b[_0x07e8('0x36')];_0x1153ac[_0x07e8('0x64')]=qs[_0x07e8('0x3f')](_0x2d90f2['query'][_0x07e8('0x3f')]);_0x1153ac[_0x07e8('0x41')]=qs[_0x07e8('0x3a')](_[_0x07e8('0x40')](_0x2d90f2[_0x07e8('0x38')],_0x53da1b['filters']));if(_0x2d90f2[_0x07e8('0x38')]['filter']){_0x1153ac[_0x07e8('0x41')]=_['merge'](_0x1153ac[_0x07e8('0x41')],{'$or':_[_0x07e8('0x37')](_0x1153ac[_0x07e8('0x3b')],function(_0x9ea177){var _0x1b8014={};_0x1b8014[_0x9ea177]={'$like':'%'+_0x2d90f2[_0x07e8('0x38')]['filter']+'%'};return _0x1b8014;})});}_0x1153ac=_[_0x07e8('0x43')]({},_0x1153ac,_0x2d90f2[_0x07e8('0x44')]);return _0x387e30[_0x07e8('0x63')](_0x1153ac);}})[_0x07e8('0x29')](function(_0x459bca){if(_0x459bca){_0x33d30e=_0x459bca[_0x07e8('0x59')];if(!_0x2d90f2[_0x07e8('0x38')][_0x07e8('0x5a')](_0x07e8('0x3e'))){_0x1153ac[_0x07e8('0x23')]=qs['limit'](_0x2d90f2[_0x07e8('0x38')][_0x07e8('0x23')]);_0x1153ac[_0x07e8('0x22')]=qs[_0x07e8('0x22')](_0x2d90f2[_0x07e8('0x38')][_0x07e8('0x22')]);}return _0x387e30[_0x07e8('0x63')](_0x1153ac);}})[_0x07e8('0x29')](function(_0x537070){if(_0x537070){return _0x537070?{'count':_0x33d30e,'rows':_0x537070}:null;}})['then'](respondWithResult(_0x437f6a,null))[_0x07e8('0x4a')](handleError(_0x437f6a,null));};exports[_0x07e8('0x65')]=function(_0x11dd8e,_0x503b90,_0x2b71b5){var _0x133373=_0x11dd8e[_0x07e8('0x4e')][_0x07e8('0x66')];return db['Team']['findAll']({'where':{'id':_0x133373},'attributes':['id'],'include':[{'model':db['User'],'as':_0x07e8('0x67'),'attributes':['id','name',_0x07e8('0x68'),_0x07e8('0x69'),_0x07e8('0x6a')],'raw':!![]}]})[_0x07e8('0x29')](function(_0x21aee1){if(_0x21aee1){var _0x9da8dd=_[_0x07e8('0x6b')](_0x21aee1,function(_0x30dcd4){var _0x70caef=_0x30dcd4[_0x07e8('0x50')]({'plain':!![]});return _0x70caef[_0x07e8('0x67')];});return db[_0x07e8('0x45')][_0x07e8('0x4c')]({'where':{'id':_0x11dd8e[_0x07e8('0x4b')]['id']}})['then'](function(_0x39119a){return db[_0x07e8('0x6c')][_0x07e8('0x6d')](function(_0x3f8f05){return _0x39119a['addTeams'](_0x133373,{'transaction':_0x3f8f05})[_0x07e8('0x29')](function(){return BPromise[_0x07e8('0x6e')](_0x9da8dd,function(_0x2ad155){return db[_0x07e8('0x58')][_0x07e8('0x6f')]({'where':{'UserId':_0x2ad155['id'],'MailQueueId':_0x11dd8e[_0x07e8('0x4b')]['id']},'transaction':_0x3f8f05});});})['then'](function(){_0x9da8dd['forEach'](function(_0xf908b5){socket[_0x07e8('0x70')](_0x07e8('0x71'),{'UserId':_0xf908b5['id'],'MailQueueId':_0x39119a['id']});});});});});}})[_0x07e8('0x29')](respondWithStatusCode(_0x503b90,null))[_0x07e8('0x4a')](handleError(_0x503b90,null));};exports['removeTeams']=function(_0x2e7fd3,_0x3c8c37,_0x230600){return db[_0x07e8('0x72')][_0x07e8('0x5b')]({'where':{'id':_0x2e7fd3[_0x07e8('0x38')][_0x07e8('0x66')]},'attributes':['id'],'include':[{'model':db[_0x07e8('0x73')],'as':_0x07e8('0x67'),'attributes':['id'],'raw':!![]}]})[_0x07e8('0x29')](handleEntityNotFound(_0x3c8c37,null))[_0x07e8('0x29')](function(_0x56417a){var _0x4100ab=_[_0x07e8('0x37')](_0x56417a,'id');var _0x562f54=[];var _0x58cede=[];var _0x855826=squel[_0x07e8('0x74')]();_0x855826[_0x07e8('0x75')](_0x07e8('0x76'))[_0x07e8('0x77')](_0x07e8('0x78'),'tq')[_0x07e8('0x79')](_0x07e8('0x7a'),'ut',_0x07e8('0x7b'))[_0x07e8('0x41')](_0x07e8('0x7c'),_0x2e7fd3[_0x07e8('0x4b')]['id']);for(var _0x5cf8b4=0x0;_0x5cf8b4<_0x56417a['length'];_0x5cf8b4+=0x1){let _0x293c58=_0x56417a[_0x5cf8b4];for(var _0x30cdb9=0x0;_0x30cdb9<_0x293c58['Agents'][_0x07e8('0x59')];_0x30cdb9+=0x1){let _0x4b658f=_0x293c58[_0x07e8('0x67')][_0x30cdb9];var _0x215d4d=_0x855826[_0x07e8('0x7d')]();_0x215d4d[_0x07e8('0x41')](_0x07e8('0x7e'),_0x4b658f['id']);_0x58cede[_0x07e8('0x7f')](db[_0x07e8('0x6c')]['query'](_0x215d4d[_0x07e8('0x80')](),{'type':db[_0x07e8('0x6c')][_0x07e8('0x81')][_0x07e8('0x82')]})[_0x07e8('0x29')](function(_0x5c45eb){if(_0x5c45eb[_0x07e8('0x59')]===0x1){return _0x4b658f['id'];}else{var _0x5db17f=_['every'](_[_0x07e8('0x37')](_0x5c45eb,_0x07e8('0x83')),function(_0x5ec1d2){return _[_0x07e8('0x84')](_0x4100ab,_0x5ec1d2);});if(_0x5db17f){return _0x4b658f['id'];}}}));}}return BPromise[_0x07e8('0x85')](_0x58cede)[_0x07e8('0x29')](function(_0xedee4a){_0x562f54=_(_0x562f54)[_0x07e8('0x86')](_0xedee4a)['compact']()[_0x07e8('0x87')]();return db[_0x07e8('0x45')][_0x07e8('0x4c')]({'where':{'id':_0x2e7fd3[_0x07e8('0x4b')]['id']}})[_0x07e8('0x29')](function(_0x4e2f2d){return db[_0x07e8('0x6c')][_0x07e8('0x6d')](function(_0x5c5cd7){return _0x4e2f2d[_0x07e8('0x88')](_0x2e7fd3[_0x07e8('0x38')][_0x07e8('0x66')],{'transaction':_0x5c5cd7})[_0x07e8('0x29')](function(){if(!_['isEmpty'](_0x562f54)){return _0x4e2f2d[_0x07e8('0x89')](_0x562f54,{'transaction':_0x5c5cd7});}})[_0x07e8('0x29')](function(){_0x562f54[_0x07e8('0x8a')](function(_0x323e6b){socket[_0x07e8('0x70')]('userMailQueue:remove',{'UserId':_0x323e6b,'MailQueueId':_0x4e2f2d['id']});});});});});});})[_0x07e8('0x29')](respondWithStatusCode(_0x3c8c37,null))[_0x07e8('0x4a')](handleError(_0x3c8c37,null));};exports[_0x07e8('0x8b')]=function(_0x267abb,_0x3b541f,_0x2345e8){return db[_0x07e8('0x45')][_0x07e8('0x4c')]({'where':{'id':_0x267abb[_0x07e8('0x4b')]['id']}})[_0x07e8('0x29')](handleEntityNotFound(_0x3b541f,null))[_0x07e8('0x29')](function(_0x1e78fe){if(_0x1e78fe){return _0x1e78fe['addAgents'](_0x267abb['body'][_0x07e8('0x66')],_[_0x07e8('0x8c')](_0x267abb['body'],[_0x07e8('0x66'),'id'])||{})[_0x07e8('0x8d')](function(_0x5e4099){for(var _0x211a19=0x0;_0x211a19<_0x267abb[_0x07e8('0x4e')]['ids'][_0x07e8('0x59')];_0x211a19+=0x1){socket[_0x07e8('0x70')](_0x07e8('0x71'),{'UserId':_0x267abb[_0x07e8('0x4e')][_0x07e8('0x66')][_0x211a19],'MailQueueId':_0x267abb[_0x07e8('0x4b')]['id']});}return _0x5e4099;});}})[_0x07e8('0x29')](respondWithResult(_0x3b541f,null))[_0x07e8('0x4a')](handleError(_0x3b541f,null));};exports[_0x07e8('0x89')]=function(_0x4b4ab9,_0xc60d43,_0x40c2ec){return db[_0x07e8('0x45')][_0x07e8('0x4c')]({'where':{'id':_0x4b4ab9['params']['id']}})[_0x07e8('0x29')](handleEntityNotFound(_0xc60d43,null))['then'](function(_0x4f79ac){if(_0x4f79ac){return _0x4f79ac[_0x07e8('0x89')](_0x4b4ab9[_0x07e8('0x38')][_0x07e8('0x66')])[_0x07e8('0x29')](function(){if(_[_0x07e8('0x8e')](_0x4b4ab9[_0x07e8('0x38')][_0x07e8('0x66')])){for(var _0x337a21=0x0;_0x337a21<_0x4b4ab9[_0x07e8('0x38')][_0x07e8('0x66')][_0x07e8('0x59')];_0x337a21+=0x1){socket[_0x07e8('0x70')](_0x07e8('0x8f'),{'UserId':Number(_0x4b4ab9[_0x07e8('0x38')][_0x07e8('0x66')][_0x337a21]),'MailQueueId':Number(_0x4b4ab9[_0x07e8('0x4b')]['id'])});}}else{socket[_0x07e8('0x70')](_0x07e8('0x8f'),{'UserId':Number(_0x4b4ab9[_0x07e8('0x38')][_0x07e8('0x66')]),'MailQueueId':Number(_0x4b4ab9[_0x07e8('0x4b')]['id'])});}});}})['then'](respondWithStatusCode(_0xc60d43,null))[_0x07e8('0x4a')](handleError(_0xc60d43,null));};exports['getAgents']=function(_0x8caa7a,_0x369573,_0x43550e){var _0x29b004={};var _0xd684c5={};var _0x1fab34;var _0xa51d96;return db[_0x07e8('0x45')][_0x07e8('0x90')]({'where':{'id':_0x8caa7a['params']['id']}})[_0x07e8('0x29')](handleEntityNotFound(_0x369573,null))[_0x07e8('0x29')](function(_0x41f8a7){if(_0x41f8a7){_0x1fab34=_0x41f8a7;_0xd684c5[_0x07e8('0x36')]=_[_0x07e8('0x39')](db[_0x07e8('0x73')][_0x07e8('0x32')]);_0xd684c5['query']=_[_0x07e8('0x39')](_0x8caa7a[_0x07e8('0x38')]);_0xd684c5[_0x07e8('0x3a')]=_[_0x07e8('0x3c')](_0xd684c5[_0x07e8('0x36')],_0xd684c5['query']);_0x29b004[_0x07e8('0x3b')]=_[_0x07e8('0x3c')](_0xd684c5[_0x07e8('0x36')],qs['fields'](_0x8caa7a['query']['fields']));_0x29b004['attributes']=_0x29b004[_0x07e8('0x3b')]['length']?_0x29b004[_0x07e8('0x3b')]:_0xd684c5[_0x07e8('0x36')];_0x29b004[_0x07e8('0x64')]=qs['sort'](_0x8caa7a['query'][_0x07e8('0x3f')]);_0x29b004[_0x07e8('0x41')]=qs[_0x07e8('0x3a')](_['pick'](_0x8caa7a[_0x07e8('0x38')],_0xd684c5['filters']));if(_0x8caa7a['query'][_0x07e8('0x42')]){_0x29b004[_0x07e8('0x41')]=_[_0x07e8('0x43')](_0x29b004['where'],{'$or':_[_0x07e8('0x37')](_0x29b004[_0x07e8('0x3b')],function(_0x17973e){var _0x2195ad={};_0x2195ad[_0x17973e]={'$like':'%'+_0x8caa7a[_0x07e8('0x38')][_0x07e8('0x42')]+'%'};return _0x2195ad;})});}_0x29b004=_[_0x07e8('0x43')]({},_0x29b004,_0x8caa7a[_0x07e8('0x44')]);return _0x1fab34[_0x07e8('0x91')](_0x29b004);}})[_0x07e8('0x29')](function(_0x4537d4){if(_0x4537d4){_0xa51d96=_0x4537d4[_0x07e8('0x59')];if(!_0x8caa7a[_0x07e8('0x38')][_0x07e8('0x5a')](_0x07e8('0x3e'))){_0x29b004[_0x07e8('0x23')]=qs[_0x07e8('0x23')](_0x8caa7a[_0x07e8('0x38')]['limit']);_0x29b004[_0x07e8('0x22')]=qs['offset'](_0x8caa7a[_0x07e8('0x38')][_0x07e8('0x22')]);}return _0x1fab34[_0x07e8('0x91')](_0x29b004);}})[_0x07e8('0x29')](function(_0x2aba33){if(_0x2aba33){return _0x2aba33?{'count':_0xa51d96,'rows':_0x2aba33}:null;}})[_0x07e8('0x29')](respondWithResult(_0x369573,null))[_0x07e8('0x4a')](handleError(_0x369573,null));}; \ No newline at end of file +var _0x336b=['pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','keys','find','catch','create','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','MailQueueId','options','UserMailQueue','User','findAndCountAll','UserId','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','findOrCreate','emit','userMailQueue:save','removeTeams','select','field','from','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','get','MailQueues','UserProfileResource','end','error','stack','name','send','map','MailQueue','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where'];(function(_0x38c062,_0x33b654){var _0x1a014c=function(_0x40f91e){while(--_0x40f91e){_0x38c062['push'](_0x38c062['shift']());}};_0x1a014c(++_0x33b654);}(_0x336b,0x175));var _0xb336=function(_0x25aa30,_0x451920){_0x25aa30=_0x25aa30-0x0;var _0x4f25f2=_0x336b[_0x25aa30];return _0x4f25f2;};'use strict';var pdf=require(_0xb336('0x0'));var emlformat=require(_0xb336('0x1'));var rimraf=require(_0xb336('0x2'));var zipdir=require(_0xb336('0x3'));var jsonpatch=require(_0xb336('0x4'));var rp=require(_0xb336('0x5'));var moment=require(_0xb336('0x6'));var BPromise=require(_0xb336('0x7'));var Mustache=require(_0xb336('0x8'));var util=require(_0xb336('0x9'));var path=require(_0xb336('0xa'));var sox=require(_0xb336('0xb'));var csv=require(_0xb336('0xc'));var ejs=require(_0xb336('0xd'));var fs=require('fs');var _=require(_0xb336('0xe'));var squel=require(_0xb336('0xf'));var crypto=require(_0xb336('0x10'));var jsforce=require(_0xb336('0x11'));var deskjs=require(_0xb336('0x12'));var toCsv=require(_0xb336('0xc'));var querystring=require(_0xb336('0x13'));var Papa=require(_0xb336('0x14'));var Redis=require(_0xb336('0x15'));var authService=require(_0xb336('0x16'));var qs=require('../../components/parsers/qs');var as=require(_0xb336('0x17'));var hardwareService=require(_0xb336('0x18'));var logger=require(_0xb336('0x19'))('api');var utils=require(_0xb336('0x1a'));var config=require(_0xb336('0x1b'));var db=require(_0xb336('0x1c'))['db'];config[_0xb336('0x1d')]=_[_0xb336('0x1e')](config[_0xb336('0x1d')],{'host':_0xb336('0x1f'),'port':0x18eb});var socket=require(_0xb336('0x20'))(new Redis(config['redis']));require(_0xb336('0x21'))[_0xb336('0x22')](socket);function respondWithStatusCode(_0x129b07,_0x92f7ad){_0x92f7ad=_0x92f7ad||0xcc;return function(_0x5807cf){if(_0x5807cf){return _0x129b07[_0xb336('0x23')](_0x92f7ad);}return _0x129b07[_0xb336('0x24')](_0x92f7ad)['end']();};}function respondWithResult(_0x31579f,_0x11d360){_0x11d360=_0x11d360||0xc8;return function(_0xaa1f51){if(_0xaa1f51){return _0x31579f[_0xb336('0x24')](_0x11d360)['json'](_0xaa1f51);}};}function respondWithFilteredResult(_0xc81877,_0x15d804){return function(_0x7d23dd){if(_0x7d23dd){var _0x3bb554=_0x7d23dd[_0xb336('0x25')],_0x8546e2=_0x15d804[_0xb336('0x26')],_0x4e21c2=_0x15d804[_0xb336('0x26')]+_0x15d804['limit'],_0x206a8c;if(_0x4e21c2>=_0x3bb554){_0x4e21c2=_0x3bb554;_0x206a8c=0xc8;}else{_0x206a8c=0xce;}_0xc81877['status'](_0x206a8c);return _0xc81877['set'](_0xb336('0x27'),_0x8546e2+'-'+_0x4e21c2+'/'+_0x3bb554)[_0xb336('0x28')](_0x7d23dd);}return null;};}function patchUpdates(_0x1833a4){return function(_0x2ebcfd){try{jsonpatch[_0xb336('0x29')](_0x2ebcfd,_0x1833a4,!![]);}catch(_0x45ee48){return BPromise[_0xb336('0x2a')](_0x45ee48);}return _0x2ebcfd[_0xb336('0x2b')]();};}function saveUpdates(_0x3c31dd,_0xe44066){return function(_0x16a157){if(_0x16a157){return _0x16a157[_0xb336('0x2c')](_0x3c31dd)[_0xb336('0x2d')](function(_0xe686a9){return _0xe686a9;});}return null;};}function removeEntity(_0x52bbcf,_0x2ff279){return function(_0x36a5e6){if(_0x36a5e6){return _0x36a5e6[_0xb336('0x2e')]()['then'](function(){var _0x229d69=_0x36a5e6[_0xb336('0x2f')]({'plain':!![]});var _0x18c791=_0xb336('0x30');return db[_0xb336('0x31')][_0xb336('0x2e')]({'where':{'type':_0x18c791,'resourceId':_0x229d69['id']}})[_0xb336('0x2d')](function(){return _0x36a5e6;});})[_0xb336('0x2d')](function(){_0x52bbcf[_0xb336('0x24')](0xcc)[_0xb336('0x32')]();});}};}function handleEntityNotFound(_0x6015ab,_0x322296){return function(_0x244ebe){if(!_0x244ebe){_0x6015ab[_0xb336('0x23')](0x194);}return _0x244ebe;};}function handleError(_0x1fc62b,_0x2e3855){_0x2e3855=_0x2e3855||0x1f4;return function(_0x3fb087){logger[_0xb336('0x33')](_0x3fb087[_0xb336('0x34')]);if(_0x3fb087[_0xb336('0x35')]){delete _0x3fb087[_0xb336('0x35')];}_0x1fc62b[_0xb336('0x24')](_0x2e3855)[_0xb336('0x36')](_0x3fb087);};}exports['index']=function(_0x498eac,_0x313b8f){var _0x485e71={},_0x376abf={},_0x2810ec={'count':0x0,'rows':[]};var _0x3c58b5=_[_0xb336('0x37')](db[_0xb336('0x38')][_0xb336('0x39')],function(_0x489266){return{'name':_0x489266[_0xb336('0x3a')],'type':_0x489266[_0xb336('0x3b')][_0xb336('0x3c')]};});_0x376abf[_0xb336('0x3d')]=_[_0xb336('0x37')](_0x3c58b5,_0xb336('0x35'));_0x376abf[_0xb336('0x3e')]=_['keys'](_0x498eac[_0xb336('0x3e')]);_0x376abf[_0xb336('0x3f')]=_[_0xb336('0x40')](_0x376abf[_0xb336('0x3d')],_0x376abf['query']);_0x485e71[_0xb336('0x41')]=_[_0xb336('0x40')](_0x376abf[_0xb336('0x3d')],qs[_0xb336('0x42')](_0x498eac[_0xb336('0x3e')][_0xb336('0x42')]));_0x485e71[_0xb336('0x41')]=_0x485e71[_0xb336('0x41')][_0xb336('0x43')]?_0x485e71[_0xb336('0x41')]:_0x376abf['model'];if(!_0x498eac['query'][_0xb336('0x44')](_0xb336('0x45'))){_0x485e71[_0xb336('0x46')]=qs['limit'](_0x498eac[_0xb336('0x3e')][_0xb336('0x46')]);_0x485e71[_0xb336('0x26')]=qs[_0xb336('0x26')](_0x498eac[_0xb336('0x3e')][_0xb336('0x26')]);}_0x485e71[_0xb336('0x47')]=qs[_0xb336('0x48')](_0x498eac[_0xb336('0x3e')][_0xb336('0x48')]);_0x485e71[_0xb336('0x49')]=qs['filters'](_[_0xb336('0x4a')](_0x498eac[_0xb336('0x3e')],_0x376abf['filters']),_0x3c58b5);if(_0x498eac[_0xb336('0x3e')]['filter']){_0x485e71[_0xb336('0x49')]=_[_0xb336('0x4b')](_0x485e71[_0xb336('0x49')],{'$or':_['map'](_0x3c58b5,function(_0x2e4ef5){if(_0x2e4ef5[_0xb336('0x3b')]!==_0xb336('0x4c')){var _0x1ee0ca={};_0x1ee0ca[_0x2e4ef5[_0xb336('0x35')]]={'$like':'%'+_0x498eac[_0xb336('0x3e')][_0xb336('0x4d')]+'%'};return _0x1ee0ca;}})});}_0x485e71=_[_0xb336('0x4b')]({},_0x485e71,_0x498eac['options']);var _0x8d16a={'where':_0x485e71[_0xb336('0x49')]};return db[_0xb336('0x38')][_0xb336('0x25')](_0x8d16a)[_0xb336('0x2d')](function(_0x13e5d3){_0x2810ec['count']=_0x13e5d3;if(_0x498eac[_0xb336('0x3e')][_0xb336('0x4e')]){_0x485e71[_0xb336('0x4f')]=[{'all':!![]}];}return db[_0xb336('0x38')][_0xb336('0x50')](_0x485e71);})[_0xb336('0x2d')](function(_0x3dec7b){_0x2810ec[_0xb336('0x51')]=_0x3dec7b;return _0x2810ec;})[_0xb336('0x2d')](respondWithFilteredResult(_0x313b8f,_0x485e71))['catch'](handleError(_0x313b8f,null));};exports[_0xb336('0x52')]=function(_0x1ac8c0,_0x237a4c){var _0x295c39={'raw':!![],'where':{'id':_0x1ac8c0[_0xb336('0x53')]['id']}},_0x18241e={};_0x18241e['model']=_[_0xb336('0x54')](db['MailQueue'][_0xb336('0x39')]);_0x18241e[_0xb336('0x3e')]=_[_0xb336('0x54')](_0x1ac8c0[_0xb336('0x3e')]);_0x18241e['filters']=_['intersection'](_0x18241e[_0xb336('0x3d')],_0x18241e[_0xb336('0x3e')]);_0x295c39[_0xb336('0x41')]=_[_0xb336('0x40')](_0x18241e[_0xb336('0x3d')],qs[_0xb336('0x42')](_0x1ac8c0[_0xb336('0x3e')][_0xb336('0x42')]));_0x295c39['attributes']=_0x295c39[_0xb336('0x41')]['length']?_0x295c39['attributes']:_0x18241e['model'];if(_0x1ac8c0[_0xb336('0x3e')][_0xb336('0x4e')]){_0x295c39[_0xb336('0x4f')]=[{'all':!![]}];}_0x295c39=_['merge']({},_0x295c39,_0x1ac8c0['options']);return db[_0xb336('0x38')][_0xb336('0x55')](_0x295c39)[_0xb336('0x2d')](handleEntityNotFound(_0x237a4c,null))[_0xb336('0x2d')](respondWithResult(_0x237a4c,null))[_0xb336('0x56')](handleError(_0x237a4c,null));};exports[_0xb336('0x57')]=function(_0x18e6b4,_0x204482){return db['MailQueue'][_0xb336('0x57')](_0x18e6b4['body'],{})['then'](function(_0x5dbff9){var _0x380438=_0x18e6b4[_0xb336('0x58')][_0xb336('0x2f')]({'plain':!![]});if(!_0x380438)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x380438[_0xb336('0x59')]==='user'){var _0x54fdd4=_0x5dbff9[_0xb336('0x2f')]({'plain':!![]});var _0x345c03='MailQueues';return db[_0xb336('0x5a')][_0xb336('0x55')]({'where':{'name':_0x345c03,'userProfileId':_0x380438[_0xb336('0x5b')]},'raw':!![]})[_0xb336('0x2d')](function(_0x51d20e){if(_0x51d20e&&_0x51d20e['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x54fdd4[_0xb336('0x35')],'resourceId':_0x54fdd4['id'],'type':_0x51d20e['name'],'sectionId':_0x51d20e['id']},{})['then'](function(){return _0x5dbff9;});}else{return _0x5dbff9;}})[_0xb336('0x56')](function(_0x1e2a71){logger[_0xb336('0x33')](_0xb336('0x5c'),_0x1e2a71);throw _0x1e2a71;});}return _0x5dbff9;})[_0xb336('0x2d')](respondWithResult(_0x204482,0xc9))['catch'](handleError(_0x204482,null));};exports[_0xb336('0x2c')]=function(_0x20fb92,_0x1a4e15){if(_0x20fb92[_0xb336('0x5d')]['id']){delete _0x20fb92[_0xb336('0x5d')]['id'];}return db[_0xb336('0x38')][_0xb336('0x55')]({'where':{'id':_0x20fb92[_0xb336('0x53')]['id']}})['then'](handleEntityNotFound(_0x1a4e15,null))['then'](saveUpdates(_0x20fb92['body'],null))[_0xb336('0x2d')](respondWithResult(_0x1a4e15,null))[_0xb336('0x56')](handleError(_0x1a4e15,null));};exports[_0xb336('0x2e')]=function(_0xf1b662,_0xabd1c7){return db[_0xb336('0x38')][_0xb336('0x55')]({'where':{'id':_0xf1b662['params']['id']}})[_0xb336('0x2d')](handleEntityNotFound(_0xabd1c7,null))[_0xb336('0x2d')](removeEntity(_0xabd1c7,null))[_0xb336('0x56')](handleError(_0xabd1c7,null));};exports[_0xb336('0x5e')]=function(_0x4f4725,_0x22db30){return db[_0xb336('0x38')]['describe']()[_0xb336('0x2d')](respondWithResult(_0x22db30,null))[_0xb336('0x56')](handleError(_0x22db30,null));};exports[_0xb336('0x5f')]=function(_0x23d103,_0x56686b,_0x14ed78){var _0x2b40ad={'raw':!![],'where':{}},_0x44bb78={},_0x58b495;return db['MailQueue'][_0xb336('0x60')]({'where':{'id':_0x23d103[_0xb336('0x53')]['id']}})[_0xb336('0x2d')](handleEntityNotFound(_0x56686b,null))['then'](function(_0x47022f){if(_0x47022f){_0x58b495=_0x47022f[_0xb336('0x2f')]({'plain':!![]});_0x44bb78['model']=_[_0xb336('0x54')](db['UserMailQueue'][_0xb336('0x39')]);_0x44bb78['query']=_['keys'](_0x23d103[_0xb336('0x3e')]);_0x44bb78['filters']=_[_0xb336('0x40')](_0x44bb78[_0xb336('0x3d')],_0x44bb78[_0xb336('0x3e')]);_0x2b40ad[_0xb336('0x41')]=_[_0xb336('0x40')](_0x44bb78['model'],qs[_0xb336('0x42')](_0x23d103[_0xb336('0x3e')][_0xb336('0x42')]));_0x2b40ad['attributes']=_0x2b40ad['attributes'][_0xb336('0x43')]?_0x2b40ad[_0xb336('0x41')]:_0x44bb78[_0xb336('0x3d')];if(!_0x23d103[_0xb336('0x3e')][_0xb336('0x44')]('nolimit')){_0x2b40ad[_0xb336('0x46')]=qs[_0xb336('0x46')](_0x23d103[_0xb336('0x3e')][_0xb336('0x46')]);_0x2b40ad[_0xb336('0x26')]=qs[_0xb336('0x26')](_0x23d103['query'][_0xb336('0x26')]);}_0x2b40ad[_0xb336('0x47')]=qs['sort'](_0x23d103[_0xb336('0x3e')]['sort']);_0x2b40ad[_0xb336('0x49')]=qs[_0xb336('0x3f')](_['pick'](_0x23d103['query'],_0x44bb78[_0xb336('0x3f')]));_0x2b40ad[_0xb336('0x49')][_0xb336('0x61')]=_0x47022f['id'];if(_0x23d103[_0xb336('0x3e')]['filter']){_0x2b40ad['where']=_[_0xb336('0x4b')](_0x2b40ad[_0xb336('0x49')],{'$or':_[_0xb336('0x37')](_0x2b40ad[_0xb336('0x41')],function(_0x341d78){var _0x2b7551={};_0x2b7551[_0x341d78]={'$like':'%'+_0x23d103[_0xb336('0x3e')][_0xb336('0x4d')]+'%'};return _0x2b7551;})});}_0x2b40ad=_[_0xb336('0x4b')]({},_0x2b40ad,_0x23d103[_0xb336('0x62')]);return db[_0xb336('0x63')][_0xb336('0x50')](_0x2b40ad);}})[_0xb336('0x2d')](function(_0x32aee7){if(_0x32aee7){return db[_0xb336('0x64')][_0xb336('0x65')]({'where':{'id':_[_0xb336('0x37')](_0x32aee7,_0xb336('0x66')),'role':'agent'},'attributes':['id','name',_0xb336('0x67'),_0xb336('0x68'),_0xb336('0x69')]});}})[_0xb336('0x2d')](function(_0x7e2958){if(_0x7e2958){return{'count':_0x7e2958[_0xb336('0x25')],'rows':_[_0xb336('0x37')](_0x7e2958['rows'],function(_0x4a20b9){return{'membername':_0x4a20b9[_0xb336('0x35')],'UserId':_0x4a20b9['id'],'queue_name':_0x58b495['name'],'MailQueueId':_0x58b495['id'],'interface':util[_0xb336('0x6a')](_0xb336('0x6b'),_0xb336('0x6c'),_0x4a20b9['name']),'penalty':0x0,'paused':_0x4a20b9[_0xb336('0x67')],'createdAt':_0x4a20b9[_0xb336('0x69')],'updatedAt':_0x4a20b9[_0xb336('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x56686b,_0x2b40ad))[_0xb336('0x56')](handleError(_0x56686b,null));};exports[_0xb336('0x6d')]=function(_0x3b24ab,_0x42a1a9,_0x35d951){var _0x38f535={};var _0x3ba2aa={};var _0x1888b8;var _0x3989a5;return db['MailQueue'][_0xb336('0x60')]({'where':{'id':_0x3b24ab[_0xb336('0x53')]['id']}})[_0xb336('0x2d')](handleEntityNotFound(_0x42a1a9,null))[_0xb336('0x2d')](function(_0x565c63){if(_0x565c63){_0x1888b8=_0x565c63;_0x3ba2aa[_0xb336('0x3d')]=_[_0xb336('0x54')](db[_0xb336('0x6e')]['rawAttributes']);_0x3ba2aa[_0xb336('0x3e')]=_['keys'](_0x3b24ab[_0xb336('0x3e')]);_0x3ba2aa[_0xb336('0x3f')]=_[_0xb336('0x40')](_0x3ba2aa[_0xb336('0x3d')],_0x3ba2aa['query']);_0x38f535[_0xb336('0x41')]=_[_0xb336('0x40')](_0x3ba2aa['model'],qs['fields'](_0x3b24ab[_0xb336('0x3e')]['fields']));_0x38f535[_0xb336('0x41')]=_0x38f535[_0xb336('0x41')]['length']?_0x38f535[_0xb336('0x41')]:_0x3ba2aa[_0xb336('0x3d')];_0x38f535[_0xb336('0x47')]=qs[_0xb336('0x48')](_0x3b24ab[_0xb336('0x3e')]['sort']);_0x38f535[_0xb336('0x49')]=qs[_0xb336('0x3f')](_[_0xb336('0x4a')](_0x3b24ab[_0xb336('0x3e')],_0x3ba2aa[_0xb336('0x3f')]));if(_0x3b24ab[_0xb336('0x3e')][_0xb336('0x4d')]){_0x38f535[_0xb336('0x49')]=_[_0xb336('0x4b')](_0x38f535[_0xb336('0x49')],{'$or':_[_0xb336('0x37')](_0x38f535[_0xb336('0x41')],function(_0x3e5036){var _0x873149={};_0x873149[_0x3e5036]={'$like':'%'+_0x3b24ab['query'][_0xb336('0x4d')]+'%'};return _0x873149;})});}_0x38f535=_[_0xb336('0x4b')]({},_0x38f535,_0x3b24ab[_0xb336('0x62')]);return _0x1888b8[_0xb336('0x6d')](_0x38f535);}})['then'](function(_0x2d9c5e){if(_0x2d9c5e){_0x3989a5=_0x2d9c5e[_0xb336('0x43')];if(!_0x3b24ab[_0xb336('0x3e')]['hasOwnProperty'](_0xb336('0x45'))){_0x38f535[_0xb336('0x46')]=qs['limit'](_0x3b24ab[_0xb336('0x3e')]['limit']);_0x38f535['offset']=qs[_0xb336('0x26')](_0x3b24ab[_0xb336('0x3e')][_0xb336('0x26')]);}return _0x1888b8[_0xb336('0x6d')](_0x38f535);}})['then'](function(_0x3480d7){if(_0x3480d7){return _0x3480d7?{'count':_0x3989a5,'rows':_0x3480d7}:null;}})[_0xb336('0x2d')](respondWithResult(_0x42a1a9,null))[_0xb336('0x56')](handleError(_0x42a1a9,null));};exports[_0xb336('0x6f')]=function(_0xd024a6,_0xc9dd52,_0x46b4c0){var _0x4f3fbb=_0xd024a6['body'][_0xb336('0x70')];return db['Team']['findAll']({'where':{'id':_0x4f3fbb},'attributes':['id'],'include':[{'model':db['User'],'as':_0xb336('0x71'),'attributes':['id',_0xb336('0x35'),'online',_0xb336('0x72'),_0xb336('0x73')],'raw':!![]}]})[_0xb336('0x2d')](function(_0x58d7cf){if(_0x58d7cf){var _0x5c8b64=_[_0xb336('0x74')](_0x58d7cf,function(_0x25e588){var _0x3dd8ee=_0x25e588[_0xb336('0x2f')]({'plain':!![]});return _0x3dd8ee[_0xb336('0x71')];});return db['MailQueue'][_0xb336('0x55')]({'where':{'id':_0xd024a6[_0xb336('0x53')]['id']}})[_0xb336('0x2d')](function(_0x90abda){return db[_0xb336('0x75')]['transaction'](function(_0x2acf13){return _0x90abda[_0xb336('0x6f')](_0x4f3fbb,{'transaction':_0x2acf13})['then'](function(){return BPromise['each'](_0x5c8b64,function(_0x35dc76){return db[_0xb336('0x63')][_0xb336('0x76')]({'where':{'UserId':_0x35dc76['id'],'MailQueueId':_0xd024a6[_0xb336('0x53')]['id']},'transaction':_0x2acf13});});})[_0xb336('0x2d')](function(){_0x5c8b64['forEach'](function(_0x372981){socket[_0xb336('0x77')](_0xb336('0x78'),{'UserId':_0x372981['id'],'MailQueueId':_0x90abda['id']});});});});});}})['then'](respondWithStatusCode(_0xc9dd52,null))['catch'](handleError(_0xc9dd52,null));};exports[_0xb336('0x79')]=function(_0x196fc3,_0x3b58d6,_0x8d8495){return db[_0xb336('0x6e')][_0xb336('0x50')]({'where':{'id':_0x196fc3[_0xb336('0x3e')][_0xb336('0x70')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xb336('0x2d')](handleEntityNotFound(_0x3b58d6,null))[_0xb336('0x2d')](function(_0x7096a8){var _0x2e849b=_[_0xb336('0x37')](_0x7096a8,'id');var _0x35179f=[];var _0x4c58a3=[];var _0x48adaa=squel[_0xb336('0x7a')]();_0x48adaa[_0xb336('0x7b')]('tq.TeamId')[_0xb336('0x7c')](_0xb336('0x7d'),'tq')['join'](_0xb336('0x7e'),'ut',_0xb336('0x7f'))[_0xb336('0x49')](_0xb336('0x80'),_0x196fc3[_0xb336('0x53')]['id']);for(var _0x563d95=0x0;_0x563d95<_0x7096a8['length'];_0x563d95+=0x1){let _0x1fe8b8=_0x7096a8[_0x563d95];for(var _0x2c9cf7=0x0;_0x2c9cf7<_0x1fe8b8[_0xb336('0x71')]['length'];_0x2c9cf7+=0x1){let _0x4049a9=_0x1fe8b8[_0xb336('0x71')][_0x2c9cf7];var _0x1f44c9=_0x48adaa[_0xb336('0x81')]();_0x1f44c9[_0xb336('0x49')]('ut.UserId\x20=\x20?',_0x4049a9['id']);_0x4c58a3[_0xb336('0x82')](db[_0xb336('0x75')][_0xb336('0x3e')](_0x1f44c9[_0xb336('0x83')](),{'type':db[_0xb336('0x75')][_0xb336('0x84')][_0xb336('0x85')]})['then'](function(_0x70ceef){if(_0x70ceef['length']===0x1){return _0x4049a9['id'];}else{var _0x28531b=_[_0xb336('0x86')](_[_0xb336('0x37')](_0x70ceef,_0xb336('0x87')),function(_0x5504dd){return _[_0xb336('0x88')](_0x2e849b,_0x5504dd);});if(_0x28531b){return _0x4049a9['id'];}}}));}}return BPromise[_0xb336('0x89')](_0x4c58a3)[_0xb336('0x2d')](function(_0x54e20e){_0x35179f=_(_0x35179f)[_0xb336('0x8a')](_0x54e20e)[_0xb336('0x8b')]()[_0xb336('0x8c')]();return db[_0xb336('0x38')][_0xb336('0x55')]({'where':{'id':_0x196fc3['params']['id']}})['then'](function(_0x1b5f3f){return db[_0xb336('0x75')]['transaction'](function(_0x3b423b){return _0x1b5f3f['removeTeams'](_0x196fc3[_0xb336('0x3e')][_0xb336('0x70')],{'transaction':_0x3b423b})[_0xb336('0x2d')](function(){if(!_[_0xb336('0x8d')](_0x35179f)){return _0x1b5f3f[_0xb336('0x8e')](_0x35179f,{'transaction':_0x3b423b});}})[_0xb336('0x2d')](function(){_0x35179f['forEach'](function(_0xedc41f){socket[_0xb336('0x77')](_0xb336('0x8f'),{'UserId':_0xedc41f,'MailQueueId':_0x1b5f3f['id']});});});});});});})[_0xb336('0x2d')](respondWithStatusCode(_0x3b58d6,null))[_0xb336('0x56')](handleError(_0x3b58d6,null));};exports[_0xb336('0x90')]=function(_0x35a589,_0x1be2b5,_0x4b9a87){return db[_0xb336('0x38')][_0xb336('0x55')]({'where':{'id':_0x35a589['params']['id']}})['then'](handleEntityNotFound(_0x1be2b5,null))[_0xb336('0x2d')](function(_0x41bd38){if(_0x41bd38){return _0x41bd38[_0xb336('0x90')](_0x35a589[_0xb336('0x5d')][_0xb336('0x70')],_[_0xb336('0x91')](_0x35a589['body'],[_0xb336('0x70'),'id'])||{})[_0xb336('0x92')](function(_0x48cc1d){for(var _0x5ef57e=0x0;_0x5ef57e<_0x35a589[_0xb336('0x5d')]['ids']['length'];_0x5ef57e+=0x1){socket[_0xb336('0x77')](_0xb336('0x78'),{'UserId':_0x35a589[_0xb336('0x5d')][_0xb336('0x70')][_0x5ef57e],'MailQueueId':_0x35a589[_0xb336('0x53')]['id']});}return _0x48cc1d;});}})[_0xb336('0x2d')](respondWithResult(_0x1be2b5,null))[_0xb336('0x56')](handleError(_0x1be2b5,null));};exports[_0xb336('0x8e')]=function(_0x3d89c,_0x3fdda5,_0x272878){return db[_0xb336('0x38')][_0xb336('0x55')]({'where':{'id':_0x3d89c[_0xb336('0x53')]['id']}})[_0xb336('0x2d')](handleEntityNotFound(_0x3fdda5,null))[_0xb336('0x2d')](function(_0x8f410f){if(_0x8f410f){return _0x8f410f[_0xb336('0x8e')](_0x3d89c[_0xb336('0x3e')]['ids'])[_0xb336('0x2d')](function(){if(_[_0xb336('0x93')](_0x3d89c[_0xb336('0x3e')]['ids'])){for(var _0x1d3f33=0x0;_0x1d3f33<_0x3d89c['query'][_0xb336('0x70')][_0xb336('0x43')];_0x1d3f33+=0x1){socket['emit'](_0xb336('0x8f'),{'UserId':Number(_0x3d89c['query'][_0xb336('0x70')][_0x1d3f33]),'MailQueueId':Number(_0x3d89c[_0xb336('0x53')]['id'])});}}else{socket[_0xb336('0x77')](_0xb336('0x8f'),{'UserId':Number(_0x3d89c[_0xb336('0x3e')][_0xb336('0x70')]),'MailQueueId':Number(_0x3d89c[_0xb336('0x53')]['id'])});}});}})[_0xb336('0x2d')](respondWithStatusCode(_0x3fdda5,null))[_0xb336('0x56')](handleError(_0x3fdda5,null));};exports[_0xb336('0x94')]=function(_0x5a5930,_0x3088c9,_0x1632c8){var _0x2538e5={};var _0x4d9f13={};var _0x375257;var _0x402150;return db[_0xb336('0x38')][_0xb336('0x60')]({'where':{'id':_0x5a5930[_0xb336('0x53')]['id']}})[_0xb336('0x2d')](handleEntityNotFound(_0x3088c9,null))['then'](function(_0x2e3cc2){if(_0x2e3cc2){_0x375257=_0x2e3cc2;_0x4d9f13['model']=_[_0xb336('0x54')](db[_0xb336('0x64')][_0xb336('0x39')]);_0x4d9f13['query']=_[_0xb336('0x54')](_0x5a5930[_0xb336('0x3e')]);_0x4d9f13[_0xb336('0x3f')]=_[_0xb336('0x40')](_0x4d9f13[_0xb336('0x3d')],_0x4d9f13[_0xb336('0x3e')]);_0x2538e5['attributes']=_[_0xb336('0x40')](_0x4d9f13[_0xb336('0x3d')],qs[_0xb336('0x42')](_0x5a5930[_0xb336('0x3e')][_0xb336('0x42')]));_0x2538e5[_0xb336('0x41')]=_0x2538e5['attributes'][_0xb336('0x43')]?_0x2538e5['attributes']:_0x4d9f13['model'];_0x2538e5[_0xb336('0x47')]=qs[_0xb336('0x48')](_0x5a5930[_0xb336('0x3e')][_0xb336('0x48')]);_0x2538e5['where']=qs[_0xb336('0x3f')](_['pick'](_0x5a5930['query'],_0x4d9f13[_0xb336('0x3f')]));if(_0x5a5930['query'][_0xb336('0x4d')]){_0x2538e5[_0xb336('0x49')]=_[_0xb336('0x4b')](_0x2538e5[_0xb336('0x49')],{'$or':_[_0xb336('0x37')](_0x2538e5[_0xb336('0x41')],function(_0x27e929){var _0x3007f2={};_0x3007f2[_0x27e929]={'$like':'%'+_0x5a5930[_0xb336('0x3e')][_0xb336('0x4d')]+'%'};return _0x3007f2;})});}_0x2538e5=_['merge']({},_0x2538e5,_0x5a5930['options']);return _0x375257['getAgents'](_0x2538e5);}})['then'](function(_0x32c848){if(_0x32c848){_0x402150=_0x32c848[_0xb336('0x43')];if(!_0x5a5930[_0xb336('0x3e')][_0xb336('0x44')](_0xb336('0x45'))){_0x2538e5[_0xb336('0x46')]=qs[_0xb336('0x46')](_0x5a5930[_0xb336('0x3e')][_0xb336('0x46')]);_0x2538e5[_0xb336('0x26')]=qs[_0xb336('0x26')](_0x5a5930[_0xb336('0x3e')][_0xb336('0x26')]);}return _0x375257[_0xb336('0x94')](_0x2538e5);}})[_0xb336('0x2d')](function(_0x2042ed){if(_0x2042ed){return _0x2042ed?{'count':_0x402150,'rows':_0x2042ed}:null;}})[_0xb336('0x2d')](respondWithResult(_0x3088c9,null))[_0xb336('0x56')](handleError(_0x3088c9,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index a89b216..bc862a8 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 _0x43a8=['setMaxListeners','save','update','emit','hook','events','../../mysqldb','MailQueue'];(function(_0x2db667,_0x193cf5){var _0x83ff9=function(_0x5da022){while(--_0x5da022){_0x2db667['push'](_0x2db667['shift']());}};_0x83ff9(++_0x193cf5);}(_0x43a8,0xa5));var _0x843a=function(_0x1aca59,_0x287f24){_0x1aca59=_0x1aca59-0x0;var _0x1b2539=_0x43a8[_0x1aca59];return _0x1b2539;};'use strict';var EventEmitter=require(_0x843a('0x0'));var MailQueue=require(_0x843a('0x1'))['db'][_0x843a('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x843a('0x3')](0x0);var events={'afterCreate':_0x843a('0x4'),'afterUpdate':_0x843a('0x5'),'afterDestroy':'remove'};function emitEvent(_0x254a51){return function(_0x2cd122,_0x5468d4,_0xb2264b){MailQueueEvents[_0x843a('0x6')](_0x254a51+':'+_0x2cd122['id'],_0x2cd122);MailQueueEvents[_0x843a('0x6')](_0x254a51,_0x2cd122);_0xb2264b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x843a('0x7')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0xe197=['hook','events','../../mysqldb','MailQueue','setMaxListeners','save','emit'];(function(_0x10118e,_0x3cb6f8){var _0x18dc49=function(_0x2dd41c){while(--_0x2dd41c){_0x10118e['push'](_0x10118e['shift']());}};_0x18dc49(++_0x3cb6f8);}(_0xe197,0x12e));var _0x7e19=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe197[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x7e19('0x0'));var MailQueue=require(_0x7e19('0x1'))['db'][_0x7e19('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x7e19('0x3')](0x0);var events={'afterCreate':_0x7e19('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x162b1a){return function(_0x58790a,_0x5b35b6,_0x8c86d4){MailQueueEvents[_0x7e19('0x5')](_0x162b1a+':'+_0x58790a['id'],_0x58790a);MailQueueEvents['emit'](_0x162b1a,_0x58790a);_0x8c86d4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x7e19('0x6')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 5afcb7a..1025410 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 _0x0fa4=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','MailQueue','mail_queues','../../config/logger','api'];(function(_0x312d1f,_0x2f97a8){var _0x3a0f42=function(_0x21a357){while(--_0x21a357){_0x312d1f['push'](_0x312d1f['shift']());}};_0x3a0f42(++_0x2f97a8);}(_0x0fa4,0x106));var _0x40fa=function(_0x101039,_0x4cfd50){_0x101039=_0x101039-0x0;var _0x50ab70=_0x0fa4[_0x101039];return _0x50ab70;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x40fa('0x0'))(_0x40fa('0x1'));var moment=require(_0x40fa('0x2'));var BPromise=require(_0x40fa('0x3'));var rp=require(_0x40fa('0x4'));var fs=require('fs');var path=require(_0x40fa('0x5'));var rimraf=require(_0x40fa('0x6'));var config=require(_0x40fa('0x7'));var attributes=require('./mailQueue.attributes');module['exports']=function(_0x13e3a6,_0x4d2600){return _0x13e3a6[_0x40fa('0x8')](_0x40fa('0x9'),attributes,{'tableName':_0x40fa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x96c6=['MailQueue','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./mailQueue.attributes','exports','define'];(function(_0x5bfbc9,_0x363138){var _0x4c58d1=function(_0x1f7558){while(--_0x1f7558){_0x5bfbc9['push'](_0x5bfbc9['shift']());}};_0x4c58d1(++_0x363138);}(_0x96c6,0x169));var _0x696c=function(_0x1d94bb,_0x468cb5){_0x1d94bb=_0x1d94bb-0x0;var _0x24dbef=_0x96c6[_0x1d94bb];return _0x24dbef;};'use strict';var _=require(_0x696c('0x0'));var util=require(_0x696c('0x1'));var logger=require(_0x696c('0x2'))(_0x696c('0x3'));var moment=require(_0x696c('0x4'));var BPromise=require(_0x696c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x696c('0x6'));var rimraf=require(_0x696c('0x7'));var config=require('../../config/environment');var attributes=require(_0x696c('0x8'));module[_0x696c('0x9')]=function(_0x2586da,_0x58a061){return _0x2586da[_0x696c('0xa')](_0x696c('0xb'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 45736a5..f7e786f 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 _0x9165=['limit','include','map','model','catch','ShowMailQueue','MailQueue','find','raw','lodash','util','bluebird','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetMailQueue','findAll','options','where','attributes'];(function(_0x38b182,_0x41a373){var _0xf3e3f6=function(_0x49c368){while(--_0x49c368){_0x38b182['push'](_0x38b182['shift']());}};_0xf3e3f6(++_0x41a373);}(_0x9165,0xf3));var _0x5916=function(_0x35fc80,_0xd6ce40){_0x35fc80=_0x35fc80-0x0;var _0x3f0fb3=_0x9165[_0x35fc80];return _0x3f0fb3;};'use strict';var _=require(_0x5916('0x0'));var util=require(_0x5916('0x1'));var moment=require('moment');var BPromise=require(_0x5916('0x2'));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(_0x5916('0x3'))(_0x5916('0x4'));var config=require(_0x5916('0x5'));var jayson=require(_0x5916('0x6'));var client=jayson[_0x5916('0x7')]['http']({'port':0x232a});config[_0x5916('0x8')]=_['defaults'](config[_0x5916('0x8')],{'host':_0x5916('0x9'),'port':0x18eb});var socket=require(_0x5916('0xa'))(new Redis(config[_0x5916('0x8')]));require(_0x5916('0xb'))[_0x5916('0xc')](socket);function respondWithRpcPromise(_0x3cf567,_0x351b35,_0x298f47){return new BPromise(function(_0x2e3e39,_0x303eb1){return client[_0x5916('0xd')](_0x3cf567,_0x298f47)[_0x5916('0xe')](function(_0x4356ee){logger[_0x5916('0xf')](_0x5916('0x10'),_0x351b35,'request\x20sent');logger[_0x5916('0x11')](_0x5916('0x12'),_0x351b35,_0x5916('0x13'),JSON[_0x5916('0x14')](_0x4356ee));if(_0x4356ee[_0x5916('0x15')]){if(_0x4356ee[_0x5916('0x15')][_0x5916('0x16')]===0x1f4){logger[_0x5916('0x15')]('MailQueue,\x20%s,\x20%s',_0x351b35,_0x4356ee[_0x5916('0x15')]['message']);return _0x303eb1(_0x4356ee['error'][_0x5916('0x17')]);}logger[_0x5916('0x15')](_0x5916('0x10'),_0x351b35,_0x4356ee[_0x5916('0x15')][_0x5916('0x17')]);return _0x2e3e39(_0x4356ee[_0x5916('0x15')][_0x5916('0x17')]);}else{logger[_0x5916('0xf')]('MailQueue,\x20%s,\x20%s',_0x351b35,_0x5916('0x13'));_0x2e3e39(_0x4356ee[_0x5916('0x18')][_0x5916('0x17')]);}})['catch'](function(_0x21d3bc){logger[_0x5916('0x15')](_0x5916('0x10'),_0x351b35,_0x21d3bc);_0x303eb1(_0x21d3bc);});});}exports[_0x5916('0x19')]=function(_0x2c6cea){var _0x36b288=this;return new Promise(function(_0x2b9e7d,_0x258791){return db['MailQueue'][_0x5916('0x1a')]({'raw':_0x2c6cea[_0x5916('0x1b')]?_0x2c6cea[_0x5916('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x2c6cea[_0x5916('0x1b')]?_0x2c6cea['options'][_0x5916('0x1c')]||null:null,'attributes':_0x2c6cea[_0x5916('0x1b')]?_0x2c6cea[_0x5916('0x1b')][_0x5916('0x1d')]||null:null,'limit':_0x2c6cea[_0x5916('0x1b')]?_0x2c6cea[_0x5916('0x1b')][_0x5916('0x1e')]||null:null,'include':_0x2c6cea[_0x5916('0x1b')]?_0x2c6cea[_0x5916('0x1b')][_0x5916('0x1f')]?_[_0x5916('0x20')](_0x2c6cea[_0x5916('0x1b')][_0x5916('0x1f')],function(_0xf940d5){return{'model':db[_0xf940d5[_0x5916('0x21')]],'as':_0xf940d5['as'],'attributes':_0xf940d5[_0x5916('0x1d')],'include':_0xf940d5['include']?_[_0x5916('0x20')](_0xf940d5[_0x5916('0x1f')],function(_0x4c114e){return{'model':db[_0x4c114e[_0x5916('0x21')]],'as':_0x4c114e['as'],'attributes':_0x4c114e[_0x5916('0x1d')],'include':_0x4c114e[_0x5916('0x1f')]?_[_0x5916('0x20')](_0x4c114e[_0x5916('0x1f')],function(_0x2fdc6f){return{'model':db[_0x2fdc6f[_0x5916('0x21')]],'as':_0x2fdc6f['as'],'attributes':_0x2fdc6f[_0x5916('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5916('0xe')](function(_0x2295bb){logger[_0x5916('0xf')](_0x5916('0x19'),_0x2c6cea);logger[_0x5916('0x11')](_0x5916('0x19'),_0x2c6cea,JSON[_0x5916('0x14')](_0x2295bb));_0x2b9e7d(_0x2295bb);})[_0x5916('0x22')](function(_0x8ea49a){logger['error'](_0x5916('0x19'),_0x8ea49a['message'],_0x2c6cea);_0x258791(_0x36b288[_0x5916('0x15')](0x1f4,_0x8ea49a['message']));});});};exports[_0x5916('0x23')]=function(_0x193c81){var _0x4fd1ae=this;return new Promise(function(_0x531da9,_0x57bf2d){return db[_0x5916('0x24')][_0x5916('0x25')]({'raw':_0x193c81[_0x5916('0x1b')]?_0x193c81['options'][_0x5916('0x26')]===undefined?!![]:![]:!![],'where':_0x193c81['options']?_0x193c81[_0x5916('0x1b')]['where']||null:null,'attributes':_0x193c81[_0x5916('0x1b')]?_0x193c81[_0x5916('0x1b')][_0x5916('0x1d')]||null:null,'include':_0x193c81[_0x5916('0x1b')]?_0x193c81[_0x5916('0x1b')][_0x5916('0x1f')]?_['map'](_0x193c81[_0x5916('0x1b')][_0x5916('0x1f')],function(_0x3a545b){return{'model':db[_0x3a545b['model']],'as':_0x3a545b['as'],'attributes':_0x3a545b[_0x5916('0x1d')],'include':_0x3a545b[_0x5916('0x1f')]?_[_0x5916('0x20')](_0x3a545b[_0x5916('0x1f')],function(_0x5c162c){return{'model':db[_0x5c162c[_0x5916('0x21')]],'as':_0x5c162c['as'],'attributes':_0x5c162c['attributes'],'include':_0x5c162c[_0x5916('0x1f')]?_[_0x5916('0x20')](_0x5c162c[_0x5916('0x1f')],function(_0x5a23c3){return{'model':db[_0x5a23c3[_0x5916('0x21')]],'as':_0x5a23c3['as'],'attributes':_0x5a23c3[_0x5916('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5916('0xe')](function(_0x32ad33){logger[_0x5916('0xf')](_0x5916('0x23'),_0x193c81);logger[_0x5916('0x11')](_0x5916('0x23'),_0x193c81,JSON['stringify'](_0x32ad33));_0x531da9(_0x32ad33);})['catch'](function(_0x5bea86){logger[_0x5916('0x15')](_0x5916('0x23'),_0x5bea86[_0x5916('0x17')],_0x193c81);_0x57bf2d(_0x4fd1ae[_0x5916('0x15')](0x1f4,_0x5bea86[_0x5916('0x17')]));});});}; \ No newline at end of file +var _0x2f6c=['../../config/logger','client','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','request','info','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','MailQueue,\x20%s,\x20%s','message','result','GetMailQueue','MailQueue','options','raw','where','attributes','limit','include','model','map','then','catch','find','ShowMailQueue','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x79cd47,_0x16102d){var _0x3b9484=function(_0x23db95){while(--_0x23db95){_0x79cd47['push'](_0x79cd47['shift']());}};_0x3b9484(++_0x16102d);}(_0x2f6c,0x6e));var _0xc2f6=function(_0x1d930e,_0x20d8b8){_0x1d930e=_0x1d930e-0x0;var _0x5bbd66=_0x2f6c[_0x1d930e];return _0x5bbd66;};'use strict';var _=require(_0xc2f6('0x0'));var util=require(_0xc2f6('0x1'));var moment=require(_0xc2f6('0x2'));var BPromise=require('bluebird');var rs=require(_0xc2f6('0x3'));var fs=require('fs');var Redis=require(_0xc2f6('0x4'));var db=require(_0xc2f6('0x5'))['db'];var utils=require(_0xc2f6('0x6'));var logger=require(_0xc2f6('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc2f6('0x8')]['http']({'port':0x232a});config['redis']=_[_0xc2f6('0x9')](config[_0xc2f6('0xa')],{'host':_0xc2f6('0xb'),'port':0x18eb});var socket=require(_0xc2f6('0xc'))(new Redis(config['redis']));require(_0xc2f6('0xd'))['register'](socket);function respondWithRpcPromise(_0xb9d169,_0xc5ca6c,_0x1bf8bb){return new BPromise(function(_0x161719,_0x5e3f5d){return client[_0xc2f6('0xe')](_0xb9d169,_0x1bf8bb)['then'](function(_0x39bb52){logger[_0xc2f6('0xf')]('MailQueue,\x20%s,\x20%s',_0xc5ca6c,_0xc2f6('0x10'));logger[_0xc2f6('0x11')](_0xc2f6('0x12'),_0xc5ca6c,_0xc2f6('0x10'),JSON[_0xc2f6('0x13')](_0x39bb52));if(_0x39bb52[_0xc2f6('0x14')]){if(_0x39bb52[_0xc2f6('0x14')][_0xc2f6('0x15')]===0x1f4){logger[_0xc2f6('0x14')](_0xc2f6('0x16'),_0xc5ca6c,_0x39bb52[_0xc2f6('0x14')][_0xc2f6('0x17')]);return _0x5e3f5d(_0x39bb52['error'][_0xc2f6('0x17')]);}logger[_0xc2f6('0x14')](_0xc2f6('0x16'),_0xc5ca6c,_0x39bb52[_0xc2f6('0x14')][_0xc2f6('0x17')]);return _0x161719(_0x39bb52[_0xc2f6('0x14')][_0xc2f6('0x17')]);}else{logger[_0xc2f6('0xf')]('MailQueue,\x20%s,\x20%s',_0xc5ca6c,'request\x20sent');_0x161719(_0x39bb52[_0xc2f6('0x18')][_0xc2f6('0x17')]);}})['catch'](function(_0x31e59a){logger[_0xc2f6('0x14')](_0xc2f6('0x16'),_0xc5ca6c,_0x31e59a);_0x5e3f5d(_0x31e59a);});});}exports[_0xc2f6('0x19')]=function(_0xf7bc2a){var _0x52cc47=this;return new Promise(function(_0x463764,_0x59f46a){return db[_0xc2f6('0x1a')]['findAll']({'raw':_0xf7bc2a[_0xc2f6('0x1b')]?_0xf7bc2a[_0xc2f6('0x1b')][_0xc2f6('0x1c')]===undefined?!![]:![]:!![],'where':_0xf7bc2a['options']?_0xf7bc2a[_0xc2f6('0x1b')][_0xc2f6('0x1d')]||null:null,'attributes':_0xf7bc2a[_0xc2f6('0x1b')]?_0xf7bc2a[_0xc2f6('0x1b')][_0xc2f6('0x1e')]||null:null,'limit':_0xf7bc2a['options']?_0xf7bc2a[_0xc2f6('0x1b')][_0xc2f6('0x1f')]||null:null,'include':_0xf7bc2a[_0xc2f6('0x1b')]?_0xf7bc2a[_0xc2f6('0x1b')]['include']?_['map'](_0xf7bc2a['options'][_0xc2f6('0x20')],function(_0x1dc124){return{'model':db[_0x1dc124[_0xc2f6('0x21')]],'as':_0x1dc124['as'],'attributes':_0x1dc124[_0xc2f6('0x1e')],'include':_0x1dc124[_0xc2f6('0x20')]?_[_0xc2f6('0x22')](_0x1dc124[_0xc2f6('0x20')],function(_0x1df0b4){return{'model':db[_0x1df0b4['model']],'as':_0x1df0b4['as'],'attributes':_0x1df0b4[_0xc2f6('0x1e')],'include':_0x1df0b4[_0xc2f6('0x20')]?_['map'](_0x1df0b4[_0xc2f6('0x20')],function(_0x52a43a){return{'model':db[_0x52a43a[_0xc2f6('0x21')]],'as':_0x52a43a['as'],'attributes':_0x52a43a[_0xc2f6('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc2f6('0x23')](function(_0x118d10){logger['info'](_0xc2f6('0x19'),_0xf7bc2a);logger[_0xc2f6('0x11')](_0xc2f6('0x19'),_0xf7bc2a,JSON[_0xc2f6('0x13')](_0x118d10));_0x463764(_0x118d10);})[_0xc2f6('0x24')](function(_0x203ef5){logger[_0xc2f6('0x14')](_0xc2f6('0x19'),_0x203ef5[_0xc2f6('0x17')],_0xf7bc2a);_0x59f46a(_0x52cc47[_0xc2f6('0x14')](0x1f4,_0x203ef5[_0xc2f6('0x17')]));});});};exports['ShowMailQueue']=function(_0x55ce22){var _0x4f8da2=this;return new Promise(function(_0x2cff75,_0x434328){return db[_0xc2f6('0x1a')][_0xc2f6('0x25')]({'raw':_0x55ce22[_0xc2f6('0x1b')]?_0x55ce22[_0xc2f6('0x1b')][_0xc2f6('0x1c')]===undefined?!![]:![]:!![],'where':_0x55ce22[_0xc2f6('0x1b')]?_0x55ce22[_0xc2f6('0x1b')][_0xc2f6('0x1d')]||null:null,'attributes':_0x55ce22[_0xc2f6('0x1b')]?_0x55ce22[_0xc2f6('0x1b')][_0xc2f6('0x1e')]||null:null,'include':_0x55ce22[_0xc2f6('0x1b')]?_0x55ce22[_0xc2f6('0x1b')]['include']?_[_0xc2f6('0x22')](_0x55ce22['options'][_0xc2f6('0x20')],function(_0x1456db){return{'model':db[_0x1456db[_0xc2f6('0x21')]],'as':_0x1456db['as'],'attributes':_0x1456db['attributes'],'include':_0x1456db[_0xc2f6('0x20')]?_[_0xc2f6('0x22')](_0x1456db[_0xc2f6('0x20')],function(_0x286ff6){return{'model':db[_0x286ff6[_0xc2f6('0x21')]],'as':_0x286ff6['as'],'attributes':_0x286ff6[_0xc2f6('0x1e')],'include':_0x286ff6['include']?_[_0xc2f6('0x22')](_0x286ff6[_0xc2f6('0x20')],function(_0x3e933f){return{'model':db[_0x3e933f[_0xc2f6('0x21')]],'as':_0x3e933f['as'],'attributes':_0x3e933f['attributes']};}):[]};}):[]};}):[]:[]})[_0xc2f6('0x23')](function(_0x2188b4){logger['info'](_0xc2f6('0x26'),_0x55ce22);logger['debug'](_0xc2f6('0x26'),_0x55ce22,JSON[_0xc2f6('0x13')](_0x2188b4));_0x2cff75(_0x2188b4);})[_0xc2f6('0x24')](function(_0x2ece5d){logger['error'](_0xc2f6('0x26'),_0x2ece5d['message'],_0x55ce22);_0x434328(_0x4f8da2[_0xc2f6('0x14')](0x1f4,_0x2ece5d[_0xc2f6('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index bf2e0dc..9efcaee 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 _0x5ceb=['mailQueue:','save','remove','update','emit','removeListener','register'];(function(_0x51e59d,_0x245c77){var _0x4be8c9=function(_0x11be17){while(--_0x11be17){_0x51e59d['push'](_0x51e59d['shift']());}};_0x4be8c9(++_0x245c77);}(_0x5ceb,0x15f));var _0xb5ce=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x5ceb[_0x565c49];return _0x20ca34;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0xb5ce('0x0'),_0xb5ce('0x1'),_0xb5ce('0x2')];function createListener(_0x18aa3d,_0x438002){return function(_0x2d0f58){_0x438002[_0xb5ce('0x3')](_0x18aa3d,_0x2d0f58);};}function removeListener(_0x19bb4f,_0x3ccd5c){return function(){MailQueueEvents[_0xb5ce('0x4')](_0x19bb4f,_0x3ccd5c);};}exports[_0xb5ce('0x5')]=function(_0x5be1eb){for(var _0x120951=0x0,_0x435f08=events['length'];_0x120951<_0x435f08;_0x120951++){var _0x475390=events[_0x120951];var _0x517c57=createListener(_0xb5ce('0x6')+_0x475390,_0x5be1eb);MailQueueEvents['on'](_0x475390,_0x517c57);}}; \ No newline at end of file +var _0xe5bb=['remove','emit','length','save'];(function(_0x3dd542,_0x2f1e0a){var _0x4cfd8f=function(_0x1851a0){while(--_0x1851a0){_0x3dd542['push'](_0x3dd542['shift']());}};_0x4cfd8f(++_0x2f1e0a);}(_0xe5bb,0xa7));var _0xbe5b=function(_0x25e694,_0x143cd5){_0x25e694=_0x25e694-0x0;var _0xfcfc42=_0xe5bb[_0x25e694];return _0xfcfc42;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0xbe5b('0x0'),_0xbe5b('0x1'),'update'];function createListener(_0x1d8cbc,_0x2df24b){return function(_0xbb434c){_0x2df24b[_0xbe5b('0x2')](_0x1d8cbc,_0xbb434c);};}function removeListener(_0x4a3545,_0x38bb32){return function(){MailQueueEvents['removeListener'](_0x4a3545,_0x38bb32);};}exports['register']=function(_0x58b5f9){for(var _0x21c1d2=0x0,_0x158f84=events[_0xbe5b('0x3')];_0x21c1d2<_0x158f84;_0x21c1d2++){var _0x34acbb=events[_0x21c1d2];var _0x900a11=createListener('mailQueue:'+_0x34acbb,_0x58b5f9);MailQueueEvents['on'](_0x34acbb,_0x900a11);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 4442efa..c83061b 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 _0x94eb=['create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','post'];(function(_0x57a115,_0x12fda8){var _0x88158f=function(_0x5ce7c9){while(--_0x5ce7c9){_0x57a115['push'](_0x57a115['shift']());}};_0x88158f(++_0x12fda8);}(_0x94eb,0x1d4));var _0xb94e=function(_0x3b7708,_0xc09493){_0x3b7708=_0x3b7708-0x0;var _0x3e33f7=_0x94eb[_0x3b7708];return _0x3e33f7;};'use strict';var multer=require(_0xb94e('0x0'));var util=require(_0xb94e('0x1'));var path=require(_0xb94e('0x2'));var timeout=require(_0xb94e('0x3'));var express=require(_0xb94e('0x4'));var router=express['Router']();var auth=require(_0xb94e('0x5'));var interaction=require(_0xb94e('0x6'));var config=require(_0xb94e('0x7'));var controller=require(_0xb94e('0x8'));router[_0xb94e('0x9')]('/',auth[_0xb94e('0xa')](),controller[_0xb94e('0xb')]);router[_0xb94e('0x9')](_0xb94e('0xc'),auth[_0xb94e('0xa')](),controller[_0xb94e('0xd')]);router[_0xb94e('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xb94e('0xe')]('/',auth[_0xb94e('0xa')](),controller[_0xb94e('0xf')]);router[_0xb94e('0x10')](_0xb94e('0x11'),auth[_0xb94e('0xa')](),controller[_0xb94e('0x12')]);router[_0xb94e('0x13')](_0xb94e('0x11'),auth[_0xb94e('0xa')](),controller['destroy']);module[_0xb94e('0x14')]=router; \ No newline at end of file +var _0x402f=['./mailQueueReport.controller','isAuthenticated','index','get','describe','show','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x44b7d6,_0x4a3f3f){var _0x5346f0=function(_0x35ac17){while(--_0x35ac17){_0x44b7d6['push'](_0x44b7d6['shift']());}};_0x5346f0(++_0x4a3f3f);}(_0x402f,0x175));var _0xf402=function(_0x59808b,_0x448eac){_0x59808b=_0x59808b-0x0;var _0x32e13a=_0x402f[_0x59808b];return _0x32e13a;};'use strict';var multer=require(_0xf402('0x0'));var util=require(_0xf402('0x1'));var path=require(_0xf402('0x2'));var timeout=require(_0xf402('0x3'));var express=require(_0xf402('0x4'));var router=express[_0xf402('0x5')]();var auth=require(_0xf402('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf402('0x7'));router['get']('/',auth[_0xf402('0x8')](),controller[_0xf402('0x9')]);router[_0xf402('0xa')]('/describe',auth[_0xf402('0x8')](),controller[_0xf402('0xb')]);router[_0xf402('0xa')]('/:id',auth[_0xf402('0x8')](),controller[_0xf402('0xc')]);router[_0xf402('0xd')]('/',auth[_0xf402('0x8')](),controller['create']);router[_0xf402('0xe')](_0xf402('0xf'),auth[_0xf402('0x8')](),controller[_0xf402('0x10')]);router[_0xf402('0x11')](_0xf402('0xf'),auth[_0xf402('0x8')](),controller[_0xf402('0x12')]);module[_0xf402('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 186a657..2dc8b03 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 _0xaca1=['exports','STRING','DATE','moment','sequelize'];(function(_0x166bc1,_0xf8034){var _0x589664=function(_0x620ebf){while(--_0x620ebf){_0x166bc1['push'](_0x166bc1['shift']());}};_0x589664(++_0xf8034);}(_0xaca1,0x107));var _0x1aca=function(_0xbd0586,_0x3ea034){_0xbd0586=_0xbd0586-0x0;var _0x3cbc64=_0xaca1[_0xbd0586];return _0x3cbc64;};'use strict';var moment=require(_0x1aca('0x0'));var Sequelize=require(_0x1aca('0x1'));module[_0x1aca('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x1aca('0x3')]},'joinAt':{'type':Sequelize[_0x1aca('0x4')]},'leaveAt':{'type':Sequelize[_0x1aca('0x4')]},'acceptAt':{'type':Sequelize[_0x1aca('0x4')]},'exitAt':{'type':Sequelize[_0x1aca('0x4')]},'reason':{'type':Sequelize[_0x1aca('0x3')]}}; \ No newline at end of file +var _0x306c=['DATE','moment','sequelize','STRING'];(function(_0x433a73,_0x468512){var _0x179853=function(_0x6f0f74){while(--_0x6f0f74){_0x433a73['push'](_0x433a73['shift']());}};_0x179853(++_0x468512);}(_0x306c,0xc5));var _0xc306=function(_0x4f0ad6,_0x312929){_0x4f0ad6=_0x4f0ad6-0x0;var _0x2de3b8=_0x306c[_0x4f0ad6];return _0x2de3b8;};'use strict';var moment=require(_0xc306('0x0'));var Sequelize=require(_0xc306('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xc306('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xc306('0x3')]},'exitAt':{'type':Sequelize[_0xc306('0x3')]},'reason':{'type':Sequelize[_0xc306('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index c084051..3b0ac50 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 _0x971d=['sendStatus','status','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','end','stack','name','send','index','map','MailQueueReport','fieldName','type','keys','query','filters','intersection','model','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','attributes','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x23f725,_0x56327a){var _0x2c89ab=function(_0x2f9375){while(--_0x2f9375){_0x23f725['push'](_0x23f725['shift']());}};_0x2c89ab(++_0x56327a);}(_0x971d,0xc5));var _0xd971=function(_0x55dc7c,_0x108898){_0x55dc7c=_0x55dc7c-0x0;var _0x27873f=_0x971d[_0x55dc7c];return _0x27873f;};'use strict';var pdf=require(_0xd971('0x0'));var emlformat=require(_0xd971('0x1'));var rimraf=require(_0xd971('0x2'));var zipdir=require(_0xd971('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd971('0x4'));var moment=require('moment');var BPromise=require(_0xd971('0x5'));var Mustache=require(_0xd971('0x6'));var util=require(_0xd971('0x7'));var path=require(_0xd971('0x8'));var sox=require(_0xd971('0x9'));var csv=require(_0xd971('0xa'));var ejs=require(_0xd971('0xb'));var fs=require('fs');var _=require(_0xd971('0xc'));var squel=require(_0xd971('0xd'));var crypto=require(_0xd971('0xe'));var jsforce=require(_0xd971('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xd971('0xa'));var querystring=require(_0xd971('0x10'));var Papa=require('papaparse');var Redis=require(_0xd971('0x11'));var authService=require(_0xd971('0x12'));var qs=require(_0xd971('0x13'));var as=require(_0xd971('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd971('0x15'));var utils=require(_0xd971('0x16'));var config=require(_0xd971('0x17'));var db=require(_0xd971('0x18'))['db'];function respondWithStatusCode(_0x48b5fe,_0x393012){_0x393012=_0x393012||0xcc;return function(_0x4f4822){if(_0x4f4822){return _0x48b5fe[_0xd971('0x19')](_0x393012);}return _0x48b5fe[_0xd971('0x1a')](_0x393012)['end']();};}function respondWithResult(_0x45fbcb,_0x4d0f72){_0x4d0f72=_0x4d0f72||0xc8;return function(_0x384951){if(_0x384951){return _0x45fbcb[_0xd971('0x1a')](_0x4d0f72)[_0xd971('0x1b')](_0x384951);}};}function respondWithFilteredResult(_0x15e866,_0x223ff0){return function(_0x41acf7){if(_0x41acf7){var _0x5f5a04=_0x41acf7[_0xd971('0x1c')],_0x19510f=_0x223ff0[_0xd971('0x1d')],_0x52638e=_0x223ff0['offset']+_0x223ff0[_0xd971('0x1e')],_0x1e5fe5;if(_0x52638e>=_0x5f5a04){_0x52638e=_0x5f5a04;_0x1e5fe5=0xc8;}else{_0x1e5fe5=0xce;}_0x15e866[_0xd971('0x1a')](_0x1e5fe5);return _0x15e866[_0xd971('0x1f')](_0xd971('0x20'),_0x19510f+'-'+_0x52638e+'/'+_0x5f5a04)[_0xd971('0x1b')](_0x41acf7);}return null;};}function patchUpdates(_0x5f38cd){return function(_0x221aff){try{jsonpatch['apply'](_0x221aff,_0x5f38cd,!![]);}catch(_0x4b2fb5){return BPromise[_0xd971('0x21')](_0x4b2fb5);}return _0x221aff['save']();};}function saveUpdates(_0x1a65fc,_0x4e1f12){return function(_0x15bbb8){if(_0x15bbb8){return _0x15bbb8[_0xd971('0x22')](_0x1a65fc)[_0xd971('0x23')](function(_0x395663){return _0x395663;});}return null;};}function removeEntity(_0x1dd362,_0x235b0b){return function(_0x4579a9){if(_0x4579a9){return _0x4579a9[_0xd971('0x24')]()[_0xd971('0x23')](function(){_0x1dd362[_0xd971('0x1a')](0xcc)[_0xd971('0x25')]();});}};}function handleEntityNotFound(_0x41b41f,_0x168474){return function(_0x31517b){if(!_0x31517b){_0x41b41f[_0xd971('0x19')](0x194);}return _0x31517b;};}function handleError(_0x1c6eb2,_0x2df904){_0x2df904=_0x2df904||0x1f4;return function(_0x17759e){logger['error'](_0x17759e[_0xd971('0x26')]);if(_0x17759e[_0xd971('0x27')]){delete _0x17759e[_0xd971('0x27')];}_0x1c6eb2[_0xd971('0x1a')](_0x2df904)[_0xd971('0x28')](_0x17759e);};}exports[_0xd971('0x29')]=function(_0x15e9d9,_0x257ffc){var _0x1c1986={},_0x444fe5={},_0x2d96ae={'count':0x0,'rows':[]};var _0x22e824=_[_0xd971('0x2a')](db[_0xd971('0x2b')]['rawAttributes'],function(_0x4fe8a1){return{'name':_0x4fe8a1[_0xd971('0x2c')],'type':_0x4fe8a1[_0xd971('0x2d')]['key']};});_0x444fe5['model']=_[_0xd971('0x2a')](_0x22e824,_0xd971('0x27'));_0x444fe5['query']=_[_0xd971('0x2e')](_0x15e9d9[_0xd971('0x2f')]);_0x444fe5[_0xd971('0x30')]=_[_0xd971('0x31')](_0x444fe5[_0xd971('0x32')],_0x444fe5[_0xd971('0x2f')]);_0x1c1986['attributes']=_[_0xd971('0x31')](_0x444fe5[_0xd971('0x32')],qs[_0xd971('0x33')](_0x15e9d9[_0xd971('0x2f')][_0xd971('0x33')]));_0x1c1986['attributes']=_0x1c1986['attributes'][_0xd971('0x34')]?_0x1c1986['attributes']:_0x444fe5[_0xd971('0x32')];if(!_0x15e9d9[_0xd971('0x2f')]['hasOwnProperty'](_0xd971('0x35'))){_0x1c1986[_0xd971('0x1e')]=qs[_0xd971('0x1e')](_0x15e9d9[_0xd971('0x2f')][_0xd971('0x1e')]);_0x1c1986[_0xd971('0x1d')]=qs[_0xd971('0x1d')](_0x15e9d9['query'][_0xd971('0x1d')]);}_0x1c1986[_0xd971('0x36')]=qs['sort'](_0x15e9d9[_0xd971('0x2f')][_0xd971('0x37')]);_0x1c1986[_0xd971('0x38')]=qs['filters'](_[_0xd971('0x39')](_0x15e9d9[_0xd971('0x2f')],_0x444fe5[_0xd971('0x30')]),_0x22e824);if(_0x15e9d9[_0xd971('0x2f')][_0xd971('0x3a')]){_0x1c1986[_0xd971('0x38')]=_[_0xd971('0x3b')](_0x1c1986[_0xd971('0x38')],{'$or':_['map'](_0x22e824,function(_0x4b70eb){if(_0x4b70eb[_0xd971('0x2d')]!==_0xd971('0x3c')){var _0x167198={};_0x167198[_0x4b70eb['name']]={'$like':'%'+_0x15e9d9[_0xd971('0x2f')][_0xd971('0x3a')]+'%'};return _0x167198;}})});}_0x1c1986=_[_0xd971('0x3b')]({},_0x1c1986,_0x15e9d9[_0xd971('0x3d')]);var _0x1908ae={'where':_0x1c1986[_0xd971('0x38')]};return db[_0xd971('0x2b')][_0xd971('0x1c')](_0x1908ae)[_0xd971('0x23')](function(_0x516337){_0x2d96ae[_0xd971('0x1c')]=_0x516337;if(_0x15e9d9[_0xd971('0x2f')][_0xd971('0x3e')]){_0x1c1986[_0xd971('0x3f')]=[{'all':!![]}];}return db[_0xd971('0x2b')][_0xd971('0x40')](_0x1c1986);})[_0xd971('0x23')](function(_0xa885b2){_0x2d96ae[_0xd971('0x41')]=_0xa885b2;return _0x2d96ae;})[_0xd971('0x23')](respondWithFilteredResult(_0x257ffc,_0x1c1986))[_0xd971('0x42')](handleError(_0x257ffc,null));};exports[_0xd971('0x43')]=function(_0x524e99,_0xd1b132){var _0xd1ef68={'raw':!![],'where':{'id':_0x524e99[_0xd971('0x44')]['id']}},_0x277d39={};_0x277d39['model']=_[_0xd971('0x2e')](db[_0xd971('0x2b')]['rawAttributes']);_0x277d39[_0xd971('0x2f')]=_['keys'](_0x524e99['query']);_0x277d39[_0xd971('0x30')]=_[_0xd971('0x31')](_0x277d39[_0xd971('0x32')],_0x277d39['query']);_0xd1ef68['attributes']=_['intersection'](_0x277d39['model'],qs[_0xd971('0x33')](_0x524e99[_0xd971('0x2f')]['fields']));_0xd1ef68[_0xd971('0x45')]=_0xd1ef68['attributes'][_0xd971('0x34')]?_0xd1ef68['attributes']:_0x277d39[_0xd971('0x32')];if(_0x524e99['query'][_0xd971('0x3e')]){_0xd1ef68[_0xd971('0x3f')]=[{'all':!![]}];}_0xd1ef68=_[_0xd971('0x3b')]({},_0xd1ef68,_0x524e99[_0xd971('0x3d')]);return db[_0xd971('0x2b')][_0xd971('0x46')](_0xd1ef68)['then'](handleEntityNotFound(_0xd1b132,null))[_0xd971('0x23')](respondWithResult(_0xd1b132,null))[_0xd971('0x42')](handleError(_0xd1b132,null));};exports[_0xd971('0x47')]=function(_0x1d51c9,_0x1d4a94){return db[_0xd971('0x2b')][_0xd971('0x47')](_0x1d51c9['body'],{})[_0xd971('0x23')](respondWithResult(_0x1d4a94,0xc9))[_0xd971('0x42')](handleError(_0x1d4a94,null));};exports[_0xd971('0x22')]=function(_0x15a0f0,_0x202b51){if(_0x15a0f0['body']['id']){delete _0x15a0f0[_0xd971('0x48')]['id'];}return db[_0xd971('0x2b')][_0xd971('0x46')]({'where':{'id':_0x15a0f0['params']['id']}})[_0xd971('0x23')](handleEntityNotFound(_0x202b51,null))[_0xd971('0x23')](saveUpdates(_0x15a0f0[_0xd971('0x48')],null))[_0xd971('0x23')](respondWithResult(_0x202b51,null))[_0xd971('0x42')](handleError(_0x202b51,null));};exports[_0xd971('0x24')]=function(_0x4bd9f4,_0x462a23){return db[_0xd971('0x2b')][_0xd971('0x46')]({'where':{'id':_0x4bd9f4['params']['id']}})[_0xd971('0x23')](handleEntityNotFound(_0x462a23,null))[_0xd971('0x23')](removeEntity(_0x462a23,null))[_0xd971('0x42')](handleError(_0x462a23,null));};exports[_0xd971('0x49')]=function(_0x28330a,_0x5c0bac){return db[_0xd971('0x2b')]['describe']()['then'](respondWithResult(_0x5c0bac,null))[_0xd971('0x42')](handleError(_0x5c0bac,null));}; \ No newline at end of file +var _0x5341=['stack','name','send','index','map','MailQueueReport','fieldName','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','findAll','catch','show','params','rawAttributes','includeAll','include','options','create','body','destroy','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','error'];(function(_0x97d6d5,_0x4453e7){var _0x3baaa2=function(_0x1df1a8){while(--_0x1df1a8){_0x97d6d5['push'](_0x97d6d5['shift']());}};_0x3baaa2(++_0x4453e7);}(_0x5341,0xbb));var _0x1534=function(_0xcc2a6a,_0x1f4b3a){_0xcc2a6a=_0xcc2a6a-0x0;var _0x51448f=_0x5341[_0xcc2a6a];return _0x51448f;};'use strict';var pdf=require(_0x1534('0x0'));var emlformat=require(_0x1534('0x1'));var rimraf=require(_0x1534('0x2'));var zipdir=require(_0x1534('0x3'));var jsonpatch=require(_0x1534('0x4'));var rp=require(_0x1534('0x5'));var moment=require(_0x1534('0x6'));var BPromise=require(_0x1534('0x7'));var Mustache=require('mustache');var util=require(_0x1534('0x8'));var path=require('path');var sox=require(_0x1534('0x9'));var csv=require(_0x1534('0xa'));var ejs=require(_0x1534('0xb'));var fs=require('fs');var _=require(_0x1534('0xc'));var squel=require(_0x1534('0xd'));var crypto=require('crypto');var jsforce=require(_0x1534('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1534('0xa'));var querystring=require('querystring');var Papa=require(_0x1534('0xf'));var Redis=require(_0x1534('0x10'));var authService=require(_0x1534('0x11'));var qs=require(_0x1534('0x12'));var as=require(_0x1534('0x13'));var hardwareService=require(_0x1534('0x14'));var logger=require(_0x1534('0x15'))('api');var utils=require(_0x1534('0x16'));var config=require(_0x1534('0x17'));var db=require(_0x1534('0x18'))['db'];function respondWithStatusCode(_0x42d1fb,_0x4abf99){_0x4abf99=_0x4abf99||0xcc;return function(_0x51b0c4){if(_0x51b0c4){return _0x42d1fb[_0x1534('0x19')](_0x4abf99);}return _0x42d1fb[_0x1534('0x1a')](_0x4abf99)[_0x1534('0x1b')]();};}function respondWithResult(_0x551afb,_0x4d54b9){_0x4d54b9=_0x4d54b9||0xc8;return function(_0x3144b9){if(_0x3144b9){return _0x551afb[_0x1534('0x1a')](_0x4d54b9)[_0x1534('0x1c')](_0x3144b9);}};}function respondWithFilteredResult(_0x23a515,_0x540446){return function(_0x2d15ef){if(_0x2d15ef){var _0x3bd85f=_0x2d15ef[_0x1534('0x1d')],_0x46074d=_0x540446['offset'],_0x2c34c5=_0x540446[_0x1534('0x1e')]+_0x540446[_0x1534('0x1f')],_0x13ee42;if(_0x2c34c5>=_0x3bd85f){_0x2c34c5=_0x3bd85f;_0x13ee42=0xc8;}else{_0x13ee42=0xce;}_0x23a515[_0x1534('0x1a')](_0x13ee42);return _0x23a515[_0x1534('0x20')](_0x1534('0x21'),_0x46074d+'-'+_0x2c34c5+'/'+_0x3bd85f)[_0x1534('0x1c')](_0x2d15ef);}return null;};}function patchUpdates(_0x5342e1){return function(_0x205306){try{jsonpatch['apply'](_0x205306,_0x5342e1,!![]);}catch(_0x3f58ef){return BPromise['reject'](_0x3f58ef);}return _0x205306[_0x1534('0x22')]();};}function saveUpdates(_0x23e3f9,_0x40adc6){return function(_0x21336e){if(_0x21336e){return _0x21336e[_0x1534('0x23')](_0x23e3f9)[_0x1534('0x24')](function(_0x5eb9c2){return _0x5eb9c2;});}return null;};}function removeEntity(_0x145ce5,_0x990bdb){return function(_0x1acdb5){if(_0x1acdb5){return _0x1acdb5['destroy']()[_0x1534('0x24')](function(){_0x145ce5[_0x1534('0x1a')](0xcc)[_0x1534('0x1b')]();});}};}function handleEntityNotFound(_0x15710a,_0x2a151f){return function(_0x19b424){if(!_0x19b424){_0x15710a[_0x1534('0x19')](0x194);}return _0x19b424;};}function handleError(_0x408d34,_0x32630e){_0x32630e=_0x32630e||0x1f4;return function(_0x14db73){logger[_0x1534('0x25')](_0x14db73[_0x1534('0x26')]);if(_0x14db73[_0x1534('0x27')]){delete _0x14db73[_0x1534('0x27')];}_0x408d34[_0x1534('0x1a')](_0x32630e)[_0x1534('0x28')](_0x14db73);};}exports[_0x1534('0x29')]=function(_0x5c3a3c,_0x2935d6){var _0x107113={},_0x194932={},_0xb06599={'count':0x0,'rows':[]};var _0x31a201=_[_0x1534('0x2a')](db[_0x1534('0x2b')]['rawAttributes'],function(_0x5d625b){return{'name':_0x5d625b[_0x1534('0x2c')],'type':_0x5d625b['type']['key']};});_0x194932[_0x1534('0x2d')]=_[_0x1534('0x2a')](_0x31a201,_0x1534('0x27'));_0x194932[_0x1534('0x2e')]=_[_0x1534('0x2f')](_0x5c3a3c[_0x1534('0x2e')]);_0x194932[_0x1534('0x30')]=_[_0x1534('0x31')](_0x194932[_0x1534('0x2d')],_0x194932[_0x1534('0x2e')]);_0x107113['attributes']=_[_0x1534('0x31')](_0x194932[_0x1534('0x2d')],qs['fields'](_0x5c3a3c[_0x1534('0x2e')][_0x1534('0x32')]));_0x107113['attributes']=_0x107113['attributes'][_0x1534('0x33')]?_0x107113[_0x1534('0x34')]:_0x194932[_0x1534('0x2d')];if(!_0x5c3a3c[_0x1534('0x2e')][_0x1534('0x35')](_0x1534('0x36'))){_0x107113[_0x1534('0x1f')]=qs[_0x1534('0x1f')](_0x5c3a3c[_0x1534('0x2e')][_0x1534('0x1f')]);_0x107113['offset']=qs['offset'](_0x5c3a3c[_0x1534('0x2e')]['offset']);}_0x107113['order']=qs[_0x1534('0x37')](_0x5c3a3c['query']['sort']);_0x107113[_0x1534('0x38')]=qs[_0x1534('0x30')](_[_0x1534('0x39')](_0x5c3a3c[_0x1534('0x2e')],_0x194932['filters']),_0x31a201);if(_0x5c3a3c[_0x1534('0x2e')][_0x1534('0x3a')]){_0x107113[_0x1534('0x38')]=_['merge'](_0x107113[_0x1534('0x38')],{'$or':_[_0x1534('0x2a')](_0x31a201,function(_0xf24c24){if(_0xf24c24[_0x1534('0x3b')]!==_0x1534('0x3c')){var _0x154a26={};_0x154a26[_0xf24c24[_0x1534('0x27')]]={'$like':'%'+_0x5c3a3c[_0x1534('0x2e')]['filter']+'%'};return _0x154a26;}})});}_0x107113=_[_0x1534('0x3d')]({},_0x107113,_0x5c3a3c['options']);var _0x4c2405={'where':_0x107113[_0x1534('0x38')]};return db[_0x1534('0x2b')][_0x1534('0x1d')](_0x4c2405)[_0x1534('0x24')](function(_0x878f7){_0xb06599[_0x1534('0x1d')]=_0x878f7;if(_0x5c3a3c[_0x1534('0x2e')]['includeAll']){_0x107113['include']=[{'all':!![]}];}return db[_0x1534('0x2b')][_0x1534('0x3e')](_0x107113);})['then'](function(_0x171028){_0xb06599['rows']=_0x171028;return _0xb06599;})[_0x1534('0x24')](respondWithFilteredResult(_0x2935d6,_0x107113))[_0x1534('0x3f')](handleError(_0x2935d6,null));};exports[_0x1534('0x40')]=function(_0x46f6ef,_0x3f1c49){var _0x8ab61e={'raw':!![],'where':{'id':_0x46f6ef[_0x1534('0x41')]['id']}},_0x2d5f60={};_0x2d5f60[_0x1534('0x2d')]=_[_0x1534('0x2f')](db[_0x1534('0x2b')][_0x1534('0x42')]);_0x2d5f60['query']=_[_0x1534('0x2f')](_0x46f6ef[_0x1534('0x2e')]);_0x2d5f60[_0x1534('0x30')]=_[_0x1534('0x31')](_0x2d5f60[_0x1534('0x2d')],_0x2d5f60[_0x1534('0x2e')]);_0x8ab61e[_0x1534('0x34')]=_[_0x1534('0x31')](_0x2d5f60[_0x1534('0x2d')],qs[_0x1534('0x32')](_0x46f6ef['query'][_0x1534('0x32')]));_0x8ab61e['attributes']=_0x8ab61e[_0x1534('0x34')][_0x1534('0x33')]?_0x8ab61e[_0x1534('0x34')]:_0x2d5f60[_0x1534('0x2d')];if(_0x46f6ef[_0x1534('0x2e')][_0x1534('0x43')]){_0x8ab61e[_0x1534('0x44')]=[{'all':!![]}];}_0x8ab61e=_[_0x1534('0x3d')]({},_0x8ab61e,_0x46f6ef[_0x1534('0x45')]);return db[_0x1534('0x2b')]['find'](_0x8ab61e)['then'](handleEntityNotFound(_0x3f1c49,null))[_0x1534('0x24')](respondWithResult(_0x3f1c49,null))[_0x1534('0x3f')](handleError(_0x3f1c49,null));};exports['create']=function(_0x44bc33,_0x48ad32){return db[_0x1534('0x2b')][_0x1534('0x46')](_0x44bc33[_0x1534('0x47')],{})[_0x1534('0x24')](respondWithResult(_0x48ad32,0xc9))[_0x1534('0x3f')](handleError(_0x48ad32,null));};exports['update']=function(_0x67d14b,_0x2799f5){if(_0x67d14b['body']['id']){delete _0x67d14b['body']['id'];}return db['MailQueueReport']['find']({'where':{'id':_0x67d14b[_0x1534('0x41')]['id']}})['then'](handleEntityNotFound(_0x2799f5,null))[_0x1534('0x24')](saveUpdates(_0x67d14b[_0x1534('0x47')],null))[_0x1534('0x24')](respondWithResult(_0x2799f5,null))[_0x1534('0x3f')](handleError(_0x2799f5,null));};exports[_0x1534('0x48')]=function(_0x2a6f3a,_0x19c612){return db[_0x1534('0x2b')][_0x1534('0x49')]({'where':{'id':_0x2a6f3a[_0x1534('0x41')]['id']}})[_0x1534('0x24')](handleEntityNotFound(_0x19c612,null))[_0x1534('0x24')](removeEntity(_0x19c612,null))['catch'](handleError(_0x19c612,null));};exports[_0x1534('0x4a')]=function(_0x8d47a9,_0x4459ff){return db['MailQueueReport'][_0x1534('0x4a')]()[_0x1534('0x24')](respondWithResult(_0x4459ff,null))[_0x1534('0x3f')](handleError(_0x4459ff,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 4751250..1b9f633 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 _0x49c3=['request-promise','path','rimraf','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird'];(function(_0x1b8e64,_0x179b76){var _0x481c86=function(_0x33fd12){while(--_0x33fd12){_0x1b8e64['push'](_0x1b8e64['shift']());}};_0x481c86(++_0x179b76);}(_0x49c3,0xb1));var _0x349c=function(_0x1fb42e,_0x351df6){_0x1fb42e=_0x1fb42e-0x0;var _0x6622a4=_0x49c3[_0x1fb42e];return _0x6622a4;};'use strict';var _=require(_0x349c('0x0'));var util=require(_0x349c('0x1'));var logger=require(_0x349c('0x2'))('api');var moment=require(_0x349c('0x3'));var BPromise=require(_0x349c('0x4'));var rp=require(_0x349c('0x5'));var fs=require('fs');var path=require(_0x349c('0x6'));var rimraf=require(_0x349c('0x7'));var config=require('../../config/environment');var attributes=require(_0x349c('0x8'));module[_0x349c('0x9')]=function(_0x5290ec,_0x47b9d8){return _0x5290ec[_0x349c('0xa')](_0x349c('0xb'),attributes,{'tableName':_0x349c('0xc'),'paranoid':![],'indexes':[{'name':_0x349c('0xd'),'fields':[_0x349c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x27d1=['./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xeb212d,_0x32a5f8){var _0x6fb55f=function(_0x2a7079){while(--_0x2a7079){_0xeb212d['push'](_0xeb212d['shift']());}};_0x6fb55f(++_0x32a5f8);}(_0x27d1,0x132));var _0x127d=function(_0x5bd345,_0x453309){_0x5bd345=_0x5bd345-0x0;var _0x20b76b=_0x27d1[_0x5bd345];return _0x20b76b;};'use strict';var _=require(_0x127d('0x0'));var util=require(_0x127d('0x1'));var logger=require(_0x127d('0x2'))(_0x127d('0x3'));var moment=require('moment');var BPromise=require(_0x127d('0x4'));var rp=require(_0x127d('0x5'));var fs=require('fs');var path=require(_0x127d('0x6'));var rimraf=require(_0x127d('0x7'));var config=require(_0x127d('0x8'));var attributes=require(_0x127d('0x9'));module[_0x127d('0xa')]=function(_0x34d6b2,_0x5252c1){return _0x34d6b2[_0x127d('0xb')](_0x127d('0xc'),attributes,{'tableName':_0x127d('0xd'),'paranoid':![],'indexes':[{'name':_0x127d('0xe'),'fields':[_0x127d('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 5977133..2d6cd1b 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc1c6=['stringify','error','message','info','catch','create','options','raw','CreateMailQueueReport','UpdateMailQueueReport','MailQueueReport','update','body','where','limit','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x5d5262,_0x4154fb){_0x5d5262=_0x5d5262-0x0;var _0x1fb4b5=_0xc1c6[_0x5d5262];return _0x1fb4b5;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var moment=require(_0x6c1c('0x2'));var BPromise=require('bluebird');var rs=require(_0x6c1c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c1c('0x4'))['db'];var utils=require(_0x6c1c('0x5'));var logger=require(_0x6c1c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6c1c('0x7'));var client=jayson['client'][_0x6c1c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x582bec,_0xe510ca,_0x2eb1ba){return new BPromise(function(_0x38369d,_0x2cec58){return client['request'](_0x582bec,_0x2eb1ba)[_0x6c1c('0x9')](function(_0x3ca985){logger['info'](_0x6c1c('0xa'),_0xe510ca,_0x6c1c('0xb'));logger[_0x6c1c('0xc')](_0x6c1c('0xd'),_0xe510ca,'request\x20sent',JSON[_0x6c1c('0xe')](_0x3ca985));if(_0x3ca985[_0x6c1c('0xf')]){if(_0x3ca985[_0x6c1c('0xf')]['code']===0x1f4){logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x3ca985[_0x6c1c('0xf')]['message']);return _0x2cec58(_0x3ca985[_0x6c1c('0xf')]['message']);}logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x3ca985[_0x6c1c('0xf')][_0x6c1c('0x10')]);return _0x38369d(_0x3ca985[_0x6c1c('0xf')][_0x6c1c('0x10')]);}else{logger[_0x6c1c('0x11')](_0x6c1c('0xa'),_0xe510ca,_0x6c1c('0xb'));_0x38369d(_0x3ca985['result'][_0x6c1c('0x10')]);}})[_0x6c1c('0x12')](function(_0x5214ee){logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x5214ee);_0x2cec58(_0x5214ee);});});}exports['CreateMailQueueReport']=function(_0x137770){var _0x4ede06=this;return new Promise(function(_0x338dc2,_0x1a0ab9){return db['MailQueueReport'][_0x6c1c('0x13')](_0x137770['body'],{'raw':_0x137770[_0x6c1c('0x14')]?_0x137770[_0x6c1c('0x14')][_0x6c1c('0x15')]===undefined?!![]:![]:!![]})[_0x6c1c('0x9')](function(_0x1acf7f){logger[_0x6c1c('0x11')](_0x6c1c('0x16'),_0x137770);logger[_0x6c1c('0xc')](_0x6c1c('0x16'),_0x137770,JSON[_0x6c1c('0xe')](_0x1acf7f));_0x338dc2(_0x1acf7f);})[_0x6c1c('0x12')](function(_0x450b1f){logger[_0x6c1c('0xf')](_0x6c1c('0x16'),_0x450b1f[_0x6c1c('0x10')],_0x137770);_0x1a0ab9(_0x4ede06[_0x6c1c('0xf')](0x1f4,_0x450b1f[_0x6c1c('0x10')]));});});};exports[_0x6c1c('0x17')]=function(_0x3a3f13){var _0x1dba08=this;return new Promise(function(_0x96046a,_0x3f517e){return db[_0x6c1c('0x18')][_0x6c1c('0x19')](_0x3a3f13[_0x6c1c('0x1a')],{'raw':_0x3a3f13[_0x6c1c('0x14')]?_0x3a3f13[_0x6c1c('0x14')][_0x6c1c('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a3f13[_0x6c1c('0x14')]?_0x3a3f13['options'][_0x6c1c('0x1b')]||null:null,'attributes':_0x3a3f13['options']?_0x3a3f13[_0x6c1c('0x14')]['attributes']||null:null,'limit':_0x3a3f13[_0x6c1c('0x14')]?_0x3a3f13['options'][_0x6c1c('0x1c')]||null:null})[_0x6c1c('0x9')](function(_0x504348){logger[_0x6c1c('0x11')](_0x6c1c('0x17'),_0x3a3f13);logger['debug'](_0x6c1c('0x17'),_0x3a3f13,JSON[_0x6c1c('0xe')](_0x504348));_0x96046a(_0x504348);})[_0x6c1c('0x12')](function(_0xcb489a){logger['error']('UpdateMailQueueReport',_0xcb489a[_0x6c1c('0x10')],_0x3a3f13);_0x3f517e(_0x1dba08[_0x6c1c('0xf')](0x1f4,_0xcb489a[_0x6c1c('0x10')]));});});}; \ No newline at end of file +var _0xf61e=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateMailQueueReport','create','body','options','raw','then','update','where','attributes','limit','UpdateMailQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x55fb83,_0x1d3856){var _0x59a87a=function(_0x38bdd1){while(--_0x38bdd1){_0x55fb83['push'](_0x55fb83['shift']());}};_0x59a87a(++_0x1d3856);}(_0xf61e,0x191));var _0xef61=function(_0x30537d,_0x241cbe){_0x30537d=_0x30537d-0x0;var _0x2ca4c4=_0xf61e[_0x30537d];return _0x2ca4c4;};'use strict';var _=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var moment=require(_0xef61('0x2'));var BPromise=require(_0xef61('0x3'));var rs=require(_0xef61('0x4'));var fs=require('fs');var Redis=require(_0xef61('0x5'));var db=require(_0xef61('0x6'))['db'];var utils=require(_0xef61('0x7'));var logger=require(_0xef61('0x8'))(_0xef61('0x9'));var config=require(_0xef61('0xa'));var jayson=require(_0xef61('0xb'));var client=jayson['client'][_0xef61('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3e2f79,_0x4f0cc5,_0x2242a7){return new BPromise(function(_0x277fa1,_0x106e7f){return client['request'](_0x3e2f79,_0x2242a7)['then'](function(_0x188894){logger[_0xef61('0xd')](_0xef61('0xe'),_0x4f0cc5,_0xef61('0xf'));logger[_0xef61('0x10')](_0xef61('0x11'),_0x4f0cc5,_0xef61('0xf'),JSON[_0xef61('0x12')](_0x188894));if(_0x188894[_0xef61('0x13')]){if(_0x188894[_0xef61('0x13')][_0xef61('0x14')]===0x1f4){logger[_0xef61('0x13')](_0xef61('0xe'),_0x4f0cc5,_0x188894[_0xef61('0x13')]['message']);return _0x106e7f(_0x188894[_0xef61('0x13')]['message']);}logger[_0xef61('0x13')](_0xef61('0xe'),_0x4f0cc5,_0x188894[_0xef61('0x13')][_0xef61('0x15')]);return _0x277fa1(_0x188894['error'][_0xef61('0x15')]);}else{logger[_0xef61('0xd')](_0xef61('0xe'),_0x4f0cc5,_0xef61('0xf'));_0x277fa1(_0x188894['result'][_0xef61('0x15')]);}})[_0xef61('0x16')](function(_0x4f7a62){logger[_0xef61('0x13')](_0xef61('0xe'),_0x4f0cc5,_0x4f7a62);_0x106e7f(_0x4f7a62);});});}exports[_0xef61('0x17')]=function(_0x22dc1b){var _0xfc36d6=this;return new Promise(function(_0x28315a,_0xdd5e38){return db['MailQueueReport'][_0xef61('0x18')](_0x22dc1b[_0xef61('0x19')],{'raw':_0x22dc1b['options']?_0x22dc1b[_0xef61('0x1a')][_0xef61('0x1b')]===undefined?!![]:![]:!![]})[_0xef61('0x1c')](function(_0x26cf42){logger[_0xef61('0xd')](_0xef61('0x17'),_0x22dc1b);logger[_0xef61('0x10')]('CreateMailQueueReport',_0x22dc1b,JSON['stringify'](_0x26cf42));_0x28315a(_0x26cf42);})[_0xef61('0x16')](function(_0x58bd7d){logger[_0xef61('0x13')]('CreateMailQueueReport',_0x58bd7d['message'],_0x22dc1b);_0xdd5e38(_0xfc36d6[_0xef61('0x13')](0x1f4,_0x58bd7d['message']));});});};exports['UpdateMailQueueReport']=function(_0xfbee94){var _0x3782c6=this;return new Promise(function(_0x3ceb14,_0x111bac){return db['MailQueueReport'][_0xef61('0x1d')](_0xfbee94['body'],{'raw':_0xfbee94[_0xef61('0x1a')]?_0xfbee94[_0xef61('0x1a')][_0xef61('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfbee94[_0xef61('0x1a')]?_0xfbee94[_0xef61('0x1a')][_0xef61('0x1e')]||null:null,'attributes':_0xfbee94[_0xef61('0x1a')]?_0xfbee94[_0xef61('0x1a')][_0xef61('0x1f')]||null:null,'limit':_0xfbee94[_0xef61('0x1a')]?_0xfbee94[_0xef61('0x1a')][_0xef61('0x20')]||null:null})[_0xef61('0x1c')](function(_0x63edd4){logger[_0xef61('0xd')](_0xef61('0x21'),_0xfbee94);logger[_0xef61('0x10')](_0xef61('0x21'),_0xfbee94,JSON[_0xef61('0x12')](_0x63edd4));_0x3ceb14(_0x63edd4);})[_0xef61('0x16')](function(_0x43bc47){logger[_0xef61('0x13')]('UpdateMailQueueReport',_0x43bc47['message'],_0xfbee94);_0x111bac(_0x3782c6[_0xef61('0x13')](0x1f4,_0x43bc47[_0xef61('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 5a487ba..926544a 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 _0x6c15=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','connect-timeout','express'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x6c15,0xf8));var _0x56c1=function(_0x528912,_0x18073b){_0x528912=_0x528912-0x0;var _0x32efd4=_0x6c15[_0x528912];return _0x32efd4;};'use strict';var multer=require(_0x56c1('0x0'));var util=require(_0x56c1('0x1'));var path=require('path');var timeout=require(_0x56c1('0x2'));var express=require(_0x56c1('0x3'));var router=express[_0x56c1('0x4')]();var auth=require(_0x56c1('0x5'));var interaction=require(_0x56c1('0x6'));var config=require(_0x56c1('0x7'));module[_0x56c1('0x8')]=router; \ No newline at end of file +var _0xc77e=['../../components/auth/service','exports','multer','connect-timeout','express','Router'];(function(_0x393dec,_0x272f05){var _0xfe02aa=function(_0x5ad20a){while(--_0x5ad20a){_0x393dec['push'](_0x393dec['shift']());}};_0xfe02aa(++_0x272f05);}(_0xc77e,0x188));var _0xec77=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc77e[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xec77('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xec77('0x1'));var express=require(_0xec77('0x2'));var router=express[_0xec77('0x3')]();var auth=require(_0xec77('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0xec77('0x5')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 20a7d83..ae67a19 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 _0x8e23=['INTEGER','sequelize','STRING','BOOLEAN','username'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0x8e23,0x1b9));var _0x38e2=function(_0x584e66,_0x447a76){_0x584e66=_0x584e66-0x0;var _0x25e823=_0x8e23[_0x584e66];return _0x25e823;};'use strict';var Sequelize=require(_0x38e2('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x38e2('0x1')]},'authentication':{'type':Sequelize[_0x38e2('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x38e2('0x1')],'unique':_0x38e2('0x3')},'password':{'type':Sequelize[_0x38e2('0x1')]},'port':{'type':Sequelize[_0x38e2('0x4')]},'tls':{'type':Sequelize[_0x38e2('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5b48=['BOOLEAN','INBOX','sequelize','exports','STRING','username','INTEGER'];(function(_0xf65242,_0x362d8b){var _0x28c741=function(_0x345059){while(--_0x345059){_0xf65242['push'](_0xf65242['shift']());}};_0x28c741(++_0x362d8b);}(_0x5b48,0x1ec));var _0x85b4=function(_0x10dc5d,_0x4b62cc){_0x10dc5d=_0x10dc5d-0x0;var _0x2c1e6f=_0x5b48[_0x10dc5d];return _0x2c1e6f;};'use strict';var Sequelize=require(_0x85b4('0x0'));module[_0x85b4('0x1')]={'description':{'type':Sequelize[_0x85b4('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x85b4('0x2')],'unique':_0x85b4('0x3')},'password':{'type':Sequelize[_0x85b4('0x2')]},'port':{'type':Sequelize[_0x85b4('0x4')]},'tls':{'type':Sequelize[_0x85b4('0x5')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x85b4('0x2')],'defaultValue':_0x85b4('0x6')},'connTimeout':{'type':Sequelize[_0x85b4('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x85b4('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 2fa6cd7..a9ab00d 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 _0xde9f=['lodash','api','moment','request-promise','path','../../config/environment','./mailServerIn.attributes','exports','MailServerIn','mail_servers_in'];(function(_0x49beea,_0x47add1){var _0x27693a=function(_0x192ed8){while(--_0x192ed8){_0x49beea['push'](_0x49beea['shift']());}};_0x27693a(++_0x47add1);}(_0xde9f,0x118));var _0xfde9=function(_0x45ee03,_0x2f5319){_0x45ee03=_0x45ee03-0x0;var _0x13d535=_0xde9f[_0x45ee03];return _0x13d535;};'use strict';var _=require(_0xfde9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xfde9('0x1'));var moment=require(_0xfde9('0x2'));var BPromise=require('bluebird');var rp=require(_0xfde9('0x3'));var fs=require('fs');var path=require(_0xfde9('0x4'));var rimraf=require('rimraf');var config=require(_0xfde9('0x5'));var attributes=require(_0xfde9('0x6'));module[_0xfde9('0x7')]=function(_0xe30eaf,_0x5e69c0){return _0xe30eaf['define'](_0xfde9('0x8'),attributes,{'tableName':_0xfde9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa30a=['path','rimraf','../../config/environment','./mailServerIn.attributes','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xaa30('0x0'));var util=require(_0xaa30('0x1'));var logger=require(_0xaa30('0x2'))('api');var moment=require(_0xaa30('0x3'));var BPromise=require(_0xaa30('0x4'));var rp=require(_0xaa30('0x5'));var fs=require('fs');var path=require(_0xaa30('0x6'));var rimraf=require(_0xaa30('0x7'));var config=require(_0xaa30('0x8'));var attributes=require(_0xaa30('0x9'));module['exports']=function(_0x347cd5,_0x4efe89){return _0x347cd5[_0xaa30('0xa')](_0xaa30('0xb'),attributes,{'tableName':_0xaa30('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 5980382..a2db6c0 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 _0x15b2=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','MailServerIn,\x20%s,\x20%s','message','catch','GetMailServerIn','MailServerIn','findAll','options','raw','attributes','limit','include','map','model','stringify'];(function(_0x5e47be,_0x5e803a){var _0x58aa0f=function(_0x3c4af7){while(--_0x3c4af7){_0x5e47be['push'](_0x5e47be['shift']());}};_0x58aa0f(++_0x5e803a);}(_0x15b2,0x1e0));var _0x215b=function(_0x259b56,_0x1b18da){_0x259b56=_0x259b56-0x0;var _0x54936e=_0x15b2[_0x259b56];return _0x54936e;};'use strict';var _=require(_0x215b('0x0'));var util=require('util');var moment=require(_0x215b('0x1'));var BPromise=require(_0x215b('0x2'));var rs=require(_0x215b('0x3'));var fs=require('fs');var Redis=require(_0x215b('0x4'));var db=require(_0x215b('0x5'))['db'];var utils=require(_0x215b('0x6'));var logger=require(_0x215b('0x7'))(_0x215b('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x215b('0x9')][_0x215b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f05e7,_0x5ceca3,_0x5eb920){return new BPromise(function(_0x56710c,_0x958d37){return client[_0x215b('0xb')](_0x4f05e7,_0x5eb920)[_0x215b('0xc')](function(_0x11a348){logger[_0x215b('0xd')]('MailServerIn,\x20%s,\x20%s',_0x5ceca3,_0x215b('0xe'));logger[_0x215b('0xf')](_0x215b('0x10'),_0x5ceca3,_0x215b('0xe'),JSON['stringify'](_0x11a348));if(_0x11a348[_0x215b('0x11')]){if(_0x11a348['error']['code']===0x1f4){logger[_0x215b('0x11')](_0x215b('0x12'),_0x5ceca3,_0x11a348['error']['message']);return _0x958d37(_0x11a348[_0x215b('0x11')]['message']);}logger[_0x215b('0x11')](_0x215b('0x12'),_0x5ceca3,_0x11a348[_0x215b('0x11')]['message']);return _0x56710c(_0x11a348[_0x215b('0x11')][_0x215b('0x13')]);}else{logger[_0x215b('0xd')]('MailServerIn,\x20%s,\x20%s',_0x5ceca3,'request\x20sent');_0x56710c(_0x11a348['result'][_0x215b('0x13')]);}})[_0x215b('0x14')](function(_0x47b3cd){logger[_0x215b('0x11')](_0x215b('0x12'),_0x5ceca3,_0x47b3cd);_0x958d37(_0x47b3cd);});});}exports[_0x215b('0x15')]=function(_0x21feb5){var _0x1b0df4=this;return new Promise(function(_0x595223,_0x3baf3f){return db[_0x215b('0x16')][_0x215b('0x17')]({'raw':_0x21feb5[_0x215b('0x18')]?_0x21feb5[_0x215b('0x18')][_0x215b('0x19')]===undefined?!![]:![]:!![],'where':_0x21feb5[_0x215b('0x18')]?_0x21feb5[_0x215b('0x18')]['where']||null:null,'attributes':_0x21feb5[_0x215b('0x18')]?_0x21feb5[_0x215b('0x18')][_0x215b('0x1a')]||null:null,'limit':_0x21feb5[_0x215b('0x18')]?_0x21feb5[_0x215b('0x18')][_0x215b('0x1b')]||null:null,'include':_0x21feb5[_0x215b('0x18')]?_0x21feb5[_0x215b('0x18')][_0x215b('0x1c')]?_[_0x215b('0x1d')](_0x21feb5[_0x215b('0x18')][_0x215b('0x1c')],function(_0x2a3f8b){return{'model':db[_0x2a3f8b[_0x215b('0x1e')]],'as':_0x2a3f8b['as'],'attributes':_0x2a3f8b[_0x215b('0x1a')],'include':_0x2a3f8b['include']?_[_0x215b('0x1d')](_0x2a3f8b[_0x215b('0x1c')],function(_0x22ba45){return{'model':db[_0x22ba45[_0x215b('0x1e')]],'as':_0x22ba45['as'],'attributes':_0x22ba45[_0x215b('0x1a')],'include':_0x22ba45[_0x215b('0x1c')]?_[_0x215b('0x1d')](_0x22ba45[_0x215b('0x1c')],function(_0x41313d){return{'model':db[_0x41313d[_0x215b('0x1e')]],'as':_0x41313d['as'],'attributes':_0x41313d[_0x215b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x215b('0xc')](function(_0x553c2b){logger[_0x215b('0xd')]('GetMailServerIn',_0x21feb5);logger[_0x215b('0xf')](_0x215b('0x15'),_0x21feb5,JSON[_0x215b('0x1f')](_0x553c2b));_0x595223(_0x553c2b);})[_0x215b('0x14')](function(_0x3525df){logger[_0x215b('0x11')](_0x215b('0x15'),_0x3525df['message'],_0x21feb5);_0x3baf3f(_0x1b0df4[_0x215b('0x11')](0x1f4,_0x3525df['message']));});});}; \ No newline at end of file +var _0x6dc3=['MailServerIn','options','where','attributes','limit','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetMailServerIn'];(function(_0x5b6165,_0x21fb6a){var _0x40053c=function(_0x492be2){while(--_0x492be2){_0x5b6165['push'](_0x5b6165['shift']());}};_0x40053c(++_0x21fb6a);}(_0x6dc3,0x1d9));var _0x36dc=function(_0x28cc23,_0x17fb4e){_0x28cc23=_0x28cc23-0x0;var _0x3897e4=_0x6dc3[_0x28cc23];return _0x3897e4;};'use strict';var _=require(_0x36dc('0x0'));var util=require(_0x36dc('0x1'));var moment=require(_0x36dc('0x2'));var BPromise=require(_0x36dc('0x3'));var rs=require(_0x36dc('0x4'));var fs=require('fs');var Redis=require(_0x36dc('0x5'));var db=require(_0x36dc('0x6'))['db'];var utils=require(_0x36dc('0x7'));var logger=require('../../config/logger')(_0x36dc('0x8'));var config=require('../../config/environment');var jayson=require(_0x36dc('0x9'));var client=jayson[_0x36dc('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c0f96,_0xd79a8d,_0x29c1b7){return new BPromise(function(_0x41a67b,_0x493c21){return client['request'](_0x4c0f96,_0x29c1b7)['then'](function(_0x25b66a){logger['info'](_0x36dc('0xb'),_0xd79a8d,'request\x20sent');logger[_0x36dc('0xc')](_0x36dc('0xd'),_0xd79a8d,_0x36dc('0xe'),JSON[_0x36dc('0xf')](_0x25b66a));if(_0x25b66a[_0x36dc('0x10')]){if(_0x25b66a['error'][_0x36dc('0x11')]===0x1f4){logger[_0x36dc('0x10')](_0x36dc('0xb'),_0xd79a8d,_0x25b66a[_0x36dc('0x10')][_0x36dc('0x12')]);return _0x493c21(_0x25b66a[_0x36dc('0x10')][_0x36dc('0x12')]);}logger[_0x36dc('0x10')](_0x36dc('0xb'),_0xd79a8d,_0x25b66a[_0x36dc('0x10')][_0x36dc('0x12')]);return _0x41a67b(_0x25b66a['error'][_0x36dc('0x12')]);}else{logger[_0x36dc('0x13')](_0x36dc('0xb'),_0xd79a8d,'request\x20sent');_0x41a67b(_0x25b66a[_0x36dc('0x14')][_0x36dc('0x12')]);}})[_0x36dc('0x15')](function(_0x4764ae){logger[_0x36dc('0x10')]('MailServerIn,\x20%s,\x20%s',_0xd79a8d,_0x4764ae);_0x493c21(_0x4764ae);});});}exports[_0x36dc('0x16')]=function(_0x32da21){var _0x498f44=this;return new Promise(function(_0x3a5140,_0x3fb5a7){return db[_0x36dc('0x17')]['findAll']({'raw':_0x32da21[_0x36dc('0x18')]?_0x32da21[_0x36dc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x32da21['options']?_0x32da21[_0x36dc('0x18')][_0x36dc('0x19')]||null:null,'attributes':_0x32da21[_0x36dc('0x18')]?_0x32da21['options'][_0x36dc('0x1a')]||null:null,'limit':_0x32da21[_0x36dc('0x18')]?_0x32da21[_0x36dc('0x18')][_0x36dc('0x1b')]||null:null,'include':_0x32da21[_0x36dc('0x18')]?_0x32da21['options'][_0x36dc('0x1c')]?_[_0x36dc('0x1d')](_0x32da21[_0x36dc('0x18')][_0x36dc('0x1c')],function(_0x1de4bf){return{'model':db[_0x1de4bf[_0x36dc('0x1e')]],'as':_0x1de4bf['as'],'attributes':_0x1de4bf['attributes'],'include':_0x1de4bf['include']?_[_0x36dc('0x1d')](_0x1de4bf[_0x36dc('0x1c')],function(_0x1f8831){return{'model':db[_0x1f8831[_0x36dc('0x1e')]],'as':_0x1f8831['as'],'attributes':_0x1f8831[_0x36dc('0x1a')],'include':_0x1f8831[_0x36dc('0x1c')]?_[_0x36dc('0x1d')](_0x1f8831['include'],function(_0x1d94ec){return{'model':db[_0x1d94ec[_0x36dc('0x1e')]],'as':_0x1d94ec['as'],'attributes':_0x1d94ec[_0x36dc('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x414501){logger['info'](_0x36dc('0x16'),_0x32da21);logger[_0x36dc('0xc')](_0x36dc('0x16'),_0x32da21,JSON[_0x36dc('0xf')](_0x414501));_0x3a5140(_0x414501);})['catch'](function(_0x3a2bbe){logger[_0x36dc('0x10')](_0x36dc('0x16'),_0x3a2bbe[_0x36dc('0x12')],_0x32da21);_0x3fb5a7(_0x498f44['error'](0x1f4,_0x3a2bbe[_0x36dc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 36b53f8..bb9d916 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 _0x6ae6=['put','update','delete','destroy','exports','util','connect-timeout','express','../../components/auth/service','../../config/environment','./mailServerOut.controller','index','get','/:id','isAuthenticated','show','post','create'];(function(_0x1022f2,_0x2d0b56){var _0x2d6585=function(_0x4feb46){while(--_0x4feb46){_0x1022f2['push'](_0x1022f2['shift']());}};_0x2d6585(++_0x2d0b56);}(_0x6ae6,0x1b5));var _0x66ae=function(_0x4bf96c,_0x4d24fd){_0x4bf96c=_0x4bf96c-0x0;var _0x281d09=_0x6ae6[_0x4bf96c];return _0x281d09;};'use strict';var multer=require('multer');var util=require(_0x66ae('0x0'));var path=require('path');var timeout=require(_0x66ae('0x1'));var express=require(_0x66ae('0x2'));var router=express['Router']();var auth=require(_0x66ae('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x66ae('0x4'));var controller=require(_0x66ae('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x66ae('0x6')]);router[_0x66ae('0x7')](_0x66ae('0x8'),auth[_0x66ae('0x9')](),controller[_0x66ae('0xa')]);router[_0x66ae('0xb')]('/',auth[_0x66ae('0x9')](),controller[_0x66ae('0xc')]);router[_0x66ae('0xd')](_0x66ae('0x8'),auth[_0x66ae('0x9')](),controller[_0x66ae('0xe')]);router[_0x66ae('0xf')](_0x66ae('0x8'),auth[_0x66ae('0x9')](),controller[_0x66ae('0x10')]);module[_0x66ae('0x11')]=router; \ No newline at end of file +var _0xc800=['show','post','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc800,0x79));var _0x0c80=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0xc800[_0x474bc0];return _0x4b24cf;};'use strict';var multer=require(_0x0c80('0x0'));var util=require(_0x0c80('0x1'));var path=require(_0x0c80('0x2'));var timeout=require(_0x0c80('0x3'));var express=require(_0x0c80('0x4'));var router=express[_0x0c80('0x5')]();var auth=require(_0x0c80('0x6'));var interaction=require(_0x0c80('0x7'));var config=require(_0x0c80('0x8'));var controller=require('./mailServerOut.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x0c80('0x9')]);router[_0x0c80('0xa')]('/:id',auth[_0x0c80('0xb')](),controller[_0x0c80('0xc')]);router[_0x0c80('0xd')]('/',auth[_0x0c80('0xb')](),controller[_0x0c80('0xe')]);router['put'](_0x0c80('0xf'),auth[_0x0c80('0xb')](),controller['update']);router[_0x0c80('0x10')](_0x0c80('0xf'),auth[_0x0c80('0xb')](),controller[_0x0c80('0x11')]);module[_0x0c80('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 0ce7f05..4765888 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 _0xa498=['INTEGER','BOOLEAN','exports','STRING'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xa498,0x1d6));var _0x8a49=function(_0x1e6b59,_0x5eca5d){_0x1e6b59=_0x1e6b59-0x0;var _0x40d7c5=_0xa498[_0x1e6b59];return _0x40d7c5;};'use strict';var Sequelize=require('sequelize');module[_0x8a49('0x0')]={'description':{'type':Sequelize[_0x8a49('0x1')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x8a49('0x1')]},'port':{'type':Sequelize[_0x8a49('0x2')]},'secure':{'type':Sequelize[_0x8a49('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x8a49('0x1')]},'authentication':{'type':Sequelize[_0x8a49('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xd47f=['BOOLEAN','sequelize','STRING','INTEGER'];(function(_0x559da0,_0x371559){var _0x284239=function(_0xee9b8c){while(--_0xee9b8c){_0x559da0['push'](_0x559da0['shift']());}};_0x284239(++_0x371559);}(_0xd47f,0x1bd));var _0xfd47=function(_0x2bbf4e,_0x21ddbc){_0x2bbf4e=_0x2bbf4e-0x0;var _0x39d499=_0xd47f[_0x2bbf4e];return _0x39d499;};'use strict';var Sequelize=require(_0xfd47('0x0'));module['exports']={'description':{'type':Sequelize[_0xfd47('0x1')]},'host':{'type':Sequelize[_0xfd47('0x1')]},'user':{'type':Sequelize[_0xfd47('0x1')]},'pass':{'type':Sequelize[_0xfd47('0x1')]},'port':{'type':Sequelize[_0xfd47('0x2')]},'secure':{'type':Sequelize[_0xfd47('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xfd47('0x1')]},'authentication':{'type':Sequelize[_0xfd47('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 ff3e413..54df1ac 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 _0xa287=['sort','where','filter','merge','VIRTUAL','MailServerOut','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','html-pdf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','count','offset','limit','set','json','reject','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','type','keys','filters','intersection','model','attributes','fields','query','length','hasOwnProperty','nolimit'];(function(_0x5b6e7c,_0x1d5684){var _0x10cc1d=function(_0x22a763){while(--_0x22a763){_0x5b6e7c['push'](_0x5b6e7c['shift']());}};_0x10cc1d(++_0x1d5684);}(_0xa287,0xe0));var _0x7a28=function(_0xb68695,_0x1881a4){_0xb68695=_0xb68695-0x0;var _0x15a817=_0xa287[_0xb68695];return _0x15a817;};'use strict';var pdf=require(_0x7a28('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7a28('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7a28('0x2'));var moment=require(_0x7a28('0x3'));var BPromise=require(_0x7a28('0x4'));var Mustache=require(_0x7a28('0x5'));var util=require(_0x7a28('0x6'));var path=require(_0x7a28('0x7'));var sox=require(_0x7a28('0x8'));var csv=require(_0x7a28('0x9'));var ejs=require(_0x7a28('0xa'));var fs=require('fs');var _=require(_0x7a28('0xb'));var squel=require(_0x7a28('0xc'));var crypto=require(_0x7a28('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7a28('0xe'));var toCsv=require(_0x7a28('0x9'));var querystring=require(_0x7a28('0xf'));var Papa=require(_0x7a28('0x10'));var Redis=require('ioredis');var authService=require(_0x7a28('0x11'));var qs=require(_0x7a28('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7a28('0x13'));var logger=require(_0x7a28('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x7a28('0x15'));var db=require(_0x7a28('0x16'))['db'];function respondWithStatusCode(_0x57e161,_0x10ff5e){_0x10ff5e=_0x10ff5e||0xcc;return function(_0xf934c1){if(_0xf934c1){return _0x57e161['sendStatus'](_0x10ff5e);}return _0x57e161[_0x7a28('0x17')](_0x10ff5e)['end']();};}function respondWithResult(_0x27072e,_0x3e4b8f){_0x3e4b8f=_0x3e4b8f||0xc8;return function(_0x1a7e14){if(_0x1a7e14){return _0x27072e[_0x7a28('0x17')](_0x3e4b8f)['json'](_0x1a7e14);}};}function respondWithFilteredResult(_0x46ce87,_0x1db255){return function(_0x28c3e8){if(_0x28c3e8){var _0x5b902e=_0x28c3e8[_0x7a28('0x18')],_0x4fccd8=_0x1db255[_0x7a28('0x19')],_0x245040=_0x1db255[_0x7a28('0x19')]+_0x1db255[_0x7a28('0x1a')],_0x459b4e;if(_0x245040>=_0x5b902e){_0x245040=_0x5b902e;_0x459b4e=0xc8;}else{_0x459b4e=0xce;}_0x46ce87[_0x7a28('0x17')](_0x459b4e);return _0x46ce87[_0x7a28('0x1b')]('Content-Range',_0x4fccd8+'-'+_0x245040+'/'+_0x5b902e)[_0x7a28('0x1c')](_0x28c3e8);}return null;};}function patchUpdates(_0x16b6d5){return function(_0x2d9820){try{jsonpatch['apply'](_0x2d9820,_0x16b6d5,!![]);}catch(_0x27e2b4){return BPromise[_0x7a28('0x1d')](_0x27e2b4);}return _0x2d9820['save']();};}function saveUpdates(_0x5667ba,_0x5d7d82){return function(_0x4fcb8b){if(_0x4fcb8b){return _0x4fcb8b[_0x7a28('0x1e')](_0x5667ba)[_0x7a28('0x1f')](function(_0x5da710){return _0x5da710;});}return null;};}function removeEntity(_0x5ed6ce,_0x50290e){return function(_0x2e6006){if(_0x2e6006){return _0x2e6006[_0x7a28('0x20')]()[_0x7a28('0x1f')](function(){_0x5ed6ce[_0x7a28('0x17')](0xcc)[_0x7a28('0x21')]();});}};}function handleEntityNotFound(_0x4e72d9,_0x53e473){return function(_0x390288){if(!_0x390288){_0x4e72d9['sendStatus'](0x194);}return _0x390288;};}function handleError(_0x405342,_0x1fe67d){_0x1fe67d=_0x1fe67d||0x1f4;return function(_0x36e27d){logger[_0x7a28('0x22')](_0x36e27d[_0x7a28('0x23')]);if(_0x36e27d['name']){delete _0x36e27d[_0x7a28('0x24')];}_0x405342[_0x7a28('0x17')](_0x1fe67d)[_0x7a28('0x25')](_0x36e27d);};}exports[_0x7a28('0x26')]=function(_0x2cb329,_0x6e73b3){var _0x1c8d02={},_0x311e79={},_0x4826a9={'count':0x0,'rows':[]};var _0x10e05f=_[_0x7a28('0x27')](db['MailServerOut'][_0x7a28('0x28')],function(_0x493615){return{'name':_0x493615['fieldName'],'type':_0x493615[_0x7a28('0x29')]['key']};});_0x311e79['model']=_['map'](_0x10e05f,_0x7a28('0x24'));_0x311e79['query']=_[_0x7a28('0x2a')](_0x2cb329['query']);_0x311e79[_0x7a28('0x2b')]=_[_0x7a28('0x2c')](_0x311e79[_0x7a28('0x2d')],_0x311e79['query']);_0x1c8d02[_0x7a28('0x2e')]=_[_0x7a28('0x2c')](_0x311e79['model'],qs[_0x7a28('0x2f')](_0x2cb329[_0x7a28('0x30')][_0x7a28('0x2f')]));_0x1c8d02[_0x7a28('0x2e')]=_0x1c8d02[_0x7a28('0x2e')][_0x7a28('0x31')]?_0x1c8d02[_0x7a28('0x2e')]:_0x311e79[_0x7a28('0x2d')];if(!_0x2cb329[_0x7a28('0x30')][_0x7a28('0x32')](_0x7a28('0x33'))){_0x1c8d02['limit']=qs[_0x7a28('0x1a')](_0x2cb329[_0x7a28('0x30')]['limit']);_0x1c8d02[_0x7a28('0x19')]=qs[_0x7a28('0x19')](_0x2cb329['query'][_0x7a28('0x19')]);}_0x1c8d02['order']=qs['sort'](_0x2cb329[_0x7a28('0x30')][_0x7a28('0x34')]);_0x1c8d02[_0x7a28('0x35')]=qs['filters'](_['pick'](_0x2cb329[_0x7a28('0x30')],_0x311e79[_0x7a28('0x2b')]),_0x10e05f);if(_0x2cb329[_0x7a28('0x30')][_0x7a28('0x36')]){_0x1c8d02['where']=_[_0x7a28('0x37')](_0x1c8d02['where'],{'$or':_[_0x7a28('0x27')](_0x10e05f,function(_0x10e729){if(_0x10e729[_0x7a28('0x29')]!==_0x7a28('0x38')){var _0x1ca8d4={};_0x1ca8d4[_0x10e729[_0x7a28('0x24')]]={'$like':'%'+_0x2cb329[_0x7a28('0x30')][_0x7a28('0x36')]+'%'};return _0x1ca8d4;}})});}_0x1c8d02=_[_0x7a28('0x37')]({},_0x1c8d02,_0x2cb329['options']);var _0x4eb085={'where':_0x1c8d02[_0x7a28('0x35')]};return db[_0x7a28('0x39')]['count'](_0x4eb085)[_0x7a28('0x1f')](function(_0x435ae9){_0x4826a9[_0x7a28('0x18')]=_0x435ae9;if(_0x2cb329[_0x7a28('0x30')][_0x7a28('0x3a')]){_0x1c8d02[_0x7a28('0x3b')]=[{'all':!![]}];}return db[_0x7a28('0x39')][_0x7a28('0x3c')](_0x1c8d02);})[_0x7a28('0x1f')](function(_0x3473b1){_0x4826a9[_0x7a28('0x3d')]=_0x3473b1;return _0x4826a9;})[_0x7a28('0x1f')](respondWithFilteredResult(_0x6e73b3,_0x1c8d02))[_0x7a28('0x3e')](handleError(_0x6e73b3,null));};exports[_0x7a28('0x3f')]=function(_0x66f242,_0x17b960){var _0x39259d={'raw':!![],'where':{'id':_0x66f242[_0x7a28('0x40')]['id']}},_0x3890f8={};_0x3890f8['model']=_[_0x7a28('0x2a')](db[_0x7a28('0x39')][_0x7a28('0x28')]);_0x3890f8[_0x7a28('0x30')]=_[_0x7a28('0x2a')](_0x66f242[_0x7a28('0x30')]);_0x3890f8[_0x7a28('0x2b')]=_['intersection'](_0x3890f8[_0x7a28('0x2d')],_0x3890f8[_0x7a28('0x30')]);_0x39259d[_0x7a28('0x2e')]=_[_0x7a28('0x2c')](_0x3890f8['model'],qs[_0x7a28('0x2f')](_0x66f242[_0x7a28('0x30')][_0x7a28('0x2f')]));_0x39259d[_0x7a28('0x2e')]=_0x39259d[_0x7a28('0x2e')][_0x7a28('0x31')]?_0x39259d[_0x7a28('0x2e')]:_0x3890f8[_0x7a28('0x2d')];if(_0x66f242[_0x7a28('0x30')][_0x7a28('0x3a')]){_0x39259d[_0x7a28('0x3b')]=[{'all':!![]}];}_0x39259d=_[_0x7a28('0x37')]({},_0x39259d,_0x66f242[_0x7a28('0x41')]);return db[_0x7a28('0x39')][_0x7a28('0x42')](_0x39259d)['then'](handleEntityNotFound(_0x17b960,null))[_0x7a28('0x1f')](respondWithResult(_0x17b960,null))[_0x7a28('0x3e')](handleError(_0x17b960,null));};exports[_0x7a28('0x43')]=function(_0x14420f,_0x2932bb){return db[_0x7a28('0x39')]['create'](_0x14420f['body'],{})[_0x7a28('0x1f')](respondWithResult(_0x2932bb,0xc9))[_0x7a28('0x3e')](handleError(_0x2932bb,null));};exports[_0x7a28('0x1e')]=function(_0x59f8f0,_0x370fae){if(_0x59f8f0[_0x7a28('0x44')]['id']){delete _0x59f8f0[_0x7a28('0x44')]['id'];}return db[_0x7a28('0x39')][_0x7a28('0x42')]({'where':{'id':_0x59f8f0[_0x7a28('0x40')]['id']}})['then'](handleEntityNotFound(_0x370fae,null))['then'](saveUpdates(_0x59f8f0[_0x7a28('0x44')],null))[_0x7a28('0x1f')](respondWithResult(_0x370fae,null))[_0x7a28('0x3e')](handleError(_0x370fae,null));};exports[_0x7a28('0x20')]=function(_0x17b627,_0x1a7439){return db[_0x7a28('0x39')][_0x7a28('0x42')]({'where':{'id':_0x17b627[_0x7a28('0x40')]['id']}})[_0x7a28('0x1f')](handleEntityNotFound(_0x1a7439,null))[_0x7a28('0x1f')](removeEntity(_0x1a7439,null))[_0x7a28('0x3e')](handleError(_0x1a7439,null));}; \ No newline at end of file +var _0x3fa0=['save','update','then','destroy','sendStatus','stack','name','send','index','map','MailServerOut','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filters','merge','filter','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','offset','limit','set','Content-Range','apply','reject'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0x3fa0,0x100));var _0x03fa=function(_0x3c9a0e,_0x14d00d){_0x3c9a0e=_0x3c9a0e-0x0;var _0x57b8b4=_0x3fa0[_0x3c9a0e];return _0x57b8b4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x03fa('0x0'));var rimraf=require(_0x03fa('0x1'));var zipdir=require(_0x03fa('0x2'));var jsonpatch=require(_0x03fa('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x03fa('0x4'));var path=require(_0x03fa('0x5'));var sox=require(_0x03fa('0x6'));var csv=require('to-csv');var ejs=require(_0x03fa('0x7'));var fs=require('fs');var _=require(_0x03fa('0x8'));var squel=require(_0x03fa('0x9'));var crypto=require(_0x03fa('0xa'));var jsforce=require(_0x03fa('0xb'));var deskjs=require(_0x03fa('0xc'));var toCsv=require(_0x03fa('0xd'));var querystring=require(_0x03fa('0xe'));var Papa=require('papaparse');var Redis=require(_0x03fa('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x03fa('0x10'));var hardwareService=require(_0x03fa('0x11'));var logger=require(_0x03fa('0x12'))(_0x03fa('0x13'));var utils=require(_0x03fa('0x14'));var config=require(_0x03fa('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x750328,_0x18c0ef){_0x18c0ef=_0x18c0ef||0xcc;return function(_0x20e759){if(_0x20e759){return _0x750328['sendStatus'](_0x18c0ef);}return _0x750328[_0x03fa('0x16')](_0x18c0ef)[_0x03fa('0x17')]();};}function respondWithResult(_0x40ef8e,_0x5bc4e1){_0x5bc4e1=_0x5bc4e1||0xc8;return function(_0x35d754){if(_0x35d754){return _0x40ef8e['status'](_0x5bc4e1)[_0x03fa('0x18')](_0x35d754);}};}function respondWithFilteredResult(_0x191a7c,_0x303787){return function(_0x8de5f1){if(_0x8de5f1){var _0x161dd3=_0x8de5f1[_0x03fa('0x19')],_0x2b2dcd=_0x303787['offset'],_0x39b90=_0x303787[_0x03fa('0x1a')]+_0x303787[_0x03fa('0x1b')],_0x1c4da7;if(_0x39b90>=_0x161dd3){_0x39b90=_0x161dd3;_0x1c4da7=0xc8;}else{_0x1c4da7=0xce;}_0x191a7c[_0x03fa('0x16')](_0x1c4da7);return _0x191a7c[_0x03fa('0x1c')](_0x03fa('0x1d'),_0x2b2dcd+'-'+_0x39b90+'/'+_0x161dd3)[_0x03fa('0x18')](_0x8de5f1);}return null;};}function patchUpdates(_0x597ad9){return function(_0x155bd6){try{jsonpatch[_0x03fa('0x1e')](_0x155bd6,_0x597ad9,!![]);}catch(_0x47d892){return BPromise[_0x03fa('0x1f')](_0x47d892);}return _0x155bd6[_0x03fa('0x20')]();};}function saveUpdates(_0x5abab7,_0x5a03a3){return function(_0x57b4b3){if(_0x57b4b3){return _0x57b4b3[_0x03fa('0x21')](_0x5abab7)[_0x03fa('0x22')](function(_0x312fa1){return _0x312fa1;});}return null;};}function removeEntity(_0x395949,_0x5feb68){return function(_0x232b02){if(_0x232b02){return _0x232b02[_0x03fa('0x23')]()['then'](function(){_0x395949[_0x03fa('0x16')](0xcc)[_0x03fa('0x17')]();});}};}function handleEntityNotFound(_0x428982,_0x25ffe6){return function(_0x35a97b){if(!_0x35a97b){_0x428982[_0x03fa('0x24')](0x194);}return _0x35a97b;};}function handleError(_0x500dc7,_0xd9f452){_0xd9f452=_0xd9f452||0x1f4;return function(_0x12193f){logger['error'](_0x12193f[_0x03fa('0x25')]);if(_0x12193f[_0x03fa('0x26')]){delete _0x12193f[_0x03fa('0x26')];}_0x500dc7[_0x03fa('0x16')](_0xd9f452)[_0x03fa('0x27')](_0x12193f);};}exports[_0x03fa('0x28')]=function(_0x1ba132,_0x262ee3){var _0x3902a2={},_0x2dcec2={},_0x57a528={'count':0x0,'rows':[]};var _0x5b7a58=_[_0x03fa('0x29')](db[_0x03fa('0x2a')][_0x03fa('0x2b')],function(_0x4930e6){return{'name':_0x4930e6['fieldName'],'type':_0x4930e6[_0x03fa('0x2c')][_0x03fa('0x2d')]};});_0x2dcec2[_0x03fa('0x2e')]=_['map'](_0x5b7a58,'name');_0x2dcec2['query']=_[_0x03fa('0x2f')](_0x1ba132[_0x03fa('0x30')]);_0x2dcec2['filters']=_[_0x03fa('0x31')](_0x2dcec2[_0x03fa('0x2e')],_0x2dcec2[_0x03fa('0x30')]);_0x3902a2[_0x03fa('0x32')]=_[_0x03fa('0x31')](_0x2dcec2[_0x03fa('0x2e')],qs['fields'](_0x1ba132['query'][_0x03fa('0x33')]));_0x3902a2[_0x03fa('0x32')]=_0x3902a2['attributes'][_0x03fa('0x34')]?_0x3902a2[_0x03fa('0x32')]:_0x2dcec2[_0x03fa('0x2e')];if(!_0x1ba132[_0x03fa('0x30')]['hasOwnProperty'](_0x03fa('0x35'))){_0x3902a2[_0x03fa('0x1b')]=qs[_0x03fa('0x1b')](_0x1ba132[_0x03fa('0x30')][_0x03fa('0x1b')]);_0x3902a2['offset']=qs['offset'](_0x1ba132['query'][_0x03fa('0x1a')]);}_0x3902a2[_0x03fa('0x36')]=qs[_0x03fa('0x37')](_0x1ba132[_0x03fa('0x30')][_0x03fa('0x37')]);_0x3902a2[_0x03fa('0x38')]=qs['filters'](_[_0x03fa('0x39')](_0x1ba132[_0x03fa('0x30')],_0x2dcec2[_0x03fa('0x3a')]),_0x5b7a58);if(_0x1ba132[_0x03fa('0x30')]['filter']){_0x3902a2[_0x03fa('0x38')]=_[_0x03fa('0x3b')](_0x3902a2[_0x03fa('0x38')],{'$or':_[_0x03fa('0x29')](_0x5b7a58,function(_0x259000){if(_0x259000[_0x03fa('0x2c')]!=='VIRTUAL'){var _0x22fe96={};_0x22fe96[_0x259000[_0x03fa('0x26')]]={'$like':'%'+_0x1ba132[_0x03fa('0x30')][_0x03fa('0x3c')]+'%'};return _0x22fe96;}})});}_0x3902a2=_[_0x03fa('0x3b')]({},_0x3902a2,_0x1ba132[_0x03fa('0x3d')]);var _0xafa788={'where':_0x3902a2['where']};return db[_0x03fa('0x2a')][_0x03fa('0x19')](_0xafa788)[_0x03fa('0x22')](function(_0x123617){_0x57a528[_0x03fa('0x19')]=_0x123617;if(_0x1ba132['query'][_0x03fa('0x3e')]){_0x3902a2['include']=[{'all':!![]}];}return db['MailServerOut'][_0x03fa('0x3f')](_0x3902a2);})[_0x03fa('0x22')](function(_0x44b061){_0x57a528[_0x03fa('0x40')]=_0x44b061;return _0x57a528;})['then'](respondWithFilteredResult(_0x262ee3,_0x3902a2))[_0x03fa('0x41')](handleError(_0x262ee3,null));};exports[_0x03fa('0x42')]=function(_0x53efd9,_0x4de136){var _0x1d138b={'raw':!![],'where':{'id':_0x53efd9[_0x03fa('0x43')]['id']}},_0xc5e9a4={};_0xc5e9a4[_0x03fa('0x2e')]=_[_0x03fa('0x2f')](db[_0x03fa('0x2a')][_0x03fa('0x2b')]);_0xc5e9a4[_0x03fa('0x30')]=_[_0x03fa('0x2f')](_0x53efd9[_0x03fa('0x30')]);_0xc5e9a4['filters']=_[_0x03fa('0x31')](_0xc5e9a4['model'],_0xc5e9a4[_0x03fa('0x30')]);_0x1d138b['attributes']=_[_0x03fa('0x31')](_0xc5e9a4[_0x03fa('0x2e')],qs[_0x03fa('0x33')](_0x53efd9[_0x03fa('0x30')]['fields']));_0x1d138b[_0x03fa('0x32')]=_0x1d138b[_0x03fa('0x32')][_0x03fa('0x34')]?_0x1d138b[_0x03fa('0x32')]:_0xc5e9a4['model'];if(_0x53efd9[_0x03fa('0x30')][_0x03fa('0x3e')]){_0x1d138b[_0x03fa('0x44')]=[{'all':!![]}];}_0x1d138b=_[_0x03fa('0x3b')]({},_0x1d138b,_0x53efd9['options']);return db[_0x03fa('0x2a')][_0x03fa('0x45')](_0x1d138b)[_0x03fa('0x22')](handleEntityNotFound(_0x4de136,null))['then'](respondWithResult(_0x4de136,null))[_0x03fa('0x41')](handleError(_0x4de136,null));};exports['create']=function(_0x28b13a,_0x4e1450){return db[_0x03fa('0x2a')][_0x03fa('0x46')](_0x28b13a[_0x03fa('0x47')],{})[_0x03fa('0x22')](respondWithResult(_0x4e1450,0xc9))['catch'](handleError(_0x4e1450,null));};exports[_0x03fa('0x21')]=function(_0x44ea9e,_0x3fe329){if(_0x44ea9e['body']['id']){delete _0x44ea9e[_0x03fa('0x47')]['id'];}return db[_0x03fa('0x2a')][_0x03fa('0x45')]({'where':{'id':_0x44ea9e[_0x03fa('0x43')]['id']}})[_0x03fa('0x22')](handleEntityNotFound(_0x3fe329,null))[_0x03fa('0x22')](saveUpdates(_0x44ea9e[_0x03fa('0x47')],null))['then'](respondWithResult(_0x3fe329,null))[_0x03fa('0x41')](handleError(_0x3fe329,null));};exports[_0x03fa('0x23')]=function(_0x55a3ac,_0x3f9f1c){return db['MailServerOut'][_0x03fa('0x45')]({'where':{'id':_0x55a3ac['params']['id']}})[_0x03fa('0x22')](handleEntityNotFound(_0x3f9f1c,null))[_0x03fa('0x22')](removeEntity(_0x3f9f1c,null))['catch'](handleError(_0x3f9f1c,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index eed877f..b365b56 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 _0xba34=['rimraf','../../config/environment','./mailServerOut.attributes','exports','define','mail_servers_out','lodash','util','../../config/logger','api','moment'];(function(_0x288bb5,_0x44bcbb){var _0x500d91=function(_0x48d7f4){while(--_0x48d7f4){_0x288bb5['push'](_0x288bb5['shift']());}};_0x500d91(++_0x44bcbb);}(_0xba34,0x119));var _0x4ba3=function(_0x97085,_0x338e6d){_0x97085=_0x97085-0x0;var _0xe371c5=_0xba34[_0x97085];return _0xe371c5;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var logger=require(_0x4ba3('0x2'))(_0x4ba3('0x3'));var moment=require(_0x4ba3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var attributes=require(_0x4ba3('0x7'));module[_0x4ba3('0x8')]=function(_0x3590a1,_0xb88621){return _0x3590a1[_0x4ba3('0x9')]('MailServerOut',attributes,{'tableName':_0x4ba3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53ec=['bluebird','path','../../config/environment','./mailServerOut.attributes','define','MailServerOut','lodash','util','../../config/logger','api','moment'];(function(_0x3897f7,_0x149298){var _0x5b7f33=function(_0x4329a6){while(--_0x4329a6){_0x3897f7['push'](_0x3897f7['shift']());}};_0x5b7f33(++_0x149298);}(_0x53ec,0x192));var _0xc53e=function(_0x2da3fe,_0x55ad2d){_0x2da3fe=_0x2da3fe-0x0;var _0x564b34=_0x53ec[_0x2da3fe];return _0x564b34;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 40a72ee..ddb13cb 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 _0x307e=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x37a7c1,_0x5cd0ee){var _0x4e30e8=function(_0x252c3d){while(--_0x252c3d){_0x37a7c1['push'](_0x37a7c1['shift']());}};_0x4e30e8(++_0x5cd0ee);}(_0x307e,0x1b2));var _0xe307=function(_0x55891b,_0x32569){_0x55891b=_0x55891b-0x0;var _0x28741e=_0x307e[_0x55891b];return _0x28741e;};'use strict';var _=require(_0xe307('0x0'));var util=require(_0xe307('0x1'));var moment=require('moment');var BPromise=require(_0xe307('0x2'));var rs=require(_0xe307('0x3'));var fs=require('fs');var Redis=require(_0xe307('0x4'));var db=require(_0xe307('0x5'))['db'];var utils=require(_0xe307('0x6'));var logger=require(_0xe307('0x7'))('rpc');var config=require(_0xe307('0x8'));var jayson=require(_0xe307('0x9'));var client=jayson[_0xe307('0xa')][_0xe307('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x126968,_0x1949c4,_0x38ef30){return new BPromise(function(_0x29b679,_0x9543e6){return client['request'](_0x126968,_0x38ef30)['then'](function(_0xbacd07){logger[_0xe307('0xc')](_0xe307('0xd'),_0x1949c4,_0xe307('0xe'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0x1949c4,'request\x20sent',JSON[_0xe307('0xf')](_0xbacd07));if(_0xbacd07['error']){if(_0xbacd07[_0xe307('0x10')][_0xe307('0x11')]===0x1f4){logger[_0xe307('0x10')](_0xe307('0xd'),_0x1949c4,_0xbacd07[_0xe307('0x10')][_0xe307('0x12')]);return _0x9543e6(_0xbacd07[_0xe307('0x10')]['message']);}logger[_0xe307('0x10')](_0xe307('0xd'),_0x1949c4,_0xbacd07[_0xe307('0x10')][_0xe307('0x12')]);return _0x29b679(_0xbacd07[_0xe307('0x10')][_0xe307('0x12')]);}else{logger[_0xe307('0xc')](_0xe307('0xd'),_0x1949c4,_0xe307('0xe'));_0x29b679(_0xbacd07['result'][_0xe307('0x12')]);}})[_0xe307('0x13')](function(_0x56e48f){logger[_0xe307('0x10')]('MailServerOut,\x20%s,\x20%s',_0x1949c4,_0x56e48f);_0x9543e6(_0x56e48f);});});} \ No newline at end of file +var _0xa429=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','request','then','info','request\x20sent','MailServerOut,\x20%s,\x20%s,\x20%s','error','code','MailServerOut,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird'];(function(_0x4184b5,_0x547e13){var _0x4e8f15=function(_0x560b43){while(--_0x560b43){_0x4184b5['push'](_0x4184b5['shift']());}};_0x4e8f15(++_0x547e13);}(_0xa429,0x1f0));var _0x9a42=function(_0x1e8aa5,_0x297727){_0x1e8aa5=_0x1e8aa5-0x0;var _0x4aa2c3=_0xa429[_0x1e8aa5];return _0x4aa2c3;};'use strict';var _=require(_0x9a42('0x0'));var util=require(_0x9a42('0x1'));var moment=require(_0x9a42('0x2'));var BPromise=require(_0x9a42('0x3'));var rs=require(_0x9a42('0x4'));var fs=require('fs');var Redis=require(_0x9a42('0x5'));var db=require(_0x9a42('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9a42('0x7'))(_0x9a42('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9a42('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13b06b,_0x4373ec,_0x21bac4){return new BPromise(function(_0x21d49d,_0x15ba7c){return client[_0x9a42('0xa')](_0x13b06b,_0x21bac4)[_0x9a42('0xb')](function(_0x3cd9d8){logger[_0x9a42('0xc')]('MailServerOut,\x20%s,\x20%s',_0x4373ec,_0x9a42('0xd'));logger['debug'](_0x9a42('0xe'),_0x4373ec,_0x9a42('0xd'),JSON['stringify'](_0x3cd9d8));if(_0x3cd9d8[_0x9a42('0xf')]){if(_0x3cd9d8[_0x9a42('0xf')][_0x9a42('0x10')]===0x1f4){logger['error'](_0x9a42('0x11'),_0x4373ec,_0x3cd9d8['error'][_0x9a42('0x12')]);return _0x15ba7c(_0x3cd9d8[_0x9a42('0xf')][_0x9a42('0x12')]);}logger[_0x9a42('0xf')](_0x9a42('0x11'),_0x4373ec,_0x3cd9d8[_0x9a42('0xf')][_0x9a42('0x12')]);return _0x21d49d(_0x3cd9d8[_0x9a42('0xf')]['message']);}else{logger[_0x9a42('0xc')]('MailServerOut,\x20%s,\x20%s',_0x4373ec,_0x9a42('0xd'));_0x21d49d(_0x3cd9d8[_0x9a42('0x13')][_0x9a42('0x12')]);}})['catch'](function(_0x346150){logger[_0x9a42('0xf')]('MailServerOut,\x20%s,\x20%s',_0x4373ec,_0x346150);_0x15ba7c(_0x346150);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 64987e4..7d10247 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 _0x7005=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','create','/:id','update','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x4d23f3,_0x59b5f7){var _0x261d33=function(_0x29bd94){while(--_0x29bd94){_0x4d23f3['push'](_0x4d23f3['shift']());}};_0x261d33(++_0x59b5f7);}(_0x7005,0x1a4));var _0x5700=function(_0xc987f2,_0x74b22e){_0xc987f2=_0xc987f2-0x0;var _0x325bb4=_0x7005[_0xc987f2];return _0x325bb4;};'use strict';var multer=require(_0x5700('0x0'));var util=require('util');var path=require(_0x5700('0x1'));var timeout=require(_0x5700('0x2'));var express=require(_0x5700('0x3'));var router=express[_0x5700('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x5700('0x5'));var config=require(_0x5700('0x6'));var controller=require('./mailSubstatus.controller');router[_0x5700('0x7')]('/',auth[_0x5700('0x8')](),controller[_0x5700('0x9')]);router[_0x5700('0x7')](_0x5700('0xa'),auth[_0x5700('0x8')](),controller['describe']);router[_0x5700('0x7')]('/:id',auth[_0x5700('0x8')](),controller[_0x5700('0xb')]);router['post']('/',auth[_0x5700('0x8')](),controller[_0x5700('0xc')]);router['put'](_0x5700('0xd'),auth[_0x5700('0x8')](),controller[_0x5700('0xe')]);router['delete'](_0x5700('0xd'),auth['isAuthenticated'](),controller[_0x5700('0xf')]);module[_0x5700('0x10')]=router; \ No newline at end of file +var _0x6b98=['/:id','show','post','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','index','get','/describe','isAuthenticated'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6b98,0x13a));var _0x86b9=function(_0x2657fa,_0x15fab8){_0x2657fa=_0x2657fa-0x0;var _0x555b92=_0x6b98[_0x2657fa];return _0x555b92;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x86b9('0x0'));var timeout=require(_0x86b9('0x1'));var express=require(_0x86b9('0x2'));var router=express[_0x86b9('0x3')]();var auth=require(_0x86b9('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailSubstatus.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x86b9('0x5')]);router[_0x86b9('0x6')](_0x86b9('0x7'),auth[_0x86b9('0x8')](),controller['describe']);router['get'](_0x86b9('0x9'),auth[_0x86b9('0x8')](),controller[_0x86b9('0xa')]);router[_0x86b9('0xb')]('/',auth[_0x86b9('0x8')](),controller['create']);router[_0x86b9('0xc')](_0x86b9('0x9'),auth[_0x86b9('0x8')](),controller[_0x86b9('0xd')]);router[_0x86b9('0xe')](_0x86b9('0x9'),auth[_0x86b9('0x8')](),controller[_0x86b9('0xf')]);module[_0x86b9('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index d2979c2..22252d7 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 _0xe953=['sequelize','exports','STRING'];(function(_0x1450df,_0x5e6e59){var _0x37b90b=function(_0x4ad5fa){while(--_0x4ad5fa){_0x1450df['push'](_0x1450df['shift']());}};_0x37b90b(++_0x5e6e59);}(_0xe953,0xf9));var _0x3e95=function(_0x2a5099,_0x329e92){_0x2a5099=_0x2a5099-0x0;var _0x2802f1=_0xe953[_0x2a5099];return _0x2802f1;};'use strict';var Sequelize=require(_0x3e95('0x0'));module[_0x3e95('0x1')]={'name':{'type':Sequelize[_0x3e95('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3e95('0x2')]}}; \ No newline at end of file +var _0x65cb=['STRING','name','sequelize'];(function(_0xf51c06,_0x388e5b){var _0x1d5420=function(_0x5e077b){while(--_0x5e077b){_0xf51c06['push'](_0xf51c06['shift']());}};_0x1d5420(++_0x388e5b);}(_0x65cb,0xa4));var _0xb65c=function(_0x4c78b3,_0x2cd555){_0x4c78b3=_0x4c78b3-0x0;var _0x17b58c=_0x65cb[_0x4c78b3];return _0x17b58c;};'use strict';var Sequelize=require(_0xb65c('0x0'));module['exports']={'name':{'type':Sequelize[_0xb65c('0x1')],'unique':_0xb65c('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb65c('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index f6bac8e..dd29345 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 _0x253f=['json','count','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','limit','offset','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status'];(function(_0xe14412,_0x2f9d9d){var _0x287bcf=function(_0x514ec2){while(--_0x514ec2){_0xe14412['push'](_0xe14412['shift']());}};_0x287bcf(++_0x2f9d9d);}(_0x253f,0x154));var _0xf253=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x253f[_0x122096];return _0x3d1966;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xf253('0x0'));var zipdir=require(_0xf253('0x1'));var jsonpatch=require(_0xf253('0x2'));var rp=require(_0xf253('0x3'));var moment=require(_0xf253('0x4'));var BPromise=require(_0xf253('0x5'));var Mustache=require(_0xf253('0x6'));var util=require(_0xf253('0x7'));var path=require(_0xf253('0x8'));var sox=require(_0xf253('0x9'));var csv=require(_0xf253('0xa'));var ejs=require(_0xf253('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf253('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf253('0xd'));var Redis=require(_0xf253('0xe'));var authService=require(_0xf253('0xf'));var qs=require(_0xf253('0x10'));var as=require(_0xf253('0x11'));var hardwareService=require(_0xf253('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xf253('0x13'));var config=require(_0xf253('0x14'));var db=require(_0xf253('0x15'))['db'];function respondWithStatusCode(_0x50e22c,_0x4b37e6){_0x4b37e6=_0x4b37e6||0xcc;return function(_0x55df3d){if(_0x55df3d){return _0x50e22c[_0xf253('0x16')](_0x4b37e6);}return _0x50e22c['status'](_0x4b37e6)[_0xf253('0x17')]();};}function respondWithResult(_0x5f56eb,_0x4f25ff){_0x4f25ff=_0x4f25ff||0xc8;return function(_0x27d4cb){if(_0x27d4cb){return _0x5f56eb[_0xf253('0x18')](_0x4f25ff)[_0xf253('0x19')](_0x27d4cb);}};}function respondWithFilteredResult(_0x556ea8,_0x1ad066){return function(_0x12a0f3){if(_0x12a0f3){var _0x38ba5e=_0x12a0f3[_0xf253('0x1a')],_0x3f62fb=_0x1ad066['offset'],_0x739447=_0x1ad066['offset']+_0x1ad066['limit'],_0x21910f;if(_0x739447>=_0x38ba5e){_0x739447=_0x38ba5e;_0x21910f=0xc8;}else{_0x21910f=0xce;}_0x556ea8[_0xf253('0x18')](_0x21910f);return _0x556ea8[_0xf253('0x1b')](_0xf253('0x1c'),_0x3f62fb+'-'+_0x739447+'/'+_0x38ba5e)['json'](_0x12a0f3);}return null;};}function patchUpdates(_0x1e996f){return function(_0x4dc9d7){try{jsonpatch[_0xf253('0x1d')](_0x4dc9d7,_0x1e996f,!![]);}catch(_0x38967c){return BPromise['reject'](_0x38967c);}return _0x4dc9d7[_0xf253('0x1e')]();};}function saveUpdates(_0x5470fc,_0xd67d98){return function(_0xefedc1){if(_0xefedc1){return _0xefedc1[_0xf253('0x1f')](_0x5470fc)[_0xf253('0x20')](function(_0x2b84db){return _0x2b84db;});}return null;};}function removeEntity(_0x39eeb1,_0x5eb21a){return function(_0x381519){if(_0x381519){return _0x381519[_0xf253('0x21')]()['then'](function(){_0x39eeb1[_0xf253('0x18')](0xcc)[_0xf253('0x17')]();});}};}function handleEntityNotFound(_0xd7d2bf,_0x549ebc){return function(_0x40b7d8){if(!_0x40b7d8){_0xd7d2bf[_0xf253('0x16')](0x194);}return _0x40b7d8;};}function handleError(_0x3f872e,_0xc680b){_0xc680b=_0xc680b||0x1f4;return function(_0x58546e){logger[_0xf253('0x22')](_0x58546e['stack']);if(_0x58546e['name']){delete _0x58546e[_0xf253('0x23')];}_0x3f872e[_0xf253('0x18')](_0xc680b)[_0xf253('0x24')](_0x58546e);};}exports[_0xf253('0x25')]=function(_0x1a4bb2,_0x59e8b0){var _0x121727={},_0x465223={},_0x17dc8f={'count':0x0,'rows':[]};var _0x187bed=_[_0xf253('0x26')](db[_0xf253('0x27')][_0xf253('0x28')],function(_0x148494){return{'name':_0x148494[_0xf253('0x29')],'type':_0x148494[_0xf253('0x2a')][_0xf253('0x2b')]};});_0x465223[_0xf253('0x2c')]=_[_0xf253('0x26')](_0x187bed,_0xf253('0x23'));_0x465223['query']=_[_0xf253('0x2d')](_0x1a4bb2['query']);_0x465223[_0xf253('0x2e')]=_[_0xf253('0x2f')](_0x465223[_0xf253('0x2c')],_0x465223[_0xf253('0x30')]);_0x121727['attributes']=_[_0xf253('0x2f')](_0x465223[_0xf253('0x2c')],qs[_0xf253('0x31')](_0x1a4bb2['query'][_0xf253('0x31')]));_0x121727[_0xf253('0x32')]=_0x121727[_0xf253('0x32')][_0xf253('0x33')]?_0x121727[_0xf253('0x32')]:_0x465223[_0xf253('0x2c')];if(!_0x1a4bb2[_0xf253('0x30')][_0xf253('0x34')](_0xf253('0x35'))){_0x121727[_0xf253('0x36')]=qs[_0xf253('0x36')](_0x1a4bb2[_0xf253('0x30')][_0xf253('0x36')]);_0x121727[_0xf253('0x37')]=qs[_0xf253('0x37')](_0x1a4bb2[_0xf253('0x30')][_0xf253('0x37')]);}_0x121727[_0xf253('0x38')]=qs[_0xf253('0x39')](_0x1a4bb2['query']['sort']);_0x121727[_0xf253('0x3a')]=qs[_0xf253('0x2e')](_['pick'](_0x1a4bb2['query'],_0x465223[_0xf253('0x2e')]),_0x187bed);if(_0x1a4bb2[_0xf253('0x30')][_0xf253('0x3b')]){_0x121727[_0xf253('0x3a')]=_['merge'](_0x121727[_0xf253('0x3a')],{'$or':_[_0xf253('0x26')](_0x187bed,function(_0x3dab9d){if(_0x3dab9d[_0xf253('0x2a')]!==_0xf253('0x3c')){var _0xbdf092={};_0xbdf092[_0x3dab9d['name']]={'$like':'%'+_0x1a4bb2['query'][_0xf253('0x3b')]+'%'};return _0xbdf092;}})});}_0x121727=_[_0xf253('0x3d')]({},_0x121727,_0x1a4bb2[_0xf253('0x3e')]);var _0x533888={'where':_0x121727[_0xf253('0x3a')]};return db[_0xf253('0x27')][_0xf253('0x1a')](_0x533888)[_0xf253('0x20')](function(_0x597a71){_0x17dc8f[_0xf253('0x1a')]=_0x597a71;if(_0x1a4bb2[_0xf253('0x30')][_0xf253('0x3f')]){_0x121727[_0xf253('0x40')]=[{'all':!![]}];}return db[_0xf253('0x27')][_0xf253('0x41')](_0x121727);})[_0xf253('0x20')](function(_0x4b704f){_0x17dc8f[_0xf253('0x42')]=_0x4b704f;return _0x17dc8f;})['then'](respondWithFilteredResult(_0x59e8b0,_0x121727))[_0xf253('0x43')](handleError(_0x59e8b0,null));};exports['show']=function(_0x18ff50,_0x50a4e3){var _0x14c061={'raw':!![],'where':{'id':_0x18ff50[_0xf253('0x44')]['id']}},_0x5c39ba={};_0x5c39ba['model']=_[_0xf253('0x2d')](db[_0xf253('0x27')][_0xf253('0x28')]);_0x5c39ba[_0xf253('0x30')]=_[_0xf253('0x2d')](_0x18ff50[_0xf253('0x30')]);_0x5c39ba[_0xf253('0x2e')]=_[_0xf253('0x2f')](_0x5c39ba[_0xf253('0x2c')],_0x5c39ba[_0xf253('0x30')]);_0x14c061['attributes']=_['intersection'](_0x5c39ba[_0xf253('0x2c')],qs['fields'](_0x18ff50[_0xf253('0x30')]['fields']));_0x14c061[_0xf253('0x32')]=_0x14c061[_0xf253('0x32')]['length']?_0x14c061[_0xf253('0x32')]:_0x5c39ba[_0xf253('0x2c')];if(_0x18ff50[_0xf253('0x30')]['includeAll']){_0x14c061[_0xf253('0x40')]=[{'all':!![]}];}_0x14c061=_[_0xf253('0x3d')]({},_0x14c061,_0x18ff50[_0xf253('0x3e')]);return db['MailSubstatus'][_0xf253('0x45')](_0x14c061)[_0xf253('0x20')](handleEntityNotFound(_0x50a4e3,null))[_0xf253('0x20')](respondWithResult(_0x50a4e3,null))[_0xf253('0x43')](handleError(_0x50a4e3,null));};exports[_0xf253('0x46')]=function(_0x412e36,_0x22d68c){return db[_0xf253('0x27')][_0xf253('0x46')](_0x412e36[_0xf253('0x47')],{})[_0xf253('0x20')](respondWithResult(_0x22d68c,0xc9))[_0xf253('0x43')](handleError(_0x22d68c,null));};exports[_0xf253('0x1f')]=function(_0x3f269d,_0x3641dd){if(_0x3f269d[_0xf253('0x47')]['id']){delete _0x3f269d[_0xf253('0x47')]['id'];}return db[_0xf253('0x27')]['find']({'where':{'id':_0x3f269d['params']['id']}})[_0xf253('0x20')](handleEntityNotFound(_0x3641dd,null))[_0xf253('0x20')](saveUpdates(_0x3f269d[_0xf253('0x47')],null))[_0xf253('0x20')](respondWithResult(_0x3641dd,null))[_0xf253('0x43')](handleError(_0x3641dd,null));};exports[_0xf253('0x21')]=function(_0x5f1a08,_0x7f25bf){return db[_0xf253('0x27')][_0xf253('0x45')]({'where':{'id':_0x5f1a08['params']['id']}})['then'](handleEntityNotFound(_0x7f25bf,null))[_0xf253('0x20')](removeEntity(_0x7f25bf,null))['catch'](handleError(_0x7f25bf,null));};exports[_0xf253('0x48')]=function(_0x2ee3a7,_0x25119b){return db['MailSubstatus'][_0xf253('0x48')]()[_0xf253('0x20')](respondWithResult(_0x25119b,null))[_0xf253('0x43')](handleError(_0x25119b,null));}; \ No newline at end of file +var _0xe7fd=['set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','MailSubstatus','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','fields','find','catch','create','body','html-pdf','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit'];(function(_0x4d3e8e,_0x538d0a){var _0x5354e5=function(_0x556da4){while(--_0x556da4){_0x4d3e8e['push'](_0x4d3e8e['shift']());}};_0x5354e5(++_0x538d0a);}(_0xe7fd,0x1ee));var _0xde7f=function(_0x26ccb3,_0x5984be){_0x26ccb3=_0x26ccb3-0x0;var _0x259ea0=_0xe7fd[_0x26ccb3];return _0x259ea0;};'use strict';var pdf=require(_0xde7f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xde7f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xde7f('0x2'));var rp=require(_0xde7f('0x3'));var moment=require(_0xde7f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xde7f('0x5'));var util=require('util');var path=require(_0xde7f('0x6'));var sox=require(_0xde7f('0x7'));var csv=require(_0xde7f('0x8'));var ejs=require(_0xde7f('0x9'));var fs=require('fs');var _=require(_0xde7f('0xa'));var squel=require(_0xde7f('0xb'));var crypto=require('crypto');var jsforce=require(_0xde7f('0xc'));var deskjs=require(_0xde7f('0xd'));var toCsv=require(_0xde7f('0x8'));var querystring=require(_0xde7f('0xe'));var Papa=require(_0xde7f('0xf'));var Redis=require('ioredis');var authService=require(_0xde7f('0x10'));var qs=require(_0xde7f('0x11'));var as=require(_0xde7f('0x12'));var hardwareService=require(_0xde7f('0x13'));var logger=require(_0xde7f('0x14'))('api');var utils=require(_0xde7f('0x15'));var config=require(_0xde7f('0x16'));var db=require(_0xde7f('0x17'))['db'];function respondWithStatusCode(_0xf7b176,_0x513917){_0x513917=_0x513917||0xcc;return function(_0x4292e6){if(_0x4292e6){return _0xf7b176[_0xde7f('0x18')](_0x513917);}return _0xf7b176[_0xde7f('0x19')](_0x513917)[_0xde7f('0x1a')]();};}function respondWithResult(_0x3cb5cb,_0x47da16){_0x47da16=_0x47da16||0xc8;return function(_0x4ce163){if(_0x4ce163){return _0x3cb5cb[_0xde7f('0x19')](_0x47da16)[_0xde7f('0x1b')](_0x4ce163);}};}function respondWithFilteredResult(_0x56b43f,_0x15731c){return function(_0x3650a9){if(_0x3650a9){var _0x311ec4=_0x3650a9[_0xde7f('0x1c')],_0xda8149=_0x15731c[_0xde7f('0x1d')],_0x2aedd7=_0x15731c[_0xde7f('0x1d')]+_0x15731c[_0xde7f('0x1e')],_0xbe2c81;if(_0x2aedd7>=_0x311ec4){_0x2aedd7=_0x311ec4;_0xbe2c81=0xc8;}else{_0xbe2c81=0xce;}_0x56b43f[_0xde7f('0x19')](_0xbe2c81);return _0x56b43f[_0xde7f('0x1f')](_0xde7f('0x20'),_0xda8149+'-'+_0x2aedd7+'/'+_0x311ec4)[_0xde7f('0x1b')](_0x3650a9);}return null;};}function patchUpdates(_0x10755b){return function(_0x2e8b20){try{jsonpatch['apply'](_0x2e8b20,_0x10755b,!![]);}catch(_0x33b57b){return BPromise[_0xde7f('0x21')](_0x33b57b);}return _0x2e8b20[_0xde7f('0x22')]();};}function saveUpdates(_0x5d9edf,_0xe092db){return function(_0x497ced){if(_0x497ced){return _0x497ced[_0xde7f('0x23')](_0x5d9edf)[_0xde7f('0x24')](function(_0x2f9ca8){return _0x2f9ca8;});}return null;};}function removeEntity(_0x2e0ca4,_0x28cf57){return function(_0x37877d){if(_0x37877d){return _0x37877d[_0xde7f('0x25')]()['then'](function(){_0x2e0ca4[_0xde7f('0x19')](0xcc)[_0xde7f('0x1a')]();});}};}function handleEntityNotFound(_0x4356db,_0xcdb9f5){return function(_0x492657){if(!_0x492657){_0x4356db[_0xde7f('0x18')](0x194);}return _0x492657;};}function handleError(_0x3da36a,_0x283b2d){_0x283b2d=_0x283b2d||0x1f4;return function(_0x1c90ec){logger[_0xde7f('0x26')](_0x1c90ec[_0xde7f('0x27')]);if(_0x1c90ec['name']){delete _0x1c90ec[_0xde7f('0x28')];}_0x3da36a[_0xde7f('0x19')](_0x283b2d)[_0xde7f('0x29')](_0x1c90ec);};}exports[_0xde7f('0x2a')]=function(_0x5d3a2e,_0x537e25){var _0x98422b={},_0x4652b5={},_0x25a0da={'count':0x0,'rows':[]};var _0x39ed24=_['map'](db[_0xde7f('0x2b')][_0xde7f('0x2c')],function(_0x5103e6){return{'name':_0x5103e6[_0xde7f('0x2d')],'type':_0x5103e6['type'][_0xde7f('0x2e')]};});_0x4652b5[_0xde7f('0x2f')]=_[_0xde7f('0x30')](_0x39ed24,_0xde7f('0x28'));_0x4652b5[_0xde7f('0x31')]=_[_0xde7f('0x32')](_0x5d3a2e[_0xde7f('0x31')]);_0x4652b5[_0xde7f('0x33')]=_[_0xde7f('0x34')](_0x4652b5[_0xde7f('0x2f')],_0x4652b5['query']);_0x98422b[_0xde7f('0x35')]=_[_0xde7f('0x34')](_0x4652b5[_0xde7f('0x2f')],qs['fields'](_0x5d3a2e[_0xde7f('0x31')]['fields']));_0x98422b[_0xde7f('0x35')]=_0x98422b[_0xde7f('0x35')][_0xde7f('0x36')]?_0x98422b['attributes']:_0x4652b5[_0xde7f('0x2f')];if(!_0x5d3a2e[_0xde7f('0x31')][_0xde7f('0x37')](_0xde7f('0x38'))){_0x98422b['limit']=qs[_0xde7f('0x1e')](_0x5d3a2e[_0xde7f('0x31')]['limit']);_0x98422b['offset']=qs[_0xde7f('0x1d')](_0x5d3a2e[_0xde7f('0x31')][_0xde7f('0x1d')]);}_0x98422b[_0xde7f('0x39')]=qs[_0xde7f('0x3a')](_0x5d3a2e['query']['sort']);_0x98422b[_0xde7f('0x3b')]=qs[_0xde7f('0x33')](_['pick'](_0x5d3a2e[_0xde7f('0x31')],_0x4652b5['filters']),_0x39ed24);if(_0x5d3a2e['query'][_0xde7f('0x3c')]){_0x98422b[_0xde7f('0x3b')]=_[_0xde7f('0x3d')](_0x98422b[_0xde7f('0x3b')],{'$or':_[_0xde7f('0x30')](_0x39ed24,function(_0x49f0b0){if(_0x49f0b0[_0xde7f('0x3e')]!==_0xde7f('0x3f')){var _0x44e578={};_0x44e578[_0x49f0b0[_0xde7f('0x28')]]={'$like':'%'+_0x5d3a2e[_0xde7f('0x31')][_0xde7f('0x3c')]+'%'};return _0x44e578;}})});}_0x98422b=_['merge']({},_0x98422b,_0x5d3a2e[_0xde7f('0x40')]);var _0x318245={'where':_0x98422b['where']};return db[_0xde7f('0x2b')][_0xde7f('0x1c')](_0x318245)['then'](function(_0x33888e){_0x25a0da[_0xde7f('0x1c')]=_0x33888e;if(_0x5d3a2e[_0xde7f('0x31')][_0xde7f('0x41')]){_0x98422b[_0xde7f('0x42')]=[{'all':!![]}];}return db[_0xde7f('0x2b')]['findAll'](_0x98422b);})[_0xde7f('0x24')](function(_0x442b2f){_0x25a0da[_0xde7f('0x43')]=_0x442b2f;return _0x25a0da;})[_0xde7f('0x24')](respondWithFilteredResult(_0x537e25,_0x98422b))['catch'](handleError(_0x537e25,null));};exports[_0xde7f('0x44')]=function(_0x2333d2,_0x4d2d4f){var _0x3edf9b={'raw':!![],'where':{'id':_0x2333d2[_0xde7f('0x45')]['id']}},_0x579768={};_0x579768[_0xde7f('0x2f')]=_[_0xde7f('0x32')](db[_0xde7f('0x2b')][_0xde7f('0x2c')]);_0x579768[_0xde7f('0x31')]=_[_0xde7f('0x32')](_0x2333d2['query']);_0x579768[_0xde7f('0x33')]=_['intersection'](_0x579768[_0xde7f('0x2f')],_0x579768[_0xde7f('0x31')]);_0x3edf9b[_0xde7f('0x35')]=_[_0xde7f('0x34')](_0x579768[_0xde7f('0x2f')],qs['fields'](_0x2333d2[_0xde7f('0x31')][_0xde7f('0x46')]));_0x3edf9b['attributes']=_0x3edf9b['attributes'][_0xde7f('0x36')]?_0x3edf9b[_0xde7f('0x35')]:_0x579768[_0xde7f('0x2f')];if(_0x2333d2[_0xde7f('0x31')][_0xde7f('0x41')]){_0x3edf9b[_0xde7f('0x42')]=[{'all':!![]}];}_0x3edf9b=_['merge']({},_0x3edf9b,_0x2333d2['options']);return db[_0xde7f('0x2b')][_0xde7f('0x47')](_0x3edf9b)[_0xde7f('0x24')](handleEntityNotFound(_0x4d2d4f,null))[_0xde7f('0x24')](respondWithResult(_0x4d2d4f,null))[_0xde7f('0x48')](handleError(_0x4d2d4f,null));};exports[_0xde7f('0x49')]=function(_0x1326ec,_0x19f376){return db['MailSubstatus'][_0xde7f('0x49')](_0x1326ec[_0xde7f('0x4a')],{})[_0xde7f('0x24')](respondWithResult(_0x19f376,0xc9))[_0xde7f('0x48')](handleError(_0x19f376,null));};exports['update']=function(_0x73072f,_0x1865b6){if(_0x73072f['body']['id']){delete _0x73072f['body']['id'];}return db[_0xde7f('0x2b')][_0xde7f('0x47')]({'where':{'id':_0x73072f['params']['id']}})[_0xde7f('0x24')](handleEntityNotFound(_0x1865b6,null))[_0xde7f('0x24')](saveUpdates(_0x73072f[_0xde7f('0x4a')],null))[_0xde7f('0x24')](respondWithResult(_0x1865b6,null))['catch'](handleError(_0x1865b6,null));};exports[_0xde7f('0x25')]=function(_0x288cc,_0x5aa08a){return db[_0xde7f('0x2b')]['find']({'where':{'id':_0x288cc[_0xde7f('0x45')]['id']}})[_0xde7f('0x24')](handleEntityNotFound(_0x5aa08a,null))[_0xde7f('0x24')](removeEntity(_0x5aa08a,null))['catch'](handleError(_0x5aa08a,null));};exports['describe']=function(_0x225e16,_0x3c1f4b){return db['MailSubstatus']['describe']()['then'](respondWithResult(_0x3c1f4b,null))[_0xde7f('0x48')](handleError(_0x3c1f4b,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 3faa973..e67effe 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 _0x3d04=['../../config/environment','./mailSubstatus.attributes','exports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x23eef6,_0x476f63){var _0x45b0dd=function(_0x578260){while(--_0x578260){_0x23eef6['push'](_0x23eef6['shift']());}};_0x45b0dd(++_0x476f63);}(_0x3d04,0xbe));var _0x43d0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3d04[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x43d0('0x0'));var util=require(_0x43d0('0x1'));var logger=require(_0x43d0('0x2'))(_0x43d0('0x3'));var moment=require(_0x43d0('0x4'));var BPromise=require(_0x43d0('0x5'));var rp=require(_0x43d0('0x6'));var fs=require('fs');var path=require(_0x43d0('0x7'));var rimraf=require('rimraf');var config=require(_0x43d0('0x8'));var attributes=require(_0x43d0('0x9'));module[_0x43d0('0xa')]=function(_0x617bf,_0x5e284f){return _0x617bf['define']('MailSubstatus',attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe77c=['MailSubstatus','mail_substatuses','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailSubstatus.attributes'];(function(_0x27e348,_0x2c908e){var _0xbae94b=function(_0x47b542){while(--_0x47b542){_0x27e348['push'](_0x27e348['shift']());}};_0xbae94b(++_0x2c908e);}(_0xe77c,0x176));var _0xce77=function(_0x221a6f,_0x1674c8){_0x221a6f=_0x221a6f-0x0;var _0x3db53d=_0xe77c[_0x221a6f];return _0x3db53d;};'use strict';var _=require(_0xce77('0x0'));var util=require(_0xce77('0x1'));var logger=require(_0xce77('0x2'))('api');var moment=require(_0xce77('0x3'));var BPromise=require(_0xce77('0x4'));var rp=require(_0xce77('0x5'));var fs=require('fs');var path=require(_0xce77('0x6'));var rimraf=require(_0xce77('0x7'));var config=require(_0xce77('0x8'));var attributes=require(_0xce77('0x9'));module['exports']=function(_0x5aea39,_0xed47c5){return _0x5aea39['define'](_0xce77('0xa'),attributes,{'tableName':_0xce77('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 267e65c..314d2a4 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 _0xa75b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x120791,_0x2186d8){var _0x244e62=function(_0x17e248){while(--_0x17e248){_0x120791['push'](_0x120791['shift']());}};_0x244e62(++_0x2186d8);}(_0xa75b,0x170));var _0xba75=function(_0x2456cf,_0x50da4b){_0x2456cf=_0x2456cf-0x0;var _0x969445=_0xa75b[_0x2456cf];return _0x969445;};'use strict';var _=require(_0xba75('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xba75('0x1'));var rs=require(_0xba75('0x2'));var fs=require('fs');var Redis=require(_0xba75('0x3'));var db=require(_0xba75('0x4'))['db'];var utils=require(_0xba75('0x5'));var logger=require(_0xba75('0x6'))(_0xba75('0x7'));var config=require(_0xba75('0x8'));var jayson=require(_0xba75('0x9'));var client=jayson[_0xba75('0xa')][_0xba75('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x238a33,_0x3ccab5,_0x5c79e3){return new BPromise(function(_0x4b842d,_0x731cae){return client['request'](_0x238a33,_0x5c79e3)['then'](function(_0x218dbd){logger['info'](_0xba75('0xc'),_0x3ccab5,_0xba75('0xd'));logger[_0xba75('0xe')](_0xba75('0xf'),_0x3ccab5,_0xba75('0xd'),JSON[_0xba75('0x10')](_0x218dbd));if(_0x218dbd[_0xba75('0x11')]){if(_0x218dbd[_0xba75('0x11')][_0xba75('0x12')]===0x1f4){logger[_0xba75('0x11')](_0xba75('0xc'),_0x3ccab5,_0x218dbd[_0xba75('0x11')]['message']);return _0x731cae(_0x218dbd['error'][_0xba75('0x13')]);}logger['error'](_0xba75('0xc'),_0x3ccab5,_0x218dbd[_0xba75('0x11')][_0xba75('0x13')]);return _0x4b842d(_0x218dbd[_0xba75('0x11')]['message']);}else{logger[_0xba75('0x14')](_0xba75('0xc'),_0x3ccab5,_0xba75('0xd'));_0x4b842d(_0x218dbd[_0xba75('0x15')][_0xba75('0x13')]);}})['catch'](function(_0x350a9d){logger[_0xba75('0x11')](_0xba75('0xc'),_0x3ccab5,_0x350a9d);_0x731cae(_0x350a9d);});});} \ No newline at end of file +var _0x1be1=['stringify','error','code','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x5d4f12,_0x11e67c){var _0x4eb577=function(_0x4d7a2d){while(--_0x4d7a2d){_0x5d4f12['push'](_0x5d4f12['shift']());}};_0x4eb577(++_0x11e67c);}(_0x1be1,0x192));var _0x11be=function(_0x4df3bb,_0x3eb72c){_0x4df3bb=_0x4df3bb-0x0;var _0x4be554=_0x1be1[_0x4df3bb];return _0x4be554;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x11be('0x0'));var BPromise=require(_0x11be('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x11be('0x2'));var db=require(_0x11be('0x3'))['db'];var utils=require(_0x11be('0x4'));var logger=require(_0x11be('0x5'))('rpc');var config=require(_0x11be('0x6'));var jayson=require(_0x11be('0x7'));var client=jayson[_0x11be('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfe8c62,_0x497730,_0x18f661){return new BPromise(function(_0x11fc15,_0x246772){return client[_0x11be('0x9')](_0xfe8c62,_0x18f661)[_0x11be('0xa')](function(_0x5f3d04){logger[_0x11be('0xb')](_0x11be('0xc'),_0x497730,'request\x20sent');logger[_0x11be('0xd')](_0x11be('0xe'),_0x497730,_0x11be('0xf'),JSON[_0x11be('0x10')](_0x5f3d04));if(_0x5f3d04['error']){if(_0x5f3d04[_0x11be('0x11')][_0x11be('0x12')]===0x1f4){logger[_0x11be('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x497730,_0x5f3d04[_0x11be('0x11')][_0x11be('0x13')]);return _0x246772(_0x5f3d04['error'][_0x11be('0x13')]);}logger['error']('MailSubstatus,\x20%s,\x20%s',_0x497730,_0x5f3d04['error']['message']);return _0x11fc15(_0x5f3d04['error']['message']);}else{logger['info'](_0x11be('0xc'),_0x497730,'request\x20sent');_0x11fc15(_0x5f3d04[_0x11be('0x14')][_0x11be('0x13')]);}})[_0x11be('0x15')](function(_0x216b8c){logger['error'](_0x11be('0xc'),_0x497730,_0x216b8c);_0x246772(_0x216b8c);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 8187231..b58a516 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 _0x73da=['exports','multer','path','connect-timeout','express','Router','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','/:id','show','post','create','update','delete','destroy'];(function(_0xe46db8,_0x4d7ced){var _0x46cdbd=function(_0x12c3c9){while(--_0x12c3c9){_0xe46db8['push'](_0xe46db8['shift']());}};_0x46cdbd(++_0x4d7ced);}(_0x73da,0x78));var _0xa73d=function(_0x5e06c3,_0x154aa1){_0x5e06c3=_0x5e06c3-0x0;var _0xd287dd=_0x73da[_0x5e06c3];return _0xd287dd;};'use strict';var multer=require(_0xa73d('0x0'));var util=require('util');var path=require(_0xa73d('0x1'));var timeout=require(_0xa73d('0x2'));var express=require(_0xa73d('0x3'));var router=express[_0xa73d('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa73d('0x5'));var controller=require(_0xa73d('0x6'));router[_0xa73d('0x7')]('/',auth[_0xa73d('0x8')](),controller['index']);router[_0xa73d('0x7')]('/describe',auth[_0xa73d('0x8')](),controller['describe']);router[_0xa73d('0x7')](_0xa73d('0x9'),auth[_0xa73d('0x8')](),controller[_0xa73d('0xa')]);router[_0xa73d('0xb')]('/',auth[_0xa73d('0x8')](),controller[_0xa73d('0xc')]);router['put'](_0xa73d('0x9'),auth['isAuthenticated'](),controller[_0xa73d('0xd')]);router[_0xa73d('0xe')](_0xa73d('0x9'),auth[_0xa73d('0x8')](),controller[_0xa73d('0xf')]);module[_0xa73d('0x10')]=router; \ No newline at end of file +var _0x9f5f=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express'];(function(_0x286e63,_0x90bf8f){var _0x4535eb=function(_0x1d71b4){while(--_0x1d71b4){_0x286e63['push'](_0x286e63['shift']());}};_0x4535eb(++_0x90bf8f);}(_0x9f5f,0x146));var _0xf9f5=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x9f5f[_0x4ff09b];return _0x3f5c2e;};'use strict';var multer=require(_0xf9f5('0x0'));var util=require(_0xf9f5('0x1'));var path=require(_0xf9f5('0x2'));var timeout=require('connect-timeout');var express=require(_0xf9f5('0x3'));var router=express[_0xf9f5('0x4')]();var auth=require(_0xf9f5('0x5'));var interaction=require(_0xf9f5('0x6'));var config=require(_0xf9f5('0x7'));var controller=require(_0xf9f5('0x8'));router[_0xf9f5('0x9')]('/',auth[_0xf9f5('0xa')](),controller[_0xf9f5('0xb')]);router[_0xf9f5('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xf9f5('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xf9f5('0xd')]);router[_0xf9f5('0xe')]('/',auth[_0xf9f5('0xa')](),controller[_0xf9f5('0xf')]);router[_0xf9f5('0x10')](_0xf9f5('0x11'),auth[_0xf9f5('0xa')](),controller[_0xf9f5('0x12')]);router[_0xf9f5('0x13')](_0xf9f5('0x11'),auth['isAuthenticated'](),controller[_0xf9f5('0x14')]);module[_0xf9f5('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 48a31f2..a9fd185 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 _0x180f=['account','agent','NOW','moment','sequelize','exports','ENUM'];(function(_0x5e1624,_0x26957f){var _0x3c6417=function(_0x501fc6){while(--_0x501fc6){_0x5e1624['push'](_0x5e1624['shift']());}};_0x3c6417(++_0x26957f);}(_0x180f,0x1ae));var _0xf180=function(_0x41e8c4,_0x30d9ff){_0x41e8c4=_0x41e8c4-0x0;var _0x54ffbe=_0x180f[_0x41e8c4];return _0x54ffbe;};'use strict';var moment=require(_0xf180('0x0'));var Sequelize=require(_0xf180('0x1'));module[_0xf180('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf180('0x3')](_0xf180('0x4'),_0xf180('0x5'),'queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xf180('0x6')]}}; \ No newline at end of file +var _0xf723=['STRING','account','agent','queue','moment','sequelize','exports'];(function(_0x22bee0,_0x412ecb){var _0x2d295b=function(_0x59d4b5){while(--_0x59d4b5){_0x22bee0['push'](_0x22bee0['shift']());}};_0x2d295b(++_0x412ecb);}(_0xf723,0x107));var _0x3f72=function(_0x273305,_0x57815f){_0x273305=_0x273305-0x0;var _0x12cf22=_0xf723[_0x273305];return _0x12cf22;};'use strict';var moment=require(_0x3f72('0x0'));var Sequelize=require(_0x3f72('0x1'));module[_0x3f72('0x2')]={'uniqueid':{'type':Sequelize[_0x3f72('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x3f72('0x4'),_0x3f72('0x5'),_0x3f72('0x6')),'allowNull':![],'defaultValue':_0x3f72('0x6')},'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 ec2212a..b2af173 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 _0xe5b1=['pick','filter','where','type','VIRTUAL','merge','includeAll','include','findAll','catch','show','length','options','find','create','body','params','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','stack','name','index','map','MailTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','sort'];(function(_0x6cedff,_0x3b696c){var _0x282d11=function(_0x35d0f3){while(--_0x35d0f3){_0x6cedff['push'](_0x6cedff['shift']());}};_0x282d11(++_0x3b696c);}(_0xe5b1,0x139));var _0x1e5b=function(_0x71cd05,_0x36ac11){_0x71cd05=_0x71cd05-0x0;var _0x59c9e7=_0xe5b1[_0x71cd05];return _0x59c9e7;};'use strict';var pdf=require(_0x1e5b('0x0'));var emlformat=require(_0x1e5b('0x1'));var rimraf=require(_0x1e5b('0x2'));var zipdir=require(_0x1e5b('0x3'));var jsonpatch=require(_0x1e5b('0x4'));var rp=require(_0x1e5b('0x5'));var moment=require(_0x1e5b('0x6'));var BPromise=require(_0x1e5b('0x7'));var Mustache=require(_0x1e5b('0x8'));var util=require('util');var path=require(_0x1e5b('0x9'));var sox=require(_0x1e5b('0xa'));var csv=require(_0x1e5b('0xb'));var ejs=require(_0x1e5b('0xc'));var fs=require('fs');var _=require(_0x1e5b('0xd'));var squel=require(_0x1e5b('0xe'));var crypto=require(_0x1e5b('0xf'));var jsforce=require(_0x1e5b('0x10'));var deskjs=require(_0x1e5b('0x11'));var toCsv=require('to-csv');var querystring=require(_0x1e5b('0x12'));var Papa=require('papaparse');var Redis=require(_0x1e5b('0x13'));var authService=require(_0x1e5b('0x14'));var qs=require(_0x1e5b('0x15'));var as=require(_0x1e5b('0x16'));var hardwareService=require(_0x1e5b('0x17'));var logger=require('../../config/logger')(_0x1e5b('0x18'));var utils=require('../../config/utils');var config=require(_0x1e5b('0x19'));var db=require(_0x1e5b('0x1a'))['db'];function respondWithStatusCode(_0x38b107,_0x5f2b93){_0x5f2b93=_0x5f2b93||0xcc;return function(_0x45fce1){if(_0x45fce1){return _0x38b107[_0x1e5b('0x1b')](_0x5f2b93);}return _0x38b107[_0x1e5b('0x1c')](_0x5f2b93)[_0x1e5b('0x1d')]();};}function respondWithResult(_0x5f384c,_0x36eb8b){_0x36eb8b=_0x36eb8b||0xc8;return function(_0x19038d){if(_0x19038d){return _0x5f384c[_0x1e5b('0x1c')](_0x36eb8b)[_0x1e5b('0x1e')](_0x19038d);}};}function respondWithFilteredResult(_0x4d7f51,_0x36109f){return function(_0x302d23){if(_0x302d23){var _0x5d7b9d=_0x302d23[_0x1e5b('0x1f')],_0x218d06=_0x36109f[_0x1e5b('0x20')],_0x4fae11=_0x36109f[_0x1e5b('0x20')]+_0x36109f[_0x1e5b('0x21')],_0x3609bb;if(_0x4fae11>=_0x5d7b9d){_0x4fae11=_0x5d7b9d;_0x3609bb=0xc8;}else{_0x3609bb=0xce;}_0x4d7f51[_0x1e5b('0x1c')](_0x3609bb);return _0x4d7f51['set'](_0x1e5b('0x22'),_0x218d06+'-'+_0x4fae11+'/'+_0x5d7b9d)[_0x1e5b('0x1e')](_0x302d23);}return null;};}function patchUpdates(_0x5e84c0){return function(_0x372ff8){try{jsonpatch[_0x1e5b('0x23')](_0x372ff8,_0x5e84c0,!![]);}catch(_0x3bf328){return BPromise[_0x1e5b('0x24')](_0x3bf328);}return _0x372ff8[_0x1e5b('0x25')]();};}function saveUpdates(_0x50eec8,_0x276a5e){return function(_0x5c7025){if(_0x5c7025){return _0x5c7025[_0x1e5b('0x26')](_0x50eec8)['then'](function(_0x1b9000){return _0x1b9000;});}return null;};}function removeEntity(_0x390f9,_0xbfb01d){return function(_0x5ca679){if(_0x5ca679){return _0x5ca679[_0x1e5b('0x27')]()[_0x1e5b('0x28')](function(){_0x390f9[_0x1e5b('0x1c')](0xcc)[_0x1e5b('0x1d')]();});}};}function handleEntityNotFound(_0x1114f8,_0x10494d){return function(_0x481a2b){if(!_0x481a2b){_0x1114f8[_0x1e5b('0x1b')](0x194);}return _0x481a2b;};}function handleError(_0x14c5cb,_0x120560){_0x120560=_0x120560||0x1f4;return function(_0xf8d86c){logger['error'](_0xf8d86c[_0x1e5b('0x29')]);if(_0xf8d86c[_0x1e5b('0x2a')]){delete _0xf8d86c[_0x1e5b('0x2a')];}_0x14c5cb[_0x1e5b('0x1c')](_0x120560)['send'](_0xf8d86c);};}exports[_0x1e5b('0x2b')]=function(_0x5cf7ec,_0x3a7333){var _0x3ec359={},_0xae519f={},_0x237170={'count':0x0,'rows':[]};var _0x16c388=_[_0x1e5b('0x2c')](db[_0x1e5b('0x2d')][_0x1e5b('0x2e')],function(_0x47a32e){return{'name':_0x47a32e[_0x1e5b('0x2f')],'type':_0x47a32e['type'][_0x1e5b('0x30')]};});_0xae519f[_0x1e5b('0x31')]=_[_0x1e5b('0x2c')](_0x16c388,'name');_0xae519f[_0x1e5b('0x32')]=_[_0x1e5b('0x33')](_0x5cf7ec['query']);_0xae519f[_0x1e5b('0x34')]=_['intersection'](_0xae519f[_0x1e5b('0x31')],_0xae519f[_0x1e5b('0x32')]);_0x3ec359[_0x1e5b('0x35')]=_[_0x1e5b('0x36')](_0xae519f[_0x1e5b('0x31')],qs[_0x1e5b('0x37')](_0x5cf7ec[_0x1e5b('0x32')][_0x1e5b('0x37')]));_0x3ec359['attributes']=_0x3ec359['attributes']['length']?_0x3ec359[_0x1e5b('0x35')]:_0xae519f[_0x1e5b('0x31')];if(!_0x5cf7ec[_0x1e5b('0x32')]['hasOwnProperty']('nolimit')){_0x3ec359[_0x1e5b('0x21')]=qs['limit'](_0x5cf7ec[_0x1e5b('0x32')][_0x1e5b('0x21')]);_0x3ec359['offset']=qs[_0x1e5b('0x20')](_0x5cf7ec[_0x1e5b('0x32')][_0x1e5b('0x20')]);}_0x3ec359['order']=qs[_0x1e5b('0x38')](_0x5cf7ec[_0x1e5b('0x32')][_0x1e5b('0x38')]);_0x3ec359['where']=qs[_0x1e5b('0x34')](_[_0x1e5b('0x39')](_0x5cf7ec[_0x1e5b('0x32')],_0xae519f[_0x1e5b('0x34')]),_0x16c388);if(_0x5cf7ec['query'][_0x1e5b('0x3a')]){_0x3ec359['where']=_['merge'](_0x3ec359[_0x1e5b('0x3b')],{'$or':_[_0x1e5b('0x2c')](_0x16c388,function(_0x51236a){if(_0x51236a[_0x1e5b('0x3c')]!==_0x1e5b('0x3d')){var _0x547d22={};_0x547d22[_0x51236a[_0x1e5b('0x2a')]]={'$like':'%'+_0x5cf7ec['query'][_0x1e5b('0x3a')]+'%'};return _0x547d22;}})});}_0x3ec359=_[_0x1e5b('0x3e')]({},_0x3ec359,_0x5cf7ec['options']);var _0x47f7fd={'where':_0x3ec359[_0x1e5b('0x3b')]};return db[_0x1e5b('0x2d')][_0x1e5b('0x1f')](_0x47f7fd)[_0x1e5b('0x28')](function(_0x3586de){_0x237170[_0x1e5b('0x1f')]=_0x3586de;if(_0x5cf7ec['query'][_0x1e5b('0x3f')]){_0x3ec359[_0x1e5b('0x40')]=[{'all':!![]}];}return db[_0x1e5b('0x2d')][_0x1e5b('0x41')](_0x3ec359);})['then'](function(_0xa643f0){_0x237170['rows']=_0xa643f0;return _0x237170;})['then'](respondWithFilteredResult(_0x3a7333,_0x3ec359))[_0x1e5b('0x42')](handleError(_0x3a7333,null));};exports[_0x1e5b('0x43')]=function(_0x55897d,_0x108c38){var _0x41fcb2={'raw':!![],'where':{'id':_0x55897d['params']['id']}},_0x227cbc={};_0x227cbc[_0x1e5b('0x31')]=_[_0x1e5b('0x33')](db[_0x1e5b('0x2d')]['rawAttributes']);_0x227cbc[_0x1e5b('0x32')]=_[_0x1e5b('0x33')](_0x55897d[_0x1e5b('0x32')]);_0x227cbc[_0x1e5b('0x34')]=_[_0x1e5b('0x36')](_0x227cbc[_0x1e5b('0x31')],_0x227cbc['query']);_0x41fcb2['attributes']=_[_0x1e5b('0x36')](_0x227cbc[_0x1e5b('0x31')],qs[_0x1e5b('0x37')](_0x55897d[_0x1e5b('0x32')]['fields']));_0x41fcb2['attributes']=_0x41fcb2[_0x1e5b('0x35')][_0x1e5b('0x44')]?_0x41fcb2[_0x1e5b('0x35')]:_0x227cbc['model'];if(_0x55897d[_0x1e5b('0x32')][_0x1e5b('0x3f')]){_0x41fcb2[_0x1e5b('0x40')]=[{'all':!![]}];}_0x41fcb2=_[_0x1e5b('0x3e')]({},_0x41fcb2,_0x55897d[_0x1e5b('0x45')]);return db[_0x1e5b('0x2d')][_0x1e5b('0x46')](_0x41fcb2)[_0x1e5b('0x28')](handleEntityNotFound(_0x108c38,null))[_0x1e5b('0x28')](respondWithResult(_0x108c38,null))[_0x1e5b('0x42')](handleError(_0x108c38,null));};exports['create']=function(_0x2d3914,_0x4a5f72){return db[_0x1e5b('0x2d')][_0x1e5b('0x47')](_0x2d3914['body'],{})['then'](respondWithResult(_0x4a5f72,0xc9))[_0x1e5b('0x42')](handleError(_0x4a5f72,null));};exports[_0x1e5b('0x26')]=function(_0x667a4a,_0x4a0d6f){if(_0x667a4a[_0x1e5b('0x48')]['id']){delete _0x667a4a['body']['id'];}return db['MailTransferReport'][_0x1e5b('0x46')]({'where':{'id':_0x667a4a[_0x1e5b('0x49')]['id']}})[_0x1e5b('0x28')](handleEntityNotFound(_0x4a0d6f,null))[_0x1e5b('0x28')](saveUpdates(_0x667a4a[_0x1e5b('0x48')],null))[_0x1e5b('0x28')](respondWithResult(_0x4a0d6f,null))[_0x1e5b('0x42')](handleError(_0x4a0d6f,null));};exports[_0x1e5b('0x27')]=function(_0xb21b74,_0x1d24e){return db[_0x1e5b('0x2d')][_0x1e5b('0x46')]({'where':{'id':_0xb21b74[_0x1e5b('0x49')]['id']}})[_0x1e5b('0x28')](handleEntityNotFound(_0x1d24e,null))[_0x1e5b('0x28')](removeEntity(_0x1d24e,null))[_0x1e5b('0x42')](handleError(_0x1d24e,null));};exports['describe']=function(_0x8fd747,_0x11bde3){return db[_0x1e5b('0x2d')]['describe']()[_0x1e5b('0x28')](respondWithResult(_0x11bde3,null))['catch'](handleError(_0x11bde3,null));}; \ No newline at end of file +var _0x90ae=['then','destroy','error','stack','name','index','map','MailTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','zip-dir','bluebird','mustache','path','sox','to-csv','ejs','lodash','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','offset','limit','set','apply','save','update'];(function(_0x22f103,_0x389bb4){var _0x14d521=function(_0x44b0eb){while(--_0x44b0eb){_0x22f103['push'](_0x22f103['shift']());}};_0x14d521(++_0x389bb4);}(_0x90ae,0x6c));var _0xe90a=function(_0x363461,_0x3070e5){_0x363461=_0x363461-0x0;var _0x36e250=_0x90ae[_0x363461];return _0x36e250;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe90a('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe90a('0x1'));var Mustache=require(_0xe90a('0x2'));var util=require('util');var path=require(_0xe90a('0x3'));var sox=require(_0xe90a('0x4'));var csv=require(_0xe90a('0x5'));var ejs=require(_0xe90a('0x6'));var fs=require('fs');var _=require(_0xe90a('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe90a('0x8'));var toCsv=require('to-csv');var querystring=require(_0xe90a('0x9'));var Papa=require('papaparse');var Redis=require(_0xe90a('0xa'));var authService=require(_0xe90a('0xb'));var qs=require(_0xe90a('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe90a('0xd'));var logger=require(_0xe90a('0xe'))(_0xe90a('0xf'));var utils=require(_0xe90a('0x10'));var config=require(_0xe90a('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21fe43,_0x53d113){_0x53d113=_0x53d113||0xcc;return function(_0x23158b){if(_0x23158b){return _0x21fe43['sendStatus'](_0x53d113);}return _0x21fe43[_0xe90a('0x12')](_0x53d113)[_0xe90a('0x13')]();};}function respondWithResult(_0x3b15f4,_0x3e0902){_0x3e0902=_0x3e0902||0xc8;return function(_0x444255){if(_0x444255){return _0x3b15f4[_0xe90a('0x12')](_0x3e0902)[_0xe90a('0x14')](_0x444255);}};}function respondWithFilteredResult(_0x8af12c,_0x40b704){return function(_0x50b492){if(_0x50b492){var _0x253561=_0x50b492[_0xe90a('0x15')],_0x1ce0a0=_0x40b704[_0xe90a('0x16')],_0x4e8f7f=_0x40b704['offset']+_0x40b704[_0xe90a('0x17')],_0x40c63a;if(_0x4e8f7f>=_0x253561){_0x4e8f7f=_0x253561;_0x40c63a=0xc8;}else{_0x40c63a=0xce;}_0x8af12c['status'](_0x40c63a);return _0x8af12c[_0xe90a('0x18')]('Content-Range',_0x1ce0a0+'-'+_0x4e8f7f+'/'+_0x253561)[_0xe90a('0x14')](_0x50b492);}return null;};}function patchUpdates(_0x321c08){return function(_0x5c893e){try{jsonpatch[_0xe90a('0x19')](_0x5c893e,_0x321c08,!![]);}catch(_0x24cabd){return BPromise['reject'](_0x24cabd);}return _0x5c893e[_0xe90a('0x1a')]();};}function saveUpdates(_0x4ed121,_0x40eb17){return function(_0x1c76ad){if(_0x1c76ad){return _0x1c76ad[_0xe90a('0x1b')](_0x4ed121)[_0xe90a('0x1c')](function(_0x242a13){return _0x242a13;});}return null;};}function removeEntity(_0x5afb5d,_0x26d6aa){return function(_0x837810){if(_0x837810){return _0x837810[_0xe90a('0x1d')]()['then'](function(){_0x5afb5d[_0xe90a('0x12')](0xcc)[_0xe90a('0x13')]();});}};}function handleEntityNotFound(_0x30ef43,_0x66c77){return function(_0x58b30f){if(!_0x58b30f){_0x30ef43['sendStatus'](0x194);}return _0x58b30f;};}function handleError(_0x1e6b4a,_0x351bd7){_0x351bd7=_0x351bd7||0x1f4;return function(_0x3f88df){logger[_0xe90a('0x1e')](_0x3f88df[_0xe90a('0x1f')]);if(_0x3f88df['name']){delete _0x3f88df[_0xe90a('0x20')];}_0x1e6b4a['status'](_0x351bd7)['send'](_0x3f88df);};}exports[_0xe90a('0x21')]=function(_0x30e828,_0x4771a1){var _0x269f65={},_0x5cee9d={},_0x422985={'count':0x0,'rows':[]};var _0x37a349=_[_0xe90a('0x22')](db[_0xe90a('0x23')]['rawAttributes'],function(_0xedfe36){return{'name':_0xedfe36[_0xe90a('0x24')],'type':_0xedfe36[_0xe90a('0x25')][_0xe90a('0x26')]};});_0x5cee9d[_0xe90a('0x27')]=_['map'](_0x37a349,'name');_0x5cee9d[_0xe90a('0x28')]=_[_0xe90a('0x29')](_0x30e828[_0xe90a('0x28')]);_0x5cee9d[_0xe90a('0x2a')]=_[_0xe90a('0x2b')](_0x5cee9d[_0xe90a('0x27')],_0x5cee9d[_0xe90a('0x28')]);_0x269f65[_0xe90a('0x2c')]=_[_0xe90a('0x2b')](_0x5cee9d[_0xe90a('0x27')],qs[_0xe90a('0x2d')](_0x30e828[_0xe90a('0x28')][_0xe90a('0x2d')]));_0x269f65[_0xe90a('0x2c')]=_0x269f65['attributes'][_0xe90a('0x2e')]?_0x269f65[_0xe90a('0x2c')]:_0x5cee9d['model'];if(!_0x30e828['query'][_0xe90a('0x2f')](_0xe90a('0x30'))){_0x269f65['limit']=qs[_0xe90a('0x17')](_0x30e828['query'][_0xe90a('0x17')]);_0x269f65[_0xe90a('0x16')]=qs[_0xe90a('0x16')](_0x30e828[_0xe90a('0x28')]['offset']);}_0x269f65[_0xe90a('0x31')]=qs[_0xe90a('0x32')](_0x30e828['query'][_0xe90a('0x32')]);_0x269f65[_0xe90a('0x33')]=qs['filters'](_[_0xe90a('0x34')](_0x30e828[_0xe90a('0x28')],_0x5cee9d[_0xe90a('0x2a')]),_0x37a349);if(_0x30e828['query'][_0xe90a('0x35')]){_0x269f65['where']=_[_0xe90a('0x36')](_0x269f65['where'],{'$or':_['map'](_0x37a349,function(_0x4d1a7d){if(_0x4d1a7d['type']!=='VIRTUAL'){var _0xd0db49={};_0xd0db49[_0x4d1a7d[_0xe90a('0x20')]]={'$like':'%'+_0x30e828[_0xe90a('0x28')][_0xe90a('0x35')]+'%'};return _0xd0db49;}})});}_0x269f65=_[_0xe90a('0x36')]({},_0x269f65,_0x30e828[_0xe90a('0x37')]);var _0x14827d={'where':_0x269f65[_0xe90a('0x33')]};return db[_0xe90a('0x23')][_0xe90a('0x15')](_0x14827d)[_0xe90a('0x1c')](function(_0x29e2cd){_0x422985['count']=_0x29e2cd;if(_0x30e828[_0xe90a('0x28')][_0xe90a('0x38')]){_0x269f65[_0xe90a('0x39')]=[{'all':!![]}];}return db[_0xe90a('0x23')][_0xe90a('0x3a')](_0x269f65);})['then'](function(_0x37acf2){_0x422985[_0xe90a('0x3b')]=_0x37acf2;return _0x422985;})['then'](respondWithFilteredResult(_0x4771a1,_0x269f65))[_0xe90a('0x3c')](handleError(_0x4771a1,null));};exports[_0xe90a('0x3d')]=function(_0x1dab83,_0x432da2){var _0x33e609={'raw':!![],'where':{'id':_0x1dab83[_0xe90a('0x3e')]['id']}},_0x4d820c={};_0x4d820c[_0xe90a('0x27')]=_['keys'](db[_0xe90a('0x23')][_0xe90a('0x3f')]);_0x4d820c['query']=_[_0xe90a('0x29')](_0x1dab83[_0xe90a('0x28')]);_0x4d820c[_0xe90a('0x2a')]=_[_0xe90a('0x2b')](_0x4d820c[_0xe90a('0x27')],_0x4d820c['query']);_0x33e609[_0xe90a('0x2c')]=_[_0xe90a('0x2b')](_0x4d820c['model'],qs[_0xe90a('0x2d')](_0x1dab83[_0xe90a('0x28')][_0xe90a('0x2d')]));_0x33e609['attributes']=_0x33e609[_0xe90a('0x2c')][_0xe90a('0x2e')]?_0x33e609[_0xe90a('0x2c')]:_0x4d820c[_0xe90a('0x27')];if(_0x1dab83['query'][_0xe90a('0x38')]){_0x33e609[_0xe90a('0x39')]=[{'all':!![]}];}_0x33e609=_[_0xe90a('0x36')]({},_0x33e609,_0x1dab83[_0xe90a('0x37')]);return db[_0xe90a('0x23')][_0xe90a('0x40')](_0x33e609)[_0xe90a('0x1c')](handleEntityNotFound(_0x432da2,null))[_0xe90a('0x1c')](respondWithResult(_0x432da2,null))[_0xe90a('0x3c')](handleError(_0x432da2,null));};exports[_0xe90a('0x41')]=function(_0x3a0262,_0x9bb879){return db[_0xe90a('0x23')][_0xe90a('0x41')](_0x3a0262[_0xe90a('0x42')],{})[_0xe90a('0x1c')](respondWithResult(_0x9bb879,0xc9))[_0xe90a('0x3c')](handleError(_0x9bb879,null));};exports['update']=function(_0x3e18fd,_0x3ba7f3){if(_0x3e18fd['body']['id']){delete _0x3e18fd[_0xe90a('0x42')]['id'];}return db['MailTransferReport'][_0xe90a('0x40')]({'where':{'id':_0x3e18fd[_0xe90a('0x3e')]['id']}})[_0xe90a('0x1c')](handleEntityNotFound(_0x3ba7f3,null))['then'](saveUpdates(_0x3e18fd[_0xe90a('0x42')],null))[_0xe90a('0x1c')](respondWithResult(_0x3ba7f3,null))[_0xe90a('0x3c')](handleError(_0x3ba7f3,null));};exports[_0xe90a('0x1d')]=function(_0x225114,_0x72c701){return db[_0xe90a('0x23')][_0xe90a('0x40')]({'where':{'id':_0x225114['params']['id']}})[_0xe90a('0x1c')](handleEntityNotFound(_0x72c701,null))[_0xe90a('0x1c')](removeEntity(_0x72c701,null))['catch'](handleError(_0x72c701,null));};exports[_0xe90a('0x43')]=function(_0x3fcca9,_0xd33ead){return db['MailTransferReport'][_0xe90a('0x43')]()[_0xe90a('0x1c')](respondWithResult(_0xd33ead,null))['catch'](handleError(_0xd33ead,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 8617a49..f0b910c 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 _0x2283=['path','rimraf','../../config/environment','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','moment','bluebird','request-promise'];(function(_0xed4bb8,_0x5e23f8){var _0x5077d9=function(_0x28acbd){while(--_0x28acbd){_0xed4bb8['push'](_0xed4bb8['shift']());}};_0x5077d9(++_0x5e23f8);}(_0x2283,0x167));var _0x3228=function(_0x4ec43d,_0x49c289){_0x4ec43d=_0x4ec43d-0x0;var _0x3b227f=_0x2283[_0x4ec43d];return _0x3b227f;};'use strict';var _=require(_0x3228('0x0'));var util=require(_0x3228('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3228('0x2'));var BPromise=require(_0x3228('0x3'));var rp=require(_0x3228('0x4'));var fs=require('fs');var path=require(_0x3228('0x5'));var rimraf=require(_0x3228('0x6'));var config=require(_0x3228('0x7'));var attributes=require('./mailTransferReport.attributes');module[_0x3228('0x8')]=function(_0x3653d4,_0x5c2d57){return _0x3653d4[_0x3228('0x9')](_0x3228('0xa'),attributes,{'tableName':_0x3228('0xb'),'paranoid':![],'indexes':[{'name':_0x3228('0xc'),'fields':[_0x3228('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1bf9=['request-promise','path','../../config/environment','./mailTransferReport.attributes','exports','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1781e3,_0x187097){var _0x33acb8=function(_0x5552e1){while(--_0x5552e1){_0x1781e3['push'](_0x1781e3['shift']());}};_0x33acb8(++_0x187097);}(_0x1bf9,0xbe));var _0x91bf=function(_0x3eb334,_0x25089e){_0x3eb334=_0x3eb334-0x0;var _0x2e290e=_0x1bf9[_0x3eb334];return _0x2e290e;};'use strict';var _=require(_0x91bf('0x0'));var util=require(_0x91bf('0x1'));var logger=require(_0x91bf('0x2'))(_0x91bf('0x3'));var moment=require(_0x91bf('0x4'));var BPromise=require(_0x91bf('0x5'));var rp=require(_0x91bf('0x6'));var fs=require('fs');var path=require(_0x91bf('0x7'));var rimraf=require('rimraf');var config=require(_0x91bf('0x8'));var attributes=require(_0x91bf('0x9'));module[_0x91bf('0xa')]=function(_0x58e043,_0x21574f){return _0x58e043['define'](_0x91bf('0xb'),attributes,{'tableName':_0x91bf('0xc'),'paranoid':![],'indexes':[{'name':_0x91bf('0xd'),'fields':[_0x91bf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 57085e8..da02949 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 _0x2a71=['request\x20sent','debug','stringify','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','MailTransferReport,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2a71,0x117));var _0x12a7=function(_0x197185,_0x251145){_0x197185=_0x197185-0x0;var _0x2c8af1=_0x2a71[_0x197185];return _0x2c8af1;};'use strict';var _=require(_0x12a7('0x0'));var util=require(_0x12a7('0x1'));var moment=require('moment');var BPromise=require(_0x12a7('0x2'));var rs=require(_0x12a7('0x3'));var fs=require('fs');var Redis=require(_0x12a7('0x4'));var db=require(_0x12a7('0x5'))['db'];var utils=require(_0x12a7('0x6'));var logger=require(_0x12a7('0x7'))('rpc');var config=require(_0x12a7('0x8'));var jayson=require(_0x12a7('0x9'));var client=jayson[_0x12a7('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e269d,_0x34ce12,_0x606fd3){return new BPromise(function(_0x20fd8d,_0x27b73d){return client[_0x12a7('0xb')](_0x2e269d,_0x606fd3)[_0x12a7('0xc')](function(_0x3721ff){logger[_0x12a7('0xd')](_0x12a7('0xe'),_0x34ce12,_0x12a7('0xf'));logger[_0x12a7('0x10')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x34ce12,_0x12a7('0xf'),JSON[_0x12a7('0x11')](_0x3721ff));if(_0x3721ff[_0x12a7('0x12')]){if(_0x3721ff[_0x12a7('0x12')]['code']===0x1f4){logger['error'](_0x12a7('0xe'),_0x34ce12,_0x3721ff[_0x12a7('0x12')]['message']);return _0x27b73d(_0x3721ff['error'][_0x12a7('0x13')]);}logger[_0x12a7('0x12')](_0x12a7('0xe'),_0x34ce12,_0x3721ff['error'][_0x12a7('0x13')]);return _0x20fd8d(_0x3721ff[_0x12a7('0x12')][_0x12a7('0x13')]);}else{logger['info'](_0x12a7('0xe'),_0x34ce12,_0x12a7('0xf'));_0x20fd8d(_0x3721ff[_0x12a7('0x14')][_0x12a7('0x13')]);}})['catch'](function(_0x1ca016){logger[_0x12a7('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x34ce12,_0x1ca016);_0x27b73d(_0x1ca016);});});} \ No newline at end of file +var _0xd8d5=['then','info','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0xd8d5,0x106));var _0x5d8d=function(_0x1c6b56,_0x245001){_0x1c6b56=_0x1c6b56-0x0;var _0xf4ac38=_0xd8d5[_0x1c6b56];return _0xf4ac38;};'use strict';var _=require(_0x5d8d('0x0'));var util=require(_0x5d8d('0x1'));var moment=require(_0x5d8d('0x2'));var BPromise=require(_0x5d8d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5d8d('0x4'))['db'];var utils=require(_0x5d8d('0x5'));var logger=require(_0x5d8d('0x6'))(_0x5d8d('0x7'));var config=require(_0x5d8d('0x8'));var jayson=require(_0x5d8d('0x9'));var client=jayson['client'][_0x5d8d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29e72d,_0x452bd5,_0x39662d){return new BPromise(function(_0x1f57b3,_0x102d34){return client['request'](_0x29e72d,_0x39662d)[_0x5d8d('0xb')](function(_0x26ece1){logger[_0x5d8d('0xc')](_0x5d8d('0xd'),_0x452bd5,'request\x20sent');logger[_0x5d8d('0xe')](_0x5d8d('0xf'),_0x452bd5,'request\x20sent',JSON[_0x5d8d('0x10')](_0x26ece1));if(_0x26ece1[_0x5d8d('0x11')]){if(_0x26ece1[_0x5d8d('0x11')][_0x5d8d('0x12')]===0x1f4){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x452bd5,_0x26ece1['error'][_0x5d8d('0x13')]);return _0x102d34(_0x26ece1['error'][_0x5d8d('0x13')]);}logger[_0x5d8d('0x11')](_0x5d8d('0xd'),_0x452bd5,_0x26ece1['error'][_0x5d8d('0x13')]);return _0x1f57b3(_0x26ece1[_0x5d8d('0x11')][_0x5d8d('0x13')]);}else{logger[_0x5d8d('0xc')](_0x5d8d('0xd'),_0x452bd5,_0x5d8d('0x14'));_0x1f57b3(_0x26ece1['result']['message']);}})['catch'](function(_0xa64547){logger[_0x5d8d('0x11')](_0x5d8d('0xd'),_0x452bd5,_0xa64547);_0x102d34(_0xa64547);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 81add89..315bce7 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 _0x7231=['put','delete','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id','show','create'];(function(_0x2a9f4,_0x25c14a){var _0x3c39e0=function(_0x3b8deb){while(--_0x3b8deb){_0x2a9f4['push'](_0x2a9f4['shift']());}};_0x3c39e0(++_0x25c14a);}(_0x7231,0xd2));var _0x1723=function(_0x1c63fd,_0x5c08df){_0x1c63fd=_0x1c63fd-0x0;var _0x4284a6=_0x7231[_0x1c63fd];return _0x4284a6;};'use strict';var multer=require('multer');var util=require(_0x1723('0x0'));var path=require(_0x1723('0x1'));var timeout=require(_0x1723('0x2'));var express=require(_0x1723('0x3'));var router=express['Router']();var auth=require(_0x1723('0x4'));var interaction=require(_0x1723('0x5'));var config=require('../../config/environment');var controller=require('./memberReport.controller');router['get']('/',auth[_0x1723('0x6')](),controller[_0x1723('0x7')]);router[_0x1723('0x8')](_0x1723('0x9'),auth[_0x1723('0x6')](),controller[_0x1723('0xa')]);router[_0x1723('0x8')](_0x1723('0xb'),auth['isAuthenticated'](),controller[_0x1723('0xc')]);router['post']('/',auth[_0x1723('0x6')](),controller[_0x1723('0xd')]);router[_0x1723('0xe')](_0x1723('0xb'),auth[_0x1723('0x6')](),controller['update']);router[_0x1723('0xf')]('/:id',auth[_0x1723('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe526=['express','../../config/environment','./memberReport.controller','get','/describe','isAuthenticated','describe','/:id','put','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0xe526,0x14d));var _0x6e52=function(_0x4e7023,_0x57eecf){_0x4e7023=_0x4e7023-0x0;var _0x26e12a=_0xe526[_0x4e7023];return _0x26e12a;};'use strict';var multer=require(_0x6e52('0x0'));var util=require(_0x6e52('0x1'));var path=require('path');var timeout=require(_0x6e52('0x2'));var express=require(_0x6e52('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6e52('0x4'));var controller=require(_0x6e52('0x5'));router[_0x6e52('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x6e52('0x7'),auth[_0x6e52('0x8')](),controller[_0x6e52('0x9')]);router['get'](_0x6e52('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x6e52('0x8')](),controller['create']);router[_0x6e52('0xb')](_0x6e52('0xa'),auth[_0x6e52('0x8')](),controller[_0x6e52('0xc')]);router[_0x6e52('0xd')]('/:id',auth[_0x6e52('0x8')](),controller[_0x6e52('0xe')]);module[_0x6e52('0xf')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 31550c7..f1cdce2 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 _0xa994=['STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','enterAt','diff','setDataValue','exitAt','duration','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','exports'];(function(_0x23f516,_0xba7b91){var _0x1f983c=function(_0x5d2497){while(--_0x5d2497){_0x23f516['push'](_0x23f516['shift']());}};_0x1f983c(++_0xba7b91);}(_0xa994,0x176));var _0x4a99=function(_0x102fcf,_0x41bf3e){_0x102fcf=_0x102fcf-0x0;var _0x248f24=_0xa994[_0x102fcf];return _0x248f24;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x4a99('0x0')]={'channel':{'type':Sequelize[_0x4a99('0x1')]},'membername':{'type':Sequelize[_0x4a99('0x1')]},'interface':{'type':Sequelize[_0x4a99('0x1')]},'type':{'type':Sequelize[_0x4a99('0x1')],'defaultValue':_0x4a99('0x2'),'comment':_0x4a99('0x3')},'duration':{'type':Sequelize[_0x4a99('0x4')]},'enterAt':{'type':Sequelize[_0x4a99('0x5')]},'exitAt':{'type':Sequelize[_0x4a99('0x5')],'set':function(_0x4bc47b){var _0x2d2401=moment(_0x4bc47b);var _0x3b46b7=moment(this['getDataValue'](_0x4a99('0x6')));var _0x2356c2=_0x2d2401[_0x4a99('0x7')](_0x3b46b7,'seconds');this[_0x4a99('0x8')](_0x4a99('0x9'),_0x4bc47b);this[_0x4a99('0x8')](_0x4a99('0xa'),_0x2356c2||null);}},'data1':{'type':Sequelize[_0x4a99('0x1')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x4a99('0x1')],'comment':_0x4a99('0xb')},'data3':{'type':Sequelize[_0x4a99('0x1')],'comment':_0x4a99('0xc')},'data4':{'type':Sequelize[_0x4a99('0x1')],'comment':_0x4a99('0xd')},'data5':{'type':Sequelize[_0x4a99('0x1')],'comment':_0x4a99('0xe')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfb22=['exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','seconds','setDataValue'];(function(_0xd7b919,_0x512516){var _0x412f45=function(_0x3847a8){while(--_0x3847a8){_0xd7b919['push'](_0xd7b919['shift']());}};_0x412f45(++_0x512516);}(_0xfb22,0x65));var _0x2fb2=function(_0x3486b0,_0x248021){_0x3486b0=_0x3486b0-0x0;var _0x2c8a3f=_0xfb22[_0x3486b0];return _0x2c8a3f;};'use strict';var Sequelize=require(_0x2fb2('0x0'));var moment=require(_0x2fb2('0x1'));module[_0x2fb2('0x2')]={'channel':{'type':Sequelize[_0x2fb2('0x3')]},'membername':{'type':Sequelize[_0x2fb2('0x3')]},'interface':{'type':Sequelize[_0x2fb2('0x3')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0x2fb2('0x4'),'comment':_0x2fb2('0x5')},'duration':{'type':Sequelize[_0x2fb2('0x6')]},'enterAt':{'type':Sequelize[_0x2fb2('0x7')]},'exitAt':{'type':Sequelize[_0x2fb2('0x7')],'set':function(_0x51af0b){var _0x33c59d=moment(_0x51af0b);var _0x20caae=moment(this[_0x2fb2('0x8')]('enterAt'));var _0x596b52=_0x33c59d['diff'](_0x20caae,_0x2fb2('0x9'));this[_0x2fb2('0xa')](_0x2fb2('0xb'),_0x51af0b);this['setDataValue'](_0x2fb2('0xc'),_0x596b52||null);}},'data1':{'type':Sequelize[_0x2fb2('0x3')],'comment':_0x2fb2('0xd')},'data2':{'type':Sequelize[_0x2fb2('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x2fb2('0x3')],'comment':_0x2fb2('0xe')},'data4':{'type':Sequelize[_0x2fb2('0x3')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x2fb2('0x3')],'comment':_0x2fb2('0xf')},'role':{'type':Sequelize[_0x2fb2('0x3')]},'internal':{'type':Sequelize[_0x2fb2('0x6')]},'uniqueid':{'type':Sequelize[_0x2fb2('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index df391f9..d73178b 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 _0xf015=['api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','map','MemberReport','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','params','include','find','catch','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger'];(function(_0x107995,_0x42fb77){var _0xa09073=function(_0x581ba7){while(--_0x581ba7){_0x107995['push'](_0x107995['shift']());}};_0xa09073(++_0x42fb77);}(_0xf015,0xc2));var _0x5f01=function(_0x1823e9,_0x2d7b01){_0x1823e9=_0x1823e9-0x0;var _0x29808f=_0xf015[_0x1823e9];return _0x29808f;};'use strict';var pdf=require(_0x5f01('0x0'));var emlformat=require(_0x5f01('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5f01('0x2'));var jsonpatch=require(_0x5f01('0x3'));var rp=require(_0x5f01('0x4'));var moment=require(_0x5f01('0x5'));var BPromise=require(_0x5f01('0x6'));var Mustache=require(_0x5f01('0x7'));var util=require(_0x5f01('0x8'));var path=require(_0x5f01('0x9'));var sox=require(_0x5f01('0xa'));var csv=require('to-csv');var ejs=require(_0x5f01('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5f01('0xc'));var jsforce=require(_0x5f01('0xd'));var deskjs=require(_0x5f01('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5f01('0xf'));var Redis=require('ioredis');var authService=require(_0x5f01('0x10'));var qs=require(_0x5f01('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5f01('0x12'))(_0x5f01('0x13'));var utils=require('../../config/utils');var config=require(_0x5f01('0x14'));var db=require(_0x5f01('0x15'))['db'];function respondWithStatusCode(_0x5f2b92,_0x4de2ce){_0x4de2ce=_0x4de2ce||0xcc;return function(_0xcdc919){if(_0xcdc919){return _0x5f2b92[_0x5f01('0x16')](_0x4de2ce);}return _0x5f2b92[_0x5f01('0x17')](_0x4de2ce)['end']();};}function respondWithResult(_0x2b77f6,_0x4498b6){_0x4498b6=_0x4498b6||0xc8;return function(_0x4d13f0){if(_0x4d13f0){return _0x2b77f6[_0x5f01('0x17')](_0x4498b6)[_0x5f01('0x18')](_0x4d13f0);}};}function respondWithFilteredResult(_0x2664cf,_0x1f0bd1){return function(_0x100a71){if(_0x100a71){var _0x16f8ea=_0x100a71['count'],_0x1bba2b=_0x1f0bd1[_0x5f01('0x19')],_0x2be2b5=_0x1f0bd1[_0x5f01('0x19')]+_0x1f0bd1['limit'],_0x568523;if(_0x2be2b5>=_0x16f8ea){_0x2be2b5=_0x16f8ea;_0x568523=0xc8;}else{_0x568523=0xce;}_0x2664cf[_0x5f01('0x17')](_0x568523);return _0x2664cf[_0x5f01('0x1a')](_0x5f01('0x1b'),_0x1bba2b+'-'+_0x2be2b5+'/'+_0x16f8ea)['json'](_0x100a71);}return null;};}function patchUpdates(_0x27069f){return function(_0x1d8040){try{jsonpatch[_0x5f01('0x1c')](_0x1d8040,_0x27069f,!![]);}catch(_0x4daadf){return BPromise[_0x5f01('0x1d')](_0x4daadf);}return _0x1d8040[_0x5f01('0x1e')]();};}function saveUpdates(_0x1bfd4c,_0x5ae548){return function(_0x1d437b){if(_0x1d437b){return _0x1d437b[_0x5f01('0x1f')](_0x1bfd4c)['then'](function(_0x243f75){return _0x243f75;});}return null;};}function removeEntity(_0x35cd02,_0x5c8cc6){return function(_0xbd9e82){if(_0xbd9e82){return _0xbd9e82[_0x5f01('0x20')]()[_0x5f01('0x21')](function(){_0x35cd02[_0x5f01('0x17')](0xcc)[_0x5f01('0x22')]();});}};}function handleEntityNotFound(_0x37a817,_0x268ce8){return function(_0x15af9b){if(!_0x15af9b){_0x37a817[_0x5f01('0x16')](0x194);}return _0x15af9b;};}function handleError(_0x59193f,_0x2cc737){_0x2cc737=_0x2cc737||0x1f4;return function(_0x32874a){logger[_0x5f01('0x23')](_0x32874a[_0x5f01('0x24')]);if(_0x32874a[_0x5f01('0x25')]){delete _0x32874a['name'];}_0x59193f[_0x5f01('0x17')](_0x2cc737)[_0x5f01('0x26')](_0x32874a);};}exports[_0x5f01('0x27')]=function(_0x52b76d,_0x482ea3){var _0x1c2074={},_0x11bc29={},_0x42287f={'count':0x0,'rows':[]};var _0x5ec8ee=_[_0x5f01('0x28')](db[_0x5f01('0x29')]['rawAttributes'],function(_0x3ca33b){return{'name':_0x3ca33b['fieldName'],'type':_0x3ca33b['type'][_0x5f01('0x2a')]};});_0x11bc29[_0x5f01('0x2b')]=_[_0x5f01('0x28')](_0x5ec8ee,_0x5f01('0x25'));_0x11bc29[_0x5f01('0x2c')]=_[_0x5f01('0x2d')](_0x52b76d[_0x5f01('0x2c')]);_0x11bc29['filters']=_[_0x5f01('0x2e')](_0x11bc29[_0x5f01('0x2b')],_0x11bc29['query']);_0x1c2074[_0x5f01('0x2f')]=_[_0x5f01('0x2e')](_0x11bc29[_0x5f01('0x2b')],qs[_0x5f01('0x30')](_0x52b76d[_0x5f01('0x2c')]['fields']));_0x1c2074['attributes']=_0x1c2074[_0x5f01('0x2f')][_0x5f01('0x31')]?_0x1c2074['attributes']:_0x11bc29['model'];if(!_0x52b76d['query'][_0x5f01('0x32')](_0x5f01('0x33'))){_0x1c2074[_0x5f01('0x34')]=qs[_0x5f01('0x34')](_0x52b76d[_0x5f01('0x2c')][_0x5f01('0x34')]);_0x1c2074[_0x5f01('0x19')]=qs['offset'](_0x52b76d[_0x5f01('0x2c')][_0x5f01('0x19')]);}_0x1c2074['order']=qs['sort'](_0x52b76d[_0x5f01('0x2c')][_0x5f01('0x35')]);_0x1c2074[_0x5f01('0x36')]=qs[_0x5f01('0x37')](_['pick'](_0x52b76d['query'],_0x11bc29['filters']),_0x5ec8ee);if(_0x52b76d[_0x5f01('0x2c')][_0x5f01('0x38')]){_0x1c2074[_0x5f01('0x36')]=_[_0x5f01('0x39')](_0x1c2074['where'],{'$or':_[_0x5f01('0x28')](_0x5ec8ee,function(_0x380b20){if(_0x380b20[_0x5f01('0x3a')]!==_0x5f01('0x3b')){var _0x4bebcf={};_0x4bebcf[_0x380b20[_0x5f01('0x25')]]={'$like':'%'+_0x52b76d['query'][_0x5f01('0x38')]+'%'};return _0x4bebcf;}})});}_0x1c2074=_[_0x5f01('0x39')]({},_0x1c2074,_0x52b76d[_0x5f01('0x3c')]);var _0x1e7144={'where':_0x1c2074[_0x5f01('0x36')]};return db[_0x5f01('0x29')]['count'](_0x1e7144)[_0x5f01('0x21')](function(_0x59428e){_0x42287f['count']=_0x59428e;if(_0x52b76d[_0x5f01('0x2c')][_0x5f01('0x3d')]){_0x1c2074['include']=[{'all':!![]}];}return db[_0x5f01('0x29')][_0x5f01('0x3e')](_0x1c2074);})['then'](function(_0x289831){_0x42287f[_0x5f01('0x3f')]=_0x289831;return _0x42287f;})[_0x5f01('0x21')](respondWithFilteredResult(_0x482ea3,_0x1c2074))['catch'](handleError(_0x482ea3,null));};exports['show']=function(_0x41e418,_0x2de445){var _0x5b0b05={'raw':!![],'where':{'id':_0x41e418[_0x5f01('0x40')]['id']}},_0x3e3bf4={};_0x3e3bf4[_0x5f01('0x2b')]=_[_0x5f01('0x2d')](db[_0x5f01('0x29')]['rawAttributes']);_0x3e3bf4[_0x5f01('0x2c')]=_[_0x5f01('0x2d')](_0x41e418['query']);_0x3e3bf4['filters']=_[_0x5f01('0x2e')](_0x3e3bf4[_0x5f01('0x2b')],_0x3e3bf4['query']);_0x5b0b05[_0x5f01('0x2f')]=_['intersection'](_0x3e3bf4['model'],qs['fields'](_0x41e418['query'][_0x5f01('0x30')]));_0x5b0b05[_0x5f01('0x2f')]=_0x5b0b05[_0x5f01('0x2f')][_0x5f01('0x31')]?_0x5b0b05[_0x5f01('0x2f')]:_0x3e3bf4['model'];if(_0x41e418[_0x5f01('0x2c')]['includeAll']){_0x5b0b05[_0x5f01('0x41')]=[{'all':!![]}];}_0x5b0b05=_[_0x5f01('0x39')]({},_0x5b0b05,_0x41e418[_0x5f01('0x3c')]);return db[_0x5f01('0x29')][_0x5f01('0x42')](_0x5b0b05)[_0x5f01('0x21')](handleEntityNotFound(_0x2de445,null))[_0x5f01('0x21')](respondWithResult(_0x2de445,null))[_0x5f01('0x43')](handleError(_0x2de445,null));};exports[_0x5f01('0x44')]=function(_0x56c60c,_0x254919){return db['MemberReport'][_0x5f01('0x44')](_0x56c60c['body'],{})[_0x5f01('0x21')](respondWithResult(_0x254919,0xc9))['catch'](handleError(_0x254919,null));};exports[_0x5f01('0x1f')]=function(_0x546abc,_0xbb1da){if(_0x546abc[_0x5f01('0x45')]['id']){delete _0x546abc['body']['id'];}return db[_0x5f01('0x29')][_0x5f01('0x42')]({'where':{'id':_0x546abc['params']['id']}})[_0x5f01('0x21')](handleEntityNotFound(_0xbb1da,null))[_0x5f01('0x21')](saveUpdates(_0x546abc['body'],null))[_0x5f01('0x21')](respondWithResult(_0xbb1da,null))['catch'](handleError(_0xbb1da,null));};exports[_0x5f01('0x20')]=function(_0x580856,_0x68b9df){return db[_0x5f01('0x29')]['find']({'where':{'id':_0x580856[_0x5f01('0x40')]['id']}})['then'](handleEntityNotFound(_0x68b9df,null))['then'](removeEntity(_0x68b9df,null))[_0x5f01('0x43')](handleError(_0x68b9df,null));};exports[_0x5f01('0x46')]=function(_0x137899,_0x1f65e8){return db['MemberReport'][_0x5f01('0x46')]()[_0x5f01('0x21')](respondWithResult(_0x1f65e8,null))[_0x5f01('0x43')](handleError(_0x1f65e8,null));}; \ No newline at end of file +var _0x20f1=['save','update','destroy','then','error','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','catch','params','length','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject'];(function(_0xf68fcc,_0x131635){var _0x9633dc=function(_0x3ca814){while(--_0x3ca814){_0xf68fcc['push'](_0xf68fcc['shift']());}};_0x9633dc(++_0x131635);}(_0x20f1,0xb6));var _0x120f=function(_0x40f04d,_0x26bfb3){_0x40f04d=_0x40f04d-0x0;var _0x4063bc=_0x20f1[_0x40f04d];return _0x4063bc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x120f('0x0'));var rimraf=require(_0x120f('0x1'));var zipdir=require(_0x120f('0x2'));var jsonpatch=require(_0x120f('0x3'));var rp=require(_0x120f('0x4'));var moment=require(_0x120f('0x5'));var BPromise=require(_0x120f('0x6'));var Mustache=require(_0x120f('0x7'));var util=require(_0x120f('0x8'));var path=require(_0x120f('0x9'));var sox=require(_0x120f('0xa'));var csv=require('to-csv');var ejs=require(_0x120f('0xb'));var fs=require('fs');var _=require(_0x120f('0xc'));var squel=require('squel');var crypto=require(_0x120f('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x120f('0xe'));var querystring=require(_0x120f('0xf'));var Papa=require(_0x120f('0x10'));var Redis=require(_0x120f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x120f('0x12'));var as=require(_0x120f('0x13'));var hardwareService=require(_0x120f('0x14'));var logger=require(_0x120f('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x120f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x593bcf,_0x5cf896){_0x5cf896=_0x5cf896||0xcc;return function(_0x277118){if(_0x277118){return _0x593bcf[_0x120f('0x17')](_0x5cf896);}return _0x593bcf[_0x120f('0x18')](_0x5cf896)[_0x120f('0x19')]();};}function respondWithResult(_0x25c2c3,_0x33609e){_0x33609e=_0x33609e||0xc8;return function(_0x5654b2){if(_0x5654b2){return _0x25c2c3['status'](_0x33609e)['json'](_0x5654b2);}};}function respondWithFilteredResult(_0x3c52f8,_0x3318a7){return function(_0x5e9c21){if(_0x5e9c21){var _0x183fbc=_0x5e9c21[_0x120f('0x1a')],_0x4b70a2=_0x3318a7['offset'],_0x4c1f55=_0x3318a7[_0x120f('0x1b')]+_0x3318a7[_0x120f('0x1c')],_0xa00fea;if(_0x4c1f55>=_0x183fbc){_0x4c1f55=_0x183fbc;_0xa00fea=0xc8;}else{_0xa00fea=0xce;}_0x3c52f8[_0x120f('0x18')](_0xa00fea);return _0x3c52f8[_0x120f('0x1d')](_0x120f('0x1e'),_0x4b70a2+'-'+_0x4c1f55+'/'+_0x183fbc)[_0x120f('0x1f')](_0x5e9c21);}return null;};}function patchUpdates(_0x29a374){return function(_0x31a2e8){try{jsonpatch[_0x120f('0x20')](_0x31a2e8,_0x29a374,!![]);}catch(_0x421f5d){return BPromise[_0x120f('0x21')](_0x421f5d);}return _0x31a2e8[_0x120f('0x22')]();};}function saveUpdates(_0x37c02d,_0x467a5a){return function(_0x2b9e46){if(_0x2b9e46){return _0x2b9e46[_0x120f('0x23')](_0x37c02d)['then'](function(_0x51c966){return _0x51c966;});}return null;};}function removeEntity(_0x4c9ba8,_0x4228d2){return function(_0x2f3fc7){if(_0x2f3fc7){return _0x2f3fc7[_0x120f('0x24')]()[_0x120f('0x25')](function(){_0x4c9ba8[_0x120f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xba1999,_0x157f87){return function(_0x4e9d1d){if(!_0x4e9d1d){_0xba1999[_0x120f('0x17')](0x194);}return _0x4e9d1d;};}function handleError(_0x43e57d,_0x5cc14c){_0x5cc14c=_0x5cc14c||0x1f4;return function(_0x273b89){logger[_0x120f('0x26')](_0x273b89[_0x120f('0x27')]);if(_0x273b89[_0x120f('0x28')]){delete _0x273b89[_0x120f('0x28')];}_0x43e57d['status'](_0x5cc14c)[_0x120f('0x29')](_0x273b89);};}exports[_0x120f('0x2a')]=function(_0x34d1c4,_0x215e5a){var _0x679b7d={},_0x45e7cd={},_0xfe62e2={'count':0x0,'rows':[]};var _0xd213c4=_[_0x120f('0x2b')](db[_0x120f('0x2c')][_0x120f('0x2d')],function(_0x1a4127){return{'name':_0x1a4127[_0x120f('0x2e')],'type':_0x1a4127[_0x120f('0x2f')][_0x120f('0x30')]};});_0x45e7cd[_0x120f('0x31')]=_[_0x120f('0x2b')](_0xd213c4,_0x120f('0x28'));_0x45e7cd[_0x120f('0x32')]=_['keys'](_0x34d1c4[_0x120f('0x32')]);_0x45e7cd['filters']=_['intersection'](_0x45e7cd[_0x120f('0x31')],_0x45e7cd[_0x120f('0x32')]);_0x679b7d[_0x120f('0x33')]=_[_0x120f('0x34')](_0x45e7cd[_0x120f('0x31')],qs['fields'](_0x34d1c4[_0x120f('0x32')][_0x120f('0x35')]));_0x679b7d[_0x120f('0x33')]=_0x679b7d[_0x120f('0x33')]['length']?_0x679b7d['attributes']:_0x45e7cd[_0x120f('0x31')];if(!_0x34d1c4[_0x120f('0x32')]['hasOwnProperty'](_0x120f('0x36'))){_0x679b7d[_0x120f('0x1c')]=qs[_0x120f('0x1c')](_0x34d1c4[_0x120f('0x32')][_0x120f('0x1c')]);_0x679b7d[_0x120f('0x1b')]=qs[_0x120f('0x1b')](_0x34d1c4[_0x120f('0x32')][_0x120f('0x1b')]);}_0x679b7d[_0x120f('0x37')]=qs[_0x120f('0x38')](_0x34d1c4['query'][_0x120f('0x38')]);_0x679b7d[_0x120f('0x39')]=qs[_0x120f('0x3a')](_[_0x120f('0x3b')](_0x34d1c4[_0x120f('0x32')],_0x45e7cd[_0x120f('0x3a')]),_0xd213c4);if(_0x34d1c4[_0x120f('0x32')][_0x120f('0x3c')]){_0x679b7d[_0x120f('0x39')]=_[_0x120f('0x3d')](_0x679b7d[_0x120f('0x39')],{'$or':_[_0x120f('0x2b')](_0xd213c4,function(_0xc59e8f){if(_0xc59e8f[_0x120f('0x2f')]!==_0x120f('0x3e')){var _0x214729={};_0x214729[_0xc59e8f['name']]={'$like':'%'+_0x34d1c4['query']['filter']+'%'};return _0x214729;}})});}_0x679b7d=_['merge']({},_0x679b7d,_0x34d1c4['options']);var _0x4e4d2d={'where':_0x679b7d[_0x120f('0x39')]};return db[_0x120f('0x2c')][_0x120f('0x1a')](_0x4e4d2d)[_0x120f('0x25')](function(_0xf3e7e8){_0xfe62e2[_0x120f('0x1a')]=_0xf3e7e8;if(_0x34d1c4['query'][_0x120f('0x3f')]){_0x679b7d['include']=[{'all':!![]}];}return db[_0x120f('0x2c')]['findAll'](_0x679b7d);})[_0x120f('0x25')](function(_0x6cb0fa){_0xfe62e2['rows']=_0x6cb0fa;return _0xfe62e2;})[_0x120f('0x25')](respondWithFilteredResult(_0x215e5a,_0x679b7d))[_0x120f('0x40')](handleError(_0x215e5a,null));};exports['show']=function(_0xc471aa,_0x32e807){var _0x5da4ee={'raw':!![],'where':{'id':_0xc471aa[_0x120f('0x41')]['id']}},_0x5aed01={};_0x5aed01['model']=_['keys'](db[_0x120f('0x2c')]['rawAttributes']);_0x5aed01[_0x120f('0x32')]=_['keys'](_0xc471aa[_0x120f('0x32')]);_0x5aed01['filters']=_[_0x120f('0x34')](_0x5aed01[_0x120f('0x31')],_0x5aed01['query']);_0x5da4ee[_0x120f('0x33')]=_[_0x120f('0x34')](_0x5aed01['model'],qs[_0x120f('0x35')](_0xc471aa[_0x120f('0x32')][_0x120f('0x35')]));_0x5da4ee['attributes']=_0x5da4ee['attributes'][_0x120f('0x42')]?_0x5da4ee[_0x120f('0x33')]:_0x5aed01[_0x120f('0x31')];if(_0xc471aa[_0x120f('0x32')][_0x120f('0x3f')]){_0x5da4ee[_0x120f('0x43')]=[{'all':!![]}];}_0x5da4ee=_[_0x120f('0x3d')]({},_0x5da4ee,_0xc471aa['options']);return db['MemberReport'][_0x120f('0x44')](_0x5da4ee)[_0x120f('0x25')](handleEntityNotFound(_0x32e807,null))[_0x120f('0x25')](respondWithResult(_0x32e807,null))[_0x120f('0x40')](handleError(_0x32e807,null));};exports[_0x120f('0x45')]=function(_0x13c63e,_0x57e4fb){return db[_0x120f('0x2c')][_0x120f('0x45')](_0x13c63e[_0x120f('0x46')],{})[_0x120f('0x25')](respondWithResult(_0x57e4fb,0xc9))[_0x120f('0x40')](handleError(_0x57e4fb,null));};exports[_0x120f('0x23')]=function(_0x5343f8,_0x58afe5){if(_0x5343f8[_0x120f('0x46')]['id']){delete _0x5343f8[_0x120f('0x46')]['id'];}return db['MemberReport'][_0x120f('0x44')]({'where':{'id':_0x5343f8[_0x120f('0x41')]['id']}})[_0x120f('0x25')](handleEntityNotFound(_0x58afe5,null))[_0x120f('0x25')](saveUpdates(_0x5343f8[_0x120f('0x46')],null))[_0x120f('0x25')](respondWithResult(_0x58afe5,null))[_0x120f('0x40')](handleError(_0x58afe5,null));};exports[_0x120f('0x24')]=function(_0x4eb117,_0x196061){return db[_0x120f('0x2c')][_0x120f('0x44')]({'where':{'id':_0x4eb117['params']['id']}})['then'](handleEntityNotFound(_0x196061,null))['then'](removeEntity(_0x196061,null))[_0x120f('0x40')](handleError(_0x196061,null));};exports[_0x120f('0x47')]=function(_0xcd3972,_0x42b0da){return db[_0x120f('0x2c')][_0x120f('0x47')]()[_0x120f('0x25')](respondWithResult(_0x42b0da,null))[_0x120f('0x40')](handleError(_0x42b0da,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 96c7ddc..07768d4 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 _0xa76b=['define','MemberReport','membername_interface','membername','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./memberReport.attributes','exports'];(function(_0x19ba39,_0x2e167d){var _0x981253=function(_0x3848cf){while(--_0x3848cf){_0x19ba39['push'](_0x19ba39['shift']());}};_0x981253(++_0x2e167d);}(_0xa76b,0x9e));var _0xba76=function(_0x4e8cb1,_0x46fb83){_0x4e8cb1=_0x4e8cb1-0x0;var _0x50d8a2=_0xa76b[_0x4e8cb1];return _0x50d8a2;};'use strict';var _=require(_0xba76('0x0'));var util=require(_0xba76('0x1'));var logger=require(_0xba76('0x2'))(_0xba76('0x3'));var moment=require(_0xba76('0x4'));var BPromise=require(_0xba76('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xba76('0x6'));var rimraf=require(_0xba76('0x7'));var config=require('../../config/environment');var attributes=require(_0xba76('0x8'));module[_0xba76('0x9')]=function(_0x49b666,_0x454866){return _0x49b666[_0xba76('0xa')](_0xba76('0xb'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0xba76('0xc'),'fields':[_0xba76('0xd'),'interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2dd2=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface','membername','interface'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x2dd2,0x90));var _0x22dd=function(_0x2da12b,_0x3ab779){_0x2da12b=_0x2da12b-0x0;var _0xf2e418=_0x2dd2[_0x2da12b];return _0xf2e418;};'use strict';var _=require(_0x22dd('0x0'));var util=require(_0x22dd('0x1'));var logger=require(_0x22dd('0x2'))(_0x22dd('0x3'));var moment=require(_0x22dd('0x4'));var BPromise=require(_0x22dd('0x5'));var rp=require(_0x22dd('0x6'));var fs=require('fs');var path=require(_0x22dd('0x7'));var rimraf=require(_0x22dd('0x8'));var config=require(_0x22dd('0x9'));var attributes=require(_0x22dd('0xa'));module[_0x22dd('0xb')]=function(_0x3e270e,_0x693683){return _0x3e270e[_0x22dd('0xc')](_0x22dd('0xd'),attributes,{'tableName':_0x22dd('0xe'),'paranoid':![],'indexes':[{'name':_0x22dd('0xf'),'fields':[_0x22dd('0x10'),_0x22dd('0x11')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index bc6c4d8..3d53f87 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 _0xc686=['MemberReport','findAll','options','raw','where','attributes','limit','include','map','model','then','CreateMemberReport','create','UpdateMemberReport','update','body','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMemberReport'];(function(_0x351ba6,_0x399ec7){var _0x38cd38=function(_0x461e15){while(--_0x461e15){_0x351ba6['push'](_0x351ba6['shift']());}};_0x38cd38(++_0x399ec7);}(_0xc686,0x1cc));var _0x6c68=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xc686[_0x411add];return _0x238242;};'use strict';var _=require('lodash');var util=require(_0x6c68('0x0'));var moment=require('moment');var BPromise=require(_0x6c68('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6c68('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x6c68('0x3'));var logger=require(_0x6c68('0x4'))(_0x6c68('0x5'));var config=require('../../config/environment');var jayson=require(_0x6c68('0x6'));var client=jayson[_0x6c68('0x7')][_0x6c68('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12df08,_0x357c08,_0xc77c1d){return new BPromise(function(_0x344a6a,_0x4a398e){return client[_0x6c68('0x9')](_0x12df08,_0xc77c1d)['then'](function(_0x32d8b9){logger[_0x6c68('0xa')](_0x6c68('0xb'),_0x357c08,_0x6c68('0xc'));logger[_0x6c68('0xd')](_0x6c68('0xe'),_0x357c08,_0x6c68('0xc'),JSON[_0x6c68('0xf')](_0x32d8b9));if(_0x32d8b9['error']){if(_0x32d8b9[_0x6c68('0x10')]['code']===0x1f4){logger[_0x6c68('0x10')](_0x6c68('0xb'),_0x357c08,_0x32d8b9[_0x6c68('0x10')][_0x6c68('0x11')]);return _0x4a398e(_0x32d8b9[_0x6c68('0x10')][_0x6c68('0x11')]);}logger[_0x6c68('0x10')](_0x6c68('0xb'),_0x357c08,_0x32d8b9['error'][_0x6c68('0x11')]);return _0x344a6a(_0x32d8b9[_0x6c68('0x10')]['message']);}else{logger[_0x6c68('0xa')]('MemberReport,\x20%s,\x20%s',_0x357c08,'request\x20sent');_0x344a6a(_0x32d8b9[_0x6c68('0x12')]['message']);}})[_0x6c68('0x13')](function(_0x12d24e){logger[_0x6c68('0x10')](_0x6c68('0xb'),_0x357c08,_0x12d24e);_0x4a398e(_0x12d24e);});});}exports[_0x6c68('0x14')]=function(_0x242643){var _0x569342=this;return new Promise(function(_0x17035b,_0x212625){return db[_0x6c68('0x15')][_0x6c68('0x16')]({'raw':_0x242643[_0x6c68('0x17')]?_0x242643['options'][_0x6c68('0x18')]===undefined?!![]:![]:!![],'where':_0x242643[_0x6c68('0x17')]?_0x242643[_0x6c68('0x17')][_0x6c68('0x19')]||null:null,'attributes':_0x242643['options']?_0x242643[_0x6c68('0x17')][_0x6c68('0x1a')]||null:null,'limit':_0x242643[_0x6c68('0x17')]?_0x242643['options'][_0x6c68('0x1b')]||null:null,'include':_0x242643[_0x6c68('0x17')]?_0x242643[_0x6c68('0x17')][_0x6c68('0x1c')]?_[_0x6c68('0x1d')](_0x242643[_0x6c68('0x17')]['include'],function(_0x10587b){return{'model':db[_0x10587b[_0x6c68('0x1e')]],'as':_0x10587b['as'],'attributes':_0x10587b[_0x6c68('0x1a')],'include':_0x10587b[_0x6c68('0x1c')]?_['map'](_0x10587b[_0x6c68('0x1c')],function(_0x1c736c){return{'model':db[_0x1c736c['model']],'as':_0x1c736c['as'],'attributes':_0x1c736c[_0x6c68('0x1a')],'include':_0x1c736c[_0x6c68('0x1c')]?_[_0x6c68('0x1d')](_0x1c736c[_0x6c68('0x1c')],function(_0x665ee4){return{'model':db[_0x665ee4[_0x6c68('0x1e')]],'as':_0x665ee4['as'],'attributes':_0x665ee4[_0x6c68('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6c68('0x1f')](function(_0x43fd23){logger[_0x6c68('0xa')](_0x6c68('0x14'),_0x242643);logger['debug']('GetMemberReport',_0x242643,JSON[_0x6c68('0xf')](_0x43fd23));_0x17035b(_0x43fd23);})['catch'](function(_0x40ae9d){logger['error'](_0x6c68('0x14'),_0x40ae9d[_0x6c68('0x11')],_0x242643);_0x212625(_0x569342[_0x6c68('0x10')](0x1f4,_0x40ae9d[_0x6c68('0x11')]));});});};exports[_0x6c68('0x20')]=function(_0x4d690c){var _0x3636e4=this;return new Promise(function(_0x306f68,_0x4ef4cd){return db[_0x6c68('0x15')][_0x6c68('0x21')](_0x4d690c['body'],{'raw':_0x4d690c[_0x6c68('0x17')]?_0x4d690c[_0x6c68('0x17')][_0x6c68('0x18')]===undefined?!![]:![]:!![]})[_0x6c68('0x1f')](function(_0x456579){logger[_0x6c68('0xa')](_0x6c68('0x20'),_0x4d690c);logger[_0x6c68('0xd')](_0x6c68('0x20'),_0x4d690c,JSON[_0x6c68('0xf')](_0x456579));_0x306f68(_0x456579);})[_0x6c68('0x13')](function(_0x1f40cf){logger[_0x6c68('0x10')](_0x6c68('0x20'),_0x1f40cf[_0x6c68('0x11')],_0x4d690c);_0x4ef4cd(_0x3636e4[_0x6c68('0x10')](0x1f4,_0x1f40cf[_0x6c68('0x11')]));});});};exports[_0x6c68('0x22')]=function(_0x2d6be7){var _0x4e882a=this;return new Promise(function(_0x315a56,_0x5165d9){return db[_0x6c68('0x15')][_0x6c68('0x23')](_0x2d6be7[_0x6c68('0x24')],{'raw':_0x2d6be7['options']?_0x2d6be7[_0x6c68('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d6be7[_0x6c68('0x17')]?_0x2d6be7[_0x6c68('0x17')][_0x6c68('0x19')]||null:null,'attributes':_0x2d6be7[_0x6c68('0x17')]?_0x2d6be7[_0x6c68('0x17')][_0x6c68('0x1a')]||null:null,'limit':_0x2d6be7[_0x6c68('0x17')]?_0x2d6be7[_0x6c68('0x17')][_0x6c68('0x1b')]||null:null})[_0x6c68('0x1f')](function(_0x599e73){logger['info']('UpdateMemberReport',_0x2d6be7);logger['debug']('UpdateMemberReport',_0x2d6be7,JSON[_0x6c68('0xf')](_0x599e73));_0x315a56(_0x599e73);})[_0x6c68('0x13')](function(_0x4c52ff){logger[_0x6c68('0x10')](_0x6c68('0x22'),_0x4c52ff[_0x6c68('0x11')],_0x2d6be7);_0x5165d9(_0x4e882a[_0x6c68('0x10')](0x1f4,_0x4c52ff[_0x6c68('0x11')]));});});}; \ No newline at end of file +var _0xa2a1=['limit','include','model','attributes','map','then','body','CreateMemberReport','UpdateMemberReport','update','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','info','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMemberReport','MemberReport','raw','options','where'];(function(_0x3e6d58,_0x1155e2){var _0x371c6e=function(_0x13240c){while(--_0x13240c){_0x3e6d58['push'](_0x3e6d58['shift']());}};_0x371c6e(++_0x1155e2);}(_0xa2a1,0x1c6));var _0x1a2a=function(_0x43e662,_0x30d864){_0x43e662=_0x43e662-0x0;var _0x3df57e=_0xa2a1[_0x43e662];return _0x3df57e;};'use strict';var _=require(_0x1a2a('0x0'));var util=require(_0x1a2a('0x1'));var moment=require(_0x1a2a('0x2'));var BPromise=require('bluebird');var rs=require(_0x1a2a('0x3'));var fs=require('fs');var Redis=require(_0x1a2a('0x4'));var db=require(_0x1a2a('0x5'))['db'];var utils=require(_0x1a2a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x1a2a('0x7'));var jayson=require(_0x1a2a('0x8'));var client=jayson[_0x1a2a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x434ea7,_0x119312,_0x3c24b6){return new BPromise(function(_0x36c965,_0x26cf7a){return client[_0x1a2a('0xa')](_0x434ea7,_0x3c24b6)['then'](function(_0x5ea41f){logger[_0x1a2a('0xb')](_0x1a2a('0xc'),_0x119312,'request\x20sent');logger[_0x1a2a('0xd')](_0x1a2a('0xe'),_0x119312,_0x1a2a('0xf'),JSON[_0x1a2a('0x10')](_0x5ea41f));if(_0x5ea41f['error']){if(_0x5ea41f[_0x1a2a('0x11')][_0x1a2a('0x12')]===0x1f4){logger[_0x1a2a('0x11')](_0x1a2a('0xc'),_0x119312,_0x5ea41f[_0x1a2a('0x11')][_0x1a2a('0x13')]);return _0x26cf7a(_0x5ea41f[_0x1a2a('0x11')][_0x1a2a('0x13')]);}logger[_0x1a2a('0x11')]('MemberReport,\x20%s,\x20%s',_0x119312,_0x5ea41f['error']['message']);return _0x36c965(_0x5ea41f['error'][_0x1a2a('0x13')]);}else{logger[_0x1a2a('0xb')](_0x1a2a('0xc'),_0x119312,_0x1a2a('0xf'));_0x36c965(_0x5ea41f[_0x1a2a('0x14')][_0x1a2a('0x13')]);}})[_0x1a2a('0x15')](function(_0x179ab3){logger[_0x1a2a('0x11')]('MemberReport,\x20%s,\x20%s',_0x119312,_0x179ab3);_0x26cf7a(_0x179ab3);});});}exports[_0x1a2a('0x16')]=function(_0xd22bc5){var _0x1ae0f1=this;return new Promise(function(_0x13f3d3,_0x2a7030){return db[_0x1a2a('0x17')]['findAll']({'raw':_0xd22bc5['options']?_0xd22bc5['options'][_0x1a2a('0x18')]===undefined?!![]:![]:!![],'where':_0xd22bc5['options']?_0xd22bc5[_0x1a2a('0x19')][_0x1a2a('0x1a')]||null:null,'attributes':_0xd22bc5['options']?_0xd22bc5['options']['attributes']||null:null,'limit':_0xd22bc5['options']?_0xd22bc5[_0x1a2a('0x19')][_0x1a2a('0x1b')]||null:null,'include':_0xd22bc5[_0x1a2a('0x19')]?_0xd22bc5[_0x1a2a('0x19')][_0x1a2a('0x1c')]?_['map'](_0xd22bc5[_0x1a2a('0x19')][_0x1a2a('0x1c')],function(_0x10a416){return{'model':db[_0x10a416[_0x1a2a('0x1d')]],'as':_0x10a416['as'],'attributes':_0x10a416[_0x1a2a('0x1e')],'include':_0x10a416[_0x1a2a('0x1c')]?_['map'](_0x10a416[_0x1a2a('0x1c')],function(_0x2764f7){return{'model':db[_0x2764f7[_0x1a2a('0x1d')]],'as':_0x2764f7['as'],'attributes':_0x2764f7[_0x1a2a('0x1e')],'include':_0x2764f7[_0x1a2a('0x1c')]?_[_0x1a2a('0x1f')](_0x2764f7[_0x1a2a('0x1c')],function(_0x47ca15){return{'model':db[_0x47ca15[_0x1a2a('0x1d')]],'as':_0x47ca15['as'],'attributes':_0x47ca15[_0x1a2a('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1a2a('0x20')](function(_0x23836c){logger[_0x1a2a('0xb')](_0x1a2a('0x16'),_0xd22bc5);logger['debug']('GetMemberReport',_0xd22bc5,JSON[_0x1a2a('0x10')](_0x23836c));_0x13f3d3(_0x23836c);})[_0x1a2a('0x15')](function(_0x26e864){logger[_0x1a2a('0x11')](_0x1a2a('0x16'),_0x26e864[_0x1a2a('0x13')],_0xd22bc5);_0x2a7030(_0x1ae0f1[_0x1a2a('0x11')](0x1f4,_0x26e864[_0x1a2a('0x13')]));});});};exports['CreateMemberReport']=function(_0x27124a){var _0x418bae=this;return new Promise(function(_0x2475b1,_0x59bb3f){return db[_0x1a2a('0x17')]['create'](_0x27124a[_0x1a2a('0x21')],{'raw':_0x27124a[_0x1a2a('0x19')]?_0x27124a['options'][_0x1a2a('0x18')]===undefined?!![]:![]:!![]})[_0x1a2a('0x20')](function(_0x197707){logger['info'](_0x1a2a('0x22'),_0x27124a);logger[_0x1a2a('0xd')](_0x1a2a('0x22'),_0x27124a,JSON[_0x1a2a('0x10')](_0x197707));_0x2475b1(_0x197707);})[_0x1a2a('0x15')](function(_0x54ec00){logger['error'](_0x1a2a('0x22'),_0x54ec00[_0x1a2a('0x13')],_0x27124a);_0x59bb3f(_0x418bae['error'](0x1f4,_0x54ec00[_0x1a2a('0x13')]));});});};exports[_0x1a2a('0x23')]=function(_0x3fbbd1){var _0x4e7308=this;return new Promise(function(_0x26dbfb,_0x234da0){return db[_0x1a2a('0x17')][_0x1a2a('0x24')](_0x3fbbd1[_0x1a2a('0x21')],{'raw':_0x3fbbd1[_0x1a2a('0x19')]?_0x3fbbd1[_0x1a2a('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fbbd1[_0x1a2a('0x19')]?_0x3fbbd1[_0x1a2a('0x19')][_0x1a2a('0x1a')]||null:null,'attributes':_0x3fbbd1[_0x1a2a('0x19')]?_0x3fbbd1[_0x1a2a('0x19')]['attributes']||null:null,'limit':_0x3fbbd1[_0x1a2a('0x19')]?_0x3fbbd1[_0x1a2a('0x19')][_0x1a2a('0x1b')]||null:null})[_0x1a2a('0x20')](function(_0x2995ed){logger['info'](_0x1a2a('0x23'),_0x3fbbd1);logger[_0x1a2a('0xd')](_0x1a2a('0x23'),_0x3fbbd1,JSON[_0x1a2a('0x10')](_0x2995ed));_0x26dbfb(_0x2995ed);})[_0x1a2a('0x15')](function(_0x51bfc4){logger[_0x1a2a('0x11')](_0x1a2a('0x23'),_0x51bfc4[_0x1a2a('0x13')],_0x3fbbd1);_0x234da0(_0x4e7308[_0x1a2a('0x11')](0x1f4,_0x51bfc4[_0x1a2a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 2dd8298..26b3c6b 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 _0x91a7=['util','path','connect-timeout','Router','../../components/interaction/service','get','index'];(function(_0x236400,_0x5b07d9){var _0x62495f=function(_0x2e45d3){while(--_0x2e45d3){_0x236400['push'](_0x236400['shift']());}};_0x62495f(++_0x5b07d9);}(_0x91a7,0xe7));var _0x791a=function(_0xd47916,_0x4be2a2){_0xd47916=_0xd47916-0x0;var _0x30759c=_0x91a7[_0xd47916];return _0x30759c;};'use strict';var multer=require('multer');var util=require(_0x791a('0x0'));var path=require(_0x791a('0x1'));var timeout=require(_0x791a('0x2'));var express=require('express');var router=express[_0x791a('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x791a('0x4'));var config=require('../../config/environment');var controller=require('./migration.controller');router[_0x791a('0x5')]('/',controller[_0x791a('0x6')]);module['exports']=router; \ No newline at end of file +var _0x7072=['express','Router','../../config/environment','get','index','exports','util','path','connect-timeout'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7072,0x138));var _0x2707=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0x7072[_0x166742];return _0xb7814a;};'use strict';var multer=require('multer');var util=require(_0x2707('0x0'));var path=require(_0x2707('0x1'));var timeout=require(_0x2707('0x2'));var express=require(_0x2707('0x3'));var router=express[_0x2707('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2707('0x5'));var controller=require('./migration.controller');router[_0x2707('0x6')]('/',controller[_0x2707('0x7')]);module[_0x2707('0x8')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index dc3120f..2018f20 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 _0xa6d3=['version','sequelize','exports','STRING'];(function(_0x596487,_0x429810){var _0x307949=function(_0x4b7f6c){while(--_0x4b7f6c){_0x596487['push'](_0x596487['shift']());}};_0x307949(++_0x429810);}(_0xa6d3,0xe9));var _0x3a6d=function(_0x59d041,_0x5c13f3){_0x59d041=_0x59d041-0x0;var _0x102dd5=_0xa6d3[_0x59d041];return _0x102dd5;};'use strict';var Sequelize=require(_0x3a6d('0x0'));module[_0x3a6d('0x1')]={'version':{'type':Sequelize[_0x3a6d('0x2')],'unique':_0x3a6d('0x3')}}; \ No newline at end of file +var _0xef08=['STRING','exports'];(function(_0x14b4e2,_0x2a744a){var _0x498dd5=function(_0x51b76a){while(--_0x51b76a){_0x14b4e2['push'](_0x14b4e2['shift']());}};_0x498dd5(++_0x2a744a);}(_0xef08,0x13f));var _0x8ef0=function(_0x431ac5,_0x3bf7d2){_0x431ac5=_0x431ac5-0x0;var _0x40b5df=_0xef08[_0x431ac5];return _0x40b5df;};'use strict';var Sequelize=require('sequelize');module[_0x8ef0('0x0')]={'version':{'type':Sequelize[_0x8ef0('0x1')],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 610288c..b98e55c 100644 --- a/server/api/migration/migration.controller.js +++ b/server/api/migration/migration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00bb=['html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','sendStatus','status','end','json','count','offset','Content-Range','apply','update','then','destroy','error','stack','map','Migration','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','catch'];(function(_0x4f5108,_0x46a54b){var _0x2d56ca=function(_0x5b3c1e){while(--_0x5b3c1e){_0x4f5108['push'](_0x4f5108['shift']());}};_0x2d56ca(++_0x46a54b);}(_0x00bb,0x1d8));var _0xb00b=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x00bb[_0x46aff0];return _0x9d78cf;};'use strict';var pdf=require(_0xb00b('0x0'));var emlformat=require(_0xb00b('0x1'));var rimraf=require(_0xb00b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb00b('0x3'));var rp=require('request-promise');var moment=require(_0xb00b('0x4'));var BPromise=require(_0xb00b('0x5'));var Mustache=require('mustache');var util=require(_0xb00b('0x6'));var path=require(_0xb00b('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ff792,_0x2d8ddf){_0x2d8ddf=_0x2d8ddf||0xcc;return function(_0x1be8aa){if(_0x1be8aa){return _0x4ff792[_0xb00b('0x14')](_0x2d8ddf);}return _0x4ff792[_0xb00b('0x15')](_0x2d8ddf)[_0xb00b('0x16')]();};}function respondWithResult(_0x4ada81,_0x218de2){_0x218de2=_0x218de2||0xc8;return function(_0xb0d42e){if(_0xb0d42e){return _0x4ada81['status'](_0x218de2)[_0xb00b('0x17')](_0xb0d42e);}};}function respondWithFilteredResult(_0x1084a6,_0x540b79){return function(_0x5da36b){if(_0x5da36b){var _0x9b471e=_0x5da36b[_0xb00b('0x18')],_0x4dcd45=_0x540b79[_0xb00b('0x19')],_0x51d136=_0x540b79[_0xb00b('0x19')]+_0x540b79['limit'],_0x1f9c78;if(_0x51d136>=_0x9b471e){_0x51d136=_0x9b471e;_0x1f9c78=0xc8;}else{_0x1f9c78=0xce;}_0x1084a6[_0xb00b('0x15')](_0x1f9c78);return _0x1084a6['set'](_0xb00b('0x1a'),_0x4dcd45+'-'+_0x51d136+'/'+_0x9b471e)['json'](_0x5da36b);}return null;};}function patchUpdates(_0x25d7a0){return function(_0x5e8d7b){try{jsonpatch[_0xb00b('0x1b')](_0x5e8d7b,_0x25d7a0,!![]);}catch(_0x3355a3){return BPromise['reject'](_0x3355a3);}return _0x5e8d7b['save']();};}function saveUpdates(_0x2b0da1,_0x4a334b){return function(_0x1344c4){if(_0x1344c4){return _0x1344c4[_0xb00b('0x1c')](_0x2b0da1)[_0xb00b('0x1d')](function(_0x3501af){return _0x3501af;});}return null;};}function removeEntity(_0x56c189,_0x362ee0){return function(_0x4df284){if(_0x4df284){return _0x4df284[_0xb00b('0x1e')]()[_0xb00b('0x1d')](function(){_0x56c189['status'](0xcc)[_0xb00b('0x16')]();});}};}function handleEntityNotFound(_0x2896d1,_0x520444){return function(_0x3ab3cc){if(!_0x3ab3cc){_0x2896d1[_0xb00b('0x14')](0x194);}return _0x3ab3cc;};}function handleError(_0x5568bb,_0x44efe5){_0x44efe5=_0x44efe5||0x1f4;return function(_0x243fdb){logger[_0xb00b('0x1f')](_0x243fdb[_0xb00b('0x20')]);if(_0x243fdb['name']){delete _0x243fdb['name'];}_0x5568bb[_0xb00b('0x15')](_0x44efe5)['send'](_0x243fdb);};}exports['index']=function(_0x4a635e,_0x16ac55){var _0x73b6b0={},_0x2592cf={},_0x3825af={'count':0x0,'rows':[]};var _0x1f14fa=_[_0xb00b('0x21')](db[_0xb00b('0x22')]['rawAttributes'],function(_0x22c22d){return{'name':_0x22c22d['fieldName'],'type':_0x22c22d[_0xb00b('0x23')][_0xb00b('0x24')]};});_0x2592cf[_0xb00b('0x25')]=_['map'](_0x1f14fa,_0xb00b('0x26'));_0x2592cf[_0xb00b('0x27')]=_[_0xb00b('0x28')](_0x4a635e[_0xb00b('0x27')]);_0x2592cf[_0xb00b('0x29')]=_[_0xb00b('0x2a')](_0x2592cf[_0xb00b('0x25')],_0x2592cf[_0xb00b('0x27')]);_0x73b6b0[_0xb00b('0x2b')]=_['intersection'](_0x2592cf[_0xb00b('0x25')],qs[_0xb00b('0x2c')](_0x4a635e['query'][_0xb00b('0x2c')]));_0x73b6b0[_0xb00b('0x2b')]=_0x73b6b0['attributes'][_0xb00b('0x2d')]?_0x73b6b0['attributes']:_0x2592cf[_0xb00b('0x25')];if(!_0x4a635e[_0xb00b('0x27')][_0xb00b('0x2e')](_0xb00b('0x2f'))){_0x73b6b0[_0xb00b('0x30')]=qs[_0xb00b('0x30')](_0x4a635e[_0xb00b('0x27')]['limit']);_0x73b6b0['offset']=qs['offset'](_0x4a635e[_0xb00b('0x27')][_0xb00b('0x19')]);}_0x73b6b0[_0xb00b('0x31')]=qs[_0xb00b('0x32')](_0x4a635e['query'][_0xb00b('0x32')]);_0x73b6b0[_0xb00b('0x33')]=qs[_0xb00b('0x29')](_[_0xb00b('0x34')](_0x4a635e[_0xb00b('0x27')],_0x2592cf[_0xb00b('0x29')]),_0x1f14fa);if(_0x4a635e[_0xb00b('0x27')][_0xb00b('0x35')]){_0x73b6b0['where']=_['merge'](_0x73b6b0[_0xb00b('0x33')],{'$or':_['map'](_0x1f14fa,function(_0x1c8258){if(_0x1c8258[_0xb00b('0x23')]!==_0xb00b('0x36')){var _0x45ca74={};_0x45ca74[_0x1c8258[_0xb00b('0x26')]]={'$like':'%'+_0x4a635e[_0xb00b('0x27')][_0xb00b('0x35')]+'%'};return _0x45ca74;}})});}_0x73b6b0=_['merge']({},_0x73b6b0,_0x4a635e[_0xb00b('0x37')]);var _0x25578e={'where':_0x73b6b0[_0xb00b('0x33')]};return db[_0xb00b('0x22')][_0xb00b('0x18')](_0x25578e)[_0xb00b('0x1d')](function(_0x59fb00){_0x3825af[_0xb00b('0x18')]=_0x59fb00;if(_0x4a635e[_0xb00b('0x27')]['includeAll']){_0x73b6b0[_0xb00b('0x38')]=[{'all':!![]}];}return db[_0xb00b('0x22')][_0xb00b('0x39')](_0x73b6b0);})[_0xb00b('0x1d')](function(_0x2954e8){_0x3825af['rows']=_0x2954e8;return _0x3825af;})[_0xb00b('0x1d')](respondWithFilteredResult(_0x16ac55,_0x73b6b0))[_0xb00b('0x3a')](handleError(_0x16ac55,null));}; \ No newline at end of file +var _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(_0x5e9919,_0x5bbf39){var _0x4655c5=function(_0x172b06){while(--_0x172b06){_0x5e9919['push'](_0x5e9919['shift']());}};_0x4655c5(++_0x5bbf39);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x32cd29,_0x29f6bb){_0x32cd29=_0x32cd29-0x0;var _0x2f7e6e=_0xf3cd[_0x32cd29];return _0x2f7e6e;};'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 diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 7e1dfba..75495e4 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 _0x2d4d=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./migration.attributes','exports','Migration'];(function(_0x450f20,_0x159bb3){var _0x15bd66=function(_0x304648){while(--_0x304648){_0x450f20['push'](_0x450f20['shift']());}};_0x15bd66(++_0x159bb3);}(_0x2d4d,0x14a));var _0xd2d4=function(_0x18da7a,_0x39b9b0){_0x18da7a=_0x18da7a-0x0;var _0x24cd57=_0x2d4d[_0x18da7a];return _0x24cd57;};'use strict';var _=require('lodash');var util=require(_0xd2d4('0x0'));var logger=require(_0xd2d4('0x1'))(_0xd2d4('0x2'));var moment=require(_0xd2d4('0x3'));var BPromise=require(_0xd2d4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd2d4('0x5'));var rimraf=require(_0xd2d4('0x6'));var config=require(_0xd2d4('0x7'));var attributes=require(_0xd2d4('0x8'));module[_0xd2d4('0x9')]=function(_0xd97dc0,_0x51f794){return _0xd97dc0['define'](_0xd2d4('0xa'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce03=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes','exports','define','migrations','lodash','util','../../config/logger','api'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0xce03,0x114));var _0x3ce0=function(_0x405586,_0x5545ad){_0x405586=_0x405586-0x0;var _0x3de55b=_0xce03[_0x405586];return _0x3de55b;};'use strict';var _=require(_0x3ce0('0x0'));var util=require(_0x3ce0('0x1'));var logger=require(_0x3ce0('0x2'))(_0x3ce0('0x3'));var moment=require(_0x3ce0('0x4'));var BPromise=require(_0x3ce0('0x5'));var rp=require(_0x3ce0('0x6'));var fs=require('fs');var path=require(_0x3ce0('0x7'));var rimraf=require(_0x3ce0('0x8'));var config=require(_0x3ce0('0x9'));var attributes=require(_0x3ce0('0xa'));module[_0x3ce0('0xb')]=function(_0x3662af,_0x1818b1){return _0x3662af[_0x3ce0('0xc')]('Migration',attributes,{'tableName':_0x3ce0('0xd'),'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 5137665..99ad957 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 _0x0577=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x26fdfc,_0x5ede52){var _0x5c9e63=function(_0x34e7fb){while(--_0x34e7fb){_0x26fdfc['push'](_0x26fdfc['shift']());}};_0x5c9e63(++_0x5ede52);}(_0x0577,0xa4));var _0x7057=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0577[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x7057('0x0'));var util=require(_0x7057('0x1'));var moment=require(_0x7057('0x2'));var BPromise=require(_0x7057('0x3'));var rs=require(_0x7057('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7057('0x5'))['db'];var utils=require(_0x7057('0x6'));var logger=require(_0x7057('0x7'))(_0x7057('0x8'));var config=require(_0x7057('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7057('0xa')][_0x7057('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d2801,_0x48f68d,_0x3fc673){return new BPromise(function(_0x548f1a,_0x5e4ae6){return client['request'](_0x4d2801,_0x3fc673)[_0x7057('0xc')](function(_0x5e5723){logger[_0x7057('0xd')](_0x7057('0xe'),_0x48f68d,_0x7057('0xf'));logger[_0x7057('0x10')](_0x7057('0x11'),_0x48f68d,_0x7057('0xf'),JSON[_0x7057('0x12')](_0x5e5723));if(_0x5e5723[_0x7057('0x13')]){if(_0x5e5723[_0x7057('0x13')]['code']===0x1f4){logger[_0x7057('0x13')](_0x7057('0xe'),_0x48f68d,_0x5e5723['error'][_0x7057('0x14')]);return _0x5e4ae6(_0x5e5723[_0x7057('0x13')][_0x7057('0x14')]);}logger[_0x7057('0x13')](_0x7057('0xe'),_0x48f68d,_0x5e5723[_0x7057('0x13')][_0x7057('0x14')]);return _0x548f1a(_0x5e5723['error'][_0x7057('0x14')]);}else{logger[_0x7057('0xd')](_0x7057('0xe'),_0x48f68d,_0x7057('0xf'));_0x548f1a(_0x5e5723[_0x7057('0x15')][_0x7057('0x14')]);}})[_0x7057('0x16')](function(_0x2de73d){logger[_0x7057('0x13')](_0x7057('0xe'),_0x48f68d,_0x2de73d);_0x5e4ae6(_0x2de73d);});});} \ No newline at end of file +var _0x72aa=['request\x20sent','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','info','Migration,\x20%s,\x20%s','debug','Migration,\x20%s,\x20%s,\x20%s'];(function(_0x1b5a5a,_0x1c3b75){var _0x42b32d=function(_0x3d35ab){while(--_0x3d35ab){_0x1b5a5a['push'](_0x1b5a5a['shift']());}};_0x42b32d(++_0x1c3b75);}(_0x72aa,0x182));var _0xa72a=function(_0x1a031f,_0xc555a7){_0x1a031f=_0x1a031f-0x0;var _0x118620=_0x72aa[_0x1a031f];return _0x118620;};'use strict';var _=require('lodash');var util=require(_0xa72a('0x0'));var moment=require(_0xa72a('0x1'));var BPromise=require(_0xa72a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa72a('0x3'));var db=require(_0xa72a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa72a('0x5'))(_0xa72a('0x6'));var config=require(_0xa72a('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa72a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5b7c0f,_0x277430,_0x3b892b){return new BPromise(function(_0x4551ff,_0x157a83){return client[_0xa72a('0x9')](_0x5b7c0f,_0x3b892b)['then'](function(_0x912b0a){logger[_0xa72a('0xa')](_0xa72a('0xb'),_0x277430,'request\x20sent');logger[_0xa72a('0xc')](_0xa72a('0xd'),_0x277430,_0xa72a('0xe'),JSON['stringify'](_0x912b0a));if(_0x912b0a[_0xa72a('0xf')]){if(_0x912b0a[_0xa72a('0xf')][_0xa72a('0x10')]===0x1f4){logger[_0xa72a('0xf')](_0xa72a('0xb'),_0x277430,_0x912b0a['error'][_0xa72a('0x11')]);return _0x157a83(_0x912b0a[_0xa72a('0xf')][_0xa72a('0x11')]);}logger[_0xa72a('0xf')]('Migration,\x20%s,\x20%s',_0x277430,_0x912b0a[_0xa72a('0xf')]['message']);return _0x4551ff(_0x912b0a[_0xa72a('0xf')][_0xa72a('0x11')]);}else{logger[_0xa72a('0xa')](_0xa72a('0xb'),_0x277430,'request\x20sent');_0x4551ff(_0x912b0a[_0xa72a('0x12')]['message']);}})[_0xa72a('0x13')](function(_0x3e020e){logger[_0xa72a('0xf')]('Migration,\x20%s,\x20%s',_0x277430,_0x3e020e);_0x157a83(_0x3e020e);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 2642cfe..015d16a 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 _0xad78=['create','put','update','delete','destroy','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xad78,0x149));var _0x8ad7=function(_0x34506f,_0x40a755){_0x34506f=_0x34506f-0x0;var _0x5b3643=_0xad78[_0x34506f];return _0x5b3643;};'use strict';var multer=require(_0x8ad7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8ad7('0x1'));var express=require(_0x8ad7('0x2'));var router=express['Router']();var auth=require(_0x8ad7('0x3'));var interaction=require(_0x8ad7('0x4'));var config=require(_0x8ad7('0x5'));var controller=require(_0x8ad7('0x6'));router[_0x8ad7('0x7')]('/',auth[_0x8ad7('0x8')](),controller[_0x8ad7('0x9')]);router[_0x8ad7('0x7')](_0x8ad7('0xa'),auth[_0x8ad7('0x8')](),controller['show']);router['post']('/',auth[_0x8ad7('0x8')](),controller[_0x8ad7('0xb')]);router[_0x8ad7('0xc')](_0x8ad7('0xa'),auth[_0x8ad7('0x8')](),controller[_0x8ad7('0xd')]);router[_0x8ad7('0xe')]('/:id',auth[_0x8ad7('0x8')](),controller[_0x8ad7('0xf')]);module[_0x8ad7('0x10')]=router; \ No newline at end of file +var _0x4813=['../../components/auth/service','../../config/environment','./network.controller','get','isAuthenticated','index','post','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x4413a1,_0x55a868){var _0x184cf3=function(_0x52db9b){while(--_0x52db9b){_0x4413a1['push'](_0x4413a1['shift']());}};_0x184cf3(++_0x55a868);}(_0x4813,0x14e));var _0x3481=function(_0x466563,_0x301fc2){_0x466563=_0x466563-0x0;var _0x34c161=_0x4813[_0x466563];return _0x34c161;};'use strict';var multer=require(_0x3481('0x0'));var util=require(_0x3481('0x1'));var path=require(_0x3481('0x2'));var timeout=require(_0x3481('0x3'));var express=require(_0x3481('0x4'));var router=express[_0x3481('0x5')]();var auth=require(_0x3481('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3481('0x7'));var controller=require(_0x3481('0x8'));router[_0x3481('0x9')]('/',auth[_0x3481('0xa')](),controller[_0x3481('0xb')]);router['get']('/:id',auth[_0x3481('0xa')](),controller['show']);router[_0x3481('0xc')]('/',auth[_0x3481('0xa')](),controller[_0x3481('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x3481('0xe')]);router['delete']('/:id',auth[_0x3481('0xa')](),controller[_0x3481('0xf')]);module[_0x3481('0x10')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 684e297..34af1ad 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(_0x4ea517,_0x2fb3dc){var _0x5dc339=function(_0x354f44){while(--_0x354f44){_0x4ea517['push'](_0x4ea517['shift']());}};_0x5dc339(++_0x2fb3dc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'type':{'type':Sequelize[_0x0a9e('0x2')]('localnet','externip',_0x0a9e('0x3'),'turn')},'value':{'type':Sequelize[_0x0a9e('0x4')]},'username':{'type':Sequelize[_0x0a9e('0x4')]},'password':{'type':Sequelize[_0x0a9e('0x4')]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','ENUM','stun'];(function(_0x457fb,_0x3f926){var _0x246608=function(_0x3dfd42){while(--_0x3dfd42){_0x457fb['push'](_0x457fb['shift']());}};_0x246608(++_0x3f926);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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 d1aa726..ce04196 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 _0x3785=['rows','show','params','length','includeAll','create','sequelize','transaction','body','STUN','readFileSync','join','root','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','TURN','server/files/templates/turn_multiple.ejs','res_stun_monitor.so','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','update','find','toUpperCase','server/files/templates/stun_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','chan_sip.so','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','save','destroy','stack','name','index','map','Network','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','include','findAll'];(function(_0x2bb30a,_0x13c669){var _0x1d0ae8=function(_0x3083b5){while(--_0x3083b5){_0x2bb30a['push'](_0x2bb30a['shift']());}};_0x1d0ae8(++_0x13c669);}(_0x3785,0x92));var _0x5378=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0x3785[_0x257642];return _0x3d813b;};'use strict';var pdf=require(_0x5378('0x0'));var emlformat=require(_0x5378('0x1'));var rimraf=require(_0x5378('0x2'));var zipdir=require(_0x5378('0x3'));var jsonpatch=require(_0x5378('0x4'));var rp=require(_0x5378('0x5'));var moment=require('moment');var BPromise=require(_0x5378('0x6'));var Mustache=require(_0x5378('0x7'));var util=require('util');var path=require(_0x5378('0x8'));var sox=require(_0x5378('0x9'));var csv=require(_0x5378('0xa'));var ejs=require(_0x5378('0xb'));var fs=require('fs');var _=require(_0x5378('0xc'));var squel=require(_0x5378('0xd'));var crypto=require(_0x5378('0xe'));var jsforce=require(_0x5378('0xf'));var deskjs=require(_0x5378('0x10'));var toCsv=require(_0x5378('0xa'));var querystring=require(_0x5378('0x11'));var Papa=require(_0x5378('0x12'));var Redis=require(_0x5378('0x13'));var authService=require(_0x5378('0x14'));var qs=require(_0x5378('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5378('0x16'))(_0x5378('0x17'));var utils=require(_0x5378('0x18'));var config=require('../../config/environment');var db=require(_0x5378('0x19'))['db'];var jayson=require(_0x5378('0x1a'));var client=jayson['client'][_0x5378('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x20bcb0,_0x28be19,_0x8f728){if(_0x8f728){var _0x118749=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x118749[_0x5378('0x1c')](_0x28be19)){return _0x20bcb0;}else{throw new db[(_0x5378('0x1d'))][(_0x5378('0x1e'))](_0x5378('0x1f'));}}else{return _0x20bcb0;}}function respondWithRpcPromise(_0x3326cc,_0x4974e4,_0x234477,_0x5698d4){return new BPromise(function(_0x3034c4,_0x4075e4){var _0x16b27f=_0x5698d4||client;return _0x16b27f[_0x5378('0x20')](_0x3326cc,_0x234477)[_0x5378('0x21')](function(_0x4b6171){logger[_0x5378('0x22')](_0x5378('0x23'),_0x4974e4,_0x5378('0x24'));logger[_0x5378('0x25')](_0x5378('0x26'),_0x4974e4,_0x5378('0x24'),JSON[_0x5378('0x27')](_0x4b6171));if(_0x4b6171[_0x5378('0x28')]){if(_0x4b6171['error'][_0x5378('0x29')]===0x1f4){logger[_0x5378('0x28')](_0x5378('0x23'),_0x4974e4,_0x4b6171[_0x5378('0x28')][_0x5378('0x2a')]);return _0x4075e4(_0x4b6171[_0x5378('0x28')][_0x5378('0x2a')]);}logger[_0x5378('0x28')](_0x5378('0x23'),_0x4974e4,_0x4b6171[_0x5378('0x28')][_0x5378('0x2a')]);return _0x3034c4(_0x4b6171['error'][_0x5378('0x2a')]);}else{logger['info'](_0x5378('0x23'),_0x4974e4,_0x5378('0x24'));_0x3034c4(_0x4b6171[_0x5378('0x2b')][_0x5378('0x2a')]);}})[_0x5378('0x2c')](function(_0x187122){logger[_0x5378('0x28')](_0x5378('0x23'),_0x4974e4,_0x187122);_0x4075e4(_0x187122);});});}function respondWithStatusCode(_0x34ded8,_0x31a316){_0x31a316=_0x31a316||0xcc;return function(_0x2b2bfb){if(_0x2b2bfb){return _0x34ded8[_0x5378('0x2d')](_0x31a316);}return _0x34ded8['status'](_0x31a316)[_0x5378('0x2e')]();};}function respondWithResult(_0x29e3f7,_0x45070d){_0x45070d=_0x45070d||0xc8;return function(_0x54be96){if(_0x54be96){return _0x29e3f7['status'](_0x45070d)[_0x5378('0x2f')](_0x54be96);}};}function respondWithFilteredResult(_0x1ebe4d,_0x366437){return function(_0x5ea24d){if(_0x5ea24d){var _0x3374cf=_0x5ea24d[_0x5378('0x30')],_0x20cd9d=_0x366437[_0x5378('0x31')],_0x5cea39=_0x366437[_0x5378('0x31')]+_0x366437[_0x5378('0x32')],_0x1fc9aa;if(_0x5cea39>=_0x3374cf){_0x5cea39=_0x3374cf;_0x1fc9aa=0xc8;}else{_0x1fc9aa=0xce;}_0x1ebe4d[_0x5378('0x33')](_0x1fc9aa);return _0x1ebe4d[_0x5378('0x34')](_0x5378('0x35'),_0x20cd9d+'-'+_0x5cea39+'/'+_0x3374cf)[_0x5378('0x2f')](_0x5ea24d);}return null;};}function patchUpdates(_0x5dd8f5){return function(_0x4a9ab7){try{jsonpatch[_0x5378('0x36')](_0x4a9ab7,_0x5dd8f5,!![]);}catch(_0x8c81c){return BPromise['reject'](_0x8c81c);}return _0x4a9ab7[_0x5378('0x37')]();};}function saveUpdates(_0x47e16c,_0x50c1bb){return function(_0x1dd7ef){if(_0x1dd7ef){return _0x1dd7ef['update'](_0x47e16c)[_0x5378('0x21')](function(_0x125254){return _0x125254;});}return null;};}function removeEntity(_0x422fad,_0x391bdd){return function(_0x3fe173){if(_0x3fe173){return _0x3fe173[_0x5378('0x38')]()['then'](function(){_0x422fad['status'](0xcc)[_0x5378('0x2e')]();});}};}function handleEntityNotFound(_0x471925,_0x4cc7b2){return function(_0x207fce){if(!_0x207fce){_0x471925[_0x5378('0x2d')](0x194);}return _0x207fce;};}function handleError(_0x141dc2,_0x161632){_0x161632=_0x161632||0x1f4;return function(_0x5c4412){logger[_0x5378('0x28')](_0x5c4412[_0x5378('0x39')]);if(_0x5c4412[_0x5378('0x3a')]){delete _0x5c4412[_0x5378('0x3a')];}_0x141dc2['status'](_0x161632)['send'](_0x5c4412);};}exports[_0x5378('0x3b')]=function(_0x2f6585,_0x46d69a){var _0x5c068d={},_0x43e2f9={},_0x51abc1={'count':0x0,'rows':[]};var _0x5e07c4=_[_0x5378('0x3c')](db[_0x5378('0x3d')][_0x5378('0x3e')],function(_0x3d860a){return{'name':_0x3d860a['fieldName'],'type':_0x3d860a['type'][_0x5378('0x3f')]};});_0x43e2f9[_0x5378('0x40')]=_['map'](_0x5e07c4,'name');_0x43e2f9['query']=_[_0x5378('0x41')](_0x2f6585[_0x5378('0x42')]);_0x43e2f9[_0x5378('0x43')]=_[_0x5378('0x44')](_0x43e2f9[_0x5378('0x40')],_0x43e2f9['query']);_0x5c068d[_0x5378('0x45')]=_[_0x5378('0x44')](_0x43e2f9[_0x5378('0x40')],qs[_0x5378('0x46')](_0x2f6585[_0x5378('0x42')][_0x5378('0x46')]));_0x5c068d[_0x5378('0x45')]=_0x5c068d[_0x5378('0x45')]['length']?_0x5c068d[_0x5378('0x45')]:_0x43e2f9['model'];if(!_0x2f6585[_0x5378('0x42')][_0x5378('0x47')](_0x5378('0x48'))){_0x5c068d[_0x5378('0x32')]=qs['limit'](_0x2f6585[_0x5378('0x42')][_0x5378('0x32')]);_0x5c068d[_0x5378('0x31')]=qs[_0x5378('0x31')](_0x2f6585[_0x5378('0x42')]['offset']);}_0x5c068d[_0x5378('0x49')]=qs[_0x5378('0x4a')](_0x2f6585[_0x5378('0x42')][_0x5378('0x4a')]);_0x5c068d['where']=qs[_0x5378('0x43')](_[_0x5378('0x4b')](_0x2f6585['query'],_0x43e2f9[_0x5378('0x43')]),_0x5e07c4);if(_0x2f6585[_0x5378('0x42')][_0x5378('0x4c')]){_0x5c068d['where']=_[_0x5378('0x4d')](_0x5c068d[_0x5378('0x4e')],{'$or':_[_0x5378('0x3c')](_0x5e07c4,function(_0x55252e){if(_0x55252e[_0x5378('0x4f')]!==_0x5378('0x50')){var _0x17e018={};_0x17e018[_0x55252e[_0x5378('0x3a')]]={'$like':'%'+_0x2f6585['query'][_0x5378('0x4c')]+'%'};return _0x17e018;}})});}_0x5c068d=_[_0x5378('0x4d')]({},_0x5c068d,_0x2f6585[_0x5378('0x51')]);var _0x4b4624={'where':_0x5c068d['where']};return db[_0x5378('0x3d')][_0x5378('0x30')](_0x4b4624)['then'](function(_0x14ca01){_0x51abc1[_0x5378('0x30')]=_0x14ca01;if(_0x2f6585[_0x5378('0x42')]['includeAll']){_0x5c068d[_0x5378('0x52')]=[{'all':!![]}];}return db['Network'][_0x5378('0x53')](_0x5c068d);})[_0x5378('0x21')](function(_0x5775e4){_0x51abc1[_0x5378('0x54')]=_0x5775e4;return _0x51abc1;})['then'](respondWithFilteredResult(_0x46d69a,_0x5c068d))['catch'](handleError(_0x46d69a,null));};exports[_0x5378('0x55')]=function(_0x5386ae,_0x5b3e56){var _0x4cfd9b={'raw':!![],'where':{'id':_0x5386ae[_0x5378('0x56')]['id']}},_0x38cfb0={};_0x38cfb0[_0x5378('0x40')]=_[_0x5378('0x41')](db['Network'][_0x5378('0x3e')]);_0x38cfb0[_0x5378('0x42')]=_['keys'](_0x5386ae[_0x5378('0x42')]);_0x38cfb0['filters']=_[_0x5378('0x44')](_0x38cfb0['model'],_0x38cfb0[_0x5378('0x42')]);_0x4cfd9b[_0x5378('0x45')]=_[_0x5378('0x44')](_0x38cfb0[_0x5378('0x40')],qs[_0x5378('0x46')](_0x5386ae[_0x5378('0x42')][_0x5378('0x46')]));_0x4cfd9b[_0x5378('0x45')]=_0x4cfd9b[_0x5378('0x45')][_0x5378('0x57')]?_0x4cfd9b[_0x5378('0x45')]:_0x38cfb0['model'];if(_0x5386ae[_0x5378('0x42')][_0x5378('0x58')]){_0x4cfd9b['include']=[{'all':!![]}];}_0x4cfd9b=_[_0x5378('0x4d')]({},_0x4cfd9b,_0x5386ae[_0x5378('0x51')]);return db[_0x5378('0x3d')]['find'](_0x4cfd9b)[_0x5378('0x21')](handleEntityNotFound(_0x5b3e56,null))[_0x5378('0x21')](respondWithResult(_0x5b3e56,null))['catch'](handleError(_0x5b3e56,null));};exports[_0x5378('0x59')]=function(_0x1b920d,_0x19ec39,_0x1c0055){var _0x488a66;return db[_0x5378('0x5a')][_0x5378('0x5b')](function(_0x121432){return db[_0x5378('0x3d')][_0x5378('0x59')](_0x1b920d[_0x5378('0x5c')],{'raw':!![]})[_0x5378('0x21')](function(_0x110ff4){_0x488a66=_0x110ff4;return db[_0x5378('0x3d')][_0x5378('0x53')]({'where':{'type':_0x1b920d['body']['type']},'raw':!![]});})['then'](function(_0x27e2aa){if(_0x488a66['type']['toUpperCase']()==_0x5378('0x5d')){var _0x4bb213=fs[_0x5378('0x5e')](path[_0x5378('0x5f')](config[_0x5378('0x60')],'server/files/templates/stun_multiple.ejs'),_0x5378('0x61'));var _0x5cfd3f=ejs[_0x5378('0x62')](_0x4bb213,{'networks':_0x27e2aa||[]});fs[_0x5378('0x63')](_0x5378('0x64'),_0x5cfd3f);return respondWithRpcPromise(_0x5378('0x65'),_0x5378('0x59'),{'module':'res_stun_monitor.so'});}else if(_0x488a66['type']['toUpperCase']()==_0x5378('0x66')){var _0x2682e2=fs['readFileSync'](path['join'](config[_0x5378('0x60')],_0x5378('0x67')),_0x5378('0x61'));var _0x20050c=ejs[_0x5378('0x62')](_0x2682e2,{'networks':_0x27e2aa||[]});fs[_0x5378('0x63')]('/etc/asterisk/turn_xcally.conf',_0x20050c);return respondWithRpcPromise(_0x5378('0x65'),_0x5378('0x59'),{'module':_0x5378('0x68')});}else{var _0x198f03=fs['readFileSync'](path[_0x5378('0x5f')](config['root'],'server/files/templates/network.ejs'),'utf8');var _0x1196d6=ejs[_0x5378('0x62')](_0x198f03,{'networks':_0x27e2aa||[]});fs['writeFileSync'](util['format'](_0x5378('0x69'),_0x1b920d['body'][_0x5378('0x4f')][_0x5378('0x6a')]()),_0x1196d6);return respondWithRpcPromise(_0x5378('0x65'),_0x5378('0x59'),{'module':'chan_sip.so'});}return null;})[_0x5378('0x21')](function(){return _0x488a66;});})[_0x5378('0x21')](respondWithResult(_0x19ec39,0xc9))[_0x5378('0x2c')](handleError(_0x19ec39,null));};exports[_0x5378('0x6b')]=function(_0x4a369a,_0x1826e6,_0x524efb){var _0x14288a;return db[_0x5378('0x5a')][_0x5378('0x5b')](function(_0x4ba609){return db[_0x5378('0x3d')][_0x5378('0x6c')]({'where':{'id':_0x4a369a['params']['id']}})['then'](handleEntityNotFound(_0x1826e6,null))['then'](saveUpdates(_0x4a369a[_0x5378('0x5c')],null))[_0x5378('0x21')](function(_0x4dd5ea){if(_0x4dd5ea){_0x14288a=_0x4dd5ea;return db['Network']['findAll']({'where':{'type':_0x14288a[_0x5378('0x4f')]},'raw':!![]});}return null;})[_0x5378('0x21')](function(_0x3115e6){if(_0x14288a['type'][_0x5378('0x6d')]()=='STUN'){var _0x3ed809=fs[_0x5378('0x5e')](path[_0x5378('0x5f')](config[_0x5378('0x60')],_0x5378('0x6e')),_0x5378('0x61'));var _0x29415e=ejs[_0x5378('0x62')](_0x3ed809,{'networks':_0x3115e6||[]});fs[_0x5378('0x63')](_0x5378('0x64'),_0x29415e);return respondWithRpcPromise('Reload',_0x5378('0x6b'),{'module':_0x5378('0x68')});}else if(_0x14288a[_0x5378('0x4f')][_0x5378('0x6d')]()=='TURN'){var _0x5e60b7=fs[_0x5378('0x5e')](path[_0x5378('0x5f')](config[_0x5378('0x60')],_0x5378('0x67')),'utf8');var _0x4a99d3=ejs[_0x5378('0x62')](_0x5e60b7,{'networks':_0x3115e6||[]});fs['writeFileSync'](_0x5378('0x6f'),_0x4a99d3);return respondWithRpcPromise('Reload','update',{'module':'res_stun_monitor.so'});}else{var _0x2272d3=fs[_0x5378('0x5e')](path['join'](config['root'],_0x5378('0x70')),'utf8');var _0xc9a8f5=ejs[_0x5378('0x62')](_0x2272d3,{'networks':_0x3115e6||[]});fs['writeFileSync'](util[_0x5378('0x71')](_0x5378('0x69'),_0x4a369a[_0x5378('0x5c')][_0x5378('0x4f')][_0x5378('0x6a')]()),_0xc9a8f5);return respondWithRpcPromise(_0x5378('0x65'),_0x5378('0x6b'),{'module':'chan_sip.so'});}return null;})[_0x5378('0x21')](function(_0x168dc0){if(_0x168dc0){return _0x14288a;}return null;});})[_0x5378('0x21')](respondWithResult(_0x1826e6,null))[_0x5378('0x2c')](handleError(_0x1826e6,null));};exports['destroy']=function(_0xa1ee85,_0x1b5d6c,_0x1aef48){var _0x2b525f;return db[_0x5378('0x3d')][_0x5378('0x6c')]({'where':{'id':_0xa1ee85[_0x5378('0x56')]['id']}})[_0x5378('0x21')](function(_0x4ac290){_0x2b525f=_0x4ac290;return _0x4ac290;})[_0x5378('0x21')](handleEntityNotFound(_0x1b5d6c,null))[_0x5378('0x21')](removeEntity(_0x1b5d6c,null))['then'](function(){if(_0x2b525f){return db['Network'][_0x5378('0x53')]({'where':{'type':_0x2b525f[_0x5378('0x4f')]},'raw':!![]});}})['then'](function(_0x17ff8c){if(_0x2b525f[_0x5378('0x4f')][_0x5378('0x6d')]()==_0x5378('0x5d')){var _0x305dce=fs[_0x5378('0x5e')](path[_0x5378('0x5f')](config[_0x5378('0x60')],_0x5378('0x6e')),_0x5378('0x61'));var _0x1b23aa=ejs[_0x5378('0x62')](_0x305dce,{'networks':_0x17ff8c||[]});fs[_0x5378('0x63')](_0x5378('0x64'),_0x1b23aa);return respondWithRpcPromise(_0x5378('0x65'),_0x5378('0x38'),{'module':_0x5378('0x68')});}else if(_0x2b525f['type'][_0x5378('0x6d')]()==_0x5378('0x66')){var _0x32fd3b=fs[_0x5378('0x5e')](path[_0x5378('0x5f')](config[_0x5378('0x60')],'server/files/templates/turn_multiple.ejs'),_0x5378('0x61'));var _0x1a0068=ejs[_0x5378('0x62')](_0x32fd3b,{'networks':_0x17ff8c||[]});fs[_0x5378('0x63')](_0x5378('0x6f'),_0x1a0068);return respondWithRpcPromise(_0x5378('0x65'),'destroy',{'module':_0x5378('0x68')});}else{var _0x3f4d36=fs['readFileSync'](path[_0x5378('0x5f')](config[_0x5378('0x60')],_0x5378('0x70')),_0x5378('0x61'));var _0x3f4a9e=ejs['render'](_0x3f4d36,{'networks':_0x17ff8c||[]});fs[_0x5378('0x63')](util[_0x5378('0x71')](_0x5378('0x69'),_0xa1ee85[_0x5378('0x5c')][_0x5378('0x4f')][_0x5378('0x6a')]()),_0x3f4a9e);return respondWithRpcPromise('Reload',_0x5378('0x38'),{'module':_0x5378('0x72')});}return null;})[_0x5378('0x2c')](handleError(_0x1b5d6c,null));}; \ No newline at end of file +var _0xf5f5=['findAll','rows','include','find','create','transaction','body','readFileSync','join','writeFileSync','/etc/asterisk/stun_xcally.conf','root','server/files/templates/turn_multiple.ejs','utf8','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','server/files/templates/network.ejs','chan_sip.so','update','sequelize','params','toUpperCase','server/files/templates/stun_multiple.ejs','Reload','TURN','render','/etc/asterisk/sip_xcally_%s.conf','STUN','destroy','format','toLowerCase','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','jayson/promise','client','http','test','Sequelize','ValidationError','info','debug','request\x20sent','stringify','error','code','Network,\x20%s,\x20%s','message','catch','status','end','count','offset','limit','set','Content-Range','json','apply','save','then','sendStatus','stack','send','index','rawAttributes','fieldName','type','key','name','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','Network'];(function(_0x5d5bde,_0x3d4be0){var _0x38a9d3=function(_0x5c3cc5){while(--_0x5c3cc5){_0x5d5bde['push'](_0x5d5bde['shift']());}};_0x38a9d3(++_0x3d4be0);}(_0xf5f5,0xf5));var _0x5f5f=function(_0x529eee,_0x311ed0){_0x529eee=_0x529eee-0x0;var _0x5edb8a=_0xf5f5[_0x529eee];return _0x5edb8a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5f5f('0x0'));var rimraf=require(_0x5f5f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5f5f('0x2'));var rp=require(_0x5f5f('0x3'));var moment=require('moment');var BPromise=require(_0x5f5f('0x4'));var Mustache=require(_0x5f5f('0x5'));var util=require(_0x5f5f('0x6'));var path=require(_0x5f5f('0x7'));var sox=require(_0x5f5f('0x8'));var csv=require(_0x5f5f('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5f5f('0xa'));var squel=require(_0x5f5f('0xb'));var crypto=require(_0x5f5f('0xc'));var jsforce=require(_0x5f5f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5f5f('0x9'));var querystring=require(_0x5f5f('0xe'));var Papa=require('papaparse');var Redis=require(_0x5f5f('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5f5f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5f5f('0x11'));var utils=require(_0x5f5f('0x12'));var config=require(_0x5f5f('0x13'));var db=require('../../mysqldb')['db'];var jayson=require(_0x5f5f('0x14'));var client=jayson[_0x5f5f('0x15')][_0x5f5f('0x16')]({'port':0x232a});function checkPasswordPattern(_0x1abf9d,_0x10ffd7,_0x248773){if(_0x248773){var _0x1ed2f2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1ed2f2[_0x5f5f('0x17')](_0x10ffd7)){return _0x1abf9d;}else{throw new db[(_0x5f5f('0x18'))][(_0x5f5f('0x19'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x1abf9d;}}function respondWithRpcPromise(_0x4048ee,_0x5d12a9,_0x46cef4,_0x26e093){return new BPromise(function(_0x1ccd83,_0x422727){var _0x2a2403=_0x26e093||client;return _0x2a2403['request'](_0x4048ee,_0x46cef4)['then'](function(_0x5bbfd3){logger[_0x5f5f('0x1a')]('Network,\x20%s,\x20%s',_0x5d12a9,'request\x20sent');logger[_0x5f5f('0x1b')]('Network,\x20%s,\x20%s,\x20%s',_0x5d12a9,_0x5f5f('0x1c'),JSON[_0x5f5f('0x1d')](_0x5bbfd3));if(_0x5bbfd3['error']){if(_0x5bbfd3[_0x5f5f('0x1e')][_0x5f5f('0x1f')]===0x1f4){logger[_0x5f5f('0x1e')](_0x5f5f('0x20'),_0x5d12a9,_0x5bbfd3[_0x5f5f('0x1e')]['message']);return _0x422727(_0x5bbfd3[_0x5f5f('0x1e')]['message']);}logger[_0x5f5f('0x1e')](_0x5f5f('0x20'),_0x5d12a9,_0x5bbfd3[_0x5f5f('0x1e')]['message']);return _0x1ccd83(_0x5bbfd3['error'][_0x5f5f('0x21')]);}else{logger[_0x5f5f('0x1a')](_0x5f5f('0x20'),_0x5d12a9,'request\x20sent');_0x1ccd83(_0x5bbfd3['result']['message']);}})[_0x5f5f('0x22')](function(_0x384386){logger[_0x5f5f('0x1e')](_0x5f5f('0x20'),_0x5d12a9,_0x384386);_0x422727(_0x384386);});});}function respondWithStatusCode(_0x30ca36,_0x51f6b9){_0x51f6b9=_0x51f6b9||0xcc;return function(_0x2c5f0c){if(_0x2c5f0c){return _0x30ca36['sendStatus'](_0x51f6b9);}return _0x30ca36[_0x5f5f('0x23')](_0x51f6b9)[_0x5f5f('0x24')]();};}function respondWithResult(_0x3c5f37,_0x3c1b01){_0x3c1b01=_0x3c1b01||0xc8;return function(_0x22925f){if(_0x22925f){return _0x3c5f37[_0x5f5f('0x23')](_0x3c1b01)['json'](_0x22925f);}};}function respondWithFilteredResult(_0x5ece53,_0x4253e2){return function(_0x447120){if(_0x447120){var _0x93300d=_0x447120[_0x5f5f('0x25')],_0x131e47=_0x4253e2[_0x5f5f('0x26')],_0x30c6ee=_0x4253e2['offset']+_0x4253e2[_0x5f5f('0x27')],_0x28b6f8;if(_0x30c6ee>=_0x93300d){_0x30c6ee=_0x93300d;_0x28b6f8=0xc8;}else{_0x28b6f8=0xce;}_0x5ece53['status'](_0x28b6f8);return _0x5ece53[_0x5f5f('0x28')](_0x5f5f('0x29'),_0x131e47+'-'+_0x30c6ee+'/'+_0x93300d)[_0x5f5f('0x2a')](_0x447120);}return null;};}function patchUpdates(_0x48e049){return function(_0x179f8a){try{jsonpatch[_0x5f5f('0x2b')](_0x179f8a,_0x48e049,!![]);}catch(_0x321ce3){return BPromise['reject'](_0x321ce3);}return _0x179f8a[_0x5f5f('0x2c')]();};}function saveUpdates(_0x5b172b,_0x410131){return function(_0x481f4e){if(_0x481f4e){return _0x481f4e['update'](_0x5b172b)[_0x5f5f('0x2d')](function(_0x1bb8f5){return _0x1bb8f5;});}return null;};}function removeEntity(_0x27ad30,_0x3c8abe){return function(_0x23ff76){if(_0x23ff76){return _0x23ff76['destroy']()[_0x5f5f('0x2d')](function(){_0x27ad30['status'](0xcc)[_0x5f5f('0x24')]();});}};}function handleEntityNotFound(_0x209f77,_0x50762d){return function(_0x364a96){if(!_0x364a96){_0x209f77[_0x5f5f('0x2e')](0x194);}return _0x364a96;};}function handleError(_0x43fa96,_0x41dd1b){_0x41dd1b=_0x41dd1b||0x1f4;return function(_0x96d76c){logger[_0x5f5f('0x1e')](_0x96d76c[_0x5f5f('0x2f')]);if(_0x96d76c['name']){delete _0x96d76c['name'];}_0x43fa96[_0x5f5f('0x23')](_0x41dd1b)[_0x5f5f('0x30')](_0x96d76c);};}exports[_0x5f5f('0x31')]=function(_0x29c98c,_0x1bf8e3){var _0x237ea7={},_0x163d5f={},_0x4b0a83={'count':0x0,'rows':[]};var _0x5ca21c=_['map'](db['Network'][_0x5f5f('0x32')],function(_0x7d463b){return{'name':_0x7d463b[_0x5f5f('0x33')],'type':_0x7d463b[_0x5f5f('0x34')][_0x5f5f('0x35')]};});_0x163d5f['model']=_['map'](_0x5ca21c,_0x5f5f('0x36'));_0x163d5f[_0x5f5f('0x37')]=_[_0x5f5f('0x38')](_0x29c98c['query']);_0x163d5f[_0x5f5f('0x39')]=_['intersection'](_0x163d5f[_0x5f5f('0x3a')],_0x163d5f[_0x5f5f('0x37')]);_0x237ea7[_0x5f5f('0x3b')]=_[_0x5f5f('0x3c')](_0x163d5f[_0x5f5f('0x3a')],qs[_0x5f5f('0x3d')](_0x29c98c[_0x5f5f('0x37')][_0x5f5f('0x3d')]));_0x237ea7['attributes']=_0x237ea7[_0x5f5f('0x3b')][_0x5f5f('0x3e')]?_0x237ea7[_0x5f5f('0x3b')]:_0x163d5f[_0x5f5f('0x3a')];if(!_0x29c98c[_0x5f5f('0x37')][_0x5f5f('0x3f')](_0x5f5f('0x40'))){_0x237ea7['limit']=qs[_0x5f5f('0x27')](_0x29c98c[_0x5f5f('0x37')]['limit']);_0x237ea7[_0x5f5f('0x26')]=qs[_0x5f5f('0x26')](_0x29c98c[_0x5f5f('0x37')][_0x5f5f('0x26')]);}_0x237ea7[_0x5f5f('0x41')]=qs[_0x5f5f('0x42')](_0x29c98c[_0x5f5f('0x37')][_0x5f5f('0x42')]);_0x237ea7[_0x5f5f('0x43')]=qs[_0x5f5f('0x39')](_[_0x5f5f('0x44')](_0x29c98c['query'],_0x163d5f[_0x5f5f('0x39')]),_0x5ca21c);if(_0x29c98c[_0x5f5f('0x37')][_0x5f5f('0x45')]){_0x237ea7[_0x5f5f('0x43')]=_[_0x5f5f('0x46')](_0x237ea7['where'],{'$or':_[_0x5f5f('0x47')](_0x5ca21c,function(_0x3b15e9){if(_0x3b15e9[_0x5f5f('0x34')]!==_0x5f5f('0x48')){var _0x5bb77b={};_0x5bb77b[_0x3b15e9['name']]={'$like':'%'+_0x29c98c[_0x5f5f('0x37')][_0x5f5f('0x45')]+'%'};return _0x5bb77b;}})});}_0x237ea7=_[_0x5f5f('0x46')]({},_0x237ea7,_0x29c98c[_0x5f5f('0x49')]);var _0x157757={'where':_0x237ea7[_0x5f5f('0x43')]};return db['Network'][_0x5f5f('0x25')](_0x157757)[_0x5f5f('0x2d')](function(_0x1ce03d){_0x4b0a83['count']=_0x1ce03d;if(_0x29c98c['query'][_0x5f5f('0x4a')]){_0x237ea7['include']=[{'all':!![]}];}return db[_0x5f5f('0x4b')][_0x5f5f('0x4c')](_0x237ea7);})[_0x5f5f('0x2d')](function(_0xa56bd3){_0x4b0a83[_0x5f5f('0x4d')]=_0xa56bd3;return _0x4b0a83;})[_0x5f5f('0x2d')](respondWithFilteredResult(_0x1bf8e3,_0x237ea7))[_0x5f5f('0x22')](handleError(_0x1bf8e3,null));};exports['show']=function(_0x9d0d89,_0x1b1046){var _0x3e5d80={'raw':!![],'where':{'id':_0x9d0d89['params']['id']}},_0x50ae00={};_0x50ae00[_0x5f5f('0x3a')]=_['keys'](db[_0x5f5f('0x4b')][_0x5f5f('0x32')]);_0x50ae00[_0x5f5f('0x37')]=_[_0x5f5f('0x38')](_0x9d0d89[_0x5f5f('0x37')]);_0x50ae00['filters']=_[_0x5f5f('0x3c')](_0x50ae00['model'],_0x50ae00['query']);_0x3e5d80[_0x5f5f('0x3b')]=_[_0x5f5f('0x3c')](_0x50ae00['model'],qs['fields'](_0x9d0d89['query'][_0x5f5f('0x3d')]));_0x3e5d80[_0x5f5f('0x3b')]=_0x3e5d80[_0x5f5f('0x3b')][_0x5f5f('0x3e')]?_0x3e5d80[_0x5f5f('0x3b')]:_0x50ae00[_0x5f5f('0x3a')];if(_0x9d0d89[_0x5f5f('0x37')][_0x5f5f('0x4a')]){_0x3e5d80[_0x5f5f('0x4e')]=[{'all':!![]}];}_0x3e5d80=_[_0x5f5f('0x46')]({},_0x3e5d80,_0x9d0d89[_0x5f5f('0x49')]);return db[_0x5f5f('0x4b')][_0x5f5f('0x4f')](_0x3e5d80)['then'](handleEntityNotFound(_0x1b1046,null))[_0x5f5f('0x2d')](respondWithResult(_0x1b1046,null))['catch'](handleError(_0x1b1046,null));};exports[_0x5f5f('0x50')]=function(_0x4f86f2,_0x5d5983,_0x2e07cf){var _0x316e24;return db['sequelize'][_0x5f5f('0x51')](function(_0x4817c5){return db['Network'][_0x5f5f('0x50')](_0x4f86f2[_0x5f5f('0x52')],{'raw':!![]})['then'](function(_0x158496){_0x316e24=_0x158496;return db[_0x5f5f('0x4b')][_0x5f5f('0x4c')]({'where':{'type':_0x4f86f2[_0x5f5f('0x52')][_0x5f5f('0x34')]},'raw':!![]});})[_0x5f5f('0x2d')](function(_0x3995d1){if(_0x316e24[_0x5f5f('0x34')]['toUpperCase']()=='STUN'){var _0x31feaa=fs[_0x5f5f('0x53')](path[_0x5f5f('0x54')](config['root'],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x503f30=ejs['render'](_0x31feaa,{'networks':_0x3995d1||[]});fs[_0x5f5f('0x55')](_0x5f5f('0x56'),_0x503f30);return respondWithRpcPromise('Reload',_0x5f5f('0x50'),{'module':'res_stun_monitor.so'});}else if(_0x316e24['type']['toUpperCase']()=='TURN'){var _0x228f57=fs['readFileSync'](path[_0x5f5f('0x54')](config[_0x5f5f('0x57')],_0x5f5f('0x58')),_0x5f5f('0x59'));var _0x45e46e=ejs['render'](_0x228f57,{'networks':_0x3995d1||[]});fs[_0x5f5f('0x55')](_0x5f5f('0x5a'),_0x45e46e);return respondWithRpcPromise('Reload',_0x5f5f('0x50'),{'module':_0x5f5f('0x5b')});}else{var _0x4937bf=fs[_0x5f5f('0x53')](path[_0x5f5f('0x54')](config[_0x5f5f('0x57')],_0x5f5f('0x5c')),_0x5f5f('0x59'));var _0x2bc820=ejs['render'](_0x4937bf,{'networks':_0x3995d1||[]});fs['writeFileSync'](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x4f86f2[_0x5f5f('0x52')][_0x5f5f('0x34')]['toLowerCase']()),_0x2bc820);return respondWithRpcPromise('Reload','create',{'module':_0x5f5f('0x5d')});}return null;})[_0x5f5f('0x2d')](function(){return _0x316e24;});})[_0x5f5f('0x2d')](respondWithResult(_0x5d5983,0xc9))['catch'](handleError(_0x5d5983,null));};exports[_0x5f5f('0x5e')]=function(_0x20f2cc,_0x26f7fd,_0x13e869){var _0x206f19;return db[_0x5f5f('0x5f')][_0x5f5f('0x51')](function(_0x24bbb6){return db[_0x5f5f('0x4b')][_0x5f5f('0x4f')]({'where':{'id':_0x20f2cc[_0x5f5f('0x60')]['id']}})['then'](handleEntityNotFound(_0x26f7fd,null))[_0x5f5f('0x2d')](saveUpdates(_0x20f2cc[_0x5f5f('0x52')],null))[_0x5f5f('0x2d')](function(_0x322369){if(_0x322369){_0x206f19=_0x322369;return db[_0x5f5f('0x4b')]['findAll']({'where':{'type':_0x206f19[_0x5f5f('0x34')]},'raw':!![]});}return null;})[_0x5f5f('0x2d')](function(_0x42a6bd){if(_0x206f19[_0x5f5f('0x34')][_0x5f5f('0x61')]()=='STUN'){var _0x5c7748=fs[_0x5f5f('0x53')](path['join'](config[_0x5f5f('0x57')],_0x5f5f('0x62')),_0x5f5f('0x59'));var _0x16c6ff=ejs['render'](_0x5c7748,{'networks':_0x42a6bd||[]});fs[_0x5f5f('0x55')](_0x5f5f('0x56'),_0x16c6ff);return respondWithRpcPromise(_0x5f5f('0x63'),_0x5f5f('0x5e'),{'module':_0x5f5f('0x5b')});}else if(_0x206f19['type'][_0x5f5f('0x61')]()==_0x5f5f('0x64')){var _0x48364e=fs[_0x5f5f('0x53')](path[_0x5f5f('0x54')](config[_0x5f5f('0x57')],_0x5f5f('0x58')),'utf8');var _0x1b042e=ejs[_0x5f5f('0x65')](_0x48364e,{'networks':_0x42a6bd||[]});fs['writeFileSync'](_0x5f5f('0x5a'),_0x1b042e);return respondWithRpcPromise('Reload',_0x5f5f('0x5e'),{'module':_0x5f5f('0x5b')});}else{var _0x452764=fs[_0x5f5f('0x53')](path['join'](config[_0x5f5f('0x57')],_0x5f5f('0x5c')),_0x5f5f('0x59'));var _0x549a44=ejs[_0x5f5f('0x65')](_0x452764,{'networks':_0x42a6bd||[]});fs[_0x5f5f('0x55')](util['format'](_0x5f5f('0x66'),_0x20f2cc[_0x5f5f('0x52')]['type']['toLowerCase']()),_0x549a44);return respondWithRpcPromise(_0x5f5f('0x63'),_0x5f5f('0x5e'),{'module':_0x5f5f('0x5d')});}return null;})['then'](function(_0x45b56e){if(_0x45b56e){return _0x206f19;}return null;});})['then'](respondWithResult(_0x26f7fd,null))['catch'](handleError(_0x26f7fd,null));};exports['destroy']=function(_0x6b0b3a,_0x53f3d2,_0xf91bd5){var _0x532c98;return db[_0x5f5f('0x4b')][_0x5f5f('0x4f')]({'where':{'id':_0x6b0b3a['params']['id']}})['then'](function(_0x4318f8){_0x532c98=_0x4318f8;return _0x4318f8;})[_0x5f5f('0x2d')](handleEntityNotFound(_0x53f3d2,null))['then'](removeEntity(_0x53f3d2,null))[_0x5f5f('0x2d')](function(){if(_0x532c98){return db[_0x5f5f('0x4b')][_0x5f5f('0x4c')]({'where':{'type':_0x532c98[_0x5f5f('0x34')]},'raw':!![]});}})[_0x5f5f('0x2d')](function(_0xb2839d){if(_0x532c98[_0x5f5f('0x34')][_0x5f5f('0x61')]()==_0x5f5f('0x67')){var _0x160d25=fs[_0x5f5f('0x53')](path['join'](config[_0x5f5f('0x57')],_0x5f5f('0x62')),_0x5f5f('0x59'));var _0x440890=ejs['render'](_0x160d25,{'networks':_0xb2839d||[]});fs[_0x5f5f('0x55')](_0x5f5f('0x56'),_0x440890);return respondWithRpcPromise('Reload',_0x5f5f('0x68'),{'module':'res_stun_monitor.so'});}else if(_0x532c98[_0x5f5f('0x34')][_0x5f5f('0x61')]()==_0x5f5f('0x64')){var _0x25671c=fs[_0x5f5f('0x53')](path['join'](config[_0x5f5f('0x57')],_0x5f5f('0x58')),'utf8');var _0x1946a4=ejs[_0x5f5f('0x65')](_0x25671c,{'networks':_0xb2839d||[]});fs[_0x5f5f('0x55')]('/etc/asterisk/turn_xcally.conf',_0x1946a4);return respondWithRpcPromise(_0x5f5f('0x63'),_0x5f5f('0x68'),{'module':_0x5f5f('0x5b')});}else{var _0x5f1784=fs[_0x5f5f('0x53')](path[_0x5f5f('0x54')](config[_0x5f5f('0x57')],_0x5f5f('0x5c')),'utf8');var _0x2312fa=ejs[_0x5f5f('0x65')](_0x5f1784,{'networks':_0xb2839d||[]});fs['writeFileSync'](util[_0x5f5f('0x69')]('/etc/asterisk/sip_xcally_%s.conf',_0x6b0b3a['body']['type'][_0x5f5f('0x6a')]()),_0x2312fa);return respondWithRpcPromise(_0x5f5f('0x63'),_0x5f5f('0x68'),{'module':'chan_sip.so'});}return null;})['catch'](handleError(_0x53f3d2,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index e9d23c6..8b5b739 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 _0x1bcd=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./network.attributes','define','Network','network','lodash'];(function(_0x52dff6,_0x71a84){var _0x21224c=function(_0x1b19f8){while(--_0x1b19f8){_0x52dff6['push'](_0x52dff6['shift']());}};_0x21224c(++_0x71a84);}(_0x1bcd,0x1a3));var _0xd1bc=function(_0x463c54,_0x38fa0f){_0x463c54=_0x463c54-0x0;var _0x2af370=_0x1bcd[_0x463c54];return _0x2af370;};'use strict';var _=require(_0xd1bc('0x0'));var util=require('util');var logger=require(_0xd1bc('0x1'))(_0xd1bc('0x2'));var moment=require(_0xd1bc('0x3'));var BPromise=require(_0xd1bc('0x4'));var rp=require(_0xd1bc('0x5'));var fs=require('fs');var path=require(_0xd1bc('0x6'));var rimraf=require('rimraf');var config=require(_0xd1bc('0x7'));var attributes=require(_0xd1bc('0x8'));module['exports']=function(_0x5d1b3e,_0x4f3d08){return _0x5d1b3e[_0xd1bc('0x9')](_0xd1bc('0xa'),attributes,{'tableName':_0xd1bc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1994=['network','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./network.attributes','exports','define','Network'];(function(_0x4725be,_0x42103a){var _0x17f89d=function(_0x32a708){while(--_0x32a708){_0x4725be['push'](_0x4725be['shift']());}};_0x17f89d(++_0x42103a);}(_0x1994,0x1ae));var _0x4199=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1994[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4199('0x0'))(_0x4199('0x1'));var moment=require('moment');var BPromise=require(_0x4199('0x2'));var rp=require(_0x4199('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4199('0x4'));var config=require(_0x4199('0x5'));var attributes=require(_0x4199('0x6'));module[_0x4199('0x7')]=function(_0x488537,_0x210143){return _0x488537[_0x4199('0x8')](_0x4199('0x9'),attributes,{'tableName':_0x4199('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 5b40f60..4f86984 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 _0xd5c0=['request','then','info','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','Network,\x20%s,\x20%s','message','request\x20sent','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http'];(function(_0x28c294,_0x30b186){var _0x2481fc=function(_0xb856c4){while(--_0xb856c4){_0x28c294['push'](_0x28c294['shift']());}};_0x2481fc(++_0x30b186);}(_0xd5c0,0x1c5));var _0x0d5c=function(_0x481bdf,_0x231538){_0x481bdf=_0x481bdf-0x0;var _0x281a12=_0xd5c0[_0x481bdf];return _0x281a12;};'use strict';var _=require('lodash');var util=require(_0x0d5c('0x0'));var moment=require('moment');var BPromise=require(_0x0d5c('0x1'));var rs=require(_0x0d5c('0x2'));var fs=require('fs');var Redis=require(_0x0d5c('0x3'));var db=require(_0x0d5c('0x4'))['db'];var utils=require(_0x0d5c('0x5'));var logger=require(_0x0d5c('0x6'))('rpc');var config=require(_0x0d5c('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0d5c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x161e69,_0x1b6162,_0x27ea98){return new BPromise(function(_0x5c9192,_0x447310){return client[_0x0d5c('0x9')](_0x161e69,_0x27ea98)[_0x0d5c('0xa')](function(_0x22f746){logger[_0x0d5c('0xb')]('Network,\x20%s,\x20%s',_0x1b6162,'request\x20sent');logger[_0x0d5c('0xc')](_0x0d5c('0xd'),_0x1b6162,'request\x20sent',JSON[_0x0d5c('0xe')](_0x22f746));if(_0x22f746[_0x0d5c('0xf')]){if(_0x22f746[_0x0d5c('0xf')][_0x0d5c('0x10')]===0x1f4){logger['error'](_0x0d5c('0x11'),_0x1b6162,_0x22f746['error'][_0x0d5c('0x12')]);return _0x447310(_0x22f746[_0x0d5c('0xf')][_0x0d5c('0x12')]);}logger[_0x0d5c('0xf')]('Network,\x20%s,\x20%s',_0x1b6162,_0x22f746['error'][_0x0d5c('0x12')]);return _0x5c9192(_0x22f746['error']['message']);}else{logger[_0x0d5c('0xb')](_0x0d5c('0x11'),_0x1b6162,_0x0d5c('0x13'));_0x5c9192(_0x22f746['result'][_0x0d5c('0x12')]);}})[_0x0d5c('0x14')](function(_0x4cbc1d){logger[_0x0d5c('0xf')](_0x0d5c('0x11'),_0x1b6162,_0x4cbc1d);_0x447310(_0x4cbc1d);});});} \ No newline at end of file +var _0xb1ba=['../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','ioredis'];(function(_0x14ec49,_0x37aa20){var _0x5dfbe7=function(_0x59c48e){while(--_0x59c48e){_0x14ec49['push'](_0x14ec49['shift']());}};_0x5dfbe7(++_0x37aa20);}(_0xb1ba,0x18b));var _0xab1b=function(_0xe926f1,_0xeb7210){_0xe926f1=_0xe926f1-0x0;var _0x5d3188=_0xb1ba[_0xe926f1];return _0x5d3188;};'use strict';var _=require(_0xab1b('0x0'));var util=require(_0xab1b('0x1'));var moment=require(_0xab1b('0x2'));var BPromise=require(_0xab1b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xab1b('0x4'));var db=require(_0xab1b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xab1b('0x6'))(_0xab1b('0x7'));var config=require(_0xab1b('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xab1b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x426ca1,_0x24712b,_0x5d38bd){return new BPromise(function(_0x9454c7,_0x52880b){return client[_0xab1b('0xa')](_0x426ca1,_0x5d38bd)[_0xab1b('0xb')](function(_0x2c31ed){logger[_0xab1b('0xc')](_0xab1b('0xd'),_0x24712b,_0xab1b('0xe'));logger['debug'](_0xab1b('0xf'),_0x24712b,_0xab1b('0xe'),JSON[_0xab1b('0x10')](_0x2c31ed));if(_0x2c31ed[_0xab1b('0x11')]){if(_0x2c31ed['error'][_0xab1b('0x12')]===0x1f4){logger['error'](_0xab1b('0xd'),_0x24712b,_0x2c31ed[_0xab1b('0x11')]['message']);return _0x52880b(_0x2c31ed['error'][_0xab1b('0x13')]);}logger['error'](_0xab1b('0xd'),_0x24712b,_0x2c31ed[_0xab1b('0x11')][_0xab1b('0x13')]);return _0x9454c7(_0x2c31ed[_0xab1b('0x11')][_0xab1b('0x13')]);}else{logger['info']('Network,\x20%s,\x20%s',_0x24712b,'request\x20sent');_0x9454c7(_0x2c31ed['result'][_0xab1b('0x13')]);}})['catch'](function(_0x20dfb4){logger[_0xab1b('0x11')](_0xab1b('0xd'),_0x24712b,_0x20dfb4);_0x52880b(_0x20dfb4);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index 52a36c6..7dc1341 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 _0x4fbf=['isAuthenticated','sendNotification','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./notification.controller','post'];(function(_0x3f32ae,_0x2cd2ef){var _0xdab85e=function(_0x27ccf3){while(--_0x27ccf3){_0x3f32ae['push'](_0x3f32ae['shift']());}};_0xdab85e(++_0x2cd2ef);}(_0x4fbf,0xc0));var _0xf4fb=function(_0x3b5836,_0x36f889){_0x3b5836=_0x3b5836-0x0;var _0x568f46=_0x4fbf[_0x3b5836];return _0x568f46;};'use strict';var multer=require(_0xf4fb('0x0'));var util=require(_0xf4fb('0x1'));var path=require('path');var timeout=require(_0xf4fb('0x2'));var express=require('express');var router=express[_0xf4fb('0x3')]();var auth=require(_0xf4fb('0x4'));var interaction=require(_0xf4fb('0x5'));var config=require('../../config/environment');var controller=require(_0xf4fb('0x6'));router[_0xf4fb('0x7')]('/',auth[_0xf4fb('0x8')](),controller[_0xf4fb('0x9')]);module['exports']=router; \ No newline at end of file +var _0x6b71=['../../components/interaction/service','../../config/environment','isAuthenticated','sendNotification','multer','util','path','connect-timeout','express'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6b71,0x12d));var _0x16b7=function(_0x201583,_0x5e64fc){_0x201583=_0x201583-0x0;var _0x4cb47f=_0x6b71[_0x201583];return _0x4cb47f;};'use strict';var multer=require(_0x16b7('0x0'));var util=require(_0x16b7('0x1'));var path=require(_0x16b7('0x2'));var timeout=require(_0x16b7('0x3'));var express=require(_0x16b7('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x16b7('0x5'));var config=require(_0x16b7('0x6'));var controller=require('./notification.controller');router['post']('/',auth[_0x16b7('0x7')](),controller[_0x16b7('0x8')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index c1827b2..63d8f9c 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 _0x7f7a=['exports','STRING','TEXT','sequelize'];(function(_0x2f0e84,_0x50db02){var _0x17e1a1=function(_0x57edbc){while(--_0x57edbc){_0x2f0e84['push'](_0x2f0e84['shift']());}};_0x17e1a1(++_0x50db02);}(_0x7f7a,0x1bf));var _0xa7f7=function(_0x3e38f2,_0x1561fd){_0x3e38f2=_0x3e38f2-0x0;var _0x470c0b=_0x7f7a[_0x3e38f2];return _0x470c0b;};'use strict';var Sequelize=require(_0xa7f7('0x0'));module[_0xa7f7('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0xa7f7('0x2')]},'recipientsId':{'type':Sequelize[_0xa7f7('0x3')]},'recipientsDescription':{'type':Sequelize[_0xa7f7('0x2')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0x263b=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x587fb5,_0x59cb3b){var _0x551105=function(_0x5bbef4){while(--_0x5bbef4){_0x587fb5['push'](_0x587fb5['shift']());}};_0x551105(++_0x59cb3b);}(_0x263b,0x1c5));var _0xb263=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x263b[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0xb263('0x0'));module[_0xb263('0x1')]={'body':{'type':Sequelize[_0xb263('0x2')]},'senderName':{'type':Sequelize[_0xb263('0x3')]},'recipientsId':{'type':Sequelize[_0xb263('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0xb263('0x4')]}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index 600a8c1..1cf2097 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 _0x4f3b=['destroy','error','stack','send','hasOwnProperty','text','body','TemplateId','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','ValidationError','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','recipientsDescription','isEmpty','beep','SenderId','then','recipientsId','sortBy','join','sequelize','Notification','create','recipient','emit','notification:send','Template','findOne','html','render','catch','forEach','User','ids','queue','replace','Queue','union','flatten','map','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update'];(function(_0x24b722,_0x1958fd){var _0x43ebba=function(_0xe22539){while(--_0xe22539){_0x24b722['push'](_0x24b722['shift']());}};_0x43ebba(++_0x1958fd);}(_0x4f3b,0xf4));var _0xb4f3=function(_0x34f701,_0x37e407){_0x34f701=_0x34f701-0x0;var _0x3e2429=_0x4f3b[_0x34f701];return _0x3e2429;};'use strict';var pdf=require(_0xb4f3('0x0'));var emlformat=require(_0xb4f3('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb4f3('0x2'));var jsonpatch=require(_0xb4f3('0x3'));var rp=require('request-promise');var moment=require(_0xb4f3('0x4'));var BPromise=require(_0xb4f3('0x5'));var Mustache=require(_0xb4f3('0x6'));var util=require(_0xb4f3('0x7'));var path=require(_0xb4f3('0x8'));var sox=require(_0xb4f3('0x9'));var csv=require(_0xb4f3('0xa'));var ejs=require(_0xb4f3('0xb'));var fs=require('fs');var _=require(_0xb4f3('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb4f3('0xa'));var querystring=require(_0xb4f3('0xd'));var Papa=require(_0xb4f3('0xe'));var Redis=require(_0xb4f3('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb4f3('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb4f3('0x11'));var logger=require(_0xb4f3('0x12'))(_0xb4f3('0x13'));var utils=require('../../config/utils');var config=require(_0xb4f3('0x14'));var db=require(_0xb4f3('0x15'))['db'];config[_0xb4f3('0x16')]=_[_0xb4f3('0x17')](config[_0xb4f3('0x16')],{'host':_0xb4f3('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb4f3('0x16')]));require('./notification.socket')[_0xb4f3('0x19')](socket);function respondWithStatusCode(_0x4c75d1,_0x25a73d){_0x25a73d=_0x25a73d||0xcc;return function(_0x2fcb34){if(_0x2fcb34){return _0x4c75d1[_0xb4f3('0x1a')](_0x25a73d);}return _0x4c75d1[_0xb4f3('0x1b')](_0x25a73d)[_0xb4f3('0x1c')]();};}function respondWithResult(_0x286547,_0x42d72c){_0x42d72c=_0x42d72c||0xc8;return function(_0x515cfe){if(_0x515cfe){return _0x286547[_0xb4f3('0x1b')](_0x42d72c)['json'](_0x515cfe);}};}function respondWithFilteredResult(_0x258677,_0x218663){return function(_0x3f54dd){if(_0x3f54dd){var _0x2c4177=_0x3f54dd[_0xb4f3('0x1d')],_0x52a6f9=_0x218663[_0xb4f3('0x1e')],_0x5387c7=_0x218663[_0xb4f3('0x1e')]+_0x218663[_0xb4f3('0x1f')],_0x3ce18e;if(_0x5387c7>=_0x2c4177){_0x5387c7=_0x2c4177;_0x3ce18e=0xc8;}else{_0x3ce18e=0xce;}_0x258677[_0xb4f3('0x1b')](_0x3ce18e);return _0x258677[_0xb4f3('0x20')]('Content-Range',_0x52a6f9+'-'+_0x5387c7+'/'+_0x2c4177)[_0xb4f3('0x21')](_0x3f54dd);}return null;};}function patchUpdates(_0x2ed8b2){return function(_0x17a4fb){try{jsonpatch[_0xb4f3('0x22')](_0x17a4fb,_0x2ed8b2,!![]);}catch(_0x53b1a2){return BPromise[_0xb4f3('0x23')](_0x53b1a2);}return _0x17a4fb[_0xb4f3('0x24')]();};}function saveUpdates(_0x4ab577,_0x4703f4){return function(_0x473931){if(_0x473931){return _0x473931[_0xb4f3('0x25')](_0x4ab577)['then'](function(_0x22fc24){return _0x22fc24;});}return null;};}function removeEntity(_0x547c3e,_0x427ece){return function(_0x44c764){if(_0x44c764){return _0x44c764[_0xb4f3('0x26')]()['then'](function(){_0x547c3e[_0xb4f3('0x1b')](0xcc)[_0xb4f3('0x1c')]();});}};}function handleEntityNotFound(_0x45b02a,_0x3fd4f6){return function(_0x40e9f7){if(!_0x40e9f7){_0x45b02a[_0xb4f3('0x1a')](0x194);}return _0x40e9f7;};}function handleError(_0x2edc15,_0x544c31){_0x544c31=_0x544c31||0x1f4;return function(_0x3c3f46){logger[_0xb4f3('0x27')](_0x3c3f46[_0xb4f3('0x28')]);if(_0x3c3f46['name']){delete _0x3c3f46['name'];}_0x2edc15[_0xb4f3('0x1b')](_0x544c31)[_0xb4f3('0x29')](_0x3c3f46);};}exports['sendNotification']=function(_0x40da45,_0x3207a5,_0x4b4621){if(!_0x40da45['body'][_0xb4f3('0x2a')](_0xb4f3('0x2b'))&&!_0x40da45[_0xb4f3('0x2c')][_0xb4f3('0x2a')](_0xb4f3('0x2d'))){throw new db['Sequelize']['ValidationError'](_0xb4f3('0x2e'));}else{if(_0x40da45[_0xb4f3('0x2c')][_0xb4f3('0x2a')](_0xb4f3('0x2d'))&&!_0x40da45[_0xb4f3('0x2c')][_0xb4f3('0x2a')](_0xb4f3('0x2f'))){throw new db[(_0xb4f3('0x30'))][(_0xb4f3('0x31'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x40da45[_0xb4f3('0x2c')][_0xb4f3('0x2a')]('recipients')){throw new db['Sequelize'][(_0xb4f3('0x31'))](_0xb4f3('0x32'));}else{try{var _0x4d4b7f=JSON[_0xb4f3('0x33')](_0x40da45[_0xb4f3('0x2c')]['recipients']);}catch(_0x32692e){logger[_0xb4f3('0x27')](_0x32692e);throw new db[(_0xb4f3('0x30'))]['ValidationError'](_0xb4f3('0x34'));}var _0x1d5fb5=[_0xb4f3('0x35'),'faxqueue','mailqueue',_0xb4f3('0x36'),_0xb4f3('0x37'),_0xb4f3('0x38'),_0xb4f3('0x39'),'team','user'];if(_[_0xb4f3('0x3a')](_0x4d4b7f,function(_0x579efd){return!_[_0xb4f3('0x3b')](_0x1d5fb5,_0x579efd[_0xb4f3('0x3c')][_0xb4f3('0x3d')]());})){throw new db[(_0xb4f3('0x30'))]['ValidationError'](_0xb4f3('0x3e'));}}}var _0x5d7fe7={};_0x5d7fe7['senderName']=_0x40da45['body'][_0xb4f3('0x2a')](_0xb4f3('0x3f'))?_0x40da45[_0xb4f3('0x2c')][_0xb4f3('0x3f')]:_0x40da45[_0xb4f3('0x40')][_0xb4f3('0x41')];_0x5d7fe7[_0xb4f3('0x42')]=_[_0xb4f3('0x43')](_0x40da45[_0xb4f3('0x2c')]['recipientsDescription'])?null:_0x40da45['body'][_0xb4f3('0x42')];_0x5d7fe7[_0xb4f3('0x44')]=_0x40da45['body'][_0xb4f3('0x44')]||![];_0x5d7fe7[_0xb4f3('0x45')]=_0x40da45[_0xb4f3('0x40')]['id'];return getContent(_0x40da45[_0xb4f3('0x2c')])['then'](function(_0x2ba93a){_0x5d7fe7[_0xb4f3('0x2c')]=_0x2ba93a;return getRecipients(_0x4d4b7f);})[_0xb4f3('0x46')](function(_0x588362){_0x5d7fe7[_0xb4f3('0x47')]=_[_0xb4f3('0x48')](_0x588362)[_0xb4f3('0x49')](',');return db[_0xb4f3('0x4a')]['transaction'](function(_0x1db86f){return db[_0xb4f3('0x4b')][_0xb4f3('0x4c')](_0x5d7fe7,{'raw':!![],'transaction':_0x1db86f})[_0xb4f3('0x46')](function(_0x5f25a1){var _0x3ce062={'sender':_0x5d7fe7['senderName'],'description':_0x5d7fe7[_0xb4f3('0x42')],'content':_0x5d7fe7[_0xb4f3('0x2c')],'beep':_0x5d7fe7['beep']};_0x588362['forEach'](function(_0x1efacd){_0x3ce062[_0xb4f3('0x4d')]=_0x1efacd;socket[_0xb4f3('0x4e')](_0xb4f3('0x4f'),_0x3ce062);});return _0x5f25a1;});});})[_0xb4f3('0x46')](respondWithResult(_0x3207a5,0xc9))['catch'](handleError(_0x3207a5,null));};function getContent(_0x1a5667){return new BPromise(function(_0x7b1dac,_0x2d42cb){if(_0x1a5667[_0xb4f3('0x2b')]){_0x7b1dac(_0x1a5667[_0xb4f3('0x2b')]);return;}return db[_0xb4f3('0x50')][_0xb4f3('0x51')]({'attributes':[_0xb4f3('0x52')],'where':{'id':_0x1a5667['TemplateId']},'raw':!![]})[_0xb4f3('0x46')](function(_0x206d7f){if(!_0x206d7f)throw new db['Sequelize']['ValidationError']('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x57f367=Mustache[_0xb4f3('0x53')](_0x206d7f[_0xb4f3('0x52')],_0x1a5667[_0xb4f3('0x2f')]);_0x7b1dac(_0x57f367);})[_0xb4f3('0x54')](function(_0x4b4b2a){_0x2d42cb(_0x4b4b2a);});});}function getRecipients(_0x10ce16){return new BPromise(function(_0x56d6c3,_0x32b84b){var _0x2d2858=[];var _0x1c9a9d=[];_0x10ce16[_0xb4f3('0x55')](function(_0xed112c){var _0x2547cc=_['startCase'](_0xed112c[_0xb4f3('0x3c')][_0xb4f3('0x3d')]());if(_0x2547cc===_0xb4f3('0x56')){_0x2d2858=_['union'](_0x2d2858,_0xed112c[_0xb4f3('0x57')]);}else{if(_[_0xb4f3('0x3b')](_0x2547cc,_0xb4f3('0x58')))_0x2547cc=_0x2547cc[_0xb4f3('0x59')]('queue',_0xb4f3('0x5a'));_0xed112c[_0xb4f3('0x57')][_0xb4f3('0x55')](function(_0x400396){_0x1c9a9d['push'](getAgents(_0x2547cc,_0x400396));});}});return BPromise['all'](_0x1c9a9d)[_0xb4f3('0x46')](function(_0x1eefc6){_0x2d2858=_[_0xb4f3('0x5b')](_0x2d2858,_[_0xb4f3('0x5c')](_0x1eefc6));_0x56d6c3(_0x2d2858);})[_0xb4f3('0x54')](function(_0x1957e8){_0x32b84b(_0x1957e8);});});}function getAgents(_0x2c6b3f,_0x3d2e45){return new BPromise(function(_0x527cb1,_0x15ff81){return db[_0x2c6b3f]['findOne']({'where':{'id':_0x3d2e45}})['then'](function(_0x50a135){return _0x50a135['getAgents']({'attributes':['id'],'raw':!![]})[_0xb4f3('0x46')](function(_0x5b657a){var _0x1ed463=_[_0xb4f3('0x5d')](_0x5b657a,'id');_0x527cb1(_0x1ed463);});})['catch'](function(_0x518482){_0x15ff81(_0x518482);});});} \ No newline at end of file +var _0xcb39=['SenderId','join','Notification','create','recipient','notification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','User','union','ids','includes','queue','replace','Queue','flatten','getAgents','map','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./notification.socket','register','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','sendNotification','hasOwnProperty','text','body','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','some','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','recipientsDescription','isEmpty','beep'];(function(_0x3ce2c4,_0x4544c1){var _0x4047c1=function(_0x3fece6){while(--_0x3fece6){_0x3ce2c4['push'](_0x3ce2c4['shift']());}};_0x4047c1(++_0x4544c1);}(_0xcb39,0x13d));var _0x9cb3=function(_0x57fa0b,_0x5df1ce){_0x57fa0b=_0x57fa0b-0x0;var _0x18669f=_0xcb39[_0x57fa0b];return _0x18669f;};'use strict';var pdf=require(_0x9cb3('0x0'));var emlformat=require(_0x9cb3('0x1'));var rimraf=require(_0x9cb3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9cb3('0x3'));var rp=require('request-promise');var moment=require(_0x9cb3('0x4'));var BPromise=require(_0x9cb3('0x5'));var Mustache=require(_0x9cb3('0x6'));var util=require('util');var path=require(_0x9cb3('0x7'));var sox=require(_0x9cb3('0x8'));var csv=require(_0x9cb3('0x9'));var ejs=require(_0x9cb3('0xa'));var fs=require('fs');var _=require(_0x9cb3('0xb'));var squel=require(_0x9cb3('0xc'));var crypto=require(_0x9cb3('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9cb3('0xe'));var Redis=require(_0x9cb3('0xf'));var authService=require(_0x9cb3('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9cb3('0x11'));var hardwareService=require(_0x9cb3('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x9cb3('0x13'));var config=require(_0x9cb3('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x9cb3('0x15')],{'host':_0x9cb3('0x16'),'port':0x18eb});var socket=require(_0x9cb3('0x17'))(new Redis(config[_0x9cb3('0x15')]));require(_0x9cb3('0x18'))[_0x9cb3('0x19')](socket);function respondWithStatusCode(_0x3ca1ce,_0x473d07){_0x473d07=_0x473d07||0xcc;return function(_0x370826){if(_0x370826){return _0x3ca1ce['sendStatus'](_0x473d07);}return _0x3ca1ce['status'](_0x473d07)[_0x9cb3('0x1a')]();};}function respondWithResult(_0x2c32c7,_0x3b6e1c){_0x3b6e1c=_0x3b6e1c||0xc8;return function(_0x3de47b){if(_0x3de47b){return _0x2c32c7[_0x9cb3('0x1b')](_0x3b6e1c)['json'](_0x3de47b);}};}function respondWithFilteredResult(_0x438b86,_0x5c9970){return function(_0x45b69e){if(_0x45b69e){var _0x4e93d8=_0x45b69e[_0x9cb3('0x1c')],_0x2ae045=_0x5c9970[_0x9cb3('0x1d')],_0x39ef76=_0x5c9970[_0x9cb3('0x1d')]+_0x5c9970[_0x9cb3('0x1e')],_0xd8771;if(_0x39ef76>=_0x4e93d8){_0x39ef76=_0x4e93d8;_0xd8771=0xc8;}else{_0xd8771=0xce;}_0x438b86[_0x9cb3('0x1b')](_0xd8771);return _0x438b86[_0x9cb3('0x1f')](_0x9cb3('0x20'),_0x2ae045+'-'+_0x39ef76+'/'+_0x4e93d8)[_0x9cb3('0x21')](_0x45b69e);}return null;};}function patchUpdates(_0x38c655){return function(_0x168082){try{jsonpatch[_0x9cb3('0x22')](_0x168082,_0x38c655,!![]);}catch(_0x1db976){return BPromise[_0x9cb3('0x23')](_0x1db976);}return _0x168082[_0x9cb3('0x24')]();};}function saveUpdates(_0x34cf98,_0x45e428){return function(_0x23779b){if(_0x23779b){return _0x23779b[_0x9cb3('0x25')](_0x34cf98)[_0x9cb3('0x26')](function(_0x1cac5b){return _0x1cac5b;});}return null;};}function removeEntity(_0x428630,_0x4151a0){return function(_0x26880b){if(_0x26880b){return _0x26880b[_0x9cb3('0x27')]()[_0x9cb3('0x26')](function(){_0x428630[_0x9cb3('0x1b')](0xcc)[_0x9cb3('0x1a')]();});}};}function handleEntityNotFound(_0x369b84,_0x2c5c24){return function(_0x64b84d){if(!_0x64b84d){_0x369b84['sendStatus'](0x194);}return _0x64b84d;};}function handleError(_0x2383b8,_0x4f08d3){_0x4f08d3=_0x4f08d3||0x1f4;return function(_0x266fb4){logger[_0x9cb3('0x28')](_0x266fb4['stack']);if(_0x266fb4[_0x9cb3('0x29')]){delete _0x266fb4[_0x9cb3('0x29')];}_0x2383b8['status'](_0x4f08d3)[_0x9cb3('0x2a')](_0x266fb4);};}exports[_0x9cb3('0x2b')]=function(_0x581062,_0x3fdc29,_0x31d70b){if(!_0x581062['body'][_0x9cb3('0x2c')](_0x9cb3('0x2d'))&&!_0x581062[_0x9cb3('0x2e')]['hasOwnProperty'](_0x9cb3('0x2f'))){throw new db[(_0x9cb3('0x30'))][(_0x9cb3('0x31'))](_0x9cb3('0x32'));}else{if(_0x581062[_0x9cb3('0x2e')][_0x9cb3('0x2c')](_0x9cb3('0x2f'))&&!_0x581062[_0x9cb3('0x2e')][_0x9cb3('0x2c')](_0x9cb3('0x33'))){throw new db[(_0x9cb3('0x30'))][(_0x9cb3('0x31'))](_0x9cb3('0x34'));}if(!_0x581062['body'][_0x9cb3('0x2c')]('recipients')){throw new db[(_0x9cb3('0x30'))][(_0x9cb3('0x31'))](_0x9cb3('0x35'));}else{try{var _0x386c09=JSON[_0x9cb3('0x36')](_0x581062[_0x9cb3('0x2e')][_0x9cb3('0x37')]);}catch(_0x4445bc){logger[_0x9cb3('0x28')](_0x4445bc);throw new db[(_0x9cb3('0x30'))]['ValidationError'](_0x9cb3('0x38'));}var _0x4df4fd=[_0x9cb3('0x39'),_0x9cb3('0x3a'),_0x9cb3('0x3b'),_0x9cb3('0x3c'),_0x9cb3('0x3d'),_0x9cb3('0x3e'),_0x9cb3('0x3f'),_0x9cb3('0x40'),'user'];if(_[_0x9cb3('0x41')](_0x386c09,function(_0x45fbec){return!_['includes'](_0x4df4fd,_0x45fbec[_0x9cb3('0x42')][_0x9cb3('0x43')]());})){throw new db[(_0x9cb3('0x30'))][(_0x9cb3('0x31'))](_0x9cb3('0x44'));}}}var _0xdf77c7={};_0xdf77c7['senderName']=_0x581062[_0x9cb3('0x2e')]['hasOwnProperty']('senderName')?_0x581062['body'][_0x9cb3('0x45')]:_0x581062[_0x9cb3('0x46')][_0x9cb3('0x47')];_0xdf77c7[_0x9cb3('0x48')]=_[_0x9cb3('0x49')](_0x581062[_0x9cb3('0x2e')][_0x9cb3('0x48')])?null:_0x581062['body'][_0x9cb3('0x48')];_0xdf77c7[_0x9cb3('0x4a')]=_0x581062['body'][_0x9cb3('0x4a')]||![];_0xdf77c7[_0x9cb3('0x4b')]=_0x581062[_0x9cb3('0x46')]['id'];return getContent(_0x581062['body'])[_0x9cb3('0x26')](function(_0x10fe35){_0xdf77c7[_0x9cb3('0x2e')]=_0x10fe35;return getRecipients(_0x386c09);})[_0x9cb3('0x26')](function(_0x4c0c00){_0xdf77c7['recipientsId']=_['sortBy'](_0x4c0c00)[_0x9cb3('0x4c')](',');return db['sequelize']['transaction'](function(_0x4343f4){return db[_0x9cb3('0x4d')][_0x9cb3('0x4e')](_0xdf77c7,{'raw':!![],'transaction':_0x4343f4})[_0x9cb3('0x26')](function(_0x482090){var _0x41ec7f={'sender':_0xdf77c7[_0x9cb3('0x45')],'description':_0xdf77c7[_0x9cb3('0x48')],'content':_0xdf77c7[_0x9cb3('0x2e')],'beep':_0xdf77c7[_0x9cb3('0x4a')]};_0x4c0c00['forEach'](function(_0x43d5a8){_0x41ec7f[_0x9cb3('0x4f')]=_0x43d5a8;socket['emit'](_0x9cb3('0x50'),_0x41ec7f);});return _0x482090;});});})[_0x9cb3('0x26')](respondWithResult(_0x3fdc29,0xc9))[_0x9cb3('0x51')](handleError(_0x3fdc29,null));};function getContent(_0x53c7e3){return new BPromise(function(_0x54086e,_0x16f7e1){if(_0x53c7e3[_0x9cb3('0x2d')]){_0x54086e(_0x53c7e3['text']);return;}return db[_0x9cb3('0x52')][_0x9cb3('0x53')]({'attributes':[_0x9cb3('0x54')],'where':{'id':_0x53c7e3[_0x9cb3('0x2f')]},'raw':!![]})[_0x9cb3('0x26')](function(_0xaa508e){if(!_0xaa508e)throw new db[(_0x9cb3('0x30'))][(_0x9cb3('0x31'))](_0x9cb3('0x55'));var _0x41e6e3=Mustache[_0x9cb3('0x56')](_0xaa508e[_0x9cb3('0x54')],_0x53c7e3[_0x9cb3('0x33')]);_0x54086e(_0x41e6e3);})[_0x9cb3('0x51')](function(_0x50f505){_0x16f7e1(_0x50f505);});});}function getRecipients(_0x5b2078){return new BPromise(function(_0x26a5de,_0x3bbe90){var _0x4ec546=[];var _0x38d87d=[];_0x5b2078['forEach'](function(_0x5dc7a8){var _0x5c7de8=_[_0x9cb3('0x57')](_0x5dc7a8[_0x9cb3('0x42')][_0x9cb3('0x43')]());if(_0x5c7de8===_0x9cb3('0x58')){_0x4ec546=_[_0x9cb3('0x59')](_0x4ec546,_0x5dc7a8[_0x9cb3('0x5a')]);}else{if(_[_0x9cb3('0x5b')](_0x5c7de8,_0x9cb3('0x5c')))_0x5c7de8=_0x5c7de8[_0x9cb3('0x5d')](_0x9cb3('0x5c'),_0x9cb3('0x5e'));_0x5dc7a8[_0x9cb3('0x5a')]['forEach'](function(_0x4be1f4){_0x38d87d['push'](getAgents(_0x5c7de8,_0x4be1f4));});}});return BPromise['all'](_0x38d87d)['then'](function(_0x20f20d){_0x4ec546=_['union'](_0x4ec546,_[_0x9cb3('0x5f')](_0x20f20d));_0x26a5de(_0x4ec546);})[_0x9cb3('0x51')](function(_0x502d0e){_0x3bbe90(_0x502d0e);});});}function getAgents(_0xbcea0d,_0x14d980){return new BPromise(function(_0x2ea323,_0x206fb5){return db[_0xbcea0d][_0x9cb3('0x53')]({'where':{'id':_0x14d980}})[_0x9cb3('0x26')](function(_0x517965){return _0x517965[_0x9cb3('0x60')]({'attributes':['id'],'raw':!![]})[_0x9cb3('0x26')](function(_0x53a21e){var _0x1a96c9=_[_0x9cb3('0x61')](_0x53a21e,'id');_0x2ea323(_0x1a96c9);});})[_0x9cb3('0x51')](function(_0x5ba296){_0x206fb5(_0x5ba296);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index aa86900..d6f918c 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 _0xdb28=['Notification','setMaxListeners','update','remove','emit','exports','events','../../mysqldb'];(function(_0x237d51,_0x5382b0){var _0x4d3eb0=function(_0x28714e){while(--_0x28714e){_0x237d51['push'](_0x237d51['shift']());}};_0x4d3eb0(++_0x5382b0);}(_0xdb28,0x106));var _0x8db2=function(_0x26df3b,_0x585b05){_0x26df3b=_0x26df3b-0x0;var _0x17ad32=_0xdb28[_0x26df3b];return _0x17ad32;};'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 +var _0xbaf0=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','Notification'];(function(_0x276167,_0x21086e){var _0x27a866=function(_0xa47f17){while(--_0xa47f17){_0x276167['push'](_0x276167['shift']());}};_0x27a866(++_0x21086e);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var EventEmitter=require('events');var Notification=require(_0x0baf('0x0'))['db'][_0x0baf('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents[_0x0baf('0x2')](0x0);var events={'afterCreate':_0x0baf('0x3'),'afterUpdate':_0x0baf('0x4'),'afterDestroy':_0x0baf('0x5')};function emitEvent(_0x5a3e42){return function(_0x232cc7,_0x1c383e,_0x2d3fa5){NotificationEvents[_0x0baf('0x6')](_0x5a3e42+':'+_0x232cc7['id'],_0x232cc7);NotificationEvents[_0x0baf('0x6')](_0x5a3e42,_0x232cc7);_0x2d3fa5(null);};}for(var e in events){if(events[_0x0baf('0x7')](e)){var event=events[e];Notification[_0x0baf('0x8')](e,emitEvent(event));}}module[_0x0baf('0x9')]=NotificationEvents; \ No newline at end of file diff --git a/server/api/notification/notification.model.js b/server/api/notification/notification.model.js index 5388ef0..496bd1f 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 _0x541b=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./notification.attributes','exports','Notification','notifications','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x54f1a2,_0x4056dd){var _0x32179a=function(_0x130804){while(--_0x130804){_0x54f1a2['push'](_0x54f1a2['shift']());}};_0x32179a(++_0x4056dd);}(_0x541b,0x15d));var _0xb541=function(_0xa9b067,_0x2047eb){_0xa9b067=_0xa9b067-0x0;var _0x492156=_0x541b[_0xa9b067];return _0x492156;};'use strict';var _=require('lodash');var util=require(_0xb541('0x0'));var logger=require(_0xb541('0x1'))('api');var moment=require(_0xb541('0x2'));var BPromise=require(_0xb541('0x3'));var rp=require(_0xb541('0x4'));var fs=require('fs');var path=require(_0xb541('0x5'));var rimraf=require(_0xb541('0x6'));var config=require(_0xb541('0x7'));var attributes=require(_0xb541('0x8'));module[_0xb541('0x9')]=function(_0x3c68d2,_0x5edcf8){return _0x3c68d2['define'](_0xb541('0xa'),attributes,{'tableName':_0xb541('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb541('0xc'),'collate':_0xb541('0xd')});}; \ No newline at end of file +var _0x84d6=['notifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./notification.attributes','exports','Notification'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x84d6,0x189));var _0x684d=function(_0x4417f5,_0x216d2e){_0x4417f5=_0x4417f5-0x0;var _0x3b4056=_0x84d6[_0x4417f5];return _0x3b4056;};'use strict';var _=require(_0x684d('0x0'));var util=require(_0x684d('0x1'));var logger=require('../../config/logger')(_0x684d('0x2'));var moment=require(_0x684d('0x3'));var BPromise=require(_0x684d('0x4'));var rp=require(_0x684d('0x5'));var fs=require('fs');var path=require(_0x684d('0x6'));var rimraf=require(_0x684d('0x7'));var config=require(_0x684d('0x8'));var attributes=require(_0x684d('0x9'));module[_0x684d('0xa')]=function(_0x23edf7,_0x48f086){return _0x23edf7['define'](_0x684d('0xb'),attributes,{'tableName':_0x684d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x684d('0xd'),'collate':_0x684d('0xe')});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index dfc7feb..f569d63 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 _0xacd6=['http','redis','localhost','socket.io-emitter','./notification.socket','register','request','then','info','Notification,\x20%s,\x20%s','request\x20sent','Notification,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1c4409,_0x3b2e8f){var _0x356d8f=function(_0xae43bf){while(--_0xae43bf){_0x1c4409['push'](_0x1c4409['shift']());}};_0x356d8f(++_0x3b2e8f);}(_0xacd6,0x17d));var _0x6acd=function(_0x4d8666,_0x2ff19d){_0x4d8666=_0x4d8666-0x0;var _0x37175b=_0xacd6[_0x4d8666];return _0x37175b;};'use strict';var _=require(_0x6acd('0x0'));var util=require('util');var moment=require(_0x6acd('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6acd('0x2'));var db=require(_0x6acd('0x3'))['db'];var utils=require(_0x6acd('0x4'));var logger=require(_0x6acd('0x5'))(_0x6acd('0x6'));var config=require(_0x6acd('0x7'));var jayson=require(_0x6acd('0x8'));var client=jayson['client'][_0x6acd('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x6acd('0xa')],{'host':_0x6acd('0xb'),'port':0x18eb});var socket=require(_0x6acd('0xc'))(new Redis(config[_0x6acd('0xa')]));require(_0x6acd('0xd'))[_0x6acd('0xe')](socket);function respondWithRpcPromise(_0x56c578,_0x3737c4,_0x3c7b29){return new BPromise(function(_0x52d64b,_0x15b3b6){return client[_0x6acd('0xf')](_0x56c578,_0x3c7b29)[_0x6acd('0x10')](function(_0x3d2e30){logger[_0x6acd('0x11')](_0x6acd('0x12'),_0x3737c4,_0x6acd('0x13'));logger['debug'](_0x6acd('0x14'),_0x3737c4,'request\x20sent',JSON['stringify'](_0x3d2e30));if(_0x3d2e30['error']){if(_0x3d2e30[_0x6acd('0x15')][_0x6acd('0x16')]===0x1f4){logger[_0x6acd('0x15')](_0x6acd('0x12'),_0x3737c4,_0x3d2e30[_0x6acd('0x15')][_0x6acd('0x17')]);return _0x15b3b6(_0x3d2e30[_0x6acd('0x15')][_0x6acd('0x17')]);}logger[_0x6acd('0x15')]('Notification,\x20%s,\x20%s',_0x3737c4,_0x3d2e30[_0x6acd('0x15')][_0x6acd('0x17')]);return _0x52d64b(_0x3d2e30['error'][_0x6acd('0x17')]);}else{logger[_0x6acd('0x11')](_0x6acd('0x12'),_0x3737c4,_0x6acd('0x13'));_0x52d64b(_0x3d2e30[_0x6acd('0x18')][_0x6acd('0x17')]);}})[_0x6acd('0x19')](function(_0x128bdd){logger[_0x6acd('0x15')](_0x6acd('0x12'),_0x3737c4,_0x128bdd);_0x15b3b6(_0x128bdd);});});} \ No newline at end of file +var _0xbcdc=['rpc','client','http','defaults','redis','localhost','register','request','then','info','Notification,\x20%s,\x20%s','debug','Notification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x382719,_0x91d5cb){var _0x48cff9=function(_0xf539c3){while(--_0xf539c3){_0x382719['push'](_0x382719['shift']());}};_0x48cff9(++_0x91d5cb);}(_0xbcdc,0x1b3));var _0xcbcd=function(_0x5684dc,_0x16f824){_0x5684dc=_0x5684dc-0x0;var _0x3d4028=_0xbcdc[_0x5684dc];return _0x3d4028;};'use strict';var _=require(_0xcbcd('0x0'));var util=require(_0xcbcd('0x1'));var moment=require(_0xcbcd('0x2'));var BPromise=require(_0xcbcd('0x3'));var rs=require(_0xcbcd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcbcd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcbcd('0x6'))(_0xcbcd('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcbcd('0x8')][_0xcbcd('0x9')]({'port':0x232a});config['redis']=_[_0xcbcd('0xa')](config[_0xcbcd('0xb')],{'host':_0xcbcd('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcbcd('0xb')]));require('./notification.socket')[_0xcbcd('0xd')](socket);function respondWithRpcPromise(_0x501ad0,_0x427f36,_0xb68f4c){return new BPromise(function(_0x41b824,_0x51c066){return client[_0xcbcd('0xe')](_0x501ad0,_0xb68f4c)[_0xcbcd('0xf')](function(_0x500888){logger[_0xcbcd('0x10')](_0xcbcd('0x11'),_0x427f36,'request\x20sent');logger[_0xcbcd('0x12')](_0xcbcd('0x13'),_0x427f36,_0xcbcd('0x14'),JSON[_0xcbcd('0x15')](_0x500888));if(_0x500888['error']){if(_0x500888[_0xcbcd('0x16')][_0xcbcd('0x17')]===0x1f4){logger[_0xcbcd('0x16')]('Notification,\x20%s,\x20%s',_0x427f36,_0x500888[_0xcbcd('0x16')][_0xcbcd('0x18')]);return _0x51c066(_0x500888[_0xcbcd('0x16')][_0xcbcd('0x18')]);}logger['error'](_0xcbcd('0x11'),_0x427f36,_0x500888[_0xcbcd('0x16')][_0xcbcd('0x18')]);return _0x41b824(_0x500888['error']['message']);}else{logger[_0xcbcd('0x10')](_0xcbcd('0x11'),_0x427f36,_0xcbcd('0x14'));_0x41b824(_0x500888['result']['message']);}})[_0xcbcd('0x19')](function(_0x2c9ea4){logger['error']('Notification,\x20%s,\x20%s',_0x427f36,_0x2c9ea4);_0x51c066(_0x2c9ea4);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index 520d6cc..964ceeb 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 _0x65de=['removeListener','length','notification:','./notification.events','save','emit'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x65de,0x129));var _0xe65d=function(_0x142d3e,_0x3f756f){_0x142d3e=_0x142d3e-0x0;var _0x2be5e3=_0x65de[_0x142d3e];return _0x2be5e3;};'use strict';var NotificationEvents=require(_0xe65d('0x0'));var events=[_0xe65d('0x1'),'remove','update'];function createListener(_0x526cfd,_0x4b4a4e){return function(_0x3feadf){_0x4b4a4e[_0xe65d('0x2')](_0x526cfd,_0x3feadf);};}function removeListener(_0x4eba68,_0x4fc8d6){return function(){NotificationEvents[_0xe65d('0x3')](_0x4eba68,_0x4fc8d6);};}exports['register']=function(_0x3045c9){for(var _0x34b0a1=0x0,_0x45737a=events[_0xe65d('0x4')];_0x34b0a1<_0x45737a;_0x34b0a1++){var _0x9d6d49=events[_0x34b0a1];var _0x16321f=createListener(_0xe65d('0x5')+_0x9d6d49,_0x3045c9);NotificationEvents['on'](_0x9d6d49,_0x16321f);}}; \ No newline at end of file +var _0x4436=['remove','emit','removeListener','notification:','./notification.events','save'];(function(_0x3e1d46,_0x1aa0ef){var _0x1ada3f=function(_0xc01694){while(--_0xc01694){_0x3e1d46['push'](_0x3e1d46['shift']());}};_0x1ada3f(++_0x1aa0ef);}(_0x4436,0x1ae));var _0x6443=function(_0x1af876,_0x1a314a){_0x1af876=_0x1af876-0x0;var _0x1e3b82=_0x4436[_0x1af876];return _0x1e3b82;};'use strict';var NotificationEvents=require(_0x6443('0x0'));var events=[_0x6443('0x1'),_0x6443('0x2'),'update'];function createListener(_0x5dd622,_0x2bd42c){return function(_0x5c7402){_0x2bd42c[_0x6443('0x3')](_0x5dd622,_0x5c7402);};}function removeListener(_0x21e234,_0x125fab){return function(){NotificationEvents[_0x6443('0x4')](_0x21e234,_0x125fab);};}exports['register']=function(_0x59f763){for(var _0x47271f=0x0,_0x203a35=events['length'];_0x47271f<_0x203a35;_0x47271f++){var _0x5d17a7=events[_0x47271f];var _0x1ff720=createListener(_0x6443('0x5')+_0x5d17a7,_0x59f763);NotificationEvents['on'](_0x5d17a7,_0x1ff720);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index e4ef10f..932ead8 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 _0x1214=['addAgents','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addAnswer','/:id/applications'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1214,0xec));var _0x4121=function(_0x3d34fc,_0x19448a){_0x3d34fc=_0x3d34fc-0x0;var _0x35a98c=_0x1214[_0x3d34fc];return _0x35a98c;};'use strict';var multer=require(_0x4121('0x0'));var util=require(_0x4121('0x1'));var path=require(_0x4121('0x2'));var timeout=require(_0x4121('0x3'));var express=require('express');var router=express[_0x4121('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x4121('0x5'));var config=require(_0x4121('0x6'));var controller=require(_0x4121('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x4121('0x8')]);router[_0x4121('0x9')](_0x4121('0xa'),auth[_0x4121('0xb')](),controller[_0x4121('0xc')]);router['get'](_0x4121('0xd'),auth[_0x4121('0xb')](),controller[_0x4121('0xe')]);router[_0x4121('0x9')](_0x4121('0xf'),auth['isAuthenticated'](),controller[_0x4121('0x10')]);router[_0x4121('0x9')](_0x4121('0x11'),auth[_0x4121('0xb')](),controller[_0x4121('0x12')]);router[_0x4121('0x9')]('/:id/applications',auth[_0x4121('0xb')](),controller[_0x4121('0x13')]);router[_0x4121('0x9')](_0x4121('0x14'),auth[_0x4121('0xb')](),controller[_0x4121('0x15')]);router[_0x4121('0x9')](_0x4121('0x16'),auth[_0x4121('0xb')](),controller[_0x4121('0x17')]);router[_0x4121('0x18')]('/',auth[_0x4121('0xb')](),controller[_0x4121('0x19')]);router[_0x4121('0x18')](_0x4121('0xf'),auth[_0x4121('0xb')](),controller['addDisposition']);router[_0x4121('0x18')]('/:id/canned_answers',auth[_0x4121('0xb')](),controller[_0x4121('0x1a')]);router[_0x4121('0x18')]('/:id/notify',controller['notify']);router[_0x4121('0x18')](_0x4121('0x1b'),auth[_0x4121('0xb')](),controller['addApplications']);router['post'](_0x4121('0x16'),auth[_0x4121('0xb')](),controller[_0x4121('0x1c')]);router[_0x4121('0x18')]('/:id/send',auth[_0x4121('0xb')](),controller['send']);router[_0x4121('0x1d')]('/:id',auth[_0x4121('0xb')](),controller[_0x4121('0x1e')]);router[_0x4121('0x1f')](_0x4121('0xd'),auth[_0x4121('0xb')](),controller['destroy']);router[_0x4121('0x1f')](_0x4121('0xf'),auth[_0x4121('0xb')](),controller['removeDispositions']);router[_0x4121('0x1f')](_0x4121('0x11'),auth[_0x4121('0xb')](),controller['removeAnswers']);router['delete']('/:id/users',auth[_0x4121('0xb')](),controller['removeAgents']);module[_0x4121('0x20')]=router; \ No newline at end of file +var _0xcf2f=['index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getInteractions','getAgents','create','post','addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','delete','removeDispositions','removeAnswers','/:id/users','removeAgents','exports','multer','util','path','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated'];(function(_0xfc7449,_0x2705cb){var _0x1678c7=function(_0x56de50){while(--_0x56de50){_0xfc7449['push'](_0xfc7449['shift']());}};_0x1678c7(++_0x2705cb);}(_0xcf2f,0x7c));var _0xfcf2=function(_0x3192ae,_0x5b676e){_0x3192ae=_0x3192ae-0x0;var _0x9d3841=_0xcf2f[_0x3192ae];return _0x9d3841;};'use strict';var multer=require(_0xfcf2('0x0'));var util=require(_0xfcf2('0x1'));var path=require(_0xfcf2('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xfcf2('0x3'));var config=require(_0xfcf2('0x4'));var controller=require(_0xfcf2('0x5'));router[_0xfcf2('0x6')]('/',auth[_0xfcf2('0x7')](),controller[_0xfcf2('0x8')]);router[_0xfcf2('0x6')](_0xfcf2('0x9'),auth[_0xfcf2('0x7')](),controller[_0xfcf2('0xa')]);router[_0xfcf2('0x6')](_0xfcf2('0xb'),auth[_0xfcf2('0x7')](),controller[_0xfcf2('0xc')]);router[_0xfcf2('0x6')](_0xfcf2('0xd'),auth[_0xfcf2('0x7')](),controller[_0xfcf2('0xe')]);router[_0xfcf2('0x6')](_0xfcf2('0xf'),auth[_0xfcf2('0x7')](),controller[_0xfcf2('0x10')]);router[_0xfcf2('0x6')]('/:id/applications',auth[_0xfcf2('0x7')](),controller['getApplications']);router[_0xfcf2('0x6')]('/:id/interactions',auth[_0xfcf2('0x7')](),controller[_0xfcf2('0x11')]);router[_0xfcf2('0x6')]('/:id/users',auth[_0xfcf2('0x7')](),controller[_0xfcf2('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0xfcf2('0x13')]);router[_0xfcf2('0x14')]('/:id/dispositions',auth['isAuthenticated'](),controller['addDisposition']);router['post'](_0xfcf2('0xf'),auth[_0xfcf2('0x7')](),controller[_0xfcf2('0x15')]);router[_0xfcf2('0x14')](_0xfcf2('0x16'),controller[_0xfcf2('0x17')]);router[_0xfcf2('0x14')]('/:id/applications',auth[_0xfcf2('0x7')](),controller[_0xfcf2('0x18')]);router[_0xfcf2('0x14')]('/:id/users',auth[_0xfcf2('0x7')](),controller[_0xfcf2('0x19')]);router[_0xfcf2('0x14')](_0xfcf2('0x1a'),auth[_0xfcf2('0x7')](),controller['send']);router['put']('/:id',auth[_0xfcf2('0x7')](),controller['update']);router[_0xfcf2('0x1b')](_0xfcf2('0xb'),auth[_0xfcf2('0x7')](),controller['destroy']);router[_0xfcf2('0x1b')]('/:id/dispositions',auth[_0xfcf2('0x7')](),controller[_0xfcf2('0x1c')]);router[_0xfcf2('0x1b')]('/:id/canned_answers',auth[_0xfcf2('0x7')](),controller[_0xfcf2('0x1d')]);router[_0xfcf2('0x1b')](_0xfcf2('0x1e'),auth[_0xfcf2('0x7')](),controller[_0xfcf2('0x1f')]);module[_0xfcf2('0x20')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 4944e69..f3e2118 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 _0x85c7=['randomstring','STRING','name','generate','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize'];(function(_0x189de4,_0x3d203f){var _0x52f95e=function(_0x4dea26){while(--_0x4dea26){_0x189de4['push'](_0x189de4['shift']());}};_0x52f95e(++_0x3d203f);}(_0x85c7,0x154));var _0x785c=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x85c7[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x785c('0x0'));var rs=require(_0x785c('0x1'));module['exports']={'name':{'type':Sequelize[_0x785c('0x2')],'unique':_0x785c('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x785c('0x2')],'defaultValue':function(){return rs[_0x785c('0x4')]();}},'replyUri':{'type':Sequelize[_0x785c('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x785c('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x785c('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x785c('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x785c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x785c('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x785c('0x7')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x785c('0x6')],'defaultValue':![],'comment':_0x785c('0x8'),'set':function(_0x33520c){if(!_0x33520c)this[_0x785c('0x9')](_0x785c('0xa'),null);this['setDataValue']('mandatoryDisposition',_0x33520c);}}}; \ No newline at end of file +var _0xe787=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','name','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x5db420,_0x4f70bc){var _0x14daa8=function(_0x1ef941){while(--_0x1ef941){_0x5db420['push'](_0x5db420['shift']());}};_0x14daa8(++_0x4f70bc);}(_0xe787,0x10a));var _0x7e78=function(_0x58c851,_0x1f3d96){_0x58c851=_0x58c851-0x0;var _0x534d8a=_0xe787[_0x58c851];return _0x534d8a;};'use strict';var Sequelize=require(_0x7e78('0x0'));var rs=require('randomstring');module[_0x7e78('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x7e78('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x7e78('0x3')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x7e78('0x4')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x7e78('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x7e78('0x5')],'defaultValue':function(){return _0x7e78('0x6');}},'notificationSound':{'type':Sequelize[_0x7e78('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7e78('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7e78('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x7e78('0x3')]},'queueTransfer':{'type':Sequelize[_0x7e78('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7e78('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7e78('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7e78('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x7e78('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x7e78('0x7')],'defaultValue':![],'comment':_0x7e78('0xa'),'set':function(_0x2d2125){if(!_0x2d2125)this[_0x7e78('0xb')]('mandatoryDispositionPauseId',null);this[_0x7e78('0xb')](_0x7e78('0xc'),_0x2d2125);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 18d7da5..3182e51 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 _0xb93f=['emit','userOpenchannelAccount:remove','getAgents','DESC','out','OpenchannelMessage','Messages','dataValues','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','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','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','sendStatus','status','end','count','offset','limit','set','apply','reject','save','UserProfileResource','destroy','stack','send','Pause','OpenchannelAccount','rawAttributes','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','name','filter','options','includeAll','include','findAll','catch','show','params','mandatoryDispositionPause','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','addDisposition','OpnechannelAccountId','getDispositions','findOne','Disposition','OpenchannelAccountId','rows','removeDispositions','addAnswer','CannedAnswer','getAnswers','nolimit','removeAnswers','notify','openchannel','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','from','CmList','List','Contacts','OpenchannelApplication','Applications','account','applications','list','priority','asc','ListId','contact','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','messageId','interaction','created','autoclose','push','unmanaged','*,*,*,*','AttachmentId','User','unshift','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','bulkCreate','findAndCountAll','getApplications','Contact','Owner','fullname','tag','omit','ids','spread','userOpenchannelAccount:save','removeAgents','isArray'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xb93f,0xc4));var _0xfb93=function(_0x1d4449,_0x495153){_0x1d4449=_0x1d4449-0x0;var _0x4dcde3=_0xb93f[_0x1d4449];return _0x4dcde3;};'use strict';var pdf=require(_0xfb93('0x0'));var emlformat=require(_0xfb93('0x1'));var rimraf=require(_0xfb93('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfb93('0x3'));var rp=require(_0xfb93('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfb93('0x5'));var util=require(_0xfb93('0x6'));var path=require(_0xfb93('0x7'));var sox=require(_0xfb93('0x8'));var csv=require(_0xfb93('0x9'));var ejs=require(_0xfb93('0xa'));var fs=require('fs');var _=require(_0xfb93('0xb'));var squel=require(_0xfb93('0xc'));var crypto=require(_0xfb93('0xd'));var jsforce=require(_0xfb93('0xe'));var deskjs=require(_0xfb93('0xf'));var toCsv=require(_0xfb93('0x9'));var querystring=require(_0xfb93('0x10'));var Papa=require(_0xfb93('0x11'));var Redis=require(_0xfb93('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xfb93('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfb93('0x14'));var logger=require(_0xfb93('0x15'))(_0xfb93('0x16'));var utils=require(_0xfb93('0x17'));var config=require('../../config/environment');var db=require(_0xfb93('0x18'))['db'];config[_0xfb93('0x19')]=_[_0xfb93('0x1a')](config[_0xfb93('0x19')],{'host':_0xfb93('0x1b'),'port':0x18eb});var socket=require(_0xfb93('0x1c'))(new Redis(config[_0xfb93('0x19')]));require(_0xfb93('0x1d'))[_0xfb93('0x1e')](socket);var jayson=require(_0xfb93('0x1f'));var client=jayson[_0xfb93('0x20')][_0xfb93('0x21')]({'port':0x232c});var client9002=jayson[_0xfb93('0x20')][_0xfb93('0x21')]({'port':0x232a});function checkPasswordPattern(_0x379ca8,_0x59510f,_0x5b961c){if(_0x5b961c){var _0x2e0655=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2e0655[_0xfb93('0x22')](_0x59510f)){return _0x379ca8;}else{throw new db['Sequelize'][(_0xfb93('0x23'))](_0xfb93('0x24'));}}else{return _0x379ca8;}}function respondWithRpcPromise(_0x81a562,_0x883ff3,_0x361ca9,_0x4f2741){return new BPromise(function(_0x4e4f82,_0x247660){var _0x4f5e3a=_0x4f2741||client;return _0x4f5e3a[_0xfb93('0x25')](_0x81a562,_0x361ca9)[_0xfb93('0x26')](function(_0x4cdcb8){logger['info'](_0xfb93('0x27'),_0x883ff3,_0xfb93('0x28'));logger['debug'](_0xfb93('0x29'),_0x883ff3,'request\x20sent',JSON['stringify'](_0x4cdcb8));if(_0x4cdcb8[_0xfb93('0x2a')]){if(_0x4cdcb8[_0xfb93('0x2a')][_0xfb93('0x2b')]===0x1f4){logger[_0xfb93('0x2a')](_0xfb93('0x27'),_0x883ff3,_0x4cdcb8[_0xfb93('0x2a')]['message']);return _0x247660(_0x4cdcb8[_0xfb93('0x2a')][_0xfb93('0x2c')]);}logger['error'](_0xfb93('0x27'),_0x883ff3,_0x4cdcb8[_0xfb93('0x2a')][_0xfb93('0x2c')]);return _0x4e4f82(_0x4cdcb8['error'][_0xfb93('0x2c')]);}else{logger[_0xfb93('0x2d')]('OpenchannelAccount,\x20%s,\x20%s',_0x883ff3,'request\x20sent');_0x4e4f82(_0x4cdcb8[_0xfb93('0x2e')]['message']);}})['catch'](function(_0x4af140){logger['error'](_0xfb93('0x27'),_0x883ff3,_0x4af140);_0x247660(_0x4af140);});});}function respondWithStatusCode(_0x417e61,_0x5098fc){_0x5098fc=_0x5098fc||0xcc;return function(_0x5bf81a){if(_0x5bf81a){return _0x417e61[_0xfb93('0x2f')](_0x5098fc);}return _0x417e61[_0xfb93('0x30')](_0x5098fc)[_0xfb93('0x31')]();};}function respondWithResult(_0x2ab27f,_0x45e656){_0x45e656=_0x45e656||0xc8;return function(_0xb62a2a){if(_0xb62a2a){return _0x2ab27f['status'](_0x45e656)['json'](_0xb62a2a);}};}function respondWithFilteredResult(_0x4417d6,_0x52b575){return function(_0x1ca721){if(_0x1ca721){var _0x336386=_0x1ca721[_0xfb93('0x32')],_0x5dc013=_0x52b575[_0xfb93('0x33')],_0x465530=_0x52b575[_0xfb93('0x33')]+_0x52b575[_0xfb93('0x34')],_0x1d5aa9;if(_0x465530>=_0x336386){_0x465530=_0x336386;_0x1d5aa9=0xc8;}else{_0x1d5aa9=0xce;}_0x4417d6[_0xfb93('0x30')](_0x1d5aa9);return _0x4417d6[_0xfb93('0x35')]('Content-Range',_0x5dc013+'-'+_0x465530+'/'+_0x336386)['json'](_0x1ca721);}return null;};}function patchUpdates(_0x168847){return function(_0x2d868d){try{jsonpatch[_0xfb93('0x36')](_0x2d868d,_0x168847,!![]);}catch(_0x10c7b3){return BPromise[_0xfb93('0x37')](_0x10c7b3);}return _0x2d868d[_0xfb93('0x38')]();};}function saveUpdates(_0x97959e,_0x2fe5b0){return function(_0x3e7599){if(_0x3e7599){return _0x3e7599['update'](_0x97959e)[_0xfb93('0x26')](function(_0x406d55){return _0x406d55;});}return null;};}function removeEntity(_0x4fe71a,_0x31c7bb){return function(_0x173c29){if(_0x173c29){return _0x173c29['destroy']()[_0xfb93('0x26')](function(){var _0x5e4e88=_0x173c29['get']({'plain':!![]});var _0x2bd7cf='OpenchannelAccounts';return db[_0xfb93('0x39')][_0xfb93('0x3a')]({'where':{'type':_0x2bd7cf,'resourceId':_0x5e4e88['id']}})[_0xfb93('0x26')](function(){return _0x173c29;});})[_0xfb93('0x26')](function(){_0x4fe71a[_0xfb93('0x30')](0xcc)[_0xfb93('0x31')]();});}};}function handleEntityNotFound(_0x115b88,_0x32742f){return function(_0x1af39b){if(!_0x1af39b){_0x115b88['sendStatus'](0x194);}return _0x1af39b;};}function handleError(_0x12987d,_0x29b356){_0x29b356=_0x29b356||0x1f4;return function(_0x5e10b6){logger[_0xfb93('0x2a')](_0x5e10b6[_0xfb93('0x3b')]);if(_0x5e10b6['name']){delete _0x5e10b6['name'];}_0x12987d[_0xfb93('0x30')](_0x29b356)[_0xfb93('0x3c')](_0x5e10b6);};}exports['index']=function(_0x11f6ce,_0x50dd9a){var _0x48aa05={'include':[{'model':db[_0xfb93('0x3d')],'as':'mandatoryDispositionPause'}]},_0x2033eb={},_0x4f79d6={'count':0x0,'rows':[]};var _0x81f45=_['map'](db[_0xfb93('0x3e')][_0xfb93('0x3f')],function(_0x26bde7){return{'name':_0x26bde7['fieldName'],'type':_0x26bde7[_0xfb93('0x40')][_0xfb93('0x41')]};});_0x2033eb[_0xfb93('0x42')]=_[_0xfb93('0x43')](_0x81f45,'name');_0x2033eb['query']=_[_0xfb93('0x44')](_0x11f6ce['query']);_0x2033eb[_0xfb93('0x45')]=_[_0xfb93('0x46')](_0x2033eb[_0xfb93('0x42')],_0x2033eb[_0xfb93('0x47')]);_0x48aa05[_0xfb93('0x48')]=_[_0xfb93('0x46')](_0x2033eb['model'],qs['fields'](_0x11f6ce[_0xfb93('0x47')][_0xfb93('0x49')]));_0x48aa05[_0xfb93('0x48')]=_0x48aa05[_0xfb93('0x48')][_0xfb93('0x4a')]?_0x48aa05[_0xfb93('0x48')]:_0x2033eb['model'];if(!_0x11f6ce['query'][_0xfb93('0x4b')]('nolimit')){_0x48aa05[_0xfb93('0x34')]=qs[_0xfb93('0x34')](_0x11f6ce[_0xfb93('0x47')]['limit']);_0x48aa05['offset']=qs['offset'](_0x11f6ce['query'][_0xfb93('0x33')]);}_0x48aa05[_0xfb93('0x4c')]=qs[_0xfb93('0x4d')](_0x11f6ce[_0xfb93('0x47')][_0xfb93('0x4d')]);_0x48aa05[_0xfb93('0x4e')]=qs[_0xfb93('0x45')](_[_0xfb93('0x4f')](_0x11f6ce[_0xfb93('0x47')],_0x2033eb[_0xfb93('0x45')]),_0x81f45);if(_0x11f6ce[_0xfb93('0x47')]['filter']){_0x48aa05[_0xfb93('0x4e')]=_[_0xfb93('0x50')](_0x48aa05[_0xfb93('0x4e')],{'$or':_['map'](_0x81f45,function(_0x290c58){if(_0x290c58[_0xfb93('0x40')]!=='VIRTUAL'){var _0x2be554={};_0x2be554[_0x290c58[_0xfb93('0x51')]]={'$like':'%'+_0x11f6ce[_0xfb93('0x47')][_0xfb93('0x52')]+'%'};return _0x2be554;}})});}_0x48aa05=_['merge']({},_0x48aa05,_0x11f6ce[_0xfb93('0x53')]);var _0x191c89={'where':_0x48aa05[_0xfb93('0x4e')]};return db['OpenchannelAccount'][_0xfb93('0x32')](_0x191c89)['then'](function(_0x1acc17){_0x4f79d6[_0xfb93('0x32')]=_0x1acc17;if(_0x11f6ce['query'][_0xfb93('0x54')]){_0x48aa05[_0xfb93('0x55')]=[{'all':!![]}];}return db[_0xfb93('0x3e')][_0xfb93('0x56')](_0x48aa05);})['then'](function(_0x41c7fa){_0x4f79d6['rows']=_0x41c7fa;return _0x4f79d6;})[_0xfb93('0x26')](respondWithFilteredResult(_0x50dd9a,_0x48aa05))[_0xfb93('0x57')](handleError(_0x50dd9a,null));};exports[_0xfb93('0x58')]=function(_0x17f3bf,_0x28e66e){var _0x140f22={'raw':![],'where':{'id':_0x17f3bf[_0xfb93('0x59')]['id']},'include':[{'model':db[_0xfb93('0x3d')],'as':_0xfb93('0x5a')}]},_0x118131={};_0x118131[_0xfb93('0x42')]=_['keys'](db['OpenchannelAccount']['rawAttributes']);_0x118131['query']=_[_0xfb93('0x44')](_0x17f3bf[_0xfb93('0x47')]);_0x118131[_0xfb93('0x45')]=_[_0xfb93('0x46')](_0x118131['model'],_0x118131[_0xfb93('0x47')]);_0x140f22[_0xfb93('0x48')]=_[_0xfb93('0x46')](_0x118131['model'],qs[_0xfb93('0x49')](_0x17f3bf['query'][_0xfb93('0x49')]));_0x140f22['attributes']=_0x140f22[_0xfb93('0x48')][_0xfb93('0x4a')]?_0x140f22[_0xfb93('0x48')]:_0x118131[_0xfb93('0x42')];if(_0x17f3bf['query']['includeAll']){_0x140f22[_0xfb93('0x55')]=[{'all':!![]}];}_0x140f22=_[_0xfb93('0x50')]({},_0x140f22,_0x17f3bf[_0xfb93('0x53')]);return db[_0xfb93('0x3e')]['find'](_0x140f22)['then'](handleEntityNotFound(_0x28e66e,null))[_0xfb93('0x26')](respondWithResult(_0x28e66e,null))['catch'](handleError(_0x28e66e,null));};exports[_0xfb93('0x5b')]=function(_0x367b5e,_0x55f373){return db[_0xfb93('0x3e')][_0xfb93('0x5b')](_0x367b5e['body'],{})[_0xfb93('0x26')](function(_0x77884e){var _0x29b3f3=_0x367b5e[_0xfb93('0x5c')][_0xfb93('0x5d')]({'plain':!![]});if(!_0x29b3f3)throw new Error(_0xfb93('0x5e'));if(_0x29b3f3[_0xfb93('0x5f')]===_0xfb93('0x5c')){var _0x2cd696=_0x77884e[_0xfb93('0x5d')]({'plain':!![]});var _0x57271b=_0xfb93('0x60');return db[_0xfb93('0x61')][_0xfb93('0x62')]({'where':{'name':_0x57271b,'userProfileId':_0x29b3f3[_0xfb93('0x63')]},'raw':!![]})[_0xfb93('0x26')](function(_0x7009f1){if(_0x7009f1&&_0x7009f1[_0xfb93('0x64')]===0x0){return db[_0xfb93('0x39')][_0xfb93('0x5b')]({'name':_0x2cd696[_0xfb93('0x51')],'resourceId':_0x2cd696['id'],'type':_0x7009f1[_0xfb93('0x51')],'sectionId':_0x7009f1['id']},{})[_0xfb93('0x26')](function(){return _0x77884e;});}else{return _0x77884e;}})[_0xfb93('0x57')](function(_0x487a2e){logger[_0xfb93('0x2a')](_0xfb93('0x65'),_0x487a2e);throw _0x487a2e;});}return _0x77884e;})[_0xfb93('0x26')](respondWithResult(_0x55f373,0xc9))[_0xfb93('0x57')](handleError(_0x55f373,null));};exports[_0xfb93('0x66')]=function(_0x3c92ca,_0x50ae72){if(_0x3c92ca[_0xfb93('0x67')]['id']){delete _0x3c92ca[_0xfb93('0x67')]['id'];}return db['OpenchannelAccount'][_0xfb93('0x62')]({'where':{'id':_0x3c92ca[_0xfb93('0x59')]['id']},'include':[{'model':db[_0xfb93('0x3d')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x50ae72,null))['then'](saveUpdates(_0x3c92ca[_0xfb93('0x67')],null))[_0xfb93('0x26')](respondWithResult(_0x50ae72,null))[_0xfb93('0x57')](handleError(_0x50ae72,null));};exports[_0xfb93('0x3a')]=function(_0x54de86,_0x14ef1a){return db[_0xfb93('0x3e')][_0xfb93('0x62')]({'where':{'id':_0x54de86[_0xfb93('0x59')]['id']}})[_0xfb93('0x26')](handleEntityNotFound(_0x14ef1a,null))['then'](removeEntity(_0x14ef1a,null))['catch'](handleError(_0x14ef1a,null));};exports[_0xfb93('0x68')]=function(_0x2c5e20,_0x3071ae){return db[_0xfb93('0x3e')][_0xfb93('0x68')]()[_0xfb93('0x26')](respondWithResult(_0x3071ae,null))[_0xfb93('0x57')](handleError(_0x3071ae,null));};exports[_0xfb93('0x69')]=function(_0x4ff789,_0x281eb4,_0x1fee22){if(_0x4ff789['body']['id']){delete _0x4ff789[_0xfb93('0x67')]['id'];}return db[_0xfb93('0x3e')]['find']({'where':{'id':_0x4ff789['params']['id']}})['then'](handleEntityNotFound(_0x281eb4,null))[_0xfb93('0x26')](function(_0x408314){if(_0x408314){_0x4ff789[_0xfb93('0x67')][_0xfb93('0x6a')]=_0x408314['id'];return db['Disposition'][_0xfb93('0x5b')](_0x4ff789['body']);}})['then'](respondWithResult(_0x281eb4,null))[_0xfb93('0x57')](handleError(_0x281eb4,null));};exports[_0xfb93('0x6b')]=function(_0x676f29,_0x1823d1,_0x4f20cb){var _0x5e9fed={'raw':![],'where':{}};var _0x49d2c1={};var _0x5bcd38={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xfb93('0x6c')]({'where':{'id':_0x676f29[_0xfb93('0x59')]['id']}})['then'](handleEntityNotFound(_0x1823d1,null))[_0xfb93('0x26')](function(_0x135737){if(_0x135737){_0x49d2c1[_0xfb93('0x42')]=_[_0xfb93('0x44')](db[_0xfb93('0x6d')][_0xfb93('0x3f')]);_0x49d2c1['query']=_[_0xfb93('0x44')](_0x676f29[_0xfb93('0x47')]);_0x49d2c1[_0xfb93('0x45')]=_['intersection'](_0x49d2c1['model'],_0x49d2c1['query']);_0x5e9fed['attributes']=_[_0xfb93('0x46')](_0x49d2c1[_0xfb93('0x42')],qs['fields'](_0x676f29[_0xfb93('0x47')][_0xfb93('0x49')]));_0x5e9fed[_0xfb93('0x48')]=_0x5e9fed[_0xfb93('0x48')]['length']?_0x5e9fed[_0xfb93('0x48')]:_0x49d2c1[_0xfb93('0x42')];if(!_0x676f29[_0xfb93('0x47')][_0xfb93('0x4b')]('nolimit')){_0x5e9fed[_0xfb93('0x34')]=qs[_0xfb93('0x34')](_0x676f29[_0xfb93('0x47')]['limit']);_0x5e9fed[_0xfb93('0x33')]=qs['offset'](_0x676f29['query'][_0xfb93('0x33')]);}_0x5e9fed[_0xfb93('0x4c')]=qs[_0xfb93('0x4d')](_0x676f29[_0xfb93('0x47')]['sort']);_0x5e9fed[_0xfb93('0x4e')]=qs[_0xfb93('0x45')](_[_0xfb93('0x4f')](_0x676f29[_0xfb93('0x47')],_0x49d2c1[_0xfb93('0x45')]));_0x5e9fed[_0xfb93('0x4e')][_0xfb93('0x6e')]=_0x135737['id'];if(_0x676f29[_0xfb93('0x47')][_0xfb93('0x52')]){_0x5e9fed['where']=_[_0xfb93('0x50')](_0x5e9fed[_0xfb93('0x4e')],{'$or':_['map'](_0x5e9fed[_0xfb93('0x48')],function(_0x5cfa51){var _0x19a861={};_0x19a861[_0x5cfa51]={'$like':'%'+_0x676f29[_0xfb93('0x47')]['filter']+'%'};return _0x19a861;})});}_0x5e9fed=_['merge']({},_0x5e9fed,_0x676f29[_0xfb93('0x53')]);return db['Disposition'][_0xfb93('0x32')]({'where':_0x5e9fed[_0xfb93('0x4e')]})[_0xfb93('0x26')](function(_0x38ae50){_0x5bcd38[_0xfb93('0x32')]=_0x38ae50;if(_0x676f29[_0xfb93('0x47')][_0xfb93('0x54')]){_0x5e9fed[_0xfb93('0x55')]=[{'all':!![]}];}return db[_0xfb93('0x6d')][_0xfb93('0x56')](_0x5e9fed);})[_0xfb93('0x26')](function(_0x53467e){_0x5bcd38[_0xfb93('0x6f')]=_0x53467e;return _0x5bcd38;});}})['then'](respondWithFilteredResult(_0x1823d1,_0x5e9fed))[_0xfb93('0x57')](handleError(_0x1823d1,null));};exports[_0xfb93('0x70')]=function(_0x34ae02,_0x316c7e,_0x1767df){return db[_0xfb93('0x3e')]['find']({'where':{'id':_0x34ae02[_0xfb93('0x59')]['id']}})['then'](handleEntityNotFound(_0x316c7e,null))[_0xfb93('0x26')](function(_0xbe8be7){if(_0xbe8be7){return _0xbe8be7[_0xfb93('0x70')](_0x34ae02[_0xfb93('0x47')]['ids']);}})[_0xfb93('0x26')](respondWithStatusCode(_0x316c7e,null))['catch'](handleError(_0x316c7e,null));};exports[_0xfb93('0x71')]=function(_0x52494b,_0x29ce1f,_0x99c37d){if(_0x52494b[_0xfb93('0x67')]['id']){delete _0x52494b['body']['id'];}return db['OpenchannelAccount'][_0xfb93('0x62')]({'where':{'id':_0x52494b[_0xfb93('0x59')]['id']}})['then'](handleEntityNotFound(_0x29ce1f,null))[_0xfb93('0x26')](function(_0x411617){if(_0x411617){_0x52494b[_0xfb93('0x67')]['OpenchannelAccountId']=_0x411617['id'];return db[_0xfb93('0x72')][_0xfb93('0x5b')](_0x52494b['body']);}})['then'](respondWithResult(_0x29ce1f,null))[_0xfb93('0x57')](handleError(_0x29ce1f,null));};exports[_0xfb93('0x73')]=function(_0x125216,_0x313bae,_0x19ba46){var _0x258e01={'raw':![],'where':{}};var _0x3f3941={};var _0x8bbd2e={'count':0x0,'rows':[]};return db[_0xfb93('0x3e')][_0xfb93('0x6c')]({'where':{'id':_0x125216[_0xfb93('0x59')]['id']}})[_0xfb93('0x26')](handleEntityNotFound(_0x313bae,null))[_0xfb93('0x26')](function(_0x4e6930){if(_0x4e6930){_0x3f3941[_0xfb93('0x42')]=_['keys'](db[_0xfb93('0x72')]['rawAttributes']);_0x3f3941[_0xfb93('0x47')]=_[_0xfb93('0x44')](_0x125216[_0xfb93('0x47')]);_0x3f3941['filters']=_[_0xfb93('0x46')](_0x3f3941[_0xfb93('0x42')],_0x3f3941[_0xfb93('0x47')]);_0x258e01[_0xfb93('0x48')]=_[_0xfb93('0x46')](_0x3f3941['model'],qs['fields'](_0x125216['query'][_0xfb93('0x49')]));_0x258e01['attributes']=_0x258e01[_0xfb93('0x48')][_0xfb93('0x4a')]?_0x258e01[_0xfb93('0x48')]:_0x3f3941[_0xfb93('0x42')];if(!_0x125216[_0xfb93('0x47')][_0xfb93('0x4b')](_0xfb93('0x74'))){_0x258e01[_0xfb93('0x34')]=qs['limit'](_0x125216['query'][_0xfb93('0x34')]);_0x258e01['offset']=qs['offset'](_0x125216[_0xfb93('0x47')][_0xfb93('0x33')]);}_0x258e01[_0xfb93('0x4c')]=qs[_0xfb93('0x4d')](_0x125216[_0xfb93('0x47')][_0xfb93('0x4d')]);_0x258e01[_0xfb93('0x4e')]=qs['filters'](_[_0xfb93('0x4f')](_0x125216[_0xfb93('0x47')],_0x3f3941[_0xfb93('0x45')]));_0x258e01[_0xfb93('0x4e')][_0xfb93('0x6e')]=_0x4e6930['id'];if(_0x125216['query']['filter']){_0x258e01[_0xfb93('0x4e')]=_[_0xfb93('0x50')](_0x258e01[_0xfb93('0x4e')],{'$or':_[_0xfb93('0x43')](_0x258e01['attributes'],function(_0x23e6f6){var _0x2a2cfe={};_0x2a2cfe[_0x23e6f6]={'$like':'%'+_0x125216[_0xfb93('0x47')][_0xfb93('0x52')]+'%'};return _0x2a2cfe;})});}_0x258e01=_[_0xfb93('0x50')]({},_0x258e01,_0x125216[_0xfb93('0x53')]);return db[_0xfb93('0x72')][_0xfb93('0x32')]({'where':_0x258e01[_0xfb93('0x4e')]})['then'](function(_0x23b21f){_0x8bbd2e[_0xfb93('0x32')]=_0x23b21f;if(_0x125216[_0xfb93('0x47')][_0xfb93('0x54')]){_0x258e01[_0xfb93('0x55')]=[{'all':!![]}];}return db[_0xfb93('0x72')][_0xfb93('0x56')](_0x258e01);})[_0xfb93('0x26')](function(_0x496d74){_0x8bbd2e[_0xfb93('0x6f')]=_0x496d74;return _0x8bbd2e;});}})[_0xfb93('0x26')](respondWithFilteredResult(_0x313bae,_0x258e01))[_0xfb93('0x57')](handleError(_0x313bae,null));};exports[_0xfb93('0x75')]=function(_0xed7a8a,_0x37c244,_0x55f7ba){return db['OpenchannelAccount'][_0xfb93('0x62')]({'where':{'id':_0xed7a8a[_0xfb93('0x59')]['id']}})['then'](handleEntityNotFound(_0x37c244,null))[_0xfb93('0x26')](function(_0x549e51){if(_0x549e51){return _0x549e51[_0xfb93('0x75')](_0xed7a8a[_0xfb93('0x47')]['ids']);}})[_0xfb93('0x26')](respondWithStatusCode(_0x37c244,null))[_0xfb93('0x57')](handleError(_0x37c244,null));};exports[_0xfb93('0x76')]=function(_0x4ffc4f,_0x37dc39,_0x20aad4){var _0x3bfd86={'body':_0x4ffc4f[_0xfb93('0x67')],'channel':_0xfb93('0x77')};var _0x1e60d3=[];var _0x3e1a21=[];var _0x4413a1={};var _0x1fa181=![];return db[_0xfb93('0x78')][_0xfb93('0x68')]()[_0xfb93('0x26')](function(_0x1a5bce){if(!_0x1a5bce){throw new db[(_0xfb93('0x79'))][(_0xfb93('0x23'))](_0xfb93('0x7a'));}_0x1e60d3=_[_0xfb93('0x7b')](_[_0xfb93('0x44')](_0x1a5bce),[_0xfb93('0x7c'),_0xfb93('0x7d')]);_0x3e1a21=_['difference'](_[_0xfb93('0x44')](_0x1a5bce),['createdAt',_0xfb93('0x7d'),'CompanyId','ListId']);if(_0x4ffc4f[_0xfb93('0x67')]['id']){delete _0x4ffc4f[_0xfb93('0x67')]['id'];}if(_[_0xfb93('0x7e')](_0x4ffc4f[_0xfb93('0x67')]['from'])){throw new db[(_0xfb93('0x79'))][(_0xfb93('0x23'))](_0xfb93('0x7f'));}if(_[_0xfb93('0x7e')](_0x4ffc4f[_0xfb93('0x67')][_0xfb93('0x67')])||_0x4ffc4f[_0xfb93('0x67')]['body']===''){throw new db['Sequelize'][(_0xfb93('0x23'))](_0xfb93('0x80'));}if(_[_0xfb93('0x7e')](_0x4ffc4f[_0xfb93('0x67')]['mapKey'])){throw new db[(_0xfb93('0x79'))]['ValidationError'](_0xfb93('0x81')+_0x3e1a21);}if(!_[_0xfb93('0x82')](_0x3e1a21,_0x4ffc4f[_0xfb93('0x67')]['mapKey'])){throw new db['Sequelize']['ValidationError'](_0xfb93('0x83')+_0x3e1a21);}_0x4413a1[_0x4ffc4f[_0xfb93('0x67')][_0xfb93('0x84')]]=_0x4ffc4f[_0xfb93('0x67')][_0xfb93('0x85')];})['then'](function(){return db[_0xfb93('0x3e')][_0xfb93('0x62')]({'where':{'id':_0x4ffc4f[_0xfb93('0x59')]['id']},'include':[{'model':db[_0xfb93('0x86')],'as':_0xfb93('0x87'),'include':[{'model':db[_0xfb93('0x78')],'as':_0xfb93('0x88'),'where':_0x4413a1,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xfb93('0x89')],'as':_0xfb93('0x8a')}]});})['then'](handleEntityNotFound(_0x37dc39,null))[_0xfb93('0x26')](function(_0x34fbf6){if(_0x34fbf6&&_0x34fbf6[_0xfb93('0x87')]){_0x3bfd86[_0xfb93('0x8b')]=_0x34fbf6;_0x3bfd86[_0xfb93('0x8c')]=_0x34fbf6['Applications'];_0x3bfd86[_0xfb93('0x8d')]=_0x34fbf6[_0xfb93('0x87')];_0x3bfd86[_0xfb93('0x8c')]=_['orderBy'](_0x3bfd86[_0xfb93('0x8c')],[_0xfb93('0x8e')],[_0xfb93('0x8f')]);if(_0x3bfd86['account'][_0xfb93('0x8a')]){delete _0x3bfd86[_0xfb93('0x8b')][_0xfb93('0x8a')];}if(_0x3bfd86[_0xfb93('0x8b')][_0xfb93('0x87')]&&_0x3bfd86[_0xfb93('0x8b')]['List']['Contacts'][_0xfb93('0x4a')]){return _0x3bfd86[_0xfb93('0x8b')]['List'][_0xfb93('0x88')][0x0];}var _0xe8b58d=_[_0xfb93('0x1a')](_0x4ffc4f['body'],{'firstName':_0x4ffc4f[_0xfb93('0x67')][_0xfb93('0x85')],'ListId':_0x34fbf6[_0xfb93('0x90')]});_0xe8b58d[_0x4ffc4f[_0xfb93('0x67')]['mapKey']]=_0x4ffc4f[_0xfb93('0x67')][_0xfb93('0x85')];return db[_0xfb93('0x78')]['create'](_0xe8b58d,{'fields':_0x1e60d3,'raw':!![]});}})[_0xfb93('0x26')](handleEntityNotFound(_0x37dc39,null))[_0xfb93('0x26')](function(_0x4c8297){_0x3bfd86[_0xfb93('0x91')]=_0x4c8297;if(_0x4c8297){var _0x441f22={'ContactId':_0x4c8297['id'],'OpenchannelAccountId':_0x4ffc4f['params']['id'],'from':(_0x4c8297['firstName']||'')+'\x20'+(_0x4c8297[_0xfb93('0x92')]||'')};var _0x2d561c={'OpenchannelAccountId':_0x4ffc4f['params']['id'],'closed':![]};if(_0x4ffc4f['body'][_0xfb93('0x93')]){_0x2d561c[_0xfb93('0x93')]=_0x4ffc4f[_0xfb93('0x67')][_0xfb93('0x93')];return db[_0xfb93('0x94')][_0xfb93('0x62')]({'where':_0x2d561c})[_0xfb93('0x26')](function(_0x38081d){if(_0x38081d){return[_0x38081d,![]];}_0x441f22[_0xfb93('0x93')]=_0x4ffc4f[_0xfb93('0x67')][_0xfb93('0x93')];_0x441f22[_0xfb93('0x95')]=_0x4ffc4f[_0xfb93('0x67')][_0xfb93('0x95')];return db[_0xfb93('0x94')][_0xfb93('0x5b')](_0x441f22)[_0xfb93('0x26')](function(_0x2fead3){return[_0x2fead3,!![]];});});}else{_0x2d561c[_0xfb93('0x93')]=null;}_0x2d561c[_0xfb93('0x96')]=_0x4c8297['id'];return db[_0xfb93('0x94')]['find']({'where':_0x2d561c})[_0xfb93('0x26')](function(_0x1d1970){if(_0x1d1970){return[_0x1d1970,![]];}return db[_0xfb93('0x94')]['create'](_0x441f22)[_0xfb93('0x26')](function(_0x15a296){return[_0x15a296,!![]];});});}})['spread'](function(_0x6f6680,_0x59845f){if(_0x6f6680){_0x1fa181=_0x59845f;if(!_0x59845f){var _0xb90e7f={'from':(_0x3bfd86[_0xfb93('0x91')]['firstName']||'')+'\x20'+(_0x3bfd86[_0xfb93('0x91')][_0xfb93('0x92')]||'')};if(_0x4ffc4f[_0xfb93('0x67')]['threadId']&&_0x4ffc4f['body'][_0xfb93('0x97')]&&_0x4ffc4f[_0xfb93('0x67')][_0xfb93('0x93')]!=_0x4ffc4f[_0xfb93('0x67')]['messageId']){_0xb90e7f['threadId']=_0x4ffc4f[_0xfb93('0x67')][_0xfb93('0x97')];}return _0x6f6680[_0xfb93('0x66')](_0xb90e7f);}else{return _0x6f6680;}}})[_0xfb93('0x26')](function(_0x5047a0){_0x3bfd86['interaction']=_0x5047a0[_0xfb93('0x5d')]({'plain':!![]});_0x3bfd86[_0xfb93('0x98')]['created']=_0x1fa181;if(_0x3bfd86[_0xfb93('0x98')][_0xfb93('0x99')]){if(_0x3bfd86[_0xfb93('0x8b')][_0xfb93('0x9a')]){_0x3bfd86[_0xfb93('0x8c')][_0xfb93('0x9b')]({'id':0x0,'priority':_0x3bfd86[_0xfb93('0x8c')][_0xfb93('0x4a')]+0x1,'app':'close','appdata':_0xfb93('0x9c'),'interval':_0xfb93('0x9d')});}}return db['OpenchannelMessage']['create']({'body':_0x4ffc4f[_0xfb93('0x67')][_0xfb93('0x67')],'OpenchannelAccountId':_0x4ffc4f[_0xfb93('0x59')]['id'],'OpenchannelInteractionId':_0x5047a0['id'],'direction':'in','ContactId':_0x3bfd86['contact']['id'],'AttachmentId':_0x4ffc4f[_0xfb93('0x67')][_0xfb93('0x9e')]});})[_0xfb93('0x26')](function(_0xc20175){_0x3bfd86[_0xfb93('0x2c')]=_0xc20175;if(_0x3bfd86['interaction']['UserId']){return db[_0xfb93('0x9f')][_0xfb93('0x62')]({'attributes':['id',_0xfb93('0x51')],'where':{'id':_0x3bfd86['interaction']['UserId']}})[_0xfb93('0x26')](function(_0xe32304){if(_0xe32304){_0x3bfd86[_0xfb93('0x8c')][_0xfb93('0xa0')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xe32304['name']+','+(_0x3bfd86[_0xfb93('0x8b')]['waitForTheAssignedAgent']||0xa),'interval':_0xfb93('0x9d')});_0x3bfd86[_0xfb93('0xa1')]=![];}return respondWithRpcPromise(_0xfb93('0xa2'),'startRouting',_0x3bfd86);});}return respondWithRpcPromise(_0xfb93('0xa2'),_0xfb93('0xa3'),_0x3bfd86);})[_0xfb93('0x26')](function(_0x1ffa16){respondWithRpcPromise('EventManager',_0xfb93('0xa4'),{'event':_0xfb93('0x76'),'message':_0x1ffa16},client9002);return _0x1ffa16;})[_0xfb93('0x26')](respondWithResult(_0x37dc39,null))['catch'](handleError(_0x37dc39,null));};exports[_0xfb93('0xa5')]=function(_0x58ce13,_0x447409,_0x6c15d8){return db[_0xfb93('0x3e')]['findOne']({'where':{'id':_0x58ce13[_0xfb93('0x59')]['id']}})[_0xfb93('0x26')](handleEntityNotFound(_0x447409,null))['then'](function(_0x54f07b){if(_0x54f07b){return db[_0xfb93('0xa6')]['transaction'](function(_0x33f0b8){return db[_0xfb93('0x89')]['destroy']({'where':{'OpenchannelAccountId':_0x58ce13[_0xfb93('0x59')]['id']},'transaction':_0x33f0b8})[_0xfb93('0x26')](function(_0x4fe161){var _0x3c7e48=_[_0xfb93('0x43')](_0x58ce13[_0xfb93('0x67')],function(_0xca6885){_0xca6885[_0xfb93('0x6e')]=_0x58ce13[_0xfb93('0x59')]['id'];return _0xca6885;});return db['OpenchannelApplication'][_0xfb93('0xa7')](_0x3c7e48,{'transaction':_0x33f0b8});});})[_0xfb93('0x26')](function(){return db[_0xfb93('0x89')][_0xfb93('0xa8')]({'where':{'OpenchannelAccountId':_0x58ce13['params']['id']},'order':_0xfb93('0x8e')});});}})[_0xfb93('0x26')](respondWithResult(_0x447409,null))[_0xfb93('0x57')](handleError(_0x447409,null));};exports[_0xfb93('0xa9')]=function(_0x22b36b,_0x436935,_0x521340){var _0x45f1e8={};var _0x1f23cd={};var _0x284798;var _0x324ac6;return db[_0xfb93('0x3e')]['findOne']({'where':{'id':_0x22b36b[_0xfb93('0x59')]['id']}})[_0xfb93('0x26')](handleEntityNotFound(_0x436935,null))[_0xfb93('0x26')](function(_0x229dc1){if(_0x229dc1){_0x284798=_0x229dc1;_0x1f23cd['model']=_['keys'](db[_0xfb93('0x89')]['rawAttributes']);_0x1f23cd[_0xfb93('0x47')]=_['keys'](_0x22b36b[_0xfb93('0x47')]);_0x1f23cd[_0xfb93('0x45')]=_[_0xfb93('0x46')](_0x1f23cd[_0xfb93('0x42')],_0x1f23cd['query']);_0x45f1e8['attributes']=_[_0xfb93('0x46')](_0x1f23cd[_0xfb93('0x42')],qs[_0xfb93('0x49')](_0x22b36b[_0xfb93('0x47')]['fields']));_0x45f1e8['attributes']=_0x45f1e8[_0xfb93('0x48')][_0xfb93('0x4a')]?_0x45f1e8[_0xfb93('0x48')]:_0x1f23cd[_0xfb93('0x42')];_0x45f1e8[_0xfb93('0x4c')]=qs[_0xfb93('0x4d')](_0x22b36b['query']['sort']);_0x45f1e8[_0xfb93('0x4e')]=qs[_0xfb93('0x45')](_[_0xfb93('0x4f')](_0x22b36b[_0xfb93('0x47')],_0x1f23cd[_0xfb93('0x45')]));if(_0x22b36b[_0xfb93('0x47')][_0xfb93('0x52')]){_0x45f1e8[_0xfb93('0x4e')]=_[_0xfb93('0x50')](_0x45f1e8[_0xfb93('0x4e')],{'$or':_['map'](_0x45f1e8[_0xfb93('0x48')],function(_0x289120){var _0x5e8f8d={};_0x5e8f8d[_0x289120]={'$like':'%'+_0x22b36b[_0xfb93('0x47')]['filter']+'%'};return _0x5e8f8d;})});}_0x45f1e8=_[_0xfb93('0x50')]({},_0x45f1e8,_0x22b36b[_0xfb93('0x53')]);return _0x284798['getApplications'](_0x45f1e8);}})[_0xfb93('0x26')](function(_0x175869){if(_0x175869){_0x324ac6=_0x175869[_0xfb93('0x4a')];if(!_0x22b36b[_0xfb93('0x47')]['hasOwnProperty'](_0xfb93('0x74'))){_0x45f1e8[_0xfb93('0x34')]=qs[_0xfb93('0x34')](_0x22b36b[_0xfb93('0x47')]['limit']);_0x45f1e8[_0xfb93('0x33')]=qs[_0xfb93('0x33')](_0x22b36b[_0xfb93('0x47')][_0xfb93('0x33')]);}return _0x284798[_0xfb93('0xa9')](_0x45f1e8);}})[_0xfb93('0x26')](function(_0x2a6e33){if(_0x2a6e33){return _0x2a6e33?{'count':_0x324ac6,'rows':_0x2a6e33}:null;}})['then'](respondWithResult(_0x436935,null))['catch'](handleError(_0x436935,null));};exports['getInteractions']=function(_0x20d9ad,_0x35607c,_0x1cb07f){var _0x2911fd={'raw':![],'where':{}};var _0x18ba2d={};var _0x2a6bc1={'count':0x0,'rows':[]};return db[_0xfb93('0x3e')][_0xfb93('0x6c')]({'where':{'id':_0x20d9ad[_0xfb93('0x59')]['id']}})[_0xfb93('0x26')](handleEntityNotFound(_0x35607c,null))[_0xfb93('0x26')](function(_0x2da7b2){if(_0x2da7b2){_0x18ba2d['model']=_['keys'](db[_0xfb93('0x94')][_0xfb93('0x3f')]);_0x18ba2d[_0xfb93('0x47')]=_['keys'](_0x20d9ad[_0xfb93('0x47')]);_0x18ba2d['filters']=_[_0xfb93('0x46')](_0x18ba2d[_0xfb93('0x42')],_0x18ba2d[_0xfb93('0x47')]);_0x2911fd[_0xfb93('0x48')]=_[_0xfb93('0x46')](_0x18ba2d[_0xfb93('0x42')],qs[_0xfb93('0x49')](_0x20d9ad['query'][_0xfb93('0x49')]));_0x2911fd['attributes']=_0x2911fd[_0xfb93('0x48')][_0xfb93('0x4a')]?_0x2911fd[_0xfb93('0x48')]:_0x18ba2d[_0xfb93('0x42')];if(!_0x20d9ad[_0xfb93('0x47')][_0xfb93('0x4b')](_0xfb93('0x74'))){_0x2911fd[_0xfb93('0x34')]=qs[_0xfb93('0x34')](_0x20d9ad[_0xfb93('0x47')]['limit']);_0x2911fd['offset']=qs[_0xfb93('0x33')](_0x20d9ad[_0xfb93('0x47')][_0xfb93('0x33')]);}_0x2911fd['order']=qs[_0xfb93('0x4d')](_0x20d9ad[_0xfb93('0x47')]['sort']);_0x2911fd[_0xfb93('0x4e')]=qs[_0xfb93('0x45')](_[_0xfb93('0x4f')](_0x20d9ad[_0xfb93('0x47')],_0x18ba2d[_0xfb93('0x45')]));_0x2911fd[_0xfb93('0x4e')]['OpenchannelAccountId']=_0x2da7b2['id'];if(_0x20d9ad['query'][_0xfb93('0x52')]){_0x2911fd['where']=_[_0xfb93('0x50')](_0x2911fd['where'],{'$or':_[_0xfb93('0x43')](_0x2911fd[_0xfb93('0x48')],function(_0x64a47b){var _0x83b18={};_0x83b18[_0x64a47b]={'$like':'%'+_0x20d9ad[_0xfb93('0x47')][_0xfb93('0x52')]+'%'};return _0x83b18;})});}_0x2911fd=_['merge']({},_0x2911fd,_0x20d9ad[_0xfb93('0x53')]);return db[_0xfb93('0x94')]['count']({'where':_0x2911fd[_0xfb93('0x4e')]})['then'](function(_0x5d24db){_0x2a6bc1[_0xfb93('0x32')]=_0x5d24db;if(_0x20d9ad[_0xfb93('0x47')]['includeAll']){_0x2911fd[_0xfb93('0x55')]=[{'model':db['CmContact'],'as':_0xfb93('0xaa'),'required':![]},{'model':db[_0xfb93('0x9f')],'as':_0xfb93('0xab'),'attributes':[_0xfb93('0x51'),_0xfb93('0xac'),'internal'],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xfb93('0x51'),'color'],'where':_0x20d9ad[_0xfb93('0x47')][_0xfb93('0xad')]?{'id':_0x20d9ad[_0xfb93('0x47')]['tag']}:undefined,'required':_0x20d9ad[_0xfb93('0x47')][_0xfb93('0xad')]?!![]:![]}];}return db[_0xfb93('0x94')]['findAll'](_0x2911fd);})[_0xfb93('0x26')](function(_0xc2ad66){_0x2a6bc1[_0xfb93('0x6f')]=_0xc2ad66;return _0x2a6bc1;});}})[_0xfb93('0x26')](respondWithFilteredResult(_0x35607c,_0x2911fd))[_0xfb93('0x57')](handleError(_0x35607c,null));};exports['addAgents']=function(_0xb07332,_0x2ade97,_0x2356a8){return db[_0xfb93('0x3e')][_0xfb93('0x62')]({'where':{'id':_0xb07332['params']['id']}})[_0xfb93('0x26')](handleEntityNotFound(_0x2ade97,null))[_0xfb93('0x26')](function(_0x18b48c){if(_0x18b48c){return _0x18b48c['addAgents'](_0xb07332[_0xfb93('0x67')]['ids'],_[_0xfb93('0xae')](_0xb07332[_0xfb93('0x67')],[_0xfb93('0xaf'),'id'])||{})[_0xfb93('0xb0')](function(_0x4c01cd){for(var _0x5d9da6=0x0;_0x5d9da6<_0xb07332['body'][_0xfb93('0xaf')]['length'];_0x5d9da6+=0x1){socket['emit'](_0xfb93('0xb1'),{'UserId':_0xb07332[_0xfb93('0x67')]['ids'][_0x5d9da6],'OpenchannelAccountId':_0xb07332[_0xfb93('0x59')]['id']});}return _0x4c01cd;});}})[_0xfb93('0x26')](respondWithResult(_0x2ade97,null))[_0xfb93('0x57')](handleError(_0x2ade97,null));};exports[_0xfb93('0xb2')]=function(_0x2b28a6,_0x20e3e2,_0x1072e4){return db[_0xfb93('0x3e')][_0xfb93('0x62')]({'where':{'id':_0x2b28a6[_0xfb93('0x59')]['id']}})[_0xfb93('0x26')](handleEntityNotFound(_0x20e3e2,null))[_0xfb93('0x26')](function(_0x260ece){if(_0x260ece){return _0x260ece[_0xfb93('0xb2')](_0x2b28a6['query'][_0xfb93('0xaf')])[_0xfb93('0x26')](function(){if(_[_0xfb93('0xb3')](_0x2b28a6['query']['ids'])){for(var _0x5f11a3=0x0;_0x5f11a3<_0x2b28a6[_0xfb93('0x47')][_0xfb93('0xaf')][_0xfb93('0x4a')];_0x5f11a3+=0x1){socket[_0xfb93('0xb4')](_0xfb93('0xb5'),{'UserId':Number(_0x2b28a6[_0xfb93('0x47')][_0xfb93('0xaf')][_0x5f11a3]),'OpenchannelAccountId':Number(_0x2b28a6[_0xfb93('0x59')]['id'])});}}else{socket[_0xfb93('0xb4')]('userOpenchannelAccount:remove',{'UserId':Number(_0x2b28a6[_0xfb93('0x47')][_0xfb93('0xaf')]),'OpenchannelAccountId':Number(_0x2b28a6[_0xfb93('0x59')]['id'])});}});}})[_0xfb93('0x26')](respondWithStatusCode(_0x20e3e2,null))[_0xfb93('0x57')](handleError(_0x20e3e2,null));};exports[_0xfb93('0xb6')]=function(_0x3cb6a4,_0x1bd1eb,_0x2c396b){var _0xd37033={};var _0x48b816={};var _0x5f0e4f;var _0x7c9f8d;return db['OpenchannelAccount'][_0xfb93('0x6c')]({'where':{'id':_0x3cb6a4[_0xfb93('0x59')]['id']}})['then'](handleEntityNotFound(_0x1bd1eb,null))[_0xfb93('0x26')](function(_0xe7a610){if(_0xe7a610){_0x5f0e4f=_0xe7a610;_0x48b816['model']=_[_0xfb93('0x44')](db[_0xfb93('0x9f')][_0xfb93('0x3f')]);_0x48b816[_0xfb93('0x47')]=_['keys'](_0x3cb6a4[_0xfb93('0x47')]);_0x48b816[_0xfb93('0x45')]=_[_0xfb93('0x46')](_0x48b816[_0xfb93('0x42')],_0x48b816[_0xfb93('0x47')]);_0xd37033[_0xfb93('0x48')]=_[_0xfb93('0x46')](_0x48b816[_0xfb93('0x42')],qs[_0xfb93('0x49')](_0x3cb6a4[_0xfb93('0x47')][_0xfb93('0x49')]));_0xd37033[_0xfb93('0x48')]=_0xd37033[_0xfb93('0x48')][_0xfb93('0x4a')]?_0xd37033['attributes']:_0x48b816['model'];_0xd37033[_0xfb93('0x4c')]=qs[_0xfb93('0x4d')](_0x3cb6a4[_0xfb93('0x47')][_0xfb93('0x4d')]);_0xd37033[_0xfb93('0x4e')]=qs['filters'](_['pick'](_0x3cb6a4[_0xfb93('0x47')],_0x48b816['filters']));if(_0x3cb6a4[_0xfb93('0x47')][_0xfb93('0x52')]){_0xd37033['where']=_[_0xfb93('0x50')](_0xd37033[_0xfb93('0x4e')],{'$or':_[_0xfb93('0x43')](_0xd37033[_0xfb93('0x48')],function(_0xe16dc9){var _0x4ffd01={};_0x4ffd01[_0xe16dc9]={'$like':'%'+_0x3cb6a4[_0xfb93('0x47')][_0xfb93('0x52')]+'%'};return _0x4ffd01;})});}_0xd37033=_['merge']({},_0xd37033,_0x3cb6a4[_0xfb93('0x53')]);return _0x5f0e4f[_0xfb93('0xb6')](_0xd37033);}})['then'](function(_0x15b243){if(_0x15b243){_0x7c9f8d=_0x15b243[_0xfb93('0x4a')];if(!_0x3cb6a4[_0xfb93('0x47')][_0xfb93('0x4b')](_0xfb93('0x74'))){_0xd37033['limit']=qs[_0xfb93('0x34')](_0x3cb6a4[_0xfb93('0x47')][_0xfb93('0x34')]);_0xd37033[_0xfb93('0x33')]=qs[_0xfb93('0x33')](_0x3cb6a4['query'][_0xfb93('0x33')]);}return _0x5f0e4f[_0xfb93('0xb6')](_0xd37033);}})[_0xfb93('0x26')](function(_0x4176fa){if(_0x4176fa){return _0x4176fa?{'count':_0x7c9f8d,'rows':_0x4176fa}:null;}})['then'](respondWithResult(_0x1bd1eb,null))[_0xfb93('0x57')](handleError(_0x1bd1eb,null));};exports['send']=function(_0x44ee92,_0x57aadf,_0x24335b){var _0x31dead,_0x35975b,_0x3f9c6c;if(_[_0xfb93('0x7e')](_0x44ee92[_0xfb93('0x67')][_0xfb93('0x67')])||_0x44ee92[_0xfb93('0x67')][_0xfb93('0x67')]===''){throw new db['Sequelize'][(_0xfb93('0x23'))](_0xfb93('0x80'));}if(_['isNil'](_0x44ee92['body']['to'])){}_0x31dead=_0x44ee92['body']['to'];return db[_0xfb93('0x3e')][_0xfb93('0x6c')]({'where':{'id':_0x44ee92[_0xfb93('0x59')]['id']}})[_0xfb93('0x26')](handleEntityNotFound(_0x57aadf,null))[_0xfb93('0x26')](function(_0xda419d){if(_0xda419d){return db['OpenchannelAccount'][_0xfb93('0x62')]({'where':{'id':_0xda419d['id']},'include':[{'model':db[_0xfb93('0x86')],'as':_0xfb93('0x87'),'include':[{'model':db[_0xfb93('0x78')],'as':_0xfb93('0x88'),'where':{[_0xda419d[_0xfb93('0x84')]]:_0x31dead},'limit':0x1,'order':[[_0xfb93('0x7d'),_0xfb93('0xb7')]]}]}]})[_0xfb93('0x26')](handleEntityNotFound(_0x57aadf,null))[_0xfb93('0x26')](function(_0x47fea4){if(_0x47fea4&&_0x47fea4[_0xfb93('0x87')]){_0x35975b=_0x47fea4['get']({'plain':!![]});if(_0x35975b[_0xfb93('0x87')]&&_0x35975b[_0xfb93('0x87')][_0xfb93('0x88')]['length']){return _0x35975b['List'][_0xfb93('0x88')][0x0];}return db[_0xfb93('0x78')][_0xfb93('0x5b')](_[_0xfb93('0x1a')](_0x44ee92['body'],{'firstName':_0x31dead,[_0x47fea4[_0xfb93('0x84')]]:_0x31dead,'phone':_0x31dead,'ListId':_0x35975b[_0xfb93('0x90')]}));}})[_0xfb93('0x26')](handleEntityNotFound(_0x57aadf,null))[_0xfb93('0x26')](function(_0x2726cb){if(_0x2726cb){_0x3f9c6c=_0x2726cb;return db[_0xfb93('0x94')][_0xfb93('0x62')]({'where':{'ContactId':_0x3f9c6c['id'],'closed':![],'OpenchannelAccountId':_0x35975b['id']}})['then'](function(_0x59b024){if(_0x59b024){return[_0x59b024,![]];}return db[_0xfb93('0x94')][_0xfb93('0x5b')]({'UserId':_0x44ee92[_0xfb93('0x5c')]['id'],'ContactId':_0x3f9c6c['id'],'OpenchannelAccountId':_0x35975b['id'],'lastMsgDirection':_0xfb93('0xb8'),'Messages':[_[_0xfb93('0x50')](_0x44ee92[_0xfb93('0x67')],{'read':![],'body':_0x44ee92[_0xfb93('0x67')][_0xfb93('0x67')],'OpenchannelAccountId':_0x35975b['id'],'UserId':_0x44ee92[_0xfb93('0x5c')]['id'],'ContactId':_0x3f9c6c['id']})]},{'include':[{'model':db[_0xfb93('0xb9')],'as':_0xfb93('0xba')}]})['then'](function(_0x19c736){return[_0x19c736,!![]];});});}})[_0xfb93('0xb0')](function(_0x54bb44,_0x13dc08){if(_0x13dc08){return _0x54bb44;}return db[_0xfb93('0xb9')][_0xfb93('0x5b')](_['merge'](_0x44ee92[_0xfb93('0x67')],{'read':![],'body':_0x44ee92['body'][_0xfb93('0x67')],'OpenchannelAccountId':_0x35975b['id'],'OpenchannelInteractionId':_0x54bb44['id'],'UserId':_0x44ee92['user']['id'],'ContactId':_0x3f9c6c['id']}))[_0xfb93('0x26')](function(_0x120df1){_0x54bb44['dataValues'][_0xfb93('0xba')]=[];_0x54bb44[_0xfb93('0xbb')]['Messages'][_0xfb93('0x9b')](_0x120df1[_0xfb93('0xbb')]);return _0x54bb44;});});}})['then'](respondWithResult(_0x57aadf,null))[_0xfb93('0x57')](handleError(_0x57aadf,null));}; \ No newline at end of file +var _0x92c3=['OpenchannelAccount','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','count','includeAll','findAll','rows','params','Pause','keys','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','mandatoryDispositionPause','describe','addDisposition','OpnechannelAccountId','Disposition','getDispositions','findOne','OpenchannelAccountId','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','OpenchannelApplication','applications','list','orderBy','priority','asc','account','List','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','messageId','interaction','created','autoclose','close','*,*,*,*','OpenchannelMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','notify','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Owner','fullname','internal','Tags','tag','addAgents','spread','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','register','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','send','map'];(function(_0xd3a581,_0x4a8817){var _0x16cee6=function(_0x58102a){while(--_0x58102a){_0xd3a581['push'](_0xd3a581['shift']());}};_0x16cee6(++_0x4a8817);}(_0x92c3,0x136));var _0x392c=function(_0x5e24a6,_0x2418bd){_0x5e24a6=_0x5e24a6-0x0;var _0x43a664=_0x92c3[_0x5e24a6];return _0x43a664;};'use strict';var pdf=require(_0x392c('0x0'));var emlformat=require(_0x392c('0x1'));var rimraf=require(_0x392c('0x2'));var zipdir=require(_0x392c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x392c('0x4'));var moment=require(_0x392c('0x5'));var BPromise=require(_0x392c('0x6'));var Mustache=require(_0x392c('0x7'));var util=require('util');var path=require(_0x392c('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x392c('0x9'));var fs=require('fs');var _=require(_0x392c('0xa'));var squel=require('squel');var crypto=require(_0x392c('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x392c('0xc'));var toCsv=require(_0x392c('0xd'));var querystring=require(_0x392c('0xe'));var Papa=require(_0x392c('0xf'));var Redis=require(_0x392c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x392c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x392c('0x12'));var logger=require(_0x392c('0x13'))(_0x392c('0x14'));var utils=require(_0x392c('0x15'));var config=require(_0x392c('0x16'));var db=require(_0x392c('0x17'))['db'];config[_0x392c('0x18')]=_[_0x392c('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x392c('0x18')]));require('./openchannelAccount.socket')[_0x392c('0x1a')](socket);var jayson=require(_0x392c('0x1b'));var client=jayson[_0x392c('0x1c')][_0x392c('0x1d')]({'port':0x232c});var client9002=jayson[_0x392c('0x1c')]['http']({'port':0x232a});function checkPasswordPattern(_0x3ce0ef,_0x58dbbb,_0x524c6b){if(_0x524c6b){var _0x20a41b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x20a41b[_0x392c('0x1e')](_0x58dbbb)){return _0x3ce0ef;}else{throw new db['Sequelize']['ValidationError'](_0x392c('0x1f'));}}else{return _0x3ce0ef;}}function respondWithRpcPromise(_0x2c6a81,_0x296627,_0x19e01f,_0x462785){return new BPromise(function(_0x5a4019,_0x339666){var _0x5c6d4b=_0x462785||client;return _0x5c6d4b[_0x392c('0x20')](_0x2c6a81,_0x19e01f)[_0x392c('0x21')](function(_0x53453f){logger[_0x392c('0x22')](_0x392c('0x23'),_0x296627,_0x392c('0x24'));logger[_0x392c('0x25')](_0x392c('0x26'),_0x296627,_0x392c('0x24'),JSON[_0x392c('0x27')](_0x53453f));if(_0x53453f[_0x392c('0x28')]){if(_0x53453f['error'][_0x392c('0x29')]===0x1f4){logger[_0x392c('0x28')](_0x392c('0x23'),_0x296627,_0x53453f[_0x392c('0x28')][_0x392c('0x2a')]);return _0x339666(_0x53453f['error']['message']);}logger[_0x392c('0x28')](_0x392c('0x23'),_0x296627,_0x53453f['error'][_0x392c('0x2a')]);return _0x5a4019(_0x53453f[_0x392c('0x28')][_0x392c('0x2a')]);}else{logger[_0x392c('0x22')](_0x392c('0x23'),_0x296627,'request\x20sent');_0x5a4019(_0x53453f['result'][_0x392c('0x2a')]);}})[_0x392c('0x2b')](function(_0x75839f){logger['error'](_0x392c('0x23'),_0x296627,_0x75839f);_0x339666(_0x75839f);});});}function respondWithStatusCode(_0x1c7b3f,_0x2b3d86){_0x2b3d86=_0x2b3d86||0xcc;return function(_0x5a9b8e){if(_0x5a9b8e){return _0x1c7b3f[_0x392c('0x2c')](_0x2b3d86);}return _0x1c7b3f[_0x392c('0x2d')](_0x2b3d86)[_0x392c('0x2e')]();};}function respondWithResult(_0x4fb512,_0x44b652){_0x44b652=_0x44b652||0xc8;return function(_0x3fb3af){if(_0x3fb3af){return _0x4fb512['status'](_0x44b652)[_0x392c('0x2f')](_0x3fb3af);}};}function respondWithFilteredResult(_0x1de583,_0x2c0393){return function(_0x36eedb){if(_0x36eedb){var _0x4de5d7=_0x36eedb['count'],_0x18e576=_0x2c0393[_0x392c('0x30')],_0x59ccf3=_0x2c0393[_0x392c('0x30')]+_0x2c0393[_0x392c('0x31')],_0x2b8449;if(_0x59ccf3>=_0x4de5d7){_0x59ccf3=_0x4de5d7;_0x2b8449=0xc8;}else{_0x2b8449=0xce;}_0x1de583[_0x392c('0x2d')](_0x2b8449);return _0x1de583[_0x392c('0x32')](_0x392c('0x33'),_0x18e576+'-'+_0x59ccf3+'/'+_0x4de5d7)[_0x392c('0x2f')](_0x36eedb);}return null;};}function patchUpdates(_0x57f3fa){return function(_0x5f4bbe){try{jsonpatch[_0x392c('0x34')](_0x5f4bbe,_0x57f3fa,!![]);}catch(_0x263b5d){return BPromise[_0x392c('0x35')](_0x263b5d);}return _0x5f4bbe[_0x392c('0x36')]();};}function saveUpdates(_0x4bd530,_0x137271){return function(_0x596810){if(_0x596810){return _0x596810[_0x392c('0x37')](_0x4bd530)[_0x392c('0x21')](function(_0x449336){return _0x449336;});}return null;};}function removeEntity(_0x3f1b55,_0x2cd25e){return function(_0x21cf3c){if(_0x21cf3c){return _0x21cf3c[_0x392c('0x38')]()[_0x392c('0x21')](function(){var _0x4dd755=_0x21cf3c[_0x392c('0x39')]({'plain':!![]});var _0x33dd75=_0x392c('0x3a');return db[_0x392c('0x3b')]['destroy']({'where':{'type':_0x33dd75,'resourceId':_0x4dd755['id']}})[_0x392c('0x21')](function(){return _0x21cf3c;});})[_0x392c('0x21')](function(){_0x3f1b55['status'](0xcc)[_0x392c('0x2e')]();});}};}function handleEntityNotFound(_0x1d8640,_0x1f5ac1){return function(_0x5ca635){if(!_0x5ca635){_0x1d8640[_0x392c('0x2c')](0x194);}return _0x5ca635;};}function handleError(_0x543eb5,_0x4b5e3d){_0x4b5e3d=_0x4b5e3d||0x1f4;return function(_0x182ec8){logger[_0x392c('0x28')](_0x182ec8[_0x392c('0x3c')]);if(_0x182ec8[_0x392c('0x3d')]){delete _0x182ec8[_0x392c('0x3d')];}_0x543eb5['status'](_0x4b5e3d)[_0x392c('0x3e')](_0x182ec8);};}exports['index']=function(_0x7d23b0,_0xcbd564){var _0x2afab2={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x59fe9e={},_0x234602={'count':0x0,'rows':[]};var _0x57ee42=_[_0x392c('0x3f')](db[_0x392c('0x40')]['rawAttributes'],function(_0x5bb9ec){return{'name':_0x5bb9ec['fieldName'],'type':_0x5bb9ec[_0x392c('0x41')][_0x392c('0x42')]};});_0x59fe9e[_0x392c('0x43')]=_[_0x392c('0x3f')](_0x57ee42,'name');_0x59fe9e[_0x392c('0x44')]=_['keys'](_0x7d23b0[_0x392c('0x44')]);_0x59fe9e[_0x392c('0x45')]=_[_0x392c('0x46')](_0x59fe9e[_0x392c('0x43')],_0x59fe9e[_0x392c('0x44')]);_0x2afab2[_0x392c('0x47')]=_['intersection'](_0x59fe9e[_0x392c('0x43')],qs[_0x392c('0x48')](_0x7d23b0[_0x392c('0x44')][_0x392c('0x48')]));_0x2afab2[_0x392c('0x47')]=_0x2afab2[_0x392c('0x47')][_0x392c('0x49')]?_0x2afab2['attributes']:_0x59fe9e[_0x392c('0x43')];if(!_0x7d23b0[_0x392c('0x44')][_0x392c('0x4a')](_0x392c('0x4b'))){_0x2afab2['limit']=qs[_0x392c('0x31')](_0x7d23b0[_0x392c('0x44')][_0x392c('0x31')]);_0x2afab2['offset']=qs['offset'](_0x7d23b0['query'][_0x392c('0x30')]);}_0x2afab2[_0x392c('0x4c')]=qs['sort'](_0x7d23b0['query'][_0x392c('0x4d')]);_0x2afab2['where']=qs['filters'](_[_0x392c('0x4e')](_0x7d23b0['query'],_0x59fe9e['filters']),_0x57ee42);if(_0x7d23b0[_0x392c('0x44')][_0x392c('0x4f')]){_0x2afab2[_0x392c('0x50')]=_[_0x392c('0x51')](_0x2afab2[_0x392c('0x50')],{'$or':_[_0x392c('0x3f')](_0x57ee42,function(_0x3a9f9a){if(_0x3a9f9a['type']!=='VIRTUAL'){var _0x1a87ee={};_0x1a87ee[_0x3a9f9a['name']]={'$like':'%'+_0x7d23b0[_0x392c('0x44')][_0x392c('0x4f')]+'%'};return _0x1a87ee;}})});}_0x2afab2=_[_0x392c('0x51')]({},_0x2afab2,_0x7d23b0[_0x392c('0x52')]);var _0x533e79={'where':_0x2afab2[_0x392c('0x50')]};return db[_0x392c('0x40')][_0x392c('0x53')](_0x533e79)[_0x392c('0x21')](function(_0x5a1d5c){_0x234602[_0x392c('0x53')]=_0x5a1d5c;if(_0x7d23b0[_0x392c('0x44')][_0x392c('0x54')]){_0x2afab2['include']=[{'all':!![]}];}return db[_0x392c('0x40')][_0x392c('0x55')](_0x2afab2);})[_0x392c('0x21')](function(_0x4ef58b){_0x234602[_0x392c('0x56')]=_0x4ef58b;return _0x234602;})[_0x392c('0x21')](respondWithFilteredResult(_0xcbd564,_0x2afab2))['catch'](handleError(_0xcbd564,null));};exports['show']=function(_0x98413d,_0x2e30f1){var _0x1f2e58={'raw':![],'where':{'id':_0x98413d[_0x392c('0x57')]['id']},'include':[{'model':db[_0x392c('0x58')],'as':'mandatoryDispositionPause'}]},_0x2ec1f9={};_0x2ec1f9[_0x392c('0x43')]=_[_0x392c('0x59')](db[_0x392c('0x40')][_0x392c('0x5a')]);_0x2ec1f9['query']=_['keys'](_0x98413d[_0x392c('0x44')]);_0x2ec1f9[_0x392c('0x45')]=_[_0x392c('0x46')](_0x2ec1f9[_0x392c('0x43')],_0x2ec1f9['query']);_0x1f2e58['attributes']=_[_0x392c('0x46')](_0x2ec1f9[_0x392c('0x43')],qs[_0x392c('0x48')](_0x98413d[_0x392c('0x44')][_0x392c('0x48')]));_0x1f2e58['attributes']=_0x1f2e58[_0x392c('0x47')][_0x392c('0x49')]?_0x1f2e58[_0x392c('0x47')]:_0x2ec1f9[_0x392c('0x43')];if(_0x98413d[_0x392c('0x44')][_0x392c('0x54')]){_0x1f2e58[_0x392c('0x5b')]=[{'all':!![]}];}_0x1f2e58=_['merge']({},_0x1f2e58,_0x98413d[_0x392c('0x52')]);return db[_0x392c('0x40')][_0x392c('0x5c')](_0x1f2e58)[_0x392c('0x21')](handleEntityNotFound(_0x2e30f1,null))['then'](respondWithResult(_0x2e30f1,null))[_0x392c('0x2b')](handleError(_0x2e30f1,null));};exports[_0x392c('0x5d')]=function(_0x40bce1,_0x869241){return db['OpenchannelAccount'][_0x392c('0x5d')](_0x40bce1[_0x392c('0x5e')],{})[_0x392c('0x21')](function(_0xc01747){var _0x82e459=_0x40bce1[_0x392c('0x5f')][_0x392c('0x39')]({'plain':!![]});if(!_0x82e459)throw new Error(_0x392c('0x60'));if(_0x82e459[_0x392c('0x61')]===_0x392c('0x5f')){var _0x1427c9=_0xc01747['get']({'plain':!![]});var _0x2eb830='OpenchannelAccounts';return db['UserProfileSection'][_0x392c('0x5c')]({'where':{'name':_0x2eb830,'userProfileId':_0x82e459['userProfileId']},'raw':!![]})['then'](function(_0x56d51e){if(_0x56d51e&&_0x56d51e[_0x392c('0x62')]===0x0){return db[_0x392c('0x3b')][_0x392c('0x5d')]({'name':_0x1427c9[_0x392c('0x3d')],'resourceId':_0x1427c9['id'],'type':_0x56d51e[_0x392c('0x3d')],'sectionId':_0x56d51e['id']},{})[_0x392c('0x21')](function(){return _0xc01747;});}else{return _0xc01747;}})[_0x392c('0x2b')](function(_0x18d76c){logger[_0x392c('0x28')](_0x392c('0x63'),_0x18d76c);throw _0x18d76c;});}return _0xc01747;})['then'](respondWithResult(_0x869241,0xc9))[_0x392c('0x2b')](handleError(_0x869241,null));};exports[_0x392c('0x37')]=function(_0x2d3f91,_0x20f61a){if(_0x2d3f91['body']['id']){delete _0x2d3f91[_0x392c('0x5e')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x2d3f91['params']['id']},'include':[{'model':db['Pause'],'as':_0x392c('0x64')}]})[_0x392c('0x21')](handleEntityNotFound(_0x20f61a,null))[_0x392c('0x21')](saveUpdates(_0x2d3f91[_0x392c('0x5e')],null))['then'](respondWithResult(_0x20f61a,null))[_0x392c('0x2b')](handleError(_0x20f61a,null));};exports[_0x392c('0x38')]=function(_0x457e7d,_0x31e811){return db[_0x392c('0x40')][_0x392c('0x5c')]({'where':{'id':_0x457e7d[_0x392c('0x57')]['id']}})[_0x392c('0x21')](handleEntityNotFound(_0x31e811,null))[_0x392c('0x21')](removeEntity(_0x31e811,null))[_0x392c('0x2b')](handleError(_0x31e811,null));};exports['describe']=function(_0x41ad12,_0x25472b){return db['OpenchannelAccount'][_0x392c('0x65')]()[_0x392c('0x21')](respondWithResult(_0x25472b,null))[_0x392c('0x2b')](handleError(_0x25472b,null));};exports[_0x392c('0x66')]=function(_0x190787,_0x573ab6,_0x5d38c9){if(_0x190787['body']['id']){delete _0x190787[_0x392c('0x5e')]['id'];}return db[_0x392c('0x40')][_0x392c('0x5c')]({'where':{'id':_0x190787[_0x392c('0x57')]['id']}})[_0x392c('0x21')](handleEntityNotFound(_0x573ab6,null))[_0x392c('0x21')](function(_0x939bdb){if(_0x939bdb){_0x190787[_0x392c('0x5e')][_0x392c('0x67')]=_0x939bdb['id'];return db[_0x392c('0x68')][_0x392c('0x5d')](_0x190787['body']);}})[_0x392c('0x21')](respondWithResult(_0x573ab6,null))[_0x392c('0x2b')](handleError(_0x573ab6,null));};exports[_0x392c('0x69')]=function(_0x1be301,_0x263ef6,_0x5dc43b){var _0x2b1ce5={'raw':![],'where':{}};var _0x37b234={};var _0xa43ec2={'count':0x0,'rows':[]};return db[_0x392c('0x40')][_0x392c('0x6a')]({'where':{'id':_0x1be301['params']['id']}})['then'](handleEntityNotFound(_0x263ef6,null))[_0x392c('0x21')](function(_0x50767c){if(_0x50767c){_0x37b234['model']=_[_0x392c('0x59')](db['Disposition'][_0x392c('0x5a')]);_0x37b234[_0x392c('0x44')]=_[_0x392c('0x59')](_0x1be301[_0x392c('0x44')]);_0x37b234[_0x392c('0x45')]=_[_0x392c('0x46')](_0x37b234[_0x392c('0x43')],_0x37b234[_0x392c('0x44')]);_0x2b1ce5[_0x392c('0x47')]=_[_0x392c('0x46')](_0x37b234[_0x392c('0x43')],qs[_0x392c('0x48')](_0x1be301[_0x392c('0x44')][_0x392c('0x48')]));_0x2b1ce5['attributes']=_0x2b1ce5[_0x392c('0x47')][_0x392c('0x49')]?_0x2b1ce5[_0x392c('0x47')]:_0x37b234[_0x392c('0x43')];if(!_0x1be301[_0x392c('0x44')][_0x392c('0x4a')](_0x392c('0x4b'))){_0x2b1ce5[_0x392c('0x31')]=qs[_0x392c('0x31')](_0x1be301[_0x392c('0x44')][_0x392c('0x31')]);_0x2b1ce5['offset']=qs['offset'](_0x1be301[_0x392c('0x44')][_0x392c('0x30')]);}_0x2b1ce5[_0x392c('0x4c')]=qs[_0x392c('0x4d')](_0x1be301['query'][_0x392c('0x4d')]);_0x2b1ce5['where']=qs[_0x392c('0x45')](_['pick'](_0x1be301[_0x392c('0x44')],_0x37b234[_0x392c('0x45')]));_0x2b1ce5[_0x392c('0x50')][_0x392c('0x6b')]=_0x50767c['id'];if(_0x1be301['query'][_0x392c('0x4f')]){_0x2b1ce5[_0x392c('0x50')]=_['merge'](_0x2b1ce5['where'],{'$or':_[_0x392c('0x3f')](_0x2b1ce5[_0x392c('0x47')],function(_0x33fbcf){var _0x5af5b5={};_0x5af5b5[_0x33fbcf]={'$like':'%'+_0x1be301[_0x392c('0x44')][_0x392c('0x4f')]+'%'};return _0x5af5b5;})});}_0x2b1ce5=_[_0x392c('0x51')]({},_0x2b1ce5,_0x1be301[_0x392c('0x52')]);return db[_0x392c('0x68')]['count']({'where':_0x2b1ce5[_0x392c('0x50')]})['then'](function(_0x154697){_0xa43ec2[_0x392c('0x53')]=_0x154697;if(_0x1be301[_0x392c('0x44')]['includeAll']){_0x2b1ce5[_0x392c('0x5b')]=[{'all':!![]}];}return db[_0x392c('0x68')][_0x392c('0x55')](_0x2b1ce5);})[_0x392c('0x21')](function(_0x375e7a){_0xa43ec2[_0x392c('0x56')]=_0x375e7a;return _0xa43ec2;});}})[_0x392c('0x21')](respondWithFilteredResult(_0x263ef6,_0x2b1ce5))[_0x392c('0x2b')](handleError(_0x263ef6,null));};exports[_0x392c('0x6c')]=function(_0x4012ca,_0x5c6afa,_0x2f0768){return db[_0x392c('0x40')]['find']({'where':{'id':_0x4012ca[_0x392c('0x57')]['id']}})['then'](handleEntityNotFound(_0x5c6afa,null))[_0x392c('0x21')](function(_0x90a0b6){if(_0x90a0b6){return _0x90a0b6[_0x392c('0x6c')](_0x4012ca[_0x392c('0x44')][_0x392c('0x6d')]);}})['then'](respondWithStatusCode(_0x5c6afa,null))['catch'](handleError(_0x5c6afa,null));};exports[_0x392c('0x6e')]=function(_0x4e7c1c,_0x393865,_0x48e07e){if(_0x4e7c1c[_0x392c('0x5e')]['id']){delete _0x4e7c1c['body']['id'];}return db[_0x392c('0x40')][_0x392c('0x5c')]({'where':{'id':_0x4e7c1c[_0x392c('0x57')]['id']}})['then'](handleEntityNotFound(_0x393865,null))[_0x392c('0x21')](function(_0x2b1e99){if(_0x2b1e99){_0x4e7c1c[_0x392c('0x5e')][_0x392c('0x6b')]=_0x2b1e99['id'];return db['CannedAnswer']['create'](_0x4e7c1c[_0x392c('0x5e')]);}})[_0x392c('0x21')](respondWithResult(_0x393865,null))[_0x392c('0x2b')](handleError(_0x393865,null));};exports[_0x392c('0x6f')]=function(_0x68e5c5,_0x2969ff,_0x3830a5){var _0x128487={'raw':![],'where':{}};var _0x51e4e8={};var _0x263062={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x392c('0x6a')]({'where':{'id':_0x68e5c5[_0x392c('0x57')]['id']}})[_0x392c('0x21')](handleEntityNotFound(_0x2969ff,null))[_0x392c('0x21')](function(_0x15b635){if(_0x15b635){_0x51e4e8[_0x392c('0x43')]=_[_0x392c('0x59')](db['CannedAnswer'][_0x392c('0x5a')]);_0x51e4e8[_0x392c('0x44')]=_['keys'](_0x68e5c5[_0x392c('0x44')]);_0x51e4e8[_0x392c('0x45')]=_[_0x392c('0x46')](_0x51e4e8[_0x392c('0x43')],_0x51e4e8[_0x392c('0x44')]);_0x128487[_0x392c('0x47')]=_['intersection'](_0x51e4e8[_0x392c('0x43')],qs[_0x392c('0x48')](_0x68e5c5[_0x392c('0x44')][_0x392c('0x48')]));_0x128487[_0x392c('0x47')]=_0x128487[_0x392c('0x47')]['length']?_0x128487[_0x392c('0x47')]:_0x51e4e8[_0x392c('0x43')];if(!_0x68e5c5[_0x392c('0x44')]['hasOwnProperty'](_0x392c('0x4b'))){_0x128487['limit']=qs[_0x392c('0x31')](_0x68e5c5['query'][_0x392c('0x31')]);_0x128487[_0x392c('0x30')]=qs[_0x392c('0x30')](_0x68e5c5[_0x392c('0x44')][_0x392c('0x30')]);}_0x128487[_0x392c('0x4c')]=qs[_0x392c('0x4d')](_0x68e5c5['query'][_0x392c('0x4d')]);_0x128487['where']=qs[_0x392c('0x45')](_[_0x392c('0x4e')](_0x68e5c5[_0x392c('0x44')],_0x51e4e8['filters']));_0x128487['where']['OpenchannelAccountId']=_0x15b635['id'];if(_0x68e5c5[_0x392c('0x44')][_0x392c('0x4f')]){_0x128487['where']=_[_0x392c('0x51')](_0x128487[_0x392c('0x50')],{'$or':_[_0x392c('0x3f')](_0x128487[_0x392c('0x47')],function(_0x18a4c4){var _0x34e3be={};_0x34e3be[_0x18a4c4]={'$like':'%'+_0x68e5c5[_0x392c('0x44')][_0x392c('0x4f')]+'%'};return _0x34e3be;})});}_0x128487=_['merge']({},_0x128487,_0x68e5c5[_0x392c('0x52')]);return db[_0x392c('0x70')]['count']({'where':_0x128487[_0x392c('0x50')]})[_0x392c('0x21')](function(_0x3613f5){_0x263062['count']=_0x3613f5;if(_0x68e5c5[_0x392c('0x44')]['includeAll']){_0x128487[_0x392c('0x5b')]=[{'all':!![]}];}return db['CannedAnswer'][_0x392c('0x55')](_0x128487);})[_0x392c('0x21')](function(_0x4d46f2){_0x263062[_0x392c('0x56')]=_0x4d46f2;return _0x263062;});}})[_0x392c('0x21')](respondWithFilteredResult(_0x2969ff,_0x128487))[_0x392c('0x2b')](handleError(_0x2969ff,null));};exports[_0x392c('0x71')]=function(_0xa0dcbb,_0x4c670b,_0x33e729){return db['OpenchannelAccount'][_0x392c('0x5c')]({'where':{'id':_0xa0dcbb[_0x392c('0x57')]['id']}})[_0x392c('0x21')](handleEntityNotFound(_0x4c670b,null))[_0x392c('0x21')](function(_0x4a5596){if(_0x4a5596){return _0x4a5596[_0x392c('0x71')](_0xa0dcbb['query'][_0x392c('0x6d')]);}})['then'](respondWithStatusCode(_0x4c670b,null))[_0x392c('0x2b')](handleError(_0x4c670b,null));};exports['notify']=function(_0x1def3d,_0x2f34d9,_0x1bcb48){var _0x2e88a9={'body':_0x1def3d['body'],'channel':_0x392c('0x72')};var _0x2593e6=[];var _0x406327=[];var _0x8122ad={};var _0x5dfb5a=![];return db[_0x392c('0x73')][_0x392c('0x65')]()['then'](function(_0x1d1302){if(!_0x1d1302){throw new db[(_0x392c('0x74'))][(_0x392c('0x75'))](_0x392c('0x76'));}_0x2593e6=_[_0x392c('0x77')](_[_0x392c('0x59')](_0x1d1302),[_0x392c('0x78'),_0x392c('0x79')]);_0x406327=_['difference'](_[_0x392c('0x59')](_0x1d1302),[_0x392c('0x78'),_0x392c('0x79'),_0x392c('0x7a'),_0x392c('0x7b')]);if(_0x1def3d['body']['id']){delete _0x1def3d['body']['id'];}if(_[_0x392c('0x7c')](_0x1def3d[_0x392c('0x5e')][_0x392c('0x7d')])){throw new db['Sequelize'][(_0x392c('0x75'))](_0x392c('0x7e'));}if(_[_0x392c('0x7c')](_0x1def3d[_0x392c('0x5e')][_0x392c('0x5e')])||_0x1def3d[_0x392c('0x5e')][_0x392c('0x5e')]===''){throw new db[(_0x392c('0x74'))]['ValidationError'](_0x392c('0x7f'));}if(_[_0x392c('0x7c')](_0x1def3d[_0x392c('0x5e')]['mapKey'])){throw new db[(_0x392c('0x74'))]['ValidationError'](_0x392c('0x80')+_0x406327);}if(!_[_0x392c('0x81')](_0x406327,_0x1def3d[_0x392c('0x5e')][_0x392c('0x82')])){throw new db[(_0x392c('0x74'))][(_0x392c('0x75'))](_0x392c('0x83')+_0x406327);}_0x8122ad[_0x1def3d['body'][_0x392c('0x82')]]=_0x1def3d[_0x392c('0x5e')][_0x392c('0x7d')];})[_0x392c('0x21')](function(){return db[_0x392c('0x40')][_0x392c('0x5c')]({'where':{'id':_0x1def3d[_0x392c('0x57')]['id']},'include':[{'model':db[_0x392c('0x84')],'as':'List','include':[{'model':db['CmContact'],'as':_0x392c('0x85'),'where':_0x8122ad,'limit':0x1,'order':[['updatedAt',_0x392c('0x86')]]}]},{'model':db[_0x392c('0x87')],'as':'Applications'}]});})[_0x392c('0x21')](handleEntityNotFound(_0x2f34d9,null))[_0x392c('0x21')](function(_0x52d9c0){if(_0x52d9c0&&_0x52d9c0['List']){_0x2e88a9['account']=_0x52d9c0;_0x2e88a9[_0x392c('0x88')]=_0x52d9c0['Applications'];_0x2e88a9[_0x392c('0x89')]=_0x52d9c0['List'];_0x2e88a9[_0x392c('0x88')]=_[_0x392c('0x8a')](_0x2e88a9[_0x392c('0x88')],[_0x392c('0x8b')],[_0x392c('0x8c')]);if(_0x2e88a9[_0x392c('0x8d')]['Applications']){delete _0x2e88a9[_0x392c('0x8d')]['Applications'];}if(_0x2e88a9[_0x392c('0x8d')][_0x392c('0x8e')]&&_0x2e88a9[_0x392c('0x8d')][_0x392c('0x8e')][_0x392c('0x85')][_0x392c('0x49')]){return _0x2e88a9[_0x392c('0x8d')][_0x392c('0x8e')][_0x392c('0x85')][0x0];}var _0x5eb725=_[_0x392c('0x19')](_0x1def3d['body'],{'firstName':_0x1def3d[_0x392c('0x5e')][_0x392c('0x7d')],'ListId':_0x52d9c0[_0x392c('0x7b')]});_0x5eb725[_0x1def3d[_0x392c('0x5e')][_0x392c('0x82')]]=_0x1def3d[_0x392c('0x5e')][_0x392c('0x7d')];return db[_0x392c('0x73')][_0x392c('0x5d')](_0x5eb725,{'fields':_0x2593e6,'raw':!![]});}})[_0x392c('0x21')](handleEntityNotFound(_0x2f34d9,null))['then'](function(_0x1d55f4){_0x2e88a9[_0x392c('0x8f')]=_0x1d55f4;if(_0x1d55f4){var _0x18ee1a={'ContactId':_0x1d55f4['id'],'OpenchannelAccountId':_0x1def3d[_0x392c('0x57')]['id'],'from':(_0x1d55f4[_0x392c('0x90')]||'')+'\x20'+(_0x1d55f4[_0x392c('0x91')]||'')};var _0x2455b7={'OpenchannelAccountId':_0x1def3d[_0x392c('0x57')]['id'],'closed':![]};if(_0x1def3d[_0x392c('0x5e')][_0x392c('0x92')]){_0x2455b7[_0x392c('0x92')]=_0x1def3d[_0x392c('0x5e')][_0x392c('0x92')];return db[_0x392c('0x93')][_0x392c('0x5c')]({'where':_0x2455b7})[_0x392c('0x21')](function(_0x4f05e2){if(_0x4f05e2){return[_0x4f05e2,![]];}_0x18ee1a['threadId']=_0x1def3d[_0x392c('0x5e')][_0x392c('0x92')];_0x18ee1a['externalUrl']=_0x1def3d['body'][_0x392c('0x94')];return db['OpenchannelInteraction'][_0x392c('0x5d')](_0x18ee1a)[_0x392c('0x21')](function(_0x2bb3bb){return[_0x2bb3bb,!![]];});});}else{_0x2455b7['threadId']=null;}_0x2455b7[_0x392c('0x95')]=_0x1d55f4['id'];return db[_0x392c('0x93')][_0x392c('0x5c')]({'where':_0x2455b7})[_0x392c('0x21')](function(_0x220846){if(_0x220846){return[_0x220846,![]];}return db[_0x392c('0x93')][_0x392c('0x5d')](_0x18ee1a)['then'](function(_0x112515){return[_0x112515,!![]];});});}})['spread'](function(_0x136f32,_0x1f89db){if(_0x136f32){_0x5dfb5a=_0x1f89db;if(!_0x1f89db){var _0x2e3258={'from':(_0x2e88a9[_0x392c('0x8f')][_0x392c('0x90')]||'')+'\x20'+(_0x2e88a9[_0x392c('0x8f')]['lastName']||'')};if(_0x1def3d['body'][_0x392c('0x92')]&&_0x1def3d[_0x392c('0x5e')]['messageId']&&_0x1def3d[_0x392c('0x5e')]['threadId']!=_0x1def3d[_0x392c('0x5e')][_0x392c('0x96')]){_0x2e3258['threadId']=_0x1def3d[_0x392c('0x5e')][_0x392c('0x96')];}return _0x136f32['update'](_0x2e3258);}else{return _0x136f32;}}})['then'](function(_0x38bb6e){_0x2e88a9[_0x392c('0x97')]=_0x38bb6e[_0x392c('0x39')]({'plain':!![]});_0x2e88a9[_0x392c('0x97')]['created']=_0x5dfb5a;if(_0x2e88a9[_0x392c('0x97')][_0x392c('0x98')]){if(_0x2e88a9['account'][_0x392c('0x99')]){_0x2e88a9[_0x392c('0x88')]['push']({'id':0x0,'priority':_0x2e88a9[_0x392c('0x88')][_0x392c('0x49')]+0x1,'app':_0x392c('0x9a'),'appdata':'unmanaged','interval':_0x392c('0x9b')});}}return db[_0x392c('0x9c')][_0x392c('0x5d')]({'body':_0x1def3d[_0x392c('0x5e')][_0x392c('0x5e')],'OpenchannelAccountId':_0x1def3d[_0x392c('0x57')]['id'],'OpenchannelInteractionId':_0x38bb6e['id'],'direction':'in','ContactId':_0x2e88a9[_0x392c('0x8f')]['id'],'AttachmentId':_0x1def3d[_0x392c('0x5e')]['AttachmentId']});})[_0x392c('0x21')](function(_0x2f2538){_0x2e88a9['message']=_0x2f2538;if(_0x2e88a9[_0x392c('0x97')][_0x392c('0x9d')]){return db[_0x392c('0x9e')][_0x392c('0x5c')]({'attributes':['id',_0x392c('0x3d')],'where':{'id':_0x2e88a9[_0x392c('0x97')]['UserId']}})[_0x392c('0x21')](function(_0x116961){if(_0x116961){_0x2e88a9[_0x392c('0x88')][_0x392c('0x9f')]({'id':0x0,'priority':0x0,'app':_0x392c('0xa0'),'appdata':_0x116961[_0x392c('0x3d')]+','+(_0x2e88a9[_0x392c('0x8d')][_0x392c('0xa1')]||0xa),'interval':_0x392c('0x9b')});_0x2e88a9[_0x392c('0xa2')]=![];}return respondWithRpcPromise(_0x392c('0xa3'),'startRouting',_0x2e88a9);});}return respondWithRpcPromise('Start','startRouting',_0x2e88a9);})[_0x392c('0x21')](function(_0xbdcafa){respondWithRpcPromise('EventManager','EventManager',{'event':_0x392c('0xa4'),'message':_0xbdcafa},client9002);return _0xbdcafa;})['then'](respondWithResult(_0x2f34d9,null))[_0x392c('0x2b')](handleError(_0x2f34d9,null));};exports['addApplications']=function(_0x25f5a4,_0x2f00c4,_0x4bfe7c){return db[_0x392c('0x40')][_0x392c('0x6a')]({'where':{'id':_0x25f5a4[_0x392c('0x57')]['id']}})[_0x392c('0x21')](handleEntityNotFound(_0x2f00c4,null))['then'](function(_0x3252f3){if(_0x3252f3){return db[_0x392c('0xa5')][_0x392c('0xa6')](function(_0x1b3938){return db[_0x392c('0x87')]['destroy']({'where':{'OpenchannelAccountId':_0x25f5a4[_0x392c('0x57')]['id']},'transaction':_0x1b3938})[_0x392c('0x21')](function(_0x4b6383){var _0x59a43b=_[_0x392c('0x3f')](_0x25f5a4[_0x392c('0x5e')],function(_0x5613ef){_0x5613ef[_0x392c('0x6b')]=_0x25f5a4['params']['id'];return _0x5613ef;});return db[_0x392c('0x87')][_0x392c('0xa7')](_0x59a43b,{'transaction':_0x1b3938});});})[_0x392c('0x21')](function(){return db[_0x392c('0x87')][_0x392c('0xa8')]({'where':{'OpenchannelAccountId':_0x25f5a4[_0x392c('0x57')]['id']},'order':_0x392c('0x8b')});});}})[_0x392c('0x21')](respondWithResult(_0x2f00c4,null))[_0x392c('0x2b')](handleError(_0x2f00c4,null));};exports[_0x392c('0xa9')]=function(_0x56befa,_0x444736,_0x5f5423){var _0x259d90={};var _0x5ac4d0={};var _0x5e3b4b;var _0x1902fe;return db['OpenchannelAccount'][_0x392c('0x6a')]({'where':{'id':_0x56befa[_0x392c('0x57')]['id']}})[_0x392c('0x21')](handleEntityNotFound(_0x444736,null))[_0x392c('0x21')](function(_0x8f53e8){if(_0x8f53e8){_0x5e3b4b=_0x8f53e8;_0x5ac4d0['model']=_['keys'](db[_0x392c('0x87')]['rawAttributes']);_0x5ac4d0['query']=_[_0x392c('0x59')](_0x56befa[_0x392c('0x44')]);_0x5ac4d0[_0x392c('0x45')]=_[_0x392c('0x46')](_0x5ac4d0[_0x392c('0x43')],_0x5ac4d0['query']);_0x259d90['attributes']=_[_0x392c('0x46')](_0x5ac4d0[_0x392c('0x43')],qs[_0x392c('0x48')](_0x56befa['query'][_0x392c('0x48')]));_0x259d90[_0x392c('0x47')]=_0x259d90[_0x392c('0x47')][_0x392c('0x49')]?_0x259d90['attributes']:_0x5ac4d0['model'];_0x259d90[_0x392c('0x4c')]=qs['sort'](_0x56befa['query'][_0x392c('0x4d')]);_0x259d90[_0x392c('0x50')]=qs[_0x392c('0x45')](_['pick'](_0x56befa[_0x392c('0x44')],_0x5ac4d0[_0x392c('0x45')]));if(_0x56befa[_0x392c('0x44')][_0x392c('0x4f')]){_0x259d90[_0x392c('0x50')]=_[_0x392c('0x51')](_0x259d90['where'],{'$or':_[_0x392c('0x3f')](_0x259d90[_0x392c('0x47')],function(_0xda9c3){var _0x3ecad1={};_0x3ecad1[_0xda9c3]={'$like':'%'+_0x56befa[_0x392c('0x44')][_0x392c('0x4f')]+'%'};return _0x3ecad1;})});}_0x259d90=_[_0x392c('0x51')]({},_0x259d90,_0x56befa[_0x392c('0x52')]);return _0x5e3b4b[_0x392c('0xa9')](_0x259d90);}})[_0x392c('0x21')](function(_0x2a74e9){if(_0x2a74e9){_0x1902fe=_0x2a74e9[_0x392c('0x49')];if(!_0x56befa[_0x392c('0x44')][_0x392c('0x4a')](_0x392c('0x4b'))){_0x259d90[_0x392c('0x31')]=qs['limit'](_0x56befa[_0x392c('0x44')]['limit']);_0x259d90[_0x392c('0x30')]=qs['offset'](_0x56befa[_0x392c('0x44')][_0x392c('0x30')]);}return _0x5e3b4b[_0x392c('0xa9')](_0x259d90);}})[_0x392c('0x21')](function(_0x510d6e){if(_0x510d6e){return _0x510d6e?{'count':_0x1902fe,'rows':_0x510d6e}:null;}})[_0x392c('0x21')](respondWithResult(_0x444736,null))['catch'](handleError(_0x444736,null));};exports[_0x392c('0xaa')]=function(_0x49037d,_0x5d6271,_0x401f2a){var _0xd5494b={'raw':![],'where':{}};var _0x5504fe={};var _0x24a8a3={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x392c('0x6a')]({'where':{'id':_0x49037d['params']['id']}})[_0x392c('0x21')](handleEntityNotFound(_0x5d6271,null))['then'](function(_0x17ae64){if(_0x17ae64){_0x5504fe[_0x392c('0x43')]=_[_0x392c('0x59')](db[_0x392c('0x93')][_0x392c('0x5a')]);_0x5504fe['query']=_[_0x392c('0x59')](_0x49037d['query']);_0x5504fe['filters']=_[_0x392c('0x46')](_0x5504fe['model'],_0x5504fe['query']);_0xd5494b[_0x392c('0x47')]=_['intersection'](_0x5504fe[_0x392c('0x43')],qs[_0x392c('0x48')](_0x49037d['query'][_0x392c('0x48')]));_0xd5494b['attributes']=_0xd5494b[_0x392c('0x47')][_0x392c('0x49')]?_0xd5494b[_0x392c('0x47')]:_0x5504fe[_0x392c('0x43')];if(!_0x49037d[_0x392c('0x44')][_0x392c('0x4a')](_0x392c('0x4b'))){_0xd5494b[_0x392c('0x31')]=qs['limit'](_0x49037d[_0x392c('0x44')][_0x392c('0x31')]);_0xd5494b[_0x392c('0x30')]=qs[_0x392c('0x30')](_0x49037d[_0x392c('0x44')][_0x392c('0x30')]);}_0xd5494b[_0x392c('0x4c')]=qs[_0x392c('0x4d')](_0x49037d[_0x392c('0x44')][_0x392c('0x4d')]);_0xd5494b[_0x392c('0x50')]=qs[_0x392c('0x45')](_['pick'](_0x49037d['query'],_0x5504fe[_0x392c('0x45')]));_0xd5494b[_0x392c('0x50')][_0x392c('0x6b')]=_0x17ae64['id'];if(_0x49037d[_0x392c('0x44')][_0x392c('0x4f')]){_0xd5494b[_0x392c('0x50')]=_[_0x392c('0x51')](_0xd5494b[_0x392c('0x50')],{'$or':_[_0x392c('0x3f')](_0xd5494b[_0x392c('0x47')],function(_0x2a66f5){var _0x8b23c6={};_0x8b23c6[_0x2a66f5]={'$like':'%'+_0x49037d['query'][_0x392c('0x4f')]+'%'};return _0x8b23c6;})});}_0xd5494b=_[_0x392c('0x51')]({},_0xd5494b,_0x49037d[_0x392c('0x52')]);return db[_0x392c('0x93')][_0x392c('0x53')]({'where':_0xd5494b[_0x392c('0x50')]})[_0x392c('0x21')](function(_0x5b232b){_0x24a8a3[_0x392c('0x53')]=_0x5b232b;if(_0x49037d[_0x392c('0x44')][_0x392c('0x54')]){_0xd5494b[_0x392c('0x5b')]=[{'model':db[_0x392c('0x73')],'as':'Contact','required':![]},{'model':db[_0x392c('0x9e')],'as':_0x392c('0xab'),'attributes':['name',_0x392c('0xac'),_0x392c('0xad')],'required':![]},{'model':db['Tag'],'as':_0x392c('0xae'),'attributes':['id',_0x392c('0x3d'),'color'],'where':_0x49037d[_0x392c('0x44')][_0x392c('0xaf')]?{'id':_0x49037d['query'][_0x392c('0xaf')]}:undefined,'required':_0x49037d[_0x392c('0x44')]['tag']?!![]:![]}];}return db[_0x392c('0x93')][_0x392c('0x55')](_0xd5494b);})['then'](function(_0x1e8245){_0x24a8a3['rows']=_0x1e8245;return _0x24a8a3;});}})[_0x392c('0x21')](respondWithFilteredResult(_0x5d6271,_0xd5494b))['catch'](handleError(_0x5d6271,null));};exports[_0x392c('0xb0')]=function(_0x57fe98,_0x20d2f1,_0x50c55e){return db[_0x392c('0x40')][_0x392c('0x5c')]({'where':{'id':_0x57fe98[_0x392c('0x57')]['id']}})[_0x392c('0x21')](handleEntityNotFound(_0x20d2f1,null))[_0x392c('0x21')](function(_0xc05f96){if(_0xc05f96){return _0xc05f96[_0x392c('0xb0')](_0x57fe98[_0x392c('0x5e')][_0x392c('0x6d')],_['omit'](_0x57fe98['body'],[_0x392c('0x6d'),'id'])||{})[_0x392c('0xb1')](function(_0x10462e){for(var _0x35ab58=0x0;_0x35ab58<_0x57fe98[_0x392c('0x5e')][_0x392c('0x6d')][_0x392c('0x49')];_0x35ab58+=0x1){socket[_0x392c('0xb2')](_0x392c('0xb3'),{'UserId':_0x57fe98[_0x392c('0x5e')][_0x392c('0x6d')][_0x35ab58],'OpenchannelAccountId':_0x57fe98[_0x392c('0x57')]['id']});}return _0x10462e;});}})[_0x392c('0x21')](respondWithResult(_0x20d2f1,null))[_0x392c('0x2b')](handleError(_0x20d2f1,null));};exports['removeAgents']=function(_0x3f8083,_0x1402f0,_0x3bfb0d){return db['OpenchannelAccount']['find']({'where':{'id':_0x3f8083[_0x392c('0x57')]['id']}})['then'](handleEntityNotFound(_0x1402f0,null))[_0x392c('0x21')](function(_0x56ce82){if(_0x56ce82){return _0x56ce82[_0x392c('0xb4')](_0x3f8083[_0x392c('0x44')]['ids'])[_0x392c('0x21')](function(){if(_[_0x392c('0xb5')](_0x3f8083[_0x392c('0x44')]['ids'])){for(var _0x193a6c=0x0;_0x193a6c<_0x3f8083[_0x392c('0x44')][_0x392c('0x6d')][_0x392c('0x49')];_0x193a6c+=0x1){socket[_0x392c('0xb2')]('userOpenchannelAccount:remove',{'UserId':Number(_0x3f8083[_0x392c('0x44')][_0x392c('0x6d')][_0x193a6c]),'OpenchannelAccountId':Number(_0x3f8083[_0x392c('0x57')]['id'])});}}else{socket['emit'](_0x392c('0xb6'),{'UserId':Number(_0x3f8083['query'][_0x392c('0x6d')]),'OpenchannelAccountId':Number(_0x3f8083[_0x392c('0x57')]['id'])});}});}})[_0x392c('0x21')](respondWithStatusCode(_0x1402f0,null))[_0x392c('0x2b')](handleError(_0x1402f0,null));};exports[_0x392c('0xb7')]=function(_0x42be5d,_0x57a23a,_0xe7fe1e){var _0x15c59b={};var _0x5d04f0={};var _0x11fce6;var _0x4abc97;return db[_0x392c('0x40')][_0x392c('0x6a')]({'where':{'id':_0x42be5d['params']['id']}})[_0x392c('0x21')](handleEntityNotFound(_0x57a23a,null))['then'](function(_0x1e03dc){if(_0x1e03dc){_0x11fce6=_0x1e03dc;_0x5d04f0[_0x392c('0x43')]=_[_0x392c('0x59')](db['User'][_0x392c('0x5a')]);_0x5d04f0[_0x392c('0x44')]=_[_0x392c('0x59')](_0x42be5d[_0x392c('0x44')]);_0x5d04f0[_0x392c('0x45')]=_[_0x392c('0x46')](_0x5d04f0[_0x392c('0x43')],_0x5d04f0[_0x392c('0x44')]);_0x15c59b[_0x392c('0x47')]=_[_0x392c('0x46')](_0x5d04f0[_0x392c('0x43')],qs['fields'](_0x42be5d[_0x392c('0x44')][_0x392c('0x48')]));_0x15c59b[_0x392c('0x47')]=_0x15c59b[_0x392c('0x47')][_0x392c('0x49')]?_0x15c59b['attributes']:_0x5d04f0[_0x392c('0x43')];_0x15c59b[_0x392c('0x4c')]=qs[_0x392c('0x4d')](_0x42be5d['query']['sort']);_0x15c59b['where']=qs[_0x392c('0x45')](_[_0x392c('0x4e')](_0x42be5d[_0x392c('0x44')],_0x5d04f0[_0x392c('0x45')]));if(_0x42be5d[_0x392c('0x44')]['filter']){_0x15c59b[_0x392c('0x50')]=_['merge'](_0x15c59b['where'],{'$or':_['map'](_0x15c59b[_0x392c('0x47')],function(_0x310842){var _0x4b8bd2={};_0x4b8bd2[_0x310842]={'$like':'%'+_0x42be5d[_0x392c('0x44')][_0x392c('0x4f')]+'%'};return _0x4b8bd2;})});}_0x15c59b=_[_0x392c('0x51')]({},_0x15c59b,_0x42be5d[_0x392c('0x52')]);return _0x11fce6[_0x392c('0xb7')](_0x15c59b);}})['then'](function(_0x32ef0c){if(_0x32ef0c){_0x4abc97=_0x32ef0c[_0x392c('0x49')];if(!_0x42be5d[_0x392c('0x44')]['hasOwnProperty'](_0x392c('0x4b'))){_0x15c59b['limit']=qs['limit'](_0x42be5d[_0x392c('0x44')][_0x392c('0x31')]);_0x15c59b[_0x392c('0x30')]=qs[_0x392c('0x30')](_0x42be5d['query'][_0x392c('0x30')]);}return _0x11fce6['getAgents'](_0x15c59b);}})[_0x392c('0x21')](function(_0x3f0338){if(_0x3f0338){return _0x3f0338?{'count':_0x4abc97,'rows':_0x3f0338}:null;}})[_0x392c('0x21')](respondWithResult(_0x57a23a,null))[_0x392c('0x2b')](handleError(_0x57a23a,null));};exports[_0x392c('0x3e')]=function(_0x38064c,_0x570dcb,_0x5b8f0e){var _0x126393,_0x232e0c,_0x23e9b4;if(_['isNil'](_0x38064c['body'][_0x392c('0x5e')])||_0x38064c['body'][_0x392c('0x5e')]===''){throw new db[(_0x392c('0x74'))][(_0x392c('0x75'))](_0x392c('0x7f'));}if(_[_0x392c('0x7c')](_0x38064c[_0x392c('0x5e')]['to'])){}_0x126393=_0x38064c[_0x392c('0x5e')]['to'];return db[_0x392c('0x40')]['findOne']({'where':{'id':_0x38064c[_0x392c('0x57')]['id']}})[_0x392c('0x21')](handleEntityNotFound(_0x570dcb,null))[_0x392c('0x21')](function(_0x22bb9a){if(_0x22bb9a){return db[_0x392c('0x40')][_0x392c('0x5c')]({'where':{'id':_0x22bb9a['id']},'include':[{'model':db[_0x392c('0x84')],'as':_0x392c('0x8e'),'include':[{'model':db[_0x392c('0x73')],'as':_0x392c('0x85'),'where':{[_0x22bb9a['mapKey']]:_0x126393},'limit':0x1,'order':[['updatedAt',_0x392c('0x86')]]}]}]})['then'](handleEntityNotFound(_0x570dcb,null))[_0x392c('0x21')](function(_0x2f15d1){if(_0x2f15d1&&_0x2f15d1[_0x392c('0x8e')]){_0x232e0c=_0x2f15d1['get']({'plain':!![]});if(_0x232e0c[_0x392c('0x8e')]&&_0x232e0c[_0x392c('0x8e')][_0x392c('0x85')][_0x392c('0x49')]){return _0x232e0c['List']['Contacts'][0x0];}return db[_0x392c('0x73')][_0x392c('0x5d')](_[_0x392c('0x19')](_0x38064c['body'],{'firstName':_0x126393,[_0x2f15d1[_0x392c('0x82')]]:_0x126393,'phone':_0x126393,'ListId':_0x232e0c[_0x392c('0x7b')]}));}})[_0x392c('0x21')](handleEntityNotFound(_0x570dcb,null))[_0x392c('0x21')](function(_0x4eee4a){if(_0x4eee4a){_0x23e9b4=_0x4eee4a;return db[_0x392c('0x93')][_0x392c('0x5c')]({'where':{'ContactId':_0x23e9b4['id'],'closed':![],'OpenchannelAccountId':_0x232e0c['id']}})[_0x392c('0x21')](function(_0x5bab4e){if(_0x5bab4e){return[_0x5bab4e,![]];}return db['OpenchannelInteraction'][_0x392c('0x5d')]({'UserId':_0x38064c[_0x392c('0x5f')]['id'],'ContactId':_0x23e9b4['id'],'OpenchannelAccountId':_0x232e0c['id'],'lastMsgDirection':_0x392c('0xb8'),'Messages':[_[_0x392c('0x51')](_0x38064c[_0x392c('0x5e')],{'read':![],'body':_0x38064c[_0x392c('0x5e')][_0x392c('0x5e')],'OpenchannelAccountId':_0x232e0c['id'],'UserId':_0x38064c[_0x392c('0x5f')]['id'],'ContactId':_0x23e9b4['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x392c('0xb9')}]})[_0x392c('0x21')](function(_0x122a9d){return[_0x122a9d,!![]];});});}})[_0x392c('0xb1')](function(_0x2be6d0,_0x2ca482){if(_0x2ca482){return _0x2be6d0;}return db['OpenchannelMessage'][_0x392c('0x5d')](_['merge'](_0x38064c[_0x392c('0x5e')],{'read':![],'body':_0x38064c[_0x392c('0x5e')][_0x392c('0x5e')],'OpenchannelAccountId':_0x232e0c['id'],'OpenchannelInteractionId':_0x2be6d0['id'],'UserId':_0x38064c[_0x392c('0x5f')]['id'],'ContactId':_0x23e9b4['id']}))[_0x392c('0x21')](function(_0x271722){_0x2be6d0[_0x392c('0xba')]['Messages']=[];_0x2be6d0[_0x392c('0xba')][_0x392c('0xb9')]['push'](_0x271722[_0x392c('0xba')]);return _0x2be6d0;});});}})[_0x392c('0x21')](respondWithResult(_0x570dcb,null))[_0x392c('0x2b')](handleError(_0x570dcb,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index ab0723e..f1720f7 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 _0xff59=['../../mysqldb','OpenchannelAccount','setMaxListeners','update','remove','hasOwnProperty','hook','exports','events'];(function(_0x2f13ce,_0xed6276){var _0x582e91=function(_0x58c71a){while(--_0x58c71a){_0x2f13ce['push'](_0x2f13ce['shift']());}};_0x582e91(++_0xed6276);}(_0xff59,0x128));var _0x9ff5=function(_0x312baa,_0x3cf768){_0x312baa=_0x312baa-0x0;var _0x2b0679=_0xff59[_0x312baa];return _0x2b0679;};'use strict';var EventEmitter=require(_0x9ff5('0x0'));var OpenchannelAccount=require(_0x9ff5('0x1'))['db'][_0x9ff5('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x9ff5('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9ff5('0x4'),'afterDestroy':_0x9ff5('0x5')};function emitEvent(_0xf73fd7){return function(_0x2fcab7,_0xad7257,_0x9c0846){OpenchannelAccountEvents['emit'](_0xf73fd7+':'+_0x2fcab7['id'],_0x2fcab7);OpenchannelAccountEvents['emit'](_0xf73fd7,_0x2fcab7);_0x9c0846(null);};}for(var e in events){if(events[_0x9ff5('0x6')](e)){var event=events[e];OpenchannelAccount[_0x9ff5('0x7')](e,emitEvent(event));}}module[_0x9ff5('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xaed5=['../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0xaed5,0x180));var _0x5aed=function(_0x474eef,_0x28ea44){_0x474eef=_0x474eef-0x0;var _0x34b158=_0xaed5[_0x474eef];return _0x34b158;};'use strict';var EventEmitter=require(_0x5aed('0x0'));var OpenchannelAccount=require(_0x5aed('0x1'))['db'][_0x5aed('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x5aed('0x3')](0x0);var events={'afterCreate':_0x5aed('0x4'),'afterUpdate':_0x5aed('0x5'),'afterDestroy':_0x5aed('0x6')};function emitEvent(_0x33e336){return function(_0x24c94d,_0x10c77b,_0x3b8251){OpenchannelAccountEvents['emit'](_0x33e336+':'+_0x24c94d['id'],_0x24c94d);OpenchannelAccountEvents[_0x5aed('0x7')](_0x33e336,_0x24c94d);_0x3b8251(null);};}for(var e in events){if(events[_0x5aed('0x8')](e)){var event=events[e];OpenchannelAccount[_0x5aed('0x9')](e,emitEvent(event));}}module[_0x5aed('0xa')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 6c22516..b964576 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 _0x3f38=['path','rimraf','../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','openchannel_accounts','lodash','util','api','moment','bluebird','request-promise'];(function(_0x526bc7,_0x48b2f4){var _0x4e01fe=function(_0x4472eb){while(--_0x4472eb){_0x526bc7['push'](_0x526bc7['shift']());}};_0x4e01fe(++_0x48b2f4);}(_0x3f38,0x1e4));var _0x83f3=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x3f38[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x83f3('0x0'));var util=require(_0x83f3('0x1'));var logger=require('../../config/logger')(_0x83f3('0x2'));var moment=require(_0x83f3('0x3'));var BPromise=require(_0x83f3('0x4'));var rp=require(_0x83f3('0x5'));var fs=require('fs');var path=require(_0x83f3('0x6'));var rimraf=require(_0x83f3('0x7'));var config=require(_0x83f3('0x8'));var attributes=require(_0x83f3('0x9'));module[_0x83f3('0xa')]=function(_0x458b39,_0x2bb8b6){return _0x458b39[_0x83f3('0xb')](_0x83f3('0xc'),attributes,{'tableName':_0x83f3('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x73b3=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','openchannel_accounts','lodash','util','../../config/logger'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0x73b3,0x183));var _0x373b=function(_0x240261,_0x4fe66c){_0x240261=_0x240261-0x0;var _0x45c332=_0x73b3[_0x240261];return _0x45c332;};'use strict';var _=require(_0x373b('0x0'));var util=require(_0x373b('0x1'));var logger=require(_0x373b('0x2'))(_0x373b('0x3'));var moment=require(_0x373b('0x4'));var BPromise=require(_0x373b('0x5'));var rp=require(_0x373b('0x6'));var fs=require('fs');var path=require(_0x373b('0x7'));var rimraf=require(_0x373b('0x8'));var config=require(_0x373b('0x9'));var attributes=require(_0x373b('0xa'));module[_0x373b('0xb')]=function(_0x5dd2ef,_0x47516e){return _0x5dd2ef[_0x373b('0xc')](_0x373b('0xd'),attributes,{'tableName':_0x373b('0xe'),'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 a3af6fd..811d272 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 _0xd3b3=['request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register','request','then','OpenchannelAccount,\x20%s,\x20%s'];(function(_0x1caebc,_0x5abdfc){var _0x2b2ee1=function(_0x5e7ca6){while(--_0x5e7ca6){_0x1caebc['push'](_0x1caebc['shift']());}};_0x2b2ee1(++_0x5abdfc);}(_0xd3b3,0x199));var _0x3d3b=function(_0x208442,_0x11d2ba){_0x208442=_0x208442-0x0;var _0xd24f10=_0xd3b3[_0x208442];return _0xd24f10;};'use strict';var _=require(_0x3d3b('0x0'));var util=require(_0x3d3b('0x1'));var moment=require(_0x3d3b('0x2'));var BPromise=require(_0x3d3b('0x3'));var rs=require(_0x3d3b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3d3b('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3d3b('0x6'));var jayson=require(_0x3d3b('0x7'));var client=jayson[_0x3d3b('0x8')][_0x3d3b('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x3d3b('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x3d3b('0xb'))(new Redis(config[_0x3d3b('0xa')]));require('./openchannelAccount.socket')[_0x3d3b('0xc')](socket);function respondWithRpcPromise(_0x538cfa,_0x35feaa,_0x2654cd){return new BPromise(function(_0x284a6b,_0x315812){return client[_0x3d3b('0xd')](_0x538cfa,_0x2654cd)[_0x3d3b('0xe')](function(_0x405d40){logger['info'](_0x3d3b('0xf'),_0x35feaa,_0x3d3b('0x10'));logger[_0x3d3b('0x11')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x35feaa,_0x3d3b('0x10'),JSON[_0x3d3b('0x12')](_0x405d40));if(_0x405d40[_0x3d3b('0x13')]){if(_0x405d40[_0x3d3b('0x13')][_0x3d3b('0x14')]===0x1f4){logger['error'](_0x3d3b('0xf'),_0x35feaa,_0x405d40[_0x3d3b('0x13')][_0x3d3b('0x15')]);return _0x315812(_0x405d40['error'][_0x3d3b('0x15')]);}logger[_0x3d3b('0x13')](_0x3d3b('0xf'),_0x35feaa,_0x405d40[_0x3d3b('0x13')][_0x3d3b('0x15')]);return _0x284a6b(_0x405d40[_0x3d3b('0x13')][_0x3d3b('0x15')]);}else{logger[_0x3d3b('0x16')](_0x3d3b('0xf'),_0x35feaa,_0x3d3b('0x10'));_0x284a6b(_0x405d40[_0x3d3b('0x17')]['message']);}})[_0x3d3b('0x18')](function(_0x593c97){logger[_0x3d3b('0x13')](_0x3d3b('0xf'),_0x35feaa,_0x593c97);_0x315812(_0x593c97);});});} \ No newline at end of file +var _0x96a4=['../../config/logger','jayson/promise','http','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x8d68ce,_0x135a7f){var _0x2e1f64=function(_0x1e8aed){while(--_0x1e8aed){_0x8d68ce['push'](_0x8d68ce['shift']());}};_0x2e1f64(++_0x135a7f);}(_0x96a4,0x7b));var _0x496a=function(_0x21c222,_0x406d0a){_0x21c222=_0x21c222-0x0;var _0x5ec82a=_0x96a4[_0x21c222];return _0x5ec82a;};'use strict';var _=require('lodash');var util=require(_0x496a('0x0'));var moment=require(_0x496a('0x1'));var BPromise=require(_0x496a('0x2'));var rs=require(_0x496a('0x3'));var fs=require('fs');var Redis=require(_0x496a('0x4'));var db=require(_0x496a('0x5'))['db'];var utils=require(_0x496a('0x6'));var logger=require(_0x496a('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x496a('0x8'));var client=jayson['client'][_0x496a('0x9')]({'port':0x232a});config[_0x496a('0xa')]=_['defaults'](config['redis'],{'host':_0x496a('0xb'),'port':0x18eb});var socket=require(_0x496a('0xc'))(new Redis(config['redis']));require(_0x496a('0xd'))[_0x496a('0xe')](socket);function respondWithRpcPromise(_0x31d561,_0x44f5ba,_0x2c4d82){return new BPromise(function(_0x35357a,_0x4dfaff){return client[_0x496a('0xf')](_0x31d561,_0x2c4d82)[_0x496a('0x10')](function(_0x91c641){logger[_0x496a('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x44f5ba,_0x496a('0x12'));logger['debug'](_0x496a('0x13'),_0x44f5ba,_0x496a('0x12'),JSON[_0x496a('0x14')](_0x91c641));if(_0x91c641['error']){if(_0x91c641[_0x496a('0x15')][_0x496a('0x16')]===0x1f4){logger[_0x496a('0x15')](_0x496a('0x17'),_0x44f5ba,_0x91c641[_0x496a('0x15')][_0x496a('0x18')]);return _0x4dfaff(_0x91c641[_0x496a('0x15')]['message']);}logger[_0x496a('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x44f5ba,_0x91c641[_0x496a('0x15')][_0x496a('0x18')]);return _0x35357a(_0x91c641[_0x496a('0x15')][_0x496a('0x18')]);}else{logger[_0x496a('0x11')](_0x496a('0x17'),_0x44f5ba,_0x496a('0x12'));_0x35357a(_0x91c641['result'][_0x496a('0x18')]);}})[_0x496a('0x19')](function(_0xf5b252){logger[_0x496a('0x15')](_0x496a('0x17'),_0x44f5ba,_0xf5b252);_0x4dfaff(_0xf5b252);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 3ac6335..4cf1a02 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 _0x1b9f=['remove','update','register','length','openchannelAccount:','./openchannelAccount.events','save'];(function(_0x2a4dda,_0x394a1b){var _0xe725e=function(_0x5c005c){while(--_0x5c005c){_0x2a4dda['push'](_0x2a4dda['shift']());}};_0xe725e(++_0x394a1b);}(_0x1b9f,0x1da));var _0xf1b9=function(_0xd7f103,_0x28bcaa){_0xd7f103=_0xd7f103-0x0;var _0x4cb2be=_0x1b9f[_0xd7f103];return _0x4cb2be;};'use strict';var OpenchannelAccountEvents=require(_0xf1b9('0x0'));var events=[_0xf1b9('0x1'),_0xf1b9('0x2'),_0xf1b9('0x3')];function createListener(_0x125a7f,_0x3f4fc3){return function(_0x1ddbfd){_0x3f4fc3['emit'](_0x125a7f,_0x1ddbfd);};}function removeListener(_0x5040fa,_0x1a93a3){return function(){OpenchannelAccountEvents['removeListener'](_0x5040fa,_0x1a93a3);};}exports[_0xf1b9('0x4')]=function(_0x1ff854){for(var _0x2099ba=0x0,_0x3da025=events[_0xf1b9('0x5')];_0x2099ba<_0x3da025;_0x2099ba++){var _0x3a502c=events[_0x2099ba];var _0x4473b0=createListener(_0xf1b9('0x6')+_0x3a502c,_0x1ff854);OpenchannelAccountEvents['on'](_0x3a502c,_0x4473b0);}}; \ No newline at end of file +var _0x32eb=['emit','removeListener','length','openchannelAccount:','remove','update'];(function(_0x40f7e3,_0x5d2c41){var _0x146e15=function(_0x3ef90e){while(--_0x3ef90e){_0x40f7e3['push'](_0x40f7e3['shift']());}};_0x146e15(++_0x5d2c41);}(_0x32eb,0x130));var _0xb32e=function(_0x39cd3c,_0xa21102){_0x39cd3c=_0x39cd3c-0x0;var _0x47a0ae=_0x32eb[_0x39cd3c];return _0x47a0ae;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save',_0xb32e('0x0'),_0xb32e('0x1')];function createListener(_0x3eaff9,_0x4eb8a1){return function(_0x2cacf1){_0x4eb8a1[_0xb32e('0x2')](_0x3eaff9,_0x2cacf1);};}function removeListener(_0x25a2ed,_0x24c57c){return function(){OpenchannelAccountEvents[_0xb32e('0x3')](_0x25a2ed,_0x24c57c);};}exports['register']=function(_0x10fc7e){for(var _0x399d9b=0x0,_0xb27b3c=events[_0xb32e('0x4')];_0x399d9b<_0xb27b3c;_0x399d9b++){var _0x20211e=events[_0x399d9b];var _0x22193e=createListener(_0xb32e('0x5')+_0x20211e,_0x10fc7e);OpenchannelAccountEvents['on'](_0x20211e,_0x22193e);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index fcaa7b2..ec9a707 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 _0x4a37=['exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','show','post','put','delete','/:id'];(function(_0x1d388f,_0x44617f){var _0x1fc79d=function(_0x26c0b7){while(--_0x26c0b7){_0x1d388f['push'](_0x1d388f['shift']());}};_0x1fc79d(++_0x44617f);}(_0x4a37,0x1e7));var _0x74a3=function(_0x4db06a,_0x4fbdea){_0x4db06a=_0x4db06a-0x0;var _0x2cb17a=_0x4a37[_0x4db06a];return _0x2cb17a;};'use strict';var multer=require(_0x74a3('0x0'));var util=require(_0x74a3('0x1'));var path=require('path');var timeout=require(_0x74a3('0x2'));var express=require(_0x74a3('0x3'));var router=express[_0x74a3('0x4')]();var auth=require(_0x74a3('0x5'));var interaction=require(_0x74a3('0x6'));var config=require(_0x74a3('0x7'));var controller=require(_0x74a3('0x8'));router[_0x74a3('0x9')]('/',auth[_0x74a3('0xa')](),controller[_0x74a3('0xb')]);router[_0x74a3('0x9')]('/:id',auth[_0x74a3('0xa')](),controller[_0x74a3('0xc')]);router[_0x74a3('0xd')]('/',auth[_0x74a3('0xa')](),controller['create']);router[_0x74a3('0xe')]('/:id',auth[_0x74a3('0xa')](),controller['update']);router[_0x74a3('0xf')](_0x74a3('0x10'),auth[_0x74a3('0xa')](),controller['destroy']);module[_0x74a3('0x11')]=router; \ No newline at end of file +var _0x972f=['isAuthenticated','index','/:id','show','post','put','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x972f,0x198));var _0xf972=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x972f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xf972('0x0'));var util=require(_0xf972('0x1'));var path=require(_0xf972('0x2'));var timeout=require(_0xf972('0x3'));var express=require(_0xf972('0x4'));var router=express['Router']();var auth=require(_0xf972('0x5'));var interaction=require(_0xf972('0x6'));var config=require(_0xf972('0x7'));var controller=require(_0xf972('0x8'));router[_0xf972('0x9')]('/',auth[_0xf972('0xa')](),controller[_0xf972('0xb')]);router[_0xf972('0x9')](_0xf972('0xc'),auth[_0xf972('0xa')](),controller[_0xf972('0xd')]);router[_0xf972('0xe')]('/',auth[_0xf972('0xa')](),controller['create']);router[_0xf972('0xf')](_0xf972('0xc'),auth['isAuthenticated'](),controller[_0xf972('0x10')]);router['delete'](_0xf972('0xc'),auth[_0xf972('0xa')](),controller[_0xf972('0x11')]);module[_0xf972('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index d0a053d..85c497a 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 _0x2744=['noop','sequelize','exports','STRING'];(function(_0x321588,_0x33e83a){var _0xd73706=function(_0x5a6f1a){while(--_0x5a6f1a){_0x321588['push'](_0x321588['shift']());}};_0xd73706(++_0x33e83a);}(_0x2744,0x79));var _0x4274=function(_0x4f1697,_0x48068d){_0x4f1697=_0x4f1697-0x0;var _0x4a32c4=_0x2744[_0x4f1697];return _0x4a32c4;};'use strict';var Sequelize=require(_0x4274('0x0'));module[_0x4274('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x4274('0x2')],'allowNull':![],'defaultValue':_0x4274('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x4274('0x2')]},'interval':{'type':Sequelize[_0x4274('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x159c=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x159c,0x129));var _0xc159=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x159c[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xc159('0x0'));module[_0xc159('0x1')]={'priority':{'type':Sequelize[_0xc159('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xc159('0x3')],'allowNull':![],'defaultValue':_0xc159('0x4')},'appdata':{'type':Sequelize[_0xc159('0x5')]()},'description':{'type':Sequelize[_0xc159('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xc159('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index a671bee..fa19533 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 _0xae90=['then','stack','send','index','OpenchannelApplication','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','keys','create','update','find','body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save'];(function(_0x12aa3e,_0x2640b4){var _0x58986b=function(_0xa73804){while(--_0xa73804){_0x12aa3e['push'](_0x12aa3e['shift']());}};_0x58986b(++_0x2640b4);}(_0xae90,0x1b1));var _0x0ae9=function(_0x5be4b1,_0x17e4fe){_0x5be4b1=_0x5be4b1-0x0;var _0x5a3126=_0xae90[_0x5be4b1];return _0x5a3126;};'use strict';var pdf=require(_0x0ae9('0x0'));var emlformat=require(_0x0ae9('0x1'));var rimraf=require(_0x0ae9('0x2'));var zipdir=require(_0x0ae9('0x3'));var jsonpatch=require(_0x0ae9('0x4'));var rp=require(_0x0ae9('0x5'));var moment=require(_0x0ae9('0x6'));var BPromise=require(_0x0ae9('0x7'));var Mustache=require(_0x0ae9('0x8'));var util=require(_0x0ae9('0x9'));var path=require(_0x0ae9('0xa'));var sox=require(_0x0ae9('0xb'));var csv=require(_0x0ae9('0xc'));var ejs=require(_0x0ae9('0xd'));var fs=require('fs');var _=require(_0x0ae9('0xe'));var squel=require(_0x0ae9('0xf'));var crypto=require(_0x0ae9('0x10'));var jsforce=require(_0x0ae9('0x11'));var deskjs=require(_0x0ae9('0x12'));var toCsv=require(_0x0ae9('0xc'));var querystring=require(_0x0ae9('0x13'));var Papa=require(_0x0ae9('0x14'));var Redis=require(_0x0ae9('0x15'));var authService=require(_0x0ae9('0x16'));var qs=require(_0x0ae9('0x17'));var as=require(_0x0ae9('0x18'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0ae9('0x19'))('api');var utils=require(_0x0ae9('0x1a'));var config=require(_0x0ae9('0x1b'));var db=require(_0x0ae9('0x1c'))['db'];function respondWithStatusCode(_0x157954,_0x50ec85){_0x50ec85=_0x50ec85||0xcc;return function(_0x1696ea){if(_0x1696ea){return _0x157954[_0x0ae9('0x1d')](_0x50ec85);}return _0x157954[_0x0ae9('0x1e')](_0x50ec85)[_0x0ae9('0x1f')]();};}function respondWithResult(_0x15d327,_0x2df457){_0x2df457=_0x2df457||0xc8;return function(_0x4d4fdd){if(_0x4d4fdd){return _0x15d327['status'](_0x2df457)['json'](_0x4d4fdd);}};}function respondWithFilteredResult(_0x16a2d9,_0xd0dec1){return function(_0x11f589){if(_0x11f589){var _0x29329f=_0x11f589[_0x0ae9('0x20')],_0x5619ba=_0xd0dec1[_0x0ae9('0x21')],_0xb66f89=_0xd0dec1[_0x0ae9('0x21')]+_0xd0dec1[_0x0ae9('0x22')],_0xb2af1f;if(_0xb66f89>=_0x29329f){_0xb66f89=_0x29329f;_0xb2af1f=0xc8;}else{_0xb2af1f=0xce;}_0x16a2d9[_0x0ae9('0x1e')](_0xb2af1f);return _0x16a2d9[_0x0ae9('0x23')](_0x0ae9('0x24'),_0x5619ba+'-'+_0xb66f89+'/'+_0x29329f)[_0x0ae9('0x25')](_0x11f589);}return null;};}function patchUpdates(_0x444a25){return function(_0x213883){try{jsonpatch[_0x0ae9('0x26')](_0x213883,_0x444a25,!![]);}catch(_0x522c0e){return BPromise[_0x0ae9('0x27')](_0x522c0e);}return _0x213883[_0x0ae9('0x28')]();};}function saveUpdates(_0x12861a,_0x503d50){return function(_0xb386a1){if(_0xb386a1){return _0xb386a1['update'](_0x12861a)[_0x0ae9('0x29')](function(_0x5d0b99){return _0x5d0b99;});}return null;};}function removeEntity(_0x35e719,_0x544805){return function(_0x48b793){if(_0x48b793){return _0x48b793['destroy']()[_0x0ae9('0x29')](function(){_0x35e719['status'](0xcc)[_0x0ae9('0x1f')]();});}};}function handleEntityNotFound(_0x460f9f,_0x2c0535){return function(_0xf94d3a){if(!_0xf94d3a){_0x460f9f[_0x0ae9('0x1d')](0x194);}return _0xf94d3a;};}function handleError(_0x5d9822,_0xe9c227){_0xe9c227=_0xe9c227||0x1f4;return function(_0x1a335d){logger['error'](_0x1a335d[_0x0ae9('0x2a')]);if(_0x1a335d['name']){delete _0x1a335d['name'];}_0x5d9822[_0x0ae9('0x1e')](_0xe9c227)[_0x0ae9('0x2b')](_0x1a335d);};}exports[_0x0ae9('0x2c')]=function(_0x38b3,_0x171716){var _0x41f96a={},_0x7e2e7d={},_0x34baf7={'count':0x0,'rows':[]};var _0xa9649d=_['map'](db[_0x0ae9('0x2d')][_0x0ae9('0x2e')],function(_0x431b43){return{'name':_0x431b43[_0x0ae9('0x2f')],'type':_0x431b43[_0x0ae9('0x30')]['key']};});_0x7e2e7d[_0x0ae9('0x31')]=_[_0x0ae9('0x32')](_0xa9649d,'name');_0x7e2e7d[_0x0ae9('0x33')]=_['keys'](_0x38b3[_0x0ae9('0x33')]);_0x7e2e7d[_0x0ae9('0x34')]=_[_0x0ae9('0x35')](_0x7e2e7d[_0x0ae9('0x31')],_0x7e2e7d[_0x0ae9('0x33')]);_0x41f96a[_0x0ae9('0x36')]=_[_0x0ae9('0x35')](_0x7e2e7d[_0x0ae9('0x31')],qs[_0x0ae9('0x37')](_0x38b3['query'][_0x0ae9('0x37')]));_0x41f96a[_0x0ae9('0x36')]=_0x41f96a['attributes'][_0x0ae9('0x38')]?_0x41f96a[_0x0ae9('0x36')]:_0x7e2e7d[_0x0ae9('0x31')];if(!_0x38b3[_0x0ae9('0x33')][_0x0ae9('0x39')](_0x0ae9('0x3a'))){_0x41f96a[_0x0ae9('0x22')]=qs[_0x0ae9('0x22')](_0x38b3[_0x0ae9('0x33')][_0x0ae9('0x22')]);_0x41f96a[_0x0ae9('0x21')]=qs[_0x0ae9('0x21')](_0x38b3[_0x0ae9('0x33')][_0x0ae9('0x21')]);}_0x41f96a[_0x0ae9('0x3b')]=qs[_0x0ae9('0x3c')](_0x38b3[_0x0ae9('0x33')][_0x0ae9('0x3c')]);_0x41f96a[_0x0ae9('0x3d')]=qs[_0x0ae9('0x34')](_[_0x0ae9('0x3e')](_0x38b3[_0x0ae9('0x33')],_0x7e2e7d[_0x0ae9('0x34')]),_0xa9649d);if(_0x38b3[_0x0ae9('0x33')]['filter']){_0x41f96a[_0x0ae9('0x3d')]=_[_0x0ae9('0x3f')](_0x41f96a[_0x0ae9('0x3d')],{'$or':_[_0x0ae9('0x32')](_0xa9649d,function(_0x46c9d8){if(_0x46c9d8['type']!==_0x0ae9('0x40')){var _0x4f392b={};_0x4f392b[_0x46c9d8['name']]={'$like':'%'+_0x38b3[_0x0ae9('0x33')][_0x0ae9('0x41')]+'%'};return _0x4f392b;}})});}_0x41f96a=_[_0x0ae9('0x3f')]({},_0x41f96a,_0x38b3[_0x0ae9('0x42')]);var _0x4e12ca={'where':_0x41f96a['where']};return db[_0x0ae9('0x2d')][_0x0ae9('0x20')](_0x4e12ca)['then'](function(_0x52ca8a){_0x34baf7['count']=_0x52ca8a;if(_0x38b3['query'][_0x0ae9('0x43')]){_0x41f96a['include']=[{'all':!![]}];}return db['OpenchannelApplication'][_0x0ae9('0x44')](_0x41f96a);})[_0x0ae9('0x29')](function(_0x393967){_0x34baf7[_0x0ae9('0x45')]=_0x393967;return _0x34baf7;})['then'](respondWithFilteredResult(_0x171716,_0x41f96a))[_0x0ae9('0x46')](handleError(_0x171716,null));};exports[_0x0ae9('0x47')]=function(_0x58d78b,_0x228348){var _0x396da4={'raw':!![],'where':{'id':_0x58d78b[_0x0ae9('0x48')]['id']}},_0x2db240={};_0x2db240['model']=_[_0x0ae9('0x49')](db[_0x0ae9('0x2d')][_0x0ae9('0x2e')]);_0x2db240['query']=_[_0x0ae9('0x49')](_0x58d78b[_0x0ae9('0x33')]);_0x2db240[_0x0ae9('0x34')]=_['intersection'](_0x2db240[_0x0ae9('0x31')],_0x2db240[_0x0ae9('0x33')]);_0x396da4[_0x0ae9('0x36')]=_[_0x0ae9('0x35')](_0x2db240[_0x0ae9('0x31')],qs[_0x0ae9('0x37')](_0x58d78b[_0x0ae9('0x33')][_0x0ae9('0x37')]));_0x396da4[_0x0ae9('0x36')]=_0x396da4[_0x0ae9('0x36')][_0x0ae9('0x38')]?_0x396da4['attributes']:_0x2db240[_0x0ae9('0x31')];if(_0x58d78b['query']['includeAll']){_0x396da4['include']=[{'all':!![]}];}_0x396da4=_[_0x0ae9('0x3f')]({},_0x396da4,_0x58d78b[_0x0ae9('0x42')]);return db[_0x0ae9('0x2d')]['find'](_0x396da4)[_0x0ae9('0x29')](handleEntityNotFound(_0x228348,null))[_0x0ae9('0x29')](respondWithResult(_0x228348,null))[_0x0ae9('0x46')](handleError(_0x228348,null));};exports[_0x0ae9('0x4a')]=function(_0x4d45f5,_0x357e6d){return db[_0x0ae9('0x2d')][_0x0ae9('0x4a')](_0x4d45f5['body'],{})[_0x0ae9('0x29')](respondWithResult(_0x357e6d,0xc9))[_0x0ae9('0x46')](handleError(_0x357e6d,null));};exports[_0x0ae9('0x4b')]=function(_0x1e6ac7,_0x10d1bf){if(_0x1e6ac7['body']['id']){delete _0x1e6ac7['body']['id'];}return db[_0x0ae9('0x2d')][_0x0ae9('0x4c')]({'where':{'id':_0x1e6ac7['params']['id']}})['then'](handleEntityNotFound(_0x10d1bf,null))[_0x0ae9('0x29')](saveUpdates(_0x1e6ac7[_0x0ae9('0x4d')],null))['then'](respondWithResult(_0x10d1bf,null))[_0x0ae9('0x46')](handleError(_0x10d1bf,null));};exports[_0x0ae9('0x4e')]=function(_0x5573c5,_0x45763f){return db[_0x0ae9('0x2d')]['find']({'where':{'id':_0x5573c5[_0x0ae9('0x48')]['id']}})[_0x0ae9('0x29')](handleEntityNotFound(_0x45763f,null))[_0x0ae9('0x29')](removeEntity(_0x45763f,null))['catch'](handleError(_0x45763f,null));}; \ No newline at end of file +var _0xf791=['intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','end','status','json','offset','limit','set','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','OpenchannelApplication','fieldName','type','key','model','query','keys','filters'];(function(_0x29a611,_0x353b27){var _0x4e4d82=function(_0x11bf26){while(--_0x11bf26){_0x29a611['push'](_0x29a611['shift']());}};_0x4e4d82(++_0x353b27);}(_0xf791,0xe7));var _0x1f79=function(_0x208cf0,_0x486665){_0x208cf0=_0x208cf0-0x0;var _0x372d0d=_0xf791[_0x208cf0];return _0x372d0d;};'use strict';var pdf=require(_0x1f79('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1f79('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1f79('0x2'));var rp=require(_0x1f79('0x3'));var moment=require('moment');var BPromise=require(_0x1f79('0x4'));var Mustache=require(_0x1f79('0x5'));var util=require(_0x1f79('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x1f79('0x7'));var ejs=require(_0x1f79('0x8'));var fs=require('fs');var _=require(_0x1f79('0x9'));var squel=require('squel');var crypto=require(_0x1f79('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1f79('0x7'));var querystring=require(_0x1f79('0xb'));var Papa=require(_0x1f79('0xc'));var Redis=require(_0x1f79('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x1f79('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1f79('0xf'));var logger=require(_0x1f79('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x1f79('0x11'));var db=require(_0x1f79('0x12'))['db'];function respondWithStatusCode(_0x3a050d,_0x45d3a7){_0x45d3a7=_0x45d3a7||0xcc;return function(_0x3b326c){if(_0x3b326c){return _0x3a050d['sendStatus'](_0x45d3a7);}return _0x3a050d['status'](_0x45d3a7)[_0x1f79('0x13')]();};}function respondWithResult(_0x2a3aa3,_0x317244){_0x317244=_0x317244||0xc8;return function(_0x3195ad){if(_0x3195ad){return _0x2a3aa3[_0x1f79('0x14')](_0x317244)[_0x1f79('0x15')](_0x3195ad);}};}function respondWithFilteredResult(_0x5e8154,_0x1fa599){return function(_0x5b71c8){if(_0x5b71c8){var _0x5c84ca=_0x5b71c8['count'],_0x64f476=_0x1fa599['offset'],_0x1728ab=_0x1fa599[_0x1f79('0x16')]+_0x1fa599[_0x1f79('0x17')],_0x1eae17;if(_0x1728ab>=_0x5c84ca){_0x1728ab=_0x5c84ca;_0x1eae17=0xc8;}else{_0x1eae17=0xce;}_0x5e8154['status'](_0x1eae17);return _0x5e8154[_0x1f79('0x18')]('Content-Range',_0x64f476+'-'+_0x1728ab+'/'+_0x5c84ca)[_0x1f79('0x15')](_0x5b71c8);}return null;};}function patchUpdates(_0x33c78d){return function(_0x5b9353){try{jsonpatch[_0x1f79('0x19')](_0x5b9353,_0x33c78d,!![]);}catch(_0x15ecfa){return BPromise[_0x1f79('0x1a')](_0x15ecfa);}return _0x5b9353[_0x1f79('0x1b')]();};}function saveUpdates(_0x39fe16,_0x50430d){return function(_0x39ad8e){if(_0x39ad8e){return _0x39ad8e['update'](_0x39fe16)[_0x1f79('0x1c')](function(_0x38e046){return _0x38e046;});}return null;};}function removeEntity(_0x5682d6,_0x559961){return function(_0x3d5d8b){if(_0x3d5d8b){return _0x3d5d8b[_0x1f79('0x1d')]()[_0x1f79('0x1c')](function(){_0x5682d6[_0x1f79('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d8d33,_0x4e5d7a){return function(_0x1802fc){if(!_0x1802fc){_0x1d8d33[_0x1f79('0x1e')](0x194);}return _0x1802fc;};}function handleError(_0x1d8741,_0x46b0ca){_0x46b0ca=_0x46b0ca||0x1f4;return function(_0x55a869){logger[_0x1f79('0x1f')](_0x55a869[_0x1f79('0x20')]);if(_0x55a869[_0x1f79('0x21')]){delete _0x55a869['name'];}_0x1d8741[_0x1f79('0x14')](_0x46b0ca)[_0x1f79('0x22')](_0x55a869);};}exports[_0x1f79('0x23')]=function(_0x3f188a,_0x29b825){var _0x248375={},_0x5bf99b={},_0x322512={'count':0x0,'rows':[]};var _0x521245=_[_0x1f79('0x24')](db[_0x1f79('0x25')]['rawAttributes'],function(_0x3a2e06){return{'name':_0x3a2e06[_0x1f79('0x26')],'type':_0x3a2e06[_0x1f79('0x27')][_0x1f79('0x28')]};});_0x5bf99b[_0x1f79('0x29')]=_['map'](_0x521245,_0x1f79('0x21'));_0x5bf99b[_0x1f79('0x2a')]=_[_0x1f79('0x2b')](_0x3f188a[_0x1f79('0x2a')]);_0x5bf99b[_0x1f79('0x2c')]=_['intersection'](_0x5bf99b['model'],_0x5bf99b[_0x1f79('0x2a')]);_0x248375['attributes']=_[_0x1f79('0x2d')](_0x5bf99b[_0x1f79('0x29')],qs['fields'](_0x3f188a[_0x1f79('0x2a')][_0x1f79('0x2e')]));_0x248375[_0x1f79('0x2f')]=_0x248375[_0x1f79('0x2f')]['length']?_0x248375[_0x1f79('0x2f')]:_0x5bf99b['model'];if(!_0x3f188a['query']['hasOwnProperty'](_0x1f79('0x30'))){_0x248375[_0x1f79('0x17')]=qs[_0x1f79('0x17')](_0x3f188a[_0x1f79('0x2a')][_0x1f79('0x17')]);_0x248375[_0x1f79('0x16')]=qs['offset'](_0x3f188a[_0x1f79('0x2a')][_0x1f79('0x16')]);}_0x248375[_0x1f79('0x31')]=qs[_0x1f79('0x32')](_0x3f188a[_0x1f79('0x2a')][_0x1f79('0x32')]);_0x248375[_0x1f79('0x33')]=qs[_0x1f79('0x2c')](_[_0x1f79('0x34')](_0x3f188a[_0x1f79('0x2a')],_0x5bf99b[_0x1f79('0x2c')]),_0x521245);if(_0x3f188a['query'][_0x1f79('0x35')]){_0x248375['where']=_[_0x1f79('0x36')](_0x248375[_0x1f79('0x33')],{'$or':_[_0x1f79('0x24')](_0x521245,function(_0x41adcf){if(_0x41adcf[_0x1f79('0x27')]!==_0x1f79('0x37')){var _0xb56ebc={};_0xb56ebc[_0x41adcf[_0x1f79('0x21')]]={'$like':'%'+_0x3f188a[_0x1f79('0x2a')]['filter']+'%'};return _0xb56ebc;}})});}_0x248375=_[_0x1f79('0x36')]({},_0x248375,_0x3f188a[_0x1f79('0x38')]);var _0x6d03f2={'where':_0x248375[_0x1f79('0x33')]};return db[_0x1f79('0x25')]['count'](_0x6d03f2)[_0x1f79('0x1c')](function(_0xd3c88c){_0x322512[_0x1f79('0x39')]=_0xd3c88c;if(_0x3f188a[_0x1f79('0x2a')][_0x1f79('0x3a')]){_0x248375['include']=[{'all':!![]}];}return db['OpenchannelApplication'][_0x1f79('0x3b')](_0x248375);})['then'](function(_0x5076d7){_0x322512[_0x1f79('0x3c')]=_0x5076d7;return _0x322512;})['then'](respondWithFilteredResult(_0x29b825,_0x248375))[_0x1f79('0x3d')](handleError(_0x29b825,null));};exports[_0x1f79('0x3e')]=function(_0x3ef857,_0x2b86b4){var _0x4e94e4={'raw':!![],'where':{'id':_0x3ef857[_0x1f79('0x3f')]['id']}},_0x3d79f9={};_0x3d79f9['model']=_['keys'](db[_0x1f79('0x25')]['rawAttributes']);_0x3d79f9['query']=_['keys'](_0x3ef857[_0x1f79('0x2a')]);_0x3d79f9['filters']=_[_0x1f79('0x2d')](_0x3d79f9[_0x1f79('0x29')],_0x3d79f9['query']);_0x4e94e4['attributes']=_[_0x1f79('0x2d')](_0x3d79f9['model'],qs['fields'](_0x3ef857[_0x1f79('0x2a')][_0x1f79('0x2e')]));_0x4e94e4[_0x1f79('0x2f')]=_0x4e94e4[_0x1f79('0x2f')][_0x1f79('0x40')]?_0x4e94e4[_0x1f79('0x2f')]:_0x3d79f9['model'];if(_0x3ef857['query'][_0x1f79('0x3a')]){_0x4e94e4[_0x1f79('0x41')]=[{'all':!![]}];}_0x4e94e4=_[_0x1f79('0x36')]({},_0x4e94e4,_0x3ef857[_0x1f79('0x38')]);return db['OpenchannelApplication'][_0x1f79('0x42')](_0x4e94e4)[_0x1f79('0x1c')](handleEntityNotFound(_0x2b86b4,null))[_0x1f79('0x1c')](respondWithResult(_0x2b86b4,null))[_0x1f79('0x3d')](handleError(_0x2b86b4,null));};exports['create']=function(_0x131bb9,_0xdffd99){return db[_0x1f79('0x25')][_0x1f79('0x43')](_0x131bb9[_0x1f79('0x44')],{})[_0x1f79('0x1c')](respondWithResult(_0xdffd99,0xc9))[_0x1f79('0x3d')](handleError(_0xdffd99,null));};exports['update']=function(_0x4917a7,_0x428aab){if(_0x4917a7[_0x1f79('0x44')]['id']){delete _0x4917a7['body']['id'];}return db[_0x1f79('0x25')][_0x1f79('0x42')]({'where':{'id':_0x4917a7['params']['id']}})[_0x1f79('0x1c')](handleEntityNotFound(_0x428aab,null))[_0x1f79('0x1c')](saveUpdates(_0x4917a7[_0x1f79('0x44')],null))['then'](respondWithResult(_0x428aab,null))[_0x1f79('0x3d')](handleError(_0x428aab,null));};exports[_0x1f79('0x1d')]=function(_0x31eb3e,_0x59161c){return db[_0x1f79('0x25')][_0x1f79('0x42')]({'where':{'id':_0x31eb3e[_0x1f79('0x3f')]['id']}})[_0x1f79('0x1c')](handleEntityNotFound(_0x59161c,null))[_0x1f79('0x1c')](removeEntity(_0x59161c,null))[_0x1f79('0x3d')](handleError(_0x59161c,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 2dca799..aa3af4c 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 _0x66f0=['openchannel_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./openchannelApplication.attributes'];(function(_0x388a5c,_0x51b851){var _0x3fcae9=function(_0x245a4c){while(--_0x245a4c){_0x388a5c['push'](_0x388a5c['shift']());}};_0x3fcae9(++_0x51b851);}(_0x66f0,0xff));var _0x066f=function(_0x3ed054,_0x4d4f16){_0x3ed054=_0x3ed054-0x0;var _0x16dd95=_0x66f0[_0x3ed054];return _0x16dd95;};'use strict';var _=require(_0x066f('0x0'));var util=require(_0x066f('0x1'));var logger=require(_0x066f('0x2'))('api');var moment=require(_0x066f('0x3'));var BPromise=require(_0x066f('0x4'));var rp=require(_0x066f('0x5'));var fs=require('fs');var path=require(_0x066f('0x6'));var rimraf=require(_0x066f('0x7'));var config=require('../../config/environment');var attributes=require(_0x066f('0x8'));module['exports']=function(_0x1dce74,_0x3d7311){return _0x1dce74['define']('OpenchannelApplication',attributes,{'tableName':_0x066f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x066f('0xa')});}; \ No newline at end of file +var _0x3e8c=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x86be3b,_0x12cf8c){var _0x28be74=function(_0x4f3329){while(--_0x4f3329){_0x86be3b['push'](_0x86be3b['shift']());}};_0x28be74(++_0x12cf8c);}(_0x3e8c,0x1df));var _0xc3e8=function(_0x5d7e6b,_0x43a231){_0x5d7e6b=_0x5d7e6b-0x0;var _0x48afbb=_0x3e8c[_0x5d7e6b];return _0x48afbb;};'use strict';var _=require(_0xc3e8('0x0'));var util=require(_0xc3e8('0x1'));var logger=require(_0xc3e8('0x2'))(_0xc3e8('0x3'));var moment=require(_0xc3e8('0x4'));var BPromise=require(_0xc3e8('0x5'));var rp=require(_0xc3e8('0x6'));var fs=require('fs');var path=require(_0xc3e8('0x7'));var rimraf=require(_0xc3e8('0x8'));var config=require(_0xc3e8('0x9'));var attributes=require(_0xc3e8('0xa'));module[_0xc3e8('0xb')]=function(_0x2c9f7e,_0xa1a121){return _0x2c9f7e[_0xc3e8('0xc')]('OpenchannelApplication',attributes,{'tableName':_0xc3e8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc3e8('0xe'),'collate':_0xc3e8('0xf')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 7bea663..d1bb81e 100644 --- a/server/api/openchannelApplication/openchannelApplication.rpc.js +++ b/server/api/openchannelApplication/openchannelApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x2cd5f1,_0x58e244){var _0x2761c6=function(_0x2f13c8){while(--_0x2f13c8){_0x2cd5f1['push'](_0x2cd5f1['shift']());}};_0x2761c6(++_0x58e244);}(_0xb10b,0x12a));var _0xbb10=function(_0x2c66f6,_0x2dae26){_0x2c66f6=_0x2c66f6-0x0;var _0x1e5894=_0xb10b[_0x2c66f6];return _0x1e5894;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x378da8['options']?_0x378da8['options'][_0xbb10('0x1c')]||null:null})[_0xbb10('0xc')](function(_0x2e911d){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1d')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2e911d));_0x575cca(_0x2e911d);})[_0xbb10('0x1e')](function(_0x395404){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x395404['message'],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0x395404['message']));});});}; \ No newline at end of file +var _0x5f2f=['error','code','message','request\x20sent','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','limit','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','OpenchannelApplication,\x20%s,\x20%s','debug','stringify'];(function(_0x30099e,_0x1ee4b2){var _0x474f63=function(_0x26f35a){while(--_0x26f35a){_0x30099e['push'](_0x30099e['shift']());}};_0x474f63(++_0x1ee4b2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x57ee1e,_0x3db0ba){_0x57ee1e=_0x57ee1e-0x0;var _0x4f7123=_0x5f2f[_0x57ee1e];return _0x4f7123;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20fccd['options']?_0x20fccd['options'][_0xf5f2('0x1d')]||null:null,'attributes':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd['options'][_0xf5f2('0x1e')]||null:null,'limit':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null})[_0xf5f2('0x20')](function(_0x4c691a){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger[_0xf5f2('0xf')](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x4c691a));_0x4ff59b(_0x4c691a);})['catch'](function(_0x529f07){logger[_0xf5f2('0x11')](_0xf5f2('0x17'),_0x529f07[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x529f07[_0xf5f2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 386555f..2f6baaa 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 _0x5dab=['removeTags','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','download','post','/:id/tags','tracked','openchannel','addTags','update','delete','openchannelinteraction:destroy','destroy'];(function(_0x34e9d3,_0x15641e){var _0x65ad47=function(_0x279123){while(--_0x279123){_0x34e9d3['push'](_0x34e9d3['shift']());}};_0x65ad47(++_0x15641e);}(_0x5dab,0xd2));var _0xb5da=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x5dab[_0xbb091];return _0x467a04;};'use strict';var multer=require(_0xb5da('0x0'));var util=require(_0xb5da('0x1'));var path=require(_0xb5da('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb5da('0x3')]();var auth=require(_0xb5da('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb5da('0x5'));var controller=require(_0xb5da('0x6'));router[_0xb5da('0x7')]('/',auth[_0xb5da('0x8')](),controller[_0xb5da('0x9')]);router[_0xb5da('0x7')](_0xb5da('0xa'),auth[_0xb5da('0x8')](),controller['describe']);router['get'](_0xb5da('0xb'),auth['isAuthenticated'](),controller[_0xb5da('0xc')]);router[_0xb5da('0x7')](_0xb5da('0xd'),auth[_0xb5da('0x8')](),controller['getMessages']);router[_0xb5da('0x7')]('/:id/download',auth[_0xb5da('0x8')](),controller[_0xb5da('0xe')]);router[_0xb5da('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb5da('0xf')](_0xb5da('0xd'),auth[_0xb5da('0x8')](),controller['addMessage']);router['post'](_0xb5da('0x10'),auth[_0xb5da('0x8')](),interaction[_0xb5da('0x11')](_0xb5da('0x12'),'openchannelinteraction:addtags'),controller[_0xb5da('0x13')]);router['put'](_0xb5da('0xb'),auth[_0xb5da('0x8')](),interaction['tracked'](_0xb5da('0x12'),'openchannelinteraction:update'),controller[_0xb5da('0x14')]);router[_0xb5da('0x15')](_0xb5da('0xb'),auth[_0xb5da('0x8')](),interaction['tracked'](_0xb5da('0x12'),_0xb5da('0x16')),controller[_0xb5da('0x17')]);router[_0xb5da('0x15')](_0xb5da('0x10'),auth[_0xb5da('0x8')](),controller[_0xb5da('0x18')]);module[_0xb5da('0x19')]=router; \ No newline at end of file +var _0x1469=['put','/:id','update','delete','tracked','openchannelinteraction:destroy','destroy','removeTags','multer','util','path','connect-timeout','express','Router','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','/describe','describe','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','openchannel','openchannelinteraction:addtags','addTags'];(function(_0x2ea31f,_0x3f2cb5){var _0x26b595=function(_0x423063){while(--_0x423063){_0x2ea31f['push'](_0x2ea31f['shift']());}};_0x26b595(++_0x3f2cb5);}(_0x1469,0xda));var _0x9146=function(_0x5599aa,_0x1b9ffe){_0x5599aa=_0x5599aa-0x0;var _0x4b0f34=_0x1469[_0x5599aa];return _0x4b0f34;};'use strict';var multer=require(_0x9146('0x0'));var util=require(_0x9146('0x1'));var path=require(_0x9146('0x2'));var timeout=require(_0x9146('0x3'));var express=require(_0x9146('0x4'));var router=express[_0x9146('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9146('0x6'));var controller=require(_0x9146('0x7'));router[_0x9146('0x8')]('/',auth[_0x9146('0x9')](),controller['index']);router['get'](_0x9146('0xa'),auth[_0x9146('0x9')](),controller[_0x9146('0xb')]);router[_0x9146('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x9146('0x8')](_0x9146('0xc'),auth[_0x9146('0x9')](),controller[_0x9146('0xd')]);router[_0x9146('0x8')](_0x9146('0xe'),auth[_0x9146('0x9')](),controller[_0x9146('0xf')]);router[_0x9146('0x10')]('/',auth[_0x9146('0x9')](),controller['create']);router['post'](_0x9146('0xc'),auth[_0x9146('0x9')](),controller[_0x9146('0x11')]);router[_0x9146('0x10')](_0x9146('0x12'),auth[_0x9146('0x9')](),interaction['tracked'](_0x9146('0x13'),_0x9146('0x14')),controller[_0x9146('0x15')]);router[_0x9146('0x16')](_0x9146('0x17'),auth[_0x9146('0x9')](),interaction['tracked'](_0x9146('0x13'),'openchannelinteraction:update'),controller[_0x9146('0x18')]);router[_0x9146('0x19')](_0x9146('0x17'),auth[_0x9146('0x9')](),interaction[_0x9146('0x1a')](_0x9146('0x13'),_0x9146('0x1b')),controller[_0x9146('0x1c')]);router[_0x9146('0x19')](_0x9146('0x12'),auth[_0x9146('0x9')](),controller[_0x9146('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 98a5fa7..a07f2c3 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 _0x61a6=['STRING','DATE','out','sequelize','exports','BOOLEAN'];(function(_0x377e6a,_0x2ea695){var _0x31ca60=function(_0x2354fa){while(--_0x2354fa){_0x377e6a['push'](_0x377e6a['shift']());}};_0x31ca60(++_0x2ea695);}(_0x61a6,0x129));var _0x661a=function(_0x1345fa,_0x11947a){_0x1345fa=_0x1345fa-0x0;var _0xc32585=_0x61a6[_0x1345fa];return _0xc32585;};'use strict';var Sequelize=require(_0x661a('0x0'));module[_0x661a('0x1')]={'closed':{'type':Sequelize[_0x661a('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x661a('0x3')]},'note':{'type':Sequelize[_0x661a('0x3')]},'read1stAt':{'type':Sequelize[_0x661a('0x4')]},'threadId':{'type':Sequelize[_0x661a('0x3')]},'externalUrl':{'type':Sequelize[_0x661a('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x661a('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe60f=['DATE','STRING','exports'];(function(_0x362d91,_0xc869d2){var _0x47d7b9=function(_0x4b15d5){while(--_0x4b15d5){_0x362d91['push'](_0x362d91['shift']());}};_0x47d7b9(++_0xc869d2);}(_0xe60f,0xb3));var _0xfe60=function(_0x2129b4,_0xf4fbeb){_0x2129b4=_0x2129b4-0x0;var _0x522d7e=_0xe60f[_0x2129b4];return _0x522d7e;};'use strict';var Sequelize=require('sequelize');module[_0xfe60('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfe60('0x1')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0xfe60('0x2')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0xfe60('0x1')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xfe60('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index f5ed597..0745316 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 _0x3954=['$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','t.id\x20IN\x20?','resolve','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','toString','sequelize','keyBy','OpenchannelInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','OpenchannelInteractionId','all','show','params','includeAll','include','merge','options','catch','create','describe','OpenchannelMessage','addMessage','ids','omit','getMessages','findOne','hasOwnProperty','filter','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','spread','Tag','emit','openchannelInteractionTags:save','removeTags','download','join','server','files','tmp','attachments','CmContact','lastName','Attachment','Messages','direction','secret','OpenchannelAccount','Account','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\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','Openchannel','Owner','N.A.','closed','closedAt','disposition','Private','basename','existsSync','createReadStream','createWriteStream','out','System','firstName','renderFile','root','views','transcript-','.pdf','log','err','unlinkSync','html-pdf','eml-format','zip-dir','request-promise','moment','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','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','stack','name','send','Users','map','fullname','Tags','TagIds','split','forEach','push','index','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','select','field','color','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','from','user_has_openchannel_interactions','left_join','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','it.OpenchannelInteractionId\x20=\x20i.id','expr','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','start','body','some','compact','isEmpty','OpenchannelAccountId','concat','createdAt','parse','$gte'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x3954,0x16d));var _0x4395=function(_0x23766d,_0xcbcb33){_0x23766d=_0x23766d-0x0;var _0x22e21e=_0x3954[_0x23766d];return _0x22e21e;};'use strict';var pdf=require(_0x4395('0x0'));var emlformat=require(_0x4395('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4395('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4395('0x3'));var moment=require(_0x4395('0x4'));var BPromise=require(_0x4395('0x5'));var Mustache=require(_0x4395('0x6'));var util=require(_0x4395('0x7'));var path=require(_0x4395('0x8'));var sox=require(_0x4395('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x4395('0xa'));var squel=require(_0x4395('0xb'));var crypto=require(_0x4395('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4395('0xd'));var toCsv=require(_0x4395('0xe'));var querystring=require(_0x4395('0xf'));var Papa=require(_0x4395('0x10'));var Redis=require(_0x4395('0x11'));var authService=require(_0x4395('0x12'));var qs=require(_0x4395('0x13'));var as=require(_0x4395('0x14'));var hardwareService=require(_0x4395('0x15'));var logger=require(_0x4395('0x16'))(_0x4395('0x17'));var utils=require(_0x4395('0x18'));var config=require(_0x4395('0x19'));var db=require(_0x4395('0x1a'))['db'];config[_0x4395('0x1b')]=_['defaults'](config[_0x4395('0x1b')],{'host':_0x4395('0x1c'),'port':0x18eb});var socket=require(_0x4395('0x1d'))(new Redis(config['redis']));require(_0x4395('0x1e'))[_0x4395('0x1f')](socket);function respondWithStatusCode(_0x1dc7f6,_0x4a6ec2){_0x4a6ec2=_0x4a6ec2||0xcc;return function(_0x4a666c){if(_0x4a666c){return _0x1dc7f6[_0x4395('0x20')](_0x4a6ec2);}return _0x1dc7f6['status'](_0x4a6ec2)[_0x4395('0x21')]();};}function respondWithResult(_0x10cf4e,_0x322da3){_0x322da3=_0x322da3||0xc8;return function(_0x4109d4){if(_0x4109d4){return _0x10cf4e[_0x4395('0x22')](_0x322da3)[_0x4395('0x23')](_0x4109d4);}};}function respondWithFilteredResult(_0x294339,_0x562fd1){return function(_0x4f1d15){if(_0x4f1d15){var _0x5d5575=_0x4f1d15[_0x4395('0x24')],_0x4ac329=_0x562fd1[_0x4395('0x25')],_0x3c2ec9=_0x562fd1[_0x4395('0x25')]+_0x562fd1[_0x4395('0x26')],_0x569e12;if(_0x3c2ec9>=_0x5d5575){_0x3c2ec9=_0x5d5575;_0x569e12=0xc8;}else{_0x569e12=0xce;}_0x294339['status'](_0x569e12);return _0x294339['set'](_0x4395('0x27'),_0x4ac329+'-'+_0x3c2ec9+'/'+_0x5d5575)['json'](_0x4f1d15);}return null;};}function patchUpdates(_0x23f590){return function(_0x9528c){try{jsonpatch[_0x4395('0x28')](_0x9528c,_0x23f590,!![]);}catch(_0x179ffc){return BPromise['reject'](_0x179ffc);}return _0x9528c[_0x4395('0x29')]();};}function saveUpdates(_0x456d25,_0x20acc3){return function(_0x4b30b9){if(_0x4b30b9){return _0x4b30b9[_0x4395('0x2a')](_0x456d25)[_0x4395('0x2b')](function(_0x338d56){return _0x338d56;});}return null;};}function removeEntity(_0xb77236,_0x1de16f){return function(_0x3768db){if(_0x3768db){return _0x3768db[_0x4395('0x2c')]()['then'](function(){_0xb77236[_0x4395('0x22')](0xcc)[_0x4395('0x21')]();});}};}function handleEntityNotFound(_0x56fc47,_0x4c2603){return function(_0x3d4b3b){if(!_0x3d4b3b){_0x56fc47[_0x4395('0x20')](0x194);}return _0x3d4b3b;};}function handleError(_0x23f173,_0x493500){_0x493500=_0x493500||0x1f4;return function(_0x463c04){logger['error'](_0x463c04[_0x4395('0x2d')]);if(_0x463c04['name']){delete _0x463c04[_0x4395('0x2e')];}_0x23f173['status'](_0x493500)[_0x4395('0x2f')](_0x463c04);};}function getInteractionUsers(_0x355a7,_0x496eb3){return new BPromise(function(_0x124a3b,_0x23caa5){try{if(_0x496eb3[_0x355a7['id']]){_0x355a7[_0x4395('0x30')]=_[_0x4395('0x31')](_0x496eb3[_0x355a7['id']],function(_0x3ec303){return{'id':_0x3ec303['id'],'fullname':_0x3ec303[_0x4395('0x32')]};});}}catch(_0x3dd2a3){_0x23caa5(_0x3dd2a3);}_0x124a3b(_0x355a7);});}function getInteractionTags(_0x4a9f00,_0x10fcb3){return new BPromise(function(_0x1ecc84,_0x175328){try{if(_0x4a9f00['TagIds']){_0x4a9f00[_0x4395('0x33')]=[];_0x4a9f00[_0x4395('0x34')][_0x4395('0x35')](',')[_0x4395('0x36')](function(_0x5cd3ec){_0x4a9f00['Tags'][_0x4395('0x37')](_0x10fcb3[_0x5cd3ec]);});}delete _0x4a9f00[_0x4395('0x34')];}catch(_0x3a5871){_0x175328(_0x3a5871);}_0x1ecc84(_0x4a9f00);});}function updateOpenchannelInteraction(_0x4544f4,_0x434764,_0x28cb8f){return new BPromise(function(_0x5bc62c,_0x42dd48){return getInteractionUsers(_0x4544f4,_0x28cb8f)[_0x4395('0x2b')](function(_0x3a95f0){return getInteractionTags(_0x3a95f0,_0x434764);})['then'](function(_0x422c15){_0x5bc62c(_0x422c15);})['catch'](function(_0x1fe7ac){_0x42dd48(_0x1fe7ac);});});}exports[_0x4395('0x38')]=function(_0x2bf58e,_0x57dc22){var _0x5929fb={},_0x2857e8={},_0x477006={'count':0x0,'rows':[]};var _0x3ade9e=_[_0x4395('0x31')](db['OpenchannelInteraction'][_0x4395('0x39')],function(_0x1a9cb6){return{'name':_0x1a9cb6[_0x4395('0x3a')],'type':_0x1a9cb6[_0x4395('0x3b')][_0x4395('0x3c')]};});_0x2857e8[_0x4395('0x3d')]=_[_0x4395('0x31')](_0x3ade9e,_0x4395('0x2e'));_0x2857e8[_0x4395('0x3e')]=_[_0x4395('0x3f')](_0x2bf58e[_0x4395('0x3e')]);_0x2857e8['filters']=_['intersection'](_0x2857e8[_0x4395('0x3d')],_0x2857e8[_0x4395('0x3e')]);_0x5929fb[_0x4395('0x40')]=_[_0x4395('0x41')](_0x2857e8[_0x4395('0x3d')],qs[_0x4395('0x42')](_0x2bf58e[_0x4395('0x3e')][_0x4395('0x42')]));_0x5929fb[_0x4395('0x40')]=_0x5929fb['attributes'][_0x4395('0x43')]?_0x5929fb[_0x4395('0x40')]:_0x2857e8[_0x4395('0x3d')];if(!_0x2bf58e[_0x4395('0x3e')]['hasOwnProperty'](_0x4395('0x44'))){_0x5929fb[_0x4395('0x26')]=qs[_0x4395('0x26')](_0x2bf58e[_0x4395('0x3e')][_0x4395('0x26')]);_0x5929fb['offset']=qs[_0x4395('0x25')](_0x2bf58e['query'][_0x4395('0x25')]);}_0x5929fb[_0x4395('0x45')]=qs[_0x4395('0x46')](_0x2bf58e['query'][_0x4395('0x46')]);_0x5929fb[_0x4395('0x47')]=qs[_0x4395('0x48')](_[_0x4395('0x49')](_0x2bf58e[_0x4395('0x3e')],_0x2857e8[_0x4395('0x48')]),_0x3ade9e);var _0x41a9a5=[];var _0x5848ba=squel[_0x4395('0x4a')]()['field']('id')[_0x4395('0x4b')](_0x4395('0x2e'))[_0x4395('0x4b')](_0x4395('0x4c'))['from'](_0x4395('0x4d'));var _0x5792e6=squel[_0x4395('0x4a')]()[_0x4395('0x4b')](_0x4395('0x4e'))['field'](_0x4395('0x4f'))['field'](_0x4395('0x50'))[_0x4395('0x51')](_0x4395('0x52'),'ui')[_0x4395('0x53')]('users','u',_0x4395('0x54'));var _0x51b0c8=squel[_0x4395('0x4a')]()[_0x4395('0x51')](_0x4395('0x55'),'i')[_0x4395('0x53')](_0x4395('0x56'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x4395('0x53')]('users','o',_0x4395('0x57'))['left_join'](_0x4395('0x58'),'a',_0x4395('0x59'))[_0x4395('0x53')](_0x4395('0x5a'),'me',_0x4395('0x5b'))[_0x4395('0x53')]('openchannel_interaction_has_tags','it',_0x4395('0x5c'))[_0x4395('0x53')](_0x4395('0x4d'),'t','t.id\x20=\x20it.TagId');var _0x37dd78=squel[_0x4395('0x5d')]();var _0x434fea=[];var _0x2d62e2=squel[_0x4395('0x5d')]();var _0x4e341f;if(_0x2bf58e[_0x4395('0x3e')]['search']){_0x4e341f=as['parseSearch'](_0x2bf58e[_0x4395('0x3e')][_0x4395('0x5e')]);var _0x532cc7=_0x4e341f[_0x4395('0x5f')];for(var _0xf017dc=0x0;_0xf017dc<_0x4e341f['conditions'][_0x4395('0x43')];_0xf017dc++){var _0x292319=_0x4e341f[_0x4395('0x60')][_0xf017dc];var _0x212867='i';var _0x549992=_[_0x4395('0x61')](_0x3ade9e,[_0x4395('0x2e'),_0x292319[_0x4395('0x4b')]]);if(!_0x549992){switch(_0x292319[_0x4395('0x4b')]){case _0x4395('0x62'):if(_0x292319[_0x4395('0x63')]==0x1){_0x51b0c8[_0x4395('0x64')]('`'+_0x292319['field']+_0x4395('0x65'));}else{_0x51b0c8[_0x4395('0x64')]('`'+_0x292319['field']+_0x4395('0x66'));}break;case _0x4395('0x67'):if(_0x292319[_0x4395('0x68')]===_0x4395('0x69')){if(_0x292319['value'][_0x4395('0x35')]('\x20')[_0x4395('0x43')]>0x1){_0x37dd78[_0x532cc7](_0x4395('0x6a'),qs[_0x4395('0x6b')](_0x292319[_0x4395('0x63')]),null);}else{var _0x5d09e3='%'+_0x292319[_0x4395('0x63')]+'%';_0x37dd78[_0x532cc7](_0x4395('0x6c'),_0x5d09e3,_0x5d09e3,_0x5d09e3);}}else{_0x549992=_[_0x4395('0x61')](_0x3ade9e,[_0x4395('0x2e'),_0x4395('0x6d')]);_0x292319[_0x4395('0x4b')]=_0x4395('0x6d');_0x172afb=as[_0x4395('0x6e')](_0x212867,_0x549992[_0x4395('0x3b')],_0x292319);_0x37dd78[_0x532cc7](_0x172afb['text'],_0x172afb[_0x4395('0x63')]['start'],_0x172afb[_0x4395('0x63')][_0x4395('0x21')]);}break;case'Tag':var _0x582e37=_0x292319[_0x4395('0x63')][_0x4395('0x35')](',')[_0x4395('0x31')](function(_0x1b40ad){return Number(_0x1b40ad);});_0x582e37['forEach'](function(_0x35532b){_0x2d62e2['or'](_0x4395('0x6f'),'%,'+_0x35532b+',%');});_0x434fea=_[_0x4395('0x70')](_0x434fea,_0x582e37);break;case _0x4395('0x71'):if(_0x292319[_0x4395('0x68')]===_0x4395('0x69')){_0x37dd78[_0x532cc7](_0x4395('0x72'),'%'+_0x292319[_0x4395('0x63')]+'%',null);}else{_0x549992=_[_0x4395('0x61')](_0x3ade9e,['name',_0x4395('0x73')]);_0x292319[_0x4395('0x4b')]=_0x4395('0x73');_0x172afb=as[_0x4395('0x6e')](_0x212867,_0x549992[_0x4395('0x3b')],_0x292319);_0x37dd78[_0x532cc7](_0x172afb[_0x4395('0x74')],_0x172afb[_0x4395('0x63')][_0x4395('0x75')],_0x172afb[_0x4395('0x63')][_0x4395('0x21')]);}break;case _0x4395('0x76'):_0x172afb=as[_0x4395('0x6e')]('me',null,_0x292319);_0x37dd78[_0x532cc7](_0x172afb[_0x4395('0x74')],_0x172afb[_0x4395('0x63')][_0x4395('0x75')],_0x172afb['value'][_0x4395('0x21')]);break;}}else{var _0x172afb=as[_0x4395('0x6e')](_0x212867,_0x549992[_0x4395('0x3b')],_0x292319);_0x37dd78[_0x532cc7](_0x172afb[_0x4395('0x74')],_0x172afb['value']['start'],_0x172afb[_0x4395('0x63')][_0x4395('0x21')]);}}}else{var _0x2444e8=_(_0x2bf58e[_0x4395('0x3e')])[_0x4395('0x3f')]()[_0x4395('0x31')](function(_0x162213){return _[_0x4395('0x77')](_0x3ade9e,[_0x4395('0x2e'),_0x162213])?_0x162213:undefined;})[_0x4395('0x78')]()[_0x4395('0x63')]();if(!_[_0x4395('0x79')](_0x2444e8)){_0x2444e8[_0x4395('0x36')](function(_0x5b3cf8){if(_0x5b3cf8===_0x4395('0x7a')){_0x51b0c8[_0x4395('0x47')]('i.OpenchannelAccountId\x20IN\x20?',[][_0x4395('0x7b')](_0x2bf58e['query'][_0x5b3cf8]));}else if(_0x5b3cf8===_0x4395('0x7c')){var _0x39b50d=JSON[_0x4395('0x7d')](_0x2bf58e[_0x4395('0x3e')][_0x5b3cf8])[_0x4395('0x7e')];var _0x2ed656=JSON[_0x4395('0x7d')](_0x2bf58e['query'][_0x5b3cf8])[_0x4395('0x7f')];_0x51b0c8[_0x4395('0x47')](_0x4395('0x80'),_0x39b50d,_0x2ed656);}else{if(_0x2bf58e[_0x4395('0x3e')][_0x5b3cf8]==='null'){_0x51b0c8[_0x4395('0x47')]('i.'+_0x5b3cf8+'\x20IS\x20NULL');}else{_0x51b0c8['where']('i.'+_0x5b3cf8+_0x4395('0x81'),_0x2bf58e[_0x4395('0x3e')][_0x5b3cf8]);}}});}if(_0x2bf58e['query'][_0x4395('0x82')]){if(_0x2bf58e[_0x4395('0x3e')][_0x4395('0x82')]==0x1){_0x51b0c8[_0x4395('0x64')](_0x4395('0x83'));}else{_0x51b0c8[_0x4395('0x64')](_0x4395('0x84'));}}if(_0x2bf58e[_0x4395('0x3e')][_0x4395('0x85')]){_0x434fea=_[_0x4395('0x86')](_0x2bf58e['query'][_0x4395('0x85')])?_0x2bf58e[_0x4395('0x3e')][_0x4395('0x85')]:new Array(_0x2bf58e[_0x4395('0x3e')][_0x4395('0x85')]);_0x434fea[_0x4395('0x36')](function(_0x128626){_0x2d62e2['or'](_0x4395('0x6f'),'%,'+_0x128626+',%');});}if(_0x2bf58e['query']['filter']){var _0x4b64d3=_0x2bf58e[_0x4395('0x3e')]['filter']['replace']('\x5c','\x5c\x5c')['replace']('\x27\x27','\x27\x27\x27\x27');if(qs['isNumeric'](_0x4b64d3)){_0x37dd78['or'](_0x4395('0x87'),_0x4b64d3+'%');}else{_0x37dd78['or'](_0x4395('0x88'),qs[_0x4395('0x6b')](_0x4b64d3))['or'](_0x4395('0x89'),_0x4b64d3+'%')['or'](_0x4395('0x8a'),_0x4b64d3+'%');}}}_0x51b0c8[_0x4395('0x47')](_0x37dd78);_0x51b0c8[_0x4395('0x8b')](_0x4395('0x8c'));var _0x14f956={'type':db['Sequelize'][_0x4395('0x8d')][_0x4395('0x8e')],'raw':!![]};var _0x52dfe2=_0x51b0c8[_0x4395('0x8f')]();_0x52dfe2[_0x4395('0x4b')]('i.id');_0x52dfe2['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x4395('0x62'));if(_0x5929fb['order']){_0x5929fb['order'][_0x4395('0x36')](function(_0xc0d0ed){_0x51b0c8[_0x4395('0x45')]('i.'+_0xc0d0ed[0x0],_0xc0d0ed[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x434fea)){_0x51b0c8[_0x4395('0x64')](_0x2d62e2);_0x52dfe2[_0x4395('0x47')](_0x4395('0x90'),_0x434fea);}BPromise[_0x4395('0x91')]()[_0x4395('0x2b')](function(){if(!_0x4e341f){if(_0x2bf58e[_0x4395('0x3e')][_0x4395('0x7a')]||_0x2bf58e['query'][_0x4395('0x92')])return;_0x52dfe2[_0x4395('0x47')](_0x4395('0x93'));_0x51b0c8[_0x4395('0x47')](_0x4395('0x93'));return;}return _0x2bf58e['user'][_0x4395('0x94')]({'attributes':['id'],'raw':!![]})[_0x4395('0x2b')](function(_0x518e55){if(_[_0x4395('0x79')](_0x518e55)){_0x52dfe2[_0x4395('0x47')](_0x4395('0x95'));_0x51b0c8[_0x4395('0x47')](_0x4395('0x95'));}else{_0x52dfe2[_0x4395('0x47')]('i.OpenchannelAccountId\x20IN\x20?',_['map'](_0x518e55,'id'));_0x51b0c8[_0x4395('0x47')](_0x4395('0x96'),_[_0x4395('0x31')](_0x518e55,'id'));}});})[_0x4395('0x2b')](function(){db['sequelize'][_0x4395('0x3e')](_0x52dfe2[_0x4395('0x97')](),_0x14f956)[_0x4395('0x2b')](function(_0xb4a6a9){_0x477006[_0x4395('0x24')]=_0xb4a6a9[_0x4395('0x43')];if(_0x477006[_0x4395('0x24')]===0x0)return[];return db[_0x4395('0x98')][_0x4395('0x3e')](_0x5848ba[_0x4395('0x97')](),_0x14f956)[_0x4395('0x2b')](function(_0xd19f0a){_0x41a9a5=_[_0x4395('0x99')](_0xd19f0a,'id');_0x14f956=_['merge'](_0x14f956,{'model':db[_0x4395('0x9a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2bf58e['query']['fields']){_0x5929fb[_0x4395('0x40')][_0x4395('0x36')](function(_0x5cfd76){_0x51b0c8[_0x4395('0x4b')]('i.'+_0x5cfd76);});}else{_0x51b0c8['field'](_0x4395('0x9b'),_0x4395('0x62'));_0x51b0c8[_0x4395('0x4b')](_0x4395('0x9c'),_0x4395('0x9d'));_0x51b0c8[_0x4395('0x4b')](_0x4395('0x9e'),_0x4395('0x9f'));_0x51b0c8[_0x4395('0x4b')]('i.*');_0x51b0c8[_0x4395('0x4b')](_0x4395('0xa0'),_0x4395('0xa1'));_0x51b0c8[_0x4395('0x4b')]('c.lastName','Contact.lastName');_0x51b0c8[_0x4395('0x4b')]('c.email',_0x4395('0xa2'));_0x51b0c8[_0x4395('0x4b')](_0x4395('0xa3'),'Contact.phone');_0x51b0c8[_0x4395('0x4b')](_0x4395('0xa4'),_0x4395('0xa5'));_0x51b0c8[_0x4395('0x4b')](_0x4395('0xa6'),_0x4395('0xa7'));_0x51b0c8[_0x4395('0x4b')](_0x4395('0xa8'),_0x4395('0xa9'));_0x51b0c8[_0x4395('0x4b')](_0x4395('0xaa'),'Owner.internal');_0x51b0c8['field'](_0x4395('0xab'),'TagIds');}if(_0x5929fb[_0x4395('0x26')])_0x51b0c8[_0x4395('0x26')](_0x5929fb['limit']);if(_0x5929fb[_0x4395('0x25')])_0x51b0c8[_0x4395('0x25')](_0x5929fb[_0x4395('0x25')]);return db['sequelize'][_0x4395('0x3e')](_0x51b0c8[_0x4395('0x97')](),_0x14f956);})['then'](function(_0xe04f11){_0x5792e6[_0x4395('0x47')](_0x4395('0xac'),_[_0x4395('0x31')](_0xe04f11,'id'));return db['sequelize']['query'](_0x5792e6[_0x4395('0x97')](),_0x14f956)[_0x4395('0x2b')](function(_0xfc7eaa){var _0x5610bf=_['groupBy'](_0xfc7eaa,_0x4395('0xad'));var _0x5a5e74=[];_0xe04f11['forEach'](function(_0x2ec4f8){_0x5a5e74['push'](updateOpenchannelInteraction(_0x2ec4f8,_0x41a9a5,_0x5610bf));});return BPromise[_0x4395('0xae')](_0x5a5e74);});});})[_0x4395('0x2b')](function(_0x154373){_0x477006['rows']=_0x154373;return _0x477006;})['then'](respondWithFilteredResult(_0x57dc22,_0x5929fb));})['catch'](handleError(_0x57dc22,null));};exports[_0x4395('0xaf')]=function(_0x4946ee,_0x470cd7){var _0x2668c5={'raw':![],'where':{'id':_0x4946ee[_0x4395('0xb0')]['id']}},_0x17c1bc={};_0x17c1bc[_0x4395('0x3d')]=_[_0x4395('0x3f')](db[_0x4395('0x9a')][_0x4395('0x39')]);_0x17c1bc[_0x4395('0x3e')]=_['keys'](_0x4946ee[_0x4395('0x3e')]);_0x17c1bc[_0x4395('0x48')]=_[_0x4395('0x41')](_0x17c1bc[_0x4395('0x3d')],_0x17c1bc[_0x4395('0x3e')]);_0x2668c5['attributes']=_[_0x4395('0x41')](_0x17c1bc[_0x4395('0x3d')],qs['fields'](_0x4946ee[_0x4395('0x3e')][_0x4395('0x42')]));_0x2668c5['attributes']=_0x2668c5[_0x4395('0x40')][_0x4395('0x43')]?_0x2668c5[_0x4395('0x40')]:_0x17c1bc['model'];if(_0x4946ee['query'][_0x4395('0xb1')]){_0x2668c5[_0x4395('0xb2')]=[{'all':!![]}];}_0x2668c5=_[_0x4395('0xb3')]({},_0x2668c5,_0x4946ee[_0x4395('0xb4')]);return db[_0x4395('0x9a')][_0x4395('0x61')](_0x2668c5)['then'](handleEntityNotFound(_0x470cd7,null))[_0x4395('0x2b')](respondWithResult(_0x470cd7,null))[_0x4395('0xb5')](handleError(_0x470cd7,null));};exports['create']=function(_0xba8b45,_0x2c4f4c){return db[_0x4395('0x9a')][_0x4395('0xb6')](_0xba8b45[_0x4395('0x76')],{})[_0x4395('0x2b')](respondWithResult(_0x2c4f4c,0xc9))[_0x4395('0xb5')](handleError(_0x2c4f4c,null));};exports['update']=function(_0x1ba02c,_0x42ca28){if(_0x1ba02c[_0x4395('0x76')]['id']){delete _0x1ba02c[_0x4395('0x76')]['id'];}return db[_0x4395('0x9a')]['find']({'where':{'id':_0x1ba02c[_0x4395('0xb0')]['id']}})[_0x4395('0x2b')](handleEntityNotFound(_0x42ca28,null))[_0x4395('0x2b')](saveUpdates(_0x1ba02c['body'],null))[_0x4395('0x2b')](respondWithResult(_0x42ca28,null))[_0x4395('0xb5')](handleError(_0x42ca28,null));};exports[_0x4395('0x2c')]=function(_0x3b3b3e,_0x220d61){return db[_0x4395('0x9a')][_0x4395('0x61')]({'where':{'id':_0x3b3b3e[_0x4395('0xb0')]['id']}})[_0x4395('0x2b')](handleEntityNotFound(_0x220d61,null))[_0x4395('0x2b')](removeEntity(_0x220d61,null))[_0x4395('0xb5')](handleError(_0x220d61,null));};exports[_0x4395('0xb7')]=function(_0x689d34,_0x1ec410){return db[_0x4395('0x9a')][_0x4395('0xb7')]()[_0x4395('0x2b')](respondWithResult(_0x1ec410,null))['catch'](handleError(_0x1ec410,null));};exports['addMessage']=function(_0xb7bdf5,_0xafa428,_0x1fa152){return db[_0x4395('0xb8')][_0x4395('0x61')]({'where':{'id':_0xb7bdf5[_0x4395('0xb0')]['id']}})[_0x4395('0x2b')](handleEntityNotFound(_0xafa428,null))[_0x4395('0x2b')](function(_0x80452){if(_0x80452){return _0x80452[_0x4395('0xb9')](_0xb7bdf5[_0x4395('0x76')][_0x4395('0xba')],_[_0x4395('0xbb')](_0xb7bdf5[_0x4395('0x76')],['ids','id'])||{});}})[_0x4395('0x2b')](respondWithResult(_0xafa428,null))[_0x4395('0xb5')](handleError(_0xafa428,null));};exports[_0x4395('0xbc')]=function(_0x484522,_0x106e77,_0x3fd4d5){var _0x4d046f={'raw':![],'where':{}};var _0x442ceb={};var _0x39f7dd={'count':0x0,'rows':[]};return db[_0x4395('0x9a')][_0x4395('0xbd')]({'where':{'id':_0x484522[_0x4395('0xb0')]['id']}})[_0x4395('0x2b')](handleEntityNotFound(_0x106e77,null))[_0x4395('0x2b')](function(_0xd2eaac){if(_0xd2eaac){_0x442ceb[_0x4395('0x3d')]=_[_0x4395('0x3f')](db['OpenchannelMessage'][_0x4395('0x39')]);_0x442ceb['query']=_[_0x4395('0x3f')](_0x484522[_0x4395('0x3e')]);_0x442ceb[_0x4395('0x48')]=_[_0x4395('0x41')](_0x442ceb['model'],_0x442ceb['query']);_0x4d046f['attributes']=_[_0x4395('0x41')](_0x442ceb[_0x4395('0x3d')],qs[_0x4395('0x42')](_0x484522[_0x4395('0x3e')][_0x4395('0x42')]));_0x4d046f['attributes']=_0x4d046f[_0x4395('0x40')][_0x4395('0x43')]?_0x4d046f[_0x4395('0x40')]:_0x442ceb[_0x4395('0x3d')];if(!_0x484522[_0x4395('0x3e')][_0x4395('0xbe')]('nolimit')){_0x4d046f['limit']=qs['limit'](_0x484522[_0x4395('0x3e')][_0x4395('0x26')]);_0x4d046f[_0x4395('0x25')]=qs['offset'](_0x484522[_0x4395('0x3e')][_0x4395('0x25')]);}_0x4d046f[_0x4395('0x45')]=qs[_0x4395('0x46')](_0x484522['query'][_0x4395('0x46')]);_0x4d046f[_0x4395('0x47')]=qs[_0x4395('0x48')](_['pick'](_0x484522[_0x4395('0x3e')],_0x442ceb[_0x4395('0x48')]));_0x4d046f['where'][_0x4395('0xad')]=_0xd2eaac['id'];if(_0x484522[_0x4395('0x3e')]['filter']){_0x4d046f[_0x4395('0x47')]=_[_0x4395('0xb3')](_0x4d046f[_0x4395('0x47')],{'$or':_['map'](_0x4d046f[_0x4395('0x40')],function(_0x1f62fc){var _0x1b1a75={};_0x1b1a75[_0x1f62fc]={'$like':'%'+_0x484522[_0x4395('0x3e')][_0x4395('0xbf')]+'%'};return _0x1b1a75;})});}if(_0x484522[_0x4395('0x3e')]['$gte']){var _0x40bee8=_0x484522[_0x4395('0x3e')]['$gte']['split'](',');var _0x47c0b0={};_0x47c0b0[_0x40bee8[0x0]]={'$gte':moment(_0x40bee8[0x1])[_0x4395('0xc0')](_0x4395('0xc1'))};_0x4d046f['where']=_[_0x4395('0xb3')](_0x4d046f['where'],_0x47c0b0);}_0x4d046f=_[_0x4395('0xb3')]({},_0x4d046f,_0x484522['options']);return db[_0x4395('0xb8')][_0x4395('0x24')]({'where':_0x4d046f[_0x4395('0x47')]})[_0x4395('0x2b')](function(_0x25764f){_0x39f7dd[_0x4395('0x24')]=_0x25764f;if(_0x484522[_0x4395('0x3e')][_0x4395('0xb1')]){_0x4d046f[_0x4395('0xb2')]=[{'all':!![]}];}return db[_0x4395('0xb8')][_0x4395('0xc2')](_0x4d046f);})[_0x4395('0x2b')](function(_0x505cb2){_0x39f7dd[_0x4395('0xc3')]=_0x505cb2;return _0x39f7dd;});}})[_0x4395('0x2b')](respondWithFilteredResult(_0x106e77,_0x4d046f))[_0x4395('0xb5')](handleError(_0x106e77,null));};exports[_0x4395('0xc4')]=function(_0x5c4d8d,_0x62e0a2,_0x45d96a){return db['OpenchannelInteraction']['find']({'where':{'id':_0x5c4d8d['params']['id']}})['then'](handleEntityNotFound(_0x62e0a2,null))['then'](function(_0x11fdef){if(_0x11fdef){return _0x11fdef[_0x4395('0xc5')](_0x5c4d8d[_0x4395('0x76')][_0x4395('0xba')],_[_0x4395('0xbb')](_0x5c4d8d[_0x4395('0x76')],['ids','id'])||{})[_0x4395('0xc6')](function(){return db[_0x4395('0xc7')][_0x4395('0xc2')]({'attributes':['id','name',_0x4395('0x4c')],'where':{'id':_0x5c4d8d[_0x4395('0x76')][_0x4395('0xba')]}});})[_0x4395('0x2b')](function(_0x433d3b){socket[_0x4395('0xc8')](_0x4395('0xc9'),{'id':Number(_0x5c4d8d['params']['id']),'tags':_0x433d3b||[]});return{'id':Number(_0x5c4d8d[_0x4395('0xb0')]['id']),'tags':_0x433d3b||[]};});}})[_0x4395('0x2b')](respondWithResult(_0x62e0a2,null))[_0x4395('0xb5')](handleError(_0x62e0a2,null));};exports[_0x4395('0xca')]=function(_0x4df0f4,_0x240d4c,_0x253976){return db[_0x4395('0x9a')]['find']({'where':{'id':_0x4df0f4[_0x4395('0xb0')]['id']}})['then'](handleEntityNotFound(_0x240d4c,null))[_0x4395('0x2b')](function(_0x5631b0){if(_0x5631b0){return _0x5631b0[_0x4395('0xca')](_0x4df0f4[_0x4395('0x3e')][_0x4395('0xba')]);}})['then'](respondWithStatusCode(_0x240d4c,null))[_0x4395('0xb5')](handleError(_0x240d4c,null));};exports[_0x4395('0xcb')]=function(_0x30ae4b,_0x51972f){var _0x26800b=moment()['unix']()[_0x4395('0x97')]();var _0x24f89e=path[_0x4395('0xcc')](config['root'],_0x4395('0xcd'),_0x4395('0xce'),_0x4395('0xcf'));var _0xaed8f4=path[_0x4395('0xcc')](config['root'],_0x4395('0xcd'),'files',_0x4395('0xd0'));var _0x9873f0=path['join'](_0x24f89e,_0x26800b);var _0x3d1a6f=util['format']('transcript-%d-%s.zip',_0x30ae4b[_0x4395('0xb0')]['id'],_0x26800b);var _0x1584d9=path[_0x4395('0xcc')](_0x24f89e,_0x3d1a6f);var _0x10ec23=[];_0x10ec23[_0x4395('0x37')]({'model':db[_0x4395('0x71')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x10ec23[_0x4395('0x37')]({'model':db[_0x4395('0xd1')],'as':_0x4395('0x67'),'attributes':['id','firstName',_0x4395('0xd2')],'raw':!![]});if(_0x30ae4b[_0x4395('0x3e')][_0x4395('0xd0')]){_0x10ec23[_0x4395('0x37')]({'model':db[_0x4395('0xd3')],'as':_0x4395('0xd3'),'raw':!![]});}var _0x1b2fa0=[{'model':db['OpenchannelMessage'],'as':_0x4395('0xd4'),'attributes':['id',_0x4395('0x76'),_0x4395('0x7c'),_0x4395('0xd5'),_0x4395('0xd6'),_0x4395('0x82')],'include':_0x10ec23}];_0x1b2fa0[_0x4395('0x37')]({'model':db[_0x4395('0xd7')],'as':_0x4395('0xd8'),'attributes':['id','name']});_0x1b2fa0[_0x4395('0x37')]({'model':db[_0x4395('0x71')],'as':'Owner','attributes':['id',_0x4395('0x32')]});return db[_0x4395('0x9a')][_0x4395('0x61')]({'where':{'id':_0x30ae4b[_0x4395('0xb0')]['id']},'include':_0x1b2fa0})[_0x4395('0x2b')](handleEntityNotFound(_0x51972f,null))[_0x4395('0x2b')](function(_0x50282c){if(_0x50282c){var _0x17323b=_0x50282c[_0x4395('0xd9')]({'plain':!![]});fs[_0x4395('0xda')](_0x9873f0);var _0x53a35a={'format':'A4','border':_0x4395('0xdb'),'header':{'height':_0x4395('0xdc'),'contents':{'first':_0x4395('0xdd')}},'footer':{'height':'30px','contents':{'default':util[_0x4395('0xc0')](_0x4395('0xde'),util[_0x4395('0xc0')]('%s\x20#%d','Openchannel',_0x17323b['id']),moment()[_0x4395('0xc0')](_0x4395('0xdf'))[_0x4395('0x97')]())}}};var _0x430954={'channel':_0x4395('0xe0'),'account':_0x17323b[_0x4395('0xd8')]['name'],'agent':_0x17323b[_0x4395('0xe1')]?_0x17323b['Owner']['fullname']:_0x4395('0xe2'),'createdAt':moment(_0x17323b[_0x4395('0x7c')])[_0x4395('0xc0')](_0x4395('0xc1'))[_0x4395('0x97')](),'closedAt':_0x17323b[_0x4395('0xe3')]?moment(_0x17323b[_0x4395('0xe4')])[_0x4395('0xc0')](_0x4395('0xc1'))[_0x4395('0x97')]():'','disposition':_0x17323b[_0x4395('0xe5')],'visibility':_0x17323b['threadId']?'Public':_0x4395('0xe6'),'messages':_(_0x17323b[_0x4395('0xd4')])[_0x4395('0xbf')]({'secret':![]})['map'](function(_0x479976){if(_0x479976['Attachment']){var _0x27c05=path[_0x4395('0xcc')](_0xaed8f4,_0x479976[_0x4395('0xd3')][_0x4395('0xe7')]);if(fs[_0x4395('0xe8')](_0x27c05)){fs[_0x4395('0xe9')](_0x27c05)['pipe'](fs[_0x4395('0xea')](path['join'](_0x9873f0,_0x479976[_0x4395('0xd3')][_0x4395('0xe7')])));}}return{'date':moment(_0x479976[_0x4395('0x7c')])[_0x4395('0xc0')](_0x4395('0xc1'))[_0x4395('0x97')](),'sender':_0x479976[_0x4395('0xd5')]===_0x4395('0xeb')?_0x479976[_0x4395('0x71')]?_0x479976[_0x4395('0x71')][_0x4395('0x32')]:_0x4395('0xec'):_0x479976[_0x4395('0x67')][_0x4395('0xed')]+(_0x479976[_0x4395('0x67')]['lastName']?'\x20'+_0x479976['Contact'][_0x4395('0xd2')]:''),'body':_0x479976['Attachment']?_0x479976[_0x4395('0xd3')][_0x4395('0xe7')]:_0x479976[_0x4395('0x76')],'direction':_0x479976[_0x4395('0xd5')]===_0x4395('0xeb')?'A':'C','secret':_0x479976[_0x4395('0xd6')],'read':_0x479976[_0x4395('0x82')],'attachment':_0x479976['Attachment']};})[_0x4395('0x63')]()};return ejs[_0x4395('0xee')](path[_0x4395('0xcc')](config[_0x4395('0xef')],_0x4395('0xcd'),_0x4395('0xf0'),'downloadInteraction.html'),{'interaction':_0x430954})['then'](function(_0x7c48e9){return new BPromise(function(_0x3aa8ed,_0x561ca9){pdf[_0x4395('0xb6')](_0x7c48e9,_0x53a35a)['toFile'](path[_0x4395('0xcc')](_0x9873f0,_0x4395('0xf1')+_0x17323b['id']+'-'+_0x26800b+_0x4395('0xf2')),function(_0x3c2ac1,_0x280d42){if(_0x3c2ac1)return _0x561ca9(_0x3c2ac1);_0x3aa8ed(_0x280d42);});});})[_0x4395('0x2b')](function(){return new BPromise(function(_0x2df85c,_0x5c2a2b){zipdir(_0x9873f0,{'saveTo':_0x1584d9},function(_0xaeb4bc,_0x470ec1){if(_0xaeb4bc)return _0x5c2a2b(_0xaeb4bc);return _0x2df85c(_0x470ec1);});})[_0x4395('0x2b')](function(){return new BPromise(function(_0x389810,_0x1dca27){rimraf(_0x9873f0,function(_0x1d8f27){if(_0x1d8f27)_0x1dca27(_0x1d8f27);return _0x389810();});});})['then'](function(){return _0x51972f[_0x4395('0xcb')](_0x1584d9,_0x3d1a6f,function(_0x4eb6c0){if(_0x4eb6c0){console[_0x4395('0xf3')](_0x4395('0xf4'),_0x4eb6c0);}else{fs[_0x4395('0xf5')](_0x1584d9);}});});});}else{return _0x51972f[_0x4395('0x20')](0xc8);}})[_0x4395('0xb5')](handleError(_0x51972f,null));}; \ No newline at end of file +var _0xee04=['CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','isEmpty','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','read','`unreadMessages`\x20>\x200','tag','isArray','replace','\x27\x27\x27\x27','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','OpenchannelAccountId','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','all','rows','show','params','includeAll','merge','options','create','update','describe','addMessage','ids','omit','OpenchannelInteractionId','filter','YYYY-MM-DD\x20HH:mm:ss','OpenchannelMessage','include','findAll','setTags','spread','Tag','emit','removeTags','download','join','server','tmp','root','files','attachments','format','transcript-%d-%s.zip','CmContact','Contact','lastName','Attachment','Messages','direction','secret','Owner','get','mkdirSync','10px','40px','30px','%s\x20#%d','Openchannel','YYYY-MM-DD','Account','closed','closedAt','disposition','threadId','Public','Private','basename','existsSync','pipe','createWriteStream','System','firstName','out','renderFile','toFile','transcript-','.pdf','log','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','Users','map','fullname','Tags','TagIds','split','forEach','push','catch','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','select','field','color','from','u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','openchannel_interactions','cm_contacts','openchannel_accounts','me.OpenchannelInteractionId\x20=\x20i.id','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','expr','search','sqlOperator','conditions','unreadMessages','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)','find','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xee04,0x16f));var _0x4ee0=function(_0x7dba2c,_0xac375e){_0x7dba2c=_0x7dba2c-0x0;var _0x1c9640=_0xee04[_0x7dba2c];return _0x1c9640;};'use strict';var pdf=require(_0x4ee0('0x0'));var emlformat=require(_0x4ee0('0x1'));var rimraf=require(_0x4ee0('0x2'));var zipdir=require(_0x4ee0('0x3'));var jsonpatch=require(_0x4ee0('0x4'));var rp=require(_0x4ee0('0x5'));var moment=require(_0x4ee0('0x6'));var BPromise=require(_0x4ee0('0x7'));var Mustache=require(_0x4ee0('0x8'));var util=require(_0x4ee0('0x9'));var path=require('path');var sox=require(_0x4ee0('0xa'));var csv=require(_0x4ee0('0xb'));var ejs=require(_0x4ee0('0xc'));var fs=require('fs');var _=require(_0x4ee0('0xd'));var squel=require(_0x4ee0('0xe'));var crypto=require(_0x4ee0('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x4ee0('0x10'));var toCsv=require('to-csv');var querystring=require(_0x4ee0('0x11'));var Papa=require(_0x4ee0('0x12'));var Redis=require(_0x4ee0('0x13'));var authService=require(_0x4ee0('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4ee0('0x15'))(_0x4ee0('0x16'));var utils=require(_0x4ee0('0x17'));var config=require('../../config/environment');var db=require(_0x4ee0('0x18'))['db'];config[_0x4ee0('0x19')]=_['defaults'](config[_0x4ee0('0x19')],{'host':_0x4ee0('0x1a'),'port':0x18eb});var socket=require(_0x4ee0('0x1b'))(new Redis(config[_0x4ee0('0x19')]));require(_0x4ee0('0x1c'))[_0x4ee0('0x1d')](socket);function respondWithStatusCode(_0x16d3a6,_0x5ec786){_0x5ec786=_0x5ec786||0xcc;return function(_0x3236c9){if(_0x3236c9){return _0x16d3a6[_0x4ee0('0x1e')](_0x5ec786);}return _0x16d3a6['status'](_0x5ec786)[_0x4ee0('0x1f')]();};}function respondWithResult(_0x57d928,_0x443ee4){_0x443ee4=_0x443ee4||0xc8;return function(_0x26ff1d){if(_0x26ff1d){return _0x57d928[_0x4ee0('0x20')](_0x443ee4)[_0x4ee0('0x21')](_0x26ff1d);}};}function respondWithFilteredResult(_0x2104d7,_0x15684e){return function(_0x1256d4){if(_0x1256d4){var _0x2522f0=_0x1256d4[_0x4ee0('0x22')],_0x18a8af=_0x15684e['offset'],_0x6b936e=_0x15684e[_0x4ee0('0x23')]+_0x15684e[_0x4ee0('0x24')],_0x18c919;if(_0x6b936e>=_0x2522f0){_0x6b936e=_0x2522f0;_0x18c919=0xc8;}else{_0x18c919=0xce;}_0x2104d7['status'](_0x18c919);return _0x2104d7[_0x4ee0('0x25')](_0x4ee0('0x26'),_0x18a8af+'-'+_0x6b936e+'/'+_0x2522f0)[_0x4ee0('0x21')](_0x1256d4);}return null;};}function patchUpdates(_0x4944ef){return function(_0x37a58b){try{jsonpatch[_0x4ee0('0x27')](_0x37a58b,_0x4944ef,!![]);}catch(_0x59e360){return BPromise[_0x4ee0('0x28')](_0x59e360);}return _0x37a58b[_0x4ee0('0x29')]();};}function saveUpdates(_0x4c1cd0,_0x586548){return function(_0x37ce87){if(_0x37ce87){return _0x37ce87['update'](_0x4c1cd0)['then'](function(_0x3302f2){return _0x3302f2;});}return null;};}function removeEntity(_0xbf12fe,_0x55efa2){return function(_0x4dc6f4){if(_0x4dc6f4){return _0x4dc6f4[_0x4ee0('0x2a')]()[_0x4ee0('0x2b')](function(){_0xbf12fe[_0x4ee0('0x20')](0xcc)[_0x4ee0('0x1f')]();});}};}function handleEntityNotFound(_0x28815f,_0x38e7ce){return function(_0x592610){if(!_0x592610){_0x28815f[_0x4ee0('0x1e')](0x194);}return _0x592610;};}function handleError(_0x5f573f,_0x12390d){_0x12390d=_0x12390d||0x1f4;return function(_0x495c0e){logger[_0x4ee0('0x2c')](_0x495c0e[_0x4ee0('0x2d')]);if(_0x495c0e[_0x4ee0('0x2e')]){delete _0x495c0e[_0x4ee0('0x2e')];}_0x5f573f[_0x4ee0('0x20')](_0x12390d)[_0x4ee0('0x2f')](_0x495c0e);};}function getInteractionUsers(_0x5c1630,_0x5abd61){return new BPromise(function(_0x4c32aa,_0x5c30ab){try{if(_0x5abd61[_0x5c1630['id']]){_0x5c1630[_0x4ee0('0x30')]=_[_0x4ee0('0x31')](_0x5abd61[_0x5c1630['id']],function(_0x11f136){return{'id':_0x11f136['id'],'fullname':_0x11f136[_0x4ee0('0x32')]};});}}catch(_0x3fce79){_0x5c30ab(_0x3fce79);}_0x4c32aa(_0x5c1630);});}function getInteractionTags(_0x57c279,_0x3d922b){return new BPromise(function(_0x15ed63,_0x3a69b1){try{if(_0x57c279['TagIds']){_0x57c279[_0x4ee0('0x33')]=[];_0x57c279[_0x4ee0('0x34')][_0x4ee0('0x35')](',')[_0x4ee0('0x36')](function(_0x8cee9c){_0x57c279[_0x4ee0('0x33')][_0x4ee0('0x37')](_0x3d922b[_0x8cee9c]);});}delete _0x57c279[_0x4ee0('0x34')];}catch(_0x589b57){_0x3a69b1(_0x589b57);}_0x15ed63(_0x57c279);});}function updateOpenchannelInteraction(_0x3205d4,_0x22e24c,_0x481428){return new BPromise(function(_0x37382b,_0x4464a5){return getInteractionUsers(_0x3205d4,_0x481428)[_0x4ee0('0x2b')](function(_0x52cafa){return getInteractionTags(_0x52cafa,_0x22e24c);})[_0x4ee0('0x2b')](function(_0x4b9664){_0x37382b(_0x4b9664);})[_0x4ee0('0x38')](function(_0x1cfdc0){_0x4464a5(_0x1cfdc0);});});}exports[_0x4ee0('0x39')]=function(_0x3fc122,_0x112c5e){var _0x2f6452={},_0x1d894a={},_0x3bf4ac={'count':0x0,'rows':[]};var _0x16f1f7=_[_0x4ee0('0x31')](db[_0x4ee0('0x3a')][_0x4ee0('0x3b')],function(_0x4f004e){return{'name':_0x4f004e[_0x4ee0('0x3c')],'type':_0x4f004e[_0x4ee0('0x3d')][_0x4ee0('0x3e')]};});_0x1d894a[_0x4ee0('0x3f')]=_['map'](_0x16f1f7,_0x4ee0('0x2e'));_0x1d894a[_0x4ee0('0x40')]=_[_0x4ee0('0x41')](_0x3fc122[_0x4ee0('0x40')]);_0x1d894a[_0x4ee0('0x42')]=_[_0x4ee0('0x43')](_0x1d894a['model'],_0x1d894a[_0x4ee0('0x40')]);_0x2f6452[_0x4ee0('0x44')]=_['intersection'](_0x1d894a[_0x4ee0('0x3f')],qs[_0x4ee0('0x45')](_0x3fc122['query'][_0x4ee0('0x45')]));_0x2f6452[_0x4ee0('0x44')]=_0x2f6452['attributes'][_0x4ee0('0x46')]?_0x2f6452['attributes']:_0x1d894a[_0x4ee0('0x3f')];if(!_0x3fc122[_0x4ee0('0x40')][_0x4ee0('0x47')]('nolimit')){_0x2f6452[_0x4ee0('0x24')]=qs[_0x4ee0('0x24')](_0x3fc122[_0x4ee0('0x40')][_0x4ee0('0x24')]);_0x2f6452[_0x4ee0('0x23')]=qs[_0x4ee0('0x23')](_0x3fc122[_0x4ee0('0x40')][_0x4ee0('0x23')]);}_0x2f6452['order']=qs['sort'](_0x3fc122['query'][_0x4ee0('0x48')]);_0x2f6452['where']=qs[_0x4ee0('0x42')](_[_0x4ee0('0x49')](_0x3fc122[_0x4ee0('0x40')],_0x1d894a[_0x4ee0('0x42')]),_0x16f1f7);var _0x47a7b4=[];var _0x25687a=squel[_0x4ee0('0x4a')]()['field']('id')[_0x4ee0('0x4b')](_0x4ee0('0x2e'))['field'](_0x4ee0('0x4c'))[_0x4ee0('0x4d')]('tools_tags');var _0x21e0d1=squel['select']()[_0x4ee0('0x4b')](_0x4ee0('0x4e'))[_0x4ee0('0x4b')](_0x4ee0('0x4f'))[_0x4ee0('0x4b')](_0x4ee0('0x50'))[_0x4ee0('0x4d')](_0x4ee0('0x51'),'ui')[_0x4ee0('0x52')](_0x4ee0('0x53'),'u','u.id\x20=\x20ui.UserId');var _0x1e9278=squel[_0x4ee0('0x4a')]()['from'](_0x4ee0('0x54'),'i')[_0x4ee0('0x52')](_0x4ee0('0x55'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x4ee0('0x52')](_0x4ee0('0x53'),'o','o.id\x20=\x20i.UserId')[_0x4ee0('0x52')](_0x4ee0('0x56'),'a','a.id\x20=\x20i.OpenchannelAccountId')[_0x4ee0('0x52')]('openchannel_messages','me',_0x4ee0('0x57'))[_0x4ee0('0x52')]('openchannel_interaction_has_tags','it',_0x4ee0('0x58'))[_0x4ee0('0x52')](_0x4ee0('0x59'),'t','t.id\x20=\x20it.TagId');var _0x14447f=squel[_0x4ee0('0x5a')]();var _0x2d23fa=[];var _0x1edc3a=squel[_0x4ee0('0x5a')]();var _0x51cf8b;if(_0x3fc122[_0x4ee0('0x40')]['search']){_0x51cf8b=as['parseSearch'](_0x3fc122['query'][_0x4ee0('0x5b')]);var _0x251a4f=_0x51cf8b[_0x4ee0('0x5c')];for(var _0x4777cc=0x0;_0x4777cc<_0x51cf8b['conditions'][_0x4ee0('0x46')];_0x4777cc++){var _0x5acdf3=_0x51cf8b[_0x4ee0('0x5d')][_0x4777cc];var _0x38ceb3='i';var _0x3b9cca=_['find'](_0x16f1f7,[_0x4ee0('0x2e'),_0x5acdf3[_0x4ee0('0x4b')]]);if(!_0x3b9cca){switch(_0x5acdf3[_0x4ee0('0x4b')]){case _0x4ee0('0x5e'):if(_0x5acdf3[_0x4ee0('0x5f')]==0x1){_0x1e9278[_0x4ee0('0x60')]('`'+_0x5acdf3[_0x4ee0('0x4b')]+_0x4ee0('0x61'));}else{_0x1e9278[_0x4ee0('0x60')]('`'+_0x5acdf3[_0x4ee0('0x4b')]+'`\x20>\x200');}break;case'Contact':if(_0x5acdf3[_0x4ee0('0x62')]===_0x4ee0('0x63')){if(_0x5acdf3[_0x4ee0('0x5f')]['split']('\x20')[_0x4ee0('0x46')]>0x1){_0x14447f[_0x251a4f](_0x4ee0('0x64'),qs['getFullTextValue'](_0x5acdf3[_0x4ee0('0x5f')]),null);}else{var _0x54f267='%'+_0x5acdf3['value']+'%';_0x14447f[_0x251a4f]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x54f267,_0x54f267,_0x54f267);}}else{_0x3b9cca=_[_0x4ee0('0x65')](_0x16f1f7,['name','ContactId']);_0x5acdf3[_0x4ee0('0x4b')]=_0x4ee0('0x66');_0x1bf0cd=as[_0x4ee0('0x67')](_0x38ceb3,_0x3b9cca[_0x4ee0('0x3d')],_0x5acdf3);_0x14447f[_0x251a4f](_0x1bf0cd[_0x4ee0('0x68')],_0x1bf0cd['value'][_0x4ee0('0x69')],_0x1bf0cd[_0x4ee0('0x5f')]['end']);}break;case'Tag':var _0x3e3dba=_0x5acdf3['value'][_0x4ee0('0x35')](',')['map'](function(_0x170e4d){return Number(_0x170e4d);});_0x3e3dba[_0x4ee0('0x36')](function(_0x1eb786){_0x1edc3a['or'](_0x4ee0('0x6a'),'%,'+_0x1eb786+',%');});_0x2d23fa=_[_0x4ee0('0x6b')](_0x2d23fa,_0x3e3dba);break;case _0x4ee0('0x6c'):if(_0x5acdf3[_0x4ee0('0x62')]==='$substring'){_0x14447f[_0x251a4f](_0x4ee0('0x6d'),'%'+_0x5acdf3[_0x4ee0('0x5f')]+'%',null);}else{_0x3b9cca=_['find'](_0x16f1f7,[_0x4ee0('0x2e'),_0x4ee0('0x6e')]);_0x5acdf3[_0x4ee0('0x4b')]=_0x4ee0('0x6e');_0x1bf0cd=as[_0x4ee0('0x67')](_0x38ceb3,_0x3b9cca[_0x4ee0('0x3d')],_0x5acdf3);_0x14447f[_0x251a4f](_0x1bf0cd[_0x4ee0('0x68')],_0x1bf0cd[_0x4ee0('0x5f')][_0x4ee0('0x69')],_0x1bf0cd[_0x4ee0('0x5f')][_0x4ee0('0x1f')]);}break;case _0x4ee0('0x6f'):_0x1bf0cd=as[_0x4ee0('0x67')]('me',null,_0x5acdf3);_0x14447f[_0x251a4f](_0x1bf0cd[_0x4ee0('0x68')],_0x1bf0cd[_0x4ee0('0x5f')]['start'],_0x1bf0cd[_0x4ee0('0x5f')]['end']);break;}}else{var _0x1bf0cd=as['buildExpression'](_0x38ceb3,_0x3b9cca['type'],_0x5acdf3);_0x14447f[_0x251a4f](_0x1bf0cd[_0x4ee0('0x68')],_0x1bf0cd[_0x4ee0('0x5f')]['start'],_0x1bf0cd[_0x4ee0('0x5f')][_0x4ee0('0x1f')]);}}}else{var _0xd52f9b=_(_0x3fc122[_0x4ee0('0x40')])['keys']()[_0x4ee0('0x31')](function(_0x4a997c){return _[_0x4ee0('0x70')](_0x16f1f7,[_0x4ee0('0x2e'),_0x4a997c])?_0x4a997c:undefined;})['compact']()[_0x4ee0('0x5f')]();if(!_[_0x4ee0('0x71')](_0xd52f9b)){_0xd52f9b[_0x4ee0('0x36')](function(_0x161869){if(_0x161869==='OpenchannelAccountId'){_0x1e9278['where'](_0x4ee0('0x72'),[][_0x4ee0('0x73')](_0x3fc122['query'][_0x161869]));}else if(_0x161869===_0x4ee0('0x74')){var _0xe4379d=JSON[_0x4ee0('0x75')](_0x3fc122[_0x4ee0('0x40')][_0x161869])[_0x4ee0('0x76')];var _0x4187d1=JSON[_0x4ee0('0x75')](_0x3fc122[_0x4ee0('0x40')][_0x161869])['$lte'];_0x1e9278[_0x4ee0('0x77')](_0x4ee0('0x78'),_0xe4379d,_0x4187d1);}else{if(_0x3fc122[_0x4ee0('0x40')][_0x161869]===_0x4ee0('0x79')){_0x1e9278[_0x4ee0('0x77')]('i.'+_0x161869+'\x20IS\x20NULL');}else{_0x1e9278[_0x4ee0('0x77')]('i.'+_0x161869+'\x20=\x20?',_0x3fc122[_0x4ee0('0x40')][_0x161869]);}}});}if(_0x3fc122[_0x4ee0('0x40')][_0x4ee0('0x7a')]){if(_0x3fc122['query'][_0x4ee0('0x7a')]==0x1){_0x1e9278[_0x4ee0('0x60')]('`unreadMessages`\x20=\x200');}else{_0x1e9278[_0x4ee0('0x60')](_0x4ee0('0x7b'));}}if(_0x3fc122[_0x4ee0('0x40')][_0x4ee0('0x7c')]){_0x2d23fa=_[_0x4ee0('0x7d')](_0x3fc122[_0x4ee0('0x40')]['tag'])?_0x3fc122[_0x4ee0('0x40')][_0x4ee0('0x7c')]:new Array(_0x3fc122[_0x4ee0('0x40')][_0x4ee0('0x7c')]);_0x2d23fa['forEach'](function(_0x4f5a6f){_0x1edc3a['or'](_0x4ee0('0x6a'),'%,'+_0x4f5a6f+',%');});}if(_0x3fc122['query']['filter']){var _0x1002f8=_0x3fc122[_0x4ee0('0x40')]['filter'][_0x4ee0('0x7e')]('\x5c','\x5c\x5c')[_0x4ee0('0x7e')]('\x27\x27',_0x4ee0('0x7f'));if(qs['isNumeric'](_0x1002f8)){_0x14447f['or']('i.id\x20LIKE\x20?',_0x1002f8+'%');}else{_0x14447f['or'](_0x4ee0('0x80'),qs[_0x4ee0('0x81')](_0x1002f8))['or'](_0x4ee0('0x82'),_0x1002f8+'%')['or'](_0x4ee0('0x83'),_0x1002f8+'%');}}}_0x1e9278['where'](_0x14447f);_0x1e9278[_0x4ee0('0x84')]('i.id');var _0x4ea6e3={'type':db[_0x4ee0('0x85')][_0x4ee0('0x86')][_0x4ee0('0x87')],'raw':!![]};var _0x33094c=_0x1e9278[_0x4ee0('0x88')]();_0x33094c[_0x4ee0('0x4b')]('i.id');_0x33094c[_0x4ee0('0x4b')](_0x4ee0('0x89'),_0x4ee0('0x5e'));if(_0x2f6452[_0x4ee0('0x8a')]){_0x2f6452[_0x4ee0('0x8a')][_0x4ee0('0x36')](function(_0x4448ae){_0x1e9278[_0x4ee0('0x8a')]('i.'+_0x4448ae[0x0],_0x4448ae[0x1]===_0x4ee0('0x8b')?![]:!![]);});}if(!_['isEmpty'](_0x2d23fa)){_0x1e9278[_0x4ee0('0x60')](_0x1edc3a);_0x33094c[_0x4ee0('0x77')]('t.id\x20IN\x20?',_0x2d23fa);}BPromise['resolve']()[_0x4ee0('0x2b')](function(){if(!_0x51cf8b){if(_0x3fc122[_0x4ee0('0x40')][_0x4ee0('0x8c')]||_0x3fc122[_0x4ee0('0x40')][_0x4ee0('0x8d')])return;_0x33094c['where'](_0x4ee0('0x8e'));_0x1e9278['where'](_0x4ee0('0x8e'));return;}return _0x3fc122[_0x4ee0('0x8f')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0x4ee0('0x2b')](function(_0x3e4ec4){if(_[_0x4ee0('0x71')](_0x3e4ec4)){_0x33094c[_0x4ee0('0x77')]('i.OpenchannelAccountId\x20IS\x20NULL');_0x1e9278[_0x4ee0('0x77')](_0x4ee0('0x90'));}else{_0x33094c[_0x4ee0('0x77')]('i.OpenchannelAccountId\x20IN\x20?',_[_0x4ee0('0x31')](_0x3e4ec4,'id'));_0x1e9278[_0x4ee0('0x77')](_0x4ee0('0x72'),_[_0x4ee0('0x31')](_0x3e4ec4,'id'));}});})[_0x4ee0('0x2b')](function(){db[_0x4ee0('0x91')][_0x4ee0('0x40')](_0x33094c[_0x4ee0('0x92')](),_0x4ea6e3)[_0x4ee0('0x2b')](function(_0x4b7794){_0x3bf4ac[_0x4ee0('0x22')]=_0x4b7794[_0x4ee0('0x46')];if(_0x3bf4ac[_0x4ee0('0x22')]===0x0)return[];return db['sequelize'][_0x4ee0('0x40')](_0x25687a['toString'](),_0x4ea6e3)[_0x4ee0('0x2b')](function(_0x54ef7a){_0x47a7b4=_[_0x4ee0('0x93')](_0x54ef7a,'id');_0x4ea6e3=_['merge'](_0x4ea6e3,{'model':db[_0x4ee0('0x3a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3fc122[_0x4ee0('0x40')][_0x4ee0('0x45')]){_0x2f6452[_0x4ee0('0x44')][_0x4ee0('0x36')](function(_0x490c9d){_0x1e9278[_0x4ee0('0x4b')]('i.'+_0x490c9d);});}else{_0x1e9278['field'](_0x4ee0('0x89'),_0x4ee0('0x5e'));_0x1e9278['field'](_0x4ee0('0x94'),_0x4ee0('0x95'));_0x1e9278[_0x4ee0('0x4b')](_0x4ee0('0x96'),_0x4ee0('0x97'));_0x1e9278['field'](_0x4ee0('0x98'));_0x1e9278[_0x4ee0('0x4b')](_0x4ee0('0x99'),_0x4ee0('0x9a'));_0x1e9278[_0x4ee0('0x4b')](_0x4ee0('0x9b'),_0x4ee0('0x9c'));_0x1e9278[_0x4ee0('0x4b')](_0x4ee0('0x9d'),'Contact.email');_0x1e9278[_0x4ee0('0x4b')](_0x4ee0('0x9e'),_0x4ee0('0x9f'));_0x1e9278['field']('c.mobile',_0x4ee0('0xa0'));_0x1e9278['field'](_0x4ee0('0xa1'),_0x4ee0('0xa2'));_0x1e9278[_0x4ee0('0x4b')](_0x4ee0('0xa3'),'Owner.fullname');_0x1e9278['field'](_0x4ee0('0xa4'),_0x4ee0('0xa5'));_0x1e9278[_0x4ee0('0x4b')](_0x4ee0('0xa6'),'TagIds');}if(_0x2f6452[_0x4ee0('0x24')])_0x1e9278['limit'](_0x2f6452[_0x4ee0('0x24')]);if(_0x2f6452['offset'])_0x1e9278['offset'](_0x2f6452[_0x4ee0('0x23')]);return db[_0x4ee0('0x91')][_0x4ee0('0x40')](_0x1e9278[_0x4ee0('0x92')](),_0x4ea6e3);})[_0x4ee0('0x2b')](function(_0x2f3051){_0x21e0d1[_0x4ee0('0x77')](_0x4ee0('0xa7'),_[_0x4ee0('0x31')](_0x2f3051,'id'));return db[_0x4ee0('0x91')][_0x4ee0('0x40')](_0x21e0d1[_0x4ee0('0x92')](),_0x4ea6e3)[_0x4ee0('0x2b')](function(_0x497f60){var _0x3da678=_[_0x4ee0('0xa8')](_0x497f60,'OpenchannelInteractionId');var _0x16e8b7=[];_0x2f3051['forEach'](function(_0x6306d){_0x16e8b7['push'](updateOpenchannelInteraction(_0x6306d,_0x47a7b4,_0x3da678));});return BPromise[_0x4ee0('0xa9')](_0x16e8b7);});});})['then'](function(_0x4b0153){_0x3bf4ac[_0x4ee0('0xaa')]=_0x4b0153;return _0x3bf4ac;})[_0x4ee0('0x2b')](respondWithFilteredResult(_0x112c5e,_0x2f6452));})[_0x4ee0('0x38')](handleError(_0x112c5e,null));};exports[_0x4ee0('0xab')]=function(_0xbe5207,_0x158122){var _0x273c64={'raw':![],'where':{'id':_0xbe5207[_0x4ee0('0xac')]['id']}},_0x1653a5={};_0x1653a5[_0x4ee0('0x3f')]=_[_0x4ee0('0x41')](db[_0x4ee0('0x3a')][_0x4ee0('0x3b')]);_0x1653a5['query']=_[_0x4ee0('0x41')](_0xbe5207[_0x4ee0('0x40')]);_0x1653a5[_0x4ee0('0x42')]=_['intersection'](_0x1653a5[_0x4ee0('0x3f')],_0x1653a5[_0x4ee0('0x40')]);_0x273c64[_0x4ee0('0x44')]=_[_0x4ee0('0x43')](_0x1653a5[_0x4ee0('0x3f')],qs[_0x4ee0('0x45')](_0xbe5207[_0x4ee0('0x40')][_0x4ee0('0x45')]));_0x273c64[_0x4ee0('0x44')]=_0x273c64[_0x4ee0('0x44')][_0x4ee0('0x46')]?_0x273c64[_0x4ee0('0x44')]:_0x1653a5['model'];if(_0xbe5207[_0x4ee0('0x40')][_0x4ee0('0xad')]){_0x273c64['include']=[{'all':!![]}];}_0x273c64=_[_0x4ee0('0xae')]({},_0x273c64,_0xbe5207[_0x4ee0('0xaf')]);return db[_0x4ee0('0x3a')][_0x4ee0('0x65')](_0x273c64)[_0x4ee0('0x2b')](handleEntityNotFound(_0x158122,null))[_0x4ee0('0x2b')](respondWithResult(_0x158122,null))[_0x4ee0('0x38')](handleError(_0x158122,null));};exports[_0x4ee0('0xb0')]=function(_0x22ec93,_0x10c86a){return db[_0x4ee0('0x3a')][_0x4ee0('0xb0')](_0x22ec93[_0x4ee0('0x6f')],{})[_0x4ee0('0x2b')](respondWithResult(_0x10c86a,0xc9))[_0x4ee0('0x38')](handleError(_0x10c86a,null));};exports[_0x4ee0('0xb1')]=function(_0x280033,_0x25efd6){if(_0x280033[_0x4ee0('0x6f')]['id']){delete _0x280033[_0x4ee0('0x6f')]['id'];}return db['OpenchannelInteraction'][_0x4ee0('0x65')]({'where':{'id':_0x280033[_0x4ee0('0xac')]['id']}})[_0x4ee0('0x2b')](handleEntityNotFound(_0x25efd6,null))[_0x4ee0('0x2b')](saveUpdates(_0x280033[_0x4ee0('0x6f')],null))[_0x4ee0('0x2b')](respondWithResult(_0x25efd6,null))[_0x4ee0('0x38')](handleError(_0x25efd6,null));};exports[_0x4ee0('0x2a')]=function(_0x4cbce1,_0x30dd4d){return db[_0x4ee0('0x3a')][_0x4ee0('0x65')]({'where':{'id':_0x4cbce1[_0x4ee0('0xac')]['id']}})['then'](handleEntityNotFound(_0x30dd4d,null))['then'](removeEntity(_0x30dd4d,null))['catch'](handleError(_0x30dd4d,null));};exports[_0x4ee0('0xb2')]=function(_0x418550,_0x15d10b){return db[_0x4ee0('0x3a')][_0x4ee0('0xb2')]()[_0x4ee0('0x2b')](respondWithResult(_0x15d10b,null))[_0x4ee0('0x38')](handleError(_0x15d10b,null));};exports[_0x4ee0('0xb3')]=function(_0x2d823e,_0x52047c,_0x362cc1){return db['OpenchannelMessage']['find']({'where':{'id':_0x2d823e['params']['id']}})['then'](handleEntityNotFound(_0x52047c,null))[_0x4ee0('0x2b')](function(_0x5a2ca4){if(_0x5a2ca4){return _0x5a2ca4['addMessage'](_0x2d823e[_0x4ee0('0x6f')][_0x4ee0('0xb4')],_[_0x4ee0('0xb5')](_0x2d823e[_0x4ee0('0x6f')],[_0x4ee0('0xb4'),'id'])||{});}})['then'](respondWithResult(_0x52047c,null))[_0x4ee0('0x38')](handleError(_0x52047c,null));};exports['getMessages']=function(_0x168d97,_0x579dc9,_0xf049ed){var _0x282d39={'raw':![],'where':{}};var _0x28491e={};var _0x4d02ed={'count':0x0,'rows':[]};return db[_0x4ee0('0x3a')]['findOne']({'where':{'id':_0x168d97[_0x4ee0('0xac')]['id']}})[_0x4ee0('0x2b')](handleEntityNotFound(_0x579dc9,null))[_0x4ee0('0x2b')](function(_0x39b2bd){if(_0x39b2bd){_0x28491e[_0x4ee0('0x3f')]=_[_0x4ee0('0x41')](db['OpenchannelMessage'][_0x4ee0('0x3b')]);_0x28491e[_0x4ee0('0x40')]=_[_0x4ee0('0x41')](_0x168d97['query']);_0x28491e['filters']=_[_0x4ee0('0x43')](_0x28491e[_0x4ee0('0x3f')],_0x28491e[_0x4ee0('0x40')]);_0x282d39[_0x4ee0('0x44')]=_['intersection'](_0x28491e[_0x4ee0('0x3f')],qs['fields'](_0x168d97['query']['fields']));_0x282d39[_0x4ee0('0x44')]=_0x282d39[_0x4ee0('0x44')][_0x4ee0('0x46')]?_0x282d39[_0x4ee0('0x44')]:_0x28491e[_0x4ee0('0x3f')];if(!_0x168d97[_0x4ee0('0x40')][_0x4ee0('0x47')]('nolimit')){_0x282d39[_0x4ee0('0x24')]=qs[_0x4ee0('0x24')](_0x168d97[_0x4ee0('0x40')][_0x4ee0('0x24')]);_0x282d39[_0x4ee0('0x23')]=qs['offset'](_0x168d97['query'][_0x4ee0('0x23')]);}_0x282d39[_0x4ee0('0x8a')]=qs['sort'](_0x168d97[_0x4ee0('0x40')][_0x4ee0('0x48')]);_0x282d39[_0x4ee0('0x77')]=qs[_0x4ee0('0x42')](_[_0x4ee0('0x49')](_0x168d97['query'],_0x28491e[_0x4ee0('0x42')]));_0x282d39[_0x4ee0('0x77')][_0x4ee0('0xb6')]=_0x39b2bd['id'];if(_0x168d97[_0x4ee0('0x40')][_0x4ee0('0xb7')]){_0x282d39[_0x4ee0('0x77')]=_['merge'](_0x282d39[_0x4ee0('0x77')],{'$or':_[_0x4ee0('0x31')](_0x282d39['attributes'],function(_0x1df66e){var _0x2e0be4={};_0x2e0be4[_0x1df66e]={'$like':'%'+_0x168d97[_0x4ee0('0x40')]['filter']+'%'};return _0x2e0be4;})});}if(_0x168d97[_0x4ee0('0x40')][_0x4ee0('0x76')]){var _0x55594d=_0x168d97[_0x4ee0('0x40')]['$gte'][_0x4ee0('0x35')](',');var _0x1cd2b4={};_0x1cd2b4[_0x55594d[0x0]]={'$gte':moment(_0x55594d[0x1])['format'](_0x4ee0('0xb8'))};_0x282d39[_0x4ee0('0x77')]=_[_0x4ee0('0xae')](_0x282d39[_0x4ee0('0x77')],_0x1cd2b4);}_0x282d39=_[_0x4ee0('0xae')]({},_0x282d39,_0x168d97['options']);return db[_0x4ee0('0xb9')][_0x4ee0('0x22')]({'where':_0x282d39[_0x4ee0('0x77')]})[_0x4ee0('0x2b')](function(_0x3a129d){_0x4d02ed[_0x4ee0('0x22')]=_0x3a129d;if(_0x168d97[_0x4ee0('0x40')][_0x4ee0('0xad')]){_0x282d39[_0x4ee0('0xba')]=[{'all':!![]}];}return db[_0x4ee0('0xb9')][_0x4ee0('0xbb')](_0x282d39);})[_0x4ee0('0x2b')](function(_0x199f3c){_0x4d02ed[_0x4ee0('0xaa')]=_0x199f3c;return _0x4d02ed;});}})['then'](respondWithFilteredResult(_0x579dc9,_0x282d39))[_0x4ee0('0x38')](handleError(_0x579dc9,null));};exports['addTags']=function(_0x1a20b8,_0x7cf521,_0x5e6887){return db[_0x4ee0('0x3a')][_0x4ee0('0x65')]({'where':{'id':_0x1a20b8[_0x4ee0('0xac')]['id']}})[_0x4ee0('0x2b')](handleEntityNotFound(_0x7cf521,null))[_0x4ee0('0x2b')](function(_0x55a50e){if(_0x55a50e){return _0x55a50e[_0x4ee0('0xbc')](_0x1a20b8['body'][_0x4ee0('0xb4')],_[_0x4ee0('0xb5')](_0x1a20b8[_0x4ee0('0x6f')],['ids','id'])||{})[_0x4ee0('0xbd')](function(){return db[_0x4ee0('0xbe')][_0x4ee0('0xbb')]({'attributes':['id',_0x4ee0('0x2e'),'color'],'where':{'id':_0x1a20b8['body']['ids']}});})[_0x4ee0('0x2b')](function(_0x139bcc){socket[_0x4ee0('0xbf')]('openchannelInteractionTags:save',{'id':Number(_0x1a20b8[_0x4ee0('0xac')]['id']),'tags':_0x139bcc||[]});return{'id':Number(_0x1a20b8[_0x4ee0('0xac')]['id']),'tags':_0x139bcc||[]};});}})[_0x4ee0('0x2b')](respondWithResult(_0x7cf521,null))[_0x4ee0('0x38')](handleError(_0x7cf521,null));};exports[_0x4ee0('0xc0')]=function(_0x492fbd,_0x3b68c3,_0x288849){return db[_0x4ee0('0x3a')]['find']({'where':{'id':_0x492fbd[_0x4ee0('0xac')]['id']}})[_0x4ee0('0x2b')](handleEntityNotFound(_0x3b68c3,null))[_0x4ee0('0x2b')](function(_0x414dc3){if(_0x414dc3){return _0x414dc3[_0x4ee0('0xc0')](_0x492fbd['query']['ids']);}})[_0x4ee0('0x2b')](respondWithStatusCode(_0x3b68c3,null))[_0x4ee0('0x38')](handleError(_0x3b68c3,null));};exports[_0x4ee0('0xc1')]=function(_0x4b2d40,_0x298adf){var _0x4738c8=moment()['unix']()[_0x4ee0('0x92')]();var _0x31b18c=path[_0x4ee0('0xc2')](config['root'],_0x4ee0('0xc3'),'files',_0x4ee0('0xc4'));var _0x5b4302=path[_0x4ee0('0xc2')](config[_0x4ee0('0xc5')],_0x4ee0('0xc3'),_0x4ee0('0xc6'),_0x4ee0('0xc7'));var _0x44faf8=path[_0x4ee0('0xc2')](_0x31b18c,_0x4738c8);var _0xc34cd8=util[_0x4ee0('0xc8')](_0x4ee0('0xc9'),_0x4b2d40[_0x4ee0('0xac')]['id'],_0x4738c8);var _0x235f4a=path[_0x4ee0('0xc2')](_0x31b18c,_0xc34cd8);var _0x34e7ae=[];_0x34e7ae[_0x4ee0('0x37')]({'model':db['User'],'as':'User','attributes':['id',_0x4ee0('0x32')],'raw':!![]});_0x34e7ae['push']({'model':db[_0x4ee0('0xca')],'as':_0x4ee0('0xcb'),'attributes':['id','firstName',_0x4ee0('0xcc')],'raw':!![]});if(_0x4b2d40[_0x4ee0('0x40')]['attachments']){_0x34e7ae['push']({'model':db[_0x4ee0('0xcd')],'as':_0x4ee0('0xcd'),'raw':!![]});}var _0x10b314=[{'model':db[_0x4ee0('0xb9')],'as':_0x4ee0('0xce'),'attributes':['id',_0x4ee0('0x6f'),'createdAt',_0x4ee0('0xcf'),_0x4ee0('0xd0'),_0x4ee0('0x7a')],'include':_0x34e7ae}];_0x10b314[_0x4ee0('0x37')]({'model':db['OpenchannelAccount'],'as':'Account','attributes':['id',_0x4ee0('0x2e')]});_0x10b314[_0x4ee0('0x37')]({'model':db[_0x4ee0('0x6c')],'as':_0x4ee0('0xd1'),'attributes':['id',_0x4ee0('0x32')]});return db[_0x4ee0('0x3a')]['find']({'where':{'id':_0x4b2d40[_0x4ee0('0xac')]['id']},'include':_0x10b314})['then'](handleEntityNotFound(_0x298adf,null))[_0x4ee0('0x2b')](function(_0x56ca56){if(_0x56ca56){var _0x50e7b4=_0x56ca56[_0x4ee0('0xd2')]({'plain':!![]});fs[_0x4ee0('0xd3')](_0x44faf8);var _0x15c8f8={'format':'A4','border':_0x4ee0('0xd4'),'header':{'height':_0x4ee0('0xd5'),'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':_0x4ee0('0xd6'),'contents':{'default':util[_0x4ee0('0xc8')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\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[_0x4ee0('0xc8')](_0x4ee0('0xd7'),_0x4ee0('0xd8'),_0x50e7b4['id']),moment()['format'](_0x4ee0('0xd9'))[_0x4ee0('0x92')]())}}};var _0x30507d={'channel':'Openchannel','account':_0x50e7b4[_0x4ee0('0xda')]['name'],'agent':_0x50e7b4[_0x4ee0('0xd1')]?_0x50e7b4[_0x4ee0('0xd1')][_0x4ee0('0x32')]:'N.A.','createdAt':moment(_0x50e7b4[_0x4ee0('0x74')])[_0x4ee0('0xc8')](_0x4ee0('0xb8'))[_0x4ee0('0x92')](),'closedAt':_0x50e7b4[_0x4ee0('0xdb')]?moment(_0x50e7b4[_0x4ee0('0xdc')])[_0x4ee0('0xc8')]('YYYY-MM-DD\x20HH:mm:ss')[_0x4ee0('0x92')]():'','disposition':_0x50e7b4[_0x4ee0('0xdd')],'visibility':_0x50e7b4[_0x4ee0('0xde')]?_0x4ee0('0xdf'):_0x4ee0('0xe0'),'messages':_(_0x50e7b4[_0x4ee0('0xce')])[_0x4ee0('0xb7')]({'secret':![]})[_0x4ee0('0x31')](function(_0x3c71ff){if(_0x3c71ff['Attachment']){var _0x277521=path[_0x4ee0('0xc2')](_0x5b4302,_0x3c71ff[_0x4ee0('0xcd')][_0x4ee0('0xe1')]);if(fs[_0x4ee0('0xe2')](_0x277521)){fs['createReadStream'](_0x277521)[_0x4ee0('0xe3')](fs[_0x4ee0('0xe4')](path[_0x4ee0('0xc2')](_0x44faf8,_0x3c71ff[_0x4ee0('0xcd')][_0x4ee0('0xe1')])));}}return{'date':moment(_0x3c71ff[_0x4ee0('0x74')])['format'](_0x4ee0('0xb8'))['toString'](),'sender':_0x3c71ff['direction']==='out'?_0x3c71ff[_0x4ee0('0x6c')]?_0x3c71ff[_0x4ee0('0x6c')][_0x4ee0('0x32')]:_0x4ee0('0xe5'):_0x3c71ff[_0x4ee0('0xcb')][_0x4ee0('0xe6')]+(_0x3c71ff[_0x4ee0('0xcb')][_0x4ee0('0xcc')]?'\x20'+_0x3c71ff[_0x4ee0('0xcb')][_0x4ee0('0xcc')]:''),'body':_0x3c71ff[_0x4ee0('0xcd')]?_0x3c71ff['Attachment'][_0x4ee0('0xe1')]:_0x3c71ff['body'],'direction':_0x3c71ff[_0x4ee0('0xcf')]===_0x4ee0('0xe7')?'A':'C','secret':_0x3c71ff[_0x4ee0('0xd0')],'read':_0x3c71ff[_0x4ee0('0x7a')],'attachment':_0x3c71ff[_0x4ee0('0xcd')]};})[_0x4ee0('0x5f')]()};return ejs[_0x4ee0('0xe8')](path[_0x4ee0('0xc2')](config[_0x4ee0('0xc5')],_0x4ee0('0xc3'),'views','downloadInteraction.html'),{'interaction':_0x30507d})[_0x4ee0('0x2b')](function(_0x14c32a){return new BPromise(function(_0x271eb0,_0x1ed919){pdf[_0x4ee0('0xb0')](_0x14c32a,_0x15c8f8)[_0x4ee0('0xe9')](path[_0x4ee0('0xc2')](_0x44faf8,_0x4ee0('0xea')+_0x50e7b4['id']+'-'+_0x4738c8+_0x4ee0('0xeb')),function(_0x4ddded,_0x50d7a9){if(_0x4ddded)return _0x1ed919(_0x4ddded);_0x271eb0(_0x50d7a9);});});})[_0x4ee0('0x2b')](function(){return new BPromise(function(_0x493ee9,_0x24ccf0){zipdir(_0x44faf8,{'saveTo':_0x235f4a},function(_0x509ca2,_0x19c8bb){if(_0x509ca2)return _0x24ccf0(_0x509ca2);return _0x493ee9(_0x19c8bb);});})[_0x4ee0('0x2b')](function(){return new BPromise(function(_0x2f7afc,_0xecd0a8){rimraf(_0x44faf8,function(_0x6207db){if(_0x6207db)_0xecd0a8(_0x6207db);return _0x2f7afc();});});})[_0x4ee0('0x2b')](function(){return _0x298adf[_0x4ee0('0xc1')](_0x235f4a,_0xc34cd8,function(_0x36e3c2){if(_0x36e3c2){console[_0x4ee0('0xec')]('err',_0x36e3c2);}else{fs[_0x4ee0('0xed')](_0x235f4a);}});});});}else{return _0x298adf[_0x4ee0('0x1e')](0xc8);}})['catch'](handleError(_0x298adf,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index ac1df77..b6664cc 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 _0xa6ae=['map','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','save','update','remove','getUsers','then','Users'];(function(_0x375eed,_0xb07660){var _0x204c21=function(_0x3748d7){while(--_0x3748d7){_0x375eed['push'](_0x375eed['shift']());}};_0x204c21(++_0xb07660);}(_0xa6ae,0x91));var _0xea6a=function(_0x59f1e6,_0xda13c5){_0x59f1e6=_0x59f1e6-0x0;var _0x2aada5=_0xa6ae[_0x59f1e6];return _0x2aada5;};'use strict';var EventEmitter=require(_0xea6a('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0xea6a('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xea6a('0x2'),'afterUpdate':_0xea6a('0x3'),'afterDestroy':_0xea6a('0x4')};function emitEvent(_0x487fb1){return function(_0xbdcf7a,_0x3a105c,_0x6ca25){_0xbdcf7a[_0xea6a('0x5')]({'attributes':['id'],'raw':!![]})[_0xea6a('0x6')](function(_0x39fde4){_0xbdcf7a['setDataValue'](_0xea6a('0x7'),_0x39fde4[_0xea6a('0x8')](function(_0x123a45){return{'id':_0x123a45['id']};}));return OpenchannelMessage[_0xea6a('0x9')]({'where':{'OpenchannelInteractionId':_0xbdcf7a['id'],'direction':'in','read':![]},'raw':!![]});})[_0xea6a('0x6')](function(_0x4339d0){_0xbdcf7a[_0xea6a('0xa')](_0xea6a('0xb'),_0x4339d0[_0xea6a('0xc')]);OpenchannelInteractionEvents[_0xea6a('0xd')](_0x487fb1+':'+_0xbdcf7a['id'],_0xbdcf7a);OpenchannelInteractionEvents[_0xea6a('0xd')](_0x487fb1,_0xbdcf7a);_0x6ca25(null);})[_0xea6a('0xe')](_0x6ca25(null));};}for(var e in events){if(events[_0xea6a('0xf')](e)){var event=events[e];OpenchannelInteraction[_0xea6a('0x10')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0x4a14=['save','update','remove','getUsers','then','setDataValue','length','emit','catch','hasOwnProperty','hook','events','OpenchannelMessage'];(function(_0x24e756,_0x2e32d5){var _0x4caec0=function(_0x42ce78){while(--_0x42ce78){_0x24e756['push'](_0x24e756['shift']());}};_0x4caec0(++_0x2e32d5);}(_0x4a14,0x1c5));var _0x44a1=function(_0xf40e38,_0x3a9f4d){_0xf40e38=_0xf40e38-0x0;var _0x4a89aa=_0x4a14[_0xf40e38];return _0x4a89aa;};'use strict';var EventEmitter=require(_0x44a1('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db']['OpenchannelInteraction'];var OpenchannelMessage=require('../../mysqldb')['db'][_0x44a1('0x1')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x44a1('0x2'),'afterUpdate':_0x44a1('0x3'),'afterDestroy':_0x44a1('0x4')};function emitEvent(_0x4c6909){return function(_0x20b12f,_0x1d22ec,_0x20d447){_0x20b12f[_0x44a1('0x5')]({'attributes':['id'],'raw':!![]})[_0x44a1('0x6')](function(_0x47d410){_0x20b12f['setDataValue']('Users',_0x47d410['map'](function(_0x4ebb31){return{'id':_0x4ebb31['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x20b12f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x44a1('0x6')](function(_0x2534f6){_0x20b12f[_0x44a1('0x7')]('unreadMessages',_0x2534f6[_0x44a1('0x8')]);OpenchannelInteractionEvents['emit'](_0x4c6909+':'+_0x20b12f['id'],_0x20b12f);OpenchannelInteractionEvents[_0x44a1('0x9')](_0x4c6909,_0x20b12f);_0x20d447(null);})[_0x44a1('0xa')](_0x20d447(null));};}for(var e in events){if(events[_0x44a1('0xb')](e)){var event=events[e];OpenchannelInteraction[_0x44a1('0xc')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 380dd53..04e1830 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 _0x3c94=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api'];(function(_0x11179b,_0x135dbf){var _0x3d67b5=function(_0x40dafe){while(--_0x40dafe){_0x11179b['push'](_0x11179b['shift']());}};_0x3d67b5(++_0x135dbf);}(_0x3c94,0xcd));var _0x43c9=function(_0x137d1d,_0x35c663){_0x137d1d=_0x137d1d-0x0;var _0x485108=_0x3c94[_0x137d1d];return _0x485108;};'use strict';var _=require(_0x43c9('0x0'));var util=require(_0x43c9('0x1'));var logger=require(_0x43c9('0x2'))(_0x43c9('0x3'));var moment=require(_0x43c9('0x4'));var BPromise=require(_0x43c9('0x5'));var rp=require(_0x43c9('0x6'));var fs=require('fs');var path=require(_0x43c9('0x7'));var rimraf=require(_0x43c9('0x8'));var config=require(_0x43c9('0x9'));var attributes=require(_0x43c9('0xa'));module[_0x43c9('0xb')]=function(_0x4fdfc2,_0x39c220){return _0x4fdfc2[_0x43c9('0xc')](_0x43c9('0xd'),attributes,{'tableName':_0x43c9('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x383adb,_0x7a0f6b,_0x28aa11){if(_0x383adb[_0x43c9('0xf')](_0x43c9('0x10'))){_0x383adb['closedAt']=moment()[_0x43c9('0x11')](_0x43c9('0x12'));}_0x28aa11(null,_0x383adb);}}});}; \ No newline at end of file +var _0x46ed=['lodash','util','api','moment','bluebird','path','rimraf','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','changed','closedAt','format'];(function(_0x421263,_0x18187d){var _0x34e4b5=function(_0x4e7978){while(--_0x4e7978){_0x421263['push'](_0x421263['shift']());}};_0x34e4b5(++_0x18187d);}(_0x46ed,0x168));var _0xd46e=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x46ed[_0x599f41];return _0x2e4d58;};'use strict';var _=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var logger=require('../../config/logger')(_0xd46e('0x2'));var moment=require(_0xd46e('0x3'));var BPromise=require(_0xd46e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd46e('0x5'));var rimraf=require(_0xd46e('0x6'));var config=require('../../config/environment');var attributes=require(_0xd46e('0x7'));module[_0xd46e('0x8')]=function(_0x160bcf,_0x25cf78){return _0x160bcf[_0xd46e('0x9')](_0xd46e('0xa'),attributes,{'tableName':_0xd46e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x144687,_0x31259b,_0x19e4f4){if(_0x144687[_0xd46e('0xc')]('closed')){_0x144687[_0xd46e('0xd')]=moment()[_0xd46e('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x19e4f4(null,_0x144687);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index b1a15f3..c5421c4 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 _0x0711=['./openchannelInteraction.socket','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','attributes','limit','AddTagsToOpenchannelInteraction','where','ids','omit','AddTags','stringify','lodash','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0711,0x14a));var _0x1071=function(_0x222604,_0x211b76){_0x222604=_0x222604-0x0;var _0x1c6eac=_0x0711[_0x222604];return _0x1c6eac;};'use strict';var _=require(_0x1071('0x0'));var util=require('util');var moment=require(_0x1071('0x1'));var BPromise=require(_0x1071('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1071('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1071('0x4'))('rpc');var config=require(_0x1071('0x5'));var jayson=require(_0x1071('0x6'));var client=jayson['client'][_0x1071('0x7')]({'port':0x232a});config['redis']=_[_0x1071('0x8')](config[_0x1071('0x9')],{'host':_0x1071('0xa'),'port':0x18eb});var socket=require(_0x1071('0xb'))(new Redis(config[_0x1071('0x9')]));require(_0x1071('0xc'))['register'](socket);function respondWithRpcPromise(_0x29afe9,_0x576cfc,_0x3312c8){return new BPromise(function(_0x4fd4f3,_0x12f0a9){return client[_0x1071('0xd')](_0x29afe9,_0x3312c8)[_0x1071('0xe')](function(_0x3d6150){logger[_0x1071('0xf')](_0x1071('0x10'),_0x576cfc,'request\x20sent');logger[_0x1071('0x11')](_0x1071('0x12'),_0x576cfc,_0x1071('0x13'),JSON['stringify'](_0x3d6150));if(_0x3d6150['error']){if(_0x3d6150[_0x1071('0x14')]['code']===0x1f4){logger[_0x1071('0x14')](_0x1071('0x10'),_0x576cfc,_0x3d6150[_0x1071('0x14')][_0x1071('0x15')]);return _0x12f0a9(_0x3d6150[_0x1071('0x14')][_0x1071('0x15')]);}logger[_0x1071('0x14')](_0x1071('0x10'),_0x576cfc,_0x3d6150['error'][_0x1071('0x15')]);return _0x4fd4f3(_0x3d6150[_0x1071('0x14')][_0x1071('0x15')]);}else{logger[_0x1071('0xf')](_0x1071('0x10'),_0x576cfc,'request\x20sent');_0x4fd4f3(_0x3d6150[_0x1071('0x16')]['message']);}})[_0x1071('0x17')](function(_0x14fa5d){logger['error'](_0x1071('0x10'),_0x576cfc,_0x14fa5d);_0x12f0a9(_0x14fa5d);});});}exports[_0x1071('0x18')]=function(_0x3dcf0d){var _0x4099c8=this;return new Promise(function(_0xe4141,_0x7ec627){return db[_0x1071('0x19')][_0x1071('0x1a')](_0x3dcf0d[_0x1071('0x1b')],{'raw':_0x3dcf0d[_0x1071('0x1c')]?_0x3dcf0d[_0x1071('0x1c')][_0x1071('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3dcf0d[_0x1071('0x1c')]?_0x3dcf0d[_0x1071('0x1c')]['where']||null:null,'attributes':_0x3dcf0d[_0x1071('0x1c')]?_0x3dcf0d[_0x1071('0x1c')][_0x1071('0x1e')]||null:null,'limit':_0x3dcf0d['options']?_0x3dcf0d[_0x1071('0x1c')][_0x1071('0x1f')]||null:null})[_0x1071('0xe')](function(_0x3f0f9f){logger[_0x1071('0xf')](_0x1071('0x18'),_0x3dcf0d);logger[_0x1071('0x11')](_0x1071('0x18'),_0x3dcf0d,JSON['stringify'](_0x3f0f9f));_0xe4141(_0x3f0f9f);})['catch'](function(_0xd638f4){logger['error'](_0x1071('0x18'),_0xd638f4[_0x1071('0x15')],_0x3dcf0d);_0x7ec627(_0x4099c8[_0x1071('0x14')](0x1f4,_0xd638f4[_0x1071('0x15')]));});});};exports[_0x1071('0x20')]=function(_0x33ddbd){return new Promise(function(_0x21b5b7,_0xb5346e){return db[_0x1071('0x19')]['find']({'where':_0x33ddbd[_0x1071('0x1c')]?_0x33ddbd[_0x1071('0x1c')][_0x1071('0x21')]||null:null})[_0x1071('0xe')](function(_0x49488c){if(_0x49488c){return _0x49488c['addTags'](_0x33ddbd[_0x1071('0x1b')][_0x1071('0x22')],_[_0x1071('0x23')](_0x33ddbd[_0x1071('0x1b')],[_0x1071('0x22'),'id'])||{});}})['spread'](function(_0x374266){logger[_0x1071('0xf')](_0x1071('0x24'),_0x33ddbd);logger[_0x1071('0x11')](_0x1071('0x24'),_0x33ddbd,JSON[_0x1071('0x25')](_0x374266));_0x21b5b7(_0x374266);})[_0x1071('0x17')](function(_0x5aee17){logger['error']('AddTags',_0x5aee17[_0x1071('0x15')],_0x33ddbd);_0xb5346e(_this['error'](0x1f4,_0x5aee17['message']));});});}; \ No newline at end of file +var _0x1636=['AddTagsToOpenchannelInteraction','find','where','omit','ids','spread','AddTags','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','UpdateOpenchannelInteraction','OpenchannelInteraction','options','raw','attributes','limit','catch'];(function(_0x14be8a,_0x92be23){var _0x3ff088=function(_0x14ebc6){while(--_0x14ebc6){_0x14be8a['push'](_0x14be8a['shift']());}};_0x3ff088(++_0x92be23);}(_0x1636,0x1b4));var _0x6163=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x1636[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x6163('0x0'));var util=require(_0x6163('0x1'));var moment=require(_0x6163('0x2'));var BPromise=require('bluebird');var rs=require(_0x6163('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6163('0x4'))['db'];var utils=require(_0x6163('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x6163('0x6'));var jayson=require(_0x6163('0x7'));var client=jayson[_0x6163('0x8')][_0x6163('0x9')]({'port':0x232a});config[_0x6163('0xa')]=_[_0x6163('0xb')](config[_0x6163('0xa')],{'host':_0x6163('0xc'),'port':0x18eb});var socket=require(_0x6163('0xd'))(new Redis(config[_0x6163('0xa')]));require(_0x6163('0xe'))['register'](socket);function respondWithRpcPromise(_0x29f187,_0x199bde,_0xde3775){return new BPromise(function(_0x5ab4d2,_0xe63b78){return client[_0x6163('0xf')](_0x29f187,_0xde3775)[_0x6163('0x10')](function(_0x363d9d){logger[_0x6163('0x11')](_0x6163('0x12'),_0x199bde,_0x6163('0x13'));logger[_0x6163('0x14')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x199bde,_0x6163('0x13'),JSON[_0x6163('0x15')](_0x363d9d));if(_0x363d9d[_0x6163('0x16')]){if(_0x363d9d['error']['code']===0x1f4){logger['error'](_0x6163('0x12'),_0x199bde,_0x363d9d['error'][_0x6163('0x17')]);return _0xe63b78(_0x363d9d[_0x6163('0x16')][_0x6163('0x17')]);}logger[_0x6163('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x199bde,_0x363d9d[_0x6163('0x16')][_0x6163('0x17')]);return _0x5ab4d2(_0x363d9d['error'][_0x6163('0x17')]);}else{logger['info'](_0x6163('0x12'),_0x199bde,_0x6163('0x13'));_0x5ab4d2(_0x363d9d[_0x6163('0x18')][_0x6163('0x17')]);}})['catch'](function(_0x7b262d){logger['error'](_0x6163('0x12'),_0x199bde,_0x7b262d);_0xe63b78(_0x7b262d);});});}exports[_0x6163('0x19')]=function(_0x224bde){var _0x5c8371=this;return new Promise(function(_0x575661,_0x520855){return db[_0x6163('0x1a')]['update'](_0x224bde['body'],{'raw':_0x224bde[_0x6163('0x1b')]?_0x224bde[_0x6163('0x1b')][_0x6163('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x224bde[_0x6163('0x1b')]?_0x224bde[_0x6163('0x1b')]['where']||null:null,'attributes':_0x224bde[_0x6163('0x1b')]?_0x224bde[_0x6163('0x1b')][_0x6163('0x1d')]||null:null,'limit':_0x224bde['options']?_0x224bde[_0x6163('0x1b')][_0x6163('0x1e')]||null:null})['then'](function(_0x319d83){logger['info'](_0x6163('0x19'),_0x224bde);logger[_0x6163('0x14')](_0x6163('0x19'),_0x224bde,JSON[_0x6163('0x15')](_0x319d83));_0x575661(_0x319d83);})[_0x6163('0x1f')](function(_0x60c09d){logger[_0x6163('0x16')](_0x6163('0x19'),_0x60c09d['message'],_0x224bde);_0x520855(_0x5c8371['error'](0x1f4,_0x60c09d[_0x6163('0x17')]));});});};exports[_0x6163('0x20')]=function(_0x36d384){return new Promise(function(_0x4f23ac,_0x1dfacd){return db[_0x6163('0x1a')][_0x6163('0x21')]({'where':_0x36d384[_0x6163('0x1b')]?_0x36d384[_0x6163('0x1b')][_0x6163('0x22')]||null:null})[_0x6163('0x10')](function(_0xa38d5b){if(_0xa38d5b){return _0xa38d5b['addTags'](_0x36d384['body']['ids'],_[_0x6163('0x23')](_0x36d384['body'],[_0x6163('0x24'),'id'])||{});}})[_0x6163('0x25')](function(_0x30df98){logger['info'](_0x6163('0x26'),_0x36d384);logger['debug'](_0x6163('0x26'),_0x36d384,JSON[_0x6163('0x15')](_0x30df98));_0x4f23ac(_0x30df98);})['catch'](function(_0x30d3ce){logger['error'](_0x6163('0x26'),_0x30d3ce[_0x6163('0x17')],_0x36d384);_0x1dfacd(_this[_0x6163('0x16')](0x1f4,_0x30d3ce['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index e0fc815..afb6edb 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 _0xd1d5=['openchannelInteraction:','./openchannelInteraction.events','remove','update','emit','register'];(function(_0x64b91f,_0x36e909){var _0x2ceb74=function(_0x5d9c79){while(--_0x5d9c79){_0x64b91f['push'](_0x64b91f['shift']());}};_0x2ceb74(++_0x36e909);}(_0xd1d5,0xb5));var _0x5d1d=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xd1d5[_0x432682];return _0x463d05;};'use strict';var OpenchannelInteractionEvents=require(_0x5d1d('0x0'));var events=['save',_0x5d1d('0x1'),_0x5d1d('0x2')];function createListener(_0x1ae085,_0xff3995){return function(_0x3c06b7){_0xff3995[_0x5d1d('0x3')](_0x1ae085,_0x3c06b7);};}function removeListener(_0x2d2d9e,_0x58333e){return function(){OpenchannelInteractionEvents['removeListener'](_0x2d2d9e,_0x58333e);};}exports[_0x5d1d('0x4')]=function(_0x408cc9){for(var _0x300f8b=0x0,_0x4367c3=events['length'];_0x300f8b<_0x4367c3;_0x300f8b++){var _0x586fcf=events[_0x300f8b];var _0x2c5e8a=createListener(_0x5d1d('0x5')+_0x586fcf,_0x408cc9);OpenchannelInteractionEvents['on'](_0x586fcf,_0x2c5e8a);}}; \ No newline at end of file +var _0x1771=['save','update','length','openchannelInteraction:'];(function(_0x1feacb,_0x20ab64){var _0x1167c5=function(_0x49ad29){while(--_0x49ad29){_0x1feacb['push'](_0x1feacb['shift']());}};_0x1167c5(++_0x20ab64);}(_0x1771,0x98));var _0x1177=function(_0x270bab,_0x225aad){_0x270bab=_0x270bab-0x0;var _0x1cce3d=_0x1771[_0x270bab];return _0x1cce3d;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x1177('0x0'),'remove',_0x1177('0x1')];function createListener(_0x18e590,_0x18a9cb){return function(_0x8c64b3){_0x18a9cb['emit'](_0x18e590,_0x8c64b3);};}function removeListener(_0x4d5b28,_0x140f6d){return function(){OpenchannelInteractionEvents['removeListener'](_0x4d5b28,_0x140f6d);};}exports['register']=function(_0x4ad2c0){for(var _0x9fd86a=0x0,_0x1f698a=events[_0x1177('0x2')];_0x9fd86a<_0x1f698a;_0x9fd86a++){var _0x56e935=events[_0x9fd86a];var _0x4b7bb9=createListener(_0x1177('0x3')+_0x56e935,_0x4ad2c0);OpenchannelInteractionEvents['on'](_0x56e935,_0x4b7bb9);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index c8b1f7c..9380eec 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 _0x505a=['isAuthenticated','index','/describe','describe','show','post','tracked','openchannelmessage:create','put','accept','reject','/:id','exports','path','connect-timeout','../../components/auth/service','./openchannelMessage.controller','get'];(function(_0x58a070,_0xec54a5){var _0x18b084=function(_0x5f2820){while(--_0x5f2820){_0x58a070['push'](_0x58a070['shift']());}};_0x18b084(++_0xec54a5);}(_0x505a,0x175));var _0xa505=function(_0x1a6318,_0x3de013){_0x1a6318=_0x1a6318-0x0;var _0x380cd5=_0x505a[_0x1a6318];return _0x380cd5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa505('0x0'));var timeout=require(_0xa505('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0xa505('0x2'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa505('0x3'));router[_0xa505('0x4')]('/',auth[_0xa505('0x5')](),controller[_0xa505('0x6')]);router[_0xa505('0x4')](_0xa505('0x7'),auth[_0xa505('0x5')](),controller[_0xa505('0x8')]);router[_0xa505('0x4')]('/:id',auth['isAuthenticated'](),controller[_0xa505('0x9')]);router[_0xa505('0xa')]('/',auth[_0xa505('0x5')](),interaction[_0xa505('0xb')]('openchannel',_0xa505('0xc')),controller['create']);router[_0xa505('0xd')]('/:id',auth[_0xa505('0x5')](),controller['update']);router[_0xa505('0xd')]('/:id/accept',auth['isAuthenticated'](),controller[_0xa505('0xe')]);router[_0xa505('0xd')]('/:id/reject',auth['isAuthenticated'](),controller[_0xa505('0xf')]);router['delete'](_0xa505('0x10'),auth[_0xa505('0x5')](),controller['destroy']);module[_0xa505('0x11')]=router; \ No newline at end of file +var _0xf6e4=['reject','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','/describe','/:id','show','tracked','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','/:id/reject'];(function(_0x993df9,_0x2b0e56){var _0x831ad1=function(_0x585786){while(--_0x585786){_0x993df9['push'](_0x993df9['shift']());}};_0x831ad1(++_0x2b0e56);}(_0xf6e4,0x6b));var _0x4f6e=function(_0x63435c,_0x3385f5){_0x63435c=_0x63435c-0x0;var _0x3e5233=_0xf6e4[_0x63435c];return _0x3e5233;};'use strict';var multer=require(_0x4f6e('0x0'));var util=require(_0x4f6e('0x1'));var path=require('path');var timeout=require(_0x4f6e('0x2'));var express=require(_0x4f6e('0x3'));var router=express[_0x4f6e('0x4')]();var auth=require(_0x4f6e('0x5'));var interaction=require(_0x4f6e('0x6'));var config=require(_0x4f6e('0x7'));var controller=require(_0x4f6e('0x8'));router[_0x4f6e('0x9')]('/',auth[_0x4f6e('0xa')](),controller['index']);router['get'](_0x4f6e('0xb'),auth[_0x4f6e('0xa')](),controller['describe']);router[_0x4f6e('0x9')](_0x4f6e('0xc'),auth[_0x4f6e('0xa')](),controller[_0x4f6e('0xd')]);router['post']('/',auth[_0x4f6e('0xa')](),interaction[_0x4f6e('0xe')](_0x4f6e('0xf'),_0x4f6e('0x10')),controller[_0x4f6e('0x11')]);router['put'](_0x4f6e('0xc'),auth[_0x4f6e('0xa')](),controller[_0x4f6e('0x12')]);router[_0x4f6e('0x13')](_0x4f6e('0x14'),auth[_0x4f6e('0xa')](),controller[_0x4f6e('0x15')]);router[_0x4f6e('0x13')](_0x4f6e('0x16'),auth[_0x4f6e('0xa')](),controller[_0x4f6e('0x17')]);router[_0x4f6e('0x18')](_0x4f6e('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x4f6e('0x19')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 3faa955..e8a6b77 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 _0x26d7=['out','sequelize','TEXT','medium','BOOLEAN','ENUM'];(function(_0x5d7533,_0x5c5947){var _0xa80024=function(_0x44bd4d){while(--_0x44bd4d){_0x5d7533['push'](_0x5d7533['shift']());}};_0xa80024(++_0x5c5947);}(_0x26d7,0x151));var _0x726d=function(_0x3c0f2f,_0x2618a0){_0x3c0f2f=_0x3c0f2f-0x0;var _0x185d72=_0x26d7[_0x3c0f2f];return _0x185d72;};'use strict';var Sequelize=require(_0x726d('0x0'));module['exports']={'body':{'type':Sequelize[_0x726d('0x1')](_0x726d('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x726d('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x726d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x726d('0x4')]('in',_0x726d('0x5')),'defaultValue':_0x726d('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x30b1=['out','DATE','exports','TEXT','BOOLEAN','ENUM'];(function(_0x29be4a,_0x2bf84b){var _0x4ce4ca=function(_0xc91999){while(--_0xc91999){_0x29be4a['push'](_0x29be4a['shift']());}};_0x4ce4ca(++_0x2bf84b);}(_0x30b1,0x11c));var _0x130b=function(_0x35311e,_0x9ff7d9){_0x35311e=_0x35311e-0x0;var _0x4d1881=_0x30b1[_0x35311e];return _0x4d1881;};'use strict';var Sequelize=require('sequelize');module[_0x130b('0x0')]={'body':{'type':Sequelize[_0x130b('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x130b('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x130b('0x3')]('in','out'),'defaultValue':_0x130b('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x130b('0x5')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 195755e..b6daf33 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 _0x925d=['http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','stringify','error','code','message','OpenchannelMessage,\x20%s,\x20%s','result','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','end','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','query','filters','intersection','model','attributes','fields','length','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','keys','create','body','find','describe','../../config/logger','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','OpenchannelInteraction','isNil','interaction','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','agent','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','rejectmessage','html-pdf','eml-format','zip-dir','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','jayson/promise','client'];(function(_0xf79bae,_0x263b2a){var _0x5d2cb7=function(_0x27c86b){while(--_0x27c86b){_0xf79bae['push'](_0xf79bae['shift']());}};_0x5d2cb7(++_0x263b2a);}(_0x925d,0x1ca));var _0xd925=function(_0x18c95f,_0x5d4d79){_0x18c95f=_0x18c95f-0x0;var _0xb1f91c=_0x925d[_0x18c95f];return _0xb1f91c;};'use strict';var pdf=require(_0xd925('0x0'));var emlformat=require(_0xd925('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd925('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd925('0x3'));var Mustache=require(_0xd925('0x4'));var util=require('util');var path=require('path');var sox=require(_0xd925('0x5'));var csv=require(_0xd925('0x6'));var ejs=require(_0xd925('0x7'));var fs=require('fs');var _=require(_0xd925('0x8'));var squel=require(_0xd925('0x9'));var crypto=require(_0xd925('0xa'));var jsforce=require(_0xd925('0xb'));var deskjs=require(_0xd925('0xc'));var toCsv=require(_0xd925('0x6'));var querystring=require(_0xd925('0xd'));var Papa=require(_0xd925('0xe'));var Redis=require(_0xd925('0xf'));var authService=require(_0xd925('0x10'));var qs=require(_0xd925('0x11'));var as=require(_0xd925('0x12'));var hardwareService=require(_0xd925('0x13'));var logger=require('../../config/logger')(_0xd925('0x14'));var utils=require(_0xd925('0x15'));var config=require(_0xd925('0x16'));var db=require('../../mysqldb')['db'];config[_0xd925('0x17')]=_[_0xd925('0x18')](config['redis'],{'host':_0xd925('0x19'),'port':0x18eb});var socket=require(_0xd925('0x1a'))(new Redis(config[_0xd925('0x17')]));require(_0xd925('0x1b'))['register'](socket);var jayson=require(_0xd925('0x1c'));var client=jayson[_0xd925('0x1d')][_0xd925('0x1e')]({'port':0x232c});var client9002=jayson[_0xd925('0x1d')][_0xd925('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x3a90cc,_0x250612,_0x2401b5){if(_0x2401b5){var _0x20fb2c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x20fb2c[_0xd925('0x1f')](_0x250612)){return _0x3a90cc;}else{throw new db[(_0xd925('0x20'))][(_0xd925('0x21'))](_0xd925('0x22'));}}else{return _0x3a90cc;}}function respondWithRpcPromise(_0xaeba07,_0xffb3e6,_0x34cb3d,_0x1ef9d6){return new BPromise(function(_0x4b611d,_0x59f176){var _0x1f79d9=_0x1ef9d6||client;return _0x1f79d9[_0xd925('0x23')](_0xaeba07,_0x34cb3d)[_0xd925('0x24')](function(_0x3d4607){logger[_0xd925('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0xffb3e6,'request\x20sent');logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0xffb3e6,_0xd925('0x26'),JSON[_0xd925('0x27')](_0x3d4607));if(_0x3d4607[_0xd925('0x28')]){if(_0x3d4607['error'][_0xd925('0x29')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0xffb3e6,_0x3d4607[_0xd925('0x28')][_0xd925('0x2a')]);return _0x59f176(_0x3d4607[_0xd925('0x28')][_0xd925('0x2a')]);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0xffb3e6,_0x3d4607[_0xd925('0x28')][_0xd925('0x2a')]);return _0x4b611d(_0x3d4607[_0xd925('0x28')]['message']);}else{logger[_0xd925('0x25')](_0xd925('0x2b'),_0xffb3e6,_0xd925('0x26'));_0x4b611d(_0x3d4607[_0xd925('0x2c')][_0xd925('0x2a')]);}})['catch'](function(_0xe9d20f){logger[_0xd925('0x28')](_0xd925('0x2b'),_0xffb3e6,_0xe9d20f);_0x59f176(_0xe9d20f);});});}function respondWithStatusCode(_0x51248d,_0x2d584d){_0x2d584d=_0x2d584d||0xcc;return function(_0x88c683){if(_0x88c683){return _0x51248d[_0xd925('0x2d')](_0x2d584d);}return _0x51248d[_0xd925('0x2e')](_0x2d584d)['end']();};}function respondWithResult(_0x27169e,_0x5a562a){_0x5a562a=_0x5a562a||0xc8;return function(_0x1ccf55){if(_0x1ccf55){return _0x27169e[_0xd925('0x2e')](_0x5a562a)[_0xd925('0x2f')](_0x1ccf55);}};}function respondWithFilteredResult(_0x5e71c7,_0x4ddc48){return function(_0x17ba30){if(_0x17ba30){var _0x459396=_0x17ba30[_0xd925('0x30')],_0x875ecb=_0x4ddc48[_0xd925('0x31')],_0x140fed=_0x4ddc48['offset']+_0x4ddc48[_0xd925('0x32')],_0x2a0251;if(_0x140fed>=_0x459396){_0x140fed=_0x459396;_0x2a0251=0xc8;}else{_0x2a0251=0xce;}_0x5e71c7[_0xd925('0x2e')](_0x2a0251);return _0x5e71c7[_0xd925('0x33')](_0xd925('0x34'),_0x875ecb+'-'+_0x140fed+'/'+_0x459396)[_0xd925('0x2f')](_0x17ba30);}return null;};}function patchUpdates(_0x316bd8){return function(_0x42fd15){try{jsonpatch[_0xd925('0x35')](_0x42fd15,_0x316bd8,!![]);}catch(_0x6ae180){return BPromise[_0xd925('0x36')](_0x6ae180);}return _0x42fd15[_0xd925('0x37')]();};}function saveUpdates(_0x217e1e,_0x37f310){return function(_0x6389e){if(_0x6389e){return _0x6389e[_0xd925('0x38')](_0x217e1e)[_0xd925('0x24')](function(_0x5ebc24){return _0x5ebc24;});}return null;};}function removeEntity(_0x2c82e4,_0x3d3d6e){return function(_0x271ae6){if(_0x271ae6){return _0x271ae6[_0xd925('0x39')]()['then'](function(){_0x2c82e4[_0xd925('0x2e')](0xcc)[_0xd925('0x3a')]();});}};}function handleEntityNotFound(_0x11cd5d,_0x506893){return function(_0x512914){if(!_0x512914){_0x11cd5d[_0xd925('0x2d')](0x194);}return _0x512914;};}function handleError(_0x381c3c,_0x1e8fee){_0x1e8fee=_0x1e8fee||0x1f4;return function(_0x48d7df){logger[_0xd925('0x28')](_0x48d7df['stack']);if(_0x48d7df[_0xd925('0x3b')]){delete _0x48d7df[_0xd925('0x3b')];}_0x381c3c['status'](_0x1e8fee)[_0xd925('0x3c')](_0x48d7df);};}exports[_0xd925('0x3d')]=function(_0x151ebf,_0x4f8e58){var _0x7b6ce9={},_0x565a1b={},_0x52189d={'count':0x0,'rows':[]};var _0x955fbe=_[_0xd925('0x3e')](db[_0xd925('0x3f')][_0xd925('0x40')],function(_0x1c72d6){return{'name':_0x1c72d6[_0xd925('0x41')],'type':_0x1c72d6['type']['key']};});_0x565a1b['model']=_[_0xd925('0x3e')](_0x955fbe,_0xd925('0x3b'));_0x565a1b[_0xd925('0x42')]=_['keys'](_0x151ebf['query']);_0x565a1b[_0xd925('0x43')]=_[_0xd925('0x44')](_0x565a1b[_0xd925('0x45')],_0x565a1b[_0xd925('0x42')]);_0x7b6ce9[_0xd925('0x46')]=_[_0xd925('0x44')](_0x565a1b[_0xd925('0x45')],qs[_0xd925('0x47')](_0x151ebf[_0xd925('0x42')]['fields']));_0x7b6ce9[_0xd925('0x46')]=_0x7b6ce9[_0xd925('0x46')][_0xd925('0x48')]?_0x7b6ce9['attributes']:_0x565a1b[_0xd925('0x45')];if(!_0x151ebf[_0xd925('0x42')]['hasOwnProperty']('nolimit')){_0x7b6ce9['limit']=qs['limit'](_0x151ebf['query'][_0xd925('0x32')]);_0x7b6ce9[_0xd925('0x31')]=qs['offset'](_0x151ebf[_0xd925('0x42')]['offset']);}_0x7b6ce9[_0xd925('0x49')]=qs[_0xd925('0x4a')](_0x151ebf['query'][_0xd925('0x4a')]);_0x7b6ce9['where']=qs['filters'](_[_0xd925('0x4b')](_0x151ebf[_0xd925('0x42')],_0x565a1b[_0xd925('0x43')]),_0x955fbe);if(_0x151ebf[_0xd925('0x42')][_0xd925('0x4c')]){_0x7b6ce9[_0xd925('0x4d')]=_['merge'](_0x7b6ce9[_0xd925('0x4d')],{'$or':_['map'](_0x955fbe,function(_0x11fbce){if(_0x11fbce[_0xd925('0x4e')]!==_0xd925('0x4f')){var _0x2e0acc={};_0x2e0acc[_0x11fbce[_0xd925('0x3b')]]={'$like':'%'+_0x151ebf[_0xd925('0x42')][_0xd925('0x4c')]+'%'};return _0x2e0acc;}})});}_0x7b6ce9=_[_0xd925('0x50')]({},_0x7b6ce9,_0x151ebf[_0xd925('0x51')]);var _0x16930e={'where':_0x7b6ce9[_0xd925('0x4d')]};return db['OpenchannelMessage'][_0xd925('0x30')](_0x16930e)['then'](function(_0x5088a5){_0x52189d['count']=_0x5088a5;if(_0x151ebf[_0xd925('0x42')][_0xd925('0x52')]){_0x7b6ce9[_0xd925('0x53')]=[{'all':!![]}];}return db[_0xd925('0x3f')][_0xd925('0x54')](_0x7b6ce9);})[_0xd925('0x24')](function(_0x58b5eb){_0x52189d[_0xd925('0x55')]=_0x58b5eb;return _0x52189d;})[_0xd925('0x24')](respondWithFilteredResult(_0x4f8e58,_0x7b6ce9))[_0xd925('0x56')](handleError(_0x4f8e58,null));};exports['show']=function(_0x143873,_0xf3b374){var _0x320de0={'raw':!![],'where':{'id':_0x143873[_0xd925('0x57')]['id']}},_0x432ac8={};_0x432ac8[_0xd925('0x45')]=_['keys'](db[_0xd925('0x3f')][_0xd925('0x40')]);_0x432ac8['query']=_[_0xd925('0x58')](_0x143873[_0xd925('0x42')]);_0x432ac8['filters']=_['intersection'](_0x432ac8[_0xd925('0x45')],_0x432ac8['query']);_0x320de0['attributes']=_['intersection'](_0x432ac8[_0xd925('0x45')],qs['fields'](_0x143873[_0xd925('0x42')][_0xd925('0x47')]));_0x320de0['attributes']=_0x320de0[_0xd925('0x46')]['length']?_0x320de0[_0xd925('0x46')]:_0x432ac8['model'];if(_0x143873[_0xd925('0x42')][_0xd925('0x52')]){_0x320de0[_0xd925('0x53')]=[{'all':!![]}];}_0x320de0=_[_0xd925('0x50')]({},_0x320de0,_0x143873[_0xd925('0x51')]);return db[_0xd925('0x3f')]['find'](_0x320de0)[_0xd925('0x24')](handleEntityNotFound(_0xf3b374,null))['then'](respondWithResult(_0xf3b374,null))['catch'](handleError(_0xf3b374,null));};exports[_0xd925('0x59')]=function(_0x5d7265,_0x514d36){return db[_0xd925('0x3f')]['create'](_0x5d7265[_0xd925('0x5a')],{})[_0xd925('0x24')](respondWithResult(_0x514d36,0xc9))[_0xd925('0x56')](handleError(_0x514d36,null));};exports[_0xd925('0x38')]=function(_0x41ba8c,_0x1c44b5){if(_0x41ba8c[_0xd925('0x5a')]['id']){delete _0x41ba8c[_0xd925('0x5a')]['id'];}return db['OpenchannelMessage'][_0xd925('0x5b')]({'where':{'id':_0x41ba8c['params']['id']}})['then'](handleEntityNotFound(_0x1c44b5,null))[_0xd925('0x24')](saveUpdates(_0x41ba8c[_0xd925('0x5a')],null))[_0xd925('0x24')](respondWithResult(_0x1c44b5,null))[_0xd925('0x56')](handleError(_0x1c44b5,null));};exports[_0xd925('0x39')]=function(_0x3075fa,_0x3dc1a9){return db[_0xd925('0x3f')]['find']({'where':{'id':_0x3075fa[_0xd925('0x57')]['id']}})['then'](handleEntityNotFound(_0x3dc1a9,null))['then'](removeEntity(_0x3dc1a9,null))[_0xd925('0x56')](handleError(_0x3dc1a9,null));};exports[_0xd925('0x5c')]=function(_0x3d1974,_0x1b2dca){return db[_0xd925('0x3f')][_0xd925('0x5c')]()['then'](respondWithResult(_0x1b2dca,null))['catch'](handleError(_0x1b2dca,null));};var interaction_log=require(_0xd925('0x5d'))('openchannel-interactions');exports[_0xd925('0x5e')]=function(_0x3cf4c8,_0x2a2086,_0x66961){var _0x235b41={'channel':_0xd925('0x5f')};if(_0x3cf4c8['body']['id']){delete _0x3cf4c8[_0xd925('0x5a')]['id'];}_0x3cf4c8[_0xd925('0x5a')][_0xd925('0x60')]=!![];_0x3cf4c8[_0xd925('0x5a')][_0xd925('0x61')]=moment()[_0xd925('0x62')](_0xd925('0x63'));_0x3cf4c8['body']['UserId']=_0x3cf4c8['body'][_0xd925('0x64')]||_0x3cf4c8[_0xd925('0x65')]['id'];return db['OpenchannelMessage'][_0xd925('0x5b')]({'where':{'id':_0x3cf4c8[_0xd925('0x57')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0xd925('0x24')](handleEntityNotFound(_0x2a2086,null))[_0xd925('0x24')](saveUpdates(_0x3cf4c8[_0xd925('0x5a')],null))[_0xd925('0x24')](function(_0x54a07c){if(_0x54a07c){_0x235b41[_0xd925('0x2a')]=_0x54a07c[_0xd925('0x66')]({'plain':!![]});return db[_0xd925('0x67')][_0xd925('0x5b')]({'where':{'id':_0x54a07c['OpenchannelInteractionId']}});}return null;})[_0xd925('0x24')](handleEntityNotFound(_0x2a2086,null))[_0xd925('0x24')](function(_0x45bc01){if(_0x45bc01){return _0x45bc01[_0xd925('0x38')]({'UserId':_0x3cf4c8[_0xd925('0x5a')][_0xd925('0x64')],'read1stAt':_[_0xd925('0x68')](_0x45bc01['read1stAt'])?moment()[_0xd925('0x62')](_0xd925('0x63')):undefined});}return null;})[_0xd925('0x24')](function(_0x27bed1){if(_0x27bed1){_0x235b41[_0xd925('0x69')]=_0x27bed1[_0xd925('0x66')]({'plain':!![]});interaction_log[_0xd925('0x25')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3cf4c8['user']['id'],_0x3cf4c8['user'][_0xd925('0x3b')],_0x3cf4c8['user']['role'],_0x235b41['interaction']['id'],_0x3cf4c8[_0xd925('0x5a')]?JSON[_0xd925('0x27')](_0x3cf4c8['body']):'null');return respondWithRpcPromise(_0xd925('0x6a'),_0xd925('0x6b'),_0x235b41);}return null;})[_0xd925('0x24')](function(_0xf5cdd4){if(_0xf5cdd4){if(_0x3cf4c8[_0xd925('0x5a')][_0xd925('0x6c')]){_0x235b41['message'][_0xd925('0x6d')]=util[_0xd925('0x62')](_0xd925('0x6e'),_0x3cf4c8[_0xd925('0x65')][_0xd925('0x3b')]);_0x235b41[_0xd925('0x2a')][_0xd925('0x6f')]=_0x235b41[_0xd925('0x6f')];_0x235b41[_0xd925('0x2a')][_0xd925('0x70')]=_0xd925('0x5e');return respondWithRpcPromise(_0xd925('0x71'),'EventManager',{'event':_0xd925('0x72'),'message':_0x235b41[_0xd925('0x2a')]},client9002)['then'](function(){return _0x235b41;});}return _0x235b41;}return null;})[_0xd925('0x24')](respondWithResult(_0x2a2086,null))[_0xd925('0x56')](handleError(_0x2a2086,null));};var interaction_log=require(_0xd925('0x5d'))('openchannel-interactions');exports['reject']=function(_0x6f4c53,_0x2e5950,_0x4c3d0c){var _0xdf5826={'agent':{},'channel':_0xd925('0x5f')};if(_0x6f4c53[_0xd925('0x5a')]['id']){delete _0x6f4c53['body']['id'];}_0x6f4c53['body'][_0xd925('0x64')]=_0x6f4c53[_0xd925('0x5a')]['UserId']||_0x6f4c53['user']['id'];_0xdf5826[_0xd925('0x73')]['id']=_0x6f4c53[_0xd925('0x5a')][_0xd925('0x64')];return db[_0xd925('0x3f')][_0xd925('0x5b')]({'where':{'id':_0x6f4c53[_0xd925('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2e5950,null))[_0xd925('0x24')](function(_0x5ac003){if(_0x5ac003){_0xdf5826[_0xd925('0x2a')]=_0x5ac003[_0xd925('0x66')]({'plain':!![]});return db[_0xd925('0x67')][_0xd925('0x5b')]({'where':{'id':_0x5ac003['OpenchannelInteractionId']}});}return null;})[_0xd925('0x24')](handleEntityNotFound(_0x2e5950,null))[_0xd925('0x24')](function(_0x2a9485){if(_0x2a9485){_0xdf5826[_0xd925('0x69')]=_0x2a9485[_0xd925('0x66')]({'plain':!![]});interaction_log[_0xd925('0x25')](_0xd925('0x74'),_0x6f4c53[_0xd925('0x65')]['id'],_0x6f4c53['user'][_0xd925('0x3b')],_0x6f4c53[_0xd925('0x65')][_0xd925('0x75')],_0xdf5826[_0xd925('0x69')]['id'],_0x6f4c53[_0xd925('0x5a')]?JSON[_0xd925('0x27')](_0x6f4c53[_0xd925('0x5a')]):_0xd925('0x76'));return respondWithRpcPromise(_0xd925('0x77'),_0xd925('0x78'),_0xdf5826);}return null;})['then'](function(_0x1d1581){if(_0x1d1581){_0x1d1581[_0xd925('0x2a')]['interface']=util[_0xd925('0x62')](_0xd925('0x6e'),_0x6f4c53[_0xd925('0x65')][_0xd925('0x3b')]);_0x1d1581['message'][_0xd925('0x6f')]=_0xdf5826['channel'];_0x1d1581[_0xd925('0x2a')][_0xd925('0x70')]=_0xd925('0x36');respondWithRpcPromise('EventManager',_0xd925('0x71'),{'event':_0xd925('0x79'),'message':_0x1d1581[_0xd925('0x2a')]},client9002);return _0xdf5826;}return null;})[_0xd925('0x24')](respondWithResult(_0x2e5950,null))[_0xd925('0x56')](handleError(_0x2e5950,null));}; \ No newline at end of file +var _0x5ad8=['body','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','interface','channel','event','EventManager','acceptmessage','agent','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SIP/%s','rejectmessage','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','OpenchannelMessage,\x20%s,\x20%s','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','limit','set','apply','reject','save','update','destroy','stack','name','index','fieldName','type','model','map','query','keys','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','OpenchannelMessage','count','includeAll','include','findAll','show','params','rawAttributes','intersection','find','create'];(function(_0x3efe87,_0x35ad48){var _0x56a4cc=function(_0x47869e){while(--_0x47869e){_0x3efe87['push'](_0x3efe87['shift']());}};_0x56a4cc(++_0x35ad48);}(_0x5ad8,0x9e));var _0x85ad=function(_0x111614,_0x4a7ac4){_0x111614=_0x111614-0x0;var _0x2c958e=_0x5ad8[_0x111614];return _0x2c958e;};'use strict';var pdf=require(_0x85ad('0x0'));var emlformat=require(_0x85ad('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x85ad('0x2'));var jsonpatch=require(_0x85ad('0x3'));var rp=require(_0x85ad('0x4'));var moment=require(_0x85ad('0x5'));var BPromise=require(_0x85ad('0x6'));var Mustache=require(_0x85ad('0x7'));var util=require(_0x85ad('0x8'));var path=require(_0x85ad('0x9'));var sox=require('sox');var csv=require(_0x85ad('0xa'));var ejs=require(_0x85ad('0xb'));var fs=require('fs');var _=require(_0x85ad('0xc'));var squel=require(_0x85ad('0xd'));var crypto=require('crypto');var jsforce=require(_0x85ad('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x85ad('0xa'));var querystring=require('querystring');var Papa=require(_0x85ad('0xf'));var Redis=require(_0x85ad('0x10'));var authService=require(_0x85ad('0x11'));var qs=require(_0x85ad('0x12'));var as=require(_0x85ad('0x13'));var hardwareService=require(_0x85ad('0x14'));var logger=require(_0x85ad('0x15'))(_0x85ad('0x16'));var utils=require(_0x85ad('0x17'));var config=require(_0x85ad('0x18'));var db=require('../../mysqldb')['db'];config[_0x85ad('0x19')]=_[_0x85ad('0x1a')](config['redis'],{'host':_0x85ad('0x1b'),'port':0x18eb});var socket=require(_0x85ad('0x1c'))(new Redis(config[_0x85ad('0x19')]));require(_0x85ad('0x1d'))['register'](socket);var jayson=require(_0x85ad('0x1e'));var client=jayson[_0x85ad('0x1f')][_0x85ad('0x20')]({'port':0x232c});var client9002=jayson[_0x85ad('0x1f')][_0x85ad('0x20')]({'port':0x232a});function checkPasswordPattern(_0x56e004,_0x13fe63,_0x4dcfcd){if(_0x4dcfcd){var _0x483635=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x483635[_0x85ad('0x21')](_0x13fe63)){return _0x56e004;}else{throw new db[(_0x85ad('0x22'))][(_0x85ad('0x23'))]('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 _0x56e004;}}function respondWithRpcPromise(_0x2abb26,_0x394c96,_0x33386d,_0x41424d){return new BPromise(function(_0x25eaf1,_0x40aaf8){var _0x2fc31d=_0x41424d||client;return _0x2fc31d[_0x85ad('0x24')](_0x2abb26,_0x33386d)[_0x85ad('0x25')](function(_0x2a9de9){logger[_0x85ad('0x26')](_0x85ad('0x27'),_0x394c96,'request\x20sent');logger[_0x85ad('0x28')](_0x85ad('0x29'),_0x394c96,_0x85ad('0x2a'),JSON[_0x85ad('0x2b')](_0x2a9de9));if(_0x2a9de9[_0x85ad('0x2c')]){if(_0x2a9de9[_0x85ad('0x2c')][_0x85ad('0x2d')]===0x1f4){logger[_0x85ad('0x2c')](_0x85ad('0x27'),_0x394c96,_0x2a9de9[_0x85ad('0x2c')][_0x85ad('0x2e')]);return _0x40aaf8(_0x2a9de9[_0x85ad('0x2c')]['message']);}logger[_0x85ad('0x2c')](_0x85ad('0x27'),_0x394c96,_0x2a9de9['error'][_0x85ad('0x2e')]);return _0x25eaf1(_0x2a9de9[_0x85ad('0x2c')]['message']);}else{logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x394c96,_0x85ad('0x2a'));_0x25eaf1(_0x2a9de9[_0x85ad('0x2f')][_0x85ad('0x2e')]);}})[_0x85ad('0x30')](function(_0xb4a660){logger[_0x85ad('0x2c')](_0x85ad('0x27'),_0x394c96,_0xb4a660);_0x40aaf8(_0xb4a660);});});}function respondWithStatusCode(_0x24a961,_0x5d0189){_0x5d0189=_0x5d0189||0xcc;return function(_0x4271c6){if(_0x4271c6){return _0x24a961[_0x85ad('0x31')](_0x5d0189);}return _0x24a961['status'](_0x5d0189)[_0x85ad('0x32')]();};}function respondWithResult(_0x413fa3,_0x2e8521){_0x2e8521=_0x2e8521||0xc8;return function(_0x2a4ff1){if(_0x2a4ff1){return _0x413fa3[_0x85ad('0x33')](_0x2e8521)[_0x85ad('0x34')](_0x2a4ff1);}};}function respondWithFilteredResult(_0x3055bf,_0x34306d){return function(_0x4a533b){if(_0x4a533b){var _0x8a1bff=_0x4a533b['count'],_0x4e48e4=_0x34306d[_0x85ad('0x35')],_0x36147d=_0x34306d['offset']+_0x34306d[_0x85ad('0x36')],_0x52db4f;if(_0x36147d>=_0x8a1bff){_0x36147d=_0x8a1bff;_0x52db4f=0xc8;}else{_0x52db4f=0xce;}_0x3055bf[_0x85ad('0x33')](_0x52db4f);return _0x3055bf[_0x85ad('0x37')]('Content-Range',_0x4e48e4+'-'+_0x36147d+'/'+_0x8a1bff)[_0x85ad('0x34')](_0x4a533b);}return null;};}function patchUpdates(_0x303c01){return function(_0x140ee7){try{jsonpatch[_0x85ad('0x38')](_0x140ee7,_0x303c01,!![]);}catch(_0x60fea2){return BPromise[_0x85ad('0x39')](_0x60fea2);}return _0x140ee7[_0x85ad('0x3a')]();};}function saveUpdates(_0x53856b,_0x117ec1){return function(_0x25b354){if(_0x25b354){return _0x25b354[_0x85ad('0x3b')](_0x53856b)[_0x85ad('0x25')](function(_0x20007b){return _0x20007b;});}return null;};}function removeEntity(_0x1f066d,_0x4bf112){return function(_0x4d7303){if(_0x4d7303){return _0x4d7303[_0x85ad('0x3c')]()['then'](function(){_0x1f066d[_0x85ad('0x33')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ae262,_0x1f75ed){return function(_0x56704d){if(!_0x56704d){_0x5ae262['sendStatus'](0x194);}return _0x56704d;};}function handleError(_0x583338,_0x2e2aa2){_0x2e2aa2=_0x2e2aa2||0x1f4;return function(_0x425968){logger[_0x85ad('0x2c')](_0x425968[_0x85ad('0x3d')]);if(_0x425968[_0x85ad('0x3e')]){delete _0x425968[_0x85ad('0x3e')];}_0x583338[_0x85ad('0x33')](_0x2e2aa2)['send'](_0x425968);};}exports[_0x85ad('0x3f')]=function(_0x320c41,_0x327ee4){var _0x1b00f2={},_0x5ddaae={},_0x6323fc={'count':0x0,'rows':[]};var _0x1ccdf9=_['map'](db['OpenchannelMessage']['rawAttributes'],function(_0x478d29){return{'name':_0x478d29[_0x85ad('0x40')],'type':_0x478d29[_0x85ad('0x41')]['key']};});_0x5ddaae[_0x85ad('0x42')]=_[_0x85ad('0x43')](_0x1ccdf9,_0x85ad('0x3e'));_0x5ddaae[_0x85ad('0x44')]=_[_0x85ad('0x45')](_0x320c41[_0x85ad('0x44')]);_0x5ddaae['filters']=_['intersection'](_0x5ddaae['model'],_0x5ddaae[_0x85ad('0x44')]);_0x1b00f2['attributes']=_['intersection'](_0x5ddaae['model'],qs[_0x85ad('0x46')](_0x320c41['query'][_0x85ad('0x46')]));_0x1b00f2[_0x85ad('0x47')]=_0x1b00f2['attributes'][_0x85ad('0x48')]?_0x1b00f2[_0x85ad('0x47')]:_0x5ddaae[_0x85ad('0x42')];if(!_0x320c41[_0x85ad('0x44')]['hasOwnProperty'](_0x85ad('0x49'))){_0x1b00f2[_0x85ad('0x36')]=qs[_0x85ad('0x36')](_0x320c41[_0x85ad('0x44')][_0x85ad('0x36')]);_0x1b00f2[_0x85ad('0x35')]=qs[_0x85ad('0x35')](_0x320c41['query'][_0x85ad('0x35')]);}_0x1b00f2[_0x85ad('0x4a')]=qs[_0x85ad('0x4b')](_0x320c41[_0x85ad('0x44')][_0x85ad('0x4b')]);_0x1b00f2[_0x85ad('0x4c')]=qs[_0x85ad('0x4d')](_['pick'](_0x320c41[_0x85ad('0x44')],_0x5ddaae['filters']),_0x1ccdf9);if(_0x320c41[_0x85ad('0x44')][_0x85ad('0x4e')]){_0x1b00f2['where']=_[_0x85ad('0x4f')](_0x1b00f2[_0x85ad('0x4c')],{'$or':_[_0x85ad('0x43')](_0x1ccdf9,function(_0x5cc54d){if(_0x5cc54d['type']!==_0x85ad('0x50')){var _0x2a86bd={};_0x2a86bd[_0x5cc54d[_0x85ad('0x3e')]]={'$like':'%'+_0x320c41['query'][_0x85ad('0x4e')]+'%'};return _0x2a86bd;}})});}_0x1b00f2=_[_0x85ad('0x4f')]({},_0x1b00f2,_0x320c41['options']);var _0x556277={'where':_0x1b00f2[_0x85ad('0x4c')]};return db[_0x85ad('0x51')]['count'](_0x556277)[_0x85ad('0x25')](function(_0x57008b){_0x6323fc[_0x85ad('0x52')]=_0x57008b;if(_0x320c41[_0x85ad('0x44')][_0x85ad('0x53')]){_0x1b00f2[_0x85ad('0x54')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x85ad('0x55')](_0x1b00f2);})[_0x85ad('0x25')](function(_0x24d3d4){_0x6323fc['rows']=_0x24d3d4;return _0x6323fc;})['then'](respondWithFilteredResult(_0x327ee4,_0x1b00f2))['catch'](handleError(_0x327ee4,null));};exports[_0x85ad('0x56')]=function(_0x9e543a,_0x38fd76){var _0x27dbe={'raw':!![],'where':{'id':_0x9e543a[_0x85ad('0x57')]['id']}},_0x3fb94={};_0x3fb94['model']=_['keys'](db[_0x85ad('0x51')][_0x85ad('0x58')]);_0x3fb94[_0x85ad('0x44')]=_[_0x85ad('0x45')](_0x9e543a[_0x85ad('0x44')]);_0x3fb94['filters']=_[_0x85ad('0x59')](_0x3fb94[_0x85ad('0x42')],_0x3fb94[_0x85ad('0x44')]);_0x27dbe[_0x85ad('0x47')]=_[_0x85ad('0x59')](_0x3fb94[_0x85ad('0x42')],qs[_0x85ad('0x46')](_0x9e543a[_0x85ad('0x44')][_0x85ad('0x46')]));_0x27dbe[_0x85ad('0x47')]=_0x27dbe[_0x85ad('0x47')]['length']?_0x27dbe['attributes']:_0x3fb94[_0x85ad('0x42')];if(_0x9e543a[_0x85ad('0x44')][_0x85ad('0x53')]){_0x27dbe[_0x85ad('0x54')]=[{'all':!![]}];}_0x27dbe=_[_0x85ad('0x4f')]({},_0x27dbe,_0x9e543a['options']);return db['OpenchannelMessage'][_0x85ad('0x5a')](_0x27dbe)['then'](handleEntityNotFound(_0x38fd76,null))[_0x85ad('0x25')](respondWithResult(_0x38fd76,null))['catch'](handleError(_0x38fd76,null));};exports[_0x85ad('0x5b')]=function(_0x6190ea,_0x848c85){return db['OpenchannelMessage'][_0x85ad('0x5b')](_0x6190ea[_0x85ad('0x5c')],{})[_0x85ad('0x25')](respondWithResult(_0x848c85,0xc9))[_0x85ad('0x30')](handleError(_0x848c85,null));};exports[_0x85ad('0x3b')]=function(_0x267075,_0x330115){if(_0x267075[_0x85ad('0x5c')]['id']){delete _0x267075['body']['id'];}return db['OpenchannelMessage'][_0x85ad('0x5a')]({'where':{'id':_0x267075[_0x85ad('0x57')]['id']}})[_0x85ad('0x25')](handleEntityNotFound(_0x330115,null))[_0x85ad('0x25')](saveUpdates(_0x267075[_0x85ad('0x5c')],null))['then'](respondWithResult(_0x330115,null))[_0x85ad('0x30')](handleError(_0x330115,null));};exports['destroy']=function(_0x2a9b74,_0x37e482){return db[_0x85ad('0x51')]['find']({'where':{'id':_0x2a9b74[_0x85ad('0x57')]['id']}})[_0x85ad('0x25')](handleEntityNotFound(_0x37e482,null))[_0x85ad('0x25')](removeEntity(_0x37e482,null))[_0x85ad('0x30')](handleError(_0x37e482,null));};exports['describe']=function(_0x23c4ff,_0x1f1c34){return db[_0x85ad('0x51')][_0x85ad('0x5d')]()[_0x85ad('0x25')](respondWithResult(_0x1f1c34,null))[_0x85ad('0x30')](handleError(_0x1f1c34,null));};var interaction_log=require(_0x85ad('0x15'))(_0x85ad('0x5e'));exports[_0x85ad('0x5f')]=function(_0xcf6db4,_0x511a12,_0x2ab4e6){var _0x1325d4={'channel':_0x85ad('0x60')};if(_0xcf6db4[_0x85ad('0x5c')]['id']){delete _0xcf6db4[_0x85ad('0x5c')]['id'];}_0xcf6db4['body'][_0x85ad('0x61')]=!![];_0xcf6db4[_0x85ad('0x5c')][_0x85ad('0x62')]=moment()[_0x85ad('0x63')](_0x85ad('0x64'));_0xcf6db4['body'][_0x85ad('0x65')]=_0xcf6db4[_0x85ad('0x5c')][_0x85ad('0x65')]||_0xcf6db4['user']['id'];return db[_0x85ad('0x51')][_0x85ad('0x5a')]({'where':{'id':_0xcf6db4[_0x85ad('0x57')]['id'],'UserId':null},'include':[{'model':db[_0x85ad('0x66')],'as':_0x85ad('0x67')}]})['then'](handleEntityNotFound(_0x511a12,null))[_0x85ad('0x25')](saveUpdates(_0xcf6db4[_0x85ad('0x5c')],null))[_0x85ad('0x25')](function(_0x42165c){if(_0x42165c){_0x1325d4['message']=_0x42165c[_0x85ad('0x68')]({'plain':!![]});return db[_0x85ad('0x69')][_0x85ad('0x5a')]({'where':{'id':_0x42165c[_0x85ad('0x6a')]}});}return null;})[_0x85ad('0x25')](handleEntityNotFound(_0x511a12,null))[_0x85ad('0x25')](function(_0x3154e5){if(_0x3154e5){return _0x3154e5[_0x85ad('0x3b')]({'UserId':_0xcf6db4[_0x85ad('0x5c')]['UserId'],'read1stAt':_[_0x85ad('0x6b')](_0x3154e5[_0x85ad('0x6c')])?moment()[_0x85ad('0x63')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x415c06){if(_0x415c06){_0x1325d4[_0x85ad('0x6d')]=_0x415c06[_0x85ad('0x68')]({'plain':!![]});interaction_log[_0x85ad('0x26')](_0x85ad('0x6e'),_0xcf6db4['user']['id'],_0xcf6db4[_0x85ad('0x6f')]['name'],_0xcf6db4['user'][_0x85ad('0x70')],_0x1325d4[_0x85ad('0x6d')]['id'],_0xcf6db4[_0x85ad('0x5c')]?JSON['stringify'](_0xcf6db4[_0x85ad('0x5c')]):_0x85ad('0x71'));return respondWithRpcPromise(_0x85ad('0x72'),'acceptMessage',_0x1325d4);}return null;})['then'](function(_0x3855f8){if(_0x3855f8){if(_0xcf6db4[_0x85ad('0x5c')]['manual']){_0x1325d4['message'][_0x85ad('0x73')]=util[_0x85ad('0x63')]('SIP/%s',_0xcf6db4[_0x85ad('0x6f')][_0x85ad('0x3e')]);_0x1325d4[_0x85ad('0x2e')][_0x85ad('0x74')]=_0x1325d4[_0x85ad('0x74')];_0x1325d4[_0x85ad('0x2e')][_0x85ad('0x75')]='accept';return respondWithRpcPromise(_0x85ad('0x76'),_0x85ad('0x76'),{'event':_0x85ad('0x77'),'message':_0x1325d4[_0x85ad('0x2e')]},client9002)[_0x85ad('0x25')](function(){return _0x1325d4;});}return _0x1325d4;}return null;})[_0x85ad('0x25')](respondWithResult(_0x511a12,null))[_0x85ad('0x30')](handleError(_0x511a12,null));};var interaction_log=require(_0x85ad('0x15'))(_0x85ad('0x5e'));exports[_0x85ad('0x39')]=function(_0x571a09,_0xd93c79,_0x1c4598){var _0x3d95fc={'agent':{},'channel':_0x85ad('0x60')};if(_0x571a09[_0x85ad('0x5c')]['id']){delete _0x571a09[_0x85ad('0x5c')]['id'];}_0x571a09[_0x85ad('0x5c')][_0x85ad('0x65')]=_0x571a09[_0x85ad('0x5c')]['UserId']||_0x571a09[_0x85ad('0x6f')]['id'];_0x3d95fc[_0x85ad('0x78')]['id']=_0x571a09[_0x85ad('0x5c')][_0x85ad('0x65')];return db[_0x85ad('0x51')][_0x85ad('0x5a')]({'where':{'id':_0x571a09[_0x85ad('0x57')]['id'],'UserId':null}})[_0x85ad('0x25')](handleEntityNotFound(_0xd93c79,null))[_0x85ad('0x25')](function(_0x4d8efa){if(_0x4d8efa){_0x3d95fc['message']=_0x4d8efa[_0x85ad('0x68')]({'plain':!![]});return db[_0x85ad('0x69')][_0x85ad('0x5a')]({'where':{'id':_0x4d8efa[_0x85ad('0x6a')]}});}return null;})[_0x85ad('0x25')](handleEntityNotFound(_0xd93c79,null))[_0x85ad('0x25')](function(_0x4553c2){if(_0x4553c2){_0x3d95fc[_0x85ad('0x6d')]=_0x4553c2[_0x85ad('0x68')]({'plain':!![]});interaction_log[_0x85ad('0x26')](_0x85ad('0x79'),_0x571a09[_0x85ad('0x6f')]['id'],_0x571a09[_0x85ad('0x6f')][_0x85ad('0x3e')],_0x571a09[_0x85ad('0x6f')][_0x85ad('0x70')],_0x3d95fc[_0x85ad('0x6d')]['id'],_0x571a09[_0x85ad('0x5c')]?JSON['stringify'](_0x571a09[_0x85ad('0x5c')]):_0x85ad('0x71'));return respondWithRpcPromise(_0x85ad('0x7a'),'rejectMessage',_0x3d95fc);}return null;})[_0x85ad('0x25')](function(_0x4cf1fc){if(_0x4cf1fc){_0x4cf1fc[_0x85ad('0x2e')][_0x85ad('0x73')]=util[_0x85ad('0x63')](_0x85ad('0x7b'),_0x571a09['user'][_0x85ad('0x3e')]);_0x4cf1fc[_0x85ad('0x2e')][_0x85ad('0x74')]=_0x3d95fc[_0x85ad('0x74')];_0x4cf1fc[_0x85ad('0x2e')][_0x85ad('0x75')]='reject';respondWithRpcPromise(_0x85ad('0x76'),_0x85ad('0x76'),{'event':_0x85ad('0x7c'),'message':_0x4cf1fc[_0x85ad('0x2e')]},client9002);return _0x3d95fc;}return null;})[_0x85ad('0x25')](respondWithResult(_0xd93c79,null))[_0x85ad('0x30')](handleError(_0xd93c79,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 8bfa5d2..d4f57ec 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 _0xef57=['../../mysqldb','OpenchannelMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xef57,0x1ee));var _0x7ef5=function(_0x42ef63,_0x5ad086){_0x42ef63=_0x42ef63-0x0;var _0x1796c5=_0xef57[_0x42ef63];return _0x1796c5;};'use strict';var EventEmitter=require(_0x7ef5('0x0'));var OpenchannelMessage=require(_0x7ef5('0x1'))['db'][_0x7ef5('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x7ef5('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7ef5('0x4'),'afterDestroy':_0x7ef5('0x5')};function emitEvent(_0x403a4d){return function(_0x61266c,_0x4b0eb4,_0x35c1f7){OpenchannelMessageEvents['emit'](_0x403a4d+':'+_0x61266c['id'],_0x61266c);OpenchannelMessageEvents[_0x7ef5('0x6')](_0x403a4d,_0x61266c);_0x35c1f7(null);};}for(var e in events){if(events[_0x7ef5('0x7')](e)){var event=events[e];OpenchannelMessage[_0x7ef5('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0x65a6=['events','OpenchannelMessage','setMaxListeners','save','remove','emit','hook'];(function(_0x3d9d1e,_0x5d284a){var _0x58a4e2=function(_0x42d718){while(--_0x42d718){_0x3d9d1e['push'](_0x3d9d1e['shift']());}};_0x58a4e2(++_0x5d284a);}(_0x65a6,0x103));var _0x665a=function(_0x54ccd7,_0x3bc3ce){_0x54ccd7=_0x54ccd7-0x0;var _0x4e667b=_0x65a6[_0x54ccd7];return _0x4e667b;};'use strict';var EventEmitter=require(_0x665a('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x665a('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x665a('0x2')](0x0);var events={'afterCreate':_0x665a('0x3'),'afterUpdate':'update','afterDestroy':_0x665a('0x4')};function emitEvent(_0x300582){return function(_0x1775fc,_0x586db7,_0x4ebd02){OpenchannelMessageEvents[_0x665a('0x5')](_0x300582+':'+_0x1775fc['id'],_0x1775fc);OpenchannelMessageEvents['emit'](_0x300582,_0x1775fc);_0x4ebd02(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x665a('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 3f49280..14abc7b 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 _0x94cb=['api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','CmContact','OpenchannelAccount','find','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interaction','omit','POST','method','body','threadId','inspect','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0xe7281f,_0x2d77c3){var _0x90dc99=function(_0x1e335b){while(--_0x1e335b){_0xe7281f['push'](_0xe7281f['shift']());}};_0x90dc99(++_0x2d77c3);}(_0x94cb,0xcd));var _0xb94c=function(_0x41eabc,_0x5c0bcc){_0x41eabc=_0x41eabc-0x0;var _0x9ee4a4=_0x94cb[_0x41eabc];return _0x9ee4a4;};'use strict';var _=require(_0xb94c('0x0'));var util=require(_0xb94c('0x1'));var logger=require(_0xb94c('0x2'))(_0xb94c('0x3'));var moment=require('moment');var BPromise=require(_0xb94c('0x4'));var rp=require(_0xb94c('0x5'));var fs=require('fs');var path=require(_0xb94c('0x6'));var rimraf=require(_0xb94c('0x7'));var config=require(_0xb94c('0x8'));var attributes=require(_0xb94c('0x9'));module[_0xb94c('0xa')]=function(_0xc36ca2,_0x566c65){return _0xc36ca2[_0xb94c('0xb')](_0xb94c('0xc'),attributes,{'tableName':_0xb94c('0xd'),'paranoid':![],'indexes':[{'name':_0xb94c('0xe'),'fields':['body'],'type':_0xb94c('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4327a2,_0x524b62,_0x370fc1){var _0x209e7a=_0xc36ca2[_0xb94c('0x10')];var _0x56ad8f=_0x4327a2[_0xb94c('0x11')]({'plain':!![]});if(_0x56ad8f[_0xb94c('0x12')][_0xb94c('0x13')]()==='in'||_0x56ad8f[_0xb94c('0x12')][_0xb94c('0x13')]()===_0xb94c('0x14')&&!_0x56ad8f[_0xb94c('0x15')]&&!_[_0xb94c('0x16')](_0x56ad8f['UserId'])){_0x209e7a[_0xb94c('0x17')][_0xb94c('0x18')]({'where':{'id':_0x56ad8f[_0xb94c('0x19')]}})[_0xb94c('0x1a')](function(_0x322c8b){if(_0x322c8b){_0x322c8b[_0xb94c('0x1b')]({'lastMsgAt':_0x56ad8f[_0xb94c('0x1c')],'lastMsgDirection':_0x56ad8f[_0xb94c('0x12')]['toLowerCase']()});}})[_0xb94c('0x1d')](function(_0x1ce046){console[_0xb94c('0x1e')](_0x1ce046);});}if(_0x56ad8f[_0xb94c('0x12')]==='out'&&!_0x56ad8f[_0xb94c('0x15')]){var _0x13e08a;_0x209e7a[_0xb94c('0x1f')]['describe']()[_0xb94c('0x1a')](function(_0x108adc){return _0x209e7a[_0xb94c('0x20')][_0xb94c('0x21')]({'where':{'id':_0x56ad8f['OpenchannelAccountId']},'include':[{'model':_0x209e7a[_0xb94c('0x17')],'as':_0xb94c('0x22'),'where':{'id':_0x56ad8f[_0xb94c('0x19')]},'limit':0x1,'include':[{'model':_0x209e7a[_0xb94c('0x1f')],'as':_0xb94c('0x23'),'attributes':_[_0xb94c('0x24')](_0x108adc)}]}]});})['then'](function(_0x304a42){_0x13e08a=_0x304a42['get']({'plain':!![]});if(_0x13e08a&&_0x13e08a[_0xb94c('0x25')]){logger[_0xb94c('0x26')](_0xb94c('0x27'),_0xb94c('0x28'),util[_0xb94c('0x29')](_0xb94c('0x2a'),_0x56ad8f['id'],_0x13e08a['replyUri']));if(_0x13e08a[_0xb94c('0x22')]&&_0x13e08a['Interactions']['length']){_0x56ad8f[_0xb94c('0x2b')]=_[_0xb94c('0x2c')](_0x13e08a[_0xb94c('0x22')][0x0],'Contact');_0x56ad8f[_0xb94c('0x23')]=_0x13e08a[_0xb94c('0x22')][0x0]['Contact'];}var _0x524b62={'method':_0xb94c('0x2d'),'uri':encodeURI(_0x13e08a['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x524b62[_0xb94c('0x2e')]){case'GET':_0x524b62['qs']=_0x56ad8f;break;case _0xb94c('0x2d'):_0x524b62[_0xb94c('0x2f')]=_0x56ad8f;break;}return rp(_0x524b62)[_0xb94c('0x1a')](function(_0xf74405){logger['info'](_0xb94c('0x27'),'afterCreate',util[_0xb94c('0x29')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x56ad8f['id'],_0x13e08a['replyUri']));if(_0xf74405[_0xb94c('0x2f')]['threadId']&&_0xf74405[_0xb94c('0x2f')][_0xb94c('0x30')]!=_0x56ad8f[_0xb94c('0x2b')][_0xb94c('0x30')]){return _0x209e7a[_0xb94c('0x17')][_0xb94c('0x1b')]({'threadId':_0xf74405[_0xb94c('0x2f')][_0xb94c('0x30')]},{'logging':!![],'where':{'id':_0x56ad8f['Interaction']['id']}});}else{return;}})[_0xb94c('0x1a')](function(){return _0x4327a2[_0xb94c('0x1b')]({'read':!![]});})[_0xb94c('0x1d')](function(_0x3f3ade){logger['error'](_0xb94c('0x27'),_0xb94c('0x28'),util[_0xb94c('0x31')](_0x3f3ade,{'showHidden':![],'depth':null}));_0x370fc1();});}else{_0x370fc1();}})[_0xb94c('0x32')](function(){_0x370fc1();});}else{_0x370fc1();}}},'charset':'utf8mb4','collate':_0xb94c('0x33')});}; \ No newline at end of file +var _0xf625=['POST','format','threadId','inspect','finally','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','isNil','UserId','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','out','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteraction','Contact','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','Interaction','omit','GET'];(function(_0x243439,_0x32daf7){var _0x4ee7c8=function(_0x6d609a){while(--_0x6d609a){_0x243439['push'](_0x243439['shift']());}};_0x4ee7c8(++_0x32daf7);}(_0xf625,0x1b5));var _0x5f62=function(_0xfb8f31,_0x2d3880){_0xfb8f31=_0xfb8f31-0x0;var _0x28b6e0=_0xf625[_0xfb8f31];return _0x28b6e0;};'use strict';var _=require(_0x5f62('0x0'));var util=require(_0x5f62('0x1'));var logger=require(_0x5f62('0x2'))(_0x5f62('0x3'));var moment=require(_0x5f62('0x4'));var BPromise=require(_0x5f62('0x5'));var rp=require(_0x5f62('0x6'));var fs=require('fs');var path=require(_0x5f62('0x7'));var rimraf=require(_0x5f62('0x8'));var config=require(_0x5f62('0x9'));var attributes=require(_0x5f62('0xa'));module[_0x5f62('0xb')]=function(_0x398ead,_0x32edc7){return _0x398ead[_0x5f62('0xc')](_0x5f62('0xd'),attributes,{'tableName':_0x5f62('0xe'),'paranoid':![],'indexes':[{'name':_0x5f62('0xf'),'fields':[_0x5f62('0x10')],'type':_0x5f62('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xc22717,_0xc9006c,_0x3527e2){var _0x59dd62=_0x398ead[_0x5f62('0x12')];var _0x5e9ae6=_0xc22717[_0x5f62('0x13')]({'plain':!![]});if(_0x5e9ae6[_0x5f62('0x14')][_0x5f62('0x15')]()==='in'||_0x5e9ae6[_0x5f62('0x14')][_0x5f62('0x15')]()==='out'&&!_0x5e9ae6['secret']&&!_[_0x5f62('0x16')](_0x5e9ae6[_0x5f62('0x17')])){_0x59dd62['OpenchannelInteraction'][_0x5f62('0x18')]({'where':{'id':_0x5e9ae6[_0x5f62('0x19')]}})[_0x5f62('0x1a')](function(_0x45f9bc){if(_0x45f9bc){_0x45f9bc[_0x5f62('0x1b')]({'lastMsgAt':_0x5e9ae6[_0x5f62('0x1c')],'lastMsgDirection':_0x5e9ae6['direction'][_0x5f62('0x15')]()});}})[_0x5f62('0x1d')](function(_0x5d915f){console[_0x5f62('0x1e')](_0x5d915f);});}if(_0x5e9ae6[_0x5f62('0x14')]===_0x5f62('0x1f')&&!_0x5e9ae6['secret']){var _0x169bb2;_0x59dd62[_0x5f62('0x20')][_0x5f62('0x21')]()[_0x5f62('0x1a')](function(_0x46be4a){return _0x59dd62[_0x5f62('0x22')][_0x5f62('0x23')]({'where':{'id':_0x5e9ae6[_0x5f62('0x24')]},'include':[{'model':_0x59dd62[_0x5f62('0x25')],'as':'Interactions','where':{'id':_0x5e9ae6['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x59dd62[_0x5f62('0x20')],'as':_0x5f62('0x26'),'attributes':_['keys'](_0x46be4a)}]}]});})['then'](function(_0x2b9a67){_0x169bb2=_0x2b9a67[_0x5f62('0x13')]({'plain':!![]});if(_0x169bb2&&_0x169bb2[_0x5f62('0x27')]){logger[_0x5f62('0x28')](_0x5f62('0x29'),_0x5f62('0x2a'),util['format'](_0x5f62('0x2b'),_0x5e9ae6['id'],_0x169bb2['replyUri']));if(_0x169bb2[_0x5f62('0x2c')]&&_0x169bb2[_0x5f62('0x2c')][_0x5f62('0x2d')]){_0x5e9ae6[_0x5f62('0x2e')]=_[_0x5f62('0x2f')](_0x169bb2[_0x5f62('0x2c')][0x0],_0x5f62('0x26'));_0x5e9ae6[_0x5f62('0x26')]=_0x169bb2[_0x5f62('0x2c')][0x0]['Contact'];}var _0xc9006c={'method':'POST','uri':encodeURI(_0x169bb2[_0x5f62('0x27')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0xc9006c['method']){case _0x5f62('0x30'):_0xc9006c['qs']=_0x5e9ae6;break;case _0x5f62('0x31'):_0xc9006c[_0x5f62('0x10')]=_0x5e9ae6;break;}return rp(_0xc9006c)['then'](function(_0x14ec43){logger['info'](_0x5f62('0x29'),_0x5f62('0x2a'),util[_0x5f62('0x32')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x5e9ae6['id'],_0x169bb2['replyUri']));if(_0x14ec43[_0x5f62('0x10')][_0x5f62('0x33')]&&_0x14ec43[_0x5f62('0x10')][_0x5f62('0x33')]!=_0x5e9ae6[_0x5f62('0x2e')][_0x5f62('0x33')]){return _0x59dd62[_0x5f62('0x25')][_0x5f62('0x1b')]({'threadId':_0x14ec43[_0x5f62('0x10')][_0x5f62('0x33')]},{'logging':!![],'where':{'id':_0x5e9ae6[_0x5f62('0x2e')]['id']}});}else{return;}})[_0x5f62('0x1a')](function(){return _0xc22717[_0x5f62('0x1b')]({'read':!![]});})[_0x5f62('0x1d')](function(_0x4a1bab){logger[_0x5f62('0x1e')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0x5f62('0x34')](_0x4a1bab,{'showHidden':![],'depth':null}));_0x3527e2();});}else{_0x3527e2();}})[_0x5f62('0x35')](function(){_0x3527e2();});}else{_0x3527e2();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index fa23095..23b0feb 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 _0x7e27=['redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','then','request\x20sent','debug','error','code','OpenchannelMessage,\x20%s,\x20%s','message','info','result','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','stringify','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x7e27,0xdd));var _0x77e2=function(_0xf5cf2a,_0x58dda9){_0xf5cf2a=_0xf5cf2a-0x0;var _0x1596eb=_0x7e27[_0xf5cf2a];return _0x1596eb;};'use strict';var _=require(_0x77e2('0x0'));var util=require(_0x77e2('0x1'));var moment=require('moment');var BPromise=require(_0x77e2('0x2'));var rs=require(_0x77e2('0x3'));var fs=require('fs');var Redis=require(_0x77e2('0x4'));var db=require(_0x77e2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x77e2('0x6'))(_0x77e2('0x7'));var config=require(_0x77e2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x77e2('0x9')]['http']({'port':0x232a});config[_0x77e2('0xa')]=_[_0x77e2('0xb')](config['redis'],{'host':_0x77e2('0xc'),'port':0x18eb});var socket=require(_0x77e2('0xd'))(new Redis(config[_0x77e2('0xa')]));require(_0x77e2('0xe'))[_0x77e2('0xf')](socket);function respondWithRpcPromise(_0x1907e9,_0x23583e,_0x5a5789){return new BPromise(function(_0x5022db,_0x1b4740){return client['request'](_0x1907e9,_0x5a5789)[_0x77e2('0x10')](function(_0xf8293f){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x23583e,_0x77e2('0x11'));logger[_0x77e2('0x12')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x23583e,_0x77e2('0x11'),JSON['stringify'](_0xf8293f));if(_0xf8293f['error']){if(_0xf8293f[_0x77e2('0x13')][_0x77e2('0x14')]===0x1f4){logger[_0x77e2('0x13')](_0x77e2('0x15'),_0x23583e,_0xf8293f[_0x77e2('0x13')]['message']);return _0x1b4740(_0xf8293f[_0x77e2('0x13')][_0x77e2('0x16')]);}logger['error'](_0x77e2('0x15'),_0x23583e,_0xf8293f[_0x77e2('0x13')][_0x77e2('0x16')]);return _0x5022db(_0xf8293f[_0x77e2('0x13')][_0x77e2('0x16')]);}else{logger[_0x77e2('0x17')](_0x77e2('0x15'),_0x23583e,_0x77e2('0x11'));_0x5022db(_0xf8293f[_0x77e2('0x18')][_0x77e2('0x16')]);}})['catch'](function(_0x375fb0){logger[_0x77e2('0x13')](_0x77e2('0x15'),_0x23583e,_0x375fb0);_0x1b4740(_0x375fb0);});});}exports[_0x77e2('0x19')]=function(_0x3774b3){var _0x2aae6c=this;return new Promise(function(_0x1a5415,_0x1e5273){return db[_0x77e2('0x1a')][_0x77e2('0x1b')](_0x3774b3[_0x77e2('0x1c')],{'raw':_0x3774b3['options']?_0x3774b3[_0x77e2('0x1d')][_0x77e2('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x2d30d3){logger['info']('CreateOpenchannelMessage',_0x3774b3);logger[_0x77e2('0x12')]('CreateOpenchannelMessage',_0x3774b3,JSON[_0x77e2('0x1f')](_0x2d30d3));_0x1a5415(_0x2d30d3);})[_0x77e2('0x20')](function(_0x20eda4){logger['error']('CreateOpenchannelMessage',_0x20eda4[_0x77e2('0x16')],_0x3774b3);_0x1e5273(_0x2aae6c['error'](0x1f4,_0x20eda4[_0x77e2('0x16')]));});});}; \ No newline at end of file +var _0xc0f9=['../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','create','body','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc0f9,0xc5));var _0x9c0f=function(_0x45161c,_0x5494fc){_0x45161c=_0x45161c-0x0;var _0x186581=_0xc0f9[_0x45161c];return _0x186581;};'use strict';var _=require(_0x9c0f('0x0'));var util=require(_0x9c0f('0x1'));var moment=require(_0x9c0f('0x2'));var BPromise=require(_0x9c0f('0x3'));var rs=require(_0x9c0f('0x4'));var fs=require('fs');var Redis=require(_0x9c0f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9c0f('0x6'));var logger=require(_0x9c0f('0x7'))(_0x9c0f('0x8'));var config=require('../../config/environment');var jayson=require(_0x9c0f('0x9'));var client=jayson[_0x9c0f('0xa')][_0x9c0f('0xb')]({'port':0x232a});config[_0x9c0f('0xc')]=_['defaults'](config[_0x9c0f('0xc')],{'host':_0x9c0f('0xd'),'port':0x18eb});var socket=require(_0x9c0f('0xe'))(new Redis(config[_0x9c0f('0xc')]));require('./openchannelMessage.socket')[_0x9c0f('0xf')](socket);function respondWithRpcPromise(_0x15b0ca,_0x4902e8,_0x2edb0f){return new BPromise(function(_0x20e9d8,_0x17c8c3){return client[_0x9c0f('0x10')](_0x15b0ca,_0x2edb0f)[_0x9c0f('0x11')](function(_0x249674){logger[_0x9c0f('0x12')]('OpenchannelMessage,\x20%s,\x20%s',_0x4902e8,_0x9c0f('0x13'));logger[_0x9c0f('0x14')](_0x9c0f('0x15'),_0x4902e8,_0x9c0f('0x13'),JSON[_0x9c0f('0x16')](_0x249674));if(_0x249674[_0x9c0f('0x17')]){if(_0x249674[_0x9c0f('0x17')][_0x9c0f('0x18')]===0x1f4){logger[_0x9c0f('0x17')](_0x9c0f('0x19'),_0x4902e8,_0x249674[_0x9c0f('0x17')]['message']);return _0x17c8c3(_0x249674[_0x9c0f('0x17')]['message']);}logger[_0x9c0f('0x17')]('OpenchannelMessage,\x20%s,\x20%s',_0x4902e8,_0x249674[_0x9c0f('0x17')][_0x9c0f('0x1a')]);return _0x20e9d8(_0x249674[_0x9c0f('0x17')]['message']);}else{logger['info'](_0x9c0f('0x19'),_0x4902e8,_0x9c0f('0x13'));_0x20e9d8(_0x249674[_0x9c0f('0x1b')][_0x9c0f('0x1a')]);}})[_0x9c0f('0x1c')](function(_0x4e2496){logger[_0x9c0f('0x17')](_0x9c0f('0x19'),_0x4902e8,_0x4e2496);_0x17c8c3(_0x4e2496);});});}exports[_0x9c0f('0x1d')]=function(_0x1f3016){var _0x5758d3=this;return new Promise(function(_0x33dff7,_0x24a892){return db[_0x9c0f('0x1e')][_0x9c0f('0x1f')](_0x1f3016[_0x9c0f('0x20')],{'raw':_0x1f3016['options']?_0x1f3016['options'][_0x9c0f('0x21')]===undefined?!![]:![]:!![]})[_0x9c0f('0x11')](function(_0x3b16dc){logger[_0x9c0f('0x12')](_0x9c0f('0x1d'),_0x1f3016);logger['debug']('CreateOpenchannelMessage',_0x1f3016,JSON[_0x9c0f('0x16')](_0x3b16dc));_0x33dff7(_0x3b16dc);})[_0x9c0f('0x1c')](function(_0x5c4df9){logger[_0x9c0f('0x17')](_0x9c0f('0x1d'),_0x5c4df9[_0x9c0f('0x1a')],_0x1f3016);_0x24a892(_0x5758d3[_0x9c0f('0x17')](0x1f4,_0x5c4df9['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 345f9db..63b247b 100644 --- a/server/api/openchannelMessage/openchannelMessage.socket.js +++ b/server/api/openchannelMessage/openchannelMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['emit','removeListener','length','openchannelMessage:','remove','update'];(function(_0x4f9ed9,_0x5c65ac){var _0x4fe47a=function(_0xba221f){while(--_0xba221f){_0x4f9ed9['push'](_0x4f9ed9['shift']());}};_0x4fe47a(++_0x5c65ac);}(_0x9c44,0x178));var _0x49c4=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x9c44[_0x3511d3];return _0x5d6321;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0x49c4('0x0'),_0x49c4('0x1')];function createListener(_0x26844b,_0x1ba0bb){return function(_0x455700){_0x1ba0bb[_0x49c4('0x2')](_0x26844b,_0x455700);};}function removeListener(_0x4e0313,_0x4941f1){return function(){OpenchannelMessageEvents[_0x49c4('0x3')](_0x4e0313,_0x4941f1);};}exports['register']=function(_0xc1278f){for(var _0x6030ae=0x0,_0x69bc41=events[_0x49c4('0x4')];_0x6030ae<_0x69bc41;_0x6030ae++){var _0x436234=events[_0x6030ae];var _0x511d53=createListener(_0x49c4('0x5')+_0x436234,_0xc1278f);OpenchannelMessageEvents['on'](_0x436234,_0x511d53);}}; \ No newline at end of file +var _0xac4a=['save','remove','update','removeListener','./openchannelMessage.events'];(function(_0x2c4e32,_0x3a5590){var _0x1eac30=function(_0x236c8e){while(--_0x236c8e){_0x2c4e32['push'](_0x2c4e32['shift']());}};_0x1eac30(++_0x3a5590);}(_0xac4a,0x13f));var _0xaac4=function(_0x3e8524,_0x462c49){_0x3e8524=_0x3e8524-0x0;var _0x4139e1=_0xac4a[_0x3e8524];return _0x4139e1;};'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 c78299f..327413a 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 _0xb76d=['../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','create','post','addAgents','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x4c1140,_0x2a8df3){var _0x13a00a=function(_0x1338df){while(--_0x1338df){_0x4c1140['push'](_0x4c1140['shift']());}};_0x13a00a(++_0x2a8df3);}(_0xb76d,0x119));var _0xdb76=function(_0x8bd0e1,_0x290d76){_0x8bd0e1=_0x8bd0e1-0x0;var _0x19ea08=_0xb76d[_0x8bd0e1];return _0x19ea08;};'use strict';var multer=require(_0xdb76('0x0'));var util=require('util');var path=require(_0xdb76('0x1'));var timeout=require(_0xdb76('0x2'));var express=require(_0xdb76('0x3'));var router=express['Router']();var auth=require(_0xdb76('0x4'));var interaction=require(_0xdb76('0x5'));var config=require(_0xdb76('0x6'));var controller=require(_0xdb76('0x7'));router[_0xdb76('0x8')]('/',auth[_0xdb76('0x9')](),controller['index']);router[_0xdb76('0x8')](_0xdb76('0xa'),auth[_0xdb76('0x9')](),controller[_0xdb76('0xb')]);router['get'](_0xdb76('0xc'),auth[_0xdb76('0x9')](),controller['show']);router[_0xdb76('0x8')](_0xdb76('0xd'),auth[_0xdb76('0x9')](),controller[_0xdb76('0xe')]);router[_0xdb76('0x8')](_0xdb76('0xf'),auth[_0xdb76('0x9')](),controller['getTeams']);router['get'](_0xdb76('0x10'),auth[_0xdb76('0x9')](),controller[_0xdb76('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xdb76('0x12')]);router['post'](_0xdb76('0xf'),auth['isAuthenticated'](),controller['addTeams']);router[_0xdb76('0x13')](_0xdb76('0x10'),auth[_0xdb76('0x9')](),controller[_0xdb76('0x14')]);router['put'](_0xdb76('0xc'),auth[_0xdb76('0x9')](),controller['update']);router[_0xdb76('0x15')](_0xdb76('0xc'),auth[_0xdb76('0x9')](),controller[_0xdb76('0x16')]);router[_0xdb76('0x15')](_0xdb76('0xf'),auth['isAuthenticated'](),controller[_0xdb76('0x17')]);router[_0xdb76('0x15')](_0xdb76('0x10'),auth['isAuthenticated'](),controller[_0xdb76('0x18')]);module[_0xdb76('0x19')]=router; \ No newline at end of file +var _0x8375=['/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','create','post','addTeams','addAgents','put','update','delete','removeTeams','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelQueue.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x304e0a,_0x1e9d9f){var _0x19005c=function(_0x373b50){while(--_0x373b50){_0x304e0a['push'](_0x304e0a['shift']());}};_0x19005c(++_0x1e9d9f);}(_0x8375,0x132));var _0x5837=function(_0x246a4a,_0x5baf75){_0x246a4a=_0x246a4a-0x0;var _0x4b5730=_0x8375[_0x246a4a];return _0x4b5730;};'use strict';var multer=require('multer');var util=require(_0x5837('0x0'));var path=require(_0x5837('0x1'));var timeout=require(_0x5837('0x2'));var express=require(_0x5837('0x3'));var router=express[_0x5837('0x4')]();var auth=require(_0x5837('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5837('0x6'));var controller=require(_0x5837('0x7'));router['get']('/',auth[_0x5837('0x8')](),controller[_0x5837('0x9')]);router[_0x5837('0xa')](_0x5837('0xb'),auth['isAuthenticated'](),controller[_0x5837('0xc')]);router[_0x5837('0xa')](_0x5837('0xd'),auth[_0x5837('0x8')](),controller[_0x5837('0xe')]);router[_0x5837('0xa')](_0x5837('0xf'),auth[_0x5837('0x8')](),controller[_0x5837('0x10')]);router['get'](_0x5837('0x11'),auth[_0x5837('0x8')](),controller['getTeams']);router[_0x5837('0xa')](_0x5837('0x12'),auth['isAuthenticated'](),controller[_0x5837('0x13')]);router['post']('/',auth[_0x5837('0x8')](),controller[_0x5837('0x14')]);router[_0x5837('0x15')](_0x5837('0x11'),auth['isAuthenticated'](),controller[_0x5837('0x16')]);router[_0x5837('0x15')](_0x5837('0x12'),auth['isAuthenticated'](),controller[_0x5837('0x17')]);router[_0x5837('0x18')](_0x5837('0xd'),auth[_0x5837('0x8')](),controller[_0x5837('0x19')]);router[_0x5837('0x1a')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x5837('0x1a')](_0x5837('0x11'),auth[_0x5837('0x8')](),controller[_0x5837('0x1b')]);router[_0x5837('0x1a')](_0x5837('0x12'),auth[_0x5837('0x8')](),controller['removeAgents']);module[_0x5837('0x1c')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index b4b941f..cbf5a79 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 _0x9bb8=['STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x34ca7a,_0x2eecc2){var _0x12a55c=function(_0x546375){while(--_0x546375){_0x34ca7a['push'](_0x34ca7a['shift']());}};_0x12a55c(++_0x2eecc2);}(_0x9bb8,0x1ae));var _0x89bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9bb8[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x89bb('0x0'));module[_0x89bb('0x1')]={'name':{'type':Sequelize[_0x89bb('0x2')],'unique':_0x89bb('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x89bb('0x2')]},'timeout':{'type':Sequelize[_0x89bb('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x89bb('0x5')](_0x89bb('0x6'),_0x89bb('0x7'),_0x89bb('0x8'))}}; \ No newline at end of file +var _0x8343=['ENUM','sequelize','exports','STRING'];(function(_0x175ad6,_0x3891ae){var _0x19fa4f=function(_0x135851){while(--_0x135851){_0x175ad6['push'](_0x175ad6['shift']());}};_0x19fa4f(++_0x3891ae);}(_0x8343,0xa9));var _0x3834=function(_0x55af92,_0x1424f8){_0x55af92=_0x55af92-0x0;var _0x3a897d=_0x8343[_0x55af92];return _0x3a897d;};'use strict';var Sequelize=require(_0x3834('0x0'));module[_0x3834('0x1')]={'name':{'type':Sequelize[_0x3834('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3834('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3834('0x3')]('rrmemory','beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 245cbcc..20aaecf 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 _0x9e92=['openchannelPause','createdAt','format','%s/%s','SIP','updatedAt','Team','getTeams','addTeams','ids','online','voicePause','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','Agents','field','from','team_has_openchannel_queues','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','status','end','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','OpenchannelQueues','UserProfileResource','error','name','send','index','map','OpenchannelQueue','fieldName','type','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','count','findAll','rows','catch','show','params','keys','rawAttributes','length','includeAll','include','options','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','getMembers','findOne','UserOpenchannelQueue','order','OpenchannelQueueId','User','UserId','agent'];(function(_0x3ac1e4,_0x3664a2){var _0x5567b9=function(_0x445063){while(--_0x445063){_0x3ac1e4['push'](_0x3ac1e4['shift']());}};_0x5567b9(++_0x3664a2);}(_0x9e92,0xbb));var _0x29e9=function(_0x4e26da,_0x493d68){_0x4e26da=_0x4e26da-0x0;var _0x1635c2=_0x9e92[_0x4e26da];return _0x1635c2;};'use strict';var pdf=require(_0x29e9('0x0'));var emlformat=require(_0x29e9('0x1'));var rimraf=require(_0x29e9('0x2'));var zipdir=require(_0x29e9('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x29e9('0x4'));var moment=require(_0x29e9('0x5'));var BPromise=require(_0x29e9('0x6'));var Mustache=require(_0x29e9('0x7'));var util=require(_0x29e9('0x8'));var path=require(_0x29e9('0x9'));var sox=require(_0x29e9('0xa'));var csv=require(_0x29e9('0xb'));var ejs=require(_0x29e9('0xc'));var fs=require('fs');var _=require(_0x29e9('0xd'));var squel=require(_0x29e9('0xe'));var crypto=require(_0x29e9('0xf'));var jsforce=require(_0x29e9('0x10'));var deskjs=require(_0x29e9('0x11'));var toCsv=require(_0x29e9('0xb'));var querystring=require(_0x29e9('0x12'));var Papa=require(_0x29e9('0x13'));var Redis=require(_0x29e9('0x14'));var authService=require(_0x29e9('0x15'));var qs=require(_0x29e9('0x16'));var as=require(_0x29e9('0x17'));var hardwareService=require(_0x29e9('0x18'));var logger=require('../../config/logger')(_0x29e9('0x19'));var utils=require(_0x29e9('0x1a'));var config=require(_0x29e9('0x1b'));var db=require('../../mysqldb')['db'];config[_0x29e9('0x1c')]=_[_0x29e9('0x1d')](config[_0x29e9('0x1c')],{'host':_0x29e9('0x1e'),'port':0x18eb});var socket=require(_0x29e9('0x1f'))(new Redis(config[_0x29e9('0x1c')]));require(_0x29e9('0x20'))[_0x29e9('0x21')](socket);function respondWithStatusCode(_0x581e81,_0x2c69e3){_0x2c69e3=_0x2c69e3||0xcc;return function(_0x50d05e){if(_0x50d05e){return _0x581e81['sendStatus'](_0x2c69e3);}return _0x581e81[_0x29e9('0x22')](_0x2c69e3)[_0x29e9('0x23')]();};}function respondWithResult(_0x7bb70f,_0x46ed3c){_0x46ed3c=_0x46ed3c||0xc8;return function(_0x3ad70c){if(_0x3ad70c){return _0x7bb70f[_0x29e9('0x22')](_0x46ed3c)['json'](_0x3ad70c);}};}function respondWithFilteredResult(_0x18955d,_0x48dc04){return function(_0x2f5549){if(_0x2f5549){var _0xe86333=_0x2f5549['count'],_0x581fed=_0x48dc04[_0x29e9('0x24')],_0x556751=_0x48dc04[_0x29e9('0x24')]+_0x48dc04[_0x29e9('0x25')],_0x1c7993;if(_0x556751>=_0xe86333){_0x556751=_0xe86333;_0x1c7993=0xc8;}else{_0x1c7993=0xce;}_0x18955d[_0x29e9('0x22')](_0x1c7993);return _0x18955d[_0x29e9('0x26')](_0x29e9('0x27'),_0x581fed+'-'+_0x556751+'/'+_0xe86333)[_0x29e9('0x28')](_0x2f5549);}return null;};}function patchUpdates(_0x41369e){return function(_0x6c3098){try{jsonpatch['apply'](_0x6c3098,_0x41369e,!![]);}catch(_0x1ad939){return BPromise[_0x29e9('0x29')](_0x1ad939);}return _0x6c3098[_0x29e9('0x2a')]();};}function saveUpdates(_0x41213f,_0x5a0522){return function(_0x7ff397){if(_0x7ff397){return _0x7ff397[_0x29e9('0x2b')](_0x41213f)[_0x29e9('0x2c')](function(_0x5723df){return _0x5723df;});}return null;};}function removeEntity(_0x406fc8,_0x350145){return function(_0x4b5849){if(_0x4b5849){return _0x4b5849[_0x29e9('0x2d')]()['then'](function(){var _0x4545d1=_0x4b5849['get']({'plain':!![]});var _0x2e5b1e=_0x29e9('0x2e');return db[_0x29e9('0x2f')][_0x29e9('0x2d')]({'where':{'type':_0x2e5b1e,'resourceId':_0x4545d1['id']}})[_0x29e9('0x2c')](function(){return _0x4b5849;});})[_0x29e9('0x2c')](function(){_0x406fc8[_0x29e9('0x22')](0xcc)[_0x29e9('0x23')]();});}};}function handleEntityNotFound(_0x2fac06,_0x4dfa31){return function(_0x122001){if(!_0x122001){_0x2fac06['sendStatus'](0x194);}return _0x122001;};}function handleError(_0x5ad7f3,_0x49f3f8){_0x49f3f8=_0x49f3f8||0x1f4;return function(_0x22a40f){logger[_0x29e9('0x30')](_0x22a40f['stack']);if(_0x22a40f[_0x29e9('0x31')]){delete _0x22a40f[_0x29e9('0x31')];}_0x5ad7f3['status'](_0x49f3f8)[_0x29e9('0x32')](_0x22a40f);};}exports[_0x29e9('0x33')]=function(_0x485ea0,_0x25a1ae){var _0xfa3d66={},_0x445a2b={},_0x123502={'count':0x0,'rows':[]};var _0x57193a=_[_0x29e9('0x34')](db[_0x29e9('0x35')]['rawAttributes'],function(_0x32da5d){return{'name':_0x32da5d[_0x29e9('0x36')],'type':_0x32da5d[_0x29e9('0x37')]['key']};});_0x445a2b['model']=_[_0x29e9('0x34')](_0x57193a,'name');_0x445a2b[_0x29e9('0x38')]=_['keys'](_0x485ea0['query']);_0x445a2b[_0x29e9('0x39')]=_[_0x29e9('0x3a')](_0x445a2b[_0x29e9('0x3b')],_0x445a2b[_0x29e9('0x38')]);_0xfa3d66[_0x29e9('0x3c')]=_[_0x29e9('0x3a')](_0x445a2b[_0x29e9('0x3b')],qs[_0x29e9('0x3d')](_0x485ea0[_0x29e9('0x38')][_0x29e9('0x3d')]));_0xfa3d66[_0x29e9('0x3c')]=_0xfa3d66['attributes']['length']?_0xfa3d66[_0x29e9('0x3c')]:_0x445a2b['model'];if(!_0x485ea0[_0x29e9('0x38')][_0x29e9('0x3e')](_0x29e9('0x3f'))){_0xfa3d66['limit']=qs[_0x29e9('0x25')](_0x485ea0[_0x29e9('0x38')][_0x29e9('0x25')]);_0xfa3d66['offset']=qs[_0x29e9('0x24')](_0x485ea0['query'][_0x29e9('0x24')]);}_0xfa3d66['order']=qs[_0x29e9('0x40')](_0x485ea0[_0x29e9('0x38')][_0x29e9('0x40')]);_0xfa3d66[_0x29e9('0x41')]=qs[_0x29e9('0x39')](_[_0x29e9('0x42')](_0x485ea0[_0x29e9('0x38')],_0x445a2b[_0x29e9('0x39')]),_0x57193a);if(_0x485ea0[_0x29e9('0x38')][_0x29e9('0x43')]){_0xfa3d66['where']=_[_0x29e9('0x44')](_0xfa3d66[_0x29e9('0x41')],{'$or':_[_0x29e9('0x34')](_0x57193a,function(_0x5a69d7){if(_0x5a69d7['type']!==_0x29e9('0x45')){var _0x475c59={};_0x475c59[_0x5a69d7[_0x29e9('0x31')]]={'$like':'%'+_0x485ea0[_0x29e9('0x38')][_0x29e9('0x43')]+'%'};return _0x475c59;}})});}_0xfa3d66=_[_0x29e9('0x44')]({},_0xfa3d66,_0x485ea0['options']);var _0x2156f9={'where':_0xfa3d66[_0x29e9('0x41')]};return db[_0x29e9('0x35')][_0x29e9('0x46')](_0x2156f9)[_0x29e9('0x2c')](function(_0x2858f9){_0x123502[_0x29e9('0x46')]=_0x2858f9;if(_0x485ea0[_0x29e9('0x38')]['includeAll']){_0xfa3d66['include']=[{'all':!![]}];}return db[_0x29e9('0x35')][_0x29e9('0x47')](_0xfa3d66);})[_0x29e9('0x2c')](function(_0x411482){_0x123502[_0x29e9('0x48')]=_0x411482;return _0x123502;})[_0x29e9('0x2c')](respondWithFilteredResult(_0x25a1ae,_0xfa3d66))[_0x29e9('0x49')](handleError(_0x25a1ae,null));};exports[_0x29e9('0x4a')]=function(_0x49d14f,_0xc6f472){var _0x3f3d6e={'raw':!![],'where':{'id':_0x49d14f[_0x29e9('0x4b')]['id']}},_0xf28f07={};_0xf28f07[_0x29e9('0x3b')]=_[_0x29e9('0x4c')](db[_0x29e9('0x35')][_0x29e9('0x4d')]);_0xf28f07[_0x29e9('0x38')]=_[_0x29e9('0x4c')](_0x49d14f[_0x29e9('0x38')]);_0xf28f07['filters']=_['intersection'](_0xf28f07[_0x29e9('0x3b')],_0xf28f07[_0x29e9('0x38')]);_0x3f3d6e[_0x29e9('0x3c')]=_[_0x29e9('0x3a')](_0xf28f07['model'],qs[_0x29e9('0x3d')](_0x49d14f[_0x29e9('0x38')][_0x29e9('0x3d')]));_0x3f3d6e[_0x29e9('0x3c')]=_0x3f3d6e['attributes'][_0x29e9('0x4e')]?_0x3f3d6e['attributes']:_0xf28f07[_0x29e9('0x3b')];if(_0x49d14f[_0x29e9('0x38')][_0x29e9('0x4f')]){_0x3f3d6e[_0x29e9('0x50')]=[{'all':!![]}];}_0x3f3d6e=_[_0x29e9('0x44')]({},_0x3f3d6e,_0x49d14f[_0x29e9('0x51')]);return db[_0x29e9('0x35')][_0x29e9('0x52')](_0x3f3d6e)[_0x29e9('0x2c')](handleEntityNotFound(_0xc6f472,null))[_0x29e9('0x2c')](respondWithResult(_0xc6f472,null))[_0x29e9('0x49')](handleError(_0xc6f472,null));};exports[_0x29e9('0x53')]=function(_0x54a788,_0x556b8a){return db[_0x29e9('0x35')]['create'](_0x54a788[_0x29e9('0x54')],{})[_0x29e9('0x2c')](function(_0x1a1c28){var _0x1e60d7=_0x54a788[_0x29e9('0x55')][_0x29e9('0x56')]({'plain':!![]});if(!_0x1e60d7)throw new Error(_0x29e9('0x57'));if(_0x1e60d7[_0x29e9('0x58')]===_0x29e9('0x55')){var _0x4854bd=_0x1a1c28[_0x29e9('0x56')]({'plain':!![]});var _0x1ea269=_0x29e9('0x2e');return db[_0x29e9('0x59')][_0x29e9('0x52')]({'where':{'name':_0x1ea269,'userProfileId':_0x1e60d7[_0x29e9('0x5a')]},'raw':!![]})['then'](function(_0x119571){if(_0x119571&&_0x119571[_0x29e9('0x5b')]===0x0){return db[_0x29e9('0x2f')][_0x29e9('0x53')]({'name':_0x4854bd['name'],'resourceId':_0x4854bd['id'],'type':_0x119571[_0x29e9('0x31')],'sectionId':_0x119571['id']},{})[_0x29e9('0x2c')](function(){return _0x1a1c28;});}else{return _0x1a1c28;}})[_0x29e9('0x49')](function(_0x5ef5d6){logger[_0x29e9('0x30')](_0x29e9('0x5c'),_0x5ef5d6);throw _0x5ef5d6;});}return _0x1a1c28;})['then'](respondWithResult(_0x556b8a,0xc9))[_0x29e9('0x49')](handleError(_0x556b8a,null));};exports[_0x29e9('0x2b')]=function(_0x441385,_0x5337c5){if(_0x441385[_0x29e9('0x54')]['id']){delete _0x441385[_0x29e9('0x54')]['id'];}return db['OpenchannelQueue'][_0x29e9('0x52')]({'where':{'id':_0x441385[_0x29e9('0x4b')]['id']}})[_0x29e9('0x2c')](handleEntityNotFound(_0x5337c5,null))[_0x29e9('0x2c')](saveUpdates(_0x441385[_0x29e9('0x54')],null))[_0x29e9('0x2c')](respondWithResult(_0x5337c5,null))[_0x29e9('0x49')](handleError(_0x5337c5,null));};exports[_0x29e9('0x2d')]=function(_0x199f65,_0x2be916){return db['OpenchannelQueue'][_0x29e9('0x52')]({'where':{'id':_0x199f65['params']['id']}})['then'](handleEntityNotFound(_0x2be916,null))[_0x29e9('0x2c')](removeEntity(_0x2be916,null))['catch'](handleError(_0x2be916,null));};exports['describe']=function(_0x30abeb,_0x17cc8e){return db[_0x29e9('0x35')]['describe']()[_0x29e9('0x2c')](respondWithResult(_0x17cc8e,null))[_0x29e9('0x49')](handleError(_0x17cc8e,null));};exports[_0x29e9('0x5d')]=function(_0x394fe9,_0x15269c,_0x289edc){var _0x2a9f42={'raw':!![],'where':{}},_0x38f423={},_0x459bcd;return db['OpenchannelQueue'][_0x29e9('0x5e')]({'where':{'id':_0x394fe9[_0x29e9('0x4b')]['id']}})['then'](handleEntityNotFound(_0x15269c,null))[_0x29e9('0x2c')](function(_0x4f0825){if(_0x4f0825){_0x459bcd=_0x4f0825[_0x29e9('0x56')]({'plain':!![]});_0x38f423[_0x29e9('0x3b')]=_['keys'](db[_0x29e9('0x5f')][_0x29e9('0x4d')]);_0x38f423['query']=_[_0x29e9('0x4c')](_0x394fe9['query']);_0x38f423[_0x29e9('0x39')]=_[_0x29e9('0x3a')](_0x38f423['model'],_0x38f423[_0x29e9('0x38')]);_0x2a9f42['attributes']=_['intersection'](_0x38f423[_0x29e9('0x3b')],qs[_0x29e9('0x3d')](_0x394fe9[_0x29e9('0x38')][_0x29e9('0x3d')]));_0x2a9f42['attributes']=_0x2a9f42['attributes']['length']?_0x2a9f42[_0x29e9('0x3c')]:_0x38f423[_0x29e9('0x3b')];if(!_0x394fe9[_0x29e9('0x38')]['hasOwnProperty'](_0x29e9('0x3f'))){_0x2a9f42[_0x29e9('0x25')]=qs[_0x29e9('0x25')](_0x394fe9['query']['limit']);_0x2a9f42[_0x29e9('0x24')]=qs[_0x29e9('0x24')](_0x394fe9['query'][_0x29e9('0x24')]);}_0x2a9f42[_0x29e9('0x60')]=qs[_0x29e9('0x40')](_0x394fe9['query'][_0x29e9('0x40')]);_0x2a9f42['where']=qs[_0x29e9('0x39')](_[_0x29e9('0x42')](_0x394fe9[_0x29e9('0x38')],_0x38f423['filters']));_0x2a9f42['where'][_0x29e9('0x61')]=_0x4f0825['id'];if(_0x394fe9[_0x29e9('0x38')][_0x29e9('0x43')]){_0x2a9f42[_0x29e9('0x41')]=_['merge'](_0x2a9f42[_0x29e9('0x41')],{'$or':_[_0x29e9('0x34')](_0x2a9f42[_0x29e9('0x3c')],function(_0x160440){var _0x3d8170={};_0x3d8170[_0x160440]={'$like':'%'+_0x394fe9['query'][_0x29e9('0x43')]+'%'};return _0x3d8170;})});}_0x2a9f42=_['merge']({},_0x2a9f42,_0x394fe9['options']);return db[_0x29e9('0x5f')][_0x29e9('0x47')](_0x2a9f42);}})[_0x29e9('0x2c')](function(_0x1460ab){if(_0x1460ab){return db[_0x29e9('0x62')]['findAndCountAll']({'where':{'id':_[_0x29e9('0x34')](_0x1460ab,_0x29e9('0x63')),'role':_0x29e9('0x64')},'attributes':['id',_0x29e9('0x31'),_0x29e9('0x65'),'updatedAt',_0x29e9('0x66')]});}})[_0x29e9('0x2c')](function(_0x26caab){if(_0x26caab){return{'count':_0x26caab['count'],'rows':_[_0x29e9('0x34')](_0x26caab[_0x29e9('0x48')],function(_0x3f11cf){return{'membername':_0x3f11cf['name'],'UserId':_0x3f11cf['id'],'queue_name':_0x459bcd[_0x29e9('0x31')],'OpenchannelQueueId':_0x459bcd['id'],'interface':util[_0x29e9('0x67')](_0x29e9('0x68'),_0x29e9('0x69'),_0x3f11cf[_0x29e9('0x31')]),'penalty':0x0,'paused':_0x3f11cf[_0x29e9('0x65')],'createdAt':_0x3f11cf[_0x29e9('0x66')],'updatedAt':_0x3f11cf[_0x29e9('0x6a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x29e9('0x2c')](respondWithFilteredResult(_0x15269c,_0x2a9f42))['catch'](handleError(_0x15269c,null));};exports['getTeams']=function(_0xeaf4b7,_0x4f8686,_0x37c38c){var _0x39f8b9={};var _0x357ba8={};var _0x306076;var _0x4a3dc1;return db[_0x29e9('0x35')]['findOne']({'where':{'id':_0xeaf4b7[_0x29e9('0x4b')]['id']}})[_0x29e9('0x2c')](handleEntityNotFound(_0x4f8686,null))['then'](function(_0x40b82e){if(_0x40b82e){_0x306076=_0x40b82e;_0x357ba8[_0x29e9('0x3b')]=_[_0x29e9('0x4c')](db[_0x29e9('0x6b')]['rawAttributes']);_0x357ba8[_0x29e9('0x38')]=_[_0x29e9('0x4c')](_0xeaf4b7['query']);_0x357ba8[_0x29e9('0x39')]=_[_0x29e9('0x3a')](_0x357ba8['model'],_0x357ba8[_0x29e9('0x38')]);_0x39f8b9[_0x29e9('0x3c')]=_[_0x29e9('0x3a')](_0x357ba8[_0x29e9('0x3b')],qs['fields'](_0xeaf4b7[_0x29e9('0x38')][_0x29e9('0x3d')]));_0x39f8b9[_0x29e9('0x3c')]=_0x39f8b9[_0x29e9('0x3c')][_0x29e9('0x4e')]?_0x39f8b9[_0x29e9('0x3c')]:_0x357ba8[_0x29e9('0x3b')];_0x39f8b9['order']=qs[_0x29e9('0x40')](_0xeaf4b7[_0x29e9('0x38')]['sort']);_0x39f8b9[_0x29e9('0x41')]=qs['filters'](_[_0x29e9('0x42')](_0xeaf4b7['query'],_0x357ba8['filters']));if(_0xeaf4b7[_0x29e9('0x38')][_0x29e9('0x43')]){_0x39f8b9[_0x29e9('0x41')]=_[_0x29e9('0x44')](_0x39f8b9[_0x29e9('0x41')],{'$or':_[_0x29e9('0x34')](_0x39f8b9['attributes'],function(_0x31cfd2){var _0x2dd211={};_0x2dd211[_0x31cfd2]={'$like':'%'+_0xeaf4b7['query']['filter']+'%'};return _0x2dd211;})});}_0x39f8b9=_[_0x29e9('0x44')]({},_0x39f8b9,_0xeaf4b7[_0x29e9('0x51')]);return _0x306076[_0x29e9('0x6c')](_0x39f8b9);}})[_0x29e9('0x2c')](function(_0x109fb7){if(_0x109fb7){_0x4a3dc1=_0x109fb7['length'];if(!_0xeaf4b7[_0x29e9('0x38')][_0x29e9('0x3e')](_0x29e9('0x3f'))){_0x39f8b9['limit']=qs['limit'](_0xeaf4b7[_0x29e9('0x38')][_0x29e9('0x25')]);_0x39f8b9[_0x29e9('0x24')]=qs[_0x29e9('0x24')](_0xeaf4b7['query']['offset']);}return _0x306076[_0x29e9('0x6c')](_0x39f8b9);}})['then'](function(_0x59f705){if(_0x59f705){return _0x59f705?{'count':_0x4a3dc1,'rows':_0x59f705}:null;}})[_0x29e9('0x2c')](respondWithResult(_0x4f8686,null))['catch'](handleError(_0x4f8686,null));};exports[_0x29e9('0x6d')]=function(_0x21b9ad,_0xcf8dc4,_0x134b0a){var _0x490266=_0x21b9ad[_0x29e9('0x54')][_0x29e9('0x6e')];return db[_0x29e9('0x6b')][_0x29e9('0x47')]({'where':{'id':_0x490266},'attributes':['id'],'include':[{'model':db[_0x29e9('0x62')],'as':'Agents','attributes':['id','name',_0x29e9('0x6f'),_0x29e9('0x70'),'interface'],'raw':!![]}]})[_0x29e9('0x2c')](function(_0x55634e){if(_0x55634e){var _0x413d7e=_['flatMap'](_0x55634e,function(_0x351790){var _0x47f3c1=_0x351790[_0x29e9('0x56')]({'plain':!![]});return _0x47f3c1['Agents'];});return db['OpenchannelQueue'][_0x29e9('0x52')]({'where':{'id':_0x21b9ad[_0x29e9('0x4b')]['id']}})[_0x29e9('0x2c')](function(_0x68d7ac){return db[_0x29e9('0x71')][_0x29e9('0x72')](function(_0x5d7184){return _0x68d7ac[_0x29e9('0x6d')](_0x490266,{'transaction':_0x5d7184})[_0x29e9('0x2c')](function(){return BPromise[_0x29e9('0x73')](_0x413d7e,function(_0x182977){return db[_0x29e9('0x5f')][_0x29e9('0x74')]({'where':{'UserId':_0x182977['id'],'OpenchannelQueueId':_0x21b9ad[_0x29e9('0x4b')]['id']},'transaction':_0x5d7184});});})['then'](function(){_0x413d7e[_0x29e9('0x75')](function(_0x40bfc8){socket[_0x29e9('0x76')](_0x29e9('0x77'),{'UserId':_0x40bfc8['id'],'OpenchannelQueueId':_0x68d7ac['id']});});});});});}})[_0x29e9('0x2c')](respondWithStatusCode(_0xcf8dc4,null))['catch'](handleError(_0xcf8dc4,null));};exports[_0x29e9('0x78')]=function(_0x568945,_0x1f5cd3,_0x323cac){return db[_0x29e9('0x6b')][_0x29e9('0x47')]({'where':{'id':_0x568945[_0x29e9('0x38')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x29e9('0x79'),'attributes':['id'],'raw':!![]}]})[_0x29e9('0x2c')](handleEntityNotFound(_0x1f5cd3,null))[_0x29e9('0x2c')](function(_0x190438){var _0x33ec5c=_[_0x29e9('0x34')](_0x190438,'id');var _0x3fe8b6=[];var _0x351d6d=[];var _0xbdc658=squel['select']();_0xbdc658[_0x29e9('0x7a')]('tq.TeamId')[_0x29e9('0x7b')](_0x29e9('0x7c'),'tq')['join'](_0x29e9('0x7d'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x29e9('0x7e'),_0x568945[_0x29e9('0x4b')]['id']);for(var _0x2af32b=0x0;_0x2af32b<_0x190438[_0x29e9('0x4e')];_0x2af32b+=0x1){let _0x39fd2e=_0x190438[_0x2af32b];for(var _0x2bd68c=0x0;_0x2bd68c<_0x39fd2e['Agents']['length'];_0x2bd68c+=0x1){let _0x8fb7f5=_0x39fd2e[_0x29e9('0x79')][_0x2bd68c];var _0x11c078=_0xbdc658[_0x29e9('0x7f')]();_0x11c078['where'](_0x29e9('0x80'),_0x8fb7f5['id']);_0x351d6d[_0x29e9('0x81')](db['sequelize'][_0x29e9('0x38')](_0x11c078[_0x29e9('0x82')](),{'type':db[_0x29e9('0x71')]['QueryTypes'][_0x29e9('0x83')]})[_0x29e9('0x2c')](function(_0x57f27b){if(_0x57f27b[_0x29e9('0x4e')]===0x1){return _0x8fb7f5['id'];}else{var _0x1e893b=_[_0x29e9('0x84')](_[_0x29e9('0x34')](_0x57f27b,_0x29e9('0x85')),function(_0x11b126){return _[_0x29e9('0x86')](_0x33ec5c,_0x11b126);});if(_0x1e893b){return _0x8fb7f5['id'];}}}));}}return BPromise[_0x29e9('0x87')](_0x351d6d)[_0x29e9('0x2c')](function(_0x5646ca){_0x3fe8b6=_(_0x3fe8b6)['union'](_0x5646ca)['compact']()['value']();return db[_0x29e9('0x35')][_0x29e9('0x52')]({'where':{'id':_0x568945['params']['id']}})[_0x29e9('0x2c')](function(_0x119c90){return db[_0x29e9('0x71')][_0x29e9('0x72')](function(_0x356f24){return _0x119c90[_0x29e9('0x78')](_0x568945['query'][_0x29e9('0x6e')],{'transaction':_0x356f24})[_0x29e9('0x2c')](function(){if(!_[_0x29e9('0x88')](_0x3fe8b6)){return _0x119c90[_0x29e9('0x89')](_0x3fe8b6,{'transaction':_0x356f24});}})[_0x29e9('0x2c')](function(){_0x3fe8b6[_0x29e9('0x75')](function(_0x32d4c2){socket[_0x29e9('0x76')](_0x29e9('0x8a'),{'UserId':_0x32d4c2,'OpenchannelQueueId':_0x119c90['id']});});});});});});})[_0x29e9('0x2c')](respondWithStatusCode(_0x1f5cd3,null))[_0x29e9('0x49')](handleError(_0x1f5cd3,null));};exports[_0x29e9('0x8b')]=function(_0x253a26,_0x13423e,_0x2c9b9d){return db[_0x29e9('0x35')]['find']({'where':{'id':_0x253a26['params']['id']}})['then'](handleEntityNotFound(_0x13423e,null))[_0x29e9('0x2c')](function(_0x5a3370){if(_0x5a3370){return _0x5a3370[_0x29e9('0x8b')](_0x253a26['body']['ids'],_[_0x29e9('0x8c')](_0x253a26[_0x29e9('0x54')],[_0x29e9('0x6e'),'id'])||{})[_0x29e9('0x8d')](function(_0x1bbce1){for(var _0x5a84d3=0x0;_0x5a84d3<_0x253a26[_0x29e9('0x54')][_0x29e9('0x6e')][_0x29e9('0x4e')];_0x5a84d3+=0x1){socket[_0x29e9('0x76')](_0x29e9('0x77'),{'UserId':_0x253a26[_0x29e9('0x54')][_0x29e9('0x6e')][_0x5a84d3],'OpenchannelQueueId':_0x253a26['params']['id']});}return _0x1bbce1;});}})[_0x29e9('0x2c')](respondWithResult(_0x13423e,null))['catch'](handleError(_0x13423e,null));};exports['removeAgents']=function(_0x51f1cc,_0x4852a6,_0x28969f){return db[_0x29e9('0x35')][_0x29e9('0x52')]({'where':{'id':_0x51f1cc[_0x29e9('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4852a6,null))[_0x29e9('0x2c')](function(_0xfba854){if(_0xfba854){return _0xfba854[_0x29e9('0x89')](_0x51f1cc[_0x29e9('0x38')][_0x29e9('0x6e')])[_0x29e9('0x2c')](function(){if(_[_0x29e9('0x8e')](_0x51f1cc['query'][_0x29e9('0x6e')])){for(var _0x5345bc=0x0;_0x5345bc<_0x51f1cc[_0x29e9('0x38')][_0x29e9('0x6e')][_0x29e9('0x4e')];_0x5345bc+=0x1){socket[_0x29e9('0x76')](_0x29e9('0x8a'),{'UserId':Number(_0x51f1cc[_0x29e9('0x38')][_0x29e9('0x6e')][_0x5345bc]),'OpenchannelQueueId':Number(_0x51f1cc['params']['id'])});}}else{socket[_0x29e9('0x76')](_0x29e9('0x8a'),{'UserId':Number(_0x51f1cc['query'][_0x29e9('0x6e')]),'OpenchannelQueueId':Number(_0x51f1cc[_0x29e9('0x4b')]['id'])});}});}})[_0x29e9('0x2c')](respondWithStatusCode(_0x4852a6,null))[_0x29e9('0x49')](handleError(_0x4852a6,null));};exports['getAgents']=function(_0x5d7c52,_0x3c8b5b,_0x56716d){var _0x17a606={};var _0x1a3d56={};var _0x4f21c0;var _0x4d0fa1;return db['OpenchannelQueue'][_0x29e9('0x5e')]({'where':{'id':_0x5d7c52[_0x29e9('0x4b')]['id']}})[_0x29e9('0x2c')](handleEntityNotFound(_0x3c8b5b,null))[_0x29e9('0x2c')](function(_0x25e4e4){if(_0x25e4e4){_0x4f21c0=_0x25e4e4;_0x1a3d56['model']=_['keys'](db[_0x29e9('0x62')][_0x29e9('0x4d')]);_0x1a3d56[_0x29e9('0x38')]=_['keys'](_0x5d7c52[_0x29e9('0x38')]);_0x1a3d56[_0x29e9('0x39')]=_[_0x29e9('0x3a')](_0x1a3d56[_0x29e9('0x3b')],_0x1a3d56[_0x29e9('0x38')]);_0x17a606[_0x29e9('0x3c')]=_[_0x29e9('0x3a')](_0x1a3d56['model'],qs[_0x29e9('0x3d')](_0x5d7c52[_0x29e9('0x38')]['fields']));_0x17a606[_0x29e9('0x3c')]=_0x17a606['attributes'][_0x29e9('0x4e')]?_0x17a606[_0x29e9('0x3c')]:_0x1a3d56[_0x29e9('0x3b')];_0x17a606[_0x29e9('0x60')]=qs['sort'](_0x5d7c52['query'][_0x29e9('0x40')]);_0x17a606['where']=qs[_0x29e9('0x39')](_['pick'](_0x5d7c52[_0x29e9('0x38')],_0x1a3d56[_0x29e9('0x39')]));if(_0x5d7c52[_0x29e9('0x38')][_0x29e9('0x43')]){_0x17a606[_0x29e9('0x41')]=_[_0x29e9('0x44')](_0x17a606[_0x29e9('0x41')],{'$or':_[_0x29e9('0x34')](_0x17a606[_0x29e9('0x3c')],function(_0x30b62a){var _0x14f0d9={};_0x14f0d9[_0x30b62a]={'$like':'%'+_0x5d7c52[_0x29e9('0x38')][_0x29e9('0x43')]+'%'};return _0x14f0d9;})});}_0x17a606=_['merge']({},_0x17a606,_0x5d7c52['options']);return _0x4f21c0[_0x29e9('0x8f')](_0x17a606);}})[_0x29e9('0x2c')](function(_0x43e281){if(_0x43e281){_0x4d0fa1=_0x43e281[_0x29e9('0x4e')];if(!_0x5d7c52[_0x29e9('0x38')]['hasOwnProperty'](_0x29e9('0x3f'))){_0x17a606[_0x29e9('0x25')]=qs['limit'](_0x5d7c52[_0x29e9('0x38')][_0x29e9('0x25')]);_0x17a606[_0x29e9('0x24')]=qs['offset'](_0x5d7c52[_0x29e9('0x38')][_0x29e9('0x24')]);}return _0x4f21c0[_0x29e9('0x8f')](_0x17a606);}})[_0x29e9('0x2c')](function(_0x4a77ac){if(_0x4a77ac){return _0x4a77ac?{'count':_0x4d0fa1,'rows':_0x4a77ac}:null;}})[_0x29e9('0x2c')](respondWithResult(_0x3c8b5b,null))[_0x29e9('0x49')](handleError(_0x3c8b5b,null));}; \ No newline at end of file +var _0x8a10=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','describe','OpenchannelQueueId','filter','UserOpenchannelQueue','User','UserId','agent','updatedAt','rows','format','%s/%s','SIP','openchannelPause','getTeams','findOne','addTeams','ids','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','emit','userOpenchannelQueue:save','Team','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','every','TeamId','all','union','compact','value','isEmpty','removeAgents','forEach','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','sendStatus','status','end','count','offset','limit','json','apply','reject','save','then','destroy','get','OpenchannelQueues','error','stack','name','send','map','OpenchannelQueue','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','options','findAll','show','keys','rawAttributes','includeAll','include','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource'];(function(_0x2f3e61,_0x5084f7){var _0x51e717=function(_0x2bafe5){while(--_0x2bafe5){_0x2f3e61['push'](_0x2f3e61['shift']());}};_0x51e717(++_0x5084f7);}(_0x8a10,0x14c));var _0x08a1=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x8a10[_0x59ee6f];return _0x4c0979;};'use strict';var pdf=require(_0x08a1('0x0'));var emlformat=require(_0x08a1('0x1'));var rimraf=require(_0x08a1('0x2'));var zipdir=require(_0x08a1('0x3'));var jsonpatch=require(_0x08a1('0x4'));var rp=require(_0x08a1('0x5'));var moment=require('moment');var BPromise=require(_0x08a1('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x08a1('0x7'));var sox=require(_0x08a1('0x8'));var csv=require(_0x08a1('0x9'));var ejs=require(_0x08a1('0xa'));var fs=require('fs');var _=require(_0x08a1('0xb'));var squel=require(_0x08a1('0xc'));var crypto=require(_0x08a1('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x08a1('0xe'));var toCsv=require(_0x08a1('0x9'));var querystring=require(_0x08a1('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x08a1('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x08a1('0x11'));var logger=require(_0x08a1('0x12'))('api');var utils=require(_0x08a1('0x13'));var config=require('../../config/environment');var db=require(_0x08a1('0x14'))['db'];config[_0x08a1('0x15')]=_[_0x08a1('0x16')](config[_0x08a1('0x15')],{'host':_0x08a1('0x17'),'port':0x18eb});var socket=require(_0x08a1('0x18'))(new Redis(config[_0x08a1('0x15')]));require(_0x08a1('0x19'))['register'](socket);function respondWithStatusCode(_0x10bdf7,_0x10917f){_0x10917f=_0x10917f||0xcc;return function(_0x465e24){if(_0x465e24){return _0x10bdf7[_0x08a1('0x1a')](_0x10917f);}return _0x10bdf7[_0x08a1('0x1b')](_0x10917f)[_0x08a1('0x1c')]();};}function respondWithResult(_0x53e90c,_0x3bc28c){_0x3bc28c=_0x3bc28c||0xc8;return function(_0x4510fb){if(_0x4510fb){return _0x53e90c[_0x08a1('0x1b')](_0x3bc28c)['json'](_0x4510fb);}};}function respondWithFilteredResult(_0x30aec6,_0x3d343d){return function(_0x4d61ec){if(_0x4d61ec){var _0x332470=_0x4d61ec[_0x08a1('0x1d')],_0x14563d=_0x3d343d[_0x08a1('0x1e')],_0x33ec91=_0x3d343d[_0x08a1('0x1e')]+_0x3d343d[_0x08a1('0x1f')],_0x5175b6;if(_0x33ec91>=_0x332470){_0x33ec91=_0x332470;_0x5175b6=0xc8;}else{_0x5175b6=0xce;}_0x30aec6['status'](_0x5175b6);return _0x30aec6['set']('Content-Range',_0x14563d+'-'+_0x33ec91+'/'+_0x332470)[_0x08a1('0x20')](_0x4d61ec);}return null;};}function patchUpdates(_0x4d15c3){return function(_0x3fba9c){try{jsonpatch[_0x08a1('0x21')](_0x3fba9c,_0x4d15c3,!![]);}catch(_0x1776b6){return BPromise[_0x08a1('0x22')](_0x1776b6);}return _0x3fba9c[_0x08a1('0x23')]();};}function saveUpdates(_0x89c885,_0x5ab1a7){return function(_0x5ab3f5){if(_0x5ab3f5){return _0x5ab3f5['update'](_0x89c885)[_0x08a1('0x24')](function(_0x598c11){return _0x598c11;});}return null;};}function removeEntity(_0x5b1e4b,_0x4ac631){return function(_0x327de6){if(_0x327de6){return _0x327de6[_0x08a1('0x25')]()[_0x08a1('0x24')](function(){var _0x4fe9d4=_0x327de6[_0x08a1('0x26')]({'plain':!![]});var _0xff56e6=_0x08a1('0x27');return db['UserProfileResource'][_0x08a1('0x25')]({'where':{'type':_0xff56e6,'resourceId':_0x4fe9d4['id']}})[_0x08a1('0x24')](function(){return _0x327de6;});})['then'](function(){_0x5b1e4b['status'](0xcc)[_0x08a1('0x1c')]();});}};}function handleEntityNotFound(_0x29ab4f,_0x1fe391){return function(_0x14d461){if(!_0x14d461){_0x29ab4f[_0x08a1('0x1a')](0x194);}return _0x14d461;};}function handleError(_0x594485,_0x4c1bc3){_0x4c1bc3=_0x4c1bc3||0x1f4;return function(_0xaf74c0){logger[_0x08a1('0x28')](_0xaf74c0[_0x08a1('0x29')]);if(_0xaf74c0['name']){delete _0xaf74c0[_0x08a1('0x2a')];}_0x594485[_0x08a1('0x1b')](_0x4c1bc3)[_0x08a1('0x2b')](_0xaf74c0);};}exports['index']=function(_0x4b7d29,_0x3f57a2){var _0x4c6a41={},_0xd3de06={},_0x2b78f6={'count':0x0,'rows':[]};var _0x56a906=_[_0x08a1('0x2c')](db[_0x08a1('0x2d')]['rawAttributes'],function(_0x503efb){return{'name':_0x503efb['fieldName'],'type':_0x503efb[_0x08a1('0x2e')]['key']};});_0xd3de06[_0x08a1('0x2f')]=_['map'](_0x56a906,_0x08a1('0x2a'));_0xd3de06[_0x08a1('0x30')]=_['keys'](_0x4b7d29[_0x08a1('0x30')]);_0xd3de06[_0x08a1('0x31')]=_[_0x08a1('0x32')](_0xd3de06[_0x08a1('0x2f')],_0xd3de06['query']);_0x4c6a41['attributes']=_[_0x08a1('0x32')](_0xd3de06[_0x08a1('0x2f')],qs[_0x08a1('0x33')](_0x4b7d29[_0x08a1('0x30')][_0x08a1('0x33')]));_0x4c6a41[_0x08a1('0x34')]=_0x4c6a41[_0x08a1('0x34')][_0x08a1('0x35')]?_0x4c6a41[_0x08a1('0x34')]:_0xd3de06[_0x08a1('0x2f')];if(!_0x4b7d29['query'][_0x08a1('0x36')]('nolimit')){_0x4c6a41[_0x08a1('0x1f')]=qs[_0x08a1('0x1f')](_0x4b7d29[_0x08a1('0x30')][_0x08a1('0x1f')]);_0x4c6a41[_0x08a1('0x1e')]=qs[_0x08a1('0x1e')](_0x4b7d29['query'][_0x08a1('0x1e')]);}_0x4c6a41[_0x08a1('0x37')]=qs[_0x08a1('0x38')](_0x4b7d29[_0x08a1('0x30')][_0x08a1('0x38')]);_0x4c6a41[_0x08a1('0x39')]=qs[_0x08a1('0x31')](_[_0x08a1('0x3a')](_0x4b7d29[_0x08a1('0x30')],_0xd3de06[_0x08a1('0x31')]),_0x56a906);if(_0x4b7d29[_0x08a1('0x30')]['filter']){_0x4c6a41[_0x08a1('0x39')]=_[_0x08a1('0x3b')](_0x4c6a41[_0x08a1('0x39')],{'$or':_[_0x08a1('0x2c')](_0x56a906,function(_0x5039ec){if(_0x5039ec[_0x08a1('0x2e')]!=='VIRTUAL'){var _0x543657={};_0x543657[_0x5039ec['name']]={'$like':'%'+_0x4b7d29[_0x08a1('0x30')]['filter']+'%'};return _0x543657;}})});}_0x4c6a41=_['merge']({},_0x4c6a41,_0x4b7d29[_0x08a1('0x3c')]);var _0x1e7edc={'where':_0x4c6a41[_0x08a1('0x39')]};return db[_0x08a1('0x2d')][_0x08a1('0x1d')](_0x1e7edc)[_0x08a1('0x24')](function(_0x49b2f8){_0x2b78f6['count']=_0x49b2f8;if(_0x4b7d29[_0x08a1('0x30')]['includeAll']){_0x4c6a41['include']=[{'all':!![]}];}return db[_0x08a1('0x2d')][_0x08a1('0x3d')](_0x4c6a41);})[_0x08a1('0x24')](function(_0x4804a7){_0x2b78f6['rows']=_0x4804a7;return _0x2b78f6;})[_0x08a1('0x24')](respondWithFilteredResult(_0x3f57a2,_0x4c6a41))['catch'](handleError(_0x3f57a2,null));};exports[_0x08a1('0x3e')]=function(_0x27821a,_0x296bde){var _0x35893a={'raw':!![],'where':{'id':_0x27821a['params']['id']}},_0x3ccb20={};_0x3ccb20['model']=_[_0x08a1('0x3f')](db[_0x08a1('0x2d')][_0x08a1('0x40')]);_0x3ccb20['query']=_['keys'](_0x27821a[_0x08a1('0x30')]);_0x3ccb20['filters']=_[_0x08a1('0x32')](_0x3ccb20[_0x08a1('0x2f')],_0x3ccb20[_0x08a1('0x30')]);_0x35893a[_0x08a1('0x34')]=_[_0x08a1('0x32')](_0x3ccb20['model'],qs['fields'](_0x27821a[_0x08a1('0x30')]['fields']));_0x35893a['attributes']=_0x35893a[_0x08a1('0x34')][_0x08a1('0x35')]?_0x35893a[_0x08a1('0x34')]:_0x3ccb20[_0x08a1('0x2f')];if(_0x27821a[_0x08a1('0x30')][_0x08a1('0x41')]){_0x35893a[_0x08a1('0x42')]=[{'all':!![]}];}_0x35893a=_[_0x08a1('0x3b')]({},_0x35893a,_0x27821a[_0x08a1('0x3c')]);return db[_0x08a1('0x2d')][_0x08a1('0x43')](_0x35893a)['then'](handleEntityNotFound(_0x296bde,null))['then'](respondWithResult(_0x296bde,null))[_0x08a1('0x44')](handleError(_0x296bde,null));};exports[_0x08a1('0x45')]=function(_0x4b82e3,_0x5d971f){return db[_0x08a1('0x2d')][_0x08a1('0x45')](_0x4b82e3['body'],{})[_0x08a1('0x24')](function(_0x5aa60b){var _0x4523b7=_0x4b82e3[_0x08a1('0x46')][_0x08a1('0x26')]({'plain':!![]});if(!_0x4523b7)throw new Error(_0x08a1('0x47'));if(_0x4523b7[_0x08a1('0x48')]===_0x08a1('0x46')){var _0x28009d=_0x5aa60b[_0x08a1('0x26')]({'plain':!![]});var _0x318441=_0x08a1('0x27');return db[_0x08a1('0x49')]['find']({'where':{'name':_0x318441,'userProfileId':_0x4523b7[_0x08a1('0x4a')]},'raw':!![]})['then'](function(_0x594505){if(_0x594505&&_0x594505['autoAssociation']===0x0){return db[_0x08a1('0x4b')][_0x08a1('0x45')]({'name':_0x28009d[_0x08a1('0x2a')],'resourceId':_0x28009d['id'],'type':_0x594505[_0x08a1('0x2a')],'sectionId':_0x594505['id']},{})[_0x08a1('0x24')](function(){return _0x5aa60b;});}else{return _0x5aa60b;}})['catch'](function(_0x285329){logger[_0x08a1('0x28')](_0x08a1('0x4c'),_0x285329);throw _0x285329;});}return _0x5aa60b;})[_0x08a1('0x24')](respondWithResult(_0x5d971f,0xc9))[_0x08a1('0x44')](handleError(_0x5d971f,null));};exports[_0x08a1('0x4d')]=function(_0x5ed949,_0x2c756){if(_0x5ed949[_0x08a1('0x4e')]['id']){delete _0x5ed949[_0x08a1('0x4e')]['id'];}return db[_0x08a1('0x2d')]['find']({'where':{'id':_0x5ed949[_0x08a1('0x4f')]['id']}})[_0x08a1('0x24')](handleEntityNotFound(_0x2c756,null))[_0x08a1('0x24')](saveUpdates(_0x5ed949[_0x08a1('0x4e')],null))[_0x08a1('0x24')](respondWithResult(_0x2c756,null))[_0x08a1('0x44')](handleError(_0x2c756,null));};exports[_0x08a1('0x25')]=function(_0x1f6535,_0x37bad9){return db[_0x08a1('0x2d')]['find']({'where':{'id':_0x1f6535[_0x08a1('0x4f')]['id']}})['then'](handleEntityNotFound(_0x37bad9,null))[_0x08a1('0x24')](removeEntity(_0x37bad9,null))[_0x08a1('0x44')](handleError(_0x37bad9,null));};exports[_0x08a1('0x50')]=function(_0x5494dc,_0x566684){return db[_0x08a1('0x2d')][_0x08a1('0x50')]()['then'](respondWithResult(_0x566684,null))[_0x08a1('0x44')](handleError(_0x566684,null));};exports['getMembers']=function(_0x1809e0,_0x16f55c,_0x4e9391){var _0x40b2b4={'raw':!![],'where':{}},_0x1e59d4={},_0xbae201;return db[_0x08a1('0x2d')]['findOne']({'where':{'id':_0x1809e0[_0x08a1('0x4f')]['id']}})[_0x08a1('0x24')](handleEntityNotFound(_0x16f55c,null))[_0x08a1('0x24')](function(_0x1abb29){if(_0x1abb29){_0xbae201=_0x1abb29[_0x08a1('0x26')]({'plain':!![]});_0x1e59d4[_0x08a1('0x2f')]=_[_0x08a1('0x3f')](db['UserOpenchannelQueue'][_0x08a1('0x40')]);_0x1e59d4[_0x08a1('0x30')]=_[_0x08a1('0x3f')](_0x1809e0['query']);_0x1e59d4[_0x08a1('0x31')]=_[_0x08a1('0x32')](_0x1e59d4['model'],_0x1e59d4[_0x08a1('0x30')]);_0x40b2b4[_0x08a1('0x34')]=_['intersection'](_0x1e59d4[_0x08a1('0x2f')],qs[_0x08a1('0x33')](_0x1809e0[_0x08a1('0x30')]['fields']));_0x40b2b4['attributes']=_0x40b2b4[_0x08a1('0x34')][_0x08a1('0x35')]?_0x40b2b4[_0x08a1('0x34')]:_0x1e59d4['model'];if(!_0x1809e0['query'][_0x08a1('0x36')]('nolimit')){_0x40b2b4[_0x08a1('0x1f')]=qs[_0x08a1('0x1f')](_0x1809e0['query']['limit']);_0x40b2b4[_0x08a1('0x1e')]=qs[_0x08a1('0x1e')](_0x1809e0[_0x08a1('0x30')][_0x08a1('0x1e')]);}_0x40b2b4['order']=qs[_0x08a1('0x38')](_0x1809e0[_0x08a1('0x30')][_0x08a1('0x38')]);_0x40b2b4['where']=qs[_0x08a1('0x31')](_[_0x08a1('0x3a')](_0x1809e0['query'],_0x1e59d4[_0x08a1('0x31')]));_0x40b2b4[_0x08a1('0x39')][_0x08a1('0x51')]=_0x1abb29['id'];if(_0x1809e0[_0x08a1('0x30')][_0x08a1('0x52')]){_0x40b2b4[_0x08a1('0x39')]=_[_0x08a1('0x3b')](_0x40b2b4[_0x08a1('0x39')],{'$or':_[_0x08a1('0x2c')](_0x40b2b4[_0x08a1('0x34')],function(_0x53245a){var _0x3761d0={};_0x3761d0[_0x53245a]={'$like':'%'+_0x1809e0[_0x08a1('0x30')][_0x08a1('0x52')]+'%'};return _0x3761d0;})});}_0x40b2b4=_[_0x08a1('0x3b')]({},_0x40b2b4,_0x1809e0[_0x08a1('0x3c')]);return db[_0x08a1('0x53')][_0x08a1('0x3d')](_0x40b2b4);}})[_0x08a1('0x24')](function(_0x16d66d){if(_0x16d66d){return db[_0x08a1('0x54')]['findAndCountAll']({'where':{'id':_[_0x08a1('0x2c')](_0x16d66d,_0x08a1('0x55')),'role':_0x08a1('0x56')},'attributes':['id',_0x08a1('0x2a'),'openchannelPause',_0x08a1('0x57'),'createdAt']});}})[_0x08a1('0x24')](function(_0x220869){if(_0x220869){return{'count':_0x220869[_0x08a1('0x1d')],'rows':_[_0x08a1('0x2c')](_0x220869[_0x08a1('0x58')],function(_0x30eaff){return{'membername':_0x30eaff[_0x08a1('0x2a')],'UserId':_0x30eaff['id'],'queue_name':_0xbae201['name'],'OpenchannelQueueId':_0xbae201['id'],'interface':util[_0x08a1('0x59')](_0x08a1('0x5a'),_0x08a1('0x5b'),_0x30eaff['name']),'penalty':0x0,'paused':_0x30eaff[_0x08a1('0x5c')],'createdAt':_0x30eaff['createdAt'],'updatedAt':_0x30eaff[_0x08a1('0x57')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x08a1('0x24')](respondWithFilteredResult(_0x16f55c,_0x40b2b4))['catch'](handleError(_0x16f55c,null));};exports[_0x08a1('0x5d')]=function(_0x6ec5be,_0x2765b1,_0x5de3e1){var _0x183e66={};var _0x38e042={};var _0x4dc213;var _0x100142;return db[_0x08a1('0x2d')][_0x08a1('0x5e')]({'where':{'id':_0x6ec5be[_0x08a1('0x4f')]['id']}})[_0x08a1('0x24')](handleEntityNotFound(_0x2765b1,null))[_0x08a1('0x24')](function(_0x3e552c){if(_0x3e552c){_0x4dc213=_0x3e552c;_0x38e042[_0x08a1('0x2f')]=_['keys'](db['Team'][_0x08a1('0x40')]);_0x38e042['query']=_[_0x08a1('0x3f')](_0x6ec5be[_0x08a1('0x30')]);_0x38e042['filters']=_[_0x08a1('0x32')](_0x38e042[_0x08a1('0x2f')],_0x38e042[_0x08a1('0x30')]);_0x183e66[_0x08a1('0x34')]=_['intersection'](_0x38e042[_0x08a1('0x2f')],qs['fields'](_0x6ec5be[_0x08a1('0x30')][_0x08a1('0x33')]));_0x183e66[_0x08a1('0x34')]=_0x183e66['attributes']['length']?_0x183e66[_0x08a1('0x34')]:_0x38e042[_0x08a1('0x2f')];_0x183e66['order']=qs['sort'](_0x6ec5be[_0x08a1('0x30')]['sort']);_0x183e66[_0x08a1('0x39')]=qs[_0x08a1('0x31')](_[_0x08a1('0x3a')](_0x6ec5be[_0x08a1('0x30')],_0x38e042[_0x08a1('0x31')]));if(_0x6ec5be['query']['filter']){_0x183e66[_0x08a1('0x39')]=_['merge'](_0x183e66[_0x08a1('0x39')],{'$or':_['map'](_0x183e66[_0x08a1('0x34')],function(_0x29405c){var _0xb9b1fc={};_0xb9b1fc[_0x29405c]={'$like':'%'+_0x6ec5be[_0x08a1('0x30')][_0x08a1('0x52')]+'%'};return _0xb9b1fc;})});}_0x183e66=_['merge']({},_0x183e66,_0x6ec5be[_0x08a1('0x3c')]);return _0x4dc213[_0x08a1('0x5d')](_0x183e66);}})[_0x08a1('0x24')](function(_0x3883c6){if(_0x3883c6){_0x100142=_0x3883c6[_0x08a1('0x35')];if(!_0x6ec5be['query']['hasOwnProperty']('nolimit')){_0x183e66[_0x08a1('0x1f')]=qs[_0x08a1('0x1f')](_0x6ec5be[_0x08a1('0x30')][_0x08a1('0x1f')]);_0x183e66['offset']=qs[_0x08a1('0x1e')](_0x6ec5be[_0x08a1('0x30')][_0x08a1('0x1e')]);}return _0x4dc213[_0x08a1('0x5d')](_0x183e66);}})[_0x08a1('0x24')](function(_0xa25229){if(_0xa25229){return _0xa25229?{'count':_0x100142,'rows':_0xa25229}:null;}})['then'](respondWithResult(_0x2765b1,null))[_0x08a1('0x44')](handleError(_0x2765b1,null));};exports[_0x08a1('0x5f')]=function(_0x15a8c1,_0x380022,_0x25811d){var _0x3340b5=_0x15a8c1['body'][_0x08a1('0x60')];return db['Team'][_0x08a1('0x3d')]({'where':{'id':_0x3340b5},'attributes':['id'],'include':[{'model':db[_0x08a1('0x54')],'as':'Agents','attributes':['id',_0x08a1('0x2a'),_0x08a1('0x61'),_0x08a1('0x62'),_0x08a1('0x63')],'raw':!![]}]})[_0x08a1('0x24')](function(_0x1d405d){if(_0x1d405d){var _0x294102=_[_0x08a1('0x64')](_0x1d405d,function(_0x48e15a){var _0x2db710=_0x48e15a[_0x08a1('0x26')]({'plain':!![]});return _0x2db710[_0x08a1('0x65')];});return db['OpenchannelQueue']['find']({'where':{'id':_0x15a8c1[_0x08a1('0x4f')]['id']}})['then'](function(_0x2e8f8d){return db[_0x08a1('0x66')][_0x08a1('0x67')](function(_0x11cb8f){return _0x2e8f8d[_0x08a1('0x5f')](_0x3340b5,{'transaction':_0x11cb8f})[_0x08a1('0x24')](function(){return BPromise[_0x08a1('0x68')](_0x294102,function(_0x7080cb){return db[_0x08a1('0x53')][_0x08a1('0x69')]({'where':{'UserId':_0x7080cb['id'],'OpenchannelQueueId':_0x15a8c1[_0x08a1('0x4f')]['id']},'transaction':_0x11cb8f});});})[_0x08a1('0x24')](function(){_0x294102['forEach'](function(_0x56f986){socket[_0x08a1('0x6a')](_0x08a1('0x6b'),{'UserId':_0x56f986['id'],'OpenchannelQueueId':_0x2e8f8d['id']});});});});});}})[_0x08a1('0x24')](respondWithStatusCode(_0x380022,null))['catch'](handleError(_0x380022,null));};exports['removeTeams']=function(_0x1cd94a,_0x5c641f,_0x32b596){return db[_0x08a1('0x6c')][_0x08a1('0x3d')]({'where':{'id':_0x1cd94a[_0x08a1('0x30')][_0x08a1('0x60')]},'attributes':['id'],'include':[{'model':db[_0x08a1('0x54')],'as':_0x08a1('0x65'),'attributes':['id'],'raw':!![]}]})[_0x08a1('0x24')](handleEntityNotFound(_0x5c641f,null))[_0x08a1('0x24')](function(_0x3f9589){var _0x2cd47c=_[_0x08a1('0x2c')](_0x3f9589,'id');var _0x3f65ab=[];var _0x166f88=[];var _0x56852f=squel[_0x08a1('0x6d')]();_0x56852f[_0x08a1('0x6e')](_0x08a1('0x6f'))[_0x08a1('0x70')](_0x08a1('0x71'),'tq')[_0x08a1('0x72')](_0x08a1('0x73'),'ut',_0x08a1('0x74'))[_0x08a1('0x39')](_0x08a1('0x75'),_0x1cd94a[_0x08a1('0x4f')]['id']);for(var _0x181f5e=0x0;_0x181f5e<_0x3f9589[_0x08a1('0x35')];_0x181f5e+=0x1){let _0x3999f6=_0x3f9589[_0x181f5e];for(var _0x30014c=0x0;_0x30014c<_0x3999f6['Agents'][_0x08a1('0x35')];_0x30014c+=0x1){let _0x42132b=_0x3999f6[_0x08a1('0x65')][_0x30014c];var _0x43da3f=_0x56852f['clone']();_0x43da3f[_0x08a1('0x39')](_0x08a1('0x76'),_0x42132b['id']);_0x166f88[_0x08a1('0x77')](db[_0x08a1('0x66')][_0x08a1('0x30')](_0x43da3f[_0x08a1('0x78')](),{'type':db['sequelize']['QueryTypes']['SELECT']})[_0x08a1('0x24')](function(_0x122263){if(_0x122263['length']===0x1){return _0x42132b['id'];}else{var _0x19fa60=_[_0x08a1('0x79')](_[_0x08a1('0x2c')](_0x122263,_0x08a1('0x7a')),function(_0x59ad7b){return _['includes'](_0x2cd47c,_0x59ad7b);});if(_0x19fa60){return _0x42132b['id'];}}}));}}return BPromise[_0x08a1('0x7b')](_0x166f88)['then'](function(_0x38b652){_0x3f65ab=_(_0x3f65ab)[_0x08a1('0x7c')](_0x38b652)[_0x08a1('0x7d')]()[_0x08a1('0x7e')]();return db[_0x08a1('0x2d')][_0x08a1('0x43')]({'where':{'id':_0x1cd94a[_0x08a1('0x4f')]['id']}})[_0x08a1('0x24')](function(_0x466e3d){return db[_0x08a1('0x66')]['transaction'](function(_0x20ec23){return _0x466e3d['removeTeams'](_0x1cd94a[_0x08a1('0x30')][_0x08a1('0x60')],{'transaction':_0x20ec23})[_0x08a1('0x24')](function(){if(!_[_0x08a1('0x7f')](_0x3f65ab)){return _0x466e3d[_0x08a1('0x80')](_0x3f65ab,{'transaction':_0x20ec23});}})['then'](function(){_0x3f65ab[_0x08a1('0x81')](function(_0x194c9c){socket[_0x08a1('0x6a')](_0x08a1('0x82'),{'UserId':_0x194c9c,'OpenchannelQueueId':_0x466e3d['id']});});});});});});})[_0x08a1('0x24')](respondWithStatusCode(_0x5c641f,null))['catch'](handleError(_0x5c641f,null));};exports['addAgents']=function(_0x57760d,_0x1e1966,_0x4fb302){return db[_0x08a1('0x2d')][_0x08a1('0x43')]({'where':{'id':_0x57760d[_0x08a1('0x4f')]['id']}})[_0x08a1('0x24')](handleEntityNotFound(_0x1e1966,null))[_0x08a1('0x24')](function(_0x422391){if(_0x422391){return _0x422391[_0x08a1('0x83')](_0x57760d[_0x08a1('0x4e')][_0x08a1('0x60')],_[_0x08a1('0x84')](_0x57760d[_0x08a1('0x4e')],[_0x08a1('0x60'),'id'])||{})[_0x08a1('0x85')](function(_0x38e7db){for(var _0x27a96a=0x0;_0x27a96a<_0x57760d[_0x08a1('0x4e')][_0x08a1('0x60')][_0x08a1('0x35')];_0x27a96a+=0x1){socket['emit'](_0x08a1('0x6b'),{'UserId':_0x57760d['body'][_0x08a1('0x60')][_0x27a96a],'OpenchannelQueueId':_0x57760d[_0x08a1('0x4f')]['id']});}return _0x38e7db;});}})[_0x08a1('0x24')](respondWithResult(_0x1e1966,null))['catch'](handleError(_0x1e1966,null));};exports[_0x08a1('0x80')]=function(_0xb61d48,_0x5c61f8,_0x2d596f){return db[_0x08a1('0x2d')][_0x08a1('0x43')]({'where':{'id':_0xb61d48[_0x08a1('0x4f')]['id']}})[_0x08a1('0x24')](handleEntityNotFound(_0x5c61f8,null))['then'](function(_0x20df5c){if(_0x20df5c){return _0x20df5c[_0x08a1('0x80')](_0xb61d48[_0x08a1('0x30')][_0x08a1('0x60')])[_0x08a1('0x24')](function(){if(_[_0x08a1('0x86')](_0xb61d48[_0x08a1('0x30')]['ids'])){for(var _0x572485=0x0;_0x572485<_0xb61d48[_0x08a1('0x30')]['ids'][_0x08a1('0x35')];_0x572485+=0x1){socket['emit'](_0x08a1('0x82'),{'UserId':Number(_0xb61d48[_0x08a1('0x30')][_0x08a1('0x60')][_0x572485]),'OpenchannelQueueId':Number(_0xb61d48['params']['id'])});}}else{socket[_0x08a1('0x6a')](_0x08a1('0x82'),{'UserId':Number(_0xb61d48[_0x08a1('0x30')][_0x08a1('0x60')]),'OpenchannelQueueId':Number(_0xb61d48['params']['id'])});}});}})[_0x08a1('0x24')](respondWithStatusCode(_0x5c61f8,null))[_0x08a1('0x44')](handleError(_0x5c61f8,null));};exports[_0x08a1('0x87')]=function(_0x9dc70e,_0x32b6b5,_0x3d6cbb){var _0x39bc11={};var _0x1cd764={};var _0x21120e;var _0x1aff31;return db[_0x08a1('0x2d')][_0x08a1('0x5e')]({'where':{'id':_0x9dc70e[_0x08a1('0x4f')]['id']}})['then'](handleEntityNotFound(_0x32b6b5,null))[_0x08a1('0x24')](function(_0x1447cc){if(_0x1447cc){_0x21120e=_0x1447cc;_0x1cd764['model']=_[_0x08a1('0x3f')](db[_0x08a1('0x54')][_0x08a1('0x40')]);_0x1cd764[_0x08a1('0x30')]=_[_0x08a1('0x3f')](_0x9dc70e[_0x08a1('0x30')]);_0x1cd764[_0x08a1('0x31')]=_[_0x08a1('0x32')](_0x1cd764[_0x08a1('0x2f')],_0x1cd764[_0x08a1('0x30')]);_0x39bc11[_0x08a1('0x34')]=_['intersection'](_0x1cd764[_0x08a1('0x2f')],qs['fields'](_0x9dc70e['query'][_0x08a1('0x33')]));_0x39bc11[_0x08a1('0x34')]=_0x39bc11['attributes'][_0x08a1('0x35')]?_0x39bc11[_0x08a1('0x34')]:_0x1cd764[_0x08a1('0x2f')];_0x39bc11[_0x08a1('0x37')]=qs['sort'](_0x9dc70e['query'][_0x08a1('0x38')]);_0x39bc11[_0x08a1('0x39')]=qs[_0x08a1('0x31')](_['pick'](_0x9dc70e[_0x08a1('0x30')],_0x1cd764[_0x08a1('0x31')]));if(_0x9dc70e[_0x08a1('0x30')][_0x08a1('0x52')]){_0x39bc11[_0x08a1('0x39')]=_[_0x08a1('0x3b')](_0x39bc11['where'],{'$or':_[_0x08a1('0x2c')](_0x39bc11[_0x08a1('0x34')],function(_0xa6ef03){var _0x246c7b={};_0x246c7b[_0xa6ef03]={'$like':'%'+_0x9dc70e['query'][_0x08a1('0x52')]+'%'};return _0x246c7b;})});}_0x39bc11=_[_0x08a1('0x3b')]({},_0x39bc11,_0x9dc70e['options']);return _0x21120e[_0x08a1('0x87')](_0x39bc11);}})[_0x08a1('0x24')](function(_0x16ae84){if(_0x16ae84){_0x1aff31=_0x16ae84[_0x08a1('0x35')];if(!_0x9dc70e[_0x08a1('0x30')][_0x08a1('0x36')]('nolimit')){_0x39bc11[_0x08a1('0x1f')]=qs[_0x08a1('0x1f')](_0x9dc70e[_0x08a1('0x30')]['limit']);_0x39bc11[_0x08a1('0x1e')]=qs[_0x08a1('0x1e')](_0x9dc70e[_0x08a1('0x30')]['offset']);}return _0x21120e[_0x08a1('0x87')](_0x39bc11);}})['then'](function(_0x5b014e){if(_0x5b014e){return _0x5b014e?{'count':_0x1aff31,'rows':_0x5b014e}:null;}})[_0x08a1('0x24')](respondWithResult(_0x32b6b5,null))[_0x08a1('0x44')](handleError(_0x32b6b5,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 401db1b..775e085 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 _0xce57=['hook','exports','events','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x576885,_0x58bf74){var _0x566648=function(_0x2a2cf4){while(--_0x2a2cf4){_0x576885['push'](_0x576885['shift']());}};_0x566648(++_0x58bf74);}(_0xce57,0xaa));var _0x7ce5=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xce57[_0x5608a3];return _0x1ed50a;};'use strict';var EventEmitter=require(_0x7ce5('0x0'));var OpenchannelQueue=require('../../mysqldb')['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x7ce5('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7ce5('0x2'),'afterDestroy':'remove'};function emitEvent(_0x2acaaa){return function(_0x5b1a80,_0x539b36,_0x27cd36){OpenchannelQueueEvents[_0x7ce5('0x3')](_0x2acaaa+':'+_0x5b1a80['id'],_0x5b1a80);OpenchannelQueueEvents[_0x7ce5('0x3')](_0x2acaaa,_0x5b1a80);_0x27cd36(null);};}for(var e in events){if(events[_0x7ce5('0x4')](e)){var event=events[e];OpenchannelQueue[_0x7ce5('0x5')](e,emitEvent(event));}}module[_0x7ce5('0x6')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x6b2c=['exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','remove','emit','hasOwnProperty','hook'];(function(_0x4ec13d,_0x358a8f){var _0x3c3fa7=function(_0x2615f6){while(--_0x2615f6){_0x4ec13d['push'](_0x4ec13d['shift']());}};_0x3c3fa7(++_0x358a8f);}(_0x6b2c,0x76));var _0xc6b2=function(_0x3d8b90,_0x365e2d){_0x3d8b90=_0x3d8b90-0x0;var _0x48d8c5=_0x6b2c[_0x3d8b90];return _0x48d8c5;};'use strict';var EventEmitter=require(_0xc6b2('0x0'));var OpenchannelQueue=require(_0xc6b2('0x1'))['db'][_0xc6b2('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xc6b2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xc6b2('0x4')};function emitEvent(_0x42c6c8){return function(_0x400946,_0x28eee5,_0x4f5d6c){OpenchannelQueueEvents[_0xc6b2('0x5')](_0x42c6c8+':'+_0x400946['id'],_0x400946);OpenchannelQueueEvents[_0xc6b2('0x5')](_0x42c6c8,_0x400946);_0x4f5d6c(null);};}for(var e in events){if(events[_0xc6b2('0x6')](e)){var event=events[e];OpenchannelQueue[_0xc6b2('0x7')](e,emitEvent(event));}}module[_0xc6b2('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 91c94f9..ca6aecb 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 _0x55f2=['define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./openchannelQueue.attributes','exports'];(function(_0xf0375a,_0x22bcda){var _0x18dec9=function(_0x32835d){while(--_0x32835d){_0xf0375a['push'](_0xf0375a['shift']());}};_0x18dec9(++_0x22bcda);}(_0x55f2,0x117));var _0x255f=function(_0x132ced,_0x1e66a5){_0x132ced=_0x132ced-0x0;var _0x3fd4da=_0x55f2[_0x132ced];return _0x3fd4da;};'use strict';var _=require(_0x255f('0x0'));var util=require(_0x255f('0x1'));var logger=require(_0x255f('0x2'))(_0x255f('0x3'));var moment=require(_0x255f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x255f('0x5'));var config=require(_0x255f('0x6'));var attributes=require(_0x255f('0x7'));module[_0x255f('0x8')]=function(_0x297627,_0x141d43){return _0x297627[_0x255f('0x9')](_0x255f('0xa'),attributes,{'tableName':_0x255f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2452=['../../config/environment','./openchannelQueue.attributes','define','OpenchannelQueue','openchannel_queues','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x2452,0x179));var _0x2245=function(_0x397bb2,_0x98192){_0x397bb2=_0x397bb2-0x0;var _0xab0416=_0x2452[_0x397bb2];return _0xab0416;};'use strict';var _=require(_0x2245('0x0'));var util=require(_0x2245('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2245('0x2'));var BPromise=require(_0x2245('0x3'));var rp=require(_0x2245('0x4'));var fs=require('fs');var path=require(_0x2245('0x5'));var rimraf=require(_0x2245('0x6'));var config=require(_0x2245('0x7'));var attributes=require(_0x2245('0x8'));module['exports']=function(_0x243878,_0x2e05cc){return _0x243878[_0x2245('0x9')](_0x2245('0xa'),attributes,{'tableName':_0x2245('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 73a2219..0ff08f3 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 _0x7802=['jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','request','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','where','limit','include','attributes','model','map','info','ShowOpenchannelQueue','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x3001e8,_0x41f9d8){var _0x384b8e=function(_0x1c574a){while(--_0x1c574a){_0x3001e8['push'](_0x3001e8['shift']());}};_0x384b8e(++_0x41f9d8);}(_0x7802,0x89));var _0x2780=function(_0x5ec365,_0x49930c){_0x5ec365=_0x5ec365-0x0;var _0xab187d=_0x7802[_0x5ec365];return _0xab187d;};'use strict';var _=require(_0x2780('0x0'));var util=require(_0x2780('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2780('0x2'));var fs=require('fs');var Redis=require(_0x2780('0x3'));var db=require(_0x2780('0x4'))['db'];var utils=require(_0x2780('0x5'));var logger=require('../../config/logger')(_0x2780('0x6'));var config=require('../../config/environment');var jayson=require(_0x2780('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x2780('0x8')]=_[_0x2780('0x9')](config['redis'],{'host':_0x2780('0xa'),'port':0x18eb});var socket=require(_0x2780('0xb'))(new Redis(config[_0x2780('0x8')]));require(_0x2780('0xc'))['register'](socket);function respondWithRpcPromise(_0x5aee2c,_0x1003c4,_0x3113d9){return new BPromise(function(_0x37e170,_0xb8f191){return client[_0x2780('0xd')](_0x5aee2c,_0x3113d9)[_0x2780('0xe')](function(_0x8c2e6a){logger['info'](_0x2780('0xf'),_0x1003c4,_0x2780('0x10'));logger[_0x2780('0x11')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x1003c4,'request\x20sent',JSON[_0x2780('0x12')](_0x8c2e6a));if(_0x8c2e6a[_0x2780('0x13')]){if(_0x8c2e6a[_0x2780('0x13')][_0x2780('0x14')]===0x1f4){logger['error'](_0x2780('0xf'),_0x1003c4,_0x8c2e6a['error'][_0x2780('0x15')]);return _0xb8f191(_0x8c2e6a[_0x2780('0x13')]['message']);}logger['error'](_0x2780('0xf'),_0x1003c4,_0x8c2e6a[_0x2780('0x13')][_0x2780('0x15')]);return _0x37e170(_0x8c2e6a[_0x2780('0x13')][_0x2780('0x15')]);}else{logger['info'](_0x2780('0xf'),_0x1003c4,_0x2780('0x10'));_0x37e170(_0x8c2e6a[_0x2780('0x16')][_0x2780('0x15')]);}})[_0x2780('0x17')](function(_0x3e5e2b){logger[_0x2780('0x13')](_0x2780('0xf'),_0x1003c4,_0x3e5e2b);_0xb8f191(_0x3e5e2b);});});}exports[_0x2780('0x18')]=function(_0x3355a8){var _0x563bf7=this;return new Promise(function(_0x139a21,_0x1cfb8c){return db[_0x2780('0x19')][_0x2780('0x1a')]({'raw':_0x3355a8['options']?_0x3355a8[_0x2780('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3355a8[_0x2780('0x1b')]?_0x3355a8[_0x2780('0x1b')][_0x2780('0x1c')]||null:null,'attributes':_0x3355a8[_0x2780('0x1b')]?_0x3355a8[_0x2780('0x1b')]['attributes']||null:null,'limit':_0x3355a8[_0x2780('0x1b')]?_0x3355a8[_0x2780('0x1b')][_0x2780('0x1d')]||null:null,'include':_0x3355a8['options']?_0x3355a8[_0x2780('0x1b')]['include']?_['map'](_0x3355a8['options'][_0x2780('0x1e')],function(_0x265ad8){return{'model':db[_0x265ad8['model']],'as':_0x265ad8['as'],'attributes':_0x265ad8[_0x2780('0x1f')],'include':_0x265ad8[_0x2780('0x1e')]?_['map'](_0x265ad8['include'],function(_0x48c9ba){return{'model':db[_0x48c9ba[_0x2780('0x20')]],'as':_0x48c9ba['as'],'attributes':_0x48c9ba[_0x2780('0x1f')],'include':_0x48c9ba['include']?_[_0x2780('0x21')](_0x48c9ba['include'],function(_0x4a715f){return{'model':db[_0x4a715f['model']],'as':_0x4a715f['as'],'attributes':_0x4a715f[_0x2780('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x2780('0xe')](function(_0x5a1e8c){logger[_0x2780('0x22')](_0x2780('0x18'),_0x3355a8);logger[_0x2780('0x11')](_0x2780('0x18'),_0x3355a8,JSON['stringify'](_0x5a1e8c));_0x139a21(_0x5a1e8c);})[_0x2780('0x17')](function(_0x2e376e){logger[_0x2780('0x13')](_0x2780('0x18'),_0x2e376e[_0x2780('0x15')],_0x3355a8);_0x1cfb8c(_0x563bf7[_0x2780('0x13')](0x1f4,_0x2e376e['message']));});});};exports['ShowOpenchannelQueue']=function(_0x5957b0){var _0x51066c=this;return new Promise(function(_0x4c71d8,_0x138ed5){return db[_0x2780('0x19')]['find']({'raw':_0x5957b0[_0x2780('0x1b')]?_0x5957b0[_0x2780('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x5957b0[_0x2780('0x1b')]?_0x5957b0['options'][_0x2780('0x1c')]||null:null,'attributes':_0x5957b0[_0x2780('0x1b')]?_0x5957b0[_0x2780('0x1b')][_0x2780('0x1f')]||null:null,'include':_0x5957b0[_0x2780('0x1b')]?_0x5957b0[_0x2780('0x1b')]['include']?_[_0x2780('0x21')](_0x5957b0[_0x2780('0x1b')]['include'],function(_0x472cff){return{'model':db[_0x472cff[_0x2780('0x20')]],'as':_0x472cff['as'],'attributes':_0x472cff[_0x2780('0x1f')],'include':_0x472cff['include']?_['map'](_0x472cff[_0x2780('0x1e')],function(_0x5416ef){return{'model':db[_0x5416ef['model']],'as':_0x5416ef['as'],'attributes':_0x5416ef[_0x2780('0x1f')],'include':_0x5416ef['include']?_[_0x2780('0x21')](_0x5416ef[_0x2780('0x1e')],function(_0x548ae1){return{'model':db[_0x548ae1['model']],'as':_0x548ae1['as'],'attributes':_0x548ae1['attributes']};}):[]};}):[]};}):[]:[]})[_0x2780('0xe')](function(_0x573e79){logger[_0x2780('0x22')]('ShowOpenchannelQueue',_0x5957b0);logger[_0x2780('0x11')](_0x2780('0x23'),_0x5957b0,JSON[_0x2780('0x12')](_0x573e79));_0x4c71d8(_0x573e79);})[_0x2780('0x17')](function(_0x3df10b){logger[_0x2780('0x13')](_0x2780('0x23'),_0x3df10b[_0x2780('0x15')],_0x5957b0);_0x138ed5(_0x51066c[_0x2780('0x13')](0x1f4,_0x3df10b[_0x2780('0x15')]));});});}; \ No newline at end of file +var _0x397c=['code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','where','attributes','limit','include','map','model','debug','ShowOpenchannelQueue','find','raw','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./openchannelQueue.socket','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3ed6fd,_0x147c51){var _0x21ba5a=function(_0x5c7b8b){while(--_0x5c7b8b){_0x3ed6fd['push'](_0x3ed6fd['shift']());}};_0x21ba5a(++_0x147c51);}(_0x397c,0x1ac));var _0xc397=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x397c[_0x13b02f];return _0x12e9a6;};'use strict';var _=require(_0xc397('0x0'));var util=require(_0xc397('0x1'));var moment=require(_0xc397('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc397('0x3'))['db'];var utils=require(_0xc397('0x4'));var logger=require(_0xc397('0x5'))(_0xc397('0x6'));var config=require(_0xc397('0x7'));var jayson=require(_0xc397('0x8'));var client=jayson[_0xc397('0x9')][_0xc397('0xa')]({'port':0x232a});config[_0xc397('0xb')]=_[_0xc397('0xc')](config['redis'],{'host':_0xc397('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc397('0xe'))['register'](socket);function respondWithRpcPromise(_0x577985,_0x4fd98f,_0x2d0193){return new BPromise(function(_0x46579c,_0x542c6f){return client[_0xc397('0xf')](_0x577985,_0x2d0193)[_0xc397('0x10')](function(_0x3f9087){logger[_0xc397('0x11')](_0xc397('0x12'),_0x4fd98f,_0xc397('0x13'));logger['debug'](_0xc397('0x14'),_0x4fd98f,_0xc397('0x13'),JSON[_0xc397('0x15')](_0x3f9087));if(_0x3f9087['error']){if(_0x3f9087[_0xc397('0x16')][_0xc397('0x17')]===0x1f4){logger[_0xc397('0x16')](_0xc397('0x12'),_0x4fd98f,_0x3f9087[_0xc397('0x16')][_0xc397('0x18')]);return _0x542c6f(_0x3f9087['error'][_0xc397('0x18')]);}logger[_0xc397('0x16')](_0xc397('0x12'),_0x4fd98f,_0x3f9087[_0xc397('0x16')]['message']);return _0x46579c(_0x3f9087[_0xc397('0x16')]['message']);}else{logger[_0xc397('0x11')](_0xc397('0x12'),_0x4fd98f,_0xc397('0x13'));_0x46579c(_0x3f9087[_0xc397('0x19')][_0xc397('0x18')]);}})[_0xc397('0x1a')](function(_0x398e48){logger[_0xc397('0x16')](_0xc397('0x12'),_0x4fd98f,_0x398e48);_0x542c6f(_0x398e48);});});}exports[_0xc397('0x1b')]=function(_0x51b3ef){var _0x1e28c5=this;return new Promise(function(_0x102a9d,_0x4307cc){return db[_0xc397('0x1c')][_0xc397('0x1d')]({'raw':_0x51b3ef[_0xc397('0x1e')]?_0x51b3ef['options']['raw']===undefined?!![]:![]:!![],'where':_0x51b3ef[_0xc397('0x1e')]?_0x51b3ef[_0xc397('0x1e')][_0xc397('0x1f')]||null:null,'attributes':_0x51b3ef[_0xc397('0x1e')]?_0x51b3ef[_0xc397('0x1e')][_0xc397('0x20')]||null:null,'limit':_0x51b3ef[_0xc397('0x1e')]?_0x51b3ef[_0xc397('0x1e')][_0xc397('0x21')]||null:null,'include':_0x51b3ef[_0xc397('0x1e')]?_0x51b3ef[_0xc397('0x1e')][_0xc397('0x22')]?_[_0xc397('0x23')](_0x51b3ef[_0xc397('0x1e')][_0xc397('0x22')],function(_0x5895b2){return{'model':db[_0x5895b2[_0xc397('0x24')]],'as':_0x5895b2['as'],'attributes':_0x5895b2['attributes'],'include':_0x5895b2[_0xc397('0x22')]?_[_0xc397('0x23')](_0x5895b2[_0xc397('0x22')],function(_0x15f1cf){return{'model':db[_0x15f1cf[_0xc397('0x24')]],'as':_0x15f1cf['as'],'attributes':_0x15f1cf[_0xc397('0x20')],'include':_0x15f1cf[_0xc397('0x22')]?_[_0xc397('0x23')](_0x15f1cf[_0xc397('0x22')],function(_0x5d188b){return{'model':db[_0x5d188b[_0xc397('0x24')]],'as':_0x5d188b['as'],'attributes':_0x5d188b[_0xc397('0x20')]};}):[]};}):[]};}):[]:[]})[_0xc397('0x10')](function(_0x172a17){logger[_0xc397('0x11')](_0xc397('0x1b'),_0x51b3ef);logger[_0xc397('0x25')](_0xc397('0x1b'),_0x51b3ef,JSON[_0xc397('0x15')](_0x172a17));_0x102a9d(_0x172a17);})[_0xc397('0x1a')](function(_0x59d27e){logger[_0xc397('0x16')](_0xc397('0x1b'),_0x59d27e[_0xc397('0x18')],_0x51b3ef);_0x4307cc(_0x1e28c5['error'](0x1f4,_0x59d27e['message']));});});};exports[_0xc397('0x26')]=function(_0x3b8fd3){var _0x1e7df4=this;return new Promise(function(_0x40e5d4,_0x29cddc){return db[_0xc397('0x1c')][_0xc397('0x27')]({'raw':_0x3b8fd3[_0xc397('0x1e')]?_0x3b8fd3[_0xc397('0x1e')][_0xc397('0x28')]===undefined?!![]:![]:!![],'where':_0x3b8fd3[_0xc397('0x1e')]?_0x3b8fd3['options'][_0xc397('0x1f')]||null:null,'attributes':_0x3b8fd3[_0xc397('0x1e')]?_0x3b8fd3['options'][_0xc397('0x20')]||null:null,'include':_0x3b8fd3[_0xc397('0x1e')]?_0x3b8fd3[_0xc397('0x1e')][_0xc397('0x22')]?_[_0xc397('0x23')](_0x3b8fd3[_0xc397('0x1e')]['include'],function(_0x285cca){return{'model':db[_0x285cca[_0xc397('0x24')]],'as':_0x285cca['as'],'attributes':_0x285cca[_0xc397('0x20')],'include':_0x285cca[_0xc397('0x22')]?_[_0xc397('0x23')](_0x285cca['include'],function(_0x350b38){return{'model':db[_0x350b38[_0xc397('0x24')]],'as':_0x350b38['as'],'attributes':_0x350b38[_0xc397('0x20')],'include':_0x350b38[_0xc397('0x22')]?_[_0xc397('0x23')](_0x350b38[_0xc397('0x22')],function(_0x1e0cbe){return{'model':db[_0x1e0cbe['model']],'as':_0x1e0cbe['as'],'attributes':_0x1e0cbe[_0xc397('0x20')]};}):[]};}):[]};}):[]:[]})[_0xc397('0x10')](function(_0x37cb1c){logger[_0xc397('0x11')](_0xc397('0x26'),_0x3b8fd3);logger[_0xc397('0x25')](_0xc397('0x26'),_0x3b8fd3,JSON[_0xc397('0x15')](_0x37cb1c));_0x40e5d4(_0x37cb1c);})['catch'](function(_0x11410e){logger[_0xc397('0x16')](_0xc397('0x26'),_0x11410e['message'],_0x3b8fd3);_0x29cddc(_0x1e7df4['error'](0x1f4,_0x11410e['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 02cf086..c9aa384 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 _0xe785=['update','emit','register','./openchannelQueue.events','save'];(function(_0xd8de73,_0x1b75aa){var _0x10a1b5=function(_0x3172bb){while(--_0x3172bb){_0xd8de73['push'](_0xd8de73['shift']());}};_0x10a1b5(++_0x1b75aa);}(_0xe785,0x18e));var _0x5e78=function(_0xa28f4a,_0x3b38ec){_0xa28f4a=_0xa28f4a-0x0;var _0x1c57a3=_0xe785[_0xa28f4a];return _0x1c57a3;};'use strict';var OpenchannelQueueEvents=require(_0x5e78('0x0'));var events=[_0x5e78('0x1'),'remove',_0x5e78('0x2')];function createListener(_0x4ce530,_0x13182c){return function(_0x4326dc){_0x13182c[_0x5e78('0x3')](_0x4ce530,_0x4326dc);};}function removeListener(_0x5822c3,_0x275dc3){return function(){OpenchannelQueueEvents['removeListener'](_0x5822c3,_0x275dc3);};}exports[_0x5e78('0x4')]=function(_0x2631f0){for(var _0x22ca92=0x0,_0x12be06=events['length'];_0x22ca92<_0x12be06;_0x22ca92++){var _0x1f2b76=events[_0x22ca92];var _0x592cf5=createListener('openchannelQueue:'+_0x1f2b76,_0x2631f0);OpenchannelQueueEvents['on'](_0x1f2b76,_0x592cf5);}}; \ No newline at end of file +var _0xab43=['register','length','openchannelQueue:','./openchannelQueue.events','save','remove','update','emit','removeListener'];(function(_0x4fa88f,_0x540865){var _0x94ea74=function(_0x4e294b){while(--_0x4e294b){_0x4fa88f['push'](_0x4fa88f['shift']());}};_0x94ea74(++_0x540865);}(_0xab43,0x1e0));var _0x3ab4=function(_0x4fda71,_0x40bff0){_0x4fda71=_0x4fda71-0x0;var _0x3c81e1=_0xab43[_0x4fda71];return _0x3c81e1;};'use strict';var OpenchannelQueueEvents=require(_0x3ab4('0x0'));var events=[_0x3ab4('0x1'),_0x3ab4('0x2'),_0x3ab4('0x3')];function createListener(_0x31efda,_0x154dfe){return function(_0xa3eede){_0x154dfe[_0x3ab4('0x4')](_0x31efda,_0xa3eede);};}function removeListener(_0x1e600a,_0x4cb7b2){return function(){OpenchannelQueueEvents[_0x3ab4('0x5')](_0x1e600a,_0x4cb7b2);};}exports[_0x3ab4('0x6')]=function(_0x244f85){for(var _0x511984=0x0,_0x22c4bf=events[_0x3ab4('0x7')];_0x511984<_0x22c4bf;_0x511984++){var _0x50baaf=events[_0x511984];var _0x2952dc=createListener(_0x3ab4('0x8')+_0x50baaf,_0x244f85);OpenchannelQueueEvents['on'](_0x50baaf,_0x2952dc);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 0e6cca9..b478ee6 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 _0xce50=['update','delete','destroy','exports','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create'];(function(_0x15b6bf,_0x2d39df){var _0x1f41a3=function(_0x115e1d){while(--_0x115e1d){_0x15b6bf['push'](_0x15b6bf['shift']());}};_0x1f41a3(++_0x2d39df);}(_0xce50,0x147));var _0x0ce5=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xce50[_0x36eaaa];return _0x461349;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0ce5('0x0'));var timeout=require('connect-timeout');var express=require(_0x0ce5('0x1'));var router=express[_0x0ce5('0x2')]();var auth=require(_0x0ce5('0x3'));var interaction=require(_0x0ce5('0x4'));var config=require(_0x0ce5('0x5'));var controller=require(_0x0ce5('0x6'));router[_0x0ce5('0x7')]('/',auth[_0x0ce5('0x8')](),controller[_0x0ce5('0x9')]);router[_0x0ce5('0x7')](_0x0ce5('0xa'),auth[_0x0ce5('0x8')](),controller[_0x0ce5('0xb')]);router['get']('/:id',auth[_0x0ce5('0x8')](),controller[_0x0ce5('0xc')]);router[_0x0ce5('0xd')]('/',auth['isAuthenticated'](),controller[_0x0ce5('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0ce5('0xf')]);router[_0x0ce5('0x10')]('/:id',auth[_0x0ce5('0x8')](),controller[_0x0ce5('0x11')]);module[_0x0ce5('0x12')]=router; \ No newline at end of file +var _0x89c0=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','/:id','update','delete','destroy','exports','multer'];(function(_0x4897fe,_0x48d158){var _0x52936d=function(_0x337683){while(--_0x337683){_0x4897fe['push'](_0x4897fe['shift']());}};_0x52936d(++_0x48d158);}(_0x89c0,0x1af));var _0x089c=function(_0x299ae2,_0x23a965){_0x299ae2=_0x299ae2-0x0;var _0x3f4b89=_0x89c0[_0x299ae2];return _0x3f4b89;};'use strict';var multer=require(_0x089c('0x0'));var util=require(_0x089c('0x1'));var path=require(_0x089c('0x2'));var timeout=require(_0x089c('0x3'));var express=require(_0x089c('0x4'));var router=express[_0x089c('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x089c('0x6'));var config=require(_0x089c('0x7'));var controller=require(_0x089c('0x8'));router[_0x089c('0x9')]('/',auth[_0x089c('0xa')](),controller[_0x089c('0xb')]);router[_0x089c('0x9')](_0x089c('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x089c('0x9')](_0x089c('0xd'),auth[_0x089c('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x089c('0xd'),auth[_0x089c('0xa')](),controller[_0x089c('0xe')]);router[_0x089c('0xf')](_0x089c('0xd'),auth[_0x089c('0xa')](),controller[_0x089c('0x10')]);module[_0x089c('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 6ec91e0..ab6f198 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 _0xb04a=['DATE','sequelize','exports'];(function(_0x2a767c,_0x1342d7){var _0x373f2a=function(_0x1e1efa){while(--_0x1e1efa){_0x2a767c['push'](_0x2a767c['shift']());}};_0x373f2a(++_0x1342d7);}(_0xb04a,0x160));var _0xab04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb04a[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require('moment');var Sequelize=require(_0xab04('0x0'));module[_0xab04('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xab04('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xab04('0x2')]},'exitAt':{'type':Sequelize[_0xab04('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4d3c=['exports','STRING','DATE','sequelize'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x4d3c,0xc7));var _0xc4d3=function(_0x2d4b57,_0x3f6d02){_0x2d4b57=_0x2d4b57-0x0;var _0x12cac7=_0x4d3c[_0x2d4b57];return _0x12cac7;};'use strict';var moment=require('moment');var Sequelize=require(_0xc4d3('0x0'));module[_0xc4d3('0x1')]={'uniqueid':{'type':Sequelize[_0xc4d3('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xc4d3('0x2')]},'joinAt':{'type':Sequelize[_0xc4d3('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xc4d3('0x3')]},'exitAt':{'type':Sequelize[_0xc4d3('0x3')]},'reason':{'type':Sequelize[_0xc4d3('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index dff3d98..2c9f1d6 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 _0x7bca=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','json','count','offset','limit','apply','reject','save','update','then','destroy','end','sendStatus','name','send','index','OpenchannelQueueReport','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','findAll','rows','params','include','options','catch','create','body','find','describe'];(function(_0x1e1963,_0x5ec40a){var _0x1bc5c6=function(_0x4faea5){while(--_0x4faea5){_0x1e1963['push'](_0x1e1963['shift']());}};_0x1bc5c6(++_0x5ec40a);}(_0x7bca,0x163));var _0xa7bc=function(_0x53ff3b,_0x58f396){_0x53ff3b=_0x53ff3b-0x0;var _0x4d7ac2=_0x7bca[_0x53ff3b];return _0x4d7ac2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa7bc('0x0'));var rimraf=require(_0xa7bc('0x1'));var zipdir=require(_0xa7bc('0x2'));var jsonpatch=require(_0xa7bc('0x3'));var rp=require(_0xa7bc('0x4'));var moment=require('moment');var BPromise=require(_0xa7bc('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa7bc('0x6'));var sox=require(_0xa7bc('0x7'));var csv=require(_0xa7bc('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa7bc('0x9'));var squel=require('squel');var crypto=require(_0xa7bc('0xa'));var jsforce=require(_0xa7bc('0xb'));var deskjs=require(_0xa7bc('0xc'));var toCsv=require(_0xa7bc('0x8'));var querystring=require(_0xa7bc('0xd'));var Papa=require(_0xa7bc('0xe'));var Redis=require('ioredis');var authService=require(_0xa7bc('0xf'));var qs=require(_0xa7bc('0x10'));var as=require(_0xa7bc('0x11'));var hardwareService=require(_0xa7bc('0x12'));var logger=require('../../config/logger')(_0xa7bc('0x13'));var utils=require('../../config/utils');var config=require(_0xa7bc('0x14'));var db=require(_0xa7bc('0x15'))['db'];function respondWithStatusCode(_0x1b2df1,_0x48733a){_0x48733a=_0x48733a||0xcc;return function(_0x46d0b5){if(_0x46d0b5){return _0x1b2df1['sendStatus'](_0x48733a);}return _0x1b2df1[_0xa7bc('0x16')](_0x48733a)['end']();};}function respondWithResult(_0x1e48cf,_0x2d03db){_0x2d03db=_0x2d03db||0xc8;return function(_0x4b632e){if(_0x4b632e){return _0x1e48cf[_0xa7bc('0x16')](_0x2d03db)[_0xa7bc('0x17')](_0x4b632e);}};}function respondWithFilteredResult(_0x3abb86,_0x58c932){return function(_0x4a0a76){if(_0x4a0a76){var _0x337331=_0x4a0a76[_0xa7bc('0x18')],_0x52cf43=_0x58c932['offset'],_0xa0ab04=_0x58c932[_0xa7bc('0x19')]+_0x58c932[_0xa7bc('0x1a')],_0x57dd1f;if(_0xa0ab04>=_0x337331){_0xa0ab04=_0x337331;_0x57dd1f=0xc8;}else{_0x57dd1f=0xce;}_0x3abb86[_0xa7bc('0x16')](_0x57dd1f);return _0x3abb86['set']('Content-Range',_0x52cf43+'-'+_0xa0ab04+'/'+_0x337331)[_0xa7bc('0x17')](_0x4a0a76);}return null;};}function patchUpdates(_0x24413f){return function(_0x203930){try{jsonpatch[_0xa7bc('0x1b')](_0x203930,_0x24413f,!![]);}catch(_0x25aaaf){return BPromise[_0xa7bc('0x1c')](_0x25aaaf);}return _0x203930[_0xa7bc('0x1d')]();};}function saveUpdates(_0x4dbb70,_0x3257ff){return function(_0x322712){if(_0x322712){return _0x322712[_0xa7bc('0x1e')](_0x4dbb70)[_0xa7bc('0x1f')](function(_0x3800a1){return _0x3800a1;});}return null;};}function removeEntity(_0x42131,_0x233f95){return function(_0x7f0d04){if(_0x7f0d04){return _0x7f0d04[_0xa7bc('0x20')]()[_0xa7bc('0x1f')](function(){_0x42131['status'](0xcc)[_0xa7bc('0x21')]();});}};}function handleEntityNotFound(_0x23cfad,_0x27d3d7){return function(_0x283f0e){if(!_0x283f0e){_0x23cfad[_0xa7bc('0x22')](0x194);}return _0x283f0e;};}function handleError(_0x194b89,_0x3c4662){_0x3c4662=_0x3c4662||0x1f4;return function(_0x4f68aa){logger['error'](_0x4f68aa['stack']);if(_0x4f68aa[_0xa7bc('0x23')]){delete _0x4f68aa[_0xa7bc('0x23')];}_0x194b89['status'](_0x3c4662)[_0xa7bc('0x24')](_0x4f68aa);};}exports[_0xa7bc('0x25')]=function(_0x599a7a,_0x47f8f5){var _0x3e9228={},_0x381111={},_0x433289={'count':0x0,'rows':[]};var _0x2ef091=_['map'](db[_0xa7bc('0x26')][_0xa7bc('0x27')],function(_0xd9730a){return{'name':_0xd9730a['fieldName'],'type':_0xd9730a[_0xa7bc('0x28')][_0xa7bc('0x29')]};});_0x381111[_0xa7bc('0x2a')]=_[_0xa7bc('0x2b')](_0x2ef091,_0xa7bc('0x23'));_0x381111['query']=_[_0xa7bc('0x2c')](_0x599a7a[_0xa7bc('0x2d')]);_0x381111[_0xa7bc('0x2e')]=_[_0xa7bc('0x2f')](_0x381111['model'],_0x381111[_0xa7bc('0x2d')]);_0x3e9228[_0xa7bc('0x30')]=_[_0xa7bc('0x2f')](_0x381111[_0xa7bc('0x2a')],qs[_0xa7bc('0x31')](_0x599a7a['query']['fields']));_0x3e9228[_0xa7bc('0x30')]=_0x3e9228[_0xa7bc('0x30')][_0xa7bc('0x32')]?_0x3e9228[_0xa7bc('0x30')]:_0x381111['model'];if(!_0x599a7a[_0xa7bc('0x2d')][_0xa7bc('0x33')](_0xa7bc('0x34'))){_0x3e9228[_0xa7bc('0x1a')]=qs['limit'](_0x599a7a[_0xa7bc('0x2d')][_0xa7bc('0x1a')]);_0x3e9228[_0xa7bc('0x19')]=qs[_0xa7bc('0x19')](_0x599a7a[_0xa7bc('0x2d')][_0xa7bc('0x19')]);}_0x3e9228[_0xa7bc('0x35')]=qs[_0xa7bc('0x36')](_0x599a7a[_0xa7bc('0x2d')][_0xa7bc('0x36')]);_0x3e9228[_0xa7bc('0x37')]=qs['filters'](_[_0xa7bc('0x38')](_0x599a7a['query'],_0x381111[_0xa7bc('0x2e')]),_0x2ef091);if(_0x599a7a[_0xa7bc('0x2d')]['filter']){_0x3e9228[_0xa7bc('0x37')]=_[_0xa7bc('0x39')](_0x3e9228[_0xa7bc('0x37')],{'$or':_['map'](_0x2ef091,function(_0x457e58){if(_0x457e58[_0xa7bc('0x28')]!==_0xa7bc('0x3a')){var _0x22c0ac={};_0x22c0ac[_0x457e58[_0xa7bc('0x23')]]={'$like':'%'+_0x599a7a['query'][_0xa7bc('0x3b')]+'%'};return _0x22c0ac;}})});}_0x3e9228=_['merge']({},_0x3e9228,_0x599a7a['options']);var _0x3e5894={'where':_0x3e9228[_0xa7bc('0x37')]};return db[_0xa7bc('0x26')][_0xa7bc('0x18')](_0x3e5894)[_0xa7bc('0x1f')](function(_0x22a6df){_0x433289[_0xa7bc('0x18')]=_0x22a6df;if(_0x599a7a[_0xa7bc('0x2d')][_0xa7bc('0x3c')]){_0x3e9228['include']=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0xa7bc('0x3d')](_0x3e9228);})[_0xa7bc('0x1f')](function(_0x2e4297){_0x433289[_0xa7bc('0x3e')]=_0x2e4297;return _0x433289;})[_0xa7bc('0x1f')](respondWithFilteredResult(_0x47f8f5,_0x3e9228))['catch'](handleError(_0x47f8f5,null));};exports['show']=function(_0x162c9d,_0x3e65da){var _0x4770ac={'raw':!![],'where':{'id':_0x162c9d[_0xa7bc('0x3f')]['id']}},_0x3f297b={};_0x3f297b['model']=_[_0xa7bc('0x2c')](db['OpenchannelQueueReport'][_0xa7bc('0x27')]);_0x3f297b['query']=_[_0xa7bc('0x2c')](_0x162c9d[_0xa7bc('0x2d')]);_0x3f297b[_0xa7bc('0x2e')]=_[_0xa7bc('0x2f')](_0x3f297b[_0xa7bc('0x2a')],_0x3f297b['query']);_0x4770ac[_0xa7bc('0x30')]=_[_0xa7bc('0x2f')](_0x3f297b[_0xa7bc('0x2a')],qs['fields'](_0x162c9d[_0xa7bc('0x2d')][_0xa7bc('0x31')]));_0x4770ac[_0xa7bc('0x30')]=_0x4770ac[_0xa7bc('0x30')][_0xa7bc('0x32')]?_0x4770ac[_0xa7bc('0x30')]:_0x3f297b['model'];if(_0x162c9d[_0xa7bc('0x2d')][_0xa7bc('0x3c')]){_0x4770ac[_0xa7bc('0x40')]=[{'all':!![]}];}_0x4770ac=_[_0xa7bc('0x39')]({},_0x4770ac,_0x162c9d[_0xa7bc('0x41')]);return db[_0xa7bc('0x26')]['find'](_0x4770ac)['then'](handleEntityNotFound(_0x3e65da,null))[_0xa7bc('0x1f')](respondWithResult(_0x3e65da,null))[_0xa7bc('0x42')](handleError(_0x3e65da,null));};exports['create']=function(_0x4d1f02,_0x2a6eaf){return db[_0xa7bc('0x26')][_0xa7bc('0x43')](_0x4d1f02[_0xa7bc('0x44')],{})[_0xa7bc('0x1f')](respondWithResult(_0x2a6eaf,0xc9))[_0xa7bc('0x42')](handleError(_0x2a6eaf,null));};exports['update']=function(_0x29b99a,_0x39e7ed){if(_0x29b99a[_0xa7bc('0x44')]['id']){delete _0x29b99a[_0xa7bc('0x44')]['id'];}return db[_0xa7bc('0x26')]['find']({'where':{'id':_0x29b99a[_0xa7bc('0x3f')]['id']}})[_0xa7bc('0x1f')](handleEntityNotFound(_0x39e7ed,null))[_0xa7bc('0x1f')](saveUpdates(_0x29b99a[_0xa7bc('0x44')],null))[_0xa7bc('0x1f')](respondWithResult(_0x39e7ed,null))[_0xa7bc('0x42')](handleError(_0x39e7ed,null));};exports[_0xa7bc('0x20')]=function(_0x4f5d89,_0x4d20a2){return db[_0xa7bc('0x26')][_0xa7bc('0x45')]({'where':{'id':_0x4f5d89[_0xa7bc('0x3f')]['id']}})[_0xa7bc('0x1f')](handleEntityNotFound(_0x4d20a2,null))['then'](removeEntity(_0x4d20a2,null))[_0xa7bc('0x42')](handleError(_0x4d20a2,null));};exports[_0xa7bc('0x46')]=function(_0x3b3794,_0x458823){return db[_0xa7bc('0x26')]['describe']()[_0xa7bc('0x1f')](respondWithResult(_0x458823,null))[_0xa7bc('0x42')](handleError(_0x458823,null));}; \ No newline at end of file +var _0xaeff=['set','Content-Range','apply','reject','update','then','destroy','error','name','index','OpenchannelQueueReport','fieldName','type','model','query','keys','intersection','fields','attributes','nolimit','limit','order','sort','where','pick','filters','filter','merge','map','VIRTUAL','include','findAll','rows','catch','show','params','rawAttributes','includeAll','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','mustache','ejs','squel','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','json','count','offset','status'];(function(_0x1bd000,_0x2a691d){var _0xca4d3b=function(_0x52581e){while(--_0x52581e){_0x1bd000['push'](_0x1bd000['shift']());}};_0xca4d3b(++_0x2a691d);}(_0xaeff,0x179));var _0xfaef=function(_0x4d63db,_0x13cd7b){_0x4d63db=_0x4d63db-0x0;var _0x4eda30=_0xaeff[_0x4d63db];return _0x4eda30;};'use strict';var pdf=require(_0xfaef('0x0'));var emlformat=require(_0xfaef('0x1'));var rimraf=require(_0xfaef('0x2'));var zipdir=require(_0xfaef('0x3'));var jsonpatch=require(_0xfaef('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfaef('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfaef('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0xfaef('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfaef('0x8'));var toCsv=require(_0xfaef('0x9'));var querystring=require(_0xfaef('0xa'));var Papa=require(_0xfaef('0xb'));var Redis=require('ioredis');var authService=require(_0xfaef('0xc'));var qs=require(_0xfaef('0xd'));var as=require(_0xfaef('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfaef('0xf'))(_0xfaef('0x10'));var utils=require(_0xfaef('0x11'));var config=require(_0xfaef('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a8b98,_0x1d0f5c){_0x1d0f5c=_0x1d0f5c||0xcc;return function(_0x11503c){if(_0x11503c){return _0x2a8b98[_0xfaef('0x13')](_0x1d0f5c);}return _0x2a8b98['status'](_0x1d0f5c)[_0xfaef('0x14')]();};}function respondWithResult(_0x26ba79,_0x26f261){_0x26f261=_0x26f261||0xc8;return function(_0x4c4177){if(_0x4c4177){return _0x26ba79['status'](_0x26f261)[_0xfaef('0x15')](_0x4c4177);}};}function respondWithFilteredResult(_0x258d63,_0xa54b7b){return function(_0x7fa963){if(_0x7fa963){var _0x46cb97=_0x7fa963[_0xfaef('0x16')],_0x595cfe=_0xa54b7b[_0xfaef('0x17')],_0xbb3f29=_0xa54b7b[_0xfaef('0x17')]+_0xa54b7b['limit'],_0x1cc62b;if(_0xbb3f29>=_0x46cb97){_0xbb3f29=_0x46cb97;_0x1cc62b=0xc8;}else{_0x1cc62b=0xce;}_0x258d63[_0xfaef('0x18')](_0x1cc62b);return _0x258d63[_0xfaef('0x19')](_0xfaef('0x1a'),_0x595cfe+'-'+_0xbb3f29+'/'+_0x46cb97)[_0xfaef('0x15')](_0x7fa963);}return null;};}function patchUpdates(_0x1164ce){return function(_0x3b5979){try{jsonpatch[_0xfaef('0x1b')](_0x3b5979,_0x1164ce,!![]);}catch(_0x55903c){return BPromise[_0xfaef('0x1c')](_0x55903c);}return _0x3b5979['save']();};}function saveUpdates(_0x542c11,_0x4725bd){return function(_0x3b2238){if(_0x3b2238){return _0x3b2238[_0xfaef('0x1d')](_0x542c11)[_0xfaef('0x1e')](function(_0x172117){return _0x172117;});}return null;};}function removeEntity(_0x2b8c65,_0x213d94){return function(_0x90e2b){if(_0x90e2b){return _0x90e2b[_0xfaef('0x1f')]()['then'](function(){_0x2b8c65[_0xfaef('0x18')](0xcc)[_0xfaef('0x14')]();});}};}function handleEntityNotFound(_0x1835ae,_0x49928c){return function(_0x39d4b4){if(!_0x39d4b4){_0x1835ae[_0xfaef('0x13')](0x194);}return _0x39d4b4;};}function handleError(_0x4f1f27,_0x4c8578){_0x4c8578=_0x4c8578||0x1f4;return function(_0x2deb20){logger[_0xfaef('0x20')](_0x2deb20['stack']);if(_0x2deb20[_0xfaef('0x21')]){delete _0x2deb20[_0xfaef('0x21')];}_0x4f1f27[_0xfaef('0x18')](_0x4c8578)['send'](_0x2deb20);};}exports[_0xfaef('0x22')]=function(_0x3bf860,_0x2db57f){var _0x339a34={},_0x186d2d={},_0x315b21={'count':0x0,'rows':[]};var _0x1cab52=_['map'](db[_0xfaef('0x23')]['rawAttributes'],function(_0x2b2360){return{'name':_0x2b2360[_0xfaef('0x24')],'type':_0x2b2360[_0xfaef('0x25')]['key']};});_0x186d2d[_0xfaef('0x26')]=_['map'](_0x1cab52,'name');_0x186d2d[_0xfaef('0x27')]=_[_0xfaef('0x28')](_0x3bf860[_0xfaef('0x27')]);_0x186d2d['filters']=_[_0xfaef('0x29')](_0x186d2d[_0xfaef('0x26')],_0x186d2d[_0xfaef('0x27')]);_0x339a34['attributes']=_['intersection'](_0x186d2d[_0xfaef('0x26')],qs['fields'](_0x3bf860[_0xfaef('0x27')][_0xfaef('0x2a')]));_0x339a34[_0xfaef('0x2b')]=_0x339a34[_0xfaef('0x2b')]['length']?_0x339a34[_0xfaef('0x2b')]:_0x186d2d[_0xfaef('0x26')];if(!_0x3bf860['query']['hasOwnProperty'](_0xfaef('0x2c'))){_0x339a34[_0xfaef('0x2d')]=qs[_0xfaef('0x2d')](_0x3bf860[_0xfaef('0x27')][_0xfaef('0x2d')]);_0x339a34[_0xfaef('0x17')]=qs[_0xfaef('0x17')](_0x3bf860[_0xfaef('0x27')][_0xfaef('0x17')]);}_0x339a34[_0xfaef('0x2e')]=qs[_0xfaef('0x2f')](_0x3bf860[_0xfaef('0x27')]['sort']);_0x339a34[_0xfaef('0x30')]=qs['filters'](_[_0xfaef('0x31')](_0x3bf860[_0xfaef('0x27')],_0x186d2d[_0xfaef('0x32')]),_0x1cab52);if(_0x3bf860['query'][_0xfaef('0x33')]){_0x339a34[_0xfaef('0x30')]=_[_0xfaef('0x34')](_0x339a34['where'],{'$or':_[_0xfaef('0x35')](_0x1cab52,function(_0x4a7e40){if(_0x4a7e40['type']!==_0xfaef('0x36')){var _0x142a6f={};_0x142a6f[_0x4a7e40[_0xfaef('0x21')]]={'$like':'%'+_0x3bf860[_0xfaef('0x27')][_0xfaef('0x33')]+'%'};return _0x142a6f;}})});}_0x339a34=_[_0xfaef('0x34')]({},_0x339a34,_0x3bf860['options']);var _0x493ab8={'where':_0x339a34[_0xfaef('0x30')]};return db[_0xfaef('0x23')][_0xfaef('0x16')](_0x493ab8)[_0xfaef('0x1e')](function(_0x441a2f){_0x315b21[_0xfaef('0x16')]=_0x441a2f;if(_0x3bf860[_0xfaef('0x27')]['includeAll']){_0x339a34[_0xfaef('0x37')]=[{'all':!![]}];}return db[_0xfaef('0x23')][_0xfaef('0x38')](_0x339a34);})[_0xfaef('0x1e')](function(_0x9a6d1e){_0x315b21[_0xfaef('0x39')]=_0x9a6d1e;return _0x315b21;})[_0xfaef('0x1e')](respondWithFilteredResult(_0x2db57f,_0x339a34))[_0xfaef('0x3a')](handleError(_0x2db57f,null));};exports[_0xfaef('0x3b')]=function(_0x30adb0,_0x8fb02d){var _0xd01e93={'raw':!![],'where':{'id':_0x30adb0[_0xfaef('0x3c')]['id']}},_0x1805fa={};_0x1805fa[_0xfaef('0x26')]=_[_0xfaef('0x28')](db[_0xfaef('0x23')][_0xfaef('0x3d')]);_0x1805fa['query']=_[_0xfaef('0x28')](_0x30adb0[_0xfaef('0x27')]);_0x1805fa[_0xfaef('0x32')]=_[_0xfaef('0x29')](_0x1805fa[_0xfaef('0x26')],_0x1805fa[_0xfaef('0x27')]);_0xd01e93['attributes']=_[_0xfaef('0x29')](_0x1805fa[_0xfaef('0x26')],qs[_0xfaef('0x2a')](_0x30adb0['query'][_0xfaef('0x2a')]));_0xd01e93[_0xfaef('0x2b')]=_0xd01e93[_0xfaef('0x2b')]['length']?_0xd01e93[_0xfaef('0x2b')]:_0x1805fa[_0xfaef('0x26')];if(_0x30adb0[_0xfaef('0x27')][_0xfaef('0x3e')]){_0xd01e93['include']=[{'all':!![]}];}_0xd01e93=_[_0xfaef('0x34')]({},_0xd01e93,_0x30adb0['options']);return db[_0xfaef('0x23')]['find'](_0xd01e93)[_0xfaef('0x1e')](handleEntityNotFound(_0x8fb02d,null))[_0xfaef('0x1e')](respondWithResult(_0x8fb02d,null))['catch'](handleError(_0x8fb02d,null));};exports[_0xfaef('0x3f')]=function(_0x47177c,_0x1060b8){return db['OpenchannelQueueReport']['create'](_0x47177c[_0xfaef('0x40')],{})[_0xfaef('0x1e')](respondWithResult(_0x1060b8,0xc9))[_0xfaef('0x3a')](handleError(_0x1060b8,null));};exports['update']=function(_0x3850d7,_0x3d3613){if(_0x3850d7[_0xfaef('0x40')]['id']){delete _0x3850d7[_0xfaef('0x40')]['id'];}return db[_0xfaef('0x23')]['find']({'where':{'id':_0x3850d7['params']['id']}})['then'](handleEntityNotFound(_0x3d3613,null))['then'](saveUpdates(_0x3850d7[_0xfaef('0x40')],null))['then'](respondWithResult(_0x3d3613,null))['catch'](handleError(_0x3d3613,null));};exports[_0xfaef('0x1f')]=function(_0x132be1,_0xf33d19){return db[_0xfaef('0x23')][_0xfaef('0x41')]({'where':{'id':_0x132be1[_0xfaef('0x3c')]['id']}})[_0xfaef('0x1e')](handleEntityNotFound(_0xf33d19,null))[_0xfaef('0x1e')](removeEntity(_0xf33d19,null))[_0xfaef('0x3a')](handleError(_0xf33d19,null));};exports[_0xfaef('0x42')]=function(_0x3ecc27,_0x249556){return db[_0xfaef('0x23')][_0xfaef('0x42')]()[_0xfaef('0x1e')](respondWithResult(_0x249556,null))[_0xfaef('0x3a')](handleError(_0x249556,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 140dc13..8f9eb8b 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 _0xaa48=['request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x278bb6,_0x356231){var _0x4d8952=function(_0x3e0bd0){while(--_0x3e0bd0){_0x278bb6['push'](_0x278bb6['shift']());}};_0x4d8952(++_0x356231);}(_0xaa48,0x15a));var _0x8aa4=function(_0x5e3fd7,_0x10d87c){_0x5e3fd7=_0x5e3fd7-0x0;var _0x2f2d3c=_0xaa48[_0x5e3fd7];return _0x2f2d3c;};'use strict';var _=require(_0x8aa4('0x0'));var util=require(_0x8aa4('0x1'));var logger=require(_0x8aa4('0x2'))(_0x8aa4('0x3'));var moment=require(_0x8aa4('0x4'));var BPromise=require(_0x8aa4('0x5'));var rp=require(_0x8aa4('0x6'));var fs=require('fs');var path=require(_0x8aa4('0x7'));var rimraf=require(_0x8aa4('0x8'));var config=require(_0x8aa4('0x9'));var attributes=require(_0x8aa4('0xa'));module[_0x8aa4('0xb')]=function(_0x141d8b,_0x14614c){return _0x141d8b[_0x8aa4('0xc')](_0x8aa4('0xd'),attributes,{'tableName':_0x8aa4('0xe'),'paranoid':![],'indexes':[{'name':_0x8aa4('0xf'),'fields':[_0x8aa4('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb700=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0x336981,_0x3fd27f){var _0x54b1cd=function(_0x35bf21){while(--_0x35bf21){_0x336981['push'](_0x336981['shift']());}};_0x54b1cd(++_0x3fd27f);}(_0xb700,0x1d3));var _0x0b70=function(_0x44268d,_0xad8443){_0x44268d=_0x44268d-0x0;var _0x4be92d=_0xb700[_0x44268d];return _0x4be92d;};'use strict';var _=require(_0x0b70('0x0'));var util=require('util');var logger=require(_0x0b70('0x1'))(_0x0b70('0x2'));var moment=require(_0x0b70('0x3'));var BPromise=require(_0x0b70('0x4'));var rp=require(_0x0b70('0x5'));var fs=require('fs');var path=require(_0x0b70('0x6'));var rimraf=require(_0x0b70('0x7'));var config=require(_0x0b70('0x8'));var attributes=require('./openchannelQueueReport.attributes');module['exports']=function(_0x5818a1,_0x186d93){return _0x5818a1[_0x0b70('0x9')](_0x0b70('0xa'),attributes,{'tableName':_0x0b70('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0b70('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 9c41bdf..ea4485e 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 _0x7b84=['OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','options','raw','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','body','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x48b916,_0x3498b6){var _0x1c20b9=function(_0x430086){while(--_0x430086){_0x48b916['push'](_0x48b916['shift']());}};_0x1c20b9(++_0x3498b6);}(_0x7b84,0x17c));var _0x47b8=function(_0x59ce13,_0x36e14c){_0x59ce13=_0x59ce13-0x0;var _0x51d2b3=_0x7b84[_0x59ce13];return _0x51d2b3;};'use strict';var _=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var moment=require(_0x47b8('0x2'));var BPromise=require(_0x47b8('0x3'));var rs=require(_0x47b8('0x4'));var fs=require('fs');var Redis=require(_0x47b8('0x5'));var db=require(_0x47b8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x47b8('0x7'))(_0x47b8('0x8'));var config=require(_0x47b8('0x9'));var jayson=require(_0x47b8('0xa'));var client=jayson[_0x47b8('0xb')][_0x47b8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x53e656,_0x3867ca,_0x3ce846){return new BPromise(function(_0x46245a,_0xb845c9){return client[_0x47b8('0xd')](_0x53e656,_0x3ce846)[_0x47b8('0xe')](function(_0x24d240){logger[_0x47b8('0xf')](_0x47b8('0x10'),_0x3867ca,_0x47b8('0x11'));logger[_0x47b8('0x12')](_0x47b8('0x13'),_0x3867ca,_0x47b8('0x11'),JSON[_0x47b8('0x14')](_0x24d240));if(_0x24d240[_0x47b8('0x15')]){if(_0x24d240[_0x47b8('0x15')][_0x47b8('0x16')]===0x1f4){logger[_0x47b8('0x15')](_0x47b8('0x10'),_0x3867ca,_0x24d240[_0x47b8('0x15')][_0x47b8('0x17')]);return _0xb845c9(_0x24d240[_0x47b8('0x15')][_0x47b8('0x17')]);}logger[_0x47b8('0x15')](_0x47b8('0x10'),_0x3867ca,_0x24d240[_0x47b8('0x15')][_0x47b8('0x17')]);return _0x46245a(_0x24d240['error'][_0x47b8('0x17')]);}else{logger[_0x47b8('0xf')](_0x47b8('0x10'),_0x3867ca,_0x47b8('0x11'));_0x46245a(_0x24d240[_0x47b8('0x18')][_0x47b8('0x17')]);}})[_0x47b8('0x19')](function(_0x5ad3ae){logger[_0x47b8('0x15')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3867ca,_0x5ad3ae);_0xb845c9(_0x5ad3ae);});});}exports['CreateOpenchannelQueueReport']=function(_0x4f7317){var _0x299195=this;return new Promise(function(_0x36faf1,_0x2797ac){return db['OpenchannelQueueReport']['create'](_0x4f7317['body'],{'raw':_0x4f7317[_0x47b8('0x1a')]?_0x4f7317['options'][_0x47b8('0x1b')]===undefined?!![]:![]:!![]})[_0x47b8('0xe')](function(_0x303f19){logger[_0x47b8('0xf')]('CreateOpenchannelQueueReport',_0x4f7317);logger[_0x47b8('0x12')](_0x47b8('0x1c'),_0x4f7317,JSON[_0x47b8('0x14')](_0x303f19));_0x36faf1(_0x303f19);})[_0x47b8('0x19')](function(_0x168cde){logger[_0x47b8('0x15')]('CreateOpenchannelQueueReport',_0x168cde[_0x47b8('0x17')],_0x4f7317);_0x2797ac(_0x299195[_0x47b8('0x15')](0x1f4,_0x168cde['message']));});});};exports[_0x47b8('0x1d')]=function(_0x247429){var _0x19b03e=this;return new Promise(function(_0x142fb6,_0x5604c9){return db[_0x47b8('0x1e')][_0x47b8('0x1f')](_0x247429[_0x47b8('0x20')],{'raw':_0x247429[_0x47b8('0x1a')]?_0x247429[_0x47b8('0x1a')][_0x47b8('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x247429[_0x47b8('0x1a')]?_0x247429['options'][_0x47b8('0x21')]||null:null,'attributes':_0x247429[_0x47b8('0x1a')]?_0x247429['options'][_0x47b8('0x22')]||null:null,'limit':_0x247429[_0x47b8('0x1a')]?_0x247429[_0x47b8('0x1a')][_0x47b8('0x23')]||null:null})['then'](function(_0x162d96){logger['info'](_0x47b8('0x1d'),_0x247429);logger[_0x47b8('0x12')](_0x47b8('0x1d'),_0x247429,JSON[_0x47b8('0x14')](_0x162d96));_0x142fb6(_0x162d96);})['catch'](function(_0x35fbbb){logger[_0x47b8('0x15')](_0x47b8('0x1d'),_0x35fbbb[_0x47b8('0x17')],_0x247429);_0x5604c9(_0x19b03e[_0x47b8('0x15')](0x1f4,_0x35fbbb[_0x47b8('0x17')]));});});}; \ No newline at end of file +var _0xbd8e=['then','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','raw','info','UpdateOpenchannelQueueReport','update','attributes','limit','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x38e8ac,_0x3222c3){var _0x3730ed=function(_0x28c4f9){while(--_0x28c4f9){_0x38e8ac['push'](_0x38e8ac['shift']());}};_0x3730ed(++_0x3222c3);}(_0xbd8e,0x1b5));var _0xebd8=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xbd8e[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xebd8('0x0'));var util=require(_0xebd8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xebd8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xebd8('0x3'))['db'];var utils=require(_0xebd8('0x4'));var logger=require(_0xebd8('0x5'))(_0xebd8('0x6'));var config=require(_0xebd8('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xebd8('0x8')][_0xebd8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f2b2e,_0x3740bd,_0x3b92b9){return new BPromise(function(_0x4ac0d0,_0x19c8ee){return client[_0xebd8('0xa')](_0x3f2b2e,_0x3b92b9)[_0xebd8('0xb')](function(_0x13afa5){logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x3740bd,'request\x20sent');logger[_0xebd8('0xc')](_0xebd8('0xd'),_0x3740bd,_0xebd8('0xe'),JSON[_0xebd8('0xf')](_0x13afa5));if(_0x13afa5[_0xebd8('0x10')]){if(_0x13afa5['error'][_0xebd8('0x11')]===0x1f4){logger['error'](_0xebd8('0x12'),_0x3740bd,_0x13afa5[_0xebd8('0x10')]['message']);return _0x19c8ee(_0x13afa5[_0xebd8('0x10')][_0xebd8('0x13')]);}logger[_0xebd8('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3740bd,_0x13afa5[_0xebd8('0x10')]['message']);return _0x4ac0d0(_0x13afa5[_0xebd8('0x10')]['message']);}else{logger['info'](_0xebd8('0x12'),_0x3740bd,_0xebd8('0xe'));_0x4ac0d0(_0x13afa5[_0xebd8('0x14')][_0xebd8('0x13')]);}})[_0xebd8('0x15')](function(_0x2b6ac4){logger[_0xebd8('0x10')](_0xebd8('0x12'),_0x3740bd,_0x2b6ac4);_0x19c8ee(_0x2b6ac4);});});}exports[_0xebd8('0x16')]=function(_0x3e0293){var _0x22152a=this;return new Promise(function(_0x46a956,_0x204593){return db[_0xebd8('0x17')]['create'](_0x3e0293[_0xebd8('0x18')],{'raw':_0x3e0293[_0xebd8('0x19')]?_0x3e0293[_0xebd8('0x19')][_0xebd8('0x1a')]===undefined?!![]:![]:!![]})[_0xebd8('0xb')](function(_0x24be02){logger[_0xebd8('0x1b')](_0xebd8('0x16'),_0x3e0293);logger[_0xebd8('0xc')]('CreateOpenchannelQueueReport',_0x3e0293,JSON[_0xebd8('0xf')](_0x24be02));_0x46a956(_0x24be02);})[_0xebd8('0x15')](function(_0x26aff8){logger[_0xebd8('0x10')](_0xebd8('0x16'),_0x26aff8[_0xebd8('0x13')],_0x3e0293);_0x204593(_0x22152a[_0xebd8('0x10')](0x1f4,_0x26aff8[_0xebd8('0x13')]));});});};exports[_0xebd8('0x1c')]=function(_0x228411){var _0x3728a6=this;return new Promise(function(_0x1d7e25,_0xa64ff5){return db['OpenchannelQueueReport'][_0xebd8('0x1d')](_0x228411['body'],{'raw':_0x228411[_0xebd8('0x19')]?_0x228411[_0xebd8('0x19')][_0xebd8('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x228411[_0xebd8('0x19')]?_0x228411['options']['where']||null:null,'attributes':_0x228411[_0xebd8('0x19')]?_0x228411[_0xebd8('0x19')][_0xebd8('0x1e')]||null:null,'limit':_0x228411[_0xebd8('0x19')]?_0x228411[_0xebd8('0x19')][_0xebd8('0x1f')]||null:null})[_0xebd8('0xb')](function(_0x5b0db9){logger['info'](_0xebd8('0x1c'),_0x228411);logger['debug'](_0xebd8('0x1c'),_0x228411,JSON['stringify'](_0x5b0db9));_0x1d7e25(_0x5b0db9);})[_0xebd8('0x15')](function(_0x2830fe){logger['error'](_0xebd8('0x1c'),_0x2830fe['message'],_0x228411);_0xa64ff5(_0x3728a6[_0xebd8('0x10')](0x1f4,_0x2830fe[_0xebd8('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 11d7aa6..b11680b 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(_0x15cbce,_0xda8402){var _0x257f29=function(_0x388132){while(--_0x388132){_0x15cbce['push'](_0x15cbce['shift']());}};_0x257f29(++_0xda8402);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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(_0x336376,_0xe4b28d){var _0x1d2a8e=function(_0x3afe68){while(--_0x3afe68){_0x336376['push'](_0x336376['shift']());}};_0x1d2a8e(++_0xe4b28d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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 90bec01..bfd339a 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 _0xbb48=['queue','DATE','NOW','moment','exports','STRING','agent'];(function(_0xf1b354,_0x32048c){var _0x405d3a=function(_0x2e1dbc){while(--_0x2e1dbc){_0xf1b354['push'](_0xf1b354['shift']());}};_0x405d3a(++_0x32048c);}(_0xbb48,0x1d8));var _0x8bb4=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xbb48[_0x4565bf];return _0x5610ba;};'use strict';var moment=require(_0x8bb4('0x0'));var Sequelize=require('sequelize');module[_0x8bb4('0x1')]={'uniqueid':{'type':Sequelize[_0x8bb4('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account',_0x8bb4('0x3'),_0x8bb4('0x4')),'allowNull':![],'defaultValue':_0x8bb4('0x4')},'transferredAt':{'type':Sequelize[_0x8bb4('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x8bb4('0x6')]}}; \ No newline at end of file +var _0xcd98=['sequelize','exports','queue','NOW','moment'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0xcd98,0xb3));var _0x8cd9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcd98[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x8cd9('0x0'));var Sequelize=require(_0x8cd9('0x1'));module[_0x8cd9('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account','agent','queue'),'allowNull':![],'defaultValue':_0x8cd9('0x3')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x8cd9('0x4')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 24951b5..95b67c5 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 _0x017b=['querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','then','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','findAll','catch','show','params','keys','include','find','create','body','update','destroy','describe','rimraf','zip-dir','moment','bluebird','util','path','sox','ejs','squel','crypto','jsforce','to-csv'];(function(_0x1fe30d,_0x51107c){var _0x3bd23e=function(_0xafc713){while(--_0xafc713){_0x1fe30d['push'](_0x1fe30d['shift']());}};_0x3bd23e(++_0x51107c);}(_0x017b,0x192));var _0xb017=function(_0x885036,_0x1e619f){_0x885036=_0x885036-0x0;var _0x9bc432=_0x017b[_0x885036];return _0x9bc432;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xb017('0x0'));var zipdir=require(_0xb017('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb017('0x2'));var BPromise=require(_0xb017('0x3'));var Mustache=require('mustache');var util=require(_0xb017('0x4'));var path=require(_0xb017('0x5'));var sox=require(_0xb017('0x6'));var csv=require('to-csv');var ejs=require(_0xb017('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb017('0x8'));var crypto=require(_0xb017('0x9'));var jsforce=require(_0xb017('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xb017('0xb'));var querystring=require(_0xb017('0xc'));var Papa=require(_0xb017('0xd'));var Redis=require(_0xb017('0xe'));var authService=require(_0xb017('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb017('0x10'));var logger=require(_0xb017('0x11'))(_0xb017('0x12'));var utils=require('../../config/utils');var config=require(_0xb017('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x183d28,_0x4e2c85){_0x4e2c85=_0x4e2c85||0xcc;return function(_0x402510){if(_0x402510){return _0x183d28[_0xb017('0x14')](_0x4e2c85);}return _0x183d28['status'](_0x4e2c85)[_0xb017('0x15')]();};}function respondWithResult(_0x51266d,_0x3eb5a3){_0x3eb5a3=_0x3eb5a3||0xc8;return function(_0x572f44){if(_0x572f44){return _0x51266d[_0xb017('0x16')](_0x3eb5a3)[_0xb017('0x17')](_0x572f44);}};}function respondWithFilteredResult(_0x356865,_0x197135){return function(_0x57741c){if(_0x57741c){var _0x30855b=_0x57741c[_0xb017('0x18')],_0x5b061c=_0x197135[_0xb017('0x19')],_0x101195=_0x197135[_0xb017('0x19')]+_0x197135[_0xb017('0x1a')],_0x2b4b09;if(_0x101195>=_0x30855b){_0x101195=_0x30855b;_0x2b4b09=0xc8;}else{_0x2b4b09=0xce;}_0x356865[_0xb017('0x16')](_0x2b4b09);return _0x356865[_0xb017('0x1b')](_0xb017('0x1c'),_0x5b061c+'-'+_0x101195+'/'+_0x30855b)['json'](_0x57741c);}return null;};}function patchUpdates(_0x1e6713){return function(_0x250d1f){try{jsonpatch['apply'](_0x250d1f,_0x1e6713,!![]);}catch(_0x4f4e8e){return BPromise[_0xb017('0x1d')](_0x4f4e8e);}return _0x250d1f[_0xb017('0x1e')]();};}function saveUpdates(_0x449eb3,_0x9954a0){return function(_0x59a66f){if(_0x59a66f){return _0x59a66f['update'](_0x449eb3)[_0xb017('0x1f')](function(_0xf86ef6){return _0xf86ef6;});}return null;};}function removeEntity(_0x42f59f,_0xd08839){return function(_0x1272ab){if(_0x1272ab){return _0x1272ab['destroy']()['then'](function(){_0x42f59f[_0xb017('0x16')](0xcc)[_0xb017('0x15')]();});}};}function handleEntityNotFound(_0x41e68c,_0x56e699){return function(_0x559e3b){if(!_0x559e3b){_0x41e68c[_0xb017('0x14')](0x194);}return _0x559e3b;};}function handleError(_0x146f74,_0x3b25bf){_0x3b25bf=_0x3b25bf||0x1f4;return function(_0x47662f){logger[_0xb017('0x20')](_0x47662f[_0xb017('0x21')]);if(_0x47662f['name']){delete _0x47662f[_0xb017('0x22')];}_0x146f74[_0xb017('0x16')](_0x3b25bf)[_0xb017('0x23')](_0x47662f);};}exports[_0xb017('0x24')]=function(_0x59e4ac,_0x44e459){var _0x3ceadb={},_0x5b2462={},_0x59cd69={'count':0x0,'rows':[]};var _0x2c5f39=_[_0xb017('0x25')](db[_0xb017('0x26')][_0xb017('0x27')],function(_0x3e77de){return{'name':_0x3e77de['fieldName'],'type':_0x3e77de['type'][_0xb017('0x28')]};});_0x5b2462[_0xb017('0x29')]=_['map'](_0x2c5f39,_0xb017('0x22'));_0x5b2462['query']=_['keys'](_0x59e4ac[_0xb017('0x2a')]);_0x5b2462[_0xb017('0x2b')]=_['intersection'](_0x5b2462[_0xb017('0x29')],_0x5b2462[_0xb017('0x2a')]);_0x3ceadb[_0xb017('0x2c')]=_[_0xb017('0x2d')](_0x5b2462[_0xb017('0x29')],qs[_0xb017('0x2e')](_0x59e4ac[_0xb017('0x2a')][_0xb017('0x2e')]));_0x3ceadb[_0xb017('0x2c')]=_0x3ceadb['attributes']['length']?_0x3ceadb[_0xb017('0x2c')]:_0x5b2462[_0xb017('0x29')];if(!_0x59e4ac[_0xb017('0x2a')][_0xb017('0x2f')]('nolimit')){_0x3ceadb['limit']=qs[_0xb017('0x1a')](_0x59e4ac['query'][_0xb017('0x1a')]);_0x3ceadb[_0xb017('0x19')]=qs[_0xb017('0x19')](_0x59e4ac[_0xb017('0x2a')][_0xb017('0x19')]);}_0x3ceadb[_0xb017('0x30')]=qs['sort'](_0x59e4ac[_0xb017('0x2a')][_0xb017('0x31')]);_0x3ceadb[_0xb017('0x32')]=qs[_0xb017('0x2b')](_[_0xb017('0x33')](_0x59e4ac[_0xb017('0x2a')],_0x5b2462[_0xb017('0x2b')]),_0x2c5f39);if(_0x59e4ac[_0xb017('0x2a')][_0xb017('0x34')]){_0x3ceadb[_0xb017('0x32')]=_[_0xb017('0x35')](_0x3ceadb[_0xb017('0x32')],{'$or':_[_0xb017('0x25')](_0x2c5f39,function(_0x306ec0){if(_0x306ec0[_0xb017('0x36')]!==_0xb017('0x37')){var _0x7b32e3={};_0x7b32e3[_0x306ec0[_0xb017('0x22')]]={'$like':'%'+_0x59e4ac[_0xb017('0x2a')][_0xb017('0x34')]+'%'};return _0x7b32e3;}})});}_0x3ceadb=_['merge']({},_0x3ceadb,_0x59e4ac[_0xb017('0x38')]);var _0x5b3f66={'where':_0x3ceadb[_0xb017('0x32')]};return db[_0xb017('0x26')][_0xb017('0x18')](_0x5b3f66)[_0xb017('0x1f')](function(_0x28d345){_0x59cd69[_0xb017('0x18')]=_0x28d345;if(_0x59e4ac[_0xb017('0x2a')]['includeAll']){_0x3ceadb['include']=[{'all':!![]}];}return db[_0xb017('0x26')][_0xb017('0x39')](_0x3ceadb);})[_0xb017('0x1f')](function(_0x4776fd){_0x59cd69['rows']=_0x4776fd;return _0x59cd69;})['then'](respondWithFilteredResult(_0x44e459,_0x3ceadb))[_0xb017('0x3a')](handleError(_0x44e459,null));};exports[_0xb017('0x3b')]=function(_0x1737bf,_0x58af6b){var _0xecf903={'raw':!![],'where':{'id':_0x1737bf[_0xb017('0x3c')]['id']}},_0x496fe0={};_0x496fe0[_0xb017('0x29')]=_[_0xb017('0x3d')](db[_0xb017('0x26')][_0xb017('0x27')]);_0x496fe0['query']=_['keys'](_0x1737bf['query']);_0x496fe0[_0xb017('0x2b')]=_[_0xb017('0x2d')](_0x496fe0[_0xb017('0x29')],_0x496fe0[_0xb017('0x2a')]);_0xecf903[_0xb017('0x2c')]=_[_0xb017('0x2d')](_0x496fe0[_0xb017('0x29')],qs['fields'](_0x1737bf[_0xb017('0x2a')][_0xb017('0x2e')]));_0xecf903[_0xb017('0x2c')]=_0xecf903[_0xb017('0x2c')]['length']?_0xecf903[_0xb017('0x2c')]:_0x496fe0['model'];if(_0x1737bf['query']['includeAll']){_0xecf903[_0xb017('0x3e')]=[{'all':!![]}];}_0xecf903=_[_0xb017('0x35')]({},_0xecf903,_0x1737bf[_0xb017('0x38')]);return db[_0xb017('0x26')][_0xb017('0x3f')](_0xecf903)[_0xb017('0x1f')](handleEntityNotFound(_0x58af6b,null))['then'](respondWithResult(_0x58af6b,null))[_0xb017('0x3a')](handleError(_0x58af6b,null));};exports[_0xb017('0x40')]=function(_0x349470,_0x427ee8){return db['OpenchannelTransferReport'][_0xb017('0x40')](_0x349470[_0xb017('0x41')],{})[_0xb017('0x1f')](respondWithResult(_0x427ee8,0xc9))[_0xb017('0x3a')](handleError(_0x427ee8,null));};exports[_0xb017('0x42')]=function(_0x1a2d68,_0x2b128d){if(_0x1a2d68[_0xb017('0x41')]['id']){delete _0x1a2d68[_0xb017('0x41')]['id'];}return db[_0xb017('0x26')][_0xb017('0x3f')]({'where':{'id':_0x1a2d68['params']['id']}})[_0xb017('0x1f')](handleEntityNotFound(_0x2b128d,null))[_0xb017('0x1f')](saveUpdates(_0x1a2d68[_0xb017('0x41')],null))[_0xb017('0x1f')](respondWithResult(_0x2b128d,null))[_0xb017('0x3a')](handleError(_0x2b128d,null));};exports[_0xb017('0x43')]=function(_0x163c9d,_0x4b441b){return db[_0xb017('0x26')][_0xb017('0x3f')]({'where':{'id':_0x163c9d['params']['id']}})[_0xb017('0x1f')](handleEntityNotFound(_0x4b441b,null))[_0xb017('0x1f')](removeEntity(_0x4b441b,null))[_0xb017('0x3a')](handleError(_0x4b441b,null));};exports[_0xb017('0x44')]=function(_0x19146f,_0x96cdc){return db[_0xb017('0x26')][_0xb017('0x44')]()['then'](respondWithResult(_0x96cdc,null))[_0xb017('0x3a')](handleError(_0x96cdc,null));}; \ No newline at end of file +var _0xaf37=['html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','limit','set','apply','reject','save','then','destroy','stack','name','index','map','OpenchannelTransferReport','rawAttributes','type','key','query','keys','intersection','attributes','model','fields','sort','where','filters','pick','filter','merge','count','includeAll','findAll','catch','show','length','include','find','create','update','body','params','describe'];(function(_0x480f72,_0xe80949){var _0x26578d=function(_0x4d4273){while(--_0x4d4273){_0x480f72['push'](_0x480f72['shift']());}};_0x26578d(++_0xe80949);}(_0xaf37,0xd2));var _0x7af3=function(_0x557fd2,_0x2c0a7a){_0x557fd2=_0x557fd2-0x0;var _0x1b54a2=_0xaf37[_0x557fd2];return _0x1b54a2;};'use strict';var pdf=require(_0x7af3('0x0'));var emlformat=require(_0x7af3('0x1'));var rimraf=require(_0x7af3('0x2'));var zipdir=require(_0x7af3('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7af3('0x4'));var moment=require(_0x7af3('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x7af3('0x6'));var sox=require(_0x7af3('0x7'));var csv=require(_0x7af3('0x8'));var ejs=require(_0x7af3('0x9'));var fs=require('fs');var _=require(_0x7af3('0xa'));var squel=require(_0x7af3('0xb'));var crypto=require(_0x7af3('0xc'));var jsforce=require(_0x7af3('0xd'));var deskjs=require(_0x7af3('0xe'));var toCsv=require(_0x7af3('0x8'));var querystring=require(_0x7af3('0xf'));var Papa=require(_0x7af3('0x10'));var Redis=require(_0x7af3('0x11'));var authService=require(_0x7af3('0x12'));var qs=require(_0x7af3('0x13'));var as=require(_0x7af3('0x14'));var hardwareService=require(_0x7af3('0x15'));var logger=require('../../config/logger')(_0x7af3('0x16'));var utils=require(_0x7af3('0x17'));var config=require(_0x7af3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53d9bd,_0x342157){_0x342157=_0x342157||0xcc;return function(_0x51e5e4){if(_0x51e5e4){return _0x53d9bd[_0x7af3('0x19')](_0x342157);}return _0x53d9bd['status'](_0x342157)[_0x7af3('0x1a')]();};}function respondWithResult(_0x42e009,_0x56e200){_0x56e200=_0x56e200||0xc8;return function(_0x5add56){if(_0x5add56){return _0x42e009[_0x7af3('0x1b')](_0x56e200)[_0x7af3('0x1c')](_0x5add56);}};}function respondWithFilteredResult(_0x36b2ed,_0x467338){return function(_0x2bd06c){if(_0x2bd06c){var _0x1ce43d=_0x2bd06c['count'],_0x4512f9=_0x467338[_0x7af3('0x1d')],_0x4dd77b=_0x467338[_0x7af3('0x1d')]+_0x467338[_0x7af3('0x1e')],_0x82c732;if(_0x4dd77b>=_0x1ce43d){_0x4dd77b=_0x1ce43d;_0x82c732=0xc8;}else{_0x82c732=0xce;}_0x36b2ed[_0x7af3('0x1b')](_0x82c732);return _0x36b2ed[_0x7af3('0x1f')]('Content-Range',_0x4512f9+'-'+_0x4dd77b+'/'+_0x1ce43d)[_0x7af3('0x1c')](_0x2bd06c);}return null;};}function patchUpdates(_0xdfed57){return function(_0x3423b3){try{jsonpatch[_0x7af3('0x20')](_0x3423b3,_0xdfed57,!![]);}catch(_0x201f34){return BPromise[_0x7af3('0x21')](_0x201f34);}return _0x3423b3[_0x7af3('0x22')]();};}function saveUpdates(_0x9762e,_0x3a52fb){return function(_0x2db63a){if(_0x2db63a){return _0x2db63a['update'](_0x9762e)[_0x7af3('0x23')](function(_0x586e0f){return _0x586e0f;});}return null;};}function removeEntity(_0x2e1ffb,_0x2fa7f5){return function(_0x78b8e){if(_0x78b8e){return _0x78b8e[_0x7af3('0x24')]()['then'](function(){_0x2e1ffb[_0x7af3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f4d52,_0x9935b5){return function(_0x221263){if(!_0x221263){_0x2f4d52[_0x7af3('0x19')](0x194);}return _0x221263;};}function handleError(_0x221e83,_0x4938a5){_0x4938a5=_0x4938a5||0x1f4;return function(_0x2d04f4){logger['error'](_0x2d04f4[_0x7af3('0x25')]);if(_0x2d04f4[_0x7af3('0x26')]){delete _0x2d04f4[_0x7af3('0x26')];}_0x221e83[_0x7af3('0x1b')](_0x4938a5)['send'](_0x2d04f4);};}exports[_0x7af3('0x27')]=function(_0x524c1d,_0x525cca){var _0x493803={},_0x4ad38a={},_0x2967b2={'count':0x0,'rows':[]};var _0x4bda8f=_[_0x7af3('0x28')](db[_0x7af3('0x29')][_0x7af3('0x2a')],function(_0x11ad2e){return{'name':_0x11ad2e['fieldName'],'type':_0x11ad2e[_0x7af3('0x2b')][_0x7af3('0x2c')]};});_0x4ad38a['model']=_['map'](_0x4bda8f,_0x7af3('0x26'));_0x4ad38a[_0x7af3('0x2d')]=_[_0x7af3('0x2e')](_0x524c1d[_0x7af3('0x2d')]);_0x4ad38a['filters']=_[_0x7af3('0x2f')](_0x4ad38a['model'],_0x4ad38a[_0x7af3('0x2d')]);_0x493803[_0x7af3('0x30')]=_[_0x7af3('0x2f')](_0x4ad38a[_0x7af3('0x31')],qs[_0x7af3('0x32')](_0x524c1d[_0x7af3('0x2d')][_0x7af3('0x32')]));_0x493803[_0x7af3('0x30')]=_0x493803[_0x7af3('0x30')]['length']?_0x493803['attributes']:_0x4ad38a[_0x7af3('0x31')];if(!_0x524c1d[_0x7af3('0x2d')]['hasOwnProperty']('nolimit')){_0x493803[_0x7af3('0x1e')]=qs[_0x7af3('0x1e')](_0x524c1d[_0x7af3('0x2d')][_0x7af3('0x1e')]);_0x493803[_0x7af3('0x1d')]=qs[_0x7af3('0x1d')](_0x524c1d[_0x7af3('0x2d')]['offset']);}_0x493803['order']=qs[_0x7af3('0x33')](_0x524c1d['query']['sort']);_0x493803[_0x7af3('0x34')]=qs[_0x7af3('0x35')](_[_0x7af3('0x36')](_0x524c1d[_0x7af3('0x2d')],_0x4ad38a['filters']),_0x4bda8f);if(_0x524c1d['query'][_0x7af3('0x37')]){_0x493803[_0x7af3('0x34')]=_[_0x7af3('0x38')](_0x493803['where'],{'$or':_['map'](_0x4bda8f,function(_0xf21bb1){if(_0xf21bb1['type']!=='VIRTUAL'){var _0x72d6cf={};_0x72d6cf[_0xf21bb1[_0x7af3('0x26')]]={'$like':'%'+_0x524c1d[_0x7af3('0x2d')]['filter']+'%'};return _0x72d6cf;}})});}_0x493803=_[_0x7af3('0x38')]({},_0x493803,_0x524c1d['options']);var _0x3ffdd1={'where':_0x493803[_0x7af3('0x34')]};return db[_0x7af3('0x29')][_0x7af3('0x39')](_0x3ffdd1)['then'](function(_0x337e78){_0x2967b2[_0x7af3('0x39')]=_0x337e78;if(_0x524c1d[_0x7af3('0x2d')][_0x7af3('0x3a')]){_0x493803['include']=[{'all':!![]}];}return db[_0x7af3('0x29')][_0x7af3('0x3b')](_0x493803);})[_0x7af3('0x23')](function(_0x4bc482){_0x2967b2['rows']=_0x4bc482;return _0x2967b2;})[_0x7af3('0x23')](respondWithFilteredResult(_0x525cca,_0x493803))[_0x7af3('0x3c')](handleError(_0x525cca,null));};exports[_0x7af3('0x3d')]=function(_0x317c00,_0x16b3f2){var _0x1f32e0={'raw':!![],'where':{'id':_0x317c00['params']['id']}},_0x5dc3dd={};_0x5dc3dd[_0x7af3('0x31')]=_[_0x7af3('0x2e')](db[_0x7af3('0x29')][_0x7af3('0x2a')]);_0x5dc3dd['query']=_[_0x7af3('0x2e')](_0x317c00[_0x7af3('0x2d')]);_0x5dc3dd[_0x7af3('0x35')]=_[_0x7af3('0x2f')](_0x5dc3dd[_0x7af3('0x31')],_0x5dc3dd[_0x7af3('0x2d')]);_0x1f32e0[_0x7af3('0x30')]=_['intersection'](_0x5dc3dd[_0x7af3('0x31')],qs[_0x7af3('0x32')](_0x317c00[_0x7af3('0x2d')][_0x7af3('0x32')]));_0x1f32e0['attributes']=_0x1f32e0[_0x7af3('0x30')][_0x7af3('0x3e')]?_0x1f32e0[_0x7af3('0x30')]:_0x5dc3dd[_0x7af3('0x31')];if(_0x317c00['query'][_0x7af3('0x3a')]){_0x1f32e0[_0x7af3('0x3f')]=[{'all':!![]}];}_0x1f32e0=_[_0x7af3('0x38')]({},_0x1f32e0,_0x317c00['options']);return db[_0x7af3('0x29')][_0x7af3('0x40')](_0x1f32e0)[_0x7af3('0x23')](handleEntityNotFound(_0x16b3f2,null))[_0x7af3('0x23')](respondWithResult(_0x16b3f2,null))[_0x7af3('0x3c')](handleError(_0x16b3f2,null));};exports[_0x7af3('0x41')]=function(_0x274df9,_0x4c411c){return db['OpenchannelTransferReport'][_0x7af3('0x41')](_0x274df9['body'],{})[_0x7af3('0x23')](respondWithResult(_0x4c411c,0xc9))[_0x7af3('0x3c')](handleError(_0x4c411c,null));};exports[_0x7af3('0x42')]=function(_0x14e106,_0x67146b){if(_0x14e106[_0x7af3('0x43')]['id']){delete _0x14e106[_0x7af3('0x43')]['id'];}return db[_0x7af3('0x29')][_0x7af3('0x40')]({'where':{'id':_0x14e106['params']['id']}})['then'](handleEntityNotFound(_0x67146b,null))[_0x7af3('0x23')](saveUpdates(_0x14e106[_0x7af3('0x43')],null))[_0x7af3('0x23')](respondWithResult(_0x67146b,null))[_0x7af3('0x3c')](handleError(_0x67146b,null));};exports['destroy']=function(_0x47ba79,_0x18736c){return db[_0x7af3('0x29')]['find']({'where':{'id':_0x47ba79[_0x7af3('0x44')]['id']}})['then'](handleEntityNotFound(_0x18736c,null))[_0x7af3('0x23')](removeEntity(_0x18736c,null))[_0x7af3('0x3c')](handleError(_0x18736c,null));};exports[_0x7af3('0x45')]=function(_0x1e219e,_0x26a263){return db['OpenchannelTransferReport'][_0x7af3('0x45')]()[_0x7af3('0x23')](respondWithResult(_0x26a263,null))[_0x7af3('0x3c')](handleError(_0x26a263,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index dd2f722..20b659f 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 _0xe714=['exports','define','OpenchannelTransferReport','uniqueid','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe714,0x12d));var _0x4e71=function(_0x25eca0,_0x2bbb67){_0x25eca0=_0x25eca0-0x0;var _0x1be6dd=_0xe714[_0x25eca0];return _0x1be6dd;};'use strict';var _=require(_0x4e71('0x0'));var util=require('util');var logger=require(_0x4e71('0x1'))(_0x4e71('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4e71('0x3'));var fs=require('fs');var path=require(_0x4e71('0x4'));var rimraf=require(_0x4e71('0x5'));var config=require(_0x4e71('0x6'));var attributes=require('./openchannelTransferReport.attributes');module[_0x4e71('0x7')]=function(_0x328530,_0x4f3066){return _0x328530[_0x4e71('0x8')](_0x4e71('0x9'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x4e71('0xa'),'fields':[_0x4e71('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x163c=['../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','uniqueid','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0xf7657b,_0x347b4c){var _0x532e52=function(_0x39b16c){while(--_0x39b16c){_0xf7657b['push'](_0xf7657b['shift']());}};_0x532e52(++_0x347b4c);}(_0x163c,0x1cd));var _0xc163=function(_0x458912,_0x48e08d){_0x458912=_0x458912-0x0;var _0x359eaf=_0x163c[_0x458912];return _0x359eaf;};'use strict';var _=require('lodash');var util=require(_0xc163('0x0'));var logger=require(_0xc163('0x1'))(_0xc163('0x2'));var moment=require('moment');var BPromise=require(_0xc163('0x3'));var rp=require(_0xc163('0x4'));var fs=require('fs');var path=require(_0xc163('0x5'));var rimraf=require(_0xc163('0x6'));var config=require(_0xc163('0x7'));var attributes=require(_0xc163('0x8'));module[_0xc163('0x9')]=function(_0x23dc11,_0x52a48b){return _0x23dc11[_0xc163('0xa')](_0xc163('0xb'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0xc163('0xc'),'fields':[_0xc163('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 6bf4ce6..930ea8a 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 _0x7596=['catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x232c5e,_0x877850){var _0x37bb4e=function(_0x1c51c4){while(--_0x1c51c4){_0x232c5e['push'](_0x232c5e['shift']());}};_0x37bb4e(++_0x877850);}(_0x7596,0xa2));var _0x6759=function(_0x2ea4c4,_0x1fe353){_0x2ea4c4=_0x2ea4c4-0x0;var _0x34fcb0=_0x7596[_0x2ea4c4];return _0x34fcb0;};'use strict';var _=require(_0x6759('0x0'));var util=require(_0x6759('0x1'));var moment=require(_0x6759('0x2'));var BPromise=require(_0x6759('0x3'));var rs=require(_0x6759('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6759('0x5'));var logger=require(_0x6759('0x6'))(_0x6759('0x7'));var config=require(_0x6759('0x8'));var jayson=require(_0x6759('0x9'));var client=jayson[_0x6759('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b51f4,_0x1f48d7,_0x5780ee){return new BPromise(function(_0x1d7e85,_0x4a789c){return client[_0x6759('0xb')](_0x4b51f4,_0x5780ee)[_0x6759('0xc')](function(_0x248531){logger[_0x6759('0xd')](_0x6759('0xe'),_0x1f48d7,'request\x20sent');logger[_0x6759('0xf')](_0x6759('0x10'),_0x1f48d7,_0x6759('0x11'),JSON[_0x6759('0x12')](_0x248531));if(_0x248531[_0x6759('0x13')]){if(_0x248531[_0x6759('0x13')][_0x6759('0x14')]===0x1f4){logger[_0x6759('0x13')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1f48d7,_0x248531[_0x6759('0x13')][_0x6759('0x15')]);return _0x4a789c(_0x248531[_0x6759('0x13')][_0x6759('0x15')]);}logger[_0x6759('0x13')](_0x6759('0xe'),_0x1f48d7,_0x248531[_0x6759('0x13')][_0x6759('0x15')]);return _0x1d7e85(_0x248531[_0x6759('0x13')][_0x6759('0x15')]);}else{logger[_0x6759('0xd')](_0x6759('0xe'),_0x1f48d7,_0x6759('0x11'));_0x1d7e85(_0x248531['result'][_0x6759('0x15')]);}})[_0x6759('0x16')](function(_0xc5e7db){logger[_0x6759('0x13')](_0x6759('0xe'),_0x1f48d7,_0xc5e7db);_0x4a789c(_0xc5e7db);});});} \ No newline at end of file +var _0xa699=['debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x42f69e,_0x1397f0){var _0x53c10d=function(_0x40ba3f){while(--_0x40ba3f){_0x42f69e['push'](_0x42f69e['shift']());}};_0x53c10d(++_0x1397f0);}(_0xa699,0x132));var _0x9a69=function(_0x2e6dee,_0x1a61b0){_0x2e6dee=_0x2e6dee-0x0;var _0x47706=_0xa699[_0x2e6dee];return _0x47706;};'use strict';var _=require('lodash');var util=require(_0x9a69('0x0'));var moment=require(_0x9a69('0x1'));var BPromise=require(_0x9a69('0x2'));var rs=require(_0x9a69('0x3'));var fs=require('fs');var Redis=require(_0x9a69('0x4'));var db=require(_0x9a69('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9a69('0x6'))(_0x9a69('0x7'));var config=require(_0x9a69('0x8'));var jayson=require(_0x9a69('0x9'));var client=jayson[_0x9a69('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x593a54,_0x5f482b,_0x3dea00){return new BPromise(function(_0x370adf,_0x1027ce){return client[_0x9a69('0xb')](_0x593a54,_0x3dea00)[_0x9a69('0xc')](function(_0x4a57b1){logger[_0x9a69('0xd')](_0x9a69('0xe'),_0x5f482b,_0x9a69('0xf'));logger[_0x9a69('0x10')](_0x9a69('0x11'),_0x5f482b,'request\x20sent',JSON[_0x9a69('0x12')](_0x4a57b1));if(_0x4a57b1[_0x9a69('0x13')]){if(_0x4a57b1['error'][_0x9a69('0x14')]===0x1f4){logger[_0x9a69('0x13')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x5f482b,_0x4a57b1[_0x9a69('0x13')][_0x9a69('0x15')]);return _0x1027ce(_0x4a57b1[_0x9a69('0x13')][_0x9a69('0x15')]);}logger[_0x9a69('0x13')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x5f482b,_0x4a57b1[_0x9a69('0x13')][_0x9a69('0x15')]);return _0x370adf(_0x4a57b1[_0x9a69('0x13')][_0x9a69('0x15')]);}else{logger[_0x9a69('0xd')](_0x9a69('0xe'),_0x5f482b,_0x9a69('0xf'));_0x370adf(_0x4a57b1['result'][_0x9a69('0x15')]);}})[_0x9a69('0x16')](function(_0x194d77){logger[_0x9a69('0x13')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x5f482b,_0x194d77);_0x1027ce(_0x194d77);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index ac2e212..8d03f58 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 _0x8275=['create','update','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','/:id','isAuthenticated','show','post'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8275,0x17a));var _0x5827=function(_0x36426d,_0x4d62fe){_0x36426d=_0x36426d-0x0;var _0x40bd33=_0x8275[_0x36426d];return _0x40bd33;};'use strict';var multer=require(_0x5827('0x0'));var util=require(_0x5827('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5827('0x2'));var router=express[_0x5827('0x3')]();var auth=require(_0x5827('0x4'));var interaction=require(_0x5827('0x5'));var config=require(_0x5827('0x6'));var controller=require(_0x5827('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x5827('0x8'),auth[_0x5827('0x9')](),controller[_0x5827('0xa')]);router[_0x5827('0xb')]('/',auth[_0x5827('0x9')](),controller[_0x5827('0xc')]);router['put'](_0x5827('0x8'),auth['isAuthenticated'](),controller[_0x5827('0xd')]);router['delete'](_0x5827('0x8'),auth[_0x5827('0x9')](),controller['destroy']);module[_0x5827('0xe')]=router; \ No newline at end of file +var _0xee67=['create','put','update','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','/:id','isAuthenticated'];(function(_0x195903,_0xabee3f){var _0x29f660=function(_0x1b923b){while(--_0x1b923b){_0x195903['push'](_0x195903['shift']());}};_0x29f660(++_0xabee3f);}(_0xee67,0x8d));var _0x7ee6=function(_0x38a372,_0x1d5d9d){_0x38a372=_0x38a372-0x0;var _0x41a0ea=_0xee67[_0x38a372];return _0x41a0ea;};'use strict';var multer=require(_0x7ee6('0x0'));var util=require(_0x7ee6('0x1'));var path=require(_0x7ee6('0x2'));var timeout=require('connect-timeout');var express=require(_0x7ee6('0x3'));var router=express[_0x7ee6('0x4')]();var auth=require(_0x7ee6('0x5'));var interaction=require(_0x7ee6('0x6'));var config=require(_0x7ee6('0x7'));var controller=require(_0x7ee6('0x8'));router[_0x7ee6('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x7ee6('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x7ee6('0xb')](),controller[_0x7ee6('0xc')]);router[_0x7ee6('0xd')](_0x7ee6('0xa'),auth[_0x7ee6('0xb')](),controller[_0x7ee6('0xe')]);router[_0x7ee6('0xf')](_0x7ee6('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x7ee6('0x10')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index bce8079..bac75fa 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 _0x8b40=['name','sequelize'];(function(_0x28f73d,_0x1722b0){var _0xf39d83=function(_0x24d23c){while(--_0x24d23c){_0x28f73d['push'](_0x28f73d['shift']());}};_0xf39d83(++_0x1722b0);}(_0x8b40,0x1b1));var _0x08b4=function(_0x25c106,_0x5b97a5){_0x25c106=_0x25c106-0x0;var _0x4ff2ce=_0x8b40[_0x25c106];return _0x4ff2ce;};'use strict';var Sequelize=require(_0x08b4('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x08b4('0x1'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x91d4=['exports','STRING','sequelize'];(function(_0x3adf42,_0x3d9c60){var _0x4b9e94=function(_0x19f93f){while(--_0x19f93f){_0x3adf42['push'](_0x3adf42['shift']());}};_0x4b9e94(++_0x3d9c60);}(_0x91d4,0xcb));var _0x491d=function(_0x478bcf,_0x11eb51){_0x478bcf=_0x478bcf-0x0;var _0x4b84e0=_0x91d4[_0x478bcf];return _0x4b84e0;};'use strict';var Sequelize=require(_0x491d('0x0'));module[_0x491d('0x1')]={'name':{'type':Sequelize[_0x491d('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x491d('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 659f48e..d3756a5 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 _0x028a=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','update','then','get','Pauses','error','name','send','map','Pause','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','rows','show','params','keys','include','options','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto'];(function(_0x3379af,_0x416f71){var _0x30134e=function(_0x1e017a){while(--_0x1e017a){_0x3379af['push'](_0x3379af['shift']());}};_0x30134e(++_0x416f71);}(_0x028a,0x130));var _0xa028=function(_0x5af85f,_0x1613c0){_0x5af85f=_0x5af85f-0x0;var _0x105018=_0x028a[_0x5af85f];return _0x105018;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa028('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa028('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa028('0x2'));var BPromise=require(_0xa028('0x3'));var Mustache=require(_0xa028('0x4'));var util=require(_0xa028('0x5'));var path=require(_0xa028('0x6'));var sox=require(_0xa028('0x7'));var csv=require(_0xa028('0x8'));var ejs=require(_0xa028('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa028('0xa'));var crypto=require(_0xa028('0xb'));var jsforce=require(_0xa028('0xc'));var deskjs=require(_0xa028('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa028('0xe'));var Papa=require(_0xa028('0xf'));var Redis=require(_0xa028('0x10'));var authService=require(_0xa028('0x11'));var qs=require(_0xa028('0x12'));var as=require(_0xa028('0x13'));var hardwareService=require(_0xa028('0x14'));var logger=require(_0xa028('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xa028('0x16'));var db=require(_0xa028('0x17'))['db'];function respondWithStatusCode(_0x3fcbd0,_0xa4885d){_0xa4885d=_0xa4885d||0xcc;return function(_0x256751){if(_0x256751){return _0x3fcbd0[_0xa028('0x18')](_0xa4885d);}return _0x3fcbd0[_0xa028('0x19')](_0xa4885d)[_0xa028('0x1a')]();};}function respondWithResult(_0x1f332a,_0xebefd3){_0xebefd3=_0xebefd3||0xc8;return function(_0x4b1544){if(_0x4b1544){return _0x1f332a[_0xa028('0x19')](_0xebefd3)[_0xa028('0x1b')](_0x4b1544);}};}function respondWithFilteredResult(_0x3fc0f6,_0x23b107){return function(_0x127442){if(_0x127442){var _0x2cf2aa=_0x127442[_0xa028('0x1c')],_0x2a03ba=_0x23b107[_0xa028('0x1d')],_0xca7e52=_0x23b107[_0xa028('0x1d')]+_0x23b107[_0xa028('0x1e')],_0x5c9aa;if(_0xca7e52>=_0x2cf2aa){_0xca7e52=_0x2cf2aa;_0x5c9aa=0xc8;}else{_0x5c9aa=0xce;}_0x3fc0f6[_0xa028('0x19')](_0x5c9aa);return _0x3fc0f6['set'](_0xa028('0x1f'),_0x2a03ba+'-'+_0xca7e52+'/'+_0x2cf2aa)[_0xa028('0x1b')](_0x127442);}return null;};}function patchUpdates(_0x16caf1){return function(_0x4116f3){try{jsonpatch[_0xa028('0x20')](_0x4116f3,_0x16caf1,!![]);}catch(_0xbba65){return BPromise['reject'](_0xbba65);}return _0x4116f3['save']();};}function saveUpdates(_0x698f42,_0x1cdfca){return function(_0x4c04e4){if(_0x4c04e4){return _0x4c04e4[_0xa028('0x21')](_0x698f42)[_0xa028('0x22')](function(_0xd17524){return _0xd17524;});}return null;};}function removeEntity(_0x25a311,_0xd892df){return function(_0x1e5c80){if(_0x1e5c80){return _0x1e5c80['destroy']()['then'](function(){var _0x5b3495=_0x1e5c80[_0xa028('0x23')]({'plain':!![]});var _0x4d96ec=_0xa028('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x4d96ec,'resourceId':_0x5b3495['id']}})[_0xa028('0x22')](function(){return _0x1e5c80;});})[_0xa028('0x22')](function(){_0x25a311['status'](0xcc)[_0xa028('0x1a')]();});}};}function handleEntityNotFound(_0xb1eaf4,_0x5ee91a){return function(_0x51b558){if(!_0x51b558){_0xb1eaf4['sendStatus'](0x194);}return _0x51b558;};}function handleError(_0x4e4c21,_0x1b87a1){_0x1b87a1=_0x1b87a1||0x1f4;return function(_0x18f5b1){logger[_0xa028('0x25')](_0x18f5b1['stack']);if(_0x18f5b1[_0xa028('0x26')]){delete _0x18f5b1['name'];}_0x4e4c21[_0xa028('0x19')](_0x1b87a1)[_0xa028('0x27')](_0x18f5b1);};}exports['index']=function(_0x3594e8,_0x534e5d){var _0xe6db91={},_0x31e2a0={},_0x390136={'count':0x0,'rows':[]};var _0x13951b=_[_0xa028('0x28')](db[_0xa028('0x29')][_0xa028('0x2a')],function(_0x5d6445){return{'name':_0x5d6445[_0xa028('0x2b')],'type':_0x5d6445[_0xa028('0x2c')]['key']};});_0x31e2a0[_0xa028('0x2d')]=_[_0xa028('0x28')](_0x13951b,_0xa028('0x26'));_0x31e2a0[_0xa028('0x2e')]=_['keys'](_0x3594e8[_0xa028('0x2e')]);_0x31e2a0[_0xa028('0x2f')]=_[_0xa028('0x30')](_0x31e2a0[_0xa028('0x2d')],_0x31e2a0[_0xa028('0x2e')]);_0xe6db91[_0xa028('0x31')]=_[_0xa028('0x30')](_0x31e2a0[_0xa028('0x2d')],qs[_0xa028('0x32')](_0x3594e8[_0xa028('0x2e')][_0xa028('0x32')]));_0xe6db91[_0xa028('0x31')]=_0xe6db91['attributes'][_0xa028('0x33')]?_0xe6db91[_0xa028('0x31')]:_0x31e2a0[_0xa028('0x2d')];if(!_0x3594e8[_0xa028('0x2e')][_0xa028('0x34')](_0xa028('0x35'))){_0xe6db91['limit']=qs[_0xa028('0x1e')](_0x3594e8[_0xa028('0x2e')][_0xa028('0x1e')]);_0xe6db91[_0xa028('0x1d')]=qs[_0xa028('0x1d')](_0x3594e8['query'][_0xa028('0x1d')]);}_0xe6db91['order']=qs[_0xa028('0x36')](_0x3594e8['query'][_0xa028('0x36')]);_0xe6db91[_0xa028('0x37')]=qs[_0xa028('0x2f')](_[_0xa028('0x38')](_0x3594e8[_0xa028('0x2e')],_0x31e2a0[_0xa028('0x2f')]),_0x13951b);if(_0x3594e8[_0xa028('0x2e')][_0xa028('0x39')]){_0xe6db91['where']=_['merge'](_0xe6db91[_0xa028('0x37')],{'$or':_[_0xa028('0x28')](_0x13951b,function(_0x6b3e90){if(_0x6b3e90[_0xa028('0x2c')]!==_0xa028('0x3a')){var _0x387414={};_0x387414[_0x6b3e90['name']]={'$like':'%'+_0x3594e8[_0xa028('0x2e')]['filter']+'%'};return _0x387414;}})});}_0xe6db91=_[_0xa028('0x3b')]({},_0xe6db91,_0x3594e8['options']);var _0x5a1138={'where':_0xe6db91[_0xa028('0x37')]};return db[_0xa028('0x29')][_0xa028('0x1c')](_0x5a1138)[_0xa028('0x22')](function(_0x101ec1){_0x390136['count']=_0x101ec1;if(_0x3594e8[_0xa028('0x2e')][_0xa028('0x3c')]){_0xe6db91['include']=[{'all':!![]}];}return db[_0xa028('0x29')][_0xa028('0x3d')](_0xe6db91);})[_0xa028('0x22')](function(_0x3da83f){_0x390136[_0xa028('0x3e')]=_0x3da83f;return _0x390136;})[_0xa028('0x22')](respondWithFilteredResult(_0x534e5d,_0xe6db91))['catch'](handleError(_0x534e5d,null));};exports[_0xa028('0x3f')]=function(_0x357f92,_0x5ba14d){var _0x27a0c0={'raw':!![],'where':{'id':_0x357f92[_0xa028('0x40')]['id']}},_0x467464={};_0x467464[_0xa028('0x2d')]=_[_0xa028('0x41')](db['Pause'][_0xa028('0x2a')]);_0x467464['query']=_[_0xa028('0x41')](_0x357f92['query']);_0x467464[_0xa028('0x2f')]=_[_0xa028('0x30')](_0x467464[_0xa028('0x2d')],_0x467464[_0xa028('0x2e')]);_0x27a0c0[_0xa028('0x31')]=_[_0xa028('0x30')](_0x467464[_0xa028('0x2d')],qs[_0xa028('0x32')](_0x357f92[_0xa028('0x2e')]['fields']));_0x27a0c0['attributes']=_0x27a0c0[_0xa028('0x31')]['length']?_0x27a0c0[_0xa028('0x31')]:_0x467464['model'];if(_0x357f92[_0xa028('0x2e')][_0xa028('0x3c')]){_0x27a0c0[_0xa028('0x42')]=[{'all':!![]}];}_0x27a0c0=_[_0xa028('0x3b')]({},_0x27a0c0,_0x357f92[_0xa028('0x43')]);return db['Pause'][_0xa028('0x44')](_0x27a0c0)[_0xa028('0x22')](handleEntityNotFound(_0x5ba14d,null))[_0xa028('0x22')](respondWithResult(_0x5ba14d,null))[_0xa028('0x45')](handleError(_0x5ba14d,null));};exports['create']=function(_0x27241a,_0x334af2){return db[_0xa028('0x29')][_0xa028('0x46')](_0x27241a['body'],{})[_0xa028('0x22')](function(_0x3d7134){var _0x21bd17=_0x27241a['user'][_0xa028('0x23')]({'plain':!![]});if(!_0x21bd17)throw new Error(_0xa028('0x47'));if(_0x21bd17[_0xa028('0x48')]==='user'){var _0x1b276a=_0x3d7134['get']({'plain':!![]});var _0x2ce0c8='Pauses';return db[_0xa028('0x49')][_0xa028('0x44')]({'where':{'name':_0x2ce0c8,'userProfileId':_0x21bd17['userProfileId']},'raw':!![]})[_0xa028('0x22')](function(_0x2457d7){if(_0x2457d7&&_0x2457d7[_0xa028('0x4a')]===0x0){return db[_0xa028('0x4b')][_0xa028('0x46')]({'name':_0x1b276a[_0xa028('0x26')],'resourceId':_0x1b276a['id'],'type':_0x2457d7[_0xa028('0x26')],'sectionId':_0x2457d7['id']},{})[_0xa028('0x22')](function(){return _0x3d7134;});}else{return _0x3d7134;}})[_0xa028('0x45')](function(_0x32e470){logger['error'](_0xa028('0x4c'),_0x32e470);throw _0x32e470;});}return _0x3d7134;})['then'](respondWithResult(_0x334af2,0xc9))[_0xa028('0x45')](handleError(_0x334af2,null));};exports[_0xa028('0x21')]=function(_0x3fb514,_0xa54667){if(_0x3fb514[_0xa028('0x4d')]['id']){delete _0x3fb514['body']['id'];}return db[_0xa028('0x29')][_0xa028('0x44')]({'where':{'id':_0x3fb514[_0xa028('0x40')]['id']}})[_0xa028('0x22')](handleEntityNotFound(_0xa54667,null))[_0xa028('0x22')](saveUpdates(_0x3fb514['body'],null))[_0xa028('0x22')](respondWithResult(_0xa54667,null))['catch'](handleError(_0xa54667,null));};exports[_0xa028('0x4e')]=function(_0x73abe7,_0x46b168){return db['Pause'][_0xa028('0x44')]({'where':{'id':_0x73abe7['params']['id']}})[_0xa028('0x22')](handleEntityNotFound(_0x46b168,null))[_0xa028('0x22')](removeEntity(_0x46b168,null))['catch'](handleError(_0x46b168,null));}; \ No newline at end of file +var _0xd362=['apply','reject','save','update','then','destroy','Pauses','UserProfileResource','name','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','Pause','findAll','rows','catch','show','params','find','create','body','user','get','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range'];(function(_0x57f7d7,_0x41443c){var _0x11b297=function(_0x2783ce){while(--_0x2783ce){_0x57f7d7['push'](_0x57f7d7['shift']());}};_0x11b297(++_0x41443c);}(_0xd362,0x1c6));var _0x2d36=function(_0x53f5bb,_0x5d45ce){_0x53f5bb=_0x53f5bb-0x0;var _0x4de461=_0xd362[_0x53f5bb];return _0x4de461;};'use strict';var pdf=require(_0x2d36('0x0'));var emlformat=require(_0x2d36('0x1'));var rimraf=require(_0x2d36('0x2'));var zipdir=require(_0x2d36('0x3'));var jsonpatch=require(_0x2d36('0x4'));var rp=require(_0x2d36('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2d36('0x6'));var util=require(_0x2d36('0x7'));var path=require(_0x2d36('0x8'));var sox=require(_0x2d36('0x9'));var csv=require(_0x2d36('0xa'));var ejs=require(_0x2d36('0xb'));var fs=require('fs');var _=require(_0x2d36('0xc'));var squel=require(_0x2d36('0xd'));var crypto=require(_0x2d36('0xe'));var jsforce=require(_0x2d36('0xf'));var deskjs=require(_0x2d36('0x10'));var toCsv=require('to-csv');var querystring=require(_0x2d36('0x11'));var Papa=require(_0x2d36('0x12'));var Redis=require(_0x2d36('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2d36('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2d36('0x15'))(_0x2d36('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x2d36('0x17'))['db'];function respondWithStatusCode(_0x3cc041,_0x3a89c1){_0x3a89c1=_0x3a89c1||0xcc;return function(_0x10f5f1){if(_0x10f5f1){return _0x3cc041[_0x2d36('0x18')](_0x3a89c1);}return _0x3cc041[_0x2d36('0x19')](_0x3a89c1)[_0x2d36('0x1a')]();};}function respondWithResult(_0x583cb4,_0xe996cd){_0xe996cd=_0xe996cd||0xc8;return function(_0x17684a){if(_0x17684a){return _0x583cb4[_0x2d36('0x19')](_0xe996cd)[_0x2d36('0x1b')](_0x17684a);}};}function respondWithFilteredResult(_0x551376,_0x4fa31c){return function(_0x41d6e2){if(_0x41d6e2){var _0x1fbd03=_0x41d6e2['count'],_0x58ba90=_0x4fa31c[_0x2d36('0x1c')],_0x1f4136=_0x4fa31c[_0x2d36('0x1c')]+_0x4fa31c[_0x2d36('0x1d')],_0x498710;if(_0x1f4136>=_0x1fbd03){_0x1f4136=_0x1fbd03;_0x498710=0xc8;}else{_0x498710=0xce;}_0x551376[_0x2d36('0x19')](_0x498710);return _0x551376[_0x2d36('0x1e')](_0x2d36('0x1f'),_0x58ba90+'-'+_0x1f4136+'/'+_0x1fbd03)[_0x2d36('0x1b')](_0x41d6e2);}return null;};}function patchUpdates(_0x39b373){return function(_0x42de10){try{jsonpatch[_0x2d36('0x20')](_0x42de10,_0x39b373,!![]);}catch(_0x2c09ea){return BPromise[_0x2d36('0x21')](_0x2c09ea);}return _0x42de10[_0x2d36('0x22')]();};}function saveUpdates(_0x6d7772,_0x1e7910){return function(_0x1d2373){if(_0x1d2373){return _0x1d2373[_0x2d36('0x23')](_0x6d7772)[_0x2d36('0x24')](function(_0x4b2523){return _0x4b2523;});}return null;};}function removeEntity(_0x5aadcc,_0x5885cf){return function(_0xccd243){if(_0xccd243){return _0xccd243[_0x2d36('0x25')]()[_0x2d36('0x24')](function(){var _0x274d0f=_0xccd243['get']({'plain':!![]});var _0x1df5bb=_0x2d36('0x26');return db[_0x2d36('0x27')][_0x2d36('0x25')]({'where':{'type':_0x1df5bb,'resourceId':_0x274d0f['id']}})[_0x2d36('0x24')](function(){return _0xccd243;});})[_0x2d36('0x24')](function(){_0x5aadcc[_0x2d36('0x19')](0xcc)[_0x2d36('0x1a')]();});}};}function handleEntityNotFound(_0x1ccd03,_0xc6ab18){return function(_0xb5c02d){if(!_0xb5c02d){_0x1ccd03[_0x2d36('0x18')](0x194);}return _0xb5c02d;};}function handleError(_0x321f85,_0x11f621){_0x11f621=_0x11f621||0x1f4;return function(_0x4c1f89){logger['error'](_0x4c1f89['stack']);if(_0x4c1f89[_0x2d36('0x28')]){delete _0x4c1f89[_0x2d36('0x28')];}_0x321f85[_0x2d36('0x19')](_0x11f621)['send'](_0x4c1f89);};}exports[_0x2d36('0x29')]=function(_0x59de4d,_0x491278){var _0x28f4d1={},_0x2b685a={},_0x5a1aee={'count':0x0,'rows':[]};var _0x359fb5=_[_0x2d36('0x2a')](db['Pause'][_0x2d36('0x2b')],function(_0x41a60d){return{'name':_0x41a60d[_0x2d36('0x2c')],'type':_0x41a60d[_0x2d36('0x2d')][_0x2d36('0x2e')]};});_0x2b685a[_0x2d36('0x2f')]=_['map'](_0x359fb5,_0x2d36('0x28'));_0x2b685a['query']=_[_0x2d36('0x30')](_0x59de4d['query']);_0x2b685a[_0x2d36('0x31')]=_[_0x2d36('0x32')](_0x2b685a[_0x2d36('0x2f')],_0x2b685a[_0x2d36('0x33')]);_0x28f4d1[_0x2d36('0x34')]=_[_0x2d36('0x32')](_0x2b685a['model'],qs[_0x2d36('0x35')](_0x59de4d['query'][_0x2d36('0x35')]));_0x28f4d1[_0x2d36('0x34')]=_0x28f4d1[_0x2d36('0x34')][_0x2d36('0x36')]?_0x28f4d1[_0x2d36('0x34')]:_0x2b685a[_0x2d36('0x2f')];if(!_0x59de4d[_0x2d36('0x33')][_0x2d36('0x37')](_0x2d36('0x38'))){_0x28f4d1[_0x2d36('0x1d')]=qs['limit'](_0x59de4d[_0x2d36('0x33')]['limit']);_0x28f4d1[_0x2d36('0x1c')]=qs[_0x2d36('0x1c')](_0x59de4d[_0x2d36('0x33')][_0x2d36('0x1c')]);}_0x28f4d1[_0x2d36('0x39')]=qs[_0x2d36('0x3a')](_0x59de4d[_0x2d36('0x33')][_0x2d36('0x3a')]);_0x28f4d1[_0x2d36('0x3b')]=qs[_0x2d36('0x31')](_[_0x2d36('0x3c')](_0x59de4d[_0x2d36('0x33')],_0x2b685a[_0x2d36('0x31')]),_0x359fb5);if(_0x59de4d[_0x2d36('0x33')][_0x2d36('0x3d')]){_0x28f4d1['where']=_[_0x2d36('0x3e')](_0x28f4d1[_0x2d36('0x3b')],{'$or':_[_0x2d36('0x2a')](_0x359fb5,function(_0x3096c8){if(_0x3096c8[_0x2d36('0x2d')]!==_0x2d36('0x3f')){var _0x39be70={};_0x39be70[_0x3096c8[_0x2d36('0x28')]]={'$like':'%'+_0x59de4d[_0x2d36('0x33')][_0x2d36('0x3d')]+'%'};return _0x39be70;}})});}_0x28f4d1=_['merge']({},_0x28f4d1,_0x59de4d[_0x2d36('0x40')]);var _0x3301d8={'where':_0x28f4d1[_0x2d36('0x3b')]};return db['Pause'][_0x2d36('0x41')](_0x3301d8)[_0x2d36('0x24')](function(_0x4fc6c4){_0x5a1aee[_0x2d36('0x41')]=_0x4fc6c4;if(_0x59de4d[_0x2d36('0x33')][_0x2d36('0x42')]){_0x28f4d1['include']=[{'all':!![]}];}return db[_0x2d36('0x43')][_0x2d36('0x44')](_0x28f4d1);})['then'](function(_0xa82909){_0x5a1aee[_0x2d36('0x45')]=_0xa82909;return _0x5a1aee;})[_0x2d36('0x24')](respondWithFilteredResult(_0x491278,_0x28f4d1))[_0x2d36('0x46')](handleError(_0x491278,null));};exports[_0x2d36('0x47')]=function(_0x5e253d,_0x199555){var _0x3eef51={'raw':!![],'where':{'id':_0x5e253d[_0x2d36('0x48')]['id']}},_0x87a788={};_0x87a788[_0x2d36('0x2f')]=_[_0x2d36('0x30')](db['Pause'][_0x2d36('0x2b')]);_0x87a788['query']=_[_0x2d36('0x30')](_0x5e253d[_0x2d36('0x33')]);_0x87a788[_0x2d36('0x31')]=_['intersection'](_0x87a788[_0x2d36('0x2f')],_0x87a788['query']);_0x3eef51[_0x2d36('0x34')]=_['intersection'](_0x87a788[_0x2d36('0x2f')],qs['fields'](_0x5e253d['query'][_0x2d36('0x35')]));_0x3eef51[_0x2d36('0x34')]=_0x3eef51['attributes'][_0x2d36('0x36')]?_0x3eef51[_0x2d36('0x34')]:_0x87a788[_0x2d36('0x2f')];if(_0x5e253d[_0x2d36('0x33')][_0x2d36('0x42')]){_0x3eef51['include']=[{'all':!![]}];}_0x3eef51=_[_0x2d36('0x3e')]({},_0x3eef51,_0x5e253d[_0x2d36('0x40')]);return db[_0x2d36('0x43')][_0x2d36('0x49')](_0x3eef51)['then'](handleEntityNotFound(_0x199555,null))[_0x2d36('0x24')](respondWithResult(_0x199555,null))[_0x2d36('0x46')](handleError(_0x199555,null));};exports[_0x2d36('0x4a')]=function(_0x1f62da,_0x1e14be){return db['Pause'][_0x2d36('0x4a')](_0x1f62da[_0x2d36('0x4b')],{})['then'](function(_0x280313){var _0x32909a=_0x1f62da[_0x2d36('0x4c')][_0x2d36('0x4d')]({'plain':!![]});if(!_0x32909a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x32909a[_0x2d36('0x4e')]===_0x2d36('0x4c')){var _0x56d8fc=_0x280313[_0x2d36('0x4d')]({'plain':!![]});var _0x2180c9=_0x2d36('0x26');return db['UserProfileSection'][_0x2d36('0x49')]({'where':{'name':_0x2180c9,'userProfileId':_0x32909a['userProfileId']},'raw':!![]})[_0x2d36('0x24')](function(_0x266b45){if(_0x266b45&&_0x266b45[_0x2d36('0x4f')]===0x0){return db[_0x2d36('0x27')][_0x2d36('0x4a')]({'name':_0x56d8fc[_0x2d36('0x28')],'resourceId':_0x56d8fc['id'],'type':_0x266b45[_0x2d36('0x28')],'sectionId':_0x266b45['id']},{})['then'](function(){return _0x280313;});}else{return _0x280313;}})[_0x2d36('0x46')](function(_0x383825){logger['error'](_0x2d36('0x50'),_0x383825);throw _0x383825;});}return _0x280313;})['then'](respondWithResult(_0x1e14be,0xc9))[_0x2d36('0x46')](handleError(_0x1e14be,null));};exports[_0x2d36('0x23')]=function(_0x108c0e,_0xf2ddb0){if(_0x108c0e[_0x2d36('0x4b')]['id']){delete _0x108c0e['body']['id'];}return db['Pause'][_0x2d36('0x49')]({'where':{'id':_0x108c0e[_0x2d36('0x48')]['id']}})['then'](handleEntityNotFound(_0xf2ddb0,null))[_0x2d36('0x24')](saveUpdates(_0x108c0e[_0x2d36('0x4b')],null))[_0x2d36('0x24')](respondWithResult(_0xf2ddb0,null))[_0x2d36('0x46')](handleError(_0xf2ddb0,null));};exports[_0x2d36('0x25')]=function(_0x2d7fd7,_0x9e85cc){return db[_0x2d36('0x43')][_0x2d36('0x49')]({'where':{'id':_0x2d7fd7['params']['id']}})[_0x2d36('0x24')](handleEntityNotFound(_0x9e85cc,null))[_0x2d36('0x24')](removeEntity(_0x9e85cc,null))[_0x2d36('0x46')](handleError(_0x9e85cc,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 7a19e93..fd8ef81 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 _0x793b=['api','moment','request-promise','path','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','../../config/logger'];(function(_0x2af117,_0x3ebd51){var _0x1215ae=function(_0x4cead6){while(--_0x4cead6){_0x2af117['push'](_0x2af117['shift']());}};_0x1215ae(++_0x3ebd51);}(_0x793b,0x189));var _0xb793=function(_0x211cdd,_0x4810b4){_0x211cdd=_0x211cdd-0x0;var _0x889708=_0x793b[_0x211cdd];return _0x889708;};'use strict';var _=require(_0xb793('0x0'));var util=require(_0xb793('0x1'));var logger=require(_0xb793('0x2'))(_0xb793('0x3'));var moment=require(_0xb793('0x4'));var BPromise=require('bluebird');var rp=require(_0xb793('0x5'));var fs=require('fs');var path=require(_0xb793('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb793('0x7'));module[_0xb793('0x8')]=function(_0x322b07,_0x2b1f19){return _0x322b07[_0xb793('0x9')](_0xb793('0xa'),attributes,{'tableName':_0xb793('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x23db=['api','moment','bluebird','rimraf','../../config/environment','exports','define','Pause','tools_pauses','lodash','util','../../config/logger'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x23db,0x141));var _0xb23d=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x23db[_0x2ec461];return _0x28603d;};'use strict';var _=require(_0xb23d('0x0'));var util=require(_0xb23d('0x1'));var logger=require(_0xb23d('0x2'))(_0xb23d('0x3'));var moment=require(_0xb23d('0x4'));var BPromise=require(_0xb23d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb23d('0x6'));var config=require(_0xb23d('0x7'));var attributes=require('./pause.attributes');module[_0xb23d('0x8')]=function(_0x3a2ba6,_0x105811){return _0x3a2ba6[_0xb23d('0x9')](_0xb23d('0xa'),attributes,{'tableName':_0xb23d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 42b9464..078d340 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 _0xe0d7=['error','code','Pause,\x20%s,\x20%s','message','catch','ShowPause','Pause','find','options','where','attributes','include','model','map','stringify','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s'];(function(_0x318751,_0x5e4490){var _0x3ab48d=function(_0xe22e8c){while(--_0xe22e8c){_0x318751['push'](_0x318751['shift']());}};_0x3ab48d(++_0x5e4490);}(_0xe0d7,0x1e0));var _0x7e0d=function(_0x92d72e,_0x6e0a25){_0x92d72e=_0x92d72e-0x0;var _0x5760c1=_0xe0d7[_0x92d72e];return _0x5760c1;};'use strict';var _=require('lodash');var util=require(_0x7e0d('0x0'));var moment=require('moment');var BPromise=require(_0x7e0d('0x1'));var rs=require(_0x7e0d('0x2'));var fs=require('fs');var Redis=require(_0x7e0d('0x3'));var db=require(_0x7e0d('0x4'))['db'];var utils=require(_0x7e0d('0x5'));var logger=require(_0x7e0d('0x6'))(_0x7e0d('0x7'));var config=require(_0x7e0d('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7e0d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x71294c,_0x42cfd7,_0x3bf7e2){return new BPromise(function(_0x1839fd,_0x1b8a71){return client[_0x7e0d('0xa')](_0x71294c,_0x3bf7e2)[_0x7e0d('0xb')](function(_0x34e8e9){logger[_0x7e0d('0xc')]('Pause,\x20%s,\x20%s',_0x42cfd7,_0x7e0d('0xd'));logger[_0x7e0d('0xe')](_0x7e0d('0xf'),_0x42cfd7,'request\x20sent',JSON['stringify'](_0x34e8e9));if(_0x34e8e9['error']){if(_0x34e8e9[_0x7e0d('0x10')][_0x7e0d('0x11')]===0x1f4){logger[_0x7e0d('0x10')](_0x7e0d('0x12'),_0x42cfd7,_0x34e8e9[_0x7e0d('0x10')]['message']);return _0x1b8a71(_0x34e8e9['error'][_0x7e0d('0x13')]);}logger['error'](_0x7e0d('0x12'),_0x42cfd7,_0x34e8e9['error'][_0x7e0d('0x13')]);return _0x1839fd(_0x34e8e9[_0x7e0d('0x10')][_0x7e0d('0x13')]);}else{logger[_0x7e0d('0xc')](_0x7e0d('0x12'),_0x42cfd7,_0x7e0d('0xd'));_0x1839fd(_0x34e8e9['result'][_0x7e0d('0x13')]);}})[_0x7e0d('0x14')](function(_0x1b6161){logger[_0x7e0d('0x10')](_0x7e0d('0x12'),_0x42cfd7,_0x1b6161);_0x1b8a71(_0x1b6161);});});}exports[_0x7e0d('0x15')]=function(_0x366a22){var _0x589954=this;return new Promise(function(_0x584561,_0x178924){return db[_0x7e0d('0x16')][_0x7e0d('0x17')]({'raw':_0x366a22[_0x7e0d('0x18')]?_0x366a22['options']['raw']===undefined?!![]:![]:!![],'where':_0x366a22[_0x7e0d('0x18')]?_0x366a22[_0x7e0d('0x18')][_0x7e0d('0x19')]||null:null,'attributes':_0x366a22[_0x7e0d('0x18')]?_0x366a22[_0x7e0d('0x18')][_0x7e0d('0x1a')]||null:null,'include':_0x366a22['options']?_0x366a22[_0x7e0d('0x18')][_0x7e0d('0x1b')]?_['map'](_0x366a22[_0x7e0d('0x18')][_0x7e0d('0x1b')],function(_0x3b9307){return{'model':db[_0x3b9307[_0x7e0d('0x1c')]],'as':_0x3b9307['as'],'attributes':_0x3b9307[_0x7e0d('0x1a')],'include':_0x3b9307[_0x7e0d('0x1b')]?_[_0x7e0d('0x1d')](_0x3b9307[_0x7e0d('0x1b')],function(_0x472b4f){return{'model':db[_0x472b4f[_0x7e0d('0x1c')]],'as':_0x472b4f['as'],'attributes':_0x472b4f[_0x7e0d('0x1a')],'include':_0x472b4f[_0x7e0d('0x1b')]?_[_0x7e0d('0x1d')](_0x472b4f[_0x7e0d('0x1b')],function(_0x2d6798){return{'model':db[_0x2d6798[_0x7e0d('0x1c')]],'as':_0x2d6798['as'],'attributes':_0x2d6798[_0x7e0d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x7e0d('0xb')](function(_0x4c0eda){logger[_0x7e0d('0xc')](_0x7e0d('0x15'),_0x366a22);logger[_0x7e0d('0xe')](_0x7e0d('0x15'),_0x366a22,JSON[_0x7e0d('0x1e')](_0x4c0eda));_0x584561(_0x4c0eda);})[_0x7e0d('0x14')](function(_0x3108c3){logger['error'](_0x7e0d('0x15'),_0x3108c3[_0x7e0d('0x13')],_0x366a22);_0x178924(_0x589954[_0x7e0d('0x10')](0x1f4,_0x3108c3[_0x7e0d('0x13')]));});});}; \ No newline at end of file +var _0x1f10=['Pause,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowPause','Pause','options','raw','attributes','map','include','model','lodash','util','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2cbc82,_0x30d15a){var _0x222f31=function(_0x51bc14){while(--_0x51bc14){_0x2cbc82['push'](_0x2cbc82['shift']());}};_0x222f31(++_0x30d15a);}(_0x1f10,0x69));var _0x01f1=function(_0x44ff66,_0x4d0541){_0x44ff66=_0x44ff66-0x0;var _0x4fe0c1=_0x1f10[_0x44ff66];return _0x4fe0c1;};'use strict';var _=require(_0x01f1('0x0'));var util=require(_0x01f1('0x1'));var moment=require('moment');var BPromise=require(_0x01f1('0x2'));var rs=require(_0x01f1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x01f1('0x4'));var logger=require('../../config/logger')(_0x01f1('0x5'));var config=require(_0x01f1('0x6'));var jayson=require(_0x01f1('0x7'));var client=jayson['client'][_0x01f1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x35b9d4,_0x33e3d5,_0x17f4d1){return new BPromise(function(_0x24609f,_0xe7b374){return client[_0x01f1('0x9')](_0x35b9d4,_0x17f4d1)[_0x01f1('0xa')](function(_0x5e1409){logger[_0x01f1('0xb')](_0x01f1('0xc'),_0x33e3d5,_0x01f1('0xd'));logger[_0x01f1('0xe')](_0x01f1('0xf'),_0x33e3d5,'request\x20sent',JSON[_0x01f1('0x10')](_0x5e1409));if(_0x5e1409[_0x01f1('0x11')]){if(_0x5e1409[_0x01f1('0x11')][_0x01f1('0x12')]===0x1f4){logger[_0x01f1('0x11')](_0x01f1('0xc'),_0x33e3d5,_0x5e1409[_0x01f1('0x11')][_0x01f1('0x13')]);return _0xe7b374(_0x5e1409['error'][_0x01f1('0x13')]);}logger[_0x01f1('0x11')](_0x01f1('0xc'),_0x33e3d5,_0x5e1409[_0x01f1('0x11')][_0x01f1('0x13')]);return _0x24609f(_0x5e1409['error'][_0x01f1('0x13')]);}else{logger['info'](_0x01f1('0xc'),_0x33e3d5,_0x01f1('0xd'));_0x24609f(_0x5e1409[_0x01f1('0x14')][_0x01f1('0x13')]);}})[_0x01f1('0x15')](function(_0x3e68be){logger[_0x01f1('0x11')](_0x01f1('0xc'),_0x33e3d5,_0x3e68be);_0xe7b374(_0x3e68be);});});}exports[_0x01f1('0x16')]=function(_0x2ea799){var _0x1465c2=this;return new Promise(function(_0x3b0e2e,_0x234024){return db[_0x01f1('0x17')]['find']({'raw':_0x2ea799[_0x01f1('0x18')]?_0x2ea799[_0x01f1('0x18')][_0x01f1('0x19')]===undefined?!![]:![]:!![],'where':_0x2ea799[_0x01f1('0x18')]?_0x2ea799[_0x01f1('0x18')]['where']||null:null,'attributes':_0x2ea799[_0x01f1('0x18')]?_0x2ea799[_0x01f1('0x18')][_0x01f1('0x1a')]||null:null,'include':_0x2ea799[_0x01f1('0x18')]?_0x2ea799[_0x01f1('0x18')]['include']?_[_0x01f1('0x1b')](_0x2ea799[_0x01f1('0x18')][_0x01f1('0x1c')],function(_0x2fef7a){return{'model':db[_0x2fef7a[_0x01f1('0x1d')]],'as':_0x2fef7a['as'],'attributes':_0x2fef7a[_0x01f1('0x1a')],'include':_0x2fef7a[_0x01f1('0x1c')]?_['map'](_0x2fef7a['include'],function(_0x5d4cfe){return{'model':db[_0x5d4cfe[_0x01f1('0x1d')]],'as':_0x5d4cfe['as'],'attributes':_0x5d4cfe[_0x01f1('0x1a')],'include':_0x5d4cfe[_0x01f1('0x1c')]?_[_0x01f1('0x1b')](_0x5d4cfe[_0x01f1('0x1c')],function(_0x562b13){return{'model':db[_0x562b13[_0x01f1('0x1d')]],'as':_0x562b13['as'],'attributes':_0x562b13[_0x01f1('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x01f1('0xa')](function(_0x1a3771){logger['info'](_0x01f1('0x16'),_0x2ea799);logger[_0x01f1('0xe')]('ShowPause',_0x2ea799,JSON['stringify'](_0x1a3771));_0x3b0e2e(_0x1a3771);})[_0x01f1('0x15')](function(_0x520155){logger[_0x01f1('0x11')](_0x01f1('0x16'),_0x520155[_0x01f1('0x13')],_0x2ea799);_0x234024(_0x1465c2[_0x01f1('0x11')](0x1f4,_0x520155[_0x01f1('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index eac969c..a3a7d6e 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 _0xdb51=['exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./plugin.controller','index','get','/webhook','webhookGet','/:id/download','download','diskStorage','root','server/files/plugins','originalname','format','%s-%s%s','basename','extname','now','post','single','file','upload','put','/:id','isAuthenticated','update','delete'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0xdb51,0x101));var _0x1db5=function(_0x147d98,_0x3de53a){_0x147d98=_0x147d98-0x0;var _0x5006c2=_0xdb51[_0x147d98];return _0x5006c2;};'use strict';var multer=require('multer');var util=require(_0x1db5('0x0'));var path=require('path');var timeout=require(_0x1db5('0x1'));var express=require(_0x1db5('0x2'));var router=express[_0x1db5('0x3')]();var auth=require(_0x1db5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1db5('0x5'));var controller=require(_0x1db5('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x1db5('0x7')]);router[_0x1db5('0x8')](_0x1db5('0x9'),controller[_0x1db5('0xa')]);router[_0x1db5('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x1db5('0x8')](_0x1db5('0xb'),auth['isAuthenticated'](),controller[_0x1db5('0xc')]);var upload=multer({'storage':multer[_0x1db5('0xd')]({'destination':function(_0x1eb119,_0x39281a,_0x3b16c0){_0x3b16c0(null,path['join'](config[_0x1db5('0xe')],_0x1db5('0xf')));},'filename':function(_0x4925b9,_0x105ab6,_0x1b875b){_0x105ab6[_0x1db5('0x10')]=_0x105ab6[_0x1db5('0x10')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1b875b(null,util[_0x1db5('0x11')](_0x1db5('0x12'),path[_0x1db5('0x13')](_0x105ab6[_0x1db5('0x10')],path[_0x1db5('0x14')](_0x105ab6['originalname'])),Date[_0x1db5('0x15')](),path[_0x1db5('0x14')](_0x105ab6[_0x1db5('0x10')])));}})});router[_0x1db5('0x16')]('/',upload[_0x1db5('0x17')](_0x1db5('0x18')),controller[_0x1db5('0x19')]);router[_0x1db5('0x16')](_0x1db5('0x9'),controller['webhookPost']);router[_0x1db5('0x1a')](_0x1db5('0x1b'),auth[_0x1db5('0x1c')](),controller[_0x1db5('0x1d')]);router[_0x1db5('0x1e')](_0x1db5('0x1b'),auth['isAuthenticated'](),controller[_0x1db5('0x1e')]);module[_0x1db5('0x1f')]=router; \ No newline at end of file +var _0xf1ed=['diskStorage','root','server/files/plugins','originalname','replace','format','%s-%s%s','now','extname','post','single','put','delete','exports','util','express','Router','../../components/interaction/service','./plugin.controller','get','/webhook','webhookGet','/:id','isAuthenticated','show','/:id/download','download'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf1ed,0x7a));var _0xdf1e=function(_0x51d0a9,_0x18972d){_0x51d0a9=_0x51d0a9-0x0;var _0x3ebb70=_0xf1ed[_0x51d0a9];return _0x3ebb70;};'use strict';var multer=require('multer');var util=require(_0xdf1e('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdf1e('0x1'));var router=express[_0xdf1e('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xdf1e('0x3'));var config=require('../../config/environment');var controller=require(_0xdf1e('0x4'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xdf1e('0x5')](_0xdf1e('0x6'),controller[_0xdf1e('0x7')]);router[_0xdf1e('0x5')](_0xdf1e('0x8'),auth[_0xdf1e('0x9')](),controller[_0xdf1e('0xa')]);router[_0xdf1e('0x5')](_0xdf1e('0xb'),auth[_0xdf1e('0x9')](),controller[_0xdf1e('0xc')]);var upload=multer({'storage':multer[_0xdf1e('0xd')]({'destination':function(_0x129445,_0x599071,_0x21d74f){_0x21d74f(null,path['join'](config[_0xdf1e('0xe')],_0xdf1e('0xf')));},'filename':function(_0x512ea0,_0x3d1d83,_0x44b069){_0x3d1d83[_0xdf1e('0x10')]=_0x3d1d83[_0xdf1e('0x10')][_0xdf1e('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x44b069(null,util[_0xdf1e('0x12')](_0xdf1e('0x13'),path['basename'](_0x3d1d83[_0xdf1e('0x10')],path['extname'](_0x3d1d83[_0xdf1e('0x10')])),Date[_0xdf1e('0x14')](),path[_0xdf1e('0x15')](_0x3d1d83[_0xdf1e('0x10')])));}})});router[_0xdf1e('0x16')]('/',upload[_0xdf1e('0x17')]('file'),controller['upload']);router['post'](_0xdf1e('0x6'),controller['webhookPost']);router[_0xdf1e('0x18')](_0xdf1e('0x8'),auth[_0xdf1e('0x9')](),controller['update']);router[_0xdf1e('0x19')](_0xdf1e('0x8'),auth['isAuthenticated'](),controller[_0xdf1e('0x19')]);module[_0xdf1e('0x1a')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index e7f4a3e..7924a14 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 _0xe301=['STRING','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM','adminOnly','agentOnly','never','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports'];(function(_0x19a4a5,_0x405e18){var _0x1196b3=function(_0x5cdc32){while(--_0x5cdc32){_0x19a4a5['push'](_0x19a4a5['shift']());}};_0x1196b3(++_0x405e18);}(_0xe301,0x11b));var _0x1e30=function(_0x49477a,_0xc9d17c){_0x49477a=_0x49477a-0x0;var _0x4edd60=_0xe301[_0x49477a];return _0x4edd60;};'use strict';var Sequelize=require(_0x1e30('0x0'));module[_0x1e30('0x1')]={'name':{'type':Sequelize[_0x1e30('0x2')]},'type':{'type':Sequelize['ENUM'](_0x1e30('0x3'),_0x1e30('0x4'))},'description':{'type':Sequelize[_0x1e30('0x5')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x1e30('0x2')],'comment':_0x1e30('0x6')},'active':{'type':Sequelize[_0x1e30('0x7')],'defaultValue':0x0,'comment':_0x1e30('0x8')},'sidebar':{'type':Sequelize[_0x1e30('0x9')](_0x1e30('0xa'),_0x1e30('0xb'),'always',_0x1e30('0xc')),'defaultValue':_0x1e30('0xd'),'comment':_0x1e30('0xe')},'icon':{'type':Sequelize[_0x1e30('0x2')]},'adminUrl':{'type':Sequelize[_0x1e30('0x2')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x1e30('0x2')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1acc=['always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','STRING','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM','adminOnly'];(function(_0x5d52cd,_0x1eebae){var _0x4ca09d=function(_0x2f4111){while(--_0x2f4111){_0x5d52cd['push'](_0x5d52cd['shift']());}};_0x4ca09d(++_0x1eebae);}(_0x1acc,0xd3));var _0xc1ac=function(_0x1be03d,_0x46cccf){_0x1be03d=_0x1be03d-0x0;var _0x45aeda=_0x1acc[_0x1be03d];return _0x45aeda;};'use strict';var Sequelize=require(_0xc1ac('0x0'));module['exports']={'name':{'type':Sequelize[_0xc1ac('0x1')]},'type':{'type':Sequelize['ENUM'](_0xc1ac('0x2'),_0xc1ac('0x3'))},'description':{'type':Sequelize[_0xc1ac('0x4')]},'version':{'type':Sequelize[_0xc1ac('0x4')]},'path':{'type':Sequelize['STRING'],'comment':_0xc1ac('0x5')},'active':{'type':Sequelize[_0xc1ac('0x6')],'defaultValue':0x0,'comment':_0xc1ac('0x7')},'sidebar':{'type':Sequelize[_0xc1ac('0x8')](_0xc1ac('0x9'),'agentOnly',_0xc1ac('0xa'),_0xc1ac('0xb')),'defaultValue':_0xc1ac('0xa'),'comment':_0xc1ac('0xc')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0xc1ac('0x1')]},'agentUrl':{'type':Sequelize[_0xc1ac('0x1')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0xc1ac('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index ef5f2c1..91670c6 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 _0xc282=['offset','Content-Range','apply','reject','save','update','destroy','then','Plugins','end','stack','name','send','Plugin','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','where','merge','options','include','findAll','rows','params','rawAttributes','includeAll','catch','download','find','join','root','server/files/plugins','zip','code','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','**/*','node_modules/**/*','basename','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','format','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','icon-apps','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','body','delete','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-type','set','endsWith','statusCode','webhookPost','content-length','html-pdf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','extract-zip','rimraf','archiver','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','json','count'];(function(_0x3db7b2,_0x69280e){var _0x35af44=function(_0x5d5435){while(--_0x5d5435){_0x3db7b2['push'](_0x3db7b2['shift']());}};_0x35af44(++_0x69280e);}(_0xc282,0x12d));var _0x2c28=function(_0x25f192,_0x474c2b){_0x25f192=_0x25f192-0x0;var _0x16652f=_0xc282[_0x25f192];return _0x16652f;};'use strict';var pdf=require(_0x2c28('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2c28('0x1'));var rp=require('request-promise');var moment=require(_0x2c28('0x2'));var BPromise=require(_0x2c28('0x3'));var Mustache=require(_0x2c28('0x4'));var util=require(_0x2c28('0x5'));var path=require(_0x2c28('0x6'));var sox=require(_0x2c28('0x7'));var csv=require(_0x2c28('0x8'));var ejs=require(_0x2c28('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2c28('0xa'));var crypto=require(_0x2c28('0xb'));var jsforce=require(_0x2c28('0xc'));var deskjs=require(_0x2c28('0xd'));var toCsv=require(_0x2c28('0x8'));var querystring=require(_0x2c28('0xe'));var Papa=require('papaparse');var extract=require(_0x2c28('0xf'));var rimraf=require(_0x2c28('0x10'));var archiver=require(_0x2c28('0x11'));var Redis=require('ioredis');var authService=require(_0x2c28('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2c28('0x13'));var hardwareService=require(_0x2c28('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x2c28('0x15'));var config=require(_0x2c28('0x16'));var db=require(_0x2c28('0x17'))['db'];config['redis']=_[_0x2c28('0x18')](config[_0x2c28('0x19')],{'host':_0x2c28('0x1a'),'port':0x18eb});var socket=require(_0x2c28('0x1b'))(new Redis(config[_0x2c28('0x19')]));require('./plugin.socket')[_0x2c28('0x1c')](socket);function respondWithStatusCode(_0x5ceaa3,_0x2b41ec){_0x2b41ec=_0x2b41ec||0xcc;return function(_0x249be0){if(_0x249be0){return _0x5ceaa3[_0x2c28('0x1d')](_0x2b41ec);}return _0x5ceaa3['status'](_0x2b41ec)['end']();};}function respondWithResult(_0x206669,_0x5b6864){_0x5b6864=_0x5b6864||0xc8;return function(_0x41ee6f){if(_0x41ee6f){return _0x206669[_0x2c28('0x1e')](_0x5b6864)[_0x2c28('0x1f')](_0x41ee6f);}};}function respondWithFilteredResult(_0x500a98,_0x1f9e2d){return function(_0x1bee4e){if(_0x1bee4e){var _0x4661e2=_0x1bee4e[_0x2c28('0x20')],_0x53e226=_0x1f9e2d[_0x2c28('0x21')],_0x38874d=_0x1f9e2d[_0x2c28('0x21')]+_0x1f9e2d['limit'],_0x58ae3a;if(_0x38874d>=_0x4661e2){_0x38874d=_0x4661e2;_0x58ae3a=0xc8;}else{_0x58ae3a=0xce;}_0x500a98['status'](_0x58ae3a);return _0x500a98['set'](_0x2c28('0x22'),_0x53e226+'-'+_0x38874d+'/'+_0x4661e2)[_0x2c28('0x1f')](_0x1bee4e);}return null;};}function patchUpdates(_0x3344e8){return function(_0x168657){try{jsonpatch[_0x2c28('0x23')](_0x168657,_0x3344e8,!![]);}catch(_0x1b646e){return BPromise[_0x2c28('0x24')](_0x1b646e);}return _0x168657[_0x2c28('0x25')]();};}function saveUpdates(_0x3d0c4e,_0x272be3){return function(_0xf66ca2){if(_0xf66ca2){return _0xf66ca2[_0x2c28('0x26')](_0x3d0c4e)['then'](function(_0x786e0f){return _0x786e0f;});}return null;};}function removeEntity(_0x687ddc,_0x37ef09){return function(_0x184219){if(_0x184219){return _0x184219[_0x2c28('0x27')]()[_0x2c28('0x28')](function(){var _0x301ae0=_0x184219['get']({'plain':!![]});var _0x126b37=_0x2c28('0x29');return db['UserProfileResource'][_0x2c28('0x27')]({'where':{'type':_0x126b37,'resourceId':_0x301ae0['id']}})['then'](function(){return _0x184219;});})[_0x2c28('0x28')](function(){_0x687ddc[_0x2c28('0x1e')](0xcc)[_0x2c28('0x2a')]();});}};}function handleEntityNotFound(_0x7c5015,_0xafe94f){return function(_0xc1263){if(!_0xc1263){_0x7c5015['sendStatus'](0x194);}return _0xc1263;};}function handleError(_0x16ebe8,_0x3a2af8){_0x3a2af8=_0x3a2af8||0x1f4;return function(_0x497a10){logger['error'](_0x497a10[_0x2c28('0x2b')]);if(_0x497a10[_0x2c28('0x2c')]){delete _0x497a10['name'];}_0x16ebe8[_0x2c28('0x1e')](_0x3a2af8)[_0x2c28('0x2d')](_0x497a10);};}exports['index']=function(_0x4d9ef0,_0x448992){var _0x56a66e={},_0x442ba6={},_0x5a370f={'count':0x0,'rows':[]};var _0x218be3=_['map'](db[_0x2c28('0x2e')]['rawAttributes'],function(_0x1f7bd5){return{'name':_0x1f7bd5['fieldName'],'type':_0x1f7bd5[_0x2c28('0x2f')][_0x2c28('0x30')]};});_0x442ba6['model']=_[_0x2c28('0x31')](_0x218be3,_0x2c28('0x2c'));_0x442ba6['query']=_[_0x2c28('0x32')](_0x4d9ef0[_0x2c28('0x33')]);_0x442ba6[_0x2c28('0x34')]=_[_0x2c28('0x35')](_0x442ba6[_0x2c28('0x36')],_0x442ba6[_0x2c28('0x33')]);_0x56a66e[_0x2c28('0x37')]=_['intersection'](_0x442ba6[_0x2c28('0x36')],qs[_0x2c28('0x38')](_0x4d9ef0['query']['fields']));_0x56a66e[_0x2c28('0x37')]=_0x56a66e[_0x2c28('0x37')][_0x2c28('0x39')]?_0x56a66e[_0x2c28('0x37')]:_0x442ba6[_0x2c28('0x36')];if(!_0x4d9ef0['query'][_0x2c28('0x3a')](_0x2c28('0x3b'))){_0x56a66e[_0x2c28('0x3c')]=qs[_0x2c28('0x3c')](_0x4d9ef0[_0x2c28('0x33')][_0x2c28('0x3c')]);_0x56a66e[_0x2c28('0x21')]=qs[_0x2c28('0x21')](_0x4d9ef0[_0x2c28('0x33')][_0x2c28('0x21')]);}_0x56a66e['order']=qs[_0x2c28('0x3d')](_0x4d9ef0[_0x2c28('0x33')][_0x2c28('0x3d')]);_0x56a66e['where']=qs[_0x2c28('0x34')](_[_0x2c28('0x3e')](_0x4d9ef0[_0x2c28('0x33')],_0x442ba6[_0x2c28('0x34')]),_0x218be3);if(_0x4d9ef0[_0x2c28('0x33')]['filter']){_0x56a66e[_0x2c28('0x3f')]=_[_0x2c28('0x40')](_0x56a66e[_0x2c28('0x3f')],{'$or':_['map'](_0x218be3,function(_0x5a4c08){if(_0x5a4c08[_0x2c28('0x2f')]!=='VIRTUAL'){var _0x2e3f54={};_0x2e3f54[_0x5a4c08['name']]={'$like':'%'+_0x4d9ef0[_0x2c28('0x33')]['filter']+'%'};return _0x2e3f54;}})});}_0x56a66e=_['merge']({},_0x56a66e,_0x4d9ef0[_0x2c28('0x41')]);var _0x6fa989={'where':_0x56a66e[_0x2c28('0x3f')]};return db[_0x2c28('0x2e')][_0x2c28('0x20')](_0x6fa989)[_0x2c28('0x28')](function(_0x3a93ac){_0x5a370f[_0x2c28('0x20')]=_0x3a93ac;if(_0x4d9ef0['query']['includeAll']){_0x56a66e[_0x2c28('0x42')]=[{'all':!![]}];}return db['Plugin'][_0x2c28('0x43')](_0x56a66e);})[_0x2c28('0x28')](function(_0x56fd4b){_0x5a370f[_0x2c28('0x44')]=_0x56fd4b;return _0x5a370f;})[_0x2c28('0x28')](respondWithFilteredResult(_0x448992,_0x56a66e))['catch'](handleError(_0x448992,null));};exports['show']=function(_0x116fb3,_0x373353){var _0x33834c={'raw':!![],'where':{'id':_0x116fb3[_0x2c28('0x45')]['id']}},_0x571844={};_0x571844[_0x2c28('0x36')]=_[_0x2c28('0x32')](db['Plugin'][_0x2c28('0x46')]);_0x571844['query']=_['keys'](_0x116fb3['query']);_0x571844['filters']=_[_0x2c28('0x35')](_0x571844[_0x2c28('0x36')],_0x571844[_0x2c28('0x33')]);_0x33834c[_0x2c28('0x37')]=_['intersection'](_0x571844[_0x2c28('0x36')],qs[_0x2c28('0x38')](_0x116fb3[_0x2c28('0x33')][_0x2c28('0x38')]));_0x33834c[_0x2c28('0x37')]=_0x33834c[_0x2c28('0x37')][_0x2c28('0x39')]?_0x33834c[_0x2c28('0x37')]:_0x571844[_0x2c28('0x36')];if(_0x116fb3[_0x2c28('0x33')][_0x2c28('0x47')]){_0x33834c[_0x2c28('0x42')]=[{'all':!![]}];}_0x33834c=_[_0x2c28('0x40')]({},_0x33834c,_0x116fb3[_0x2c28('0x41')]);return db[_0x2c28('0x2e')]['find'](_0x33834c)[_0x2c28('0x28')](handleEntityNotFound(_0x373353,null))['then'](respondWithResult(_0x373353,null))[_0x2c28('0x48')](handleError(_0x373353,null));};exports[_0x2c28('0x49')]=function(_0x52ce3b,_0x89fbca,_0x277275){return db['Plugin'][_0x2c28('0x4a')]({'where':{'id':_0x52ce3b[_0x2c28('0x45')]['id']},'attributes':['name','path'],'raw':!![]})[_0x2c28('0x28')](handleEntityNotFound(_0x89fbca,null))['then'](function(_0xddacdf){if(_0xddacdf){var _0x51daee=path[_0x2c28('0x4b')](config[_0x2c28('0x4c')],_0x2c28('0x4d'),util['format']('%s.zip',path['basename'](_0xddacdf['path'])));var _0x5b810=fs['createWriteStream'](_0x51daee);var _0x263a2a=archiver(_0x2c28('0x4e'),{'zlib':{'level':0x9}});_0x263a2a['on']('warning',function(_0x2eec05){if(_0x2eec05[_0x2c28('0x4f')]==='ENOENT'){logger[_0x2c28('0x50')](_0x2eec05);}else{throw new db[(_0x2c28('0x51'))][(_0x2c28('0x52'))](_0x2c28('0x53'));}});_0x263a2a['on'](_0x2c28('0x50'),function(_0x561414){throw new db[(_0x2c28('0x51'))]['Error'](_0x2c28('0x53'));});_0x263a2a[_0x2c28('0x54')](_0x5b810);_0x263a2a['glob'](_0x2c28('0x55'),{'cwd':path[_0x2c28('0x4b')](config[_0x2c28('0x4c')],_0x2c28('0x4d'),path['dirname'](_0xddacdf['path'])),'ignore':[path[_0x2c28('0x4b')](path['basename'](_0xddacdf[_0x2c28('0x6')]),_0x2c28('0x56')),path['join'](path[_0x2c28('0x57')](_0xddacdf[_0x2c28('0x6')]),_0x2c28('0x58'))],'nodir':!![]})[_0x2c28('0x59')]();_0x5b810['on'](_0x2c28('0x5a'),function(){if(!fs[_0x2c28('0x5b')](_0x51daee)){throw new db[(_0x2c28('0x51'))]['Error'](_0x2c28('0x5c'));}return _0x89fbca[_0x2c28('0x49')](_0x51daee,util[_0x2c28('0x5d')](_0x2c28('0x5e'),path[_0x2c28('0x57')](_0xddacdf[_0x2c28('0x6')])),function(_0x4e0dff){if(_0x4e0dff){throw new db[(_0x2c28('0x51'))][(_0x2c28('0x52'))](_0x2c28('0x5f'));}fs[_0x2c28('0x60')](_0x51daee);logger[_0x2c28('0x61')](_0x2c28('0x62'));logger[_0x2c28('0x61')](_0x2c28('0x63'));});});}return null;})[_0x2c28('0x48')](handleError(_0x89fbca,null));};exports['upload']=function(_0x26ff44,_0x4ff3be,_0x370ea5){var _0x3e1eb0=path['basename'](_0x26ff44[_0x2c28('0x64')][_0x2c28('0x65')],path[_0x2c28('0x66')](_0x26ff44[_0x2c28('0x64')]['filename']));var _0x3bfda1=path[_0x2c28('0x4b')](config[_0x2c28('0x4c')],_0x2c28('0x4d'),_0x26ff44['file'][_0x2c28('0x65')]);var _0x2de83d=path[_0x2c28('0x4b')](config[_0x2c28('0x4c')],_0x2c28('0x4d'),_0x3e1eb0);logger['info'](_0x2c28('0x67'),_0x3bfda1);logger[_0x2c28('0x61')](_0x2c28('0x68'),_0x2de83d);try{fs[_0x2c28('0x69')](_0x3bfda1,parseInt('0777',0x8));extract(_0x3bfda1,{'dir':_0x2de83d},function(_0x1c34d1){if(_0x1c34d1){logger[_0x2c28('0x50')](_0x1c34d1);handleError(_0x1c34d1,!![]);};var _0x1e3e66=fs[_0x2c28('0x6a')](_0x2de83d);if(_0x1e3e66[_0x2c28('0x39')]>0x1){removeReferences(_0x3bfda1,_0x2de83d);logger[_0x2c28('0x50')](_0x2c28('0x6b'));return _0x370ea5(new Error(_0x2c28('0x6b')));}var _0x2d2a9c=fs[_0x2c28('0x6c')](path[_0x2c28('0x4b')](_0x2de83d,_0x1e3e66[0x0]));if(_0x2d2a9c[_0x2c28('0x6d')]()){removeReferences(_0x3bfda1,_0x2de83d);logger[_0x2c28('0x50')](_0x2c28('0x6b'));return _0x370ea5(new Error(_0x2c28('0x6b')));}if(_0x2d2a9c[_0x2c28('0x6e')]()){var _0x2119a7=fs[_0x2c28('0x6a')](path[_0x2c28('0x4b')](_0x2de83d,_0x1e3e66[0x0]));if(_0x2119a7[_0x2c28('0x39')]===0x0){removeReferences(_0x3bfda1,_0x2de83d);logger[_0x2c28('0x50')](_0x2c28('0x6b'));return _0x370ea5(new Error(_0x2c28('0x6b')));}var _0x99499b=_0x2119a7[_0x2c28('0x6f')](function(_0x5a31a6){return _0x5a31a6===_0x2c28('0x70');});if(!_0x99499b){return _0x370ea5(new Error(_0x2c28('0x71')));}var _0x43b049=fs[_0x2c28('0x72')](path[_0x2c28('0x4b')](_0x2de83d,_0x1e3e66[0x0],_0x2c28('0x70')));var _0x2cf81b=JSON[_0x2c28('0x73')](_0x43b049);if('undefined'==typeof _0x2cf81b[_0x2c28('0x2c')]){return _0x370ea5(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x2c28('0x74')==typeof _0x2cf81b['type']){return _0x370ea5(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x2c28('0x74')==typeof _0x2cf81b[_0x2c28('0x75')]){return _0x370ea5(new Error(_0x2c28('0x76')));}if('undefined'==typeof _0x2cf81b[_0x2c28('0x77')]){return _0x370ea5(new Error(_0x2c28('0x78')));}if(_0x2cf81b[_0x2c28('0x2f')]===_0x2c28('0x79')){if(_0x2c28('0x74')==typeof _0x2cf81b[_0x2c28('0x77')][_0x2c28('0x7a')]){return _0x370ea5(new Error(_0x2c28('0x7b')));}if('undefined'==typeof _0x2cf81b[_0x2c28('0x77')][_0x2c28('0x7a')][_0x2c28('0x7c')]&&_0x2c28('0x74')==typeof _0x2cf81b[_0x2c28('0x77')][_0x2c28('0x7a')][_0x2c28('0x7d')]){return _0x370ea5(new Error(_0x2c28('0x7e')));}}else if(_0x2cf81b[_0x2c28('0x2f')]===_0x2c28('0x7f')){if(_0x2c28('0x74')==typeof _0x2cf81b['parameters'][_0x2c28('0x80')]){return _0x370ea5(new Error(_0x2c28('0x81')));}if(_0x2c28('0x74')==typeof _0x2cf81b[_0x2c28('0x77')][_0x2c28('0x82')]){return _0x370ea5(new Error(_0x2c28('0x83')));}}else{return _0x370ea5(new Error(_0x2c28('0x84')));}var _0x45ba02=_0x2cf81b[_0x2c28('0x2c')];var _0x5b9757=_0x2cf81b[_0x2c28('0x85')];var _0x1cf736=_0x2cf81b[_0x2c28('0x2f')];var _0x2553d6=_0x2cf81b[_0x2c28('0x86')]?_0x2cf81b[_0x2c28('0x86')]:'always';var _0x1ed2b8=_0x2cf81b['icon']?_0x2cf81b[_0x2c28('0x87')]:_0x2c28('0x88');var _0x33e069='';var _0x4b391f='';var _0x27291e='';var _0x397ddb='';var _0x16f1e7=_0x2cf81b['version'];if(_0x1cf736===_0x2c28('0x79')){if(_0x2c28('0x74')!=typeof _0x2cf81b[_0x2c28('0x77')][_0x2c28('0x7a')][_0x2c28('0x7c')]){var _0x529003=_0x2cf81b[_0x2c28('0x77')]['views'][_0x2c28('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0x2c28('0x89')](_0x529003)){_0x33e069=path[_0x2c28('0x4b')](_0x2c28('0x8a'),_0x3e1eb0,_0x1e3e66[0x0],_0x529003);}else{_0x33e069=_0x529003;}}else{logger[_0x2c28('0x61')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x2c28('0x74')!=typeof _0x2cf81b[_0x2c28('0x77')]['views'][_0x2c28('0x7d')]){var _0x2ffad6=_0x2cf81b['parameters'][_0x2c28('0x7a')][_0x2c28('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0x2c28('0x89')](_0x2ffad6)){_0x4b391f=path[_0x2c28('0x4b')]('plugins',_0x3e1eb0,_0x1e3e66[0x0],_0x2ffad6);}else{_0x4b391f=_0x2ffad6;}}else{logger[_0x2c28('0x61')](_0x2c28('0x8b'));}}else if(_0x1cf736===_0x2c28('0x7f')){_0x27291e=_0x2cf81b[_0x2c28('0x77')][_0x2c28('0x80')];_0x397ddb=_0x2cf81b['parameters']['scriptPath'];if(_0x2c28('0x74')!=typeof _0x2cf81b[_0x2c28('0x77')]['views']){if(_0x2c28('0x74')!=typeof _0x2cf81b[_0x2c28('0x77')][_0x2c28('0x7a')][_0x2c28('0x7c')]){var _0x529003=_0x2cf81b[_0x2c28('0x77')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0x2c28('0x89')](_0x529003)){_0x33e069=path['join'](_0x2c28('0x8a'),_0x3e1eb0,_0x1e3e66[0x0],_0x529003);}else{_0x33e069=_0x529003;}}if(_0x2c28('0x74')!=typeof _0x2cf81b['parameters']['views']['agent']){var _0x2ffad6=_0x2cf81b['parameters'][_0x2c28('0x7a')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x2c28('0x89')](_0x2ffad6)){_0x4b391f=path[_0x2c28('0x4b')]('plugins',_0x3e1eb0,_0x1e3e66[0x0],_0x2ffad6);}else{_0x4b391f=_0x2ffad6;}}}}var _0x378995={'name':_0x45ba02,'description':_0x5b9757,'path':path[_0x2c28('0x4b')](_0x3e1eb0,_0x1e3e66[0x0]),'type':_0x1cf736,'sidebar':_0x2553d6,'icon':_0x1ed2b8,'adminUrl':_0x33e069,'agentUrl':_0x4b391f,'scriptName':_0x27291e,'scriptPath':_0x397ddb,'version':_0x16f1e7};removeReferences(_0x3bfda1,null);return db[_0x2c28('0x2e')]['create'](_0x378995)[_0x2c28('0x28')](function(_0x57a9e3){var _0x590292={'role':_0x26ff44['body'][_0x2c28('0x8c')],'userProfileId':_0x26ff44['body'][_0x2c28('0x8d')]};if(!_0x590292)throw new Error(_0x2c28('0x8e'));if(_0x590292[_0x2c28('0x8c')]==='user'){var _0xe874f6=_0x57a9e3[_0x2c28('0x8f')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x2c28('0x29'),'userProfileId':_0x590292[_0x2c28('0x8d')]},'raw':!![]})[_0x2c28('0x28')](function(_0x3a0a77){if(_0x3a0a77&&_0x3a0a77[_0x2c28('0x90')]===0x0){return db[_0x2c28('0x91')]['create']({'name':_0xe874f6['name'],'resourceId':_0xe874f6['id'],'type':_0x3a0a77[_0x2c28('0x2c')],'sectionId':_0x3a0a77['id']},{})[_0x2c28('0x28')](function(){return _0x57a9e3;});}else{return _0x57a9e3;}})[_0x2c28('0x48')](function(_0x3b3acd){logger[_0x2c28('0x50')](_0x2c28('0x92'),_0x3b3acd);throw _0x3b3acd;});}return _0x57a9e3;})['then'](respondWithResult(_0x4ff3be,null))[_0x2c28('0x48')](handleError(_0x4ff3be,null));}});}catch(_0x180b4e){_0x4ff3be['status'](0x1f4)['send'](_0x180b4e);}};function removeReferences(_0x4b6b39,_0xfea20b){try{if(_0x4b6b39){fs[_0x2c28('0x60')](_0x4b6b39);logger[_0x2c28('0x61')](_0x2c28('0x93'));}if(_0xfea20b){rimraf(_0xfea20b,function(){});logger[_0x2c28('0x61')](_0x2c28('0x94'));}}catch(_0x4e7ee3){logger[_0x2c28('0x50')](_0x4e7ee3);}}exports[_0x2c28('0x26')]=function(_0x1b79b5,_0x359290,_0x3052cc){return db['Plugin']['find']({'where':{'id':_0x1b79b5[_0x2c28('0x45')]['id']}})['then'](handleEntityNotFound(_0x359290,null))[_0x2c28('0x28')](saveUpdates(_0x1b79b5[_0x2c28('0x95')],null))['then'](respondWithResult(_0x359290,null))[_0x2c28('0x48')](handleError(_0x359290,null));};exports[_0x2c28('0x96')]=function(_0xca98df,_0x1e1140,_0x4c17f3){return db[_0x2c28('0x2e')][_0x2c28('0x4a')]({'where':{'id':_0xca98df[_0x2c28('0x45')]['id']}})[_0x2c28('0x28')](function(_0x5256ce){if(_0x5256ce){return _0x5256ce[_0x2c28('0x27')]();}})[_0x2c28('0x28')](function(_0x2052df){rimraf(path['join'](config['root'],'server/files/plugins',path['dirname'](_0x2052df[_0x2c28('0x6')])),function(){});return _0x2052df;})[_0x2c28('0x28')](handleEntityNotFound(_0x1e1140,null))[_0x2c28('0x28')](respondWithStatusCode(_0x1e1140,null))[_0x2c28('0x48')](handleError(_0x1e1140,null));};exports['webhookGet']=function(_0x17b8bf,_0x413eb1,_0x515de7){return BPromise[_0x2c28('0x97')]()[_0x2c28('0x28')](function(){if(!_0x17b8bf[_0x2c28('0x33')]['path']){throw new Error(_0x2c28('0x98'));}if(!_0x17b8bf[_0x2c28('0x33')][_0x2c28('0x99')]){throw new Error(_0x2c28('0x9a'));}var _0x1a98f0=_0x17b8bf[_0x2c28('0x33')]['hostname']?_0x17b8bf[_0x2c28('0x33')][_0x2c28('0x9b')]+':'+_0x17b8bf['query'][_0x2c28('0x99')]:_0x2c28('0x9c')+_0x17b8bf['query'][_0x2c28('0x99')];var _0x32673c=_0x17b8bf[_0x2c28('0x33')]['json']?_0x17b8bf['query'][_0x2c28('0x1f')]:!![];var _0x1569b6=_0x17b8bf[_0x2c28('0x33')]['encoding']?_0x17b8bf[_0x2c28('0x33')][_0x2c28('0x9d')]:null;var _0x57022e={'method':_0x17b8bf[_0x2c28('0x9e')],'uri':util[_0x2c28('0x5d')](_0x2c28('0x9f'),_0x1a98f0,_0x17b8bf['query'][_0x2c28('0x6')]),'json':_0x32673c,'resolveWithFullResponse':!![],'encoding':_0x1569b6,'qs':_0x17b8bf['query']};if(_0x17b8bf['headers']){_0x57022e[_0x2c28('0xa0')]=_0x17b8bf[_0x2c28('0xa0')];if(_0x57022e[_0x2c28('0xa0')]['content-length']){delete _0x57022e[_0x2c28('0xa0')]['content-length'];}}if(_0x57022e[_0x2c28('0xa0')][_0x2c28('0xa1')]){delete _0x57022e[_0x2c28('0xa0')][_0x2c28('0xa1')];}return rp(_0x57022e);})[_0x2c28('0x28')](function(_0x18cbf9){if(_0x18cbf9){_0x413eb1[_0x2c28('0xa2')](_0x18cbf9[_0x2c28('0xa0')]);logger['info'](_0x18cbf9['body']);if(_[_0x2c28('0xa3')](_0x17b8bf['query'][_0x2c28('0x6')],_0x2c28('0x49'))&&_0x18cbf9[_0x2c28('0xa4')]==0x1f4){return _0x413eb1['sendStatus'](_0x18cbf9[_0x2c28('0xa4')]);}else{return _0x413eb1[_0x2c28('0x1e')](_0x18cbf9[_0x2c28('0xa4')])[_0x2c28('0x2d')](_0x18cbf9[_0x2c28('0x95')]);}}else{return _0x413eb1[_0x2c28('0x1d')](0xc8);}})[_0x2c28('0x48')](handleError(_0x413eb1,null));};exports[_0x2c28('0xa5')]=function(_0x5a7cda,_0x27de79,_0x42891a){return BPromise[_0x2c28('0x97')]()[_0x2c28('0x28')](function(){if(!_0x5a7cda['query'][_0x2c28('0x6')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x5a7cda[_0x2c28('0x33')][_0x2c28('0x99')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x18431c=_0x5a7cda[_0x2c28('0x33')][_0x2c28('0x9b')]?_0x5a7cda[_0x2c28('0x33')][_0x2c28('0x9b')]+':'+_0x5a7cda['query'][_0x2c28('0x99')]:_0x2c28('0x9c')+_0x5a7cda['query']['port'];var _0x3ea6fc=_0x5a7cda[_0x2c28('0x33')][_0x2c28('0x1f')]?_0x5a7cda['query'][_0x2c28('0x1f')]:!![];var _0x119b8f=_0x5a7cda[_0x2c28('0x33')][_0x2c28('0x9d')]?_0x5a7cda[_0x2c28('0x33')][_0x2c28('0x9d')]:null;var _0x113bbf={'method':_0x5a7cda[_0x2c28('0x9e')],'uri':util[_0x2c28('0x5d')](_0x2c28('0x9f'),_0x18431c,_0x5a7cda[_0x2c28('0x33')][_0x2c28('0x6')]),'json':_0x3ea6fc,'resolveWithFullResponse':!![],'encoding':_0x119b8f,'body':_0x5a7cda[_0x2c28('0x95')]};if(_0x5a7cda[_0x2c28('0xa0')]){_0x113bbf[_0x2c28('0xa0')]=_0x5a7cda[_0x2c28('0xa0')];if(_0x113bbf[_0x2c28('0xa0')][_0x2c28('0xa6')]){delete _0x113bbf[_0x2c28('0xa0')][_0x2c28('0xa6')];}}if(_0x113bbf[_0x2c28('0xa0')]['content-type']){delete _0x113bbf[_0x2c28('0xa0')][_0x2c28('0xa1')];}return rp(_0x113bbf);})[_0x2c28('0x28')](function(_0x261574){if(_0x261574){_0x27de79[_0x2c28('0xa2')](_0x261574[_0x2c28('0xa0')]);logger['info'](_0x261574[_0x2c28('0x95')]);return _0x27de79[_0x2c28('0x1e')](_0x261574[_0x2c28('0xa4')])[_0x2c28('0x2d')](_0x261574[_0x2c28('0x95')]);}else{return _0x27de79[_0x2c28('0x1d')](0xc8);}})['catch'](handleError(_0x27de79,null));}; \ No newline at end of file +var _0x006b=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','extract-zip','archiver','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./plugin.socket','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','Plugin','rawAttributes','type','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','include','findAll','catch','show','params','includeAll','download','find','join','root','server/files/plugins','format','%s.zip','basename','zip','warning','code','ENOENT','Sequelize','Error','pipe','glob','**/*','dirname','node_modules/**/*','attachments/**/*','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','parameters','views','admin','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','test','Warning:\x20admin\x20view\x20not\x20specified','agent','plugins','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Plugins','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','html-pdf','eml-format','zip-dir','fast-json-patch'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x006b,0xab));var _0xb006=function(_0x5a17e3,_0xdb8fcb){_0x5a17e3=_0x5a17e3-0x0;var _0x38929a=_0x006b[_0x5a17e3];return _0x38929a;};'use strict';var pdf=require(_0xb006('0x0'));var emlformat=require(_0xb006('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb006('0x2'));var jsonpatch=require(_0xb006('0x3'));var rp=require(_0xb006('0x4'));var moment=require(_0xb006('0x5'));var BPromise=require(_0xb006('0x6'));var Mustache=require(_0xb006('0x7'));var util=require(_0xb006('0x8'));var path=require(_0xb006('0x9'));var sox=require(_0xb006('0xa'));var csv=require(_0xb006('0xb'));var ejs=require(_0xb006('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb006('0xd'));var crypto=require(_0xb006('0xe'));var jsforce=require(_0xb006('0xf'));var deskjs=require(_0xb006('0x10'));var toCsv=require(_0xb006('0xb'));var querystring=require('querystring');var Papa=require(_0xb006('0x11'));var extract=require(_0xb006('0x12'));var rimraf=require('rimraf');var archiver=require(_0xb006('0x13'));var Redis=require('ioredis');var authService=require(_0xb006('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xb006('0x15'));var hardwareService=require(_0xb006('0x16'));var logger=require(_0xb006('0x17'))(_0xb006('0x18'));var utils=require(_0xb006('0x19'));var config=require(_0xb006('0x1a'));var db=require(_0xb006('0x1b'))['db'];config[_0xb006('0x1c')]=_[_0xb006('0x1d')](config[_0xb006('0x1c')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb006('0x1c')]));require(_0xb006('0x1e'))['register'](socket);function respondWithStatusCode(_0x5a7465,_0x4308a6){_0x4308a6=_0x4308a6||0xcc;return function(_0x54d533){if(_0x54d533){return _0x5a7465[_0xb006('0x1f')](_0x4308a6);}return _0x5a7465[_0xb006('0x20')](_0x4308a6)[_0xb006('0x21')]();};}function respondWithResult(_0x31f096,_0x5ab250){_0x5ab250=_0x5ab250||0xc8;return function(_0x513ad6){if(_0x513ad6){return _0x31f096[_0xb006('0x20')](_0x5ab250)[_0xb006('0x22')](_0x513ad6);}};}function respondWithFilteredResult(_0x5c9505,_0x3f9b36){return function(_0x3a1b5b){if(_0x3a1b5b){var _0x35c30d=_0x3a1b5b[_0xb006('0x23')],_0x1f397f=_0x3f9b36[_0xb006('0x24')],_0x1e9344=_0x3f9b36[_0xb006('0x24')]+_0x3f9b36[_0xb006('0x25')],_0x3deb78;if(_0x1e9344>=_0x35c30d){_0x1e9344=_0x35c30d;_0x3deb78=0xc8;}else{_0x3deb78=0xce;}_0x5c9505[_0xb006('0x20')](_0x3deb78);return _0x5c9505[_0xb006('0x26')]('Content-Range',_0x1f397f+'-'+_0x1e9344+'/'+_0x35c30d)[_0xb006('0x22')](_0x3a1b5b);}return null;};}function patchUpdates(_0x52518c){return function(_0xb87667){try{jsonpatch[_0xb006('0x27')](_0xb87667,_0x52518c,!![]);}catch(_0x35167d){return BPromise[_0xb006('0x28')](_0x35167d);}return _0xb87667[_0xb006('0x29')]();};}function saveUpdates(_0x5dde7c,_0x12a5e4){return function(_0x354365){if(_0x354365){return _0x354365[_0xb006('0x2a')](_0x5dde7c)[_0xb006('0x2b')](function(_0x194276){return _0x194276;});}return null;};}function removeEntity(_0x4221d2,_0x10ae8b){return function(_0xe784c8){if(_0xe784c8){return _0xe784c8['destroy']()[_0xb006('0x2b')](function(){var _0x52615a=_0xe784c8[_0xb006('0x2c')]({'plain':!![]});var _0x51e84c='Plugins';return db[_0xb006('0x2d')][_0xb006('0x2e')]({'where':{'type':_0x51e84c,'resourceId':_0x52615a['id']}})[_0xb006('0x2b')](function(){return _0xe784c8;});})['then'](function(){_0x4221d2[_0xb006('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19b2f1,_0x19ead2){return function(_0x331b5b){if(!_0x331b5b){_0x19b2f1[_0xb006('0x1f')](0x194);}return _0x331b5b;};}function handleError(_0x589d1a,_0x2f90b3){_0x2f90b3=_0x2f90b3||0x1f4;return function(_0x2c0586){logger[_0xb006('0x2f')](_0x2c0586[_0xb006('0x30')]);if(_0x2c0586[_0xb006('0x31')]){delete _0x2c0586[_0xb006('0x31')];}_0x589d1a[_0xb006('0x20')](_0x2f90b3)[_0xb006('0x32')](_0x2c0586);};}exports[_0xb006('0x33')]=function(_0x29523c,_0x4f62e7){var _0x5784c4={},_0x367944={},_0x4d59c0={'count':0x0,'rows':[]};var _0x402976=_['map'](db[_0xb006('0x34')][_0xb006('0x35')],function(_0x27edc7){return{'name':_0x27edc7['fieldName'],'type':_0x27edc7[_0xb006('0x36')][_0xb006('0x37')]};});_0x367944['model']=_['map'](_0x402976,'name');_0x367944[_0xb006('0x38')]=_[_0xb006('0x39')](_0x29523c[_0xb006('0x38')]);_0x367944['filters']=_[_0xb006('0x3a')](_0x367944['model'],_0x367944[_0xb006('0x38')]);_0x5784c4[_0xb006('0x3b')]=_[_0xb006('0x3a')](_0x367944[_0xb006('0x3c')],qs[_0xb006('0x3d')](_0x29523c[_0xb006('0x38')][_0xb006('0x3d')]));_0x5784c4[_0xb006('0x3b')]=_0x5784c4[_0xb006('0x3b')][_0xb006('0x3e')]?_0x5784c4[_0xb006('0x3b')]:_0x367944[_0xb006('0x3c')];if(!_0x29523c[_0xb006('0x38')][_0xb006('0x3f')](_0xb006('0x40'))){_0x5784c4[_0xb006('0x25')]=qs[_0xb006('0x25')](_0x29523c[_0xb006('0x38')]['limit']);_0x5784c4[_0xb006('0x24')]=qs['offset'](_0x29523c['query']['offset']);}_0x5784c4[_0xb006('0x41')]=qs[_0xb006('0x42')](_0x29523c[_0xb006('0x38')][_0xb006('0x42')]);_0x5784c4[_0xb006('0x43')]=qs[_0xb006('0x44')](_[_0xb006('0x45')](_0x29523c[_0xb006('0x38')],_0x367944[_0xb006('0x44')]),_0x402976);if(_0x29523c[_0xb006('0x38')][_0xb006('0x46')]){_0x5784c4[_0xb006('0x43')]=_[_0xb006('0x47')](_0x5784c4[_0xb006('0x43')],{'$or':_[_0xb006('0x48')](_0x402976,function(_0x2f5d37){if(_0x2f5d37['type']!==_0xb006('0x49')){var _0x419e44={};_0x419e44[_0x2f5d37[_0xb006('0x31')]]={'$like':'%'+_0x29523c[_0xb006('0x38')][_0xb006('0x46')]+'%'};return _0x419e44;}})});}_0x5784c4=_[_0xb006('0x47')]({},_0x5784c4,_0x29523c['options']);var _0xb7685e={'where':_0x5784c4[_0xb006('0x43')]};return db[_0xb006('0x34')][_0xb006('0x23')](_0xb7685e)['then'](function(_0x2b7db4){_0x4d59c0[_0xb006('0x23')]=_0x2b7db4;if(_0x29523c[_0xb006('0x38')]['includeAll']){_0x5784c4[_0xb006('0x4a')]=[{'all':!![]}];}return db[_0xb006('0x34')][_0xb006('0x4b')](_0x5784c4);})[_0xb006('0x2b')](function(_0x4d828a){_0x4d59c0['rows']=_0x4d828a;return _0x4d59c0;})[_0xb006('0x2b')](respondWithFilteredResult(_0x4f62e7,_0x5784c4))[_0xb006('0x4c')](handleError(_0x4f62e7,null));};exports[_0xb006('0x4d')]=function(_0x385ce5,_0x294c73){var _0x2b2607={'raw':!![],'where':{'id':_0x385ce5[_0xb006('0x4e')]['id']}},_0x2f01f5={};_0x2f01f5['model']=_[_0xb006('0x39')](db['Plugin'][_0xb006('0x35')]);_0x2f01f5[_0xb006('0x38')]=_[_0xb006('0x39')](_0x385ce5[_0xb006('0x38')]);_0x2f01f5[_0xb006('0x44')]=_[_0xb006('0x3a')](_0x2f01f5[_0xb006('0x3c')],_0x2f01f5[_0xb006('0x38')]);_0x2b2607[_0xb006('0x3b')]=_[_0xb006('0x3a')](_0x2f01f5[_0xb006('0x3c')],qs[_0xb006('0x3d')](_0x385ce5[_0xb006('0x38')][_0xb006('0x3d')]));_0x2b2607[_0xb006('0x3b')]=_0x2b2607[_0xb006('0x3b')][_0xb006('0x3e')]?_0x2b2607[_0xb006('0x3b')]:_0x2f01f5['model'];if(_0x385ce5[_0xb006('0x38')][_0xb006('0x4f')]){_0x2b2607[_0xb006('0x4a')]=[{'all':!![]}];}_0x2b2607=_[_0xb006('0x47')]({},_0x2b2607,_0x385ce5['options']);return db[_0xb006('0x34')]['find'](_0x2b2607)['then'](handleEntityNotFound(_0x294c73,null))['then'](respondWithResult(_0x294c73,null))['catch'](handleError(_0x294c73,null));};exports[_0xb006('0x50')]=function(_0x1beefc,_0x279399,_0x4a00e9){return db[_0xb006('0x34')][_0xb006('0x51')]({'where':{'id':_0x1beefc[_0xb006('0x4e')]['id']},'attributes':[_0xb006('0x31'),'path'],'raw':!![]})[_0xb006('0x2b')](handleEntityNotFound(_0x279399,null))[_0xb006('0x2b')](function(_0x3f16f4){if(_0x3f16f4){var _0x247c21=path[_0xb006('0x52')](config[_0xb006('0x53')],_0xb006('0x54'),util[_0xb006('0x55')](_0xb006('0x56'),path[_0xb006('0x57')](_0x3f16f4['path'])));var _0x1461f4=fs['createWriteStream'](_0x247c21);var _0x541ffc=archiver(_0xb006('0x58'),{'zlib':{'level':0x9}});_0x541ffc['on'](_0xb006('0x59'),function(_0x351ee6){if(_0x351ee6[_0xb006('0x5a')]===_0xb006('0x5b')){logger[_0xb006('0x2f')](_0x351ee6);}else{throw new db[(_0xb006('0x5c'))][(_0xb006('0x5d'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x541ffc['on'](_0xb006('0x2f'),function(_0x26abc8){throw new db[(_0xb006('0x5c'))][(_0xb006('0x5d'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x541ffc[_0xb006('0x5e')](_0x1461f4);_0x541ffc[_0xb006('0x5f')](_0xb006('0x60'),{'cwd':path[_0xb006('0x52')](config[_0xb006('0x53')],_0xb006('0x54'),path[_0xb006('0x61')](_0x3f16f4[_0xb006('0x9')])),'ignore':[path['join'](path[_0xb006('0x57')](_0x3f16f4['path']),_0xb006('0x62')),path[_0xb006('0x52')](path[_0xb006('0x57')](_0x3f16f4[_0xb006('0x9')]),_0xb006('0x63'))],'nodir':!![]})['finalize']();_0x1461f4['on'](_0xb006('0x64'),function(){if(!fs[_0xb006('0x65')](_0x247c21)){throw new db['Sequelize'][(_0xb006('0x5d'))](_0xb006('0x66'));}return _0x279399['download'](_0x247c21,util[_0xb006('0x55')](_0xb006('0x56'),path[_0xb006('0x57')](_0x3f16f4[_0xb006('0x9')])),function(_0x219fe1){if(_0x219fe1){throw new db['Sequelize']['Error'](_0xb006('0x67'));}fs[_0xb006('0x68')](_0x247c21);logger[_0xb006('0x69')](_0xb006('0x6a'));logger[_0xb006('0x69')](_0xb006('0x6b'));});});}return null;})[_0xb006('0x4c')](handleError(_0x279399,null));};exports[_0xb006('0x6c')]=function(_0x55b7e1,_0x12d074,_0x275b0f){var _0xa1cbbf=path[_0xb006('0x57')](_0x55b7e1[_0xb006('0x6d')]['filename'],path['extname'](_0x55b7e1[_0xb006('0x6d')][_0xb006('0x6e')]));var _0x1026cf=path[_0xb006('0x52')](config[_0xb006('0x53')],'server/files/plugins',_0x55b7e1[_0xb006('0x6d')][_0xb006('0x6e')]);var _0x2703a4=path[_0xb006('0x52')](config[_0xb006('0x53')],_0xb006('0x54'),_0xa1cbbf);logger[_0xb006('0x69')](_0xb006('0x6f'),_0x1026cf);logger[_0xb006('0x69')](_0xb006('0x70'),_0x2703a4);try{fs[_0xb006('0x71')](_0x1026cf,parseInt(_0xb006('0x72'),0x8));extract(_0x1026cf,{'dir':_0x2703a4},function(_0x53138d){if(_0x53138d){logger[_0xb006('0x2f')](_0x53138d);handleError(_0x53138d,!![]);};var _0xfa8a6b=fs['readdirSync'](_0x2703a4);if(_0xfa8a6b['length']>0x1){removeReferences(_0x1026cf,_0x2703a4);logger[_0xb006('0x2f')](_0xb006('0x73'));return _0x275b0f(new Error(_0xb006('0x73')));}var _0x4362fb=fs[_0xb006('0x74')](path[_0xb006('0x52')](_0x2703a4,_0xfa8a6b[0x0]));if(_0x4362fb[_0xb006('0x75')]()){removeReferences(_0x1026cf,_0x2703a4);logger['error'](_0xb006('0x73'));return _0x275b0f(new Error(_0xb006('0x73')));}if(_0x4362fb[_0xb006('0x76')]()){var _0x6faa3f=fs['readdirSync'](path[_0xb006('0x52')](_0x2703a4,_0xfa8a6b[0x0]));if(_0x6faa3f[_0xb006('0x3e')]===0x0){removeReferences(_0x1026cf,_0x2703a4);logger[_0xb006('0x2f')](_0xb006('0x73'));return _0x275b0f(new Error(_0xb006('0x73')));}var _0x29c146=_0x6faa3f[_0xb006('0x77')](function(_0x4f151c){return _0x4f151c===_0xb006('0x78');});if(!_0x29c146){return _0x275b0f(new Error(_0xb006('0x79')));}var _0x2b80b1=fs[_0xb006('0x7a')](path[_0xb006('0x52')](_0x2703a4,_0xfa8a6b[0x0],_0xb006('0x78')));var _0x5a2deb=JSON[_0xb006('0x7b')](_0x2b80b1);if(_0xb006('0x7c')==typeof _0x5a2deb['name']){return _0x275b0f(new Error(_0xb006('0x7d')));}if(_0xb006('0x7c')==typeof _0x5a2deb['type']){return _0x275b0f(new Error(_0xb006('0x7e')));}if(_0xb006('0x7c')==typeof _0x5a2deb[_0xb006('0x7f')]){return _0x275b0f(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if('undefined'==typeof _0x5a2deb[_0xb006('0x80')]){return _0x275b0f(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x5a2deb[_0xb006('0x36')]==='html'){if(_0xb006('0x7c')==typeof _0x5a2deb[_0xb006('0x80')][_0xb006('0x81')]){return _0x275b0f(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0xb006('0x7c')==typeof _0x5a2deb['parameters'][_0xb006('0x81')][_0xb006('0x82')]&&_0xb006('0x7c')==typeof _0x5a2deb[_0xb006('0x80')][_0xb006('0x81')]['agent']){return _0x275b0f(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x5a2deb['type']===_0xb006('0x83')){if(_0xb006('0x7c')==typeof _0x5a2deb['parameters'][_0xb006('0x84')]){return _0x275b0f(new Error(_0xb006('0x85')));}if('undefined'==typeof _0x5a2deb[_0xb006('0x80')]['scriptPath']){return _0x275b0f(new Error(_0xb006('0x86')));}}else{return _0x275b0f(new Error(_0xb006('0x87')));}var _0x3f195a=_0x5a2deb[_0xb006('0x31')];var _0x9401a9=_0x5a2deb['description'];var _0x46d5ff=_0x5a2deb[_0xb006('0x36')];var _0x35a13b=_0x5a2deb[_0xb006('0x88')]?_0x5a2deb[_0xb006('0x88')]:_0xb006('0x89');var _0x86c144=_0x5a2deb[_0xb006('0x8a')]?_0x5a2deb[_0xb006('0x8a')]:_0xb006('0x8b');var _0x294f48='';var _0x28532b='';var _0x50ad26='';var _0x540584='';var _0x2090c8=_0x5a2deb[_0xb006('0x7f')];if(_0x46d5ff==='html'){if('undefined'!=typeof _0x5a2deb['parameters'][_0xb006('0x81')][_0xb006('0x82')]){var _0x32a36a=_0x5a2deb[_0xb006('0x80')][_0xb006('0x81')][_0xb006('0x82')];if(!/^(f|ht)tps?:\/\//i[_0xb006('0x8c')](_0x32a36a)){_0x294f48=path[_0xb006('0x52')]('plugins',_0xa1cbbf,_0xfa8a6b[0x0],_0x32a36a);}else{_0x294f48=_0x32a36a;}}else{logger[_0xb006('0x69')](_0xb006('0x8d'));}if(_0xb006('0x7c')!=typeof _0x5a2deb['parameters']['views'][_0xb006('0x8e')]){var _0x1a9410=_0x5a2deb[_0xb006('0x80')][_0xb006('0x81')][_0xb006('0x8e')];if(!/^(f|ht)tps?:\/\//i['test'](_0x1a9410)){_0x28532b=path[_0xb006('0x52')](_0xb006('0x8f'),_0xa1cbbf,_0xfa8a6b[0x0],_0x1a9410);}else{_0x28532b=_0x1a9410;}}else{logger['info'](_0xb006('0x90'));}}else if(_0x46d5ff===_0xb006('0x83')){_0x50ad26=_0x5a2deb[_0xb006('0x80')][_0xb006('0x84')];_0x540584=_0x5a2deb['parameters'][_0xb006('0x91')];if('undefined'!=typeof _0x5a2deb['parameters']['views']){if('undefined'!=typeof _0x5a2deb[_0xb006('0x80')]['views'][_0xb006('0x82')]){var _0x32a36a=_0x5a2deb[_0xb006('0x80')][_0xb006('0x81')][_0xb006('0x82')];if(!/^(f|ht)tps?:\/\//i['test'](_0x32a36a)){_0x294f48=path[_0xb006('0x52')]('plugins',_0xa1cbbf,_0xfa8a6b[0x0],_0x32a36a);}else{_0x294f48=_0x32a36a;}}if(_0xb006('0x7c')!=typeof _0x5a2deb[_0xb006('0x80')][_0xb006('0x81')]['agent']){var _0x1a9410=_0x5a2deb[_0xb006('0x80')][_0xb006('0x81')][_0xb006('0x8e')];if(!/^(f|ht)tps?:\/\//i['test'](_0x1a9410)){_0x28532b=path[_0xb006('0x52')](_0xb006('0x8f'),_0xa1cbbf,_0xfa8a6b[0x0],_0x1a9410);}else{_0x28532b=_0x1a9410;}}}}var _0x381377={'name':_0x3f195a,'description':_0x9401a9,'path':path[_0xb006('0x52')](_0xa1cbbf,_0xfa8a6b[0x0]),'type':_0x46d5ff,'sidebar':_0x35a13b,'icon':_0x86c144,'adminUrl':_0x294f48,'agentUrl':_0x28532b,'scriptName':_0x50ad26,'scriptPath':_0x540584,'version':_0x2090c8};removeReferences(_0x1026cf,null);return db[_0xb006('0x34')][_0xb006('0x92')](_0x381377)[_0xb006('0x2b')](function(_0x39598a){var _0x51e0d0={'role':_0x55b7e1[_0xb006('0x93')][_0xb006('0x94')],'userProfileId':_0x55b7e1['body'][_0xb006('0x95')]};if(!_0x51e0d0)throw new Error(_0xb006('0x96'));if(_0x51e0d0[_0xb006('0x94')]===_0xb006('0x97')){var _0x51fb78=_0x39598a[_0xb006('0x2c')]({'plain':!![]});return db[_0xb006('0x98')]['find']({'where':{'name':_0xb006('0x99'),'userProfileId':_0x51e0d0[_0xb006('0x95')]},'raw':!![]})['then'](function(_0x20fe5a){if(_0x20fe5a&&_0x20fe5a[_0xb006('0x9a')]===0x0){return db[_0xb006('0x2d')][_0xb006('0x92')]({'name':_0x51fb78['name'],'resourceId':_0x51fb78['id'],'type':_0x20fe5a[_0xb006('0x31')],'sectionId':_0x20fe5a['id']},{})[_0xb006('0x2b')](function(){return _0x39598a;});}else{return _0x39598a;}})[_0xb006('0x4c')](function(_0x5304ab){logger[_0xb006('0x2f')](_0xb006('0x9b'),_0x5304ab);throw _0x5304ab;});}return _0x39598a;})['then'](respondWithResult(_0x12d074,null))[_0xb006('0x4c')](handleError(_0x12d074,null));}});}catch(_0x46cc4c){_0x12d074[_0xb006('0x20')](0x1f4)[_0xb006('0x32')](_0x46cc4c);}};function removeReferences(_0x6698b0,_0x17e3c8){try{if(_0x6698b0){fs[_0xb006('0x68')](_0x6698b0);logger[_0xb006('0x69')](_0xb006('0x9c'));}if(_0x17e3c8){rimraf(_0x17e3c8,function(){});logger[_0xb006('0x69')](_0xb006('0x9d'));}}catch(_0xc6ff76){logger[_0xb006('0x2f')](_0xc6ff76);}}exports['update']=function(_0x3ce0c3,_0x2cd462,_0x384102){return db[_0xb006('0x34')]['find']({'where':{'id':_0x3ce0c3['params']['id']}})[_0xb006('0x2b')](handleEntityNotFound(_0x2cd462,null))['then'](saveUpdates(_0x3ce0c3[_0xb006('0x93')],null))[_0xb006('0x2b')](respondWithResult(_0x2cd462,null))[_0xb006('0x4c')](handleError(_0x2cd462,null));};exports[_0xb006('0x9e')]=function(_0x82299d,_0x1c6f44,_0x1b67d3){return db['Plugin'][_0xb006('0x51')]({'where':{'id':_0x82299d[_0xb006('0x4e')]['id']}})[_0xb006('0x2b')](function(_0x4a7c02){if(_0x4a7c02){return _0x4a7c02['destroy']();}})['then'](function(_0x180198){rimraf(path['join'](config['root'],'server/files/plugins',path[_0xb006('0x61')](_0x180198[_0xb006('0x9')])),function(){});return _0x180198;})[_0xb006('0x2b')](handleEntityNotFound(_0x1c6f44,null))['then'](respondWithStatusCode(_0x1c6f44,null))[_0xb006('0x4c')](handleError(_0x1c6f44,null));};exports[_0xb006('0x9f')]=function(_0x143926,_0x54efcb,_0x11118c){return BPromise[_0xb006('0xa0')]()[_0xb006('0x2b')](function(){if(!_0x143926[_0xb006('0x38')][_0xb006('0x9')]){throw new Error(_0xb006('0xa1'));}if(!_0x143926['query'][_0xb006('0xa2')]){throw new Error(_0xb006('0xa3'));}var _0x147269=_0x143926[_0xb006('0x38')][_0xb006('0xa4')]?_0x143926[_0xb006('0x38')][_0xb006('0xa4')]+':'+_0x143926[_0xb006('0x38')][_0xb006('0xa2')]:_0xb006('0xa5')+_0x143926[_0xb006('0x38')]['port'];var _0x2e15df=_0x143926[_0xb006('0x38')]['json']?_0x143926[_0xb006('0x38')]['json']:!![];var _0x384a1f=_0x143926[_0xb006('0x38')][_0xb006('0xa6')]?_0x143926[_0xb006('0x38')][_0xb006('0xa6')]:null;var _0x39fb21={'method':_0x143926[_0xb006('0xa7')],'uri':util['format'](_0xb006('0xa8'),_0x147269,_0x143926['query'][_0xb006('0x9')]),'json':_0x2e15df,'resolveWithFullResponse':!![],'encoding':_0x384a1f,'qs':_0x143926[_0xb006('0x38')]};if(_0x143926[_0xb006('0xa9')]){_0x39fb21[_0xb006('0xa9')]=_0x143926[_0xb006('0xa9')];if(_0x39fb21[_0xb006('0xa9')]['content-length']){delete _0x39fb21[_0xb006('0xa9')][_0xb006('0xaa')];}}if(_0x39fb21['headers']['content-type']){delete _0x39fb21[_0xb006('0xa9')][_0xb006('0xab')];}return rp(_0x39fb21);})['then'](function(_0x1b3f7d){if(_0x1b3f7d){_0x54efcb[_0xb006('0x26')](_0x1b3f7d['headers']);logger['info'](_0x1b3f7d[_0xb006('0x93')]);if(_[_0xb006('0xac')](_0x143926[_0xb006('0x38')][_0xb006('0x9')],_0xb006('0x50'))&&_0x1b3f7d['statusCode']==0x1f4){return _0x54efcb[_0xb006('0x1f')](_0x1b3f7d['statusCode']);}else{return _0x54efcb[_0xb006('0x20')](_0x1b3f7d[_0xb006('0xad')])[_0xb006('0x32')](_0x1b3f7d['body']);}}else{return _0x54efcb[_0xb006('0x1f')](0xc8);}})[_0xb006('0x4c')](handleError(_0x54efcb,null));};exports[_0xb006('0xae')]=function(_0x3ab385,_0x447407,_0x203e8f){return BPromise[_0xb006('0xa0')]()[_0xb006('0x2b')](function(){if(!_0x3ab385[_0xb006('0x38')][_0xb006('0x9')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x3ab385[_0xb006('0x38')][_0xb006('0xa2')]){throw new Error(_0xb006('0xa3'));}var _0x392a47=_0x3ab385[_0xb006('0x38')][_0xb006('0xa4')]?_0x3ab385['query'][_0xb006('0xa4')]+':'+_0x3ab385[_0xb006('0x38')]['port']:_0xb006('0xa5')+_0x3ab385['query'][_0xb006('0xa2')];var _0x5cea8d=_0x3ab385[_0xb006('0x38')][_0xb006('0x22')]?_0x3ab385[_0xb006('0x38')][_0xb006('0x22')]:!![];var _0x470131=_0x3ab385[_0xb006('0x38')][_0xb006('0xa6')]?_0x3ab385['query']['encoding']:null;var _0x436b0f={'method':_0x3ab385[_0xb006('0xa7')],'uri':util['format'](_0xb006('0xa8'),_0x392a47,_0x3ab385[_0xb006('0x38')][_0xb006('0x9')]),'json':_0x5cea8d,'resolveWithFullResponse':!![],'encoding':_0x470131,'body':_0x3ab385[_0xb006('0x93')]};if(_0x3ab385[_0xb006('0xa9')]){_0x436b0f[_0xb006('0xa9')]=_0x3ab385['headers'];if(_0x436b0f[_0xb006('0xa9')][_0xb006('0xaa')]){delete _0x436b0f[_0xb006('0xa9')][_0xb006('0xaa')];}}if(_0x436b0f['headers']['content-type']){delete _0x436b0f['headers'][_0xb006('0xab')];}return rp(_0x436b0f);})['then'](function(_0x400031){if(_0x400031){_0x447407['set'](_0x400031[_0xb006('0xa9')]);logger[_0xb006('0x69')](_0x400031['body']);return _0x447407[_0xb006('0x20')](_0x400031[_0xb006('0xad')])[_0xb006('0x32')](_0x400031[_0xb006('0x93')]);}else{return _0x447407[_0xb006('0x1f')](0xc8);}})['catch'](handleError(_0x447407,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 786c2db..a34679b 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 _0x4213=['../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x250d2a,_0x2983be){var _0x5738fa=function(_0x3cbde0){while(--_0x3cbde0){_0x250d2a['push'](_0x250d2a['shift']());}};_0x5738fa(++_0x2983be);}(_0x4213,0x77));var _0x3421=function(_0xf63cae,_0x3e66a5){_0xf63cae=_0xf63cae-0x0;var _0x4e69df=_0x4213[_0xf63cae];return _0x4e69df;};'use strict';var EventEmitter=require(_0x3421('0x0'));var Plugin=require(_0x3421('0x1'))['db'][_0x3421('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x3421('0x3')](0x0);var events={'afterCreate':_0x3421('0x4'),'afterUpdate':_0x3421('0x5'),'afterDestroy':_0x3421('0x6')};function emitEvent(_0x5a303d){return function(_0xdbd54e,_0x5c3719,_0x459c5e){PluginEvents[_0x3421('0x7')](_0x5a303d+':'+_0xdbd54e['id'],_0xdbd54e);PluginEvents[_0x3421('0x7')](_0x5a303d,_0xdbd54e);_0x459c5e(null);};}for(var e in events){if(events[_0x3421('0x8')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x3421('0x9')]=PluginEvents; \ No newline at end of file +var _0x0120=['remove','emit','exports','events','../../mysqldb','Plugin','setMaxListeners','save','update'];(function(_0x4ad9cb,_0x34833f){var _0x1df8bb=function(_0x53bc74){while(--_0x53bc74){_0x4ad9cb['push'](_0x4ad9cb['shift']());}};_0x1df8bb(++_0x34833f);}(_0x0120,0x6f));var _0x0012=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0120[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0x0012('0x0'));var Plugin=require(_0x0012('0x1'))['db'][_0x0012('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x0012('0x3')](0x0);var events={'afterCreate':_0x0012('0x4'),'afterUpdate':_0x0012('0x5'),'afterDestroy':_0x0012('0x6')};function emitEvent(_0xeb175){return function(_0x357f77,_0x302029,_0x3505ab){PluginEvents[_0x0012('0x7')](_0xeb175+':'+_0x357f77['id'],_0x357f77);PluginEvents['emit'](_0xeb175,_0x357f77);_0x3505ab(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x0012('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 73b9f73..ed08156 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 _0x9a19=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports','define'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0x9a19,0x114));var _0x99a1=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x9a19[_0x4a747d];return _0x3a5b5c;};'use strict';var _=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var logger=require(_0x99a1('0x2'))('api');var moment=require(_0x99a1('0x3'));var BPromise=require(_0x99a1('0x4'));var rp=require(_0x99a1('0x5'));var fs=require('fs');var path=require(_0x99a1('0x6'));var rimraf=require(_0x99a1('0x7'));var config=require(_0x99a1('0x8'));var attributes=require(_0x99a1('0x9'));module[_0x99a1('0xa')]=function(_0x3eff4a,_0xff0240){return _0x3eff4a[_0x99a1('0xb')]('Plugin',attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3eea=['exports','Plugin','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes'];(function(_0x166ff6,_0x121d72){var _0x260452=function(_0x19076a){while(--_0x19076a){_0x166ff6['push'](_0x166ff6['shift']());}};_0x260452(++_0x121d72);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x76c15e,_0x5c8a78){_0x76c15e=_0x76c15e-0x0;var _0x148a93=_0x3eea[_0x76c15e];return _0x148a93;};'use strict';var _=require(_0xa3ee('0x0'));var util=require('util');var logger=require(_0xa3ee('0x1'))(_0xa3ee('0x2'));var moment=require(_0xa3ee('0x3'));var BPromise=require(_0xa3ee('0x4'));var rp=require(_0xa3ee('0x5'));var fs=require('fs');var path=require(_0xa3ee('0x6'));var rimraf=require(_0xa3ee('0x7'));var config=require(_0xa3ee('0x8'));var attributes=require(_0xa3ee('0x9'));module[_0xa3ee('0xa')]=function(_0xb93cdb,_0x5776bb){return _0xb93cdb['define'](_0xa3ee('0xb'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 26d1efc..0d8e485 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 _0xbd81=['redis','defaults','localhost','socket.io-emitter','register','then','info','Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreatePlugin','create','options','raw','debug','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x1646f5,_0x521057){var _0x16ea46=function(_0x5d2083){while(--_0x5d2083){_0x1646f5['push'](_0x1646f5['shift']());}};_0x16ea46(++_0x521057);}(_0xbd81,0x16a));var _0x1bd8=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xbd81[_0x6cf19c];return _0xce14f3;};'use strict';var _=require(_0x1bd8('0x0'));var util=require(_0x1bd8('0x1'));var moment=require(_0x1bd8('0x2'));var BPromise=require(_0x1bd8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1bd8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1bd8('0x5'));var logger=require('../../config/logger')(_0x1bd8('0x6'));var config=require(_0x1bd8('0x7'));var jayson=require(_0x1bd8('0x8'));var client=jayson[_0x1bd8('0x9')]['http']({'port':0x232a});config[_0x1bd8('0xa')]=_[_0x1bd8('0xb')](config[_0x1bd8('0xa')],{'host':_0x1bd8('0xc'),'port':0x18eb});var socket=require(_0x1bd8('0xd'))(new Redis(config[_0x1bd8('0xa')]));require('./plugin.socket')[_0x1bd8('0xe')](socket);function respondWithRpcPromise(_0x21ff10,_0x35f9d4,_0x23f5b3){return new BPromise(function(_0x5daddf,_0x201e29){return client['request'](_0x21ff10,_0x23f5b3)[_0x1bd8('0xf')](function(_0x1286a9){logger[_0x1bd8('0x10')](_0x1bd8('0x11'),_0x35f9d4,_0x1bd8('0x12'));logger['debug'](_0x1bd8('0x13'),_0x35f9d4,_0x1bd8('0x12'),JSON[_0x1bd8('0x14')](_0x1286a9));if(_0x1286a9[_0x1bd8('0x15')]){if(_0x1286a9[_0x1bd8('0x15')][_0x1bd8('0x16')]===0x1f4){logger[_0x1bd8('0x15')]('Plugin,\x20%s,\x20%s',_0x35f9d4,_0x1286a9['error'][_0x1bd8('0x17')]);return _0x201e29(_0x1286a9[_0x1bd8('0x15')][_0x1bd8('0x17')]);}logger[_0x1bd8('0x15')]('Plugin,\x20%s,\x20%s',_0x35f9d4,_0x1286a9[_0x1bd8('0x15')][_0x1bd8('0x17')]);return _0x5daddf(_0x1286a9[_0x1bd8('0x15')][_0x1bd8('0x17')]);}else{logger[_0x1bd8('0x10')](_0x1bd8('0x11'),_0x35f9d4,_0x1bd8('0x12'));_0x5daddf(_0x1286a9[_0x1bd8('0x18')][_0x1bd8('0x17')]);}})[_0x1bd8('0x19')](function(_0x357872){logger[_0x1bd8('0x15')](_0x1bd8('0x11'),_0x35f9d4,_0x357872);_0x201e29(_0x357872);});});}exports[_0x1bd8('0x1a')]=function(_0x199cf3){var _0x44c84b=this;return new Promise(function(_0xcc33a3,_0x1600cf){return db['Plugin'][_0x1bd8('0x1b')](_0x199cf3['body'],{'raw':_0x199cf3[_0x1bd8('0x1c')]?_0x199cf3[_0x1bd8('0x1c')][_0x1bd8('0x1d')]===undefined?!![]:![]:!![]})[_0x1bd8('0xf')](function(_0x126e8a){logger[_0x1bd8('0x10')](_0x1bd8('0x1a'),_0x199cf3);logger[_0x1bd8('0x1e')](_0x1bd8('0x1a'),_0x199cf3,JSON[_0x1bd8('0x14')](_0x126e8a));_0xcc33a3(_0x126e8a);})[_0x1bd8('0x19')](function(_0x3740b9){logger[_0x1bd8('0x15')](_0x1bd8('0x1a'),_0x3740b9['message'],_0x199cf3);_0x1600cf(_0x44c84b[_0x1bd8('0x15')](0x1f4,_0x3740b9['message']));});});}; \ No newline at end of file +var _0x26fa=['socket.io-emitter','register','request','then','info','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','code','Plugin,\x20%s,\x20%s','message','catch','CreatePlugin','Plugin','create','body','options','raw','stringify','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost'];(function(_0xd77f62,_0x16d615){var _0xc1888c=function(_0x364f22){while(--_0x364f22){_0xd77f62['push'](_0xd77f62['shift']());}};_0xc1888c(++_0x16d615);}(_0x26fa,0xbe));var _0xa26f=function(_0x4ce17a,_0x3a1671){_0x4ce17a=_0x4ce17a-0x0;var _0x3c8bed=_0x26fa[_0x4ce17a];return _0x3c8bed;};'use strict';var _=require('lodash');var util=require(_0xa26f('0x0'));var moment=require(_0xa26f('0x1'));var BPromise=require(_0xa26f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa26f('0x3'));var db=require(_0xa26f('0x4'))['db'];var utils=require(_0xa26f('0x5'));var logger=require(_0xa26f('0x6'))(_0xa26f('0x7'));var config=require(_0xa26f('0x8'));var jayson=require(_0xa26f('0x9'));var client=jayson['client'][_0xa26f('0xa')]({'port':0x232a});config[_0xa26f('0xb')]=_[_0xa26f('0xc')](config[_0xa26f('0xb')],{'host':_0xa26f('0xd'),'port':0x18eb});var socket=require(_0xa26f('0xe'))(new Redis(config[_0xa26f('0xb')]));require('./plugin.socket')[_0xa26f('0xf')](socket);function respondWithRpcPromise(_0x5d22fd,_0x3f1074,_0x3319f3){return new BPromise(function(_0x161242,_0x54eda5){return client[_0xa26f('0x10')](_0x5d22fd,_0x3319f3)[_0xa26f('0x11')](function(_0xd8b0a4){logger[_0xa26f('0x12')]('Plugin,\x20%s,\x20%s',_0x3f1074,_0xa26f('0x13'));logger[_0xa26f('0x14')](_0xa26f('0x15'),_0x3f1074,_0xa26f('0x13'),JSON['stringify'](_0xd8b0a4));if(_0xd8b0a4[_0xa26f('0x16')]){if(_0xd8b0a4[_0xa26f('0x16')][_0xa26f('0x17')]===0x1f4){logger[_0xa26f('0x16')](_0xa26f('0x18'),_0x3f1074,_0xd8b0a4[_0xa26f('0x16')]['message']);return _0x54eda5(_0xd8b0a4['error'][_0xa26f('0x19')]);}logger[_0xa26f('0x16')](_0xa26f('0x18'),_0x3f1074,_0xd8b0a4['error']['message']);return _0x161242(_0xd8b0a4[_0xa26f('0x16')][_0xa26f('0x19')]);}else{logger[_0xa26f('0x12')](_0xa26f('0x18'),_0x3f1074,_0xa26f('0x13'));_0x161242(_0xd8b0a4['result'][_0xa26f('0x19')]);}})[_0xa26f('0x1a')](function(_0x4369ab){logger[_0xa26f('0x16')]('Plugin,\x20%s,\x20%s',_0x3f1074,_0x4369ab);_0x54eda5(_0x4369ab);});});}exports[_0xa26f('0x1b')]=function(_0x5cf85b){var _0x1febd8=this;return new Promise(function(_0xf168aa,_0x54449f){return db[_0xa26f('0x1c')][_0xa26f('0x1d')](_0x5cf85b[_0xa26f('0x1e')],{'raw':_0x5cf85b[_0xa26f('0x1f')]?_0x5cf85b['options'][_0xa26f('0x20')]===undefined?!![]:![]:!![]})[_0xa26f('0x11')](function(_0x28173d){logger['info'](_0xa26f('0x1b'),_0x5cf85b);logger['debug'](_0xa26f('0x1b'),_0x5cf85b,JSON[_0xa26f('0x21')](_0x28173d));_0xf168aa(_0x28173d);})[_0xa26f('0x1a')](function(_0x158e71){logger[_0xa26f('0x16')](_0xa26f('0x1b'),_0x158e71[_0xa26f('0x19')],_0x5cf85b);_0x54449f(_0x1febd8['error'](0x1f4,_0x158e71[_0xa26f('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 5b6fcca..ec413bd 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 _0x1619=['removeListener','remove'];(function(_0x55dfdd,_0x11e0b5){var _0x2eac54=function(_0x5a919b){while(--_0x5a919b){_0x55dfdd['push'](_0x55dfdd['shift']());}};_0x2eac54(++_0x11e0b5);}(_0x1619,0x189));var _0x9161=function(_0xd56e77,_0x2982ba){_0xd56e77=_0xd56e77-0x0;var _0x5db728=_0x1619[_0xd56e77];return _0x5db728;};'use strict';var PluginEvents=require('./plugin.events');var events=['save',_0x9161('0x0'),'update'];function createListener(_0x32741a,_0x5b7e95){return function(_0x27b078){_0x5b7e95['emit'](_0x32741a,_0x27b078);};}function removeListener(_0x1a123e,_0x491624){return function(){PluginEvents[_0x9161('0x1')](_0x1a123e,_0x491624);};}exports['register']=function(_0x50ed78){for(var _0x1b006d=0x0,_0x280562=events['length'];_0x1b006d<_0x280562;_0x1b006d++){var _0xb212e4=events[_0x1b006d];var _0x1f8240=createListener('plugin:'+_0xb212e4,_0x50ed78);PluginEvents['on'](_0xb212e4,_0x1f8240);}}; \ No newline at end of file +var _0x4912=['save','remove','update','emit','removeListener','register','plugin:'];(function(_0x552bab,_0xc58252){var _0x4afdc0=function(_0x5d5e3a){while(--_0x5d5e3a){_0x552bab['push'](_0x552bab['shift']());}};_0x4afdc0(++_0xc58252);}(_0x4912,0x1c0));var _0x2491=function(_0x1e3d63,_0x821370){_0x1e3d63=_0x1e3d63-0x0;var _0x4b9031=_0x4912[_0x1e3d63];return _0x4b9031;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x2491('0x0'),_0x2491('0x1'),_0x2491('0x2')];function createListener(_0x283a10,_0x47cc2b){return function(_0x4d0102){_0x47cc2b[_0x2491('0x3')](_0x283a10,_0x4d0102);};}function removeListener(_0x30258c,_0x36f0f7){return function(){PluginEvents[_0x2491('0x4')](_0x30258c,_0x36f0f7);};}exports[_0x2491('0x5')]=function(_0x1594e8){for(var _0x2addc5=0x0,_0x2fd440=events['length'];_0x2addc5<_0x2fd440;_0x2addc5++){var _0x1c43c2=events[_0x2addc5];var _0x181584=createListener(_0x2491('0x6')+_0x1c43c2,_0x1594e8);PluginEvents['on'](_0x1c43c2,_0x181584);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index d65b01a..d912f5f 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 _0xbcaa=['../../components/auth/service','./pm2.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','Router'];(function(_0x3c70c4,_0x486505){var _0x17afd6=function(_0x44cb5d){while(--_0x44cb5d){_0x3c70c4['push'](_0x3c70c4['shift']());}};_0x17afd6(++_0x486505);}(_0xbcaa,0xc2));var _0xabca=function(_0xf0bd2,_0x35db65){_0xf0bd2=_0xf0bd2-0x0;var _0x5b26ce=_0xbcaa[_0xf0bd2];return _0x5b26ce;};'use strict';var express=require('express');var router=express[_0xabca('0x0')]();var auth=require(_0xabca('0x1'));var controller=require(_0xabca('0x2'));router['get']('/',auth[_0xabca('0x3')](),controller[_0xabca('0x4')]);router[_0xabca('0x5')](_0xabca('0x6'),auth[_0xabca('0x3')](),controller[_0xabca('0x7')]);router[_0xabca('0x8')]('/',auth[_0xabca('0x3')](),controller[_0xabca('0x9')]);router[_0xabca('0xa')](_0xabca('0x6'),auth[_0xabca('0x3')](),controller[_0xabca('0xb')]);router[_0xabca('0xc')]('/:id',auth[_0xabca('0x3')](),controller[_0xabca('0xd')]);module[_0xabca('0xe')]=router; \ No newline at end of file +var _0xdf62=['show','create','put','/:id','destroy','exports','express','../../components/auth/service','./pm2.controller','get','isAuthenticated'];(function(_0x44e6a6,_0x2b05a3){var _0xb65563=function(_0x5bebd4){while(--_0x5bebd4){_0x44e6a6['push'](_0x44e6a6['shift']());}};_0xb65563(++_0x2b05a3);}(_0xdf62,0x1be));var _0x2df6=function(_0x1d307c,_0x21fc3c){_0x1d307c=_0x1d307c-0x0;var _0xb36311=_0xdf62[_0x1d307c];return _0xb36311;};'use strict';var express=require(_0x2df6('0x0'));var router=express['Router']();var auth=require(_0x2df6('0x1'));var controller=require(_0x2df6('0x2'));router[_0x2df6('0x3')]('/',auth[_0x2df6('0x4')](),controller['index']);router['get']('/:id',auth[_0x2df6('0x4')](),controller[_0x2df6('0x5')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2df6('0x6')]);router[_0x2df6('0x7')]('/:id',auth[_0x2df6('0x4')](),controller['update']);router['delete'](_0x2df6('0x8'),auth[_0x2df6('0x4')](),controller[_0x2df6('0x9')]);module[_0x2df6('0xa')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 88b4bac..abf2c10 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 _0x467c=['error','name','send','npm\x20install','info','index','list','then','reject','motion2','length','catch','show','describe','create','body','script','join','../../files/plugins','cwd','chdir','start','dump','Missing\x20name\x20and/or\x20path','update','stop','params','Unknown\x20status','destroy','lodash','../../config/pm2','../../config/logger','api','path','sendStatus','status','json'];(function(_0x435b1d,_0x323551){var _0x25f4e5=function(_0x5c5125){while(--_0x5c5125){_0x435b1d['push'](_0x435b1d['shift']());}};_0x25f4e5(++_0x323551);}(_0x467c,0x1d9));var _0xc467=function(_0xb58e48,_0x5cf818){_0xb58e48=_0xb58e48-0x0;var _0x358b15=_0x467c[_0xb58e48];return _0x358b15;};'use strict';var _=require(_0xc467('0x0'));var pm2=require(_0xc467('0x1'));var logger=require(_0xc467('0x2'))(_0xc467('0x3'));var path=require(_0xc467('0x4'));var exec=require('child_process')['exec'];var BPromise=require('bluebird');function handleEntityNotFound(_0x2407a6,_0x31676d){return function(_0x34c406){if(!_0x34c406){_0x2407a6[_0xc467('0x5')](0x194);;}return _0x34c406;};}function respondWithResult(_0x2c925a,_0x1acf82){_0x1acf82=_0x1acf82||0xc8;return function(_0x157f8c){if(_0x157f8c){return _0x2c925a[_0xc467('0x6')](_0x1acf82)[_0xc467('0x7')](_0x157f8c);}return null;};}function handleError(_0x2a9dc4,_0x3228ee){_0x3228ee=_0x3228ee||0x1f4;return function(_0x2558a4){logger[_0xc467('0x8')](_0x2558a4['stack']);if(_0x2558a4[_0xc467('0x9')]){delete _0x2558a4[_0xc467('0x9')];}_0x2a9dc4[_0xc467('0x6')](_0x3228ee)[_0xc467('0xa')](_0x2558a4);};}function execChildProcess(){return new BPromise(function(_0x37650a,_0x45a600){exec(_0xc467('0xb'),function(_0x21a122,_0xf5de63,_0x5defe2){logger[_0xc467('0xc')](_0xf5de63);logger[_0xc467('0xc')](_0x5defe2);if(_0x21a122){logger[_0xc467('0x8')](_0x21a122);return _0x45a600(_0x21a122);}return _0x37650a(_0xf5de63);});});}exports[_0xc467('0xd')]=function(_0x53e76e,_0x3e23f2){return pm2[_0xc467('0xe')]()[_0xc467('0xf')](function(_0x3624bb){if(_0x3624bb){var _0x122c09=_[_0xc467('0x10')](_0x3624bb,function(_0x5150f8){return _0x5150f8['name']==='express'||_0x5150f8['name']===_0xc467('0x11');});return{'rows':_0x122c09,'count':_0x122c09[_0xc467('0x12')]};}return null;})[_0xc467('0xf')](respondWithResult(_0x3e23f2,null))[_0xc467('0x13')](handleError(_0x3e23f2,null));};exports[_0xc467('0x14')]=function(_0x4912e3,_0x443337){return pm2[_0xc467('0x15')](_0x4912e3['params']['id'])[_0xc467('0xf')](respondWithResult(_0x443337,null))['then'](handleEntityNotFound(_0x443337,null))[_0xc467('0x13')](handleError(_0x443337,null));};exports[_0xc467('0x16')]=function(_0x48bca1,_0x48867c){if(_0x48bca1['body'][_0xc467('0x9')]&&_0x48bca1[_0xc467('0x17')][_0xc467('0x18')]){var _0x1d2687=path[_0xc467('0x19')](__dirname,_0xc467('0x1a'),_0x48bca1[_0xc467('0x17')][_0xc467('0x18')]);var _0x4c09d5=process[_0xc467('0x1b')]();process[_0xc467('0x1c')](path['dirname'](_0x1d2687));return execChildProcess()[_0xc467('0xf')](function(_0x87b155){process['chdir'](_0x4c09d5);return pm2[_0xc467('0x1d')]({'name':_0x48bca1[_0xc467('0x17')][_0xc467('0x9')],'script':_0x1d2687});})[_0xc467('0xf')](function(_0x3f062c){pm2[_0xc467('0x1e')]();return _0x3f062c[0x0];})[_0xc467('0xf')](respondWithResult(_0x48867c,0xc9))[_0xc467('0x13')](handleError(_0x48867c,null));}else{return _0x48867c[_0xc467('0x6')](0x1f4)[_0xc467('0xa')]({'message':_0xc467('0x1f')});}};exports[_0xc467('0x20')]=function(_0x13bc84,_0x1f4aeb){if(_0x13bc84[_0xc467('0x17')]['id']){delete _0x13bc84['body']['id'];}var _0x5e14ad={'online':'restart','stopped':_0xc467('0x21')};if(_0x5e14ad['hasOwnProperty'](_0x13bc84[_0xc467('0x17')][_0xc467('0x6')])){return pm2[_0x5e14ad[_0x13bc84[_0xc467('0x17')]['status']]](_0x13bc84[_0xc467('0x22')]['id'])[_0xc467('0xf')](respondWithResult(_0x1f4aeb,0xc8))[_0xc467('0x13')](handleError(_0x1f4aeb,null));}else{return _0x1f4aeb[_0xc467('0x6')](0x1f4)['send']({'message':_0xc467('0x23')});}};exports[_0xc467('0x24')]=function(_0x1a8b81,_0x1b888f){if(_0x1a8b81[_0xc467('0x17')]['id']){delete _0x1a8b81[_0xc467('0x17')]['id'];}if(_0x1a8b81['params']['id']){return pm2['delete'](_0x1a8b81[_0xc467('0x22')]['id'])[_0xc467('0xf')](function(_0x1ed0cc){pm2[_0xc467('0x1e')]();return _0x1ed0cc[0x0];})[_0xc467('0xf')](respondWithResult(_0x1b888f,null))[_0xc467('0x13')](handleError(_0x1b888f,null));}else{return _0x1b888f['status'](0x1f4)[_0xc467('0xa')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0x7de0=['error','stack','name','npm\x20install','info','index','reject','express','motion2','then','catch','show','describe','create','body','join','../../files/plugins','script','cwd','dirname','chdir','dump','send','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','params','destroy','delete','Unknown\x20id','../../config/pm2','path','child_process','bluebird','status'];(function(_0x58f7fe,_0xec0533){var _0x6dfce6=function(_0x1fb8ca){while(--_0x1fb8ca){_0x58f7fe['push'](_0x58f7fe['shift']());}};_0x6dfce6(++_0xec0533);}(_0x7de0,0xfe));var _0x07de=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x7de0[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var pm2=require(_0x07de('0x0'));var logger=require('../../config/logger')('api');var path=require(_0x07de('0x1'));var exec=require(_0x07de('0x2'))['exec'];var BPromise=require(_0x07de('0x3'));function handleEntityNotFound(_0x42a27a,_0x301040){return function(_0x17af91){if(!_0x17af91){_0x42a27a['sendStatus'](0x194);;}return _0x17af91;};}function respondWithResult(_0x12e174,_0x304c5a){_0x304c5a=_0x304c5a||0xc8;return function(_0x4087bf){if(_0x4087bf){return _0x12e174[_0x07de('0x4')](_0x304c5a)['json'](_0x4087bf);}return null;};}function handleError(_0x2b7585,_0x41ff49){_0x41ff49=_0x41ff49||0x1f4;return function(_0x94008e){logger[_0x07de('0x5')](_0x94008e[_0x07de('0x6')]);if(_0x94008e[_0x07de('0x7')]){delete _0x94008e[_0x07de('0x7')];}_0x2b7585[_0x07de('0x4')](_0x41ff49)['send'](_0x94008e);};}function execChildProcess(){return new BPromise(function(_0x3109ef,_0x254351){exec(_0x07de('0x8'),function(_0x197d04,_0xd7041c,_0x1bdfc7){logger[_0x07de('0x9')](_0xd7041c);logger['info'](_0x1bdfc7);if(_0x197d04){logger[_0x07de('0x5')](_0x197d04);return _0x254351(_0x197d04);}return _0x3109ef(_0xd7041c);});});}exports[_0x07de('0xa')]=function(_0x1c6462,_0x456a7a){return pm2['list']()['then'](function(_0x262fe4){if(_0x262fe4){var _0x4f23bf=_[_0x07de('0xb')](_0x262fe4,function(_0x3fc57e){return _0x3fc57e[_0x07de('0x7')]===_0x07de('0xc')||_0x3fc57e[_0x07de('0x7')]===_0x07de('0xd');});return{'rows':_0x4f23bf,'count':_0x4f23bf['length']};}return null;})[_0x07de('0xe')](respondWithResult(_0x456a7a,null))[_0x07de('0xf')](handleError(_0x456a7a,null));};exports[_0x07de('0x10')]=function(_0x41ab98,_0x1c45cf){return pm2[_0x07de('0x11')](_0x41ab98['params']['id'])[_0x07de('0xe')](respondWithResult(_0x1c45cf,null))['then'](handleEntityNotFound(_0x1c45cf,null))[_0x07de('0xf')](handleError(_0x1c45cf,null));};exports[_0x07de('0x12')]=function(_0x326ffa,_0x3cb4a9){if(_0x326ffa['body'][_0x07de('0x7')]&&_0x326ffa[_0x07de('0x13')]['script']){var _0x4e65b1=path[_0x07de('0x14')](__dirname,_0x07de('0x15'),_0x326ffa[_0x07de('0x13')][_0x07de('0x16')]);var _0x14593c=process[_0x07de('0x17')]();process['chdir'](path[_0x07de('0x18')](_0x4e65b1));return execChildProcess()[_0x07de('0xe')](function(_0x5982c7){process[_0x07de('0x19')](_0x14593c);return pm2['start']({'name':_0x326ffa[_0x07de('0x13')]['name'],'script':_0x4e65b1});})[_0x07de('0xe')](function(_0x392505){pm2[_0x07de('0x1a')]();return _0x392505[0x0];})[_0x07de('0xe')](respondWithResult(_0x3cb4a9,0xc9))['catch'](handleError(_0x3cb4a9,null));}else{return _0x3cb4a9[_0x07de('0x4')](0x1f4)[_0x07de('0x1b')]({'message':_0x07de('0x1c')});}};exports[_0x07de('0x1d')]=function(_0x1048f0,_0x2a377a){if(_0x1048f0[_0x07de('0x13')]['id']){delete _0x1048f0[_0x07de('0x13')]['id'];}var _0x271989={'online':_0x07de('0x1e'),'stopped':_0x07de('0x1f')};if(_0x271989[_0x07de('0x20')](_0x1048f0[_0x07de('0x13')][_0x07de('0x4')])){return pm2[_0x271989[_0x1048f0[_0x07de('0x13')][_0x07de('0x4')]]](_0x1048f0[_0x07de('0x21')]['id'])['then'](respondWithResult(_0x2a377a,0xc8))[_0x07de('0xf')](handleError(_0x2a377a,null));}else{return _0x2a377a[_0x07de('0x4')](0x1f4)[_0x07de('0x1b')]({'message':'Unknown\x20status'});}};exports[_0x07de('0x22')]=function(_0x4fdbfe,_0x50bc42){if(_0x4fdbfe['body']['id']){delete _0x4fdbfe[_0x07de('0x13')]['id'];}if(_0x4fdbfe[_0x07de('0x21')]['id']){return pm2[_0x07de('0x23')](_0x4fdbfe[_0x07de('0x21')]['id'])[_0x07de('0xe')](function(_0x4ca78c){pm2['dump']();return _0x4ca78c[0x0];})['then'](respondWithResult(_0x50bc42,null))[_0x07de('0xf')](handleError(_0x50bc42,null));}else{return _0x50bc42[_0x07de('0x4')](0x1f4)['send']({'message':_0x07de('0x24')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index a88224d..728fbb4 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 _0xc34c=['exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xc34c,0x9b));var _0xcc34=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xc34c[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0xcc34('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xcc34('0x1'));var express=require(_0xcc34('0x2'));var router=express[_0xcc34('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xcc34('0x4'));var config=require(_0xcc34('0x5'));module[_0xcc34('0x6')]=router; \ No newline at end of file +var _0xc255=['Router','../../config/environment','util','connect-timeout'];(function(_0x336376,_0xe4b28d){var _0x1d2a8e=function(_0x3afe68){while(--_0x3afe68){_0x336376['push'](_0x336376['shift']());}};_0x1d2a8e(++_0xe4b28d);}(_0xc255,0xfa));var _0x5c25=function(_0x257a0,_0x42d2b4){_0x257a0=_0x257a0-0x0;var _0x8a44ed=_0xc255[_0x257a0];return _0x8a44ed;};'use strict';var multer=require('multer');var util=require(_0x5c25('0x0'));var path=require('path');var timeout=require(_0x5c25('0x1'));var express=require('express');var router=express[_0x5c25('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5c25('0x3'));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 7e56a49..b565b3f 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 _0x1de7=['STRING','DATE','sequelize','exports','INTEGER'];(function(_0x79a898,_0x3b4f71){var _0xeb5da=function(_0x3ae423){while(--_0x3ae423){_0x79a898['push'](_0x79a898['shift']());}};_0xeb5da(++_0x3b4f71);}(_0x1de7,0x1b5));var _0x71de=function(_0x358861,_0x588704){_0x358861=_0x358861-0x0;var _0x818c78=_0x1de7[_0x358861];return _0x818c78;};'use strict';var Sequelize=require(_0x71de('0x0'));module[_0x71de('0x1')]={'state':{'type':Sequelize[_0x71de('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x71de('0x3')]},'scheduledat':{'type':Sequelize[_0x71de('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x71de('0x4')]},'responsetime':{'type':Sequelize[_0x71de('0x4')]},'ringtime':{'type':Sequelize[_0x71de('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x71de('0x3')]},'campaigntype':{'type':Sequelize[_0x71de('0x3')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x94f5=['STRING','DATE','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x94f5,0x92));var _0x594f=function(_0x4cacf2,_0x27d0e4){_0x4cacf2=_0x4cacf2-0x0;var _0x23d089=_0x94f5[_0x4cacf2];return _0x23d089;};'use strict';var Sequelize=require('sequelize');module[_0x594f('0x0')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x594f('0x1')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x594f('0x1')]},'starttime':{'type':Sequelize[_0x594f('0x2')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x594f('0x1')]},'campaigntype':{'type':Sequelize[_0x594f('0x1')]},'membername':{'type':Sequelize[_0x594f('0x1')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index f7173d0..129f285 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 _0x11fd=['bluebird','path','rimraf','../../config/environment','./reportAgentPreview.attributes','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x11fd,0x157));var _0xd11f=function(_0x245b7f,_0x2b8ed6){_0x245b7f=_0x245b7f-0x0;var _0x1fae5e=_0x11fd[_0x245b7f];return _0x1fae5e;};'use strict';var _=require(_0xd11f('0x0'));var util=require(_0xd11f('0x1'));var logger=require(_0xd11f('0x2'))(_0xd11f('0x3'));var moment=require(_0xd11f('0x4'));var BPromise=require(_0xd11f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd11f('0x6'));var rimraf=require(_0xd11f('0x7'));var config=require(_0xd11f('0x8'));var attributes=require(_0xd11f('0x9'));module['exports']=function(_0x1155af,_0x4f75b5){return _0x1155af['define'](_0xd11f('0xa'),attributes,{'tableName':_0xd11f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc7b8=['./reportAgentPreview.attributes','util','api','moment','bluebird','path','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc7b8,0xcc));var _0x8c7b=function(_0xcfa394,_0x7a3346){_0xcfa394=_0xcfa394-0x0;var _0x26c4fe=_0xc7b8[_0xcfa394];return _0x26c4fe;};'use strict';var _=require('lodash');var util=require(_0x8c7b('0x0'));var logger=require('../../config/logger')(_0x8c7b('0x1'));var moment=require(_0x8c7b('0x2'));var BPromise=require(_0x8c7b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8c7b('0x4'));var rimraf=require('rimraf');var config=require(_0x8c7b('0x5'));var attributes=require(_0x8c7b('0x6'));module['exports']=function(_0x5a5489,_0x12b846){return _0x5a5489['define']('ReportAgentPreview',attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 6716a8b..fc2510c 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 _0x4f0f=['CreateReportAgentPreview','stringify','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ReportAgentPreview','create','body','options','raw'];(function(_0x24303d,_0x5a994b){var _0x35276e=function(_0x32b292){while(--_0x32b292){_0x24303d['push'](_0x24303d['shift']());}};_0x35276e(++_0x5a994b);}(_0x4f0f,0x16e));var _0xf4f0=function(_0x17febc,_0x5618f2){_0x17febc=_0x17febc-0x0;var _0x500db8=_0x4f0f[_0x17febc];return _0x500db8;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xf4f0('0x0'));var rs=require(_0xf4f0('0x1'));var fs=require('fs');var Redis=require(_0xf4f0('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xf4f0('0x3'));var logger=require(_0xf4f0('0x4'))(_0xf4f0('0x5'));var config=require(_0xf4f0('0x6'));var jayson=require(_0xf4f0('0x7'));var client=jayson[_0xf4f0('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a24a0,_0x5164d8,_0x69690c){return new BPromise(function(_0x39b8f4,_0x114715){return client[_0xf4f0('0x9')](_0x5a24a0,_0x69690c)[_0xf4f0('0xa')](function(_0x361d1e){logger[_0xf4f0('0xb')](_0xf4f0('0xc'),_0x5164d8,_0xf4f0('0xd'));logger[_0xf4f0('0xe')](_0xf4f0('0xf'),_0x5164d8,_0xf4f0('0xd'),JSON['stringify'](_0x361d1e));if(_0x361d1e[_0xf4f0('0x10')]){if(_0x361d1e['error'][_0xf4f0('0x11')]===0x1f4){logger[_0xf4f0('0x10')](_0xf4f0('0xc'),_0x5164d8,_0x361d1e[_0xf4f0('0x10')][_0xf4f0('0x12')]);return _0x114715(_0x361d1e['error'][_0xf4f0('0x12')]);}logger[_0xf4f0('0x10')](_0xf4f0('0xc'),_0x5164d8,_0x361d1e[_0xf4f0('0x10')][_0xf4f0('0x12')]);return _0x39b8f4(_0x361d1e[_0xf4f0('0x10')]['message']);}else{logger[_0xf4f0('0xb')]('ReportAgentPreview,\x20%s,\x20%s',_0x5164d8,'request\x20sent');_0x39b8f4(_0x361d1e[_0xf4f0('0x13')][_0xf4f0('0x12')]);}})[_0xf4f0('0x14')](function(_0x30cea7){logger['error'](_0xf4f0('0xc'),_0x5164d8,_0x30cea7);_0x114715(_0x30cea7);});});}exports['CreateReportAgentPreview']=function(_0x142d2f){var _0x5f1a94=this;return new Promise(function(_0xcbfb98,_0xebae06){return db[_0xf4f0('0x15')][_0xf4f0('0x16')](_0x142d2f[_0xf4f0('0x17')],{'raw':_0x142d2f['options']?_0x142d2f[_0xf4f0('0x18')][_0xf4f0('0x19')]===undefined?!![]:![]:!![]})[_0xf4f0('0xa')](function(_0x181f3c){logger[_0xf4f0('0xb')](_0xf4f0('0x1a'),_0x142d2f);logger[_0xf4f0('0xe')](_0xf4f0('0x1a'),_0x142d2f,JSON[_0xf4f0('0x1b')](_0x181f3c));_0xcbfb98(_0x181f3c);})[_0xf4f0('0x14')](function(_0xd0fd3b){logger[_0xf4f0('0x10')]('CreateReportAgentPreview',_0xd0fd3b[_0xf4f0('0x12')],_0x142d2f);_0xebae06(_0x5f1a94[_0xf4f0('0x10')](0x1f4,_0xd0fd3b['message']));});});}; \ No newline at end of file +var _0x3436=['jayson/promise','http','request','info','ReportAgentPreview,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','body','options','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x50b6cd,_0x428332){var _0x289d3d=function(_0x32e628){while(--_0x32e628){_0x50b6cd['push'](_0x50b6cd['shift']());}};_0x289d3d(++_0x428332);}(_0x3436,0x19a));var _0x6343=function(_0x2543ba,_0x2088df){_0x2543ba=_0x2543ba-0x0;var _0x1cd7f0=_0x3436[_0x2543ba];return _0x1cd7f0;};'use strict';var _=require(_0x6343('0x0'));var util=require(_0x6343('0x1'));var moment=require(_0x6343('0x2'));var BPromise=require(_0x6343('0x3'));var rs=require(_0x6343('0x4'));var fs=require('fs');var Redis=require(_0x6343('0x5'));var db=require(_0x6343('0x6'))['db'];var utils=require(_0x6343('0x7'));var logger=require(_0x6343('0x8'))(_0x6343('0x9'));var config=require('../../config/environment');var jayson=require(_0x6343('0xa'));var client=jayson['client'][_0x6343('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c04df,_0xaa5fa9,_0x3c09b4){return new BPromise(function(_0x15d11f,_0xbf9db6){return client[_0x6343('0xc')](_0x3c04df,_0x3c09b4)['then'](function(_0x23ae12){logger[_0x6343('0xd')](_0x6343('0xe'),_0xaa5fa9,'request\x20sent');logger[_0x6343('0xf')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0xaa5fa9,_0x6343('0x10'),JSON[_0x6343('0x11')](_0x23ae12));if(_0x23ae12[_0x6343('0x12')]){if(_0x23ae12['error'][_0x6343('0x13')]===0x1f4){logger['error'](_0x6343('0xe'),_0xaa5fa9,_0x23ae12[_0x6343('0x12')]['message']);return _0xbf9db6(_0x23ae12[_0x6343('0x12')][_0x6343('0x14')]);}logger[_0x6343('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0xaa5fa9,_0x23ae12[_0x6343('0x12')][_0x6343('0x14')]);return _0x15d11f(_0x23ae12[_0x6343('0x12')][_0x6343('0x14')]);}else{logger[_0x6343('0xd')](_0x6343('0xe'),_0xaa5fa9,_0x6343('0x10'));_0x15d11f(_0x23ae12[_0x6343('0x15')][_0x6343('0x14')]);}})[_0x6343('0x16')](function(_0x1572c5){logger['error'](_0x6343('0xe'),_0xaa5fa9,_0x1572c5);_0xbf9db6(_0x1572c5);});});}exports[_0x6343('0x17')]=function(_0x516b05){var _0x350334=this;return new Promise(function(_0x4ce95a,_0x139c47){return db[_0x6343('0x18')]['create'](_0x516b05[_0x6343('0x19')],{'raw':_0x516b05[_0x6343('0x1a')]?_0x516b05[_0x6343('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x6343('0x1b')](function(_0x3508df){logger['info'](_0x6343('0x17'),_0x516b05);logger[_0x6343('0xf')](_0x6343('0x17'),_0x516b05,JSON[_0x6343('0x11')](_0x3508df));_0x4ce95a(_0x3508df);})['catch'](function(_0x1f34e2){logger[_0x6343('0x12')](_0x6343('0x17'),_0x1f34e2[_0x6343('0x14')],_0x516b05);_0x139c47(_0x350334[_0x6343('0x12')](0x1f4,_0x1f34e2[_0x6343('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index c09869b..55be22d 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 _0x411c=['/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/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','voiceQueuesChannelRedirect','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','put','agentCapacity','/telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','chatQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','showMailQueues','/chat/queues/:id/notify','chat','showChatQueues','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','showWhatsappQueues','/agents/:id/notify','exports','multer','util','Router','./rpc.controller','get'];(function(_0x5c4f89,_0x42e9d6){var _0x133307=function(_0x1484d6){while(--_0x1484d6){_0x5c4f89['push'](_0x5c4f89['shift']());}};_0x133307(++_0x42e9d6);}(_0x411c,0x93));var _0xc411=function(_0x4d2f96,_0xb8dfc8){_0x4d2f96=_0x4d2f96-0x0;var _0x1f0c90=_0x411c[_0x4d2f96];return _0x1f0c90;};'use strict';var multer=require(_0xc411('0x0'));var util=require(_0xc411('0x1'));var path=require('path');var express=require('express');var router=express[_0xc411('0x2')]();var auth=require('../../components/auth/service');var controller=require(_0xc411('0x3'));router[_0xc411('0x4')](_0xc411('0x5'),auth[_0xc411('0x6')](),controller[_0xc411('0x7')]);router[_0xc411('0x4')](_0xc411('0x8'),auth[_0xc411('0x6')](),controller[_0xc411('0x9')]);router[_0xc411('0x4')](_0xc411('0xa'),auth[_0xc411('0x6')](),controller['voiceChannelStopMixMonitor']);router[_0xc411('0x4')](_0xc411('0xb'),auth[_0xc411('0x6')](),controller[_0xc411('0xc')]);router[_0xc411('0x4')](_0xc411('0xd'),auth[_0xc411('0x6')](),controller[_0xc411('0xe')]);router[_0xc411('0x4')](_0xc411('0xf'),auth[_0xc411('0x6')](),controller[_0xc411('0x10')]);router[_0xc411('0x4')](_0xc411('0x11'),auth[_0xc411('0x6')](),controller[_0xc411('0x12')]);router[_0xc411('0x4')](_0xc411('0x13'),auth[_0xc411('0x6')](),controller['openchannelQueues']);router[_0xc411('0x4')](_0xc411('0x14'),auth[_0xc411('0x6')](),controller[_0xc411('0x15')]);router['get'](_0xc411('0x16'),auth[_0xc411('0x6')](),controller[_0xc411('0x17')]);router[_0xc411('0x4')](_0xc411('0x18'),auth[_0xc411('0x6')](),controller[_0xc411('0x19')]);router[_0xc411('0x4')](_0xc411('0x1a'),auth[_0xc411('0x6')](),controller[_0xc411('0x1b')]);router[_0xc411('0x4')](_0xc411('0x1c'),auth[_0xc411('0x6')](),controller[_0xc411('0x1d')]);router[_0xc411('0x4')]('/voice/queues/channels/:uniqueid',auth[_0xc411('0x6')](),controller[_0xc411('0x1e')]);router['get'](_0xc411('0x1f'),auth[_0xc411('0x6')](),controller[_0xc411('0x20')]);router['get'](_0xc411('0x21'),auth[_0xc411('0x6')](),controller[_0xc411('0x22')]);router[_0xc411('0x4')]('/voice/queues/:id',auth[_0xc411('0x6')](),controller['showVoiceQueues']);router[_0xc411('0x4')](_0xc411('0x23'),auth[_0xc411('0x6')](),controller[_0xc411('0x24')]);router[_0xc411('0x4')](_0xc411('0x25'),auth[_0xc411('0x6')](),controller[_0xc411('0x26')]);router[_0xc411('0x4')](_0xc411('0x27'),auth[_0xc411('0x6')](),controller[_0xc411('0x28')]);router[_0xc411('0x29')]('/agents/:id/capacity',auth[_0xc411('0x6')](),controller[_0xc411('0x2a')]);router[_0xc411('0x4')](_0xc411('0x2b'),auth[_0xc411('0x6')](),controller['telephones']);router[_0xc411('0x4')](_0xc411('0x2c'),auth[_0xc411('0x6')](),controller[_0xc411('0x2d')]);router[_0xc411('0x4')](_0xc411('0x2e'),auth[_0xc411('0x6')](),controller[_0xc411('0x2f')]);router[_0xc411('0x4')](_0xc411('0x30'),auth['isAuthenticated'](),controller[_0xc411('0x31')]);router[_0xc411('0x4')]('/chat/queues/waitinginteractions',auth[_0xc411('0x6')](),controller[_0xc411('0x32')]);router[_0xc411('0x4')]('/mail/queues/waitinginteractions',auth[_0xc411('0x6')](),controller['mailQueuesWaitingInteractions']);router[_0xc411('0x4')](_0xc411('0x33'),auth[_0xc411('0x6')](),controller[_0xc411('0x34')]);router[_0xc411('0x4')](_0xc411('0x35'),auth[_0xc411('0x6')](),controller[_0xc411('0x36')]);router[_0xc411('0x4')](_0xc411('0x37'),auth['isAuthenticated'](),controller[_0xc411('0x38')]);router['get'](_0xc411('0x39'),auth[_0xc411('0x6')](),controller[_0xc411('0x3a')]);router[_0xc411('0x3b')](_0xc411('0x3c'),auth[_0xc411('0x6')](),controller[_0xc411('0x3d')]('mail'));router['get']('/mail/queues/:id',auth[_0xc411('0x6')](),controller[_0xc411('0x3e')]);router[_0xc411('0x3b')](_0xc411('0x3f'),auth[_0xc411('0x6')](),controller['queueNotify'](_0xc411('0x40')));router['get']('/chat/queues/:id',auth[_0xc411('0x6')](),controller[_0xc411('0x41')]);router['post']('/fax/queues/:id/notify',auth[_0xc411('0x6')](),controller[_0xc411('0x3d')]('fax'));router['get'](_0xc411('0x42'),auth[_0xc411('0x6')](),controller['showFaxQueues']);router['post'](_0xc411('0x43'),auth[_0xc411('0x6')](),controller['queueNotify'](_0xc411('0x44')));router[_0xc411('0x4')]('/openchannel/queues/:id',auth[_0xc411('0x6')](),controller[_0xc411('0x45')]);router[_0xc411('0x3b')]('/sms/queues/:id/notify',auth['isAuthenticated'](),controller[_0xc411('0x3d')]('sms'));router[_0xc411('0x3b')](_0xc411('0x46'),auth[_0xc411('0x6')](),controller['queueNotify']('whatsapp'));router['get'](_0xc411('0x47'),auth['isAuthenticated'](),controller[_0xc411('0x48')]);router['get']('/whatsapp/queues/:id',auth[_0xc411('0x6')](),controller[_0xc411('0x49')]);router[_0xc411('0x3b')](_0xc411('0x4a'),auth[_0xc411('0x6')](),controller['agentNotify']);module[_0xc411('0x4b')]=router; \ No newline at end of file +var _0x1bc1=['mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','showFaxQueues','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','multer','util','path','Router','../../components/auth/service','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/channels','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','put','/agents/:id/capacity','/telephones','trunks','/campaigns','campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','queueNotify'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1bc1,0x13c));var _0x11bc=function(_0x54c578,_0x397223){_0x54c578=_0x54c578-0x0;var _0x24acf2=_0x1bc1[_0x54c578];return _0x24acf2;};'use strict';var multer=require(_0x11bc('0x0'));var util=require(_0x11bc('0x1'));var path=require(_0x11bc('0x2'));var express=require('express');var router=express[_0x11bc('0x3')]();var auth=require(_0x11bc('0x4'));var controller=require('./rpc.controller');router[_0x11bc('0x5')]('/voice/channels',auth[_0x11bc('0x6')](),controller[_0x11bc('0x7')]);router[_0x11bc('0x5')](_0x11bc('0x8'),auth[_0x11bc('0x6')](),controller['voiceChannelMixMonitor']);router[_0x11bc('0x5')]('/voice/channels/:uniqueid/stopmixmonitor',auth['isAuthenticated'](),controller[_0x11bc('0x9')]);router['get'](_0x11bc('0xa'),auth[_0x11bc('0x6')](),controller[_0x11bc('0xb')]);router[_0x11bc('0x5')](_0x11bc('0xc'),auth[_0x11bc('0x6')](),controller['chatQueues']);router[_0x11bc('0x5')]('/mail/queues',auth[_0x11bc('0x6')](),controller[_0x11bc('0xd')]);router[_0x11bc('0x5')](_0x11bc('0xe'),auth[_0x11bc('0x6')](),controller[_0x11bc('0xf')]);router[_0x11bc('0x5')](_0x11bc('0x10'),auth['isAuthenticated'](),controller['openchannelQueues']);router[_0x11bc('0x5')](_0x11bc('0x11'),auth[_0x11bc('0x6')](),controller[_0x11bc('0x12')]);router[_0x11bc('0x5')](_0x11bc('0x13'),auth[_0x11bc('0x6')](),controller[_0x11bc('0x14')]);router[_0x11bc('0x5')](_0x11bc('0x15'),auth[_0x11bc('0x6')](),controller[_0x11bc('0x16')]);router[_0x11bc('0x5')]('/voice/queues/preview/:id',auth[_0x11bc('0x6')](),controller['voiceQueuesPreview']);router[_0x11bc('0x5')](_0x11bc('0x17'),auth[_0x11bc('0x6')](),controller['voiceQueuesChannels']);router[_0x11bc('0x5')]('/voice/queues/channels/:uniqueid',auth[_0x11bc('0x6')](),controller['voiceQueuesChannel']);router['get'](_0x11bc('0x18'),auth[_0x11bc('0x6')](),controller['voiceQueuesChannelHangup']);router[_0x11bc('0x5')](_0x11bc('0x19'),auth['isAuthenticated'](),controller[_0x11bc('0x1a')]);router[_0x11bc('0x5')](_0x11bc('0x1b'),auth[_0x11bc('0x6')](),controller[_0x11bc('0x1c')]);router[_0x11bc('0x5')](_0x11bc('0x1d'),auth['isAuthenticated'](),controller[_0x11bc('0x1e')]);router[_0x11bc('0x5')](_0x11bc('0x1f'),auth[_0x11bc('0x6')](),controller[_0x11bc('0x20')]);router['get'](_0x11bc('0x21'),auth['isAuthenticated'](),controller[_0x11bc('0x22')]);router[_0x11bc('0x23')](_0x11bc('0x24'),auth['isAuthenticated'](),controller['agentCapacity']);router[_0x11bc('0x5')](_0x11bc('0x25'),auth[_0x11bc('0x6')](),controller['telephones']);router['get']('/trunks',auth[_0x11bc('0x6')](),controller[_0x11bc('0x26')]);router[_0x11bc('0x5')](_0x11bc('0x27'),auth[_0x11bc('0x6')](),controller[_0x11bc('0x28')]);router['get'](_0x11bc('0x29'),auth[_0x11bc('0x6')](),controller['faxAccounts']);router[_0x11bc('0x5')](_0x11bc('0x2a'),auth[_0x11bc('0x6')](),controller[_0x11bc('0x2b')]);router[_0x11bc('0x5')](_0x11bc('0x2c'),auth[_0x11bc('0x6')](),controller[_0x11bc('0x2d')]);router[_0x11bc('0x5')](_0x11bc('0x2e'),auth['isAuthenticated'](),controller['openchannelQueuesWaitingInteractions']);router[_0x11bc('0x5')](_0x11bc('0x2f'),auth['isAuthenticated'](),controller[_0x11bc('0x30')]);router[_0x11bc('0x5')](_0x11bc('0x31'),auth['isAuthenticated'](),controller['whatsappQueuesWaitingInteractions']);router[_0x11bc('0x5')](_0x11bc('0x32'),auth['isAuthenticated'](),controller[_0x11bc('0x33')]);router[_0x11bc('0x34')]('/mail/queues/:id/notify',auth[_0x11bc('0x6')](),controller[_0x11bc('0x35')](_0x11bc('0x36')));router[_0x11bc('0x5')](_0x11bc('0x37'),auth[_0x11bc('0x6')](),controller[_0x11bc('0x38')]);router[_0x11bc('0x34')](_0x11bc('0x39'),auth['isAuthenticated'](),controller[_0x11bc('0x35')]('chat'));router[_0x11bc('0x5')](_0x11bc('0x3a'),auth[_0x11bc('0x6')](),controller[_0x11bc('0x3b')]);router['post'](_0x11bc('0x3c'),auth[_0x11bc('0x6')](),controller['queueNotify'](_0x11bc('0x3d')));router['get']('/fax/queues/:id',auth[_0x11bc('0x6')](),controller[_0x11bc('0x3e')]);router[_0x11bc('0x34')]('/openchannel/queues/:id/notify',auth[_0x11bc('0x6')](),controller[_0x11bc('0x35')]('openchannel'));router[_0x11bc('0x5')]('/openchannel/queues/:id',auth[_0x11bc('0x6')](),controller[_0x11bc('0x3f')]);router['post'](_0x11bc('0x40'),auth[_0x11bc('0x6')](),controller['queueNotify'](_0x11bc('0x41')));router[_0x11bc('0x34')](_0x11bc('0x42'),auth['isAuthenticated'](),controller[_0x11bc('0x35')](_0x11bc('0x43')));router[_0x11bc('0x5')](_0x11bc('0x44'),auth['isAuthenticated'](),controller[_0x11bc('0x45')]);router[_0x11bc('0x5')](_0x11bc('0x46'),auth[_0x11bc('0x6')](),controller[_0x11bc('0x47')]);router[_0x11bc('0x34')](_0x11bc('0x48'),auth[_0x11bc('0x6')](),controller[_0x11bc('0x49')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 9ae6316..293b485 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 _0xe8da=['agent','Agent\x20not\x20found','Message','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','error','code','catch','status','name','send','isNil','rows','find','VoiceChannels','then','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','params','voiceChannelStopMixMonitor','VoiceQueues','showVoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','MemberReport','findAll','INTERACTION','length','format','updateAttributes','findOrCreate','interface','YYYY-MM-DD\x20HH:mm:ss','internal','AgentCapacity','capacity','Telephones','Trunks','Campaigns','ChatQueues','mailQueues','MailQueues','showMailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','\x20Queue\x20not\x20found','findOne','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','channel'];(function(_0x33554b,_0x48162b){var _0x256954=function(_0x185f66){while(--_0x185f66){_0x33554b['push'](_0x33554b['shift']());}};_0x256954(++_0x48162b);}(_0xe8da,0xdf));var _0xae8d=function(_0x59035a,_0x39710a){_0x59035a=_0x59035a-0x0;var _0x4de37c=_0xe8da[_0x59035a];return _0x4de37c;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require(_0xae8d('0x0'));var util=require(_0xae8d('0x1'));var db=require(_0xae8d('0x2'))['db'];var logger=require(_0xae8d('0x3'))(_0xae8d('0x4'));var jayson=require(_0xae8d('0x5'));var amiClient=jayson[_0xae8d('0x6')][_0xae8d('0x7')]({'port':0x232a});var mailClient=jayson[_0xae8d('0x6')][_0xae8d('0x7')]({'port':0x232b});var routingClient=jayson[_0xae8d('0x6')][_0xae8d('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x5277af,_0x5edf22,_0x950653){return new BPromise(function(_0x1b2103,_0x458269){var _0xc25800=_0x950653?_0x950653:amiClient;return _0xc25800['request'](_0x5277af,_0x5edf22)['then'](function(_0x412ecb){if(_0x412ecb['error']){if(_0x412ecb[_0xae8d('0x8')][_0xae8d('0x9')]===0x1f4){return _0x458269(_0x412ecb[_0xae8d('0x8')]['message']);}return _0x1b2103(_0x412ecb['error']['message']);}else{_0x1b2103(_0x412ecb['result']);}})[_0xae8d('0xa')](function(_0x286165){_0x458269(_0x286165);});});}function respondWithResult(_0x1fdfc4,_0x150023){_0x150023=_0x150023||0xc8;return function(_0x3edc26){if(_0x3edc26){return _0x1fdfc4[_0xae8d('0xb')](_0x150023)['json'](_0x3edc26);}return _0x1fdfc4['sendStatus'](0x194);};}function handleError(_0x89863e,_0x5f08f0){_0x5f08f0=_0x5f08f0||0x1f4;return function(_0x5d120a){logger[_0xae8d('0x8')](_0x5d120a['stack']);if(_0x5d120a[_0xae8d('0xc')]){delete _0x5d120a['name'];}_0x89863e[_0xae8d('0xb')](_0x5f08f0)[_0xae8d('0xd')](_0x5d120a);};}function findById(_0x4ddc0d){return function(_0x4962e6){if(!_[_0xae8d('0xe')](_0x4ddc0d)&&!_[_0xae8d('0xe')](_0x4962e6)&&!_[_0xae8d('0xe')](_0x4962e6[_0xae8d('0xf')])){return _[_0xae8d('0x10')](_0x4962e6[_0xae8d('0xf')],function(_0xd7ceec){return _0xd7ceec['id']==_0x4ddc0d;});}return null;};}exports['voiceChannels']=function(_0x2e2dc2,_0x5d8c11){return respondWithRpcPromise(_0xae8d('0x11'),_0x2e2dc2['query'])[_0xae8d('0x12')](respondWithResult(_0x5d8c11,null))['catch'](handleError(_0x5d8c11,null));};exports[_0xae8d('0x13')]=function(_0x56a8e0,_0x5a2d74){return respondWithRpcPromise(_0xae8d('0x14'),_[_0xae8d('0x15')](_0x56a8e0[_0xae8d('0x16')],_0x56a8e0[_0xae8d('0x17')]))[_0xae8d('0x12')](respondWithResult(_0x5a2d74,null))[_0xae8d('0xa')](handleError(_0x5a2d74,null));};exports[_0xae8d('0x18')]=function(_0x5ad8fb,_0x44ff3c){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0xae8d('0x15')](_0x5ad8fb[_0xae8d('0x16')],_0x5ad8fb[_0xae8d('0x17')]))[_0xae8d('0x12')](respondWithResult(_0x44ff3c,null))[_0xae8d('0xa')](handleError(_0x44ff3c,null));};exports['voiceQueues']=function(_0x3c3bcf,_0x5cda50){return respondWithRpcPromise(_0xae8d('0x19'),_0x3c3bcf['query'])['then'](respondWithResult(_0x5cda50,null))[_0xae8d('0xa')](handleError(_0x5cda50,null));};exports[_0xae8d('0x1a')]=function(_0x5c3f66,_0x50a37c){return respondWithRpcPromise(_0xae8d('0x19'),_0x5c3f66[_0xae8d('0x16')])[_0xae8d('0x12')](findById(_0x5c3f66[_0xae8d('0x17')]['id']))[_0xae8d('0x12')](respondWithResult(_0x50a37c,null))[_0xae8d('0xa')](handleError(_0x50a37c,null));};exports[_0xae8d('0x1b')]=function(_0x49db2e,_0x30b90b){return respondWithRpcPromise(_0xae8d('0x1c'),_[_0xae8d('0x15')](_0x49db2e[_0xae8d('0x16')],_0x49db2e[_0xae8d('0x17')]))[_0xae8d('0x12')](respondWithResult(_0x30b90b,null))[_0xae8d('0xa')](handleError(_0x30b90b,null));};exports['voiceQueuesChannels']=function(_0x58b2af,_0x3af13d){return respondWithRpcPromise(_0xae8d('0x1d'),_0x58b2af[_0xae8d('0x16')])[_0xae8d('0x12')](respondWithResult(_0x3af13d,null))['catch'](handleError(_0x3af13d,null));};exports[_0xae8d('0x1e')]=function(_0x4b2895,_0x3325aa){return respondWithRpcPromise(_0xae8d('0x1f'),_[_0xae8d('0x15')](_0x4b2895[_0xae8d('0x16')],_0x4b2895[_0xae8d('0x17')]))[_0xae8d('0x12')](respondWithResult(_0x3325aa,null))[_0xae8d('0xa')](handleError(_0x3325aa,null));};exports['voiceQueuesChannelHangup']=function(_0xbe93e8,_0x42a6a6){return respondWithRpcPromise(_0xae8d('0x20'),_['merge'](_0xbe93e8[_0xae8d('0x16')],_0xbe93e8[_0xae8d('0x17')]))[_0xae8d('0x12')](respondWithResult(_0x42a6a6,null))[_0xae8d('0xa')](handleError(_0x42a6a6,null));};exports[_0xae8d('0x21')]=function(_0x3792f8,_0x2c1f7a){return respondWithRpcPromise(_0xae8d('0x22'),_['merge'](_0x3792f8[_0xae8d('0x16')],_0x3792f8['params']))[_0xae8d('0x12')](respondWithResult(_0x2c1f7a,null))[_0xae8d('0xa')](handleError(_0x2c1f7a,null));};exports['outbound']=function(_0x5b6b78,_0x16614d){return respondWithRpcPromise(_0xae8d('0x23'),_0x5b6b78[_0xae8d('0x16')])[_0xae8d('0x12')](respondWithResult(_0x16614d,null))[_0xae8d('0xa')](handleError(_0x16614d,null));};exports[_0xae8d('0x24')]=function(_0x2a7bed,_0x3e4ca8){return respondWithRpcPromise(_0xae8d('0x25'),_0x2a7bed[_0xae8d('0x16')])[_0xae8d('0x12')](respondWithResult(_0x3e4ca8,null))[_0xae8d('0xa')](handleError(_0x3e4ca8,null));};exports[_0xae8d('0x26')]=function(_0x265a5b,_0x5f3f7f){var _0x8ac60f;return respondWithRpcPromise(_0xae8d('0x27'),_0x265a5b[_0xae8d('0x16')])[_0xae8d('0x12')](function(_0x2355c6){_0x8ac60f=_0x2355c6;return respondWithRpcPromise('Agents',_0x265a5b[_0xae8d('0x16')],routingClient);})['then'](function(_0x34dd9a){return _[_0xae8d('0x15')]({},_0x34dd9a,_0x8ac60f);})[_0xae8d('0x12')](respondWithResult(_0x5f3f7f,null))[_0xae8d('0xa')](handleError(_0x5f3f7f,null));};exports[_0xae8d('0x28')]=function(_0xbdf56a,_0x1fa357){if(_0xbdf56a[_0xae8d('0x29')]&&_0xbdf56a[_0xae8d('0x29')][_0xae8d('0x2a')]&&_0xbdf56a[_0xae8d('0x2b')]&&_0xbdf56a[_0xae8d('0x2b')][_0xae8d('0xc')]){for(var _0x5700b6 in _0xbdf56a['body'][_0xae8d('0x2a')]){if(_0xbdf56a['body']['interaction']['hasOwnProperty'](_0x5700b6)){db[_0xae8d('0x2c')][_0xae8d('0x2d')]({'where':{'channel':_0x5700b6,'membername':_0xbdf56a[_0xae8d('0x2b')]['name'],'type':_0xae8d('0x2e'),'exitAt':null,'uniqueid':_0xbdf56a[_0xae8d('0x29')]['interaction'][_0x5700b6]&&_0xbdf56a['body'][_0xae8d('0x2a')][_0x5700b6][_0xae8d('0x2f')]?{'$notIn':_0xbdf56a['body'][_0xae8d('0x2a')][_0x5700b6]}:{'$ne':null}}})[_0xae8d('0x12')](function(_0xd4b992){var _0x561306=moment()[_0xae8d('0x30')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x2385c7=0x0,_0x369da0=_0xd4b992[_0xae8d('0x2f')];_0x2385c7<_0x369da0;_0x2385c7+=0x1){_0xd4b992[_0x2385c7][_0xae8d('0x31')]({'exitAt':_0x561306});}});for(var _0x31255d=0x0;_0x31255d<_0xbdf56a[_0xae8d('0x29')][_0xae8d('0x2a')][_0x5700b6][_0xae8d('0x2f')];_0x31255d+=0x1){db['MemberReport'][_0xae8d('0x32')]({'where':{'channel':_0x5700b6,'membername':_0xbdf56a['user'][_0xae8d('0xc')],'type':_0xae8d('0x2e'),'uniqueid':_0xbdf56a['body'][_0xae8d('0x2a')][_0x5700b6][_0x31255d],'exitAt':null},'defaults':{'channel':_0x5700b6,'membername':_0xbdf56a['user']['name'],'interface':_[_0xae8d('0xe')](_0xbdf56a[_0xae8d('0x2b')]['interface'])?util[_0xae8d('0x30')]('SIP/%s',_0xbdf56a[_0xae8d('0x2b')]['name']):_0xbdf56a[_0xae8d('0x2b')][_0xae8d('0x33')],'type':'INTERACTION','enterAt':moment()['format'](_0xae8d('0x34')),'role':'agent','internal':_0xbdf56a[_0xae8d('0x2b')][_0xae8d('0x35')],'uniqueid':_0xbdf56a['body'][_0xae8d('0x2a')][_0x5700b6][_0x31255d]}});}}}}return respondWithRpcPromise(_0xae8d('0x36'),{'id':_0xbdf56a[_0xae8d('0x17')]['id'],'capacity':_0xbdf56a[_0xae8d('0x29')][_0xae8d('0x37')]},routingClient)[_0xae8d('0x12')](respondWithResult(_0x1fa357,null))[_0xae8d('0xa')](handleError(_0x1fa357,null));};exports['telephones']=function(_0x4ad561,_0x1df481){return respondWithRpcPromise(_0xae8d('0x38'),_0x4ad561['query'])[_0xae8d('0x12')](respondWithResult(_0x1df481,null))['catch'](handleError(_0x1df481,null));};exports['trunks']=function(_0x42c701,_0x41bfab){return respondWithRpcPromise(_0xae8d('0x39'),_0x42c701[_0xae8d('0x16')])[_0xae8d('0x12')](respondWithResult(_0x41bfab,null))['catch'](handleError(_0x41bfab,null));};exports['campaigns']=function(_0x8060a5,_0x21d8ed){return respondWithRpcPromise(_0xae8d('0x3a'),_0x8060a5[_0xae8d('0x16')])['then'](respondWithResult(_0x21d8ed,null))[_0xae8d('0xa')](handleError(_0x21d8ed,null));};exports['chatQueues']=function(_0x507c39,_0x2df7af){return respondWithRpcPromise(_0xae8d('0x3b'),_0x507c39[_0xae8d('0x16')],routingClient)[_0xae8d('0x12')](respondWithResult(_0x2df7af,null))[_0xae8d('0xa')](handleError(_0x2df7af,null));};exports['showChatQueues']=function(_0x1b21fa,_0x49cc29){return respondWithRpcPromise('ChatQueues',_0x1b21fa[_0xae8d('0x16')],routingClient)[_0xae8d('0x12')](findById(_0x1b21fa[_0xae8d('0x17')]['id']))['then'](respondWithResult(_0x49cc29,null))[_0xae8d('0xa')](handleError(_0x49cc29,null));};exports[_0xae8d('0x3c')]=function(_0x3c1fad,_0x4b3024){return respondWithRpcPromise(_0xae8d('0x3d'),_0x3c1fad['query'],routingClient)[_0xae8d('0x12')](respondWithResult(_0x4b3024,null))[_0xae8d('0xa')](handleError(_0x4b3024,null));};exports[_0xae8d('0x3e')]=function(_0x825b7b,_0x384ee4){return respondWithRpcPromise('MailQueues',_0x825b7b['query'],routingClient)[_0xae8d('0x12')](findById(_0x825b7b[_0xae8d('0x17')]['id']))['then'](respondWithResult(_0x384ee4,null))[_0xae8d('0xa')](handleError(_0x384ee4,null));};exports['mailAccounts']=function(_0x23ed9e,_0xc50f53){return respondWithRpcPromise(_0xae8d('0x3f'),_0x23ed9e[_0xae8d('0x16')],mailClient)[_0xae8d('0x12')](respondWithResult(_0xc50f53,null))[_0xae8d('0xa')](handleError(_0xc50f53,null));};exports[_0xae8d('0x40')]=function(_0x40ef78,_0x41e5de){return respondWithRpcPromise(_0xae8d('0x41'),_0x40ef78[_0xae8d('0x16')],routingClient)['then'](respondWithResult(_0x41e5de,null))[_0xae8d('0xa')](handleError(_0x41e5de,null));};exports['showOpenchannelQueues']=function(_0x4e6dfb,_0xa9d46a){return respondWithRpcPromise(_0xae8d('0x41'),_0x4e6dfb['query'],routingClient)['then'](findById(_0x4e6dfb[_0xae8d('0x17')]['id']))[_0xae8d('0x12')](respondWithResult(_0xa9d46a,null))[_0xae8d('0xa')](handleError(_0xa9d46a,null));};exports[_0xae8d('0x42')]=function(_0x3bd7e5,_0x9c1766){return respondWithRpcPromise(_0xae8d('0x43'),_0x3bd7e5[_0xae8d('0x16')],routingClient)[_0xae8d('0x12')](respondWithResult(_0x9c1766,null))[_0xae8d('0xa')](handleError(_0x9c1766,null));};exports[_0xae8d('0x44')]=function(_0x9a620f,_0x16bbe6){return respondWithRpcPromise('SmsQueues',_0x9a620f[_0xae8d('0x16')],routingClient)[_0xae8d('0x12')](findById(_0x9a620f[_0xae8d('0x17')]['id']))[_0xae8d('0x12')](respondWithResult(_0x16bbe6,null))[_0xae8d('0xa')](handleError(_0x16bbe6,null));};exports[_0xae8d('0x45')]=function(_0x28187d,_0x3b99b7){return respondWithRpcPromise(_0xae8d('0x46'),_0x28187d[_0xae8d('0x16')],routingClient)[_0xae8d('0x12')](respondWithResult(_0x3b99b7,null))[_0xae8d('0xa')](handleError(_0x3b99b7,null));};exports[_0xae8d('0x47')]=function(_0x1d0d77,_0x2b23de){return respondWithRpcPromise(_0xae8d('0x46'),_0x1d0d77[_0xae8d('0x16')],routingClient)[_0xae8d('0x12')](findById(_0x1d0d77['params']['id']))[_0xae8d('0x12')](respondWithResult(_0x2b23de,null))['catch'](handleError(_0x2b23de,null));};exports[_0xae8d('0x48')]=function(_0x5b17f2,_0x1da6a9){return respondWithRpcPromise(_0xae8d('0x49'),_0x5b17f2[_0xae8d('0x16')],routingClient)['then'](respondWithResult(_0x1da6a9,null))['catch'](handleError(_0x1da6a9,null));};exports[_0xae8d('0x4a')]=function(_0x3cc29b,_0x49eb8e){return respondWithRpcPromise(_0xae8d('0x49'),_0x3cc29b[_0xae8d('0x16')],routingClient)[_0xae8d('0x12')](findById(_0x3cc29b[_0xae8d('0x17')]['id']))[_0xae8d('0x12')](respondWithResult(_0x49eb8e,null))['catch'](handleError(_0x49eb8e,null));};exports['faxAccounts']=function(_0x4480a3,_0x580301){return respondWithRpcPromise(_0xae8d('0x4b'),_0x4480a3['query'])[_0xae8d('0x12')](respondWithResult(_0x580301,null))[_0xae8d('0xa')](handleError(_0x580301,null));};exports[_0xae8d('0x4c')]=function(_0x284f69,_0x2f94f0){return respondWithRpcPromise(_0xae8d('0x4d'),_0x284f69[_0xae8d('0x16')],routingClient)['then'](respondWithResult(_0x2f94f0,null))['catch'](handleError(_0x2f94f0,null));};exports['mailQueuesWaitingInteractions']=function(_0x12a252,_0x58dca2){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x12a252['query'],routingClient)['then'](respondWithResult(_0x58dca2,null))[_0xae8d('0xa')](handleError(_0x58dca2,null));};exports[_0xae8d('0x4e')]=function(_0x53c314,_0x5d65c6){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x53c314['query'],routingClient)[_0xae8d('0x12')](respondWithResult(_0x5d65c6,null))[_0xae8d('0xa')](handleError(_0x5d65c6,null));};exports[_0xae8d('0x4f')]=function(_0x320c76,_0x52312e){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x320c76[_0xae8d('0x16')],routingClient)[_0xae8d('0x12')](respondWithResult(_0x52312e,null))[_0xae8d('0xa')](handleError(_0x52312e,null));};exports[_0xae8d('0x50')]=function(_0x46547d,_0x361b53){return respondWithRpcPromise(_0xae8d('0x51'),_0x46547d[_0xae8d('0x16')],routingClient)[_0xae8d('0x12')](respondWithResult(_0x361b53,null))[_0xae8d('0xa')](handleError(_0x361b53,null));};exports[_0xae8d('0x52')]=function(_0x291c16,_0x5205dd){return respondWithRpcPromise(_0xae8d('0x53'),_0x291c16[_0xae8d('0x16')],routingClient)[_0xae8d('0x12')](respondWithResult(_0x5205dd,null))[_0xae8d('0xa')](handleError(_0x5205dd,null));};exports[_0xae8d('0x54')]=function(_0x44edb5){return function(_0x41dc82,_0x272e7e){var _0x190d17,_0x51fd82;var _0x3e9d3f=_[_0xae8d('0x55')](_0x44edb5);var _0x422d31=_0x44edb5===_0xae8d('0x56')?_0xae8d('0x57'):_0xae8d('0x58');return db[_0x3e9d3f+_0xae8d('0x59')]['findOne']({'raw':!![],'where':{'id':_0x41dc82[_0xae8d('0x17')]['id']}})[_0xae8d('0x12')](function(_0x2b7e57){if(_[_0xae8d('0xe')](_0x2b7e57)){throw new Error(_0x3e9d3f+_0xae8d('0x5a'));}_0x190d17=_0x2b7e57;return db[_0x3e9d3f+'Message'][_0xae8d('0x5b')]({'where':{'id':_0x41dc82[_0xae8d('0x29')][_0xae8d('0x5c')]},'include':[{'model':db[_0x3e9d3f+_0xae8d('0x5d')],'as':_0xae8d('0x5d')},{'model':db[_0x3e9d3f+_0x422d31],'as':_0xae8d('0x58')}]});})['then'](function(_0x9f942f){if(_['isNil'](_0x9f942f)){throw new Error(_0x3e9d3f+_0xae8d('0x5e'));}_0x51fd82=_0x9f942f;return _0x9f942f[_0xae8d('0x5f')]({'read':0x0,'readAt':null,'UserId':null});})[_0xae8d('0x12')](function(){var _0x1a6326={'uniqueid':_0x44edb5+'.'+_0x51fd82['id']+'.'+_0x51fd82[_0xae8d('0x5d')]['id'],'FromUserId':_0x41dc82[_0xae8d('0x2b')]['id'],'type':_0xae8d('0x60')};_0x1a6326[_0x3e9d3f+_0xae8d('0x61')]=_0x51fd82['id'];_0x1a6326[_0x3e9d3f+_0xae8d('0x62')]=_0x51fd82['Interaction']['id'];_0x1a6326[_0xae8d('0x63')+_0x3e9d3f+_0x422d31+'Id']=_0x51fd82[_0xae8d('0x58')]['id'];_0x1a6326['To'+_0x3e9d3f+_0xae8d('0x64')]=_0x190d17['id'];return db[_0x3e9d3f+_0xae8d('0x65')][_0xae8d('0x66')](_0x1a6326);})[_0xae8d('0x12')](function(){return respondWithRpcPromise(_0xae8d('0x67'),{'channel':_0x44edb5,'interaction':_0x51fd82[_0xae8d('0x5d')],'message':_0x51fd82,'account':_0x51fd82[_0xae8d('0x58')],'applications':[{'id':0x0,'priority':0x1,'app':_0xae8d('0x60'),'appdata':_0x190d17[_0xae8d('0xc')]+','+(_0x51fd82[_0xae8d('0x58')][_0xae8d('0x68')]||0x12c),'interval':_0xae8d('0x69')}]},routingClient);})[_0xae8d('0x12')](respondWithResult(_0x272e7e,null))[_0xae8d('0xa')](handleError(_0x272e7e,null));};};exports['agentNotify']=function(_0x527a24,_0x433724){var _0x1eaa48,_0x29f8dd;if(_[_0xae8d('0xe')](_0x527a24[_0xae8d('0x29')][_0xae8d('0x6a')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x36f340=_0x527a24[_0xae8d('0x29')][_0xae8d('0x6a')];var _0x212c5d=_['capitalize'](_0x36f340);var _0x42d109=_0x36f340===_0xae8d('0x56')?'Website':'Account';return db['User'][_0xae8d('0x5b')]({'raw':!![],'where':{'id':_0x527a24[_0xae8d('0x17')]['id'],'role':_0xae8d('0x6b')}})[_0xae8d('0x12')](function(_0x54ae67){if(_[_0xae8d('0xe')](_0x54ae67)){throw new Error(_0xae8d('0x6c'));}_0x1eaa48=_0x54ae67;return db[_0x212c5d+_0xae8d('0x6d')][_0xae8d('0x5b')]({'where':{'id':_0x527a24[_0xae8d('0x29')][_0xae8d('0x5c')]},'include':[{'model':db[_0x212c5d+_0xae8d('0x5d')],'as':_0xae8d('0x5d')},{'model':db[_0x212c5d+_0x42d109],'as':'Account'}]});})['then'](function(_0x317955){if(_[_0xae8d('0xe')](_0x317955)){throw new Error(_0x212c5d+_0xae8d('0x5e'));}_0x29f8dd=_0x317955;return _0x317955[_0xae8d('0x5f')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x162d50={'uniqueid':_0x36f340+'.'+_0x29f8dd['id']+'.'+_0x29f8dd['Interaction']['id'],'FromUserId':_0x527a24[_0xae8d('0x2b')]['id'],'type':_0xae8d('0x60'),'ToUserId':_0x1eaa48['id']};_0x162d50[_0x212c5d+_0xae8d('0x61')]=_0x29f8dd['id'];_0x162d50[_0x212c5d+_0xae8d('0x62')]=_0x29f8dd['Interaction']['id'];_0x162d50['From'+_0x212c5d+_0x42d109+'Id']=_0x29f8dd[_0xae8d('0x58')]['id'];return db[_0x212c5d+_0xae8d('0x65')][_0xae8d('0x66')](_0x162d50);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x36f340,'interaction':_0x29f8dd[_0xae8d('0x5d')],'message':_0x29f8dd,'account':_0x29f8dd[_0xae8d('0x58')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x1eaa48[_0xae8d('0xc')]+','+(_0x29f8dd['Account']['agentTransferTimeout']||0x12c),'interval':_0xae8d('0x69')}]},routingClient);})['then'](respondWithResult(_0x433724,null))[_0xae8d('0xa')](handleError(_0x433724,null));}; \ No newline at end of file +var _0x24f8=['jayson/promise','client','http','request','then','error','code','message','result','catch','json','sendStatus','stack','name','status','isNil','rows','voiceChannels','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','params','voiceChannelStopMixMonitor','voiceQueues','VoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','format','SIP/%s','agent','internal','capacity','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Account','Queue','findOne','\x20Queue\x20not\x20found','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','QueueId','TransferReport','create','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','User','Agent\x20not\x20found','Message','messageId','From','Start','agentTransferTimeout','util','../../config/logger','api'];(function(_0x501d0d,_0x38b758){var _0x37a8b8=function(_0x14113c){while(--_0x14113c){_0x501d0d['push'](_0x501d0d['shift']());}};_0x37a8b8(++_0x38b758);}(_0x24f8,0xed));var _0x824f=function(_0x56b138,_0x2396d6){_0x56b138=_0x56b138-0x0;var _0x3df878=_0x24f8[_0x56b138];return _0x3df878;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require('lodash');var util=require(_0x824f('0x0'));var db=require('../../mysqldb')['db'];var logger=require(_0x824f('0x1'))(_0x824f('0x2'));var jayson=require(_0x824f('0x3'));var amiClient=jayson[_0x824f('0x4')][_0x824f('0x5')]({'port':0x232a});var mailClient=jayson[_0x824f('0x4')][_0x824f('0x5')]({'port':0x232b});var routingClient=jayson[_0x824f('0x4')][_0x824f('0x5')]({'port':0x232c});function respondWithRpcPromise(_0x284ea3,_0x4052a7,_0x1e6147){return new BPromise(function(_0x27897d,_0x4d4ab4){var _0x5b177a=_0x1e6147?_0x1e6147:amiClient;return _0x5b177a[_0x824f('0x6')](_0x284ea3,_0x4052a7)[_0x824f('0x7')](function(_0x242e6e){if(_0x242e6e[_0x824f('0x8')]){if(_0x242e6e[_0x824f('0x8')][_0x824f('0x9')]===0x1f4){return _0x4d4ab4(_0x242e6e[_0x824f('0x8')][_0x824f('0xa')]);}return _0x27897d(_0x242e6e[_0x824f('0x8')][_0x824f('0xa')]);}else{_0x27897d(_0x242e6e[_0x824f('0xb')]);}})[_0x824f('0xc')](function(_0xa36467){_0x4d4ab4(_0xa36467);});});}function respondWithResult(_0x3ecafc,_0x18c995){_0x18c995=_0x18c995||0xc8;return function(_0x53ba0f){if(_0x53ba0f){return _0x3ecafc['status'](_0x18c995)[_0x824f('0xd')](_0x53ba0f);}return _0x3ecafc[_0x824f('0xe')](0x194);};}function handleError(_0x2ab001,_0xabe3d5){_0xabe3d5=_0xabe3d5||0x1f4;return function(_0x46e977){logger[_0x824f('0x8')](_0x46e977[_0x824f('0xf')]);if(_0x46e977[_0x824f('0x10')]){delete _0x46e977['name'];}_0x2ab001[_0x824f('0x11')](_0xabe3d5)['send'](_0x46e977);};}function findById(_0x5121ad){return function(_0xf9286f){if(!_[_0x824f('0x12')](_0x5121ad)&&!_[_0x824f('0x12')](_0xf9286f)&&!_[_0x824f('0x12')](_0xf9286f[_0x824f('0x13')])){return _['find'](_0xf9286f[_0x824f('0x13')],function(_0x56e600){return _0x56e600['id']==_0x5121ad;});}return null;};}exports[_0x824f('0x14')]=function(_0x549a75,_0x22957f){return respondWithRpcPromise('VoiceChannels',_0x549a75['query'])[_0x824f('0x7')](respondWithResult(_0x22957f,null))[_0x824f('0xc')](handleError(_0x22957f,null));};exports[_0x824f('0x15')]=function(_0x1a3ed4,_0x18f1e7){return respondWithRpcPromise(_0x824f('0x16'),_[_0x824f('0x17')](_0x1a3ed4[_0x824f('0x18')],_0x1a3ed4[_0x824f('0x19')]))[_0x824f('0x7')](respondWithResult(_0x18f1e7,null))[_0x824f('0xc')](handleError(_0x18f1e7,null));};exports[_0x824f('0x1a')]=function(_0x10b094,_0x1f10d9){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x824f('0x17')](_0x10b094[_0x824f('0x18')],_0x10b094[_0x824f('0x19')]))['then'](respondWithResult(_0x1f10d9,null))[_0x824f('0xc')](handleError(_0x1f10d9,null));};exports[_0x824f('0x1b')]=function(_0x159e7d,_0x1b6f0b){return respondWithRpcPromise(_0x824f('0x1c'),_0x159e7d[_0x824f('0x18')])[_0x824f('0x7')](respondWithResult(_0x1b6f0b,null))['catch'](handleError(_0x1b6f0b,null));};exports['showVoiceQueues']=function(_0x417b80,_0x107719){return respondWithRpcPromise(_0x824f('0x1c'),_0x417b80[_0x824f('0x18')])[_0x824f('0x7')](findById(_0x417b80[_0x824f('0x19')]['id']))[_0x824f('0x7')](respondWithResult(_0x107719,null))[_0x824f('0xc')](handleError(_0x107719,null));};exports[_0x824f('0x1d')]=function(_0x3057a9,_0x168eaa){return respondWithRpcPromise(_0x824f('0x1e'),_[_0x824f('0x17')](_0x3057a9[_0x824f('0x18')],_0x3057a9[_0x824f('0x19')]))[_0x824f('0x7')](respondWithResult(_0x168eaa,null))['catch'](handleError(_0x168eaa,null));};exports[_0x824f('0x1f')]=function(_0xbabe26,_0x279712){return respondWithRpcPromise('VoiceQueuesChannels',_0xbabe26[_0x824f('0x18')])[_0x824f('0x7')](respondWithResult(_0x279712,null))['catch'](handleError(_0x279712,null));};exports[_0x824f('0x20')]=function(_0x1974c5,_0x50d1ba){return respondWithRpcPromise(_0x824f('0x21'),_['merge'](_0x1974c5[_0x824f('0x18')],_0x1974c5[_0x824f('0x19')]))['then'](respondWithResult(_0x50d1ba,null))[_0x824f('0xc')](handleError(_0x50d1ba,null));};exports[_0x824f('0x22')]=function(_0x18ee06,_0x45c67f){return respondWithRpcPromise(_0x824f('0x23'),_[_0x824f('0x17')](_0x18ee06[_0x824f('0x18')],_0x18ee06[_0x824f('0x19')]))[_0x824f('0x7')](respondWithResult(_0x45c67f,null))[_0x824f('0xc')](handleError(_0x45c67f,null));};exports[_0x824f('0x24')]=function(_0x2479ed,_0x41d834){return respondWithRpcPromise(_0x824f('0x25'),_[_0x824f('0x17')](_0x2479ed[_0x824f('0x18')],_0x2479ed['params']))['then'](respondWithResult(_0x41d834,null))[_0x824f('0xc')](handleError(_0x41d834,null));};exports[_0x824f('0x26')]=function(_0x21af05,_0x4ef103){return respondWithRpcPromise(_0x824f('0x27'),_0x21af05['query'])['then'](respondWithResult(_0x4ef103,null))[_0x824f('0xc')](handleError(_0x4ef103,null));};exports['outboundChannels']=function(_0x50c88f,_0x460067){return respondWithRpcPromise(_0x824f('0x28'),_0x50c88f[_0x824f('0x18')])['then'](respondWithResult(_0x460067,null))[_0x824f('0xc')](handleError(_0x460067,null));};exports[_0x824f('0x29')]=function(_0x4b879f,_0x11f999){var _0x386d87;return respondWithRpcPromise(_0x824f('0x2a'),_0x4b879f[_0x824f('0x18')])['then'](function(_0x546861){_0x386d87=_0x546861;return respondWithRpcPromise(_0x824f('0x2a'),_0x4b879f['query'],routingClient);})['then'](function(_0x3fb251){return _['merge']({},_0x3fb251,_0x386d87);})[_0x824f('0x7')](respondWithResult(_0x11f999,null))[_0x824f('0xc')](handleError(_0x11f999,null));};exports[_0x824f('0x2b')]=function(_0x194f27,_0x543403){if(_0x194f27[_0x824f('0x2c')]&&_0x194f27[_0x824f('0x2c')][_0x824f('0x2d')]&&_0x194f27[_0x824f('0x2e')]&&_0x194f27['user'][_0x824f('0x10')]){for(var _0x5353ff in _0x194f27[_0x824f('0x2c')][_0x824f('0x2d')]){if(_0x194f27[_0x824f('0x2c')]['interaction'][_0x824f('0x2f')](_0x5353ff)){db[_0x824f('0x30')][_0x824f('0x31')]({'where':{'channel':_0x5353ff,'membername':_0x194f27[_0x824f('0x2e')][_0x824f('0x10')],'type':_0x824f('0x32'),'exitAt':null,'uniqueid':_0x194f27[_0x824f('0x2c')][_0x824f('0x2d')][_0x5353ff]&&_0x194f27['body']['interaction'][_0x5353ff][_0x824f('0x33')]?{'$notIn':_0x194f27[_0x824f('0x2c')][_0x824f('0x2d')][_0x5353ff]}:{'$ne':null}}})[_0x824f('0x7')](function(_0x204b92){var _0x3db3d0=moment()['format'](_0x824f('0x34'));for(var _0x39cae4=0x0,_0xbd8e57=_0x204b92[_0x824f('0x33')];_0x39cae4<_0xbd8e57;_0x39cae4+=0x1){_0x204b92[_0x39cae4][_0x824f('0x35')]({'exitAt':_0x3db3d0});}});for(var _0x13a3c9=0x0;_0x13a3c9<_0x194f27['body'][_0x824f('0x2d')][_0x5353ff][_0x824f('0x33')];_0x13a3c9+=0x1){db[_0x824f('0x30')][_0x824f('0x36')]({'where':{'channel':_0x5353ff,'membername':_0x194f27[_0x824f('0x2e')][_0x824f('0x10')],'type':_0x824f('0x32'),'uniqueid':_0x194f27[_0x824f('0x2c')][_0x824f('0x2d')][_0x5353ff][_0x13a3c9],'exitAt':null},'defaults':{'channel':_0x5353ff,'membername':_0x194f27[_0x824f('0x2e')][_0x824f('0x10')],'interface':_[_0x824f('0x12')](_0x194f27[_0x824f('0x2e')][_0x824f('0x37')])?util[_0x824f('0x38')](_0x824f('0x39'),_0x194f27['user'][_0x824f('0x10')]):_0x194f27[_0x824f('0x2e')]['interface'],'type':_0x824f('0x32'),'enterAt':moment()['format'](_0x824f('0x34')),'role':_0x824f('0x3a'),'internal':_0x194f27[_0x824f('0x2e')][_0x824f('0x3b')],'uniqueid':_0x194f27[_0x824f('0x2c')][_0x824f('0x2d')][_0x5353ff][_0x13a3c9]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x194f27[_0x824f('0x19')]['id'],'capacity':_0x194f27['body'][_0x824f('0x3c')]},routingClient)[_0x824f('0x7')](respondWithResult(_0x543403,null))['catch'](handleError(_0x543403,null));};exports['telephones']=function(_0xe69def,_0x328f03){return respondWithRpcPromise('Telephones',_0xe69def[_0x824f('0x18')])[_0x824f('0x7')](respondWithResult(_0x328f03,null))[_0x824f('0xc')](handleError(_0x328f03,null));};exports[_0x824f('0x3d')]=function(_0x303740,_0x4626be){return respondWithRpcPromise(_0x824f('0x3e'),_0x303740[_0x824f('0x18')])[_0x824f('0x7')](respondWithResult(_0x4626be,null))[_0x824f('0xc')](handleError(_0x4626be,null));};exports[_0x824f('0x3f')]=function(_0x3420e1,_0x5eecdf){return respondWithRpcPromise(_0x824f('0x40'),_0x3420e1[_0x824f('0x18')])[_0x824f('0x7')](respondWithResult(_0x5eecdf,null))[_0x824f('0xc')](handleError(_0x5eecdf,null));};exports[_0x824f('0x41')]=function(_0x7a05de,_0x19f46f){return respondWithRpcPromise(_0x824f('0x42'),_0x7a05de[_0x824f('0x18')],routingClient)[_0x824f('0x7')](respondWithResult(_0x19f46f,null))[_0x824f('0xc')](handleError(_0x19f46f,null));};exports[_0x824f('0x43')]=function(_0x546a54,_0x497d15){return respondWithRpcPromise(_0x824f('0x42'),_0x546a54[_0x824f('0x18')],routingClient)[_0x824f('0x7')](findById(_0x546a54[_0x824f('0x19')]['id']))['then'](respondWithResult(_0x497d15,null))['catch'](handleError(_0x497d15,null));};exports[_0x824f('0x44')]=function(_0x2540de,_0x2be920){return respondWithRpcPromise(_0x824f('0x45'),_0x2540de[_0x824f('0x18')],routingClient)[_0x824f('0x7')](respondWithResult(_0x2be920,null))[_0x824f('0xc')](handleError(_0x2be920,null));};exports[_0x824f('0x46')]=function(_0x2af314,_0x5dfa8d){return respondWithRpcPromise(_0x824f('0x45'),_0x2af314[_0x824f('0x18')],routingClient)['then'](findById(_0x2af314[_0x824f('0x19')]['id']))[_0x824f('0x7')](respondWithResult(_0x5dfa8d,null))[_0x824f('0xc')](handleError(_0x5dfa8d,null));};exports[_0x824f('0x47')]=function(_0x38def5,_0x306557){return respondWithRpcPromise('MailAccounts',_0x38def5['query'],mailClient)[_0x824f('0x7')](respondWithResult(_0x306557,null))[_0x824f('0xc')](handleError(_0x306557,null));};exports[_0x824f('0x48')]=function(_0x47e9a9,_0x1cc87a){return respondWithRpcPromise(_0x824f('0x49'),_0x47e9a9['query'],routingClient)[_0x824f('0x7')](respondWithResult(_0x1cc87a,null))['catch'](handleError(_0x1cc87a,null));};exports['showOpenchannelQueues']=function(_0x16acfd,_0x59c084){return respondWithRpcPromise(_0x824f('0x49'),_0x16acfd[_0x824f('0x18')],routingClient)[_0x824f('0x7')](findById(_0x16acfd[_0x824f('0x19')]['id']))[_0x824f('0x7')](respondWithResult(_0x59c084,null))[_0x824f('0xc')](handleError(_0x59c084,null));};exports[_0x824f('0x4a')]=function(_0x264e16,_0x4e376b){return respondWithRpcPromise(_0x824f('0x4b'),_0x264e16[_0x824f('0x18')],routingClient)[_0x824f('0x7')](respondWithResult(_0x4e376b,null))[_0x824f('0xc')](handleError(_0x4e376b,null));};exports[_0x824f('0x4c')]=function(_0x33b6b6,_0xdd1f05){return respondWithRpcPromise(_0x824f('0x4b'),_0x33b6b6[_0x824f('0x18')],routingClient)[_0x824f('0x7')](findById(_0x33b6b6[_0x824f('0x19')]['id']))[_0x824f('0x7')](respondWithResult(_0xdd1f05,null))[_0x824f('0xc')](handleError(_0xdd1f05,null));};exports[_0x824f('0x4d')]=function(_0x482926,_0x2c55cc){return respondWithRpcPromise(_0x824f('0x4e'),_0x482926[_0x824f('0x18')],routingClient)[_0x824f('0x7')](respondWithResult(_0x2c55cc,null))[_0x824f('0xc')](handleError(_0x2c55cc,null));};exports[_0x824f('0x4f')]=function(_0x7c8f56,_0x34eefe){return respondWithRpcPromise(_0x824f('0x4e'),_0x7c8f56[_0x824f('0x18')],routingClient)['then'](findById(_0x7c8f56[_0x824f('0x19')]['id']))['then'](respondWithResult(_0x34eefe,null))[_0x824f('0xc')](handleError(_0x34eefe,null));};exports[_0x824f('0x50')]=function(_0x1d6d97,_0x146881){return respondWithRpcPromise(_0x824f('0x51'),_0x1d6d97[_0x824f('0x18')],routingClient)[_0x824f('0x7')](respondWithResult(_0x146881,null))[_0x824f('0xc')](handleError(_0x146881,null));};exports['showFaxQueues']=function(_0x2fccdf,_0x5d3bb8){return respondWithRpcPromise('FaxQueues',_0x2fccdf['query'],routingClient)[_0x824f('0x7')](findById(_0x2fccdf['params']['id']))[_0x824f('0x7')](respondWithResult(_0x5d3bb8,null))[_0x824f('0xc')](handleError(_0x5d3bb8,null));};exports[_0x824f('0x52')]=function(_0x4f5c18,_0x194b2e){return respondWithRpcPromise(_0x824f('0x53'),_0x4f5c18[_0x824f('0x18')])[_0x824f('0x7')](respondWithResult(_0x194b2e,null))[_0x824f('0xc')](handleError(_0x194b2e,null));};exports[_0x824f('0x54')]=function(_0x5e9440,_0x34946c){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x5e9440[_0x824f('0x18')],routingClient)['then'](respondWithResult(_0x34946c,null))[_0x824f('0xc')](handleError(_0x34946c,null));};exports[_0x824f('0x55')]=function(_0x1fbd3d,_0x3820f3){return respondWithRpcPromise(_0x824f('0x56'),_0x1fbd3d[_0x824f('0x18')],routingClient)['then'](respondWithResult(_0x3820f3,null))['catch'](handleError(_0x3820f3,null));};exports[_0x824f('0x57')]=function(_0xeee4d2,_0x1451e5){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0xeee4d2[_0x824f('0x18')],routingClient)['then'](respondWithResult(_0x1451e5,null))[_0x824f('0xc')](handleError(_0x1451e5,null));};exports[_0x824f('0x58')]=function(_0xb1b5e9,_0x2146da){return respondWithRpcPromise(_0x824f('0x59'),_0xb1b5e9[_0x824f('0x18')],routingClient)[_0x824f('0x7')](respondWithResult(_0x2146da,null))[_0x824f('0xc')](handleError(_0x2146da,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x5347a8,_0xf121ce){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x5347a8[_0x824f('0x18')],routingClient)[_0x824f('0x7')](respondWithResult(_0xf121ce,null))['catch'](handleError(_0xf121ce,null));};exports[_0x824f('0x5a')]=function(_0x1a6778,_0x1832ab){return respondWithRpcPromise(_0x824f('0x5b'),_0x1a6778[_0x824f('0x18')],routingClient)[_0x824f('0x7')](respondWithResult(_0x1832ab,null))['catch'](handleError(_0x1832ab,null));};exports[_0x824f('0x5c')]=function(_0x2435f1){return function(_0x53f1ed,_0x526e27){var _0x375b7c,_0x29bf44;var _0x5aadb5=_[_0x824f('0x5d')](_0x2435f1);var _0x549ab7=_0x2435f1===_0x824f('0x5e')?'Website':_0x824f('0x5f');return db[_0x5aadb5+_0x824f('0x60')][_0x824f('0x61')]({'raw':!![],'where':{'id':_0x53f1ed[_0x824f('0x19')]['id']}})[_0x824f('0x7')](function(_0x2bbc70){if(_[_0x824f('0x12')](_0x2bbc70)){throw new Error(_0x5aadb5+_0x824f('0x62'));}_0x375b7c=_0x2bbc70;return db[_0x5aadb5+'Message'][_0x824f('0x61')]({'where':{'id':_0x53f1ed[_0x824f('0x2c')]['messageId']},'include':[{'model':db[_0x5aadb5+'Interaction'],'as':_0x824f('0x63')},{'model':db[_0x5aadb5+_0x549ab7],'as':_0x824f('0x5f')}]});})[_0x824f('0x7')](function(_0x152cdb){if(_[_0x824f('0x12')](_0x152cdb)){throw new Error(_0x5aadb5+_0x824f('0x64'));}_0x29bf44=_0x152cdb;return _0x152cdb[_0x824f('0x65')]({'read':0x0,'readAt':null,'UserId':null});})[_0x824f('0x7')](function(){var _0x567135={'uniqueid':_0x2435f1+'.'+_0x29bf44['id']+'.'+_0x29bf44[_0x824f('0x63')]['id'],'FromUserId':_0x53f1ed['user']['id'],'type':_0x824f('0x66')};_0x567135[_0x5aadb5+_0x824f('0x67')]=_0x29bf44['id'];_0x567135[_0x5aadb5+'InteractionId']=_0x29bf44[_0x824f('0x63')]['id'];_0x567135['From'+_0x5aadb5+_0x549ab7+'Id']=_0x29bf44['Account']['id'];_0x567135['To'+_0x5aadb5+_0x824f('0x68')]=_0x375b7c['id'];return db[_0x5aadb5+_0x824f('0x69')][_0x824f('0x6a')](_0x567135);})[_0x824f('0x7')](function(){return respondWithRpcPromise('Start',{'channel':_0x2435f1,'interaction':_0x29bf44['Interaction'],'message':_0x29bf44,'account':_0x29bf44[_0x824f('0x5f')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x375b7c[_0x824f('0x10')]+','+(_0x29bf44['Account'][_0x824f('0x6b')]||0x12c),'interval':_0x824f('0x6c')}]},routingClient);})[_0x824f('0x7')](respondWithResult(_0x526e27,null))[_0x824f('0xc')](handleError(_0x526e27,null));};};exports[_0x824f('0x6d')]=function(_0x38be60,_0x2db43e){var _0x42b0cd,_0x5b4ee8;if(_['isNil'](_0x38be60[_0x824f('0x2c')][_0x824f('0x6e')])){throw new Error(_0x824f('0x6f'));}var _0x2dd34f=_0x38be60[_0x824f('0x2c')][_0x824f('0x6e')];var _0x339d67=_['capitalize'](_0x2dd34f);var _0x558efe=_0x2dd34f===_0x824f('0x5e')?_0x824f('0x70'):'Account';return db[_0x824f('0x71')][_0x824f('0x61')]({'raw':!![],'where':{'id':_0x38be60['params']['id'],'role':_0x824f('0x3a')}})['then'](function(_0x3158ea){if(_['isNil'](_0x3158ea)){throw new Error(_0x824f('0x72'));}_0x42b0cd=_0x3158ea;return db[_0x339d67+_0x824f('0x73')]['findOne']({'where':{'id':_0x38be60[_0x824f('0x2c')][_0x824f('0x74')]},'include':[{'model':db[_0x339d67+_0x824f('0x63')],'as':'Interaction'},{'model':db[_0x339d67+_0x558efe],'as':_0x824f('0x5f')}]});})[_0x824f('0x7')](function(_0x3139df){if(_[_0x824f('0x12')](_0x3139df)){throw new Error(_0x339d67+'\x20Message\x20not\x20found');}_0x5b4ee8=_0x3139df;return _0x3139df[_0x824f('0x65')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x1a4be0={'uniqueid':_0x2dd34f+'.'+_0x5b4ee8['id']+'.'+_0x5b4ee8[_0x824f('0x63')]['id'],'FromUserId':_0x38be60[_0x824f('0x2e')]['id'],'type':'queue','ToUserId':_0x42b0cd['id']};_0x1a4be0[_0x339d67+_0x824f('0x67')]=_0x5b4ee8['id'];_0x1a4be0[_0x339d67+'InteractionId']=_0x5b4ee8[_0x824f('0x63')]['id'];_0x1a4be0[_0x824f('0x75')+_0x339d67+_0x558efe+'Id']=_0x5b4ee8[_0x824f('0x5f')]['id'];return db[_0x339d67+_0x824f('0x69')][_0x824f('0x6a')](_0x1a4be0);})[_0x824f('0x7')](function(){return respondWithRpcPromise(_0x824f('0x76'),{'channel':_0x2dd34f,'interaction':_0x5b4ee8['Interaction'],'message':_0x5b4ee8,'account':_0x5b4ee8[_0x824f('0x5f')],'applications':[{'id':0x0,'priority':0x1,'app':_0x824f('0x3a'),'appdata':_0x42b0cd['name']+','+(_0x5b4ee8[_0x824f('0x5f')][_0x824f('0x77')]||0x12c),'interval':_0x824f('0x6c')}]},routingClient);})[_0x824f('0x7')](respondWithResult(_0x2db43e,null))[_0x824f('0xc')](handleError(_0x2db43e,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 0b399a1..0520911 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 _0x27cd=['/:id','multer','util','express','Router','get','isAuthenticated','index','show','/:id/run','run','post','create','put','update'];(function(_0x28be64,_0x48c7c5){var _0x3d92ec=function(_0x4c8a1a){while(--_0x4c8a1a){_0x28be64['push'](_0x28be64['shift']());}};_0x3d92ec(++_0x48c7c5);}(_0x27cd,0x100));var _0xd27c=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x27cd[_0x525c7b];return _0x27b33e;};'use strict';var multer=require(_0xd27c('0x0'));var util=require(_0xd27c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd27c('0x2'));var router=express[_0xd27c('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./schedule.controller');router[_0xd27c('0x4')]('/',auth[_0xd27c('0x5')](),controller[_0xd27c('0x6')]);router[_0xd27c('0x4')]('/:id',auth[_0xd27c('0x5')](),controller[_0xd27c('0x7')]);router[_0xd27c('0x4')](_0xd27c('0x8'),auth['isAuthenticated'](),controller[_0xd27c('0x9')]);router[_0xd27c('0xa')]('/',auth['isAuthenticated'](),controller[_0xd27c('0xb')]);router[_0xd27c('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xd27c('0xd')]);router['delete'](_0xd27c('0xe'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xda9d=['/:id/run','run','create','/:id','destroy','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','index','get','isAuthenticated','show'];(function(_0x13519f,_0x1f4223){var _0x10b558=function(_0x1908e7){while(--_0x1908e7){_0x13519f['push'](_0x13519f['shift']());}};_0x10b558(++_0x1f4223);}(_0xda9d,0x1f4));var _0xdda9=function(_0x57b236,_0x30614e){_0x57b236=_0x57b236-0x0;var _0x4feb29=_0xda9d[_0x57b236];return _0x4feb29;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xdda9('0x0'));var express=require(_0xdda9('0x1'));var router=express['Router']();var auth=require(_0xdda9('0x2'));var interaction=require(_0xdda9('0x3'));var config=require(_0xdda9('0x4'));var controller=require(_0xdda9('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xdda9('0x6')]);router[_0xdda9('0x7')]('/:id',auth[_0xdda9('0x8')](),controller[_0xdda9('0x9')]);router[_0xdda9('0x7')](_0xdda9('0xa'),auth[_0xdda9('0x8')](),controller[_0xdda9('0xb')]);router['post']('/',auth[_0xdda9('0x8')](),controller[_0xdda9('0xc')]);router['put'](_0xdda9('0xd'),auth[_0xdda9('0x8')](),controller['update']);router['delete'](_0xdda9('0xd'),auth[_0xdda9('0x8')](),controller[_0xdda9('0xe')]);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 df14a24..3f815b6 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 _0xfdbd=['default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','ENUM','quarters','months','minutes','days','csv','pdf','xlsx','custom'];(function(_0x16eef6,_0x57479d){var _0x1f0285=function(_0x2e07a6){while(--_0x2e07a6){_0x16eef6['push'](_0x16eef6['shift']());}};_0x1f0285(++_0x57479d);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x43d16c,_0x2b5447){_0x43d16c=_0x43d16c-0x0;var _0x208cce=_0xfdbd[_0x43d16c];return _0x208cce;};'use strict';var Sequelize=require(_0xdfdb('0x0'));module[_0xdfdb('0x1')]={'name':{'type':Sequelize[_0xdfdb('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xdfdb('0x2')]},'active':{'type':Sequelize[_0xdfdb('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xdfdb('0x2')],'allowNull':![],'defaultValue':_0xdfdb('0x4')},'startAt':{'type':Sequelize[_0xdfdb('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0xdfdb('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xdfdb('0x6')]('years',_0xdfdb('0x7'),_0xdfdb('0x8'),'weeks','days','hours',_0xdfdb('0x9')),'allowNull':![],'defaultValue':_0xdfdb('0xa')},'output':{'type':Sequelize['ENUM'](_0xdfdb('0xb'),_0xdfdb('0xc'),_0xdfdb('0xd')),'allowNull':![],'defaultValue':_0xdfdb('0xb')},'type':{'type':Sequelize[_0xdfdb('0x6')](_0xdfdb('0xe'),_0xdfdb('0xf')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0xdfdb('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xdfdb('0x2')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0xdfdb('0x10')]},'sendIfEmpty':{'type':Sequelize[_0xdfdb('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x6363=['months','weeks','days','minutes','csv','pdf','xlsx','custom','default','TEXT','sequelize','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters'];(function(_0x3e23f8,_0x46ebfc){var _0x4c08f0=function(_0x564281){while(--_0x564281){_0x3e23f8['push'](_0x3e23f8['shift']());}};_0x4c08f0(++_0x46ebfc);}(_0x6363,0x13a));var _0x3636=function(_0x2e117d,_0xd9aaa1){_0x2e117d=_0x2e117d-0x0;var _0x1a6975=_0x6363[_0x2e117d];return _0x1a6975;};'use strict';var Sequelize=require(_0x3636('0x0'));module['exports']={'name':{'type':Sequelize[_0x3636('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x3636('0x1')]},'active':{'type':Sequelize[_0x3636('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x3636('0x1')],'allowNull':![],'defaultValue':_0x3636('0x3')},'startAt':{'type':Sequelize[_0x3636('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x3636('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x3636('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x3636('0x6')](_0x3636('0x7'),_0x3636('0x8'),_0x3636('0x9'),_0x3636('0xa'),_0x3636('0xb'),'hours',_0x3636('0xc')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0x3636('0x6')](_0x3636('0xd'),_0x3636('0xe'),_0x3636('0xf')),'allowNull':![],'defaultValue':_0x3636('0xd')},'type':{'type':Sequelize[_0x3636('0x6')](_0x3636('0x10'),_0x3636('0x11')),'allowNull':![],'defaultValue':_0x3636('0x10')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x3636('0x12')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x3636('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index f9520b0..e0224d7 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 _0xf23d=['key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','Schedule','findAll','show','length','includeAll','include','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Scheduler','UserProfileResource','end','name','send','index','rawAttributes','fieldName','type'];(function(_0x4446d3,_0x405295){var _0x3bec74=function(_0x54ceee){while(--_0x54ceee){_0x4446d3['push'](_0x4446d3['shift']());}};_0x3bec74(++_0x405295);}(_0xf23d,0xcc));var _0xdf23=function(_0x352e09,_0x37a7da){_0x352e09=_0x352e09-0x0;var _0x1b7094=_0xf23d[_0x352e09];return _0x1b7094;};'use strict';var pdf=require(_0xdf23('0x0'));var emlformat=require(_0xdf23('0x1'));var rimraf=require(_0xdf23('0x2'));var zipdir=require(_0xdf23('0x3'));var jsonpatch=require(_0xdf23('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdf23('0x5'));var Mustache=require('mustache');var util=require(_0xdf23('0x6'));var path=require(_0xdf23('0x7'));var sox=require(_0xdf23('0x8'));var csv=require(_0xdf23('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdf23('0xa'));var squel=require(_0xdf23('0xb'));var crypto=require(_0xdf23('0xc'));var jsforce=require(_0xdf23('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xdf23('0x9'));var querystring=require(_0xdf23('0xe'));var Papa=require(_0xdf23('0xf'));var Redis=require(_0xdf23('0x10'));var authService=require(_0xdf23('0x11'));var qs=require(_0xdf23('0x12'));var as=require(_0xdf23('0x13'));var hardwareService=require(_0xdf23('0x14'));var logger=require(_0xdf23('0x15'))(_0xdf23('0x16'));var utils=require(_0xdf23('0x17'));var config=require(_0xdf23('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28230b,_0x7f426b){_0x7f426b=_0x7f426b||0xcc;return function(_0x3c5ea1){if(_0x3c5ea1){return _0x28230b[_0xdf23('0x19')](_0x7f426b);}return _0x28230b[_0xdf23('0x1a')](_0x7f426b)['end']();};}function respondWithResult(_0x3967c4,_0x58b64d){_0x58b64d=_0x58b64d||0xc8;return function(_0x416b1a){if(_0x416b1a){return _0x3967c4[_0xdf23('0x1a')](_0x58b64d)['json'](_0x416b1a);}};}function respondWithFilteredResult(_0x301ebf,_0x590be5){return function(_0x5bd873){if(_0x5bd873){var _0x4006ad=_0x5bd873[_0xdf23('0x1b')],_0x2c8977=_0x590be5[_0xdf23('0x1c')],_0x349899=_0x590be5[_0xdf23('0x1c')]+_0x590be5['limit'],_0x5a0b22;if(_0x349899>=_0x4006ad){_0x349899=_0x4006ad;_0x5a0b22=0xc8;}else{_0x5a0b22=0xce;}_0x301ebf[_0xdf23('0x1a')](_0x5a0b22);return _0x301ebf[_0xdf23('0x1d')](_0xdf23('0x1e'),_0x2c8977+'-'+_0x349899+'/'+_0x4006ad)[_0xdf23('0x1f')](_0x5bd873);}return null;};}function patchUpdates(_0x42ffa0){return function(_0x17f289){try{jsonpatch[_0xdf23('0x20')](_0x17f289,_0x42ffa0,!![]);}catch(_0x3c35ce){return BPromise[_0xdf23('0x21')](_0x3c35ce);}return _0x17f289[_0xdf23('0x22')]();};}function saveUpdates(_0x967698,_0x2401bf){return function(_0x4e9038){if(_0x4e9038){return _0x4e9038[_0xdf23('0x23')](_0x967698)[_0xdf23('0x24')](function(_0x280640){return _0x280640;});}return null;};}function removeEntity(_0x38c063,_0x10b5f5){return function(_0x4de31b){if(_0x4de31b){return _0x4de31b[_0xdf23('0x25')]()['then'](function(){var _0x2a397b=_0x4de31b[_0xdf23('0x26')]({'plain':!![]});var _0x188e7a=_0xdf23('0x27');return db[_0xdf23('0x28')]['destroy']({'where':{'type':_0x188e7a,'resourceId':_0x2a397b['id']}})[_0xdf23('0x24')](function(){return _0x4de31b;});})[_0xdf23('0x24')](function(){_0x38c063['status'](0xcc)[_0xdf23('0x29')]();});}};}function handleEntityNotFound(_0x50063a,_0x35b31a){return function(_0x32b5d2){if(!_0x32b5d2){_0x50063a[_0xdf23('0x19')](0x194);}return _0x32b5d2;};}function handleError(_0xb26699,_0x119503){_0x119503=_0x119503||0x1f4;return function(_0x2d1a92){logger['error'](_0x2d1a92['stack']);if(_0x2d1a92[_0xdf23('0x2a')]){delete _0x2d1a92[_0xdf23('0x2a')];}_0xb26699['status'](_0x119503)[_0xdf23('0x2b')](_0x2d1a92);};}exports[_0xdf23('0x2c')]=function(_0x3a7340,_0x5b54a9){var _0x16903d={},_0x3ee542={},_0x195b9c={'count':0x0,'rows':[]};var _0x3e8a8f=_['map'](db['Schedule'][_0xdf23('0x2d')],function(_0x21b35a){return{'name':_0x21b35a[_0xdf23('0x2e')],'type':_0x21b35a[_0xdf23('0x2f')][_0xdf23('0x30')]};});_0x3ee542[_0xdf23('0x31')]=_[_0xdf23('0x32')](_0x3e8a8f,'name');_0x3ee542[_0xdf23('0x33')]=_[_0xdf23('0x34')](_0x3a7340[_0xdf23('0x33')]);_0x3ee542[_0xdf23('0x35')]=_['intersection'](_0x3ee542['model'],_0x3ee542['query']);_0x16903d['attributes']=_[_0xdf23('0x36')](_0x3ee542[_0xdf23('0x31')],qs['fields'](_0x3a7340[_0xdf23('0x33')][_0xdf23('0x37')]));_0x16903d['attributes']=_0x16903d[_0xdf23('0x38')]['length']?_0x16903d['attributes']:_0x3ee542[_0xdf23('0x31')];if(!_0x3a7340['query'][_0xdf23('0x39')]('nolimit')){_0x16903d['limit']=qs['limit'](_0x3a7340[_0xdf23('0x33')]['limit']);_0x16903d[_0xdf23('0x1c')]=qs[_0xdf23('0x1c')](_0x3a7340[_0xdf23('0x33')]['offset']);}_0x16903d['order']=qs[_0xdf23('0x3a')](_0x3a7340[_0xdf23('0x33')]['sort']);_0x16903d[_0xdf23('0x3b')]=qs['filters'](_['pick'](_0x3a7340[_0xdf23('0x33')],_0x3ee542['filters']),_0x3e8a8f);if(_0x3a7340[_0xdf23('0x33')][_0xdf23('0x3c')]){_0x16903d['where']=_[_0xdf23('0x3d')](_0x16903d['where'],{'$or':_[_0xdf23('0x32')](_0x3e8a8f,function(_0x476d1b){if(_0x476d1b[_0xdf23('0x2f')]!==_0xdf23('0x3e')){var _0xab7dc8={};_0xab7dc8[_0x476d1b['name']]={'$like':'%'+_0x3a7340[_0xdf23('0x33')][_0xdf23('0x3c')]+'%'};return _0xab7dc8;}})});}_0x16903d=_[_0xdf23('0x3d')]({},_0x16903d,_0x3a7340[_0xdf23('0x3f')]);var _0x4d29a7={'where':_0x16903d[_0xdf23('0x3b')]};return db[_0xdf23('0x40')]['count'](_0x4d29a7)[_0xdf23('0x24')](function(_0x4fdda1){_0x195b9c['count']=_0x4fdda1;if(_0x3a7340['query']['includeAll']){_0x16903d['include']=[{'all':!![]}];}return db[_0xdf23('0x40')][_0xdf23('0x41')](_0x16903d);})[_0xdf23('0x24')](function(_0x32f26d){_0x195b9c['rows']=_0x32f26d;return _0x195b9c;})[_0xdf23('0x24')](respondWithFilteredResult(_0x5b54a9,_0x16903d))['catch'](handleError(_0x5b54a9,null));};exports[_0xdf23('0x42')]=function(_0x3dd7f6,_0x19bfd1){var _0x23ff57={'raw':![],'where':{'id':_0x3dd7f6['params']['id']}},_0x51909a={};_0x51909a['model']=_[_0xdf23('0x34')](db[_0xdf23('0x40')]['rawAttributes']);_0x51909a[_0xdf23('0x33')]=_[_0xdf23('0x34')](_0x3dd7f6[_0xdf23('0x33')]);_0x51909a[_0xdf23('0x35')]=_[_0xdf23('0x36')](_0x51909a[_0xdf23('0x31')],_0x51909a[_0xdf23('0x33')]);_0x23ff57[_0xdf23('0x38')]=_[_0xdf23('0x36')](_0x51909a[_0xdf23('0x31')],qs[_0xdf23('0x37')](_0x3dd7f6[_0xdf23('0x33')][_0xdf23('0x37')]));_0x23ff57['attributes']=_0x23ff57['attributes'][_0xdf23('0x43')]?_0x23ff57[_0xdf23('0x38')]:_0x51909a[_0xdf23('0x31')];if(_0x3dd7f6['query'][_0xdf23('0x44')]){_0x23ff57[_0xdf23('0x45')]=[{'all':!![]}];}_0x23ff57=_[_0xdf23('0x3d')]({},_0x23ff57,_0x3dd7f6[_0xdf23('0x3f')]);return db[_0xdf23('0x40')]['find'](_0x23ff57)['then'](handleEntityNotFound(_0x19bfd1,null))['then'](respondWithResult(_0x19bfd1,null))['catch'](handleError(_0x19bfd1,null));};exports['create']=function(_0x2bc70c,_0x30ec51){return db[_0xdf23('0x40')][_0xdf23('0x46')](_0x2bc70c[_0xdf23('0x47')],{})[_0xdf23('0x24')](function(_0x43c44a){var _0xc210c9=_0x2bc70c[_0xdf23('0x48')]['get']({'plain':!![]});if(!_0xc210c9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xc210c9[_0xdf23('0x49')]===_0xdf23('0x48')){var _0x200e00=_0x43c44a[_0xdf23('0x26')]({'plain':!![]});var _0x49f263=_0xdf23('0x27');return db[_0xdf23('0x4a')][_0xdf23('0x4b')]({'where':{'name':_0x49f263,'userProfileId':_0xc210c9[_0xdf23('0x4c')]},'raw':!![]})[_0xdf23('0x24')](function(_0x37192c){if(_0x37192c&&_0x37192c[_0xdf23('0x4d')]===0x0){return db[_0xdf23('0x28')][_0xdf23('0x46')]({'name':_0x200e00[_0xdf23('0x2a')],'resourceId':_0x200e00['id'],'type':_0x37192c[_0xdf23('0x2a')],'sectionId':_0x37192c['id']},{})[_0xdf23('0x24')](function(){return _0x43c44a;});}else{return _0x43c44a;}})[_0xdf23('0x4e')](function(_0x10532d){logger[_0xdf23('0x4f')](_0xdf23('0x50'),_0x10532d);throw _0x10532d;});}return _0x43c44a;})[_0xdf23('0x24')](respondWithResult(_0x30ec51,0xc9))[_0xdf23('0x4e')](handleError(_0x30ec51,null));};exports[_0xdf23('0x23')]=function(_0x40125d,_0x186f97){if(_0x40125d[_0xdf23('0x47')]['id']){delete _0x40125d[_0xdf23('0x47')]['id'];}return db[_0xdf23('0x40')][_0xdf23('0x4b')]({'where':{'id':_0x40125d['params']['id']}})[_0xdf23('0x24')](handleEntityNotFound(_0x186f97,null))[_0xdf23('0x24')](saveUpdates(_0x40125d[_0xdf23('0x47')],null))['then'](respondWithResult(_0x186f97,null))[_0xdf23('0x4e')](handleError(_0x186f97,null));};exports[_0xdf23('0x25')]=function(_0x4cd9ec,_0x47b8c){return db['Schedule']['find']({'where':{'id':_0x4cd9ec['params']['id']}})['then'](handleEntityNotFound(_0x47b8c,null))['then'](removeEntity(_0x47b8c,null))['catch'](handleError(_0x47b8c,null));};exports[_0xdf23('0x51')]=function(_0x5c690a,_0x1c44c2,_0x5815c2){var _0x1c9be0=require(_0xdf23('0x52'));return db[_0xdf23('0x40')][_0xdf23('0x4b')]({'where':{'id':_0x5c690a[_0xdf23('0x53')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x1c44c2,null))[_0xdf23('0x24')](function(){_0x1c9be0['run'](_0x5c690a[_0xdf23('0x53')]['id']);})[_0xdf23('0x24')](respondWithStatusCode(_0x1c44c2,null))[_0xdf23('0x4e')](handleError(_0x1c44c2,null));}; \ No newline at end of file +var _0xe9eb=['show','params','keys','catch','create','body','user','role','find','autoAssociation','UserProfileResource','../../config/schedule','run','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Scheduler','error','stack','name','send','index','Schedule','rawAttributes','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','options','includeAll','include','findAll'];(function(_0x52500e,_0x3d5462){var _0x4e4e43=function(_0x2ee6d7){while(--_0x2ee6d7){_0x52500e['push'](_0x52500e['shift']());}};_0x4e4e43(++_0x3d5462);}(_0xe9eb,0x1cf));var _0xbe9e=function(_0x138b0f,_0x3dec5f){_0x138b0f=_0x138b0f-0x0;var _0x31e2f5=_0xe9eb[_0x138b0f];return _0x31e2f5;};'use strict';var pdf=require(_0xbe9e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbe9e('0x1'));var zipdir=require(_0xbe9e('0x2'));var jsonpatch=require(_0xbe9e('0x3'));var rp=require(_0xbe9e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbe9e('0x5'));var util=require(_0xbe9e('0x6'));var path=require(_0xbe9e('0x7'));var sox=require(_0xbe9e('0x8'));var csv=require(_0xbe9e('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbe9e('0xa'));var deskjs=require(_0xbe9e('0xb'));var toCsv=require(_0xbe9e('0x9'));var querystring=require('querystring');var Papa=require(_0xbe9e('0xc'));var Redis=require(_0xbe9e('0xd'));var authService=require(_0xbe9e('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xbe9e('0xf'));var config=require(_0xbe9e('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc33aaa,_0x337721){_0x337721=_0x337721||0xcc;return function(_0x298885){if(_0x298885){return _0xc33aaa[_0xbe9e('0x11')](_0x337721);}return _0xc33aaa[_0xbe9e('0x12')](_0x337721)[_0xbe9e('0x13')]();};}function respondWithResult(_0x55bbec,_0x403738){_0x403738=_0x403738||0xc8;return function(_0x3f8e46){if(_0x3f8e46){return _0x55bbec[_0xbe9e('0x12')](_0x403738)[_0xbe9e('0x14')](_0x3f8e46);}};}function respondWithFilteredResult(_0x84c602,_0x1e9479){return function(_0x1a558b){if(_0x1a558b){var _0x4f03e6=_0x1a558b[_0xbe9e('0x15')],_0x2b030f=_0x1e9479[_0xbe9e('0x16')],_0x512a7f=_0x1e9479[_0xbe9e('0x16')]+_0x1e9479[_0xbe9e('0x17')],_0x3c960d;if(_0x512a7f>=_0x4f03e6){_0x512a7f=_0x4f03e6;_0x3c960d=0xc8;}else{_0x3c960d=0xce;}_0x84c602['status'](_0x3c960d);return _0x84c602[_0xbe9e('0x18')](_0xbe9e('0x19'),_0x2b030f+'-'+_0x512a7f+'/'+_0x4f03e6)[_0xbe9e('0x14')](_0x1a558b);}return null;};}function patchUpdates(_0x152faa){return function(_0x51d1ad){try{jsonpatch[_0xbe9e('0x1a')](_0x51d1ad,_0x152faa,!![]);}catch(_0x2bd596){return BPromise[_0xbe9e('0x1b')](_0x2bd596);}return _0x51d1ad[_0xbe9e('0x1c')]();};}function saveUpdates(_0x566a50,_0x48910d){return function(_0x133a2a){if(_0x133a2a){return _0x133a2a[_0xbe9e('0x1d')](_0x566a50)[_0xbe9e('0x1e')](function(_0x44617c){return _0x44617c;});}return null;};}function removeEntity(_0x75019d,_0x2a1d2e){return function(_0x52abab){if(_0x52abab){return _0x52abab[_0xbe9e('0x1f')]()[_0xbe9e('0x1e')](function(){var _0x3586f8=_0x52abab[_0xbe9e('0x20')]({'plain':!![]});var _0x18fca8=_0xbe9e('0x21');return db['UserProfileResource'][_0xbe9e('0x1f')]({'where':{'type':_0x18fca8,'resourceId':_0x3586f8['id']}})[_0xbe9e('0x1e')](function(){return _0x52abab;});})[_0xbe9e('0x1e')](function(){_0x75019d[_0xbe9e('0x12')](0xcc)[_0xbe9e('0x13')]();});}};}function handleEntityNotFound(_0x16c1aa,_0x49680d){return function(_0xcac67d){if(!_0xcac67d){_0x16c1aa[_0xbe9e('0x11')](0x194);}return _0xcac67d;};}function handleError(_0x3d2a25,_0x1d48df){_0x1d48df=_0x1d48df||0x1f4;return function(_0x4bc203){logger[_0xbe9e('0x22')](_0x4bc203[_0xbe9e('0x23')]);if(_0x4bc203[_0xbe9e('0x24')]){delete _0x4bc203['name'];}_0x3d2a25[_0xbe9e('0x12')](_0x1d48df)[_0xbe9e('0x25')](_0x4bc203);};}exports[_0xbe9e('0x26')]=function(_0xef686f,_0x4611a2){var _0x11377d={},_0xb0447e={},_0x4f5124={'count':0x0,'rows':[]};var _0x314a4b=_['map'](db[_0xbe9e('0x27')][_0xbe9e('0x28')],function(_0x1fe0a4){return{'name':_0x1fe0a4['fieldName'],'type':_0x1fe0a4['type'][_0xbe9e('0x29')]};});_0xb0447e[_0xbe9e('0x2a')]=_['map'](_0x314a4b,_0xbe9e('0x24'));_0xb0447e[_0xbe9e('0x2b')]=_['keys'](_0xef686f[_0xbe9e('0x2b')]);_0xb0447e['filters']=_[_0xbe9e('0x2c')](_0xb0447e['model'],_0xb0447e[_0xbe9e('0x2b')]);_0x11377d[_0xbe9e('0x2d')]=_[_0xbe9e('0x2c')](_0xb0447e[_0xbe9e('0x2a')],qs['fields'](_0xef686f[_0xbe9e('0x2b')][_0xbe9e('0x2e')]));_0x11377d[_0xbe9e('0x2d')]=_0x11377d[_0xbe9e('0x2d')][_0xbe9e('0x2f')]?_0x11377d[_0xbe9e('0x2d')]:_0xb0447e[_0xbe9e('0x2a')];if(!_0xef686f[_0xbe9e('0x2b')][_0xbe9e('0x30')](_0xbe9e('0x31'))){_0x11377d[_0xbe9e('0x17')]=qs[_0xbe9e('0x17')](_0xef686f['query'][_0xbe9e('0x17')]);_0x11377d['offset']=qs[_0xbe9e('0x16')](_0xef686f[_0xbe9e('0x2b')][_0xbe9e('0x16')]);}_0x11377d[_0xbe9e('0x32')]=qs[_0xbe9e('0x33')](_0xef686f[_0xbe9e('0x2b')][_0xbe9e('0x33')]);_0x11377d[_0xbe9e('0x34')]=qs['filters'](_[_0xbe9e('0x35')](_0xef686f[_0xbe9e('0x2b')],_0xb0447e[_0xbe9e('0x36')]),_0x314a4b);if(_0xef686f[_0xbe9e('0x2b')][_0xbe9e('0x37')]){_0x11377d[_0xbe9e('0x34')]=_[_0xbe9e('0x38')](_0x11377d[_0xbe9e('0x34')],{'$or':_['map'](_0x314a4b,function(_0x146e26){if(_0x146e26[_0xbe9e('0x39')]!=='VIRTUAL'){var _0x37d92d={};_0x37d92d[_0x146e26[_0xbe9e('0x24')]]={'$like':'%'+_0xef686f[_0xbe9e('0x2b')][_0xbe9e('0x37')]+'%'};return _0x37d92d;}})});}_0x11377d=_[_0xbe9e('0x38')]({},_0x11377d,_0xef686f[_0xbe9e('0x3a')]);var _0xf9cb0={'where':_0x11377d[_0xbe9e('0x34')]};return db[_0xbe9e('0x27')][_0xbe9e('0x15')](_0xf9cb0)['then'](function(_0x2f9b41){_0x4f5124['count']=_0x2f9b41;if(_0xef686f[_0xbe9e('0x2b')][_0xbe9e('0x3b')]){_0x11377d[_0xbe9e('0x3c')]=[{'all':!![]}];}return db[_0xbe9e('0x27')][_0xbe9e('0x3d')](_0x11377d);})[_0xbe9e('0x1e')](function(_0x2289ff){_0x4f5124['rows']=_0x2289ff;return _0x4f5124;})['then'](respondWithFilteredResult(_0x4611a2,_0x11377d))['catch'](handleError(_0x4611a2,null));};exports[_0xbe9e('0x3e')]=function(_0x4f6b36,_0x21e49f){var _0x1dff2d={'raw':![],'where':{'id':_0x4f6b36[_0xbe9e('0x3f')]['id']}},_0x19feb={};_0x19feb[_0xbe9e('0x2a')]=_[_0xbe9e('0x40')](db[_0xbe9e('0x27')][_0xbe9e('0x28')]);_0x19feb[_0xbe9e('0x2b')]=_[_0xbe9e('0x40')](_0x4f6b36[_0xbe9e('0x2b')]);_0x19feb[_0xbe9e('0x36')]=_[_0xbe9e('0x2c')](_0x19feb[_0xbe9e('0x2a')],_0x19feb[_0xbe9e('0x2b')]);_0x1dff2d[_0xbe9e('0x2d')]=_[_0xbe9e('0x2c')](_0x19feb[_0xbe9e('0x2a')],qs['fields'](_0x4f6b36[_0xbe9e('0x2b')][_0xbe9e('0x2e')]));_0x1dff2d['attributes']=_0x1dff2d[_0xbe9e('0x2d')][_0xbe9e('0x2f')]?_0x1dff2d[_0xbe9e('0x2d')]:_0x19feb['model'];if(_0x4f6b36[_0xbe9e('0x2b')][_0xbe9e('0x3b')]){_0x1dff2d[_0xbe9e('0x3c')]=[{'all':!![]}];}_0x1dff2d=_['merge']({},_0x1dff2d,_0x4f6b36[_0xbe9e('0x3a')]);return db[_0xbe9e('0x27')]['find'](_0x1dff2d)['then'](handleEntityNotFound(_0x21e49f,null))[_0xbe9e('0x1e')](respondWithResult(_0x21e49f,null))[_0xbe9e('0x41')](handleError(_0x21e49f,null));};exports[_0xbe9e('0x42')]=function(_0x4709cf,_0x45040d){return db[_0xbe9e('0x27')][_0xbe9e('0x42')](_0x4709cf[_0xbe9e('0x43')],{})[_0xbe9e('0x1e')](function(_0x2f0402){var _0x4b899f=_0x4709cf[_0xbe9e('0x44')]['get']({'plain':!![]});if(!_0x4b899f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b899f[_0xbe9e('0x45')]===_0xbe9e('0x44')){var _0x143f67=_0x2f0402['get']({'plain':!![]});var _0x5c48b2=_0xbe9e('0x21');return db['UserProfileSection'][_0xbe9e('0x46')]({'where':{'name':_0x5c48b2,'userProfileId':_0x4b899f['userProfileId']},'raw':!![]})[_0xbe9e('0x1e')](function(_0x5b4a20){if(_0x5b4a20&&_0x5b4a20[_0xbe9e('0x47')]===0x0){return db[_0xbe9e('0x48')]['create']({'name':_0x143f67[_0xbe9e('0x24')],'resourceId':_0x143f67['id'],'type':_0x5b4a20[_0xbe9e('0x24')],'sectionId':_0x5b4a20['id']},{})[_0xbe9e('0x1e')](function(){return _0x2f0402;});}else{return _0x2f0402;}})[_0xbe9e('0x41')](function(_0x49be02){logger[_0xbe9e('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49be02);throw _0x49be02;});}return _0x2f0402;})[_0xbe9e('0x1e')](respondWithResult(_0x45040d,0xc9))[_0xbe9e('0x41')](handleError(_0x45040d,null));};exports[_0xbe9e('0x1d')]=function(_0x75694c,_0x5f202d){if(_0x75694c[_0xbe9e('0x43')]['id']){delete _0x75694c['body']['id'];}return db[_0xbe9e('0x27')][_0xbe9e('0x46')]({'where':{'id':_0x75694c[_0xbe9e('0x3f')]['id']}})[_0xbe9e('0x1e')](handleEntityNotFound(_0x5f202d,null))[_0xbe9e('0x1e')](saveUpdates(_0x75694c[_0xbe9e('0x43')],null))[_0xbe9e('0x1e')](respondWithResult(_0x5f202d,null))[_0xbe9e('0x41')](handleError(_0x5f202d,null));};exports[_0xbe9e('0x1f')]=function(_0x4d8dd5,_0x558bda){return db[_0xbe9e('0x27')][_0xbe9e('0x46')]({'where':{'id':_0x4d8dd5['params']['id']}})[_0xbe9e('0x1e')](handleEntityNotFound(_0x558bda,null))['then'](removeEntity(_0x558bda,null))[_0xbe9e('0x41')](handleError(_0x558bda,null));};exports['run']=function(_0x50c115,_0x46ade1,_0x2f70af){var _0x57027c=require(_0xbe9e('0x49'));return db[_0xbe9e('0x27')][_0xbe9e('0x46')]({'where':{'id':_0x50c115[_0xbe9e('0x3f')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x46ade1,null))['then'](function(){_0x57027c[_0xbe9e('0x4a')](_0x50c115['params']['id']);})[_0xbe9e('0x1e')](respondWithStatusCode(_0x46ade1,null))[_0xbe9e('0x41')](handleError(_0x46ade1,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index edc960c..9f1a8d3 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 _0x2709=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./schedule.attributes','exports','define','tools_schedules'];(function(_0x4f6883,_0x4c0061){var _0xe2ba1f=function(_0x5dd38b){while(--_0x5dd38b){_0x4f6883['push'](_0x4f6883['shift']());}};_0xe2ba1f(++_0x4c0061);}(_0x2709,0x78));var _0x9270=function(_0x33bdd8,_0x36fdac){_0x33bdd8=_0x33bdd8-0x0;var _0x337f78=_0x2709[_0x33bdd8];return _0x337f78;};'use strict';var _=require('lodash');var util=require(_0x9270('0x0'));var logger=require(_0x9270('0x1'))(_0x9270('0x2'));var moment=require(_0x9270('0x3'));var BPromise=require(_0x9270('0x4'));var rp=require(_0x9270('0x5'));var fs=require('fs');var path=require(_0x9270('0x6'));var rimraf=require('rimraf');var config=require(_0x9270('0x7'));var attributes=require(_0x9270('0x8'));module[_0x9270('0x9')]=function(_0x12e1db,_0x46b54b){return _0x12e1db[_0x9270('0xa')]('Schedule',attributes,{'tableName':_0x9270('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d98=['moment','bluebird','request-promise','rimraf','../../config/environment','./schedule.attributes','tools_schedules','lodash','util','../../config/logger'];(function(_0x2338f5,_0x1b6cc4){var _0x217d24=function(_0x41efc1){while(--_0x41efc1){_0x2338f5['push'](_0x2338f5['shift']());}};_0x217d24(++_0x1b6cc4);}(_0x2d98,0x6b));var _0x82d9=function(_0x36f531,_0x17ec32){_0x36f531=_0x36f531-0x0;var _0x4d3aa6=_0x2d98[_0x36f531];return _0x4d3aa6;};'use strict';var _=require(_0x82d9('0x0'));var util=require(_0x82d9('0x1'));var logger=require(_0x82d9('0x2'))('api');var moment=require(_0x82d9('0x3'));var BPromise=require(_0x82d9('0x4'));var rp=require(_0x82d9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x82d9('0x6'));var config=require(_0x82d9('0x7'));var attributes=require(_0x82d9('0x8'));module['exports']=function(_0x5eb424,_0xcde8e1){return _0x5eb424['define']('Schedule',attributes,{'tableName':_0x82d9('0x9'),'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 27a2b14..34bcfb5 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 _0x6b0e=['Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info'];(function(_0x43f489,_0x2b4fea){var _0x4134b4=function(_0x4365f6){while(--_0x4365f6){_0x43f489['push'](_0x43f489['shift']());}};_0x4134b4(++_0x2b4fea);}(_0x6b0e,0x141));var _0xe6b0=function(_0x514833,_0x4f691e){_0x514833=_0x514833-0x0;var _0x1879fb=_0x6b0e[_0x514833];return _0x1879fb;};'use strict';var _=require(_0xe6b0('0x0'));var util=require(_0xe6b0('0x1'));var moment=require(_0xe6b0('0x2'));var BPromise=require(_0xe6b0('0x3'));var rs=require(_0xe6b0('0x4'));var fs=require('fs');var Redis=require(_0xe6b0('0x5'));var db=require(_0xe6b0('0x6'))['db'];var utils=require(_0xe6b0('0x7'));var logger=require(_0xe6b0('0x8'))(_0xe6b0('0x9'));var config=require(_0xe6b0('0xa'));var jayson=require(_0xe6b0('0xb'));var client=jayson[_0xe6b0('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c5500,_0x26bfb9,_0x55d1c1){return new BPromise(function(_0x4fff4,_0x22d974){return client['request'](_0x1c5500,_0x55d1c1)[_0xe6b0('0xd')](function(_0x5937d7){logger[_0xe6b0('0xe')](_0xe6b0('0xf'),_0x26bfb9,_0xe6b0('0x10'));logger[_0xe6b0('0x11')](_0xe6b0('0x12'),_0x26bfb9,_0xe6b0('0x10'),JSON[_0xe6b0('0x13')](_0x5937d7));if(_0x5937d7[_0xe6b0('0x14')]){if(_0x5937d7[_0xe6b0('0x14')][_0xe6b0('0x15')]===0x1f4){logger[_0xe6b0('0x14')](_0xe6b0('0xf'),_0x26bfb9,_0x5937d7[_0xe6b0('0x14')][_0xe6b0('0x16')]);return _0x22d974(_0x5937d7[_0xe6b0('0x14')][_0xe6b0('0x16')]);}logger[_0xe6b0('0x14')]('Schedule,\x20%s,\x20%s',_0x26bfb9,_0x5937d7[_0xe6b0('0x14')][_0xe6b0('0x16')]);return _0x4fff4(_0x5937d7['error'][_0xe6b0('0x16')]);}else{logger[_0xe6b0('0xe')]('Schedule,\x20%s,\x20%s',_0x26bfb9,_0xe6b0('0x10'));_0x4fff4(_0x5937d7['result']['message']);}})[_0xe6b0('0x17')](function(_0x971561){logger[_0xe6b0('0x14')](_0xe6b0('0xf'),_0x26bfb9,_0x971561);_0x22d974(_0x971561);});});} \ No newline at end of file +var _0xb221=['code','message','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x598157,_0x24492e){var _0x5b5b04=function(_0x1b35f0){while(--_0x1b35f0){_0x598157['push'](_0x598157['shift']());}};_0x5b5b04(++_0x24492e);}(_0xb221,0x80));var _0x1b22=function(_0x5efd8f,_0xf1f28){_0x5efd8f=_0x5efd8f-0x0;var _0x3a669f=_0xb221[_0x5efd8f];return _0x3a669f;};'use strict';var _=require(_0x1b22('0x0'));var util=require(_0x1b22('0x1'));var moment=require(_0x1b22('0x2'));var BPromise=require(_0x1b22('0x3'));var rs=require(_0x1b22('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1b22('0x5'));var logger=require('../../config/logger')(_0x1b22('0x6'));var config=require(_0x1b22('0x7'));var jayson=require(_0x1b22('0x8'));var client=jayson[_0x1b22('0x9')][_0x1b22('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x280ed2,_0x53f923,_0xdc9aa7){return new BPromise(function(_0x421f93,_0x33b711){return client[_0x1b22('0xb')](_0x280ed2,_0xdc9aa7)[_0x1b22('0xc')](function(_0x1c6da3){logger[_0x1b22('0xd')](_0x1b22('0xe'),_0x53f923,'request\x20sent');logger[_0x1b22('0xf')]('Schedule,\x20%s,\x20%s,\x20%s',_0x53f923,_0x1b22('0x10'),JSON[_0x1b22('0x11')](_0x1c6da3));if(_0x1c6da3[_0x1b22('0x12')]){if(_0x1c6da3[_0x1b22('0x12')][_0x1b22('0x13')]===0x1f4){logger['error']('Schedule,\x20%s,\x20%s',_0x53f923,_0x1c6da3[_0x1b22('0x12')][_0x1b22('0x14')]);return _0x33b711(_0x1c6da3[_0x1b22('0x12')]['message']);}logger[_0x1b22('0x12')](_0x1b22('0xe'),_0x53f923,_0x1c6da3[_0x1b22('0x12')][_0x1b22('0x14')]);return _0x421f93(_0x1c6da3[_0x1b22('0x12')][_0x1b22('0x14')]);}else{logger[_0x1b22('0xd')](_0x1b22('0xe'),_0x53f923,_0x1b22('0x10'));_0x421f93(_0x1c6da3['result'][_0x1b22('0x14')]);}})['catch'](function(_0x180045){logger['error'](_0x1b22('0xe'),_0x53f923,_0x180045);_0x33b711(_0x180045);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index c2a0a17..3e1cead 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 _0x4198=['../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/download','download','create','put','destroy','exports','util','connect-timeout','../../components/auth/service'];(function(_0x164af1,_0x3cf772){var _0x5d81a2=function(_0xa57547){while(--_0xa57547){_0x164af1['push'](_0x164af1['shift']());}};_0x5d81a2(++_0x3cf772);}(_0x4198,0x75));var _0x8419=function(_0x2e6e75,_0x3843e4){_0x2e6e75=_0x2e6e75-0x0;var _0x3f8525=_0x4198[_0x2e6e75];return _0x3f8525;};'use strict';var multer=require('multer');var util=require(_0x8419('0x0'));var path=require('path');var timeout=require(_0x8419('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x8419('0x2'));var interaction=require(_0x8419('0x3'));var config=require('../../config/environment');var controller=require('./screenRecording.controller');router[_0x8419('0x4')]('/',auth[_0x8419('0x5')](),controller[_0x8419('0x6')]);router[_0x8419('0x4')]('/describe',auth[_0x8419('0x5')](),controller['describe']);router['get'](_0x8419('0x7'),auth[_0x8419('0x5')](),controller[_0x8419('0x8')]);router[_0x8419('0x4')](_0x8419('0x9'),auth[_0x8419('0x5')](),controller[_0x8419('0xa')]);router['post']('/',auth[_0x8419('0x5')](),controller[_0x8419('0xb')]);router[_0x8419('0xc')]('/:id',auth[_0x8419('0x5')](),controller['update']);router['delete'](_0x8419('0x7'),auth['isAuthenticated'](),controller[_0x8419('0xd')]);module[_0x8419('0xe')]=router; \ No newline at end of file +var _0x1ce1=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','download','post','create','put','update','destroy','multer','util','path','connect-timeout'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x1ce1,0x1ca));var _0x11ce=function(_0x7d1663,_0x57c494){_0x7d1663=_0x7d1663-0x0;var _0x327a5f=_0x1ce1[_0x7d1663];return _0x327a5f;};'use strict';var multer=require(_0x11ce('0x0'));var util=require(_0x11ce('0x1'));var path=require(_0x11ce('0x2'));var timeout=require(_0x11ce('0x3'));var express=require(_0x11ce('0x4'));var router=express[_0x11ce('0x5')]();var auth=require(_0x11ce('0x6'));var interaction=require(_0x11ce('0x7'));var config=require(_0x11ce('0x8'));var controller=require(_0x11ce('0x9'));router[_0x11ce('0xa')]('/',auth[_0x11ce('0xb')](),controller[_0x11ce('0xc')]);router['get'](_0x11ce('0xd'),auth['isAuthenticated'](),controller[_0x11ce('0xe')]);router[_0x11ce('0xa')](_0x11ce('0xf'),auth[_0x11ce('0xb')](),controller['show']);router[_0x11ce('0xa')]('/:id/download',auth[_0x11ce('0xb')](),controller[_0x11ce('0x10')]);router[_0x11ce('0x11')]('/',auth['isAuthenticated'](),controller[_0x11ce('0x12')]);router[_0x11ce('0x13')](_0x11ce('0xf'),auth['isAuthenticated'](),controller[_0x11ce('0x14')]);router['delete']('/:id',auth[_0x11ce('0xb')](),controller[_0x11ce('0x15')]);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 9be104b..e85c64a 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 _0xf2ca=['format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','moment','path','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','DATE'];(function(_0x1d27b1,_0x582136){var _0x45198b=function(_0x4819f4){while(--_0x4819f4){_0x1d27b1['push'](_0x1d27b1['shift']());}};_0x45198b(++_0x582136);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x4cd690,_0x4797cc){_0x4cd690=_0x4cd690-0x0;var _0x4a74a9=_0xf2ca[_0x4cd690];return _0x4a74a9;};'use strict';var Sequelize=require(_0xaf2c('0x0'));var moment=require(_0xaf2c('0x1'));var path=require(_0xaf2c('0x2'));var config=require('../../config/environment');module[_0xaf2c('0x3')]={'format':{'type':Sequelize[_0xaf2c('0x4')],'get':function(){return this[_0xaf2c('0x5')](_0xaf2c('0x6'))?path[_0xaf2c('0x7')](this[_0xaf2c('0x5')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0xaf2c('0x8')]},'channel':{'type':Sequelize[_0xaf2c('0x8')]},'value':{'type':Sequelize[_0xaf2c('0x8')],'set':function(_0x1f9531){var _0x58351f=_0x1f9531[_0xaf2c('0x9')](/\\/g,'/');this[_0xaf2c('0xa')]('value',_0x58351f);}},'rating':{'type':Sequelize[_0xaf2c('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x439ca3){this['setDataValue'](_0xaf2c('0xc'),moment()[_0xaf2c('0xd')](_0x439ca3,'ms'));this[_0xaf2c('0xa')](_0xaf2c('0xe'),moment());this['setDataValue']('duration',_0x439ca3);}},'startedAt':{'type':Sequelize[_0xaf2c('0xf')],'get':function(){return moment(this[_0xaf2c('0x5')](_0xaf2c('0xc')))[_0xaf2c('0x10')](_0xaf2c('0x11'))['toString']();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xaf2c('0x5')](_0xaf2c('0xe')))[_0xaf2c('0x10')](_0xaf2c('0x11'))[_0xaf2c('0x12')]();}},'createdAt':{'type':Sequelize[_0xaf2c('0xf')],'get':function(){return moment(this[_0xaf2c('0x5')](_0xaf2c('0x13')))[_0xaf2c('0x10')](_0xaf2c('0x11'))[_0xaf2c('0x12')]();}},'updatedAt':{'type':Sequelize[_0xaf2c('0xf')],'get':function(){return moment(this[_0xaf2c('0x5')](_0xaf2c('0x14')))[_0xaf2c('0x10')]('MM-DD-YYYY\x20HH:mm')[_0xaf2c('0x12')]();}}}; \ No newline at end of file +var _0xbd50=['setDataValue','DATE','MM-DD-YYYY\x20HH:mm','toString','format','createdAt','sequelize','moment','path','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','INTEGER','startedAt','subtract','closedAt'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xbd50,0x196));var _0x0bd5=function(_0x4b7ae3,_0x5dc0c9){_0x4b7ae3=_0x4b7ae3-0x0;var _0x46d4b0=_0xbd50[_0x4b7ae3];return _0x46d4b0;};'use strict';var Sequelize=require(_0x0bd5('0x0'));var moment=require(_0x0bd5('0x1'));var path=require(_0x0bd5('0x2'));var config=require('../../config/environment');module[_0x0bd5('0x3')]={'format':{'type':Sequelize[_0x0bd5('0x4')],'get':function(){return this[_0x0bd5('0x5')](_0x0bd5('0x6'))?path[_0x0bd5('0x7')](this['getDataValue']('value')):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x0bd5('0x8')]},'value':{'type':Sequelize[_0x0bd5('0x8')],'set':function(_0xcc6cfa){var _0x2c0db1=_0xcc6cfa[_0x0bd5('0x9')](/\\/g,'/');this['setDataValue']('value',_0x2c0db1);}},'rating':{'type':Sequelize[_0x0bd5('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x0bd5('0xa')],'set':function(_0x259f4c){this['setDataValue'](_0x0bd5('0xb'),moment()[_0x0bd5('0xc')](_0x259f4c,'ms'));this['setDataValue'](_0x0bd5('0xd'),moment());this[_0x0bd5('0xe')]('duration',_0x259f4c);}},'startedAt':{'type':Sequelize[_0x0bd5('0xf')],'get':function(){return moment(this[_0x0bd5('0x5')](_0x0bd5('0xb')))['format'](_0x0bd5('0x10'))[_0x0bd5('0x11')]();}},'closedAt':{'type':Sequelize[_0x0bd5('0xf')],'get':function(){return moment(this[_0x0bd5('0x5')](_0x0bd5('0xd')))[_0x0bd5('0x12')](_0x0bd5('0x10'))[_0x0bd5('0x11')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0bd5('0x5')](_0x0bd5('0x13')))['format'](_0x0bd5('0x10'))[_0x0bd5('0x11')]();}},'updatedAt':{'type':Sequelize[_0x0bd5('0xf')],'get':function(){return moment(this[_0x0bd5('0x5')]('updatedAt'))[_0x0bd5('0x12')](_0x0bd5('0x10'))[_0x0bd5('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index f7b9d41..94c90f0 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 _0xb066=['set','Content-Range','json','reject','then','destroy','error','name','send','rawAttributes','type','key','model','map','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','filter','merge','VIRTUAL','options','where','ScreenRecording','include','findAll','catch','includeAll','create','body','update','createdAt','closedAt','value','find','params','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','download','filename','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset'];(function(_0x46e190,_0xd0ba63){var _0x450a36=function(_0x3e2c09){while(--_0x3e2c09){_0x46e190['push'](_0x46e190['shift']());}};_0x450a36(++_0xd0ba63);}(_0xb066,0x1c9));var _0x6b06=function(_0x4a8f77,_0x5ee2ca){_0x4a8f77=_0x4a8f77-0x0;var _0x5a26b2=_0xb066[_0x4a8f77];return _0x5a26b2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6b06('0x0'));var rimraf=require(_0x6b06('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6b06('0x2'));var moment=require(_0x6b06('0x3'));var BPromise=require(_0x6b06('0x4'));var Mustache=require(_0x6b06('0x5'));var util=require(_0x6b06('0x6'));var path=require(_0x6b06('0x7'));var sox=require(_0x6b06('0x8'));var csv=require(_0x6b06('0x9'));var ejs=require(_0x6b06('0xa'));var fs=require('fs');var _=require(_0x6b06('0xb'));var squel=require('squel');var crypto=require(_0x6b06('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6b06('0x9'));var querystring=require(_0x6b06('0xd'));var Papa=require(_0x6b06('0xe'));var Redis=require('ioredis');var authService=require(_0x6b06('0xf'));var qs=require(_0x6b06('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6b06('0x11'));var logger=require(_0x6b06('0x12'))(_0x6b06('0x13'));var utils=require(_0x6b06('0x14'));var config=require(_0x6b06('0x15'));var db=require(_0x6b06('0x16'))['db'];function respondWithStatusCode(_0x5af4b3,_0xeccd10){_0xeccd10=_0xeccd10||0xcc;return function(_0x51d1d8){if(_0x51d1d8){return _0x5af4b3[_0x6b06('0x17')](_0xeccd10);}return _0x5af4b3[_0x6b06('0x18')](_0xeccd10)[_0x6b06('0x19')]();};}function respondWithResult(_0x3743b5,_0x24c833){_0x24c833=_0x24c833||0xc8;return function(_0x35a35a){if(_0x35a35a){return _0x3743b5[_0x6b06('0x18')](_0x24c833)['json'](_0x35a35a);}};}function respondWithFilteredResult(_0x9c5c6f,_0x23e93f){return function(_0x485024){if(_0x485024){var _0x4ccd87=_0x485024[_0x6b06('0x1a')],_0x33907c=_0x23e93f[_0x6b06('0x1b')],_0x1a48a2=_0x23e93f[_0x6b06('0x1b')]+_0x23e93f['limit'],_0x28e511;if(_0x1a48a2>=_0x4ccd87){_0x1a48a2=_0x4ccd87;_0x28e511=0xc8;}else{_0x28e511=0xce;}_0x9c5c6f['status'](_0x28e511);return _0x9c5c6f[_0x6b06('0x1c')](_0x6b06('0x1d'),_0x33907c+'-'+_0x1a48a2+'/'+_0x4ccd87)[_0x6b06('0x1e')](_0x485024);}return null;};}function patchUpdates(_0xde5737){return function(_0xb2373){try{jsonpatch['apply'](_0xb2373,_0xde5737,!![]);}catch(_0x20478e){return BPromise[_0x6b06('0x1f')](_0x20478e);}return _0xb2373['save']();};}function saveUpdates(_0x4b2bc8,_0x172a7f){return function(_0x170437){if(_0x170437){return _0x170437['update'](_0x4b2bc8)[_0x6b06('0x20')](function(_0x3c692d){return _0x3c692d;});}return null;};}function removeEntity(_0x985f21,_0x545ebf){return function(_0x7f3ab){if(_0x7f3ab){return _0x7f3ab[_0x6b06('0x21')]()['then'](function(){_0x985f21[_0x6b06('0x18')](0xcc)[_0x6b06('0x19')]();});}};}function handleEntityNotFound(_0x1eb06b,_0x2e3c64){return function(_0x2501be){if(!_0x2501be){_0x1eb06b[_0x6b06('0x17')](0x194);}return _0x2501be;};}function handleError(_0x2a4fee,_0x2ecbea){_0x2ecbea=_0x2ecbea||0x1f4;return function(_0x56bd06){logger[_0x6b06('0x22')](_0x56bd06['stack']);if(_0x56bd06[_0x6b06('0x23')]){delete _0x56bd06[_0x6b06('0x23')];}_0x2a4fee[_0x6b06('0x18')](_0x2ecbea)[_0x6b06('0x24')](_0x56bd06);};}exports['index']=function(_0x14b5a4,_0x5a0f51){var _0x1144f1={},_0x390486={},_0x545908={'count':0x0,'rows':[]};var _0x42b7b2=_['map'](db['ScreenRecording'][_0x6b06('0x25')],function(_0x1bc98e){return{'name':_0x1bc98e['fieldName'],'type':_0x1bc98e[_0x6b06('0x26')][_0x6b06('0x27')]};});_0x390486[_0x6b06('0x28')]=_['differenceBy'](_[_0x6b06('0x29')](_0x42b7b2,'name'),[_0x6b06('0x2a')]);_0x390486[_0x6b06('0x2b')]=_[_0x6b06('0x2c')](_0x14b5a4[_0x6b06('0x2b')]);_0x390486[_0x6b06('0x2d')]=_[_0x6b06('0x2e')](_0x390486[_0x6b06('0x28')],_0x390486[_0x6b06('0x2b')]);_0x1144f1[_0x6b06('0x2f')]=_[_0x6b06('0x2e')](_0x390486['model'],qs['fields'](_0x14b5a4[_0x6b06('0x2b')][_0x6b06('0x30')]));_0x1144f1[_0x6b06('0x2f')]=_0x1144f1['attributes'][_0x6b06('0x31')]?_0x1144f1[_0x6b06('0x2f')]:_0x390486[_0x6b06('0x28')];if(!_0x14b5a4[_0x6b06('0x2b')][_0x6b06('0x32')]('nolimit')){_0x1144f1[_0x6b06('0x33')]=qs[_0x6b06('0x33')](_0x14b5a4[_0x6b06('0x2b')][_0x6b06('0x33')]);_0x1144f1[_0x6b06('0x1b')]=qs[_0x6b06('0x1b')](_0x14b5a4[_0x6b06('0x2b')][_0x6b06('0x1b')]);}_0x1144f1[_0x6b06('0x34')]=qs['sort'](_0x14b5a4['query'][_0x6b06('0x35')]);_0x1144f1['where']=qs[_0x6b06('0x2d')](_['pick'](_0x14b5a4[_0x6b06('0x2b')],_0x390486[_0x6b06('0x2d')]),_0x42b7b2);if(_0x14b5a4[_0x6b06('0x2b')][_0x6b06('0x36')]){_0x1144f1['where']=_[_0x6b06('0x37')](_0x1144f1['where'],{'$or':_[_0x6b06('0x29')](_0x42b7b2,function(_0x380aa9){if(_0x380aa9[_0x6b06('0x26')]!==_0x6b06('0x38')){var _0x331f20={};_0x331f20[_0x380aa9['name']]={'$like':'%'+_0x14b5a4[_0x6b06('0x2b')][_0x6b06('0x36')]+'%'};return _0x331f20;}})});}_0x1144f1=_['merge']({},_0x1144f1,_0x14b5a4[_0x6b06('0x39')]);var _0x293ae8={'where':_0x1144f1[_0x6b06('0x3a')]};return db[_0x6b06('0x3b')][_0x6b06('0x1a')](_0x293ae8)[_0x6b06('0x20')](function(_0x25992a){_0x545908[_0x6b06('0x1a')]=_0x25992a;if(_0x14b5a4[_0x6b06('0x2b')]['includeAll']){_0x1144f1[_0x6b06('0x3c')]=[{'all':!![]}];}return db[_0x6b06('0x3b')][_0x6b06('0x3d')](_0x1144f1);})[_0x6b06('0x20')](function(_0x575856){_0x545908['rows']=_0x575856;return _0x545908;})['then'](respondWithFilteredResult(_0x5a0f51,_0x1144f1))[_0x6b06('0x3e')](handleError(_0x5a0f51,null));};exports['show']=function(_0x4d323c,_0x4a48a1){var _0x34ecef={'raw':![],'where':{'id':_0x4d323c['params']['id']}},_0x58379d={};_0x58379d[_0x6b06('0x28')]=_['keys'](db['ScreenRecording'][_0x6b06('0x25')]);_0x58379d[_0x6b06('0x2b')]=_['keys'](_0x4d323c[_0x6b06('0x2b')]);_0x58379d['filters']=_['intersection'](_0x58379d['model'],_0x58379d[_0x6b06('0x2b')]);_0x34ecef['attributes']=_['intersection'](_0x58379d['model'],qs['fields'](_0x4d323c[_0x6b06('0x2b')]['fields']));_0x34ecef[_0x6b06('0x2f')]=_0x34ecef['attributes']['length']?_0x34ecef[_0x6b06('0x2f')]:_0x58379d[_0x6b06('0x28')];if(_0x4d323c[_0x6b06('0x2b')][_0x6b06('0x3f')]){_0x34ecef['include']=[{'all':!![]}];}_0x34ecef=_['merge']({},_0x34ecef,_0x4d323c[_0x6b06('0x39')]);return db['ScreenRecording']['find'](_0x34ecef)['then'](handleEntityNotFound(_0x4a48a1,null))[_0x6b06('0x20')](respondWithResult(_0x4a48a1,null))[_0x6b06('0x3e')](handleError(_0x4a48a1,null));};exports[_0x6b06('0x40')]=function(_0x59a48b,_0x47da6f){return db[_0x6b06('0x3b')]['create'](_0x59a48b[_0x6b06('0x41')],{})['then'](respondWithResult(_0x47da6f,0xc9))['catch'](handleError(_0x47da6f,null));};exports[_0x6b06('0x42')]=function(_0x4c5164,_0x1f8e4c){if(_0x4c5164[_0x6b06('0x41')]['id']){delete _0x4c5164['body']['id'];}delete _0x4c5164[_0x6b06('0x41')]['duration'];delete _0x4c5164[_0x6b06('0x41')][_0x6b06('0x43')];delete _0x4c5164[_0x6b06('0x41')][_0x6b06('0x44')];delete _0x4c5164['body'][_0x6b06('0x45')];return db[_0x6b06('0x3b')][_0x6b06('0x46')]({'where':{'id':_0x4c5164[_0x6b06('0x47')]['id']}})[_0x6b06('0x20')](handleEntityNotFound(_0x1f8e4c,null))[_0x6b06('0x20')](saveUpdates(_0x4c5164[_0x6b06('0x41')],null))[_0x6b06('0x20')](respondWithResult(_0x1f8e4c,null))['catch'](handleError(_0x1f8e4c,null));};exports['describe']=function(_0x3addbb,_0x3174da){return db[_0x6b06('0x3b')]['describe']()[_0x6b06('0x20')](respondWithResult(_0x3174da,null))[_0x6b06('0x3e')](handleError(_0x3174da,null));};exports['download']=function(_0xff3185,_0xa91cf5,_0x3de848){var _0x4a9a63=require(_0x6b06('0x48'));var _0x181162=![];var _0x16729a={};if(_0xff3185['query'][_0x6b06('0x26')]&&_0xff3185[_0x6b06('0x2b')][_0x6b06('0x26')]==='uniqueid'){_0x16729a[_0x6b06('0x49')]=_0xff3185['params']['id'];}else{_0x16729a['id']=_0xff3185['params']['id'];}return db[_0x6b06('0x3b')][_0x6b06('0x46')]({'where':_0x16729a,'attributes':['id',_0x6b06('0x45')],'raw':!![]})[_0x6b06('0x20')](handleEntityNotFound(_0xa91cf5,null))[_0x6b06('0x20')](function(_0xda5f76){if(_0xda5f76){var _0x23f317=path[_0x6b06('0x4a')](config[_0x6b06('0x4b')],_0x6b06('0x4c'),_0xda5f76['value']);var _0x47d785=util[_0x6b06('0x2a')]('%s.cypher',_0x23f317);if(fs[_0x6b06('0x4d')](_0x47d785)){_0x181162=!![];return _0x4a9a63[_0x6b06('0x4e')](_0x47d785,_0x23f317,config[_0x6b06('0x4f')][_0x6b06('0x50')])[_0x6b06('0x20')](function(){return _0xda5f76;});}return _0xda5f76;}})[_0x6b06('0x20')](function(_0x41afb2){if(_0x41afb2){var _0x1aa199=path[_0x6b06('0x4a')](config[_0x6b06('0x4b')],_0x6b06('0x4c'),_0x41afb2[_0x6b06('0x45')]);if(!fs[_0x6b06('0x4d')](_0x1aa199)){throw new db[(_0x6b06('0x51'))][(_0x6b06('0x52'))](_0x6b06('0x53'));}if(_0x41afb2['filename']){return _0xa91cf5[_0x6b06('0x54')](_0x1aa199,_0x41afb2[_0x6b06('0x55')]+path[_0x6b06('0x56')](_0x1aa199),function(){if(_0x181162){fs[_0x6b06('0x57')](_0x1aa199);}});}else{return _0xa91cf5['download'](_0x1aa199,function(_0x164670){if(_0x181162){fs['unlink'](_0x1aa199);}});}}})['catch'](function(_0x113567){if(_0x113567[_0x6b06('0x58')]===_0x6b06('0x53')){_0xa91cf5[_0x6b06('0x18')](0x194)['send'](_0x6b06('0x59'));}else{return handleError(_0xa91cf5,null);}});};exports[_0x6b06('0x21')]=function(_0x2e78e5,_0x4b9985){return db[_0x6b06('0x3b')][_0x6b06('0x46')]({'where':{'id':_0x2e78e5['params']['id']}})[_0x6b06('0x20')](function(_0x212baa){if(!_0x212baa)throw new ReferenceError(_0x6b06('0x5a'));return _0x212baa;})[_0x6b06('0x20')](function(_0x12b25f){var _0x192671=path[_0x6b06('0x4a')](config[_0x6b06('0x4b')],_0x6b06('0x4c'),_0x12b25f[_0x6b06('0x45')]);logger[_0x6b06('0x5b')](_0x6b06('0x5c'),_0x192671);if(!_[_0x6b06('0x5d')](_0x12b25f[_0x6b06('0x45')])&&fs['existsSync'](_0x192671)){logger['info'](_0x6b06('0x5e')+_0x192671+_0x6b06('0x5f'));fs[_0x6b06('0x60')](_0x192671);}_0x192671=_0x192671+'.cypher';if(!_[_0x6b06('0x5d')](_0x12b25f[_0x6b06('0x45')])&&fs['existsSync'](_0x192671)){logger['info'](_0x6b06('0x5e')+_0x192671+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x192671);}return _0x12b25f;})['then'](function(_0x3376cc){if(!_0x3376cc)throw new InternalError();return _0x3376cc[_0x6b06('0x21')]();})[_0x6b06('0x20')](function(){_0x4b9985['status'](0xcc)['end']();})[_0x6b06('0x3e')](handleError(_0x4b9985,null));}; \ No newline at end of file +var _0xfeba=['.cypher','isNil','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','reject','update','then','name','index','map','ScreenRecording','rawAttributes','fieldName','key','model','differenceBy','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','pick','filter','merge','type','options','where','includeAll','include','rows','catch','show','find','create','body','duration','createdAt','closedAt','value','params','describe','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','existsSync','recording','ValidationError','ScreenRecording\x20not\x20found','filename','download','extname','unlink','message','Not\x20found','destroy','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync'];(function(_0x2d936e,_0x3b0aa7){var _0x5a71ad=function(_0x4f7891){while(--_0x4f7891){_0x2d936e['push'](_0x2d936e['shift']());}};_0x5a71ad(++_0x3b0aa7);}(_0xfeba,0x18e));var _0xafeb=function(_0x448a78,_0x2abcaf){_0x448a78=_0x448a78-0x0;var _0x2d3ddb=_0xfeba[_0x448a78];return _0x2d3ddb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xafeb('0x0'));var rimraf=require(_0xafeb('0x1'));var zipdir=require(_0xafeb('0x2'));var jsonpatch=require(_0xafeb('0x3'));var rp=require(_0xafeb('0x4'));var moment=require(_0xafeb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xafeb('0x6'));var util=require(_0xafeb('0x7'));var path=require(_0xafeb('0x8'));var sox=require(_0xafeb('0x9'));var csv=require(_0xafeb('0xa'));var ejs=require(_0xafeb('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xafeb('0xc'));var crypto=require(_0xafeb('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xafeb('0xe'));var toCsv=require('to-csv');var querystring=require(_0xafeb('0xf'));var Papa=require(_0xafeb('0x10'));var Redis=require(_0xafeb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xafeb('0x12'));var as=require(_0xafeb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xafeb('0x14'))(_0xafeb('0x15'));var utils=require(_0xafeb('0x16'));var config=require(_0xafeb('0x17'));var db=require(_0xafeb('0x18'))['db'];function respondWithStatusCode(_0x210333,_0x2ef518){_0x2ef518=_0x2ef518||0xcc;return function(_0x389a8f){if(_0x389a8f){return _0x210333[_0xafeb('0x19')](_0x2ef518);}return _0x210333[_0xafeb('0x1a')](_0x2ef518)[_0xafeb('0x1b')]();};}function respondWithResult(_0x16089c,_0x432bf7){_0x432bf7=_0x432bf7||0xc8;return function(_0x1d252e){if(_0x1d252e){return _0x16089c[_0xafeb('0x1a')](_0x432bf7)[_0xafeb('0x1c')](_0x1d252e);}};}function respondWithFilteredResult(_0x22f32f,_0x38fb63){return function(_0x493483){if(_0x493483){var _0x1bb36e=_0x493483[_0xafeb('0x1d')],_0x502b5f=_0x38fb63[_0xafeb('0x1e')],_0x4a1c36=_0x38fb63['offset']+_0x38fb63['limit'],_0x438054;if(_0x4a1c36>=_0x1bb36e){_0x4a1c36=_0x1bb36e;_0x438054=0xc8;}else{_0x438054=0xce;}_0x22f32f['status'](_0x438054);return _0x22f32f[_0xafeb('0x1f')]('Content-Range',_0x502b5f+'-'+_0x4a1c36+'/'+_0x1bb36e)[_0xafeb('0x1c')](_0x493483);}return null;};}function patchUpdates(_0x3ba264){return function(_0x5ca536){try{jsonpatch[_0xafeb('0x20')](_0x5ca536,_0x3ba264,!![]);}catch(_0x8dd8a3){return BPromise[_0xafeb('0x21')](_0x8dd8a3);}return _0x5ca536['save']();};}function saveUpdates(_0x437fff,_0x42359f){return function(_0x5136e1){if(_0x5136e1){return _0x5136e1[_0xafeb('0x22')](_0x437fff)[_0xafeb('0x23')](function(_0x136945){return _0x136945;});}return null;};}function removeEntity(_0x177e90,_0x3d309b){return function(_0x5b8bad){if(_0x5b8bad){return _0x5b8bad['destroy']()[_0xafeb('0x23')](function(){_0x177e90[_0xafeb('0x1a')](0xcc)[_0xafeb('0x1b')]();});}};}function handleEntityNotFound(_0x506471,_0x252a35){return function(_0xce1bbd){if(!_0xce1bbd){_0x506471['sendStatus'](0x194);}return _0xce1bbd;};}function handleError(_0x6abbe4,_0xd930b){_0xd930b=_0xd930b||0x1f4;return function(_0x3cfe43){logger['error'](_0x3cfe43['stack']);if(_0x3cfe43[_0xafeb('0x24')]){delete _0x3cfe43[_0xafeb('0x24')];}_0x6abbe4['status'](_0xd930b)['send'](_0x3cfe43);};}exports[_0xafeb('0x25')]=function(_0x1543a1,_0x21df6e){var _0x1f52ac={},_0x5a7b5e={},_0x1ecb75={'count':0x0,'rows':[]};var _0x58ef7a=_[_0xafeb('0x26')](db[_0xafeb('0x27')][_0xafeb('0x28')],function(_0x4ee56e){return{'name':_0x4ee56e[_0xafeb('0x29')],'type':_0x4ee56e['type'][_0xafeb('0x2a')]};});_0x5a7b5e[_0xafeb('0x2b')]=_[_0xafeb('0x2c')](_[_0xafeb('0x26')](_0x58ef7a,_0xafeb('0x24')),['format']);_0x5a7b5e[_0xafeb('0x2d')]=_[_0xafeb('0x2e')](_0x1543a1[_0xafeb('0x2d')]);_0x5a7b5e[_0xafeb('0x2f')]=_[_0xafeb('0x30')](_0x5a7b5e[_0xafeb('0x2b')],_0x5a7b5e[_0xafeb('0x2d')]);_0x1f52ac['attributes']=_[_0xafeb('0x30')](_0x5a7b5e[_0xafeb('0x2b')],qs['fields'](_0x1543a1['query'][_0xafeb('0x31')]));_0x1f52ac['attributes']=_0x1f52ac[_0xafeb('0x32')][_0xafeb('0x33')]?_0x1f52ac[_0xafeb('0x32')]:_0x5a7b5e[_0xafeb('0x2b')];if(!_0x1543a1[_0xafeb('0x2d')][_0xafeb('0x34')](_0xafeb('0x35'))){_0x1f52ac['limit']=qs[_0xafeb('0x36')](_0x1543a1[_0xafeb('0x2d')]['limit']);_0x1f52ac['offset']=qs[_0xafeb('0x1e')](_0x1543a1[_0xafeb('0x2d')][_0xafeb('0x1e')]);}_0x1f52ac['order']=qs[_0xafeb('0x37')](_0x1543a1[_0xafeb('0x2d')][_0xafeb('0x37')]);_0x1f52ac['where']=qs[_0xafeb('0x2f')](_[_0xafeb('0x38')](_0x1543a1[_0xafeb('0x2d')],_0x5a7b5e[_0xafeb('0x2f')]),_0x58ef7a);if(_0x1543a1[_0xafeb('0x2d')][_0xafeb('0x39')]){_0x1f52ac['where']=_[_0xafeb('0x3a')](_0x1f52ac['where'],{'$or':_['map'](_0x58ef7a,function(_0x4cb604){if(_0x4cb604[_0xafeb('0x3b')]!=='VIRTUAL'){var _0xdf1a41={};_0xdf1a41[_0x4cb604[_0xafeb('0x24')]]={'$like':'%'+_0x1543a1[_0xafeb('0x2d')]['filter']+'%'};return _0xdf1a41;}})});}_0x1f52ac=_[_0xafeb('0x3a')]({},_0x1f52ac,_0x1543a1[_0xafeb('0x3c')]);var _0x2c2fab={'where':_0x1f52ac[_0xafeb('0x3d')]};return db[_0xafeb('0x27')][_0xafeb('0x1d')](_0x2c2fab)['then'](function(_0x4cbf16){_0x1ecb75[_0xafeb('0x1d')]=_0x4cbf16;if(_0x1543a1[_0xafeb('0x2d')][_0xafeb('0x3e')]){_0x1f52ac[_0xafeb('0x3f')]=[{'all':!![]}];}return db[_0xafeb('0x27')]['findAll'](_0x1f52ac);})[_0xafeb('0x23')](function(_0x53052d){_0x1ecb75[_0xafeb('0x40')]=_0x53052d;return _0x1ecb75;})[_0xafeb('0x23')](respondWithFilteredResult(_0x21df6e,_0x1f52ac))[_0xafeb('0x41')](handleError(_0x21df6e,null));};exports[_0xafeb('0x42')]=function(_0x43a111,_0x3034b1){var _0x60d756={'raw':![],'where':{'id':_0x43a111['params']['id']}},_0x4ba020={};_0x4ba020[_0xafeb('0x2b')]=_[_0xafeb('0x2e')](db[_0xafeb('0x27')][_0xafeb('0x28')]);_0x4ba020[_0xafeb('0x2d')]=_[_0xafeb('0x2e')](_0x43a111[_0xafeb('0x2d')]);_0x4ba020[_0xafeb('0x2f')]=_['intersection'](_0x4ba020[_0xafeb('0x2b')],_0x4ba020[_0xafeb('0x2d')]);_0x60d756[_0xafeb('0x32')]=_[_0xafeb('0x30')](_0x4ba020[_0xafeb('0x2b')],qs[_0xafeb('0x31')](_0x43a111[_0xafeb('0x2d')][_0xafeb('0x31')]));_0x60d756[_0xafeb('0x32')]=_0x60d756[_0xafeb('0x32')][_0xafeb('0x33')]?_0x60d756[_0xafeb('0x32')]:_0x4ba020[_0xafeb('0x2b')];if(_0x43a111['query'][_0xafeb('0x3e')]){_0x60d756[_0xafeb('0x3f')]=[{'all':!![]}];}_0x60d756=_[_0xafeb('0x3a')]({},_0x60d756,_0x43a111[_0xafeb('0x3c')]);return db['ScreenRecording'][_0xafeb('0x43')](_0x60d756)['then'](handleEntityNotFound(_0x3034b1,null))[_0xafeb('0x23')](respondWithResult(_0x3034b1,null))[_0xafeb('0x41')](handleError(_0x3034b1,null));};exports[_0xafeb('0x44')]=function(_0x32c620,_0x28e665){return db[_0xafeb('0x27')]['create'](_0x32c620[_0xafeb('0x45')],{})[_0xafeb('0x23')](respondWithResult(_0x28e665,0xc9))[_0xafeb('0x41')](handleError(_0x28e665,null));};exports[_0xafeb('0x22')]=function(_0x1eb194,_0x2d6ab9){if(_0x1eb194[_0xafeb('0x45')]['id']){delete _0x1eb194[_0xafeb('0x45')]['id'];}delete _0x1eb194[_0xafeb('0x45')][_0xafeb('0x46')];delete _0x1eb194['body'][_0xafeb('0x47')];delete _0x1eb194[_0xafeb('0x45')][_0xafeb('0x48')];delete _0x1eb194['body'][_0xafeb('0x49')];return db[_0xafeb('0x27')][_0xafeb('0x43')]({'where':{'id':_0x1eb194[_0xafeb('0x4a')]['id']}})[_0xafeb('0x23')](handleEntityNotFound(_0x2d6ab9,null))[_0xafeb('0x23')](saveUpdates(_0x1eb194[_0xafeb('0x45')],null))[_0xafeb('0x23')](respondWithResult(_0x2d6ab9,null))[_0xafeb('0x41')](handleError(_0x2d6ab9,null));};exports['describe']=function(_0x178637,_0x30e09c){return db['ScreenRecording'][_0xafeb('0x4b')]()[_0xafeb('0x23')](respondWithResult(_0x30e09c,null))[_0xafeb('0x41')](handleError(_0x30e09c,null));};exports['download']=function(_0x7a7460,_0x593a94,_0x5ed17e){var _0x1d26e5=require(_0xafeb('0x4c'));var _0x294be6=![];var _0xbc465a={};if(_0x7a7460[_0xafeb('0x2d')][_0xafeb('0x3b')]&&_0x7a7460[_0xafeb('0x2d')][_0xafeb('0x3b')]===_0xafeb('0x4d')){_0xbc465a[_0xafeb('0x4d')]=_0x7a7460[_0xafeb('0x4a')]['id'];}else{_0xbc465a['id']=_0x7a7460[_0xafeb('0x4a')]['id'];}return db[_0xafeb('0x27')][_0xafeb('0x43')]({'where':_0xbc465a,'attributes':['id',_0xafeb('0x49')],'raw':!![]})['then'](handleEntityNotFound(_0x593a94,null))[_0xafeb('0x23')](function(_0x4d4c3c){if(_0x4d4c3c){var _0x49a20b=path[_0xafeb('0x4e')](config[_0xafeb('0x4f')],_0xafeb('0x50'),_0x4d4c3c[_0xafeb('0x49')]);var _0x105982=util['format']('%s.cypher',_0x49a20b);if(fs[_0xafeb('0x51')](_0x105982)){_0x294be6=!![];return _0x1d26e5['decryptFile'](_0x105982,_0x49a20b,config['secrets'][_0xafeb('0x52')])[_0xafeb('0x23')](function(){return _0x4d4c3c;});}return _0x4d4c3c;}})['then'](function(_0x52b3cd){if(_0x52b3cd){var _0xb3ac6b=path['join'](config['root'],'server/files/screen_recordings',_0x52b3cd['value']);if(!fs[_0xafeb('0x51')](_0xb3ac6b)){throw new db['Sequelize'][(_0xafeb('0x53'))](_0xafeb('0x54'));}if(_0x52b3cd[_0xafeb('0x55')]){return _0x593a94[_0xafeb('0x56')](_0xb3ac6b,_0x52b3cd[_0xafeb('0x55')]+path[_0xafeb('0x57')](_0xb3ac6b),function(){if(_0x294be6){fs[_0xafeb('0x58')](_0xb3ac6b);}});}else{return _0x593a94[_0xafeb('0x56')](_0xb3ac6b,function(_0x3daa4a){if(_0x294be6){fs[_0xafeb('0x58')](_0xb3ac6b);}});}}})[_0xafeb('0x41')](function(_0x350599){if(_0x350599[_0xafeb('0x59')]===_0xafeb('0x54')){_0x593a94[_0xafeb('0x1a')](0x194)['send'](_0xafeb('0x5a'));}else{return handleError(_0x593a94,null);}});};exports[_0xafeb('0x5b')]=function(_0x339d7a,_0xc8c1e4){return db['ScreenRecording'][_0xafeb('0x43')]({'where':{'id':_0x339d7a[_0xafeb('0x4a')]['id']}})[_0xafeb('0x23')](function(_0x15a107){if(!_0x15a107)throw new ReferenceError(_0xafeb('0x5c'));return _0x15a107;})[_0xafeb('0x23')](function(_0x2ca15f){var _0x232eee=path[_0xafeb('0x4e')](config['root'],_0xafeb('0x50'),_0x2ca15f['value']);logger[_0xafeb('0x5d')]('cancellazione\x20fisica\x20documento\x20%s',_0x232eee);if(!_['isNil'](_0x2ca15f[_0xafeb('0x49')])&&fs[_0xafeb('0x51')](_0x232eee)){logger['info'](_0xafeb('0x5e')+_0x232eee+_0xafeb('0x5f'));fs[_0xafeb('0x60')](_0x232eee);}_0x232eee=_0x232eee+_0xafeb('0x61');if(!_[_0xafeb('0x62')](_0x2ca15f['value'])&&fs[_0xafeb('0x51')](_0x232eee)){logger[_0xafeb('0x5d')](_0xafeb('0x5e')+_0x232eee+_0xafeb('0x5f'));fs['unlinkSync'](_0x232eee);}return _0x2ca15f;})[_0xafeb('0x23')](function(_0x5121be){if(!_0x5121be)throw new InternalError();return _0x5121be[_0xafeb('0x5b')]();})['then'](function(){_0xc8c1e4['status'](0xcc)[_0xafeb('0x1b')]();})['catch'](handleError(_0xc8c1e4,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 42e06f3..0e0b9ed 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 _0xa2f8=['path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util','api','moment','bluebird','request-promise'];(function(_0x1ab852,_0x15ed66){var _0x2da601=function(_0x228c2a){while(--_0x228c2a){_0x1ab852['push'](_0x1ab852['shift']());}};_0x2da601(++_0x15ed66);}(_0xa2f8,0x90));var _0x8a2f=function(_0x4b9a2e,_0x26b0fe){_0x4b9a2e=_0x4b9a2e-0x0;var _0x46ea53=_0xa2f8[_0x4b9a2e];return _0x46ea53;};'use strict';var _=require(_0x8a2f('0x0'));var util=require(_0x8a2f('0x1'));var logger=require('../../config/logger')(_0x8a2f('0x2'));var moment=require(_0x8a2f('0x3'));var BPromise=require(_0x8a2f('0x4'));var rp=require(_0x8a2f('0x5'));var fs=require('fs');var path=require(_0x8a2f('0x6'));var rimraf=require(_0x8a2f('0x7'));var config=require(_0x8a2f('0x8'));var attributes=require(_0x8a2f('0x9'));module[_0x8a2f('0xa')]=function(_0x4b1982,_0x32b161){return _0x4b1982[_0x8a2f('0xb')](_0x8a2f('0xc'),attributes,{'tableName':_0x8a2f('0xd'),'paranoid':![],'indexes':[{'name':_0x8a2f('0xe'),'fields':[_0x8a2f('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0b63=['../../config/environment','define','ScreenRecording','screen_recordings','interactionid','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x59caad,_0x39ada9){var _0x454038=function(_0xaa5f78){while(--_0xaa5f78){_0x59caad['push'](_0x59caad['shift']());}};_0x454038(++_0x39ada9);}(_0x0b63,0x1e5));var _0x30b6=function(_0x3cb648,_0x2ceb43){_0x3cb648=_0x3cb648-0x0;var _0x39dcac=_0x0b63[_0x3cb648];return _0x39dcac;};'use strict';var _=require('lodash');var util=require(_0x30b6('0x0'));var logger=require(_0x30b6('0x1'))(_0x30b6('0x2'));var moment=require(_0x30b6('0x3'));var BPromise=require('bluebird');var rp=require(_0x30b6('0x4'));var fs=require('fs');var path=require(_0x30b6('0x5'));var rimraf=require(_0x30b6('0x6'));var config=require(_0x30b6('0x7'));var attributes=require('./screenRecording.attributes');module['exports']=function(_0x2c40a0,_0x2ac6f5){return _0x2c40a0[_0x30b6('0x8')](_0x30b6('0x9'),attributes,{'tableName':_0x30b6('0xa'),'paranoid':![],'indexes':[{'name':_0x30b6('0xb'),'fields':[_0x30b6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 27037a1..175c895 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(_0x4c73f7,_0x373731){var _0x3524fb=function(_0x4ada4e){while(--_0x4ada4e){_0x4c73f7['push'](_0x4c73f7['shift']());}};_0x3524fb(++_0x373731);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x9284a5,_0x48a0d5){var _0x46c96c=function(_0xcca1a6){while(--_0xcca1a6){_0x9284a5['push'](_0x9284a5['shift']());}};_0x46c96c(++_0x48a0d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index d80b871..43efa40 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 _0x646b=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','show','get','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','diskStorage','join','root','format','%s%s','logo','extname','originalname','post','single','file','addLogo','server/files/images/logos/','logologin','addLogoLogin','preferred','addPreferred','favicon','addFavicon','put','update','exports','multer','util'];(function(_0x41ae57,_0x49cc48){var _0x400213=function(_0x271a47){while(--_0x271a47){_0x41ae57['push'](_0x41ae57['shift']());}};_0x400213(++_0x49cc48);}(_0x646b,0x85));var _0xb646=function(_0x24679e,_0x22d9d7){_0x24679e=_0x24679e-0x0;var _0x291f21=_0x646b[_0x24679e];return _0x291f21;};'use strict';var multer=require(_0xb646('0x0'));var util=require(_0xb646('0x1'));var path=require(_0xb646('0x2'));var timeout=require(_0xb646('0x3'));var express=require(_0xb646('0x4'));var router=express[_0xb646('0x5')]();var auth=require(_0xb646('0x6'));var interaction=require(_0xb646('0x7'));var config=require(_0xb646('0x8'));var controller=require('./setting.controller');router['get']('/',auth[_0xb646('0x9')](),controller[_0xb646('0xa')]);router['get'](_0xb646('0xb'),controller[_0xb646('0xc')]);router[_0xb646('0xd')](_0xb646('0xe'),controller[_0xb646('0xf')]);router[_0xb646('0xd')](_0xb646('0x10'),controller[_0xb646('0x11')]);router[_0xb646('0xd')](_0xb646('0x12'),controller[_0xb646('0x13')]);router[_0xb646('0xd')](_0xb646('0x14'),controller[_0xb646('0x15')]);router['get'](_0xb646('0x16'),controller['getFavicon']);var upload=multer({'storage':multer[_0xb646('0x17')]({'destination':function(_0x32a383,_0x302725,_0xe47a40){_0xe47a40(null,path[_0xb646('0x18')](config[_0xb646('0x19')],'server/files/images/logos/'));},'filename':function(_0x1c6291,_0x4b7fa8,_0x22cbee){_0x22cbee(null,util[_0xb646('0x1a')](_0xb646('0x1b'),_0xb646('0x1c'),path[_0xb646('0x1d')](_0x4b7fa8[_0xb646('0x1e')])));}})});router[_0xb646('0x1f')](_0xb646('0xe'),upload[_0xb646('0x20')](_0xb646('0x21')),controller[_0xb646('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2a93c3,_0x24023f,_0x9eb244){_0x9eb244(null,path[_0xb646('0x18')](config[_0xb646('0x19')],_0xb646('0x23')));},'filename':function(_0x3746f8,_0x3de944,_0x34176a){_0x34176a(null,util[_0xb646('0x1a')](_0xb646('0x1b'),_0xb646('0x24'),path[_0xb646('0x1d')](_0x3de944[_0xb646('0x1e')])));}})});router[_0xb646('0x1f')](_0xb646('0x10'),upload[_0xb646('0x20')]('file'),controller[_0xb646('0x25')]);var upload=multer({'storage':multer[_0xb646('0x17')]({'destination':function(_0x2ddae5,_0x5018c2,_0x17ed5){_0x17ed5(null,path[_0xb646('0x18')](config[_0xb646('0x19')],_0xb646('0x23')));},'filename':function(_0x57092b,_0x1964a0,_0x3f3039){_0x3f3039(null,util[_0xb646('0x1a')](_0xb646('0x1b'),_0xb646('0x26'),path[_0xb646('0x1d')](_0x1964a0[_0xb646('0x1e')])));}})});router['post'](_0xb646('0x14'),upload['single'](_0xb646('0x21')),controller[_0xb646('0x27')]);var upload=multer({'storage':multer[_0xb646('0x17')]({'destination':function(_0x1682e2,_0x3b47bc,_0x5414a6){_0x5414a6(null,path[_0xb646('0x18')](config['root'],'server/files/images/logos/'));},'filename':function(_0x2e318c,_0x2fb208,_0x12f70d){_0x12f70d(null,util[_0xb646('0x1a')](_0xb646('0x1b'),_0xb646('0x28'),path[_0xb646('0x1d')](_0x2fb208['originalname'])));}})});router[_0xb646('0x1f')](_0xb646('0x16'),upload[_0xb646('0x20')](_0xb646('0x21')),controller[_0xb646('0x29')]);router[_0xb646('0x2a')](_0xb646('0xb'),auth[_0xb646('0x9')](),controller[_0xb646('0x2b')]);module[_0xb646('0x2c')]=router; \ No newline at end of file +var _0x46fc=['Router','../../components/auth/service','../../components/interaction/service','./setting.controller','get','isAuthenticated','index','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','diskStorage','join','server/files/images/logos/','format','%s%s','originalname','post','single','file','addLogo','root','logologin','extname','preferred','addFavicon','put','/:id','update','multer','util','path','connect-timeout'];(function(_0x3004a5,_0x1365bf){var _0x1e20e6=function(_0x1d4551){while(--_0x1d4551){_0x3004a5['push'](_0x3004a5['shift']());}};_0x1e20e6(++_0x1365bf);}(_0x46fc,0xba));var _0xc46f=function(_0x111d01,_0x506e2f){_0x111d01=_0x111d01-0x0;var _0x1857d8=_0x46fc[_0x111d01];return _0x1857d8;};'use strict';var multer=require(_0xc46f('0x0'));var util=require(_0xc46f('0x1'));var path=require(_0xc46f('0x2'));var timeout=require(_0xc46f('0x3'));var express=require('express');var router=express[_0xc46f('0x4')]();var auth=require(_0xc46f('0x5'));var interaction=require(_0xc46f('0x6'));var config=require('../../config/environment');var controller=require(_0xc46f('0x7'));router[_0xc46f('0x8')]('/',auth[_0xc46f('0x9')](),controller[_0xc46f('0xa')]);router[_0xc46f('0x8')]('/:id',controller['show']);router[_0xc46f('0x8')](_0xc46f('0xb'),controller[_0xc46f('0xc')]);router[_0xc46f('0x8')](_0xc46f('0xd'),controller[_0xc46f('0xe')]);router[_0xc46f('0x8')](_0xc46f('0xf'),controller[_0xc46f('0x10')]);router[_0xc46f('0x8')](_0xc46f('0x11'),controller[_0xc46f('0x12')]);router[_0xc46f('0x8')](_0xc46f('0x13'),controller['getFavicon']);var upload=multer({'storage':multer[_0xc46f('0x14')]({'destination':function(_0x27c31c,_0x214798,_0x231d3b){_0x231d3b(null,path[_0xc46f('0x15')](config['root'],_0xc46f('0x16')));},'filename':function(_0x5d8784,_0x1c1b5a,_0xcd718e){_0xcd718e(null,util[_0xc46f('0x17')](_0xc46f('0x18'),'logo',path['extname'](_0x1c1b5a[_0xc46f('0x19')])));}})});router[_0xc46f('0x1a')](_0xc46f('0xb'),upload[_0xc46f('0x1b')](_0xc46f('0x1c')),controller[_0xc46f('0x1d')]);var upload=multer({'storage':multer[_0xc46f('0x14')]({'destination':function(_0x4854be,_0x213447,_0x20ec68){_0x20ec68(null,path[_0xc46f('0x15')](config[_0xc46f('0x1e')],_0xc46f('0x16')));},'filename':function(_0xf010bd,_0x44d3ba,_0x3a9f9e){_0x3a9f9e(null,util[_0xc46f('0x17')](_0xc46f('0x18'),_0xc46f('0x1f'),path[_0xc46f('0x20')](_0x44d3ba[_0xc46f('0x19')])));}})});router['post'](_0xc46f('0xd'),upload['single'](_0xc46f('0x1c')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0xc46f('0x14')]({'destination':function(_0x248b73,_0x490553,_0x4484a0){_0x4484a0(null,path[_0xc46f('0x15')](config[_0xc46f('0x1e')],'server/files/images/logos/'));},'filename':function(_0x21f2bd,_0x1090c7,_0x5a7d20){_0x5a7d20(null,util[_0xc46f('0x17')](_0xc46f('0x18'),_0xc46f('0x21'),path[_0xc46f('0x20')](_0x1090c7[_0xc46f('0x19')])));}})});router[_0xc46f('0x1a')](_0xc46f('0x11'),upload[_0xc46f('0x1b')](_0xc46f('0x1c')),controller['addPreferred']);var upload=multer({'storage':multer[_0xc46f('0x14')]({'destination':function(_0x32925d,_0x57b38c,_0xdc12b2){_0xdc12b2(null,path[_0xc46f('0x15')](config[_0xc46f('0x1e')],'server/files/images/logos/'));},'filename':function(_0x532c5f,_0x25be17,_0xaec076){_0xaec076(null,util['format'](_0xc46f('0x18'),'favicon',path[_0xc46f('0x20')](_0x25be17[_0xc46f('0x19')])));}})});router[_0xc46f('0x1a')](_0xc46f('0x13'),upload[_0xc46f('0x1b')](_0xc46f('0x1c')),controller[_0xc46f('0x22')]);router[_0xc46f('0x23')](_0xc46f('0x24'),auth['isAuthenticated'](),controller[_0xc46f('0x25')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index a346ca6..26e12ae 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 _0x0b00=['BOOLEAN','alternate','exports','min_internal','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x2a1764,_0x5656da){var _0x5532a6=function(_0x516692){while(--_0x516692){_0x2a1764['push'](_0x2a1764['shift']());}};_0x5532a6(++_0x5656da);}(_0x0b00,0x1d2));var _0x00b0=function(_0x592a9f,_0x172adf){_0x592a9f=_0x592a9f-0x0;var _0x17370a=_0x0b00[_0x592a9f];return _0x17370a;};'use strict';var Sequelize=require('sequelize');module[_0x00b0('0x0')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x00b0('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x00b0('0x2')](0xb),'unique':_0x00b0('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x00b0('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x00b0('0x4')],'defaultValue':_0x00b0('0x5')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0x00b0('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0x00b0('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x00b0('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x00b0('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x00b0('0x4')]},'turnaddr':{'type':Sequelize[_0x00b0('0x4')]},'turnusername':{'type':Sequelize[_0x00b0('0x4')]},'turnpassword':{'type':Sequelize[_0x00b0('0x4')]},'pageTitle':{'type':Sequelize[_0x00b0('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x00b0('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x00b0('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x00b0('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x00b0('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x00b0('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x00b0('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x00b0('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x00b0('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x00b0('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x00b0('0x7')},'chatTimeout':{'type':Sequelize[_0x00b0('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x00b0('0x4')]},'defaultPreferred':{'type':Sequelize[_0x00b0('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x00b0('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x00b0('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0x00b0('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x00b0('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x00b0('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x00b0('0x4')]},'sentiment':{'type':Sequelize[_0x00b0('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x00b0('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x00b0('0x2')]},'sentimentRegion':{'type':Sequelize[_0x00b0('0x4')]},'language':{'type':Sequelize[_0x00b0('0x4')]},'bucket':{'type':Sequelize[_0x00b0('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x00b0('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0xe71d=['alternate','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN'];(function(_0x4357c1,_0x2f0cd3){var _0x54a12e=function(_0x41122e){while(--_0x41122e){_0x4357c1['push'](_0x4357c1['shift']());}};_0x54a12e(++_0x2f0cd3);}(_0xe71d,0x181));var _0xde71=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xe71d[_0x9aada2];return _0x196dff;};'use strict';var Sequelize=require(_0xde71('0x0'));module[_0xde71('0x1')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xde71('0x2')](0xb),'unique':_0xde71('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xde71('0x4')],'defaultValue':_0xde71('0x5')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0xde71('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xde71('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0xde71('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xde71('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xde71('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xde71('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xde71('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xde71('0x4')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0xde71('0x4')]},'turnpassword':{'type':Sequelize[_0xde71('0x4')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xde71('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xde71('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xde71('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0xde71('0x6')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xde71('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xde71('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xde71('0x4')],'defaultValue':_0xde71('0x7')},'chatTimeout':{'type':Sequelize[_0xde71('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xde71('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xde71('0x4')]},'defaultPreferred':{'type':Sequelize[_0xde71('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xde71('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xde71('0x4')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xde71('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xde71('0x4')]},'defaultFavicon':{'type':Sequelize[_0xde71('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xde71('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xde71('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xde71('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xde71('0x2')]},'transcribeRegion':{'type':Sequelize[_0xde71('0x4')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xde71('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0xde71('0x4')]},'language':{'type':Sequelize[_0xde71('0x4')]},'bucket':{'type':Sequelize[_0xde71('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0xde71('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index c5f3385..ced2d18 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 _0x89e3=['toLower','default_logo.png','upperFirst','custom','\x20not\x20found','getLogoLogin','favicon','defaultLogo','defaultFavicon','default_loginLogo.png','default','download','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','default_favicon.ico','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','jayson/promise','http','test','Sequelize','ValidationError','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','set','reject','save','destroy','stack','name','index','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','VIRTUAL','filter','merge','Setting','includeAll','include','show','params','options','find','update','body','addLogo','file','filename','addLogoLogin','loginLogo','../../config/license/util','getLogo','server/files/images/logos','getLicense','logo','preferred','defaultLoginLogo','defaultPreferred','existsSync','join','root'];(function(_0x12793a,_0x4f77d3){var _0x25beb9=function(_0x2d6c4a){while(--_0x2d6c4a){_0x12793a['push'](_0x12793a['shift']());}};_0x25beb9(++_0x4f77d3);}(_0x89e3,0x1e7));var _0x389e=function(_0x112221,_0x31c1b4){_0x112221=_0x112221-0x0;var _0x3ef12b=_0x89e3[_0x112221];return _0x3ef12b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x389e('0x0'));var rimraf=require(_0x389e('0x1'));var zipdir=require(_0x389e('0x2'));var jsonpatch=require(_0x389e('0x3'));var rp=require('request-promise');var moment=require(_0x389e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x389e('0x5'));var util=require(_0x389e('0x6'));var path=require(_0x389e('0x7'));var sox=require(_0x389e('0x8'));var csv=require('to-csv');var ejs=require(_0x389e('0x9'));var fs=require('fs');var _=require(_0x389e('0xa'));var squel=require(_0x389e('0xb'));var crypto=require(_0x389e('0xc'));var jsforce=require(_0x389e('0xd'));var deskjs=require(_0x389e('0xe'));var toCsv=require(_0x389e('0xf'));var querystring=require(_0x389e('0x10'));var Papa=require(_0x389e('0x11'));var Redis=require('ioredis');var authService=require(_0x389e('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x389e('0x13'));var logger=require('../../config/logger')(_0x389e('0x14'));var utils=require(_0x389e('0x15'));var config=require(_0x389e('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0x389e('0x17'));var client=jayson['client'][_0x389e('0x18')]({'port':0x232a});function checkPasswordPattern(_0x4f3d35,_0x17056c,_0x2b1a1c){if(_0x2b1a1c){var _0x1eead9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1eead9[_0x389e('0x19')](_0x17056c)){return _0x4f3d35;}else{throw new db[(_0x389e('0x1a'))][(_0x389e('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 _0x4f3d35;}}function respondWithRpcPromise(_0x4676e0,_0x249975,_0x3b8b51,_0x13a726){return new BPromise(function(_0x417490,_0x4cf7ac){var _0x301431=_0x13a726||client;return _0x301431[_0x389e('0x1c')](_0x4676e0,_0x3b8b51)[_0x389e('0x1d')](function(_0x441192){logger[_0x389e('0x1e')](_0x389e('0x1f'),_0x249975,_0x389e('0x20'));logger['debug'](_0x389e('0x21'),_0x249975,'request\x20sent',JSON[_0x389e('0x22')](_0x441192));if(_0x441192[_0x389e('0x23')]){if(_0x441192[_0x389e('0x23')][_0x389e('0x24')]===0x1f4){logger[_0x389e('0x23')](_0x389e('0x1f'),_0x249975,_0x441192['error'][_0x389e('0x25')]);return _0x4cf7ac(_0x441192['error'][_0x389e('0x25')]);}logger[_0x389e('0x23')](_0x389e('0x1f'),_0x249975,_0x441192[_0x389e('0x23')]['message']);return _0x417490(_0x441192[_0x389e('0x23')]['message']);}else{logger[_0x389e('0x1e')](_0x389e('0x1f'),_0x249975,_0x389e('0x20'));_0x417490(_0x441192[_0x389e('0x26')][_0x389e('0x25')]);}})[_0x389e('0x27')](function(_0x21fda9){logger[_0x389e('0x23')](_0x389e('0x1f'),_0x249975,_0x21fda9);_0x4cf7ac(_0x21fda9);});});}function respondWithStatusCode(_0x18b814,_0x54db65){_0x54db65=_0x54db65||0xcc;return function(_0x43a161){if(_0x43a161){return _0x18b814[_0x389e('0x28')](_0x54db65);}return _0x18b814[_0x389e('0x29')](_0x54db65)['end']();};}function respondWithResult(_0x46db3f,_0x44af2d){_0x44af2d=_0x44af2d||0xc8;return function(_0x9d0ede){if(_0x9d0ede){return _0x46db3f[_0x389e('0x29')](_0x44af2d)[_0x389e('0x2a')](_0x9d0ede);}};}function respondWithFilteredResult(_0x107cbe,_0x4b42e8){return function(_0x51307e){if(_0x51307e){var _0x69f977=_0x51307e[_0x389e('0x2b')],_0x420a0d=_0x4b42e8[_0x389e('0x2c')],_0x59578a=_0x4b42e8[_0x389e('0x2c')]+_0x4b42e8['limit'],_0x4dc832;if(_0x59578a>=_0x69f977){_0x59578a=_0x69f977;_0x4dc832=0xc8;}else{_0x4dc832=0xce;}_0x107cbe[_0x389e('0x29')](_0x4dc832);return _0x107cbe[_0x389e('0x2d')]('Content-Range',_0x420a0d+'-'+_0x59578a+'/'+_0x69f977)[_0x389e('0x2a')](_0x51307e);}return null;};}function patchUpdates(_0x164873){return function(_0x566e03){try{jsonpatch['apply'](_0x566e03,_0x164873,!![]);}catch(_0x5e16b2){return BPromise[_0x389e('0x2e')](_0x5e16b2);}return _0x566e03[_0x389e('0x2f')]();};}function saveUpdates(_0x192bd7,_0x8ae077){return function(_0x444f94){if(_0x444f94){return _0x444f94['update'](_0x192bd7)[_0x389e('0x1d')](function(_0x297743){return _0x297743;});}return null;};}function removeEntity(_0x3e0a87,_0x2858cb){return function(_0x5361ff){if(_0x5361ff){return _0x5361ff[_0x389e('0x30')]()[_0x389e('0x1d')](function(){_0x3e0a87[_0x389e('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2115cc,_0x27db87){return function(_0xc390a8){if(!_0xc390a8){_0x2115cc[_0x389e('0x28')](0x194);}return _0xc390a8;};}function handleError(_0x5455ce,_0x265b6f){_0x265b6f=_0x265b6f||0x1f4;return function(_0x172eaf){logger[_0x389e('0x23')](_0x172eaf[_0x389e('0x31')]);if(_0x172eaf[_0x389e('0x32')]){delete _0x172eaf[_0x389e('0x32')];}_0x5455ce[_0x389e('0x29')](_0x265b6f)['send'](_0x172eaf);};}exports[_0x389e('0x33')]=function(_0xa8ca79,_0x50d828){var _0x35ba62={},_0x469fc9={},_0x23c816={'count':0x0,'rows':[]};var _0x1e4658=_[_0x389e('0x34')](db['Setting'][_0x389e('0x35')],function(_0x19ed26){return{'name':_0x19ed26[_0x389e('0x36')],'type':_0x19ed26[_0x389e('0x37')]['key']};});_0x469fc9[_0x389e('0x38')]=_['map'](_0x1e4658,_0x389e('0x32'));_0x469fc9['query']=_[_0x389e('0x39')](_0xa8ca79[_0x389e('0x3a')]);_0x469fc9[_0x389e('0x3b')]=_[_0x389e('0x3c')](_0x469fc9['model'],_0x469fc9['query']);_0x35ba62['attributes']=_[_0x389e('0x3c')](_0x469fc9['model'],qs[_0x389e('0x3d')](_0xa8ca79[_0x389e('0x3a')]['fields']));_0x35ba62[_0x389e('0x3e')]=_0x35ba62[_0x389e('0x3e')][_0x389e('0x3f')]?_0x35ba62[_0x389e('0x3e')]:_0x469fc9[_0x389e('0x38')];if(!_0xa8ca79['query'][_0x389e('0x40')](_0x389e('0x41'))){_0x35ba62[_0x389e('0x42')]=qs[_0x389e('0x42')](_0xa8ca79[_0x389e('0x3a')]['limit']);_0x35ba62['offset']=qs[_0x389e('0x2c')](_0xa8ca79[_0x389e('0x3a')]['offset']);}_0x35ba62['order']=qs['sort'](_0xa8ca79[_0x389e('0x3a')][_0x389e('0x43')]);_0x35ba62[_0x389e('0x44')]=qs[_0x389e('0x3b')](_[_0x389e('0x45')](_0xa8ca79[_0x389e('0x3a')],_0x469fc9['filters']),_0x1e4658);if(_0xa8ca79[_0x389e('0x3a')]['filter']){_0x35ba62[_0x389e('0x44')]=_['merge'](_0x35ba62[_0x389e('0x44')],{'$or':_[_0x389e('0x34')](_0x1e4658,function(_0x2904fc){if(_0x2904fc[_0x389e('0x37')]!==_0x389e('0x46')){var _0x2bb954={};_0x2bb954[_0x2904fc[_0x389e('0x32')]]={'$like':'%'+_0xa8ca79['query'][_0x389e('0x47')]+'%'};return _0x2bb954;}})});}_0x35ba62=_[_0x389e('0x48')]({},_0x35ba62,_0xa8ca79['options']);var _0x46fc00={'where':_0x35ba62['where']};return db[_0x389e('0x49')][_0x389e('0x2b')](_0x46fc00)[_0x389e('0x1d')](function(_0x44e9ec){_0x23c816[_0x389e('0x2b')]=_0x44e9ec;if(_0xa8ca79[_0x389e('0x3a')][_0x389e('0x4a')]){_0x35ba62[_0x389e('0x4b')]=[{'all':!![]}];}return db[_0x389e('0x49')]['findAll'](_0x35ba62);})[_0x389e('0x1d')](function(_0x260675){_0x23c816['rows']=_0x260675;return _0x23c816;})[_0x389e('0x1d')](respondWithFilteredResult(_0x50d828,_0x35ba62))[_0x389e('0x27')](handleError(_0x50d828,null));};exports[_0x389e('0x4c')]=function(_0x536e29,_0x3e5fa0){var _0x28053d={'raw':![],'where':{'id':_0x536e29[_0x389e('0x4d')]['id']}},_0xef208d={};_0xef208d[_0x389e('0x38')]=_[_0x389e('0x39')](db[_0x389e('0x49')][_0x389e('0x35')]);_0xef208d['query']=_[_0x389e('0x39')](_0x536e29['query']);_0xef208d[_0x389e('0x3b')]=_[_0x389e('0x3c')](_0xef208d[_0x389e('0x38')],_0xef208d[_0x389e('0x3a')]);_0x28053d['attributes']=_[_0x389e('0x3c')](_0xef208d[_0x389e('0x38')],qs[_0x389e('0x3d')](_0x536e29[_0x389e('0x3a')]['fields']));_0x28053d[_0x389e('0x3e')]=_0x28053d[_0x389e('0x3e')]['length']?_0x28053d[_0x389e('0x3e')]:_0xef208d[_0x389e('0x38')];if(_0x536e29['query'][_0x389e('0x4a')]){_0x28053d[_0x389e('0x4b')]=[{'all':!![]}];}_0x28053d=_[_0x389e('0x48')]({},_0x28053d,_0x536e29[_0x389e('0x4e')]);return db[_0x389e('0x49')][_0x389e('0x4f')](_0x28053d)[_0x389e('0x1d')](handleEntityNotFound(_0x3e5fa0,null))['then'](respondWithResult(_0x3e5fa0,null))[_0x389e('0x27')](handleError(_0x3e5fa0,null));};exports[_0x389e('0x50')]=function(_0x3bb45c,_0x2dd64){if(_0x3bb45c[_0x389e('0x51')]['id']){delete _0x3bb45c[_0x389e('0x51')]['id'];}return db[_0x389e('0x49')][_0x389e('0x4f')]({'where':{'id':_0x3bb45c[_0x389e('0x4d')]['id']}})[_0x389e('0x1d')](handleEntityNotFound(_0x2dd64,null))[_0x389e('0x1d')](saveUpdates(_0x3bb45c[_0x389e('0x51')],null))[_0x389e('0x1d')](respondWithResult(_0x2dd64,null))[_0x389e('0x27')](handleError(_0x2dd64,null));};exports[_0x389e('0x52')]=function(_0x58cefa,_0x55a33d,_0x59d351){if(_0x58cefa['file']&&_0x58cefa[_0x389e('0x53')][_0x389e('0x54')]){_0x58cefa[_0x389e('0x51')]['logo']=_0x58cefa[_0x389e('0x53')][_0x389e('0x54')];}return db[_0x389e('0x49')]['find']({'where':{'id':_0x58cefa[_0x389e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x55a33d,null))[_0x389e('0x1d')](saveUpdates(_0x58cefa[_0x389e('0x51')],null))[_0x389e('0x1d')](respondWithResult(_0x55a33d,null))['catch'](handleError(_0x55a33d,null));};exports[_0x389e('0x55')]=function(_0x1ba1e3,_0x5bacda,_0x409ab7){if(_0x1ba1e3[_0x389e('0x53')]&&_0x1ba1e3[_0x389e('0x53')][_0x389e('0x54')]){_0x1ba1e3[_0x389e('0x51')][_0x389e('0x56')]=_0x1ba1e3[_0x389e('0x53')][_0x389e('0x54')];}return db[_0x389e('0x49')][_0x389e('0x4f')]({'where':{'id':_0x1ba1e3['params']['id']}})['then'](handleEntityNotFound(_0x5bacda,null))[_0x389e('0x1d')](saveUpdates(_0x1ba1e3[_0x389e('0x51')],null))[_0x389e('0x1d')](respondWithResult(_0x5bacda,null))[_0x389e('0x27')](handleError(_0x5bacda,null));};var utilLicense=require(_0x389e('0x57'));exports[_0x389e('0x58')]=function(_0xed3a2b,_0x551e75,_0x2940eb){var _0x3086c1=_0x389e('0x59');var _0x55b6bb={'custom':![]};return utilLicense[_0x389e('0x5a')]()['then'](function(_0x287288){if(_0x287288){_0x55b6bb=_0x287288;}return db[_0x389e('0x49')]['find']({'where':{'id':_0xed3a2b[_0x389e('0x4d')]['id']},'attributes':[_0x389e('0x5b'),_0x389e('0x56'),_0x389e('0x5c'),'favicon','defaultLogo',_0x389e('0x5d'),_0x389e('0x5e'),'defaultFavicon'],'raw':!![]});})[_0x389e('0x1d')](handleEntityNotFound(_0x551e75,null))[_0x389e('0x1d')](function(_0x1f0510){if(_0x1f0510){var _0x13d615=_0x1f0510[_0x389e('0x5b')]&&fs[_0x389e('0x5f')](path[_0x389e('0x60')](config[_0x389e('0x61')],_0x3086c1,_[_0x389e('0x62')](_0x1f0510['logo'])))?path[_0x389e('0x60')](config[_0x389e('0x61')],_0x3086c1,_['toLower'](_0x1f0510['logo'])):path[_0x389e('0x60')](config[_0x389e('0x61')],_0x3086c1,_[_0x389e('0x62')](_0x389e('0x63')));var _0x480060='default'+_[_0x389e('0x64')]('logo');if(_0x1f0510[_0x480060]||!_0x55b6bb[_0x389e('0x65')]){_0x13d615=path['join'](config[_0x389e('0x61')],_0x3086c1,_['toLower'](_0x389e('0x63')));}if(!fs['existsSync'](_0x13d615)){throw new db[(_0x389e('0x1a'))][(_0x389e('0x1b'))](_['upperFirst'](_0x389e('0x5b'))+_0x389e('0x66'));}return _0x551e75['download'](_0x13d615);}})[_0x389e('0x27')](handleError(_0x551e75,null));};var utilLicense=require(_0x389e('0x57'));exports[_0x389e('0x67')]=function(_0x282a6b,_0x2e64c5,_0x478f5a){var _0x2a49f3=_0x389e('0x59');var _0x289dcd={'custom':![]};return utilLicense[_0x389e('0x5a')]()['then'](function(_0xf51fb6){if(_0xf51fb6){_0x289dcd=_0xf51fb6;}return db['Setting']['find']({'where':{'id':_0x282a6b[_0x389e('0x4d')]['id']},'attributes':[_0x389e('0x5b'),_0x389e('0x56'),_0x389e('0x5c'),_0x389e('0x68'),_0x389e('0x69'),'defaultLoginLogo',_0x389e('0x5e'),_0x389e('0x6a')],'raw':!![]});})[_0x389e('0x1d')](handleEntityNotFound(_0x2e64c5,null))[_0x389e('0x1d')](function(_0xd136f5){if(_0xd136f5){var _0x3b4f0d=_0xd136f5[_0x389e('0x56')]&&fs[_0x389e('0x5f')](path[_0x389e('0x60')](config[_0x389e('0x61')],_0x2a49f3,_['toLower'](_0xd136f5['loginLogo'])))?path['join'](config[_0x389e('0x61')],_0x2a49f3,_[_0x389e('0x62')](_0xd136f5[_0x389e('0x56')])):path[_0x389e('0x60')](config[_0x389e('0x61')],_0x2a49f3,_[_0x389e('0x62')](_0x389e('0x6b')));var _0x3c3044=_0x389e('0x6c')+_[_0x389e('0x64')](_0x389e('0x56'));if(_0xd136f5[_0x3c3044]||!_0x289dcd[_0x389e('0x65')]){_0x3b4f0d=path[_0x389e('0x60')](config[_0x389e('0x61')],_0x2a49f3,_[_0x389e('0x62')](_0x389e('0x6b')));}if(!fs['existsSync'](_0x3b4f0d)){throw new db[(_0x389e('0x1a'))][(_0x389e('0x1b'))](_[_0x389e('0x64')](_0x389e('0x56'))+_0x389e('0x66'));}return _0x2e64c5[_0x389e('0x6d')](_0x3b4f0d);}})[_0x389e('0x27')](handleError(_0x2e64c5,null));};exports[_0x389e('0x6e')]=function(_0x2b7514,_0x27ce26){return db[_0x389e('0x49')][_0x389e('0x4f')]({'where':{'id':_0x2b7514[_0x389e('0x4d')]['id']},'attributes':[_0x389e('0x6f')]})['then'](respondWithResult(_0x27ce26,null))['catch'](handleError(_0x27ce26,null));};exports[_0x389e('0x70')]=function(_0xba7ce2,_0x31bef3,_0x22770c){if(_0xba7ce2[_0x389e('0x53')]&&_0xba7ce2[_0x389e('0x53')][_0x389e('0x54')]){_0xba7ce2[_0x389e('0x51')][_0x389e('0x5c')]=_0xba7ce2['file']['filename'];}return db[_0x389e('0x49')][_0x389e('0x4f')]({'where':{'id':_0xba7ce2[_0x389e('0x4d')]['id']}})[_0x389e('0x1d')](handleEntityNotFound(_0x31bef3,null))[_0x389e('0x1d')](saveUpdates(_0xba7ce2[_0x389e('0x51')],null))[_0x389e('0x1d')](respondWithResult(_0x31bef3,null))['catch'](handleError(_0x31bef3,null));};var utilLicense=require('../../config/license/util');exports[_0x389e('0x71')]=function(_0x331c31,_0x4eee40,_0xd01455){var _0x22db6b=_0x389e('0x59');var _0x57738b={'custom':![]};return utilLicense['getLicense']()[_0x389e('0x1d')](function(_0x160be3){if(_0x160be3){_0x57738b=_0x160be3;}return db[_0x389e('0x49')][_0x389e('0x4f')]({'where':{'id':_0x331c31[_0x389e('0x4d')]['id']},'attributes':['logo','loginLogo',_0x389e('0x5c'),_0x389e('0x68'),_0x389e('0x69'),_0x389e('0x5d'),'defaultPreferred','defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x4eee40,null))[_0x389e('0x1d')](function(_0xb7d0fe){if(_0xb7d0fe){var _0x24d5c4=_0xb7d0fe[_0x389e('0x5c')]&&fs[_0x389e('0x5f')](path[_0x389e('0x60')](config[_0x389e('0x61')],_0x22db6b,_[_0x389e('0x62')](_0xb7d0fe[_0x389e('0x5c')])))?path['join'](config['root'],_0x22db6b,_['toLower'](_0xb7d0fe[_0x389e('0x5c')])):path[_0x389e('0x60')](config['root'],_0x22db6b,_[_0x389e('0x62')](_0x389e('0x72')));var _0x37491a='default'+_[_0x389e('0x64')](_0x389e('0x5c'));if(_0xb7d0fe[_0x37491a]||!_0x57738b[_0x389e('0x65')]||!_0x57738b[_0x389e('0x5c')]){_0x24d5c4=path[_0x389e('0x60')](config['root'],_0x22db6b,_['toLower']('default_preferred.png'));}if(!fs[_0x389e('0x5f')](_0x24d5c4)){throw new db[(_0x389e('0x1a'))][(_0x389e('0x1b'))](_[_0x389e('0x64')]('preferred')+_0x389e('0x66'));}return _0x4eee40[_0x389e('0x6d')](_0x24d5c4);}})['catch'](handleError(_0x4eee40,null));};exports[_0x389e('0x73')]=function(_0x3913e8,_0xb051e6,_0x5528fb){if(_0x3913e8[_0x389e('0x53')]&&_0x3913e8[_0x389e('0x53')][_0x389e('0x54')]){_0x3913e8[_0x389e('0x51')][_0x389e('0x68')]=_0x3913e8[_0x389e('0x53')][_0x389e('0x54')];}return db[_0x389e('0x49')]['find']({'where':{'id':_0x3913e8[_0x389e('0x4d')]['id']}})[_0x389e('0x1d')](handleEntityNotFound(_0xb051e6,null))[_0x389e('0x1d')](saveUpdates(_0x3913e8[_0x389e('0x51')],null))[_0x389e('0x1d')](respondWithResult(_0xb051e6,null))['catch'](handleError(_0xb051e6,null));};var utilLicense=require(_0x389e('0x57'));exports['getFavicon']=function(_0xa98bc1,_0x54396c,_0x459f49){var _0x55401d=_0x389e('0x59');var _0x22db4f={'custom':![]};return utilLicense[_0x389e('0x5a')]()[_0x389e('0x1d')](function(_0x20f0b7){if(_0x20f0b7){_0x22db4f=_0x20f0b7;}return db['Setting']['find']({'where':{'id':_0xa98bc1[_0x389e('0x4d')]['id']},'attributes':[_0x389e('0x5b'),'loginLogo','preferred',_0x389e('0x68'),_0x389e('0x69'),_0x389e('0x5d'),_0x389e('0x5e'),_0x389e('0x6a')],'raw':!![]});})['then'](handleEntityNotFound(_0x54396c,null))['then'](function(_0x48d2f6){if(_0x48d2f6){var _0x298b9a=_0x48d2f6['favicon']&&fs['existsSync'](path['join'](config[_0x389e('0x61')],_0x55401d,_[_0x389e('0x62')](_0x48d2f6[_0x389e('0x68')])))?path[_0x389e('0x60')](config[_0x389e('0x61')],_0x55401d,_[_0x389e('0x62')](_0x48d2f6[_0x389e('0x68')])):path['join'](config[_0x389e('0x61')],_0x55401d,_[_0x389e('0x62')](_0x389e('0x74')));var _0x2a8598=_0x389e('0x6c')+_[_0x389e('0x64')]('favicon');if(_0x48d2f6[_0x2a8598]||!_0x22db4f[_0x389e('0x65')]){_0x298b9a=path['join'](config['root'],_0x55401d,_[_0x389e('0x62')](_0x389e('0x74')));}if(!fs[_0x389e('0x5f')](_0x298b9a)){throw new db[(_0x389e('0x1a'))]['ValidationError'](_[_0x389e('0x64')]('favicon')+_0x389e('0x66'));}return _0x54396c[_0x389e('0x6d')](_0x298b9a);}})[_0x389e('0x27')](handleError(_0x54396c,null));}; \ No newline at end of file +var _0x2952=['../../config/license/util','getLogo','getLicense','preferred','favicon','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.png','default','upperFirst','custom','\x20not\x20found','download','getLogoLogin','defaultLogo','default_loginLogo.png','gdpr','securePassword','addPreferred','getPreferred','server/files/images/logos','default_preferred.png','addFavicon','default_favicon.ico','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','path','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','destroy','stack','name','send','index','map','Setting','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','type','options','includeAll','include','params','keys','body','find','addLogo','file','filename','logo','loginLogo'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x2952,0x170));var _0x2295=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x2952[_0x1da527];return _0x40fc7c;};'use strict';var pdf=require(_0x2295('0x0'));var emlformat=require(_0x2295('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2295('0x2'));var jsonpatch=require(_0x2295('0x3'));var rp=require('request-promise');var moment=require(_0x2295('0x4'));var BPromise=require(_0x2295('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2295('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2295('0x7'));var fs=require('fs');var _=require(_0x2295('0x8'));var squel=require(_0x2295('0x9'));var crypto=require(_0x2295('0xa'));var jsforce=require(_0x2295('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x2295('0xc'));var querystring=require(_0x2295('0xd'));var Papa=require('papaparse');var Redis=require(_0x2295('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x2295('0xf'));var as=require(_0x2295('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x2295('0x11'));var config=require(_0x2295('0x12'));var db=require(_0x2295('0x13'))['db'];var jayson=require(_0x2295('0x14'));var client=jayson['client'][_0x2295('0x15')]({'port':0x232a});function checkPasswordPattern(_0x11d917,_0x2593d5,_0x29bdc8){if(_0x29bdc8){var _0x71114c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x71114c['test'](_0x2593d5)){return _0x11d917;}else{throw new db[(_0x2295('0x16'))][(_0x2295('0x17'))](_0x2295('0x18'));}}else{return _0x11d917;}}function respondWithRpcPromise(_0x313f72,_0x4340f1,_0x28a069,_0x5b2db7){return new BPromise(function(_0x1c8276,_0x12809d){var _0x45bfa0=_0x5b2db7||client;return _0x45bfa0['request'](_0x313f72,_0x28a069)[_0x2295('0x19')](function(_0x34770a){logger[_0x2295('0x1a')](_0x2295('0x1b'),_0x4340f1,'request\x20sent');logger[_0x2295('0x1c')](_0x2295('0x1d'),_0x4340f1,_0x2295('0x1e'),JSON['stringify'](_0x34770a));if(_0x34770a[_0x2295('0x1f')]){if(_0x34770a['error'][_0x2295('0x20')]===0x1f4){logger[_0x2295('0x1f')](_0x2295('0x1b'),_0x4340f1,_0x34770a['error'][_0x2295('0x21')]);return _0x12809d(_0x34770a[_0x2295('0x1f')]['message']);}logger[_0x2295('0x1f')](_0x2295('0x1b'),_0x4340f1,_0x34770a[_0x2295('0x1f')][_0x2295('0x21')]);return _0x1c8276(_0x34770a['error'][_0x2295('0x21')]);}else{logger[_0x2295('0x1a')]('Setting,\x20%s,\x20%s',_0x4340f1,_0x2295('0x1e'));_0x1c8276(_0x34770a[_0x2295('0x22')][_0x2295('0x21')]);}})[_0x2295('0x23')](function(_0x582d7a){logger[_0x2295('0x1f')](_0x2295('0x1b'),_0x4340f1,_0x582d7a);_0x12809d(_0x582d7a);});});}function respondWithStatusCode(_0x32efbd,_0xdc8475){_0xdc8475=_0xdc8475||0xcc;return function(_0x1bffd3){if(_0x1bffd3){return _0x32efbd[_0x2295('0x24')](_0xdc8475);}return _0x32efbd[_0x2295('0x25')](_0xdc8475)[_0x2295('0x26')]();};}function respondWithResult(_0x4cd7f5,_0x447ab4){_0x447ab4=_0x447ab4||0xc8;return function(_0x97e8af){if(_0x97e8af){return _0x4cd7f5[_0x2295('0x25')](_0x447ab4)[_0x2295('0x27')](_0x97e8af);}};}function respondWithFilteredResult(_0x48291d,_0xcd8c19){return function(_0x25f6b0){if(_0x25f6b0){var _0x538925=_0x25f6b0[_0x2295('0x28')],_0x12351a=_0xcd8c19[_0x2295('0x29')],_0x516164=_0xcd8c19[_0x2295('0x29')]+_0xcd8c19[_0x2295('0x2a')],_0x1d996c;if(_0x516164>=_0x538925){_0x516164=_0x538925;_0x1d996c=0xc8;}else{_0x1d996c=0xce;}_0x48291d[_0x2295('0x25')](_0x1d996c);return _0x48291d['set'](_0x2295('0x2b'),_0x12351a+'-'+_0x516164+'/'+_0x538925)[_0x2295('0x27')](_0x25f6b0);}return null;};}function patchUpdates(_0x390701){return function(_0x4fbc42){try{jsonpatch[_0x2295('0x2c')](_0x4fbc42,_0x390701,!![]);}catch(_0x598039){return BPromise['reject'](_0x598039);}return _0x4fbc42[_0x2295('0x2d')]();};}function saveUpdates(_0x4191e6,_0x3deee4){return function(_0x11ac57){if(_0x11ac57){return _0x11ac57[_0x2295('0x2e')](_0x4191e6)['then'](function(_0x2a1050){return _0x2a1050;});}return null;};}function removeEntity(_0x22d031,_0x2b9499){return function(_0x52df88){if(_0x52df88){return _0x52df88[_0x2295('0x2f')]()[_0x2295('0x19')](function(){_0x22d031[_0x2295('0x25')](0xcc)[_0x2295('0x26')]();});}};}function handleEntityNotFound(_0x41a01f,_0x1ce22c){return function(_0x2fa60d){if(!_0x2fa60d){_0x41a01f[_0x2295('0x24')](0x194);}return _0x2fa60d;};}function handleError(_0x2bb45d,_0x1a06cb){_0x1a06cb=_0x1a06cb||0x1f4;return function(_0x3f1fdd){logger[_0x2295('0x1f')](_0x3f1fdd[_0x2295('0x30')]);if(_0x3f1fdd[_0x2295('0x31')]){delete _0x3f1fdd[_0x2295('0x31')];}_0x2bb45d[_0x2295('0x25')](_0x1a06cb)[_0x2295('0x32')](_0x3f1fdd);};}exports[_0x2295('0x33')]=function(_0x54b77d,_0x40fe3b){var _0x32d8a9={},_0x4fdcee={},_0x4c2484={'count':0x0,'rows':[]};var _0x21ee30=_[_0x2295('0x34')](db[_0x2295('0x35')][_0x2295('0x36')],function(_0x5ab246){return{'name':_0x5ab246[_0x2295('0x37')],'type':_0x5ab246['type'][_0x2295('0x38')]};});_0x4fdcee[_0x2295('0x39')]=_[_0x2295('0x34')](_0x21ee30,'name');_0x4fdcee[_0x2295('0x3a')]=_['keys'](_0x54b77d[_0x2295('0x3a')]);_0x4fdcee['filters']=_[_0x2295('0x3b')](_0x4fdcee[_0x2295('0x39')],_0x4fdcee[_0x2295('0x3a')]);_0x32d8a9[_0x2295('0x3c')]=_[_0x2295('0x3b')](_0x4fdcee[_0x2295('0x39')],qs[_0x2295('0x3d')](_0x54b77d[_0x2295('0x3a')][_0x2295('0x3d')]));_0x32d8a9[_0x2295('0x3c')]=_0x32d8a9['attributes'][_0x2295('0x3e')]?_0x32d8a9['attributes']:_0x4fdcee[_0x2295('0x39')];if(!_0x54b77d['query'][_0x2295('0x3f')]('nolimit')){_0x32d8a9['limit']=qs[_0x2295('0x2a')](_0x54b77d['query']['limit']);_0x32d8a9[_0x2295('0x29')]=qs[_0x2295('0x29')](_0x54b77d[_0x2295('0x3a')][_0x2295('0x29')]);}_0x32d8a9[_0x2295('0x40')]=qs[_0x2295('0x41')](_0x54b77d['query'][_0x2295('0x41')]);_0x32d8a9['where']=qs[_0x2295('0x42')](_[_0x2295('0x43')](_0x54b77d[_0x2295('0x3a')],_0x4fdcee[_0x2295('0x42')]),_0x21ee30);if(_0x54b77d[_0x2295('0x3a')][_0x2295('0x44')]){_0x32d8a9[_0x2295('0x45')]=_[_0x2295('0x46')](_0x32d8a9[_0x2295('0x45')],{'$or':_[_0x2295('0x34')](_0x21ee30,function(_0x453d09){if(_0x453d09[_0x2295('0x47')]!=='VIRTUAL'){var _0x481f73={};_0x481f73[_0x453d09[_0x2295('0x31')]]={'$like':'%'+_0x54b77d['query'][_0x2295('0x44')]+'%'};return _0x481f73;}})});}_0x32d8a9=_[_0x2295('0x46')]({},_0x32d8a9,_0x54b77d[_0x2295('0x48')]);var _0x479dc1={'where':_0x32d8a9[_0x2295('0x45')]};return db[_0x2295('0x35')][_0x2295('0x28')](_0x479dc1)[_0x2295('0x19')](function(_0xd382cc){_0x4c2484[_0x2295('0x28')]=_0xd382cc;if(_0x54b77d[_0x2295('0x3a')][_0x2295('0x49')]){_0x32d8a9[_0x2295('0x4a')]=[{'all':!![]}];}return db[_0x2295('0x35')]['findAll'](_0x32d8a9);})['then'](function(_0x569980){_0x4c2484['rows']=_0x569980;return _0x4c2484;})[_0x2295('0x19')](respondWithFilteredResult(_0x40fe3b,_0x32d8a9))[_0x2295('0x23')](handleError(_0x40fe3b,null));};exports['show']=function(_0x2919f1,_0x1b47e9){var _0x597b10={'raw':![],'where':{'id':_0x2919f1[_0x2295('0x4b')]['id']}},_0x4c62ea={};_0x4c62ea[_0x2295('0x39')]=_[_0x2295('0x4c')](db[_0x2295('0x35')][_0x2295('0x36')]);_0x4c62ea[_0x2295('0x3a')]=_[_0x2295('0x4c')](_0x2919f1[_0x2295('0x3a')]);_0x4c62ea[_0x2295('0x42')]=_[_0x2295('0x3b')](_0x4c62ea[_0x2295('0x39')],_0x4c62ea[_0x2295('0x3a')]);_0x597b10[_0x2295('0x3c')]=_[_0x2295('0x3b')](_0x4c62ea[_0x2295('0x39')],qs[_0x2295('0x3d')](_0x2919f1[_0x2295('0x3a')]['fields']));_0x597b10[_0x2295('0x3c')]=_0x597b10[_0x2295('0x3c')][_0x2295('0x3e')]?_0x597b10[_0x2295('0x3c')]:_0x4c62ea['model'];if(_0x2919f1[_0x2295('0x3a')][_0x2295('0x49')]){_0x597b10[_0x2295('0x4a')]=[{'all':!![]}];}_0x597b10=_[_0x2295('0x46')]({},_0x597b10,_0x2919f1[_0x2295('0x48')]);return db[_0x2295('0x35')]['find'](_0x597b10)[_0x2295('0x19')](handleEntityNotFound(_0x1b47e9,null))[_0x2295('0x19')](respondWithResult(_0x1b47e9,null))[_0x2295('0x23')](handleError(_0x1b47e9,null));};exports[_0x2295('0x2e')]=function(_0x4d7e0c,_0x561ed0){if(_0x4d7e0c[_0x2295('0x4d')]['id']){delete _0x4d7e0c[_0x2295('0x4d')]['id'];}return db['Setting'][_0x2295('0x4e')]({'where':{'id':_0x4d7e0c[_0x2295('0x4b')]['id']}})[_0x2295('0x19')](handleEntityNotFound(_0x561ed0,null))[_0x2295('0x19')](saveUpdates(_0x4d7e0c['body'],null))[_0x2295('0x19')](respondWithResult(_0x561ed0,null))[_0x2295('0x23')](handleError(_0x561ed0,null));};exports[_0x2295('0x4f')]=function(_0x522d82,_0x57f121,_0x173aae){if(_0x522d82[_0x2295('0x50')]&&_0x522d82[_0x2295('0x50')][_0x2295('0x51')]){_0x522d82['body'][_0x2295('0x52')]=_0x522d82[_0x2295('0x50')][_0x2295('0x51')];}return db[_0x2295('0x35')][_0x2295('0x4e')]({'where':{'id':_0x522d82[_0x2295('0x4b')]['id']}})['then'](handleEntityNotFound(_0x57f121,null))[_0x2295('0x19')](saveUpdates(_0x522d82[_0x2295('0x4d')],null))[_0x2295('0x19')](respondWithResult(_0x57f121,null))['catch'](handleError(_0x57f121,null));};exports['addLogoLogin']=function(_0x19c54f,_0x635833,_0x19d329){if(_0x19c54f[_0x2295('0x50')]&&_0x19c54f['file'][_0x2295('0x51')]){_0x19c54f[_0x2295('0x4d')][_0x2295('0x53')]=_0x19c54f['file']['filename'];}return db[_0x2295('0x35')][_0x2295('0x4e')]({'where':{'id':_0x19c54f[_0x2295('0x4b')]['id']}})[_0x2295('0x19')](handleEntityNotFound(_0x635833,null))[_0x2295('0x19')](saveUpdates(_0x19c54f[_0x2295('0x4d')],null))[_0x2295('0x19')](respondWithResult(_0x635833,null))[_0x2295('0x23')](handleError(_0x635833,null));};var utilLicense=require(_0x2295('0x54'));exports[_0x2295('0x55')]=function(_0x3fa821,_0x1d8b2f,_0x17076d){var _0x1265a3='server/files/images/logos';var _0x343d51={'custom':![]};return utilLicense[_0x2295('0x56')]()[_0x2295('0x19')](function(_0x4175db){if(_0x4175db){_0x343d51=_0x4175db;}return db[_0x2295('0x35')][_0x2295('0x4e')]({'where':{'id':_0x3fa821[_0x2295('0x4b')]['id']},'attributes':['logo',_0x2295('0x53'),_0x2295('0x57'),_0x2295('0x58'),'defaultLogo',_0x2295('0x59'),_0x2295('0x5a'),_0x2295('0x5b')],'raw':!![]});})[_0x2295('0x19')](handleEntityNotFound(_0x1d8b2f,null))[_0x2295('0x19')](function(_0x126989){if(_0x126989){var _0x468818=_0x126989[_0x2295('0x52')]&&fs[_0x2295('0x5c')](path[_0x2295('0x5d')](config[_0x2295('0x5e')],_0x1265a3,_[_0x2295('0x5f')](_0x126989[_0x2295('0x52')])))?path[_0x2295('0x5d')](config[_0x2295('0x5e')],_0x1265a3,_[_0x2295('0x5f')](_0x126989[_0x2295('0x52')])):path[_0x2295('0x5d')](config[_0x2295('0x5e')],_0x1265a3,_[_0x2295('0x5f')](_0x2295('0x60')));var _0x39a992=_0x2295('0x61')+_[_0x2295('0x62')]('logo');if(_0x126989[_0x39a992]||!_0x343d51[_0x2295('0x63')]){_0x468818=path[_0x2295('0x5d')](config['root'],_0x1265a3,_[_0x2295('0x5f')](_0x2295('0x60')));}if(!fs['existsSync'](_0x468818)){throw new db['Sequelize'][(_0x2295('0x17'))](_[_0x2295('0x62')]('logo')+_0x2295('0x64'));}return _0x1d8b2f[_0x2295('0x65')](_0x468818);}})['catch'](handleError(_0x1d8b2f,null));};var utilLicense=require(_0x2295('0x54'));exports[_0x2295('0x66')]=function(_0x299ff6,_0x231fb7,_0x1be50d){var _0x24dc3c='server/files/images/logos';var _0x3b1338={'custom':![]};return utilLicense[_0x2295('0x56')]()['then'](function(_0x369758){if(_0x369758){_0x3b1338=_0x369758;}return db[_0x2295('0x35')]['find']({'where':{'id':_0x299ff6[_0x2295('0x4b')]['id']},'attributes':['logo',_0x2295('0x53'),_0x2295('0x57'),_0x2295('0x58'),_0x2295('0x67'),_0x2295('0x59'),'defaultPreferred',_0x2295('0x5b')],'raw':!![]});})[_0x2295('0x19')](handleEntityNotFound(_0x231fb7,null))[_0x2295('0x19')](function(_0x472050){if(_0x472050){var _0x5bf53b=_0x472050['loginLogo']&&fs['existsSync'](path[_0x2295('0x5d')](config['root'],_0x24dc3c,_[_0x2295('0x5f')](_0x472050[_0x2295('0x53')])))?path[_0x2295('0x5d')](config['root'],_0x24dc3c,_['toLower'](_0x472050[_0x2295('0x53')])):path[_0x2295('0x5d')](config[_0x2295('0x5e')],_0x24dc3c,_[_0x2295('0x5f')](_0x2295('0x68')));var _0x1705e6=_0x2295('0x61')+_[_0x2295('0x62')]('loginLogo');if(_0x472050[_0x1705e6]||!_0x3b1338[_0x2295('0x63')]){_0x5bf53b=path['join'](config['root'],_0x24dc3c,_['toLower']('default_loginLogo.png'));}if(!fs['existsSync'](_0x5bf53b)){throw new db[(_0x2295('0x16'))][(_0x2295('0x17'))](_[_0x2295('0x62')](_0x2295('0x53'))+_0x2295('0x64'));}return _0x231fb7['download'](_0x5bf53b);}})[_0x2295('0x23')](handleError(_0x231fb7,null));};exports[_0x2295('0x69')]=function(_0x435d0d,_0x12776f){return db[_0x2295('0x35')][_0x2295('0x4e')]({'where':{'id':_0x435d0d[_0x2295('0x4b')]['id']},'attributes':[_0x2295('0x6a')]})[_0x2295('0x19')](respondWithResult(_0x12776f,null))[_0x2295('0x23')](handleError(_0x12776f,null));};exports[_0x2295('0x6b')]=function(_0x1c0ec6,_0x2f24a3,_0x1b915f){if(_0x1c0ec6[_0x2295('0x50')]&&_0x1c0ec6[_0x2295('0x50')]['filename']){_0x1c0ec6[_0x2295('0x4d')]['preferred']=_0x1c0ec6[_0x2295('0x50')][_0x2295('0x51')];}return db['Setting'][_0x2295('0x4e')]({'where':{'id':_0x1c0ec6[_0x2295('0x4b')]['id']}})[_0x2295('0x19')](handleEntityNotFound(_0x2f24a3,null))[_0x2295('0x19')](saveUpdates(_0x1c0ec6[_0x2295('0x4d')],null))[_0x2295('0x19')](respondWithResult(_0x2f24a3,null))['catch'](handleError(_0x2f24a3,null));};var utilLicense=require(_0x2295('0x54'));exports[_0x2295('0x6c')]=function(_0x3e519f,_0x54da86,_0x34d9e2){var _0x5cb265=_0x2295('0x6d');var _0x5aa3c4={'custom':![]};return utilLicense[_0x2295('0x56')]()[_0x2295('0x19')](function(_0x2dcb33){if(_0x2dcb33){_0x5aa3c4=_0x2dcb33;}return db[_0x2295('0x35')]['find']({'where':{'id':_0x3e519f[_0x2295('0x4b')]['id']},'attributes':[_0x2295('0x52'),_0x2295('0x53'),_0x2295('0x57'),_0x2295('0x58'),'defaultLogo',_0x2295('0x59'),_0x2295('0x5a'),_0x2295('0x5b')],'raw':!![]});})[_0x2295('0x19')](handleEntityNotFound(_0x54da86,null))[_0x2295('0x19')](function(_0x177f2b){if(_0x177f2b){var _0x21c07a=_0x177f2b['preferred']&&fs['existsSync'](path[_0x2295('0x5d')](config['root'],_0x5cb265,_[_0x2295('0x5f')](_0x177f2b['preferred'])))?path[_0x2295('0x5d')](config[_0x2295('0x5e')],_0x5cb265,_[_0x2295('0x5f')](_0x177f2b[_0x2295('0x57')])):path[_0x2295('0x5d')](config[_0x2295('0x5e')],_0x5cb265,_[_0x2295('0x5f')]('default_preferred.png'));var _0x7d4b89=_0x2295('0x61')+_[_0x2295('0x62')](_0x2295('0x57'));if(_0x177f2b[_0x7d4b89]||!_0x5aa3c4[_0x2295('0x63')]||!_0x5aa3c4['preferred']){_0x21c07a=path[_0x2295('0x5d')](config['root'],_0x5cb265,_[_0x2295('0x5f')](_0x2295('0x6e')));}if(!fs[_0x2295('0x5c')](_0x21c07a)){throw new db['Sequelize'][(_0x2295('0x17'))](_[_0x2295('0x62')](_0x2295('0x57'))+'\x20not\x20found');}return _0x54da86[_0x2295('0x65')](_0x21c07a);}})[_0x2295('0x23')](handleError(_0x54da86,null));};exports[_0x2295('0x6f')]=function(_0x48f44b,_0x47dfde,_0xc918ef){if(_0x48f44b[_0x2295('0x50')]&&_0x48f44b[_0x2295('0x50')][_0x2295('0x51')]){_0x48f44b[_0x2295('0x4d')][_0x2295('0x58')]=_0x48f44b[_0x2295('0x50')][_0x2295('0x51')];}return db[_0x2295('0x35')]['find']({'where':{'id':_0x48f44b['params']['id']}})[_0x2295('0x19')](handleEntityNotFound(_0x47dfde,null))['then'](saveUpdates(_0x48f44b[_0x2295('0x4d')],null))[_0x2295('0x19')](respondWithResult(_0x47dfde,null))['catch'](handleError(_0x47dfde,null));};var utilLicense=require('../../config/license/util');exports['getFavicon']=function(_0x315643,_0x4abc8f,_0x1bf597){var _0x4a0dd0='server/files/images/logos';var _0x2b803c={'custom':![]};return utilLicense[_0x2295('0x56')]()[_0x2295('0x19')](function(_0x213f36){if(_0x213f36){_0x2b803c=_0x213f36;}return db[_0x2295('0x35')][_0x2295('0x4e')]({'where':{'id':_0x315643[_0x2295('0x4b')]['id']},'attributes':[_0x2295('0x52'),_0x2295('0x53'),_0x2295('0x57'),_0x2295('0x58'),_0x2295('0x67'),'defaultLoginLogo',_0x2295('0x5a'),_0x2295('0x5b')],'raw':!![]});})[_0x2295('0x19')](handleEntityNotFound(_0x4abc8f,null))['then'](function(_0x10bf48){if(_0x10bf48){var _0xb50b6f=_0x10bf48[_0x2295('0x58')]&&fs[_0x2295('0x5c')](path[_0x2295('0x5d')](config[_0x2295('0x5e')],_0x4a0dd0,_[_0x2295('0x5f')](_0x10bf48[_0x2295('0x58')])))?path[_0x2295('0x5d')](config[_0x2295('0x5e')],_0x4a0dd0,_[_0x2295('0x5f')](_0x10bf48[_0x2295('0x58')])):path[_0x2295('0x5d')](config[_0x2295('0x5e')],_0x4a0dd0,_[_0x2295('0x5f')](_0x2295('0x70')));var _0x397139=_0x2295('0x61')+_[_0x2295('0x62')](_0x2295('0x58'));if(_0x10bf48[_0x397139]||!_0x2b803c[_0x2295('0x63')]){_0xb50b6f=path['join'](config[_0x2295('0x5e')],_0x4a0dd0,_[_0x2295('0x5f')](_0x2295('0x70')));}if(!fs[_0x2295('0x5c')](_0xb50b6f)){throw new db[(_0x2295('0x16'))][(_0x2295('0x17'))](_[_0x2295('0x62')](_0x2295('0x58'))+_0x2295('0x64'));}return _0x4abc8f[_0x2295('0x65')](_0xb50b6f);}})[_0x2295('0x23')](handleError(_0x4abc8f,null));}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index a132dc1..330804d 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 _0x7993=['exports','define','Setting','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./setting.attributes'];(function(_0x546baa,_0x2a3641){var _0x3d151b=function(_0x33b758){while(--_0x33b758){_0x546baa['push'](_0x546baa['shift']());}};_0x3d151b(++_0x2a3641);}(_0x7993,0x87));var _0x3799=function(_0x5b0ac7,_0x22fd0e){_0x5b0ac7=_0x5b0ac7-0x0;var _0x3c1c4b=_0x7993[_0x5b0ac7];return _0x3c1c4b;};'use strict';var _=require(_0x3799('0x0'));var util=require(_0x3799('0x1'));var logger=require(_0x3799('0x2'))(_0x3799('0x3'));var moment=require(_0x3799('0x4'));var BPromise=require(_0x3799('0x5'));var rp=require(_0x3799('0x6'));var fs=require('fs');var path=require(_0x3799('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3799('0x8'));module[_0x3799('0x9')]=function(_0x1d764c,_0x2b251d){return _0x1d764c[_0x3799('0xa')](_0x3799('0xb'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x00aa=['define','Setting','settings','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0xb8ca57,_0x241e8b){var _0x1ceec2=function(_0x4c350c){while(--_0x4c350c){_0xb8ca57['push'](_0xb8ca57['shift']());}};_0x1ceec2(++_0x241e8b);}(_0x00aa,0x10d));var _0xa00a=function(_0x3fd3a3,_0x36c863){_0x3fd3a3=_0x3fd3a3-0x0;var _0xa3e4d5=_0x00aa[_0x3fd3a3];return _0xa3e4d5;};'use strict';var _=require(_0xa00a('0x0'));var util=require(_0xa00a('0x1'));var logger=require(_0xa00a('0x2'))(_0xa00a('0x3'));var moment=require(_0xa00a('0x4'));var BPromise=require(_0xa00a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa00a('0x6'));var rimraf=require(_0xa00a('0x7'));var config=require(_0xa00a('0x8'));var attributes=require(_0xa00a('0x9'));module[_0xa00a('0xa')]=function(_0x16d114,_0x856bcc){return _0x16d114[_0xa00a('0xb')](_0xa00a('0xc'),attributes,{'tableName':_0xa00a('0xd'),'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 dd58562..d91a45c 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 _0x3c9e=['http','request','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x342c52,_0x571d7a){var _0x3ee49a=function(_0x1c01f3){while(--_0x1c01f3){_0x342c52['push'](_0x342c52['shift']());}};_0x3ee49a(++_0x571d7a);}(_0x3c9e,0x1d8));var _0xe3c9=function(_0x4d22e0,_0x111e87){_0x4d22e0=_0x4d22e0-0x0;var _0x86684a=_0x3c9e[_0x4d22e0];return _0x86684a;};'use strict';var _=require(_0xe3c9('0x0'));var util=require(_0xe3c9('0x1'));var moment=require(_0xe3c9('0x2'));var BPromise=require(_0xe3c9('0x3'));var rs=require(_0xe3c9('0x4'));var fs=require('fs');var Redis=require(_0xe3c9('0x5'));var db=require(_0xe3c9('0x6'))['db'];var utils=require(_0xe3c9('0x7'));var logger=require(_0xe3c9('0x8'))('rpc');var config=require(_0xe3c9('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe3c9('0xa')][_0xe3c9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35de7c,_0x3c27f6,_0x1a3336){return new BPromise(function(_0x4ef5e5,_0x47f17d){return client[_0xe3c9('0xc')](_0x35de7c,_0x1a3336)['then'](function(_0x28352e){logger['info'](_0xe3c9('0xd'),_0x3c27f6,_0xe3c9('0xe'));logger[_0xe3c9('0xf')](_0xe3c9('0x10'),_0x3c27f6,_0xe3c9('0xe'),JSON[_0xe3c9('0x11')](_0x28352e));if(_0x28352e[_0xe3c9('0x12')]){if(_0x28352e['error'][_0xe3c9('0x13')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x3c27f6,_0x28352e['error'][_0xe3c9('0x14')]);return _0x47f17d(_0x28352e['error'][_0xe3c9('0x14')]);}logger[_0xe3c9('0x12')](_0xe3c9('0xd'),_0x3c27f6,_0x28352e[_0xe3c9('0x12')]['message']);return _0x4ef5e5(_0x28352e['error'][_0xe3c9('0x14')]);}else{logger[_0xe3c9('0x15')](_0xe3c9('0xd'),_0x3c27f6,_0xe3c9('0xe'));_0x4ef5e5(_0x28352e['result'][_0xe3c9('0x14')]);}})[_0xe3c9('0x16')](function(_0x25a6a6){logger[_0xe3c9('0x12')]('Setting,\x20%s,\x20%s',_0x3c27f6,_0x25a6a6);_0x47f17d(_0x25a6a6);});});} \ No newline at end of file +var _0x0913=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x25b94e,_0x522407){var _0x47e9fc=function(_0xfc52ec){while(--_0xfc52ec){_0x25b94e['push'](_0x25b94e['shift']());}};_0x47e9fc(++_0x522407);}(_0x0913,0x1ac));var _0x3091=function(_0x41ec10,_0x4c3698){_0x41ec10=_0x41ec10-0x0;var _0xbf245=_0x0913[_0x41ec10];return _0xbf245;};'use strict';var _=require(_0x3091('0x0'));var util=require(_0x3091('0x1'));var moment=require(_0x3091('0x2'));var BPromise=require(_0x3091('0x3'));var rs=require(_0x3091('0x4'));var fs=require('fs');var Redis=require(_0x3091('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3091('0x6'));var logger=require(_0x3091('0x7'))(_0x3091('0x8'));var config=require('../../config/environment');var jayson=require(_0x3091('0x9'));var client=jayson[_0x3091('0xa')][_0x3091('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x310703,_0x3d4ef9,_0x4228a7){return new BPromise(function(_0x129dab,_0x552635){return client[_0x3091('0xc')](_0x310703,_0x4228a7)[_0x3091('0xd')](function(_0x14a224){logger[_0x3091('0xe')](_0x3091('0xf'),_0x3d4ef9,_0x3091('0x10'));logger[_0x3091('0x11')](_0x3091('0x12'),_0x3d4ef9,_0x3091('0x10'),JSON[_0x3091('0x13')](_0x14a224));if(_0x14a224[_0x3091('0x14')]){if(_0x14a224[_0x3091('0x14')][_0x3091('0x15')]===0x1f4){logger[_0x3091('0x14')]('Setting,\x20%s,\x20%s',_0x3d4ef9,_0x14a224['error'][_0x3091('0x16')]);return _0x552635(_0x14a224['error'][_0x3091('0x16')]);}logger[_0x3091('0x14')](_0x3091('0xf'),_0x3d4ef9,_0x14a224[_0x3091('0x14')][_0x3091('0x16')]);return _0x129dab(_0x14a224[_0x3091('0x14')][_0x3091('0x16')]);}else{logger[_0x3091('0xe')]('Setting,\x20%s,\x20%s',_0x3d4ef9,_0x3091('0x10'));_0x129dab(_0x14a224[_0x3091('0x17')]['message']);}})[_0x3091('0x18')](function(_0x37af4f){logger[_0x3091('0x14')](_0x3091('0xf'),_0x3d4ef9,_0x37af4f);_0x552635(_0x37af4f);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 7debb51..822b8fa 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 _0x78aa=['/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','/:id/status','statusGet','/:id/users','getAgents','post','create','addAnswer','/:id/notify','addApplications','status','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions'];(function(_0x31df23,_0x46f0e1){var _0x438a31=function(_0x1d6d77){while(--_0x1d6d77){_0x31df23['push'](_0x31df23['shift']());}};_0x438a31(++_0x46f0e1);}(_0x78aa,0xa5));var _0xa78a=function(_0x4e54ea,_0x2fee48){_0x4e54ea=_0x4e54ea-0x0;var _0x1872f4=_0x78aa[_0x4e54ea];return _0x1872f4;};'use strict';var multer=require(_0xa78a('0x0'));var util=require(_0xa78a('0x1'));var path=require('path');var timeout=require(_0xa78a('0x2'));var express=require(_0xa78a('0x3'));var router=express[_0xa78a('0x4')]();var auth=require(_0xa78a('0x5'));var interaction=require(_0xa78a('0x6'));var config=require(_0xa78a('0x7'));var controller=require('./smsAccount.controller');router[_0xa78a('0x8')]('/',auth[_0xa78a('0x9')](),controller['index']);router[_0xa78a('0x8')](_0xa78a('0xa'),auth['isAuthenticated'](),controller[_0xa78a('0xb')]);router['get'](_0xa78a('0xc'),auth[_0xa78a('0x9')](),controller[_0xa78a('0xd')]);router[_0xa78a('0x8')](_0xa78a('0xe'),auth[_0xa78a('0x9')](),controller['getDispositions']);router['get'](_0xa78a('0xf'),auth[_0xa78a('0x9')](),controller[_0xa78a('0x10')]);router[_0xa78a('0x8')](_0xa78a('0x11'),auth['isAuthenticated'](),controller['getApplications']);router[_0xa78a('0x8')](_0xa78a('0x12'),auth[_0xa78a('0x9')](),controller['getInteractions']);router['get'](_0xa78a('0x13'),controller[_0xa78a('0x14')]);router[_0xa78a('0x8')](_0xa78a('0x15'),auth['isAuthenticated'](),controller[_0xa78a('0x16')]);router[_0xa78a('0x17')]('/',auth[_0xa78a('0x9')](),controller[_0xa78a('0x18')]);router['post']('/:id/dispositions',auth['isAuthenticated'](),controller['addDisposition']);router['post'](_0xa78a('0xf'),auth[_0xa78a('0x9')](),controller[_0xa78a('0x19')]);router[_0xa78a('0x17')](_0xa78a('0x1a'),controller['notify']);router[_0xa78a('0x17')](_0xa78a('0x11'),auth['isAuthenticated'](),controller[_0xa78a('0x1b')]);router['post']('/:id/send',auth[_0xa78a('0x9')](),controller['send']);router[_0xa78a('0x17')](_0xa78a('0x13'),controller[_0xa78a('0x1c')]);router[_0xa78a('0x17')](_0xa78a('0x15'),auth[_0xa78a('0x9')](),controller['addAgents']);router[_0xa78a('0x1d')](_0xa78a('0xc'),auth[_0xa78a('0x9')](),controller[_0xa78a('0x1e')]);router[_0xa78a('0x1f')]('/:id',auth[_0xa78a('0x9')](),controller[_0xa78a('0x20')]);router[_0xa78a('0x1f')](_0xa78a('0xe'),auth[_0xa78a('0x9')](),controller[_0xa78a('0x21')]);router['delete'](_0xa78a('0xf'),auth[_0xa78a('0x9')](),controller[_0xa78a('0x22')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xa78a('0x23')]);module['exports']=router; \ No newline at end of file +var _0x3fd6=['removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','getAgents','post','/:id/dispositions','addAnswer','notify','addApplications','/:id/send','send','status','addAgents','put','update','destroy','delete'];(function(_0x3ee8f0,_0x566bdc){var _0x5324f8=function(_0x176028){while(--_0x176028){_0x3ee8f0['push'](_0x3ee8f0['shift']());}};_0x5324f8(++_0x566bdc);}(_0x3fd6,0x19d));var _0x63fd=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x3fd6[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0x63fd('0x0'));var util=require(_0x63fd('0x1'));var path=require(_0x63fd('0x2'));var timeout=require(_0x63fd('0x3'));var express=require(_0x63fd('0x4'));var router=express['Router']();var auth=require(_0x63fd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x63fd('0x6'));var controller=require(_0x63fd('0x7'));router[_0x63fd('0x8')]('/',auth['isAuthenticated'](),controller[_0x63fd('0x9')]);router[_0x63fd('0x8')](_0x63fd('0xa'),auth[_0x63fd('0xb')](),controller[_0x63fd('0xc')]);router['get'](_0x63fd('0xd'),auth[_0x63fd('0xb')](),controller[_0x63fd('0xe')]);router[_0x63fd('0x8')]('/:id/dispositions',auth[_0x63fd('0xb')](),controller['getDispositions']);router[_0x63fd('0x8')](_0x63fd('0xf'),auth[_0x63fd('0xb')](),controller[_0x63fd('0x10')]);router[_0x63fd('0x8')](_0x63fd('0x11'),auth['isAuthenticated'](),controller[_0x63fd('0x12')]);router[_0x63fd('0x8')](_0x63fd('0x13'),auth[_0x63fd('0xb')](),controller[_0x63fd('0x14')]);router[_0x63fd('0x8')](_0x63fd('0x15'),controller[_0x63fd('0x16')]);router[_0x63fd('0x8')](_0x63fd('0x17'),auth[_0x63fd('0xb')](),controller[_0x63fd('0x18')]);router[_0x63fd('0x19')]('/',auth[_0x63fd('0xb')](),controller['create']);router[_0x63fd('0x19')](_0x63fd('0x1a'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x63fd('0x19')](_0x63fd('0xf'),auth['isAuthenticated'](),controller[_0x63fd('0x1b')]);router[_0x63fd('0x19')]('/:id/notify',controller[_0x63fd('0x1c')]);router['post'](_0x63fd('0x11'),auth[_0x63fd('0xb')](),controller[_0x63fd('0x1d')]);router[_0x63fd('0x19')](_0x63fd('0x1e'),auth[_0x63fd('0xb')](),controller[_0x63fd('0x1f')]);router['post'](_0x63fd('0x15'),controller[_0x63fd('0x20')]);router[_0x63fd('0x19')](_0x63fd('0x17'),auth[_0x63fd('0xb')](),controller[_0x63fd('0x21')]);router[_0x63fd('0x22')](_0x63fd('0xd'),auth[_0x63fd('0xb')](),controller[_0x63fd('0x23')]);router['delete'](_0x63fd('0xd'),auth[_0x63fd('0xb')](),controller[_0x63fd('0x24')]);router[_0x63fd('0x25')](_0x63fd('0x1a'),auth[_0x63fd('0xb')](),controller['removeDispositions']);router[_0x63fd('0x25')](_0x63fd('0xf'),auth[_0x63fd('0xb')](),controller[_0x63fd('0x26')]);router[_0x63fd('0x25')](_0x63fd('0x17'),auth[_0x63fd('0xb')](),controller[_0x63fd('0x27')]);module[_0x63fd('0x28')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 6f42f4e..cc1e3c4 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 _0xfc9f=['exports','STRING','name','generate','twilio','skebby','connectel','plivo','clickatell','csc','infobip','intelepeer','ENUM','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring'];(function(_0x3b1bcb,_0x34f49e){var _0x5d2085=function(_0x4993df){while(--_0x4993df){_0x3b1bcb['push'](_0x3b1bcb['shift']());}};_0x5d2085(++_0x34f49e);}(_0xfc9f,0x1e2));var _0xffc9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfc9f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xffc9('0x0'));var rs=require(_0xffc9('0x1'));module[_0xffc9('0x2')]={'name':{'type':Sequelize[_0xffc9('0x3')],'unique':_0xffc9('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xffc9('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xffc9('0x3')],'defaultValue':function(){return rs[_0xffc9('0x5')]();}},'phone':{'type':Sequelize[_0xffc9('0x3')]},'type':{'type':Sequelize['ENUM'](_0xffc9('0x6'),_0xffc9('0x7'),_0xffc9('0x8'),'clicksend',_0xffc9('0x9'),_0xffc9('0xa'),_0xffc9('0xb'),_0xffc9('0xc'),_0xffc9('0xd'))},'accountSid':{'type':Sequelize[_0xffc9('0x3')]},'authId':{'type':Sequelize[_0xffc9('0x3')]},'authToken':{'type':Sequelize[_0xffc9('0x3')]},'smsMethod':{'type':Sequelize[_0xffc9('0xe')]('SI','TI','GP')},'username':{'type':Sequelize[_0xffc9('0x3')]},'password':{'type':Sequelize[_0xffc9('0x3')]},'apiKey':{'type':Sequelize[_0xffc9('0x3')]},'senderString':{'type':Sequelize[_0xffc9('0x3')]},'deliveryReport':{'type':Sequelize[_0xffc9('0xf')],'defaultValue':![]},'description':{'type':Sequelize[_0xffc9('0x3')]},'notificationTemplate':{'type':Sequelize[_0xffc9('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xffc9('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xffc9('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xffc9('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xffc9('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xffc9('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xffc9('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xffc9('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xffc9('0x11')],'comment':_0xffc9('0x12')},'mandatoryDisposition':{'type':Sequelize[_0xffc9('0xf')],'defaultValue':![],'comment':_0xffc9('0x13'),'set':function(_0x231d35){if(!_0x231d35)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xffc9('0x14')](_0xffc9('0x15'),_0x231d35);}}}; \ No newline at end of file +var _0x483b=['connectel','clicksend','plivo','clickatell','csc','infobip','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','name','STRING','generate','ENUM','skebby'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0x483b,0xbf));var _0xb483=function(_0x40bed8,_0x3b1b0a){_0x40bed8=_0x40bed8-0x0;var _0x40b4e9=_0x483b[_0x40bed8];return _0x40b4e9;};'use strict';var Sequelize=require(_0xb483('0x0'));var rs=require('randomstring');module[_0xb483('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb483('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xb483('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xb483('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xb483('0x3')],'defaultValue':function(){return rs[_0xb483('0x4')]();}},'phone':{'type':Sequelize[_0xb483('0x3')]},'type':{'type':Sequelize[_0xb483('0x5')]('twilio',_0xb483('0x6'),_0xb483('0x7'),_0xb483('0x8'),_0xb483('0x9'),_0xb483('0xa'),_0xb483('0xb'),_0xb483('0xc'),'intelepeer')},'accountSid':{'type':Sequelize[_0xb483('0x3')]},'authId':{'type':Sequelize[_0xb483('0x3')]},'authToken':{'type':Sequelize[_0xb483('0x3')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0xb483('0x3')]},'password':{'type':Sequelize[_0xb483('0x3')]},'apiKey':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xb483('0x3')]},'deliveryReport':{'type':Sequelize[_0xb483('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0xb483('0x3')]},'notificationTemplate':{'type':Sequelize[_0xb483('0xe')],'defaultValue':function(){return _0xb483('0xf');}},'notificationSound':{'type':Sequelize[_0xb483('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb483('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb483('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb483('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xb483('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb483('0x10')],'comment':_0xb483('0x11')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xb483('0x12'),'set':function(_0x43c687){if(!_0x43c687)this[_0xb483('0x13')](_0xb483('0x14'),null);this[_0xb483('0x13')](_0xb483('0x15'),_0x43c687);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index c7c39d7..68edc3e 100644 --- a/server/api/smsAccount/smsAccount.controller.js +++ b/server/api/smsAccount/smsAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['show','params','fields','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','nolimit','sort','pick','rows','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','notify','sms','account','applications','orderBy','Applications','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','mobile','twilio','from','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','plivo','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','updatedAt','list','omit','contact','SmsInteraction','spread','interaction','autoclose','push','close','unmanaged','*,*,*,*','created','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','debug','entity\x20found','stringify','Content-Type','text/xml','addApplications','sequelize','transaction','SmsApplication','bulkCreate','findAndCountAll','priority','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','to\x20is\x20mandatory','List','DESC','dataValues','Messages','log','endpoint\x20/status\x20POST\x20/','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','requestid','status_code','groupName','intelepeer','DELIVERED','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','message-id','state','addAgents','emit','removeAgents','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','test','ValidationError','then','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','apply','save','destroy','SmsAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','hasOwnProperty','limit','order','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x5bc75a,_0x38ce5c){var _0x51abb3=function(_0x2622c0){while(--_0x2622c0){_0x5bc75a['push'](_0x5bc75a['shift']());}};_0x51abb3(++_0x38ce5c);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];config[_0x7995('0x1a')]=_[_0x7995('0x1b')](config[_0x7995('0x1a')],{'host':_0x7995('0x1c'),'port':0x18eb});var socket=require(_0x7995('0x1d'))(new Redis(config[_0x7995('0x1a')]));require('./smsAccount.socket')['register'](socket);var jayson=require(_0x7995('0x1e'));var client=jayson[_0x7995('0x1f')][_0x7995('0x20')]({'port':0x232c});function checkPasswordPattern(_0x321ae8,_0x3f1d3e,_0x1a5310){if(_0x1a5310){var _0x2202ce=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2202ce[_0x7995('0x21')](_0x3f1d3e)){return _0x321ae8;}else{throw new db['Sequelize'][(_0x7995('0x22'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x321ae8;}}function respondWithRpcPromise(_0x2f832e,_0x37f297,_0x43d4b8,_0x291317){return new BPromise(function(_0x1e1415,_0x37a7d4){var _0x4faa60=_0x291317||client;return _0x4faa60['request'](_0x2f832e,_0x43d4b8)[_0x7995('0x23')](function(_0x5e6f90){logger['info'](_0x7995('0x24'),_0x37f297,_0x7995('0x25'));logger['debug'](_0x7995('0x26'),_0x37f297,'request\x20sent',JSON['stringify'](_0x5e6f90));if(_0x5e6f90[_0x7995('0x27')]){if(_0x5e6f90[_0x7995('0x27')][_0x7995('0x28')]===0x1f4){logger[_0x7995('0x27')](_0x7995('0x24'),_0x37f297,_0x5e6f90[_0x7995('0x27')]['message']);return _0x37a7d4(_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);}logger[_0x7995('0x27')](_0x7995('0x24'),_0x37f297,_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);return _0x1e1415(_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);}else{logger['info'](_0x7995('0x24'),_0x37f297,_0x7995('0x25'));_0x1e1415(_0x5e6f90[_0x7995('0x2a')][_0x7995('0x29')]);}})[_0x7995('0x2b')](function(_0x2a307e){logger['error'](_0x7995('0x24'),_0x37f297,_0x2a307e);_0x37a7d4(_0x2a307e);});});}function respondWithStatusCode(_0x5911c3,_0x229742){_0x229742=_0x229742||0xcc;return function(_0x49bc7e){if(_0x49bc7e){return _0x5911c3[_0x7995('0x2c')](_0x229742);}return _0x5911c3[_0x7995('0x2d')](_0x229742)[_0x7995('0x2e')]();};}function respondWithResult(_0x4b6f99,_0x9b2a15){_0x9b2a15=_0x9b2a15||0xc8;return function(_0x514445){if(_0x514445){return _0x4b6f99[_0x7995('0x2d')](_0x9b2a15)[_0x7995('0x2f')](_0x514445);}};}function respondWithFilteredResult(_0x4253e5,_0x574574){return function(_0x530611){if(_0x530611){var _0x48e573=_0x530611[_0x7995('0x30')],_0x3573be=_0x574574[_0x7995('0x31')],_0xe6b0b3=_0x574574[_0x7995('0x31')]+_0x574574['limit'],_0x327a81;if(_0xe6b0b3>=_0x48e573){_0xe6b0b3=_0x48e573;_0x327a81=0xc8;}else{_0x327a81=0xce;}_0x4253e5['status'](_0x327a81);return _0x4253e5[_0x7995('0x32')]('Content-Range',_0x3573be+'-'+_0xe6b0b3+'/'+_0x48e573)[_0x7995('0x2f')](_0x530611);}return null;};}function patchUpdates(_0x3eb566){return function(_0x29fac5){try{jsonpatch[_0x7995('0x33')](_0x29fac5,_0x3eb566,!![]);}catch(_0x1f7d27){return BPromise['reject'](_0x1f7d27);}return _0x29fac5[_0x7995('0x34')]();};}function saveUpdates(_0x33e24e,_0x5dd802){return function(_0x48db25){if(_0x48db25){return _0x48db25['update'](_0x33e24e)[_0x7995('0x23')](function(_0x3acfc3){return _0x3acfc3;});}return null;};}function removeEntity(_0x4a176f,_0x3e7020){return function(_0x51b95d){if(_0x51b95d){return _0x51b95d[_0x7995('0x35')]()[_0x7995('0x23')](function(){var _0x177cb4=_0x51b95d['get']({'plain':!![]});var _0x52d76d=_0x7995('0x36');return db['UserProfileResource']['destroy']({'where':{'type':_0x52d76d,'resourceId':_0x177cb4['id']}})[_0x7995('0x23')](function(){return _0x51b95d;});})[_0x7995('0x23')](function(){_0x4a176f['status'](0xcc)[_0x7995('0x2e')]();});}};}function handleEntityNotFound(_0x1922b4,_0x2b772f){return function(_0x18667c){if(!_0x18667c){_0x1922b4[_0x7995('0x2c')](0x194);}return _0x18667c;};}function handleError(_0x53002a,_0x2d4285){_0x2d4285=_0x2d4285||0x1f4;return function(_0x242713){logger[_0x7995('0x27')](_0x242713[_0x7995('0x37')]);if(_0x242713['name']){delete _0x242713[_0x7995('0x38')];}_0x53002a[_0x7995('0x2d')](_0x2d4285)[_0x7995('0x39')](_0x242713);};}exports[_0x7995('0x3a')]=function(_0x1f5bee,_0x1035dc){var _0x5688a1={'include':[{'model':db[_0x7995('0x3b')],'as':_0x7995('0x3c')}]},_0x183a68={},_0x3be298={'count':0x0,'rows':[]};var _0x2e04cd=_[_0x7995('0x3d')](db[_0x7995('0x3e')][_0x7995('0x3f')],function(_0x1234e1){return{'name':_0x1234e1[_0x7995('0x40')],'type':_0x1234e1[_0x7995('0x41')][_0x7995('0x42')]};});_0x183a68[_0x7995('0x43')]=_['map'](_0x2e04cd,'name');_0x183a68[_0x7995('0x44')]=_[_0x7995('0x45')](_0x1f5bee['query']);_0x183a68['filters']=_[_0x7995('0x46')](_0x183a68['model'],_0x183a68['query']);_0x5688a1[_0x7995('0x47')]=_[_0x7995('0x46')](_0x183a68[_0x7995('0x43')],qs['fields'](_0x1f5bee[_0x7995('0x44')]['fields']));_0x5688a1[_0x7995('0x47')]=_0x5688a1['attributes']['length']?_0x5688a1[_0x7995('0x47')]:_0x183a68[_0x7995('0x43')];if(!_0x1f5bee[_0x7995('0x44')][_0x7995('0x48')]('nolimit')){_0x5688a1[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x1f5bee[_0x7995('0x44')][_0x7995('0x49')]);_0x5688a1['offset']=qs['offset'](_0x1f5bee[_0x7995('0x44')]['offset']);}_0x5688a1[_0x7995('0x4a')]=qs['sort'](_0x1f5bee[_0x7995('0x44')]['sort']);_0x5688a1[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_['pick'](_0x1f5bee[_0x7995('0x44')],_0x183a68[_0x7995('0x4c')]),_0x2e04cd);if(_0x1f5bee[_0x7995('0x44')][_0x7995('0x4d')]){_0x5688a1['where']=_[_0x7995('0x4e')](_0x5688a1[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x2e04cd,function(_0x491184){if(_0x491184[_0x7995('0x41')]!==_0x7995('0x4f')){var _0x511567={};_0x511567[_0x491184[_0x7995('0x38')]]={'$like':'%'+_0x1f5bee[_0x7995('0x44')]['filter']+'%'};return _0x511567;}})});}_0x5688a1=_[_0x7995('0x4e')]({},_0x5688a1,_0x1f5bee[_0x7995('0x50')]);var _0x5921b9={'where':_0x5688a1[_0x7995('0x4b')]};return db['SmsAccount'][_0x7995('0x30')](_0x5921b9)[_0x7995('0x23')](function(_0x1afab4){_0x3be298[_0x7995('0x30')]=_0x1afab4;if(_0x1f5bee[_0x7995('0x44')][_0x7995('0x51')]){_0x5688a1[_0x7995('0x52')]=[{'all':!![]}];}return db['SmsAccount'][_0x7995('0x53')](_0x5688a1);})[_0x7995('0x23')](function(_0x418eb9){_0x3be298['rows']=_0x418eb9;return _0x3be298;})[_0x7995('0x23')](respondWithFilteredResult(_0x1035dc,_0x5688a1))[_0x7995('0x2b')](handleError(_0x1035dc,null));};exports[_0x7995('0x54')]=function(_0x47d1d8,_0x4ec548){var _0x5a592e={'raw':![],'where':{'id':_0x47d1d8[_0x7995('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x7995('0x3c')}]},_0xb70620={};_0xb70620[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0x3e')][_0x7995('0x3f')]);_0xb70620['query']=_[_0x7995('0x45')](_0x47d1d8['query']);_0xb70620[_0x7995('0x4c')]=_[_0x7995('0x46')](_0xb70620[_0x7995('0x43')],_0xb70620['query']);_0x5a592e['attributes']=_['intersection'](_0xb70620['model'],qs[_0x7995('0x56')](_0x47d1d8[_0x7995('0x44')][_0x7995('0x56')]));_0x5a592e[_0x7995('0x47')]=_0x5a592e[_0x7995('0x47')][_0x7995('0x57')]?_0x5a592e[_0x7995('0x47')]:_0xb70620[_0x7995('0x43')];if(_0x47d1d8[_0x7995('0x44')][_0x7995('0x51')]){_0x5a592e[_0x7995('0x52')]=[{'all':!![]}];}_0x5a592e=_[_0x7995('0x4e')]({},_0x5a592e,_0x47d1d8[_0x7995('0x50')]);return db[_0x7995('0x3e')][_0x7995('0x58')](_0x5a592e)[_0x7995('0x23')](handleEntityNotFound(_0x4ec548,null))[_0x7995('0x23')](respondWithResult(_0x4ec548,null))[_0x7995('0x2b')](handleError(_0x4ec548,null));};exports[_0x7995('0x59')]=function(_0x50b7c2,_0x56a374){return db[_0x7995('0x3e')][_0x7995('0x59')](_0x50b7c2[_0x7995('0x5a')],{})['then'](function(_0x53125a){var _0x402fa0=_0x50b7c2[_0x7995('0x5b')][_0x7995('0x5c')]({'plain':!![]});if(!_0x402fa0)throw new Error(_0x7995('0x5d'));if(_0x402fa0['role']===_0x7995('0x5b')){var _0x74ff38=_0x53125a[_0x7995('0x5c')]({'plain':!![]});var _0x33c49c='SmsAccounts';return db['UserProfileSection'][_0x7995('0x58')]({'where':{'name':_0x33c49c,'userProfileId':_0x402fa0[_0x7995('0x5e')]},'raw':!![]})[_0x7995('0x23')](function(_0x1d69ce){if(_0x1d69ce&&_0x1d69ce[_0x7995('0x5f')]===0x0){return db[_0x7995('0x60')][_0x7995('0x59')]({'name':_0x74ff38[_0x7995('0x38')],'resourceId':_0x74ff38['id'],'type':_0x1d69ce[_0x7995('0x38')],'sectionId':_0x1d69ce['id']},{})['then'](function(){return _0x53125a;});}else{return _0x53125a;}})[_0x7995('0x2b')](function(_0x3ec5a8){logger[_0x7995('0x27')](_0x7995('0x61'),_0x3ec5a8);throw _0x3ec5a8;});}return _0x53125a;})['then'](respondWithResult(_0x56a374,0xc9))['catch'](handleError(_0x56a374,null));};exports[_0x7995('0x62')]=function(_0xebb5c8,_0x47d5d7){if(_0xebb5c8[_0x7995('0x5a')]['id']){delete _0xebb5c8[_0x7995('0x5a')]['id'];}return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0xebb5c8[_0x7995('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x7995('0x3c')}]})['then'](handleEntityNotFound(_0x47d5d7,null))[_0x7995('0x23')](saveUpdates(_0xebb5c8[_0x7995('0x5a')],null))[_0x7995('0x23')](respondWithResult(_0x47d5d7,null))[_0x7995('0x2b')](handleError(_0x47d5d7,null));};exports[_0x7995('0x35')]=function(_0xeb8920,_0x2b3c1d){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0xeb8920[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x2b3c1d,null))[_0x7995('0x23')](removeEntity(_0x2b3c1d,null))['catch'](handleError(_0x2b3c1d,null));};exports[_0x7995('0x63')]=function(_0x23bbc1,_0x293480){return db[_0x7995('0x3e')][_0x7995('0x63')]()['then'](respondWithResult(_0x293480,null))['catch'](handleError(_0x293480,null));};exports[_0x7995('0x64')]=function(_0x87e38d,_0x221542,_0xae6166){if(_0x87e38d['body']['id']){delete _0x87e38d[_0x7995('0x5a')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x87e38d[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x221542,null))[_0x7995('0x23')](function(_0x44bf2b){if(_0x44bf2b){_0x87e38d[_0x7995('0x5a')][_0x7995('0x65')]=_0x44bf2b['id'];return db[_0x7995('0x66')][_0x7995('0x59')](_0x87e38d[_0x7995('0x5a')]);}})[_0x7995('0x23')](respondWithResult(_0x221542,null))['catch'](handleError(_0x221542,null));};exports[_0x7995('0x67')]=function(_0x8908cd,_0x3c5802,_0x4cc247){var _0x1fe1cb={'raw':![],'where':{}};var _0x1d2f9d={};var _0x705f0={'count':0x0,'rows':[]};return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x8908cd[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x3c5802,null))[_0x7995('0x23')](function(_0x2f94c4){if(_0x2f94c4){_0x1d2f9d[_0x7995('0x43')]=_[_0x7995('0x45')](db['Disposition']['rawAttributes']);_0x1d2f9d[_0x7995('0x44')]=_[_0x7995('0x45')](_0x8908cd[_0x7995('0x44')]);_0x1d2f9d[_0x7995('0x4c')]=_['intersection'](_0x1d2f9d[_0x7995('0x43')],_0x1d2f9d[_0x7995('0x44')]);_0x1fe1cb['attributes']=_['intersection'](_0x1d2f9d[_0x7995('0x43')],qs[_0x7995('0x56')](_0x8908cd['query'][_0x7995('0x56')]));_0x1fe1cb['attributes']=_0x1fe1cb[_0x7995('0x47')][_0x7995('0x57')]?_0x1fe1cb['attributes']:_0x1d2f9d['model'];if(!_0x8908cd[_0x7995('0x44')]['hasOwnProperty'](_0x7995('0x69'))){_0x1fe1cb[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x8908cd[_0x7995('0x44')][_0x7995('0x49')]);_0x1fe1cb[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x8908cd[_0x7995('0x44')][_0x7995('0x31')]);}_0x1fe1cb[_0x7995('0x4a')]=qs[_0x7995('0x6a')](_0x8908cd[_0x7995('0x44')][_0x7995('0x6a')]);_0x1fe1cb[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x8908cd[_0x7995('0x44')],_0x1d2f9d[_0x7995('0x4c')]));_0x1fe1cb[_0x7995('0x4b')][_0x7995('0x65')]=_0x2f94c4['id'];if(_0x8908cd[_0x7995('0x44')][_0x7995('0x4d')]){_0x1fe1cb[_0x7995('0x4b')]=_[_0x7995('0x4e')](_0x1fe1cb[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x1fe1cb[_0x7995('0x47')],function(_0x34724d){var _0x59efff={};_0x59efff[_0x34724d]={'$like':'%'+_0x8908cd[_0x7995('0x44')][_0x7995('0x4d')]+'%'};return _0x59efff;})});}_0x1fe1cb=_['merge']({},_0x1fe1cb,_0x8908cd['options']);return db[_0x7995('0x66')][_0x7995('0x30')]({'where':_0x1fe1cb[_0x7995('0x4b')]})[_0x7995('0x23')](function(_0xe1ce4){_0x705f0[_0x7995('0x30')]=_0xe1ce4;if(_0x8908cd['query'][_0x7995('0x51')]){_0x1fe1cb[_0x7995('0x52')]=[{'all':!![]}];}return db[_0x7995('0x66')][_0x7995('0x53')](_0x1fe1cb);})[_0x7995('0x23')](function(_0x3f0bff){_0x705f0[_0x7995('0x6c')]=_0x3f0bff;return _0x705f0;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x3c5802,_0x1fe1cb))['catch'](handleError(_0x3c5802,null));};exports[_0x7995('0x6d')]=function(_0x2b8217,_0x5c04c9,_0x479271){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x2b8217[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x5c04c9,null))[_0x7995('0x23')](function(_0x4a02ea){if(_0x4a02ea){return _0x4a02ea[_0x7995('0x6d')](_0x2b8217[_0x7995('0x44')]['ids']);}})[_0x7995('0x23')](respondWithStatusCode(_0x5c04c9,null))[_0x7995('0x2b')](handleError(_0x5c04c9,null));};exports['addAnswer']=function(_0x1535a3,_0x4a5bc5,_0x135191){if(_0x1535a3[_0x7995('0x5a')]['id']){delete _0x1535a3[_0x7995('0x5a')]['id'];}return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x1535a3['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x4a5bc5,null))[_0x7995('0x23')](function(_0x38b37f){if(_0x38b37f){_0x1535a3['body'][_0x7995('0x65')]=_0x38b37f['id'];return db[_0x7995('0x6e')][_0x7995('0x59')](_0x1535a3[_0x7995('0x5a')]);}})['then'](respondWithResult(_0x4a5bc5,null))[_0x7995('0x2b')](handleError(_0x4a5bc5,null));};exports[_0x7995('0x6f')]=function(_0x3a5f5e,_0x4aafa3,_0x5358d4){var _0x3fc10={'raw':![],'where':{}};var _0x333379={};var _0x4800a8={'count':0x0,'rows':[]};return db['SmsAccount'][_0x7995('0x68')]({'where':{'id':_0x3a5f5e[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x4aafa3,null))[_0x7995('0x23')](function(_0x2ba606){if(_0x2ba606){_0x333379['model']=_['keys'](db[_0x7995('0x6e')]['rawAttributes']);_0x333379['query']=_[_0x7995('0x45')](_0x3a5f5e[_0x7995('0x44')]);_0x333379[_0x7995('0x4c')]=_['intersection'](_0x333379[_0x7995('0x43')],_0x333379[_0x7995('0x44')]);_0x3fc10[_0x7995('0x47')]=_[_0x7995('0x46')](_0x333379[_0x7995('0x43')],qs['fields'](_0x3a5f5e[_0x7995('0x44')][_0x7995('0x56')]));_0x3fc10[_0x7995('0x47')]=_0x3fc10[_0x7995('0x47')]['length']?_0x3fc10[_0x7995('0x47')]:_0x333379[_0x7995('0x43')];if(!_0x3a5f5e['query'][_0x7995('0x48')](_0x7995('0x69'))){_0x3fc10['limit']=qs[_0x7995('0x49')](_0x3a5f5e['query'][_0x7995('0x49')]);_0x3fc10['offset']=qs[_0x7995('0x31')](_0x3a5f5e['query'][_0x7995('0x31')]);}_0x3fc10[_0x7995('0x4a')]=qs['sort'](_0x3a5f5e[_0x7995('0x44')]['sort']);_0x3fc10['where']=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x3a5f5e[_0x7995('0x44')],_0x333379[_0x7995('0x4c')]));_0x3fc10['where'][_0x7995('0x65')]=_0x2ba606['id'];if(_0x3a5f5e[_0x7995('0x44')]['filter']){_0x3fc10['where']=_[_0x7995('0x4e')](_0x3fc10['where'],{'$or':_[_0x7995('0x3d')](_0x3fc10[_0x7995('0x47')],function(_0xfb4479){var _0x5b42be={};_0x5b42be[_0xfb4479]={'$like':'%'+_0x3a5f5e['query'][_0x7995('0x4d')]+'%'};return _0x5b42be;})});}_0x3fc10=_['merge']({},_0x3fc10,_0x3a5f5e[_0x7995('0x50')]);return db[_0x7995('0x6e')][_0x7995('0x30')]({'where':_0x3fc10[_0x7995('0x4b')]})['then'](function(_0x52d102){_0x4800a8['count']=_0x52d102;if(_0x3a5f5e[_0x7995('0x44')][_0x7995('0x51')]){_0x3fc10[_0x7995('0x52')]=[{'all':!![]}];}return db[_0x7995('0x6e')][_0x7995('0x53')](_0x3fc10);})[_0x7995('0x23')](function(_0x59a793){_0x4800a8['rows']=_0x59a793;return _0x4800a8;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x4aafa3,_0x3fc10))['catch'](handleError(_0x4aafa3,null));};exports['removeAnswers']=function(_0x17d00f,_0x5e95c0,_0x57a164){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x17d00f[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x5e95c0,null))[_0x7995('0x23')](function(_0xf604d9){if(_0xf604d9){return _0xf604d9[_0x7995('0x70')](_0x17d00f[_0x7995('0x44')][_0x7995('0x71')]);}})[_0x7995('0x23')](respondWithStatusCode(_0x5e95c0,null))[_0x7995('0x2b')](handleError(_0x5e95c0,null));};exports[_0x7995('0x72')]=function(_0x19d746,_0x570b71,_0x3eb3fa){var _0x87a539={'channel':_0x7995('0x73')};var _0x2056da=[];var _0x2a01d4=[];var _0x5a4695={};return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x19d746[_0x7995('0x55')]['id']},'include':[{'model':db['SmsApplication'],'as':'Applications'}]})['then'](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x17f7d6){_0x87a539[_0x7995('0x74')]=_0x17f7d6;_0x87a539[_0x7995('0x75')]=_[_0x7995('0x76')](_0x17f7d6[_0x7995('0x77')],['priority'],[_0x7995('0x78')]);if(_0x87a539['account'][_0x7995('0x77')]){delete _0x87a539[_0x7995('0x74')][_0x7995('0x77')];}return db[_0x7995('0x79')][_0x7995('0x63')]();})[_0x7995('0x23')](function(_0x4f929b){if(!_0x4f929b){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x7b'));}_0x2056da=_[_0x7995('0x7c')](_['keys'](_0x4f929b),[_0x7995('0x7d'),'updatedAt']);_0x2a01d4=_[_0x7995('0x7c')](_[_0x7995('0x45')](_0x4f929b),['createdAt','updatedAt',_0x7995('0x7e'),_0x7995('0x7f')]);_0x87a539[_0x7995('0x5a')]={'mapKey':_0x7995('0x80')};if(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]){switch(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]){case _0x7995('0x81'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['From'];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x83')];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746['body'][_0x7995('0x85')];break;case _0x7995('0x86'):_0x87a539['body'][_0x7995('0x82')]='+'+_0x19d746['body'][_0x7995('0x87')];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746['body'][_0x7995('0x88')];break;case _0x7995('0x89'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')]['body']=_0x19d746['body']['message'];break;case _0x7995('0x8a'):_0x87a539[_0x7995('0x5a')]['from']=_0x19d746['body'][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')]['body']=_0x19d746['body']['body'];_0x87a539['body'][_0x7995('0x84')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x8b')];break;case _0x7995('0x8c'):_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['From'];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')]['Text'];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746['body'][_0x7995('0x8d')];break;case _0x7995('0x8e'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]='+'+_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x88')];_0x87a539[_0x7995('0x5a')]['messageId']=_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x84')];break;case _0x7995('0x90'):_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x91')];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x92')][_0x7995('0x29')];break;case _0x7995('0x93'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746['body'][_0x7995('0x94')];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x88')];_0x87a539['body'][_0x7995('0x84')]=_0x19d746['body']['replyMessageId'];break;case'intelepeer':_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['from'];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746['body'][_0x7995('0x29')];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x95')];break;}}if(_0x87a539['body']['id']){delete _0x87a539[_0x7995('0x5a')]['id'];}if(_[_0x7995('0x96')](_0x87a539[_0x7995('0x5a')][_0x7995('0x82')])){throw new db['Sequelize'][(_0x7995('0x22'))](_0x7995('0x97'));}if(_[_0x7995('0x96')](_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')])||_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]===''){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x98'));}if(_['isNil'](_0x87a539[_0x7995('0x5a')]['mapKey'])){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x99')+_0x2a01d4);}if(!_['includes'](_0x2a01d4,_0x87a539['body'][_0x7995('0x9a')])){throw new db[(_0x7995('0x7a'))]['ValidationError'](_0x7995('0x9b')+_0x2a01d4);}_0x5a4695[_0x87a539['body'][_0x7995('0x9a')]]=_0x87a539[_0x7995('0x5a')][_0x7995('0x82')];return db[_0x7995('0x9c')]['find']({'where':{'id':_0x87a539['account'][_0x7995('0x7f')]},'include':[{'model':db[_0x7995('0x79')],'as':_0x7995('0x9d'),'where':_0x5a4695,'limit':0x1,'order':[[_0x7995('0x9e'),'DESC']]}]});})[_0x7995('0x23')](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x8b820b){if(_0x8b820b){_0x87a539[_0x7995('0x9f')]=_[_0x7995('0xa0')](_0x8b820b,['Contacts']);if(_0x8b820b['Contacts']['length']){return _0x8b820b[_0x7995('0x9d')][0x0];}var _0x24a3cf=_['defaults'](_0x87a539[_0x7995('0x5a')],{'firstName':_0x87a539['body'][_0x7995('0x82')],'ListId':_0x8b820b['id']});_0x24a3cf[_0x87a539[_0x7995('0x5a')][_0x7995('0x9a')]]=_0x87a539[_0x7995('0x5a')]['from'];return db[_0x7995('0x79')][_0x7995('0x59')](_0x24a3cf,{'fields':_0x2056da,'raw':!![]});}})[_0x7995('0x23')](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x2023a7){if(_0x2023a7){_0x87a539[_0x7995('0xa1')]=_0x2023a7;var _0x1d200d={'ContactId':_0x2023a7['id'],'phone':_0x87a539[_0x7995('0x5a')][_0x7995('0x82')],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id']};var _0x30893a={'ContactId':_0x2023a7['id'],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id'],'closed':![]};return db[_0x7995('0xa2')][_0x7995('0x58')]({'where':_0x30893a})['then'](function(_0x764245){if(_0x764245){return[_0x764245,![]];}return db['SmsInteraction'][_0x7995('0x59')](_0x1d200d)[_0x7995('0x23')](function(_0x5cf7b2){return[_0x5cf7b2,!![]];});});}})[_0x7995('0xa3')](function(_0x55dc6c,_0x17c3f9){_0x87a539[_0x7995('0xa4')]=_0x55dc6c['get']({'plain':!![]});_0x87a539['interaction']['created']=![];if(_0x17c3f9){if(_0x87a539[_0x7995('0x74')][_0x7995('0xa5')]){_0x87a539[_0x7995('0x75')][_0x7995('0xa6')]({'id':0x0,'priority':_0x87a539['applications'][_0x7995('0x57')]+0x1,'app':_0x7995('0xa7'),'appdata':_0x7995('0xa8'),'interval':_0x7995('0xa9')});}_0x87a539[_0x7995('0xa4')][_0x7995('0xaa')]=!![];}return db[_0x7995('0xab')][_0x7995('0x59')]({'phone':_0x87a539['body'][_0x7995('0x82')],'messageId':_0x87a539[_0x7995('0x5a')][_0x7995('0x84')],'body':_0x87a539[_0x7995('0x5a')]['body'],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id'],'SmsInteractionId':_0x55dc6c['id'],'direction':'in','ContactId':_0x55dc6c[_0x7995('0xac')],'AttachmentId':_0x87a539[_0x7995('0x5a')][_0x7995('0xad')]});})[_0x7995('0x23')](function(_0x2e7416){_0x87a539['message']=_0x2e7416;if(_0x87a539[_0x7995('0xa4')][_0x7995('0xae')]){return db[_0x7995('0xaf')][_0x7995('0x58')]({'attributes':['id',_0x7995('0x38')],'where':{'id':_0x87a539[_0x7995('0xa4')][_0x7995('0xae')]}})[_0x7995('0x23')](function(_0xf76f46){if(_0xf76f46){_0x87a539[_0x7995('0x75')][_0x7995('0xb0')]({'id':0x0,'priority':0x0,'app':_0x7995('0xb1'),'appdata':_0xf76f46[_0x7995('0x38')]+','+(_0x87a539[_0x7995('0x74')][_0x7995('0xb2')]||0xa),'interval':_0x7995('0xa9')});}return respondWithRpcPromise(_0x7995('0xb3'),_0x7995('0xb4'),_0x87a539);});}return respondWithRpcPromise(_0x7995('0xb3'),_0x7995('0xb4'),_0x87a539);})[_0x7995('0x23')](function(_0x51f854){if(_0x51f854){var _0x4cf7f1=0xc8;var _0x1a980b=_0x7995('0xb5');logger['info'](_0x7995('0x26'),_0x1a980b,_0x4cf7f1,'entity\x20found');logger[_0x7995('0xb6')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x1a980b,_0x4cf7f1,_0x7995('0xb7'),JSON[_0x7995('0xb8')](_0x51f854));if(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]===_0x7995('0x81')){return _0x570b71[_0x7995('0x2d')](_0x4cf7f1)[_0x7995('0x32')](_0x7995('0xb9'),_0x7995('0xba'))[_0x7995('0x39')]('\x0a');}else{return _0x570b71[_0x7995('0x2d')](_0x4cf7f1)[_0x7995('0x2f')](_0x51f854);}}})[_0x7995('0x2b')](handleError(_0x570b71,null));};exports[_0x7995('0xbb')]=function(_0x54b803,_0x408c22,_0x1d2afe){return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x54b803['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x408c22,null))[_0x7995('0x23')](function(_0x31d0e9){if(_0x31d0e9){return db[_0x7995('0xbc')][_0x7995('0xbd')](function(_0x13dda4){return db[_0x7995('0xbe')][_0x7995('0x35')]({'where':{'SmsAccountId':_0x54b803[_0x7995('0x55')]['id']},'transaction':_0x13dda4})['then'](function(_0x3c81cc){var _0x5f5496=_[_0x7995('0x3d')](_0x54b803[_0x7995('0x5a')],function(_0x35b217){_0x35b217[_0x7995('0x65')]=_0x54b803['params']['id'];return _0x35b217;});return db[_0x7995('0xbe')][_0x7995('0xbf')](_0x5f5496,{'transaction':_0x13dda4});});})[_0x7995('0x23')](function(){return db[_0x7995('0xbe')][_0x7995('0xc0')]({'where':{'SmsAccountId':_0x54b803[_0x7995('0x55')]['id']},'order':_0x7995('0xc1')});});}})[_0x7995('0x23')](respondWithResult(_0x408c22,null))[_0x7995('0x2b')](handleError(_0x408c22,null));};exports[_0x7995('0xc2')]=function(_0x45f389,_0x44d6a8,_0x7d14e2){var _0x405711={};var _0x54e341={};var _0x5cb30e;var _0xdfc11d;return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x45f389['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x44d6a8,null))[_0x7995('0x23')](function(_0x610b81){if(_0x610b81){_0x5cb30e=_0x610b81;_0x54e341['model']=_[_0x7995('0x45')](db[_0x7995('0xbe')][_0x7995('0x3f')]);_0x54e341[_0x7995('0x44')]=_[_0x7995('0x45')](_0x45f389[_0x7995('0x44')]);_0x54e341[_0x7995('0x4c')]=_[_0x7995('0x46')](_0x54e341[_0x7995('0x43')],_0x54e341[_0x7995('0x44')]);_0x405711[_0x7995('0x47')]=_['intersection'](_0x54e341['model'],qs[_0x7995('0x56')](_0x45f389['query'][_0x7995('0x56')]));_0x405711[_0x7995('0x47')]=_0x405711[_0x7995('0x47')][_0x7995('0x57')]?_0x405711[_0x7995('0x47')]:_0x54e341['model'];_0x405711['order']=qs[_0x7995('0x6a')](_0x45f389[_0x7995('0x44')][_0x7995('0x6a')]);_0x405711[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x45f389[_0x7995('0x44')],_0x54e341[_0x7995('0x4c')]));if(_0x45f389[_0x7995('0x44')][_0x7995('0x4d')]){_0x405711['where']=_[_0x7995('0x4e')](_0x405711[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x405711[_0x7995('0x47')],function(_0x511cf8){var _0x4d6da0={};_0x4d6da0[_0x511cf8]={'$like':'%'+_0x45f389['query']['filter']+'%'};return _0x4d6da0;})});}_0x405711=_['merge']({},_0x405711,_0x45f389[_0x7995('0x50')]);return _0x5cb30e['getApplications'](_0x405711);}})['then'](function(_0x32f19d){if(_0x32f19d){_0xdfc11d=_0x32f19d[_0x7995('0x57')];if(!_0x45f389[_0x7995('0x44')]['hasOwnProperty'](_0x7995('0x69'))){_0x405711['limit']=qs[_0x7995('0x49')](_0x45f389[_0x7995('0x44')][_0x7995('0x49')]);_0x405711['offset']=qs[_0x7995('0x31')](_0x45f389[_0x7995('0x44')][_0x7995('0x31')]);}return _0x5cb30e['getApplications'](_0x405711);}})[_0x7995('0x23')](function(_0x15cfd3){if(_0x15cfd3){return _0x15cfd3?{'count':_0xdfc11d,'rows':_0x15cfd3}:null;}})[_0x7995('0x23')](respondWithResult(_0x44d6a8,null))[_0x7995('0x2b')](handleError(_0x44d6a8,null));};exports[_0x7995('0xc3')]=function(_0x574e2a,_0x1761e1,_0x2a4991){var _0xc8bbb4={'raw':![],'where':{}};var _0x484b6c={};var _0x20852c={'count':0x0,'rows':[]};return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x574e2a[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1761e1,null))['then'](function(_0x2995a3){if(_0x2995a3){_0x484b6c[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0xa2')][_0x7995('0x3f')]);_0x484b6c[_0x7995('0x44')]=_[_0x7995('0x45')](_0x574e2a['query']);_0x484b6c['filters']=_[_0x7995('0x46')](_0x484b6c[_0x7995('0x43')],_0x484b6c['query']);_0xc8bbb4['attributes']=_[_0x7995('0x46')](_0x484b6c[_0x7995('0x43')],qs[_0x7995('0x56')](_0x574e2a[_0x7995('0x44')][_0x7995('0x56')]));_0xc8bbb4[_0x7995('0x47')]=_0xc8bbb4[_0x7995('0x47')]['length']?_0xc8bbb4[_0x7995('0x47')]:_0x484b6c[_0x7995('0x43')];if(!_0x574e2a[_0x7995('0x44')][_0x7995('0x48')](_0x7995('0x69'))){_0xc8bbb4[_0x7995('0x49')]=qs['limit'](_0x574e2a[_0x7995('0x44')][_0x7995('0x49')]);_0xc8bbb4[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x574e2a[_0x7995('0x44')][_0x7995('0x31')]);}_0xc8bbb4[_0x7995('0x4a')]=qs['sort'](_0x574e2a[_0x7995('0x44')][_0x7995('0x6a')]);_0xc8bbb4[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_['pick'](_0x574e2a[_0x7995('0x44')],_0x484b6c['filters']));_0xc8bbb4[_0x7995('0x4b')][_0x7995('0x65')]=_0x2995a3['id'];if(_0x574e2a['query']['filter']){_0xc8bbb4['where']=_[_0x7995('0x4e')](_0xc8bbb4[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0xc8bbb4[_0x7995('0x47')],function(_0x503b32){var _0x2da21e={};_0x2da21e[_0x503b32]={'$like':'%'+_0x574e2a[_0x7995('0x44')][_0x7995('0x4d')]+'%'};return _0x2da21e;})});}_0xc8bbb4=_[_0x7995('0x4e')]({},_0xc8bbb4,_0x574e2a[_0x7995('0x50')]);return db[_0x7995('0xa2')][_0x7995('0x30')]({'where':_0xc8bbb4['where']})['then'](function(_0x2695eb){_0x20852c['count']=_0x2695eb;if(_0x574e2a['query'][_0x7995('0x51')]){_0xc8bbb4[_0x7995('0x52')]=[{'model':db[_0x7995('0x79')],'as':_0x7995('0xc4'),'required':![]},{'model':db[_0x7995('0xaf')],'as':_0x7995('0xc5'),'attributes':[_0x7995('0x38'),_0x7995('0xc6'),_0x7995('0xc7')],'required':![]},{'model':db[_0x7995('0xc8')],'as':_0x7995('0xc9'),'attributes':['id',_0x7995('0x38'),'color'],'where':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]?{'id':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]}:undefined,'required':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]?!![]:![]}];}return db[_0x7995('0xa2')]['findAll'](_0xc8bbb4);})[_0x7995('0x23')](function(_0x234832){_0x20852c[_0x7995('0x6c')]=_0x234832;return _0x20852c;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x1761e1,_0xc8bbb4))[_0x7995('0x2b')](handleError(_0x1761e1,null));};exports['send']=function(_0x2d1c14,_0x5e7fde,_0x156b65){var _0x12f4c5,_0x221be8,_0x5150aa;if(_[_0x7995('0x96')](_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')])||_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')]===''){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2d1c14[_0x7995('0x5a')]['to'])){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0xcb'));}_0x12f4c5=_0x2d1c14[_0x7995('0x5a')]['to'];return db[_0x7995('0x3e')]['find']({'where':{'id':_0x2d1c14[_0x7995('0x55')]['id']},'include':[{'model':db[_0x7995('0x9c')],'as':_0x7995('0xcc'),'include':[{'model':db[_0x7995('0x79')],'as':'Contacts','where':{'mobile':_0x12f4c5},'limit':0x1,'order':[['updatedAt',_0x7995('0xcd')]]}]}]})[_0x7995('0x23')](handleEntityNotFound(_0x5e7fde,null))['then'](function(_0x3130f2){if(_0x3130f2&&_0x3130f2[_0x7995('0xcc')]){_0x221be8=_0x3130f2['get']({'plain':!![]});if(_0x221be8[_0x7995('0xcc')]&&_0x221be8[_0x7995('0xcc')][_0x7995('0x9d')][_0x7995('0x57')]){return _0x221be8[_0x7995('0xcc')]['Contacts'][0x0];}return db['CmContact'][_0x7995('0x59')](_[_0x7995('0x1b')](_0x2d1c14[_0x7995('0x5a')],{'firstName':_0x12f4c5,'mobile':_0x12f4c5,'phone':_0x12f4c5,'ListId':_0x221be8[_0x7995('0x7f')]}));}})[_0x7995('0x23')](handleEntityNotFound(_0x5e7fde,null))['then'](function(_0xd0da6e){if(_0xd0da6e){_0x5150aa=_0xd0da6e;return db[_0x7995('0xa2')][_0x7995('0x58')]({'where':{'ContactId':_0x5150aa['id'],'closed':![],'SmsAccountId':_0x221be8['id']}})[_0x7995('0x23')](function(_0x1949f5){if(_0x1949f5){return[_0x1949f5,![]];}return db['SmsInteraction']['create']({'UserId':_0x2d1c14['user']['id'],'ContactId':_0x5150aa['id'],'SmsAccountId':_0x221be8['id'],'phone':_0x12f4c5,'firstMsgDirection':'out','Messages':[_[_0x7995('0x4e')](_0x2d1c14[_0x7995('0x5a')],{'read':![],'body':_0x2d1c14['body'][_0x7995('0x5a')],'phone':_0x12f4c5,'SmsAccountId':_0x221be8['id'],'UserId':_0x2d1c14[_0x7995('0x5b')]['id'],'ContactId':_0x5150aa['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})[_0x7995('0x23')](function(_0x3ee80c){return[_0x3ee80c,!![]];});});}})[_0x7995('0xa3')](function(_0x8bd55,_0x20a056){if(_0x20a056){return _0x8bd55;}return db[_0x7995('0xab')][_0x7995('0x59')](_['merge'](_0x2d1c14['body'],{'read':![],'body':_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')],'phone':_0x12f4c5,'SmsAccountId':_0x221be8['id'],'SmsInteractionId':_0x8bd55['id'],'UserId':_0x2d1c14[_0x7995('0x5b')]['id'],'ContactId':_0x5150aa['id']}))['then'](function(_0x2f96fd){_0x8bd55[_0x7995('0xce')][_0x7995('0xcf')]=[];_0x8bd55[_0x7995('0xce')][_0x7995('0xcf')][_0x7995('0xa6')](_0x2f96fd[_0x7995('0xce')]);return _0x8bd55;});})[_0x7995('0x23')](respondWithResult(_0x5e7fde,null))[_0x7995('0x2b')](handleError(_0x5e7fde,null));};exports['status']=function(_0x5136f5,_0x1161f2,_0x4bd222){if(_0x5136f5[_0x7995('0x5a')]['id']){delete _0x5136f5['body']['id'];}console[_0x7995('0xd0')](_0x7995('0xd1'),_0x5136f5[_0x7995('0x5a')]);var _0x4a75d2,_0x4c810d,_0x1401b4;return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x5136f5[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1161f2,null))[_0x7995('0x23')](function(_0xb0164a){if(_0xb0164a){_0x1401b4=_0xb0164a;logger[_0x7995('0xb6')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0xd2'),_0xb0164a['type'],util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));switch(_0xb0164a[_0x7995('0x41')]){case _0x7995('0x86'):if(_0x5136f5[_0x7995('0x5a')]['skebby_dispatch_id']&&_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0xd4')]}});}break;case _0x7995('0x89'):if(_0x5136f5['body']['requestid']&&_0x5136f5[_0x7995('0x5a')][_0x7995('0xd5')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0xd5')];return db[_0x7995('0xab')]['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0xd6')]}});}break;case _0x7995('0x8a'):if(_0x5136f5[_0x7995('0x5a')][_0x7995('0x8b')]&&_0x5136f5[_0x7995('0x5a')][_0x7995('0xd7')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0xd7')];return db['SmsMessage']['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0x8b')]}});}break;case _0x7995('0x8e'):var _0x296643=_0x5136f5[_0x7995('0x5a')][_0x7995('0x8f')][0x0];if(_0x296643[_0x7995('0x84')]&&_0x296643[_0x7995('0x2d')]['groupName']==='DELIVERED'){_0x4c810d=_0x296643[_0x7995('0x2d')][_0x7995('0xd8')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x296643['messageId']}});}break;case'clickatell':if(_0x5136f5[_0x7995('0x5a')][_0x7995('0x84')]&&_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0x84')]}});}break;case _0x7995('0xd9'):if(_0x5136f5[_0x7995('0x5a')]['redif']&&_0x5136f5['body'][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')]['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')]['redif']}});}break;}}})[_0x7995('0x23')](handleEntityNotFound(_0x1161f2,null))[_0x7995('0x23')](function(_0x308d0e){if(_0x308d0e){_0x4a75d2=_0x308d0e;switch(_0x1401b4[_0x7995('0x41')]){case _0x7995('0x86'):if(_0x4c810d===_0x7995('0xda')){return _0x4a75d2['update']({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x86'),util['inspect'](_0x5136f5['body'],{'showHidden':![],'depth':null}));}break;case _0x7995('0x89'):if(_0x4c810d==='1'){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),'status',_0x7995('0x86'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x5136f5[_0x7995('0x5a')][_0x7995('0xdb')]&&_0x4c810d>=0xc8&&_0x4c810d<=0xce){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger['error'](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x8a'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x7995('0x8e'):var _0x1f6c3e=_0x5136f5[_0x7995('0x5a')][_0x7995('0x8f')][0x0];if(_0x1f6c3e['status'][_0x7995('0xd8')]===_0x7995('0xda')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x7995('0x2d'),_0x7995('0x8e'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x4c810d==_0x7995('0xdc')||_0x4c810d==_0x7995('0xdd')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x93'),util['inspect'](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x7995('0xd9'):if(_0x4c810d===_0x7995('0xde')||_0x4c810d===_0x7995('0xdf')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger['error'](_0x7995('0x26'),'status',_0x7995('0xd9'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x4a75d2;}})['then'](respondWithResult(_0x1161f2,null))['catch'](handleError(_0x1161f2,null));};exports['statusGet']=function(_0x21ff84,_0x1763aa,_0x32e443){var _0x35b6f9,_0x17fab0,_0x4da0e8;return db['SmsAccount'][_0x7995('0x58')]({'where':{'id':_0x21ff84[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1763aa,null))[_0x7995('0x23')](function(_0x5bc1b4){if(_0x5bc1b4){_0x4da0e8=_0x5bc1b4;logger[_0x7995('0xb6')](_0x7995('0x26'),'status',_0x7995('0xd2'),_0x5bc1b4['type'],util[_0x7995('0xd3')](_0x21ff84[_0x7995('0x44')],{'showHidden':![],'depth':null}));switch(_0x5bc1b4[_0x7995('0x41')]){case'csc':if(_0x21ff84['query'][_0x7995('0xe0')]&&_0x21ff84[_0x7995('0x44')][_0x7995('0xe1')]){_0x17fab0=_0x21ff84[_0x7995('0x44')][_0x7995('0xe1')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x21ff84[_0x7995('0x44')][_0x7995('0xe0')]}});}break;}}})[_0x7995('0x23')](handleEntityNotFound(_0x1763aa,null))[_0x7995('0x23')](function(_0x48c9fc){if(_0x48c9fc){_0x35b6f9=_0x48c9fc;switch(_0x4da0e8['type']){case _0x7995('0x90'):if(_0x17fab0==='2'||_0x17fab0==='6'){return _0x35b6f9[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),'status','csc',util[_0x7995('0xd3')](_0x21ff84[_0x7995('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x35b6f9;}})['then'](respondWithResult(_0x1763aa,null))['catch'](handleError(_0x1763aa,null));};exports[_0x7995('0xe2')]=function(_0x469cd6,_0x3ad24,_0x17c27b){return db[_0x7995('0x3e')]['find']({'where':{'id':_0x469cd6[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x3ad24,null))['then'](function(_0xf9859c){if(_0xf9859c){return _0xf9859c[_0x7995('0xe2')](_0x469cd6[_0x7995('0x5a')]['ids'],_[_0x7995('0xa0')](_0x469cd6[_0x7995('0x5a')],[_0x7995('0x71'),'id'])||{})[_0x7995('0xa3')](function(_0x113e03){for(var _0x5348b1=0x0;_0x5348b1<_0x469cd6['body'][_0x7995('0x71')]['length'];_0x5348b1+=0x1){socket[_0x7995('0xe3')]('userSmsAccount:save',{'UserId':_0x469cd6[_0x7995('0x5a')][_0x7995('0x71')][_0x5348b1],'SmsAccountId':_0x469cd6[_0x7995('0x55')]['id']});}return _0x113e03;});}})['then'](respondWithResult(_0x3ad24,null))['catch'](handleError(_0x3ad24,null));};exports['removeAgents']=function(_0x362580,_0x1da57f,_0x270ef3){return db['SmsAccount'][_0x7995('0x58')]({'where':{'id':_0x362580[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x1da57f,null))[_0x7995('0x23')](function(_0x39449e){if(_0x39449e){return _0x39449e[_0x7995('0xe4')](_0x362580[_0x7995('0x44')][_0x7995('0x71')])['then'](function(){if(_['isArray'](_0x362580[_0x7995('0x44')][_0x7995('0x71')])){for(var _0x134da2=0x0;_0x134da2<_0x362580[_0x7995('0x44')][_0x7995('0x71')][_0x7995('0x57')];_0x134da2+=0x1){socket[_0x7995('0xe3')](_0x7995('0xe5'),{'UserId':Number(_0x362580[_0x7995('0x44')][_0x7995('0x71')][_0x134da2]),'SmsAccountId':Number(_0x362580['params']['id'])});}}else{socket[_0x7995('0xe3')](_0x7995('0xe5'),{'UserId':Number(_0x362580[_0x7995('0x44')][_0x7995('0x71')]),'SmsAccountId':Number(_0x362580[_0x7995('0x55')]['id'])});}});}})[_0x7995('0x23')](respondWithStatusCode(_0x1da57f,null))[_0x7995('0x2b')](handleError(_0x1da57f,null));};exports['getAgents']=function(_0x5d0fe6,_0x43a8a4,_0x2aec8d){var _0x12df49={};var _0x1f4efc={};var _0x55ce63;var _0x572c53;return db['SmsAccount'][_0x7995('0x68')]({'where':{'id':_0x5d0fe6[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x43a8a4,null))[_0x7995('0x23')](function(_0x2265cf){if(_0x2265cf){_0x55ce63=_0x2265cf;_0x1f4efc[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0xaf')][_0x7995('0x3f')]);_0x1f4efc[_0x7995('0x44')]=_[_0x7995('0x45')](_0x5d0fe6['query']);_0x1f4efc[_0x7995('0x4c')]=_[_0x7995('0x46')](_0x1f4efc[_0x7995('0x43')],_0x1f4efc['query']);_0x12df49[_0x7995('0x47')]=_['intersection'](_0x1f4efc['model'],qs['fields'](_0x5d0fe6['query'][_0x7995('0x56')]));_0x12df49['attributes']=_0x12df49[_0x7995('0x47')][_0x7995('0x57')]?_0x12df49['attributes']:_0x1f4efc[_0x7995('0x43')];_0x12df49[_0x7995('0x4a')]=qs[_0x7995('0x6a')](_0x5d0fe6[_0x7995('0x44')]['sort']);_0x12df49[_0x7995('0x4b')]=qs['filters'](_[_0x7995('0x6b')](_0x5d0fe6[_0x7995('0x44')],_0x1f4efc[_0x7995('0x4c')]));if(_0x5d0fe6[_0x7995('0x44')][_0x7995('0x4d')]){_0x12df49[_0x7995('0x4b')]=_[_0x7995('0x4e')](_0x12df49[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x12df49[_0x7995('0x47')],function(_0x4aa202){var _0x8c9b6f={};_0x8c9b6f[_0x4aa202]={'$like':'%'+_0x5d0fe6[_0x7995('0x44')]['filter']+'%'};return _0x8c9b6f;})});}_0x12df49=_[_0x7995('0x4e')]({},_0x12df49,_0x5d0fe6[_0x7995('0x50')]);return _0x55ce63[_0x7995('0xe6')](_0x12df49);}})[_0x7995('0x23')](function(_0x1a6f42){if(_0x1a6f42){_0x572c53=_0x1a6f42[_0x7995('0x57')];if(!_0x5d0fe6['query'][_0x7995('0x48')]('nolimit')){_0x12df49[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x5d0fe6[_0x7995('0x44')][_0x7995('0x49')]);_0x12df49[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x5d0fe6['query'][_0x7995('0x31')]);}return _0x55ce63[_0x7995('0xe6')](_0x12df49);}})[_0x7995('0x23')](function(_0x4c2faf){if(_0x4c2faf){return _0x4c2faf?{'count':_0x572c53,'rows':_0x4c2faf}:null;}})[_0x7995('0x23')](respondWithResult(_0x43a8a4,null))[_0x7995('0x2b')](handleError(_0x43a8a4,null));}; \ No newline at end of file +var _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(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'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 c853f30..6ce6e32 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 _0xa8ce=['../../mysqldb','SmsAccount','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x65e216,_0x568bd5){var _0x4e3e06=function(_0x351fc0){while(--_0x351fc0){_0x65e216['push'](_0x65e216['shift']());}};_0x4e3e06(++_0x568bd5);}(_0xa8ce,0x197));var _0xea8c=function(_0x5692c2,_0x3e8b34){_0x5692c2=_0x5692c2-0x0;var _0x556903=_0xa8ce[_0x5692c2];return _0x556903;};'use strict';var EventEmitter=require(_0xea8c('0x0'));var SmsAccount=require(_0xea8c('0x1'))['db'][_0xea8c('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xea8c('0x3'),'afterDestroy':_0xea8c('0x4')};function emitEvent(_0x1fde52){return function(_0x22e4b7,_0xcae704,_0x3b7b36){SmsAccountEvents['emit'](_0x1fde52+':'+_0x22e4b7['id'],_0x22e4b7);SmsAccountEvents[_0xea8c('0x5')](_0x1fde52,_0x22e4b7);_0x3b7b36(null);};}for(var e in events){if(events[_0xea8c('0x6')](e)){var event=events[e];SmsAccount[_0xea8c('0x7')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0xc3a5=['exports','events','SmsAccount','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0xe17fa4,_0x5e9a7d){var _0x51c079=function(_0x4b8a81){while(--_0x4b8a81){_0xe17fa4['push'](_0xe17fa4['shift']());}};_0x51c079(++_0x5e9a7d);}(_0xc3a5,0x141));var _0x5c3a=function(_0x5ed142,_0x5a3522){_0x5ed142=_0x5ed142-0x0;var _0x3b2728=_0xc3a5[_0x5ed142];return _0x3b2728;};'use strict';var EventEmitter=require(_0x5c3a('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x5c3a('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x5c3a('0x2')](0x0);var events={'afterCreate':_0x5c3a('0x3'),'afterUpdate':_0x5c3a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x244e30){return function(_0x4d55e2,_0x4cc29a,_0x298dac){SmsAccountEvents[_0x5c3a('0x5')](_0x244e30+':'+_0x4d55e2['id'],_0x4d55e2);SmsAccountEvents['emit'](_0x244e30,_0x4d55e2);_0x298dac(null);};}for(var e in events){if(events[_0x5c3a('0x6')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x5c3a('0x7')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 2f29e14..9835f33 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 _0x8ef5=['rimraf','../../config/environment','./smsAccount.attributes','exports','lodash','util','../../config/logger','moment','path'];(function(_0x4c887b,_0x2ef38a){var _0x383b04=function(_0x517a7f){while(--_0x517a7f){_0x4c887b['push'](_0x4c887b['shift']());}};_0x383b04(++_0x2ef38a);}(_0x8ef5,0x175));var _0x58ef=function(_0x413e7f,_0x908f1b){_0x413e7f=_0x413e7f-0x0;var _0x4b9b88=_0x8ef5[_0x413e7f];return _0x4b9b88;};'use strict';var _=require(_0x58ef('0x0'));var util=require(_0x58ef('0x1'));var logger=require(_0x58ef('0x2'))('api');var moment=require(_0x58ef('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x58ef('0x4'));var rimraf=require(_0x58ef('0x5'));var config=require(_0x58ef('0x6'));var attributes=require(_0x58ef('0x7'));module[_0x58ef('0x8')]=function(_0x27d332,_0x59cfee){return _0x27d332['define']('SmsAccount',attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa65d=['moment','request-promise','path','rimraf','./smsAccount.attributes','define','SmsAccount','sms_accounts','lodash','../../config/logger'];(function(_0x565fce,_0x2c905b){var _0x2420a2=function(_0x389b0d){while(--_0x389b0d){_0x565fce['push'](_0x565fce['shift']());}};_0x2420a2(++_0x2c905b);}(_0xa65d,0x17a));var _0xda65=function(_0x2f610c,_0x57b378){_0x2f610c=_0x2f610c-0x0;var _0x5da954=_0xa65d[_0x2f610c];return _0x5da954;};'use strict';var _=require(_0xda65('0x0'));var util=require('util');var logger=require(_0xda65('0x1'))('api');var moment=require(_0xda65('0x2'));var BPromise=require('bluebird');var rp=require(_0xda65('0x3'));var fs=require('fs');var path=require(_0xda65('0x4'));var rimraf=require(_0xda65('0x5'));var config=require('../../config/environment');var attributes=require(_0xda65('0x6'));module['exports']=function(_0x30f241,_0x3a11c2){return _0x30f241[_0xda65('0x7')](_0xda65('0x8'),attributes,{'tableName':_0xda65('0x9'),'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 e675181..d3680c3 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 _0x0913=['defaults','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','message','SmsAccount,\x20%s,\x20%s','catch','ShowSmsAccount','SmsAccount','find','options','where','attributes','include','map','model','stringify','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0xcc69c5,_0x5b35b2){var _0x14ec59=function(_0x4377ec){while(--_0x4377ec){_0xcc69c5['push'](_0xcc69c5['shift']());}};_0x14ec59(++_0x5b35b2);}(_0x0913,0xa4));var _0x3091=function(_0x326406,_0x5aa772){_0x326406=_0x326406-0x0;var _0x30abe7=_0x0913[_0x326406];return _0x30abe7;};'use strict';var _=require('lodash');var util=require(_0x3091('0x0'));var moment=require(_0x3091('0x1'));var BPromise=require(_0x3091('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3091('0x3'));var db=require(_0x3091('0x4'))['db'];var utils=require(_0x3091('0x5'));var logger=require(_0x3091('0x6'))('rpc');var config=require(_0x3091('0x7'));var jayson=require(_0x3091('0x8'));var client=jayson[_0x3091('0x9')][_0x3091('0xa')]({'port':0x232a});config['redis']=_[_0x3091('0xb')](config[_0x3091('0xc')],{'host':_0x3091('0xd'),'port':0x18eb});var socket=require(_0x3091('0xe'))(new Redis(config[_0x3091('0xc')]));require('./smsAccount.socket')[_0x3091('0xf')](socket);function respondWithRpcPromise(_0x49e28e,_0x28407c,_0x2d85a6){return new BPromise(function(_0x156539,_0x28f147){return client[_0x3091('0x10')](_0x49e28e,_0x2d85a6)[_0x3091('0x11')](function(_0x2fbd11){logger[_0x3091('0x12')]('SmsAccount,\x20%s,\x20%s',_0x28407c,_0x3091('0x13'));logger['debug'](_0x3091('0x14'),_0x28407c,_0x3091('0x13'),JSON['stringify'](_0x2fbd11));if(_0x2fbd11[_0x3091('0x15')]){if(_0x2fbd11[_0x3091('0x15')]['code']===0x1f4){logger[_0x3091('0x15')]('SmsAccount,\x20%s,\x20%s',_0x28407c,_0x2fbd11[_0x3091('0x15')][_0x3091('0x16')]);return _0x28f147(_0x2fbd11['error'][_0x3091('0x16')]);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x28407c,_0x2fbd11[_0x3091('0x15')]['message']);return _0x156539(_0x2fbd11[_0x3091('0x15')][_0x3091('0x16')]);}else{logger[_0x3091('0x12')](_0x3091('0x17'),_0x28407c,_0x3091('0x13'));_0x156539(_0x2fbd11['result'][_0x3091('0x16')]);}})[_0x3091('0x18')](function(_0x3da196){logger['error'](_0x3091('0x17'),_0x28407c,_0x3da196);_0x28f147(_0x3da196);});});}exports[_0x3091('0x19')]=function(_0x264b0d){var _0x5c86cd=this;return new Promise(function(_0x7029f3,_0x32dec9){return db[_0x3091('0x1a')][_0x3091('0x1b')]({'raw':_0x264b0d[_0x3091('0x1c')]?_0x264b0d['options']['raw']===undefined?!![]:![]:!![],'where':_0x264b0d['options']?_0x264b0d['options'][_0x3091('0x1d')]||null:null,'attributes':_0x264b0d[_0x3091('0x1c')]?_0x264b0d[_0x3091('0x1c')][_0x3091('0x1e')]||null:null,'include':_0x264b0d['options']?_0x264b0d[_0x3091('0x1c')]['include']?_['map'](_0x264b0d[_0x3091('0x1c')][_0x3091('0x1f')],function(_0xbd896b){return{'model':db[_0xbd896b['model']],'as':_0xbd896b['as'],'attributes':_0xbd896b[_0x3091('0x1e')],'include':_0xbd896b[_0x3091('0x1f')]?_[_0x3091('0x20')](_0xbd896b[_0x3091('0x1f')],function(_0x5a948d){return{'model':db[_0x5a948d[_0x3091('0x21')]],'as':_0x5a948d['as'],'attributes':_0x5a948d['attributes'],'include':_0x5a948d[_0x3091('0x1f')]?_['map'](_0x5a948d[_0x3091('0x1f')],function(_0x3ccdbd){return{'model':db[_0x3ccdbd[_0x3091('0x21')]],'as':_0x3ccdbd['as'],'attributes':_0x3ccdbd[_0x3091('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3091('0x11')](function(_0x101d7e){logger[_0x3091('0x12')](_0x3091('0x19'),_0x264b0d);logger['debug'](_0x3091('0x19'),_0x264b0d,JSON[_0x3091('0x22')](_0x101d7e));_0x7029f3(_0x101d7e);})['catch'](function(_0x835f0f){logger[_0x3091('0x15')](_0x3091('0x19'),_0x835f0f[_0x3091('0x16')],_0x264b0d);_0x32dec9(_0x5c86cd[_0x3091('0x15')](0x1f4,_0x835f0f['message']));});});}; \ No newline at end of file +var _0x9e3d=['where','attributes','include','model','map','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsAccount,\x20%s,\x20%s','request\x20sent','result','catch','ShowSmsAccount','SmsAccount','options'];(function(_0x1abb5,_0x4fcc57){var _0x155c10=function(_0x4d11fb){while(--_0x4d11fb){_0x1abb5['push'](_0x1abb5['shift']());}};_0x155c10(++_0x4fcc57);}(_0x9e3d,0x108));var _0xd9e3=function(_0x517a99,_0x562424){_0x517a99=_0x517a99-0x0;var _0x445e49=_0x9e3d[_0x517a99];return _0x445e49;};'use strict';var _=require('lodash');var util=require(_0xd9e3('0x0'));var moment=require('moment');var BPromise=require(_0xd9e3('0x1'));var rs=require(_0xd9e3('0x2'));var fs=require('fs');var Redis=require(_0xd9e3('0x3'));var db=require(_0xd9e3('0x4'))['db'];var utils=require(_0xd9e3('0x5'));var logger=require(_0xd9e3('0x6'))('rpc');var config=require(_0xd9e3('0x7'));var jayson=require(_0xd9e3('0x8'));var client=jayson[_0xd9e3('0x9')]['http']({'port':0x232a});config['redis']=_[_0xd9e3('0xa')](config[_0xd9e3('0xb')],{'host':_0xd9e3('0xc'),'port':0x18eb});var socket=require(_0xd9e3('0xd'))(new Redis(config[_0xd9e3('0xb')]));require(_0xd9e3('0xe'))[_0xd9e3('0xf')](socket);function respondWithRpcPromise(_0x2c05e4,_0x16dd8c,_0x204482){return new BPromise(function(_0x4155a4,_0x7d3e85){return client[_0xd9e3('0x10')](_0x2c05e4,_0x204482)[_0xd9e3('0x11')](function(_0x30105e){logger[_0xd9e3('0x12')]('SmsAccount,\x20%s,\x20%s',_0x16dd8c,'request\x20sent');logger[_0xd9e3('0x13')](_0xd9e3('0x14'),_0x16dd8c,'request\x20sent',JSON[_0xd9e3('0x15')](_0x30105e));if(_0x30105e[_0xd9e3('0x16')]){if(_0x30105e[_0xd9e3('0x16')][_0xd9e3('0x17')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x16dd8c,_0x30105e['error'][_0xd9e3('0x18')]);return _0x7d3e85(_0x30105e[_0xd9e3('0x16')]['message']);}logger[_0xd9e3('0x16')](_0xd9e3('0x19'),_0x16dd8c,_0x30105e[_0xd9e3('0x16')][_0xd9e3('0x18')]);return _0x4155a4(_0x30105e['error'][_0xd9e3('0x18')]);}else{logger['info'](_0xd9e3('0x19'),_0x16dd8c,_0xd9e3('0x1a'));_0x4155a4(_0x30105e[_0xd9e3('0x1b')]['message']);}})[_0xd9e3('0x1c')](function(_0x4c6c12){logger[_0xd9e3('0x16')](_0xd9e3('0x19'),_0x16dd8c,_0x4c6c12);_0x7d3e85(_0x4c6c12);});});}exports[_0xd9e3('0x1d')]=function(_0x3acb30){var _0xbeb2f6=this;return new Promise(function(_0x5c817f,_0x174652){return db[_0xd9e3('0x1e')]['find']({'raw':_0x3acb30[_0xd9e3('0x1f')]?_0x3acb30[_0xd9e3('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x3acb30[_0xd9e3('0x1f')]?_0x3acb30[_0xd9e3('0x1f')][_0xd9e3('0x20')]||null:null,'attributes':_0x3acb30[_0xd9e3('0x1f')]?_0x3acb30[_0xd9e3('0x1f')][_0xd9e3('0x21')]||null:null,'include':_0x3acb30[_0xd9e3('0x1f')]?_0x3acb30['options']['include']?_['map'](_0x3acb30[_0xd9e3('0x1f')][_0xd9e3('0x22')],function(_0x23914c){return{'model':db[_0x23914c[_0xd9e3('0x23')]],'as':_0x23914c['as'],'attributes':_0x23914c[_0xd9e3('0x21')],'include':_0x23914c[_0xd9e3('0x22')]?_[_0xd9e3('0x24')](_0x23914c['include'],function(_0x77997){return{'model':db[_0x77997[_0xd9e3('0x23')]],'as':_0x77997['as'],'attributes':_0x77997[_0xd9e3('0x21')],'include':_0x77997[_0xd9e3('0x22')]?_[_0xd9e3('0x24')](_0x77997[_0xd9e3('0x22')],function(_0x23fdba){return{'model':db[_0x23fdba[_0xd9e3('0x23')]],'as':_0x23fdba['as'],'attributes':_0x23fdba[_0xd9e3('0x21')]};}):[]};}):[]};}):[]:[]})[_0xd9e3('0x11')](function(_0x157fef){logger[_0xd9e3('0x12')](_0xd9e3('0x1d'),_0x3acb30);logger[_0xd9e3('0x13')]('ShowSmsAccount',_0x3acb30,JSON[_0xd9e3('0x15')](_0x157fef));_0x5c817f(_0x157fef);})[_0xd9e3('0x1c')](function(_0x3b8cb4){logger[_0xd9e3('0x16')](_0xd9e3('0x1d'),_0x3b8cb4[_0xd9e3('0x18')],_0x3acb30);_0x174652(_0xbeb2f6[_0xd9e3('0x16')](0x1f4,_0x3b8cb4[_0xd9e3('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 3aa3c10..d3824ee 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 _0x1437=['update','emit','removeListener','register','smsAccount:','./smsAccount.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1437,0x1c5));var _0x7143=function(_0x415c11,_0x4b8067){_0x415c11=_0x415c11-0x0;var _0x3deb58=_0x1437[_0x415c11];return _0x3deb58;};'use strict';var SmsAccountEvents=require(_0x7143('0x0'));var events=[_0x7143('0x1'),'remove',_0x7143('0x2')];function createListener(_0x9ef40b,_0x5a08b7){return function(_0x162fc5){_0x5a08b7[_0x7143('0x3')](_0x9ef40b,_0x162fc5);};}function removeListener(_0x1a3e3a,_0x47a72d){return function(){SmsAccountEvents[_0x7143('0x4')](_0x1a3e3a,_0x47a72d);};}exports[_0x7143('0x5')]=function(_0x2ab1c7){for(var _0x24b4f6=0x0,_0x57fdcb=events['length'];_0x24b4f6<_0x57fdcb;_0x24b4f6++){var _0x13d779=events[_0x24b4f6];var _0x201368=createListener(_0x7143('0x6')+_0x13d779,_0x2ab1c7);SmsAccountEvents['on'](_0x13d779,_0x201368);}}; \ No newline at end of file +var _0xeeb2=['save','remove','emit','register','length','smsAccount:','./smsAccount.events'];(function(_0x127060,_0x1462bb){var _0x5d3a15=function(_0x58a6f7){while(--_0x58a6f7){_0x127060['push'](_0x127060['shift']());}};_0x5d3a15(++_0x1462bb);}(_0xeeb2,0x117));var _0x2eeb=function(_0x3f8a03,_0x319b9c){_0x3f8a03=_0x3f8a03-0x0;var _0x147fb2=_0xeeb2[_0x3f8a03];return _0x147fb2;};'use strict';var SmsAccountEvents=require(_0x2eeb('0x0'));var events=[_0x2eeb('0x1'),_0x2eeb('0x2'),'update'];function createListener(_0x3f45dd,_0x43134c){return function(_0x5f031b){_0x43134c[_0x2eeb('0x3')](_0x3f45dd,_0x5f031b);};}function removeListener(_0x3d67d3,_0x20d194){return function(){SmsAccountEvents['removeListener'](_0x3d67d3,_0x20d194);};}exports[_0x2eeb('0x4')]=function(_0x54a8b6){for(var _0x47f6a5=0x0,_0x456525=events[_0x2eeb('0x5')];_0x47f6a5<_0x456525;_0x47f6a5++){var _0x49cacc=events[_0x47f6a5];var _0x20d7d6=createListener(_0x2eeb('0x6')+_0x49cacc,_0x54a8b6);SmsAccountEvents['on'](_0x49cacc,_0x20d7d6);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 6cf742b..f286c34 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 _0xd2fb=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','exports','multer','util'];(function(_0x5fd46f,_0x3fd0c9){var _0x5e425f=function(_0x39046b){while(--_0x39046b){_0x5fd46f['push'](_0x5fd46f['shift']());}};_0x5e425f(++_0x3fd0c9);}(_0xd2fb,0x64));var _0xbd2f=function(_0x4603ea,_0x23b157){_0x4603ea=_0x4603ea-0x0;var _0x265b24=_0xd2fb[_0x4603ea];return _0x265b24;};'use strict';var multer=require(_0xbd2f('0x0'));var util=require(_0xbd2f('0x1'));var path=require('path');var timeout=require(_0xbd2f('0x2'));var express=require('express');var router=express[_0xbd2f('0x3')]();var auth=require(_0xbd2f('0x4'));var interaction=require(_0xbd2f('0x5'));var config=require(_0xbd2f('0x6'));var controller=require(_0xbd2f('0x7'));router[_0xbd2f('0x8')]('/',auth[_0xbd2f('0x9')](),controller[_0xbd2f('0xa')]);router[_0xbd2f('0x8')](_0xbd2f('0xb'),auth[_0xbd2f('0x9')](),controller[_0xbd2f('0xc')]);router[_0xbd2f('0xd')]('/',auth['isAuthenticated'](),controller[_0xbd2f('0xe')]);router[_0xbd2f('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xbd2f('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xbd2f('0x10')]=router; \ No newline at end of file +var _0x9b64=['../../components/interaction/service','get','index','/:id','isAuthenticated','post','create','put','update','delete','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x3ccafd,_0x1d00ff){var _0x27c973=function(_0x1f59b1){while(--_0x1f59b1){_0x3ccafd['push'](_0x3ccafd['shift']());}};_0x27c973(++_0x1d00ff);}(_0x9b64,0x1ba));var _0x49b6=function(_0x3ba57e,_0x2e6810){_0x3ba57e=_0x3ba57e-0x0;var _0x5d95cf=_0x9b64[_0x3ba57e];return _0x5d95cf;};'use strict';var multer=require(_0x49b6('0x0'));var util=require('util');var path=require(_0x49b6('0x1'));var timeout=require(_0x49b6('0x2'));var express=require(_0x49b6('0x3'));var router=express[_0x49b6('0x4')]();var auth=require(_0x49b6('0x5'));var interaction=require(_0x49b6('0x6'));var config=require('../../config/environment');var controller=require('./smsApplication.controller');router[_0x49b6('0x7')]('/',auth['isAuthenticated'](),controller[_0x49b6('0x8')]);router[_0x49b6('0x7')](_0x49b6('0x9'),auth[_0x49b6('0xa')](),controller['show']);router[_0x49b6('0xb')]('/',auth[_0x49b6('0xa')](),controller[_0x49b6('0xc')]);router[_0x49b6('0xd')](_0x49b6('0x9'),auth[_0x49b6('0xa')](),controller[_0x49b6('0xe')]);router[_0x49b6('0xf')](_0x49b6('0x9'),auth[_0x49b6('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 06e9326..16b2d23 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 _0x8cf3=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x17b9b7,_0x4e4f73){var _0x8b11f7=function(_0xb599cb){while(--_0xb599cb){_0x17b9b7['push'](_0x17b9b7['shift']());}};_0x8b11f7(++_0x4e4f73);}(_0x8cf3,0x113));var _0x38cf=function(_0x50af80,_0x33ee3d){_0x50af80=_0x50af80-0x0;var _0x3eb7e0=_0x8cf3[_0x50af80];return _0x3eb7e0;};'use strict';var Sequelize=require(_0x38cf('0x0'));module[_0x38cf('0x1')]={'priority':{'type':Sequelize[_0x38cf('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x38cf('0x3')],'allowNull':![],'defaultValue':_0x38cf('0x4')},'appdata':{'type':Sequelize[_0x38cf('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x38cf('0x3')],'defaultValue':_0x38cf('0x6')}}; \ No newline at end of file +var _0xdb4b=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x45d29e,_0x4afb9d){var _0xc129b6=function(_0x185c90){while(--_0x185c90){_0x45d29e['push'](_0x45d29e['shift']());}};_0xc129b6(++_0x4afb9d);}(_0xdb4b,0x17f));var _0xbdb4=function(_0x18a378,_0x46dc75){_0x18a378=_0x18a378-0x0;var _0x23760a=_0xdb4b[_0x18a378];return _0x23760a;};'use strict';var Sequelize=require(_0xbdb4('0x0'));module['exports']={'priority':{'type':Sequelize[_0xbdb4('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xbdb4('0x2')],'allowNull':![],'defaultValue':_0xbdb4('0x3')},'appdata':{'type':Sequelize[_0xbdb4('0x4')]()},'description':{'type':Sequelize[_0xbdb4('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xbdb4('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 32b612d..ef7937b 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 _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(_0x5a3467,_0x4269f9){var _0x427bd0=function(_0x3d9531){while(--_0x3d9531){_0x5a3467['push'](_0x5a3467['shift']());}};_0x427bd0(++_0x4269f9);}(_0x36ee,0xe8));var _0xe36e=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x36ee[_0x3bf83f];return _0x22c4a9;};'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 +var _0xeb3b=['html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','json','limit','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','SmsApplication','rawAttributes','type','query','filters','intersection','model','attributes','fields','hasOwnProperty','offset','order','where','pick','filter','VIRTUAL','merge','count','includeAll','rows','params','keys','length','include','options','find','catch','create','update','body'];(function(_0x293fa7,_0x1bdf5c){var _0x3f54dc=function(_0x465ae5){while(--_0x465ae5){_0x293fa7['push'](_0x293fa7['shift']());}};_0x3f54dc(++_0x1bdf5c);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x5d5bcb,_0x25e2ea){_0x5d5bcb=_0x5d5bcb-0x0;var _0x4ea5eb=_0xeb3b[_0x5d5bcb];return _0x4ea5eb;};'use strict';var pdf=require(_0xbeb3('0x0'));var emlformat=require(_0xbeb3('0x1'));var rimraf=require(_0xbeb3('0x2'));var zipdir=require(_0xbeb3('0x3'));var jsonpatch=require(_0xbeb3('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbeb3('0x5'));var Mustache=require('mustache');var util=require(_0xbeb3('0x6'));var path=require('path');var sox=require(_0xbeb3('0x7'));var csv=require(_0xbeb3('0x8'));var ejs=require(_0xbeb3('0x9'));var fs=require('fs');var _=require(_0xbeb3('0xa'));var squel=require(_0xbeb3('0xb'));var crypto=require(_0xbeb3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbeb3('0xd'));var toCsv=require(_0xbeb3('0x8'));var querystring=require(_0xbeb3('0xe'));var Papa=require(_0xbeb3('0xf'));var Redis=require(_0xbeb3('0x10'));var authService=require(_0xbeb3('0x11'));var qs=require(_0xbeb3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbeb3('0x13'));var logger=require(_0xbeb3('0x14'))('api');var utils=require(_0xbeb3('0x15'));var config=require(_0xbeb3('0x16'));var db=require(_0xbeb3('0x17'))['db'];function respondWithStatusCode(_0x2a7fb1,_0x19868e){_0x19868e=_0x19868e||0xcc;return function(_0x313296){if(_0x313296){return _0x2a7fb1['sendStatus'](_0x19868e);}return _0x2a7fb1['status'](_0x19868e)[_0xbeb3('0x18')]();};}function respondWithResult(_0x300c44,_0x5f521b){_0x5f521b=_0x5f521b||0xc8;return function(_0x4dfb28){if(_0x4dfb28){return _0x300c44[_0xbeb3('0x19')](_0x5f521b)[_0xbeb3('0x1a')](_0x4dfb28);}};}function respondWithFilteredResult(_0x395d2b,_0x43d58a){return function(_0x26daf2){if(_0x26daf2){var _0x535836=_0x26daf2['count'],_0x1aeaee=_0x43d58a['offset'],_0x5970a1=_0x43d58a['offset']+_0x43d58a[_0xbeb3('0x1b')],_0x80ef55;if(_0x5970a1>=_0x535836){_0x5970a1=_0x535836;_0x80ef55=0xc8;}else{_0x80ef55=0xce;}_0x395d2b[_0xbeb3('0x19')](_0x80ef55);return _0x395d2b[_0xbeb3('0x1c')](_0xbeb3('0x1d'),_0x1aeaee+'-'+_0x5970a1+'/'+_0x535836)['json'](_0x26daf2);}return null;};}function patchUpdates(_0x233a62){return function(_0x821d92){try{jsonpatch[_0xbeb3('0x1e')](_0x821d92,_0x233a62,!![]);}catch(_0x495c0a){return BPromise['reject'](_0x495c0a);}return _0x821d92[_0xbeb3('0x1f')]();};}function saveUpdates(_0x57e8b6,_0x1d917b){return function(_0x50b005){if(_0x50b005){return _0x50b005['update'](_0x57e8b6)[_0xbeb3('0x20')](function(_0x3c98f8){return _0x3c98f8;});}return null;};}function removeEntity(_0x2f3088,_0x4bd89e){return function(_0x301899){if(_0x301899){return _0x301899[_0xbeb3('0x21')]()['then'](function(){_0x2f3088[_0xbeb3('0x19')](0xcc)[_0xbeb3('0x18')]();});}};}function handleEntityNotFound(_0x55a59d,_0xfc384a){return function(_0x278fe4){if(!_0x278fe4){_0x55a59d[_0xbeb3('0x22')](0x194);}return _0x278fe4;};}function handleError(_0x42c6c3,_0x2bc188){_0x2bc188=_0x2bc188||0x1f4;return function(_0xee71d7){logger[_0xbeb3('0x23')](_0xee71d7[_0xbeb3('0x24')]);if(_0xee71d7[_0xbeb3('0x25')]){delete _0xee71d7['name'];}_0x42c6c3['status'](_0x2bc188)[_0xbeb3('0x26')](_0xee71d7);};}exports['index']=function(_0x3e7f7d,_0xda808c){var _0x138adf={},_0x400f65={},_0x4fa3c7={'count':0x0,'rows':[]};var _0x2fe7ec=_['map'](db[_0xbeb3('0x27')][_0xbeb3('0x28')],function(_0x5bd93d){return{'name':_0x5bd93d['fieldName'],'type':_0x5bd93d[_0xbeb3('0x29')]['key']};});_0x400f65['model']=_['map'](_0x2fe7ec,'name');_0x400f65[_0xbeb3('0x2a')]=_['keys'](_0x3e7f7d[_0xbeb3('0x2a')]);_0x400f65[_0xbeb3('0x2b')]=_[_0xbeb3('0x2c')](_0x400f65[_0xbeb3('0x2d')],_0x400f65[_0xbeb3('0x2a')]);_0x138adf[_0xbeb3('0x2e')]=_[_0xbeb3('0x2c')](_0x400f65[_0xbeb3('0x2d')],qs[_0xbeb3('0x2f')](_0x3e7f7d[_0xbeb3('0x2a')]['fields']));_0x138adf[_0xbeb3('0x2e')]=_0x138adf[_0xbeb3('0x2e')]['length']?_0x138adf[_0xbeb3('0x2e')]:_0x400f65[_0xbeb3('0x2d')];if(!_0x3e7f7d[_0xbeb3('0x2a')][_0xbeb3('0x30')]('nolimit')){_0x138adf[_0xbeb3('0x1b')]=qs[_0xbeb3('0x1b')](_0x3e7f7d[_0xbeb3('0x2a')][_0xbeb3('0x1b')]);_0x138adf[_0xbeb3('0x31')]=qs[_0xbeb3('0x31')](_0x3e7f7d[_0xbeb3('0x2a')][_0xbeb3('0x31')]);}_0x138adf[_0xbeb3('0x32')]=qs['sort'](_0x3e7f7d[_0xbeb3('0x2a')]['sort']);_0x138adf[_0xbeb3('0x33')]=qs[_0xbeb3('0x2b')](_[_0xbeb3('0x34')](_0x3e7f7d[_0xbeb3('0x2a')],_0x400f65[_0xbeb3('0x2b')]),_0x2fe7ec);if(_0x3e7f7d[_0xbeb3('0x2a')][_0xbeb3('0x35')]){_0x138adf[_0xbeb3('0x33')]=_['merge'](_0x138adf[_0xbeb3('0x33')],{'$or':_['map'](_0x2fe7ec,function(_0x59e6df){if(_0x59e6df['type']!==_0xbeb3('0x36')){var _0x2c95ce={};_0x2c95ce[_0x59e6df[_0xbeb3('0x25')]]={'$like':'%'+_0x3e7f7d[_0xbeb3('0x2a')][_0xbeb3('0x35')]+'%'};return _0x2c95ce;}})});}_0x138adf=_[_0xbeb3('0x37')]({},_0x138adf,_0x3e7f7d['options']);var _0x32db2d={'where':_0x138adf[_0xbeb3('0x33')]};return db[_0xbeb3('0x27')]['count'](_0x32db2d)['then'](function(_0x54239b){_0x4fa3c7[_0xbeb3('0x38')]=_0x54239b;if(_0x3e7f7d[_0xbeb3('0x2a')][_0xbeb3('0x39')]){_0x138adf['include']=[{'all':!![]}];}return db[_0xbeb3('0x27')]['findAll'](_0x138adf);})[_0xbeb3('0x20')](function(_0x447ac4){_0x4fa3c7[_0xbeb3('0x3a')]=_0x447ac4;return _0x4fa3c7;})[_0xbeb3('0x20')](respondWithFilteredResult(_0xda808c,_0x138adf))['catch'](handleError(_0xda808c,null));};exports['show']=function(_0x3c6ee2,_0x3684f1){var _0x3d4262={'raw':!![],'where':{'id':_0x3c6ee2[_0xbeb3('0x3b')]['id']}},_0x2443a0={};_0x2443a0[_0xbeb3('0x2d')]=_[_0xbeb3('0x3c')](db[_0xbeb3('0x27')]['rawAttributes']);_0x2443a0[_0xbeb3('0x2a')]=_[_0xbeb3('0x3c')](_0x3c6ee2[_0xbeb3('0x2a')]);_0x2443a0[_0xbeb3('0x2b')]=_[_0xbeb3('0x2c')](_0x2443a0[_0xbeb3('0x2d')],_0x2443a0[_0xbeb3('0x2a')]);_0x3d4262['attributes']=_[_0xbeb3('0x2c')](_0x2443a0[_0xbeb3('0x2d')],qs[_0xbeb3('0x2f')](_0x3c6ee2[_0xbeb3('0x2a')][_0xbeb3('0x2f')]));_0x3d4262[_0xbeb3('0x2e')]=_0x3d4262[_0xbeb3('0x2e')][_0xbeb3('0x3d')]?_0x3d4262[_0xbeb3('0x2e')]:_0x2443a0[_0xbeb3('0x2d')];if(_0x3c6ee2[_0xbeb3('0x2a')][_0xbeb3('0x39')]){_0x3d4262[_0xbeb3('0x3e')]=[{'all':!![]}];}_0x3d4262=_['merge']({},_0x3d4262,_0x3c6ee2[_0xbeb3('0x3f')]);return db[_0xbeb3('0x27')][_0xbeb3('0x40')](_0x3d4262)['then'](handleEntityNotFound(_0x3684f1,null))['then'](respondWithResult(_0x3684f1,null))[_0xbeb3('0x41')](handleError(_0x3684f1,null));};exports[_0xbeb3('0x42')]=function(_0x269fe9,_0xf0fcd6){return db['SmsApplication'][_0xbeb3('0x42')](_0x269fe9['body'],{})['then'](respondWithResult(_0xf0fcd6,0xc9))[_0xbeb3('0x41')](handleError(_0xf0fcd6,null));};exports[_0xbeb3('0x43')]=function(_0x1ff297,_0x8eaebd){if(_0x1ff297['body']['id']){delete _0x1ff297[_0xbeb3('0x44')]['id'];}return db[_0xbeb3('0x27')][_0xbeb3('0x40')]({'where':{'id':_0x1ff297['params']['id']}})[_0xbeb3('0x20')](handleEntityNotFound(_0x8eaebd,null))['then'](saveUpdates(_0x1ff297['body'],null))[_0xbeb3('0x20')](respondWithResult(_0x8eaebd,null))[_0xbeb3('0x41')](handleError(_0x8eaebd,null));};exports[_0xbeb3('0x21')]=function(_0x55e546,_0x23d63c){return db[_0xbeb3('0x27')][_0xbeb3('0x40')]({'where':{'id':_0x55e546['params']['id']}})[_0xbeb3('0x20')](handleEntityNotFound(_0x23d63c,null))['then'](removeEntity(_0x23d63c,null))[_0xbeb3('0x41')](handleError(_0x23d63c,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 06935aa..f307f3b 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 _0x073d=['path','rimraf','../../config/environment','exports','define','sms_applications','utf8mb4','lodash','util','api','moment','bluebird'];(function(_0x2892da,_0x191a40){var _0x28cff2=function(_0x57023d){while(--_0x57023d){_0x2892da['push'](_0x2892da['shift']());}};_0x28cff2(++_0x191a40);}(_0x073d,0xeb));var _0xd073=function(_0x4ecd76,_0x79f1f3){_0x4ecd76=_0x4ecd76-0x0;var _0x240f34=_0x073d[_0x4ecd76];return _0x240f34;};'use strict';var _=require(_0xd073('0x0'));var util=require(_0xd073('0x1'));var logger=require('../../config/logger')(_0xd073('0x2'));var moment=require(_0xd073('0x3'));var BPromise=require(_0xd073('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd073('0x5'));var rimraf=require(_0xd073('0x6'));var config=require(_0xd073('0x7'));var attributes=require('./smsApplication.attributes');module[_0xd073('0x8')]=function(_0x53c4d9,_0x5db3f4){return _0x53c4d9[_0xd073('0x9')]('SmsApplication',attributes,{'tableName':_0xd073('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd073('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x6e83=['utf8mb4_unicode_ci','lodash','util','../../config/logger','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications'];(function(_0x5411aa,_0x4a9d28){var _0x21d0a0=function(_0x51d862){while(--_0x51d862){_0x5411aa['push'](_0x5411aa['shift']());}};_0x21d0a0(++_0x4a9d28);}(_0x6e83,0x175));var _0x36e8=function(_0x40e41e,_0x3d30e7){_0x40e41e=_0x40e41e-0x0;var _0x18b70c=_0x6e83[_0x40e41e];return _0x18b70c;};'use strict';var _=require(_0x36e8('0x0'));var util=require(_0x36e8('0x1'));var logger=require(_0x36e8('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x36e8('0x3'));var rimraf=require(_0x36e8('0x4'));var config=require(_0x36e8('0x5'));var attributes=require(_0x36e8('0x6'));module[_0x36e8('0x7')]=function(_0x51445f,_0x3aa890){return _0x51445f[_0x36e8('0x8')](_0x36e8('0x9'),attributes,{'tableName':_0x36e8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x36e8('0xb')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 7a04f35..5a82129 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 _0x544f=['info','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsApplication,\x20%s,\x20%s','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','then'];(function(_0x2bcf7c,_0xe39ceb){var _0x1cfb89=function(_0xea05c6){while(--_0xea05c6){_0x2bcf7c['push'](_0x2bcf7c['shift']());}};_0x1cfb89(++_0xe39ceb);}(_0x544f,0x14c));var _0xf544=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x544f[_0x31a371];return _0x2a5bd6;};'use strict';var _=require(_0xf544('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf544('0x1'));var rs=require(_0xf544('0x2'));var fs=require('fs');var Redis=require(_0xf544('0x3'));var db=require(_0xf544('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf544('0x5'))(_0xf544('0x6'));var config=require('../../config/environment');var jayson=require(_0xf544('0x7'));var client=jayson[_0xf544('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xdb52e7,_0x2ce041,_0x1749cc){return new BPromise(function(_0x4dd70e,_0x10cbea){return client['request'](_0xdb52e7,_0x1749cc)[_0xf544('0x9')](function(_0x4fee2e){logger[_0xf544('0xa')]('SmsApplication,\x20%s,\x20%s',_0x2ce041,_0xf544('0xb'));logger['debug'](_0xf544('0xc'),_0x2ce041,_0xf544('0xb'),JSON[_0xf544('0xd')](_0x4fee2e));if(_0x4fee2e[_0xf544('0xe')]){if(_0x4fee2e[_0xf544('0xe')][_0xf544('0xf')]===0x1f4){logger[_0xf544('0xe')](_0xf544('0x10'),_0x2ce041,_0x4fee2e['error'][_0xf544('0x11')]);return _0x10cbea(_0x4fee2e[_0xf544('0xe')]['message']);}logger['error']('SmsApplication,\x20%s,\x20%s',_0x2ce041,_0x4fee2e[_0xf544('0xe')]['message']);return _0x4dd70e(_0x4fee2e[_0xf544('0xe')]['message']);}else{logger[_0xf544('0xa')]('SmsApplication,\x20%s,\x20%s',_0x2ce041,_0xf544('0xb'));_0x4dd70e(_0x4fee2e[_0xf544('0x12')][_0xf544('0x11')]);}})['catch'](function(_0x44a3ee){logger[_0xf544('0xe')](_0xf544('0x10'),_0x2ce041,_0x44a3ee);_0x10cbea(_0x44a3ee);});});} \ No newline at end of file +var _0xf350=['request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','info','SmsApplication,\x20%s,\x20%s'];(function(_0x434628,_0x4cf803){var _0x33536d=function(_0xde62a5){while(--_0xde62a5){_0x434628['push'](_0x434628['shift']());}};_0x33536d(++_0x4cf803);}(_0xf350,0x105));var _0x0f35=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf350[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x0f35('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0f35('0x1'));var rs=require(_0x0f35('0x2'));var fs=require('fs');var Redis=require(_0x0f35('0x3'));var db=require(_0x0f35('0x4'))['db'];var utils=require(_0x0f35('0x5'));var logger=require(_0x0f35('0x6'))(_0x0f35('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0f35('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2c61c4,_0x481712,_0x544342){return new BPromise(function(_0x2c716b,_0x49c0fe){return client[_0x0f35('0x9')](_0x2c61c4,_0x544342)['then'](function(_0x3d928d){logger[_0x0f35('0xa')](_0x0f35('0xb'),_0x481712,_0x0f35('0xc'));logger[_0x0f35('0xd')](_0x0f35('0xe'),_0x481712,_0x0f35('0xc'),JSON[_0x0f35('0xf')](_0x3d928d));if(_0x3d928d[_0x0f35('0x10')]){if(_0x3d928d['error'][_0x0f35('0x11')]===0x1f4){logger[_0x0f35('0x10')]('SmsApplication,\x20%s,\x20%s',_0x481712,_0x3d928d[_0x0f35('0x10')]['message']);return _0x49c0fe(_0x3d928d[_0x0f35('0x10')]['message']);}logger['error'](_0x0f35('0xb'),_0x481712,_0x3d928d[_0x0f35('0x10')][_0x0f35('0x12')]);return _0x2c716b(_0x3d928d['error'][_0x0f35('0x12')]);}else{logger[_0x0f35('0xa')](_0x0f35('0xb'),_0x481712,_0x0f35('0xc'));_0x2c716b(_0x3d928d[_0x0f35('0x13')][_0x0f35('0x12')]);}})[_0x0f35('0x14')](function(_0x1a2ffc){logger[_0x0f35('0x10')](_0x0f35('0xb'),_0x481712,_0x1a2ffc);_0x49c0fe(_0x1a2ffc);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 6fe5f6a..8b71be5 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 _0xaf6e=['/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','addTags','put','smsinteraction:update','update','delete','sms','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','describe'];(function(_0x275ec2,_0x231944){var _0x1e18d4=function(_0x172c90){while(--_0x172c90){_0x275ec2['push'](_0x275ec2['shift']());}};_0x1e18d4(++_0x231944);}(_0xaf6e,0x16e));var _0xeaf6=function(_0x11c195,_0x5ecd25){_0x11c195=_0x11c195-0x0;var _0x26a4b1=_0xaf6e[_0x11c195];return _0x26a4b1;};'use strict';var multer=require(_0xeaf6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xeaf6('0x1'));var express=require(_0xeaf6('0x2'));var router=express[_0xeaf6('0x3')]();var auth=require(_0xeaf6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xeaf6('0x5'));var controller=require(_0xeaf6('0x6'));router[_0xeaf6('0x7')]('/',auth[_0xeaf6('0x8')](),controller[_0xeaf6('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xeaf6('0xa')]);router['get'](_0xeaf6('0xb'),auth['isAuthenticated'](),controller[_0xeaf6('0xc')]);router[_0xeaf6('0x7')](_0xeaf6('0xd'),auth[_0xeaf6('0x8')](),controller[_0xeaf6('0xe')]);router[_0xeaf6('0x7')](_0xeaf6('0xf'),auth[_0xeaf6('0x8')](),controller[_0xeaf6('0x10')]);router[_0xeaf6('0x11')]('/',auth[_0xeaf6('0x8')](),controller['create']);router[_0xeaf6('0x11')](_0xeaf6('0xd'),auth[_0xeaf6('0x8')](),controller[_0xeaf6('0x12')]);router[_0xeaf6('0x11')](_0xeaf6('0x13'),auth[_0xeaf6('0x8')](),interaction[_0xeaf6('0x14')]('sms','smsinteraction:addtags'),controller[_0xeaf6('0x15')]);router[_0xeaf6('0x16')](_0xeaf6('0xb'),auth[_0xeaf6('0x8')](),interaction[_0xeaf6('0x14')]('sms',_0xeaf6('0x17')),controller[_0xeaf6('0x18')]);router[_0xeaf6('0x19')](_0xeaf6('0xb'),auth[_0xeaf6('0x8')](),interaction[_0xeaf6('0x14')](_0xeaf6('0x1a'),'smsinteraction:destroy'),controller[_0xeaf6('0x1b')]);router[_0xeaf6('0x19')](_0xeaf6('0x13'),auth['isAuthenticated'](),controller['removeTags']);module[_0xeaf6('0x1c')]=router; \ No newline at end of file +var _0xd6f9=['/:id','show','/:id/messages','/:id/download','download','post','addMessage','tracked','sms','smsinteraction:addtags','addTags','update','delete','smsinteraction:destroy','/:id/tags','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','./smsInteraction.controller','get','isAuthenticated','describe'];(function(_0x100682,_0x11afec){var _0xcb6e87=function(_0x3ef421){while(--_0x3ef421){_0x100682['push'](_0x100682['shift']());}};_0xcb6e87(++_0x11afec);}(_0xd6f9,0x1ca));var _0x9d6f=function(_0x10df18,_0x13338c){_0x10df18=_0x10df18-0x0;var _0x1f9a1d=_0xd6f9[_0x10df18];return _0x1f9a1d;};'use strict';var multer=require(_0x9d6f('0x0'));var util=require(_0x9d6f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9d6f('0x2'));var router=express[_0x9d6f('0x3')]();var auth=require(_0x9d6f('0x4'));var interaction=require(_0x9d6f('0x5'));var config=require('../../config/environment');var controller=require(_0x9d6f('0x6'));router[_0x9d6f('0x7')]('/',auth[_0x9d6f('0x8')](),controller['index']);router[_0x9d6f('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x9d6f('0x9')]);router['get'](_0x9d6f('0xa'),auth[_0x9d6f('0x8')](),controller[_0x9d6f('0xb')]);router[_0x9d6f('0x7')](_0x9d6f('0xc'),auth['isAuthenticated'](),controller['getMessages']);router['get'](_0x9d6f('0xd'),auth[_0x9d6f('0x8')](),controller[_0x9d6f('0xe')]);router[_0x9d6f('0xf')]('/',auth[_0x9d6f('0x8')](),controller['create']);router[_0x9d6f('0xf')](_0x9d6f('0xc'),auth[_0x9d6f('0x8')](),controller[_0x9d6f('0x10')]);router[_0x9d6f('0xf')]('/:id/tags',auth[_0x9d6f('0x8')](),interaction[_0x9d6f('0x11')](_0x9d6f('0x12'),_0x9d6f('0x13')),controller[_0x9d6f('0x14')]);router['put'](_0x9d6f('0xa'),auth[_0x9d6f('0x8')](),interaction[_0x9d6f('0x11')](_0x9d6f('0x12'),'smsinteraction:update'),controller[_0x9d6f('0x15')]);router[_0x9d6f('0x16')](_0x9d6f('0xa'),auth[_0x9d6f('0x8')](),interaction['tracked'](_0x9d6f('0x12'),_0x9d6f('0x17')),controller['destroy']);router[_0x9d6f('0x16')](_0x9d6f('0x18'),auth[_0x9d6f('0x8')](),controller['removeTags']);module[_0x9d6f('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index efbba29..06ad714 100644 --- a/server/api/smsInteraction/smsInteraction.attributes.js +++ b/server/api/smsInteraction/smsInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x1f21d5,_0x3182f2){var _0xa8733=function(_0x3e7034){while(--_0x3e7034){_0x1f21d5['push'](_0x1f21d5['shift']());}};_0xa8733(++_0x3182f2);}(_0xb10b,0x12a));var _0xbb10=function(_0x12551a,_0x5af080){_0x12551a=_0x12551a-0x0;var _0x6f8fc0=_0xb10b[_0x12551a];return _0x6f8fc0;};'use strict';var Sequelize=require(_0xbb10('0x0'));var moment=require('moment');module[_0xbb10('0x1')]={'closed':{'type':Sequelize[_0xbb10('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xbb10('0x3')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xbb10('0x4')]},'phone':{'type':Sequelize[_0xbb10('0x4')]},'read1stAt':{'type':Sequelize[_0xbb10('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xbb10('0x5')]('in',_0xbb10('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xbb10('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xbb10('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x757a=['moment','exports','STRING','DATE','ENUM','out'];(function(_0x51e79c,_0x51485e){var _0x2467be=function(_0xbf70f0){while(--_0xbf70f0){_0x51e79c['push'](_0x51e79c['shift']());}};_0x2467be(++_0x51485e);}(_0x757a,0xde));var _0xa757=function(_0x6bf296,_0x40f7bb){_0x6bf296=_0x6bf296-0x0;var _0x99991a=_0x757a[_0x6bf296];return _0x99991a;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa757('0x0'));module[_0xa757('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xa757('0x2')]},'phone':{'type':Sequelize[_0xa757('0x2')]},'read1stAt':{'type':Sequelize[_0xa757('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xa757('0x4')]('in',_0xa757('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa757('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xa757('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index db3b6ea..15818ad 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 _0x3667=['end','json','count','offset','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','Users','map','fullname','split','forEach','Tags','TagIds','catch','index','SmsInteraction','rawAttributes','type','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','where','select','field','color','from','tools_tags','u.id','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','length','find','unreadMessages','value','`\x20>\x200','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','keys','compact','SmsAccountId','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','read','`unreadMessages`\x20=\x200','having','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','DESC','isEmpty','t.id\x20IN\x20?','resolve','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','sequelize','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','push','all','rows','show','params','include','create','describe','addMessage','ids','omit','getMessages','findOne','SmsMessage','sort','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','findAll','addTags','setTags','spread','emit','download','unix','root','tmp','server','files','attachments','join','format','transcript-%d-%s.zip','User','CmContact','firstName','lastName','Messages','direction','secret','Account','Owner','get','mkdirSync','10px','40px','30px','Sms','YYYY-MM-DD','closed','closedAt','disposition','System','Contact','out','renderFile','views','downloadInteraction.html','toFile','transcript-','log','err','unlinkSync','html-pdf','eml-format','rimraf','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','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','status'];(function(_0x2a9197,_0x5225eb){var _0x588c8a=function(_0x4698ee){while(--_0x4698ee){_0x2a9197['push'](_0x2a9197['shift']());}};_0x588c8a(++_0x5225eb);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x7366('0x0'));var emlformat=require(_0x7366('0x1'));var rimraf=require(_0x7366('0x2'));var zipdir=require(_0x7366('0x3'));var jsonpatch=require(_0x7366('0x4'));var rp=require('request-promise');var moment=require(_0x7366('0x5'));var BPromise=require(_0x7366('0x6'));var Mustache=require('mustache');var util=require(_0x7366('0x7'));var path=require(_0x7366('0x8'));var sox=require(_0x7366('0x9'));var csv=require(_0x7366('0xa'));var ejs=require(_0x7366('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7366('0xc'));var crypto=require(_0x7366('0xd'));var jsforce=require(_0x7366('0xe'));var deskjs=require(_0x7366('0xf'));var toCsv=require(_0x7366('0xa'));var querystring=require(_0x7366('0x10'));var Papa=require(_0x7366('0x11'));var Redis=require(_0x7366('0x12'));var authService=require(_0x7366('0x13'));var qs=require(_0x7366('0x14'));var as=require(_0x7366('0x15'));var hardwareService=require(_0x7366('0x16'));var logger=require(_0x7366('0x17'))(_0x7366('0x18'));var utils=require(_0x7366('0x19'));var config=require(_0x7366('0x1a'));var db=require(_0x7366('0x1b'))['db'];config[_0x7366('0x1c')]=_[_0x7366('0x1d')](config[_0x7366('0x1c')],{'host':_0x7366('0x1e'),'port':0x18eb});var socket=require(_0x7366('0x1f'))(new Redis(config[_0x7366('0x1c')]));require(_0x7366('0x20'))[_0x7366('0x21')](socket);function respondWithStatusCode(_0x27500c,_0x22562f){_0x22562f=_0x22562f||0xcc;return function(_0xf4114){if(_0xf4114){return _0x27500c['sendStatus'](_0x22562f);}return _0x27500c[_0x7366('0x22')](_0x22562f)[_0x7366('0x23')]();};}function respondWithResult(_0x338719,_0x2c0422){_0x2c0422=_0x2c0422||0xc8;return function(_0xe2c87b){if(_0xe2c87b){return _0x338719[_0x7366('0x22')](_0x2c0422)[_0x7366('0x24')](_0xe2c87b);}};}function respondWithFilteredResult(_0x22d348,_0x83e5d5){return function(_0x41113f){if(_0x41113f){var _0x1a71f5=_0x41113f[_0x7366('0x25')],_0x49e50b=_0x83e5d5[_0x7366('0x26')],_0x208ac8=_0x83e5d5[_0x7366('0x26')]+_0x83e5d5['limit'],_0x4ffbc7;if(_0x208ac8>=_0x1a71f5){_0x208ac8=_0x1a71f5;_0x4ffbc7=0xc8;}else{_0x4ffbc7=0xce;}_0x22d348[_0x7366('0x22')](_0x4ffbc7);return _0x22d348[_0x7366('0x27')](_0x7366('0x28'),_0x49e50b+'-'+_0x208ac8+'/'+_0x1a71f5)['json'](_0x41113f);}return null;};}function patchUpdates(_0x16e038){return function(_0x1946c6){try{jsonpatch['apply'](_0x1946c6,_0x16e038,!![]);}catch(_0x3bfbca){return BPromise[_0x7366('0x29')](_0x3bfbca);}return _0x1946c6[_0x7366('0x2a')]();};}function saveUpdates(_0x1a12d2,_0x3c30a2){return function(_0x1d3139){if(_0x1d3139){return _0x1d3139[_0x7366('0x2b')](_0x1a12d2)[_0x7366('0x2c')](function(_0x2095a1){return _0x2095a1;});}return null;};}function removeEntity(_0x301220,_0x12aed6){return function(_0x1dc875){if(_0x1dc875){return _0x1dc875[_0x7366('0x2d')]()['then'](function(){_0x301220[_0x7366('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x379146,_0x4ab987){return function(_0x5e30fb){if(!_0x5e30fb){_0x379146[_0x7366('0x2e')](0x194);}return _0x5e30fb;};}function handleError(_0x4d4cb5,_0x254374){_0x254374=_0x254374||0x1f4;return function(_0x4ac138){logger[_0x7366('0x2f')](_0x4ac138[_0x7366('0x30')]);if(_0x4ac138['name']){delete _0x4ac138[_0x7366('0x31')];}_0x4d4cb5['status'](_0x254374)[_0x7366('0x32')](_0x4ac138);};}function getInteractionUsers(_0x2b61af,_0x4a4e67){return new BPromise(function(_0x3cef4a,_0x507baf){try{if(_0x4a4e67[_0x2b61af['id']]){_0x2b61af[_0x7366('0x33')]=_[_0x7366('0x34')](_0x4a4e67[_0x2b61af['id']],function(_0x39d6ea){return{'id':_0x39d6ea['id'],'fullname':_0x39d6ea[_0x7366('0x35')]};});}}catch(_0x2dda4b){_0x507baf(_0x2dda4b);}_0x3cef4a(_0x2b61af);});}function getInteractionTags(_0x5e075c,_0x166628){return new BPromise(function(_0x447807,_0x538d42){try{if(_0x5e075c['TagIds']){_0x5e075c['Tags']=[];_0x5e075c['TagIds'][_0x7366('0x36')](',')[_0x7366('0x37')](function(_0x163a29){_0x5e075c[_0x7366('0x38')]['push'](_0x166628[_0x163a29]);});}delete _0x5e075c[_0x7366('0x39')];}catch(_0x2abf10){_0x538d42(_0x2abf10);}_0x447807(_0x5e075c);});}function updateSmsInteraction(_0xdaffd3,_0x21547f,_0x5214bc){return new BPromise(function(_0x3ab373,_0x311dab){return getInteractionUsers(_0xdaffd3,_0x5214bc)['then'](function(_0x2befc7){return getInteractionTags(_0x2befc7,_0x21547f);})[_0x7366('0x2c')](function(_0x1de991){_0x3ab373(_0x1de991);})[_0x7366('0x3a')](function(_0x7779c7){_0x311dab(_0x7779c7);});});}exports[_0x7366('0x3b')]=function(_0x3a69fa,_0x26858b){var _0x437713={},_0x59dead={},_0x45db2a={'count':0x0,'rows':[]};var _0x83b879=_['map'](db[_0x7366('0x3c')][_0x7366('0x3d')],function(_0x3ca8e9){return{'name':_0x3ca8e9['fieldName'],'type':_0x3ca8e9[_0x7366('0x3e')]['key']};});_0x59dead[_0x7366('0x3f')]=_['map'](_0x83b879,'name');_0x59dead[_0x7366('0x40')]=_['keys'](_0x3a69fa[_0x7366('0x40')]);_0x59dead[_0x7366('0x41')]=_['intersection'](_0x59dead[_0x7366('0x3f')],_0x59dead['query']);_0x437713[_0x7366('0x42')]=_[_0x7366('0x43')](_0x59dead[_0x7366('0x3f')],qs[_0x7366('0x44')](_0x3a69fa['query'][_0x7366('0x44')]));_0x437713[_0x7366('0x42')]=_0x437713[_0x7366('0x42')]['length']?_0x437713[_0x7366('0x42')]:_0x59dead[_0x7366('0x3f')];if(!_0x3a69fa[_0x7366('0x40')][_0x7366('0x45')](_0x7366('0x46'))){_0x437713[_0x7366('0x47')]=qs[_0x7366('0x47')](_0x3a69fa['query']['limit']);_0x437713[_0x7366('0x26')]=qs[_0x7366('0x26')](_0x3a69fa['query'][_0x7366('0x26')]);}_0x437713[_0x7366('0x48')]=qs['sort'](_0x3a69fa[_0x7366('0x40')]['sort']);_0x437713[_0x7366('0x49')]=qs[_0x7366('0x41')](_['pick'](_0x3a69fa['query'],_0x59dead[_0x7366('0x41')]),_0x83b879);var _0xedc3c7=[];var _0x2ac2e6=squel[_0x7366('0x4a')]()['field']('id')[_0x7366('0x4b')](_0x7366('0x31'))[_0x7366('0x4b')](_0x7366('0x4c'))[_0x7366('0x4d')](_0x7366('0x4e'));var _0x37fcd6=squel['select']()[_0x7366('0x4b')](_0x7366('0x4f'))[_0x7366('0x4b')]('u.fullname')[_0x7366('0x4b')](_0x7366('0x50'))['from'](_0x7366('0x51'),'ui')[_0x7366('0x52')](_0x7366('0x53'),'u','u.id\x20=\x20ui.UserId');var _0x1909d4=squel[_0x7366('0x4a')]()[_0x7366('0x4d')]('sms_interactions','i')[_0x7366('0x52')](_0x7366('0x54'),'c',_0x7366('0x55'))['left_join'](_0x7366('0x53'),'o',_0x7366('0x56'))[_0x7366('0x52')](_0x7366('0x57'),'a','a.id\x20=\x20i.SmsAccountId')[_0x7366('0x52')](_0x7366('0x58'),'me',_0x7366('0x59'))[_0x7366('0x52')](_0x7366('0x5a'),'it',_0x7366('0x5b'))[_0x7366('0x52')](_0x7366('0x4e'),'t',_0x7366('0x5c'));var _0x59f078=squel[_0x7366('0x5d')]();var _0x1b8dcd=[];var _0x5db903=squel[_0x7366('0x5d')]();var _0x33a804;if(_0x3a69fa['query'][_0x7366('0x5e')]){_0x33a804=as['parseSearch'](_0x3a69fa[_0x7366('0x40')][_0x7366('0x5e')]);var _0x1295ca=_0x33a804[_0x7366('0x5f')];for(var _0x588b31=0x0;_0x588b31<_0x33a804[_0x7366('0x60')][_0x7366('0x61')];_0x588b31++){var _0x390bd7=_0x33a804[_0x7366('0x60')][_0x588b31];var _0x1de0a7='i';var _0x2146dc=_[_0x7366('0x62')](_0x83b879,[_0x7366('0x31'),_0x390bd7[_0x7366('0x4b')]]);if(!_0x2146dc){switch(_0x390bd7[_0x7366('0x4b')]){case _0x7366('0x63'):if(_0x390bd7[_0x7366('0x64')]==0x1){_0x1909d4['having']('`'+_0x390bd7[_0x7366('0x4b')]+'`\x20=\x200');}else{_0x1909d4['having']('`'+_0x390bd7[_0x7366('0x4b')]+_0x7366('0x65'));}break;case'Contact':if(_0x390bd7[_0x7366('0x66')]===_0x7366('0x67')){if(_0x390bd7['value']['split']('\x20')[_0x7366('0x61')]>0x1){_0x59f078[_0x1295ca]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x7366('0x68')](_0x390bd7[_0x7366('0x64')]),null);}else{var _0x4ca4f7='%'+_0x390bd7[_0x7366('0x64')]+'%';_0x59f078[_0x1295ca](_0x7366('0x69'),_0x4ca4f7,_0x4ca4f7,_0x4ca4f7);}}else{_0x2146dc=_[_0x7366('0x62')](_0x83b879,['name',_0x7366('0x6a')]);_0x390bd7[_0x7366('0x4b')]=_0x7366('0x6a');_0x523016=as[_0x7366('0x6b')](_0x1de0a7,_0x2146dc['type'],_0x390bd7);_0x59f078[_0x1295ca](_0x523016[_0x7366('0x6c')],_0x523016[_0x7366('0x64')][_0x7366('0x6d')],_0x523016[_0x7366('0x64')][_0x7366('0x23')]);}break;case'Tag':var _0x1249a7=_0x390bd7[_0x7366('0x64')][_0x7366('0x36')](',')[_0x7366('0x34')](function(_0x54c117){return Number(_0x54c117);});_0x1249a7[_0x7366('0x37')](function(_0x5cbefc){_0x5db903['or'](_0x7366('0x6e'),'%,'+_0x5cbefc+',%');});_0x1b8dcd=_[_0x7366('0x6f')](_0x1b8dcd,_0x1249a7);break;case'User':if(_0x390bd7[_0x7366('0x66')]===_0x7366('0x67')){_0x59f078[_0x1295ca](_0x7366('0x70'),'%'+_0x390bd7[_0x7366('0x64')]+'%',null);}else{_0x2146dc=_['find'](_0x83b879,['name',_0x7366('0x71')]);_0x390bd7['field']=_0x7366('0x71');_0x523016=as[_0x7366('0x6b')](_0x1de0a7,_0x2146dc[_0x7366('0x3e')],_0x390bd7);_0x59f078[_0x1295ca](_0x523016[_0x7366('0x6c')],_0x523016[_0x7366('0x64')][_0x7366('0x6d')],_0x523016[_0x7366('0x64')][_0x7366('0x23')]);}break;case _0x7366('0x72'):_0x523016=as['buildExpression']('me',null,_0x390bd7);_0x59f078[_0x1295ca](_0x523016[_0x7366('0x6c')],_0x523016['value']['start'],_0x523016['value'][_0x7366('0x23')]);break;}}else{var _0x523016=as[_0x7366('0x6b')](_0x1de0a7,_0x2146dc['type'],_0x390bd7);_0x59f078[_0x1295ca](_0x523016[_0x7366('0x6c')],_0x523016['value'][_0x7366('0x6d')],_0x523016[_0x7366('0x64')]['end']);}}}else{var _0x4793c6=_(_0x3a69fa[_0x7366('0x40')])[_0x7366('0x73')]()[_0x7366('0x34')](function(_0x37a599){return _['some'](_0x83b879,[_0x7366('0x31'),_0x37a599])?_0x37a599:undefined;})[_0x7366('0x74')]()[_0x7366('0x64')]();if(!_['isEmpty'](_0x4793c6)){_0x4793c6['forEach'](function(_0x26ab9b){if(_0x26ab9b===_0x7366('0x75')){_0x1909d4[_0x7366('0x49')]('i.SmsAccountId\x20IN\x20?',[][_0x7366('0x76')](_0x3a69fa[_0x7366('0x40')][_0x26ab9b]));}else if(_0x26ab9b===_0x7366('0x77')){var _0x236180=JSON[_0x7366('0x78')](_0x3a69fa[_0x7366('0x40')][_0x26ab9b])[_0x7366('0x79')];var _0x38c65b=JSON[_0x7366('0x78')](_0x3a69fa[_0x7366('0x40')][_0x26ab9b])[_0x7366('0x7a')];_0x1909d4['where'](_0x7366('0x7b'),_0x236180,_0x38c65b);}else{if(_0x3a69fa[_0x7366('0x40')][_0x26ab9b]==='null'){_0x1909d4[_0x7366('0x49')]('i.'+_0x26ab9b+'\x20IS\x20NULL');}else{_0x1909d4['where']('i.'+_0x26ab9b+_0x7366('0x7c'),_0x3a69fa[_0x7366('0x40')][_0x26ab9b]);}}});}if(_0x3a69fa[_0x7366('0x40')][_0x7366('0x7d')]){if(_0x3a69fa[_0x7366('0x40')][_0x7366('0x7d')]==0x1){_0x1909d4['having'](_0x7366('0x7e'));}else{_0x1909d4[_0x7366('0x7f')](_0x7366('0x80'));}}if(_0x3a69fa['query'][_0x7366('0x81')]){_0x1b8dcd=_['isArray'](_0x3a69fa['query'][_0x7366('0x81')])?_0x3a69fa['query'][_0x7366('0x81')]:new Array(_0x3a69fa[_0x7366('0x40')][_0x7366('0x81')]);_0x1b8dcd[_0x7366('0x37')](function(_0x4b9045){_0x5db903['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4b9045+',%');});}if(_0x3a69fa[_0x7366('0x40')][_0x7366('0x82')]){var _0x1a2c88=_0x3a69fa[_0x7366('0x40')]['filter'][_0x7366('0x83')]('\x5c','\x5c\x5c')['replace']('\x27\x27','\x27\x27\x27\x27');if(qs[_0x7366('0x84')](_0x1a2c88)){_0x59f078['or'](_0x7366('0x85'),_0x1a2c88+'%')['or']('i.phone\x20LIKE\x20?',_0x1a2c88+'%');}else{_0x59f078['or'](_0x7366('0x86'),qs[_0x7366('0x68')](_0x1a2c88))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x1a2c88+'%');}}}_0x1909d4[_0x7366('0x49')](_0x59f078);_0x1909d4[_0x7366('0x87')](_0x7366('0x88'));var _0x3cad9e={'type':db[_0x7366('0x89')][_0x7366('0x8a')][_0x7366('0x8b')],'raw':!![]};var _0x16b3a=_0x1909d4[_0x7366('0x8c')]();_0x16b3a[_0x7366('0x4b')]('i.id');_0x16b3a['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x7366('0x63'));if(_0x437713[_0x7366('0x48')]){_0x437713[_0x7366('0x48')]['forEach'](function(_0x2754ae){_0x1909d4[_0x7366('0x48')]('i.'+_0x2754ae[0x0],_0x2754ae[0x1]===_0x7366('0x8d')?![]:!![]);});}if(!_[_0x7366('0x8e')](_0x1b8dcd)){_0x1909d4[_0x7366('0x7f')](_0x5db903);_0x16b3a['where'](_0x7366('0x8f'),_0x1b8dcd);}BPromise[_0x7366('0x90')]()['then'](function(){if(!_0x33a804){if(_0x3a69fa[_0x7366('0x40')][_0x7366('0x75')]||_0x3a69fa[_0x7366('0x40')][_0x7366('0x91')])return;_0x16b3a[_0x7366('0x49')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x1909d4['where'](_0x7366('0x92'));return;}return _0x3a69fa[_0x7366('0x93')][_0x7366('0x94')]({'attributes':['id'],'raw':!![]})[_0x7366('0x2c')](function(_0x3bc663){if(_[_0x7366('0x8e')](_0x3bc663)){_0x16b3a[_0x7366('0x49')](_0x7366('0x95'));_0x1909d4[_0x7366('0x49')](_0x7366('0x95'));}else{_0x16b3a[_0x7366('0x49')](_0x7366('0x96'),_[_0x7366('0x34')](_0x3bc663,'id'));_0x1909d4[_0x7366('0x49')]('i.SmsAccountId\x20IN\x20?',_[_0x7366('0x34')](_0x3bc663,'id'));}});})['then'](function(){db[_0x7366('0x97')]['query'](_0x16b3a[_0x7366('0x98')](),_0x3cad9e)['then'](function(_0x313478){_0x45db2a[_0x7366('0x25')]=_0x313478['length'];if(_0x45db2a[_0x7366('0x25')]===0x0)return[];return db[_0x7366('0x97')]['query'](_0x2ac2e6['toString'](),_0x3cad9e)[_0x7366('0x2c')](function(_0x1821e1){_0xedc3c7=_['keyBy'](_0x1821e1,'id');_0x3cad9e=_[_0x7366('0x99')](_0x3cad9e,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3a69fa[_0x7366('0x40')]['fields']){_0x437713['attributes'][_0x7366('0x37')](function(_0x40a7a3){_0x1909d4[_0x7366('0x4b')]('i.'+_0x40a7a3);});}else{_0x1909d4['field'](_0x7366('0x9a'),_0x7366('0x63'));_0x1909d4[_0x7366('0x4b')]('a.key',_0x7366('0x9b'));_0x1909d4[_0x7366('0x4b')](_0x7366('0x9c'),_0x7366('0x9d'));_0x1909d4[_0x7366('0x4b')](_0x7366('0x9e'));_0x1909d4['field'](_0x7366('0x9f'),_0x7366('0xa0'));_0x1909d4[_0x7366('0x4b')]('c.lastName',_0x7366('0xa1'));_0x1909d4['field'](_0x7366('0xa2'),_0x7366('0xa3'));_0x1909d4[_0x7366('0x4b')](_0x7366('0xa4'),_0x7366('0xa5'));_0x1909d4[_0x7366('0x4b')](_0x7366('0xa6'),_0x7366('0xa7'));_0x1909d4[_0x7366('0x4b')](_0x7366('0xa8'),_0x7366('0xa9'));_0x1909d4[_0x7366('0x4b')](_0x7366('0xaa'),'Owner.fullname');_0x1909d4[_0x7366('0x4b')](_0x7366('0xab'),_0x7366('0xac'));_0x1909d4[_0x7366('0x4b')](_0x7366('0xad'),'TagIds');}if(_0x437713[_0x7366('0x47')])_0x1909d4[_0x7366('0x47')](_0x437713['limit']);if(_0x437713[_0x7366('0x26')])_0x1909d4[_0x7366('0x26')](_0x437713[_0x7366('0x26')]);return db['sequelize'][_0x7366('0x40')](_0x1909d4['toString'](),_0x3cad9e);})['then'](function(_0x5d3a75){_0x37fcd6[_0x7366('0x49')](_0x7366('0xae'),_[_0x7366('0x34')](_0x5d3a75,'id'));return db[_0x7366('0x97')][_0x7366('0x40')](_0x37fcd6[_0x7366('0x98')](),_0x3cad9e)['then'](function(_0x506c11){var _0x133be0=_[_0x7366('0xaf')](_0x506c11,_0x7366('0xb0'));var _0xe26771=[];_0x5d3a75['forEach'](function(_0x2c69bf){_0xe26771[_0x7366('0xb1')](updateSmsInteraction(_0x2c69bf,_0xedc3c7,_0x133be0));});return BPromise[_0x7366('0xb2')](_0xe26771);});});})[_0x7366('0x2c')](function(_0x12b3e2){_0x45db2a[_0x7366('0xb3')]=_0x12b3e2;return _0x45db2a;})['then'](respondWithFilteredResult(_0x26858b,_0x437713));})[_0x7366('0x3a')](handleError(_0x26858b,null));};exports[_0x7366('0xb4')]=function(_0x2e52a7,_0x33ae81){var _0x108dba={'raw':![],'where':{'id':_0x2e52a7[_0x7366('0xb5')]['id']}},_0x123d0a={};_0x123d0a['model']=_[_0x7366('0x73')](db[_0x7366('0x3c')]['rawAttributes']);_0x123d0a[_0x7366('0x40')]=_[_0x7366('0x73')](_0x2e52a7[_0x7366('0x40')]);_0x123d0a[_0x7366('0x41')]=_[_0x7366('0x43')](_0x123d0a['model'],_0x123d0a['query']);_0x108dba['attributes']=_[_0x7366('0x43')](_0x123d0a[_0x7366('0x3f')],qs[_0x7366('0x44')](_0x2e52a7[_0x7366('0x40')][_0x7366('0x44')]));_0x108dba[_0x7366('0x42')]=_0x108dba[_0x7366('0x42')][_0x7366('0x61')]?_0x108dba['attributes']:_0x123d0a[_0x7366('0x3f')];if(_0x2e52a7[_0x7366('0x40')]['includeAll']){_0x108dba[_0x7366('0xb6')]=[{'all':!![]}];}_0x108dba=_['merge']({},_0x108dba,_0x2e52a7['options']);return db['SmsInteraction'][_0x7366('0x62')](_0x108dba)[_0x7366('0x2c')](handleEntityNotFound(_0x33ae81,null))[_0x7366('0x2c')](respondWithResult(_0x33ae81,null))[_0x7366('0x3a')](handleError(_0x33ae81,null));};exports[_0x7366('0xb7')]=function(_0x29640b,_0x313ea8){return db[_0x7366('0x3c')][_0x7366('0xb7')](_0x29640b[_0x7366('0x72')],{})['then'](respondWithResult(_0x313ea8,0xc9))[_0x7366('0x3a')](handleError(_0x313ea8,null));};exports[_0x7366('0x2b')]=function(_0x5e0556,_0x57df7b){if(_0x5e0556[_0x7366('0x72')]['id']){delete _0x5e0556[_0x7366('0x72')]['id'];}return db[_0x7366('0x3c')][_0x7366('0x62')]({'where':{'id':_0x5e0556[_0x7366('0xb5')]['id']}})['then'](handleEntityNotFound(_0x57df7b,null))[_0x7366('0x2c')](saveUpdates(_0x5e0556[_0x7366('0x72')],null))[_0x7366('0x2c')](respondWithResult(_0x57df7b,null))[_0x7366('0x3a')](handleError(_0x57df7b,null));};exports[_0x7366('0x2d')]=function(_0x57a6b7,_0x18c2bf){return db[_0x7366('0x3c')][_0x7366('0x62')]({'where':{'id':_0x57a6b7[_0x7366('0xb5')]['id']}})[_0x7366('0x2c')](handleEntityNotFound(_0x18c2bf,null))[_0x7366('0x2c')](removeEntity(_0x18c2bf,null))[_0x7366('0x3a')](handleError(_0x18c2bf,null));};exports[_0x7366('0xb8')]=function(_0x5c1ec2,_0x544935){return db[_0x7366('0x3c')][_0x7366('0xb8')]()[_0x7366('0x2c')](respondWithResult(_0x544935,null))[_0x7366('0x3a')](handleError(_0x544935,null));};exports[_0x7366('0xb9')]=function(_0x36fdb0,_0x1844f8,_0x31138d){return db['SmsMessage'][_0x7366('0x62')]({'where':{'id':_0x36fdb0['params']['id']}})[_0x7366('0x2c')](handleEntityNotFound(_0x1844f8,null))[_0x7366('0x2c')](function(_0x172ee4){if(_0x172ee4){return _0x172ee4[_0x7366('0xb9')](_0x36fdb0[_0x7366('0x72')][_0x7366('0xba')],_[_0x7366('0xbb')](_0x36fdb0[_0x7366('0x72')],[_0x7366('0xba'),'id'])||{});}})[_0x7366('0x2c')](respondWithResult(_0x1844f8,null))[_0x7366('0x3a')](handleError(_0x1844f8,null));};exports[_0x7366('0xbc')]=function(_0x576751,_0x1acf3b,_0xd4246a){var _0x2ff830={'raw':![],'where':{}};var _0x145519={};var _0x3c36db={'count':0x0,'rows':[]};return db[_0x7366('0x3c')][_0x7366('0xbd')]({'where':{'id':_0x576751[_0x7366('0xb5')]['id']}})['then'](handleEntityNotFound(_0x1acf3b,null))[_0x7366('0x2c')](function(_0x2e0ccb){if(_0x2e0ccb){_0x145519[_0x7366('0x3f')]=_[_0x7366('0x73')](db[_0x7366('0xbe')][_0x7366('0x3d')]);_0x145519[_0x7366('0x40')]=_[_0x7366('0x73')](_0x576751[_0x7366('0x40')]);_0x145519[_0x7366('0x41')]=_[_0x7366('0x43')](_0x145519[_0x7366('0x3f')],_0x145519[_0x7366('0x40')]);_0x2ff830['attributes']=_[_0x7366('0x43')](_0x145519[_0x7366('0x3f')],qs['fields'](_0x576751['query']['fields']));_0x2ff830['attributes']=_0x2ff830[_0x7366('0x42')]['length']?_0x2ff830[_0x7366('0x42')]:_0x145519[_0x7366('0x3f')];if(!_0x576751['query'][_0x7366('0x45')](_0x7366('0x46'))){_0x2ff830[_0x7366('0x47')]=qs['limit'](_0x576751[_0x7366('0x40')][_0x7366('0x47')]);_0x2ff830['offset']=qs[_0x7366('0x26')](_0x576751[_0x7366('0x40')][_0x7366('0x26')]);}_0x2ff830[_0x7366('0x48')]=qs[_0x7366('0xbf')](_0x576751[_0x7366('0x40')]['sort']);_0x2ff830[_0x7366('0x49')]=qs[_0x7366('0x41')](_['pick'](_0x576751[_0x7366('0x40')],_0x145519[_0x7366('0x41')]));_0x2ff830[_0x7366('0x49')]['SmsInteractionId']=_0x2e0ccb['id'];if(_0x576751[_0x7366('0x40')][_0x7366('0x82')]){_0x2ff830['where']=_[_0x7366('0x99')](_0x2ff830[_0x7366('0x49')],{'$or':_[_0x7366('0x34')](_0x2ff830[_0x7366('0x42')],function(_0x54d697){var _0x4aaba8={};_0x4aaba8[_0x54d697]={'$like':'%'+_0x576751[_0x7366('0x40')][_0x7366('0x82')]+'%'};return _0x4aaba8;})});}if(_0x576751['query']['$gte']){var _0x4f0e41=_0x576751[_0x7366('0x40')][_0x7366('0x79')]['split'](',');var _0x20930e={};_0x20930e[_0x4f0e41[0x0]]={'$gte':moment(_0x4f0e41[0x1])['format'](_0x7366('0xc0'))};_0x2ff830[_0x7366('0x49')]=_[_0x7366('0x99')](_0x2ff830['where'],_0x20930e);}_0x2ff830=_[_0x7366('0x99')]({},_0x2ff830,_0x576751[_0x7366('0xc1')]);return db[_0x7366('0xbe')]['count']({'where':_0x2ff830[_0x7366('0x49')]})[_0x7366('0x2c')](function(_0x20a10b){_0x3c36db[_0x7366('0x25')]=_0x20a10b;if(_0x576751[_0x7366('0x40')][_0x7366('0xc2')]){_0x2ff830[_0x7366('0xb6')]=[{'all':!![]}];}return db[_0x7366('0xbe')][_0x7366('0xc3')](_0x2ff830);})[_0x7366('0x2c')](function(_0x58a5b5){_0x3c36db[_0x7366('0xb3')]=_0x58a5b5;return _0x3c36db;});}})['then'](respondWithFilteredResult(_0x1acf3b,_0x2ff830))[_0x7366('0x3a')](handleError(_0x1acf3b,null));};exports[_0x7366('0xc4')]=function(_0x26ef04,_0x328b4a,_0x17b9e5){return db[_0x7366('0x3c')][_0x7366('0x62')]({'where':{'id':_0x26ef04['params']['id']}})[_0x7366('0x2c')](handleEntityNotFound(_0x328b4a,null))[_0x7366('0x2c')](function(_0x540c12){if(_0x540c12){return _0x540c12[_0x7366('0xc5')](_0x26ef04[_0x7366('0x72')][_0x7366('0xba')],_[_0x7366('0xbb')](_0x26ef04[_0x7366('0x72')],[_0x7366('0xba'),'id'])||{})[_0x7366('0xc6')](function(){return db['Tag'][_0x7366('0xc3')]({'attributes':['id',_0x7366('0x31'),'color'],'where':{'id':_0x26ef04[_0x7366('0x72')][_0x7366('0xba')]}});})[_0x7366('0x2c')](function(_0x49139e){socket[_0x7366('0xc7')]('smsInteractionTags:save',{'id':Number(_0x26ef04[_0x7366('0xb5')]['id']),'tags':_0x49139e||[]});return{'id':Number(_0x26ef04[_0x7366('0xb5')]['id']),'tags':_0x49139e||[]};});}})[_0x7366('0x2c')](respondWithResult(_0x328b4a,null))['catch'](handleError(_0x328b4a,null));};exports['removeTags']=function(_0x19414f,_0x432daf,_0x1d5a79){return db[_0x7366('0x3c')][_0x7366('0x62')]({'where':{'id':_0x19414f[_0x7366('0xb5')]['id']}})[_0x7366('0x2c')](handleEntityNotFound(_0x432daf,null))[_0x7366('0x2c')](function(_0x433172){if(_0x433172){return _0x433172['removeTags'](_0x19414f[_0x7366('0x40')][_0x7366('0xba')]);}})[_0x7366('0x2c')](respondWithStatusCode(_0x432daf,null))['catch'](handleError(_0x432daf,null));};exports[_0x7366('0xc8')]=function(_0x1f21e7,_0x652bd2){var _0x4c42fa=moment()[_0x7366('0xc9')]()['toString']();var _0x3a9cdd=path['join'](config[_0x7366('0xca')],'server','files',_0x7366('0xcb'));var _0x368452=path['join'](config[_0x7366('0xca')],_0x7366('0xcc'),_0x7366('0xcd'),_0x7366('0xce'));var _0x3774be=path[_0x7366('0xcf')](_0x3a9cdd,_0x4c42fa);var _0x41d8ae=util[_0x7366('0xd0')](_0x7366('0xd1'),_0x1f21e7[_0x7366('0xb5')]['id'],_0x4c42fa);var _0xbeb315=path['join'](_0x3a9cdd,_0x41d8ae);var _0x3dd418=[];_0x3dd418['push']({'model':db[_0x7366('0xd2')],'as':_0x7366('0xd2'),'attributes':['id',_0x7366('0x35')],'raw':!![]});_0x3dd418[_0x7366('0xb1')]({'model':db[_0x7366('0xd3')],'as':'Contact','attributes':['id',_0x7366('0xd4'),_0x7366('0xd5')],'raw':!![]});var _0x237485=[{'model':db[_0x7366('0xbe')],'as':_0x7366('0xd6'),'attributes':['id',_0x7366('0x72'),_0x7366('0x77'),_0x7366('0xd7'),_0x7366('0xd8'),'read'],'include':_0x3dd418}];_0x237485['push']({'model':db['SmsAccount'],'as':_0x7366('0xd9'),'attributes':['id','name']});_0x237485['push']({'model':db[_0x7366('0xd2')],'as':_0x7366('0xda'),'attributes':['id',_0x7366('0x35')]});return db[_0x7366('0x3c')][_0x7366('0x62')]({'where':{'id':_0x1f21e7[_0x7366('0xb5')]['id']},'include':_0x237485})['then'](handleEntityNotFound(_0x652bd2,null))[_0x7366('0x2c')](function(_0x5ed9eb){if(_0x5ed9eb){var _0x4c6f72=_0x5ed9eb[_0x7366('0xdb')]({'plain':!![]});fs[_0x7366('0xdc')](_0x3774be);var _0x17571a={'format':'A4','border':_0x7366('0xdd'),'header':{'height':_0x7366('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':_0x7366('0xdf'),'contents':{'default':util[_0x7366('0xd0')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\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[_0x7366('0xd0')]('%s\x20#%d',_0x7366('0xe0'),_0x4c6f72['id']),moment()[_0x7366('0xd0')](_0x7366('0xe1'))[_0x7366('0x98')]())}}};var _0x402781={'channel':_0x7366('0xe0'),'account':_0x4c6f72[_0x7366('0xd9')]['name'],'agent':_0x4c6f72[_0x7366('0xda')]?_0x4c6f72[_0x7366('0xda')]['fullname']:'N.A.','createdAt':moment(_0x4c6f72[_0x7366('0x77')])[_0x7366('0xd0')](_0x7366('0xc0'))[_0x7366('0x98')](),'closedAt':_0x4c6f72[_0x7366('0xe2')]?moment(_0x4c6f72[_0x7366('0xe3')])['format'](_0x7366('0xc0'))[_0x7366('0x98')]():'','disposition':_0x4c6f72[_0x7366('0xe4')],'messages':_(_0x4c6f72[_0x7366('0xd6')])['filter']({'secret':![]})[_0x7366('0x34')](function(_0x33d651){return{'date':moment(_0x33d651[_0x7366('0x77')])[_0x7366('0xd0')](_0x7366('0xc0'))[_0x7366('0x98')](),'sender':_0x33d651[_0x7366('0xd7')]==='out'?_0x33d651[_0x7366('0xd2')]?_0x33d651['User']['fullname']:_0x7366('0xe5'):_0x33d651['Contact'][_0x7366('0xd4')]+(_0x33d651[_0x7366('0xe6')]['lastName']?'\x20'+_0x33d651[_0x7366('0xe6')][_0x7366('0xd5')]:''),'body':_0x33d651[_0x7366('0x72')],'direction':_0x33d651[_0x7366('0xd7')]===_0x7366('0xe7')?'A':'C','secret':_0x33d651['secret'],'read':_0x33d651['read']};})[_0x7366('0x64')]()};return ejs[_0x7366('0xe8')](path['join'](config['root'],_0x7366('0xcc'),_0x7366('0xe9'),_0x7366('0xea')),{'interaction':_0x402781})[_0x7366('0x2c')](function(_0x286bb4){return new BPromise(function(_0x5c264f,_0x2e9f64){pdf['create'](_0x286bb4,_0x17571a)[_0x7366('0xeb')](path[_0x7366('0xcf')](_0x3774be,_0x7366('0xec')+_0x4c6f72['id']+'-'+_0x4c42fa+'.pdf'),function(_0x28096d,_0x1d8808){if(_0x28096d)return _0x2e9f64(_0x28096d);_0x5c264f(_0x1d8808);});});})[_0x7366('0x2c')](function(){return new BPromise(function(_0x5660cf,_0x42e7ad){zipdir(_0x3774be,{'saveTo':_0xbeb315},function(_0x37c6b2,_0x56e058){if(_0x37c6b2)return _0x42e7ad(_0x37c6b2);return _0x5660cf(_0x56e058);});})[_0x7366('0x2c')](function(){return new BPromise(function(_0x581897,_0x3de2a6){rimraf(_0x3774be,function(_0x5073d9){if(_0x5073d9)_0x3de2a6(_0x5073d9);return _0x581897();});});})[_0x7366('0x2c')](function(){return _0x652bd2[_0x7366('0xc8')](_0xbeb315,_0x41d8ae,function(_0x35e024){if(_0x35e024){console[_0x7366('0xed')](_0x7366('0xee'),_0x35e024);}else{fs[_0x7366('0xef')](_0xbeb315);}});});});}else{return _0x652bd2[_0x7366('0x2e')](0xc8);}})[_0x7366('0x3a')](handleError(_0x652bd2,null));}; \ No newline at end of file +var _0x878f=['sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','value','find','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','SmsAccountId','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','t.id\x20IN\x20?','resolve','journey','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','toString','sequelize','keyBy','SmsInteraction','Account.key','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','push','all','rows','rawAttributes','includeAll','include','options','create','params','describe','SmsMessage','addMessage','ids','omit','getMessages','nolimit','pick','format','YYYY-MM-DD\x20HH:mm:ss','merge','addTags','spread','findAll','color','smsInteractionTags:save','removeTags','unix','join','root','files','tmp','server','attachments','fullname','firstName','lastName','Messages','direction','secret','Owner','get','mkdirSync','10px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Sms','YYYY-MM-DD','Account','closed','disposition','out','System','downloadInteraction.html','toFile','.pdf','download','log','err','unlinkSync','sendStatus','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','error','name','send','Users','Tags','TagIds','split','forEach','catch','index','map','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','select','field','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','users','u.id\x20=\x20ui.UserId','sms_interactions','left_join','cm_contacts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x878f,0x173));var _0xf878=function(_0x1ced39,_0x4b8816){_0x1ced39=_0x1ced39-0x0;var _0x1e6888=_0x878f[_0x1ced39];return _0x1e6888;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf878('0x0'));var rimraf=require(_0xf878('0x1'));var zipdir=require(_0xf878('0x2'));var jsonpatch=require(_0xf878('0x3'));var rp=require(_0xf878('0x4'));var moment=require(_0xf878('0x5'));var BPromise=require(_0xf878('0x6'));var Mustache=require(_0xf878('0x7'));var util=require(_0xf878('0x8'));var path=require(_0xf878('0x9'));var sox=require(_0xf878('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xf878('0xb'));var squel=require(_0xf878('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf878('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf878('0xe'));var authService=require(_0xf878('0xf'));var qs=require(_0xf878('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf878('0x11'));var logger=require(_0xf878('0x12'))('api');var utils=require(_0xf878('0x13'));var config=require('../../config/environment');var db=require(_0xf878('0x14'))['db'];config[_0xf878('0x15')]=_[_0xf878('0x16')](config['redis'],{'host':_0xf878('0x17'),'port':0x18eb});var socket=require(_0xf878('0x18'))(new Redis(config[_0xf878('0x15')]));require('./smsInteraction.socket')[_0xf878('0x19')](socket);function respondWithStatusCode(_0x3902f7,_0x119e9e){_0x119e9e=_0x119e9e||0xcc;return function(_0x492260){if(_0x492260){return _0x3902f7['sendStatus'](_0x119e9e);}return _0x3902f7[_0xf878('0x1a')](_0x119e9e)[_0xf878('0x1b')]();};}function respondWithResult(_0x31d888,_0x6dbeca){_0x6dbeca=_0x6dbeca||0xc8;return function(_0x44aacc){if(_0x44aacc){return _0x31d888[_0xf878('0x1a')](_0x6dbeca)[_0xf878('0x1c')](_0x44aacc);}};}function respondWithFilteredResult(_0x2c8953,_0x3c5dee){return function(_0x3a55f3){if(_0x3a55f3){var _0x3b2e1b=_0x3a55f3[_0xf878('0x1d')],_0x47a91a=_0x3c5dee[_0xf878('0x1e')],_0x2b2b54=_0x3c5dee[_0xf878('0x1e')]+_0x3c5dee[_0xf878('0x1f')],_0x34ae59;if(_0x2b2b54>=_0x3b2e1b){_0x2b2b54=_0x3b2e1b;_0x34ae59=0xc8;}else{_0x34ae59=0xce;}_0x2c8953[_0xf878('0x1a')](_0x34ae59);return _0x2c8953['set'](_0xf878('0x20'),_0x47a91a+'-'+_0x2b2b54+'/'+_0x3b2e1b)[_0xf878('0x1c')](_0x3a55f3);}return null;};}function patchUpdates(_0x250f85){return function(_0x59efcb){try{jsonpatch[_0xf878('0x21')](_0x59efcb,_0x250f85,!![]);}catch(_0x23590c){return BPromise[_0xf878('0x22')](_0x23590c);}return _0x59efcb[_0xf878('0x23')]();};}function saveUpdates(_0x22d884,_0x442450){return function(_0x1cbc92){if(_0x1cbc92){return _0x1cbc92[_0xf878('0x24')](_0x22d884)[_0xf878('0x25')](function(_0x1a6506){return _0x1a6506;});}return null;};}function removeEntity(_0x45e61f,_0x566995){return function(_0x2ac38b){if(_0x2ac38b){return _0x2ac38b['destroy']()[_0xf878('0x25')](function(){_0x45e61f[_0xf878('0x1a')](0xcc)[_0xf878('0x1b')]();});}};}function handleEntityNotFound(_0x280036,_0x20449e){return function(_0x5ebaa0){if(!_0x5ebaa0){_0x280036['sendStatus'](0x194);}return _0x5ebaa0;};}function handleError(_0x59ba7b,_0x242926){_0x242926=_0x242926||0x1f4;return function(_0x3baba4){logger[_0xf878('0x26')](_0x3baba4['stack']);if(_0x3baba4[_0xf878('0x27')]){delete _0x3baba4[_0xf878('0x27')];}_0x59ba7b[_0xf878('0x1a')](_0x242926)[_0xf878('0x28')](_0x3baba4);};}function getInteractionUsers(_0x41dd55,_0x5aff46){return new BPromise(function(_0x502322,_0x9a127d){try{if(_0x5aff46[_0x41dd55['id']]){_0x41dd55[_0xf878('0x29')]=_['map'](_0x5aff46[_0x41dd55['id']],function(_0x31e2e1){return{'id':_0x31e2e1['id'],'fullname':_0x31e2e1['fullname']};});}}catch(_0x969ee3){_0x9a127d(_0x969ee3);}_0x502322(_0x41dd55);});}function getInteractionTags(_0x51afaf,_0x2c61c1){return new BPromise(function(_0x49e66a,_0x2630fb){try{if(_0x51afaf['TagIds']){_0x51afaf[_0xf878('0x2a')]=[];_0x51afaf[_0xf878('0x2b')][_0xf878('0x2c')](',')[_0xf878('0x2d')](function(_0x27c53b){_0x51afaf[_0xf878('0x2a')]['push'](_0x2c61c1[_0x27c53b]);});}delete _0x51afaf[_0xf878('0x2b')];}catch(_0x3c7114){_0x2630fb(_0x3c7114);}_0x49e66a(_0x51afaf);});}function updateSmsInteraction(_0x4218f1,_0x358c13,_0xd11e68){return new BPromise(function(_0x487e39,_0x2288cb){return getInteractionUsers(_0x4218f1,_0xd11e68)[_0xf878('0x25')](function(_0x56938d){return getInteractionTags(_0x56938d,_0x358c13);})[_0xf878('0x25')](function(_0xd1ad51){_0x487e39(_0xd1ad51);})[_0xf878('0x2e')](function(_0x3a7f0d){_0x2288cb(_0x3a7f0d);});});}exports[_0xf878('0x2f')]=function(_0x4e3cab,_0x11d669){var _0x1b09de={},_0x2eb76d={},_0x129805={'count':0x0,'rows':[]};var _0x579c91=_[_0xf878('0x30')](db['SmsInteraction']['rawAttributes'],function(_0x1e1174){return{'name':_0x1e1174[_0xf878('0x31')],'type':_0x1e1174[_0xf878('0x32')][_0xf878('0x33')]};});_0x2eb76d[_0xf878('0x34')]=_['map'](_0x579c91,_0xf878('0x27'));_0x2eb76d['query']=_[_0xf878('0x35')](_0x4e3cab[_0xf878('0x36')]);_0x2eb76d['filters']=_[_0xf878('0x37')](_0x2eb76d[_0xf878('0x34')],_0x2eb76d['query']);_0x1b09de[_0xf878('0x38')]=_[_0xf878('0x37')](_0x2eb76d['model'],qs[_0xf878('0x39')](_0x4e3cab[_0xf878('0x36')][_0xf878('0x39')]));_0x1b09de[_0xf878('0x38')]=_0x1b09de[_0xf878('0x38')][_0xf878('0x3a')]?_0x1b09de[_0xf878('0x38')]:_0x2eb76d['model'];if(!_0x4e3cab[_0xf878('0x36')][_0xf878('0x3b')]('nolimit')){_0x1b09de[_0xf878('0x1f')]=qs['limit'](_0x4e3cab['query'][_0xf878('0x1f')]);_0x1b09de[_0xf878('0x1e')]=qs[_0xf878('0x1e')](_0x4e3cab[_0xf878('0x36')][_0xf878('0x1e')]);}_0x1b09de['order']=qs[_0xf878('0x3c')](_0x4e3cab['query'][_0xf878('0x3c')]);_0x1b09de[_0xf878('0x3d')]=qs['filters'](_['pick'](_0x4e3cab[_0xf878('0x36')],_0x2eb76d[_0xf878('0x3e')]),_0x579c91);var _0x13fcd3=[];var _0x2f6ee5=squel[_0xf878('0x3f')]()[_0xf878('0x40')]('id')[_0xf878('0x40')](_0xf878('0x27'))[_0xf878('0x40')]('color')[_0xf878('0x41')](_0xf878('0x42'));var _0xe2c096=squel[_0xf878('0x3f')]()[_0xf878('0x40')](_0xf878('0x43'))['field'](_0xf878('0x44'))[_0xf878('0x40')](_0xf878('0x45'))[_0xf878('0x41')](_0xf878('0x46'),'ui')['left_join'](_0xf878('0x47'),'u',_0xf878('0x48'));var _0x2429e6=squel[_0xf878('0x3f')]()['from'](_0xf878('0x49'),'i')[_0xf878('0x4a')](_0xf878('0x4b'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0xf878('0x47'),'o','o.id\x20=\x20i.UserId')['left_join']('sms_accounts','a',_0xf878('0x4c'))['left_join'](_0xf878('0x4d'),'me',_0xf878('0x4e'))[_0xf878('0x4a')](_0xf878('0x4f'),'it',_0xf878('0x50'))[_0xf878('0x4a')](_0xf878('0x42'),'t','t.id\x20=\x20it.TagId');var _0xb0bf4c=squel[_0xf878('0x51')]();var _0x40d912=[];var _0x227dd7=squel[_0xf878('0x51')]();var _0x47c8be;if(_0x4e3cab['query'][_0xf878('0x52')]){_0x47c8be=as[_0xf878('0x53')](_0x4e3cab['query'][_0xf878('0x52')]);var _0x4ff722=_0x47c8be[_0xf878('0x54')];for(var _0x31adde=0x0;_0x31adde<_0x47c8be[_0xf878('0x55')][_0xf878('0x3a')];_0x31adde++){var _0x5411c2=_0x47c8be[_0xf878('0x55')][_0x31adde];var _0xd8fbc9='i';var _0x193c11=_['find'](_0x579c91,[_0xf878('0x27'),_0x5411c2[_0xf878('0x40')]]);if(!_0x193c11){switch(_0x5411c2[_0xf878('0x40')]){case _0xf878('0x56'):if(_0x5411c2['value']==0x1){_0x2429e6[_0xf878('0x57')]('`'+_0x5411c2[_0xf878('0x40')]+_0xf878('0x58'));}else{_0x2429e6['having']('`'+_0x5411c2[_0xf878('0x40')]+_0xf878('0x59'));}break;case _0xf878('0x5a'):if(_0x5411c2[_0xf878('0x5b')]==='$substring'){if(_0x5411c2['value']['split']('\x20')[_0xf878('0x3a')]>0x1){_0xb0bf4c[_0x4ff722]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5411c2['value']),null);}else{var _0x209517='%'+_0x5411c2[_0xf878('0x5c')]+'%';_0xb0bf4c[_0x4ff722]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x209517,_0x209517,_0x209517);}}else{_0x193c11=_[_0xf878('0x5d')](_0x579c91,[_0xf878('0x27'),_0xf878('0x5e')]);_0x5411c2['field']='ContactId';_0x1be0ba=as[_0xf878('0x5f')](_0xd8fbc9,_0x193c11['type'],_0x5411c2);_0xb0bf4c[_0x4ff722](_0x1be0ba[_0xf878('0x60')],_0x1be0ba[_0xf878('0x5c')][_0xf878('0x61')],_0x1be0ba[_0xf878('0x5c')][_0xf878('0x1b')]);}break;case _0xf878('0x62'):var _0x57f635=_0x5411c2[_0xf878('0x5c')][_0xf878('0x2c')](',')['map'](function(_0x1e0824){return Number(_0x1e0824);});_0x57f635[_0xf878('0x2d')](function(_0x192abd){_0x227dd7['or'](_0xf878('0x63'),'%,'+_0x192abd+',%');});_0x40d912=_[_0xf878('0x64')](_0x40d912,_0x57f635);break;case _0xf878('0x65'):if(_0x5411c2[_0xf878('0x5b')]==='$substring'){_0xb0bf4c[_0x4ff722](_0xf878('0x66'),'%'+_0x5411c2[_0xf878('0x5c')]+'%',null);}else{_0x193c11=_[_0xf878('0x5d')](_0x579c91,['name',_0xf878('0x67')]);_0x5411c2['field']=_0xf878('0x67');_0x1be0ba=as[_0xf878('0x5f')](_0xd8fbc9,_0x193c11[_0xf878('0x32')],_0x5411c2);_0xb0bf4c[_0x4ff722](_0x1be0ba[_0xf878('0x60')],_0x1be0ba[_0xf878('0x5c')][_0xf878('0x61')],_0x1be0ba[_0xf878('0x5c')][_0xf878('0x1b')]);}break;case _0xf878('0x68'):_0x1be0ba=as[_0xf878('0x5f')]('me',null,_0x5411c2);_0xb0bf4c[_0x4ff722](_0x1be0ba['text'],_0x1be0ba['value']['start'],_0x1be0ba[_0xf878('0x5c')]['end']);break;}}else{var _0x1be0ba=as[_0xf878('0x5f')](_0xd8fbc9,_0x193c11['type'],_0x5411c2);_0xb0bf4c[_0x4ff722](_0x1be0ba['text'],_0x1be0ba[_0xf878('0x5c')][_0xf878('0x61')],_0x1be0ba[_0xf878('0x5c')][_0xf878('0x1b')]);}}}else{var _0x248caa=_(_0x4e3cab[_0xf878('0x36')])[_0xf878('0x35')]()[_0xf878('0x30')](function(_0x1602ed){return _[_0xf878('0x69')](_0x579c91,[_0xf878('0x27'),_0x1602ed])?_0x1602ed:undefined;})[_0xf878('0x6a')]()[_0xf878('0x5c')]();if(!_[_0xf878('0x6b')](_0x248caa)){_0x248caa[_0xf878('0x2d')](function(_0x2ffdb0){if(_0x2ffdb0===_0xf878('0x6c')){_0x2429e6[_0xf878('0x3d')]('i.SmsAccountId\x20IN\x20?',[][_0xf878('0x6d')](_0x4e3cab['query'][_0x2ffdb0]));}else if(_0x2ffdb0===_0xf878('0x6e')){var _0xb57b60=JSON[_0xf878('0x6f')](_0x4e3cab[_0xf878('0x36')][_0x2ffdb0])[_0xf878('0x70')];var _0x27b3de=JSON[_0xf878('0x6f')](_0x4e3cab[_0xf878('0x36')][_0x2ffdb0])[_0xf878('0x71')];_0x2429e6['where'](_0xf878('0x72'),_0xb57b60,_0x27b3de);}else{if(_0x4e3cab[_0xf878('0x36')][_0x2ffdb0]===_0xf878('0x73')){_0x2429e6[_0xf878('0x3d')]('i.'+_0x2ffdb0+'\x20IS\x20NULL');}else{_0x2429e6[_0xf878('0x3d')]('i.'+_0x2ffdb0+_0xf878('0x74'),_0x4e3cab[_0xf878('0x36')][_0x2ffdb0]);}}});}if(_0x4e3cab[_0xf878('0x36')][_0xf878('0x75')]){if(_0x4e3cab['query']['read']==0x1){_0x2429e6[_0xf878('0x57')](_0xf878('0x76'));}else{_0x2429e6[_0xf878('0x57')](_0xf878('0x77'));}}if(_0x4e3cab[_0xf878('0x36')][_0xf878('0x78')]){_0x40d912=_[_0xf878('0x79')](_0x4e3cab[_0xf878('0x36')][_0xf878('0x78')])?_0x4e3cab[_0xf878('0x36')][_0xf878('0x78')]:new Array(_0x4e3cab[_0xf878('0x36')][_0xf878('0x78')]);_0x40d912[_0xf878('0x2d')](function(_0x3bfd00){_0x227dd7['or'](_0xf878('0x63'),'%,'+_0x3bfd00+',%');});}if(_0x4e3cab[_0xf878('0x36')]['filter']){var _0x3ee3e0=_0x4e3cab[_0xf878('0x36')][_0xf878('0x7a')][_0xf878('0x7b')]('\x5c','\x5c\x5c')[_0xf878('0x7b')]('\x27\x27',_0xf878('0x7c'));if(qs[_0xf878('0x7d')](_0x3ee3e0)){_0xb0bf4c['or'](_0xf878('0x7e'),_0x3ee3e0+'%')['or'](_0xf878('0x7f'),_0x3ee3e0+'%');}else{_0xb0bf4c['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xf878('0x80')](_0x3ee3e0))['or'](_0xf878('0x81'),_0x3ee3e0+'%');}}}_0x2429e6[_0xf878('0x3d')](_0xb0bf4c);_0x2429e6[_0xf878('0x82')](_0xf878('0x83'));var _0xb452c6={'type':db[_0xf878('0x84')]['QueryTypes']['SELECT'],'raw':!![]};var _0x12859b=_0x2429e6['clone']();_0x12859b[_0xf878('0x40')](_0xf878('0x83'));_0x12859b[_0xf878('0x40')](_0xf878('0x85'),'unreadMessages');if(_0x1b09de[_0xf878('0x86')]){_0x1b09de[_0xf878('0x86')][_0xf878('0x2d')](function(_0x1403cf){_0x2429e6['order']('i.'+_0x1403cf[0x0],_0x1403cf[0x1]===_0xf878('0x87')?![]:!![]);});}if(!_['isEmpty'](_0x40d912)){_0x2429e6[_0xf878('0x57')](_0x227dd7);_0x12859b[_0xf878('0x3d')](_0xf878('0x88'),_0x40d912);}BPromise[_0xf878('0x89')]()[_0xf878('0x25')](function(){if(!_0x47c8be){if(_0x4e3cab['query'][_0xf878('0x6c')]||_0x4e3cab[_0xf878('0x36')][_0xf878('0x8a')])return;_0x12859b[_0xf878('0x3d')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x2429e6[_0xf878('0x3d')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}return _0x4e3cab[_0xf878('0x8b')][_0xf878('0x8c')]({'attributes':['id'],'raw':!![]})[_0xf878('0x25')](function(_0x334d6f){if(_[_0xf878('0x6b')](_0x334d6f)){_0x12859b[_0xf878('0x3d')](_0xf878('0x8d'));_0x2429e6[_0xf878('0x3d')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x12859b['where']('i.SmsAccountId\x20IN\x20?',_[_0xf878('0x30')](_0x334d6f,'id'));_0x2429e6[_0xf878('0x3d')]('i.SmsAccountId\x20IN\x20?',_['map'](_0x334d6f,'id'));}});})[_0xf878('0x25')](function(){db['sequelize'][_0xf878('0x36')](_0x12859b[_0xf878('0x8e')](),_0xb452c6)[_0xf878('0x25')](function(_0x1ca178){_0x129805[_0xf878('0x1d')]=_0x1ca178[_0xf878('0x3a')];if(_0x129805[_0xf878('0x1d')]===0x0)return[];return db[_0xf878('0x8f')][_0xf878('0x36')](_0x2f6ee5['toString'](),_0xb452c6)[_0xf878('0x25')](function(_0x170a6a){_0x13fcd3=_[_0xf878('0x90')](_0x170a6a,'id');_0xb452c6=_['merge'](_0xb452c6,{'model':db[_0xf878('0x91')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4e3cab[_0xf878('0x36')]['fields']){_0x1b09de[_0xf878('0x38')][_0xf878('0x2d')](function(_0x2b548d){_0x2429e6[_0xf878('0x40')]('i.'+_0x2b548d);});}else{_0x2429e6[_0xf878('0x40')](_0xf878('0x85'),_0xf878('0x56'));_0x2429e6[_0xf878('0x40')]('a.key',_0xf878('0x92'));_0x2429e6['field']('a.mandatoryDisposition',_0xf878('0x93'));_0x2429e6[_0xf878('0x40')]('i.*');_0x2429e6[_0xf878('0x40')](_0xf878('0x94'),_0xf878('0x95'));_0x2429e6[_0xf878('0x40')](_0xf878('0x96'),'Contact.lastName');_0x2429e6[_0xf878('0x40')](_0xf878('0x97'),'Contact.email');_0x2429e6[_0xf878('0x40')](_0xf878('0x98'),_0xf878('0x99'));_0x2429e6[_0xf878('0x40')]('c.mobile','Contact.mobile');_0x2429e6[_0xf878('0x40')](_0xf878('0x9a'),_0xf878('0x9b'));_0x2429e6[_0xf878('0x40')](_0xf878('0x9c'),_0xf878('0x9d'));_0x2429e6[_0xf878('0x40')](_0xf878('0x9e'),_0xf878('0x9f'));_0x2429e6[_0xf878('0x40')](_0xf878('0xa0'),_0xf878('0x2b'));}if(_0x1b09de[_0xf878('0x1f')])_0x2429e6[_0xf878('0x1f')](_0x1b09de[_0xf878('0x1f')]);if(_0x1b09de['offset'])_0x2429e6[_0xf878('0x1e')](_0x1b09de[_0xf878('0x1e')]);return db[_0xf878('0x8f')][_0xf878('0x36')](_0x2429e6['toString'](),_0xb452c6);})[_0xf878('0x25')](function(_0x4a252d){_0xe2c096[_0xf878('0x3d')](_0xf878('0xa1'),_['map'](_0x4a252d,'id'));return db[_0xf878('0x8f')][_0xf878('0x36')](_0xe2c096['toString'](),_0xb452c6)['then'](function(_0x138f6f){var _0x11ef6a=_[_0xf878('0xa2')](_0x138f6f,_0xf878('0xa3'));var _0x12b984=[];_0x4a252d[_0xf878('0x2d')](function(_0x1fb2f){_0x12b984[_0xf878('0xa4')](updateSmsInteraction(_0x1fb2f,_0x13fcd3,_0x11ef6a));});return BPromise[_0xf878('0xa5')](_0x12b984);});});})[_0xf878('0x25')](function(_0x5d03cb){_0x129805[_0xf878('0xa6')]=_0x5d03cb;return _0x129805;})[_0xf878('0x25')](respondWithFilteredResult(_0x11d669,_0x1b09de));})[_0xf878('0x2e')](handleError(_0x11d669,null));};exports['show']=function(_0x3d4e43,_0x482a2d){var _0x14e9b6={'raw':![],'where':{'id':_0x3d4e43['params']['id']}},_0x3a0421={};_0x3a0421[_0xf878('0x34')]=_[_0xf878('0x35')](db[_0xf878('0x91')][_0xf878('0xa7')]);_0x3a0421[_0xf878('0x36')]=_[_0xf878('0x35')](_0x3d4e43[_0xf878('0x36')]);_0x3a0421['filters']=_[_0xf878('0x37')](_0x3a0421[_0xf878('0x34')],_0x3a0421[_0xf878('0x36')]);_0x14e9b6['attributes']=_['intersection'](_0x3a0421[_0xf878('0x34')],qs[_0xf878('0x39')](_0x3d4e43['query'][_0xf878('0x39')]));_0x14e9b6[_0xf878('0x38')]=_0x14e9b6['attributes']['length']?_0x14e9b6['attributes']:_0x3a0421[_0xf878('0x34')];if(_0x3d4e43['query'][_0xf878('0xa8')]){_0x14e9b6[_0xf878('0xa9')]=[{'all':!![]}];}_0x14e9b6=_['merge']({},_0x14e9b6,_0x3d4e43[_0xf878('0xaa')]);return db['SmsInteraction'][_0xf878('0x5d')](_0x14e9b6)[_0xf878('0x25')](handleEntityNotFound(_0x482a2d,null))[_0xf878('0x25')](respondWithResult(_0x482a2d,null))[_0xf878('0x2e')](handleError(_0x482a2d,null));};exports[_0xf878('0xab')]=function(_0x2bd1d1,_0x8d90c){return db[_0xf878('0x91')][_0xf878('0xab')](_0x2bd1d1['body'],{})[_0xf878('0x25')](respondWithResult(_0x8d90c,0xc9))[_0xf878('0x2e')](handleError(_0x8d90c,null));};exports[_0xf878('0x24')]=function(_0x5e1685,_0x3fa8dd){if(_0x5e1685[_0xf878('0x68')]['id']){delete _0x5e1685[_0xf878('0x68')]['id'];}return db[_0xf878('0x91')][_0xf878('0x5d')]({'where':{'id':_0x5e1685[_0xf878('0xac')]['id']}})[_0xf878('0x25')](handleEntityNotFound(_0x3fa8dd,null))['then'](saveUpdates(_0x5e1685[_0xf878('0x68')],null))[_0xf878('0x25')](respondWithResult(_0x3fa8dd,null))[_0xf878('0x2e')](handleError(_0x3fa8dd,null));};exports['destroy']=function(_0x499b77,_0x310977){return db[_0xf878('0x91')][_0xf878('0x5d')]({'where':{'id':_0x499b77[_0xf878('0xac')]['id']}})['then'](handleEntityNotFound(_0x310977,null))['then'](removeEntity(_0x310977,null))[_0xf878('0x2e')](handleError(_0x310977,null));};exports[_0xf878('0xad')]=function(_0x4be287,_0x4b2bec){return db['SmsInteraction'][_0xf878('0xad')]()[_0xf878('0x25')](respondWithResult(_0x4b2bec,null))[_0xf878('0x2e')](handleError(_0x4b2bec,null));};exports['addMessage']=function(_0x1a4769,_0x439b8a,_0xdba94b){return db[_0xf878('0xae')][_0xf878('0x5d')]({'where':{'id':_0x1a4769[_0xf878('0xac')]['id']}})[_0xf878('0x25')](handleEntityNotFound(_0x439b8a,null))[_0xf878('0x25')](function(_0x5fb33a){if(_0x5fb33a){return _0x5fb33a[_0xf878('0xaf')](_0x1a4769[_0xf878('0x68')][_0xf878('0xb0')],_[_0xf878('0xb1')](_0x1a4769[_0xf878('0x68')],[_0xf878('0xb0'),'id'])||{});}})[_0xf878('0x25')](respondWithResult(_0x439b8a,null))[_0xf878('0x2e')](handleError(_0x439b8a,null));};exports[_0xf878('0xb2')]=function(_0x53f416,_0x20ba8f,_0x3a6196){var _0x2fdfe6={'raw':![],'where':{}};var _0x8e5cf6={};var _0x19efa2={'count':0x0,'rows':[]};return db[_0xf878('0x91')]['findOne']({'where':{'id':_0x53f416['params']['id']}})[_0xf878('0x25')](handleEntityNotFound(_0x20ba8f,null))[_0xf878('0x25')](function(_0x395116){if(_0x395116){_0x8e5cf6[_0xf878('0x34')]=_['keys'](db['SmsMessage'][_0xf878('0xa7')]);_0x8e5cf6[_0xf878('0x36')]=_[_0xf878('0x35')](_0x53f416[_0xf878('0x36')]);_0x8e5cf6[_0xf878('0x3e')]=_[_0xf878('0x37')](_0x8e5cf6['model'],_0x8e5cf6[_0xf878('0x36')]);_0x2fdfe6[_0xf878('0x38')]=_['intersection'](_0x8e5cf6[_0xf878('0x34')],qs[_0xf878('0x39')](_0x53f416[_0xf878('0x36')]['fields']));_0x2fdfe6[_0xf878('0x38')]=_0x2fdfe6[_0xf878('0x38')]['length']?_0x2fdfe6[_0xf878('0x38')]:_0x8e5cf6[_0xf878('0x34')];if(!_0x53f416[_0xf878('0x36')][_0xf878('0x3b')](_0xf878('0xb3'))){_0x2fdfe6['limit']=qs[_0xf878('0x1f')](_0x53f416[_0xf878('0x36')][_0xf878('0x1f')]);_0x2fdfe6[_0xf878('0x1e')]=qs[_0xf878('0x1e')](_0x53f416['query'][_0xf878('0x1e')]);}_0x2fdfe6[_0xf878('0x86')]=qs[_0xf878('0x3c')](_0x53f416[_0xf878('0x36')][_0xf878('0x3c')]);_0x2fdfe6[_0xf878('0x3d')]=qs[_0xf878('0x3e')](_[_0xf878('0xb4')](_0x53f416[_0xf878('0x36')],_0x8e5cf6[_0xf878('0x3e')]));_0x2fdfe6[_0xf878('0x3d')][_0xf878('0xa3')]=_0x395116['id'];if(_0x53f416['query']['filter']){_0x2fdfe6['where']=_['merge'](_0x2fdfe6[_0xf878('0x3d')],{'$or':_['map'](_0x2fdfe6[_0xf878('0x38')],function(_0x2b9ebc){var _0x577d9f={};_0x577d9f[_0x2b9ebc]={'$like':'%'+_0x53f416[_0xf878('0x36')][_0xf878('0x7a')]+'%'};return _0x577d9f;})});}if(_0x53f416['query'][_0xf878('0x70')]){var _0x28eafb=_0x53f416['query']['$gte'][_0xf878('0x2c')](',');var _0x3aaf04={};_0x3aaf04[_0x28eafb[0x0]]={'$gte':moment(_0x28eafb[0x1])[_0xf878('0xb5')](_0xf878('0xb6'))};_0x2fdfe6['where']=_[_0xf878('0xb7')](_0x2fdfe6[_0xf878('0x3d')],_0x3aaf04);}_0x2fdfe6=_[_0xf878('0xb7')]({},_0x2fdfe6,_0x53f416[_0xf878('0xaa')]);return db['SmsMessage'][_0xf878('0x1d')]({'where':_0x2fdfe6['where']})[_0xf878('0x25')](function(_0xa15512){_0x19efa2['count']=_0xa15512;if(_0x53f416[_0xf878('0x36')]['includeAll']){_0x2fdfe6[_0xf878('0xa9')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x2fdfe6);})[_0xf878('0x25')](function(_0x56b112){_0x19efa2[_0xf878('0xa6')]=_0x56b112;return _0x19efa2;});}})[_0xf878('0x25')](respondWithFilteredResult(_0x20ba8f,_0x2fdfe6))[_0xf878('0x2e')](handleError(_0x20ba8f,null));};exports[_0xf878('0xb8')]=function(_0x37cf67,_0x4535e0,_0x452e10){return db['SmsInteraction'][_0xf878('0x5d')]({'where':{'id':_0x37cf67['params']['id']}})[_0xf878('0x25')](handleEntityNotFound(_0x4535e0,null))[_0xf878('0x25')](function(_0x378a13){if(_0x378a13){return _0x378a13['setTags'](_0x37cf67['body'][_0xf878('0xb0')],_[_0xf878('0xb1')](_0x37cf67[_0xf878('0x68')],[_0xf878('0xb0'),'id'])||{})[_0xf878('0xb9')](function(){return db[_0xf878('0x62')][_0xf878('0xba')]({'attributes':['id',_0xf878('0x27'),_0xf878('0xbb')],'where':{'id':_0x37cf67['body'][_0xf878('0xb0')]}});})[_0xf878('0x25')](function(_0x34a749){socket['emit'](_0xf878('0xbc'),{'id':Number(_0x37cf67[_0xf878('0xac')]['id']),'tags':_0x34a749||[]});return{'id':Number(_0x37cf67['params']['id']),'tags':_0x34a749||[]};});}})[_0xf878('0x25')](respondWithResult(_0x4535e0,null))[_0xf878('0x2e')](handleError(_0x4535e0,null));};exports['removeTags']=function(_0x4a7b72,_0x52987b,_0x11ceae){return db[_0xf878('0x91')][_0xf878('0x5d')]({'where':{'id':_0x4a7b72[_0xf878('0xac')]['id']}})['then'](handleEntityNotFound(_0x52987b,null))[_0xf878('0x25')](function(_0x131eae){if(_0x131eae){return _0x131eae[_0xf878('0xbd')](_0x4a7b72[_0xf878('0x36')][_0xf878('0xb0')]);}})[_0xf878('0x25')](respondWithStatusCode(_0x52987b,null))['catch'](handleError(_0x52987b,null));};exports['download']=function(_0x319bd9,_0x179a21){var _0x165bcc=moment()[_0xf878('0xbe')]()[_0xf878('0x8e')]();var _0x11e6a0=path[_0xf878('0xbf')](config[_0xf878('0xc0')],'server',_0xf878('0xc1'),_0xf878('0xc2'));var _0x22afda=path[_0xf878('0xbf')](config[_0xf878('0xc0')],_0xf878('0xc3'),'files',_0xf878('0xc4'));var _0x1f55c7=path[_0xf878('0xbf')](_0x11e6a0,_0x165bcc);var _0x6435ef=util[_0xf878('0xb5')]('transcript-%d-%s.zip',_0x319bd9[_0xf878('0xac')]['id'],_0x165bcc);var _0x8e929=path[_0xf878('0xbf')](_0x11e6a0,_0x6435ef);var _0x43db03=[];_0x43db03[_0xf878('0xa4')]({'model':db[_0xf878('0x65')],'as':'User','attributes':['id',_0xf878('0xc5')],'raw':!![]});_0x43db03[_0xf878('0xa4')]({'model':db['CmContact'],'as':_0xf878('0x5a'),'attributes':['id',_0xf878('0xc6'),_0xf878('0xc7')],'raw':!![]});var _0x1ec2cc=[{'model':db[_0xf878('0xae')],'as':_0xf878('0xc8'),'attributes':['id',_0xf878('0x68'),_0xf878('0x6e'),_0xf878('0xc9'),_0xf878('0xca'),_0xf878('0x75')],'include':_0x43db03}];_0x1ec2cc[_0xf878('0xa4')]({'model':db['SmsAccount'],'as':'Account','attributes':['id','name']});_0x1ec2cc[_0xf878('0xa4')]({'model':db[_0xf878('0x65')],'as':_0xf878('0xcb'),'attributes':['id',_0xf878('0xc5')]});return db[_0xf878('0x91')][_0xf878('0x5d')]({'where':{'id':_0x319bd9['params']['id']},'include':_0x1ec2cc})['then'](handleEntityNotFound(_0x179a21,null))['then'](function(_0x534858){if(_0x534858){var _0x328589=_0x534858[_0xf878('0xcc')]({'plain':!![]});fs[_0xf878('0xcd')](_0x1f55c7);var _0x3bea97={'format':'A4','border':_0xf878('0xce'),'header':{'height':'40px','contents':{'first':_0xf878('0xcf')}},'footer':{'height':'30px','contents':{'default':util['format'](_0xf878('0xd0'),util[_0xf878('0xb5')](_0xf878('0xd1'),_0xf878('0xd2'),_0x328589['id']),moment()['format'](_0xf878('0xd3'))['toString']())}}};var _0x254a71={'channel':_0xf878('0xd2'),'account':_0x328589[_0xf878('0xd4')]['name'],'agent':_0x328589['Owner']?_0x328589[_0xf878('0xcb')][_0xf878('0xc5')]:'N.A.','createdAt':moment(_0x328589[_0xf878('0x6e')])[_0xf878('0xb5')](_0xf878('0xb6'))[_0xf878('0x8e')](),'closedAt':_0x328589[_0xf878('0xd5')]?moment(_0x328589['closedAt'])[_0xf878('0xb5')](_0xf878('0xb6'))['toString']():'','disposition':_0x328589[_0xf878('0xd6')],'messages':_(_0x328589[_0xf878('0xc8')])[_0xf878('0x7a')]({'secret':![]})['map'](function(_0x4b9d6b){return{'date':moment(_0x4b9d6b[_0xf878('0x6e')])['format'](_0xf878('0xb6'))[_0xf878('0x8e')](),'sender':_0x4b9d6b[_0xf878('0xc9')]===_0xf878('0xd7')?_0x4b9d6b[_0xf878('0x65')]?_0x4b9d6b['User'][_0xf878('0xc5')]:_0xf878('0xd8'):_0x4b9d6b[_0xf878('0x5a')][_0xf878('0xc6')]+(_0x4b9d6b[_0xf878('0x5a')][_0xf878('0xc7')]?'\x20'+_0x4b9d6b['Contact'][_0xf878('0xc7')]:''),'body':_0x4b9d6b['body'],'direction':_0x4b9d6b[_0xf878('0xc9')]===_0xf878('0xd7')?'A':'C','secret':_0x4b9d6b[_0xf878('0xca')],'read':_0x4b9d6b[_0xf878('0x75')]};})['value']()};return ejs['renderFile'](path['join'](config[_0xf878('0xc0')],_0xf878('0xc3'),'views',_0xf878('0xd9')),{'interaction':_0x254a71})[_0xf878('0x25')](function(_0x338e79){return new BPromise(function(_0x5f5286,_0x153b7d){pdf[_0xf878('0xab')](_0x338e79,_0x3bea97)[_0xf878('0xda')](path[_0xf878('0xbf')](_0x1f55c7,'transcript-'+_0x328589['id']+'-'+_0x165bcc+_0xf878('0xdb')),function(_0x115873,_0x1eb6fb){if(_0x115873)return _0x153b7d(_0x115873);_0x5f5286(_0x1eb6fb);});});})[_0xf878('0x25')](function(){return new BPromise(function(_0x2f649e,_0xd3e9f0){zipdir(_0x1f55c7,{'saveTo':_0x8e929},function(_0x5622c0,_0x44715d){if(_0x5622c0)return _0xd3e9f0(_0x5622c0);return _0x2f649e(_0x44715d);});})[_0xf878('0x25')](function(){return new BPromise(function(_0x418116,_0x22074f){rimraf(_0x1f55c7,function(_0x2381f3){if(_0x2381f3)_0x22074f(_0x2381f3);return _0x418116();});});})[_0xf878('0x25')](function(){return _0x179a21[_0xf878('0xdc')](_0x8e929,_0x6435ef,function(_0x150dac){if(_0x150dac){console[_0xf878('0xdd')](_0xf878('0xde'),_0x150dac);}else{fs[_0xf878('0xdf')](_0x8e929);}});});});}else{return _0x179a21[_0xf878('0xe0')](0xc8);}})[_0xf878('0x2e')](handleError(_0x179a21,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index fe15dc9..1c54a78 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 _0x02a7=['then','setDataValue','Users','map','findAll','length','emit','catch','hook','exports','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x02a7,0x7a));var _0x702a=function(_0x5421ff,_0x37bbd4){_0x5421ff=_0x5421ff-0x0;var _0x231337=_0x02a7[_0x5421ff];return _0x231337;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x702a('0x0'))['db']['SmsInteraction'];var SmsMessage=require('../../mysqldb')['db'][_0x702a('0x1')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x702a('0x2')](0x0);var events={'afterCreate':_0x702a('0x3'),'afterUpdate':_0x702a('0x4'),'afterDestroy':_0x702a('0x5')};function emitEvent(_0x1fc26b){return function(_0x3fb65a,_0x4a1d02,_0x1bcfe5){_0x3fb65a['getUsers']({'attributes':['id'],'raw':!![]})[_0x702a('0x6')](function(_0x1aa2c2){_0x3fb65a[_0x702a('0x7')](_0x702a('0x8'),_0x1aa2c2[_0x702a('0x9')](function(_0x20c009){return{'id':_0x20c009['id']};}));return SmsMessage[_0x702a('0xa')]({'where':{'SmsInteractionId':_0x3fb65a['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x15acfb){_0x3fb65a['setDataValue']('unreadMessages',_0x15acfb[_0x702a('0xb')]);SmsInteractionEvents[_0x702a('0xc')](_0x1fc26b+':'+_0x3fb65a['id'],_0x3fb65a);SmsInteractionEvents[_0x702a('0xc')](_0x1fc26b,_0x3fb65a);_0x1bcfe5(null);})[_0x702a('0xd')](_0x1bcfe5(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x702a('0xe')](e,emitEvent(event));}}module[_0x702a('0xf')]=SmsInteractionEvents; \ No newline at end of file +var _0x826a=['exports','../../mysqldb','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','hasOwnProperty','hook'];(function(_0x57bfad,_0x5126cc){var _0x5d8e2f=function(_0xd5ce2b){while(--_0xd5ce2b){_0x57bfad['push'](_0x57bfad['shift']());}};_0x5d8e2f(++_0x5126cc);}(_0x826a,0x1aa));var _0xa826=function(_0x190a4b,_0x59f7bd){_0x190a4b=_0x190a4b-0x0;var _0x503bf0=_0x826a[_0x190a4b];return _0x503bf0;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0xa826('0x0'))['db']['SmsInteraction'];var SmsMessage=require(_0xa826('0x0'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xa826('0x1')](0x0);var events={'afterCreate':_0xa826('0x2'),'afterUpdate':_0xa826('0x3'),'afterDestroy':_0xa826('0x4')};function emitEvent(_0x5372ab){return function(_0x30875f,_0x15f777,_0x3929d4){_0x30875f[_0xa826('0x5')]({'attributes':['id'],'raw':!![]})[_0xa826('0x6')](function(_0x4124f5){_0x30875f[_0xa826('0x7')](_0xa826('0x8'),_0x4124f5[_0xa826('0x9')](function(_0x428c70){return{'id':_0x428c70['id']};}));return SmsMessage[_0xa826('0xa')]({'where':{'SmsInteractionId':_0x30875f['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa826('0x6')](function(_0x2a6f4d){_0x30875f[_0xa826('0x7')](_0xa826('0xb'),_0x2a6f4d[_0xa826('0xc')]);SmsInteractionEvents['emit'](_0x5372ab+':'+_0x30875f['id'],_0x30875f);SmsInteractionEvents[_0xa826('0xd')](_0x5372ab,_0x30875f);_0x3929d4(null);})['catch'](_0x3929d4(null));};}for(var e in events){if(events[_0xa826('0xe')](e)){var event=events[e];SmsInteraction[_0xa826('0xf')](e,emitEvent(event));}}module[_0xa826('0x10')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 7347baf..fd6dc79 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 _0xded4=['SmsInteraction','sms_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0xded4,0x14a));var _0x4ded=function(_0x1301f1,_0x3312e6){_0x1301f1=_0x1301f1-0x0;var _0xa740e0=_0xded4[_0x1301f1];return _0xa740e0;};'use strict';var _=require(_0x4ded('0x0'));var util=require('util');var logger=require(_0x4ded('0x1'))(_0x4ded('0x2'));var moment=require(_0x4ded('0x3'));var BPromise=require(_0x4ded('0x4'));var rp=require(_0x4ded('0x5'));var fs=require('fs');var path=require(_0x4ded('0x6'));var rimraf=require(_0x4ded('0x7'));var config=require(_0x4ded('0x8'));var attributes=require(_0x4ded('0x9'));module[_0x4ded('0xa')]=function(_0x21dbd5,_0x36c543){return _0x21dbd5[_0x4ded('0xb')](_0x4ded('0xc'),attributes,{'tableName':_0x4ded('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x416343,_0xfe36fb,_0x5db14a){if(_0x416343[_0x4ded('0xe')]('closed')){_0x416343[_0x4ded('0xf')]=moment()[_0x4ded('0x10')](_0x4ded('0x11'));}_0x5db14a(null,_0x416343);}}});}; \ No newline at end of file +var _0xbaf8=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xbaf8,0x13a));var _0x8baf=function(_0x3c5272,_0x1ea873){_0x3c5272=_0x3c5272-0x0;var _0x31a12a=_0xbaf8[_0x3c5272];return _0x31a12a;};'use strict';var _=require(_0x8baf('0x0'));var util=require(_0x8baf('0x1'));var logger=require('../../config/logger')(_0x8baf('0x2'));var moment=require(_0x8baf('0x3'));var BPromise=require(_0x8baf('0x4'));var rp=require(_0x8baf('0x5'));var fs=require('fs');var path=require(_0x8baf('0x6'));var rimraf=require(_0x8baf('0x7'));var config=require(_0x8baf('0x8'));var attributes=require(_0x8baf('0x9'));module[_0x8baf('0xa')]=function(_0x5ef28f,_0x9f903e){return _0x5ef28f[_0x8baf('0xb')]('SmsInteraction',attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x41c06e,_0x7db26f,_0x56bc34){if(_0x41c06e['changed'](_0x8baf('0xc'))){_0x41c06e['closedAt']=moment()[_0x8baf('0xd')](_0x8baf('0xe'));}_0x56bc34(null,_0x41c06e);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 696adfd..7eff5b0 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 _0x8b2d=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','./smsInteraction.socket','request','then','info','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','options','raw','where','attributes','AddTagsToSmsInteraction','find','addTags','body','ids','omit','spread','AddTags','util','bluebird'];(function(_0x4991d6,_0x348deb){var _0x50faf7=function(_0x14c7f8){while(--_0x14c7f8){_0x4991d6['push'](_0x4991d6['shift']());}};_0x50faf7(++_0x348deb);}(_0x8b2d,0x1cc));var _0xd8b2=function(_0x5114aa,_0x4596b9){_0x5114aa=_0x5114aa-0x0;var _0x1841bc=_0x8b2d[_0x5114aa];return _0x1841bc;};'use strict';var _=require('lodash');var util=require(_0xd8b2('0x0'));var moment=require('moment');var BPromise=require(_0xd8b2('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd8b2('0x2'));var db=require(_0xd8b2('0x3'))['db'];var utils=require(_0xd8b2('0x4'));var logger=require(_0xd8b2('0x5'))(_0xd8b2('0x6'));var config=require(_0xd8b2('0x7'));var jayson=require(_0xd8b2('0x8'));var client=jayson[_0xd8b2('0x9')][_0xd8b2('0xa')]({'port':0x232a});config['redis']=_[_0xd8b2('0xb')](config[_0xd8b2('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd8b2('0xc')]));require(_0xd8b2('0xd'))['register'](socket);function respondWithRpcPromise(_0x56cdd7,_0x20c917,_0x5de257){return new BPromise(function(_0x1702fa,_0x311042){return client[_0xd8b2('0xe')](_0x56cdd7,_0x5de257)[_0xd8b2('0xf')](function(_0x808e7a){logger[_0xd8b2('0x10')]('SmsInteraction,\x20%s,\x20%s',_0x20c917,_0xd8b2('0x11'));logger[_0xd8b2('0x12')](_0xd8b2('0x13'),_0x20c917,_0xd8b2('0x11'),JSON[_0xd8b2('0x14')](_0x808e7a));if(_0x808e7a[_0xd8b2('0x15')]){if(_0x808e7a[_0xd8b2('0x15')][_0xd8b2('0x16')]===0x1f4){logger[_0xd8b2('0x15')](_0xd8b2('0x17'),_0x20c917,_0x808e7a[_0xd8b2('0x15')][_0xd8b2('0x18')]);return _0x311042(_0x808e7a['error'][_0xd8b2('0x18')]);}logger[_0xd8b2('0x15')]('SmsInteraction,\x20%s,\x20%s',_0x20c917,_0x808e7a[_0xd8b2('0x15')][_0xd8b2('0x18')]);return _0x1702fa(_0x808e7a[_0xd8b2('0x15')][_0xd8b2('0x18')]);}else{logger['info'](_0xd8b2('0x17'),_0x20c917,_0xd8b2('0x11'));_0x1702fa(_0x808e7a[_0xd8b2('0x19')][_0xd8b2('0x18')]);}})[_0xd8b2('0x1a')](function(_0x3e9901){logger[_0xd8b2('0x15')](_0xd8b2('0x17'),_0x20c917,_0x3e9901);_0x311042(_0x3e9901);});});}exports[_0xd8b2('0x1b')]=function(_0x246ed6){var _0x2754fb=this;return new Promise(function(_0x4851bd,_0x585b4c){return db[_0xd8b2('0x1c')][_0xd8b2('0x1d')](_0x246ed6['body'],{'raw':_0x246ed6[_0xd8b2('0x1e')]?_0x246ed6[_0xd8b2('0x1e')][_0xd8b2('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x246ed6[_0xd8b2('0x1e')]?_0x246ed6[_0xd8b2('0x1e')][_0xd8b2('0x20')]||null:null,'attributes':_0x246ed6['options']?_0x246ed6[_0xd8b2('0x1e')][_0xd8b2('0x21')]||null:null,'limit':_0x246ed6['options']?_0x246ed6[_0xd8b2('0x1e')]['limit']||null:null})[_0xd8b2('0xf')](function(_0x2a3d8f){logger[_0xd8b2('0x10')]('UpdateSmsInteraction',_0x246ed6);logger[_0xd8b2('0x12')](_0xd8b2('0x1b'),_0x246ed6,JSON[_0xd8b2('0x14')](_0x2a3d8f));_0x4851bd(_0x2a3d8f);})[_0xd8b2('0x1a')](function(_0x3d0474){logger['error']('UpdateSmsInteraction',_0x3d0474[_0xd8b2('0x18')],_0x246ed6);_0x585b4c(_0x2754fb['error'](0x1f4,_0x3d0474[_0xd8b2('0x18')]));});});};exports[_0xd8b2('0x22')]=function(_0x5bb382){return new Promise(function(_0x4a212c,_0x4e95f9){return db[_0xd8b2('0x1c')][_0xd8b2('0x23')]({'where':_0x5bb382[_0xd8b2('0x1e')]?_0x5bb382['options']['where']||null:null})[_0xd8b2('0xf')](function(_0x455c18){if(_0x455c18){return _0x455c18[_0xd8b2('0x24')](_0x5bb382[_0xd8b2('0x25')][_0xd8b2('0x26')],_[_0xd8b2('0x27')](_0x5bb382[_0xd8b2('0x25')],[_0xd8b2('0x26'),'id'])||{});}})[_0xd8b2('0x28')](function(_0x2112b3){logger[_0xd8b2('0x10')](_0xd8b2('0x29'),_0x5bb382);logger['debug'](_0xd8b2('0x29'),_0x5bb382,JSON[_0xd8b2('0x14')](_0x2112b3));_0x4a212c(_0x2112b3);})[_0xd8b2('0x1a')](function(_0x486215){logger['error'](_0xd8b2('0x29'),_0x486215[_0xd8b2('0x18')],_0x5bb382);_0x4e95f9(_this[_0xd8b2('0x15')](0x1f4,_0x486215['message']));});});}; \ No newline at end of file +var _0x9e55=['SmsInteraction,\x20%s,\x20%s','info','result','update','body','options','raw','where','attributes','limit','UpdateSmsInteraction','AddTagsToSmsInteraction','find','addTags','ids','omit','spread','AddTags','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./smsInteraction.socket','register','request','then','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1a7968,_0x464dc8){var _0x51e080=function(_0x5ab8aa){while(--_0x5ab8aa){_0x1a7968['push'](_0x1a7968['shift']());}};_0x51e080(++_0x464dc8);}(_0x9e55,0x121));var _0x59e5=function(_0x47024a,_0xb67d08){_0x47024a=_0x47024a-0x0;var _0x4d07f8=_0x9e55[_0x47024a];return _0x4d07f8;};'use strict';var _=require(_0x59e5('0x0'));var util=require(_0x59e5('0x1'));var moment=require(_0x59e5('0x2'));var BPromise=require('bluebird');var rs=require(_0x59e5('0x3'));var fs=require('fs');var Redis=require(_0x59e5('0x4'));var db=require(_0x59e5('0x5'))['db'];var utils=require(_0x59e5('0x6'));var logger=require(_0x59e5('0x7'))('rpc');var config=require(_0x59e5('0x8'));var jayson=require(_0x59e5('0x9'));var client=jayson[_0x59e5('0xa')][_0x59e5('0xb')]({'port':0x232a});config['redis']=_[_0x59e5('0xc')](config[_0x59e5('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x59e5('0xe'))(new Redis(config[_0x59e5('0xd')]));require(_0x59e5('0xf'))[_0x59e5('0x10')](socket);function respondWithRpcPromise(_0xc5900a,_0x3b4540,_0x56fa63){return new BPromise(function(_0x12c815,_0x20c9fb){return client[_0x59e5('0x11')](_0xc5900a,_0x56fa63)[_0x59e5('0x12')](function(_0x51d771){logger['info']('SmsInteraction,\x20%s,\x20%s',_0x3b4540,_0x59e5('0x13'));logger[_0x59e5('0x14')](_0x59e5('0x15'),_0x3b4540,'request\x20sent',JSON[_0x59e5('0x16')](_0x51d771));if(_0x51d771[_0x59e5('0x17')]){if(_0x51d771[_0x59e5('0x17')][_0x59e5('0x18')]===0x1f4){logger[_0x59e5('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x3b4540,_0x51d771[_0x59e5('0x17')]['message']);return _0x20c9fb(_0x51d771['error'][_0x59e5('0x19')]);}logger[_0x59e5('0x17')](_0x59e5('0x1a'),_0x3b4540,_0x51d771[_0x59e5('0x17')][_0x59e5('0x19')]);return _0x12c815(_0x51d771[_0x59e5('0x17')][_0x59e5('0x19')]);}else{logger[_0x59e5('0x1b')](_0x59e5('0x1a'),_0x3b4540,_0x59e5('0x13'));_0x12c815(_0x51d771[_0x59e5('0x1c')][_0x59e5('0x19')]);}})['catch'](function(_0x3f2c40){logger[_0x59e5('0x17')](_0x59e5('0x1a'),_0x3b4540,_0x3f2c40);_0x20c9fb(_0x3f2c40);});});}exports['UpdateSmsInteraction']=function(_0x222d27){var _0x3a046d=this;return new Promise(function(_0x57ba51,_0x3e064b){return db['SmsInteraction'][_0x59e5('0x1d')](_0x222d27[_0x59e5('0x1e')],{'raw':_0x222d27[_0x59e5('0x1f')]?_0x222d27[_0x59e5('0x1f')][_0x59e5('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x222d27[_0x59e5('0x1f')]?_0x222d27[_0x59e5('0x1f')][_0x59e5('0x21')]||null:null,'attributes':_0x222d27[_0x59e5('0x1f')]?_0x222d27['options'][_0x59e5('0x22')]||null:null,'limit':_0x222d27['options']?_0x222d27['options'][_0x59e5('0x23')]||null:null})[_0x59e5('0x12')](function(_0x4ff6d0){logger['info'](_0x59e5('0x24'),_0x222d27);logger[_0x59e5('0x14')](_0x59e5('0x24'),_0x222d27,JSON[_0x59e5('0x16')](_0x4ff6d0));_0x57ba51(_0x4ff6d0);})['catch'](function(_0x492924){logger[_0x59e5('0x17')](_0x59e5('0x24'),_0x492924[_0x59e5('0x19')],_0x222d27);_0x3e064b(_0x3a046d[_0x59e5('0x17')](0x1f4,_0x492924[_0x59e5('0x19')]));});});};exports[_0x59e5('0x25')]=function(_0x3af690){return new Promise(function(_0x191359,_0x285efc){return db['SmsInteraction'][_0x59e5('0x26')]({'where':_0x3af690[_0x59e5('0x1f')]?_0x3af690[_0x59e5('0x1f')][_0x59e5('0x21')]||null:null})[_0x59e5('0x12')](function(_0x862994){if(_0x862994){return _0x862994[_0x59e5('0x27')](_0x3af690['body'][_0x59e5('0x28')],_[_0x59e5('0x29')](_0x3af690[_0x59e5('0x1e')],[_0x59e5('0x28'),'id'])||{});}})[_0x59e5('0x2a')](function(_0x36e3da){logger[_0x59e5('0x1b')](_0x59e5('0x2b'),_0x3af690);logger[_0x59e5('0x14')](_0x59e5('0x2b'),_0x3af690,JSON[_0x59e5('0x16')](_0x36e3da));_0x191359(_0x36e3da);})[_0x59e5('0x2c')](function(_0x1f731b){logger['error'](_0x59e5('0x2b'),_0x1f731b['message'],_0x3af690);_0x285efc(_this[_0x59e5('0x17')](0x1f4,_0x1f731b[_0x59e5('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index a1d08ab..1be231f 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(_0x2a7eb2,_0x30192e){var _0x592201=function(_0xfbe6ef){while(--_0xfbe6ef){_0x2a7eb2['push'](_0x2a7eb2['shift']());}};_0x592201(++_0x30192e);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x5f66[_0x2b4411];return _0x8e41ef;};'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 _0x0b0e=['smsInteraction:','./smsInteraction.events','remove','emit','removeListener','register'];(function(_0xd22c7a,_0x1338b1){var _0x9585ca=function(_0x33ec07){while(--_0x33ec07){_0xd22c7a['push'](_0xd22c7a['shift']());}};_0x9585ca(++_0x1338b1);}(_0x0b0e,0x187));var _0xe0b0=function(_0x20f96d,_0x23e67f){_0x20f96d=_0x20f96d-0x0;var _0x9a7524=_0x0b0e[_0x20f96d];return _0x9a7524;};'use strict';var SmsInteractionEvents=require(_0xe0b0('0x0'));var events=['save',_0xe0b0('0x1'),'update'];function createListener(_0x7e5a8a,_0xdf715e){return function(_0x3b5e2b){_0xdf715e[_0xe0b0('0x2')](_0x7e5a8a,_0x3b5e2b);};}function removeListener(_0x28040c,_0x38a058){return function(){SmsInteractionEvents[_0xe0b0('0x3')](_0x28040c,_0x38a058);};}exports[_0xe0b0('0x4')]=function(_0x30e20d){for(var _0x28e40f=0x0,_0x219b1c=events['length'];_0x28e40f<_0x219b1c;_0x28e40f++){var _0x50be7f=events[_0x28e40f];var _0x11effc=createListener(_0xe0b0('0x5')+_0x50be7f,_0x30e20d);SmsInteractionEvents['on'](_0x50be7f,_0x11effc);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 9a72292..0ccba1a 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 _0xf713=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','isAuthenticated','index','get','describe','/:id','post','sms','smsmessage:create','create','/:id/status','status','put','update','/:id/accept','/:id/reject','destroy','exports','multer','util'];(function(_0x294c30,_0x4fc9d9){var _0x4e20c9=function(_0x5e3727){while(--_0x5e3727){_0x294c30['push'](_0x294c30['shift']());}};_0x4e20c9(++_0x4fc9d9);}(_0xf713,0x1c9));var _0x3f71=function(_0x2067e3,_0x19bcb2){_0x2067e3=_0x2067e3-0x0;var _0x180c44=_0xf713[_0x2067e3];return _0x180c44;};'use strict';var multer=require(_0x3f71('0x0'));var util=require(_0x3f71('0x1'));var path=require(_0x3f71('0x2'));var timeout=require(_0x3f71('0x3'));var express=require(_0x3f71('0x4'));var router=express[_0x3f71('0x5')]();var auth=require(_0x3f71('0x6'));var interaction=require(_0x3f71('0x7'));var config=require(_0x3f71('0x8'));var controller=require(_0x3f71('0x9'));router['get']('/',auth[_0x3f71('0xa')](),controller[_0x3f71('0xb')]);router[_0x3f71('0xc')]('/describe',auth[_0x3f71('0xa')](),controller[_0x3f71('0xd')]);router[_0x3f71('0xc')](_0x3f71('0xe'),auth[_0x3f71('0xa')](),controller['show']);router[_0x3f71('0xf')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x3f71('0x10'),_0x3f71('0x11')),controller[_0x3f71('0x12')]);router[_0x3f71('0xf')](_0x3f71('0x13'),controller[_0x3f71('0x14')]);router[_0x3f71('0x15')](_0x3f71('0xe'),auth['isAuthenticated'](),controller[_0x3f71('0x16')]);router[_0x3f71('0x15')](_0x3f71('0x17'),auth['isAuthenticated'](),controller['accept']);router[_0x3f71('0x15')](_0x3f71('0x18'),auth[_0x3f71('0xa')](),controller['reject']);router['delete'](_0x3f71('0xe'),auth['isAuthenticated'](),controller[_0x3f71('0x19')]);module[_0x3f71('0x1a')]=router; \ No newline at end of file +var _0x80af=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','tracked','sms','smsmessage:create','create','post','/:id/status','status','put','update','accept','/:id/reject','delete','destroy','exports'];(function(_0x69062,_0x231f82){var _0x3dabab=function(_0xc96141){while(--_0xc96141){_0x69062['push'](_0x69062['shift']());}};_0x3dabab(++_0x231f82);}(_0x80af,0xcb));var _0xf80a=function(_0x1bd36a,_0x582c6f){_0x1bd36a=_0x1bd36a-0x0;var _0x25ca7e=_0x80af[_0x1bd36a];return _0x25ca7e;};'use strict';var multer=require('multer');var util=require(_0xf80a('0x0'));var path=require(_0xf80a('0x1'));var timeout=require(_0xf80a('0x2'));var express=require(_0xf80a('0x3'));var router=express['Router']();var auth=require(_0xf80a('0x4'));var interaction=require(_0xf80a('0x5'));var config=require(_0xf80a('0x6'));var controller=require(_0xf80a('0x7'));router['get']('/',auth[_0xf80a('0x8')](),controller[_0xf80a('0x9')]);router[_0xf80a('0xa')](_0xf80a('0xb'),auth[_0xf80a('0x8')](),controller[_0xf80a('0xc')]);router[_0xf80a('0xa')](_0xf80a('0xd'),auth['isAuthenticated'](),controller[_0xf80a('0xe')]);router['post']('/',auth['isAuthenticated'](),interaction[_0xf80a('0xf')](_0xf80a('0x10'),_0xf80a('0x11')),controller[_0xf80a('0x12')]);router[_0xf80a('0x13')](_0xf80a('0x14'),controller[_0xf80a('0x15')]);router[_0xf80a('0x16')](_0xf80a('0xd'),auth['isAuthenticated'](),controller[_0xf80a('0x17')]);router[_0xf80a('0x16')]('/:id/accept',auth['isAuthenticated'](),controller[_0xf80a('0x18')]);router[_0xf80a('0x16')](_0xf80a('0x19'),auth['isAuthenticated'](),controller['reject']);router[_0xf80a('0x1a')](_0xf80a('0xd'),auth[_0xf80a('0x8')](),controller[_0xf80a('0x1b')]);module[_0xf80a('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 77032c1..8fde38c 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 _0x3140=['exports','TEXT','medium','out','STRING','DATE','BOOLEAN','sequelize'];(function(_0x28a554,_0x29662f){var _0x4d8724=function(_0x8f5e7a){while(--_0x8f5e7a){_0x28a554['push'](_0x28a554['shift']());}};_0x4d8724(++_0x29662f);}(_0x3140,0xaf));var _0x0314=function(_0x4947e3,_0x21f2ee){_0x4947e3=_0x4947e3-0x0;var _0x1911e5=_0x3140[_0x4947e3];return _0x1911e5;};'use strict';var Sequelize=require(_0x0314('0x0'));module[_0x0314('0x1')]={'body':{'type':Sequelize[_0x0314('0x2')](_0x0314('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x0314('0x4')),'defaultValue':_0x0314('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x0314('0x5')](0xbe)},'phone':{'type':Sequelize[_0x0314('0x5')]},'readAt':{'type':Sequelize[_0x0314('0x6')]},'secret':{'type':Sequelize[_0x0314('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0xd517=['medium','BOOLEAN','out','STRING','DATE','sequelize','exports','TEXT'];(function(_0x347102,_0x374cc9){var _0xf4e6b1=function(_0x1ab761){while(--_0x1ab761){_0x347102['push'](_0x347102['shift']());}};_0xf4e6b1(++_0x374cc9);}(_0xd517,0x1dd));var _0x7d51=function(_0x52121d,_0x1d1704){_0x52121d=_0x52121d-0x0;var _0x448627=_0xd517[_0x52121d];return _0x448627;};'use strict';var Sequelize=require(_0x7d51('0x0'));module[_0x7d51('0x1')]={'body':{'type':Sequelize[_0x7d51('0x2')](_0x7d51('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x7d51('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x7d51('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x7d51('0x6')]},'readAt':{'type':Sequelize[_0x7d51('0x7')]},'secret':{'type':Sequelize[_0x7d51('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 0dc70e2..43bc5b7 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 _0xeffd=['redis','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~!@#$%^&-_=+[{]}.','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','destroy','stack','name','index','map','SmsMessage','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','show','params','options','find','body','describe','accept','sms','read','format','UserId','CmContact','Contact','get','SmsInteraction','SmsInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','acceptMessage','interface','SIP/%s','channel','event','EventManager','acceptmessage','sms-interactions','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','rejectmessage','SmsAccount','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','MessageUUID','indexOf','delivered','Status','infobip','results','groupName','DELIVERED','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults'];(function(_0x5f5885,_0x43cb55){var _0x28c70c=function(_0x4dd24f){while(--_0x4dd24f){_0x5f5885['push'](_0x5f5885['shift']());}};_0x28c70c(++_0x43cb55);}(_0xeffd,0x6b));var _0xdeff=function(_0x21bc29,_0xae5a13){_0x21bc29=_0x21bc29-0x0;var _0x39f1e7=_0xeffd[_0x21bc29];return _0x39f1e7;};'use strict';var pdf=require(_0xdeff('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xdeff('0x1'));var zipdir=require(_0xdeff('0x2'));var jsonpatch=require(_0xdeff('0x3'));var rp=require(_0xdeff('0x4'));var moment=require(_0xdeff('0x5'));var BPromise=require(_0xdeff('0x6'));var Mustache=require(_0xdeff('0x7'));var util=require(_0xdeff('0x8'));var path=require(_0xdeff('0x9'));var sox=require(_0xdeff('0xa'));var csv=require(_0xdeff('0xb'));var ejs=require(_0xdeff('0xc'));var fs=require('fs');var _=require(_0xdeff('0xd'));var squel=require(_0xdeff('0xe'));var crypto=require(_0xdeff('0xf'));var jsforce=require(_0xdeff('0x10'));var deskjs=require(_0xdeff('0x11'));var toCsv=require('to-csv');var querystring=require(_0xdeff('0x12'));var Papa=require(_0xdeff('0x13'));var Redis=require(_0xdeff('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xdeff('0x15'));var as=require(_0xdeff('0x16'));var hardwareService=require(_0xdeff('0x17'));var logger=require(_0xdeff('0x18'))(_0xdeff('0x19'));var utils=require(_0xdeff('0x1a'));var config=require(_0xdeff('0x1b'));var db=require(_0xdeff('0x1c'))['db'];config['redis']=_[_0xdeff('0x1d')](config[_0xdeff('0x1e')],{'host':'localhost','port':0x18eb});var socket=require(_0xdeff('0x1f'))(new Redis(config['redis']));require('./smsMessage.socket')[_0xdeff('0x20')](socket);var jayson=require(_0xdeff('0x21'));var client=jayson[_0xdeff('0x22')][_0xdeff('0x23')]({'port':0x232c});var client9002=jayson['client'][_0xdeff('0x23')]({'port':0x232a});function checkPasswordPattern(_0x314ded,_0xea6c4,_0x391633){if(_0x391633){var _0x3dbba1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3dbba1[_0xdeff('0x24')](_0xea6c4)){return _0x314ded;}else{throw new db['Sequelize']['ValidationError'](_0xdeff('0x25'));}}else{return _0x314ded;}}function respondWithRpcPromise(_0x4cf724,_0x5c9837,_0x35635f,_0x369e13){return new BPromise(function(_0x4b14b6,_0x2de203){var _0x42e98e=_0x369e13||client;return _0x42e98e[_0xdeff('0x26')](_0x4cf724,_0x35635f)[_0xdeff('0x27')](function(_0x18f2e2){logger[_0xdeff('0x28')](_0xdeff('0x29'),_0x5c9837,_0xdeff('0x2a'));logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5c9837,'request\x20sent',JSON[_0xdeff('0x2b')](_0x18f2e2));if(_0x18f2e2['error']){if(_0x18f2e2[_0xdeff('0x2c')][_0xdeff('0x2d')]===0x1f4){logger['error'](_0xdeff('0x29'),_0x5c9837,_0x18f2e2[_0xdeff('0x2c')]['message']);return _0x2de203(_0x18f2e2['error'][_0xdeff('0x2e')]);}logger[_0xdeff('0x2c')](_0xdeff('0x29'),_0x5c9837,_0x18f2e2[_0xdeff('0x2c')][_0xdeff('0x2e')]);return _0x4b14b6(_0x18f2e2['error'][_0xdeff('0x2e')]);}else{logger[_0xdeff('0x28')](_0xdeff('0x29'),_0x5c9837,_0xdeff('0x2a'));_0x4b14b6(_0x18f2e2[_0xdeff('0x2f')][_0xdeff('0x2e')]);}})[_0xdeff('0x30')](function(_0x52ea5d){logger[_0xdeff('0x2c')](_0xdeff('0x29'),_0x5c9837,_0x52ea5d);_0x2de203(_0x52ea5d);});});}function respondWithStatusCode(_0x53b168,_0x4dd366){_0x4dd366=_0x4dd366||0xcc;return function(_0x830be4){if(_0x830be4){return _0x53b168[_0xdeff('0x31')](_0x4dd366);}return _0x53b168[_0xdeff('0x32')](_0x4dd366)[_0xdeff('0x33')]();};}function respondWithResult(_0x533069,_0xf9b278){_0xf9b278=_0xf9b278||0xc8;return function(_0xbc75ee){if(_0xbc75ee){return _0x533069['status'](_0xf9b278)[_0xdeff('0x34')](_0xbc75ee);}};}function respondWithFilteredResult(_0x167e07,_0x34e258){return function(_0x5045b8){if(_0x5045b8){var _0x59f7a0=_0x5045b8[_0xdeff('0x35')],_0x346743=_0x34e258[_0xdeff('0x36')],_0x505e3f=_0x34e258['offset']+_0x34e258[_0xdeff('0x37')],_0x69842a;if(_0x505e3f>=_0x59f7a0){_0x505e3f=_0x59f7a0;_0x69842a=0xc8;}else{_0x69842a=0xce;}_0x167e07['status'](_0x69842a);return _0x167e07['set'](_0xdeff('0x38'),_0x346743+'-'+_0x505e3f+'/'+_0x59f7a0)[_0xdeff('0x34')](_0x5045b8);}return null;};}function patchUpdates(_0x4764c0){return function(_0x240459){try{jsonpatch['apply'](_0x240459,_0x4764c0,!![]);}catch(_0x3f91d8){return BPromise[_0xdeff('0x39')](_0x3f91d8);}return _0x240459[_0xdeff('0x3a')]();};}function saveUpdates(_0xfcfc54,_0x1ae013){return function(_0x78382e){if(_0x78382e){return _0x78382e[_0xdeff('0x3b')](_0xfcfc54)['then'](function(_0x471614){return _0x471614;});}return null;};}function removeEntity(_0x5cef77,_0x1923bf){return function(_0x2b38b0){if(_0x2b38b0){return _0x2b38b0[_0xdeff('0x3c')]()[_0xdeff('0x27')](function(){_0x5cef77[_0xdeff('0x32')](0xcc)[_0xdeff('0x33')]();});}};}function handleEntityNotFound(_0x52baf5,_0x25801b){return function(_0x3bf462){if(!_0x3bf462){_0x52baf5['sendStatus'](0x194);}return _0x3bf462;};}function handleError(_0x133f02,_0x38e41e){_0x38e41e=_0x38e41e||0x1f4;return function(_0x1c6d4c){logger[_0xdeff('0x2c')](_0x1c6d4c[_0xdeff('0x3d')]);if(_0x1c6d4c[_0xdeff('0x3e')]){delete _0x1c6d4c[_0xdeff('0x3e')];}_0x133f02[_0xdeff('0x32')](_0x38e41e)['send'](_0x1c6d4c);};}exports[_0xdeff('0x3f')]=function(_0x4ad39d,_0x231893){var _0x345032={},_0x30f442={},_0x5f368d={'count':0x0,'rows':[]};var _0x443550=_[_0xdeff('0x40')](db[_0xdeff('0x41')][_0xdeff('0x42')],function(_0x226028){return{'name':_0x226028['fieldName'],'type':_0x226028[_0xdeff('0x43')]['key']};});_0x30f442[_0xdeff('0x44')]=_[_0xdeff('0x40')](_0x443550,'name');_0x30f442[_0xdeff('0x45')]=_[_0xdeff('0x46')](_0x4ad39d[_0xdeff('0x45')]);_0x30f442[_0xdeff('0x47')]=_[_0xdeff('0x48')](_0x30f442['model'],_0x30f442[_0xdeff('0x45')]);_0x345032[_0xdeff('0x49')]=_[_0xdeff('0x48')](_0x30f442[_0xdeff('0x44')],qs[_0xdeff('0x4a')](_0x4ad39d['query']['fields']));_0x345032[_0xdeff('0x49')]=_0x345032[_0xdeff('0x49')][_0xdeff('0x4b')]?_0x345032[_0xdeff('0x49')]:_0x30f442[_0xdeff('0x44')];if(!_0x4ad39d[_0xdeff('0x45')][_0xdeff('0x4c')]('nolimit')){_0x345032[_0xdeff('0x37')]=qs[_0xdeff('0x37')](_0x4ad39d[_0xdeff('0x45')]['limit']);_0x345032[_0xdeff('0x36')]=qs[_0xdeff('0x36')](_0x4ad39d[_0xdeff('0x45')][_0xdeff('0x36')]);}_0x345032['order']=qs[_0xdeff('0x4d')](_0x4ad39d[_0xdeff('0x45')][_0xdeff('0x4d')]);_0x345032[_0xdeff('0x4e')]=qs[_0xdeff('0x47')](_[_0xdeff('0x4f')](_0x4ad39d[_0xdeff('0x45')],_0x30f442[_0xdeff('0x47')]),_0x443550);if(_0x4ad39d['query'][_0xdeff('0x50')]){_0x345032[_0xdeff('0x4e')]=_[_0xdeff('0x51')](_0x345032[_0xdeff('0x4e')],{'$or':_[_0xdeff('0x40')](_0x443550,function(_0x4d2dd3){if(_0x4d2dd3[_0xdeff('0x43')]!==_0xdeff('0x52')){var _0x2bf4b0={};_0x2bf4b0[_0x4d2dd3[_0xdeff('0x3e')]]={'$like':'%'+_0x4ad39d[_0xdeff('0x45')]['filter']+'%'};return _0x2bf4b0;}})});}_0x345032=_[_0xdeff('0x51')]({},_0x345032,_0x4ad39d['options']);var _0x42c435={'where':_0x345032[_0xdeff('0x4e')]};return db[_0xdeff('0x41')][_0xdeff('0x35')](_0x42c435)[_0xdeff('0x27')](function(_0x15b02c){_0x5f368d['count']=_0x15b02c;if(_0x4ad39d['query'][_0xdeff('0x53')]){_0x345032[_0xdeff('0x54')]=[{'all':!![]}];}return db[_0xdeff('0x41')]['findAll'](_0x345032);})['then'](function(_0x443bc6){_0x5f368d[_0xdeff('0x55')]=_0x443bc6;return _0x5f368d;})['then'](respondWithFilteredResult(_0x231893,_0x345032))[_0xdeff('0x30')](handleError(_0x231893,null));};exports[_0xdeff('0x56')]=function(_0xb84cfa,_0x4dc2ff){var _0x28fa6c={'raw':!![],'where':{'id':_0xb84cfa[_0xdeff('0x57')]['id']}},_0x2dea17={};_0x2dea17['model']=_[_0xdeff('0x46')](db[_0xdeff('0x41')][_0xdeff('0x42')]);_0x2dea17[_0xdeff('0x45')]=_[_0xdeff('0x46')](_0xb84cfa[_0xdeff('0x45')]);_0x2dea17[_0xdeff('0x47')]=_['intersection'](_0x2dea17[_0xdeff('0x44')],_0x2dea17[_0xdeff('0x45')]);_0x28fa6c['attributes']=_[_0xdeff('0x48')](_0x2dea17[_0xdeff('0x44')],qs[_0xdeff('0x4a')](_0xb84cfa[_0xdeff('0x45')][_0xdeff('0x4a')]));_0x28fa6c[_0xdeff('0x49')]=_0x28fa6c[_0xdeff('0x49')][_0xdeff('0x4b')]?_0x28fa6c['attributes']:_0x2dea17[_0xdeff('0x44')];if(_0xb84cfa[_0xdeff('0x45')][_0xdeff('0x53')]){_0x28fa6c['include']=[{'all':!![]}];}_0x28fa6c=_['merge']({},_0x28fa6c,_0xb84cfa[_0xdeff('0x58')]);return db[_0xdeff('0x41')][_0xdeff('0x59')](_0x28fa6c)[_0xdeff('0x27')](handleEntityNotFound(_0x4dc2ff,null))[_0xdeff('0x27')](respondWithResult(_0x4dc2ff,null))[_0xdeff('0x30')](handleError(_0x4dc2ff,null));};exports['create']=function(_0x486619,_0x38338b){return db[_0xdeff('0x41')]['create'](_0x486619['body'],{})[_0xdeff('0x27')](respondWithResult(_0x38338b,0xc9))[_0xdeff('0x30')](handleError(_0x38338b,null));};exports['update']=function(_0x4107cf,_0x2ac44c){if(_0x4107cf['body']['id']){delete _0x4107cf[_0xdeff('0x5a')]['id'];}return db[_0xdeff('0x41')]['find']({'where':{'id':_0x4107cf[_0xdeff('0x57')]['id']}})[_0xdeff('0x27')](handleEntityNotFound(_0x2ac44c,null))['then'](saveUpdates(_0x4107cf[_0xdeff('0x5a')],null))[_0xdeff('0x27')](respondWithResult(_0x2ac44c,null))[_0xdeff('0x30')](handleError(_0x2ac44c,null));};exports['destroy']=function(_0x47e86d,_0x661d27){return db['SmsMessage'][_0xdeff('0x59')]({'where':{'id':_0x47e86d[_0xdeff('0x57')]['id']}})[_0xdeff('0x27')](handleEntityNotFound(_0x661d27,null))[_0xdeff('0x27')](removeEntity(_0x661d27,null))[_0xdeff('0x30')](handleError(_0x661d27,null));};exports['describe']=function(_0x4d4f85,_0x98d18c){return db[_0xdeff('0x41')][_0xdeff('0x5b')]()[_0xdeff('0x27')](respondWithResult(_0x98d18c,null))[_0xdeff('0x30')](handleError(_0x98d18c,null));};var interaction_log=require(_0xdeff('0x18'))('sms-interactions');exports[_0xdeff('0x5c')]=function(_0x47b946,_0x10253e,_0x184c9d){var _0x2f92dd={'channel':_0xdeff('0x5d')};if(_0x47b946[_0xdeff('0x5a')]['id']){delete _0x47b946[_0xdeff('0x5a')]['id'];}_0x47b946[_0xdeff('0x5a')][_0xdeff('0x5e')]=!![];_0x47b946[_0xdeff('0x5a')]['readAt']=moment()[_0xdeff('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x47b946[_0xdeff('0x5a')][_0xdeff('0x60')]=_0x47b946['body'][_0xdeff('0x60')]||_0x47b946['user']['id'];return db[_0xdeff('0x41')]['find']({'where':{'id':_0x47b946['params']['id'],'UserId':null},'include':[{'model':db[_0xdeff('0x61')],'as':_0xdeff('0x62')}]})['then'](handleEntityNotFound(_0x10253e,null))[_0xdeff('0x27')](saveUpdates(_0x47b946[_0xdeff('0x5a')],null))[_0xdeff('0x27')](function(_0x3a04fd){if(_0x3a04fd){_0x2f92dd[_0xdeff('0x2e')]=_0x3a04fd[_0xdeff('0x63')]({'plain':!![]});return db[_0xdeff('0x64')][_0xdeff('0x59')]({'where':{'id':_0x3a04fd[_0xdeff('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x10253e,null))[_0xdeff('0x27')](function(_0x198aea){if(_0x198aea){return _0x198aea['update']({'UserId':_0x47b946['body'][_0xdeff('0x60')],'read1stAt':_[_0xdeff('0x66')](_0x198aea['read1stAt'])?moment()[_0xdeff('0x5f')](_0xdeff('0x67')):undefined});}return null;})[_0xdeff('0x27')](function(_0x1d3d2b){if(_0x1d3d2b){_0x2f92dd[_0xdeff('0x68')]=_0x1d3d2b[_0xdeff('0x63')]({'plain':!![]});interaction_log[_0xdeff('0x28')](_0xdeff('0x69'),_0x47b946[_0xdeff('0x6a')]['id'],_0x47b946[_0xdeff('0x6a')]['name'],_0x47b946[_0xdeff('0x6a')][_0xdeff('0x6b')],_0x2f92dd[_0xdeff('0x68')]['id'],_0x47b946[_0xdeff('0x5a')]?JSON[_0xdeff('0x2b')](_0x47b946['body']):'null');return respondWithRpcPromise('AcceptMessage',_0xdeff('0x6c'),_0x2f92dd);}return null;})[_0xdeff('0x27')](function(_0x2e801b){if(_0x2e801b){if(_0x47b946[_0xdeff('0x5a')]['manual']){_0x2f92dd['message'][_0xdeff('0x6d')]=util[_0xdeff('0x5f')](_0xdeff('0x6e'),_0x47b946[_0xdeff('0x6a')][_0xdeff('0x3e')]);_0x2f92dd[_0xdeff('0x2e')][_0xdeff('0x6f')]=_0x2f92dd[_0xdeff('0x6f')];_0x2f92dd['message'][_0xdeff('0x70')]=_0xdeff('0x5c');return respondWithRpcPromise(_0xdeff('0x71'),_0xdeff('0x71'),{'event':_0xdeff('0x72'),'message':_0x2f92dd[_0xdeff('0x2e')]},client9002)[_0xdeff('0x27')](function(){return _0x2f92dd;});}return _0x2f92dd;}return null;})[_0xdeff('0x27')](respondWithResult(_0x10253e,null))[_0xdeff('0x30')](handleError(_0x10253e,null));};var interaction_log=require(_0xdeff('0x18'))(_0xdeff('0x73'));exports[_0xdeff('0x39')]=function(_0x5b60e4,_0xdc88e8,_0xa46f6c){var _0x1fa20b={'agent':{},'channel':'sms'};if(_0x5b60e4[_0xdeff('0x5a')]['id']){delete _0x5b60e4[_0xdeff('0x5a')]['id'];}_0x5b60e4[_0xdeff('0x5a')][_0xdeff('0x60')]=_0x5b60e4['body'][_0xdeff('0x60')]||_0x5b60e4[_0xdeff('0x6a')]['id'];_0x1fa20b['agent']['id']=_0x5b60e4[_0xdeff('0x5a')][_0xdeff('0x60')];return db[_0xdeff('0x41')][_0xdeff('0x59')]({'where':{'id':_0x5b60e4[_0xdeff('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xdc88e8,null))[_0xdeff('0x27')](function(_0x452711){if(_0x452711){_0x1fa20b[_0xdeff('0x2e')]=_0x452711[_0xdeff('0x63')]({'plain':!![]});return db[_0xdeff('0x64')]['find']({'where':{'id':_0x452711[_0xdeff('0x65')]}});}return null;})[_0xdeff('0x27')](handleEntityNotFound(_0xdc88e8,null))['then'](function(_0x22d2fb){if(_0x22d2fb){_0x1fa20b[_0xdeff('0x68')]=_0x22d2fb[_0xdeff('0x63')]({'plain':!![]});interaction_log['info'](_0xdeff('0x74'),_0x5b60e4[_0xdeff('0x6a')]['id'],_0x5b60e4['user'][_0xdeff('0x3e')],_0x5b60e4[_0xdeff('0x6a')][_0xdeff('0x6b')],_0x1fa20b[_0xdeff('0x68')]['id'],_0x5b60e4['body']?JSON[_0xdeff('0x2b')](_0x5b60e4[_0xdeff('0x5a')]):_0xdeff('0x75'));return respondWithRpcPromise(_0xdeff('0x76'),_0xdeff('0x77'),_0x1fa20b);}return null;})[_0xdeff('0x27')](function(_0x7b5b7b){if(_0x7b5b7b){_0x7b5b7b[_0xdeff('0x2e')][_0xdeff('0x6d')]=util['format'](_0xdeff('0x6e'),_0x5b60e4['user'][_0xdeff('0x3e')]);_0x7b5b7b['message']['channel']=_0x1fa20b[_0xdeff('0x6f')];_0x7b5b7b[_0xdeff('0x2e')]['event']=_0xdeff('0x39');respondWithRpcPromise(_0xdeff('0x71'),_0xdeff('0x71'),{'event':_0xdeff('0x78'),'message':_0x7b5b7b['message']},client9002);return _0x1fa20b;}return null;})[_0xdeff('0x27')](respondWithResult(_0xdc88e8,null))[_0xdeff('0x30')](handleError(_0xdc88e8,null));};exports['status']=function(_0x3dca7f,_0xd597c7,_0x3eeb2d){if(_0x3dca7f[_0xdeff('0x5a')]['id']){delete _0x3dca7f[_0xdeff('0x5a')]['id'];}var _0x377733;return db[_0xdeff('0x41')][_0xdeff('0x59')]({'where':{'id':_0x3dca7f['params']['id']}})['then'](handleEntityNotFound(_0xd597c7,null))[_0xdeff('0x27')](function(_0x4cb6a6){if(_0x4cb6a6){_0x377733=_0x4cb6a6;return db[_0xdeff('0x79')][_0xdeff('0x59')]({'where':{'id':_0x4cb6a6['SmsAccountId']}});}})[_0xdeff('0x27')](handleEntityNotFound(_0xd597c7,null))[_0xdeff('0x27')](function(_0x232d7e){if(_0x232d7e){logger['debug'](_0xdeff('0x7a'),_0xdeff('0x32'),_0xdeff('0x7b'),_0x232d7e[_0xdeff('0x43')],util['inspect'](_0x3dca7f[_0xdeff('0x5a')],{'showHidden':![],'depth':null}));switch(_0x232d7e['type']){case _0xdeff('0x7c'):if(_0x3dca7f['body'][_0xdeff('0x7d')]&&_0x3dca7f['body'][_0xdeff('0x7d')]===_0x377733[_0xdeff('0x7e')]){return _0x377733[_0xdeff('0x3b')]({'read':!![]});}else{logger['error'](_0xdeff('0x7f'),_0xdeff('0x32'),_0xdeff('0x7c'),util[_0xdeff('0x80')](_0x3dca7f['body'],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x3dca7f[_0xdeff('0x5a')][_0xdeff('0x81')]&&_0x3dca7f[_0xdeff('0x5a')][_0xdeff('0x81')]===_0x377733[_0xdeff('0x7e')]&&_[_0xdeff('0x82')](['sent',_0xdeff('0x83')],_0x3dca7f[_0xdeff('0x5a')][_0xdeff('0x84')])>=0x0){return _0x377733['update']({'read':!![]});}else{logger['error'](_0xdeff('0x7f'),_0xdeff('0x32'),'plivio',util[_0xdeff('0x80')](_0x3dca7f[_0xdeff('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xdeff('0x85'):var _0x38bf78=_0x3dca7f[_0xdeff('0x5a')][_0xdeff('0x86')][0x0];if(_0x38bf78['status'][_0xdeff('0x87')]===_0xdeff('0x88')){return _0x377733[_0xdeff('0x3b')]({'read':!![]});}else{logger['error'](_0xdeff('0x7f'),'status',_0xdeff('0x85'),util[_0xdeff('0x80')](_0x3dca7f['body'],{'showHidden':![],'depth':null}));}break;}return _0x377733;}})[_0xdeff('0x27')](respondWithResult(_0xd597c7,null))[_0xdeff('0x30')](handleError(_0xd597c7,null));}; \ No newline at end of file +var _0x2948=['SmsMessage','findAll','rows','show','params','find','create','body','update','describe','sms-interactions','accept','sms','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','format','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','null','AcceptMessage','acceptMessage','manual','interface','channel','event','EventManager','acceptmessage','agent','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SIP/%s','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','messageId','indexOf','sent','plivio','results','groupName','DELIVERED','infobip','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.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~!@#$%^&-_=+[{]}.','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','status','end','json','count','offset','Content-Range','apply','reject','destroy','sendStatus','name','send','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include'];(function(_0x33a914,_0x31c89b){var _0x2815fb=function(_0x3b1b3f){while(--_0x3b1b3f){_0x33a914['push'](_0x33a914['shift']());}};_0x2815fb(++_0x31c89b);}(_0x2948,0xcb));var _0x8294=function(_0x4a56a8,_0x4246e5){_0x4a56a8=_0x4a56a8-0x0;var _0x4ca17=_0x2948[_0x4a56a8];return _0x4ca17;};'use strict';var pdf=require(_0x8294('0x0'));var emlformat=require(_0x8294('0x1'));var rimraf=require(_0x8294('0x2'));var zipdir=require(_0x8294('0x3'));var jsonpatch=require(_0x8294('0x4'));var rp=require(_0x8294('0x5'));var moment=require(_0x8294('0x6'));var BPromise=require(_0x8294('0x7'));var Mustache=require(_0x8294('0x8'));var util=require('util');var path=require(_0x8294('0x9'));var sox=require('sox');var csv=require(_0x8294('0xa'));var ejs=require(_0x8294('0xb'));var fs=require('fs');var _=require(_0x8294('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8294('0xa'));var querystring=require(_0x8294('0xd'));var Papa=require('papaparse');var Redis=require(_0x8294('0xe'));var authService=require(_0x8294('0xf'));var qs=require(_0x8294('0x10'));var as=require(_0x8294('0x11'));var hardwareService=require(_0x8294('0x12'));var logger=require(_0x8294('0x13'))('api');var utils=require(_0x8294('0x14'));var config=require(_0x8294('0x15'));var db=require(_0x8294('0x16'))['db'];config[_0x8294('0x17')]=_[_0x8294('0x18')](config[_0x8294('0x17')],{'host':_0x8294('0x19'),'port':0x18eb});var socket=require(_0x8294('0x1a'))(new Redis(config['redis']));require(_0x8294('0x1b'))[_0x8294('0x1c')](socket);var jayson=require(_0x8294('0x1d'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client'][_0x8294('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x1bccf6,_0x25c9ae,_0x2ca14b){if(_0x2ca14b){var _0x38e295=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x38e295[_0x8294('0x1f')](_0x25c9ae)){return _0x1bccf6;}else{throw new db[(_0x8294('0x20'))][(_0x8294('0x21'))](_0x8294('0x22'));}}else{return _0x1bccf6;}}function respondWithRpcPromise(_0x1ecf57,_0x3d194a,_0x49dd8e,_0x40175a){return new BPromise(function(_0x4d1981,_0x470e21){var _0x27dabf=_0x40175a||client;return _0x27dabf[_0x8294('0x23')](_0x1ecf57,_0x49dd8e)[_0x8294('0x24')](function(_0x30f80b){logger[_0x8294('0x25')](_0x8294('0x26'),_0x3d194a,_0x8294('0x27'));logger[_0x8294('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3d194a,_0x8294('0x27'),JSON[_0x8294('0x29')](_0x30f80b));if(_0x30f80b['error']){if(_0x30f80b[_0x8294('0x2a')][_0x8294('0x2b')]===0x1f4){logger[_0x8294('0x2a')](_0x8294('0x26'),_0x3d194a,_0x30f80b[_0x8294('0x2a')][_0x8294('0x2c')]);return _0x470e21(_0x30f80b[_0x8294('0x2a')][_0x8294('0x2c')]);}logger[_0x8294('0x2a')](_0x8294('0x26'),_0x3d194a,_0x30f80b[_0x8294('0x2a')]['message']);return _0x4d1981(_0x30f80b['error'][_0x8294('0x2c')]);}else{logger['info'](_0x8294('0x26'),_0x3d194a,'request\x20sent');_0x4d1981(_0x30f80b['result'][_0x8294('0x2c')]);}})[_0x8294('0x2d')](function(_0x51ef39){logger[_0x8294('0x2a')](_0x8294('0x26'),_0x3d194a,_0x51ef39);_0x470e21(_0x51ef39);});});}function respondWithStatusCode(_0x257c75,_0x1f00b6){_0x1f00b6=_0x1f00b6||0xcc;return function(_0x58c4d2){if(_0x58c4d2){return _0x257c75['sendStatus'](_0x1f00b6);}return _0x257c75[_0x8294('0x2e')](_0x1f00b6)[_0x8294('0x2f')]();};}function respondWithResult(_0x3ae908,_0x4fa43c){_0x4fa43c=_0x4fa43c||0xc8;return function(_0x5ae09f){if(_0x5ae09f){return _0x3ae908[_0x8294('0x2e')](_0x4fa43c)[_0x8294('0x30')](_0x5ae09f);}};}function respondWithFilteredResult(_0x32cb49,_0x4925e0){return function(_0x5d0973){if(_0x5d0973){var _0x221519=_0x5d0973[_0x8294('0x31')],_0x340b72=_0x4925e0['offset'],_0x4f9ed9=_0x4925e0[_0x8294('0x32')]+_0x4925e0['limit'],_0xb2bb87;if(_0x4f9ed9>=_0x221519){_0x4f9ed9=_0x221519;_0xb2bb87=0xc8;}else{_0xb2bb87=0xce;}_0x32cb49[_0x8294('0x2e')](_0xb2bb87);return _0x32cb49['set'](_0x8294('0x33'),_0x340b72+'-'+_0x4f9ed9+'/'+_0x221519)[_0x8294('0x30')](_0x5d0973);}return null;};}function patchUpdates(_0x35a9cc){return function(_0x39b73d){try{jsonpatch[_0x8294('0x34')](_0x39b73d,_0x35a9cc,!![]);}catch(_0x254581){return BPromise[_0x8294('0x35')](_0x254581);}return _0x39b73d['save']();};}function saveUpdates(_0x29622a,_0x85f5b3){return function(_0x26e29a){if(_0x26e29a){return _0x26e29a['update'](_0x29622a)[_0x8294('0x24')](function(_0x38e4b5){return _0x38e4b5;});}return null;};}function removeEntity(_0xd22e91,_0x581ba4){return function(_0x59508c){if(_0x59508c){return _0x59508c[_0x8294('0x36')]()[_0x8294('0x24')](function(){_0xd22e91[_0x8294('0x2e')](0xcc)[_0x8294('0x2f')]();});}};}function handleEntityNotFound(_0x9b3ea8,_0x18642b){return function(_0x2f9cab){if(!_0x2f9cab){_0x9b3ea8[_0x8294('0x37')](0x194);}return _0x2f9cab;};}function handleError(_0x396420,_0x55087a){_0x55087a=_0x55087a||0x1f4;return function(_0x3f1246){logger[_0x8294('0x2a')](_0x3f1246['stack']);if(_0x3f1246[_0x8294('0x38')]){delete _0x3f1246[_0x8294('0x38')];}_0x396420[_0x8294('0x2e')](_0x55087a)[_0x8294('0x39')](_0x3f1246);};}exports['index']=function(_0x365d94,_0x2991f7){var _0x39ee6d={},_0x19f86a={},_0x81b7b0={'count':0x0,'rows':[]};var _0x1c1107=_['map'](db['SmsMessage'][_0x8294('0x3a')],function(_0x4bac0b){return{'name':_0x4bac0b[_0x8294('0x3b')],'type':_0x4bac0b[_0x8294('0x3c')]['key']};});_0x19f86a[_0x8294('0x3d')]=_[_0x8294('0x3e')](_0x1c1107,_0x8294('0x38'));_0x19f86a[_0x8294('0x3f')]=_[_0x8294('0x40')](_0x365d94[_0x8294('0x3f')]);_0x19f86a[_0x8294('0x41')]=_[_0x8294('0x42')](_0x19f86a[_0x8294('0x3d')],_0x19f86a[_0x8294('0x3f')]);_0x39ee6d[_0x8294('0x43')]=_['intersection'](_0x19f86a[_0x8294('0x3d')],qs[_0x8294('0x44')](_0x365d94[_0x8294('0x3f')]['fields']));_0x39ee6d[_0x8294('0x43')]=_0x39ee6d['attributes'][_0x8294('0x45')]?_0x39ee6d['attributes']:_0x19f86a['model'];if(!_0x365d94[_0x8294('0x3f')]['hasOwnProperty'](_0x8294('0x46'))){_0x39ee6d['limit']=qs[_0x8294('0x47')](_0x365d94['query'][_0x8294('0x47')]);_0x39ee6d[_0x8294('0x32')]=qs[_0x8294('0x32')](_0x365d94['query'][_0x8294('0x32')]);}_0x39ee6d[_0x8294('0x48')]=qs[_0x8294('0x49')](_0x365d94['query'][_0x8294('0x49')]);_0x39ee6d[_0x8294('0x4a')]=qs['filters'](_[_0x8294('0x4b')](_0x365d94[_0x8294('0x3f')],_0x19f86a[_0x8294('0x41')]),_0x1c1107);if(_0x365d94[_0x8294('0x3f')][_0x8294('0x4c')]){_0x39ee6d[_0x8294('0x4a')]=_['merge'](_0x39ee6d[_0x8294('0x4a')],{'$or':_['map'](_0x1c1107,function(_0x28944d){if(_0x28944d['type']!==_0x8294('0x4d')){var _0x1829a6={};_0x1829a6[_0x28944d['name']]={'$like':'%'+_0x365d94['query']['filter']+'%'};return _0x1829a6;}})});}_0x39ee6d=_['merge']({},_0x39ee6d,_0x365d94[_0x8294('0x4e')]);var _0xedb065={'where':_0x39ee6d[_0x8294('0x4a')]};return db['SmsMessage'][_0x8294('0x31')](_0xedb065)[_0x8294('0x24')](function(_0x13cb5b){_0x81b7b0['count']=_0x13cb5b;if(_0x365d94['query'][_0x8294('0x4f')]){_0x39ee6d[_0x8294('0x50')]=[{'all':!![]}];}return db[_0x8294('0x51')][_0x8294('0x52')](_0x39ee6d);})['then'](function(_0x10850d){_0x81b7b0[_0x8294('0x53')]=_0x10850d;return _0x81b7b0;})[_0x8294('0x24')](respondWithFilteredResult(_0x2991f7,_0x39ee6d))[_0x8294('0x2d')](handleError(_0x2991f7,null));};exports[_0x8294('0x54')]=function(_0x392bfa,_0x498ff7){var _0x221e55={'raw':!![],'where':{'id':_0x392bfa[_0x8294('0x55')]['id']}},_0x49f0fb={};_0x49f0fb[_0x8294('0x3d')]=_[_0x8294('0x40')](db[_0x8294('0x51')][_0x8294('0x3a')]);_0x49f0fb['query']=_[_0x8294('0x40')](_0x392bfa[_0x8294('0x3f')]);_0x49f0fb['filters']=_['intersection'](_0x49f0fb['model'],_0x49f0fb['query']);_0x221e55['attributes']=_[_0x8294('0x42')](_0x49f0fb[_0x8294('0x3d')],qs['fields'](_0x392bfa[_0x8294('0x3f')]['fields']));_0x221e55[_0x8294('0x43')]=_0x221e55['attributes']['length']?_0x221e55[_0x8294('0x43')]:_0x49f0fb[_0x8294('0x3d')];if(_0x392bfa[_0x8294('0x3f')][_0x8294('0x4f')]){_0x221e55['include']=[{'all':!![]}];}_0x221e55=_['merge']({},_0x221e55,_0x392bfa[_0x8294('0x4e')]);return db[_0x8294('0x51')][_0x8294('0x56')](_0x221e55)['then'](handleEntityNotFound(_0x498ff7,null))['then'](respondWithResult(_0x498ff7,null))[_0x8294('0x2d')](handleError(_0x498ff7,null));};exports[_0x8294('0x57')]=function(_0x1cb7ef,_0x367850){return db[_0x8294('0x51')][_0x8294('0x57')](_0x1cb7ef[_0x8294('0x58')],{})[_0x8294('0x24')](respondWithResult(_0x367850,0xc9))[_0x8294('0x2d')](handleError(_0x367850,null));};exports[_0x8294('0x59')]=function(_0x26e855,_0x3c4dd2){if(_0x26e855[_0x8294('0x58')]['id']){delete _0x26e855[_0x8294('0x58')]['id'];}return db['SmsMessage'][_0x8294('0x56')]({'where':{'id':_0x26e855[_0x8294('0x55')]['id']}})['then'](handleEntityNotFound(_0x3c4dd2,null))[_0x8294('0x24')](saveUpdates(_0x26e855[_0x8294('0x58')],null))[_0x8294('0x24')](respondWithResult(_0x3c4dd2,null))[_0x8294('0x2d')](handleError(_0x3c4dd2,null));};exports[_0x8294('0x36')]=function(_0x17ea9c,_0x1d6b0a){return db['SmsMessage']['find']({'where':{'id':_0x17ea9c[_0x8294('0x55')]['id']}})[_0x8294('0x24')](handleEntityNotFound(_0x1d6b0a,null))[_0x8294('0x24')](removeEntity(_0x1d6b0a,null))[_0x8294('0x2d')](handleError(_0x1d6b0a,null));};exports[_0x8294('0x5a')]=function(_0x108b9d,_0x3b62ec){return db['SmsMessage'][_0x8294('0x5a')]()[_0x8294('0x24')](respondWithResult(_0x3b62ec,null))['catch'](handleError(_0x3b62ec,null));};var interaction_log=require(_0x8294('0x13'))(_0x8294('0x5b'));exports[_0x8294('0x5c')]=function(_0xe0b6cb,_0x4ad6d7,_0x16e803){var _0x2438b1={'channel':_0x8294('0x5d')};if(_0xe0b6cb[_0x8294('0x58')]['id']){delete _0xe0b6cb['body']['id'];}_0xe0b6cb[_0x8294('0x58')][_0x8294('0x5e')]=!![];_0xe0b6cb[_0x8294('0x58')][_0x8294('0x5f')]=moment()['format'](_0x8294('0x60'));_0xe0b6cb['body'][_0x8294('0x61')]=_0xe0b6cb[_0x8294('0x58')][_0x8294('0x61')]||_0xe0b6cb[_0x8294('0x62')]['id'];return db['SmsMessage'][_0x8294('0x56')]({'where':{'id':_0xe0b6cb[_0x8294('0x55')]['id'],'UserId':null},'include':[{'model':db[_0x8294('0x63')],'as':_0x8294('0x64')}]})[_0x8294('0x24')](handleEntityNotFound(_0x4ad6d7,null))[_0x8294('0x24')](saveUpdates(_0xe0b6cb['body'],null))[_0x8294('0x24')](function(_0xf33755){if(_0xf33755){_0x2438b1[_0x8294('0x2c')]=_0xf33755[_0x8294('0x65')]({'plain':!![]});return db[_0x8294('0x66')]['find']({'where':{'id':_0xf33755[_0x8294('0x67')]}});}return null;})[_0x8294('0x24')](handleEntityNotFound(_0x4ad6d7,null))[_0x8294('0x24')](function(_0x31cec7){if(_0x31cec7){return _0x31cec7[_0x8294('0x59')]({'UserId':_0xe0b6cb['body'][_0x8294('0x61')],'read1stAt':_[_0x8294('0x68')](_0x31cec7[_0x8294('0x69')])?moment()[_0x8294('0x6a')](_0x8294('0x60')):undefined});}return null;})[_0x8294('0x24')](function(_0x570d6b){if(_0x570d6b){_0x2438b1['interaction']=_0x570d6b['get']({'plain':!![]});interaction_log[_0x8294('0x25')](_0x8294('0x6b'),_0xe0b6cb['user']['id'],_0xe0b6cb['user'][_0x8294('0x38')],_0xe0b6cb[_0x8294('0x62')]['role'],_0x2438b1[_0x8294('0x6c')]['id'],_0xe0b6cb['body']?JSON[_0x8294('0x29')](_0xe0b6cb[_0x8294('0x58')]):_0x8294('0x6d'));return respondWithRpcPromise(_0x8294('0x6e'),_0x8294('0x6f'),_0x2438b1);}return null;})['then'](function(_0x169f50){if(_0x169f50){if(_0xe0b6cb[_0x8294('0x58')][_0x8294('0x70')]){_0x2438b1[_0x8294('0x2c')][_0x8294('0x71')]=util[_0x8294('0x6a')]('SIP/%s',_0xe0b6cb[_0x8294('0x62')][_0x8294('0x38')]);_0x2438b1[_0x8294('0x2c')][_0x8294('0x72')]=_0x2438b1['channel'];_0x2438b1[_0x8294('0x2c')][_0x8294('0x73')]=_0x8294('0x5c');return respondWithRpcPromise(_0x8294('0x74'),_0x8294('0x74'),{'event':_0x8294('0x75'),'message':_0x2438b1['message']},client9002)[_0x8294('0x24')](function(){return _0x2438b1;});}return _0x2438b1;}return null;})[_0x8294('0x24')](respondWithResult(_0x4ad6d7,null))['catch'](handleError(_0x4ad6d7,null));};var interaction_log=require(_0x8294('0x13'))(_0x8294('0x5b'));exports['reject']=function(_0x2cd1e9,_0x4b137b,_0x37e809){var _0x1b038f={'agent':{},'channel':_0x8294('0x5d')};if(_0x2cd1e9[_0x8294('0x58')]['id']){delete _0x2cd1e9['body']['id'];}_0x2cd1e9[_0x8294('0x58')][_0x8294('0x61')]=_0x2cd1e9[_0x8294('0x58')]['UserId']||_0x2cd1e9['user']['id'];_0x1b038f[_0x8294('0x76')]['id']=_0x2cd1e9['body']['UserId'];return db[_0x8294('0x51')][_0x8294('0x56')]({'where':{'id':_0x2cd1e9[_0x8294('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4b137b,null))['then'](function(_0x373991){if(_0x373991){_0x1b038f[_0x8294('0x2c')]=_0x373991['get']({'plain':!![]});return db['SmsInteraction'][_0x8294('0x56')]({'where':{'id':_0x373991['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x4b137b,null))['then'](function(_0x491341){if(_0x491341){_0x1b038f[_0x8294('0x6c')]=_0x491341['get']({'plain':!![]});interaction_log[_0x8294('0x25')](_0x8294('0x77'),_0x2cd1e9[_0x8294('0x62')]['id'],_0x2cd1e9[_0x8294('0x62')][_0x8294('0x38')],_0x2cd1e9[_0x8294('0x62')][_0x8294('0x78')],_0x1b038f[_0x8294('0x6c')]['id'],_0x2cd1e9[_0x8294('0x58')]?JSON['stringify'](_0x2cd1e9[_0x8294('0x58')]):_0x8294('0x6d'));return respondWithRpcPromise(_0x8294('0x79'),_0x8294('0x7a'),_0x1b038f);}return null;})[_0x8294('0x24')](function(_0x3e319d){if(_0x3e319d){_0x3e319d['message'][_0x8294('0x71')]=util['format'](_0x8294('0x7b'),_0x2cd1e9[_0x8294('0x62')][_0x8294('0x38')]);_0x3e319d['message']['channel']=_0x1b038f[_0x8294('0x72')];_0x3e319d[_0x8294('0x2c')][_0x8294('0x73')]=_0x8294('0x35');respondWithRpcPromise('EventManager',_0x8294('0x74'),{'event':'rejectmessage','message':_0x3e319d['message']},client9002);return _0x1b038f;}return null;})[_0x8294('0x24')](respondWithResult(_0x4b137b,null))[_0x8294('0x2d')](handleError(_0x4b137b,null));};exports[_0x8294('0x2e')]=function(_0x5c6126,_0xee725a,_0x5e8a8f){if(_0x5c6126[_0x8294('0x58')]['id']){delete _0x5c6126[_0x8294('0x58')]['id'];}var _0x39146d;return db['SmsMessage'][_0x8294('0x56')]({'where':{'id':_0x5c6126[_0x8294('0x55')]['id']}})['then'](handleEntityNotFound(_0xee725a,null))[_0x8294('0x24')](function(_0xec0b4c){if(_0xec0b4c){_0x39146d=_0xec0b4c;return db[_0x8294('0x7c')][_0x8294('0x56')]({'where':{'id':_0xec0b4c[_0x8294('0x7d')]}});}})['then'](handleEntityNotFound(_0xee725a,null))[_0x8294('0x24')](function(_0x5cd475){if(_0x5cd475){logger[_0x8294('0x28')](_0x8294('0x7e'),'status',_0x8294('0x7f'),_0x5cd475[_0x8294('0x3c')],util[_0x8294('0x80')](_0x5c6126[_0x8294('0x58')],{'showHidden':![],'depth':null}));switch(_0x5cd475[_0x8294('0x3c')]){case _0x8294('0x81'):if(_0x5c6126[_0x8294('0x58')][_0x8294('0x82')]&&_0x5c6126[_0x8294('0x58')][_0x8294('0x82')]===_0x39146d['messageId']){return _0x39146d[_0x8294('0x59')]({'read':!![]});}else{logger[_0x8294('0x2a')](_0x8294('0x83'),_0x8294('0x2e'),'twilio',util[_0x8294('0x80')](_0x5c6126[_0x8294('0x58')],{'showHidden':![],'depth':null}));}break;case _0x8294('0x84'):if(_0x5c6126[_0x8294('0x58')][_0x8294('0x85')]&&_0x5c6126[_0x8294('0x58')][_0x8294('0x85')]===_0x39146d[_0x8294('0x86')]&&_[_0x8294('0x87')]([_0x8294('0x88'),'delivered'],_0x5c6126[_0x8294('0x58')]['Status'])>=0x0){return _0x39146d[_0x8294('0x59')]({'read':!![]});}else{logger[_0x8294('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x8294('0x89'),util[_0x8294('0x80')](_0x5c6126[_0x8294('0x58')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x217be0=_0x5c6126[_0x8294('0x58')][_0x8294('0x8a')][0x0];if(_0x217be0[_0x8294('0x2e')][_0x8294('0x8b')]===_0x8294('0x8c')){return _0x39146d[_0x8294('0x59')]({'read':!![]});}else{logger[_0x8294('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x8294('0x2e'),_0x8294('0x8d'),util[_0x8294('0x80')](_0x5c6126[_0x8294('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x39146d;}})[_0x8294('0x24')](respondWithResult(_0xee725a,null))[_0x8294('0x2d')](handleError(_0xee725a,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 7b1c6ee..35ee42b 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 _0xb416=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x2c534a,_0x18a19e){var _0x3f5c99=function(_0x4c085f){while(--_0x4c085f){_0x2c534a['push'](_0x2c534a['shift']());}};_0x3f5c99(++_0x18a19e);}(_0xb416,0x1ec));var _0x6b41=function(_0x9fa59,_0x200fe9){_0x9fa59=_0x9fa59-0x0;var _0x24cd76=_0xb416[_0x9fa59];return _0x24cd76;};'use strict';var EventEmitter=require(_0x6b41('0x0'));var SmsMessage=require(_0x6b41('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x6b41('0x2')](0x0);var events={'afterCreate':_0x6b41('0x3'),'afterUpdate':_0x6b41('0x4'),'afterDestroy':_0x6b41('0x5')};function emitEvent(_0x52f592){return function(_0x4c464b,_0x3efcad,_0xe64d89){SmsMessageEvents[_0x6b41('0x6')](_0x52f592+':'+_0x4c464b['id'],_0x4c464b);SmsMessageEvents[_0x6b41('0x6')](_0x52f592,_0x4c464b);_0xe64d89(null);};}for(var e in events){if(events[_0x6b41('0x7')](e)){var event=events[e];SmsMessage[_0x6b41('0x8')](e,emitEvent(event));}}module[_0x6b41('0x9')]=SmsMessageEvents; \ No newline at end of file +var _0x0aa9=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save'];(function(_0x12c290,_0x1e3239){var _0x5b7e4c=function(_0x37e2be){while(--_0x37e2be){_0x12c290['push'](_0x12c290['shift']());}};_0x5b7e4c(++_0x1e3239);}(_0x0aa9,0xe2));var _0x90aa=function(_0x3aa0f4,_0x49fa72){_0x3aa0f4=_0x3aa0f4-0x0;var _0x3ce03e=_0x0aa9[_0x3aa0f4];return _0x3ce03e;};'use strict';var EventEmitter=require(_0x90aa('0x0'));var SmsMessage=require(_0x90aa('0x1'))['db'][_0x90aa('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x90aa('0x3')](0x0);var events={'afterCreate':_0x90aa('0x4'),'afterUpdate':_0x90aa('0x5'),'afterDestroy':_0x90aa('0x6')};function emitEvent(_0x493de3){return function(_0x100db2,_0x28ce35,_0x361d29){SmsMessageEvents['emit'](_0x493de3+':'+_0x100db2['id'],_0x100db2);SmsMessageEvents[_0x90aa('0x7')](_0x493de3,_0x100db2);_0x361d29(null);};}for(var e in events){if(events[_0x90aa('0x8')](e)){var event=events[e];SmsMessage[_0x90aa('0x9')](e,emitEvent(event));}}module[_0x90aa('0xa')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 6293f8d..5df7133 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 _0x4978=['format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','head','message_id','clickSend','authId','token','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','deliveryReport','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','sender','text','keys','sort','length','createHash','md5','digest','hex','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','uuid','UTF-8','apiMessageId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','messageId','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','SmsInteractionId','createdAt','catch','error','SmsAccount','find','SmsAccountId','then','type','twilio','accountSid','authToken','phone','messages','create','body','remote','/api/sms/messages/','/status?token=','sid','update','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','login?username=','&password=','GET','split','user_key','total_sent','internal_order_id','read','afterCreate','Missing\x20parameters:\x20username,\x20password','connectel','POST','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','senderString'];(function(_0x7a68b,_0x964789){var _0x110d37=function(_0x482401){while(--_0x482401){_0x7a68b['push'](_0x7a68b['shift']());}};_0x110d37(++_0x964789);}(_0x4978,0x12d));var _0x8497=function(_0x41aaa5,_0x5d880b){_0x41aaa5=_0x41aaa5-0x0;var _0x35c60f=_0x4978[_0x41aaa5];return _0x35c60f;};'use strict';var _=require('lodash');var util=require(_0x8497('0x0'));var logger=require(_0x8497('0x1'))(_0x8497('0x2'));var moment=require(_0x8497('0x3'));var BPromise=require('bluebird');var rp=require(_0x8497('0x4'));var fs=require('fs');var path=require(_0x8497('0x5'));var rimraf=require(_0x8497('0x6'));var config=require(_0x8497('0x7'));var attributes=require(_0x8497('0x8'));module[_0x8497('0x9')]=function(_0x1ab83c,_0x31501c){return _0x1ab83c[_0x8497('0xa')](_0x8497('0xb'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x8497('0xc'),'fields':[_0x8497('0xc')]},{'name':'fti_sms_messages','fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4266a3,_0x670e4a,_0x30496a){var _0x430e24=_0x1ab83c[_0x8497('0xd')];var _0x30e05a=_0x4266a3[_0x8497('0xe')]({'plain':!![]});if(_0x30e05a[_0x8497('0xf')]['toLowerCase']()==='in'||_0x30e05a[_0x8497('0xf')][_0x8497('0x10')]()===_0x8497('0x11')&&!_0x30e05a[_0x8497('0x12')]&&!_[_0x8497('0x13')](_0x30e05a[_0x8497('0x14')])){_0x430e24['SmsInteraction'][_0x8497('0x15')]({'where':{'id':_0x30e05a[_0x8497('0x16')]}})['then'](function(_0x2c8d5c){if(_0x2c8d5c){_0x2c8d5c['update']({'lastMsgAt':_0x30e05a[_0x8497('0x17')],'lastMsgDirection':_0x30e05a[_0x8497('0xf')][_0x8497('0x10')]()});}})[_0x8497('0x18')](function(_0x503583){console[_0x8497('0x19')](_0x503583);});}if(_0x30e05a[_0x8497('0xf')]===_0x8497('0x11')&&!_0x30e05a['secret']){var _0xe85054;_0x430e24[_0x8497('0x1a')][_0x8497('0x1b')]({'where':{'id':_0x30e05a[_0x8497('0x1c')]},'raw':!![]})[_0x8497('0x1d')](function(_0x3ceb16){_0xe85054=_0x3ceb16;if(_0xe85054&&_0xe85054[_0x8497('0x1e')]){switch(_0xe85054['type']){case _0x8497('0x1f'):var _0x21cc10=require('twilio');if(_0xe85054[_0x8497('0x20')]&&_0xe85054[_0x8497('0x21')]&&_0xe85054[_0x8497('0x22')]){var _0x30829f=new _0x21cc10(_0xe85054['accountSid'],_0xe85054[_0x8497('0x21')]);_0x30829f[_0x8497('0x23')][_0x8497('0x24')]({'body':_0x30e05a[_0x8497('0x25')],'to':_0x30e05a[_0x8497('0x22')],'from':_0xe85054['phone'],'statusCallback':_0xe85054[_0x8497('0x26')]+_0x8497('0x27')+_0x30e05a['id']+_0x8497('0x28')+_0xe85054['token']})[_0x8497('0x1d')](function(_0x269afc){if(_0x269afc[_0x8497('0x29')]){return _0x4266a3[_0x8497('0x2a')]({'messageId':_0x269afc[_0x8497('0x29')]});}})['catch'](function(_0x298f4f){logger[_0x8497('0x19')](_0x8497('0x2b'),'afterCreate',_0x8497('0x1f'),util[_0x8497('0x2c')](_0x298f4f,{'showHidden':![],'depth':null}));});}else{logger[_0x8497('0x19')](_0x8497('0x2b'),'afterCreate',_0x8497('0x1f'),_0x8497('0x2d'));}break;case _0x8497('0x2e'):var _0x10991b=_0x8497('0x2f');if(_0xe85054[_0x8497('0x30')]&&_0xe85054[_0x8497('0x31')]){var _0x33e538={'recipient':[_0x30e05a[_0x8497('0x22')]],'message':_0x30e05a[_0x8497('0x25')],'message_type':_0xe85054[_0x8497('0x32')]};if(_0xe85054['smsMethod']&&_0xe85054[_0x8497('0x32')]!=='SI'){_0x33e538['sender']=_0xe85054[_0x8497('0x22')];}var _0x478c15={'url':_0x10991b+_0x8497('0x33')+_0xe85054[_0x8497('0x30')]+_0x8497('0x34')+_0xe85054[_0x8497('0x31')],'method':_0x8497('0x35')};rp(_0x478c15)[_0x8497('0x1d')](function(_0x24fda2){var _0x40c1da=_0x24fda2[_0x8497('0x36')](';');var _0x17e73d={'user_key':_0x40c1da[0x0],'session_key':_0x40c1da[0x1]};_0x478c15={'url':_0x10991b+'sms','method':'POST','headers':{'user_key':_0x17e73d[_0x8497('0x37')],'Session_key':_0x17e73d['session_key']},'json':!![],'body':_0x33e538};return rp(_0x478c15);})[_0x8497('0x1d')](function(_0x1717a5){if(_0x1717a5[_0x8497('0x38')]>=0x1){var _0x5e254c={'messageId':_0x1717a5[_0x8497('0x39')]};if(_0xe85054[_0x8497('0x32')]!=='GP'||!_0xe85054['deliveryReport']){_0x5e254c[_0x8497('0x3a')]=!![];}return _0x4266a3[_0x8497('0x2a')](_0x5e254c);}else{return logger[_0x8497('0x19')](_0x8497('0x2b'),_0x8497('0x3b'),_0x8497('0x2e'),util['inspect'](_0x1717a5,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2a1909){return logger['error'](_0x8497('0x2b'),_0x8497('0x3b'),_0x8497('0x2e'),util[_0x8497('0x2c')](_0x2a1909,{'showHidden':![],'depth':null}));});}else{logger[_0x8497('0x19')](_0x8497('0x2b'),_0x8497('0x3b'),_0x8497('0x2e'),_0x8497('0x3c'));}break;case _0x8497('0x3d'):if(_0xe85054['authToken']){var _0x58f143={'recipient':_0x30e05a['phone'],'message':_0x30e05a['body'],'sender':_0xe85054['senderString']||_0xe85054[_0x8497('0x22')],'authorization':_0xe85054[_0x8497('0x21')]};var _0x670e4a={'method':_0x8497('0x3e'),'uri':'https://smsapi.connectel.se/api/send/','body':_0x58f143,'json':!![]};rp(_0x670e4a)[_0x8497('0x1d')](function(_0x500334){var _0x1290f7={'messageId':_0x500334[_0x8497('0x3f')]};if(!_0xe85054['deliveryReport']){_0x1290f7[_0x8497('0x3a')]=!![];}return _0x4266a3[_0x8497('0x2a')](_0x1290f7);})[_0x8497('0x18')](function(_0x4cfc45){logger['error'](_0x8497('0x2b'),_0x8497('0x3b'),_0x8497('0x3d'),util['inspect'](_0x4cfc45,{'showHidden':![],'depth':null}));});}else{logger[_0x8497('0x19')](_0x8497('0x2b'),_0x8497('0x3b'),_0x8497('0x3d'),_0x8497('0x40'));}break;case _0x8497('0x41'):if(_0xe85054[_0x8497('0x30')]&&_0xe85054[_0x8497('0x31')]){var _0x58f143={'messages':[{'source':_0x8497('0x42'),'to':_0x30e05a[_0x8497('0x22')],'body':_0x30e05a['body'],'from':_0xe85054[_0x8497('0x43')]||_0xe85054[_0x8497('0x22')]}]};var _0x3a0b54=util[_0x8497('0x44')](_0x8497('0x45'),_0xe85054[_0x8497('0x30')],_0xe85054['password']);var _0x670e4a={'method':'POST','uri':_0x8497('0x46'),'body':_0x58f143,'headers':{'Authorization':util[_0x8497('0x44')](_0x8497('0x47'),new Buffer(_0x3a0b54)[_0x8497('0x48')](_0x8497('0x49')))},'json':!![]};rp(_0x670e4a)[_0x8497('0x1d')](function(_0x4376d1){if(_0x4376d1[_0x8497('0x4a')]>=0xc8&&_0x4376d1[_0x8497('0x4a')]<=0xce){if(_0x4376d1[_0x8497('0x4b')]&&_0x4376d1[_0x8497('0x4b')]['queued_count']>0x0){var _0x108417=_[_0x8497('0x4c')](_0x4376d1[_0x8497('0x4b')]['messages']);var _0x344b61={'messageId':_0x108417[_0x8497('0x4d')]};if(!_0xe85054['deliveryReport']){_0x344b61['read']=!![];}return _0x4266a3[_0x8497('0x2a')](_0x344b61);}else{logger[_0x8497('0x19')](_0x8497('0x2b'),_0x8497('0x3b'),_0x8497('0x4e'),util['inspect'](_0x4376d1,{'showHidden':![],'depth':null}));}}else{logger[_0x8497('0x19')](_0x8497('0x2b'),_0x8497('0x3b'),_0x8497('0x4e'),util[_0x8497('0x2c')](_0x4376d1,{'showHidden':![],'depth':null}));}})[_0x8497('0x18')](function(_0x43f24d){logger[_0x8497('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8497('0x3b'),_0x8497('0x4e'),util['inspect'](_0x43f24d,{'showHidden':![],'depth':null}));});}else{logger[_0x8497('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x8497('0x4e'),_0x8497('0x3c'));}break;case'plivo':if(_0xe85054[_0x8497('0x4f')]&&_0xe85054['authToken']){var _0x58f143={'dst':_0x30e05a[_0x8497('0x22')],'text':_0x30e05a['body'],'src':_0xe85054[_0x8497('0x43')]||_0xe85054[_0x8497('0x22')],'url':_0xe85054[_0x8497('0x26')]+_0x8497('0x27')+_0x30e05a['id']+_0x8497('0x28')+_0xe85054[_0x8497('0x50')]};var _0x3a0b54=util[_0x8497('0x44')](_0x8497('0x45'),_0xe85054[_0x8497('0x4f')],_0xe85054[_0x8497('0x21')]);var _0x670e4a={'method':'POST','uri':util[_0x8497('0x44')]('https://api.plivo.com/v1/Account/%s/Message/',_0xe85054[_0x8497('0x4f')]),'body':_0x58f143,'headers':{'Authorization':util[_0x8497('0x44')](_0x8497('0x47'),new Buffer(_0x3a0b54)['toString']('base64'))},'json':!![]};rp(_0x670e4a)[_0x8497('0x1d')](function(_0x55ca6a){var _0x16fbfb={'messageId':_0x55ca6a['message_uuid'][0x0]};return _0x4266a3[_0x8497('0x2a')](_0x16fbfb);})[_0x8497('0x18')](function(_0x7244dd){logger[_0x8497('0x19')](_0x8497('0x2b'),'afterCreate',_0x8497('0x51'),util[_0x8497('0x2c')](_0x7244dd,{'showHidden':![],'depth':null}));});}else{logger[_0x8497('0x19')](_0x8497('0x2b'),_0x8497('0x3b'),_0x8497('0x51'),_0x8497('0x52'));}break;case _0x8497('0x53'):if(_0xe85054['username']&&_0xe85054[_0x8497('0x31')]){if(_0xe85054[_0x8497('0x54')]){var _0x1a5886={'method':'POST','uri':_0xe85054[_0x8497('0x54')]+_0x8497('0x55'),'body':{'username':_0xe85054[_0x8497('0x30')],'password':_0xe85054[_0x8497('0x31')]},'json':!![]};return rp(_0x1a5886)[_0x8497('0x1d')](function(_0x5a28f3){var _0x117607={'method':_0x8497('0x3e'),'uri':_0xe85054['baseUrl']+_0x8497('0x56'),'body':{'messages':[{'from':_0xe85054['phone'],'destinations':[{'to':_0x30e05a[_0x8497('0x22')]}],'text':_0x30e05a['body'],'notifyUrl':_0xe85054['remote']+_0x8497('0x27')+_0x30e05a['id']+_0x8497('0x28')+_0xe85054[_0x8497('0x50')],'notifyContentType':_0x8497('0x57'),'callbackData':_0xe85054[_0x8497('0x22')]+';'+_0x30e05a[_0x8497('0x25')]}]},'headers':{'Authorization':_0x8497('0x58')+_0x5a28f3[_0x8497('0x50')]},'json':!![]};return rp(_0x117607)[_0x8497('0x1d')](function(_0x20084f){if(_0x20084f[_0x8497('0x23')]){var _0xed3bc={'messageId':_0x20084f[_0x8497('0x23')][0x0][_0x8497('0xc')]};if(!_0xe85054[_0x8497('0x59')]){_0xed3bc[_0x8497('0x3a')]=!![];}return _0x4266a3['update'](_0xed3bc);}else{return logger[_0x8497('0x19')](_0x8497('0x2b'),_0x8497('0x3b'),_0x8497('0x53'),util['inspect'](_0x20084f,{'showHidden':![],'depth':null}));}});})[_0x8497('0x18')](function(_0x20b37c){return logger[_0x8497('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8497('0x3b'),_0x8497('0x53'),util[_0x8497('0x2c')](_0x20b37c,{'showHidden':![],'depth':null}));});}else{logger[_0x8497('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8497('0x3b'),_0x8497('0x53'),_0x8497('0x5a'));}}else{logger[_0x8497('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8497('0x3b'),_0x8497('0x53'),_0x8497('0x3c'));}break;case _0x8497('0x5b'):var _0x3201b2=require(_0x8497('0x5c'));if(_0xe85054[_0x8497('0x5d')]){var _0x17a052={};_0x17a052[_0x8497('0x5e')]=_0xe85054[_0x8497('0x30')];_0x17a052['phone']=_0x30e05a[_0x8497('0x22')];_0x17a052[_0x8497('0x5f')]=_0xe85054[_0x8497('0x22')];_0x17a052[_0x8497('0x60')]=_0x30e05a[_0x8497('0x25')];_0x17a052['timestamp']=+new Date();var _0x4c2d82='';var _0x15a8a7='';var _0x173361=Object[_0x8497('0x61')](_0x17a052);_0x173361[_0x8497('0x62')]();for(var _0xb77b1c=0x0;_0xb77b1c<_0x173361[_0x8497('0x63')];_0xb77b1c++){if(_0x4c2d82!=''){_0x4c2d82+='&';}_0x4c2d82+=_0x173361[_0xb77b1c]+'='+encodeURIComponent(_0x17a052[_0x173361[_0xb77b1c]]);_0x15a8a7+=_0x17a052[_0x173361[_0xb77b1c]];}_0x15a8a7+=_0xe85054[_0x8497('0x5d')];_0x15a8a7=_0x3201b2[_0x8497('0x64')](_0x8497('0x65'))['update'](_0x15a8a7)[_0x8497('0x66')](_0x8497('0x67'));if(_0x4c2d82!==''){_0x4c2d82+='&';}_0x4c2d82+=_0x8497('0x68')+_0x15a8a7;var _0x478c15={'method':'GET','uri':_0xe85054[_0x8497('0x54')]+_0x8497('0x69')+_0x4c2d82,'json':!![]};return rp(_0x478c15)[_0x8497('0x1d')](function(_0x593183){var _0x2a29d6=Object[_0x8497('0x61')](_0x593183);if(_0x593183[_0x2a29d6[0x0]][_0x8497('0x19')]&&parseInt(_0x593183[_0x2a29d6[0x0]][_0x8497('0x19')])===0x0){var _0x5aa14e={'messageId':_0x593183[_0x2a29d6[0x0]][_0x8497('0x6a')]};if(!_0xe85054[_0x8497('0x59')]){_0x5aa14e['read']=!![];}return _0x4266a3['update'](_0x5aa14e);}else{return logger[_0x8497('0x19')](_0x8497('0x2b'),_0x8497('0x3b'),_0x8497('0x5b'),util['inspect'](_0x593183['error'],{'showHidden':![],'depth':null}));}})[_0x8497('0x18')](function(_0x542470){return logger[_0x8497('0x19')](_0x8497('0x2b'),'afterCreate',_0x8497('0x5b'),util['inspect'](_0x542470,{'showHidden':![],'depth':null}));});}else{logger[_0x8497('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x8497('0x5b'),_0x8497('0x6b'));}break;case _0x8497('0x6c'):if(_0xe85054[_0x8497('0x5d')]){var _0x2ac4ab={'method':'POST','uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0xe85054[_0x8497('0x5d')]},'body':{'content':_0x30e05a[_0x8497('0x25')],'to':[_0x30e05a['phone']],'from':_0xe85054[_0x8497('0x22')],'binary':![],'clientMessageId':_0x8497('0x6d'),'charset':_0x8497('0x6e')},'json':!![]};rp(_0x2ac4ab)[_0x8497('0x1d')](function(_0x1be4aa){if(!_0x1be4aa[_0x8497('0x19')]){var _0x3aceb6={'messageId':_0x1be4aa['messages'][0x0][_0x8497('0x6f')]};if(!_0xe85054[_0x8497('0x59')]){_0x3aceb6[_0x8497('0x3a')]=!![];}return _0x4266a3[_0x8497('0x2a')](_0x3aceb6);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x8497('0x6c'),util[_0x8497('0x2c')](_0x1be4aa['error'],{'showHidden':![],'depth':null}));}})[_0x8497('0x18')](function(_0x37fef8){return logger['error'](_0x8497('0x2b'),_0x8497('0x3b'),_0x8497('0x6c'),util[_0x8497('0x2c')](_0x37fef8,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x8497('0x2b'),_0x8497('0x3b'),_0x8497('0x6c'),_0x8497('0x6b'));}break;case _0x8497('0x70'):if(_0xe85054[_0x8497('0x5d')]){var _0x42ccc6={};var _0x478c15={'method':_0x8497('0x3e'),'uri':_0x8497('0x71'),'headers':{'Authorization':_0x8497('0x72')+_0xe85054[_0x8497('0x5d')],'Content-Type':_0x8497('0x57')},'body':{'from':_0xe85054[_0x8497('0x22')],'to':_0x30e05a[_0x8497('0x22')],'text':_0x30e05a[_0x8497('0x25')]},'json':!![]};return rp(_0x478c15)[_0x8497('0x1d')](function(_0x136090){if(_0x136090['code']==0xca){_0x42ccc6[_0x8497('0x73')]=_0x136090;var _0x2be15f={'method':_0x8497('0x3e'),'uri':_0x8497('0x74'),'headers':{'Authorization':'Bearer\x20'+_0xe85054['apiKey'],'Content-Type':_0x8497('0x57')},'body':{'refid':_0x42ccc6[_0x8497('0x73')][_0x8497('0x75')]},'json':!![]};return rp(_0x2be15f)[_0x8497('0x1d')](function(_0x2f704d){_0x42ccc6[_0x8497('0x76')]=_0x2f704d;var _0x29bfbc={'messageId':_0x42ccc6[_0x8497('0x73')]['refid'],'read':!![]};return _0x4266a3['update'](_0x29bfbc);});}else{return logger[_0x8497('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8497('0x3b'),_0x8497('0x70'),util['inspect'](_0x136090,{'showHidden':![],'depth':null}));}})[_0x8497('0x18')](function(_0x4648c1){return logger[_0x8497('0x19')](_0x8497('0x2b'),_0x8497('0x3b'),_0x8497('0x70'),util[_0x8497('0x2c')](_0x4648c1,{'showHidden':![],'depth':null}));});}else{return logger[_0x8497('0x19')](_0x8497('0x2b'),_0x8497('0x3b'),_0x8497('0x70'),_0x8497('0x77'));}break;}}})[_0x8497('0x78')](function(){_0x30496a();});}else{_0x30496a();}}},'charset':_0x8497('0x79'),'collate':_0x8497('0x7a')});}; \ No newline at end of file +var _0xbbee=['refid','finally','utf8mb4','util','../../config/logger','api','bluebird','path','../../config/environment','./smsMessage.attributes','define','sms_messages','messageId','fti_sms_messages','body','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','then','update','createdAt','catch','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','remote','/api/sms/messages/','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','password','smsMethod','sender','login?username=','username','&password=','POST','user_key','session_key','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/send/','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','%s:%s','Basic\x20%s','toString','base64','http_code','data','head','message_id','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','format','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','/status?token=','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','timestamp','createHash','md5','digest','hex','signature=','GET','/external/get/send.php?','keys','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','apiMessageId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbbee,0x1bb));var _0xebbe=function(_0x4ed854,_0x252d23){_0x4ed854=_0x4ed854-0x0;var _0x5ca6bc=_0xbbee[_0x4ed854];return _0x5ca6bc;};'use strict';var _=require('lodash');var util=require(_0xebbe('0x0'));var logger=require(_0xebbe('0x1'))(_0xebbe('0x2'));var moment=require('moment');var BPromise=require(_0xebbe('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xebbe('0x4'));var rimraf=require('rimraf');var config=require(_0xebbe('0x5'));var attributes=require(_0xebbe('0x6'));module['exports']=function(_0x92afd3,_0x572058){return _0x92afd3[_0xebbe('0x7')]('SmsMessage',attributes,{'tableName':_0xebbe('0x8'),'paranoid':![],'indexes':[{'name':_0xebbe('0x9'),'fields':[_0xebbe('0x9')]},{'name':_0xebbe('0xa'),'fields':[_0xebbe('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1aef61,_0x239183,_0x1ff914){var _0x19eb26=_0x92afd3['models'];var _0xc9124e=_0x1aef61['get']({'plain':!![]});if(_0xc9124e[_0xebbe('0xc')][_0xebbe('0xd')]()==='in'||_0xc9124e[_0xebbe('0xc')][_0xebbe('0xd')]()===_0xebbe('0xe')&&!_0xc9124e[_0xebbe('0xf')]&&!_[_0xebbe('0x10')](_0xc9124e[_0xebbe('0x11')])){_0x19eb26[_0xebbe('0x12')]['findOne']({'where':{'id':_0xc9124e['SmsInteractionId']}})[_0xebbe('0x13')](function(_0x108973){if(_0x108973){_0x108973[_0xebbe('0x14')]({'lastMsgAt':_0xc9124e[_0xebbe('0x15')],'lastMsgDirection':_0xc9124e['direction']['toLowerCase']()});}})[_0xebbe('0x16')](function(_0xc4ef88){console[_0xebbe('0x17')](_0xc4ef88);});}if(_0xc9124e[_0xebbe('0xc')]===_0xebbe('0xe')&&!_0xc9124e[_0xebbe('0xf')]){var _0x1c3d83;_0x19eb26[_0xebbe('0x18')][_0xebbe('0x19')]({'where':{'id':_0xc9124e[_0xebbe('0x1a')]},'raw':!![]})[_0xebbe('0x13')](function(_0x180e68){_0x1c3d83=_0x180e68;if(_0x1c3d83&&_0x1c3d83[_0xebbe('0x1b')]){switch(_0x1c3d83[_0xebbe('0x1b')]){case _0xebbe('0x1c'):var _0x122b9e=require(_0xebbe('0x1c'));if(_0x1c3d83[_0xebbe('0x1d')]&&_0x1c3d83[_0xebbe('0x1e')]&&_0x1c3d83[_0xebbe('0x1f')]){var _0x36ff49=new _0x122b9e(_0x1c3d83[_0xebbe('0x1d')],_0x1c3d83[_0xebbe('0x1e')]);_0x36ff49[_0xebbe('0x20')]['create']({'body':_0xc9124e[_0xebbe('0xb')],'to':_0xc9124e[_0xebbe('0x1f')],'from':_0x1c3d83[_0xebbe('0x1f')],'statusCallback':_0x1c3d83[_0xebbe('0x21')]+_0xebbe('0x22')+_0xc9124e['id']+'/status?token='+_0x1c3d83[_0xebbe('0x23')]})[_0xebbe('0x13')](function(_0x3b18e5){if(_0x3b18e5[_0xebbe('0x24')]){return _0x1aef61[_0xebbe('0x14')]({'messageId':_0x3b18e5[_0xebbe('0x24')]});}})['catch'](function(_0x42286d){logger[_0xebbe('0x17')](_0xebbe('0x25'),'afterCreate',_0xebbe('0x1c'),util[_0xebbe('0x26')](_0x42286d,{'showHidden':![],'depth':null}));});}else{logger[_0xebbe('0x17')](_0xebbe('0x25'),_0xebbe('0x27'),'twilio',_0xebbe('0x28'));}break;case _0xebbe('0x29'):var _0x51738a='https://api.skebby.it/API/v1.0/REST/';if(_0x1c3d83['username']&&_0x1c3d83[_0xebbe('0x2a')]){var _0x1b1a07={'recipient':[_0xc9124e[_0xebbe('0x1f')]],'message':_0xc9124e['body'],'message_type':_0x1c3d83[_0xebbe('0x2b')]};if(_0x1c3d83[_0xebbe('0x2b')]&&_0x1c3d83[_0xebbe('0x2b')]!=='SI'){_0x1b1a07[_0xebbe('0x2c')]=_0x1c3d83[_0xebbe('0x1f')];}var _0x52903a={'url':_0x51738a+_0xebbe('0x2d')+_0x1c3d83[_0xebbe('0x2e')]+_0xebbe('0x2f')+_0x1c3d83[_0xebbe('0x2a')],'method':'GET'};rp(_0x52903a)[_0xebbe('0x13')](function(_0x364054){var _0x51b45b=_0x364054['split'](';');var _0x639e37={'user_key':_0x51b45b[0x0],'session_key':_0x51b45b[0x1]};_0x52903a={'url':_0x51738a+'sms','method':_0xebbe('0x30'),'headers':{'user_key':_0x639e37[_0xebbe('0x31')],'Session_key':_0x639e37[_0xebbe('0x32')]},'json':!![],'body':_0x1b1a07};return rp(_0x52903a);})[_0xebbe('0x13')](function(_0x24ab32){if(_0x24ab32['total_sent']>=0x1){var _0xfa577f={'messageId':_0x24ab32[_0xebbe('0x33')]};if(_0x1c3d83[_0xebbe('0x2b')]!=='GP'||!_0x1c3d83[_0xebbe('0x34')]){_0xfa577f[_0xebbe('0x35')]=!![];}return _0x1aef61[_0xebbe('0x14')](_0xfa577f);}else{return logger[_0xebbe('0x17')](_0xebbe('0x25'),_0xebbe('0x27'),_0xebbe('0x29'),util[_0xebbe('0x26')](_0x24ab32,{'showHidden':![],'depth':null}));}})[_0xebbe('0x16')](function(_0x57ebcc){return logger['error'](_0xebbe('0x25'),_0xebbe('0x27'),_0xebbe('0x29'),util[_0xebbe('0x26')](_0x57ebcc,{'showHidden':![],'depth':null}));});}else{logger[_0xebbe('0x17')](_0xebbe('0x25'),_0xebbe('0x27'),'skebby',_0xebbe('0x36'));}break;case _0xebbe('0x37'):if(_0x1c3d83[_0xebbe('0x1e')]){var _0x5b94ad={'recipient':_0xc9124e[_0xebbe('0x1f')],'message':_0xc9124e['body'],'sender':_0x1c3d83[_0xebbe('0x38')]||_0x1c3d83[_0xebbe('0x1f')],'authorization':_0x1c3d83['authToken']};var _0x239183={'method':_0xebbe('0x30'),'uri':_0xebbe('0x39'),'body':_0x5b94ad,'json':!![]};rp(_0x239183)[_0xebbe('0x13')](function(_0x2ed34c){var _0x1754bf={'messageId':_0x2ed34c['requestid']};if(!_0x1c3d83['deliveryReport']){_0x1754bf[_0xebbe('0x35')]=!![];}return _0x1aef61[_0xebbe('0x14')](_0x1754bf);})[_0xebbe('0x16')](function(_0x4b58e4){logger[_0xebbe('0x17')](_0xebbe('0x25'),'afterCreate',_0xebbe('0x37'),util[_0xebbe('0x26')](_0x4b58e4,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xebbe('0x25'),_0xebbe('0x27'),'connectel',_0xebbe('0x3a'));}break;case'clicksend':if(_0x1c3d83['username']&&_0x1c3d83[_0xebbe('0x2a')]){var _0x5b94ad={'messages':[{'source':_0xebbe('0x3b'),'to':_0xc9124e[_0xebbe('0x1f')],'body':_0xc9124e['body'],'from':_0x1c3d83[_0xebbe('0x38')]||_0x1c3d83[_0xebbe('0x1f')]}]};var _0x29f20a=util['format'](_0xebbe('0x3c'),_0x1c3d83[_0xebbe('0x2e')],_0x1c3d83[_0xebbe('0x2a')]);var _0x239183={'method':'POST','uri':'https://rest.clicksend.com/v3/sms/send','body':_0x5b94ad,'headers':{'Authorization':util['format'](_0xebbe('0x3d'),new Buffer(_0x29f20a)[_0xebbe('0x3e')](_0xebbe('0x3f')))},'json':!![]};rp(_0x239183)[_0xebbe('0x13')](function(_0x2b0165){if(_0x2b0165[_0xebbe('0x40')]>=0xc8&&_0x2b0165[_0xebbe('0x40')]<=0xce){if(_0x2b0165[_0xebbe('0x41')]&&_0x2b0165[_0xebbe('0x41')]['queued_count']>0x0){var _0x4846ac=_[_0xebbe('0x42')](_0x2b0165[_0xebbe('0x41')][_0xebbe('0x20')]);var _0x5470cf={'messageId':_0x4846ac[_0xebbe('0x43')]};if(!_0x1c3d83[_0xebbe('0x34')]){_0x5470cf['read']=!![];}return _0x1aef61[_0xebbe('0x14')](_0x5470cf);}else{logger['error'](_0xebbe('0x25'),_0xebbe('0x27'),'clickSend',util[_0xebbe('0x26')](_0x2b0165,{'showHidden':![],'depth':null}));}}else{logger['error'](_0xebbe('0x25'),_0xebbe('0x27'),_0xebbe('0x44'),util[_0xebbe('0x26')](_0x2b0165,{'showHidden':![],'depth':null}));}})['catch'](function(_0x51cee3){logger[_0xebbe('0x17')](_0xebbe('0x25'),'afterCreate',_0xebbe('0x44'),util[_0xebbe('0x26')](_0x51cee3,{'showHidden':![],'depth':null}));});}else{logger[_0xebbe('0x17')](_0xebbe('0x25'),_0xebbe('0x27'),_0xebbe('0x44'),_0xebbe('0x36'));}break;case _0xebbe('0x45'):if(_0x1c3d83['authId']&&_0x1c3d83['authToken']){var _0x5b94ad={'dst':_0xc9124e[_0xebbe('0x1f')],'text':_0xc9124e[_0xebbe('0xb')],'src':_0x1c3d83['senderString']||_0x1c3d83[_0xebbe('0x1f')],'url':_0x1c3d83[_0xebbe('0x21')]+_0xebbe('0x22')+_0xc9124e['id']+'/status?token='+_0x1c3d83['token']};var _0x29f20a=util['format']('%s:%s',_0x1c3d83[_0xebbe('0x46')],_0x1c3d83[_0xebbe('0x1e')]);var _0x239183={'method':'POST','uri':util['format'](_0xebbe('0x47'),_0x1c3d83[_0xebbe('0x46')]),'body':_0x5b94ad,'headers':{'Authorization':util[_0xebbe('0x48')](_0xebbe('0x3d'),new Buffer(_0x29f20a)[_0xebbe('0x3e')](_0xebbe('0x3f')))},'json':!![]};rp(_0x239183)['then'](function(_0x2bf474){var _0x24dd9c={'messageId':_0x2bf474[_0xebbe('0x49')][0x0]};return _0x1aef61['update'](_0x24dd9c);})[_0xebbe('0x16')](function(_0x22581c){logger['error'](_0xebbe('0x25'),_0xebbe('0x27'),'plivo',util['inspect'](_0x22581c,{'showHidden':![],'depth':null}));});}else{logger[_0xebbe('0x17')](_0xebbe('0x25'),_0xebbe('0x27'),_0xebbe('0x45'),_0xebbe('0x4a'));}break;case _0xebbe('0x4b'):if(_0x1c3d83[_0xebbe('0x2e')]&&_0x1c3d83[_0xebbe('0x2a')]){if(_0x1c3d83[_0xebbe('0x4c')]){var _0x45975c={'method':'POST','uri':_0x1c3d83['baseUrl']+_0xebbe('0x4d'),'body':{'username':_0x1c3d83['username'],'password':_0x1c3d83[_0xebbe('0x2a')]},'json':!![]};return rp(_0x45975c)[_0xebbe('0x13')](function(_0x38d4a7){var _0x38d1b2={'method':_0xebbe('0x30'),'uri':_0x1c3d83[_0xebbe('0x4c')]+_0xebbe('0x4e'),'body':{'messages':[{'from':_0x1c3d83[_0xebbe('0x1f')],'destinations':[{'to':_0xc9124e[_0xebbe('0x1f')]}],'text':_0xc9124e['body'],'notifyUrl':_0x1c3d83[_0xebbe('0x21')]+_0xebbe('0x22')+_0xc9124e['id']+_0xebbe('0x4f')+_0x1c3d83[_0xebbe('0x23')],'notifyContentType':_0xebbe('0x50'),'callbackData':_0x1c3d83[_0xebbe('0x1f')]+';'+_0xc9124e[_0xebbe('0xb')]}]},'headers':{'Authorization':_0xebbe('0x51')+_0x38d4a7['token']},'json':!![]};return rp(_0x38d1b2)[_0xebbe('0x13')](function(_0x1f5d6c){if(_0x1f5d6c[_0xebbe('0x20')]){var _0x5c673a={'messageId':_0x1f5d6c[_0xebbe('0x20')][0x0]['messageId']};if(!_0x1c3d83[_0xebbe('0x34')]){_0x5c673a[_0xebbe('0x35')]=!![];}return _0x1aef61[_0xebbe('0x14')](_0x5c673a);}else{return logger[_0xebbe('0x17')](_0xebbe('0x25'),_0xebbe('0x27'),_0xebbe('0x4b'),util[_0xebbe('0x26')](_0x1f5d6c,{'showHidden':![],'depth':null}));}});})[_0xebbe('0x16')](function(_0x44d184){return logger[_0xebbe('0x17')](_0xebbe('0x25'),_0xebbe('0x27'),_0xebbe('0x4b'),util[_0xebbe('0x26')](_0x44d184,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xebbe('0x27'),_0xebbe('0x4b'),_0xebbe('0x52'));}}else{logger[_0xebbe('0x17')](_0xebbe('0x25'),_0xebbe('0x27'),_0xebbe('0x4b'),_0xebbe('0x36'));}break;case _0xebbe('0x53'):var _0x2bff48=require(_0xebbe('0x54'));if(_0x1c3d83[_0xebbe('0x55')]){var _0x522696={};_0x522696[_0xebbe('0x56')]=_0x1c3d83['username'];_0x522696[_0xebbe('0x1f')]=_0xc9124e[_0xebbe('0x1f')];_0x522696[_0xebbe('0x2c')]=_0x1c3d83['phone'];_0x522696['text']=_0xc9124e[_0xebbe('0xb')];_0x522696[_0xebbe('0x57')]=+new Date();var _0x46ae80='';var _0x7ffe77='';var _0x36a144=Object['keys'](_0x522696);_0x36a144['sort']();for(var _0x577f0d=0x0;_0x577f0d<_0x36a144['length'];_0x577f0d++){if(_0x46ae80!=''){_0x46ae80+='&';}_0x46ae80+=_0x36a144[_0x577f0d]+'='+encodeURIComponent(_0x522696[_0x36a144[_0x577f0d]]);_0x7ffe77+=_0x522696[_0x36a144[_0x577f0d]];}_0x7ffe77+=_0x1c3d83[_0xebbe('0x55')];_0x7ffe77=_0x2bff48[_0xebbe('0x58')](_0xebbe('0x59'))[_0xebbe('0x14')](_0x7ffe77)[_0xebbe('0x5a')](_0xebbe('0x5b'));if(_0x46ae80!==''){_0x46ae80+='&';}_0x46ae80+=_0xebbe('0x5c')+_0x7ffe77;var _0x52903a={'method':_0xebbe('0x5d'),'uri':_0x1c3d83[_0xebbe('0x4c')]+_0xebbe('0x5e')+_0x46ae80,'json':!![]};return rp(_0x52903a)[_0xebbe('0x13')](function(_0x1e3a59){var _0x130c43=Object[_0xebbe('0x5f')](_0x1e3a59);if(_0x1e3a59[_0x130c43[0x0]][_0xebbe('0x17')]&&parseInt(_0x1e3a59[_0x130c43[0x0]][_0xebbe('0x17')])===0x0){var _0x55448f={'messageId':_0x1e3a59[_0x130c43[0x0]][_0xebbe('0x60')]};if(!_0x1c3d83[_0xebbe('0x34')]){_0x55448f[_0xebbe('0x35')]=!![];}return _0x1aef61[_0xebbe('0x14')](_0x55448f);}else{return logger[_0xebbe('0x17')](_0xebbe('0x25'),_0xebbe('0x27'),_0xebbe('0x53'),util[_0xebbe('0x26')](_0x1e3a59['error'],{'showHidden':![],'depth':null}));}})[_0xebbe('0x16')](function(_0x4043d7){return logger[_0xebbe('0x17')](_0xebbe('0x25'),_0xebbe('0x27'),'csc',util[_0xebbe('0x26')](_0x4043d7,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xebbe('0x25'),_0xebbe('0x27'),_0xebbe('0x53'),_0xebbe('0x61'));}break;case _0xebbe('0x62'):if(_0x1c3d83[_0xebbe('0x55')]){var _0xdf68cb={'method':_0xebbe('0x30'),'uri':_0xebbe('0x63'),'headers':{'Authorization':_0x1c3d83['apiKey']},'body':{'content':_0xc9124e[_0xebbe('0xb')],'to':[_0xc9124e['phone']],'from':_0x1c3d83['phone'],'binary':![],'clientMessageId':'uuid','charset':'UTF-8'},'json':!![]};rp(_0xdf68cb)[_0xebbe('0x13')](function(_0x45b130){if(!_0x45b130[_0xebbe('0x17')]){var _0x58d671={'messageId':_0x45b130[_0xebbe('0x20')][0x0][_0xebbe('0x64')]};if(!_0x1c3d83[_0xebbe('0x34')]){_0x58d671['read']=!![];}return _0x1aef61[_0xebbe('0x14')](_0x58d671);}else{return logger[_0xebbe('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xebbe('0x27'),'clickatell',util[_0xebbe('0x26')](_0x45b130['error'],{'showHidden':![],'depth':null}));}})[_0xebbe('0x16')](function(_0x1eabe0){return logger[_0xebbe('0x17')](_0xebbe('0x25'),_0xebbe('0x27'),'clickatell',util['inspect'](_0x1eabe0,{'showHidden':![],'depth':null}));});}else{logger[_0xebbe('0x17')](_0xebbe('0x25'),_0xebbe('0x27'),'clickatell','Missing\x20parameters:\x20apiKey');}break;case _0xebbe('0x65'):if(_0x1c3d83[_0xebbe('0x55')]){var _0x5c1fc2={};var _0x52903a={'method':_0xebbe('0x30'),'uri':_0xebbe('0x66'),'headers':{'Authorization':_0xebbe('0x67')+_0x1c3d83['apiKey'],'Content-Type':_0xebbe('0x50')},'body':{'from':_0x1c3d83[_0xebbe('0x1f')],'to':_0xc9124e[_0xebbe('0x1f')],'text':_0xc9124e[_0xebbe('0xb')]},'json':!![]};return rp(_0x52903a)[_0xebbe('0x13')](function(_0x21a501){if(_0x21a501[_0xebbe('0x68')]==0xca){_0x5c1fc2[_0xebbe('0x69')]=_0x21a501;var _0x15a754={'method':_0xebbe('0x30'),'uri':_0xebbe('0x6a'),'headers':{'Authorization':_0xebbe('0x67')+_0x1c3d83[_0xebbe('0x55')],'Content-Type':'application/json'},'body':{'refid':_0x5c1fc2[_0xebbe('0x69')]['refid']},'json':!![]};return rp(_0x15a754)[_0xebbe('0x13')](function(_0x5bdd60){_0x5c1fc2['status']=_0x5bdd60;var _0x23bbc9={'messageId':_0x5c1fc2[_0xebbe('0x69')][_0xebbe('0x6b')],'read':!![]};return _0x1aef61[_0xebbe('0x14')](_0x23bbc9);});}else{return logger[_0xebbe('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xebbe('0x27'),'intelepeer',util['inspect'](_0x21a501,{'showHidden':![],'depth':null}));}})[_0xebbe('0x16')](function(_0x43bfcf){return logger[_0xebbe('0x17')](_0xebbe('0x25'),_0xebbe('0x27'),_0xebbe('0x65'),util[_0xebbe('0x26')](_0x43bfcf,{'showHidden':![],'depth':null}));});}else{return logger[_0xebbe('0x17')](_0xebbe('0x25'),'afterCreate',_0xebbe('0x65'),'Token\x20not\x20received');}break;}}})[_0xebbe('0x6c')](function(){_0x1ff914();});}else{_0x1ff914();}}},'charset':_0xebbe('0x6d'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 0dfd7c8..2511281 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 _0x0b0e=['message','result','SmsMessage','create','body','options','CreateSmsMessage','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsMessage.socket','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s'];(function(_0x302547,_0x4196b2){var _0x3a9ae8=function(_0xa9fe57){while(--_0xa9fe57){_0x302547['push'](_0x302547['shift']());}};_0x3a9ae8(++_0x4196b2);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5976f8,_0x1265b7){_0x5976f8=_0x5976f8-0x0;var _0x179715=_0x0b0e[_0x5976f8];return _0x179715;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});config[_0xe0b0('0xc')]=_['defaults'](config['redis'],{'host':_0xe0b0('0xd'),'port':0x18eb});var socket=require(_0xe0b0('0xe'))(new Redis(config[_0xe0b0('0xc')]));require(_0xe0b0('0xf'))['register'](socket);function respondWithRpcPromise(_0x338e7c,_0x1dd3b8,_0x553d4f){return new BPromise(function(_0x1fef28,_0x2f32b6){return client['request'](_0x338e7c,_0x553d4f)[_0xe0b0('0x10')](function(_0x2cdad2){logger[_0xe0b0('0x11')]('SmsMessage,\x20%s,\x20%s',_0x1dd3b8,_0xe0b0('0x12'));logger[_0xe0b0('0x13')](_0xe0b0('0x14'),_0x1dd3b8,_0xe0b0('0x12'),JSON[_0xe0b0('0x15')](_0x2cdad2));if(_0x2cdad2['error']){if(_0x2cdad2[_0xe0b0('0x16')][_0xe0b0('0x17')]===0x1f4){logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2[_0xe0b0('0x16')]['message']);return _0x2f32b6(_0x2cdad2[_0xe0b0('0x16')]['message']);}logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2['error'][_0xe0b0('0x19')]);return _0x1fef28(_0x2cdad2['error'][_0xe0b0('0x19')]);}else{logger[_0xe0b0('0x11')]('SmsMessage,\x20%s,\x20%s',_0x1dd3b8,'request\x20sent');_0x1fef28(_0x2cdad2[_0xe0b0('0x1a')]['message']);}})['catch'](function(_0x4bce65){logger[_0xe0b0('0x16')]('SmsMessage,\x20%s,\x20%s',_0x1dd3b8,_0x4bce65);_0x2f32b6(_0x4bce65);});});}exports['CreateSmsMessage']=function(_0x10cde1){var _0x59dff5=this;return new Promise(function(_0x472286,_0x5dba2f){return db[_0xe0b0('0x1b')][_0xe0b0('0x1c')](_0x10cde1[_0xe0b0('0x1d')],{'raw':_0x10cde1[_0xe0b0('0x1e')]?_0x10cde1[_0xe0b0('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2fa820){logger['info'](_0xe0b0('0x1f'),_0x10cde1);logger[_0xe0b0('0x13')]('CreateSmsMessage',_0x10cde1,JSON[_0xe0b0('0x15')](_0x2fa820));_0x472286(_0x2fa820);})['catch'](function(_0x2208d0){logger['error'](_0xe0b0('0x1f'),_0x2208d0['message'],_0x10cde1);_0x5dba2f(_0x59dff5[_0xe0b0('0x16')](0x1f4,_0x2208d0['message']));});});}; \ No newline at end of file +var _0xda2d=['body','options','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SmsMessage,\x20%s,\x20%s','result','catch','CreateSmsMessage','SmsMessage'];(function(_0x3a2a3c,_0x37bd31){var _0x50ac9a=function(_0x494a7f){while(--_0x494a7f){_0x3a2a3c['push'](_0x3a2a3c['shift']());}};_0x50ac9a(++_0x37bd31);}(_0xda2d,0x102));var _0xdda2=function(_0x368739,_0x36920c){_0x368739=_0x368739-0x0;var _0x81fd6c=_0xda2d[_0x368739];return _0x81fd6c;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var moment=require(_0xdda2('0x1'));var BPromise=require(_0xdda2('0x2'));var rs=require(_0xdda2('0x3'));var fs=require('fs');var Redis=require(_0xdda2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdda2('0x5'));var config=require(_0xdda2('0x6'));var jayson=require(_0xdda2('0x7'));var client=jayson[_0xdda2('0x8')][_0xdda2('0x9')]({'port':0x232a});config[_0xdda2('0xa')]=_[_0xdda2('0xb')](config[_0xdda2('0xa')],{'host':_0xdda2('0xc'),'port':0x18eb});var socket=require(_0xdda2('0xd'))(new Redis(config['redis']));require(_0xdda2('0xe'))[_0xdda2('0xf')](socket);function respondWithRpcPromise(_0x4df6b8,_0x1c11b2,_0x2f3454){return new BPromise(function(_0x42d990,_0x346119){return client[_0xdda2('0x10')](_0x4df6b8,_0x2f3454)[_0xdda2('0x11')](function(_0x26fe81){logger[_0xdda2('0x12')]('SmsMessage,\x20%s,\x20%s',_0x1c11b2,'request\x20sent');logger['debug'](_0xdda2('0x13'),_0x1c11b2,_0xdda2('0x14'),JSON[_0xdda2('0x15')](_0x26fe81));if(_0x26fe81[_0xdda2('0x16')]){if(_0x26fe81[_0xdda2('0x16')][_0xdda2('0x17')]===0x1f4){logger[_0xdda2('0x16')]('SmsMessage,\x20%s,\x20%s',_0x1c11b2,_0x26fe81[_0xdda2('0x16')]['message']);return _0x346119(_0x26fe81[_0xdda2('0x16')][_0xdda2('0x18')]);}logger[_0xdda2('0x16')](_0xdda2('0x19'),_0x1c11b2,_0x26fe81[_0xdda2('0x16')]['message']);return _0x42d990(_0x26fe81['error'][_0xdda2('0x18')]);}else{logger['info'](_0xdda2('0x19'),_0x1c11b2,_0xdda2('0x14'));_0x42d990(_0x26fe81[_0xdda2('0x1a')][_0xdda2('0x18')]);}})[_0xdda2('0x1b')](function(_0x17015f){logger[_0xdda2('0x16')](_0xdda2('0x19'),_0x1c11b2,_0x17015f);_0x346119(_0x17015f);});});}exports[_0xdda2('0x1c')]=function(_0x337b0b){var _0x312ef1=this;return new Promise(function(_0x6fdede,_0x4eed30){return db[_0xdda2('0x1d')]['create'](_0x337b0b[_0xdda2('0x1e')],{'raw':_0x337b0b[_0xdda2('0x1f')]?_0x337b0b[_0xdda2('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0xdda2('0x11')](function(_0x5a9bb8){logger[_0xdda2('0x12')](_0xdda2('0x1c'),_0x337b0b);logger['debug'](_0xdda2('0x1c'),_0x337b0b,JSON[_0xdda2('0x15')](_0x5a9bb8));_0x6fdede(_0x5a9bb8);})[_0xdda2('0x1b')](function(_0x13b0f3){logger[_0xdda2('0x16')]('CreateSmsMessage',_0x13b0f3[_0xdda2('0x18')],_0x337b0b);_0x4eed30(_0x312ef1[_0xdda2('0x16')](0x1f4,_0x13b0f3[_0xdda2('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 0bfc8e9..bd8560e 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 _0x12dd=['save','remove','update','removeListener','length','smsMessage:'];(function(_0x329437,_0x1de73a){var _0x3789d9=function(_0x37832e){while(--_0x37832e){_0x329437['push'](_0x329437['shift']());}};_0x3789d9(++_0x1de73a);}(_0x12dd,0xa8));var _0xd12d=function(_0x1cc3ce,_0x43791e){_0x1cc3ce=_0x1cc3ce-0x0;var _0x4ac6ac=_0x12dd[_0x1cc3ce];return _0x4ac6ac;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0xd12d('0x0'),_0xd12d('0x1'),_0xd12d('0x2')];function createListener(_0x37e464,_0x3b0725){return function(_0x374b2b){_0x3b0725['emit'](_0x37e464,_0x374b2b);};}function removeListener(_0x41abb4,_0x27bf14){return function(){SmsMessageEvents[_0xd12d('0x3')](_0x41abb4,_0x27bf14);};}exports['register']=function(_0x1ecf87){for(var _0x495d21=0x0,_0x270904=events[_0xd12d('0x4')];_0x495d21<_0x270904;_0x495d21++){var _0x4d7a95=events[_0x495d21];var _0x56a252=createListener(_0xd12d('0x5')+_0x4d7a95,_0x1ecf87);SmsMessageEvents['on'](_0x4d7a95,_0x56a252);}}; \ No newline at end of file +var _0x62bf=['length','smsMessage:','./smsMessage.events','save','remove','update','emit','register'];(function(_0x57d3cd,_0x2d772a){var _0x3b67c0=function(_0x1aa283){while(--_0x1aa283){_0x57d3cd['push'](_0x57d3cd['shift']());}};_0x3b67c0(++_0x2d772a);}(_0x62bf,0x15a));var _0xf62b=function(_0x4d8cb9,_0x3a6729){_0x4d8cb9=_0x4d8cb9-0x0;var _0x5aba82=_0x62bf[_0x4d8cb9];return _0x5aba82;};'use strict';var SmsMessageEvents=require(_0xf62b('0x0'));var events=[_0xf62b('0x1'),_0xf62b('0x2'),_0xf62b('0x3')];function createListener(_0x1e124e,_0x3296a6){return function(_0x5b4a08){_0x3296a6[_0xf62b('0x4')](_0x1e124e,_0x5b4a08);};}function removeListener(_0x1cc99a,_0x19bb24){return function(){SmsMessageEvents['removeListener'](_0x1cc99a,_0x19bb24);};}exports[_0xf62b('0x5')]=function(_0x318ee6){for(var _0x2eaef8=0x0,_0x5ecc92=events[_0xf62b('0x6')];_0x2eaef8<_0x5ecc92;_0x2eaef8++){var _0x4119bf=events[_0x2eaef8];var _0x347d41=createListener(_0xf62b('0x7')+_0x4119bf,_0x318ee6);SmsMessageEvents['on'](_0x4119bf,_0x347d41);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 6d98489..e3d82a1 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 _0x9f02=['destroy','delete','removeTeams','removeAgents','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','/:id','show','/:id/members','/:id/users','getAgents','isAuthenticated','create','post','/:id/teams','addTeams','put','update'];(function(_0x5d8f42,_0x44e3ed){var _0x22f1c3=function(_0x1eceeb){while(--_0x1eceeb){_0x5d8f42['push'](_0x5d8f42['shift']());}};_0x22f1c3(++_0x44e3ed);}(_0x9f02,0x68));var _0x29f0=function(_0xcbb7f7,_0x299988){_0xcbb7f7=_0xcbb7f7-0x0;var _0x1b6927=_0x9f02[_0xcbb7f7];return _0x1b6927;};'use strict';var multer=require(_0x29f0('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x29f0('0x1'));var router=express[_0x29f0('0x2')]();var auth=require(_0x29f0('0x3'));var interaction=require(_0x29f0('0x4'));var config=require(_0x29f0('0x5'));var controller=require('./smsQueue.controller');router[_0x29f0('0x6')]('/',auth['isAuthenticated'](),controller[_0x29f0('0x7')]);router[_0x29f0('0x6')](_0x29f0('0x8'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x29f0('0x9'),auth['isAuthenticated'](),controller[_0x29f0('0xa')]);router[_0x29f0('0x6')](_0x29f0('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0x29f0('0x6')]('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router['get'](_0x29f0('0xc'),auth['isAuthenticated'](),controller[_0x29f0('0xd')]);router['post']('/',auth[_0x29f0('0xe')](),controller[_0x29f0('0xf')]);router[_0x29f0('0x10')](_0x29f0('0x11'),auth['isAuthenticated'](),controller[_0x29f0('0x12')]);router[_0x29f0('0x10')]('/:id/users',auth[_0x29f0('0xe')](),controller['addAgents']);router[_0x29f0('0x13')]('/:id',auth[_0x29f0('0xe')](),controller[_0x29f0('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x29f0('0x15')]);router[_0x29f0('0x16')](_0x29f0('0x11'),auth['isAuthenticated'](),controller[_0x29f0('0x17')]);router[_0x29f0('0x16')](_0x29f0('0xc'),auth[_0x29f0('0xe')](),controller[_0x29f0('0x18')]);module['exports']=router; \ No newline at end of file +var _0x2581=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','describe','/:id','show','getMembers','/:id/teams','/:id/users','getAgents','create','post','addTeams','put','update','delete','destroy','removeTeams','removeAgents','exports'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x2581,0xcb));var _0x1258=function(_0x131062,_0x1d4d50){_0x131062=_0x131062-0x0;var _0x41beaa=_0x2581[_0x131062];return _0x41beaa;};'use strict';var multer=require(_0x1258('0x0'));var util=require(_0x1258('0x1'));var path=require(_0x1258('0x2'));var timeout=require(_0x1258('0x3'));var express=require(_0x1258('0x4'));var router=express['Router']();var auth=require(_0x1258('0x5'));var interaction=require(_0x1258('0x6'));var config=require(_0x1258('0x7'));var controller=require(_0x1258('0x8'));router[_0x1258('0x9')]('/',auth[_0x1258('0xa')](),controller[_0x1258('0xb')]);router[_0x1258('0x9')]('/describe',auth[_0x1258('0xa')](),controller[_0x1258('0xc')]);router[_0x1258('0x9')](_0x1258('0xd'),auth[_0x1258('0xa')](),controller[_0x1258('0xe')]);router[_0x1258('0x9')]('/:id/members',auth['isAuthenticated'](),controller[_0x1258('0xf')]);router[_0x1258('0x9')](_0x1258('0x10'),auth[_0x1258('0xa')](),controller['getTeams']);router[_0x1258('0x9')](_0x1258('0x11'),auth[_0x1258('0xa')](),controller[_0x1258('0x12')]);router['post']('/',auth[_0x1258('0xa')](),controller[_0x1258('0x13')]);router[_0x1258('0x14')](_0x1258('0x10'),auth[_0x1258('0xa')](),controller[_0x1258('0x15')]);router[_0x1258('0x14')]('/:id/users',auth[_0x1258('0xa')](),controller['addAgents']);router[_0x1258('0x16')](_0x1258('0xd'),auth[_0x1258('0xa')](),controller[_0x1258('0x17')]);router[_0x1258('0x18')]('/:id',auth[_0x1258('0xa')](),controller[_0x1258('0x19')]);router[_0x1258('0x18')]('/:id/teams',auth[_0x1258('0xa')](),controller[_0x1258('0x1a')]);router['delete'](_0x1258('0x11'),auth[_0x1258('0xa')](),controller[_0x1258('0x1b')]);module[_0x1258('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 8966757..7e6b376 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 _0x935e=['exports','STRING','INTEGER','sequelize'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x935e,0x163));var _0xe935=function(_0x151a0c,_0x3d382b){_0x151a0c=_0x151a0c-0x0;var _0x25a73e=_0x935e[_0x151a0c];return _0x25a73e;};'use strict';var Sequelize=require(_0xe935('0x0'));module[_0xe935('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe935('0x2')]},'timeout':{'type':Sequelize[_0xe935('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory','beepall','roundrobin')}}; \ No newline at end of file +var _0xfb40=['INTEGER','ENUM','rrmemory','beepall','exports','STRING','name'];(function(_0x3b3210,_0x25e8ed){var _0x5b5484=function(_0x417858){while(--_0x417858){_0x3b3210['push'](_0x3b3210['shift']());}};_0x5b5484(++_0x25e8ed);}(_0xfb40,0xf2));var _0x0fb4=function(_0x430711,_0x44e268){_0x430711=_0x430711-0x0;var _0x5ca16a=_0xfb40[_0x430711];return _0x5ca16a;};'use strict';var Sequelize=require('sequelize');module[_0x0fb4('0x0')]={'name':{'type':Sequelize[_0x0fb4('0x1')],'unique':_0x0fb4('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x0fb4('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0fb4('0x4')](_0x0fb4('0x5'),_0x0fb4('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index e331017..899f80e 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 _0x2497=['reject','save','update','destroy','get','SmsQueues','then','end','stack','send','map','rawAttributes','fieldName','type','key','model','name','query','intersection','attributes','hasOwnProperty','nolimit','sort','where','pick','filters','merge','VIRTUAL','filter','includeAll','include','SmsQueue','rows','catch','show','params','fields','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','keys','order','SmsQueueId','findAll','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','smsPause','getTeams','Team','voicePause','interface','flatMap','Agents','sequelize','transaction','addTeams','UserSmsQueue','forEach','userSmsQueue:save','removeTeams','select','tq.TeamId','from','team_has_sms_queues','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','value','ids','isEmpty','removeAgents','emit','addAgents','spread','userSmsQueue:remove','getAgents','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','path','sox','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','count','offset','limit','Content-Range','json','apply'];(function(_0x3d9176,_0x399d6f){var _0x12adc5=function(_0x700b01){while(--_0x700b01){_0x3d9176['push'](_0x3d9176['shift']());}};_0x12adc5(++_0x399d6f);}(_0x2497,0xee));var _0x7249=function(_0x500d61,_0x57f530){_0x500d61=_0x500d61-0x0;var _0x500395=_0x2497[_0x500d61];return _0x500395;};'use strict';var pdf=require(_0x7249('0x0'));var emlformat=require(_0x7249('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7249('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7249('0x3'));var moment=require(_0x7249('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7249('0x5'));var util=require('util');var path=require(_0x7249('0x6'));var sox=require(_0x7249('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x7249('0x8'));var squel=require('squel');var crypto=require(_0x7249('0x9'));var jsforce=require(_0x7249('0xa'));var deskjs=require(_0x7249('0xb'));var toCsv=require(_0x7249('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7249('0xd'));var authService=require(_0x7249('0xe'));var qs=require(_0x7249('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7249('0x10'));var logger=require(_0x7249('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x7249('0x12'));var db=require(_0x7249('0x13'))['db'];config[_0x7249('0x14')]=_['defaults'](config[_0x7249('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x7249('0x15'))(new Redis(config[_0x7249('0x14')]));require(_0x7249('0x16'))[_0x7249('0x17')](socket);function respondWithStatusCode(_0x1f1dd0,_0x44d6a2){_0x44d6a2=_0x44d6a2||0xcc;return function(_0x596ee8){if(_0x596ee8){return _0x1f1dd0[_0x7249('0x18')](_0x44d6a2);}return _0x1f1dd0[_0x7249('0x19')](_0x44d6a2)['end']();};}function respondWithResult(_0x2c16e2,_0x2e07bc){_0x2e07bc=_0x2e07bc||0xc8;return function(_0xdfae34){if(_0xdfae34){return _0x2c16e2[_0x7249('0x19')](_0x2e07bc)['json'](_0xdfae34);}};}function respondWithFilteredResult(_0x18a9c3,_0x288b81){return function(_0x569e98){if(_0x569e98){var _0xf02b7f=_0x569e98[_0x7249('0x1a')],_0x198dba=_0x288b81[_0x7249('0x1b')],_0x243152=_0x288b81['offset']+_0x288b81[_0x7249('0x1c')],_0x1285cd;if(_0x243152>=_0xf02b7f){_0x243152=_0xf02b7f;_0x1285cd=0xc8;}else{_0x1285cd=0xce;}_0x18a9c3[_0x7249('0x19')](_0x1285cd);return _0x18a9c3['set'](_0x7249('0x1d'),_0x198dba+'-'+_0x243152+'/'+_0xf02b7f)[_0x7249('0x1e')](_0x569e98);}return null;};}function patchUpdates(_0x3690b6){return function(_0x39837f){try{jsonpatch[_0x7249('0x1f')](_0x39837f,_0x3690b6,!![]);}catch(_0x3642d5){return BPromise[_0x7249('0x20')](_0x3642d5);}return _0x39837f[_0x7249('0x21')]();};}function saveUpdates(_0x5d5144,_0x26ad7c){return function(_0x21d147){if(_0x21d147){return _0x21d147[_0x7249('0x22')](_0x5d5144)['then'](function(_0x32e384){return _0x32e384;});}return null;};}function removeEntity(_0x2ba5fa,_0x1a8322){return function(_0xcdb2d8){if(_0xcdb2d8){return _0xcdb2d8[_0x7249('0x23')]()['then'](function(){var _0x487612=_0xcdb2d8[_0x7249('0x24')]({'plain':!![]});var _0x48b941=_0x7249('0x25');return db['UserProfileResource'][_0x7249('0x23')]({'where':{'type':_0x48b941,'resourceId':_0x487612['id']}})[_0x7249('0x26')](function(){return _0xcdb2d8;});})['then'](function(){_0x2ba5fa[_0x7249('0x19')](0xcc)[_0x7249('0x27')]();});}};}function handleEntityNotFound(_0x838629,_0x1762d7){return function(_0x1055f9){if(!_0x1055f9){_0x838629[_0x7249('0x18')](0x194);}return _0x1055f9;};}function handleError(_0x3a7c6a,_0x1b171f){_0x1b171f=_0x1b171f||0x1f4;return function(_0x18a049){logger['error'](_0x18a049[_0x7249('0x28')]);if(_0x18a049['name']){delete _0x18a049['name'];}_0x3a7c6a[_0x7249('0x19')](_0x1b171f)[_0x7249('0x29')](_0x18a049);};}exports['index']=function(_0x3ac855,_0x2e111d){var _0x1531d6={},_0x46a854={},_0x5044a0={'count':0x0,'rows':[]};var _0x2d264b=_[_0x7249('0x2a')](db['SmsQueue'][_0x7249('0x2b')],function(_0x162ba5){return{'name':_0x162ba5[_0x7249('0x2c')],'type':_0x162ba5[_0x7249('0x2d')][_0x7249('0x2e')]};});_0x46a854[_0x7249('0x2f')]=_[_0x7249('0x2a')](_0x2d264b,_0x7249('0x30'));_0x46a854[_0x7249('0x31')]=_['keys'](_0x3ac855[_0x7249('0x31')]);_0x46a854['filters']=_[_0x7249('0x32')](_0x46a854[_0x7249('0x2f')],_0x46a854[_0x7249('0x31')]);_0x1531d6[_0x7249('0x33')]=_[_0x7249('0x32')](_0x46a854['model'],qs['fields'](_0x3ac855[_0x7249('0x31')]['fields']));_0x1531d6[_0x7249('0x33')]=_0x1531d6[_0x7249('0x33')]['length']?_0x1531d6[_0x7249('0x33')]:_0x46a854[_0x7249('0x2f')];if(!_0x3ac855[_0x7249('0x31')][_0x7249('0x34')](_0x7249('0x35'))){_0x1531d6[_0x7249('0x1c')]=qs['limit'](_0x3ac855[_0x7249('0x31')]['limit']);_0x1531d6[_0x7249('0x1b')]=qs[_0x7249('0x1b')](_0x3ac855['query'][_0x7249('0x1b')]);}_0x1531d6['order']=qs[_0x7249('0x36')](_0x3ac855[_0x7249('0x31')]['sort']);_0x1531d6[_0x7249('0x37')]=qs['filters'](_[_0x7249('0x38')](_0x3ac855['query'],_0x46a854[_0x7249('0x39')]),_0x2d264b);if(_0x3ac855[_0x7249('0x31')]['filter']){_0x1531d6[_0x7249('0x37')]=_[_0x7249('0x3a')](_0x1531d6[_0x7249('0x37')],{'$or':_[_0x7249('0x2a')](_0x2d264b,function(_0x3abfe3){if(_0x3abfe3['type']!==_0x7249('0x3b')){var _0x4cdd29={};_0x4cdd29[_0x3abfe3[_0x7249('0x30')]]={'$like':'%'+_0x3ac855[_0x7249('0x31')][_0x7249('0x3c')]+'%'};return _0x4cdd29;}})});}_0x1531d6=_[_0x7249('0x3a')]({},_0x1531d6,_0x3ac855['options']);var _0x2f6673={'where':_0x1531d6['where']};return db['SmsQueue'][_0x7249('0x1a')](_0x2f6673)[_0x7249('0x26')](function(_0x19a94d){_0x5044a0[_0x7249('0x1a')]=_0x19a94d;if(_0x3ac855[_0x7249('0x31')][_0x7249('0x3d')]){_0x1531d6[_0x7249('0x3e')]=[{'all':!![]}];}return db[_0x7249('0x3f')]['findAll'](_0x1531d6);})[_0x7249('0x26')](function(_0x166abe){_0x5044a0[_0x7249('0x40')]=_0x166abe;return _0x5044a0;})[_0x7249('0x26')](respondWithFilteredResult(_0x2e111d,_0x1531d6))[_0x7249('0x41')](handleError(_0x2e111d,null));};exports[_0x7249('0x42')]=function(_0x441ddc,_0x2e9905){var _0x280eac={'raw':!![],'where':{'id':_0x441ddc[_0x7249('0x43')]['id']}},_0xaaa364={};_0xaaa364[_0x7249('0x2f')]=_['keys'](db['SmsQueue']['rawAttributes']);_0xaaa364['query']=_['keys'](_0x441ddc['query']);_0xaaa364[_0x7249('0x39')]=_[_0x7249('0x32')](_0xaaa364['model'],_0xaaa364[_0x7249('0x31')]);_0x280eac[_0x7249('0x33')]=_[_0x7249('0x32')](_0xaaa364[_0x7249('0x2f')],qs[_0x7249('0x44')](_0x441ddc[_0x7249('0x31')][_0x7249('0x44')]));_0x280eac['attributes']=_0x280eac[_0x7249('0x33')][_0x7249('0x45')]?_0x280eac[_0x7249('0x33')]:_0xaaa364[_0x7249('0x2f')];if(_0x441ddc['query'][_0x7249('0x3d')]){_0x280eac[_0x7249('0x3e')]=[{'all':!![]}];}_0x280eac=_[_0x7249('0x3a')]({},_0x280eac,_0x441ddc[_0x7249('0x46')]);return db[_0x7249('0x3f')][_0x7249('0x47')](_0x280eac)['then'](handleEntityNotFound(_0x2e9905,null))[_0x7249('0x26')](respondWithResult(_0x2e9905,null))[_0x7249('0x41')](handleError(_0x2e9905,null));};exports[_0x7249('0x48')]=function(_0xf94e4,_0x5225e8){return db[_0x7249('0x3f')]['create'](_0xf94e4[_0x7249('0x49')],{})['then'](function(_0x358385){var _0x5e1b8b=_0xf94e4[_0x7249('0x4a')][_0x7249('0x24')]({'plain':!![]});if(!_0x5e1b8b)throw new Error(_0x7249('0x4b'));if(_0x5e1b8b[_0x7249('0x4c')]===_0x7249('0x4a')){var _0xb2fc65=_0x358385['get']({'plain':!![]});var _0x53c4e7=_0x7249('0x25');return db[_0x7249('0x4d')]['find']({'where':{'name':_0x53c4e7,'userProfileId':_0x5e1b8b[_0x7249('0x4e')]},'raw':!![]})[_0x7249('0x26')](function(_0x25cfef){if(_0x25cfef&&_0x25cfef[_0x7249('0x4f')]===0x0){return db[_0x7249('0x50')][_0x7249('0x48')]({'name':_0xb2fc65[_0x7249('0x30')],'resourceId':_0xb2fc65['id'],'type':_0x25cfef['name'],'sectionId':_0x25cfef['id']},{})[_0x7249('0x26')](function(){return _0x358385;});}else{return _0x358385;}})[_0x7249('0x41')](function(_0x5f1e2e){logger[_0x7249('0x51')](_0x7249('0x52'),_0x5f1e2e);throw _0x5f1e2e;});}return _0x358385;})[_0x7249('0x26')](respondWithResult(_0x5225e8,0xc9))[_0x7249('0x41')](handleError(_0x5225e8,null));};exports['update']=function(_0x3c5f73,_0x31288a){if(_0x3c5f73['body']['id']){delete _0x3c5f73[_0x7249('0x49')]['id'];}return db[_0x7249('0x3f')]['find']({'where':{'id':_0x3c5f73['params']['id']}})[_0x7249('0x26')](handleEntityNotFound(_0x31288a,null))[_0x7249('0x26')](saveUpdates(_0x3c5f73[_0x7249('0x49')],null))[_0x7249('0x26')](respondWithResult(_0x31288a,null))['catch'](handleError(_0x31288a,null));};exports['destroy']=function(_0x27c6ee,_0x158a30){return db[_0x7249('0x3f')][_0x7249('0x47')]({'where':{'id':_0x27c6ee[_0x7249('0x43')]['id']}})[_0x7249('0x26')](handleEntityNotFound(_0x158a30,null))['then'](removeEntity(_0x158a30,null))[_0x7249('0x41')](handleError(_0x158a30,null));};exports[_0x7249('0x53')]=function(_0x42879c,_0x244b1a){return db[_0x7249('0x3f')][_0x7249('0x53')]()[_0x7249('0x26')](respondWithResult(_0x244b1a,null))[_0x7249('0x41')](handleError(_0x244b1a,null));};exports[_0x7249('0x54')]=function(_0x2cc5ad,_0x3beeac,_0x3fc84a){var _0x574f82={'raw':!![],'where':{}},_0x1b1e4f={},_0x1bff2f;return db[_0x7249('0x3f')][_0x7249('0x55')]({'where':{'id':_0x2cc5ad[_0x7249('0x43')]['id']}})[_0x7249('0x26')](handleEntityNotFound(_0x3beeac,null))['then'](function(_0x311f1b){if(_0x311f1b){_0x1bff2f=_0x311f1b[_0x7249('0x24')]({'plain':!![]});_0x1b1e4f[_0x7249('0x2f')]=_['keys'](db['UserSmsQueue'][_0x7249('0x2b')]);_0x1b1e4f[_0x7249('0x31')]=_[_0x7249('0x56')](_0x2cc5ad[_0x7249('0x31')]);_0x1b1e4f[_0x7249('0x39')]=_[_0x7249('0x32')](_0x1b1e4f[_0x7249('0x2f')],_0x1b1e4f[_0x7249('0x31')]);_0x574f82['attributes']=_[_0x7249('0x32')](_0x1b1e4f[_0x7249('0x2f')],qs[_0x7249('0x44')](_0x2cc5ad[_0x7249('0x31')][_0x7249('0x44')]));_0x574f82[_0x7249('0x33')]=_0x574f82[_0x7249('0x33')][_0x7249('0x45')]?_0x574f82['attributes']:_0x1b1e4f[_0x7249('0x2f')];if(!_0x2cc5ad['query'][_0x7249('0x34')]('nolimit')){_0x574f82['limit']=qs[_0x7249('0x1c')](_0x2cc5ad[_0x7249('0x31')][_0x7249('0x1c')]);_0x574f82['offset']=qs[_0x7249('0x1b')](_0x2cc5ad[_0x7249('0x31')][_0x7249('0x1b')]);}_0x574f82[_0x7249('0x57')]=qs[_0x7249('0x36')](_0x2cc5ad[_0x7249('0x31')][_0x7249('0x36')]);_0x574f82[_0x7249('0x37')]=qs[_0x7249('0x39')](_['pick'](_0x2cc5ad['query'],_0x1b1e4f[_0x7249('0x39')]));_0x574f82['where'][_0x7249('0x58')]=_0x311f1b['id'];if(_0x2cc5ad[_0x7249('0x31')][_0x7249('0x3c')]){_0x574f82['where']=_[_0x7249('0x3a')](_0x574f82[_0x7249('0x37')],{'$or':_[_0x7249('0x2a')](_0x574f82[_0x7249('0x33')],function(_0x78ce2e){var _0x3a2a27={};_0x3a2a27[_0x78ce2e]={'$like':'%'+_0x2cc5ad[_0x7249('0x31')][_0x7249('0x3c')]+'%'};return _0x3a2a27;})});}_0x574f82=_[_0x7249('0x3a')]({},_0x574f82,_0x2cc5ad['options']);return db['UserSmsQueue'][_0x7249('0x59')](_0x574f82);}})[_0x7249('0x26')](function(_0x2cd45c){if(_0x2cd45c){return db[_0x7249('0x5a')][_0x7249('0x5b')]({'where':{'id':_['map'](_0x2cd45c,_0x7249('0x5c')),'role':_0x7249('0x5d')},'attributes':['id','name','smsPause',_0x7249('0x5e'),_0x7249('0x5f')]});}})[_0x7249('0x26')](function(_0x1b14d5){if(_0x1b14d5){return{'count':_0x1b14d5[_0x7249('0x1a')],'rows':_[_0x7249('0x2a')](_0x1b14d5[_0x7249('0x40')],function(_0x1c4c5f){return{'membername':_0x1c4c5f[_0x7249('0x30')],'UserId':_0x1c4c5f['id'],'queue_name':_0x1bff2f[_0x7249('0x30')],'SmsQueueId':_0x1bff2f['id'],'interface':util[_0x7249('0x60')](_0x7249('0x61'),'SIP',_0x1c4c5f[_0x7249('0x30')]),'penalty':0x0,'paused':_0x1c4c5f[_0x7249('0x62')],'createdAt':_0x1c4c5f[_0x7249('0x5f')],'updatedAt':_0x1c4c5f[_0x7249('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3beeac,_0x574f82))[_0x7249('0x41')](handleError(_0x3beeac,null));};exports[_0x7249('0x63')]=function(_0x1e26f8,_0x34f222,_0x1ff19){var _0x57cbe1={};var _0x16cfe2={};var _0x78ed64;var _0x30723e;return db[_0x7249('0x3f')][_0x7249('0x55')]({'where':{'id':_0x1e26f8['params']['id']}})[_0x7249('0x26')](handleEntityNotFound(_0x34f222,null))[_0x7249('0x26')](function(_0x50be0a){if(_0x50be0a){_0x78ed64=_0x50be0a;_0x16cfe2['model']=_[_0x7249('0x56')](db[_0x7249('0x64')][_0x7249('0x2b')]);_0x16cfe2[_0x7249('0x31')]=_[_0x7249('0x56')](_0x1e26f8[_0x7249('0x31')]);_0x16cfe2[_0x7249('0x39')]=_[_0x7249('0x32')](_0x16cfe2[_0x7249('0x2f')],_0x16cfe2[_0x7249('0x31')]);_0x57cbe1[_0x7249('0x33')]=_['intersection'](_0x16cfe2[_0x7249('0x2f')],qs[_0x7249('0x44')](_0x1e26f8['query'][_0x7249('0x44')]));_0x57cbe1['attributes']=_0x57cbe1[_0x7249('0x33')]['length']?_0x57cbe1[_0x7249('0x33')]:_0x16cfe2[_0x7249('0x2f')];_0x57cbe1[_0x7249('0x57')]=qs['sort'](_0x1e26f8[_0x7249('0x31')][_0x7249('0x36')]);_0x57cbe1[_0x7249('0x37')]=qs[_0x7249('0x39')](_[_0x7249('0x38')](_0x1e26f8[_0x7249('0x31')],_0x16cfe2[_0x7249('0x39')]));if(_0x1e26f8[_0x7249('0x31')]['filter']){_0x57cbe1[_0x7249('0x37')]=_[_0x7249('0x3a')](_0x57cbe1[_0x7249('0x37')],{'$or':_['map'](_0x57cbe1[_0x7249('0x33')],function(_0x5c4a94){var _0x392588={};_0x392588[_0x5c4a94]={'$like':'%'+_0x1e26f8[_0x7249('0x31')][_0x7249('0x3c')]+'%'};return _0x392588;})});}_0x57cbe1=_[_0x7249('0x3a')]({},_0x57cbe1,_0x1e26f8[_0x7249('0x46')]);return _0x78ed64[_0x7249('0x63')](_0x57cbe1);}})[_0x7249('0x26')](function(_0x345f60){if(_0x345f60){_0x30723e=_0x345f60[_0x7249('0x45')];if(!_0x1e26f8[_0x7249('0x31')][_0x7249('0x34')](_0x7249('0x35'))){_0x57cbe1[_0x7249('0x1c')]=qs[_0x7249('0x1c')](_0x1e26f8[_0x7249('0x31')]['limit']);_0x57cbe1[_0x7249('0x1b')]=qs['offset'](_0x1e26f8[_0x7249('0x31')]['offset']);}return _0x78ed64[_0x7249('0x63')](_0x57cbe1);}})[_0x7249('0x26')](function(_0x33130b){if(_0x33130b){return _0x33130b?{'count':_0x30723e,'rows':_0x33130b}:null;}})[_0x7249('0x26')](respondWithResult(_0x34f222,null))[_0x7249('0x41')](handleError(_0x34f222,null));};exports['addTeams']=function(_0x406013,_0x557828,_0x2b04e9){var _0x594acf=_0x406013[_0x7249('0x49')]['ids'];return db[_0x7249('0x64')][_0x7249('0x59')]({'where':{'id':_0x594acf},'attributes':['id'],'include':[{'model':db[_0x7249('0x5a')],'as':'Agents','attributes':['id','name','online',_0x7249('0x65'),_0x7249('0x66')],'raw':!![]}]})[_0x7249('0x26')](function(_0x5a30cf){if(_0x5a30cf){var _0x673b26=_[_0x7249('0x67')](_0x5a30cf,function(_0x33221a){var _0x22a5e1=_0x33221a[_0x7249('0x24')]({'plain':!![]});return _0x22a5e1[_0x7249('0x68')];});return db[_0x7249('0x3f')][_0x7249('0x47')]({'where':{'id':_0x406013[_0x7249('0x43')]['id']}})['then'](function(_0x1f7d5c){return db[_0x7249('0x69')][_0x7249('0x6a')](function(_0x39b629){return _0x1f7d5c[_0x7249('0x6b')](_0x594acf,{'transaction':_0x39b629})[_0x7249('0x26')](function(){return BPromise['each'](_0x673b26,function(_0xd12b2d){return db[_0x7249('0x6c')]['findOrCreate']({'where':{'UserId':_0xd12b2d['id'],'SmsQueueId':_0x406013['params']['id']},'transaction':_0x39b629});});})[_0x7249('0x26')](function(){_0x673b26[_0x7249('0x6d')](function(_0x38d891){socket['emit'](_0x7249('0x6e'),{'UserId':_0x38d891['id'],'SmsQueueId':_0x1f7d5c['id']});});});});});}})[_0x7249('0x26')](respondWithStatusCode(_0x557828,null))[_0x7249('0x41')](handleError(_0x557828,null));};exports[_0x7249('0x6f')]=function(_0x411d05,_0x10a9dc,_0x1b0c8f){return db['Team'][_0x7249('0x59')]({'where':{'id':_0x411d05[_0x7249('0x31')]['ids']},'attributes':['id'],'include':[{'model':db[_0x7249('0x5a')],'as':_0x7249('0x68'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x10a9dc,null))[_0x7249('0x26')](function(_0x5b6f4d){var _0x100028=_['map'](_0x5b6f4d,'id');var _0x1034bc=[];var _0x19bba7=[];var _0x3bf005=squel[_0x7249('0x70')]();_0x3bf005['field'](_0x7249('0x71'))[_0x7249('0x72')](_0x7249('0x73'),'tq')['join']('user_has_teams','ut',_0x7249('0x74'))[_0x7249('0x37')](_0x7249('0x75'),_0x411d05['params']['id']);for(var _0xfb520f=0x0;_0xfb520f<_0x5b6f4d[_0x7249('0x45')];_0xfb520f+=0x1){let _0x15f2b7=_0x5b6f4d[_0xfb520f];for(var _0x2e6017=0x0;_0x2e6017<_0x15f2b7[_0x7249('0x68')][_0x7249('0x45')];_0x2e6017+=0x1){let _0x23b6f1=_0x15f2b7[_0x7249('0x68')][_0x2e6017];var _0x5ec094=_0x3bf005['clone']();_0x5ec094[_0x7249('0x37')]('ut.UserId\x20=\x20?',_0x23b6f1['id']);_0x19bba7[_0x7249('0x76')](db[_0x7249('0x69')][_0x7249('0x31')](_0x5ec094[_0x7249('0x77')](),{'type':db['sequelize'][_0x7249('0x78')][_0x7249('0x79')]})[_0x7249('0x26')](function(_0x3d9735){if(_0x3d9735[_0x7249('0x45')]===0x1){return _0x23b6f1['id'];}else{var _0xeb4c18=_[_0x7249('0x7a')](_[_0x7249('0x2a')](_0x3d9735,_0x7249('0x7b')),function(_0x243f6e){return _['includes'](_0x100028,_0x243f6e);});if(_0xeb4c18){return _0x23b6f1['id'];}}}));}}return BPromise[_0x7249('0x7c')](_0x19bba7)[_0x7249('0x26')](function(_0x1d4ba4){_0x1034bc=_(_0x1034bc)[_0x7249('0x7d')](_0x1d4ba4)['compact']()[_0x7249('0x7e')]();return db[_0x7249('0x3f')][_0x7249('0x47')]({'where':{'id':_0x411d05[_0x7249('0x43')]['id']}})['then'](function(_0x161b07){return db[_0x7249('0x69')][_0x7249('0x6a')](function(_0x184382){return _0x161b07[_0x7249('0x6f')](_0x411d05['query'][_0x7249('0x7f')],{'transaction':_0x184382})['then'](function(){if(!_[_0x7249('0x80')](_0x1034bc)){return _0x161b07[_0x7249('0x81')](_0x1034bc,{'transaction':_0x184382});}})[_0x7249('0x26')](function(){_0x1034bc[_0x7249('0x6d')](function(_0x1b8e25){socket[_0x7249('0x82')]('userSmsQueue:remove',{'UserId':_0x1b8e25,'SmsQueueId':_0x161b07['id']});});});});});});})[_0x7249('0x26')](respondWithStatusCode(_0x10a9dc,null))['catch'](handleError(_0x10a9dc,null));};exports[_0x7249('0x83')]=function(_0x250a40,_0x4367ee,_0x3a3108){return db[_0x7249('0x3f')][_0x7249('0x47')]({'where':{'id':_0x250a40[_0x7249('0x43')]['id']}})['then'](handleEntityNotFound(_0x4367ee,null))[_0x7249('0x26')](function(_0x172e91){if(_0x172e91){return _0x172e91[_0x7249('0x83')](_0x250a40[_0x7249('0x49')][_0x7249('0x7f')],_['omit'](_0x250a40[_0x7249('0x49')],[_0x7249('0x7f'),'id'])||{})[_0x7249('0x84')](function(_0x597bd5){for(var _0x53411f=0x0;_0x53411f<_0x250a40['body'][_0x7249('0x7f')][_0x7249('0x45')];_0x53411f+=0x1){socket[_0x7249('0x82')]('userSmsQueue:save',{'UserId':_0x250a40[_0x7249('0x49')][_0x7249('0x7f')][_0x53411f],'SmsQueueId':_0x250a40[_0x7249('0x43')]['id']});}return _0x597bd5;});}})[_0x7249('0x26')](respondWithResult(_0x4367ee,null))['catch'](handleError(_0x4367ee,null));};exports[_0x7249('0x81')]=function(_0x29f28c,_0x341e76,_0xb388c6){return db[_0x7249('0x3f')][_0x7249('0x47')]({'where':{'id':_0x29f28c[_0x7249('0x43')]['id']}})[_0x7249('0x26')](handleEntityNotFound(_0x341e76,null))[_0x7249('0x26')](function(_0xf9094c){if(_0xf9094c){return _0xf9094c[_0x7249('0x81')](_0x29f28c[_0x7249('0x31')]['ids'])[_0x7249('0x26')](function(){if(_['isArray'](_0x29f28c[_0x7249('0x31')]['ids'])){for(var _0x4109fb=0x0;_0x4109fb<_0x29f28c[_0x7249('0x31')][_0x7249('0x7f')][_0x7249('0x45')];_0x4109fb+=0x1){socket['emit'](_0x7249('0x85'),{'UserId':Number(_0x29f28c[_0x7249('0x31')][_0x7249('0x7f')][_0x4109fb]),'SmsQueueId':Number(_0x29f28c[_0x7249('0x43')]['id'])});}}else{socket[_0x7249('0x82')](_0x7249('0x85'),{'UserId':Number(_0x29f28c[_0x7249('0x31')][_0x7249('0x7f')]),'SmsQueueId':Number(_0x29f28c[_0x7249('0x43')]['id'])});}});}})[_0x7249('0x26')](respondWithStatusCode(_0x341e76,null))['catch'](handleError(_0x341e76,null));};exports[_0x7249('0x86')]=function(_0x2d626f,_0x147a06,_0x785b01){var _0x16828f={};var _0x157e2b={};var _0x2feb04;var _0x420c35;return db[_0x7249('0x3f')][_0x7249('0x55')]({'where':{'id':_0x2d626f[_0x7249('0x43')]['id']}})[_0x7249('0x26')](handleEntityNotFound(_0x147a06,null))[_0x7249('0x26')](function(_0x313c0a){if(_0x313c0a){_0x2feb04=_0x313c0a;_0x157e2b[_0x7249('0x2f')]=_[_0x7249('0x56')](db['User'][_0x7249('0x2b')]);_0x157e2b[_0x7249('0x31')]=_[_0x7249('0x56')](_0x2d626f[_0x7249('0x31')]);_0x157e2b[_0x7249('0x39')]=_['intersection'](_0x157e2b[_0x7249('0x2f')],_0x157e2b[_0x7249('0x31')]);_0x16828f[_0x7249('0x33')]=_['intersection'](_0x157e2b[_0x7249('0x2f')],qs['fields'](_0x2d626f[_0x7249('0x31')][_0x7249('0x44')]));_0x16828f[_0x7249('0x33')]=_0x16828f['attributes']['length']?_0x16828f[_0x7249('0x33')]:_0x157e2b['model'];_0x16828f[_0x7249('0x57')]=qs[_0x7249('0x36')](_0x2d626f[_0x7249('0x31')][_0x7249('0x36')]);_0x16828f['where']=qs[_0x7249('0x39')](_[_0x7249('0x38')](_0x2d626f['query'],_0x157e2b[_0x7249('0x39')]));if(_0x2d626f['query'][_0x7249('0x3c')]){_0x16828f[_0x7249('0x37')]=_[_0x7249('0x3a')](_0x16828f['where'],{'$or':_[_0x7249('0x2a')](_0x16828f[_0x7249('0x33')],function(_0x42da54){var _0x2582a6={};_0x2582a6[_0x42da54]={'$like':'%'+_0x2d626f[_0x7249('0x31')][_0x7249('0x3c')]+'%'};return _0x2582a6;})});}_0x16828f=_[_0x7249('0x3a')]({},_0x16828f,_0x2d626f[_0x7249('0x46')]);return _0x2feb04[_0x7249('0x86')](_0x16828f);}})[_0x7249('0x26')](function(_0x4dcd6f){if(_0x4dcd6f){_0x420c35=_0x4dcd6f[_0x7249('0x45')];if(!_0x2d626f['query']['hasOwnProperty'](_0x7249('0x35'))){_0x16828f[_0x7249('0x1c')]=qs['limit'](_0x2d626f[_0x7249('0x31')]['limit']);_0x16828f[_0x7249('0x1b')]=qs[_0x7249('0x1b')](_0x2d626f[_0x7249('0x31')][_0x7249('0x1b')]);}return _0x2feb04[_0x7249('0x86')](_0x16828f);}})[_0x7249('0x26')](function(_0x1592ba){if(_0x1592ba){return _0x1592ba?{'count':_0x420c35,'rows':_0x1592ba}:null;}})[_0x7249('0x26')](respondWithResult(_0x147a06,null))[_0x7249('0x41')](handleError(_0x147a06,null));}; \ No newline at end of file +var _0x2486=['SmsQueue','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','describe','getMembers','findOne','UserSmsQueue','filter','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','forEach','emit','userSmsQueue:save','removeTeams','ids','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','SELECT','every','TeamId','includes','all','union','compact','value','addAgents','omit','removeAgents','isArray','userSmsQueue:remove','getAgents','html-pdf','fast-json-patch','moment','bluebird','util','path','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','sendStatus','end','status','count','offset','limit','set','Content-Range','json','update','then','SmsQueues','error','name','index','map'];(function(_0x103e56,_0x2506a2){var _0x2acf86=function(_0x4c4440){while(--_0x4c4440){_0x103e56['push'](_0x103e56['shift']());}};_0x2acf86(++_0x2506a2);}(_0x2486,0xe0));var _0x6248=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2486[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x6248('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6248('0x1'));var rp=require('request-promise');var moment=require(_0x6248('0x2'));var BPromise=require(_0x6248('0x3'));var Mustache=require('mustache');var util=require(_0x6248('0x4'));var path=require(_0x6248('0x5'));var sox=require('sox');var csv=require(_0x6248('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6248('0x7'));var squel=require(_0x6248('0x8'));var crypto=require('crypto');var jsforce=require(_0x6248('0x9'));var deskjs=require(_0x6248('0xa'));var toCsv=require(_0x6248('0x6'));var querystring=require(_0x6248('0xb'));var Papa=require(_0x6248('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6248('0xd'));var as=require(_0x6248('0xe'));var hardwareService=require(_0x6248('0xf'));var logger=require(_0x6248('0x10'))(_0x6248('0x11'));var utils=require(_0x6248('0x12'));var config=require('../../config/environment');var db=require(_0x6248('0x13'))['db'];config['redis']=_[_0x6248('0x14')](config[_0x6248('0x15')],{'host':_0x6248('0x16'),'port':0x18eb});var socket=require(_0x6248('0x17'))(new Redis(config['redis']));require('./smsQueue.socket')['register'](socket);function respondWithStatusCode(_0x20cb01,_0x444c5d){_0x444c5d=_0x444c5d||0xcc;return function(_0x409d71){if(_0x409d71){return _0x20cb01[_0x6248('0x18')](_0x444c5d);}return _0x20cb01['status'](_0x444c5d)[_0x6248('0x19')]();};}function respondWithResult(_0x20e256,_0x2ab95e){_0x2ab95e=_0x2ab95e||0xc8;return function(_0x25e09d){if(_0x25e09d){return _0x20e256[_0x6248('0x1a')](_0x2ab95e)['json'](_0x25e09d);}};}function respondWithFilteredResult(_0x34ee56,_0x210ae0){return function(_0x4a87db){if(_0x4a87db){var _0x3bb8cc=_0x4a87db[_0x6248('0x1b')],_0x43c000=_0x210ae0[_0x6248('0x1c')],_0x221270=_0x210ae0[_0x6248('0x1c')]+_0x210ae0[_0x6248('0x1d')],_0x31b5d2;if(_0x221270>=_0x3bb8cc){_0x221270=_0x3bb8cc;_0x31b5d2=0xc8;}else{_0x31b5d2=0xce;}_0x34ee56[_0x6248('0x1a')](_0x31b5d2);return _0x34ee56[_0x6248('0x1e')](_0x6248('0x1f'),_0x43c000+'-'+_0x221270+'/'+_0x3bb8cc)[_0x6248('0x20')](_0x4a87db);}return null;};}function patchUpdates(_0x323ac7){return function(_0x5aab14){try{jsonpatch['apply'](_0x5aab14,_0x323ac7,!![]);}catch(_0x499d0f){return BPromise['reject'](_0x499d0f);}return _0x5aab14['save']();};}function saveUpdates(_0xa2400f,_0x31a815){return function(_0x17dfd1){if(_0x17dfd1){return _0x17dfd1[_0x6248('0x21')](_0xa2400f)[_0x6248('0x22')](function(_0x1d6840){return _0x1d6840;});}return null;};}function removeEntity(_0x2b5c93,_0x2fa4a0){return function(_0x38bdf0){if(_0x38bdf0){return _0x38bdf0['destroy']()[_0x6248('0x22')](function(){var _0x572dd4=_0x38bdf0['get']({'plain':!![]});var _0x4a87f8=_0x6248('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x4a87f8,'resourceId':_0x572dd4['id']}})[_0x6248('0x22')](function(){return _0x38bdf0;});})[_0x6248('0x22')](function(){_0x2b5c93[_0x6248('0x1a')](0xcc)[_0x6248('0x19')]();});}};}function handleEntityNotFound(_0x965b1d,_0x2963b1){return function(_0x28a99e){if(!_0x28a99e){_0x965b1d[_0x6248('0x18')](0x194);}return _0x28a99e;};}function handleError(_0xc5d9fd,_0x27142e){_0x27142e=_0x27142e||0x1f4;return function(_0x329cef){logger[_0x6248('0x24')](_0x329cef['stack']);if(_0x329cef[_0x6248('0x25')]){delete _0x329cef[_0x6248('0x25')];}_0xc5d9fd[_0x6248('0x1a')](_0x27142e)['send'](_0x329cef);};}exports[_0x6248('0x26')]=function(_0x32df6e,_0xa03a94){var _0x5438c2={},_0x5af81e={},_0x4f4e16={'count':0x0,'rows':[]};var _0x1bd2a1=_[_0x6248('0x27')](db[_0x6248('0x28')][_0x6248('0x29')],function(_0x103bef){return{'name':_0x103bef[_0x6248('0x2a')],'type':_0x103bef[_0x6248('0x2b')]['key']};});_0x5af81e[_0x6248('0x2c')]=_[_0x6248('0x27')](_0x1bd2a1,_0x6248('0x25'));_0x5af81e[_0x6248('0x2d')]=_['keys'](_0x32df6e[_0x6248('0x2d')]);_0x5af81e[_0x6248('0x2e')]=_[_0x6248('0x2f')](_0x5af81e[_0x6248('0x2c')],_0x5af81e[_0x6248('0x2d')]);_0x5438c2[_0x6248('0x30')]=_[_0x6248('0x2f')](_0x5af81e[_0x6248('0x2c')],qs[_0x6248('0x31')](_0x32df6e[_0x6248('0x2d')][_0x6248('0x31')]));_0x5438c2[_0x6248('0x30')]=_0x5438c2[_0x6248('0x30')][_0x6248('0x32')]?_0x5438c2['attributes']:_0x5af81e[_0x6248('0x2c')];if(!_0x32df6e[_0x6248('0x2d')][_0x6248('0x33')](_0x6248('0x34'))){_0x5438c2[_0x6248('0x1d')]=qs[_0x6248('0x1d')](_0x32df6e[_0x6248('0x2d')]['limit']);_0x5438c2[_0x6248('0x1c')]=qs[_0x6248('0x1c')](_0x32df6e[_0x6248('0x2d')][_0x6248('0x1c')]);}_0x5438c2[_0x6248('0x35')]=qs[_0x6248('0x36')](_0x32df6e[_0x6248('0x2d')][_0x6248('0x36')]);_0x5438c2[_0x6248('0x37')]=qs[_0x6248('0x2e')](_[_0x6248('0x38')](_0x32df6e['query'],_0x5af81e[_0x6248('0x2e')]),_0x1bd2a1);if(_0x32df6e[_0x6248('0x2d')]['filter']){_0x5438c2[_0x6248('0x37')]=_[_0x6248('0x39')](_0x5438c2['where'],{'$or':_[_0x6248('0x27')](_0x1bd2a1,function(_0x44a802){if(_0x44a802[_0x6248('0x2b')]!==_0x6248('0x3a')){var _0xb6aa2e={};_0xb6aa2e[_0x44a802[_0x6248('0x25')]]={'$like':'%'+_0x32df6e['query']['filter']+'%'};return _0xb6aa2e;}})});}_0x5438c2=_['merge']({},_0x5438c2,_0x32df6e[_0x6248('0x3b')]);var _0x2c8f49={'where':_0x5438c2['where']};return db[_0x6248('0x28')]['count'](_0x2c8f49)[_0x6248('0x22')](function(_0x32fb8f){_0x4f4e16[_0x6248('0x1b')]=_0x32fb8f;if(_0x32df6e[_0x6248('0x2d')][_0x6248('0x3c')]){_0x5438c2[_0x6248('0x3d')]=[{'all':!![]}];}return db[_0x6248('0x28')][_0x6248('0x3e')](_0x5438c2);})[_0x6248('0x22')](function(_0x5e6a36){_0x4f4e16[_0x6248('0x3f')]=_0x5e6a36;return _0x4f4e16;})[_0x6248('0x22')](respondWithFilteredResult(_0xa03a94,_0x5438c2))[_0x6248('0x40')](handleError(_0xa03a94,null));};exports[_0x6248('0x41')]=function(_0x16f68b,_0x5e7772){var _0x235ba6={'raw':!![],'where':{'id':_0x16f68b[_0x6248('0x42')]['id']}},_0x529b43={};_0x529b43[_0x6248('0x2c')]=_[_0x6248('0x43')](db[_0x6248('0x28')][_0x6248('0x29')]);_0x529b43[_0x6248('0x2d')]=_[_0x6248('0x43')](_0x16f68b[_0x6248('0x2d')]);_0x529b43['filters']=_[_0x6248('0x2f')](_0x529b43[_0x6248('0x2c')],_0x529b43[_0x6248('0x2d')]);_0x235ba6[_0x6248('0x30')]=_[_0x6248('0x2f')](_0x529b43[_0x6248('0x2c')],qs[_0x6248('0x31')](_0x16f68b['query'][_0x6248('0x31')]));_0x235ba6[_0x6248('0x30')]=_0x235ba6[_0x6248('0x30')][_0x6248('0x32')]?_0x235ba6[_0x6248('0x30')]:_0x529b43[_0x6248('0x2c')];if(_0x16f68b[_0x6248('0x2d')][_0x6248('0x3c')]){_0x235ba6[_0x6248('0x3d')]=[{'all':!![]}];}_0x235ba6=_[_0x6248('0x39')]({},_0x235ba6,_0x16f68b['options']);return db[_0x6248('0x28')][_0x6248('0x44')](_0x235ba6)['then'](handleEntityNotFound(_0x5e7772,null))[_0x6248('0x22')](respondWithResult(_0x5e7772,null))['catch'](handleError(_0x5e7772,null));};exports[_0x6248('0x45')]=function(_0x476f1a,_0x30abec){return db[_0x6248('0x28')]['create'](_0x476f1a['body'],{})['then'](function(_0x487223){var _0x3b169c=_0x476f1a[_0x6248('0x46')][_0x6248('0x47')]({'plain':!![]});if(!_0x3b169c)throw new Error(_0x6248('0x48'));if(_0x3b169c[_0x6248('0x49')]===_0x6248('0x46')){var _0x26e4aa=_0x487223['get']({'plain':!![]});var _0x4c2a1a=_0x6248('0x23');return db['UserProfileSection'][_0x6248('0x44')]({'where':{'name':_0x4c2a1a,'userProfileId':_0x3b169c[_0x6248('0x4a')]},'raw':!![]})[_0x6248('0x22')](function(_0x316bcf){if(_0x316bcf&&_0x316bcf['autoAssociation']===0x0){return db[_0x6248('0x4b')][_0x6248('0x45')]({'name':_0x26e4aa[_0x6248('0x25')],'resourceId':_0x26e4aa['id'],'type':_0x316bcf[_0x6248('0x25')],'sectionId':_0x316bcf['id']},{})[_0x6248('0x22')](function(){return _0x487223;});}else{return _0x487223;}})[_0x6248('0x40')](function(_0x4ac9f2){logger[_0x6248('0x24')](_0x6248('0x4c'),_0x4ac9f2);throw _0x4ac9f2;});}return _0x487223;})[_0x6248('0x22')](respondWithResult(_0x30abec,0xc9))[_0x6248('0x40')](handleError(_0x30abec,null));};exports['update']=function(_0xbfb345,_0x232237){if(_0xbfb345[_0x6248('0x4d')]['id']){delete _0xbfb345[_0x6248('0x4d')]['id'];}return db['SmsQueue']['find']({'where':{'id':_0xbfb345[_0x6248('0x42')]['id']}})['then'](handleEntityNotFound(_0x232237,null))[_0x6248('0x22')](saveUpdates(_0xbfb345['body'],null))[_0x6248('0x22')](respondWithResult(_0x232237,null))[_0x6248('0x40')](handleError(_0x232237,null));};exports[_0x6248('0x4e')]=function(_0x107569,_0x2433df){return db['SmsQueue'][_0x6248('0x44')]({'where':{'id':_0x107569[_0x6248('0x42')]['id']}})[_0x6248('0x22')](handleEntityNotFound(_0x2433df,null))[_0x6248('0x22')](removeEntity(_0x2433df,null))[_0x6248('0x40')](handleError(_0x2433df,null));};exports['describe']=function(_0x17d695,_0xf6325d){return db[_0x6248('0x28')][_0x6248('0x4f')]()[_0x6248('0x22')](respondWithResult(_0xf6325d,null))[_0x6248('0x40')](handleError(_0xf6325d,null));};exports[_0x6248('0x50')]=function(_0x59adf6,_0x456c05,_0x441e24){var _0x32a238={'raw':!![],'where':{}},_0x25e75d={},_0x1ed247;return db[_0x6248('0x28')][_0x6248('0x51')]({'where':{'id':_0x59adf6['params']['id']}})[_0x6248('0x22')](handleEntityNotFound(_0x456c05,null))[_0x6248('0x22')](function(_0x58ff3d){if(_0x58ff3d){_0x1ed247=_0x58ff3d[_0x6248('0x47')]({'plain':!![]});_0x25e75d[_0x6248('0x2c')]=_[_0x6248('0x43')](db[_0x6248('0x52')][_0x6248('0x29')]);_0x25e75d[_0x6248('0x2d')]=_['keys'](_0x59adf6[_0x6248('0x2d')]);_0x25e75d[_0x6248('0x2e')]=_[_0x6248('0x2f')](_0x25e75d[_0x6248('0x2c')],_0x25e75d[_0x6248('0x2d')]);_0x32a238[_0x6248('0x30')]=_[_0x6248('0x2f')](_0x25e75d[_0x6248('0x2c')],qs[_0x6248('0x31')](_0x59adf6[_0x6248('0x2d')][_0x6248('0x31')]));_0x32a238['attributes']=_0x32a238[_0x6248('0x30')]['length']?_0x32a238[_0x6248('0x30')]:_0x25e75d['model'];if(!_0x59adf6['query'][_0x6248('0x33')](_0x6248('0x34'))){_0x32a238[_0x6248('0x1d')]=qs[_0x6248('0x1d')](_0x59adf6[_0x6248('0x2d')][_0x6248('0x1d')]);_0x32a238[_0x6248('0x1c')]=qs[_0x6248('0x1c')](_0x59adf6[_0x6248('0x2d')][_0x6248('0x1c')]);}_0x32a238['order']=qs[_0x6248('0x36')](_0x59adf6['query'][_0x6248('0x36')]);_0x32a238[_0x6248('0x37')]=qs['filters'](_[_0x6248('0x38')](_0x59adf6[_0x6248('0x2d')],_0x25e75d[_0x6248('0x2e')]));_0x32a238[_0x6248('0x37')]['SmsQueueId']=_0x58ff3d['id'];if(_0x59adf6[_0x6248('0x2d')][_0x6248('0x53')]){_0x32a238[_0x6248('0x37')]=_['merge'](_0x32a238[_0x6248('0x37')],{'$or':_[_0x6248('0x27')](_0x32a238[_0x6248('0x30')],function(_0x423287){var _0x56c4bb={};_0x56c4bb[_0x423287]={'$like':'%'+_0x59adf6[_0x6248('0x2d')]['filter']+'%'};return _0x56c4bb;})});}_0x32a238=_[_0x6248('0x39')]({},_0x32a238,_0x59adf6['options']);return db[_0x6248('0x52')][_0x6248('0x3e')](_0x32a238);}})[_0x6248('0x22')](function(_0x326a90){if(_0x326a90){return db[_0x6248('0x54')][_0x6248('0x55')]({'where':{'id':_['map'](_0x326a90,_0x6248('0x56')),'role':_0x6248('0x57')},'attributes':['id',_0x6248('0x25'),'smsPause',_0x6248('0x58'),_0x6248('0x59')]});}})[_0x6248('0x22')](function(_0x2b54a0){if(_0x2b54a0){return{'count':_0x2b54a0['count'],'rows':_[_0x6248('0x27')](_0x2b54a0[_0x6248('0x3f')],function(_0x10ec16){return{'membername':_0x10ec16['name'],'UserId':_0x10ec16['id'],'queue_name':_0x1ed247[_0x6248('0x25')],'SmsQueueId':_0x1ed247['id'],'interface':util[_0x6248('0x5a')](_0x6248('0x5b'),'SIP',_0x10ec16['name']),'penalty':0x0,'paused':_0x10ec16['smsPause'],'createdAt':_0x10ec16[_0x6248('0x59')],'updatedAt':_0x10ec16[_0x6248('0x58')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6248('0x22')](respondWithFilteredResult(_0x456c05,_0x32a238))[_0x6248('0x40')](handleError(_0x456c05,null));};exports[_0x6248('0x5c')]=function(_0x570c91,_0x5bf88f,_0x46ab66){var _0x55f0b0={};var _0x2b3dd8={};var _0x4f50cd;var _0x51fc6e;return db['SmsQueue'][_0x6248('0x51')]({'where':{'id':_0x570c91['params']['id']}})[_0x6248('0x22')](handleEntityNotFound(_0x5bf88f,null))[_0x6248('0x22')](function(_0x2aa237){if(_0x2aa237){_0x4f50cd=_0x2aa237;_0x2b3dd8[_0x6248('0x2c')]=_[_0x6248('0x43')](db[_0x6248('0x5d')][_0x6248('0x29')]);_0x2b3dd8[_0x6248('0x2d')]=_[_0x6248('0x43')](_0x570c91['query']);_0x2b3dd8[_0x6248('0x2e')]=_[_0x6248('0x2f')](_0x2b3dd8['model'],_0x2b3dd8[_0x6248('0x2d')]);_0x55f0b0[_0x6248('0x30')]=_[_0x6248('0x2f')](_0x2b3dd8['model'],qs[_0x6248('0x31')](_0x570c91[_0x6248('0x2d')][_0x6248('0x31')]));_0x55f0b0['attributes']=_0x55f0b0[_0x6248('0x30')][_0x6248('0x32')]?_0x55f0b0[_0x6248('0x30')]:_0x2b3dd8[_0x6248('0x2c')];_0x55f0b0[_0x6248('0x35')]=qs['sort'](_0x570c91[_0x6248('0x2d')][_0x6248('0x36')]);_0x55f0b0[_0x6248('0x37')]=qs['filters'](_[_0x6248('0x38')](_0x570c91[_0x6248('0x2d')],_0x2b3dd8['filters']));if(_0x570c91[_0x6248('0x2d')][_0x6248('0x53')]){_0x55f0b0[_0x6248('0x37')]=_[_0x6248('0x39')](_0x55f0b0[_0x6248('0x37')],{'$or':_[_0x6248('0x27')](_0x55f0b0['attributes'],function(_0x508e2e){var _0x5f410c={};_0x5f410c[_0x508e2e]={'$like':'%'+_0x570c91[_0x6248('0x2d')]['filter']+'%'};return _0x5f410c;})});}_0x55f0b0=_[_0x6248('0x39')]({},_0x55f0b0,_0x570c91[_0x6248('0x3b')]);return _0x4f50cd[_0x6248('0x5c')](_0x55f0b0);}})['then'](function(_0x20a72c){if(_0x20a72c){_0x51fc6e=_0x20a72c[_0x6248('0x32')];if(!_0x570c91[_0x6248('0x2d')]['hasOwnProperty']('nolimit')){_0x55f0b0['limit']=qs[_0x6248('0x1d')](_0x570c91[_0x6248('0x2d')][_0x6248('0x1d')]);_0x55f0b0[_0x6248('0x1c')]=qs[_0x6248('0x1c')](_0x570c91[_0x6248('0x2d')][_0x6248('0x1c')]);}return _0x4f50cd['getTeams'](_0x55f0b0);}})['then'](function(_0xf60ec0){if(_0xf60ec0){return _0xf60ec0?{'count':_0x51fc6e,'rows':_0xf60ec0}:null;}})['then'](respondWithResult(_0x5bf88f,null))['catch'](handleError(_0x5bf88f,null));};exports[_0x6248('0x5e')]=function(_0xf2317d,_0x215d35,_0x14f688){var _0x5b7b96=_0xf2317d[_0x6248('0x4d')]['ids'];return db[_0x6248('0x5d')][_0x6248('0x3e')]({'where':{'id':_0x5b7b96},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6248('0x5f'),'attributes':['id',_0x6248('0x25'),_0x6248('0x60'),_0x6248('0x61'),_0x6248('0x62')],'raw':!![]}]})[_0x6248('0x22')](function(_0xb760e){if(_0xb760e){var _0x1b5c92=_[_0x6248('0x63')](_0xb760e,function(_0x45ccec){var _0x115a92=_0x45ccec['get']({'plain':!![]});return _0x115a92['Agents'];});return db[_0x6248('0x28')]['find']({'where':{'id':_0xf2317d['params']['id']}})[_0x6248('0x22')](function(_0x371a86){return db[_0x6248('0x64')][_0x6248('0x65')](function(_0x2d3ddb){return _0x371a86['addTeams'](_0x5b7b96,{'transaction':_0x2d3ddb})['then'](function(){return BPromise[_0x6248('0x66')](_0x1b5c92,function(_0x369024){return db[_0x6248('0x52')]['findOrCreate']({'where':{'UserId':_0x369024['id'],'SmsQueueId':_0xf2317d[_0x6248('0x42')]['id']},'transaction':_0x2d3ddb});});})[_0x6248('0x22')](function(){_0x1b5c92[_0x6248('0x67')](function(_0x361086){socket[_0x6248('0x68')](_0x6248('0x69'),{'UserId':_0x361086['id'],'SmsQueueId':_0x371a86['id']});});});});});}})[_0x6248('0x22')](respondWithStatusCode(_0x215d35,null))[_0x6248('0x40')](handleError(_0x215d35,null));};exports[_0x6248('0x6a')]=function(_0x2bb68e,_0x440ed6,_0x425d52){return db[_0x6248('0x5d')][_0x6248('0x3e')]({'where':{'id':_0x2bb68e['query'][_0x6248('0x6b')]},'attributes':['id'],'include':[{'model':db[_0x6248('0x54')],'as':_0x6248('0x5f'),'attributes':['id'],'raw':!![]}]})[_0x6248('0x22')](handleEntityNotFound(_0x440ed6,null))[_0x6248('0x22')](function(_0x1bae0b){var _0x581801=_['map'](_0x1bae0b,'id');var _0x134859=[];var _0x327068=[];var _0x42a32c=squel['select']();_0x42a32c['field'](_0x6248('0x6c'))[_0x6248('0x6d')](_0x6248('0x6e'),'tq')[_0x6248('0x6f')](_0x6248('0x70'),'ut',_0x6248('0x71'))[_0x6248('0x37')](_0x6248('0x72'),_0x2bb68e[_0x6248('0x42')]['id']);for(var _0x3e6618=0x0;_0x3e6618<_0x1bae0b[_0x6248('0x32')];_0x3e6618+=0x1){let _0x1cba04=_0x1bae0b[_0x3e6618];for(var _0x65f1c9=0x0;_0x65f1c9<_0x1cba04[_0x6248('0x5f')][_0x6248('0x32')];_0x65f1c9+=0x1){let _0x1bf69e=_0x1cba04[_0x6248('0x5f')][_0x65f1c9];var _0x264ac3=_0x42a32c[_0x6248('0x73')]();_0x264ac3[_0x6248('0x37')](_0x6248('0x74'),_0x1bf69e['id']);_0x327068[_0x6248('0x75')](db[_0x6248('0x64')][_0x6248('0x2d')](_0x264ac3['toString'](),{'type':db[_0x6248('0x64')]['QueryTypes'][_0x6248('0x76')]})[_0x6248('0x22')](function(_0x2075a0){if(_0x2075a0['length']===0x1){return _0x1bf69e['id'];}else{var _0x15802b=_[_0x6248('0x77')](_[_0x6248('0x27')](_0x2075a0,_0x6248('0x78')),function(_0xd753ae){return _[_0x6248('0x79')](_0x581801,_0xd753ae);});if(_0x15802b){return _0x1bf69e['id'];}}}));}}return BPromise[_0x6248('0x7a')](_0x327068)[_0x6248('0x22')](function(_0x18d8bf){_0x134859=_(_0x134859)[_0x6248('0x7b')](_0x18d8bf)[_0x6248('0x7c')]()[_0x6248('0x7d')]();return db[_0x6248('0x28')]['find']({'where':{'id':_0x2bb68e[_0x6248('0x42')]['id']}})[_0x6248('0x22')](function(_0x5ccbc3){return db['sequelize']['transaction'](function(_0x49c7de){return _0x5ccbc3[_0x6248('0x6a')](_0x2bb68e['query'][_0x6248('0x6b')],{'transaction':_0x49c7de})[_0x6248('0x22')](function(){if(!_['isEmpty'](_0x134859)){return _0x5ccbc3['removeAgents'](_0x134859,{'transaction':_0x49c7de});}})[_0x6248('0x22')](function(){_0x134859[_0x6248('0x67')](function(_0x17bb9a){socket[_0x6248('0x68')]('userSmsQueue:remove',{'UserId':_0x17bb9a,'SmsQueueId':_0x5ccbc3['id']});});});});});});})[_0x6248('0x22')](respondWithStatusCode(_0x440ed6,null))[_0x6248('0x40')](handleError(_0x440ed6,null));};exports['addAgents']=function(_0x23b68c,_0x271f66,_0xd7e395){return db[_0x6248('0x28')][_0x6248('0x44')]({'where':{'id':_0x23b68c[_0x6248('0x42')]['id']}})[_0x6248('0x22')](handleEntityNotFound(_0x271f66,null))[_0x6248('0x22')](function(_0x3f94ed){if(_0x3f94ed){return _0x3f94ed[_0x6248('0x7e')](_0x23b68c[_0x6248('0x4d')]['ids'],_[_0x6248('0x7f')](_0x23b68c[_0x6248('0x4d')],['ids','id'])||{})['spread'](function(_0x2d1d51){for(var _0x15575b=0x0;_0x15575b<_0x23b68c['body'][_0x6248('0x6b')][_0x6248('0x32')];_0x15575b+=0x1){socket[_0x6248('0x68')](_0x6248('0x69'),{'UserId':_0x23b68c['body'][_0x6248('0x6b')][_0x15575b],'SmsQueueId':_0x23b68c[_0x6248('0x42')]['id']});}return _0x2d1d51;});}})[_0x6248('0x22')](respondWithResult(_0x271f66,null))[_0x6248('0x40')](handleError(_0x271f66,null));};exports[_0x6248('0x80')]=function(_0x54d147,_0x148b6c,_0x306174){return db['SmsQueue'][_0x6248('0x44')]({'where':{'id':_0x54d147[_0x6248('0x42')]['id']}})['then'](handleEntityNotFound(_0x148b6c,null))[_0x6248('0x22')](function(_0x3ed69c){if(_0x3ed69c){return _0x3ed69c[_0x6248('0x80')](_0x54d147[_0x6248('0x2d')][_0x6248('0x6b')])[_0x6248('0x22')](function(){if(_[_0x6248('0x81')](_0x54d147[_0x6248('0x2d')][_0x6248('0x6b')])){for(var _0x187398=0x0;_0x187398<_0x54d147[_0x6248('0x2d')][_0x6248('0x6b')][_0x6248('0x32')];_0x187398+=0x1){socket[_0x6248('0x68')]('userSmsQueue:remove',{'UserId':Number(_0x54d147[_0x6248('0x2d')][_0x6248('0x6b')][_0x187398]),'SmsQueueId':Number(_0x54d147['params']['id'])});}}else{socket[_0x6248('0x68')](_0x6248('0x82'),{'UserId':Number(_0x54d147[_0x6248('0x2d')][_0x6248('0x6b')]),'SmsQueueId':Number(_0x54d147[_0x6248('0x42')]['id'])});}});}})[_0x6248('0x22')](respondWithStatusCode(_0x148b6c,null))[_0x6248('0x40')](handleError(_0x148b6c,null));};exports[_0x6248('0x83')]=function(_0x2fd952,_0x1f41e2,_0x55cec4){var _0x430649={};var _0x2012e1={};var _0x110fac;var _0x3cb4da;return db[_0x6248('0x28')][_0x6248('0x51')]({'where':{'id':_0x2fd952[_0x6248('0x42')]['id']}})[_0x6248('0x22')](handleEntityNotFound(_0x1f41e2,null))['then'](function(_0x16096d){if(_0x16096d){_0x110fac=_0x16096d;_0x2012e1[_0x6248('0x2c')]=_[_0x6248('0x43')](db[_0x6248('0x54')][_0x6248('0x29')]);_0x2012e1[_0x6248('0x2d')]=_[_0x6248('0x43')](_0x2fd952[_0x6248('0x2d')]);_0x2012e1[_0x6248('0x2e')]=_['intersection'](_0x2012e1[_0x6248('0x2c')],_0x2012e1[_0x6248('0x2d')]);_0x430649[_0x6248('0x30')]=_[_0x6248('0x2f')](_0x2012e1['model'],qs[_0x6248('0x31')](_0x2fd952[_0x6248('0x2d')]['fields']));_0x430649[_0x6248('0x30')]=_0x430649[_0x6248('0x30')]['length']?_0x430649[_0x6248('0x30')]:_0x2012e1['model'];_0x430649[_0x6248('0x35')]=qs['sort'](_0x2fd952[_0x6248('0x2d')][_0x6248('0x36')]);_0x430649[_0x6248('0x37')]=qs[_0x6248('0x2e')](_['pick'](_0x2fd952[_0x6248('0x2d')],_0x2012e1['filters']));if(_0x2fd952[_0x6248('0x2d')][_0x6248('0x53')]){_0x430649[_0x6248('0x37')]=_[_0x6248('0x39')](_0x430649[_0x6248('0x37')],{'$or':_[_0x6248('0x27')](_0x430649[_0x6248('0x30')],function(_0x53814a){var _0x443337={};_0x443337[_0x53814a]={'$like':'%'+_0x2fd952[_0x6248('0x2d')][_0x6248('0x53')]+'%'};return _0x443337;})});}_0x430649=_[_0x6248('0x39')]({},_0x430649,_0x2fd952[_0x6248('0x3b')]);return _0x110fac[_0x6248('0x83')](_0x430649);}})['then'](function(_0x5323eb){if(_0x5323eb){_0x3cb4da=_0x5323eb[_0x6248('0x32')];if(!_0x2fd952['query'][_0x6248('0x33')](_0x6248('0x34'))){_0x430649['limit']=qs[_0x6248('0x1d')](_0x2fd952['query'][_0x6248('0x1d')]);_0x430649[_0x6248('0x1c')]=qs['offset'](_0x2fd952['query'][_0x6248('0x1c')]);}return _0x110fac[_0x6248('0x83')](_0x430649);}})['then'](function(_0x3c8cb6){if(_0x3c8cb6){return _0x3c8cb6?{'count':_0x3cb4da,'rows':_0x3c8cb6}:null;}})[_0x6248('0x22')](respondWithResult(_0x1f41e2,null))[_0x6248('0x40')](handleError(_0x1f41e2,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 2a6ac88..da29ade 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 _0x0f49=['hasOwnProperty','hook','../../mysqldb','SmsQueue','save','update','remove','emit'];(function(_0x1034ee,_0x12998c){var _0x2922af=function(_0x13715a){while(--_0x13715a){_0x1034ee['push'](_0x1034ee['shift']());}};_0x2922af(++_0x12998c);}(_0x0f49,0xb2));var _0x90f4=function(_0x112e2a,_0x364486){_0x112e2a=_0x112e2a-0x0;var _0x4f8af9=_0x0f49[_0x112e2a];return _0x4f8af9;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x90f4('0x0'))['db'][_0x90f4('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x90f4('0x2'),'afterUpdate':_0x90f4('0x3'),'afterDestroy':_0x90f4('0x4')};function emitEvent(_0x357112){return function(_0xc45c9f,_0x26930c,_0x458a5d){SmsQueueEvents[_0x90f4('0x5')](_0x357112+':'+_0xc45c9f['id'],_0xc45c9f);SmsQueueEvents[_0x90f4('0x5')](_0x357112,_0xc45c9f);_0x458a5d(null);};}for(var e in events){if(events[_0x90f4('0x6')](e)){var event=events[e];SmsQueue[_0x90f4('0x7')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0xdf68=['remove','emit','exports','events','../../mysqldb','SmsQueue','setMaxListeners','save','update'];(function(_0x10afad,_0x30da9d){var _0x588d7e=function(_0x25e897){while(--_0x25e897){_0x10afad['push'](_0x10afad['shift']());}};_0x588d7e(++_0x30da9d);}(_0xdf68,0x1ce));var _0x8df6=function(_0x1b8b95,_0x3ea343){_0x1b8b95=_0x1b8b95-0x0;var _0x3657ae=_0xdf68[_0x1b8b95];return _0x3657ae;};'use strict';var EventEmitter=require(_0x8df6('0x0'));var SmsQueue=require(_0x8df6('0x1'))['db'][_0x8df6('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x8df6('0x3')](0x0);var events={'afterCreate':_0x8df6('0x4'),'afterUpdate':_0x8df6('0x5'),'afterDestroy':_0x8df6('0x6')};function emitEvent(_0x42768e){return function(_0x532d6c,_0x4f07f7,_0x2b578a){SmsQueueEvents['emit'](_0x42768e+':'+_0x532d6c['id'],_0x532d6c);SmsQueueEvents[_0x8df6('0x7')](_0x42768e,_0x532d6c);_0x2b578a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x8df6('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 d7a14ef..8b580a9 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 _0xc09f=['lodash','util','api','moment','bluebird','path','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues'];(function(_0x5541b7,_0x2cdaaf){var _0x302b66=function(_0x3e7e33){while(--_0x3e7e33){_0x5541b7['push'](_0x5541b7['shift']());}};_0x302b66(++_0x2cdaaf);}(_0xc09f,0xe4));var _0xfc09=function(_0x430095,_0x122722){_0x430095=_0x430095-0x0;var _0x115f8a=_0xc09f[_0x430095];return _0x115f8a;};'use strict';var _=require(_0xfc09('0x0'));var util=require(_0xfc09('0x1'));var logger=require('../../config/logger')(_0xfc09('0x2'));var moment=require(_0xfc09('0x3'));var BPromise=require(_0xfc09('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfc09('0x5'));var rimraf=require('rimraf');var config=require(_0xfc09('0x6'));var attributes=require(_0xfc09('0x7'));module[_0xfc09('0x8')]=function(_0x391a64,_0x4c1fe1){return _0x391a64[_0xfc09('0x9')](_0xfc09('0xa'),attributes,{'tableName':_0xfc09('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1022=['define','SmsQueue','sms_queues','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','exports'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x1022,0x1c6));var _0x2102=function(_0x52a0e4,_0x9c292f){_0x52a0e4=_0x52a0e4-0x0;var _0x28b930=_0x1022[_0x52a0e4];return _0x28b930;};'use strict';var _=require(_0x2102('0x0'));var util=require(_0x2102('0x1'));var logger=require(_0x2102('0x2'))(_0x2102('0x3'));var moment=require(_0x2102('0x4'));var BPromise=require(_0x2102('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2102('0x6'));var attributes=require('./smsQueue.attributes');module[_0x2102('0x7')]=function(_0x50b1b7,_0x3208e7){return _0x50b1b7[_0x2102('0x8')](_0x2102('0x9'),attributes,{'tableName':_0x2102('0xa'),'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 fc97766..01d8537 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 _0xde89=['map','model','attributes','GetSmsQueue','ShowSmsQueue','SmsQueue','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','raw','where','limit','include'];(function(_0x5485e2,_0x7cc95e){var _0x5153ef=function(_0x26b77a){while(--_0x26b77a){_0x5485e2['push'](_0x5485e2['shift']());}};_0x5153ef(++_0x7cc95e);}(_0xde89,0x10f));var _0x9de8=function(_0x9cfe28,_0x1a335c){_0x9cfe28=_0x9cfe28-0x0;var _0x54a1d0=_0xde89[_0x9cfe28];return _0x54a1d0;};'use strict';var _=require(_0x9de8('0x0'));var util=require(_0x9de8('0x1'));var moment=require(_0x9de8('0x2'));var BPromise=require(_0x9de8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9de8('0x4'));var db=require(_0x9de8('0x5'))['db'];var utils=require(_0x9de8('0x6'));var logger=require(_0x9de8('0x7'))('rpc');var config=require(_0x9de8('0x8'));var jayson=require(_0x9de8('0x9'));var client=jayson[_0x9de8('0xa')][_0x9de8('0xb')]({'port':0x232a});config[_0x9de8('0xc')]=_[_0x9de8('0xd')](config[_0x9de8('0xc')],{'host':_0x9de8('0xe'),'port':0x18eb});var socket=require(_0x9de8('0xf'))(new Redis(config[_0x9de8('0xc')]));require(_0x9de8('0x10'))[_0x9de8('0x11')](socket);function respondWithRpcPromise(_0xe7336f,_0x4ea94a,_0x68754e){return new BPromise(function(_0x445c36,_0x2e44df){return client[_0x9de8('0x12')](_0xe7336f,_0x68754e)[_0x9de8('0x13')](function(_0x482a7a){logger[_0x9de8('0x14')](_0x9de8('0x15'),_0x4ea94a,_0x9de8('0x16'));logger[_0x9de8('0x17')](_0x9de8('0x18'),_0x4ea94a,_0x9de8('0x16'),JSON[_0x9de8('0x19')](_0x482a7a));if(_0x482a7a[_0x9de8('0x1a')]){if(_0x482a7a[_0x9de8('0x1a')][_0x9de8('0x1b')]===0x1f4){logger[_0x9de8('0x1a')]('SmsQueue,\x20%s,\x20%s',_0x4ea94a,_0x482a7a['error'][_0x9de8('0x1c')]);return _0x2e44df(_0x482a7a[_0x9de8('0x1a')][_0x9de8('0x1c')]);}logger[_0x9de8('0x1a')](_0x9de8('0x15'),_0x4ea94a,_0x482a7a[_0x9de8('0x1a')][_0x9de8('0x1c')]);return _0x445c36(_0x482a7a[_0x9de8('0x1a')][_0x9de8('0x1c')]);}else{logger['info'](_0x9de8('0x15'),_0x4ea94a,'request\x20sent');_0x445c36(_0x482a7a[_0x9de8('0x1d')]['message']);}})[_0x9de8('0x1e')](function(_0x499ecb){logger['error'](_0x9de8('0x15'),_0x4ea94a,_0x499ecb);_0x2e44df(_0x499ecb);});});}exports['GetSmsQueue']=function(_0x38b90f){var _0x35ddcf=this;return new Promise(function(_0x3c304d,_0x4c03bf){return db['SmsQueue'][_0x9de8('0x1f')]({'raw':_0x38b90f['options']?_0x38b90f[_0x9de8('0x20')][_0x9de8('0x21')]===undefined?!![]:![]:!![],'where':_0x38b90f[_0x9de8('0x20')]?_0x38b90f[_0x9de8('0x20')][_0x9de8('0x22')]||null:null,'attributes':_0x38b90f['options']?_0x38b90f['options']['attributes']||null:null,'limit':_0x38b90f['options']?_0x38b90f['options'][_0x9de8('0x23')]||null:null,'include':_0x38b90f['options']?_0x38b90f[_0x9de8('0x20')][_0x9de8('0x24')]?_[_0x9de8('0x25')](_0x38b90f[_0x9de8('0x20')][_0x9de8('0x24')],function(_0x25dd9e){return{'model':db[_0x25dd9e[_0x9de8('0x26')]],'as':_0x25dd9e['as'],'attributes':_0x25dd9e[_0x9de8('0x27')],'include':_0x25dd9e[_0x9de8('0x24')]?_[_0x9de8('0x25')](_0x25dd9e['include'],function(_0x566e84){return{'model':db[_0x566e84[_0x9de8('0x26')]],'as':_0x566e84['as'],'attributes':_0x566e84['attributes'],'include':_0x566e84[_0x9de8('0x24')]?_[_0x9de8('0x25')](_0x566e84['include'],function(_0x294663){return{'model':db[_0x294663[_0x9de8('0x26')]],'as':_0x294663['as'],'attributes':_0x294663['attributes']};}):[]};}):[]};}):[]:[]})[_0x9de8('0x13')](function(_0x536015){logger[_0x9de8('0x14')](_0x9de8('0x28'),_0x38b90f);logger[_0x9de8('0x17')](_0x9de8('0x28'),_0x38b90f,JSON[_0x9de8('0x19')](_0x536015));_0x3c304d(_0x536015);})[_0x9de8('0x1e')](function(_0x29f161){logger[_0x9de8('0x1a')]('GetSmsQueue',_0x29f161[_0x9de8('0x1c')],_0x38b90f);_0x4c03bf(_0x35ddcf[_0x9de8('0x1a')](0x1f4,_0x29f161[_0x9de8('0x1c')]));});});};exports[_0x9de8('0x29')]=function(_0x48d776){var _0x4fdcf4=this;return new Promise(function(_0x362a37,_0x43a9cb){return db[_0x9de8('0x2a')][_0x9de8('0x2b')]({'raw':_0x48d776[_0x9de8('0x20')]?_0x48d776[_0x9de8('0x20')][_0x9de8('0x21')]===undefined?!![]:![]:!![],'where':_0x48d776['options']?_0x48d776[_0x9de8('0x20')][_0x9de8('0x22')]||null:null,'attributes':_0x48d776[_0x9de8('0x20')]?_0x48d776[_0x9de8('0x20')][_0x9de8('0x27')]||null:null,'include':_0x48d776[_0x9de8('0x20')]?_0x48d776[_0x9de8('0x20')][_0x9de8('0x24')]?_[_0x9de8('0x25')](_0x48d776[_0x9de8('0x20')][_0x9de8('0x24')],function(_0x56bba2){return{'model':db[_0x56bba2[_0x9de8('0x26')]],'as':_0x56bba2['as'],'attributes':_0x56bba2[_0x9de8('0x27')],'include':_0x56bba2[_0x9de8('0x24')]?_[_0x9de8('0x25')](_0x56bba2[_0x9de8('0x24')],function(_0x87499){return{'model':db[_0x87499[_0x9de8('0x26')]],'as':_0x87499['as'],'attributes':_0x87499[_0x9de8('0x27')],'include':_0x87499['include']?_[_0x9de8('0x25')](_0x87499[_0x9de8('0x24')],function(_0x5895a5){return{'model':db[_0x5895a5['model']],'as':_0x5895a5['as'],'attributes':_0x5895a5[_0x9de8('0x27')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d3338){logger[_0x9de8('0x14')]('ShowSmsQueue',_0x48d776);logger[_0x9de8('0x17')](_0x9de8('0x29'),_0x48d776,JSON[_0x9de8('0x19')](_0x2d3338));_0x362a37(_0x2d3338);})[_0x9de8('0x1e')](function(_0x5e6bda){logger[_0x9de8('0x1a')](_0x9de8('0x29'),_0x5e6bda['message'],_0x48d776);_0x43a9cb(_0x4fdcf4[_0x9de8('0x1a')](0x1f4,_0x5e6bda[_0x9de8('0x1c')]));});});}; \ No newline at end of file +var _0xfd3d=['model','map','include','ShowSmsQueue','where','then','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsQueue.socket','register','info','SmsQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','catch','GetSmsQueue','SmsQueue','findAll','options','attributes','limit'];(function(_0x4b20be,_0x5a21e5){var _0x25d937=function(_0x5411a1){while(--_0x5411a1){_0x4b20be['push'](_0x4b20be['shift']());}};_0x25d937(++_0x5a21e5);}(_0xfd3d,0x1e7));var _0xdfd3=function(_0x5ca43a,_0x592b2b){_0x5ca43a=_0x5ca43a-0x0;var _0x138b04=_0xfd3d[_0x5ca43a];return _0x138b04;};'use strict';var _=require('lodash');var util=require(_0xdfd3('0x0'));var moment=require(_0xdfd3('0x1'));var BPromise=require(_0xdfd3('0x2'));var rs=require(_0xdfd3('0x3'));var fs=require('fs');var Redis=require(_0xdfd3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdfd3('0x5'));var logger=require(_0xdfd3('0x6'))('rpc');var config=require(_0xdfd3('0x7'));var jayson=require(_0xdfd3('0x8'));var client=jayson[_0xdfd3('0x9')][_0xdfd3('0xa')]({'port':0x232a});config[_0xdfd3('0xb')]=_[_0xdfd3('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xdfd3('0xd'))(new Redis(config[_0xdfd3('0xb')]));require(_0xdfd3('0xe'))[_0xdfd3('0xf')](socket);function respondWithRpcPromise(_0x52ba70,_0xbfbdc7,_0x2f6d76){return new BPromise(function(_0xa3d7ea,_0x1a47a2){return client['request'](_0x52ba70,_0x2f6d76)['then'](function(_0x23f593){logger[_0xdfd3('0x10')](_0xdfd3('0x11'),_0xbfbdc7,'request\x20sent');logger[_0xdfd3('0x12')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0xbfbdc7,_0xdfd3('0x13'),JSON[_0xdfd3('0x14')](_0x23f593));if(_0x23f593['error']){if(_0x23f593['error'][_0xdfd3('0x15')]===0x1f4){logger[_0xdfd3('0x16')](_0xdfd3('0x11'),_0xbfbdc7,_0x23f593[_0xdfd3('0x16')]['message']);return _0x1a47a2(_0x23f593[_0xdfd3('0x16')][_0xdfd3('0x17')]);}logger['error'](_0xdfd3('0x11'),_0xbfbdc7,_0x23f593[_0xdfd3('0x16')]['message']);return _0xa3d7ea(_0x23f593[_0xdfd3('0x16')][_0xdfd3('0x17')]);}else{logger[_0xdfd3('0x10')](_0xdfd3('0x11'),_0xbfbdc7,_0xdfd3('0x13'));_0xa3d7ea(_0x23f593['result']['message']);}})[_0xdfd3('0x18')](function(_0x5139c0){logger['error'](_0xdfd3('0x11'),_0xbfbdc7,_0x5139c0);_0x1a47a2(_0x5139c0);});});}exports[_0xdfd3('0x19')]=function(_0x2e8c75){var _0x1f10e9=this;return new Promise(function(_0x460863,_0x12b145){return db[_0xdfd3('0x1a')][_0xdfd3('0x1b')]({'raw':_0x2e8c75[_0xdfd3('0x1c')]?_0x2e8c75[_0xdfd3('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x2e8c75[_0xdfd3('0x1c')]?_0x2e8c75[_0xdfd3('0x1c')]['where']||null:null,'attributes':_0x2e8c75[_0xdfd3('0x1c')]?_0x2e8c75[_0xdfd3('0x1c')][_0xdfd3('0x1d')]||null:null,'limit':_0x2e8c75[_0xdfd3('0x1c')]?_0x2e8c75[_0xdfd3('0x1c')][_0xdfd3('0x1e')]||null:null,'include':_0x2e8c75['options']?_0x2e8c75[_0xdfd3('0x1c')]['include']?_['map'](_0x2e8c75[_0xdfd3('0x1c')]['include'],function(_0x530869){return{'model':db[_0x530869[_0xdfd3('0x1f')]],'as':_0x530869['as'],'attributes':_0x530869[_0xdfd3('0x1d')],'include':_0x530869['include']?_[_0xdfd3('0x20')](_0x530869[_0xdfd3('0x21')],function(_0xd2b950){return{'model':db[_0xd2b950['model']],'as':_0xd2b950['as'],'attributes':_0xd2b950[_0xdfd3('0x1d')],'include':_0xd2b950[_0xdfd3('0x21')]?_[_0xdfd3('0x20')](_0xd2b950[_0xdfd3('0x21')],function(_0x4645f7){return{'model':db[_0x4645f7[_0xdfd3('0x1f')]],'as':_0x4645f7['as'],'attributes':_0x4645f7[_0xdfd3('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x920af0){logger[_0xdfd3('0x10')](_0xdfd3('0x19'),_0x2e8c75);logger[_0xdfd3('0x12')](_0xdfd3('0x19'),_0x2e8c75,JSON['stringify'](_0x920af0));_0x460863(_0x920af0);})[_0xdfd3('0x18')](function(_0x50202d){logger['error']('GetSmsQueue',_0x50202d[_0xdfd3('0x17')],_0x2e8c75);_0x12b145(_0x1f10e9['error'](0x1f4,_0x50202d[_0xdfd3('0x17')]));});});};exports[_0xdfd3('0x22')]=function(_0x13d2d7){var _0x3d995a=this;return new Promise(function(_0x210225,_0x321906){return db[_0xdfd3('0x1a')]['find']({'raw':_0x13d2d7[_0xdfd3('0x1c')]?_0x13d2d7[_0xdfd3('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x13d2d7['options']?_0x13d2d7[_0xdfd3('0x1c')][_0xdfd3('0x23')]||null:null,'attributes':_0x13d2d7[_0xdfd3('0x1c')]?_0x13d2d7[_0xdfd3('0x1c')]['attributes']||null:null,'include':_0x13d2d7[_0xdfd3('0x1c')]?_0x13d2d7['options'][_0xdfd3('0x21')]?_[_0xdfd3('0x20')](_0x13d2d7[_0xdfd3('0x1c')][_0xdfd3('0x21')],function(_0x1c7334){return{'model':db[_0x1c7334[_0xdfd3('0x1f')]],'as':_0x1c7334['as'],'attributes':_0x1c7334[_0xdfd3('0x1d')],'include':_0x1c7334[_0xdfd3('0x21')]?_[_0xdfd3('0x20')](_0x1c7334[_0xdfd3('0x21')],function(_0x561ea8){return{'model':db[_0x561ea8[_0xdfd3('0x1f')]],'as':_0x561ea8['as'],'attributes':_0x561ea8[_0xdfd3('0x1d')],'include':_0x561ea8['include']?_[_0xdfd3('0x20')](_0x561ea8[_0xdfd3('0x21')],function(_0x3fcc61){return{'model':db[_0x3fcc61['model']],'as':_0x3fcc61['as'],'attributes':_0x3fcc61[_0xdfd3('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xdfd3('0x24')](function(_0x2cac4c){logger['info'](_0xdfd3('0x22'),_0x13d2d7);logger[_0xdfd3('0x12')]('ShowSmsQueue',_0x13d2d7,JSON[_0xdfd3('0x14')](_0x2cac4c));_0x210225(_0x2cac4c);})[_0xdfd3('0x18')](function(_0x220a5f){logger[_0xdfd3('0x16')](_0xdfd3('0x22'),_0x220a5f[_0xdfd3('0x17')],_0x13d2d7);_0x321906(_0x3d995a['error'](0x1f4,_0x220a5f[_0xdfd3('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 7b33fe4..794f246 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 _0x9128=['./smsQueue.events','save','remove','emit','register','smsQueue:'];(function(_0x2e4a0f,_0x3a9bb6){var _0x25a3cd=function(_0x1c614f){while(--_0x1c614f){_0x2e4a0f['push'](_0x2e4a0f['shift']());}};_0x25a3cd(++_0x3a9bb6);}(_0x9128,0x11a));var _0x8912=function(_0x53417c,_0x126dee){_0x53417c=_0x53417c-0x0;var _0x49407d=_0x9128[_0x53417c];return _0x49407d;};'use strict';var SmsQueueEvents=require(_0x8912('0x0'));var events=[_0x8912('0x1'),_0x8912('0x2'),'update'];function createListener(_0x578acf,_0x82fad7){return function(_0x2a41ef){_0x82fad7[_0x8912('0x3')](_0x578acf,_0x2a41ef);};}function removeListener(_0x5d7700,_0x394a65){return function(){SmsQueueEvents['removeListener'](_0x5d7700,_0x394a65);};}exports[_0x8912('0x4')]=function(_0x5f5c67){for(var _0x487074=0x0,_0x4a3bb0=events['length'];_0x487074<_0x4a3bb0;_0x487074++){var _0x66f0b=events[_0x487074];var _0x7d2d19=createListener(_0x8912('0x5')+_0x66f0b,_0x5f5c67);SmsQueueEvents['on'](_0x66f0b,_0x7d2d19);}}; \ No newline at end of file +var _0xe491=['register','length','./smsQueue.events','update','emit','removeListener'];(function(_0x3f9acb,_0x80a9a2){var _0x5805ba=function(_0x57b12b){while(--_0x57b12b){_0x3f9acb['push'](_0x3f9acb['shift']());}};_0x5805ba(++_0x80a9a2);}(_0xe491,0xf8));var _0x1e49=function(_0x5d8d33,_0xe499a5){_0x5d8d33=_0x5d8d33-0x0;var _0x27499e=_0xe491[_0x5d8d33];return _0x27499e;};'use strict';var SmsQueueEvents=require(_0x1e49('0x0'));var events=['save','remove',_0x1e49('0x1')];function createListener(_0x450059,_0x444784){return function(_0x38b792){_0x444784[_0x1e49('0x2')](_0x450059,_0x38b792);};}function removeListener(_0x1ee4dd,_0x410e8a){return function(){SmsQueueEvents[_0x1e49('0x3')](_0x1ee4dd,_0x410e8a);};}exports[_0x1e49('0x4')]=function(_0x4d4c7c){for(var _0x391cf3=0x0,_0x5c32a4=events[_0x1e49('0x5')];_0x391cf3<_0x5c32a4;_0x391cf3++){var _0x42ef77=events[_0x391cf3];var _0x2f8e77=createListener('smsQueue:'+_0x42ef77,_0x4d4c7c);SmsQueueEvents['on'](_0x42ef77,_0x2f8e77);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index d170810..9a56653 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 _0xa9e0=['put','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','/describe','/:id','post','create'];(function(_0x43d16c,_0x2b5447){var _0x208cce=function(_0x371720){while(--_0x371720){_0x43d16c['push'](_0x43d16c['shift']());}};_0x208cce(++_0x2b5447);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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 _0x67fe=['isAuthenticated','/describe','get','/:id','show','post','create','put','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./smsQueueReport.controller'];(function(_0x4e5e92,_0x3628bc){var _0x8f1647=function(_0x5f44bd){while(--_0x5f44bd){_0x4e5e92['push'](_0x4e5e92['shift']());}};_0x8f1647(++_0x3628bc);}(_0x67fe,0x189));var _0xe67f=function(_0x5bfd3b,_0x1633f2){_0x5bfd3b=_0x5bfd3b-0x0;var _0x403f95=_0x67fe[_0x5bfd3b];return _0x403f95;};'use strict';var multer=require(_0xe67f('0x0'));var util=require(_0xe67f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe67f('0x2'));var router=express[_0xe67f('0x3')]();var auth=require(_0xe67f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe67f('0x5'));var controller=require(_0xe67f('0x6'));router['get']('/',auth[_0xe67f('0x7')](),controller['index']);router['get'](_0xe67f('0x8'),auth[_0xe67f('0x7')](),controller['describe']);router[_0xe67f('0x9')](_0xe67f('0xa'),auth[_0xe67f('0x7')](),controller[_0xe67f('0xb')]);router[_0xe67f('0xc')]('/',auth[_0xe67f('0x7')](),controller[_0xe67f('0xd')]);router[_0xe67f('0xe')](_0xe67f('0xa'),auth[_0xe67f('0x7')](),controller['update']);router['delete'](_0xe67f('0xa'),auth[_0xe67f('0x7')](),controller['destroy']);module[_0xe67f('0xf')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index ebd5a75..71c4e6f 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 _0x8819=['sequelize','exports','STRING','DATE'];(function(_0x8f633e,_0x54ea00){var _0x4d2778=function(_0x45d315){while(--_0x45d315){_0x8f633e['push'](_0x8f633e['shift']());}};_0x4d2778(++_0x54ea00);}(_0x8819,0x134));var _0x9881=function(_0x48772c,_0xcd4549){_0x48772c=_0x48772c-0x0;var _0x49be0f=_0x8819[_0x48772c];return _0x49be0f;};'use strict';var moment=require('moment');var Sequelize=require(_0x9881('0x0'));module[_0x9881('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x9881('0x2')]},'joinAt':{'type':Sequelize[_0x9881('0x3')]},'leaveAt':{'type':Sequelize[_0x9881('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x9881('0x2')]}}; \ No newline at end of file +var _0x46fb=['DATE','moment','STRING'];(function(_0x2ac772,_0x579bf6){var _0x573cc9=function(_0x15497f){while(--_0x15497f){_0x2ac772['push'](_0x2ac772['shift']());}};_0x573cc9(++_0x579bf6);}(_0x46fb,0xf1));var _0xb46f=function(_0x50a6b7,_0x3d82b8){_0x50a6b7=_0x50a6b7-0x0;var _0x192db5=_0x46fb[_0x50a6b7];return _0x192db5;};'use strict';var moment=require(_0xb46f('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xb46f('0x1')]},'joinAt':{'type':Sequelize[_0xb46f('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xb46f('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index c1a90ca..7c6ed78 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 _0x9957=['eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','pick','filter','where','merge','VIRTUAL','options','SmsQueueReport','count','includeAll','include','findAll','rows','show','find','catch','create','body','update','params','describe','html-pdf'];(function(_0x1ed2e2,_0x13e06c){var _0x1c089e=function(_0x347556){while(--_0x347556){_0x1ed2e2['push'](_0x1ed2e2['shift']());}};_0x1c089e(++_0x13e06c);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];function respondWithStatusCode(_0x2cb37a,_0x19a27e){_0x19a27e=_0x19a27e||0xcc;return function(_0x385f00){if(_0x385f00){return _0x2cb37a[_0x7995('0x1a')](_0x19a27e);}return _0x2cb37a[_0x7995('0x1b')](_0x19a27e)[_0x7995('0x1c')]();};}function respondWithResult(_0x4cc004,_0x58f5ad){_0x58f5ad=_0x58f5ad||0xc8;return function(_0x2b4e94){if(_0x2b4e94){return _0x4cc004[_0x7995('0x1b')](_0x58f5ad)[_0x7995('0x1d')](_0x2b4e94);}};}function respondWithFilteredResult(_0x321ae8,_0x3f1d3e){return function(_0x1a5310){if(_0x1a5310){var _0x2202ce=_0x1a5310['count'],_0x41cbf0=_0x3f1d3e[_0x7995('0x1e')],_0x5377e5=_0x3f1d3e[_0x7995('0x1e')]+_0x3f1d3e[_0x7995('0x1f')],_0x2eeacc;if(_0x5377e5>=_0x2202ce){_0x5377e5=_0x2202ce;_0x2eeacc=0xc8;}else{_0x2eeacc=0xce;}_0x321ae8[_0x7995('0x1b')](_0x2eeacc);return _0x321ae8[_0x7995('0x20')](_0x7995('0x21'),_0x41cbf0+'-'+_0x5377e5+'/'+_0x2202ce)['json'](_0x1a5310);}return null;};}function patchUpdates(_0x54c9ae){return function(_0x2536c8){try{jsonpatch['apply'](_0x2536c8,_0x54c9ae,!![]);}catch(_0x555f74){return BPromise[_0x7995('0x22')](_0x555f74);}return _0x2536c8[_0x7995('0x23')]();};}function saveUpdates(_0x4cbe10,_0x3a9b54){return function(_0x51f276){if(_0x51f276){return _0x51f276['update'](_0x4cbe10)[_0x7995('0x24')](function(_0x327b1f){return _0x327b1f;});}return null;};}function removeEntity(_0x350fd9,_0x1a8568){return function(_0x460924){if(_0x460924){return _0x460924[_0x7995('0x25')]()['then'](function(){_0x350fd9[_0x7995('0x1b')](0xcc)[_0x7995('0x1c')]();});}};}function handleEntityNotFound(_0x204507,_0x285437){return function(_0x563799){if(!_0x563799){_0x204507[_0x7995('0x1a')](0x194);}return _0x563799;};}function handleError(_0x475351,_0x472195){_0x472195=_0x472195||0x1f4;return function(_0x59405a){logger[_0x7995('0x26')](_0x59405a[_0x7995('0x27')]);if(_0x59405a[_0x7995('0x28')]){delete _0x59405a[_0x7995('0x28')];}_0x475351[_0x7995('0x1b')](_0x472195)[_0x7995('0x29')](_0x59405a);};}exports['index']=function(_0x47625f,_0x5911c3){var _0x229742={},_0x49bc7e={},_0xf16cc2={'count':0x0,'rows':[]};var _0x132a42=_[_0x7995('0x2a')](db['SmsQueueReport'][_0x7995('0x2b')],function(_0x514445){return{'name':_0x514445[_0x7995('0x2c')],'type':_0x514445[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x49bc7e['model']=_['map'](_0x132a42,'name');_0x49bc7e[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x47625f[_0x7995('0x2f')]);_0x49bc7e[_0x7995('0x31')]=_[_0x7995('0x32')](_0x49bc7e[_0x7995('0x33')],_0x49bc7e['query']);_0x229742['attributes']=_[_0x7995('0x32')](_0x49bc7e['model'],qs[_0x7995('0x34')](_0x47625f[_0x7995('0x2f')][_0x7995('0x34')]));_0x229742[_0x7995('0x35')]=_0x229742[_0x7995('0x35')]['length']?_0x229742[_0x7995('0x35')]:_0x49bc7e[_0x7995('0x33')];if(!_0x47625f['query']['hasOwnProperty']('nolimit')){_0x229742[_0x7995('0x1f')]=qs[_0x7995('0x1f')](_0x47625f['query'][_0x7995('0x1f')]);_0x229742['offset']=qs[_0x7995('0x1e')](_0x47625f[_0x7995('0x2f')][_0x7995('0x1e')]);}_0x229742['order']=qs['sort'](_0x47625f[_0x7995('0x2f')]['sort']);_0x229742['where']=qs[_0x7995('0x31')](_[_0x7995('0x36')](_0x47625f['query'],_0x49bc7e[_0x7995('0x31')]),_0x132a42);if(_0x47625f[_0x7995('0x2f')][_0x7995('0x37')]){_0x229742[_0x7995('0x38')]=_[_0x7995('0x39')](_0x229742['where'],{'$or':_[_0x7995('0x2a')](_0x132a42,function(_0x242713){if(_0x242713[_0x7995('0x2d')]!==_0x7995('0x3a')){var _0x4b1541={};_0x4b1541[_0x242713[_0x7995('0x28')]]={'$like':'%'+_0x47625f[_0x7995('0x2f')][_0x7995('0x37')]+'%'};return _0x4b1541;}})});}_0x229742=_[_0x7995('0x39')]({},_0x229742,_0x47625f[_0x7995('0x3b')]);var _0x1035dc={'where':_0x229742['where']};return db[_0x7995('0x3c')][_0x7995('0x3d')](_0x1035dc)[_0x7995('0x24')](function(_0x2ea47f){_0xf16cc2[_0x7995('0x3d')]=_0x2ea47f;if(_0x47625f[_0x7995('0x2f')][_0x7995('0x3e')]){_0x229742[_0x7995('0x3f')]=[{'all':!![]}];}return db[_0x7995('0x3c')][_0x7995('0x40')](_0x229742);})[_0x7995('0x24')](function(_0x270d52){_0xf16cc2[_0x7995('0x41')]=_0x270d52;return _0xf16cc2;})['then'](respondWithFilteredResult(_0x5911c3,_0x229742))['catch'](handleError(_0x5911c3,null));};exports[_0x7995('0x42')]=function(_0x7325e8,_0x58523e){var _0x4b0855={'raw':!![],'where':{'id':_0x7325e8['params']['id']}},_0x3f8522={};_0x3f8522['model']=_[_0x7995('0x30')](db[_0x7995('0x3c')][_0x7995('0x2b')]);_0x3f8522['query']=_[_0x7995('0x30')](_0x7325e8['query']);_0x3f8522[_0x7995('0x31')]=_['intersection'](_0x3f8522['model'],_0x3f8522[_0x7995('0x2f')]);_0x4b0855[_0x7995('0x35')]=_[_0x7995('0x32')](_0x3f8522[_0x7995('0x33')],qs['fields'](_0x7325e8[_0x7995('0x2f')][_0x7995('0x34')]));_0x4b0855[_0x7995('0x35')]=_0x4b0855[_0x7995('0x35')]['length']?_0x4b0855['attributes']:_0x3f8522[_0x7995('0x33')];if(_0x7325e8['query'][_0x7995('0x3e')]){_0x4b0855['include']=[{'all':!![]}];}_0x4b0855=_[_0x7995('0x39')]({},_0x4b0855,_0x7325e8['options']);return db[_0x7995('0x3c')][_0x7995('0x43')](_0x4b0855)['then'](handleEntityNotFound(_0x58523e,null))[_0x7995('0x24')](respondWithResult(_0x58523e,null))[_0x7995('0x44')](handleError(_0x58523e,null));};exports[_0x7995('0x45')]=function(_0xb70a51,_0x4c6837){return db[_0x7995('0x3c')][_0x7995('0x45')](_0xb70a51[_0x7995('0x46')],{})['then'](respondWithResult(_0x4c6837,0xc9))[_0x7995('0x44')](handleError(_0x4c6837,null));};exports[_0x7995('0x47')]=function(_0x511567,_0x3d8ae3){if(_0x511567[_0x7995('0x46')]['id']){delete _0x511567['body']['id'];}return db[_0x7995('0x3c')][_0x7995('0x43')]({'where':{'id':_0x511567['params']['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x3d8ae3,null))['then'](saveUpdates(_0x511567[_0x7995('0x46')],null))[_0x7995('0x24')](respondWithResult(_0x3d8ae3,null))[_0x7995('0x44')](handleError(_0x3d8ae3,null));};exports[_0x7995('0x25')]=function(_0xddf537,_0x14b537){return db[_0x7995('0x3c')]['find']({'where':{'id':_0xddf537[_0x7995('0x48')]['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x14b537,null))[_0x7995('0x24')](removeEntity(_0x14b537,null))['catch'](handleError(_0x14b537,null));};exports[_0x7995('0x49')]=function(_0x1fe77e,_0x12d4b8){return db['SmsQueueReport']['describe']()['then'](respondWithResult(_0x12d4b8,null))[_0x7995('0x44')](handleError(_0x12d4b8,null));}; \ No newline at end of file +var _0xe14b=['findAll','rows','catch','find','create','body','params','destroy','describe','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','reject','update','then','error','stack','name','index','SmsQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include'];(function(_0x3a78aa,_0x56a4f9){var _0x2c9cb7=function(_0x283087){while(--_0x283087){_0x3a78aa['push'](_0x3a78aa['shift']());}};_0x2c9cb7(++_0x56a4f9);}(_0xe14b,0x93));var _0xbe14=function(_0x3825ca,_0x433065){_0x3825ca=_0x3825ca-0x0;var _0x28f9e2=_0xe14b[_0x3825ca];return _0x28f9e2;};'use strict';var pdf=require(_0xbe14('0x0'));var emlformat=require(_0xbe14('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbe14('0x2'));var rp=require(_0xbe14('0x3'));var moment=require('moment');var BPromise=require(_0xbe14('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbe14('0x5'));var sox=require(_0xbe14('0x6'));var csv=require(_0xbe14('0x7'));var ejs=require(_0xbe14('0x8'));var fs=require('fs');var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var db=require(_0xbe14('0x14'))['db'];function respondWithStatusCode(_0x3d38c2,_0x27792f){_0x27792f=_0x27792f||0xcc;return function(_0x3b898d){if(_0x3b898d){return _0x3d38c2[_0xbe14('0x15')](_0x27792f);}return _0x3d38c2[_0xbe14('0x16')](_0x27792f)[_0xbe14('0x17')]();};}function respondWithResult(_0xa2cf72,_0x1e4826){_0x1e4826=_0x1e4826||0xc8;return function(_0x33fd54){if(_0x33fd54){return _0xa2cf72[_0xbe14('0x16')](_0x1e4826)['json'](_0x33fd54);}};}function respondWithFilteredResult(_0x55b3a7,_0x3f58f5){return function(_0x3dc4a9){if(_0x3dc4a9){var _0xf4ac9=_0x3dc4a9[_0xbe14('0x18')],_0x37ce4e=_0x3f58f5[_0xbe14('0x19')],_0x4e8f34=_0x3f58f5[_0xbe14('0x19')]+_0x3f58f5[_0xbe14('0x1a')],_0x21c789;if(_0x4e8f34>=_0xf4ac9){_0x4e8f34=_0xf4ac9;_0x21c789=0xc8;}else{_0x21c789=0xce;}_0x55b3a7[_0xbe14('0x16')](_0x21c789);return _0x55b3a7[_0xbe14('0x1b')]('Content-Range',_0x37ce4e+'-'+_0x4e8f34+'/'+_0xf4ac9)[_0xbe14('0x1c')](_0x3dc4a9);}return null;};}function patchUpdates(_0x456ca8){return function(_0x329588){try{jsonpatch[_0xbe14('0x1d')](_0x329588,_0x456ca8,!![]);}catch(_0x3249da){return BPromise[_0xbe14('0x1e')](_0x3249da);}return _0x329588['save']();};}function saveUpdates(_0x24f820,_0x4a1bbd){return function(_0x417c8d){if(_0x417c8d){return _0x417c8d[_0xbe14('0x1f')](_0x24f820)[_0xbe14('0x20')](function(_0x51dc0b){return _0x51dc0b;});}return null;};}function removeEntity(_0xe60f42,_0x56d845){return function(_0x3c1c85){if(_0x3c1c85){return _0x3c1c85['destroy']()[_0xbe14('0x20')](function(){_0xe60f42['status'](0xcc)[_0xbe14('0x17')]();});}};}function handleEntityNotFound(_0x3d3608,_0x505dbd){return function(_0x2da350){if(!_0x2da350){_0x3d3608['sendStatus'](0x194);}return _0x2da350;};}function handleError(_0x4587a8,_0x4851f8){_0x4851f8=_0x4851f8||0x1f4;return function(_0x36a21e){logger[_0xbe14('0x21')](_0x36a21e[_0xbe14('0x22')]);if(_0x36a21e[_0xbe14('0x23')]){delete _0x36a21e[_0xbe14('0x23')];}_0x4587a8[_0xbe14('0x16')](_0x4851f8)['send'](_0x36a21e);};}exports[_0xbe14('0x24')]=function(_0x1ba46a,_0x391556){var _0x169369={},_0x5dd475={},_0x16f884={'count':0x0,'rows':[]};var _0x29fc64=_['map'](db[_0xbe14('0x25')][_0xbe14('0x26')],function(_0x1c7cc7){return{'name':_0x1c7cc7[_0xbe14('0x27')],'type':_0x1c7cc7[_0xbe14('0x28')][_0xbe14('0x29')]};});_0x5dd475[_0xbe14('0x2a')]=_[_0xbe14('0x2b')](_0x29fc64,_0xbe14('0x23'));_0x5dd475[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](_0x1ba46a[_0xbe14('0x2c')]);_0x5dd475[_0xbe14('0x2e')]=_[_0xbe14('0x2f')](_0x5dd475[_0xbe14('0x2a')],_0x5dd475[_0xbe14('0x2c')]);_0x169369[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x5dd475[_0xbe14('0x2a')],qs[_0xbe14('0x31')](_0x1ba46a['query'][_0xbe14('0x31')]));_0x169369['attributes']=_0x169369['attributes'][_0xbe14('0x32')]?_0x169369['attributes']:_0x5dd475[_0xbe14('0x2a')];if(!_0x1ba46a[_0xbe14('0x2c')]['hasOwnProperty']('nolimit')){_0x169369['limit']=qs[_0xbe14('0x1a')](_0x1ba46a[_0xbe14('0x2c')]['limit']);_0x169369[_0xbe14('0x19')]=qs[_0xbe14('0x19')](_0x1ba46a[_0xbe14('0x2c')][_0xbe14('0x19')]);}_0x169369[_0xbe14('0x33')]=qs['sort'](_0x1ba46a['query'][_0xbe14('0x34')]);_0x169369['where']=qs['filters'](_['pick'](_0x1ba46a[_0xbe14('0x2c')],_0x5dd475[_0xbe14('0x2e')]),_0x29fc64);if(_0x1ba46a[_0xbe14('0x2c')][_0xbe14('0x35')]){_0x169369[_0xbe14('0x36')]=_[_0xbe14('0x37')](_0x169369[_0xbe14('0x36')],{'$or':_[_0xbe14('0x2b')](_0x29fc64,function(_0x2d9c12){if(_0x2d9c12[_0xbe14('0x28')]!==_0xbe14('0x38')){var _0x32c59d={};_0x32c59d[_0x2d9c12['name']]={'$like':'%'+_0x1ba46a['query'][_0xbe14('0x35')]+'%'};return _0x32c59d;}})});}_0x169369=_[_0xbe14('0x37')]({},_0x169369,_0x1ba46a[_0xbe14('0x39')]);var _0x520e09={'where':_0x169369[_0xbe14('0x36')]};return db[_0xbe14('0x25')][_0xbe14('0x18')](_0x520e09)[_0xbe14('0x20')](function(_0x3bd454){_0x16f884[_0xbe14('0x18')]=_0x3bd454;if(_0x1ba46a[_0xbe14('0x2c')][_0xbe14('0x3a')]){_0x169369[_0xbe14('0x3b')]=[{'all':!![]}];}return db['SmsQueueReport'][_0xbe14('0x3c')](_0x169369);})[_0xbe14('0x20')](function(_0x3463c4){_0x16f884[_0xbe14('0x3d')]=_0x3463c4;return _0x16f884;})[_0xbe14('0x20')](respondWithFilteredResult(_0x391556,_0x169369))[_0xbe14('0x3e')](handleError(_0x391556,null));};exports['show']=function(_0xb0f143,_0x1974a4){var _0x1220c9={'raw':!![],'where':{'id':_0xb0f143['params']['id']}},_0x36263c={};_0x36263c['model']=_[_0xbe14('0x2d')](db[_0xbe14('0x25')][_0xbe14('0x26')]);_0x36263c['query']=_['keys'](_0xb0f143[_0xbe14('0x2c')]);_0x36263c['filters']=_['intersection'](_0x36263c[_0xbe14('0x2a')],_0x36263c[_0xbe14('0x2c')]);_0x1220c9[_0xbe14('0x30')]=_['intersection'](_0x36263c['model'],qs['fields'](_0xb0f143[_0xbe14('0x2c')][_0xbe14('0x31')]));_0x1220c9[_0xbe14('0x30')]=_0x1220c9['attributes'][_0xbe14('0x32')]?_0x1220c9[_0xbe14('0x30')]:_0x36263c[_0xbe14('0x2a')];if(_0xb0f143[_0xbe14('0x2c')]['includeAll']){_0x1220c9['include']=[{'all':!![]}];}_0x1220c9=_[_0xbe14('0x37')]({},_0x1220c9,_0xb0f143[_0xbe14('0x39')]);return db[_0xbe14('0x25')][_0xbe14('0x3f')](_0x1220c9)[_0xbe14('0x20')](handleEntityNotFound(_0x1974a4,null))['then'](respondWithResult(_0x1974a4,null))['catch'](handleError(_0x1974a4,null));};exports[_0xbe14('0x40')]=function(_0x2a3623,_0x238c60){return db[_0xbe14('0x25')]['create'](_0x2a3623[_0xbe14('0x41')],{})[_0xbe14('0x20')](respondWithResult(_0x238c60,0xc9))['catch'](handleError(_0x238c60,null));};exports[_0xbe14('0x1f')]=function(_0x2a35e5,_0x2d6ee8){if(_0x2a35e5[_0xbe14('0x41')]['id']){delete _0x2a35e5['body']['id'];}return db['SmsQueueReport'][_0xbe14('0x3f')]({'where':{'id':_0x2a35e5[_0xbe14('0x42')]['id']}})['then'](handleEntityNotFound(_0x2d6ee8,null))['then'](saveUpdates(_0x2a35e5[_0xbe14('0x41')],null))[_0xbe14('0x20')](respondWithResult(_0x2d6ee8,null))[_0xbe14('0x3e')](handleError(_0x2d6ee8,null));};exports[_0xbe14('0x43')]=function(_0xdbc6e1,_0xd04fd5){return db[_0xbe14('0x25')]['find']({'where':{'id':_0xdbc6e1[_0xbe14('0x42')]['id']}})[_0xbe14('0x20')](handleEntityNotFound(_0xd04fd5,null))[_0xbe14('0x20')](removeEntity(_0xd04fd5,null))[_0xbe14('0x3e')](handleError(_0xd04fd5,null));};exports[_0xbe14('0x44')]=function(_0x494c32,_0x3a221b){return db[_0xbe14('0x25')][_0xbe14('0x44')]()[_0xbe14('0x20')](respondWithResult(_0x3a221b,null))[_0xbe14('0x3e')](handleError(_0x3a221b,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 9dbd2c4..28a443e 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 _0x0849=['moment','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x0849,0xca));var _0x9084=function(_0x33a919,_0x271e2c){_0x33a919=_0x33a919-0x0;var _0x5cf348=_0x0849[_0x33a919];return _0x5cf348;};'use strict';var _=require(_0x9084('0x0'));var util=require(_0x9084('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9084('0x2'));var BPromise=require(_0x9084('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9084('0x4'));var rimraf=require(_0x9084('0x5'));var config=require(_0x9084('0x6'));var attributes=require(_0x9084('0x7'));module['exports']=function(_0x321e2e,_0x42288f){return _0x321e2e[_0x9084('0x8')](_0x9084('0x9'),attributes,{'tableName':_0x9084('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x9084('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9b8c=['exports','define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment'];(function(_0x25306c,_0x5612ce){var _0x2077b0=function(_0x3def22){while(--_0x3def22){_0x25306c['push'](_0x25306c['shift']());}};_0x2077b0(++_0x5612ce);}(_0x9b8c,0x16f));var _0xc9b8=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x9b8c[_0xc6be3a];return _0x56a310;};'use strict';var _=require(_0xc9b8('0x0'));var util=require(_0xc9b8('0x1'));var logger=require(_0xc9b8('0x2'))('api');var moment=require(_0xc9b8('0x3'));var BPromise=require(_0xc9b8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc9b8('0x5'));var rimraf=require('rimraf');var config=require(_0xc9b8('0x6'));var attributes=require('./smsQueueReport.attributes');module[_0xc9b8('0x7')]=function(_0x380a9b,_0x539bd3){return _0x380a9b[_0xc9b8('0x8')](_0xc9b8('0x9'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0xc9b8('0xa'),'fields':[_0xc9b8('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 34b3959..8ff502a 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 _0xae0a=['debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsQueueReport,\x20%s,\x20%s','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','UpdateSmsQueueReport','update','raw','where','attributes','limit','lodash','util','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent'];(function(_0x2923c4,_0x4dc92d){var _0x26cae9=function(_0x4d40dd){while(--_0x4d40dd){_0x2923c4['push'](_0x2923c4['shift']());}};_0x26cae9(++_0x4dc92d);}(_0xae0a,0x154));var _0xaae0=function(_0x3c52c2,_0x2bb299){_0x3c52c2=_0x3c52c2-0x0;var _0x45289a=_0xae0a[_0x3c52c2];return _0x45289a;};'use strict';var _=require(_0xaae0('0x0'));var util=require(_0xaae0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaae0('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xaae0('0x3'));var logger=require('../../config/logger')(_0xaae0('0x4'));var config=require(_0xaae0('0x5'));var jayson=require(_0xaae0('0x6'));var client=jayson[_0xaae0('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x545527,_0x3ed9fe,_0x4e922b){return new BPromise(function(_0x5e2afa,_0x816593){return client[_0xaae0('0x8')](_0x545527,_0x4e922b)[_0xaae0('0x9')](function(_0x157d1f){logger[_0xaae0('0xa')]('SmsQueueReport,\x20%s,\x20%s',_0x3ed9fe,_0xaae0('0xb'));logger[_0xaae0('0xc')](_0xaae0('0xd'),_0x3ed9fe,_0xaae0('0xb'),JSON[_0xaae0('0xe')](_0x157d1f));if(_0x157d1f[_0xaae0('0xf')]){if(_0x157d1f[_0xaae0('0xf')][_0xaae0('0x10')]===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x3ed9fe,_0x157d1f[_0xaae0('0xf')][_0xaae0('0x11')]);return _0x816593(_0x157d1f[_0xaae0('0xf')]['message']);}logger['error'](_0xaae0('0x12'),_0x3ed9fe,_0x157d1f[_0xaae0('0xf')]['message']);return _0x5e2afa(_0x157d1f[_0xaae0('0xf')]['message']);}else{logger['info'](_0xaae0('0x12'),_0x3ed9fe,_0xaae0('0xb'));_0x5e2afa(_0x157d1f[_0xaae0('0x13')][_0xaae0('0x11')]);}})[_0xaae0('0x14')](function(_0x19eac8){logger[_0xaae0('0xf')](_0xaae0('0x12'),_0x3ed9fe,_0x19eac8);_0x816593(_0x19eac8);});});}exports[_0xaae0('0x15')]=function(_0x3c5711){var _0x122ee7=this;return new Promise(function(_0x553351,_0x4e16b5){return db[_0xaae0('0x16')][_0xaae0('0x17')](_0x3c5711[_0xaae0('0x18')],{'raw':_0x3c5711[_0xaae0('0x19')]?_0x3c5711[_0xaae0('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xaae0('0x9')](function(_0x309217){logger[_0xaae0('0xa')](_0xaae0('0x15'),_0x3c5711);logger['debug'](_0xaae0('0x15'),_0x3c5711,JSON[_0xaae0('0xe')](_0x309217));_0x553351(_0x309217);})[_0xaae0('0x14')](function(_0x57e1a7){logger[_0xaae0('0xf')]('CreateSmsQueueReport',_0x57e1a7[_0xaae0('0x11')],_0x3c5711);_0x4e16b5(_0x122ee7[_0xaae0('0xf')](0x1f4,_0x57e1a7['message']));});});};exports[_0xaae0('0x1a')]=function(_0x3eeff9){var _0x2fdea2=this;return new Promise(function(_0x4a2ffd,_0x3d86d5){return db[_0xaae0('0x16')][_0xaae0('0x1b')](_0x3eeff9[_0xaae0('0x18')],{'raw':_0x3eeff9[_0xaae0('0x19')]?_0x3eeff9['options'][_0xaae0('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3eeff9[_0xaae0('0x19')]?_0x3eeff9[_0xaae0('0x19')][_0xaae0('0x1d')]||null:null,'attributes':_0x3eeff9[_0xaae0('0x19')]?_0x3eeff9[_0xaae0('0x19')][_0xaae0('0x1e')]||null:null,'limit':_0x3eeff9['options']?_0x3eeff9[_0xaae0('0x19')][_0xaae0('0x1f')]||null:null})['then'](function(_0x3e67da){logger[_0xaae0('0xa')]('UpdateSmsQueueReport',_0x3eeff9);logger['debug']('UpdateSmsQueueReport',_0x3eeff9,JSON[_0xaae0('0xe')](_0x3e67da));_0x4a2ffd(_0x3e67da);})[_0xaae0('0x14')](function(_0x5d09e5){logger[_0xaae0('0xf')](_0xaae0('0x1a'),_0x5d09e5[_0xaae0('0x11')],_0x3eeff9);_0x3d86d5(_0x2fdea2['error'](0x1f4,_0x5d09e5[_0xaae0('0x11')]));});});}; \ No newline at end of file +var _0xc34f=['message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','then','debug','where','attributes','limit','UpdateSmsQueueReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x24618a,_0x2cd0f4){var _0x2e3d64=function(_0x28c59c){while(--_0x28c59c){_0x24618a['push'](_0x24618a['shift']());}};_0x2e3d64(++_0x2cd0f4);}(_0xc34f,0x17a));var _0xfc34=function(_0x3eb2ea,_0x401c21){_0x3eb2ea=_0x3eb2ea-0x0;var _0x516fe4=_0xc34f[_0x3eb2ea];return _0x516fe4;};'use strict';var _=require(_0xfc34('0x0'));var util=require(_0xfc34('0x1'));var moment=require(_0xfc34('0x2'));var BPromise=require(_0xfc34('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfc34('0x4'));var db=require(_0xfc34('0x5'))['db'];var utils=require(_0xfc34('0x6'));var logger=require(_0xfc34('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfc34('0x8')][_0xfc34('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55222c,_0x696224,_0x28dedb){return new BPromise(function(_0x369ec9,_0x5e6e30){return client[_0xfc34('0xa')](_0x55222c,_0x28dedb)['then'](function(_0x594135){logger[_0xfc34('0xb')](_0xfc34('0xc'),_0x696224,_0xfc34('0xd'));logger['debug'](_0xfc34('0xe'),_0x696224,_0xfc34('0xd'),JSON[_0xfc34('0xf')](_0x594135));if(_0x594135['error']){if(_0x594135[_0xfc34('0x10')][_0xfc34('0x11')]===0x1f4){logger[_0xfc34('0x10')](_0xfc34('0xc'),_0x696224,_0x594135[_0xfc34('0x10')][_0xfc34('0x12')]);return _0x5e6e30(_0x594135[_0xfc34('0x10')]['message']);}logger[_0xfc34('0x10')](_0xfc34('0xc'),_0x696224,_0x594135['error'][_0xfc34('0x12')]);return _0x369ec9(_0x594135[_0xfc34('0x10')][_0xfc34('0x12')]);}else{logger['info'](_0xfc34('0xc'),_0x696224,_0xfc34('0xd'));_0x369ec9(_0x594135[_0xfc34('0x13')][_0xfc34('0x12')]);}})[_0xfc34('0x14')](function(_0x49debf){logger[_0xfc34('0x10')](_0xfc34('0xc'),_0x696224,_0x49debf);_0x5e6e30(_0x49debf);});});}exports[_0xfc34('0x15')]=function(_0x158ec4){var _0x1058ba=this;return new Promise(function(_0x2dd988,_0xea8c5){return db[_0xfc34('0x16')][_0xfc34('0x17')](_0x158ec4[_0xfc34('0x18')],{'raw':_0x158ec4[_0xfc34('0x19')]?_0x158ec4[_0xfc34('0x19')][_0xfc34('0x1a')]===undefined?!![]:![]:!![]})[_0xfc34('0x1b')](function(_0x2dc45b){logger[_0xfc34('0xb')](_0xfc34('0x15'),_0x158ec4);logger[_0xfc34('0x1c')](_0xfc34('0x15'),_0x158ec4,JSON[_0xfc34('0xf')](_0x2dc45b));_0x2dd988(_0x2dc45b);})['catch'](function(_0x5a2840){logger[_0xfc34('0x10')](_0xfc34('0x15'),_0x5a2840[_0xfc34('0x12')],_0x158ec4);_0xea8c5(_0x1058ba[_0xfc34('0x10')](0x1f4,_0x5a2840[_0xfc34('0x12')]));});});};exports['UpdateSmsQueueReport']=function(_0x3fb699){var _0x145224=this;return new Promise(function(_0x38b217,_0xc3a22f){return db['SmsQueueReport']['update'](_0x3fb699[_0xfc34('0x18')],{'raw':_0x3fb699[_0xfc34('0x19')]?_0x3fb699[_0xfc34('0x19')][_0xfc34('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fb699[_0xfc34('0x19')]?_0x3fb699[_0xfc34('0x19')][_0xfc34('0x1d')]||null:null,'attributes':_0x3fb699[_0xfc34('0x19')]?_0x3fb699[_0xfc34('0x19')][_0xfc34('0x1e')]||null:null,'limit':_0x3fb699[_0xfc34('0x19')]?_0x3fb699['options'][_0xfc34('0x1f')]||null:null})[_0xfc34('0x1b')](function(_0x714b23){logger[_0xfc34('0xb')](_0xfc34('0x20'),_0x3fb699);logger['debug'](_0xfc34('0x20'),_0x3fb699,JSON[_0xfc34('0xf')](_0x714b23));_0x38b217(_0x714b23);})[_0xfc34('0x14')](function(_0x12440e){logger[_0xfc34('0x10')]('UpdateSmsQueueReport',_0x12440e[_0xfc34('0x12')],_0x3fb699);_0xc3a22f(_0x145224[_0xfc34('0x10')](0x1f4,_0x12440e[_0xfc34('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 50822f7..a078123 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 _0x757a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','delete','util','path'];(function(_0x4001ad,_0x1e22dd){var _0x4c7ec2=function(_0x24cb8a){while(--_0x24cb8a){_0x4001ad['push'](_0x4001ad['shift']());}};_0x4c7ec2(++_0x1e22dd);}(_0x757a,0xde));var _0xa757=function(_0x1eacdd,_0x25af70){_0x1eacdd=_0x1eacdd-0x0;var _0x528a7d=_0x757a[_0x1eacdd];return _0x528a7d;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xa757('0x2'));var interaction=require(_0xa757('0x3'));var config=require(_0xa757('0x4'));var controller=require(_0xa757('0x5'));router[_0xa757('0x6')]('/',auth[_0xa757('0x7')](),controller['index']);router[_0xa757('0x6')](_0xa757('0x8'),auth['isAuthenticated'](),controller[_0xa757('0x9')]);router[_0xa757('0x6')](_0xa757('0xa'),auth[_0xa757('0x7')](),controller[_0xa757('0xb')]);router['post']('/',auth[_0xa757('0x7')](),controller[_0xa757('0xc')]);router[_0xa757('0xd')](_0xa757('0xa'),auth[_0xa757('0x7')](),controller[_0xa757('0xe')]);router[_0xa757('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0972=['put','update','delete','destroy','exports','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create'];(function(_0x189e8a,_0x2a6733){var _0x1f69fc=function(_0x1f27a5){while(--_0x1f27a5){_0x189e8a['push'](_0x189e8a['shift']());}};_0x1f69fc(++_0x2a6733);}(_0x0972,0x64));var _0x2097=function(_0x10a774,_0x50368b){_0x10a774=_0x10a774-0x0;var _0x3e2a20=_0x0972[_0x10a774];return _0x3e2a20;};'use strict';var multer=require('multer');var util=require(_0x2097('0x0'));var path=require('path');var timeout=require(_0x2097('0x1'));var express=require('express');var router=express[_0x2097('0x2')]();var auth=require(_0x2097('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x2097('0x4'));var controller=require(_0x2097('0x5'));router[_0x2097('0x6')]('/',auth[_0x2097('0x7')](),controller[_0x2097('0x8')]);router[_0x2097('0x6')](_0x2097('0x9'),auth['isAuthenticated'](),controller[_0x2097('0xa')]);router[_0x2097('0x6')](_0x2097('0xb'),auth[_0x2097('0x7')](),controller[_0x2097('0xc')]);router['post']('/',auth[_0x2097('0x7')](),controller[_0x2097('0xd')]);router[_0x2097('0xe')](_0x2097('0xb'),auth[_0x2097('0x7')](),controller[_0x2097('0xf')]);router[_0x2097('0x10')](_0x2097('0xb'),auth[_0x2097('0x7')](),controller[_0x2097('0x11')]);module[_0x2097('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 a924fdc..e1d1e8e 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 _0x0d2b=['ENUM','account','agent','queue','moment','sequelize','exports','STRING'];(function(_0x5a0383,_0x312ffe){var _0x1adda7=function(_0x1a0cf5){while(--_0x1a0cf5){_0x5a0383['push'](_0x5a0383['shift']());}};_0x1adda7(++_0x312ffe);}(_0x0d2b,0xec));var _0xb0d2=function(_0x2d7b77,_0x2476df){_0x2d7b77=_0x2d7b77-0x0;var _0x3e96ae=_0x0d2b[_0x2d7b77];return _0x3e96ae;};'use strict';var moment=require(_0xb0d2('0x0'));var Sequelize=require(_0xb0d2('0x1'));module[_0xb0d2('0x2')]={'uniqueid':{'type':Sequelize[_0xb0d2('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xb0d2('0x4')](_0xb0d2('0x5'),_0xb0d2('0x6'),'queue'),'allowNull':![],'defaultValue':_0xb0d2('0x7')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xc0f6=['ENUM','agent','queue','moment','sequelize'];(function(_0x4c9380,_0x2fefc0){var _0x49a523=function(_0x165e85){while(--_0x165e85){_0x4c9380['push'](_0x4c9380['shift']());}};_0x49a523(++_0x2fefc0);}(_0xc0f6,0xb7));var _0x6c0f=function(_0x368587,_0x1b6554){_0x368587=_0x368587-0x0;var _0x42d33c=_0xc0f6[_0x368587];return _0x42d33c;};'use strict';var moment=require(_0x6c0f('0x0'));var Sequelize=require(_0x6c0f('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6c0f('0x2')]('account',_0x6c0f('0x3'),_0x6c0f('0x4')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index dbdfedd..99d54bc 100644 --- a/server/api/smsTransferReport/smsTransferReport.controller.js +++ b/server/api/smsTransferReport/smsTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['catch','create','body','destroy','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','count','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','SmsTransferReport','include','findAll','rows','params','includeAll','options','find'];(function(_0x404654,_0x19e0c4){var _0x6ad82c=function(_0x46fbb4){while(--_0x46fbb4){_0x404654['push'](_0x404654['shift']());}};_0x6ad82c(++_0x19e0c4);}(_0xe706,0xa3));var _0x6e70=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xe706[_0x1e7b16];return _0x37fadc;};'use strict';var pdf=require(_0x6e70('0x0'));var emlformat=require(_0x6e70('0x1'));var rimraf=require(_0x6e70('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6e70('0x3'));var rp=require(_0x6e70('0x4'));var moment=require(_0x6e70('0x5'));var BPromise=require(_0x6e70('0x6'));var Mustache=require(_0x6e70('0x7'));var util=require(_0x6e70('0x8'));var path=require(_0x6e70('0x9'));var sox=require(_0x6e70('0xa'));var csv=require(_0x6e70('0xb'));var ejs=require(_0x6e70('0xc'));var fs=require('fs');var _=require(_0x6e70('0xd'));var squel=require(_0x6e70('0xe'));var crypto=require(_0x6e70('0xf'));var jsforce=require(_0x6e70('0x10'));var deskjs=require(_0x6e70('0x11'));var toCsv=require(_0x6e70('0xb'));var querystring=require(_0x6e70('0x12'));var Papa=require(_0x6e70('0x13'));var Redis=require(_0x6e70('0x14'));var authService=require(_0x6e70('0x15'));var qs=require(_0x6e70('0x16'));var as=require(_0x6e70('0x17'));var hardwareService=require(_0x6e70('0x18'));var logger=require(_0x6e70('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x6e70('0x1a'));var db=require(_0x6e70('0x1b'))['db'];function respondWithStatusCode(_0x18cf27,_0x27dd9b){_0x27dd9b=_0x27dd9b||0xcc;return function(_0x3b38f3){if(_0x3b38f3){return _0x18cf27[_0x6e70('0x1c')](_0x27dd9b);}return _0x18cf27[_0x6e70('0x1d')](_0x27dd9b)[_0x6e70('0x1e')]();};}function respondWithResult(_0x5dfbaa,_0x52737e){_0x52737e=_0x52737e||0xc8;return function(_0x48bc72){if(_0x48bc72){return _0x5dfbaa[_0x6e70('0x1d')](_0x52737e)['json'](_0x48bc72);}};}function respondWithFilteredResult(_0x53aed0,_0x304716){return function(_0x22c50c){if(_0x22c50c){var _0x5d9263=_0x22c50c[_0x6e70('0x1f')],_0x24f3ac=_0x304716['offset'],_0x5c3fe7=_0x304716['offset']+_0x304716[_0x6e70('0x20')],_0x2efc0f;if(_0x5c3fe7>=_0x5d9263){_0x5c3fe7=_0x5d9263;_0x2efc0f=0xc8;}else{_0x2efc0f=0xce;}_0x53aed0['status'](_0x2efc0f);return _0x53aed0[_0x6e70('0x21')](_0x6e70('0x22'),_0x24f3ac+'-'+_0x5c3fe7+'/'+_0x5d9263)['json'](_0x22c50c);}return null;};}function patchUpdates(_0x497d61){return function(_0xc238ba){try{jsonpatch[_0x6e70('0x23')](_0xc238ba,_0x497d61,!![]);}catch(_0x2368eb){return BPromise[_0x6e70('0x24')](_0x2368eb);}return _0xc238ba[_0x6e70('0x25')]();};}function saveUpdates(_0xcdf9f2,_0x1b2453){return function(_0x44a49f){if(_0x44a49f){return _0x44a49f[_0x6e70('0x26')](_0xcdf9f2)[_0x6e70('0x27')](function(_0x4a0cfe){return _0x4a0cfe;});}return null;};}function removeEntity(_0x228350,_0x344b65){return function(_0x27b294){if(_0x27b294){return _0x27b294['destroy']()[_0x6e70('0x27')](function(){_0x228350[_0x6e70('0x1d')](0xcc)[_0x6e70('0x1e')]();});}};}function handleEntityNotFound(_0x50da2c,_0x10fc91){return function(_0x538b9c){if(!_0x538b9c){_0x50da2c['sendStatus'](0x194);}return _0x538b9c;};}function handleError(_0x4e97c7,_0x41e352){_0x41e352=_0x41e352||0x1f4;return function(_0x19c5ae){logger['error'](_0x19c5ae[_0x6e70('0x28')]);if(_0x19c5ae[_0x6e70('0x29')]){delete _0x19c5ae['name'];}_0x4e97c7[_0x6e70('0x1d')](_0x41e352)[_0x6e70('0x2a')](_0x19c5ae);};}exports[_0x6e70('0x2b')]=function(_0x4a67ac,_0x54a5fe){var _0x2c4d37={},_0x3af17f={},_0x83c836={'count':0x0,'rows':[]};var _0x114344=_[_0x6e70('0x2c')](db['SmsTransferReport'][_0x6e70('0x2d')],function(_0x406f29){return{'name':_0x406f29[_0x6e70('0x2e')],'type':_0x406f29[_0x6e70('0x2f')][_0x6e70('0x30')]};});_0x3af17f[_0x6e70('0x31')]=_[_0x6e70('0x2c')](_0x114344,_0x6e70('0x29'));_0x3af17f[_0x6e70('0x32')]=_[_0x6e70('0x33')](_0x4a67ac['query']);_0x3af17f[_0x6e70('0x34')]=_['intersection'](_0x3af17f[_0x6e70('0x31')],_0x3af17f['query']);_0x2c4d37[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0x3af17f[_0x6e70('0x31')],qs['fields'](_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x37')]));_0x2c4d37['attributes']=_0x2c4d37[_0x6e70('0x35')][_0x6e70('0x38')]?_0x2c4d37['attributes']:_0x3af17f[_0x6e70('0x31')];if(!_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x39')](_0x6e70('0x3a'))){_0x2c4d37[_0x6e70('0x20')]=qs[_0x6e70('0x20')](_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x20')]);_0x2c4d37[_0x6e70('0x3b')]=qs[_0x6e70('0x3b')](_0x4a67ac['query'][_0x6e70('0x3b')]);}_0x2c4d37['order']=qs[_0x6e70('0x3c')](_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x3c')]);_0x2c4d37[_0x6e70('0x3d')]=qs[_0x6e70('0x34')](_[_0x6e70('0x3e')](_0x4a67ac[_0x6e70('0x32')],_0x3af17f[_0x6e70('0x34')]),_0x114344);if(_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x3f')]){_0x2c4d37[_0x6e70('0x3d')]=_[_0x6e70('0x40')](_0x2c4d37[_0x6e70('0x3d')],{'$or':_['map'](_0x114344,function(_0x5446a2){if(_0x5446a2['type']!==_0x6e70('0x41')){var _0x3841a0={};_0x3841a0[_0x5446a2[_0x6e70('0x29')]]={'$like':'%'+_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x3f')]+'%'};return _0x3841a0;}})});}_0x2c4d37=_[_0x6e70('0x40')]({},_0x2c4d37,_0x4a67ac['options']);var _0x3b508c={'where':_0x2c4d37[_0x6e70('0x3d')]};return db[_0x6e70('0x42')][_0x6e70('0x1f')](_0x3b508c)[_0x6e70('0x27')](function(_0x37bf46){_0x83c836[_0x6e70('0x1f')]=_0x37bf46;if(_0x4a67ac[_0x6e70('0x32')]['includeAll']){_0x2c4d37[_0x6e70('0x43')]=[{'all':!![]}];}return db[_0x6e70('0x42')][_0x6e70('0x44')](_0x2c4d37);})[_0x6e70('0x27')](function(_0x201da9){_0x83c836[_0x6e70('0x45')]=_0x201da9;return _0x83c836;})[_0x6e70('0x27')](respondWithFilteredResult(_0x54a5fe,_0x2c4d37))['catch'](handleError(_0x54a5fe,null));};exports['show']=function(_0x5ae898,_0x154e0c){var _0x2b63cc={'raw':!![],'where':{'id':_0x5ae898[_0x6e70('0x46')]['id']}},_0x83847b={};_0x83847b[_0x6e70('0x31')]=_['keys'](db[_0x6e70('0x42')][_0x6e70('0x2d')]);_0x83847b[_0x6e70('0x32')]=_['keys'](_0x5ae898['query']);_0x83847b['filters']=_[_0x6e70('0x36')](_0x83847b['model'],_0x83847b[_0x6e70('0x32')]);_0x2b63cc[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0x83847b[_0x6e70('0x31')],qs['fields'](_0x5ae898[_0x6e70('0x32')]['fields']));_0x2b63cc[_0x6e70('0x35')]=_0x2b63cc[_0x6e70('0x35')][_0x6e70('0x38')]?_0x2b63cc[_0x6e70('0x35')]:_0x83847b['model'];if(_0x5ae898[_0x6e70('0x32')][_0x6e70('0x47')]){_0x2b63cc[_0x6e70('0x43')]=[{'all':!![]}];}_0x2b63cc=_[_0x6e70('0x40')]({},_0x2b63cc,_0x5ae898[_0x6e70('0x48')]);return db[_0x6e70('0x42')][_0x6e70('0x49')](_0x2b63cc)['then'](handleEntityNotFound(_0x154e0c,null))[_0x6e70('0x27')](respondWithResult(_0x154e0c,null))[_0x6e70('0x4a')](handleError(_0x154e0c,null));};exports[_0x6e70('0x4b')]=function(_0x2f99cb,_0x3f86cf){return db[_0x6e70('0x42')][_0x6e70('0x4b')](_0x2f99cb['body'],{})[_0x6e70('0x27')](respondWithResult(_0x3f86cf,0xc9))['catch'](handleError(_0x3f86cf,null));};exports[_0x6e70('0x26')]=function(_0x3836e4,_0x4b351e){if(_0x3836e4['body']['id']){delete _0x3836e4[_0x6e70('0x4c')]['id'];}return db[_0x6e70('0x42')][_0x6e70('0x49')]({'where':{'id':_0x3836e4['params']['id']}})['then'](handleEntityNotFound(_0x4b351e,null))[_0x6e70('0x27')](saveUpdates(_0x3836e4[_0x6e70('0x4c')],null))[_0x6e70('0x27')](respondWithResult(_0x4b351e,null))[_0x6e70('0x4a')](handleError(_0x4b351e,null));};exports[_0x6e70('0x4d')]=function(_0x340674,_0x4ad5a9){return db[_0x6e70('0x42')][_0x6e70('0x49')]({'where':{'id':_0x340674[_0x6e70('0x46')]['id']}})[_0x6e70('0x27')](handleEntityNotFound(_0x4ad5a9,null))[_0x6e70('0x27')](removeEntity(_0x4ad5a9,null))['catch'](handleError(_0x4ad5a9,null));};exports['describe']=function(_0x2c5538,_0x2e3ea6){return db[_0x6e70('0x42')][_0x6e70('0x4e')]()[_0x6e70('0x27')](respondWithResult(_0x2e3ea6,null))['catch'](handleError(_0x2e3ea6,null));}; \ No newline at end of file +var _0xe706=['catch','create','body','destroy','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','count','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','SmsTransferReport','include','findAll','rows','params','includeAll','options','find'];(function(_0x1985d4,_0x1e32b8){var _0x6c708b=function(_0x2d2dde){while(--_0x2d2dde){_0x1985d4['push'](_0x1985d4['shift']());}};_0x6c708b(++_0x1e32b8);}(_0xe706,0xa3));var _0x6e70=function(_0x235884,_0x1c4355){_0x235884=_0x235884-0x0;var _0x211158=_0xe706[_0x235884];return _0x211158;};'use strict';var pdf=require(_0x6e70('0x0'));var emlformat=require(_0x6e70('0x1'));var rimraf=require(_0x6e70('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6e70('0x3'));var rp=require(_0x6e70('0x4'));var moment=require(_0x6e70('0x5'));var BPromise=require(_0x6e70('0x6'));var Mustache=require(_0x6e70('0x7'));var util=require(_0x6e70('0x8'));var path=require(_0x6e70('0x9'));var sox=require(_0x6e70('0xa'));var csv=require(_0x6e70('0xb'));var ejs=require(_0x6e70('0xc'));var fs=require('fs');var _=require(_0x6e70('0xd'));var squel=require(_0x6e70('0xe'));var crypto=require(_0x6e70('0xf'));var jsforce=require(_0x6e70('0x10'));var deskjs=require(_0x6e70('0x11'));var toCsv=require(_0x6e70('0xb'));var querystring=require(_0x6e70('0x12'));var Papa=require(_0x6e70('0x13'));var Redis=require(_0x6e70('0x14'));var authService=require(_0x6e70('0x15'));var qs=require(_0x6e70('0x16'));var as=require(_0x6e70('0x17'));var hardwareService=require(_0x6e70('0x18'));var logger=require(_0x6e70('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x6e70('0x1a'));var db=require(_0x6e70('0x1b'))['db'];function respondWithStatusCode(_0x18cf27,_0x27dd9b){_0x27dd9b=_0x27dd9b||0xcc;return function(_0x3b38f3){if(_0x3b38f3){return _0x18cf27[_0x6e70('0x1c')](_0x27dd9b);}return _0x18cf27[_0x6e70('0x1d')](_0x27dd9b)[_0x6e70('0x1e')]();};}function respondWithResult(_0x5dfbaa,_0x52737e){_0x52737e=_0x52737e||0xc8;return function(_0x48bc72){if(_0x48bc72){return _0x5dfbaa[_0x6e70('0x1d')](_0x52737e)['json'](_0x48bc72);}};}function respondWithFilteredResult(_0x53aed0,_0x304716){return function(_0x22c50c){if(_0x22c50c){var _0x5d9263=_0x22c50c[_0x6e70('0x1f')],_0x24f3ac=_0x304716['offset'],_0x5c3fe7=_0x304716['offset']+_0x304716[_0x6e70('0x20')],_0x2efc0f;if(_0x5c3fe7>=_0x5d9263){_0x5c3fe7=_0x5d9263;_0x2efc0f=0xc8;}else{_0x2efc0f=0xce;}_0x53aed0['status'](_0x2efc0f);return _0x53aed0[_0x6e70('0x21')](_0x6e70('0x22'),_0x24f3ac+'-'+_0x5c3fe7+'/'+_0x5d9263)['json'](_0x22c50c);}return null;};}function patchUpdates(_0x497d61){return function(_0xc238ba){try{jsonpatch[_0x6e70('0x23')](_0xc238ba,_0x497d61,!![]);}catch(_0x2368eb){return BPromise[_0x6e70('0x24')](_0x2368eb);}return _0xc238ba[_0x6e70('0x25')]();};}function saveUpdates(_0xcdf9f2,_0x1b2453){return function(_0x44a49f){if(_0x44a49f){return _0x44a49f[_0x6e70('0x26')](_0xcdf9f2)[_0x6e70('0x27')](function(_0x4a0cfe){return _0x4a0cfe;});}return null;};}function removeEntity(_0x228350,_0x344b65){return function(_0x27b294){if(_0x27b294){return _0x27b294['destroy']()[_0x6e70('0x27')](function(){_0x228350[_0x6e70('0x1d')](0xcc)[_0x6e70('0x1e')]();});}};}function handleEntityNotFound(_0x50da2c,_0x10fc91){return function(_0x538b9c){if(!_0x538b9c){_0x50da2c['sendStatus'](0x194);}return _0x538b9c;};}function handleError(_0x4e97c7,_0x41e352){_0x41e352=_0x41e352||0x1f4;return function(_0x19c5ae){logger['error'](_0x19c5ae[_0x6e70('0x28')]);if(_0x19c5ae[_0x6e70('0x29')]){delete _0x19c5ae['name'];}_0x4e97c7[_0x6e70('0x1d')](_0x41e352)[_0x6e70('0x2a')](_0x19c5ae);};}exports[_0x6e70('0x2b')]=function(_0x4a67ac,_0x54a5fe){var _0x2c4d37={},_0x3af17f={},_0x83c836={'count':0x0,'rows':[]};var _0x114344=_[_0x6e70('0x2c')](db['SmsTransferReport'][_0x6e70('0x2d')],function(_0x406f29){return{'name':_0x406f29[_0x6e70('0x2e')],'type':_0x406f29[_0x6e70('0x2f')][_0x6e70('0x30')]};});_0x3af17f[_0x6e70('0x31')]=_[_0x6e70('0x2c')](_0x114344,_0x6e70('0x29'));_0x3af17f[_0x6e70('0x32')]=_[_0x6e70('0x33')](_0x4a67ac['query']);_0x3af17f[_0x6e70('0x34')]=_['intersection'](_0x3af17f[_0x6e70('0x31')],_0x3af17f['query']);_0x2c4d37[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0x3af17f[_0x6e70('0x31')],qs['fields'](_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x37')]));_0x2c4d37['attributes']=_0x2c4d37[_0x6e70('0x35')][_0x6e70('0x38')]?_0x2c4d37['attributes']:_0x3af17f[_0x6e70('0x31')];if(!_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x39')](_0x6e70('0x3a'))){_0x2c4d37[_0x6e70('0x20')]=qs[_0x6e70('0x20')](_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x20')]);_0x2c4d37[_0x6e70('0x3b')]=qs[_0x6e70('0x3b')](_0x4a67ac['query'][_0x6e70('0x3b')]);}_0x2c4d37['order']=qs[_0x6e70('0x3c')](_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x3c')]);_0x2c4d37[_0x6e70('0x3d')]=qs[_0x6e70('0x34')](_[_0x6e70('0x3e')](_0x4a67ac[_0x6e70('0x32')],_0x3af17f[_0x6e70('0x34')]),_0x114344);if(_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x3f')]){_0x2c4d37[_0x6e70('0x3d')]=_[_0x6e70('0x40')](_0x2c4d37[_0x6e70('0x3d')],{'$or':_['map'](_0x114344,function(_0x5446a2){if(_0x5446a2['type']!==_0x6e70('0x41')){var _0x3841a0={};_0x3841a0[_0x5446a2[_0x6e70('0x29')]]={'$like':'%'+_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x3f')]+'%'};return _0x3841a0;}})});}_0x2c4d37=_[_0x6e70('0x40')]({},_0x2c4d37,_0x4a67ac['options']);var _0x3b508c={'where':_0x2c4d37[_0x6e70('0x3d')]};return db[_0x6e70('0x42')][_0x6e70('0x1f')](_0x3b508c)[_0x6e70('0x27')](function(_0x37bf46){_0x83c836[_0x6e70('0x1f')]=_0x37bf46;if(_0x4a67ac[_0x6e70('0x32')]['includeAll']){_0x2c4d37[_0x6e70('0x43')]=[{'all':!![]}];}return db[_0x6e70('0x42')][_0x6e70('0x44')](_0x2c4d37);})[_0x6e70('0x27')](function(_0x201da9){_0x83c836[_0x6e70('0x45')]=_0x201da9;return _0x83c836;})[_0x6e70('0x27')](respondWithFilteredResult(_0x54a5fe,_0x2c4d37))['catch'](handleError(_0x54a5fe,null));};exports['show']=function(_0x5ae898,_0x154e0c){var _0x2b63cc={'raw':!![],'where':{'id':_0x5ae898[_0x6e70('0x46')]['id']}},_0x83847b={};_0x83847b[_0x6e70('0x31')]=_['keys'](db[_0x6e70('0x42')][_0x6e70('0x2d')]);_0x83847b[_0x6e70('0x32')]=_['keys'](_0x5ae898['query']);_0x83847b['filters']=_[_0x6e70('0x36')](_0x83847b['model'],_0x83847b[_0x6e70('0x32')]);_0x2b63cc[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0x83847b[_0x6e70('0x31')],qs['fields'](_0x5ae898[_0x6e70('0x32')]['fields']));_0x2b63cc[_0x6e70('0x35')]=_0x2b63cc[_0x6e70('0x35')][_0x6e70('0x38')]?_0x2b63cc[_0x6e70('0x35')]:_0x83847b['model'];if(_0x5ae898[_0x6e70('0x32')][_0x6e70('0x47')]){_0x2b63cc[_0x6e70('0x43')]=[{'all':!![]}];}_0x2b63cc=_[_0x6e70('0x40')]({},_0x2b63cc,_0x5ae898[_0x6e70('0x48')]);return db[_0x6e70('0x42')][_0x6e70('0x49')](_0x2b63cc)['then'](handleEntityNotFound(_0x154e0c,null))[_0x6e70('0x27')](respondWithResult(_0x154e0c,null))[_0x6e70('0x4a')](handleError(_0x154e0c,null));};exports[_0x6e70('0x4b')]=function(_0x2f99cb,_0x3f86cf){return db[_0x6e70('0x42')][_0x6e70('0x4b')](_0x2f99cb['body'],{})[_0x6e70('0x27')](respondWithResult(_0x3f86cf,0xc9))['catch'](handleError(_0x3f86cf,null));};exports[_0x6e70('0x26')]=function(_0x3836e4,_0x4b351e){if(_0x3836e4['body']['id']){delete _0x3836e4[_0x6e70('0x4c')]['id'];}return db[_0x6e70('0x42')][_0x6e70('0x49')]({'where':{'id':_0x3836e4['params']['id']}})['then'](handleEntityNotFound(_0x4b351e,null))[_0x6e70('0x27')](saveUpdates(_0x3836e4[_0x6e70('0x4c')],null))[_0x6e70('0x27')](respondWithResult(_0x4b351e,null))[_0x6e70('0x4a')](handleError(_0x4b351e,null));};exports[_0x6e70('0x4d')]=function(_0x340674,_0x4ad5a9){return db[_0x6e70('0x42')][_0x6e70('0x49')]({'where':{'id':_0x340674[_0x6e70('0x46')]['id']}})[_0x6e70('0x27')](handleEntityNotFound(_0x4ad5a9,null))[_0x6e70('0x27')](removeEntity(_0x4ad5a9,null))['catch'](handleError(_0x4ad5a9,null));};exports['describe']=function(_0x2c5538,_0x2e3ea6){return db[_0x6e70('0x42')][_0x6e70('0x4e')]()[_0x6e70('0x27')](respondWithResult(_0x2e3ea6,null))['catch'](handleError(_0x2e3ea6,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 6d912ae..d7f012e 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 _0x6455=['request-promise','path','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','lodash','../../config/logger','api','moment','bluebird'];(function(_0xa9010e,_0x253a72){var _0x2c7982=function(_0x131bc4){while(--_0x131bc4){_0xa9010e['push'](_0xa9010e['shift']());}};_0x2c7982(++_0x253a72);}(_0x6455,0x97));var _0x5645=function(_0x477827,_0x54430c){_0x477827=_0x477827-0x0;var _0x4cdff4=_0x6455[_0x477827];return _0x4cdff4;};'use strict';var _=require(_0x5645('0x0'));var util=require('util');var logger=require(_0x5645('0x1'))(_0x5645('0x2'));var moment=require(_0x5645('0x3'));var BPromise=require(_0x5645('0x4'));var rp=require(_0x5645('0x5'));var fs=require('fs');var path=require(_0x5645('0x6'));var rimraf=require('rimraf');var config=require(_0x5645('0x7'));var attributes=require(_0x5645('0x8'));module[_0x5645('0x9')]=function(_0x9400a8,_0x3a635d){return _0x9400a8[_0x5645('0xa')](_0x5645('0xb'),attributes,{'tableName':_0x5645('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0309=['bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','define','report_sms_transfer','uniqueid','lodash','../../config/logger','moment'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x0309,0x165));var _0x9030=function(_0x320c67,_0x4f9e4a){_0x320c67=_0x320c67-0x0;var _0x1c9d6b=_0x0309[_0x320c67];return _0x1c9d6b;};'use strict';var _=require(_0x9030('0x0'));var util=require('util');var logger=require(_0x9030('0x1'))('api');var moment=require(_0x9030('0x2'));var BPromise=require(_0x9030('0x3'));var rp=require(_0x9030('0x4'));var fs=require('fs');var path=require(_0x9030('0x5'));var rimraf=require(_0x9030('0x6'));var config=require(_0x9030('0x7'));var attributes=require(_0x9030('0x8'));module['exports']=function(_0x5a3334,_0x1c9c7b){return _0x5a3334[_0x9030('0x9')]('SmsTransferReport',attributes,{'tableName':_0x9030('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x9030('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 2a292ea..0c2b84f 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 _0x9352=['lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','code','SmsTransferReport,\x20%s,\x20%s','message','catch'];(function(_0x274426,_0xb42258){var _0x59620d=function(_0x4a2ade){while(--_0x4a2ade){_0x274426['push'](_0x274426['shift']());}};_0x59620d(++_0xb42258);}(_0x9352,0xe7));var _0x2935=function(_0x47e5c4,_0x1b3770){_0x47e5c4=_0x47e5c4-0x0;var _0x4c1f1b=_0x9352[_0x47e5c4];return _0x4c1f1b;};'use strict';var _=require(_0x2935('0x0'));var util=require('util');var moment=require(_0x2935('0x1'));var BPromise=require(_0x2935('0x2'));var rs=require(_0x2935('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2935('0x4'))['db'];var utils=require(_0x2935('0x5'));var logger=require(_0x2935('0x6'))(_0x2935('0x7'));var config=require(_0x2935('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2935('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x34b2ce,_0x49deea,_0x23bb8f){return new BPromise(function(_0x4b46d1,_0x3ad31a){return client[_0x2935('0xa')](_0x34b2ce,_0x23bb8f)[_0x2935('0xb')](function(_0xb529eb){logger[_0x2935('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x49deea,_0x2935('0xd'));logger[_0x2935('0xe')](_0x2935('0xf'),_0x49deea,_0x2935('0xd'),JSON['stringify'](_0xb529eb));if(_0xb529eb[_0x2935('0x10')]){if(_0xb529eb[_0x2935('0x10')][_0x2935('0x11')]===0x1f4){logger[_0x2935('0x10')](_0x2935('0x12'),_0x49deea,_0xb529eb[_0x2935('0x10')]['message']);return _0x3ad31a(_0xb529eb['error'][_0x2935('0x13')]);}logger[_0x2935('0x10')](_0x2935('0x12'),_0x49deea,_0xb529eb[_0x2935('0x10')][_0x2935('0x13')]);return _0x4b46d1(_0xb529eb[_0x2935('0x10')][_0x2935('0x13')]);}else{logger['info'](_0x2935('0x12'),_0x49deea,_0x2935('0xd'));_0x4b46d1(_0xb529eb['result']['message']);}})[_0x2935('0x14')](function(_0x1b6b09){logger[_0x2935('0x10')](_0x2935('0x12'),_0x49deea,_0x1b6b09);_0x3ad31a(_0x1b6b09);});});} \ No newline at end of file +var _0x9912=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger'];(function(_0x5d4600,_0x2c572f){var _0x5e71ef=function(_0x4f046f){while(--_0x4f046f){_0x5d4600['push'](_0x5d4600['shift']());}};_0x5e71ef(++_0x2c572f);}(_0x9912,0x1c6));var _0x2991=function(_0x14c97c,_0x251154){_0x14c97c=_0x14c97c-0x0;var _0x5efd5f=_0x9912[_0x14c97c];return _0x5efd5f;};'use strict';var _=require(_0x2991('0x0'));var util=require(_0x2991('0x1'));var moment=require(_0x2991('0x2'));var BPromise=require('bluebird');var rs=require(_0x2991('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2991('0x4'));var logger=require(_0x2991('0x5'))(_0x2991('0x6'));var config=require(_0x2991('0x7'));var jayson=require(_0x2991('0x8'));var client=jayson[_0x2991('0x9')][_0x2991('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ada96,_0x49b9f5,_0x39a960){return new BPromise(function(_0x34cb5e,_0x2f9280){return client[_0x2991('0xb')](_0x3ada96,_0x39a960)[_0x2991('0xc')](function(_0x2cde16){logger[_0x2991('0xd')](_0x2991('0xe'),_0x49b9f5,_0x2991('0xf'));logger[_0x2991('0x10')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x49b9f5,_0x2991('0xf'),JSON['stringify'](_0x2cde16));if(_0x2cde16[_0x2991('0x11')]){if(_0x2cde16[_0x2991('0x11')]['code']===0x1f4){logger[_0x2991('0x11')](_0x2991('0xe'),_0x49b9f5,_0x2cde16[_0x2991('0x11')][_0x2991('0x12')]);return _0x2f9280(_0x2cde16[_0x2991('0x11')][_0x2991('0x12')]);}logger[_0x2991('0x11')](_0x2991('0xe'),_0x49b9f5,_0x2cde16[_0x2991('0x11')][_0x2991('0x12')]);return _0x34cb5e(_0x2cde16[_0x2991('0x11')][_0x2991('0x12')]);}else{logger['info'](_0x2991('0xe'),_0x49b9f5,_0x2991('0xf'));_0x34cb5e(_0x2cde16['result']['message']);}})[_0x2991('0x13')](function(_0x147321){logger[_0x2991('0x11')](_0x2991('0xe'),_0x49b9f5,_0x147321);_0x2f9280(_0x147321);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index f8b14ee..4633cd0 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 _0x99b7=['put','/:id','update','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','/:id/download','download','join','server/files/sounds/original/','originalname','replace','format','%s-%s%s','extname','now','post','file','create'];(function(_0x209180,_0x4ef262){var _0x359174=function(_0x59be0f){while(--_0x59be0f){_0x209180['push'](_0x209180['shift']());}};_0x359174(++_0x4ef262);}(_0x99b7,0x193));var _0x799b=function(_0x261522,_0x1adc1f){_0x261522=_0x261522-0x0;var _0x98a25a=_0x99b7[_0x261522];return _0x98a25a;};'use strict';var multer=require('multer');var util=require(_0x799b('0x0'));var path=require('path');var timeout=require(_0x799b('0x1'));var express=require(_0x799b('0x2'));var router=express['Router']();var auth=require(_0x799b('0x3'));var interaction=require(_0x799b('0x4'));var config=require('../../config/environment');var controller=require('./sound.controller');router[_0x799b('0x5')]('/',auth[_0x799b('0x6')](),controller[_0x799b('0x7')]);router[_0x799b('0x5')]('/:id',auth[_0x799b('0x6')](),controller[_0x799b('0x8')]);router[_0x799b('0x5')](_0x799b('0x9'),auth[_0x799b('0x6')](),controller[_0x799b('0xa')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x300081,_0x261a5e,_0x4518cb){_0x4518cb(null,path[_0x799b('0xb')](config['root'],_0x799b('0xc')));},'filename':function(_0x52611f,_0x311a6c,_0x5a36e6){_0x311a6c[_0x799b('0xd')]=_0x311a6c[_0x799b('0xd')][_0x799b('0xe')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5a36e6(null,util[_0x799b('0xf')](_0x799b('0x10'),path['basename'](_0x311a6c[_0x799b('0xd')],path[_0x799b('0x11')](_0x311a6c[_0x799b('0xd')])),Date[_0x799b('0x12')](),path[_0x799b('0x11')](_0x311a6c[_0x799b('0xd')])));}})});router[_0x799b('0x13')]('/',upload['single'](_0x799b('0x14')),controller[_0x799b('0x15')]);router[_0x799b('0x16')](_0x799b('0x17'),auth[_0x799b('0x6')](),controller[_0x799b('0x18')]);router['delete']('/:id',auth['isAuthenticated'](),controller['delete']);module['exports']=router; \ No newline at end of file +var _0x62ca=['get','index','/:id','isAuthenticated','show','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','basename','extname','post','single','file','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0xe0ef2f,_0x5f01c3){var _0x40e015=function(_0x40ca6e){while(--_0x40ca6e){_0xe0ef2f['push'](_0xe0ef2f['shift']());}};_0x40e015(++_0x5f01c3);}(_0x62ca,0x110));var _0xa62c=function(_0x2e89e4,_0x4735fe){_0x2e89e4=_0x2e89e4-0x0;var _0xbc0002=_0x62ca[_0x2e89e4];return _0xbc0002;};'use strict';var multer=require(_0xa62c('0x0'));var util=require('util');var path=require(_0xa62c('0x1'));var timeout=require(_0xa62c('0x2'));var express=require(_0xa62c('0x3'));var router=express[_0xa62c('0x4')]();var auth=require(_0xa62c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa62c('0x6'));var controller=require('./sound.controller');router[_0xa62c('0x7')]('/',auth['isAuthenticated'](),controller[_0xa62c('0x8')]);router[_0xa62c('0x7')](_0xa62c('0x9'),auth[_0xa62c('0xa')](),controller[_0xa62c('0xb')]);router[_0xa62c('0x7')](_0xa62c('0xc'),auth['isAuthenticated'](),controller[_0xa62c('0xd')]);var upload=multer({'storage':multer[_0xa62c('0xe')]({'destination':function(_0x3dfc88,_0x488156,_0x3954bc){_0x3954bc(null,path[_0xa62c('0xf')](config[_0xa62c('0x10')],_0xa62c('0x11')));},'filename':function(_0x57cf88,_0x6dd65e,_0x5b30e5){_0x6dd65e[_0xa62c('0x12')]=_0x6dd65e[_0xa62c('0x12')][_0xa62c('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5b30e5(null,util[_0xa62c('0x14')]('%s-%s%s',path[_0xa62c('0x15')](_0x6dd65e[_0xa62c('0x12')],path[_0xa62c('0x16')](_0x6dd65e['originalname'])),Date['now'](),path[_0xa62c('0x16')](_0x6dd65e[_0xa62c('0x12')])));}})});router[_0xa62c('0x17')]('/',upload[_0xa62c('0x18')](_0xa62c('0x19')),controller[_0xa62c('0x1a')]);router[_0xa62c('0x1b')](_0xa62c('0x9'),auth[_0xa62c('0xa')](),controller[_0xa62c('0x1c')]);router[_0xa62c('0x1d')](_0xa62c('0x9'),auth['isAuthenticated'](),controller[_0xa62c('0x1d')]);module[_0xa62c('0x1e')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index dc9af72..2aa75f0 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 _0x8534=['sequelize','exports','STRING','BIGINT','INTEGER'];(function(_0x32d113,_0x283c9d){var _0x5b2ab1=function(_0x556c77){while(--_0x556c77){_0x32d113['push'](_0x32d113['shift']());}};_0x5b2ab1(++_0x283c9d);}(_0x8534,0x145));var _0x4853=function(_0x173585,_0x2286c7){_0x173585=_0x173585-0x0;var _0x5e0672=_0x8534[_0x173585];return _0x5e0672;};'use strict';var Sequelize=require(_0x4853('0x0'));module[_0x4853('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x4853('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x4853('0x2')]},'original_format':{'type':Sequelize[_0x4853('0x2')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x4853('0x3')]},'original_channelCount':{'type':Sequelize[_0x4853('0x4')]},'original_bitRate':{'type':Sequelize[_0x4853('0x3')]},'original_sampleRate':{'type':Sequelize[_0x4853('0x4')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x4853('0x3')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x4853('0x3')]},'converted_sampleRate':{'type':Sequelize[_0x4853('0x4')]}}; \ No newline at end of file +var _0x6ae3=['INTEGER','sequelize','exports','STRING','FLOAT','BIGINT'];(function(_0x56cef5,_0x5f27bf){var _0x28b8a1=function(_0x181a55){while(--_0x181a55){_0x56cef5['push'](_0x56cef5['shift']());}};_0x28b8a1(++_0x5f27bf);}(_0x6ae3,0x12d));var _0x36ae=function(_0x3949d1,_0x3f58ce){_0x3949d1=_0x3949d1-0x0;var _0x178612=_0x6ae3[_0x3949d1];return _0x178612;};'use strict';var Sequelize=require(_0x36ae('0x0'));module[_0x36ae('0x1')]={'name':{'type':Sequelize[_0x36ae('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x36ae('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x36ae('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x36ae('0x3')]},'original_sampleCount':{'type':Sequelize[_0x36ae('0x4')]},'original_channelCount':{'type':Sequelize[_0x36ae('0x5')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x36ae('0x5')]},'converted_format':{'type':Sequelize[_0x36ae('0x2')]},'converted_duration':{'type':Sequelize[_0x36ae('0x3')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x36ae('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x36ae('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index ecfa3c2..30b5e7e 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 _0x4576=['sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_bitRate','role','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','pick','description','delete','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','index','Sound','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','options','includeAll','findAll','rows','catch','params','length','include','merge','find','save_name','converted_format','join','root','server/files/sounds/converted','Sound\x20not\x20found','download','format','%s.%s','create','file','originalname','extname','filename','substring','basename','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','wav','error','unlinkSync','original_duration','duration','original_sampleCount'];(function(_0x532e3c,_0x54fd19){var _0x76d74b=function(_0x33c005){while(--_0x33c005){_0x532e3c['push'](_0x532e3c['shift']());}};_0x76d74b(++_0x54fd19);}(_0x4576,0x17f));var _0x6457=function(_0xa75cb1,_0x3c4b1f){_0xa75cb1=_0xa75cb1-0x0;var _0xe6f1a3=_0x4576[_0xa75cb1];return _0xe6f1a3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6457('0x0'));var rimraf=require(_0x6457('0x1'));var zipdir=require(_0x6457('0x2'));var jsonpatch=require(_0x6457('0x3'));var rp=require(_0x6457('0x4'));var moment=require(_0x6457('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6457('0x6'));var util=require(_0x6457('0x7'));var path=require('path');var sox=require(_0x6457('0x8'));var csv=require('to-csv');var ejs=require(_0x6457('0x9'));var fs=require('fs');var _=require(_0x6457('0xa'));var squel=require('squel');var crypto=require(_0x6457('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6457('0xc'));var toCsv=require(_0x6457('0xd'));var querystring=require(_0x6457('0xe'));var Papa=require(_0x6457('0xf'));var Redis=require(_0x6457('0x10'));var authService=require(_0x6457('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6457('0x12'));var logger=require(_0x6457('0x13'))('api');var utils=require(_0x6457('0x14'));var config=require('../../config/environment');var db=require(_0x6457('0x15'))['db'];function respondWithStatusCode(_0x3bb5dd,_0x3e3150){_0x3e3150=_0x3e3150||0xcc;return function(_0x43988a){if(_0x43988a){return _0x3bb5dd[_0x6457('0x16')](_0x3e3150);}return _0x3bb5dd[_0x6457('0x17')](_0x3e3150)[_0x6457('0x18')]();};}function respondWithResult(_0xa8f9cf,_0x126564){_0x126564=_0x126564||0xc8;return function(_0x586a7f){if(_0x586a7f){return _0xa8f9cf[_0x6457('0x17')](_0x126564)[_0x6457('0x19')](_0x586a7f);}};}function respondWithFilteredResult(_0xa7075,_0xb2f2c5){return function(_0x1dc9e1){if(_0x1dc9e1){var _0x2b68dc=_0x1dc9e1[_0x6457('0x1a')],_0x29b967=_0xb2f2c5[_0x6457('0x1b')],_0x2ab8cb=_0xb2f2c5[_0x6457('0x1b')]+_0xb2f2c5[_0x6457('0x1c')],_0x1d8ec8;if(_0x2ab8cb>=_0x2b68dc){_0x2ab8cb=_0x2b68dc;_0x1d8ec8=0xc8;}else{_0x1d8ec8=0xce;}_0xa7075[_0x6457('0x17')](_0x1d8ec8);return _0xa7075[_0x6457('0x1d')](_0x6457('0x1e'),_0x29b967+'-'+_0x2ab8cb+'/'+_0x2b68dc)[_0x6457('0x19')](_0x1dc9e1);}return null;};}function patchUpdates(_0x47be6b){return function(_0x4b89c4){try{jsonpatch[_0x6457('0x1f')](_0x4b89c4,_0x47be6b,!![]);}catch(_0x82f905){return BPromise[_0x6457('0x20')](_0x82f905);}return _0x4b89c4[_0x6457('0x21')]();};}function saveUpdates(_0x5561b4,_0xae9679){return function(_0x765068){if(_0x765068){return _0x765068[_0x6457('0x22')](_0x5561b4)[_0x6457('0x23')](function(_0x466d01){return _0x466d01;});}return null;};}function removeEntity(_0x574dc1,_0x32d00c){return function(_0x1c06a8){if(_0x1c06a8){return _0x1c06a8[_0x6457('0x24')]()['then'](function(){var _0x1a82d1=_0x1c06a8[_0x6457('0x25')]({'plain':!![]});var _0x5497a0='Sounds';return db[_0x6457('0x26')][_0x6457('0x24')]({'where':{'type':_0x5497a0,'resourceId':_0x1a82d1['id']}})[_0x6457('0x23')](function(){return _0x1c06a8;});})[_0x6457('0x23')](function(){_0x574dc1[_0x6457('0x17')](0xcc)[_0x6457('0x18')]();});}};}function handleEntityNotFound(_0xe9a619,_0x5a8c52){return function(_0x580e96){if(!_0x580e96){_0xe9a619[_0x6457('0x16')](0x194);}return _0x580e96;};}function handleError(_0x5876d6,_0xfc8c0){_0xfc8c0=_0xfc8c0||0x1f4;return function(_0x1243b1){logger['error'](_0x1243b1[_0x6457('0x27')]);if(_0x1243b1[_0x6457('0x28')]){delete _0x1243b1[_0x6457('0x28')];}_0x5876d6[_0x6457('0x17')](_0xfc8c0)[_0x6457('0x29')](_0x1243b1);};}exports[_0x6457('0x2a')]=function(_0x454bf7,_0x242c59){var _0x462e13={},_0x49a783={},_0x2edf7d={'count':0x0,'rows':[]};var _0x5095b8=_['map'](db[_0x6457('0x2b')][_0x6457('0x2c')],function(_0x48273b){return{'name':_0x48273b['fieldName'],'type':_0x48273b[_0x6457('0x2d')][_0x6457('0x2e')]};});_0x49a783[_0x6457('0x2f')]=_['map'](_0x5095b8,_0x6457('0x28'));_0x49a783[_0x6457('0x30')]=_[_0x6457('0x31')](_0x454bf7[_0x6457('0x30')]);_0x49a783[_0x6457('0x32')]=_[_0x6457('0x33')](_0x49a783['model'],_0x49a783[_0x6457('0x30')]);_0x462e13[_0x6457('0x34')]=_[_0x6457('0x33')](_0x49a783[_0x6457('0x2f')],qs[_0x6457('0x35')](_0x454bf7[_0x6457('0x30')][_0x6457('0x35')]));_0x462e13[_0x6457('0x34')]=_0x462e13[_0x6457('0x34')]['length']?_0x462e13[_0x6457('0x34')]:_0x49a783[_0x6457('0x2f')];if(!_0x454bf7['query'][_0x6457('0x36')](_0x6457('0x37'))){_0x462e13['limit']=qs[_0x6457('0x1c')](_0x454bf7['query'][_0x6457('0x1c')]);_0x462e13[_0x6457('0x1b')]=qs['offset'](_0x454bf7[_0x6457('0x30')][_0x6457('0x1b')]);}_0x462e13[_0x6457('0x38')]=qs[_0x6457('0x39')](_0x454bf7['query'][_0x6457('0x39')]);_0x462e13[_0x6457('0x3a')]=qs['filters'](_['pick'](_0x454bf7[_0x6457('0x30')],_0x49a783[_0x6457('0x32')]),_0x5095b8);if(_0x454bf7['query'][_0x6457('0x3b')]){_0x462e13[_0x6457('0x3a')]=_['merge'](_0x462e13[_0x6457('0x3a')],{'$or':_['map'](_0x5095b8,function(_0x4468f6){if(_0x4468f6['type']!=='VIRTUAL'){var _0x703f55={};_0x703f55[_0x4468f6['name']]={'$like':'%'+_0x454bf7[_0x6457('0x30')][_0x6457('0x3b')]+'%'};return _0x703f55;}})});}_0x462e13=_['merge']({},_0x462e13,_0x454bf7[_0x6457('0x3c')]);var _0x10bd9e={'where':_0x462e13[_0x6457('0x3a')]};return db[_0x6457('0x2b')]['count'](_0x10bd9e)[_0x6457('0x23')](function(_0x3fd0d8){_0x2edf7d['count']=_0x3fd0d8;if(_0x454bf7[_0x6457('0x30')][_0x6457('0x3d')]){_0x462e13['include']=[{'all':!![]}];}return db[_0x6457('0x2b')][_0x6457('0x3e')](_0x462e13);})[_0x6457('0x23')](function(_0x28636e){_0x2edf7d[_0x6457('0x3f')]=_0x28636e;return _0x2edf7d;})['then'](respondWithFilteredResult(_0x242c59,_0x462e13))[_0x6457('0x40')](handleError(_0x242c59,null));};exports['show']=function(_0x23aae0,_0x5ac4b1){var _0xb1540e={'raw':!![],'where':{'id':_0x23aae0[_0x6457('0x41')]['id']}},_0x52178c={};_0x52178c['model']=_['keys'](db[_0x6457('0x2b')][_0x6457('0x2c')]);_0x52178c[_0x6457('0x30')]=_[_0x6457('0x31')](_0x23aae0['query']);_0x52178c['filters']=_['intersection'](_0x52178c['model'],_0x52178c[_0x6457('0x30')]);_0xb1540e[_0x6457('0x34')]=_['intersection'](_0x52178c['model'],qs['fields'](_0x23aae0[_0x6457('0x30')][_0x6457('0x35')]));_0xb1540e['attributes']=_0xb1540e['attributes'][_0x6457('0x42')]?_0xb1540e['attributes']:_0x52178c['model'];if(_0x23aae0[_0x6457('0x30')][_0x6457('0x3d')]){_0xb1540e[_0x6457('0x43')]=[{'all':!![]}];}_0xb1540e=_[_0x6457('0x44')]({},_0xb1540e,_0x23aae0[_0x6457('0x3c')]);return db['Sound'][_0x6457('0x45')](_0xb1540e)[_0x6457('0x23')](handleEntityNotFound(_0x5ac4b1,null))['then'](respondWithResult(_0x5ac4b1,null))[_0x6457('0x40')](handleError(_0x5ac4b1,null));};exports['download']=function(_0xb9f3b3,_0x51bcbf,_0x601c98){return db[_0x6457('0x2b')]['find']({'where':{'id':_0xb9f3b3['params']['id']},'attributes':['name',_0x6457('0x46'),_0x6457('0x47')],'raw':!![]})[_0x6457('0x23')](handleEntityNotFound(_0x51bcbf,null))[_0x6457('0x23')](function(_0x1195ef){if(_0x1195ef){if(!fs['existsSync'](path[_0x6457('0x48')](config[_0x6457('0x49')],_0x6457('0x4a'),_0x1195ef['save_name']+'.'+_0x1195ef[_0x6457('0x47')]))){throw new db['Sequelize']['ValidationError'](_0x6457('0x4b'));}return _0x51bcbf[_0x6457('0x4c')](path['join'](config[_0x6457('0x49')],_0x6457('0x4a'),util['format']('%s.%s',_0x1195ef[_0x6457('0x46')],_0x1195ef['converted_format'])),util[_0x6457('0x4d')](_0x6457('0x4e'),_0x1195ef[_0x6457('0x28')],_0x1195ef[_0x6457('0x47')]));}return null;})[_0x6457('0x40')](handleError(_0x51bcbf,null));};exports[_0x6457('0x4f')]=function(_0x2af34b,_0x2a8c7b,_0x4b1d69){var _0x3c9b9d={'name':path['basename'](_0x2af34b[_0x6457('0x50')][_0x6457('0x51')],path[_0x6457('0x52')](_0x2af34b[_0x6457('0x50')][_0x6457('0x51')])),'save_name':path['basename'](_0x2af34b[_0x6457('0x50')]['filename'],path[_0x6457('0x52')](_0x2af34b[_0x6457('0x50')][_0x6457('0x53')])),'original_format':path[_0x6457('0x52')](_0x2af34b[_0x6457('0x50')][_0x6457('0x51')])[_0x6457('0x54')](0x1),'converted_format':'wav'};var _0x3874b6=path[_0x6457('0x48')](config[_0x6457('0x49')],'server/files/sounds/original',_0x2af34b[_0x6457('0x50')][_0x6457('0x53')]);var _0x3e307d=path[_0x6457('0x48')](config[_0x6457('0x49')],_0x6457('0x4a'),util[_0x6457('0x4d')](_0x6457('0x4e'),path[_0x6457('0x55')](_0x2af34b['file'][_0x6457('0x53')],path['extname'](_0x2af34b['file'][_0x6457('0x53')])),_0x3c9b9d[_0x6457('0x47')]));logger[_0x6457('0x56')]('Sound\x20upload\x20filepath:\x20%s',_0x3874b6);logger[_0x6457('0x56')](_0x6457('0x57'),_0x3e307d);try{fs[_0x6457('0x58')](_0x3874b6,parseInt(_0x6457('0x59'),0x8));var _0x29b800=sox[_0x6457('0x5a')](_0x3874b6,_0x3e307d,{'sampleRate':0x1f40,'format':_0x6457('0x5b'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x29b800['on'](_0x6457('0x5c'),function(_0x3c570a){fs[_0x6457('0x5d')](_0x3874b6);_0x2a8c7b[_0x6457('0x17')](0x1f4)[_0x6457('0x29')](_0x3c570a);});_0x29b800['on']('src',function(_0x22097c){_0x3c9b9d[_0x6457('0x5e')]=isNaN(_0x22097c[_0x6457('0x5f')])?null:_0x22097c[_0x6457('0x5f')]*0x3e8;_0x3c9b9d[_0x6457('0x60')]=isNaN(_0x22097c[_0x6457('0x61')])?null:_0x22097c[_0x6457('0x61')];_0x3c9b9d[_0x6457('0x62')]=isNaN(_0x22097c[_0x6457('0x63')])?null:_0x22097c[_0x6457('0x63')];_0x3c9b9d[_0x6457('0x64')]=isNaN(_0x22097c[_0x6457('0x65')])?null:_0x22097c[_0x6457('0x65')];_0x3c9b9d[_0x6457('0x66')]=isNaN(_0x22097c[_0x6457('0x67')])?null:_0x22097c[_0x6457('0x67')];});_0x29b800['on'](_0x6457('0x68'),function(_0x50e498){_0x3c9b9d[_0x6457('0x69')]=isNaN(_0x50e498[_0x6457('0x5f')])?null:_0x50e498[_0x6457('0x5f')]*0x3e8;_0x3c9b9d[_0x6457('0x6a')]=isNaN(_0x50e498[_0x6457('0x61')])?null:_0x50e498['sampleCount'];_0x3c9b9d['converted_channelCount']=isNaN(_0x50e498[_0x6457('0x63')])?null:_0x50e498[_0x6457('0x63')];_0x3c9b9d[_0x6457('0x6b')]=isNaN(_0x50e498[_0x6457('0x65')])?null:_0x50e498['bitRate'];_0x3c9b9d['converted_sampleRate']=isNaN(_0x50e498[_0x6457('0x67')])?null:_0x50e498[_0x6457('0x67')];});_0x29b800['on']('end',function(){fs[_0x6457('0x58')](_0x3e307d,parseInt(_0x6457('0x59'),0x8));return db[_0x6457('0x2b')][_0x6457('0x4f')](_0x3c9b9d)[_0x6457('0x23')](function(_0x2e1ad1){var _0x159a06={'role':_0x2af34b['body'][_0x6457('0x6c')],'userProfileId':_0x2af34b[_0x6457('0x6d')]['userProfileId']};if(!_0x159a06)throw new Error(_0x6457('0x6e'));if(_0x159a06[_0x6457('0x6c')]===_0x6457('0x6f')){var _0x24248c=_0x2e1ad1[_0x6457('0x25')]({'plain':!![]});return db[_0x6457('0x70')][_0x6457('0x45')]({'where':{'name':'Sounds','userProfileId':_0x159a06['userProfileId']},'raw':!![]})[_0x6457('0x23')](function(_0x2cca03){if(_0x2cca03&&_0x2cca03[_0x6457('0x71')]===0x0){return db[_0x6457('0x26')][_0x6457('0x4f')]({'name':_0x24248c[_0x6457('0x28')],'resourceId':_0x24248c['id'],'type':_0x2cca03['name'],'sectionId':_0x2cca03['id']},{})[_0x6457('0x23')](function(){return _0x2e1ad1;});}else{return _0x2e1ad1;}})['catch'](function(_0x183424){logger[_0x6457('0x5c')](_0x6457('0x72'),_0x183424);throw _0x183424;});}return _0x2e1ad1;})[_0x6457('0x23')](respondWithResult(_0x2a8c7b,null))[_0x6457('0x40')](handleError(_0x2a8c7b,null));});_0x29b800[_0x6457('0x73')]();}catch(_0x54379d){_0x2a8c7b['status'](0x1f4)[_0x6457('0x29')](_0x54379d);}};exports[_0x6457('0x22')]=function(_0x2b4e38,_0x57e376,_0x3fb499){return db[_0x6457('0x2b')][_0x6457('0x45')]({'where':{'id':_0x2b4e38[_0x6457('0x41')]['id']}})[_0x6457('0x23')](handleEntityNotFound(_0x57e376,null))[_0x6457('0x23')](saveUpdates(_[_0x6457('0x74')](_0x2b4e38[_0x6457('0x6d')],[_0x6457('0x28'),_0x6457('0x75')]),null))[_0x6457('0x23')](respondWithResult(_0x57e376,null))['catch'](handleError(_0x57e376,null));};exports[_0x6457('0x76')]=function(_0x38683b,_0x2df244,_0x134feb){return db['Sound']['find']({'where':{'id':_0x38683b[_0x6457('0x41')]['id']}})[_0x6457('0x23')](function(_0x17540d){if(_0x17540d){return _0x17540d[_0x6457('0x24')]();}})[_0x6457('0x23')](function(_0x659669){var _0x53eb0a=path[_0x6457('0x48')](config[_0x6457('0x49')],'server/files/sounds/original',util['format'](_0x6457('0x4e'),_0x659669[_0x6457('0x46')],_0x659669[_0x6457('0x77')]));var _0x55dfd5=path['join'](config[_0x6457('0x49')],'server/files/sounds/converted',util[_0x6457('0x4d')]('%s.%s',_0x659669[_0x6457('0x46')],_0x659669[_0x6457('0x47')]));fs['unlinkSync'](_0x53eb0a);fs[_0x6457('0x5d')](_0x55dfd5);return _0x659669;})['then'](function(_0x3a6275){if(_0x3a6275){return _0x2df244['status'](0xcc)[_0x6457('0x18')]();}})['then'](handleEntityNotFound(_0x2df244,null))['catch'](handleError(_0x2df244,null));}; \ No newline at end of file +var _0x066d=['order','sort','where','pick','filter','type','VIRTUAL','options','count','findAll','rows','catch','show','includeAll','include','find','params','save_name','converted_format','existsSync','join','root','Sequelize','ValidationError','server/files/sounds/converted','format','create','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','%s.%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','sampleRate','dest','converted_duration','duration','converted_sampleCount','converted_channelCount','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','original_format','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','save','update','destroy','then','get','Sounds','UserProfileResource','error','stack','name','send','index','map','Sound','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit'];(function(_0x36c1f0,_0x24b59f){var _0x39394a=function(_0x5ad06f){while(--_0x5ad06f){_0x36c1f0['push'](_0x36c1f0['shift']());}};_0x39394a(++_0x24b59f);}(_0x066d,0x1b0));var _0xd066=function(_0x3fd9c8,_0x3cb07a){_0x3fd9c8=_0x3fd9c8-0x0;var _0x5e1f37=_0x066d[_0x3fd9c8];return _0x5e1f37;};'use strict';var pdf=require(_0xd066('0x0'));var emlformat=require(_0xd066('0x1'));var rimraf=require(_0xd066('0x2'));var zipdir=require(_0xd066('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd066('0x4'));var moment=require(_0xd066('0x5'));var BPromise=require(_0xd066('0x6'));var Mustache=require(_0xd066('0x7'));var util=require(_0xd066('0x8'));var path=require(_0xd066('0x9'));var sox=require(_0xd066('0xa'));var csv=require('to-csv');var ejs=require(_0xd066('0xb'));var fs=require('fs');var _=require(_0xd066('0xc'));var squel=require(_0xd066('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd066('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd066('0xf'));var Papa=require(_0xd066('0x10'));var Redis=require('ioredis');var authService=require(_0xd066('0x11'));var qs=require(_0xd066('0x12'));var as=require(_0xd066('0x13'));var hardwareService=require(_0xd066('0x14'));var logger=require(_0xd066('0x15'))(_0xd066('0x16'));var utils=require(_0xd066('0x17'));var config=require(_0xd066('0x18'));var db=require(_0xd066('0x19'))['db'];function respondWithStatusCode(_0x111783,_0x5329a2){_0x5329a2=_0x5329a2||0xcc;return function(_0x543c12){if(_0x543c12){return _0x111783[_0xd066('0x1a')](_0x5329a2);}return _0x111783[_0xd066('0x1b')](_0x5329a2)[_0xd066('0x1c')]();};}function respondWithResult(_0x2b940f,_0x1feba4){_0x1feba4=_0x1feba4||0xc8;return function(_0x4e2bb1){if(_0x4e2bb1){return _0x2b940f[_0xd066('0x1b')](_0x1feba4)[_0xd066('0x1d')](_0x4e2bb1);}};}function respondWithFilteredResult(_0x4848a4,_0x5c7fe2){return function(_0x5ccb6b){if(_0x5ccb6b){var _0x3222ac=_0x5ccb6b['count'],_0x5e0cff=_0x5c7fe2[_0xd066('0x1e')],_0x3ff7f8=_0x5c7fe2[_0xd066('0x1e')]+_0x5c7fe2[_0xd066('0x1f')],_0x3ebe6e;if(_0x3ff7f8>=_0x3222ac){_0x3ff7f8=_0x3222ac;_0x3ebe6e=0xc8;}else{_0x3ebe6e=0xce;}_0x4848a4[_0xd066('0x1b')](_0x3ebe6e);return _0x4848a4[_0xd066('0x20')](_0xd066('0x21'),_0x5e0cff+'-'+_0x3ff7f8+'/'+_0x3222ac)[_0xd066('0x1d')](_0x5ccb6b);}return null;};}function patchUpdates(_0x4f3dd0){return function(_0xde6dc0){try{jsonpatch['apply'](_0xde6dc0,_0x4f3dd0,!![]);}catch(_0x47750d){return BPromise['reject'](_0x47750d);}return _0xde6dc0[_0xd066('0x22')]();};}function saveUpdates(_0x5f48c6,_0x45679d){return function(_0x3d1ea0){if(_0x3d1ea0){return _0x3d1ea0[_0xd066('0x23')](_0x5f48c6)['then'](function(_0x378c47){return _0x378c47;});}return null;};}function removeEntity(_0x1bede4,_0x509fd2){return function(_0x58e627){if(_0x58e627){return _0x58e627[_0xd066('0x24')]()[_0xd066('0x25')](function(){var _0xd30796=_0x58e627[_0xd066('0x26')]({'plain':!![]});var _0x51ef6b=_0xd066('0x27');return db[_0xd066('0x28')][_0xd066('0x24')]({'where':{'type':_0x51ef6b,'resourceId':_0xd30796['id']}})[_0xd066('0x25')](function(){return _0x58e627;});})[_0xd066('0x25')](function(){_0x1bede4[_0xd066('0x1b')](0xcc)[_0xd066('0x1c')]();});}};}function handleEntityNotFound(_0x404655,_0x299e2c){return function(_0x6e4bf4){if(!_0x6e4bf4){_0x404655[_0xd066('0x1a')](0x194);}return _0x6e4bf4;};}function handleError(_0x8abaa8,_0x28a874){_0x28a874=_0x28a874||0x1f4;return function(_0x2e4115){logger[_0xd066('0x29')](_0x2e4115[_0xd066('0x2a')]);if(_0x2e4115[_0xd066('0x2b')]){delete _0x2e4115[_0xd066('0x2b')];}_0x8abaa8[_0xd066('0x1b')](_0x28a874)[_0xd066('0x2c')](_0x2e4115);};}exports[_0xd066('0x2d')]=function(_0x46f357,_0x437364){var _0xd6c7f={},_0x4c5e07={},_0x247f41={'count':0x0,'rows':[]};var _0x14c306=_[_0xd066('0x2e')](db[_0xd066('0x2f')][_0xd066('0x30')],function(_0x455177){return{'name':_0x455177[_0xd066('0x31')],'type':_0x455177['type'][_0xd066('0x32')]};});_0x4c5e07[_0xd066('0x33')]=_['map'](_0x14c306,_0xd066('0x2b'));_0x4c5e07[_0xd066('0x34')]=_[_0xd066('0x35')](_0x46f357[_0xd066('0x34')]);_0x4c5e07[_0xd066('0x36')]=_[_0xd066('0x37')](_0x4c5e07[_0xd066('0x33')],_0x4c5e07[_0xd066('0x34')]);_0xd6c7f[_0xd066('0x38')]=_[_0xd066('0x37')](_0x4c5e07[_0xd066('0x33')],qs['fields'](_0x46f357['query'][_0xd066('0x39')]));_0xd6c7f['attributes']=_0xd6c7f[_0xd066('0x38')][_0xd066('0x3a')]?_0xd6c7f[_0xd066('0x38')]:_0x4c5e07[_0xd066('0x33')];if(!_0x46f357[_0xd066('0x34')]['hasOwnProperty'](_0xd066('0x3b'))){_0xd6c7f[_0xd066('0x1f')]=qs[_0xd066('0x1f')](_0x46f357[_0xd066('0x34')][_0xd066('0x1f')]);_0xd6c7f[_0xd066('0x1e')]=qs[_0xd066('0x1e')](_0x46f357['query']['offset']);}_0xd6c7f[_0xd066('0x3c')]=qs['sort'](_0x46f357[_0xd066('0x34')][_0xd066('0x3d')]);_0xd6c7f[_0xd066('0x3e')]=qs[_0xd066('0x36')](_[_0xd066('0x3f')](_0x46f357[_0xd066('0x34')],_0x4c5e07[_0xd066('0x36')]),_0x14c306);if(_0x46f357['query'][_0xd066('0x40')]){_0xd6c7f[_0xd066('0x3e')]=_['merge'](_0xd6c7f[_0xd066('0x3e')],{'$or':_[_0xd066('0x2e')](_0x14c306,function(_0xad3b2b){if(_0xad3b2b[_0xd066('0x41')]!==_0xd066('0x42')){var _0x4098a2={};_0x4098a2[_0xad3b2b[_0xd066('0x2b')]]={'$like':'%'+_0x46f357['query']['filter']+'%'};return _0x4098a2;}})});}_0xd6c7f=_['merge']({},_0xd6c7f,_0x46f357[_0xd066('0x43')]);var _0x9d6934={'where':_0xd6c7f[_0xd066('0x3e')]};return db[_0xd066('0x2f')]['count'](_0x9d6934)[_0xd066('0x25')](function(_0x1a65d9){_0x247f41[_0xd066('0x44')]=_0x1a65d9;if(_0x46f357[_0xd066('0x34')]['includeAll']){_0xd6c7f['include']=[{'all':!![]}];}return db[_0xd066('0x2f')][_0xd066('0x45')](_0xd6c7f);})[_0xd066('0x25')](function(_0x3c1712){_0x247f41[_0xd066('0x46')]=_0x3c1712;return _0x247f41;})[_0xd066('0x25')](respondWithFilteredResult(_0x437364,_0xd6c7f))[_0xd066('0x47')](handleError(_0x437364,null));};exports[_0xd066('0x48')]=function(_0x110140,_0x285a55){var _0x21fc73={'raw':!![],'where':{'id':_0x110140['params']['id']}},_0x5c5dc8={};_0x5c5dc8[_0xd066('0x33')]=_[_0xd066('0x35')](db[_0xd066('0x2f')]['rawAttributes']);_0x5c5dc8[_0xd066('0x34')]=_[_0xd066('0x35')](_0x110140[_0xd066('0x34')]);_0x5c5dc8[_0xd066('0x36')]=_[_0xd066('0x37')](_0x5c5dc8['model'],_0x5c5dc8[_0xd066('0x34')]);_0x21fc73[_0xd066('0x38')]=_[_0xd066('0x37')](_0x5c5dc8[_0xd066('0x33')],qs['fields'](_0x110140[_0xd066('0x34')][_0xd066('0x39')]));_0x21fc73[_0xd066('0x38')]=_0x21fc73[_0xd066('0x38')][_0xd066('0x3a')]?_0x21fc73['attributes']:_0x5c5dc8[_0xd066('0x33')];if(_0x110140[_0xd066('0x34')][_0xd066('0x49')]){_0x21fc73[_0xd066('0x4a')]=[{'all':!![]}];}_0x21fc73=_['merge']({},_0x21fc73,_0x110140['options']);return db[_0xd066('0x2f')][_0xd066('0x4b')](_0x21fc73)[_0xd066('0x25')](handleEntityNotFound(_0x285a55,null))[_0xd066('0x25')](respondWithResult(_0x285a55,null))[_0xd066('0x47')](handleError(_0x285a55,null));};exports['download']=function(_0x4946f6,_0x4758b9,_0x36acf0){return db['Sound'][_0xd066('0x4b')]({'where':{'id':_0x4946f6[_0xd066('0x4c')]['id']},'attributes':[_0xd066('0x2b'),_0xd066('0x4d'),_0xd066('0x4e')],'raw':!![]})[_0xd066('0x25')](handleEntityNotFound(_0x4758b9,null))[_0xd066('0x25')](function(_0x51ede7){if(_0x51ede7){if(!fs[_0xd066('0x4f')](path[_0xd066('0x50')](config[_0xd066('0x51')],'server/files/sounds/converted',_0x51ede7[_0xd066('0x4d')]+'.'+_0x51ede7[_0xd066('0x4e')]))){throw new db[(_0xd066('0x52'))][(_0xd066('0x53'))]('Sound\x20not\x20found');}return _0x4758b9['download'](path[_0xd066('0x50')](config[_0xd066('0x51')],_0xd066('0x54'),util[_0xd066('0x55')]('%s.%s',_0x51ede7[_0xd066('0x4d')],_0x51ede7['converted_format'])),util['format']('%s.%s',_0x51ede7[_0xd066('0x2b')],_0x51ede7['converted_format']));}return null;})[_0xd066('0x47')](handleError(_0x4758b9,null));};exports[_0xd066('0x56')]=function(_0x33644a,_0x413990,_0x1f9e30){var _0x50a32e={'name':path[_0xd066('0x57')](_0x33644a[_0xd066('0x58')][_0xd066('0x59')],path[_0xd066('0x5a')](_0x33644a[_0xd066('0x58')][_0xd066('0x59')])),'save_name':path['basename'](_0x33644a[_0xd066('0x58')][_0xd066('0x5b')],path[_0xd066('0x5a')](_0x33644a[_0xd066('0x58')][_0xd066('0x5b')])),'original_format':path[_0xd066('0x5a')](_0x33644a[_0xd066('0x58')][_0xd066('0x59')])[_0xd066('0x5c')](0x1),'converted_format':_0xd066('0x5d')};var _0x6302a4=path['join'](config['root'],_0xd066('0x5e'),_0x33644a[_0xd066('0x58')][_0xd066('0x5b')]);var _0x36780e=path[_0xd066('0x50')](config[_0xd066('0x51')],_0xd066('0x54'),util[_0xd066('0x55')](_0xd066('0x5f'),path[_0xd066('0x57')](_0x33644a[_0xd066('0x58')][_0xd066('0x5b')],path[_0xd066('0x5a')](_0x33644a[_0xd066('0x58')][_0xd066('0x5b')])),_0x50a32e[_0xd066('0x4e')]));logger[_0xd066('0x60')]('Sound\x20upload\x20filepath:\x20%s',_0x6302a4);logger[_0xd066('0x60')](_0xd066('0x61'),_0x36780e);try{fs[_0xd066('0x62')](_0x6302a4,parseInt(_0xd066('0x63'),0x8));var _0x1c03a5=sox[_0xd066('0x64')](_0x6302a4,_0x36780e,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1c03a5['on'](_0xd066('0x29'),function(_0x370e74){fs[_0xd066('0x65')](_0x6302a4);_0x413990['status'](0x1f4)[_0xd066('0x2c')](_0x370e74);});_0x1c03a5['on'](_0xd066('0x66'),function(_0x136051){_0x50a32e['original_duration']=isNaN(_0x136051['duration'])?null:_0x136051['duration']*0x3e8;_0x50a32e[_0xd066('0x67')]=isNaN(_0x136051['sampleCount'])?null:_0x136051[_0xd066('0x68')];_0x50a32e[_0xd066('0x69')]=isNaN(_0x136051['channelCount'])?null:_0x136051[_0xd066('0x6a')];_0x50a32e['original_bitRate']=isNaN(_0x136051[_0xd066('0x6b')])?null:_0x136051['bitRate'];_0x50a32e['original_sampleRate']=isNaN(_0x136051[_0xd066('0x6c')])?null:_0x136051[_0xd066('0x6c')];});_0x1c03a5['on'](_0xd066('0x6d'),function(_0x108b42){_0x50a32e[_0xd066('0x6e')]=isNaN(_0x108b42[_0xd066('0x6f')])?null:_0x108b42['duration']*0x3e8;_0x50a32e[_0xd066('0x70')]=isNaN(_0x108b42['sampleCount'])?null:_0x108b42[_0xd066('0x68')];_0x50a32e[_0xd066('0x71')]=isNaN(_0x108b42[_0xd066('0x6a')])?null:_0x108b42[_0xd066('0x6a')];_0x50a32e['converted_bitRate']=isNaN(_0x108b42['bitRate'])?null:_0x108b42[_0xd066('0x6b')];_0x50a32e['converted_sampleRate']=isNaN(_0x108b42['sampleRate'])?null:_0x108b42[_0xd066('0x6c')];});_0x1c03a5['on']('end',function(){fs[_0xd066('0x62')](_0x36780e,parseInt('0777',0x8));return db[_0xd066('0x2f')][_0xd066('0x56')](_0x50a32e)['then'](function(_0x3d497b){var _0x5201b8={'role':_0x33644a[_0xd066('0x72')][_0xd066('0x73')],'userProfileId':_0x33644a[_0xd066('0x72')][_0xd066('0x74')]};if(!_0x5201b8)throw new Error(_0xd066('0x75'));if(_0x5201b8['role']===_0xd066('0x76')){var _0x297079=_0x3d497b[_0xd066('0x26')]({'plain':!![]});return db['UserProfileSection'][_0xd066('0x4b')]({'where':{'name':'Sounds','userProfileId':_0x5201b8[_0xd066('0x74')]},'raw':!![]})['then'](function(_0x31cc0e){if(_0x31cc0e&&_0x31cc0e[_0xd066('0x77')]===0x0){return db[_0xd066('0x28')]['create']({'name':_0x297079[_0xd066('0x2b')],'resourceId':_0x297079['id'],'type':_0x31cc0e[_0xd066('0x2b')],'sectionId':_0x31cc0e['id']},{})[_0xd066('0x25')](function(){return _0x3d497b;});}else{return _0x3d497b;}})[_0xd066('0x47')](function(_0x4a1526){logger['error'](_0xd066('0x78'),_0x4a1526);throw _0x4a1526;});}return _0x3d497b;})[_0xd066('0x25')](respondWithResult(_0x413990,null))['catch'](handleError(_0x413990,null));});_0x1c03a5[_0xd066('0x79')]();}catch(_0x478ece){_0x413990[_0xd066('0x1b')](0x1f4)[_0xd066('0x2c')](_0x478ece);}};exports['update']=function(_0x52eabe,_0x52320e,_0x5ed828){return db[_0xd066('0x2f')][_0xd066('0x4b')]({'where':{'id':_0x52eabe['params']['id']}})[_0xd066('0x25')](handleEntityNotFound(_0x52320e,null))[_0xd066('0x25')](saveUpdates(_[_0xd066('0x3f')](_0x52eabe[_0xd066('0x72')],[_0xd066('0x2b'),'description']),null))['then'](respondWithResult(_0x52320e,null))['catch'](handleError(_0x52320e,null));};exports['delete']=function(_0x52a8c6,_0x2573d2,_0x4c1344){return db[_0xd066('0x2f')][_0xd066('0x4b')]({'where':{'id':_0x52a8c6['params']['id']}})[_0xd066('0x25')](function(_0x116c73){if(_0x116c73){return _0x116c73[_0xd066('0x24')]();}})[_0xd066('0x25')](function(_0x147216){var _0x4792a8=path[_0xd066('0x50')](config['root'],_0xd066('0x5e'),util['format'](_0xd066('0x5f'),_0x147216[_0xd066('0x4d')],_0x147216[_0xd066('0x7a')]));var _0x1f5791=path[_0xd066('0x50')](config[_0xd066('0x51')],'server/files/sounds/converted',util[_0xd066('0x55')](_0xd066('0x5f'),_0x147216[_0xd066('0x4d')],_0x147216[_0xd066('0x4e')]));fs['unlinkSync'](_0x4792a8);fs[_0xd066('0x65')](_0x1f5791);return _0x147216;})['then'](function(_0x189802){if(_0x189802){return _0x2573d2['status'](0xcc)[_0xd066('0x1c')]();}})[_0xd066('0x25')](handleEntityNotFound(_0x2573d2,null))['catch'](handleError(_0x2573d2,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 8671d31..e0567dd 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 _0xddac=['tools_sounds','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound'];(function(_0x3f85e8,_0x21f569){var _0x4ed379=function(_0x467741){while(--_0x467741){_0x3f85e8['push'](_0x3f85e8['shift']());}};_0x4ed379(++_0x21f569);}(_0xddac,0x6d));var _0xcdda=function(_0x369cc9,_0x2b10f1){_0x369cc9=_0x369cc9-0x0;var _0x535156=_0xddac[_0x369cc9];return _0x535156;};'use strict';var _=require(_0xcdda('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcdda('0x1'));var moment=require('moment');var BPromise=require(_0xcdda('0x2'));var rp=require(_0xcdda('0x3'));var fs=require('fs');var path=require(_0xcdda('0x4'));var rimraf=require(_0xcdda('0x5'));var config=require(_0xcdda('0x6'));var attributes=require(_0xcdda('0x7'));module[_0xcdda('0x8')]=function(_0x54e347,_0x48adaf){return _0x54e347[_0xcdda('0x9')](_0xcdda('0xa'),attributes,{'tableName':_0xcdda('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2d1=['bluebird','request-promise','path','rimraf','exports','define','Sound','tools_sounds','lodash','util','api','moment'];(function(_0x5282f0,_0x537c5d){var _0x32f3d4=function(_0x9f1412){while(--_0x9f1412){_0x5282f0['push'](_0x5282f0['shift']());}};_0x32f3d4(++_0x537c5d);}(_0xd2d1,0x80));var _0x1d2d=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd2d1[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x1d2d('0x0'));var util=require(_0x1d2d('0x1'));var logger=require('../../config/logger')(_0x1d2d('0x2'));var moment=require(_0x1d2d('0x3'));var BPromise=require(_0x1d2d('0x4'));var rp=require(_0x1d2d('0x5'));var fs=require('fs');var path=require(_0x1d2d('0x6'));var rimraf=require(_0x1d2d('0x7'));var config=require('../../config/environment');var attributes=require('./sound.attributes');module[_0x1d2d('0x8')]=function(_0x465810,_0x84136a){return _0x465810[_0x1d2d('0x9')](_0x1d2d('0xa'),attributes,{'tableName':_0x1d2d('0xb'),'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 30e2e8b..1552fb3 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 _0xd213=['request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','ShowSound','Sound','find','options','raw','include','map','model','attributes','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Sound,\x20%s,\x20%s'];(function(_0x2cae99,_0x2c4acb){var _0x2748b6=function(_0x277351){while(--_0x277351){_0x2cae99['push'](_0x2cae99['shift']());}};_0x2748b6(++_0x2c4acb);}(_0xd213,0xd8));var _0x3d21=function(_0x4f93a9,_0x2793c3){_0x4f93a9=_0x4f93a9-0x0;var _0x8fab33=_0xd213[_0x4f93a9];return _0x8fab33;};'use strict';var _=require(_0x3d21('0x0'));var util=require(_0x3d21('0x1'));var moment=require('moment');var BPromise=require(_0x3d21('0x2'));var rs=require(_0x3d21('0x3'));var fs=require('fs');var Redis=require(_0x3d21('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3d21('0x5'));var logger=require(_0x3d21('0x6'))(_0x3d21('0x7'));var config=require(_0x3d21('0x8'));var jayson=require(_0x3d21('0x9'));var client=jayson[_0x3d21('0xa')][_0x3d21('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x348705,_0x207390,_0x4dad54){return new BPromise(function(_0x37161c,_0x1bb65c){return client[_0x3d21('0xc')](_0x348705,_0x4dad54)[_0x3d21('0xd')](function(_0x3d62e2){logger['info'](_0x3d21('0xe'),_0x207390,_0x3d21('0xf'));logger[_0x3d21('0x10')](_0x3d21('0x11'),_0x207390,_0x3d21('0xf'),JSON['stringify'](_0x3d62e2));if(_0x3d62e2[_0x3d21('0x12')]){if(_0x3d62e2[_0x3d21('0x12')][_0x3d21('0x13')]===0x1f4){logger[_0x3d21('0x12')](_0x3d21('0xe'),_0x207390,_0x3d62e2['error'][_0x3d21('0x14')]);return _0x1bb65c(_0x3d62e2[_0x3d21('0x12')][_0x3d21('0x14')]);}logger[_0x3d21('0x12')]('Sound,\x20%s,\x20%s',_0x207390,_0x3d62e2[_0x3d21('0x12')]['message']);return _0x37161c(_0x3d62e2[_0x3d21('0x12')][_0x3d21('0x14')]);}else{logger[_0x3d21('0x15')]('Sound,\x20%s,\x20%s',_0x207390,'request\x20sent');_0x37161c(_0x3d62e2[_0x3d21('0x16')][_0x3d21('0x14')]);}})[_0x3d21('0x17')](function(_0x1f265f){logger[_0x3d21('0x12')]('Sound,\x20%s,\x20%s',_0x207390,_0x1f265f);_0x1bb65c(_0x1f265f);});});}exports[_0x3d21('0x18')]=function(_0x2ef54c){var _0x1c65aa=this;return new Promise(function(_0x3dacc4,_0x5313e5){return db[_0x3d21('0x19')][_0x3d21('0x1a')]({'raw':_0x2ef54c[_0x3d21('0x1b')]?_0x2ef54c[_0x3d21('0x1b')][_0x3d21('0x1c')]===undefined?!![]:![]:!![],'where':_0x2ef54c[_0x3d21('0x1b')]?_0x2ef54c['options']['where']||null:null,'attributes':_0x2ef54c['options']?_0x2ef54c[_0x3d21('0x1b')]['attributes']||null:null,'include':_0x2ef54c[_0x3d21('0x1b')]?_0x2ef54c['options'][_0x3d21('0x1d')]?_[_0x3d21('0x1e')](_0x2ef54c[_0x3d21('0x1b')][_0x3d21('0x1d')],function(_0x5bc589){return{'model':db[_0x5bc589[_0x3d21('0x1f')]],'as':_0x5bc589['as'],'attributes':_0x5bc589[_0x3d21('0x20')],'include':_0x5bc589[_0x3d21('0x1d')]?_[_0x3d21('0x1e')](_0x5bc589[_0x3d21('0x1d')],function(_0x467692){return{'model':db[_0x467692[_0x3d21('0x1f')]],'as':_0x467692['as'],'attributes':_0x467692[_0x3d21('0x20')],'include':_0x467692[_0x3d21('0x1d')]?_[_0x3d21('0x1e')](_0x467692[_0x3d21('0x1d')],function(_0x21e1d3){return{'model':db[_0x21e1d3[_0x3d21('0x1f')]],'as':_0x21e1d3['as'],'attributes':_0x21e1d3[_0x3d21('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x265fbc){logger[_0x3d21('0x15')](_0x3d21('0x18'),_0x2ef54c);logger['debug'](_0x3d21('0x18'),_0x2ef54c,JSON['stringify'](_0x265fbc));_0x3dacc4(_0x265fbc);})[_0x3d21('0x17')](function(_0x3bace7){logger['error'](_0x3d21('0x18'),_0x3bace7[_0x3d21('0x14')],_0x2ef54c);_0x5313e5(_0x1c65aa[_0x3d21('0x12')](0x1f4,_0x3bace7[_0x3d21('0x14')]));});});}; \ No newline at end of file +var _0xb93c=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Sound,\x20%s,\x20%s','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','ShowSound','Sound','find','options','raw','where','attributes','include','map','debug','util','moment','bluebird','randomstring'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0xb93c,0x104));var _0xcb93=function(_0x38223f,_0x3a0dfc){_0x38223f=_0x38223f-0x0;var _0x3e3fab=_0xb93c[_0x38223f];return _0x3e3fab;};'use strict';var _=require('lodash');var util=require(_0xcb93('0x0'));var moment=require(_0xcb93('0x1'));var BPromise=require(_0xcb93('0x2'));var rs=require(_0xcb93('0x3'));var fs=require('fs');var Redis=require(_0xcb93('0x4'));var db=require(_0xcb93('0x5'))['db'];var utils=require(_0xcb93('0x6'));var logger=require(_0xcb93('0x7'))(_0xcb93('0x8'));var config=require(_0xcb93('0x9'));var jayson=require(_0xcb93('0xa'));var client=jayson[_0xcb93('0xb')][_0xcb93('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x549f16,_0x330dce,_0x1f06b6){return new BPromise(function(_0xadd31e,_0x4f2b4e){return client['request'](_0x549f16,_0x1f06b6)[_0xcb93('0xd')](function(_0x52f915){logger[_0xcb93('0xe')](_0xcb93('0xf'),_0x330dce,'request\x20sent');logger['debug'](_0xcb93('0x10'),_0x330dce,_0xcb93('0x11'),JSON[_0xcb93('0x12')](_0x52f915));if(_0x52f915[_0xcb93('0x13')]){if(_0x52f915[_0xcb93('0x13')][_0xcb93('0x14')]===0x1f4){logger[_0xcb93('0x13')](_0xcb93('0xf'),_0x330dce,_0x52f915['error'][_0xcb93('0x15')]);return _0x4f2b4e(_0x52f915[_0xcb93('0x13')][_0xcb93('0x15')]);}logger[_0xcb93('0x13')](_0xcb93('0xf'),_0x330dce,_0x52f915[_0xcb93('0x13')][_0xcb93('0x15')]);return _0xadd31e(_0x52f915[_0xcb93('0x13')]['message']);}else{logger['info'](_0xcb93('0xf'),_0x330dce,_0xcb93('0x11'));_0xadd31e(_0x52f915['result']['message']);}})[_0xcb93('0x16')](function(_0x2ea6e1){logger[_0xcb93('0x13')](_0xcb93('0xf'),_0x330dce,_0x2ea6e1);_0x4f2b4e(_0x2ea6e1);});});}exports[_0xcb93('0x17')]=function(_0x1f3d20){var _0x5e59d7=this;return new Promise(function(_0x2f6a1a,_0x183566){return db[_0xcb93('0x18')][_0xcb93('0x19')]({'raw':_0x1f3d20[_0xcb93('0x1a')]?_0x1f3d20[_0xcb93('0x1a')][_0xcb93('0x1b')]===undefined?!![]:![]:!![],'where':_0x1f3d20[_0xcb93('0x1a')]?_0x1f3d20[_0xcb93('0x1a')][_0xcb93('0x1c')]||null:null,'attributes':_0x1f3d20[_0xcb93('0x1a')]?_0x1f3d20['options'][_0xcb93('0x1d')]||null:null,'include':_0x1f3d20[_0xcb93('0x1a')]?_0x1f3d20[_0xcb93('0x1a')][_0xcb93('0x1e')]?_[_0xcb93('0x1f')](_0x1f3d20[_0xcb93('0x1a')][_0xcb93('0x1e')],function(_0x2b6979){return{'model':db[_0x2b6979['model']],'as':_0x2b6979['as'],'attributes':_0x2b6979[_0xcb93('0x1d')],'include':_0x2b6979[_0xcb93('0x1e')]?_[_0xcb93('0x1f')](_0x2b6979[_0xcb93('0x1e')],function(_0x43f4e7){return{'model':db[_0x43f4e7['model']],'as':_0x43f4e7['as'],'attributes':_0x43f4e7['attributes'],'include':_0x43f4e7[_0xcb93('0x1e')]?_['map'](_0x43f4e7[_0xcb93('0x1e')],function(_0x1f4910){return{'model':db[_0x1f4910['model']],'as':_0x1f4910['as'],'attributes':_0x1f4910['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x52bb9d){logger[_0xcb93('0xe')](_0xcb93('0x17'),_0x1f3d20);logger[_0xcb93('0x20')]('ShowSound',_0x1f3d20,JSON['stringify'](_0x52bb9d));_0x2f6a1a(_0x52bb9d);})[_0xcb93('0x16')](function(_0xe5c71a){logger[_0xcb93('0x13')](_0xcb93('0x17'),_0xe5c71a[_0xcb93('0x15')],_0x1f3d20);_0x183566(_0x5e59d7[_0xcb93('0x13')](0x1f4,_0xe5c71a[_0xcb93('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 3c6dc26..1a8b56d 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 _0x4f89=['index','/:id','show','post','put','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x121e18,_0x581f6c){var _0x16bd33=function(_0x105958){while(--_0x105958){_0x121e18['push'](_0x121e18['shift']());}};_0x16bd33(++_0x581f6c);}(_0x4f89,0x138));var _0x94f8=function(_0x26b6f7,_0x38416a){_0x26b6f7=_0x26b6f7-0x0;var _0x11f763=_0x4f89[_0x26b6f7];return _0x11f763;};'use strict';var multer=require(_0x94f8('0x0'));var util=require(_0x94f8('0x1'));var path=require(_0x94f8('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x94f8('0x3')]();var auth=require(_0x94f8('0x4'));var interaction=require(_0x94f8('0x5'));var config=require('../../config/environment');var controller=require('./squareMessage.controller');router[_0x94f8('0x6')]('/',auth[_0x94f8('0x7')](),controller[_0x94f8('0x8')]);router[_0x94f8('0x6')](_0x94f8('0x9'),auth[_0x94f8('0x7')](),controller[_0x94f8('0xa')]);router[_0x94f8('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x94f8('0xc')](_0x94f8('0x9'),auth['isAuthenticated'](),controller[_0x94f8('0xd')]);router['delete'](_0x94f8('0x9'),auth[_0x94f8('0x7')](),controller[_0x94f8('0xe')]);module[_0x94f8('0xf')]=router; \ No newline at end of file +var _0x2010=['/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index'];(function(_0x465e40,_0x301f1d){var _0x2a04cd=function(_0x5b91a4){while(--_0x5b91a4){_0x465e40['push'](_0x465e40['shift']());}};_0x2a04cd(++_0x301f1d);}(_0x2010,0x197));var _0x0201=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2010[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0201('0x0'));var util=require(_0x0201('0x1'));var path=require(_0x0201('0x2'));var timeout=require(_0x0201('0x3'));var express=require(_0x0201('0x4'));var router=express[_0x0201('0x5')]();var auth=require(_0x0201('0x6'));var interaction=require(_0x0201('0x7'));var config=require(_0x0201('0x8'));var controller=require(_0x0201('0x9'));router[_0x0201('0xa')]('/',auth[_0x0201('0xb')](),controller[_0x0201('0xc')]);router[_0x0201('0xa')](_0x0201('0xd'),auth[_0x0201('0xb')](),controller[_0x0201('0xe')]);router[_0x0201('0xf')]('/',auth[_0x0201('0xb')](),controller['create']);router[_0x0201('0x10')](_0x0201('0xd'),auth['isAuthenticated'](),controller[_0x0201('0x11')]);router[_0x0201('0x12')](_0x0201('0xd'),auth[_0x0201('0xb')](),controller[_0x0201('0x13')]);module[_0x0201('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 0a560b2..12e08d7 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 _0x4929=['out','exports','STRING','TEXT','medium','ENUM'];(function(_0x53fff4,_0xed22df){var _0x3069b4=function(_0x402be4){while(--_0x402be4){_0x53fff4['push'](_0x53fff4['shift']());}};_0x3069b4(++_0xed22df);}(_0x4929,0xeb));var _0x9492=function(_0x4343c8,_0x4dd6ad){_0x4343c8=_0x4343c8-0x0;var _0x4c2b31=_0x4929[_0x4343c8];return _0x4c2b31;};'use strict';var Sequelize=require('sequelize');module[_0x9492('0x0')]={'uniqueid':{'type':Sequelize[_0x9492('0x1')]},'body':{'type':Sequelize[_0x9492('0x2')](_0x9492('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x9492('0x4')]('in',_0x9492('0x5')),'defaultValue':_0x9492('0x5'),'allowNull':![]}}; \ No newline at end of file +var _0x4ba5=['out','sequelize','STRING','ENUM'];(function(_0xcd7827,_0x5effe2){var _0x432f21=function(_0x3ffdc6){while(--_0x3ffdc6){_0xcd7827['push'](_0xcd7827['shift']());}};_0x432f21(++_0x5effe2);}(_0x4ba5,0x1ed));var _0x54ba=function(_0x337438,_0x157dec){_0x337438=_0x337438-0x0;var _0xfcffc2=_0x4ba5[_0x337438];return _0xfcffc2;};'use strict';var Sequelize=require(_0x54ba('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x54ba('0x1')]},'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x54ba('0x2')]('in',_0x54ba('0x3')),'defaultValue':_0x54ba('0x3'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index c9dd318..1895fea 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 _0xef5d=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','order','sort','where','filter','merge','options','includeAll','catch','show','include','find','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x512980,_0x401e50){var _0x571f0a=function(_0x456237){while(--_0x456237){_0x512980['push'](_0x512980['shift']());}};_0x571f0a(++_0x401e50);}(_0xef5d,0x19a));var _0xdef5=function(_0x3dfbcf,_0x138164){_0x3dfbcf=_0x3dfbcf-0x0;var _0x3c9987=_0xef5d[_0x3dfbcf];return _0x3c9987;};'use strict';var pdf=require(_0xdef5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xdef5('0x1'));var zipdir=require(_0xdef5('0x2'));var jsonpatch=require(_0xdef5('0x3'));var rp=require('request-promise');var moment=require(_0xdef5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdef5('0x5'));var util=require(_0xdef5('0x6'));var path=require('path');var sox=require(_0xdef5('0x7'));var csv=require(_0xdef5('0x8'));var ejs=require(_0xdef5('0x9'));var fs=require('fs');var _=require(_0xdef5('0xa'));var squel=require(_0xdef5('0xb'));var crypto=require('crypto');var jsforce=require(_0xdef5('0xc'));var deskjs=require(_0xdef5('0xd'));var toCsv=require(_0xdef5('0x8'));var querystring=require(_0xdef5('0xe'));var Papa=require(_0xdef5('0xf'));var Redis=require(_0xdef5('0x10'));var authService=require(_0xdef5('0x11'));var qs=require(_0xdef5('0x12'));var as=require(_0xdef5('0x13'));var hardwareService=require(_0xdef5('0x14'));var logger=require(_0xdef5('0x15'))(_0xdef5('0x16'));var utils=require(_0xdef5('0x17'));var config=require(_0xdef5('0x18'));var db=require(_0xdef5('0x19'))['db'];function respondWithStatusCode(_0x3f2654,_0x3373e0){_0x3373e0=_0x3373e0||0xcc;return function(_0x750216){if(_0x750216){return _0x3f2654[_0xdef5('0x1a')](_0x3373e0);}return _0x3f2654['status'](_0x3373e0)[_0xdef5('0x1b')]();};}function respondWithResult(_0x419cdb,_0x2d3134){_0x2d3134=_0x2d3134||0xc8;return function(_0x4f902c){if(_0x4f902c){return _0x419cdb[_0xdef5('0x1c')](_0x2d3134)[_0xdef5('0x1d')](_0x4f902c);}};}function respondWithFilteredResult(_0x5de514,_0x10434d){return function(_0x499a72){if(_0x499a72){var _0x737866=_0x499a72[_0xdef5('0x1e')],_0x11740c=_0x10434d[_0xdef5('0x1f')],_0x40f447=_0x10434d['offset']+_0x10434d[_0xdef5('0x20')],_0x2bfce6;if(_0x40f447>=_0x737866){_0x40f447=_0x737866;_0x2bfce6=0xc8;}else{_0x2bfce6=0xce;}_0x5de514[_0xdef5('0x1c')](_0x2bfce6);return _0x5de514[_0xdef5('0x21')](_0xdef5('0x22'),_0x11740c+'-'+_0x40f447+'/'+_0x737866)['json'](_0x499a72);}return null;};}function patchUpdates(_0x4e0dc1){return function(_0xeb8358){try{jsonpatch[_0xdef5('0x23')](_0xeb8358,_0x4e0dc1,!![]);}catch(_0x102123){return BPromise[_0xdef5('0x24')](_0x102123);}return _0xeb8358[_0xdef5('0x25')]();};}function saveUpdates(_0x2730b1,_0xf80f7f){return function(_0x2bc408){if(_0x2bc408){return _0x2bc408[_0xdef5('0x26')](_0x2730b1)[_0xdef5('0x27')](function(_0x526f63){return _0x526f63;});}return null;};}function removeEntity(_0x52497d,_0x431d0c){return function(_0x60a4f6){if(_0x60a4f6){return _0x60a4f6[_0xdef5('0x28')]()[_0xdef5('0x27')](function(){_0x52497d['status'](0xcc)[_0xdef5('0x1b')]();});}};}function handleEntityNotFound(_0x203b79,_0x234e19){return function(_0x30d8ab){if(!_0x30d8ab){_0x203b79[_0xdef5('0x1a')](0x194);}return _0x30d8ab;};}function handleError(_0x3aba29,_0x57975b){_0x57975b=_0x57975b||0x1f4;return function(_0xaed864){logger[_0xdef5('0x29')](_0xaed864['stack']);if(_0xaed864[_0xdef5('0x2a')]){delete _0xaed864[_0xdef5('0x2a')];}_0x3aba29['status'](_0x57975b)[_0xdef5('0x2b')](_0xaed864);};}exports[_0xdef5('0x2c')]=function(_0x5783a6,_0x69f92a){var _0x45e536={},_0x3927f1={},_0x18e2ba={'count':0x0,'rows':[]};var _0x2e24e8=_[_0xdef5('0x2d')](db[_0xdef5('0x2e')][_0xdef5('0x2f')],function(_0x57235c){return{'name':_0x57235c[_0xdef5('0x30')],'type':_0x57235c[_0xdef5('0x31')][_0xdef5('0x32')]};});_0x3927f1['model']=_[_0xdef5('0x2d')](_0x2e24e8,'name');_0x3927f1[_0xdef5('0x33')]=_[_0xdef5('0x34')](_0x5783a6[_0xdef5('0x33')]);_0x3927f1[_0xdef5('0x35')]=_['intersection'](_0x3927f1[_0xdef5('0x36')],_0x3927f1[_0xdef5('0x33')]);_0x45e536[_0xdef5('0x37')]=_[_0xdef5('0x38')](_0x3927f1['model'],qs[_0xdef5('0x39')](_0x5783a6[_0xdef5('0x33')][_0xdef5('0x39')]));_0x45e536[_0xdef5('0x37')]=_0x45e536['attributes'][_0xdef5('0x3a')]?_0x45e536['attributes']:_0x3927f1['model'];if(!_0x5783a6['query']['hasOwnProperty']('nolimit')){_0x45e536['limit']=qs[_0xdef5('0x20')](_0x5783a6[_0xdef5('0x33')][_0xdef5('0x20')]);_0x45e536[_0xdef5('0x1f')]=qs[_0xdef5('0x1f')](_0x5783a6[_0xdef5('0x33')][_0xdef5('0x1f')]);}_0x45e536[_0xdef5('0x3b')]=qs[_0xdef5('0x3c')](_0x5783a6['query'][_0xdef5('0x3c')]);_0x45e536[_0xdef5('0x3d')]=qs['filters'](_['pick'](_0x5783a6[_0xdef5('0x33')],_0x3927f1[_0xdef5('0x35')]),_0x2e24e8);if(_0x5783a6[_0xdef5('0x33')][_0xdef5('0x3e')]){_0x45e536['where']=_[_0xdef5('0x3f')](_0x45e536[_0xdef5('0x3d')],{'$or':_[_0xdef5('0x2d')](_0x2e24e8,function(_0xb20a0f){if(_0xb20a0f[_0xdef5('0x31')]!=='VIRTUAL'){var _0x1c0767={};_0x1c0767[_0xb20a0f[_0xdef5('0x2a')]]={'$like':'%'+_0x5783a6['query'][_0xdef5('0x3e')]+'%'};return _0x1c0767;}})});}_0x45e536=_[_0xdef5('0x3f')]({},_0x45e536,_0x5783a6[_0xdef5('0x40')]);var _0x3334c2={'where':_0x45e536[_0xdef5('0x3d')]};return db['SquareMessage']['count'](_0x3334c2)['then'](function(_0x1f0d3c){_0x18e2ba[_0xdef5('0x1e')]=_0x1f0d3c;if(_0x5783a6['query'][_0xdef5('0x41')]){_0x45e536['include']=[{'all':!![]}];}return db[_0xdef5('0x2e')]['findAll'](_0x45e536);})[_0xdef5('0x27')](function(_0x114c7f){_0x18e2ba['rows']=_0x114c7f;return _0x18e2ba;})[_0xdef5('0x27')](respondWithFilteredResult(_0x69f92a,_0x45e536))[_0xdef5('0x42')](handleError(_0x69f92a,null));};exports[_0xdef5('0x43')]=function(_0x41afa8,_0x1a8005){var _0x2ecea1={'raw':!![],'where':{'id':_0x41afa8['params']['id']}},_0xfe58f1={};_0xfe58f1[_0xdef5('0x36')]=_[_0xdef5('0x34')](db[_0xdef5('0x2e')][_0xdef5('0x2f')]);_0xfe58f1[_0xdef5('0x33')]=_[_0xdef5('0x34')](_0x41afa8[_0xdef5('0x33')]);_0xfe58f1[_0xdef5('0x35')]=_[_0xdef5('0x38')](_0xfe58f1[_0xdef5('0x36')],_0xfe58f1[_0xdef5('0x33')]);_0x2ecea1[_0xdef5('0x37')]=_['intersection'](_0xfe58f1[_0xdef5('0x36')],qs[_0xdef5('0x39')](_0x41afa8[_0xdef5('0x33')]['fields']));_0x2ecea1[_0xdef5('0x37')]=_0x2ecea1[_0xdef5('0x37')][_0xdef5('0x3a')]?_0x2ecea1[_0xdef5('0x37')]:_0xfe58f1[_0xdef5('0x36')];if(_0x41afa8[_0xdef5('0x33')][_0xdef5('0x41')]){_0x2ecea1[_0xdef5('0x44')]=[{'all':!![]}];}_0x2ecea1=_[_0xdef5('0x3f')]({},_0x2ecea1,_0x41afa8[_0xdef5('0x40')]);return db[_0xdef5('0x2e')][_0xdef5('0x45')](_0x2ecea1)[_0xdef5('0x27')](handleEntityNotFound(_0x1a8005,null))[_0xdef5('0x27')](respondWithResult(_0x1a8005,null))['catch'](handleError(_0x1a8005,null));};exports['create']=function(_0xc31876,_0x2b00ea){return db['SquareMessage'][_0xdef5('0x46')](_0xc31876[_0xdef5('0x47')],{})[_0xdef5('0x27')](respondWithResult(_0x2b00ea,0xc9))[_0xdef5('0x42')](handleError(_0x2b00ea,null));};exports['update']=function(_0x36190b,_0x445e2b){if(_0x36190b['body']['id']){delete _0x36190b[_0xdef5('0x47')]['id'];}return db['SquareMessage'][_0xdef5('0x45')]({'where':{'id':_0x36190b['params']['id']}})['then'](handleEntityNotFound(_0x445e2b,null))[_0xdef5('0x27')](saveUpdates(_0x36190b[_0xdef5('0x47')],null))[_0xdef5('0x27')](respondWithResult(_0x445e2b,null))['catch'](handleError(_0x445e2b,null));};exports[_0xdef5('0x28')]=function(_0x1a0f6b,_0x3ecfdc){return db[_0xdef5('0x2e')]['find']({'where':{'id':_0x1a0f6b['params']['id']}})[_0xdef5('0x27')](handleEntityNotFound(_0x3ecfdc,null))[_0xdef5('0x27')](removeEntity(_0x3ecfdc,null))['catch'](handleError(_0x3ecfdc,null));}; \ No newline at end of file +var _0xc3ee=['params','intersection','options','catch','create','body','find','html-pdf','rimraf','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','SquareMessage','includeAll','findAll'];(function(_0x5bf840,_0x37e230){var _0x1e0ad0=function(_0x4090bb){while(--_0x4090bb){_0x5bf840['push'](_0x5bf840['shift']());}};_0x1e0ad0(++_0x37e230);}(_0xc3ee,0x127));var _0xec3e=function(_0x3adf3b,_0x125e81){_0x3adf3b=_0x3adf3b-0x0;var _0xf843ff=_0xc3ee[_0x3adf3b];return _0xf843ff;};'use strict';var pdf=require(_0xec3e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xec3e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xec3e('0x2'));var rp=require(_0xec3e('0x3'));var moment=require(_0xec3e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xec3e('0x5'));var path=require(_0xec3e('0x6'));var sox=require(_0xec3e('0x7'));var csv=require('to-csv');var ejs=require(_0xec3e('0x8'));var fs=require('fs');var _=require(_0xec3e('0x9'));var squel=require(_0xec3e('0xa'));var crypto=require(_0xec3e('0xb'));var jsforce=require(_0xec3e('0xc'));var deskjs=require(_0xec3e('0xd'));var toCsv=require('to-csv');var querystring=require(_0xec3e('0xe'));var Papa=require(_0xec3e('0xf'));var Redis=require(_0xec3e('0x10'));var authService=require(_0xec3e('0x11'));var qs=require(_0xec3e('0x12'));var as=require(_0xec3e('0x13'));var hardwareService=require(_0xec3e('0x14'));var logger=require(_0xec3e('0x15'))(_0xec3e('0x16'));var utils=require('../../config/utils');var config=require(_0xec3e('0x17'));var db=require(_0xec3e('0x18'))['db'];function respondWithStatusCode(_0x399463,_0x5bf5cc){_0x5bf5cc=_0x5bf5cc||0xcc;return function(_0x197cbc){if(_0x197cbc){return _0x399463['sendStatus'](_0x5bf5cc);}return _0x399463[_0xec3e('0x19')](_0x5bf5cc)['end']();};}function respondWithResult(_0x8decf5,_0x3d08ec){_0x3d08ec=_0x3d08ec||0xc8;return function(_0x287823){if(_0x287823){return _0x8decf5[_0xec3e('0x19')](_0x3d08ec)['json'](_0x287823);}};}function respondWithFilteredResult(_0x813067,_0x19dc0d){return function(_0x24a228){if(_0x24a228){var _0x3d7a3d=_0x24a228['count'],_0x40bf78=_0x19dc0d['offset'],_0x1f52a7=_0x19dc0d[_0xec3e('0x1a')]+_0x19dc0d[_0xec3e('0x1b')],_0x138e6b;if(_0x1f52a7>=_0x3d7a3d){_0x1f52a7=_0x3d7a3d;_0x138e6b=0xc8;}else{_0x138e6b=0xce;}_0x813067['status'](_0x138e6b);return _0x813067[_0xec3e('0x1c')](_0xec3e('0x1d'),_0x40bf78+'-'+_0x1f52a7+'/'+_0x3d7a3d)[_0xec3e('0x1e')](_0x24a228);}return null;};}function patchUpdates(_0x371b37){return function(_0x28c2e6){try{jsonpatch[_0xec3e('0x1f')](_0x28c2e6,_0x371b37,!![]);}catch(_0x1929ca){return BPromise[_0xec3e('0x20')](_0x1929ca);}return _0x28c2e6[_0xec3e('0x21')]();};}function saveUpdates(_0x4fc1c1,_0x5d0ead){return function(_0x314250){if(_0x314250){return _0x314250[_0xec3e('0x22')](_0x4fc1c1)['then'](function(_0x4a7924){return _0x4a7924;});}return null;};}function removeEntity(_0x4e9d6d,_0x3b779d){return function(_0x377853){if(_0x377853){return _0x377853[_0xec3e('0x23')]()[_0xec3e('0x24')](function(){_0x4e9d6d[_0xec3e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38d12d,_0x14f6ca){return function(_0x40fc2d){if(!_0x40fc2d){_0x38d12d[_0xec3e('0x25')](0x194);}return _0x40fc2d;};}function handleError(_0xec37bd,_0x14e2ec){_0x14e2ec=_0x14e2ec||0x1f4;return function(_0x4af257){logger[_0xec3e('0x26')](_0x4af257[_0xec3e('0x27')]);if(_0x4af257['name']){delete _0x4af257[_0xec3e('0x28')];}_0xec37bd[_0xec3e('0x19')](_0x14e2ec)['send'](_0x4af257);};}exports[_0xec3e('0x29')]=function(_0x3bba67,_0x1580ec){var _0x4420c8={},_0xdcfefb={},_0xb7219c={'count':0x0,'rows':[]};var _0x3675ae=_['map'](db['SquareMessage'][_0xec3e('0x2a')],function(_0x2b9862){return{'name':_0x2b9862[_0xec3e('0x2b')],'type':_0x2b9862[_0xec3e('0x2c')][_0xec3e('0x2d')]};});_0xdcfefb[_0xec3e('0x2e')]=_[_0xec3e('0x2f')](_0x3675ae,_0xec3e('0x28'));_0xdcfefb[_0xec3e('0x30')]=_[_0xec3e('0x31')](_0x3bba67[_0xec3e('0x30')]);_0xdcfefb['filters']=_['intersection'](_0xdcfefb[_0xec3e('0x2e')],_0xdcfefb[_0xec3e('0x30')]);_0x4420c8[_0xec3e('0x32')]=_['intersection'](_0xdcfefb[_0xec3e('0x2e')],qs[_0xec3e('0x33')](_0x3bba67[_0xec3e('0x30')][_0xec3e('0x33')]));_0x4420c8[_0xec3e('0x32')]=_0x4420c8[_0xec3e('0x32')][_0xec3e('0x34')]?_0x4420c8[_0xec3e('0x32')]:_0xdcfefb[_0xec3e('0x2e')];if(!_0x3bba67[_0xec3e('0x30')][_0xec3e('0x35')](_0xec3e('0x36'))){_0x4420c8[_0xec3e('0x1b')]=qs[_0xec3e('0x1b')](_0x3bba67['query'][_0xec3e('0x1b')]);_0x4420c8[_0xec3e('0x1a')]=qs[_0xec3e('0x1a')](_0x3bba67[_0xec3e('0x30')][_0xec3e('0x1a')]);}_0x4420c8['order']=qs[_0xec3e('0x37')](_0x3bba67[_0xec3e('0x30')][_0xec3e('0x37')]);_0x4420c8[_0xec3e('0x38')]=qs[_0xec3e('0x39')](_[_0xec3e('0x3a')](_0x3bba67['query'],_0xdcfefb[_0xec3e('0x39')]),_0x3675ae);if(_0x3bba67[_0xec3e('0x30')][_0xec3e('0x3b')]){_0x4420c8['where']=_['merge'](_0x4420c8['where'],{'$or':_[_0xec3e('0x2f')](_0x3675ae,function(_0x642647){if(_0x642647[_0xec3e('0x2c')]!==_0xec3e('0x3c')){var _0x538b7a={};_0x538b7a[_0x642647[_0xec3e('0x28')]]={'$like':'%'+_0x3bba67[_0xec3e('0x30')][_0xec3e('0x3b')]+'%'};return _0x538b7a;}})});}_0x4420c8=_[_0xec3e('0x3d')]({},_0x4420c8,_0x3bba67['options']);var _0x3d6f1d={'where':_0x4420c8[_0xec3e('0x38')]};return db[_0xec3e('0x3e')]['count'](_0x3d6f1d)[_0xec3e('0x24')](function(_0x4372b0){_0xb7219c['count']=_0x4372b0;if(_0x3bba67[_0xec3e('0x30')][_0xec3e('0x3f')]){_0x4420c8['include']=[{'all':!![]}];}return db[_0xec3e('0x3e')][_0xec3e('0x40')](_0x4420c8);})[_0xec3e('0x24')](function(_0x38353a){_0xb7219c['rows']=_0x38353a;return _0xb7219c;})['then'](respondWithFilteredResult(_0x1580ec,_0x4420c8))['catch'](handleError(_0x1580ec,null));};exports['show']=function(_0x5654b5,_0x257216){var _0x263b03={'raw':!![],'where':{'id':_0x5654b5[_0xec3e('0x41')]['id']}},_0x507ad6={};_0x507ad6[_0xec3e('0x2e')]=_[_0xec3e('0x31')](db['SquareMessage'][_0xec3e('0x2a')]);_0x507ad6[_0xec3e('0x30')]=_[_0xec3e('0x31')](_0x5654b5['query']);_0x507ad6[_0xec3e('0x39')]=_[_0xec3e('0x42')](_0x507ad6['model'],_0x507ad6[_0xec3e('0x30')]);_0x263b03[_0xec3e('0x32')]=_[_0xec3e('0x42')](_0x507ad6[_0xec3e('0x2e')],qs[_0xec3e('0x33')](_0x5654b5[_0xec3e('0x30')][_0xec3e('0x33')]));_0x263b03[_0xec3e('0x32')]=_0x263b03[_0xec3e('0x32')][_0xec3e('0x34')]?_0x263b03[_0xec3e('0x32')]:_0x507ad6['model'];if(_0x5654b5['query'][_0xec3e('0x3f')]){_0x263b03['include']=[{'all':!![]}];}_0x263b03=_[_0xec3e('0x3d')]({},_0x263b03,_0x5654b5[_0xec3e('0x43')]);return db[_0xec3e('0x3e')]['find'](_0x263b03)[_0xec3e('0x24')](handleEntityNotFound(_0x257216,null))[_0xec3e('0x24')](respondWithResult(_0x257216,null))[_0xec3e('0x44')](handleError(_0x257216,null));};exports[_0xec3e('0x45')]=function(_0x260a65,_0x38f9bf){return db[_0xec3e('0x3e')]['create'](_0x260a65[_0xec3e('0x46')],{})['then'](respondWithResult(_0x38f9bf,0xc9))[_0xec3e('0x44')](handleError(_0x38f9bf,null));};exports[_0xec3e('0x22')]=function(_0x5e571e,_0x492cf7){if(_0x5e571e['body']['id']){delete _0x5e571e[_0xec3e('0x46')]['id'];}return db[_0xec3e('0x3e')]['find']({'where':{'id':_0x5e571e[_0xec3e('0x41')]['id']}})[_0xec3e('0x24')](handleEntityNotFound(_0x492cf7,null))[_0xec3e('0x24')](saveUpdates(_0x5e571e['body'],null))[_0xec3e('0x24')](respondWithResult(_0x492cf7,null))[_0xec3e('0x44')](handleError(_0x492cf7,null));};exports[_0xec3e('0x23')]=function(_0x399c82,_0x128a5c){return db[_0xec3e('0x3e')][_0xec3e('0x47')]({'where':{'id':_0x399c82['params']['id']}})[_0xec3e('0x24')](handleEntityNotFound(_0x128a5c,null))[_0xec3e('0x24')](removeEntity(_0x128a5c,null))[_0xec3e('0x44')](handleError(_0x128a5c,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 63b927c..ad213ee 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 _0x500f=['square_messages','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define'];(function(_0x5279cb,_0x1601be){var _0x55785a=function(_0x33fd36){while(--_0x33fd36){_0x5279cb['push'](_0x5279cb['shift']());}};_0x55785a(++_0x1601be);}(_0x500f,0x198));var _0xf500=function(_0x4c7d8b,_0x572388){_0x4c7d8b=_0x4c7d8b-0x0;var _0x187158=_0x500f[_0x4c7d8b];return _0x187158;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf500('0x0'))(_0xf500('0x1'));var moment=require(_0xf500('0x2'));var BPromise=require('bluebird');var rp=require(_0xf500('0x3'));var fs=require('fs');var path=require(_0xf500('0x4'));var rimraf=require(_0xf500('0x5'));var config=require(_0xf500('0x6'));var attributes=require(_0xf500('0x7'));module[_0xf500('0x8')]=function(_0x225e91,_0x2d97b8){return _0x225e91[_0xf500('0x9')]('SquareMessage',attributes,{'tableName':_0xf500('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef4b=['moment','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','square_messages','lodash','util','../../config/logger','api'];(function(_0x50e68f,_0x44c2f6){var _0xef3a05=function(_0x116727){while(--_0x116727){_0x50e68f['push'](_0x50e68f['shift']());}};_0xef3a05(++_0x44c2f6);}(_0xef4b,0x98));var _0xbef4=function(_0x3ba2f6,_0x13cdb9){_0x3ba2f6=_0x3ba2f6-0x0;var _0x5bf772=_0xef4b[_0x3ba2f6];return _0x5bf772;};'use strict';var _=require(_0xbef4('0x0'));var util=require(_0xbef4('0x1'));var logger=require(_0xbef4('0x2'))(_0xbef4('0x3'));var moment=require(_0xbef4('0x4'));var BPromise=require('bluebird');var rp=require(_0xbef4('0x5'));var fs=require('fs');var path=require(_0xbef4('0x6'));var rimraf=require(_0xbef4('0x7'));var config=require(_0xbef4('0x8'));var attributes=require(_0xbef4('0x9'));module[_0xbef4('0xa')]=function(_0x1166ff,_0x4c84c8){return _0x1166ff['define']('SquareMessage',attributes,{'tableName':_0xbef4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 127a9c7..806e83e 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 _0x8d0a=['rpc','jayson/promise','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x8d0a,0x172));var _0xa8d0=function(_0x50d9b8,_0x99855f){_0x50d9b8=_0x50d9b8-0x0;var _0x2b9e4a=_0x8d0a[_0x50d9b8];return _0x2b9e4a;};'use strict';var _=require(_0xa8d0('0x0'));var util=require(_0xa8d0('0x1'));var moment=require(_0xa8d0('0x2'));var BPromise=require('bluebird');var rs=require(_0xa8d0('0x3'));var fs=require('fs');var Redis=require(_0xa8d0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa8d0('0x5'));var logger=require(_0xa8d0('0x6'))(_0xa8d0('0x7'));var config=require('../../config/environment');var jayson=require(_0xa8d0('0x8'));var client=jayson[_0xa8d0('0x9')][_0xa8d0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x40c0b3,_0xeef6d9,_0x1032ed){return new BPromise(function(_0x14b0a0,_0x3d6cce){return client[_0xa8d0('0xb')](_0x40c0b3,_0x1032ed)[_0xa8d0('0xc')](function(_0x4550cf){logger[_0xa8d0('0xd')](_0xa8d0('0xe'),_0xeef6d9,_0xa8d0('0xf'));logger[_0xa8d0('0x10')](_0xa8d0('0x11'),_0xeef6d9,_0xa8d0('0xf'),JSON[_0xa8d0('0x12')](_0x4550cf));if(_0x4550cf[_0xa8d0('0x13')]){if(_0x4550cf[_0xa8d0('0x13')]['code']===0x1f4){logger['error'](_0xa8d0('0xe'),_0xeef6d9,_0x4550cf[_0xa8d0('0x13')]['message']);return _0x3d6cce(_0x4550cf['error'][_0xa8d0('0x14')]);}logger[_0xa8d0('0x13')](_0xa8d0('0xe'),_0xeef6d9,_0x4550cf[_0xa8d0('0x13')][_0xa8d0('0x14')]);return _0x14b0a0(_0x4550cf[_0xa8d0('0x13')][_0xa8d0('0x14')]);}else{logger[_0xa8d0('0xd')](_0xa8d0('0xe'),_0xeef6d9,_0xa8d0('0xf'));_0x14b0a0(_0x4550cf[_0xa8d0('0x15')]['message']);}})[_0xa8d0('0x16')](function(_0x3a3528){logger['error'](_0xa8d0('0xe'),_0xeef6d9,_0x3a3528);_0x3d6cce(_0x3a3528);});});}exports[_0xa8d0('0x17')]=function(_0x2899fb){var _0x434ad5=this;return new Promise(function(_0x34ce5d,_0x48e8c5){return db[_0xa8d0('0x18')][_0xa8d0('0x19')](_0x2899fb[_0xa8d0('0x1a')],{'raw':_0x2899fb[_0xa8d0('0x1b')]?_0x2899fb[_0xa8d0('0x1b')][_0xa8d0('0x1c')]===undefined?!![]:![]:!![]})[_0xa8d0('0xc')](function(_0x595452){logger[_0xa8d0('0xd')](_0xa8d0('0x17'),_0x2899fb);logger[_0xa8d0('0x10')](_0xa8d0('0x17'),_0x2899fb,JSON['stringify'](_0x595452));_0x34ce5d(_0x595452);})[_0xa8d0('0x16')](function(_0x31216e){logger[_0xa8d0('0x13')](_0xa8d0('0x17'),_0x31216e['message'],_0x2899fb);_0x48e8c5(_0x434ad5[_0xa8d0('0x13')](0x1f4,_0x31216e[_0xa8d0('0x14')]));});});}; \ No newline at end of file +var _0xf69d=['request','then','info','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','SquareMessage,\x20%s,\x20%s','catch','CreateSquareMessage','SquareMessage','body','options','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x304642,_0x59a898){var _0x2df7ad=function(_0x242786){while(--_0x242786){_0x304642['push'](_0x304642['shift']());}};_0x2df7ad(++_0x59a898);}(_0xf69d,0xd3));var _0xdf69=function(_0x3b710f,_0x214793){_0x3b710f=_0x3b710f-0x0;var _0x53f7c0=_0xf69d[_0x3b710f];return _0x53f7c0;};'use strict';var _=require(_0xdf69('0x0'));var util=require(_0xdf69('0x1'));var moment=require(_0xdf69('0x2'));var BPromise=require(_0xdf69('0x3'));var rs=require(_0xdf69('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf69('0x5'))['db'];var utils=require(_0xdf69('0x6'));var logger=require(_0xdf69('0x7'))(_0xdf69('0x8'));var config=require(_0xdf69('0x9'));var jayson=require(_0xdf69('0xa'));var client=jayson[_0xdf69('0xb')][_0xdf69('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1d2501,_0x12c186,_0x18a08e){return new BPromise(function(_0xc1b77e,_0x38909e){return client[_0xdf69('0xd')](_0x1d2501,_0x18a08e)[_0xdf69('0xe')](function(_0x211ea9){logger[_0xdf69('0xf')]('SquareMessage,\x20%s,\x20%s',_0x12c186,_0xdf69('0x10'));logger[_0xdf69('0x11')](_0xdf69('0x12'),_0x12c186,_0xdf69('0x10'),JSON[_0xdf69('0x13')](_0x211ea9));if(_0x211ea9[_0xdf69('0x14')]){if(_0x211ea9['error']['code']===0x1f4){logger['error']('SquareMessage,\x20%s,\x20%s',_0x12c186,_0x211ea9[_0xdf69('0x14')][_0xdf69('0x15')]);return _0x38909e(_0x211ea9[_0xdf69('0x14')][_0xdf69('0x15')]);}logger[_0xdf69('0x14')](_0xdf69('0x16'),_0x12c186,_0x211ea9['error'][_0xdf69('0x15')]);return _0xc1b77e(_0x211ea9[_0xdf69('0x14')][_0xdf69('0x15')]);}else{logger[_0xdf69('0xf')]('SquareMessage,\x20%s,\x20%s',_0x12c186,_0xdf69('0x10'));_0xc1b77e(_0x211ea9['result'][_0xdf69('0x15')]);}})[_0xdf69('0x17')](function(_0x5263a4){logger[_0xdf69('0x14')](_0xdf69('0x16'),_0x12c186,_0x5263a4);_0x38909e(_0x5263a4);});});}exports[_0xdf69('0x18')]=function(_0x85d1d){var _0x59bfd2=this;return new Promise(function(_0x5ae237,_0x352400){return db[_0xdf69('0x19')]['create'](_0x85d1d[_0xdf69('0x1a')],{'raw':_0x85d1d[_0xdf69('0x1b')]?_0x85d1d[_0xdf69('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xdf69('0xe')](function(_0x452cfa){logger['info']('CreateSquareMessage',_0x85d1d);logger[_0xdf69('0x11')](_0xdf69('0x18'),_0x85d1d,JSON[_0xdf69('0x13')](_0x452cfa));_0x5ae237(_0x452cfa);})['catch'](function(_0x50ef18){logger['error'](_0xdf69('0x18'),_0x50ef18['message'],_0x85d1d);_0x352400(_0x59bfd2[_0xdf69('0x14')](0x1f4,_0x50ef18[_0xdf69('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index c066b97..4f76671 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 _0x207a=['create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareOdbc.controller','get','/:id','show','/:id/test','isAuthenticated','15s','post'];(function(_0x335fe2,_0x32e58a){var _0x1ac963=function(_0x525b6b){while(--_0x525b6b){_0x335fe2['push'](_0x335fe2['shift']());}};_0x1ac963(++_0x32e58a);}(_0x207a,0x180));var _0xa207=function(_0x1e2040,_0x3a134c){_0x1e2040=_0x1e2040-0x0;var _0x5ab109=_0x207a[_0x1e2040];return _0x5ab109;};'use strict';var multer=require(_0xa207('0x0'));var util=require('util');var path=require(_0xa207('0x1'));var timeout=require(_0xa207('0x2'));var express=require(_0xa207('0x3'));var router=express[_0xa207('0x4')]();var auth=require(_0xa207('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa207('0x6'));var controller=require(_0xa207('0x7'));router[_0xa207('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa207('0x8')](_0xa207('0x9'),auth['isAuthenticated'](),controller[_0xa207('0xa')]);router['get'](_0xa207('0xb'),auth[_0xa207('0xc')](),timeout(_0xa207('0xd')),controller['test']);router[_0xa207('0xe')]('/',auth[_0xa207('0xc')](),controller[_0xa207('0xf')]);router[_0xa207('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xa207('0x11')]);router[_0xa207('0x12')](_0xa207('0x9'),auth['isAuthenticated'](),controller[_0xa207('0x13')]);module[_0xa207('0x14')]=router; \ No newline at end of file +var _0x2462=['create','update','delete','destroy','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','/:id/test','test','post'];(function(_0x2656de,_0x4bd932){var _0x2c6ecb=function(_0x10f9d3){while(--_0x10f9d3){_0x2656de['push'](_0x2656de['shift']());}};_0x2c6ecb(++_0x4bd932);}(_0x2462,0x77));var _0x2246=function(_0x3601ac,_0x2febca){_0x3601ac=_0x3601ac-0x0;var _0x595700=_0x2462[_0x3601ac];return _0x595700;};'use strict';var multer=require('multer');var util=require(_0x2246('0x0'));var path=require('path');var timeout=require(_0x2246('0x1'));var express=require('express');var router=express[_0x2246('0x2')]();var auth=require(_0x2246('0x3'));var interaction=require(_0x2246('0x4'));var config=require('../../config/environment');var controller=require(_0x2246('0x5'));router[_0x2246('0x6')]('/',auth[_0x2246('0x7')](),controller[_0x2246('0x8')]);router['get'](_0x2246('0x9'),auth[_0x2246('0x7')](),controller[_0x2246('0xa')]);router[_0x2246('0x6')](_0x2246('0xb'),auth[_0x2246('0x7')](),timeout('15s'),controller[_0x2246('0xc')]);router[_0x2246('0xd')]('/',auth[_0x2246('0x7')](),controller[_0x2246('0xe')]);router['put'](_0x2246('0x9'),auth['isAuthenticated'](),controller[_0x2246('0xf')]);router[_0x2246('0x10')](_0x2246('0x9'),auth[_0x2246('0x7')](),controller[_0x2246('0x11')]);module[_0x2246('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index f603138..6c9de28 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 _0xac09=['exports','STRING','name','sequelize'];(function(_0x466092,_0x2606ef){var _0x319cad=function(_0x59da5b){while(--_0x59da5b){_0x466092['push'](_0x466092['shift']());}};_0x319cad(++_0x2606ef);}(_0xac09,0x153));var _0x9ac0=function(_0xb84fc5,_0x281b53){_0xb84fc5=_0xb84fc5-0x0;var _0x26bbe3=_0xac09[_0xb84fc5];return _0x26bbe3;};'use strict';var Sequelize=require(_0x9ac0('0x0'));module[_0x9ac0('0x1')]={'name':{'type':Sequelize[_0x9ac0('0x2')],'unique':_0x9ac0('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x9ac0('0x2')]},'description':{'type':Sequelize[_0x9ac0('0x2')]}}; \ No newline at end of file +var _0xb200=['exports','STRING'];(function(_0x45b2ac,_0x3010da){var _0x304bf3=function(_0x486ac1){while(--_0x486ac1){_0x45b2ac['push'](_0x45b2ac['shift']());}};_0x304bf3(++_0x3010da);}(_0xb200,0x80));var _0x0b20=function(_0x30c9fd,_0x2614f0){_0x30c9fd=_0x30c9fd-0x0;var _0x397b35=_0xb200[_0x30c9fd];return _0x397b35;};'use strict';var Sequelize=require('sequelize');module[_0x0b20('0x0')]={'name':{'type':Sequelize[_0x0b20('0x1')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x0b20('0x1')]},'description':{'type':Sequelize[_0x0b20('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index d6e0ea2..c2d47ac 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 _0xe2fc=['sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','get','ODBC','UserProfileResource','destroy','end','error','stack','name','send','index','map','SquareOdbc','rawAttributes','key','keys','filters','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','params','length','find','create','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','dsn','closeSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../mysqldb'];(function(_0x579ef5,_0x1cea81){var _0x3674bb=function(_0x2d1d35){while(--_0x2d1d35){_0x579ef5['push'](_0x579ef5['shift']());}};_0x3674bb(++_0x1cea81);}(_0xe2fc,0x136));var _0xce2f=function(_0x4507a3,_0x394817){_0x4507a3=_0x4507a3-0x0;var _0x558bc4=_0xe2fc[_0x4507a3];return _0x558bc4;};'use strict';var pdf=require(_0xce2f('0x0'));var emlformat=require(_0xce2f('0x1'));var rimraf=require(_0xce2f('0x2'));var zipdir=require(_0xce2f('0x3'));var jsonpatch=require(_0xce2f('0x4'));var rp=require(_0xce2f('0x5'));var moment=require(_0xce2f('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xce2f('0x7'));var path=require(_0xce2f('0x8'));var sox=require(_0xce2f('0x9'));var csv=require(_0xce2f('0xa'));var ejs=require(_0xce2f('0xb'));var fs=require('fs');var _=require(_0xce2f('0xc'));var squel=require(_0xce2f('0xd'));var crypto=require(_0xce2f('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xce2f('0xf'));var Papa=require(_0xce2f('0x10'));var Redis=require('ioredis');var authService=require(_0xce2f('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xce2f('0x12'));var logger=require('../../config/logger')(_0xce2f('0x13'));var utils=require(_0xce2f('0x14'));var config=require('../../config/environment');var db=require(_0xce2f('0x15'))['db'];function respondWithStatusCode(_0x5a2d8f,_0x2ae369){_0x2ae369=_0x2ae369||0xcc;return function(_0x328960){if(_0x328960){return _0x5a2d8f[_0xce2f('0x16')](_0x2ae369);}return _0x5a2d8f[_0xce2f('0x17')](_0x2ae369)['end']();};}function respondWithResult(_0xd703c7,_0x3172aa){_0x3172aa=_0x3172aa||0xc8;return function(_0x51539b){if(_0x51539b){return _0xd703c7[_0xce2f('0x17')](_0x3172aa)[_0xce2f('0x18')](_0x51539b);}};}function respondWithFilteredResult(_0x84973,_0x262cc7){return function(_0x210f3b){if(_0x210f3b){var _0x550ac5=_0x210f3b[_0xce2f('0x19')],_0x5f32bc=_0x262cc7[_0xce2f('0x1a')],_0x1b8659=_0x262cc7[_0xce2f('0x1a')]+_0x262cc7[_0xce2f('0x1b')],_0x5119b6;if(_0x1b8659>=_0x550ac5){_0x1b8659=_0x550ac5;_0x5119b6=0xc8;}else{_0x5119b6=0xce;}_0x84973[_0xce2f('0x17')](_0x5119b6);return _0x84973[_0xce2f('0x1c')](_0xce2f('0x1d'),_0x5f32bc+'-'+_0x1b8659+'/'+_0x550ac5)[_0xce2f('0x18')](_0x210f3b);}return null;};}function patchUpdates(_0x353aa1){return function(_0x2ee99e){try{jsonpatch['apply'](_0x2ee99e,_0x353aa1,!![]);}catch(_0x397ab7){return BPromise[_0xce2f('0x1e')](_0x397ab7);}return _0x2ee99e[_0xce2f('0x1f')]();};}function saveUpdates(_0x60caf2,_0x1ba4bb){return function(_0x16dec2){if(_0x16dec2){return _0x16dec2[_0xce2f('0x20')](_0x60caf2)[_0xce2f('0x21')](function(_0x160067){return _0x160067;});}return null;};}function removeEntity(_0x35c2ba,_0x429aa7){return function(_0xabf8df){if(_0xabf8df){return _0xabf8df['destroy']()[_0xce2f('0x21')](function(){var _0x2b0f30=_0xabf8df[_0xce2f('0x22')]({'plain':!![]});var _0x1596fe=_0xce2f('0x23');return db[_0xce2f('0x24')][_0xce2f('0x25')]({'where':{'type':_0x1596fe,'resourceId':_0x2b0f30['id']}})['then'](function(){return _0xabf8df;});})[_0xce2f('0x21')](function(){_0x35c2ba[_0xce2f('0x17')](0xcc)[_0xce2f('0x26')]();});}};}function handleEntityNotFound(_0x50b010,_0xab3d96){return function(_0x196cdc){if(!_0x196cdc){_0x50b010['sendStatus'](0x194);}return _0x196cdc;};}function handleError(_0x538af0,_0x2cc21e){_0x2cc21e=_0x2cc21e||0x1f4;return function(_0x384232){logger[_0xce2f('0x27')](_0x384232[_0xce2f('0x28')]);if(_0x384232[_0xce2f('0x29')]){delete _0x384232[_0xce2f('0x29')];}_0x538af0[_0xce2f('0x17')](_0x2cc21e)[_0xce2f('0x2a')](_0x384232);};}exports[_0xce2f('0x2b')]=function(_0x2ff31a,_0x5d793a){var _0x3fbd61={},_0x56a05a={},_0x1cf279={'count':0x0,'rows':[]};var _0x220a2e=_[_0xce2f('0x2c')](db[_0xce2f('0x2d')][_0xce2f('0x2e')],function(_0xe0a677){return{'name':_0xe0a677['fieldName'],'type':_0xe0a677['type'][_0xce2f('0x2f')]};});_0x56a05a['model']=_[_0xce2f('0x2c')](_0x220a2e,_0xce2f('0x29'));_0x56a05a['query']=_[_0xce2f('0x30')](_0x2ff31a['query']);_0x56a05a[_0xce2f('0x31')]=_[_0xce2f('0x32')](_0x56a05a[_0xce2f('0x33')],_0x56a05a[_0xce2f('0x34')]);_0x3fbd61[_0xce2f('0x35')]=_[_0xce2f('0x32')](_0x56a05a['model'],qs[_0xce2f('0x36')](_0x2ff31a[_0xce2f('0x34')][_0xce2f('0x36')]));_0x3fbd61['attributes']=_0x3fbd61[_0xce2f('0x35')]['length']?_0x3fbd61[_0xce2f('0x35')]:_0x56a05a[_0xce2f('0x33')];if(!_0x2ff31a[_0xce2f('0x34')][_0xce2f('0x37')](_0xce2f('0x38'))){_0x3fbd61[_0xce2f('0x1b')]=qs[_0xce2f('0x1b')](_0x2ff31a['query'][_0xce2f('0x1b')]);_0x3fbd61[_0xce2f('0x1a')]=qs[_0xce2f('0x1a')](_0x2ff31a['query']['offset']);}_0x3fbd61[_0xce2f('0x39')]=qs[_0xce2f('0x3a')](_0x2ff31a[_0xce2f('0x34')][_0xce2f('0x3a')]);_0x3fbd61[_0xce2f('0x3b')]=qs['filters'](_[_0xce2f('0x3c')](_0x2ff31a[_0xce2f('0x34')],_0x56a05a[_0xce2f('0x31')]),_0x220a2e);if(_0x2ff31a[_0xce2f('0x34')][_0xce2f('0x3d')]){_0x3fbd61[_0xce2f('0x3b')]=_[_0xce2f('0x3e')](_0x3fbd61['where'],{'$or':_[_0xce2f('0x2c')](_0x220a2e,function(_0x456eef){if(_0x456eef[_0xce2f('0x3f')]!==_0xce2f('0x40')){var _0xbc16c={};_0xbc16c[_0x456eef['name']]={'$like':'%'+_0x2ff31a[_0xce2f('0x34')][_0xce2f('0x3d')]+'%'};return _0xbc16c;}})});}_0x3fbd61=_[_0xce2f('0x3e')]({},_0x3fbd61,_0x2ff31a[_0xce2f('0x41')]);var _0x5ce977={'where':_0x3fbd61[_0xce2f('0x3b')]};return db[_0xce2f('0x2d')]['count'](_0x5ce977)['then'](function(_0x541cdd){_0x1cf279[_0xce2f('0x19')]=_0x541cdd;if(_0x2ff31a[_0xce2f('0x34')][_0xce2f('0x42')]){_0x3fbd61[_0xce2f('0x43')]=[{'all':!![]}];}return db[_0xce2f('0x2d')][_0xce2f('0x44')](_0x3fbd61);})[_0xce2f('0x21')](function(_0x4ac8b9){_0x1cf279['rows']=_0x4ac8b9;return _0x1cf279;})[_0xce2f('0x21')](respondWithFilteredResult(_0x5d793a,_0x3fbd61))[_0xce2f('0x45')](handleError(_0x5d793a,null));};exports['show']=function(_0x51888d,_0x36b581){var _0x23b320={'raw':!![],'where':{'id':_0x51888d[_0xce2f('0x46')]['id']}},_0x6ceaef={};_0x6ceaef['model']=_[_0xce2f('0x30')](db['SquareOdbc']['rawAttributes']);_0x6ceaef[_0xce2f('0x34')]=_['keys'](_0x51888d[_0xce2f('0x34')]);_0x6ceaef[_0xce2f('0x31')]=_[_0xce2f('0x32')](_0x6ceaef[_0xce2f('0x33')],_0x6ceaef[_0xce2f('0x34')]);_0x23b320[_0xce2f('0x35')]=_[_0xce2f('0x32')](_0x6ceaef[_0xce2f('0x33')],qs['fields'](_0x51888d['query'][_0xce2f('0x36')]));_0x23b320[_0xce2f('0x35')]=_0x23b320[_0xce2f('0x35')][_0xce2f('0x47')]?_0x23b320[_0xce2f('0x35')]:_0x6ceaef['model'];if(_0x51888d[_0xce2f('0x34')][_0xce2f('0x42')]){_0x23b320[_0xce2f('0x43')]=[{'all':!![]}];}_0x23b320=_[_0xce2f('0x3e')]({},_0x23b320,_0x51888d['options']);return db[_0xce2f('0x2d')][_0xce2f('0x48')](_0x23b320)['then'](handleEntityNotFound(_0x36b581,null))[_0xce2f('0x21')](respondWithResult(_0x36b581,null))[_0xce2f('0x45')](handleError(_0x36b581,null));};exports['create']=function(_0xb6e7a3,_0x70f0c4){return db[_0xce2f('0x2d')][_0xce2f('0x49')](_0xb6e7a3['body'],{})[_0xce2f('0x21')](function(_0x19ebfc){var _0x3323e9=_0xb6e7a3[_0xce2f('0x4a')][_0xce2f('0x22')]({'plain':!![]});if(!_0x3323e9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3323e9[_0xce2f('0x4b')]===_0xce2f('0x4a')){var _0x287eb3=_0x19ebfc[_0xce2f('0x22')]({'plain':!![]});var _0x7dee79=_0xce2f('0x23');return db['UserProfileSection'][_0xce2f('0x48')]({'where':{'name':_0x7dee79,'userProfileId':_0x3323e9[_0xce2f('0x4c')]},'raw':!![]})['then'](function(_0x41be72){if(_0x41be72&&_0x41be72[_0xce2f('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x287eb3[_0xce2f('0x29')],'resourceId':_0x287eb3['id'],'type':_0x41be72['name'],'sectionId':_0x41be72['id']},{})[_0xce2f('0x21')](function(){return _0x19ebfc;});}else{return _0x19ebfc;}})[_0xce2f('0x45')](function(_0xf0019d){logger[_0xce2f('0x27')](_0xce2f('0x4e'),_0xf0019d);throw _0xf0019d;});}return _0x19ebfc;})[_0xce2f('0x21')](respondWithResult(_0x70f0c4,0xc9))[_0xce2f('0x45')](handleError(_0x70f0c4,null));};exports[_0xce2f('0x20')]=function(_0x4e0e25,_0x88447c){if(_0x4e0e25[_0xce2f('0x4f')]['id']){delete _0x4e0e25['body']['id'];}return db[_0xce2f('0x2d')][_0xce2f('0x48')]({'where':{'id':_0x4e0e25[_0xce2f('0x46')]['id']}})[_0xce2f('0x21')](handleEntityNotFound(_0x88447c,null))[_0xce2f('0x21')](saveUpdates(_0x4e0e25[_0xce2f('0x4f')],null))['then'](respondWithResult(_0x88447c,null))[_0xce2f('0x45')](handleError(_0x88447c,null));};exports['destroy']=function(_0x3ce82d,_0x5348db){return db['SquareOdbc'][_0xce2f('0x48')]({'where':{'id':_0x3ce82d['params']['id']}})[_0xce2f('0x21')](handleEntityNotFound(_0x5348db,null))[_0xce2f('0x21')](removeEntity(_0x5348db,null))[_0xce2f('0x45')](handleError(_0x5348db,null));};exports[_0xce2f('0x50')]=function(_0x1e312e,_0x54bc93,_0x14cb24){var _0x125684;return db['SquareOdbc']['find']({'where':{'id':_0x1e312e['params']['id']},'attributes':['id',_0xce2f('0x51')]})['then'](handleEntityNotFound(_0x54bc93,null))[_0xce2f('0x21')](function(_0x13ddb6){if(_0x13ddb6){var _0x4d986d=require('odbc')();_0x4d986d['openSync'](_0x13ddb6[_0xce2f('0x51')]);_0x4d986d[_0xce2f('0x52')]();return _0x13ddb6;}})['then'](respondWithResult(_0x54bc93,null))[_0xce2f('0x45')](handleError(_0x54bc93,null));}; \ No newline at end of file +var _0x9216=['SquareOdbc','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','length','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','dsn','odbc','openSync','closeSync','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','status','end','count','offset','limit','set','json','apply','reject','save','update','destroy','then','ODBC','UserProfileResource','error','stack','name','send','map'];(function(_0x40cf62,_0x2d5e35){var _0x5f1f2b=function(_0xdc22c8){while(--_0xdc22c8){_0x40cf62['push'](_0x40cf62['shift']());}};_0x5f1f2b(++_0x2d5e35);}(_0x9216,0x11f));var _0x6921=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x9216[_0xaa0309];return _0x5de7ce;};'use strict';var pdf=require(_0x6921('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6921('0x1'));var zipdir=require(_0x6921('0x2'));var jsonpatch=require(_0x6921('0x3'));var rp=require(_0x6921('0x4'));var moment=require(_0x6921('0x5'));var BPromise=require(_0x6921('0x6'));var Mustache=require(_0x6921('0x7'));var util=require(_0x6921('0x8'));var path=require(_0x6921('0x9'));var sox=require('sox');var csv=require(_0x6921('0xa'));var ejs=require(_0x6921('0xb'));var fs=require('fs');var _=require(_0x6921('0xc'));var squel=require(_0x6921('0xd'));var crypto=require('crypto');var jsforce=require(_0x6921('0xe'));var deskjs=require(_0x6921('0xf'));var toCsv=require(_0x6921('0xa'));var querystring=require(_0x6921('0x10'));var Papa=require(_0x6921('0x11'));var Redis=require(_0x6921('0x12'));var authService=require(_0x6921('0x13'));var qs=require(_0x6921('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6921('0x15'));var logger=require(_0x6921('0x16'))('api');var utils=require(_0x6921('0x17'));var config=require(_0x6921('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c9871,_0x1f7b79){_0x1f7b79=_0x1f7b79||0xcc;return function(_0x5a4226){if(_0x5a4226){return _0x3c9871['sendStatus'](_0x1f7b79);}return _0x3c9871[_0x6921('0x19')](_0x1f7b79)[_0x6921('0x1a')]();};}function respondWithResult(_0x41192c,_0x3b9193){_0x3b9193=_0x3b9193||0xc8;return function(_0x1fd9e6){if(_0x1fd9e6){return _0x41192c[_0x6921('0x19')](_0x3b9193)['json'](_0x1fd9e6);}};}function respondWithFilteredResult(_0x4cec6a,_0x460265){return function(_0x4621f6){if(_0x4621f6){var _0x518480=_0x4621f6[_0x6921('0x1b')],_0x42e442=_0x460265[_0x6921('0x1c')],_0x321d7d=_0x460265[_0x6921('0x1c')]+_0x460265[_0x6921('0x1d')],_0x42c1a6;if(_0x321d7d>=_0x518480){_0x321d7d=_0x518480;_0x42c1a6=0xc8;}else{_0x42c1a6=0xce;}_0x4cec6a[_0x6921('0x19')](_0x42c1a6);return _0x4cec6a[_0x6921('0x1e')]('Content-Range',_0x42e442+'-'+_0x321d7d+'/'+_0x518480)[_0x6921('0x1f')](_0x4621f6);}return null;};}function patchUpdates(_0x537886){return function(_0x13dcac){try{jsonpatch[_0x6921('0x20')](_0x13dcac,_0x537886,!![]);}catch(_0x1a9491){return BPromise[_0x6921('0x21')](_0x1a9491);}return _0x13dcac[_0x6921('0x22')]();};}function saveUpdates(_0x133c91,_0x52c2ef){return function(_0x7cf2dd){if(_0x7cf2dd){return _0x7cf2dd[_0x6921('0x23')](_0x133c91)['then'](function(_0x15c553){return _0x15c553;});}return null;};}function removeEntity(_0x3fd678,_0x45bea4){return function(_0x366695){if(_0x366695){return _0x366695[_0x6921('0x24')]()[_0x6921('0x25')](function(){var _0xb5a7a8=_0x366695['get']({'plain':!![]});var _0x1f1bbe=_0x6921('0x26');return db[_0x6921('0x27')]['destroy']({'where':{'type':_0x1f1bbe,'resourceId':_0xb5a7a8['id']}})[_0x6921('0x25')](function(){return _0x366695;});})[_0x6921('0x25')](function(){_0x3fd678[_0x6921('0x19')](0xcc)[_0x6921('0x1a')]();});}};}function handleEntityNotFound(_0x1b5699,_0x5191f7){return function(_0x1ae89f){if(!_0x1ae89f){_0x1b5699['sendStatus'](0x194);}return _0x1ae89f;};}function handleError(_0xb62c04,_0x20e068){_0x20e068=_0x20e068||0x1f4;return function(_0x257c7b){logger[_0x6921('0x28')](_0x257c7b[_0x6921('0x29')]);if(_0x257c7b[_0x6921('0x2a')]){delete _0x257c7b[_0x6921('0x2a')];}_0xb62c04[_0x6921('0x19')](_0x20e068)[_0x6921('0x2b')](_0x257c7b);};}exports['index']=function(_0x4b1691,_0x2e269f){var _0x975aa0={},_0x41302d={},_0x4f7dd7={'count':0x0,'rows':[]};var _0x4d374e=_[_0x6921('0x2c')](db[_0x6921('0x2d')][_0x6921('0x2e')],function(_0x4e0245){return{'name':_0x4e0245[_0x6921('0x2f')],'type':_0x4e0245[_0x6921('0x30')][_0x6921('0x31')]};});_0x41302d[_0x6921('0x32')]=_[_0x6921('0x2c')](_0x4d374e,_0x6921('0x2a'));_0x41302d[_0x6921('0x33')]=_[_0x6921('0x34')](_0x4b1691[_0x6921('0x33')]);_0x41302d[_0x6921('0x35')]=_['intersection'](_0x41302d['model'],_0x41302d[_0x6921('0x33')]);_0x975aa0[_0x6921('0x36')]=_[_0x6921('0x37')](_0x41302d['model'],qs['fields'](_0x4b1691[_0x6921('0x33')][_0x6921('0x38')]));_0x975aa0[_0x6921('0x36')]=_0x975aa0[_0x6921('0x36')]['length']?_0x975aa0['attributes']:_0x41302d[_0x6921('0x32')];if(!_0x4b1691[_0x6921('0x33')][_0x6921('0x39')]('nolimit')){_0x975aa0[_0x6921('0x1d')]=qs['limit'](_0x4b1691[_0x6921('0x33')][_0x6921('0x1d')]);_0x975aa0[_0x6921('0x1c')]=qs[_0x6921('0x1c')](_0x4b1691['query']['offset']);}_0x975aa0['order']=qs['sort'](_0x4b1691[_0x6921('0x33')]['sort']);_0x975aa0[_0x6921('0x3a')]=qs['filters'](_[_0x6921('0x3b')](_0x4b1691['query'],_0x41302d['filters']),_0x4d374e);if(_0x4b1691['query'][_0x6921('0x3c')]){_0x975aa0[_0x6921('0x3a')]=_[_0x6921('0x3d')](_0x975aa0[_0x6921('0x3a')],{'$or':_['map'](_0x4d374e,function(_0x25e8c0){if(_0x25e8c0[_0x6921('0x30')]!==_0x6921('0x3e')){var _0x5a68c6={};_0x5a68c6[_0x25e8c0['name']]={'$like':'%'+_0x4b1691[_0x6921('0x33')][_0x6921('0x3c')]+'%'};return _0x5a68c6;}})});}_0x975aa0=_['merge']({},_0x975aa0,_0x4b1691[_0x6921('0x3f')]);var _0x477471={'where':_0x975aa0[_0x6921('0x3a')]};return db['SquareOdbc'][_0x6921('0x1b')](_0x477471)[_0x6921('0x25')](function(_0x3834c3){_0x4f7dd7['count']=_0x3834c3;if(_0x4b1691[_0x6921('0x33')][_0x6921('0x40')]){_0x975aa0['include']=[{'all':!![]}];}return db[_0x6921('0x2d')]['findAll'](_0x975aa0);})['then'](function(_0x3dfd51){_0x4f7dd7[_0x6921('0x41')]=_0x3dfd51;return _0x4f7dd7;})[_0x6921('0x25')](respondWithFilteredResult(_0x2e269f,_0x975aa0))[_0x6921('0x42')](handleError(_0x2e269f,null));};exports['show']=function(_0x16d479,_0x2ff331){var _0x3ba8d3={'raw':!![],'where':{'id':_0x16d479['params']['id']}},_0x185f16={};_0x185f16[_0x6921('0x32')]=_[_0x6921('0x34')](db['SquareOdbc'][_0x6921('0x2e')]);_0x185f16[_0x6921('0x33')]=_[_0x6921('0x34')](_0x16d479[_0x6921('0x33')]);_0x185f16[_0x6921('0x35')]=_[_0x6921('0x37')](_0x185f16['model'],_0x185f16['query']);_0x3ba8d3[_0x6921('0x36')]=_['intersection'](_0x185f16[_0x6921('0x32')],qs[_0x6921('0x38')](_0x16d479[_0x6921('0x33')][_0x6921('0x38')]));_0x3ba8d3[_0x6921('0x36')]=_0x3ba8d3[_0x6921('0x36')][_0x6921('0x43')]?_0x3ba8d3['attributes']:_0x185f16['model'];if(_0x16d479[_0x6921('0x33')][_0x6921('0x40')]){_0x3ba8d3['include']=[{'all':!![]}];}_0x3ba8d3=_[_0x6921('0x3d')]({},_0x3ba8d3,_0x16d479[_0x6921('0x3f')]);return db[_0x6921('0x2d')][_0x6921('0x44')](_0x3ba8d3)[_0x6921('0x25')](handleEntityNotFound(_0x2ff331,null))['then'](respondWithResult(_0x2ff331,null))[_0x6921('0x42')](handleError(_0x2ff331,null));};exports[_0x6921('0x45')]=function(_0x4b2996,_0x49c1a7){return db[_0x6921('0x2d')]['create'](_0x4b2996[_0x6921('0x46')],{})['then'](function(_0x30771a){var _0x17f0fe=_0x4b2996[_0x6921('0x47')][_0x6921('0x48')]({'plain':!![]});if(!_0x17f0fe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x17f0fe[_0x6921('0x49')]==='user'){var _0x59d68=_0x30771a[_0x6921('0x48')]({'plain':!![]});var _0x429666='ODBC';return db[_0x6921('0x4a')][_0x6921('0x44')]({'where':{'name':_0x429666,'userProfileId':_0x17f0fe[_0x6921('0x4b')]},'raw':!![]})['then'](function(_0x298759){if(_0x298759&&_0x298759[_0x6921('0x4c')]===0x0){return db['UserProfileResource']['create']({'name':_0x59d68[_0x6921('0x2a')],'resourceId':_0x59d68['id'],'type':_0x298759[_0x6921('0x2a')],'sectionId':_0x298759['id']},{})[_0x6921('0x25')](function(){return _0x30771a;});}else{return _0x30771a;}})[_0x6921('0x42')](function(_0x291270){logger[_0x6921('0x28')](_0x6921('0x4d'),_0x291270);throw _0x291270;});}return _0x30771a;})[_0x6921('0x25')](respondWithResult(_0x49c1a7,0xc9))[_0x6921('0x42')](handleError(_0x49c1a7,null));};exports[_0x6921('0x23')]=function(_0x280892,_0x2f9a3a){if(_0x280892[_0x6921('0x46')]['id']){delete _0x280892[_0x6921('0x46')]['id'];}return db['SquareOdbc'][_0x6921('0x44')]({'where':{'id':_0x280892['params']['id']}})[_0x6921('0x25')](handleEntityNotFound(_0x2f9a3a,null))[_0x6921('0x25')](saveUpdates(_0x280892[_0x6921('0x46')],null))['then'](respondWithResult(_0x2f9a3a,null))[_0x6921('0x42')](handleError(_0x2f9a3a,null));};exports['destroy']=function(_0x3d5e6a,_0x766537){return db[_0x6921('0x2d')][_0x6921('0x44')]({'where':{'id':_0x3d5e6a['params']['id']}})['then'](handleEntityNotFound(_0x766537,null))['then'](removeEntity(_0x766537,null))['catch'](handleError(_0x766537,null));};exports['test']=function(_0x3f40f6,_0x597270,_0x26907c){var _0x1bef42;return db[_0x6921('0x2d')][_0x6921('0x44')]({'where':{'id':_0x3f40f6[_0x6921('0x4e')]['id']},'attributes':['id',_0x6921('0x4f')]})[_0x6921('0x25')](handleEntityNotFound(_0x597270,null))[_0x6921('0x25')](function(_0x280de4){if(_0x280de4){var _0x521f9e=require(_0x6921('0x50'))();_0x521f9e[_0x6921('0x51')](_0x280de4['dsn']);_0x521f9e[_0x6921('0x52')]();return _0x280de4;}})['then'](respondWithResult(_0x597270,null))['catch'](handleError(_0x597270,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 0724752..9cac99a 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 _0xa702=['lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','exports','SquareOdbc','square_odbc'];(function(_0x45e83a,_0x430070){var _0x2e46e9=function(_0x24c909){while(--_0x24c909){_0x45e83a['push'](_0x45e83a['shift']());}};_0x2e46e9(++_0x430070);}(_0xa702,0x1ae));var _0x2a70=function(_0x4ee098,_0x577ffd){_0x4ee098=_0x4ee098-0x0;var _0x10fa69=_0xa702[_0x4ee098];return _0x10fa69;};'use strict';var _=require(_0x2a70('0x0'));var util=require(_0x2a70('0x1'));var logger=require(_0x2a70('0x2'))(_0x2a70('0x3'));var moment=require(_0x2a70('0x4'));var BPromise=require('bluebird');var rp=require(_0x2a70('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2a70('0x6'));var attributes=require('./squareOdbc.attributes');module[_0x2a70('0x7')]=function(_0x16cdc3,_0x4b2915){return _0x16cdc3['define'](_0x2a70('0x8'),attributes,{'tableName':_0x2a70('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5eef=['./squareOdbc.attributes','define','SquareOdbc','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x16b930,_0xc2d3a1){var _0x506ba5=function(_0x4b2f1e){while(--_0x4b2f1e){_0x16b930['push'](_0x16b930['shift']());}};_0x506ba5(++_0xc2d3a1);}(_0x5eef,0x9c));var _0xf5ee=function(_0x38fe72,_0xca9a5b){_0x38fe72=_0x38fe72-0x0;var _0x2a5fa7=_0x5eef[_0x38fe72];return _0x2a5fa7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf5ee('0x0'))('api');var moment=require(_0xf5ee('0x1'));var BPromise=require('bluebird');var rp=require(_0xf5ee('0x2'));var fs=require('fs');var path=require(_0xf5ee('0x3'));var rimraf=require(_0xf5ee('0x4'));var config=require(_0xf5ee('0x5'));var attributes=require(_0xf5ee('0x6'));module['exports']=function(_0x4d4175,_0x594128){return _0x4d4175[_0xf5ee('0x7')](_0xf5ee('0x8'),attributes,{'tableName':'square_odbc','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 99a6e59..9acd274 100644 --- a/server/api/squareOdbc/squareOdbc.rpc.js +++ b/server/api/squareOdbc/squareOdbc.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['catch','SquareOdbc','find','options','raw','where','attributes','include','map','model','then','ShowSquareOdbc','stringify','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','SquareOdbc,\x20%s,\x20%s','message','info'];(function(_0x8550ba,_0x57c10d){var _0x432399=function(_0x33ab8a){while(--_0x33ab8a){_0x8550ba['push'](_0x8550ba['shift']());}};_0x432399(++_0x57c10d);}(_0x3e74,0x175));var _0x43e7=function(_0x46d91f,_0x733fb7){_0x46d91f=_0x46d91f-0x0;var _0x1d9053=_0x3e74[_0x46d91f];return _0x1d9053;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('SquareOdbc,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});}exports['ShowSquareOdbc']=function(_0x446986){var _0x1ca758=this;return new Promise(function(_0x9037d3,_0x140657){return db[_0x43e7('0x12')][_0x43e7('0x13')]({'raw':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x15')]===undefined?!![]:![]:!![],'where':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x16')]||null:null,'attributes':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x17')]||null:null,'include':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x18')]?_[_0x43e7('0x19')](_0x446986[_0x43e7('0x14')][_0x43e7('0x18')],function(_0x2f4cb4){return{'model':db[_0x2f4cb4['model']],'as':_0x2f4cb4['as'],'attributes':_0x2f4cb4[_0x43e7('0x17')],'include':_0x2f4cb4['include']?_['map'](_0x2f4cb4[_0x43e7('0x18')],function(_0x43f4ff){return{'model':db[_0x43f4ff['model']],'as':_0x43f4ff['as'],'attributes':_0x43f4ff[_0x43e7('0x17')],'include':_0x43f4ff['include']?_[_0x43e7('0x19')](_0x43f4ff['include'],function(_0x1af208){return{'model':db[_0x1af208[_0x43e7('0x1a')]],'as':_0x1af208['as'],'attributes':_0x1af208[_0x43e7('0x17')]};}):[]};}):[]};}):[]:[]})[_0x43e7('0x1b')](function(_0x51f4d7){logger['info'](_0x43e7('0x1c'),_0x446986);logger['debug'](_0x43e7('0x1c'),_0x446986,JSON[_0x43e7('0x1d')](_0x51f4d7));_0x9037d3(_0x51f4d7);})[_0x43e7('0x11')](function(_0xb1fc63){logger['error'](_0x43e7('0x1c'),_0xb1fc63[_0x43e7('0xf')],_0x446986);_0x140657(_0x1ca758[_0x43e7('0xd')](0x1f4,_0xb1fc63[_0x43e7('0xf')]));});});}; \ No newline at end of file +var _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(_0x1e909d,_0x4a8f3d){var _0x4762cd=function(_0x30cc4e){while(--_0x30cc4e){_0x1e909d['push'](_0x1e909d['shift']());}};_0x4762cd(++_0x4a8f3d);}(_0x008c,0x188));var _0xc008=function(_0x15f236,_0x59a12b){_0x15f236=_0x15f236-0x0;var _0x3645c0=_0x008c[_0x15f236];return _0x3645c0;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});}exports['ShowSquareOdbc']=function(_0x540e45){var _0x5c2668=this;return new Promise(function(_0x46042b,_0x462af5){return db['SquareOdbc'][_0xc008('0x15')]({'raw':_0x540e45['options']?_0x540e45['options']['raw']===undefined?!![]:![]:!![],'where':_0x540e45['options']?_0x540e45[_0xc008('0x16')]['where']||null:null,'attributes':_0x540e45['options']?_0x540e45['options']['attributes']||null:null,'include':_0x540e45['options']?_0x540e45[_0xc008('0x16')][_0xc008('0x17')]?_[_0xc008('0x18')](_0x540e45[_0xc008('0x16')][_0xc008('0x17')],function(_0x110128){return{'model':db[_0x110128['model']],'as':_0x110128['as'],'attributes':_0x110128[_0xc008('0x19')],'include':_0x110128['include']?_['map'](_0x110128[_0xc008('0x17')],function(_0x36f358){return{'model':db[_0x36f358[_0xc008('0x1a')]],'as':_0x36f358['as'],'attributes':_0x36f358[_0xc008('0x19')],'include':_0x36f358['include']?_['map'](_0x36f358['include'],function(_0x3f7b07){return{'model':db[_0x3f7b07[_0xc008('0x1a')]],'as':_0x3f7b07['as'],'attributes':_0x3f7b07[_0xc008('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc008('0x1b')](function(_0x5bebd9){logger['info']('ShowSquareOdbc',_0x540e45);logger['debug']('ShowSquareOdbc',_0x540e45,JSON[_0xc008('0x1c')](_0x5bebd9));_0x46042b(_0x5bebd9);})[_0xc008('0x14')](function(_0x25eae4){logger['error'](_0xc008('0x1d'),_0x25eae4[_0xc008('0x13')],_0x540e45);_0x462af5(_0x5c2668[_0xc008('0x10')](0x1f4,_0x25eae4[_0xc008('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 59468c1..2218035 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 _0x02ce=['getUsers','post','create','addUsers','put','update','delete','removeUsers','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','/:id/users'];(function(_0x160fb9,_0x4b82ff){var _0x43f06d=function(_0x1b0f93){while(--_0x1b0f93){_0x160fb9['push'](_0x160fb9['shift']());}};_0x43f06d(++_0x4b82ff);}(_0x02ce,0x1ac));var _0xe02c=function(_0x414902,_0x19cb58){_0x414902=_0x414902-0x0;var _0x5b00a3=_0x02ce[_0x414902];return _0x5b00a3;};'use strict';var multer=require(_0xe02c('0x0'));var util=require(_0xe02c('0x1'));var path=require(_0xe02c('0x2'));var timeout=require('connect-timeout');var express=require(_0xe02c('0x3'));var router=express['Router']();var auth=require(_0xe02c('0x4'));var interaction=require(_0xe02c('0x5'));var config=require(_0xe02c('0x6'));var controller=require(_0xe02c('0x7'));router[_0xe02c('0x8')]('/',auth[_0xe02c('0x9')](),controller[_0xe02c('0xa')]);router[_0xe02c('0x8')](_0xe02c('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xe02c('0x8')](_0xe02c('0xc'),auth[_0xe02c('0x9')](),controller[_0xe02c('0xd')]);router[_0xe02c('0xe')]('/',auth[_0xe02c('0x9')](),controller[_0xe02c('0xf')]);router[_0xe02c('0xe')](_0xe02c('0xc'),auth[_0xe02c('0x9')](),controller[_0xe02c('0x10')]);router[_0xe02c('0x11')](_0xe02c('0xb'),auth[_0xe02c('0x9')](),controller[_0xe02c('0x12')]);router[_0xe02c('0x13')](_0xe02c('0xb'),auth[_0xe02c('0x9')](),controller['destroy']);router[_0xe02c('0x13')]('/:id/users',auth['isAuthenticated'](),controller[_0xe02c('0x14')]);module['exports']=router; \ No newline at end of file +var _0x6e6c=['./squareProject.controller','isAuthenticated','index','/:id','get','/:id/users','getUsers','create','post','addUsers','put','delete','destroy','removeUsers','exports','multer','util','connect-timeout','express','../../components/interaction/service'];(function(_0x20bf9c,_0x2feee7){var _0x45dd7c=function(_0x241d75){while(--_0x241d75){_0x20bf9c['push'](_0x20bf9c['shift']());}};_0x45dd7c(++_0x2feee7);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6e6c[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0xc6e6('0x0'));var util=require(_0xc6e6('0x1'));var path=require('path');var timeout=require(_0xc6e6('0x2'));var express=require(_0xc6e6('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xc6e6('0x4'));var config=require('../../config/environment');var controller=require(_0xc6e6('0x5'));router['get']('/',auth[_0xc6e6('0x6')](),controller[_0xc6e6('0x7')]);router['get'](_0xc6e6('0x8'),auth[_0xc6e6('0x6')](),controller['show']);router[_0xc6e6('0x9')](_0xc6e6('0xa'),auth['isAuthenticated'](),controller[_0xc6e6('0xb')]);router['post']('/',auth[_0xc6e6('0x6')](),controller[_0xc6e6('0xc')]);router[_0xc6e6('0xd')](_0xc6e6('0xa'),auth[_0xc6e6('0x6')](),controller[_0xc6e6('0xe')]);router[_0xc6e6('0xf')](_0xc6e6('0x8'),auth[_0xc6e6('0x6')](),controller['update']);router[_0xc6e6('0x10')]('/:id',auth[_0xc6e6('0x6')](),controller[_0xc6e6('0x11')]);router[_0xc6e6('0x10')](_0xc6e6('0xa'),auth['isAuthenticated'](),controller[_0xc6e6('0x12')]);module[_0xc6e6('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 98a7313..9154cb2 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 _0xa065=['getDataValue','preproduction','toString','utf8','production','sequelize','exports','name','BLOB','long'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa065,0x16d));var _0x5a06=function(_0x12ff06,_0x3e8a84){_0x12ff06=_0x12ff06-0x0;var _0x4522b9=_0xa065[_0x12ff06];return _0x4522b9;};'use strict';var Sequelize=require(_0x5a06('0x0'));module[_0x5a06('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x5a06('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x5a06('0x3')](_0x5a06('0x4')),'get':function(){if(this[_0x5a06('0x5')](_0x5a06('0x6'))){return this['getDataValue'](_0x5a06('0x6'))[_0x5a06('0x7')](_0x5a06('0x8'));}}},'production':{'type':Sequelize['BLOB']('long'),'get':function(){if(this[_0x5a06('0x5')](_0x5a06('0x9'))){return this[_0x5a06('0x5')](_0x5a06('0x9'))['toString']('utf8');}}}}; \ No newline at end of file +var _0xb7c0=['name','BLOB','long','getDataValue','preproduction','toString','utf8','production','sequelize','exports'];(function(_0x45f8c0,_0x5376c1){var _0x462372=function(_0x53da28){while(--_0x53da28){_0x45f8c0['push'](_0x45f8c0['shift']());}};_0x462372(++_0x5376c1);}(_0xb7c0,0x13e));var _0x0b7c=function(_0x5749f5,_0x3abd89){_0x5749f5=_0x5749f5-0x0;var _0x5020dc=_0xb7c0[_0x5749f5];return _0x5020dc;};'use strict';var Sequelize=require(_0x0b7c('0x0'));module[_0x0b7c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x0b7c('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x0b7c('0x3')](_0x0b7c('0x4')),'get':function(){if(this[_0x0b7c('0x5')]('preproduction')){return this[_0x0b7c('0x5')](_0x0b7c('0x6'))[_0x0b7c('0x7')](_0x0b7c('0x8'));}}},'production':{'type':Sequelize[_0x0b7c('0x3')](_0x0b7c('0x4')),'get':function(){if(this[_0x0b7c('0x5')](_0x0b7c('0x9'))){return this[_0x0b7c('0x5')]('production')[_0x0b7c('0x7')](_0x0b7c('0x8'));}}}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 896deda..e1ea2f0 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 _0xbadb=['SquareProjects','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','attributes','fields','length','nolimit','limit','order','sort','filters','filter','where','VIRTUAL','options','SquareProject','includeAll','include','rows','catch','show','params','intersection','merge','find','body','user','role','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','removeUsers','emit','userSquareProject:remove','getUsers','User','pick','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','json','count','offset','apply','reject','save','update','then','destroy','get'];(function(_0x4e8d22,_0x562642){var _0x3c2411=function(_0x37cb1f){while(--_0x37cb1f){_0x4e8d22['push'](_0x4e8d22['shift']());}};_0x3c2411(++_0x562642);}(_0xbadb,0x14e));var _0xbbad=function(_0x55cab6,_0x4c1c08){_0x55cab6=_0x55cab6-0x0;var _0x541ba4=_0xbadb[_0x55cab6];return _0x541ba4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbbad('0x0'));var rimraf=require(_0xbbad('0x1'));var zipdir=require(_0xbbad('0x2'));var jsonpatch=require(_0xbbad('0x3'));var rp=require(_0xbbad('0x4'));var moment=require(_0xbbad('0x5'));var BPromise=require(_0xbbad('0x6'));var Mustache=require(_0xbbad('0x7'));var util=require(_0xbbad('0x8'));var path=require(_0xbbad('0x9'));var sox=require('sox');var csv=require(_0xbbad('0xa'));var ejs=require(_0xbbad('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbbad('0xc'));var crypto=require('crypto');var jsforce=require(_0xbbad('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xbbad('0xa'));var querystring=require('querystring');var Papa=require(_0xbbad('0xe'));var Redis=require(_0xbbad('0xf'));var authService=require(_0xbbad('0x10'));var qs=require(_0xbbad('0x11'));var as=require(_0xbbad('0x12'));var hardwareService=require(_0xbbad('0x13'));var logger=require('../../config/logger')(_0xbbad('0x14'));var utils=require(_0xbbad('0x15'));var config=require(_0xbbad('0x16'));var db=require(_0xbbad('0x17'))['db'];config[_0xbbad('0x18')]=_[_0xbbad('0x19')](config[_0xbbad('0x18')],{'host':_0xbbad('0x1a'),'port':0x18eb});var socket=require(_0xbbad('0x1b'))(new Redis(config[_0xbbad('0x18')]));require(_0xbbad('0x1c'))[_0xbbad('0x1d')](socket);function respondWithStatusCode(_0x465553,_0x3f6ed3){_0x3f6ed3=_0x3f6ed3||0xcc;return function(_0x398dbd){if(_0x398dbd){return _0x465553[_0xbbad('0x1e')](_0x3f6ed3);}return _0x465553[_0xbbad('0x1f')](_0x3f6ed3)['end']();};}function respondWithResult(_0x10586d,_0x313f3f){_0x313f3f=_0x313f3f||0xc8;return function(_0x4d17f8){if(_0x4d17f8){return _0x10586d[_0xbbad('0x1f')](_0x313f3f)[_0xbbad('0x20')](_0x4d17f8);}};}function respondWithFilteredResult(_0x593e39,_0x5ecab9){return function(_0x191cfd){if(_0x191cfd){var _0x215379=_0x191cfd[_0xbbad('0x21')],_0xe1da94=_0x5ecab9['offset'],_0x442f03=_0x5ecab9[_0xbbad('0x22')]+_0x5ecab9['limit'],_0x517849;if(_0x442f03>=_0x215379){_0x442f03=_0x215379;_0x517849=0xc8;}else{_0x517849=0xce;}_0x593e39[_0xbbad('0x1f')](_0x517849);return _0x593e39['set']('Content-Range',_0xe1da94+'-'+_0x442f03+'/'+_0x215379)[_0xbbad('0x20')](_0x191cfd);}return null;};}function patchUpdates(_0x40b1cc){return function(_0x127d5e){try{jsonpatch[_0xbbad('0x23')](_0x127d5e,_0x40b1cc,!![]);}catch(_0x346507){return BPromise[_0xbbad('0x24')](_0x346507);}return _0x127d5e[_0xbbad('0x25')]();};}function saveUpdates(_0x42030e,_0x17d8aa){return function(_0x249aef){if(_0x249aef){return _0x249aef[_0xbbad('0x26')](_0x42030e)[_0xbbad('0x27')](function(_0x86b690){return _0x86b690;});}return null;};}function removeEntity(_0x538aaf,_0x375d5b){return function(_0xe1e00b){if(_0xe1e00b){return _0xe1e00b[_0xbbad('0x28')]()[_0xbbad('0x27')](function(){var _0x3c18fa=_0xe1e00b[_0xbbad('0x29')]({'plain':!![]});var _0x4ebfea=_0xbbad('0x2a');return db[_0xbbad('0x2b')][_0xbbad('0x28')]({'where':{'type':_0x4ebfea,'resourceId':_0x3c18fa['id']}})[_0xbbad('0x27')](function(){return _0xe1e00b;});})[_0xbbad('0x27')](function(){_0x538aaf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d301f,_0x5661fe){return function(_0x5c0c07){if(!_0x5c0c07){_0x1d301f['sendStatus'](0x194);}return _0x5c0c07;};}function handleError(_0x2ace9e,_0x3d9dbc){_0x3d9dbc=_0x3d9dbc||0x1f4;return function(_0xe1bef1){logger['error'](_0xe1bef1[_0xbbad('0x2c')]);if(_0xe1bef1['name']){delete _0xe1bef1[_0xbbad('0x2d')];}_0x2ace9e[_0xbbad('0x1f')](_0x3d9dbc)[_0xbbad('0x2e')](_0xe1bef1);};}exports[_0xbbad('0x2f')]=function(_0x3f4cdd,_0x17cc5e){var _0x30e0b0={},_0x3b13cc={},_0x24e836={'count':0x0,'rows':[]};var _0x4ce049=_[_0xbbad('0x30')](db['SquareProject'][_0xbbad('0x31')],function(_0x2af8d6){return{'name':_0x2af8d6[_0xbbad('0x32')],'type':_0x2af8d6[_0xbbad('0x33')][_0xbbad('0x34')]};});_0x3b13cc[_0xbbad('0x35')]=_[_0xbbad('0x30')](_0x4ce049,_0xbbad('0x2d'));_0x3b13cc['query']=_[_0xbbad('0x36')](_0x3f4cdd[_0xbbad('0x37')]);_0x3b13cc['filters']=_['intersection'](_0x3b13cc[_0xbbad('0x35')],_0x3b13cc['query']);_0x30e0b0[_0xbbad('0x38')]=_['intersection'](_0x3b13cc[_0xbbad('0x35')],qs[_0xbbad('0x39')](_0x3f4cdd[_0xbbad('0x37')][_0xbbad('0x39')]));_0x30e0b0['attributes']=_0x30e0b0[_0xbbad('0x38')][_0xbbad('0x3a')]?_0x30e0b0['attributes']:_0x3b13cc[_0xbbad('0x35')];if(!_0x3f4cdd[_0xbbad('0x37')]['hasOwnProperty'](_0xbbad('0x3b'))){_0x30e0b0['limit']=qs[_0xbbad('0x3c')](_0x3f4cdd[_0xbbad('0x37')][_0xbbad('0x3c')]);_0x30e0b0[_0xbbad('0x22')]=qs[_0xbbad('0x22')](_0x3f4cdd[_0xbbad('0x37')][_0xbbad('0x22')]);}_0x30e0b0[_0xbbad('0x3d')]=qs[_0xbbad('0x3e')](_0x3f4cdd[_0xbbad('0x37')]['sort']);_0x30e0b0['where']=qs['filters'](_['pick'](_0x3f4cdd[_0xbbad('0x37')],_0x3b13cc[_0xbbad('0x3f')]),_0x4ce049);if(_0x3f4cdd['query'][_0xbbad('0x40')]){_0x30e0b0['where']=_['merge'](_0x30e0b0[_0xbbad('0x41')],{'$or':_[_0xbbad('0x30')](_0x4ce049,function(_0x5bb5f3){if(_0x5bb5f3[_0xbbad('0x33')]!==_0xbbad('0x42')){var _0x46159a={};_0x46159a[_0x5bb5f3[_0xbbad('0x2d')]]={'$like':'%'+_0x3f4cdd['query'][_0xbbad('0x40')]+'%'};return _0x46159a;}})});}_0x30e0b0=_['merge']({},_0x30e0b0,_0x3f4cdd[_0xbbad('0x43')]);var _0x1ffdd5={'where':_0x30e0b0[_0xbbad('0x41')]};return db[_0xbbad('0x44')]['count'](_0x1ffdd5)['then'](function(_0x26bdb9){_0x24e836['count']=_0x26bdb9;if(_0x3f4cdd[_0xbbad('0x37')][_0xbbad('0x45')]){_0x30e0b0[_0xbbad('0x46')]=[{'all':!![]}];}return db[_0xbbad('0x44')]['findAll'](_0x30e0b0);})[_0xbbad('0x27')](function(_0x147a5e){_0x24e836[_0xbbad('0x47')]=_0x147a5e;return _0x24e836;})['then'](respondWithFilteredResult(_0x17cc5e,_0x30e0b0))[_0xbbad('0x48')](handleError(_0x17cc5e,null));};exports[_0xbbad('0x49')]=function(_0x4b2de8,_0x34371b){var _0x65b4d8={'raw':![],'where':{'id':_0x4b2de8[_0xbbad('0x4a')]['id']}},_0x53ad65={};_0x53ad65[_0xbbad('0x35')]=_[_0xbbad('0x36')](db[_0xbbad('0x44')][_0xbbad('0x31')]);_0x53ad65[_0xbbad('0x37')]=_[_0xbbad('0x36')](_0x4b2de8[_0xbbad('0x37')]);_0x53ad65[_0xbbad('0x3f')]=_['intersection'](_0x53ad65[_0xbbad('0x35')],_0x53ad65[_0xbbad('0x37')]);_0x65b4d8[_0xbbad('0x38')]=_[_0xbbad('0x4b')](_0x53ad65[_0xbbad('0x35')],qs['fields'](_0x4b2de8[_0xbbad('0x37')][_0xbbad('0x39')]));_0x65b4d8[_0xbbad('0x38')]=_0x65b4d8['attributes']['length']?_0x65b4d8[_0xbbad('0x38')]:_0x53ad65[_0xbbad('0x35')];if(_0x4b2de8[_0xbbad('0x37')][_0xbbad('0x45')]){_0x65b4d8[_0xbbad('0x46')]=[{'all':!![]}];}_0x65b4d8=_[_0xbbad('0x4c')]({},_0x65b4d8,_0x4b2de8[_0xbbad('0x43')]);return db['SquareProject'][_0xbbad('0x4d')](_0x65b4d8)[_0xbbad('0x27')](handleEntityNotFound(_0x34371b,null))[_0xbbad('0x27')](respondWithResult(_0x34371b,null))[_0xbbad('0x48')](handleError(_0x34371b,null));};exports['create']=function(_0x253b0d,_0x21f249){return db[_0xbbad('0x44')]['create'](_0x253b0d[_0xbbad('0x4e')],{})['then'](function(_0x193a04){var _0x59632a=_0x253b0d[_0xbbad('0x4f')][_0xbbad('0x29')]({'plain':!![]});if(!_0x59632a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x59632a[_0xbbad('0x50')]===_0xbbad('0x4f')){var _0x2a0f04=_0x193a04[_0xbbad('0x29')]({'plain':!![]});var _0x17350f=_0xbbad('0x2a');return db[_0xbbad('0x51')][_0xbbad('0x4d')]({'where':{'name':_0x17350f,'userProfileId':_0x59632a[_0xbbad('0x52')]},'raw':!![]})[_0xbbad('0x27')](function(_0x54d68b){if(_0x54d68b&&_0x54d68b['autoAssociation']===0x0){return db['UserProfileResource'][_0xbbad('0x53')]({'name':_0x2a0f04[_0xbbad('0x2d')],'resourceId':_0x2a0f04['id'],'type':_0x54d68b[_0xbbad('0x2d')],'sectionId':_0x54d68b['id']},{})['then'](function(){return _0x193a04;});}else{return _0x193a04;}})[_0xbbad('0x48')](function(_0x21c0ca){logger['error'](_0xbbad('0x54'),_0x21c0ca);throw _0x21c0ca;});}return _0x193a04;})[_0xbbad('0x27')](respondWithResult(_0x21f249,0xc9))[_0xbbad('0x48')](handleError(_0x21f249,null));};exports[_0xbbad('0x26')]=function(_0x40dd8e,_0x3cddf9){if(_0x40dd8e[_0xbbad('0x4e')]['id']){delete _0x40dd8e[_0xbbad('0x4e')]['id'];}return db['SquareProject'][_0xbbad('0x4d')]({'where':{'id':_0x40dd8e['params']['id']}})[_0xbbad('0x27')](handleEntityNotFound(_0x3cddf9,null))[_0xbbad('0x27')](saveUpdates(_0x40dd8e['body'],null))[_0xbbad('0x27')](respondWithResult(_0x3cddf9,null))[_0xbbad('0x48')](handleError(_0x3cddf9,null));};exports[_0xbbad('0x28')]=function(_0xa4ca66,_0x22bdf8){return db['SquareProject'][_0xbbad('0x4d')]({'where':{'id':_0xa4ca66['params']['id']}})['then'](handleEntityNotFound(_0x22bdf8,null))['then'](removeEntity(_0x22bdf8,null))[_0xbbad('0x48')](handleError(_0x22bdf8,null));};exports[_0xbbad('0x55')]=function(_0x12f017,_0x26db92,_0x569090){return db[_0xbbad('0x44')]['find']({'where':{'id':_0x12f017['params']['id']}})[_0xbbad('0x27')](handleEntityNotFound(_0x26db92,null))[_0xbbad('0x27')](function(_0x49b179){if(_0x49b179){return _0x49b179['addUsers'](_0x12f017[_0xbbad('0x4e')][_0xbbad('0x56')],_['omit'](_0x12f017[_0xbbad('0x4e')],[_0xbbad('0x56'),'id'])||{});}})['then'](respondWithResult(_0x26db92,null))[_0xbbad('0x48')](handleError(_0x26db92,null));};exports[_0xbbad('0x57')]=function(_0x5d93fd,_0x1e8d18,_0x4da10e){return db[_0xbbad('0x44')][_0xbbad('0x4d')]({'where':{'id':_0x5d93fd[_0xbbad('0x4a')]['id']}})[_0xbbad('0x27')](handleEntityNotFound(_0x1e8d18,null))[_0xbbad('0x27')](function(_0x2d5463){if(_0x2d5463){return _0x2d5463['removeUsers'](_0x5d93fd['query'][_0xbbad('0x56')])[_0xbbad('0x27')](function(){if(_['isArray'](_0x5d93fd[_0xbbad('0x37')]['ids'])){for(var _0x34000b=0x0;_0x34000b<_0x5d93fd[_0xbbad('0x37')][_0xbbad('0x56')][_0xbbad('0x3a')];_0x34000b+=0x1){socket[_0xbbad('0x58')](_0xbbad('0x59'),{'UserId':Number(_0x5d93fd['query']['ids'][_0x34000b]),'SquareProjectId':Number(_0x5d93fd[_0xbbad('0x4a')]['id'])});}}else{socket['emit'](_0xbbad('0x59'),{'UserId':Number(_0x5d93fd[_0xbbad('0x37')][_0xbbad('0x56')]),'SquareProjectId':Number(_0x5d93fd[_0xbbad('0x4a')]['id'])});}});}})[_0xbbad('0x27')](respondWithStatusCode(_0x1e8d18,null))[_0xbbad('0x48')](handleError(_0x1e8d18,null));};exports[_0xbbad('0x5a')]=function(_0x3db2db,_0x499a3f,_0xe0d03c){var _0x26505a={};var _0x35a0cb={};var _0x1190e0;var _0x4f7f82;return db[_0xbbad('0x44')]['findOne']({'where':{'id':_0x3db2db[_0xbbad('0x4a')]['id']}})[_0xbbad('0x27')](handleEntityNotFound(_0x499a3f,null))[_0xbbad('0x27')](function(_0x1458aa){if(_0x1458aa){_0x1190e0=_0x1458aa;_0x35a0cb['model']=_[_0xbbad('0x36')](db[_0xbbad('0x5b')][_0xbbad('0x31')]);_0x35a0cb['query']=_['keys'](_0x3db2db[_0xbbad('0x37')]);_0x35a0cb[_0xbbad('0x3f')]=_['intersection'](_0x35a0cb[_0xbbad('0x35')],_0x35a0cb['query']);_0x26505a[_0xbbad('0x38')]=_[_0xbbad('0x4b')](_0x35a0cb['model'],qs[_0xbbad('0x39')](_0x3db2db[_0xbbad('0x37')][_0xbbad('0x39')]));_0x26505a['attributes']=_0x26505a[_0xbbad('0x38')][_0xbbad('0x3a')]?_0x26505a['attributes']:_0x35a0cb[_0xbbad('0x35')];_0x26505a[_0xbbad('0x3d')]=qs[_0xbbad('0x3e')](_0x3db2db[_0xbbad('0x37')][_0xbbad('0x3e')]);_0x26505a['where']=qs[_0xbbad('0x3f')](_[_0xbbad('0x5c')](_0x3db2db[_0xbbad('0x37')],_0x35a0cb[_0xbbad('0x3f')]));if(_0x3db2db['query'][_0xbbad('0x40')]){_0x26505a[_0xbbad('0x41')]=_[_0xbbad('0x4c')](_0x26505a['where'],{'$or':_[_0xbbad('0x30')](_0x26505a['attributes'],function(_0x3f6cf0){var _0x2724d2={};_0x2724d2[_0x3f6cf0]={'$like':'%'+_0x3db2db[_0xbbad('0x37')][_0xbbad('0x40')]+'%'};return _0x2724d2;})});}_0x26505a=_[_0xbbad('0x4c')]({},_0x26505a,_0x3db2db[_0xbbad('0x43')]);return _0x1190e0[_0xbbad('0x5a')](_0x26505a);}})[_0xbbad('0x27')](function(_0x27e416){if(_0x27e416){_0x4f7f82=_0x27e416[_0xbbad('0x3a')];if(!_0x3db2db['query'][_0xbbad('0x5d')](_0xbbad('0x3b'))){_0x26505a[_0xbbad('0x3c')]=qs[_0xbbad('0x3c')](_0x3db2db['query'][_0xbbad('0x3c')]);_0x26505a[_0xbbad('0x22')]=qs[_0xbbad('0x22')](_0x3db2db[_0xbbad('0x37')][_0xbbad('0x22')]);}return _0x1190e0['getUsers'](_0x26505a);}})[_0xbbad('0x27')](function(_0x46a75e){if(_0x46a75e){return _0x46a75e?{'count':_0x4f7f82,'rows':_0x46a75e}:null;}})[_0xbbad('0x27')](respondWithResult(_0x499a3f,null))['catch'](handleError(_0x499a3f,null));}; \ No newline at end of file +var _0x6fd9=['userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addUsers','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','pick','merge','html-pdf','rimraf','fast-json-patch','request-promise','moment','mustache','sox','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','UserProfileResource','error','stack','name','send','map','SquareProject','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','options','includeAll','include','rows','catch','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection'];(function(_0x213d10,_0x1a489b){var _0x5c2e02=function(_0xfdc399){while(--_0xfdc399){_0x213d10['push'](_0x213d10['shift']());}};_0x5c2e02(++_0x1a489b);}(_0x6fd9,0x179));var _0x96fd=function(_0x4bbe46,_0x25ed71){_0x4bbe46=_0x4bbe46-0x0;var _0x5bbecc=_0x6fd9[_0x4bbe46];return _0x5bbecc;};'use strict';var pdf=require(_0x96fd('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x96fd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x96fd('0x2'));var rp=require(_0x96fd('0x3'));var moment=require(_0x96fd('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x96fd('0x5'));var util=require('util');var path=require('path');var sox=require(_0x96fd('0x6'));var csv=require('to-csv');var ejs=require(_0x96fd('0x7'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x96fd('0x8'));var jsforce=require(_0x96fd('0x9'));var deskjs=require(_0x96fd('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x96fd('0xb'));var Redis=require(_0x96fd('0xc'));var authService=require(_0x96fd('0xd'));var qs=require(_0x96fd('0xe'));var as=require(_0x96fd('0xf'));var hardwareService=require(_0x96fd('0x10'));var logger=require(_0x96fd('0x11'))('api');var utils=require(_0x96fd('0x12'));var config=require(_0x96fd('0x13'));var db=require(_0x96fd('0x14'))['db'];config[_0x96fd('0x15')]=_[_0x96fd('0x16')](config[_0x96fd('0x15')],{'host':_0x96fd('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x96fd('0x15')]));require('./squareProject.socket')[_0x96fd('0x18')](socket);function respondWithStatusCode(_0x578d2a,_0x46578c){_0x46578c=_0x46578c||0xcc;return function(_0x3b8189){if(_0x3b8189){return _0x578d2a[_0x96fd('0x19')](_0x46578c);}return _0x578d2a['status'](_0x46578c)[_0x96fd('0x1a')]();};}function respondWithResult(_0xf3b3ef,_0x23a744){_0x23a744=_0x23a744||0xc8;return function(_0x8b50bf){if(_0x8b50bf){return _0xf3b3ef[_0x96fd('0x1b')](_0x23a744)[_0x96fd('0x1c')](_0x8b50bf);}};}function respondWithFilteredResult(_0x279a20,_0x26fa25){return function(_0x3809b7){if(_0x3809b7){var _0x4c0823=_0x3809b7[_0x96fd('0x1d')],_0x251367=_0x26fa25['offset'],_0x3ee8a3=_0x26fa25[_0x96fd('0x1e')]+_0x26fa25[_0x96fd('0x1f')],_0x16128f;if(_0x3ee8a3>=_0x4c0823){_0x3ee8a3=_0x4c0823;_0x16128f=0xc8;}else{_0x16128f=0xce;}_0x279a20[_0x96fd('0x1b')](_0x16128f);return _0x279a20[_0x96fd('0x20')](_0x96fd('0x21'),_0x251367+'-'+_0x3ee8a3+'/'+_0x4c0823)[_0x96fd('0x1c')](_0x3809b7);}return null;};}function patchUpdates(_0x508dd5){return function(_0x2c17ba){try{jsonpatch[_0x96fd('0x22')](_0x2c17ba,_0x508dd5,!![]);}catch(_0x265998){return BPromise[_0x96fd('0x23')](_0x265998);}return _0x2c17ba['save']();};}function saveUpdates(_0x3db1d8,_0x160405){return function(_0x6633d8){if(_0x6633d8){return _0x6633d8[_0x96fd('0x24')](_0x3db1d8)[_0x96fd('0x25')](function(_0x443510){return _0x443510;});}return null;};}function removeEntity(_0x375b9b,_0x15eb2a){return function(_0x2654c7){if(_0x2654c7){return _0x2654c7[_0x96fd('0x26')]()[_0x96fd('0x25')](function(){var _0x50d554=_0x2654c7['get']({'plain':!![]});var _0x80ad19='SquareProjects';return db[_0x96fd('0x27')]['destroy']({'where':{'type':_0x80ad19,'resourceId':_0x50d554['id']}})[_0x96fd('0x25')](function(){return _0x2654c7;});})[_0x96fd('0x25')](function(){_0x375b9b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c8ae6,_0x1b4295){return function(_0x1539c3){if(!_0x1539c3){_0x4c8ae6['sendStatus'](0x194);}return _0x1539c3;};}function handleError(_0x281adf,_0x111005){_0x111005=_0x111005||0x1f4;return function(_0x3544ec){logger[_0x96fd('0x28')](_0x3544ec[_0x96fd('0x29')]);if(_0x3544ec[_0x96fd('0x2a')]){delete _0x3544ec[_0x96fd('0x2a')];}_0x281adf[_0x96fd('0x1b')](_0x111005)[_0x96fd('0x2b')](_0x3544ec);};}exports['index']=function(_0x4af7a0,_0x295582){var _0x4f0813={},_0x3e6071={},_0x24805f={'count':0x0,'rows':[]};var _0x55ecb6=_[_0x96fd('0x2c')](db[_0x96fd('0x2d')][_0x96fd('0x2e')],function(_0x27686c){return{'name':_0x27686c[_0x96fd('0x2f')],'type':_0x27686c[_0x96fd('0x30')][_0x96fd('0x31')]};});_0x3e6071['model']=_['map'](_0x55ecb6,_0x96fd('0x2a'));_0x3e6071[_0x96fd('0x32')]=_[_0x96fd('0x33')](_0x4af7a0[_0x96fd('0x32')]);_0x3e6071['filters']=_['intersection'](_0x3e6071[_0x96fd('0x34')],_0x3e6071[_0x96fd('0x32')]);_0x4f0813[_0x96fd('0x35')]=_[_0x96fd('0x36')](_0x3e6071[_0x96fd('0x34')],qs['fields'](_0x4af7a0[_0x96fd('0x32')][_0x96fd('0x37')]));_0x4f0813[_0x96fd('0x35')]=_0x4f0813['attributes'][_0x96fd('0x38')]?_0x4f0813[_0x96fd('0x35')]:_0x3e6071['model'];if(!_0x4af7a0[_0x96fd('0x32')][_0x96fd('0x39')](_0x96fd('0x3a'))){_0x4f0813['limit']=qs[_0x96fd('0x1f')](_0x4af7a0[_0x96fd('0x32')]['limit']);_0x4f0813[_0x96fd('0x1e')]=qs['offset'](_0x4af7a0[_0x96fd('0x32')][_0x96fd('0x1e')]);}_0x4f0813[_0x96fd('0x3b')]=qs[_0x96fd('0x3c')](_0x4af7a0[_0x96fd('0x32')]['sort']);_0x4f0813[_0x96fd('0x3d')]=qs[_0x96fd('0x3e')](_['pick'](_0x4af7a0['query'],_0x3e6071['filters']),_0x55ecb6);if(_0x4af7a0[_0x96fd('0x32')][_0x96fd('0x3f')]){_0x4f0813[_0x96fd('0x3d')]=_['merge'](_0x4f0813[_0x96fd('0x3d')],{'$or':_['map'](_0x55ecb6,function(_0x5590c9){if(_0x5590c9[_0x96fd('0x30')]!==_0x96fd('0x40')){var _0x3d6692={};_0x3d6692[_0x5590c9['name']]={'$like':'%'+_0x4af7a0[_0x96fd('0x32')]['filter']+'%'};return _0x3d6692;}})});}_0x4f0813=_['merge']({},_0x4f0813,_0x4af7a0[_0x96fd('0x41')]);var _0x4e593e={'where':_0x4f0813[_0x96fd('0x3d')]};return db[_0x96fd('0x2d')][_0x96fd('0x1d')](_0x4e593e)[_0x96fd('0x25')](function(_0x21b5fa){_0x24805f[_0x96fd('0x1d')]=_0x21b5fa;if(_0x4af7a0['query'][_0x96fd('0x42')]){_0x4f0813[_0x96fd('0x43')]=[{'all':!![]}];}return db[_0x96fd('0x2d')]['findAll'](_0x4f0813);})[_0x96fd('0x25')](function(_0x506936){_0x24805f[_0x96fd('0x44')]=_0x506936;return _0x24805f;})[_0x96fd('0x25')](respondWithFilteredResult(_0x295582,_0x4f0813))[_0x96fd('0x45')](handleError(_0x295582,null));};exports['show']=function(_0xc8f709,_0x16fa6e){var _0x227c71={'raw':![],'where':{'id':_0xc8f709['params']['id']}},_0x192b5f={};_0x192b5f[_0x96fd('0x34')]=_[_0x96fd('0x33')](db[_0x96fd('0x2d')][_0x96fd('0x2e')]);_0x192b5f[_0x96fd('0x32')]=_[_0x96fd('0x33')](_0xc8f709[_0x96fd('0x32')]);_0x192b5f[_0x96fd('0x3e')]=_[_0x96fd('0x36')](_0x192b5f['model'],_0x192b5f[_0x96fd('0x32')]);_0x227c71['attributes']=_[_0x96fd('0x36')](_0x192b5f[_0x96fd('0x34')],qs[_0x96fd('0x37')](_0xc8f709['query'][_0x96fd('0x37')]));_0x227c71[_0x96fd('0x35')]=_0x227c71[_0x96fd('0x35')][_0x96fd('0x38')]?_0x227c71[_0x96fd('0x35')]:_0x192b5f['model'];if(_0xc8f709[_0x96fd('0x32')][_0x96fd('0x42')]){_0x227c71[_0x96fd('0x43')]=[{'all':!![]}];}_0x227c71=_['merge']({},_0x227c71,_0xc8f709[_0x96fd('0x41')]);return db[_0x96fd('0x2d')][_0x96fd('0x46')](_0x227c71)['then'](handleEntityNotFound(_0x16fa6e,null))['then'](respondWithResult(_0x16fa6e,null))[_0x96fd('0x45')](handleError(_0x16fa6e,null));};exports[_0x96fd('0x47')]=function(_0x3c1417,_0x5a6d98){return db[_0x96fd('0x2d')][_0x96fd('0x47')](_0x3c1417[_0x96fd('0x48')],{})[_0x96fd('0x25')](function(_0x5eefb0){var _0x246cc3=_0x3c1417[_0x96fd('0x49')]['get']({'plain':!![]});if(!_0x246cc3)throw new Error(_0x96fd('0x4a'));if(_0x246cc3[_0x96fd('0x4b')]==='user'){var _0x290416=_0x5eefb0[_0x96fd('0x4c')]({'plain':!![]});var _0x13f4aa='SquareProjects';return db[_0x96fd('0x4d')][_0x96fd('0x46')]({'where':{'name':_0x13f4aa,'userProfileId':_0x246cc3[_0x96fd('0x4e')]},'raw':!![]})['then'](function(_0x4fed85){if(_0x4fed85&&_0x4fed85['autoAssociation']===0x0){return db['UserProfileResource'][_0x96fd('0x47')]({'name':_0x290416[_0x96fd('0x2a')],'resourceId':_0x290416['id'],'type':_0x4fed85[_0x96fd('0x2a')],'sectionId':_0x4fed85['id']},{})[_0x96fd('0x25')](function(){return _0x5eefb0;});}else{return _0x5eefb0;}})[_0x96fd('0x45')](function(_0x1c3d45){logger[_0x96fd('0x28')](_0x96fd('0x4f'),_0x1c3d45);throw _0x1c3d45;});}return _0x5eefb0;})['then'](respondWithResult(_0x5a6d98,0xc9))['catch'](handleError(_0x5a6d98,null));};exports[_0x96fd('0x24')]=function(_0x3ae2dc,_0x10ee4c){if(_0x3ae2dc[_0x96fd('0x48')]['id']){delete _0x3ae2dc['body']['id'];}return db['SquareProject'][_0x96fd('0x46')]({'where':{'id':_0x3ae2dc[_0x96fd('0x50')]['id']}})[_0x96fd('0x25')](handleEntityNotFound(_0x10ee4c,null))[_0x96fd('0x25')](saveUpdates(_0x3ae2dc['body'],null))[_0x96fd('0x25')](respondWithResult(_0x10ee4c,null))[_0x96fd('0x45')](handleError(_0x10ee4c,null));};exports['destroy']=function(_0x32b58f,_0x4e260a){return db['SquareProject'][_0x96fd('0x46')]({'where':{'id':_0x32b58f['params']['id']}})[_0x96fd('0x25')](handleEntityNotFound(_0x4e260a,null))[_0x96fd('0x25')](removeEntity(_0x4e260a,null))[_0x96fd('0x45')](handleError(_0x4e260a,null));};exports['addUsers']=function(_0x17d7e3,_0x17f929,_0x4f1b73){return db['SquareProject']['find']({'where':{'id':_0x17d7e3[_0x96fd('0x50')]['id']}})[_0x96fd('0x25')](handleEntityNotFound(_0x17f929,null))[_0x96fd('0x25')](function(_0xd17edd){if(_0xd17edd){return _0xd17edd[_0x96fd('0x51')](_0x17d7e3[_0x96fd('0x48')][_0x96fd('0x52')],_['omit'](_0x17d7e3[_0x96fd('0x48')],[_0x96fd('0x52'),'id'])||{});}})[_0x96fd('0x25')](respondWithResult(_0x17f929,null))[_0x96fd('0x45')](handleError(_0x17f929,null));};exports['removeUsers']=function(_0x2d9228,_0x13477f,_0x54ebb5){return db[_0x96fd('0x2d')]['find']({'where':{'id':_0x2d9228['params']['id']}})['then'](handleEntityNotFound(_0x13477f,null))[_0x96fd('0x25')](function(_0x51787e){if(_0x51787e){return _0x51787e[_0x96fd('0x53')](_0x2d9228['query']['ids'])[_0x96fd('0x25')](function(){if(_[_0x96fd('0x54')](_0x2d9228[_0x96fd('0x32')][_0x96fd('0x52')])){for(var _0x29d12b=0x0;_0x29d12b<_0x2d9228[_0x96fd('0x32')][_0x96fd('0x52')]['length'];_0x29d12b+=0x1){socket[_0x96fd('0x55')](_0x96fd('0x56'),{'UserId':Number(_0x2d9228['query']['ids'][_0x29d12b]),'SquareProjectId':Number(_0x2d9228[_0x96fd('0x50')]['id'])});}}else{socket[_0x96fd('0x55')](_0x96fd('0x56'),{'UserId':Number(_0x2d9228[_0x96fd('0x32')][_0x96fd('0x52')]),'SquareProjectId':Number(_0x2d9228['params']['id'])});}});}})[_0x96fd('0x25')](respondWithStatusCode(_0x13477f,null))['catch'](handleError(_0x13477f,null));};exports[_0x96fd('0x57')]=function(_0x509598,_0xd3aad5,_0x22ed31){var _0x5c15ba={};var _0x445f1f={};var _0x10e354;var _0x56aba4;return db[_0x96fd('0x2d')][_0x96fd('0x58')]({'where':{'id':_0x509598[_0x96fd('0x50')]['id']}})[_0x96fd('0x25')](handleEntityNotFound(_0xd3aad5,null))[_0x96fd('0x25')](function(_0x184708){if(_0x184708){_0x10e354=_0x184708;_0x445f1f[_0x96fd('0x34')]=_['keys'](db['User'][_0x96fd('0x2e')]);_0x445f1f[_0x96fd('0x32')]=_[_0x96fd('0x33')](_0x509598['query']);_0x445f1f['filters']=_[_0x96fd('0x36')](_0x445f1f[_0x96fd('0x34')],_0x445f1f[_0x96fd('0x32')]);_0x5c15ba['attributes']=_[_0x96fd('0x36')](_0x445f1f[_0x96fd('0x34')],qs[_0x96fd('0x37')](_0x509598['query'][_0x96fd('0x37')]));_0x5c15ba[_0x96fd('0x35')]=_0x5c15ba[_0x96fd('0x35')][_0x96fd('0x38')]?_0x5c15ba['attributes']:_0x445f1f[_0x96fd('0x34')];_0x5c15ba['order']=qs[_0x96fd('0x3c')](_0x509598['query'][_0x96fd('0x3c')]);_0x5c15ba[_0x96fd('0x3d')]=qs[_0x96fd('0x3e')](_[_0x96fd('0x59')](_0x509598[_0x96fd('0x32')],_0x445f1f['filters']));if(_0x509598['query']['filter']){_0x5c15ba[_0x96fd('0x3d')]=_[_0x96fd('0x5a')](_0x5c15ba['where'],{'$or':_[_0x96fd('0x2c')](_0x5c15ba[_0x96fd('0x35')],function(_0x521a17){var _0x1f12bf={};_0x1f12bf[_0x521a17]={'$like':'%'+_0x509598['query'][_0x96fd('0x3f')]+'%'};return _0x1f12bf;})});}_0x5c15ba=_[_0x96fd('0x5a')]({},_0x5c15ba,_0x509598[_0x96fd('0x41')]);return _0x10e354['getUsers'](_0x5c15ba);}})['then'](function(_0x1f2117){if(_0x1f2117){_0x56aba4=_0x1f2117[_0x96fd('0x38')];if(!_0x509598[_0x96fd('0x32')][_0x96fd('0x39')](_0x96fd('0x3a'))){_0x5c15ba[_0x96fd('0x1f')]=qs[_0x96fd('0x1f')](_0x509598[_0x96fd('0x32')][_0x96fd('0x1f')]);_0x5c15ba['offset']=qs[_0x96fd('0x1e')](_0x509598[_0x96fd('0x32')]['offset']);}return _0x10e354[_0x96fd('0x57')](_0x5c15ba);}})[_0x96fd('0x25')](function(_0x386f89){if(_0x386f89){return _0x386f89?{'count':_0x56aba4,'rows':_0x386f89}:null;}})[_0x96fd('0x25')](respondWithResult(_0xd3aad5,null))[_0x96fd('0x45')](handleError(_0xd3aad5,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index e57feca..1c9b372 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 _0x363b=['emit','exports','events','../../mysqldb','SquareProject','setMaxListeners','save','update','remove'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x363b,0x17c));var _0xb363=function(_0x265596,_0x23947a){_0x265596=_0x265596-0x0;var _0x3f8d6b=_0x363b[_0x265596];return _0x3f8d6b;};'use strict';var EventEmitter=require(_0xb363('0x0'));var SquareProject=require(_0xb363('0x1'))['db'][_0xb363('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xb363('0x3')](0x0);var events={'afterCreate':_0xb363('0x4'),'afterUpdate':_0xb363('0x5'),'afterDestroy':_0xb363('0x6')};function emitEvent(_0x356393){return function(_0x18d5fb,_0x1e9bca,_0x49e77c){SquareProjectEvents[_0xb363('0x7')](_0x356393+':'+_0x18d5fb['id'],_0x18d5fb);SquareProjectEvents[_0xb363('0x7')](_0x356393,_0x18d5fb);_0x49e77c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0xb363('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0x7857=['setMaxListeners','save','remove','emit','exports','events','../../mysqldb'];(function(_0x2b7f97,_0x3fe5c6){var _0x3c2339=function(_0x12e36c){while(--_0x12e36c){_0x2b7f97['push'](_0x2b7f97['shift']());}};_0x3c2339(++_0x3fe5c6);}(_0x7857,0x1a9));var _0x7785=function(_0x4cf510,_0x2ef297){_0x4cf510=_0x4cf510-0x0;var _0x5d926a=_0x7857[_0x4cf510];return _0x5d926a;};'use strict';var EventEmitter=require(_0x7785('0x0'));var SquareProject=require(_0x7785('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x7785('0x2')](0x0);var events={'afterCreate':_0x7785('0x3'),'afterUpdate':'update','afterDestroy':_0x7785('0x4')};function emitEvent(_0x294fe6){return function(_0x2d425b,_0x4e5021,_0x130b5b){SquareProjectEvents[_0x7785('0x5')](_0x294fe6+':'+_0x2d425b['id'],_0x2d425b);SquareProjectEvents[_0x7785('0x5')](_0x294fe6,_0x2d425b);_0x130b5b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x7785('0x6')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 15bcc3a..fe910df 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 _0x378f=['square_projects','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./squareProject.attributes','exports','define','SquareProject'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x378f,0xd9));var _0xf378=function(_0x9e6711,_0x1a86f2){_0x9e6711=_0x9e6711-0x0;var _0x29e620=_0x378f[_0x9e6711];return _0x29e620;};'use strict';var _=require(_0xf378('0x0'));var util=require('util');var logger=require(_0xf378('0x1'))(_0xf378('0x2'));var moment=require(_0xf378('0x3'));var BPromise=require(_0xf378('0x4'));var rp=require(_0xf378('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf378('0x6'));var attributes=require(_0xf378('0x7'));module[_0xf378('0x8')]=function(_0x14d50d,_0x59a70d){return _0x14d50d[_0xf378('0x9')](_0xf378('0xa'),attributes,{'tableName':_0xf378('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x39ef=['./squareProject.attributes','exports','define','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2dd7a6,_0x4c86b4){var _0x457024=function(_0x575069){while(--_0x575069){_0x2dd7a6['push'](_0x2dd7a6['shift']());}};_0x457024(++_0x4c86b4);}(_0x39ef,0x157));var _0xf39e=function(_0x33320a,_0x40563c){_0x33320a=_0x33320a-0x0;var _0x2110fd=_0x39ef[_0x33320a];return _0x2110fd;};'use strict';var _=require(_0xf39e('0x0'));var util=require(_0xf39e('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xf39e('0x2'));var rp=require(_0xf39e('0x3'));var fs=require('fs');var path=require(_0xf39e('0x4'));var rimraf=require(_0xf39e('0x5'));var config=require(_0xf39e('0x6'));var attributes=require(_0xf39e('0x7'));module[_0xf39e('0x8')]=function(_0x13e1f4,_0xb80798){return _0x13e1f4[_0xf39e('0x9')]('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 9aa4ef2..f8bfefa 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 _0x78e8=['ShowSquareProject','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','request','then','info','SquareProject,\x20%s,\x20%s','debug','SquareProject,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','find','options','raw','where','include','map','model','attributes'];(function(_0x3d9565,_0x5db973){var _0x546f66=function(_0x137352){while(--_0x137352){_0x3d9565['push'](_0x3d9565['shift']());}};_0x546f66(++_0x5db973);}(_0x78e8,0xef));var _0x878e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x78e8[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0x878e('0x0'));var moment=require(_0x878e('0x1'));var BPromise=require(_0x878e('0x2'));var rs=require(_0x878e('0x3'));var fs=require('fs');var Redis=require(_0x878e('0x4'));var db=require(_0x878e('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x878e('0x6'));var config=require(_0x878e('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x878e('0x8')]({'port':0x232a});config['redis']=_[_0x878e('0x9')](config[_0x878e('0xa')],{'host':_0x878e('0xb'),'port':0x18eb});var socket=require(_0x878e('0xc'))(new Redis(config['redis']));require(_0x878e('0xd'))['register'](socket);function respondWithRpcPromise(_0x4eca77,_0xfbb629,_0x9371de){return new BPromise(function(_0x8c579,_0x37b5f9){return client[_0x878e('0xe')](_0x4eca77,_0x9371de)[_0x878e('0xf')](function(_0x14d821){logger[_0x878e('0x10')](_0x878e('0x11'),_0xfbb629,'request\x20sent');logger[_0x878e('0x12')](_0x878e('0x13'),_0xfbb629,_0x878e('0x14'),JSON['stringify'](_0x14d821));if(_0x14d821[_0x878e('0x15')]){if(_0x14d821[_0x878e('0x15')][_0x878e('0x16')]===0x1f4){logger['error']('SquareProject,\x20%s,\x20%s',_0xfbb629,_0x14d821[_0x878e('0x15')][_0x878e('0x17')]);return _0x37b5f9(_0x14d821[_0x878e('0x15')][_0x878e('0x17')]);}logger[_0x878e('0x15')](_0x878e('0x11'),_0xfbb629,_0x14d821[_0x878e('0x15')][_0x878e('0x17')]);return _0x8c579(_0x14d821[_0x878e('0x15')][_0x878e('0x17')]);}else{logger[_0x878e('0x10')](_0x878e('0x11'),_0xfbb629,_0x878e('0x14'));_0x8c579(_0x14d821['result']['message']);}})[_0x878e('0x18')](function(_0x10aba0){logger[_0x878e('0x15')](_0x878e('0x11'),_0xfbb629,_0x10aba0);_0x37b5f9(_0x10aba0);});});}exports['ShowSquareProject']=function(_0x563b45){var _0x2cc5f3=this;return new Promise(function(_0x4ac10,_0x32568e){return db['SquareProject'][_0x878e('0x19')]({'raw':_0x563b45[_0x878e('0x1a')]?_0x563b45[_0x878e('0x1a')][_0x878e('0x1b')]===undefined?!![]:![]:!![],'where':_0x563b45[_0x878e('0x1a')]?_0x563b45['options'][_0x878e('0x1c')]||null:null,'attributes':_0x563b45[_0x878e('0x1a')]?_0x563b45[_0x878e('0x1a')]['attributes']||null:null,'include':_0x563b45['options']?_0x563b45[_0x878e('0x1a')][_0x878e('0x1d')]?_[_0x878e('0x1e')](_0x563b45[_0x878e('0x1a')][_0x878e('0x1d')],function(_0x1660b2){return{'model':db[_0x1660b2[_0x878e('0x1f')]],'as':_0x1660b2['as'],'attributes':_0x1660b2['attributes'],'include':_0x1660b2[_0x878e('0x1d')]?_[_0x878e('0x1e')](_0x1660b2[_0x878e('0x1d')],function(_0x217ce5){return{'model':db[_0x217ce5[_0x878e('0x1f')]],'as':_0x217ce5['as'],'attributes':_0x217ce5[_0x878e('0x20')],'include':_0x217ce5[_0x878e('0x1d')]?_[_0x878e('0x1e')](_0x217ce5[_0x878e('0x1d')],function(_0x471959){return{'model':db[_0x471959[_0x878e('0x1f')]],'as':_0x471959['as'],'attributes':_0x471959[_0x878e('0x20')]};}):[]};}):[]};}):[]:[]})[_0x878e('0xf')](function(_0x6b9d62){logger[_0x878e('0x10')](_0x878e('0x21'),_0x563b45);logger[_0x878e('0x12')](_0x878e('0x21'),_0x563b45,JSON['stringify'](_0x6b9d62));_0x4ac10(_0x6b9d62);})['catch'](function(_0x48527b){logger[_0x878e('0x15')]('ShowSquareProject',_0x48527b[_0x878e('0x17')],_0x563b45);_0x32568e(_0x2cc5f3['error'](0x1f4,_0x48527b['message']));});});}; \ No newline at end of file +var _0x5bf3=['http','redis','localhost','./squareProject.socket','register','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','find','options','raw','include','map','model','attributes','ShowSquareProject','stringify','lodash','util','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x5b57d4,_0x58b01b){var _0x28400f=function(_0x394cfd){while(--_0x394cfd){_0x5b57d4['push'](_0x5b57d4['shift']());}};_0x28400f(++_0x58b01b);}(_0x5bf3,0x1e8));var _0x35bf=function(_0x4c5c95,_0x389b35){_0x4c5c95=_0x4c5c95-0x0;var _0x261209=_0x5bf3[_0x4c5c95];return _0x261209;};'use strict';var _=require(_0x35bf('0x0'));var util=require(_0x35bf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x35bf('0x2'));var fs=require('fs');var Redis=require(_0x35bf('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x35bf('0x4'))('rpc');var config=require(_0x35bf('0x5'));var jayson=require(_0x35bf('0x6'));var client=jayson[_0x35bf('0x7')][_0x35bf('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0x35bf('0x9')],{'host':_0x35bf('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x35bf('0x9')]));require(_0x35bf('0xb'))[_0x35bf('0xc')](socket);function respondWithRpcPromise(_0xe1b32a,_0x21dcb4,_0x55b8f0){return new BPromise(function(_0x3c8b1b,_0x453f24){return client['request'](_0xe1b32a,_0x55b8f0)[_0x35bf('0xd')](function(_0x3b8fb5){logger[_0x35bf('0xe')](_0x35bf('0xf'),_0x21dcb4,_0x35bf('0x10'));logger[_0x35bf('0x11')]('SquareProject,\x20%s,\x20%s,\x20%s',_0x21dcb4,_0x35bf('0x10'),JSON['stringify'](_0x3b8fb5));if(_0x3b8fb5[_0x35bf('0x12')]){if(_0x3b8fb5[_0x35bf('0x12')]['code']===0x1f4){logger[_0x35bf('0x12')](_0x35bf('0xf'),_0x21dcb4,_0x3b8fb5[_0x35bf('0x12')][_0x35bf('0x13')]);return _0x453f24(_0x3b8fb5[_0x35bf('0x12')][_0x35bf('0x13')]);}logger['error'](_0x35bf('0xf'),_0x21dcb4,_0x3b8fb5[_0x35bf('0x12')][_0x35bf('0x13')]);return _0x3c8b1b(_0x3b8fb5['error']['message']);}else{logger['info'](_0x35bf('0xf'),_0x21dcb4,_0x35bf('0x10'));_0x3c8b1b(_0x3b8fb5[_0x35bf('0x14')][_0x35bf('0x13')]);}})[_0x35bf('0x15')](function(_0x2679df){logger[_0x35bf('0x12')](_0x35bf('0xf'),_0x21dcb4,_0x2679df);_0x453f24(_0x2679df);});});}exports['ShowSquareProject']=function(_0x3e2a0a){var _0x329213=this;return new Promise(function(_0x56fb41,_0x3c4581){return db['SquareProject'][_0x35bf('0x16')]({'raw':_0x3e2a0a[_0x35bf('0x17')]?_0x3e2a0a[_0x35bf('0x17')][_0x35bf('0x18')]===undefined?!![]:![]:!![],'where':_0x3e2a0a[_0x35bf('0x17')]?_0x3e2a0a[_0x35bf('0x17')]['where']||null:null,'attributes':_0x3e2a0a[_0x35bf('0x17')]?_0x3e2a0a[_0x35bf('0x17')]['attributes']||null:null,'include':_0x3e2a0a[_0x35bf('0x17')]?_0x3e2a0a[_0x35bf('0x17')][_0x35bf('0x19')]?_[_0x35bf('0x1a')](_0x3e2a0a[_0x35bf('0x17')][_0x35bf('0x19')],function(_0x3a159b){return{'model':db[_0x3a159b[_0x35bf('0x1b')]],'as':_0x3a159b['as'],'attributes':_0x3a159b[_0x35bf('0x1c')],'include':_0x3a159b[_0x35bf('0x19')]?_['map'](_0x3a159b[_0x35bf('0x19')],function(_0x180e7c){return{'model':db[_0x180e7c[_0x35bf('0x1b')]],'as':_0x180e7c['as'],'attributes':_0x180e7c[_0x35bf('0x1c')],'include':_0x180e7c['include']?_[_0x35bf('0x1a')](_0x180e7c['include'],function(_0x108086){return{'model':db[_0x108086[_0x35bf('0x1b')]],'as':_0x108086['as'],'attributes':_0x108086[_0x35bf('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x35bf('0xd')](function(_0x144efb){logger[_0x35bf('0xe')](_0x35bf('0x1d'),_0x3e2a0a);logger[_0x35bf('0x11')](_0x35bf('0x1d'),_0x3e2a0a,JSON[_0x35bf('0x1e')](_0x144efb));_0x56fb41(_0x144efb);})[_0x35bf('0x15')](function(_0xfe2503){logger[_0x35bf('0x12')](_0x35bf('0x1d'),_0xfe2503[_0x35bf('0x13')],_0x3e2a0a);_0x3c4581(_0x329213['error'](0x1f4,_0xfe2503[_0x35bf('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index fd06f3d..f8e1ffa 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 _0x3f8a=['squareProject:','./squareProject.events','save','remove','update','emit','removeListener','register','length'];(function(_0x7026aa,_0x174e96){var _0x35a685=function(_0xf607ef){while(--_0xf607ef){_0x7026aa['push'](_0x7026aa['shift']());}};_0x35a685(++_0x174e96);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x412774,_0x3b6fde){_0x412774=_0x412774-0x0;var _0x2cf781=_0x3f8a[_0x412774];return _0x2cf781;};'use strict';var SquareProjectEvents=require(_0xa3f8('0x0'));var events=[_0xa3f8('0x1'),_0xa3f8('0x2'),_0xa3f8('0x3')];function createListener(_0x512b4c,_0x467a6c){return function(_0x143375){_0x467a6c[_0xa3f8('0x4')](_0x512b4c,_0x143375);};}function removeListener(_0x15b6aa,_0x2553fd){return function(){SquareProjectEvents[_0xa3f8('0x5')](_0x15b6aa,_0x2553fd);};}exports[_0xa3f8('0x6')]=function(_0x471464){for(var _0x1f160a=0x0,_0xf895d9=events[_0xa3f8('0x7')];_0x1f160a<_0xf895d9;_0x1f160a++){var _0x268332=events[_0x1f160a];var _0x2faf2e=createListener(_0xa3f8('0x8')+_0x268332,_0x471464);SquareProjectEvents['on'](_0x268332,_0x2faf2e);}}; \ No newline at end of file +var _0xc4aa=['remove','update','removeListener','register','length','./squareProject.events','save'];(function(_0x1c30dc,_0xbc0c95){var _0x4a9099=function(_0x37a03e){while(--_0x37a03e){_0x1c30dc['push'](_0x1c30dc['shift']());}};_0x4a9099(++_0xbc0c95);}(_0xc4aa,0x1b7));var _0xac4a=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xc4aa[_0xaa1b3e];return _0x454d7d;};'use strict';var SquareProjectEvents=require(_0xac4a('0x0'));var events=[_0xac4a('0x1'),_0xac4a('0x2'),_0xac4a('0x3')];function createListener(_0x275161,_0x22469d){return function(_0x58634e){_0x22469d['emit'](_0x275161,_0x58634e);};}function removeListener(_0x47d4f6,_0x2f48ed){return function(){SquareProjectEvents[_0xac4a('0x4')](_0x47d4f6,_0x2f48ed);};}exports[_0xac4a('0x5')]=function(_0x215f39){for(var _0x96be2b=0x0,_0x15cd34=events[_0xac4a('0x6')];_0x96be2b<_0x15cd34;_0x96be2b++){var _0x10525b=events[_0x96be2b];var _0x5c6179=createListener('squareProject:'+_0x10525b,_0x215f39);SquareProjectEvents['on'](_0x10525b,_0x5c6179);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index dd17477..8b110ae 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 _0xdc04=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','/:id/download','download','put','update','delete','/:id/delete','destroy','exports','multer','util'];(function(_0x378a56,_0x31885a){var _0x149db0=function(_0x33eb59){while(--_0x33eb59){_0x378a56['push'](_0x378a56['shift']());}};_0x149db0(++_0x31885a);}(_0xdc04,0x108));var _0x4dc0=function(_0x57a41b,_0x280ae0){_0x57a41b=_0x57a41b-0x0;var _0x21b55f=_0xdc04[_0x57a41b];return _0x21b55f;};'use strict';var multer=require(_0x4dc0('0x0'));var util=require(_0x4dc0('0x1'));var path=require('path');var timeout=require(_0x4dc0('0x2'));var express=require(_0x4dc0('0x3'));var router=express['Router']();var auth=require(_0x4dc0('0x4'));var interaction=require(_0x4dc0('0x5'));var config=require('../../config/environment');var controller=require('./squareRecording.controller');router[_0x4dc0('0x6')]('/',auth['isAuthenticated'](),controller[_0x4dc0('0x7')]);router['get'](_0x4dc0('0x8'),auth[_0x4dc0('0x9')](),controller[_0x4dc0('0xa')]);router[_0x4dc0('0x6')](_0x4dc0('0xb'),auth['isAuthenticated'](),controller[_0x4dc0('0xc')]);router['post']('/',auth[_0x4dc0('0x9')](),controller['create']);router[_0x4dc0('0xd')](_0x4dc0('0x8'),auth[_0x4dc0('0x9')](),controller[_0x4dc0('0xe')]);router[_0x4dc0('0xf')](_0x4dc0('0x10'),auth['isAuthenticated'](),controller[_0x4dc0('0x11')]);module[_0x4dc0('0x12')]=router; \ No newline at end of file +var _0x3a35=['put','update','delete','/:id/delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','create'];(function(_0x59c28f,_0x2a0876){var _0x5e8ab6=function(_0x13bcc1){while(--_0x13bcc1){_0x59c28f['push'](_0x59c28f['shift']());}};_0x5e8ab6(++_0x2a0876);}(_0x3a35,0xf6));var _0x53a3=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x3a35[_0x491a7f];return _0x3d8f44;};'use strict';var multer=require(_0x53a3('0x0'));var util=require(_0x53a3('0x1'));var path=require(_0x53a3('0x2'));var timeout=require(_0x53a3('0x3'));var express=require(_0x53a3('0x4'));var router=express[_0x53a3('0x5')]();var auth=require(_0x53a3('0x6'));var interaction=require(_0x53a3('0x7'));var config=require(_0x53a3('0x8'));var controller=require(_0x53a3('0x9'));router[_0x53a3('0xa')]('/',auth[_0x53a3('0xb')](),controller['index']);router[_0x53a3('0xa')](_0x53a3('0xc'),auth[_0x53a3('0xb')](),controller[_0x53a3('0xd')]);router[_0x53a3('0xa')](_0x53a3('0xe'),auth[_0x53a3('0xb')](),controller[_0x53a3('0xf')]);router[_0x53a3('0x10')]('/',auth[_0x53a3('0xb')](),controller[_0x53a3('0x11')]);router[_0x53a3('0x12')](_0x53a3('0xc'),auth['isAuthenticated'](),controller[_0x53a3('0x13')]);router[_0x53a3('0x14')](_0x53a3('0x15'),auth[_0x53a3('0xb')](),controller[_0x53a3('0x16')]);module[_0x53a3('0x17')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 5e74d2f..d6f2896 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 _0x079b=['VIRTUAL','getDataValue','savePath','substring','lastIndexOf','sequelize','exports','STRING'];(function(_0x1ed878,_0x1cd3e7){var _0x236e54=function(_0xc7e43c){while(--_0xc7e43c){_0x1ed878['push'](_0x1ed878['shift']());}};_0x236e54(++_0x1cd3e7);}(_0x079b,0x165));var _0xb079=function(_0x2b70df,_0x224881){_0x2b70df=_0x2b70df-0x0;var _0x44b705=_0x079b[_0x2b70df];return _0x44b705;};'use strict';var Sequelize=require(_0xb079('0x0'));module[_0xb079('0x1')]={'uniqueid':{'type':Sequelize[_0xb079('0x2')]},'callerid':{'type':Sequelize[_0xb079('0x2')]},'calleridname':{'type':Sequelize[_0xb079('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xb079('0x2')]},'accountcode':{'type':Sequelize[_0xb079('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xb079('0x2')]},'saveName':{'type':Sequelize[_0xb079('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0xb079('0x2')]},'format':{'type':Sequelize[_0xb079('0x3')],'get':function(){var _0xec7d79='';var _0x1ce51d=this[_0xb079('0x4')](_0xb079('0x5'));if(_0x1ce51d){_0xec7d79=_0x1ce51d[_0xb079('0x6')](_0x1ce51d[_0xb079('0x7')]('.'));}return _0xec7d79;}}}; \ No newline at end of file +var _0x428b=['STRING','VIRTUAL','getDataValue','substring','lastIndexOf','sequelize','exports'];(function(_0x5bea9d,_0x48ed0f){var _0xb84519=function(_0x2805b1){while(--_0x2805b1){_0x5bea9d['push'](_0x5bea9d['shift']());}};_0xb84519(++_0x48ed0f);}(_0x428b,0xd0));var _0xb428=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x428b[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xb428('0x0'));module[_0xb428('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xb428('0x2')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xb428('0x2')]},'extension':{'type':Sequelize[_0xb428('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xb428('0x2')]},'projectName':{'type':Sequelize[_0xb428('0x2')]},'saveName':{'type':Sequelize[_0xb428('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0xb428('0x2')]},'format':{'type':Sequelize[_0xb428('0x3')],'get':function(){var _0x9ffb00='';var _0x1e0f24=this[_0xb428('0x4')]('savePath');if(_0x1e0f24){_0x9ffb00=_0x1e0f24[_0xb428('0x5')](_0x1e0f24[_0xb428('0x6')]('.'));}return _0x9ffb00;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 79d29a7..6e5289d 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 _0x64f3=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','save','destroy','then','error','stack','send','map','SquareRecording','fieldName','type','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','name','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','catch','create','body','../../components/encryptor','uniqueid','savePath','filename','format','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','download','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','eml-format','rimraf','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs'];(function(_0x18a203,_0x10430e){var _0x1b0743=function(_0x283fe9){while(--_0x283fe9){_0x18a203['push'](_0x18a203['shift']());}};_0x1b0743(++_0x10430e);}(_0x64f3,0x160));var _0x364f=function(_0x36e3cd,_0x4ff225){_0x36e3cd=_0x36e3cd-0x0;var _0x19f9d6=_0x64f3[_0x36e3cd];return _0x19f9d6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x364f('0x0'));var rimraf=require(_0x364f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x364f('0x2'));var path=require('path');var sox=require(_0x364f('0x3'));var csv=require(_0x364f('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x364f('0x5'));var squel=require(_0x364f('0x6'));var crypto=require(_0x364f('0x7'));var jsforce=require(_0x364f('0x8'));var deskjs=require(_0x364f('0x9'));var toCsv=require(_0x364f('0x4'));var querystring=require('querystring');var Papa=require(_0x364f('0xa'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x364f('0xb'));var as=require(_0x364f('0xc'));var hardwareService=require(_0x364f('0xd'));var logger=require(_0x364f('0xe'))('api');var utils=require(_0x364f('0xf'));var config=require(_0x364f('0x10'));var db=require(_0x364f('0x11'))['db'];function respondWithStatusCode(_0x20ff84,_0x3c47b2){_0x3c47b2=_0x3c47b2||0xcc;return function(_0x5d341f){if(_0x5d341f){return _0x20ff84[_0x364f('0x12')](_0x3c47b2);}return _0x20ff84[_0x364f('0x13')](_0x3c47b2)[_0x364f('0x14')]();};}function respondWithResult(_0x56d9ab,_0x5e5f9b){_0x5e5f9b=_0x5e5f9b||0xc8;return function(_0x5ee894){if(_0x5ee894){return _0x56d9ab[_0x364f('0x13')](_0x5e5f9b)[_0x364f('0x15')](_0x5ee894);}};}function respondWithFilteredResult(_0x228df1,_0x1890fa){return function(_0x25a8f5){if(_0x25a8f5){var _0xce7505=_0x25a8f5[_0x364f('0x16')],_0x3ed3af=_0x1890fa[_0x364f('0x17')],_0x3e1d74=_0x1890fa[_0x364f('0x17')]+_0x1890fa[_0x364f('0x18')],_0x4b55ab;if(_0x3e1d74>=_0xce7505){_0x3e1d74=_0xce7505;_0x4b55ab=0xc8;}else{_0x4b55ab=0xce;}_0x228df1[_0x364f('0x13')](_0x4b55ab);return _0x228df1[_0x364f('0x19')]('Content-Range',_0x3ed3af+'-'+_0x3e1d74+'/'+_0xce7505)[_0x364f('0x15')](_0x25a8f5);}return null;};}function patchUpdates(_0x5a1654){return function(_0x22c437){try{jsonpatch[_0x364f('0x1a')](_0x22c437,_0x5a1654,!![]);}catch(_0x5da2ff){return BPromise['reject'](_0x5da2ff);}return _0x22c437[_0x364f('0x1b')]();};}function saveUpdates(_0x2437a3,_0x5db011){return function(_0x36422c){if(_0x36422c){return _0x36422c['update'](_0x2437a3)['then'](function(_0x4b1abe){return _0x4b1abe;});}return null;};}function removeEntity(_0x4cf407,_0x47e4a3){return function(_0x1dc799){if(_0x1dc799){return _0x1dc799[_0x364f('0x1c')]()[_0x364f('0x1d')](function(){_0x4cf407[_0x364f('0x13')](0xcc)[_0x364f('0x14')]();});}};}function handleEntityNotFound(_0x4ea6ae,_0x2103a2){return function(_0x1dae8f){if(!_0x1dae8f){_0x4ea6ae[_0x364f('0x12')](0x194);}return _0x1dae8f;};}function handleError(_0x36838b,_0x4fe691){_0x4fe691=_0x4fe691||0x1f4;return function(_0x3d384d){logger[_0x364f('0x1e')](_0x3d384d[_0x364f('0x1f')]);if(_0x3d384d['name']){delete _0x3d384d['name'];}_0x36838b['status'](_0x4fe691)[_0x364f('0x20')](_0x3d384d);};}exports['index']=function(_0x400cb9,_0x57d81e){var _0x46b641={},_0x261b33={},_0x20b437={'count':0x0,'rows':[]};var _0x244798=_[_0x364f('0x21')](db[_0x364f('0x22')]['rawAttributes'],function(_0x33ecae){return{'name':_0x33ecae[_0x364f('0x23')],'type':_0x33ecae[_0x364f('0x24')]['key']};});_0x261b33['model']=_['map'](_0x244798,'name');_0x261b33[_0x364f('0x25')]=_['keys'](_0x400cb9[_0x364f('0x25')]);_0x261b33[_0x364f('0x26')]=_[_0x364f('0x27')](_0x261b33[_0x364f('0x28')],_0x261b33[_0x364f('0x25')]);_0x46b641['attributes']=_[_0x364f('0x27')](_0x261b33[_0x364f('0x28')],qs[_0x364f('0x29')](_0x400cb9[_0x364f('0x25')][_0x364f('0x29')]));_0x46b641[_0x364f('0x2a')]=_0x46b641[_0x364f('0x2a')][_0x364f('0x2b')]?_0x46b641[_0x364f('0x2a')]:_0x261b33['model'];if(!_0x400cb9[_0x364f('0x25')][_0x364f('0x2c')](_0x364f('0x2d'))){_0x46b641[_0x364f('0x18')]=qs[_0x364f('0x18')](_0x400cb9[_0x364f('0x25')]['limit']);_0x46b641['offset']=qs[_0x364f('0x17')](_0x400cb9[_0x364f('0x25')]['offset']);}_0x46b641[_0x364f('0x2e')]=qs[_0x364f('0x2f')](_0x400cb9[_0x364f('0x25')][_0x364f('0x2f')]);_0x46b641[_0x364f('0x30')]=qs['filters'](_[_0x364f('0x31')](_0x400cb9['query'],_0x261b33['filters']),_0x244798);if(_0x400cb9['query']['filter']){_0x46b641[_0x364f('0x30')]=_['merge'](_0x46b641[_0x364f('0x30')],{'$or':_[_0x364f('0x21')](_0x244798,function(_0x24e826){if(_0x24e826[_0x364f('0x24')]!==_0x364f('0x32')){var _0x3e5903={};_0x3e5903[_0x24e826[_0x364f('0x33')]]={'$like':'%'+_0x400cb9['query'][_0x364f('0x34')]+'%'};return _0x3e5903;}})});}_0x46b641=_[_0x364f('0x35')]({},_0x46b641,_0x400cb9[_0x364f('0x36')]);var _0x454197={'where':_0x46b641[_0x364f('0x30')]};return db[_0x364f('0x22')][_0x364f('0x16')](_0x454197)[_0x364f('0x1d')](function(_0xdd7130){_0x20b437[_0x364f('0x16')]=_0xdd7130;if(_0x400cb9[_0x364f('0x25')][_0x364f('0x37')]){_0x46b641[_0x364f('0x38')]=[{'all':!![]}];}return db[_0x364f('0x22')][_0x364f('0x39')](_0x46b641);})[_0x364f('0x1d')](function(_0x412bed){_0x20b437[_0x364f('0x3a')]=_0x412bed;return _0x20b437;})[_0x364f('0x1d')](respondWithFilteredResult(_0x57d81e,_0x46b641))['catch'](handleError(_0x57d81e,null));};exports[_0x364f('0x3b')]=function(_0x2bd58d,_0x5e2e36){var _0x1b6173={'raw':!![],'where':{'id':_0x2bd58d[_0x364f('0x3c')]['id']}},_0x4dfd04={};_0x4dfd04[_0x364f('0x28')]=_[_0x364f('0x3d')](db['SquareRecording'][_0x364f('0x3e')]);_0x4dfd04[_0x364f('0x25')]=_[_0x364f('0x3d')](_0x2bd58d['query']);_0x4dfd04[_0x364f('0x26')]=_[_0x364f('0x27')](_0x4dfd04[_0x364f('0x28')],_0x4dfd04['query']);_0x1b6173[_0x364f('0x2a')]=_[_0x364f('0x27')](_0x4dfd04[_0x364f('0x28')],qs[_0x364f('0x29')](_0x2bd58d[_0x364f('0x25')][_0x364f('0x29')]));_0x1b6173[_0x364f('0x2a')]=_0x1b6173['attributes']['length']?_0x1b6173[_0x364f('0x2a')]:_0x4dfd04[_0x364f('0x28')];if(_0x2bd58d[_0x364f('0x25')][_0x364f('0x37')]){_0x1b6173[_0x364f('0x38')]=[{'all':!![]}];}_0x1b6173=_['merge']({},_0x1b6173,_0x2bd58d[_0x364f('0x36')]);return db[_0x364f('0x22')][_0x364f('0x3f')](_0x1b6173)['then'](handleEntityNotFound(_0x5e2e36,null))[_0x364f('0x1d')](respondWithResult(_0x5e2e36,null))[_0x364f('0x40')](handleError(_0x5e2e36,null));};exports[_0x364f('0x41')]=function(_0xdc0bc9,_0x291f4a){return db[_0x364f('0x22')]['create'](_0xdc0bc9[_0x364f('0x42')],{})['then'](respondWithResult(_0x291f4a,0xc9))['catch'](handleError(_0x291f4a,null));};exports['update']=function(_0x143f39,_0x1445e6){if(_0x143f39[_0x364f('0x42')]['id']){delete _0x143f39[_0x364f('0x42')]['id'];}return db[_0x364f('0x22')][_0x364f('0x3f')]({'where':{'id':_0x143f39[_0x364f('0x3c')]['id']}})[_0x364f('0x1d')](handleEntityNotFound(_0x1445e6,null))['then'](saveUpdates(_0x143f39[_0x364f('0x42')],null))[_0x364f('0x1d')](respondWithResult(_0x1445e6,null))[_0x364f('0x40')](handleError(_0x1445e6,null));};exports['download']=function(_0x9372ef,_0x323aa6,_0x337890){var _0x3514e4=require(_0x364f('0x43'));var _0x58542b=![];var _0x279d31={};if(_0x9372ef['query']['type']&&_0x9372ef[_0x364f('0x25')][_0x364f('0x24')]===_0x364f('0x44')){_0x279d31[_0x364f('0x44')]=_0x9372ef[_0x364f('0x3c')]['id'];}else{_0x279d31['id']=_0x9372ef['params']['id'];}return db[_0x364f('0x22')][_0x364f('0x3f')]({'where':_0x279d31,'attributes':['id',_0x364f('0x45'),_0x364f('0x46')],'raw':!![]})[_0x364f('0x1d')](handleEntityNotFound(_0x323aa6,null))[_0x364f('0x1d')](function(_0xf3328){if(_0xf3328){var _0x2969a4=_0xf3328[_0x364f('0x45')];var _0x3999fc=util[_0x364f('0x47')]('%s.cypher',_0x2969a4);if(fs['existsSync'](_0x3999fc)){_0x58542b=!![];return _0x3514e4[_0x364f('0x48')](_0x3999fc,_0x2969a4,config[_0x364f('0x49')][_0x364f('0x4a')])[_0x364f('0x1d')](function(){return _0xf3328;});}return _0xf3328;}})[_0x364f('0x1d')](function(_0x47617e){if(_0x47617e){var _0x102e9e=_0x47617e[_0x364f('0x45')];if(!fs[_0x364f('0x4b')](_0x102e9e)){throw new db[(_0x364f('0x4c'))][(_0x364f('0x4d'))](_0x364f('0x4e'));}if(_0x47617e[_0x364f('0x46')]){return _0x323aa6[_0x364f('0x4f')](_0x102e9e,_0x47617e[_0x364f('0x46')]+path[_0x364f('0x50')](_0x102e9e),function(){if(_0x58542b){fs[_0x364f('0x51')](_0x102e9e);}});}else{return _0x323aa6['download'](_0x102e9e,function(_0x9d3d03){if(_0x58542b){fs[_0x364f('0x51')](_0x102e9e);}});}}})[_0x364f('0x40')](function(_0x284c53){if(_0x284c53[_0x364f('0x52')]===_0x364f('0x4e')){_0x323aa6['status'](0x194)[_0x364f('0x20')](_0x364f('0x53'));}else{return handleError(_0x323aa6,null);}});};exports['destroy']=function(_0x15078e,_0x5533af){return db[_0x364f('0x22')]['find']({'where':{'id':_0x15078e[_0x364f('0x3c')]['id']}})[_0x364f('0x1d')](function(_0x1efe3a){if(!_0x1efe3a)throw new ReferenceError(_0x364f('0x54'));return _0x1efe3a;})[_0x364f('0x1d')](function(_0x111611){var _0x302448=_0x111611['savePath'];logger[_0x364f('0x55')](_0x364f('0x56'),_0x302448);if(!_[_0x364f('0x57')](_0x111611[_0x364f('0x45')])&&fs[_0x364f('0x4b')](_0x302448)){logger[_0x364f('0x55')](_0x364f('0x58')+_0x302448+_0x364f('0x59'));fs['unlinkSync'](_0x302448);}_0x302448=_0x302448+_0x364f('0x5a');if(!_[_0x364f('0x57')](_0x111611[_0x364f('0x45')])&&fs['existsSync'](_0x302448)){logger['info'](_0x364f('0x58')+_0x302448+_0x364f('0x59'));fs['unlinkSync'](_0x302448);}return _0x111611;})[_0x364f('0x1d')](function(_0xb0d01a){if(!_0xb0d01a)throw new InternalError();return _0xb0d01a[_0x364f('0x1c')]();})[_0x364f('0x1d')](function(){_0x5533af[_0x364f('0x13')](0xcc)[_0x364f('0x14')]();})[_0x364f('0x40')](handleError(_0x5533af,null));}; \ No newline at end of file +var _0x30b6=['sort','where','pick','merge','VIRTUAL','filter','includeAll','rows','show','params','keys','rawAttributes','include','options','catch','create','body','find','download','../../components/encryptor','uniqueid','savePath','format','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','unlink','message','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','SquareRecording','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit'];(function(_0x13c779,_0x5a82a8){var _0xcaa0e0=function(_0x37fef3){while(--_0x37fef3){_0x13c779['push'](_0x13c779['shift']());}};_0xcaa0e0(++_0x5a82a8);}(_0x30b6,0x8a));var _0x630b=function(_0x491e15,_0x19559b){_0x491e15=_0x491e15-0x0;var _0x3a4c39=_0x30b6[_0x491e15];return _0x3a4c39;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x630b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x630b('0x1'));var moment=require(_0x630b('0x2'));var BPromise=require(_0x630b('0x3'));var Mustache=require(_0x630b('0x4'));var util=require(_0x630b('0x5'));var path=require(_0x630b('0x6'));var sox=require(_0x630b('0x7'));var csv=require(_0x630b('0x8'));var ejs=require(_0x630b('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x630b('0xa'));var crypto=require(_0x630b('0xb'));var jsforce=require(_0x630b('0xc'));var deskjs=require(_0x630b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x630b('0xe'));var Papa=require(_0x630b('0xf'));var Redis=require(_0x630b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x630b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x630b('0x12'));var logger=require(_0x630b('0x13'))(_0x630b('0x14'));var utils=require(_0x630b('0x15'));var config=require(_0x630b('0x16'));var db=require(_0x630b('0x17'))['db'];function respondWithStatusCode(_0x229f54,_0x394044){_0x394044=_0x394044||0xcc;return function(_0x3ebd11){if(_0x3ebd11){return _0x229f54[_0x630b('0x18')](_0x394044);}return _0x229f54[_0x630b('0x19')](_0x394044)[_0x630b('0x1a')]();};}function respondWithResult(_0x4f3969,_0x1d0a2d){_0x1d0a2d=_0x1d0a2d||0xc8;return function(_0x17cd77){if(_0x17cd77){return _0x4f3969[_0x630b('0x19')](_0x1d0a2d)['json'](_0x17cd77);}};}function respondWithFilteredResult(_0x2f59b3,_0x294c88){return function(_0x23683a){if(_0x23683a){var _0x18aa16=_0x23683a[_0x630b('0x1b')],_0x4f4754=_0x294c88[_0x630b('0x1c')],_0x4f01f3=_0x294c88[_0x630b('0x1c')]+_0x294c88[_0x630b('0x1d')],_0x8da0cc;if(_0x4f01f3>=_0x18aa16){_0x4f01f3=_0x18aa16;_0x8da0cc=0xc8;}else{_0x8da0cc=0xce;}_0x2f59b3['status'](_0x8da0cc);return _0x2f59b3[_0x630b('0x1e')](_0x630b('0x1f'),_0x4f4754+'-'+_0x4f01f3+'/'+_0x18aa16)[_0x630b('0x20')](_0x23683a);}return null;};}function patchUpdates(_0x563a2c){return function(_0x14061b){try{jsonpatch['apply'](_0x14061b,_0x563a2c,!![]);}catch(_0x1aadfc){return BPromise[_0x630b('0x21')](_0x1aadfc);}return _0x14061b[_0x630b('0x22')]();};}function saveUpdates(_0x3461ea,_0x2bf2df){return function(_0x1fb31a){if(_0x1fb31a){return _0x1fb31a[_0x630b('0x23')](_0x3461ea)[_0x630b('0x24')](function(_0x5c3f69){return _0x5c3f69;});}return null;};}function removeEntity(_0x15ce4d,_0x31e7de){return function(_0x1073f2){if(_0x1073f2){return _0x1073f2[_0x630b('0x25')]()['then'](function(){_0x15ce4d[_0x630b('0x19')](0xcc)[_0x630b('0x1a')]();});}};}function handleEntityNotFound(_0x34c74e,_0x291e51){return function(_0x26b206){if(!_0x26b206){_0x34c74e['sendStatus'](0x194);}return _0x26b206;};}function handleError(_0x1ea93c,_0x3858cf){_0x3858cf=_0x3858cf||0x1f4;return function(_0x289453){logger[_0x630b('0x26')](_0x289453[_0x630b('0x27')]);if(_0x289453[_0x630b('0x28')]){delete _0x289453[_0x630b('0x28')];}_0x1ea93c[_0x630b('0x19')](_0x3858cf)[_0x630b('0x29')](_0x289453);};}exports[_0x630b('0x2a')]=function(_0x3d4c27,_0x5802fa){var _0x413846={},_0x24e3b9={},_0x5bee2e={'count':0x0,'rows':[]};var _0x2e7d33=_[_0x630b('0x2b')](db[_0x630b('0x2c')]['rawAttributes'],function(_0x171621){return{'name':_0x171621[_0x630b('0x2d')],'type':_0x171621[_0x630b('0x2e')][_0x630b('0x2f')]};});_0x24e3b9[_0x630b('0x30')]=_[_0x630b('0x2b')](_0x2e7d33,'name');_0x24e3b9[_0x630b('0x31')]=_['keys'](_0x3d4c27[_0x630b('0x31')]);_0x24e3b9[_0x630b('0x32')]=_[_0x630b('0x33')](_0x24e3b9[_0x630b('0x30')],_0x24e3b9['query']);_0x413846['attributes']=_[_0x630b('0x33')](_0x24e3b9[_0x630b('0x30')],qs[_0x630b('0x34')](_0x3d4c27[_0x630b('0x31')][_0x630b('0x34')]));_0x413846[_0x630b('0x35')]=_0x413846[_0x630b('0x35')][_0x630b('0x36')]?_0x413846[_0x630b('0x35')]:_0x24e3b9['model'];if(!_0x3d4c27[_0x630b('0x31')]['hasOwnProperty'](_0x630b('0x37'))){_0x413846[_0x630b('0x1d')]=qs[_0x630b('0x1d')](_0x3d4c27[_0x630b('0x31')][_0x630b('0x1d')]);_0x413846[_0x630b('0x1c')]=qs['offset'](_0x3d4c27['query']['offset']);}_0x413846['order']=qs[_0x630b('0x38')](_0x3d4c27[_0x630b('0x31')][_0x630b('0x38')]);_0x413846[_0x630b('0x39')]=qs['filters'](_[_0x630b('0x3a')](_0x3d4c27['query'],_0x24e3b9[_0x630b('0x32')]),_0x2e7d33);if(_0x3d4c27[_0x630b('0x31')]['filter']){_0x413846[_0x630b('0x39')]=_[_0x630b('0x3b')](_0x413846[_0x630b('0x39')],{'$or':_['map'](_0x2e7d33,function(_0x55876d){if(_0x55876d[_0x630b('0x2e')]!==_0x630b('0x3c')){var _0x4198ae={};_0x4198ae[_0x55876d[_0x630b('0x28')]]={'$like':'%'+_0x3d4c27['query'][_0x630b('0x3d')]+'%'};return _0x4198ae;}})});}_0x413846=_[_0x630b('0x3b')]({},_0x413846,_0x3d4c27['options']);var _0x6c0eec={'where':_0x413846[_0x630b('0x39')]};return db[_0x630b('0x2c')][_0x630b('0x1b')](_0x6c0eec)['then'](function(_0x341790){_0x5bee2e[_0x630b('0x1b')]=_0x341790;if(_0x3d4c27[_0x630b('0x31')][_0x630b('0x3e')]){_0x413846['include']=[{'all':!![]}];}return db[_0x630b('0x2c')]['findAll'](_0x413846);})[_0x630b('0x24')](function(_0x5e90cd){_0x5bee2e[_0x630b('0x3f')]=_0x5e90cd;return _0x5bee2e;})['then'](respondWithFilteredResult(_0x5802fa,_0x413846))['catch'](handleError(_0x5802fa,null));};exports[_0x630b('0x40')]=function(_0x1ad355,_0x1d1d16){var _0x5035d4={'raw':!![],'where':{'id':_0x1ad355[_0x630b('0x41')]['id']}},_0x53862b={};_0x53862b[_0x630b('0x30')]=_[_0x630b('0x42')](db[_0x630b('0x2c')][_0x630b('0x43')]);_0x53862b[_0x630b('0x31')]=_['keys'](_0x1ad355[_0x630b('0x31')]);_0x53862b['filters']=_[_0x630b('0x33')](_0x53862b[_0x630b('0x30')],_0x53862b[_0x630b('0x31')]);_0x5035d4['attributes']=_[_0x630b('0x33')](_0x53862b[_0x630b('0x30')],qs[_0x630b('0x34')](_0x1ad355['query'][_0x630b('0x34')]));_0x5035d4[_0x630b('0x35')]=_0x5035d4[_0x630b('0x35')][_0x630b('0x36')]?_0x5035d4[_0x630b('0x35')]:_0x53862b[_0x630b('0x30')];if(_0x1ad355[_0x630b('0x31')][_0x630b('0x3e')]){_0x5035d4[_0x630b('0x44')]=[{'all':!![]}];}_0x5035d4=_['merge']({},_0x5035d4,_0x1ad355[_0x630b('0x45')]);return db[_0x630b('0x2c')]['find'](_0x5035d4)[_0x630b('0x24')](handleEntityNotFound(_0x1d1d16,null))[_0x630b('0x24')](respondWithResult(_0x1d1d16,null))[_0x630b('0x46')](handleError(_0x1d1d16,null));};exports[_0x630b('0x47')]=function(_0x40216f,_0x3d5297){return db[_0x630b('0x2c')][_0x630b('0x47')](_0x40216f[_0x630b('0x48')],{})['then'](respondWithResult(_0x3d5297,0xc9))[_0x630b('0x46')](handleError(_0x3d5297,null));};exports[_0x630b('0x23')]=function(_0x5854f5,_0x1a44f3){if(_0x5854f5[_0x630b('0x48')]['id']){delete _0x5854f5['body']['id'];}return db['SquareRecording'][_0x630b('0x49')]({'where':{'id':_0x5854f5[_0x630b('0x41')]['id']}})[_0x630b('0x24')](handleEntityNotFound(_0x1a44f3,null))[_0x630b('0x24')](saveUpdates(_0x5854f5[_0x630b('0x48')],null))[_0x630b('0x24')](respondWithResult(_0x1a44f3,null))[_0x630b('0x46')](handleError(_0x1a44f3,null));};exports[_0x630b('0x4a')]=function(_0x267f6d,_0x2aadf1,_0x17ed7c){var _0x3b154b=require(_0x630b('0x4b'));var _0x2a0f06=![];var _0x3e870b={};if(_0x267f6d[_0x630b('0x31')][_0x630b('0x2e')]&&_0x267f6d[_0x630b('0x31')][_0x630b('0x2e')]===_0x630b('0x4c')){_0x3e870b[_0x630b('0x4c')]=_0x267f6d[_0x630b('0x41')]['id'];}else{_0x3e870b['id']=_0x267f6d['params']['id'];}return db[_0x630b('0x2c')][_0x630b('0x49')]({'where':_0x3e870b,'attributes':['id',_0x630b('0x4d'),'filename'],'raw':!![]})[_0x630b('0x24')](handleEntityNotFound(_0x2aadf1,null))['then'](function(_0x3bdb6c){if(_0x3bdb6c){var _0x2cfae8=_0x3bdb6c[_0x630b('0x4d')];var _0x86e94f=util[_0x630b('0x4e')]('%s.cypher',_0x2cfae8);if(fs[_0x630b('0x4f')](_0x86e94f)){_0x2a0f06=!![];return _0x3b154b[_0x630b('0x50')](_0x86e94f,_0x2cfae8,config[_0x630b('0x51')][_0x630b('0x52')])[_0x630b('0x24')](function(){return _0x3bdb6c;});}return _0x3bdb6c;}})[_0x630b('0x24')](function(_0x124eca){if(_0x124eca){var _0x193dd9=_0x124eca[_0x630b('0x4d')];if(!fs['existsSync'](_0x193dd9)){throw new db[(_0x630b('0x53'))][(_0x630b('0x54'))](_0x630b('0x55'));}if(_0x124eca['filename']){return _0x2aadf1[_0x630b('0x4a')](_0x193dd9,_0x124eca[_0x630b('0x56')]+path['extname'](_0x193dd9),function(){if(_0x2a0f06){fs[_0x630b('0x57')](_0x193dd9);}});}else{return _0x2aadf1[_0x630b('0x4a')](_0x193dd9,function(_0x1fb5fe){if(_0x2a0f06){fs[_0x630b('0x57')](_0x193dd9);}});}}})[_0x630b('0x46')](function(_0x5716b6){if(_0x5716b6[_0x630b('0x58')]===_0x630b('0x55')){_0x2aadf1[_0x630b('0x19')](0x194)[_0x630b('0x29')]('Not\x20found');}else{return handleError(_0x2aadf1,null);}});};exports[_0x630b('0x25')]=function(_0xa09e20,_0x2e59b9){return db['SquareRecording'][_0x630b('0x49')]({'where':{'id':_0xa09e20[_0x630b('0x41')]['id']}})['then'](function(_0x1b1be5){if(!_0x1b1be5)throw new ReferenceError(_0x630b('0x59'));return _0x1b1be5;})[_0x630b('0x24')](function(_0x25c927){var _0x4356b9=_0x25c927[_0x630b('0x4d')];logger[_0x630b('0x5a')](_0x630b('0x5b'),_0x4356b9);if(!_[_0x630b('0x5c')](_0x25c927['savePath'])&&fs[_0x630b('0x4f')](_0x4356b9)){logger[_0x630b('0x5a')](_0x630b('0x5d')+_0x4356b9+_0x630b('0x5e'));fs[_0x630b('0x5f')](_0x4356b9);}_0x4356b9=_0x4356b9+_0x630b('0x60');if(!_['isNil'](_0x25c927['savePath'])&&fs[_0x630b('0x4f')](_0x4356b9)){logger[_0x630b('0x5a')](_0x630b('0x5d')+_0x4356b9+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x630b('0x5f')](_0x4356b9);}return _0x25c927;})[_0x630b('0x24')](function(_0x1934db){if(!_0x1934db)throw new InternalError();return _0x1934db[_0x630b('0x25')]();})[_0x630b('0x24')](function(){_0x2e59b9[_0x630b('0x19')](0xcc)[_0x630b('0x1a')]();})[_0x630b('0x46')](handleError(_0x2e59b9,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 211b61e..2a88452 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 _0xf846=['SquareRecording','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./squareRecording.attributes','exports','define'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0xf846,0x85));var _0x6f84=function(_0x28ddc8,_0x296e71){_0x28ddc8=_0x28ddc8-0x0;var _0x1d0a89=_0xf846[_0x28ddc8];return _0x1d0a89;};'use strict';var _=require(_0x6f84('0x0'));var util=require(_0x6f84('0x1'));var logger=require(_0x6f84('0x2'))(_0x6f84('0x3'));var moment=require('moment');var BPromise=require(_0x6f84('0x4'));var rp=require(_0x6f84('0x5'));var fs=require('fs');var path=require(_0x6f84('0x6'));var rimraf=require(_0x6f84('0x7'));var config=require('../../config/environment');var attributes=require(_0x6f84('0x8'));module[_0x6f84('0x9')]=function(_0x2963cd,_0x25e3c2){return _0x2963cd[_0x6f84('0xa')](_0x6f84('0xb'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb3b=['moment','path','../../config/environment','exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger','api'];(function(_0x4f366d,_0x306206){var _0x47bd5b=function(_0x2324af){while(--_0x2324af){_0x4f366d['push'](_0x4f366d['shift']());}};_0x47bd5b(++_0x306206);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xeb3b[_0x4a747d];return _0x3a5b5c;};'use strict';var _=require(_0xbeb3('0x0'));var util=require(_0xbeb3('0x1'));var logger=require(_0xbeb3('0x2'))(_0xbeb3('0x3'));var moment=require(_0xbeb3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbeb3('0x5'));var rimraf=require('rimraf');var config=require(_0xbeb3('0x6'));var attributes=require('./squareRecording.attributes');module[_0xbeb3('0x7')]=function(_0x5ae6f9,_0x8d8cce){return _0x5ae6f9[_0xbeb3('0x8')](_0xbeb3('0x9'),attributes,{'tableName':_0xbeb3('0xa'),'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 7f5fe64..7973267 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 _0xb55f=['ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareRecording','create','body','lodash','moment','bluebird','randomstring'];(function(_0x2438ed,_0x1ddf78){var _0x19cc9b=function(_0x37fcb0){while(--_0x37fcb0){_0x2438ed['push'](_0x2438ed['shift']());}};_0x19cc9b(++_0x1ddf78);}(_0xb55f,0x18c));var _0xfb55=function(_0x1a041c,_0x2e8684){_0x1a041c=_0x1a041c-0x0;var _0x5d40e2=_0xb55f[_0x1a041c];return _0x5d40e2;};'use strict';var _=require(_0xfb55('0x0'));var util=require('util');var moment=require(_0xfb55('0x1'));var BPromise=require(_0xfb55('0x2'));var rs=require(_0xfb55('0x3'));var fs=require('fs');var Redis=require(_0xfb55('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfb55('0x5'));var logger=require(_0xfb55('0x6'))(_0xfb55('0x7'));var config=require('../../config/environment');var jayson=require(_0xfb55('0x8'));var client=jayson[_0xfb55('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x210f40,_0x52f287,_0xb63422){return new BPromise(function(_0x41b1ea,_0xe28ed9){return client[_0xfb55('0xa')](_0x210f40,_0xb63422)[_0xfb55('0xb')](function(_0x5729d9){logger[_0xfb55('0xc')](_0xfb55('0xd'),_0x52f287,_0xfb55('0xe'));logger[_0xfb55('0xf')](_0xfb55('0x10'),_0x52f287,'request\x20sent',JSON[_0xfb55('0x11')](_0x5729d9));if(_0x5729d9[_0xfb55('0x12')]){if(_0x5729d9[_0xfb55('0x12')][_0xfb55('0x13')]===0x1f4){logger[_0xfb55('0x12')](_0xfb55('0xd'),_0x52f287,_0x5729d9[_0xfb55('0x12')][_0xfb55('0x14')]);return _0xe28ed9(_0x5729d9[_0xfb55('0x12')][_0xfb55('0x14')]);}logger[_0xfb55('0x12')](_0xfb55('0xd'),_0x52f287,_0x5729d9[_0xfb55('0x12')][_0xfb55('0x14')]);return _0x41b1ea(_0x5729d9[_0xfb55('0x12')]['message']);}else{logger[_0xfb55('0xc')](_0xfb55('0xd'),_0x52f287,_0xfb55('0xe'));_0x41b1ea(_0x5729d9['result'][_0xfb55('0x14')]);}})[_0xfb55('0x15')](function(_0x253449){logger[_0xfb55('0x12')](_0xfb55('0xd'),_0x52f287,_0x253449);_0xe28ed9(_0x253449);});});}exports[_0xfb55('0x16')]=function(_0xb9f565){var _0x11c217=this;return new Promise(function(_0x5aa017,_0xa86d07){return db['SquareRecording'][_0xfb55('0x17')](_0xb9f565[_0xfb55('0x18')],{'raw':_0xb9f565['options']?_0xb9f565['options']['raw']===undefined?!![]:![]:!![]})[_0xfb55('0xb')](function(_0xe2206f){logger[_0xfb55('0xc')](_0xfb55('0x16'),_0xb9f565);logger[_0xfb55('0xf')](_0xfb55('0x16'),_0xb9f565,JSON[_0xfb55('0x11')](_0xe2206f));_0x5aa017(_0xe2206f);})[_0xfb55('0x15')](function(_0x324158){logger[_0xfb55('0x12')](_0xfb55('0x16'),_0x324158['message'],_0xb9f565);_0xa86d07(_0x11c217[_0xfb55('0x12')](0x1f4,_0x324158[_0xfb55('0x14')]));});});}; \ No newline at end of file +var _0x4491=['SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSquareRecording','SquareRecording','create','options','raw','then','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','SquareRecording,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1a0cf7,_0x566b7d){var _0x38cc61=function(_0x55469b){while(--_0x55469b){_0x1a0cf7['push'](_0x1a0cf7['shift']());}};_0x38cc61(++_0x566b7d);}(_0x4491,0xbc));var _0x1449=function(_0x1d2886,_0x1ae9b3){_0x1d2886=_0x1d2886-0x0;var _0x3b1220=_0x4491[_0x1d2886];return _0x3b1220;};'use strict';var _=require(_0x1449('0x0'));var util=require(_0x1449('0x1'));var moment=require(_0x1449('0x2'));var BPromise=require('bluebird');var rs=require(_0x1449('0x3'));var fs=require('fs');var Redis=require(_0x1449('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1449('0x5'))(_0x1449('0x6'));var config=require(_0x1449('0x7'));var jayson=require(_0x1449('0x8'));var client=jayson[_0x1449('0x9')][_0x1449('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ccfc1,_0x31b95e,_0xc5dc9d){return new BPromise(function(_0x9c89d9,_0x39bc0d){return client[_0x1449('0xb')](_0x3ccfc1,_0xc5dc9d)['then'](function(_0x4a9f1d){logger['info'](_0x1449('0xc'),_0x31b95e,_0x1449('0xd'));logger[_0x1449('0xe')](_0x1449('0xf'),_0x31b95e,_0x1449('0xd'),JSON[_0x1449('0x10')](_0x4a9f1d));if(_0x4a9f1d['error']){if(_0x4a9f1d[_0x1449('0x11')][_0x1449('0x12')]===0x1f4){logger[_0x1449('0x11')](_0x1449('0xc'),_0x31b95e,_0x4a9f1d[_0x1449('0x11')]['message']);return _0x39bc0d(_0x4a9f1d[_0x1449('0x11')][_0x1449('0x13')]);}logger[_0x1449('0x11')]('SquareRecording,\x20%s,\x20%s',_0x31b95e,_0x4a9f1d[_0x1449('0x11')][_0x1449('0x13')]);return _0x9c89d9(_0x4a9f1d[_0x1449('0x11')][_0x1449('0x13')]);}else{logger[_0x1449('0x14')](_0x1449('0xc'),_0x31b95e,_0x1449('0xd'));_0x9c89d9(_0x4a9f1d[_0x1449('0x15')][_0x1449('0x13')]);}})[_0x1449('0x16')](function(_0x550ba0){logger[_0x1449('0x11')](_0x1449('0xc'),_0x31b95e,_0x550ba0);_0x39bc0d(_0x550ba0);});});}exports[_0x1449('0x17')]=function(_0x43bc00){var _0x3544c8=this;return new Promise(function(_0x35f375,_0x1c83ae){return db[_0x1449('0x18')][_0x1449('0x19')](_0x43bc00['body'],{'raw':_0x43bc00[_0x1449('0x1a')]?_0x43bc00[_0x1449('0x1a')][_0x1449('0x1b')]===undefined?!![]:![]:!![]})[_0x1449('0x1c')](function(_0x43ae6f){logger[_0x1449('0x14')]('CreateSquareRecording',_0x43bc00);logger[_0x1449('0xe')](_0x1449('0x17'),_0x43bc00,JSON[_0x1449('0x10')](_0x43ae6f));_0x35f375(_0x43ae6f);})[_0x1449('0x16')](function(_0x11b075){logger[_0x1449('0x11')](_0x1449('0x17'),_0x11b075[_0x1449('0x13')],_0x43bc00);_0x1c83ae(_0x3544c8[_0x1449('0x11')](0x1f4,_0x11b075[_0x1449('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index b6b65f8..35a7231 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 _0x2cb9=['/:id','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','./squareReport.controller','isAuthenticated','index','get','/describe'];(function(_0x33d07d,_0x318cfd){var _0x34cc94=function(_0x176cb2){while(--_0x176cb2){_0x33d07d['push'](_0x33d07d['shift']());}};_0x34cc94(++_0x318cfd);}(_0x2cb9,0x67));var _0x92cb=function(_0x14b3bb,_0x56c278){_0x14b3bb=_0x14b3bb-0x0;var _0x4c7d00=_0x2cb9[_0x14b3bb];return _0x4c7d00;};'use strict';var multer=require(_0x92cb('0x0'));var util=require('util');var path=require(_0x92cb('0x1'));var timeout=require(_0x92cb('0x2'));var express=require(_0x92cb('0x3'));var router=express[_0x92cb('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x92cb('0x5'));var config=require('../../config/environment');var controller=require(_0x92cb('0x6'));router['get']('/',auth[_0x92cb('0x7')](),controller[_0x92cb('0x8')]);router[_0x92cb('0x9')](_0x92cb('0xa'),auth[_0x92cb('0x7')](),controller['describe']);router[_0x92cb('0x9')](_0x92cb('0xb'),auth['isAuthenticated'](),controller[_0x92cb('0xc')]);router[_0x92cb('0xd')]('/',auth['isAuthenticated'](),controller[_0x92cb('0xe')]);router[_0x92cb('0xf')](_0x92cb('0xb'),auth['isAuthenticated'](),controller[_0x92cb('0x10')]);router['delete'](_0x92cb('0xb'),auth[_0x92cb('0x7')](),controller[_0x92cb('0x11')]);module[_0x92cb('0x12')]=router; \ No newline at end of file +var _0x24d9=['isAuthenticated','index','/describe','describe','show','post','create','put','/:id','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get'];(function(_0x552fca,_0x196b79){var _0x2032ce=function(_0xe9bb30){while(--_0xe9bb30){_0x552fca['push'](_0x552fca['shift']());}};_0x2032ce(++_0x196b79);}(_0x24d9,0x1b0));var _0x924d=function(_0x52b15d,_0x111cb9){_0x52b15d=_0x52b15d-0x0;var _0x3f4bce=_0x24d9[_0x52b15d];return _0x3f4bce;};'use strict';var multer=require(_0x924d('0x0'));var util=require(_0x924d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x924d('0x2'));var router=express[_0x924d('0x3')]();var auth=require(_0x924d('0x4'));var interaction=require(_0x924d('0x5'));var config=require(_0x924d('0x6'));var controller=require(_0x924d('0x7'));router[_0x924d('0x8')]('/',auth[_0x924d('0x9')](),controller[_0x924d('0xa')]);router[_0x924d('0x8')](_0x924d('0xb'),auth[_0x924d('0x9')](),controller[_0x924d('0xc')]);router[_0x924d('0x8')]('/:id',auth[_0x924d('0x9')](),controller[_0x924d('0xd')]);router[_0x924d('0xe')]('/',auth['isAuthenticated'](),controller[_0x924d('0xf')]);router[_0x924d('0x10')](_0x924d('0x11'),auth[_0x924d('0x9')](),controller['update']);router[_0x924d('0x12')]('/:id',auth[_0x924d('0x9')](),controller[_0x924d('0x13')]);module[_0x924d('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 2e546ff..175433b 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 _0x2090=['STRING','DATE','sequelize'];(function(_0x4ef433,_0x234b50){var _0x1a517f=function(_0x48d9c4){while(--_0x48d9c4){_0x4ef433['push'](_0x4ef433['shift']());}};_0x1a517f(++_0x234b50);}(_0x2090,0x10d));var _0x0209=function(_0x3d361c,_0x27e13a){_0x3d361c=_0x3d361c-0x0;var _0x3b62ec=_0x2090[_0x3d361c];return _0x3b62ec;};'use strict';var Sequelize=require(_0x0209('0x0'));module['exports']={'network':{'type':Sequelize[_0x0209('0x1')]},'network_script':{'type':Sequelize[_0x0209('0x1')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x0209('0x1')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x0209('0x1')]},'uniqueid':{'type':Sequelize[_0x0209('0x1')]},'version':{'type':Sequelize[_0x0209('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0209('0x1')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x0209('0x1')]},'dnid':{'type':Sequelize[_0x0209('0x1')]},'rdnis':{'type':Sequelize[_0x0209('0x1')]},'context':{'type':Sequelize[_0x0209('0x1')]},'extension':{'type':Sequelize[_0x0209('0x1')]},'priority':{'type':Sequelize[_0x0209('0x1')]},'enhanced':{'type':Sequelize[_0x0209('0x1')]},'accountcode':{'type':Sequelize[_0x0209('0x1')]},'threadid':{'type':Sequelize[_0x0209('0x1')]},'project_name':{'type':Sequelize[_0x0209('0x1')]},'joinAt':{'type':Sequelize[_0x0209('0x2')]},'leaveAt':{'type':Sequelize[_0x0209('0x2')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xdd8f=['STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xdd8f,0x17f));var _0xfdd8=function(_0x2af58e,_0x2e3cee){_0x2af58e=_0x2af58e-0x0;var _0x27f465=_0xdd8f[_0x2af58e];return _0x27f465;};'use strict';var Sequelize=require(_0xfdd8('0x0'));module[_0xfdd8('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xfdd8('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xfdd8('0x2')]},'language':{'type':Sequelize[_0xfdd8('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0xfdd8('0x2')]},'callerid':{'type':Sequelize[_0xfdd8('0x2')]},'calleridname':{'type':Sequelize[_0xfdd8('0x2')]},'callingpres':{'type':Sequelize[_0xfdd8('0x2')]},'callingani2':{'type':Sequelize[_0xfdd8('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xfdd8('0x2')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0xfdd8('0x2')]},'accountcode':{'type':Sequelize[_0xfdd8('0x2')]},'threadid':{'type':Sequelize[_0xfdd8('0x2')]},'project_name':{'type':Sequelize[_0xfdd8('0x2')]},'joinAt':{'type':Sequelize[_0xfdd8('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0xfdd8('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 6363061..d9bd1a9 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 _0xfbdc=['save','update','then','end','error','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','count','includeAll','include','findAll','catch','show','params','find','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','lodash','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','json','offset','limit','set','apply','reject'];(function(_0x22b0fe,_0x272c42){var _0x524663=function(_0x27ef71){while(--_0x27ef71){_0x22b0fe['push'](_0x22b0fe['shift']());}};_0x524663(++_0x272c42);}(_0xfbdc,0x1f2));var _0xcfbd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfbdc[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xcfbd('0x0'));var emlformat=require(_0xcfbd('0x1'));var rimraf=require(_0xcfbd('0x2'));var zipdir=require(_0xcfbd('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcfbd('0x4'));var moment=require(_0xcfbd('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcfbd('0x6'));var path=require(_0xcfbd('0x7'));var sox=require(_0xcfbd('0x8'));var csv=require(_0xcfbd('0x9'));var ejs=require(_0xcfbd('0xa'));var fs=require('fs');var _=require(_0xcfbd('0xb'));var squel=require(_0xcfbd('0xc'));var crypto=require(_0xcfbd('0xd'));var jsforce=require(_0xcfbd('0xe'));var deskjs=require(_0xcfbd('0xf'));var toCsv=require(_0xcfbd('0x9'));var querystring=require(_0xcfbd('0x10'));var Papa=require(_0xcfbd('0x11'));var Redis=require('ioredis');var authService=require(_0xcfbd('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xcfbd('0x13'));var hardwareService=require(_0xcfbd('0x14'));var logger=require(_0xcfbd('0x15'))(_0xcfbd('0x16'));var utils=require(_0xcfbd('0x17'));var config=require(_0xcfbd('0x18'));var db=require(_0xcfbd('0x19'))['db'];function respondWithStatusCode(_0x219ddd,_0x5ec254){_0x5ec254=_0x5ec254||0xcc;return function(_0x4e7d6c){if(_0x4e7d6c){return _0x219ddd[_0xcfbd('0x1a')](_0x5ec254);}return _0x219ddd[_0xcfbd('0x1b')](_0x5ec254)['end']();};}function respondWithResult(_0x4a0972,_0x13f535){_0x13f535=_0x13f535||0xc8;return function(_0x1fa55b){if(_0x1fa55b){return _0x4a0972[_0xcfbd('0x1b')](_0x13f535)[_0xcfbd('0x1c')](_0x1fa55b);}};}function respondWithFilteredResult(_0x3c3fbe,_0x5ab8be){return function(_0x4f9721){if(_0x4f9721){var _0x5dbd3b=_0x4f9721['count'],_0x2ebd28=_0x5ab8be[_0xcfbd('0x1d')],_0x2a6d1f=_0x5ab8be['offset']+_0x5ab8be[_0xcfbd('0x1e')],_0x23f621;if(_0x2a6d1f>=_0x5dbd3b){_0x2a6d1f=_0x5dbd3b;_0x23f621=0xc8;}else{_0x23f621=0xce;}_0x3c3fbe[_0xcfbd('0x1b')](_0x23f621);return _0x3c3fbe[_0xcfbd('0x1f')]('Content-Range',_0x2ebd28+'-'+_0x2a6d1f+'/'+_0x5dbd3b)['json'](_0x4f9721);}return null;};}function patchUpdates(_0x388f55){return function(_0x584adb){try{jsonpatch[_0xcfbd('0x20')](_0x584adb,_0x388f55,!![]);}catch(_0x5c20ac){return BPromise[_0xcfbd('0x21')](_0x5c20ac);}return _0x584adb[_0xcfbd('0x22')]();};}function saveUpdates(_0x1e3179,_0x2b2a23){return function(_0x3cd750){if(_0x3cd750){return _0x3cd750[_0xcfbd('0x23')](_0x1e3179)[_0xcfbd('0x24')](function(_0x1cd51c){return _0x1cd51c;});}return null;};}function removeEntity(_0x354e1a,_0x5d1bd3){return function(_0x660627){if(_0x660627){return _0x660627['destroy']()[_0xcfbd('0x24')](function(){_0x354e1a[_0xcfbd('0x1b')](0xcc)[_0xcfbd('0x25')]();});}};}function handleEntityNotFound(_0xbe9dc8,_0x55b46b){return function(_0x4573d5){if(!_0x4573d5){_0xbe9dc8[_0xcfbd('0x1a')](0x194);}return _0x4573d5;};}function handleError(_0x3bc7c3,_0x21b3e8){_0x21b3e8=_0x21b3e8||0x1f4;return function(_0x3e4e0d){logger[_0xcfbd('0x26')](_0x3e4e0d[_0xcfbd('0x27')]);if(_0x3e4e0d[_0xcfbd('0x28')]){delete _0x3e4e0d[_0xcfbd('0x28')];}_0x3bc7c3['status'](_0x21b3e8)[_0xcfbd('0x29')](_0x3e4e0d);};}exports[_0xcfbd('0x2a')]=function(_0x480310,_0x1a16e0){var _0x146d38={},_0x10cf7b={},_0x412117={'count':0x0,'rows':[]};var _0x57e7a9=_[_0xcfbd('0x2b')](db[_0xcfbd('0x2c')][_0xcfbd('0x2d')],function(_0x5a532b){return{'name':_0x5a532b[_0xcfbd('0x2e')],'type':_0x5a532b[_0xcfbd('0x2f')][_0xcfbd('0x30')]};});_0x10cf7b[_0xcfbd('0x31')]=_[_0xcfbd('0x2b')](_0x57e7a9,'name');_0x10cf7b[_0xcfbd('0x32')]=_[_0xcfbd('0x33')](_0x480310[_0xcfbd('0x32')]);_0x10cf7b['filters']=_[_0xcfbd('0x34')](_0x10cf7b['model'],_0x10cf7b[_0xcfbd('0x32')]);_0x146d38['attributes']=_[_0xcfbd('0x34')](_0x10cf7b[_0xcfbd('0x31')],qs[_0xcfbd('0x35')](_0x480310[_0xcfbd('0x32')][_0xcfbd('0x35')]));_0x146d38[_0xcfbd('0x36')]=_0x146d38['attributes']['length']?_0x146d38[_0xcfbd('0x36')]:_0x10cf7b[_0xcfbd('0x31')];if(!_0x480310['query'][_0xcfbd('0x37')](_0xcfbd('0x38'))){_0x146d38[_0xcfbd('0x1e')]=qs['limit'](_0x480310[_0xcfbd('0x32')][_0xcfbd('0x1e')]);_0x146d38[_0xcfbd('0x1d')]=qs['offset'](_0x480310[_0xcfbd('0x32')][_0xcfbd('0x1d')]);}_0x146d38[_0xcfbd('0x39')]=qs[_0xcfbd('0x3a')](_0x480310['query'][_0xcfbd('0x3a')]);_0x146d38[_0xcfbd('0x3b')]=qs[_0xcfbd('0x3c')](_[_0xcfbd('0x3d')](_0x480310['query'],_0x10cf7b['filters']),_0x57e7a9);if(_0x480310[_0xcfbd('0x32')][_0xcfbd('0x3e')]){_0x146d38[_0xcfbd('0x3b')]=_[_0xcfbd('0x3f')](_0x146d38['where'],{'$or':_[_0xcfbd('0x2b')](_0x57e7a9,function(_0x4e63fc){if(_0x4e63fc[_0xcfbd('0x2f')]!=='VIRTUAL'){var _0x11b553={};_0x11b553[_0x4e63fc[_0xcfbd('0x28')]]={'$like':'%'+_0x480310[_0xcfbd('0x32')][_0xcfbd('0x3e')]+'%'};return _0x11b553;}})});}_0x146d38=_[_0xcfbd('0x3f')]({},_0x146d38,_0x480310[_0xcfbd('0x40')]);var _0x5998bb={'where':_0x146d38['where']};return db[_0xcfbd('0x2c')][_0xcfbd('0x41')](_0x5998bb)[_0xcfbd('0x24')](function(_0x1683d4){_0x412117[_0xcfbd('0x41')]=_0x1683d4;if(_0x480310[_0xcfbd('0x32')][_0xcfbd('0x42')]){_0x146d38[_0xcfbd('0x43')]=[{'all':!![]}];}return db['SquareReport'][_0xcfbd('0x44')](_0x146d38);})['then'](function(_0x2f5c31){_0x412117['rows']=_0x2f5c31;return _0x412117;})[_0xcfbd('0x24')](respondWithFilteredResult(_0x1a16e0,_0x146d38))[_0xcfbd('0x45')](handleError(_0x1a16e0,null));};exports[_0xcfbd('0x46')]=function(_0x36f97d,_0x4d765f){var _0x1faed1={'raw':!![],'where':{'id':_0x36f97d[_0xcfbd('0x47')]['id']}},_0x3de256={};_0x3de256[_0xcfbd('0x31')]=_[_0xcfbd('0x33')](db[_0xcfbd('0x2c')][_0xcfbd('0x2d')]);_0x3de256[_0xcfbd('0x32')]=_[_0xcfbd('0x33')](_0x36f97d['query']);_0x3de256['filters']=_['intersection'](_0x3de256[_0xcfbd('0x31')],_0x3de256[_0xcfbd('0x32')]);_0x1faed1[_0xcfbd('0x36')]=_[_0xcfbd('0x34')](_0x3de256[_0xcfbd('0x31')],qs[_0xcfbd('0x35')](_0x36f97d[_0xcfbd('0x32')][_0xcfbd('0x35')]));_0x1faed1[_0xcfbd('0x36')]=_0x1faed1[_0xcfbd('0x36')]['length']?_0x1faed1[_0xcfbd('0x36')]:_0x3de256[_0xcfbd('0x31')];if(_0x36f97d['query'][_0xcfbd('0x42')]){_0x1faed1['include']=[{'all':!![]}];}_0x1faed1=_[_0xcfbd('0x3f')]({},_0x1faed1,_0x36f97d['options']);return db['SquareReport'][_0xcfbd('0x48')](_0x1faed1)[_0xcfbd('0x24')](handleEntityNotFound(_0x4d765f,null))[_0xcfbd('0x24')](respondWithResult(_0x4d765f,null))['catch'](handleError(_0x4d765f,null));};exports['create']=function(_0x9dd107,_0x1845e){return db[_0xcfbd('0x2c')]['create'](_0x9dd107[_0xcfbd('0x49')],{})['then'](respondWithResult(_0x1845e,0xc9))[_0xcfbd('0x45')](handleError(_0x1845e,null));};exports[_0xcfbd('0x23')]=function(_0x59bf34,_0x11ec77){if(_0x59bf34['body']['id']){delete _0x59bf34['body']['id'];}return db[_0xcfbd('0x2c')][_0xcfbd('0x48')]({'where':{'id':_0x59bf34[_0xcfbd('0x47')]['id']}})[_0xcfbd('0x24')](handleEntityNotFound(_0x11ec77,null))[_0xcfbd('0x24')](saveUpdates(_0x59bf34[_0xcfbd('0x49')],null))['then'](respondWithResult(_0x11ec77,null))[_0xcfbd('0x45')](handleError(_0x11ec77,null));};exports[_0xcfbd('0x4a')]=function(_0xab72f6,_0x15088a){return db['SquareReport']['find']({'where':{'id':_0xab72f6[_0xcfbd('0x47')]['id']}})[_0xcfbd('0x24')](handleEntityNotFound(_0x15088a,null))[_0xcfbd('0x24')](removeEntity(_0x15088a,null))['catch'](handleError(_0x15088a,null));};exports['describe']=function(_0x5291b4,_0x155831){return db[_0xcfbd('0x2c')][_0xcfbd('0x4b')]()['then'](respondWithResult(_0x155831,null))['catch'](handleError(_0x155831,null));}; \ No newline at end of file +var _0x29e6=['nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','include','rows','catch','params','find','create','body','describe','html-pdf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','reject','save','then','destroy','stack','name','index','SquareReport','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty'];(function(_0x4de1b1,_0x18c64c){var _0x639f27=function(_0x635e03){while(--_0x635e03){_0x4de1b1['push'](_0x4de1b1['shift']());}};_0x639f27(++_0x18c64c);}(_0x29e6,0x122));var _0x629e=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x29e6[_0x167cc1];return _0x10bc4b;};'use strict';var pdf=require(_0x629e('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x629e('0x1'));var rp=require(_0x629e('0x2'));var moment=require(_0x629e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x629e('0x4'));var util=require(_0x629e('0x5'));var path=require(_0x629e('0x6'));var sox=require(_0x629e('0x7'));var csv=require(_0x629e('0x8'));var ejs=require(_0x629e('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x629e('0xa'));var crypto=require(_0x629e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x629e('0xc'));var toCsv=require(_0x629e('0x8'));var querystring=require(_0x629e('0xd'));var Papa=require('papaparse');var Redis=require(_0x629e('0xe'));var authService=require(_0x629e('0xf'));var qs=require(_0x629e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x629e('0x11'));var logger=require(_0x629e('0x12'))('api');var utils=require(_0x629e('0x13'));var config=require(_0x629e('0x14'));var db=require(_0x629e('0x15'))['db'];function respondWithStatusCode(_0x2c2ba4,_0x3ddf26){_0x3ddf26=_0x3ddf26||0xcc;return function(_0x52f64b){if(_0x52f64b){return _0x2c2ba4[_0x629e('0x16')](_0x3ddf26);}return _0x2c2ba4['status'](_0x3ddf26)[_0x629e('0x17')]();};}function respondWithResult(_0x28ccbe,_0xdccce){_0xdccce=_0xdccce||0xc8;return function(_0x17d83e){if(_0x17d83e){return _0x28ccbe[_0x629e('0x18')](_0xdccce)[_0x629e('0x19')](_0x17d83e);}};}function respondWithFilteredResult(_0x410f4b,_0x250244){return function(_0x45f5b4){if(_0x45f5b4){var _0xe9dc9d=_0x45f5b4['count'],_0x1cb34d=_0x250244[_0x629e('0x1a')],_0x451d5b=_0x250244[_0x629e('0x1a')]+_0x250244[_0x629e('0x1b')],_0xc57f09;if(_0x451d5b>=_0xe9dc9d){_0x451d5b=_0xe9dc9d;_0xc57f09=0xc8;}else{_0xc57f09=0xce;}_0x410f4b['status'](_0xc57f09);return _0x410f4b[_0x629e('0x1c')](_0x629e('0x1d'),_0x1cb34d+'-'+_0x451d5b+'/'+_0xe9dc9d)[_0x629e('0x19')](_0x45f5b4);}return null;};}function patchUpdates(_0x16fc74){return function(_0x1bd6ce){try{jsonpatch['apply'](_0x1bd6ce,_0x16fc74,!![]);}catch(_0x183a5c){return BPromise[_0x629e('0x1e')](_0x183a5c);}return _0x1bd6ce[_0x629e('0x1f')]();};}function saveUpdates(_0x5aa849,_0x5e4d77){return function(_0x90a2f0){if(_0x90a2f0){return _0x90a2f0['update'](_0x5aa849)[_0x629e('0x20')](function(_0x220e7a){return _0x220e7a;});}return null;};}function removeEntity(_0xafd578,_0x2039d2){return function(_0x2a82c5){if(_0x2a82c5){return _0x2a82c5[_0x629e('0x21')]()[_0x629e('0x20')](function(){_0xafd578['status'](0xcc)[_0x629e('0x17')]();});}};}function handleEntityNotFound(_0x123376,_0x72e5b5){return function(_0x5f2086){if(!_0x5f2086){_0x123376['sendStatus'](0x194);}return _0x5f2086;};}function handleError(_0x2c7ac7,_0x11135d){_0x11135d=_0x11135d||0x1f4;return function(_0xe8a30f){logger['error'](_0xe8a30f[_0x629e('0x22')]);if(_0xe8a30f[_0x629e('0x23')]){delete _0xe8a30f[_0x629e('0x23')];}_0x2c7ac7[_0x629e('0x18')](_0x11135d)['send'](_0xe8a30f);};}exports[_0x629e('0x24')]=function(_0x3cb93c,_0x4d9ba8){var _0x1ea914={},_0x2785c1={},_0x26cf2d={'count':0x0,'rows':[]};var _0x3b3ec9=_['map'](db[_0x629e('0x25')][_0x629e('0x26')],function(_0x4d949b){return{'name':_0x4d949b[_0x629e('0x27')],'type':_0x4d949b[_0x629e('0x28')]['key']};});_0x2785c1[_0x629e('0x29')]=_[_0x629e('0x2a')](_0x3b3ec9,'name');_0x2785c1['query']=_[_0x629e('0x2b')](_0x3cb93c[_0x629e('0x2c')]);_0x2785c1[_0x629e('0x2d')]=_[_0x629e('0x2e')](_0x2785c1[_0x629e('0x29')],_0x2785c1[_0x629e('0x2c')]);_0x1ea914[_0x629e('0x2f')]=_['intersection'](_0x2785c1[_0x629e('0x29')],qs['fields'](_0x3cb93c[_0x629e('0x2c')][_0x629e('0x30')]));_0x1ea914[_0x629e('0x2f')]=_0x1ea914[_0x629e('0x2f')]['length']?_0x1ea914[_0x629e('0x2f')]:_0x2785c1[_0x629e('0x29')];if(!_0x3cb93c[_0x629e('0x2c')][_0x629e('0x31')](_0x629e('0x32'))){_0x1ea914[_0x629e('0x1b')]=qs[_0x629e('0x1b')](_0x3cb93c[_0x629e('0x2c')]['limit']);_0x1ea914[_0x629e('0x1a')]=qs[_0x629e('0x1a')](_0x3cb93c[_0x629e('0x2c')]['offset']);}_0x1ea914[_0x629e('0x33')]=qs[_0x629e('0x34')](_0x3cb93c[_0x629e('0x2c')]['sort']);_0x1ea914[_0x629e('0x35')]=qs[_0x629e('0x2d')](_[_0x629e('0x36')](_0x3cb93c[_0x629e('0x2c')],_0x2785c1[_0x629e('0x2d')]),_0x3b3ec9);if(_0x3cb93c[_0x629e('0x2c')][_0x629e('0x37')]){_0x1ea914[_0x629e('0x35')]=_['merge'](_0x1ea914[_0x629e('0x35')],{'$or':_[_0x629e('0x2a')](_0x3b3ec9,function(_0x4fe0c8){if(_0x4fe0c8[_0x629e('0x28')]!=='VIRTUAL'){var _0x31044a={};_0x31044a[_0x4fe0c8[_0x629e('0x23')]]={'$like':'%'+_0x3cb93c['query'][_0x629e('0x37')]+'%'};return _0x31044a;}})});}_0x1ea914=_[_0x629e('0x38')]({},_0x1ea914,_0x3cb93c[_0x629e('0x39')]);var _0x5a1274={'where':_0x1ea914[_0x629e('0x35')]};return db[_0x629e('0x25')][_0x629e('0x3a')](_0x5a1274)['then'](function(_0x29a82c){_0x26cf2d[_0x629e('0x3a')]=_0x29a82c;if(_0x3cb93c[_0x629e('0x2c')][_0x629e('0x3b')]){_0x1ea914[_0x629e('0x3c')]=[{'all':!![]}];}return db[_0x629e('0x25')]['findAll'](_0x1ea914);})[_0x629e('0x20')](function(_0x34a59e){_0x26cf2d[_0x629e('0x3d')]=_0x34a59e;return _0x26cf2d;})[_0x629e('0x20')](respondWithFilteredResult(_0x4d9ba8,_0x1ea914))[_0x629e('0x3e')](handleError(_0x4d9ba8,null));};exports['show']=function(_0xff320d,_0x429f4d){var _0x6f4fa8={'raw':!![],'where':{'id':_0xff320d[_0x629e('0x3f')]['id']}},_0x22792c={};_0x22792c[_0x629e('0x29')]=_['keys'](db[_0x629e('0x25')][_0x629e('0x26')]);_0x22792c[_0x629e('0x2c')]=_['keys'](_0xff320d[_0x629e('0x2c')]);_0x22792c[_0x629e('0x2d')]=_['intersection'](_0x22792c[_0x629e('0x29')],_0x22792c[_0x629e('0x2c')]);_0x6f4fa8[_0x629e('0x2f')]=_[_0x629e('0x2e')](_0x22792c[_0x629e('0x29')],qs[_0x629e('0x30')](_0xff320d['query'][_0x629e('0x30')]));_0x6f4fa8[_0x629e('0x2f')]=_0x6f4fa8[_0x629e('0x2f')]['length']?_0x6f4fa8[_0x629e('0x2f')]:_0x22792c[_0x629e('0x29')];if(_0xff320d[_0x629e('0x2c')][_0x629e('0x3b')]){_0x6f4fa8[_0x629e('0x3c')]=[{'all':!![]}];}_0x6f4fa8=_['merge']({},_0x6f4fa8,_0xff320d[_0x629e('0x39')]);return db[_0x629e('0x25')][_0x629e('0x40')](_0x6f4fa8)[_0x629e('0x20')](handleEntityNotFound(_0x429f4d,null))[_0x629e('0x20')](respondWithResult(_0x429f4d,null))[_0x629e('0x3e')](handleError(_0x429f4d,null));};exports[_0x629e('0x41')]=function(_0x33c1c5,_0x5acd39){return db[_0x629e('0x25')][_0x629e('0x41')](_0x33c1c5['body'],{})[_0x629e('0x20')](respondWithResult(_0x5acd39,0xc9))['catch'](handleError(_0x5acd39,null));};exports['update']=function(_0x4cf337,_0x387e93){if(_0x4cf337['body']['id']){delete _0x4cf337[_0x629e('0x42')]['id'];}return db[_0x629e('0x25')]['find']({'where':{'id':_0x4cf337[_0x629e('0x3f')]['id']}})[_0x629e('0x20')](handleEntityNotFound(_0x387e93,null))[_0x629e('0x20')](saveUpdates(_0x4cf337[_0x629e('0x42')],null))[_0x629e('0x20')](respondWithResult(_0x387e93,null))[_0x629e('0x3e')](handleError(_0x387e93,null));};exports[_0x629e('0x21')]=function(_0x3c2d36,_0x543c79){return db[_0x629e('0x25')][_0x629e('0x40')]({'where':{'id':_0x3c2d36[_0x629e('0x3f')]['id']}})[_0x629e('0x20')](handleEntityNotFound(_0x543c79,null))[_0x629e('0x20')](removeEntity(_0x543c79,null))[_0x629e('0x3e')](handleError(_0x543c79,null));};exports[_0x629e('0x43')]=function(_0x43bae3,_0x160c6c){return db['SquareReport'][_0x629e('0x43')]()[_0x629e('0x20')](respondWithResult(_0x160c6c,null))['catch'](handleError(_0x160c6c,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index d501a79..ae1ecfd 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 _0x616e=['define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','api','moment','request-promise','rimraf','./squareReport.attributes'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x616e,0x19d));var _0xe616=function(_0x40927b,_0xf9b0a0){_0x40927b=_0x40927b-0x0;var _0x2635e8=_0x616e[_0x40927b];return _0x2635e8;};'use strict';var _=require(_0xe616('0x0'));var util=require(_0xe616('0x1'));var logger=require('../../config/logger')(_0xe616('0x2'));var moment=require(_0xe616('0x3'));var BPromise=require('bluebird');var rp=require(_0xe616('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe616('0x5'));var config=require('../../config/environment');var attributes=require(_0xe616('0x6'));module['exports']=function(_0x6da7d1,_0x444534){return _0x6da7d1[_0xe616('0x7')](_0xe616('0x8'),attributes,{'tableName':_0xe616('0x9'),'paranoid':![],'indexes':[{'name':_0xe616('0xa'),'fields':[_0xe616('0xb'),_0xe616('0xc')]},{'name':_0xe616('0xd'),'fields':[_0xe616('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0a4c=['leaveAt','lodash','util','../../config/logger','api','bluebird','path','rimraf','exports','define','report_square','uid_pname','uniqueid','project_name'];(function(_0xc77819,_0x139fdc){var _0x1c9434=function(_0x11d15d){while(--_0x11d15d){_0xc77819['push'](_0xc77819['shift']());}};_0x1c9434(++_0x139fdc);}(_0x0a4c,0xd3));var _0xc0a4=function(_0x164364,_0x1cb42d){_0x164364=_0x164364-0x0;var _0x148c3d=_0x0a4c[_0x164364];return _0x148c3d;};'use strict';var _=require(_0xc0a4('0x0'));var util=require(_0xc0a4('0x1'));var logger=require(_0xc0a4('0x2'))(_0xc0a4('0x3'));var moment=require('moment');var BPromise=require(_0xc0a4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc0a4('0x5'));var rimraf=require(_0xc0a4('0x6'));var config=require('../../config/environment');var attributes=require('./squareReport.attributes');module[_0xc0a4('0x7')]=function(_0xbbbce4,_0x460ff5){return _0xbbbce4[_0xc0a4('0x8')]('SquareReport',attributes,{'tableName':_0xc0a4('0x9'),'paranoid':![],'indexes':[{'name':_0xc0a4('0xa'),'fields':[_0xc0a4('0xb'),_0xc0a4('0xc')]},{'name':_0xc0a4('0xd'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index b79d929..94aaa7f 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 _0xa203=['update','where','attributes','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareReport','create','options','raw','UpdateSquareReport','SquareReport'];(function(_0x17302a,_0x1af632){var _0x70f938=function(_0x25a995){while(--_0x25a995){_0x17302a['push'](_0x17302a['shift']());}};_0x70f938(++_0x1af632);}(_0xa203,0x1e3));var _0x3a20=function(_0x5c967a,_0x254ae5){_0x5c967a=_0x5c967a-0x0;var _0x412b4a=_0xa203[_0x5c967a];return _0x412b4a;};'use strict';var _=require(_0x3a20('0x0'));var util=require(_0x3a20('0x1'));var moment=require(_0x3a20('0x2'));var BPromise=require(_0x3a20('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a20('0x4'))['db'];var utils=require(_0x3a20('0x5'));var logger=require(_0x3a20('0x6'))(_0x3a20('0x7'));var config=require(_0x3a20('0x8'));var jayson=require(_0x3a20('0x9'));var client=jayson[_0x3a20('0xa')][_0x3a20('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x540320,_0x4b4d30,_0x3ae88e){return new BPromise(function(_0x201299,_0x3cf2c2){return client['request'](_0x540320,_0x3ae88e)[_0x3a20('0xc')](function(_0x26a578){logger[_0x3a20('0xd')](_0x3a20('0xe'),_0x4b4d30,_0x3a20('0xf'));logger[_0x3a20('0x10')](_0x3a20('0x11'),_0x4b4d30,_0x3a20('0xf'),JSON[_0x3a20('0x12')](_0x26a578));if(_0x26a578[_0x3a20('0x13')]){if(_0x26a578[_0x3a20('0x13')][_0x3a20('0x14')]===0x1f4){logger['error'](_0x3a20('0xe'),_0x4b4d30,_0x26a578[_0x3a20('0x13')][_0x3a20('0x15')]);return _0x3cf2c2(_0x26a578[_0x3a20('0x13')][_0x3a20('0x15')]);}logger[_0x3a20('0x13')](_0x3a20('0xe'),_0x4b4d30,_0x26a578[_0x3a20('0x13')]['message']);return _0x201299(_0x26a578[_0x3a20('0x13')][_0x3a20('0x15')]);}else{logger['info']('SquareReport,\x20%s,\x20%s',_0x4b4d30,'request\x20sent');_0x201299(_0x26a578['result'][_0x3a20('0x15')]);}})[_0x3a20('0x16')](function(_0x5dad9f){logger[_0x3a20('0x13')]('SquareReport,\x20%s,\x20%s',_0x4b4d30,_0x5dad9f);_0x3cf2c2(_0x5dad9f);});});}exports[_0x3a20('0x17')]=function(_0x37065c){var _0xdcabff=this;return new Promise(function(_0x573dbe,_0x1b5fa0){return db['SquareReport'][_0x3a20('0x18')](_0x37065c['body'],{'raw':_0x37065c[_0x3a20('0x19')]?_0x37065c[_0x3a20('0x19')][_0x3a20('0x1a')]===undefined?!![]:![]:!![]})[_0x3a20('0xc')](function(_0x3c5829){logger[_0x3a20('0xd')](_0x3a20('0x17'),_0x37065c);logger[_0x3a20('0x10')](_0x3a20('0x17'),_0x37065c,JSON['stringify'](_0x3c5829));_0x573dbe(_0x3c5829);})[_0x3a20('0x16')](function(_0x3a195f){logger[_0x3a20('0x13')](_0x3a20('0x17'),_0x3a195f[_0x3a20('0x15')],_0x37065c);_0x1b5fa0(_0xdcabff[_0x3a20('0x13')](0x1f4,_0x3a195f[_0x3a20('0x15')]));});});};exports[_0x3a20('0x1b')]=function(_0x2b2606){var _0x3a21cb=this;return new Promise(function(_0x3417c2,_0x33d2e3){return db[_0x3a20('0x1c')][_0x3a20('0x1d')](_0x2b2606['body'],{'raw':_0x2b2606['options']?_0x2b2606[_0x3a20('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b2606[_0x3a20('0x19')]?_0x2b2606[_0x3a20('0x19')][_0x3a20('0x1e')]||null:null,'attributes':_0x2b2606['options']?_0x2b2606['options'][_0x3a20('0x1f')]||null:null,'limit':_0x2b2606[_0x3a20('0x19')]?_0x2b2606[_0x3a20('0x19')]['limit']||null:null})[_0x3a20('0xc')](function(_0x4bafe4){logger[_0x3a20('0xd')](_0x3a20('0x1b'),_0x2b2606);logger[_0x3a20('0x10')](_0x3a20('0x1b'),_0x2b2606,JSON[_0x3a20('0x12')](_0x4bafe4));_0x3417c2(_0x4bafe4);})['catch'](function(_0x50e668){logger[_0x3a20('0x13')](_0x3a20('0x1b'),_0x50e668[_0x3a20('0x15')],_0x2b2606);_0x33d2e3(_0x3a21cb['error'](0x1f4,_0x50e668[_0x3a20('0x15')]));});});}; \ No newline at end of file +var _0x284a=['../../config/environment','jayson/promise','client','http','request','SquareReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','SquareReport','create','body','options','then','debug','CreateSquareReport','update','raw','attributes','limit','UpdateSquareReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x284a,0x1e1));var _0xa284=function(_0x120bea,_0x18f8ad){_0x120bea=_0x120bea-0x0;var _0x2fc5e0=_0x284a[_0x120bea];return _0x2fc5e0;};'use strict';var _=require(_0xa284('0x0'));var util=require(_0xa284('0x1'));var moment=require(_0xa284('0x2'));var BPromise=require('bluebird');var rs=require(_0xa284('0x3'));var fs=require('fs');var Redis=require(_0xa284('0x4'));var db=require(_0xa284('0x5'))['db'];var utils=require(_0xa284('0x6'));var logger=require(_0xa284('0x7'))(_0xa284('0x8'));var config=require(_0xa284('0x9'));var jayson=require(_0xa284('0xa'));var client=jayson[_0xa284('0xb')][_0xa284('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x31d541,_0x341a33,_0x24245a){return new BPromise(function(_0x2f02c1,_0x63242){return client[_0xa284('0xd')](_0x31d541,_0x24245a)['then'](function(_0xbaef17){logger['info'](_0xa284('0xe'),_0x341a33,_0xa284('0xf'));logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0x341a33,_0xa284('0xf'),JSON[_0xa284('0x10')](_0xbaef17));if(_0xbaef17['error']){if(_0xbaef17[_0xa284('0x11')][_0xa284('0x12')]===0x1f4){logger['error'](_0xa284('0xe'),_0x341a33,_0xbaef17['error'][_0xa284('0x13')]);return _0x63242(_0xbaef17['error'][_0xa284('0x13')]);}logger[_0xa284('0x11')](_0xa284('0xe'),_0x341a33,_0xbaef17[_0xa284('0x11')]['message']);return _0x2f02c1(_0xbaef17[_0xa284('0x11')][_0xa284('0x13')]);}else{logger[_0xa284('0x14')](_0xa284('0xe'),_0x341a33,_0xa284('0xf'));_0x2f02c1(_0xbaef17[_0xa284('0x15')][_0xa284('0x13')]);}})[_0xa284('0x16')](function(_0x1a8395){logger[_0xa284('0x11')]('SquareReport,\x20%s,\x20%s',_0x341a33,_0x1a8395);_0x63242(_0x1a8395);});});}exports['CreateSquareReport']=function(_0x207063){var _0x486f56=this;return new Promise(function(_0x451d24,_0x178d05){return db[_0xa284('0x17')][_0xa284('0x18')](_0x207063[_0xa284('0x19')],{'raw':_0x207063[_0xa284('0x1a')]?_0x207063[_0xa284('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xa284('0x1b')](function(_0x542687){logger[_0xa284('0x14')]('CreateSquareReport',_0x207063);logger[_0xa284('0x1c')](_0xa284('0x1d'),_0x207063,JSON[_0xa284('0x10')](_0x542687));_0x451d24(_0x542687);})[_0xa284('0x16')](function(_0x4565d4){logger['error'](_0xa284('0x1d'),_0x4565d4[_0xa284('0x13')],_0x207063);_0x178d05(_0x486f56[_0xa284('0x11')](0x1f4,_0x4565d4['message']));});});};exports['UpdateSquareReport']=function(_0x1affcc){var _0x41b584=this;return new Promise(function(_0x4bafb9,_0x4457da){return db['SquareReport'][_0xa284('0x1e')](_0x1affcc['body'],{'raw':_0x1affcc[_0xa284('0x1a')]?_0x1affcc[_0xa284('0x1a')][_0xa284('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1affcc[_0xa284('0x1a')]?_0x1affcc[_0xa284('0x1a')]['where']||null:null,'attributes':_0x1affcc[_0xa284('0x1a')]?_0x1affcc[_0xa284('0x1a')][_0xa284('0x20')]||null:null,'limit':_0x1affcc[_0xa284('0x1a')]?_0x1affcc[_0xa284('0x1a')][_0xa284('0x21')]||null:null})[_0xa284('0x1b')](function(_0xdbc9c3){logger[_0xa284('0x14')]('UpdateSquareReport',_0x1affcc);logger[_0xa284('0x1c')](_0xa284('0x22'),_0x1affcc,JSON[_0xa284('0x10')](_0xdbc9c3));_0x4bafb9(_0xdbc9c3);})['catch'](function(_0x5866ee){logger[_0xa284('0x11')](_0xa284('0x22'),_0x5866ee[_0xa284('0x13')],_0x1affcc);_0x4457da(_0x41b584['error'](0x1f4,_0x5866ee['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index c38aec9..172af5a 100644 --- a/server/api/squareReportDetail/index.js +++ b/server/api/squareReportDetail/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['describe','/:id','create','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated'];(function(_0x1185fa,_0x12f4a1){var _0xa6dcf6=function(_0x351edb){while(--_0x351edb){_0x1185fa['push'](_0x1185fa['shift']());}};_0xa6dcf6(++_0x12f4a1);}(_0x7a54,0x106));var _0x47a5=function(_0x1a44e3,_0x2d7e7c){_0x1a44e3=_0x1a44e3-0x0;var _0x867079=_0x7a54[_0x1a44e3];return _0x867079;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var controller=require(_0x47a5('0x7'));router[_0x47a5('0x8')]('/',auth[_0x47a5('0x9')](),controller['index']);router[_0x47a5('0x8')]('/describe',auth[_0x47a5('0x9')](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x47a5('0x9')](),controller[_0x47a5('0xc')]);router['put'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x47a5('0xd')](_0x47a5('0xb'),auth[_0x47a5('0x9')](),controller[_0x47a5('0xe')]);module[_0x47a5('0xf')]=router; \ No newline at end of file +var _0x7a54=['describe','/:id','create','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated'];(function(_0x1284fe,_0x34c45d){var _0x184f9f=function(_0x3104c7){while(--_0x3104c7){_0x1284fe['push'](_0x1284fe['shift']());}};_0x184f9f(++_0x34c45d);}(_0x7a54,0x106));var _0x47a5=function(_0x4ab6fc,_0x58ec7b){_0x4ab6fc=_0x4ab6fc-0x0;var _0x5ac358=_0x7a54[_0x4ab6fc];return _0x5ac358;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var controller=require(_0x47a5('0x7'));router[_0x47a5('0x8')]('/',auth[_0x47a5('0x9')](),controller['index']);router[_0x47a5('0x8')]('/describe',auth[_0x47a5('0x9')](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x47a5('0x9')](),controller[_0x47a5('0xc')]);router['put'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x47a5('0xd')](_0x47a5('0xb'),auth[_0x47a5('0x9')](),controller[_0x47a5('0xe')]);module[_0x47a5('0xf')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 88081dc..0804e39 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 _0xc834=['STRING','TEXT','sequelize'];(function(_0x1749d4,_0x257a91){var _0xdc5f0d=function(_0x808f6b){while(--_0x808f6b){_0x1749d4['push'](_0x1749d4['shift']());}};_0xdc5f0d(++_0x257a91);}(_0xc834,0xf2));var _0x4c83=function(_0x21481c,_0x1b51ba){_0x21481c=_0x21481c-0x0;var _0x5dd77a=_0xc834[_0x21481c];return _0x5dd77a;};'use strict';var Sequelize=require(_0x4c83('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x4c83('0x1')]},'application':{'type':Sequelize[_0x4c83('0x1')]},'data':{'type':Sequelize[_0x4c83('0x2')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x4c83('0x1')]}}; \ No newline at end of file +var _0x2423=['STRING','TEXT','sequelize','exports'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x2423,0x19e));var _0x3242=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2423[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x3242('0x0'));module[_0x3242('0x1')]={'uniqueid':{'type':Sequelize[_0x3242('0x2')]},'node':{'type':Sequelize[_0x3242('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x3242('0x3')]},'project_name':{'type':Sequelize[_0x3242('0x2')]},'callerid':{'type':Sequelize[_0x3242('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 4ec4654..2bd0113 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 _0xa0d8=['crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','end','error','stack','name','send','index','SquareDetailsReport','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','options','include','findAll','params','rawAttributes','includeAll','find','catch','create','update','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xa0d8,0x10a));var _0x8a0d=function(_0x368e85,_0x5c6050){_0x368e85=_0x368e85-0x0;var _0x2a7d25=_0xa0d8[_0x368e85];return _0x2a7d25;};'use strict';var pdf=require(_0x8a0d('0x0'));var emlformat=require(_0x8a0d('0x1'));var rimraf=require(_0x8a0d('0x2'));var zipdir=require(_0x8a0d('0x3'));var jsonpatch=require(_0x8a0d('0x4'));var rp=require(_0x8a0d('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8a0d('0x6'));var util=require(_0x8a0d('0x7'));var path=require(_0x8a0d('0x8'));var sox=require(_0x8a0d('0x9'));var csv=require(_0x8a0d('0xa'));var ejs=require(_0x8a0d('0xb'));var fs=require('fs');var _=require(_0x8a0d('0xc'));var squel=require(_0x8a0d('0xd'));var crypto=require(_0x8a0d('0xe'));var jsforce=require(_0x8a0d('0xf'));var deskjs=require(_0x8a0d('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8a0d('0x11'));var Redis=require('ioredis');var authService=require(_0x8a0d('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8a0d('0x13'));var logger=require(_0x8a0d('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x8a0d('0x15'))['db'];function respondWithStatusCode(_0x14f698,_0x3df5e5){_0x3df5e5=_0x3df5e5||0xcc;return function(_0x19e694){if(_0x19e694){return _0x14f698[_0x8a0d('0x16')](_0x3df5e5);}return _0x14f698['status'](_0x3df5e5)['end']();};}function respondWithResult(_0x160c1e,_0x531a42){_0x531a42=_0x531a42||0xc8;return function(_0x23a894){if(_0x23a894){return _0x160c1e[_0x8a0d('0x17')](_0x531a42)[_0x8a0d('0x18')](_0x23a894);}};}function respondWithFilteredResult(_0x29e2bb,_0x452117){return function(_0x224ad8){if(_0x224ad8){var _0x5862d3=_0x224ad8[_0x8a0d('0x19')],_0x38195a=_0x452117[_0x8a0d('0x1a')],_0x3a670a=_0x452117[_0x8a0d('0x1a')]+_0x452117[_0x8a0d('0x1b')],_0x28cf16;if(_0x3a670a>=_0x5862d3){_0x3a670a=_0x5862d3;_0x28cf16=0xc8;}else{_0x28cf16=0xce;}_0x29e2bb['status'](_0x28cf16);return _0x29e2bb[_0x8a0d('0x1c')](_0x8a0d('0x1d'),_0x38195a+'-'+_0x3a670a+'/'+_0x5862d3)['json'](_0x224ad8);}return null;};}function patchUpdates(_0x8ccbba){return function(_0x3514cf){try{jsonpatch['apply'](_0x3514cf,_0x8ccbba,!![]);}catch(_0x4a80be){return BPromise[_0x8a0d('0x1e')](_0x4a80be);}return _0x3514cf[_0x8a0d('0x1f')]();};}function saveUpdates(_0x39fbf6,_0x2a9e56){return function(_0x1ca8a3){if(_0x1ca8a3){return _0x1ca8a3['update'](_0x39fbf6)[_0x8a0d('0x20')](function(_0x35d90f){return _0x35d90f;});}return null;};}function removeEntity(_0x5e3288,_0xc0bdc0){return function(_0x337eaf){if(_0x337eaf){return _0x337eaf[_0x8a0d('0x21')]()[_0x8a0d('0x20')](function(){_0x5e3288['status'](0xcc)[_0x8a0d('0x22')]();});}};}function handleEntityNotFound(_0x2f4eed,_0x374228){return function(_0x472404){if(!_0x472404){_0x2f4eed[_0x8a0d('0x16')](0x194);}return _0x472404;};}function handleError(_0x270732,_0x1ff2fd){_0x1ff2fd=_0x1ff2fd||0x1f4;return function(_0x1d9042){logger[_0x8a0d('0x23')](_0x1d9042[_0x8a0d('0x24')]);if(_0x1d9042[_0x8a0d('0x25')]){delete _0x1d9042[_0x8a0d('0x25')];}_0x270732['status'](_0x1ff2fd)[_0x8a0d('0x26')](_0x1d9042);};}exports[_0x8a0d('0x27')]=function(_0x5ea4c7,_0x518352){var _0x43a062={},_0x1ea6d3={},_0x36bf18={'count':0x0,'rows':[]};var _0x3001cd=_['map'](db[_0x8a0d('0x28')]['rawAttributes'],function(_0x9842a5){return{'name':_0x9842a5[_0x8a0d('0x29')],'type':_0x9842a5[_0x8a0d('0x2a')]['key']};});_0x1ea6d3[_0x8a0d('0x2b')]=_[_0x8a0d('0x2c')](_0x3001cd,'name');_0x1ea6d3[_0x8a0d('0x2d')]=_[_0x8a0d('0x2e')](_0x5ea4c7[_0x8a0d('0x2d')]);_0x1ea6d3[_0x8a0d('0x2f')]=_[_0x8a0d('0x30')](_0x1ea6d3[_0x8a0d('0x2b')],_0x1ea6d3[_0x8a0d('0x2d')]);_0x43a062[_0x8a0d('0x31')]=_[_0x8a0d('0x30')](_0x1ea6d3['model'],qs['fields'](_0x5ea4c7[_0x8a0d('0x2d')][_0x8a0d('0x32')]));_0x43a062['attributes']=_0x43a062[_0x8a0d('0x31')][_0x8a0d('0x33')]?_0x43a062['attributes']:_0x1ea6d3[_0x8a0d('0x2b')];if(!_0x5ea4c7[_0x8a0d('0x2d')][_0x8a0d('0x34')]('nolimit')){_0x43a062[_0x8a0d('0x1b')]=qs['limit'](_0x5ea4c7['query']['limit']);_0x43a062[_0x8a0d('0x1a')]=qs[_0x8a0d('0x1a')](_0x5ea4c7[_0x8a0d('0x2d')]['offset']);}_0x43a062[_0x8a0d('0x35')]=qs[_0x8a0d('0x36')](_0x5ea4c7[_0x8a0d('0x2d')]['sort']);_0x43a062['where']=qs[_0x8a0d('0x2f')](_['pick'](_0x5ea4c7[_0x8a0d('0x2d')],_0x1ea6d3[_0x8a0d('0x2f')]),_0x3001cd);if(_0x5ea4c7[_0x8a0d('0x2d')]['filter']){_0x43a062[_0x8a0d('0x37')]=_[_0x8a0d('0x38')](_0x43a062[_0x8a0d('0x37')],{'$or':_[_0x8a0d('0x2c')](_0x3001cd,function(_0x40ff77){if(_0x40ff77[_0x8a0d('0x2a')]!==_0x8a0d('0x39')){var _0x2b4a8d={};_0x2b4a8d[_0x40ff77[_0x8a0d('0x25')]]={'$like':'%'+_0x5ea4c7[_0x8a0d('0x2d')]['filter']+'%'};return _0x2b4a8d;}})});}_0x43a062=_[_0x8a0d('0x38')]({},_0x43a062,_0x5ea4c7[_0x8a0d('0x3a')]);var _0x4c1fd4={'where':_0x43a062[_0x8a0d('0x37')]};return db[_0x8a0d('0x28')]['count'](_0x4c1fd4)[_0x8a0d('0x20')](function(_0x29b4d0){_0x36bf18['count']=_0x29b4d0;if(_0x5ea4c7[_0x8a0d('0x2d')]['includeAll']){_0x43a062[_0x8a0d('0x3b')]=[{'all':!![]}];}return db[_0x8a0d('0x28')][_0x8a0d('0x3c')](_0x43a062);})['then'](function(_0x402405){_0x36bf18['rows']=_0x402405;return _0x36bf18;})[_0x8a0d('0x20')](respondWithFilteredResult(_0x518352,_0x43a062))['catch'](handleError(_0x518352,null));};exports['show']=function(_0x40f59a,_0xe37709){var _0x11a3c2={'raw':!![],'where':{'id':_0x40f59a[_0x8a0d('0x3d')]['id']}},_0x137f58={};_0x137f58[_0x8a0d('0x2b')]=_[_0x8a0d('0x2e')](db[_0x8a0d('0x28')][_0x8a0d('0x3e')]);_0x137f58['query']=_[_0x8a0d('0x2e')](_0x40f59a['query']);_0x137f58[_0x8a0d('0x2f')]=_['intersection'](_0x137f58[_0x8a0d('0x2b')],_0x137f58[_0x8a0d('0x2d')]);_0x11a3c2[_0x8a0d('0x31')]=_[_0x8a0d('0x30')](_0x137f58[_0x8a0d('0x2b')],qs[_0x8a0d('0x32')](_0x40f59a['query'][_0x8a0d('0x32')]));_0x11a3c2[_0x8a0d('0x31')]=_0x11a3c2[_0x8a0d('0x31')][_0x8a0d('0x33')]?_0x11a3c2[_0x8a0d('0x31')]:_0x137f58[_0x8a0d('0x2b')];if(_0x40f59a[_0x8a0d('0x2d')][_0x8a0d('0x3f')]){_0x11a3c2['include']=[{'all':!![]}];}_0x11a3c2=_[_0x8a0d('0x38')]({},_0x11a3c2,_0x40f59a['options']);return db['SquareDetailsReport'][_0x8a0d('0x40')](_0x11a3c2)[_0x8a0d('0x20')](handleEntityNotFound(_0xe37709,null))['then'](respondWithResult(_0xe37709,null))[_0x8a0d('0x41')](handleError(_0xe37709,null));};exports['create']=function(_0x5bb44b,_0x4cd373){return db[_0x8a0d('0x28')][_0x8a0d('0x42')](_0x5bb44b['body'],{})[_0x8a0d('0x20')](respondWithResult(_0x4cd373,0xc9))[_0x8a0d('0x41')](handleError(_0x4cd373,null));};exports[_0x8a0d('0x43')]=function(_0x35f66b,_0x3531f1){if(_0x35f66b[_0x8a0d('0x44')]['id']){delete _0x35f66b[_0x8a0d('0x44')]['id'];}return db[_0x8a0d('0x28')]['find']({'where':{'id':_0x35f66b['params']['id']}})['then'](handleEntityNotFound(_0x3531f1,null))[_0x8a0d('0x20')](saveUpdates(_0x35f66b[_0x8a0d('0x44')],null))['then'](respondWithResult(_0x3531f1,null))[_0x8a0d('0x41')](handleError(_0x3531f1,null));};exports[_0x8a0d('0x21')]=function(_0x37a6e0,_0x48f15d){return db[_0x8a0d('0x28')][_0x8a0d('0x40')]({'where':{'id':_0x37a6e0['params']['id']}})[_0x8a0d('0x20')](handleEntityNotFound(_0x48f15d,null))[_0x8a0d('0x20')](removeEntity(_0x48f15d,null))['catch'](handleError(_0x48f15d,null));};exports[_0x8a0d('0x45')]=function(_0x1c69bf,_0x4c1d04){return db[_0x8a0d('0x28')][_0x8a0d('0x45')]()[_0x8a0d('0x20')](respondWithResult(_0x4c1d04,null))[_0x8a0d('0x41')](handleError(_0x4c1d04,null));}; \ No newline at end of file +var _0x942b=['../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','apply','reject','then','destroy','error','stack','name','send','map','SquareDetailsReport','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','filter','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','update','html-pdf','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x3b697e,_0x2c2f46){var _0x39b9c5=function(_0x3e5d76){while(--_0x3e5d76){_0x3b697e['push'](_0x3b697e['shift']());}};_0x39b9c5(++_0x2c2f46);}(_0x942b,0x109));var _0xb942=function(_0xf4e61c,_0x4f257a){_0xf4e61c=_0xf4e61c-0x0;var _0x7df834=_0x942b[_0xf4e61c];return _0x7df834;};'use strict';var pdf=require(_0xb942('0x0'));var emlformat=require(_0xb942('0x1'));var rimraf=require(_0xb942('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb942('0x3'));var moment=require(_0xb942('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb942('0x5'));var util=require(_0xb942('0x6'));var path=require(_0xb942('0x7'));var sox=require(_0xb942('0x8'));var csv=require(_0xb942('0x9'));var ejs=require(_0xb942('0xa'));var fs=require('fs');var _=require(_0xb942('0xb'));var squel=require(_0xb942('0xc'));var crypto=require(_0xb942('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb942('0xe'));var toCsv=require(_0xb942('0x9'));var querystring=require(_0xb942('0xf'));var Papa=require('papaparse');var Redis=require(_0xb942('0x10'));var authService=require(_0xb942('0x11'));var qs=require(_0xb942('0x12'));var as=require(_0xb942('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb942('0x14'));var utils=require(_0xb942('0x15'));var config=require(_0xb942('0x16'));var db=require(_0xb942('0x17'))['db'];function respondWithStatusCode(_0x5883b2,_0x8cbfae){_0x8cbfae=_0x8cbfae||0xcc;return function(_0x370466){if(_0x370466){return _0x5883b2['sendStatus'](_0x8cbfae);}return _0x5883b2[_0xb942('0x18')](_0x8cbfae)[_0xb942('0x19')]();};}function respondWithResult(_0x262c27,_0x3fe953){_0x3fe953=_0x3fe953||0xc8;return function(_0x1d7901){if(_0x1d7901){return _0x262c27[_0xb942('0x18')](_0x3fe953)['json'](_0x1d7901);}};}function respondWithFilteredResult(_0xda71eb,_0x1a8e6d){return function(_0x1cfa32){if(_0x1cfa32){var _0x809c66=_0x1cfa32[_0xb942('0x1a')],_0x368ac6=_0x1a8e6d['offset'],_0x575546=_0x1a8e6d[_0xb942('0x1b')]+_0x1a8e6d[_0xb942('0x1c')],_0x3f5d24;if(_0x575546>=_0x809c66){_0x575546=_0x809c66;_0x3f5d24=0xc8;}else{_0x3f5d24=0xce;}_0xda71eb[_0xb942('0x18')](_0x3f5d24);return _0xda71eb[_0xb942('0x1d')]('Content-Range',_0x368ac6+'-'+_0x575546+'/'+_0x809c66)['json'](_0x1cfa32);}return null;};}function patchUpdates(_0x3f289b){return function(_0x5a6a0b){try{jsonpatch[_0xb942('0x1e')](_0x5a6a0b,_0x3f289b,!![]);}catch(_0x52c1b1){return BPromise[_0xb942('0x1f')](_0x52c1b1);}return _0x5a6a0b['save']();};}function saveUpdates(_0x5494a7,_0x48e812){return function(_0x15069a){if(_0x15069a){return _0x15069a['update'](_0x5494a7)[_0xb942('0x20')](function(_0x3bde6c){return _0x3bde6c;});}return null;};}function removeEntity(_0x47d246,_0x17a56c){return function(_0x281ee8){if(_0x281ee8){return _0x281ee8[_0xb942('0x21')]()[_0xb942('0x20')](function(){_0x47d246[_0xb942('0x18')](0xcc)[_0xb942('0x19')]();});}};}function handleEntityNotFound(_0x5354dc,_0x2a58fa){return function(_0x574029){if(!_0x574029){_0x5354dc['sendStatus'](0x194);}return _0x574029;};}function handleError(_0x3d315e,_0x57aaba){_0x57aaba=_0x57aaba||0x1f4;return function(_0x57897b){logger[_0xb942('0x22')](_0x57897b[_0xb942('0x23')]);if(_0x57897b[_0xb942('0x24')]){delete _0x57897b[_0xb942('0x24')];}_0x3d315e[_0xb942('0x18')](_0x57aaba)[_0xb942('0x25')](_0x57897b);};}exports['index']=function(_0x259ddf,_0x56992e){var _0x400866={},_0x11fff1={},_0x4f1db7={'count':0x0,'rows':[]};var _0x4526a5=_[_0xb942('0x26')](db[_0xb942('0x27')][_0xb942('0x28')],function(_0x3b0b9b){return{'name':_0x3b0b9b[_0xb942('0x29')],'type':_0x3b0b9b['type'][_0xb942('0x2a')]};});_0x11fff1['model']=_[_0xb942('0x26')](_0x4526a5,_0xb942('0x24'));_0x11fff1[_0xb942('0x2b')]=_[_0xb942('0x2c')](_0x259ddf['query']);_0x11fff1['filters']=_[_0xb942('0x2d')](_0x11fff1[_0xb942('0x2e')],_0x11fff1['query']);_0x400866[_0xb942('0x2f')]=_['intersection'](_0x11fff1[_0xb942('0x2e')],qs[_0xb942('0x30')](_0x259ddf[_0xb942('0x2b')][_0xb942('0x30')]));_0x400866[_0xb942('0x2f')]=_0x400866['attributes'][_0xb942('0x31')]?_0x400866[_0xb942('0x2f')]:_0x11fff1['model'];if(!_0x259ddf[_0xb942('0x2b')][_0xb942('0x32')](_0xb942('0x33'))){_0x400866['limit']=qs[_0xb942('0x1c')](_0x259ddf[_0xb942('0x2b')][_0xb942('0x1c')]);_0x400866['offset']=qs[_0xb942('0x1b')](_0x259ddf['query'][_0xb942('0x1b')]);}_0x400866[_0xb942('0x34')]=qs[_0xb942('0x35')](_0x259ddf['query'][_0xb942('0x35')]);_0x400866['where']=qs[_0xb942('0x36')](_[_0xb942('0x37')](_0x259ddf[_0xb942('0x2b')],_0x11fff1['filters']),_0x4526a5);if(_0x259ddf['query']['filter']){_0x400866[_0xb942('0x38')]=_[_0xb942('0x39')](_0x400866[_0xb942('0x38')],{'$or':_[_0xb942('0x26')](_0x4526a5,function(_0x25d523){if(_0x25d523['type']!=='VIRTUAL'){var _0x191b08={};_0x191b08[_0x25d523[_0xb942('0x24')]]={'$like':'%'+_0x259ddf[_0xb942('0x2b')][_0xb942('0x3a')]+'%'};return _0x191b08;}})});}_0x400866=_[_0xb942('0x39')]({},_0x400866,_0x259ddf['options']);var _0x1719eb={'where':_0x400866[_0xb942('0x38')]};return db[_0xb942('0x27')][_0xb942('0x1a')](_0x1719eb)[_0xb942('0x20')](function(_0x2239db){_0x4f1db7['count']=_0x2239db;if(_0x259ddf[_0xb942('0x2b')]['includeAll']){_0x400866[_0xb942('0x3b')]=[{'all':!![]}];}return db[_0xb942('0x27')][_0xb942('0x3c')](_0x400866);})[_0xb942('0x20')](function(_0x2c2d4d){_0x4f1db7[_0xb942('0x3d')]=_0x2c2d4d;return _0x4f1db7;})[_0xb942('0x20')](respondWithFilteredResult(_0x56992e,_0x400866))[_0xb942('0x3e')](handleError(_0x56992e,null));};exports[_0xb942('0x3f')]=function(_0x138c4b,_0x53d93b){var _0x209ca9={'raw':!![],'where':{'id':_0x138c4b[_0xb942('0x40')]['id']}},_0x3abb18={};_0x3abb18[_0xb942('0x2e')]=_[_0xb942('0x2c')](db[_0xb942('0x27')][_0xb942('0x28')]);_0x3abb18['query']=_[_0xb942('0x2c')](_0x138c4b[_0xb942('0x2b')]);_0x3abb18[_0xb942('0x36')]=_[_0xb942('0x2d')](_0x3abb18[_0xb942('0x2e')],_0x3abb18['query']);_0x209ca9[_0xb942('0x2f')]=_[_0xb942('0x2d')](_0x3abb18[_0xb942('0x2e')],qs[_0xb942('0x30')](_0x138c4b[_0xb942('0x2b')]['fields']));_0x209ca9[_0xb942('0x2f')]=_0x209ca9[_0xb942('0x2f')][_0xb942('0x31')]?_0x209ca9['attributes']:_0x3abb18[_0xb942('0x2e')];if(_0x138c4b['query'][_0xb942('0x41')]){_0x209ca9['include']=[{'all':!![]}];}_0x209ca9=_[_0xb942('0x39')]({},_0x209ca9,_0x138c4b[_0xb942('0x42')]);return db[_0xb942('0x27')][_0xb942('0x43')](_0x209ca9)[_0xb942('0x20')](handleEntityNotFound(_0x53d93b,null))[_0xb942('0x20')](respondWithResult(_0x53d93b,null))[_0xb942('0x3e')](handleError(_0x53d93b,null));};exports[_0xb942('0x44')]=function(_0x52f9ba,_0xa200cc){return db['SquareDetailsReport'][_0xb942('0x44')](_0x52f9ba[_0xb942('0x45')],{})[_0xb942('0x20')](respondWithResult(_0xa200cc,0xc9))[_0xb942('0x3e')](handleError(_0xa200cc,null));};exports[_0xb942('0x46')]=function(_0x38889c,_0xbb32ee){if(_0x38889c[_0xb942('0x45')]['id']){delete _0x38889c['body']['id'];}return db[_0xb942('0x27')][_0xb942('0x43')]({'where':{'id':_0x38889c[_0xb942('0x40')]['id']}})[_0xb942('0x20')](handleEntityNotFound(_0xbb32ee,null))[_0xb942('0x20')](saveUpdates(_0x38889c[_0xb942('0x45')],null))[_0xb942('0x20')](respondWithResult(_0xbb32ee,null))[_0xb942('0x3e')](handleError(_0xbb32ee,null));};exports[_0xb942('0x21')]=function(_0x884deb,_0x5e12b3){return db[_0xb942('0x27')]['find']({'where':{'id':_0x884deb[_0xb942('0x40')]['id']}})[_0xb942('0x20')](handleEntityNotFound(_0x5e12b3,null))[_0xb942('0x20')](removeEntity(_0x5e12b3,null))[_0xb942('0x3e')](handleError(_0x5e12b3,null));};exports['describe']=function(_0x521d90,_0x1d002a){return db[_0xb942('0x27')]['describe']()[_0xb942('0x20')](respondWithResult(_0x1d002a,null))[_0xb942('0x3e')](handleError(_0x1d002a,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index d7c3c9f..b165d09 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 _0x0d6f=['api','bluebird','path','exports','define','report_square_details','lodash','util','../../config/logger'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x0d6f,0xb1));var _0xf0d6=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x0d6f[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0xf0d6('0x0'));var util=require(_0xf0d6('0x1'));var logger=require(_0xf0d6('0x2'))(_0xf0d6('0x3'));var moment=require('moment');var BPromise=require(_0xf0d6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf0d6('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./squareReportDetail.attributes');module[_0xf0d6('0x6')]=function(_0x5ef764,_0x1060d2){return _0x5ef764[_0xf0d6('0x7')]('SquareDetailsReport',attributes,{'tableName':_0xf0d6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3af5=['util','api','moment','path','./squareReportDetail.attributes','exports','SquareDetailsReport','report_square_details','lodash'];(function(_0x435eee,_0x3aad45){var _0x44d2e3=function(_0x1e2934){while(--_0x1e2934){_0x435eee['push'](_0x435eee['shift']());}};_0x44d2e3(++_0x3aad45);}(_0x3af5,0x1d3));var _0x53af=function(_0x5a60ce,_0x48f080){_0x5a60ce=_0x5a60ce-0x0;var _0x393e5e=_0x3af5[_0x5a60ce];return _0x393e5e;};'use strict';var _=require(_0x53af('0x0'));var util=require(_0x53af('0x1'));var logger=require('../../config/logger')(_0x53af('0x2'));var moment=require(_0x53af('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x53af('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x53af('0x5'));module[_0x53af('0x6')]=function(_0x4e0137,_0xba7147){return _0x4e0137['define'](_0x53af('0x7'),attributes,{'tableName':_0x53af('0x8'),'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 acab6a1..0b52bf7 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 _0xea26=['request','then','info','SquareDetailsReport,\x20%s,\x20%s','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','CreateSquareDetailsReport','create','options','raw','debug','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x6cf5ec,_0x194d2e){var _0x271c4f=function(_0x206fee){while(--_0x206fee){_0x6cf5ec['push'](_0x6cf5ec['shift']());}};_0x271c4f(++_0x194d2e);}(_0xea26,0x17c));var _0x6ea2=function(_0x37fbf5,_0x4f80fb){_0x37fbf5=_0x37fbf5-0x0;var _0x155886=_0xea26[_0x37fbf5];return _0x155886;};'use strict';var _=require(_0x6ea2('0x0'));var util=require('util');var moment=require(_0x6ea2('0x1'));var BPromise=require(_0x6ea2('0x2'));var rs=require(_0x6ea2('0x3'));var fs=require('fs');var Redis=require(_0x6ea2('0x4'));var db=require(_0x6ea2('0x5'))['db'];var utils=require(_0x6ea2('0x6'));var logger=require(_0x6ea2('0x7'))(_0x6ea2('0x8'));var config=require(_0x6ea2('0x9'));var jayson=require(_0x6ea2('0xa'));var client=jayson[_0x6ea2('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42bc59,_0x1e272e,_0x940827){return new BPromise(function(_0x13d9ae,_0x6b8322){return client[_0x6ea2('0xc')](_0x42bc59,_0x940827)[_0x6ea2('0xd')](function(_0x4bf5a4){logger[_0x6ea2('0xe')](_0x6ea2('0xf'),_0x1e272e,'request\x20sent');logger['debug'](_0x6ea2('0x10'),_0x1e272e,_0x6ea2('0x11'),JSON['stringify'](_0x4bf5a4));if(_0x4bf5a4[_0x6ea2('0x12')]){if(_0x4bf5a4[_0x6ea2('0x12')]['code']===0x1f4){logger[_0x6ea2('0x12')](_0x6ea2('0xf'),_0x1e272e,_0x4bf5a4[_0x6ea2('0x12')][_0x6ea2('0x13')]);return _0x6b8322(_0x4bf5a4[_0x6ea2('0x12')][_0x6ea2('0x13')]);}logger[_0x6ea2('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x1e272e,_0x4bf5a4[_0x6ea2('0x12')]['message']);return _0x13d9ae(_0x4bf5a4[_0x6ea2('0x12')]['message']);}else{logger['info'](_0x6ea2('0xf'),_0x1e272e,_0x6ea2('0x11'));_0x13d9ae(_0x4bf5a4[_0x6ea2('0x14')][_0x6ea2('0x13')]);}})[_0x6ea2('0x15')](function(_0x122283){logger[_0x6ea2('0x12')](_0x6ea2('0xf'),_0x1e272e,_0x122283);_0x6b8322(_0x122283);});});}exports[_0x6ea2('0x16')]=function(_0x1d5bc3){var _0x457769=this;return new Promise(function(_0x23a2f7,_0x3bdd8f){return db['SquareDetailsReport'][_0x6ea2('0x17')](_0x1d5bc3['body'],{'raw':_0x1d5bc3[_0x6ea2('0x18')]?_0x1d5bc3['options'][_0x6ea2('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x2173c8){logger['info'](_0x6ea2('0x16'),_0x1d5bc3);logger[_0x6ea2('0x1a')](_0x6ea2('0x16'),_0x1d5bc3,JSON[_0x6ea2('0x1b')](_0x2173c8));_0x23a2f7(_0x2173c8);})[_0x6ea2('0x15')](function(_0x30302e){logger[_0x6ea2('0x12')](_0x6ea2('0x16'),_0x30302e[_0x6ea2('0x13')],_0x1d5bc3);_0x3bdd8f(_0x457769[_0x6ea2('0x12')](0x1f4,_0x30302e['message']));});});}; \ No newline at end of file +var _0x2667=['SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareDetailsReport','SquareDetailsReport','create','options','raw','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info'];(function(_0x51dfdf,_0x13365c){var _0x2dba3d=function(_0x415a0d){while(--_0x415a0d){_0x51dfdf['push'](_0x51dfdf['shift']());}};_0x2dba3d(++_0x13365c);}(_0x2667,0x1ae));var _0x7266=function(_0x4afbe7,_0x5e4f75){_0x4afbe7=_0x4afbe7-0x0;var _0xf8a8e7=_0x2667[_0x4afbe7];return _0xf8a8e7;};'use strict';var _=require('lodash');var util=require(_0x7266('0x0'));var moment=require(_0x7266('0x1'));var BPromise=require('bluebird');var rs=require(_0x7266('0x2'));var fs=require('fs');var Redis=require(_0x7266('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7266('0x4'));var logger=require(_0x7266('0x5'))(_0x7266('0x6'));var config=require(_0x7266('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7266('0x8')][_0x7266('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a2b85,_0x59c421,_0x2bd0fc){return new BPromise(function(_0x1a0ba3,_0x400297){return client[_0x7266('0xa')](_0x2a2b85,_0x2bd0fc)['then'](function(_0x1fa2d6){logger[_0x7266('0xb')](_0x7266('0xc'),_0x59c421,_0x7266('0xd'));logger[_0x7266('0xe')](_0x7266('0xf'),_0x59c421,_0x7266('0xd'),JSON[_0x7266('0x10')](_0x1fa2d6));if(_0x1fa2d6['error']){if(_0x1fa2d6[_0x7266('0x11')][_0x7266('0x12')]===0x1f4){logger[_0x7266('0x11')](_0x7266('0xc'),_0x59c421,_0x1fa2d6['error'][_0x7266('0x13')]);return _0x400297(_0x1fa2d6[_0x7266('0x11')][_0x7266('0x13')]);}logger[_0x7266('0x11')](_0x7266('0xc'),_0x59c421,_0x1fa2d6['error'][_0x7266('0x13')]);return _0x1a0ba3(_0x1fa2d6[_0x7266('0x11')]['message']);}else{logger[_0x7266('0xb')](_0x7266('0xc'),_0x59c421,'request\x20sent');_0x1a0ba3(_0x1fa2d6['result'][_0x7266('0x13')]);}})[_0x7266('0x14')](function(_0xd942ee){logger[_0x7266('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x59c421,_0xd942ee);_0x400297(_0xd942ee);});});}exports[_0x7266('0x15')]=function(_0x47462d){var _0x514788=this;return new Promise(function(_0x3c5001,_0x36a6f0){return db[_0x7266('0x16')][_0x7266('0x17')](_0x47462d['body'],{'raw':_0x47462d['options']?_0x47462d[_0x7266('0x18')][_0x7266('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x5a8086){logger[_0x7266('0xb')](_0x7266('0x15'),_0x47462d);logger[_0x7266('0xe')](_0x7266('0x15'),_0x47462d,JSON[_0x7266('0x10')](_0x5a8086));_0x3c5001(_0x5a8086);})['catch'](function(_0x374af9){logger[_0x7266('0x11')](_0x7266('0x15'),_0x374af9[_0x7266('0x13')],_0x47462d);_0x36a6f0(_0x514788['error'](0x1f4,_0x374af9[_0x7266('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 82ea795..c2eb187 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 _0xdd23=['get','killProcess','exports','express','Router','../../components/auth/service','./system.controller','isAuthenticated'];(function(_0x27f847,_0x37591b){var _0x4c19c7=function(_0x28f310){while(--_0x28f310){_0x27f847['push'](_0x27f847['shift']());}};_0x4c19c7(++_0x37591b);}(_0xdd23,0xab));var _0x3dd2=function(_0x123d23,_0x2b6282){_0x123d23=_0x123d23-0x0;var _0x183491=_0xdd23[_0x123d23];return _0x183491;};'use strict';var express=require(_0x3dd2('0x0'));var router=express[_0x3dd2('0x1')]();var auth=require(_0x3dd2('0x2'));var controller=require(_0x3dd2('0x3'));router['get']('/',auth[_0x3dd2('0x4')](),controller['index']);router[_0x3dd2('0x5')]('/process/:pid/kill',auth[_0x3dd2('0x4')](),controller[_0x3dd2('0x6')]);module[_0x3dd2('0x7')]=router; \ No newline at end of file +var _0xd2e0=['killProcess','exports','express','Router','../../components/auth/service','./system.controller','isAuthenticated','index','get','/process/:pid/kill'];(function(_0x17c453,_0x51c514){var _0x58f6ef=function(_0x331f41){while(--_0x331f41){_0x17c453['push'](_0x17c453['shift']());}};_0x58f6ef(++_0x51c514);}(_0xd2e0,0x174));var _0x0d2e=function(_0x3881ea,_0xa2b900){_0x3881ea=_0x3881ea-0x0;var _0x4579f7=_0xd2e0[_0x3881ea];return _0x4579f7;};'use strict';var express=require(_0x0d2e('0x0'));var router=express[_0x0d2e('0x1')]();var auth=require(_0x0d2e('0x2'));var controller=require(_0x0d2e('0x3'));router['get']('/',auth[_0x0d2e('0x4')](),controller[_0x0d2e('0x5')]);router[_0x0d2e('0x6')](_0x0d2e('0x7'),auth[_0x0d2e('0x4')](),controller[_0x0d2e('0x8')]);module[_0x0d2e('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 684d785..246ef0f 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 _0x7785=['exec','../../config/logger','util','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','then','catch','json','killProcess','components/import/cm','format','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly'];(function(_0x1cd7bb,_0x470ef2){var _0x8a027a=function(_0x1e91cb){while(--_0x1e91cb){_0x1cd7bb['push'](_0x1cd7bb['shift']());}};_0x8a027a(++_0x470ef2);}(_0x7785,0x104));var _0x5778=function(_0x23e2f7,_0x3d7f7d){_0x23e2f7=_0x23e2f7-0x0;var _0x36641f=_0x7785[_0x23e2f7];return _0x36641f;};'use strict';var info=require('systeminformation');var exec=require('child_process')[_0x5778('0x0')];var logger=require(_0x5778('0x1'))('api');var util=require(_0x5778('0x2'));var BPromise=require(_0x5778('0x3'));var _=require('lodash');function handleError(_0x49020d,_0x4e9b45,_0x45ee54){_0x4e9b45=_0x4e9b45||0x1f4;return function(_0x49b279){logger[_0x5778('0x4')](_0x5778('0x5'),_0x45ee54,_0x4e9b45,util[_0x5778('0x6')](_0x49b279,{'showHidden':![],'depth':null}));delete _0x49b279[_0x5778('0x7')];_0x49020d[_0x5778('0x8')](_0x4e9b45)[_0x5778('0x9')](_0x49b279);};}exports[_0x5778('0xa')]=function(_0x24f14d,_0x22e243){return info['getAllData']()[_0x5778('0xb')](function(_0x55d1b8){return _0x22e243[_0x5778('0x8')](0xc8)['json'](_0x55d1b8);})[_0x5778('0xc')](function(_0x18aa8c){return _0x22e243['status'](0x1f4)[_0x5778('0xd')](_0x18aa8c);});};exports[_0x5778('0xe')]=function(_0x3a8391,_0x59f377){var _0x19c079=[_0x5778('0xf')];return new BPromise(function(_0x2e992d,_0x278fb6){return exec(util[_0x5778('0x10')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x3a8391[_0x5778('0x11')][_0x5778('0x12')]),function(_0x3539db,_0x34ab27,_0x3b5c45){if(_0x3539db){return _0x278fb6(_0x3539db);}return _0x2e992d(_0x34ab27);});})['then'](function(_0x15e860){var _0x1111e7=![];var _0x51c62a=_0x15e860[_0x5778('0x13')](/\n/);for(var _0x265ba3=0x0,_0x236ec1=_0x19c079[_0x5778('0x14')];_0x265ba3<_0x236ec1,_0x1111e7===![];_0x265ba3+=0x1){if(_0x15e860[_0x5778('0x15')](_0x19c079[_0x265ba3])>=0x0){_0x1111e7=!![];}}if(!_0x1111e7){throw new Error(util['format'](_0x5778('0x16'),_0x3a8391[_0x5778('0x11')][_0x5778('0x12')]));}process[_0x5778('0x17')](_0x3a8391[_0x5778('0x11')][_0x5778('0x12')],_0x5778('0x18'));return _0x59f377[_0x5778('0x8')](0xc8)[_0x5778('0xd')]({'message':util[_0x5778('0x10')](_0x5778('0x19'),_0x3a8391[_0x5778('0x11')][_0x5778('0x12')])});})['catch'](handleError(_0x59f377,null,_0x5778('0xe')));}; \ No newline at end of file +var _0x0578=['send','getAllData','then','json','catch','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','status','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','child_process','exec','../../config/logger','api','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect'];(function(_0x3b9d3b,_0x5a68d5){var _0x398074=function(_0xea2912){while(--_0xea2912){_0x3b9d3b['push'](_0x3b9d3b['shift']());}};_0x398074(++_0x5a68d5);}(_0x0578,0x7e));var _0x8057=function(_0x176853,_0x4bd0a3){_0x176853=_0x176853-0x0;var _0x538ce0=_0x0578[_0x176853];return _0x538ce0;};'use strict';var info=require('systeminformation');var exec=require(_0x8057('0x0'))[_0x8057('0x1')];var logger=require(_0x8057('0x2'))(_0x8057('0x3'));var util=require('util');var BPromise=require(_0x8057('0x4'));var _=require(_0x8057('0x5'));function handleError(_0x121dcd,_0x21c073,_0x4f16c9){_0x21c073=_0x21c073||0x1f4;return function(_0x3a9364){logger[_0x8057('0x6')](_0x8057('0x7'),_0x4f16c9,_0x21c073,util[_0x8057('0x8')](_0x3a9364,{'showHidden':![],'depth':null}));delete _0x3a9364['name'];_0x121dcd['status'](_0x21c073)[_0x8057('0x9')](_0x3a9364);};}exports['index']=function(_0x1f5009,_0x586fad){return info[_0x8057('0xa')]()[_0x8057('0xb')](function(_0xd4d05b){return _0x586fad['status'](0xc8)[_0x8057('0xc')](_0xd4d05b);})[_0x8057('0xd')](function(_0x9a3984){return _0x586fad['status'](0x1f4)['json'](_0x9a3984);});};exports['killProcess']=function(_0x119c00,_0x1723b2){var _0x6c9f2a=['components/import/cm'];return new BPromise(function(_0x45d36f,_0x1be0b4){return exec(util[_0x8057('0xe')](_0x8057('0xf'),_0x119c00[_0x8057('0x10')][_0x8057('0x11')]),function(_0x59d602,_0x24a7e3,_0x31f6e0){if(_0x59d602){return _0x1be0b4(_0x59d602);}return _0x45d36f(_0x24a7e3);});})[_0x8057('0xb')](function(_0x3ebe4b){var _0x4a08e0=![];var _0x355cc5=_0x3ebe4b[_0x8057('0x12')](/\n/);for(var _0x1b9f44=0x0,_0x4c8892=_0x6c9f2a[_0x8057('0x13')];_0x1b9f44<_0x4c8892,_0x4a08e0===![];_0x1b9f44+=0x1){if(_0x3ebe4b[_0x8057('0x14')](_0x6c9f2a[_0x1b9f44])>=0x0){_0x4a08e0=!![];}}if(!_0x4a08e0){throw new Error(util[_0x8057('0xe')](_0x8057('0x15'),_0x119c00[_0x8057('0x10')][_0x8057('0x11')]));}process[_0x8057('0x16')](_0x119c00['params']['pid'],_0x8057('0x17'));return _0x1723b2[_0x8057('0x18')](0xc8)[_0x8057('0xc')]({'message':util[_0x8057('0xe')](_0x8057('0x19'),_0x119c00[_0x8057('0x10')][_0x8057('0x11')])});})['catch'](handleError(_0x1723b2,null,_0x8057('0x1a')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 997fa10..8e11eea 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 _0x55e0=['util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x55e0,0xdc));var _0x055e=function(_0x4880fc,_0x407738){_0x4880fc=_0x4880fc-0x0;var _0x22d8e8=_0x55e0[_0x4880fc];return _0x22d8e8;};'use strict';var multer=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var path=require(_0x055e('0x2'));var timeout=require(_0x055e('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x055e('0x4'));var interaction=require(_0x055e('0x5'));var config=require(_0x055e('0x6'));var controller=require(_0x055e('0x7'));router[_0x055e('0x8')]('/',auth[_0x055e('0x9')](),controller['index']);router['get'](_0x055e('0xa'),auth['isAuthenticated'](),controller[_0x055e('0xb')]);router[_0x055e('0xc')]('/',auth[_0x055e('0x9')](),controller[_0x055e('0xd')]);router[_0x055e('0xe')]('/:id',auth[_0x055e('0x9')](),controller[_0x055e('0xf')]);router[_0x055e('0x10')](_0x055e('0xa'),auth[_0x055e('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf109=['../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','show','create','put','delete','multer','util','path','../../components/auth/service'];(function(_0x2a0e96,_0x330d80){var _0x1cc6a9=function(_0x49d0a4){while(--_0x49d0a4){_0x2a0e96['push'](_0x2a0e96['shift']());}};_0x1cc6a9(++_0x330d80);}(_0xf109,0xce));var _0x9f10=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xf109[_0x35885a];return _0xe86249;};'use strict';var multer=require(_0x9f10('0x0'));var util=require(_0x9f10('0x1'));var path=require(_0x9f10('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x9f10('0x3'));var interaction=require(_0x9f10('0x4'));var config=require(_0x9f10('0x5'));var controller=require(_0x9f10('0x6'));router[_0x9f10('0x7')]('/',auth[_0x9f10('0x8')](),controller[_0x9f10('0x9')]);router[_0x9f10('0x7')](_0x9f10('0xa'),auth[_0x9f10('0x8')](),controller[_0x9f10('0xb')]);router['post']('/',auth[_0x9f10('0x8')](),controller[_0x9f10('0xc')]);router[_0x9f10('0xd')](_0x9f10('0xa'),auth[_0x9f10('0x8')](),controller['update']);router[_0x9f10('0xe')](_0x9f10('0xa'),auth[_0x9f10('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index dd092aa..8669e0a 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 _0xea28=['exports','STRING','name','#0091EA','sequelize'];(function(_0x5966e8,_0x347554){var _0x2ec39f=function(_0x339c2e){while(--_0x339c2e){_0x5966e8['push'](_0x5966e8['shift']());}};_0x2ec39f(++_0x347554);}(_0xea28,0x13a));var _0x8ea2=function(_0x51c516,_0xb48835){_0x51c516=_0x51c516-0x0;var _0x41ce48=_0xea28[_0x51c516];return _0x41ce48;};'use strict';var Sequelize=require(_0x8ea2('0x0'));module[_0x8ea2('0x1')]={'name':{'type':Sequelize[_0x8ea2('0x2')],'unique':_0x8ea2('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x8ea2('0x2')],'defaultValue':_0x8ea2('0x4')},'description':{'type':Sequelize[_0x8ea2('0x2')]}}; \ No newline at end of file +var _0xa571=['STRING','name','#0091EA','sequelize','exports'];(function(_0x5a5011,_0x3778b9){var _0x2e6ee1=function(_0x5db251){while(--_0x5db251){_0x5a5011['push'](_0x5a5011['shift']());}};_0x2e6ee1(++_0x3778b9);}(_0xa571,0x107));var _0x1a57=function(_0x535409,_0x4ff033){_0x535409=_0x535409-0x0;var _0x5b990f=_0xa571[_0x535409];return _0x5b990f;};'use strict';var Sequelize=require(_0x1a57('0x0'));module[_0x1a57('0x1')]={'name':{'type':Sequelize[_0x1a57('0x2')],'unique':_0x1a57('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x1a57('0x4')},'description':{'type':Sequelize[_0x1a57('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 555255e..f9aed9c 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 _0xe69d=['index','map','fieldName','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Tag','includeAll','include','findAll','show','params','rawAttributes','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','end','json','count','offset','limit','status','Content-Range','apply','reject','save','update','destroy','then','get','Tags','sendStatus','error','stack','name','send'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xe69d,0x11d));var _0xde69=function(_0x36f6c8,_0x1a6406){_0x36f6c8=_0x36f6c8-0x0;var _0x533cb5=_0xe69d[_0x36f6c8];return _0x533cb5;};'use strict';var pdf=require(_0xde69('0x0'));var emlformat=require(_0xde69('0x1'));var rimraf=require(_0xde69('0x2'));var zipdir=require(_0xde69('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xde69('0x4'));var moment=require(_0xde69('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xde69('0x6'));var sox=require(_0xde69('0x7'));var csv=require(_0xde69('0x8'));var ejs=require(_0xde69('0x9'));var fs=require('fs');var _=require(_0xde69('0xa'));var squel=require('squel');var crypto=require(_0xde69('0xb'));var jsforce=require(_0xde69('0xc'));var deskjs=require(_0xde69('0xd'));var toCsv=require(_0xde69('0x8'));var querystring=require(_0xde69('0xe'));var Papa=require(_0xde69('0xf'));var Redis=require('ioredis');var authService=require(_0xde69('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xde69('0x11'));var hardwareService=require(_0xde69('0x12'));var logger=require(_0xde69('0x13'))(_0xde69('0x14'));var utils=require(_0xde69('0x15'));var config=require('../../config/environment');var db=require(_0xde69('0x16'))['db'];function respondWithStatusCode(_0x3bc771,_0x12e075){_0x12e075=_0x12e075||0xcc;return function(_0x3b13aa){if(_0x3b13aa){return _0x3bc771['sendStatus'](_0x12e075);}return _0x3bc771['status'](_0x12e075)[_0xde69('0x17')]();};}function respondWithResult(_0x4a5ef7,_0x396d33){_0x396d33=_0x396d33||0xc8;return function(_0x42a690){if(_0x42a690){return _0x4a5ef7['status'](_0x396d33)[_0xde69('0x18')](_0x42a690);}};}function respondWithFilteredResult(_0x48abb3,_0x5b7b68){return function(_0x40d089){if(_0x40d089){var _0x1e99c3=_0x40d089[_0xde69('0x19')],_0x43f998=_0x5b7b68[_0xde69('0x1a')],_0x5be0c7=_0x5b7b68[_0xde69('0x1a')]+_0x5b7b68[_0xde69('0x1b')],_0x56edff;if(_0x5be0c7>=_0x1e99c3){_0x5be0c7=_0x1e99c3;_0x56edff=0xc8;}else{_0x56edff=0xce;}_0x48abb3[_0xde69('0x1c')](_0x56edff);return _0x48abb3['set'](_0xde69('0x1d'),_0x43f998+'-'+_0x5be0c7+'/'+_0x1e99c3)['json'](_0x40d089);}return null;};}function patchUpdates(_0x36b640){return function(_0x515268){try{jsonpatch[_0xde69('0x1e')](_0x515268,_0x36b640,!![]);}catch(_0x52e709){return BPromise[_0xde69('0x1f')](_0x52e709);}return _0x515268[_0xde69('0x20')]();};}function saveUpdates(_0x319665,_0x92abc){return function(_0x4ceaac){if(_0x4ceaac){return _0x4ceaac[_0xde69('0x21')](_0x319665)['then'](function(_0x407bcb){return _0x407bcb;});}return null;};}function removeEntity(_0x527f6a,_0xa20637){return function(_0x245d44){if(_0x245d44){return _0x245d44[_0xde69('0x22')]()[_0xde69('0x23')](function(){var _0x3f498e=_0x245d44[_0xde69('0x24')]({'plain':!![]});var _0x42124f=_0xde69('0x25');return db['UserProfileResource'][_0xde69('0x22')]({'where':{'type':_0x42124f,'resourceId':_0x3f498e['id']}})['then'](function(){return _0x245d44;});})[_0xde69('0x23')](function(){_0x527f6a['status'](0xcc)[_0xde69('0x17')]();});}};}function handleEntityNotFound(_0xdc205a,_0x1dd569){return function(_0x454216){if(!_0x454216){_0xdc205a[_0xde69('0x26')](0x194);}return _0x454216;};}function handleError(_0x359a7a,_0x251150){_0x251150=_0x251150||0x1f4;return function(_0x3be486){logger[_0xde69('0x27')](_0x3be486[_0xde69('0x28')]);if(_0x3be486[_0xde69('0x29')]){delete _0x3be486['name'];}_0x359a7a['status'](_0x251150)[_0xde69('0x2a')](_0x3be486);};}exports[_0xde69('0x2b')]=function(_0x4f5a0e,_0x1f6daf){var _0x217012={},_0x46ddfd={},_0x3cbaae={'count':0x0,'rows':[]};var _0x40688b=_[_0xde69('0x2c')](db['Tag']['rawAttributes'],function(_0x4b2ff5){return{'name':_0x4b2ff5[_0xde69('0x2d')],'type':_0x4b2ff5['type'][_0xde69('0x2e')]};});_0x46ddfd['model']=_[_0xde69('0x2c')](_0x40688b,_0xde69('0x29'));_0x46ddfd['query']=_[_0xde69('0x2f')](_0x4f5a0e[_0xde69('0x30')]);_0x46ddfd[_0xde69('0x31')]=_[_0xde69('0x32')](_0x46ddfd['model'],_0x46ddfd[_0xde69('0x30')]);_0x217012[_0xde69('0x33')]=_['intersection'](_0x46ddfd[_0xde69('0x34')],qs[_0xde69('0x35')](_0x4f5a0e[_0xde69('0x30')][_0xde69('0x35')]));_0x217012['attributes']=_0x217012[_0xde69('0x33')][_0xde69('0x36')]?_0x217012[_0xde69('0x33')]:_0x46ddfd[_0xde69('0x34')];if(!_0x4f5a0e[_0xde69('0x30')][_0xde69('0x37')](_0xde69('0x38'))){_0x217012[_0xde69('0x1b')]=qs[_0xde69('0x1b')](_0x4f5a0e[_0xde69('0x30')][_0xde69('0x1b')]);_0x217012[_0xde69('0x1a')]=qs[_0xde69('0x1a')](_0x4f5a0e[_0xde69('0x30')][_0xde69('0x1a')]);}_0x217012[_0xde69('0x39')]=qs['sort'](_0x4f5a0e[_0xde69('0x30')][_0xde69('0x3a')]);_0x217012[_0xde69('0x3b')]=qs[_0xde69('0x31')](_[_0xde69('0x3c')](_0x4f5a0e[_0xde69('0x30')],_0x46ddfd[_0xde69('0x31')]),_0x40688b);if(_0x4f5a0e[_0xde69('0x30')][_0xde69('0x3d')]){_0x217012[_0xde69('0x3b')]=_[_0xde69('0x3e')](_0x217012[_0xde69('0x3b')],{'$or':_[_0xde69('0x2c')](_0x40688b,function(_0x1702d1){if(_0x1702d1['type']!==_0xde69('0x3f')){var _0x53306d={};_0x53306d[_0x1702d1[_0xde69('0x29')]]={'$like':'%'+_0x4f5a0e[_0xde69('0x30')]['filter']+'%'};return _0x53306d;}})});}_0x217012=_['merge']({},_0x217012,_0x4f5a0e[_0xde69('0x40')]);var _0x212c26={'where':_0x217012[_0xde69('0x3b')]};return db[_0xde69('0x41')]['count'](_0x212c26)[_0xde69('0x23')](function(_0x3b11a2){_0x3cbaae[_0xde69('0x19')]=_0x3b11a2;if(_0x4f5a0e[_0xde69('0x30')][_0xde69('0x42')]){_0x217012[_0xde69('0x43')]=[{'all':!![]}];}return db[_0xde69('0x41')][_0xde69('0x44')](_0x217012);})[_0xde69('0x23')](function(_0x579080){_0x3cbaae['rows']=_0x579080;return _0x3cbaae;})[_0xde69('0x23')](respondWithFilteredResult(_0x1f6daf,_0x217012))['catch'](handleError(_0x1f6daf,null));};exports[_0xde69('0x45')]=function(_0x5308d6,_0x3626fa){var _0x11fc9c={'raw':!![],'where':{'id':_0x5308d6[_0xde69('0x46')]['id']}},_0x5aa2bb={};_0x5aa2bb[_0xde69('0x34')]=_[_0xde69('0x2f')](db[_0xde69('0x41')][_0xde69('0x47')]);_0x5aa2bb[_0xde69('0x30')]=_[_0xde69('0x2f')](_0x5308d6[_0xde69('0x30')]);_0x5aa2bb['filters']=_[_0xde69('0x32')](_0x5aa2bb[_0xde69('0x34')],_0x5aa2bb['query']);_0x11fc9c[_0xde69('0x33')]=_[_0xde69('0x32')](_0x5aa2bb[_0xde69('0x34')],qs[_0xde69('0x35')](_0x5308d6['query'][_0xde69('0x35')]));_0x11fc9c[_0xde69('0x33')]=_0x11fc9c['attributes']['length']?_0x11fc9c[_0xde69('0x33')]:_0x5aa2bb[_0xde69('0x34')];if(_0x5308d6[_0xde69('0x30')]['includeAll']){_0x11fc9c[_0xde69('0x43')]=[{'all':!![]}];}_0x11fc9c=_['merge']({},_0x11fc9c,_0x5308d6['options']);return db[_0xde69('0x41')][_0xde69('0x48')](_0x11fc9c)['then'](handleEntityNotFound(_0x3626fa,null))[_0xde69('0x23')](respondWithResult(_0x3626fa,null))['catch'](handleError(_0x3626fa,null));};exports[_0xde69('0x49')]=function(_0x32ea0c,_0x3d718e){return db[_0xde69('0x41')][_0xde69('0x49')](_0x32ea0c[_0xde69('0x4a')],{})[_0xde69('0x23')](function(_0xef2cbf){var _0x59f819=_0x32ea0c[_0xde69('0x4b')][_0xde69('0x24')]({'plain':!![]});if(!_0x59f819)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x59f819[_0xde69('0x4c')]===_0xde69('0x4b')){var _0x29bf79=_0xef2cbf[_0xde69('0x24')]({'plain':!![]});var _0x1d6d11=_0xde69('0x25');return db[_0xde69('0x4d')]['find']({'where':{'name':_0x1d6d11,'userProfileId':_0x59f819[_0xde69('0x4e')]},'raw':!![]})['then'](function(_0x1e9cb3){if(_0x1e9cb3&&_0x1e9cb3[_0xde69('0x4f')]===0x0){return db['UserProfileResource'][_0xde69('0x49')]({'name':_0x29bf79[_0xde69('0x29')],'resourceId':_0x29bf79['id'],'type':_0x1e9cb3['name'],'sectionId':_0x1e9cb3['id']},{})['then'](function(){return _0xef2cbf;});}else{return _0xef2cbf;}})[_0xde69('0x50')](function(_0x11d247){logger[_0xde69('0x27')](_0xde69('0x51'),_0x11d247);throw _0x11d247;});}return _0xef2cbf;})[_0xde69('0x23')](respondWithResult(_0x3d718e,0xc9))['catch'](handleError(_0x3d718e,null));};exports[_0xde69('0x21')]=function(_0x574643,_0x58a93d){if(_0x574643[_0xde69('0x4a')]['id']){delete _0x574643[_0xde69('0x4a')]['id'];}return db[_0xde69('0x41')][_0xde69('0x48')]({'where':{'id':_0x574643[_0xde69('0x46')]['id']}})[_0xde69('0x23')](handleEntityNotFound(_0x58a93d,null))[_0xde69('0x23')](saveUpdates(_0x574643[_0xde69('0x4a')],null))['then'](respondWithResult(_0x58a93d,null))[_0xde69('0x50')](handleError(_0x58a93d,null));};exports[_0xde69('0x22')]=function(_0x1d0af0,_0x5b4bbe){return db[_0xde69('0x41')][_0xde69('0x48')]({'where':{'id':_0x1d0af0[_0xde69('0x46')]['id']}})[_0xde69('0x23')](handleEntityNotFound(_0x5b4bbe,null))[_0xde69('0x23')](removeEntity(_0x5b4bbe,null))[_0xde69('0x50')](handleError(_0x5b4bbe,null));}; \ No newline at end of file +var _0x3708=['role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','count','limit','set','Content-Range','save','update','destroy','get','Tags','UserProfileResource','then','error','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','hasOwnProperty','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','Tag','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x416efd,_0x2818cc){var _0x11198a=function(_0x5cba7f){while(--_0x5cba7f){_0x416efd['push'](_0x416efd['shift']());}};_0x11198a(++_0x2818cc);}(_0x3708,0xa6));var _0x8370=function(_0x3b439d,_0x3d2d7c){_0x3b439d=_0x3b439d-0x0;var _0x236225=_0x3708[_0x3b439d];return _0x236225;};'use strict';var pdf=require(_0x8370('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8370('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8370('0x2'));var moment=require(_0x8370('0x3'));var BPromise=require(_0x8370('0x4'));var Mustache=require(_0x8370('0x5'));var util=require(_0x8370('0x6'));var path=require('path');var sox=require(_0x8370('0x7'));var csv=require(_0x8370('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8370('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8370('0xa'));var deskjs=require(_0x8370('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8370('0xc'));var Redis=require(_0x8370('0xd'));var authService=require(_0x8370('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x8370('0xf'));var hardwareService=require(_0x8370('0x10'));var logger=require(_0x8370('0x11'))(_0x8370('0x12'));var utils=require(_0x8370('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xcf67c2,_0xdf768a){_0xdf768a=_0xdf768a||0xcc;return function(_0x3c3f39){if(_0x3c3f39){return _0xcf67c2[_0x8370('0x14')](_0xdf768a);}return _0xcf67c2[_0x8370('0x15')](_0xdf768a)[_0x8370('0x16')]();};}function respondWithResult(_0x3e64,_0x30ccc4){_0x30ccc4=_0x30ccc4||0xc8;return function(_0x114d30){if(_0x114d30){return _0x3e64[_0x8370('0x15')](_0x30ccc4)[_0x8370('0x17')](_0x114d30);}};}function respondWithFilteredResult(_0x4ce3f0,_0x55625a){return function(_0x1bd068){if(_0x1bd068){var _0x3a5f6e=_0x1bd068[_0x8370('0x18')],_0x40b36b=_0x55625a['offset'],_0x3a61ac=_0x55625a['offset']+_0x55625a[_0x8370('0x19')],_0x38006b;if(_0x3a61ac>=_0x3a5f6e){_0x3a61ac=_0x3a5f6e;_0x38006b=0xc8;}else{_0x38006b=0xce;}_0x4ce3f0['status'](_0x38006b);return _0x4ce3f0[_0x8370('0x1a')](_0x8370('0x1b'),_0x40b36b+'-'+_0x3a61ac+'/'+_0x3a5f6e)[_0x8370('0x17')](_0x1bd068);}return null;};}function patchUpdates(_0x5b8c8e){return function(_0x55abd9){try{jsonpatch['apply'](_0x55abd9,_0x5b8c8e,!![]);}catch(_0x1efe61){return BPromise['reject'](_0x1efe61);}return _0x55abd9[_0x8370('0x1c')]();};}function saveUpdates(_0x499106,_0x147816){return function(_0xa4e3f1){if(_0xa4e3f1){return _0xa4e3f1[_0x8370('0x1d')](_0x499106)['then'](function(_0x208f18){return _0x208f18;});}return null;};}function removeEntity(_0x48566c,_0x27a8ad){return function(_0x3b6584){if(_0x3b6584){return _0x3b6584[_0x8370('0x1e')]()['then'](function(){var _0x3bcf5d=_0x3b6584[_0x8370('0x1f')]({'plain':!![]});var _0x42a2ee=_0x8370('0x20');return db[_0x8370('0x21')][_0x8370('0x1e')]({'where':{'type':_0x42a2ee,'resourceId':_0x3bcf5d['id']}})[_0x8370('0x22')](function(){return _0x3b6584;});})['then'](function(){_0x48566c['status'](0xcc)[_0x8370('0x16')]();});}};}function handleEntityNotFound(_0x2a52e3,_0x3797e1){return function(_0x58d3b9){if(!_0x58d3b9){_0x2a52e3['sendStatus'](0x194);}return _0x58d3b9;};}function handleError(_0xf6a6b2,_0x39f9c0){_0x39f9c0=_0x39f9c0||0x1f4;return function(_0x471f3d){logger[_0x8370('0x23')](_0x471f3d['stack']);if(_0x471f3d[_0x8370('0x24')]){delete _0x471f3d[_0x8370('0x24')];}_0xf6a6b2[_0x8370('0x15')](_0x39f9c0)[_0x8370('0x25')](_0x471f3d);};}exports[_0x8370('0x26')]=function(_0x1c348f,_0x543670){var _0x268709={},_0x2180af={},_0x55aa40={'count':0x0,'rows':[]};var _0x4a9b92=_[_0x8370('0x27')](db['Tag'][_0x8370('0x28')],function(_0x509784){return{'name':_0x509784[_0x8370('0x29')],'type':_0x509784[_0x8370('0x2a')][_0x8370('0x2b')]};});_0x2180af['model']=_[_0x8370('0x27')](_0x4a9b92,_0x8370('0x24'));_0x2180af[_0x8370('0x2c')]=_['keys'](_0x1c348f[_0x8370('0x2c')]);_0x2180af[_0x8370('0x2d')]=_[_0x8370('0x2e')](_0x2180af['model'],_0x2180af['query']);_0x268709[_0x8370('0x2f')]=_[_0x8370('0x2e')](_0x2180af[_0x8370('0x30')],qs['fields'](_0x1c348f[_0x8370('0x2c')][_0x8370('0x31')]));_0x268709[_0x8370('0x2f')]=_0x268709[_0x8370('0x2f')]['length']?_0x268709['attributes']:_0x2180af[_0x8370('0x30')];if(!_0x1c348f[_0x8370('0x2c')][_0x8370('0x32')]('nolimit')){_0x268709[_0x8370('0x19')]=qs[_0x8370('0x19')](_0x1c348f['query'][_0x8370('0x19')]);_0x268709[_0x8370('0x33')]=qs['offset'](_0x1c348f[_0x8370('0x2c')]['offset']);}_0x268709[_0x8370('0x34')]=qs[_0x8370('0x35')](_0x1c348f[_0x8370('0x2c')][_0x8370('0x35')]);_0x268709[_0x8370('0x36')]=qs[_0x8370('0x2d')](_[_0x8370('0x37')](_0x1c348f['query'],_0x2180af['filters']),_0x4a9b92);if(_0x1c348f[_0x8370('0x2c')][_0x8370('0x38')]){_0x268709[_0x8370('0x36')]=_[_0x8370('0x39')](_0x268709['where'],{'$or':_[_0x8370('0x27')](_0x4a9b92,function(_0x4a926b){if(_0x4a926b[_0x8370('0x2a')]!==_0x8370('0x3a')){var _0xf3883e={};_0xf3883e[_0x4a926b[_0x8370('0x24')]]={'$like':'%'+_0x1c348f[_0x8370('0x2c')][_0x8370('0x38')]+'%'};return _0xf3883e;}})});}_0x268709=_[_0x8370('0x39')]({},_0x268709,_0x1c348f[_0x8370('0x3b')]);var _0x5d4e72={'where':_0x268709[_0x8370('0x36')]};return db[_0x8370('0x3c')][_0x8370('0x18')](_0x5d4e72)[_0x8370('0x22')](function(_0x254c77){_0x55aa40['count']=_0x254c77;if(_0x1c348f['query'][_0x8370('0x3d')]){_0x268709[_0x8370('0x3e')]=[{'all':!![]}];}return db['Tag'][_0x8370('0x3f')](_0x268709);})['then'](function(_0x5efcad){_0x55aa40[_0x8370('0x40')]=_0x5efcad;return _0x55aa40;})['then'](respondWithFilteredResult(_0x543670,_0x268709))[_0x8370('0x41')](handleError(_0x543670,null));};exports[_0x8370('0x42')]=function(_0x158dfa,_0x4ae5a8){var _0x17b292={'raw':!![],'where':{'id':_0x158dfa[_0x8370('0x43')]['id']}},_0x52ac75={};_0x52ac75[_0x8370('0x30')]=_[_0x8370('0x44')](db[_0x8370('0x3c')][_0x8370('0x28')]);_0x52ac75[_0x8370('0x2c')]=_[_0x8370('0x44')](_0x158dfa[_0x8370('0x2c')]);_0x52ac75['filters']=_[_0x8370('0x2e')](_0x52ac75['model'],_0x52ac75['query']);_0x17b292[_0x8370('0x2f')]=_[_0x8370('0x2e')](_0x52ac75[_0x8370('0x30')],qs[_0x8370('0x31')](_0x158dfa['query'][_0x8370('0x31')]));_0x17b292[_0x8370('0x2f')]=_0x17b292[_0x8370('0x2f')][_0x8370('0x45')]?_0x17b292[_0x8370('0x2f')]:_0x52ac75[_0x8370('0x30')];if(_0x158dfa['query'][_0x8370('0x3d')]){_0x17b292['include']=[{'all':!![]}];}_0x17b292=_[_0x8370('0x39')]({},_0x17b292,_0x158dfa[_0x8370('0x3b')]);return db[_0x8370('0x3c')][_0x8370('0x46')](_0x17b292)[_0x8370('0x22')](handleEntityNotFound(_0x4ae5a8,null))[_0x8370('0x22')](respondWithResult(_0x4ae5a8,null))[_0x8370('0x41')](handleError(_0x4ae5a8,null));};exports[_0x8370('0x47')]=function(_0x43ab7e,_0x15b43d){return db[_0x8370('0x3c')][_0x8370('0x47')](_0x43ab7e['body'],{})[_0x8370('0x22')](function(_0x5b5fd5){var _0x4d99b5=_0x43ab7e[_0x8370('0x48')][_0x8370('0x1f')]({'plain':!![]});if(!_0x4d99b5)throw new Error(_0x8370('0x49'));if(_0x4d99b5[_0x8370('0x4a')]===_0x8370('0x48')){var _0x837753=_0x5b5fd5[_0x8370('0x1f')]({'plain':!![]});var _0x467a80=_0x8370('0x20');return db[_0x8370('0x4b')][_0x8370('0x46')]({'where':{'name':_0x467a80,'userProfileId':_0x4d99b5[_0x8370('0x4c')]},'raw':!![]})[_0x8370('0x22')](function(_0x3e6eaa){if(_0x3e6eaa&&_0x3e6eaa[_0x8370('0x4d')]===0x0){return db['UserProfileResource'][_0x8370('0x47')]({'name':_0x837753[_0x8370('0x24')],'resourceId':_0x837753['id'],'type':_0x3e6eaa[_0x8370('0x24')],'sectionId':_0x3e6eaa['id']},{})['then'](function(){return _0x5b5fd5;});}else{return _0x5b5fd5;}})['catch'](function(_0x30c0d9){logger[_0x8370('0x23')](_0x8370('0x4e'),_0x30c0d9);throw _0x30c0d9;});}return _0x5b5fd5;})[_0x8370('0x22')](respondWithResult(_0x15b43d,0xc9))[_0x8370('0x41')](handleError(_0x15b43d,null));};exports[_0x8370('0x1d')]=function(_0x20045e,_0x1c782a){if(_0x20045e[_0x8370('0x4f')]['id']){delete _0x20045e[_0x8370('0x4f')]['id'];}return db['Tag']['find']({'where':{'id':_0x20045e['params']['id']}})['then'](handleEntityNotFound(_0x1c782a,null))[_0x8370('0x22')](saveUpdates(_0x20045e[_0x8370('0x4f')],null))['then'](respondWithResult(_0x1c782a,null))['catch'](handleError(_0x1c782a,null));};exports[_0x8370('0x1e')]=function(_0x27dba4,_0x445d41){return db['Tag']['find']({'where':{'id':_0x27dba4[_0x8370('0x43')]['id']}})['then'](handleEntityNotFound(_0x445d41,null))[_0x8370('0x22')](removeEntity(_0x445d41,null))[_0x8370('0x41')](handleError(_0x445d41,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index fa9a1f6..20a1606 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 _0xa91a=['request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','define','Tag','tools_tags','util','../../config/logger','api','moment','bluebird'];(function(_0x5c034a,_0x131fd6){var _0x176d53=function(_0x1d6a20){while(--_0x1d6a20){_0x5c034a['push'](_0x5c034a['shift']());}};_0x176d53(++_0x131fd6);}(_0xa91a,0x167));var _0xaa91=function(_0x1e8061,_0x4b37ce){_0x1e8061=_0x1e8061-0x0;var _0x43eb9f=_0xa91a[_0x1e8061];return _0x43eb9f;};'use strict';var _=require('lodash');var util=require(_0xaa91('0x0'));var logger=require(_0xaa91('0x1'))(_0xaa91('0x2'));var moment=require(_0xaa91('0x3'));var BPromise=require(_0xaa91('0x4'));var rp=require(_0xaa91('0x5'));var fs=require('fs');var path=require(_0xaa91('0x6'));var rimraf=require(_0xaa91('0x7'));var config=require(_0xaa91('0x8'));var attributes=require(_0xaa91('0x9'));module[_0xaa91('0xa')]=function(_0x149ea8,_0x155d0a){return _0x149ea8[_0xaa91('0xb')](_0xaa91('0xc'),attributes,{'tableName':_0xaa91('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ef3=['bluebird','request-promise','path','rimraf','../../config/environment','define','Tag','tools_tags','lodash','util','../../config/logger','api','moment'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x8ef3,0xcb));var _0x38ef=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x8ef3[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x38ef('0x0'));var util=require(_0x38ef('0x1'));var logger=require(_0x38ef('0x2'))(_0x38ef('0x3'));var moment=require(_0x38ef('0x4'));var BPromise=require(_0x38ef('0x5'));var rp=require(_0x38ef('0x6'));var fs=require('fs');var path=require(_0x38ef('0x7'));var rimraf=require(_0x38ef('0x8'));var config=require(_0x38ef('0x9'));var attributes=require('./tag.attributes');module['exports']=function(_0x5e7a6b,_0x528f0f){return _0x5e7a6b[_0x38ef('0xa')](_0x38ef('0xb'),attributes,{'tableName':_0x38ef('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index e1eea11..9fd0e93 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 _0x54ef=['result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x192ff8,_0x177818){var _0x44948c=function(_0x4ee9e1){while(--_0x4ee9e1){_0x192ff8['push'](_0x192ff8['shift']());}};_0x44948c(++_0x177818);}(_0x54ef,0x112));var _0xf54e=function(_0x4f58ef,_0x17a6d2){_0x4f58ef=_0x4f58ef-0x0;var _0x3fcb46=_0x54ef[_0x4f58ef];return _0x3fcb46;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var moment=require(_0xf54e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf54e('0x3'));var fs=require('fs');var Redis=require(_0xf54e('0x4'));var db=require(_0xf54e('0x5'))['db'];var utils=require(_0xf54e('0x6'));var logger=require(_0xf54e('0x7'))(_0xf54e('0x8'));var config=require(_0xf54e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x99cf9,_0x2464ae,_0x561870){return new BPromise(function(_0x27e69b,_0x57a1ce){return client[_0xf54e('0xb')](_0x99cf9,_0x561870)[_0xf54e('0xc')](function(_0x47c5e1){logger[_0xf54e('0xd')](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));logger[_0xf54e('0x10')]('Tag,\x20%s,\x20%s,\x20%s',_0x2464ae,_0xf54e('0xf'),JSON[_0xf54e('0x11')](_0x47c5e1));if(_0x47c5e1[_0xf54e('0x12')]){if(_0x47c5e1[_0xf54e('0x12')]['code']===0x1f4){logger[_0xf54e('0x12')]('Tag,\x20%s,\x20%s',_0x2464ae,_0x47c5e1['error'][_0xf54e('0x13')]);return _0x57a1ce(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}logger[_0xf54e('0x12')]('Tag,\x20%s,\x20%s',_0x2464ae,_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);return _0x27e69b(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}else{logger['info'](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));_0x27e69b(_0x47c5e1[_0xf54e('0x14')]['message']);}})['catch'](function(_0xd87020){logger[_0xf54e('0x12')](_0xf54e('0xe'),_0x2464ae,_0xd87020);_0x57a1ce(_0xd87020);});});} \ No newline at end of file +var _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(_0x4ed4d2,_0x47acf7){var _0x15ae2e=function(_0x3199f0){while(--_0x3199f0){_0x4ed4d2['push'](_0x4ed4d2['shift']());}};_0x15ae2e(++_0x47acf7);}(_0x0fd9,0xa3));var _0x90fd=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x0fd9[_0x82129b];return _0x2ae5dc;};'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 0a40daa..4170af0 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 _0xaf86=['show','/:id/queues','/:id/users','getAgents','create','post','addAgents','put','/:id','update','delete','removeQueues','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./team.controller','get','index','isAuthenticated'];(function(_0x5a6cef,_0x1697df){var _0x37f76f=function(_0x17dc71){while(--_0x17dc71){_0x5a6cef['push'](_0x5a6cef['shift']());}};_0x37f76f(++_0x1697df);}(_0xaf86,0x8b));var _0x6af8=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0xaf86[_0x2b9b7f];return _0x4ed19a;};'use strict';var multer=require(_0x6af8('0x0'));var util=require(_0x6af8('0x1'));var path=require(_0x6af8('0x2'));var timeout=require(_0x6af8('0x3'));var express=require(_0x6af8('0x4'));var router=express['Router']();var auth=require(_0x6af8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6af8('0x6'));var controller=require(_0x6af8('0x7'));router[_0x6af8('0x8')]('/',auth['isAuthenticated'](),controller[_0x6af8('0x9')]);router[_0x6af8('0x8')]('/:id',auth[_0x6af8('0xa')](),controller[_0x6af8('0xb')]);router[_0x6af8('0x8')](_0x6af8('0xc'),auth[_0x6af8('0xa')](),controller['getQueues']);router[_0x6af8('0x8')](_0x6af8('0xd'),auth[_0x6af8('0xa')](),controller[_0x6af8('0xe')]);router['post']('/',auth[_0x6af8('0xa')](),controller[_0x6af8('0xf')]);router[_0x6af8('0x10')](_0x6af8('0xc'),auth[_0x6af8('0xa')](),controller['addQueues']);router[_0x6af8('0x10')]('/:id/users',auth[_0x6af8('0xa')](),controller[_0x6af8('0x11')]);router[_0x6af8('0x12')](_0x6af8('0x13'),auth['isAuthenticated'](),controller[_0x6af8('0x14')]);router[_0x6af8('0x15')](_0x6af8('0x13'),auth[_0x6af8('0xa')](),controller['destroy']);router[_0x6af8('0x15')](_0x6af8('0xc'),auth[_0x6af8('0xa')](),controller[_0x6af8('0x16')]);router[_0x6af8('0x15')](_0x6af8('0xd'),auth[_0x6af8('0xa')](),controller[_0x6af8('0x17')]);module[_0x6af8('0x18')]=router; \ No newline at end of file +var _0xd3c8=['put','/:id','destroy','delete','removeQueues','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','isAuthenticated','index','show','getQueues','/:id/users','getAgents','create','/:id/queues','addQueues','post','addAgents'];(function(_0x5a1ff0,_0x479395){var _0x20b198=function(_0x371c8a){while(--_0x371c8a){_0x5a1ff0['push'](_0x5a1ff0['shift']());}};_0x20b198(++_0x479395);}(_0xd3c8,0x180));var _0x8d3c=function(_0x1313e1,_0x11d6fd){_0x1313e1=_0x1313e1-0x0;var _0x4f152e=_0xd3c8[_0x1313e1];return _0x4f152e;};'use strict';var multer=require(_0x8d3c('0x0'));var util=require(_0x8d3c('0x1'));var path=require(_0x8d3c('0x2'));var timeout=require(_0x8d3c('0x3'));var express=require(_0x8d3c('0x4'));var router=express[_0x8d3c('0x5')]();var auth=require(_0x8d3c('0x6'));var interaction=require(_0x8d3c('0x7'));var config=require(_0x8d3c('0x8'));var controller=require(_0x8d3c('0x9'));router[_0x8d3c('0xa')]('/',auth[_0x8d3c('0xb')](),controller[_0x8d3c('0xc')]);router['get']('/:id',auth[_0x8d3c('0xb')](),controller[_0x8d3c('0xd')]);router[_0x8d3c('0xa')]('/:id/queues',auth[_0x8d3c('0xb')](),controller[_0x8d3c('0xe')]);router['get'](_0x8d3c('0xf'),auth[_0x8d3c('0xb')](),controller[_0x8d3c('0x10')]);router['post']('/',auth[_0x8d3c('0xb')](),controller[_0x8d3c('0x11')]);router['post'](_0x8d3c('0x12'),auth['isAuthenticated'](),controller[_0x8d3c('0x13')]);router[_0x8d3c('0x14')](_0x8d3c('0xf'),auth[_0x8d3c('0xb')](),controller[_0x8d3c('0x15')]);router[_0x8d3c('0x16')](_0x8d3c('0x17'),auth[_0x8d3c('0xb')](),controller['update']);router['delete'](_0x8d3c('0x17'),auth[_0x8d3c('0xb')](),controller[_0x8d3c('0x18')]);router[_0x8d3c('0x19')]('/:id/queues',auth[_0x8d3c('0xb')](),controller[_0x8d3c('0x1a')]);router[_0x8d3c('0x19')]('/:id/users',auth[_0x8d3c('0xb')](),controller[_0x8d3c('0x1b')]);module[_0x8d3c('0x1c')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index ad63b28..cd733a6 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 _0x5a64=['name','sequelize','exports','STRING'];(function(_0x2ecdbb,_0xb11c30){var _0x3e315a=function(_0x526e6c){while(--_0x526e6c){_0x2ecdbb['push'](_0x2ecdbb['shift']());}};_0x3e315a(++_0xb11c30);}(_0x5a64,0x1b1));var _0x45a6=function(_0x345df5,_0x2ecc84){_0x345df5=_0x345df5-0x0;var _0x28c96b=_0x5a64[_0x345df5];return _0x28c96b;};'use strict';var Sequelize=require(_0x45a6('0x0'));module[_0x45a6('0x1')]={'name':{'type':Sequelize[_0x45a6('0x2')],'allowNull':![],'unique':_0x45a6('0x3')},'description':{'type':Sequelize[_0x45a6('0x2')]}}; \ No newline at end of file +var _0x0690=['STRING','name','exports'];(function(_0x465b18,_0x2bc166){var _0x5d8f8d=function(_0x4d736e){while(--_0x4d736e){_0x465b18['push'](_0x465b18['shift']());}};_0x5d8f8d(++_0x2bc166);}(_0x0690,0x15b));var _0x0069=function(_0x1dda2c,_0x43b602){_0x1dda2c=_0x1dda2c-0x0;var _0x19c1af=_0x0690[_0x1dda2c];return _0x19c1af;};'use strict';var Sequelize=require('sequelize');module[_0x0069('0x0')]={'name':{'type':Sequelize[_0x0069('0x1')],'allowNull':![],'unique':_0x0069('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 75ad497..85eb2af 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 _0x05bc=['find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Teams','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','getQueues','channel','isValidChannel','Sequelize','ValidationError','Unknown\x20channel','capitalize','toLowerCase','addQueues','findOne','ids','removeQueues','Queues','Mail','Sms','Fax','Openchannel','Whatsapp','each','addAgents','Voice','User','online','voicePause','interface','UserVoiceQueueRt','format','SIP/%s','userTeam:save','removeAgents','voice','mail','fax','openchannel','isArray','emit','userTeam:remove','getAgents','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','save','update','then','error','stack','name','send','map','Team','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll'];(function(_0x5b8ff2,_0x23898c){var _0x533be2=function(_0x119b29){while(--_0x119b29){_0x5b8ff2['push'](_0x5b8ff2['shift']());}};_0x533be2(++_0x23898c);}(_0x05bc,0xae));var _0xc05b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x05bc[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc05b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc05b('0x1'));var jsonpatch=require(_0xc05b('0x2'));var rp=require('request-promise');var moment=require(_0xc05b('0x3'));var BPromise=require(_0xc05b('0x4'));var Mustache=require(_0xc05b('0x5'));var util=require(_0xc05b('0x6'));var path=require(_0xc05b('0x7'));var sox=require(_0xc05b('0x8'));var csv=require(_0xc05b('0x9'));var ejs=require(_0xc05b('0xa'));var fs=require('fs');var _=require(_0xc05b('0xb'));var squel=require(_0xc05b('0xc'));var crypto=require(_0xc05b('0xd'));var jsforce=require(_0xc05b('0xe'));var deskjs=require(_0xc05b('0xf'));var toCsv=require(_0xc05b('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc05b('0x10'));var authService=require(_0xc05b('0x11'));var qs=require(_0xc05b('0x12'));var as=require(_0xc05b('0x13'));var hardwareService=require(_0xc05b('0x14'));var logger=require(_0xc05b('0x15'))(_0xc05b('0x16'));var utils=require(_0xc05b('0x17'));var config=require(_0xc05b('0x18'));var db=require('../../mysqldb')['db'];config[_0xc05b('0x19')]=_[_0xc05b('0x1a')](config[_0xc05b('0x19')],{'host':_0xc05b('0x1b'),'port':0x18eb});var socket=require(_0xc05b('0x1c'))(new Redis(config[_0xc05b('0x19')]));require('./team.socket')[_0xc05b('0x1d')](socket);function respondWithStatusCode(_0x6b1880,_0x55ec04){_0x55ec04=_0x55ec04||0xcc;return function(_0x4d4698){if(_0x4d4698){return _0x6b1880[_0xc05b('0x1e')](_0x55ec04);}return _0x6b1880[_0xc05b('0x1f')](_0x55ec04)[_0xc05b('0x20')]();};}function respondWithResult(_0xcceda9,_0x387036){_0x387036=_0x387036||0xc8;return function(_0x21435e){if(_0x21435e){return _0xcceda9[_0xc05b('0x1f')](_0x387036)['json'](_0x21435e);}};}function respondWithFilteredResult(_0x42395b,_0x13c79f){return function(_0xee4d8){if(_0xee4d8){var _0x421cb=_0xee4d8[_0xc05b('0x21')],_0x1cba94=_0x13c79f['offset'],_0x403290=_0x13c79f[_0xc05b('0x22')]+_0x13c79f[_0xc05b('0x23')],_0x58224d;if(_0x403290>=_0x421cb){_0x403290=_0x421cb;_0x58224d=0xc8;}else{_0x58224d=0xce;}_0x42395b[_0xc05b('0x1f')](_0x58224d);return _0x42395b[_0xc05b('0x24')](_0xc05b('0x25'),_0x1cba94+'-'+_0x403290+'/'+_0x421cb)['json'](_0xee4d8);}return null;};}function patchUpdates(_0x10eb99){return function(_0x40de30){try{jsonpatch[_0xc05b('0x26')](_0x40de30,_0x10eb99,!![]);}catch(_0x311fcb){return BPromise['reject'](_0x311fcb);}return _0x40de30[_0xc05b('0x27')]();};}function saveUpdates(_0x456930,_0x2692c2){return function(_0x1edaa0){if(_0x1edaa0){return _0x1edaa0[_0xc05b('0x28')](_0x456930)[_0xc05b('0x29')](function(_0x4938d9){return _0x4938d9;});}return null;};}function removeEntity(_0x585447,_0x2699fb){return function(_0x382743){if(_0x382743){return _0x382743['destroy']()[_0xc05b('0x29')](function(){var _0x5b9e1f=_0x382743['get']({'plain':!![]});var _0x19cadd='Teams';return db['UserProfileResource']['destroy']({'where':{'type':_0x19cadd,'resourceId':_0x5b9e1f['id']}})[_0xc05b('0x29')](function(){return _0x382743;});})['then'](function(){_0x585447[_0xc05b('0x1f')](0xcc)[_0xc05b('0x20')]();});}};}function handleEntityNotFound(_0x4d1fd4,_0x337cc1){return function(_0x395baa){if(!_0x395baa){_0x4d1fd4[_0xc05b('0x1e')](0x194);}return _0x395baa;};}function handleError(_0x3e26c4,_0x23a937){_0x23a937=_0x23a937||0x1f4;return function(_0xeb6d8b){logger[_0xc05b('0x2a')](_0xeb6d8b[_0xc05b('0x2b')]);if(_0xeb6d8b[_0xc05b('0x2c')]){delete _0xeb6d8b[_0xc05b('0x2c')];}_0x3e26c4[_0xc05b('0x1f')](_0x23a937)[_0xc05b('0x2d')](_0xeb6d8b);};}exports['index']=function(_0x3ca295,_0x56cc4a){var _0x370d05={},_0x54286a={},_0x580d43={'count':0x0,'rows':[]};var _0x78333=_[_0xc05b('0x2e')](db[_0xc05b('0x2f')]['rawAttributes'],function(_0x884fcb){return{'name':_0x884fcb['fieldName'],'type':_0x884fcb['type']['key']};});_0x54286a[_0xc05b('0x30')]=_[_0xc05b('0x2e')](_0x78333,_0xc05b('0x2c'));_0x54286a['query']=_[_0xc05b('0x31')](_0x3ca295[_0xc05b('0x32')]);_0x54286a[_0xc05b('0x33')]=_[_0xc05b('0x34')](_0x54286a['model'],_0x54286a[_0xc05b('0x32')]);_0x370d05[_0xc05b('0x35')]=_[_0xc05b('0x34')](_0x54286a['model'],qs[_0xc05b('0x36')](_0x3ca295[_0xc05b('0x32')]['fields']));_0x370d05[_0xc05b('0x35')]=_0x370d05[_0xc05b('0x35')]['length']?_0x370d05['attributes']:_0x54286a[_0xc05b('0x30')];if(!_0x3ca295[_0xc05b('0x32')][_0xc05b('0x37')](_0xc05b('0x38'))){_0x370d05['limit']=qs[_0xc05b('0x23')](_0x3ca295['query'][_0xc05b('0x23')]);_0x370d05[_0xc05b('0x22')]=qs[_0xc05b('0x22')](_0x3ca295[_0xc05b('0x32')]['offset']);}_0x370d05[_0xc05b('0x39')]=qs[_0xc05b('0x3a')](_0x3ca295['query']['sort']);_0x370d05[_0xc05b('0x3b')]=qs[_0xc05b('0x33')](_[_0xc05b('0x3c')](_0x3ca295[_0xc05b('0x32')],_0x54286a[_0xc05b('0x33')]),_0x78333);if(_0x3ca295['query'][_0xc05b('0x3d')]){_0x370d05[_0xc05b('0x3b')]=_[_0xc05b('0x3e')](_0x370d05[_0xc05b('0x3b')],{'$or':_['map'](_0x78333,function(_0x58a796){if(_0x58a796[_0xc05b('0x3f')]!=='VIRTUAL'){var _0xbeeded={};_0xbeeded[_0x58a796['name']]={'$like':'%'+_0x3ca295[_0xc05b('0x32')][_0xc05b('0x3d')]+'%'};return _0xbeeded;}})});}_0x370d05=_[_0xc05b('0x3e')]({},_0x370d05,_0x3ca295[_0xc05b('0x40')]);var _0x5bf0b5={'where':_0x370d05['where']};return db[_0xc05b('0x2f')]['count'](_0x5bf0b5)[_0xc05b('0x29')](function(_0x482770){_0x580d43[_0xc05b('0x21')]=_0x482770;if(_0x3ca295[_0xc05b('0x32')]['includeAll']){_0x370d05[_0xc05b('0x41')]=[{'all':!![]}];}return db[_0xc05b('0x2f')][_0xc05b('0x42')](_0x370d05);})[_0xc05b('0x29')](function(_0x6d9709){_0x580d43[_0xc05b('0x43')]=_0x6d9709;return _0x580d43;})[_0xc05b('0x29')](respondWithFilteredResult(_0x56cc4a,_0x370d05))[_0xc05b('0x44')](handleError(_0x56cc4a,null));};exports[_0xc05b('0x45')]=function(_0x30ea24,_0x426231){var _0x4b6ef9={'raw':![],'where':{'id':_0x30ea24[_0xc05b('0x46')]['id']}},_0x122aa2={};_0x122aa2[_0xc05b('0x30')]=_['keys'](db[_0xc05b('0x2f')][_0xc05b('0x47')]);_0x122aa2[_0xc05b('0x32')]=_[_0xc05b('0x31')](_0x30ea24['query']);_0x122aa2[_0xc05b('0x33')]=_[_0xc05b('0x34')](_0x122aa2['model'],_0x122aa2[_0xc05b('0x32')]);_0x4b6ef9[_0xc05b('0x35')]=_[_0xc05b('0x34')](_0x122aa2['model'],qs[_0xc05b('0x36')](_0x30ea24[_0xc05b('0x32')][_0xc05b('0x36')]));_0x4b6ef9[_0xc05b('0x35')]=_0x4b6ef9[_0xc05b('0x35')][_0xc05b('0x48')]?_0x4b6ef9[_0xc05b('0x35')]:_0x122aa2['model'];if(_0x30ea24[_0xc05b('0x32')][_0xc05b('0x49')]){_0x4b6ef9[_0xc05b('0x41')]=[{'all':!![]}];}_0x4b6ef9=_[_0xc05b('0x3e')]({},_0x4b6ef9,_0x30ea24[_0xc05b('0x40')]);return db['Team'][_0xc05b('0x4a')](_0x4b6ef9)[_0xc05b('0x29')](handleEntityNotFound(_0x426231,null))[_0xc05b('0x29')](respondWithResult(_0x426231,null))[_0xc05b('0x44')](handleError(_0x426231,null));};exports[_0xc05b('0x4b')]=function(_0x45467,_0xe7e2a3){return db['Team'][_0xc05b('0x4b')](_0x45467[_0xc05b('0x4c')],{})[_0xc05b('0x29')](function(_0x227a4f){var _0x3a0f9d=_0x45467[_0xc05b('0x4d')]['get']({'plain':!![]});if(!_0x3a0f9d)throw new Error(_0xc05b('0x4e'));if(_0x3a0f9d[_0xc05b('0x4f')]==='user'){var _0xc2dc13=_0x227a4f[_0xc05b('0x50')]({'plain':!![]});var _0x115283=_0xc05b('0x51');return db['UserProfileSection']['find']({'where':{'name':_0x115283,'userProfileId':_0x3a0f9d[_0xc05b('0x52')]},'raw':!![]})[_0xc05b('0x29')](function(_0x210adf){if(_0x210adf&&_0x210adf[_0xc05b('0x53')]===0x0){return db['UserProfileResource'][_0xc05b('0x4b')]({'name':_0xc2dc13['name'],'resourceId':_0xc2dc13['id'],'type':_0x210adf['name'],'sectionId':_0x210adf['id']},{})[_0xc05b('0x29')](function(){return _0x227a4f;});}else{return _0x227a4f;}})[_0xc05b('0x44')](function(_0x12fb0b){logger[_0xc05b('0x2a')](_0xc05b('0x54'),_0x12fb0b);throw _0x12fb0b;});}return _0x227a4f;})['then'](respondWithResult(_0xe7e2a3,0xc9))[_0xc05b('0x44')](handleError(_0xe7e2a3,null));};exports['update']=function(_0x117cb9,_0x28a670){if(_0x117cb9[_0xc05b('0x4c')]['id']){delete _0x117cb9['body']['id'];}return db[_0xc05b('0x2f')][_0xc05b('0x4a')]({'where':{'id':_0x117cb9[_0xc05b('0x46')]['id']}})[_0xc05b('0x29')](handleEntityNotFound(_0x28a670,null))[_0xc05b('0x29')](saveUpdates(_0x117cb9[_0xc05b('0x4c')],null))[_0xc05b('0x29')](respondWithResult(_0x28a670,null))['catch'](handleError(_0x28a670,null));};exports[_0xc05b('0x55')]=function(_0x12db76,_0x2d2085){return db[_0xc05b('0x2f')]['find']({'where':{'id':_0x12db76[_0xc05b('0x46')]['id']}})[_0xc05b('0x29')](handleEntityNotFound(_0x2d2085,null))['then'](removeEntity(_0x2d2085,null))[_0xc05b('0x44')](handleError(_0x2d2085,null));};exports[_0xc05b('0x56')]=function(_0x36810e,_0x1c01fe,_0x506db6){return db[_0xc05b('0x2f')]['findOne']({'where':{'id':_0x36810e['params']['id']}})[_0xc05b('0x29')](handleEntityNotFound(_0x1c01fe,null))['then'](function(_0x297ca9){if(!_0x36810e[_0xc05b('0x32')][_0xc05b('0x57')]||!utils[_0xc05b('0x58')](_0x36810e[_0xc05b('0x32')][_0xc05b('0x57')])){throw new db[(_0xc05b('0x59'))][(_0xc05b('0x5a'))](_0xc05b('0x5b'));}var _0x211c90={};var _0x147444={};_0x147444[_0xc05b('0x30')]=_[_0xc05b('0x31')](db[_[_0xc05b('0x5c')](_0x36810e['query'][_0xc05b('0x57')][_0xc05b('0x5d')]())+'Queue']['rawAttributes']);_0x147444[_0xc05b('0x32')]=_[_0xc05b('0x31')](_0x36810e[_0xc05b('0x32')]);_0x147444[_0xc05b('0x33')]=_[_0xc05b('0x34')](_0x147444[_0xc05b('0x30')],_0x147444[_0xc05b('0x32')]);_0x211c90[_0xc05b('0x35')]=_[_0xc05b('0x34')](_0x147444[_0xc05b('0x30')],qs[_0xc05b('0x36')](_0x36810e[_0xc05b('0x32')][_0xc05b('0x36')]));_0x211c90[_0xc05b('0x35')]=_0x211c90[_0xc05b('0x35')]['length']?_0x211c90[_0xc05b('0x35')]:_0x147444[_0xc05b('0x30')];_0x211c90[_0xc05b('0x23')]=qs[_0xc05b('0x23')](_0x36810e[_0xc05b('0x32')][_0xc05b('0x23')]);_0x211c90['offset']=qs[_0xc05b('0x22')](_0x36810e['query'][_0xc05b('0x22')]);_0x211c90[_0xc05b('0x39')]=qs[_0xc05b('0x3a')](_0x36810e[_0xc05b('0x32')][_0xc05b('0x3a')]);_0x211c90[_0xc05b('0x3b')]=qs[_0xc05b('0x33')](_[_0xc05b('0x3c')](_0x36810e[_0xc05b('0x32')],_0x147444['filters']));_0x211c90=_[_0xc05b('0x3e')]({},_0x211c90,_0x36810e[_0xc05b('0x40')]);return _0x297ca9[_0xc05b('0x50')+_[_0xc05b('0x5c')](_0x36810e[_0xc05b('0x32')][_0xc05b('0x57')][_0xc05b('0x5d')]())+'Queues'](_0x211c90);})[_0xc05b('0x29')](respondWithResult(_0x1c01fe,null))[_0xc05b('0x44')](handleError(_0x1c01fe,null));};exports[_0xc05b('0x5e')]=function(_0xe2ba4c,_0x2efc30,_0xd25cb3){return db['Team'][_0xc05b('0x5f')]({'where':{'id':_0xe2ba4c[_0xc05b('0x46')]['id']}})[_0xc05b('0x29')](function(_0x1a0600){if(_0x1a0600){if(!_0xe2ba4c['body']['channel']||!utils[_0xc05b('0x58')](_0xe2ba4c[_0xc05b('0x4c')][_0xc05b('0x57')])){throw new db[(_0xc05b('0x59'))][(_0xc05b('0x5a'))]('Unknown\x20channel');}return _0x1a0600['add'+_[_0xc05b('0x5c')](_0xe2ba4c[_0xc05b('0x4c')][_0xc05b('0x57')][_0xc05b('0x5d')]())+'Queues'](_0xe2ba4c[_0xc05b('0x4c')][_0xc05b('0x60')]);}return null;})['then'](handleEntityNotFound(_0x2efc30,null))[_0xc05b('0x29')](respondWithStatusCode(_0x2efc30,null))[_0xc05b('0x44')](handleError(_0x2efc30,null));};exports[_0xc05b('0x61')]=function(_0x2446b8,_0x423685,_0x5c2895){return db[_0xc05b('0x2f')][_0xc05b('0x5f')]({'where':{'id':_0x2446b8[_0xc05b('0x46')]['id']}})[_0xc05b('0x29')](function(_0x5e1df8){if(_0x5e1df8){if(!_0x2446b8['query'][_0xc05b('0x57')]||!utils[_0xc05b('0x58')](_0x2446b8[_0xc05b('0x32')][_0xc05b('0x57')])){throw new db[(_0xc05b('0x59'))][(_0xc05b('0x5a'))](_0xc05b('0x5b'));}return _0x5e1df8['remove'+_[_0xc05b('0x5c')](_0x2446b8['query']['channel'][_0xc05b('0x5d')]())+_0xc05b('0x62')](_0x2446b8[_0xc05b('0x32')]['ids']);}return null;})[_0xc05b('0x29')](handleEntityNotFound(_0x423685,null))[_0xc05b('0x29')](respondWithStatusCode(_0x423685,null))[_0xc05b('0x44')](handleError(_0x423685,null));};exports['addAgents']=function(_0x2aaf45,_0x1abe24,_0x5c77b6){return db[_0xc05b('0x2f')]['find']({'where':{'id':_0x2aaf45[_0xc05b('0x46')]['id']}})[_0xc05b('0x29')](handleEntityNotFound(_0x1abe24,null))[_0xc05b('0x29')](function(_0x1b2acc){if(_0x1b2acc){var _0x5dd1c2=['Voice','Chat',_0xc05b('0x63'),_0xc05b('0x64'),_0xc05b('0x65'),_0xc05b('0x66'),_0xc05b('0x67')];return BPromise['each'](_0x5dd1c2,function(_0x200daa){return _0x1b2acc[_0xc05b('0x50')+_0x200daa+_0xc05b('0x62')]({'attributes':['id',_0xc05b('0x2c')]})[_0xc05b('0x29')](function(_0xc3b2cc){return BPromise[_0xc05b('0x68')](_0xc3b2cc,function(_0x1a2ec2){return _0x1a2ec2[_0xc05b('0x69')](_0x2aaf45[_0xc05b('0x4c')][_0xc05b('0x60')])[_0xc05b('0x29')](function(){if(_0x200daa===_0xc05b('0x6a')){return db[_0xc05b('0x6b')]['findAll']({'where':{'id':_0x2aaf45[_0xc05b('0x4c')][_0xc05b('0x60')]},'attributes':['id',_0xc05b('0x2c'),_0xc05b('0x6c'),_0xc05b('0x6d'),_0xc05b('0x6e')],'raw':!![]})['then'](function(_0x5df82e){return BPromise[_0xc05b('0x68')](_[_0xc05b('0x3d')](_0x5df82e,{'online':0x1}),function(_0x249478){return db[_0xc05b('0x6f')]['upsert']({'membername':_0x249478[_0xc05b('0x2c')],'UserId':_0x249478['id'],'queue_name':_0x1a2ec2[_0xc05b('0x2c')],'VoiceQueueId':_0x1a2ec2['id'],'interface':_['isNil'](_0x249478[_0xc05b('0x6e')])?util[_0xc05b('0x70')](_0xc05b('0x71'),_0x249478[_0xc05b('0x2c')]):_0x249478[_0xc05b('0x6e')],'paused':_0x249478['voicePause']||![],'penalty':0x0});});});}});});})['then'](function(){return _0x1b2acc;});})[_0xc05b('0x29')](function(){return _0x1b2acc;});}})[_0xc05b('0x29')](function(_0x54c731){if(_0x54c731){return _0x54c731['addAgents'](_0x2aaf45[_0xc05b('0x4c')]['ids'],_['omit'](_0x2aaf45['body'],['ids','id'])||{})['spread'](function(_0x37a2a5){for(var _0x50244d=0x0;_0x50244d<_0x2aaf45['body']['ids'][_0xc05b('0x48')];_0x50244d+=0x1){socket['emit'](_0xc05b('0x72'),{'UserId':_0x2aaf45[_0xc05b('0x4c')][_0xc05b('0x60')][_0x50244d],'TeamId':_0x2aaf45['params']['id']});}return _0x37a2a5;});}})[_0xc05b('0x29')](respondWithResult(_0x1abe24,null))[_0xc05b('0x44')](handleError(_0x1abe24,null));};exports[_0xc05b('0x73')]=function(_0xe40d91,_0x137ade,_0x939122){return db['Team'][_0xc05b('0x4a')]({'where':{'id':_0xe40d91['params']['id']}})[_0xc05b('0x29')](handleEntityNotFound(_0x137ade,null))['then'](function(_0x3285d3){if(_0x3285d3){return BPromise[_0xc05b('0x68')]([_0xc05b('0x74'),'chat',_0xc05b('0x75'),'sms',_0xc05b('0x76'),_0xc05b('0x77'),'whatsapp'],function(_0x56c855){return _0x3285d3[_0xc05b('0x50')+_[_0xc05b('0x5c')](_0x56c855)+_0xc05b('0x62')]({'attributes':['id',_0xc05b('0x2c')]})[_0xc05b('0x29')](function(_0x1bd6c2){return BPromise[_0xc05b('0x68')](_0x1bd6c2,function(_0x20f19a){return _0x20f19a['removeAgents'](_0xe40d91[_0xc05b('0x32')]['ids'])[_0xc05b('0x29')](function(){if(_0x56c855==='voice'){return db[_0xc05b('0x6f')][_0xc05b('0x55')]({'where':{'VoiceQueueId':_0x20f19a['id'],'UserId':_0xe40d91[_0xc05b('0x32')][_0xc05b('0x60')]}});}});});})[_0xc05b('0x29')](function(){return _0x3285d3;});})[_0xc05b('0x29')](function(){return _0x3285d3;});}})[_0xc05b('0x29')](function(_0x16875f){if(_0x16875f){return _0x16875f['removeAgents'](_0xe40d91[_0xc05b('0x32')][_0xc05b('0x60')])[_0xc05b('0x29')](function(){if(_[_0xc05b('0x78')](_0xe40d91[_0xc05b('0x32')][_0xc05b('0x60')])){for(var _0x4300da=0x0;_0x4300da<_0xe40d91[_0xc05b('0x32')][_0xc05b('0x60')]['length'];_0x4300da+=0x1){socket[_0xc05b('0x79')](_0xc05b('0x7a'),{'UserId':Number(_0xe40d91[_0xc05b('0x32')][_0xc05b('0x60')][_0x4300da]),'TeamId':Number(_0xe40d91[_0xc05b('0x46')]['id'])});}}else{socket['emit']('userTeam:remove',{'UserId':Number(_0xe40d91['query'][_0xc05b('0x60')]),'TeamId':Number(_0xe40d91[_0xc05b('0x46')]['id'])});}});}})[_0xc05b('0x29')](respondWithStatusCode(_0x137ade,null))[_0xc05b('0x44')](handleError(_0x137ade,null));};exports[_0xc05b('0x7b')]=function(_0x20cbb9,_0x179335,_0x2ac375){var _0x4818d2={};var _0x517846={};var _0x4bdb5c;var _0x4ca728;return db[_0xc05b('0x2f')]['findOne']({'where':{'id':_0x20cbb9[_0xc05b('0x46')]['id']}})[_0xc05b('0x29')](handleEntityNotFound(_0x179335,null))[_0xc05b('0x29')](function(_0x1e7dfa){if(_0x1e7dfa){_0x4bdb5c=_0x1e7dfa;_0x517846[_0xc05b('0x30')]=_[_0xc05b('0x31')](db[_0xc05b('0x6b')][_0xc05b('0x47')]);_0x517846['query']=_[_0xc05b('0x31')](_0x20cbb9[_0xc05b('0x32')]);_0x517846[_0xc05b('0x33')]=_[_0xc05b('0x34')](_0x517846[_0xc05b('0x30')],_0x517846['query']);_0x4818d2[_0xc05b('0x35')]=_[_0xc05b('0x34')](_0x517846[_0xc05b('0x30')],qs['fields'](_0x20cbb9[_0xc05b('0x32')][_0xc05b('0x36')]));_0x4818d2[_0xc05b('0x35')]=_0x4818d2[_0xc05b('0x35')]['length']?_0x4818d2[_0xc05b('0x35')]:_0x517846['model'];_0x4818d2[_0xc05b('0x39')]=qs['sort'](_0x20cbb9[_0xc05b('0x32')]['sort']);_0x4818d2[_0xc05b('0x3b')]=qs[_0xc05b('0x33')](_[_0xc05b('0x3c')](_0x20cbb9[_0xc05b('0x32')],_0x517846[_0xc05b('0x33')]));if(_0x20cbb9[_0xc05b('0x32')]['filter']){_0x4818d2[_0xc05b('0x3b')]=_['merge'](_0x4818d2[_0xc05b('0x3b')],{'$or':_[_0xc05b('0x2e')](_0x4818d2[_0xc05b('0x35')],function(_0x4d6659){var _0x36f32b={};_0x36f32b[_0x4d6659]={'$like':'%'+_0x20cbb9[_0xc05b('0x32')][_0xc05b('0x3d')]+'%'};return _0x36f32b;})});}_0x4818d2=_[_0xc05b('0x3e')]({},_0x4818d2,_0x20cbb9[_0xc05b('0x40')]);return _0x4bdb5c[_0xc05b('0x7b')](_0x4818d2);}})[_0xc05b('0x29')](function(_0x2a022f){if(_0x2a022f){_0x4ca728=_0x2a022f[_0xc05b('0x48')];if(!_0x20cbb9[_0xc05b('0x32')]['hasOwnProperty'](_0xc05b('0x38'))){_0x4818d2[_0xc05b('0x23')]=qs[_0xc05b('0x23')](_0x20cbb9[_0xc05b('0x32')][_0xc05b('0x23')]);_0x4818d2[_0xc05b('0x22')]=qs['offset'](_0x20cbb9[_0xc05b('0x32')][_0xc05b('0x22')]);}return _0x4bdb5c[_0xc05b('0x7b')](_0x4818d2);}})[_0xc05b('0x29')](function(_0x258ad0){if(_0x258ad0){return _0x258ad0?{'count':_0x4ca728,'rows':_0x258ad0}:null;}})[_0xc05b('0x29')](respondWithResult(_0x179335,null))['catch'](handleError(_0x179335,null));}; \ No newline at end of file +var _0xd2d9=['offset','status','set','Content-Range','reject','save','update','destroy','then','UserProfileResource','sendStatus','error','stack','name','index','map','Team','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Teams','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','channel','Sequelize','ValidationError','capitalize','toLowerCase','Queue','order','addQueues','isValidChannel','Unknown\x20channel','add','Queues','ids','removeQueues','remove','addAgents','Voice','Chat','Mail','Sms','Whatsapp','each','User','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','omit','spread','emit','userTeam:save','removeAgents','voice','chat','mail','fax','openchannel','whatsapp','userTeam:remove','getAgents','html-pdf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','end','json'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd2d9,0x16c));var _0x9d2d=function(_0x4c9f6a,_0xcb2cb2){_0x4c9f6a=_0x4c9f6a-0x0;var _0x5df5b9=_0xd2d9[_0x4c9f6a];return _0x5df5b9;};'use strict';var pdf=require(_0x9d2d('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9d2d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9d2d('0x2'));var moment=require(_0x9d2d('0x3'));var BPromise=require(_0x9d2d('0x4'));var Mustache=require(_0x9d2d('0x5'));var util=require(_0x9d2d('0x6'));var path=require(_0x9d2d('0x7'));var sox=require(_0x9d2d('0x8'));var csv=require(_0x9d2d('0x9'));var ejs=require(_0x9d2d('0xa'));var fs=require('fs');var _=require(_0x9d2d('0xb'));var squel=require(_0x9d2d('0xc'));var crypto=require(_0x9d2d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9d2d('0xe'));var toCsv=require(_0x9d2d('0x9'));var querystring=require(_0x9d2d('0xf'));var Papa=require('papaparse');var Redis=require(_0x9d2d('0x10'));var authService=require(_0x9d2d('0x11'));var qs=require(_0x9d2d('0x12'));var as=require(_0x9d2d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9d2d('0x14'))(_0x9d2d('0x15'));var utils=require('../../config/utils');var config=require(_0x9d2d('0x16'));var db=require(_0x9d2d('0x17'))['db'];config[_0x9d2d('0x18')]=_[_0x9d2d('0x19')](config['redis'],{'host':_0x9d2d('0x1a'),'port':0x18eb});var socket=require(_0x9d2d('0x1b'))(new Redis(config[_0x9d2d('0x18')]));require(_0x9d2d('0x1c'))[_0x9d2d('0x1d')](socket);function respondWithStatusCode(_0xd3744,_0x4acdb9){_0x4acdb9=_0x4acdb9||0xcc;return function(_0x548dc7){if(_0x548dc7){return _0xd3744['sendStatus'](_0x4acdb9);}return _0xd3744['status'](_0x4acdb9)[_0x9d2d('0x1e')]();};}function respondWithResult(_0x4fd8e9,_0x451e5c){_0x451e5c=_0x451e5c||0xc8;return function(_0x1d5666){if(_0x1d5666){return _0x4fd8e9['status'](_0x451e5c)[_0x9d2d('0x1f')](_0x1d5666);}};}function respondWithFilteredResult(_0x5335fe,_0x5c11dc){return function(_0x1768a9){if(_0x1768a9){var _0x3686d9=_0x1768a9['count'],_0x5ab68a=_0x5c11dc[_0x9d2d('0x20')],_0x196586=_0x5c11dc[_0x9d2d('0x20')]+_0x5c11dc['limit'],_0x53ea08;if(_0x196586>=_0x3686d9){_0x196586=_0x3686d9;_0x53ea08=0xc8;}else{_0x53ea08=0xce;}_0x5335fe[_0x9d2d('0x21')](_0x53ea08);return _0x5335fe[_0x9d2d('0x22')](_0x9d2d('0x23'),_0x5ab68a+'-'+_0x196586+'/'+_0x3686d9)['json'](_0x1768a9);}return null;};}function patchUpdates(_0x560a3a){return function(_0x238a98){try{jsonpatch['apply'](_0x238a98,_0x560a3a,!![]);}catch(_0x7a7afc){return BPromise[_0x9d2d('0x24')](_0x7a7afc);}return _0x238a98[_0x9d2d('0x25')]();};}function saveUpdates(_0xeaf613,_0x418ff6){return function(_0x36839f){if(_0x36839f){return _0x36839f[_0x9d2d('0x26')](_0xeaf613)['then'](function(_0x27d5a6){return _0x27d5a6;});}return null;};}function removeEntity(_0x745d72,_0x384a0b){return function(_0x2c3531){if(_0x2c3531){return _0x2c3531[_0x9d2d('0x27')]()[_0x9d2d('0x28')](function(){var _0xca2c20=_0x2c3531['get']({'plain':!![]});var _0x4854b9='Teams';return db[_0x9d2d('0x29')][_0x9d2d('0x27')]({'where':{'type':_0x4854b9,'resourceId':_0xca2c20['id']}})[_0x9d2d('0x28')](function(){return _0x2c3531;});})[_0x9d2d('0x28')](function(){_0x745d72['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x226cd6,_0x4870dc){return function(_0x5d6594){if(!_0x5d6594){_0x226cd6[_0x9d2d('0x2a')](0x194);}return _0x5d6594;};}function handleError(_0x7ab38f,_0x86970d){_0x86970d=_0x86970d||0x1f4;return function(_0x423113){logger[_0x9d2d('0x2b')](_0x423113[_0x9d2d('0x2c')]);if(_0x423113['name']){delete _0x423113[_0x9d2d('0x2d')];}_0x7ab38f[_0x9d2d('0x21')](_0x86970d)['send'](_0x423113);};}exports[_0x9d2d('0x2e')]=function(_0x4cdc4c,_0x3b7d49){var _0x1ee332={},_0x5cd10b={},_0x3dfdad={'count':0x0,'rows':[]};var _0x7c2524=_[_0x9d2d('0x2f')](db[_0x9d2d('0x30')][_0x9d2d('0x31')],function(_0x217ab6){return{'name':_0x217ab6['fieldName'],'type':_0x217ab6[_0x9d2d('0x32')][_0x9d2d('0x33')]};});_0x5cd10b['model']=_[_0x9d2d('0x2f')](_0x7c2524,_0x9d2d('0x2d'));_0x5cd10b['query']=_[_0x9d2d('0x34')](_0x4cdc4c[_0x9d2d('0x35')]);_0x5cd10b[_0x9d2d('0x36')]=_[_0x9d2d('0x37')](_0x5cd10b[_0x9d2d('0x38')],_0x5cd10b['query']);_0x1ee332[_0x9d2d('0x39')]=_[_0x9d2d('0x37')](_0x5cd10b['model'],qs[_0x9d2d('0x3a')](_0x4cdc4c[_0x9d2d('0x35')][_0x9d2d('0x3a')]));_0x1ee332['attributes']=_0x1ee332['attributes'][_0x9d2d('0x3b')]?_0x1ee332[_0x9d2d('0x39')]:_0x5cd10b[_0x9d2d('0x38')];if(!_0x4cdc4c[_0x9d2d('0x35')][_0x9d2d('0x3c')](_0x9d2d('0x3d'))){_0x1ee332[_0x9d2d('0x3e')]=qs[_0x9d2d('0x3e')](_0x4cdc4c[_0x9d2d('0x35')][_0x9d2d('0x3e')]);_0x1ee332[_0x9d2d('0x20')]=qs[_0x9d2d('0x20')](_0x4cdc4c[_0x9d2d('0x35')]['offset']);}_0x1ee332['order']=qs[_0x9d2d('0x3f')](_0x4cdc4c[_0x9d2d('0x35')][_0x9d2d('0x3f')]);_0x1ee332[_0x9d2d('0x40')]=qs['filters'](_[_0x9d2d('0x41')](_0x4cdc4c['query'],_0x5cd10b[_0x9d2d('0x36')]),_0x7c2524);if(_0x4cdc4c['query'][_0x9d2d('0x42')]){_0x1ee332[_0x9d2d('0x40')]=_[_0x9d2d('0x43')](_0x1ee332['where'],{'$or':_[_0x9d2d('0x2f')](_0x7c2524,function(_0x3713d1){if(_0x3713d1[_0x9d2d('0x32')]!==_0x9d2d('0x44')){var _0x4250b4={};_0x4250b4[_0x3713d1[_0x9d2d('0x2d')]]={'$like':'%'+_0x4cdc4c['query']['filter']+'%'};return _0x4250b4;}})});}_0x1ee332=_['merge']({},_0x1ee332,_0x4cdc4c[_0x9d2d('0x45')]);var _0x11f45f={'where':_0x1ee332['where']};return db[_0x9d2d('0x30')][_0x9d2d('0x46')](_0x11f45f)[_0x9d2d('0x28')](function(_0x1e6888){_0x3dfdad[_0x9d2d('0x46')]=_0x1e6888;if(_0x4cdc4c['query'][_0x9d2d('0x47')]){_0x1ee332[_0x9d2d('0x48')]=[{'all':!![]}];}return db[_0x9d2d('0x30')][_0x9d2d('0x49')](_0x1ee332);})[_0x9d2d('0x28')](function(_0x2a49a2){_0x3dfdad[_0x9d2d('0x4a')]=_0x2a49a2;return _0x3dfdad;})[_0x9d2d('0x28')](respondWithFilteredResult(_0x3b7d49,_0x1ee332))['catch'](handleError(_0x3b7d49,null));};exports[_0x9d2d('0x4b')]=function(_0x18fadb,_0x22a6b0){var _0x4b4cd8={'raw':![],'where':{'id':_0x18fadb[_0x9d2d('0x4c')]['id']}},_0x471ad2={};_0x471ad2[_0x9d2d('0x38')]=_[_0x9d2d('0x34')](db[_0x9d2d('0x30')][_0x9d2d('0x31')]);_0x471ad2['query']=_['keys'](_0x18fadb[_0x9d2d('0x35')]);_0x471ad2[_0x9d2d('0x36')]=_['intersection'](_0x471ad2[_0x9d2d('0x38')],_0x471ad2[_0x9d2d('0x35')]);_0x4b4cd8[_0x9d2d('0x39')]=_[_0x9d2d('0x37')](_0x471ad2[_0x9d2d('0x38')],qs['fields'](_0x18fadb[_0x9d2d('0x35')][_0x9d2d('0x3a')]));_0x4b4cd8[_0x9d2d('0x39')]=_0x4b4cd8[_0x9d2d('0x39')][_0x9d2d('0x3b')]?_0x4b4cd8[_0x9d2d('0x39')]:_0x471ad2[_0x9d2d('0x38')];if(_0x18fadb[_0x9d2d('0x35')][_0x9d2d('0x47')]){_0x4b4cd8[_0x9d2d('0x48')]=[{'all':!![]}];}_0x4b4cd8=_[_0x9d2d('0x43')]({},_0x4b4cd8,_0x18fadb[_0x9d2d('0x45')]);return db[_0x9d2d('0x30')]['find'](_0x4b4cd8)[_0x9d2d('0x28')](handleEntityNotFound(_0x22a6b0,null))['then'](respondWithResult(_0x22a6b0,null))[_0x9d2d('0x4d')](handleError(_0x22a6b0,null));};exports[_0x9d2d('0x4e')]=function(_0x4299cb,_0x241f1c){return db['Team']['create'](_0x4299cb[_0x9d2d('0x4f')],{})[_0x9d2d('0x28')](function(_0x42e9f0){var _0x36f50d=_0x4299cb['user'][_0x9d2d('0x50')]({'plain':!![]});if(!_0x36f50d)throw new Error(_0x9d2d('0x51'));if(_0x36f50d['role']===_0x9d2d('0x52')){var _0x391184=_0x42e9f0[_0x9d2d('0x50')]({'plain':!![]});var _0x5c785b=_0x9d2d('0x53');return db[_0x9d2d('0x54')][_0x9d2d('0x55')]({'where':{'name':_0x5c785b,'userProfileId':_0x36f50d[_0x9d2d('0x56')]},'raw':!![]})[_0x9d2d('0x28')](function(_0x1bdeed){if(_0x1bdeed&&_0x1bdeed[_0x9d2d('0x57')]===0x0){return db[_0x9d2d('0x29')][_0x9d2d('0x4e')]({'name':_0x391184['name'],'resourceId':_0x391184['id'],'type':_0x1bdeed[_0x9d2d('0x2d')],'sectionId':_0x1bdeed['id']},{})[_0x9d2d('0x28')](function(){return _0x42e9f0;});}else{return _0x42e9f0;}})[_0x9d2d('0x4d')](function(_0x4d9aae){logger[_0x9d2d('0x2b')](_0x9d2d('0x58'),_0x4d9aae);throw _0x4d9aae;});}return _0x42e9f0;})[_0x9d2d('0x28')](respondWithResult(_0x241f1c,0xc9))['catch'](handleError(_0x241f1c,null));};exports['update']=function(_0x3c5bb3,_0x1b7168){if(_0x3c5bb3[_0x9d2d('0x4f')]['id']){delete _0x3c5bb3['body']['id'];}return db[_0x9d2d('0x30')][_0x9d2d('0x55')]({'where':{'id':_0x3c5bb3['params']['id']}})[_0x9d2d('0x28')](handleEntityNotFound(_0x1b7168,null))[_0x9d2d('0x28')](saveUpdates(_0x3c5bb3['body'],null))[_0x9d2d('0x28')](respondWithResult(_0x1b7168,null))[_0x9d2d('0x4d')](handleError(_0x1b7168,null));};exports[_0x9d2d('0x27')]=function(_0x36d35c,_0x2f5ac4){return db[_0x9d2d('0x30')][_0x9d2d('0x55')]({'where':{'id':_0x36d35c['params']['id']}})['then'](handleEntityNotFound(_0x2f5ac4,null))[_0x9d2d('0x28')](removeEntity(_0x2f5ac4,null))[_0x9d2d('0x4d')](handleError(_0x2f5ac4,null));};exports['getQueues']=function(_0x580345,_0x3062ec,_0x46921a){return db[_0x9d2d('0x30')][_0x9d2d('0x59')]({'where':{'id':_0x580345['params']['id']}})[_0x9d2d('0x28')](handleEntityNotFound(_0x3062ec,null))[_0x9d2d('0x28')](function(_0x55483e){if(!_0x580345[_0x9d2d('0x35')]['channel']||!utils['isValidChannel'](_0x580345['query'][_0x9d2d('0x5a')])){throw new db[(_0x9d2d('0x5b'))][(_0x9d2d('0x5c'))]('Unknown\x20channel');}var _0x175bdd={};var _0x33cb36={};_0x33cb36[_0x9d2d('0x38')]=_[_0x9d2d('0x34')](db[_[_0x9d2d('0x5d')](_0x580345[_0x9d2d('0x35')][_0x9d2d('0x5a')][_0x9d2d('0x5e')]())+_0x9d2d('0x5f')][_0x9d2d('0x31')]);_0x33cb36[_0x9d2d('0x35')]=_[_0x9d2d('0x34')](_0x580345[_0x9d2d('0x35')]);_0x33cb36[_0x9d2d('0x36')]=_['intersection'](_0x33cb36[_0x9d2d('0x38')],_0x33cb36['query']);_0x175bdd['attributes']=_['intersection'](_0x33cb36['model'],qs[_0x9d2d('0x3a')](_0x580345[_0x9d2d('0x35')][_0x9d2d('0x3a')]));_0x175bdd[_0x9d2d('0x39')]=_0x175bdd[_0x9d2d('0x39')][_0x9d2d('0x3b')]?_0x175bdd[_0x9d2d('0x39')]:_0x33cb36['model'];_0x175bdd['limit']=qs['limit'](_0x580345[_0x9d2d('0x35')]['limit']);_0x175bdd[_0x9d2d('0x20')]=qs[_0x9d2d('0x20')](_0x580345['query']['offset']);_0x175bdd[_0x9d2d('0x60')]=qs['sort'](_0x580345[_0x9d2d('0x35')]['sort']);_0x175bdd[_0x9d2d('0x40')]=qs[_0x9d2d('0x36')](_[_0x9d2d('0x41')](_0x580345[_0x9d2d('0x35')],_0x33cb36[_0x9d2d('0x36')]));_0x175bdd=_[_0x9d2d('0x43')]({},_0x175bdd,_0x580345[_0x9d2d('0x45')]);return _0x55483e['get'+_[_0x9d2d('0x5d')](_0x580345[_0x9d2d('0x35')]['channel'][_0x9d2d('0x5e')]())+'Queues'](_0x175bdd);})['then'](respondWithResult(_0x3062ec,null))[_0x9d2d('0x4d')](handleError(_0x3062ec,null));};exports[_0x9d2d('0x61')]=function(_0x8df565,_0x5bcf3d,_0x1f8002){return db[_0x9d2d('0x30')][_0x9d2d('0x59')]({'where':{'id':_0x8df565[_0x9d2d('0x4c')]['id']}})[_0x9d2d('0x28')](function(_0xba14bb){if(_0xba14bb){if(!_0x8df565['body'][_0x9d2d('0x5a')]||!utils[_0x9d2d('0x62')](_0x8df565[_0x9d2d('0x4f')][_0x9d2d('0x5a')])){throw new db[(_0x9d2d('0x5b'))]['ValidationError'](_0x9d2d('0x63'));}return _0xba14bb[_0x9d2d('0x64')+_[_0x9d2d('0x5d')](_0x8df565[_0x9d2d('0x4f')][_0x9d2d('0x5a')]['toLowerCase']())+_0x9d2d('0x65')](_0x8df565[_0x9d2d('0x4f')][_0x9d2d('0x66')]);}return null;})[_0x9d2d('0x28')](handleEntityNotFound(_0x5bcf3d,null))['then'](respondWithStatusCode(_0x5bcf3d,null))[_0x9d2d('0x4d')](handleError(_0x5bcf3d,null));};exports[_0x9d2d('0x67')]=function(_0xb1043,_0x1d2375,_0x28d4c8){return db[_0x9d2d('0x30')][_0x9d2d('0x59')]({'where':{'id':_0xb1043[_0x9d2d('0x4c')]['id']}})['then'](function(_0x2a21fc){if(_0x2a21fc){if(!_0xb1043[_0x9d2d('0x35')]['channel']||!utils['isValidChannel'](_0xb1043['query'][_0x9d2d('0x5a')])){throw new db[(_0x9d2d('0x5b'))][(_0x9d2d('0x5c'))](_0x9d2d('0x63'));}return _0x2a21fc[_0x9d2d('0x68')+_['capitalize'](_0xb1043[_0x9d2d('0x35')][_0x9d2d('0x5a')][_0x9d2d('0x5e')]())+'Queues'](_0xb1043[_0x9d2d('0x35')][_0x9d2d('0x66')]);}return null;})[_0x9d2d('0x28')](handleEntityNotFound(_0x1d2375,null))[_0x9d2d('0x28')](respondWithStatusCode(_0x1d2375,null))[_0x9d2d('0x4d')](handleError(_0x1d2375,null));};exports[_0x9d2d('0x69')]=function(_0x42323e,_0x4d8cd2,_0x50515e){return db['Team'][_0x9d2d('0x55')]({'where':{'id':_0x42323e[_0x9d2d('0x4c')]['id']}})[_0x9d2d('0x28')](handleEntityNotFound(_0x4d8cd2,null))['then'](function(_0x1d71f7){if(_0x1d71f7){var _0x1a0cbe=[_0x9d2d('0x6a'),_0x9d2d('0x6b'),_0x9d2d('0x6c'),_0x9d2d('0x6d'),'Fax','Openchannel',_0x9d2d('0x6e')];return BPromise[_0x9d2d('0x6f')](_0x1a0cbe,function(_0x2496a5){return _0x1d71f7[_0x9d2d('0x50')+_0x2496a5+'Queues']({'attributes':['id',_0x9d2d('0x2d')]})[_0x9d2d('0x28')](function(_0x3b694e){return BPromise['each'](_0x3b694e,function(_0x52f039){return _0x52f039['addAgents'](_0x42323e[_0x9d2d('0x4f')][_0x9d2d('0x66')])[_0x9d2d('0x28')](function(){if(_0x2496a5===_0x9d2d('0x6a')){return db[_0x9d2d('0x70')][_0x9d2d('0x49')]({'where':{'id':_0x42323e[_0x9d2d('0x4f')][_0x9d2d('0x66')]},'attributes':['id','name',_0x9d2d('0x71'),_0x9d2d('0x72'),_0x9d2d('0x73')],'raw':!![]})['then'](function(_0x409086){return BPromise[_0x9d2d('0x6f')](_[_0x9d2d('0x42')](_0x409086,{'online':0x1}),function(_0x18c82b){return db[_0x9d2d('0x74')][_0x9d2d('0x75')]({'membername':_0x18c82b[_0x9d2d('0x2d')],'UserId':_0x18c82b['id'],'queue_name':_0x52f039['name'],'VoiceQueueId':_0x52f039['id'],'interface':_[_0x9d2d('0x76')](_0x18c82b[_0x9d2d('0x73')])?util['format']('SIP/%s',_0x18c82b[_0x9d2d('0x2d')]):_0x18c82b[_0x9d2d('0x73')],'paused':_0x18c82b[_0x9d2d('0x72')]||![],'penalty':0x0});});});}});});})[_0x9d2d('0x28')](function(){return _0x1d71f7;});})[_0x9d2d('0x28')](function(){return _0x1d71f7;});}})[_0x9d2d('0x28')](function(_0x550f9a){if(_0x550f9a){return _0x550f9a[_0x9d2d('0x69')](_0x42323e['body'][_0x9d2d('0x66')],_[_0x9d2d('0x77')](_0x42323e['body'],[_0x9d2d('0x66'),'id'])||{})[_0x9d2d('0x78')](function(_0x3a5f9b){for(var _0x21e658=0x0;_0x21e658<_0x42323e[_0x9d2d('0x4f')][_0x9d2d('0x66')][_0x9d2d('0x3b')];_0x21e658+=0x1){socket[_0x9d2d('0x79')](_0x9d2d('0x7a'),{'UserId':_0x42323e[_0x9d2d('0x4f')]['ids'][_0x21e658],'TeamId':_0x42323e[_0x9d2d('0x4c')]['id']});}return _0x3a5f9b;});}})['then'](respondWithResult(_0x4d8cd2,null))[_0x9d2d('0x4d')](handleError(_0x4d8cd2,null));};exports[_0x9d2d('0x7b')]=function(_0x54645b,_0x5a7575,_0x5d5fb6){return db[_0x9d2d('0x30')][_0x9d2d('0x55')]({'where':{'id':_0x54645b[_0x9d2d('0x4c')]['id']}})[_0x9d2d('0x28')](handleEntityNotFound(_0x5a7575,null))[_0x9d2d('0x28')](function(_0x37be53){if(_0x37be53){return BPromise['each']([_0x9d2d('0x7c'),_0x9d2d('0x7d'),_0x9d2d('0x7e'),'sms',_0x9d2d('0x7f'),_0x9d2d('0x80'),_0x9d2d('0x81')],function(_0x483f94){return _0x37be53[_0x9d2d('0x50')+_[_0x9d2d('0x5d')](_0x483f94)+'Queues']({'attributes':['id',_0x9d2d('0x2d')]})['then'](function(_0x381687){return BPromise[_0x9d2d('0x6f')](_0x381687,function(_0xc1ec7b){return _0xc1ec7b['removeAgents'](_0x54645b[_0x9d2d('0x35')][_0x9d2d('0x66')])[_0x9d2d('0x28')](function(){if(_0x483f94===_0x9d2d('0x7c')){return db[_0x9d2d('0x74')][_0x9d2d('0x27')]({'where':{'VoiceQueueId':_0xc1ec7b['id'],'UserId':_0x54645b['query']['ids']}});}});});})[_0x9d2d('0x28')](function(){return _0x37be53;});})[_0x9d2d('0x28')](function(){return _0x37be53;});}})[_0x9d2d('0x28')](function(_0x420e64){if(_0x420e64){return _0x420e64[_0x9d2d('0x7b')](_0x54645b[_0x9d2d('0x35')][_0x9d2d('0x66')])[_0x9d2d('0x28')](function(){if(_['isArray'](_0x54645b[_0x9d2d('0x35')][_0x9d2d('0x66')])){for(var _0x1b80d4=0x0;_0x1b80d4<_0x54645b[_0x9d2d('0x35')][_0x9d2d('0x66')]['length'];_0x1b80d4+=0x1){socket[_0x9d2d('0x79')]('userTeam:remove',{'UserId':Number(_0x54645b[_0x9d2d('0x35')][_0x9d2d('0x66')][_0x1b80d4]),'TeamId':Number(_0x54645b[_0x9d2d('0x4c')]['id'])});}}else{socket[_0x9d2d('0x79')](_0x9d2d('0x82'),{'UserId':Number(_0x54645b[_0x9d2d('0x35')][_0x9d2d('0x66')]),'TeamId':Number(_0x54645b['params']['id'])});}});}})[_0x9d2d('0x28')](respondWithStatusCode(_0x5a7575,null))[_0x9d2d('0x4d')](handleError(_0x5a7575,null));};exports[_0x9d2d('0x83')]=function(_0x1a3c3c,_0x3e03b7,_0x1a5812){var _0x2134d5={};var _0x282db9={};var _0x183a3b;var _0x2ddf0b;return db[_0x9d2d('0x30')][_0x9d2d('0x59')]({'where':{'id':_0x1a3c3c[_0x9d2d('0x4c')]['id']}})[_0x9d2d('0x28')](handleEntityNotFound(_0x3e03b7,null))[_0x9d2d('0x28')](function(_0x32ecc7){if(_0x32ecc7){_0x183a3b=_0x32ecc7;_0x282db9['model']=_[_0x9d2d('0x34')](db[_0x9d2d('0x70')][_0x9d2d('0x31')]);_0x282db9[_0x9d2d('0x35')]=_[_0x9d2d('0x34')](_0x1a3c3c[_0x9d2d('0x35')]);_0x282db9[_0x9d2d('0x36')]=_[_0x9d2d('0x37')](_0x282db9['model'],_0x282db9[_0x9d2d('0x35')]);_0x2134d5['attributes']=_[_0x9d2d('0x37')](_0x282db9['model'],qs[_0x9d2d('0x3a')](_0x1a3c3c[_0x9d2d('0x35')][_0x9d2d('0x3a')]));_0x2134d5[_0x9d2d('0x39')]=_0x2134d5[_0x9d2d('0x39')][_0x9d2d('0x3b')]?_0x2134d5['attributes']:_0x282db9[_0x9d2d('0x38')];_0x2134d5[_0x9d2d('0x60')]=qs[_0x9d2d('0x3f')](_0x1a3c3c[_0x9d2d('0x35')][_0x9d2d('0x3f')]);_0x2134d5['where']=qs[_0x9d2d('0x36')](_[_0x9d2d('0x41')](_0x1a3c3c[_0x9d2d('0x35')],_0x282db9['filters']));if(_0x1a3c3c[_0x9d2d('0x35')][_0x9d2d('0x42')]){_0x2134d5[_0x9d2d('0x40')]=_['merge'](_0x2134d5[_0x9d2d('0x40')],{'$or':_[_0x9d2d('0x2f')](_0x2134d5['attributes'],function(_0x1e1e3d){var _0x5c5b93={};_0x5c5b93[_0x1e1e3d]={'$like':'%'+_0x1a3c3c[_0x9d2d('0x35')][_0x9d2d('0x42')]+'%'};return _0x5c5b93;})});}_0x2134d5=_[_0x9d2d('0x43')]({},_0x2134d5,_0x1a3c3c[_0x9d2d('0x45')]);return _0x183a3b[_0x9d2d('0x83')](_0x2134d5);}})[_0x9d2d('0x28')](function(_0x426aaa){if(_0x426aaa){_0x2ddf0b=_0x426aaa[_0x9d2d('0x3b')];if(!_0x1a3c3c[_0x9d2d('0x35')][_0x9d2d('0x3c')](_0x9d2d('0x3d'))){_0x2134d5[_0x9d2d('0x3e')]=qs['limit'](_0x1a3c3c[_0x9d2d('0x35')]['limit']);_0x2134d5[_0x9d2d('0x20')]=qs[_0x9d2d('0x20')](_0x1a3c3c[_0x9d2d('0x35')]['offset']);}return _0x183a3b['getAgents'](_0x2134d5);}})[_0x9d2d('0x28')](function(_0x21b29e){if(_0x21b29e){return _0x21b29e?{'count':_0x2ddf0b,'rows':_0x21b29e}:null;}})[_0x9d2d('0x28')](respondWithResult(_0x3e03b7,null))[_0x9d2d('0x4d')](handleError(_0x3e03b7,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 04a1d7f..9feadd5 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 _0x61b1=['remove','emit','hook','exports','../../mysqldb','Team','setMaxListeners'];(function(_0x11dbbe,_0x7b04d3){var _0x475061=function(_0x3677d3){while(--_0x3677d3){_0x11dbbe['push'](_0x11dbbe['shift']());}};_0x475061(++_0x7b04d3);}(_0x61b1,0x1e7));var _0x161b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x61b1[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require('events');var Team=require(_0x161b('0x0'))['db'][_0x161b('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x161b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x161b('0x3')};function emitEvent(_0x28c884){return function(_0x5e185e,_0x321d9a,_0x57d877){TeamEvents[_0x161b('0x4')](_0x28c884+':'+_0x5e185e['id'],_0x5e185e);TeamEvents[_0x161b('0x4')](_0x28c884,_0x5e185e);_0x57d877(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x161b('0x5')](e,emitEvent(event));}}module[_0x161b('0x6')]=TeamEvents; \ No newline at end of file +var _0xc399=['remove','emit','hasOwnProperty','events','setMaxListeners','save','update'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xc399,0x14c));var _0x9c39=function(_0x6d5b3c,_0x5b5217){_0x6d5b3c=_0x6d5b3c-0x0;var _0x77e8c=_0xc399[_0x6d5b3c];return _0x77e8c;};'use strict';var EventEmitter=require(_0x9c39('0x0'));var Team=require('../../mysqldb')['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x9c39('0x1')](0x0);var events={'afterCreate':_0x9c39('0x2'),'afterUpdate':_0x9c39('0x3'),'afterDestroy':_0x9c39('0x4')};function emitEvent(_0x3d654f){return function(_0x135857,_0x939eaf,_0x10434a){TeamEvents[_0x9c39('0x5')](_0x3d654f+':'+_0x135857['id'],_0x135857);TeamEvents['emit'](_0x3d654f,_0x135857);_0x10434a(null);};}for(var e in events){if(events[_0x9c39('0x6')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 67a3645..ba1d963 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 _0xe678=['Team','teams','lodash','../../config/logger','bluebird','path','../../config/environment','./team.attributes','define'];(function(_0x12c926,_0x158d01){var _0x14ba0f=function(_0x39fb1f){while(--_0x39fb1f){_0x12c926['push'](_0x12c926['shift']());}};_0x14ba0f(++_0x158d01);}(_0xe678,0x1a9));var _0x8e67=function(_0x27fd39,_0x500539){_0x27fd39=_0x27fd39-0x0;var _0x32d4c6=_0xe678[_0x27fd39];return _0x32d4c6;};'use strict';var _=require(_0x8e67('0x0'));var util=require('util');var logger=require(_0x8e67('0x1'))('api');var moment=require('moment');var BPromise=require(_0x8e67('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8e67('0x3'));var rimraf=require('rimraf');var config=require(_0x8e67('0x4'));var attributes=require(_0x8e67('0x5'));module['exports']=function(_0x379262,_0x22d178){return _0x379262[_0x8e67('0x6')](_0x8e67('0x7'),attributes,{'tableName':_0x8e67('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x538f=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','define','teams','lodash'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x538f,0x1f3));var _0xf538=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x538f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xf538('0x0'));var util=require(_0xf538('0x1'));var logger=require(_0xf538('0x2'))('api');var moment=require(_0xf538('0x3'));var BPromise=require(_0xf538('0x4'));var rp=require(_0xf538('0x5'));var fs=require('fs');var path=require(_0xf538('0x6'));var rimraf=require(_0xf538('0x7'));var config=require('../../config/environment');var attributes=require('./team.attributes');module['exports']=function(_0x5d1798,_0x8dde4b){return _0x5d1798[_0xf538('0x8')]('Team',attributes,{'tableName':_0xf538('0x9'),'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 a141734..3e0c2fa 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 _0x357b=['error','Team,\x20%s,\x20%s','message','info','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x1e0972,_0x2912a9){var _0x456ab8=function(_0x2b8c8b){while(--_0x2b8c8b){_0x1e0972['push'](_0x1e0972['shift']());}};_0x456ab8(++_0x2912a9);}(_0x357b,0x1e6));var _0xb357=function(_0x10f92c,_0x341dbf){_0x10f92c=_0x10f92c-0x0;var _0x10f4b3=_0x357b[_0x10f92c];return _0x10f4b3;};'use strict';var _=require(_0xb357('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb357('0x1'));var rs=require(_0xb357('0x2'));var fs=require('fs');var Redis=require(_0xb357('0x3'));var db=require(_0xb357('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb357('0x5'));var config=require('../../config/environment');var jayson=require(_0xb357('0x6'));var client=jayson[_0xb357('0x7')][_0xb357('0x8')]({'port':0x232a});config[_0xb357('0x9')]=_['defaults'](config[_0xb357('0x9')],{'host':_0xb357('0xa'),'port':0x18eb});var socket=require(_0xb357('0xb'))(new Redis(config[_0xb357('0x9')]));require('./team.socket')[_0xb357('0xc')](socket);function respondWithRpcPromise(_0x1febd7,_0x460cab,_0x55ce05){return new BPromise(function(_0x2a7321,_0x17d67f){return client[_0xb357('0xd')](_0x1febd7,_0x55ce05)[_0xb357('0xe')](function(_0x492e98){logger['info']('Team,\x20%s,\x20%s',_0x460cab,'request\x20sent');logger['debug'](_0xb357('0xf'),_0x460cab,_0xb357('0x10'),JSON[_0xb357('0x11')](_0x492e98));if(_0x492e98['error']){if(_0x492e98[_0xb357('0x12')]['code']===0x1f4){logger['error'](_0xb357('0x13'),_0x460cab,_0x492e98[_0xb357('0x12')]['message']);return _0x17d67f(_0x492e98[_0xb357('0x12')][_0xb357('0x14')]);}logger['error']('Team,\x20%s,\x20%s',_0x460cab,_0x492e98[_0xb357('0x12')][_0xb357('0x14')]);return _0x2a7321(_0x492e98[_0xb357('0x12')][_0xb357('0x14')]);}else{logger[_0xb357('0x15')](_0xb357('0x13'),_0x460cab,'request\x20sent');_0x2a7321(_0x492e98[_0xb357('0x16')][_0xb357('0x14')]);}})[_0xb357('0x17')](function(_0x5a64c6){logger[_0xb357('0x12')](_0xb357('0x13'),_0x460cab,_0x5a64c6);_0x17d67f(_0x5a64c6);});});} \ No newline at end of file +var _0x657c=['code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3ef2d5,_0x423d46){var _0x2fefb2=function(_0x54f82f){while(--_0x54f82f){_0x3ef2d5['push'](_0x3ef2d5['shift']());}};_0x2fefb2(++_0x423d46);}(_0x657c,0x130));var _0xc657=function(_0x3e2820,_0x27050d){_0x3e2820=_0x3e2820-0x0;var _0xe4b733=_0x657c[_0x3e2820];return _0xe4b733;};'use strict';var _=require(_0xc657('0x0'));var util=require(_0xc657('0x1'));var moment=require('moment');var BPromise=require(_0xc657('0x2'));var rs=require(_0xc657('0x3'));var fs=require('fs');var Redis=require(_0xc657('0x4'));var db=require(_0xc657('0x5'))['db'];var utils=require(_0xc657('0x6'));var logger=require(_0xc657('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc657('0x8'));var client=jayson[_0xc657('0x9')][_0xc657('0xa')]({'port':0x232a});config[_0xc657('0xb')]=_[_0xc657('0xc')](config[_0xc657('0xb')],{'host':_0xc657('0xd'),'port':0x18eb});var socket=require(_0xc657('0xe'))(new Redis(config[_0xc657('0xb')]));require(_0xc657('0xf'))[_0xc657('0x10')](socket);function respondWithRpcPromise(_0x29c4b9,_0x286eba,_0x5abc11){return new BPromise(function(_0xf2ee10,_0x27bc47){return client[_0xc657('0x11')](_0x29c4b9,_0x5abc11)[_0xc657('0x12')](function(_0x33902b){logger[_0xc657('0x13')](_0xc657('0x14'),_0x286eba,'request\x20sent');logger[_0xc657('0x15')](_0xc657('0x16'),_0x286eba,_0xc657('0x17'),JSON[_0xc657('0x18')](_0x33902b));if(_0x33902b['error']){if(_0x33902b[_0xc657('0x19')][_0xc657('0x1a')]===0x1f4){logger[_0xc657('0x19')](_0xc657('0x14'),_0x286eba,_0x33902b['error']['message']);return _0x27bc47(_0x33902b[_0xc657('0x19')][_0xc657('0x1b')]);}logger[_0xc657('0x19')]('Team,\x20%s,\x20%s',_0x286eba,_0x33902b['error'][_0xc657('0x1b')]);return _0xf2ee10(_0x33902b[_0xc657('0x19')]['message']);}else{logger[_0xc657('0x13')]('Team,\x20%s,\x20%s',_0x286eba,_0xc657('0x17'));_0xf2ee10(_0x33902b[_0xc657('0x1c')][_0xc657('0x1b')]);}})[_0xc657('0x1d')](function(_0x1e8379){logger[_0xc657('0x19')]('Team,\x20%s,\x20%s',_0x286eba,_0x1e8379);_0x27bc47(_0x1e8379);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index e3c849c..8568e30 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 _0xbedb=['update','emit','removeListener','register','length','team:','./team.events','remove'];(function(_0x32cce8,_0x18762f){var _0x4a732b=function(_0x5a3a21){while(--_0x5a3a21){_0x32cce8['push'](_0x32cce8['shift']());}};_0x4a732b(++_0x18762f);}(_0xbedb,0x12e));var _0xbbed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbedb[_0x3dd15e];return _0x231fd0;};'use strict';var TeamEvents=require(_0xbbed('0x0'));var events=['save',_0xbbed('0x1'),_0xbbed('0x2')];function createListener(_0x3e475c,_0x57817e){return function(_0x4e6b39){_0x57817e[_0xbbed('0x3')](_0x3e475c,_0x4e6b39);};}function removeListener(_0x1096c8,_0x6b20a4){return function(){TeamEvents[_0xbbed('0x4')](_0x1096c8,_0x6b20a4);};}exports[_0xbbed('0x5')]=function(_0x281e33){for(var _0x1c8c9a=0x0,_0x3a3d9c=events[_0xbbed('0x6')];_0x1c8c9a<_0x3a3d9c;_0x1c8c9a++){var _0x42f499=events[_0x1c8c9a];var _0x51d8c6=createListener(_0xbbed('0x7')+_0x42f499,_0x281e33);TeamEvents['on'](_0x42f499,_0x51d8c6);}}; \ No newline at end of file +var _0x6a83=['register','length','team:','./team.events','save','remove','update','emit','removeListener'];(function(_0x2058cb,_0x5f51ca){var _0x199a8d=function(_0x1f0066){while(--_0x1f0066){_0x2058cb['push'](_0x2058cb['shift']());}};_0x199a8d(++_0x5f51ca);}(_0x6a83,0xd2));var _0x36a8=function(_0xf2c1dd,_0x2dad99){_0xf2c1dd=_0xf2c1dd-0x0;var _0x26104f=_0x6a83[_0xf2c1dd];return _0x26104f;};'use strict';var TeamEvents=require(_0x36a8('0x0'));var events=[_0x36a8('0x1'),_0x36a8('0x2'),_0x36a8('0x3')];function createListener(_0x125ca1,_0x367db7){return function(_0x1f59f3){_0x367db7[_0x36a8('0x4')](_0x125ca1,_0x1f59f3);};}function removeListener(_0x11a47c,_0x35767b){return function(){TeamEvents[_0x36a8('0x5')](_0x11a47c,_0x35767b);};}exports[_0x36a8('0x6')]=function(_0x360b47){for(var _0x60d79a=0x0,_0x2a0ba3=events[_0x36a8('0x7')];_0x60d79a<_0x2a0ba3;_0x60d79a++){var _0x31b8d3=events[_0x60d79a];var _0xf312a6=createListener(_0x36a8('0x8')+_0x31b8d3,_0x360b47);TeamEvents['on'](_0x31b8d3,_0xf312a6);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 4be2baa..3d56c87 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 _0xb0de=['index','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','Router','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated'];(function(_0x291dfb,_0x8de8cd){var _0x352673=function(_0xc76cd7){while(--_0xc76cd7){_0x291dfb['push'](_0x291dfb['shift']());}};_0x352673(++_0x8de8cd);}(_0xb0de,0x1ba));var _0xeb0d=function(_0xf7eba2,_0x16caf4){_0xf7eba2=_0xf7eba2-0x0;var _0x1cffa6=_0xb0de[_0xf7eba2];return _0x1cffa6;};'use strict';var multer=require(_0xeb0d('0x0'));var util=require('util');var path=require(_0xeb0d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xeb0d('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xeb0d('0x3'));var config=require(_0xeb0d('0x4'));var controller=require(_0xeb0d('0x5'));router[_0xeb0d('0x6')]('/',auth[_0xeb0d('0x7')](),controller[_0xeb0d('0x8')]);router[_0xeb0d('0x6')](_0xeb0d('0x9'),auth[_0xeb0d('0x7')](),controller[_0xeb0d('0xa')]);router[_0xeb0d('0xb')]('/',auth[_0xeb0d('0x7')](),controller[_0xeb0d('0xc')]);router[_0xeb0d('0xd')](_0xeb0d('0x9'),auth[_0xeb0d('0x7')](),controller[_0xeb0d('0xe')]);router[_0xeb0d('0xf')](_0xeb0d('0x9'),auth[_0xeb0d('0x7')](),controller[_0xeb0d('0x10')]);module[_0xeb0d('0x11')]=router; \ No newline at end of file +var _0x5a75=['create','put','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','post'];(function(_0x2365cb,_0x53ff78){var _0x225e06=function(_0x3adc4e){while(--_0x3adc4e){_0x2365cb['push'](_0x2365cb['shift']());}};_0x225e06(++_0x53ff78);}(_0x5a75,0xc2));var _0x55a7=function(_0x24a654,_0x2ca441){_0x24a654=_0x24a654-0x0;var _0x458651=_0x5a75[_0x24a654];return _0x458651;};'use strict';var multer=require(_0x55a7('0x0'));var util=require(_0x55a7('0x1'));var path=require(_0x55a7('0x2'));var timeout=require(_0x55a7('0x3'));var express=require(_0x55a7('0x4'));var router=express[_0x55a7('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x55a7('0x6'));var config=require(_0x55a7('0x7'));var controller=require(_0x55a7('0x8'));router[_0x55a7('0x9')]('/',auth[_0x55a7('0xa')](),controller[_0x55a7('0xb')]);router['get'](_0x55a7('0xc'),auth[_0x55a7('0xa')](),controller['show']);router[_0x55a7('0xd')]('/',auth[_0x55a7('0xa')](),controller[_0x55a7('0xe')]);router[_0x55a7('0xf')](_0x55a7('0xc'),auth[_0x55a7('0xa')](),controller['update']);router['delete'](_0x55a7('0xc'),auth[_0x55a7('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index bcc0f8e..0539376 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 _0x2f61=['sequelize','exports','STRING','TEXT'];(function(_0x2b6593,_0x616eca){var _0x2b95f6=function(_0x1ec974){while(--_0x1ec974){_0x2b6593['push'](_0x2b6593['shift']());}};_0x2b95f6(++_0x616eca);}(_0x2f61,0x15c));var _0x12f6=function(_0x567760,_0x282c85){_0x567760=_0x567760-0x0;var _0xbfbb92=_0x2f61[_0x567760];return _0xbfbb92;};'use strict';var Sequelize=require(_0x12f6('0x0'));module[_0x12f6('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x12f6('0x2')]},'html':{'type':Sequelize[_0x12f6('0x3')]}}; \ No newline at end of file +var _0x1956=['exports','STRING','sequelize'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x1956,0x8f));var _0x6195=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0x1956[_0x468b0f];return _0x3e74d9;};'use strict';var Sequelize=require(_0x6195('0x0'));module[_0x6195('0x1')]={'name':{'type':Sequelize[_0x6195('0x2')]},'description':{'type':Sequelize[_0x6195('0x2')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index ae2bb5c..545fbe8 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 _0x65dd=['limit','sort','where','filters','pick','filter','VIRTUAL','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','user','get','role','Templates','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','save','then','destroy','UserProfileResource','error','name','send','map','Template','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty'];(function(_0x536a04,_0x158d1d){var _0x592eeb=function(_0x51b2a3){while(--_0x51b2a3){_0x536a04['push'](_0x536a04['shift']());}};_0x592eeb(++_0x158d1d);}(_0x65dd,0x6c));var _0xd65d=function(_0x2d6763,_0x16571b){_0x2d6763=_0x2d6763-0x0;var _0x449678=_0x65dd[_0x2d6763];return _0x449678;};'use strict';var pdf=require(_0xd65d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd65d('0x1'));var zipdir=require(_0xd65d('0x2'));var jsonpatch=require(_0xd65d('0x3'));var rp=require(_0xd65d('0x4'));var moment=require('moment');var BPromise=require(_0xd65d('0x5'));var Mustache=require(_0xd65d('0x6'));var util=require(_0xd65d('0x7'));var path=require(_0xd65d('0x8'));var sox=require(_0xd65d('0x9'));var csv=require(_0xd65d('0xa'));var ejs=require(_0xd65d('0xb'));var fs=require('fs');var _=require(_0xd65d('0xc'));var squel=require(_0xd65d('0xd'));var crypto=require(_0xd65d('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xd65d('0xf'));var toCsv=require(_0xd65d('0xa'));var querystring=require(_0xd65d('0x10'));var Papa=require('papaparse');var Redis=require(_0xd65d('0x11'));var authService=require(_0xd65d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd65d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd65d('0x14'))(_0xd65d('0x15'));var utils=require('../../config/utils');var config=require(_0xd65d('0x16'));var db=require(_0xd65d('0x17'))['db'];function respondWithStatusCode(_0x2759f2,_0x245402){_0x245402=_0x245402||0xcc;return function(_0x17cf14){if(_0x17cf14){return _0x2759f2[_0xd65d('0x18')](_0x245402);}return _0x2759f2[_0xd65d('0x19')](_0x245402)[_0xd65d('0x1a')]();};}function respondWithResult(_0x3625be,_0x83bce6){_0x83bce6=_0x83bce6||0xc8;return function(_0x2fce75){if(_0x2fce75){return _0x3625be[_0xd65d('0x19')](_0x83bce6)[_0xd65d('0x1b')](_0x2fce75);}};}function respondWithFilteredResult(_0x5a7219,_0x5d8d5b){return function(_0x3da298){if(_0x3da298){var _0x2d655c=_0x3da298[_0xd65d('0x1c')],_0x2b58d1=_0x5d8d5b[_0xd65d('0x1d')],_0x505866=_0x5d8d5b[_0xd65d('0x1d')]+_0x5d8d5b['limit'],_0x5002e1;if(_0x505866>=_0x2d655c){_0x505866=_0x2d655c;_0x5002e1=0xc8;}else{_0x5002e1=0xce;}_0x5a7219['status'](_0x5002e1);return _0x5a7219[_0xd65d('0x1e')]('Content-Range',_0x2b58d1+'-'+_0x505866+'/'+_0x2d655c)[_0xd65d('0x1b')](_0x3da298);}return null;};}function patchUpdates(_0x12c8b9){return function(_0x2e688a){try{jsonpatch[_0xd65d('0x1f')](_0x2e688a,_0x12c8b9,!![]);}catch(_0x235b6c){return BPromise['reject'](_0x235b6c);}return _0x2e688a[_0xd65d('0x20')]();};}function saveUpdates(_0x539c46,_0x572b16){return function(_0x1fdfa8){if(_0x1fdfa8){return _0x1fdfa8['update'](_0x539c46)[_0xd65d('0x21')](function(_0x3fefa7){return _0x3fefa7;});}return null;};}function removeEntity(_0x3448cd,_0x4eca18){return function(_0xb0e21d){if(_0xb0e21d){return _0xb0e21d[_0xd65d('0x22')]()[_0xd65d('0x21')](function(){var _0x1ec80c=_0xb0e21d['get']({'plain':!![]});var _0x1d909f='Templates';return db[_0xd65d('0x23')]['destroy']({'where':{'type':_0x1d909f,'resourceId':_0x1ec80c['id']}})['then'](function(){return _0xb0e21d;});})[_0xd65d('0x21')](function(){_0x3448cd['status'](0xcc)[_0xd65d('0x1a')]();});}};}function handleEntityNotFound(_0x35ae0e,_0x5b6100){return function(_0x38ac99){if(!_0x38ac99){_0x35ae0e[_0xd65d('0x18')](0x194);}return _0x38ac99;};}function handleError(_0x30283a,_0x14a7ce){_0x14a7ce=_0x14a7ce||0x1f4;return function(_0x575c8d){logger[_0xd65d('0x24')](_0x575c8d['stack']);if(_0x575c8d[_0xd65d('0x25')]){delete _0x575c8d[_0xd65d('0x25')];}_0x30283a[_0xd65d('0x19')](_0x14a7ce)[_0xd65d('0x26')](_0x575c8d);};}exports['index']=function(_0x39ea50,_0x512f84){var _0x4f3064={},_0x40989a={},_0x424151={'count':0x0,'rows':[]};var _0x575384=_[_0xd65d('0x27')](db[_0xd65d('0x28')][_0xd65d('0x29')],function(_0x2cd8df){return{'name':_0x2cd8df[_0xd65d('0x2a')],'type':_0x2cd8df[_0xd65d('0x2b')][_0xd65d('0x2c')]};});_0x40989a[_0xd65d('0x2d')]=_[_0xd65d('0x27')](_0x575384,_0xd65d('0x25'));_0x40989a[_0xd65d('0x2e')]=_[_0xd65d('0x2f')](_0x39ea50[_0xd65d('0x2e')]);_0x40989a['filters']=_[_0xd65d('0x30')](_0x40989a[_0xd65d('0x2d')],_0x40989a[_0xd65d('0x2e')]);_0x4f3064['attributes']=_[_0xd65d('0x30')](_0x40989a[_0xd65d('0x2d')],qs[_0xd65d('0x31')](_0x39ea50['query'][_0xd65d('0x31')]));_0x4f3064[_0xd65d('0x32')]=_0x4f3064[_0xd65d('0x32')]['length']?_0x4f3064[_0xd65d('0x32')]:_0x40989a[_0xd65d('0x2d')];if(!_0x39ea50[_0xd65d('0x2e')][_0xd65d('0x33')]('nolimit')){_0x4f3064[_0xd65d('0x34')]=qs[_0xd65d('0x34')](_0x39ea50[_0xd65d('0x2e')]['limit']);_0x4f3064['offset']=qs[_0xd65d('0x1d')](_0x39ea50[_0xd65d('0x2e')][_0xd65d('0x1d')]);}_0x4f3064['order']=qs[_0xd65d('0x35')](_0x39ea50[_0xd65d('0x2e')][_0xd65d('0x35')]);_0x4f3064[_0xd65d('0x36')]=qs[_0xd65d('0x37')](_[_0xd65d('0x38')](_0x39ea50[_0xd65d('0x2e')],_0x40989a[_0xd65d('0x37')]),_0x575384);if(_0x39ea50['query'][_0xd65d('0x39')]){_0x4f3064[_0xd65d('0x36')]=_['merge'](_0x4f3064[_0xd65d('0x36')],{'$or':_[_0xd65d('0x27')](_0x575384,function(_0x750c56){if(_0x750c56[_0xd65d('0x2b')]!==_0xd65d('0x3a')){var _0x25ba24={};_0x25ba24[_0x750c56[_0xd65d('0x25')]]={'$like':'%'+_0x39ea50[_0xd65d('0x2e')]['filter']+'%'};return _0x25ba24;}})});}_0x4f3064=_['merge']({},_0x4f3064,_0x39ea50[_0xd65d('0x3b')]);var _0x7bbbc3={'where':_0x4f3064['where']};return db[_0xd65d('0x28')]['count'](_0x7bbbc3)[_0xd65d('0x21')](function(_0x52949f){_0x424151[_0xd65d('0x1c')]=_0x52949f;if(_0x39ea50[_0xd65d('0x2e')]['includeAll']){_0x4f3064[_0xd65d('0x3c')]=[{'all':!![]}];}return db[_0xd65d('0x28')][_0xd65d('0x3d')](_0x4f3064);})[_0xd65d('0x21')](function(_0x488626){_0x424151[_0xd65d('0x3e')]=_0x488626;return _0x424151;})['then'](respondWithFilteredResult(_0x512f84,_0x4f3064))[_0xd65d('0x3f')](handleError(_0x512f84,null));};exports[_0xd65d('0x40')]=function(_0x5b01d3,_0x58aae8){var _0x1fbc9e={'raw':!![],'where':{'id':_0x5b01d3[_0xd65d('0x41')]['id']}},_0x253fde={};_0x253fde[_0xd65d('0x2d')]=_[_0xd65d('0x2f')](db[_0xd65d('0x28')][_0xd65d('0x29')]);_0x253fde[_0xd65d('0x2e')]=_[_0xd65d('0x2f')](_0x5b01d3[_0xd65d('0x2e')]);_0x253fde[_0xd65d('0x37')]=_[_0xd65d('0x30')](_0x253fde[_0xd65d('0x2d')],_0x253fde[_0xd65d('0x2e')]);_0x1fbc9e[_0xd65d('0x32')]=_[_0xd65d('0x30')](_0x253fde[_0xd65d('0x2d')],qs['fields'](_0x5b01d3['query']['fields']));_0x1fbc9e['attributes']=_0x1fbc9e['attributes'][_0xd65d('0x42')]?_0x1fbc9e['attributes']:_0x253fde[_0xd65d('0x2d')];if(_0x5b01d3['query'][_0xd65d('0x43')]){_0x1fbc9e[_0xd65d('0x3c')]=[{'all':!![]}];}_0x1fbc9e=_['merge']({},_0x1fbc9e,_0x5b01d3[_0xd65d('0x3b')]);return db[_0xd65d('0x28')][_0xd65d('0x44')](_0x1fbc9e)[_0xd65d('0x21')](handleEntityNotFound(_0x58aae8,null))[_0xd65d('0x21')](respondWithResult(_0x58aae8,null))[_0xd65d('0x3f')](handleError(_0x58aae8,null));};exports[_0xd65d('0x45')]=function(_0x210135,_0x15616e){return db[_0xd65d('0x28')][_0xd65d('0x45')](_0x210135[_0xd65d('0x46')],{})[_0xd65d('0x21')](function(_0x3abecd){var _0xd1da1=_0x210135[_0xd65d('0x47')][_0xd65d('0x48')]({'plain':!![]});if(!_0xd1da1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xd1da1[_0xd65d('0x49')]===_0xd65d('0x47')){var _0x315002=_0x3abecd['get']({'plain':!![]});var _0x30bdee=_0xd65d('0x4a');return db[_0xd65d('0x4b')]['find']({'where':{'name':_0x30bdee,'userProfileId':_0xd1da1[_0xd65d('0x4c')]},'raw':!![]})[_0xd65d('0x21')](function(_0x3c3441){if(_0x3c3441&&_0x3c3441[_0xd65d('0x4d')]===0x0){return db[_0xd65d('0x23')][_0xd65d('0x45')]({'name':_0x315002[_0xd65d('0x25')],'resourceId':_0x315002['id'],'type':_0x3c3441['name'],'sectionId':_0x3c3441['id']},{})[_0xd65d('0x21')](function(){return _0x3abecd;});}else{return _0x3abecd;}})[_0xd65d('0x3f')](function(_0x244e13){logger[_0xd65d('0x24')](_0xd65d('0x4e'),_0x244e13);throw _0x244e13;});}return _0x3abecd;})[_0xd65d('0x21')](respondWithResult(_0x15616e,0xc9))[_0xd65d('0x3f')](handleError(_0x15616e,null));};exports[_0xd65d('0x4f')]=function(_0x23c032,_0x5c710d){if(_0x23c032[_0xd65d('0x46')]['id']){delete _0x23c032[_0xd65d('0x46')]['id'];}return db[_0xd65d('0x28')][_0xd65d('0x44')]({'where':{'id':_0x23c032[_0xd65d('0x41')]['id']}})['then'](handleEntityNotFound(_0x5c710d,null))[_0xd65d('0x21')](saveUpdates(_0x23c032[_0xd65d('0x46')],null))[_0xd65d('0x21')](respondWithResult(_0x5c710d,null))['catch'](handleError(_0x5c710d,null));};exports[_0xd65d('0x22')]=function(_0x1440dc,_0x23e797){return db['Template'][_0xd65d('0x44')]({'where':{'id':_0x1440dc[_0xd65d('0x41')]['id']}})[_0xd65d('0x21')](handleEntityNotFound(_0x23e797,null))['then'](removeEntity(_0x23e797,null))[_0xd65d('0x3f')](handleError(_0x23e797,null));}; \ No newline at end of file +var _0xba3d=['keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','Template','include','findAll','rows','catch','show','params','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','Content-Range','apply','reject','then','destroy','get','Templates','UserProfileResource','error','stack','name','send','index','map','rawAttributes','type','key','query'];(function(_0x1de569,_0x15910c){var _0x3c9bb4=function(_0x2a029c){while(--_0x2a029c){_0x1de569['push'](_0x1de569['shift']());}};_0x3c9bb4(++_0x15910c);}(_0xba3d,0x1ac));var _0xdba3=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xba3d[_0x45d55e];return _0x29812a;};'use strict';var pdf=require(_0xdba3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xdba3('0x1'));var zipdir=require(_0xdba3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdba3('0x3'));var moment=require(_0xdba3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdba3('0x5'));var util=require(_0xdba3('0x6'));var path=require(_0xdba3('0x7'));var sox=require(_0xdba3('0x8'));var csv=require(_0xdba3('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xdba3('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xdba3('0xb'));var toCsv=require(_0xdba3('0x9'));var querystring=require(_0xdba3('0xc'));var Papa=require(_0xdba3('0xd'));var Redis=require(_0xdba3('0xe'));var authService=require(_0xdba3('0xf'));var qs=require(_0xdba3('0x10'));var as=require(_0xdba3('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdba3('0x12'))(_0xdba3('0x13'));var utils=require(_0xdba3('0x14'));var config=require(_0xdba3('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2500cf,_0x215e7c){_0x215e7c=_0x215e7c||0xcc;return function(_0x4d2f64){if(_0x4d2f64){return _0x2500cf[_0xdba3('0x16')](_0x215e7c);}return _0x2500cf['status'](_0x215e7c)[_0xdba3('0x17')]();};}function respondWithResult(_0xdd3ace,_0x444d0b){_0x444d0b=_0x444d0b||0xc8;return function(_0x494151){if(_0x494151){return _0xdd3ace[_0xdba3('0x18')](_0x444d0b)[_0xdba3('0x19')](_0x494151);}};}function respondWithFilteredResult(_0x30a5d2,_0x3cab3d){return function(_0x577ec3){if(_0x577ec3){var _0x2b540e=_0x577ec3[_0xdba3('0x1a')],_0x3de59a=_0x3cab3d[_0xdba3('0x1b')],_0x1ec7d4=_0x3cab3d['offset']+_0x3cab3d['limit'],_0x37fd6b;if(_0x1ec7d4>=_0x2b540e){_0x1ec7d4=_0x2b540e;_0x37fd6b=0xc8;}else{_0x37fd6b=0xce;}_0x30a5d2[_0xdba3('0x18')](_0x37fd6b);return _0x30a5d2['set'](_0xdba3('0x1c'),_0x3de59a+'-'+_0x1ec7d4+'/'+_0x2b540e)[_0xdba3('0x19')](_0x577ec3);}return null;};}function patchUpdates(_0x42b1c8){return function(_0x547222){try{jsonpatch[_0xdba3('0x1d')](_0x547222,_0x42b1c8,!![]);}catch(_0x774074){return BPromise[_0xdba3('0x1e')](_0x774074);}return _0x547222['save']();};}function saveUpdates(_0xdb40d5,_0x53927f){return function(_0x1cc5f7){if(_0x1cc5f7){return _0x1cc5f7['update'](_0xdb40d5)[_0xdba3('0x1f')](function(_0x421d6c){return _0x421d6c;});}return null;};}function removeEntity(_0x190fef,_0x28e4c4){return function(_0x1e8305){if(_0x1e8305){return _0x1e8305[_0xdba3('0x20')]()[_0xdba3('0x1f')](function(){var _0x670f85=_0x1e8305[_0xdba3('0x21')]({'plain':!![]});var _0x5784c7=_0xdba3('0x22');return db[_0xdba3('0x23')][_0xdba3('0x20')]({'where':{'type':_0x5784c7,'resourceId':_0x670f85['id']}})['then'](function(){return _0x1e8305;});})[_0xdba3('0x1f')](function(){_0x190fef[_0xdba3('0x18')](0xcc)[_0xdba3('0x17')]();});}};}function handleEntityNotFound(_0x50ba0e,_0xc54e98){return function(_0x26e461){if(!_0x26e461){_0x50ba0e['sendStatus'](0x194);}return _0x26e461;};}function handleError(_0xa6c7d4,_0x5bf637){_0x5bf637=_0x5bf637||0x1f4;return function(_0x194d7f){logger[_0xdba3('0x24')](_0x194d7f[_0xdba3('0x25')]);if(_0x194d7f[_0xdba3('0x26')]){delete _0x194d7f[_0xdba3('0x26')];}_0xa6c7d4[_0xdba3('0x18')](_0x5bf637)[_0xdba3('0x27')](_0x194d7f);};}exports[_0xdba3('0x28')]=function(_0x131d9c,_0x5456e7){var _0x4fdf77={},_0x435e37={},_0x2d71fd={'count':0x0,'rows':[]};var _0x489318=_[_0xdba3('0x29')](db['Template'][_0xdba3('0x2a')],function(_0x31d3cd){return{'name':_0x31d3cd['fieldName'],'type':_0x31d3cd[_0xdba3('0x2b')][_0xdba3('0x2c')]};});_0x435e37['model']=_['map'](_0x489318,_0xdba3('0x26'));_0x435e37[_0xdba3('0x2d')]=_[_0xdba3('0x2e')](_0x131d9c[_0xdba3('0x2d')]);_0x435e37[_0xdba3('0x2f')]=_[_0xdba3('0x30')](_0x435e37['model'],_0x435e37[_0xdba3('0x2d')]);_0x4fdf77['attributes']=_[_0xdba3('0x30')](_0x435e37[_0xdba3('0x31')],qs['fields'](_0x131d9c['query'][_0xdba3('0x32')]));_0x4fdf77[_0xdba3('0x33')]=_0x4fdf77[_0xdba3('0x33')][_0xdba3('0x34')]?_0x4fdf77[_0xdba3('0x33')]:_0x435e37['model'];if(!_0x131d9c[_0xdba3('0x2d')][_0xdba3('0x35')](_0xdba3('0x36'))){_0x4fdf77['limit']=qs[_0xdba3('0x37')](_0x131d9c['query'][_0xdba3('0x37')]);_0x4fdf77[_0xdba3('0x1b')]=qs[_0xdba3('0x1b')](_0x131d9c[_0xdba3('0x2d')]['offset']);}_0x4fdf77['order']=qs[_0xdba3('0x38')](_0x131d9c[_0xdba3('0x2d')][_0xdba3('0x38')]);_0x4fdf77[_0xdba3('0x39')]=qs['filters'](_[_0xdba3('0x3a')](_0x131d9c[_0xdba3('0x2d')],_0x435e37[_0xdba3('0x2f')]),_0x489318);if(_0x131d9c[_0xdba3('0x2d')][_0xdba3('0x3b')]){_0x4fdf77['where']=_[_0xdba3('0x3c')](_0x4fdf77[_0xdba3('0x39')],{'$or':_[_0xdba3('0x29')](_0x489318,function(_0x35fd6a){if(_0x35fd6a[_0xdba3('0x2b')]!==_0xdba3('0x3d')){var _0x2f1e7b={};_0x2f1e7b[_0x35fd6a[_0xdba3('0x26')]]={'$like':'%'+_0x131d9c[_0xdba3('0x2d')][_0xdba3('0x3b')]+'%'};return _0x2f1e7b;}})});}_0x4fdf77=_[_0xdba3('0x3c')]({},_0x4fdf77,_0x131d9c[_0xdba3('0x3e')]);var _0x13c049={'where':_0x4fdf77[_0xdba3('0x39')]};return db[_0xdba3('0x3f')]['count'](_0x13c049)[_0xdba3('0x1f')](function(_0x409ba1){_0x2d71fd[_0xdba3('0x1a')]=_0x409ba1;if(_0x131d9c['query']['includeAll']){_0x4fdf77[_0xdba3('0x40')]=[{'all':!![]}];}return db[_0xdba3('0x3f')][_0xdba3('0x41')](_0x4fdf77);})['then'](function(_0x9df913){_0x2d71fd[_0xdba3('0x42')]=_0x9df913;return _0x2d71fd;})[_0xdba3('0x1f')](respondWithFilteredResult(_0x5456e7,_0x4fdf77))[_0xdba3('0x43')](handleError(_0x5456e7,null));};exports[_0xdba3('0x44')]=function(_0x5e0c03,_0x4fb263){var _0x17d8ee={'raw':!![],'where':{'id':_0x5e0c03[_0xdba3('0x45')]['id']}},_0x4600f9={};_0x4600f9[_0xdba3('0x31')]=_[_0xdba3('0x2e')](db[_0xdba3('0x3f')][_0xdba3('0x2a')]);_0x4600f9[_0xdba3('0x2d')]=_[_0xdba3('0x2e')](_0x5e0c03[_0xdba3('0x2d')]);_0x4600f9[_0xdba3('0x2f')]=_[_0xdba3('0x30')](_0x4600f9[_0xdba3('0x31')],_0x4600f9[_0xdba3('0x2d')]);_0x17d8ee[_0xdba3('0x33')]=_['intersection'](_0x4600f9[_0xdba3('0x31')],qs[_0xdba3('0x32')](_0x5e0c03[_0xdba3('0x2d')][_0xdba3('0x32')]));_0x17d8ee['attributes']=_0x17d8ee[_0xdba3('0x33')][_0xdba3('0x34')]?_0x17d8ee['attributes']:_0x4600f9[_0xdba3('0x31')];if(_0x5e0c03[_0xdba3('0x2d')][_0xdba3('0x46')]){_0x17d8ee[_0xdba3('0x40')]=[{'all':!![]}];}_0x17d8ee=_[_0xdba3('0x3c')]({},_0x17d8ee,_0x5e0c03['options']);return db[_0xdba3('0x3f')][_0xdba3('0x47')](_0x17d8ee)['then'](handleEntityNotFound(_0x4fb263,null))[_0xdba3('0x1f')](respondWithResult(_0x4fb263,null))[_0xdba3('0x43')](handleError(_0x4fb263,null));};exports[_0xdba3('0x48')]=function(_0x42f949,_0x5c9005){return db[_0xdba3('0x3f')]['create'](_0x42f949[_0xdba3('0x49')],{})[_0xdba3('0x1f')](function(_0x38239c){var _0x3356f6=_0x42f949['user'][_0xdba3('0x21')]({'plain':!![]});if(!_0x3356f6)throw new Error(_0xdba3('0x4a'));if(_0x3356f6[_0xdba3('0x4b')]===_0xdba3('0x4c')){var _0x9396f=_0x38239c[_0xdba3('0x21')]({'plain':!![]});var _0x4a7f67=_0xdba3('0x22');return db['UserProfileSection'][_0xdba3('0x47')]({'where':{'name':_0x4a7f67,'userProfileId':_0x3356f6[_0xdba3('0x4d')]},'raw':!![]})[_0xdba3('0x1f')](function(_0x1de5de){if(_0x1de5de&&_0x1de5de['autoAssociation']===0x0){return db[_0xdba3('0x23')]['create']({'name':_0x9396f[_0xdba3('0x26')],'resourceId':_0x9396f['id'],'type':_0x1de5de[_0xdba3('0x26')],'sectionId':_0x1de5de['id']},{})['then'](function(){return _0x38239c;});}else{return _0x38239c;}})[_0xdba3('0x43')](function(_0x39aea2){logger[_0xdba3('0x24')](_0xdba3('0x4e'),_0x39aea2);throw _0x39aea2;});}return _0x38239c;})[_0xdba3('0x1f')](respondWithResult(_0x5c9005,0xc9))[_0xdba3('0x43')](handleError(_0x5c9005,null));};exports['update']=function(_0x30a996,_0x20ed7a){if(_0x30a996['body']['id']){delete _0x30a996[_0xdba3('0x49')]['id'];}return db[_0xdba3('0x3f')]['find']({'where':{'id':_0x30a996[_0xdba3('0x45')]['id']}})[_0xdba3('0x1f')](handleEntityNotFound(_0x20ed7a,null))[_0xdba3('0x1f')](saveUpdates(_0x30a996[_0xdba3('0x49')],null))[_0xdba3('0x1f')](respondWithResult(_0x20ed7a,null))[_0xdba3('0x43')](handleError(_0x20ed7a,null));};exports['destroy']=function(_0x1f5708,_0x25d601){return db[_0xdba3('0x3f')][_0xdba3('0x47')]({'where':{'id':_0x1f5708[_0xdba3('0x45')]['id']}})['then'](handleEntityNotFound(_0x25d601,null))[_0xdba3('0x1f')](removeEntity(_0x25d601,null))['catch'](handleError(_0x25d601,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index f2d3beb..c8a4d5c 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 _0x69de=['path','../../config/environment','define','Template','tools_templates','../../config/logger','moment','request-promise'];(function(_0x56ef99,_0x44ef07){var _0x4c6929=function(_0x28e455){while(--_0x28e455){_0x56ef99['push'](_0x56ef99['shift']());}};_0x4c6929(++_0x44ef07);}(_0x69de,0x19d));var _0xe69d=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0x69de[_0x24259d];return _0x5a701;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe69d('0x0'))('api');var moment=require(_0xe69d('0x1'));var BPromise=require('bluebird');var rp=require(_0xe69d('0x2'));var fs=require('fs');var path=require(_0xe69d('0x3'));var rimraf=require('rimraf');var config=require(_0xe69d('0x4'));var attributes=require('./template.attributes');module['exports']=function(_0x3e29ec,_0x187cd2){return _0x3e29ec[_0xe69d('0x5')](_0xe69d('0x6'),attributes,{'tableName':_0xe69d('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0484=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','Template','tools_templates'];(function(_0x292427,_0x5dc5d1){var _0x1e5629=function(_0xeb9913){while(--_0xeb9913){_0x292427['push'](_0x292427['shift']());}};_0x1e5629(++_0x5dc5d1);}(_0x0484,0x1ec));var _0x4048=function(_0x2da1e5,_0x1f56af){_0x2da1e5=_0x2da1e5-0x0;var _0x38779a=_0x0484[_0x2da1e5];return _0x38779a;};'use strict';var _=require(_0x4048('0x0'));var util=require(_0x4048('0x1'));var logger=require(_0x4048('0x2'))(_0x4048('0x3'));var moment=require(_0x4048('0x4'));var BPromise=require(_0x4048('0x5'));var rp=require(_0x4048('0x6'));var fs=require('fs');var path=require(_0x4048('0x7'));var rimraf=require('rimraf');var config=require(_0x4048('0x8'));var attributes=require('./template.attributes');module[_0x4048('0x9')]=function(_0x402c00,_0xe4b186){return _0x402c00['define'](_0x4048('0xa'),attributes,{'tableName':_0x4048('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 22d8bcc..03f27f0 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 _0x6207=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetTemplate','Template','findAll','options','where','attributes','limit','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x9e3340,_0x24882b){var _0x33b2f8=function(_0x127846){while(--_0x127846){_0x9e3340['push'](_0x9e3340['shift']());}};_0x33b2f8(++_0x24882b);}(_0x6207,0xc0));var _0x7620=function(_0x238dc7,_0x4152ae){_0x238dc7=_0x238dc7-0x0;var _0x274da2=_0x6207[_0x238dc7];return _0x274da2;};'use strict';var _=require(_0x7620('0x0'));var util=require(_0x7620('0x1'));var moment=require(_0x7620('0x2'));var BPromise=require(_0x7620('0x3'));var rs=require(_0x7620('0x4'));var fs=require('fs');var Redis=require(_0x7620('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7620('0x6'));var logger=require(_0x7620('0x7'))(_0x7620('0x8'));var config=require(_0x7620('0x9'));var jayson=require(_0x7620('0xa'));var client=jayson[_0x7620('0xb')][_0x7620('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5499aa,_0x17f7b0,_0x45f3a3){return new BPromise(function(_0x5885dd,_0x1d8af3){return client[_0x7620('0xd')](_0x5499aa,_0x45f3a3)[_0x7620('0xe')](function(_0x4d9b5d){logger[_0x7620('0xf')](_0x7620('0x10'),_0x17f7b0,_0x7620('0x11'));logger['debug']('Template,\x20%s,\x20%s,\x20%s',_0x17f7b0,_0x7620('0x11'),JSON[_0x7620('0x12')](_0x4d9b5d));if(_0x4d9b5d[_0x7620('0x13')]){if(_0x4d9b5d[_0x7620('0x13')]['code']===0x1f4){logger[_0x7620('0x13')](_0x7620('0x10'),_0x17f7b0,_0x4d9b5d[_0x7620('0x13')][_0x7620('0x14')]);return _0x1d8af3(_0x4d9b5d[_0x7620('0x13')][_0x7620('0x14')]);}logger[_0x7620('0x13')](_0x7620('0x10'),_0x17f7b0,_0x4d9b5d[_0x7620('0x13')]['message']);return _0x5885dd(_0x4d9b5d[_0x7620('0x13')][_0x7620('0x14')]);}else{logger[_0x7620('0xf')]('Template,\x20%s,\x20%s',_0x17f7b0,'request\x20sent');_0x5885dd(_0x4d9b5d[_0x7620('0x15')][_0x7620('0x14')]);}})[_0x7620('0x16')](function(_0x58ad9a){logger['error']('Template,\x20%s,\x20%s',_0x17f7b0,_0x58ad9a);_0x1d8af3(_0x58ad9a);});});}exports[_0x7620('0x17')]=function(_0x31eff7){var _0xfb373e=this;return new Promise(function(_0x304dc5,_0x25aa31){return db[_0x7620('0x18')][_0x7620('0x19')]({'raw':_0x31eff7[_0x7620('0x1a')]?_0x31eff7['options']['raw']===undefined?!![]:![]:!![],'where':_0x31eff7['options']?_0x31eff7[_0x7620('0x1a')][_0x7620('0x1b')]||null:null,'attributes':_0x31eff7[_0x7620('0x1a')]?_0x31eff7[_0x7620('0x1a')][_0x7620('0x1c')]||null:null,'limit':_0x31eff7['options']?_0x31eff7['options'][_0x7620('0x1d')]||null:null,'include':_0x31eff7[_0x7620('0x1a')]?_0x31eff7[_0x7620('0x1a')][_0x7620('0x1e')]?_[_0x7620('0x1f')](_0x31eff7[_0x7620('0x1a')][_0x7620('0x1e')],function(_0x171f94){return{'model':db[_0x171f94[_0x7620('0x20')]],'as':_0x171f94['as'],'attributes':_0x171f94[_0x7620('0x1c')],'include':_0x171f94[_0x7620('0x1e')]?_[_0x7620('0x1f')](_0x171f94['include'],function(_0x36aa12){return{'model':db[_0x36aa12[_0x7620('0x20')]],'as':_0x36aa12['as'],'attributes':_0x36aa12[_0x7620('0x1c')],'include':_0x36aa12[_0x7620('0x1e')]?_['map'](_0x36aa12[_0x7620('0x1e')],function(_0x43c885){return{'model':db[_0x43c885[_0x7620('0x20')]],'as':_0x43c885['as'],'attributes':_0x43c885['attributes']};}):[]};}):[]};}):[]:[]})[_0x7620('0xe')](function(_0x444168){logger[_0x7620('0xf')]('GetTemplate',_0x31eff7);logger['debug'](_0x7620('0x17'),_0x31eff7,JSON[_0x7620('0x12')](_0x444168));_0x304dc5(_0x444168);})[_0x7620('0x16')](function(_0xe8d208){logger[_0x7620('0x13')](_0x7620('0x17'),_0xe8d208[_0x7620('0x14')],_0x31eff7);_0x25aa31(_0xfb373e[_0x7620('0x13')](0x1f4,_0xe8d208[_0x7620('0x14')]));});});}; \ No newline at end of file +var _0xbacb=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetTemplate','Template','findAll','options','where','attributes','limit','include','map','model','lodash','util','moment','randomstring'];(function(_0x3ad648,_0x20d769){var _0xcf3ff3=function(_0x5b7b90){while(--_0x5b7b90){_0x3ad648['push'](_0x3ad648['shift']());}};_0xcf3ff3(++_0x20d769);}(_0xbacb,0xa1));var _0xbbac=function(_0x30ec06,_0x4c6acf){_0x30ec06=_0x30ec06-0x0;var _0x571d3a=_0xbacb[_0x30ec06];return _0x571d3a;};'use strict';var _=require(_0xbbac('0x0'));var util=require(_0xbbac('0x1'));var moment=require(_0xbbac('0x2'));var BPromise=require('bluebird');var rs=require(_0xbbac('0x3'));var fs=require('fs');var Redis=require(_0xbbac('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbbac('0x5'));var logger=require(_0xbbac('0x6'))(_0xbbac('0x7'));var config=require(_0xbbac('0x8'));var jayson=require(_0xbbac('0x9'));var client=jayson[_0xbbac('0xa')][_0xbbac('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21ec30,_0x1895b6,_0x2a9d51){return new BPromise(function(_0xad13fb,_0x73f68d){return client['request'](_0x21ec30,_0x2a9d51)[_0xbbac('0xc')](function(_0x346e3d){logger[_0xbbac('0xd')](_0xbbac('0xe'),_0x1895b6,_0xbbac('0xf'));logger[_0xbbac('0x10')](_0xbbac('0x11'),_0x1895b6,'request\x20sent',JSON[_0xbbac('0x12')](_0x346e3d));if(_0x346e3d[_0xbbac('0x13')]){if(_0x346e3d['error'][_0xbbac('0x14')]===0x1f4){logger[_0xbbac('0x13')](_0xbbac('0xe'),_0x1895b6,_0x346e3d['error'][_0xbbac('0x15')]);return _0x73f68d(_0x346e3d[_0xbbac('0x13')][_0xbbac('0x15')]);}logger[_0xbbac('0x13')](_0xbbac('0xe'),_0x1895b6,_0x346e3d[_0xbbac('0x13')][_0xbbac('0x15')]);return _0xad13fb(_0x346e3d['error'][_0xbbac('0x15')]);}else{logger[_0xbbac('0xd')](_0xbbac('0xe'),_0x1895b6,_0xbbac('0xf'));_0xad13fb(_0x346e3d['result'][_0xbbac('0x15')]);}})[_0xbbac('0x16')](function(_0x2cf840){logger['error'](_0xbbac('0xe'),_0x1895b6,_0x2cf840);_0x73f68d(_0x2cf840);});});}exports[_0xbbac('0x17')]=function(_0x223485){var _0x1d86fc=this;return new Promise(function(_0x56b56f,_0xa4d929){return db[_0xbbac('0x18')][_0xbbac('0x19')]({'raw':_0x223485[_0xbbac('0x1a')]?_0x223485[_0xbbac('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x223485['options']?_0x223485[_0xbbac('0x1a')][_0xbbac('0x1b')]||null:null,'attributes':_0x223485['options']?_0x223485[_0xbbac('0x1a')][_0xbbac('0x1c')]||null:null,'limit':_0x223485['options']?_0x223485[_0xbbac('0x1a')][_0xbbac('0x1d')]||null:null,'include':_0x223485[_0xbbac('0x1a')]?_0x223485[_0xbbac('0x1a')][_0xbbac('0x1e')]?_[_0xbbac('0x1f')](_0x223485[_0xbbac('0x1a')][_0xbbac('0x1e')],function(_0x2ef11e){return{'model':db[_0x2ef11e[_0xbbac('0x20')]],'as':_0x2ef11e['as'],'attributes':_0x2ef11e[_0xbbac('0x1c')],'include':_0x2ef11e[_0xbbac('0x1e')]?_[_0xbbac('0x1f')](_0x2ef11e['include'],function(_0x37da3b){return{'model':db[_0x37da3b[_0xbbac('0x20')]],'as':_0x37da3b['as'],'attributes':_0x37da3b[_0xbbac('0x1c')],'include':_0x37da3b['include']?_[_0xbbac('0x1f')](_0x37da3b[_0xbbac('0x1e')],function(_0x259b24){return{'model':db[_0x259b24[_0xbbac('0x20')]],'as':_0x259b24['as'],'attributes':_0x259b24[_0xbbac('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xbbac('0xc')](function(_0xfbe376){logger['info'](_0xbbac('0x17'),_0x223485);logger[_0xbbac('0x10')]('GetTemplate',_0x223485,JSON[_0xbbac('0x12')](_0xfbe376));_0x56b56f(_0xfbe376);})['catch'](function(_0x49a4a6){logger[_0xbbac('0x13')](_0xbbac('0x17'),_0x49a4a6[_0xbbac('0x15')],_0x223485);_0xa4d929(_0x1d86fc[_0xbbac('0x13')](0x1f4,_0x49a4a6[_0xbbac('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 49c5645..6c5b064 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 _0xa419=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','index','/:id','isAuthenticated','show','get','/:id/all_conditions','getAllConditions','/:id/any_conditions','/:id/actions','post','create','addAnyCondition','addAction','put','destroy','exports','util','path','connect-timeout'];(function(_0xd70515,_0x50cfb3){var _0x1e9a3a=function(_0xbb7d0c){while(--_0xbb7d0c){_0xd70515['push'](_0xd70515['shift']());}};_0x1e9a3a(++_0x50cfb3);}(_0xa419,0x1dd));var _0x9a41=function(_0x4bb581,_0x6f7037){_0x4bb581=_0x4bb581-0x0;var _0x316bf5=_0xa419[_0x4bb581];return _0x316bf5;};'use strict';var multer=require('multer');var util=require(_0x9a41('0x0'));var path=require(_0x9a41('0x1'));var timeout=require(_0x9a41('0x2'));var express=require('express');var router=express[_0x9a41('0x3')]();var auth=require(_0x9a41('0x4'));var interaction=require(_0x9a41('0x5'));var config=require(_0x9a41('0x6'));var controller=require(_0x9a41('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x9a41('0x8')]);router['get'](_0x9a41('0x9'),auth[_0x9a41('0xa')](),controller[_0x9a41('0xb')]);router[_0x9a41('0xc')](_0x9a41('0xd'),auth[_0x9a41('0xa')](),controller[_0x9a41('0xe')]);router[_0x9a41('0xc')](_0x9a41('0xf'),auth[_0x9a41('0xa')](),controller['getAnyConditions']);router[_0x9a41('0xc')](_0x9a41('0x10'),auth[_0x9a41('0xa')](),controller['getActions']);router[_0x9a41('0x11')]('/',auth[_0x9a41('0xa')](),controller[_0x9a41('0x12')]);router[_0x9a41('0x11')]('/:id/all_conditions',auth[_0x9a41('0xa')](),controller['addAllCondition']);router['post']('/:id/any_conditions',auth[_0x9a41('0xa')](),controller[_0x9a41('0x13')]);router[_0x9a41('0x11')]('/:id/actions',auth[_0x9a41('0xa')](),controller[_0x9a41('0x14')]);router[_0x9a41('0x15')](_0x9a41('0x9'),auth[_0x9a41('0xa')](),controller['update']);router['delete'](_0x9a41('0x9'),auth[_0x9a41('0xa')](),controller[_0x9a41('0x16')]);module[_0x9a41('0x17')]=router; \ No newline at end of file +var _0xe1eb=['../../config/environment','./trigger.controller','get','isAuthenticated','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','getActions','post','create','addAllCondition','addAnyCondition','/:id/actions','addAction','update','delete','multer','util','connect-timeout','../../components/auth/service'];(function(_0x5bd721,_0x4a577e){var _0xe1d127=function(_0x44f0a2){while(--_0x44f0a2){_0x5bd721['push'](_0x5bd721['shift']());}};_0xe1d127(++_0x4a577e);}(_0xe1eb,0xe2));var _0xbe1e=function(_0x107f31,_0x1bcd53){_0x107f31=_0x107f31-0x0;var _0x10560c=_0xe1eb[_0x107f31];return _0x10560c;};'use strict';var multer=require(_0xbe1e('0x0'));var util=require(_0xbe1e('0x1'));var path=require('path');var timeout=require(_0xbe1e('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xbe1e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xbe1e('0x4'));var controller=require(_0xbe1e('0x5'));router[_0xbe1e('0x6')]('/',auth[_0xbe1e('0x7')](),controller['index']);router[_0xbe1e('0x6')](_0xbe1e('0x8'),auth[_0xbe1e('0x7')](),controller[_0xbe1e('0x9')]);router[_0xbe1e('0x6')](_0xbe1e('0xa'),auth[_0xbe1e('0x7')](),controller[_0xbe1e('0xb')]);router[_0xbe1e('0x6')](_0xbe1e('0xc'),auth['isAuthenticated'](),controller[_0xbe1e('0xd')]);router['get']('/:id/actions',auth[_0xbe1e('0x7')](),controller[_0xbe1e('0xe')]);router[_0xbe1e('0xf')]('/',auth[_0xbe1e('0x7')](),controller[_0xbe1e('0x10')]);router[_0xbe1e('0xf')](_0xbe1e('0xa'),auth[_0xbe1e('0x7')](),controller[_0xbe1e('0x11')]);router[_0xbe1e('0xf')](_0xbe1e('0xc'),auth[_0xbe1e('0x7')](),controller[_0xbe1e('0x12')]);router[_0xbe1e('0xf')](_0xbe1e('0x13'),auth[_0xbe1e('0x7')](),controller[_0xbe1e('0x14')]);router['put'](_0xbe1e('0x8'),auth['isAuthenticated'](),controller[_0xbe1e('0x15')]);router[_0xbe1e('0x16')](_0xbe1e('0x8'),auth[_0xbe1e('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index e700012..3d1e0c3 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 _0x8505=['BOOLEAN','sequelize','exports','STRING'];(function(_0x2433dc,_0x21c096){var _0x2a3716=function(_0x26ee5e){while(--_0x26ee5e){_0x2433dc['push'](_0x2433dc['shift']());}};_0x2a3716(++_0x21c096);}(_0x8505,0xa1));var _0x5850=function(_0x288804,_0x91ab8f){_0x288804=_0x288804-0x0;var _0x3b86ba=_0x8505[_0x288804];return _0x3b86ba;};'use strict';var Sequelize=require(_0x5850('0x0'));module[_0x5850('0x1')]={'name':{'type':Sequelize[_0x5850('0x2')]},'channel':{'type':Sequelize[_0x5850('0x2')]},'description':{'type':Sequelize[_0x5850('0x2')]},'status':{'type':Sequelize[_0x5850('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x5643=['sequelize','STRING','BOOLEAN'];(function(_0x3b3933,_0x4a5bd2){var _0x41d2c4=function(_0x4f295d){while(--_0x4f295d){_0x3b3933['push'](_0x3b3933['shift']());}};_0x41d2c4(++_0x4a5bd2);}(_0x5643,0x1dd));var _0x3564=function(_0xc61548,_0x37e4ca){_0xc61548=_0xc61548-0x0;var _0x592b6c=_0x5643[_0xc61548];return _0x592b6c;};'use strict';var Sequelize=require(_0x3564('0x0'));module['exports']={'name':{'type':Sequelize[_0x3564('0x1')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3564('0x1')]},'status':{'type':Sequelize[_0x3564('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 7d1c198..bb2df8d 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 _0x29cd=['filter','merge','options','Trigger','includeAll','include','findAll','rows','show','params','fields','length','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','order','sort','getAnyConditions','addAction','TriggerId','getActions','pick','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','set','json','apply','reject','then','destroy','get','Triggers','error','name','send','rawAttributes','type','key','map','keys','query','model','attributes','intersection','hasOwnProperty','nolimit','limit','where','filters'];(function(_0x381c80,_0x3bc995){var _0x93916c=function(_0xc8e323){while(--_0xc8e323){_0x381c80['push'](_0x381c80['shift']());}};_0x93916c(++_0x3bc995);}(_0x29cd,0x18f));var _0xd29c=function(_0x5c103f,_0x3fc776){_0x5c103f=_0x5c103f-0x0;var _0x5eb4e8=_0x29cd[_0x5c103f];return _0x5eb4e8;};'use strict';var pdf=require(_0xd29c('0x0'));var emlformat=require(_0xd29c('0x1'));var rimraf=require(_0xd29c('0x2'));var zipdir=require(_0xd29c('0x3'));var jsonpatch=require(_0xd29c('0x4'));var rp=require(_0xd29c('0x5'));var moment=require('moment');var BPromise=require(_0xd29c('0x6'));var Mustache=require(_0xd29c('0x7'));var util=require(_0xd29c('0x8'));var path=require(_0xd29c('0x9'));var sox=require(_0xd29c('0xa'));var csv=require(_0xd29c('0xb'));var ejs=require(_0xd29c('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd29c('0xd'));var crypto=require(_0xd29c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xd29c('0xf'));var toCsv=require(_0xd29c('0xb'));var querystring=require(_0xd29c('0x10'));var Papa=require(_0xd29c('0x11'));var Redis=require(_0xd29c('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd29c('0x13'));var as=require(_0xd29c('0x14'));var hardwareService=require(_0xd29c('0x15'));var logger=require(_0xd29c('0x16'))(_0xd29c('0x17'));var utils=require(_0xd29c('0x18'));var config=require(_0xd29c('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d7b6a,_0x2525e4){_0x2525e4=_0x2525e4||0xcc;return function(_0x42629b){if(_0x42629b){return _0x2d7b6a[_0xd29c('0x1a')](_0x2525e4);}return _0x2d7b6a[_0xd29c('0x1b')](_0x2525e4)[_0xd29c('0x1c')]();};}function respondWithResult(_0x3327cf,_0x34e72b){_0x34e72b=_0x34e72b||0xc8;return function(_0x3e0385){if(_0x3e0385){return _0x3327cf[_0xd29c('0x1b')](_0x34e72b)['json'](_0x3e0385);}};}function respondWithFilteredResult(_0x170574,_0x22a538){return function(_0x1763a1){if(_0x1763a1){var _0x2a9515=_0x1763a1[_0xd29c('0x1d')],_0x2653be=_0x22a538[_0xd29c('0x1e')],_0x10a78c=_0x22a538[_0xd29c('0x1e')]+_0x22a538['limit'],_0x18a503;if(_0x10a78c>=_0x2a9515){_0x10a78c=_0x2a9515;_0x18a503=0xc8;}else{_0x18a503=0xce;}_0x170574[_0xd29c('0x1b')](_0x18a503);return _0x170574[_0xd29c('0x1f')]('Content-Range',_0x2653be+'-'+_0x10a78c+'/'+_0x2a9515)[_0xd29c('0x20')](_0x1763a1);}return null;};}function patchUpdates(_0x193b20){return function(_0x153cfe){try{jsonpatch[_0xd29c('0x21')](_0x153cfe,_0x193b20,!![]);}catch(_0x26baeb){return BPromise[_0xd29c('0x22')](_0x26baeb);}return _0x153cfe['save']();};}function saveUpdates(_0x1b07e4,_0x3d2283){return function(_0x6fce04){if(_0x6fce04){return _0x6fce04['update'](_0x1b07e4)[_0xd29c('0x23')](function(_0x5e029d){return _0x5e029d;});}return null;};}function removeEntity(_0x1bf42f,_0x499482){return function(_0x564fa0){if(_0x564fa0){return _0x564fa0[_0xd29c('0x24')]()[_0xd29c('0x23')](function(){var _0x3504a8=_0x564fa0[_0xd29c('0x25')]({'plain':!![]});var _0x464628=_0xd29c('0x26');return db['UserProfileResource'][_0xd29c('0x24')]({'where':{'type':_0x464628,'resourceId':_0x3504a8['id']}})[_0xd29c('0x23')](function(){return _0x564fa0;});})[_0xd29c('0x23')](function(){_0x1bf42f[_0xd29c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x433620,_0x506042){return function(_0x10f0bb){if(!_0x10f0bb){_0x433620[_0xd29c('0x1a')](0x194);}return _0x10f0bb;};}function handleError(_0x49d124,_0x2e2529){_0x2e2529=_0x2e2529||0x1f4;return function(_0x47929c){logger[_0xd29c('0x27')](_0x47929c['stack']);if(_0x47929c['name']){delete _0x47929c[_0xd29c('0x28')];}_0x49d124[_0xd29c('0x1b')](_0x2e2529)[_0xd29c('0x29')](_0x47929c);};}exports['index']=function(_0x2fd0bf,_0x3b5ed4){var _0x17fb40={},_0x166f8f={},_0x4ee2f0={'count':0x0,'rows':[]};var _0x23dbc8=_['map'](db['Trigger'][_0xd29c('0x2a')],function(_0x2d4ebc){return{'name':_0x2d4ebc['fieldName'],'type':_0x2d4ebc[_0xd29c('0x2b')][_0xd29c('0x2c')]};});_0x166f8f['model']=_[_0xd29c('0x2d')](_0x23dbc8,'name');_0x166f8f['query']=_[_0xd29c('0x2e')](_0x2fd0bf[_0xd29c('0x2f')]);_0x166f8f['filters']=_['intersection'](_0x166f8f[_0xd29c('0x30')],_0x166f8f[_0xd29c('0x2f')]);_0x17fb40[_0xd29c('0x31')]=_[_0xd29c('0x32')](_0x166f8f[_0xd29c('0x30')],qs['fields'](_0x2fd0bf[_0xd29c('0x2f')]['fields']));_0x17fb40['attributes']=_0x17fb40[_0xd29c('0x31')]['length']?_0x17fb40['attributes']:_0x166f8f[_0xd29c('0x30')];if(!_0x2fd0bf[_0xd29c('0x2f')][_0xd29c('0x33')](_0xd29c('0x34'))){_0x17fb40['limit']=qs[_0xd29c('0x35')](_0x2fd0bf['query'][_0xd29c('0x35')]);_0x17fb40[_0xd29c('0x1e')]=qs[_0xd29c('0x1e')](_0x2fd0bf[_0xd29c('0x2f')][_0xd29c('0x1e')]);}_0x17fb40['order']=qs['sort'](_0x2fd0bf['query']['sort']);_0x17fb40[_0xd29c('0x36')]=qs[_0xd29c('0x37')](_['pick'](_0x2fd0bf['query'],_0x166f8f[_0xd29c('0x37')]),_0x23dbc8);if(_0x2fd0bf[_0xd29c('0x2f')][_0xd29c('0x38')]){_0x17fb40[_0xd29c('0x36')]=_[_0xd29c('0x39')](_0x17fb40[_0xd29c('0x36')],{'$or':_[_0xd29c('0x2d')](_0x23dbc8,function(_0x575063){if(_0x575063[_0xd29c('0x2b')]!=='VIRTUAL'){var _0xd63b6a={};_0xd63b6a[_0x575063[_0xd29c('0x28')]]={'$like':'%'+_0x2fd0bf[_0xd29c('0x2f')][_0xd29c('0x38')]+'%'};return _0xd63b6a;}})});}_0x17fb40=_[_0xd29c('0x39')]({},_0x17fb40,_0x2fd0bf[_0xd29c('0x3a')]);var _0x3cb8cf={'where':_0x17fb40[_0xd29c('0x36')]};return db[_0xd29c('0x3b')][_0xd29c('0x1d')](_0x3cb8cf)[_0xd29c('0x23')](function(_0x4f6117){_0x4ee2f0['count']=_0x4f6117;if(_0x2fd0bf[_0xd29c('0x2f')][_0xd29c('0x3c')]){_0x17fb40[_0xd29c('0x3d')]=[{'all':!![]}];}return db['Trigger'][_0xd29c('0x3e')](_0x17fb40);})['then'](function(_0x21b568){_0x4ee2f0[_0xd29c('0x3f')]=_0x21b568;return _0x4ee2f0;})[_0xd29c('0x23')](respondWithFilteredResult(_0x3b5ed4,_0x17fb40))['catch'](handleError(_0x3b5ed4,null));};exports[_0xd29c('0x40')]=function(_0x412a1c,_0xf49681){var _0x9b2b1e={'raw':![],'where':{'id':_0x412a1c[_0xd29c('0x41')]['id']}},_0x16fecf={};_0x16fecf[_0xd29c('0x30')]=_[_0xd29c('0x2e')](db[_0xd29c('0x3b')][_0xd29c('0x2a')]);_0x16fecf[_0xd29c('0x2f')]=_[_0xd29c('0x2e')](_0x412a1c[_0xd29c('0x2f')]);_0x16fecf['filters']=_[_0xd29c('0x32')](_0x16fecf[_0xd29c('0x30')],_0x16fecf[_0xd29c('0x2f')]);_0x9b2b1e[_0xd29c('0x31')]=_[_0xd29c('0x32')](_0x16fecf[_0xd29c('0x30')],qs[_0xd29c('0x42')](_0x412a1c[_0xd29c('0x2f')][_0xd29c('0x42')]));_0x9b2b1e[_0xd29c('0x31')]=_0x9b2b1e['attributes'][_0xd29c('0x43')]?_0x9b2b1e['attributes']:_0x16fecf[_0xd29c('0x30')];if(_0x412a1c['query'][_0xd29c('0x3c')]){_0x9b2b1e[_0xd29c('0x3d')]=[{'all':!![]}];}_0x9b2b1e=_[_0xd29c('0x39')]({},_0x9b2b1e,_0x412a1c[_0xd29c('0x3a')]);return db[_0xd29c('0x3b')]['find'](_0x9b2b1e)[_0xd29c('0x23')](handleEntityNotFound(_0xf49681,null))[_0xd29c('0x23')](respondWithResult(_0xf49681,null))[_0xd29c('0x44')](handleError(_0xf49681,null));};exports[_0xd29c('0x45')]=function(_0x142807,_0x572272){return db[_0xd29c('0x3b')][_0xd29c('0x45')](_0x142807['body'],{})['then'](function(_0x235035){var _0x48d918=_0x142807[_0xd29c('0x46')][_0xd29c('0x25')]({'plain':!![]});if(!_0x48d918)throw new Error(_0xd29c('0x47'));if(_0x48d918['role']===_0xd29c('0x46')){var _0x35f1ff=_0x235035['get']({'plain':!![]});var _0x7791d=_0xd29c('0x26');return db['UserProfileSection'][_0xd29c('0x48')]({'where':{'name':_0x7791d,'userProfileId':_0x48d918[_0xd29c('0x49')]},'raw':!![]})[_0xd29c('0x23')](function(_0x140b14){if(_0x140b14&&_0x140b14['autoAssociation']===0x0){return db[_0xd29c('0x4a')][_0xd29c('0x45')]({'name':_0x35f1ff[_0xd29c('0x28')],'resourceId':_0x35f1ff['id'],'type':_0x140b14[_0xd29c('0x28')],'sectionId':_0x140b14['id']},{})[_0xd29c('0x23')](function(){return _0x235035;});}else{return _0x235035;}})[_0xd29c('0x44')](function(_0x45a4db){logger[_0xd29c('0x27')](_0xd29c('0x4b'),_0x45a4db);throw _0x45a4db;});}return _0x235035;})[_0xd29c('0x23')](respondWithResult(_0x572272,0xc9))['catch'](handleError(_0x572272,null));};exports[_0xd29c('0x4c')]=function(_0x35cc01,_0x52df24){if(_0x35cc01[_0xd29c('0x4d')]['id']){delete _0x35cc01['body']['id'];}return db['Trigger'][_0xd29c('0x48')]({'where':{'id':_0x35cc01[_0xd29c('0x41')]['id']}})[_0xd29c('0x23')](handleEntityNotFound(_0x52df24,null))['then'](saveUpdates(_0x35cc01[_0xd29c('0x4d')],null))['then'](respondWithResult(_0x52df24,null))[_0xd29c('0x44')](handleError(_0x52df24,null));};exports[_0xd29c('0x24')]=function(_0x13bc80,_0x2c9afc){return db[_0xd29c('0x3b')][_0xd29c('0x48')]({'where':{'id':_0x13bc80[_0xd29c('0x41')]['id']}})['then'](handleEntityNotFound(_0x2c9afc,null))['then'](removeEntity(_0x2c9afc,null))[_0xd29c('0x44')](handleError(_0x2c9afc,null));};exports['addAllCondition']=function(_0x21a5cf,_0x143820,_0x57021a){if(_0x21a5cf[_0xd29c('0x4d')]['id']){delete _0x21a5cf[_0xd29c('0x4d')]['id'];}return db[_0xd29c('0x3b')][_0xd29c('0x48')]({'where':{'id':_0x21a5cf[_0xd29c('0x41')]['id']}})[_0xd29c('0x23')](handleEntityNotFound(_0x143820,null))[_0xd29c('0x23')](function(_0x28a2cd){if(_0x28a2cd){_0x21a5cf[_0xd29c('0x4d')][_0xd29c('0x4e')]=_0x28a2cd['id'];return db[_0xd29c('0x4f')][_0xd29c('0x45')](_0x21a5cf[_0xd29c('0x4d')]);}})[_0xd29c('0x23')](respondWithResult(_0x143820,null))[_0xd29c('0x44')](handleError(_0x143820,null));};exports[_0xd29c('0x50')]=function(_0x42dca5,_0x16f662,_0x5b603f){if(_0x42dca5[_0xd29c('0x4d')]['id']){delete _0x42dca5[_0xd29c('0x4d')]['id'];}return db['Trigger']['find']({'where':{'id':_0x42dca5[_0xd29c('0x41')]['id']}})[_0xd29c('0x23')](handleEntityNotFound(_0x16f662,null))[_0xd29c('0x23')](function(_0x280269){if(_0x280269){_0x42dca5[_0xd29c('0x4d')][_0xd29c('0x51')]=_0x280269['id'];return db['Condition']['create'](_0x42dca5[_0xd29c('0x4d')]);}})[_0xd29c('0x23')](respondWithResult(_0x16f662,null))[_0xd29c('0x44')](handleError(_0x16f662,null));};exports[_0xd29c('0x52')]=function(_0x54a478,_0xe128ac,_0x3c3edf){var _0x4bd492={};var _0x34025d={};var _0x478cc6;var _0x2490d2;return db[_0xd29c('0x3b')][_0xd29c('0x53')]({'where':{'id':_0x54a478['params']['id']}})[_0xd29c('0x23')](handleEntityNotFound(_0xe128ac,null))[_0xd29c('0x23')](function(_0x5aaebc){if(_0x5aaebc){_0x478cc6=_0x5aaebc;_0x34025d[_0xd29c('0x30')]=_[_0xd29c('0x2e')](db['Condition'][_0xd29c('0x2a')]);_0x34025d[_0xd29c('0x2f')]=_[_0xd29c('0x2e')](_0x54a478[_0xd29c('0x2f')]);_0x34025d[_0xd29c('0x37')]=_['intersection'](_0x34025d[_0xd29c('0x30')],_0x34025d[_0xd29c('0x2f')]);_0x4bd492['attributes']=_['intersection'](_0x34025d[_0xd29c('0x30')],qs[_0xd29c('0x42')](_0x54a478['query']['fields']));_0x4bd492[_0xd29c('0x31')]=_0x4bd492[_0xd29c('0x31')][_0xd29c('0x43')]?_0x4bd492[_0xd29c('0x31')]:_0x34025d[_0xd29c('0x30')];_0x4bd492[_0xd29c('0x54')]=qs[_0xd29c('0x55')](_0x54a478[_0xd29c('0x2f')][_0xd29c('0x55')]);_0x4bd492[_0xd29c('0x36')]=qs['filters'](_['pick'](_0x54a478[_0xd29c('0x2f')],_0x34025d[_0xd29c('0x37')]));if(_0x54a478['query'][_0xd29c('0x38')]){_0x4bd492['where']=_[_0xd29c('0x39')](_0x4bd492[_0xd29c('0x36')],{'$or':_['map'](_0x4bd492[_0xd29c('0x31')],function(_0xff3423){var _0x102c85={};_0x102c85[_0xff3423]={'$like':'%'+_0x54a478['query'][_0xd29c('0x38')]+'%'};return _0x102c85;})});}_0x4bd492=_[_0xd29c('0x39')]({},_0x4bd492,_0x54a478[_0xd29c('0x3a')]);return _0x478cc6[_0xd29c('0x52')](_0x4bd492);}})[_0xd29c('0x23')](function(_0x4194af){if(_0x4194af){_0x2490d2=_0x4194af['length'];if(!_0x54a478[_0xd29c('0x2f')][_0xd29c('0x33')](_0xd29c('0x34'))){_0x4bd492[_0xd29c('0x35')]=qs[_0xd29c('0x35')](_0x54a478['query'][_0xd29c('0x35')]);_0x4bd492[_0xd29c('0x1e')]=qs[_0xd29c('0x1e')](_0x54a478['query'][_0xd29c('0x1e')]);}return _0x478cc6['getAllConditions'](_0x4bd492);}})[_0xd29c('0x23')](function(_0x4c5ebc){if(_0x4c5ebc){return _0x4c5ebc?{'count':_0x2490d2,'rows':_0x4c5ebc}:null;}})[_0xd29c('0x23')](respondWithResult(_0xe128ac,null))[_0xd29c('0x44')](handleError(_0xe128ac,null));};exports[_0xd29c('0x56')]=function(_0xdbd075,_0x455f01,_0x2d43dc){var _0x5d3a20={};var _0x2d1143={};var _0x4c4b4a;var _0x4f19db;return db[_0xd29c('0x3b')][_0xd29c('0x53')]({'where':{'id':_0xdbd075[_0xd29c('0x41')]['id']}})[_0xd29c('0x23')](handleEntityNotFound(_0x455f01,null))[_0xd29c('0x23')](function(_0xb0d4f4){if(_0xb0d4f4){_0x4c4b4a=_0xb0d4f4;_0x2d1143[_0xd29c('0x30')]=_[_0xd29c('0x2e')](db[_0xd29c('0x4f')][_0xd29c('0x2a')]);_0x2d1143[_0xd29c('0x2f')]=_[_0xd29c('0x2e')](_0xdbd075[_0xd29c('0x2f')]);_0x2d1143[_0xd29c('0x37')]=_[_0xd29c('0x32')](_0x2d1143[_0xd29c('0x30')],_0x2d1143[_0xd29c('0x2f')]);_0x5d3a20[_0xd29c('0x31')]=_['intersection'](_0x2d1143[_0xd29c('0x30')],qs[_0xd29c('0x42')](_0xdbd075[_0xd29c('0x2f')][_0xd29c('0x42')]));_0x5d3a20[_0xd29c('0x31')]=_0x5d3a20['attributes'][_0xd29c('0x43')]?_0x5d3a20['attributes']:_0x2d1143[_0xd29c('0x30')];_0x5d3a20[_0xd29c('0x54')]=qs['sort'](_0xdbd075[_0xd29c('0x2f')][_0xd29c('0x55')]);_0x5d3a20[_0xd29c('0x36')]=qs[_0xd29c('0x37')](_['pick'](_0xdbd075['query'],_0x2d1143[_0xd29c('0x37')]));if(_0xdbd075[_0xd29c('0x2f')]['filter']){_0x5d3a20['where']=_[_0xd29c('0x39')](_0x5d3a20[_0xd29c('0x36')],{'$or':_[_0xd29c('0x2d')](_0x5d3a20[_0xd29c('0x31')],function(_0x3cd6c6){var _0x3eb0cd={};_0x3eb0cd[_0x3cd6c6]={'$like':'%'+_0xdbd075['query'][_0xd29c('0x38')]+'%'};return _0x3eb0cd;})});}_0x5d3a20=_[_0xd29c('0x39')]({},_0x5d3a20,_0xdbd075[_0xd29c('0x3a')]);return _0x4c4b4a[_0xd29c('0x56')](_0x5d3a20);}})[_0xd29c('0x23')](function(_0x5c8fa7){if(_0x5c8fa7){_0x4f19db=_0x5c8fa7['length'];if(!_0xdbd075[_0xd29c('0x2f')]['hasOwnProperty'](_0xd29c('0x34'))){_0x5d3a20['limit']=qs[_0xd29c('0x35')](_0xdbd075[_0xd29c('0x2f')][_0xd29c('0x35')]);_0x5d3a20[_0xd29c('0x1e')]=qs[_0xd29c('0x1e')](_0xdbd075['query'][_0xd29c('0x1e')]);}return _0x4c4b4a['getAnyConditions'](_0x5d3a20);}})[_0xd29c('0x23')](function(_0x8a2056){if(_0x8a2056){return _0x8a2056?{'count':_0x4f19db,'rows':_0x8a2056}:null;}})[_0xd29c('0x23')](respondWithResult(_0x455f01,null))[_0xd29c('0x44')](handleError(_0x455f01,null));};exports[_0xd29c('0x57')]=function(_0x2be0fd,_0x5a72a8,_0x378d93){if(_0x2be0fd[_0xd29c('0x4d')]['id']){delete _0x2be0fd[_0xd29c('0x4d')]['id'];}return db[_0xd29c('0x3b')]['find']({'where':{'id':_0x2be0fd[_0xd29c('0x41')]['id']}})[_0xd29c('0x23')](handleEntityNotFound(_0x5a72a8,null))[_0xd29c('0x23')](function(_0x1c2a69){if(_0x1c2a69){_0x2be0fd[_0xd29c('0x4d')][_0xd29c('0x58')]=_0x1c2a69['id'];return db['Action'][_0xd29c('0x45')](_0x2be0fd[_0xd29c('0x4d')]);}})[_0xd29c('0x23')](respondWithResult(_0x5a72a8,null))[_0xd29c('0x44')](handleError(_0x5a72a8,null));};exports[_0xd29c('0x59')]=function(_0x3e66b5,_0x5d383c,_0x2b3d94){var _0x1a926b={};var _0x4d1294={};var _0x39013c;var _0x3927ee;return db[_0xd29c('0x3b')][_0xd29c('0x53')]({'where':{'id':_0x3e66b5['params']['id']}})[_0xd29c('0x23')](handleEntityNotFound(_0x5d383c,null))[_0xd29c('0x23')](function(_0x1b26f0){if(_0x1b26f0){_0x39013c=_0x1b26f0;_0x4d1294[_0xd29c('0x30')]=_[_0xd29c('0x2e')](db['Action'][_0xd29c('0x2a')]);_0x4d1294[_0xd29c('0x2f')]=_[_0xd29c('0x2e')](_0x3e66b5[_0xd29c('0x2f')]);_0x4d1294[_0xd29c('0x37')]=_['intersection'](_0x4d1294[_0xd29c('0x30')],_0x4d1294[_0xd29c('0x2f')]);_0x1a926b[_0xd29c('0x31')]=_[_0xd29c('0x32')](_0x4d1294['model'],qs[_0xd29c('0x42')](_0x3e66b5[_0xd29c('0x2f')][_0xd29c('0x42')]));_0x1a926b[_0xd29c('0x31')]=_0x1a926b[_0xd29c('0x31')]['length']?_0x1a926b[_0xd29c('0x31')]:_0x4d1294[_0xd29c('0x30')];_0x1a926b['order']=qs[_0xd29c('0x55')](_0x3e66b5['query'][_0xd29c('0x55')]);_0x1a926b[_0xd29c('0x36')]=qs[_0xd29c('0x37')](_[_0xd29c('0x5a')](_0x3e66b5['query'],_0x4d1294['filters']));if(_0x3e66b5[_0xd29c('0x2f')][_0xd29c('0x38')]){_0x1a926b['where']=_[_0xd29c('0x39')](_0x1a926b['where'],{'$or':_[_0xd29c('0x2d')](_0x1a926b[_0xd29c('0x31')],function(_0x38618f){var _0x2e6fb8={};_0x2e6fb8[_0x38618f]={'$like':'%'+_0x3e66b5[_0xd29c('0x2f')][_0xd29c('0x38')]+'%'};return _0x2e6fb8;})});}_0x1a926b=_[_0xd29c('0x39')]({},_0x1a926b,_0x3e66b5['options']);return _0x39013c[_0xd29c('0x59')](_0x1a926b);}})[_0xd29c('0x23')](function(_0x5130a1){if(_0x5130a1){_0x3927ee=_0x5130a1[_0xd29c('0x43')];if(!_0x3e66b5[_0xd29c('0x2f')][_0xd29c('0x33')]('nolimit')){_0x1a926b['limit']=qs[_0xd29c('0x35')](_0x3e66b5[_0xd29c('0x2f')][_0xd29c('0x35')]);_0x1a926b[_0xd29c('0x1e')]=qs['offset'](_0x3e66b5['query']['offset']);}return _0x39013c['getActions'](_0x1a926b);}})[_0xd29c('0x23')](function(_0x107fb9){if(_0x107fb9){return _0x107fb9?{'count':_0x3927ee,'rows':_0x107fb9}:null;}})['then'](respondWithResult(_0x5d383c,null))[_0xd29c('0x44')](handleError(_0x5d383c,null));}; \ No newline at end of file +var _0x5f11=['findAll','rows','catch','show','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','filter','getAnyConditions','pick','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','reject','update','then','destroy','get','Triggers','UserProfileResource','name','index','map','Trigger','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','count'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f11,0x74));var _0x15f1=function(_0x4ede7c,_0x1ab530){_0x4ede7c=_0x4ede7c-0x0;var _0x25f157=_0x5f11[_0x4ede7c];return _0x25f157;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x15f1('0x0'));var rimraf=require(_0x15f1('0x1'));var zipdir=require(_0x15f1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x15f1('0x3'));var BPromise=require(_0x15f1('0x4'));var Mustache=require('mustache');var util=require(_0x15f1('0x5'));var path=require(_0x15f1('0x6'));var sox=require(_0x15f1('0x7'));var csv=require(_0x15f1('0x8'));var ejs=require(_0x15f1('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x15f1('0xa'));var jsforce=require(_0x15f1('0xb'));var deskjs=require(_0x15f1('0xc'));var toCsv=require(_0x15f1('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x15f1('0xd'));var authService=require(_0x15f1('0xe'));var qs=require(_0x15f1('0xf'));var as=require(_0x15f1('0x10'));var hardwareService=require(_0x15f1('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x15f1('0x12'))['db'];function respondWithStatusCode(_0x422fba,_0x44d6f1){_0x44d6f1=_0x44d6f1||0xcc;return function(_0x1c49dc){if(_0x1c49dc){return _0x422fba[_0x15f1('0x13')](_0x44d6f1);}return _0x422fba[_0x15f1('0x14')](_0x44d6f1)[_0x15f1('0x15')]();};}function respondWithResult(_0x5dda32,_0x488823){_0x488823=_0x488823||0xc8;return function(_0x3ebd8b){if(_0x3ebd8b){return _0x5dda32[_0x15f1('0x14')](_0x488823)[_0x15f1('0x16')](_0x3ebd8b);}};}function respondWithFilteredResult(_0x49ac00,_0x426cdc){return function(_0x519fb4){if(_0x519fb4){var _0x4c400c=_0x519fb4['count'],_0xa8f849=_0x426cdc[_0x15f1('0x17')],_0x4cf1e4=_0x426cdc[_0x15f1('0x17')]+_0x426cdc[_0x15f1('0x18')],_0x3272b6;if(_0x4cf1e4>=_0x4c400c){_0x4cf1e4=_0x4c400c;_0x3272b6=0xc8;}else{_0x3272b6=0xce;}_0x49ac00[_0x15f1('0x14')](_0x3272b6);return _0x49ac00['set'](_0x15f1('0x19'),_0xa8f849+'-'+_0x4cf1e4+'/'+_0x4c400c)['json'](_0x519fb4);}return null;};}function patchUpdates(_0x45ed8b){return function(_0x294473){try{jsonpatch['apply'](_0x294473,_0x45ed8b,!![]);}catch(_0x5d5dec){return BPromise[_0x15f1('0x1a')](_0x5d5dec);}return _0x294473['save']();};}function saveUpdates(_0x2f6d01,_0x4df5c7){return function(_0x198750){if(_0x198750){return _0x198750[_0x15f1('0x1b')](_0x2f6d01)[_0x15f1('0x1c')](function(_0x4542df){return _0x4542df;});}return null;};}function removeEntity(_0x1df31b,_0x3bbf70){return function(_0x34efcb){if(_0x34efcb){return _0x34efcb[_0x15f1('0x1d')]()[_0x15f1('0x1c')](function(){var _0x17642b=_0x34efcb[_0x15f1('0x1e')]({'plain':!![]});var _0x45effa=_0x15f1('0x1f');return db[_0x15f1('0x20')]['destroy']({'where':{'type':_0x45effa,'resourceId':_0x17642b['id']}})[_0x15f1('0x1c')](function(){return _0x34efcb;});})[_0x15f1('0x1c')](function(){_0x1df31b[_0x15f1('0x14')](0xcc)[_0x15f1('0x15')]();});}};}function handleEntityNotFound(_0x3a54ae,_0x442caa){return function(_0x54348e){if(!_0x54348e){_0x3a54ae[_0x15f1('0x13')](0x194);}return _0x54348e;};}function handleError(_0x56dced,_0x28a105){_0x28a105=_0x28a105||0x1f4;return function(_0x20a1ee){logger['error'](_0x20a1ee['stack']);if(_0x20a1ee['name']){delete _0x20a1ee[_0x15f1('0x21')];}_0x56dced[_0x15f1('0x14')](_0x28a105)['send'](_0x20a1ee);};}exports[_0x15f1('0x22')]=function(_0x55b12f,_0x5334a5){var _0x44236c={},_0x15c42b={},_0x43a1da={'count':0x0,'rows':[]};var _0x211b87=_[_0x15f1('0x23')](db[_0x15f1('0x24')][_0x15f1('0x25')],function(_0x46e4d4){return{'name':_0x46e4d4[_0x15f1('0x26')],'type':_0x46e4d4['type'][_0x15f1('0x27')]};});_0x15c42b[_0x15f1('0x28')]=_['map'](_0x211b87,_0x15f1('0x21'));_0x15c42b[_0x15f1('0x29')]=_[_0x15f1('0x2a')](_0x55b12f[_0x15f1('0x29')]);_0x15c42b[_0x15f1('0x2b')]=_[_0x15f1('0x2c')](_0x15c42b[_0x15f1('0x28')],_0x15c42b[_0x15f1('0x29')]);_0x44236c[_0x15f1('0x2d')]=_[_0x15f1('0x2c')](_0x15c42b['model'],qs['fields'](_0x55b12f[_0x15f1('0x29')][_0x15f1('0x2e')]));_0x44236c['attributes']=_0x44236c[_0x15f1('0x2d')][_0x15f1('0x2f')]?_0x44236c[_0x15f1('0x2d')]:_0x15c42b['model'];if(!_0x55b12f[_0x15f1('0x29')][_0x15f1('0x30')](_0x15f1('0x31'))){_0x44236c['limit']=qs['limit'](_0x55b12f[_0x15f1('0x29')][_0x15f1('0x18')]);_0x44236c[_0x15f1('0x17')]=qs[_0x15f1('0x17')](_0x55b12f['query'][_0x15f1('0x17')]);}_0x44236c[_0x15f1('0x32')]=qs['sort'](_0x55b12f[_0x15f1('0x29')][_0x15f1('0x33')]);_0x44236c[_0x15f1('0x34')]=qs['filters'](_['pick'](_0x55b12f[_0x15f1('0x29')],_0x15c42b[_0x15f1('0x2b')]),_0x211b87);if(_0x55b12f['query']['filter']){_0x44236c[_0x15f1('0x34')]=_[_0x15f1('0x35')](_0x44236c['where'],{'$or':_['map'](_0x211b87,function(_0x528767){if(_0x528767['type']!==_0x15f1('0x36')){var _0x42c7fe={};_0x42c7fe[_0x528767['name']]={'$like':'%'+_0x55b12f[_0x15f1('0x29')]['filter']+'%'};return _0x42c7fe;}})});}_0x44236c=_[_0x15f1('0x35')]({},_0x44236c,_0x55b12f['options']);var _0x4a5379={'where':_0x44236c[_0x15f1('0x34')]};return db[_0x15f1('0x24')][_0x15f1('0x37')](_0x4a5379)['then'](function(_0x372d1b){_0x43a1da[_0x15f1('0x37')]=_0x372d1b;if(_0x55b12f[_0x15f1('0x29')]['includeAll']){_0x44236c['include']=[{'all':!![]}];}return db[_0x15f1('0x24')][_0x15f1('0x38')](_0x44236c);})['then'](function(_0x47393a){_0x43a1da[_0x15f1('0x39')]=_0x47393a;return _0x43a1da;})[_0x15f1('0x1c')](respondWithFilteredResult(_0x5334a5,_0x44236c))[_0x15f1('0x3a')](handleError(_0x5334a5,null));};exports[_0x15f1('0x3b')]=function(_0x1ee9de,_0x3f3135){var _0x127085={'raw':![],'where':{'id':_0x1ee9de['params']['id']}},_0x387a25={};_0x387a25['model']=_[_0x15f1('0x2a')](db[_0x15f1('0x24')][_0x15f1('0x25')]);_0x387a25['query']=_['keys'](_0x1ee9de[_0x15f1('0x29')]);_0x387a25[_0x15f1('0x2b')]=_[_0x15f1('0x2c')](_0x387a25[_0x15f1('0x28')],_0x387a25[_0x15f1('0x29')]);_0x127085[_0x15f1('0x2d')]=_[_0x15f1('0x2c')](_0x387a25[_0x15f1('0x28')],qs[_0x15f1('0x2e')](_0x1ee9de[_0x15f1('0x29')][_0x15f1('0x2e')]));_0x127085[_0x15f1('0x2d')]=_0x127085['attributes']['length']?_0x127085[_0x15f1('0x2d')]:_0x387a25['model'];if(_0x1ee9de['query'][_0x15f1('0x3c')]){_0x127085['include']=[{'all':!![]}];}_0x127085=_[_0x15f1('0x35')]({},_0x127085,_0x1ee9de[_0x15f1('0x3d')]);return db[_0x15f1('0x24')][_0x15f1('0x3e')](_0x127085)['then'](handleEntityNotFound(_0x3f3135,null))[_0x15f1('0x1c')](respondWithResult(_0x3f3135,null))['catch'](handleError(_0x3f3135,null));};exports[_0x15f1('0x3f')]=function(_0x276a6d,_0x15ba2a){return db['Trigger'][_0x15f1('0x3f')](_0x276a6d[_0x15f1('0x40')],{})['then'](function(_0x2f7f19){var _0x925266=_0x276a6d[_0x15f1('0x41')][_0x15f1('0x1e')]({'plain':!![]});if(!_0x925266)throw new Error(_0x15f1('0x42'));if(_0x925266[_0x15f1('0x43')]===_0x15f1('0x41')){var _0x412278=_0x2f7f19['get']({'plain':!![]});var _0xaace0d=_0x15f1('0x1f');return db[_0x15f1('0x44')][_0x15f1('0x3e')]({'where':{'name':_0xaace0d,'userProfileId':_0x925266[_0x15f1('0x45')]},'raw':!![]})[_0x15f1('0x1c')](function(_0x2476c5){if(_0x2476c5&&_0x2476c5[_0x15f1('0x46')]===0x0){return db[_0x15f1('0x20')][_0x15f1('0x3f')]({'name':_0x412278[_0x15f1('0x21')],'resourceId':_0x412278['id'],'type':_0x2476c5[_0x15f1('0x21')],'sectionId':_0x2476c5['id']},{})[_0x15f1('0x1c')](function(){return _0x2f7f19;});}else{return _0x2f7f19;}})['catch'](function(_0x35d392){logger[_0x15f1('0x47')](_0x15f1('0x48'),_0x35d392);throw _0x35d392;});}return _0x2f7f19;})['then'](respondWithResult(_0x15ba2a,0xc9))[_0x15f1('0x3a')](handleError(_0x15ba2a,null));};exports[_0x15f1('0x1b')]=function(_0x5ad994,_0x2714a7){if(_0x5ad994[_0x15f1('0x40')]['id']){delete _0x5ad994[_0x15f1('0x40')]['id'];}return db[_0x15f1('0x24')][_0x15f1('0x3e')]({'where':{'id':_0x5ad994[_0x15f1('0x49')]['id']}})[_0x15f1('0x1c')](handleEntityNotFound(_0x2714a7,null))[_0x15f1('0x1c')](saveUpdates(_0x5ad994[_0x15f1('0x40')],null))['then'](respondWithResult(_0x2714a7,null))[_0x15f1('0x3a')](handleError(_0x2714a7,null));};exports[_0x15f1('0x1d')]=function(_0x17fdbe,_0x1c7646){return db[_0x15f1('0x24')]['find']({'where':{'id':_0x17fdbe[_0x15f1('0x49')]['id']}})[_0x15f1('0x1c')](handleEntityNotFound(_0x1c7646,null))[_0x15f1('0x1c')](removeEntity(_0x1c7646,null))[_0x15f1('0x3a')](handleError(_0x1c7646,null));};exports['addAllCondition']=function(_0x8ef5f4,_0x2c3f62,_0x4ad73e){if(_0x8ef5f4[_0x15f1('0x40')]['id']){delete _0x8ef5f4[_0x15f1('0x40')]['id'];}return db[_0x15f1('0x24')]['find']({'where':{'id':_0x8ef5f4[_0x15f1('0x49')]['id']}})['then'](handleEntityNotFound(_0x2c3f62,null))['then'](function(_0x3d05ff){if(_0x3d05ff){_0x8ef5f4[_0x15f1('0x40')][_0x15f1('0x4a')]=_0x3d05ff['id'];return db[_0x15f1('0x4b')][_0x15f1('0x3f')](_0x8ef5f4['body']);}})[_0x15f1('0x1c')](respondWithResult(_0x2c3f62,null))[_0x15f1('0x3a')](handleError(_0x2c3f62,null));};exports[_0x15f1('0x4c')]=function(_0x3b2235,_0x1e8e5b,_0x17ecdb){if(_0x3b2235[_0x15f1('0x40')]['id']){delete _0x3b2235[_0x15f1('0x40')]['id'];}return db['Trigger']['find']({'where':{'id':_0x3b2235[_0x15f1('0x49')]['id']}})[_0x15f1('0x1c')](handleEntityNotFound(_0x1e8e5b,null))[_0x15f1('0x1c')](function(_0x40ee11){if(_0x40ee11){_0x3b2235['body'][_0x15f1('0x4d')]=_0x40ee11['id'];return db[_0x15f1('0x4b')]['create'](_0x3b2235['body']);}})['then'](respondWithResult(_0x1e8e5b,null))['catch'](handleError(_0x1e8e5b,null));};exports[_0x15f1('0x4e')]=function(_0x20db15,_0x118f30,_0x57d860){var _0x42bd87={};var _0x38d9d6={};var _0xf4bf08;var _0x242cd2;return db['Trigger'][_0x15f1('0x4f')]({'where':{'id':_0x20db15[_0x15f1('0x49')]['id']}})[_0x15f1('0x1c')](handleEntityNotFound(_0x118f30,null))['then'](function(_0xfd4b64){if(_0xfd4b64){_0xf4bf08=_0xfd4b64;_0x38d9d6['model']=_[_0x15f1('0x2a')](db[_0x15f1('0x4b')][_0x15f1('0x25')]);_0x38d9d6[_0x15f1('0x29')]=_['keys'](_0x20db15['query']);_0x38d9d6['filters']=_[_0x15f1('0x2c')](_0x38d9d6[_0x15f1('0x28')],_0x38d9d6[_0x15f1('0x29')]);_0x42bd87[_0x15f1('0x2d')]=_[_0x15f1('0x2c')](_0x38d9d6[_0x15f1('0x28')],qs[_0x15f1('0x2e')](_0x20db15[_0x15f1('0x29')][_0x15f1('0x2e')]));_0x42bd87['attributes']=_0x42bd87[_0x15f1('0x2d')]['length']?_0x42bd87[_0x15f1('0x2d')]:_0x38d9d6[_0x15f1('0x28')];_0x42bd87[_0x15f1('0x32')]=qs[_0x15f1('0x33')](_0x20db15[_0x15f1('0x29')][_0x15f1('0x33')]);_0x42bd87[_0x15f1('0x34')]=qs[_0x15f1('0x2b')](_['pick'](_0x20db15[_0x15f1('0x29')],_0x38d9d6[_0x15f1('0x2b')]));if(_0x20db15[_0x15f1('0x29')][_0x15f1('0x50')]){_0x42bd87[_0x15f1('0x34')]=_['merge'](_0x42bd87[_0x15f1('0x34')],{'$or':_[_0x15f1('0x23')](_0x42bd87[_0x15f1('0x2d')],function(_0x51284f){var _0x2263e0={};_0x2263e0[_0x51284f]={'$like':'%'+_0x20db15[_0x15f1('0x29')][_0x15f1('0x50')]+'%'};return _0x2263e0;})});}_0x42bd87=_[_0x15f1('0x35')]({},_0x42bd87,_0x20db15[_0x15f1('0x3d')]);return _0xf4bf08['getAllConditions'](_0x42bd87);}})[_0x15f1('0x1c')](function(_0x593c24){if(_0x593c24){_0x242cd2=_0x593c24[_0x15f1('0x2f')];if(!_0x20db15[_0x15f1('0x29')][_0x15f1('0x30')]('nolimit')){_0x42bd87[_0x15f1('0x18')]=qs[_0x15f1('0x18')](_0x20db15[_0x15f1('0x29')]['limit']);_0x42bd87['offset']=qs['offset'](_0x20db15[_0x15f1('0x29')]['offset']);}return _0xf4bf08[_0x15f1('0x4e')](_0x42bd87);}})[_0x15f1('0x1c')](function(_0xfb8743){if(_0xfb8743){return _0xfb8743?{'count':_0x242cd2,'rows':_0xfb8743}:null;}})[_0x15f1('0x1c')](respondWithResult(_0x118f30,null))[_0x15f1('0x3a')](handleError(_0x118f30,null));};exports[_0x15f1('0x51')]=function(_0x327608,_0x536787,_0xf6cf7c){var _0x186d63={};var _0x378e1b={};var _0x2df1bd;var _0x342f88;return db[_0x15f1('0x24')][_0x15f1('0x4f')]({'where':{'id':_0x327608[_0x15f1('0x49')]['id']}})[_0x15f1('0x1c')](handleEntityNotFound(_0x536787,null))[_0x15f1('0x1c')](function(_0x27a825){if(_0x27a825){_0x2df1bd=_0x27a825;_0x378e1b[_0x15f1('0x28')]=_[_0x15f1('0x2a')](db[_0x15f1('0x4b')][_0x15f1('0x25')]);_0x378e1b[_0x15f1('0x29')]=_['keys'](_0x327608[_0x15f1('0x29')]);_0x378e1b[_0x15f1('0x2b')]=_[_0x15f1('0x2c')](_0x378e1b[_0x15f1('0x28')],_0x378e1b['query']);_0x186d63['attributes']=_[_0x15f1('0x2c')](_0x378e1b['model'],qs[_0x15f1('0x2e')](_0x327608[_0x15f1('0x29')][_0x15f1('0x2e')]));_0x186d63[_0x15f1('0x2d')]=_0x186d63[_0x15f1('0x2d')][_0x15f1('0x2f')]?_0x186d63[_0x15f1('0x2d')]:_0x378e1b['model'];_0x186d63[_0x15f1('0x32')]=qs[_0x15f1('0x33')](_0x327608[_0x15f1('0x29')][_0x15f1('0x33')]);_0x186d63[_0x15f1('0x34')]=qs[_0x15f1('0x2b')](_[_0x15f1('0x52')](_0x327608[_0x15f1('0x29')],_0x378e1b['filters']));if(_0x327608[_0x15f1('0x29')]['filter']){_0x186d63[_0x15f1('0x34')]=_[_0x15f1('0x35')](_0x186d63[_0x15f1('0x34')],{'$or':_[_0x15f1('0x23')](_0x186d63[_0x15f1('0x2d')],function(_0x45752a){var _0x251b4a={};_0x251b4a[_0x45752a]={'$like':'%'+_0x327608[_0x15f1('0x29')][_0x15f1('0x50')]+'%'};return _0x251b4a;})});}_0x186d63=_['merge']({},_0x186d63,_0x327608[_0x15f1('0x3d')]);return _0x2df1bd[_0x15f1('0x51')](_0x186d63);}})[_0x15f1('0x1c')](function(_0x14b4ef){if(_0x14b4ef){_0x342f88=_0x14b4ef[_0x15f1('0x2f')];if(!_0x327608[_0x15f1('0x29')][_0x15f1('0x30')](_0x15f1('0x31'))){_0x186d63[_0x15f1('0x18')]=qs[_0x15f1('0x18')](_0x327608[_0x15f1('0x29')]['limit']);_0x186d63['offset']=qs[_0x15f1('0x17')](_0x327608[_0x15f1('0x29')]['offset']);}return _0x2df1bd[_0x15f1('0x51')](_0x186d63);}})['then'](function(_0x1b2f62){if(_0x1b2f62){return _0x1b2f62?{'count':_0x342f88,'rows':_0x1b2f62}:null;}})[_0x15f1('0x1c')](respondWithResult(_0x536787,null))[_0x15f1('0x3a')](handleError(_0x536787,null));};exports['addAction']=function(_0x3a68e7,_0x53eaa4,_0x3f3033){if(_0x3a68e7[_0x15f1('0x40')]['id']){delete _0x3a68e7[_0x15f1('0x40')]['id'];}return db['Trigger'][_0x15f1('0x3e')]({'where':{'id':_0x3a68e7[_0x15f1('0x49')]['id']}})[_0x15f1('0x1c')](handleEntityNotFound(_0x53eaa4,null))[_0x15f1('0x1c')](function(_0x338d6e){if(_0x338d6e){_0x3a68e7['body'][_0x15f1('0x53')]=_0x338d6e['id'];return db[_0x15f1('0x54')][_0x15f1('0x3f')](_0x3a68e7[_0x15f1('0x40')]);}})['then'](respondWithResult(_0x53eaa4,null))[_0x15f1('0x3a')](handleError(_0x53eaa4,null));};exports['getActions']=function(_0x3773df,_0x37f523,_0x30e726){var _0x2b7271={};var _0x25b3b3={};var _0x3bad75;var _0x4eca2e;return db[_0x15f1('0x24')][_0x15f1('0x4f')]({'where':{'id':_0x3773df[_0x15f1('0x49')]['id']}})[_0x15f1('0x1c')](handleEntityNotFound(_0x37f523,null))[_0x15f1('0x1c')](function(_0x3a942b){if(_0x3a942b){_0x3bad75=_0x3a942b;_0x25b3b3['model']=_[_0x15f1('0x2a')](db['Action']['rawAttributes']);_0x25b3b3[_0x15f1('0x29')]=_[_0x15f1('0x2a')](_0x3773df[_0x15f1('0x29')]);_0x25b3b3[_0x15f1('0x2b')]=_[_0x15f1('0x2c')](_0x25b3b3[_0x15f1('0x28')],_0x25b3b3[_0x15f1('0x29')]);_0x2b7271[_0x15f1('0x2d')]=_[_0x15f1('0x2c')](_0x25b3b3[_0x15f1('0x28')],qs['fields'](_0x3773df[_0x15f1('0x29')]['fields']));_0x2b7271[_0x15f1('0x2d')]=_0x2b7271[_0x15f1('0x2d')][_0x15f1('0x2f')]?_0x2b7271['attributes']:_0x25b3b3[_0x15f1('0x28')];_0x2b7271[_0x15f1('0x32')]=qs[_0x15f1('0x33')](_0x3773df[_0x15f1('0x29')][_0x15f1('0x33')]);_0x2b7271['where']=qs[_0x15f1('0x2b')](_[_0x15f1('0x52')](_0x3773df[_0x15f1('0x29')],_0x25b3b3[_0x15f1('0x2b')]));if(_0x3773df['query']['filter']){_0x2b7271[_0x15f1('0x34')]=_['merge'](_0x2b7271[_0x15f1('0x34')],{'$or':_['map'](_0x2b7271[_0x15f1('0x2d')],function(_0x3f8586){var _0x52d86f={};_0x52d86f[_0x3f8586]={'$like':'%'+_0x3773df[_0x15f1('0x29')][_0x15f1('0x50')]+'%'};return _0x52d86f;})});}_0x2b7271=_[_0x15f1('0x35')]({},_0x2b7271,_0x3773df[_0x15f1('0x3d')]);return _0x3bad75[_0x15f1('0x55')](_0x2b7271);}})['then'](function(_0x397a93){if(_0x397a93){_0x4eca2e=_0x397a93[_0x15f1('0x2f')];if(!_0x3773df['query'][_0x15f1('0x30')](_0x15f1('0x31'))){_0x2b7271['limit']=qs[_0x15f1('0x18')](_0x3773df['query'][_0x15f1('0x18')]);_0x2b7271['offset']=qs[_0x15f1('0x17')](_0x3773df[_0x15f1('0x29')][_0x15f1('0x17')]);}return _0x3bad75[_0x15f1('0x55')](_0x2b7271);}})[_0x15f1('0x1c')](function(_0x2ca038){if(_0x2ca038){return _0x2ca038?{'count':_0x4eca2e,'rows':_0x2ca038}:null;}})[_0x15f1('0x1c')](respondWithResult(_0x37f523,null))['catch'](handleError(_0x37f523,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 38b34bb..9747155 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 _0x0e01=['lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./trigger.attributes','exports','define','Trigger','tools_triggers'];(function(_0x53e802,_0x2caee4){var _0x764bad=function(_0x1d6aee){while(--_0x1d6aee){_0x53e802['push'](_0x53e802['shift']());}};_0x764bad(++_0x2caee4);}(_0x0e01,0x68));var _0x10e0=function(_0xe41ba8,_0xfd2419){_0xe41ba8=_0xe41ba8-0x0;var _0x4872f6=_0x0e01[_0xe41ba8];return _0x4872f6;};'use strict';var _=require(_0x10e0('0x0'));var util=require(_0x10e0('0x1'));var logger=require(_0x10e0('0x2'))(_0x10e0('0x3'));var moment=require(_0x10e0('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x10e0('0x5'));var rimraf=require(_0x10e0('0x6'));var config=require(_0x10e0('0x7'));var attributes=require(_0x10e0('0x8'));module[_0x10e0('0x9')]=function(_0x679c86,_0x46a619){return _0x679c86[_0x10e0('0xa')](_0x10e0('0xb'),attributes,{'tableName':_0x10e0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5bd4=['bluebird','request-promise','path','../../config/environment','./trigger.attributes','define','Trigger','tools_triggers','lodash','util','../../config/logger','moment'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x5bd4,0x140));var _0x45bd=function(_0x40bdee,_0x26d482){_0x40bdee=_0x40bdee-0x0;var _0x12c70c=_0x5bd4[_0x40bdee];return _0x12c70c;};'use strict';var _=require(_0x45bd('0x0'));var util=require(_0x45bd('0x1'));var logger=require(_0x45bd('0x2'))('api');var moment=require(_0x45bd('0x3'));var BPromise=require(_0x45bd('0x4'));var rp=require(_0x45bd('0x5'));var fs=require('fs');var path=require(_0x45bd('0x6'));var rimraf=require('rimraf');var config=require(_0x45bd('0x7'));var attributes=require(_0x45bd('0x8'));module['exports']=function(_0x5caaf8,_0x498c17){return _0x5caaf8[_0x45bd('0x9')](_0x45bd('0xa'),attributes,{'tableName':_0x45bd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 78fa344..8223cab 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 _0x84a0=['bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Trigger,\x20%s,\x20%s','message','result','catch','Trigger','findAll','options','raw','where','attributes','limit','include','model','map','GetTrigger','ShowTrigger','find','lodash','util','moment'];(function(_0x46fa95,_0x50a76f){var _0x1b0c9f=function(_0x1003b4){while(--_0x1003b4){_0x46fa95['push'](_0x46fa95['shift']());}};_0x1b0c9f(++_0x50a76f);}(_0x84a0,0x66));var _0x084a=function(_0x5b6a6f,_0x1610a3){_0x5b6a6f=_0x5b6a6f-0x0;var _0x184768=_0x84a0[_0x5b6a6f];return _0x184768;};'use strict';var _=require(_0x084a('0x0'));var util=require(_0x084a('0x1'));var moment=require(_0x084a('0x2'));var BPromise=require(_0x084a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x084a('0x4'));var db=require(_0x084a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x084a('0x6'));var config=require(_0x084a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x084a('0x8')][_0x084a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e6810,_0x373d2,_0x2b30bc){return new BPromise(function(_0x58d419,_0x1051a9){return client[_0x084a('0xa')](_0x2e6810,_0x2b30bc)[_0x084a('0xb')](function(_0x2888e3){logger[_0x084a('0xc')]('Trigger,\x20%s,\x20%s',_0x373d2,'request\x20sent');logger[_0x084a('0xd')](_0x084a('0xe'),_0x373d2,_0x084a('0xf'),JSON[_0x084a('0x10')](_0x2888e3));if(_0x2888e3[_0x084a('0x11')]){if(_0x2888e3['error']['code']===0x1f4){logger[_0x084a('0x11')](_0x084a('0x12'),_0x373d2,_0x2888e3[_0x084a('0x11')][_0x084a('0x13')]);return _0x1051a9(_0x2888e3[_0x084a('0x11')][_0x084a('0x13')]);}logger[_0x084a('0x11')](_0x084a('0x12'),_0x373d2,_0x2888e3['error'][_0x084a('0x13')]);return _0x58d419(_0x2888e3['error'][_0x084a('0x13')]);}else{logger[_0x084a('0xc')](_0x084a('0x12'),_0x373d2,_0x084a('0xf'));_0x58d419(_0x2888e3[_0x084a('0x14')]['message']);}})[_0x084a('0x15')](function(_0x4abd81){logger[_0x084a('0x11')](_0x084a('0x12'),_0x373d2,_0x4abd81);_0x1051a9(_0x4abd81);});});}exports['GetTrigger']=function(_0xf2c333){var _0x32c729=this;return new Promise(function(_0x4134b9,_0x14bb19){return db[_0x084a('0x16')][_0x084a('0x17')]({'raw':_0xf2c333[_0x084a('0x18')]?_0xf2c333[_0x084a('0x18')][_0x084a('0x19')]===undefined?!![]:![]:!![],'where':_0xf2c333[_0x084a('0x18')]?_0xf2c333[_0x084a('0x18')][_0x084a('0x1a')]||null:null,'attributes':_0xf2c333[_0x084a('0x18')]?_0xf2c333[_0x084a('0x18')][_0x084a('0x1b')]||null:null,'limit':_0xf2c333['options']?_0xf2c333[_0x084a('0x18')][_0x084a('0x1c')]||null:null,'include':_0xf2c333[_0x084a('0x18')]?_0xf2c333[_0x084a('0x18')][_0x084a('0x1d')]?_['map'](_0xf2c333[_0x084a('0x18')][_0x084a('0x1d')],function(_0x6346a5){return{'model':db[_0x6346a5[_0x084a('0x1e')]],'as':_0x6346a5['as'],'attributes':_0x6346a5[_0x084a('0x1b')],'include':_0x6346a5[_0x084a('0x1d')]?_['map'](_0x6346a5[_0x084a('0x1d')],function(_0x2af138){return{'model':db[_0x2af138[_0x084a('0x1e')]],'as':_0x2af138['as'],'attributes':_0x2af138['attributes'],'include':_0x2af138[_0x084a('0x1d')]?_[_0x084a('0x1f')](_0x2af138[_0x084a('0x1d')],function(_0x4c5658){return{'model':db[_0x4c5658['model']],'as':_0x4c5658['as'],'attributes':_0x4c5658['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x33b88f){logger['info']('GetTrigger',_0xf2c333);logger['debug'](_0x084a('0x20'),_0xf2c333,JSON[_0x084a('0x10')](_0x33b88f));_0x4134b9(_0x33b88f);})[_0x084a('0x15')](function(_0x2c4149){logger[_0x084a('0x11')](_0x084a('0x20'),_0x2c4149[_0x084a('0x13')],_0xf2c333);_0x14bb19(_0x32c729[_0x084a('0x11')](0x1f4,_0x2c4149['message']));});});};exports[_0x084a('0x21')]=function(_0x3b2b38){var _0x501a16=this;return new Promise(function(_0xe1980b,_0x24bcf5){return db[_0x084a('0x16')][_0x084a('0x22')]({'raw':_0x3b2b38[_0x084a('0x18')]?_0x3b2b38[_0x084a('0x18')][_0x084a('0x19')]===undefined?!![]:![]:!![],'where':_0x3b2b38[_0x084a('0x18')]?_0x3b2b38[_0x084a('0x18')][_0x084a('0x1a')]||null:null,'attributes':_0x3b2b38[_0x084a('0x18')]?_0x3b2b38[_0x084a('0x18')][_0x084a('0x1b')]||null:null,'include':_0x3b2b38['options']?_0x3b2b38['options'][_0x084a('0x1d')]?_[_0x084a('0x1f')](_0x3b2b38[_0x084a('0x18')][_0x084a('0x1d')],function(_0x83f94f){return{'model':db[_0x83f94f['model']],'as':_0x83f94f['as'],'attributes':_0x83f94f[_0x084a('0x1b')],'include':_0x83f94f[_0x084a('0x1d')]?_[_0x084a('0x1f')](_0x83f94f['include'],function(_0x109593){return{'model':db[_0x109593[_0x084a('0x1e')]],'as':_0x109593['as'],'attributes':_0x109593[_0x084a('0x1b')],'include':_0x109593['include']?_['map'](_0x109593['include'],function(_0xf97d1b){return{'model':db[_0xf97d1b[_0x084a('0x1e')]],'as':_0xf97d1b['as'],'attributes':_0xf97d1b[_0x084a('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c09c3){logger[_0x084a('0xc')](_0x084a('0x21'),_0x3b2b38);logger[_0x084a('0xd')](_0x084a('0x21'),_0x3b2b38,JSON[_0x084a('0x10')](_0x3c09c3));_0xe1980b(_0x3c09c3);})[_0x084a('0x15')](function(_0x19354f){logger[_0x084a('0x11')](_0x084a('0x21'),_0x19354f[_0x084a('0x13')],_0x3b2b38);_0x24bcf5(_0x501a16[_0x084a('0x11')](0x1f4,_0x19354f[_0x084a('0x13')]));});});}; \ No newline at end of file +var _0x0fd9=['../../config/environment','jayson/promise','client','request','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','include','map','model','then','ShowTrigger','find','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x0fd9,0xa3));var _0x90fd=function(_0x164af1,_0x3cf772){_0x164af1=_0x164af1-0x0;var _0x5d81a2=_0x0fd9[_0x164af1];return _0x5d81a2;};'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')]('Trigger,\x20%s,\x20%s',_0x128c17,_0x234ba9[_0x90fd('0x11')][_0x90fd('0x13')]);return _0x2acef7(_0x234ba9[_0x90fd('0x11')]['message']);}logger[_0x90fd('0x11')]('Trigger,\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);});});}exports[_0x90fd('0x15')]=function(_0x1fcc87){var _0x4d8f3b=this;return new Promise(function(_0x3f9c76,_0x16e9e3){return db[_0x90fd('0x16')][_0x90fd('0x17')]({'raw':_0x1fcc87[_0x90fd('0x18')]?_0x1fcc87[_0x90fd('0x18')][_0x90fd('0x19')]===undefined?!![]:![]:!![],'where':_0x1fcc87[_0x90fd('0x18')]?_0x1fcc87[_0x90fd('0x18')][_0x90fd('0x1a')]||null:null,'attributes':_0x1fcc87[_0x90fd('0x18')]?_0x1fcc87[_0x90fd('0x18')][_0x90fd('0x1b')]||null:null,'limit':_0x1fcc87[_0x90fd('0x18')]?_0x1fcc87[_0x90fd('0x18')]['limit']||null:null,'include':_0x1fcc87[_0x90fd('0x18')]?_0x1fcc87[_0x90fd('0x18')][_0x90fd('0x1c')]?_[_0x90fd('0x1d')](_0x1fcc87[_0x90fd('0x18')][_0x90fd('0x1c')],function(_0x30f67e){return{'model':db[_0x30f67e[_0x90fd('0x1e')]],'as':_0x30f67e['as'],'attributes':_0x30f67e['attributes'],'include':_0x30f67e[_0x90fd('0x1c')]?_['map'](_0x30f67e[_0x90fd('0x1c')],function(_0x18d5b3){return{'model':db[_0x18d5b3[_0x90fd('0x1e')]],'as':_0x18d5b3['as'],'attributes':_0x18d5b3[_0x90fd('0x1b')],'include':_0x18d5b3[_0x90fd('0x1c')]?_['map'](_0x18d5b3[_0x90fd('0x1c')],function(_0xe333f0){return{'model':db[_0xe333f0[_0x90fd('0x1e')]],'as':_0xe333f0['as'],'attributes':_0xe333f0[_0x90fd('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x90fd('0x1f')](function(_0x428bc2){logger['info']('GetTrigger',_0x1fcc87);logger[_0x90fd('0xe')](_0x90fd('0x15'),_0x1fcc87,JSON[_0x90fd('0x10')](_0x428bc2));_0x3f9c76(_0x428bc2);})[_0x90fd('0x14')](function(_0x397aaf){logger['error']('GetTrigger',_0x397aaf[_0x90fd('0x13')],_0x1fcc87);_0x16e9e3(_0x4d8f3b[_0x90fd('0x11')](0x1f4,_0x397aaf[_0x90fd('0x13')]));});});};exports[_0x90fd('0x20')]=function(_0x4a3ae4){var _0x59aede=this;return new Promise(function(_0x12dea4,_0x21a9cf){return db[_0x90fd('0x16')][_0x90fd('0x21')]({'raw':_0x4a3ae4['options']?_0x4a3ae4[_0x90fd('0x18')][_0x90fd('0x19')]===undefined?!![]:![]:!![],'where':_0x4a3ae4[_0x90fd('0x18')]?_0x4a3ae4[_0x90fd('0x18')][_0x90fd('0x1a')]||null:null,'attributes':_0x4a3ae4[_0x90fd('0x18')]?_0x4a3ae4[_0x90fd('0x18')][_0x90fd('0x1b')]||null:null,'include':_0x4a3ae4[_0x90fd('0x18')]?_0x4a3ae4[_0x90fd('0x18')][_0x90fd('0x1c')]?_[_0x90fd('0x1d')](_0x4a3ae4[_0x90fd('0x18')][_0x90fd('0x1c')],function(_0x209e5c){return{'model':db[_0x209e5c[_0x90fd('0x1e')]],'as':_0x209e5c['as'],'attributes':_0x209e5c['attributes'],'include':_0x209e5c[_0x90fd('0x1c')]?_[_0x90fd('0x1d')](_0x209e5c[_0x90fd('0x1c')],function(_0x3aee5){return{'model':db[_0x3aee5[_0x90fd('0x1e')]],'as':_0x3aee5['as'],'attributes':_0x3aee5[_0x90fd('0x1b')],'include':_0x3aee5[_0x90fd('0x1c')]?_[_0x90fd('0x1d')](_0x3aee5[_0x90fd('0x1c')],function(_0x186f4f){return{'model':db[_0x186f4f[_0x90fd('0x1e')]],'as':_0x186f4f['as'],'attributes':_0x186f4f[_0x90fd('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x90fd('0x1f')](function(_0x4c20b0){logger[_0x90fd('0xb')](_0x90fd('0x20'),_0x4a3ae4);logger[_0x90fd('0xe')](_0x90fd('0x20'),_0x4a3ae4,JSON['stringify'](_0x4c20b0));_0x12dea4(_0x4c20b0);})[_0x90fd('0x14')](function(_0x2c4f37){logger[_0x90fd('0x11')]('ShowTrigger',_0x2c4f37['message'],_0x4a3ae4);_0x21a9cf(_0x59aede[_0x90fd('0x11')](0x1f4,_0x2c4f37[_0x90fd('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index e6e068d..e637bc5 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 _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(_0x3ac921,_0x464683){var _0x13f1c9=function(_0x123c83){while(--_0x123c83){_0x3ac921['push'](_0x3ac921['shift']());}};_0x13f1c9(++_0x464683);}(_0x008c,0x188));var _0xc008=function(_0x28c870,_0x1bf349){_0x28c870=_0x28c870-0x0;var _0x5e4de6=_0x008c[_0x28c870];return _0x5e4de6;};'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 +var _0x9957=['/:id/clone','clone','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post'];(function(_0x43cd45,_0x472601){var _0x1c6333=function(_0x3630ef){while(--_0x3630ef){_0x43cd45['push'](_0x43cd45['shift']());}};_0x1c6333(++_0x472601);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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('./trunk.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['show']);router[_0x7995('0xc')](_0x7995('0xd'),auth['isAuthenticated'](),controller[_0x7995('0xe')]);router[_0x7995('0xc')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['update']);router[_0x7995('0x11')](_0x7995('0xb'),auth['isAuthenticated'](),controller[_0x7995('0x12')]);module[_0x7995('0x13')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index ef55197..3bbed14 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 _0x8d67=['user','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','shortinfo','auto','rfc2833','yes','nonat','outgoing','force_rport,comedia','setDataValue','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','originate','uac','uas','pai','fingerprint','certificate','actpass','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend'];(function(_0x162802,_0x555c15){var _0x24d606=function(_0x4eff2f){while(--_0x4eff2f){_0x162802['push'](_0x162802['shift']());}};_0x24d606(++_0x555c15);}(_0x8d67,0xea));var _0x78d6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8d67[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x78d6('0x0'));module[_0x78d6('0x1')]={'name':{'type':Sequelize[_0x78d6('0x2')],'allowNull':![],'unique':_0x78d6('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x78d6('0x4')](_0x78d6('0x5'),_0x78d6('0x6'),'peer'),'allowNull':![],'defaultValue':_0x78d6('0x5')},'context':{'type':Sequelize[_0x78d6('0x2')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x78d6('0x4')]('ALLOWED_NOT_SCREENED',_0x78d6('0x7'),_0x78d6('0x8'),_0x78d6('0x9'),_0x78d6('0xa'),_0x78d6('0xb'),_0x78d6('0xc'),'PROHIB')},'deny':{'type':Sequelize[_0x78d6('0x2')]},'permit':{'type':Sequelize[_0x78d6('0x2')]},'secret':{'type':Sequelize[_0x78d6('0x2')]},'md5secret':{'type':Sequelize[_0x78d6('0x2')]},'remotesecret':{'type':Sequelize[_0x78d6('0x2')]},'transport':{'type':Sequelize['STRING'],'defaultValue':'udp','set':function(_0x283d09){this['setDataValue'](_0x78d6('0xd'),_0x283d09?_0x283d09['join'](','):null);},'get':function(){return this['getDataValue'](_0x78d6('0xd'))?this[_0x78d6('0xe')](_0x78d6('0xd'))[_0x78d6('0xf')](','):null;},'comment':_0x78d6('0x10')},'dtmfmode':{'type':Sequelize[_0x78d6('0x4')]('rfc2833','info',_0x78d6('0x11'),'inband',_0x78d6('0x12')),'defaultValue':_0x78d6('0x13')},'directmedia':{'type':Sequelize[_0x78d6('0x4')](_0x78d6('0x14'),'no',_0x78d6('0x15'),'update',_0x78d6('0x16')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x78d6('0x4')](_0x78d6('0x14'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x78d6('0x2')]},'directmediadeny':{'type':Sequelize[_0x78d6('0x2')]},'nat':{'type':Sequelize[_0x78d6('0x2')],'defaultValue':_0x78d6('0x17'),'set':function(_0x3c957d){this[_0x78d6('0x18')]('nat',_0x3c957d?_0x3c957d['join'](','):null);},'get':function(){return this[_0x78d6('0xe')](_0x78d6('0x19'))?this['getDataValue'](_0x78d6('0x19'))[_0x78d6('0xf')](','):null;},'comment':_0x78d6('0x1a')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x78d6('0x2')]},'pickupgroup':{'type':Sequelize[_0x78d6('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x78d6('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x78d6('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x78d6('0x2')],'defaultValue':_0x78d6('0x1b')},'allow':{'type':Sequelize[_0x78d6('0x2')],'allowNull':![],'defaultValue':_0x78d6('0x1c'),'set':function(_0x2ce0d0){this['setDataValue'](_0x78d6('0x1d'),_0x2ce0d0?_0x2ce0d0[_0x78d6('0x1e')](';'):_0x78d6('0x1c'));},'get':function(){return this[_0x78d6('0xe')](_0x78d6('0x1d'))?this[_0x78d6('0xe')](_0x78d6('0x1d'))[_0x78d6('0xf')](';'):null;},'comment':_0x78d6('0x1f')},'autoframing':{'type':Sequelize['ENUM']('yes','no')},'insecure':{'type':Sequelize[_0x78d6('0x2')],'defaultValue':_0x78d6('0x20'),'set':function(_0x493902){this[_0x78d6('0x18')](_0x78d6('0x21'),_0x493902?_0x493902[_0x78d6('0x1e')](','):null);},'get':function(){return this[_0x78d6('0xe')](_0x78d6('0x21'))?this[_0x78d6('0xe')](_0x78d6('0x21'))[_0x78d6('0xf')](','):null;},'comment':_0x78d6('0x22')},'trustrpid':{'type':Sequelize[_0x78d6('0x4')](_0x78d6('0x14'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x78d6('0x4')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x78d6('0x14'),'no',_0x78d6('0x23'))},'promiscredir':{'type':Sequelize[_0x78d6('0x4')](_0x78d6('0x14'),'no')},'useclientcode':{'type':Sequelize[_0x78d6('0x4')](_0x78d6('0x14'),'no')},'accountcode':{'type':Sequelize[_0x78d6('0x24')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x78d6('0x2')],'defaultValue':_0x78d6('0x25')},'amaflags':{'type':Sequelize[_0x78d6('0x2')]},'callcounter':{'type':Sequelize['ENUM'](_0x78d6('0x14'),'no'),'defaultValue':_0x78d6('0x14')},'busylevel':{'type':Sequelize[_0x78d6('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0x78d6('0x4')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0x78d6('0x4')](_0x78d6('0x14'),'no')},'allowtransfer':{'type':Sequelize[_0x78d6('0x4')](_0x78d6('0x14'),'no')},'ignoresdpversion':{'type':Sequelize[_0x78d6('0x4')](_0x78d6('0x14'),'no')},'subscribecontext':{'type':Sequelize[_0x78d6('0x2')]},'template':{'type':Sequelize[_0x78d6('0x2')]},'videosupport':{'type':Sequelize['ENUM'](_0x78d6('0x14'),'no',_0x78d6('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x78d6('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x78d6('0x4')]('yes','no')},'mailbox':{'type':Sequelize[_0x78d6('0x2')]},'session_timers':{'type':Sequelize[_0x78d6('0x4')](_0x78d6('0x27'),'refuse',_0x78d6('0x28'))},'session_expires':{'type':Sequelize[_0x78d6('0x24')](0xb)},'session_minse':{'type':Sequelize[_0x78d6('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0x78d6('0x4')](_0x78d6('0x29'),_0x78d6('0x2a')),'defaultValue':_0x78d6('0x2a')},'t38pt_usertpsource':{'type':Sequelize[_0x78d6('0x2')]},'regexten':{'type':Sequelize[_0x78d6('0x2')]},'fromdomain':{'type':Sequelize[_0x78d6('0x2')]},'fromuser':{'type':Sequelize[_0x78d6('0x2')]},'port':{'type':Sequelize[_0x78d6('0x24')](0x5)},'qualify':{'type':Sequelize[_0x78d6('0x4')](_0x78d6('0x14'),'no'),'defaultValue':_0x78d6('0x14')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x78d6('0x2')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x78d6('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x78d6('0x4')](_0x78d6('0x14'),'no',_0x78d6('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x78d6('0x2')]},'callbackextension':{'type':Sequelize[_0x78d6('0x2')]},'timert1':{'type':Sequelize[_0x78d6('0x24')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x78d6('0x2')]},'contactdeny':{'type':Sequelize[_0x78d6('0x2')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x78d6('0x2')]},'use_q850_reason':{'type':Sequelize[_0x78d6('0x2')]},'maxforwards':{'type':Sequelize[_0x78d6('0x24')](0xb)},'encryption':{'type':Sequelize[_0x78d6('0x4')](_0x78d6('0x14'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x78d6('0x4')](_0x78d6('0x14'),'no')},'force_avp':{'type':Sequelize[_0x78d6('0x4')](_0x78d6('0x14'),'no')},'icesupport':{'type':Sequelize[_0x78d6('0x4')](_0x78d6('0x14'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x78d6('0x14'),'no')},'dtlsverify':{'type':Sequelize[_0x78d6('0x4')](_0x78d6('0x14'),'no',_0x78d6('0x2c'),_0x78d6('0x2d'))},'dtlsrekey':{'type':Sequelize[_0x78d6('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0x78d6('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x78d6('0x2')]},'dtlscipher':{'type':Sequelize[_0x78d6('0x2')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x78d6('0x2')]},'dtlssetup':{'type':Sequelize['ENUM']('active','passive',_0x78d6('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x78d6('0x2')]},'usereqphone':{'type':Sequelize[_0x78d6('0x4')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x78d6('0x2')]},'recordofffeature':{'type':Sequelize[_0x78d6('0x2')]},'call_limit':{'type':Sequelize[_0x78d6('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x78d6('0x4')](_0x78d6('0x14'),'no')},'subscribemwi':{'type':Sequelize[_0x78d6('0x4')](_0x78d6('0x14'),'no')},'vmexten':{'type':Sequelize[_0x78d6('0x2')]},'mohinterpret':{'type':Sequelize[_0x78d6('0x2')]},'mohsuggest':{'type':Sequelize[_0x78d6('0x2')]},'parkinglot':{'type':Sequelize[_0x78d6('0x2')]},'description':{'type':Sequelize[_0x78d6('0x2')]},'host':{'type':Sequelize[_0x78d6('0x2')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x78d6('0x4')]('yes','no','nonat','update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x78d6('0x2')]},'otherFields':{'type':Sequelize[_0x78d6('0x2')]},'active':{'type':Sequelize[_0x78d6('0x2f')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x78d6('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x8c4a=['active','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','name','user','peer','friend','from-voip-provider','ENUM','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','getDataValue','split','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','setDataValue','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','uac','uas','pai','fingerprint'];(function(_0x2aff38,_0x38e115){var _0x2f62e5=function(_0x342dbc){while(--_0x342dbc){_0x2aff38['push'](_0x2aff38['shift']());}};_0x2f62e5(++_0x38e115);}(_0x8c4a,0x1ec));var _0xa8c4=function(_0x2ac967,_0x45dc75){_0x2ac967=_0x2ac967-0x0;var _0x153142=_0x8c4a[_0x2ac967];return _0x153142;};'use strict';var Sequelize=require(_0xa8c4('0x0'));module[_0xa8c4('0x1')]={'name':{'type':Sequelize[_0xa8c4('0x2')],'allowNull':![],'unique':_0xa8c4('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('friend',_0xa8c4('0x4'),_0xa8c4('0x5')),'allowNull':![],'defaultValue':_0xa8c4('0x6')},'context':{'type':Sequelize[_0xa8c4('0x2')],'allowNull':![],'defaultValue':_0xa8c4('0x7')},'callingpres':{'type':Sequelize[_0xa8c4('0x8')]('ALLOWED_NOT_SCREENED',_0xa8c4('0x9'),_0xa8c4('0xa'),_0xa8c4('0xb'),_0xa8c4('0xc'),_0xa8c4('0xd'),_0xa8c4('0xe'),_0xa8c4('0xf'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0xa8c4('0x2')]},'secret':{'type':Sequelize[_0xa8c4('0x2')]},'md5secret':{'type':Sequelize[_0xa8c4('0x2')]},'remotesecret':{'type':Sequelize[_0xa8c4('0x2')]},'transport':{'type':Sequelize[_0xa8c4('0x2')],'defaultValue':_0xa8c4('0x10'),'set':function(_0x3280ec){this['setDataValue'](_0xa8c4('0x11'),_0x3280ec?_0x3280ec[_0xa8c4('0x12')](','):null);},'get':function(){return this[_0xa8c4('0x13')]('transport')?this['getDataValue'](_0xa8c4('0x11'))[_0xa8c4('0x14')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xa8c4('0x8')](_0xa8c4('0x15'),_0xa8c4('0x16'),_0xa8c4('0x17'),_0xa8c4('0x18'),_0xa8c4('0x19')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xa8c4('0x8')](_0xa8c4('0x1a'),'no',_0xa8c4('0x1b'),_0xa8c4('0x1c'),_0xa8c4('0x1d')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xa8c4('0x8')](_0xa8c4('0x1a'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xa8c4('0x2')]},'directmediadeny':{'type':Sequelize[_0xa8c4('0x2')]},'nat':{'type':Sequelize['STRING'],'defaultValue':'force_rport,comedia','set':function(_0x1b9168){this[_0xa8c4('0x1e')](_0xa8c4('0x1f'),_0x1b9168?_0x1b9168[_0xa8c4('0x12')](','):null);},'get':function(){return this['getDataValue'](_0xa8c4('0x1f'))?this[_0xa8c4('0x13')](_0xa8c4('0x1f'))[_0xa8c4('0x14')](','):null;},'comment':_0xa8c4('0x20')},'callgroup':{'type':Sequelize[_0xa8c4('0x2')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xa8c4('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xa8c4('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xa8c4('0x2')],'defaultValue':'all'},'allow':{'type':Sequelize[_0xa8c4('0x2')],'allowNull':![],'defaultValue':_0xa8c4('0x21'),'set':function(_0x5ec8c3){this[_0xa8c4('0x1e')](_0xa8c4('0x22'),_0x5ec8c3?_0x5ec8c3[_0xa8c4('0x12')](';'):_0xa8c4('0x21'));},'get':function(){return this[_0xa8c4('0x13')](_0xa8c4('0x22'))?this[_0xa8c4('0x13')](_0xa8c4('0x22'))[_0xa8c4('0x14')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0xa8c4('0x1a'),'no')},'insecure':{'type':Sequelize[_0xa8c4('0x2')],'defaultValue':_0xa8c4('0x23'),'set':function(_0x577451){this[_0xa8c4('0x1e')](_0xa8c4('0x24'),_0x577451?_0x577451[_0xa8c4('0x12')](','):null);},'get':function(){return this[_0xa8c4('0x13')](_0xa8c4('0x24'))?this[_0xa8c4('0x13')](_0xa8c4('0x24'))['split'](','):null;},'comment':_0xa8c4('0x25')},'trustrpid':{'type':Sequelize[_0xa8c4('0x8')](_0xa8c4('0x1a'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xa8c4('0x1a'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xa8c4('0x8')](_0xa8c4('0x1a'),'no',_0xa8c4('0x26'))},'promiscredir':{'type':Sequelize['ENUM'](_0xa8c4('0x1a'),'no')},'useclientcode':{'type':Sequelize[_0xa8c4('0x8')](_0xa8c4('0x1a'),'no')},'accountcode':{'type':Sequelize[_0xa8c4('0x27')](0xb)},'setvar':{'type':Sequelize[_0xa8c4('0x2')]},'callerid':{'type':Sequelize[_0xa8c4('0x2')],'defaultValue':_0xa8c4('0x28')},'amaflags':{'type':Sequelize[_0xa8c4('0x2')]},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xa8c4('0x27')](0xb)},'allowoverlap':{'type':Sequelize[_0xa8c4('0x8')](_0xa8c4('0x1a'),'no')},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no')},'allowtransfer':{'type':Sequelize[_0xa8c4('0x8')](_0xa8c4('0x1a'),'no')},'ignoresdpversion':{'type':Sequelize[_0xa8c4('0x8')]('yes','no')},'subscribecontext':{'type':Sequelize[_0xa8c4('0x2')]},'template':{'type':Sequelize[_0xa8c4('0x2')]},'videosupport':{'type':Sequelize[_0xa8c4('0x8')](_0xa8c4('0x1a'),'no',_0xa8c4('0x29')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xa8c4('0x27')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xa8c4('0x8')](_0xa8c4('0x1a'),'no')},'mailbox':{'type':Sequelize[_0xa8c4('0x2')]},'session_timers':{'type':Sequelize[_0xa8c4('0x8')](_0xa8c4('0x2a'),_0xa8c4('0x2b'),'originate')},'session_expires':{'type':Sequelize[_0xa8c4('0x27')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0xa8c4('0x8')](_0xa8c4('0x2c'),_0xa8c4('0x2d')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xa8c4('0x2')]},'regexten':{'type':Sequelize[_0xa8c4('0x2')]},'fromdomain':{'type':Sequelize[_0xa8c4('0x2')]},'fromuser':{'type':Sequelize[_0xa8c4('0x2')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0xa8c4('0x8')](_0xa8c4('0x1a'),'no'),'defaultValue':_0xa8c4('0x1a')},'keepalive':{'type':Sequelize[_0xa8c4('0x27')](0xb)},'defaultip':{'type':Sequelize[_0xa8c4('0x2')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0xa8c4('0x27')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xa8c4('0x27')](0xb)},'sendrpid':{'type':Sequelize[_0xa8c4('0x8')](_0xa8c4('0x1a'),'no',_0xa8c4('0x2e')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0xa8c4('0x2')]},'timert1':{'type':Sequelize[_0xa8c4('0x27')](0xb)},'timerb':{'type':Sequelize[_0xa8c4('0x27')](0xb)},'qualifyfreq':{'type':Sequelize[_0xa8c4('0x27')](0xb)},'contactpermit':{'type':Sequelize[_0xa8c4('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0xa8c4('0x2')]},'use_q850_reason':{'type':Sequelize[_0xa8c4('0x2')]},'maxforwards':{'type':Sequelize[_0xa8c4('0x27')](0xb)},'encryption':{'type':Sequelize[_0xa8c4('0x8')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xa8c4('0x8')](_0xa8c4('0x1a'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0xa8c4('0x1a'),'no')},'icesupport':{'type':Sequelize[_0xa8c4('0x8')](_0xa8c4('0x1a'),'no')},'dtlsenable':{'type':Sequelize['ENUM']('yes','no')},'dtlsverify':{'type':Sequelize[_0xa8c4('0x8')]('yes','no',_0xa8c4('0x2f'),'certificate')},'dtlsrekey':{'type':Sequelize[_0xa8c4('0x27')](0xb)},'dtlscertfile':{'type':Sequelize[_0xa8c4('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xa8c4('0x2')]},'dtlscipher':{'type':Sequelize[_0xa8c4('0x2')]},'dtlscafile':{'type':Sequelize[_0xa8c4('0x2')]},'dtlscapath':{'type':Sequelize[_0xa8c4('0x2')]},'dtlssetup':{'type':Sequelize[_0xa8c4('0x8')](_0xa8c4('0x30'),_0xa8c4('0x31'),_0xa8c4('0x32')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xa8c4('0x8')](_0xa8c4('0x1a'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0xa8c4('0x2')]},'call_limit':{'type':Sequelize[_0xa8c4('0x27')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xa8c4('0x8')](_0xa8c4('0x1a'),'no')},'subscribemwi':{'type':Sequelize[_0xa8c4('0x8')](_0xa8c4('0x1a'),'no')},'vmexten':{'type':Sequelize[_0xa8c4('0x2')]},'mohinterpret':{'type':Sequelize[_0xa8c4('0x2')]},'mohsuggest':{'type':Sequelize[_0xa8c4('0x2')]},'parkinglot':{'type':Sequelize[_0xa8c4('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xa8c4('0x2')],'defaultValue':_0xa8c4('0x33')},'canreinvite':{'type':Sequelize[_0xa8c4('0x8')]('yes','no',_0xa8c4('0x1b'),_0xa8c4('0x1c'),_0xa8c4('0x34')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xa8c4('0x2')]},'otherFields':{'type':Sequelize[_0xa8c4('0x2')]},'active':{'type':Sequelize[_0xa8c4('0x35')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xa8c4('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 ccff932..92ed159 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 _0xcf66=['/etc/asterisk/sip_xcally_registers.conf','Reload','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','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','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','status','end','json','offset','set','Content-Range','reject','save','update','destroy','get','Trunks','UserProfileResource','sendStatus','stack','name','send','index','Trunk','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','clone','find','createdAt','updatedAt','body','omit','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','readFileSync','root','server/files/templates/trunk.ejs','utf8','join','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','chan_sip.so','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x58ed82,_0x26d569){var _0x2df0a1=function(_0x1d7994){while(--_0x1d7994){_0x58ed82['push'](_0x58ed82['shift']());}};_0x2df0a1(++_0x26d569);}(_0xcf66,0x71));var _0x6cf6=function(_0x7da053,_0x35e1ac){_0x7da053=_0x7da053-0x0;var _0x2d9ce5=_0xcf66[_0x7da053];return _0x2d9ce5;};'use strict';var pdf=require(_0x6cf6('0x0'));var emlformat=require(_0x6cf6('0x1'));var rimraf=require(_0x6cf6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6cf6('0x3'));var rp=require(_0x6cf6('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6cf6('0x5'));var util=require(_0x6cf6('0x6'));var path=require('path');var sox=require(_0x6cf6('0x7'));var csv=require(_0x6cf6('0x8'));var ejs=require(_0x6cf6('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6cf6('0xa'));var crypto=require(_0x6cf6('0xb'));var jsforce=require(_0x6cf6('0xc'));var deskjs=require(_0x6cf6('0xd'));var toCsv=require(_0x6cf6('0x8'));var querystring=require(_0x6cf6('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6cf6('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6cf6('0x10'));var logger=require(_0x6cf6('0x11'))(_0x6cf6('0x12'));var utils=require(_0x6cf6('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x6cf6('0x14')][_0x6cf6('0x15')]({'port':0x232a});function checkPasswordPattern(_0x372d12,_0x39e8c3,_0x3e62a7){if(_0x3e62a7){var _0x114c2c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x114c2c['test'](_0x39e8c3)){return _0x372d12;}else{throw new db[(_0x6cf6('0x16'))]['ValidationError'](_0x6cf6('0x17'));}}else{return _0x372d12;}}function respondWithRpcPromise(_0x18360e,_0x4b073f,_0x40e413,_0x1b40f8){return new BPromise(function(_0x2d23ab,_0x74486a){var _0x2b6d7b=_0x1b40f8||client;return _0x2b6d7b[_0x6cf6('0x18')](_0x18360e,_0x40e413)[_0x6cf6('0x19')](function(_0x39ec25){logger[_0x6cf6('0x1a')](_0x6cf6('0x1b'),_0x4b073f,'request\x20sent');logger[_0x6cf6('0x1c')](_0x6cf6('0x1d'),_0x4b073f,_0x6cf6('0x1e'),JSON['stringify'](_0x39ec25));if(_0x39ec25[_0x6cf6('0x1f')]){if(_0x39ec25[_0x6cf6('0x1f')][_0x6cf6('0x20')]===0x1f4){logger[_0x6cf6('0x1f')](_0x6cf6('0x1b'),_0x4b073f,_0x39ec25[_0x6cf6('0x1f')][_0x6cf6('0x21')]);return _0x74486a(_0x39ec25['error'][_0x6cf6('0x21')]);}logger[_0x6cf6('0x1f')](_0x6cf6('0x1b'),_0x4b073f,_0x39ec25[_0x6cf6('0x1f')][_0x6cf6('0x21')]);return _0x2d23ab(_0x39ec25[_0x6cf6('0x1f')][_0x6cf6('0x21')]);}else{logger[_0x6cf6('0x1a')]('Trunk,\x20%s,\x20%s',_0x4b073f,'request\x20sent');_0x2d23ab(_0x39ec25[_0x6cf6('0x22')]['message']);}})[_0x6cf6('0x23')](function(_0x18c8cd){logger[_0x6cf6('0x1f')](_0x6cf6('0x1b'),_0x4b073f,_0x18c8cd);_0x74486a(_0x18c8cd);});});}function respondWithStatusCode(_0x3f9871,_0x565fad){_0x565fad=_0x565fad||0xcc;return function(_0x1c966e){if(_0x1c966e){return _0x3f9871['sendStatus'](_0x565fad);}return _0x3f9871[_0x6cf6('0x24')](_0x565fad)[_0x6cf6('0x25')]();};}function respondWithResult(_0x3eaa31,_0x558405){_0x558405=_0x558405||0xc8;return function(_0xf4eec5){if(_0xf4eec5){return _0x3eaa31[_0x6cf6('0x24')](_0x558405)[_0x6cf6('0x26')](_0xf4eec5);}};}function respondWithFilteredResult(_0x1f5a88,_0x5c9236){return function(_0x584594){if(_0x584594){var _0x2afe84=_0x584594['count'],_0x4521af=_0x5c9236[_0x6cf6('0x27')],_0x57099f=_0x5c9236['offset']+_0x5c9236['limit'],_0x5869e9;if(_0x57099f>=_0x2afe84){_0x57099f=_0x2afe84;_0x5869e9=0xc8;}else{_0x5869e9=0xce;}_0x1f5a88['status'](_0x5869e9);return _0x1f5a88[_0x6cf6('0x28')](_0x6cf6('0x29'),_0x4521af+'-'+_0x57099f+'/'+_0x2afe84)[_0x6cf6('0x26')](_0x584594);}return null;};}function patchUpdates(_0x42f488){return function(_0x11c848){try{jsonpatch['apply'](_0x11c848,_0x42f488,!![]);}catch(_0x348d9e){return BPromise[_0x6cf6('0x2a')](_0x348d9e);}return _0x11c848[_0x6cf6('0x2b')]();};}function saveUpdates(_0x535b28,_0x3c4b7a){return function(_0x145363){if(_0x145363){return _0x145363[_0x6cf6('0x2c')](_0x535b28)[_0x6cf6('0x19')](function(_0x197c7e){return _0x197c7e;});}return null;};}function removeEntity(_0x1339a2,_0x11f66d){return function(_0xb77709){if(_0xb77709){return _0xb77709[_0x6cf6('0x2d')]()[_0x6cf6('0x19')](function(){var _0x16d34f=_0xb77709[_0x6cf6('0x2e')]({'plain':!![]});var _0x4620b6=_0x6cf6('0x2f');return db[_0x6cf6('0x30')][_0x6cf6('0x2d')]({'where':{'type':_0x4620b6,'resourceId':_0x16d34f['id']}})[_0x6cf6('0x19')](function(){return _0xb77709;});})[_0x6cf6('0x19')](function(){_0x1339a2['status'](0xcc)[_0x6cf6('0x25')]();});}};}function handleEntityNotFound(_0x3314a3,_0x19e94d){return function(_0xa1f482){if(!_0xa1f482){_0x3314a3[_0x6cf6('0x31')](0x194);}return _0xa1f482;};}function handleError(_0x2cf3a3,_0x2bf5d0){_0x2bf5d0=_0x2bf5d0||0x1f4;return function(_0xac8f82){logger[_0x6cf6('0x1f')](_0xac8f82[_0x6cf6('0x32')]);if(_0xac8f82[_0x6cf6('0x33')]){delete _0xac8f82['name'];}_0x2cf3a3[_0x6cf6('0x24')](_0x2bf5d0)[_0x6cf6('0x34')](_0xac8f82);};}exports[_0x6cf6('0x35')]=function(_0x43f2bf,_0x31c822){var _0xe329e3={},_0x2f0120={},_0x42d9e9={'count':0x0,'rows':[]};var _0x3a962a=_['map'](db[_0x6cf6('0x36')][_0x6cf6('0x37')],function(_0x3a0cb1){return{'name':_0x3a0cb1[_0x6cf6('0x38')],'type':_0x3a0cb1[_0x6cf6('0x39')][_0x6cf6('0x3a')]};});_0x2f0120[_0x6cf6('0x3b')]=_[_0x6cf6('0x3c')](_0x3a962a,_0x6cf6('0x33'));_0x2f0120['query']=_[_0x6cf6('0x3d')](_0x43f2bf['query']);_0x2f0120[_0x6cf6('0x3e')]=_[_0x6cf6('0x3f')](_0x2f0120[_0x6cf6('0x3b')],_0x2f0120[_0x6cf6('0x40')]);_0xe329e3[_0x6cf6('0x41')]=_[_0x6cf6('0x3f')](_0x2f0120[_0x6cf6('0x3b')],qs[_0x6cf6('0x42')](_0x43f2bf['query'][_0x6cf6('0x42')]));_0xe329e3[_0x6cf6('0x41')]=_0xe329e3['attributes'][_0x6cf6('0x43')]?_0xe329e3[_0x6cf6('0x41')]:_0x2f0120[_0x6cf6('0x3b')];if(!_0x43f2bf['query'][_0x6cf6('0x44')](_0x6cf6('0x45'))){_0xe329e3['limit']=qs[_0x6cf6('0x46')](_0x43f2bf[_0x6cf6('0x40')][_0x6cf6('0x46')]);_0xe329e3[_0x6cf6('0x27')]=qs[_0x6cf6('0x27')](_0x43f2bf[_0x6cf6('0x40')][_0x6cf6('0x27')]);}_0xe329e3['order']=qs[_0x6cf6('0x47')](_0x43f2bf['query'][_0x6cf6('0x47')]);_0xe329e3[_0x6cf6('0x48')]=qs['filters'](_[_0x6cf6('0x49')](_0x43f2bf[_0x6cf6('0x40')],_0x2f0120[_0x6cf6('0x3e')]),_0x3a962a);if(_0x43f2bf[_0x6cf6('0x40')][_0x6cf6('0x4a')]){_0xe329e3['where']=_[_0x6cf6('0x4b')](_0xe329e3[_0x6cf6('0x48')],{'$or':_[_0x6cf6('0x3c')](_0x3a962a,function(_0x4833d5){if(_0x4833d5[_0x6cf6('0x39')]!==_0x6cf6('0x4c')){var _0xa322b4={};_0xa322b4[_0x4833d5['name']]={'$like':'%'+_0x43f2bf[_0x6cf6('0x40')]['filter']+'%'};return _0xa322b4;}})});}_0xe329e3=_['merge']({},_0xe329e3,_0x43f2bf[_0x6cf6('0x4d')]);var _0x37edba={'where':_0xe329e3[_0x6cf6('0x48')]};return db[_0x6cf6('0x36')][_0x6cf6('0x4e')](_0x37edba)[_0x6cf6('0x19')](function(_0x28629d){_0x42d9e9[_0x6cf6('0x4e')]=_0x28629d;if(_0x43f2bf[_0x6cf6('0x40')][_0x6cf6('0x4f')]){_0xe329e3[_0x6cf6('0x50')]=[{'all':!![]}];}return db[_0x6cf6('0x36')][_0x6cf6('0x51')](_0xe329e3);})['then'](function(_0x26a6ff){_0x42d9e9[_0x6cf6('0x52')]=_0x26a6ff;return _0x42d9e9;})['then'](respondWithFilteredResult(_0x31c822,_0xe329e3))['catch'](handleError(_0x31c822,null));};exports[_0x6cf6('0x53')]=function(_0x17dd6e,_0x1db524){var _0x20a106={'raw':![],'where':{'id':_0x17dd6e[_0x6cf6('0x54')]['id']}},_0x459ca3={};_0x459ca3['model']=_[_0x6cf6('0x3d')](db[_0x6cf6('0x36')][_0x6cf6('0x37')]);_0x459ca3['query']=_['keys'](_0x17dd6e[_0x6cf6('0x40')]);_0x459ca3[_0x6cf6('0x3e')]=_[_0x6cf6('0x3f')](_0x459ca3[_0x6cf6('0x3b')],_0x459ca3[_0x6cf6('0x40')]);_0x20a106[_0x6cf6('0x41')]=_[_0x6cf6('0x3f')](_0x459ca3[_0x6cf6('0x3b')],qs[_0x6cf6('0x42')](_0x17dd6e[_0x6cf6('0x40')]['fields']));_0x20a106[_0x6cf6('0x41')]=_0x20a106[_0x6cf6('0x41')][_0x6cf6('0x43')]?_0x20a106[_0x6cf6('0x41')]:_0x459ca3[_0x6cf6('0x3b')];if(_0x17dd6e[_0x6cf6('0x40')][_0x6cf6('0x4f')]){_0x20a106[_0x6cf6('0x50')]=[{'all':!![]}];}_0x20a106=_[_0x6cf6('0x4b')]({},_0x20a106,_0x17dd6e[_0x6cf6('0x4d')]);return db[_0x6cf6('0x36')]['find'](_0x20a106)[_0x6cf6('0x19')](handleEntityNotFound(_0x1db524,null))['then'](respondWithResult(_0x1db524,null))[_0x6cf6('0x23')](handleError(_0x1db524,null));};exports[_0x6cf6('0x55')]=function(_0x498539,_0x1fa5b0){var _0x399dc0={'where':{'id':_0x498539[_0x6cf6('0x54')]['id']}},_0x4699d5={};_0x4699d5[_0x6cf6('0x3b')]=_[_0x6cf6('0x3d')](db['Trunk'][_0x6cf6('0x37')]);_0x399dc0[_0x6cf6('0x41')]=_[_0x6cf6('0x3f')](_0x4699d5['model'],qs['fields'](_0x498539[_0x6cf6('0x40')][_0x6cf6('0x42')]));_0x399dc0['attributes']=_0x399dc0[_0x6cf6('0x41')][_0x6cf6('0x43')]?_0x399dc0[_0x6cf6('0x41')]:_0x4699d5[_0x6cf6('0x3b')];if(_0x498539[_0x6cf6('0x40')]['includeAll']){_0x399dc0[_0x6cf6('0x50')]=[{'all':!![]}];}_0x399dc0=_[_0x6cf6('0x4b')]({},_0x399dc0,_0x498539['options']);return db['Trunk'][_0x6cf6('0x56')](_0x399dc0)[_0x6cf6('0x19')](handleEntityNotFound(_0x1fa5b0,null))[_0x6cf6('0x19')](function(_0x32a6c6){if(_0x32a6c6){var _0x26dfc7=_0x32a6c6['get']({'plain':!![]});_0x26dfc7=qs['omit'](_0x26dfc7,['id',_0x6cf6('0x57'),_0x6cf6('0x58')]);_0x498539[_0x6cf6('0x59')]=_[_0x6cf6('0x5a')](_0x498539[_0x6cf6('0x59')],['id','createdAt','updatedAt']);return db['Trunk'][_0x6cf6('0x5b')](_[_0x6cf6('0x4b')](_0x26dfc7,_0x498539[_0x6cf6('0x59')]),{'include':_0x498539[_0x6cf6('0x40')]['includeAll']?[{'all':!![]}]:undefined})[_0x6cf6('0x19')](function(_0x5487b5){var _0x179b3d=_0x498539['user'][_0x6cf6('0x2e')]({'plain':!![]});if(!_0x179b3d)throw new Error(_0x6cf6('0x5c'));if(_0x179b3d[_0x6cf6('0x5d')]===_0x6cf6('0x5e')){var _0x38ebcc=_0x5487b5['get']({'plain':!![]});var _0x21ea76='Trunks';return db[_0x6cf6('0x5f')]['find']({'where':{'name':_0x21ea76,'userProfileId':_0x179b3d[_0x6cf6('0x60')]},'raw':!![]})['then'](function(_0x5b19a7){if(_0x5b19a7&&_0x5b19a7[_0x6cf6('0x61')]===0x0){return db['UserProfileResource'][_0x6cf6('0x5b')]({'name':_0x38ebcc[_0x6cf6('0x33')],'resourceId':_0x38ebcc['id'],'type':_0x5b19a7[_0x6cf6('0x33')],'sectionId':_0x5b19a7['id']},{})[_0x6cf6('0x19')](function(){return _0x5487b5;});}else{return _0x5487b5;}})[_0x6cf6('0x23')](function(_0x124d23){logger[_0x6cf6('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x124d23);throw _0x124d23;});}return _0x5487b5;});}})['then'](respondWithResult(_0x1fa5b0,0xc9))[_0x6cf6('0x23')](handleError(_0x1fa5b0,null));};exports[_0x6cf6('0x5b')]=function(_0x5cfc55,_0xd96f46,_0x565efc){var _0x581e78;return db[_0x6cf6('0x36')]['create'](_0x5cfc55['body'],{'raw':!![]})[_0x6cf6('0x19')](function(_0x29a446){_0x581e78=_0x29a446;return db[_0x6cf6('0x36')]['findAll']({'raw':!![]});})[_0x6cf6('0x19')](function(_0x4a2451){var _0x2dedba=fs[_0x6cf6('0x62')](path['join'](config[_0x6cf6('0x63')],_0x6cf6('0x64')),_0x6cf6('0x65'));var _0x421819=fs[_0x6cf6('0x62')](path[_0x6cf6('0x66')](config['root'],_0x6cf6('0x67')),_0x6cf6('0x65'));var _0x177a1c=ejs[_0x6cf6('0x68')](_0x2dedba,{'trunks':_0x4a2451||[]});fs[_0x6cf6('0x69')](_0x6cf6('0x6a'),_0x177a1c);if(_0x581e78['registry']){var _0x5be914=ejs['render'](_0x421819,{'trunks':_0x4a2451||[]});fs[_0x6cf6('0x69')]('/etc/asterisk/sip_xcally_registers.conf',_0x5be914);}})[_0x6cf6('0x19')](function(){return respondWithRpcPromise('Reload',_0x6cf6('0x5b'),{'module':_0x6cf6('0x6b')});})['then'](function(){var _0x3048a2=_0x5cfc55[_0x6cf6('0x5e')][_0x6cf6('0x2e')]({'plain':!![]});if(!_0x3048a2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3048a2[_0x6cf6('0x5d')]==='user'){var _0xaaa702=_0x581e78[_0x6cf6('0x2e')]({'plain':!![]});return db[_0x6cf6('0x5f')][_0x6cf6('0x56')]({'where':{'name':_0x6cf6('0x2f'),'userProfileId':_0x3048a2[_0x6cf6('0x60')]},'raw':!![]})[_0x6cf6('0x19')](function(_0x4df5a8){if(_0x4df5a8&&_0x4df5a8[_0x6cf6('0x61')]===0x0){return db['UserProfileResource'][_0x6cf6('0x5b')]({'name':_0xaaa702[_0x6cf6('0x33')],'resourceId':_0xaaa702['id'],'type':_0x4df5a8[_0x6cf6('0x33')],'sectionId':_0x4df5a8['id']},{})[_0x6cf6('0x19')](function(){return _0x581e78;});}else{return _0x581e78;}})['catch'](function(_0x4ab759){logger[_0x6cf6('0x1f')](_0x6cf6('0x6c'),_0x4ab759);throw _0x4ab759;});}return _0x581e78;})[_0x6cf6('0x19')](respondWithResult(_0xd96f46,0xc9))[_0x6cf6('0x23')](handleError(_0xd96f46,null));};exports[_0x6cf6('0x2c')]=function(_0x43f5bb,_0x5527d6,_0x517c8e){var _0x1c73bf;return db['Trunk'][_0x6cf6('0x56')]({'where':{'id':_0x43f5bb[_0x6cf6('0x54')]['id']}})[_0x6cf6('0x19')](handleEntityNotFound(_0x5527d6,null))[_0x6cf6('0x19')](saveUpdates(_0x43f5bb['body'],null))[_0x6cf6('0x19')](function(_0x4c5f0d){if(_0x4c5f0d){_0x1c73bf=_0x4c5f0d;return db[_0x6cf6('0x36')][_0x6cf6('0x51')]({'raw':!![]});}})[_0x6cf6('0x19')](function(_0x51fe69){if(_0x51fe69){var _0xc509d3=fs[_0x6cf6('0x62')](path[_0x6cf6('0x66')](config['root'],_0x6cf6('0x64')),_0x6cf6('0x65'));var _0x31f59b=fs['readFileSync'](path['join'](config[_0x6cf6('0x63')],'server/files/templates/registry.ejs'),'utf8');var _0x1f1cbb=ejs[_0x6cf6('0x68')](_0xc509d3,{'trunks':_0x51fe69||[]});fs[_0x6cf6('0x69')](_0x6cf6('0x6a'),_0x1f1cbb);var _0x46cad8=ejs[_0x6cf6('0x68')](_0x31f59b,{'trunks':_0x51fe69||[]});fs[_0x6cf6('0x69')](_0x6cf6('0x6d'),_0x46cad8);return respondWithRpcPromise(_0x6cf6('0x6e'),'update',{'module':_0x6cf6('0x6b')});}return null;})[_0x6cf6('0x19')](function(_0x27cfe7){if(_0x27cfe7){return _0x1c73bf;}})['then'](respondWithResult(_0x5527d6,null))['catch'](handleError(_0x5527d6,null));};exports[_0x6cf6('0x2d')]=function(_0x169a33,_0x204f3d,_0x1c254d){var _0x38652f;return db[_0x6cf6('0x36')]['find']({'where':{'id':_0x169a33[_0x6cf6('0x54')]['id']}})[_0x6cf6('0x19')](handleEntityNotFound(_0x204f3d,null))[_0x6cf6('0x19')](removeEntity(_0x204f3d,null))[_0x6cf6('0x19')](function(){return db[_0x6cf6('0x36')][_0x6cf6('0x51')]({'raw':!![]});})[_0x6cf6('0x19')](function(_0x592d53){var _0x316b82=fs[_0x6cf6('0x62')](path['join'](config[_0x6cf6('0x63')],_0x6cf6('0x64')),_0x6cf6('0x65'));var _0x4dca82=fs[_0x6cf6('0x62')](path[_0x6cf6('0x66')](config[_0x6cf6('0x63')],_0x6cf6('0x67')),_0x6cf6('0x65'));var _0x1f2b47=ejs['render'](_0x316b82,{'trunks':_0x592d53});var _0x5073e3=ejs['render'](_0x4dca82,{'trunks':_0x592d53});fs[_0x6cf6('0x69')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1f2b47);fs[_0x6cf6('0x69')](_0x6cf6('0x6d'),_0x5073e3);return respondWithRpcPromise('Reload',_0x6cf6('0x2d'),{'module':_0x6cf6('0x6b')});})[_0x6cf6('0x23')](handleError(_0x204f3d,null));}; \ No newline at end of file +var _0x58a4=['catch','sendStatus','status','end','json','offset','limit','Content-Range','apply','save','update','destroy','get','Trunks','stack','name','send','index','Trunk','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','show','params','clone','omit','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','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','/etc/asterisk/sip_xcally_trunks.conf','registry','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','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','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0x58a4,0xbf));var _0x458a=function(_0x2d4521,_0x8d98b6){_0x2d4521=_0x2d4521-0x0;var _0x5d765f=_0x58a4[_0x2d4521];return _0x5d765f;};'use strict';var pdf=require(_0x458a('0x0'));var emlformat=require(_0x458a('0x1'));var rimraf=require(_0x458a('0x2'));var zipdir=require(_0x458a('0x3'));var jsonpatch=require(_0x458a('0x4'));var rp=require(_0x458a('0x5'));var moment=require(_0x458a('0x6'));var BPromise=require(_0x458a('0x7'));var Mustache=require(_0x458a('0x8'));var util=require(_0x458a('0x9'));var path=require(_0x458a('0xa'));var sox=require(_0x458a('0xb'));var csv=require(_0x458a('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x458a('0xd'));var crypto=require(_0x458a('0xe'));var jsforce=require(_0x458a('0xf'));var deskjs=require(_0x458a('0x10'));var toCsv=require(_0x458a('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x458a('0x11'));var authService=require(_0x458a('0x12'));var qs=require(_0x458a('0x13'));var as=require(_0x458a('0x14'));var hardwareService=require(_0x458a('0x15'));var logger=require('../../config/logger')(_0x458a('0x16'));var utils=require(_0x458a('0x17'));var config=require('../../config/environment');var db=require(_0x458a('0x18'))['db'];var jayson=require(_0x458a('0x19'));var client=jayson[_0x458a('0x1a')][_0x458a('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x2e788b,_0x5bd09e,_0x53e6b4){if(_0x53e6b4){var _0x4408e9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4408e9['test'](_0x5bd09e)){return _0x2e788b;}else{throw new db[(_0x458a('0x1c'))][(_0x458a('0x1d'))](_0x458a('0x1e'));}}else{return _0x2e788b;}}function respondWithRpcPromise(_0x3b74f9,_0xad80f9,_0x29acee,_0x507b0f){return new BPromise(function(_0x4b26be,_0x5c7993){var _0x2faf6a=_0x507b0f||client;return _0x2faf6a[_0x458a('0x1f')](_0x3b74f9,_0x29acee)[_0x458a('0x20')](function(_0x5c5b41){logger[_0x458a('0x21')](_0x458a('0x22'),_0xad80f9,_0x458a('0x23'));logger[_0x458a('0x24')](_0x458a('0x25'),_0xad80f9,'request\x20sent',JSON['stringify'](_0x5c5b41));if(_0x5c5b41[_0x458a('0x26')]){if(_0x5c5b41['error'][_0x458a('0x27')]===0x1f4){logger[_0x458a('0x26')]('Trunk,\x20%s,\x20%s',_0xad80f9,_0x5c5b41[_0x458a('0x26')]['message']);return _0x5c7993(_0x5c5b41[_0x458a('0x26')][_0x458a('0x28')]);}logger['error'](_0x458a('0x22'),_0xad80f9,_0x5c5b41[_0x458a('0x26')]['message']);return _0x4b26be(_0x5c5b41[_0x458a('0x26')]['message']);}else{logger[_0x458a('0x21')]('Trunk,\x20%s,\x20%s',_0xad80f9,_0x458a('0x23'));_0x4b26be(_0x5c5b41['result'][_0x458a('0x28')]);}})[_0x458a('0x29')](function(_0xcb0756){logger[_0x458a('0x26')](_0x458a('0x22'),_0xad80f9,_0xcb0756);_0x5c7993(_0xcb0756);});});}function respondWithStatusCode(_0x19bd5,_0x340375){_0x340375=_0x340375||0xcc;return function(_0x3012c7){if(_0x3012c7){return _0x19bd5[_0x458a('0x2a')](_0x340375);}return _0x19bd5[_0x458a('0x2b')](_0x340375)[_0x458a('0x2c')]();};}function respondWithResult(_0x327fcb,_0x21ec38){_0x21ec38=_0x21ec38||0xc8;return function(_0x5a55b7){if(_0x5a55b7){return _0x327fcb[_0x458a('0x2b')](_0x21ec38)[_0x458a('0x2d')](_0x5a55b7);}};}function respondWithFilteredResult(_0x5f3ac0,_0x5df150){return function(_0x41b23d){if(_0x41b23d){var _0x596fe2=_0x41b23d['count'],_0x33c5d8=_0x5df150[_0x458a('0x2e')],_0x29f9b5=_0x5df150[_0x458a('0x2e')]+_0x5df150[_0x458a('0x2f')],_0x223f73;if(_0x29f9b5>=_0x596fe2){_0x29f9b5=_0x596fe2;_0x223f73=0xc8;}else{_0x223f73=0xce;}_0x5f3ac0['status'](_0x223f73);return _0x5f3ac0['set'](_0x458a('0x30'),_0x33c5d8+'-'+_0x29f9b5+'/'+_0x596fe2)['json'](_0x41b23d);}return null;};}function patchUpdates(_0x185f1c){return function(_0x56e0b9){try{jsonpatch[_0x458a('0x31')](_0x56e0b9,_0x185f1c,!![]);}catch(_0xb39224){return BPromise['reject'](_0xb39224);}return _0x56e0b9[_0x458a('0x32')]();};}function saveUpdates(_0x269f53,_0x625ae3){return function(_0x525caf){if(_0x525caf){return _0x525caf[_0x458a('0x33')](_0x269f53)[_0x458a('0x20')](function(_0xaf233b){return _0xaf233b;});}return null;};}function removeEntity(_0x90d283,_0x5267fe){return function(_0x4fd30f){if(_0x4fd30f){return _0x4fd30f[_0x458a('0x34')]()[_0x458a('0x20')](function(){var _0x41f449=_0x4fd30f[_0x458a('0x35')]({'plain':!![]});var _0x35ec8f=_0x458a('0x36');return db['UserProfileResource'][_0x458a('0x34')]({'where':{'type':_0x35ec8f,'resourceId':_0x41f449['id']}})[_0x458a('0x20')](function(){return _0x4fd30f;});})[_0x458a('0x20')](function(){_0x90d283[_0x458a('0x2b')](0xcc)[_0x458a('0x2c')]();});}};}function handleEntityNotFound(_0x19d73a,_0x262ad0){return function(_0x2af919){if(!_0x2af919){_0x19d73a[_0x458a('0x2a')](0x194);}return _0x2af919;};}function handleError(_0x4cb8be,_0x3c9b56){_0x3c9b56=_0x3c9b56||0x1f4;return function(_0x41e270){logger[_0x458a('0x26')](_0x41e270[_0x458a('0x37')]);if(_0x41e270[_0x458a('0x38')]){delete _0x41e270[_0x458a('0x38')];}_0x4cb8be[_0x458a('0x2b')](_0x3c9b56)[_0x458a('0x39')](_0x41e270);};}exports[_0x458a('0x3a')]=function(_0x1ecf2f,_0x1a4011){var _0x1aa28e={},_0x40c6cb={},_0x73e060={'count':0x0,'rows':[]};var _0x5d79cb=_['map'](db[_0x458a('0x3b')][_0x458a('0x3c')],function(_0x12849d){return{'name':_0x12849d[_0x458a('0x3d')],'type':_0x12849d[_0x458a('0x3e')][_0x458a('0x3f')]};});_0x40c6cb[_0x458a('0x40')]=_[_0x458a('0x41')](_0x5d79cb,_0x458a('0x38'));_0x40c6cb[_0x458a('0x42')]=_[_0x458a('0x43')](_0x1ecf2f['query']);_0x40c6cb[_0x458a('0x44')]=_[_0x458a('0x45')](_0x40c6cb['model'],_0x40c6cb[_0x458a('0x42')]);_0x1aa28e[_0x458a('0x46')]=_[_0x458a('0x45')](_0x40c6cb['model'],qs[_0x458a('0x47')](_0x1ecf2f[_0x458a('0x42')][_0x458a('0x47')]));_0x1aa28e[_0x458a('0x46')]=_0x1aa28e[_0x458a('0x46')][_0x458a('0x48')]?_0x1aa28e[_0x458a('0x46')]:_0x40c6cb[_0x458a('0x40')];if(!_0x1ecf2f['query'][_0x458a('0x49')](_0x458a('0x4a'))){_0x1aa28e[_0x458a('0x2f')]=qs['limit'](_0x1ecf2f[_0x458a('0x42')][_0x458a('0x2f')]);_0x1aa28e['offset']=qs[_0x458a('0x2e')](_0x1ecf2f[_0x458a('0x42')][_0x458a('0x2e')]);}_0x1aa28e[_0x458a('0x4b')]=qs[_0x458a('0x4c')](_0x1ecf2f['query']['sort']);_0x1aa28e[_0x458a('0x4d')]=qs[_0x458a('0x44')](_[_0x458a('0x4e')](_0x1ecf2f[_0x458a('0x42')],_0x40c6cb['filters']),_0x5d79cb);if(_0x1ecf2f[_0x458a('0x42')][_0x458a('0x4f')]){_0x1aa28e['where']=_[_0x458a('0x50')](_0x1aa28e['where'],{'$or':_[_0x458a('0x41')](_0x5d79cb,function(_0x357851){if(_0x357851[_0x458a('0x3e')]!=='VIRTUAL'){var _0x195a24={};_0x195a24[_0x357851[_0x458a('0x38')]]={'$like':'%'+_0x1ecf2f[_0x458a('0x42')]['filter']+'%'};return _0x195a24;}})});}_0x1aa28e=_['merge']({},_0x1aa28e,_0x1ecf2f[_0x458a('0x51')]);var _0x28ae82={'where':_0x1aa28e[_0x458a('0x4d')]};return db['Trunk']['count'](_0x28ae82)[_0x458a('0x20')](function(_0xf362b5){_0x73e060[_0x458a('0x52')]=_0xf362b5;if(_0x1ecf2f[_0x458a('0x42')][_0x458a('0x53')]){_0x1aa28e[_0x458a('0x54')]=[{'all':!![]}];}return db[_0x458a('0x3b')][_0x458a('0x55')](_0x1aa28e);})[_0x458a('0x20')](function(_0x213f86){_0x73e060[_0x458a('0x56')]=_0x213f86;return _0x73e060;})[_0x458a('0x20')](respondWithFilteredResult(_0x1a4011,_0x1aa28e))[_0x458a('0x29')](handleError(_0x1a4011,null));};exports[_0x458a('0x57')]=function(_0x1ddc39,_0x25b44c){var _0x51669b={'raw':![],'where':{'id':_0x1ddc39[_0x458a('0x58')]['id']}},_0x1c270b={};_0x1c270b[_0x458a('0x40')]=_[_0x458a('0x43')](db[_0x458a('0x3b')]['rawAttributes']);_0x1c270b['query']=_['keys'](_0x1ddc39[_0x458a('0x42')]);_0x1c270b['filters']=_[_0x458a('0x45')](_0x1c270b[_0x458a('0x40')],_0x1c270b[_0x458a('0x42')]);_0x51669b[_0x458a('0x46')]=_[_0x458a('0x45')](_0x1c270b['model'],qs['fields'](_0x1ddc39[_0x458a('0x42')][_0x458a('0x47')]));_0x51669b[_0x458a('0x46')]=_0x51669b[_0x458a('0x46')][_0x458a('0x48')]?_0x51669b['attributes']:_0x1c270b[_0x458a('0x40')];if(_0x1ddc39['query'][_0x458a('0x53')]){_0x51669b['include']=[{'all':!![]}];}_0x51669b=_[_0x458a('0x50')]({},_0x51669b,_0x1ddc39['options']);return db['Trunk']['find'](_0x51669b)[_0x458a('0x20')](handleEntityNotFound(_0x25b44c,null))[_0x458a('0x20')](respondWithResult(_0x25b44c,null))['catch'](handleError(_0x25b44c,null));};exports[_0x458a('0x59')]=function(_0x704b02,_0x194592){var _0x5070f9={'where':{'id':_0x704b02[_0x458a('0x58')]['id']}},_0x2c1230={};_0x2c1230[_0x458a('0x40')]=_[_0x458a('0x43')](db[_0x458a('0x3b')][_0x458a('0x3c')]);_0x5070f9['attributes']=_[_0x458a('0x45')](_0x2c1230[_0x458a('0x40')],qs[_0x458a('0x47')](_0x704b02[_0x458a('0x42')][_0x458a('0x47')]));_0x5070f9[_0x458a('0x46')]=_0x5070f9[_0x458a('0x46')][_0x458a('0x48')]?_0x5070f9['attributes']:_0x2c1230[_0x458a('0x40')];if(_0x704b02['query'][_0x458a('0x53')]){_0x5070f9[_0x458a('0x54')]=[{'all':!![]}];}_0x5070f9=_[_0x458a('0x50')]({},_0x5070f9,_0x704b02[_0x458a('0x51')]);return db['Trunk']['find'](_0x5070f9)[_0x458a('0x20')](handleEntityNotFound(_0x194592,null))[_0x458a('0x20')](function(_0x2b9aac){if(_0x2b9aac){var _0x156a22=_0x2b9aac[_0x458a('0x35')]({'plain':!![]});_0x156a22=qs[_0x458a('0x5a')](_0x156a22,['id','createdAt',_0x458a('0x5b')]);_0x704b02[_0x458a('0x5c')]=_['omit'](_0x704b02[_0x458a('0x5c')],['id','createdAt',_0x458a('0x5b')]);return db[_0x458a('0x3b')][_0x458a('0x5d')](_[_0x458a('0x50')](_0x156a22,_0x704b02[_0x458a('0x5c')]),{'include':_0x704b02[_0x458a('0x42')][_0x458a('0x53')]?[{'all':!![]}]:undefined})[_0x458a('0x20')](function(_0x4c97b4){var _0x3fd126=_0x704b02[_0x458a('0x5e')]['get']({'plain':!![]});if(!_0x3fd126)throw new Error(_0x458a('0x5f'));if(_0x3fd126[_0x458a('0x60')]==='user'){var _0xaf7b50=_0x4c97b4[_0x458a('0x35')]({'plain':!![]});var _0x47cbcf=_0x458a('0x36');return db[_0x458a('0x61')]['find']({'where':{'name':_0x47cbcf,'userProfileId':_0x3fd126[_0x458a('0x62')]},'raw':!![]})[_0x458a('0x20')](function(_0xce9756){if(_0xce9756&&_0xce9756[_0x458a('0x63')]===0x0){return db[_0x458a('0x64')][_0x458a('0x5d')]({'name':_0xaf7b50[_0x458a('0x38')],'resourceId':_0xaf7b50['id'],'type':_0xce9756[_0x458a('0x38')],'sectionId':_0xce9756['id']},{})['then'](function(){return _0x4c97b4;});}else{return _0x4c97b4;}})[_0x458a('0x29')](function(_0x406634){logger[_0x458a('0x26')](_0x458a('0x65'),_0x406634);throw _0x406634;});}return _0x4c97b4;});}})[_0x458a('0x20')](respondWithResult(_0x194592,0xc9))[_0x458a('0x29')](handleError(_0x194592,null));};exports[_0x458a('0x5d')]=function(_0x1255b8,_0x1b744c,_0xfe46ae){var _0x546519;return db[_0x458a('0x3b')]['create'](_0x1255b8[_0x458a('0x5c')],{'raw':!![]})[_0x458a('0x20')](function(_0x3bd686){_0x546519=_0x3bd686;return db[_0x458a('0x3b')][_0x458a('0x55')]({'raw':!![]});})[_0x458a('0x20')](function(_0x2c6a00){var _0x3745d5=fs[_0x458a('0x66')](path[_0x458a('0x67')](config[_0x458a('0x68')],_0x458a('0x69')),_0x458a('0x6a'));var _0x435884=fs[_0x458a('0x66')](path[_0x458a('0x67')](config['root'],_0x458a('0x6b')),'utf8');var _0x10dde3=ejs[_0x458a('0x6c')](_0x3745d5,{'trunks':_0x2c6a00||[]});fs['writeFileSync'](_0x458a('0x6d'),_0x10dde3);if(_0x546519[_0x458a('0x6e')]){var _0x350b73=ejs['render'](_0x435884,{'trunks':_0x2c6a00||[]});fs[_0x458a('0x6f')](_0x458a('0x70'),_0x350b73);}})[_0x458a('0x20')](function(){return respondWithRpcPromise(_0x458a('0x71'),_0x458a('0x5d'),{'module':_0x458a('0x72')});})['then'](function(){var _0x3a6591=_0x1255b8['user']['get']({'plain':!![]});if(!_0x3a6591)throw new Error(_0x458a('0x5f'));if(_0x3a6591[_0x458a('0x60')]===_0x458a('0x5e')){var _0x5e01af=_0x546519[_0x458a('0x35')]({'plain':!![]});return db[_0x458a('0x61')][_0x458a('0x73')]({'where':{'name':_0x458a('0x36'),'userProfileId':_0x3a6591[_0x458a('0x62')]},'raw':!![]})[_0x458a('0x20')](function(_0x38cff5){if(_0x38cff5&&_0x38cff5[_0x458a('0x63')]===0x0){return db[_0x458a('0x64')][_0x458a('0x5d')]({'name':_0x5e01af['name'],'resourceId':_0x5e01af['id'],'type':_0x38cff5['name'],'sectionId':_0x38cff5['id']},{})['then'](function(){return _0x546519;});}else{return _0x546519;}})[_0x458a('0x29')](function(_0x5c6a8d){logger[_0x458a('0x26')](_0x458a('0x65'),_0x5c6a8d);throw _0x5c6a8d;});}return _0x546519;})[_0x458a('0x20')](respondWithResult(_0x1b744c,0xc9))[_0x458a('0x29')](handleError(_0x1b744c,null));};exports[_0x458a('0x33')]=function(_0x2246e9,_0x46df7c,_0x49f3ee){var _0x349ff4;return db[_0x458a('0x3b')]['find']({'where':{'id':_0x2246e9[_0x458a('0x58')]['id']}})['then'](handleEntityNotFound(_0x46df7c,null))[_0x458a('0x20')](saveUpdates(_0x2246e9['body'],null))[_0x458a('0x20')](function(_0x177457){if(_0x177457){_0x349ff4=_0x177457;return db[_0x458a('0x3b')][_0x458a('0x55')]({'raw':!![]});}})['then'](function(_0x191872){if(_0x191872){var _0x14b95e=fs[_0x458a('0x66')](path[_0x458a('0x67')](config[_0x458a('0x68')],_0x458a('0x69')),_0x458a('0x6a'));var _0x259ab5=fs['readFileSync'](path[_0x458a('0x67')](config[_0x458a('0x68')],_0x458a('0x6b')),_0x458a('0x6a'));var _0x591dbb=ejs[_0x458a('0x6c')](_0x14b95e,{'trunks':_0x191872||[]});fs[_0x458a('0x6f')]('/etc/asterisk/sip_xcally_trunks.conf',_0x591dbb);var _0x32bc59=ejs[_0x458a('0x6c')](_0x259ab5,{'trunks':_0x191872||[]});fs[_0x458a('0x6f')](_0x458a('0x70'),_0x32bc59);return respondWithRpcPromise(_0x458a('0x71'),'update',{'module':_0x458a('0x72')});}return null;})[_0x458a('0x20')](function(_0x2ba226){if(_0x2ba226){return _0x349ff4;}})[_0x458a('0x20')](respondWithResult(_0x46df7c,null))[_0x458a('0x29')](handleError(_0x46df7c,null));};exports[_0x458a('0x34')]=function(_0x2eecf0,_0x573f46,_0x1f9925){var _0x4d3790;return db[_0x458a('0x3b')][_0x458a('0x73')]({'where':{'id':_0x2eecf0[_0x458a('0x58')]['id']}})['then'](handleEntityNotFound(_0x573f46,null))[_0x458a('0x20')](removeEntity(_0x573f46,null))['then'](function(){return db['Trunk'][_0x458a('0x55')]({'raw':!![]});})[_0x458a('0x20')](function(_0x5464a5){var _0x480e71=fs[_0x458a('0x66')](path[_0x458a('0x67')](config[_0x458a('0x68')],_0x458a('0x69')),_0x458a('0x6a'));var _0x50f1e0=fs[_0x458a('0x66')](path['join'](config[_0x458a('0x68')],_0x458a('0x6b')),_0x458a('0x6a'));var _0x54adb7=ejs[_0x458a('0x6c')](_0x480e71,{'trunks':_0x5464a5});var _0x358267=ejs['render'](_0x50f1e0,{'trunks':_0x5464a5});fs[_0x458a('0x6f')]('/etc/asterisk/sip_xcally_trunks.conf',_0x54adb7);fs[_0x458a('0x6f')](_0x458a('0x70'),_0x358267);return respondWithRpcPromise(_0x458a('0x71'),_0x458a('0x34'),{'module':'chan_sip.so'});})[_0x458a('0x29')](handleError(_0x573f46,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 305f589..1fc7ca7 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 _0x12e9=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','lodash','util'];(function(_0x2bc35a,_0x4da8fd){var _0x26b765=function(_0x4d0db2){while(--_0x4d0db2){_0x2bc35a['push'](_0x2bc35a['shift']());}};_0x26b765(++_0x4da8fd);}(_0x12e9,0x9e));var _0x912e=function(_0x43f570,_0x26496a){_0x43f570=_0x43f570-0x0;var _0x4b44b8=_0x12e9[_0x43f570];return _0x4b44b8;};'use strict';var _=require(_0x912e('0x0'));var util=require(_0x912e('0x1'));var logger=require('../../config/logger')(_0x912e('0x2'));var moment=require(_0x912e('0x3'));var BPromise=require(_0x912e('0x4'));var rp=require(_0x912e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x912e('0x6'));var config=require(_0x912e('0x7'));var attributes=require('./trunk.attributes');module[_0x912e('0x8')]=function(_0x423fca,_0x358b04){return _0x423fca[_0x912e('0x9')]('Trunk',attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe196=['moment','path','rimraf','../../config/environment','exports','Trunk','tools_trunks','../../config/logger'];(function(_0x468b6a,_0x1baa1d){var _0x113d0b=function(_0x5d73f0){while(--_0x5d73f0){_0x468b6a['push'](_0x468b6a['shift']());}};_0x113d0b(++_0x1baa1d);}(_0xe196,0x137));var _0x6e19=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xe196[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6e19('0x0'))('api');var moment=require(_0x6e19('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6e19('0x2'));var rimraf=require(_0x6e19('0x3'));var config=require(_0x6e19('0x4'));var attributes=require('./trunk.attributes');module[_0x6e19('0x5')]=function(_0x55557a,_0x123dd9){return _0x55557a['define'](_0x6e19('0x6'),attributes,{'tableName':_0x6e19('0x7'),'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 5b4d8e6..027e3db 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 _0x0b0e=['model','GetTrunk','Trunk','find','where','include','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','findAll','raw','options','attributes','map'];(function(_0x433613,_0x58e1b4){var _0x167334=function(_0x3d076c){while(--_0x3d076c){_0x433613['push'](_0x433613['shift']());}};_0x167334(++_0x58e1b4);}(_0x0b0e,0x187));var _0xe0b0=function(_0x15ea09,_0x2f30ab){_0x15ea09=_0x15ea09-0x0;var _0x3e9c78=_0x0b0e[_0x15ea09];return _0x3e9c78;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('Trunk,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});}exports['GetTrunk']=function(_0x54a3eb){var _0x46bb44=this;return new Promise(function(_0x50a441,_0x4df8da){return db['Trunk'][_0xe0b0('0x18')]({'raw':_0x54a3eb['options']?_0x54a3eb['options'][_0xe0b0('0x19')]===undefined?!![]:![]:!![],'where':_0x54a3eb['options']?_0x54a3eb[_0xe0b0('0x1a')]['where']||null:null,'attributes':_0x54a3eb[_0xe0b0('0x1a')]?_0x54a3eb[_0xe0b0('0x1a')][_0xe0b0('0x1b')]||null:null,'limit':_0x54a3eb[_0xe0b0('0x1a')]?_0x54a3eb[_0xe0b0('0x1a')]['limit']||null:null,'include':_0x54a3eb['options']?_0x54a3eb[_0xe0b0('0x1a')]['include']?_[_0xe0b0('0x1c')](_0x54a3eb[_0xe0b0('0x1a')]['include'],function(_0x170ad8){return{'model':db[_0x170ad8['model']],'as':_0x170ad8['as'],'attributes':_0x170ad8[_0xe0b0('0x1b')],'include':_0x170ad8['include']?_[_0xe0b0('0x1c')](_0x170ad8['include'],function(_0x3e5c88){return{'model':db[_0x3e5c88['model']],'as':_0x3e5c88['as'],'attributes':_0x3e5c88[_0xe0b0('0x1b')],'include':_0x3e5c88['include']?_[_0xe0b0('0x1c')](_0x3e5c88['include'],function(_0x362aba){return{'model':db[_0x362aba[_0xe0b0('0x1d')]],'as':_0x362aba['as'],'attributes':_0x362aba[_0xe0b0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe0b0('0xd')](function(_0x3ec2){logger[_0xe0b0('0xe')]('GetTrunk',_0x54a3eb);logger[_0xe0b0('0x10')](_0xe0b0('0x1e'),_0x54a3eb,JSON['stringify'](_0x3ec2));_0x50a441(_0x3ec2);})[_0xe0b0('0x17')](function(_0x419b1f){logger[_0xe0b0('0x13')](_0xe0b0('0x1e'),_0x419b1f[_0xe0b0('0x14')],_0x54a3eb);_0x4df8da(_0x46bb44[_0xe0b0('0x13')](0x1f4,_0x419b1f[_0xe0b0('0x14')]));});});};exports['ShowTrunk']=function(_0x1854b8){var _0x3c0109=this;return new Promise(function(_0x48a9b5,_0x4fe400){return db[_0xe0b0('0x1f')][_0xe0b0('0x20')]({'raw':_0x1854b8[_0xe0b0('0x1a')]?_0x1854b8[_0xe0b0('0x1a')][_0xe0b0('0x19')]===undefined?!![]:![]:!![],'where':_0x1854b8['options']?_0x1854b8[_0xe0b0('0x1a')][_0xe0b0('0x21')]||null:null,'attributes':_0x1854b8[_0xe0b0('0x1a')]?_0x1854b8[_0xe0b0('0x1a')][_0xe0b0('0x1b')]||null:null,'include':_0x1854b8['options']?_0x1854b8[_0xe0b0('0x1a')][_0xe0b0('0x22')]?_[_0xe0b0('0x1c')](_0x1854b8[_0xe0b0('0x1a')][_0xe0b0('0x22')],function(_0x12eeb8){return{'model':db[_0x12eeb8[_0xe0b0('0x1d')]],'as':_0x12eeb8['as'],'attributes':_0x12eeb8[_0xe0b0('0x1b')],'include':_0x12eeb8[_0xe0b0('0x22')]?_[_0xe0b0('0x1c')](_0x12eeb8[_0xe0b0('0x22')],function(_0x1a0c90){return{'model':db[_0x1a0c90[_0xe0b0('0x1d')]],'as':_0x1a0c90['as'],'attributes':_0x1a0c90[_0xe0b0('0x1b')],'include':_0x1a0c90[_0xe0b0('0x22')]?_['map'](_0x1a0c90[_0xe0b0('0x22')],function(_0x135be5){return{'model':db[_0x135be5[_0xe0b0('0x1d')]],'as':_0x135be5['as'],'attributes':_0x135be5[_0xe0b0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe0b0('0xd')](function(_0x2c6e60){logger[_0xe0b0('0xe')]('ShowTrunk',_0x1854b8);logger['debug']('ShowTrunk',_0x1854b8,JSON['stringify'](_0x2c6e60));_0x48a9b5(_0x2c6e60);})[_0xe0b0('0x17')](function(_0xc3d967){logger[_0xe0b0('0x13')]('ShowTrunk',_0xc3d967[_0xe0b0('0x14')],_0x1854b8);_0x4fe400(_0x3c0109[_0xe0b0('0x13')](0x1f4,_0xc3d967[_0xe0b0('0x14')]));});});}; \ No newline at end of file +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(_0x2e6f2e,_0x2ec0f4){var _0x5635aa=function(_0x48d326){while(--_0x48d326){_0x2e6f2e['push'](_0x2e6f2e['shift']());}};_0x5635aa(++_0x2ec0f4);}(_0x14a0,0x8e));var _0x014a=function(_0x2206e2,_0x12b4f1){_0x2206e2=_0x2206e2-0x0;var _0x4f8b5d=_0x14a0[_0x2206e2];return _0x4f8b5d;};'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 diff --git a/server/api/user/index.js b/server/api/user/index.js index 96687c7..9473390 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 _0xdd11=['/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getChatWebsites','/:id/whatsapp_accounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','/:id/api_key','getApiKey','post','/create_many','bulkCreate','/:id/contacts','addContacts','create','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','single','file','/:id/login','login','/:id/logout','logout','pause','addTeams','/:id/chat_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','addMailAccounts','/:id/chat_websites','addWhatsappAccounts','addSquareProjects','createApiKey','put','update','delete','removeTeams','destroy','removeChatInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeMailAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','exports','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','index','get','/describe','describe','/whoami','whoami','/:id','show','/:id/avatar','getAvatar','getContacts','/:id/queues','getQueues','getVoiceQueuesRt','getGroups','getRecordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions'];(function(_0x16e688,_0x4bd3da){var _0x131955=function(_0x58f782){while(--_0x58f782){_0x16e688['push'](_0x16e688['shift']());}};_0x131955(++_0x4bd3da);}(_0xdd11,0x119));var _0x1dd1=function(_0x2baca1,_0x2f3557){_0x2baca1=_0x2baca1-0x0;var _0x9aa62a=_0xdd11[_0x2baca1];return _0x9aa62a;};'use strict';var multer=require(_0x1dd1('0x0'));var util=require('util');var path=require(_0x1dd1('0x1'));var timeout=require(_0x1dd1('0x2'));var express=require(_0x1dd1('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x1dd1('0x4'));var config=require(_0x1dd1('0x5'));var controller=require(_0x1dd1('0x6'));router['get']('/',auth[_0x1dd1('0x7')](),controller[_0x1dd1('0x8')]);router[_0x1dd1('0x9')](_0x1dd1('0xa'),auth['isAuthenticated'](),controller[_0x1dd1('0xb')]);router[_0x1dd1('0x9')](_0x1dd1('0xc'),auth['isAuthenticated'](),controller[_0x1dd1('0xd')]);router[_0x1dd1('0x9')](_0x1dd1('0xe'),auth['isAuthenticated'](),controller[_0x1dd1('0xf')]);router[_0x1dd1('0x9')](_0x1dd1('0x10'),controller[_0x1dd1('0x11')]);router['get']('/:id/contacts',auth[_0x1dd1('0x7')](),controller[_0x1dd1('0x12')]);router[_0x1dd1('0x9')](_0x1dd1('0x13'),auth[_0x1dd1('0x7')](),controller[_0x1dd1('0x14')]);router[_0x1dd1('0x9')]('/:id/queues_rt',auth[_0x1dd1('0x7')](),controller[_0x1dd1('0x15')]);router[_0x1dd1('0x9')]('/:id/groups',auth[_0x1dd1('0x7')](),controller[_0x1dd1('0x16')]);router[_0x1dd1('0x9')]('/:id/recordings',auth[_0x1dd1('0x7')](),controller[_0x1dd1('0x17')]);router['get']('/:id/screen_recordings',auth[_0x1dd1('0x7')](),controller[_0x1dd1('0x18')]);router[_0x1dd1('0x9')](_0x1dd1('0x19'),auth[_0x1dd1('0x7')](),controller[_0x1dd1('0x1a')]);router[_0x1dd1('0x9')](_0x1dd1('0x1b'),auth[_0x1dd1('0x7')](),controller['getOpenchannelInteractions']);router[_0x1dd1('0x9')](_0x1dd1('0x1c'),auth[_0x1dd1('0x7')](),controller['getMailInteractions']);router[_0x1dd1('0x9')](_0x1dd1('0x1d'),auth['isAuthenticated'](),controller[_0x1dd1('0x1e')]);router[_0x1dd1('0x9')](_0x1dd1('0x1f'),auth['isAuthenticated'](),controller[_0x1dd1('0x20')]);router[_0x1dd1('0x9')](_0x1dd1('0x21'),auth['isAuthenticated'](),controller[_0x1dd1('0x22')]);router[_0x1dd1('0x9')](_0x1dd1('0x23'),auth['isAuthenticated'](),controller[_0x1dd1('0x24')]);router[_0x1dd1('0x9')](_0x1dd1('0x25'),auth[_0x1dd1('0x7')](),controller[_0x1dd1('0x26')]);router[_0x1dd1('0x9')](_0x1dd1('0x27'),auth[_0x1dd1('0x7')](),controller[_0x1dd1('0x28')]);router[_0x1dd1('0x9')]('/:id/prefixes',auth['isAuthenticated'](),controller['getVoicePrefixes']);router[_0x1dd1('0x9')](_0x1dd1('0x29'),auth[_0x1dd1('0x7')](),controller[_0x1dd1('0x2a')]);router[_0x1dd1('0x9')](_0x1dd1('0x2b'),auth['isAuthenticated'](),controller[_0x1dd1('0x2c')]);router[_0x1dd1('0x9')](_0x1dd1('0x2d'),auth[_0x1dd1('0x7')](),controller[_0x1dd1('0x2e')]);router[_0x1dd1('0x9')](_0x1dd1('0x2f'),auth['isAuthenticated'](),controller['getSmsAccounts']);router[_0x1dd1('0x9')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0x1dd1('0x30')]);router[_0x1dd1('0x9')](_0x1dd1('0x31'),auth[_0x1dd1('0x7')](),controller['getWhatsappAccounts']);router[_0x1dd1('0x9')](_0x1dd1('0x32'),auth['isAuthenticated'](),controller[_0x1dd1('0x33')]);router[_0x1dd1('0x9')](_0x1dd1('0x34'),auth[_0x1dd1('0x7')](),controller['getScheduledCalls']);router[_0x1dd1('0x9')](_0x1dd1('0x35'),auth[_0x1dd1('0x7')](),controller[_0x1dd1('0x36')]);router[_0x1dd1('0x37')](_0x1dd1('0x38'),auth[_0x1dd1('0x7')](),controller[_0x1dd1('0x39')]);router['post'](_0x1dd1('0x3a'),auth[_0x1dd1('0x7')](),controller[_0x1dd1('0x3b')]);router['post']('/',auth[_0x1dd1('0x7')](),controller[_0x1dd1('0x3c')]);router[_0x1dd1('0x37')](_0x1dd1('0x13'),auth[_0x1dd1('0x7')](),controller['addQueues']);var upload=multer({'storage':multer[_0x1dd1('0x3d')]({'destination':function(_0x2f303b,_0x1914ad,_0x1e6b0a){_0x1e6b0a(null,path[_0x1dd1('0x3e')](config[_0x1dd1('0x3f')],_0x1dd1('0x40')));},'filename':function(_0x5d2a51,_0x36d17d,_0x4935df){_0x4935df(null,util[_0x1dd1('0x41')](_0x1dd1('0x42'),Date[_0x1dd1('0x43')](),_0x36d17d[_0x1dd1('0x44')]));}})});router['post'](_0x1dd1('0x10'),upload[_0x1dd1('0x45')](_0x1dd1('0x46')),controller['addAvatar']);router['post'](_0x1dd1('0x47'),auth[_0x1dd1('0x7')](),controller[_0x1dd1('0x48')]);router[_0x1dd1('0x37')](_0x1dd1('0x49'),auth['isAuthenticated'](),controller[_0x1dd1('0x4a')]);router[_0x1dd1('0x37')]('/:id/pause',auth[_0x1dd1('0x7')](),controller[_0x1dd1('0x4b')]);router[_0x1dd1('0x37')]('/:id/unpause',auth[_0x1dd1('0x7')](),controller['unpause']);router[_0x1dd1('0x37')]('/:id/teams',auth[_0x1dd1('0x7')](),controller[_0x1dd1('0x4c')]);router[_0x1dd1('0x37')](_0x1dd1('0x4d'),auth[_0x1dd1('0x7')](),controller['addChatInteractions']);router[_0x1dd1('0x37')]('/:id/mail_interactions',auth[_0x1dd1('0x7')](),controller['addMailInteractions']);router[_0x1dd1('0x37')]('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0x1dd1('0x4e')]);router['post'](_0x1dd1('0x4f'),auth[_0x1dd1('0x7')](),controller[_0x1dd1('0x50')]);router[_0x1dd1('0x37')]('/:id/openchannel_interactions',auth[_0x1dd1('0x7')](),controller[_0x1dd1('0x51')]);router['post'](_0x1dd1('0x52'),auth[_0x1dd1('0x7')](),controller['addWhatsappInteractions']);router[_0x1dd1('0x37')](_0x1dd1('0x29'),auth['isAuthenticated'](),controller[_0x1dd1('0x53')]);router[_0x1dd1('0x37')](_0x1dd1('0x2b'),auth[_0x1dd1('0x7')](),controller[_0x1dd1('0x54')]);router[_0x1dd1('0x37')](_0x1dd1('0x2d'),auth[_0x1dd1('0x7')](),controller['addOpenchannelAccounts']);router['post'](_0x1dd1('0x2f'),auth[_0x1dd1('0x7')](),controller['addSmsAccounts']);router[_0x1dd1('0x37')](_0x1dd1('0x55'),auth['isAuthenticated'](),controller['addChatWebsites']);router[_0x1dd1('0x37')](_0x1dd1('0x31'),auth['isAuthenticated'](),controller[_0x1dd1('0x56')]);router['post'](_0x1dd1('0x32'),auth[_0x1dd1('0x7')](),controller[_0x1dd1('0x57')]);router[_0x1dd1('0x37')](_0x1dd1('0x35'),auth['isAuthenticated'](),controller[_0x1dd1('0x58')]);router[_0x1dd1('0x59')](_0x1dd1('0xe'),auth['isAuthenticated'](),controller[_0x1dd1('0x5a')]);router[_0x1dd1('0x59')]('/:id/password',auth[_0x1dd1('0x7')](),controller['changePassword']);router[_0x1dd1('0x5b')]('/:id/queues',auth[_0x1dd1('0x7')](),controller['removeQueues']);router[_0x1dd1('0x5b')](_0x1dd1('0x23'),auth[_0x1dd1('0x7')](),controller[_0x1dd1('0x5c')]);router[_0x1dd1('0x5b')](_0x1dd1('0xe'),auth['isAuthenticated'](),controller[_0x1dd1('0x5d')]);router['delete']('/:id/chat_interactions',auth[_0x1dd1('0x7')](),controller[_0x1dd1('0x5e')]);router[_0x1dd1('0x5b')]('/:id/mail_interactions',auth[_0x1dd1('0x7')](),controller['removeMailInteractions']);router[_0x1dd1('0x5b')]('/:id/fax_interactions',auth[_0x1dd1('0x7')](),controller['removeFaxInteractions']);router[_0x1dd1('0x5b')](_0x1dd1('0x4f'),auth[_0x1dd1('0x7')](),controller[_0x1dd1('0x5f')]);router[_0x1dd1('0x5b')](_0x1dd1('0x60'),auth['isAuthenticated'](),controller[_0x1dd1('0x61')]);router[_0x1dd1('0x5b')](_0x1dd1('0x52'),auth['isAuthenticated'](),controller['removeWhatsappInteractions']);router[_0x1dd1('0x5b')](_0x1dd1('0x29'),auth[_0x1dd1('0x7')](),controller['removeFaxAccounts']);router[_0x1dd1('0x5b')](_0x1dd1('0x2b'),auth[_0x1dd1('0x7')](),controller[_0x1dd1('0x62')]);router[_0x1dd1('0x5b')](_0x1dd1('0x2d'),auth[_0x1dd1('0x7')](),controller['removeOpenchannelAccounts']);router[_0x1dd1('0x5b')](_0x1dd1('0x2f'),auth[_0x1dd1('0x7')](),controller['removeSmsAccounts']);router[_0x1dd1('0x5b')](_0x1dd1('0x55'),auth[_0x1dd1('0x7')](),controller[_0x1dd1('0x63')]);router[_0x1dd1('0x5b')]('/:id/whatsapp_accounts',auth[_0x1dd1('0x7')](),controller[_0x1dd1('0x64')]);router[_0x1dd1('0x5b')](_0x1dd1('0x32'),auth[_0x1dd1('0x7')](),controller['removeSquareProjects']);router[_0x1dd1('0x5b')](_0x1dd1('0x35'),auth[_0x1dd1('0x7')](),controller[_0x1dd1('0x65')]);module[_0x1dd1('0x66')]=router; \ No newline at end of file +var _0x591f=['/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','put','/:id','update','/:id/password','changePassword','delete','removeQueues','/:id/teams','removeTeams','removeMailInteractions','removeSmsInteractions','removeWhatsappInteractions','removeMailAccounts','/:id/openchannel_accounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','describe','/whoami','isAuthenticated','whoami','show','getAvatar','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','getWhatsappInteractions','/:id/lists','getLists','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','/:id/api_key','getApiKey','post','/create_many','bulkCreate','addContacts','create','addQueues','diskStorage','join','root','server/files/images/','%s-%s','now','originalname','single','file','addAvatar','/:id/login','/:id/logout','logout','/:id/pause','/:id/unpause','unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions'];(function(_0x540279,_0x3b7d4f){var _0x243215=function(_0x269539){while(--_0x269539){_0x540279['push'](_0x540279['shift']());}};_0x243215(++_0x3b7d4f);}(_0x591f,0x9a));var _0xf591=function(_0x163040,_0x38a58c){_0x163040=_0x163040-0x0;var _0x364667=_0x591f[_0x163040];return _0x364667;};'use strict';var multer=require(_0xf591('0x0'));var util=require('util');var path=require(_0xf591('0x1'));var timeout=require(_0xf591('0x2'));var express=require('express');var router=express[_0xf591('0x3')]();var auth=require(_0xf591('0x4'));var interaction=require(_0xf591('0x5'));var config=require(_0xf591('0x6'));var controller=require('./user.controller');router[_0xf591('0x7')]('/',auth['isAuthenticated'](),controller[_0xf591('0x8')]);router[_0xf591('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xf591('0x9')]);router[_0xf591('0x7')](_0xf591('0xa'),auth[_0xf591('0xb')](),controller[_0xf591('0xc')]);router[_0xf591('0x7')]('/:id',auth[_0xf591('0xb')](),controller[_0xf591('0xd')]);router[_0xf591('0x7')]('/:id/avatar',controller[_0xf591('0xe')]);router[_0xf591('0x7')](_0xf591('0xf'),auth[_0xf591('0xb')](),controller[_0xf591('0x10')]);router['get'](_0xf591('0x11'),auth[_0xf591('0xb')](),controller[_0xf591('0x12')]);router[_0xf591('0x7')](_0xf591('0x13'),auth[_0xf591('0xb')](),controller[_0xf591('0x14')]);router[_0xf591('0x7')](_0xf591('0x15'),auth[_0xf591('0xb')](),controller[_0xf591('0x16')]);router[_0xf591('0x7')](_0xf591('0x17'),auth[_0xf591('0xb')](),controller[_0xf591('0x18')]);router[_0xf591('0x7')](_0xf591('0x19'),auth[_0xf591('0xb')](),controller[_0xf591('0x1a')]);router[_0xf591('0x7')](_0xf591('0x1b'),auth['isAuthenticated'](),controller[_0xf591('0x1c')]);router[_0xf591('0x7')](_0xf591('0x1d'),auth[_0xf591('0xb')](),controller[_0xf591('0x1e')]);router['get']('/:id/mail/interactions',auth[_0xf591('0xb')](),controller[_0xf591('0x1f')]);router[_0xf591('0x7')](_0xf591('0x20'),auth[_0xf591('0xb')](),controller[_0xf591('0x21')]);router[_0xf591('0x7')]('/:id/fax/interactions',auth[_0xf591('0xb')](),controller['getFaxInteractions']);router[_0xf591('0x7')]('/:id/whatsapp/interactions',auth[_0xf591('0xb')](),controller[_0xf591('0x22')]);router[_0xf591('0x7')]('/:id/teams',auth[_0xf591('0xb')](),controller['getTeams']);router[_0xf591('0x7')](_0xf591('0x23'),auth[_0xf591('0xb')](),controller[_0xf591('0x24')]);router[_0xf591('0x7')]('/:id/agents',auth[_0xf591('0xb')](),controller[_0xf591('0x25')]);router[_0xf591('0x7')](_0xf591('0x26'),auth['isAuthenticated'](),controller[_0xf591('0x27')]);router[_0xf591('0x7')](_0xf591('0x28'),auth['isAuthenticated'](),controller[_0xf591('0x29')]);router['get'](_0xf591('0x2a'),auth[_0xf591('0xb')](),controller[_0xf591('0x2b')]);router[_0xf591('0x7')]('/:id/openchannel_accounts',auth[_0xf591('0xb')](),controller[_0xf591('0x2c')]);router[_0xf591('0x7')]('/:id/sms_accounts',auth[_0xf591('0xb')](),controller[_0xf591('0x2d')]);router[_0xf591('0x7')]('/:id/chat_websites',auth[_0xf591('0xb')](),controller[_0xf591('0x2e')]);router[_0xf591('0x7')](_0xf591('0x2f'),auth[_0xf591('0xb')](),controller[_0xf591('0x30')]);router[_0xf591('0x7')](_0xf591('0x31'),auth[_0xf591('0xb')](),controller[_0xf591('0x32')]);router['get'](_0xf591('0x33'),auth[_0xf591('0xb')](),controller['getScheduledCalls']);router[_0xf591('0x7')](_0xf591('0x34'),auth['isAuthenticated'](),controller[_0xf591('0x35')]);router[_0xf591('0x36')](_0xf591('0x37'),auth['isAuthenticated'](),controller[_0xf591('0x38')]);router[_0xf591('0x36')]('/:id/contacts',auth[_0xf591('0xb')](),controller[_0xf591('0x39')]);router[_0xf591('0x36')]('/',auth[_0xf591('0xb')](),controller[_0xf591('0x3a')]);router[_0xf591('0x36')](_0xf591('0x11'),auth[_0xf591('0xb')](),controller[_0xf591('0x3b')]);var upload=multer({'storage':multer[_0xf591('0x3c')]({'destination':function(_0x15001d,_0x3437f2,_0x35fa7a){_0x35fa7a(null,path[_0xf591('0x3d')](config[_0xf591('0x3e')],_0xf591('0x3f')));},'filename':function(_0x2bfd52,_0x420e9c,_0x531ca7){_0x531ca7(null,util['format'](_0xf591('0x40'),Date[_0xf591('0x41')](),_0x420e9c[_0xf591('0x42')]));}})});router[_0xf591('0x36')]('/:id/avatar',upload[_0xf591('0x43')](_0xf591('0x44')),controller[_0xf591('0x45')]);router[_0xf591('0x36')](_0xf591('0x46'),auth['isAuthenticated'](),controller['login']);router[_0xf591('0x36')](_0xf591('0x47'),auth['isAuthenticated'](),controller[_0xf591('0x48')]);router[_0xf591('0x36')](_0xf591('0x49'),auth['isAuthenticated'](),controller['pause']);router[_0xf591('0x36')](_0xf591('0x4a'),auth[_0xf591('0xb')](),controller[_0xf591('0x4b')]);router[_0xf591('0x36')]('/:id/teams',auth[_0xf591('0xb')](),controller['addTeams']);router[_0xf591('0x36')](_0xf591('0x4c'),auth[_0xf591('0xb')](),controller[_0xf591('0x4d')]);router[_0xf591('0x36')](_0xf591('0x4e'),auth[_0xf591('0xb')](),controller[_0xf591('0x4f')]);router[_0xf591('0x36')](_0xf591('0x50'),auth[_0xf591('0xb')](),controller[_0xf591('0x51')]);router['post'](_0xf591('0x52'),auth[_0xf591('0xb')](),controller[_0xf591('0x53')]);router[_0xf591('0x36')](_0xf591('0x54'),auth['isAuthenticated'](),controller[_0xf591('0x55')]);router[_0xf591('0x36')](_0xf591('0x56'),auth['isAuthenticated'](),controller[_0xf591('0x57')]);router['post']('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0xf591('0x58')]);router[_0xf591('0x36')]('/:id/mail_accounts',auth[_0xf591('0xb')](),controller[_0xf591('0x59')]);router[_0xf591('0x36')]('/:id/openchannel_accounts',auth[_0xf591('0xb')](),controller[_0xf591('0x5a')]);router[_0xf591('0x36')](_0xf591('0x5b'),auth[_0xf591('0xb')](),controller[_0xf591('0x5c')]);router[_0xf591('0x36')]('/:id/chat_websites',auth[_0xf591('0xb')](),controller[_0xf591('0x5d')]);router['post'](_0xf591('0x2f'),auth['isAuthenticated'](),controller[_0xf591('0x5e')]);router[_0xf591('0x36')](_0xf591('0x31'),auth['isAuthenticated'](),controller[_0xf591('0x5f')]);router[_0xf591('0x36')]('/:id/api_key',auth[_0xf591('0xb')](),controller['createApiKey']);router[_0xf591('0x60')](_0xf591('0x61'),auth[_0xf591('0xb')](),controller[_0xf591('0x62')]);router[_0xf591('0x60')](_0xf591('0x63'),auth[_0xf591('0xb')](),controller[_0xf591('0x64')]);router[_0xf591('0x65')](_0xf591('0x11'),auth[_0xf591('0xb')](),controller[_0xf591('0x66')]);router['delete'](_0xf591('0x67'),auth['isAuthenticated'](),controller[_0xf591('0x68')]);router[_0xf591('0x65')](_0xf591('0x61'),auth['isAuthenticated'](),controller['destroy']);router[_0xf591('0x65')](_0xf591('0x4c'),auth[_0xf591('0xb')](),controller['removeChatInteractions']);router[_0xf591('0x65')]('/:id/mail_interactions',auth[_0xf591('0xb')](),controller[_0xf591('0x69')]);router[_0xf591('0x65')](_0xf591('0x50'),auth[_0xf591('0xb')](),controller['removeFaxInteractions']);router['delete'](_0xf591('0x52'),auth[_0xf591('0xb')](),controller[_0xf591('0x6a')]);router['delete']('/:id/openchannel_interactions',auth[_0xf591('0xb')](),controller['removeOpenchannelInteractions']);router['delete'](_0xf591('0x56'),auth[_0xf591('0xb')](),controller[_0xf591('0x6b')]);router['delete'](_0xf591('0x28'),auth[_0xf591('0xb')](),controller['removeFaxAccounts']);router['delete']('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0xf591('0x6c')]);router[_0xf591('0x65')](_0xf591('0x6d'),auth[_0xf591('0xb')](),controller[_0xf591('0x6e')]);router[_0xf591('0x65')](_0xf591('0x5b'),auth[_0xf591('0xb')](),controller[_0xf591('0x6f')]);router[_0xf591('0x65')]('/:id/chat_websites',auth[_0xf591('0xb')](),controller[_0xf591('0x70')]);router[_0xf591('0x65')](_0xf591('0x2f'),auth[_0xf591('0xb')](),controller[_0xf591('0x71')]);router[_0xf591('0x65')](_0xf591('0x31'),auth[_0xf591('0xb')](),controller[_0xf591('0x72')]);router[_0xf591('0x65')](_0xf591('0x34'),auth[_0xf591('0xb')](),controller[_0xf591('0x73')]);module[_0xf591('0x74')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 14a654d..ecadd51 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 _0xa1be=['from-sip','ALLOWED_NOT_SCREENED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','transport','join','shortinfo','inband','rfc2833','yes','nonat','outgoing','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','active','actpass','update','update,nonat','showWebBar','get','wss','encryption','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','map','phoneBarEnableScreenRecordingByAgent','screenrecording','blocked','blockedAt','loginAttempts','sequelize','util','lodash','STRING','name','setDataValue','defaultuser','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','ENUM','admin','user','agent','telephone','local','accountcode','BOOLEAN','DATE','INTEGER','dynamic','friend','peer'];(function(_0x542fd8,_0x56e82b){var _0x5ae1f4=function(_0x57e6eb){while(--_0x57e6eb){_0x542fd8['push'](_0x542fd8['shift']());}};_0x5ae1f4(++_0x56e82b);}(_0xa1be,0xd8));var _0xea1b=function(_0x37115c,_0x281549){_0x37115c=_0x37115c-0x0;var _0x2c73fa=_0xa1be[_0x37115c];return _0x2c73fa;};'use strict';var Sequelize=require(_0xea1b('0x0'));var moment=require('moment');var util=require(_0xea1b('0x1'));var _=require(_0xea1b('0x2'));module['exports']={'name':{'type':Sequelize[_0xea1b('0x3')],'allowNull':![],'unique':_0xea1b('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x14d76e){this[_0xea1b('0x5')]('name',_0x14d76e);this[_0xea1b('0x5')](_0xea1b('0x6'),_0x14d76e);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0xea1b('0x3')],'allowNull':![],'set':function(_0x3677a0){this[_0xea1b('0x5')](_0xea1b('0x7'),_0x3677a0);this['setDataValue'](_0xea1b('0x8'),util[_0xea1b('0x9')](_0xea1b('0xa'),_0x3677a0,this[_0xea1b('0xb')](_0xea1b('0xc'))));}},'alias':{'type':Sequelize[_0xea1b('0x3')]},'email':{'type':Sequelize[_0xea1b('0x3')],'allowNull':![],'unique':_0xea1b('0xd'),'validate':{'isEmail':!![]},'set':function(_0x19addd){if(_0x19addd){this[_0xea1b('0x5')](_0xea1b('0xd'),_0x19addd['toLowerCase']());}}},'role':{'type':Sequelize[_0xea1b('0xe')](_0xea1b('0xf'),_0xea1b('0x10'),_0xea1b('0x11'),_0xea1b('0x12')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0xea1b('0x13')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0xea1b('0xc'),'set':function(_0x1eb94f){this['setDataValue']('internal',_0x1eb94f);this[_0xea1b('0x5')](_0xea1b('0x14'),_0x1eb94f);this['setDataValue'](_0xea1b('0x8'),util[_0xea1b('0x9')]('\x22%s\x22\x20<%s>',this[_0xea1b('0xb')](_0xea1b('0x7')),_0x1eb94f));}},'salt':{'type':Sequelize[_0xea1b('0x3')]},'phone':{'type':Sequelize[_0xea1b('0x3')]},'mobile':{'type':Sequelize[_0xea1b('0x3')]},'address':{'type':Sequelize[_0xea1b('0x3')]},'zipcode':{'type':Sequelize[_0xea1b('0x3')]},'userpic':{'type':Sequelize[_0xea1b('0x3')]},'city':{'type':Sequelize[_0xea1b('0x3')]},'country':{'type':Sequelize[_0xea1b('0x3')]},'online':{'type':Sequelize[_0xea1b('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xea1b('0x16')]},'voicePause':{'type':Sequelize[_0xea1b('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xea1b('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xea1b('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xea1b('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xea1b('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0xea1b('0x16')]},'chatCapacity':{'type':Sequelize[_0xea1b('0x17')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xea1b('0x17')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xea1b('0x17')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xea1b('0x17')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xea1b('0x17')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xea1b('0x17')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xea1b('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xea1b('0x17')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xea1b('0x17')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xea1b('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xea1b('0x17')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xea1b('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xea1b('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xea1b('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0xea1b('0x3')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xea1b('0x18')},'ipaddr':{'type':Sequelize[_0xea1b('0x3')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0xea1b('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xea1b('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xea1b('0x17')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xea1b('0xe')](_0xea1b('0x19'),_0xea1b('0x10'),_0xea1b('0x1a')),'allowNull':!![],'defaultValue':_0xea1b('0x19')},'context':{'type':Sequelize[_0xea1b('0x3')],'allowNull':!![],'defaultValue':_0xea1b('0x1b')},'callingpres':{'type':Sequelize[_0xea1b('0xe')](_0xea1b('0x1c'),'ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED',_0xea1b('0x1d'),_0xea1b('0x1e'),'PROHIB_FAILED_SCREEN',_0xea1b('0x1f')),'allowNull':!![]},'deny':{'type':Sequelize[_0xea1b('0x3')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0xea1b('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xea1b('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xea1b('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0xea1b('0x3')],'allowNull':!![],'defaultValue':_0xea1b('0x20'),'set':function(_0x33235b){this[_0xea1b('0x5')](_0xea1b('0x21'),_0x33235b?_0x33235b[_0xea1b('0x22')](','):null);},'get':function(){return this[_0xea1b('0xb')](_0xea1b('0x21'))?this[_0xea1b('0xb')]('transport')['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xea1b('0xe')]('rfc2833','info',_0xea1b('0x23'),_0xea1b('0x24'),'auto'),'allowNull':!![],'defaultValue':_0xea1b('0x25')},'directmedia':{'type':Sequelize[_0xea1b('0xe')](_0xea1b('0x26'),'no',_0xea1b('0x27'),'update',_0xea1b('0x28')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xea1b('0xe')](_0xea1b('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xea1b('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0xea1b('0x3')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x23a265){this[_0xea1b('0x5')](_0xea1b('0x29'),_0x23a265?_0x23a265[_0xea1b('0x22')](','):null);},'get':function(){return this[_0xea1b('0xb')]('nat')?this[_0xea1b('0xb')]('nat')[_0xea1b('0x2a')](','):null;},'comment':_0xea1b('0x2b')},'callgroup':{'type':Sequelize[_0xea1b('0x3')]},'namedcallgroup':{'type':Sequelize[_0xea1b('0x3')]},'pickupgroup':{'type':Sequelize[_0xea1b('0x3')]},'namedpickupgroup':{'type':Sequelize[_0xea1b('0x3')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xea1b('0x3')]},'disallow':{'type':Sequelize[_0xea1b('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0xea1b('0x3')],'allowNull':![],'defaultValue':_0xea1b('0x2c'),'set':function(_0x44769e){this[_0xea1b('0x5')](_0xea1b('0x2d'),_0x44769e?_0x44769e[_0xea1b('0x22')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xea1b('0xb')](_0xea1b('0x2d'))?this[_0xea1b('0xb')]('allow')['split'](';'):null;},'comment':_0xea1b('0x2e')},'autoframing':{'type':Sequelize[_0xea1b('0xe')](_0xea1b('0x26'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xea1b('0x3')],'allowNull':!![],'set':function(_0x31a9ad){this[_0xea1b('0x5')]('insecure',_0x31a9ad?_0x31a9ad[_0xea1b('0x22')](','):null);},'get':function(){return this['getDataValue']('insecure')?this[_0xea1b('0xb')](_0xea1b('0x2f'))[_0xea1b('0x2a')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xea1b('0xe')](_0xea1b('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xea1b('0xe')](_0xea1b('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xea1b('0xe')](_0xea1b('0x26'),'no',_0xea1b('0x30')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xea1b('0xe')](_0xea1b('0x26'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xea1b('0xe')](_0xea1b('0x26'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xea1b('0x17')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xea1b('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xea1b('0x31')},'amaflags':{'type':Sequelize[_0xea1b('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xea1b('0xe')](_0xea1b('0x26'),'no'),'allowNull':!![],'defaultValue':_0xea1b('0x26')},'busylevel':{'type':Sequelize[_0xea1b('0x17')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xea1b('0xe')](_0xea1b('0x26'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0xea1b('0x26'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xea1b('0x26'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xea1b('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0xea1b('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0xea1b('0x26'),'no',_0xea1b('0x32')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xea1b('0x17')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xea1b('0xe')](_0xea1b('0x26'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xea1b('0xe')](_0xea1b('0x33'),_0xea1b('0x34'),_0xea1b('0x35')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xea1b('0x17')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xea1b('0xe')](_0xea1b('0x36'),_0xea1b('0x37')),'allowNull':!![],'defaultValue':_0xea1b('0x37')},'t38pt_usertpsource':{'type':Sequelize[_0xea1b('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xea1b('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xea1b('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xea1b('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xea1b('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xea1b('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xea1b('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xea1b('0x17')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xea1b('0xe')](_0xea1b('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xea1b('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xea1b('0x17')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xea1b('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xea1b('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xea1b('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xea1b('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0xea1b('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xea1b('0xe')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0xea1b('0x26'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xea1b('0xe')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xea1b('0xe')](_0xea1b('0x26'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xea1b('0xe')](_0xea1b('0x26'),'no',_0xea1b('0x38'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xea1b('0x17')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xea1b('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xea1b('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xea1b('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xea1b('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0xea1b('0x39'),'passive',_0xea1b('0x3a')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xea1b('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0xea1b('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xea1b('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0xea1b('0x26'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0xea1b('0x26'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xea1b('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xea1b('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xea1b('0xe')](_0xea1b('0x26'),'no',_0xea1b('0x27'),_0xea1b('0x3b'),_0xea1b('0x3c')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xea1b('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xea1b('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0xea1b('0x16')]},'showWebBar':{'type':Sequelize[_0xea1b('0x17')],'defaultValue':0x0,'set':function(_0x5e9a5a){this[_0xea1b('0x5')](_0xea1b('0x3d'),_0x5e9a5a);var _0x4fdfda=this[_0xea1b('0x3e')]({'plain':!![]});switch(_0x5e9a5a){case 0x0:case 0x1:var _0x10d989=_0x4fdfda['transport']?_['isArray'](_0x4fdfda[_0xea1b('0x21')])?_0x4fdfda['transport']['join']():_0x4fdfda[_0xea1b('0x21')]:_0xea1b('0x20');if(_0x10d989===_0xea1b('0x3f')){_0x10d989='udp';}this[_0xea1b('0x5')](_0xea1b('0x21'),_0x10d989);this['setDataValue'](_0xea1b('0x40'),'no');this[_0xea1b('0x5')]('avpf',null);this['setDataValue'](_0xea1b('0x41'),null);this['setDataValue'](_0xea1b('0x42'),null);this['setDataValue'](_0xea1b('0x43'),null);this['setDataValue'](_0xea1b('0x44'),null);this[_0xea1b('0x5')](_0xea1b('0x45'),null);this['setDataValue']('dtlscertfile',null);this[_0xea1b('0x5')](_0xea1b('0x46'),null);this[_0xea1b('0x5')](_0xea1b('0x47'),'no');break;case 0x2:this[_0xea1b('0x5')](_0xea1b('0x21'),'wss');this[_0xea1b('0x5')](_0xea1b('0x40'),'yes');this[_0xea1b('0x5')]('avpf',_0xea1b('0x26'));this['setDataValue'](_0xea1b('0x41'),'yes');this[_0xea1b('0x5')](_0xea1b('0x42'),'yes');this[_0xea1b('0x5')](_0xea1b('0x43'),_0xea1b('0x26'));this[_0xea1b('0x5')](_0xea1b('0x44'),'no');this[_0xea1b('0x5')](_0xea1b('0x45'),_0xea1b('0x3a'));this['setDataValue']('dtlscertfile',_0x4fdfda[_0xea1b('0x48')]||_0xea1b('0x49'));this['setDataValue'](_0xea1b('0x46'),_0x4fdfda[_0xea1b('0x46')]||_0xea1b('0x4a'));this[_0xea1b('0x5')](_0xea1b('0x47'),_0xea1b('0x26'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x2cdb16){this[_0xea1b('0x5')]('permissions',_0x2cdb16?_0x2cdb16[_0xea1b('0x22')](','):[]);},'get':function(){return this[_0xea1b('0xb')]('permissions')?_[_0xea1b('0x4b')](this[_0xea1b('0xb')]('permissions')['split'](','),function(_0x28a63e){return parseInt(_0x28a63e,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xea1b('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xea1b('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0xea1b('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0xea1b('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xea1b('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xea1b('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xea1b('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xea1b('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xea1b('0x17')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xea1b('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xea1b('0x17')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xea1b('0xe')](_0xea1b('0x26'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xea1b('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xea1b('0x3')]},'passwordResetAt':{'type':Sequelize[_0xea1b('0x16')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xea1b('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('phoneBarEnableScreenRecordingByAgent')?this['getDataValue'](_0xea1b('0x4c')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xea1b('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xea1b('0x15')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xea1b('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xea1b('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xea1b('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x140812){if(typeof _0x140812==='string'){var _0x31dcc0=_0x140812==='1'?!![]:_0x140812==='0'?![]:_0x140812==='true'?!![]:_0x140812==='false'?![]:![];this['setDataValue'](_0xea1b('0x4d'),_0x31dcc0);}else{this[_0xea1b('0x5')]('screenrecording',_0x140812);}}},'blocked':{'type':Sequelize[_0xea1b('0x15')],'defaultValue':![],'set':function(_0x378d76){this[_0xea1b('0x5')](_0xea1b('0x4e'),_0x378d76);if(_0x378d76===!![]){this[_0xea1b('0x5')](_0xea1b('0x4f'),moment());this[_0xea1b('0x5')](_0xea1b('0x50'),0x0);}else{this[_0xea1b('0x5')](_0xea1b('0x4f'),null);}}},'blockedAt':{'type':Sequelize[_0xea1b('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xea1b('0x17')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xea1b('0x15')],'defaultValue':![]}}; \ No newline at end of file +var _0xcfe2=['inband','yes','update','outgoing','nat','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','split','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','actpass','nonat','update,nonat','showWebBar','get','wss','encryption','force_avp','icesupport','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','avpf','dtlscertfile','/etc/pki/tls/private/motion.key','TEXT','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','email','toLowerCase','admin','user','agent','telephone','local','INTEGER','internal','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','ENUM','peer','friend','from-sip','ALLOWED_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','transport','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo'];(function(_0x1d31ea,_0x529869){var _0x19cf91=function(_0x2078ef){while(--_0x2078ef){_0x1d31ea['push'](_0x1d31ea['shift']());}};_0x19cf91(++_0x529869);}(_0xcfe2,0x137));var _0x2cfe=function(_0x38d240,_0x31d475){_0x38d240=_0x38d240-0x0;var _0x15f36c=_0xcfe2[_0x38d240];return _0x15f36c;};'use strict';var Sequelize=require(_0x2cfe('0x0'));var moment=require(_0x2cfe('0x1'));var util=require(_0x2cfe('0x2'));var _=require(_0x2cfe('0x3'));module[_0x2cfe('0x4')]={'name':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':![],'unique':_0x2cfe('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2cff16){this[_0x2cfe('0x7')](_0x2cfe('0x6'),_0x2cff16);this[_0x2cfe('0x7')]('defaultuser',_0x2cff16);},'comment':_0x2cfe('0x8')},'fullname':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':![],'set':function(_0x24cade){this['setDataValue'](_0x2cfe('0x9'),_0x24cade);this[_0x2cfe('0x7')](_0x2cfe('0xa'),util[_0x2cfe('0xb')](_0x2cfe('0xc'),_0x24cade,this[_0x2cfe('0xd')]('internal')));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':![],'unique':_0x2cfe('0xe'),'validate':{'isEmail':!![]},'set':function(_0x42df60){if(_0x42df60){this['setDataValue'](_0x2cfe('0xe'),_0x42df60[_0x2cfe('0xf')]());}}},'role':{'type':Sequelize['ENUM'](_0x2cfe('0x10'),_0x2cfe('0x11'),_0x2cfe('0x12'),_0x2cfe('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x2cfe('0x5')],'defaultValue':_0x2cfe('0x14')},'internal':{'type':Sequelize[_0x2cfe('0x15')](0xb),'allowNull':![],'unique':_0x2cfe('0x16'),'set':function(_0x206ee6){this['setDataValue'](_0x2cfe('0x16'),_0x206ee6);this['setDataValue']('accountcode',_0x206ee6);this['setDataValue']('callerid',util['format'](_0x2cfe('0xc'),this[_0x2cfe('0xd')]('fullname'),_0x206ee6));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x2cfe('0x5')]},'mobile':{'type':Sequelize[_0x2cfe('0x5')]},'address':{'type':Sequelize[_0x2cfe('0x5')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x2cfe('0x5')]},'city':{'type':Sequelize[_0x2cfe('0x5')]},'country':{'type':Sequelize[_0x2cfe('0x5')]},'online':{'type':Sequelize[_0x2cfe('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x2cfe('0x18')]},'voicePause':{'type':Sequelize[_0x2cfe('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x2cfe('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x2cfe('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x2cfe('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x2cfe('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x2cfe('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x2cfe('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x2cfe('0x19')},'lastPauseAt':{'type':Sequelize[_0x2cfe('0x18')]},'chatCapacity':{'type':Sequelize[_0x2cfe('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x2cfe('0x15')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x2cfe('0x15')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x2cfe('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x2cfe('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x2cfe('0x15')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x2cfe('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x2cfe('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x2cfe('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x2cfe('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x2cfe('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x2cfe('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x2cfe('0x17')],'defaultValue':![]},'description':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':!![]},'host':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':!![],'defaultValue':_0x2cfe('0x1a')},'ipaddr':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':!![]},'port':{'type':Sequelize[_0x2cfe('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x2cfe('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x2cfe('0x1b')]('friend',_0x2cfe('0x11'),_0x2cfe('0x1c')),'allowNull':!![],'defaultValue':_0x2cfe('0x1d')},'context':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':!![],'defaultValue':_0x2cfe('0x1e')},'callingpres':{'type':Sequelize[_0x2cfe('0x1b')](_0x2cfe('0x1f'),'ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED',_0x2cfe('0x20'),_0x2cfe('0x21'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':!![]},'permit':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':!![]},'secret':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':!![]},'transport':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':!![],'defaultValue':_0x2cfe('0x22'),'set':function(_0x28389d){this[_0x2cfe('0x7')](_0x2cfe('0x23'),_0x28389d?_0x28389d[_0x2cfe('0x24')](','):null);},'get':function(){return this['getDataValue'](_0x2cfe('0x23'))?this['getDataValue'](_0x2cfe('0x23'))['split'](','):null;},'comment':_0x2cfe('0x25')},'dtmfmode':{'type':Sequelize[_0x2cfe('0x1b')](_0x2cfe('0x26'),_0x2cfe('0x27'),_0x2cfe('0x28'),_0x2cfe('0x29'),'auto'),'allowNull':!![],'defaultValue':_0x2cfe('0x26')},'directmedia':{'type':Sequelize[_0x2cfe('0x1b')](_0x2cfe('0x2a'),'no','nonat',_0x2cfe('0x2b'),_0x2cfe('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2cfe('0x1b')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x1e136d){this[_0x2cfe('0x7')]('nat',_0x1e136d?_0x1e136d[_0x2cfe('0x24')](','):null);},'get':function(){return this[_0x2cfe('0xd')]('nat')?this['getDataValue'](_0x2cfe('0x2d'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x2cfe('0x5')]},'namedcallgroup':{'type':Sequelize[_0x2cfe('0x5')]},'pickupgroup':{'type':Sequelize[_0x2cfe('0x5')]},'namedpickupgroup':{'type':Sequelize[_0x2cfe('0x5')]},'language':{'type':Sequelize[_0x2cfe('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':![],'defaultValue':_0x2cfe('0x2e'),'set':function(_0x480a0e){this[_0x2cfe('0x7')](_0x2cfe('0x2f'),_0x480a0e?_0x480a0e[_0x2cfe('0x24')](';'):_0x2cfe('0x2e'));},'get':function(){return this[_0x2cfe('0xd')](_0x2cfe('0x2f'))?this[_0x2cfe('0xd')]('allow')['split'](';'):null;},'comment':_0x2cfe('0x30')},'autoframing':{'type':Sequelize['ENUM'](_0x2cfe('0x2a'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':!![],'set':function(_0x3d6ad9){this[_0x2cfe('0x7')](_0x2cfe('0x31'),_0x3d6ad9?_0x3d6ad9['join'](','):null);},'get':function(){return this['getDataValue'](_0x2cfe('0x31'))?this[_0x2cfe('0xd')](_0x2cfe('0x31'))[_0x2cfe('0x32')](','):null;},'comment':_0x2cfe('0x33')},'trustrpid':{'type':Sequelize[_0x2cfe('0x1b')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x2cfe('0x1b')](_0x2cfe('0x2a'),'no',_0x2cfe('0x34')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x2cfe('0x1b')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x2cfe('0x1b')](_0x2cfe('0x2a'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x2cfe('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':!![],'defaultValue':_0x2cfe('0x35')},'amaflags':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':_0x2cfe('0x2a')},'busylevel':{'type':Sequelize[_0x2cfe('0x15')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x2cfe('0x1b')](_0x2cfe('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x2cfe('0x1b')](_0x2cfe('0x2a'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x2cfe('0x2a'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x2cfe('0x1b')](_0x2cfe('0x2a'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x2cfe('0x1b')](_0x2cfe('0x2a'),'no',_0x2cfe('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x2cfe('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x2cfe('0x1b')](_0x2cfe('0x2a'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM']('accept',_0x2cfe('0x37'),_0x2cfe('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x2cfe('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x2cfe('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x2cfe('0x39'),_0x2cfe('0x3a')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x2cfe('0x1b')](_0x2cfe('0x2a'),'no'),'allowNull':!![],'defaultValue':_0x2cfe('0x2a')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x2cfe('0x15')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x2cfe('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x2cfe('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x2cfe('0x15')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x2cfe('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x2cfe('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x2cfe('0x1b')](_0x2cfe('0x2a'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x2cfe('0x1b')](_0x2cfe('0x2a'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x2cfe('0x1b')](_0x2cfe('0x2a'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x2cfe('0x1b')](_0x2cfe('0x2a'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x2cfe('0x2a'),'no',_0x2cfe('0x3b'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x2cfe('0x1b')](_0x2cfe('0x3c'),_0x2cfe('0x3d'),_0x2cfe('0x3e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x2cfe('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x2cfe('0x15')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x2cfe('0x1b')](_0x2cfe('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x2cfe('0x1b')](_0x2cfe('0x2a'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x2cfe('0x1b')](_0x2cfe('0x2a'),'no',_0x2cfe('0x3f'),'update',_0x2cfe('0x40')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x2cfe('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x2cfe('0x5')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x4e5ddb){this['setDataValue'](_0x2cfe('0x41'),_0x4e5ddb);var _0x57ad10=this[_0x2cfe('0x42')]({'plain':!![]});switch(_0x4e5ddb){case 0x0:case 0x1:var _0x607193=_0x57ad10[_0x2cfe('0x23')]?_['isArray'](_0x57ad10['transport'])?_0x57ad10[_0x2cfe('0x23')][_0x2cfe('0x24')]():_0x57ad10[_0x2cfe('0x23')]:'udp';if(_0x607193===_0x2cfe('0x43')){_0x607193=_0x2cfe('0x22');}this[_0x2cfe('0x7')](_0x2cfe('0x23'),_0x607193);this[_0x2cfe('0x7')](_0x2cfe('0x44'),'no');this[_0x2cfe('0x7')]('avpf',null);this[_0x2cfe('0x7')](_0x2cfe('0x45'),null);this[_0x2cfe('0x7')](_0x2cfe('0x46'),null);this[_0x2cfe('0x7')]('dtlsenable',null);this[_0x2cfe('0x7')](_0x2cfe('0x47'),null);this['setDataValue'](_0x2cfe('0x48'),null);this['setDataValue']('dtlscertfile',null);this[_0x2cfe('0x7')](_0x2cfe('0x49'),null);this[_0x2cfe('0x7')](_0x2cfe('0x4a'),'no');break;case 0x2:this[_0x2cfe('0x7')]('transport',_0x2cfe('0x43'));this[_0x2cfe('0x7')](_0x2cfe('0x44'),_0x2cfe('0x2a'));this[_0x2cfe('0x7')](_0x2cfe('0x4b'),'yes');this[_0x2cfe('0x7')]('force_avp',_0x2cfe('0x2a'));this[_0x2cfe('0x7')]('icesupport',_0x2cfe('0x2a'));this[_0x2cfe('0x7')]('dtlsenable','yes');this['setDataValue'](_0x2cfe('0x47'),'no');this[_0x2cfe('0x7')]('dtlssetup',_0x2cfe('0x3e'));this[_0x2cfe('0x7')](_0x2cfe('0x4c'),_0x57ad10['dtlscertfile']||'/etc/pki/tls/certs/motion.crt');this[_0x2cfe('0x7')]('dtlsprivatekey',_0x57ad10['dtlsprivatekey']||_0x2cfe('0x4d'));this['setDataValue'](_0x2cfe('0x4a'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x2cfe('0x4e')],'set':function(_0x20812a){this[_0x2cfe('0x7')]('permissions',_0x20812a?_0x20812a[_0x2cfe('0x24')](','):[]);},'get':function(){return this[_0x2cfe('0xd')](_0x2cfe('0x4f'))?_['map'](this['getDataValue'](_0x2cfe('0x4f'))[_0x2cfe('0x32')](','),function(_0xe72752){return parseInt(_0xe72752,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x2cfe('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x2cfe('0x5')]},'phoneBarBusyNumber':{'type':Sequelize[_0x2cfe('0x5')]},'phoneBarUnconditional':{'type':Sequelize[_0x2cfe('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x2cfe('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x2cfe('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x2cfe('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x2cfe('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x2cfe('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x2cfe('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x2cfe('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x2cfe('0x1b')](_0x2cfe('0x2a'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x2cfe('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x2cfe('0x5')]},'passwordResetAt':{'type':Sequelize[_0x2cfe('0x18')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0x2cfe('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x2cfe('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x2cfe('0x50')],'get':function(){return this[_0x2cfe('0xd')]('phoneBarEnableScreenRecordingByAgent')?this['getDataValue'](_0x2cfe('0x51')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x2cfe('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x2cfe('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0x2cfe('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x2cfe('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x2cfe('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x2cfe('0x17')],'defaultValue':![],'set':function(_0x537199){if(typeof _0x537199===_0x2cfe('0x52')){var _0x638c5d=_0x537199==='1'?!![]:_0x537199==='0'?![]:_0x537199==='true'?!![]:_0x537199===_0x2cfe('0x53')?![]:![];this[_0x2cfe('0x7')]('screenrecording',_0x638c5d);}else{this[_0x2cfe('0x7')](_0x2cfe('0x54'),_0x537199);}}},'blocked':{'type':Sequelize[_0x2cfe('0x17')],'defaultValue':![],'set':function(_0x17a8f4){this[_0x2cfe('0x7')](_0x2cfe('0x55'),_0x17a8f4);if(_0x17a8f4===!![]){this[_0x2cfe('0x7')](_0x2cfe('0x56'),moment());this[_0x2cfe('0x7')](_0x2cfe('0x57'),0x0);}else{this['setDataValue'](_0x2cfe('0x56'),null);}}},'blockedAt':{'type':Sequelize[_0x2cfe('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x2cfe('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 803405c..e5d0e55 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 _0x923a=['mailPause','chatPause','faxPause','openchannelPause','smsPause','pauseType','lastPauseAt','manual','mail','chat','sms','whatsapp','openchannel','%s%s','getTeams','Team','addTeams','omit','setDataValue','getMailQueues','Mail','getSmsQueues','Sms','getWhatsappQueues','Whatsapp','getFaxQueues','Fax','getOpenchannelQueues','Openchannel','transaction','getDataValue','Voice','removeTeams','getChatQueues','Chat','flatten','Queue:remove','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','user_has_chat_interactions:save','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','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','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$or','$gt','$gte','$lt','$eq','$between','$notBetween','$in','$like','$notLike','$iLike','$contains','$contained','$any','firstName','dialActive','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','ejs','lodash','crypto','jsforce','to-csv','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','./user.socket','register','client','http','test','Sequelize','ValidationError','request','then','info','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','limit','set','Content-Range','save','update','Users','user','Agents','telephone','filter','value','role','find','name','UserProfileResource','destroy','stack','send','index','map','User','fieldName','key','model','password','salt','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','sequelize','lower','col','options','count','include','params','differenceBy','rawAttributes','includeAll','bulkCreate','body','describe','addContacts','ids','agent','agent\x20role','admin','telephones','users','isNil','License\x20limit\x20reached','format','count\x20%s:\x20%s','create','Setting','findById','securePassword','min_internal','max','internal','QueryTypes','SELECT','from','VoiceMail','fullname','permissions','102','103','113','110','104','105','106','107','108','109','100','111','114','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Telephones','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','changePassword','findOne','oldPassword','newPassword','Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword','authenticate','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','channel','voicePause','isValidChannel','Unknown\x20channel','add','penalty','spread','capitalize','toLowerCase','QueueId','emit','Queue:save','voice','VoiceQueue','online','push','interface','each','UserVoiceQueueRt','upsert','removeQueues','Queues','userpic','file','filename','join','root','server/files/images/logos/default_profile.png','server/files/images/','download','CmContact','hasOwnProperty','CmList','List','Tag','Tags','color','tag','getContacts','Queue','findAll','getVoiceQueuesRt','getGroups','ChatGroup','VoiceRecording','UserId','rows','getScreenRecordings','ScreenRecording','ChatInteraction','getChatInteractions','getOpenchannelInteractions','MailInteraction','getSmsInteractions','getFaxInteractions','getWhatsappInteractions','phone','mobile','loginInPause','LOCAL/%s@from-sip/n','intrf','SIP/%s','headers','x-forwarded-for','connection','remoteAddress','socket','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','all','getChannels','YYYY-MM-DD\x20HH:mm:ss','device','PAUSE','LOGININPAUSE','resolve','logout','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','unpause'];(function(_0x35324e,_0x3e9c63){var _0x426e6b=function(_0x2a30b5){while(--_0x2a30b5){_0x35324e['push'](_0x35324e['shift']());}};_0x426e6b(++_0x3e9c63);}(_0x923a,0x1de));var _0xa923=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x923a[_0x178e48];return _0x440d7e;};'use strict';var pdf=require(_0xa923('0x0'));var emlformat=require(_0xa923('0x1'));var rimraf=require(_0xa923('0x2'));var zipdir=require(_0xa923('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa923('0x4'));var moment=require('moment');var BPromise=require(_0xa923('0x5'));var Mustache=require(_0xa923('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa923('0x7'));var fs=require('fs');var _=require(_0xa923('0x8'));var squel=require('squel');var crypto=require(_0xa923('0x9'));var jsforce=require(_0xa923('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xa923('0xb'));var querystring=require(_0xa923('0xc'));var Papa=require('papaparse');var Redis=require(_0xa923('0xd'));var authService=require(_0xa923('0xe'));var qs=require(_0xa923('0xf'));var as=require(_0xa923('0x10'));var hardwareService=require(_0xa923('0x11'));var logger=require(_0xa923('0x12'))(_0xa923('0x13'));var utils=require('../../config/utils');var config=require(_0xa923('0x14'));var db=require(_0xa923('0x15'))['db'];config[_0xa923('0x16')]=_[_0xa923('0x17')](config[_0xa923('0x16')],{'host':_0xa923('0x18'),'port':0x18eb});var socket=require(_0xa923('0x19'))(new Redis(config[_0xa923('0x16')]));require(_0xa923('0x1a'))[_0xa923('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0xa923('0x1c')][_0xa923('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x3076d3,_0x2ed7aa,_0x1d52a0){if(_0x1d52a0){var _0x4a14fc=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4a14fc[_0xa923('0x1e')](_0x2ed7aa)){return _0x3076d3;}else{throw new db[(_0xa923('0x1f'))][(_0xa923('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 _0x3076d3;}}function respondWithRpcPromise(_0x1dda94,_0x50dd83,_0x104880,_0x5a30c1){return new BPromise(function(_0x4ec809,_0x561c62){var _0x1945a4=_0x5a30c1||client;return _0x1945a4[_0xa923('0x21')](_0x1dda94,_0x104880)[_0xa923('0x22')](function(_0x4099bf){logger[_0xa923('0x23')](_0xa923('0x24'),_0x50dd83,_0xa923('0x25'));logger['debug'](_0xa923('0x26'),_0x50dd83,_0xa923('0x25'),JSON[_0xa923('0x27')](_0x4099bf));if(_0x4099bf[_0xa923('0x28')]){if(_0x4099bf[_0xa923('0x28')][_0xa923('0x29')]===0x1f4){logger[_0xa923('0x28')]('User,\x20%s,\x20%s',_0x50dd83,_0x4099bf['error'][_0xa923('0x2a')]);return _0x561c62(_0x4099bf[_0xa923('0x28')][_0xa923('0x2a')]);}logger[_0xa923('0x28')](_0xa923('0x24'),_0x50dd83,_0x4099bf[_0xa923('0x28')][_0xa923('0x2a')]);return _0x4ec809(_0x4099bf[_0xa923('0x28')][_0xa923('0x2a')]);}else{logger[_0xa923('0x23')](_0xa923('0x24'),_0x50dd83,_0xa923('0x25'));_0x4ec809(_0x4099bf[_0xa923('0x2b')][_0xa923('0x2a')]);}})[_0xa923('0x2c')](function(_0x1b526a){logger[_0xa923('0x28')](_0xa923('0x24'),_0x50dd83,_0x1b526a);_0x561c62(_0x1b526a);});});}function respondWithStatusCode(_0x3ff34f,_0x3352c7){_0x3352c7=_0x3352c7||0xcc;return function(_0xcd0df0){if(_0xcd0df0){return _0x3ff34f[_0xa923('0x2d')](_0x3352c7);}return _0x3ff34f['status'](_0x3352c7)[_0xa923('0x2e')]();};}function respondWithResult(_0x400813,_0x38674c){_0x38674c=_0x38674c||0xc8;return function(_0x3be5f8){if(_0x3be5f8){return _0x400813[_0xa923('0x2f')](_0x38674c)[_0xa923('0x30')](_0x3be5f8);}};}function respondWithFilteredResult(_0x20a1bd,_0x347f04){return function(_0x5130b3){if(_0x5130b3){var _0x551e50=_0x5130b3['count'],_0x68af9b=_0x347f04['offset'],_0x104627=_0x347f04[_0xa923('0x31')]+_0x347f04[_0xa923('0x32')],_0x389171;if(_0x104627>=_0x551e50){_0x104627=_0x551e50;_0x389171=0xc8;}else{_0x389171=0xce;}_0x20a1bd[_0xa923('0x2f')](_0x389171);return _0x20a1bd[_0xa923('0x33')](_0xa923('0x34'),_0x68af9b+'-'+_0x104627+'/'+_0x551e50)[_0xa923('0x30')](_0x5130b3);}return null;};}function patchUpdates(_0x1bcc02){return function(_0x35b616){try{jsonpatch['apply'](_0x35b616,_0x1bcc02,!![]);}catch(_0x4a5f38){return BPromise['reject'](_0x4a5f38);}return _0x35b616[_0xa923('0x35')]();};}function saveUpdates(_0xb79333,_0x450d47){return function(_0x4f8aa0){if(_0x4f8aa0){return _0x4f8aa0[_0xa923('0x36')](_0xb79333)['then'](function(_0x28707){return _0x28707;});}return null;};}function removeEntity(_0x474936,_0x484e8f){return function(_0x301fb2){if(_0x301fb2){return _0x301fb2['destroy']()[_0xa923('0x22')](function(){var _0x25708b=_0x301fb2['get']({'plain':!![]});var _0x2b4121=[{'name':_0xa923('0x37'),'value':_0xa923('0x38'),'ignore':!![]},{'name':_0xa923('0x39'),'value':'agent','ignore':![]},{'name':'Telephones','value':_0xa923('0x3a'),'ignore':![]}];var _0x18c0a6=_(_0x2b4121)[_0xa923('0x3b')]('ignore')['map'](_0xa923('0x3c'))[_0xa923('0x3c')]();if(_['includes'](_0x18c0a6,_0x25708b[_0xa923('0x3d')])){return;}var _0x2f6039=_[_0xa923('0x3e')](_0x2b4121,[_0xa923('0x3c'),_0x25708b['role']])[_0xa923('0x3f')];return db[_0xa923('0x40')][_0xa923('0x41')]({'where':{'type':_0x2f6039,'resourceId':_0x25708b['id']}})[_0xa923('0x22')](function(){return _0x301fb2;});})[_0xa923('0x22')](function(){_0x474936[_0xa923('0x2f')](0xcc)[_0xa923('0x2e')]();});}};}function handleEntityNotFound(_0x25d5cc,_0x28a500){return function(_0x324b42){if(!_0x324b42){_0x25d5cc['sendStatus'](0x194);}return _0x324b42;};}function handleError(_0x490f2a,_0x5a2cbf){_0x5a2cbf=_0x5a2cbf||0x1f4;return function(_0x591784){logger[_0xa923('0x28')](_0x591784[_0xa923('0x42')]);if(_0x591784[_0xa923('0x3f')]){delete _0x591784['name'];}_0x490f2a[_0xa923('0x2f')](_0x5a2cbf)[_0xa923('0x43')](_0x591784);};}exports[_0xa923('0x44')]=function(_0x52db90,_0x360198){var _0x108837={},_0x1a4dc3={},_0x1a7e9c={'count':0x0,'rows':[]};var _0x59f129=_[_0xa923('0x45')](db[_0xa923('0x46')]['rawAttributes'],function(_0x14cae8){return{'name':_0x14cae8[_0xa923('0x47')],'type':_0x14cae8['type'][_0xa923('0x48')]};});_0x1a4dc3[_0xa923('0x49')]=_['differenceBy'](_[_0xa923('0x45')](_0x59f129,_0xa923('0x3f')),[_0xa923('0x4a'),_0xa923('0x4b')]);_0x1a4dc3[_0xa923('0x4c')]=_[_0xa923('0x4d')](_0x52db90[_0xa923('0x4c')]);_0x1a4dc3[_0xa923('0x4e')]=_[_0xa923('0x4f')](_0x1a4dc3['model'],_0x1a4dc3['query']);_0x108837['attributes']=_['intersection'](_0x1a4dc3['model'],qs[_0xa923('0x50')](_0x52db90[_0xa923('0x4c')][_0xa923('0x50')]));_0x108837[_0xa923('0x51')]=_0x108837[_0xa923('0x51')][_0xa923('0x52')]?_0x108837[_0xa923('0x51')]:_0x1a4dc3[_0xa923('0x49')];if(!_0x52db90[_0xa923('0x4c')]['hasOwnProperty'](_0xa923('0x53'))){_0x108837[_0xa923('0x32')]=qs['limit'](_0x52db90[_0xa923('0x4c')]['limit']);_0x108837[_0xa923('0x31')]=qs[_0xa923('0x31')](_0x52db90[_0xa923('0x4c')][_0xa923('0x31')]);}_0x108837[_0xa923('0x54')]=qs[_0xa923('0x55')](_0x52db90[_0xa923('0x4c')]['sort']);_0x108837[_0xa923('0x56')]=qs[_0xa923('0x4e')](_[_0xa923('0x57')](_0x52db90[_0xa923('0x4c')],_0x1a4dc3[_0xa923('0x4e')]),_0x59f129);if(_0x52db90[_0xa923('0x4c')]['filter']){_0x108837[_0xa923('0x56')]=_[_0xa923('0x58')](_0x108837[_0xa923('0x56')],{'$or':_[_0xa923('0x45')](_0x59f129,function(_0x156ca7){if(_0x156ca7[_0xa923('0x59')]!==_0xa923('0x5a')){return db[_0xa923('0x5b')]['where'](db[_0xa923('0x5b')]['fn'](_0xa923('0x5c'),db[_0xa923('0x5b')][_0xa923('0x5d')](_0x156ca7[_0xa923('0x3f')])),{'$like':db[_0xa923('0x5b')]['fn'](_0xa923('0x5c'),'%'+_0x52db90[_0xa923('0x4c')][_0xa923('0x3b')]+'%')});}})});}_0x108837=_[_0xa923('0x58')]({},_0x108837,_0x52db90[_0xa923('0x5e')]);var _0x155ac1={'where':_0x108837[_0xa923('0x56')]};return db[_0xa923('0x46')]['count'](_0x155ac1)[_0xa923('0x22')](function(_0x2576a3){_0x1a7e9c[_0xa923('0x5f')]=_0x2576a3;if(_0x52db90['query']['includeAll']){_0x108837[_0xa923('0x60')]=[{'all':!![]}];}return db[_0xa923('0x46')]['findAll'](_0x108837);})[_0xa923('0x22')](function(_0x2fe4da){_0x1a7e9c['rows']=_0x2fe4da;return _0x1a7e9c;})[_0xa923('0x22')](respondWithFilteredResult(_0x360198,_0x108837))['catch'](handleError(_0x360198,null));};exports['show']=function(_0x21ef25,_0x544d74){var _0x3043cf={'raw':![],'where':{'id':_0x21ef25[_0xa923('0x61')]['id']}},_0x1d2996={};_0x1d2996[_0xa923('0x49')]=_[_0xa923('0x62')](_[_0xa923('0x4d')](db[_0xa923('0x46')][_0xa923('0x63')]),['password','salt']);_0x1d2996['query']=_[_0xa923('0x4d')](_0x21ef25[_0xa923('0x4c')]);_0x1d2996['filters']=_[_0xa923('0x4f')](_0x1d2996['model'],_0x1d2996[_0xa923('0x4c')]);_0x3043cf[_0xa923('0x51')]=_['intersection'](_0x1d2996[_0xa923('0x49')],qs[_0xa923('0x50')](_0x21ef25[_0xa923('0x4c')][_0xa923('0x50')]));_0x3043cf[_0xa923('0x51')]=_0x3043cf[_0xa923('0x51')][_0xa923('0x52')]?_0x3043cf[_0xa923('0x51')]:_0x1d2996[_0xa923('0x49')];if(_0x21ef25['query'][_0xa923('0x64')]){_0x3043cf[_0xa923('0x60')]=[{'all':!![]}];}_0x3043cf=_[_0xa923('0x58')]({},_0x3043cf,_0x21ef25[_0xa923('0x5e')]);return db[_0xa923('0x46')][_0xa923('0x3e')](_0x3043cf)[_0xa923('0x22')](handleEntityNotFound(_0x544d74,null))[_0xa923('0x22')](respondWithResult(_0x544d74,null))[_0xa923('0x2c')](handleError(_0x544d74,null));};exports[_0xa923('0x65')]=function(_0x357e85,_0x1d3067){return db[_0xa923('0x46')]['bulkCreate'](_0x357e85[_0xa923('0x66')],{'raw':![],'individualHooks':!![]})[_0xa923('0x22')](respondWithResult(_0x1d3067,0xc9))[_0xa923('0x2c')](handleError(_0x1d3067,null));};exports[_0xa923('0x36')]=function(_0x50e99f,_0x48e388){if(_0x50e99f['body']['id']){delete _0x50e99f['body']['id'];}delete _0x50e99f[_0xa923('0x66')][_0xa923('0x3d')];return db[_0xa923('0x46')][_0xa923('0x3e')]({'where':{'id':_0x50e99f['params']['id']}})[_0xa923('0x22')](handleEntityNotFound(_0x48e388,null))[_0xa923('0x22')](saveUpdates(_0x50e99f[_0xa923('0x66')],null))[_0xa923('0x22')](respondWithResult(_0x48e388,null))[_0xa923('0x2c')](handleError(_0x48e388,null));};exports[_0xa923('0x67')]=function(_0x397ae2,_0x123242){return db[_0xa923('0x46')][_0xa923('0x67')]()[_0xa923('0x22')](respondWithResult(_0x123242,null))[_0xa923('0x2c')](handleError(_0x123242,null));};exports[_0xa923('0x68')]=function(_0x3cab31,_0x404d51,_0x4a05e7){return db[_0xa923('0x46')][_0xa923('0x3e')]({'where':{'id':_0x3cab31[_0xa923('0x61')]['id']}})[_0xa923('0x22')](handleEntityNotFound(_0x404d51,null))['then'](function(_0x50e0b1){if(_0x50e0b1){return _0x50e0b1[_0xa923('0x68')](_0x3cab31[_0xa923('0x66')][_0xa923('0x69')],_['omit'](_0x3cab31['body'],['ids','id'])||{});}})[_0xa923('0x22')](respondWithResult(_0x404d51,null))[_0xa923('0x2c')](handleError(_0x404d51,null));};var getLicense=function(_0x41e28){return new BPromise(function(_0x204b9c,_0x21b950){var _0xe2d2f1=0x0;_0x41e28[_0xa923('0x66')][_0xa923('0x3d')]===_0xa923('0x6a')&&_0x204b9c(_0xa923('0x6b'));return db[_0xa923('0x46')]['count']({'where':{'$or':[{'role':_0x41e28[_0xa923('0x66')][_0xa923('0x3d')]==='telephone'?_0xa923('0x3a'):[_0xa923('0x6c'),_0xa923('0x38')]}]}})[_0xa923('0x22')](function(_0x99c37){_0xe2d2f1=_0x99c37;return require('../../config/license/util')['getLicense']();})['then'](function(_0x4e7433){var _0x51d16b=_0x41e28['body']['role']===_0xa923('0x3a')?_0xa923('0x6d'):_0xa923('0x6e');if(!_[_0xa923('0x6f')](_0x4e7433[_0x51d16b])&&_0xe2d2f1>=_0x4e7433[_0x51d16b]){return _0x21b950({'message':_0xa923('0x70')});}return _0x204b9c(util[_0xa923('0x71')](_0xa923('0x72'),_0x51d16b,_0xe2d2f1));})[_0xa923('0x2c')](function(_0x4dc7a3){return _0x21b950(_0x4dc7a3);});});};exports[_0xa923('0x73')]=function(_0x10fa79,_0x5d9a6d){return getLicense(_0x10fa79)['then'](function(_0xbb7d78){if(!_0x10fa79[_0xa923('0x66')]['internal']){var _0x4b5427;return db[_0xa923('0x74')][_0xa923('0x75')](0x1)[_0xa923('0x22')](function(_0xe74368){return checkPasswordPattern(_0xe74368,_0x10fa79[_0xa923('0x66')][_0xa923('0x4a')],_0xe74368[_0xa923('0x76')]);})['then'](function(_0x33efd9){_0x4b5427=_0x33efd9[_0xa923('0x77')];return db[_0xa923('0x46')][_0xa923('0x78')]('internal');})['then'](function(_0x17db43){if(_[_0xa923('0x6f')](_0x17db43)){if(_0x4b5427){_0x10fa79[_0xa923('0x66')][_0xa923('0x79')]=_0x4b5427;}else{_0x10fa79[_0xa923('0x66')][_0xa923('0x79')]=0x1;}}else{if(_[_0xa923('0x6f')](_0x4b5427)||_0x4b5427==_0x17db43){_0x10fa79[_0xa923('0x66')][_0xa923('0x79')]=_0x17db43+0x1;}else if(_0x4b5427>_0x17db43){_0x10fa79[_0xa923('0x66')][_0xa923('0x79')]=_0x4b5427;}else{return db['sequelize']['query']('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0xa923('0x5b')][_0xa923('0x7a')][_0xa923('0x7b')]})[_0xa923('0x22')](function(_0x3c2124){if(_0x3c2124&&_0x3c2124[_0xa923('0x52')]){for(var _0x3d5d83=0x0,_0x490af7=_0x3c2124[_0xa923('0x52')];_0x3d5d83<_0x490af7&&_[_0xa923('0x6f')](_0x10fa79[_0xa923('0x66')][_0xa923('0x79')]);_0x3d5d83++){if(_0x4b5427<=_0x3c2124[_0x3d5d83]['from']){_0x10fa79[_0xa923('0x66')][_0xa923('0x79')]=_0x3c2124[_0x3d5d83][_0xa923('0x7c')];}else if(_0x4b5427>_0x3c2124[_0x3d5d83][_0xa923('0x7c')]&&_0x4b5427<=_0x3c2124[_0x3d5d83]['to']){_0x10fa79['body']['internal']=_0x4b5427;}}}if(_['isNil'](_0x10fa79[_0xa923('0x66')]['internal'])){_0x10fa79[_0xa923('0x66')]['internal']=_0x17db43+0x1;}});}}});}})['then'](function(){if(_0x10fa79[_0xa923('0x66')]['voicemail']){_0x10fa79[_0xa923('0x66')]['mailbox']=_0x10fa79[_0xa923('0x66')]['internal'];_0x10fa79['body'][_0xa923('0x7d')]={'mailbox':_0x10fa79[_0xa923('0x66')][_0xa923('0x79')],'password':_0x10fa79[_0xa923('0x66')][_0xa923('0x4a')],'fullname':_0x10fa79[_0xa923('0x66')][_0xa923('0x7e')],'email':_0x10fa79[_0xa923('0x66')]['email']};}if(_0x10fa79[_0xa923('0x66')]&&_0x10fa79[_0xa923('0x66')][_0xa923('0x3d')]===_0xa923('0x6a')){if(!_0x10fa79[_0xa923('0x66')][_0xa923('0x7f')]){_0x10fa79[_0xa923('0x66')]['permissions']=['101',_0xa923('0x80'),_0xa923('0x81'),_0xa923('0x82'),_0xa923('0x83'),_0xa923('0x84'),_0xa923('0x85'),_0xa923('0x86'),_0xa923('0x87'),_0xa923('0x88'),_0xa923('0x89'),_0xa923('0x8a'),_0xa923('0x8b'),_0xa923('0x8c')];}}return db[_0xa923('0x46')][_0xa923('0x73')](_0x10fa79[_0xa923('0x66')],{'include':[{'model':db[_0xa923('0x7d')],'as':_0xa923('0x7d')}]});})[_0xa923('0x22')](function(_0x25ebc5){if(_0x10fa79[_0xa923('0x66')][_0xa923('0x3d')]===_0xa923('0x38'))return _0x25ebc5;var _0x596660=_0x10fa79['user'][_0xa923('0x8d')]({'plain':!![]});if(!_0x596660)throw new Error(_0xa923('0x8e'));if(_0x596660[_0xa923('0x3d')]==='user'){var _0x4cb278=_0x25ebc5[_0xa923('0x8d')]({'plain':!![]});var _0x132e1d=[{'name':'Agents','value':_0xa923('0x6a')},{'name':_0xa923('0x8f'),'value':_0xa923('0x3a')}];var _0x5da3e3=_[_0xa923('0x3e')](_0x132e1d,[_0xa923('0x3c'),_0x4cb278[_0xa923('0x3d')]])['name'];return db['UserProfileSection'][_0xa923('0x3e')]({'where':{'name':_0x5da3e3,'userProfileId':_0x596660[_0xa923('0x90')]},'raw':!![]})[_0xa923('0x22')](function(_0x4ab3a5){if(_0x4ab3a5&&_0x4ab3a5['autoAssociation']===0x0){return db[_0xa923('0x40')]['create']({'name':_0x4cb278['name'],'resourceId':_0x4cb278['id'],'type':_0x4ab3a5[_0xa923('0x3f')],'sectionId':_0x4ab3a5['id']},{})[_0xa923('0x22')](function(){return _0x25ebc5;});}else{return _0x25ebc5;}})[_0xa923('0x2c')](function(_0x57fc44){logger[_0xa923('0x28')](_0xa923('0x91'),_0x57fc44);throw _0x57fc44;});}return _0x25ebc5;})[_0xa923('0x22')](respondWithResult(_0x5d9a6d,0xc9))['catch'](handleError(_0x5d9a6d,null));};exports[_0xa923('0x92')]=function(_0x395828,_0x5e0d57,_0x2f3f8c){var _0x8124e2=![];if(_0x395828['body']['id']){delete _0x395828[_0xa923('0x66')]['id'];}return db[_0xa923('0x74')][_0xa923('0x93')]({'attributes':['id',_0xa923('0x76')]})[_0xa923('0x22')](function(_0x4b455a){_0x8124e2=_0x4b455a[_0xa923('0x76')];return db[_0xa923('0x46')][_0xa923('0x3e')]({'where':{'id':_0x395828[_0xa923('0x61')]['id']}});})[_0xa923('0x22')](function(_0x1a6615){if(_0x1a6615){if(_0x1a6615['id']==_0x395828['user']['id']){if(!_0x395828[_0xa923('0x66')][_0xa923('0x94')]||!_0x395828[_0xa923('0x66')][_0xa923('0x95')]){throw new db['Sequelize']['ValidationError'](_0xa923('0x96'));}if(!_0x1a6615[_0xa923('0x97')](_0x395828[_0xa923('0x66')][_0xa923('0x94')])){throw new db[(_0xa923('0x1f'))][(_0xa923('0x20'))](_0xa923('0x98'));}if(_0x395828['body']['oldPassword']==_0x395828[_0xa923('0x66')][_0xa923('0x95')]){throw new db[(_0xa923('0x1f'))][(_0xa923('0x20'))](_0xa923('0x99'));}return _0x1a6615;}else if(_0x395828['user'][_0xa923('0x3d')]==_0xa923('0x6c')){if(!_0x395828[_0xa923('0x66')]['newPassword']){throw new db[(_0xa923('0x1f'))][(_0xa923('0x20'))](_0xa923('0x9a'));}return _0x1a6615;}else if(_0x395828[_0xa923('0x38')]['role']==_0xa923('0x38')){if(!_0x395828[_0xa923('0x66')][_0xa923('0x95')]){throw new db[(_0xa923('0x1f'))]['ValidationError'](_0xa923('0x9a'));}if(_0x1a6615[_0xa923('0x3d')]!=_0xa923('0x6a')){throw new db['Sequelize'][(_0xa923('0x20'))](_0xa923('0x9b'));}return _0x1a6615;}else{throw new db['Sequelize'][(_0xa923('0x20'))](_0xa923('0x9b'));}}return null;})['then'](handleEntityNotFound(_0x5e0d57,null))['then'](function(_0x11ecc4){return checkPasswordPattern(_0x11ecc4,_0x395828[_0xa923('0x66')][_0xa923('0x95')],_0x8124e2);})['then'](saveUpdates({'password':_0x395828['body'][_0xa923('0x95')],'passwordResetAt':_0x395828[_0xa923('0x38')]['id']==_0x395828['params']['id']?moment():null},null))[_0xa923('0x22')](respondWithResult(_0x5e0d57,null))[_0xa923('0x2c')](handleError(_0x5e0d57,null));};exports['addQueues']=function(_0x1863d2,_0x183b51,_0x14aa62){var _0x35c67c=_0x1863d2[_0xa923('0x66')][_0xa923('0x9c')];return db['User']['find']({'where':{'id':_0x1863d2['params']['id']},'attributes':['id',_0xa923('0x3f'),'role','online','loginInPause',_0xa923('0x9d'),'interface']})['then'](handleEntityNotFound(_0x183b51,null))[_0xa923('0x22')](function(_0x5ebe9f){if(_0x5ebe9f){if(!utils[_0xa923('0x9e')](_0x35c67c)){throw new db[(_0xa923('0x1f'))][(_0xa923('0x20'))](_0xa923('0x9f'));}return _0x5ebe9f[_0xa923('0xa0')+_['capitalize'](_0x35c67c['toLowerCase']())+'Queues'](_0x1863d2['body'][_0xa923('0x69')],{'penalty':_0x1863d2[_0xa923('0x66')][_0xa923('0xa1')]||0x0})[_0xa923('0xa2')](function(_0x23e4fe){for(var _0x3eafe4=0x0;_0x3eafe4<_0x1863d2[_0xa923('0x66')][_0xa923('0x69')][_0xa923('0x52')];_0x3eafe4+=0x1){var _0x5e9f05={'UserId':_0x1863d2[_0xa923('0x61')]['id']};_0x5e9f05[_[_0xa923('0xa3')](_0x35c67c[_0xa923('0xa4')]())+_0xa923('0xa5')]=_0x1863d2['body']['ids'][_0x3eafe4];socket[_0xa923('0xa6')](_0xa923('0x38')+_[_0xa923('0xa3')](_0x35c67c[_0xa923('0xa4')]())+_0xa923('0xa7'),_0x5e9f05);}return _0x23e4fe;})[_0xa923('0x22')](function(){if(_0x35c67c===_0xa923('0xa8')){return db[_0xa923('0xa9')]['findAll']({'where':{'id':_0x1863d2['body'][_0xa923('0x69')]||[]},'raw':!![],'attributes':['id',_0xa923('0x3f')]});}})[_0xa923('0x22')](function(_0x59ef4a){var _0x571a32=_0x5ebe9f[_0xa923('0x8d')]({'plain':!![]});var _0x11a26a=[];if(_0x35c67c===_0xa923('0xa8')&&_0x571a32['role']==='agent'&&_0x571a32[_0xa923('0xaa')]){for(var _0x5e22db=0x0;_0x5e22db<_0x59ef4a['length'];_0x5e22db+=0x1){_0x11a26a[_0xa923('0xab')]({'membername':_0x571a32['name'],'UserId':_0x571a32['id'],'queue_name':_0x59ef4a[_0x5e22db]['name'],'VoiceQueueId':_0x59ef4a[_0x5e22db]['id'],'interface':_[_0xa923('0x6f')](_0x571a32[_0xa923('0xac')])?util[_0xa923('0x71')]('SIP/%s',_0x571a32[_0xa923('0x3f')]):_0x571a32[_0xa923('0xac')],'paused':_0x571a32[_0xa923('0x9d')]||![],'penalty':_0x1863d2[_0xa923('0x66')][_0xa923('0xa1')]||0x0});}return BPromise[_0xa923('0xad')](_0x11a26a,function(_0x34a819){return db[_0xa923('0xae')][_0xa923('0xaf')](_0x34a819);});}return _0x5ebe9f;});}})['then'](respondWithStatusCode(_0x183b51,null))['catch'](handleError(_0x183b51,null));};exports[_0xa923('0xb0')]=function(_0x29a716,_0x1022c2,_0x3081d5){var _0x431f01;return db[_0xa923('0x46')][_0xa923('0x3e')]({'where':{'id':_0x29a716[_0xa923('0x61')]['id']},'attributes':['id',_0xa923('0x3f'),_0xa923('0x3d')]})[_0xa923('0x22')](handleEntityNotFound(_0x1022c2,null))[_0xa923('0x22')](function(_0x3fe7b2){if(_0x3fe7b2){_0x431f01=_0x3fe7b2;if(!_0x29a716[_0xa923('0x4c')]['channel']||!utils[_0xa923('0x9e')](_0x29a716[_0xa923('0x4c')]['channel'])){throw new db[(_0xa923('0x1f'))]['ValidationError']('Unknown\x20channel');}return _0x3fe7b2['remove'+_[_0xa923('0xa3')](_0x29a716['query'][_0xa923('0x9c')][_0xa923('0xa4')]())+_0xa923('0xb1')](_0x29a716[_0xa923('0x4c')][_0xa923('0x69')]);}})[_0xa923('0x22')](function(_0x5753e3){for(var _0x3ccf07=0x0;_0x3ccf07<_0x29a716['query'][_0xa923('0x69')][_0xa923('0x52')];_0x3ccf07+=0x1){var _0x439ca0={'UserId':_0x29a716[_0xa923('0x61')]['id']};_0x439ca0[_['capitalize'](_0x29a716[_0xa923('0x4c')]['channel'][_0xa923('0xa4')]())+_0xa923('0xa5')]=_0x29a716['query'][_0xa923('0x69')][_0x3ccf07];socket[_0xa923('0xa6')](_0xa923('0x38')+_[_0xa923('0xa3')](_0x29a716[_0xa923('0x4c')][_0xa923('0x9c')][_0xa923('0xa4')]())+'Queue:remove',_0x439ca0);}return _0x5753e3;})[_0xa923('0x22')](function(){if(_0x29a716[_0xa923('0x4c')][_0xa923('0x9c')]==='voice'){return db[_0xa923('0xae')]['destroy']({'where':{'UserId':_0x29a716[_0xa923('0x61')]['id'],'VoiceQueueId':_0x29a716[_0xa923('0x4c')][_0xa923('0x69')]},'individualHooks':!![]})[_0xa923('0x22')](function(){return _0x431f01;});}return _0x431f01;})[_0xa923('0x22')](respondWithStatusCode(_0x1022c2,null))[_0xa923('0x2c')](handleError(_0x1022c2,null));};exports['addAvatar']=function(_0x15a603,_0x1007d6,_0x4e40e9){_0x15a603['body'][_0xa923('0xb2')]=_0x15a603[_0xa923('0xb3')][_0xa923('0xb4')];return db[_0xa923('0x46')][_0xa923('0x3e')]({'where':{'id':_0x15a603[_0xa923('0x61')]['id']}})[_0xa923('0x22')](handleEntityNotFound(_0x1007d6,null))['then'](saveUpdates(_0x15a603['body'],null))[_0xa923('0x22')](respondWithResult(_0x1007d6,null))[_0xa923('0x2c')](handleError(_0x1007d6,null));};exports['getAvatar']=function(_0x55fef6,_0x22cc60,_0x1aed31){var _0x4694a9=path[_0xa923('0xb5')](config[_0xa923('0xb6')],_0xa923('0xb7'));return db[_0xa923('0x46')][_0xa923('0x3e')]({'where':{'id':_0x55fef6[_0xa923('0x61')]['id']},'attributes':['id',_0xa923('0xb2')],'raw':!![]})[_0xa923('0x22')](handleEntityNotFound(_0x22cc60,null))[_0xa923('0x22')](function(_0xcd59e2){if(_0xcd59e2){if(_[_0xa923('0x6f')](_0xcd59e2[_0xa923('0xb2')])){return _0x22cc60['download'](_0x4694a9);}else{if(!fs['existsSync'](path[_0xa923('0xb5')](config['root'],_0xa923('0xb8'),_0xcd59e2[_0xa923('0xb2')]))){return _0x22cc60[_0xa923('0xb9')](_0x4694a9);}return _0x22cc60[_0xa923('0xb9')](path[_0xa923('0xb5')](config[_0xa923('0xb6')],'server/files/images/',_0xcd59e2['userpic']));}}})[_0xa923('0x2c')](handleError(_0x22cc60,null));};exports['getContacts']=function(_0x4216d7,_0x4240c1,_0x359dae){var _0x1a9637={};var _0x4530a6={};var _0x5cedb1;var _0x750713;return db[_0xa923('0x46')]['findOne']({'where':{'id':_0x4216d7[_0xa923('0x61')]['id']}})[_0xa923('0x22')](handleEntityNotFound(_0x4240c1,null))[_0xa923('0x22')](function(_0x100cd7){if(_0x100cd7){_0x5cedb1=_0x100cd7;_0x4530a6['model']=_['keys'](db[_0xa923('0xba')][_0xa923('0x63')]);_0x4530a6[_0xa923('0x4c')]=_['keys'](_0x4216d7['query']);_0x4530a6[_0xa923('0x4e')]=_[_0xa923('0x4f')](_0x4530a6[_0xa923('0x49')],_0x4530a6[_0xa923('0x4c')]);_0x1a9637[_0xa923('0x51')]=_[_0xa923('0x4f')](_0x4530a6[_0xa923('0x49')],qs[_0xa923('0x50')](_0x4216d7[_0xa923('0x4c')]['fields']));_0x1a9637[_0xa923('0x51')]=_0x1a9637['attributes'][_0xa923('0x52')]?_0x1a9637['attributes']:_0x4530a6['model'];_0x1a9637[_0xa923('0x54')]=qs[_0xa923('0x55')](_0x4216d7['query'][_0xa923('0x55')]);_0x1a9637[_0xa923('0x56')]=qs[_0xa923('0x4e')](_[_0xa923('0x57')](_0x4216d7[_0xa923('0x4c')],_0x4530a6[_0xa923('0x4e')]));if(_0x4216d7[_0xa923('0x4c')][_0xa923('0x3b')]){_0x1a9637['where']=_[_0xa923('0x58')](_0x1a9637['where'],{'$or':_[_0xa923('0x45')](_0x1a9637[_0xa923('0x51')],function(_0x54685e){var _0x1cfea0={};_0x1cfea0[_0x54685e]={'$like':'%'+_0x4216d7['query'][_0xa923('0x3b')]+'%'};return _0x1cfea0;})});}_0x1a9637=_[_0xa923('0x58')]({},_0x1a9637,_0x4216d7[_0xa923('0x5e')]);return _0x5cedb1['getContacts'](_0x1a9637);}})[_0xa923('0x22')](function(_0x1f826e){if(_0x1f826e){_0x750713=_0x1f826e[_0xa923('0x52')];if(_0x4216d7['query'][_0xa923('0xbb')]('includeAll')){_0x1a9637[_0xa923('0x60')]=[{'model':db[_0xa923('0xbc')],'as':_0xa923('0xbd'),'required':![]},{'model':db[_0xa923('0xbe')],'as':_0xa923('0xbf'),'attributes':['id','name',_0xa923('0xc0')],'where':_0x4216d7[_0xa923('0x4c')][_0xa923('0xc1')]?{'id':_0x4216d7[_0xa923('0x4c')][_0xa923('0xc1')]}:undefined,'required':_0x4216d7[_0xa923('0x4c')]['tag']?!![]:![]}];}if(!_0x4216d7[_0xa923('0x4c')][_0xa923('0xbb')]('nolimit')){_0x1a9637['limit']=qs[_0xa923('0x32')](_0x4216d7[_0xa923('0x4c')][_0xa923('0x32')]);_0x1a9637['offset']=qs['offset'](_0x4216d7[_0xa923('0x4c')][_0xa923('0x31')]);}return _0x5cedb1[_0xa923('0xc2')](_0x1a9637);}})[_0xa923('0x22')](function(_0x52948d){if(_0x52948d){return _0x52948d?{'count':_0x750713,'rows':_0x52948d}:null;}})['then'](respondWithResult(_0x4240c1,null))['catch'](handleError(_0x4240c1,null));};exports['getQueues']=function(_0x40d0c5,_0x119738,_0x1517b4){var _0x4494da;var _0x96c64;var _0x29a931={};var _0xb4e47f;return db[_0xa923('0x46')][_0xa923('0x93')]({'where':{'id':_0x40d0c5[_0xa923('0x61')]['id']},'attributes':['id','name',_0xa923('0x3d')]})['then'](handleEntityNotFound(_0x119738,null))['then'](function(_0x8e5800){if(!utils[_0xa923('0x9e')](_0x40d0c5[_0xa923('0x4c')][_0xa923('0x9c')])){throw new db[(_0xa923('0x1f'))][(_0xa923('0x20'))](_0xa923('0x9f'));}_0x4494da=_0x8e5800;var _0x191772={};_0x191772['model']=_[_0xa923('0x4d')](db[_[_0xa923('0xa3')](_0x40d0c5[_0xa923('0x4c')][_0xa923('0x9c')])+_0xa923('0xc3')][_0xa923('0x63')]);_0x191772['query']=_[_0xa923('0x4d')](_0x40d0c5[_0xa923('0x4c')]);_0x191772[_0xa923('0x4e')]=_[_0xa923('0x4f')](_0x191772[_0xa923('0x49')],_0x191772[_0xa923('0x4c')]);_0x29a931[_0xa923('0x51')]=_['intersection'](_0x191772[_0xa923('0x49')],qs['fields'](_0x40d0c5[_0xa923('0x4c')][_0xa923('0x50')]));_0x29a931[_0xa923('0x51')]=_0x29a931[_0xa923('0x51')]['length']?_0x29a931[_0xa923('0x51')]:_0x191772[_0xa923('0x49')];_0x29a931[_0xa923('0x54')]=qs[_0xa923('0x55')](_0x40d0c5[_0xa923('0x4c')][_0xa923('0x55')]);_0x29a931[_0xa923('0x56')]=qs[_0xa923('0x4e')](_[_0xa923('0x57')](_0x40d0c5['query'],_0x191772[_0xa923('0x4e')]));if(_0x40d0c5[_0xa923('0x4c')][_0xa923('0x3b')]){_0x29a931[_0xa923('0x56')]=_[_0xa923('0x58')](_0x29a931[_0xa923('0x56')],{'$or':_[_0xa923('0x45')](_0x29a931['attributes'],function(_0x5996e8){var _0x18da9c={};_0x18da9c[_0x5996e8]={'$like':'%'+_0x40d0c5[_0xa923('0x4c')][_0xa923('0x3b')]+'%'};return _0x18da9c;})});}_0x29a931=_[_0xa923('0x58')]({},_0x29a931,_0x40d0c5[_0xa923('0x5e')]);switch(_0x4494da['role']){case'admin':return db[_[_0xa923('0xa3')](_0x40d0c5[_0xa923('0x4c')][_0xa923('0x9c')])+_0xa923('0xc3')][_0xa923('0xc4')](_0x29a931);case'user':case _0xa923('0x6a'):return _0x4494da[_0xa923('0x8d')+_[_0xa923('0xa3')](_0x40d0c5[_0xa923('0x4c')][_0xa923('0x9c')])+'Queues'](_0x29a931);default:throw new db[(_0xa923('0x1f'))][(_0xa923('0x20'))]('Unknown\x20role');}})[_0xa923('0x22')](function(_0x45e117){_0xb4e47f=_0x45e117[_0xa923('0x52')];if(!_0x40d0c5[_0xa923('0x4c')][_0xa923('0xbb')](_0xa923('0x53'))){_0x29a931[_0xa923('0x32')]=qs[_0xa923('0x32')](_0x40d0c5[_0xa923('0x4c')][_0xa923('0x32')]);_0x29a931['offset']=qs['offset'](_0x40d0c5[_0xa923('0x4c')]['offset']);}switch(_0x4494da['role']){case _0xa923('0x6c'):return db[_[_0xa923('0xa3')](_0x40d0c5['query'][_0xa923('0x9c')])+_0xa923('0xc3')][_0xa923('0xc4')](_0x29a931);case _0xa923('0x38'):case _0xa923('0x6a'):return _0x4494da['get'+_[_0xa923('0xa3')](_0x40d0c5[_0xa923('0x4c')][_0xa923('0x9c')])+_0xa923('0xb1')](_0x29a931);}})[_0xa923('0x22')](function(_0x3b943d){return{'count':_0xb4e47f,'rows':_0x3b943d};})[_0xa923('0x22')](respondWithResult(_0x119738,null))[_0xa923('0x2c')](handleError(_0x119738,null));};exports[_0xa923('0xc5')]=function(_0x312817,_0xe3b846,_0x18da26){var _0x2530eb={};var _0x346dca={};var _0x25697d;var _0x4fcbff;return db['User'][_0xa923('0x93')]({'where':{'id':_0x312817[_0xa923('0x61')]['id']}})[_0xa923('0x22')](handleEntityNotFound(_0xe3b846,null))[_0xa923('0x22')](function(_0xbf09a3){if(_0xbf09a3){_0x25697d=_0xbf09a3;_0x346dca[_0xa923('0x49')]=_[_0xa923('0x4d')](db['UserVoiceQueueRt'][_0xa923('0x63')]);_0x346dca['query']=_[_0xa923('0x4d')](_0x312817[_0xa923('0x4c')]);_0x346dca['filters']=_[_0xa923('0x4f')](_0x346dca[_0xa923('0x49')],_0x346dca['query']);_0x2530eb[_0xa923('0x51')]=_[_0xa923('0x4f')](_0x346dca[_0xa923('0x49')],qs[_0xa923('0x50')](_0x312817[_0xa923('0x4c')][_0xa923('0x50')]));_0x2530eb[_0xa923('0x51')]=_0x2530eb[_0xa923('0x51')][_0xa923('0x52')]?_0x2530eb[_0xa923('0x51')]:_0x346dca['model'];_0x2530eb[_0xa923('0x54')]=qs[_0xa923('0x55')](_0x312817[_0xa923('0x4c')][_0xa923('0x55')]);_0x2530eb['where']=qs['filters'](_[_0xa923('0x57')](_0x312817['query'],_0x346dca[_0xa923('0x4e')]));if(_0x312817[_0xa923('0x4c')]['filter']){_0x2530eb[_0xa923('0x56')]=_['merge'](_0x2530eb[_0xa923('0x56')],{'$or':_[_0xa923('0x45')](_0x2530eb['attributes'],function(_0x5588ee){var _0x31423f={};_0x31423f[_0x5588ee]={'$like':'%'+_0x312817['query']['filter']+'%'};return _0x31423f;})});}_0x2530eb=_[_0xa923('0x58')]({},_0x2530eb,_0x312817['options']);return _0x25697d['getVoiceQueuesRt'](_0x2530eb);}})['then'](function(_0x42935b){if(_0x42935b){_0x4fcbff=_0x42935b[_0xa923('0x52')];if(!_0x312817[_0xa923('0x4c')][_0xa923('0xbb')](_0xa923('0x53'))){_0x2530eb[_0xa923('0x32')]=qs[_0xa923('0x32')](_0x312817[_0xa923('0x4c')][_0xa923('0x32')]);_0x2530eb[_0xa923('0x31')]=qs[_0xa923('0x31')](_0x312817[_0xa923('0x4c')][_0xa923('0x31')]);}return _0x25697d[_0xa923('0xc5')](_0x2530eb);}})[_0xa923('0x22')](function(_0x4666be){if(_0x4666be){return _0x4666be?{'count':_0x4fcbff,'rows':_0x4666be}:null;}})[_0xa923('0x22')](respondWithResult(_0xe3b846,null))[_0xa923('0x2c')](handleError(_0xe3b846,null));};exports[_0xa923('0xc6')]=function(_0xfe573a,_0x3e2cb3,_0x1557f8){var _0x5dddce={};var _0x2ef5b8={};var _0x85e3f3;var _0x12af32;return db[_0xa923('0x46')][_0xa923('0x93')]({'where':{'id':_0xfe573a['params']['id']}})[_0xa923('0x22')](handleEntityNotFound(_0x3e2cb3,null))[_0xa923('0x22')](function(_0x5eeb3d){if(_0x5eeb3d){_0x85e3f3=_0x5eeb3d;_0x2ef5b8['model']=_['keys'](db[_0xa923('0xc7')][_0xa923('0x63')]);_0x2ef5b8[_0xa923('0x4c')]=_[_0xa923('0x4d')](_0xfe573a[_0xa923('0x4c')]);_0x2ef5b8[_0xa923('0x4e')]=_[_0xa923('0x4f')](_0x2ef5b8[_0xa923('0x49')],_0x2ef5b8[_0xa923('0x4c')]);_0x5dddce[_0xa923('0x51')]=_['intersection'](_0x2ef5b8['model'],qs[_0xa923('0x50')](_0xfe573a['query']['fields']));_0x5dddce[_0xa923('0x51')]=_0x5dddce[_0xa923('0x51')][_0xa923('0x52')]?_0x5dddce[_0xa923('0x51')]:_0x2ef5b8[_0xa923('0x49')];_0x5dddce[_0xa923('0x54')]=qs['sort'](_0xfe573a[_0xa923('0x4c')]['sort']);_0x5dddce[_0xa923('0x56')]=qs[_0xa923('0x4e')](_['pick'](_0xfe573a[_0xa923('0x4c')],_0x2ef5b8[_0xa923('0x4e')]));if(_0xfe573a[_0xa923('0x4c')]['filter']){_0x5dddce[_0xa923('0x56')]=_['merge'](_0x5dddce[_0xa923('0x56')],{'$or':_['map'](_0x5dddce['attributes'],function(_0x44319e){var _0x471aad={};_0x471aad[_0x44319e]={'$like':'%'+_0xfe573a['query'][_0xa923('0x3b')]+'%'};return _0x471aad;})});}_0x5dddce=_[_0xa923('0x58')]({},_0x5dddce,_0xfe573a[_0xa923('0x5e')]);return _0x85e3f3[_0xa923('0xc6')](_0x5dddce);}})[_0xa923('0x22')](function(_0x5d2a96){if(_0x5d2a96){_0x12af32=_0x5d2a96[_0xa923('0x52')];if(!_0xfe573a[_0xa923('0x4c')][_0xa923('0xbb')](_0xa923('0x53'))){_0x5dddce[_0xa923('0x32')]=qs[_0xa923('0x32')](_0xfe573a[_0xa923('0x4c')][_0xa923('0x32')]);_0x5dddce[_0xa923('0x31')]=qs[_0xa923('0x31')](_0xfe573a[_0xa923('0x4c')][_0xa923('0x31')]);}return _0x85e3f3[_0xa923('0xc6')](_0x5dddce);}})['then'](function(_0x572e87){if(_0x572e87){return _0x572e87?{'count':_0x12af32,'rows':_0x572e87}:null;}})['then'](respondWithResult(_0x3e2cb3,null))[_0xa923('0x2c')](handleError(_0x3e2cb3,null));};exports['getRecordings']=function(_0x103643,_0x8f9a6e,_0x51d4b7){var _0x5cd175={'raw':!![],'where':{}};var _0x3a80b8={};var _0x37fdca={'count':0x0,'rows':[]};return db[_0xa923('0x46')][_0xa923('0x93')]({'where':{'id':_0x103643[_0xa923('0x61')]['id']}})['then'](handleEntityNotFound(_0x8f9a6e,null))[_0xa923('0x22')](function(_0x1c6a59){if(_0x1c6a59){_0x3a80b8[_0xa923('0x49')]=_['keys'](db[_0xa923('0xc8')][_0xa923('0x63')]);_0x3a80b8['query']=_[_0xa923('0x4d')](_0x103643[_0xa923('0x4c')]);_0x3a80b8[_0xa923('0x4e')]=_[_0xa923('0x4f')](_0x3a80b8[_0xa923('0x49')],_0x3a80b8[_0xa923('0x4c')]);_0x5cd175[_0xa923('0x51')]=_[_0xa923('0x4f')](_0x3a80b8[_0xa923('0x49')],qs[_0xa923('0x50')](_0x103643[_0xa923('0x4c')]['fields']));_0x5cd175[_0xa923('0x51')]=_0x5cd175[_0xa923('0x51')][_0xa923('0x52')]?_0x5cd175['attributes']:_0x3a80b8['model'];if(!_0x103643[_0xa923('0x4c')]['hasOwnProperty'](_0xa923('0x53'))){_0x5cd175['limit']=qs[_0xa923('0x32')](_0x103643['query'][_0xa923('0x32')]);_0x5cd175[_0xa923('0x31')]=qs['offset'](_0x103643['query']['offset']);}_0x5cd175['order']=qs[_0xa923('0x55')](_0x103643[_0xa923('0x4c')][_0xa923('0x55')]);_0x5cd175['where']=qs[_0xa923('0x4e')](_['pick'](_0x103643[_0xa923('0x4c')],_0x3a80b8[_0xa923('0x4e')]));_0x5cd175['where'][_0xa923('0xc9')]=_0x1c6a59['id'];if(_0x103643['query']['filter']){_0x5cd175[_0xa923('0x56')]=_[_0xa923('0x58')](_0x5cd175['where'],{'$or':_[_0xa923('0x45')](_0x5cd175[_0xa923('0x51')],function(_0xaa9a96){var _0xe4f169={};_0xe4f169[_0xaa9a96]={'$like':'%'+_0x103643[_0xa923('0x4c')][_0xa923('0x3b')]+'%'};return _0xe4f169;})});}_0x5cd175=_[_0xa923('0x58')]({},_0x5cd175,_0x103643[_0xa923('0x5e')]);return db[_0xa923('0xc8')][_0xa923('0x5f')]({'where':_0x5cd175['where']})[_0xa923('0x22')](function(_0xf010e8){_0x37fdca['count']=_0xf010e8;if(_0x103643['query'][_0xa923('0x64')]){_0x5cd175[_0xa923('0x60')]=[{'all':!![]}];}return db[_0xa923('0xc8')][_0xa923('0xc4')](_0x5cd175);})['then'](function(_0x20e7db){_0x37fdca[_0xa923('0xca')]=_0x20e7db;return _0x37fdca;});}})[_0xa923('0x22')](respondWithFilteredResult(_0x8f9a6e,_0x5cd175))[_0xa923('0x2c')](handleError(_0x8f9a6e,null));};exports[_0xa923('0xcb')]=function(_0x32f1e6,_0x482d02,_0x22cf39){var _0xf00023={'raw':!![],'where':{}};var _0x2ab8ee={};var _0x211276={'count':0x0,'rows':[]};return db[_0xa923('0x46')][_0xa923('0x93')]({'where':{'id':_0x32f1e6[_0xa923('0x61')]['id']}})[_0xa923('0x22')](handleEntityNotFound(_0x482d02,null))[_0xa923('0x22')](function(_0x4f3ffe){if(_0x4f3ffe){_0x2ab8ee[_0xa923('0x49')]=_[_0xa923('0x4d')](db[_0xa923('0xcc')][_0xa923('0x63')]);_0x2ab8ee['query']=_[_0xa923('0x4d')](_0x32f1e6['query']);_0x2ab8ee[_0xa923('0x4e')]=_[_0xa923('0x4f')](_0x2ab8ee[_0xa923('0x49')],_0x2ab8ee[_0xa923('0x4c')]);_0xf00023[_0xa923('0x51')]=_[_0xa923('0x4f')](_0x2ab8ee[_0xa923('0x49')],qs['fields'](_0x32f1e6[_0xa923('0x4c')][_0xa923('0x50')]));_0xf00023[_0xa923('0x51')]=_0xf00023[_0xa923('0x51')][_0xa923('0x52')]?_0xf00023[_0xa923('0x51')]:_0x2ab8ee[_0xa923('0x49')];if(!_0x32f1e6['query'][_0xa923('0xbb')](_0xa923('0x53'))){_0xf00023[_0xa923('0x32')]=qs['limit'](_0x32f1e6[_0xa923('0x4c')][_0xa923('0x32')]);_0xf00023[_0xa923('0x31')]=qs[_0xa923('0x31')](_0x32f1e6[_0xa923('0x4c')]['offset']);}_0xf00023['order']=qs['sort'](_0x32f1e6[_0xa923('0x4c')]['sort']);_0xf00023[_0xa923('0x56')]=qs[_0xa923('0x4e')](_[_0xa923('0x57')](_0x32f1e6[_0xa923('0x4c')],_0x2ab8ee[_0xa923('0x4e')]));_0xf00023[_0xa923('0x56')]['UserId']=_0x4f3ffe['id'];if(_0x32f1e6[_0xa923('0x4c')][_0xa923('0x3b')]){_0xf00023[_0xa923('0x56')]=_[_0xa923('0x58')](_0xf00023[_0xa923('0x56')],{'$or':_[_0xa923('0x45')](_0xf00023[_0xa923('0x51')],function(_0x199b51){var _0x3b2665={};_0x3b2665[_0x199b51]={'$like':'%'+_0x32f1e6[_0xa923('0x4c')][_0xa923('0x3b')]+'%'};return _0x3b2665;})});}_0xf00023=_[_0xa923('0x58')]({},_0xf00023,_0x32f1e6[_0xa923('0x5e')]);return db[_0xa923('0xcc')]['count']({'where':_0xf00023[_0xa923('0x56')]})['then'](function(_0x262e9e){_0x211276[_0xa923('0x5f')]=_0x262e9e;if(_0x32f1e6[_0xa923('0x4c')]['includeAll']){_0xf00023['include']=[{'all':!![]}];}return db['ScreenRecording'][_0xa923('0xc4')](_0xf00023);})[_0xa923('0x22')](function(_0x1b92a0){_0x211276['rows']=_0x1b92a0;return _0x211276;});}})[_0xa923('0x22')](respondWithFilteredResult(_0x482d02,_0xf00023))[_0xa923('0x2c')](handleError(_0x482d02,null));};exports['getChatInteractions']=function(_0x53df29,_0x11e036,_0xe85b18){var _0x2d4b16={};var _0x2ca552={};var _0x554d1;var _0x3341e6;return db[_0xa923('0x46')][_0xa923('0x93')]({'where':{'id':_0x53df29['params']['id']}})[_0xa923('0x22')](handleEntityNotFound(_0x11e036,null))[_0xa923('0x22')](function(_0x5e9850){if(_0x5e9850){_0x554d1=_0x5e9850;_0x2ca552[_0xa923('0x49')]=_[_0xa923('0x4d')](db[_0xa923('0xcd')]['rawAttributes']);_0x2ca552['query']=_[_0xa923('0x4d')](_0x53df29[_0xa923('0x4c')]);_0x2ca552[_0xa923('0x4e')]=_[_0xa923('0x4f')](_0x2ca552[_0xa923('0x49')],_0x2ca552[_0xa923('0x4c')]);_0x2d4b16[_0xa923('0x51')]=_['intersection'](_0x2ca552['model'],qs[_0xa923('0x50')](_0x53df29[_0xa923('0x4c')]['fields']));_0x2d4b16[_0xa923('0x51')]=_0x2d4b16['attributes'][_0xa923('0x52')]?_0x2d4b16[_0xa923('0x51')]:_0x2ca552[_0xa923('0x49')];_0x2d4b16['order']=qs['sort'](_0x53df29['query']['sort']);_0x2d4b16['where']=qs[_0xa923('0x4e')](_[_0xa923('0x57')](_0x53df29[_0xa923('0x4c')],_0x2ca552[_0xa923('0x4e')]));if(_0x53df29['query'][_0xa923('0x3b')]){_0x2d4b16[_0xa923('0x56')]=_['merge'](_0x2d4b16[_0xa923('0x56')],{'$or':_[_0xa923('0x45')](_0x2d4b16[_0xa923('0x51')],function(_0x324654){var _0x5d2bad={};_0x5d2bad[_0x324654]={'$like':'%'+_0x53df29[_0xa923('0x4c')][_0xa923('0x3b')]+'%'};return _0x5d2bad;})});}_0x2d4b16=_[_0xa923('0x58')]({},_0x2d4b16,_0x53df29[_0xa923('0x5e')]);return _0x554d1[_0xa923('0xce')](_0x2d4b16);}})['then'](function(_0x210c5b){if(_0x210c5b){_0x3341e6=_0x210c5b[_0xa923('0x52')];if(!_0x53df29[_0xa923('0x4c')][_0xa923('0xbb')](_0xa923('0x53'))){_0x2d4b16[_0xa923('0x32')]=qs[_0xa923('0x32')](_0x53df29[_0xa923('0x4c')][_0xa923('0x32')]);_0x2d4b16[_0xa923('0x31')]=qs[_0xa923('0x31')](_0x53df29[_0xa923('0x4c')][_0xa923('0x31')]);}return _0x554d1[_0xa923('0xce')](_0x2d4b16);}})[_0xa923('0x22')](function(_0x14d41c){if(_0x14d41c){return _0x14d41c?{'count':_0x3341e6,'rows':_0x14d41c}:null;}})[_0xa923('0x22')](respondWithResult(_0x11e036,null))[_0xa923('0x2c')](handleError(_0x11e036,null));};exports['getOpenchannelInteractions']=function(_0x24031c,_0x2e9002,_0x44d8fe){var _0x1ec0a1={};var _0x29f887={};var _0x47f14c;var _0x488f01;return db[_0xa923('0x46')][_0xa923('0x93')]({'where':{'id':_0x24031c['params']['id']}})[_0xa923('0x22')](handleEntityNotFound(_0x2e9002,null))[_0xa923('0x22')](function(_0x2c695e){if(_0x2c695e){_0x47f14c=_0x2c695e;_0x29f887[_0xa923('0x49')]=_[_0xa923('0x4d')](db['OpenchannelInteraction'][_0xa923('0x63')]);_0x29f887['query']=_[_0xa923('0x4d')](_0x24031c[_0xa923('0x4c')]);_0x29f887[_0xa923('0x4e')]=_[_0xa923('0x4f')](_0x29f887['model'],_0x29f887['query']);_0x1ec0a1[_0xa923('0x51')]=_['intersection'](_0x29f887['model'],qs[_0xa923('0x50')](_0x24031c[_0xa923('0x4c')][_0xa923('0x50')]));_0x1ec0a1[_0xa923('0x51')]=_0x1ec0a1['attributes'][_0xa923('0x52')]?_0x1ec0a1[_0xa923('0x51')]:_0x29f887['model'];_0x1ec0a1[_0xa923('0x54')]=qs['sort'](_0x24031c['query']['sort']);_0x1ec0a1[_0xa923('0x56')]=qs[_0xa923('0x4e')](_[_0xa923('0x57')](_0x24031c[_0xa923('0x4c')],_0x29f887['filters']));if(_0x24031c[_0xa923('0x4c')][_0xa923('0x3b')]){_0x1ec0a1[_0xa923('0x56')]=_[_0xa923('0x58')](_0x1ec0a1[_0xa923('0x56')],{'$or':_[_0xa923('0x45')](_0x1ec0a1['attributes'],function(_0x4d5d75){var _0x129827={};_0x129827[_0x4d5d75]={'$like':'%'+_0x24031c['query'][_0xa923('0x3b')]+'%'};return _0x129827;})});}_0x1ec0a1=_[_0xa923('0x58')]({},_0x1ec0a1,_0x24031c[_0xa923('0x5e')]);return _0x47f14c[_0xa923('0xcf')](_0x1ec0a1);}})[_0xa923('0x22')](function(_0x4c3a53){if(_0x4c3a53){_0x488f01=_0x4c3a53[_0xa923('0x52')];if(!_0x24031c['query']['hasOwnProperty'](_0xa923('0x53'))){_0x1ec0a1[_0xa923('0x32')]=qs[_0xa923('0x32')](_0x24031c[_0xa923('0x4c')][_0xa923('0x32')]);_0x1ec0a1[_0xa923('0x31')]=qs[_0xa923('0x31')](_0x24031c[_0xa923('0x4c')][_0xa923('0x31')]);}return _0x47f14c[_0xa923('0xcf')](_0x1ec0a1);}})['then'](function(_0x4b5687){if(_0x4b5687){return _0x4b5687?{'count':_0x488f01,'rows':_0x4b5687}:null;}})[_0xa923('0x22')](respondWithResult(_0x2e9002,null))['catch'](handleError(_0x2e9002,null));};exports['getMailInteractions']=function(_0x517d9f,_0x362a20,_0x5c439f){var _0x4b4220={'raw':!![],'where':{}};var _0x2f1876={};var _0x423b39={'count':0x0,'rows':[]};return db[_0xa923('0x46')][_0xa923('0x93')]({'where':{'id':_0x517d9f[_0xa923('0x61')]['id']}})[_0xa923('0x22')](handleEntityNotFound(_0x362a20,null))[_0xa923('0x22')](function(_0x10bf67){if(_0x10bf67){_0x2f1876[_0xa923('0x49')]=_[_0xa923('0x4d')](db[_0xa923('0xd0')][_0xa923('0x63')]);_0x2f1876['query']=_[_0xa923('0x4d')](_0x517d9f[_0xa923('0x4c')]);_0x2f1876['filters']=_['intersection'](_0x2f1876[_0xa923('0x49')],_0x2f1876[_0xa923('0x4c')]);_0x4b4220[_0xa923('0x51')]=_['intersection'](_0x2f1876[_0xa923('0x49')],qs[_0xa923('0x50')](_0x517d9f[_0xa923('0x4c')][_0xa923('0x50')]));_0x4b4220[_0xa923('0x51')]=_0x4b4220['attributes'][_0xa923('0x52')]?_0x4b4220['attributes']:_0x2f1876[_0xa923('0x49')];if(!_0x517d9f[_0xa923('0x4c')][_0xa923('0xbb')](_0xa923('0x53'))){_0x4b4220[_0xa923('0x32')]=qs[_0xa923('0x32')](_0x517d9f[_0xa923('0x4c')][_0xa923('0x32')]);_0x4b4220[_0xa923('0x31')]=qs[_0xa923('0x31')](_0x517d9f[_0xa923('0x4c')]['offset']);}_0x4b4220['order']=qs[_0xa923('0x55')](_0x517d9f[_0xa923('0x4c')][_0xa923('0x55')]);_0x4b4220[_0xa923('0x56')]=qs[_0xa923('0x4e')](_[_0xa923('0x57')](_0x517d9f[_0xa923('0x4c')],_0x2f1876[_0xa923('0x4e')]));_0x4b4220[_0xa923('0x56')]['UserId']=_0x10bf67['id'];if(_0x517d9f['query'][_0xa923('0x3b')]){_0x4b4220['where']=_[_0xa923('0x58')](_0x4b4220[_0xa923('0x56')],{'$or':_[_0xa923('0x45')](_0x4b4220[_0xa923('0x51')],function(_0x1658a4){var _0x243bcf={};_0x243bcf[_0x1658a4]={'$like':'%'+_0x517d9f['query'][_0xa923('0x3b')]+'%'};return _0x243bcf;})});}_0x4b4220=_[_0xa923('0x58')]({},_0x4b4220,_0x517d9f[_0xa923('0x5e')]);return db['MailInteraction'][_0xa923('0x5f')]({'where':_0x4b4220[_0xa923('0x56')]})[_0xa923('0x22')](function(_0x583c79){_0x423b39[_0xa923('0x5f')]=_0x583c79;if(_0x517d9f['query']['includeAll']){_0x4b4220[_0xa923('0x60')]=[{'all':!![]}];}return db[_0xa923('0xd0')][_0xa923('0xc4')](_0x4b4220);})[_0xa923('0x22')](function(_0x25e22e){_0x423b39[_0xa923('0xca')]=_0x25e22e;return _0x423b39;});}})[_0xa923('0x22')](respondWithFilteredResult(_0x362a20,_0x4b4220))[_0xa923('0x2c')](handleError(_0x362a20,null));};exports[_0xa923('0xd1')]=function(_0x5e8a24,_0x25af9e,_0x1a48a7){var _0x2a05c2={};var _0x58eb64={};var _0x45d4be;var _0xce74f6;return db[_0xa923('0x46')]['findOne']({'where':{'id':_0x5e8a24[_0xa923('0x61')]['id']}})[_0xa923('0x22')](handleEntityNotFound(_0x25af9e,null))[_0xa923('0x22')](function(_0x1b3ae6){if(_0x1b3ae6){_0x45d4be=_0x1b3ae6;_0x58eb64[_0xa923('0x49')]=_[_0xa923('0x4d')](db['SmsInteraction'][_0xa923('0x63')]);_0x58eb64[_0xa923('0x4c')]=_[_0xa923('0x4d')](_0x5e8a24[_0xa923('0x4c')]);_0x58eb64['filters']=_[_0xa923('0x4f')](_0x58eb64['model'],_0x58eb64['query']);_0x2a05c2[_0xa923('0x51')]=_[_0xa923('0x4f')](_0x58eb64[_0xa923('0x49')],qs[_0xa923('0x50')](_0x5e8a24['query']['fields']));_0x2a05c2[_0xa923('0x51')]=_0x2a05c2[_0xa923('0x51')][_0xa923('0x52')]?_0x2a05c2[_0xa923('0x51')]:_0x58eb64[_0xa923('0x49')];_0x2a05c2[_0xa923('0x54')]=qs[_0xa923('0x55')](_0x5e8a24['query'][_0xa923('0x55')]);_0x2a05c2['where']=qs[_0xa923('0x4e')](_[_0xa923('0x57')](_0x5e8a24['query'],_0x58eb64[_0xa923('0x4e')]));if(_0x5e8a24['query'][_0xa923('0x3b')]){_0x2a05c2[_0xa923('0x56')]=_[_0xa923('0x58')](_0x2a05c2[_0xa923('0x56')],{'$or':_[_0xa923('0x45')](_0x2a05c2[_0xa923('0x51')],function(_0x402e37){var _0x1ffb33={};_0x1ffb33[_0x402e37]={'$like':'%'+_0x5e8a24['query']['filter']+'%'};return _0x1ffb33;})});}_0x2a05c2=_[_0xa923('0x58')]({},_0x2a05c2,_0x5e8a24[_0xa923('0x5e')]);return _0x45d4be[_0xa923('0xd1')](_0x2a05c2);}})[_0xa923('0x22')](function(_0xd75181){if(_0xd75181){_0xce74f6=_0xd75181[_0xa923('0x52')];if(!_0x5e8a24[_0xa923('0x4c')][_0xa923('0xbb')](_0xa923('0x53'))){_0x2a05c2[_0xa923('0x32')]=qs[_0xa923('0x32')](_0x5e8a24[_0xa923('0x4c')][_0xa923('0x32')]);_0x2a05c2['offset']=qs[_0xa923('0x31')](_0x5e8a24['query']['offset']);}return _0x45d4be[_0xa923('0xd1')](_0x2a05c2);}})[_0xa923('0x22')](function(_0x2b1a3c){if(_0x2b1a3c){return _0x2b1a3c?{'count':_0xce74f6,'rows':_0x2b1a3c}:null;}})[_0xa923('0x22')](respondWithResult(_0x25af9e,null))[_0xa923('0x2c')](handleError(_0x25af9e,null));};exports[_0xa923('0xd2')]=function(_0x228f74,_0x59e53c,_0x51bcc6){var _0x105110={};var _0x196947={};var _0x1f8e31;var _0x1548b3;return db['User']['findOne']({'where':{'id':_0x228f74[_0xa923('0x61')]['id']}})[_0xa923('0x22')](handleEntityNotFound(_0x59e53c,null))[_0xa923('0x22')](function(_0xfb195d){if(_0xfb195d){_0x1f8e31=_0xfb195d;_0x196947[_0xa923('0x49')]=_['keys'](db['FaxInteraction']['rawAttributes']);_0x196947[_0xa923('0x4c')]=_[_0xa923('0x4d')](_0x228f74[_0xa923('0x4c')]);_0x196947[_0xa923('0x4e')]=_[_0xa923('0x4f')](_0x196947[_0xa923('0x49')],_0x196947[_0xa923('0x4c')]);_0x105110[_0xa923('0x51')]=_[_0xa923('0x4f')](_0x196947[_0xa923('0x49')],qs[_0xa923('0x50')](_0x228f74[_0xa923('0x4c')][_0xa923('0x50')]));_0x105110[_0xa923('0x51')]=_0x105110['attributes'][_0xa923('0x52')]?_0x105110[_0xa923('0x51')]:_0x196947[_0xa923('0x49')];_0x105110[_0xa923('0x54')]=qs[_0xa923('0x55')](_0x228f74[_0xa923('0x4c')]['sort']);_0x105110[_0xa923('0x56')]=qs[_0xa923('0x4e')](_['pick'](_0x228f74[_0xa923('0x4c')],_0x196947['filters']));if(_0x228f74['query'][_0xa923('0x3b')]){_0x105110[_0xa923('0x56')]=_[_0xa923('0x58')](_0x105110[_0xa923('0x56')],{'$or':_[_0xa923('0x45')](_0x105110[_0xa923('0x51')],function(_0x5d63be){var _0x505568={};_0x505568[_0x5d63be]={'$like':'%'+_0x228f74['query']['filter']+'%'};return _0x505568;})});}_0x105110=_[_0xa923('0x58')]({},_0x105110,_0x228f74[_0xa923('0x5e')]);return _0x1f8e31[_0xa923('0xd2')](_0x105110);}})['then'](function(_0xe33d0b){if(_0xe33d0b){_0x1548b3=_0xe33d0b[_0xa923('0x52')];if(!_0x228f74[_0xa923('0x4c')][_0xa923('0xbb')]('nolimit')){_0x105110['limit']=qs[_0xa923('0x32')](_0x228f74[_0xa923('0x4c')][_0xa923('0x32')]);_0x105110[_0xa923('0x31')]=qs[_0xa923('0x31')](_0x228f74[_0xa923('0x4c')][_0xa923('0x31')]);}return _0x1f8e31['getFaxInteractions'](_0x105110);}})[_0xa923('0x22')](function(_0x48f006){if(_0x48f006){return _0x48f006?{'count':_0x1548b3,'rows':_0x48f006}:null;}})['then'](respondWithResult(_0x59e53c,null))[_0xa923('0x2c')](handleError(_0x59e53c,null));};exports[_0xa923('0xd3')]=function(_0x56708b,_0x4da813,_0x10289e){var _0x1207cb={};var _0x44607c={};var _0x411c84;var _0x52f85f;return db['User'][_0xa923('0x93')]({'where':{'id':_0x56708b[_0xa923('0x61')]['id']}})[_0xa923('0x22')](handleEntityNotFound(_0x4da813,null))[_0xa923('0x22')](function(_0x256d72){if(_0x256d72){_0x411c84=_0x256d72;_0x44607c['model']=_[_0xa923('0x4d')](db['WhatsappInteraction'][_0xa923('0x63')]);_0x44607c[_0xa923('0x4c')]=_['keys'](_0x56708b[_0xa923('0x4c')]);_0x44607c[_0xa923('0x4e')]=_[_0xa923('0x4f')](_0x44607c[_0xa923('0x49')],_0x44607c[_0xa923('0x4c')]);_0x1207cb['attributes']=_[_0xa923('0x4f')](_0x44607c[_0xa923('0x49')],qs['fields'](_0x56708b[_0xa923('0x4c')][_0xa923('0x50')]));_0x1207cb['attributes']=_0x1207cb[_0xa923('0x51')][_0xa923('0x52')]?_0x1207cb['attributes']:_0x44607c['model'];_0x1207cb[_0xa923('0x54')]=qs['sort'](_0x56708b[_0xa923('0x4c')][_0xa923('0x55')]);_0x1207cb['where']=qs[_0xa923('0x4e')](_[_0xa923('0x57')](_0x56708b[_0xa923('0x4c')],_0x44607c['filters']));if(_0x56708b[_0xa923('0x4c')][_0xa923('0x3b')]){_0x1207cb[_0xa923('0x56')]=_['merge'](_0x1207cb[_0xa923('0x56')],{'$or':_[_0xa923('0x45')](_0x1207cb[_0xa923('0x51')],function(_0x7859ed){var _0x49e0c5={};_0x49e0c5[_0x7859ed]={'$like':'%'+_0x56708b['query'][_0xa923('0x3b')]+'%'};return _0x49e0c5;})});}_0x1207cb=_['merge']({},_0x1207cb,_0x56708b['options']);return _0x411c84[_0xa923('0xd3')](_0x1207cb);}})[_0xa923('0x22')](function(_0x2e1c8f){if(_0x2e1c8f){_0x52f85f=_0x2e1c8f[_0xa923('0x52')];if(!_0x56708b[_0xa923('0x4c')][_0xa923('0xbb')](_0xa923('0x53'))){_0x1207cb[_0xa923('0x32')]=qs[_0xa923('0x32')](_0x56708b[_0xa923('0x4c')]['limit']);_0x1207cb[_0xa923('0x31')]=qs[_0xa923('0x31')](_0x56708b[_0xa923('0x4c')]['offset']);}return _0x411c84['getWhatsappInteractions'](_0x1207cb);}})[_0xa923('0x22')](function(_0x5939af){if(_0x5939af){return _0x5939af?{'count':_0x52f85f,'rows':_0x5939af}:null;}})[_0xa923('0x22')](respondWithResult(_0x4da813,null))[_0xa923('0x2c')](handleError(_0x4da813,null));};exports['login']=function(_0xfa760,_0x1b7d89,_0x273241){var _0x11d393;var _0x42677c;var _0x194f1f;var _0x25384e=!_[_0xa923('0x6f')](_0xfa760[_0xa923('0x61')]['id'])?_0xfa760[_0xa923('0x61')]['id']:!_[_0xa923('0x6f')](_0xfa760[_0xa923('0x38')]['id'])?_0xfa760[_0xa923('0x38')]['id']:null;return db[_0xa923('0x46')][_0xa923('0x3e')]({'where':{'id':_0x25384e,'role':{'$or':[_0xa923('0x6c'),_0xa923('0x38'),_0xa923('0x6a')]}},'attributes':['id',_0xa923('0x3f'),_0xa923('0xd4'),_0xa923('0xd5'),_0xa923('0x3d'),'internal',_0xa923('0xd6')]})[_0xa923('0x22')](function(_0x5efb27){if(_0x5efb27){if(_0x5efb27[_0xa923('0x3d')]==='agent'){_0x11d393=_0x5efb27;if(_0xfa760[_0xa923('0x66')][_0xa923('0xac')]){_0x194f1f=util[_0xa923('0x71')](_0xa923('0xd7'),_0x11d393[_0xfa760[_0xa923('0x66')][_0xa923('0xac')]]);}else if(_0xfa760[_0xa923('0x66')][_0xa923('0xd8')]){_0x194f1f=util[_0xa923('0x71')]('SIP/%s',_0xfa760['body'][_0xa923('0xd8')]);}else{_0x194f1f=util[_0xa923('0x71')](_0xa923('0xd9'),_0x11d393[_0xa923('0x3f')]);}socket['to'](util[_0xa923('0x71')]('user:%s',_0x11d393[_0xa923('0x3f')]))[_0xa923('0xa6')]('user:forcelogout',{'ip':_0xfa760[_0xa923('0xda')][_0xa923('0xdb')]||_0xfa760[_0xa923('0xdc')][_0xa923('0xdd')]||_0xfa760[_0xa923('0xde')][_0xa923('0xdd')]||_0xfa760[_0xa923('0xdc')][_0xa923('0xde')]['remoteAddress']});return db[_0xa923('0xae')][_0xa923('0x41')]({'where':{'membername':_0x11d393['name']},'individualHooks':!![]});}}else{throw new db[(_0xa923('0x1f'))]['ValidationError']('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0xa923('0x22')](function(){if(_0x11d393){return _0x11d393[_0xa923('0xdf')]({'raw':!![]});}})['then'](function(_0x28b772){if(_0x11d393){var _0x5d3f1f=[];if(_0x28b772){_0x42677c=_0x28b772;if(_0x42677c[_0xa923('0x52')]){for(var _0x653de6=0x0;_0x653de6<_0x42677c[_0xa923('0x52')];_0x653de6++){_0x5d3f1f[_0xa923('0xab')]({'membername':_0x11d393[_0xa923('0x3f')],'UserId':_0x11d393['id'],'queue_name':_0x42677c[_0x653de6][_0xa923('0x3f')],'VoiceQueueId':_0x42677c[_0x653de6]['id'],'interface':_0x194f1f,'paused':_0x11d393[_0xa923('0xd6')]||![],'penalty':_0x42677c[_0x653de6][_0xa923('0xe0')]||0x0});}return BPromise['each'](_0x5d3f1f,function(_0x416a5f){return db[_0xa923('0xae')][_0xa923('0xaf')](_0x416a5f);});}}}})[_0xa923('0x22')](function(){if(_0x11d393){return db[_0xa923('0xe1')][_0xa923('0xc4')]({'where':{'membername':_0x11d393['name'],'exitAt':null}});}})[_0xa923('0x22')](function(_0x34ae31){if(_0x11d393){var _0x26506e=[];_0x34ae31[_0xa923('0xe2')](function(_0x5ef89e){_0x26506e[_0xa923('0xab')](_0x5ef89e[_0xa923('0x36')]({'exitAt':moment()[_0xa923('0x71')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xa923('0xe3')](_0x26506e);}})['then'](function(){if(_0x11d393){var _0x256b28=[];var _0x331c26=[];var _0x123ad6=utils[_0xa923('0xe4')]();var _0x39b243={'membername':_0x11d393[_0xa923('0x3f')],'interface':_0x194f1f,'enterAt':moment()[_0xa923('0x71')](_0xa923('0xe5')),'role':_0x11d393['role'],'internal':_0x11d393[_0xa923('0x79')]};_0x123ad6[_0xa923('0xe2')](function(_0x775642){_0x256b28[_0xa923('0xab')](_[_0xa923('0x58')]({'channel':_0x775642,'type':'LOGIN','data1':_0xfa760[_0xa923('0x66')][_0xa923('0xe6')],'data2':_0x194f1f},_0x39b243));if(_0x11d393[_0xa923('0xd6')]){_0x331c26['push'](_[_0xa923('0x58')]({'channel':_0x775642,'type':_0xa923('0xe7'),'data1':_0xa923('0xe8')},_0x39b243));}});return db['MemberReport'][_0xa923('0x65')](_0x256b28['concat'](_0x331c26),{'individualHooks':!![]});}})[_0xa923('0x22')](function(){if(_0x11d393){return _0x11d393[_0xa923('0x36')]({'online':!![],'lastLoginAt':moment()['format'](_0xa923('0xe5')),'voicePause':_0x11d393[_0xa923('0xd6')]||![],'mailPause':_0x11d393[_0xa923('0xd6')]||![],'chatPause':_0x11d393['loginInPause']||![],'faxPause':_0x11d393[_0xa923('0xd6')]||![],'smsPause':_0x11d393[_0xa923('0xd6')]||![],'openchannelPause':_0x11d393[_0xa923('0xd6')]||![],'whatsappPause':_0x11d393['loginInPause']||![],'pauseType':_0x11d393[_0xa923('0xd6')]?'LOGININPAUSE':null,'interface':_0x194f1f,'lastPauseAt':moment()[_0xa923('0x71')](_0xa923('0xe5'))});}})['then'](function(_0x535592){if(_0xfa760['isMiddleware']){return _0x273241();}else{return BPromise[_0xa923('0xe9')](_0x535592)[_0xa923('0x22')](respondWithResult(_0x1b7d89,null));}})['catch'](handleError(_0x1b7d89,null));};exports[_0xa923('0xea')]=function(_0x2cb9bf,_0xb6ed24,_0x38ac44){var _0x17fce8;return db[_0xa923('0x46')][_0xa923('0x3e')]({'where':{'id':_0x2cb9bf[_0xa923('0x61')]['id'],'role':_0xa923('0x6a')},'attributes':['id',_0xa923('0x3f'),_0xa923('0x3d')]})[_0xa923('0x22')](handleEntityNotFound(_0xb6ed24,null))[_0xa923('0x22')](function(_0x2ff5e4){if(_0x2ff5e4){_0x17fce8=_0x2ff5e4;return db[_0xa923('0xae')][_0xa923('0x41')]({'where':{'membername':_0x17fce8[_0xa923('0x3f')]},'individualHooks':!![]});}})[_0xa923('0x22')](function(){return db[_0xa923('0xe1')][_0xa923('0xc4')]({'where':{'membername':_0x17fce8[_0xa923('0x3f')],'exitAt':null}});})['then'](function(_0x2b1be3){var _0x1af3cf=[];_0x2b1be3['forEach'](function(_0x3a7bcd){_0x1af3cf[_0xa923('0xab')](_0x3a7bcd[_0xa923('0x36')]({'exitAt':moment()[_0xa923('0x71')](_0xa923('0xe5'))}));});return BPromise[_0xa923('0xe3')](_0x1af3cf);})[_0xa923('0x22')](function(){return _0x17fce8[_0xa923('0x36')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xa923('0x22')](respondWithResult(_0xb6ed24,null))[_0xa923('0x2c')](handleError(_0xb6ed24,null));};exports[_0xa923('0xeb')]=function(_0x1eb5d0,_0x165663,_0x45c90c){var _0x297d40;return db['UserVoiceQueueRt'][_0xa923('0x36')]({'paused':0x1},{'where':{'UserId':_0x1eb5d0[_0xa923('0x61')]['id']},'individualHooks':!![]})['then'](function(){return db[_0xa923('0x46')]['find']({'where':{'id':_0x1eb5d0[_0xa923('0x61')]['id'],'role':'agent'},'attributes':['id',_0xa923('0x3f'),_0xa923('0x3d'),_0xa923('0x79'),_0xa923('0xac')]});})[_0xa923('0x22')](handleEntityNotFound(_0x165663,null))['then'](function(_0x32eb41){if(_0x32eb41){_0x297d40=_0x32eb41;return respondWithRpcPromise(_0xa923('0xec'),'pause',{'id':_0x297d40['id'],'name':_0x297d40[_0xa923('0x3f')],'pause':!![]});}})[_0xa923('0x22')](function(){if(_0x297d40){return db['MemberReport'][_0xa923('0xc4')]({'where':{'membername':_0x297d40[_0xa923('0x3f')],'type':'PAUSE','exitAt':null}});}})[_0xa923('0x22')](function(_0xe1c2f6){if(_0xe1c2f6[_0xa923('0x52')]){var _0xa37e37=moment()[_0xa923('0x71')](_0xa923('0xe5'));for(var _0x5a8cd4=0x0,_0x5d7ff5=_0xe1c2f6[_0xa923('0x52')];_0x5a8cd4<_0x5d7ff5;_0x5a8cd4++){_0xe1c2f6[_0x5a8cd4][_0xa923('0xed')]({'exitAt':_0xa37e37});}}})[_0xa923('0x22')](function(){var _0x14152=[];var _0x57e4d1=utils[_0xa923('0xe4')]();_0x57e4d1[_0xa923('0xe2')](function(_0xa7aa19){_0x14152[_0xa923('0xab')]({'channel':_0xa7aa19,'membername':_0x297d40[_0xa923('0x3f')],'interface':_['isNil'](_0x297d40[_0xa923('0xac')])?util['format'](_0xa923('0xd9'),_0x297d40[_0xa923('0x3f')]):_0x297d40[_0xa923('0xac')],'type':_0xa923('0xe7'),'enterAt':moment()[_0xa923('0x71')](_0xa923('0xe5')),'data1':_0x1eb5d0[_0xa923('0x66')][_0xa923('0x59')]||_0xa923('0xee'),'role':_0x297d40[_0xa923('0x3d')],'internal':_0x297d40[_0xa923('0x79')]});});return db[_0xa923('0xe1')][_0xa923('0x65')](_0x14152,{'individualHooks':!![]});})[_0xa923('0x22')](function(){return _0x297d40[_0xa923('0x36')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x1eb5d0[_0xa923('0x66')]['type']||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xa923('0x71')](_0xa923('0xe5'))});})['then'](respondWithResult(_0x165663,null))[_0xa923('0x2c')](handleError(_0x165663,null));};exports[_0xa923('0xef')]=function(_0x2ec2d7,_0x3bfeec,_0xf064a2){var _0x2a393d;return db[_0xa923('0x46')][_0xa923('0x3e')]({'where':{'id':_0x2ec2d7[_0xa923('0x61')]['id']},'attributes':['id',_0xa923('0x3f'),_0xa923('0x3d'),_0xa923('0x9d'),_0xa923('0xf0'),_0xa923('0xf1'),_0xa923('0xf2'),_0xa923('0xf3'),_0xa923('0xf4'),'whatsapppause',_0xa923('0xf5'),_0xa923('0xf6')]})[_0xa923('0x22')](handleEntityNotFound(_0x3bfeec,null))['then'](function(_0x4f4788){if(_0x4f4788){_0x2a393d=_0x4f4788;if(_0x2ec2d7[_0xa923('0x66')]['channel']&&!utils['isValidChannel'](_0x2ec2d7[_0xa923('0x66')]['channel'])){throw new db[(_0xa923('0x1f'))][(_0xa923('0x20'))](_0xa923('0x9f'));}switch(_0x2ec2d7[_0xa923('0x66')]['channel']){case _0xa923('0xa8'):return respondWithRpcPromise('QueuePause',_0xa923('0xef'),{'id':_0x2a393d['id'],'name':_0x2a393d['name'],'pause':![]})[_0xa923('0x22')](function(){return db[_0xa923('0xae')]['update']({'paused':0x0},{'where':{'UserId':_0x2a393d['id']},'individualHooks':!![]});})['then'](function(){return db[_0xa923('0xe1')]['find']({'where':{'channel':_0x2ec2d7[_0xa923('0x66')]['channel'],'membername':_0x2a393d[_0xa923('0x3f')],'type':_0xa923('0xe7'),'exitAt':null}});})[_0xa923('0x22')](function(_0x596e1d){if(_0x596e1d){return _0x596e1d[_0xa923('0x36')]({'exitAt':moment()[_0xa923('0x71')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xa923('0xf7')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x2a393d['update']({'voicePause':![]});});case _0xa923('0xf8'):case _0xa923('0xf9'):case'fax':case _0xa923('0xfa'):case _0xa923('0xfb'):case _0xa923('0xfc'):return db['MemberReport'][_0xa923('0x3e')]({'where':{'channel':_0x2ec2d7['body'][_0xa923('0x9c')],'membername':_0x2a393d[_0xa923('0x3f')],'type':_0xa923('0xe7'),'exitAt':null}})[_0xa923('0x22')](function(_0xb84a48){if(_0xb84a48){return _0xb84a48['update']({'exitAt':moment()[_0xa923('0x71')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'manual'},{'individualHooks':!![]});}return null;})['then'](function(){var _0x295a47={};_['set'](_0x295a47,util['format'](_0xa923('0xfd'),_0x2ec2d7['body'][_0xa923('0x9c')],'Pause'),![]);return _0x2a393d[_0xa923('0x36')](_0x295a47);});default:return respondWithRpcPromise('QueuePause',_0xa923('0xef'),{'id':_0x2a393d['id'],'name':_0x2a393d[_0xa923('0x3f')],'pause':![]})[_0xa923('0x22')](function(){return db['UserVoiceQueueRt'][_0xa923('0x36')]({'paused':0x0},{'where':{'UserId':_0x2a393d['id']}});})['then'](function(){return db['MemberReport'][_0xa923('0xc4')]({'where':{'membername':_0x2a393d[_0xa923('0x3f')],'type':_0xa923('0xe7'),'exitAt':null}});})[_0xa923('0x22')](function(_0x3c888b){var _0x48fb73=[];_0x3c888b[_0xa923('0xe2')](function(_0x26fd3c){_0x48fb73[_0xa923('0xab')](_0x26fd3c[_0xa923('0x36')]({'exitAt':moment()[_0xa923('0x71')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xa923('0xf7')}));});return BPromise[_0xa923('0xe3')](_0x48fb73);})['then'](function(){return _0x2a393d['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x3bfeec,null))[_0xa923('0x2c')](handleError(_0x3bfeec,null));};exports[_0xa923('0xfe')]=function(_0x33cd95,_0x318727,_0x549506){var _0x12f957={};var _0x3bf9a5={};var _0x457cc8;var _0x3f4287;return db[_0xa923('0x46')][_0xa923('0x93')]({'where':{'id':_0x33cd95[_0xa923('0x61')]['id']}})['then'](handleEntityNotFound(_0x318727,null))[_0xa923('0x22')](function(_0x448e29){if(_0x448e29){_0x457cc8=_0x448e29;_0x3bf9a5[_0xa923('0x49')]=_['keys'](db[_0xa923('0xff')][_0xa923('0x63')]);_0x3bf9a5['query']=_[_0xa923('0x4d')](_0x33cd95['query']);_0x3bf9a5[_0xa923('0x4e')]=_['intersection'](_0x3bf9a5[_0xa923('0x49')],_0x3bf9a5[_0xa923('0x4c')]);_0x12f957[_0xa923('0x51')]=_['intersection'](_0x3bf9a5['model'],qs[_0xa923('0x50')](_0x33cd95['query'][_0xa923('0x50')]));_0x12f957[_0xa923('0x51')]=_0x12f957[_0xa923('0x51')][_0xa923('0x52')]?_0x12f957['attributes']:_0x3bf9a5[_0xa923('0x49')];_0x12f957[_0xa923('0x54')]=qs['sort'](_0x33cd95[_0xa923('0x4c')][_0xa923('0x55')]);_0x12f957['where']=qs[_0xa923('0x4e')](_[_0xa923('0x57')](_0x33cd95[_0xa923('0x4c')],_0x3bf9a5[_0xa923('0x4e')]));if(_0x33cd95[_0xa923('0x4c')][_0xa923('0x3b')]){_0x12f957[_0xa923('0x56')]=_[_0xa923('0x58')](_0x12f957[_0xa923('0x56')],{'$or':_[_0xa923('0x45')](_0x12f957[_0xa923('0x51')],function(_0x581fa6){var _0x3f7a37={};_0x3f7a37[_0x581fa6]={'$like':'%'+_0x33cd95['query'][_0xa923('0x3b')]+'%'};return _0x3f7a37;})});}_0x12f957=_[_0xa923('0x58')]({},_0x12f957,_0x33cd95[_0xa923('0x5e')]);return _0x457cc8[_0xa923('0xfe')](_0x12f957);}})[_0xa923('0x22')](function(_0x3f326c){if(_0x3f326c){_0x3f4287=_0x3f326c[_0xa923('0x52')];if(!_0x33cd95[_0xa923('0x4c')][_0xa923('0xbb')](_0xa923('0x53'))){_0x12f957[_0xa923('0x32')]=qs[_0xa923('0x32')](_0x33cd95['query'][_0xa923('0x32')]);_0x12f957['offset']=qs['offset'](_0x33cd95['query']['offset']);}return _0x457cc8[_0xa923('0xfe')](_0x12f957);}})[_0xa923('0x22')](function(_0x15bd78){if(_0x15bd78){return _0x15bd78?{'count':_0x3f4287,'rows':_0x15bd78}:null;}})['then'](respondWithResult(_0x318727,null))[_0xa923('0x2c')](handleError(_0x318727,null));};exports['addTeams']=function(_0xa48b0c,_0x36ff5d){return db['User'][_0xa923('0x3e')]({'where':{'id':_0xa48b0c[_0xa923('0x61')]['id']}})['then'](handleEntityNotFound(_0x36ff5d,null))['then'](function(_0x9f5489){if(_0x9f5489){var _0x377ba2=_0x9f5489[_0xa923('0x8d')]({'plain':!![]});return _0x9f5489[_0xa923('0x100')](_0xa48b0c['body'][_0xa923('0x69')],_[_0xa923('0x101')](_0xa48b0c[_0xa923('0x66')],[_0xa923('0x69'),'id'])||{})['then'](function(){for(var _0x43c286=0x0;_0x43c286<_0xa48b0c['body'][_0xa923('0x69')]['length'];_0x43c286++){var _0x2f57ea=[];db['Team'][_0xa923('0x93')]({'where':{'id':_0xa48b0c['body'][_0xa923('0x69')][_0x43c286]}})[_0xa923('0x22')](function(_0x1056f4){_0x2f57ea[_0xa923('0xab')](_0x1056f4['getVoiceQueues']()[_0xa923('0x22')](function(_0x24441f){for(var _0xd634a0=0x0;_0xd634a0<_0x24441f[_0xa923('0x52')];_0xd634a0++){_0x24441f[_0xd634a0][_0xa923('0x102')]('channel','Voice');}return _0x24441f;}));_0x2f57ea[_0xa923('0xab')](_0x1056f4['getChatQueues']()['then'](function(_0x3847aa){for(var _0x5ef000=0x0;_0x5ef000<_0x3847aa[_0xa923('0x52')];_0x5ef000++){_0x3847aa[_0x5ef000][_0xa923('0x102')](_0xa923('0x9c'),'Chat');}return _0x3847aa;}));_0x2f57ea[_0xa923('0xab')](_0x1056f4[_0xa923('0x103')]()[_0xa923('0x22')](function(_0x3f3c4b){for(var _0x57ff78=0x0;_0x57ff78<_0x3f3c4b[_0xa923('0x52')];_0x57ff78++){_0x3f3c4b[_0x57ff78]['setDataValue']('channel',_0xa923('0x104'));}return _0x3f3c4b;}));_0x2f57ea[_0xa923('0xab')](_0x1056f4[_0xa923('0x105')]()[_0xa923('0x22')](function(_0x2b119b){for(var _0x4e0585=0x0;_0x4e0585<_0x2b119b['length'];_0x4e0585++){_0x2b119b[_0x4e0585][_0xa923('0x102')]('channel',_0xa923('0x106'));}return _0x2b119b;}));_0x2f57ea[_0xa923('0xab')](_0x1056f4[_0xa923('0x107')]()['then'](function(_0x292900){for(var _0x2fecba=0x0;_0x2fecba<_0x292900[_0xa923('0x52')];_0x2fecba++){_0x292900[_0x2fecba][_0xa923('0x102')](_0xa923('0x9c'),_0xa923('0x108'));}return _0x292900;}));_0x2f57ea[_0xa923('0xab')](_0x1056f4[_0xa923('0x109')]()[_0xa923('0x22')](function(_0x53ef02){for(var _0x11bb30=0x0;_0x11bb30<_0x53ef02[_0xa923('0x52')];_0x11bb30++){_0x53ef02[_0x11bb30]['setDataValue']('channel',_0xa923('0x10a'));}return _0x53ef02;}));_0x2f57ea[_0xa923('0xab')](_0x1056f4[_0xa923('0x10b')]()[_0xa923('0x22')](function(_0x50e475){for(var _0x5d1377=0x0;_0x5d1377<_0x50e475[_0xa923('0x52')];_0x5d1377++){_0x50e475[_0x5d1377][_0xa923('0x102')](_0xa923('0x9c'),_0xa923('0x10c'));}return _0x50e475;}));return BPromise[_0xa923('0xe3')](_0x2f57ea);})[_0xa923('0x22')](function(_0x3370a9){var _0x4827ed=_['flatten'](_0x3370a9);_0x2f57ea=[];return db['sequelize'][_0xa923('0x10d')](function(_0x556f6f){for(var _0x38af8c=0x0;_0x38af8c<_0x4827ed[_0xa923('0x52')];_0x38af8c++){_0x2f57ea[_0xa923('0xab')](_0x4827ed[_0x38af8c]['addAgent'](_0x377ba2['id']),{'transaction':_0x556f6f});}return BPromise[_0xa923('0xe3')](_0x2f57ea)[_0xa923('0x22')](function(){if(_0x377ba2['online']){return BPromise[_0xa923('0xad')](_[_0xa923('0x3b')](_0x4827ed,function(_0x23e53c){return _0x23e53c[_0xa923('0x10e')](_0xa923('0x9c'))===_0xa923('0x10f');}),function(_0x393641){return db[_0xa923('0xae')][_0xa923('0xaf')]({'membername':_0x377ba2[_0xa923('0x3f')],'UserId':_0x377ba2['id'],'queue_name':_0x393641['name'],'VoiceQueueId':_0x393641['id'],'interface':_['isNil'](_0x377ba2[_0xa923('0xac')])?util[_0xa923('0x71')](_0xa923('0xd9'),_0x377ba2[_0xa923('0x3f')]):_0x377ba2[_0xa923('0xac')],'paused':_0x377ba2['voicePause']||![],'penalty':_0x377ba2[_0xa923('0xa1')]},{'transaction':_0x556f6f});});}else{return;}})[_0xa923('0x22')](function(){for(var _0x4acc09=0x0;_0x4acc09<_0x4827ed[_0xa923('0x52')];_0x4acc09++){var _0x57f6df=_0x4827ed[_0x4acc09]['getDataValue'](_0xa923('0x9c'));var _0xf41514=_0x57f6df+'QueueId';socket[_0xa923('0xa6')](_0xa923('0x38')+_0x57f6df+_0xa923('0xa7'),{'UserId':_0x377ba2['id'],['queueField']:_0x4827ed[_0x4acc09]['id']});}});});});}});}})[_0xa923('0x22')](respondWithStatusCode(_0x36ff5d,null))['catch'](handleError(_0x36ff5d,null));};exports[_0xa923('0x110')]=function(_0x4f882f,_0x2981de){return db[_0xa923('0x46')]['findOne']({'where':{'id':_0x4f882f[_0xa923('0x61')]['id']}})['then'](handleEntityNotFound(_0x2981de,null))[_0xa923('0x22')](function(_0x566c03){if(_0x566c03){var _0x25d60e=_0x566c03[_0xa923('0x8d')]({'plain':!![]});var _0x5d68cb=_0x4f882f[_0xa923('0x4c')][_0xa923('0x69')];return _0x566c03[_0xa923('0x110')](_0x5d68cb)['then'](function(){for(var _0x2233c8=0x0;_0x2233c8<_0x5d68cb[_0xa923('0x52')];_0x2233c8++){var _0x33bc55=[];db[_0xa923('0xff')][_0xa923('0x93')]({'where':{'id':_0x5d68cb[_0x2233c8]}})[_0xa923('0x22')](function(_0x405d44){_0x33bc55['push'](_0x405d44[_0xa923('0xdf')]()[_0xa923('0x22')](function(_0x37de4f){for(var _0x55ce7a=0x0;_0x55ce7a<_0x37de4f[_0xa923('0x52')];_0x55ce7a++){_0x37de4f[_0x55ce7a]['setDataValue']('channel',_0xa923('0x10f'));}return _0x37de4f;}));_0x33bc55['push'](_0x405d44[_0xa923('0x111')]()['then'](function(_0x31c616){for(var _0x5ea40f=0x0;_0x5ea40f<_0x31c616[_0xa923('0x52')];_0x5ea40f++){_0x31c616[_0x5ea40f][_0xa923('0x102')](_0xa923('0x9c'),_0xa923('0x112'));}return _0x31c616;}));_0x33bc55[_0xa923('0xab')](_0x405d44[_0xa923('0x103')]()[_0xa923('0x22')](function(_0x1ac2ee){for(var _0xdcdcab=0x0;_0xdcdcab<_0x1ac2ee[_0xa923('0x52')];_0xdcdcab++){_0x1ac2ee[_0xdcdcab][_0xa923('0x102')](_0xa923('0x9c'),_0xa923('0x104'));}return _0x1ac2ee;}));_0x33bc55[_0xa923('0xab')](_0x405d44[_0xa923('0x105')]()[_0xa923('0x22')](function(_0x560140){for(var _0x24133e=0x0;_0x24133e<_0x560140[_0xa923('0x52')];_0x24133e++){_0x560140[_0x24133e][_0xa923('0x102')](_0xa923('0x9c'),_0xa923('0x106'));}return _0x560140;}));_0x33bc55['push'](_0x405d44[_0xa923('0x107')]()[_0xa923('0x22')](function(_0x36226c){for(var _0x12a761=0x0;_0x12a761<_0x36226c[_0xa923('0x52')];_0x12a761++){_0x36226c[_0x12a761][_0xa923('0x102')](_0xa923('0x9c'),'Whatsapp');}return _0x36226c;}));_0x33bc55[_0xa923('0xab')](_0x405d44[_0xa923('0x109')]()['then'](function(_0x10e3fa){for(var _0x18e53d=0x0;_0x18e53d<_0x10e3fa[_0xa923('0x52')];_0x18e53d++){_0x10e3fa[_0x18e53d]['setDataValue'](_0xa923('0x9c'),_0xa923('0x10a'));}return _0x10e3fa;}));_0x33bc55[_0xa923('0xab')](_0x405d44[_0xa923('0x10b')]()[_0xa923('0x22')](function(_0x43f11b){for(var _0x207bbb=0x0;_0x207bbb<_0x43f11b[_0xa923('0x52')];_0x207bbb++){_0x43f11b[_0x207bbb]['setDataValue']('channel',_0xa923('0x10c'));}return _0x43f11b;}));return BPromise[_0xa923('0xe3')](_0x33bc55);})[_0xa923('0x22')](function(_0x3c46b9){var _0x2706d6=_[_0xa923('0x113')](_0x3c46b9);_0x33bc55=[];return db[_0xa923('0x5b')]['transaction'](function(_0xcd1818){for(var _0x3b6bdf=0x0;_0x3b6bdf<_0x2706d6['length'];_0x3b6bdf++){_0x33bc55[_0xa923('0xab')](_0x2706d6[_0x3b6bdf]['removeAgent'](_0x25d60e['id']),{'transaction':_0xcd1818});}return BPromise[_0xa923('0xe3')](_0x33bc55)[_0xa923('0x22')](function(){if(_0x25d60e['online']){return BPromise[_0xa923('0xad')](_[_0xa923('0x3b')](_0x2706d6,function(_0x251c56){return _0x251c56['getDataValue'](_0xa923('0x9c'))===_0xa923('0x10f');}),function(_0x2e5ec0){return db[_0xa923('0xae')]['destroy']({'where':{'VoiceQueueId':_0x2e5ec0['id'],'UserId':_0x25d60e['id']},'transaction':_0xcd1818});});}else{return;}})['then'](function(){for(var _0x5de8c1=0x0;_0x5de8c1<_0x2706d6[_0xa923('0x52')];_0x5de8c1++){var _0x418a18=_0x2706d6[_0x5de8c1][_0xa923('0x10e')](_0xa923('0x9c'));var _0x27e7e6=_0x418a18+_0xa923('0xa5');socket['emit'](_0xa923('0x38')+_0x418a18+_0xa923('0x114'),{'UserId':_0x25d60e['id'],['queueField']:_0x2706d6[_0x5de8c1]['id']});}});});});}});}})[_0xa923('0x22')](respondWithStatusCode(_0x2981de,null))[_0xa923('0x2c')](handleError(_0x2981de,null));};exports[_0xa923('0x115')]=function(_0x366dcf,_0x5f52ca,_0x38a07c){var _0x56132e={};var _0xee7925={};var _0x2dc1dc;var _0x4a0313;return db[_0xa923('0x46')][_0xa923('0x93')]({'where':{'id':_0x366dcf['params']['id']}})['then'](handleEntityNotFound(_0x5f52ca,null))[_0xa923('0x22')](function(_0x2cea59){if(_0x2cea59){_0x2dc1dc=_0x2cea59;_0xee7925[_0xa923('0x49')]=_['keys'](db[_0xa923('0xbc')][_0xa923('0x63')]);_0xee7925[_0xa923('0x4c')]=_[_0xa923('0x4d')](_0x366dcf['query']);_0xee7925[_0xa923('0x4e')]=_[_0xa923('0x4f')](_0xee7925[_0xa923('0x49')],_0xee7925[_0xa923('0x4c')]);_0x56132e[_0xa923('0x51')]=_[_0xa923('0x4f')](_0xee7925[_0xa923('0x49')],qs[_0xa923('0x50')](_0x366dcf['query']['fields']));_0x56132e[_0xa923('0x51')]=_0x56132e[_0xa923('0x51')][_0xa923('0x52')]?_0x56132e['attributes']:_0xee7925[_0xa923('0x49')];_0x56132e['order']=qs[_0xa923('0x55')](_0x366dcf['query'][_0xa923('0x55')]);_0x56132e[_0xa923('0x56')]=qs[_0xa923('0x4e')](_[_0xa923('0x57')](_0x366dcf['query'],_0xee7925[_0xa923('0x4e')]));if(_0x366dcf['query'][_0xa923('0x3b')]){_0x56132e[_0xa923('0x56')]=_[_0xa923('0x58')](_0x56132e[_0xa923('0x56')],{'$or':_[_0xa923('0x45')](_0x56132e[_0xa923('0x51')],function(_0xbccb5){var _0x33a844={};_0x33a844[_0xbccb5]={'$like':'%'+_0x366dcf['query']['filter']+'%'};return _0x33a844;})});}_0x56132e=_[_0xa923('0x58')]({},_0x56132e,_0x366dcf[_0xa923('0x5e')]);return _0x2dc1dc[_0xa923('0x115')](_0x56132e);}})['then'](function(_0x550332){if(_0x550332){_0x4a0313=_0x550332[_0xa923('0x52')];if(!_0x366dcf[_0xa923('0x4c')]['hasOwnProperty'](_0xa923('0x53'))){_0x56132e['limit']=qs['limit'](_0x366dcf['query']['limit']);_0x56132e[_0xa923('0x31')]=qs[_0xa923('0x31')](_0x366dcf[_0xa923('0x4c')][_0xa923('0x31')]);}return _0x2dc1dc['getLists'](_0x56132e);}})[_0xa923('0x22')](function(_0x5aab43){if(_0x5aab43){return _0x5aab43?{'count':_0x4a0313,'rows':_0x5aab43}:null;}})['then'](respondWithResult(_0x5f52ca,null))[_0xa923('0x2c')](handleError(_0x5f52ca,null));};exports[_0xa923('0x116')]=function(_0x345391,_0x37c4e5,_0x28cd46){var _0x37a3f2={};var _0x21cbfe={};var _0x2cf6ba;var _0x266941;return db['User'][_0xa923('0x93')]({'where':{'id':_0x345391[_0xa923('0x61')]['id']}})[_0xa923('0x22')](handleEntityNotFound(_0x37c4e5,null))[_0xa923('0x22')](function(_0x31b9d8){if(_0x31b9d8){_0x2cf6ba=_0x31b9d8;_0x21cbfe[_0xa923('0x49')]=_[_0xa923('0x4d')](db[_0xa923('0x46')][_0xa923('0x63')]);_0x21cbfe[_0xa923('0x4c')]=_[_0xa923('0x4d')](_0x345391[_0xa923('0x4c')]);_0x21cbfe[_0xa923('0x4e')]=_[_0xa923('0x4f')](_0x21cbfe[_0xa923('0x49')],_0x21cbfe[_0xa923('0x4c')]);_0x37a3f2[_0xa923('0x51')]=_[_0xa923('0x4f')](_0x21cbfe[_0xa923('0x49')],qs['fields'](_0x345391[_0xa923('0x4c')][_0xa923('0x50')]));_0x37a3f2[_0xa923('0x51')]=_0x37a3f2[_0xa923('0x51')][_0xa923('0x52')]?_0x37a3f2[_0xa923('0x51')]:_0x21cbfe['model'];_0x37a3f2[_0xa923('0x54')]=qs['sort'](_0x345391[_0xa923('0x4c')][_0xa923('0x55')]);_0x37a3f2[_0xa923('0x56')]=qs[_0xa923('0x4e')](_['pick'](_0x345391[_0xa923('0x4c')],_0x21cbfe[_0xa923('0x4e')]));if(_0x345391[_0xa923('0x4c')][_0xa923('0x3b')]){_0x37a3f2['where']=_['merge'](_0x37a3f2['where'],{'$or':_['map'](_0x37a3f2['attributes'],function(_0x261cdf){var _0x5546fa={};_0x5546fa[_0x261cdf]={'$like':'%'+_0x345391['query'][_0xa923('0x3b')]+'%'};return _0x5546fa;})});}_0x37a3f2[_0xa923('0x49')]=db[_0xa923('0x46')];_0x37a3f2['as']='Agents';_0x37a3f2=_[_0xa923('0x58')]({},_0x37a3f2,_0x345391['options']);return _0x2cf6ba[_0xa923('0xdf')]({'include':[_0x37a3f2]});}})['then'](function(_0x1c1597){if(_0x1c1597){var _0x10dedc={},_0x1941fb=[],_0xb856c4=0x0;for(var _0xfe9c5d=0x0;_0xfe9c5d<_0x1c1597['length'];_0xfe9c5d+=0x1){for(var _0x635930=0x0,_0x29879d;_0x635930<_0x1c1597[_0xfe9c5d]['Agents'][_0xa923('0x52')];_0x635930+=0x1){_0x29879d=_0x1c1597[_0xfe9c5d]['Agents'][_0x635930][_0xa923('0x8d')]({'plain':!![]});_0x10dedc[_0x29879d['id']]=_0x29879d;}}_0x10dedc=_[_0xa923('0x117')](_0x10dedc);for(var _0x33e944=qs[_0xa923('0x31')](_0x345391[_0xa923('0x4c')]['offset']);_0x33e944<_0x10dedc['length']&&_0x1941fb[_0xa923('0x52')]=_0x3b81e7){_0x418294=_0x3b81e7;_0x2c8e9e=0xc8;}else{_0x2c8e9e=0xce;}_0x52a353[_0x14c5('0x2b')](_0x2c8e9e);return _0x52a353['set'](_0x14c5('0x30'),_0x3814eb+'-'+_0x418294+'/'+_0x3b81e7)[_0x14c5('0x2d')](_0xaeb416);}return null;};}function patchUpdates(_0x131150){return function(_0x3d3caa){try{jsonpatch[_0x14c5('0x31')](_0x3d3caa,_0x131150,!![]);}catch(_0x349775){return BPromise[_0x14c5('0x32')](_0x349775);}return _0x3d3caa[_0x14c5('0x33')]();};}function saveUpdates(_0x2866cc,_0x3ba5d0){return function(_0x152433){if(_0x152433){return _0x152433[_0x14c5('0x34')](_0x2866cc)['then'](function(_0x567893){return _0x567893;});}return null;};}function removeEntity(_0x5ea622,_0x17b5ed){return function(_0x2f1eda){if(_0x2f1eda){return _0x2f1eda[_0x14c5('0x35')]()[_0x14c5('0x21')](function(){var _0xbcc203=_0x2f1eda[_0x14c5('0x36')]({'plain':!![]});var _0x1332cc=[{'name':_0x14c5('0x37'),'value':_0x14c5('0x38'),'ignore':!![]},{'name':_0x14c5('0x39'),'value':_0x14c5('0x3a'),'ignore':![]},{'name':_0x14c5('0x3b'),'value':_0x14c5('0x3c'),'ignore':![]}];var _0x488241=_(_0x1332cc)[_0x14c5('0x3d')]('ignore')[_0x14c5('0x3e')]('value')[_0x14c5('0x3f')]();if(_['includes'](_0x488241,_0xbcc203['role'])){return;}var _0x43a72c=_[_0x14c5('0x40')](_0x1332cc,[_0x14c5('0x3f'),_0xbcc203[_0x14c5('0x41')]])[_0x14c5('0x42')];return db['UserProfileResource'][_0x14c5('0x35')]({'where':{'type':_0x43a72c,'resourceId':_0xbcc203['id']}})[_0x14c5('0x21')](function(){return _0x2f1eda;});})[_0x14c5('0x21')](function(){_0x5ea622[_0x14c5('0x2b')](0xcc)[_0x14c5('0x2c')]();});}};}function handleEntityNotFound(_0x242da2,_0x453106){return function(_0x33e1cb){if(!_0x33e1cb){_0x242da2[_0x14c5('0x2a')](0x194);}return _0x33e1cb;};}function handleError(_0x59e4b1,_0x3cb2d6){_0x3cb2d6=_0x3cb2d6||0x1f4;return function(_0x1828c8){logger[_0x14c5('0x27')](_0x1828c8[_0x14c5('0x43')]);if(_0x1828c8[_0x14c5('0x42')]){delete _0x1828c8[_0x14c5('0x42')];}_0x59e4b1[_0x14c5('0x2b')](_0x3cb2d6)[_0x14c5('0x44')](_0x1828c8);};}exports[_0x14c5('0x45')]=function(_0x16557e,_0x449828){var _0x11885f={},_0x25b21d={},_0x49165f={'count':0x0,'rows':[]};var _0x1ed461=_[_0x14c5('0x3e')](db[_0x14c5('0x46')][_0x14c5('0x47')],function(_0x4aebc3){return{'name':_0x4aebc3[_0x14c5('0x48')],'type':_0x4aebc3[_0x14c5('0x49')]['key']};});_0x25b21d[_0x14c5('0x4a')]=_[_0x14c5('0x4b')](_[_0x14c5('0x3e')](_0x1ed461,_0x14c5('0x42')),[_0x14c5('0x4c'),_0x14c5('0x4d')]);_0x25b21d[_0x14c5('0x4e')]=_[_0x14c5('0x4f')](_0x16557e[_0x14c5('0x4e')]);_0x25b21d[_0x14c5('0x50')]=_[_0x14c5('0x51')](_0x25b21d[_0x14c5('0x4a')],_0x25b21d[_0x14c5('0x4e')]);_0x11885f[_0x14c5('0x52')]=_[_0x14c5('0x51')](_0x25b21d[_0x14c5('0x4a')],qs[_0x14c5('0x53')](_0x16557e[_0x14c5('0x4e')][_0x14c5('0x53')]));_0x11885f[_0x14c5('0x52')]=_0x11885f[_0x14c5('0x52')][_0x14c5('0x54')]?_0x11885f[_0x14c5('0x52')]:_0x25b21d[_0x14c5('0x4a')];if(!_0x16557e['query']['hasOwnProperty'](_0x14c5('0x55'))){_0x11885f[_0x14c5('0x2f')]=qs[_0x14c5('0x2f')](_0x16557e[_0x14c5('0x4e')][_0x14c5('0x2f')]);_0x11885f[_0x14c5('0x2e')]=qs[_0x14c5('0x2e')](_0x16557e[_0x14c5('0x4e')][_0x14c5('0x2e')]);}_0x11885f[_0x14c5('0x56')]=qs[_0x14c5('0x57')](_0x16557e[_0x14c5('0x4e')][_0x14c5('0x57')]);_0x11885f[_0x14c5('0x58')]=qs[_0x14c5('0x50')](_[_0x14c5('0x59')](_0x16557e[_0x14c5('0x4e')],_0x25b21d['filters']),_0x1ed461);if(_0x16557e['query'][_0x14c5('0x3d')]){_0x11885f[_0x14c5('0x58')]=_[_0x14c5('0x5a')](_0x11885f[_0x14c5('0x58')],{'$or':_[_0x14c5('0x3e')](_0x1ed461,function(_0x4dcefd){if(_0x4dcefd[_0x14c5('0x49')]!==_0x14c5('0x5b')){return db[_0x14c5('0x5c')][_0x14c5('0x58')](db[_0x14c5('0x5c')]['fn']('lower',db[_0x14c5('0x5c')][_0x14c5('0x5d')](_0x4dcefd[_0x14c5('0x42')])),{'$like':db[_0x14c5('0x5c')]['fn']('lower','%'+_0x16557e[_0x14c5('0x4e')][_0x14c5('0x3d')]+'%')});}})});}_0x11885f=_[_0x14c5('0x5a')]({},_0x11885f,_0x16557e[_0x14c5('0x5e')]);var _0x27e43e={'where':_0x11885f[_0x14c5('0x58')]};return db[_0x14c5('0x46')][_0x14c5('0x5f')](_0x27e43e)[_0x14c5('0x21')](function(_0x3ba7c7){_0x49165f[_0x14c5('0x5f')]=_0x3ba7c7;if(_0x16557e[_0x14c5('0x4e')][_0x14c5('0x60')]){_0x11885f['include']=[{'all':!![]}];}return db[_0x14c5('0x46')]['findAll'](_0x11885f);})['then'](function(_0x5bb2a4){_0x49165f[_0x14c5('0x61')]=_0x5bb2a4;return _0x49165f;})['then'](respondWithFilteredResult(_0x449828,_0x11885f))[_0x14c5('0x62')](handleError(_0x449828,null));};exports[_0x14c5('0x63')]=function(_0x4dfc32,_0x1392c8){var _0xc6ca61={'raw':![],'where':{'id':_0x4dfc32['params']['id']}},_0x408345={};_0x408345[_0x14c5('0x4a')]=_[_0x14c5('0x4b')](_[_0x14c5('0x4f')](db[_0x14c5('0x46')][_0x14c5('0x47')]),['password',_0x14c5('0x4d')]);_0x408345[_0x14c5('0x4e')]=_['keys'](_0x4dfc32['query']);_0x408345[_0x14c5('0x50')]=_[_0x14c5('0x51')](_0x408345[_0x14c5('0x4a')],_0x408345[_0x14c5('0x4e')]);_0xc6ca61[_0x14c5('0x52')]=_[_0x14c5('0x51')](_0x408345[_0x14c5('0x4a')],qs[_0x14c5('0x53')](_0x4dfc32[_0x14c5('0x4e')]['fields']));_0xc6ca61[_0x14c5('0x52')]=_0xc6ca61['attributes'][_0x14c5('0x54')]?_0xc6ca61[_0x14c5('0x52')]:_0x408345[_0x14c5('0x4a')];if(_0x4dfc32[_0x14c5('0x4e')][_0x14c5('0x60')]){_0xc6ca61[_0x14c5('0x64')]=[{'all':!![]}];}_0xc6ca61=_['merge']({},_0xc6ca61,_0x4dfc32[_0x14c5('0x5e')]);return db['User'][_0x14c5('0x40')](_0xc6ca61)[_0x14c5('0x21')](handleEntityNotFound(_0x1392c8,null))[_0x14c5('0x21')](respondWithResult(_0x1392c8,null))['catch'](handleError(_0x1392c8,null));};exports[_0x14c5('0x65')]=function(_0x3ab11b,_0xbbd799){return db[_0x14c5('0x46')]['bulkCreate'](_0x3ab11b[_0x14c5('0x66')],{'raw':![],'individualHooks':!![]})[_0x14c5('0x21')](respondWithResult(_0xbbd799,0xc9))[_0x14c5('0x62')](handleError(_0xbbd799,null));};exports[_0x14c5('0x34')]=function(_0x1ac20d,_0x41838f){if(_0x1ac20d[_0x14c5('0x66')]['id']){delete _0x1ac20d[_0x14c5('0x66')]['id'];}delete _0x1ac20d[_0x14c5('0x66')][_0x14c5('0x41')];return db[_0x14c5('0x46')][_0x14c5('0x40')]({'where':{'id':_0x1ac20d['params']['id']}})[_0x14c5('0x21')](handleEntityNotFound(_0x41838f,null))['then'](saveUpdates(_0x1ac20d[_0x14c5('0x66')],null))['then'](respondWithResult(_0x41838f,null))[_0x14c5('0x62')](handleError(_0x41838f,null));};exports['describe']=function(_0x192f4b,_0x131565){return db[_0x14c5('0x46')]['describe']()[_0x14c5('0x21')](respondWithResult(_0x131565,null))[_0x14c5('0x62')](handleError(_0x131565,null));};exports[_0x14c5('0x67')]=function(_0x3b3102,_0x2a3971,_0x3ca5bf){return db[_0x14c5('0x46')]['find']({'where':{'id':_0x3b3102[_0x14c5('0x68')]['id']}})[_0x14c5('0x21')](handleEntityNotFound(_0x2a3971,null))[_0x14c5('0x21')](function(_0x48fa24){if(_0x48fa24){return _0x48fa24[_0x14c5('0x67')](_0x3b3102[_0x14c5('0x66')][_0x14c5('0x69')],_['omit'](_0x3b3102[_0x14c5('0x66')],['ids','id'])||{});}})[_0x14c5('0x21')](respondWithResult(_0x2a3971,null))['catch'](handleError(_0x2a3971,null));};var getLicense=function(_0x791f6f){return new BPromise(function(_0x5a84d8,_0x13295a){var _0x4fb29b=0x0;_0x791f6f[_0x14c5('0x66')][_0x14c5('0x41')]===_0x14c5('0x3a')&&_0x5a84d8('agent\x20role');return db[_0x14c5('0x46')]['count']({'where':{'$or':[{'role':_0x791f6f[_0x14c5('0x66')][_0x14c5('0x41')]===_0x14c5('0x3c')?'telephone':[_0x14c5('0x6a'),_0x14c5('0x38')]}]}})[_0x14c5('0x21')](function(_0x5cc4cb){_0x4fb29b=_0x5cc4cb;return require(_0x14c5('0x6b'))[_0x14c5('0x6c')]();})[_0x14c5('0x21')](function(_0x421a2a){var _0x1aa78c=_0x791f6f['body']['role']===_0x14c5('0x3c')?'telephones':_0x14c5('0x6d');if(!_[_0x14c5('0x6e')](_0x421a2a[_0x1aa78c])&&_0x4fb29b>=_0x421a2a[_0x1aa78c]){return _0x13295a({'message':_0x14c5('0x6f')});}return _0x5a84d8(util[_0x14c5('0x70')](_0x14c5('0x71'),_0x1aa78c,_0x4fb29b));})[_0x14c5('0x62')](function(_0x4e0cbd){return _0x13295a(_0x4e0cbd);});});};exports[_0x14c5('0x72')]=function(_0x1f809,_0x9a7d43){return getLicense(_0x1f809)[_0x14c5('0x21')](function(_0x482bf7){if(!_0x1f809['body'][_0x14c5('0x73')]){var _0x529dce;return db[_0x14c5('0x74')][_0x14c5('0x75')](0x1)[_0x14c5('0x21')](function(_0x28d5db){return checkPasswordPattern(_0x28d5db,_0x1f809[_0x14c5('0x66')][_0x14c5('0x4c')],_0x28d5db['securePassword']);})[_0x14c5('0x21')](function(_0x3e6d64){_0x529dce=_0x3e6d64[_0x14c5('0x76')];return db['User'][_0x14c5('0x77')](_0x14c5('0x73'));})[_0x14c5('0x21')](function(_0x43b2cb){if(_['isNil'](_0x43b2cb)){if(_0x529dce){_0x1f809['body'][_0x14c5('0x73')]=_0x529dce;}else{_0x1f809[_0x14c5('0x66')]['internal']=0x1;}}else{if(_[_0x14c5('0x6e')](_0x529dce)||_0x529dce==_0x43b2cb){_0x1f809[_0x14c5('0x66')][_0x14c5('0x73')]=_0x43b2cb+0x1;}else if(_0x529dce>_0x43b2cb){_0x1f809[_0x14c5('0x66')][_0x14c5('0x73')]=_0x529dce;}else{return db[_0x14c5('0x5c')][_0x14c5('0x4e')](_0x14c5('0x78'),{'type':db[_0x14c5('0x5c')]['QueryTypes'][_0x14c5('0x79')]})[_0x14c5('0x21')](function(_0x49d20a){if(_0x49d20a&&_0x49d20a['length']){for(var _0x5e68da=0x0,_0x661cf4=_0x49d20a[_0x14c5('0x54')];_0x5e68da<_0x661cf4&&_[_0x14c5('0x6e')](_0x1f809[_0x14c5('0x66')][_0x14c5('0x73')]);_0x5e68da++){if(_0x529dce<=_0x49d20a[_0x5e68da]['from']){_0x1f809['body']['internal']=_0x49d20a[_0x5e68da][_0x14c5('0x7a')];}else if(_0x529dce>_0x49d20a[_0x5e68da][_0x14c5('0x7a')]&&_0x529dce<=_0x49d20a[_0x5e68da]['to']){_0x1f809[_0x14c5('0x66')][_0x14c5('0x73')]=_0x529dce;}}}if(_[_0x14c5('0x6e')](_0x1f809[_0x14c5('0x66')][_0x14c5('0x73')])){_0x1f809[_0x14c5('0x66')][_0x14c5('0x73')]=_0x43b2cb+0x1;}});}}});}})['then'](function(){if(_0x1f809[_0x14c5('0x66')][_0x14c5('0x7b')]){_0x1f809[_0x14c5('0x66')]['mailbox']=_0x1f809[_0x14c5('0x66')][_0x14c5('0x73')];_0x1f809['body'][_0x14c5('0x7c')]={'mailbox':_0x1f809[_0x14c5('0x66')][_0x14c5('0x73')],'password':_0x1f809[_0x14c5('0x66')][_0x14c5('0x4c')],'fullname':_0x1f809[_0x14c5('0x66')][_0x14c5('0x7d')],'email':_0x1f809[_0x14c5('0x66')][_0x14c5('0x7e')]};}if(_0x1f809[_0x14c5('0x66')]&&_0x1f809[_0x14c5('0x66')][_0x14c5('0x41')]===_0x14c5('0x3a')){if(!_0x1f809[_0x14c5('0x66')][_0x14c5('0x7f')]){_0x1f809[_0x14c5('0x66')][_0x14c5('0x7f')]=['101',_0x14c5('0x80'),_0x14c5('0x81'),_0x14c5('0x82'),_0x14c5('0x83'),_0x14c5('0x84'),_0x14c5('0x85'),_0x14c5('0x86'),'107',_0x14c5('0x87'),_0x14c5('0x88'),_0x14c5('0x89'),_0x14c5('0x8a'),'114'];}}return db[_0x14c5('0x46')][_0x14c5('0x72')](_0x1f809['body'],{'include':[{'model':db[_0x14c5('0x7c')],'as':'VoiceMail'}]});})['then'](function(_0xbd8ae1){if(_0x1f809['body'][_0x14c5('0x41')]===_0x14c5('0x38'))return _0xbd8ae1;var _0x5ae6eb=_0x1f809[_0x14c5('0x38')][_0x14c5('0x36')]({'plain':!![]});if(!_0x5ae6eb)throw new Error(_0x14c5('0x8b'));if(_0x5ae6eb[_0x14c5('0x41')]===_0x14c5('0x38')){var _0x24ccd6=_0xbd8ae1[_0x14c5('0x36')]({'plain':!![]});var _0x408efd=[{'name':'Agents','value':_0x14c5('0x3a')},{'name':_0x14c5('0x3b'),'value':_0x14c5('0x3c')}];var _0x32cc85=_['find'](_0x408efd,[_0x14c5('0x3f'),_0x24ccd6[_0x14c5('0x41')]])[_0x14c5('0x42')];return db[_0x14c5('0x8c')][_0x14c5('0x40')]({'where':{'name':_0x32cc85,'userProfileId':_0x5ae6eb[_0x14c5('0x8d')]},'raw':!![]})[_0x14c5('0x21')](function(_0x4e7d80){if(_0x4e7d80&&_0x4e7d80[_0x14c5('0x8e')]===0x0){return db[_0x14c5('0x8f')][_0x14c5('0x72')]({'name':_0x24ccd6[_0x14c5('0x42')],'resourceId':_0x24ccd6['id'],'type':_0x4e7d80[_0x14c5('0x42')],'sectionId':_0x4e7d80['id']},{})['then'](function(){return _0xbd8ae1;});}else{return _0xbd8ae1;}})[_0x14c5('0x62')](function(_0x3c8b2c){logger[_0x14c5('0x27')](_0x14c5('0x90'),_0x3c8b2c);throw _0x3c8b2c;});}return _0xbd8ae1;})['then'](respondWithResult(_0x9a7d43,0xc9))['catch'](handleError(_0x9a7d43,null));};exports[_0x14c5('0x91')]=function(_0x21496a,_0x4b88f2,_0x1c5a10){var _0x19e40c=![];if(_0x21496a[_0x14c5('0x66')]['id']){delete _0x21496a[_0x14c5('0x66')]['id'];}return db['Setting']['findOne']({'attributes':['id',_0x14c5('0x92')]})['then'](function(_0x42b43c){_0x19e40c=_0x42b43c['securePassword'];return db[_0x14c5('0x46')][_0x14c5('0x40')]({'where':{'id':_0x21496a[_0x14c5('0x68')]['id']}});})[_0x14c5('0x21')](function(_0x51c9c7){if(_0x51c9c7){if(_0x51c9c7['id']==_0x21496a['user']['id']){if(!_0x21496a[_0x14c5('0x66')]['oldPassword']||!_0x21496a['body'][_0x14c5('0x93')]){throw new db[(_0x14c5('0x1f'))]['ValidationError'](_0x14c5('0x94'));}if(!_0x51c9c7[_0x14c5('0x95')](_0x21496a[_0x14c5('0x66')][_0x14c5('0x96')])){throw new db[(_0x14c5('0x1f'))][(_0x14c5('0x97'))](_0x14c5('0x98'));}if(_0x21496a['body']['oldPassword']==_0x21496a[_0x14c5('0x66')]['newPassword']){throw new db[(_0x14c5('0x1f'))][(_0x14c5('0x97'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}return _0x51c9c7;}else if(_0x21496a['user'][_0x14c5('0x41')]==_0x14c5('0x6a')){if(!_0x21496a[_0x14c5('0x66')]['newPassword']){throw new db[(_0x14c5('0x1f'))][(_0x14c5('0x97'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}return _0x51c9c7;}else if(_0x21496a[_0x14c5('0x38')][_0x14c5('0x41')]==_0x14c5('0x38')){if(!_0x21496a[_0x14c5('0x66')][_0x14c5('0x93')]){throw new db['Sequelize'][(_0x14c5('0x97'))](_0x14c5('0x99'));}if(_0x51c9c7[_0x14c5('0x41')]!=_0x14c5('0x3a')){throw new db['Sequelize'][(_0x14c5('0x97'))](_0x14c5('0x9a'));}return _0x51c9c7;}else{throw new db[(_0x14c5('0x1f'))][(_0x14c5('0x97'))](_0x14c5('0x9a'));}}return null;})[_0x14c5('0x21')](handleEntityNotFound(_0x4b88f2,null))[_0x14c5('0x21')](function(_0x41c2d1){return checkPasswordPattern(_0x41c2d1,_0x21496a['body'][_0x14c5('0x93')],_0x19e40c);})[_0x14c5('0x21')](saveUpdates({'password':_0x21496a[_0x14c5('0x66')][_0x14c5('0x93')],'passwordResetAt':_0x21496a[_0x14c5('0x38')]['id']==_0x21496a[_0x14c5('0x68')]['id']?moment():null},null))[_0x14c5('0x21')](respondWithResult(_0x4b88f2,null))[_0x14c5('0x62')](handleError(_0x4b88f2,null));};exports[_0x14c5('0x9b')]=function(_0x58f0ce,_0x30e1f0,_0x12c886){var _0x5494c8=_0x58f0ce[_0x14c5('0x66')][_0x14c5('0x9c')];return db[_0x14c5('0x46')][_0x14c5('0x40')]({'where':{'id':_0x58f0ce[_0x14c5('0x68')]['id']},'attributes':['id','name',_0x14c5('0x41'),'online',_0x14c5('0x9d'),'voicePause','interface']})[_0x14c5('0x21')](handleEntityNotFound(_0x30e1f0,null))[_0x14c5('0x21')](function(_0x5f3a58){if(_0x5f3a58){if(!utils[_0x14c5('0x9e')](_0x5494c8)){throw new db[(_0x14c5('0x1f'))]['ValidationError'](_0x14c5('0x9f'));}return _0x5f3a58[_0x14c5('0xa0')+_[_0x14c5('0xa1')](_0x5494c8[_0x14c5('0xa2')]())+_0x14c5('0xa3')](_0x58f0ce['body'][_0x14c5('0x69')],{'penalty':_0x58f0ce['body'][_0x14c5('0xa4')]||0x0})[_0x14c5('0xa5')](function(_0x5ad7a3){for(var _0x2558ff=0x0;_0x2558ff<_0x58f0ce[_0x14c5('0x66')][_0x14c5('0x69')][_0x14c5('0x54')];_0x2558ff+=0x1){var _0x122dac={'UserId':_0x58f0ce['params']['id']};_0x122dac[_['capitalize'](_0x5494c8[_0x14c5('0xa2')]())+_0x14c5('0xa6')]=_0x58f0ce['body'][_0x14c5('0x69')][_0x2558ff];socket['emit'](_0x14c5('0x38')+_[_0x14c5('0xa1')](_0x5494c8[_0x14c5('0xa2')]())+_0x14c5('0xa7'),_0x122dac);}return _0x5ad7a3;})[_0x14c5('0x21')](function(){if(_0x5494c8===_0x14c5('0xa8')){return db[_0x14c5('0xa9')][_0x14c5('0xaa')]({'where':{'id':_0x58f0ce[_0x14c5('0x66')][_0x14c5('0x69')]||[]},'raw':!![],'attributes':['id',_0x14c5('0x42')]});}})[_0x14c5('0x21')](function(_0x2d862b){var _0x23f612=_0x5f3a58[_0x14c5('0x36')]({'plain':!![]});var _0x593e72=[];if(_0x5494c8===_0x14c5('0xa8')&&_0x23f612['role']===_0x14c5('0x3a')&&_0x23f612[_0x14c5('0xab')]){for(var _0x5ecae3=0x0;_0x5ecae3<_0x2d862b[_0x14c5('0x54')];_0x5ecae3+=0x1){_0x593e72[_0x14c5('0xac')]({'membername':_0x23f612[_0x14c5('0x42')],'UserId':_0x23f612['id'],'queue_name':_0x2d862b[_0x5ecae3][_0x14c5('0x42')],'VoiceQueueId':_0x2d862b[_0x5ecae3]['id'],'interface':_['isNil'](_0x23f612[_0x14c5('0xad')])?util[_0x14c5('0x70')](_0x14c5('0xae'),_0x23f612[_0x14c5('0x42')]):_0x23f612[_0x14c5('0xad')],'paused':_0x23f612[_0x14c5('0xaf')]||![],'penalty':_0x58f0ce[_0x14c5('0x66')]['penalty']||0x0});}return BPromise[_0x14c5('0xb0')](_0x593e72,function(_0x1bd46d){return db[_0x14c5('0xb1')][_0x14c5('0xb2')](_0x1bd46d);});}return _0x5f3a58;});}})[_0x14c5('0x21')](respondWithStatusCode(_0x30e1f0,null))[_0x14c5('0x62')](handleError(_0x30e1f0,null));};exports[_0x14c5('0xb3')]=function(_0xc503de,_0x4d4cf8,_0x144cb3){var _0x3fb32a;return db[_0x14c5('0x46')]['find']({'where':{'id':_0xc503de[_0x14c5('0x68')]['id']},'attributes':['id',_0x14c5('0x42'),_0x14c5('0x41')]})[_0x14c5('0x21')](handleEntityNotFound(_0x4d4cf8,null))[_0x14c5('0x21')](function(_0x586dfe){if(_0x586dfe){_0x3fb32a=_0x586dfe;if(!_0xc503de['query'][_0x14c5('0x9c')]||!utils['isValidChannel'](_0xc503de['query'][_0x14c5('0x9c')])){throw new db[(_0x14c5('0x1f'))][(_0x14c5('0x97'))](_0x14c5('0x9f'));}return _0x586dfe['remove'+_['capitalize'](_0xc503de[_0x14c5('0x4e')][_0x14c5('0x9c')][_0x14c5('0xa2')]())+'Queues'](_0xc503de[_0x14c5('0x4e')][_0x14c5('0x69')]);}})[_0x14c5('0x21')](function(_0x3edd41){for(var _0x42940a=0x0;_0x42940a<_0xc503de[_0x14c5('0x4e')][_0x14c5('0x69')][_0x14c5('0x54')];_0x42940a+=0x1){var _0x12b2d6={'UserId':_0xc503de[_0x14c5('0x68')]['id']};_0x12b2d6[_[_0x14c5('0xa1')](_0xc503de[_0x14c5('0x4e')][_0x14c5('0x9c')][_0x14c5('0xa2')]())+'QueueId']=_0xc503de[_0x14c5('0x4e')][_0x14c5('0x69')][_0x42940a];socket[_0x14c5('0xb4')]('user'+_['capitalize'](_0xc503de[_0x14c5('0x4e')][_0x14c5('0x9c')]['toLowerCase']())+'Queue:remove',_0x12b2d6);}return _0x3edd41;})[_0x14c5('0x21')](function(){if(_0xc503de[_0x14c5('0x4e')][_0x14c5('0x9c')]===_0x14c5('0xa8')){return db['UserVoiceQueueRt'][_0x14c5('0x35')]({'where':{'UserId':_0xc503de['params']['id'],'VoiceQueueId':_0xc503de[_0x14c5('0x4e')][_0x14c5('0x69')]},'individualHooks':!![]})[_0x14c5('0x21')](function(){return _0x3fb32a;});}return _0x3fb32a;})[_0x14c5('0x21')](respondWithStatusCode(_0x4d4cf8,null))[_0x14c5('0x62')](handleError(_0x4d4cf8,null));};exports[_0x14c5('0xb5')]=function(_0x1ee7ce,_0x2705b3,_0x4b4095){_0x1ee7ce[_0x14c5('0x66')][_0x14c5('0xb6')]=_0x1ee7ce['file'][_0x14c5('0xb7')];return db[_0x14c5('0x46')][_0x14c5('0x40')]({'where':{'id':_0x1ee7ce[_0x14c5('0x68')]['id']}})[_0x14c5('0x21')](handleEntityNotFound(_0x2705b3,null))[_0x14c5('0x21')](saveUpdates(_0x1ee7ce[_0x14c5('0x66')],null))[_0x14c5('0x21')](respondWithResult(_0x2705b3,null))[_0x14c5('0x62')](handleError(_0x2705b3,null));};exports[_0x14c5('0xb8')]=function(_0x39cad0,_0xd9727b,_0x51c0c5){var _0x2582fb=path[_0x14c5('0xb9')](config['root'],_0x14c5('0xba'));return db[_0x14c5('0x46')][_0x14c5('0x40')]({'where':{'id':_0x39cad0['params']['id']},'attributes':['id','userpic'],'raw':!![]})[_0x14c5('0x21')](handleEntityNotFound(_0xd9727b,null))['then'](function(_0x3c3248){if(_0x3c3248){if(_[_0x14c5('0x6e')](_0x3c3248['userpic'])){return _0xd9727b[_0x14c5('0xbb')](_0x2582fb);}else{if(!fs[_0x14c5('0xbc')](path[_0x14c5('0xb9')](config[_0x14c5('0xbd')],_0x14c5('0xbe'),_0x3c3248[_0x14c5('0xb6')]))){return _0xd9727b[_0x14c5('0xbb')](_0x2582fb);}return _0xd9727b['download'](path[_0x14c5('0xb9')](config['root'],'server/files/images/',_0x3c3248[_0x14c5('0xb6')]));}}})[_0x14c5('0x62')](handleError(_0xd9727b,null));};exports['getContacts']=function(_0x5c6ee6,_0x252848,_0x30a828){var _0x227668={};var _0x27f49a={};var _0x194b58;var _0x5e1ecc;return db['User'][_0x14c5('0xbf')]({'where':{'id':_0x5c6ee6[_0x14c5('0x68')]['id']}})[_0x14c5('0x21')](handleEntityNotFound(_0x252848,null))[_0x14c5('0x21')](function(_0x5ba9f8){if(_0x5ba9f8){_0x194b58=_0x5ba9f8;_0x27f49a[_0x14c5('0x4a')]=_[_0x14c5('0x4f')](db[_0x14c5('0xc0')][_0x14c5('0x47')]);_0x27f49a[_0x14c5('0x4e')]=_['keys'](_0x5c6ee6[_0x14c5('0x4e')]);_0x27f49a[_0x14c5('0x50')]=_[_0x14c5('0x51')](_0x27f49a[_0x14c5('0x4a')],_0x27f49a['query']);_0x227668[_0x14c5('0x52')]=_[_0x14c5('0x51')](_0x27f49a['model'],qs[_0x14c5('0x53')](_0x5c6ee6[_0x14c5('0x4e')][_0x14c5('0x53')]));_0x227668[_0x14c5('0x52')]=_0x227668[_0x14c5('0x52')][_0x14c5('0x54')]?_0x227668['attributes']:_0x27f49a[_0x14c5('0x4a')];_0x227668['order']=qs[_0x14c5('0x57')](_0x5c6ee6[_0x14c5('0x4e')][_0x14c5('0x57')]);_0x227668[_0x14c5('0x58')]=qs[_0x14c5('0x50')](_[_0x14c5('0x59')](_0x5c6ee6[_0x14c5('0x4e')],_0x27f49a[_0x14c5('0x50')]));if(_0x5c6ee6[_0x14c5('0x4e')][_0x14c5('0x3d')]){_0x227668[_0x14c5('0x58')]=_[_0x14c5('0x5a')](_0x227668[_0x14c5('0x58')],{'$or':_[_0x14c5('0x3e')](_0x227668[_0x14c5('0x52')],function(_0xf8723b){var _0x593c72={};_0x593c72[_0xf8723b]={'$like':'%'+_0x5c6ee6[_0x14c5('0x4e')][_0x14c5('0x3d')]+'%'};return _0x593c72;})});}_0x227668=_[_0x14c5('0x5a')]({},_0x227668,_0x5c6ee6[_0x14c5('0x5e')]);return _0x194b58[_0x14c5('0xc1')](_0x227668);}})[_0x14c5('0x21')](function(_0x4eb91d){if(_0x4eb91d){_0x5e1ecc=_0x4eb91d[_0x14c5('0x54')];if(_0x5c6ee6[_0x14c5('0x4e')][_0x14c5('0xc2')](_0x14c5('0x60'))){_0x227668[_0x14c5('0x64')]=[{'model':db[_0x14c5('0xc3')],'as':'List','required':![]},{'model':db[_0x14c5('0xc4')],'as':'Tags','attributes':['id',_0x14c5('0x42'),_0x14c5('0xc5')],'where':_0x5c6ee6[_0x14c5('0x4e')][_0x14c5('0xc6')]?{'id':_0x5c6ee6['query'][_0x14c5('0xc6')]}:undefined,'required':_0x5c6ee6[_0x14c5('0x4e')][_0x14c5('0xc6')]?!![]:![]}];}if(!_0x5c6ee6[_0x14c5('0x4e')][_0x14c5('0xc2')](_0x14c5('0x55'))){_0x227668[_0x14c5('0x2f')]=qs[_0x14c5('0x2f')](_0x5c6ee6[_0x14c5('0x4e')]['limit']);_0x227668['offset']=qs[_0x14c5('0x2e')](_0x5c6ee6['query'][_0x14c5('0x2e')]);}return _0x194b58['getContacts'](_0x227668);}})['then'](function(_0x3e05e6){if(_0x3e05e6){return _0x3e05e6?{'count':_0x5e1ecc,'rows':_0x3e05e6}:null;}})[_0x14c5('0x21')](respondWithResult(_0x252848,null))[_0x14c5('0x62')](handleError(_0x252848,null));};exports[_0x14c5('0xc7')]=function(_0x229941,_0x341118,_0x1ea6c1){var _0x4e9394;var _0x1de06b;var _0x3ba5c0={};var _0x22356e;return db[_0x14c5('0x46')][_0x14c5('0xbf')]({'where':{'id':_0x229941[_0x14c5('0x68')]['id']},'attributes':['id',_0x14c5('0x42'),'role']})[_0x14c5('0x21')](handleEntityNotFound(_0x341118,null))[_0x14c5('0x21')](function(_0x234e2c){if(!utils['isValidChannel'](_0x229941[_0x14c5('0x4e')]['channel'])){throw new db[(_0x14c5('0x1f'))][(_0x14c5('0x97'))](_0x14c5('0x9f'));}_0x4e9394=_0x234e2c;var _0x521b29={};_0x521b29[_0x14c5('0x4a')]=_[_0x14c5('0x4f')](db[_[_0x14c5('0xa1')](_0x229941[_0x14c5('0x4e')][_0x14c5('0x9c')])+_0x14c5('0xc8')][_0x14c5('0x47')]);_0x521b29[_0x14c5('0x4e')]=_[_0x14c5('0x4f')](_0x229941[_0x14c5('0x4e')]);_0x521b29['filters']=_['intersection'](_0x521b29[_0x14c5('0x4a')],_0x521b29[_0x14c5('0x4e')]);_0x3ba5c0['attributes']=_[_0x14c5('0x51')](_0x521b29[_0x14c5('0x4a')],qs[_0x14c5('0x53')](_0x229941[_0x14c5('0x4e')][_0x14c5('0x53')]));_0x3ba5c0[_0x14c5('0x52')]=_0x3ba5c0[_0x14c5('0x52')]['length']?_0x3ba5c0[_0x14c5('0x52')]:_0x521b29['model'];_0x3ba5c0['order']=qs[_0x14c5('0x57')](_0x229941[_0x14c5('0x4e')][_0x14c5('0x57')]);_0x3ba5c0['where']=qs[_0x14c5('0x50')](_[_0x14c5('0x59')](_0x229941[_0x14c5('0x4e')],_0x521b29[_0x14c5('0x50')]));if(_0x229941[_0x14c5('0x4e')][_0x14c5('0x3d')]){_0x3ba5c0[_0x14c5('0x58')]=_['merge'](_0x3ba5c0[_0x14c5('0x58')],{'$or':_[_0x14c5('0x3e')](_0x3ba5c0[_0x14c5('0x52')],function(_0x5ca5aa){var _0x6331db={};_0x6331db[_0x5ca5aa]={'$like':'%'+_0x229941[_0x14c5('0x4e')]['filter']+'%'};return _0x6331db;})});}_0x3ba5c0=_[_0x14c5('0x5a')]({},_0x3ba5c0,_0x229941[_0x14c5('0x5e')]);switch(_0x4e9394[_0x14c5('0x41')]){case _0x14c5('0x6a'):return db[_[_0x14c5('0xa1')](_0x229941[_0x14c5('0x4e')][_0x14c5('0x9c')])+_0x14c5('0xc8')]['findAll'](_0x3ba5c0);case _0x14c5('0x38'):case _0x14c5('0x3a'):return _0x4e9394['get'+_[_0x14c5('0xa1')](_0x229941['query'][_0x14c5('0x9c')])+_0x14c5('0xa3')](_0x3ba5c0);default:throw new db[(_0x14c5('0x1f'))][(_0x14c5('0x97'))](_0x14c5('0xc9'));}})['then'](function(_0x589e46){_0x22356e=_0x589e46[_0x14c5('0x54')];if(!_0x229941[_0x14c5('0x4e')][_0x14c5('0xc2')](_0x14c5('0x55'))){_0x3ba5c0[_0x14c5('0x2f')]=qs[_0x14c5('0x2f')](_0x229941[_0x14c5('0x4e')][_0x14c5('0x2f')]);_0x3ba5c0[_0x14c5('0x2e')]=qs[_0x14c5('0x2e')](_0x229941[_0x14c5('0x4e')][_0x14c5('0x2e')]);}switch(_0x4e9394[_0x14c5('0x41')]){case'admin':return db[_[_0x14c5('0xa1')](_0x229941[_0x14c5('0x4e')][_0x14c5('0x9c')])+_0x14c5('0xc8')]['findAll'](_0x3ba5c0);case _0x14c5('0x38'):case'agent':return _0x4e9394[_0x14c5('0x36')+_[_0x14c5('0xa1')](_0x229941[_0x14c5('0x4e')][_0x14c5('0x9c')])+_0x14c5('0xa3')](_0x3ba5c0);}})[_0x14c5('0x21')](function(_0x1ffffe){return{'count':_0x22356e,'rows':_0x1ffffe};})[_0x14c5('0x21')](respondWithResult(_0x341118,null))[_0x14c5('0x62')](handleError(_0x341118,null));};exports[_0x14c5('0xca')]=function(_0x32bb48,_0x2722ed,_0x566ac3){var _0xba9ba3={};var _0x25e0b5={};var _0x3e8fbd;var _0x14b985;return db[_0x14c5('0x46')][_0x14c5('0xbf')]({'where':{'id':_0x32bb48[_0x14c5('0x68')]['id']}})[_0x14c5('0x21')](handleEntityNotFound(_0x2722ed,null))['then'](function(_0x3e9bb7){if(_0x3e9bb7){_0x3e8fbd=_0x3e9bb7;_0x25e0b5[_0x14c5('0x4a')]=_['keys'](db['UserVoiceQueueRt'][_0x14c5('0x47')]);_0x25e0b5[_0x14c5('0x4e')]=_['keys'](_0x32bb48[_0x14c5('0x4e')]);_0x25e0b5[_0x14c5('0x50')]=_['intersection'](_0x25e0b5[_0x14c5('0x4a')],_0x25e0b5['query']);_0xba9ba3[_0x14c5('0x52')]=_[_0x14c5('0x51')](_0x25e0b5[_0x14c5('0x4a')],qs[_0x14c5('0x53')](_0x32bb48[_0x14c5('0x4e')][_0x14c5('0x53')]));_0xba9ba3[_0x14c5('0x52')]=_0xba9ba3[_0x14c5('0x52')]['length']?_0xba9ba3[_0x14c5('0x52')]:_0x25e0b5[_0x14c5('0x4a')];_0xba9ba3[_0x14c5('0x56')]=qs['sort'](_0x32bb48[_0x14c5('0x4e')][_0x14c5('0x57')]);_0xba9ba3[_0x14c5('0x58')]=qs[_0x14c5('0x50')](_[_0x14c5('0x59')](_0x32bb48['query'],_0x25e0b5[_0x14c5('0x50')]));if(_0x32bb48['query']['filter']){_0xba9ba3['where']=_[_0x14c5('0x5a')](_0xba9ba3[_0x14c5('0x58')],{'$or':_['map'](_0xba9ba3[_0x14c5('0x52')],function(_0x4c6081){var _0x522205={};_0x522205[_0x4c6081]={'$like':'%'+_0x32bb48[_0x14c5('0x4e')][_0x14c5('0x3d')]+'%'};return _0x522205;})});}_0xba9ba3=_[_0x14c5('0x5a')]({},_0xba9ba3,_0x32bb48[_0x14c5('0x5e')]);return _0x3e8fbd[_0x14c5('0xca')](_0xba9ba3);}})[_0x14c5('0x21')](function(_0x28eba1){if(_0x28eba1){_0x14b985=_0x28eba1[_0x14c5('0x54')];if(!_0x32bb48[_0x14c5('0x4e')]['hasOwnProperty']('nolimit')){_0xba9ba3[_0x14c5('0x2f')]=qs[_0x14c5('0x2f')](_0x32bb48[_0x14c5('0x4e')][_0x14c5('0x2f')]);_0xba9ba3[_0x14c5('0x2e')]=qs[_0x14c5('0x2e')](_0x32bb48[_0x14c5('0x4e')][_0x14c5('0x2e')]);}return _0x3e8fbd[_0x14c5('0xca')](_0xba9ba3);}})[_0x14c5('0x21')](function(_0x4e0893){if(_0x4e0893){return _0x4e0893?{'count':_0x14b985,'rows':_0x4e0893}:null;}})['then'](respondWithResult(_0x2722ed,null))[_0x14c5('0x62')](handleError(_0x2722ed,null));};exports[_0x14c5('0xcb')]=function(_0x2bfc9b,_0x4f3476,_0x5ce6c7){var _0x1a757c={};var _0x3bb9a5={};var _0x3bea98;var _0x213c3d;return db['User'][_0x14c5('0xbf')]({'where':{'id':_0x2bfc9b['params']['id']}})[_0x14c5('0x21')](handleEntityNotFound(_0x4f3476,null))[_0x14c5('0x21')](function(_0x3dacbd){if(_0x3dacbd){_0x3bea98=_0x3dacbd;_0x3bb9a5[_0x14c5('0x4a')]=_['keys'](db['ChatGroup'][_0x14c5('0x47')]);_0x3bb9a5[_0x14c5('0x4e')]=_[_0x14c5('0x4f')](_0x2bfc9b[_0x14c5('0x4e')]);_0x3bb9a5[_0x14c5('0x50')]=_[_0x14c5('0x51')](_0x3bb9a5[_0x14c5('0x4a')],_0x3bb9a5[_0x14c5('0x4e')]);_0x1a757c[_0x14c5('0x52')]=_['intersection'](_0x3bb9a5['model'],qs[_0x14c5('0x53')](_0x2bfc9b[_0x14c5('0x4e')][_0x14c5('0x53')]));_0x1a757c[_0x14c5('0x52')]=_0x1a757c['attributes'][_0x14c5('0x54')]?_0x1a757c[_0x14c5('0x52')]:_0x3bb9a5[_0x14c5('0x4a')];_0x1a757c[_0x14c5('0x56')]=qs['sort'](_0x2bfc9b['query'][_0x14c5('0x57')]);_0x1a757c[_0x14c5('0x58')]=qs[_0x14c5('0x50')](_[_0x14c5('0x59')](_0x2bfc9b[_0x14c5('0x4e')],_0x3bb9a5[_0x14c5('0x50')]));if(_0x2bfc9b['query'][_0x14c5('0x3d')]){_0x1a757c[_0x14c5('0x58')]=_[_0x14c5('0x5a')](_0x1a757c['where'],{'$or':_[_0x14c5('0x3e')](_0x1a757c['attributes'],function(_0x2f49b4){var _0x33d396={};_0x33d396[_0x2f49b4]={'$like':'%'+_0x2bfc9b[_0x14c5('0x4e')]['filter']+'%'};return _0x33d396;})});}_0x1a757c=_[_0x14c5('0x5a')]({},_0x1a757c,_0x2bfc9b[_0x14c5('0x5e')]);return _0x3bea98['getGroups'](_0x1a757c);}})[_0x14c5('0x21')](function(_0x1b228c){if(_0x1b228c){_0x213c3d=_0x1b228c[_0x14c5('0x54')];if(!_0x2bfc9b[_0x14c5('0x4e')][_0x14c5('0xc2')](_0x14c5('0x55'))){_0x1a757c['limit']=qs[_0x14c5('0x2f')](_0x2bfc9b[_0x14c5('0x4e')][_0x14c5('0x2f')]);_0x1a757c['offset']=qs[_0x14c5('0x2e')](_0x2bfc9b[_0x14c5('0x4e')][_0x14c5('0x2e')]);}return _0x3bea98['getGroups'](_0x1a757c);}})[_0x14c5('0x21')](function(_0x2543d3){if(_0x2543d3){return _0x2543d3?{'count':_0x213c3d,'rows':_0x2543d3}:null;}})[_0x14c5('0x21')](respondWithResult(_0x4f3476,null))[_0x14c5('0x62')](handleError(_0x4f3476,null));};exports[_0x14c5('0xcc')]=function(_0x50394e,_0x5d501c,_0x2c042d){var _0x4ff33c={'raw':!![],'where':{}};var _0x3b3909={};var _0x1cd4ff={'count':0x0,'rows':[]};return db[_0x14c5('0x46')][_0x14c5('0xbf')]({'where':{'id':_0x50394e[_0x14c5('0x68')]['id']}})[_0x14c5('0x21')](handleEntityNotFound(_0x5d501c,null))[_0x14c5('0x21')](function(_0x551589){if(_0x551589){_0x3b3909['model']=_[_0x14c5('0x4f')](db[_0x14c5('0xcd')]['rawAttributes']);_0x3b3909['query']=_[_0x14c5('0x4f')](_0x50394e[_0x14c5('0x4e')]);_0x3b3909[_0x14c5('0x50')]=_[_0x14c5('0x51')](_0x3b3909[_0x14c5('0x4a')],_0x3b3909[_0x14c5('0x4e')]);_0x4ff33c[_0x14c5('0x52')]=_[_0x14c5('0x51')](_0x3b3909[_0x14c5('0x4a')],qs[_0x14c5('0x53')](_0x50394e['query'][_0x14c5('0x53')]));_0x4ff33c['attributes']=_0x4ff33c['attributes'][_0x14c5('0x54')]?_0x4ff33c['attributes']:_0x3b3909[_0x14c5('0x4a')];if(!_0x50394e[_0x14c5('0x4e')][_0x14c5('0xc2')](_0x14c5('0x55'))){_0x4ff33c[_0x14c5('0x2f')]=qs[_0x14c5('0x2f')](_0x50394e[_0x14c5('0x4e')]['limit']);_0x4ff33c[_0x14c5('0x2e')]=qs[_0x14c5('0x2e')](_0x50394e[_0x14c5('0x4e')][_0x14c5('0x2e')]);}_0x4ff33c[_0x14c5('0x56')]=qs[_0x14c5('0x57')](_0x50394e[_0x14c5('0x4e')]['sort']);_0x4ff33c[_0x14c5('0x58')]=qs[_0x14c5('0x50')](_[_0x14c5('0x59')](_0x50394e[_0x14c5('0x4e')],_0x3b3909[_0x14c5('0x50')]));_0x4ff33c['where'][_0x14c5('0xce')]=_0x551589['id'];if(_0x50394e['query'][_0x14c5('0x3d')]){_0x4ff33c[_0x14c5('0x58')]=_['merge'](_0x4ff33c[_0x14c5('0x58')],{'$or':_['map'](_0x4ff33c[_0x14c5('0x52')],function(_0x312a01){var _0xf78dfb={};_0xf78dfb[_0x312a01]={'$like':'%'+_0x50394e[_0x14c5('0x4e')][_0x14c5('0x3d')]+'%'};return _0xf78dfb;})});}_0x4ff33c=_[_0x14c5('0x5a')]({},_0x4ff33c,_0x50394e[_0x14c5('0x5e')]);return db['VoiceRecording'][_0x14c5('0x5f')]({'where':_0x4ff33c[_0x14c5('0x58')]})[_0x14c5('0x21')](function(_0x55062e){_0x1cd4ff[_0x14c5('0x5f')]=_0x55062e;if(_0x50394e[_0x14c5('0x4e')]['includeAll']){_0x4ff33c[_0x14c5('0x64')]=[{'all':!![]}];}return db[_0x14c5('0xcd')][_0x14c5('0xaa')](_0x4ff33c);})[_0x14c5('0x21')](function(_0x254608){_0x1cd4ff[_0x14c5('0x61')]=_0x254608;return _0x1cd4ff;});}})[_0x14c5('0x21')](respondWithFilteredResult(_0x5d501c,_0x4ff33c))[_0x14c5('0x62')](handleError(_0x5d501c,null));};exports[_0x14c5('0xcf')]=function(_0x94010a,_0x2a4446,_0x46ba38){var _0x406a7b={'raw':!![],'where':{}};var _0x10c897={};var _0x23d16a={'count':0x0,'rows':[]};return db['User'][_0x14c5('0xbf')]({'where':{'id':_0x94010a[_0x14c5('0x68')]['id']}})['then'](handleEntityNotFound(_0x2a4446,null))['then'](function(_0x28f9ac){if(_0x28f9ac){_0x10c897['model']=_[_0x14c5('0x4f')](db[_0x14c5('0xd0')][_0x14c5('0x47')]);_0x10c897[_0x14c5('0x4e')]=_[_0x14c5('0x4f')](_0x94010a[_0x14c5('0x4e')]);_0x10c897[_0x14c5('0x50')]=_[_0x14c5('0x51')](_0x10c897[_0x14c5('0x4a')],_0x10c897[_0x14c5('0x4e')]);_0x406a7b['attributes']=_[_0x14c5('0x51')](_0x10c897[_0x14c5('0x4a')],qs[_0x14c5('0x53')](_0x94010a[_0x14c5('0x4e')][_0x14c5('0x53')]));_0x406a7b[_0x14c5('0x52')]=_0x406a7b[_0x14c5('0x52')]['length']?_0x406a7b[_0x14c5('0x52')]:_0x10c897[_0x14c5('0x4a')];if(!_0x94010a[_0x14c5('0x4e')][_0x14c5('0xc2')](_0x14c5('0x55'))){_0x406a7b['limit']=qs[_0x14c5('0x2f')](_0x94010a[_0x14c5('0x4e')][_0x14c5('0x2f')]);_0x406a7b[_0x14c5('0x2e')]=qs['offset'](_0x94010a[_0x14c5('0x4e')]['offset']);}_0x406a7b[_0x14c5('0x56')]=qs[_0x14c5('0x57')](_0x94010a['query'][_0x14c5('0x57')]);_0x406a7b['where']=qs[_0x14c5('0x50')](_[_0x14c5('0x59')](_0x94010a[_0x14c5('0x4e')],_0x10c897[_0x14c5('0x50')]));_0x406a7b[_0x14c5('0x58')][_0x14c5('0xce')]=_0x28f9ac['id'];if(_0x94010a[_0x14c5('0x4e')][_0x14c5('0x3d')]){_0x406a7b[_0x14c5('0x58')]=_[_0x14c5('0x5a')](_0x406a7b[_0x14c5('0x58')],{'$or':_['map'](_0x406a7b[_0x14c5('0x52')],function(_0x1403c9){var _0x2f3d27={};_0x2f3d27[_0x1403c9]={'$like':'%'+_0x94010a['query'][_0x14c5('0x3d')]+'%'};return _0x2f3d27;})});}_0x406a7b=_[_0x14c5('0x5a')]({},_0x406a7b,_0x94010a[_0x14c5('0x5e')]);return db[_0x14c5('0xd0')][_0x14c5('0x5f')]({'where':_0x406a7b[_0x14c5('0x58')]})['then'](function(_0x2d2006){_0x23d16a[_0x14c5('0x5f')]=_0x2d2006;if(_0x94010a[_0x14c5('0x4e')]['includeAll']){_0x406a7b['include']=[{'all':!![]}];}return db[_0x14c5('0xd0')]['findAll'](_0x406a7b);})[_0x14c5('0x21')](function(_0x3bb346){_0x23d16a[_0x14c5('0x61')]=_0x3bb346;return _0x23d16a;});}})[_0x14c5('0x21')](respondWithFilteredResult(_0x2a4446,_0x406a7b))[_0x14c5('0x62')](handleError(_0x2a4446,null));};exports[_0x14c5('0xd1')]=function(_0x169722,_0x9ec05a,_0x19b894){var _0x2b5ddb={};var _0x2c7da6={};var _0x3d61d7;var _0x575dd1;return db[_0x14c5('0x46')][_0x14c5('0xbf')]({'where':{'id':_0x169722[_0x14c5('0x68')]['id']}})['then'](handleEntityNotFound(_0x9ec05a,null))[_0x14c5('0x21')](function(_0x349998){if(_0x349998){_0x3d61d7=_0x349998;_0x2c7da6['model']=_[_0x14c5('0x4f')](db[_0x14c5('0xd2')][_0x14c5('0x47')]);_0x2c7da6['query']=_[_0x14c5('0x4f')](_0x169722[_0x14c5('0x4e')]);_0x2c7da6['filters']=_['intersection'](_0x2c7da6[_0x14c5('0x4a')],_0x2c7da6['query']);_0x2b5ddb[_0x14c5('0x52')]=_[_0x14c5('0x51')](_0x2c7da6[_0x14c5('0x4a')],qs['fields'](_0x169722['query']['fields']));_0x2b5ddb['attributes']=_0x2b5ddb[_0x14c5('0x52')]['length']?_0x2b5ddb[_0x14c5('0x52')]:_0x2c7da6[_0x14c5('0x4a')];_0x2b5ddb[_0x14c5('0x56')]=qs[_0x14c5('0x57')](_0x169722[_0x14c5('0x4e')][_0x14c5('0x57')]);_0x2b5ddb[_0x14c5('0x58')]=qs['filters'](_[_0x14c5('0x59')](_0x169722[_0x14c5('0x4e')],_0x2c7da6[_0x14c5('0x50')]));if(_0x169722[_0x14c5('0x4e')]['filter']){_0x2b5ddb[_0x14c5('0x58')]=_[_0x14c5('0x5a')](_0x2b5ddb[_0x14c5('0x58')],{'$or':_[_0x14c5('0x3e')](_0x2b5ddb[_0x14c5('0x52')],function(_0x1a7993){var _0x40cd28={};_0x40cd28[_0x1a7993]={'$like':'%'+_0x169722['query'][_0x14c5('0x3d')]+'%'};return _0x40cd28;})});}_0x2b5ddb=_[_0x14c5('0x5a')]({},_0x2b5ddb,_0x169722[_0x14c5('0x5e')]);return _0x3d61d7[_0x14c5('0xd1')](_0x2b5ddb);}})[_0x14c5('0x21')](function(_0x229260){if(_0x229260){_0x575dd1=_0x229260[_0x14c5('0x54')];if(!_0x169722[_0x14c5('0x4e')][_0x14c5('0xc2')]('nolimit')){_0x2b5ddb['limit']=qs[_0x14c5('0x2f')](_0x169722[_0x14c5('0x4e')][_0x14c5('0x2f')]);_0x2b5ddb[_0x14c5('0x2e')]=qs[_0x14c5('0x2e')](_0x169722[_0x14c5('0x4e')]['offset']);}return _0x3d61d7['getChatInteractions'](_0x2b5ddb);}})[_0x14c5('0x21')](function(_0x42330b){if(_0x42330b){return _0x42330b?{'count':_0x575dd1,'rows':_0x42330b}:null;}})[_0x14c5('0x21')](respondWithResult(_0x9ec05a,null))[_0x14c5('0x62')](handleError(_0x9ec05a,null));};exports[_0x14c5('0xd3')]=function(_0x2013a8,_0xaeb3cd,_0x1cd8a9){var _0x483dcc={};var _0x5ee0f4={};var _0x2bc82d;var _0x4a9305;return db['User'][_0x14c5('0xbf')]({'where':{'id':_0x2013a8['params']['id']}})[_0x14c5('0x21')](handleEntityNotFound(_0xaeb3cd,null))[_0x14c5('0x21')](function(_0x16b5e2){if(_0x16b5e2){_0x2bc82d=_0x16b5e2;_0x5ee0f4[_0x14c5('0x4a')]=_[_0x14c5('0x4f')](db[_0x14c5('0xd4')][_0x14c5('0x47')]);_0x5ee0f4[_0x14c5('0x4e')]=_[_0x14c5('0x4f')](_0x2013a8[_0x14c5('0x4e')]);_0x5ee0f4[_0x14c5('0x50')]=_[_0x14c5('0x51')](_0x5ee0f4[_0x14c5('0x4a')],_0x5ee0f4[_0x14c5('0x4e')]);_0x483dcc[_0x14c5('0x52')]=_[_0x14c5('0x51')](_0x5ee0f4[_0x14c5('0x4a')],qs[_0x14c5('0x53')](_0x2013a8[_0x14c5('0x4e')][_0x14c5('0x53')]));_0x483dcc[_0x14c5('0x52')]=_0x483dcc[_0x14c5('0x52')]['length']?_0x483dcc[_0x14c5('0x52')]:_0x5ee0f4['model'];_0x483dcc[_0x14c5('0x56')]=qs[_0x14c5('0x57')](_0x2013a8[_0x14c5('0x4e')][_0x14c5('0x57')]);_0x483dcc[_0x14c5('0x58')]=qs[_0x14c5('0x50')](_['pick'](_0x2013a8[_0x14c5('0x4e')],_0x5ee0f4[_0x14c5('0x50')]));if(_0x2013a8[_0x14c5('0x4e')][_0x14c5('0x3d')]){_0x483dcc[_0x14c5('0x58')]=_[_0x14c5('0x5a')](_0x483dcc['where'],{'$or':_['map'](_0x483dcc[_0x14c5('0x52')],function(_0x731ede){var _0x444920={};_0x444920[_0x731ede]={'$like':'%'+_0x2013a8[_0x14c5('0x4e')][_0x14c5('0x3d')]+'%'};return _0x444920;})});}_0x483dcc=_[_0x14c5('0x5a')]({},_0x483dcc,_0x2013a8['options']);return _0x2bc82d['getOpenchannelInteractions'](_0x483dcc);}})[_0x14c5('0x21')](function(_0x1a0e27){if(_0x1a0e27){_0x4a9305=_0x1a0e27[_0x14c5('0x54')];if(!_0x2013a8[_0x14c5('0x4e')][_0x14c5('0xc2')](_0x14c5('0x55'))){_0x483dcc[_0x14c5('0x2f')]=qs[_0x14c5('0x2f')](_0x2013a8[_0x14c5('0x4e')]['limit']);_0x483dcc[_0x14c5('0x2e')]=qs[_0x14c5('0x2e')](_0x2013a8[_0x14c5('0x4e')]['offset']);}return _0x2bc82d[_0x14c5('0xd3')](_0x483dcc);}})[_0x14c5('0x21')](function(_0x2f11aa){if(_0x2f11aa){return _0x2f11aa?{'count':_0x4a9305,'rows':_0x2f11aa}:null;}})[_0x14c5('0x21')](respondWithResult(_0xaeb3cd,null))['catch'](handleError(_0xaeb3cd,null));};exports['getMailInteractions']=function(_0x1bbb85,_0x3695a7,_0x13b480){var _0x3eec28={'raw':!![],'where':{}};var _0x298b51={};var _0x2f4b94={'count':0x0,'rows':[]};return db['User'][_0x14c5('0xbf')]({'where':{'id':_0x1bbb85[_0x14c5('0x68')]['id']}})['then'](handleEntityNotFound(_0x3695a7,null))[_0x14c5('0x21')](function(_0x5b9f4e){if(_0x5b9f4e){_0x298b51[_0x14c5('0x4a')]=_[_0x14c5('0x4f')](db[_0x14c5('0xd5')][_0x14c5('0x47')]);_0x298b51[_0x14c5('0x4e')]=_[_0x14c5('0x4f')](_0x1bbb85['query']);_0x298b51[_0x14c5('0x50')]=_[_0x14c5('0x51')](_0x298b51['model'],_0x298b51[_0x14c5('0x4e')]);_0x3eec28['attributes']=_[_0x14c5('0x51')](_0x298b51[_0x14c5('0x4a')],qs['fields'](_0x1bbb85[_0x14c5('0x4e')]['fields']));_0x3eec28[_0x14c5('0x52')]=_0x3eec28[_0x14c5('0x52')]['length']?_0x3eec28[_0x14c5('0x52')]:_0x298b51['model'];if(!_0x1bbb85[_0x14c5('0x4e')][_0x14c5('0xc2')]('nolimit')){_0x3eec28['limit']=qs[_0x14c5('0x2f')](_0x1bbb85[_0x14c5('0x4e')][_0x14c5('0x2f')]);_0x3eec28[_0x14c5('0x2e')]=qs[_0x14c5('0x2e')](_0x1bbb85['query']['offset']);}_0x3eec28[_0x14c5('0x56')]=qs[_0x14c5('0x57')](_0x1bbb85[_0x14c5('0x4e')][_0x14c5('0x57')]);_0x3eec28['where']=qs['filters'](_['pick'](_0x1bbb85['query'],_0x298b51[_0x14c5('0x50')]));_0x3eec28[_0x14c5('0x58')]['UserId']=_0x5b9f4e['id'];if(_0x1bbb85[_0x14c5('0x4e')]['filter']){_0x3eec28[_0x14c5('0x58')]=_['merge'](_0x3eec28[_0x14c5('0x58')],{'$or':_['map'](_0x3eec28[_0x14c5('0x52')],function(_0x5666a1){var _0x51d74d={};_0x51d74d[_0x5666a1]={'$like':'%'+_0x1bbb85['query']['filter']+'%'};return _0x51d74d;})});}_0x3eec28=_[_0x14c5('0x5a')]({},_0x3eec28,_0x1bbb85[_0x14c5('0x5e')]);return db['MailInteraction'][_0x14c5('0x5f')]({'where':_0x3eec28[_0x14c5('0x58')]})[_0x14c5('0x21')](function(_0xaed518){_0x2f4b94[_0x14c5('0x5f')]=_0xaed518;if(_0x1bbb85['query'][_0x14c5('0x60')]){_0x3eec28[_0x14c5('0x64')]=[{'all':!![]}];}return db['MailInteraction'][_0x14c5('0xaa')](_0x3eec28);})[_0x14c5('0x21')](function(_0x57dc8c){_0x2f4b94[_0x14c5('0x61')]=_0x57dc8c;return _0x2f4b94;});}})[_0x14c5('0x21')](respondWithFilteredResult(_0x3695a7,_0x3eec28))[_0x14c5('0x62')](handleError(_0x3695a7,null));};exports[_0x14c5('0xd6')]=function(_0x5972a5,_0x9b652c,_0x143500){var _0x4a98ea={};var _0x5873dd={};var _0x507519;var _0x38d908;return db[_0x14c5('0x46')][_0x14c5('0xbf')]({'where':{'id':_0x5972a5[_0x14c5('0x68')]['id']}})['then'](handleEntityNotFound(_0x9b652c,null))[_0x14c5('0x21')](function(_0x43a7c0){if(_0x43a7c0){_0x507519=_0x43a7c0;_0x5873dd[_0x14c5('0x4a')]=_['keys'](db['SmsInteraction'][_0x14c5('0x47')]);_0x5873dd[_0x14c5('0x4e')]=_[_0x14c5('0x4f')](_0x5972a5[_0x14c5('0x4e')]);_0x5873dd['filters']=_['intersection'](_0x5873dd[_0x14c5('0x4a')],_0x5873dd[_0x14c5('0x4e')]);_0x4a98ea[_0x14c5('0x52')]=_['intersection'](_0x5873dd[_0x14c5('0x4a')],qs[_0x14c5('0x53')](_0x5972a5[_0x14c5('0x4e')]['fields']));_0x4a98ea[_0x14c5('0x52')]=_0x4a98ea[_0x14c5('0x52')][_0x14c5('0x54')]?_0x4a98ea['attributes']:_0x5873dd[_0x14c5('0x4a')];_0x4a98ea['order']=qs['sort'](_0x5972a5['query']['sort']);_0x4a98ea[_0x14c5('0x58')]=qs[_0x14c5('0x50')](_['pick'](_0x5972a5[_0x14c5('0x4e')],_0x5873dd['filters']));if(_0x5972a5[_0x14c5('0x4e')][_0x14c5('0x3d')]){_0x4a98ea['where']=_[_0x14c5('0x5a')](_0x4a98ea[_0x14c5('0x58')],{'$or':_[_0x14c5('0x3e')](_0x4a98ea[_0x14c5('0x52')],function(_0x44b641){var _0x4131d9={};_0x4131d9[_0x44b641]={'$like':'%'+_0x5972a5['query'][_0x14c5('0x3d')]+'%'};return _0x4131d9;})});}_0x4a98ea=_[_0x14c5('0x5a')]({},_0x4a98ea,_0x5972a5[_0x14c5('0x5e')]);return _0x507519[_0x14c5('0xd6')](_0x4a98ea);}})[_0x14c5('0x21')](function(_0x5dc39a){if(_0x5dc39a){_0x38d908=_0x5dc39a['length'];if(!_0x5972a5['query'][_0x14c5('0xc2')](_0x14c5('0x55'))){_0x4a98ea[_0x14c5('0x2f')]=qs['limit'](_0x5972a5[_0x14c5('0x4e')][_0x14c5('0x2f')]);_0x4a98ea[_0x14c5('0x2e')]=qs[_0x14c5('0x2e')](_0x5972a5[_0x14c5('0x4e')]['offset']);}return _0x507519[_0x14c5('0xd6')](_0x4a98ea);}})[_0x14c5('0x21')](function(_0x59c45a){if(_0x59c45a){return _0x59c45a?{'count':_0x38d908,'rows':_0x59c45a}:null;}})[_0x14c5('0x21')](respondWithResult(_0x9b652c,null))[_0x14c5('0x62')](handleError(_0x9b652c,null));};exports[_0x14c5('0xd7')]=function(_0x4b41bc,_0x4f9b81,_0x398407){var _0x12241c={};var _0x5f215e={};var _0x33ff83;var _0x174161;return db[_0x14c5('0x46')]['findOne']({'where':{'id':_0x4b41bc[_0x14c5('0x68')]['id']}})['then'](handleEntityNotFound(_0x4f9b81,null))[_0x14c5('0x21')](function(_0xeeddf3){if(_0xeeddf3){_0x33ff83=_0xeeddf3;_0x5f215e[_0x14c5('0x4a')]=_['keys'](db[_0x14c5('0xd8')][_0x14c5('0x47')]);_0x5f215e[_0x14c5('0x4e')]=_[_0x14c5('0x4f')](_0x4b41bc['query']);_0x5f215e[_0x14c5('0x50')]=_[_0x14c5('0x51')](_0x5f215e['model'],_0x5f215e[_0x14c5('0x4e')]);_0x12241c[_0x14c5('0x52')]=_[_0x14c5('0x51')](_0x5f215e[_0x14c5('0x4a')],qs[_0x14c5('0x53')](_0x4b41bc['query'][_0x14c5('0x53')]));_0x12241c[_0x14c5('0x52')]=_0x12241c[_0x14c5('0x52')][_0x14c5('0x54')]?_0x12241c[_0x14c5('0x52')]:_0x5f215e[_0x14c5('0x4a')];_0x12241c['order']=qs[_0x14c5('0x57')](_0x4b41bc[_0x14c5('0x4e')][_0x14c5('0x57')]);_0x12241c[_0x14c5('0x58')]=qs[_0x14c5('0x50')](_['pick'](_0x4b41bc[_0x14c5('0x4e')],_0x5f215e[_0x14c5('0x50')]));if(_0x4b41bc[_0x14c5('0x4e')][_0x14c5('0x3d')]){_0x12241c['where']=_[_0x14c5('0x5a')](_0x12241c['where'],{'$or':_[_0x14c5('0x3e')](_0x12241c[_0x14c5('0x52')],function(_0x486564){var _0x3dfce3={};_0x3dfce3[_0x486564]={'$like':'%'+_0x4b41bc['query'][_0x14c5('0x3d')]+'%'};return _0x3dfce3;})});}_0x12241c=_[_0x14c5('0x5a')]({},_0x12241c,_0x4b41bc[_0x14c5('0x5e')]);return _0x33ff83[_0x14c5('0xd7')](_0x12241c);}})[_0x14c5('0x21')](function(_0x2b7713){if(_0x2b7713){_0x174161=_0x2b7713[_0x14c5('0x54')];if(!_0x4b41bc[_0x14c5('0x4e')][_0x14c5('0xc2')]('nolimit')){_0x12241c[_0x14c5('0x2f')]=qs[_0x14c5('0x2f')](_0x4b41bc[_0x14c5('0x4e')][_0x14c5('0x2f')]);_0x12241c['offset']=qs[_0x14c5('0x2e')](_0x4b41bc['query'][_0x14c5('0x2e')]);}return _0x33ff83['getFaxInteractions'](_0x12241c);}})[_0x14c5('0x21')](function(_0x15eac1){if(_0x15eac1){return _0x15eac1?{'count':_0x174161,'rows':_0x15eac1}:null;}})['then'](respondWithResult(_0x4f9b81,null))['catch'](handleError(_0x4f9b81,null));};exports[_0x14c5('0xd9')]=function(_0x5b76c2,_0x23d17d,_0x2c4812){var _0x4ab1a3={};var _0x13b9df={};var _0x37d659;var _0x2b1f6a;return db[_0x14c5('0x46')][_0x14c5('0xbf')]({'where':{'id':_0x5b76c2['params']['id']}})[_0x14c5('0x21')](handleEntityNotFound(_0x23d17d,null))[_0x14c5('0x21')](function(_0x2e3746){if(_0x2e3746){_0x37d659=_0x2e3746;_0x13b9df['model']=_[_0x14c5('0x4f')](db[_0x14c5('0xda')][_0x14c5('0x47')]);_0x13b9df[_0x14c5('0x4e')]=_[_0x14c5('0x4f')](_0x5b76c2[_0x14c5('0x4e')]);_0x13b9df[_0x14c5('0x50')]=_[_0x14c5('0x51')](_0x13b9df[_0x14c5('0x4a')],_0x13b9df[_0x14c5('0x4e')]);_0x4ab1a3[_0x14c5('0x52')]=_[_0x14c5('0x51')](_0x13b9df['model'],qs[_0x14c5('0x53')](_0x5b76c2[_0x14c5('0x4e')][_0x14c5('0x53')]));_0x4ab1a3[_0x14c5('0x52')]=_0x4ab1a3[_0x14c5('0x52')][_0x14c5('0x54')]?_0x4ab1a3[_0x14c5('0x52')]:_0x13b9df['model'];_0x4ab1a3[_0x14c5('0x56')]=qs[_0x14c5('0x57')](_0x5b76c2[_0x14c5('0x4e')][_0x14c5('0x57')]);_0x4ab1a3[_0x14c5('0x58')]=qs[_0x14c5('0x50')](_[_0x14c5('0x59')](_0x5b76c2[_0x14c5('0x4e')],_0x13b9df[_0x14c5('0x50')]));if(_0x5b76c2[_0x14c5('0x4e')]['filter']){_0x4ab1a3[_0x14c5('0x58')]=_[_0x14c5('0x5a')](_0x4ab1a3[_0x14c5('0x58')],{'$or':_[_0x14c5('0x3e')](_0x4ab1a3['attributes'],function(_0x16d403){var _0x170561={};_0x170561[_0x16d403]={'$like':'%'+_0x5b76c2['query'][_0x14c5('0x3d')]+'%'};return _0x170561;})});}_0x4ab1a3=_['merge']({},_0x4ab1a3,_0x5b76c2[_0x14c5('0x5e')]);return _0x37d659['getWhatsappInteractions'](_0x4ab1a3);}})[_0x14c5('0x21')](function(_0x23b905){if(_0x23b905){_0x2b1f6a=_0x23b905[_0x14c5('0x54')];if(!_0x5b76c2[_0x14c5('0x4e')][_0x14c5('0xc2')](_0x14c5('0x55'))){_0x4ab1a3['limit']=qs[_0x14c5('0x2f')](_0x5b76c2[_0x14c5('0x4e')][_0x14c5('0x2f')]);_0x4ab1a3['offset']=qs[_0x14c5('0x2e')](_0x5b76c2['query']['offset']);}return _0x37d659['getWhatsappInteractions'](_0x4ab1a3);}})[_0x14c5('0x21')](function(_0x53ea87){if(_0x53ea87){return _0x53ea87?{'count':_0x2b1f6a,'rows':_0x53ea87}:null;}})['then'](respondWithResult(_0x23d17d,null))['catch'](handleError(_0x23d17d,null));};exports[_0x14c5('0xdb')]=function(_0x3ba33a,_0x55f278,_0x3eda96){var _0x5d6d81;var _0x4f7b35;var _0x47920b;var _0x2b25e0=!_['isNil'](_0x3ba33a[_0x14c5('0x68')]['id'])?_0x3ba33a[_0x14c5('0x68')]['id']:!_['isNil'](_0x3ba33a['user']['id'])?_0x3ba33a[_0x14c5('0x38')]['id']:null;return db['User'][_0x14c5('0x40')]({'where':{'id':_0x2b25e0,'role':{'$or':[_0x14c5('0x6a'),_0x14c5('0x38'),_0x14c5('0x3a')]}},'attributes':['id',_0x14c5('0x42'),_0x14c5('0xdc'),_0x14c5('0xdd'),_0x14c5('0x41'),_0x14c5('0x73'),'loginInPause']})[_0x14c5('0x21')](function(_0x598e20){if(_0x598e20){if(_0x598e20[_0x14c5('0x41')]===_0x14c5('0x3a')){_0x5d6d81=_0x598e20;if(_0x3ba33a[_0x14c5('0x66')][_0x14c5('0xad')]){_0x47920b=util['format'](_0x14c5('0xde'),_0x5d6d81[_0x3ba33a[_0x14c5('0x66')][_0x14c5('0xad')]]);}else if(_0x3ba33a[_0x14c5('0x66')]['intrf']){_0x47920b=util[_0x14c5('0x70')](_0x14c5('0xae'),_0x3ba33a[_0x14c5('0x66')][_0x14c5('0xdf')]);}else{_0x47920b=util[_0x14c5('0x70')]('SIP/%s',_0x5d6d81[_0x14c5('0x42')]);}socket['to'](util['format'](_0x14c5('0xe0'),_0x5d6d81['name']))[_0x14c5('0xb4')](_0x14c5('0xe1'),{'ip':_0x3ba33a[_0x14c5('0xe2')][_0x14c5('0xe3')]||_0x3ba33a['connection'][_0x14c5('0xe4')]||_0x3ba33a[_0x14c5('0xe5')][_0x14c5('0xe4')]||_0x3ba33a[_0x14c5('0xe6')][_0x14c5('0xe5')][_0x14c5('0xe4')]});return db[_0x14c5('0xb1')]['destroy']({'where':{'membername':_0x5d6d81[_0x14c5('0x42')]},'individualHooks':!![]});}}else{throw new db['Sequelize']['ValidationError'](_0x14c5('0xe7'));}})[_0x14c5('0x21')](function(){if(_0x5d6d81){return _0x5d6d81['getVoiceQueues']({'raw':!![]});}})[_0x14c5('0x21')](function(_0x2ec6e4){if(_0x5d6d81){var _0x2e075c=[];if(_0x2ec6e4){_0x4f7b35=_0x2ec6e4;if(_0x4f7b35[_0x14c5('0x54')]){for(var _0x5ec1bf=0x0;_0x5ec1bf<_0x4f7b35[_0x14c5('0x54')];_0x5ec1bf++){_0x2e075c[_0x14c5('0xac')]({'membername':_0x5d6d81[_0x14c5('0x42')],'UserId':_0x5d6d81['id'],'queue_name':_0x4f7b35[_0x5ec1bf][_0x14c5('0x42')],'VoiceQueueId':_0x4f7b35[_0x5ec1bf]['id'],'interface':_0x47920b,'paused':_0x5d6d81[_0x14c5('0x9d')]||![],'penalty':_0x4f7b35[_0x5ec1bf][_0x14c5('0xe8')]||0x0});}return BPromise[_0x14c5('0xb0')](_0x2e075c,function(_0x5bd3d7){return db['UserVoiceQueueRt'][_0x14c5('0xb2')](_0x5bd3d7);});}}}})[_0x14c5('0x21')](function(){if(_0x5d6d81){return db[_0x14c5('0xe9')][_0x14c5('0xaa')]({'where':{'membername':_0x5d6d81['name'],'exitAt':null}});}})[_0x14c5('0x21')](function(_0x299ef0){if(_0x5d6d81){var _0x1d3c13=[];_0x299ef0[_0x14c5('0xea')](function(_0x2dd558){_0x1d3c13[_0x14c5('0xac')](_0x2dd558[_0x14c5('0x34')]({'exitAt':moment()[_0x14c5('0x70')](_0x14c5('0xeb'))}));});return BPromise[_0x14c5('0xec')](_0x1d3c13);}})[_0x14c5('0x21')](function(){if(_0x5d6d81){var _0x512f6f=[];var _0x49184c=[];var _0x1d03a7=utils[_0x14c5('0xed')]();var _0x173603={'membername':_0x5d6d81[_0x14c5('0x42')],'interface':_0x47920b,'enterAt':moment()[_0x14c5('0x70')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x5d6d81[_0x14c5('0x41')],'internal':_0x5d6d81[_0x14c5('0x73')]};_0x1d03a7['forEach'](function(_0x36412c){_0x512f6f[_0x14c5('0xac')](_[_0x14c5('0x5a')]({'channel':_0x36412c,'type':_0x14c5('0xee'),'data1':_0x3ba33a[_0x14c5('0x66')][_0x14c5('0xef')],'data2':_0x47920b},_0x173603));if(_0x5d6d81[_0x14c5('0x9d')]){_0x49184c[_0x14c5('0xac')](_[_0x14c5('0x5a')]({'channel':_0x36412c,'type':_0x14c5('0xf0'),'data1':_0x14c5('0xf1')},_0x173603));}});return db[_0x14c5('0xe9')][_0x14c5('0x65')](_0x512f6f[_0x14c5('0xf2')](_0x49184c),{'individualHooks':!![]});}})[_0x14c5('0x21')](function(){if(_0x5d6d81){return _0x5d6d81[_0x14c5('0x34')]({'online':!![],'lastLoginAt':moment()['format'](_0x14c5('0xeb')),'voicePause':_0x5d6d81[_0x14c5('0x9d')]||![],'mailPause':_0x5d6d81[_0x14c5('0x9d')]||![],'chatPause':_0x5d6d81[_0x14c5('0x9d')]||![],'faxPause':_0x5d6d81[_0x14c5('0x9d')]||![],'smsPause':_0x5d6d81['loginInPause']||![],'openchannelPause':_0x5d6d81['loginInPause']||![],'whatsappPause':_0x5d6d81[_0x14c5('0x9d')]||![],'pauseType':_0x5d6d81[_0x14c5('0x9d')]?_0x14c5('0xf1'):null,'interface':_0x47920b,'lastPauseAt':moment()[_0x14c5('0x70')](_0x14c5('0xeb'))});}})['then'](function(_0x2d76da){if(_0x3ba33a[_0x14c5('0xf3')]){return _0x3eda96();}else{return BPromise[_0x14c5('0xf4')](_0x2d76da)[_0x14c5('0x21')](respondWithResult(_0x55f278,null));}})[_0x14c5('0x62')](handleError(_0x55f278,null));};exports[_0x14c5('0xf5')]=function(_0x2d5406,_0x1a58cf,_0x9ffc06){var _0x40fe3e;return db[_0x14c5('0x46')][_0x14c5('0x40')]({'where':{'id':_0x2d5406[_0x14c5('0x68')]['id'],'role':_0x14c5('0x3a')},'attributes':['id',_0x14c5('0x42'),_0x14c5('0x41')]})['then'](handleEntityNotFound(_0x1a58cf,null))[_0x14c5('0x21')](function(_0x4a33d8){if(_0x4a33d8){_0x40fe3e=_0x4a33d8;return db['UserVoiceQueueRt'][_0x14c5('0x35')]({'where':{'membername':_0x40fe3e[_0x14c5('0x42')]},'individualHooks':!![]});}})[_0x14c5('0x21')](function(){return db[_0x14c5('0xe9')][_0x14c5('0xaa')]({'where':{'membername':_0x40fe3e['name'],'exitAt':null}});})[_0x14c5('0x21')](function(_0x105f2b){var _0x1b429d=[];_0x105f2b[_0x14c5('0xea')](function(_0x1c07ca){_0x1b429d[_0x14c5('0xac')](_0x1c07ca[_0x14c5('0x34')]({'exitAt':moment()['format'](_0x14c5('0xeb'))}));});return BPromise['all'](_0x1b429d);})['then'](function(){return _0x40fe3e[_0x14c5('0x34')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x14c5('0x21')](respondWithResult(_0x1a58cf,null))['catch'](handleError(_0x1a58cf,null));};exports[_0x14c5('0xf6')]=function(_0x2ed9d5,_0x20b8ec,_0x3f5747){var _0x5369b0;return db[_0x14c5('0xb1')][_0x14c5('0x34')]({'paused':0x1},{'where':{'UserId':_0x2ed9d5[_0x14c5('0x68')]['id']},'individualHooks':!![]})[_0x14c5('0x21')](function(){return db['User']['find']({'where':{'id':_0x2ed9d5[_0x14c5('0x68')]['id'],'role':_0x14c5('0x3a')},'attributes':['id',_0x14c5('0x42'),_0x14c5('0x41'),_0x14c5('0x73'),_0x14c5('0xad')]});})[_0x14c5('0x21')](handleEntityNotFound(_0x20b8ec,null))['then'](function(_0x4a3f12){if(_0x4a3f12){_0x5369b0=_0x4a3f12;return respondWithRpcPromise('QueuePause',_0x14c5('0xf6'),{'id':_0x5369b0['id'],'name':_0x5369b0[_0x14c5('0x42')],'pause':!![]});}})['then'](function(){if(_0x5369b0){return db['MemberReport'][_0x14c5('0xaa')]({'where':{'membername':_0x5369b0['name'],'type':'PAUSE','exitAt':null}});}})[_0x14c5('0x21')](function(_0x2a7b2a){if(_0x2a7b2a[_0x14c5('0x54')]){var _0x2bb18d=moment()['format'](_0x14c5('0xeb'));for(var _0x468096=0x0,_0x4af525=_0x2a7b2a[_0x14c5('0x54')];_0x468096<_0x4af525;_0x468096++){_0x2a7b2a[_0x468096][_0x14c5('0xf7')]({'exitAt':_0x2bb18d});}}})['then'](function(){var _0x19f302=[];var _0x4c90e2=utils['getChannels']();_0x4c90e2[_0x14c5('0xea')](function(_0x273d06){_0x19f302[_0x14c5('0xac')]({'channel':_0x273d06,'membername':_0x5369b0[_0x14c5('0x42')],'interface':_[_0x14c5('0x6e')](_0x5369b0['interface'])?util[_0x14c5('0x70')]('SIP/%s',_0x5369b0[_0x14c5('0x42')]):_0x5369b0['interface'],'type':_0x14c5('0xf0'),'enterAt':moment()[_0x14c5('0x70')](_0x14c5('0xeb')),'data1':_0x2ed9d5[_0x14c5('0x66')][_0x14c5('0x49')]||_0x14c5('0xf8'),'role':_0x5369b0['role'],'internal':_0x5369b0[_0x14c5('0x73')]});});return db['MemberReport'][_0x14c5('0x65')](_0x19f302,{'individualHooks':!![]});})[_0x14c5('0x21')](function(){return _0x5369b0[_0x14c5('0x34')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x2ed9d5[_0x14c5('0x66')][_0x14c5('0x49')]||_0x14c5('0xf8'),'lastPauseAt':moment()['format'](_0x14c5('0xeb'))});})[_0x14c5('0x21')](respondWithResult(_0x20b8ec,null))['catch'](handleError(_0x20b8ec,null));};exports[_0x14c5('0xf9')]=function(_0x2ee74d,_0x37de64,_0x653c8d){var _0xec159;return db[_0x14c5('0x46')][_0x14c5('0x40')]({'where':{'id':_0x2ee74d[_0x14c5('0x68')]['id']},'attributes':['id',_0x14c5('0x42'),'role',_0x14c5('0xaf'),_0x14c5('0xfa'),_0x14c5('0xfb'),_0x14c5('0xfc'),_0x14c5('0xfd'),_0x14c5('0xfe'),'whatsapppause',_0x14c5('0xff'),_0x14c5('0x100')]})[_0x14c5('0x21')](handleEntityNotFound(_0x37de64,null))['then'](function(_0x4a8729){if(_0x4a8729){_0xec159=_0x4a8729;if(_0x2ee74d['body'][_0x14c5('0x9c')]&&!utils[_0x14c5('0x9e')](_0x2ee74d[_0x14c5('0x66')]['channel'])){throw new db['Sequelize']['ValidationError']('Unknown\x20channel');}switch(_0x2ee74d[_0x14c5('0x66')][_0x14c5('0x9c')]){case _0x14c5('0xa8'):return respondWithRpcPromise('QueuePause','unpause',{'id':_0xec159['id'],'name':_0xec159[_0x14c5('0x42')],'pause':![]})[_0x14c5('0x21')](function(){return db[_0x14c5('0xb1')][_0x14c5('0x34')]({'paused':0x0},{'where':{'UserId':_0xec159['id']},'individualHooks':!![]});})[_0x14c5('0x21')](function(){return db[_0x14c5('0xe9')][_0x14c5('0x40')]({'where':{'channel':_0x2ee74d[_0x14c5('0x66')][_0x14c5('0x9c')],'membername':_0xec159[_0x14c5('0x42')],'type':_0x14c5('0xf0'),'exitAt':null}});})['then'](function(_0x381c5f){if(_0x381c5f){return _0x381c5f['update']({'exitAt':moment()[_0x14c5('0x70')](_0x14c5('0xeb')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x14c5('0x21')](function(){return _0xec159[_0x14c5('0x34')]({'voicePause':![]});});case'mail':case _0x14c5('0x101'):case _0x14c5('0x102'):case'sms':case _0x14c5('0x103'):case'openchannel':return db[_0x14c5('0xe9')]['find']({'where':{'channel':_0x2ee74d[_0x14c5('0x66')][_0x14c5('0x9c')],'membername':_0xec159['name'],'type':_0x14c5('0xf0'),'exitAt':null}})[_0x14c5('0x21')](function(_0x440aaf){if(_0x440aaf){return _0x440aaf[_0x14c5('0x34')]({'exitAt':moment()[_0x14c5('0x70')](_0x14c5('0xeb')),'data2':_0x14c5('0x104')},{'individualHooks':!![]});}return null;})[_0x14c5('0x21')](function(){var _0x2bc2a7={};_[_0x14c5('0x105')](_0x2bc2a7,util[_0x14c5('0x70')]('%s%s',_0x2ee74d[_0x14c5('0x66')]['channel'],_0x14c5('0x106')),![]);return _0xec159[_0x14c5('0x34')](_0x2bc2a7);});default:return respondWithRpcPromise(_0x14c5('0x107'),_0x14c5('0xf9'),{'id':_0xec159['id'],'name':_0xec159['name'],'pause':![]})['then'](function(){return db['UserVoiceQueueRt'][_0x14c5('0x34')]({'paused':0x0},{'where':{'UserId':_0xec159['id']}});})[_0x14c5('0x21')](function(){return db['MemberReport'][_0x14c5('0xaa')]({'where':{'membername':_0xec159[_0x14c5('0x42')],'type':_0x14c5('0xf0'),'exitAt':null}});})[_0x14c5('0x21')](function(_0x544331){var _0x2e924e=[];_0x544331[_0x14c5('0xea')](function(_0x43ac84){_0x2e924e[_0x14c5('0xac')](_0x43ac84[_0x14c5('0x34')]({'exitAt':moment()[_0x14c5('0x70')](_0x14c5('0xeb')),'data2':_0x14c5('0x104')}));});return BPromise['all'](_0x2e924e);})[_0x14c5('0x21')](function(){return _0xec159[_0x14c5('0x34')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x14c5('0x21')](respondWithResult(_0x37de64,null))['catch'](handleError(_0x37de64,null));};exports[_0x14c5('0x108')]=function(_0x1df579,_0xa8a37,_0x1bec82){var _0x433361={};var _0x3200be={};var _0x46a7f0;var _0x3426c8;return db['User'][_0x14c5('0xbf')]({'where':{'id':_0x1df579[_0x14c5('0x68')]['id']}})[_0x14c5('0x21')](handleEntityNotFound(_0xa8a37,null))[_0x14c5('0x21')](function(_0x3287c0){if(_0x3287c0){_0x46a7f0=_0x3287c0;_0x3200be[_0x14c5('0x4a')]=_[_0x14c5('0x4f')](db[_0x14c5('0x109')][_0x14c5('0x47')]);_0x3200be[_0x14c5('0x4e')]=_[_0x14c5('0x4f')](_0x1df579[_0x14c5('0x4e')]);_0x3200be[_0x14c5('0x50')]=_['intersection'](_0x3200be[_0x14c5('0x4a')],_0x3200be[_0x14c5('0x4e')]);_0x433361[_0x14c5('0x52')]=_[_0x14c5('0x51')](_0x3200be[_0x14c5('0x4a')],qs[_0x14c5('0x53')](_0x1df579[_0x14c5('0x4e')]['fields']));_0x433361[_0x14c5('0x52')]=_0x433361[_0x14c5('0x52')][_0x14c5('0x54')]?_0x433361['attributes']:_0x3200be['model'];_0x433361[_0x14c5('0x56')]=qs['sort'](_0x1df579[_0x14c5('0x4e')][_0x14c5('0x57')]);_0x433361[_0x14c5('0x58')]=qs[_0x14c5('0x50')](_[_0x14c5('0x59')](_0x1df579[_0x14c5('0x4e')],_0x3200be[_0x14c5('0x50')]));if(_0x1df579[_0x14c5('0x4e')][_0x14c5('0x3d')]){_0x433361[_0x14c5('0x58')]=_[_0x14c5('0x5a')](_0x433361[_0x14c5('0x58')],{'$or':_[_0x14c5('0x3e')](_0x433361[_0x14c5('0x52')],function(_0x4728f2){var _0x49da2c={};_0x49da2c[_0x4728f2]={'$like':'%'+_0x1df579['query']['filter']+'%'};return _0x49da2c;})});}_0x433361=_[_0x14c5('0x5a')]({},_0x433361,_0x1df579[_0x14c5('0x5e')]);return _0x46a7f0[_0x14c5('0x108')](_0x433361);}})[_0x14c5('0x21')](function(_0x1a6d1e){if(_0x1a6d1e){_0x3426c8=_0x1a6d1e['length'];if(!_0x1df579[_0x14c5('0x4e')][_0x14c5('0xc2')](_0x14c5('0x55'))){_0x433361[_0x14c5('0x2f')]=qs['limit'](_0x1df579[_0x14c5('0x4e')]['limit']);_0x433361[_0x14c5('0x2e')]=qs[_0x14c5('0x2e')](_0x1df579[_0x14c5('0x4e')]['offset']);}return _0x46a7f0[_0x14c5('0x108')](_0x433361);}})[_0x14c5('0x21')](function(_0x148c95){if(_0x148c95){return _0x148c95?{'count':_0x3426c8,'rows':_0x148c95}:null;}})[_0x14c5('0x21')](respondWithResult(_0xa8a37,null))['catch'](handleError(_0xa8a37,null));};exports[_0x14c5('0x10a')]=function(_0xa75200,_0x11568c){return db['User'][_0x14c5('0x40')]({'where':{'id':_0xa75200[_0x14c5('0x68')]['id']}})['then'](handleEntityNotFound(_0x11568c,null))['then'](function(_0x47a443){if(_0x47a443){var _0x34e4ca=_0x47a443['get']({'plain':!![]});return _0x47a443['addTeams'](_0xa75200[_0x14c5('0x66')][_0x14c5('0x69')],_[_0x14c5('0x10b')](_0xa75200[_0x14c5('0x66')],[_0x14c5('0x69'),'id'])||{})[_0x14c5('0x21')](function(){for(var _0x37852e=0x0;_0x37852e<_0xa75200[_0x14c5('0x66')]['ids'][_0x14c5('0x54')];_0x37852e++){var _0x398eae=[];db[_0x14c5('0x109')][_0x14c5('0xbf')]({'where':{'id':_0xa75200['body']['ids'][_0x37852e]}})['then'](function(_0x2183f1){_0x398eae[_0x14c5('0xac')](_0x2183f1['getVoiceQueues']()[_0x14c5('0x21')](function(_0x4d4db0){for(var _0x15f2f3=0x0;_0x15f2f3<_0x4d4db0['length'];_0x15f2f3++){_0x4d4db0[_0x15f2f3]['setDataValue'](_0x14c5('0x9c'),'Voice');}return _0x4d4db0;}));_0x398eae[_0x14c5('0xac')](_0x2183f1[_0x14c5('0x10c')]()[_0x14c5('0x21')](function(_0x398297){for(var _0x890474=0x0;_0x890474<_0x398297[_0x14c5('0x54')];_0x890474++){_0x398297[_0x890474][_0x14c5('0x10d')](_0x14c5('0x9c'),'Chat');}return _0x398297;}));_0x398eae[_0x14c5('0xac')](_0x2183f1[_0x14c5('0x10e')]()['then'](function(_0x551903){for(var _0x1becf4=0x0;_0x1becf4<_0x551903['length'];_0x1becf4++){_0x551903[_0x1becf4][_0x14c5('0x10d')](_0x14c5('0x9c'),_0x14c5('0x10f'));}return _0x551903;}));_0x398eae[_0x14c5('0xac')](_0x2183f1[_0x14c5('0x110')]()[_0x14c5('0x21')](function(_0x39a77e){for(var _0x4a77a2=0x0;_0x4a77a2<_0x39a77e[_0x14c5('0x54')];_0x4a77a2++){_0x39a77e[_0x4a77a2][_0x14c5('0x10d')](_0x14c5('0x9c'),_0x14c5('0x111'));}return _0x39a77e;}));_0x398eae[_0x14c5('0xac')](_0x2183f1[_0x14c5('0x112')]()['then'](function(_0x2e0a80){for(var _0x30a8e8=0x0;_0x30a8e8<_0x2e0a80[_0x14c5('0x54')];_0x30a8e8++){_0x2e0a80[_0x30a8e8][_0x14c5('0x10d')](_0x14c5('0x9c'),_0x14c5('0x113'));}return _0x2e0a80;}));_0x398eae['push'](_0x2183f1[_0x14c5('0x114')]()[_0x14c5('0x21')](function(_0x73a55e){for(var _0x5e1f95=0x0;_0x5e1f95<_0x73a55e[_0x14c5('0x54')];_0x5e1f95++){_0x73a55e[_0x5e1f95][_0x14c5('0x10d')](_0x14c5('0x9c'),_0x14c5('0x115'));}return _0x73a55e;}));_0x398eae['push'](_0x2183f1[_0x14c5('0x116')]()[_0x14c5('0x21')](function(_0x29db51){for(var _0x241e31=0x0;_0x241e31<_0x29db51[_0x14c5('0x54')];_0x241e31++){_0x29db51[_0x241e31][_0x14c5('0x10d')]('channel','Openchannel');}return _0x29db51;}));return BPromise[_0x14c5('0xec')](_0x398eae);})['then'](function(_0x5e4445){var _0x5b31d1=_[_0x14c5('0x117')](_0x5e4445);_0x398eae=[];return db[_0x14c5('0x5c')][_0x14c5('0x118')](function(_0x40c5ef){for(var _0x23fe71=0x0;_0x23fe71<_0x5b31d1[_0x14c5('0x54')];_0x23fe71++){_0x398eae[_0x14c5('0xac')](_0x5b31d1[_0x23fe71]['addAgent'](_0x34e4ca['id']),{'transaction':_0x40c5ef});}return BPromise['all'](_0x398eae)['then'](function(){if(_0x34e4ca['online']){return BPromise['each'](_[_0x14c5('0x3d')](_0x5b31d1,function(_0x49201b){return _0x49201b[_0x14c5('0x119')](_0x14c5('0x9c'))==='Voice';}),function(_0x2aefe3){return db[_0x14c5('0xb1')][_0x14c5('0xb2')]({'membername':_0x34e4ca[_0x14c5('0x42')],'UserId':_0x34e4ca['id'],'queue_name':_0x2aefe3['name'],'VoiceQueueId':_0x2aefe3['id'],'interface':_[_0x14c5('0x6e')](_0x34e4ca[_0x14c5('0xad')])?util['format']('SIP/%s',_0x34e4ca[_0x14c5('0x42')]):_0x34e4ca['interface'],'paused':_0x34e4ca[_0x14c5('0xaf')]||![],'penalty':_0x34e4ca[_0x14c5('0xa4')]},{'transaction':_0x40c5ef});});}else{return;}})[_0x14c5('0x21')](function(){for(var _0x46f95b=0x0;_0x46f95b<_0x5b31d1['length'];_0x46f95b++){var _0x1ebc53=_0x5b31d1[_0x46f95b]['getDataValue'](_0x14c5('0x9c'));var _0x3ccb90=_0x1ebc53+_0x14c5('0xa6');socket[_0x14c5('0xb4')]('user'+_0x1ebc53+_0x14c5('0xa7'),{'UserId':_0x34e4ca['id'],['queueField']:_0x5b31d1[_0x46f95b]['id']});}});});});}});}})[_0x14c5('0x21')](respondWithStatusCode(_0x11568c,null))[_0x14c5('0x62')](handleError(_0x11568c,null));};exports['removeTeams']=function(_0x211b22,_0x406330){return db[_0x14c5('0x46')]['findOne']({'where':{'id':_0x211b22[_0x14c5('0x68')]['id']}})[_0x14c5('0x21')](handleEntityNotFound(_0x406330,null))[_0x14c5('0x21')](function(_0x443a1e){if(_0x443a1e){var _0x25ec44=_0x443a1e[_0x14c5('0x36')]({'plain':!![]});var _0xf698f1=_0x211b22[_0x14c5('0x4e')][_0x14c5('0x69')];return _0x443a1e[_0x14c5('0x11a')](_0xf698f1)[_0x14c5('0x21')](function(){for(var _0x2158cb=0x0;_0x2158cb<_0xf698f1[_0x14c5('0x54')];_0x2158cb++){var _0x55053a=[];db[_0x14c5('0x109')][_0x14c5('0xbf')]({'where':{'id':_0xf698f1[_0x2158cb]}})[_0x14c5('0x21')](function(_0x4d35dd){_0x55053a['push'](_0x4d35dd[_0x14c5('0x11b')]()['then'](function(_0x4fae83){for(var _0x382ac5=0x0;_0x382ac5<_0x4fae83[_0x14c5('0x54')];_0x382ac5++){_0x4fae83[_0x382ac5][_0x14c5('0x10d')](_0x14c5('0x9c'),_0x14c5('0x11c'));}return _0x4fae83;}));_0x55053a['push'](_0x4d35dd[_0x14c5('0x10c')]()['then'](function(_0x289b05){for(var _0x4aca1f=0x0;_0x4aca1f<_0x289b05[_0x14c5('0x54')];_0x4aca1f++){_0x289b05[_0x4aca1f]['setDataValue'](_0x14c5('0x9c'),_0x14c5('0x11d'));}return _0x289b05;}));_0x55053a[_0x14c5('0xac')](_0x4d35dd[_0x14c5('0x10e')]()['then'](function(_0x504176){for(var _0x4a3e70=0x0;_0x4a3e70<_0x504176[_0x14c5('0x54')];_0x4a3e70++){_0x504176[_0x4a3e70]['setDataValue'](_0x14c5('0x9c'),_0x14c5('0x10f'));}return _0x504176;}));_0x55053a['push'](_0x4d35dd[_0x14c5('0x110')]()['then'](function(_0x4b6949){for(var _0x1246d8=0x0;_0x1246d8<_0x4b6949[_0x14c5('0x54')];_0x1246d8++){_0x4b6949[_0x1246d8][_0x14c5('0x10d')](_0x14c5('0x9c'),_0x14c5('0x111'));}return _0x4b6949;}));_0x55053a[_0x14c5('0xac')](_0x4d35dd[_0x14c5('0x112')]()[_0x14c5('0x21')](function(_0x4214b1){for(var _0xe582fb=0x0;_0xe582fb<_0x4214b1['length'];_0xe582fb++){_0x4214b1[_0xe582fb][_0x14c5('0x10d')](_0x14c5('0x9c'),_0x14c5('0x113'));}return _0x4214b1;}));_0x55053a['push'](_0x4d35dd[_0x14c5('0x114')]()[_0x14c5('0x21')](function(_0x1ceb51){for(var _0x4f1697=0x0;_0x4f1697<_0x1ceb51[_0x14c5('0x54')];_0x4f1697++){_0x1ceb51[_0x4f1697]['setDataValue'](_0x14c5('0x9c'),_0x14c5('0x115'));}return _0x1ceb51;}));_0x55053a[_0x14c5('0xac')](_0x4d35dd['getOpenchannelQueues']()[_0x14c5('0x21')](function(_0x5be7e7){for(var _0x442072=0x0;_0x442072<_0x5be7e7[_0x14c5('0x54')];_0x442072++){_0x5be7e7[_0x442072][_0x14c5('0x10d')](_0x14c5('0x9c'),'Openchannel');}return _0x5be7e7;}));return BPromise[_0x14c5('0xec')](_0x55053a);})[_0x14c5('0x21')](function(_0x34926d){var _0x581016=_[_0x14c5('0x117')](_0x34926d);_0x55053a=[];return db['sequelize'][_0x14c5('0x118')](function(_0x1c4d39){for(var _0x3c3550=0x0;_0x3c3550<_0x581016[_0x14c5('0x54')];_0x3c3550++){_0x55053a[_0x14c5('0xac')](_0x581016[_0x3c3550][_0x14c5('0x11e')](_0x25ec44['id']),{'transaction':_0x1c4d39});}return BPromise[_0x14c5('0xec')](_0x55053a)[_0x14c5('0x21')](function(){if(_0x25ec44[_0x14c5('0xab')]){return BPromise[_0x14c5('0xb0')](_[_0x14c5('0x3d')](_0x581016,function(_0x530431){return _0x530431[_0x14c5('0x119')]('channel')==='Voice';}),function(_0x34e497){return db[_0x14c5('0xb1')][_0x14c5('0x35')]({'where':{'VoiceQueueId':_0x34e497['id'],'UserId':_0x25ec44['id']},'transaction':_0x1c4d39});});}else{return;}})[_0x14c5('0x21')](function(){for(var _0x32da45=0x0;_0x32da45<_0x581016[_0x14c5('0x54')];_0x32da45++){var _0x1059b4=_0x581016[_0x32da45][_0x14c5('0x119')](_0x14c5('0x9c'));var _0x5ebbf5=_0x1059b4+_0x14c5('0xa6');socket[_0x14c5('0xb4')]('user'+_0x1059b4+'Queue:remove',{'UserId':_0x25ec44['id'],['queueField']:_0x581016[_0x32da45]['id']});}});});});}});}})[_0x14c5('0x21')](respondWithStatusCode(_0x406330,null))[_0x14c5('0x62')](handleError(_0x406330,null));};exports[_0x14c5('0x11f')]=function(_0x3eb93f,_0x8c8432,_0x42f277){var _0x4c5986={};var _0x12172c={};var _0x19e869;var _0xbc2f7d;return db[_0x14c5('0x46')]['findOne']({'where':{'id':_0x3eb93f[_0x14c5('0x68')]['id']}})[_0x14c5('0x21')](handleEntityNotFound(_0x8c8432,null))[_0x14c5('0x21')](function(_0x16767e){if(_0x16767e){_0x19e869=_0x16767e;_0x12172c['model']=_[_0x14c5('0x4f')](db['CmList'][_0x14c5('0x47')]);_0x12172c[_0x14c5('0x4e')]=_[_0x14c5('0x4f')](_0x3eb93f[_0x14c5('0x4e')]);_0x12172c[_0x14c5('0x50')]=_['intersection'](_0x12172c['model'],_0x12172c['query']);_0x4c5986[_0x14c5('0x52')]=_[_0x14c5('0x51')](_0x12172c[_0x14c5('0x4a')],qs[_0x14c5('0x53')](_0x3eb93f[_0x14c5('0x4e')]['fields']));_0x4c5986[_0x14c5('0x52')]=_0x4c5986[_0x14c5('0x52')][_0x14c5('0x54')]?_0x4c5986[_0x14c5('0x52')]:_0x12172c[_0x14c5('0x4a')];_0x4c5986[_0x14c5('0x56')]=qs['sort'](_0x3eb93f[_0x14c5('0x4e')][_0x14c5('0x57')]);_0x4c5986[_0x14c5('0x58')]=qs[_0x14c5('0x50')](_[_0x14c5('0x59')](_0x3eb93f['query'],_0x12172c['filters']));if(_0x3eb93f[_0x14c5('0x4e')][_0x14c5('0x3d')]){_0x4c5986[_0x14c5('0x58')]=_[_0x14c5('0x5a')](_0x4c5986[_0x14c5('0x58')],{'$or':_['map'](_0x4c5986['attributes'],function(_0x44332a){var _0x37dca7={};_0x37dca7[_0x44332a]={'$like':'%'+_0x3eb93f[_0x14c5('0x4e')]['filter']+'%'};return _0x37dca7;})});}_0x4c5986=_[_0x14c5('0x5a')]({},_0x4c5986,_0x3eb93f['options']);return _0x19e869[_0x14c5('0x11f')](_0x4c5986);}})['then'](function(_0x486205){if(_0x486205){_0xbc2f7d=_0x486205[_0x14c5('0x54')];if(!_0x3eb93f[_0x14c5('0x4e')][_0x14c5('0xc2')](_0x14c5('0x55'))){_0x4c5986[_0x14c5('0x2f')]=qs[_0x14c5('0x2f')](_0x3eb93f['query']['limit']);_0x4c5986['offset']=qs['offset'](_0x3eb93f[_0x14c5('0x4e')][_0x14c5('0x2e')]);}return _0x19e869['getLists'](_0x4c5986);}})['then'](function(_0x29494b){if(_0x29494b){return _0x29494b?{'count':_0xbc2f7d,'rows':_0x29494b}:null;}})[_0x14c5('0x21')](respondWithResult(_0x8c8432,null))[_0x14c5('0x62')](handleError(_0x8c8432,null));};exports['getAgents']=function(_0x29dace,_0x44dd1e,_0xba4ba2){var _0x1b287b={};var _0x3a2337={};var _0x10e837;var _0x1d4039;return db[_0x14c5('0x46')]['findOne']({'where':{'id':_0x29dace[_0x14c5('0x68')]['id']}})[_0x14c5('0x21')](handleEntityNotFound(_0x44dd1e,null))[_0x14c5('0x21')](function(_0x19f33b){if(_0x19f33b){_0x10e837=_0x19f33b;_0x3a2337[_0x14c5('0x4a')]=_['keys'](db[_0x14c5('0x46')][_0x14c5('0x47')]);_0x3a2337['query']=_[_0x14c5('0x4f')](_0x29dace[_0x14c5('0x4e')]);_0x3a2337[_0x14c5('0x50')]=_[_0x14c5('0x51')](_0x3a2337[_0x14c5('0x4a')],_0x3a2337[_0x14c5('0x4e')]);_0x1b287b[_0x14c5('0x52')]=_[_0x14c5('0x51')](_0x3a2337[_0x14c5('0x4a')],qs['fields'](_0x29dace['query']['fields']));_0x1b287b[_0x14c5('0x52')]=_0x1b287b[_0x14c5('0x52')][_0x14c5('0x54')]?_0x1b287b[_0x14c5('0x52')]:_0x3a2337[_0x14c5('0x4a')];_0x1b287b[_0x14c5('0x56')]=qs[_0x14c5('0x57')](_0x29dace[_0x14c5('0x4e')][_0x14c5('0x57')]);_0x1b287b[_0x14c5('0x58')]=qs[_0x14c5('0x50')](_[_0x14c5('0x59')](_0x29dace[_0x14c5('0x4e')],_0x3a2337[_0x14c5('0x50')]));if(_0x29dace[_0x14c5('0x4e')]['filter']){_0x1b287b['where']=_['merge'](_0x1b287b[_0x14c5('0x58')],{'$or':_[_0x14c5('0x3e')](_0x1b287b[_0x14c5('0x52')],function(_0x49b44f){var _0x3f3047={};_0x3f3047[_0x49b44f]={'$like':'%'+_0x29dace[_0x14c5('0x4e')]['filter']+'%'};return _0x3f3047;})});}_0x1b287b[_0x14c5('0x4a')]=db[_0x14c5('0x46')];_0x1b287b['as']='Agents';_0x1b287b=_[_0x14c5('0x5a')]({},_0x1b287b,_0x29dace['options']);return _0x10e837[_0x14c5('0x11b')]({'include':[_0x1b287b]});}})['then'](function(_0x1c23c9){if(_0x1c23c9){var _0x22e75f={},_0x1eee68=[],_0x524f2e=0x0;for(var _0x32a1d3=0x0;_0x32a1d3<_0x1c23c9[_0x14c5('0x54')];_0x32a1d3+=0x1){for(var _0x3e9e48=0x0,_0x49da50;_0x3e9e48<_0x1c23c9[_0x32a1d3]['Agents'][_0x14c5('0x54')];_0x3e9e48+=0x1){_0x49da50=_0x1c23c9[_0x32a1d3]['Agents'][_0x3e9e48][_0x14c5('0x36')]({'plain':!![]});_0x22e75f[_0x49da50['id']]=_0x49da50;}}_0x22e75f=_[_0x14c5('0x120')](_0x22e75f);for(var _0x4db732=qs[_0x14c5('0x2e')](_0x29dace[_0x14c5('0x4e')]['offset']);_0x4db732<_0x22e75f[_0x14c5('0x54')]&&_0x1eee68[_0x14c5('0x54')]=_0xaf58d2['agents']){throw new Error(_0x15b0('0x53'));}})[_0x15b0('0x20')](function(){if(_0x5ba1f7){return db[_0x15b0('0x41')][_0x15b0('0x4b')]({'where':{'membername':_0x5ba1f7[_0x15b0('0x27')]},'individualHooks':!![]});}})[_0x15b0('0x20')](function(){if(_0x5ba1f7){return _0x5ba1f7[_0x15b0('0x54')]({'raw':!![]});}})['then'](function(_0x22ad7e){if(_0x5ba1f7){if(_0x22ad7e){var _0x3e5eb1=[];_0x2ea7e0=_0x22ad7e;if(_0x2ea7e0[_0x15b0('0x2d')]){for(var _0x14521e=0x0;_0x14521e<_0x2ea7e0[_0x15b0('0x2d')];_0x14521e++){_0x3e5eb1[_0x15b0('0x4a')](db[_0x15b0('0x41')][_0x15b0('0x55')]({'membername':_0x5ba1f7['name'],'UserId':_0x5ba1f7['id'],'queue_name':_0x2ea7e0[_0x14521e][_0x15b0('0x27')],'VoiceQueueId':_0x2ea7e0[_0x14521e]['id'],'interface':_0x1fc7e8,'paused':_0x5ba1f7['loginInPause']||![],'penalty':_0x2ea7e0[_0x14521e]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x15b0('0x56')](_0x3e5eb1);}}}})[_0x15b0('0x20')](function(){if(_0x5ba1f7){return db['MemberReport']['findAll']({'where':{'membername':_0x5ba1f7[_0x15b0('0x27')],'exitAt':null}});}})[_0x15b0('0x20')](function(_0x18c69e){if(_0x5ba1f7){if(_0x18c69e&&_0x18c69e[_0x15b0('0x2d')]){var _0xae960e=[];_0x18c69e[_0x15b0('0x31')](function(_0x7184d4){_0xae960e[_0x15b0('0x4a')](_0x7184d4['update']({'exitAt':moment()[_0x15b0('0x35')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0xae960e);}}})['then'](function(_0x5182a0){if(_0x5ba1f7){var _0x13ef30=[];var _0x52c846=[];var _0x21517f=utils['getChannels']();var _0x2edcd9={'membername':_0x5ba1f7[_0x15b0('0x27')],'interface':_0x1fc7e8,'enterAt':moment()[_0x15b0('0x35')](_0x15b0('0x2e')),'role':_0x5ba1f7[_0x15b0('0x28')],'internal':_0x5ba1f7[_0x15b0('0x29')]};_0x21517f[_0x15b0('0x31')](function(_0x49cbea){_0x13ef30[_0x15b0('0x4a')](_['merge']({'channel':_0x49cbea,'type':_0x15b0('0x57'),'data1':_0x15b0('0x58'),'data2':_0x1fc7e8},_0x2edcd9));if(_0x5ba1f7[_0x15b0('0x4f')]){_0x52c846[_0x15b0('0x4a')](_[_0x15b0('0x59')]({'channel':_0x49cbea,'type':_0x15b0('0x2c'),'data1':_0x15b0('0x5a')},_0x2edcd9));}});return db[_0x15b0('0x2b')]['bulkCreate'](_0x13ef30[_0x15b0('0x5b')](_0x52c846),{'individualHooks':!![]});}})[_0x15b0('0x20')](function(){if(_0x5ba1f7){return _0x5ba1f7[_0x15b0('0x2a')]({'online':!![],'lastLoginAt':moment()[_0x15b0('0x35')](_0x15b0('0x2e')),'voicePause':_0x5ba1f7['loginInPause']||![],'mailPause':_0x5ba1f7[_0x15b0('0x4f')]||![],'chatPause':_0x5ba1f7['loginInPause']||![],'faxPause':_0x5ba1f7[_0x15b0('0x4f')]||![],'smsPause':_0x5ba1f7[_0x15b0('0x4f')]||![],'openchannelPause':_0x5ba1f7[_0x15b0('0x4f')]||![],'pauseType':_0x5ba1f7[_0x15b0('0x4f')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x15b0('0x35')](_0x15b0('0x2e')),'interface':_0x1fc7e8});}})['then'](function(_0xc6bb6e){_0x222095(_0xc6bb6e);})[_0x15b0('0x17')](function(_0x146e12){_0x1b65ed(_0x328803[_0x15b0('0x14')](0x1f4,_0x146e12[_0x15b0('0x15')]));});});}; \ No newline at end of file +var _0x61f8=['mail','fax','sms','openchannel','set','%s%s','Pause','all','LoginUser','findOne','role','mobile','phone','loginInPause','count','agent','../../config/license/util','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','LOGIN','callysquare','LOGININPAUSE','concat','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','./user.socket','register','request','then','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','error','code','User,\x20%s,\x20%s','message','info','result','catch','GetUser','User','options','raw','where','include','map','model','attributes','stringify','ShowUser','find','name','interface','UserVoiceQueueRt','MemberReport','findAll','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','isNil','body','type','DEFAULT\x20PAUSE','internal','bulkCreate','update','UnpauseUser','channel','isValidChannel','Unknown\x20channel','voice','system'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0x61f8,0x1d8));var _0x861f=function(_0x395bfe,_0x4db521){_0x395bfe=_0x395bfe-0x0;var _0x35c81c=_0x61f8[_0x395bfe];return _0x35c81c;};'use strict';var _=require(_0x861f('0x0'));var util=require('util');var moment=require(_0x861f('0x1'));var BPromise=require('bluebird');var rs=require(_0x861f('0x2'));var fs=require('fs');var Redis=require(_0x861f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x861f('0x4'));var logger=require(_0x861f('0x5'))('rpc');var config=require(_0x861f('0x6'));var jayson=require(_0x861f('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x861f('0x8')]=_[_0x861f('0x9')](config[_0x861f('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x861f('0x8')]));require(_0x861f('0xa'))[_0x861f('0xb')](socket);function respondWithRpcPromise(_0x503063,_0x2f270e,_0x1ea2e3){return new BPromise(function(_0x4dd645,_0x91f4b5){return client[_0x861f('0xc')](_0x503063,_0x1ea2e3)[_0x861f('0xd')](function(_0x1956dd){logger['info']('User,\x20%s,\x20%s',_0x2f270e,_0x861f('0xe'));logger[_0x861f('0xf')](_0x861f('0x10'),_0x2f270e,'request\x20sent',JSON['stringify'](_0x1956dd));if(_0x1956dd['error']){if(_0x1956dd[_0x861f('0x11')][_0x861f('0x12')]===0x1f4){logger[_0x861f('0x11')](_0x861f('0x13'),_0x2f270e,_0x1956dd[_0x861f('0x11')][_0x861f('0x14')]);return _0x91f4b5(_0x1956dd[_0x861f('0x11')][_0x861f('0x14')]);}logger[_0x861f('0x11')](_0x861f('0x13'),_0x2f270e,_0x1956dd[_0x861f('0x11')][_0x861f('0x14')]);return _0x4dd645(_0x1956dd[_0x861f('0x11')][_0x861f('0x14')]);}else{logger[_0x861f('0x15')]('User,\x20%s,\x20%s',_0x2f270e,_0x861f('0xe'));_0x4dd645(_0x1956dd[_0x861f('0x16')]['message']);}})[_0x861f('0x17')](function(_0x4af2e3){logger[_0x861f('0x11')](_0x861f('0x13'),_0x2f270e,_0x4af2e3);_0x91f4b5(_0x4af2e3);});});}exports[_0x861f('0x18')]=function(_0x1509d2){var _0x5e7cad=this;return new Promise(function(_0x2f3d7d,_0x54082b){return db[_0x861f('0x19')]['findAll']({'raw':_0x1509d2[_0x861f('0x1a')]?_0x1509d2['options'][_0x861f('0x1b')]===undefined?!![]:![]:!![],'where':_0x1509d2[_0x861f('0x1a')]?_0x1509d2[_0x861f('0x1a')][_0x861f('0x1c')]||null:null,'attributes':_0x1509d2[_0x861f('0x1a')]?_0x1509d2[_0x861f('0x1a')]['attributes']||null:null,'limit':_0x1509d2[_0x861f('0x1a')]?_0x1509d2[_0x861f('0x1a')]['limit']||null:null,'include':_0x1509d2[_0x861f('0x1a')]?_0x1509d2[_0x861f('0x1a')][_0x861f('0x1d')]?_[_0x861f('0x1e')](_0x1509d2[_0x861f('0x1a')][_0x861f('0x1d')],function(_0x387dae){return{'model':db[_0x387dae[_0x861f('0x1f')]],'as':_0x387dae['as'],'attributes':_0x387dae[_0x861f('0x20')],'include':_0x387dae[_0x861f('0x1d')]?_[_0x861f('0x1e')](_0x387dae[_0x861f('0x1d')],function(_0x123190){return{'model':db[_0x123190[_0x861f('0x1f')]],'as':_0x123190['as'],'attributes':_0x123190['attributes'],'include':_0x123190[_0x861f('0x1d')]?_[_0x861f('0x1e')](_0x123190[_0x861f('0x1d')],function(_0x503ed6){return{'model':db[_0x503ed6[_0x861f('0x1f')]],'as':_0x503ed6['as'],'attributes':_0x503ed6['attributes']};}):[]};}):[]};}):[]:[]})[_0x861f('0xd')](function(_0x1b5c66){logger['info']('GetUser',_0x1509d2);logger['debug'](_0x861f('0x18'),_0x1509d2,JSON[_0x861f('0x21')](_0x1b5c66));_0x2f3d7d(_0x1b5c66);})[_0x861f('0x17')](function(_0x95d647){logger[_0x861f('0x11')](_0x861f('0x18'),_0x95d647[_0x861f('0x14')],_0x1509d2);_0x54082b(_0x5e7cad['error'](0x1f4,_0x95d647[_0x861f('0x14')]));});});};exports[_0x861f('0x22')]=function(_0x1dc22d){var _0x5848af=this;return new Promise(function(_0x37e60c,_0x4e2aa2){return db['User'][_0x861f('0x23')]({'raw':_0x1dc22d[_0x861f('0x1a')]?_0x1dc22d[_0x861f('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1dc22d['options']?_0x1dc22d[_0x861f('0x1a')]['where']||null:null,'attributes':_0x1dc22d[_0x861f('0x1a')]?_0x1dc22d[_0x861f('0x1a')]['attributes']||null:null,'include':_0x1dc22d[_0x861f('0x1a')]?_0x1dc22d['options'][_0x861f('0x1d')]?_[_0x861f('0x1e')](_0x1dc22d[_0x861f('0x1a')][_0x861f('0x1d')],function(_0x619e54){return{'model':db[_0x619e54[_0x861f('0x1f')]],'as':_0x619e54['as'],'attributes':_0x619e54[_0x861f('0x20')],'include':_0x619e54[_0x861f('0x1d')]?_[_0x861f('0x1e')](_0x619e54[_0x861f('0x1d')],function(_0x40401f){return{'model':db[_0x40401f[_0x861f('0x1f')]],'as':_0x40401f['as'],'attributes':_0x40401f[_0x861f('0x20')],'include':_0x40401f[_0x861f('0x1d')]?_[_0x861f('0x1e')](_0x40401f[_0x861f('0x1d')],function(_0x59593d){return{'model':db[_0x59593d[_0x861f('0x1f')]],'as':_0x59593d['as'],'attributes':_0x59593d[_0x861f('0x20')]};}):[]};}):[]};}):[]:[]})[_0x861f('0xd')](function(_0x51185b){logger[_0x861f('0x15')](_0x861f('0x22'),_0x1dc22d);logger[_0x861f('0xf')](_0x861f('0x22'),_0x1dc22d,JSON[_0x861f('0x21')](_0x51185b));_0x37e60c(_0x51185b);})[_0x861f('0x17')](function(_0x4c2011){logger[_0x861f('0x11')](_0x861f('0x22'),_0x4c2011[_0x861f('0x14')],_0x1dc22d);_0x4e2aa2(_0x5848af[_0x861f('0x11')](0x1f4,_0x4c2011[_0x861f('0x14')]));});});};exports['PauseUser']=function(_0x14bbc3){var _0x2c2184=this;return new Promise(function(_0x2e67c0,_0x18491e){var _0xf4bcd;return db[_0x861f('0x19')][_0x861f('0x23')]({'where':_0x14bbc3[_0x861f('0x1a')][_0x861f('0x1c')]||{},'attributes':['id',_0x861f('0x24'),'role','internal',_0x861f('0x25')]})[_0x861f('0xd')](function(_0x4edbf1){if(_0x4edbf1){_0xf4bcd=_0x4edbf1;return db[_0x861f('0x26')]['update']({'paused':0x1},{'where':{'UserId':_0xf4bcd['id']},'individualHooks':!![]});}})[_0x861f('0xd')](function(){if(_0xf4bcd){return db[_0x861f('0x27')][_0x861f('0x28')]({'where':{'membername':_0xf4bcd['name'],'type':_0x861f('0x29'),'exitAt':null}});}})[_0x861f('0xd')](function(_0x4728d5){if(_0xf4bcd){if(_0x4728d5&&_0x4728d5[_0x861f('0x2a')]){var _0x4fdfb2=moment()[_0x861f('0x2b')](_0x861f('0x2c'));for(var _0x3498b2=0x0,_0x1ed718=_0x4728d5[_0x861f('0x2a')];_0x3498b2<_0x1ed718;_0x3498b2++){_0x4728d5[_0x3498b2][_0x861f('0x2d')]({'exitAt':_0x4fdfb2});}}}})[_0x861f('0xd')](function(){if(_0xf4bcd){var _0x26307c=[];var _0x2552af=utils[_0x861f('0x2e')]();_0x2552af[_0x861f('0x2f')](function(_0x5ccd9b){_0x26307c[_0x861f('0x30')]({'channel':_0x5ccd9b,'membername':_0xf4bcd[_0x861f('0x24')],'interface':_[_0x861f('0x31')](_0xf4bcd[_0x861f('0x25')])?util[_0x861f('0x2b')]('SIP/%s',_0xf4bcd[_0x861f('0x24')]):_0xf4bcd['interface'],'type':'PAUSE','enterAt':moment()[_0x861f('0x2b')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x14bbc3[_0x861f('0x32')][_0x861f('0x33')]||_0x861f('0x34'),'role':_0xf4bcd['role'],'internal':_0xf4bcd[_0x861f('0x35')],'uniqueid':_0x14bbc3[_0x861f('0x32')]['uniqueid']||null});});return db['MemberReport'][_0x861f('0x36')](_0x26307c,{'individualHooks':!![]});}})[_0x861f('0xd')](function(){if(_0xf4bcd){return _0xf4bcd[_0x861f('0x37')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x14bbc3[_0x861f('0x32')]['type']||_0x861f('0x34'),'lastPauseAt':moment()[_0x861f('0x2b')](_0x861f('0x2c'))});}})[_0x861f('0xd')](function(_0x2e2f2f){_0x2e67c0(_0x2e2f2f);})['catch'](function(_0x9d719){_0x18491e(_0x2c2184[_0x861f('0x11')](0x1f4,_0x9d719['message']));});});};exports[_0x861f('0x38')]=function(_0x5d7839){var _0x178381=this;return new Promise(function(_0x464c21,_0x26c08e){var _0x1f7aee;return db['User']['findOne']({'where':_0x5d7839['options'][_0x861f('0x1c')]||{},'attributes':['id',_0x861f('0x24')]})[_0x861f('0xd')](function(_0x2cf512){if(_0x2cf512){_0x1f7aee=_0x2cf512;if(_0x5d7839[_0x861f('0x32')][_0x861f('0x39')]&&!utils[_0x861f('0x3a')](_0x5d7839['body'][_0x861f('0x39')])){throw new Error(_0x861f('0x3b'));}switch(_0x5d7839['body'][_0x861f('0x39')]){case _0x861f('0x3c'):return db['UserVoiceQueueRt'][_0x861f('0x37')]({'paused':0x0},{'where':{'UserId':_0x1f7aee['id']}})[_0x861f('0xd')](function(){return db[_0x861f('0x27')][_0x861f('0x23')]({'where':{'channel':_0x5d7839[_0x861f('0x32')][_0x861f('0x39')],'membername':_0x1f7aee['name'],'type':_0x861f('0x29'),'exitAt':null}});})[_0x861f('0xd')](function(_0x1f9d29){if(_0x1f9d29){return _0x1f9d29['update']({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x861f('0x3d')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x1f7aee['update']({'voicePause':![]});});case _0x861f('0x3e'):case'chat':case _0x861f('0x3f'):case _0x861f('0x40'):case _0x861f('0x41'):return db[_0x861f('0x27')][_0x861f('0x23')]({'where':{'channel':_0x5d7839[_0x861f('0x32')][_0x861f('0x39')],'membername':_0x1f7aee[_0x861f('0x24')],'type':_0x861f('0x29'),'exitAt':null}})[_0x861f('0xd')](function(_0x2e7c67){return _0x2e7c67['update']({'exitAt':moment()[_0x861f('0x2b')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'system'},{'individualHooks':!![]});})['then'](function(){var _0x355493={};_[_0x861f('0x42')](_0x355493,util[_0x861f('0x2b')](_0x861f('0x43'),_0x5d7839[_0x861f('0x32')][_0x861f('0x39')],_0x861f('0x44')),![]);return _0x1f7aee[_0x861f('0x37')](_0x355493);});default:return db[_0x861f('0x26')][_0x861f('0x37')]({'paused':0x0},{'where':{'UserId':_0x1f7aee['id']}})['then'](function(){return db['MemberReport'][_0x861f('0x28')]({'where':{'membername':_0x1f7aee[_0x861f('0x24')],'type':'PAUSE','exitAt':null}});})[_0x861f('0xd')](function(_0x1011fd){var _0x358df5=[];_0x1011fd[_0x861f('0x2f')](function(_0x4520f6){_0x358df5[_0x861f('0x30')](_0x4520f6['update']({'exitAt':moment()[_0x861f('0x2b')](_0x861f('0x2c')),'data2':_0x861f('0x3d')}));});return BPromise[_0x861f('0x45')](_0x358df5);})[_0x861f('0xd')](function(){return _0x1f7aee[_0x861f('0x37')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0x861f('0xd')](function(_0x25da04){_0x464c21(_0x25da04);})['catch'](function(_0x1f985f){_0x26c08e(_0x178381[_0x861f('0x11')](0x1f4,_0x1f985f[_0x861f('0x14')]));});});};exports['LogoutUser']=function(_0x506905){var _0x338edd=this;return new Promise(function(_0x2e0762,_0x33f8db){var _0x593190;return db[_0x861f('0x19')]['findOne']({'where':_0x506905[_0x861f('0x1a')][_0x861f('0x1c')]||{},'attributes':['id',_0x861f('0x24')]})[_0x861f('0xd')](function(_0x8713f4){if(_0x8713f4){_0x593190=_0x8713f4;return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x593190[_0x861f('0x24')]},'individualHooks':!![]});}})[_0x861f('0xd')](function(){if(_0x593190){return db[_0x861f('0x27')][_0x861f('0x28')]({'where':{'membername':_0x593190[_0x861f('0x24')],'exitAt':null}});}})[_0x861f('0xd')](function(_0x12966){if(_0x593190){if(_0x12966&&_0x12966['length']){var _0x3de7f2=[];_0x12966[_0x861f('0x2f')](function(_0x28a0f4){_0x3de7f2[_0x861f('0x30')](_0x28a0f4[_0x861f('0x37')]({'exitAt':moment()[_0x861f('0x2b')](_0x861f('0x2c'))}));});return BPromise[_0x861f('0x45')](_0x3de7f2);}}})[_0x861f('0xd')](function(){if(_0x593190){return _0x593190[_0x861f('0x37')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x861f('0xd')](function(_0x5e015b){_0x2e0762(_0x5e015b);})[_0x861f('0x17')](function(_0x165999){_0x33f8db(_0x338edd[_0x861f('0x11')](0x1f4,_0x165999[_0x861f('0x14')]));});});};exports[_0x861f('0x46')]=function(_0x10b621){var _0x3c951c=this;return new Promise(function(_0x3d55e7,_0x5de85d){var _0x36a135;var _0x26a7eb;var _0x914e89;var _0x5c10fe;return db[_0x861f('0x19')][_0x861f('0x47')]({'where':_0x10b621[_0x861f('0x1a')][_0x861f('0x1c')]||{},'attributes':['id',_0x861f('0x24'),_0x861f('0x48'),_0x861f('0x49'),_0x861f('0x4a'),_0x861f('0x35'),_0x861f('0x4b'),_0x861f('0x25')]})[_0x861f('0xd')](function(_0x219c8a){if(_0x219c8a){_0x36a135=_0x219c8a;_0x5c10fe=_0x10b621['body']['interface']?_0x10b621[_0x861f('0x32')][_0x861f('0x25')]:util['format']('SIP/%s',_0x36a135['name']);return db[_0x861f('0x19')][_0x861f('0x4c')]({'where':{'role':_0x861f('0x4d'),'online':!![],'id':{'$ne':_0x36a135['id']}}});}})[_0x861f('0xd')](function(_0x2d9482){if(_0x2d9482){_0x914e89=_0x2d9482;return require(_0x861f('0x4e'))['getLicense']();}})['then'](function(_0x4b9f82){if(_0x4b9f82&&_0x4b9f82[_0x861f('0x4f')]&&_0x914e89>=_0x4b9f82[_0x861f('0x4f')]){throw new Error(_0x861f('0x50'));}})[_0x861f('0xd')](function(){if(_0x36a135){return db[_0x861f('0x26')]['destroy']({'where':{'membername':_0x36a135[_0x861f('0x24')]},'individualHooks':!![]});}})[_0x861f('0xd')](function(){if(_0x36a135){return _0x36a135[_0x861f('0x51')]({'raw':!![]});}})[_0x861f('0xd')](function(_0x26764e){if(_0x36a135){if(_0x26764e){var _0x40df9f=[];_0x26a7eb=_0x26764e;if(_0x26a7eb[_0x861f('0x2a')]){for(var _0x40b853=0x0;_0x40b853<_0x26a7eb[_0x861f('0x2a')];_0x40b853++){_0x40df9f[_0x861f('0x30')](db[_0x861f('0x26')][_0x861f('0x52')]({'membername':_0x36a135[_0x861f('0x24')],'UserId':_0x36a135['id'],'queue_name':_0x26a7eb[_0x40b853][_0x861f('0x24')],'VoiceQueueId':_0x26a7eb[_0x40b853]['id'],'interface':_0x5c10fe,'paused':_0x36a135[_0x861f('0x4b')]||![],'penalty':_0x26a7eb[_0x40b853][_0x861f('0x53')]||0x0}));}return BPromise[_0x861f('0x45')](_0x40df9f);}}}})[_0x861f('0xd')](function(){if(_0x36a135){return db[_0x861f('0x27')]['findAll']({'where':{'membername':_0x36a135[_0x861f('0x24')],'exitAt':null}});}})['then'](function(_0x2bd5a2){if(_0x36a135){if(_0x2bd5a2&&_0x2bd5a2['length']){var _0x2dbffa=[];_0x2bd5a2[_0x861f('0x2f')](function(_0x2a2cf7){_0x2dbffa[_0x861f('0x30')](_0x2a2cf7['update']({'exitAt':moment()[_0x861f('0x2b')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x861f('0x45')](_0x2dbffa);}}})[_0x861f('0xd')](function(_0xa172a6){if(_0x36a135){var _0x6dcc99=[];var _0x6bacba=[];var _0x532a8f=utils[_0x861f('0x2e')]();var _0x1bfb10={'membername':_0x36a135[_0x861f('0x24')],'interface':_0x5c10fe,'enterAt':moment()[_0x861f('0x2b')](_0x861f('0x2c')),'role':_0x36a135[_0x861f('0x48')],'internal':_0x36a135[_0x861f('0x35')]};_0x532a8f[_0x861f('0x2f')](function(_0x18ce00){_0x6dcc99[_0x861f('0x30')](_[_0x861f('0x54')]({'channel':_0x18ce00,'type':_0x861f('0x55'),'data1':_0x861f('0x56'),'data2':_0x5c10fe},_0x1bfb10));if(_0x36a135['loginInPause']){_0x6bacba[_0x861f('0x30')](_[_0x861f('0x54')]({'channel':_0x18ce00,'type':_0x861f('0x29'),'data1':_0x861f('0x57')},_0x1bfb10));}});return db['MemberReport'][_0x861f('0x36')](_0x6dcc99[_0x861f('0x58')](_0x6bacba),{'individualHooks':!![]});}})[_0x861f('0xd')](function(){if(_0x36a135){return _0x36a135[_0x861f('0x37')]({'online':!![],'lastLoginAt':moment()[_0x861f('0x2b')](_0x861f('0x2c')),'voicePause':_0x36a135[_0x861f('0x4b')]||![],'mailPause':_0x36a135[_0x861f('0x4b')]||![],'chatPause':_0x36a135['loginInPause']||![],'faxPause':_0x36a135[_0x861f('0x4b')]||![],'smsPause':_0x36a135[_0x861f('0x4b')]||![],'openchannelPause':_0x36a135[_0x861f('0x4b')]||![],'pauseType':_0x36a135[_0x861f('0x4b')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x861f('0x2b')](_0x861f('0x2c')),'interface':_0x5c10fe});}})[_0x861f('0xd')](function(_0xc87396){_0x3d55e7(_0xc87396);})[_0x861f('0x17')](function(_0x25de49){_0x5de85d(_0x3c951c[_0x861f('0x11')](0x1f4,_0x25de49[_0x861f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index a4fe26f..3a2e3f2 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 _0xd53f=['emit','removeListener','register','save','remove'];(function(_0x3ba2a5,_0x47935d){var _0x3fc7e5=function(_0x293607){while(--_0x293607){_0x3ba2a5['push'](_0x3ba2a5['shift']());}};_0x3fc7e5(++_0x47935d);}(_0xd53f,0xa8));var _0xfd53=function(_0x2cfb79,_0x4221a2){_0x2cfb79=_0x2cfb79-0x0;var _0x51a50e=_0xd53f[_0x2cfb79];return _0x51a50e;};'use strict';var UserEvents=require('./user.events');var events=[_0xfd53('0x0'),_0xfd53('0x1'),'update'];function createListener(_0xe5ee28,_0x1955df){return function(_0x962a30){_0x1955df[_0xfd53('0x2')](_0xe5ee28,_0x962a30);};}function removeListener(_0x375b35,_0x3b1405){return function(){UserEvents[_0xfd53('0x3')](_0x375b35,_0x3b1405);};}exports[_0xfd53('0x4')]=function(_0x4a1b78){for(var _0x4c6d5d=0x0,_0x54b5a3=events['length'];_0x4c6d5d<_0x54b5a3;_0x4c6d5d++){var _0x397d96=events[_0x4c6d5d];var _0x546934=createListener('user:'+_0x397d96,_0x4a1b78);UserEvents['on'](_0x397d96,_0x546934);}}; \ No newline at end of file +var _0xf9ac=['update','emit','removeListener','user:','remove'];(function(_0x58c2a0,_0x810117){var _0x250395=function(_0x5ce79c){while(--_0x5ce79c){_0x58c2a0['push'](_0x58c2a0['shift']());}};_0x250395(++_0x810117);}(_0xf9ac,0x176));var _0xcf9a=function(_0xdfbb3b,_0x3cbe34){_0xdfbb3b=_0xdfbb3b-0x0;var _0x14c9a2=_0xf9ac[_0xdfbb3b];return _0x14c9a2;};'use strict';var UserEvents=require('./user.events');var events=['save',_0xcf9a('0x0'),_0xcf9a('0x1')];function createListener(_0xe9d646,_0x149593){return function(_0x3d0f2e){_0x149593[_0xcf9a('0x2')](_0xe9d646,_0x3d0f2e);};}function removeListener(_0x1fc67a,_0x1c81e1){return function(){UserEvents[_0xcf9a('0x3')](_0x1fc67a,_0x1c81e1);};}exports['register']=function(_0x375eb4){for(var _0x544656=0x0,_0x46c3cd=events['length'];_0x544656<_0x46c3cd;_0x544656++){var _0x13ccc5=events[_0x544656];var _0x139564=createListener(_0xcf9a('0x4')+_0x13ccc5,_0x375eb4);UserEvents['on'](_0x13ccc5,_0x139564);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 2d63310..0d555ae 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 _0x56d0=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','util'];(function(_0x3d84de,_0x1d84df){var _0x263536=function(_0xbae6bc){while(--_0xbae6bc){_0x3d84de['push'](_0x3d84de['shift']());}};_0x263536(++_0x1d84df);}(_0x56d0,0x1a7));var _0x056d=function(_0x888385,_0x9cdc66){_0x888385=_0x888385-0x0;var _0x22d5c2=_0x56d0[_0x888385];return _0x22d5c2;};'use strict';var multer=require('multer');var util=require(_0x056d('0x0'));var path=require(_0x056d('0x1'));var timeout=require(_0x056d('0x2'));var express=require(_0x056d('0x3'));var router=express['Router']();var auth=require(_0x056d('0x4'));var interaction=require(_0x056d('0x5'));var config=require(_0x056d('0x6'));module[_0x056d('0x7')]=router; \ No newline at end of file +var _0x300a=['Router','../../components/interaction/service','../../config/environment','multer','util','path','connect-timeout'];(function(_0x43d1e4,_0x198e52){var _0x22f1e6=function(_0x2a23fc){while(--_0x2a23fc){_0x43d1e4['push'](_0x43d1e4['shift']());}};_0x22f1e6(++_0x198e52);}(_0x300a,0x184));var _0xa300=function(_0x4a94d0,_0x374e5d){_0x4a94d0=_0x4a94d0-0x0;var _0x50128a=_0x300a[_0x4a94d0];return _0x50128a;};'use strict';var multer=require(_0xa300('0x0'));var util=require(_0xa300('0x1'));var path=require(_0xa300('0x2'));var timeout=require(_0xa300('0x3'));var express=require('express');var router=express[_0xa300('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa300('0x5'));var config=require(_0xa300('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 6fe68ec..4f13f32 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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x2b42b7,_0x474daa){var _0x41644d=function(_0x953868){while(--_0x953868){_0x2b42b7['push'](_0x2b42b7['shift']());}};_0x41644d(++_0x474daa);}(_0xe706,0xa3));var _0x6e70=function(_0x31c68e,_0x5f0385){_0x31c68e=_0x31c68e-0x0;var _0x159e5d=_0xe706[_0x31c68e];return _0x159e5d;};'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(_0x15d2a2,_0x5055d7){var _0x458346=function(_0x54ac97){while(--_0x54ac97){_0x15d2a2['push'](_0x15d2a2['shift']());}};_0x458346(++_0x5055d7);}(_0xe706,0xa3));var _0x6e70=function(_0x49fcfb,_0x504dec){_0x49fcfb=_0x49fcfb-0x0;var _0x964926=_0xe706[_0x49fcfb];return _0x964926;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 2ba436d..09a1d46 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 _0x5686=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','define','UserChatQueue','user_has_chat_queues','lodash','util'];(function(_0x166e96,_0x55191d){var _0x553d73=function(_0x586142){while(--_0x586142){_0x166e96['push'](_0x166e96['shift']());}};_0x553d73(++_0x55191d);}(_0x5686,0x1be));var _0x6568=function(_0x4b9a62,_0x528ba3){_0x4b9a62=_0x4b9a62-0x0;var _0x45c582=_0x5686[_0x4b9a62];return _0x45c582;};'use strict';var _=require(_0x6568('0x0'));var util=require(_0x6568('0x1'));var logger=require(_0x6568('0x2'))(_0x6568('0x3'));var moment=require(_0x6568('0x4'));var BPromise=require(_0x6568('0x5'));var rp=require(_0x6568('0x6'));var fs=require('fs');var path=require(_0x6568('0x7'));var rimraf=require(_0x6568('0x8'));var config=require(_0x6568('0x9'));var attributes=require(_0x6568('0xa'));module['exports']=function(_0x1f3a97,_0x25b5b4){return _0x1f3a97[_0x6568('0xb')](_0x6568('0xc'),attributes,{'tableName':_0x6568('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x58d5=['util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./userChatQueue.attributes','exports','UserChatQueue','user_has_chat_queues','lodash'];(function(_0x2b97eb,_0x415ba5){var _0x2f5783=function(_0x13aaa4){while(--_0x13aaa4){_0x2b97eb['push'](_0x2b97eb['shift']());}};_0x2f5783(++_0x415ba5);}(_0x58d5,0x107));var _0x558d=function(_0x145fa0,_0x36b0d8){_0x145fa0=_0x145fa0-0x0;var _0x51d2dd=_0x58d5[_0x145fa0];return _0x51d2dd;};'use strict';var _=require(_0x558d('0x0'));var util=require(_0x558d('0x1'));var logger=require(_0x558d('0x2'))('api');var moment=require(_0x558d('0x3'));var BPromise=require(_0x558d('0x4'));var rp=require(_0x558d('0x5'));var fs=require('fs');var path=require(_0x558d('0x6'));var rimraf=require('rimraf');var config=require(_0x558d('0x7'));var attributes=require(_0x558d('0x8'));module[_0x558d('0x9')]=function(_0x58baf5,_0x54061a){return _0x58baf5['define'](_0x558d('0xa'),attributes,{'tableName':_0x558d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 978fa3d..05c12c4 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 _0x50c5=['lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','http','request','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result'];(function(_0x420ec0,_0x42834b){var _0x1c4a5d=function(_0x45ccb7){while(--_0x45ccb7){_0x420ec0['push'](_0x420ec0['shift']());}};_0x1c4a5d(++_0x42834b);}(_0x50c5,0x18c));var _0x550c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x50c5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x550c('0x0'));var util=require('util');var moment=require(_0x550c('0x1'));var BPromise=require(_0x550c('0x2'));var rs=require(_0x550c('0x3'));var fs=require('fs');var Redis=require(_0x550c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x550c('0x5'));var logger=require(_0x550c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x550c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x367eb3,_0x13a3a6,_0x35d750){return new BPromise(function(_0x401743,_0xbf7908){return client[_0x550c('0x8')](_0x367eb3,_0x35d750)['then'](function(_0xd0a508){logger['info'](_0x550c('0x9'),_0x13a3a6,'request\x20sent');logger[_0x550c('0xa')](_0x550c('0xb'),_0x13a3a6,_0x550c('0xc'),JSON[_0x550c('0xd')](_0xd0a508));if(_0xd0a508[_0x550c('0xe')]){if(_0xd0a508[_0x550c('0xe')]['code']===0x1f4){logger[_0x550c('0xe')](_0x550c('0x9'),_0x13a3a6,_0xd0a508[_0x550c('0xe')][_0x550c('0xf')]);return _0xbf7908(_0xd0a508['error'][_0x550c('0xf')]);}logger[_0x550c('0xe')](_0x550c('0x9'),_0x13a3a6,_0xd0a508[_0x550c('0xe')]['message']);return _0x401743(_0xd0a508['error'][_0x550c('0xf')]);}else{logger[_0x550c('0x10')](_0x550c('0x9'),_0x13a3a6,_0x550c('0xc'));_0x401743(_0xd0a508[_0x550c('0x11')][_0x550c('0xf')]);}})['catch'](function(_0x5eeec9){logger[_0x550c('0xe')]('UserChatQueue,\x20%s,\x20%s',_0x13a3a6,_0x5eeec9);_0xbf7908(_0x5eeec9);});});} \ No newline at end of file +var _0x3764=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','result','lodash','moment'];(function(_0x216a4e,_0x572302){var _0x41fc15=function(_0x5c7ebe){while(--_0x5c7ebe){_0x216a4e['push'](_0x216a4e['shift']());}};_0x41fc15(++_0x572302);}(_0x3764,0x108));var _0x4376=function(_0x41bc55,_0x3b2592){_0x41bc55=_0x41bc55-0x0;var _0x5cbcad=_0x3764[_0x41bc55];return _0x5cbcad;};'use strict';var _=require(_0x4376('0x0'));var util=require('util');var moment=require(_0x4376('0x1'));var BPromise=require(_0x4376('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4376('0x3'));var db=require(_0x4376('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4376('0x5'))(_0x4376('0x6'));var config=require(_0x4376('0x7'));var jayson=require(_0x4376('0x8'));var client=jayson[_0x4376('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34cb65,_0x5f1b2c,_0xb56dd7){return new BPromise(function(_0x595f50,_0x47a0b0){return client[_0x4376('0xa')](_0x34cb65,_0xb56dd7)[_0x4376('0xb')](function(_0x46db93){logger[_0x4376('0xc')](_0x4376('0xd'),_0x5f1b2c,_0x4376('0xe'));logger[_0x4376('0xf')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x5f1b2c,_0x4376('0xe'),JSON['stringify'](_0x46db93));if(_0x46db93[_0x4376('0x10')]){if(_0x46db93['error']['code']===0x1f4){logger[_0x4376('0x10')](_0x4376('0xd'),_0x5f1b2c,_0x46db93['error']['message']);return _0x47a0b0(_0x46db93[_0x4376('0x10')][_0x4376('0x11')]);}logger['error'](_0x4376('0xd'),_0x5f1b2c,_0x46db93[_0x4376('0x10')][_0x4376('0x11')]);return _0x595f50(_0x46db93['error'][_0x4376('0x11')]);}else{logger[_0x4376('0xc')]('UserChatQueue,\x20%s,\x20%s',_0x5f1b2c,'request\x20sent');_0x595f50(_0x46db93[_0x4376('0x12')][_0x4376('0x11')]);}})['catch'](function(_0x131762){logger[_0x4376('0x10')](_0x4376('0xd'),_0x5f1b2c,_0x131762);_0x47a0b0(_0x131762);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index b72e328..5b82eb7 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 _0x063d=['path','express','Router','../../components/auth/service','../../config/environment','exports','util'];(function(_0x25ed4c,_0x3b3d52){var _0x430468=function(_0x5287fa){while(--_0x5287fa){_0x25ed4c['push'](_0x25ed4c['shift']());}};_0x430468(++_0x3b3d52);}(_0x063d,0xbc));var _0xd063=function(_0x426986,_0x360d22){_0x426986=_0x426986-0x0;var _0x43e656=_0x063d[_0x426986];return _0x43e656;};'use strict';var multer=require('multer');var util=require(_0xd063('0x0'));var path=require(_0xd063('0x1'));var timeout=require('connect-timeout');var express=require(_0xd063('0x2'));var router=express[_0xd063('0x3')]();var auth=require(_0xd063('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd063('0x5'));module[_0xd063('0x6')]=router; \ No newline at end of file +var _0x1b1a=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x2294a2,_0x4dbeca){var _0x18cd88=function(_0x1b6c85){while(--_0x1b6c85){_0x2294a2['push'](_0x2294a2['shift']());}};_0x18cd88(++_0x4dbeca);}(_0x1b1a,0xdb));var _0xa1b1=function(_0x3c858f,_0x235201){_0x3c858f=_0x3c858f-0x0;var _0x198090=_0x1b1a[_0x3c858f];return _0x198090;};'use strict';var multer=require(_0xa1b1('0x0'));var util=require(_0xa1b1('0x1'));var path=require(_0xa1b1('0x2'));var timeout=require(_0xa1b1('0x3'));var express=require(_0xa1b1('0x4'));var router=express[_0xa1b1('0x5')]();var auth=require(_0xa1b1('0x6'));var interaction=require(_0xa1b1('0x7'));var config=require('../../config/environment');module[_0xa1b1('0x8')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 44ba8b2..6779ad6 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 _0x5c00=['INTEGER','STRING','sequelize','exports'];(function(_0x2bc2a2,_0x51e95f){var _0x20de67=function(_0x27f2d2){while(--_0x27f2d2){_0x2bc2a2['push'](_0x2bc2a2['shift']());}};_0x20de67(++_0x51e95f);}(_0x5c00,0x17e));var _0x05c0=function(_0x5efbd0,_0x299553){_0x5efbd0=_0x5efbd0-0x0;var _0x475ec9=_0x5c00[_0x5efbd0];return _0x475ec9;};'use strict';var Sequelize=require(_0x05c0('0x0'));module[_0x05c0('0x1')]={'penalty':{'type':Sequelize[_0x05c0('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x05c0('0x3')]}}; \ No newline at end of file +var _0x8f4c=['exports','INTEGER','STRING','sequelize'];(function(_0x4d6cdd,_0x452bd6){var _0x380970=function(_0x45e130){while(--_0x45e130){_0x4d6cdd['push'](_0x4d6cdd['shift']());}};_0x380970(++_0x452bd6);}(_0x8f4c,0x113));var _0xc8f4=function(_0xffad76,_0x2d3cd3){_0xffad76=_0xffad76-0x0;var _0x47819c=_0x8f4c[_0xffad76];return _0x47819c;};'use strict';var Sequelize=require(_0xc8f4('0x0'));module[_0xc8f4('0x1')]={'penalty':{'type':Sequelize[_0xc8f4('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xc8f4('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xc8f4('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index e23a1b4..a8f3b73 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 _0x40fb=['moment','bluebird','request-promise','rimraf','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','api'];(function(_0x2d3d1e,_0x37bb2d){var _0x3c045e=function(_0x237447){while(--_0x237447){_0x2d3d1e['push'](_0x2d3d1e['shift']());}};_0x3c045e(++_0x37bb2d);}(_0x40fb,0xb1));var _0xb40f=function(_0x4e0417,_0x574fd4){_0x4e0417=_0x4e0417-0x0;var _0x5d6909=_0x40fb[_0x4e0417];return _0x5d6909;};'use strict';var _=require(_0xb40f('0x0'));var util=require(_0xb40f('0x1'));var logger=require('../../config/logger')(_0xb40f('0x2'));var moment=require(_0xb40f('0x3'));var BPromise=require(_0xb40f('0x4'));var rp=require(_0xb40f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb40f('0x6'));var config=require('../../config/environment');var attributes=require(_0xb40f('0x7'));module[_0xb40f('0x8')]=function(_0x12c365,_0x26dfe4){return _0x12c365[_0xb40f('0x9')](_0xb40f('0xa'),attributes,{'tableName':_0xb40f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x20d9=['bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','define','UserFaxQueue','user_has_fax_queues','util','../../config/logger','api','moment'];(function(_0x2579bd,_0x5a33f7){var _0x3f1b8e=function(_0x277ad8){while(--_0x277ad8){_0x2579bd['push'](_0x2579bd['shift']());}};_0x3f1b8e(++_0x5a33f7);}(_0x20d9,0xcc));var _0x920d=function(_0x4ca073,_0x57db51){_0x4ca073=_0x4ca073-0x0;var _0x34a650=_0x20d9[_0x4ca073];return _0x34a650;};'use strict';var _=require('lodash');var util=require(_0x920d('0x0'));var logger=require(_0x920d('0x1'))(_0x920d('0x2'));var moment=require(_0x920d('0x3'));var BPromise=require(_0x920d('0x4'));var rp=require(_0x920d('0x5'));var fs=require('fs');var path=require(_0x920d('0x6'));var rimraf=require(_0x920d('0x7'));var config=require(_0x920d('0x8'));var attributes=require(_0x920d('0x9'));module['exports']=function(_0x4f828d,_0x3f7122){return _0x4f828d[_0x920d('0xa')](_0x920d('0xb'),attributes,{'tableName':_0x920d('0xc'),'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 b626963..752c224 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 _0xad1b=['UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x369217,_0x25bbdd){var _0x238cc2=function(_0x4869b0){while(--_0x4869b0){_0x369217['push'](_0x369217['shift']());}};_0x238cc2(++_0x25bbdd);}(_0xad1b,0x131));var _0xbad1=function(_0x5d754f,_0x518cae){_0x5d754f=_0x5d754f-0x0;var _0x31ad90=_0xad1b[_0x5d754f];return _0x31ad90;};'use strict';var _=require(_0xbad1('0x0'));var util=require(_0xbad1('0x1'));var moment=require(_0xbad1('0x2'));var BPromise=require(_0xbad1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbad1('0x4'));var db=require(_0xbad1('0x5'))['db'];var utils=require(_0xbad1('0x6'));var logger=require('../../config/logger')(_0xbad1('0x7'));var config=require('../../config/environment');var jayson=require(_0xbad1('0x8'));var client=jayson['client'][_0xbad1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x10fbed,_0x4f148a,_0x49612a){return new BPromise(function(_0x4d7a8b,_0x52dae0){return client[_0xbad1('0xa')](_0x10fbed,_0x49612a)['then'](function(_0x559116){logger[_0xbad1('0xb')](_0xbad1('0xc'),_0x4f148a,_0xbad1('0xd'));logger[_0xbad1('0xe')](_0xbad1('0xf'),_0x4f148a,'request\x20sent',JSON[_0xbad1('0x10')](_0x559116));if(_0x559116[_0xbad1('0x11')]){if(_0x559116[_0xbad1('0x11')]['code']===0x1f4){logger[_0xbad1('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0x4f148a,_0x559116['error'][_0xbad1('0x12')]);return _0x52dae0(_0x559116['error']['message']);}logger[_0xbad1('0x11')](_0xbad1('0xc'),_0x4f148a,_0x559116['error'][_0xbad1('0x12')]);return _0x4d7a8b(_0x559116[_0xbad1('0x11')]['message']);}else{logger[_0xbad1('0xb')](_0xbad1('0xc'),_0x4f148a,'request\x20sent');_0x4d7a8b(_0x559116['result']['message']);}})[_0xbad1('0x13')](function(_0x1fe2e5){logger['error'](_0xbad1('0xc'),_0x4f148a,_0x1fe2e5);_0x52dae0(_0x1fe2e5);});});} \ No newline at end of file +var _0x061a=['stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x417ae1,_0x1a6501){var _0x3fb812=function(_0x41101a){while(--_0x41101a){_0x417ae1['push'](_0x417ae1['shift']());}};_0x3fb812(++_0x1a6501);}(_0x061a,0x13e));var _0xa061=function(_0x5653aa,_0x2eeab9){_0x5653aa=_0x5653aa-0x0;var _0x56320f=_0x061a[_0x5653aa];return _0x56320f;};'use strict';var _=require(_0xa061('0x0'));var util=require(_0xa061('0x1'));var moment=require(_0xa061('0x2'));var BPromise=require(_0xa061('0x3'));var rs=require(_0xa061('0x4'));var fs=require('fs');var Redis=require(_0xa061('0x5'));var db=require(_0xa061('0x6'))['db'];var utils=require(_0xa061('0x7'));var logger=require('../../config/logger')(_0xa061('0x8'));var config=require(_0xa061('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa061('0xa')][_0xa061('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a9db5,_0x2bd646,_0x30fbee){return new BPromise(function(_0x500397,_0x405f12){return client[_0xa061('0xc')](_0x1a9db5,_0x30fbee)[_0xa061('0xd')](function(_0x5d9254){logger['info'](_0xa061('0xe'),_0x2bd646,'request\x20sent');logger[_0xa061('0xf')](_0xa061('0x10'),_0x2bd646,_0xa061('0x11'),JSON[_0xa061('0x12')](_0x5d9254));if(_0x5d9254[_0xa061('0x13')]){if(_0x5d9254[_0xa061('0x13')][_0xa061('0x14')]===0x1f4){logger[_0xa061('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x2bd646,_0x5d9254['error'][_0xa061('0x15')]);return _0x405f12(_0x5d9254[_0xa061('0x13')][_0xa061('0x15')]);}logger['error'](_0xa061('0xe'),_0x2bd646,_0x5d9254[_0xa061('0x13')][_0xa061('0x15')]);return _0x500397(_0x5d9254[_0xa061('0x13')]['message']);}else{logger[_0xa061('0x16')](_0xa061('0xe'),_0x2bd646,_0xa061('0x11'));_0x500397(_0x5d9254[_0xa061('0x17')][_0xa061('0x15')]);}})['catch'](function(_0x22c8f0){logger[_0xa061('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x2bd646,_0x22c8f0);_0x405f12(_0x22c8f0);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 6db22f0..b926f22 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 _0x8f8e=['express','Router','../../config/environment','multer','util','connect-timeout'];(function(_0x3cc4c8,_0x114636){var _0xdc0123=function(_0x1c3078){while(--_0x1c3078){_0x3cc4c8['push'](_0x3cc4c8['shift']());}};_0xdc0123(++_0x114636);}(_0x8f8e,0xf9));var _0xe8f8=function(_0xbb9dbf,_0x5dafa4){_0xbb9dbf=_0xbb9dbf-0x0;var _0x30223c=_0x8f8e[_0xbb9dbf];return _0x30223c;};'use strict';var multer=require(_0xe8f8('0x0'));var util=require(_0xe8f8('0x1'));var path=require('path');var timeout=require(_0xe8f8('0x2'));var express=require(_0xe8f8('0x3'));var router=express[_0xe8f8('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe8f8('0x5'));module['exports']=router; \ No newline at end of file +var _0x8646=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x41521d,_0x4fdba6){var _0x239faf=function(_0x590e5f){while(--_0x590e5f){_0x41521d['push'](_0x41521d['shift']());}};_0x239faf(++_0x4fdba6);}(_0x8646,0x19b));var _0x6864=function(_0x2f613a,_0x37f8ca){_0x2f613a=_0x2f613a-0x0;var _0x102e32=_0x8646[_0x2f613a];return _0x102e32;};'use strict';var multer=require(_0x6864('0x0'));var util=require(_0x6864('0x1'));var path=require(_0x6864('0x2'));var timeout=require(_0x6864('0x3'));var express=require(_0x6864('0x4'));var router=express[_0x6864('0x5')]();var auth=require(_0x6864('0x6'));var interaction=require(_0x6864('0x7'));var config=require(_0x6864('0x8'));module[_0x6864('0x9')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index d668808..f0511df 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(_0x2967c1,_0x202a72){var _0x103397=function(_0x14b5cc){while(--_0x14b5cc){_0x2967c1['push'](_0x2967c1['shift']());}};_0x103397(++_0x202a72);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x589e0d,_0x1b3ce9){var _0x1cf42c=function(_0x320c21){while(--_0x320c21){_0x589e0d['push'](_0x589e0d['shift']());}};_0x1cf42c(++_0x1b3ce9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 126bd87..8b61421 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 _0x757a=['define','user_has_mail_queues','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports'];(function(_0x54d5c8,_0x344ce5){var _0x525e2e=function(_0x4581b7){while(--_0x4581b7){_0x54d5c8['push'](_0x54d5c8['shift']());}};_0x525e2e(++_0x344ce5);}(_0x757a,0xde));var _0xa757=function(_0x113af8,_0x1c95e4){_0x113af8=_0x113af8-0x0;var _0x26a104=_0x757a[_0x113af8];return _0x26a104;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('UserMailQueue',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2032=['user_has_mail_queues','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue'];(function(_0x4629ad,_0x1d8e82){var _0x9ee89=function(_0x5ea879){while(--_0x5ea879){_0x4629ad['push'](_0x4629ad['shift']());}};_0x9ee89(++_0x1d8e82);}(_0x2032,0xd9));var _0x2203=function(_0x48fb79,_0x209698){_0x48fb79=_0x48fb79-0x0;var _0xa8e28c=_0x2032[_0x48fb79];return _0xa8e28c;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var logger=require(_0x2203('0x1'))(_0x2203('0x2'));var moment=require('moment');var BPromise=require(_0x2203('0x3'));var rp=require(_0x2203('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var attributes=require(_0x2203('0x7'));module[_0x2203('0x8')]=function(_0x3f7ba1,_0x13367a){return _0x3f7ba1[_0x2203('0x9')](_0x2203('0xa'),attributes,{'tableName':_0x2203('0xb'),'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 72cdddd..fdc3089 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 _0x483f=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','error','code','message','UserMailQueue,\x20%s,\x20%s','info','result','catch','lodash','util'];(function(_0x4d886a,_0x1980d3){var _0x3fa895=function(_0x3731f8){while(--_0x3731f8){_0x4d886a['push'](_0x4d886a['shift']());}};_0x3fa895(++_0x1980d3);}(_0x483f,0x11c));var _0xf483=function(_0x144b18,_0x423cfa){_0x144b18=_0x144b18-0x0;var _0x46494d=_0x483f[_0x144b18];return _0x46494d;};'use strict';var _=require(_0xf483('0x0'));var util=require(_0xf483('0x1'));var moment=require(_0xf483('0x2'));var BPromise=require(_0xf483('0x3'));var rs=require(_0xf483('0x4'));var fs=require('fs');var Redis=require(_0xf483('0x5'));var db=require(_0xf483('0x6'))['db'];var utils=require(_0xf483('0x7'));var logger=require(_0xf483('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf483('0x9')][_0xf483('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43ec99,_0x2266b5,_0x39761e){return new BPromise(function(_0x44791c,_0x313f61){return client[_0xf483('0xb')](_0x43ec99,_0x39761e)['then'](function(_0x42372a){logger['info']('UserMailQueue,\x20%s,\x20%s',_0x2266b5,_0xf483('0xc'));logger[_0xf483('0xd')](_0xf483('0xe'),_0x2266b5,_0xf483('0xc'),JSON['stringify'](_0x42372a));if(_0x42372a[_0xf483('0xf')]){if(_0x42372a['error'][_0xf483('0x10')]===0x1f4){logger[_0xf483('0xf')]('UserMailQueue,\x20%s,\x20%s',_0x2266b5,_0x42372a[_0xf483('0xf')][_0xf483('0x11')]);return _0x313f61(_0x42372a['error']['message']);}logger[_0xf483('0xf')](_0xf483('0x12'),_0x2266b5,_0x42372a[_0xf483('0xf')][_0xf483('0x11')]);return _0x44791c(_0x42372a[_0xf483('0xf')]['message']);}else{logger[_0xf483('0x13')](_0xf483('0x12'),_0x2266b5,'request\x20sent');_0x44791c(_0x42372a[_0xf483('0x14')][_0xf483('0x11')]);}})[_0xf483('0x15')](function(_0xaaab8f){logger[_0xf483('0xf')](_0xf483('0x12'),_0x2266b5,_0xaaab8f);_0x313f61(_0xaaab8f);});});} \ No newline at end of file +var _0x9075=['message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x323419,_0x2a6172){var _0x4c0be7=function(_0x5ae2df){while(--_0x5ae2df){_0x323419['push'](_0x323419['shift']());}};_0x4c0be7(++_0x2a6172);}(_0x9075,0x7a));var _0x5907=function(_0x5c8c71,_0x421f89){_0x5c8c71=_0x5c8c71-0x0;var _0x38eaef=_0x9075[_0x5c8c71];return _0x38eaef;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5907('0x0'));var BPromise=require(_0x5907('0x1'));var rs=require(_0x5907('0x2'));var fs=require('fs');var Redis=require(_0x5907('0x3'));var db=require(_0x5907('0x4'))['db'];var utils=require(_0x5907('0x5'));var logger=require(_0x5907('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5907('0x7'));var client=jayson[_0x5907('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4aa900,_0x2417f0,_0x5e96e5){return new BPromise(function(_0x3a3e8b,_0x4746b1){return client[_0x5907('0x9')](_0x4aa900,_0x5e96e5)['then'](function(_0x2c576b){logger[_0x5907('0xa')](_0x5907('0xb'),_0x2417f0,_0x5907('0xc'));logger[_0x5907('0xd')](_0x5907('0xe'),_0x2417f0,_0x5907('0xc'),JSON[_0x5907('0xf')](_0x2c576b));if(_0x2c576b[_0x5907('0x10')]){if(_0x2c576b[_0x5907('0x10')][_0x5907('0x11')]===0x1f4){logger[_0x5907('0x10')](_0x5907('0xb'),_0x2417f0,_0x2c576b[_0x5907('0x10')][_0x5907('0x12')]);return _0x4746b1(_0x2c576b['error'][_0x5907('0x12')]);}logger['error'](_0x5907('0xb'),_0x2417f0,_0x2c576b[_0x5907('0x10')][_0x5907('0x12')]);return _0x3a3e8b(_0x2c576b['error'][_0x5907('0x12')]);}else{logger[_0x5907('0xa')]('UserMailQueue,\x20%s,\x20%s',_0x2417f0,_0x5907('0xc'));_0x3a3e8b(_0x2c576b['result'][_0x5907('0x12')]);}})[_0x5907('0x13')](function(_0x30f796){logger['error'](_0x5907('0xb'),_0x2417f0,_0x30f796);_0x4746b1(_0x30f796);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index c37cd16..677a957 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 _0x3d11=['../../components/auth/service','multer','util','path','Router'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x3d11,0x1a5));var _0x13d1=function(_0xec18aa,_0x181a50){_0xec18aa=_0xec18aa-0x0;var _0x51fd4b=_0x3d11[_0xec18aa];return _0x51fd4b;};'use strict';var multer=require(_0x13d1('0x0'));var util=require(_0x13d1('0x1'));var path=require(_0x13d1('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x13d1('0x3')]();var auth=require(_0x13d1('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0x2704=['exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2900bf,_0x396900){var _0x4ff896=function(_0x4366c7){while(--_0x4366c7){_0x2900bf['push'](_0x2900bf['shift']());}};_0x4ff896(++_0x396900);}(_0x2704,0x101));var _0x4270=function(_0x3e079f,_0x189e15){_0x3e079f=_0x3e079f-0x0;var _0x296a34=_0x2704[_0x3e079f];return _0x296a34;};'use strict';var multer=require(_0x4270('0x0'));var util=require(_0x4270('0x1'));var path=require(_0x4270('0x2'));var timeout=require('connect-timeout');var express=require(_0x4270('0x3'));var router=express['Router']();var auth=require(_0x4270('0x4'));var interaction=require(_0x4270('0x5'));var config=require(_0x4270('0x6'));module[_0x4270('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 007c8ce..dca94d3 100644 --- a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js +++ b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x4ed481,_0x1aad66){var _0x553d22=function(_0x464e63){while(--_0x464e63){_0x4ed481['push'](_0x4ed481['shift']());}};_0x553d22(++_0x1aad66);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x3df1e9,_0x3cd30e){var _0xd6b371=function(_0x4b5457){while(--_0x4b5457){_0x3df1e9['push'](_0x3df1e9['shift']());}};_0xd6b371(++_0x3cd30e);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 16fe509..7d081a2 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 _0x60c7=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash'];(function(_0x21e63b,_0x27a1db){var _0x5421b5=function(_0x4b4cca){while(--_0x4b4cca){_0x21e63b['push'](_0x21e63b['shift']());}};_0x5421b5(++_0x27a1db);}(_0x60c7,0x15d));var _0x760c=function(_0x2af2f8,_0x27009d){_0x2af2f8=_0x2af2f8-0x0;var _0x209109=_0x60c7[_0x2af2f8];return _0x209109;};'use strict';var _=require(_0x760c('0x0'));var util=require(_0x760c('0x1'));var logger=require(_0x760c('0x2'))('api');var moment=require(_0x760c('0x3'));var BPromise=require(_0x760c('0x4'));var rp=require(_0x760c('0x5'));var fs=require('fs');var path=require(_0x760c('0x6'));var rimraf=require(_0x760c('0x7'));var config=require(_0x760c('0x8'));var attributes=require(_0x760c('0x9'));module[_0x760c('0xa')]=function(_0x37f380,_0x372161){return _0x37f380[_0x760c('0xb')](_0x760c('0xc'),attributes,{'tableName':_0x760c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a73=['user_has_openchannel_queues','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue'];(function(_0x27830a,_0x4e8504){var _0x32ccc3=function(_0x1e17f3){while(--_0x1e17f3){_0x27830a['push'](_0x27830a['shift']());}};_0x32ccc3(++_0x4e8504);}(_0x9a73,0x7a));var _0x39a7=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x9a73[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x39a7('0x0'));var logger=require(_0x39a7('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x39a7('0x2'));var fs=require('fs');var path=require(_0x39a7('0x3'));var rimraf=require(_0x39a7('0x4'));var config=require(_0x39a7('0x5'));var attributes=require(_0x39a7('0x6'));module[_0x39a7('0x7')]=function(_0x2b4067,_0x357cf8){return _0x2b4067[_0x39a7('0x8')](_0x39a7('0x9'),attributes,{'tableName':_0x39a7('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 1c0a496..4258edc 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 _0x132d=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0x132d,0x1b5));var _0xd132=function(_0x30a75f,_0x1ebfe7){_0x30a75f=_0x30a75f-0x0;var _0x64a76f=_0x132d[_0x30a75f];return _0x64a76f;};'use strict';var _=require(_0xd132('0x0'));var util=require(_0xd132('0x1'));var moment=require(_0xd132('0x2'));var BPromise=require(_0xd132('0x3'));var rs=require(_0xd132('0x4'));var fs=require('fs');var Redis=require(_0xd132('0x5'));var db=require(_0xd132('0x6'))['db'];var utils=require(_0xd132('0x7'));var logger=require('../../config/logger')(_0xd132('0x8'));var config=require('../../config/environment');var jayson=require(_0xd132('0x9'));var client=jayson[_0xd132('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x314fe4,_0x2c32b8,_0x3d6af0){return new BPromise(function(_0x5ce308,_0x4faee6){return client[_0xd132('0xb')](_0x314fe4,_0x3d6af0)[_0xd132('0xc')](function(_0x3b0911){logger[_0xd132('0xd')](_0xd132('0xe'),_0x2c32b8,_0xd132('0xf'));logger[_0xd132('0x10')](_0xd132('0x11'),_0x2c32b8,_0xd132('0xf'),JSON['stringify'](_0x3b0911));if(_0x3b0911[_0xd132('0x12')]){if(_0x3b0911['error'][_0xd132('0x13')]===0x1f4){logger[_0xd132('0x12')](_0xd132('0xe'),_0x2c32b8,_0x3b0911[_0xd132('0x12')][_0xd132('0x14')]);return _0x4faee6(_0x3b0911[_0xd132('0x12')][_0xd132('0x14')]);}logger[_0xd132('0x12')](_0xd132('0xe'),_0x2c32b8,_0x3b0911['error'][_0xd132('0x14')]);return _0x5ce308(_0x3b0911[_0xd132('0x12')][_0xd132('0x14')]);}else{logger[_0xd132('0xd')](_0xd132('0xe'),_0x2c32b8,_0xd132('0xf'));_0x5ce308(_0x3b0911['result'][_0xd132('0x14')]);}})[_0xd132('0x15')](function(_0x5bfb35){logger[_0xd132('0x12')](_0xd132('0xe'),_0x2c32b8,_0x5bfb35);_0x4faee6(_0x5bfb35);});});} \ No newline at end of file +var _0xd2c4=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','stringify','code','error','message','result'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xd2c4,0x91));var _0x4d2c=function(_0x145b54,_0x267c42){_0x145b54=_0x145b54-0x0;var _0x52007e=_0xd2c4[_0x145b54];return _0x52007e;};'use strict';var _=require(_0x4d2c('0x0'));var util=require(_0x4d2c('0x1'));var moment=require(_0x4d2c('0x2'));var BPromise=require(_0x4d2c('0x3'));var rs=require(_0x4d2c('0x4'));var fs=require('fs');var Redis=require(_0x4d2c('0x5'));var db=require(_0x4d2c('0x6'))['db'];var utils=require(_0x4d2c('0x7'));var logger=require(_0x4d2c('0x8'))(_0x4d2c('0x9'));var config=require(_0x4d2c('0xa'));var jayson=require(_0x4d2c('0xb'));var client=jayson[_0x4d2c('0xc')][_0x4d2c('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x336905,_0x527d51,_0x13c4a8){return new BPromise(function(_0xa63cac,_0x6e6516){return client[_0x4d2c('0xe')](_0x336905,_0x13c4a8)[_0x4d2c('0xf')](function(_0x528e84){logger[_0x4d2c('0x10')](_0x4d2c('0x11'),_0x527d51,'request\x20sent');logger['debug']('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x527d51,'request\x20sent',JSON[_0x4d2c('0x12')](_0x528e84));if(_0x528e84['error']){if(_0x528e84['error'][_0x4d2c('0x13')]===0x1f4){logger[_0x4d2c('0x14')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x527d51,_0x528e84[_0x4d2c('0x14')][_0x4d2c('0x15')]);return _0x6e6516(_0x528e84['error'][_0x4d2c('0x15')]);}logger[_0x4d2c('0x14')](_0x4d2c('0x11'),_0x527d51,_0x528e84['error'][_0x4d2c('0x15')]);return _0xa63cac(_0x528e84['error'][_0x4d2c('0x15')]);}else{logger['info'](_0x4d2c('0x11'),_0x527d51,'request\x20sent');_0xa63cac(_0x528e84[_0x4d2c('0x16')]['message']);}})[_0x4d2c('0x17')](function(_0x24b24a){logger[_0x4d2c('0x14')](_0x4d2c('0x11'),_0x527d51,_0x24b24a);_0x6e6516(_0x24b24a);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index ef09985..67bc893 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 _0xfd59=['../../config/environment','./userProfile.controller','get','isAuthenticated','/describe','/:id','/:id/sections','getSections','/:id/resources','getResources','post','clone','addResources','put','delete','destroy','removeResources','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x34a923,_0x3ce38d){var _0x46442b=function(_0x110960){while(--_0x110960){_0x34a923['push'](_0x34a923['shift']());}};_0x46442b(++_0x3ce38d);}(_0xfd59,0xe9));var _0x9fd5=function(_0x5976be,_0x43e64f){_0x5976be=_0x5976be-0x0;var _0x54fc72=_0xfd59[_0x5976be];return _0x54fc72;};'use strict';var multer=require(_0x9fd5('0x0'));var util=require(_0x9fd5('0x1'));var path=require(_0x9fd5('0x2'));var timeout=require(_0x9fd5('0x3'));var express=require(_0x9fd5('0x4'));var router=express['Router']();var auth=require(_0x9fd5('0x5'));var interaction=require(_0x9fd5('0x6'));var config=require(_0x9fd5('0x7'));var controller=require(_0x9fd5('0x8'));router[_0x9fd5('0x9')]('/',auth[_0x9fd5('0xa')](),controller['index']);router[_0x9fd5('0x9')](_0x9fd5('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x9fd5('0x9')](_0x9fd5('0xc'),auth[_0x9fd5('0xa')](),controller['show']);router[_0x9fd5('0x9')](_0x9fd5('0xd'),auth[_0x9fd5('0xa')](),controller[_0x9fd5('0xe')]);router[_0x9fd5('0x9')](_0x9fd5('0xf'),auth['isAuthenticated'](),controller[_0x9fd5('0x10')]);router[_0x9fd5('0x11')]('/',auth[_0x9fd5('0xa')](),controller['create']);router[_0x9fd5('0x11')]('/:id/clone',auth[_0x9fd5('0xa')](),controller[_0x9fd5('0x12')]);router[_0x9fd5('0x11')](_0x9fd5('0xd'),auth[_0x9fd5('0xa')](),controller['addSections']);router[_0x9fd5('0x11')]('/:id/resources',auth[_0x9fd5('0xa')](),controller[_0x9fd5('0x13')]);router[_0x9fd5('0x14')](_0x9fd5('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x9fd5('0x15')](_0x9fd5('0xc'),auth[_0x9fd5('0xa')](),controller[_0x9fd5('0x16')]);router[_0x9fd5('0x15')]('/:id/sections',auth[_0x9fd5('0xa')](),controller['removeSections']);router[_0x9fd5('0x15')](_0x9fd5('0xf'),auth[_0x9fd5('0xa')](),controller[_0x9fd5('0x17')]);module['exports']=router; \ No newline at end of file +var _0x2aa4=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','addSections','put','delete','destroy','removeSections','exports'];(function(_0x106942,_0xe3b7a0){var _0x580510=function(_0x1553b2){while(--_0x1553b2){_0x106942['push'](_0x106942['shift']());}};_0x580510(++_0xe3b7a0);}(_0x2aa4,0x105));var _0x42aa=function(_0xedd02d,_0x395bfd){_0xedd02d=_0xedd02d-0x0;var _0xcf9793=_0x2aa4[_0xedd02d];return _0xcf9793;};'use strict';var multer=require(_0x42aa('0x0'));var util=require(_0x42aa('0x1'));var path=require(_0x42aa('0x2'));var timeout=require(_0x42aa('0x3'));var express=require('express');var router=express[_0x42aa('0x4')]();var auth=require(_0x42aa('0x5'));var interaction=require(_0x42aa('0x6'));var config=require(_0x42aa('0x7'));var controller=require(_0x42aa('0x8'));router['get']('/',auth[_0x42aa('0x9')](),controller[_0x42aa('0xa')]);router[_0x42aa('0xb')](_0x42aa('0xc'),auth[_0x42aa('0x9')](),controller[_0x42aa('0xd')]);router['get'](_0x42aa('0xe'),auth[_0x42aa('0x9')](),controller['show']);router[_0x42aa('0xb')](_0x42aa('0xf'),auth[_0x42aa('0x9')](),controller[_0x42aa('0x10')]);router[_0x42aa('0xb')](_0x42aa('0x11'),auth['isAuthenticated'](),controller[_0x42aa('0x12')]);router[_0x42aa('0x13')]('/',auth[_0x42aa('0x9')](),controller[_0x42aa('0x14')]);router['post'](_0x42aa('0x15'),auth[_0x42aa('0x9')](),controller[_0x42aa('0x16')]);router[_0x42aa('0x13')](_0x42aa('0xf'),auth[_0x42aa('0x9')](),controller[_0x42aa('0x17')]);router[_0x42aa('0x13')](_0x42aa('0x11'),auth[_0x42aa('0x9')](),controller['addResources']);router[_0x42aa('0x18')](_0x42aa('0xe'),auth[_0x42aa('0x9')](),controller['update']);router[_0x42aa('0x19')](_0x42aa('0xe'),auth[_0x42aa('0x9')](),controller[_0x42aa('0x1a')]);router[_0x42aa('0x19')](_0x42aa('0xf'),auth['isAuthenticated'](),controller[_0x42aa('0x1b')]);router[_0x42aa('0x19')](_0x42aa('0x11'),auth[_0x42aa('0x9')](),controller['removeResources']);module[_0x42aa('0x1c')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index be0faac..f7fc3fd 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 _0xa0d5=['join','getDataValue','split','exports','setDataValue','crudPermissions'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0xa0d5,0xab));var _0x5a0d=function(_0x52bfa5,_0x42cf21){_0x52bfa5=_0x52bfa5-0x0;var _0x26f80b=_0xa0d5[_0x52bfa5];return _0x26f80b;};'use strict';var Sequelize=require('sequelize');module[_0x5a0d('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x532f45){this[_0x5a0d('0x1')](_0x5a0d('0x2'),_0x532f45?_0x532f45[_0x5a0d('0x3')](''):[]);},'get':function(){return this[_0x5a0d('0x4')](_0x5a0d('0x2'))?this[_0x5a0d('0x4')]('crudPermissions')[_0x5a0d('0x5')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x4fe5=['STRING','name','setDataValue','getDataValue','crudPermissions','split','sequelize'];(function(_0x33b359,_0x24e70a){var _0x320d4f=function(_0x4c7717){while(--_0x4c7717){_0x33b359['push'](_0x33b359['shift']());}};_0x320d4f(++_0x24e70a);}(_0x4fe5,0xbc));var _0x54fe=function(_0x4fe9f4,_0x499a4b){_0x4fe9f4=_0x4fe9f4-0x0;var _0x58c073=_0x4fe5[_0x4fe9f4];return _0x58c073;};'use strict';var Sequelize=require(_0x54fe('0x0'));module['exports']={'name':{'type':Sequelize[_0x54fe('0x1')],'allowNull':![],'unique':_0x54fe('0x2')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x421b97){this[_0x54fe('0x3')]('crudPermissions',_0x421b97?_0x421b97['join'](''):[]);},'get':function(){return this[_0x54fe('0x4')](_0x54fe('0x5'))?this['getDataValue'](_0x54fe('0x5'))[_0x54fe('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x54fe('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 0a041ce..a67081b 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 _0xccd0=['voicequeues','queuecampaigns','Users','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','Dashboard','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','templates','Template','triggers','variables','Variable','plugins','Plugin','extractedreports','reportId','metrics','AnalyticMetric','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','count','offset','limit','set','Content-Range','json','save','update','then','error','name','send','index','UserProfile','rawAttributes','fieldName','type','key','model','map','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','clone','get','omit','createdAt','crudPermissions','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','updatedAt','sectionId','userProfileId','Resources','describe','addSections','destroy','ids','enabled','includes','subsections','push','forEach','resourceId','bulkCreate','removeResources','getResources','undefined','Sequelize','ValidationError','Unknown\x20section','mergeResources','isEmpty','parentSections','findOne','ignore','union','childModel','all','field','foreignKey','associatedResources','AnalyticExtractedReport','reportType','DefaultReports','custom','CustomReports','rows','CmContact','Tag','Tags','color','tag','toLowerCase','squareprojects','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','contacts','Lists','ListId','CmList','companies','CmCompany','globalcustomfields','CmCustomField','ChatQueue','chatwebsites','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceMail','voicerecordings','VoiceRecording','Agents','User','role','agent','Telephones','membername','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','ivrcampaigns','Campaign','mailqueues','MailQueue','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams'];(function(_0x88b8bb,_0x471e65){var _0x5b814d=function(_0x39fbb1){while(--_0x39fbb1){_0x88b8bb['push'](_0x88b8bb['shift']());}};_0x5b814d(++_0x471e65);}(_0xccd0,0x114));var _0x0ccd=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xccd0[_0x502c7d];return _0x30b7ed;};'use strict';var pdf=require(_0x0ccd('0x0'));var emlformat=require(_0x0ccd('0x1'));var rimraf=require(_0x0ccd('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0ccd('0x3'));var rp=require(_0x0ccd('0x4'));var moment=require(_0x0ccd('0x5'));var BPromise=require(_0x0ccd('0x6'));var Mustache=require(_0x0ccd('0x7'));var util=require(_0x0ccd('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x0ccd('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x0ccd('0xa'));var crypto=require('crypto');var jsforce=require(_0x0ccd('0xb'));var deskjs=require(_0x0ccd('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0ccd('0xd'));var Papa=require(_0x0ccd('0xe'));var Redis=require(_0x0ccd('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0ccd('0x10'));var logger=require(_0x0ccd('0x11'))(_0x0ccd('0x12'));var utils=require(_0x0ccd('0x13'));var config=require(_0x0ccd('0x14'));var db=require('../../mysqldb')['db'];config[_0x0ccd('0x15')]=_[_0x0ccd('0x16')](config[_0x0ccd('0x15')],{'host':_0x0ccd('0x17'),'port':0x18eb});var socket=require(_0x0ccd('0x18'))(new Redis(config[_0x0ccd('0x15')]));require(_0x0ccd('0x19'))[_0x0ccd('0x1a')](socket);function respondWithStatusCode(_0x5e9cb7,_0x4be7f5){_0x4be7f5=_0x4be7f5||0xcc;return function(_0x5e4c1d){if(_0x5e4c1d){return _0x5e9cb7[_0x0ccd('0x1b')](_0x4be7f5);}return _0x5e9cb7[_0x0ccd('0x1c')](_0x4be7f5)[_0x0ccd('0x1d')]();};}function respondWithResult(_0x59f341,_0x5d4844){_0x5d4844=_0x5d4844||0xc8;return function(_0x597b4e){if(_0x597b4e){return _0x59f341['status'](_0x5d4844)['json'](_0x597b4e);}};}function respondWithFilteredResult(_0x5b5857,_0x496a19){return function(_0x11c7db){if(_0x11c7db){var _0x372164=_0x11c7db[_0x0ccd('0x1e')],_0x784e68=_0x496a19[_0x0ccd('0x1f')],_0x434b45=_0x496a19['offset']+_0x496a19[_0x0ccd('0x20')],_0x490796;if(_0x434b45>=_0x372164){_0x434b45=_0x372164;_0x490796=0xc8;}else{_0x490796=0xce;}_0x5b5857[_0x0ccd('0x1c')](_0x490796);return _0x5b5857[_0x0ccd('0x21')](_0x0ccd('0x22'),_0x784e68+'-'+_0x434b45+'/'+_0x372164)[_0x0ccd('0x23')](_0x11c7db);}return null;};}function patchUpdates(_0x2ec886){return function(_0x53211f){try{jsonpatch['apply'](_0x53211f,_0x2ec886,!![]);}catch(_0x466a0b){return BPromise['reject'](_0x466a0b);}return _0x53211f[_0x0ccd('0x24')]();};}function saveUpdates(_0x15ac4d,_0x19f2ef){return function(_0x390148){if(_0x390148){return _0x390148[_0x0ccd('0x25')](_0x15ac4d)[_0x0ccd('0x26')](function(_0x18d346){return _0x18d346;});}return null;};}function removeEntity(_0x237e93,_0x33efe1){return function(_0xca250){if(_0xca250){return _0xca250['destroy']()[_0x0ccd('0x26')](function(){_0x237e93['status'](0xcc)[_0x0ccd('0x1d')]();});}};}function handleEntityNotFound(_0x1ec2cb,_0x390f4d){return function(_0x5f213d){if(!_0x5f213d){_0x1ec2cb[_0x0ccd('0x1b')](0x194);}return _0x5f213d;};}function handleError(_0x3fd1d8,_0x534265){_0x534265=_0x534265||0x1f4;return function(_0x362572){logger[_0x0ccd('0x27')](_0x362572['stack']);if(_0x362572[_0x0ccd('0x28')]){delete _0x362572['name'];}_0x3fd1d8[_0x0ccd('0x1c')](_0x534265)[_0x0ccd('0x29')](_0x362572);};}exports[_0x0ccd('0x2a')]=function(_0x508927,_0x44152c){var _0xe2692c={},_0x22e451={},_0x4d8f9a={'count':0x0,'rows':[]};var _0x50fea2=_['map'](db[_0x0ccd('0x2b')][_0x0ccd('0x2c')],function(_0x109da8){return{'name':_0x109da8[_0x0ccd('0x2d')],'type':_0x109da8[_0x0ccd('0x2e')][_0x0ccd('0x2f')]};});_0x22e451[_0x0ccd('0x30')]=_[_0x0ccd('0x31')](_0x50fea2,_0x0ccd('0x28'));_0x22e451['query']=_['keys'](_0x508927['query']);_0x22e451[_0x0ccd('0x32')]=_[_0x0ccd('0x33')](_0x22e451['model'],_0x22e451[_0x0ccd('0x34')]);_0xe2692c[_0x0ccd('0x35')]=_[_0x0ccd('0x33')](_0x22e451[_0x0ccd('0x30')],qs[_0x0ccd('0x36')](_0x508927[_0x0ccd('0x34')][_0x0ccd('0x36')]));_0xe2692c['attributes']=_0xe2692c[_0x0ccd('0x35')][_0x0ccd('0x37')]?_0xe2692c['attributes']:_0x22e451['model'];if(!_0x508927[_0x0ccd('0x34')][_0x0ccd('0x38')](_0x0ccd('0x39'))){_0xe2692c[_0x0ccd('0x20')]=qs[_0x0ccd('0x20')](_0x508927[_0x0ccd('0x34')]['limit']);_0xe2692c[_0x0ccd('0x1f')]=qs[_0x0ccd('0x1f')](_0x508927[_0x0ccd('0x34')][_0x0ccd('0x1f')]);}_0xe2692c[_0x0ccd('0x3a')]=qs[_0x0ccd('0x3b')](_0x508927[_0x0ccd('0x34')]['sort']);_0xe2692c['where']=qs[_0x0ccd('0x32')](_[_0x0ccd('0x3c')](_0x508927[_0x0ccd('0x34')],_0x22e451[_0x0ccd('0x32')]),_0x50fea2);if(_0x508927[_0x0ccd('0x34')][_0x0ccd('0x3d')]){_0xe2692c[_0x0ccd('0x3e')]=_[_0x0ccd('0x3f')](_0xe2692c[_0x0ccd('0x3e')],{'$or':_[_0x0ccd('0x31')](_0x50fea2,function(_0x34e895){if(_0x34e895[_0x0ccd('0x2e')]!==_0x0ccd('0x40')){var _0x453ba6={};_0x453ba6[_0x34e895[_0x0ccd('0x28')]]={'$like':'%'+_0x508927[_0x0ccd('0x34')][_0x0ccd('0x3d')]+'%'};return _0x453ba6;}})});}_0xe2692c=_['merge']({},_0xe2692c,_0x508927[_0x0ccd('0x41')]);var _0x5dbac9={'where':_0xe2692c[_0x0ccd('0x3e')]};return db['UserProfile'][_0x0ccd('0x1e')](_0x5dbac9)[_0x0ccd('0x26')](function(_0x36d2b7){_0x4d8f9a[_0x0ccd('0x1e')]=_0x36d2b7;if(_0x508927[_0x0ccd('0x34')][_0x0ccd('0x42')]){_0xe2692c[_0x0ccd('0x43')]=[{'all':!![]}];}return db[_0x0ccd('0x2b')][_0x0ccd('0x44')](_0xe2692c);})[_0x0ccd('0x26')](function(_0x3b3015){_0x4d8f9a['rows']=_0x3b3015;return _0x4d8f9a;})['then'](respondWithFilteredResult(_0x44152c,_0xe2692c))[_0x0ccd('0x45')](handleError(_0x44152c,null));};exports[_0x0ccd('0x46')]=function(_0x2fca8d,_0x4098f8){var _0x9342b9={'raw':![],'where':{'id':_0x2fca8d[_0x0ccd('0x47')]['id']}},_0x3e0e63={};_0x3e0e63[_0x0ccd('0x30')]=_[_0x0ccd('0x48')](db[_0x0ccd('0x2b')][_0x0ccd('0x2c')]);_0x3e0e63[_0x0ccd('0x34')]=_[_0x0ccd('0x48')](_0x2fca8d[_0x0ccd('0x34')]);_0x3e0e63[_0x0ccd('0x32')]=_[_0x0ccd('0x33')](_0x3e0e63[_0x0ccd('0x30')],_0x3e0e63[_0x0ccd('0x34')]);_0x9342b9[_0x0ccd('0x35')]=_['intersection'](_0x3e0e63['model'],qs['fields'](_0x2fca8d['query'][_0x0ccd('0x36')]));_0x9342b9['attributes']=_0x9342b9[_0x0ccd('0x35')][_0x0ccd('0x37')]?_0x9342b9[_0x0ccd('0x35')]:_0x3e0e63[_0x0ccd('0x30')];if(_0x2fca8d['query']['includeAll']){_0x9342b9['include']=[{'all':!![]}];}_0x9342b9=_[_0x0ccd('0x3f')]({},_0x9342b9,_0x2fca8d[_0x0ccd('0x41')]);return db[_0x0ccd('0x2b')][_0x0ccd('0x49')](_0x9342b9)['then'](handleEntityNotFound(_0x4098f8,null))[_0x0ccd('0x26')](respondWithResult(_0x4098f8,null))[_0x0ccd('0x45')](handleError(_0x4098f8,null));};exports['create']=function(_0x30def2,_0x218c78){return db['UserProfile'][_0x0ccd('0x4a')](_0x30def2[_0x0ccd('0x4b')],{})[_0x0ccd('0x26')](respondWithResult(_0x218c78,0xc9))[_0x0ccd('0x45')](handleError(_0x218c78,null));};exports[_0x0ccd('0x4c')]=function(_0xdb3c6d,_0x1ed9ba){var _0x15a61c={'where':{'id':_0xdb3c6d[_0x0ccd('0x47')]['id']}},_0x6002e={};_0x6002e[_0x0ccd('0x30')]=_[_0x0ccd('0x48')](db[_0x0ccd('0x2b')][_0x0ccd('0x2c')]);_0x15a61c[_0x0ccd('0x35')]=_[_0x0ccd('0x33')](_0x6002e[_0x0ccd('0x30')],qs[_0x0ccd('0x36')](_0xdb3c6d[_0x0ccd('0x34')][_0x0ccd('0x36')]));_0x15a61c['attributes']=_0x15a61c[_0x0ccd('0x35')][_0x0ccd('0x37')]?_0x15a61c['attributes']:_0x6002e[_0x0ccd('0x30')];if(_0xdb3c6d['query'][_0x0ccd('0x42')]){_0x15a61c[_0x0ccd('0x43')]=[{'all':!![]}];}_0x15a61c=_[_0x0ccd('0x3f')]({},_0x15a61c,_0xdb3c6d['options']);return db[_0x0ccd('0x2b')][_0x0ccd('0x49')](_0x15a61c)[_0x0ccd('0x26')](handleEntityNotFound(_0x1ed9ba,null))[_0x0ccd('0x26')](function(_0x2f9272){if(_0x2f9272){var _0x3153cd=_0x2f9272[_0x0ccd('0x4d')]({'plain':!![]});_0x3153cd=qs[_0x0ccd('0x4e')](_0x3153cd,['id',_0x0ccd('0x4f'),'updatedAt',_0x0ccd('0x50')]);_0xdb3c6d['body']=_[_0x0ccd('0x4e')](_0xdb3c6d[_0x0ccd('0x4b')],['id',_0x0ccd('0x4f'),'updatedAt']);return db[_0x0ccd('0x51')][_0x0ccd('0x52')](function(_0x18fc91){return db[_0x0ccd('0x2b')]['create'](_[_0x0ccd('0x3f')](_0x3153cd,_0xdb3c6d[_0x0ccd('0x4b')]),{'include':_0xdb3c6d[_0x0ccd('0x34')][_0x0ccd('0x42')]?[{'all':!![]}]:undefined,'transaction':_0x18fc91})[_0x0ccd('0x26')](function(_0x340c10){var _0x496653=_0x340c10[_0x0ccd('0x4d')]({'plain':!![]});return db[_0x0ccd('0x53')][_0x0ccd('0x44')]({'where':{'userProfileId':_0xdb3c6d[_0x0ccd('0x47')]['id']},'raw':!![]})[_0x0ccd('0x26')](function(_0x336af5){if(_0x336af5){return BPromise[_0x0ccd('0x54')](_0x336af5,function(_0x445056){return new BPromise(function(_0xff21bb,_0x57e5f3){if(_0x445056[_0x0ccd('0x55')]===null||_0x445056['autoAssociation']===0x1)_0xff21bb(null);return db[_0x0ccd('0x56')][_0x0ccd('0x44')]({'where':{'sectionId':_0x445056['id']},'raw':!![]})[_0x0ccd('0x26')](function(_0x504541){var _0x477284=_['map'](_0x504541,function(_0x217ed4){return qs[_0x0ccd('0x4e')](_0x217ed4,['id',_0x0ccd('0x4f'),_0x0ccd('0x57'),_0x0ccd('0x58')]);});_0xff21bb(_0x477284);})[_0x0ccd('0x45')](function(_0x3e41c2){_0x57e5f3(_0x3e41c2);});})[_0x0ccd('0x26')](function(_0xed8b51){var _0xeaa8d6=qs[_0x0ccd('0x4e')](_0x445056,['id',_0x0ccd('0x4f'),_0x0ccd('0x57')]);_0xeaa8d6[_0x0ccd('0x59')]=_0x496653['id'];if(_0xed8b51)_0xeaa8d6[_0x0ccd('0x5a')]=_0xed8b51;return _0xeaa8d6;})['then'](function(_0x22398b){return db[_0x0ccd('0x53')][_0x0ccd('0x4a')](_0x22398b,{'include':[{'model':db[_0x0ccd('0x56')],'as':_0x0ccd('0x5a')}],'raw':!![],'transaction':_0x18fc91});});})[_0x0ccd('0x26')](function(){return _0x496653;});}});});});}})[_0x0ccd('0x26')](respondWithResult(_0x1ed9ba,0xc9))[_0x0ccd('0x45')](handleError(_0x1ed9ba,null));};exports['update']=function(_0x2d232a,_0x1bd093){if(_0x2d232a[_0x0ccd('0x4b')]['id']){delete _0x2d232a[_0x0ccd('0x4b')]['id'];}return db['UserProfile'][_0x0ccd('0x49')]({'where':{'id':_0x2d232a[_0x0ccd('0x47')]['id']}})['then'](handleEntityNotFound(_0x1bd093,null))[_0x0ccd('0x26')](saveUpdates(_0x2d232a['body'],null))[_0x0ccd('0x26')](respondWithResult(_0x1bd093,null))[_0x0ccd('0x45')](handleError(_0x1bd093,null));};exports['destroy']=function(_0xf1b24a,_0x42c05f){return db[_0x0ccd('0x2b')][_0x0ccd('0x49')]({'where':{'id':_0xf1b24a['params']['id']}})['then'](handleEntityNotFound(_0x42c05f,null))['then'](removeEntity(_0x42c05f,null))[_0x0ccd('0x45')](handleError(_0x42c05f,null));};exports[_0x0ccd('0x5b')]=function(_0x11e3f9,_0x7302dd){return db[_0x0ccd('0x2b')]['describe']()[_0x0ccd('0x26')](respondWithResult(_0x7302dd,null))[_0x0ccd('0x45')](handleError(_0x7302dd,null));};exports[_0x0ccd('0x5c')]=function(_0x25147b,_0x3bd5c0){var _0x3f8e24=_0x25147b[_0x0ccd('0x4b')];return db[_0x0ccd('0x2b')][_0x0ccd('0x49')]({'where':{'id':_0x25147b['params']['id']}})[_0x0ccd('0x26')](handleEntityNotFound(_0x3bd5c0,null))[_0x0ccd('0x26')](function(_0x7004b9){if(_0x7004b9){return db['sequelize']['transaction'](function(_0x3b21f1){return db[_0x0ccd('0x53')][_0x0ccd('0x5d')]({'where':{'userProfileId':_0x25147b[_0x0ccd('0x47')]['id'],'sectionId':_[_0x0ccd('0x31')](_0x3f8e24,function(_0x34072c){return _0x34072c['sectionId'];})},'transaction':_0x3b21f1})[_0x0ccd('0x26')](function(){var _0x2bb016=_['map'](_0x3f8e24,function(_0x2c303b){_0x2c303b['userProfileId']=_0x25147b[_0x0ccd('0x47')]['id'];return _0x2c303b;});var _0x10308=[];return BPromise['each'](_0x2bb016,function(_0x1e5f7c){return db[_0x0ccd('0x53')][_0x0ccd('0x4a')](_0x1e5f7c,{'include':[{'model':db[_0x0ccd('0x56')],'as':_0x0ccd('0x5a')}],'raw':!![],'transaction':_0x3b21f1})[_0x0ccd('0x26')](function(_0x3d88b0){_0x10308['push'](_0x3d88b0[_0x0ccd('0x4d')]({'plain':!![]}));});})[_0x0ccd('0x26')](function(){return _0x10308;});});});}})[_0x0ccd('0x26')](function(_0x52e569){return _0x52e569;})['then'](respondWithResult(_0x3bd5c0,null))[_0x0ccd('0x45')](handleError(_0x3bd5c0,null));};exports['removeSections']=function(_0x3a6383,_0x1c86fd){var _0x47fc0;return db[_0x0ccd('0x2b')][_0x0ccd('0x49')]({'where':{'id':_0x3a6383[_0x0ccd('0x47')]['id']},'attributes':['id',_0x0ccd('0x28')]})[_0x0ccd('0x26')](handleEntityNotFound(_0x1c86fd,null))[_0x0ccd('0x26')](function(_0x55c52a){if(_0x55c52a){_0x47fc0=_0x55c52a;return db[_0x0ccd('0x53')][_0x0ccd('0x5d')]({'where':{'userProfileId':_0x3a6383[_0x0ccd('0x47')]['id'],'sectionId':_0x3a6383[_0x0ccd('0x34')][_0x0ccd('0x5e')]}});}})[_0x0ccd('0x26')](function(){return _0x47fc0;})[_0x0ccd('0x26')](respondWithStatusCode(_0x1c86fd,null))[_0x0ccd('0x45')](handleError(_0x1c86fd,null));};exports['getSections']=function(_0x3d4f91,_0x455c5b){var _0x447143=[];var _0x49510d=[];return db['UserProfileSection'][_0x0ccd('0x44')]({'where':{'userProfileId':_0x3d4f91[_0x0ccd('0x47')]['id']},'raw':!![]})[_0x0ccd('0x26')](function(_0x4aa1b1){_0x447143=_['filter'](_0x4aa1b1,function(_0x2d21ee){return _0x2d21ee[_0x0ccd('0x5f')]===0x1||_[_0x0ccd('0x60')]([0x3eb,0x709],_0x2d21ee[_0x0ccd('0x58')]);});if(!_['isEmpty'](_0x447143)){return _['map'](_0x447143,function(_0x57f641){return _0x57f641['sectionId'];});}else{return;}})[_0x0ccd('0x26')](function(_0xc59907){if(_0xc59907)_0x49510d=_0xc59907;if(_[_0x0ccd('0x60')](_0x49510d,0x64)){var _0x25c195=_[_0x0ccd('0x49')](_0x447143,{'sectionId':0x64});return hasDefaultDashboard(_0x25c195)[_0x0ccd('0x26')](function(_0x3326ec){return _[_0x0ccd('0x31')](_0x447143,function(_0x165e59){if(_0x165e59[_0x0ccd('0x58')]===0x64){_0x165e59[_0x0ccd('0x61')]=_0x3326ec;}return _0x165e59;});});}else{return;}})[_0x0ccd('0x26')](function(_0x3fe868){if(_0x3fe868)_0x447143=_0x3fe868;if(_['includes'](_0x49510d,0x3eb)){var _0x24a8d7=_[_0x0ccd('0x49')](_0x447143,{'sectionId':0x3eb});return getCustomDashboards(_0x24a8d7)[_0x0ccd('0x26')](function(_0x5c7a53){return _[_0x0ccd('0x31')](_0x447143,function(_0x437307){if(_0x24a8d7[_0x0ccd('0x5f')]){if(_0x437307[_0x0ccd('0x58')]===0x3eb){_0x437307[_0x0ccd('0x61')]=_0x5c7a53;}}else{if(_0x437307[_0x0ccd('0x58')]===0x64){_0x437307[_0x0ccd('0x61')]=_0x5c7a53;}}return _0x437307;});});}else{return;}})[_0x0ccd('0x26')](function(_0x3c9196){if(_0x3c9196)_0x447143=_0x3c9196;if(_['includes'](_0x49510d,0x709)){var _0x1f2928=_[_0x0ccd('0x49')](_0x447143,{'sectionId':0x709});return getPlugins(_0x1f2928)[_0x0ccd('0x26')](function(_0x3762b6){if(_0x1f2928[_0x0ccd('0x5f')]){return _['map'](_0x447143,function(_0x166caa){if(_0x166caa[_0x0ccd('0x58')]===0x709){_0x166caa['subsections']=_0x3762b6;}return _0x166caa;});}else{var _0x42c4ac={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3762b6};var _0x20bfe8=_[_0x0ccd('0x31')](_0x447143);_0x20bfe8[_0x0ccd('0x62')](_0x42c4ac);return _0x20bfe8;}});}else{return;}})[_0x0ccd('0x26')](function(_0x224681){if(_0x224681)_0x447143=_0x224681;return _[_0x0ccd('0x3d')](_0x447143,[_0x0ccd('0x5f'),0x1]);})['then'](respondWithResult(_0x455c5b,null))[_0x0ccd('0x45')](handleError(_0x455c5b,null));};function hasDefaultDashboard(_0x5c45c2){var _0x1fe635=[0x65];return new BPromise(function(_0x28f74c,_0x170ad7){try{if(_0x5c45c2[_0x0ccd('0x55')]){_0x28f74c(_0x1fe635);}else{return db[_0x0ccd('0x56')]['findOne']({'where':{'sectionId':_0x5c45c2['id']},'raw':!![]})[_0x0ccd('0x26')](function(_0x1288e3){_0x1288e3?_0x28f74c(_0x1fe635):_0x28f74c();});}}catch(_0x11e551){_0x170ad7(_0x11e551);}});}function getCustomDashboards(_0x54da11){var _0x5c2746=[];return new BPromise(function(_0x56c9cb,_0x16d6a3){try{if(_0x54da11['autoAssociation']){return db['Dashboard'][_0x0ccd('0x44')]({'raw':!![]})[_0x0ccd('0x26')](function(_0x3e1398){_0x3e1398[_0x0ccd('0x63')](function(_0x22daec){_0x5c2746['push'](_0x22daec['id']+0x1869f);});_0x56c9cb(_0x5c2746);});}else{return db[_0x0ccd('0x56')][_0x0ccd('0x44')]({'where':{'sectionId':_0x54da11['id']},'raw':!![]})['then'](function(_0x251143){_0x251143[_0x0ccd('0x63')](function(_0x568808){_0x5c2746[_0x0ccd('0x62')](_0x568808[_0x0ccd('0x64')]+0x1869f);});_0x56c9cb(_0x5c2746);});}}catch(_0xe34c39){_0x16d6a3(_0xe34c39);}});}function getPlugins(_0x1e1e72){var _0x23b373=[];return new BPromise(function(_0x960d73,_0x43bcec){try{if(_0x1e1e72[_0x0ccd('0x55')]){return db['Plugin'][_0x0ccd('0x44')]({'raw':!![]})['then'](function(_0x2963d4){_0x2963d4[_0x0ccd('0x63')](function(_0x57a784){_0x23b373[_0x0ccd('0x62')](_0x57a784['id']+0x15b38);});_0x960d73(_0x23b373);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x1e1e72['id']},'raw':!![]})[_0x0ccd('0x26')](function(_0xad5e76){_0xad5e76['forEach'](function(_0xab2fd0){_0x23b373[_0x0ccd('0x62')](_0xab2fd0[_0x0ccd('0x64')]+0x15b38);});_0x960d73(_0x23b373);});}}catch(_0x35f1d3){_0x43bcec(_0x35f1d3);}});}exports['addResources']=function(_0x234074,_0x5e19be){return db[_0x0ccd('0x2b')][_0x0ccd('0x49')]({'where':{'id':_0x234074[_0x0ccd('0x47')]['id']}})[_0x0ccd('0x26')](handleEntityNotFound(_0x5e19be,null))['then'](function(_0x1aa5e2){if(_0x1aa5e2){return db[_0x0ccd('0x51')][_0x0ccd('0x52')](function(_0x46374a){return db[_0x0ccd('0x53')][_0x0ccd('0x44')]({'where':{'userProfileId':_0x234074[_0x0ccd('0x47')]['id']},'attributes':['id'],'raw':!![]})[_0x0ccd('0x26')](function(_0x4a9c63){if(_0x4a9c63){return db['UserProfileSection'][_0x0ccd('0x5d')]({'where':{'userProfileId':_0x234074['params']['id'],'id':_[_0x0ccd('0x31')](_0x4a9c63,function(_0x1eda11){return _0x1eda11['id'];})},'transaction':_0x46374a});}})[_0x0ccd('0x26')](function(_0x3a8170){var _0x289848=_[_0x0ccd('0x31')](_0x234074[_0x0ccd('0x4b')],function(_0x421c0c){_0x421c0c[_0x0ccd('0x59')]=_0x234074[_0x0ccd('0x47')]['id'];return _0x421c0c;});return db[_0x0ccd('0x53')]['bulkCreate'](_0x289848,{'raw':!![],'transaction':_0x46374a});})[_0x0ccd('0x26')](function(_0x34ec39){var _0x580aa0=_[_0x0ccd('0x3d')](_[_0x0ccd('0x31')](_0x34ec39,function(_0x39d30c){return _0x39d30c[_0x0ccd('0x4d')]({'plain':!![]});}),{'includeAll':![]});if(_0x580aa0){return db[_0x0ccd('0x53')]['findAll']({'where':{'userProfileId':_0x234074['params']['id'],'sectionId':_[_0x0ccd('0x31')](_0x580aa0,function(_0x334bda){return _0x334bda['sectionId'];})},'attributes':['id',_0x0ccd('0x58')],'raw':!![]})[_0x0ccd('0x26')](function(_0x3bb9da){var _0x26e51f=_['map'](_0x234074[_0x0ccd('0x4b')],function(_0x2e9dda){_0x2e9dda[_0x0ccd('0x59')]=_0x234074[_0x0ccd('0x47')]['id'];return _0x2e9dda;});return db[_0x0ccd('0x56')][_0x0ccd('0x65')](_0x26e51f,{'raw':!![],'transaction':_0x46374a});});}})[_0x0ccd('0x45')](handleError(_0x5e19be,null));});}})['then'](function(_0x4e52c7){var _0x19fe38=_['map'](_0x4e52c7,function(_0x4a4a75){return _0x4a4a75[_0x0ccd('0x4d')]({'plain':!![]});});})[_0x0ccd('0x26')](respondWithResult(_0x5e19be,null))[_0x0ccd('0x45')](handleError(_0x5e19be,null));};exports[_0x0ccd('0x66')]=function(_0x4c28a8,_0x5c1e5d,_0x2cf2ca){return db[_0x0ccd('0x2b')]['find']({'where':{'id':_0x4c28a8['params']['id']}})[_0x0ccd('0x26')](handleEntityNotFound(_0x5c1e5d,null))['then'](function(_0x31d4da){if(_0x31d4da){return _0x31d4da['removeResources'](_0x4c28a8[_0x0ccd('0x34')][_0x0ccd('0x5e')]);}})[_0x0ccd('0x26')](respondWithStatusCode(_0x5c1e5d,null))[_0x0ccd('0x45')](handleError(_0x5c1e5d,null));};exports[_0x0ccd('0x67')]=function(_0x17b4c1,_0x3b576e){var _0x3122e7={'raw':![],'where':{}};var _0x562c5f={};var _0x53d325={'count':0x0,'rows':[]};var _0x5089c2=_0x17b4c1[_0x0ccd('0x34')]['section'];if(typeof _0x5089c2===_0x0ccd('0x68')){throw new db[(_0x0ccd('0x69'))][(_0x0ccd('0x6a'))](_0x0ccd('0x6b'));}var _0x23b74f=_0x17b4c1['query'][_0x0ccd('0x6c')]||![];var _0x42379b=getQueryModels(_0x5089c2,_0x23b74f);if(typeof _0x42379b['childModel']===_0x0ccd('0x68')){throw new db['Sequelize'][(_0x0ccd('0x6a'))]('Invalid\x20section\x20\x27'+_0x5089c2+'\x27');}var _0x554d78=[];if(!_[_0x0ccd('0x6d')](_0x42379b[_0x0ccd('0x6e')])){_0x554d78=_0x42379b[_0x0ccd('0x6e')];}else{_0x554d78=[{'name':_0x5089c2}];}return db[_0x0ccd('0x2b')][_0x0ccd('0x6f')]({'where':{'id':_0x17b4c1[_0x0ccd('0x47')]['id']}})[_0x0ccd('0x26')](handleEntityNotFound(_0x3b576e,null))[_0x0ccd('0x26')](function(_0x3924c9){if(_0x3924c9){var _0x11f0d8=[];for(var _0x4213d0=0x0;_0x4213d0<_0x554d78[_0x0ccd('0x37')];_0x4213d0++){_0x11f0d8[_0x0ccd('0x62')](db[_0x0ccd('0x53')][_0x0ccd('0x6f')]({'where':{'userProfileId':_0x3924c9['id'],'name':_0x554d78[_0x4213d0][_0x0ccd('0x28')]},'raw':!![]}));}return BPromise['all'](_0x11f0d8);}})[_0x0ccd('0x26')](function(_0x315c1f){var _0x295472=_[_0x0ccd('0x3d')](_0x315c1f,function(_0x2f84be){return _0x2f84be?_0x2f84be:undefined;});var _0x3c56b7=_[_0x0ccd('0x3d')](_0x554d78,[_0x0ccd('0x70'),!![]]);var _0x4d92d7=_['isEmpty'](_0x295472)&&_[_0x0ccd('0x6d')](_0x3c56b7)?null:_[_0x0ccd('0x71')](_0x3c56b7,_0x295472);if(_0x4d92d7){var _0x4e2315=[];for(var _0x38b2be=0x0;_0x38b2be<_0x4d92d7[_0x0ccd('0x37')];_0x38b2be++){var _0x4ed197=_[_0x0ccd('0x49')](_0x554d78,function(_0x4c1ec7){return _0x4d92d7[_0x38b2be]?_0x4c1ec7[_0x0ccd('0x28')]===_0x4d92d7[_0x38b2be]['name']:null;});if(_0x4ed197){if(_0x4d92d7[_0x38b2be][_0x0ccd('0x70')]){_0x4e2315['push'](getAllResources(_0x42379b[_0x0ccd('0x72')],_0x4d92d7[_0x38b2be]));}else{if(!_0x4d92d7[_0x38b2be]['autoAssociation']){_0x4e2315['push'](getAllowedResources(_0x4ed197,_0x4d92d7[_0x38b2be],_0x42379b[_0x0ccd('0x72')]));}else{if(_0x4ed197[_0x0ccd('0x30')]){_0x4e2315[_0x0ccd('0x62')](getAllFilteredResources(_0x4ed197,_0x4d92d7[_0x38b2be]));}}}}}return BPromise[_0x0ccd('0x73')](_0x4e2315);}else{return null;}})[_0x0ccd('0x26')](function(_0x262487){var _0x2ab3ca=_0x262487;var _0x6d15cd=null;if(_0x2ab3ca){_0x6d15cd=_0x2ab3ca[_0x0ccd('0x37')]===0x1?_0x2ab3ca[0x0]:null;}if(_0x6d15cd||_0x2ab3ca){var _0x93518c=db[_0x42379b[_0x0ccd('0x72')]]['rawAttributes'];_0x562c5f['model']=_['keys'](_0x93518c);_0x562c5f['query']=_['keys'](_0x17b4c1['query']);_0x562c5f[_0x0ccd('0x32')]=_[_0x0ccd('0x33')](_0x562c5f[_0x0ccd('0x30')],_0x562c5f[_0x0ccd('0x34')]);_0x3122e7['attributes']=_[_0x0ccd('0x33')](_0x562c5f[_0x0ccd('0x30')],qs['fields'](_0x17b4c1[_0x0ccd('0x34')]['fields']));_0x3122e7['attributes']=_0x3122e7['attributes']['length']?_0x3122e7[_0x0ccd('0x35')]:_0x562c5f[_0x0ccd('0x30')];if(!_0x17b4c1[_0x0ccd('0x34')][_0x0ccd('0x38')](_0x0ccd('0x39'))){_0x3122e7[_0x0ccd('0x20')]=qs[_0x0ccd('0x20')](_0x17b4c1['query'][_0x0ccd('0x20')]);_0x3122e7[_0x0ccd('0x1f')]=qs[_0x0ccd('0x1f')](_0x17b4c1[_0x0ccd('0x34')][_0x0ccd('0x1f')]);}_0x3122e7[_0x0ccd('0x3a')]=qs[_0x0ccd('0x3b')](_0x17b4c1[_0x0ccd('0x34')][_0x0ccd('0x3b')]);_0x3122e7[_0x0ccd('0x3e')]=qs[_0x0ccd('0x32')](_[_0x0ccd('0x3c')](_0x17b4c1['query'],_0x562c5f['filters']));if(_0x17b4c1['query'][_0x0ccd('0x3d')]){_0x3122e7[_0x0ccd('0x3e')]=_[_0x0ccd('0x3f')](_0x3122e7[_0x0ccd('0x3e')],{'$or':_[_0x0ccd('0x31')](_0x93518c,function(_0x163276){if(_0x163276[_0x0ccd('0x2e')][_0x0ccd('0x2f')]!==_0x0ccd('0x40')){var _0x241ebc={};_0x241ebc[_0x163276[_0x0ccd('0x74')]]={'$like':'%'+_0x17b4c1[_0x0ccd('0x34')][_0x0ccd('0x3d')]+'%'};return _0x241ebc;}})});}var _0x1ed3db=[];if(_0x6d15cd){var _0x6ba2d8=_[_0x0ccd('0x49')](_0x554d78,[_0x0ccd('0x28'),_0x6d15cd[_0x0ccd('0x28')]]);if(_0x6ba2d8[_0x0ccd('0x74')]){var _0x4080d8={};if(_0x42379b['childModel']==='AnalyticExtractedReport'){_0x4080d8[_0x6ba2d8[_0x0ccd('0x75')]]=_[_0x0ccd('0x31')](_0x6d15cd[_0x0ccd('0x76')],'id');}else{_0x4080d8[_0x6ba2d8['foreignKey']]=_0x6d15cd[_0x0ccd('0x76')];}_0x1ed3db['push'](_0x4080d8);}else{_0x3122e7[_0x0ccd('0x3e')]['id']=_0x6d15cd[_0x0ccd('0x76')];}}else{for(var _0x3cb628=0x0;_0x3cb628<_0x2ab3ca[_0x0ccd('0x37')];_0x3cb628++){var _0x6ba2d8=_[_0x0ccd('0x49')](_0x554d78,['name',_0x2ab3ca[_0x3cb628]['name']]);if(_0x6ba2d8[_0x0ccd('0x74')]){var _0x4080d8={};_0x4080d8[_0x6ba2d8[_0x0ccd('0x75')]]=_0x2ab3ca[_0x3cb628][_0x0ccd('0x76')];_0x1ed3db[_0x0ccd('0x62')](_0x4080d8);}else{if(!_0x3122e7['where']['id'])_0x3122e7[_0x0ccd('0x3e')]['id']=[];_0x2ab3ca[_0x3cb628][_0x0ccd('0x76')][_0x0ccd('0x63')](function(_0x2d0599){_0x3122e7['where']['id'][_0x0ccd('0x62')](_0x2d0599);});}}}if(!_[_0x0ccd('0x6d')](_0x1ed3db)){_0x3122e7[_0x0ccd('0x3e')]=_[_0x0ccd('0x3f')](_0x3122e7[_0x0ccd('0x3e')],{'$and':{'$or':_0x1ed3db}});}_0x3122e7=_['merge']({},_0x3122e7,_0x17b4c1[_0x0ccd('0x41')]);if(_0x6d15cd&&!_0x6d15cd[_0x0ccd('0x55')]&&_0x42379b[_0x0ccd('0x72')]===_0x0ccd('0x77')){if(_0x17b4c1[_0x0ccd('0x34')][_0x0ccd('0x42')]){_0x3122e7[_0x0ccd('0x43')]=[{'all':!![]}];}return db[_0x42379b[_0x0ccd('0x72')]][_0x0ccd('0x44')](_0x3122e7)[_0x0ccd('0x26')](function(_0x3116b5){var _0x146380=[];_0x3116b5[_0x0ccd('0x63')](function(_0x226716){var _0x30766d;switch(_0x226716[_0x0ccd('0x78')]){case'default':_0x30766d=_[_0x0ccd('0x49')](_0x6d15cd[_0x0ccd('0x76')],function(_0x206cd8){return _0x206cd8['id']===_0x226716['reportId']&&_0x206cd8[_0x0ccd('0x2e')]===_0x0ccd('0x79');});break;case _0x0ccd('0x7a'):_0x30766d=_[_0x0ccd('0x49')](_0x6d15cd['associatedResources'],function(_0x30158d){return _0x30158d['id']===_0x226716['reportId']&&_0x30158d[_0x0ccd('0x2e')]===_0x0ccd('0x7b');});break;}if(_0x30766d)_0x146380['push'](_0x226716);});_0x53d325[_0x0ccd('0x1e')]=_0x146380[_0x0ccd('0x37')];_0x53d325[_0x0ccd('0x7c')]=_0x146380;return _0x53d325;});}else{return db[_0x42379b[_0x0ccd('0x72')]][_0x0ccd('0x1e')]({'where':_0x3122e7['where']})[_0x0ccd('0x26')](function(_0x1ab262){_0x53d325[_0x0ccd('0x1e')]=_0x1ab262;if(_0x17b4c1[_0x0ccd('0x34')]['includeAll']){if(_0x42379b[_0x0ccd('0x72')]===_0x0ccd('0x7d')){_0x3122e7[_0x0ccd('0x43')]=[{'model':db[_0x0ccd('0x7e')],'as':_0x0ccd('0x7f'),'attributes':['id',_0x0ccd('0x28'),_0x0ccd('0x80')],'required':_0x17b4c1[_0x0ccd('0x34')][_0x0ccd('0x81')]?!![]:![]},{'model':db[_0x0ccd('0x7e')],'as':'ThroughTags','attributes':['id',_0x0ccd('0x28'),_0x0ccd('0x80')],'through':_0x17b4c1[_0x0ccd('0x34')][_0x0ccd('0x81')]?{'attributes':[],'where':{'TagId':_0x17b4c1[_0x0ccd('0x34')][_0x0ccd('0x81')]||undefined}}:{},'required':_0x17b4c1[_0x0ccd('0x34')]['tag']?!![]:![]}];}else{_0x3122e7[_0x0ccd('0x43')]=[{'all':!![]}];}}return db[_0x42379b[_0x0ccd('0x72')]][_0x0ccd('0x44')](_0x3122e7);})[_0x0ccd('0x26')](function(_0x2d10f8){_0x53d325[_0x0ccd('0x7c')]=_0x2d10f8;return _0x53d325;});}}else{return _0x53d325;}})[_0x0ccd('0x26')](respondWithFilteredResult(_0x3b576e,_0x3122e7))[_0x0ccd('0x45')](handleError(_0x3b576e,null));};function getAllResources(_0xd1fff9,_0x2c9c51){return new BPromise(function(_0x14c654,_0x2f86e8){if(_0x2c9c51){var _0x43cd4b=_0x2c9c51[_0x0ccd('0x3d')]?{[_0x2c9c51[_0x0ccd('0x3d')][_0x0ccd('0x74')]]:_0x2c9c51[_0x0ccd('0x3d')]['value']}:undefined;return db[_0xd1fff9][_0x0ccd('0x44')]({'where':_0x43cd4b,'raw':!![]})[_0x0ccd('0x26')](function(_0x5a49b5){_0x2c9c51[_0x0ccd('0x76')]=_['map'](_0x5a49b5,'id');_0x14c654(_0x2c9c51);})[_0x0ccd('0x45')](function(_0x5aeae4){_0x2f86e8(_0x5aeae4);});}else{_0x14c654(null);}});}function getAllFilteredResources(_0x226bde,_0x3f9839){return new BPromise(function(_0x212694,_0x43caf7){var _0x93a656=_0x226bde['filter']?{[_0x226bde[_0x0ccd('0x3d')][_0x0ccd('0x74')]]:_0x226bde[_0x0ccd('0x3d')]['value']}:undefined;return db[_0x226bde[_0x0ccd('0x30')]][_0x0ccd('0x44')]({'where':_0x93a656,'raw':!![]})[_0x0ccd('0x26')](function(_0x27fd03){_0x3f9839[_0x0ccd('0x76')]=_[_0x0ccd('0x31')](_0x27fd03,function(_0x6741b1){return _0x6741b1[_0x0ccd('0x28')];});_0x212694(_0x3f9839);})[_0x0ccd('0x45')](function(_0x292b3b){_0x43caf7(_0x292b3b);});});}function getAllowedResources(_0x2580b8,_0x1c705c,_0x3bae7f){return new BPromise(function(_0x40edf4,_0x2aca08){if(_0x1c705c){return db[_0x0ccd('0x56')][_0x0ccd('0x44')]({'where':{'sectionId':_0x1c705c['id']},'raw':!![]})[_0x0ccd('0x26')](function(_0x4579d8){if(_0x2580b8['field']&&_0x2580b8[_0x0ccd('0x74')]!=='id'){_0x1c705c[_0x0ccd('0x76')]=_[_0x0ccd('0x31')](_0x4579d8,function(_0x48f938){return _0x48f938[_0x2580b8[_0x0ccd('0x74')]];});}else{if(_0x3bae7f===_0x0ccd('0x77')){_0x1c705c[_0x0ccd('0x76')]=_[_0x0ccd('0x31')](_0x4579d8,function(_0x361730){return{'id':_0x361730[_0x0ccd('0x64')],'type':_0x361730[_0x0ccd('0x2e')]};});}else{_0x1c705c[_0x0ccd('0x76')]=_['map'](_0x4579d8,function(_0x2541f6){return _0x2541f6[_0x0ccd('0x64')];});}}_0x40edf4(_0x1c705c);})[_0x0ccd('0x45')](function(_0x51f00f){_0x2aca08(_0x51f00f);});}else{_0x40edf4(null);}});}function getQueryModels(_0x4d572b,_0x1b6f91){var _0x1db831=_0x4d572b[_0x0ccd('0x82')]();var _0x553cdf={'childModel':undefined,'parentSections':[]};switch(_0x1db831){case _0x0ccd('0x83'):_0x553cdf[_0x0ccd('0x72')]=_0x0ccd('0x84');break;case _0x0ccd('0x85'):_0x553cdf[_0x0ccd('0x72')]=_0x0ccd('0x86');break;case _0x0ccd('0x87'):_0x553cdf['childModel']=_0x0ccd('0x88');_0x553cdf['parentSections']=[{'name':_0x0ccd('0x89'),'field':_0x0ccd('0x28'),'foreignKey':_0x0ccd('0x8a')}];break;case _0x0ccd('0x8b'):_0x553cdf[_0x0ccd('0x72')]='JscriptyProject';break;case _0x0ccd('0x8c'):_0x553cdf[_0x0ccd('0x72')]=_0x0ccd('0x7d');_0x553cdf[_0x0ccd('0x6e')]=[{'name':_0x0ccd('0x8d'),'field':'id','foreignKey':_0x0ccd('0x8e')}];break;case'lists':_0x553cdf[_0x0ccd('0x72')]=_0x0ccd('0x8f');break;case _0x0ccd('0x90'):_0x553cdf[_0x0ccd('0x72')]=_0x0ccd('0x91');break;case _0x0ccd('0x92'):_0x553cdf[_0x0ccd('0x72')]=_0x0ccd('0x93');break;case'chatqueues':_0x553cdf[_0x0ccd('0x72')]=_0x0ccd('0x94');break;case _0x0ccd('0x95'):_0x553cdf[_0x0ccd('0x72')]='ChatWebsite';break;case _0x0ccd('0x96'):_0x553cdf[_0x0ccd('0x72')]=_0x0ccd('0x97');break;case _0x0ccd('0x98'):_0x553cdf['childModel']=_0x0ccd('0x99');break;case _0x0ccd('0x9a'):case _0x0ccd('0x9b'):case _0x0ccd('0x9c'):_0x553cdf['childModel']=_0x0ccd('0x9d');break;case _0x0ccd('0x9e'):_0x553cdf[_0x0ccd('0x72')]='VoiceContext';break;case'voicemails':_0x553cdf[_0x0ccd('0x72')]=_0x0ccd('0x9f');break;case _0x0ccd('0xa0'):_0x553cdf[_0x0ccd('0x72')]=_0x0ccd('0xa1');_0x553cdf[_0x0ccd('0x6e')]=[{'name':_0x0ccd('0xa2'),'field':'name','foreignKey':'membername','model':_0x0ccd('0xa3'),'filter':{'field':_0x0ccd('0xa4'),'value':[_0x0ccd('0xa5')]}},{'name':_0x0ccd('0xa6'),'field':_0x0ccd('0x28'),'foreignKey':_0x0ccd('0xa7'),'model':_0x0ccd('0xa3'),'filter':{'field':_0x0ccd('0xa4'),'value':[_0x0ccd('0xa8')]}},{'name':_0x0ccd('0xa9'),'field':'name','foreignKey':_0x0ccd('0xaa'),'model':_0x0ccd('0xab'),'filter':{'field':_0x0ccd('0x2e'),'value':[_0x0ccd('0xac')]}},{'name':_0x0ccd('0xad'),'field':'name','foreignKey':_0x0ccd('0xaa'),'model':_0x0ccd('0xab'),'filter':{'field':_0x0ccd('0x2e'),'value':[_0x0ccd('0xae')]}}];break;case _0x0ccd('0xaf'):_0x553cdf[_0x0ccd('0x72')]=_0x0ccd('0xb0');break;case _0x0ccd('0xb1'):_0x553cdf[_0x0ccd('0x72')]=_0x0ccd('0xb2');break;case'voiceprefixes':_0x553cdf[_0x0ccd('0x72')]='VoicePrefix';break;case _0x0ccd('0xb3'):_0x553cdf['childModel']=_0x0ccd('0xb4');break;case _0x0ccd('0xb5'):_0x553cdf[_0x0ccd('0x72')]=_0x0ccd('0xb6');break;case'mailaccounts':_0x553cdf[_0x0ccd('0x72')]=_0x0ccd('0xb7');break;case _0x0ccd('0xb8'):_0x553cdf[_0x0ccd('0x72')]=_0x0ccd('0xb9');break;case _0x0ccd('0xba'):_0x553cdf[_0x0ccd('0x72')]='OpenchannelQueue';break;case _0x0ccd('0xbb'):_0x553cdf[_0x0ccd('0x72')]=_0x0ccd('0xbc');break;case _0x0ccd('0xbd'):_0x553cdf['childModel']=_0x0ccd('0xbe');break;case _0x0ccd('0xbf'):_0x553cdf[_0x0ccd('0x72')]='SmsAccount';break;case'whatsappqueues':_0x553cdf[_0x0ccd('0x72')]=_0x0ccd('0xc0');break;case _0x0ccd('0xc1'):_0x553cdf['childModel']=_0x0ccd('0xc2');break;case _0x0ccd('0xc3'):_0x553cdf['childModel']='Team';break;case _0x0ccd('0xc4'):case _0x0ccd('0xc5'):_0x553cdf[_0x0ccd('0x72')]=_0x0ccd('0xab');if(_0x1b6f91){_0x553cdf[_0x0ccd('0x6e')]=[{'name':_0x0ccd('0xa9')},{'name':_0x0ccd('0xad')}];}break;case'users':case'agents':case'telephones':_0x553cdf[_0x0ccd('0x72')]='User';if(_0x1b6f91){_0x553cdf[_0x0ccd('0x6e')]=[{'name':_0x0ccd('0xc6'),'filter':{'field':'role','value':['admin',_0x0ccd('0xc7')]},'ignore':!![]},{'name':_0x0ccd('0xa2')},{'name':'Telephones'}];}break;case _0x0ccd('0xc8'):_0x553cdf[_0x0ccd('0x72')]=_0x0ccd('0xc9');break;case _0x0ccd('0xca'):_0x553cdf[_0x0ccd('0x72')]=_0x0ccd('0xcb');break;case _0x0ccd('0xcc'):_0x553cdf['childModel']=_0x0ccd('0xcd');break;case _0x0ccd('0xce'):_0x553cdf['childModel']='SugarcrmAccount';break;case _0x0ccd('0xcf'):_0x553cdf[_0x0ccd('0x72')]=_0x0ccd('0xd0');break;case _0x0ccd('0xd1'):_0x553cdf[_0x0ccd('0x72')]=_0x0ccd('0xd2');break;case _0x0ccd('0xd3'):_0x553cdf[_0x0ccd('0x72')]=_0x0ccd('0xa3');break;case _0x0ccd('0xd4'):_0x553cdf[_0x0ccd('0x72')]=_0x0ccd('0xd5');break;case _0x0ccd('0xd6'):_0x553cdf['childModel']=_0x0ccd('0xd7');break;case'customdashboards':_0x553cdf['childModel']=_0x0ccd('0xd8');break;case'intervals':_0x553cdf[_0x0ccd('0x72')]=_0x0ccd('0xd9');break;case _0x0ccd('0xda'):_0x553cdf[_0x0ccd('0x72')]=_0x0ccd('0xdb');break;case _0x0ccd('0xdc'):_0x553cdf[_0x0ccd('0x72')]=_0x0ccd('0xdd');break;case _0x0ccd('0xde'):_0x553cdf[_0x0ccd('0x72')]=_0x0ccd('0xdf');break;case _0x0ccd('0xe0'):_0x553cdf[_0x0ccd('0x72')]=_0x0ccd('0x7e');break;case _0x0ccd('0xe1'):_0x553cdf[_0x0ccd('0x72')]=_0x0ccd('0xe2');break;case _0x0ccd('0xe3'):_0x553cdf[_0x0ccd('0x72')]='Trigger';break;case'trunks':_0x553cdf[_0x0ccd('0x72')]='Trunk';break;case _0x0ccd('0xe4'):_0x553cdf[_0x0ccd('0x72')]=_0x0ccd('0xe5');break;case _0x0ccd('0xe6'):_0x553cdf['childModel']=_0x0ccd('0xe7');break;case _0x0ccd('0xe8'):_0x553cdf[_0x0ccd('0x72')]='AnalyticExtractedReport';_0x553cdf[_0x0ccd('0x6e')]=[{'name':'Reports','field':'id','foreignKey':_0x0ccd('0xe9')}];break;case _0x0ccd('0xea'):_0x553cdf[_0x0ccd('0x72')]=_0x0ccd('0xeb');break;case _0x0ccd('0xc1'):_0x553cdf['childModel']=_0x0ccd('0xc2');break;default:return _0x553cdf;}return _0x553cdf;} \ No newline at end of file +var _0x4ba1=['includes','subsections','Dashboard','forEach','resourceId','Plugin','bulkCreate','removeResources','getResources','section','undefined','ValidationError','Unknown\x20section','mergeResources','Sequelize','isEmpty','parentSections','findOne','ignore','union','childModel','all','sort','AnalyticExtractedReport','foreignKey','associatedResources','reportId','DefaultReports','custom','CustomReports','rows','Tags','tag','Tag','ThroughTags','field','value','toLowerCase','squareprojects','SquareProject','SquareOdbc','squarerecordings','SquareRecording','projectName','projects','JscriptyProject','contacts','CmContact','Lists','ListId','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','FaxQueue','faxaccounts','inboundroutes','internalroutes','VoiceContext','voicemails','voicerecordings','VoiceRecording','Agents','User','role','Telephones','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','smsaccounts','SmsAccount','WhatsappQueue','teams','Team','voicequeues','users','agents','Users','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','vtigeraccounts','CannedAnswer','dispositions','Disposition','customdashboards','intervals','Pause','scheduler','Schedule','sounds','tags','templates','triggers','Trigger','trunks','variables','Variable','plugins','extractedreports','metrics','AnalyticMetric','whatsappaccounts','WhatsappAccount','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./userProfile.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','index','map','UserProfile','rawAttributes','fieldName','type','key','name','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filters','filter','VIRTUAL','merge','includeAll','findAll','catch','params','options','find','create','body','include','get','createdAt','omit','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','updatedAt','userProfileId','Resources','describe','addSections','sectionId','push','removeSections','ids','enabled'];(function(_0x33797f,_0x266a51){var _0x5e38e8=function(_0x577985){while(--_0x577985){_0x33797f['push'](_0x33797f['shift']());}};_0x5e38e8(++_0x266a51);}(_0x4ba1,0x8a));var _0x14ba=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x4ba1[_0x465a0c];return _0x1e202e;};'use strict';var pdf=require(_0x14ba('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x14ba('0x1'));var zipdir=require(_0x14ba('0x2'));var jsonpatch=require(_0x14ba('0x3'));var rp=require(_0x14ba('0x4'));var moment=require(_0x14ba('0x5'));var BPromise=require(_0x14ba('0x6'));var Mustache=require(_0x14ba('0x7'));var util=require(_0x14ba('0x8'));var path=require(_0x14ba('0x9'));var sox=require('sox');var csv=require(_0x14ba('0xa'));var ejs=require(_0x14ba('0xb'));var fs=require('fs');var _=require(_0x14ba('0xc'));var squel=require('squel');var crypto=require(_0x14ba('0xd'));var jsforce=require(_0x14ba('0xe'));var deskjs=require(_0x14ba('0xf'));var toCsv=require('to-csv');var querystring=require(_0x14ba('0x10'));var Papa=require(_0x14ba('0x11'));var Redis=require('ioredis');var authService=require(_0x14ba('0x12'));var qs=require(_0x14ba('0x13'));var as=require(_0x14ba('0x14'));var hardwareService=require(_0x14ba('0x15'));var logger=require('../../config/logger')(_0x14ba('0x16'));var utils=require('../../config/utils');var config=require(_0x14ba('0x17'));var db=require(_0x14ba('0x18'))['db'];config[_0x14ba('0x19')]=_[_0x14ba('0x1a')](config[_0x14ba('0x19')],{'host':_0x14ba('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x14ba('0x19')]));require(_0x14ba('0x1c'))[_0x14ba('0x1d')](socket);function respondWithStatusCode(_0x3ebeea,_0x1bddd2){_0x1bddd2=_0x1bddd2||0xcc;return function(_0x3272d3){if(_0x3272d3){return _0x3ebeea['sendStatus'](_0x1bddd2);}return _0x3ebeea[_0x14ba('0x1e')](_0x1bddd2)[_0x14ba('0x1f')]();};}function respondWithResult(_0x2f8aef,_0x4f1d69){_0x4f1d69=_0x4f1d69||0xc8;return function(_0x3e0639){if(_0x3e0639){return _0x2f8aef[_0x14ba('0x1e')](_0x4f1d69)[_0x14ba('0x20')](_0x3e0639);}};}function respondWithFilteredResult(_0x35f32f,_0x195fc1){return function(_0x56ae17){if(_0x56ae17){var _0x57e17d=_0x56ae17[_0x14ba('0x21')],_0x4b22cd=_0x195fc1[_0x14ba('0x22')],_0x26f283=_0x195fc1[_0x14ba('0x22')]+_0x195fc1[_0x14ba('0x23')],_0x585692;if(_0x26f283>=_0x57e17d){_0x26f283=_0x57e17d;_0x585692=0xc8;}else{_0x585692=0xce;}_0x35f32f[_0x14ba('0x1e')](_0x585692);return _0x35f32f[_0x14ba('0x24')](_0x14ba('0x25'),_0x4b22cd+'-'+_0x26f283+'/'+_0x57e17d)['json'](_0x56ae17);}return null;};}function patchUpdates(_0x5cf1ba){return function(_0x105bc4){try{jsonpatch[_0x14ba('0x26')](_0x105bc4,_0x5cf1ba,!![]);}catch(_0x403920){return BPromise['reject'](_0x403920);}return _0x105bc4[_0x14ba('0x27')]();};}function saveUpdates(_0x4dd4b9,_0x42d2dc){return function(_0xd967e3){if(_0xd967e3){return _0xd967e3[_0x14ba('0x28')](_0x4dd4b9)[_0x14ba('0x29')](function(_0x19e8a2){return _0x19e8a2;});}return null;};}function removeEntity(_0x2117d4,_0x568246){return function(_0x51adab){if(_0x51adab){return _0x51adab[_0x14ba('0x2a')]()[_0x14ba('0x29')](function(){_0x2117d4[_0x14ba('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18c076,_0x5377d2){return function(_0x2e2ccc){if(!_0x2e2ccc){_0x18c076[_0x14ba('0x2b')](0x194);}return _0x2e2ccc;};}function handleError(_0x1d8bf1,_0x29cfc7){_0x29cfc7=_0x29cfc7||0x1f4;return function(_0x70384f){logger[_0x14ba('0x2c')](_0x70384f[_0x14ba('0x2d')]);if(_0x70384f['name']){delete _0x70384f['name'];}_0x1d8bf1[_0x14ba('0x1e')](_0x29cfc7)['send'](_0x70384f);};}exports[_0x14ba('0x2e')]=function(_0x11ac09,_0x5d687b){var _0x126ae0={},_0x130b47={},_0x5b9beb={'count':0x0,'rows':[]};var _0x56858a=_[_0x14ba('0x2f')](db[_0x14ba('0x30')][_0x14ba('0x31')],function(_0x38a903){return{'name':_0x38a903[_0x14ba('0x32')],'type':_0x38a903[_0x14ba('0x33')][_0x14ba('0x34')]};});_0x130b47['model']=_['map'](_0x56858a,_0x14ba('0x35'));_0x130b47['query']=_[_0x14ba('0x36')](_0x11ac09[_0x14ba('0x37')]);_0x130b47['filters']=_[_0x14ba('0x38')](_0x130b47[_0x14ba('0x39')],_0x130b47[_0x14ba('0x37')]);_0x126ae0[_0x14ba('0x3a')]=_[_0x14ba('0x38')](_0x130b47[_0x14ba('0x39')],qs[_0x14ba('0x3b')](_0x11ac09[_0x14ba('0x37')][_0x14ba('0x3b')]));_0x126ae0[_0x14ba('0x3a')]=_0x126ae0[_0x14ba('0x3a')][_0x14ba('0x3c')]?_0x126ae0['attributes']:_0x130b47[_0x14ba('0x39')];if(!_0x11ac09['query'][_0x14ba('0x3d')](_0x14ba('0x3e'))){_0x126ae0[_0x14ba('0x23')]=qs[_0x14ba('0x23')](_0x11ac09['query']['limit']);_0x126ae0['offset']=qs[_0x14ba('0x22')](_0x11ac09['query'][_0x14ba('0x22')]);}_0x126ae0[_0x14ba('0x3f')]=qs['sort'](_0x11ac09[_0x14ba('0x37')]['sort']);_0x126ae0[_0x14ba('0x40')]=qs['filters'](_[_0x14ba('0x41')](_0x11ac09[_0x14ba('0x37')],_0x130b47[_0x14ba('0x42')]),_0x56858a);if(_0x11ac09[_0x14ba('0x37')][_0x14ba('0x43')]){_0x126ae0[_0x14ba('0x40')]=_['merge'](_0x126ae0[_0x14ba('0x40')],{'$or':_[_0x14ba('0x2f')](_0x56858a,function(_0x1efa8b){if(_0x1efa8b['type']!==_0x14ba('0x44')){var _0x17443d={};_0x17443d[_0x1efa8b[_0x14ba('0x35')]]={'$like':'%'+_0x11ac09[_0x14ba('0x37')][_0x14ba('0x43')]+'%'};return _0x17443d;}})});}_0x126ae0=_[_0x14ba('0x45')]({},_0x126ae0,_0x11ac09['options']);var _0x3d9a6c={'where':_0x126ae0[_0x14ba('0x40')]};return db[_0x14ba('0x30')][_0x14ba('0x21')](_0x3d9a6c)[_0x14ba('0x29')](function(_0x118017){_0x5b9beb[_0x14ba('0x21')]=_0x118017;if(_0x11ac09[_0x14ba('0x37')][_0x14ba('0x46')]){_0x126ae0['include']=[{'all':!![]}];}return db[_0x14ba('0x30')][_0x14ba('0x47')](_0x126ae0);})[_0x14ba('0x29')](function(_0x537a90){_0x5b9beb['rows']=_0x537a90;return _0x5b9beb;})[_0x14ba('0x29')](respondWithFilteredResult(_0x5d687b,_0x126ae0))[_0x14ba('0x48')](handleError(_0x5d687b,null));};exports['show']=function(_0x1b7fec,_0x33c177){var _0x2ecc16={'raw':![],'where':{'id':_0x1b7fec[_0x14ba('0x49')]['id']}},_0x4353e0={};_0x4353e0[_0x14ba('0x39')]=_['keys'](db['UserProfile'][_0x14ba('0x31')]);_0x4353e0[_0x14ba('0x37')]=_['keys'](_0x1b7fec['query']);_0x4353e0[_0x14ba('0x42')]=_['intersection'](_0x4353e0['model'],_0x4353e0[_0x14ba('0x37')]);_0x2ecc16[_0x14ba('0x3a')]=_[_0x14ba('0x38')](_0x4353e0['model'],qs['fields'](_0x1b7fec[_0x14ba('0x37')][_0x14ba('0x3b')]));_0x2ecc16[_0x14ba('0x3a')]=_0x2ecc16[_0x14ba('0x3a')][_0x14ba('0x3c')]?_0x2ecc16[_0x14ba('0x3a')]:_0x4353e0[_0x14ba('0x39')];if(_0x1b7fec['query'][_0x14ba('0x46')]){_0x2ecc16['include']=[{'all':!![]}];}_0x2ecc16=_[_0x14ba('0x45')]({},_0x2ecc16,_0x1b7fec[_0x14ba('0x4a')]);return db['UserProfile'][_0x14ba('0x4b')](_0x2ecc16)['then'](handleEntityNotFound(_0x33c177,null))['then'](respondWithResult(_0x33c177,null))[_0x14ba('0x48')](handleError(_0x33c177,null));};exports[_0x14ba('0x4c')]=function(_0x55e1e9,_0x16ca03){return db[_0x14ba('0x30')][_0x14ba('0x4c')](_0x55e1e9[_0x14ba('0x4d')],{})[_0x14ba('0x29')](respondWithResult(_0x16ca03,0xc9))[_0x14ba('0x48')](handleError(_0x16ca03,null));};exports['clone']=function(_0x561942,_0x522f15){var _0x2aee68={'where':{'id':_0x561942[_0x14ba('0x49')]['id']}},_0x2443b3={};_0x2443b3[_0x14ba('0x39')]=_[_0x14ba('0x36')](db[_0x14ba('0x30')][_0x14ba('0x31')]);_0x2aee68['attributes']=_[_0x14ba('0x38')](_0x2443b3[_0x14ba('0x39')],qs[_0x14ba('0x3b')](_0x561942[_0x14ba('0x37')][_0x14ba('0x3b')]));_0x2aee68['attributes']=_0x2aee68[_0x14ba('0x3a')][_0x14ba('0x3c')]?_0x2aee68[_0x14ba('0x3a')]:_0x2443b3[_0x14ba('0x39')];if(_0x561942['query'][_0x14ba('0x46')]){_0x2aee68[_0x14ba('0x4e')]=[{'all':!![]}];}_0x2aee68=_['merge']({},_0x2aee68,_0x561942['options']);return db[_0x14ba('0x30')]['find'](_0x2aee68)[_0x14ba('0x29')](handleEntityNotFound(_0x522f15,null))['then'](function(_0x1d88a9){if(_0x1d88a9){var _0x4d87e2=_0x1d88a9[_0x14ba('0x4f')]({'plain':!![]});_0x4d87e2=qs['omit'](_0x4d87e2,['id',_0x14ba('0x50'),'updatedAt','crudPermissions']);_0x561942[_0x14ba('0x4d')]=_[_0x14ba('0x51')](_0x561942[_0x14ba('0x4d')],['id',_0x14ba('0x50'),'updatedAt']);return db[_0x14ba('0x52')][_0x14ba('0x53')](function(_0x2ab8af){return db[_0x14ba('0x30')][_0x14ba('0x4c')](_[_0x14ba('0x45')](_0x4d87e2,_0x561942[_0x14ba('0x4d')]),{'include':_0x561942[_0x14ba('0x37')][_0x14ba('0x46')]?[{'all':!![]}]:undefined,'transaction':_0x2ab8af})[_0x14ba('0x29')](function(_0x195c9b){var _0x3071e6=_0x195c9b[_0x14ba('0x4f')]({'plain':!![]});return db[_0x14ba('0x54')][_0x14ba('0x47')]({'where':{'userProfileId':_0x561942[_0x14ba('0x49')]['id']},'raw':!![]})[_0x14ba('0x29')](function(_0x29b1f0){if(_0x29b1f0){return BPromise[_0x14ba('0x55')](_0x29b1f0,function(_0x5cec01){return new BPromise(function(_0x347ff0,_0x5deb04){if(_0x5cec01[_0x14ba('0x56')]===null||_0x5cec01[_0x14ba('0x56')]===0x1)_0x347ff0(null);return db[_0x14ba('0x57')][_0x14ba('0x47')]({'where':{'sectionId':_0x5cec01['id']},'raw':!![]})['then'](function(_0x586440){var _0x42ee31=_[_0x14ba('0x2f')](_0x586440,function(_0x18d82d){return qs[_0x14ba('0x51')](_0x18d82d,['id','createdAt',_0x14ba('0x58'),'sectionId']);});_0x347ff0(_0x42ee31);})[_0x14ba('0x48')](function(_0x163e2c){_0x5deb04(_0x163e2c);});})['then'](function(_0x59923b){var _0x20cc1c=qs[_0x14ba('0x51')](_0x5cec01,['id',_0x14ba('0x50'),_0x14ba('0x58')]);_0x20cc1c[_0x14ba('0x59')]=_0x3071e6['id'];if(_0x59923b)_0x20cc1c['Resources']=_0x59923b;return _0x20cc1c;})[_0x14ba('0x29')](function(_0x345b0e){return db['UserProfileSection'][_0x14ba('0x4c')](_0x345b0e,{'include':[{'model':db[_0x14ba('0x57')],'as':_0x14ba('0x5a')}],'raw':!![],'transaction':_0x2ab8af});});})[_0x14ba('0x29')](function(){return _0x3071e6;});}});});});}})[_0x14ba('0x29')](respondWithResult(_0x522f15,0xc9))['catch'](handleError(_0x522f15,null));};exports['update']=function(_0x1fbf2a,_0x19b5e7){if(_0x1fbf2a['body']['id']){delete _0x1fbf2a[_0x14ba('0x4d')]['id'];}return db[_0x14ba('0x30')][_0x14ba('0x4b')]({'where':{'id':_0x1fbf2a[_0x14ba('0x49')]['id']}})[_0x14ba('0x29')](handleEntityNotFound(_0x19b5e7,null))[_0x14ba('0x29')](saveUpdates(_0x1fbf2a[_0x14ba('0x4d')],null))[_0x14ba('0x29')](respondWithResult(_0x19b5e7,null))[_0x14ba('0x48')](handleError(_0x19b5e7,null));};exports['destroy']=function(_0x5c6350,_0x2c202b){return db['UserProfile']['find']({'where':{'id':_0x5c6350[_0x14ba('0x49')]['id']}})[_0x14ba('0x29')](handleEntityNotFound(_0x2c202b,null))[_0x14ba('0x29')](removeEntity(_0x2c202b,null))[_0x14ba('0x48')](handleError(_0x2c202b,null));};exports[_0x14ba('0x5b')]=function(_0x3bee23,_0x33f1fd){return db[_0x14ba('0x30')][_0x14ba('0x5b')]()[_0x14ba('0x29')](respondWithResult(_0x33f1fd,null))['catch'](handleError(_0x33f1fd,null));};exports[_0x14ba('0x5c')]=function(_0x531933,_0x148128){var _0xfb5a25=_0x531933['body'];return db[_0x14ba('0x30')][_0x14ba('0x4b')]({'where':{'id':_0x531933[_0x14ba('0x49')]['id']}})[_0x14ba('0x29')](handleEntityNotFound(_0x148128,null))[_0x14ba('0x29')](function(_0x1efb7d){if(_0x1efb7d){return db['sequelize']['transaction'](function(_0x1697f3){return db[_0x14ba('0x54')][_0x14ba('0x2a')]({'where':{'userProfileId':_0x531933['params']['id'],'sectionId':_['map'](_0xfb5a25,function(_0x1d8902){return _0x1d8902[_0x14ba('0x5d')];})},'transaction':_0x1697f3})[_0x14ba('0x29')](function(){var _0x2d3ae7=_[_0x14ba('0x2f')](_0xfb5a25,function(_0x4a48f7){_0x4a48f7[_0x14ba('0x59')]=_0x531933[_0x14ba('0x49')]['id'];return _0x4a48f7;});var _0xe9f240=[];return BPromise[_0x14ba('0x55')](_0x2d3ae7,function(_0xe152aa){return db['UserProfileSection']['create'](_0xe152aa,{'include':[{'model':db[_0x14ba('0x57')],'as':_0x14ba('0x5a')}],'raw':!![],'transaction':_0x1697f3})[_0x14ba('0x29')](function(_0x4d270d){_0xe9f240[_0x14ba('0x5e')](_0x4d270d[_0x14ba('0x4f')]({'plain':!![]}));});})[_0x14ba('0x29')](function(){return _0xe9f240;});});});}})[_0x14ba('0x29')](function(_0x14b4a3){return _0x14b4a3;})['then'](respondWithResult(_0x148128,null))[_0x14ba('0x48')](handleError(_0x148128,null));};exports[_0x14ba('0x5f')]=function(_0x177d0d,_0x3309f0){var _0x1e1305;return db['UserProfile'][_0x14ba('0x4b')]({'where':{'id':_0x177d0d[_0x14ba('0x49')]['id']},'attributes':['id',_0x14ba('0x35')]})[_0x14ba('0x29')](handleEntityNotFound(_0x3309f0,null))[_0x14ba('0x29')](function(_0x132d9c){if(_0x132d9c){_0x1e1305=_0x132d9c;return db['UserProfileSection'][_0x14ba('0x2a')]({'where':{'userProfileId':_0x177d0d['params']['id'],'sectionId':_0x177d0d['query'][_0x14ba('0x60')]}});}})[_0x14ba('0x29')](function(){return _0x1e1305;})[_0x14ba('0x29')](respondWithStatusCode(_0x3309f0,null))[_0x14ba('0x48')](handleError(_0x3309f0,null));};exports['getSections']=function(_0x123f24,_0xedb459){var _0x14ec30=[];var _0x59afa8=[];return db[_0x14ba('0x54')][_0x14ba('0x47')]({'where':{'userProfileId':_0x123f24[_0x14ba('0x49')]['id']},'raw':!![]})[_0x14ba('0x29')](function(_0x4c3bd6){_0x14ec30=_[_0x14ba('0x43')](_0x4c3bd6,function(_0xa2633d){return _0xa2633d[_0x14ba('0x61')]===0x1||_[_0x14ba('0x62')]([0x3eb,0x709],_0xa2633d[_0x14ba('0x5d')]);});if(!_['isEmpty'](_0x14ec30)){return _['map'](_0x14ec30,function(_0x1e96b9){return _0x1e96b9[_0x14ba('0x5d')];});}else{return;}})['then'](function(_0x3b4e91){if(_0x3b4e91)_0x59afa8=_0x3b4e91;if(_[_0x14ba('0x62')](_0x59afa8,0x64)){var _0x54c747=_[_0x14ba('0x4b')](_0x14ec30,{'sectionId':0x64});return hasDefaultDashboard(_0x54c747)[_0x14ba('0x29')](function(_0x137211){return _[_0x14ba('0x2f')](_0x14ec30,function(_0x21197a){if(_0x21197a['sectionId']===0x64){_0x21197a[_0x14ba('0x63')]=_0x137211;}return _0x21197a;});});}else{return;}})[_0x14ba('0x29')](function(_0x174c73){if(_0x174c73)_0x14ec30=_0x174c73;if(_[_0x14ba('0x62')](_0x59afa8,0x3eb)){var _0x141c9f=_[_0x14ba('0x4b')](_0x14ec30,{'sectionId':0x3eb});return getCustomDashboards(_0x141c9f)[_0x14ba('0x29')](function(_0x26118e){return _['map'](_0x14ec30,function(_0x49615d){if(_0x141c9f[_0x14ba('0x61')]){if(_0x49615d[_0x14ba('0x5d')]===0x3eb){_0x49615d['subsections']=_0x26118e;}}else{if(_0x49615d[_0x14ba('0x5d')]===0x64){_0x49615d[_0x14ba('0x63')]=_0x26118e;}}return _0x49615d;});});}else{return;}})[_0x14ba('0x29')](function(_0x22597d){if(_0x22597d)_0x14ec30=_0x22597d;if(_[_0x14ba('0x62')](_0x59afa8,0x709)){var _0x1e9ea7=_[_0x14ba('0x4b')](_0x14ec30,{'sectionId':0x709});return getPlugins(_0x1e9ea7)[_0x14ba('0x29')](function(_0x218e79){if(_0x1e9ea7[_0x14ba('0x61')]){return _[_0x14ba('0x2f')](_0x14ec30,function(_0x21cdb7){if(_0x21cdb7[_0x14ba('0x5d')]===0x709){_0x21cdb7[_0x14ba('0x63')]=_0x218e79;}return _0x21cdb7;});}else{var _0x39ae5b={'sectionId':0x76c,'enabled':0x1,'subsections':_0x218e79};var _0x511316=_[_0x14ba('0x2f')](_0x14ec30);_0x511316[_0x14ba('0x5e')](_0x39ae5b);return _0x511316;}});}else{return;}})[_0x14ba('0x29')](function(_0x563ccf){if(_0x563ccf)_0x14ec30=_0x563ccf;return _[_0x14ba('0x43')](_0x14ec30,[_0x14ba('0x61'),0x1]);})['then'](respondWithResult(_0xedb459,null))[_0x14ba('0x48')](handleError(_0xedb459,null));};function hasDefaultDashboard(_0x2dcf41){var _0x22e896=[0x65];return new BPromise(function(_0x102a2f,_0x590434){try{if(_0x2dcf41['autoAssociation']){_0x102a2f(_0x22e896);}else{return db[_0x14ba('0x57')]['findOne']({'where':{'sectionId':_0x2dcf41['id']},'raw':!![]})[_0x14ba('0x29')](function(_0x50d0d5){_0x50d0d5?_0x102a2f(_0x22e896):_0x102a2f();});}}catch(_0x2ab903){_0x590434(_0x2ab903);}});}function getCustomDashboards(_0xb6da70){var _0x2f2c78=[];return new BPromise(function(_0x11eef0,_0x1ba75f){try{if(_0xb6da70[_0x14ba('0x56')]){return db[_0x14ba('0x64')][_0x14ba('0x47')]({'raw':!![]})[_0x14ba('0x29')](function(_0x106724){_0x106724['forEach'](function(_0x225738){_0x2f2c78[_0x14ba('0x5e')](_0x225738['id']+0x1869f);});_0x11eef0(_0x2f2c78);});}else{return db[_0x14ba('0x57')][_0x14ba('0x47')]({'where':{'sectionId':_0xb6da70['id']},'raw':!![]})['then'](function(_0x4c61e4){_0x4c61e4[_0x14ba('0x65')](function(_0x345ef1){_0x2f2c78[_0x14ba('0x5e')](_0x345ef1[_0x14ba('0x66')]+0x1869f);});_0x11eef0(_0x2f2c78);});}}catch(_0x2437f9){_0x1ba75f(_0x2437f9);}});}function getPlugins(_0x1763da){var _0x1cc7ac=[];return new BPromise(function(_0x16c2d0,_0x1d9294){try{if(_0x1763da['autoAssociation']){return db[_0x14ba('0x67')][_0x14ba('0x47')]({'raw':!![]})[_0x14ba('0x29')](function(_0x390df3){_0x390df3[_0x14ba('0x65')](function(_0x1f89ab){_0x1cc7ac['push'](_0x1f89ab['id']+0x15b38);});_0x16c2d0(_0x1cc7ac);});}else{return db[_0x14ba('0x57')]['findAll']({'where':{'sectionId':_0x1763da['id']},'raw':!![]})[_0x14ba('0x29')](function(_0x1ca603){_0x1ca603[_0x14ba('0x65')](function(_0x583889){_0x1cc7ac['push'](_0x583889[_0x14ba('0x66')]+0x15b38);});_0x16c2d0(_0x1cc7ac);});}}catch(_0x1864f5){_0x1d9294(_0x1864f5);}});}exports['addResources']=function(_0x198ce2,_0x25e791){return db[_0x14ba('0x30')]['find']({'where':{'id':_0x198ce2[_0x14ba('0x49')]['id']}})['then'](handleEntityNotFound(_0x25e791,null))['then'](function(_0x102da9){if(_0x102da9){return db['sequelize'][_0x14ba('0x53')](function(_0x4d0676){return db[_0x14ba('0x54')][_0x14ba('0x47')]({'where':{'userProfileId':_0x198ce2['params']['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x23bf47){if(_0x23bf47){return db[_0x14ba('0x54')][_0x14ba('0x2a')]({'where':{'userProfileId':_0x198ce2[_0x14ba('0x49')]['id'],'id':_['map'](_0x23bf47,function(_0xb09485){return _0xb09485['id'];})},'transaction':_0x4d0676});}})[_0x14ba('0x29')](function(_0x4aba4b){var _0x521891=_[_0x14ba('0x2f')](_0x198ce2[_0x14ba('0x4d')],function(_0x30f9af){_0x30f9af['userProfileId']=_0x198ce2[_0x14ba('0x49')]['id'];return _0x30f9af;});return db[_0x14ba('0x54')][_0x14ba('0x68')](_0x521891,{'raw':!![],'transaction':_0x4d0676});})[_0x14ba('0x29')](function(_0x1f823b){var _0xc24340=_[_0x14ba('0x43')](_[_0x14ba('0x2f')](_0x1f823b,function(_0x5b1a38){return _0x5b1a38['get']({'plain':!![]});}),{'includeAll':![]});if(_0xc24340){return db[_0x14ba('0x54')][_0x14ba('0x47')]({'where':{'userProfileId':_0x198ce2[_0x14ba('0x49')]['id'],'sectionId':_[_0x14ba('0x2f')](_0xc24340,function(_0x1a2683){return _0x1a2683[_0x14ba('0x5d')];})},'attributes':['id',_0x14ba('0x5d')],'raw':!![]})[_0x14ba('0x29')](function(_0x585168){var _0x1b3c57=_[_0x14ba('0x2f')](_0x198ce2['body'],function(_0x297073){_0x297073['userProfileId']=_0x198ce2[_0x14ba('0x49')]['id'];return _0x297073;});return db[_0x14ba('0x57')]['bulkCreate'](_0x1b3c57,{'raw':!![],'transaction':_0x4d0676});});}})['catch'](handleError(_0x25e791,null));});}})[_0x14ba('0x29')](function(_0x3edab8){var _0x428f78=_[_0x14ba('0x2f')](_0x3edab8,function(_0x3c0499){return _0x3c0499[_0x14ba('0x4f')]({'plain':!![]});});})[_0x14ba('0x29')](respondWithResult(_0x25e791,null))[_0x14ba('0x48')](handleError(_0x25e791,null));};exports[_0x14ba('0x69')]=function(_0x1c2303,_0x552604,_0x1dc240){return db[_0x14ba('0x30')]['find']({'where':{'id':_0x1c2303[_0x14ba('0x49')]['id']}})[_0x14ba('0x29')](handleEntityNotFound(_0x552604,null))['then'](function(_0x4b22f5){if(_0x4b22f5){return _0x4b22f5[_0x14ba('0x69')](_0x1c2303[_0x14ba('0x37')][_0x14ba('0x60')]);}})[_0x14ba('0x29')](respondWithStatusCode(_0x552604,null))[_0x14ba('0x48')](handleError(_0x552604,null));};exports[_0x14ba('0x6a')]=function(_0x209da7,_0x16abb2){var _0x383cdc={'raw':![],'where':{}};var _0x5f4a3e={};var _0x5c10e6={'count':0x0,'rows':[]};var _0x5ad8c5=_0x209da7[_0x14ba('0x37')][_0x14ba('0x6b')];if(typeof _0x5ad8c5===_0x14ba('0x6c')){throw new db['Sequelize'][(_0x14ba('0x6d'))](_0x14ba('0x6e'));}var _0x2518af=_0x209da7[_0x14ba('0x37')][_0x14ba('0x6f')]||![];var _0x5f15ad=getQueryModels(_0x5ad8c5,_0x2518af);if(typeof _0x5f15ad['childModel']===_0x14ba('0x6c')){throw new db[(_0x14ba('0x70'))][(_0x14ba('0x6d'))]('Invalid\x20section\x20\x27'+_0x5ad8c5+'\x27');}var _0x39781e=[];if(!_[_0x14ba('0x71')](_0x5f15ad[_0x14ba('0x72')])){_0x39781e=_0x5f15ad[_0x14ba('0x72')];}else{_0x39781e=[{'name':_0x5ad8c5}];}return db['UserProfile'][_0x14ba('0x73')]({'where':{'id':_0x209da7[_0x14ba('0x49')]['id']}})[_0x14ba('0x29')](handleEntityNotFound(_0x16abb2,null))[_0x14ba('0x29')](function(_0x38b904){if(_0x38b904){var _0x950ad4=[];for(var _0x18e84a=0x0;_0x18e84a<_0x39781e[_0x14ba('0x3c')];_0x18e84a++){_0x950ad4[_0x14ba('0x5e')](db[_0x14ba('0x54')][_0x14ba('0x73')]({'where':{'userProfileId':_0x38b904['id'],'name':_0x39781e[_0x18e84a][_0x14ba('0x35')]},'raw':!![]}));}return BPromise['all'](_0x950ad4);}})[_0x14ba('0x29')](function(_0x740e09){var _0x251f6c=_['filter'](_0x740e09,function(_0x56c7b3){return _0x56c7b3?_0x56c7b3:undefined;});var _0x3f8168=_['filter'](_0x39781e,[_0x14ba('0x74'),!![]]);var _0x4b7a83=_[_0x14ba('0x71')](_0x251f6c)&&_['isEmpty'](_0x3f8168)?null:_[_0x14ba('0x75')](_0x3f8168,_0x251f6c);if(_0x4b7a83){var _0x2f6301=[];for(var _0x2db89c=0x0;_0x2db89c<_0x4b7a83[_0x14ba('0x3c')];_0x2db89c++){var _0x6c741=_['find'](_0x39781e,function(_0x52c259){return _0x4b7a83[_0x2db89c]?_0x52c259['name']===_0x4b7a83[_0x2db89c]['name']:null;});if(_0x6c741){if(_0x4b7a83[_0x2db89c][_0x14ba('0x74')]){_0x2f6301['push'](getAllResources(_0x5f15ad[_0x14ba('0x76')],_0x4b7a83[_0x2db89c]));}else{if(!_0x4b7a83[_0x2db89c][_0x14ba('0x56')]){_0x2f6301[_0x14ba('0x5e')](getAllowedResources(_0x6c741,_0x4b7a83[_0x2db89c],_0x5f15ad[_0x14ba('0x76')]));}else{if(_0x6c741[_0x14ba('0x39')]){_0x2f6301[_0x14ba('0x5e')](getAllFilteredResources(_0x6c741,_0x4b7a83[_0x2db89c]));}}}}}return BPromise[_0x14ba('0x77')](_0x2f6301);}else{return null;}})[_0x14ba('0x29')](function(_0x3b87bb){var _0x219406=_0x3b87bb;var _0x54f88d=null;if(_0x219406){_0x54f88d=_0x219406[_0x14ba('0x3c')]===0x1?_0x219406[0x0]:null;}if(_0x54f88d||_0x219406){var _0x5f4a1e=db[_0x5f15ad['childModel']][_0x14ba('0x31')];_0x5f4a3e[_0x14ba('0x39')]=_[_0x14ba('0x36')](_0x5f4a1e);_0x5f4a3e[_0x14ba('0x37')]=_[_0x14ba('0x36')](_0x209da7[_0x14ba('0x37')]);_0x5f4a3e['filters']=_[_0x14ba('0x38')](_0x5f4a3e[_0x14ba('0x39')],_0x5f4a3e[_0x14ba('0x37')]);_0x383cdc[_0x14ba('0x3a')]=_[_0x14ba('0x38')](_0x5f4a3e[_0x14ba('0x39')],qs[_0x14ba('0x3b')](_0x209da7[_0x14ba('0x37')]['fields']));_0x383cdc[_0x14ba('0x3a')]=_0x383cdc[_0x14ba('0x3a')][_0x14ba('0x3c')]?_0x383cdc['attributes']:_0x5f4a3e[_0x14ba('0x39')];if(!_0x209da7[_0x14ba('0x37')][_0x14ba('0x3d')](_0x14ba('0x3e'))){_0x383cdc[_0x14ba('0x23')]=qs[_0x14ba('0x23')](_0x209da7[_0x14ba('0x37')]['limit']);_0x383cdc['offset']=qs[_0x14ba('0x22')](_0x209da7[_0x14ba('0x37')][_0x14ba('0x22')]);}_0x383cdc[_0x14ba('0x3f')]=qs[_0x14ba('0x78')](_0x209da7[_0x14ba('0x37')][_0x14ba('0x78')]);_0x383cdc[_0x14ba('0x40')]=qs['filters'](_[_0x14ba('0x41')](_0x209da7['query'],_0x5f4a3e[_0x14ba('0x42')]));if(_0x209da7[_0x14ba('0x37')]['filter']){_0x383cdc[_0x14ba('0x40')]=_[_0x14ba('0x45')](_0x383cdc[_0x14ba('0x40')],{'$or':_[_0x14ba('0x2f')](_0x5f4a1e,function(_0x46ed82){if(_0x46ed82[_0x14ba('0x33')][_0x14ba('0x34')]!==_0x14ba('0x44')){var _0x88d25b={};_0x88d25b[_0x46ed82['field']]={'$like':'%'+_0x209da7['query'][_0x14ba('0x43')]+'%'};return _0x88d25b;}})});}var _0x91a901=[];if(_0x54f88d){var _0x17d5dc=_[_0x14ba('0x4b')](_0x39781e,['name',_0x54f88d[_0x14ba('0x35')]]);if(_0x17d5dc['field']){var _0x78ffa6={};if(_0x5f15ad[_0x14ba('0x76')]===_0x14ba('0x79')){_0x78ffa6[_0x17d5dc[_0x14ba('0x7a')]]=_[_0x14ba('0x2f')](_0x54f88d[_0x14ba('0x7b')],'id');}else{_0x78ffa6[_0x17d5dc[_0x14ba('0x7a')]]=_0x54f88d[_0x14ba('0x7b')];}_0x91a901[_0x14ba('0x5e')](_0x78ffa6);}else{_0x383cdc['where']['id']=_0x54f88d[_0x14ba('0x7b')];}}else{for(var _0x5a0623=0x0;_0x5a0623<_0x219406[_0x14ba('0x3c')];_0x5a0623++){var _0x17d5dc=_[_0x14ba('0x4b')](_0x39781e,[_0x14ba('0x35'),_0x219406[_0x5a0623][_0x14ba('0x35')]]);if(_0x17d5dc['field']){var _0x78ffa6={};_0x78ffa6[_0x17d5dc[_0x14ba('0x7a')]]=_0x219406[_0x5a0623][_0x14ba('0x7b')];_0x91a901[_0x14ba('0x5e')](_0x78ffa6);}else{if(!_0x383cdc[_0x14ba('0x40')]['id'])_0x383cdc[_0x14ba('0x40')]['id']=[];_0x219406[_0x5a0623]['associatedResources'][_0x14ba('0x65')](function(_0x4f65cb){_0x383cdc[_0x14ba('0x40')]['id'][_0x14ba('0x5e')](_0x4f65cb);});}}}if(!_[_0x14ba('0x71')](_0x91a901)){_0x383cdc['where']=_[_0x14ba('0x45')](_0x383cdc[_0x14ba('0x40')],{'$and':{'$or':_0x91a901}});}_0x383cdc=_[_0x14ba('0x45')]({},_0x383cdc,_0x209da7['options']);if(_0x54f88d&&!_0x54f88d[_0x14ba('0x56')]&&_0x5f15ad[_0x14ba('0x76')]===_0x14ba('0x79')){if(_0x209da7[_0x14ba('0x37')][_0x14ba('0x46')]){_0x383cdc[_0x14ba('0x4e')]=[{'all':!![]}];}return db[_0x5f15ad[_0x14ba('0x76')]][_0x14ba('0x47')](_0x383cdc)['then'](function(_0x552ca6){var _0x216a39=[];_0x552ca6[_0x14ba('0x65')](function(_0x5db02f){var _0x392dd6;switch(_0x5db02f['reportType']){case'default':_0x392dd6=_[_0x14ba('0x4b')](_0x54f88d[_0x14ba('0x7b')],function(_0x1ce16a){return _0x1ce16a['id']===_0x5db02f[_0x14ba('0x7c')]&&_0x1ce16a[_0x14ba('0x33')]===_0x14ba('0x7d');});break;case _0x14ba('0x7e'):_0x392dd6=_[_0x14ba('0x4b')](_0x54f88d[_0x14ba('0x7b')],function(_0x25db25){return _0x25db25['id']===_0x5db02f['reportId']&&_0x25db25[_0x14ba('0x33')]===_0x14ba('0x7f');});break;}if(_0x392dd6)_0x216a39[_0x14ba('0x5e')](_0x5db02f);});_0x5c10e6[_0x14ba('0x21')]=_0x216a39[_0x14ba('0x3c')];_0x5c10e6[_0x14ba('0x80')]=_0x216a39;return _0x5c10e6;});}else{return db[_0x5f15ad['childModel']]['count']({'where':_0x383cdc[_0x14ba('0x40')]})['then'](function(_0xf7ade6){_0x5c10e6[_0x14ba('0x21')]=_0xf7ade6;if(_0x209da7[_0x14ba('0x37')][_0x14ba('0x46')]){if(_0x5f15ad[_0x14ba('0x76')]==='CmContact'){_0x383cdc[_0x14ba('0x4e')]=[{'model':db['Tag'],'as':_0x14ba('0x81'),'attributes':['id',_0x14ba('0x35'),'color'],'required':_0x209da7[_0x14ba('0x37')][_0x14ba('0x82')]?!![]:![]},{'model':db[_0x14ba('0x83')],'as':_0x14ba('0x84'),'attributes':['id','name','color'],'through':_0x209da7[_0x14ba('0x37')][_0x14ba('0x82')]?{'attributes':[],'where':{'TagId':_0x209da7[_0x14ba('0x37')][_0x14ba('0x82')]||undefined}}:{},'required':_0x209da7['query'][_0x14ba('0x82')]?!![]:![]}];}else{_0x383cdc[_0x14ba('0x4e')]=[{'all':!![]}];}}return db[_0x5f15ad[_0x14ba('0x76')]][_0x14ba('0x47')](_0x383cdc);})['then'](function(_0x37fd19){_0x5c10e6[_0x14ba('0x80')]=_0x37fd19;return _0x5c10e6;});}}else{return _0x5c10e6;}})['then'](respondWithFilteredResult(_0x16abb2,_0x383cdc))[_0x14ba('0x48')](handleError(_0x16abb2,null));};function getAllResources(_0x26d119,_0x32e87c){return new BPromise(function(_0x47a3b9,_0x3c8a12){if(_0x32e87c){var _0x2aee47=_0x32e87c['filter']?{[_0x32e87c[_0x14ba('0x43')][_0x14ba('0x85')]]:_0x32e87c[_0x14ba('0x43')][_0x14ba('0x86')]}:undefined;return db[_0x26d119][_0x14ba('0x47')]({'where':_0x2aee47,'raw':!![]})[_0x14ba('0x29')](function(_0x2757bd){_0x32e87c[_0x14ba('0x7b')]=_[_0x14ba('0x2f')](_0x2757bd,'id');_0x47a3b9(_0x32e87c);})['catch'](function(_0x14c133){_0x3c8a12(_0x14c133);});}else{_0x47a3b9(null);}});}function getAllFilteredResources(_0x38d949,_0x4aae76){return new BPromise(function(_0x11749c,_0x3ff692){var _0x540aa0=_0x38d949['filter']?{[_0x38d949[_0x14ba('0x43')][_0x14ba('0x85')]]:_0x38d949[_0x14ba('0x43')][_0x14ba('0x86')]}:undefined;return db[_0x38d949[_0x14ba('0x39')]][_0x14ba('0x47')]({'where':_0x540aa0,'raw':!![]})[_0x14ba('0x29')](function(_0x15fd5e){_0x4aae76[_0x14ba('0x7b')]=_[_0x14ba('0x2f')](_0x15fd5e,function(_0x5dd896){return _0x5dd896['name'];});_0x11749c(_0x4aae76);})['catch'](function(_0x344578){_0x3ff692(_0x344578);});});}function getAllowedResources(_0x594d27,_0xff2cfe,_0x2d1515){return new BPromise(function(_0x3e93d0,_0x35c5e6){if(_0xff2cfe){return db[_0x14ba('0x57')]['findAll']({'where':{'sectionId':_0xff2cfe['id']},'raw':!![]})[_0x14ba('0x29')](function(_0x184fd9){if(_0x594d27[_0x14ba('0x85')]&&_0x594d27[_0x14ba('0x85')]!=='id'){_0xff2cfe['associatedResources']=_[_0x14ba('0x2f')](_0x184fd9,function(_0xe90172){return _0xe90172[_0x594d27[_0x14ba('0x85')]];});}else{if(_0x2d1515==='AnalyticExtractedReport'){_0xff2cfe[_0x14ba('0x7b')]=_['map'](_0x184fd9,function(_0x87988b){return{'id':_0x87988b[_0x14ba('0x66')],'type':_0x87988b['type']};});}else{_0xff2cfe['associatedResources']=_[_0x14ba('0x2f')](_0x184fd9,function(_0x1ccfbf){return _0x1ccfbf[_0x14ba('0x66')];});}}_0x3e93d0(_0xff2cfe);})[_0x14ba('0x48')](function(_0x33b192){_0x35c5e6(_0x33b192);});}else{_0x3e93d0(null);}});}function getQueryModels(_0x17d405,_0x3070f9){var _0x45e902=_0x17d405[_0x14ba('0x87')]();var _0x35bdf6={'childModel':undefined,'parentSections':[]};switch(_0x45e902){case _0x14ba('0x88'):_0x35bdf6['childModel']=_0x14ba('0x89');break;case'odbc':_0x35bdf6[_0x14ba('0x76')]=_0x14ba('0x8a');break;case _0x14ba('0x8b'):_0x35bdf6[_0x14ba('0x76')]=_0x14ba('0x8c');_0x35bdf6['parentSections']=[{'name':'SquareProjects','field':'name','foreignKey':_0x14ba('0x8d')}];break;case _0x14ba('0x8e'):_0x35bdf6[_0x14ba('0x76')]=_0x14ba('0x8f');break;case _0x14ba('0x90'):_0x35bdf6[_0x14ba('0x76')]=_0x14ba('0x91');_0x35bdf6['parentSections']=[{'name':_0x14ba('0x92'),'field':'id','foreignKey':_0x14ba('0x93')}];break;case'lists':_0x35bdf6[_0x14ba('0x76')]=_0x14ba('0x94');break;case _0x14ba('0x95'):_0x35bdf6[_0x14ba('0x76')]=_0x14ba('0x96');break;case _0x14ba('0x97'):_0x35bdf6['childModel']=_0x14ba('0x98');break;case _0x14ba('0x99'):_0x35bdf6['childModel']=_0x14ba('0x9a');break;case _0x14ba('0x9b'):_0x35bdf6[_0x14ba('0x76')]=_0x14ba('0x9c');break;case'faxqueues':_0x35bdf6[_0x14ba('0x76')]=_0x14ba('0x9d');break;case _0x14ba('0x9e'):_0x35bdf6[_0x14ba('0x76')]='FaxAccount';break;case _0x14ba('0x9f'):case _0x14ba('0xa0'):case'outboundroutes':_0x35bdf6['childModel']='VoiceExtension';break;case'contexts':_0x35bdf6[_0x14ba('0x76')]=_0x14ba('0xa1');break;case _0x14ba('0xa2'):_0x35bdf6[_0x14ba('0x76')]='VoiceMail';break;case _0x14ba('0xa3'):_0x35bdf6[_0x14ba('0x76')]=_0x14ba('0xa4');_0x35bdf6[_0x14ba('0x72')]=[{'name':_0x14ba('0xa5'),'field':_0x14ba('0x35'),'foreignKey':'membername','model':_0x14ba('0xa6'),'filter':{'field':_0x14ba('0xa7'),'value':['agent']}},{'name':_0x14ba('0xa8'),'field':_0x14ba('0x35'),'foreignKey':'membername','model':'User','filter':{'field':'role','value':['telephone']}},{'name':_0x14ba('0xa9'),'field':_0x14ba('0x35'),'foreignKey':_0x14ba('0xaa'),'model':_0x14ba('0xab'),'filter':{'field':_0x14ba('0x33'),'value':[_0x14ba('0xac')]}},{'name':_0x14ba('0xad'),'field':_0x14ba('0x35'),'foreignKey':'queue','model':_0x14ba('0xab'),'filter':{'field':_0x14ba('0x33'),'value':[_0x14ba('0xae')]}}];break;case _0x14ba('0xaf'):_0x35bdf6[_0x14ba('0x76')]=_0x14ba('0xb0');break;case _0x14ba('0xb1'):_0x35bdf6['childModel']=_0x14ba('0xb2');break;case _0x14ba('0xb3'):_0x35bdf6[_0x14ba('0x76')]=_0x14ba('0xb4');break;case'ivrcampaigns':_0x35bdf6[_0x14ba('0x76')]=_0x14ba('0xb5');break;case _0x14ba('0xb6'):_0x35bdf6[_0x14ba('0x76')]=_0x14ba('0xb7');break;case _0x14ba('0xb8'):_0x35bdf6['childModel']=_0x14ba('0xb9');break;case _0x14ba('0xba'):_0x35bdf6['childModel']=_0x14ba('0xbb');break;case'openchannelqueues':_0x35bdf6[_0x14ba('0x76')]=_0x14ba('0xbc');break;case _0x14ba('0xbd'):_0x35bdf6[_0x14ba('0x76')]=_0x14ba('0xbe');break;case _0x14ba('0xbf'):_0x35bdf6[_0x14ba('0x76')]='SmsQueue';break;case _0x14ba('0xc0'):_0x35bdf6[_0x14ba('0x76')]=_0x14ba('0xc1');break;case'whatsappqueues':_0x35bdf6[_0x14ba('0x76')]=_0x14ba('0xc2');break;case'whatsappaccounts':_0x35bdf6[_0x14ba('0x76')]='WhatsappAccount';break;case _0x14ba('0xc3'):_0x35bdf6['childModel']=_0x14ba('0xc4');break;case _0x14ba('0xc5'):case'queuecampaigns':_0x35bdf6[_0x14ba('0x76')]=_0x14ba('0xab');if(_0x3070f9){_0x35bdf6[_0x14ba('0x72')]=[{'name':'VoiceQueues'},{'name':_0x14ba('0xad')}];}break;case _0x14ba('0xc6'):case _0x14ba('0xc7'):case'telephones':_0x35bdf6['childModel']=_0x14ba('0xa6');if(_0x3070f9){_0x35bdf6[_0x14ba('0x72')]=[{'name':_0x14ba('0xc8'),'filter':{'field':_0x14ba('0xa7'),'value':['admin',_0x14ba('0xc9')]},'ignore':!![]},{'name':'Agents'},{'name':_0x14ba('0xa8')}];}break;case _0x14ba('0xca'):_0x35bdf6['childModel']=_0x14ba('0xcb');break;case _0x14ba('0xcc'):_0x35bdf6[_0x14ba('0x76')]=_0x14ba('0xcd');break;case _0x14ba('0xce'):_0x35bdf6[_0x14ba('0x76')]=_0x14ba('0xcf');break;case _0x14ba('0xd0'):_0x35bdf6[_0x14ba('0x76')]=_0x14ba('0xd1');break;case _0x14ba('0xd2'):_0x35bdf6['childModel']=_0x14ba('0xd3');break;case _0x14ba('0xd4'):_0x35bdf6[_0x14ba('0x76')]='ZohoAccount';break;case _0x14ba('0xd5'):_0x35bdf6[_0x14ba('0x76')]=_0x14ba('0xa6');break;case'cannedanswers':_0x35bdf6[_0x14ba('0x76')]=_0x14ba('0xd6');break;case _0x14ba('0xd7'):_0x35bdf6['childModel']=_0x14ba('0xd8');break;case _0x14ba('0xd9'):_0x35bdf6[_0x14ba('0x76')]=_0x14ba('0x64');break;case _0x14ba('0xda'):_0x35bdf6[_0x14ba('0x76')]='Interval';break;case'pauses':_0x35bdf6[_0x14ba('0x76')]=_0x14ba('0xdb');break;case _0x14ba('0xdc'):_0x35bdf6[_0x14ba('0x76')]=_0x14ba('0xdd');break;case _0x14ba('0xde'):_0x35bdf6[_0x14ba('0x76')]='Sound';break;case _0x14ba('0xdf'):_0x35bdf6[_0x14ba('0x76')]='Tag';break;case _0x14ba('0xe0'):_0x35bdf6[_0x14ba('0x76')]='Template';break;case _0x14ba('0xe1'):_0x35bdf6[_0x14ba('0x76')]=_0x14ba('0xe2');break;case _0x14ba('0xe3'):_0x35bdf6[_0x14ba('0x76')]='Trunk';break;case _0x14ba('0xe4'):_0x35bdf6['childModel']=_0x14ba('0xe5');break;case _0x14ba('0xe6'):_0x35bdf6[_0x14ba('0x76')]=_0x14ba('0x67');break;case _0x14ba('0xe7'):_0x35bdf6['childModel']=_0x14ba('0x79');_0x35bdf6[_0x14ba('0x72')]=[{'name':'Reports','field':'id','foreignKey':_0x14ba('0x7c')}];break;case _0x14ba('0xe8'):_0x35bdf6[_0x14ba('0x76')]=_0x14ba('0xe9');break;case _0x14ba('0xea'):_0x35bdf6[_0x14ba('0x76')]=_0x14ba('0xeb');break;default:return _0x35bdf6;}return _0x35bdf6;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index ca715b4..4fcd3eb 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 _0x2cb1=['update','remove','emit','hook','events','../../mysqldb','UserProfile','setMaxListeners','save'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0x2cb1,0x148));var _0x12cb=function(_0x71e33,_0x525f63){_0x71e33=_0x71e33-0x0;var _0x375f15=_0x2cb1[_0x71e33];return _0x375f15;};'use strict';var EventEmitter=require(_0x12cb('0x0'));var UserProfile=require(_0x12cb('0x1'))['db'][_0x12cb('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x12cb('0x3')](0x0);var events={'afterCreate':_0x12cb('0x4'),'afterUpdate':_0x12cb('0x5'),'afterDestroy':_0x12cb('0x6')};function emitEvent(_0x50ca5d){return function(_0x37befc,_0x3e0d17,_0x34aca1){UserProfileEvents[_0x12cb('0x7')](_0x50ca5d+':'+_0x37befc['id'],_0x37befc);UserProfileEvents[_0x12cb('0x7')](_0x50ca5d,_0x37befc);_0x34aca1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x12cb('0x8')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0x108a=['hook','events','../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x108a,0x133));var _0xa108=function(_0x2ad1ef,_0x472f16){_0x2ad1ef=_0x2ad1ef-0x0;var _0x1c54d2=_0x108a[_0x2ad1ef];return _0x1c54d2;};'use strict';var EventEmitter=require(_0xa108('0x0'));var UserProfile=require(_0xa108('0x1'))['db'][_0xa108('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xa108('0x3')](0x0);var events={'afterCreate':_0xa108('0x4'),'afterUpdate':_0xa108('0x5'),'afterDestroy':_0xa108('0x6')};function emitEvent(_0x15f5d3){return function(_0x1cd8e0,_0x3e4f5f,_0x12f59a){UserProfileEvents[_0xa108('0x7')](_0x15f5d3+':'+_0x1cd8e0['id'],_0x1cd8e0);UserProfileEvents[_0xa108('0x7')](_0x15f5d3,_0x1cd8e0);_0x12f59a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0xa108('0x8')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 8b7c918..9c842af 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 _0xc2b5=['rimraf','../../config/environment','./userProfile.attributes','exports','define','UserProfile','user_profiles','lodash','util','api','moment','path'];(function(_0x4d91b4,_0x3d9e10){var _0x3e4be9=function(_0x43d10f){while(--_0x43d10f){_0x4d91b4['push'](_0x4d91b4['shift']());}};_0x3e4be9(++_0x3d9e10);}(_0xc2b5,0x187));var _0x5c2b=function(_0x3e2d71,_0x2eef5a){_0x3e2d71=_0x3e2d71-0x0;var _0x6c8bc5=_0xc2b5[_0x3e2d71];return _0x6c8bc5;};'use strict';var _=require(_0x5c2b('0x0'));var util=require(_0x5c2b('0x1'));var logger=require('../../config/logger')(_0x5c2b('0x2'));var moment=require(_0x5c2b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5c2b('0x4'));var rimraf=require(_0x5c2b('0x5'));var config=require(_0x5c2b('0x6'));var attributes=require(_0x5c2b('0x7'));module[_0x5c2b('0x8')]=function(_0x26a670,_0x25d44a){return _0x26a670[_0x5c2b('0x9')](_0x5c2b('0xa'),attributes,{'tableName':_0x5c2b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x755f=['bluebird','path','rimraf','./userProfile.attributes','exports','define','user_profiles','lodash','util','api','moment'];(function(_0x6c4e5,_0x3f4cb5){var _0x441db3=function(_0x5725ba){while(--_0x5725ba){_0x6c4e5['push'](_0x6c4e5['shift']());}};_0x441db3(++_0x3f4cb5);}(_0x755f,0x1bf));var _0xf755=function(_0x1ab342,_0x92ea3c){_0x1ab342=_0x1ab342-0x0;var _0x3751d1=_0x755f[_0x1ab342];return _0x3751d1;};'use strict';var _=require(_0xf755('0x0'));var util=require(_0xf755('0x1'));var logger=require('../../config/logger')(_0xf755('0x2'));var moment=require(_0xf755('0x3'));var BPromise=require(_0xf755('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf755('0x5'));var rimraf=require(_0xf755('0x6'));var config=require('../../config/environment');var attributes=require(_0xf755('0x7'));module[_0xf755('0x8')]=function(_0x16177c,_0x1cc5f3){return _0x16177c[_0xf755('0x9')]('UserProfile',attributes,{'tableName':_0xf755('0xa'),'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 fccf408..d8c4f5b 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 _0xac9d=['./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter'];(function(_0x503ea4,_0xfd61d9){var _0x33bbf9=function(_0x80b101){while(--_0x80b101){_0x503ea4['push'](_0x503ea4['shift']());}};_0x33bbf9(++_0xfd61d9);}(_0xac9d,0x14d));var _0xdac9=function(_0x450aaf,_0x1c1a8c){_0x450aaf=_0x450aaf-0x0;var _0x199a88=_0xac9d[_0x450aaf];return _0x199a88;};'use strict';var _=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var moment=require(_0xdac9('0x2'));var BPromise=require(_0xdac9('0x3'));var rs=require(_0xdac9('0x4'));var fs=require('fs');var Redis=require(_0xdac9('0x5'));var db=require(_0xdac9('0x6'))['db'];var utils=require(_0xdac9('0x7'));var logger=require('../../config/logger')(_0xdac9('0x8'));var config=require('../../config/environment');var jayson=require(_0xdac9('0x9'));var client=jayson[_0xdac9('0xa')][_0xdac9('0xb')]({'port':0x232a});config[_0xdac9('0xc')]=_[_0xdac9('0xd')](config[_0xdac9('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xdac9('0xe'))(new Redis(config['redis']));require(_0xdac9('0xf'))[_0xdac9('0x10')](socket);function respondWithRpcPromise(_0x39c92c,_0x1a4674,_0x23ec14){return new BPromise(function(_0x2859bf,_0x255627){return client[_0xdac9('0x11')](_0x39c92c,_0x23ec14)[_0xdac9('0x12')](function(_0x5514c5){logger[_0xdac9('0x13')](_0xdac9('0x14'),_0x1a4674,'request\x20sent');logger[_0xdac9('0x15')](_0xdac9('0x16'),_0x1a4674,_0xdac9('0x17'),JSON['stringify'](_0x5514c5));if(_0x5514c5[_0xdac9('0x18')]){if(_0x5514c5[_0xdac9('0x18')][_0xdac9('0x19')]===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x1a4674,_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);return _0x255627(_0x5514c5['error'][_0xdac9('0x1a')]);}logger[_0xdac9('0x18')](_0xdac9('0x14'),_0x1a4674,_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);return _0x2859bf(_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);}else{logger[_0xdac9('0x13')]('UserProfile,\x20%s,\x20%s',_0x1a4674,_0xdac9('0x17'));_0x2859bf(_0x5514c5[_0xdac9('0x1b')]['message']);}})[_0xdac9('0x1c')](function(_0xa57f2d){logger[_0xdac9('0x18')](_0xdac9('0x14'),_0x1a4674,_0xa57f2d);_0x255627(_0xa57f2d);});});} \ No newline at end of file +var _0x8958=['UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./userProfile.socket','register','request','info'];(function(_0x38a753,_0xedd9bd){var _0x56cd9d=function(_0x5b3934){while(--_0x5b3934){_0x38a753['push'](_0x38a753['shift']());}};_0x56cd9d(++_0xedd9bd);}(_0x8958,0x93));var _0x8895=function(_0x5ee714,_0x14cf0d){_0x5ee714=_0x5ee714-0x0;var _0x516a1d=_0x8958[_0x5ee714];return _0x516a1d;};'use strict';var _=require('lodash');var util=require(_0x8895('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8895('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x8895('0x2'))(_0x8895('0x3'));var config=require(_0x8895('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x8895('0x5')][_0x8895('0x6')]({'port':0x232a});config[_0x8895('0x7')]=_[_0x8895('0x8')](config[_0x8895('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x8895('0x9'))(new Redis(config[_0x8895('0x7')]));require(_0x8895('0xa'))[_0x8895('0xb')](socket);function respondWithRpcPromise(_0x6eab1e,_0x29c126,_0x22a12b){return new BPromise(function(_0xdb3d59,_0x46c467){return client[_0x8895('0xc')](_0x6eab1e,_0x22a12b)['then'](function(_0x1cf600){logger[_0x8895('0xd')](_0x8895('0xe'),_0x29c126,_0x8895('0xf'));logger[_0x8895('0x10')](_0x8895('0x11'),_0x29c126,'request\x20sent',JSON[_0x8895('0x12')](_0x1cf600));if(_0x1cf600[_0x8895('0x13')]){if(_0x1cf600[_0x8895('0x13')]['code']===0x1f4){logger['error'](_0x8895('0xe'),_0x29c126,_0x1cf600['error'][_0x8895('0x14')]);return _0x46c467(_0x1cf600[_0x8895('0x13')][_0x8895('0x14')]);}logger[_0x8895('0x13')](_0x8895('0xe'),_0x29c126,_0x1cf600['error'][_0x8895('0x14')]);return _0xdb3d59(_0x1cf600[_0x8895('0x13')][_0x8895('0x14')]);}else{logger[_0x8895('0xd')](_0x8895('0xe'),_0x29c126,_0x8895('0xf'));_0xdb3d59(_0x1cf600[_0x8895('0x15')][_0x8895('0x14')]);}})[_0x8895('0x16')](function(_0x2da618){logger[_0x8895('0x13')](_0x8895('0xe'),_0x29c126,_0x2da618);_0x46c467(_0x2da618);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index e9b974d..185b622 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 _0x746c=['remove','update','emit','register','length','userProfile:','./userProfile.events'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x746c,0x195));var _0xc746=function(_0x36cb22,_0x340b23){_0x36cb22=_0x36cb22-0x0;var _0x5f8af7=_0x746c[_0x36cb22];return _0x5f8af7;};'use strict';var UserProfileEvents=require(_0xc746('0x0'));var events=['save',_0xc746('0x1'),_0xc746('0x2')];function createListener(_0x19ecb3,_0x4765e2){return function(_0x2b8664){_0x4765e2[_0xc746('0x3')](_0x19ecb3,_0x2b8664);};}function removeListener(_0x36fb3f,_0x26776e){return function(){UserProfileEvents['removeListener'](_0x36fb3f,_0x26776e);};}exports[_0xc746('0x4')]=function(_0x329029){for(var _0x2fe4d4=0x0,_0x2ee8e2=events[_0xc746('0x5')];_0x2fe4d4<_0x2ee8e2;_0x2fe4d4++){var _0x3220d4=events[_0x2fe4d4];var _0x561ad8=createListener(_0xc746('0x6')+_0x3220d4,_0x329029);UserProfileEvents['on'](_0x3220d4,_0x561ad8);}}; \ No newline at end of file +var _0x8656=['length','userProfile:','./userProfile.events','save','remove','emit','removeListener','register'];(function(_0xf18452,_0x1df28e){var _0x2d87c2=function(_0x261467){while(--_0x261467){_0xf18452['push'](_0xf18452['shift']());}};_0x2d87c2(++_0x1df28e);}(_0x8656,0xea));var _0x6865=function(_0x2b4448,_0x5bcc69){_0x2b4448=_0x2b4448-0x0;var _0xb4b465=_0x8656[_0x2b4448];return _0xb4b465;};'use strict';var UserProfileEvents=require(_0x6865('0x0'));var events=[_0x6865('0x1'),_0x6865('0x2'),'update'];function createListener(_0x52cfd1,_0x5f2d28){return function(_0x5eef34){_0x5f2d28[_0x6865('0x3')](_0x52cfd1,_0x5eef34);};}function removeListener(_0x501639,_0x259d62){return function(){UserProfileEvents[_0x6865('0x4')](_0x501639,_0x259d62);};}exports[_0x6865('0x5')]=function(_0x4e95ae){for(var _0x23a37d=0x0,_0x51f43c=events[_0x6865('0x6')];_0x23a37d<_0x51f43c;_0x23a37d++){var _0x9b018e=events[_0x23a37d];var _0x417bab=createListener(_0x6865('0x7')+_0x9b018e,_0x4e95ae);UserProfileEvents['on'](_0x9b018e,_0x417bab);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index b322513..dd3460f 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 _0x9e38=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x529902,_0x1c9253){var _0x6f4be6=function(_0x35ddd7){while(--_0x35ddd7){_0x529902['push'](_0x529902['shift']());}};_0x6f4be6(++_0x1c9253);}(_0x9e38,0x155));var _0x89e3=function(_0x270dba,_0x1817d2){_0x270dba=_0x270dba-0x0;var _0x36b83b=_0x9e38[_0x270dba];return _0x36b83b;};'use strict';var multer=require(_0x89e3('0x0'));var util=require(_0x89e3('0x1'));var path=require(_0x89e3('0x2'));var timeout=require(_0x89e3('0x3'));var express=require(_0x89e3('0x4'));var router=express[_0x89e3('0x5')]();var auth=require(_0x89e3('0x6'));var interaction=require(_0x89e3('0x7'));var config=require(_0x89e3('0x8'));var controller=require(_0x89e3('0x9'));router[_0x89e3('0xa')]('/',auth[_0x89e3('0xb')](),controller[_0x89e3('0xc')]);router['get'](_0x89e3('0xd'),auth[_0x89e3('0xb')](),controller[_0x89e3('0xe')]);router[_0x89e3('0xa')](_0x89e3('0xf'),auth[_0x89e3('0xb')](),controller[_0x89e3('0x10')]);router[_0x89e3('0x11')]('/',auth[_0x89e3('0xb')](),controller[_0x89e3('0x12')]);router['put'](_0x89e3('0xf'),auth[_0x89e3('0xb')](),controller[_0x89e3('0x13')]);router[_0x89e3('0x14')]('/:id',auth[_0x89e3('0xb')](),controller[_0x89e3('0x15')]);module[_0x89e3('0x16')]=router; \ No newline at end of file +var _0xe084=['/describe','isAuthenticated','describe','/:id','show','post','create','update','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','get','index'];(function(_0x416671,_0x3ab75c){var _0x147581=function(_0xc04d24){while(--_0xc04d24){_0x416671['push'](_0x416671['shift']());}};_0x147581(++_0x3ab75c);}(_0xe084,0x171));var _0x4e08=function(_0xd02ae1,_0x37b3ae){_0xd02ae1=_0xd02ae1-0x0;var _0x4f8e4c=_0xe084[_0xd02ae1];return _0x4f8e4c;};'use strict';var multer=require(_0x4e08('0x0'));var util=require(_0x4e08('0x1'));var path=require(_0x4e08('0x2'));var timeout=require('connect-timeout');var express=require(_0x4e08('0x3'));var router=express['Router']();var auth=require(_0x4e08('0x4'));var interaction=require(_0x4e08('0x5'));var config=require('../../config/environment');var controller=require(_0x4e08('0x6'));router[_0x4e08('0x7')]('/',auth['isAuthenticated'](),controller[_0x4e08('0x8')]);router['get'](_0x4e08('0x9'),auth[_0x4e08('0xa')](),controller[_0x4e08('0xb')]);router[_0x4e08('0x7')](_0x4e08('0xc'),auth['isAuthenticated'](),controller[_0x4e08('0xd')]);router[_0x4e08('0xe')]('/',auth[_0x4e08('0xa')](),controller[_0x4e08('0xf')]);router['put']('/:id',auth[_0x4e08('0xa')](),controller[_0x4e08('0x10')]);router['delete'](_0x4e08('0xc'),auth[_0x4e08('0xa')](),controller['destroy']);module[_0x4e08('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 3f1b106..77c1ea5 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 _0xdbf7=['exports','STRING','INTEGER'];(function(_0x3485c5,_0x46872c){var _0x14fd8a=function(_0x3b968c){while(--_0x3b968c){_0x3485c5['push'](_0x3485c5['shift']());}};_0x14fd8a(++_0x46872c);}(_0xdbf7,0xcf));var _0x7dbf=function(_0x4f5a2d,_0x3c2eb4){_0x4f5a2d=_0x4f5a2d-0x0;var _0x46ca10=_0xdbf7[_0x4f5a2d];return _0x46ca10;};'use strict';var Sequelize=require('sequelize');module[_0x7dbf('0x0')]={'name':{'type':Sequelize[_0x7dbf('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x7dbf('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7dbf('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xbe8a=['exports','STRING','INTEGER','sequelize'];(function(_0x2c94d4,_0x43af5a){var _0x138a94=function(_0x1ab63e){while(--_0x1ab63e){_0x2c94d4['push'](_0x2c94d4['shift']());}};_0x138a94(++_0x43af5a);}(_0xbe8a,0x1a3));var _0xabe8=function(_0x39157f,_0x3d8c1e){_0x39157f=_0x39157f-0x0;var _0x1ae4e2=_0xbe8a[_0x39157f];return _0x1ae4e2;};'use strict';var Sequelize=require(_0xabe8('0x0'));module[_0xabe8('0x1')]={'name':{'type':Sequelize[_0xabe8('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xabe8('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xabe8('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 4901e09..c2b0e66 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 _0x7da7=['api','../../config/utils','../../mysqldb','status','end','json','set','Content-Range','apply','update','then','sendStatus','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','limit','offset','sort','pick','filter','where','VIRTUAL','merge','count','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','options','UserProfileResource','find','create','body','describe','html-pdf','eml-format','rimraf','request-promise','moment','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x2d47c0,_0x1cca4){var _0xfcffdb=function(_0x2273ca){while(--_0x2273ca){_0x2d47c0['push'](_0x2d47c0['shift']());}};_0xfcffdb(++_0x1cca4);}(_0x7da7,0x10d));var _0x77da=function(_0x5ac1e5,_0x4b5012){_0x5ac1e5=_0x5ac1e5-0x0;var _0x1bccc6=_0x7da7[_0x5ac1e5];return _0x1bccc6;};'use strict';var pdf=require(_0x77da('0x0'));var emlformat=require(_0x77da('0x1'));var rimraf=require(_0x77da('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x77da('0x3'));var moment=require(_0x77da('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x77da('0x5'));var util=require(_0x77da('0x6'));var path=require('path');var sox=require(_0x77da('0x7'));var csv=require(_0x77da('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x77da('0x9'));var squel=require('squel');var crypto=require(_0x77da('0xa'));var jsforce=require(_0x77da('0xb'));var deskjs=require(_0x77da('0xc'));var toCsv=require(_0x77da('0x8'));var querystring=require(_0x77da('0xd'));var Papa=require('papaparse');var Redis=require(_0x77da('0xe'));var authService=require(_0x77da('0xf'));var qs=require(_0x77da('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x77da('0x11'));var logger=require(_0x77da('0x12'))(_0x77da('0x13'));var utils=require(_0x77da('0x14'));var config=require('../../config/environment');var db=require(_0x77da('0x15'))['db'];function respondWithStatusCode(_0x3bcea0,_0x2acc65){_0x2acc65=_0x2acc65||0xcc;return function(_0x5d6e2f){if(_0x5d6e2f){return _0x3bcea0['sendStatus'](_0x2acc65);}return _0x3bcea0[_0x77da('0x16')](_0x2acc65)[_0x77da('0x17')]();};}function respondWithResult(_0x589aa1,_0x3b0ff2){_0x3b0ff2=_0x3b0ff2||0xc8;return function(_0x369df0){if(_0x369df0){return _0x589aa1[_0x77da('0x16')](_0x3b0ff2)[_0x77da('0x18')](_0x369df0);}};}function respondWithFilteredResult(_0x519253,_0x2172d0){return function(_0x4e130c){if(_0x4e130c){var _0x29cd7b=_0x4e130c['count'],_0x366443=_0x2172d0['offset'],_0x1b0e17=_0x2172d0['offset']+_0x2172d0['limit'],_0x4500c4;if(_0x1b0e17>=_0x29cd7b){_0x1b0e17=_0x29cd7b;_0x4500c4=0xc8;}else{_0x4500c4=0xce;}_0x519253[_0x77da('0x16')](_0x4500c4);return _0x519253[_0x77da('0x19')](_0x77da('0x1a'),_0x366443+'-'+_0x1b0e17+'/'+_0x29cd7b)[_0x77da('0x18')](_0x4e130c);}return null;};}function patchUpdates(_0x19a00c){return function(_0x12d2b1){try{jsonpatch[_0x77da('0x1b')](_0x12d2b1,_0x19a00c,!![]);}catch(_0x3b6dde){return BPromise['reject'](_0x3b6dde);}return _0x12d2b1['save']();};}function saveUpdates(_0xd5a809,_0x4d1512){return function(_0x507979){if(_0x507979){return _0x507979[_0x77da('0x1c')](_0xd5a809)[_0x77da('0x1d')](function(_0x24aa8a){return _0x24aa8a;});}return null;};}function removeEntity(_0x5ab79a,_0x58270c){return function(_0x3e6cfe){if(_0x3e6cfe){return _0x3e6cfe['destroy']()[_0x77da('0x1d')](function(){_0x5ab79a[_0x77da('0x16')](0xcc)[_0x77da('0x17')]();});}};}function handleEntityNotFound(_0x27b6c7,_0x10399a){return function(_0x270318){if(!_0x270318){_0x27b6c7[_0x77da('0x1e')](0x194);}return _0x270318;};}function handleError(_0x50799d,_0x4885ec){_0x4885ec=_0x4885ec||0x1f4;return function(_0xfd160){logger[_0x77da('0x1f')](_0xfd160[_0x77da('0x20')]);if(_0xfd160[_0x77da('0x21')]){delete _0xfd160['name'];}_0x50799d[_0x77da('0x16')](_0x4885ec)[_0x77da('0x22')](_0xfd160);};}exports[_0x77da('0x23')]=function(_0x36115b,_0x446ae7){var _0x5997b6={},_0xce24b8={},_0x3e090d={'count':0x0,'rows':[]};var _0x1f2279=_[_0x77da('0x24')](db['UserProfileResource']['rawAttributes'],function(_0x4d395a){return{'name':_0x4d395a[_0x77da('0x25')],'type':_0x4d395a[_0x77da('0x26')][_0x77da('0x27')]};});_0xce24b8[_0x77da('0x28')]=_[_0x77da('0x24')](_0x1f2279,'name');_0xce24b8[_0x77da('0x29')]=_[_0x77da('0x2a')](_0x36115b[_0x77da('0x29')]);_0xce24b8[_0x77da('0x2b')]=_[_0x77da('0x2c')](_0xce24b8[_0x77da('0x28')],_0xce24b8['query']);_0x5997b6[_0x77da('0x2d')]=_[_0x77da('0x2c')](_0xce24b8[_0x77da('0x28')],qs[_0x77da('0x2e')](_0x36115b[_0x77da('0x29')][_0x77da('0x2e')]));_0x5997b6[_0x77da('0x2d')]=_0x5997b6[_0x77da('0x2d')]['length']?_0x5997b6['attributes']:_0xce24b8[_0x77da('0x28')];if(!_0x36115b[_0x77da('0x29')]['hasOwnProperty'](_0x77da('0x2f'))){_0x5997b6[_0x77da('0x30')]=qs[_0x77da('0x30')](_0x36115b[_0x77da('0x29')][_0x77da('0x30')]);_0x5997b6[_0x77da('0x31')]=qs[_0x77da('0x31')](_0x36115b['query'][_0x77da('0x31')]);}_0x5997b6['order']=qs['sort'](_0x36115b['query'][_0x77da('0x32')]);_0x5997b6['where']=qs[_0x77da('0x2b')](_[_0x77da('0x33')](_0x36115b[_0x77da('0x29')],_0xce24b8[_0x77da('0x2b')]),_0x1f2279);if(_0x36115b[_0x77da('0x29')][_0x77da('0x34')]){_0x5997b6[_0x77da('0x35')]=_['merge'](_0x5997b6[_0x77da('0x35')],{'$or':_[_0x77da('0x24')](_0x1f2279,function(_0x1ca53a){if(_0x1ca53a[_0x77da('0x26')]!==_0x77da('0x36')){var _0x188284={};_0x188284[_0x1ca53a['name']]={'$like':'%'+_0x36115b[_0x77da('0x29')][_0x77da('0x34')]+'%'};return _0x188284;}})});}_0x5997b6=_[_0x77da('0x37')]({},_0x5997b6,_0x36115b['options']);var _0xc5f0b8={'where':_0x5997b6['where']};return db['UserProfileResource']['count'](_0xc5f0b8)['then'](function(_0x19f9f7){_0x3e090d[_0x77da('0x38')]=_0x19f9f7;if(_0x36115b[_0x77da('0x29')]['includeAll']){_0x5997b6[_0x77da('0x39')]=[{'all':!![]}];}return db['UserProfileResource'][_0x77da('0x3a')](_0x5997b6);})['then'](function(_0x3c216f){_0x3e090d[_0x77da('0x3b')]=_0x3c216f;return _0x3e090d;})[_0x77da('0x1d')](respondWithFilteredResult(_0x446ae7,_0x5997b6))[_0x77da('0x3c')](handleError(_0x446ae7,null));};exports[_0x77da('0x3d')]=function(_0x5ecf12,_0x759b86){var _0x1f48bd={'raw':![],'where':{'id':_0x5ecf12[_0x77da('0x3e')]['id']}},_0x44717a={};_0x44717a[_0x77da('0x28')]=_[_0x77da('0x2a')](db['UserProfileResource'][_0x77da('0x3f')]);_0x44717a[_0x77da('0x29')]=_[_0x77da('0x2a')](_0x5ecf12[_0x77da('0x29')]);_0x44717a[_0x77da('0x2b')]=_[_0x77da('0x2c')](_0x44717a['model'],_0x44717a[_0x77da('0x29')]);_0x1f48bd['attributes']=_[_0x77da('0x2c')](_0x44717a[_0x77da('0x28')],qs[_0x77da('0x2e')](_0x5ecf12['query'][_0x77da('0x2e')]));_0x1f48bd[_0x77da('0x2d')]=_0x1f48bd[_0x77da('0x2d')][_0x77da('0x40')]?_0x1f48bd[_0x77da('0x2d')]:_0x44717a[_0x77da('0x28')];if(_0x5ecf12[_0x77da('0x29')][_0x77da('0x41')]){_0x1f48bd[_0x77da('0x39')]=[{'all':!![]}];}_0x1f48bd=_['merge']({},_0x1f48bd,_0x5ecf12[_0x77da('0x42')]);return db[_0x77da('0x43')][_0x77da('0x44')](_0x1f48bd)[_0x77da('0x1d')](handleEntityNotFound(_0x759b86,null))[_0x77da('0x1d')](respondWithResult(_0x759b86,null))[_0x77da('0x3c')](handleError(_0x759b86,null));};exports['create']=function(_0x54f88c,_0x240d7b){return db[_0x77da('0x43')][_0x77da('0x45')](_0x54f88c[_0x77da('0x46')],{})[_0x77da('0x1d')](respondWithResult(_0x240d7b,0xc9))[_0x77da('0x3c')](handleError(_0x240d7b,null));};exports['update']=function(_0x6ccb8f,_0x357ee4){if(_0x6ccb8f[_0x77da('0x46')]['id']){delete _0x6ccb8f[_0x77da('0x46')]['id'];}return db['UserProfileResource'][_0x77da('0x44')]({'where':{'id':_0x6ccb8f['params']['id']}})['then'](handleEntityNotFound(_0x357ee4,null))[_0x77da('0x1d')](saveUpdates(_0x6ccb8f[_0x77da('0x46')],null))[_0x77da('0x1d')](respondWithResult(_0x357ee4,null))[_0x77da('0x3c')](handleError(_0x357ee4,null));};exports['destroy']=function(_0x16bf4b,_0x1e36ee){return db['UserProfileResource'][_0x77da('0x44')]({'where':{'id':_0x16bf4b[_0x77da('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1e36ee,null))[_0x77da('0x1d')](removeEntity(_0x1e36ee,null))[_0x77da('0x3c')](handleError(_0x1e36ee,null));};exports[_0x77da('0x47')]=function(_0xef2496,_0xfc13ed){return db[_0x77da('0x43')][_0x77da('0x47')]()[_0x77da('0x1d')](respondWithResult(_0xfc13ed,null))[_0x77da('0x3c')](handleError(_0xfc13ed,null));}; \ No newline at end of file +var _0x5162=['limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','UserProfileResource','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','body','find','describe','html-pdf','request-promise','moment','bluebird','mustache','util','path','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x5162,0x103));var _0x2516=function(_0x1b925b,_0x1ab3c9){_0x1b925b=_0x1b925b-0x0;var _0x275f07=_0x5162[_0x1b925b];return _0x275f07;};'use strict';var pdf=require(_0x2516('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2516('0x1'));var moment=require(_0x2516('0x2'));var BPromise=require(_0x2516('0x3'));var Mustache=require(_0x2516('0x4'));var util=require(_0x2516('0x5'));var path=require(_0x2516('0x6'));var sox=require(_0x2516('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x2516('0x8'));var crypto=require(_0x2516('0x9'));var jsforce=require(_0x2516('0xa'));var deskjs=require(_0x2516('0xb'));var toCsv=require(_0x2516('0xc'));var querystring=require(_0x2516('0xd'));var Papa=require(_0x2516('0xe'));var Redis=require('ioredis');var authService=require(_0x2516('0xf'));var qs=require(_0x2516('0x10'));var as=require(_0x2516('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x2516('0x12'));var db=require(_0x2516('0x13'))['db'];function respondWithStatusCode(_0x310d1a,_0x3ef6ff){_0x3ef6ff=_0x3ef6ff||0xcc;return function(_0x56c69c){if(_0x56c69c){return _0x310d1a[_0x2516('0x14')](_0x3ef6ff);}return _0x310d1a[_0x2516('0x15')](_0x3ef6ff)[_0x2516('0x16')]();};}function respondWithResult(_0xb28714,_0x42c771){_0x42c771=_0x42c771||0xc8;return function(_0x558d20){if(_0x558d20){return _0xb28714[_0x2516('0x15')](_0x42c771)[_0x2516('0x17')](_0x558d20);}};}function respondWithFilteredResult(_0x1b3c7e,_0x181a28){return function(_0x2637e8){if(_0x2637e8){var _0x2ec31f=_0x2637e8['count'],_0x19aacb=_0x181a28[_0x2516('0x18')],_0x5dee15=_0x181a28[_0x2516('0x18')]+_0x181a28[_0x2516('0x19')],_0x3543d;if(_0x5dee15>=_0x2ec31f){_0x5dee15=_0x2ec31f;_0x3543d=0xc8;}else{_0x3543d=0xce;}_0x1b3c7e['status'](_0x3543d);return _0x1b3c7e[_0x2516('0x1a')]('Content-Range',_0x19aacb+'-'+_0x5dee15+'/'+_0x2ec31f)['json'](_0x2637e8);}return null;};}function patchUpdates(_0x31a817){return function(_0x3583cf){try{jsonpatch[_0x2516('0x1b')](_0x3583cf,_0x31a817,!![]);}catch(_0x618aed){return BPromise[_0x2516('0x1c')](_0x618aed);}return _0x3583cf[_0x2516('0x1d')]();};}function saveUpdates(_0x2bf0ee,_0x113616){return function(_0x248c5a){if(_0x248c5a){return _0x248c5a[_0x2516('0x1e')](_0x2bf0ee)[_0x2516('0x1f')](function(_0x11e78b){return _0x11e78b;});}return null;};}function removeEntity(_0x1b0831,_0x4fb7d9){return function(_0x559a3e){if(_0x559a3e){return _0x559a3e[_0x2516('0x20')]()[_0x2516('0x1f')](function(){_0x1b0831[_0x2516('0x15')](0xcc)[_0x2516('0x16')]();});}};}function handleEntityNotFound(_0x3ffb6d,_0x32de7a){return function(_0x3d906d){if(!_0x3d906d){_0x3ffb6d[_0x2516('0x14')](0x194);}return _0x3d906d;};}function handleError(_0x4b1d4f,_0xa4538d){_0xa4538d=_0xa4538d||0x1f4;return function(_0x39c63f){logger[_0x2516('0x21')](_0x39c63f[_0x2516('0x22')]);if(_0x39c63f['name']){delete _0x39c63f[_0x2516('0x23')];}_0x4b1d4f[_0x2516('0x15')](_0xa4538d)[_0x2516('0x24')](_0x39c63f);};}exports[_0x2516('0x25')]=function(_0xd84b29,_0x4a3dc8){var _0x3c5c3c={},_0x1750e7={},_0x935035={'count':0x0,'rows':[]};var _0x2cb847=_[_0x2516('0x26')](db[_0x2516('0x27')]['rawAttributes'],function(_0x136893){return{'name':_0x136893[_0x2516('0x28')],'type':_0x136893['type'][_0x2516('0x29')]};});_0x1750e7[_0x2516('0x2a')]=_[_0x2516('0x26')](_0x2cb847,_0x2516('0x23'));_0x1750e7[_0x2516('0x2b')]=_[_0x2516('0x2c')](_0xd84b29[_0x2516('0x2b')]);_0x1750e7[_0x2516('0x2d')]=_[_0x2516('0x2e')](_0x1750e7[_0x2516('0x2a')],_0x1750e7[_0x2516('0x2b')]);_0x3c5c3c[_0x2516('0x2f')]=_[_0x2516('0x2e')](_0x1750e7[_0x2516('0x2a')],qs[_0x2516('0x30')](_0xd84b29['query'][_0x2516('0x30')]));_0x3c5c3c['attributes']=_0x3c5c3c[_0x2516('0x2f')]['length']?_0x3c5c3c[_0x2516('0x2f')]:_0x1750e7['model'];if(!_0xd84b29[_0x2516('0x2b')][_0x2516('0x31')](_0x2516('0x32'))){_0x3c5c3c[_0x2516('0x19')]=qs[_0x2516('0x19')](_0xd84b29[_0x2516('0x2b')][_0x2516('0x19')]);_0x3c5c3c[_0x2516('0x18')]=qs[_0x2516('0x18')](_0xd84b29['query'][_0x2516('0x18')]);}_0x3c5c3c[_0x2516('0x33')]=qs[_0x2516('0x34')](_0xd84b29[_0x2516('0x2b')]['sort']);_0x3c5c3c['where']=qs[_0x2516('0x2d')](_[_0x2516('0x35')](_0xd84b29[_0x2516('0x2b')],_0x1750e7[_0x2516('0x2d')]),_0x2cb847);if(_0xd84b29[_0x2516('0x2b')][_0x2516('0x36')]){_0x3c5c3c[_0x2516('0x37')]=_[_0x2516('0x38')](_0x3c5c3c[_0x2516('0x37')],{'$or':_[_0x2516('0x26')](_0x2cb847,function(_0x541d69){if(_0x541d69['type']!==_0x2516('0x39')){var _0x322021={};_0x322021[_0x541d69['name']]={'$like':'%'+_0xd84b29['query'][_0x2516('0x36')]+'%'};return _0x322021;}})});}_0x3c5c3c=_[_0x2516('0x38')]({},_0x3c5c3c,_0xd84b29['options']);var _0x3982ca={'where':_0x3c5c3c['where']};return db[_0x2516('0x27')][_0x2516('0x3a')](_0x3982ca)['then'](function(_0x978490){_0x935035[_0x2516('0x3a')]=_0x978490;if(_0xd84b29[_0x2516('0x2b')][_0x2516('0x3b')]){_0x3c5c3c[_0x2516('0x3c')]=[{'all':!![]}];}return db[_0x2516('0x27')][_0x2516('0x3d')](_0x3c5c3c);})[_0x2516('0x1f')](function(_0x346e31){_0x935035[_0x2516('0x3e')]=_0x346e31;return _0x935035;})[_0x2516('0x1f')](respondWithFilteredResult(_0x4a3dc8,_0x3c5c3c))[_0x2516('0x3f')](handleError(_0x4a3dc8,null));};exports[_0x2516('0x40')]=function(_0x4c832b,_0x1b72cd){var _0x1bc0e={'raw':![],'where':{'id':_0x4c832b[_0x2516('0x41')]['id']}},_0x5debf2={};_0x5debf2[_0x2516('0x2a')]=_[_0x2516('0x2c')](db[_0x2516('0x27')][_0x2516('0x42')]);_0x5debf2['query']=_[_0x2516('0x2c')](_0x4c832b[_0x2516('0x2b')]);_0x5debf2[_0x2516('0x2d')]=_[_0x2516('0x2e')](_0x5debf2[_0x2516('0x2a')],_0x5debf2[_0x2516('0x2b')]);_0x1bc0e['attributes']=_[_0x2516('0x2e')](_0x5debf2[_0x2516('0x2a')],qs[_0x2516('0x30')](_0x4c832b[_0x2516('0x2b')][_0x2516('0x30')]));_0x1bc0e[_0x2516('0x2f')]=_0x1bc0e[_0x2516('0x2f')]['length']?_0x1bc0e[_0x2516('0x2f')]:_0x5debf2['model'];if(_0x4c832b[_0x2516('0x2b')]['includeAll']){_0x1bc0e[_0x2516('0x3c')]=[{'all':!![]}];}_0x1bc0e=_[_0x2516('0x38')]({},_0x1bc0e,_0x4c832b[_0x2516('0x43')]);return db['UserProfileResource']['find'](_0x1bc0e)[_0x2516('0x1f')](handleEntityNotFound(_0x1b72cd,null))[_0x2516('0x1f')](respondWithResult(_0x1b72cd,null))['catch'](handleError(_0x1b72cd,null));};exports['create']=function(_0x33ed52,_0x147e05){return db[_0x2516('0x27')]['create'](_0x33ed52[_0x2516('0x44')],{})['then'](respondWithResult(_0x147e05,0xc9))[_0x2516('0x3f')](handleError(_0x147e05,null));};exports[_0x2516('0x1e')]=function(_0x318128,_0x3af4c9){if(_0x318128['body']['id']){delete _0x318128[_0x2516('0x44')]['id'];}return db[_0x2516('0x27')][_0x2516('0x45')]({'where':{'id':_0x318128[_0x2516('0x41')]['id']}})[_0x2516('0x1f')](handleEntityNotFound(_0x3af4c9,null))['then'](saveUpdates(_0x318128[_0x2516('0x44')],null))[_0x2516('0x1f')](respondWithResult(_0x3af4c9,null))[_0x2516('0x3f')](handleError(_0x3af4c9,null));};exports[_0x2516('0x20')]=function(_0x5a2a79,_0x45e179){return db[_0x2516('0x27')][_0x2516('0x45')]({'where':{'id':_0x5a2a79[_0x2516('0x41')]['id']}})[_0x2516('0x1f')](handleEntityNotFound(_0x45e179,null))['then'](removeEntity(_0x45e179,null))[_0x2516('0x3f')](handleError(_0x45e179,null));};exports[_0x2516('0x46')]=function(_0x136d5c,_0x2810e8){return db[_0x2516('0x27')][_0x2516('0x46')]()['then'](respondWithResult(_0x2810e8,null))['catch'](handleError(_0x2810e8,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 27008ba..ac7ff32 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 _0x8f5b=['util','../../config/logger','request-promise','path','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash'];(function(_0x3de4f8,_0x336c7d){var _0x3d81fc=function(_0x53b9f9){while(--_0x53b9f9){_0x3de4f8['push'](_0x3de4f8['shift']());}};_0x3d81fc(++_0x336c7d);}(_0x8f5b,0x141));var _0xb8f5=function(_0x226b68,_0x3d22fe){_0x226b68=_0x226b68-0x0;var _0x579e0f=_0x8f5b[_0x226b68];return _0x579e0f;};'use strict';var _=require(_0xb8f5('0x0'));var util=require(_0xb8f5('0x1'));var logger=require(_0xb8f5('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb8f5('0x3'));var fs=require('fs');var path=require(_0xb8f5('0x4'));var rimraf=require('rimraf');var config=require(_0xb8f5('0x5'));var attributes=require(_0xb8f5('0x6'));module[_0xb8f5('0x7')]=function(_0x158867,_0x4b5925){return _0x158867[_0xb8f5('0x8')](_0xb8f5('0x9'),attributes,{'tableName':_0xb8f5('0xa'),'paranoid':![],'indexes':[{'name':_0xb8f5('0xb'),'fields':[_0xb8f5('0xc'),_0xb8f5('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc476=['sectionId','api','moment','request-promise','path','rimraf','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId'];(function(_0x3304df,_0x5bb98f){var _0x569afd=function(_0x24af28){while(--_0x24af28){_0x3304df['push'](_0x3304df['shift']());}};_0x569afd(++_0x5bb98f);}(_0xc476,0x114));var _0x6c47=function(_0xb7e332,_0x5b58d7){_0xb7e332=_0xb7e332-0x0;var _0x48a874=_0xc476[_0xb7e332];return _0x48a874;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x6c47('0x0'));var moment=require(_0x6c47('0x1'));var BPromise=require('bluebird');var rp=require(_0x6c47('0x2'));var fs=require('fs');var path=require(_0x6c47('0x3'));var rimraf=require(_0x6c47('0x4'));var config=require('../../config/environment');var attributes=require('./userProfileResource.attributes');module['exports']=function(_0x4ed306,_0x167e42){return _0x4ed306[_0x6c47('0x5')](_0x6c47('0x6'),attributes,{'tableName':_0x6c47('0x7'),'paranoid':![],'indexes':[{'name':_0x6c47('0x8'),'fields':[_0x6c47('0x9'),_0x6c47('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index fc325c6..cf22948 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 _0x3e53=['error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x15523b,_0x388fe6){var _0x409eed=function(_0x2e79c4){while(--_0x2e79c4){_0x15523b['push'](_0x15523b['shift']());}};_0x409eed(++_0x388fe6);}(_0x3e53,0x130));var _0x33e5=function(_0x2a8686,_0x4cb393){_0x2a8686=_0x2a8686-0x0;var _0x3b2917=_0x3e53[_0x2a8686];return _0x3b2917;};'use strict';var _=require(_0x33e5('0x0'));var util=require('util');var moment=require(_0x33e5('0x1'));var BPromise=require(_0x33e5('0x2'));var rs=require(_0x33e5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x33e5('0x4'))['db'];var utils=require(_0x33e5('0x5'));var logger=require(_0x33e5('0x6'))(_0x33e5('0x7'));var config=require('../../config/environment');var jayson=require(_0x33e5('0x8'));var client=jayson[_0x33e5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20c04c,_0x1953d6,_0x5168ab){return new BPromise(function(_0x5286b8,_0x540c6b){return client[_0x33e5('0xa')](_0x20c04c,_0x5168ab)[_0x33e5('0xb')](function(_0x3e69fb){logger[_0x33e5('0xc')](_0x33e5('0xd'),_0x1953d6,'request\x20sent');logger[_0x33e5('0xe')](_0x33e5('0xf'),_0x1953d6,_0x33e5('0x10'),JSON[_0x33e5('0x11')](_0x3e69fb));if(_0x3e69fb[_0x33e5('0x12')]){if(_0x3e69fb[_0x33e5('0x12')][_0x33e5('0x13')]===0x1f4){logger['error'](_0x33e5('0xd'),_0x1953d6,_0x3e69fb['error']['message']);return _0x540c6b(_0x3e69fb['error'][_0x33e5('0x14')]);}logger[_0x33e5('0x12')](_0x33e5('0xd'),_0x1953d6,_0x3e69fb[_0x33e5('0x12')][_0x33e5('0x14')]);return _0x5286b8(_0x3e69fb[_0x33e5('0x12')][_0x33e5('0x14')]);}else{logger['info'](_0x33e5('0xd'),_0x1953d6,'request\x20sent');_0x5286b8(_0x3e69fb[_0x33e5('0x15')]['message']);}})[_0x33e5('0x16')](function(_0x310f08){logger[_0x33e5('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x1953d6,_0x310f08);_0x540c6b(_0x310f08);});});} \ No newline at end of file +var _0xf0d5=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','http','request','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s'];(function(_0x5d89bf,_0x3fb110){var _0x6840b1=function(_0x47305f){while(--_0x47305f){_0x5d89bf['push'](_0x5d89bf['shift']());}};_0x6840b1(++_0x3fb110);}(_0xf0d5,0x74));var _0x5f0d=function(_0x28c807,_0x5647ac){_0x28c807=_0x28c807-0x0;var _0x1266d2=_0xf0d5[_0x28c807];return _0x1266d2;};'use strict';var _=require(_0x5f0d('0x0'));var util=require(_0x5f0d('0x1'));var moment=require(_0x5f0d('0x2'));var BPromise=require(_0x5f0d('0x3'));var rs=require(_0x5f0d('0x4'));var fs=require('fs');var Redis=require(_0x5f0d('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x5f0d('0x6'));var jayson=require(_0x5f0d('0x7'));var client=jayson[_0x5f0d('0x8')][_0x5f0d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c0452,_0x4bc3d7,_0x118ae3){return new BPromise(function(_0x3d03de,_0x1b743f){return client[_0x5f0d('0xa')](_0x4c0452,_0x118ae3)['then'](function(_0x237b42){logger[_0x5f0d('0xb')](_0x5f0d('0xc'),_0x4bc3d7,_0x5f0d('0xd'));logger[_0x5f0d('0xe')](_0x5f0d('0xf'),_0x4bc3d7,'request\x20sent',JSON[_0x5f0d('0x10')](_0x237b42));if(_0x237b42[_0x5f0d('0x11')]){if(_0x237b42[_0x5f0d('0x11')][_0x5f0d('0x12')]===0x1f4){logger['error'](_0x5f0d('0xc'),_0x4bc3d7,_0x237b42[_0x5f0d('0x11')][_0x5f0d('0x13')]);return _0x1b743f(_0x237b42[_0x5f0d('0x11')][_0x5f0d('0x13')]);}logger[_0x5f0d('0x11')](_0x5f0d('0xc'),_0x4bc3d7,_0x237b42[_0x5f0d('0x11')][_0x5f0d('0x13')]);return _0x3d03de(_0x237b42[_0x5f0d('0x11')][_0x5f0d('0x13')]);}else{logger['info'](_0x5f0d('0xc'),_0x4bc3d7,'request\x20sent');_0x3d03de(_0x237b42[_0x5f0d('0x14')]['message']);}})[_0x5f0d('0x15')](function(_0x4778fe){logger[_0x5f0d('0x11')](_0x5f0d('0xc'),_0x4bc3d7,_0x4778fe);_0x1b743f(_0x4778fe);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 50504a2..6b8bca6 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 _0x95ca=['../../components/auth/service','../../config/environment','get','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','Router'];(function(_0x359124,_0xf0a2e7){var _0x164466=function(_0x24712c){while(--_0x24712c){_0x359124['push'](_0x359124['shift']());}};_0x164466(++_0xf0a2e7);}(_0x95ca,0x1ac));var _0xa95c=function(_0x183365,_0x138de6){_0x183365=_0x183365-0x0;var _0x63579e=_0x95ca[_0x183365];return _0x63579e;};'use strict';var multer=require(_0xa95c('0x0'));var util=require(_0xa95c('0x1'));var path=require(_0xa95c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa95c('0x3')]();var auth=require(_0xa95c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa95c('0x5'));var controller=require('./userProfileSection.controller');router[_0xa95c('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa95c('0x6')](_0xa95c('0x7'),auth[_0xa95c('0x8')](),controller['describe']);router[_0xa95c('0x6')](_0xa95c('0x9'),auth[_0xa95c('0x8')](),controller[_0xa95c('0xa')]);router[_0xa95c('0xb')]('/',auth[_0xa95c('0x8')](),controller[_0xa95c('0xc')]);router[_0xa95c('0xd')]('/:id',auth[_0xa95c('0x8')](),controller[_0xa95c('0xe')]);router[_0xa95c('0xf')](_0xa95c('0x9'),auth[_0xa95c('0x8')](),controller[_0xa95c('0x10')]);module[_0xa95c('0x11')]=router; \ No newline at end of file +var _0x8926=['/describe','/:id','show','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x3891d4,_0x889e97){var _0x33b275=function(_0x5049ca){while(--_0x5049ca){_0x3891d4['push'](_0x3891d4['shift']());}};_0x33b275(++_0x889e97);}(_0x8926,0x199));var _0x6892=function(_0x16987b,_0x12db08){_0x16987b=_0x16987b-0x0;var _0x3f91c7=_0x8926[_0x16987b];return _0x3f91c7;};'use strict';var multer=require('multer');var util=require(_0x6892('0x0'));var path=require(_0x6892('0x1'));var timeout=require(_0x6892('0x2'));var express=require(_0x6892('0x3'));var router=express[_0x6892('0x4')]();var auth=require(_0x6892('0x5'));var interaction=require(_0x6892('0x6'));var config=require(_0x6892('0x7'));var controller=require('./userProfileSection.controller');router[_0x6892('0x8')]('/',auth[_0x6892('0x9')](),controller[_0x6892('0xa')]);router['get'](_0x6892('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x6892('0x8')](_0x6892('0xc'),auth[_0x6892('0x9')](),controller[_0x6892('0xd')]);router[_0x6892('0xe')]('/',auth[_0x6892('0x9')](),controller[_0x6892('0xf')]);router[_0x6892('0x10')](_0x6892('0xc'),auth[_0x6892('0x9')](),controller[_0x6892('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x6892('0x12')]);module[_0x6892('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index e5f4e8e..81cfbd5 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 _0x5643=['BOOLEAN','setDataValue','crudPermissions','getDataValue','split','sequelize','exports','STRING','INTEGER'];(function(_0x35aad4,_0x34e491){var _0x348052=function(_0x50a139){while(--_0x50a139){_0x35aad4['push'](_0x35aad4['shift']());}};_0x348052(++_0x34e491);}(_0x5643,0x1a3));var _0x3564=function(_0x4a513f,_0x2321c0){_0x4a513f=_0x4a513f-0x0;var _0x27adce=_0x5643[_0x4a513f];return _0x27adce;};'use strict';var Sequelize=require(_0x3564('0x0'));module[_0x3564('0x1')]={'name':{'type':Sequelize[_0x3564('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x3564('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x3564('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x3564('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x3564('0x2')],'set':function(_0x22a27d){this[_0x3564('0x5')](_0x3564('0x6'),_0x22a27d?_0x22a27d['join'](''):[]);},'get':function(){return this[_0x3564('0x7')](_0x3564('0x6'))?this[_0x3564('0x7')](_0x3564('0x6'))[_0x3564('0x8')](''):[];}}}; \ No newline at end of file +var _0x210d=['crudPermissions','join','getDataValue','split','sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue'];(function(_0x380307,_0x440ccd){var _0x9ea14b=function(_0x51024c){while(--_0x51024c){_0x380307['push'](_0x380307['shift']());}};_0x9ea14b(++_0x440ccd);}(_0x210d,0x7c));var _0xd210=function(_0x3c04ef,_0x9d110c){_0x3c04ef=_0x3c04ef-0x0;var _0x6a3a69=_0x210d[_0x3c04ef];return _0x6a3a69;};'use strict';var Sequelize=require(_0xd210('0x0'));module[_0xd210('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0xd210('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xd210('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0xd210('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x201546){this[_0xd210('0x5')](_0xd210('0x6'),_0x201546?_0x201546[_0xd210('0x7')](''):[]);},'get':function(){return this[_0xd210('0x8')](_0xd210('0x6'))?this[_0xd210('0x8')](_0xd210('0x6'))[_0xd210('0x9')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 45fc0f5..7848a03 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 _0xcea2=['../../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','UserProfileSection','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','keys','options','find','create','body','params','describe','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'];(function(_0x1681eb,_0xe4240f){var _0x41422a=function(_0x1ec184){while(--_0x1ec184){_0x1681eb['push'](_0x1681eb['shift']());}};_0x41422a(++_0xe4240f);}(_0xcea2,0x15a));var _0x2cea=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xcea2[_0x525c7b];return _0x27b33e;};'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')]=_['map'](_0x2741cb,_0x2cea('0x25'));_0x3ea40c[_0x2cea('0x2e')]=_['keys'](_0x2bbe9b[_0x2cea('0x2e')]);_0x3ea40c[_0x2cea('0x2f')]=_[_0x2cea('0x30')](_0x3ea40c[_0x2cea('0x2d')],_0x3ea40c[_0x2cea('0x2e')]);_0x46ef5a[_0x2cea('0x31')]=_[_0x2cea('0x30')](_0x3ea40c[_0x2cea('0x2d')],qs[_0x2cea('0x32')](_0x2bbe9b[_0x2cea('0x2e')][_0x2cea('0x32')]));_0x46ef5a['attributes']=_0x46ef5a[_0x2cea('0x31')][_0x2cea('0x33')]?_0x46ef5a[_0x2cea('0x31')]:_0x3ea40c[_0x2cea('0x2d')];if(!_0x2bbe9b['query']['hasOwnProperty'](_0x2cea('0x34'))){_0x46ef5a[_0x2cea('0x35')]=qs['limit'](_0x2bbe9b[_0x2cea('0x2e')]['limit']);_0x46ef5a[_0x2cea('0x1a')]=qs['offset'](_0x2bbe9b[_0x2cea('0x2e')]['offset']);}_0x46ef5a[_0x2cea('0x36')]=qs[_0x2cea('0x37')](_0x2bbe9b['query'][_0x2cea('0x37')]);_0x46ef5a[_0x2cea('0x38')]=qs['filters'](_[_0x2cea('0x39')](_0x2bbe9b[_0x2cea('0x2e')],_0x3ea40c[_0x2cea('0x2f')]),_0x2741cb);if(_0x2bbe9b[_0x2cea('0x2e')][_0x2cea('0x3a')]){_0x46ef5a['where']=_[_0x2cea('0x3b')](_0x46ef5a[_0x2cea('0x38')],{'$or':_['map'](_0x2741cb,function(_0x53c088){if(_0x53c088[_0x2cea('0x2b')]!=='VIRTUAL'){var _0x4e6bb4={};_0x4e6bb4[_0x53c088['name']]={'$like':'%'+_0x2bbe9b['query'][_0x2cea('0x3a')]+'%'};return _0x4e6bb4;}})});}_0x46ef5a=_[_0x2cea('0x3b')]({},_0x46ef5a,_0x2bbe9b['options']);var _0x219560={'where':_0x46ef5a[_0x2cea('0x38')]};return db[_0x2cea('0x28')]['count'](_0x219560)[_0x2cea('0x21')](function(_0xcc11b6){_0xe99cca[_0x2cea('0x19')]=_0xcc11b6;if(_0x2bbe9b[_0x2cea('0x2e')][_0x2cea('0x3c')]){_0x46ef5a[_0x2cea('0x3d')]=[{'all':!![]}];}return db[_0x2cea('0x28')][_0x2cea('0x3e')](_0x46ef5a);})[_0x2cea('0x21')](function(_0x27677c){_0xe99cca[_0x2cea('0x3f')]=_0x27677c;return _0xe99cca;})[_0x2cea('0x21')](respondWithFilteredResult(_0x32af98,_0x46ef5a))[_0x2cea('0x40')](handleError(_0x32af98,null));};exports[_0x2cea('0x41')]=function(_0x190a29,_0x28bb35){var _0x36efa8={'raw':![],'where':{'id':_0x190a29['params']['id']}},_0xa0692d={};_0xa0692d[_0x2cea('0x2d')]=_['keys'](db[_0x2cea('0x28')][_0x2cea('0x29')]);_0xa0692d[_0x2cea('0x2e')]=_[_0x2cea('0x42')](_0x190a29[_0x2cea('0x2e')]);_0xa0692d[_0x2cea('0x2f')]=_[_0x2cea('0x30')](_0xa0692d[_0x2cea('0x2d')],_0xa0692d[_0x2cea('0x2e')]);_0x36efa8[_0x2cea('0x31')]=_['intersection'](_0xa0692d['model'],qs[_0x2cea('0x32')](_0x190a29[_0x2cea('0x2e')]['fields']));_0x36efa8[_0x2cea('0x31')]=_0x36efa8['attributes'][_0x2cea('0x33')]?_0x36efa8['attributes']:_0xa0692d[_0x2cea('0x2d')];if(_0x190a29[_0x2cea('0x2e')][_0x2cea('0x3c')]){_0x36efa8[_0x2cea('0x3d')]=[{'all':!![]}];}_0x36efa8=_[_0x2cea('0x3b')]({},_0x36efa8,_0x190a29[_0x2cea('0x43')]);return db[_0x2cea('0x28')][_0x2cea('0x44')](_0x36efa8)[_0x2cea('0x21')](handleEntityNotFound(_0x28bb35,null))[_0x2cea('0x21')](respondWithResult(_0x28bb35,null))['catch'](handleError(_0x28bb35,null));};exports[_0x2cea('0x45')]=function(_0x4771a0,_0x123520){return db[_0x2cea('0x28')]['create'](_0x4771a0['body'],{})[_0x2cea('0x21')](respondWithResult(_0x123520,0xc9))[_0x2cea('0x40')](handleError(_0x123520,null));};exports[_0x2cea('0x20')]=function(_0x510e0f,_0x2a5e20){if(_0x510e0f[_0x2cea('0x46')]['id']){delete _0x510e0f[_0x2cea('0x46')]['id'];}return db[_0x2cea('0x28')]['find']({'where':{'id':_0x510e0f[_0x2cea('0x47')]['id']}})['then'](handleEntityNotFound(_0x2a5e20,null))['then'](saveUpdates(_0x510e0f[_0x2cea('0x46')],null))[_0x2cea('0x21')](respondWithResult(_0x2a5e20,null))[_0x2cea('0x40')](handleError(_0x2a5e20,null));};exports[_0x2cea('0x22')]=function(_0x542c10,_0x492fcf){return db[_0x2cea('0x28')][_0x2cea('0x44')]({'where':{'id':_0x542c10[_0x2cea('0x47')]['id']}})[_0x2cea('0x21')](handleEntityNotFound(_0x492fcf,null))['then'](removeEntity(_0x492fcf,null))['catch'](handleError(_0x492fcf,null));};exports['describe']=function(_0x31c559,_0x3e7d11){return db[_0x2cea('0x28')][_0x2cea('0x48')]()[_0x2cea('0x21')](respondWithResult(_0x3e7d11,null))[_0x2cea('0x40')](handleError(_0x3e7d11,null));}; \ No newline at end of file +var _0xe80c=['intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','show','params','create','body','catch','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','set','Content-Range','save','then','destroy','end','name','send','index','map','UserProfileSection','rawAttributes','type','key','model','query','keys','filters','attributes'];(function(_0x49b9ef,_0x55547f){var _0x4de813=function(_0x4647cb){while(--_0x4647cb){_0x49b9ef['push'](_0x49b9ef['shift']());}};_0x4de813(++_0x55547f);}(_0xe80c,0x1c2));var _0xce80=function(_0x31f3cb,_0x5aceff){_0x31f3cb=_0x31f3cb-0x0;var _0x4fa487=_0xe80c[_0x31f3cb];return _0x4fa487;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xce80('0x0'));var rimraf=require(_0xce80('0x1'));var zipdir=require(_0xce80('0x2'));var jsonpatch=require(_0xce80('0x3'));var rp=require(_0xce80('0x4'));var moment=require('moment');var BPromise=require(_0xce80('0x5'));var Mustache=require(_0xce80('0x6'));var util=require(_0xce80('0x7'));var path=require(_0xce80('0x8'));var sox=require('sox');var csv=require(_0xce80('0x9'));var ejs=require(_0xce80('0xa'));var fs=require('fs');var _=require(_0xce80('0xb'));var squel=require('squel');var crypto=require(_0xce80('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xce80('0xd'));var toCsv=require('to-csv');var querystring=require(_0xce80('0xe'));var Papa=require(_0xce80('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xce80('0x10'));var as=require(_0xce80('0x11'));var hardwareService=require(_0xce80('0x12'));var logger=require(_0xce80('0x13'))(_0xce80('0x14'));var utils=require(_0xce80('0x15'));var config=require(_0xce80('0x16'));var db=require(_0xce80('0x17'))['db'];function respondWithStatusCode(_0x4ac266,_0x45a9b7){_0x45a9b7=_0x45a9b7||0xcc;return function(_0x37561b){if(_0x37561b){return _0x4ac266[_0xce80('0x18')](_0x45a9b7);}return _0x4ac266['status'](_0x45a9b7)['end']();};}function respondWithResult(_0x3ab0e2,_0x1903ec){_0x1903ec=_0x1903ec||0xc8;return function(_0x15f870){if(_0x15f870){return _0x3ab0e2[_0xce80('0x19')](_0x1903ec)['json'](_0x15f870);}};}function respondWithFilteredResult(_0x2cd5b3,_0x5d134e){return function(_0x9402b9){if(_0x9402b9){var _0x48796f=_0x9402b9['count'],_0x24efa3=_0x5d134e['offset'],_0x43b8da=_0x5d134e[_0xce80('0x1a')]+_0x5d134e[_0xce80('0x1b')],_0x4a8cab;if(_0x43b8da>=_0x48796f){_0x43b8da=_0x48796f;_0x4a8cab=0xc8;}else{_0x4a8cab=0xce;}_0x2cd5b3[_0xce80('0x19')](_0x4a8cab);return _0x2cd5b3[_0xce80('0x1c')](_0xce80('0x1d'),_0x24efa3+'-'+_0x43b8da+'/'+_0x48796f)['json'](_0x9402b9);}return null;};}function patchUpdates(_0x1bf7c4){return function(_0xc459ce){try{jsonpatch['apply'](_0xc459ce,_0x1bf7c4,!![]);}catch(_0x56865a){return BPromise['reject'](_0x56865a);}return _0xc459ce[_0xce80('0x1e')]();};}function saveUpdates(_0x433472,_0x468b61){return function(_0x44f399){if(_0x44f399){return _0x44f399['update'](_0x433472)[_0xce80('0x1f')](function(_0x10ba3d){return _0x10ba3d;});}return null;};}function removeEntity(_0x2c0fcd,_0x5315eb){return function(_0x4df9bb){if(_0x4df9bb){return _0x4df9bb[_0xce80('0x20')]()['then'](function(){_0x2c0fcd[_0xce80('0x19')](0xcc)[_0xce80('0x21')]();});}};}function handleEntityNotFound(_0x2c5d01,_0x34f511){return function(_0x4fc91c){if(!_0x4fc91c){_0x2c5d01[_0xce80('0x18')](0x194);}return _0x4fc91c;};}function handleError(_0x4982a9,_0x42a1dd){_0x42a1dd=_0x42a1dd||0x1f4;return function(_0x3fef3d){logger['error'](_0x3fef3d['stack']);if(_0x3fef3d[_0xce80('0x22')]){delete _0x3fef3d['name'];}_0x4982a9[_0xce80('0x19')](_0x42a1dd)[_0xce80('0x23')](_0x3fef3d);};}exports[_0xce80('0x24')]=function(_0x1d03ba,_0x4c3e8a){var _0x8fd32c={},_0x148e90={},_0x1fec80={'count':0x0,'rows':[]};var _0x3d7c49=_[_0xce80('0x25')](db[_0xce80('0x26')][_0xce80('0x27')],function(_0x6d1190){return{'name':_0x6d1190['fieldName'],'type':_0x6d1190[_0xce80('0x28')][_0xce80('0x29')]};});_0x148e90[_0xce80('0x2a')]=_[_0xce80('0x25')](_0x3d7c49,_0xce80('0x22'));_0x148e90[_0xce80('0x2b')]=_[_0xce80('0x2c')](_0x1d03ba['query']);_0x148e90[_0xce80('0x2d')]=_['intersection'](_0x148e90['model'],_0x148e90[_0xce80('0x2b')]);_0x8fd32c[_0xce80('0x2e')]=_[_0xce80('0x2f')](_0x148e90[_0xce80('0x2a')],qs[_0xce80('0x30')](_0x1d03ba[_0xce80('0x2b')][_0xce80('0x30')]));_0x8fd32c[_0xce80('0x2e')]=_0x8fd32c['attributes'][_0xce80('0x31')]?_0x8fd32c['attributes']:_0x148e90[_0xce80('0x2a')];if(!_0x1d03ba[_0xce80('0x2b')][_0xce80('0x32')](_0xce80('0x33'))){_0x8fd32c[_0xce80('0x1b')]=qs[_0xce80('0x1b')](_0x1d03ba['query'][_0xce80('0x1b')]);_0x8fd32c[_0xce80('0x1a')]=qs[_0xce80('0x1a')](_0x1d03ba[_0xce80('0x2b')][_0xce80('0x1a')]);}_0x8fd32c[_0xce80('0x34')]=qs['sort'](_0x1d03ba['query'][_0xce80('0x35')]);_0x8fd32c[_0xce80('0x36')]=qs[_0xce80('0x2d')](_[_0xce80('0x37')](_0x1d03ba[_0xce80('0x2b')],_0x148e90['filters']),_0x3d7c49);if(_0x1d03ba[_0xce80('0x2b')][_0xce80('0x38')]){_0x8fd32c[_0xce80('0x36')]=_[_0xce80('0x39')](_0x8fd32c[_0xce80('0x36')],{'$or':_[_0xce80('0x25')](_0x3d7c49,function(_0x1acc00){if(_0x1acc00[_0xce80('0x28')]!==_0xce80('0x3a')){var _0x45e175={};_0x45e175[_0x1acc00['name']]={'$like':'%'+_0x1d03ba[_0xce80('0x2b')]['filter']+'%'};return _0x45e175;}})});}_0x8fd32c=_[_0xce80('0x39')]({},_0x8fd32c,_0x1d03ba[_0xce80('0x3b')]);var _0x3111a9={'where':_0x8fd32c[_0xce80('0x36')]};return db[_0xce80('0x26')]['count'](_0x3111a9)[_0xce80('0x1f')](function(_0x4273dd){_0x1fec80[_0xce80('0x3c')]=_0x4273dd;if(_0x1d03ba['query'][_0xce80('0x3d')]){_0x8fd32c['include']=[{'all':!![]}];}return db[_0xce80('0x26')][_0xce80('0x3e')](_0x8fd32c);})[_0xce80('0x1f')](function(_0x48a169){_0x1fec80[_0xce80('0x3f')]=_0x48a169;return _0x1fec80;})[_0xce80('0x1f')](respondWithFilteredResult(_0x4c3e8a,_0x8fd32c))['catch'](handleError(_0x4c3e8a,null));};exports[_0xce80('0x40')]=function(_0x3226a4,_0xa4c7f){var _0x12bb2c={'raw':![],'where':{'id':_0x3226a4[_0xce80('0x41')]['id']}},_0x4e224a={};_0x4e224a['model']=_[_0xce80('0x2c')](db[_0xce80('0x26')][_0xce80('0x27')]);_0x4e224a[_0xce80('0x2b')]=_[_0xce80('0x2c')](_0x3226a4[_0xce80('0x2b')]);_0x4e224a[_0xce80('0x2d')]=_[_0xce80('0x2f')](_0x4e224a[_0xce80('0x2a')],_0x4e224a['query']);_0x12bb2c[_0xce80('0x2e')]=_[_0xce80('0x2f')](_0x4e224a[_0xce80('0x2a')],qs['fields'](_0x3226a4[_0xce80('0x2b')][_0xce80('0x30')]));_0x12bb2c[_0xce80('0x2e')]=_0x12bb2c['attributes'][_0xce80('0x31')]?_0x12bb2c['attributes']:_0x4e224a[_0xce80('0x2a')];if(_0x3226a4[_0xce80('0x2b')][_0xce80('0x3d')]){_0x12bb2c['include']=[{'all':!![]}];}_0x12bb2c=_[_0xce80('0x39')]({},_0x12bb2c,_0x3226a4[_0xce80('0x3b')]);return db[_0xce80('0x26')]['find'](_0x12bb2c)[_0xce80('0x1f')](handleEntityNotFound(_0xa4c7f,null))['then'](respondWithResult(_0xa4c7f,null))['catch'](handleError(_0xa4c7f,null));};exports[_0xce80('0x42')]=function(_0x3dc8c6,_0x42a4be){return db[_0xce80('0x26')][_0xce80('0x42')](_0x3dc8c6[_0xce80('0x43')],{})[_0xce80('0x1f')](respondWithResult(_0x42a4be,0xc9))[_0xce80('0x44')](handleError(_0x42a4be,null));};exports['update']=function(_0x217fa4,_0x563ff1){if(_0x217fa4[_0xce80('0x43')]['id']){delete _0x217fa4[_0xce80('0x43')]['id'];}return db[_0xce80('0x26')][_0xce80('0x45')]({'where':{'id':_0x217fa4[_0xce80('0x41')]['id']}})[_0xce80('0x1f')](handleEntityNotFound(_0x563ff1,null))['then'](saveUpdates(_0x217fa4[_0xce80('0x43')],null))['then'](respondWithResult(_0x563ff1,null))[_0xce80('0x44')](handleError(_0x563ff1,null));};exports['destroy']=function(_0x58a336,_0x28d4e6){return db[_0xce80('0x26')][_0xce80('0x45')]({'where':{'id':_0x58a336[_0xce80('0x41')]['id']}})['then'](handleEntityNotFound(_0x28d4e6,null))[_0xce80('0x1f')](removeEntity(_0x28d4e6,null))[_0xce80('0x44')](handleError(_0x28d4e6,null));};exports['describe']=function(_0x300901,_0x10add8){return db[_0xce80('0x26')][_0xce80('0x46')]()['then'](respondWithResult(_0x10add8,null))['catch'](handleError(_0x10add8,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index b37ae84..0dcc43c 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 _0xa641=['compositeIndex','sectionId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define'];(function(_0x53bc38,_0x5a425f){var _0x475614=function(_0x28eba3){while(--_0x28eba3){_0x53bc38['push'](_0x53bc38['shift']());}};_0x475614(++_0x5a425f);}(_0xa641,0x188));var _0x1a64=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xa641[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x1a64('0x0'));var util=require(_0x1a64('0x1'));var logger=require(_0x1a64('0x2'))(_0x1a64('0x3'));var moment=require(_0x1a64('0x4'));var BPromise=require(_0x1a64('0x5'));var rp=require(_0x1a64('0x6'));var fs=require('fs');var path=require(_0x1a64('0x7'));var rimraf=require(_0x1a64('0x8'));var config=require(_0x1a64('0x9'));var attributes=require(_0x1a64('0xa'));module[_0x1a64('0xb')]=function(_0x76c84a,_0x304cdc){return _0x76c84a[_0x1a64('0xc')]('UserProfileSection',attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x1a64('0xd'),'fields':[_0x1a64('0xe'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x01ad=['bluebird','request-promise','path','../../config/environment','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','lodash','util','api','moment'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x01ad,0x168));var _0xd01a=function(_0x479650,_0x2bee99){_0x479650=_0x479650-0x0;var _0x26b288=_0x01ad[_0x479650];return _0x26b288;};'use strict';var _=require(_0xd01a('0x0'));var util=require(_0xd01a('0x1'));var logger=require('../../config/logger')(_0xd01a('0x2'));var moment=require(_0xd01a('0x3'));var BPromise=require(_0xd01a('0x4'));var rp=require(_0xd01a('0x5'));var fs=require('fs');var path=require(_0xd01a('0x6'));var rimraf=require('rimraf');var config=require(_0xd01a('0x7'));var attributes=require('./userProfileSection.attributes');module[_0xd01a('0x8')]=function(_0x1a23c6,_0x2a39b6){return _0x1a23c6[_0xd01a('0x9')](_0xd01a('0xa'),attributes,{'tableName':_0xd01a('0xb'),'paranoid':![],'indexes':[{'name':_0xd01a('0xc'),'fields':[_0xd01a('0xd'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index f981944..0bfb503 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 _0x653e=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','error','UserProfileSection,\x20%s,\x20%s','message'];(function(_0x48cc4a,_0x4de959){var _0xe5cb20=function(_0x1af55c){while(--_0x1af55c){_0x48cc4a['push'](_0x48cc4a['shift']());}};_0xe5cb20(++_0x4de959);}(_0x653e,0xba));var _0xe653=function(_0x3ccc44,_0x207b0c){_0x3ccc44=_0x3ccc44-0x0;var _0x5d74bb=_0x653e[_0x3ccc44];return _0x5d74bb;};'use strict';var _=require(_0xe653('0x0'));var util=require(_0xe653('0x1'));var moment=require(_0xe653('0x2'));var BPromise=require(_0xe653('0x3'));var rs=require(_0xe653('0x4'));var fs=require('fs');var Redis=require(_0xe653('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe653('0x6'));var logger=require(_0xe653('0x7'))(_0xe653('0x8'));var config=require(_0xe653('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe653('0xa')][_0xe653('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x294765,_0x428d94,_0x298453){return new BPromise(function(_0x169ee0,_0x4436b8){return client[_0xe653('0xc')](_0x294765,_0x298453)[_0xe653('0xd')](function(_0x2d0aa5){logger[_0xe653('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x428d94,'request\x20sent');logger[_0xe653('0xf')](_0xe653('0x10'),_0x428d94,_0xe653('0x11'),JSON['stringify'](_0x2d0aa5));if(_0x2d0aa5[_0xe653('0x12')]){if(_0x2d0aa5[_0xe653('0x12')]['code']===0x1f4){logger[_0xe653('0x12')](_0xe653('0x13'),_0x428d94,_0x2d0aa5[_0xe653('0x12')][_0xe653('0x14')]);return _0x4436b8(_0x2d0aa5['error'][_0xe653('0x14')]);}logger[_0xe653('0x12')](_0xe653('0x13'),_0x428d94,_0x2d0aa5['error']['message']);return _0x169ee0(_0x2d0aa5[_0xe653('0x12')]['message']);}else{logger[_0xe653('0xe')](_0xe653('0x13'),_0x428d94,'request\x20sent');_0x169ee0(_0x2d0aa5[_0xe653('0x15')][_0xe653('0x14')]);}})[_0xe653('0x16')](function(_0x5415dd){logger[_0xe653('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x428d94,_0x5415dd);_0x4436b8(_0x5415dd);});});} \ No newline at end of file +var _0xd8f3=['debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent'];(function(_0xd2f4ac,_0x5aa8e5){var _0x9757b2=function(_0x442ced){while(--_0x442ced){_0xd2f4ac['push'](_0xd2f4ac['shift']());}};_0x9757b2(++_0x5aa8e5);}(_0xd8f3,0xc4));var _0x3d8f=function(_0x25c16b,_0x2c5483){_0x25c16b=_0x25c16b-0x0;var _0x3c900f=_0xd8f3[_0x25c16b];return _0x3c900f;};'use strict';var _=require(_0x3d8f('0x0'));var util=require(_0x3d8f('0x1'));var moment=require(_0x3d8f('0x2'));var BPromise=require(_0x3d8f('0x3'));var rs=require(_0x3d8f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3d8f('0x5'));var logger=require(_0x3d8f('0x6'))(_0x3d8f('0x7'));var config=require(_0x3d8f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3d8f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1bd6b2,_0x567bc6,_0x2c98a0){return new BPromise(function(_0x2be605,_0x157b64){return client['request'](_0x1bd6b2,_0x2c98a0)[_0x3d8f('0xa')](function(_0x1e4c32){logger[_0x3d8f('0xb')](_0x3d8f('0xc'),_0x567bc6,_0x3d8f('0xd'));logger[_0x3d8f('0xe')](_0x3d8f('0xf'),_0x567bc6,'request\x20sent',JSON[_0x3d8f('0x10')](_0x1e4c32));if(_0x1e4c32[_0x3d8f('0x11')]){if(_0x1e4c32['error']['code']===0x1f4){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x567bc6,_0x1e4c32[_0x3d8f('0x11')]['message']);return _0x157b64(_0x1e4c32[_0x3d8f('0x11')][_0x3d8f('0x12')]);}logger[_0x3d8f('0x11')](_0x3d8f('0xc'),_0x567bc6,_0x1e4c32[_0x3d8f('0x11')][_0x3d8f('0x12')]);return _0x2be605(_0x1e4c32[_0x3d8f('0x11')]['message']);}else{logger[_0x3d8f('0xb')]('UserProfileSection,\x20%s,\x20%s',_0x567bc6,_0x3d8f('0xd'));_0x2be605(_0x1e4c32[_0x3d8f('0x13')][_0x3d8f('0x12')]);}})[_0x3d8f('0x14')](function(_0x28e7e6){logger[_0x3d8f('0x11')](_0x3d8f('0xc'),_0x567bc6,_0x28e7e6);_0x157b64(_0x28e7e6);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 828ffb8..bc195b2 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 _0x1670=['multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5d0f24,_0xb8072f){var _0x4fb7d1=function(_0x4eace1){while(--_0x4eace1){_0x5d0f24['push'](_0x5d0f24['shift']());}};_0x4fb7d1(++_0xb8072f);}(_0x1670,0x9a));var _0x0167=function(_0x3c595a,_0x516743){_0x3c595a=_0x3c595a-0x0;var _0x89be42=_0x1670[_0x3c595a];return _0x89be42;};'use strict';var multer=require(_0x0167('0x0'));var util=require(_0x0167('0x1'));var path=require('path');var timeout=require(_0x0167('0x2'));var express=require('express');var router=express[_0x0167('0x3')]();var auth=require(_0x0167('0x4'));var interaction=require(_0x0167('0x5'));var config=require(_0x0167('0x6'));module['exports']=router; \ No newline at end of file +var _0xf524=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','path','connect-timeout'];(function(_0x198baa,_0x37e07b){var _0x28398d=function(_0x4dd4ee){while(--_0x4dd4ee){_0x198baa['push'](_0x198baa['shift']());}};_0x28398d(++_0x37e07b);}(_0xf524,0x14a));var _0x4f52=function(_0x2dd22e,_0xec41fe){_0x2dd22e=_0x2dd22e-0x0;var _0x257b01=_0xf524[_0x2dd22e];return _0x257b01;};'use strict';var multer=require(_0x4f52('0x0'));var util=require('util');var path=require(_0x4f52('0x1'));var timeout=require(_0x4f52('0x2'));var express=require(_0x4f52('0x3'));var router=express[_0x4f52('0x4')]();var auth=require(_0x4f52('0x5'));var interaction=require(_0x4f52('0x6'));var config=require(_0x4f52('0x7'));module[_0x4f52('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 57d2721..22ded37 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(_0x160e3c,_0x50f7cb){var _0x4aaf9c=function(_0x26d562){while(--_0x26d562){_0x160e3c['push'](_0x160e3c['shift']());}};_0x4aaf9c(++_0x50f7cb);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x356c85,_0x22b9c7){var _0x4d6fa1=function(_0x41277b){while(--_0x41277b){_0x356c85['push'](_0x356c85['shift']());}};_0x4d6fa1(++_0x22b9c7);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 1f16f3a..48608a5 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 _0x5e95=['define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./userSmsQueue.attributes','exports'];(function(_0x3b37cb,_0x427328){var _0x1c4933=function(_0x41f8d6){while(--_0x41f8d6){_0x3b37cb['push'](_0x3b37cb['shift']());}};_0x1c4933(++_0x427328);}(_0x5e95,0x13b));var _0x55e9=function(_0x38b2d8,_0x39ce86){_0x38b2d8=_0x38b2d8-0x0;var _0x492c43=_0x5e95[_0x38b2d8];return _0x492c43;};'use strict';var _=require(_0x55e9('0x0'));var util=require(_0x55e9('0x1'));var logger=require(_0x55e9('0x2'))('api');var moment=require(_0x55e9('0x3'));var BPromise=require(_0x55e9('0x4'));var rp=require(_0x55e9('0x5'));var fs=require('fs');var path=require(_0x55e9('0x6'));var rimraf=require('rimraf');var config=require(_0x55e9('0x7'));var attributes=require(_0x55e9('0x8'));module[_0x55e9('0x9')]=function(_0x14f849,_0x56363a){return _0x14f849[_0x55e9('0xa')](_0x55e9('0xb'),attributes,{'tableName':_0x55e9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa88b=['UserSmsQueue','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports'];(function(_0x1eb3f6,_0x3f8dc7){var _0x511f68=function(_0x33d351){while(--_0x33d351){_0x1eb3f6['push'](_0x1eb3f6['shift']());}};_0x511f68(++_0x3f8dc7);}(_0xa88b,0x182));var _0xba88=function(_0x191154,_0x56f74c){_0x191154=_0x191154-0x0;var _0x3dcd73=_0xa88b[_0x191154];return _0x3dcd73;};'use strict';var _=require('lodash');var util=require(_0xba88('0x0'));var logger=require('../../config/logger')(_0xba88('0x1'));var moment=require(_0xba88('0x2'));var BPromise=require(_0xba88('0x3'));var rp=require(_0xba88('0x4'));var fs=require('fs');var path=require(_0xba88('0x5'));var rimraf=require(_0xba88('0x6'));var config=require(_0xba88('0x7'));var attributes=require(_0xba88('0x8'));module[_0xba88('0x9')]=function(_0x12d76c,_0x5c2663){return _0x12d76c['define'](_0xba88('0xa'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 3f4cc2a..5debb72 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 _0xaa0e=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xeda6fe,_0x1231e5){var _0x4bda28=function(_0x32ec36){while(--_0x32ec36){_0xeda6fe['push'](_0xeda6fe['shift']());}};_0x4bda28(++_0x1231e5);}(_0xaa0e,0xd1));var _0xeaa0=function(_0x1b5a05,_0x2c80de){_0x1b5a05=_0x1b5a05-0x0;var _0x347931=_0xaa0e[_0x1b5a05];return _0x347931;};'use strict';var _=require(_0xeaa0('0x0'));var util=require(_0xeaa0('0x1'));var moment=require('moment');var BPromise=require(_0xeaa0('0x2'));var rs=require(_0xeaa0('0x3'));var fs=require('fs');var Redis=require(_0xeaa0('0x4'));var db=require(_0xeaa0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xeaa0('0x6'))(_0xeaa0('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeaa0('0x8')][_0xeaa0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d5520,_0x5b40a0,_0x4a4a5a){return new BPromise(function(_0x328581,_0x356962){return client[_0xeaa0('0xa')](_0x2d5520,_0x4a4a5a)[_0xeaa0('0xb')](function(_0xea90f8){logger[_0xeaa0('0xc')](_0xeaa0('0xd'),_0x5b40a0,_0xeaa0('0xe'));logger[_0xeaa0('0xf')](_0xeaa0('0x10'),_0x5b40a0,_0xeaa0('0xe'),JSON[_0xeaa0('0x11')](_0xea90f8));if(_0xea90f8[_0xeaa0('0x12')]){if(_0xea90f8[_0xeaa0('0x12')][_0xeaa0('0x13')]===0x1f4){logger[_0xeaa0('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x5b40a0,_0xea90f8[_0xeaa0('0x12')][_0xeaa0('0x14')]);return _0x356962(_0xea90f8[_0xeaa0('0x12')][_0xeaa0('0x14')]);}logger[_0xeaa0('0x12')](_0xeaa0('0xd'),_0x5b40a0,_0xea90f8[_0xeaa0('0x12')][_0xeaa0('0x14')]);return _0x328581(_0xea90f8[_0xeaa0('0x12')]['message']);}else{logger[_0xeaa0('0xc')](_0xeaa0('0xd'),_0x5b40a0,'request\x20sent');_0x328581(_0xea90f8[_0xeaa0('0x15')]['message']);}})[_0xeaa0('0x16')](function(_0x29a142){logger[_0xeaa0('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x5b40a0,_0x29a142);_0x356962(_0x29a142);});});} \ No newline at end of file +var _0xf631=['message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','UserSmsQueue,\x20%s,\x20%s','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xbcdd2e,_0x588d17){var _0x9254e3=function(_0x13345e){while(--_0x13345e){_0xbcdd2e['push'](_0xbcdd2e['shift']());}};_0x9254e3(++_0x588d17);}(_0xf631,0x72));var _0x1f63=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf631[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1f63('0x0'));var util=require(_0x1f63('0x1'));var moment=require(_0x1f63('0x2'));var BPromise=require(_0x1f63('0x3'));var rs=require(_0x1f63('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f63('0x5'))['db'];var utils=require(_0x1f63('0x6'));var logger=require('../../config/logger')(_0x1f63('0x7'));var config=require('../../config/environment');var jayson=require(_0x1f63('0x8'));var client=jayson['client'][_0x1f63('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x585fdf,_0x47b8c5,_0x490768){return new BPromise(function(_0x59e4d6,_0x5c08f9){return client[_0x1f63('0xa')](_0x585fdf,_0x490768)[_0x1f63('0xb')](function(_0x5322cc){logger['info'](_0x1f63('0xc'),_0x47b8c5,_0x1f63('0xd'));logger['debug'](_0x1f63('0xe'),_0x47b8c5,'request\x20sent',JSON[_0x1f63('0xf')](_0x5322cc));if(_0x5322cc[_0x1f63('0x10')]){if(_0x5322cc[_0x1f63('0x10')][_0x1f63('0x11')]===0x1f4){logger['error'](_0x1f63('0xc'),_0x47b8c5,_0x5322cc[_0x1f63('0x10')]['message']);return _0x5c08f9(_0x5322cc[_0x1f63('0x10')][_0x1f63('0x12')]);}logger[_0x1f63('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x47b8c5,_0x5322cc[_0x1f63('0x10')][_0x1f63('0x12')]);return _0x59e4d6(_0x5322cc['error'][_0x1f63('0x12')]);}else{logger[_0x1f63('0x13')](_0x1f63('0xc'),_0x47b8c5,_0x1f63('0xd'));_0x59e4d6(_0x5322cc[_0x1f63('0x14')][_0x1f63('0x12')]);}})[_0x1f63('0x15')](function(_0x382d96){logger[_0x1f63('0x10')](_0x1f63('0xc'),_0x47b8c5,_0x382d96);_0x5c08f9(_0x382d96);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 06d5a78..71240b9 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 _0xb878=['path','connect-timeout','Router','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xb878,0x1aa));var _0x8b87=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xb878[_0x8c43de];return _0xa6591b;};'use strict';var multer=require(_0x8b87('0x0'));var util=require('util');var path=require(_0x8b87('0x1'));var timeout=require(_0x8b87('0x2'));var express=require('express');var router=express[_0x8b87('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x8b87('0x4'));var config=require(_0x8b87('0x5'));module[_0x8b87('0x6')]=router; \ No newline at end of file +var _0xc4e4=['Router','../../config/environment','util','path','express'];(function(_0x4eeeb1,_0x56ffc0){var _0x292f19=function(_0x4d497b){while(--_0x4d497b){_0x4eeeb1['push'](_0x4eeeb1['shift']());}};_0x292f19(++_0x56ffc0);}(_0xc4e4,0x160));var _0x4c4e=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xc4e4[_0x1035c1];return _0x308d67;};'use strict';var multer=require('multer');var util=require(_0x4c4e('0x0'));var path=require(_0x4c4e('0x1'));var timeout=require('connect-timeout');var express=require(_0x4c4e('0x2'));var router=express[_0x4c4e('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4c4e('0x4'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index aa2d03f..23cd669 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.attributes.js +++ b/server/api/userVoiceQueue/userVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x5d8afd,_0xd7f769){var _0x336c61=function(_0x539e58){while(--_0x539e58){_0x5d8afd['push'](_0x5d8afd['shift']());}};_0x336c61(++_0xd7f769);}(_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(_0x4124b8,_0x39a5fb){var _0xdd927=function(_0x2fb8ab){while(--_0x2fb8ab){_0x4124b8['push'](_0x4124b8['shift']());}};_0xdd927(++_0x39a5fb);}(_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/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index dc9efd9..88b63f8 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 _0xac31=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','UserVoiceQueue','user_has_voice_queues','lodash','util'];(function(_0x405c31,_0x3e7409){var _0x758b03=function(_0x216202){while(--_0x216202){_0x405c31['push'](_0x405c31['shift']());}};_0x758b03(++_0x3e7409);}(_0xac31,0xca));var _0x1ac3=function(_0x1cf551,_0x5cdc5a){_0x1cf551=_0x1cf551-0x0;var _0x4965d0=_0xac31[_0x1cf551];return _0x4965d0;};'use strict';var _=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var logger=require(_0x1ac3('0x2'))(_0x1ac3('0x3'));var moment=require(_0x1ac3('0x4'));var BPromise=require(_0x1ac3('0x5'));var rp=require(_0x1ac3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1ac3('0x7'));var config=require(_0x1ac3('0x8'));var attributes=require('./userVoiceQueue.attributes');module['exports']=function(_0xbe22b7,_0x20027f){return _0xbe22b7[_0x1ac3('0x9')](_0x1ac3('0xa'),attributes,{'tableName':_0x1ac3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c02=['./userVoiceQueue.attributes','exports','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x865d51,_0x5dc55c){var _0x3b35d2=function(_0x3202a9){while(--_0x3202a9){_0x865d51['push'](_0x865d51['shift']());}};_0x3b35d2(++_0x5dc55c);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x20c0('0x0'));var logger=require(_0x20c0('0x1'))('api');var moment=require(_0x20c0('0x2'));var BPromise=require(_0x20c0('0x3'));var rp=require(_0x20c0('0x4'));var fs=require('fs');var path=require(_0x20c0('0x5'));var rimraf=require(_0x20c0('0x6'));var config=require(_0x20c0('0x7'));var attributes=require(_0x20c0('0x8'));module[_0x20c0('0x9')]=function(_0x13312d,_0xd25ee8){return _0x13312d['define']('UserVoiceQueue',attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 5dd3997..9f3d5fc 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 _0x472d=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x417911,_0x45f9bf){var _0xf6fcb3=function(_0x86a81a){while(--_0x86a81a){_0x417911['push'](_0x417911['shift']());}};_0xf6fcb3(++_0x45f9bf);}(_0x472d,0xaf));var _0xd472=function(_0x5e99ac,_0x41ba67){_0x5e99ac=_0x5e99ac-0x0;var _0x3a73ac=_0x472d[_0x5e99ac];return _0x3a73ac;};'use strict';var _=require(_0xd472('0x0'));var util=require('util');var moment=require(_0xd472('0x1'));var BPromise=require(_0xd472('0x2'));var rs=require(_0xd472('0x3'));var fs=require('fs');var Redis=require(_0xd472('0x4'));var db=require(_0xd472('0x5'))['db'];var utils=require(_0xd472('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xd472('0x7'));var jayson=require(_0xd472('0x8'));var client=jayson[_0xd472('0x9')][_0xd472('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x536d67,_0x453550,_0x26f9b0){return new BPromise(function(_0x1e4c44,_0x2bd816){return client[_0xd472('0xb')](_0x536d67,_0x26f9b0)['then'](function(_0x23d650){logger[_0xd472('0xc')](_0xd472('0xd'),_0x453550,_0xd472('0xe'));logger[_0xd472('0xf')](_0xd472('0x10'),_0x453550,_0xd472('0xe'),JSON[_0xd472('0x11')](_0x23d650));if(_0x23d650[_0xd472('0x12')]){if(_0x23d650[_0xd472('0x12')][_0xd472('0x13')]===0x1f4){logger['error'](_0xd472('0xd'),_0x453550,_0x23d650['error'][_0xd472('0x14')]);return _0x2bd816(_0x23d650[_0xd472('0x12')][_0xd472('0x14')]);}logger['error'](_0xd472('0xd'),_0x453550,_0x23d650['error'][_0xd472('0x14')]);return _0x1e4c44(_0x23d650[_0xd472('0x12')]['message']);}else{logger['info'](_0xd472('0xd'),_0x453550,_0xd472('0xe'));_0x1e4c44(_0x23d650[_0xd472('0x15')][_0xd472('0x14')]);}})['catch'](function(_0x3b23e9){logger[_0xd472('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x453550,_0x3b23e9);_0x2bd816(_0x3b23e9);});});} \ No newline at end of file +var _0xc38c=['then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http','request'];(function(_0x5c1345,_0x40116e){var _0x1c070d=function(_0x1e862f){while(--_0x1e862f){_0x5c1345['push'](_0x5c1345['shift']());}};_0x1c070d(++_0x40116e);}(_0xc38c,0x198));var _0xcc38=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc38c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcc38('0x0'));var util=require(_0xcc38('0x1'));var moment=require('moment');var BPromise=require(_0xcc38('0x2'));var rs=require(_0xcc38('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcc38('0x4'));var logger=require(_0xcc38('0x5'))(_0xcc38('0x6'));var config=require('../../config/environment');var jayson=require(_0xcc38('0x7'));var client=jayson['client'][_0xcc38('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x230360,_0x18bea6,_0x29ee23){return new BPromise(function(_0xfd0bf8,_0x33e442){return client[_0xcc38('0x9')](_0x230360,_0x29ee23)[_0xcc38('0xa')](function(_0xd95503){logger[_0xcc38('0xb')](_0xcc38('0xc'),_0x18bea6,_0xcc38('0xd'));logger[_0xcc38('0xe')](_0xcc38('0xf'),_0x18bea6,'request\x20sent',JSON[_0xcc38('0x10')](_0xd95503));if(_0xd95503[_0xcc38('0x11')]){if(_0xd95503[_0xcc38('0x11')][_0xcc38('0x12')]===0x1f4){logger[_0xcc38('0x11')](_0xcc38('0xc'),_0x18bea6,_0xd95503[_0xcc38('0x11')]['message']);return _0x33e442(_0xd95503['error'][_0xcc38('0x13')]);}logger[_0xcc38('0x11')](_0xcc38('0xc'),_0x18bea6,_0xd95503[_0xcc38('0x11')][_0xcc38('0x13')]);return _0xfd0bf8(_0xd95503['error'][_0xcc38('0x13')]);}else{logger[_0xcc38('0xb')](_0xcc38('0xc'),_0x18bea6,_0xcc38('0xd'));_0xfd0bf8(_0xd95503[_0xcc38('0x14')]['message']);}})[_0xcc38('0x15')](function(_0x54f8f7){logger[_0xcc38('0x11')](_0xcc38('0xc'),_0x18bea6,_0x54f8f7);_0x33e442(_0x54f8f7);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index d31cba9..c21750e 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 _0x277f=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','express'];(function(_0x271b80,_0x3d59a5){var _0x3a1d0a=function(_0x16a0b9){while(--_0x16a0b9){_0x271b80['push'](_0x271b80['shift']());}};_0x3a1d0a(++_0x3d59a5);}(_0x277f,0x11c));var _0xf277=function(_0x2794c4,_0xda1d01){_0x2794c4=_0x2794c4-0x0;var _0x17c8d3=_0x277f[_0x2794c4];return _0x17c8d3;};'use strict';var multer=require(_0xf277('0x0'));var util=require(_0xf277('0x1'));var path=require(_0xf277('0x2'));var timeout=require('connect-timeout');var express=require(_0xf277('0x3'));var router=express[_0xf277('0x4')]();var auth=require(_0xf277('0x5'));var interaction=require(_0xf277('0x6'));var config=require(_0xf277('0x7'));module[_0xf277('0x8')]=router; \ No newline at end of file +var _0xf452=['multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x2eef00,_0x4a4d6a){var _0x171f46=function(_0x4b580c){while(--_0x4b580c){_0x2eef00['push'](_0x2eef00['shift']());}};_0x171f46(++_0x4a4d6a);}(_0xf452,0x70));var _0x2f45=function(_0x194be0,_0x5c397e){_0x194be0=_0x194be0-0x0;var _0xa968bb=_0xf452[_0x194be0];return _0xa968bb;};'use strict';var multer=require(_0x2f45('0x0'));var util=require(_0x2f45('0x1'));var path=require(_0x2f45('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x2f45('0x3'));var interaction=require(_0x2f45('0x4'));var config=require(_0x2f45('0x5'));module[_0x2f45('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index ece405f..7107594 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 _0x44b7=['exports','STRING','Required\x20by\x20Asterisk','INTEGER','queue_interface','sequelize'];(function(_0x3a7854,_0x344616){var _0x2552c3=function(_0x151027){while(--_0x151027){_0x3a7854['push'](_0x3a7854['shift']());}};_0x2552c3(++_0x344616);}(_0x44b7,0x83));var _0x744b=function(_0x59a0d2,_0x4e0f17){_0x59a0d2=_0x59a0d2-0x0;var _0x55bed2=_0x44b7[_0x59a0d2];return _0x55bed2;};'use strict';var Sequelize=require(_0x744b('0x0'));module[_0x744b('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x744b('0x2')],'allowNull':![],'comment':_0x744b('0x3')},'UserId':{'type':Sequelize[_0x744b('0x4')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x744b('0x2')],'allowNull':![],'unique':_0x744b('0x5'),'comment':_0x744b('0x3')},'VoiceQueueId':{'type':Sequelize[_0x744b('0x4')],'allowNull':![]},'interface':{'type':Sequelize[_0x744b('0x2')],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x744b('0x4')](0xb),'defaultValue':0x0,'comment':_0x744b('0x3')},'paused':{'type':Sequelize[_0x744b('0x4')](0xb),'defaultValue':0x0,'comment':_0x744b('0x3')}}; \ No newline at end of file +var _0x2d5b=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x3f9019,_0x5b49c7){var _0x457978=function(_0x336406){while(--_0x336406){_0x3f9019['push'](_0x3f9019['shift']());}};_0x457978(++_0x5b49c7);}(_0x2d5b,0x19d));var _0xb2d5=function(_0x3f097c,_0x32f99f){_0x3f097c=_0x3f097c-0x0;var _0x524678=_0x2d5b[_0x3f097c];return _0x524678;};'use strict';var Sequelize=require(_0xb2d5('0x0'));module[_0xb2d5('0x1')]={'uniqueid':{'type':Sequelize[_0xb2d5('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xb2d5('0x3')},'membername':{'type':Sequelize[_0xb2d5('0x4')],'allowNull':![],'comment':_0xb2d5('0x3')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0xb2d5('0x4')],'allowNull':![],'unique':_0xb2d5('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0xb2d5('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xb2d5('0x4')],'allowNull':![],'unique':_0xb2d5('0x5'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0xb2d5('0x2')](0xb),'defaultValue':0x0,'comment':_0xb2d5('0x3')},'paused':{'type':Sequelize[_0xb2d5('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index c232442..505936e 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 _0x1e56=['../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','remove','emit','exports','events'];(function(_0x3737ce,_0xf0b190){var _0xef4f6e=function(_0x1d5951){while(--_0x1d5951){_0x3737ce['push'](_0x3737ce['shift']());}};_0xef4f6e(++_0xf0b190);}(_0x1e56,0x18f));var _0x61e5=function(_0x49ab2c,_0x409d2f){_0x49ab2c=_0x49ab2c-0x0;var _0xb4a7c3=_0x1e56[_0x49ab2c];return _0xb4a7c3;};'use strict';var EventEmitter=require(_0x61e5('0x0'));var UserVoiceQueueRt=require(_0x61e5('0x1'))['db'][_0x61e5('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x61e5('0x3')](0x0);var events={'afterCreate':_0x61e5('0x4'),'afterUpdate':'update','afterDestroy':_0x61e5('0x5')};function emitEvent(_0x3ef6d6){return function(_0x185cbd,_0x3dc494,_0x4d858a){UserVoiceQueueRtEvents[_0x61e5('0x6')](_0x3ef6d6+':'+_0x185cbd['id'],_0x185cbd);UserVoiceQueueRtEvents['emit'](_0x3ef6d6,_0x185cbd);_0x4d858a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0x61e5('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x589a=['../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x59609a,_0x2c6a1d){var _0x20e923=function(_0x220dff){while(--_0x220dff){_0x59609a['push'](_0x59609a['shift']());}};_0x20e923(++_0x2c6a1d);}(_0x589a,0x9f));var _0xa589=function(_0x47fe03,_0x8de1b2){_0x47fe03=_0x47fe03-0x0;var _0x35ef6f=_0x589a[_0x47fe03];return _0x35ef6f;};'use strict';var EventEmitter=require(_0xa589('0x0'));var UserVoiceQueueRt=require(_0xa589('0x1'))['db'][_0xa589('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xa589('0x3')](0x0);var events={'afterCreate':_0xa589('0x4'),'afterUpdate':_0xa589('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3df702){return function(_0x21a7e0,_0x30ecfe,_0x3e2539){UserVoiceQueueRtEvents[_0xa589('0x6')](_0x3df702+':'+_0x21a7e0['id'],_0x21a7e0);UserVoiceQueueRtEvents['emit'](_0x3df702,_0x21a7e0);_0x3e2539(null);};}for(var e in events){if(events[_0xa589('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0xa589('0x8')](e,emitEvent(event));}}module[_0xa589('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 38c975b..baf10d3 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 _0xd8c3=['path','../../config/environment','./userVoiceQueueRt.attributes','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0xd8c3,0x119));var _0x3d8c=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xd8c3[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x3d8c('0x0'));var util=require(_0x3d8c('0x1'));var logger=require(_0x3d8c('0x2'))(_0x3d8c('0x3'));var moment=require(_0x3d8c('0x4'));var BPromise=require(_0x3d8c('0x5'));var rp=require(_0x3d8c('0x6'));var fs=require('fs');var path=require(_0x3d8c('0x7'));var rimraf=require('rimraf');var config=require(_0x3d8c('0x8'));var attributes=require(_0x3d8c('0x9'));module['exports']=function(_0x16ff87,_0x2ebf59){return _0x16ff87['define'](_0x3d8c('0xa'),attributes,{'tableName':_0x3d8c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8eef=['user_has_voice_queues_rt','lodash','util','bluebird','request-promise','path','../../config/environment','./userVoiceQueueRt.attributes','exports','define'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x8eef,0x105));var _0xf8ee=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8eef[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xf8ee('0x0'));var util=require(_0xf8ee('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xf8ee('0x2'));var rp=require(_0xf8ee('0x3'));var fs=require('fs');var path=require(_0xf8ee('0x4'));var rimraf=require('rimraf');var config=require(_0xf8ee('0x5'));var attributes=require(_0xf8ee('0x6'));module[_0xf8ee('0x7')]=function(_0xbcbfbe,_0x304000){return _0xbcbfbe[_0xf8ee('0x8')]('UserVoiceQueueRt',attributes,{'tableName':_0xf8ee('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 79a882d..f553908 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 _0xb499=['outboundQueuePauses','debug','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','register','then','info','request\x20sent','stringify','error','code','message','UserVoiceQueueRt,\x20%s,\x20%s','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null'];(function(_0xa60623,_0x2d4e4f){var _0x4a6487=function(_0xba6cbe){while(--_0xba6cbe){_0xa60623['push'](_0xa60623['shift']());}};_0x4a6487(++_0x2d4e4f);}(_0xb499,0x150));var _0x9b49=function(_0x58d08f,_0x53fdfd){_0x58d08f=_0x58d08f-0x0;var _0x1f447f=_0xb499[_0x58d08f];return _0x1f447f;};'use strict';var _=require(_0x9b49('0x0'));var util=require(_0x9b49('0x1'));var moment=require(_0x9b49('0x2'));var BPromise=require(_0x9b49('0x3'));var rs=require(_0x9b49('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9b49('0x5'))['db'];var utils=require(_0x9b49('0x6'));var logger=require(_0x9b49('0x7'))(_0x9b49('0x8'));var config=require(_0x9b49('0x9'));var jayson=require(_0x9b49('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x9b49('0xb')]=_[_0x9b49('0xc')](config[_0x9b49('0xb')],{'host':_0x9b49('0xd'),'port':0x18eb});var socket=require(_0x9b49('0xe'))(new Redis(config[_0x9b49('0xb')]));require('./userVoiceQueueRt.socket')[_0x9b49('0xf')](socket);function respondWithRpcPromise(_0xa198c0,_0x31f87a,_0x3a02db){return new BPromise(function(_0x367143,_0x2a6351){return client['request'](_0xa198c0,_0x3a02db)[_0x9b49('0x10')](function(_0x2828c3){logger[_0x9b49('0x11')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x31f87a,_0x9b49('0x12'));logger['debug']('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x31f87a,_0x9b49('0x12'),JSON[_0x9b49('0x13')](_0x2828c3));if(_0x2828c3['error']){if(_0x2828c3[_0x9b49('0x14')][_0x9b49('0x15')]===0x1f4){logger[_0x9b49('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x31f87a,_0x2828c3[_0x9b49('0x14')]['message']);return _0x2a6351(_0x2828c3[_0x9b49('0x14')][_0x9b49('0x16')]);}logger[_0x9b49('0x14')](_0x9b49('0x17'),_0x31f87a,_0x2828c3[_0x9b49('0x14')][_0x9b49('0x16')]);return _0x367143(_0x2828c3['error'][_0x9b49('0x16')]);}else{logger[_0x9b49('0x11')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x31f87a,_0x9b49('0x12'));_0x367143(_0x2828c3[_0x9b49('0x18')][_0x9b49('0x16')]);}})['catch'](function(_0x37f685){logger[_0x9b49('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x31f87a,_0x37f685);_0x2a6351(_0x37f685);});});}exports[_0x9b49('0x19')]=function(_0x5dbdd3){var _0x931827=this;return new Promise(function(_0x38c17c,_0x2544fa){return db[_0x9b49('0x1a')][_0x9b49('0x1b')]({'raw':_0x5dbdd3[_0x9b49('0x1c')]?_0x5dbdd3['options'][_0x9b49('0x1d')]===undefined?!![]:![]:!![],'where':_0x5dbdd3[_0x9b49('0x1c')]?_0x5dbdd3[_0x9b49('0x1c')][_0x9b49('0x1e')]||null:null,'attributes':[[db[_0x9b49('0x1f')]['fn'](_0x9b49('0x20'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x9b49('0x21')))),_0x9b49('0x22')]]})['then'](function(_0x29e58a){logger['info'](_0x9b49('0x19'),_0x5dbdd3);logger[_0x9b49('0x23')](_0x9b49('0x19'),_0x5dbdd3,JSON['stringify'](_0x29e58a));_0x38c17c(_0x29e58a);})[_0x9b49('0x24')](function(_0x4b75bd){logger['error'](_0x9b49('0x19'),_0x4b75bd['message'],_0x5dbdd3);_0x2544fa(_0x931827[_0x9b49('0x14')](0x1f4,_0x4b75bd[_0x9b49('0x16')]));});});}; \ No newline at end of file +var _0x0ad1=['COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','raw','where','sequelize'];(function(_0x36bc5b,_0x2a6be2){var _0x160151=function(_0x140acf){while(--_0x140acf){_0x36bc5b['push'](_0x36bc5b['shift']());}};_0x160151(++_0x2a6be2);}(_0x0ad1,0x177));var _0x10ad=function(_0x14aba3,_0x58e6d1){_0x14aba3=_0x14aba3-0x0;var _0x4c2792=_0x0ad1[_0x14aba3];return _0x4c2792;};'use strict';var _=require('lodash');var util=require(_0x10ad('0x0'));var moment=require(_0x10ad('0x1'));var BPromise=require(_0x10ad('0x2'));var rs=require(_0x10ad('0x3'));var fs=require('fs');var Redis=require(_0x10ad('0x4'));var db=require(_0x10ad('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x10ad('0x6'))(_0x10ad('0x7'));var config=require('../../config/environment');var jayson=require(_0x10ad('0x8'));var client=jayson[_0x10ad('0x9')][_0x10ad('0xa')]({'port':0x232a});config[_0x10ad('0xb')]=_[_0x10ad('0xc')](config['redis'],{'host':_0x10ad('0xd'),'port':0x18eb});var socket=require(_0x10ad('0xe'))(new Redis(config['redis']));require('./userVoiceQueueRt.socket')['register'](socket);function respondWithRpcPromise(_0x565926,_0xbd733e,_0xad858f){return new BPromise(function(_0x469deb,_0x1306f0){return client[_0x10ad('0xf')](_0x565926,_0xad858f)['then'](function(_0x2700b5){logger[_0x10ad('0x10')](_0x10ad('0x11'),_0xbd733e,_0x10ad('0x12'));logger[_0x10ad('0x13')](_0x10ad('0x14'),_0xbd733e,_0x10ad('0x12'),JSON[_0x10ad('0x15')](_0x2700b5));if(_0x2700b5[_0x10ad('0x16')]){if(_0x2700b5[_0x10ad('0x16')]['code']===0x1f4){logger[_0x10ad('0x16')](_0x10ad('0x11'),_0xbd733e,_0x2700b5['error'][_0x10ad('0x17')]);return _0x1306f0(_0x2700b5[_0x10ad('0x16')][_0x10ad('0x17')]);}logger['error'](_0x10ad('0x11'),_0xbd733e,_0x2700b5[_0x10ad('0x16')][_0x10ad('0x17')]);return _0x469deb(_0x2700b5[_0x10ad('0x16')][_0x10ad('0x17')]);}else{logger['info'](_0x10ad('0x11'),_0xbd733e,_0x10ad('0x12'));_0x469deb(_0x2700b5[_0x10ad('0x18')][_0x10ad('0x17')]);}})[_0x10ad('0x19')](function(_0x284bbd){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0xbd733e,_0x284bbd);_0x1306f0(_0x284bbd);});});}exports[_0x10ad('0x1a')]=function(_0x19c06f){var _0x2fe6f3=this;return new Promise(function(_0x14406,_0x2cfd13){return db[_0x10ad('0x1b')]['findAll']({'raw':_0x19c06f['options']?_0x19c06f[_0x10ad('0x1c')][_0x10ad('0x1d')]===undefined?!![]:![]:!![],'where':_0x19c06f[_0x10ad('0x1c')]?_0x19c06f['options'][_0x10ad('0x1e')]||null:null,'attributes':[[db[_0x10ad('0x1f')]['fn'](_0x10ad('0x20'),db['sequelize']['fn']('IF',db[_0x10ad('0x1f')][_0x10ad('0x21')](_0x10ad('0x22')))),_0x10ad('0x23')]]})[_0x10ad('0x24')](function(_0x12be42){logger[_0x10ad('0x10')]('GetVoiceQueueRtPauses',_0x19c06f);logger[_0x10ad('0x13')](_0x10ad('0x1a'),_0x19c06f,JSON[_0x10ad('0x15')](_0x12be42));_0x14406(_0x12be42);})[_0x10ad('0x19')](function(_0x219338){logger['error'](_0x10ad('0x1a'),_0x219338[_0x10ad('0x17')],_0x19c06f);_0x2cfd13(_0x2fe6f3['error'](0x1f4,_0x219338[_0x10ad('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 45d2560..8c81007 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 _0x5811=['save','remove','emit','register','./userVoiceQueueRt.events'];(function(_0x3937e7,_0x91712b){var _0x197ad7=function(_0x16e5b2){while(--_0x16e5b2){_0x3937e7['push'](_0x3937e7['shift']());}};_0x197ad7(++_0x91712b);}(_0x5811,0x185));var _0x1581=function(_0x28e3d5,_0xe3971c){_0x28e3d5=_0x28e3d5-0x0;var _0x3b0327=_0x5811[_0x28e3d5];return _0x3b0327;};'use strict';var UserVoiceQueueRtEvents=require(_0x1581('0x0'));var events=[_0x1581('0x1'),_0x1581('0x2'),'update'];function createListener(_0x2a16e9,_0x5025c3){return function(_0x141255){_0x5025c3[_0x1581('0x3')](_0x2a16e9,_0x141255);};}function removeListener(_0x4a3e6e,_0x477bcb){return function(){UserVoiceQueueRtEvents['removeListener'](_0x4a3e6e,_0x477bcb);};}exports[_0x1581('0x4')]=function(_0x42c35d){for(var _0x599737=0x0,_0x43d9d5=events['length'];_0x599737<_0x43d9d5;_0x599737++){var _0x19bb77=events[_0x599737];var _0x1ec38d=createListener('userVoiceQueueRt:'+_0x19bb77,_0x42c35d);UserVoiceQueueRtEvents['on'](_0x19bb77,_0x1ec38d);}}; \ No newline at end of file +var _0x46ab=['save','update','emit','removeListener','register','userVoiceQueueRt:','./userVoiceQueueRt.events'];(function(_0x330009,_0x1494b7){var _0x26516c=function(_0x2f8185){while(--_0x2f8185){_0x330009['push'](_0x330009['shift']());}};_0x26516c(++_0x1494b7);}(_0x46ab,0x1db));var _0xb46a=function(_0x3ca3ba,_0x12c3b9){_0x3ca3ba=_0x3ca3ba-0x0;var _0x5cc930=_0x46ab[_0x3ca3ba];return _0x5cc930;};'use strict';var UserVoiceQueueRtEvents=require(_0xb46a('0x0'));var events=[_0xb46a('0x1'),'remove',_0xb46a('0x2')];function createListener(_0x28eac7,_0x4f5be4){return function(_0x4ed89d){_0x4f5be4[_0xb46a('0x3')](_0x28eac7,_0x4ed89d);};}function removeListener(_0x5e7fc8,_0x53858a){return function(){UserVoiceQueueRtEvents[_0xb46a('0x4')](_0x5e7fc8,_0x53858a);};}exports[_0xb46a('0x5')]=function(_0x6b7604){for(var _0x2e36ac=0x0,_0x1f28e6=events['length'];_0x2e36ac<_0x1f28e6;_0x2e36ac++){var _0x18b797=events[_0x2e36ac];var _0x329b83=createListener(_0xb46a('0x6')+_0x18b797,_0x6b7604);UserVoiceQueueRtEvents['on'](_0x18b797,_0x329b83);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index f37cabe..f3749e6 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 _0x0324=['express','Router','../../components/interaction/service','../../config/environment','multer','util','connect-timeout'];(function(_0x268a71,_0x320096){var _0xd456b3=function(_0x200e01){while(--_0x200e01){_0x268a71['push'](_0x268a71['shift']());}};_0xd456b3(++_0x320096);}(_0x0324,0x1e0));var _0x4032=function(_0xd93baf,_0x587151){_0xd93baf=_0xd93baf-0x0;var _0x534fb9=_0x0324[_0xd93baf];return _0x534fb9;};'use strict';var multer=require(_0x4032('0x0'));var util=require(_0x4032('0x1'));var path=require('path');var timeout=require(_0x4032('0x2'));var express=require(_0x4032('0x3'));var router=express[_0x4032('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x4032('0x5'));var config=require(_0x4032('0x6'));module['exports']=router; \ No newline at end of file +var _0x2d70=['../../config/environment','exports','multer','util','path','../../components/interaction/service'];(function(_0x2de3df,_0x4a78eb){var _0x581f12=function(_0x51bffc){while(--_0x51bffc){_0x2de3df['push'](_0x2de3df['shift']());}};_0x581f12(++_0x4a78eb);}(_0x2d70,0x14c));var _0x02d7=function(_0x2ff4bd,_0x4780a6){_0x2ff4bd=_0x2ff4bd-0x0;var _0x28edc6=_0x2d70[_0x2ff4bd];return _0x28edc6;};'use strict';var multer=require(_0x02d7('0x0'));var util=require(_0x02d7('0x1'));var path=require(_0x02d7('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x02d7('0x3'));var config=require(_0x02d7('0x4'));module[_0x02d7('0x5')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 14430a7..788af32 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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x4f6c97,_0x188640){var _0x1a0cc6=function(_0x44d983){while(--_0x44d983){_0x4f6c97['push'](_0x4f6c97['shift']());}};_0x1a0cc6(++_0x188640);}(_0xe706,0xa3));var _0x6e70=function(_0xd3da2a,_0x22241c){_0xd3da2a=_0xd3da2a-0x0;var _0x10ab61=_0xe706[_0xd3da2a];return _0x10ab61;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x459573,_0x35679e){var _0x51ffcd=function(_0x37bb90){while(--_0x37bb90){_0x459573['push'](_0x459573['shift']());}};_0x51ffcd(++_0x35679e);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index de517db..c6cae72 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 _0xd7d1=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x2f223,_0x32a7e5){_0x2f223=_0x2f223-0x0;var _0x4994aa=_0xd7d1[_0x2f223];return _0x4994aa;};'use strict';var _=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var logger=require(_0x1d7d('0x2'))(_0x1d7d('0x3'));var moment=require(_0x1d7d('0x4'));var BPromise=require(_0x1d7d('0x5'));var rp=require(_0x1d7d('0x6'));var fs=require('fs');var path=require(_0x1d7d('0x7'));var rimraf=require(_0x1d7d('0x8'));var config=require(_0x1d7d('0x9'));var attributes=require(_0x1d7d('0xa'));module[_0x1d7d('0xb')]=function(_0x14b2b9,_0x5a8cf3){return _0x14b2b9[_0x1d7d('0xc')](_0x1d7d('0xd'),attributes,{'tableName':_0x1d7d('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda2d=['./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','util','../../config/logger','api','moment','bluebird','../../config/environment'];(function(_0x43e57f,_0x462aa9){var _0x2ec8e7=function(_0x2b69bd){while(--_0x2b69bd){_0x43e57f['push'](_0x43e57f['shift']());}};_0x2ec8e7(++_0x462aa9);}(_0xda2d,0x102));var _0xdda2=function(_0x34d6be,_0x42a44e){_0x34d6be=_0x34d6be-0x0;var _0x89374=_0xda2d[_0x34d6be];return _0x89374;};'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/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index cc18f4e..0792b64 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(_0x3ee71b,_0x56466){var _0x4010a8=function(_0x1a8350){while(--_0x1a8350){_0x3ee71b['push'](_0x3ee71b['shift']());}};_0x4010a8(++_0x56466);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0xcaaba7,_0x47f7e7){var _0x4b67f0=function(_0x55fa59){while(--_0x55fa59){_0xcaaba7['push'](_0xcaaba7['shift']());}};_0x4b67f0(++_0x47f7e7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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 4e77790..8c8490d 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 _0x2153=['isAuthenticated','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','index','/:id','show','post'];(function(_0x792e6b,_0x1949c4){var _0x1627c2=function(_0xa89bb1){while(--_0xa89bb1){_0x792e6b['push'](_0x792e6b['shift']());}};_0x1627c2(++_0x1949c4);}(_0x2153,0xf6));var _0x3215=function(_0x38cc16,_0x4678bf){_0x38cc16=_0x38cc16-0x0;var _0x5b6753=_0x2153[_0x38cc16];return _0x5b6753;};'use strict';var multer=require(_0x3215('0x0'));var util=require(_0x3215('0x1'));var path=require(_0x3215('0x2'));var timeout=require(_0x3215('0x3'));var express=require(_0x3215('0x4'));var router=express['Router']();var auth=require(_0x3215('0x5'));var interaction=require(_0x3215('0x6'));var config=require(_0x3215('0x7'));var controller=require(_0x3215('0x8'));router[_0x3215('0x9')]('/',auth['isAuthenticated'](),controller[_0x3215('0xa')]);router[_0x3215('0x9')](_0x3215('0xb'),auth['isAuthenticated'](),controller[_0x3215('0xc')]);router[_0x3215('0xd')]('/',auth[_0x3215('0xe')](),controller['create']);router[_0x3215('0xf')](_0x3215('0xb'),auth[_0x3215('0xe')](),controller[_0x3215('0x10')]);router[_0x3215('0x11')](_0x3215('0xb'),auth['isAuthenticated'](),controller[_0x3215('0x12')]);module[_0x3215('0x13')]=router; \ No newline at end of file +var _0xf2b7=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','isAuthenticated','get','/:id','post','create','put','update','delete','destroy','exports'];(function(_0x2f202e,_0x5ed293){var _0x398ac6=function(_0x49bda9){while(--_0x49bda9){_0x2f202e['push'](_0x2f202e['shift']());}};_0x398ac6(++_0x5ed293);}(_0xf2b7,0x17c));var _0x7f2b=function(_0x906c91,_0x4fb003){_0x906c91=_0x906c91-0x0;var _0x4f4620=_0xf2b7[_0x906c91];return _0x4f4620;};'use strict';var multer=require(_0x7f2b('0x0'));var util=require(_0x7f2b('0x1'));var path=require(_0x7f2b('0x2'));var timeout=require(_0x7f2b('0x3'));var express=require(_0x7f2b('0x4'));var router=express[_0x7f2b('0x5')]();var auth=require(_0x7f2b('0x6'));var interaction=require(_0x7f2b('0x7'));var config=require(_0x7f2b('0x8'));var controller=require(_0x7f2b('0x9'));router['get']('/',auth[_0x7f2b('0xa')](),controller['index']);router[_0x7f2b('0xb')](_0x7f2b('0xc'),auth[_0x7f2b('0xa')](),controller['show']);router[_0x7f2b('0xd')]('/',auth['isAuthenticated'](),controller[_0x7f2b('0xe')]);router[_0x7f2b('0xf')](_0x7f2b('0xc'),auth[_0x7f2b('0xa')](),controller[_0x7f2b('0x10')]);router[_0x7f2b('0x11')](_0x7f2b('0xc'),auth['isAuthenticated'](),controller[_0x7f2b('0x12')]);module[_0x7f2b('0x13')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index a4f621f..584971b 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 _0xac70=['exports','sequelize'];(function(_0x5ee062,_0x2628d7){var _0x40b065=function(_0x390f0e){while(--_0x390f0e){_0x5ee062['push'](_0x5ee062['shift']());}};_0x40b065(++_0x2628d7);}(_0xac70,0x1c7));var _0x0ac7=function(_0xe0b81f,_0x1fb734){_0xe0b81f=_0xe0b81f-0x0;var _0x290e5e=_0xac70[_0xe0b81f];return _0x290e5e;};'use strict';var Sequelize=require(_0x0ac7('0x0'));module[_0x0ac7('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6504=['STRING','name','sequelize','exports'];(function(_0x22e571,_0x443a32){var _0x5b3f1c=function(_0x52a0ce){while(--_0x52a0ce){_0x22e571['push'](_0x22e571['shift']());}};_0x5b3f1c(++_0x443a32);}(_0x6504,0x1ba));var _0x4650=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6504[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x4650('0x0'));module[_0x4650('0x1')]={'name':{'type':Sequelize[_0x4650('0x2')],'unique':_0x4650('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4650('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 386904c..3530c91 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 _0xd5f4=['path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','update','then','get','Variables','UserProfileResource','destroy','stack','name','send','index','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','Variable','includeAll','include','findAll','rows','catch','params','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x56c64a,_0x2a2cde){var _0x16fb84=function(_0x84ec03){while(--_0x84ec03){_0x56c64a['push'](_0x56c64a['shift']());}};_0x16fb84(++_0x2a2cde);}(_0xd5f4,0x192));var _0x4d5f=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xd5f4[_0x4ff09b];return _0x3f5c2e;};'use strict';var pdf=require(_0x4d5f('0x0'));var emlformat=require(_0x4d5f('0x1'));var rimraf=require(_0x4d5f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d5f('0x3'));var rp=require(_0x4d5f('0x4'));var moment=require('moment');var BPromise=require(_0x4d5f('0x5'));var Mustache=require(_0x4d5f('0x6'));var util=require(_0x4d5f('0x7'));var path=require(_0x4d5f('0x8'));var sox=require(_0x4d5f('0x9'));var csv=require(_0x4d5f('0xa'));var ejs=require(_0x4d5f('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4d5f('0xc'));var crypto=require(_0x4d5f('0xd'));var jsforce=require(_0x4d5f('0xe'));var deskjs=require(_0x4d5f('0xf'));var toCsv=require(_0x4d5f('0xa'));var querystring=require('querystring');var Papa=require(_0x4d5f('0x10'));var Redis=require(_0x4d5f('0x11'));var authService=require(_0x4d5f('0x12'));var qs=require(_0x4d5f('0x13'));var as=require(_0x4d5f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4d5f('0x15'));var utils=require(_0x4d5f('0x16'));var config=require(_0x4d5f('0x17'));var db=require(_0x4d5f('0x18'))['db'];function respondWithStatusCode(_0x5e3b8d,_0x67a276){_0x67a276=_0x67a276||0xcc;return function(_0x540896){if(_0x540896){return _0x5e3b8d[_0x4d5f('0x19')](_0x67a276);}return _0x5e3b8d[_0x4d5f('0x1a')](_0x67a276)[_0x4d5f('0x1b')]();};}function respondWithResult(_0x51963b,_0x88d78e){_0x88d78e=_0x88d78e||0xc8;return function(_0x453b17){if(_0x453b17){return _0x51963b[_0x4d5f('0x1a')](_0x88d78e)[_0x4d5f('0x1c')](_0x453b17);}};}function respondWithFilteredResult(_0x4247bb,_0x175c8e){return function(_0x310feb){if(_0x310feb){var _0x15f391=_0x310feb[_0x4d5f('0x1d')],_0x2243cb=_0x175c8e['offset'],_0x466566=_0x175c8e[_0x4d5f('0x1e')]+_0x175c8e['limit'],_0x578d69;if(_0x466566>=_0x15f391){_0x466566=_0x15f391;_0x578d69=0xc8;}else{_0x578d69=0xce;}_0x4247bb[_0x4d5f('0x1a')](_0x578d69);return _0x4247bb['set']('Content-Range',_0x2243cb+'-'+_0x466566+'/'+_0x15f391)[_0x4d5f('0x1c')](_0x310feb);}return null;};}function patchUpdates(_0x54a07c){return function(_0x273a75){try{jsonpatch['apply'](_0x273a75,_0x54a07c,!![]);}catch(_0x5558f8){return BPromise['reject'](_0x5558f8);}return _0x273a75['save']();};}function saveUpdates(_0x5c7765,_0x1beb65){return function(_0x48fab4){if(_0x48fab4){return _0x48fab4[_0x4d5f('0x1f')](_0x5c7765)[_0x4d5f('0x20')](function(_0x3bbaf2){return _0x3bbaf2;});}return null;};}function removeEntity(_0x1b640c,_0x5d5505){return function(_0x53ea2e){if(_0x53ea2e){return _0x53ea2e['destroy']()[_0x4d5f('0x20')](function(){var _0x2bb651=_0x53ea2e[_0x4d5f('0x21')]({'plain':!![]});var _0x323dae=_0x4d5f('0x22');return db[_0x4d5f('0x23')][_0x4d5f('0x24')]({'where':{'type':_0x323dae,'resourceId':_0x2bb651['id']}})[_0x4d5f('0x20')](function(){return _0x53ea2e;});})[_0x4d5f('0x20')](function(){_0x1b640c[_0x4d5f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x430c14,_0x420691){return function(_0x3e1b03){if(!_0x3e1b03){_0x430c14['sendStatus'](0x194);}return _0x3e1b03;};}function handleError(_0x4ad4b3,_0x4866f6){_0x4866f6=_0x4866f6||0x1f4;return function(_0xc5d10){logger['error'](_0xc5d10[_0x4d5f('0x25')]);if(_0xc5d10['name']){delete _0xc5d10[_0x4d5f('0x26')];}_0x4ad4b3[_0x4d5f('0x1a')](_0x4866f6)[_0x4d5f('0x27')](_0xc5d10);};}exports[_0x4d5f('0x28')]=function(_0x3d55cb,_0x49f3c1){var _0x29df25={},_0x1ec797={},_0x4e9ca2={'count':0x0,'rows':[]};var _0x355873=_['map'](db['Variable'][_0x4d5f('0x29')],function(_0x226976){return{'name':_0x226976[_0x4d5f('0x2a')],'type':_0x226976['type'][_0x4d5f('0x2b')]};});_0x1ec797[_0x4d5f('0x2c')]=_[_0x4d5f('0x2d')](_0x355873,'name');_0x1ec797[_0x4d5f('0x2e')]=_[_0x4d5f('0x2f')](_0x3d55cb[_0x4d5f('0x2e')]);_0x1ec797['filters']=_[_0x4d5f('0x30')](_0x1ec797[_0x4d5f('0x2c')],_0x1ec797[_0x4d5f('0x2e')]);_0x29df25[_0x4d5f('0x31')]=_[_0x4d5f('0x30')](_0x1ec797['model'],qs['fields'](_0x3d55cb[_0x4d5f('0x2e')][_0x4d5f('0x32')]));_0x29df25[_0x4d5f('0x31')]=_0x29df25[_0x4d5f('0x31')][_0x4d5f('0x33')]?_0x29df25[_0x4d5f('0x31')]:_0x1ec797['model'];if(!_0x3d55cb[_0x4d5f('0x2e')][_0x4d5f('0x34')](_0x4d5f('0x35'))){_0x29df25[_0x4d5f('0x36')]=qs[_0x4d5f('0x36')](_0x3d55cb[_0x4d5f('0x2e')]['limit']);_0x29df25[_0x4d5f('0x1e')]=qs[_0x4d5f('0x1e')](_0x3d55cb['query'][_0x4d5f('0x1e')]);}_0x29df25[_0x4d5f('0x37')]=qs[_0x4d5f('0x38')](_0x3d55cb[_0x4d5f('0x2e')][_0x4d5f('0x38')]);_0x29df25[_0x4d5f('0x39')]=qs[_0x4d5f('0x3a')](_[_0x4d5f('0x3b')](_0x3d55cb[_0x4d5f('0x2e')],_0x1ec797['filters']),_0x355873);if(_0x3d55cb['query'][_0x4d5f('0x3c')]){_0x29df25[_0x4d5f('0x39')]=_[_0x4d5f('0x3d')](_0x29df25['where'],{'$or':_[_0x4d5f('0x2d')](_0x355873,function(_0x511d3e){if(_0x511d3e[_0x4d5f('0x3e')]!==_0x4d5f('0x3f')){var _0x1d17c6={};_0x1d17c6[_0x511d3e[_0x4d5f('0x26')]]={'$like':'%'+_0x3d55cb[_0x4d5f('0x2e')][_0x4d5f('0x3c')]+'%'};return _0x1d17c6;}})});}_0x29df25=_['merge']({},_0x29df25,_0x3d55cb[_0x4d5f('0x40')]);var _0x1a1024={'where':_0x29df25[_0x4d5f('0x39')]};return db[_0x4d5f('0x41')][_0x4d5f('0x1d')](_0x1a1024)[_0x4d5f('0x20')](function(_0x2f213d){_0x4e9ca2[_0x4d5f('0x1d')]=_0x2f213d;if(_0x3d55cb[_0x4d5f('0x2e')][_0x4d5f('0x42')]){_0x29df25[_0x4d5f('0x43')]=[{'all':!![]}];}return db[_0x4d5f('0x41')][_0x4d5f('0x44')](_0x29df25);})[_0x4d5f('0x20')](function(_0x3b186d){_0x4e9ca2[_0x4d5f('0x45')]=_0x3b186d;return _0x4e9ca2;})[_0x4d5f('0x20')](respondWithFilteredResult(_0x49f3c1,_0x29df25))[_0x4d5f('0x46')](handleError(_0x49f3c1,null));};exports['show']=function(_0x2642a3,_0x6453cb){var _0xb50443={'raw':!![],'where':{'id':_0x2642a3[_0x4d5f('0x47')]['id']}},_0x6575d6={};_0x6575d6[_0x4d5f('0x2c')]=_[_0x4d5f('0x2f')](db[_0x4d5f('0x41')][_0x4d5f('0x29')]);_0x6575d6[_0x4d5f('0x2e')]=_['keys'](_0x2642a3[_0x4d5f('0x2e')]);_0x6575d6['filters']=_[_0x4d5f('0x30')](_0x6575d6[_0x4d5f('0x2c')],_0x6575d6[_0x4d5f('0x2e')]);_0xb50443[_0x4d5f('0x31')]=_[_0x4d5f('0x30')](_0x6575d6[_0x4d5f('0x2c')],qs['fields'](_0x2642a3[_0x4d5f('0x2e')][_0x4d5f('0x32')]));_0xb50443[_0x4d5f('0x31')]=_0xb50443[_0x4d5f('0x31')]['length']?_0xb50443[_0x4d5f('0x31')]:_0x6575d6['model'];if(_0x2642a3['query'][_0x4d5f('0x42')]){_0xb50443['include']=[{'all':!![]}];}_0xb50443=_['merge']({},_0xb50443,_0x2642a3[_0x4d5f('0x40')]);return db[_0x4d5f('0x41')][_0x4d5f('0x48')](_0xb50443)[_0x4d5f('0x20')](handleEntityNotFound(_0x6453cb,null))[_0x4d5f('0x20')](respondWithResult(_0x6453cb,null))[_0x4d5f('0x46')](handleError(_0x6453cb,null));};exports[_0x4d5f('0x49')]=function(_0x2078e9,_0x2a59d8){return db[_0x4d5f('0x41')][_0x4d5f('0x49')](_0x2078e9[_0x4d5f('0x4a')],{})[_0x4d5f('0x20')](function(_0x39b277){var _0x29ed63=_0x2078e9[_0x4d5f('0x4b')]['get']({'plain':!![]});if(!_0x29ed63)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29ed63[_0x4d5f('0x4c')]===_0x4d5f('0x4b')){var _0x3fe3aa=_0x39b277['get']({'plain':!![]});var _0x4f81c0=_0x4d5f('0x22');return db[_0x4d5f('0x4d')]['find']({'where':{'name':_0x4f81c0,'userProfileId':_0x29ed63[_0x4d5f('0x4e')]},'raw':!![]})['then'](function(_0x19de7f){if(_0x19de7f&&_0x19de7f[_0x4d5f('0x4f')]===0x0){return db[_0x4d5f('0x23')][_0x4d5f('0x49')]({'name':_0x3fe3aa['name'],'resourceId':_0x3fe3aa['id'],'type':_0x19de7f[_0x4d5f('0x26')],'sectionId':_0x19de7f['id']},{})[_0x4d5f('0x20')](function(){return _0x39b277;});}else{return _0x39b277;}})[_0x4d5f('0x46')](function(_0x51a3cf){logger[_0x4d5f('0x50')](_0x4d5f('0x51'),_0x51a3cf);throw _0x51a3cf;});}return _0x39b277;})[_0x4d5f('0x20')](respondWithResult(_0x2a59d8,0xc9))[_0x4d5f('0x46')](handleError(_0x2a59d8,null));};exports[_0x4d5f('0x1f')]=function(_0x16cf62,_0x281ec1){if(_0x16cf62[_0x4d5f('0x4a')]['id']){delete _0x16cf62['body']['id'];}return db['Variable'][_0x4d5f('0x48')]({'where':{'id':_0x16cf62['params']['id']}})[_0x4d5f('0x20')](handleEntityNotFound(_0x281ec1,null))['then'](saveUpdates(_0x16cf62[_0x4d5f('0x4a')],null))[_0x4d5f('0x20')](respondWithResult(_0x281ec1,null))[_0x4d5f('0x46')](handleError(_0x281ec1,null));};exports[_0x4d5f('0x24')]=function(_0x3c915e,_0x4c0630){return db[_0x4d5f('0x41')][_0x4d5f('0x48')]({'where':{'id':_0x3c915e[_0x4d5f('0x47')]['id']}})[_0x4d5f('0x20')](handleEntityNotFound(_0x4c0630,null))['then'](removeEntity(_0x4c0630,null))[_0x4d5f('0x46')](handleError(_0x4c0630,null));}; \ No newline at end of file +var _0xf491=['moment','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','reject','destroy','then','UserProfileResource','end','sendStatus','error','name','send','index','rawAttributes','fieldName','type','key','map','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','where','pick','merge','VIRTUAL','filter','options','include','Variable','findAll','show','params','keys','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x16c2e0,_0x3dc335){var _0x49b690=function(_0x5bb015){while(--_0x5bb015){_0x16c2e0['push'](_0x16c2e0['shift']());}};_0x49b690(++_0x3dc335);}(_0xf491,0x137));var _0x1f49=function(_0x54458c,_0x51e89c){_0x54458c=_0x54458c-0x0;var _0x282ab6=_0xf491[_0x54458c];return _0x282ab6;};'use strict';var pdf=require(_0x1f49('0x0'));var emlformat=require(_0x1f49('0x1'));var rimraf=require(_0x1f49('0x2'));var zipdir=require(_0x1f49('0x3'));var jsonpatch=require(_0x1f49('0x4'));var rp=require('request-promise');var moment=require(_0x1f49('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1f49('0x6'));var util=require(_0x1f49('0x7'));var path=require(_0x1f49('0x8'));var sox=require('sox');var csv=require(_0x1f49('0x9'));var ejs=require(_0x1f49('0xa'));var fs=require('fs');var _=require(_0x1f49('0xb'));var squel=require('squel');var crypto=require(_0x1f49('0xc'));var jsforce=require(_0x1f49('0xd'));var deskjs=require(_0x1f49('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1f49('0xf'));var Papa=require(_0x1f49('0x10'));var Redis=require(_0x1f49('0x11'));var authService=require(_0x1f49('0x12'));var qs=require(_0x1f49('0x13'));var as=require(_0x1f49('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1f49('0x15'));var utils=require(_0x1f49('0x16'));var config=require(_0x1f49('0x17'));var db=require(_0x1f49('0x18'))['db'];function respondWithStatusCode(_0x1ee496,_0xadf78b){_0xadf78b=_0xadf78b||0xcc;return function(_0x2ff701){if(_0x2ff701){return _0x1ee496['sendStatus'](_0xadf78b);}return _0x1ee496[_0x1f49('0x19')](_0xadf78b)['end']();};}function respondWithResult(_0x379e2c,_0xa759f2){_0xa759f2=_0xa759f2||0xc8;return function(_0x5bfcbb){if(_0x5bfcbb){return _0x379e2c[_0x1f49('0x19')](_0xa759f2)[_0x1f49('0x1a')](_0x5bfcbb);}};}function respondWithFilteredResult(_0x182d4a,_0x13ff81){return function(_0x4a5d03){if(_0x4a5d03){var _0x8636ac=_0x4a5d03[_0x1f49('0x1b')],_0x103e91=_0x13ff81[_0x1f49('0x1c')],_0x2ec014=_0x13ff81[_0x1f49('0x1c')]+_0x13ff81[_0x1f49('0x1d')],_0xb8a2ef;if(_0x2ec014>=_0x8636ac){_0x2ec014=_0x8636ac;_0xb8a2ef=0xc8;}else{_0xb8a2ef=0xce;}_0x182d4a[_0x1f49('0x19')](_0xb8a2ef);return _0x182d4a[_0x1f49('0x1e')]('Content-Range',_0x103e91+'-'+_0x2ec014+'/'+_0x8636ac)[_0x1f49('0x1a')](_0x4a5d03);}return null;};}function patchUpdates(_0x3c7852){return function(_0x5adb14){try{jsonpatch['apply'](_0x5adb14,_0x3c7852,!![]);}catch(_0xd4aeb6){return BPromise[_0x1f49('0x1f')](_0xd4aeb6);}return _0x5adb14['save']();};}function saveUpdates(_0x1fe1ed,_0x21b635){return function(_0x22988b){if(_0x22988b){return _0x22988b['update'](_0x1fe1ed)['then'](function(_0xed0021){return _0xed0021;});}return null;};}function removeEntity(_0x9f16cf,_0x19407d){return function(_0x246295){if(_0x246295){return _0x246295[_0x1f49('0x20')]()[_0x1f49('0x21')](function(){var _0x1debe8=_0x246295['get']({'plain':!![]});var _0x4238d9='Variables';return db[_0x1f49('0x22')][_0x1f49('0x20')]({'where':{'type':_0x4238d9,'resourceId':_0x1debe8['id']}})[_0x1f49('0x21')](function(){return _0x246295;});})[_0x1f49('0x21')](function(){_0x9f16cf[_0x1f49('0x19')](0xcc)[_0x1f49('0x23')]();});}};}function handleEntityNotFound(_0x28b76c,_0x1687a4){return function(_0x8448be){if(!_0x8448be){_0x28b76c[_0x1f49('0x24')](0x194);}return _0x8448be;};}function handleError(_0x4f6a61,_0x215897){_0x215897=_0x215897||0x1f4;return function(_0x3ac8a8){logger[_0x1f49('0x25')](_0x3ac8a8['stack']);if(_0x3ac8a8['name']){delete _0x3ac8a8[_0x1f49('0x26')];}_0x4f6a61[_0x1f49('0x19')](_0x215897)[_0x1f49('0x27')](_0x3ac8a8);};}exports[_0x1f49('0x28')]=function(_0x28b201,_0xbfc1dc){var _0x57d2ff={},_0x4f0c1e={},_0x455a62={'count':0x0,'rows':[]};var _0xeb01e9=_['map'](db['Variable'][_0x1f49('0x29')],function(_0x3f88d9){return{'name':_0x3f88d9[_0x1f49('0x2a')],'type':_0x3f88d9[_0x1f49('0x2b')][_0x1f49('0x2c')]};});_0x4f0c1e['model']=_[_0x1f49('0x2d')](_0xeb01e9,'name');_0x4f0c1e[_0x1f49('0x2e')]=_['keys'](_0x28b201[_0x1f49('0x2e')]);_0x4f0c1e[_0x1f49('0x2f')]=_['intersection'](_0x4f0c1e[_0x1f49('0x30')],_0x4f0c1e[_0x1f49('0x2e')]);_0x57d2ff[_0x1f49('0x31')]=_[_0x1f49('0x32')](_0x4f0c1e[_0x1f49('0x30')],qs[_0x1f49('0x33')](_0x28b201[_0x1f49('0x2e')][_0x1f49('0x33')]));_0x57d2ff[_0x1f49('0x31')]=_0x57d2ff[_0x1f49('0x31')][_0x1f49('0x34')]?_0x57d2ff[_0x1f49('0x31')]:_0x4f0c1e['model'];if(!_0x28b201[_0x1f49('0x2e')][_0x1f49('0x35')]('nolimit')){_0x57d2ff['limit']=qs[_0x1f49('0x1d')](_0x28b201[_0x1f49('0x2e')][_0x1f49('0x1d')]);_0x57d2ff[_0x1f49('0x1c')]=qs[_0x1f49('0x1c')](_0x28b201[_0x1f49('0x2e')][_0x1f49('0x1c')]);}_0x57d2ff[_0x1f49('0x36')]=qs['sort'](_0x28b201['query']['sort']);_0x57d2ff[_0x1f49('0x37')]=qs[_0x1f49('0x2f')](_[_0x1f49('0x38')](_0x28b201['query'],_0x4f0c1e[_0x1f49('0x2f')]),_0xeb01e9);if(_0x28b201['query']['filter']){_0x57d2ff[_0x1f49('0x37')]=_[_0x1f49('0x39')](_0x57d2ff[_0x1f49('0x37')],{'$or':_[_0x1f49('0x2d')](_0xeb01e9,function(_0x1503c1){if(_0x1503c1[_0x1f49('0x2b')]!==_0x1f49('0x3a')){var _0x1d03bf={};_0x1d03bf[_0x1503c1['name']]={'$like':'%'+_0x28b201['query'][_0x1f49('0x3b')]+'%'};return _0x1d03bf;}})});}_0x57d2ff=_[_0x1f49('0x39')]({},_0x57d2ff,_0x28b201[_0x1f49('0x3c')]);var _0x186c2a={'where':_0x57d2ff[_0x1f49('0x37')]};return db['Variable'][_0x1f49('0x1b')](_0x186c2a)[_0x1f49('0x21')](function(_0x232ef0){_0x455a62['count']=_0x232ef0;if(_0x28b201[_0x1f49('0x2e')]['includeAll']){_0x57d2ff[_0x1f49('0x3d')]=[{'all':!![]}];}return db[_0x1f49('0x3e')][_0x1f49('0x3f')](_0x57d2ff);})[_0x1f49('0x21')](function(_0x501af7){_0x455a62['rows']=_0x501af7;return _0x455a62;})[_0x1f49('0x21')](respondWithFilteredResult(_0xbfc1dc,_0x57d2ff))['catch'](handleError(_0xbfc1dc,null));};exports[_0x1f49('0x40')]=function(_0x1b2a57,_0x176191){var _0x58997c={'raw':!![],'where':{'id':_0x1b2a57[_0x1f49('0x41')]['id']}},_0x2d4b8e={};_0x2d4b8e[_0x1f49('0x30')]=_['keys'](db[_0x1f49('0x3e')]['rawAttributes']);_0x2d4b8e[_0x1f49('0x2e')]=_[_0x1f49('0x42')](_0x1b2a57[_0x1f49('0x2e')]);_0x2d4b8e[_0x1f49('0x2f')]=_[_0x1f49('0x32')](_0x2d4b8e[_0x1f49('0x30')],_0x2d4b8e[_0x1f49('0x2e')]);_0x58997c[_0x1f49('0x31')]=_[_0x1f49('0x32')](_0x2d4b8e[_0x1f49('0x30')],qs[_0x1f49('0x33')](_0x1b2a57[_0x1f49('0x2e')][_0x1f49('0x33')]));_0x58997c[_0x1f49('0x31')]=_0x58997c[_0x1f49('0x31')][_0x1f49('0x34')]?_0x58997c['attributes']:_0x2d4b8e[_0x1f49('0x30')];if(_0x1b2a57['query']['includeAll']){_0x58997c[_0x1f49('0x3d')]=[{'all':!![]}];}_0x58997c=_['merge']({},_0x58997c,_0x1b2a57[_0x1f49('0x3c')]);return db[_0x1f49('0x3e')]['find'](_0x58997c)[_0x1f49('0x21')](handleEntityNotFound(_0x176191,null))[_0x1f49('0x21')](respondWithResult(_0x176191,null))[_0x1f49('0x43')](handleError(_0x176191,null));};exports[_0x1f49('0x44')]=function(_0x5dafe3,_0x40eb90){return db['Variable'][_0x1f49('0x44')](_0x5dafe3[_0x1f49('0x45')],{})[_0x1f49('0x21')](function(_0x4d905b){var _0x22de55=_0x5dafe3[_0x1f49('0x46')][_0x1f49('0x47')]({'plain':!![]});if(!_0x22de55)throw new Error(_0x1f49('0x48'));if(_0x22de55[_0x1f49('0x49')]===_0x1f49('0x46')){var _0x39fcd8=_0x4d905b[_0x1f49('0x47')]({'plain':!![]});var _0x5add97='Variables';return db[_0x1f49('0x4a')][_0x1f49('0x4b')]({'where':{'name':_0x5add97,'userProfileId':_0x22de55['userProfileId']},'raw':!![]})[_0x1f49('0x21')](function(_0x49a229){if(_0x49a229&&_0x49a229[_0x1f49('0x4c')]===0x0){return db[_0x1f49('0x22')][_0x1f49('0x44')]({'name':_0x39fcd8[_0x1f49('0x26')],'resourceId':_0x39fcd8['id'],'type':_0x49a229['name'],'sectionId':_0x49a229['id']},{})[_0x1f49('0x21')](function(){return _0x4d905b;});}else{return _0x4d905b;}})[_0x1f49('0x43')](function(_0x44813c){logger[_0x1f49('0x25')](_0x1f49('0x4d'),_0x44813c);throw _0x44813c;});}return _0x4d905b;})[_0x1f49('0x21')](respondWithResult(_0x40eb90,0xc9))[_0x1f49('0x43')](handleError(_0x40eb90,null));};exports[_0x1f49('0x4e')]=function(_0x235b9f,_0x1f9cab){if(_0x235b9f[_0x1f49('0x45')]['id']){delete _0x235b9f[_0x1f49('0x45')]['id'];}return db[_0x1f49('0x3e')][_0x1f49('0x4b')]({'where':{'id':_0x235b9f['params']['id']}})['then'](handleEntityNotFound(_0x1f9cab,null))[_0x1f49('0x21')](saveUpdates(_0x235b9f[_0x1f49('0x45')],null))[_0x1f49('0x21')](respondWithResult(_0x1f9cab,null))[_0x1f49('0x43')](handleError(_0x1f9cab,null));};exports[_0x1f49('0x20')]=function(_0xde42f4,_0x39dd8b){return db['Variable'][_0x1f49('0x4b')]({'where':{'id':_0xde42f4[_0x1f49('0x41')]['id']}})[_0x1f49('0x21')](handleEntityNotFound(_0x39dd8b,null))[_0x1f49('0x21')](removeEntity(_0x39dd8b,null))[_0x1f49('0x43')](handleError(_0x39dd8b,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index d80b0a4..f049f71 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 _0x7333=['define','Variable','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./variable.attributes'];(function(_0x47e216,_0x3740bd){var _0x360aa2=function(_0x41ffac){while(--_0x41ffac){_0x47e216['push'](_0x47e216['shift']());}};_0x360aa2(++_0x3740bd);}(_0x7333,0xfc));var _0x3733=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7333[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x3733('0x0'));var util=require('util');var logger=require(_0x3733('0x1'))('api');var moment=require(_0x3733('0x2'));var BPromise=require(_0x3733('0x3'));var rp=require(_0x3733('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3733('0x5'));var config=require(_0x3733('0x6'));var attributes=require(_0x3733('0x7'));module['exports']=function(_0xa51fdb,_0x27c9b7){return _0xa51fdb[_0x3733('0x8')](_0x3733('0x9'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf2a6=['path','rimraf','../../config/environment','./variable.attributes','exports','define','Variable','lodash','moment','request-promise'];(function(_0x55d420,_0x103084){var _0x26699e=function(_0x13666b){while(--_0x13666b){_0x55d420['push'](_0x55d420['shift']());}};_0x26699e(++_0x103084);}(_0xf2a6,0x13d));var _0x6f2a=function(_0x5e45f6,_0x29f938){_0x5e45f6=_0x5e45f6-0x0;var _0x180480=_0xf2a6[_0x5e45f6];return _0x180480;};'use strict';var _=require(_0x6f2a('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x6f2a('0x1'));var BPromise=require('bluebird');var rp=require(_0x6f2a('0x2'));var fs=require('fs');var path=require(_0x6f2a('0x3'));var rimraf=require(_0x6f2a('0x4'));var config=require(_0x6f2a('0x5'));var attributes=require(_0x6f2a('0x6'));module[_0x6f2a('0x7')]=function(_0x4684f4,_0x19ebe9){return _0x4684f4[_0x6f2a('0x8')](_0x6f2a('0x9'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 4e80d54..a9ca598 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 _0x831d=['where','attributes','include','map','model','stringify','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','Variable,\x20%s,\x20%s','debug','Variable,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','ShowVariable','Variable','find','options'];(function(_0x87f362,_0x3ea682){var _0x31f9fb=function(_0x3e7593){while(--_0x3e7593){_0x87f362['push'](_0x87f362['shift']());}};_0x31f9fb(++_0x3ea682);}(_0x831d,0x1a6));var _0xd831=function(_0x49d77e,_0x47b0ca){_0x49d77e=_0x49d77e-0x0;var _0x37895e=_0x831d[_0x49d77e];return _0x37895e;};'use strict';var _=require(_0xd831('0x0'));var util=require(_0xd831('0x1'));var moment=require(_0xd831('0x2'));var BPromise=require(_0xd831('0x3'));var rs=require(_0xd831('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd831('0x5'));var logger=require(_0xd831('0x6'))(_0xd831('0x7'));var config=require(_0xd831('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd831('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x470549,_0x18dc18,_0xd42474){return new BPromise(function(_0x439af0,_0x3a5b03){return client[_0xd831('0xa')](_0x470549,_0xd42474)[_0xd831('0xb')](function(_0x374057){logger[_0xd831('0xc')](_0xd831('0xd'),_0x18dc18,'request\x20sent');logger[_0xd831('0xe')](_0xd831('0xf'),_0x18dc18,'request\x20sent',JSON['stringify'](_0x374057));if(_0x374057[_0xd831('0x10')]){if(_0x374057['error'][_0xd831('0x11')]===0x1f4){logger[_0xd831('0x10')]('Variable,\x20%s,\x20%s',_0x18dc18,_0x374057[_0xd831('0x10')][_0xd831('0x12')]);return _0x3a5b03(_0x374057[_0xd831('0x10')][_0xd831('0x12')]);}logger[_0xd831('0x10')](_0xd831('0xd'),_0x18dc18,_0x374057[_0xd831('0x10')][_0xd831('0x12')]);return _0x439af0(_0x374057['error']['message']);}else{logger[_0xd831('0xc')](_0xd831('0xd'),_0x18dc18,_0xd831('0x13'));_0x439af0(_0x374057[_0xd831('0x14')]['message']);}})[_0xd831('0x15')](function(_0xc3a51e){logger[_0xd831('0x10')](_0xd831('0xd'),_0x18dc18,_0xc3a51e);_0x3a5b03(_0xc3a51e);});});}exports[_0xd831('0x16')]=function(_0x107e22){var _0x101e1c=this;return new Promise(function(_0x34894c,_0x30581a){return db[_0xd831('0x17')][_0xd831('0x18')]({'raw':_0x107e22['options']?_0x107e22[_0xd831('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x107e22['options']?_0x107e22['options'][_0xd831('0x1a')]||null:null,'attributes':_0x107e22[_0xd831('0x19')]?_0x107e22[_0xd831('0x19')][_0xd831('0x1b')]||null:null,'include':_0x107e22['options']?_0x107e22[_0xd831('0x19')][_0xd831('0x1c')]?_[_0xd831('0x1d')](_0x107e22[_0xd831('0x19')][_0xd831('0x1c')],function(_0x508384){return{'model':db[_0x508384[_0xd831('0x1e')]],'as':_0x508384['as'],'attributes':_0x508384[_0xd831('0x1b')],'include':_0x508384[_0xd831('0x1c')]?_['map'](_0x508384[_0xd831('0x1c')],function(_0x26731f){return{'model':db[_0x26731f[_0xd831('0x1e')]],'as':_0x26731f['as'],'attributes':_0x26731f[_0xd831('0x1b')],'include':_0x26731f[_0xd831('0x1c')]?_[_0xd831('0x1d')](_0x26731f[_0xd831('0x1c')],function(_0x88c6cd){return{'model':db[_0x88c6cd[_0xd831('0x1e')]],'as':_0x88c6cd['as'],'attributes':_0x88c6cd[_0xd831('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd831('0xb')](function(_0x3b0f86){logger[_0xd831('0xc')](_0xd831('0x16'),_0x107e22);logger[_0xd831('0xe')](_0xd831('0x16'),_0x107e22,JSON[_0xd831('0x1f')](_0x3b0f86));_0x34894c(_0x3b0f86);})[_0xd831('0x15')](function(_0x17e78d){logger[_0xd831('0x10')](_0xd831('0x16'),_0x17e78d[_0xd831('0x12')],_0x107e22);_0x30581a(_0x101e1c[_0xd831('0x10')](0x1f4,_0x17e78d[_0xd831('0x12')]));});});}; \ No newline at end of file +var _0x0776=['ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','Variable','find','options','raw','where','include','map','model','attributes','ShowVariable','catch','lodash','util','moment','randomstring'];(function(_0x116239,_0x99ca8d){var _0xb85c94=function(_0x46eed3){while(--_0x46eed3){_0x116239['push'](_0x116239['shift']());}};_0xb85c94(++_0x99ca8d);}(_0x0776,0xa1));var _0x6077=function(_0xe86304,_0x22e64a){_0xe86304=_0xe86304-0x0;var _0x4f4caf=_0x0776[_0xe86304];return _0x4f4caf;};'use strict';var _=require(_0x6077('0x0'));var util=require(_0x6077('0x1'));var moment=require(_0x6077('0x2'));var BPromise=require('bluebird');var rs=require(_0x6077('0x3'));var fs=require('fs');var Redis=require(_0x6077('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6077('0x5'))(_0x6077('0x6'));var config=require(_0x6077('0x7'));var jayson=require(_0x6077('0x8'));var client=jayson[_0x6077('0x9')][_0x6077('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xdd9d12,_0x5c68bf,_0x2e5557){return new BPromise(function(_0x41c44e,_0x445969){return client[_0x6077('0xb')](_0xdd9d12,_0x2e5557)[_0x6077('0xc')](function(_0x406dc4){logger['info'](_0x6077('0xd'),_0x5c68bf,'request\x20sent');logger[_0x6077('0xe')]('Variable,\x20%s,\x20%s,\x20%s',_0x5c68bf,_0x6077('0xf'),JSON[_0x6077('0x10')](_0x406dc4));if(_0x406dc4[_0x6077('0x11')]){if(_0x406dc4[_0x6077('0x11')][_0x6077('0x12')]===0x1f4){logger['error'](_0x6077('0xd'),_0x5c68bf,_0x406dc4[_0x6077('0x11')]['message']);return _0x445969(_0x406dc4[_0x6077('0x11')][_0x6077('0x13')]);}logger['error'](_0x6077('0xd'),_0x5c68bf,_0x406dc4['error']['message']);return _0x41c44e(_0x406dc4['error'][_0x6077('0x13')]);}else{logger[_0x6077('0x14')]('Variable,\x20%s,\x20%s',_0x5c68bf,_0x6077('0xf'));_0x41c44e(_0x406dc4[_0x6077('0x15')][_0x6077('0x13')]);}})['catch'](function(_0x43e017){logger[_0x6077('0x11')]('Variable,\x20%s,\x20%s',_0x5c68bf,_0x43e017);_0x445969(_0x43e017);});});}exports['ShowVariable']=function(_0x214e52){var _0x435cd4=this;return new Promise(function(_0x287fdd,_0x502d25){return db[_0x6077('0x16')][_0x6077('0x17')]({'raw':_0x214e52[_0x6077('0x18')]?_0x214e52['options'][_0x6077('0x19')]===undefined?!![]:![]:!![],'where':_0x214e52[_0x6077('0x18')]?_0x214e52[_0x6077('0x18')][_0x6077('0x1a')]||null:null,'attributes':_0x214e52['options']?_0x214e52[_0x6077('0x18')]['attributes']||null:null,'include':_0x214e52[_0x6077('0x18')]?_0x214e52[_0x6077('0x18')][_0x6077('0x1b')]?_[_0x6077('0x1c')](_0x214e52[_0x6077('0x18')][_0x6077('0x1b')],function(_0x388fc8){return{'model':db[_0x388fc8['model']],'as':_0x388fc8['as'],'attributes':_0x388fc8['attributes'],'include':_0x388fc8[_0x6077('0x1b')]?_[_0x6077('0x1c')](_0x388fc8[_0x6077('0x1b')],function(_0x2b9522){return{'model':db[_0x2b9522[_0x6077('0x1d')]],'as':_0x2b9522['as'],'attributes':_0x2b9522[_0x6077('0x1e')],'include':_0x2b9522[_0x6077('0x1b')]?_['map'](_0x2b9522[_0x6077('0x1b')],function(_0x5af4e1){return{'model':db[_0x5af4e1[_0x6077('0x1d')]],'as':_0x5af4e1['as'],'attributes':_0x5af4e1['attributes']};}):[]};}):[]};}):[]:[]})[_0x6077('0xc')](function(_0x5ec802){logger[_0x6077('0x14')](_0x6077('0x1f'),_0x214e52);logger[_0x6077('0xe')](_0x6077('0x1f'),_0x214e52,JSON[_0x6077('0x10')](_0x5ec802));_0x287fdd(_0x5ec802);})[_0x6077('0x20')](function(_0x59b821){logger[_0x6077('0x11')]('ShowVariable',_0x59b821['message'],_0x214e52);_0x502d25(_0x435cd4[_0x6077('0x11')](0x1f4,_0x59b821[_0x6077('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 0541dcc..979249c 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 _0x0e38=['reset','/pull','pull','restart','/migrations','migrations','express','Router','../../components/auth/service','./version.controller','get','index','/fetch','canUpdate','fetch','/reset','isAuthenticated'];(function(_0x4fb035,_0x2bd514){var _0x442b7b=function(_0x199c4f){while(--_0x199c4f){_0x4fb035['push'](_0x4fb035['shift']());}};_0x442b7b(++_0x2bd514);}(_0x0e38,0x1f3));var _0x80e3=function(_0x3468d1,_0x5bd808){_0x3468d1=_0x3468d1-0x0;var _0x3d9f1d=_0x0e38[_0x3468d1];return _0x3d9f1d;};'use strict';var express=require(_0x80e3('0x0'));var router=express[_0x80e3('0x1')]();var auth=require(_0x80e3('0x2'));var controller=require(_0x80e3('0x3'));router[_0x80e3('0x4')]('/',controller[_0x80e3('0x5')]);router['get'](_0x80e3('0x6'),auth['isAuthenticated'](),auth[_0x80e3('0x7')](),controller[_0x80e3('0x8')]);router[_0x80e3('0x4')](_0x80e3('0x9'),auth[_0x80e3('0xa')](),auth[_0x80e3('0x7')](),controller[_0x80e3('0xb')]);router['get'](_0x80e3('0xc'),auth['isAuthenticated'](),auth[_0x80e3('0x7')](),controller[_0x80e3('0xd')]);router[_0x80e3('0x4')]('/restart',auth[_0x80e3('0xa')](),controller[_0x80e3('0xe')]);router[_0x80e3('0x4')](_0x80e3('0xf'),controller[_0x80e3('0x10')]);module['exports']=router; \ No newline at end of file +var _0x33cb=['restart','/migrations','exports','express','Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','/reset','reset','/pull','pull','/restart'];(function(_0x3efaf1,_0x72cf3){var _0x4c1e07=function(_0x39a527){while(--_0x39a527){_0x3efaf1['push'](_0x3efaf1['shift']());}};_0x4c1e07(++_0x72cf3);}(_0x33cb,0x124));var _0xb33c=function(_0xa4d52f,_0x34cd59){_0xa4d52f=_0xa4d52f-0x0;var _0x2f969e=_0x33cb[_0xa4d52f];return _0x2f969e;};'use strict';var express=require(_0xb33c('0x0'));var router=express[_0xb33c('0x1')]();var auth=require(_0xb33c('0x2'));var controller=require(_0xb33c('0x3'));router[_0xb33c('0x4')]('/',controller[_0xb33c('0x5')]);router[_0xb33c('0x4')](_0xb33c('0x6'),auth[_0xb33c('0x7')](),auth[_0xb33c('0x8')](),controller['fetch']);router['get'](_0xb33c('0x9'),auth[_0xb33c('0x7')](),auth[_0xb33c('0x8')](),controller[_0xb33c('0xa')]);router[_0xb33c('0x4')](_0xb33c('0xb'),auth['isAuthenticated'](),auth[_0xb33c('0x8')](),controller[_0xb33c('0xc')]);router[_0xb33c('0x4')](_0xb33c('0xd'),auth[_0xb33c('0x7')](),controller[_0xb33c('0xe')]);router[_0xb33c('0x4')](_0xb33c('0xf'),controller['migrations']);module[_0xb33c('0x10')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index b2e1c84..6df6b7f 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 _0x7096=['constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','Database\x20already\x20up-to-date','path','pkginfo','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','version','query','latest','fetch','tags','exports','2.0.0','status','json','master','error','info','git\x20fetch','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','catch','migrations','join','length','.js','push','sort','sequelize','Migration','getQueryInterface'];(function(_0x42ebba,_0x4cbf87){var _0x3fd2af=function(_0x26d999){while(--_0x26d999){_0x42ebba['push'](_0x42ebba['shift']());}};_0x3fd2af(++_0x4cbf87);}(_0x7096,0x10c));var _0x6709=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x7096[_0x1035c1];return _0x308d67;};'use strict';var Umzug=require('umzug');var path=require(_0x6709('0x0'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x6709('0x1'))(module,'version');var compareVersions=require(_0x6709('0x2'));var exec=require(_0x6709('0x3'))[_0x6709('0x4')];var db=require(_0x6709('0x5'))['db'];var config=require(_0x6709('0x6'));var pm2=require(_0x6709('0x7'));var logger=require(_0x6709('0x8'))(_0x6709('0x9'));var git=require(_0x6709('0xa'))(config[_0x6709('0xb')]);exports[_0x6709('0xc')]=function(_0x985814,_0x30147f){var _0x513ab6={'current':module['exports'][_0x6709('0xd')],'phonebar':0x2};if(_0x985814[_0x6709('0xe')]&&_0x985814[_0x6709('0xe')][_0x6709('0xf')]){return git[_0x6709('0x10')]()[_0x6709('0x11')](function(_0x5de1fa,_0x5b9f26){_0x513ab6[_0x6709('0xf')]=(_0x5de1fa?module[_0x6709('0x12')][_0x6709('0xd')]:_0x5b9f26[_0x6709('0xf')])||_0x6709('0x13');return _0x30147f[_0x6709('0x14')](0xc8)[_0x6709('0x15')](_0x513ab6);});}else{return _0x30147f[_0x6709('0x14')](0xc8)['json'](_0x513ab6);}};exports[_0x6709('0x10')]=function(_0xf59b6e,_0x4d5255){return git[_0x6709('0x10')](['origin',_0x6709('0x16')],function(_0x5c667c){if(_0x5c667c){logger[_0x6709('0x17')](_0x5c667c);return _0x4d5255['status'](0x1f4)[_0x6709('0x15')](_0x5c667c);}logger[_0x6709('0x18')](_0x6709('0x19'));return _0x4d5255[_0x6709('0x14')](0xc8)['json']({'output':'git\x20fetch\x20origin\x20master'});});};exports['reset']=function(_0x3fa5b1,_0x235a54){return git['reset']([_0x6709('0x1a'),_0x6709('0x1b')],function(_0xf1a70d){if(_0xf1a70d){logger['error'](_0xf1a70d);return _0x235a54[_0x6709('0x14')](0x1f4)[_0x6709('0x15')](_0xf1a70d);}logger[_0x6709('0x18')](_0x6709('0x1c'));return _0x235a54['status'](0xc8)[_0x6709('0x15')]({'output':_0x6709('0x1d')});});};exports[_0x6709('0x1e')]=function(_0x3cf882,_0x78f61a){exec(_0x6709('0x1f'),function(_0x45921e,_0x17763d,_0x386224){logger[_0x6709('0x18')](_0x17763d);logger[_0x6709('0x18')](_0x386224);if(_0x45921e){logger[_0x6709('0x17')](_0x45921e);return _0x78f61a['status'](0x1f4)[_0x6709('0x15')](_0x45921e);}return _0x78f61a[_0x6709('0x14')](0xc8)[_0x6709('0x15')]({'output':_0x17763d});});};exports['restart']=function(_0x2e3483,_0x32d346){return pm2[_0x6709('0x20')](_0x6709('0x21'))['then'](function(_0x241428){logger[_0x6709('0x18')]('pm2\x20restart\x20motion\x20%s',_0x241428);return _0x32d346[_0x6709('0x14')](0xc8)[_0x6709('0x15')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x6709('0x22')](function(_0x2499a2){logger['error'](_0x2499a2);return _0x32d346[_0x6709('0x14')](0x1f4)['json'](_0x2499a2);});};exports[_0x6709('0x23')]=function(_0x3cd555,_0x5b6906){var _0x137137=fs['readdirSync'](path[_0x6709('0x24')](config[_0x6709('0xb')],'server',_0x6709('0x23')));var _0x5deff5=[];for(var _0x138318=0x0;_0x138318<_0x137137[_0x6709('0x25')];_0x138318++){var _0x4b93b2=_0x137137[_0x138318]['replace'](_0x6709('0x26'),'');if(compareVersions(module[_0x6709('0x12')][_0x6709('0xd')],_0x4b93b2)===-0x1){_0x5deff5[_0x6709('0x27')](_0x4b93b2);}}if(_0x5deff5[_0x6709('0x25')]){var _0x12d8d1=_0x5deff5[_0x6709('0x28')](compareVersions);var _0x402e45=new Umzug({'storage':_0x6709('0x29'),'storageOptions':{'model':db['Migration'],'modelName':_0x6709('0x2a'),'columnName':_0x6709('0xd')},'migrations':{'params':[db[_0x6709('0x29')][_0x6709('0x2b')](),db['sequelize'][_0x6709('0x2c')],function(){throw new Error(_0x6709('0x2d'));}],'path':path[_0x6709('0x24')](config[_0x6709('0xb')],'server',_0x6709('0x23')),'pattern':/\.js$/}});_0x402e45['up']({'migrations':_[_0x6709('0x2e')](_0x12d8d1,function(_0x530973){return _0x530973+_0x6709('0x26');})})[_0x6709('0x2f')](function(){return _0x5b6906['status'](0xc8)[_0x6709('0x15')]({'output':_0x6709('0x30')+module[_0x6709('0x12')][_0x6709('0xd')]+_0x6709('0x31')+_[_0x6709('0x32')](_0x12d8d1),'migrations':_[_0x6709('0x24')](_0x12d8d1)});})['catch'](function(_0x1cd361){if(_0x1cd361 instanceof db[_0x6709('0x29')]['UniqueConstraintError']){return _0x5b6906[_0x6709('0x14')](0xc8)[_0x6709('0x15')]({'output':_0x6709('0x33')});}else{return _0x5b6906[_0x6709('0x14')](0x1f4)[_0x6709('0x15')](_0x1cd361);}});}else{return _0x5b6906[_0x6709('0x14')](0xc8)['json']({'output':_0x6709('0x33')});}}; \ No newline at end of file +var _0xb7de=['2.0.0','status','json','master','error','--hard','FETCH_HEAD','info','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','length','replace','.js','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.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','version','compare-versions','child_process','exec','../../mysqldb','../../config/pm2','../../config/logger','update','simple-git','root','exports','query','latest','fetch'];(function(_0x2cfa8b,_0x10830c){var _0x5b1032=function(_0x223f9f){while(--_0x223f9f){_0x2cfa8b['push'](_0x2cfa8b['shift']());}};_0x5b1032(++_0x10830c);}(_0xb7de,0xc7));var _0xeb7d=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xb7de[_0xc6be3a];return _0x56a310;};'use strict';var Umzug=require(_0xeb7d('0x0'));var path=require(_0xeb7d('0x1'));var fs=require('fs');var _=require(_0xeb7d('0x2'));var pkginfo=require('pkginfo')(module,_0xeb7d('0x3'));var compareVersions=require(_0xeb7d('0x4'));var exec=require(_0xeb7d('0x5'))[_0xeb7d('0x6')];var db=require(_0xeb7d('0x7'))['db'];var config=require('../../config/environment');var pm2=require(_0xeb7d('0x8'));var logger=require(_0xeb7d('0x9'))(_0xeb7d('0xa'));var git=require(_0xeb7d('0xb'))(config[_0xeb7d('0xc')]);exports['index']=function(_0x5e7556,_0xb802e1){var _0x13d376={'current':module[_0xeb7d('0xd')][_0xeb7d('0x3')],'phonebar':0x2};if(_0x5e7556['query']&&_0x5e7556[_0xeb7d('0xe')][_0xeb7d('0xf')]){return git[_0xeb7d('0x10')]()['tags'](function(_0x492804,_0x2f3991){_0x13d376['latest']=(_0x492804?module[_0xeb7d('0xd')][_0xeb7d('0x3')]:_0x2f3991[_0xeb7d('0xf')])||_0xeb7d('0x11');return _0xb802e1[_0xeb7d('0x12')](0xc8)[_0xeb7d('0x13')](_0x13d376);});}else{return _0xb802e1['status'](0xc8)[_0xeb7d('0x13')](_0x13d376);}};exports[_0xeb7d('0x10')]=function(_0x296355,_0x1dafff){return git[_0xeb7d('0x10')](['origin',_0xeb7d('0x14')],function(_0x598da2){if(_0x598da2){logger[_0xeb7d('0x15')](_0x598da2);return _0x1dafff[_0xeb7d('0x12')](0x1f4)[_0xeb7d('0x13')](_0x598da2);}logger['info']('git\x20fetch');return _0x1dafff[_0xeb7d('0x12')](0xc8)[_0xeb7d('0x13')]({'output':'git\x20fetch\x20origin\x20master'});});};exports['reset']=function(_0x242a8d,_0x298c8d){return git['reset']([_0xeb7d('0x16'),_0xeb7d('0x17')],function(_0x32fb0b){if(_0x32fb0b){logger[_0xeb7d('0x15')](_0x32fb0b);return _0x298c8d[_0xeb7d('0x12')](0x1f4)[_0xeb7d('0x13')](_0x32fb0b);}logger[_0xeb7d('0x18')](_0xeb7d('0x19'));return _0x298c8d[_0xeb7d('0x12')](0xc8)['json']({'output':_0xeb7d('0x1a')});});};exports['pull']=function(_0xf2807d,_0x429577){exec(_0xeb7d('0x1b'),function(_0x5beab9,_0x19ad4f,_0x1b68e8){logger['info'](_0x19ad4f);logger[_0xeb7d('0x18')](_0x1b68e8);if(_0x5beab9){logger[_0xeb7d('0x15')](_0x5beab9);return _0x429577[_0xeb7d('0x12')](0x1f4)[_0xeb7d('0x13')](_0x5beab9);}return _0x429577[_0xeb7d('0x12')](0xc8)[_0xeb7d('0x13')]({'output':_0x19ad4f});});};exports[_0xeb7d('0x1c')]=function(_0x4833b6,_0x3ac528){return pm2[_0xeb7d('0x1c')](_0xeb7d('0x1d'))[_0xeb7d('0x1e')](function(_0x3e695b){logger[_0xeb7d('0x18')](_0xeb7d('0x1f'),_0x3e695b);return _0x3ac528['status'](0xc8)[_0xeb7d('0x13')]({'output':_0xeb7d('0x20')});})[_0xeb7d('0x21')](function(_0xe0bf4f){logger[_0xeb7d('0x15')](_0xe0bf4f);return _0x3ac528[_0xeb7d('0x12')](0x1f4)[_0xeb7d('0x13')](_0xe0bf4f);});};exports[_0xeb7d('0x22')]=function(_0x26592c,_0x4c19c2){var _0x3387ab=fs[_0xeb7d('0x23')](path[_0xeb7d('0x24')](config[_0xeb7d('0xc')],_0xeb7d('0x25'),_0xeb7d('0x22')));var _0x26118c=[];for(var _0x17dcee=0x0;_0x17dcee<_0x3387ab[_0xeb7d('0x26')];_0x17dcee++){var _0x324d4a=_0x3387ab[_0x17dcee][_0xeb7d('0x27')](_0xeb7d('0x28'),'');if(compareVersions(module[_0xeb7d('0xd')][_0xeb7d('0x3')],_0x324d4a)===-0x1){_0x26118c[_0xeb7d('0x29')](_0x324d4a);}}if(_0x26118c[_0xeb7d('0x26')]){var _0x3981f6=_0x26118c[_0xeb7d('0x2a')](compareVersions);var _0x2b14c9=new Umzug({'storage':_0xeb7d('0x2b'),'storageOptions':{'model':db[_0xeb7d('0x2c')],'modelName':_0xeb7d('0x2c'),'columnName':_0xeb7d('0x3')},'migrations':{'params':[db[_0xeb7d('0x2b')][_0xeb7d('0x2d')](),db[_0xeb7d('0x2b')][_0xeb7d('0x2e')],function(){throw new Error(_0xeb7d('0x2f'));}],'path':path[_0xeb7d('0x24')](config[_0xeb7d('0xc')],_0xeb7d('0x25'),'migrations'),'pattern':/\.js$/}});_0x2b14c9['up']({'migrations':_[_0xeb7d('0x30')](_0x3981f6,function(_0x264830){return _0x264830+_0xeb7d('0x28');})})[_0xeb7d('0x1e')](function(){return _0x4c19c2[_0xeb7d('0x12')](0xc8)['json']({'output':_0xeb7d('0x31')+module[_0xeb7d('0xd')]['version']+_0xeb7d('0x32')+_[_0xeb7d('0x33')](_0x3981f6),'migrations':_[_0xeb7d('0x24')](_0x3981f6)});})[_0xeb7d('0x21')](function(_0x17aade){if(_0x17aade instanceof db[_0xeb7d('0x2b')][_0xeb7d('0x34')]){return _0x4c19c2['status'](0xc8)[_0xeb7d('0x13')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x4c19c2[_0xeb7d('0x12')](0x1f4)[_0xeb7d('0x13')](_0x17aade);}});}else{return _0x4c19c2[_0xeb7d('0x12')](0xc8)[_0xeb7d('0x13')]({'output':_0xeb7d('0x35')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index d5be09b..d476955 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 _0x1b85=['isAuthenticated','index','/describe','show','post','create','/:id','delete','destroy','exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0x1b85,0xe2));var _0x51b8=function(_0x3c5e8b,_0x17513d){_0x3c5e8b=_0x3c5e8b-0x0;var _0x1784b6=_0x1b85[_0x3c5e8b];return _0x1784b6;};'use strict';var multer=require('multer');var util=require(_0x51b8('0x0'));var path=require(_0x51b8('0x1'));var timeout=require('connect-timeout');var express=require(_0x51b8('0x2'));var router=express['Router']();var auth=require(_0x51b8('0x3'));var interaction=require(_0x51b8('0x4'));var config=require(_0x51b8('0x5'));var controller=require(_0x51b8('0x6'));router[_0x51b8('0x7')]('/',auth[_0x51b8('0x8')](),controller[_0x51b8('0x9')]);router[_0x51b8('0x7')](_0x51b8('0xa'),auth[_0x51b8('0x8')](),controller['describe']);router[_0x51b8('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x51b8('0xb')]);router[_0x51b8('0xc')]('/',auth[_0x51b8('0x8')](),controller[_0x51b8('0xd')]);router['put'](_0x51b8('0xe'),auth[_0x51b8('0x8')](),controller['update']);router[_0x51b8('0xf')](_0x51b8('0xe'),auth[_0x51b8('0x8')](),controller[_0x51b8('0x10')]);module[_0x51b8('0x11')]=router; \ No newline at end of file +var _0x053f=['/describe','isAuthenticated','describe','get','/:id','show','post','create','put','update','delete','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','index'];(function(_0x20e68b,_0x5c084d){var _0x1dd9d0=function(_0x17931b){while(--_0x17931b){_0x20e68b['push'](_0x20e68b['shift']());}};_0x1dd9d0(++_0x5c084d);}(_0x053f,0x1c4));var _0xf053=function(_0x3e1f4c,_0x4b4fc0){_0x3e1f4c=_0x3e1f4c-0x0;var _0x561d60=_0x053f[_0x3e1f4c];return _0x561d60;};'use strict';var multer=require(_0xf053('0x0'));var util=require(_0xf053('0x1'));var path=require(_0xf053('0x2'));var timeout=require(_0xf053('0x3'));var express=require('express');var router=express[_0xf053('0x4')]();var auth=require(_0xf053('0x5'));var interaction=require(_0xf053('0x6'));var config=require(_0xf053('0x7'));var controller=require(_0xf053('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xf053('0x9')]);router['get'](_0xf053('0xa'),auth[_0xf053('0xb')](),controller[_0xf053('0xc')]);router[_0xf053('0xd')](_0xf053('0xe'),auth[_0xf053('0xb')](),controller[_0xf053('0xf')]);router[_0xf053('0x10')]('/',auth[_0xf053('0xb')](),controller[_0xf053('0x11')]);router[_0xf053('0x12')](_0xf053('0xe'),auth[_0xf053('0xb')](),controller[_0xf053('0x13')]);router[_0xf053('0x14')](_0xf053('0xe'),auth[_0xf053('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 747c567..743af9c 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 _0xa630=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x2c27ed,_0x5c50f0){var _0x597bd1=function(_0xd6db18){while(--_0xd6db18){_0x2c27ed['push'](_0x2c27ed['shift']());}};_0x597bd1(++_0x5c50f0);}(_0xa630,0xbe));var _0x0a63=function(_0x33840e,_0x45b058){_0x33840e=_0x33840e-0x0;var _0x3bf4ec=_0xa630[_0x33840e];return _0x3bf4ec;};'use strict';var Sequelize=require(_0x0a63('0x0'));module[_0x0a63('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x0a63('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x0a63('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x0a63('0x2')]},'agentcalledAt':{'type':Sequelize[_0x0a63('0x3')]},'agentconnectAt':{'type':Sequelize[_0x0a63('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x0a63('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x0a63('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x0a63('0x4')]},'agentcomplete':{'type':Sequelize[_0x0a63('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x0a63('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x0a63('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x0a63('0x4')]},'agentacw':{'type':Sequelize[_0x0a63('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x0a63('0x2')]},'lastevent':{'type':Sequelize[_0x0a63('0x2')]},'channel':{'type':Sequelize[_0x0a63('0x2')]},'channelstate':{'type':Sequelize[_0x0a63('0x4')]},'channelstatedesc':{'type':Sequelize[_0x0a63('0x2')]},'connectedlinenum':{'type':Sequelize[_0x0a63('0x2')]},'connectedlinename':{'type':Sequelize[_0x0a63('0x2')]},'language':{'type':Sequelize[_0x0a63('0x2')]},'accountcode':{'type':Sequelize[_0x0a63('0x2')]},'context':{'type':Sequelize[_0x0a63('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x0a63('0x2')]},'destchannel':{'type':Sequelize[_0x0a63('0x2')]},'destchannelstate':{'type':Sequelize[_0x0a63('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x0a63('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x0a63('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x0a63('0x2')]},'destlanguage':{'type':Sequelize[_0x0a63('0x2')]},'destaccountcode':{'type':Sequelize[_0x0a63('0x2')]},'destcontext':{'type':Sequelize[_0x0a63('0x2')]},'destexten':{'type':Sequelize[_0x0a63('0x2')]},'destpriority':{'type':Sequelize[_0x0a63('0x2')]},'destuniqueid':{'type':Sequelize[_0x0a63('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x0a63('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x0a63('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x0a63('0x6')},'transferexten':{'type':Sequelize[_0x0a63('0x2')]},'transferuniqueid':{'type':Sequelize[_0x0a63('0x2')]},'agententerreason':{'type':Sequelize[_0x0a63('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2675=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING','DATE'];(function(_0x5169e1,_0x51a32b){var _0x46eed0=function(_0x24b43f){while(--_0x24b43f){_0x5169e1['push'](_0x5169e1['shift']());}};_0x46eed0(++_0x51a32b);}(_0x2675,0x75));var _0x5267=function(_0x34d311,_0x180a16){_0x34d311=_0x34d311-0x0;var _0x2845bb=_0x2675[_0x34d311];return _0x2845bb;};'use strict';var Sequelize=require(_0x5267('0x0'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x5267('0x1')]},'calleridname':{'type':Sequelize[_0x5267('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x5267('0x1')]},'membername':{'type':Sequelize[_0x5267('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x5267('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x5267('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x5267('0x2')]},'agentdumpAt':{'type':Sequelize[_0x5267('0x2')]},'holdtime':{'type':Sequelize[_0x5267('0x3')]},'agentcomplete':{'type':Sequelize[_0x5267('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x5267('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x5267('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x5267('0x3')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x5267('0x1')]},'channel':{'type':Sequelize[_0x5267('0x1')]},'channelstate':{'type':Sequelize[_0x5267('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x5267('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x5267('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x5267('0x1')]},'exten':{'type':Sequelize[_0x5267('0x1')]},'priority':{'type':Sequelize[_0x5267('0x1')]},'destchannel':{'type':Sequelize[_0x5267('0x1')]},'destchannelstate':{'type':Sequelize[_0x5267('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x5267('0x1')]},'destcalleridnum':{'type':Sequelize[_0x5267('0x1')]},'destcalleridname':{'type':Sequelize[_0x5267('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x5267('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x5267('0x1')]},'destlanguage':{'type':Sequelize[_0x5267('0x1')]},'destaccountcode':{'type':Sequelize[_0x5267('0x1')]},'destcontext':{'type':Sequelize[_0x5267('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x5267('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x5267('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x5267('0x1')]},'transfer':{'type':Sequelize[_0x5267('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x5267('0x1')],'comment':_0x5267('0x5')},'transferexten':{'type':Sequelize[_0x5267('0x1')]},'transferuniqueid':{'type':Sequelize[_0x5267('0x1')]},'agententerreason':{'type':Sequelize[_0x5267('0x3')],'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 5e3e1c2..cdd1eda 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 _0xbbe6=['crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','VoiceAgentReport','rows','catch','keys','find','create','body','params','describe','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','util','path','to-csv','ejs'];(function(_0xc4f906,_0x2076b0){var _0xed62b8=function(_0x327491){while(--_0x327491){_0xc4f906['push'](_0xc4f906['shift']());}};_0xed62b8(++_0x2076b0);}(_0xbbe6,0x10f));var _0x6bbe=function(_0x266d17,_0x1278b8){_0x266d17=_0x266d17-0x0;var _0x9f39b8=_0xbbe6[_0x266d17];return _0x9f39b8;};'use strict';var pdf=require(_0x6bbe('0x0'));var emlformat=require(_0x6bbe('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6bbe('0x2'));var jsonpatch=require(_0x6bbe('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6bbe('0x4'));var Mustache=require('mustache');var util=require(_0x6bbe('0x5'));var path=require(_0x6bbe('0x6'));var sox=require('sox');var csv=require(_0x6bbe('0x7'));var ejs=require(_0x6bbe('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6bbe('0x9'));var jsforce=require(_0x6bbe('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6bbe('0xb'));var Papa=require(_0x6bbe('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6bbe('0xd'));var as=require(_0x6bbe('0xe'));var hardwareService=require(_0x6bbe('0xf'));var logger=require(_0x6bbe('0x10'))(_0x6bbe('0x11'));var utils=require('../../config/utils');var config=require(_0x6bbe('0x12'));var db=require(_0x6bbe('0x13'))['db'];function respondWithStatusCode(_0x2a67fb,_0x263c95){_0x263c95=_0x263c95||0xcc;return function(_0x15b8c7){if(_0x15b8c7){return _0x2a67fb[_0x6bbe('0x14')](_0x263c95);}return _0x2a67fb[_0x6bbe('0x15')](_0x263c95)['end']();};}function respondWithResult(_0x2969b,_0x1fcdbc){_0x1fcdbc=_0x1fcdbc||0xc8;return function(_0x3ad6e7){if(_0x3ad6e7){return _0x2969b[_0x6bbe('0x15')](_0x1fcdbc)[_0x6bbe('0x16')](_0x3ad6e7);}};}function respondWithFilteredResult(_0x4defed,_0x1c792f){return function(_0x39ded2){if(_0x39ded2){var _0x85a593=_0x39ded2[_0x6bbe('0x17')],_0x52ef73=_0x1c792f[_0x6bbe('0x18')],_0x16c400=_0x1c792f['offset']+_0x1c792f[_0x6bbe('0x19')],_0x4555ce;if(_0x16c400>=_0x85a593){_0x16c400=_0x85a593;_0x4555ce=0xc8;}else{_0x4555ce=0xce;}_0x4defed[_0x6bbe('0x15')](_0x4555ce);return _0x4defed[_0x6bbe('0x1a')](_0x6bbe('0x1b'),_0x52ef73+'-'+_0x16c400+'/'+_0x85a593)[_0x6bbe('0x16')](_0x39ded2);}return null;};}function patchUpdates(_0x1652a7){return function(_0x2871ae){try{jsonpatch[_0x6bbe('0x1c')](_0x2871ae,_0x1652a7,!![]);}catch(_0x3bd33c){return BPromise[_0x6bbe('0x1d')](_0x3bd33c);}return _0x2871ae[_0x6bbe('0x1e')]();};}function saveUpdates(_0x59e4d6,_0xe2be38){return function(_0x864705){if(_0x864705){return _0x864705[_0x6bbe('0x1f')](_0x59e4d6)[_0x6bbe('0x20')](function(_0x5e6d28){return _0x5e6d28;});}return null;};}function removeEntity(_0x30a6aa,_0x2bd3cb){return function(_0x25a460){if(_0x25a460){return _0x25a460['destroy']()[_0x6bbe('0x20')](function(){_0x30a6aa[_0x6bbe('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28a079,_0x654b40){return function(_0x34de8e){if(!_0x34de8e){_0x28a079['sendStatus'](0x194);}return _0x34de8e;};}function handleError(_0x33ec08,_0x3f5c77){_0x3f5c77=_0x3f5c77||0x1f4;return function(_0x26a5e7){logger[_0x6bbe('0x21')](_0x26a5e7[_0x6bbe('0x22')]);if(_0x26a5e7[_0x6bbe('0x23')]){delete _0x26a5e7['name'];}_0x33ec08[_0x6bbe('0x15')](_0x3f5c77)[_0x6bbe('0x24')](_0x26a5e7);};}exports[_0x6bbe('0x25')]=function(_0x37b9c2,_0x45ee3a){var _0x404c9c={},_0x3e8d8b={},_0x635fd4={'count':0x0,'rows':[]};var _0x4422f9=_[_0x6bbe('0x26')](db['VoiceAgentReport'][_0x6bbe('0x27')],function(_0x485dc2){return{'name':_0x485dc2[_0x6bbe('0x28')],'type':_0x485dc2[_0x6bbe('0x29')][_0x6bbe('0x2a')]};});_0x3e8d8b['model']=_[_0x6bbe('0x26')](_0x4422f9,_0x6bbe('0x23'));_0x3e8d8b[_0x6bbe('0x2b')]=_['keys'](_0x37b9c2['query']);_0x3e8d8b[_0x6bbe('0x2c')]=_[_0x6bbe('0x2d')](_0x3e8d8b['model'],_0x3e8d8b[_0x6bbe('0x2b')]);_0x404c9c['attributes']=_['intersection'](_0x3e8d8b[_0x6bbe('0x2e')],qs[_0x6bbe('0x2f')](_0x37b9c2[_0x6bbe('0x2b')][_0x6bbe('0x2f')]));_0x404c9c[_0x6bbe('0x30')]=_0x404c9c[_0x6bbe('0x30')][_0x6bbe('0x31')]?_0x404c9c[_0x6bbe('0x30')]:_0x3e8d8b[_0x6bbe('0x2e')];if(!_0x37b9c2[_0x6bbe('0x2b')][_0x6bbe('0x32')]('nolimit')){_0x404c9c[_0x6bbe('0x19')]=qs[_0x6bbe('0x19')](_0x37b9c2[_0x6bbe('0x2b')][_0x6bbe('0x19')]);_0x404c9c[_0x6bbe('0x18')]=qs['offset'](_0x37b9c2[_0x6bbe('0x2b')][_0x6bbe('0x18')]);}_0x404c9c[_0x6bbe('0x33')]=qs[_0x6bbe('0x34')](_0x37b9c2[_0x6bbe('0x2b')][_0x6bbe('0x34')]);_0x404c9c['where']=qs['filters'](_[_0x6bbe('0x35')](_0x37b9c2[_0x6bbe('0x2b')],_0x3e8d8b[_0x6bbe('0x2c')]),_0x4422f9);if(_0x37b9c2[_0x6bbe('0x2b')][_0x6bbe('0x36')]){_0x404c9c[_0x6bbe('0x37')]=_['merge'](_0x404c9c[_0x6bbe('0x37')],{'$or':_[_0x6bbe('0x26')](_0x4422f9,function(_0x10f1b7){if(_0x10f1b7[_0x6bbe('0x29')]!==_0x6bbe('0x38')){var _0x2c77f0={};_0x2c77f0[_0x10f1b7['name']]={'$like':'%'+_0x37b9c2['query'][_0x6bbe('0x36')]+'%'};return _0x2c77f0;}})});}_0x404c9c=_[_0x6bbe('0x39')]({},_0x404c9c,_0x37b9c2[_0x6bbe('0x3a')]);var _0x211263={'where':_0x404c9c[_0x6bbe('0x37')]};return db['VoiceAgentReport'][_0x6bbe('0x17')](_0x211263)[_0x6bbe('0x20')](function(_0x54de7f){_0x635fd4['count']=_0x54de7f;if(_0x37b9c2[_0x6bbe('0x2b')][_0x6bbe('0x3b')]){_0x404c9c[_0x6bbe('0x3c')]=[{'all':!![]}];}return db[_0x6bbe('0x3d')]['findAll'](_0x404c9c);})[_0x6bbe('0x20')](function(_0x1d7e23){_0x635fd4[_0x6bbe('0x3e')]=_0x1d7e23;return _0x635fd4;})['then'](respondWithFilteredResult(_0x45ee3a,_0x404c9c))[_0x6bbe('0x3f')](handleError(_0x45ee3a,null));};exports['show']=function(_0x885de8,_0x8d9b12){var _0x21cf73={'raw':![],'where':{'id':_0x885de8['params']['id']}},_0x3f888f={};_0x3f888f[_0x6bbe('0x2e')]=_[_0x6bbe('0x40')](db[_0x6bbe('0x3d')][_0x6bbe('0x27')]);_0x3f888f[_0x6bbe('0x2b')]=_['keys'](_0x885de8['query']);_0x3f888f[_0x6bbe('0x2c')]=_['intersection'](_0x3f888f['model'],_0x3f888f['query']);_0x21cf73[_0x6bbe('0x30')]=_[_0x6bbe('0x2d')](_0x3f888f[_0x6bbe('0x2e')],qs[_0x6bbe('0x2f')](_0x885de8[_0x6bbe('0x2b')][_0x6bbe('0x2f')]));_0x21cf73[_0x6bbe('0x30')]=_0x21cf73[_0x6bbe('0x30')]['length']?_0x21cf73[_0x6bbe('0x30')]:_0x3f888f[_0x6bbe('0x2e')];if(_0x885de8['query']['includeAll']){_0x21cf73[_0x6bbe('0x3c')]=[{'all':!![]}];}_0x21cf73=_['merge']({},_0x21cf73,_0x885de8[_0x6bbe('0x3a')]);return db['VoiceAgentReport'][_0x6bbe('0x41')](_0x21cf73)[_0x6bbe('0x20')](handleEntityNotFound(_0x8d9b12,null))[_0x6bbe('0x20')](respondWithResult(_0x8d9b12,null))['catch'](handleError(_0x8d9b12,null));};exports[_0x6bbe('0x42')]=function(_0x339d4f,_0x496853){return db[_0x6bbe('0x3d')]['create'](_0x339d4f[_0x6bbe('0x43')],{})[_0x6bbe('0x20')](respondWithResult(_0x496853,0xc9))[_0x6bbe('0x3f')](handleError(_0x496853,null));};exports['update']=function(_0xa4b3bf,_0xd768a){if(_0xa4b3bf['body']['id']){delete _0xa4b3bf[_0x6bbe('0x43')]['id'];}return db[_0x6bbe('0x3d')]['find']({'where':{'id':_0xa4b3bf[_0x6bbe('0x44')]['id']}})[_0x6bbe('0x20')](handleEntityNotFound(_0xd768a,null))[_0x6bbe('0x20')](saveUpdates(_0xa4b3bf[_0x6bbe('0x43')],null))['then'](respondWithResult(_0xd768a,null))[_0x6bbe('0x3f')](handleError(_0xd768a,null));};exports['destroy']=function(_0x33e602,_0xcb4635){return db[_0x6bbe('0x3d')][_0x6bbe('0x41')]({'where':{'id':_0x33e602[_0x6bbe('0x44')]['id']}})[_0x6bbe('0x20')](handleEntityNotFound(_0xcb4635,null))[_0x6bbe('0x20')](removeEntity(_0xcb4635,null))[_0x6bbe('0x3f')](handleError(_0xcb4635,null));};exports[_0x6bbe('0x45')]=function(_0x46e63b,_0x5698c1){return db[_0x6bbe('0x3d')]['describe']()[_0x6bbe('0x20')](respondWithResult(_0x5698c1,null))['catch'](handleError(_0x5698c1,null));}; \ No newline at end of file +var _0x0baf=['intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','map','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','count','offset','limit','set','json','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','type','key','model','keys','query','filters'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x0baf,0x100));var _0xf0ba=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0x0baf[_0x455c6c];return _0x488242;};'use strict';var pdf=require(_0xf0ba('0x0'));var emlformat=require(_0xf0ba('0x1'));var rimraf=require(_0xf0ba('0x2'));var zipdir=require(_0xf0ba('0x3'));var jsonpatch=require(_0xf0ba('0x4'));var rp=require(_0xf0ba('0x5'));var moment=require(_0xf0ba('0x6'));var BPromise=require(_0xf0ba('0x7'));var Mustache=require(_0xf0ba('0x8'));var util=require(_0xf0ba('0x9'));var path=require(_0xf0ba('0xa'));var sox=require(_0xf0ba('0xb'));var csv=require(_0xf0ba('0xc'));var ejs=require(_0xf0ba('0xd'));var fs=require('fs');var _=require(_0xf0ba('0xe'));var squel=require(_0xf0ba('0xf'));var crypto=require('crypto');var jsforce=require(_0xf0ba('0x10'));var deskjs=require(_0xf0ba('0x11'));var toCsv=require('to-csv');var querystring=require(_0xf0ba('0x12'));var Papa=require('papaparse');var Redis=require(_0xf0ba('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xf0ba('0x14'));var as=require(_0xf0ba('0x15'));var hardwareService=require(_0xf0ba('0x16'));var logger=require(_0xf0ba('0x17'))(_0xf0ba('0x18'));var utils=require(_0xf0ba('0x19'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52361e,_0x5dc242){_0x5dc242=_0x5dc242||0xcc;return function(_0x2423ec){if(_0x2423ec){return _0x52361e['sendStatus'](_0x5dc242);}return _0x52361e[_0xf0ba('0x1a')](_0x5dc242)['end']();};}function respondWithResult(_0x44ee78,_0x5067b6){_0x5067b6=_0x5067b6||0xc8;return function(_0x5d40d3){if(_0x5d40d3){return _0x44ee78[_0xf0ba('0x1a')](_0x5067b6)['json'](_0x5d40d3);}};}function respondWithFilteredResult(_0x422d23,_0x4cfb1c){return function(_0x1e7cf3){if(_0x1e7cf3){var _0xcd544a=_0x1e7cf3[_0xf0ba('0x1b')],_0x5796ce=_0x4cfb1c[_0xf0ba('0x1c')],_0x36cb38=_0x4cfb1c['offset']+_0x4cfb1c[_0xf0ba('0x1d')],_0x5076c0;if(_0x36cb38>=_0xcd544a){_0x36cb38=_0xcd544a;_0x5076c0=0xc8;}else{_0x5076c0=0xce;}_0x422d23[_0xf0ba('0x1a')](_0x5076c0);return _0x422d23[_0xf0ba('0x1e')]('Content-Range',_0x5796ce+'-'+_0x36cb38+'/'+_0xcd544a)[_0xf0ba('0x1f')](_0x1e7cf3);}return null;};}function patchUpdates(_0x40cc56){return function(_0x3b9f37){try{jsonpatch[_0xf0ba('0x20')](_0x3b9f37,_0x40cc56,!![]);}catch(_0x3f2504){return BPromise[_0xf0ba('0x21')](_0x3f2504);}return _0x3b9f37[_0xf0ba('0x22')]();};}function saveUpdates(_0x2d15c4,_0x446a91){return function(_0xb744db){if(_0xb744db){return _0xb744db['update'](_0x2d15c4)[_0xf0ba('0x23')](function(_0x5df393){return _0x5df393;});}return null;};}function removeEntity(_0x13e1a3,_0x4bb859){return function(_0x46b136){if(_0x46b136){return _0x46b136[_0xf0ba('0x24')]()[_0xf0ba('0x23')](function(){_0x13e1a3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x405b7f,_0x3be72b){return function(_0x1d7edf){if(!_0x1d7edf){_0x405b7f[_0xf0ba('0x25')](0x194);}return _0x1d7edf;};}function handleError(_0x17eec0,_0x406ef5){_0x406ef5=_0x406ef5||0x1f4;return function(_0x5122ba){logger[_0xf0ba('0x26')](_0x5122ba[_0xf0ba('0x27')]);if(_0x5122ba[_0xf0ba('0x28')]){delete _0x5122ba[_0xf0ba('0x28')];}_0x17eec0[_0xf0ba('0x1a')](_0x406ef5)[_0xf0ba('0x29')](_0x5122ba);};}exports[_0xf0ba('0x2a')]=function(_0x56e936,_0x461e14){var _0x1f3041={},_0x517b8e={},_0x5416ff={'count':0x0,'rows':[]};var _0x1cd229=_['map'](db[_0xf0ba('0x2b')][_0xf0ba('0x2c')],function(_0x4ccdf8){return{'name':_0x4ccdf8[_0xf0ba('0x2d')],'type':_0x4ccdf8[_0xf0ba('0x2e')][_0xf0ba('0x2f')]};});_0x517b8e[_0xf0ba('0x30')]=_['map'](_0x1cd229,_0xf0ba('0x28'));_0x517b8e['query']=_[_0xf0ba('0x31')](_0x56e936[_0xf0ba('0x32')]);_0x517b8e[_0xf0ba('0x33')]=_[_0xf0ba('0x34')](_0x517b8e[_0xf0ba('0x30')],_0x517b8e[_0xf0ba('0x32')]);_0x1f3041[_0xf0ba('0x35')]=_[_0xf0ba('0x34')](_0x517b8e['model'],qs[_0xf0ba('0x36')](_0x56e936[_0xf0ba('0x32')][_0xf0ba('0x36')]));_0x1f3041[_0xf0ba('0x35')]=_0x1f3041['attributes']['length']?_0x1f3041[_0xf0ba('0x35')]:_0x517b8e['model'];if(!_0x56e936[_0xf0ba('0x32')][_0xf0ba('0x37')](_0xf0ba('0x38'))){_0x1f3041[_0xf0ba('0x1d')]=qs['limit'](_0x56e936[_0xf0ba('0x32')][_0xf0ba('0x1d')]);_0x1f3041[_0xf0ba('0x1c')]=qs[_0xf0ba('0x1c')](_0x56e936[_0xf0ba('0x32')][_0xf0ba('0x1c')]);}_0x1f3041[_0xf0ba('0x39')]=qs['sort'](_0x56e936[_0xf0ba('0x32')][_0xf0ba('0x3a')]);_0x1f3041['where']=qs[_0xf0ba('0x33')](_[_0xf0ba('0x3b')](_0x56e936[_0xf0ba('0x32')],_0x517b8e[_0xf0ba('0x33')]),_0x1cd229);if(_0x56e936[_0xf0ba('0x32')][_0xf0ba('0x3c')]){_0x1f3041[_0xf0ba('0x3d')]=_['merge'](_0x1f3041['where'],{'$or':_[_0xf0ba('0x3e')](_0x1cd229,function(_0x29dc9c){if(_0x29dc9c['type']!==_0xf0ba('0x3f')){var _0x282fbf={};_0x282fbf[_0x29dc9c[_0xf0ba('0x28')]]={'$like':'%'+_0x56e936[_0xf0ba('0x32')][_0xf0ba('0x3c')]+'%'};return _0x282fbf;}})});}_0x1f3041=_[_0xf0ba('0x40')]({},_0x1f3041,_0x56e936[_0xf0ba('0x41')]);var _0xf20ac={'where':_0x1f3041['where']};return db[_0xf0ba('0x2b')][_0xf0ba('0x1b')](_0xf20ac)[_0xf0ba('0x23')](function(_0x20cc88){_0x5416ff[_0xf0ba('0x1b')]=_0x20cc88;if(_0x56e936[_0xf0ba('0x32')][_0xf0ba('0x42')]){_0x1f3041[_0xf0ba('0x43')]=[{'all':!![]}];}return db[_0xf0ba('0x2b')][_0xf0ba('0x44')](_0x1f3041);})[_0xf0ba('0x23')](function(_0x278468){_0x5416ff[_0xf0ba('0x45')]=_0x278468;return _0x5416ff;})[_0xf0ba('0x23')](respondWithFilteredResult(_0x461e14,_0x1f3041))[_0xf0ba('0x46')](handleError(_0x461e14,null));};exports[_0xf0ba('0x47')]=function(_0x47b0af,_0x3d0022){var _0x2c38ee={'raw':![],'where':{'id':_0x47b0af[_0xf0ba('0x48')]['id']}},_0x2d31a7={};_0x2d31a7['model']=_['keys'](db['VoiceAgentReport']['rawAttributes']);_0x2d31a7['query']=_[_0xf0ba('0x31')](_0x47b0af[_0xf0ba('0x32')]);_0x2d31a7[_0xf0ba('0x33')]=_[_0xf0ba('0x34')](_0x2d31a7['model'],_0x2d31a7['query']);_0x2c38ee[_0xf0ba('0x35')]=_['intersection'](_0x2d31a7[_0xf0ba('0x30')],qs[_0xf0ba('0x36')](_0x47b0af[_0xf0ba('0x32')][_0xf0ba('0x36')]));_0x2c38ee[_0xf0ba('0x35')]=_0x2c38ee['attributes']['length']?_0x2c38ee['attributes']:_0x2d31a7[_0xf0ba('0x30')];if(_0x47b0af[_0xf0ba('0x32')][_0xf0ba('0x42')]){_0x2c38ee['include']=[{'all':!![]}];}_0x2c38ee=_[_0xf0ba('0x40')]({},_0x2c38ee,_0x47b0af['options']);return db[_0xf0ba('0x2b')][_0xf0ba('0x49')](_0x2c38ee)[_0xf0ba('0x23')](handleEntityNotFound(_0x3d0022,null))[_0xf0ba('0x23')](respondWithResult(_0x3d0022,null))[_0xf0ba('0x46')](handleError(_0x3d0022,null));};exports[_0xf0ba('0x4a')]=function(_0x613ba5,_0x3d35a4){return db[_0xf0ba('0x2b')][_0xf0ba('0x4a')](_0x613ba5[_0xf0ba('0x4b')],{})[_0xf0ba('0x23')](respondWithResult(_0x3d35a4,0xc9))[_0xf0ba('0x46')](handleError(_0x3d35a4,null));};exports['update']=function(_0x2ce311,_0x252f4a){if(_0x2ce311[_0xf0ba('0x4b')]['id']){delete _0x2ce311[_0xf0ba('0x4b')]['id'];}return db[_0xf0ba('0x2b')][_0xf0ba('0x49')]({'where':{'id':_0x2ce311['params']['id']}})[_0xf0ba('0x23')](handleEntityNotFound(_0x252f4a,null))[_0xf0ba('0x23')](saveUpdates(_0x2ce311[_0xf0ba('0x4b')],null))[_0xf0ba('0x23')](respondWithResult(_0x252f4a,null))[_0xf0ba('0x46')](handleError(_0x252f4a,null));};exports[_0xf0ba('0x24')]=function(_0x31f399,_0x15f07f){return db[_0xf0ba('0x2b')][_0xf0ba('0x49')]({'where':{'id':_0x31f399[_0xf0ba('0x48')]['id']}})[_0xf0ba('0x23')](handleEntityNotFound(_0x15f07f,null))['then'](removeEntity(_0x15f07f,null))[_0xf0ba('0x46')](handleError(_0x15f07f,null));};exports[_0xf0ba('0x4c')]=function(_0x108d4a,_0x2e4680){return db['VoiceAgentReport'][_0xf0ba('0x4c')]()[_0xf0ba('0x23')](respondWithResult(_0x2e4680,null))[_0xf0ba('0x46')](handleError(_0x2e4680,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index a19a2d8..c51b4ac 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 _0x0519=['exports','define','uniqueid','destuniqueid','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x2f28ee,_0x100f4e){var _0x3bedf7=function(_0x258b12){while(--_0x258b12){_0x2f28ee['push'](_0x2f28ee['shift']());}};_0x3bedf7(++_0x100f4e);}(_0x0519,0xa0));var _0x9051=function(_0x34325b,_0x5e5afe){_0x34325b=_0x34325b-0x0;var _0x3da348=_0x0519[_0x34325b];return _0x3da348;};'use strict';var _=require(_0x9051('0x0'));var util=require(_0x9051('0x1'));var logger=require(_0x9051('0x2'))(_0x9051('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9051('0x4'));var fs=require('fs');var path=require(_0x9051('0x5'));var rimraf=require(_0x9051('0x6'));var config=require(_0x9051('0x7'));var attributes=require('./voiceAgentReport.attributes');module[_0x9051('0x8')]=function(_0xf953d2,_0x35931f){return _0xf953d2[_0x9051('0x9')]('VoiceAgentReport',attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x9051('0xa'),_0x9051('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3079=['define','uniqueid','util','../../config/logger','api','moment','request-promise','path','./voiceAgentReport.attributes','exports'];(function(_0x1ea2f6,_0x21cba3){var _0x1a20e5=function(_0x373c44){while(--_0x373c44){_0x1ea2f6['push'](_0x1ea2f6['shift']());}};_0x1a20e5(++_0x21cba3);}(_0x3079,0x110));var _0x9307=function(_0x41141a,_0x378b56){_0x41141a=_0x41141a-0x0;var _0x5622a9=_0x3079[_0x41141a];return _0x5622a9;};'use strict';var _=require('lodash');var util=require(_0x9307('0x0'));var logger=require(_0x9307('0x1'))(_0x9307('0x2'));var moment=require(_0x9307('0x3'));var BPromise=require('bluebird');var rp=require(_0x9307('0x4'));var fs=require('fs');var path=require(_0x9307('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9307('0x6'));module[_0x9307('0x7')]=function(_0x2877af,_0x10c4bc){return _0x2877af[_0x9307('0x8')]('VoiceAgentReport',attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x9307('0x9'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 498c15e..e37f5e5 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 _0x8438=['request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','VoiceAgentReport','create','body','options','CreateVoiceAgentReport','debug','UpdateVoiceAgentReport','update','raw','where','attributes','limit','catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc','jayson/promise','then','info','VoiceAgentReport,\x20%s,\x20%s'];(function(_0x1f2d47,_0x553f32){var _0x46a512=function(_0xe3f200){while(--_0xe3f200){_0x1f2d47['push'](_0x1f2d47['shift']());}};_0x46a512(++_0x553f32);}(_0x8438,0x12b));var _0x8843=function(_0x24c272,_0x1d08fa){_0x24c272=_0x24c272-0x0;var _0x30debd=_0x8438[_0x24c272];return _0x30debd;};'use strict';var _=require(_0x8843('0x0'));var util=require(_0x8843('0x1'));var moment=require(_0x8843('0x2'));var BPromise=require(_0x8843('0x3'));var rs=require(_0x8843('0x4'));var fs=require('fs');var Redis=require(_0x8843('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8843('0x6'));var config=require('../../config/environment');var jayson=require(_0x8843('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19281a,_0x1f5a20,_0x547c85){return new BPromise(function(_0x2a30f1,_0x6aa221){return client['request'](_0x19281a,_0x547c85)[_0x8843('0x8')](function(_0x115a07){logger[_0x8843('0x9')](_0x8843('0xa'),_0x1f5a20,_0x8843('0xb'));logger['debug'](_0x8843('0xc'),_0x1f5a20,'request\x20sent',JSON[_0x8843('0xd')](_0x115a07));if(_0x115a07[_0x8843('0xe')]){if(_0x115a07[_0x8843('0xe')][_0x8843('0xf')]===0x1f4){logger[_0x8843('0xe')](_0x8843('0xa'),_0x1f5a20,_0x115a07[_0x8843('0xe')][_0x8843('0x10')]);return _0x6aa221(_0x115a07[_0x8843('0xe')]['message']);}logger[_0x8843('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x1f5a20,_0x115a07[_0x8843('0xe')][_0x8843('0x10')]);return _0x2a30f1(_0x115a07[_0x8843('0xe')][_0x8843('0x10')]);}else{logger[_0x8843('0x9')](_0x8843('0xa'),_0x1f5a20,'request\x20sent');_0x2a30f1(_0x115a07[_0x8843('0x11')][_0x8843('0x10')]);}})['catch'](function(_0x2b07c5){logger[_0x8843('0xe')](_0x8843('0xa'),_0x1f5a20,_0x2b07c5);_0x6aa221(_0x2b07c5);});});}exports['CreateVoiceAgentReport']=function(_0x3d8138){var _0x9ad105=this;return new Promise(function(_0x2f861b,_0x19bf21){return db[_0x8843('0x12')][_0x8843('0x13')](_0x3d8138[_0x8843('0x14')],{'raw':_0x3d8138[_0x8843('0x15')]?_0x3d8138[_0x8843('0x15')]['raw']===undefined?!![]:![]:!![]})[_0x8843('0x8')](function(_0x122b75){logger[_0x8843('0x9')](_0x8843('0x16'),_0x3d8138);logger[_0x8843('0x17')](_0x8843('0x16'),_0x3d8138,JSON['stringify'](_0x122b75));_0x2f861b(_0x122b75);})['catch'](function(_0x1c7caa){logger[_0x8843('0xe')](_0x8843('0x16'),_0x1c7caa[_0x8843('0x10')],_0x3d8138);_0x19bf21(_0x9ad105[_0x8843('0xe')](0x1f4,_0x1c7caa[_0x8843('0x10')]));});});};exports[_0x8843('0x18')]=function(_0x4b6e6a){var _0xbcd265=this;return new Promise(function(_0x3d9ac9,_0xb1998d){return db[_0x8843('0x12')][_0x8843('0x19')](_0x4b6e6a[_0x8843('0x14')],{'raw':_0x4b6e6a[_0x8843('0x15')]?_0x4b6e6a[_0x8843('0x15')][_0x8843('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b6e6a['options']?_0x4b6e6a['options'][_0x8843('0x1b')]||null:null,'attributes':_0x4b6e6a['options']?_0x4b6e6a[_0x8843('0x15')][_0x8843('0x1c')]||null:null,'limit':_0x4b6e6a[_0x8843('0x15')]?_0x4b6e6a['options'][_0x8843('0x1d')]||null:null})[_0x8843('0x8')](function(_0x1b4c49){logger[_0x8843('0x9')]('UpdateVoiceAgentReport',_0x4b6e6a);logger[_0x8843('0x17')]('UpdateVoiceAgentReport',_0x4b6e6a,JSON['stringify'](_0x1b4c49));_0x3d9ac9(_0x1b4c49);})[_0x8843('0x1e')](function(_0x138a69){logger[_0x8843('0xe')]('UpdateVoiceAgentReport',_0x138a69['message'],_0x4b6e6a);_0xb1998d(_0xbcd265['error'](0x1f4,_0x138a69[_0x8843('0x10')]));});});}; \ No newline at end of file +var _0x19cc=['debug','request\x20sent','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','info','limit','UpdateVoiceAgentReport','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x503950,_0x5022eb){var _0x1657a9=function(_0x4c1e8f){while(--_0x4c1e8f){_0x503950['push'](_0x503950['shift']());}};_0x1657a9(++_0x5022eb);}(_0x19cc,0x1f1));var _0xc19c=function(_0x2a67fe,_0x295c09){_0x2a67fe=_0x2a67fe-0x0;var _0x57e726=_0x19cc[_0x2a67fe];return _0x57e726;};'use strict';var _=require(_0xc19c('0x0'));var util=require('util');var moment=require(_0xc19c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc19c('0x2'));var db=require(_0xc19c('0x3'))['db'];var utils=require(_0xc19c('0x4'));var logger=require(_0xc19c('0x5'))(_0xc19c('0x6'));var config=require(_0xc19c('0x7'));var jayson=require(_0xc19c('0x8'));var client=jayson[_0xc19c('0x9')][_0xc19c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x358743,_0x442b69,_0x2e4301){return new BPromise(function(_0x56beba,_0x2e33b5){return client[_0xc19c('0xb')](_0x358743,_0x2e4301)[_0xc19c('0xc')](function(_0x4bc3c9){logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0x442b69,'request\x20sent');logger[_0xc19c('0xd')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x442b69,_0xc19c('0xe'),JSON[_0xc19c('0xf')](_0x4bc3c9));if(_0x4bc3c9[_0xc19c('0x10')]){if(_0x4bc3c9[_0xc19c('0x10')][_0xc19c('0x11')]===0x1f4){logger[_0xc19c('0x10')](_0xc19c('0x12'),_0x442b69,_0x4bc3c9[_0xc19c('0x10')][_0xc19c('0x13')]);return _0x2e33b5(_0x4bc3c9[_0xc19c('0x10')][_0xc19c('0x13')]);}logger[_0xc19c('0x10')](_0xc19c('0x12'),_0x442b69,_0x4bc3c9[_0xc19c('0x10')][_0xc19c('0x13')]);return _0x56beba(_0x4bc3c9[_0xc19c('0x10')]['message']);}else{logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0x442b69,'request\x20sent');_0x56beba(_0x4bc3c9['result']['message']);}})[_0xc19c('0x14')](function(_0x56c10c){logger[_0xc19c('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x442b69,_0x56c10c);_0x2e33b5(_0x56c10c);});});}exports[_0xc19c('0x15')]=function(_0x422dd9){var _0x39d663=this;return new Promise(function(_0x1aa797,_0x5c3c4a){return db[_0xc19c('0x16')][_0xc19c('0x17')](_0x422dd9[_0xc19c('0x18')],{'raw':_0x422dd9[_0xc19c('0x19')]?_0x422dd9[_0xc19c('0x19')][_0xc19c('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x252172){logger[_0xc19c('0x1b')](_0xc19c('0x15'),_0x422dd9);logger['debug'](_0xc19c('0x15'),_0x422dd9,JSON['stringify'](_0x252172));_0x1aa797(_0x252172);})[_0xc19c('0x14')](function(_0x25e338){logger[_0xc19c('0x10')]('CreateVoiceAgentReport',_0x25e338[_0xc19c('0x13')],_0x422dd9);_0x5c3c4a(_0x39d663['error'](0x1f4,_0x25e338[_0xc19c('0x13')]));});});};exports['UpdateVoiceAgentReport']=function(_0x401e94){var _0x94b8a1=this;return new Promise(function(_0x20b94c,_0x200d26){return db[_0xc19c('0x16')]['update'](_0x401e94[_0xc19c('0x18')],{'raw':_0x401e94[_0xc19c('0x19')]?_0x401e94[_0xc19c('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x401e94[_0xc19c('0x19')]?_0x401e94[_0xc19c('0x19')]['where']||null:null,'attributes':_0x401e94[_0xc19c('0x19')]?_0x401e94['options']['attributes']||null:null,'limit':_0x401e94[_0xc19c('0x19')]?_0x401e94[_0xc19c('0x19')][_0xc19c('0x1c')]||null:null})['then'](function(_0x25f167){logger['info'](_0xc19c('0x1d'),_0x401e94);logger[_0xc19c('0xd')]('UpdateVoiceAgentReport',_0x401e94,JSON[_0xc19c('0xf')](_0x25f167));_0x20b94c(_0x25f167);})[_0xc19c('0x14')](function(_0xbb9021){logger[_0xc19c('0x10')](_0xc19c('0x1d'),_0xbb9021['message'],_0x401e94);_0x200d26(_0x94b8a1[_0xc19c('0x10')](0x1f4,_0xbb9021[_0xc19c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 4b92b53..a238d59 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 _0x70c2=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','put','update','delete','destroy','exports','util','path'];(function(_0x1ac120,_0x3e7e45){var _0x19b703=function(_0x5f32cb){while(--_0x5f32cb){_0x1ac120['push'](_0x1ac120['shift']());}};_0x19b703(++_0x3e7e45);}(_0x70c2,0x67));var _0x270c=function(_0x760e49,_0x11daff){_0x760e49=_0x760e49-0x0;var _0x564b9d=_0x70c2[_0x760e49];return _0x564b9d;};'use strict';var multer=require('multer');var util=require(_0x270c('0x0'));var path=require(_0x270c('0x1'));var timeout=require(_0x270c('0x2'));var express=require(_0x270c('0x3'));var router=express[_0x270c('0x4')]();var auth=require(_0x270c('0x5'));var interaction=require(_0x270c('0x6'));var config=require(_0x270c('0x7'));var controller=require(_0x270c('0x8'));router[_0x270c('0x9')]('/',auth[_0x270c('0xa')](),controller['index']);router[_0x270c('0x9')](_0x270c('0xb'),auth[_0x270c('0xa')](),controller[_0x270c('0xc')]);router['get'](_0x270c('0xd'),auth[_0x270c('0xa')](),controller[_0x270c('0xe')]);router[_0x270c('0xf')]('/',auth[_0x270c('0xa')](),controller['create']);router[_0x270c('0x10')](_0x270c('0xd'),auth[_0x270c('0xa')](),controller[_0x270c('0x11')]);router[_0x270c('0x12')](_0x270c('0xd'),auth[_0x270c('0xa')](),controller[_0x270c('0x13')]);module[_0x270c('0x14')]=router; \ No newline at end of file +var _0x9ab1=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceCallReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','delete','destroy'];(function(_0x4be18a,_0x326e6d){var _0x5042d4=function(_0x3f6157){while(--_0x3f6157){_0x4be18a['push'](_0x4be18a['shift']());}};_0x5042d4(++_0x326e6d);}(_0x9ab1,0x1c3));var _0x19ab=function(_0x8ec62c,_0x54be7c){_0x8ec62c=_0x8ec62c-0x0;var _0x43bbf9=_0x9ab1[_0x8ec62c];return _0x43bbf9;};'use strict';var multer=require(_0x19ab('0x0'));var util=require('util');var path=require(_0x19ab('0x1'));var timeout=require(_0x19ab('0x2'));var express=require(_0x19ab('0x3'));var router=express[_0x19ab('0x4')]();var auth=require(_0x19ab('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x19ab('0x6'));var controller=require(_0x19ab('0x7'));router[_0x19ab('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x19ab('0x9'),auth[_0x19ab('0xa')](),controller[_0x19ab('0xb')]);router[_0x19ab('0x8')](_0x19ab('0xc'),auth['isAuthenticated'](),controller[_0x19ab('0xd')]);router[_0x19ab('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x19ab('0xc'),auth[_0x19ab('0xa')](),controller['update']);router[_0x19ab('0xf')](_0x19ab('0xc'),auth[_0x19ab('0xa')](),controller[_0x19ab('0x10')]);module[_0x19ab('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 0e1568b..d3df4db 100644 --- a/server/api/voiceCallReport/voiceCallReport.attributes.js +++ b/server/api/voiceCallReport/voiceCallReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['ENUM','internal','outbound','inbound-fax','outbound-fax','DATE','INTEGER','sequelize','exports','STRING'];(function(_0x55caf1,_0x4a1c35){var _0x47c7d5=function(_0x283072){while(--_0x283072){_0x55caf1['push'](_0x55caf1['shift']());}};_0x47c7d5(++_0x4a1c35);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')]},'type':{'type':Sequelize[_0x7995('0x3')]('inbound',_0x7995('0x4'),_0x7995('0x5'),_0x7995('0x6'),_0x7995('0x7'),'dialer')},'tag':{'type':Sequelize[_0x7995('0x2')]},'accountcode':{'type':Sequelize[_0x7995('0x2')]},'source':{'type':Sequelize[_0x7995('0x2')]},'destination':{'type':Sequelize[_0x7995('0x2')]},'destinationcontext':{'type':Sequelize[_0x7995('0x2')]},'callerid':{'type':Sequelize[_0x7995('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x7995('0x2')]},'lastapplication':{'type':Sequelize[_0x7995('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x7995('0x8')]},'systemanswertime':{'type':Sequelize[_0x7995('0x8')]},'answertime':{'type':Sequelize[_0x7995('0x8')]},'endtime':{'type':Sequelize[_0x7995('0x8')]},'duration':{'type':Sequelize[_0x7995('0x9')]},'billableseconds':{'type':Sequelize[_0x7995('0x9')]},'mohtime':{'type':Sequelize[_0x7995('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x7995('0x2')]},'userfield':{'type':Sequelize[_0x7995('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7995('0x2')]},'prefix':{'type':Sequelize[_0x7995('0x2')]},'routeid':{'type':Sequelize[_0x7995('0x9')]},'sipcallid':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0xa9e0=['dialer','DATE','INTEGER','sequelize','exports','STRING','internal','inbound-fax','outbound-fax'];(function(_0x2d8fdb,_0x30e70c){var _0x3bc1c2=function(_0x592716){while(--_0x592716){_0x2d8fdb['push'](_0x2d8fdb['shift']());}};_0x3bc1c2(++_0x30e70c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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 795d412..97ac59b 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 _0x8fbc=['bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','Content-Range','apply','reject','save','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','VIRTUAL','options','count','then','includeAll','include','fullname','User','VoiceCallReport','findAll','show','params','find','catch','create','body','describe','update','uniqueid','user','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0x8fbc,0xf3));var _0xc8fb=function(_0x1ddd84,_0x1edaba){_0x1ddd84=_0x1ddd84-0x0;var _0x48b212=_0x8fbc[_0x1ddd84];return _0x48b212;};'use strict';var pdf=require(_0xc8fb('0x0'));var emlformat=require(_0xc8fb('0x1'));var rimraf=require(_0xc8fb('0x2'));var zipdir=require(_0xc8fb('0x3'));var jsonpatch=require(_0xc8fb('0x4'));var rp=require(_0xc8fb('0x5'));var moment=require('moment');var BPromise=require(_0xc8fb('0x6'));var Mustache=require('mustache');var util=require(_0xc8fb('0x7'));var path=require(_0xc8fb('0x8'));var sox=require(_0xc8fb('0x9'));var csv=require(_0xc8fb('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc8fb('0xb'));var squel=require(_0xc8fb('0xc'));var crypto=require(_0xc8fb('0xd'));var jsforce=require(_0xc8fb('0xe'));var deskjs=require(_0xc8fb('0xf'));var toCsv=require(_0xc8fb('0xa'));var querystring=require(_0xc8fb('0x10'));var Papa=require(_0xc8fb('0x11'));var Redis=require(_0xc8fb('0x12'));var authService=require(_0xc8fb('0x13'));var qs=require(_0xc8fb('0x14'));var as=require(_0xc8fb('0x15'));var hardwareService=require(_0xc8fb('0x16'));var logger=require(_0xc8fb('0x17'))(_0xc8fb('0x18'));var utils=require(_0xc8fb('0x19'));var config=require('../../config/environment');var db=require(_0xc8fb('0x1a'))['db'];function respondWithStatusCode(_0x366af7,_0x4f1684){_0x4f1684=_0x4f1684||0xcc;return function(_0x4d7617){if(_0x4d7617){return _0x366af7[_0xc8fb('0x1b')](_0x4f1684);}return _0x366af7[_0xc8fb('0x1c')](_0x4f1684)['end']();};}function respondWithResult(_0x4c560f,_0x236d98){_0x236d98=_0x236d98||0xc8;return function(_0x52ff5c){if(_0x52ff5c){return _0x4c560f['status'](_0x236d98)[_0xc8fb('0x1d')](_0x52ff5c);}};}function respondWithFilteredResult(_0x1bff83,_0x353dde){return function(_0x4e5aa2){if(_0x4e5aa2){var _0x4e2990=_0x4e5aa2['count'],_0x1de2fd=_0x353dde['offset'],_0x36b740=_0x353dde[_0xc8fb('0x1e')]+_0x353dde['limit'],_0x4903cf;if(_0x36b740>=_0x4e2990){_0x36b740=_0x4e2990;_0x4903cf=0xc8;}else{_0x4903cf=0xce;}_0x1bff83[_0xc8fb('0x1c')](_0x4903cf);return _0x1bff83['set'](_0xc8fb('0x1f'),_0x1de2fd+'-'+_0x36b740+'/'+_0x4e2990)[_0xc8fb('0x1d')](_0x4e5aa2);}return null;};}function patchUpdates(_0x15a7fa){return function(_0x47b951){try{jsonpatch[_0xc8fb('0x20')](_0x47b951,_0x15a7fa,!![]);}catch(_0xa60a7f){return BPromise[_0xc8fb('0x21')](_0xa60a7f);}return _0x47b951[_0xc8fb('0x22')]();};}function saveUpdates(_0x28d8e1,_0x4c0383){return function(_0x4a00d1){if(_0x4a00d1){return _0x4a00d1['update'](_0x28d8e1)['then'](function(_0x54f72d){return _0x54f72d;});}return null;};}function removeEntity(_0xbd4529,_0x4d0fc9){return function(_0x1d866b){if(_0x1d866b){return _0x1d866b[_0xc8fb('0x23')]()['then'](function(){_0xbd4529[_0xc8fb('0x1c')](0xcc)[_0xc8fb('0x24')]();});}};}function handleEntityNotFound(_0x1b0b65,_0x38c84b){return function(_0x58e2e4){if(!_0x58e2e4){_0x1b0b65[_0xc8fb('0x1b')](0x194);}return _0x58e2e4;};}function handleError(_0x752c77,_0x5912ac){_0x5912ac=_0x5912ac||0x1f4;return function(_0x4991e8){logger[_0xc8fb('0x25')](_0x4991e8[_0xc8fb('0x26')]);if(_0x4991e8[_0xc8fb('0x27')]){delete _0x4991e8['name'];}_0x752c77[_0xc8fb('0x1c')](_0x5912ac)[_0xc8fb('0x28')](_0x4991e8);};}exports[_0xc8fb('0x29')]=function(_0x2fc21c,_0x31e719){var _0x45a001={},_0x26fcbe={},_0x4e6c42={'count':0x0,'rows':[]};var _0x263209=_[_0xc8fb('0x2a')](db['VoiceCallReport'][_0xc8fb('0x2b')],function(_0x4a945c){return{'name':_0x4a945c[_0xc8fb('0x2c')],'type':_0x4a945c[_0xc8fb('0x2d')][_0xc8fb('0x2e')]};});_0x26fcbe[_0xc8fb('0x2f')]=_['map'](_0x263209,_0xc8fb('0x27'));_0x26fcbe['query']=_[_0xc8fb('0x30')](_0x2fc21c[_0xc8fb('0x31')]);_0x26fcbe['filters']=_[_0xc8fb('0x32')](_0x26fcbe['model'],_0x26fcbe['query']);_0x45a001[_0xc8fb('0x33')]=_[_0xc8fb('0x32')](_0x26fcbe[_0xc8fb('0x2f')],qs[_0xc8fb('0x34')](_0x2fc21c['query'][_0xc8fb('0x34')]));_0x45a001[_0xc8fb('0x33')]=_0x45a001[_0xc8fb('0x33')][_0xc8fb('0x35')]?_0x45a001[_0xc8fb('0x33')]:_0x26fcbe[_0xc8fb('0x2f')];if(!_0x2fc21c['query'][_0xc8fb('0x36')](_0xc8fb('0x37'))){_0x45a001[_0xc8fb('0x38')]=qs[_0xc8fb('0x38')](_0x2fc21c[_0xc8fb('0x31')]['limit']);_0x45a001[_0xc8fb('0x1e')]=qs[_0xc8fb('0x1e')](_0x2fc21c[_0xc8fb('0x31')][_0xc8fb('0x1e')]);}_0x45a001[_0xc8fb('0x39')]=qs[_0xc8fb('0x3a')](_0x2fc21c[_0xc8fb('0x31')][_0xc8fb('0x3a')]);_0x45a001[_0xc8fb('0x3b')]=qs[_0xc8fb('0x3c')](_['pick'](_0x2fc21c['query'],_0x26fcbe[_0xc8fb('0x3c')]),_0x263209);if(_0x2fc21c[_0xc8fb('0x31')][_0xc8fb('0x3d')]){_0x45a001[_0xc8fb('0x3b')]=_[_0xc8fb('0x3e')](_0x45a001['where'],{'$or':_[_0xc8fb('0x2a')](_0x263209,function(_0x59056f){if(_0x59056f['type']!==_0xc8fb('0x3f')){var _0x106327={};_0x106327[_0x59056f[_0xc8fb('0x27')]]={'$like':'%'+_0x2fc21c[_0xc8fb('0x31')][_0xc8fb('0x3d')]+'%'};return _0x106327;}})});}_0x45a001=_['merge']({},_0x45a001,_0x2fc21c[_0xc8fb('0x40')]);var _0x5223f2={'where':_0x45a001[_0xc8fb('0x3b')]};return db['VoiceCallReport'][_0xc8fb('0x41')](_0x5223f2)[_0xc8fb('0x42')](function(_0x22146e){_0x4e6c42[_0xc8fb('0x41')]=_0x22146e;if(_0x2fc21c[_0xc8fb('0x31')][_0xc8fb('0x43')]){_0x45a001[_0xc8fb('0x44')]=[{'attributes':['id',_0xc8fb('0x27'),_0xc8fb('0x45'),'alias'],'model':db['User'],'as':_0xc8fb('0x46')}];}return db[_0xc8fb('0x47')][_0xc8fb('0x48')](_0x45a001);})[_0xc8fb('0x42')](function(_0x3f24c0){_0x4e6c42['rows']=_0x3f24c0;return _0x4e6c42;})[_0xc8fb('0x42')](respondWithFilteredResult(_0x31e719,_0x45a001))['catch'](handleError(_0x31e719,null));};exports[_0xc8fb('0x49')]=function(_0x4143c5,_0x2f6387){var _0x68b3a1={'raw':!![],'where':{'id':_0x4143c5[_0xc8fb('0x4a')]['id']}},_0x2b2d6a={};_0x2b2d6a[_0xc8fb('0x2f')]=_[_0xc8fb('0x30')](db['VoiceCallReport']['rawAttributes']);_0x2b2d6a[_0xc8fb('0x31')]=_[_0xc8fb('0x30')](_0x4143c5[_0xc8fb('0x31')]);_0x2b2d6a[_0xc8fb('0x3c')]=_[_0xc8fb('0x32')](_0x2b2d6a[_0xc8fb('0x2f')],_0x2b2d6a[_0xc8fb('0x31')]);_0x68b3a1[_0xc8fb('0x33')]=_[_0xc8fb('0x32')](_0x2b2d6a[_0xc8fb('0x2f')],qs[_0xc8fb('0x34')](_0x4143c5['query'][_0xc8fb('0x34')]));_0x68b3a1['attributes']=_0x68b3a1['attributes'][_0xc8fb('0x35')]?_0x68b3a1[_0xc8fb('0x33')]:_0x2b2d6a[_0xc8fb('0x2f')];if(_0x4143c5[_0xc8fb('0x31')][_0xc8fb('0x43')]){_0x68b3a1[_0xc8fb('0x44')]=[{'all':!![]}];}_0x68b3a1=_['merge']({},_0x68b3a1,_0x4143c5[_0xc8fb('0x40')]);return db['VoiceCallReport'][_0xc8fb('0x4b')](_0x68b3a1)[_0xc8fb('0x42')](handleEntityNotFound(_0x2f6387,null))[_0xc8fb('0x42')](respondWithResult(_0x2f6387,null))[_0xc8fb('0x4c')](handleError(_0x2f6387,null));};exports[_0xc8fb('0x4d')]=function(_0x4929c7,_0x4e109b){return db[_0xc8fb('0x47')]['create'](_0x4929c7[_0xc8fb('0x4e')],{})[_0xc8fb('0x42')](respondWithResult(_0x4e109b,0xc9))[_0xc8fb('0x4c')](handleError(_0x4e109b,null));};exports[_0xc8fb('0x23')]=function(_0x4be8b7,_0xa4aef3){return db['VoiceCallReport'][_0xc8fb('0x4b')]({'where':{'id':_0x4be8b7[_0xc8fb('0x4a')]['id']}})[_0xc8fb('0x42')](handleEntityNotFound(_0xa4aef3,null))[_0xc8fb('0x42')](removeEntity(_0xa4aef3,null))[_0xc8fb('0x4c')](handleError(_0xa4aef3,null));};exports[_0xc8fb('0x4f')]=function(_0x2cbc9e,_0x3bdc2c){return db[_0xc8fb('0x47')][_0xc8fb('0x4f')]()[_0xc8fb('0x42')](respondWithResult(_0x3bdc2c,null))[_0xc8fb('0x4c')](handleError(_0x3bdc2c,null));};exports[_0xc8fb('0x50')]=function(_0x45e112,_0x30cf92){if(_0x45e112[_0xc8fb('0x4e')][_0xc8fb('0x51')]){delete _0x45e112[_0xc8fb('0x4e')][_0xc8fb('0x51')];}return db['VoiceCallReport'][_0xc8fb('0x4b')]({'where':{'uniqueid':_0x45e112['params']['id'],'UserId':{'$or':[null,_0x45e112[_0xc8fb('0x52')]['id']]}}})[_0xc8fb('0x42')](handleEntityNotFound(_0x30cf92,null))[_0xc8fb('0x42')](saveUpdates(_0x45e112[_0xc8fb('0x4e')],null))[_0xc8fb('0x42')](respondWithResult(_0x30cf92,null))['catch'](handleError(_0x30cf92,null));}; \ No newline at end of file +var _0x4b9c=['apply','save','update','destroy','then','error','stack','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','sort','where','merge','type','VIRTUAL','options','includeAll','include','alias','User','findAll','catch','create','body','find','params','describe','uniqueid','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range'];(function(_0x3e91a9,_0x53c466){var _0x25c9ad=function(_0x69ee2d){while(--_0x69ee2d){_0x3e91a9['push'](_0x3e91a9['shift']());}};_0x25c9ad(++_0x53c466);}(_0x4b9c,0x10c));var _0xc4b9=function(_0x4b08d9,_0x676186){_0x4b08d9=_0x4b08d9-0x0;var _0x531af3=_0x4b9c[_0x4b08d9];return _0x531af3;};'use strict';var pdf=require(_0xc4b9('0x0'));var emlformat=require(_0xc4b9('0x1'));var rimraf=require(_0xc4b9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc4b9('0x3'));var rp=require(_0xc4b9('0x4'));var moment=require('moment');var BPromise=require(_0xc4b9('0x5'));var Mustache=require(_0xc4b9('0x6'));var util=require('util');var path=require(_0xc4b9('0x7'));var sox=require(_0xc4b9('0x8'));var csv=require(_0xc4b9('0x9'));var ejs=require(_0xc4b9('0xa'));var fs=require('fs');var _=require(_0xc4b9('0xb'));var squel=require(_0xc4b9('0xc'));var crypto=require(_0xc4b9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc4b9('0xe'));var toCsv=require(_0xc4b9('0x9'));var querystring=require('querystring');var Papa=require(_0xc4b9('0xf'));var Redis=require(_0xc4b9('0x10'));var authService=require(_0xc4b9('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc4b9('0x12'));var hardwareService=require(_0xc4b9('0x13'));var logger=require(_0xc4b9('0x14'))(_0xc4b9('0x15'));var utils=require('../../config/utils');var config=require(_0xc4b9('0x16'));var db=require(_0xc4b9('0x17'))['db'];function respondWithStatusCode(_0x56bc79,_0x485c57){_0x485c57=_0x485c57||0xcc;return function(_0x37e41a){if(_0x37e41a){return _0x56bc79[_0xc4b9('0x18')](_0x485c57);}return _0x56bc79['status'](_0x485c57)[_0xc4b9('0x19')]();};}function respondWithResult(_0x2bb28c,_0x3d9443){_0x3d9443=_0x3d9443||0xc8;return function(_0x1d4312){if(_0x1d4312){return _0x2bb28c[_0xc4b9('0x1a')](_0x3d9443)[_0xc4b9('0x1b')](_0x1d4312);}};}function respondWithFilteredResult(_0x3bb2af,_0x3fbe71){return function(_0x42fdc9){if(_0x42fdc9){var _0x48433c=_0x42fdc9[_0xc4b9('0x1c')],_0x5c2915=_0x3fbe71[_0xc4b9('0x1d')],_0x73fb7d=_0x3fbe71[_0xc4b9('0x1d')]+_0x3fbe71['limit'],_0x13bf22;if(_0x73fb7d>=_0x48433c){_0x73fb7d=_0x48433c;_0x13bf22=0xc8;}else{_0x13bf22=0xce;}_0x3bb2af[_0xc4b9('0x1a')](_0x13bf22);return _0x3bb2af[_0xc4b9('0x1e')](_0xc4b9('0x1f'),_0x5c2915+'-'+_0x73fb7d+'/'+_0x48433c)[_0xc4b9('0x1b')](_0x42fdc9);}return null;};}function patchUpdates(_0x35beaf){return function(_0x4f928a){try{jsonpatch[_0xc4b9('0x20')](_0x4f928a,_0x35beaf,!![]);}catch(_0x2089af){return BPromise['reject'](_0x2089af);}return _0x4f928a[_0xc4b9('0x21')]();};}function saveUpdates(_0x46608f,_0x4c3af8){return function(_0x50c7d2){if(_0x50c7d2){return _0x50c7d2[_0xc4b9('0x22')](_0x46608f)['then'](function(_0x50934b){return _0x50934b;});}return null;};}function removeEntity(_0x54998b,_0xf1a76d){return function(_0x1a47aa){if(_0x1a47aa){return _0x1a47aa[_0xc4b9('0x23')]()[_0xc4b9('0x24')](function(){_0x54998b[_0xc4b9('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cdfbf,_0x2e54e3){return function(_0x5ee9cf){if(!_0x5ee9cf){_0x4cdfbf[_0xc4b9('0x18')](0x194);}return _0x5ee9cf;};}function handleError(_0x6f186a,_0x4bc52f){_0x4bc52f=_0x4bc52f||0x1f4;return function(_0x197725){logger[_0xc4b9('0x25')](_0x197725[_0xc4b9('0x26')]);if(_0x197725['name']){delete _0x197725[_0xc4b9('0x27')];}_0x6f186a[_0xc4b9('0x1a')](_0x4bc52f)[_0xc4b9('0x28')](_0x197725);};}exports[_0xc4b9('0x29')]=function(_0x3f05f1,_0x5318fc){var _0x184056={},_0x407630={},_0x11fe9d={'count':0x0,'rows':[]};var _0x3052b1=_[_0xc4b9('0x2a')](db[_0xc4b9('0x2b')][_0xc4b9('0x2c')],function(_0x3ee1d2){return{'name':_0x3ee1d2[_0xc4b9('0x2d')],'type':_0x3ee1d2['type'][_0xc4b9('0x2e')]};});_0x407630['model']=_[_0xc4b9('0x2a')](_0x3052b1,_0xc4b9('0x27'));_0x407630[_0xc4b9('0x2f')]=_[_0xc4b9('0x30')](_0x3f05f1[_0xc4b9('0x2f')]);_0x407630[_0xc4b9('0x31')]=_[_0xc4b9('0x32')](_0x407630[_0xc4b9('0x33')],_0x407630['query']);_0x184056['attributes']=_[_0xc4b9('0x32')](_0x407630[_0xc4b9('0x33')],qs[_0xc4b9('0x34')](_0x3f05f1[_0xc4b9('0x2f')][_0xc4b9('0x34')]));_0x184056[_0xc4b9('0x35')]=_0x184056[_0xc4b9('0x35')][_0xc4b9('0x36')]?_0x184056[_0xc4b9('0x35')]:_0x407630[_0xc4b9('0x33')];if(!_0x3f05f1[_0xc4b9('0x2f')][_0xc4b9('0x37')]('nolimit')){_0x184056[_0xc4b9('0x38')]=qs[_0xc4b9('0x38')](_0x3f05f1[_0xc4b9('0x2f')][_0xc4b9('0x38')]);_0x184056[_0xc4b9('0x1d')]=qs[_0xc4b9('0x1d')](_0x3f05f1['query'][_0xc4b9('0x1d')]);}_0x184056['order']=qs[_0xc4b9('0x39')](_0x3f05f1[_0xc4b9('0x2f')][_0xc4b9('0x39')]);_0x184056['where']=qs[_0xc4b9('0x31')](_['pick'](_0x3f05f1[_0xc4b9('0x2f')],_0x407630[_0xc4b9('0x31')]),_0x3052b1);if(_0x3f05f1[_0xc4b9('0x2f')]['filter']){_0x184056[_0xc4b9('0x3a')]=_[_0xc4b9('0x3b')](_0x184056[_0xc4b9('0x3a')],{'$or':_[_0xc4b9('0x2a')](_0x3052b1,function(_0x1bbf33){if(_0x1bbf33[_0xc4b9('0x3c')]!==_0xc4b9('0x3d')){var _0x15b4b6={};_0x15b4b6[_0x1bbf33[_0xc4b9('0x27')]]={'$like':'%'+_0x3f05f1[_0xc4b9('0x2f')]['filter']+'%'};return _0x15b4b6;}})});}_0x184056=_['merge']({},_0x184056,_0x3f05f1[_0xc4b9('0x3e')]);var _0x5279b9={'where':_0x184056[_0xc4b9('0x3a')]};return db[_0xc4b9('0x2b')][_0xc4b9('0x1c')](_0x5279b9)[_0xc4b9('0x24')](function(_0xa7b7e2){_0x11fe9d[_0xc4b9('0x1c')]=_0xa7b7e2;if(_0x3f05f1['query'][_0xc4b9('0x3f')]){_0x184056[_0xc4b9('0x40')]=[{'attributes':['id',_0xc4b9('0x27'),'fullname',_0xc4b9('0x41')],'model':db['User'],'as':_0xc4b9('0x42')}];}return db[_0xc4b9('0x2b')][_0xc4b9('0x43')](_0x184056);})[_0xc4b9('0x24')](function(_0x103ee1){_0x11fe9d['rows']=_0x103ee1;return _0x11fe9d;})[_0xc4b9('0x24')](respondWithFilteredResult(_0x5318fc,_0x184056))[_0xc4b9('0x44')](handleError(_0x5318fc,null));};exports['show']=function(_0x203f72,_0xf4c060){var _0x16feb3={'raw':!![],'where':{'id':_0x203f72['params']['id']}},_0x4af42e={};_0x4af42e[_0xc4b9('0x33')]=_[_0xc4b9('0x30')](db[_0xc4b9('0x2b')][_0xc4b9('0x2c')]);_0x4af42e[_0xc4b9('0x2f')]=_['keys'](_0x203f72['query']);_0x4af42e[_0xc4b9('0x31')]=_[_0xc4b9('0x32')](_0x4af42e[_0xc4b9('0x33')],_0x4af42e[_0xc4b9('0x2f')]);_0x16feb3[_0xc4b9('0x35')]=_[_0xc4b9('0x32')](_0x4af42e[_0xc4b9('0x33')],qs['fields'](_0x203f72['query'][_0xc4b9('0x34')]));_0x16feb3[_0xc4b9('0x35')]=_0x16feb3['attributes'][_0xc4b9('0x36')]?_0x16feb3['attributes']:_0x4af42e[_0xc4b9('0x33')];if(_0x203f72[_0xc4b9('0x2f')][_0xc4b9('0x3f')]){_0x16feb3[_0xc4b9('0x40')]=[{'all':!![]}];}_0x16feb3=_['merge']({},_0x16feb3,_0x203f72[_0xc4b9('0x3e')]);return db[_0xc4b9('0x2b')]['find'](_0x16feb3)[_0xc4b9('0x24')](handleEntityNotFound(_0xf4c060,null))[_0xc4b9('0x24')](respondWithResult(_0xf4c060,null))[_0xc4b9('0x44')](handleError(_0xf4c060,null));};exports[_0xc4b9('0x45')]=function(_0x45b581,_0x158aaf){return db[_0xc4b9('0x2b')]['create'](_0x45b581[_0xc4b9('0x46')],{})['then'](respondWithResult(_0x158aaf,0xc9))[_0xc4b9('0x44')](handleError(_0x158aaf,null));};exports[_0xc4b9('0x23')]=function(_0x5e7b61,_0x4d245b){return db[_0xc4b9('0x2b')][_0xc4b9('0x47')]({'where':{'id':_0x5e7b61[_0xc4b9('0x48')]['id']}})[_0xc4b9('0x24')](handleEntityNotFound(_0x4d245b,null))['then'](removeEntity(_0x4d245b,null))['catch'](handleError(_0x4d245b,null));};exports[_0xc4b9('0x49')]=function(_0x5506b8,_0x58117d){return db[_0xc4b9('0x2b')][_0xc4b9('0x49')]()[_0xc4b9('0x24')](respondWithResult(_0x58117d,null))[_0xc4b9('0x44')](handleError(_0x58117d,null));};exports[_0xc4b9('0x22')]=function(_0x4fd93f,_0x55aa50){if(_0x4fd93f[_0xc4b9('0x46')][_0xc4b9('0x4a')]){delete _0x4fd93f[_0xc4b9('0x46')][_0xc4b9('0x4a')];}return db[_0xc4b9('0x2b')][_0xc4b9('0x47')]({'where':{'uniqueid':_0x4fd93f['params']['id'],'UserId':{'$or':[null,_0x4fd93f['user']['id']]}}})[_0xc4b9('0x24')](handleEntityNotFound(_0x55aa50,null))[_0xc4b9('0x24')](saveUpdates(_0x4fd93f[_0xc4b9('0x46')],null))[_0xc4b9('0x24')](respondWithResult(_0x55aa50,null))[_0xc4b9('0x44')](handleError(_0x55aa50,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 6595949..ddb4d8b 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 _0xd900=['uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','define','report_call'];(function(_0x2ea461,_0x1db7ec){var _0xacc818=function(_0xe1a57f){while(--_0xe1a57f){_0x2ea461['push'](_0x2ea461['shift']());}};_0xacc818(++_0x1db7ec);}(_0xd900,0x112));var _0x0d90=function(_0x343308,_0x500535){_0x343308=_0x343308-0x0;var _0x1504f1=_0xd900[_0x343308];return _0x1504f1;};'use strict';var _=require(_0x0d90('0x0'));var util=require('util');var logger=require(_0x0d90('0x1'))(_0x0d90('0x2'));var moment=require(_0x0d90('0x3'));var BPromise=require(_0x0d90('0x4'));var rp=require(_0x0d90('0x5'));var fs=require('fs');var path=require(_0x0d90('0x6'));var rimraf=require(_0x0d90('0x7'));var config=require(_0x0d90('0x8'));var attributes=require(_0x0d90('0x9'));module['exports']=function(_0x1adf1e,_0x879281){return _0x1adf1e[_0x0d90('0xa')]('VoiceCallReport',attributes,{'tableName':_0x0d90('0xb'),'paranoid':![],'indexes':[{'fields':[_0x0d90('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5353=['api','moment','bluebird','request-promise','rimraf','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','../../config/logger'];(function(_0x49080e,_0x1243e3){var _0x1f90e2=function(_0x124914){while(--_0x124914){_0x49080e['push'](_0x49080e['shift']());}};_0x1f90e2(++_0x1243e3);}(_0x5353,0x99));var _0x3535=function(_0x43c236,_0x1ed36b){_0x43c236=_0x43c236-0x0;var _0x17addd=_0x5353[_0x43c236];return _0x17addd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3535('0x0'))(_0x3535('0x1'));var moment=require(_0x3535('0x2'));var BPromise=require(_0x3535('0x3'));var rp=require(_0x3535('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3535('0x5'));var config=require('../../config/environment');var attributes=require(_0x3535('0x6'));module[_0x3535('0x7')]=function(_0x5020b3,_0x5b1e57){return _0x5020b3[_0x3535('0x8')](_0x3535('0x9'),attributes,{'tableName':_0x3535('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 033d036..0bba021 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 _0x32d2=['client','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','where','attributes','limit','include','map','model','create','body','raw','CreateVoiceCallReport','stringify','UpdateVoiceCallReport','update','util','bluebird','../../mysqldb','../../config/environment','jayson/promise'];(function(_0x2931a0,_0x4a28c6){var _0x509e62=function(_0x2a8247){while(--_0x2a8247){_0x2931a0['push'](_0x2931a0['shift']());}};_0x509e62(++_0x4a28c6);}(_0x32d2,0x1d7));var _0x232d=function(_0x26351f,_0x1c93e7){_0x26351f=_0x26351f-0x0;var _0x4f2f7c=_0x32d2[_0x26351f];return _0x4f2f7c;};'use strict';var _=require('lodash');var util=require(_0x232d('0x0'));var moment=require('moment');var BPromise=require(_0x232d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x232d('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x232d('0x3'));var jayson=require(_0x232d('0x4'));var client=jayson[_0x232d('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4cd866,_0x4539be,_0xe879bd){return new BPromise(function(_0x2bed10,_0x54e573){return client['request'](_0x4cd866,_0xe879bd)[_0x232d('0x6')](function(_0x2e923a){logger[_0x232d('0x7')](_0x232d('0x8'),_0x4539be,_0x232d('0x9'));logger[_0x232d('0xa')](_0x232d('0xb'),_0x4539be,_0x232d('0x9'),JSON['stringify'](_0x2e923a));if(_0x2e923a['error']){if(_0x2e923a[_0x232d('0xc')][_0x232d('0xd')]===0x1f4){logger['error'](_0x232d('0x8'),_0x4539be,_0x2e923a[_0x232d('0xc')][_0x232d('0xe')]);return _0x54e573(_0x2e923a['error'][_0x232d('0xe')]);}logger[_0x232d('0xc')](_0x232d('0x8'),_0x4539be,_0x2e923a['error']['message']);return _0x2bed10(_0x2e923a['error'][_0x232d('0xe')]);}else{logger[_0x232d('0x7')](_0x232d('0x8'),_0x4539be,'request\x20sent');_0x2bed10(_0x2e923a[_0x232d('0xf')][_0x232d('0xe')]);}})[_0x232d('0x10')](function(_0x321c38){logger[_0x232d('0xc')](_0x232d('0x8'),_0x4539be,_0x321c38);_0x54e573(_0x321c38);});});}exports[_0x232d('0x11')]=function(_0x2aa474){var _0x5e9a9b=this;return new Promise(function(_0x2ed6bd,_0x5cae6c){return db[_0x232d('0x12')][_0x232d('0x13')]({'raw':_0x2aa474[_0x232d('0x14')]?_0x2aa474[_0x232d('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x2aa474['options']?_0x2aa474[_0x232d('0x14')][_0x232d('0x15')]||null:null,'attributes':_0x2aa474[_0x232d('0x14')]?_0x2aa474['options'][_0x232d('0x16')]||null:null,'limit':_0x2aa474[_0x232d('0x14')]?_0x2aa474[_0x232d('0x14')][_0x232d('0x17')]||null:null,'include':_0x2aa474[_0x232d('0x14')]?_0x2aa474[_0x232d('0x14')][_0x232d('0x18')]?_[_0x232d('0x19')](_0x2aa474['options'][_0x232d('0x18')],function(_0x1287cd){return{'model':db[_0x1287cd[_0x232d('0x1a')]],'as':_0x1287cd['as'],'attributes':_0x1287cd[_0x232d('0x16')],'include':_0x1287cd[_0x232d('0x18')]?_[_0x232d('0x19')](_0x1287cd[_0x232d('0x18')],function(_0x4bdc46){return{'model':db[_0x4bdc46[_0x232d('0x1a')]],'as':_0x4bdc46['as'],'attributes':_0x4bdc46[_0x232d('0x16')],'include':_0x4bdc46[_0x232d('0x18')]?_[_0x232d('0x19')](_0x4bdc46['include'],function(_0xd8c670){return{'model':db[_0xd8c670[_0x232d('0x1a')]],'as':_0xd8c670['as'],'attributes':_0xd8c670[_0x232d('0x16')]};}):[]};}):[]};}):[]:[]})[_0x232d('0x6')](function(_0x333ad5){logger[_0x232d('0x7')]('GetVoiceCallReport',_0x2aa474);logger[_0x232d('0xa')](_0x232d('0x11'),_0x2aa474,JSON['stringify'](_0x333ad5));_0x2ed6bd(_0x333ad5);})[_0x232d('0x10')](function(_0x4f757b){logger[_0x232d('0xc')](_0x232d('0x11'),_0x4f757b[_0x232d('0xe')],_0x2aa474);_0x5cae6c(_0x5e9a9b[_0x232d('0xc')](0x1f4,_0x4f757b['message']));});});};exports['CreateVoiceCallReport']=function(_0x4a509b){var _0x5e982d=this;return new Promise(function(_0x4b55aa,_0x43e81e){return db[_0x232d('0x12')][_0x232d('0x1b')](_0x4a509b[_0x232d('0x1c')],{'raw':_0x4a509b[_0x232d('0x14')]?_0x4a509b[_0x232d('0x14')][_0x232d('0x1d')]===undefined?!![]:![]:!![]})[_0x232d('0x6')](function(_0x1c1c54){logger[_0x232d('0x7')](_0x232d('0x1e'),_0x4a509b);logger[_0x232d('0xa')](_0x232d('0x1e'),_0x4a509b,JSON[_0x232d('0x1f')](_0x1c1c54));_0x4b55aa(_0x1c1c54);})[_0x232d('0x10')](function(_0x5f4f6b){logger[_0x232d('0xc')]('CreateVoiceCallReport',_0x5f4f6b[_0x232d('0xe')],_0x4a509b);_0x43e81e(_0x5e982d['error'](0x1f4,_0x5f4f6b[_0x232d('0xe')]));});});};exports[_0x232d('0x20')]=function(_0x5f88f7){var _0x6b66c5=this;return new Promise(function(_0x413df6,_0x8ef785){return db[_0x232d('0x12')][_0x232d('0x21')](_0x5f88f7[_0x232d('0x1c')],{'raw':_0x5f88f7[_0x232d('0x14')]?_0x5f88f7[_0x232d('0x14')][_0x232d('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f88f7['options']?_0x5f88f7[_0x232d('0x14')]['where']||null:null,'attributes':_0x5f88f7[_0x232d('0x14')]?_0x5f88f7[_0x232d('0x14')]['attributes']||null:null,'limit':_0x5f88f7[_0x232d('0x14')]?_0x5f88f7[_0x232d('0x14')]['limit']||null:null})[_0x232d('0x6')](function(_0x2eb27d){logger['info'](_0x232d('0x20'),_0x5f88f7);logger[_0x232d('0xa')](_0x232d('0x20'),_0x5f88f7,JSON[_0x232d('0x1f')](_0x2eb27d));_0x413df6(_0x2eb27d);})[_0x232d('0x10')](function(_0x27f166){logger['error']('UpdateVoiceCallReport',_0x27f166[_0x232d('0xe')],_0x5f88f7);_0x8ef785(_0x6b66c5['error'](0x1f4,_0x27f166[_0x232d('0xe')]));});});}; \ No newline at end of file +var _0xb197=['create','UpdateVoiceCallReport','VoiceCallReport','update','body','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','findAll','options','raw','where','attributes','limit','include','model','map','GetVoiceCallReport','stringify','CreateVoiceCallReport'];(function(_0x2f7d61,_0x20dc7a){var _0x4dd7c2=function(_0x1ea738){while(--_0x1ea738){_0x2f7d61['push'](_0x2f7d61['shift']());}};_0x4dd7c2(++_0x20dc7a);}(_0xb197,0x176));var _0x7b19=function(_0xfc0976,_0x33776f){_0xfc0976=_0xfc0976-0x0;var _0x23579f=_0xb197[_0xfc0976];return _0x23579f;};'use strict';var _=require(_0x7b19('0x0'));var util=require(_0x7b19('0x1'));var moment=require(_0x7b19('0x2'));var BPromise=require(_0x7b19('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7b19('0x4'));var db=require(_0x7b19('0x5'))['db'];var utils=require(_0x7b19('0x6'));var logger=require(_0x7b19('0x7'))(_0x7b19('0x8'));var config=require(_0x7b19('0x9'));var jayson=require(_0x7b19('0xa'));var client=jayson[_0x7b19('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20b522,_0xe6b22,_0x2578db){return new BPromise(function(_0x6a8fa0,_0x450d44){return client[_0x7b19('0xc')](_0x20b522,_0x2578db)[_0x7b19('0xd')](function(_0x5c2318){logger[_0x7b19('0xe')](_0x7b19('0xf'),_0xe6b22,_0x7b19('0x10'));logger[_0x7b19('0x11')](_0x7b19('0x12'),_0xe6b22,'request\x20sent',JSON['stringify'](_0x5c2318));if(_0x5c2318[_0x7b19('0x13')]){if(_0x5c2318[_0x7b19('0x13')][_0x7b19('0x14')]===0x1f4){logger[_0x7b19('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0xe6b22,_0x5c2318[_0x7b19('0x13')][_0x7b19('0x15')]);return _0x450d44(_0x5c2318['error'][_0x7b19('0x15')]);}logger[_0x7b19('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0xe6b22,_0x5c2318['error'][_0x7b19('0x15')]);return _0x6a8fa0(_0x5c2318[_0x7b19('0x13')][_0x7b19('0x15')]);}else{logger['info'](_0x7b19('0xf'),_0xe6b22,_0x7b19('0x10'));_0x6a8fa0(_0x5c2318[_0x7b19('0x16')]['message']);}})[_0x7b19('0x17')](function(_0x2a45bb){logger['error'](_0x7b19('0xf'),_0xe6b22,_0x2a45bb);_0x450d44(_0x2a45bb);});});}exports['GetVoiceCallReport']=function(_0x49f7ef){var _0x20122c=this;return new Promise(function(_0x1af31d,_0x10089c){return db['VoiceCallReport'][_0x7b19('0x18')]({'raw':_0x49f7ef['options']?_0x49f7ef[_0x7b19('0x19')][_0x7b19('0x1a')]===undefined?!![]:![]:!![],'where':_0x49f7ef[_0x7b19('0x19')]?_0x49f7ef[_0x7b19('0x19')][_0x7b19('0x1b')]||null:null,'attributes':_0x49f7ef[_0x7b19('0x19')]?_0x49f7ef['options'][_0x7b19('0x1c')]||null:null,'limit':_0x49f7ef[_0x7b19('0x19')]?_0x49f7ef[_0x7b19('0x19')][_0x7b19('0x1d')]||null:null,'include':_0x49f7ef[_0x7b19('0x19')]?_0x49f7ef['options'][_0x7b19('0x1e')]?_['map'](_0x49f7ef['options'][_0x7b19('0x1e')],function(_0x13ada5){return{'model':db[_0x13ada5[_0x7b19('0x1f')]],'as':_0x13ada5['as'],'attributes':_0x13ada5[_0x7b19('0x1c')],'include':_0x13ada5[_0x7b19('0x1e')]?_['map'](_0x13ada5[_0x7b19('0x1e')],function(_0x51840f){return{'model':db[_0x51840f['model']],'as':_0x51840f['as'],'attributes':_0x51840f['attributes'],'include':_0x51840f['include']?_[_0x7b19('0x20')](_0x51840f[_0x7b19('0x1e')],function(_0x1eefd7){return{'model':db[_0x1eefd7['model']],'as':_0x1eefd7['as'],'attributes':_0x1eefd7[_0x7b19('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x9629d6){logger['info'](_0x7b19('0x21'),_0x49f7ef);logger[_0x7b19('0x11')](_0x7b19('0x21'),_0x49f7ef,JSON[_0x7b19('0x22')](_0x9629d6));_0x1af31d(_0x9629d6);})[_0x7b19('0x17')](function(_0x185614){logger['error'](_0x7b19('0x21'),_0x185614[_0x7b19('0x15')],_0x49f7ef);_0x10089c(_0x20122c[_0x7b19('0x13')](0x1f4,_0x185614[_0x7b19('0x15')]));});});};exports[_0x7b19('0x23')]=function(_0x27e364){var _0x4b9813=this;return new Promise(function(_0x5551e9,_0x1e46ed){return db['VoiceCallReport'][_0x7b19('0x24')](_0x27e364['body'],{'raw':_0x27e364[_0x7b19('0x19')]?_0x27e364[_0x7b19('0x19')][_0x7b19('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x3754c3){logger[_0x7b19('0xe')](_0x7b19('0x23'),_0x27e364);logger[_0x7b19('0x11')]('CreateVoiceCallReport',_0x27e364,JSON[_0x7b19('0x22')](_0x3754c3));_0x5551e9(_0x3754c3);})[_0x7b19('0x17')](function(_0x15e635){logger['error'](_0x7b19('0x23'),_0x15e635[_0x7b19('0x15')],_0x27e364);_0x1e46ed(_0x4b9813['error'](0x1f4,_0x15e635[_0x7b19('0x15')]));});});};exports[_0x7b19('0x25')]=function(_0x192904){var _0x5c5a4c=this;return new Promise(function(_0xe87af3,_0x384e1d){return db[_0x7b19('0x26')][_0x7b19('0x27')](_0x192904[_0x7b19('0x28')],{'raw':_0x192904[_0x7b19('0x19')]?_0x192904['options'][_0x7b19('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x192904[_0x7b19('0x19')]?_0x192904[_0x7b19('0x19')][_0x7b19('0x1b')]||null:null,'attributes':_0x192904[_0x7b19('0x19')]?_0x192904[_0x7b19('0x19')][_0x7b19('0x1c')]||null:null,'limit':_0x192904['options']?_0x192904[_0x7b19('0x19')][_0x7b19('0x1d')]||null:null})[_0x7b19('0xd')](function(_0x3c9b10){logger[_0x7b19('0xe')](_0x7b19('0x25'),_0x192904);logger[_0x7b19('0x11')](_0x7b19('0x25'),_0x192904,JSON[_0x7b19('0x22')](_0x3c9b10));_0xe87af3(_0x3c9b10);})[_0x7b19('0x17')](function(_0x45c974){logger[_0x7b19('0x13')](_0x7b19('0x25'),_0x45c974[_0x7b19('0x15')],_0x192904);_0x384e1d(_0x5c5a4c['error'](0x1f4,_0x45c974[_0x7b19('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 6694633..df0e576 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 _0xc83b=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated','index','/:id','post','put','update','multer'];(function(_0x455dd2,_0x56e6ef){var _0x13d632=function(_0x4f5a00){while(--_0x4f5a00){_0x455dd2['push'](_0x455dd2['shift']());}};_0x13d632(++_0x56e6ef);}(_0xc83b,0xa4));var _0xbc83=function(_0x51d2bb,_0x58e3ad){_0x51d2bb=_0x51d2bb-0x0;var _0xc3d3de=_0xc83b[_0x51d2bb];return _0xc3d3de;};'use strict';var multer=require(_0xbc83('0x0'));var util=require(_0xbc83('0x1'));var path=require(_0xbc83('0x2'));var timeout=require(_0xbc83('0x3'));var express=require('express');var router=express[_0xbc83('0x4')]();var auth=require(_0xbc83('0x5'));var interaction=require(_0xbc83('0x6'));var config=require(_0xbc83('0x7'));var controller=require(_0xbc83('0x8'));router['get']('/',auth[_0xbc83('0x9')](),controller[_0xbc83('0xa')]);router['get'](_0xbc83('0xb'),auth[_0xbc83('0x9')](),controller['show']);router[_0xbc83('0xc')]('/',auth[_0xbc83('0x9')](),controller['create']);router[_0xbc83('0xd')](_0xbc83('0xb'),auth[_0xbc83('0x9')](),controller[_0xbc83('0xe')]);router['delete'](_0xbc83('0xb'),auth[_0xbc83('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4e00=['/:id','post','create','put','update','exports','util','connect-timeout','express','../../components/interaction/service','./voiceChanSpy.controller','get','isAuthenticated','index'];(function(_0x38a6ea,_0x559b75){var _0x2c1a9c=function(_0x584bd0){while(--_0x584bd0){_0x38a6ea['push'](_0x38a6ea['shift']());}};_0x2c1a9c(++_0x559b75);}(_0x4e00,0xa0));var _0x04e0=function(_0x4f35de,_0x46a5be){_0x4f35de=_0x4f35de-0x0;var _0x15fb36=_0x4e00[_0x4f35de];return _0x15fb36;};'use strict';var multer=require('multer');var util=require(_0x04e0('0x0'));var path=require('path');var timeout=require(_0x04e0('0x1'));var express=require(_0x04e0('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x04e0('0x3'));var config=require('../../config/environment');var controller=require(_0x04e0('0x4'));router[_0x04e0('0x5')]('/',auth[_0x04e0('0x6')](),controller[_0x04e0('0x7')]);router[_0x04e0('0x5')](_0x04e0('0x8'),auth[_0x04e0('0x6')](),controller['show']);router[_0x04e0('0x9')]('/',auth[_0x04e0('0x6')](),controller[_0x04e0('0xa')]);router[_0x04e0('0xb')]('/:id',auth[_0x04e0('0x6')](),controller[_0x04e0('0xc')]);router['delete']('/:id',auth[_0x04e0('0x6')](),controller['destroy']);module[_0x04e0('0xd')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index a7f0440..9b53544 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 _0x7192=['options','join','getDataValue','split','BOOLEAN','exports','STRING','name','setDataValue'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0x7192,0xef));var _0x2719=function(_0x4b3312,_0x485b89){_0x4b3312=_0x4b3312-0x0;var _0x4e6ca7=_0x7192[_0x4b3312];return _0x4e6ca7;};'use strict';var Sequelize=require('sequelize');module[_0x2719('0x0')]={'name':{'type':Sequelize[_0x2719('0x1')]},'prefix':{'type':Sequelize[_0x2719('0x1')],'unique':_0x2719('0x2'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x37ab86){this[_0x2719('0x3')](_0x2719('0x4'),_0x37ab86?_0x37ab86[_0x2719('0x5')](''):[]);},'get':function(){return this[_0x2719('0x6')](_0x2719('0x4'))?this[_0x2719('0x6')](_0x2719('0x4'))[_0x2719('0x7')](''):[];}},'auth':{'type':Sequelize[_0x2719('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x2719('0x1')]},'record':{'type':Sequelize[_0x2719('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x2719('0x1')]},'description':{'type':Sequelize[_0x2719('0x1')]}}; \ No newline at end of file +var _0xf629=['split','sequelize','exports','STRING','name','setDataValue','options','join','getDataValue'];(function(_0x151b29,_0x524747){var _0xee5511=function(_0x9cb891){while(--_0x9cb891){_0x151b29['push'](_0x151b29['shift']());}};_0xee5511(++_0x524747);}(_0xf629,0x12a));var _0x9f62=function(_0x1fab0f,_0x3d1df5){_0x1fab0f=_0x1fab0f-0x0;var _0x49956f=_0xf629[_0x1fab0f];return _0x49956f;};'use strict';var Sequelize=require(_0x9f62('0x0'));module[_0x9f62('0x1')]={'name':{'type':Sequelize[_0x9f62('0x2')]},'prefix':{'type':Sequelize[_0x9f62('0x2')],'unique':_0x9f62('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x9f62('0x2')],'set':function(_0x3d770e){this[_0x9f62('0x4')](_0x9f62('0x5'),_0x3d770e?_0x3d770e[_0x9f62('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x9f62('0x5'))?this[_0x9f62('0x7')](_0x9f62('0x5'))[_0x9f62('0x8')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x9f62('0x2')]},'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 ca48806..f5d21f1 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 _0xd752=['lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','apply','reject','update','then','destroy','ChanSpies','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','VoiceChanSpy','includeAll','include','findAll','catch','show','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs'];(function(_0x2b7675,_0x5969c9){var _0x4c4f97=function(_0x233188){while(--_0x233188){_0x2b7675['push'](_0x2b7675['shift']());}};_0x4c4f97(++_0x5969c9);}(_0xd752,0x92));var _0x2d75=function(_0x5bce33,_0x4a4b06){_0x5bce33=_0x5bce33-0x0;var _0x15bc20=_0xd752[_0x5bce33];return _0x15bc20;};'use strict';var pdf=require(_0x2d75('0x0'));var emlformat=require(_0x2d75('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2d75('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2d75('0x3'));var moment=require(_0x2d75('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2d75('0x5'));var path=require(_0x2d75('0x6'));var sox=require(_0x2d75('0x7'));var csv=require(_0x2d75('0x8'));var ejs=require(_0x2d75('0x9'));var fs=require('fs');var _=require(_0x2d75('0xa'));var squel=require('squel');var crypto=require(_0x2d75('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2d75('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2d75('0xd'));var Papa=require(_0x2d75('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2d75('0xf'));var as=require(_0x2d75('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2d75('0x11'))(_0x2d75('0x12'));var utils=require(_0x2d75('0x13'));var config=require(_0x2d75('0x14'));var db=require(_0x2d75('0x15'))['db'];function respondWithStatusCode(_0xb104b5,_0x5dc398){_0x5dc398=_0x5dc398||0xcc;return function(_0x455034){if(_0x455034){return _0xb104b5[_0x2d75('0x16')](_0x5dc398);}return _0xb104b5[_0x2d75('0x17')](_0x5dc398)[_0x2d75('0x18')]();};}function respondWithResult(_0x57690a,_0x59fa5e){_0x59fa5e=_0x59fa5e||0xc8;return function(_0x3cbf44){if(_0x3cbf44){return _0x57690a['status'](_0x59fa5e)['json'](_0x3cbf44);}};}function respondWithFilteredResult(_0x5d0594,_0x241daf){return function(_0x468a93){if(_0x468a93){var _0x400e8c=_0x468a93[_0x2d75('0x19')],_0x108010=_0x241daf[_0x2d75('0x1a')],_0x50407c=_0x241daf[_0x2d75('0x1a')]+_0x241daf[_0x2d75('0x1b')],_0x1190f6;if(_0x50407c>=_0x400e8c){_0x50407c=_0x400e8c;_0x1190f6=0xc8;}else{_0x1190f6=0xce;}_0x5d0594[_0x2d75('0x17')](_0x1190f6);return _0x5d0594['set'](_0x2d75('0x1c'),_0x108010+'-'+_0x50407c+'/'+_0x400e8c)['json'](_0x468a93);}return null;};}function patchUpdates(_0x24df2f){return function(_0x567bf1){try{jsonpatch[_0x2d75('0x1d')](_0x567bf1,_0x24df2f,!![]);}catch(_0xda837f){return BPromise[_0x2d75('0x1e')](_0xda837f);}return _0x567bf1['save']();};}function saveUpdates(_0x21a487,_0x403a72){return function(_0x2deb75){if(_0x2deb75){return _0x2deb75[_0x2d75('0x1f')](_0x21a487)[_0x2d75('0x20')](function(_0x278f17){return _0x278f17;});}return null;};}function removeEntity(_0x3b06d7,_0x36b9c5){return function(_0x1a5ee2){if(_0x1a5ee2){return _0x1a5ee2[_0x2d75('0x21')]()[_0x2d75('0x20')](function(){var _0x52d5d3=_0x1a5ee2['get']({'plain':!![]});var _0x4160a3=_0x2d75('0x22');return db[_0x2d75('0x23')][_0x2d75('0x21')]({'where':{'type':_0x4160a3,'resourceId':_0x52d5d3['id']}})[_0x2d75('0x20')](function(){return _0x1a5ee2;});})[_0x2d75('0x20')](function(){_0x3b06d7[_0x2d75('0x17')](0xcc)[_0x2d75('0x18')]();});}};}function handleEntityNotFound(_0x1559c7,_0x13e198){return function(_0x15e3d9){if(!_0x15e3d9){_0x1559c7[_0x2d75('0x16')](0x194);}return _0x15e3d9;};}function handleError(_0x156e2d,_0x23303a){_0x23303a=_0x23303a||0x1f4;return function(_0x3d2017){logger[_0x2d75('0x24')](_0x3d2017[_0x2d75('0x25')]);if(_0x3d2017['name']){delete _0x3d2017[_0x2d75('0x26')];}_0x156e2d[_0x2d75('0x17')](_0x23303a)[_0x2d75('0x27')](_0x3d2017);};}exports[_0x2d75('0x28')]=function(_0x453447,_0x99152d){var _0x15da9e={},_0x89fc59={},_0x54e488={'count':0x0,'rows':[]};var _0x979050=_[_0x2d75('0x29')](db['VoiceChanSpy'][_0x2d75('0x2a')],function(_0x3a2cf7){return{'name':_0x3a2cf7[_0x2d75('0x2b')],'type':_0x3a2cf7[_0x2d75('0x2c')][_0x2d75('0x2d')]};});_0x89fc59[_0x2d75('0x2e')]=_[_0x2d75('0x29')](_0x979050,_0x2d75('0x26'));_0x89fc59['query']=_['keys'](_0x453447['query']);_0x89fc59[_0x2d75('0x2f')]=_[_0x2d75('0x30')](_0x89fc59['model'],_0x89fc59[_0x2d75('0x31')]);_0x15da9e[_0x2d75('0x32')]=_[_0x2d75('0x30')](_0x89fc59[_0x2d75('0x2e')],qs[_0x2d75('0x33')](_0x453447['query'][_0x2d75('0x33')]));_0x15da9e[_0x2d75('0x32')]=_0x15da9e[_0x2d75('0x32')][_0x2d75('0x34')]?_0x15da9e['attributes']:_0x89fc59[_0x2d75('0x2e')];if(!_0x453447[_0x2d75('0x31')][_0x2d75('0x35')]('nolimit')){_0x15da9e[_0x2d75('0x1b')]=qs[_0x2d75('0x1b')](_0x453447['query'][_0x2d75('0x1b')]);_0x15da9e['offset']=qs['offset'](_0x453447[_0x2d75('0x31')][_0x2d75('0x1a')]);}_0x15da9e[_0x2d75('0x36')]=qs[_0x2d75('0x37')](_0x453447[_0x2d75('0x31')][_0x2d75('0x37')]);_0x15da9e[_0x2d75('0x38')]=qs[_0x2d75('0x2f')](_[_0x2d75('0x39')](_0x453447['query'],_0x89fc59[_0x2d75('0x2f')]),_0x979050);if(_0x453447[_0x2d75('0x31')][_0x2d75('0x3a')]){_0x15da9e[_0x2d75('0x38')]=_[_0x2d75('0x3b')](_0x15da9e[_0x2d75('0x38')],{'$or':_[_0x2d75('0x29')](_0x979050,function(_0x95604f){if(_0x95604f[_0x2d75('0x2c')]!=='VIRTUAL'){var _0xdeac88={};_0xdeac88[_0x95604f[_0x2d75('0x26')]]={'$like':'%'+_0x453447[_0x2d75('0x31')][_0x2d75('0x3a')]+'%'};return _0xdeac88;}})});}_0x15da9e=_[_0x2d75('0x3b')]({},_0x15da9e,_0x453447[_0x2d75('0x3c')]);var _0x16bf0f={'where':_0x15da9e[_0x2d75('0x38')]};return db[_0x2d75('0x3d')][_0x2d75('0x19')](_0x16bf0f)[_0x2d75('0x20')](function(_0x1891e2){_0x54e488[_0x2d75('0x19')]=_0x1891e2;if(_0x453447['query'][_0x2d75('0x3e')]){_0x15da9e[_0x2d75('0x3f')]=[{'all':!![]}];}return db[_0x2d75('0x3d')][_0x2d75('0x40')](_0x15da9e);})[_0x2d75('0x20')](function(_0x32a494){_0x54e488['rows']=_0x32a494;return _0x54e488;})[_0x2d75('0x20')](respondWithFilteredResult(_0x99152d,_0x15da9e))[_0x2d75('0x41')](handleError(_0x99152d,null));};exports[_0x2d75('0x42')]=function(_0x6da36c,_0x16f85e){var _0x626cb2={'raw':![],'where':{'id':_0x6da36c['params']['id']}},_0x50c204={};_0x50c204[_0x2d75('0x2e')]=_[_0x2d75('0x43')](db[_0x2d75('0x3d')][_0x2d75('0x2a')]);_0x50c204[_0x2d75('0x31')]=_[_0x2d75('0x43')](_0x6da36c[_0x2d75('0x31')]);_0x50c204['filters']=_['intersection'](_0x50c204[_0x2d75('0x2e')],_0x50c204['query']);_0x626cb2[_0x2d75('0x32')]=_[_0x2d75('0x30')](_0x50c204[_0x2d75('0x2e')],qs[_0x2d75('0x33')](_0x6da36c[_0x2d75('0x31')][_0x2d75('0x33')]));_0x626cb2[_0x2d75('0x32')]=_0x626cb2['attributes'][_0x2d75('0x34')]?_0x626cb2[_0x2d75('0x32')]:_0x50c204[_0x2d75('0x2e')];if(_0x6da36c['query'][_0x2d75('0x3e')]){_0x626cb2[_0x2d75('0x3f')]=[{'all':!![]}];}_0x626cb2=_[_0x2d75('0x3b')]({},_0x626cb2,_0x6da36c[_0x2d75('0x3c')]);return db['VoiceChanSpy'][_0x2d75('0x44')](_0x626cb2)[_0x2d75('0x20')](handleEntityNotFound(_0x16f85e,null))['then'](respondWithResult(_0x16f85e,null))[_0x2d75('0x41')](handleError(_0x16f85e,null));};exports[_0x2d75('0x45')]=function(_0x2ea0e9,_0x38bb2b){return db[_0x2d75('0x3d')][_0x2d75('0x45')](_0x2ea0e9[_0x2d75('0x46')],{})[_0x2d75('0x20')](function(_0x144240){var _0x5b7446=_0x2ea0e9[_0x2d75('0x47')][_0x2d75('0x48')]({'plain':!![]});if(!_0x5b7446)throw new Error(_0x2d75('0x49'));if(_0x5b7446['role']===_0x2d75('0x47')){var _0x41f0cb=_0x144240[_0x2d75('0x48')]({'plain':!![]});var _0x5a7ae7=_0x2d75('0x22');return db['UserProfileSection'][_0x2d75('0x44')]({'where':{'name':_0x5a7ae7,'userProfileId':_0x5b7446[_0x2d75('0x4a')]},'raw':!![]})[_0x2d75('0x20')](function(_0x36c935){if(_0x36c935&&_0x36c935[_0x2d75('0x4b')]===0x0){return db[_0x2d75('0x23')][_0x2d75('0x45')]({'name':_0x41f0cb[_0x2d75('0x26')],'resourceId':_0x41f0cb['id'],'type':_0x36c935['name'],'sectionId':_0x36c935['id']},{})[_0x2d75('0x20')](function(){return _0x144240;});}else{return _0x144240;}})[_0x2d75('0x41')](function(_0x5721f6){logger[_0x2d75('0x24')](_0x2d75('0x4c'),_0x5721f6);throw _0x5721f6;});}return _0x144240;})['then'](respondWithResult(_0x38bb2b,0xc9))[_0x2d75('0x41')](handleError(_0x38bb2b,null));};exports[_0x2d75('0x1f')]=function(_0x5dbd19,_0x198771){if(_0x5dbd19[_0x2d75('0x46')]['id']){delete _0x5dbd19[_0x2d75('0x46')]['id'];}return db[_0x2d75('0x3d')]['find']({'where':{'id':_0x5dbd19[_0x2d75('0x4d')]['id']}})[_0x2d75('0x20')](handleEntityNotFound(_0x198771,null))[_0x2d75('0x20')](saveUpdates(_0x5dbd19[_0x2d75('0x46')],null))[_0x2d75('0x20')](respondWithResult(_0x198771,null))[_0x2d75('0x41')](handleError(_0x198771,null));};exports['destroy']=function(_0x1681d5,_0x5c879d){return db[_0x2d75('0x3d')]['find']({'where':{'id':_0x1681d5[_0x2d75('0x4d')]['id']}})[_0x2d75('0x20')](handleEntityNotFound(_0x5c879d,null))[_0x2d75('0x20')](removeEntity(_0x5c879d,null))['catch'](handleError(_0x5c879d,null));}; \ No newline at end of file +var _0x0fdb=['map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','VoiceChanSpy','includeAll','include','findAll','rows','catch','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','destroy','then','get','ChanSpies','error','stack','name','index'];(function(_0x6af6b6,_0x36162c){var _0x244d68=function(_0x597e2e){while(--_0x597e2e){_0x6af6b6['push'](_0x6af6b6['shift']());}};_0x244d68(++_0x36162c);}(_0x0fdb,0x1c3));var _0xb0fd=function(_0x7a9abb,_0x57ea72){_0x7a9abb=_0x7a9abb-0x0;var _0xd04225=_0x0fdb[_0x7a9abb];return _0xd04225;};'use strict';var pdf=require(_0xb0fd('0x0'));var emlformat=require(_0xb0fd('0x1'));var rimraf=require(_0xb0fd('0x2'));var zipdir=require(_0xb0fd('0x3'));var jsonpatch=require(_0xb0fd('0x4'));var rp=require(_0xb0fd('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb0fd('0x6'));var path=require(_0xb0fd('0x7'));var sox=require('sox');var csv=require(_0xb0fd('0x8'));var ejs=require(_0xb0fd('0x9'));var fs=require('fs');var _=require(_0xb0fd('0xa'));var squel=require('squel');var crypto=require(_0xb0fd('0xb'));var jsforce=require(_0xb0fd('0xc'));var deskjs=require(_0xb0fd('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb0fd('0xe'));var Papa=require('papaparse');var Redis=require(_0xb0fd('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb0fd('0x10'));var as=require(_0xb0fd('0x11'));var hardwareService=require(_0xb0fd('0x12'));var logger=require(_0xb0fd('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xb0fd('0x14'));var db=require(_0xb0fd('0x15'))['db'];function respondWithStatusCode(_0x1ab75f,_0x1c5cf9){_0x1c5cf9=_0x1c5cf9||0xcc;return function(_0x351ef2){if(_0x351ef2){return _0x1ab75f[_0xb0fd('0x16')](_0x1c5cf9);}return _0x1ab75f[_0xb0fd('0x17')](_0x1c5cf9)[_0xb0fd('0x18')]();};}function respondWithResult(_0x29e5b6,_0x5431e0){_0x5431e0=_0x5431e0||0xc8;return function(_0x10910f){if(_0x10910f){return _0x29e5b6[_0xb0fd('0x17')](_0x5431e0)[_0xb0fd('0x19')](_0x10910f);}};}function respondWithFilteredResult(_0x536bbf,_0x29b848){return function(_0x47a58c){if(_0x47a58c){var _0x2be2e1=_0x47a58c[_0xb0fd('0x1a')],_0x1a36e5=_0x29b848[_0xb0fd('0x1b')],_0x2de261=_0x29b848[_0xb0fd('0x1b')]+_0x29b848['limit'],_0x28901d;if(_0x2de261>=_0x2be2e1){_0x2de261=_0x2be2e1;_0x28901d=0xc8;}else{_0x28901d=0xce;}_0x536bbf['status'](_0x28901d);return _0x536bbf[_0xb0fd('0x1c')](_0xb0fd('0x1d'),_0x1a36e5+'-'+_0x2de261+'/'+_0x2be2e1)[_0xb0fd('0x19')](_0x47a58c);}return null;};}function patchUpdates(_0x8b84f1){return function(_0xec3111){try{jsonpatch[_0xb0fd('0x1e')](_0xec3111,_0x8b84f1,!![]);}catch(_0x5b2ab4){return BPromise[_0xb0fd('0x1f')](_0x5b2ab4);}return _0xec3111[_0xb0fd('0x20')]();};}function saveUpdates(_0x1b4514,_0x12eab5){return function(_0x28b1e1){if(_0x28b1e1){return _0x28b1e1['update'](_0x1b4514)['then'](function(_0x4b4f93){return _0x4b4f93;});}return null;};}function removeEntity(_0x220a42,_0x2ea2ef){return function(_0x84ebb9){if(_0x84ebb9){return _0x84ebb9[_0xb0fd('0x21')]()[_0xb0fd('0x22')](function(){var _0x129d40=_0x84ebb9[_0xb0fd('0x23')]({'plain':!![]});var _0x3b6323=_0xb0fd('0x24');return db['UserProfileResource'][_0xb0fd('0x21')]({'where':{'type':_0x3b6323,'resourceId':_0x129d40['id']}})[_0xb0fd('0x22')](function(){return _0x84ebb9;});})['then'](function(){_0x220a42[_0xb0fd('0x17')](0xcc)[_0xb0fd('0x18')]();});}};}function handleEntityNotFound(_0x1418f2,_0x3cecec){return function(_0x57f8f0){if(!_0x57f8f0){_0x1418f2[_0xb0fd('0x16')](0x194);}return _0x57f8f0;};}function handleError(_0x51865f,_0x560447){_0x560447=_0x560447||0x1f4;return function(_0x341dd7){logger[_0xb0fd('0x25')](_0x341dd7[_0xb0fd('0x26')]);if(_0x341dd7[_0xb0fd('0x27')]){delete _0x341dd7[_0xb0fd('0x27')];}_0x51865f[_0xb0fd('0x17')](_0x560447)['send'](_0x341dd7);};}exports[_0xb0fd('0x28')]=function(_0x22f867,_0x151301){var _0x3d5d9c={},_0x40ede7={},_0x126e9a={'count':0x0,'rows':[]};var _0x81b9bb=_[_0xb0fd('0x29')](db['VoiceChanSpy'][_0xb0fd('0x2a')],function(_0x3e042e){return{'name':_0x3e042e[_0xb0fd('0x2b')],'type':_0x3e042e[_0xb0fd('0x2c')][_0xb0fd('0x2d')]};});_0x40ede7[_0xb0fd('0x2e')]=_[_0xb0fd('0x29')](_0x81b9bb,_0xb0fd('0x27'));_0x40ede7[_0xb0fd('0x2f')]=_[_0xb0fd('0x30')](_0x22f867['query']);_0x40ede7['filters']=_['intersection'](_0x40ede7[_0xb0fd('0x2e')],_0x40ede7[_0xb0fd('0x2f')]);_0x3d5d9c[_0xb0fd('0x31')]=_[_0xb0fd('0x32')](_0x40ede7[_0xb0fd('0x2e')],qs[_0xb0fd('0x33')](_0x22f867[_0xb0fd('0x2f')][_0xb0fd('0x33')]));_0x3d5d9c['attributes']=_0x3d5d9c[_0xb0fd('0x31')][_0xb0fd('0x34')]?_0x3d5d9c[_0xb0fd('0x31')]:_0x40ede7['model'];if(!_0x22f867[_0xb0fd('0x2f')]['hasOwnProperty'](_0xb0fd('0x35'))){_0x3d5d9c[_0xb0fd('0x36')]=qs[_0xb0fd('0x36')](_0x22f867[_0xb0fd('0x2f')][_0xb0fd('0x36')]);_0x3d5d9c[_0xb0fd('0x1b')]=qs[_0xb0fd('0x1b')](_0x22f867[_0xb0fd('0x2f')][_0xb0fd('0x1b')]);}_0x3d5d9c[_0xb0fd('0x37')]=qs['sort'](_0x22f867[_0xb0fd('0x2f')][_0xb0fd('0x38')]);_0x3d5d9c[_0xb0fd('0x39')]=qs[_0xb0fd('0x3a')](_[_0xb0fd('0x3b')](_0x22f867['query'],_0x40ede7[_0xb0fd('0x3a')]),_0x81b9bb);if(_0x22f867['query'][_0xb0fd('0x3c')]){_0x3d5d9c[_0xb0fd('0x39')]=_[_0xb0fd('0x3d')](_0x3d5d9c['where'],{'$or':_['map'](_0x81b9bb,function(_0x36b4a3){if(_0x36b4a3[_0xb0fd('0x2c')]!==_0xb0fd('0x3e')){var _0x315ea2={};_0x315ea2[_0x36b4a3[_0xb0fd('0x27')]]={'$like':'%'+_0x22f867[_0xb0fd('0x2f')][_0xb0fd('0x3c')]+'%'};return _0x315ea2;}})});}_0x3d5d9c=_[_0xb0fd('0x3d')]({},_0x3d5d9c,_0x22f867[_0xb0fd('0x3f')]);var _0x2c5069={'where':_0x3d5d9c[_0xb0fd('0x39')]};return db[_0xb0fd('0x40')][_0xb0fd('0x1a')](_0x2c5069)[_0xb0fd('0x22')](function(_0x4fa71e){_0x126e9a[_0xb0fd('0x1a')]=_0x4fa71e;if(_0x22f867[_0xb0fd('0x2f')][_0xb0fd('0x41')]){_0x3d5d9c[_0xb0fd('0x42')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0xb0fd('0x43')](_0x3d5d9c);})['then'](function(_0xecd524){_0x126e9a[_0xb0fd('0x44')]=_0xecd524;return _0x126e9a;})[_0xb0fd('0x22')](respondWithFilteredResult(_0x151301,_0x3d5d9c))[_0xb0fd('0x45')](handleError(_0x151301,null));};exports['show']=function(_0x886b2e,_0x4e7325){var _0x4e9c99={'raw':![],'where':{'id':_0x886b2e['params']['id']}},_0x1ab0d2={};_0x1ab0d2[_0xb0fd('0x2e')]=_[_0xb0fd('0x30')](db[_0xb0fd('0x40')]['rawAttributes']);_0x1ab0d2[_0xb0fd('0x2f')]=_[_0xb0fd('0x30')](_0x886b2e['query']);_0x1ab0d2['filters']=_[_0xb0fd('0x32')](_0x1ab0d2[_0xb0fd('0x2e')],_0x1ab0d2[_0xb0fd('0x2f')]);_0x4e9c99[_0xb0fd('0x31')]=_[_0xb0fd('0x32')](_0x1ab0d2['model'],qs['fields'](_0x886b2e[_0xb0fd('0x2f')][_0xb0fd('0x33')]));_0x4e9c99[_0xb0fd('0x31')]=_0x4e9c99[_0xb0fd('0x31')][_0xb0fd('0x34')]?_0x4e9c99[_0xb0fd('0x31')]:_0x1ab0d2[_0xb0fd('0x2e')];if(_0x886b2e['query'][_0xb0fd('0x41')]){_0x4e9c99[_0xb0fd('0x42')]=[{'all':!![]}];}_0x4e9c99=_[_0xb0fd('0x3d')]({},_0x4e9c99,_0x886b2e[_0xb0fd('0x3f')]);return db[_0xb0fd('0x40')][_0xb0fd('0x46')](_0x4e9c99)[_0xb0fd('0x22')](handleEntityNotFound(_0x4e7325,null))['then'](respondWithResult(_0x4e7325,null))['catch'](handleError(_0x4e7325,null));};exports['create']=function(_0x6ec153,_0x1f9303){return db[_0xb0fd('0x40')][_0xb0fd('0x47')](_0x6ec153[_0xb0fd('0x48')],{})[_0xb0fd('0x22')](function(_0xeb8c60){var _0x7fc750=_0x6ec153[_0xb0fd('0x49')][_0xb0fd('0x23')]({'plain':!![]});if(!_0x7fc750)throw new Error(_0xb0fd('0x4a'));if(_0x7fc750[_0xb0fd('0x4b')]===_0xb0fd('0x49')){var _0x1bd231=_0xeb8c60[_0xb0fd('0x23')]({'plain':!![]});var _0x515eb6=_0xb0fd('0x24');return db['UserProfileSection'][_0xb0fd('0x46')]({'where':{'name':_0x515eb6,'userProfileId':_0x7fc750[_0xb0fd('0x4c')]},'raw':!![]})[_0xb0fd('0x22')](function(_0x1615ed){if(_0x1615ed&&_0x1615ed[_0xb0fd('0x4d')]===0x0){return db[_0xb0fd('0x4e')]['create']({'name':_0x1bd231['name'],'resourceId':_0x1bd231['id'],'type':_0x1615ed['name'],'sectionId':_0x1615ed['id']},{})[_0xb0fd('0x22')](function(){return _0xeb8c60;});}else{return _0xeb8c60;}})['catch'](function(_0x2f9abc){logger[_0xb0fd('0x25')](_0xb0fd('0x4f'),_0x2f9abc);throw _0x2f9abc;});}return _0xeb8c60;})[_0xb0fd('0x22')](respondWithResult(_0x1f9303,0xc9))[_0xb0fd('0x45')](handleError(_0x1f9303,null));};exports[_0xb0fd('0x50')]=function(_0xa5d5c6,_0x2db1bf){if(_0xa5d5c6[_0xb0fd('0x48')]['id']){delete _0xa5d5c6['body']['id'];}return db[_0xb0fd('0x40')][_0xb0fd('0x46')]({'where':{'id':_0xa5d5c6[_0xb0fd('0x51')]['id']}})[_0xb0fd('0x22')](handleEntityNotFound(_0x2db1bf,null))[_0xb0fd('0x22')](saveUpdates(_0xa5d5c6[_0xb0fd('0x48')],null))[_0xb0fd('0x22')](respondWithResult(_0x2db1bf,null))[_0xb0fd('0x45')](handleError(_0x2db1bf,null));};exports['destroy']=function(_0x29e76f,_0x35cfda){return db['VoiceChanSpy'][_0xb0fd('0x46')]({'where':{'id':_0x29e76f[_0xb0fd('0x51')]['id']}})[_0xb0fd('0x22')](handleEntityNotFound(_0x35cfda,null))['then'](removeEntity(_0x35cfda,null))[_0xb0fd('0x45')](handleError(_0x35cfda,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 6d59c1b..80e17ee 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 _0xa179=['length','bulkCreate','VoiceExtension','destroy','catch','lodash','util','./voiceChanSpy.attributes','context','from-sip','format','prefix','system','push','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','recordingFormat','auth','Authenticate','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','internal','concat','User','findAll','exports','models','voice_chanspy','then'];(function(_0x1f4698,_0x178766){var _0x558451=function(_0x3e566a){while(--_0x3e566a){_0x1f4698['push'](_0x1f4698['shift']());}};_0x558451(++_0x178766);}(_0xa179,0x1c1));var _0x9a17=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa179[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9a17('0x0'));var util=require(_0x9a17('0x1'));var BPromise=require('bluebird');var attributes=require(_0x9a17('0x2'));var getUserApplications=function(_0x284497,_0x5d512b,_0x304e18){var _0x4a8798=0x1;var _0x139d1a=[];var _0x249e13={'context':_0x5d512b[_0x9a17('0x3')]||_0x9a17('0x4'),'exten':util[_0x9a17('0x5')]('%s%s',_0x284497[_0x9a17('0x6')],_0x304e18),'type':_0x9a17('0x7'),'isApp':![],'ChanSpyId':_0x284497['id'],'UserId':_0x5d512b['id']};_0x139d1a[_0x9a17('0x8')](_[_0x9a17('0x9')]({'app':_0x9a17('0xa'),'appdata':util[_0x9a17('0x5')](_0x9a17('0xb'),_0x9a17('0xc')),'priority':_0x4a8798++},_0x249e13));if(_0x284497[_0x9a17('0xd')]){_0x139d1a[_0x9a17('0x8')](_['merge']({'app':_0x9a17('0xe'),'appdata':util[_0x9a17('0x5')]('${UNIQUEID}.%s,a',_0x284497[_0x9a17('0xf')]),'priority':_0x4a8798++},_0x249e13));}if(_0x284497[_0x9a17('0x10')]){_0x139d1a[_0x9a17('0x8')](_[_0x9a17('0x9')]({'app':_0x9a17('0x11'),'appdata':_0x284497['password'],'priority':_0x4a8798++},_0x249e13));}_0x139d1a['push'](_[_0x9a17('0x9')]({'app':_0x9a17('0x12'),'appdata':util['format'](_0x9a17('0x13'),_0x5d512b[_0x9a17('0x14')],_0x284497[_0x9a17('0x15')]?_0x284497[_0x9a17('0x15')][_0x9a17('0x16')](''):''),'priority':_0x4a8798++},_0x249e13));if(_0x284497[_0x9a17('0xd')]){_0x139d1a[_0x9a17('0x8')](_[_0x9a17('0x9')]({'app':_0x9a17('0x17'),'priority':_0x4a8798++},_0x249e13));}return _0x139d1a;};var getChanSpyApplications=function(_0x3ad23e,_0x131611){var _0x4f2460=[];for(var _0x2c3731=0x0,_0x898d0=0x1;_0x2c3731<_0x131611['length'];_0x2c3731++,_0x898d0=0x1){_0x4f2460=_0x4f2460['concat'](getUserApplications(_0x3ad23e,_0x131611[_0x2c3731],_0x131611[_0x2c3731][_0x9a17('0x18')]));if(_0x131611[_0x2c3731][_0x9a17('0x18')]!=_0x131611[_0x2c3731][_0x9a17('0x14')]){_0x4f2460=_0x4f2460[_0x9a17('0x19')](getUserApplications(_0x3ad23e,_0x131611[_0x2c3731],_0x131611[_0x2c3731][_0x9a17('0x14')]));}}return _0x4f2460;};var getChanSpyPromise=function(_0x26daf1,_0x21aac2){return new BPromise(function(_0x406d39,_0x3d91df){return _0x26daf1[_0x9a17('0x1a')][_0x9a17('0x1b')]({'attributes':['id',_0x9a17('0x14'),_0x9a17('0x18')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})['then'](function(_0x25d24c){if(_0x25d24c){return _0x406d39(getChanSpyApplications(_0x21aac2,_0x25d24c));}return _0x406d39([]);})['catch'](function(_0xe71ac0){_0x3d91df(_0xe71ac0);});});};module[_0x9a17('0x1c')]=function(_0x178c50,_0x1218d2){var _0x43c0e4=_0x178c50[_0x9a17('0x1d')];return _0x178c50['define']('VoiceChanSpy',attributes,{'tableName':_0x9a17('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2c2812,_0x2a21d7,_0x628ffa){return getChanSpyPromise(_0x43c0e4,_0x2c2812)[_0x9a17('0x1f')](function(_0x6a1923){if(_0x6a1923&&_0x6a1923[_0x9a17('0x20')]){return _0x43c0e4['VoiceExtension'][_0x9a17('0x21')](_0x6a1923);}})[_0x9a17('0x1f')](function(){_0x628ffa();})['catch'](function(_0x4831bc){_0x628ffa(_0x4831bc);});},'afterUpdate':function(_0x5da153,_0x56b46f,_0x355f5a){return _0x43c0e4[_0x9a17('0x22')][_0x9a17('0x23')]({'where':{'ChanSpyId':_0x5da153['id']}})[_0x9a17('0x1f')](function(){return getChanSpyPromise(_0x43c0e4,_0x5da153);})['then'](function(_0x4e7473){if(_0x4e7473&&_0x4e7473[_0x9a17('0x20')]){return _0x43c0e4[_0x9a17('0x22')][_0x9a17('0x21')](_0x4e7473);}})[_0x9a17('0x1f')](function(){_0x355f5a();})['catch'](function(_0x3b16ff){_0x355f5a(_0x3b16ff);});},'afterDestroy':function(_0x1db848,_0x105a79,_0x4d0b6f){return _0x43c0e4[_0x9a17('0x22')]['destroy']({'where':{'ChanSpyId':_0x1db848['id']}})[_0x9a17('0x1f')](function(){_0x4d0b6f();})[_0x9a17('0x24')](function(_0x290627){_0x4d0b6f(_0x290627);});}}});}; \ No newline at end of file +var _0xcd1a=['${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','name','options','join','StopMixMonitor','concat','internal','User','findAll','agent','then','catch','exports','models','define','voice_chanspy','VoiceExtension','length','bulkCreate','destroy','lodash','util','bluebird','context','from-sip','format','%s%s','system','push','merge','MixMonitor'];(function(_0x53efc8,_0x4b6fc2){var _0x196b88=function(_0x3ef9aa){while(--_0x3ef9aa){_0x53efc8['push'](_0x53efc8['shift']());}};_0x196b88(++_0x4b6fc2);}(_0xcd1a,0x115));var _0xacd1=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xcd1a[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require(_0xacd1('0x0'));var util=require(_0xacd1('0x1'));var BPromise=require(_0xacd1('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x373411,_0x17abdc,_0x57e941){var _0x80728b=0x1;var _0x51a40f=[];var _0x25c9b4={'context':_0x17abdc[_0xacd1('0x3')]||_0xacd1('0x4'),'exten':util[_0xacd1('0x5')](_0xacd1('0x6'),_0x373411['prefix'],_0x57e941),'type':_0xacd1('0x7'),'isApp':![],'ChanSpyId':_0x373411['id'],'UserId':_0x17abdc['id']};_0x51a40f[_0xacd1('0x8')](_[_0xacd1('0x9')]({'app':'Set','appdata':util['format']('CDR(type)=%s','chanspy'),'priority':_0x80728b++},_0x25c9b4));if(_0x373411['record']){_0x51a40f[_0xacd1('0x8')](_[_0xacd1('0x9')]({'app':_0xacd1('0xa'),'appdata':util['format'](_0xacd1('0xb'),_0x373411[_0xacd1('0xc')]),'priority':_0x80728b++},_0x25c9b4));}if(_0x373411[_0xacd1('0xd')]){_0x51a40f[_0xacd1('0x8')](_[_0xacd1('0x9')]({'app':_0xacd1('0xe'),'appdata':_0x373411[_0xacd1('0xf')],'priority':_0x80728b++},_0x25c9b4));}_0x51a40f[_0xacd1('0x8')](_[_0xacd1('0x9')]({'app':_0xacd1('0x10'),'appdata':util[_0xacd1('0x5')]('SIP/%s,%s',_0x17abdc[_0xacd1('0x11')],_0x373411[_0xacd1('0x12')]?_0x373411[_0xacd1('0x12')][_0xacd1('0x13')](''):''),'priority':_0x80728b++},_0x25c9b4));if(_0x373411['record']){_0x51a40f['push'](_[_0xacd1('0x9')]({'app':_0xacd1('0x14'),'priority':_0x80728b++},_0x25c9b4));}return _0x51a40f;};var getChanSpyApplications=function(_0x338166,_0x548ac3){var _0x5dd4ee=[];for(var _0x4c9664=0x0,_0x4c453d=0x1;_0x4c9664<_0x548ac3['length'];_0x4c9664++,_0x4c453d=0x1){_0x5dd4ee=_0x5dd4ee[_0xacd1('0x15')](getUserApplications(_0x338166,_0x548ac3[_0x4c9664],_0x548ac3[_0x4c9664][_0xacd1('0x16')]));if(_0x548ac3[_0x4c9664][_0xacd1('0x16')]!=_0x548ac3[_0x4c9664][_0xacd1('0x11')]){_0x5dd4ee=_0x5dd4ee[_0xacd1('0x15')](getUserApplications(_0x338166,_0x548ac3[_0x4c9664],_0x548ac3[_0x4c9664]['name']));}}return _0x5dd4ee;};var getChanSpyPromise=function(_0x51a03d,_0x523c92){return new BPromise(function(_0x2c1a09,_0xf50ce4){return _0x51a03d[_0xacd1('0x17')][_0xacd1('0x18')]({'attributes':['id',_0xacd1('0x11'),_0xacd1('0x16')],'where':{'role':_0xacd1('0x19'),'chanspy':!![]},'raw':!![]})[_0xacd1('0x1a')](function(_0x1ad877){if(_0x1ad877){return _0x2c1a09(getChanSpyApplications(_0x523c92,_0x1ad877));}return _0x2c1a09([]);})[_0xacd1('0x1b')](function(_0x27fc19){_0xf50ce4(_0x27fc19);});});};module[_0xacd1('0x1c')]=function(_0xbfd9bb,_0x4cde57){var _0x11a7b9=_0xbfd9bb[_0xacd1('0x1d')];return _0xbfd9bb[_0xacd1('0x1e')]('VoiceChanSpy',attributes,{'tableName':_0xacd1('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x34c4d0,_0x116bee,_0x4ebb93){return getChanSpyPromise(_0x11a7b9,_0x34c4d0)['then'](function(_0x3f17b9){if(_0x3f17b9&&_0x3f17b9['length']){return _0x11a7b9[_0xacd1('0x20')]['bulkCreate'](_0x3f17b9);}})[_0xacd1('0x1a')](function(){_0x4ebb93();})[_0xacd1('0x1b')](function(_0x45f6ee){_0x4ebb93(_0x45f6ee);});},'afterUpdate':function(_0x413121,_0x3a1a01,_0xf8e439){return _0x11a7b9[_0xacd1('0x20')]['destroy']({'where':{'ChanSpyId':_0x413121['id']}})[_0xacd1('0x1a')](function(){return getChanSpyPromise(_0x11a7b9,_0x413121);})['then'](function(_0x5379ee){if(_0x5379ee&&_0x5379ee[_0xacd1('0x21')]){return _0x11a7b9['VoiceExtension'][_0xacd1('0x22')](_0x5379ee);}})[_0xacd1('0x1a')](function(){_0xf8e439();})[_0xacd1('0x1b')](function(_0x313a7d){_0xf8e439(_0x313a7d);});},'afterDestroy':function(_0x5dcca1,_0x572c24,_0x3b13fa){return _0x11a7b9[_0xacd1('0x20')][_0xacd1('0x23')]({'where':{'ChanSpyId':_0x5dcca1['id']}})[_0xacd1('0x1a')](function(){_0x3b13fa();})['catch'](function(_0x2093b8){_0x3b13fa(_0x2093b8);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index bb5f1e0..e646400 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 _0x63f7=['VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','error','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x2bf6be,_0x5b23f1){var _0x532ef4=function(_0x3760df){while(--_0x3760df){_0x2bf6be['push'](_0x2bf6be['shift']());}};_0x532ef4(++_0x5b23f1);}(_0x63f7,0x91));var _0x763f=function(_0x5cbc77,_0x50a049){_0x5cbc77=_0x5cbc77-0x0;var _0x1e6c64=_0x63f7[_0x5cbc77];return _0x1e6c64;};'use strict';var _=require(_0x763f('0x0'));var util=require(_0x763f('0x1'));var moment=require('moment');var BPromise=require(_0x763f('0x2'));var rs=require(_0x763f('0x3'));var fs=require('fs');var Redis=require(_0x763f('0x4'));var db=require(_0x763f('0x5'))['db'];var utils=require(_0x763f('0x6'));var logger=require(_0x763f('0x7'))(_0x763f('0x8'));var config=require(_0x763f('0x9'));var jayson=require(_0x763f('0xa'));var client=jayson[_0x763f('0xb')][_0x763f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x550197,_0x161596,_0x5857f1){return new BPromise(function(_0x3c6d76,_0x2748e3){return client[_0x763f('0xd')](_0x550197,_0x5857f1)[_0x763f('0xe')](function(_0x135aab){logger[_0x763f('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x161596,'request\x20sent');logger['debug'](_0x763f('0x10'),_0x161596,_0x763f('0x11'),JSON['stringify'](_0x135aab));if(_0x135aab[_0x763f('0x12')]){if(_0x135aab['error']['code']===0x1f4){logger[_0x763f('0x12')](_0x763f('0x13'),_0x161596,_0x135aab['error'][_0x763f('0x14')]);return _0x2748e3(_0x135aab[_0x763f('0x12')][_0x763f('0x14')]);}logger[_0x763f('0x12')](_0x763f('0x13'),_0x161596,_0x135aab[_0x763f('0x12')][_0x763f('0x14')]);return _0x3c6d76(_0x135aab[_0x763f('0x12')][_0x763f('0x14')]);}else{logger[_0x763f('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x161596,_0x763f('0x11'));_0x3c6d76(_0x135aab[_0x763f('0x15')][_0x763f('0x14')]);}})[_0x763f('0x16')](function(_0x2fc54b){logger[_0x763f('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x161596,_0x2fc54b);_0x2748e3(_0x2fc54b);});});} \ No newline at end of file +var _0x6048=['client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x6048,0xfe));var _0x8604=function(_0x1fd155,_0x340af9){_0x1fd155=_0x1fd155-0x0;var _0x250e2f=_0x6048[_0x1fd155];return _0x250e2f;};'use strict';var _=require(_0x8604('0x0'));var util=require(_0x8604('0x1'));var moment=require('moment');var BPromise=require(_0x8604('0x2'));var rs=require(_0x8604('0x3'));var fs=require('fs');var Redis=require(_0x8604('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8604('0x5'));var logger=require(_0x8604('0x6'))(_0x8604('0x7'));var config=require(_0x8604('0x8'));var jayson=require(_0x8604('0x9'));var client=jayson[_0x8604('0xa')][_0x8604('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e9633,_0x45fe64,_0x5ece49){return new BPromise(function(_0x18e65d,_0x3f7560){return client[_0x8604('0xc')](_0x1e9633,_0x5ece49)[_0x8604('0xd')](function(_0x2aad71){logger[_0x8604('0xe')](_0x8604('0xf'),_0x45fe64,_0x8604('0x10'));logger[_0x8604('0x11')](_0x8604('0x12'),_0x45fe64,'request\x20sent',JSON[_0x8604('0x13')](_0x2aad71));if(_0x2aad71[_0x8604('0x14')]){if(_0x2aad71[_0x8604('0x14')]['code']===0x1f4){logger[_0x8604('0x14')]('VoiceChanSpy,\x20%s,\x20%s',_0x45fe64,_0x2aad71[_0x8604('0x14')][_0x8604('0x15')]);return _0x3f7560(_0x2aad71[_0x8604('0x14')][_0x8604('0x15')]);}logger[_0x8604('0x14')]('VoiceChanSpy,\x20%s,\x20%s',_0x45fe64,_0x2aad71[_0x8604('0x14')]['message']);return _0x18e65d(_0x2aad71[_0x8604('0x14')][_0x8604('0x15')]);}else{logger['info'](_0x8604('0xf'),_0x45fe64,_0x8604('0x10'));_0x18e65d(_0x2aad71['result'][_0x8604('0x15')]);}})['catch'](function(_0x6b6761){logger['error'](_0x8604('0xf'),_0x45fe64,_0x6b6761);_0x3f7560(_0x6b6761);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 465f90c..f2a977f 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 _0x6766=['get','show','post','create','put','/:id','update','delete','destroy','multer','path','express','../../components/interaction/service','../../config/environment','./voiceContext.controller','isAuthenticated'];(function(_0x1bd1d1,_0x177176){var _0x178b20=function(_0x42f762){while(--_0x42f762){_0x1bd1d1['push'](_0x1bd1d1['shift']());}};_0x178b20(++_0x177176);}(_0x6766,0x119));var _0x6676=function(_0x199bc4,_0x338105){_0x199bc4=_0x199bc4-0x0;var _0x136ffb=_0x6766[_0x199bc4];return _0x136ffb;};'use strict';var multer=require(_0x6676('0x0'));var util=require('util');var path=require(_0x6676('0x1'));var timeout=require('connect-timeout');var express=require(_0x6676('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x6676('0x3'));var config=require(_0x6676('0x4'));var controller=require(_0x6676('0x5'));router['get']('/',auth[_0x6676('0x6')](),controller['index']);router[_0x6676('0x7')]('/:id',auth[_0x6676('0x6')](),controller[_0x6676('0x8')]);router[_0x6676('0x9')]('/',auth[_0x6676('0x6')](),controller[_0x6676('0xa')]);router[_0x6676('0xb')](_0x6676('0xc'),auth[_0x6676('0x6')](),controller[_0x6676('0xd')]);router[_0x6676('0xe')](_0x6676('0xc'),auth[_0x6676('0x6')](),controller[_0x6676('0xf')]);module['exports']=router; \ No newline at end of file +var _0x860a=['post','create','put','update','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show'];(function(_0x59b15e,_0x26d506){var _0x120142=function(_0x50fabc){while(--_0x50fabc){_0x59b15e['push'](_0x59b15e['shift']());}};_0x120142(++_0x26d506);}(_0x860a,0x19d));var _0xa860=function(_0x549300,_0x325250){_0x549300=_0x549300-0x0;var _0x326d3d=_0x860a[_0x549300];return _0x326d3d;};'use strict';var multer=require(_0xa860('0x0'));var util=require(_0xa860('0x1'));var path=require(_0xa860('0x2'));var timeout=require('connect-timeout');var express=require(_0xa860('0x3'));var router=express[_0xa860('0x4')]();var auth=require(_0xa860('0x5'));var interaction=require(_0xa860('0x6'));var config=require(_0xa860('0x7'));var controller=require('./voiceContext.controller');router[_0xa860('0x8')]('/',auth[_0xa860('0x9')](),controller['index']);router['get'](_0xa860('0xa'),auth[_0xa860('0x9')](),controller[_0xa860('0xb')]);router[_0xa860('0xc')]('/',auth['isAuthenticated'](),controller[_0xa860('0xd')]);router[_0xa860('0xe')](_0xa860('0xa'),auth[_0xa860('0x9')](),controller[_0xa860('0xf')]);router['delete']('/:id',auth[_0xa860('0x9')](),controller[_0xa860('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 2dfb57f..137463a 100644 --- a/server/api/voiceContext/voiceContext.attributes.js +++ b/server/api/voiceContext/voiceContext.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['name','sequelize','STRING'];(function(_0x72d7d,_0x132bd7){var _0x13f3c2=function(_0x37fb41){while(--_0x37fb41){_0x72d7d['push'](_0x72d7d['shift']());}};_0x13f3c2(++_0x132bd7);}(_0x3e74,0x175));var _0x43e7=function(_0x28840c,_0x3b9297){_0x28840c=_0x28840c-0x0;var _0x2b0a4c=_0x3e74[_0x28840c];return _0x2b0a4c;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'name':{'type':Sequelize[_0x43e7('0x1')],'unique':_0x43e7('0x2')},'description':{'type':Sequelize[_0x43e7('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x3e74=['name','sequelize','STRING'];(function(_0x5a49c5,_0x39a350){var _0x29b69b=function(_0x44ed94){while(--_0x44ed94){_0x5a49c5['push'](_0x5a49c5['shift']());}};_0x29b69b(++_0x39a350);}(_0x3e74,0x175));var _0x43e7=function(_0x3ccd46,_0x17ff10){_0x3ccd46=_0x3ccd46-0x0;var _0x35c4b2=_0x3e74[_0x3ccd46];return _0x35c4b2;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'name':{'type':Sequelize[_0x43e7('0x1')],'unique':_0x43e7('0x2')},'description':{'type':Sequelize[_0x43e7('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 5529069..8607f9b 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 _0x008c=['../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','VoiceContext,\x20%s,\x20%s','error','message','info','request\x20sent','catch','sendStatus','status','end','count','offset','limit','apply','reject','save','update','get','Contexts','UserProfileResource','destroy','stack','name','index','VoiceContext','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','findAll','rows','show','params','includeAll','include','create','body','join','root','server/files/templates/context.ejs','render','writeFileSync','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','utf8','/etc/asterisk/extensions_xcally_contexts.conf','readFileSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger'];(function(_0xc6a72f,_0x1ac77c){var _0x3728f7=function(_0x3d1427){while(--_0x3d1427){_0xc6a72f['push'](_0xc6a72f['shift']());}};_0x3728f7(++_0x1ac77c);}(_0x008c,0x188));var _0xc008=function(_0x32665e,_0x12740e){_0x32665e=_0x32665e-0x0;var _0x10be45=_0x008c[_0x32665e];return _0x10be45;};'use strict';var pdf=require(_0xc008('0x0'));var emlformat=require(_0xc008('0x1'));var rimraf=require(_0xc008('0x2'));var zipdir=require(_0xc008('0x3'));var jsonpatch=require(_0xc008('0x4'));var rp=require('request-promise');var moment=require(_0xc008('0x5'));var BPromise=require(_0xc008('0x6'));var Mustache=require(_0xc008('0x7'));var util=require(_0xc008('0x8'));var path=require(_0xc008('0x9'));var sox=require(_0xc008('0xa'));var csv=require(_0xc008('0xb'));var ejs=require(_0xc008('0xc'));var fs=require('fs');var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var db=require(_0xc008('0x16'))['db'];var jayson=require(_0xc008('0x17'));var client=jayson[_0xc008('0x18')][_0xc008('0x19')]({'port':0x232a});function checkPasswordPattern(_0x69726e,_0x593f7a,_0x560e28){if(_0x560e28){var _0x33f44c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x33f44c['test'](_0x593f7a)){return _0x69726e;}else{throw new db[(_0xc008('0x1a'))][(_0xc008('0x1b'))](_0xc008('0x1c'));}}else{return _0x69726e;}}function respondWithRpcPromise(_0x339ffc,_0x3f0ecf,_0x5ee00b,_0x5e894e){return new BPromise(function(_0x4bd0f4,_0x11ef38){var _0x15a6ad=_0x5e894e||client;return _0x15a6ad[_0xc008('0x1d')](_0x339ffc,_0x5ee00b)[_0xc008('0x1e')](function(_0x4fe771){logger['info']('VoiceContext,\x20%s,\x20%s',_0x3f0ecf,'request\x20sent');logger[_0xc008('0x1f')](_0xc008('0x20'),_0x3f0ecf,'request\x20sent',JSON[_0xc008('0x21')](_0x4fe771));if(_0x4fe771['error']){if(_0x4fe771['error']['code']===0x1f4){logger['error'](_0xc008('0x22'),_0x3f0ecf,_0x4fe771['error']['message']);return _0x11ef38(_0x4fe771['error']['message']);}logger['error'](_0xc008('0x22'),_0x3f0ecf,_0x4fe771[_0xc008('0x23')][_0xc008('0x24')]);return _0x4bd0f4(_0x4fe771[_0xc008('0x23')][_0xc008('0x24')]);}else{logger[_0xc008('0x25')]('VoiceContext,\x20%s,\x20%s',_0x3f0ecf,_0xc008('0x26'));_0x4bd0f4(_0x4fe771['result']['message']);}})[_0xc008('0x27')](function(_0x36f358){logger[_0xc008('0x23')](_0xc008('0x22'),_0x3f0ecf,_0x36f358);_0x11ef38(_0x36f358);});});}function respondWithStatusCode(_0x5410f5,_0x48582b){_0x48582b=_0x48582b||0xcc;return function(_0x5de1e9){if(_0x5de1e9){return _0x5410f5[_0xc008('0x28')](_0x48582b);}return _0x5410f5[_0xc008('0x29')](_0x48582b)[_0xc008('0x2a')]();};}function respondWithResult(_0x2e31c2,_0x5bebd9){_0x5bebd9=_0x5bebd9||0xc8;return function(_0x5e2aca){if(_0x5e2aca){return _0x2e31c2['status'](_0x5bebd9)['json'](_0x5e2aca);}};}function respondWithFilteredResult(_0x4caaf4,_0x3865c0){return function(_0x29ba43){if(_0x29ba43){var _0x25eae4=_0x29ba43[_0xc008('0x2b')],_0x529961=_0x3865c0[_0xc008('0x2c')],_0x24c14c=_0x3865c0['offset']+_0x3865c0[_0xc008('0x2d')],_0x32390d;if(_0x24c14c>=_0x25eae4){_0x24c14c=_0x25eae4;_0x32390d=0xc8;}else{_0x32390d=0xce;}_0x4caaf4[_0xc008('0x29')](_0x32390d);return _0x4caaf4['set']('Content-Range',_0x529961+'-'+_0x24c14c+'/'+_0x25eae4)['json'](_0x29ba43);}return null;};}function patchUpdates(_0x1032b2){return function(_0x267abd){try{jsonpatch[_0xc008('0x2e')](_0x267abd,_0x1032b2,!![]);}catch(_0x10889f){return BPromise[_0xc008('0x2f')](_0x10889f);}return _0x267abd[_0xc008('0x30')]();};}function saveUpdates(_0x294f97,_0x22d8e8){return function(_0x1fe1e1){if(_0x1fe1e1){return _0x1fe1e1[_0xc008('0x31')](_0x294f97)[_0xc008('0x1e')](function(_0x1ac7c8){return _0x1ac7c8;});}return null;};}function removeEntity(_0x596ee8,_0x334a09){return function(_0x4b7fd4){if(_0x4b7fd4){return _0x4b7fd4['destroy']()[_0xc008('0x1e')](function(){var _0x165a7b=_0x4b7fd4[_0xc008('0x32')]({'plain':!![]});var _0xca0520=_0xc008('0x33');return db[_0xc008('0x34')][_0xc008('0x35')]({'where':{'type':_0xca0520,'resourceId':_0x165a7b['id']}})[_0xc008('0x1e')](function(){return _0x4b7fd4;});})[_0xc008('0x1e')](function(){_0x596ee8['status'](0xcc)[_0xc008('0x2a')]();});}};}function handleEntityNotFound(_0x389a40,_0x459df4){return function(_0x344bad){if(!_0x344bad){_0x389a40[_0xc008('0x28')](0x194);}return _0x344bad;};}function handleError(_0x315562,_0x1667a0){_0x1667a0=_0x1667a0||0x1f4;return function(_0x5d0e06){logger[_0xc008('0x23')](_0x5d0e06[_0xc008('0x36')]);if(_0x5d0e06['name']){delete _0x5d0e06[_0xc008('0x37')];}_0x315562[_0xc008('0x29')](_0x1667a0)['send'](_0x5d0e06);};}exports[_0xc008('0x38')]=function(_0x2e4ae1,_0x280e9b){var _0x55ff48={},_0x53b353={},_0x478810={'count':0x0,'rows':[]};var _0x234f2a=_['map'](db[_0xc008('0x39')][_0xc008('0x3a')],function(_0x6a4ccb){return{'name':_0x6a4ccb[_0xc008('0x3b')],'type':_0x6a4ccb[_0xc008('0x3c')][_0xc008('0x3d')]};});_0x53b353[_0xc008('0x3e')]=_[_0xc008('0x3f')](_0x234f2a,_0xc008('0x37'));_0x53b353[_0xc008('0x40')]=_[_0xc008('0x41')](_0x2e4ae1[_0xc008('0x40')]);_0x53b353[_0xc008('0x42')]=_[_0xc008('0x43')](_0x53b353['model'],_0x53b353[_0xc008('0x40')]);_0x55ff48[_0xc008('0x44')]=_[_0xc008('0x43')](_0x53b353[_0xc008('0x3e')],qs['fields'](_0x2e4ae1[_0xc008('0x40')][_0xc008('0x45')]));_0x55ff48[_0xc008('0x44')]=_0x55ff48[_0xc008('0x44')][_0xc008('0x46')]?_0x55ff48['attributes']:_0x53b353[_0xc008('0x3e')];if(!_0x2e4ae1[_0xc008('0x40')][_0xc008('0x47')](_0xc008('0x48'))){_0x55ff48[_0xc008('0x2d')]=qs['limit'](_0x2e4ae1[_0xc008('0x40')][_0xc008('0x2d')]);_0x55ff48[_0xc008('0x2c')]=qs[_0xc008('0x2c')](_0x2e4ae1['query'][_0xc008('0x2c')]);}_0x55ff48[_0xc008('0x49')]=qs[_0xc008('0x4a')](_0x2e4ae1['query'][_0xc008('0x4a')]);_0x55ff48['where']=qs[_0xc008('0x42')](_['pick'](_0x2e4ae1[_0xc008('0x40')],_0x53b353[_0xc008('0x42')]),_0x234f2a);if(_0x2e4ae1['query'][_0xc008('0x4b')]){_0x55ff48[_0xc008('0x4c')]=_[_0xc008('0x4d')](_0x55ff48['where'],{'$or':_[_0xc008('0x3f')](_0x234f2a,function(_0x2a9b5c){if(_0x2a9b5c[_0xc008('0x3c')]!==_0xc008('0x4e')){var _0x347629={};_0x347629[_0x2a9b5c[_0xc008('0x37')]]={'$like':'%'+_0x2e4ae1['query']['filter']+'%'};return _0x347629;}})});}_0x55ff48=_['merge']({},_0x55ff48,_0x2e4ae1[_0xc008('0x4f')]);var _0x36417a={'where':_0x55ff48[_0xc008('0x4c')]};return db[_0xc008('0x39')][_0xc008('0x2b')](_0x36417a)[_0xc008('0x1e')](function(_0x2cf641){_0x478810[_0xc008('0x2b')]=_0x2cf641;if(_0x2e4ae1['query']['includeAll']){_0x55ff48['include']=[{'all':!![]}];}return db[_0xc008('0x39')][_0xc008('0x50')](_0x55ff48);})[_0xc008('0x1e')](function(_0x511383){_0x478810[_0xc008('0x51')]=_0x511383;return _0x478810;})[_0xc008('0x1e')](respondWithFilteredResult(_0x280e9b,_0x55ff48))[_0xc008('0x27')](handleError(_0x280e9b,null));};exports[_0xc008('0x52')]=function(_0x4981b4,_0x56e4ac){var _0x17ec90={'raw':![],'where':{'id':_0x4981b4[_0xc008('0x53')]['id']}},_0x405e87={};_0x405e87[_0xc008('0x3e')]=_['keys'](db['VoiceContext'][_0xc008('0x3a')]);_0x405e87['query']=_[_0xc008('0x41')](_0x4981b4[_0xc008('0x40')]);_0x405e87[_0xc008('0x42')]=_['intersection'](_0x405e87[_0xc008('0x3e')],_0x405e87[_0xc008('0x40')]);_0x17ec90[_0xc008('0x44')]=_[_0xc008('0x43')](_0x405e87[_0xc008('0x3e')],qs['fields'](_0x4981b4[_0xc008('0x40')][_0xc008('0x45')]));_0x17ec90['attributes']=_0x17ec90[_0xc008('0x44')][_0xc008('0x46')]?_0x17ec90['attributes']:_0x405e87['model'];if(_0x4981b4[_0xc008('0x40')][_0xc008('0x54')]){_0x17ec90[_0xc008('0x55')]=[{'all':!![]}];}_0x17ec90=_[_0xc008('0x4d')]({},_0x17ec90,_0x4981b4[_0xc008('0x4f')]);return db['VoiceContext']['find'](_0x17ec90)[_0xc008('0x1e')](handleEntityNotFound(_0x56e4ac,null))['then'](respondWithResult(_0x56e4ac,null))[_0xc008('0x27')](handleError(_0x56e4ac,null));};exports[_0xc008('0x56')]=function(_0xf94fcb,_0x2f1105,_0x44f42d){var _0x27a167;return db['VoiceContext'][_0xc008('0x56')](_0xf94fcb[_0xc008('0x57')],{'raw':!![]})[_0xc008('0x1e')](function(_0x2b350c){_0x27a167=_0x2b350c;return db[_0xc008('0x39')]['findAll']({'raw':!![]});})[_0xc008('0x1e')](function(_0x4fdab4){var _0x535e6e=fs['readFileSync'](path[_0xc008('0x58')](config[_0xc008('0x59')],_0xc008('0x5a')),'utf8');var _0x3aeeab=ejs[_0xc008('0x5b')](_0x535e6e,{'contexts':_0x4fdab4||[]});fs[_0xc008('0x5c')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x3aeeab);})[_0xc008('0x1e')](function(){return respondWithRpcPromise(_0xc008('0x5d'),_0xc008('0x56'),{'module':_0xc008('0x5e')});})['then'](function(){var _0x4022dd=_0xf94fcb['user'][_0xc008('0x32')]({'plain':!![]});if(!_0x4022dd)throw new Error(_0xc008('0x5f'));if(_0x4022dd[_0xc008('0x60')]===_0xc008('0x61')){var _0x192c87=_0x27a167[_0xc008('0x32')]({'plain':!![]});return db['UserProfileSection'][_0xc008('0x62')]({'where':{'name':'Contexts','userProfileId':_0x4022dd['userProfileId']},'raw':!![]})[_0xc008('0x1e')](function(_0x30aa1e){if(_0x30aa1e&&_0x30aa1e['autoAssociation']===0x0){return db[_0xc008('0x34')][_0xc008('0x56')]({'name':_0x192c87[_0xc008('0x37')],'resourceId':_0x192c87['id'],'type':_0x30aa1e[_0xc008('0x37')],'sectionId':_0x30aa1e['id']},{})[_0xc008('0x1e')](function(){return _0x27a167;});}else{return _0x27a167;}})[_0xc008('0x27')](function(_0x12973b){logger['error'](_0xc008('0x63'),_0x12973b);throw _0x12973b;});}return _0x27a167;})[_0xc008('0x1e')](respondWithResult(_0x2f1105,0xc9))[_0xc008('0x27')](handleError(_0x2f1105,null));};exports[_0xc008('0x31')]=function(_0xb3ca0f,_0x167425,_0x249898){var _0x280249;return db[_0xc008('0x39')][_0xc008('0x62')]({'where':{'id':_0xb3ca0f[_0xc008('0x53')]['id']}})[_0xc008('0x1e')](handleEntityNotFound(_0x167425,null))[_0xc008('0x1e')](saveUpdates(_0xb3ca0f[_0xc008('0x57')],null))['then'](function(_0x36a08e){if(_0x36a08e){_0x280249=_0x36a08e;return db[_0xc008('0x39')][_0xc008('0x50')]({'raw':!![]});}})['then'](function(_0xd7d020){var _0x3214df=fs['readFileSync'](path['join'](config[_0xc008('0x59')],_0xc008('0x5a')),_0xc008('0x64'));var _0x39083c=ejs[_0xc008('0x5b')](_0x3214df,{'contexts':_0xd7d020||[]});fs[_0xc008('0x5c')](_0xc008('0x65'),_0x39083c);})[_0xc008('0x1e')](function(){return respondWithRpcPromise(_0xc008('0x5d'),_0xc008('0x31'),{'module':_0xc008('0x5e')});})['then'](function(){return _0x280249;})[_0xc008('0x1e')](respondWithResult(_0x167425,null))[_0xc008('0x27')](handleError(_0x167425,null));};exports[_0xc008('0x35')]=function(_0x27dc80,_0x521e67,_0x17ffb1){var _0x5975de;return db[_0xc008('0x39')][_0xc008('0x62')]({'where':{'id':_0x27dc80[_0xc008('0x53')]['id']}})['then'](handleEntityNotFound(_0x521e67,null))[_0xc008('0x1e')](removeEntity(_0x521e67,null))[_0xc008('0x1e')](function(){return db[_0xc008('0x39')]['findAll']({'raw':!![]});})[_0xc008('0x1e')](function(_0x539fc8){var _0x50ee03=fs[_0xc008('0x66')](path[_0xc008('0x58')](config[_0xc008('0x59')],_0xc008('0x5a')),'utf8');var _0x3c30db=ejs[_0xc008('0x5b')](_0x50ee03,{'contexts':_0x539fc8});fs['writeFileSync'](_0xc008('0x65'),_0x3c30db);return respondWithRpcPromise('Reload',_0xc008('0x35'),{'module':'chan_sip.so'});})[_0xc008('0x27')](handleError(_0x521e67,null));}; \ No newline at end of file +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(_0x41916b,_0x4eb0b4){var _0x4ff672=function(_0x26e9c5){while(--_0x26e9c5){_0x41916b['push'](_0x41916b['shift']());}};_0x4ff672(++_0x4eb0b4);}(_0x34e8,0x12c));var _0x834e=function(_0x698fe2,_0x24af7b){_0x698fe2=_0x698fe2-0x0;var _0x3f1589=_0x34e8[_0x698fe2];return _0x3f1589;};'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 diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 8f46474..4056bf7 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 _0xe83f=['exports','define','VoiceContext','voice_contexts','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x58155f,_0x2f989f){var _0xfef168=function(_0x3d77f4){while(--_0x3d77f4){_0x58155f['push'](_0x58155f['shift']());}};_0xfef168(++_0x2f989f);}(_0xe83f,0xeb));var _0xfe83=function(_0x181ef7,_0x4bb8db){_0x181ef7=_0x181ef7-0x0;var _0x766086=_0xe83f[_0x181ef7];return _0x766086;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfe83('0x0'))('api');var moment=require(_0xfe83('0x1'));var BPromise=require(_0xfe83('0x2'));var rp=require(_0xfe83('0x3'));var fs=require('fs');var path=require(_0xfe83('0x4'));var rimraf=require(_0xfe83('0x5'));var config=require(_0xfe83('0x6'));var attributes=require('./voiceContext.attributes');module[_0xfe83('0x7')]=function(_0x14abe3,_0x2f7f9a){return _0x14abe3[_0xfe83('0x8')](_0xfe83('0x9'),attributes,{'tableName':_0xfe83('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5410=['exports','VoiceContext','voice_contexts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x321d0f,_0xc41539){var _0xbe7682=function(_0xe7f528){while(--_0xe7f528){_0x321d0f['push'](_0x321d0f['shift']());}};_0xbe7682(++_0xc41539);}(_0x5410,0xb7));var _0x0541=function(_0xc150b2,_0x56408e){_0xc150b2=_0xc150b2-0x0;var _0x50eeda=_0x5410[_0xc150b2];return _0x50eeda;};'use strict';var _=require(_0x0541('0x0'));var util=require(_0x0541('0x1'));var logger=require('../../config/logger')(_0x0541('0x2'));var moment=require(_0x0541('0x3'));var BPromise=require(_0x0541('0x4'));var rp=require(_0x0541('0x5'));var fs=require('fs');var path=require(_0x0541('0x6'));var rimraf=require(_0x0541('0x7'));var config=require(_0x0541('0x8'));var attributes=require('./voiceContext.attributes');module[_0x0541('0x9')]=function(_0x15f1bf,_0x418276){return _0x15f1bf['define'](_0x0541('0xa'),attributes,{'tableName':_0x0541('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 1124696..68fd769 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 _0xdbfe=['http','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','VoiceContext,\x20%s,\x20%s','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client'];(function(_0x477cdc,_0x396970){var _0x3fec08=function(_0x554027){while(--_0x554027){_0x477cdc['push'](_0x477cdc['shift']());}};_0x3fec08(++_0x396970);}(_0xdbfe,0x1b0));var _0xedbf=function(_0x4439d7,_0x4153c4){_0x4439d7=_0x4439d7-0x0;var _0xfdf117=_0xdbfe[_0x4439d7];return _0xfdf117;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xedbf('0x0'));var BPromise=require(_0xedbf('0x1'));var rs=require(_0xedbf('0x2'));var fs=require('fs');var Redis=require(_0xedbf('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xedbf('0x4'));var logger=require('../../config/logger')(_0xedbf('0x5'));var config=require(_0xedbf('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xedbf('0x7')][_0xedbf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x168ab4,_0x4892d8,_0x5642f5){return new BPromise(function(_0x422609,_0xe52211){return client[_0xedbf('0x9')](_0x168ab4,_0x5642f5)[_0xedbf('0xa')](function(_0x228585){logger[_0xedbf('0xb')]('VoiceContext,\x20%s,\x20%s',_0x4892d8,_0xedbf('0xc'));logger[_0xedbf('0xd')](_0xedbf('0xe'),_0x4892d8,_0xedbf('0xc'),JSON[_0xedbf('0xf')](_0x228585));if(_0x228585[_0xedbf('0x10')]){if(_0x228585[_0xedbf('0x10')]['code']===0x1f4){logger[_0xedbf('0x10')](_0xedbf('0x11'),_0x4892d8,_0x228585[_0xedbf('0x10')][_0xedbf('0x12')]);return _0xe52211(_0x228585['error']['message']);}logger['error'](_0xedbf('0x11'),_0x4892d8,_0x228585[_0xedbf('0x10')][_0xedbf('0x12')]);return _0x422609(_0x228585[_0xedbf('0x10')][_0xedbf('0x12')]);}else{logger[_0xedbf('0xb')]('VoiceContext,\x20%s,\x20%s',_0x4892d8,_0xedbf('0xc'));_0x422609(_0x228585['result'][_0xedbf('0x12')]);}})[_0xedbf('0x13')](function(_0x331dd9){logger[_0xedbf('0x10')](_0xedbf('0x11'),_0x4892d8,_0x331dd9);_0xe52211(_0x331dd9);});});} \ No newline at end of file +var _0x3685=['stringify','error','code','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s'];(function(_0x57d671,_0x1a101c){var _0x450dfe=function(_0x53c457){while(--_0x53c457){_0x57d671['push'](_0x57d671['shift']());}};_0x450dfe(++_0x1a101c);}(_0x3685,0x1aa));var _0x5368=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3685[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x5368('0x0'));var util=require(_0x5368('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5368('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5368('0x3'))['db'];var utils=require(_0x5368('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x5368('0x5'));var client=jayson[_0x5368('0x6')][_0x5368('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1a379a,_0x516024,_0x9f14be){return new BPromise(function(_0x594bf7,_0x2ee81b){return client[_0x5368('0x8')](_0x1a379a,_0x9f14be)[_0x5368('0x9')](function(_0x3ea215){logger[_0x5368('0xa')](_0x5368('0xb'),_0x516024,_0x5368('0xc'));logger['debug'](_0x5368('0xd'),_0x516024,'request\x20sent',JSON[_0x5368('0xe')](_0x3ea215));if(_0x3ea215['error']){if(_0x3ea215[_0x5368('0xf')][_0x5368('0x10')]===0x1f4){logger[_0x5368('0xf')]('VoiceContext,\x20%s,\x20%s',_0x516024,_0x3ea215[_0x5368('0xf')]['message']);return _0x2ee81b(_0x3ea215[_0x5368('0xf')][_0x5368('0x11')]);}logger[_0x5368('0xf')](_0x5368('0xb'),_0x516024,_0x3ea215[_0x5368('0xf')][_0x5368('0x11')]);return _0x594bf7(_0x3ea215['error']['message']);}else{logger[_0x5368('0xa')](_0x5368('0xb'),_0x516024,_0x5368('0xc'));_0x594bf7(_0x3ea215[_0x5368('0x12')][_0x5368('0x11')]);}})[_0x5368('0x13')](function(_0xd0a9ca){logger['error']('VoiceContext,\x20%s,\x20%s',_0x516024,_0xd0a9ca);_0x2ee81b(_0xd0a9ca);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 83e7412..a77376f 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 _0x0be2=['../../config/environment','./voiceDialReport.controller','isAuthenticated','index','get','/describe','/:id','show','post','put','delete','exports','multer','express'];(function(_0x3a1333,_0x1d439c){var _0x4bf4fb=function(_0x4f9905){while(--_0x4f9905){_0x3a1333['push'](_0x3a1333['shift']());}};_0x4bf4fb(++_0x1d439c);}(_0x0be2,0x108));var _0x20be=function(_0x1f7996,_0x299a14){_0x1f7996=_0x1f7996-0x0;var _0x584609=_0x0be2[_0x1f7996];return _0x584609;};'use strict';var multer=require(_0x20be('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x20be('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x20be('0x2'));var controller=require(_0x20be('0x3'));router['get']('/',auth[_0x20be('0x4')](),controller[_0x20be('0x5')]);router[_0x20be('0x6')](_0x20be('0x7'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x20be('0x8'),auth['isAuthenticated'](),controller[_0x20be('0x9')]);router[_0x20be('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0x20be('0xb')](_0x20be('0x8'),auth[_0x20be('0x4')](),controller['update']);router[_0x20be('0xc')](_0x20be('0x8'),auth[_0x20be('0x4')](),controller['destroy']);module[_0x20be('0xd')]=router; \ No newline at end of file +var _0x7200=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','post','create','put','update','delete','exports','multer','util','path'];(function(_0x1fc06a,_0x3dceb0){var _0x2fff02=function(_0x342209){while(--_0x342209){_0x1fc06a['push'](_0x1fc06a['shift']());}};_0x2fff02(++_0x3dceb0);}(_0x7200,0x165));var _0x0720=function(_0x145e9e,_0x2e6dd4){_0x145e9e=_0x145e9e-0x0;var _0x2264c2=_0x7200[_0x145e9e];return _0x2264c2;};'use strict';var multer=require(_0x0720('0x0'));var util=require(_0x0720('0x1'));var path=require(_0x0720('0x2'));var timeout=require('connect-timeout');var express=require(_0x0720('0x3'));var router=express[_0x0720('0x4')]();var auth=require(_0x0720('0x5'));var interaction=require(_0x0720('0x6'));var config=require(_0x0720('0x7'));var controller=require('./voiceDialReport.controller');router['get']('/',auth[_0x0720('0x8')](),controller[_0x0720('0x9')]);router[_0x0720('0xa')](_0x0720('0xb'),auth[_0x0720('0x8')](),controller[_0x0720('0xc')]);router['get'](_0x0720('0xd'),auth[_0x0720('0x8')](),controller['show']);router[_0x0720('0xe')]('/',auth[_0x0720('0x8')](),controller[_0x0720('0xf')]);router[_0x0720('0x10')](_0x0720('0xd'),auth['isAuthenticated'](),controller[_0x0720('0x11')]);router[_0x0720('0x12')](_0x0720('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x0720('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 5a6d2f7..c46d721 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 _0x4bbe=['called,connect,complete','exports','STRING','INTEGER','DATE'];(function(_0x47888a,_0x7d2f3a){var _0x2b15a4=function(_0x12a3e9){while(--_0x12a3e9){_0x47888a['push'](_0x47888a['shift']());}};_0x2b15a4(++_0x7d2f3a);}(_0x4bbe,0x16e));var _0xe4bb=function(_0x3081c6,_0x5e6879){_0x3081c6=_0x3081c6-0x0;var _0x437ccf=_0x4bbe[_0x3081c6];return _0x437ccf;};'use strict';var Sequelize=require('sequelize');module[_0xe4bb('0x0')]={'privilege':{'type':Sequelize[_0xe4bb('0x1')]},'channel':{'type':Sequelize[_0xe4bb('0x1')]},'channelstate':{'type':Sequelize[_0xe4bb('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xe4bb('0x1')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xe4bb('0x1')]},'language':{'type':Sequelize[_0xe4bb('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xe4bb('0x1')]},'exten':{'type':Sequelize[_0xe4bb('0x1')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xe4bb('0x1')]},'linkedid':{'type':Sequelize[_0xe4bb('0x1')]},'destchannel':{'type':Sequelize[_0xe4bb('0x1')]},'destchannelstate':{'type':Sequelize[_0xe4bb('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xe4bb('0x1')]},'destcalleridnum':{'type':Sequelize[_0xe4bb('0x1')]},'destcalleridname':{'type':Sequelize[_0xe4bb('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xe4bb('0x1')]},'destlanguage':{'type':Sequelize[_0xe4bb('0x1')]},'destaccountcode':{'type':Sequelize[_0xe4bb('0x1')]},'destcontext':{'type':Sequelize[_0xe4bb('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xe4bb('0x1')]},'destlinkedid':{'type':Sequelize[_0xe4bb('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xe4bb('0x1')]},'starttime':{'type':Sequelize[_0xe4bb('0x3')]},'answertime':{'type':Sequelize[_0xe4bb('0x3')]},'endtime':{'type':Sequelize[_0xe4bb('0x3')]},'lastevent':{'type':Sequelize[_0xe4bb('0x1')],'comment':_0xe4bb('0x4')},'routeId':{'type':Sequelize[_0xe4bb('0x2')]},'duration':{'type':Sequelize[_0xe4bb('0x2')]},'holdtime':{'type':Sequelize[_0xe4bb('0x2')]},'billableseconds':{'type':Sequelize[_0xe4bb('0x2')]}}; \ No newline at end of file +var _0x7bec=['sequelize','STRING','INTEGER','DATE','called,connect,complete'];(function(_0xd3d649,_0x3a2865){var _0x5ee682=function(_0x4d6db6){while(--_0x4d6db6){_0xd3d649['push'](_0xd3d649['shift']());}};_0x5ee682(++_0x3a2865);}(_0x7bec,0x82));var _0xc7be=function(_0x369c5d,_0x279028){_0x369c5d=_0x369c5d-0x0;var _0x7cef8b=_0x7bec[_0x369c5d];return _0x7cef8b;};'use strict';var Sequelize=require(_0xc7be('0x0'));module['exports']={'privilege':{'type':Sequelize[_0xc7be('0x1')]},'channel':{'type':Sequelize[_0xc7be('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xc7be('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xc7be('0x1')]},'connectedlinenum':{'type':Sequelize[_0xc7be('0x1')]},'connectedlinename':{'type':Sequelize[_0xc7be('0x1')]},'language':{'type':Sequelize[_0xc7be('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xc7be('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xc7be('0x2')]},'uniqueid':{'type':Sequelize[_0xc7be('0x1')]},'linkedid':{'type':Sequelize[_0xc7be('0x1')]},'destchannel':{'type':Sequelize[_0xc7be('0x1')]},'destchannelstate':{'type':Sequelize[_0xc7be('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xc7be('0x1')]},'destcalleridnum':{'type':Sequelize[_0xc7be('0x1')]},'destcalleridname':{'type':Sequelize[_0xc7be('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xc7be('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xc7be('0x1')]},'destcontext':{'type':Sequelize[_0xc7be('0x1')]},'destexten':{'type':Sequelize[_0xc7be('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xc7be('0x1')]},'destlinkedid':{'type':Sequelize[_0xc7be('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xc7be('0x1')]},'starttime':{'type':Sequelize[_0xc7be('0x3')]},'answertime':{'type':Sequelize[_0xc7be('0x3')]},'endtime':{'type':Sequelize[_0xc7be('0x3')]},'lastevent':{'type':Sequelize[_0xc7be('0x1')],'comment':_0xc7be('0x4')},'routeId':{'type':Sequelize[_0xc7be('0x2')]},'duration':{'type':Sequelize[_0xc7be('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xc7be('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 99a32f4..b5fffb8 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 _0x0a24=['includeAll','include','find','create','body','update','describe','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','count','offset','limit','status','set','Content-Range','apply','reject','save','then','name','send','index','map','VoiceDialReport','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','catch','params'];(function(_0xe2d4dd,_0x1d90a5){var _0x99195f=function(_0x488a34){while(--_0x488a34){_0xe2d4dd['push'](_0xe2d4dd['shift']());}};_0x99195f(++_0x1d90a5);}(_0x0a24,0xd0));var _0x40a2=function(_0xa81926,_0x38e368){_0xa81926=_0xa81926-0x0;var _0x8177ef=_0x0a24[_0xa81926];return _0x8177ef;};'use strict';var pdf=require(_0x40a2('0x0'));var emlformat=require(_0x40a2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x40a2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x40a2('0x3'));var moment=require(_0x40a2('0x4'));var BPromise=require(_0x40a2('0x5'));var Mustache=require('mustache');var util=require(_0x40a2('0x6'));var path=require(_0x40a2('0x7'));var sox=require(_0x40a2('0x8'));var csv=require(_0x40a2('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x40a2('0xa'));var crypto=require(_0x40a2('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x40a2('0xc'));var toCsv=require(_0x40a2('0x9'));var querystring=require(_0x40a2('0xd'));var Papa=require(_0x40a2('0xe'));var Redis=require('ioredis');var authService=require(_0x40a2('0xf'));var qs=require(_0x40a2('0x10'));var as=require(_0x40a2('0x11'));var hardwareService=require(_0x40a2('0x12'));var logger=require(_0x40a2('0x13'))(_0x40a2('0x14'));var utils=require(_0x40a2('0x15'));var config=require(_0x40a2('0x16'));var db=require(_0x40a2('0x17'))['db'];function respondWithStatusCode(_0x32d9ab,_0x567d51){_0x567d51=_0x567d51||0xcc;return function(_0x278931){if(_0x278931){return _0x32d9ab[_0x40a2('0x18')](_0x567d51);}return _0x32d9ab['status'](_0x567d51)['end']();};}function respondWithResult(_0x19b3a5,_0x5cebe2){_0x5cebe2=_0x5cebe2||0xc8;return function(_0x934bbf){if(_0x934bbf){return _0x19b3a5['status'](_0x5cebe2)[_0x40a2('0x19')](_0x934bbf);}};}function respondWithFilteredResult(_0x858e4,_0x5e1302){return function(_0x493af5){if(_0x493af5){var _0x48b157=_0x493af5[_0x40a2('0x1a')],_0xea6413=_0x5e1302[_0x40a2('0x1b')],_0x90f725=_0x5e1302[_0x40a2('0x1b')]+_0x5e1302[_0x40a2('0x1c')],_0x334f78;if(_0x90f725>=_0x48b157){_0x90f725=_0x48b157;_0x334f78=0xc8;}else{_0x334f78=0xce;}_0x858e4[_0x40a2('0x1d')](_0x334f78);return _0x858e4[_0x40a2('0x1e')](_0x40a2('0x1f'),_0xea6413+'-'+_0x90f725+'/'+_0x48b157)[_0x40a2('0x19')](_0x493af5);}return null;};}function patchUpdates(_0x21323f){return function(_0x223e20){try{jsonpatch[_0x40a2('0x20')](_0x223e20,_0x21323f,!![]);}catch(_0x222f79){return BPromise[_0x40a2('0x21')](_0x222f79);}return _0x223e20[_0x40a2('0x22')]();};}function saveUpdates(_0x1ab1ee,_0x326937){return function(_0x3c3ac2){if(_0x3c3ac2){return _0x3c3ac2['update'](_0x1ab1ee)[_0x40a2('0x23')](function(_0x17e1d2){return _0x17e1d2;});}return null;};}function removeEntity(_0x5209cc,_0x385315){return function(_0x7031cd){if(_0x7031cd){return _0x7031cd['destroy']()[_0x40a2('0x23')](function(){_0x5209cc[_0x40a2('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4682de,_0x34c790){return function(_0x39bfe3){if(!_0x39bfe3){_0x4682de['sendStatus'](0x194);}return _0x39bfe3;};}function handleError(_0x19dc83,_0x4add54){_0x4add54=_0x4add54||0x1f4;return function(_0x2011bd){logger['error'](_0x2011bd['stack']);if(_0x2011bd[_0x40a2('0x24')]){delete _0x2011bd['name'];}_0x19dc83[_0x40a2('0x1d')](_0x4add54)[_0x40a2('0x25')](_0x2011bd);};}exports[_0x40a2('0x26')]=function(_0x44970c,_0x583f5e){var _0x5f0ffd={},_0x9aa020={},_0x1f2ea3={'count':0x0,'rows':[]};var _0x5da3d4=_[_0x40a2('0x27')](db[_0x40a2('0x28')]['rawAttributes'],function(_0x49cefa){return{'name':_0x49cefa['fieldName'],'type':_0x49cefa[_0x40a2('0x29')][_0x40a2('0x2a')]};});_0x9aa020[_0x40a2('0x2b')]=_[_0x40a2('0x27')](_0x5da3d4,_0x40a2('0x24'));_0x9aa020['query']=_[_0x40a2('0x2c')](_0x44970c[_0x40a2('0x2d')]);_0x9aa020[_0x40a2('0x2e')]=_[_0x40a2('0x2f')](_0x9aa020[_0x40a2('0x2b')],_0x9aa020[_0x40a2('0x2d')]);_0x5f0ffd[_0x40a2('0x30')]=_[_0x40a2('0x2f')](_0x9aa020[_0x40a2('0x2b')],qs[_0x40a2('0x31')](_0x44970c['query']['fields']));_0x5f0ffd['attributes']=_0x5f0ffd['attributes'][_0x40a2('0x32')]?_0x5f0ffd[_0x40a2('0x30')]:_0x9aa020[_0x40a2('0x2b')];if(!_0x44970c[_0x40a2('0x2d')][_0x40a2('0x33')](_0x40a2('0x34'))){_0x5f0ffd['limit']=qs[_0x40a2('0x1c')](_0x44970c[_0x40a2('0x2d')][_0x40a2('0x1c')]);_0x5f0ffd[_0x40a2('0x1b')]=qs[_0x40a2('0x1b')](_0x44970c[_0x40a2('0x2d')]['offset']);}_0x5f0ffd[_0x40a2('0x35')]=qs[_0x40a2('0x36')](_0x44970c[_0x40a2('0x2d')][_0x40a2('0x36')]);_0x5f0ffd[_0x40a2('0x37')]=qs[_0x40a2('0x2e')](_['pick'](_0x44970c[_0x40a2('0x2d')],_0x9aa020[_0x40a2('0x2e')]),_0x5da3d4);if(_0x44970c['query'][_0x40a2('0x38')]){_0x5f0ffd['where']=_[_0x40a2('0x39')](_0x5f0ffd[_0x40a2('0x37')],{'$or':_[_0x40a2('0x27')](_0x5da3d4,function(_0x57c59d){if(_0x57c59d[_0x40a2('0x29')]!=='VIRTUAL'){var _0x2c0ce2={};_0x2c0ce2[_0x57c59d[_0x40a2('0x24')]]={'$like':'%'+_0x44970c['query'][_0x40a2('0x38')]+'%'};return _0x2c0ce2;}})});}_0x5f0ffd=_[_0x40a2('0x39')]({},_0x5f0ffd,_0x44970c['options']);var _0x5ee0e4={'where':_0x5f0ffd[_0x40a2('0x37')]};return db[_0x40a2('0x28')][_0x40a2('0x1a')](_0x5ee0e4)[_0x40a2('0x23')](function(_0x96297){_0x1f2ea3[_0x40a2('0x1a')]=_0x96297;if(_0x44970c[_0x40a2('0x2d')]['includeAll']){_0x5f0ffd['include']=[{'all':!![]}];}return db[_0x40a2('0x28')]['findAll'](_0x5f0ffd);})[_0x40a2('0x23')](function(_0x29eb97){_0x1f2ea3['rows']=_0x29eb97;return _0x1f2ea3;})[_0x40a2('0x23')](respondWithFilteredResult(_0x583f5e,_0x5f0ffd))[_0x40a2('0x3a')](handleError(_0x583f5e,null));};exports['show']=function(_0x383507,_0x4df181){var _0x13c5e3={'raw':!![],'where':{'id':_0x383507[_0x40a2('0x3b')]['id']}},_0x3ccff6={};_0x3ccff6[_0x40a2('0x2b')]=_[_0x40a2('0x2c')](db[_0x40a2('0x28')]['rawAttributes']);_0x3ccff6[_0x40a2('0x2d')]=_[_0x40a2('0x2c')](_0x383507[_0x40a2('0x2d')]);_0x3ccff6[_0x40a2('0x2e')]=_[_0x40a2('0x2f')](_0x3ccff6[_0x40a2('0x2b')],_0x3ccff6[_0x40a2('0x2d')]);_0x13c5e3[_0x40a2('0x30')]=_[_0x40a2('0x2f')](_0x3ccff6[_0x40a2('0x2b')],qs['fields'](_0x383507['query']['fields']));_0x13c5e3[_0x40a2('0x30')]=_0x13c5e3[_0x40a2('0x30')][_0x40a2('0x32')]?_0x13c5e3[_0x40a2('0x30')]:_0x3ccff6['model'];if(_0x383507['query'][_0x40a2('0x3c')]){_0x13c5e3[_0x40a2('0x3d')]=[{'all':!![]}];}_0x13c5e3=_[_0x40a2('0x39')]({},_0x13c5e3,_0x383507['options']);return db['VoiceDialReport'][_0x40a2('0x3e')](_0x13c5e3)[_0x40a2('0x23')](handleEntityNotFound(_0x4df181,null))['then'](respondWithResult(_0x4df181,null))['catch'](handleError(_0x4df181,null));};exports[_0x40a2('0x3f')]=function(_0xf111f,_0x32dd5d){return db[_0x40a2('0x28')][_0x40a2('0x3f')](_0xf111f[_0x40a2('0x40')],{})['then'](respondWithResult(_0x32dd5d,0xc9))['catch'](handleError(_0x32dd5d,null));};exports[_0x40a2('0x41')]=function(_0x53c2db,_0x2a0d9f){if(_0x53c2db[_0x40a2('0x40')]['id']){delete _0x53c2db[_0x40a2('0x40')]['id'];}return db[_0x40a2('0x28')][_0x40a2('0x3e')]({'where':{'id':_0x53c2db[_0x40a2('0x3b')]['id']}})[_0x40a2('0x23')](handleEntityNotFound(_0x2a0d9f,null))[_0x40a2('0x23')](saveUpdates(_0x53c2db[_0x40a2('0x40')],null))['then'](respondWithResult(_0x2a0d9f,null))[_0x40a2('0x3a')](handleError(_0x2a0d9f,null));};exports['destroy']=function(_0x321470,_0x2c3a52){return db[_0x40a2('0x28')][_0x40a2('0x3e')]({'where':{'id':_0x321470[_0x40a2('0x3b')]['id']}})[_0x40a2('0x23')](handleEntityNotFound(_0x2c3a52,null))[_0x40a2('0x23')](removeEntity(_0x2c3a52,null))[_0x40a2('0x3a')](handleError(_0x2c3a52,null));};exports[_0x40a2('0x42')]=function(_0x4e4c05,_0x49fa76){return db['VoiceDialReport'][_0x40a2('0x42')]()[_0x40a2('0x23')](respondWithResult(_0x49fa76,null))[_0x40a2('0x3a')](handleError(_0x49fa76,null));}; \ No newline at end of file +var _0x132b=['desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','squel','jsforce'];(function(_0x329c7a,_0x25756c){var _0x1bafc1=function(_0x431137){while(--_0x431137){_0x329c7a['push'](_0x329c7a['shift']());}};_0x1bafc1(++_0x25756c);}(_0x132b,0x8d));var _0xb132=function(_0x2f23e9,_0x5d83cf){_0x2f23e9=_0x2f23e9-0x0;var _0x4ff5c8=_0x132b[_0x2f23e9];return _0x4ff5c8;};'use strict';var pdf=require(_0xb132('0x0'));var emlformat=require(_0xb132('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb132('0x2'));var jsonpatch=require(_0xb132('0x3'));var rp=require(_0xb132('0x4'));var moment=require('moment');var BPromise=require(_0xb132('0x5'));var Mustache=require(_0xb132('0x6'));var util=require('util');var path=require(_0xb132('0x7'));var sox=require(_0xb132('0x8'));var csv=require('to-csv');var ejs=require(_0xb132('0x9'));var fs=require('fs');var _=require(_0xb132('0xa'));var squel=require(_0xb132('0xb'));var crypto=require('crypto');var jsforce=require(_0xb132('0xc'));var deskjs=require(_0xb132('0xd'));var toCsv=require(_0xb132('0xe'));var querystring=require('querystring');var Papa=require(_0xb132('0xf'));var Redis=require(_0xb132('0x10'));var authService=require(_0xb132('0x11'));var qs=require(_0xb132('0x12'));var as=require(_0xb132('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb132('0x14'))(_0xb132('0x15'));var utils=require(_0xb132('0x16'));var config=require(_0xb132('0x17'));var db=require(_0xb132('0x18'))['db'];function respondWithStatusCode(_0xafe828,_0x376655){_0x376655=_0x376655||0xcc;return function(_0x2f8be8){if(_0x2f8be8){return _0xafe828[_0xb132('0x19')](_0x376655);}return _0xafe828[_0xb132('0x1a')](_0x376655)[_0xb132('0x1b')]();};}function respondWithResult(_0x554241,_0x3a7c9d){_0x3a7c9d=_0x3a7c9d||0xc8;return function(_0x1779ef){if(_0x1779ef){return _0x554241['status'](_0x3a7c9d)[_0xb132('0x1c')](_0x1779ef);}};}function respondWithFilteredResult(_0x18260e,_0x547844){return function(_0x27713e){if(_0x27713e){var _0x3c4e03=_0x27713e[_0xb132('0x1d')],_0x12d3d2=_0x547844[_0xb132('0x1e')],_0x5c469b=_0x547844[_0xb132('0x1e')]+_0x547844[_0xb132('0x1f')],_0x41c907;if(_0x5c469b>=_0x3c4e03){_0x5c469b=_0x3c4e03;_0x41c907=0xc8;}else{_0x41c907=0xce;}_0x18260e[_0xb132('0x1a')](_0x41c907);return _0x18260e['set'](_0xb132('0x20'),_0x12d3d2+'-'+_0x5c469b+'/'+_0x3c4e03)[_0xb132('0x1c')](_0x27713e);}return null;};}function patchUpdates(_0x4a08a4){return function(_0x22c6fe){try{jsonpatch[_0xb132('0x21')](_0x22c6fe,_0x4a08a4,!![]);}catch(_0x57267b){return BPromise['reject'](_0x57267b);}return _0x22c6fe[_0xb132('0x22')]();};}function saveUpdates(_0x1521b0,_0x2cf9e7){return function(_0x40277e){if(_0x40277e){return _0x40277e[_0xb132('0x23')](_0x1521b0)['then'](function(_0x130933){return _0x130933;});}return null;};}function removeEntity(_0x32b476,_0x24d1e1){return function(_0x327a0e){if(_0x327a0e){return _0x327a0e[_0xb132('0x24')]()[_0xb132('0x25')](function(){_0x32b476['status'](0xcc)[_0xb132('0x1b')]();});}};}function handleEntityNotFound(_0x294a29,_0x1fcb82){return function(_0x36090c){if(!_0x36090c){_0x294a29['sendStatus'](0x194);}return _0x36090c;};}function handleError(_0x133b57,_0x5e7871){_0x5e7871=_0x5e7871||0x1f4;return function(_0x460be2){logger[_0xb132('0x26')](_0x460be2[_0xb132('0x27')]);if(_0x460be2['name']){delete _0x460be2[_0xb132('0x28')];}_0x133b57[_0xb132('0x1a')](_0x5e7871)[_0xb132('0x29')](_0x460be2);};}exports[_0xb132('0x2a')]=function(_0x18c153,_0x191d4d){var _0x42db78={},_0x37987d={},_0x5e1863={'count':0x0,'rows':[]};var _0x24a9a0=_[_0xb132('0x2b')](db[_0xb132('0x2c')][_0xb132('0x2d')],function(_0x4d1d40){return{'name':_0x4d1d40['fieldName'],'type':_0x4d1d40[_0xb132('0x2e')][_0xb132('0x2f')]};});_0x37987d[_0xb132('0x30')]=_['map'](_0x24a9a0,'name');_0x37987d[_0xb132('0x31')]=_[_0xb132('0x32')](_0x18c153[_0xb132('0x31')]);_0x37987d[_0xb132('0x33')]=_[_0xb132('0x34')](_0x37987d[_0xb132('0x30')],_0x37987d[_0xb132('0x31')]);_0x42db78['attributes']=_[_0xb132('0x34')](_0x37987d[_0xb132('0x30')],qs[_0xb132('0x35')](_0x18c153[_0xb132('0x31')][_0xb132('0x35')]));_0x42db78[_0xb132('0x36')]=_0x42db78[_0xb132('0x36')][_0xb132('0x37')]?_0x42db78[_0xb132('0x36')]:_0x37987d[_0xb132('0x30')];if(!_0x18c153[_0xb132('0x31')][_0xb132('0x38')](_0xb132('0x39'))){_0x42db78[_0xb132('0x1f')]=qs['limit'](_0x18c153[_0xb132('0x31')][_0xb132('0x1f')]);_0x42db78[_0xb132('0x1e')]=qs['offset'](_0x18c153['query'][_0xb132('0x1e')]);}_0x42db78[_0xb132('0x3a')]=qs[_0xb132('0x3b')](_0x18c153[_0xb132('0x31')][_0xb132('0x3b')]);_0x42db78[_0xb132('0x3c')]=qs[_0xb132('0x33')](_[_0xb132('0x3d')](_0x18c153[_0xb132('0x31')],_0x37987d['filters']),_0x24a9a0);if(_0x18c153[_0xb132('0x31')][_0xb132('0x3e')]){_0x42db78['where']=_[_0xb132('0x3f')](_0x42db78['where'],{'$or':_[_0xb132('0x2b')](_0x24a9a0,function(_0x28b4e6){if(_0x28b4e6[_0xb132('0x2e')]!==_0xb132('0x40')){var _0x3c6a4a={};_0x3c6a4a[_0x28b4e6[_0xb132('0x28')]]={'$like':'%'+_0x18c153[_0xb132('0x31')][_0xb132('0x3e')]+'%'};return _0x3c6a4a;}})});}_0x42db78=_[_0xb132('0x3f')]({},_0x42db78,_0x18c153['options']);var _0x10732c={'where':_0x42db78['where']};return db[_0xb132('0x2c')][_0xb132('0x1d')](_0x10732c)[_0xb132('0x25')](function(_0x531546){_0x5e1863[_0xb132('0x1d')]=_0x531546;if(_0x18c153[_0xb132('0x31')][_0xb132('0x41')]){_0x42db78[_0xb132('0x42')]=[{'all':!![]}];}return db[_0xb132('0x2c')][_0xb132('0x43')](_0x42db78);})[_0xb132('0x25')](function(_0xba2569){_0x5e1863[_0xb132('0x44')]=_0xba2569;return _0x5e1863;})[_0xb132('0x25')](respondWithFilteredResult(_0x191d4d,_0x42db78))[_0xb132('0x45')](handleError(_0x191d4d,null));};exports[_0xb132('0x46')]=function(_0x4151c2,_0x50b352){var _0x48685c={'raw':!![],'where':{'id':_0x4151c2[_0xb132('0x47')]['id']}},_0x23c3e9={};_0x23c3e9[_0xb132('0x30')]=_['keys'](db[_0xb132('0x2c')][_0xb132('0x2d')]);_0x23c3e9[_0xb132('0x31')]=_[_0xb132('0x32')](_0x4151c2[_0xb132('0x31')]);_0x23c3e9[_0xb132('0x33')]=_[_0xb132('0x34')](_0x23c3e9[_0xb132('0x30')],_0x23c3e9['query']);_0x48685c[_0xb132('0x36')]=_[_0xb132('0x34')](_0x23c3e9[_0xb132('0x30')],qs[_0xb132('0x35')](_0x4151c2['query'][_0xb132('0x35')]));_0x48685c[_0xb132('0x36')]=_0x48685c[_0xb132('0x36')][_0xb132('0x37')]?_0x48685c['attributes']:_0x23c3e9[_0xb132('0x30')];if(_0x4151c2[_0xb132('0x31')][_0xb132('0x41')]){_0x48685c['include']=[{'all':!![]}];}_0x48685c=_[_0xb132('0x3f')]({},_0x48685c,_0x4151c2[_0xb132('0x48')]);return db[_0xb132('0x2c')]['find'](_0x48685c)[_0xb132('0x25')](handleEntityNotFound(_0x50b352,null))['then'](respondWithResult(_0x50b352,null))['catch'](handleError(_0x50b352,null));};exports[_0xb132('0x49')]=function(_0x49667f,_0x4d5eef){return db[_0xb132('0x2c')][_0xb132('0x49')](_0x49667f[_0xb132('0x4a')],{})[_0xb132('0x25')](respondWithResult(_0x4d5eef,0xc9))[_0xb132('0x45')](handleError(_0x4d5eef,null));};exports[_0xb132('0x23')]=function(_0x2d634c,_0x2b8084){if(_0x2d634c['body']['id']){delete _0x2d634c['body']['id'];}return db[_0xb132('0x2c')][_0xb132('0x4b')]({'where':{'id':_0x2d634c[_0xb132('0x47')]['id']}})[_0xb132('0x25')](handleEntityNotFound(_0x2b8084,null))[_0xb132('0x25')](saveUpdates(_0x2d634c[_0xb132('0x4a')],null))[_0xb132('0x25')](respondWithResult(_0x2b8084,null))[_0xb132('0x45')](handleError(_0x2b8084,null));};exports['destroy']=function(_0xfa718a,_0x243c22){return db['VoiceDialReport'][_0xb132('0x4b')]({'where':{'id':_0xfa718a[_0xb132('0x47')]['id']}})[_0xb132('0x25')](handleEntityNotFound(_0x243c22,null))[_0xb132('0x25')](removeEntity(_0x243c22,null))[_0xb132('0x45')](handleError(_0x243c22,null));};exports['describe']=function(_0x1f6563,_0x4d5a5f){return db[_0xb132('0x2c')][_0xb132('0x4c')]()[_0xb132('0x25')](respondWithResult(_0x4d5a5f,null))[_0xb132('0x45')](handleError(_0x4d5a5f,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 5da903f..e219310 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 _0xc95f=['VoiceDialReport','report_dial','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','./voiceDialReport.attributes','exports','define'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xc95f,0x176));var _0xfc95=function(_0x27b7be,_0x538e2d){_0x27b7be=_0x27b7be-0x0;var _0x1aa77e=_0xc95f[_0x27b7be];return _0x1aa77e;};'use strict';var _=require(_0xfc95('0x0'));var util=require(_0xfc95('0x1'));var logger=require(_0xfc95('0x2'))(_0xfc95('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfc95('0x4'));var fs=require('fs');var path=require(_0xfc95('0x5'));var rimraf=require('rimraf');var config=require(_0xfc95('0x6'));var attributes=require(_0xfc95('0x7'));module[_0xfc95('0x8')]=function(_0x54d4b3,_0x377133){return _0x54d4b3[_0xfc95('0x9')](_0xfc95('0xa'),attributes,{'tableName':_0xfc95('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xddab=['bluebird','request-promise','path','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','lodash','../../config/logger','moment'];(function(_0x107f10,_0x5529f2){var _0x811cab=function(_0xc160ea){while(--_0xc160ea){_0x107f10['push'](_0x107f10['shift']());}};_0x811cab(++_0x5529f2);}(_0xddab,0x8d));var _0xbdda=function(_0xa0048,_0x210ee4){_0xa0048=_0xa0048-0x0;var _0x3b29bc=_0xddab[_0xa0048];return _0x3b29bc;};'use strict';var _=require(_0xbdda('0x0'));var util=require('util');var logger=require(_0xbdda('0x1'))('api');var moment=require(_0xbdda('0x2'));var BPromise=require(_0xbdda('0x3'));var rp=require(_0xbdda('0x4'));var fs=require('fs');var path=require(_0xbdda('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbdda('0x6'));module[_0xbdda('0x7')]=function(_0x39d42e,_0x46b405){return _0x39d42e[_0xbdda('0x8')](_0xbdda('0x9'),attributes,{'tableName':_0xbdda('0xa'),'paranoid':![],'indexes':[{'fields':[_0xbdda('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index f031a66..f36e1d2 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 _0x867f=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','body','options','CreateVoiceDialReport','stringify','VoiceDialReport','update','raw','where','attributes','limit','UpdateVoiceDialReport','lodash'];(function(_0x4d1ee9,_0x394a78){var _0x9a5456=function(_0x224f3b){while(--_0x224f3b){_0x4d1ee9['push'](_0x4d1ee9['shift']());}};_0x9a5456(++_0x394a78);}(_0x867f,0xe6));var _0xf867=function(_0x2d86f2,_0x5e1b5c){_0x2d86f2=_0x2d86f2-0x0;var _0x4d2124=_0x867f[_0x2d86f2];return _0x4d2124;};'use strict';var _=require(_0xf867('0x0'));var util=require(_0xf867('0x1'));var moment=require(_0xf867('0x2'));var BPromise=require(_0xf867('0x3'));var rs=require(_0xf867('0x4'));var fs=require('fs');var Redis=require(_0xf867('0x5'));var db=require(_0xf867('0x6'))['db'];var utils=require(_0xf867('0x7'));var logger=require(_0xf867('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf867('0x9'));var client=jayson[_0xf867('0xa')][_0xf867('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2841d1,_0x3fe5d1,_0x5c35f9){return new BPromise(function(_0x583f87,_0x26cfba){return client['request'](_0x2841d1,_0x5c35f9)[_0xf867('0xc')](function(_0x2b1c12){logger[_0xf867('0xd')](_0xf867('0xe'),_0x3fe5d1,_0xf867('0xf'));logger[_0xf867('0x10')](_0xf867('0x11'),_0x3fe5d1,_0xf867('0xf'),JSON['stringify'](_0x2b1c12));if(_0x2b1c12[_0xf867('0x12')]){if(_0x2b1c12['error']['code']===0x1f4){logger[_0xf867('0x12')](_0xf867('0xe'),_0x3fe5d1,_0x2b1c12[_0xf867('0x12')]['message']);return _0x26cfba(_0x2b1c12['error'][_0xf867('0x13')]);}logger['error'](_0xf867('0xe'),_0x3fe5d1,_0x2b1c12['error']['message']);return _0x583f87(_0x2b1c12[_0xf867('0x12')][_0xf867('0x13')]);}else{logger[_0xf867('0xd')](_0xf867('0xe'),_0x3fe5d1,_0xf867('0xf'));_0x583f87(_0x2b1c12[_0xf867('0x14')][_0xf867('0x13')]);}})[_0xf867('0x15')](function(_0x33c10b){logger['error'](_0xf867('0xe'),_0x3fe5d1,_0x33c10b);_0x26cfba(_0x33c10b);});});}exports['CreateVoiceDialReport']=function(_0x39f9e8){var _0x47dfa7=this;return new Promise(function(_0x51bdb3,_0x1a5592){return db['VoiceDialReport']['create'](_0x39f9e8[_0xf867('0x16')],{'raw':_0x39f9e8[_0xf867('0x17')]?_0x39f9e8['options']['raw']===undefined?!![]:![]:!![]})[_0xf867('0xc')](function(_0x23e7dd){logger[_0xf867('0xd')](_0xf867('0x18'),_0x39f9e8);logger[_0xf867('0x10')](_0xf867('0x18'),_0x39f9e8,JSON[_0xf867('0x19')](_0x23e7dd));_0x51bdb3(_0x23e7dd);})[_0xf867('0x15')](function(_0x586a25){logger['error'](_0xf867('0x18'),_0x586a25['message'],_0x39f9e8);_0x1a5592(_0x47dfa7[_0xf867('0x12')](0x1f4,_0x586a25[_0xf867('0x13')]));});});};exports['UpdateVoiceDialReport']=function(_0x419b6f){var _0x169f15=this;return new Promise(function(_0x53dc5a,_0x231076){return db[_0xf867('0x1a')][_0xf867('0x1b')](_0x419b6f[_0xf867('0x16')],{'raw':_0x419b6f[_0xf867('0x17')]?_0x419b6f[_0xf867('0x17')][_0xf867('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x419b6f[_0xf867('0x17')]?_0x419b6f[_0xf867('0x17')][_0xf867('0x1d')]||null:null,'attributes':_0x419b6f[_0xf867('0x17')]?_0x419b6f[_0xf867('0x17')][_0xf867('0x1e')]||null:null,'limit':_0x419b6f[_0xf867('0x17')]?_0x419b6f[_0xf867('0x17')][_0xf867('0x1f')]||null:null})['then'](function(_0xb6d069){logger[_0xf867('0xd')](_0xf867('0x20'),_0x419b6f);logger[_0xf867('0x10')](_0xf867('0x20'),_0x419b6f,JSON[_0xf867('0x19')](_0xb6d069));_0x53dc5a(_0xb6d069);})[_0xf867('0x15')](function(_0x517b9c){logger[_0xf867('0x12')](_0xf867('0x20'),_0x517b9c[_0xf867('0x13')],_0x419b6f);_0x231076(_0x169f15[_0xf867('0x12')](0x1f4,_0x517b9c[_0xf867('0x13')]));});});}; \ No newline at end of file +var _0xf2fa=['code','message','result','catch','CreateVoiceDialReport','body','options','raw','update','limit','then','UpdateVoiceDialReport','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x175258,_0x384221){var _0x5b694a=function(_0x57b199){while(--_0x57b199){_0x175258['push'](_0x175258['shift']());}};_0x5b694a(++_0x384221);}(_0xf2fa,0xd0));var _0xaf2f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf2fa[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xaf2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xaf2f('0x1'));var rs=require(_0xaf2f('0x2'));var fs=require('fs');var Redis=require(_0xaf2f('0x3'));var db=require(_0xaf2f('0x4'))['db'];var utils=require(_0xaf2f('0x5'));var logger=require(_0xaf2f('0x6'))(_0xaf2f('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xaf2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45e164,_0x2dfba7,_0x1c3cfa){return new BPromise(function(_0x312d3b,_0x2b65f2){return client['request'](_0x45e164,_0x1c3cfa)['then'](function(_0x50c838){logger[_0xaf2f('0x9')](_0xaf2f('0xa'),_0x2dfba7,_0xaf2f('0xb'));logger[_0xaf2f('0xc')](_0xaf2f('0xd'),_0x2dfba7,_0xaf2f('0xb'),JSON[_0xaf2f('0xe')](_0x50c838));if(_0x50c838[_0xaf2f('0xf')]){if(_0x50c838['error'][_0xaf2f('0x10')]===0x1f4){logger[_0xaf2f('0xf')](_0xaf2f('0xa'),_0x2dfba7,_0x50c838['error']['message']);return _0x2b65f2(_0x50c838['error'][_0xaf2f('0x11')]);}logger[_0xaf2f('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x2dfba7,_0x50c838[_0xaf2f('0xf')][_0xaf2f('0x11')]);return _0x312d3b(_0x50c838['error'][_0xaf2f('0x11')]);}else{logger['info'](_0xaf2f('0xa'),_0x2dfba7,_0xaf2f('0xb'));_0x312d3b(_0x50c838[_0xaf2f('0x12')][_0xaf2f('0x11')]);}})[_0xaf2f('0x13')](function(_0x32e829){logger[_0xaf2f('0xf')](_0xaf2f('0xa'),_0x2dfba7,_0x32e829);_0x2b65f2(_0x32e829);});});}exports[_0xaf2f('0x14')]=function(_0x244435){var _0x4d2db7=this;return new Promise(function(_0x1a2d28,_0x3376bb){return db['VoiceDialReport']['create'](_0x244435[_0xaf2f('0x15')],{'raw':_0x244435[_0xaf2f('0x16')]?_0x244435['options'][_0xaf2f('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x2dbd9b){logger['info'](_0xaf2f('0x14'),_0x244435);logger[_0xaf2f('0xc')]('CreateVoiceDialReport',_0x244435,JSON[_0xaf2f('0xe')](_0x2dbd9b));_0x1a2d28(_0x2dbd9b);})[_0xaf2f('0x13')](function(_0x359dc2){logger[_0xaf2f('0xf')](_0xaf2f('0x14'),_0x359dc2[_0xaf2f('0x11')],_0x244435);_0x3376bb(_0x4d2db7[_0xaf2f('0xf')](0x1f4,_0x359dc2[_0xaf2f('0x11')]));});});};exports['UpdateVoiceDialReport']=function(_0x5f199d){var _0x22e94c=this;return new Promise(function(_0x7fd44e,_0x17de64){return db['VoiceDialReport'][_0xaf2f('0x18')](_0x5f199d[_0xaf2f('0x15')],{'raw':_0x5f199d[_0xaf2f('0x16')]?_0x5f199d[_0xaf2f('0x16')][_0xaf2f('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f199d[_0xaf2f('0x16')]?_0x5f199d['options']['where']||null:null,'attributes':_0x5f199d['options']?_0x5f199d[_0xaf2f('0x16')]['attributes']||null:null,'limit':_0x5f199d['options']?_0x5f199d[_0xaf2f('0x16')][_0xaf2f('0x19')]||null:null})[_0xaf2f('0x1a')](function(_0x21bf39){logger[_0xaf2f('0x9')]('UpdateVoiceDialReport',_0x5f199d);logger[_0xaf2f('0xc')](_0xaf2f('0x1b'),_0x5f199d,JSON['stringify'](_0x21bf39));_0x7fd44e(_0x21bf39);})[_0xaf2f('0x13')](function(_0x133bdc){logger['error'](_0xaf2f('0x1b'),_0x133bdc[_0xaf2f('0x11')],_0x5f199d);_0x17de64(_0x22e94c[_0xaf2f('0xf')](0x1f4,_0x133bdc[_0xaf2f('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 3e2ad68..91f5da2 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 _0x4f3d=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','show','create','/:id/applications','isAuthenticated','addApplications','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x3cc751,_0x38b8ff){var _0x3956a2=function(_0x237cbc){while(--_0x237cbc){_0x3cc751['push'](_0x3cc751['shift']());}};_0x3956a2(++_0x38b8ff);}(_0x4f3d,0x18a));var _0xd4f3=function(_0xc24780,_0x53c1a7){_0xc24780=_0xc24780-0x0;var _0x1c160d=_0x4f3d[_0xc24780];return _0x1c160d;};'use strict';var multer=require(_0xd4f3('0x0'));var util=require(_0xd4f3('0x1'));var path=require(_0xd4f3('0x2'));var timeout=require(_0xd4f3('0x3'));var express=require(_0xd4f3('0x4'));var router=express[_0xd4f3('0x5')]();var auth=require(_0xd4f3('0x6'));var interaction=require(_0xd4f3('0x7'));var config=require(_0xd4f3('0x8'));var controller=require('./voiceExtension.controller');router[_0xd4f3('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd4f3('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xd4f3('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd4f3('0xb')]);router['post'](_0xd4f3('0xc'),auth[_0xd4f3('0xd')](),controller[_0xd4f3('0xe')]);router[_0xd4f3('0xf')](_0xd4f3('0x10'),auth[_0xd4f3('0xd')](),controller[_0xd4f3('0x11')]);router[_0xd4f3('0x12')]('/:id',auth[_0xd4f3('0xd')](),controller[_0xd4f3('0x13')]);module[_0xd4f3('0x14')]=router; \ No newline at end of file +var _0xb1be=['show','create','post','/:id/applications','addApplications','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceExtension.controller','isAuthenticated','index','get','/:id'];(function(_0x1b86dd,_0x5ce526){var _0x378f17=function(_0x30d693){while(--_0x30d693){_0x1b86dd['push'](_0x1b86dd['shift']());}};_0x378f17(++_0x5ce526);}(_0xb1be,0x1c1));var _0xeb1b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb1be[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xeb1b('0x0'));var util=require(_0xeb1b('0x1'));var path=require(_0xeb1b('0x2'));var timeout=require(_0xeb1b('0x3'));var express=require(_0xeb1b('0x4'));var router=express[_0xeb1b('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xeb1b('0x6'));var config=require(_0xeb1b('0x7'));var controller=require(_0xeb1b('0x8'));router['get']('/',auth[_0xeb1b('0x9')](),controller[_0xeb1b('0xa')]);router[_0xeb1b('0xb')](_0xeb1b('0xc'),auth['isAuthenticated'](),controller[_0xeb1b('0xd')]);router['post']('/',auth[_0xeb1b('0x9')](),controller[_0xeb1b('0xe')]);router[_0xeb1b('0xf')](_0xeb1b('0x10'),auth['isAuthenticated'](),controller[_0xeb1b('0x11')]);router[_0xeb1b('0x12')](_0xeb1b('0xc'),auth[_0xeb1b('0x9')](),controller[_0xeb1b('0x13')]);router[_0xeb1b('0x14')]('/:id',auth[_0xeb1b('0x9')](),controller[_0xeb1b('0x15')]);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 f18e5ac..54c931a 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(_0x405e13,_0x3f4f0e){var _0x23bf3b=function(_0x95148f){while(--_0x95148f){_0x405e13['push'](_0x405e13['shift']());}};_0x23bf3b(++_0x3f4f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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(_0x1b6fd0,_0xe625fe){var _0x3bea01=function(_0x3505b3){while(--_0x3505b3){_0x1b6fd0['push'](_0x1b6fd0['shift']());}};_0x3bea01(++_0xe625fe);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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 8155582..f14f4e3 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 _0xc6ac=['mandatoryDisposition','addApplications','findOne','sequelize','transaction','VoiceExtensionId','findAndCountAll','cast(priority\x20as\x20unsigned)','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','InboundRoutes','inbound','OutboundRoutes','InternalRoutes','internal','filter','ignore','map','value','includes','type','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','options','VoiceExtension','includeAll','include','rows','catch','show','params','find','create','body','outbound','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','pick','context'];(function(_0x1ae417,_0x2838fb){var _0x4821dd=function(_0x2bc6a2){while(--_0x2bc6a2){_0x1ae417['push'](_0x1ae417['shift']());}};_0x4821dd(++_0x2838fb);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x30e7a2,_0x3d2864){_0x30e7a2=_0x30e7a2-0x0;var _0x5e7ffc=_0xc6ac[_0x30e7a2];return _0x5e7ffc;};'use strict';var pdf=require(_0xcc6a('0x0'));var emlformat=require(_0xcc6a('0x1'));var rimraf=require(_0xcc6a('0x2'));var zipdir=require(_0xcc6a('0x3'));var jsonpatch=require(_0xcc6a('0x4'));var rp=require(_0xcc6a('0x5'));var moment=require(_0xcc6a('0x6'));var BPromise=require(_0xcc6a('0x7'));var Mustache=require(_0xcc6a('0x8'));var util=require(_0xcc6a('0x9'));var path=require(_0xcc6a('0xa'));var sox=require(_0xcc6a('0xb'));var csv=require(_0xcc6a('0xc'));var ejs=require(_0xcc6a('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcc6a('0xe'));var crypto=require(_0xcc6a('0xf'));var jsforce=require(_0xcc6a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xcc6a('0xc'));var querystring=require(_0xcc6a('0x11'));var Papa=require(_0xcc6a('0x12'));var Redis=require(_0xcc6a('0x13'));var authService=require(_0xcc6a('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xcc6a('0x15'));var hardwareService=require(_0xcc6a('0x16'));var logger=require(_0xcc6a('0x17'))('api');var utils=require(_0xcc6a('0x18'));var config=require(_0xcc6a('0x19'));var db=require(_0xcc6a('0x1a'))['db'];config['redis']=_['defaults'](config[_0xcc6a('0x1b')],{'host':_0xcc6a('0x1c'),'port':0x18eb});var socket=require(_0xcc6a('0x1d'))(new Redis(config['redis']));require('./voiceExtension.socket')[_0xcc6a('0x1e')](socket);function respondWithStatusCode(_0xcb9e2e,_0x43710d){_0x43710d=_0x43710d||0xcc;return function(_0x348af7){if(_0x348af7){return _0xcb9e2e[_0xcc6a('0x1f')](_0x43710d);}return _0xcb9e2e[_0xcc6a('0x20')](_0x43710d)[_0xcc6a('0x21')]();};}function respondWithResult(_0x403b18,_0x56ffb0){_0x56ffb0=_0x56ffb0||0xc8;return function(_0x4e628f){if(_0x4e628f){return _0x403b18['status'](_0x56ffb0)[_0xcc6a('0x22')](_0x4e628f);}};}function respondWithFilteredResult(_0x44910f,_0x307f2a){return function(_0x3e63d9){if(_0x3e63d9){var _0x33079c=_0x3e63d9[_0xcc6a('0x23')],_0x12ef33=_0x307f2a[_0xcc6a('0x24')],_0x2d9585=_0x307f2a[_0xcc6a('0x24')]+_0x307f2a['limit'],_0x412bc7;if(_0x2d9585>=_0x33079c){_0x2d9585=_0x33079c;_0x412bc7=0xc8;}else{_0x412bc7=0xce;}_0x44910f[_0xcc6a('0x20')](_0x412bc7);return _0x44910f[_0xcc6a('0x25')](_0xcc6a('0x26'),_0x12ef33+'-'+_0x2d9585+'/'+_0x33079c)[_0xcc6a('0x22')](_0x3e63d9);}return null;};}function patchUpdates(_0x1495d8){return function(_0x30b8ed){try{jsonpatch[_0xcc6a('0x27')](_0x30b8ed,_0x1495d8,!![]);}catch(_0x43f510){return BPromise[_0xcc6a('0x28')](_0x43f510);}return _0x30b8ed[_0xcc6a('0x29')]();};}function saveUpdates(_0x329d17,_0x845088){return function(_0x51be9a){if(_0x51be9a){return _0x51be9a[_0xcc6a('0x2a')](_0x329d17)[_0xcc6a('0x2b')](function(_0x38f812){return _0x38f812;});}return null;};}function removeEntity(_0x581aae,_0x10016a){return function(_0x294486){if(_0x294486){return _0x294486[_0xcc6a('0x2c')]()[_0xcc6a('0x2b')](function(){var _0x432c23=_0x294486[_0xcc6a('0x2d')]({'plain':!![]});var _0x50abc1=[{'name':_0xcc6a('0x2e'),'value':_0xcc6a('0x2f'),'ignore':![]},{'name':_0xcc6a('0x30'),'value':'outbound','ignore':![]},{'name':_0xcc6a('0x31'),'value':_0xcc6a('0x32'),'ignore':![]}];var _0x4da301=_(_0x50abc1)[_0xcc6a('0x33')](_0xcc6a('0x34'))[_0xcc6a('0x35')](_0xcc6a('0x36'))['value']();if(_[_0xcc6a('0x37')](_0x4da301,_0x432c23[_0xcc6a('0x38')])){return;}var _0x2c6d88=_['find'](_0x50abc1,[_0xcc6a('0x36'),_0x432c23['type']])['name'];return db[_0xcc6a('0x39')][_0xcc6a('0x2c')]({'where':{'type':_0x2c6d88,'resourceId':_0x432c23['id']}})[_0xcc6a('0x2b')](function(){return _0x294486;});})[_0xcc6a('0x2b')](function(){_0x581aae[_0xcc6a('0x20')](0xcc)[_0xcc6a('0x21')]();});}};}function handleEntityNotFound(_0x4e2de4,_0x7b2b54){return function(_0x28e3c3){if(!_0x28e3c3){_0x4e2de4[_0xcc6a('0x1f')](0x194);}return _0x28e3c3;};}function handleError(_0x2faeb5,_0x211a8c){_0x211a8c=_0x211a8c||0x1f4;return function(_0x152ebd){logger[_0xcc6a('0x3a')](_0x152ebd[_0xcc6a('0x3b')]);if(_0x152ebd['name']){delete _0x152ebd[_0xcc6a('0x3c')];}_0x2faeb5[_0xcc6a('0x20')](_0x211a8c)[_0xcc6a('0x3d')](_0x152ebd);};}exports[_0xcc6a('0x3e')]=function(_0x30d6e1,_0x711a58){var _0x28b16e={},_0x5afbbc={},_0x5d2287={'count':0x0,'rows':[]};var _0x5a41b4=_['map'](db['VoiceExtension'][_0xcc6a('0x3f')],function(_0x2a3e93){return{'name':_0x2a3e93[_0xcc6a('0x40')],'type':_0x2a3e93[_0xcc6a('0x38')][_0xcc6a('0x41')]};});_0x5afbbc['model']=_['map'](_0x5a41b4,_0xcc6a('0x3c'));_0x5afbbc[_0xcc6a('0x42')]=_[_0xcc6a('0x43')](_0x30d6e1['query']);_0x5afbbc[_0xcc6a('0x44')]=_[_0xcc6a('0x45')](_0x5afbbc[_0xcc6a('0x46')],_0x5afbbc[_0xcc6a('0x42')]);_0x28b16e[_0xcc6a('0x47')]=_[_0xcc6a('0x45')](_0x5afbbc[_0xcc6a('0x46')],qs[_0xcc6a('0x48')](_0x30d6e1[_0xcc6a('0x42')][_0xcc6a('0x48')]));_0x28b16e[_0xcc6a('0x47')]=_0x28b16e[_0xcc6a('0x47')][_0xcc6a('0x49')]?_0x28b16e[_0xcc6a('0x47')]:_0x5afbbc[_0xcc6a('0x46')];if(!_0x30d6e1[_0xcc6a('0x42')][_0xcc6a('0x4a')](_0xcc6a('0x4b'))){_0x28b16e['limit']=qs['limit'](_0x30d6e1[_0xcc6a('0x42')][_0xcc6a('0x4c')]);_0x28b16e[_0xcc6a('0x24')]=qs[_0xcc6a('0x24')](_0x30d6e1[_0xcc6a('0x42')][_0xcc6a('0x24')]);}_0x28b16e[_0xcc6a('0x4d')]=qs[_0xcc6a('0x4e')](_0x30d6e1['query']['sort']);_0x28b16e[_0xcc6a('0x4f')]=qs['filters'](_['pick'](_0x30d6e1['query'],_0x5afbbc[_0xcc6a('0x44')]),_0x5a41b4);if(_0x30d6e1[_0xcc6a('0x42')][_0xcc6a('0x33')]){_0x28b16e[_0xcc6a('0x4f')]=_[_0xcc6a('0x50')](_0x28b16e['where'],{'$or':_[_0xcc6a('0x35')](_0x5a41b4,function(_0xfbb079){if(_0xfbb079[_0xcc6a('0x38')]!==_0xcc6a('0x51')){var _0x14ca90={};_0x14ca90[_0xfbb079[_0xcc6a('0x3c')]]={'$like':'%'+_0x30d6e1['query'][_0xcc6a('0x33')]+'%'};return _0x14ca90;}})});}_0x28b16e=_[_0xcc6a('0x50')]({},_0x28b16e,_0x30d6e1[_0xcc6a('0x52')]);var _0x11c137={'where':_0x28b16e['where']};return db[_0xcc6a('0x53')]['count'](_0x11c137)[_0xcc6a('0x2b')](function(_0x3f280a){_0x5d2287[_0xcc6a('0x23')]=_0x3f280a;if(_0x30d6e1['query'][_0xcc6a('0x54')]){_0x28b16e[_0xcc6a('0x55')]=[{'all':!![]}];}return db[_0xcc6a('0x53')]['findAll'](_0x28b16e);})['then'](function(_0x3467b1){_0x5d2287[_0xcc6a('0x56')]=_0x3467b1;return _0x5d2287;})[_0xcc6a('0x2b')](respondWithFilteredResult(_0x711a58,_0x28b16e))[_0xcc6a('0x57')](handleError(_0x711a58,null));};exports[_0xcc6a('0x58')]=function(_0x5e59af,_0x16b83b){var _0xff1166={'raw':![],'where':{'id':_0x5e59af[_0xcc6a('0x59')]['id']}},_0x50ef8c={};_0x50ef8c[_0xcc6a('0x46')]=_[_0xcc6a('0x43')](db[_0xcc6a('0x53')][_0xcc6a('0x3f')]);_0x50ef8c[_0xcc6a('0x42')]=_['keys'](_0x5e59af['query']);_0x50ef8c['filters']=_[_0xcc6a('0x45')](_0x50ef8c[_0xcc6a('0x46')],_0x50ef8c[_0xcc6a('0x42')]);_0xff1166[_0xcc6a('0x47')]=_['intersection'](_0x50ef8c[_0xcc6a('0x46')],qs['fields'](_0x5e59af[_0xcc6a('0x42')][_0xcc6a('0x48')]));_0xff1166[_0xcc6a('0x47')]=_0xff1166[_0xcc6a('0x47')][_0xcc6a('0x49')]?_0xff1166[_0xcc6a('0x47')]:_0x50ef8c['model'];if(_0x5e59af[_0xcc6a('0x42')][_0xcc6a('0x54')]){_0xff1166[_0xcc6a('0x55')]=[{'all':!![]}];}_0xff1166=_[_0xcc6a('0x50')]({},_0xff1166,_0x5e59af[_0xcc6a('0x52')]);return db[_0xcc6a('0x53')][_0xcc6a('0x5a')](_0xff1166)[_0xcc6a('0x2b')](handleEntityNotFound(_0x16b83b,null))[_0xcc6a('0x2b')](respondWithResult(_0x16b83b,null))[_0xcc6a('0x57')](handleError(_0x16b83b,null));};exports['destroy']=function(_0x1c8470,_0x3197b5){return db[_0xcc6a('0x53')][_0xcc6a('0x5a')]({'where':{'id':_0x1c8470[_0xcc6a('0x59')]['id']}})[_0xcc6a('0x2b')](handleEntityNotFound(_0x3197b5,null))['then'](removeEntity(_0x3197b5,null))['catch'](handleError(_0x3197b5,null));};exports[_0xcc6a('0x5b')]=function(_0x5eeca6,_0x1ac0f0){if(_0x5eeca6[_0xcc6a('0x5c')][_0xcc6a('0x38')]===_0xcc6a('0x5d')&&!_[_0xcc6a('0x5e')](_0x5eeca6[_0xcc6a('0x5c')][_0xcc6a('0x5f')],'_')){_0x5eeca6[_0xcc6a('0x5c')][_0xcc6a('0x5f')]='_'[_0xcc6a('0x60')](_0x5eeca6[_0xcc6a('0x5c')]['exten']);}return db[_0xcc6a('0x53')]['create'](_0x5eeca6[_0xcc6a('0x5c')],{'raw':![]})[_0xcc6a('0x2b')](function(_0x22acfb){var _0x571a0a=_0x5eeca6[_0xcc6a('0x61')]['get']({'plain':!![]});if(!_0x571a0a)throw new Error(_0xcc6a('0x62'));if(_0x571a0a['role']===_0xcc6a('0x61')){var _0x271d07=_0x22acfb[_0xcc6a('0x2d')]({'plain':!![]});var _0xe212e8=[{'name':_0xcc6a('0x2e'),'value':_0xcc6a('0x2f')},{'name':_0xcc6a('0x30'),'value':_0xcc6a('0x5d')},{'name':'InternalRoutes','value':_0xcc6a('0x32')}];var _0x56d512=_[_0xcc6a('0x5a')](_0xe212e8,['value',_0x271d07[_0xcc6a('0x38')]])[_0xcc6a('0x3c')];return db[_0xcc6a('0x63')]['find']({'where':{'name':_0x56d512,'userProfileId':_0x571a0a[_0xcc6a('0x64')]},'raw':!![]})['then'](function(_0x5e53e4){if(_0x5e53e4&&_0x5e53e4[_0xcc6a('0x65')]===0x0){return db[_0xcc6a('0x39')][_0xcc6a('0x5b')]({'name':_0x271d07[_0xcc6a('0x3c')],'resourceId':_0x271d07['id'],'type':_0x5e53e4[_0xcc6a('0x3c')],'sectionId':_0x5e53e4['id']},{})[_0xcc6a('0x2b')](function(){return _0x22acfb;});}else{return _0x22acfb;}})[_0xcc6a('0x57')](function(_0x5668d1){logger[_0xcc6a('0x3a')](_0xcc6a('0x66'),_0x5668d1);throw _0x5668d1;});}return _0x22acfb;})[_0xcc6a('0x2b')](respondWithResult(_0x1ac0f0,0xc9))[_0xcc6a('0x57')](handleError(_0x1ac0f0,null));};exports[_0xcc6a('0x2a')]=function(_0x483aa4,_0x2a3745){if(_0x483aa4[_0xcc6a('0x5c')]['id']){delete _0x483aa4[_0xcc6a('0x5c')]['id'];}return db[_0xcc6a('0x53')]['find']({'where':{'id':_0x483aa4[_0xcc6a('0x59')]['id']}})[_0xcc6a('0x2b')](handleEntityNotFound(_0x2a3745,null))[_0xcc6a('0x2b')](function(_0x2ffe07){if(_0x2ffe07){return db[_0xcc6a('0x53')][_0xcc6a('0x2a')](_[_0xcc6a('0x67')](_0x483aa4[_0xcc6a('0x5c')],[_0xcc6a('0x5f'),_0xcc6a('0x68'),'description','recordingFormat','cutdigits',_0xcc6a('0x69')]),{'where':{'context':_0x2ffe07[_0xcc6a('0x68')],'exten':_0x2ffe07[_0xcc6a('0x5f')]},'individualHooks':!![]})['then'](function(_0x2f7787){return _0x2f7787;});}return null;})[_0xcc6a('0x2b')](respondWithStatusCode(_0x2a3745,null))[_0xcc6a('0x57')](handleError(_0x2a3745,null));};exports[_0xcc6a('0x6a')]=function(_0x5e1c69,_0x481d25,_0xaec5e8){return db[_0xcc6a('0x53')][_0xcc6a('0x6b')]({'where':{'id':_0x5e1c69[_0xcc6a('0x59')]['id']}})['then'](handleEntityNotFound(_0x481d25,null))[_0xcc6a('0x2b')](function(_0x2e9a9f){if(_0x2e9a9f){return db[_0xcc6a('0x6c')][_0xcc6a('0x6d')](function(_0x3a0d36){return db['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':_0x5e1c69[_0xcc6a('0x59')]['id']},'transaction':_0x3a0d36})[_0xcc6a('0x2b')](function(_0x2d9f02){var _0x144495=_['map'](_0x5e1c69['body'],function(_0x43827c){_0x43827c[_0xcc6a('0x6e')]=_0x5e1c69[_0xcc6a('0x59')]['id'];return _0x43827c;});return db[_0xcc6a('0x53')]['bulkCreate'](_0x144495,{'transaction':_0x3a0d36});});})['then'](function(){return db['VoiceExtension'][_0xcc6a('0x6f')]({'where':{'isApp':!![],'VoiceExtensionId':_0x5e1c69[_0xcc6a('0x59')]['id']},'order':_0xcc6a('0x70')});});}})[_0xcc6a('0x2b')](respondWithResult(_0x481d25,null))['catch'](handleError(_0x481d25,null));}; \ No newline at end of file +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(_0x427c0e,_0x49ab78){var _0x429225=function(_0x2c4b95){while(--_0x2c4b95){_0x427c0e['push'](_0x427c0e['shift']());}};_0x429225(++_0x49ab78);}(_0xba34,0x119));var _0x4ba3=function(_0x1923f2,_0x152680){_0x1923f2=_0x1923f2-0x0;var _0x5afefc=_0xba34[_0x1923f2];return _0x5afefc;};'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 16a5be6..142f9fd 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 _0xf484=['exports','events','../../mysqldb','VoiceExtension','setMaxListeners','remove','emit','hook'];(function(_0x418caf,_0x26611c){var _0x2f05ac=function(_0x1cee8f){while(--_0x1cee8f){_0x418caf['push'](_0x418caf['shift']());}};_0x2f05ac(++_0x26611c);}(_0xf484,0x1e9));var _0x4f48=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf484[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x4f48('0x0'));var VoiceExtension=require(_0x4f48('0x1'))['db'][_0x4f48('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x4f48('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x4f48('0x4')};function emitEvent(_0x410a50){return function(_0x359cf0,_0x291cf5,_0x39fb75){VoiceExtensionEvents[_0x4f48('0x5')](_0x410a50+':'+_0x359cf0['id'],_0x359cf0);VoiceExtensionEvents[_0x4f48('0x5')](_0x410a50,_0x359cf0);_0x39fb75(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x4f48('0x6')](e,emitEvent(event));}}module[_0x4f48('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0x3b52=['events','../../mysqldb','VoiceExtension','setMaxListeners','save','emit','hook','exports'];(function(_0x35022d,_0x2e3004){var _0x17d1ca=function(_0x3f1ac6){while(--_0x3f1ac6){_0x35022d['push'](_0x35022d['shift']());}};_0x17d1ca(++_0x2e3004);}(_0x3b52,0x78));var _0x23b5=function(_0x40c2c7,_0x3a8037){_0x40c2c7=_0x40c2c7-0x0;var _0xfc9266=_0x3b52[_0x40c2c7];return _0xfc9266;};'use strict';var EventEmitter=require(_0x23b5('0x0'));var VoiceExtension=require(_0x23b5('0x1'))['db'][_0x23b5('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x23b5('0x3')](0x0);var events={'afterCreate':_0x23b5('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4e49ca){return function(_0x7b3449,_0x2fb84e,_0x2f6197){VoiceExtensionEvents[_0x23b5('0x5')](_0x4e49ca+':'+_0x7b3449['id'],_0x7b3449);VoiceExtensionEvents['emit'](_0x4e49ca,_0x7b3449);_0x2f6197(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x23b5('0x6')](e,emitEvent(event));}}module[_0x23b5('0x7')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 19259cf..a3df0f1 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 _0xe7ce=['bluebird','request-promise','../../config/environment','./voiceExtension.attributes','exports','define','VoiceExtension','voice_extensions','lodash','util','../../config/logger'];(function(_0x4687df,_0x12099c){var _0x32eaef=function(_0x2387db){while(--_0x2387db){_0x4687df['push'](_0x4687df['shift']());}};_0x32eaef(++_0x12099c);}(_0xe7ce,0x168));var _0xee7c=function(_0x596c16,_0x2dc7f2){_0x596c16=_0x596c16-0x0;var _0x40823b=_0xe7ce[_0x596c16];return _0x40823b;};'use strict';var _=require(_0xee7c('0x0'));var util=require(_0xee7c('0x1'));var logger=require(_0xee7c('0x2'))('api');var moment=require('moment');var BPromise=require(_0xee7c('0x3'));var rp=require(_0xee7c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xee7c('0x5'));var attributes=require(_0xee7c('0x6'));module[_0xee7c('0x7')]=function(_0x196f66,_0x190ab1){return _0x196f66[_0xee7c('0x8')](_0xee7c('0x9'),attributes,{'tableName':_0xee7c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe659=['api','bluebird','request-promise','rimraf','../../config/environment','./voiceExtension.attributes','exports','define','VoiceExtension','voice_extensions','lodash','util','../../config/logger'];(function(_0x2f5d87,_0x5c9748){var _0x4aa59a=function(_0x4a8285){while(--_0x4a8285){_0x2f5d87['push'](_0x2f5d87['shift']());}};_0x4aa59a(++_0x5c9748);}(_0xe659,0xe7));var _0x9e65=function(_0x5011f5,_0x92181b){_0x5011f5=_0x5011f5-0x0;var _0x2b0e3f=_0xe659[_0x5011f5];return _0x2b0e3f;};'use strict';var _=require(_0x9e65('0x0'));var util=require(_0x9e65('0x1'));var logger=require(_0x9e65('0x2'))(_0x9e65('0x3'));var moment=require('moment');var BPromise=require(_0x9e65('0x4'));var rp=require(_0x9e65('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9e65('0x6'));var config=require(_0x9e65('0x7'));var attributes=require(_0x9e65('0x8'));module[_0x9e65('0x9')]=function(_0x5abb33,_0x5998a1){return _0x5abb33[_0x9e65('0xa')](_0x9e65('0xb'),attributes,{'tableName':_0x9e65('0xc'),'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 7f92eea..c50cc2b 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 _0x667e=['../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceExtension','findAll','options','raw','where','limit','include','model','attributes','map','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x185445,_0x1879a4){var _0x300c0f=function(_0x525253){while(--_0x525253){_0x185445['push'](_0x185445['shift']());}};_0x300c0f(++_0x1879a4);}(_0x667e,0x139));var _0xe667=function(_0x1fedd5,_0x3da7d3){_0x1fedd5=_0x1fedd5-0x0;var _0x16c57b=_0x667e[_0x1fedd5];return _0x16c57b;};'use strict';var _=require(_0xe667('0x0'));var util=require(_0xe667('0x1'));var moment=require(_0xe667('0x2'));var BPromise=require(_0xe667('0x3'));var rs=require(_0xe667('0x4'));var fs=require('fs');var Redis=require(_0xe667('0x5'));var db=require(_0xe667('0x6'))['db'];var utils=require(_0xe667('0x7'));var logger=require('../../config/logger')(_0xe667('0x8'));var config=require(_0xe667('0x9'));var jayson=require(_0xe667('0xa'));var client=jayson['client'][_0xe667('0xb')]({'port':0x232a});config[_0xe667('0xc')]=_['defaults'](config[_0xe667('0xc')],{'host':_0xe667('0xd'),'port':0x18eb});var socket=require(_0xe667('0xe'))(new Redis(config['redis']));require(_0xe667('0xf'))[_0xe667('0x10')](socket);function respondWithRpcPromise(_0x55fa7e,_0x3c8fd0,_0x3a1807){return new BPromise(function(_0x27c1d5,_0xb34f71){return client[_0xe667('0x11')](_0x55fa7e,_0x3a1807)[_0xe667('0x12')](function(_0x47c6c1){logger[_0xe667('0x13')](_0xe667('0x14'),_0x3c8fd0,'request\x20sent');logger['debug'](_0xe667('0x15'),_0x3c8fd0,_0xe667('0x16'),JSON[_0xe667('0x17')](_0x47c6c1));if(_0x47c6c1[_0xe667('0x18')]){if(_0x47c6c1[_0xe667('0x18')][_0xe667('0x19')]===0x1f4){logger[_0xe667('0x18')](_0xe667('0x14'),_0x3c8fd0,_0x47c6c1[_0xe667('0x18')][_0xe667('0x1a')]);return _0xb34f71(_0x47c6c1[_0xe667('0x18')][_0xe667('0x1a')]);}logger[_0xe667('0x18')](_0xe667('0x14'),_0x3c8fd0,_0x47c6c1[_0xe667('0x18')][_0xe667('0x1a')]);return _0x27c1d5(_0x47c6c1[_0xe667('0x18')][_0xe667('0x1a')]);}else{logger[_0xe667('0x13')](_0xe667('0x14'),_0x3c8fd0,_0xe667('0x16'));_0x27c1d5(_0x47c6c1[_0xe667('0x1b')]['message']);}})[_0xe667('0x1c')](function(_0x243cba){logger[_0xe667('0x18')]('VoiceExtension,\x20%s,\x20%s',_0x3c8fd0,_0x243cba);_0xb34f71(_0x243cba);});});}exports[_0xe667('0x1d')]=function(_0x4acbd0){var _0x43d735=this;return new Promise(function(_0x254502,_0x328a94){return db['VoiceExtension'][_0xe667('0x1e')]({'raw':_0x4acbd0[_0xe667('0x1f')]?_0x4acbd0[_0xe667('0x1f')][_0xe667('0x20')]===undefined?!![]:![]:!![],'where':_0x4acbd0[_0xe667('0x1f')]?_0x4acbd0[_0xe667('0x1f')][_0xe667('0x21')]||null:null,'attributes':_0x4acbd0[_0xe667('0x1f')]?_0x4acbd0[_0xe667('0x1f')]['attributes']||null:null,'limit':_0x4acbd0[_0xe667('0x1f')]?_0x4acbd0[_0xe667('0x1f')][_0xe667('0x22')]||null:null,'include':_0x4acbd0[_0xe667('0x1f')]?_0x4acbd0[_0xe667('0x1f')]['include']?_['map'](_0x4acbd0['options'][_0xe667('0x23')],function(_0x16ddc8){return{'model':db[_0x16ddc8[_0xe667('0x24')]],'as':_0x16ddc8['as'],'attributes':_0x16ddc8[_0xe667('0x25')],'include':_0x16ddc8[_0xe667('0x23')]?_[_0xe667('0x26')](_0x16ddc8[_0xe667('0x23')],function(_0x181c07){return{'model':db[_0x181c07[_0xe667('0x24')]],'as':_0x181c07['as'],'attributes':_0x181c07[_0xe667('0x25')],'include':_0x181c07[_0xe667('0x23')]?_[_0xe667('0x26')](_0x181c07[_0xe667('0x23')],function(_0x13a16f){return{'model':db[_0x13a16f[_0xe667('0x24')]],'as':_0x13a16f['as'],'attributes':_0x13a16f[_0xe667('0x25')]};}):[]};}):[]};}):[]:[]})[_0xe667('0x12')](function(_0x47cdc6){logger[_0xe667('0x13')]('GetVoiceExtension',_0x4acbd0);logger[_0xe667('0x27')](_0xe667('0x1d'),_0x4acbd0,JSON[_0xe667('0x17')](_0x47cdc6));_0x254502(_0x47cdc6);})['catch'](function(_0xf4488d){logger[_0xe667('0x18')](_0xe667('0x1d'),_0xf4488d[_0xe667('0x1a')],_0x4acbd0);_0x328a94(_0x43d735[_0xe667('0x18')](0x1f4,_0xf4488d['message']));});});}; \ No newline at end of file +var _0xcad6=['findAll','options','raw','where','attributes','limit','include','map','model','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./voiceExtension.socket','register','then','info','VoiceExtension,\x20%s,\x20%s','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetVoiceExtension','VoiceExtension'];(function(_0x2caa12,_0x43453b){var _0xfc95a4=function(_0x1f9855){while(--_0x1f9855){_0x2caa12['push'](_0x2caa12['shift']());}};_0xfc95a4(++_0x43453b);}(_0xcad6,0xf4));var _0x6cad=function(_0xa384b4,_0xa14bfd){_0xa384b4=_0xa384b4-0x0;var _0x3f5720=_0xcad6[_0xa384b4];return _0x3f5720;};'use strict';var _=require(_0x6cad('0x0'));var util=require(_0x6cad('0x1'));var moment=require(_0x6cad('0x2'));var BPromise=require('bluebird');var rs=require(_0x6cad('0x3'));var fs=require('fs');var Redis=require(_0x6cad('0x4'));var db=require(_0x6cad('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6cad('0x6'))(_0x6cad('0x7'));var config=require(_0x6cad('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6cad('0x9')][_0x6cad('0xa')]({'port':0x232a});config[_0x6cad('0xb')]=_[_0x6cad('0xc')](config[_0x6cad('0xb')],{'host':_0x6cad('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6cad('0xb')]));require(_0x6cad('0xe'))[_0x6cad('0xf')](socket);function respondWithRpcPromise(_0x1b42cb,_0x29db29,_0x240f1e){return new BPromise(function(_0xe988ba,_0x1e9197){return client['request'](_0x1b42cb,_0x240f1e)[_0x6cad('0x10')](function(_0x1f1068){logger[_0x6cad('0x11')](_0x6cad('0x12'),_0x29db29,'request\x20sent');logger['debug'](_0x6cad('0x13'),_0x29db29,'request\x20sent',JSON[_0x6cad('0x14')](_0x1f1068));if(_0x1f1068['error']){if(_0x1f1068[_0x6cad('0x15')][_0x6cad('0x16')]===0x1f4){logger[_0x6cad('0x15')](_0x6cad('0x12'),_0x29db29,_0x1f1068[_0x6cad('0x15')][_0x6cad('0x17')]);return _0x1e9197(_0x1f1068[_0x6cad('0x15')][_0x6cad('0x17')]);}logger[_0x6cad('0x15')]('VoiceExtension,\x20%s,\x20%s',_0x29db29,_0x1f1068[_0x6cad('0x15')]['message']);return _0xe988ba(_0x1f1068['error'][_0x6cad('0x17')]);}else{logger[_0x6cad('0x11')](_0x6cad('0x12'),_0x29db29,_0x6cad('0x18'));_0xe988ba(_0x1f1068[_0x6cad('0x19')]['message']);}})[_0x6cad('0x1a')](function(_0x2617fe){logger[_0x6cad('0x15')](_0x6cad('0x12'),_0x29db29,_0x2617fe);_0x1e9197(_0x2617fe);});});}exports[_0x6cad('0x1b')]=function(_0x408683){var _0x5740b3=this;return new Promise(function(_0x9353c3,_0x1d91c3){return db[_0x6cad('0x1c')][_0x6cad('0x1d')]({'raw':_0x408683[_0x6cad('0x1e')]?_0x408683[_0x6cad('0x1e')][_0x6cad('0x1f')]===undefined?!![]:![]:!![],'where':_0x408683[_0x6cad('0x1e')]?_0x408683[_0x6cad('0x1e')][_0x6cad('0x20')]||null:null,'attributes':_0x408683[_0x6cad('0x1e')]?_0x408683[_0x6cad('0x1e')][_0x6cad('0x21')]||null:null,'limit':_0x408683[_0x6cad('0x1e')]?_0x408683[_0x6cad('0x1e')][_0x6cad('0x22')]||null:null,'include':_0x408683[_0x6cad('0x1e')]?_0x408683[_0x6cad('0x1e')][_0x6cad('0x23')]?_[_0x6cad('0x24')](_0x408683[_0x6cad('0x1e')][_0x6cad('0x23')],function(_0x49702c){return{'model':db[_0x49702c[_0x6cad('0x25')]],'as':_0x49702c['as'],'attributes':_0x49702c['attributes'],'include':_0x49702c[_0x6cad('0x23')]?_[_0x6cad('0x24')](_0x49702c[_0x6cad('0x23')],function(_0x3b2709){return{'model':db[_0x3b2709[_0x6cad('0x25')]],'as':_0x3b2709['as'],'attributes':_0x3b2709[_0x6cad('0x21')],'include':_0x3b2709[_0x6cad('0x23')]?_[_0x6cad('0x24')](_0x3b2709[_0x6cad('0x23')],function(_0x5538b4){return{'model':db[_0x5538b4[_0x6cad('0x25')]],'as':_0x5538b4['as'],'attributes':_0x5538b4[_0x6cad('0x21')]};}):[]};}):[]};}):[]:[]})[_0x6cad('0x10')](function(_0x73f5cb){logger[_0x6cad('0x11')](_0x6cad('0x1b'),_0x408683);logger[_0x6cad('0x26')](_0x6cad('0x1b'),_0x408683,JSON['stringify'](_0x73f5cb));_0x9353c3(_0x73f5cb);})[_0x6cad('0x1a')](function(_0x179f30){logger[_0x6cad('0x15')](_0x6cad('0x1b'),_0x179f30[_0x6cad('0x17')],_0x408683);_0x1d91c3(_0x5740b3['error'](0x1f4,_0x179f30['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 748ea5d..c0a0467 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 _0x0619=['register','length','voiceExtension:','./voiceExtension.events','save','update','emit'];(function(_0x4d1ac9,_0x37e63a){var _0x41c2d9=function(_0x108354){while(--_0x108354){_0x4d1ac9['push'](_0x4d1ac9['shift']());}};_0x41c2d9(++_0x37e63a);}(_0x0619,0x199));var _0x9061=function(_0x45eba6,_0x4156b3){_0x45eba6=_0x45eba6-0x0;var _0x212dbe=_0x0619[_0x45eba6];return _0x212dbe;};'use strict';var VoiceExtensionEvents=require(_0x9061('0x0'));var events=[_0x9061('0x1'),'remove',_0x9061('0x2')];function createListener(_0x4e5aa7,_0x124fe4){return function(_0x2212b2){_0x124fe4[_0x9061('0x3')](_0x4e5aa7,_0x2212b2);};}function removeListener(_0x4b2b1f,_0x3cf30b){return function(){VoiceExtensionEvents['removeListener'](_0x4b2b1f,_0x3cf30b);};}exports[_0x9061('0x4')]=function(_0x540b9c){for(var _0x4cc75c=0x0,_0x5b42ed=events[_0x9061('0x5')];_0x4cc75c<_0x5b42ed;_0x4cc75c++){var _0x20eb29=events[_0x4cc75c];var _0x4df3de=createListener(_0x9061('0x6')+_0x20eb29,_0x540b9c);VoiceExtensionEvents['on'](_0x20eb29,_0x4df3de);}}; \ No newline at end of file +var _0x6dca=['voiceExtension:','./voiceExtension.events','remove','emit','removeListener','register','length'];(function(_0x284b98,_0x434b7d){var _0x50744c=function(_0x1db91f){while(--_0x1db91f){_0x284b98['push'](_0x284b98['shift']());}};_0x50744c(++_0x434b7d);}(_0x6dca,0x1eb));var _0xa6dc=function(_0x760ae,_0x395079){_0x760ae=_0x760ae-0x0;var _0x487230=_0x6dca[_0x760ae];return _0x487230;};'use strict';var VoiceExtensionEvents=require(_0xa6dc('0x0'));var events=['save',_0xa6dc('0x1'),'update'];function createListener(_0x7c6392,_0xb61577){return function(_0x2c16c6){_0xb61577[_0xa6dc('0x2')](_0x7c6392,_0x2c16c6);};}function removeListener(_0xb4c82e,_0x425755){return function(){VoiceExtensionEvents[_0xa6dc('0x3')](_0xb4c82e,_0x425755);};}exports[_0xa6dc('0x4')]=function(_0x473df1){for(var _0x27bb72=0x0,_0x3d15b8=events[_0xa6dc('0x5')];_0x27bb72<_0x3d15b8;_0x27bb72++){var _0x5128bd=events[_0x27bb72];var _0x404abd=createListener(_0xa6dc('0x6')+_0x5128bd,_0x473df1);VoiceExtensionEvents['on'](_0x5128bd,_0x404abd);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 8f7182c..44eb9b7 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 _0x76ca=['put','/:id','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get','isAuthenticated','index','show','/:id/messages','getMessages','post','create'];(function(_0x3d0104,_0x2ba6ff){var _0x995a45=function(_0x4a9503){while(--_0x4a9503){_0x3d0104['push'](_0x3d0104['shift']());}};_0x995a45(++_0x2ba6ff);}(_0x76ca,0x98));var _0xa76c=function(_0xc543e2,_0x57016e){_0xc543e2=_0xc543e2-0x0;var _0x310c8a=_0x76ca[_0xc543e2];return _0x310c8a;};'use strict';var multer=require('multer');var util=require(_0xa76c('0x0'));var path=require(_0xa76c('0x1'));var timeout=require(_0xa76c('0x2'));var express=require(_0xa76c('0x3'));var router=express[_0xa76c('0x4')]();var auth=require(_0xa76c('0x5'));var interaction=require(_0xa76c('0x6'));var config=require('../../config/environment');var controller=require(_0xa76c('0x7'));router[_0xa76c('0x8')]('/',auth[_0xa76c('0x9')](),controller[_0xa76c('0xa')]);router[_0xa76c('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xa76c('0xb')]);router[_0xa76c('0x8')](_0xa76c('0xc'),auth[_0xa76c('0x9')](),controller[_0xa76c('0xd')]);router[_0xa76c('0xe')]('/',auth[_0xa76c('0x9')](),controller[_0xa76c('0xf')]);router[_0xa76c('0x10')](_0xa76c('0x11'),auth[_0xa76c('0x9')](),controller[_0xa76c('0x12')]);router[_0xa76c('0x13')](_0xa76c('0x11'),auth[_0xa76c('0x9')](),controller['destroy']);module[_0xa76c('0x14')]=router; \ No newline at end of file +var _0x3e8b=['isAuthenticated','/:id','show','get','/:id/messages','post','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../config/environment','./voiceMail.controller'];(function(_0x146a85,_0x529b52){var _0x1b59bf=function(_0x4af0fd){while(--_0x4af0fd){_0x146a85['push'](_0x146a85['shift']());}};_0x1b59bf(++_0x529b52);}(_0x3e8b,0x12c));var _0xb3e8=function(_0x566249,_0x2b7d25){_0x566249=_0x566249-0x0;var _0x598b05=_0x3e8b[_0x566249];return _0x598b05;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb3e8('0x0'));var timeout=require(_0xb3e8('0x1'));var express=require(_0xb3e8('0x2'));var router=express[_0xb3e8('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb3e8('0x4'));var controller=require(_0xb3e8('0x5'));router['get']('/',auth[_0xb3e8('0x6')](),controller['index']);router['get'](_0xb3e8('0x7'),auth[_0xb3e8('0x6')](),controller[_0xb3e8('0x8')]);router[_0xb3e8('0x9')](_0xb3e8('0xa'),auth[_0xb3e8('0x6')](),controller['getMessages']);router[_0xb3e8('0xb')]('/',auth['isAuthenticated'](),controller[_0xb3e8('0xc')]);router[_0xb3e8('0xd')](_0xb3e8('0x7'),auth[_0xb3e8('0x6')](),controller[_0xb3e8('0xe')]);router[_0xb3e8('0xf')](_0xb3e8('0x7'),auth[_0xb3e8('0x6')](),controller[_0xb3e8('0x10')]);module[_0xb3e8('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 2cdbf4c..3ec231f 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 _0xda3f=['fullname','\x20-\x20','exports','STRING','setDataValue','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue'];(function(_0x22710d,_0x182d5f){var _0x3ff8f8=function(_0x40398c){while(--_0x40398c){_0x22710d['push'](_0x22710d['shift']());}};_0x3ff8f8(++_0x182d5f);}(_0xda3f,0xec));var _0xfda3=function(_0x1b8a16,_0x4c2a73){_0x1b8a16=_0x1b8a16-0x0;var _0x934fd2=_0xda3f[_0x1b8a16];return _0x934fd2;};'use strict';var Sequelize=require('sequelize');module[_0xfda3('0x0')]={'customer_id':{'type':Sequelize[_0xfda3('0x1')]},'context':{'type':Sequelize['STRING'],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xfda3('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0xfda3('0x1')]},'fullname':{'type':Sequelize[_0xfda3('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x42bd74){this[_0xfda3('0x2')]('email',typeof _0x42bd74==='string'&&_0x42bd74[_0xfda3('0x3')]()?_0x42bd74[_0xfda3('0x3')]():null);}},'pager':{'type':Sequelize[_0xfda3('0x1')]},'tz':{'type':Sequelize[_0xfda3('0x1')],'defaultValue':_0xfda3('0x4')},'attach':{'type':Sequelize[_0xfda3('0x5')](_0xfda3('0x6'),'no'),'defaultValue':_0xfda3('0x6'),'allowNull':![]},'saycid':{'type':Sequelize[_0xfda3('0x5')](_0xfda3('0x6'),'no'),'defaultValue':_0xfda3('0x6'),'allowNull':![]},'dialout':{'type':Sequelize[_0xfda3('0x1')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0xfda3('0x5')](_0xfda3('0x6'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xfda3('0x5')](_0xfda3('0x6'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xfda3('0x5')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xfda3('0x5')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xfda3('0x7'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xfda3('0x5')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xfda3('0x5')](_0xfda3('0x6'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xfda3('0x5')](_0xfda3('0x6'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xfda3('0x5')](_0xfda3('0x6'),'no'),'defaultValue':_0xfda3('0x6'),'allowNull':![]},'stamp':{'type':_0xfda3('0x8')},'emailsubject':{'type':Sequelize[_0xfda3('0x1')]},'emailbody':{'type':Sequelize[_0xfda3('0x1')]},'maxsecs':{'type':Sequelize[_0xfda3('0x9')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xfda3('0x9')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xfda3('0xa')](_0xfda3('0xb'))+_0xfda3('0xc')+this[_0xfda3('0xa')]('mailbox');}}}; \ No newline at end of file +var _0x96cc=['TINYINT(4)','INTEGER','VIRTUAL','fullname','\x20-\x20','getDataValue','mailbox','sequelize','STRING','from-voicemail','contest_mailbox','setDataValue','string','trim','central','ENUM','yes'];(function(_0x77a500,_0x42048f){var _0x128031=function(_0x54fd4f){while(--_0x54fd4f){_0x77a500['push'](_0x77a500['shift']());}};_0x128031(++_0x42048f);}(_0x96cc,0x16c));var _0xc96c=function(_0x27f8b8,_0x6acb65){_0x27f8b8=_0x27f8b8-0x0;var _0x2cd274=_0x96cc[_0x27f8b8];return _0x2cd274;};'use strict';var Sequelize=require(_0xc96c('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0xc96c('0x1')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0xc96c('0x2'),'unique':_0xc96c('0x3')},'mailbox':{'type':Sequelize[_0xc96c('0x1')],'defaultValue':'','allowNull':![],'unique':_0xc96c('0x3')},'password':{'type':Sequelize[_0xc96c('0x1')]},'fullname':{'type':Sequelize[_0xc96c('0x1')]},'email':{'type':Sequelize[_0xc96c('0x1')],'validate':{'isEmail':!![]},'set':function(_0x7b632c){this[_0xc96c('0x4')]('email',typeof _0x7b632c===_0xc96c('0x5')&&_0x7b632c[_0xc96c('0x6')]()?_0x7b632c[_0xc96c('0x6')]():null);}},'pager':{'type':Sequelize[_0xc96c('0x1')]},'tz':{'type':Sequelize[_0xc96c('0x1')],'defaultValue':_0xc96c('0x7')},'attach':{'type':Sequelize[_0xc96c('0x8')]('yes','no'),'defaultValue':_0xc96c('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0xc96c('0x8')](_0xc96c('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0xc96c('0x1')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0xc96c('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xc96c('0x8')](_0xc96c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xc96c('0x8')](_0xc96c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0xc96c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xc96c('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xc96c('0x8')](_0xc96c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0xc96c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xc96c('0x8')](_0xc96c('0x9'),'no'),'defaultValue':_0xc96c('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0xc96c('0x8')](_0xc96c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xc96c('0x8')](_0xc96c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xc96c('0x8')](_0xc96c('0x9'),'no'),'defaultValue':_0xc96c('0x9'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0xc96c('0x1')]},'maxsecs':{'type':Sequelize[_0xc96c('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xc96c('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xc96c('0xc')],'get':function(){return this['getDataValue'](_0xc96c('0xd'))+_0xc96c('0xe')+this[_0xc96c('0xf')](_0xc96c('0x10'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 1071167..3bcef39 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 _0x0cdc=['VoiceMail','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','where','pick','filter','merge','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','catch','update','getMessages','findOne','hasOwnProperty','sort','mailbox','html-pdf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','querystring','papaparse','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','save','then','destroy','get','Voicemails','UserProfileResource','sendStatus','error','stack','name','send','index','map'];(function(_0x28e22c,_0x2743f7){var _0x46fd29=function(_0x30949b){while(--_0x30949b){_0x28e22c['push'](_0x28e22c['shift']());}};_0x46fd29(++_0x2743f7);}(_0x0cdc,0xc4));var _0xc0cd=function(_0x547456,_0x1de17e){_0x547456=_0x547456-0x0;var _0xc1fd7b=_0x0cdc[_0x547456];return _0xc1fd7b;};'use strict';var pdf=require(_0xc0cd('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc0cd('0x1'));var BPromise=require(_0xc0cd('0x2'));var Mustache=require(_0xc0cd('0x3'));var util=require(_0xc0cd('0x4'));var path=require(_0xc0cd('0x5'));var sox=require(_0xc0cd('0x6'));var csv=require(_0xc0cd('0x7'));var ejs=require(_0xc0cd('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc0cd('0x9'));var crypto=require(_0xc0cd('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc0cd('0x7'));var querystring=require(_0xc0cd('0xb'));var Papa=require(_0xc0cd('0xc'));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(_0xc0cd('0xd'));var logger=require(_0xc0cd('0xe'))('api');var utils=require(_0xc0cd('0xf'));var config=require('../../config/environment');var db=require(_0xc0cd('0x10'))['db'];function respondWithStatusCode(_0x239e9a,_0x39f1a3){_0x39f1a3=_0x39f1a3||0xcc;return function(_0x1389b8){if(_0x1389b8){return _0x239e9a['sendStatus'](_0x39f1a3);}return _0x239e9a[_0xc0cd('0x11')](_0x39f1a3)[_0xc0cd('0x12')]();};}function respondWithResult(_0x18f681,_0x1cfdd6){_0x1cfdd6=_0x1cfdd6||0xc8;return function(_0x544283){if(_0x544283){return _0x18f681[_0xc0cd('0x11')](_0x1cfdd6)[_0xc0cd('0x13')](_0x544283);}};}function respondWithFilteredResult(_0x88c8b5,_0x308e19){return function(_0x3f6dc4){if(_0x3f6dc4){var _0x209fd9=_0x3f6dc4[_0xc0cd('0x14')],_0x11cfe6=_0x308e19['offset'],_0x5e26e6=_0x308e19[_0xc0cd('0x15')]+_0x308e19[_0xc0cd('0x16')],_0x43f1ab;if(_0x5e26e6>=_0x209fd9){_0x5e26e6=_0x209fd9;_0x43f1ab=0xc8;}else{_0x43f1ab=0xce;}_0x88c8b5['status'](_0x43f1ab);return _0x88c8b5[_0xc0cd('0x17')](_0xc0cd('0x18'),_0x11cfe6+'-'+_0x5e26e6+'/'+_0x209fd9)[_0xc0cd('0x13')](_0x3f6dc4);}return null;};}function patchUpdates(_0x3384c0){return function(_0x1a03f4){try{jsonpatch['apply'](_0x1a03f4,_0x3384c0,!![]);}catch(_0x5b3a6a){return BPromise['reject'](_0x5b3a6a);}return _0x1a03f4[_0xc0cd('0x19')]();};}function saveUpdates(_0x4e4f59,_0x54bb9b){return function(_0x21d591){if(_0x21d591){return _0x21d591['update'](_0x4e4f59)[_0xc0cd('0x1a')](function(_0x2b95d6){return _0x2b95d6;});}return null;};}function removeEntity(_0x6e4403,_0x3dc556){return function(_0xcc1d37){if(_0xcc1d37){return _0xcc1d37[_0xc0cd('0x1b')]()['then'](function(){var _0x3750fd=_0xcc1d37[_0xc0cd('0x1c')]({'plain':!![]});var _0x44fba5=_0xc0cd('0x1d');return db[_0xc0cd('0x1e')][_0xc0cd('0x1b')]({'where':{'type':_0x44fba5,'resourceId':_0x3750fd['id']}})[_0xc0cd('0x1a')](function(){return _0xcc1d37;});})['then'](function(){_0x6e4403['status'](0xcc)[_0xc0cd('0x12')]();});}};}function handleEntityNotFound(_0x5dab42,_0x33c7a9){return function(_0x32f04c){if(!_0x32f04c){_0x5dab42[_0xc0cd('0x1f')](0x194);}return _0x32f04c;};}function handleError(_0x24f007,_0x5d9e8f){_0x5d9e8f=_0x5d9e8f||0x1f4;return function(_0x5b2535){logger[_0xc0cd('0x20')](_0x5b2535[_0xc0cd('0x21')]);if(_0x5b2535['name']){delete _0x5b2535[_0xc0cd('0x22')];}_0x24f007[_0xc0cd('0x11')](_0x5d9e8f)[_0xc0cd('0x23')](_0x5b2535);};}exports[_0xc0cd('0x24')]=function(_0x4d3678,_0x57b569){var _0x35b447={},_0x32b27b={},_0x35e8e9={'count':0x0,'rows':[]};var _0x3d546b=_[_0xc0cd('0x25')](db[_0xc0cd('0x26')]['rawAttributes'],function(_0x5007f0){return{'name':_0x5007f0['fieldName'],'type':_0x5007f0[_0xc0cd('0x27')][_0xc0cd('0x28')]};});_0x32b27b[_0xc0cd('0x29')]=_[_0xc0cd('0x25')](_0x3d546b,_0xc0cd('0x22'));_0x32b27b[_0xc0cd('0x2a')]=_[_0xc0cd('0x2b')](_0x4d3678[_0xc0cd('0x2a')]);_0x32b27b[_0xc0cd('0x2c')]=_[_0xc0cd('0x2d')](_0x32b27b[_0xc0cd('0x29')],_0x32b27b[_0xc0cd('0x2a')]);_0x35b447[_0xc0cd('0x2e')]=_['intersection'](_0x32b27b[_0xc0cd('0x29')],qs[_0xc0cd('0x2f')](_0x4d3678[_0xc0cd('0x2a')]['fields']));_0x35b447[_0xc0cd('0x2e')]=_0x35b447[_0xc0cd('0x2e')][_0xc0cd('0x30')]?_0x35b447[_0xc0cd('0x2e')]:_0x32b27b[_0xc0cd('0x29')];if(!_0x4d3678['query']['hasOwnProperty'](_0xc0cd('0x31'))){_0x35b447[_0xc0cd('0x16')]=qs[_0xc0cd('0x16')](_0x4d3678[_0xc0cd('0x2a')][_0xc0cd('0x16')]);_0x35b447[_0xc0cd('0x15')]=qs['offset'](_0x4d3678[_0xc0cd('0x2a')][_0xc0cd('0x15')]);}_0x35b447[_0xc0cd('0x32')]=qs['sort'](_0x4d3678[_0xc0cd('0x2a')]['sort']);_0x35b447[_0xc0cd('0x33')]=qs[_0xc0cd('0x2c')](_[_0xc0cd('0x34')](_0x4d3678['query'],_0x32b27b[_0xc0cd('0x2c')]),_0x3d546b);if(_0x4d3678[_0xc0cd('0x2a')][_0xc0cd('0x35')]){_0x35b447[_0xc0cd('0x33')]=_['merge'](_0x35b447['where'],{'$or':_[_0xc0cd('0x25')](_0x3d546b,function(_0x50b5f3){if(_0x50b5f3[_0xc0cd('0x27')]!=='VIRTUAL'){var _0x17572c={};_0x17572c[_0x50b5f3['name']]={'$like':'%'+_0x4d3678[_0xc0cd('0x2a')][_0xc0cd('0x35')]+'%'};return _0x17572c;}})});}_0x35b447=_[_0xc0cd('0x36')]({},_0x35b447,_0x4d3678['options']);var _0x22c711={'where':_0x35b447[_0xc0cd('0x33')]};return db['VoiceMail']['count'](_0x22c711)['then'](function(_0x3a79a2){_0x35e8e9['count']=_0x3a79a2;if(_0x4d3678[_0xc0cd('0x2a')][_0xc0cd('0x37')]){_0x35b447[_0xc0cd('0x38')]=[{'all':!![]}];}return db[_0xc0cd('0x26')][_0xc0cd('0x39')](_0x35b447);})[_0xc0cd('0x1a')](function(_0x2d4a19){_0x35e8e9[_0xc0cd('0x3a')]=_0x2d4a19;return _0x35e8e9;})[_0xc0cd('0x1a')](respondWithFilteredResult(_0x57b569,_0x35b447))['catch'](handleError(_0x57b569,null));};exports[_0xc0cd('0x3b')]=function(_0x3f7e13,_0x4b0b0f){var _0x5123aa={'raw':!![],'where':{'id':_0x3f7e13[_0xc0cd('0x3c')]['id']}},_0xc150c7={};_0xc150c7[_0xc0cd('0x29')]=_['keys'](db[_0xc0cd('0x26')][_0xc0cd('0x3d')]);_0xc150c7['query']=_[_0xc0cd('0x2b')](_0x3f7e13[_0xc0cd('0x2a')]);_0xc150c7[_0xc0cd('0x2c')]=_[_0xc0cd('0x2d')](_0xc150c7[_0xc0cd('0x29')],_0xc150c7[_0xc0cd('0x2a')]);_0x5123aa['attributes']=_[_0xc0cd('0x2d')](_0xc150c7[_0xc0cd('0x29')],qs[_0xc0cd('0x2f')](_0x3f7e13['query'][_0xc0cd('0x2f')]));_0x5123aa[_0xc0cd('0x2e')]=_0x5123aa[_0xc0cd('0x2e')][_0xc0cd('0x30')]?_0x5123aa['attributes']:_0xc150c7['model'];if(_0x3f7e13['query']['includeAll']){_0x5123aa['include']=[{'all':!![]}];}_0x5123aa=_['merge']({},_0x5123aa,_0x3f7e13[_0xc0cd('0x3e')]);return db[_0xc0cd('0x26')][_0xc0cd('0x3f')](_0x5123aa)[_0xc0cd('0x1a')](handleEntityNotFound(_0x4b0b0f,null))[_0xc0cd('0x1a')](respondWithResult(_0x4b0b0f,null))['catch'](handleError(_0x4b0b0f,null));};exports[_0xc0cd('0x40')]=function(_0x331168,_0x20f3a2){return db[_0xc0cd('0x26')]['create'](_0x331168[_0xc0cd('0x41')],{})['then'](function(_0x169c79){var _0x3f1d58=_0x331168[_0xc0cd('0x42')]['get']({'plain':!![]});if(!_0x3f1d58)throw new Error(_0xc0cd('0x43'));if(_0x3f1d58[_0xc0cd('0x44')]==='user'){var _0x416275=_0x169c79[_0xc0cd('0x1c')]({'plain':!![]});var _0x233b7c='Voicemails';return db[_0xc0cd('0x45')]['find']({'where':{'name':_0x233b7c,'userProfileId':_0x3f1d58[_0xc0cd('0x46')]},'raw':!![]})['then'](function(_0x1e5fbb){if(_0x1e5fbb&&_0x1e5fbb['autoAssociation']===0x0){return db[_0xc0cd('0x1e')][_0xc0cd('0x40')]({'name':_0x416275[_0xc0cd('0x22')],'resourceId':_0x416275['id'],'type':_0x1e5fbb[_0xc0cd('0x22')],'sectionId':_0x1e5fbb['id']},{})[_0xc0cd('0x1a')](function(){return _0x169c79;});}else{return _0x169c79;}})[_0xc0cd('0x47')](function(_0xb358f5){logger[_0xc0cd('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb358f5);throw _0xb358f5;});}return _0x169c79;})[_0xc0cd('0x1a')](respondWithResult(_0x20f3a2,0xc9))[_0xc0cd('0x47')](handleError(_0x20f3a2,null));};exports[_0xc0cd('0x48')]=function(_0x4db322,_0x374ba5){if(_0x4db322[_0xc0cd('0x41')]['id']){delete _0x4db322['body']['id'];}return db[_0xc0cd('0x26')][_0xc0cd('0x3f')]({'where':{'id':_0x4db322[_0xc0cd('0x3c')]['id']}})[_0xc0cd('0x1a')](handleEntityNotFound(_0x374ba5,null))['then'](saveUpdates(_0x4db322['body'],null))[_0xc0cd('0x1a')](respondWithResult(_0x374ba5,null))[_0xc0cd('0x47')](handleError(_0x374ba5,null));};exports[_0xc0cd('0x1b')]=function(_0x144c84,_0x4a47aa){return db[_0xc0cd('0x26')]['find']({'where':{'id':_0x144c84[_0xc0cd('0x3c')]['id']}})[_0xc0cd('0x1a')](handleEntityNotFound(_0x4a47aa,null))['then'](removeEntity(_0x4a47aa,null))[_0xc0cd('0x47')](handleError(_0x4a47aa,null));};exports[_0xc0cd('0x49')]=function(_0x264d6c,_0x57bb36,_0x545c42){return db[_0xc0cd('0x26')][_0xc0cd('0x4a')]({'where':{'id':_0x264d6c['params']['id']}})[_0xc0cd('0x1a')](handleEntityNotFound(_0x57bb36,null))[_0xc0cd('0x1a')](function(_0x3e84a4){var _0x2f1ef5;var _0x442284={},_0x3c8f3d={};_0x3c8f3d[_0xc0cd('0x29')]=_[_0xc0cd('0x2b')](db['VoiceMailMessage'][_0xc0cd('0x3d')]);_0x3c8f3d['query']=_[_0xc0cd('0x2b')](_0x264d6c[_0xc0cd('0x2a')]);_0x3c8f3d[_0xc0cd('0x2c')]=_[_0xc0cd('0x2d')](_0x3c8f3d['model'],_0x3c8f3d[_0xc0cd('0x2a')]);_0x442284[_0xc0cd('0x2e')]=_[_0xc0cd('0x2d')](_0x3c8f3d['model'],qs[_0xc0cd('0x2f')](_0x264d6c['query'][_0xc0cd('0x2f')]));_0x442284[_0xc0cd('0x2e')]=_0x442284[_0xc0cd('0x2e')][_0xc0cd('0x30')]?_0x442284['attributes']:_0x3c8f3d[_0xc0cd('0x29')];if(!_0x264d6c['query'][_0xc0cd('0x4b')]('nolimit')){_0x442284[_0xc0cd('0x16')]=qs[_0xc0cd('0x16')](_0x264d6c['query'][_0xc0cd('0x16')]);_0x442284[_0xc0cd('0x15')]=qs['offset'](_0x264d6c[_0xc0cd('0x2a')][_0xc0cd('0x15')]);}_0x442284[_0xc0cd('0x32')]=qs[_0xc0cd('0x4c')](_0x264d6c['query'][_0xc0cd('0x4c')]);_0x442284[_0xc0cd('0x33')]=qs['filters'](_[_0xc0cd('0x34')](_0x264d6c['query'],_0x3c8f3d['filters']));if(_0x264d6c[_0xc0cd('0x2a')]['filter']){_0x442284[_0xc0cd('0x33')]=_[_0xc0cd('0x36')](_0x442284[_0xc0cd('0x33')],{'$or':_['map'](_0x442284[_0xc0cd('0x2e')],function(_0x105754){var _0x27136b={};_0x27136b[_0x105754]={'$like':'%'+_0x264d6c['query'][_0xc0cd('0x35')]+'%'};return _0x27136b;})});}_0x442284[_0xc0cd('0x33')]=_[_0xc0cd('0x36')](_0x442284[_0xc0cd('0x33')],{'mailboxuser':_0x3e84a4[_0xc0cd('0x4d')]});_0x442284=_['merge']({},_0x442284,_0x264d6c[_0xc0cd('0x3e')]);return db['VoiceMailMessage']['findAndCountAll'](_0x442284)[_0xc0cd('0x1a')](respondWithFilteredResult(_0x57bb36,_0x442284));})[_0xc0cd('0x47')](handleError(_0x57bb36,null));}; \ No newline at end of file +var _0xcde5=['count','includeAll','include','rows','catch','params','keys','fields','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','rawAttributes','findAndCountAll','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','Voicemails','UserProfileResource','destroy','stack','name','index','map','type','key','query','filters','intersection','attributes','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceMail'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xcde5,0x156));var _0x5cde=function(_0xf585d0,_0x4703a9){_0xf585d0=_0xf585d0-0x0;var _0x64dc76=_0xcde5[_0xf585d0];return _0x64dc76;};'use strict';var pdf=require(_0x5cde('0x0'));var emlformat=require(_0x5cde('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5cde('0x2'));var jsonpatch=require(_0x5cde('0x3'));var rp=require(_0x5cde('0x4'));var moment=require('moment');var BPromise=require(_0x5cde('0x5'));var Mustache=require(_0x5cde('0x6'));var util=require(_0x5cde('0x7'));var path=require('path');var sox=require(_0x5cde('0x8'));var csv=require(_0x5cde('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5cde('0xa'));var squel=require(_0x5cde('0xb'));var crypto=require(_0x5cde('0xc'));var jsforce=require(_0x5cde('0xd'));var deskjs=require(_0x5cde('0xe'));var toCsv=require(_0x5cde('0x9'));var querystring=require('querystring');var Papa=require(_0x5cde('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5cde('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5cde('0x11'));var logger=require(_0x5cde('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x5cde('0x13'));var db=require(_0x5cde('0x14'))['db'];function respondWithStatusCode(_0x2bc990,_0x2f0c0d){_0x2f0c0d=_0x2f0c0d||0xcc;return function(_0xaa8df8){if(_0xaa8df8){return _0x2bc990[_0x5cde('0x15')](_0x2f0c0d);}return _0x2bc990[_0x5cde('0x16')](_0x2f0c0d)[_0x5cde('0x17')]();};}function respondWithResult(_0x4974ac,_0x3f5fe8){_0x3f5fe8=_0x3f5fe8||0xc8;return function(_0x1375bf){if(_0x1375bf){return _0x4974ac[_0x5cde('0x16')](_0x3f5fe8)[_0x5cde('0x18')](_0x1375bf);}};}function respondWithFilteredResult(_0xcae6aa,_0x59b875){return function(_0x3f0cf0){if(_0x3f0cf0){var _0x55fd3c=_0x3f0cf0['count'],_0x43f49d=_0x59b875[_0x5cde('0x19')],_0x73e41e=_0x59b875['offset']+_0x59b875[_0x5cde('0x1a')],_0x289cfa;if(_0x73e41e>=_0x55fd3c){_0x73e41e=_0x55fd3c;_0x289cfa=0xc8;}else{_0x289cfa=0xce;}_0xcae6aa[_0x5cde('0x16')](_0x289cfa);return _0xcae6aa[_0x5cde('0x1b')](_0x5cde('0x1c'),_0x43f49d+'-'+_0x73e41e+'/'+_0x55fd3c)['json'](_0x3f0cf0);}return null;};}function patchUpdates(_0x16f8f2){return function(_0x29d5a1){try{jsonpatch[_0x5cde('0x1d')](_0x29d5a1,_0x16f8f2,!![]);}catch(_0x1dc7ab){return BPromise[_0x5cde('0x1e')](_0x1dc7ab);}return _0x29d5a1[_0x5cde('0x1f')]();};}function saveUpdates(_0x546d6e,_0x4d5502){return function(_0x291959){if(_0x291959){return _0x291959['update'](_0x546d6e)[_0x5cde('0x20')](function(_0x4ee496){return _0x4ee496;});}return null;};}function removeEntity(_0x2ec34f,_0x3e045e){return function(_0x53e85f){if(_0x53e85f){return _0x53e85f['destroy']()[_0x5cde('0x20')](function(){var _0x19fc74=_0x53e85f['get']({'plain':!![]});var _0x1c49d3=_0x5cde('0x21');return db[_0x5cde('0x22')][_0x5cde('0x23')]({'where':{'type':_0x1c49d3,'resourceId':_0x19fc74['id']}})[_0x5cde('0x20')](function(){return _0x53e85f;});})[_0x5cde('0x20')](function(){_0x2ec34f[_0x5cde('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e1ab7,_0x2c3296){return function(_0x4775d3){if(!_0x4775d3){_0x2e1ab7['sendStatus'](0x194);}return _0x4775d3;};}function handleError(_0x4ca2b7,_0x383150){_0x383150=_0x383150||0x1f4;return function(_0x2d6ecb){logger['error'](_0x2d6ecb[_0x5cde('0x24')]);if(_0x2d6ecb[_0x5cde('0x25')]){delete _0x2d6ecb[_0x5cde('0x25')];}_0x4ca2b7[_0x5cde('0x16')](_0x383150)['send'](_0x2d6ecb);};}exports[_0x5cde('0x26')]=function(_0xc270ad,_0x1fd8ae){var _0x518d17={},_0x39461c={},_0x1723d5={'count':0x0,'rows':[]};var _0x40c410=_[_0x5cde('0x27')](db['VoiceMail']['rawAttributes'],function(_0x3f1d90){return{'name':_0x3f1d90['fieldName'],'type':_0x3f1d90[_0x5cde('0x28')][_0x5cde('0x29')]};});_0x39461c['model']=_[_0x5cde('0x27')](_0x40c410,'name');_0x39461c[_0x5cde('0x2a')]=_['keys'](_0xc270ad[_0x5cde('0x2a')]);_0x39461c[_0x5cde('0x2b')]=_[_0x5cde('0x2c')](_0x39461c['model'],_0x39461c[_0x5cde('0x2a')]);_0x518d17[_0x5cde('0x2d')]=_[_0x5cde('0x2c')](_0x39461c[_0x5cde('0x2e')],qs['fields'](_0xc270ad[_0x5cde('0x2a')]['fields']));_0x518d17[_0x5cde('0x2d')]=_0x518d17[_0x5cde('0x2d')]['length']?_0x518d17['attributes']:_0x39461c[_0x5cde('0x2e')];if(!_0xc270ad[_0x5cde('0x2a')][_0x5cde('0x2f')](_0x5cde('0x30'))){_0x518d17[_0x5cde('0x1a')]=qs[_0x5cde('0x1a')](_0xc270ad[_0x5cde('0x2a')]['limit']);_0x518d17[_0x5cde('0x19')]=qs[_0x5cde('0x19')](_0xc270ad[_0x5cde('0x2a')][_0x5cde('0x19')]);}_0x518d17[_0x5cde('0x31')]=qs['sort'](_0xc270ad['query'][_0x5cde('0x32')]);_0x518d17[_0x5cde('0x33')]=qs[_0x5cde('0x2b')](_[_0x5cde('0x34')](_0xc270ad[_0x5cde('0x2a')],_0x39461c['filters']),_0x40c410);if(_0xc270ad[_0x5cde('0x2a')][_0x5cde('0x35')]){_0x518d17[_0x5cde('0x33')]=_[_0x5cde('0x36')](_0x518d17['where'],{'$or':_[_0x5cde('0x27')](_0x40c410,function(_0x57615a){if(_0x57615a[_0x5cde('0x28')]!==_0x5cde('0x37')){var _0x4b1664={};_0x4b1664[_0x57615a[_0x5cde('0x25')]]={'$like':'%'+_0xc270ad[_0x5cde('0x2a')][_0x5cde('0x35')]+'%'};return _0x4b1664;}})});}_0x518d17=_[_0x5cde('0x36')]({},_0x518d17,_0xc270ad[_0x5cde('0x38')]);var _0x582d6c={'where':_0x518d17['where']};return db[_0x5cde('0x39')]['count'](_0x582d6c)[_0x5cde('0x20')](function(_0x4378b1){_0x1723d5[_0x5cde('0x3a')]=_0x4378b1;if(_0xc270ad[_0x5cde('0x2a')][_0x5cde('0x3b')]){_0x518d17[_0x5cde('0x3c')]=[{'all':!![]}];}return db[_0x5cde('0x39')]['findAll'](_0x518d17);})[_0x5cde('0x20')](function(_0x285082){_0x1723d5[_0x5cde('0x3d')]=_0x285082;return _0x1723d5;})[_0x5cde('0x20')](respondWithFilteredResult(_0x1fd8ae,_0x518d17))[_0x5cde('0x3e')](handleError(_0x1fd8ae,null));};exports['show']=function(_0x29d570,_0x31703c){var _0x151506={'raw':!![],'where':{'id':_0x29d570[_0x5cde('0x3f')]['id']}},_0x1f9e5f={};_0x1f9e5f[_0x5cde('0x2e')]=_[_0x5cde('0x40')](db['VoiceMail']['rawAttributes']);_0x1f9e5f[_0x5cde('0x2a')]=_[_0x5cde('0x40')](_0x29d570['query']);_0x1f9e5f['filters']=_[_0x5cde('0x2c')](_0x1f9e5f[_0x5cde('0x2e')],_0x1f9e5f['query']);_0x151506[_0x5cde('0x2d')]=_[_0x5cde('0x2c')](_0x1f9e5f[_0x5cde('0x2e')],qs[_0x5cde('0x41')](_0x29d570[_0x5cde('0x2a')][_0x5cde('0x41')]));_0x151506[_0x5cde('0x2d')]=_0x151506[_0x5cde('0x2d')][_0x5cde('0x42')]?_0x151506['attributes']:_0x1f9e5f['model'];if(_0x29d570[_0x5cde('0x2a')][_0x5cde('0x3b')]){_0x151506[_0x5cde('0x3c')]=[{'all':!![]}];}_0x151506=_[_0x5cde('0x36')]({},_0x151506,_0x29d570['options']);return db['VoiceMail'][_0x5cde('0x43')](_0x151506)[_0x5cde('0x20')](handleEntityNotFound(_0x31703c,null))['then'](respondWithResult(_0x31703c,null))['catch'](handleError(_0x31703c,null));};exports[_0x5cde('0x44')]=function(_0x10f2f1,_0x14d24e){return db[_0x5cde('0x39')][_0x5cde('0x44')](_0x10f2f1[_0x5cde('0x45')],{})[_0x5cde('0x20')](function(_0x3a0d39){var _0x4f3bc2=_0x10f2f1[_0x5cde('0x46')][_0x5cde('0x47')]({'plain':!![]});if(!_0x4f3bc2)throw new Error(_0x5cde('0x48'));if(_0x4f3bc2['role']==='user'){var _0x154fc7=_0x3a0d39['get']({'plain':!![]});var _0x567bcc=_0x5cde('0x21');return db[_0x5cde('0x49')][_0x5cde('0x43')]({'where':{'name':_0x567bcc,'userProfileId':_0x4f3bc2['userProfileId']},'raw':!![]})[_0x5cde('0x20')](function(_0x381e5f){if(_0x381e5f&&_0x381e5f['autoAssociation']===0x0){return db[_0x5cde('0x22')]['create']({'name':_0x154fc7[_0x5cde('0x25')],'resourceId':_0x154fc7['id'],'type':_0x381e5f[_0x5cde('0x25')],'sectionId':_0x381e5f['id']},{})[_0x5cde('0x20')](function(){return _0x3a0d39;});}else{return _0x3a0d39;}})['catch'](function(_0xdda689){logger['error'](_0x5cde('0x4a'),_0xdda689);throw _0xdda689;});}return _0x3a0d39;})[_0x5cde('0x20')](respondWithResult(_0x14d24e,0xc9))['catch'](handleError(_0x14d24e,null));};exports['update']=function(_0x14f0a8,_0xca05bf){if(_0x14f0a8['body']['id']){delete _0x14f0a8[_0x5cde('0x45')]['id'];}return db[_0x5cde('0x39')]['find']({'where':{'id':_0x14f0a8[_0x5cde('0x3f')]['id']}})[_0x5cde('0x20')](handleEntityNotFound(_0xca05bf,null))['then'](saveUpdates(_0x14f0a8[_0x5cde('0x45')],null))[_0x5cde('0x20')](respondWithResult(_0xca05bf,null))[_0x5cde('0x3e')](handleError(_0xca05bf,null));};exports[_0x5cde('0x23')]=function(_0x23fc9f,_0x4b4ebe){return db['VoiceMail']['find']({'where':{'id':_0x23fc9f['params']['id']}})[_0x5cde('0x20')](handleEntityNotFound(_0x4b4ebe,null))[_0x5cde('0x20')](removeEntity(_0x4b4ebe,null))[_0x5cde('0x3e')](handleError(_0x4b4ebe,null));};exports[_0x5cde('0x4b')]=function(_0x397cc5,_0x4ef334,_0x5c8b03){return db[_0x5cde('0x39')][_0x5cde('0x4c')]({'where':{'id':_0x397cc5[_0x5cde('0x3f')]['id']}})[_0x5cde('0x20')](handleEntityNotFound(_0x4ef334,null))[_0x5cde('0x20')](function(_0x40c5){var _0xe759a8;var _0x21cce3={},_0x3708ed={};_0x3708ed[_0x5cde('0x2e')]=_[_0x5cde('0x40')](db[_0x5cde('0x4d')][_0x5cde('0x4e')]);_0x3708ed[_0x5cde('0x2a')]=_[_0x5cde('0x40')](_0x397cc5[_0x5cde('0x2a')]);_0x3708ed[_0x5cde('0x2b')]=_['intersection'](_0x3708ed[_0x5cde('0x2e')],_0x3708ed[_0x5cde('0x2a')]);_0x21cce3[_0x5cde('0x2d')]=_[_0x5cde('0x2c')](_0x3708ed[_0x5cde('0x2e')],qs[_0x5cde('0x41')](_0x397cc5[_0x5cde('0x2a')][_0x5cde('0x41')]));_0x21cce3['attributes']=_0x21cce3['attributes'][_0x5cde('0x42')]?_0x21cce3[_0x5cde('0x2d')]:_0x3708ed[_0x5cde('0x2e')];if(!_0x397cc5['query'][_0x5cde('0x2f')](_0x5cde('0x30'))){_0x21cce3['limit']=qs[_0x5cde('0x1a')](_0x397cc5[_0x5cde('0x2a')][_0x5cde('0x1a')]);_0x21cce3[_0x5cde('0x19')]=qs[_0x5cde('0x19')](_0x397cc5[_0x5cde('0x2a')]['offset']);}_0x21cce3[_0x5cde('0x31')]=qs[_0x5cde('0x32')](_0x397cc5['query']['sort']);_0x21cce3[_0x5cde('0x33')]=qs['filters'](_[_0x5cde('0x34')](_0x397cc5[_0x5cde('0x2a')],_0x3708ed['filters']));if(_0x397cc5[_0x5cde('0x2a')][_0x5cde('0x35')]){_0x21cce3[_0x5cde('0x33')]=_['merge'](_0x21cce3['where'],{'$or':_[_0x5cde('0x27')](_0x21cce3['attributes'],function(_0x3d75cd){var _0x83718f={};_0x83718f[_0x3d75cd]={'$like':'%'+_0x397cc5[_0x5cde('0x2a')][_0x5cde('0x35')]+'%'};return _0x83718f;})});}_0x21cce3[_0x5cde('0x33')]=_['merge'](_0x21cce3[_0x5cde('0x33')],{'mailboxuser':_0x40c5['mailbox']});_0x21cce3=_[_0x5cde('0x36')]({},_0x21cce3,_0x397cc5[_0x5cde('0x38')]);return db[_0x5cde('0x4d')][_0x5cde('0x4f')](_0x21cce3)[_0x5cde('0x20')](respondWithFilteredResult(_0x4ef334,_0x21cce3));})[_0x5cde('0x3e')](handleError(_0x4ef334,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 2979161..30737c7 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 _0x6f0d=['request-promise','path','../../config/environment','./voiceMail.attributes','exports','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','util','../../config/logger','api','moment','bluebird'];(function(_0x4d5b90,_0x2ae3ab){var _0x5d1364=function(_0x5943d1){while(--_0x5943d1){_0x4d5b90['push'](_0x4d5b90['shift']());}};_0x5d1364(++_0x2ae3ab);}(_0x6f0d,0xeb));var _0xd6f0=function(_0x3d290f,_0x2b422c){_0x3d290f=_0x3d290f-0x0;var _0xaf436c=_0x6f0d[_0x3d290f];return _0xaf436c;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var logger=require(_0xd6f0('0x1'))(_0xd6f0('0x2'));var moment=require(_0xd6f0('0x3'));var BPromise=require(_0xd6f0('0x4'));var rp=require(_0xd6f0('0x5'));var fs=require('fs');var path=require(_0xd6f0('0x6'));var rimraf=require('rimraf');var config=require(_0xd6f0('0x7'));var attributes=require(_0xd6f0('0x8'));module[_0xd6f0('0x9')]=function(_0x2af15b,_0xe5cd34){return _0x2af15b['define'](_0xd6f0('0xa'),attributes,{'tableName':_0xd6f0('0xb'),'paranoid':![],'indexes':[{'name':_0xd6f0('0xc'),'fields':[_0xd6f0('0xd'),_0xd6f0('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdc91=['rimraf','../../config/environment','./voiceMail.attributes','exports','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','util','request-promise','path'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0xdc91,0x8b));var _0x1dc9=function(_0x325885,_0x577495){_0x325885=_0x325885-0x0;var _0x175c1f=_0xdc91[_0x325885];return _0x175c1f;};'use strict';var _=require(_0x1dc9('0x0'));var util=require(_0x1dc9('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1dc9('0x2'));var fs=require('fs');var path=require(_0x1dc9('0x3'));var rimraf=require(_0x1dc9('0x4'));var config=require(_0x1dc9('0x5'));var attributes=require(_0x1dc9('0x6'));module[_0x1dc9('0x7')]=function(_0x15ac2c,_0x115fe8){return _0x15ac2c['define'](_0x1dc9('0x8'),attributes,{'tableName':_0x1dc9('0x9'),'paranoid':![],'indexes':[{'name':_0x1dc9('0xa'),'fields':[_0x1dc9('0xb'),_0x1dc9('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 1eadbf4..cf9eebd 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 _0x6d17=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util'];(function(_0x59ae4f,_0x13d7cf){var _0x31e795=function(_0x25e22c){while(--_0x25e22c){_0x59ae4f['push'](_0x59ae4f['shift']());}};_0x31e795(++_0x13d7cf);}(_0x6d17,0x14e));var _0x76d1=function(_0x18b191,_0x4e0684){_0x18b191=_0x18b191-0x0;var _0x43e146=_0x6d17[_0x18b191];return _0x43e146;};'use strict';var _=require(_0x76d1('0x0'));var util=require(_0x76d1('0x1'));var moment=require(_0x76d1('0x2'));var BPromise=require(_0x76d1('0x3'));var rs=require(_0x76d1('0x4'));var fs=require('fs');var Redis=require(_0x76d1('0x5'));var db=require(_0x76d1('0x6'))['db'];var utils=require(_0x76d1('0x7'));var logger=require(_0x76d1('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x76d1('0x9'));var client=jayson[_0x76d1('0xa')][_0x76d1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5cae00,_0x334e82,_0x52371c){return new BPromise(function(_0x68c5,_0x39ba17){return client[_0x76d1('0xc')](_0x5cae00,_0x52371c)[_0x76d1('0xd')](function(_0x254fea){logger[_0x76d1('0xe')](_0x76d1('0xf'),_0x334e82,_0x76d1('0x10'));logger[_0x76d1('0x11')](_0x76d1('0x12'),_0x334e82,_0x76d1('0x10'),JSON['stringify'](_0x254fea));if(_0x254fea[_0x76d1('0x13')]){if(_0x254fea[_0x76d1('0x13')][_0x76d1('0x14')]===0x1f4){logger[_0x76d1('0x13')](_0x76d1('0xf'),_0x334e82,_0x254fea[_0x76d1('0x13')][_0x76d1('0x15')]);return _0x39ba17(_0x254fea[_0x76d1('0x13')][_0x76d1('0x15')]);}logger[_0x76d1('0x13')](_0x76d1('0xf'),_0x334e82,_0x254fea['error'][_0x76d1('0x15')]);return _0x68c5(_0x254fea[_0x76d1('0x13')][_0x76d1('0x15')]);}else{logger[_0x76d1('0xe')](_0x76d1('0xf'),_0x334e82,_0x76d1('0x10'));_0x68c5(_0x254fea[_0x76d1('0x16')][_0x76d1('0x15')]);}})[_0x76d1('0x17')](function(_0x22b4c4){logger[_0x76d1('0x13')]('VoiceMail,\x20%s,\x20%s',_0x334e82,_0x22b4c4);_0x39ba17(_0x22b4c4);});});} \ No newline at end of file +var _0xf239=['error','code','VoiceMail,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x47bd34,_0xcdd43d){var _0x30b487=function(_0x5022ae){while(--_0x5022ae){_0x47bd34['push'](_0x47bd34['shift']());}};_0x30b487(++_0xcdd43d);}(_0xf239,0x17c));var _0x9f23=function(_0x54b265,_0x272d36){_0x54b265=_0x54b265-0x0;var _0x1c7987=_0xf239[_0x54b265];return _0x1c7987;};'use strict';var _=require('lodash');var util=require(_0x9f23('0x0'));var moment=require('moment');var BPromise=require(_0x9f23('0x1'));var rs=require(_0x9f23('0x2'));var fs=require('fs');var Redis=require(_0x9f23('0x3'));var db=require(_0x9f23('0x4'))['db'];var utils=require(_0x9f23('0x5'));var logger=require(_0x9f23('0x6'))(_0x9f23('0x7'));var config=require(_0x9f23('0x8'));var jayson=require(_0x9f23('0x9'));var client=jayson[_0x9f23('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7c6a13,_0x32ca4e,_0x13ae3c){return new BPromise(function(_0x6edc6e,_0x4894ef){return client[_0x9f23('0xb')](_0x7c6a13,_0x13ae3c)['then'](function(_0x5d468a){logger[_0x9f23('0xc')]('VoiceMail,\x20%s,\x20%s',_0x32ca4e,'request\x20sent');logger[_0x9f23('0xd')](_0x9f23('0xe'),_0x32ca4e,'request\x20sent',JSON[_0x9f23('0xf')](_0x5d468a));if(_0x5d468a[_0x9f23('0x10')]){if(_0x5d468a['error'][_0x9f23('0x11')]===0x1f4){logger[_0x9f23('0x10')](_0x9f23('0x12'),_0x32ca4e,_0x5d468a[_0x9f23('0x10')][_0x9f23('0x13')]);return _0x4894ef(_0x5d468a[_0x9f23('0x10')][_0x9f23('0x13')]);}logger['error']('VoiceMail,\x20%s,\x20%s',_0x32ca4e,_0x5d468a[_0x9f23('0x10')][_0x9f23('0x13')]);return _0x6edc6e(_0x5d468a[_0x9f23('0x10')][_0x9f23('0x13')]);}else{logger[_0x9f23('0xc')](_0x9f23('0x12'),_0x32ca4e,'request\x20sent');_0x6edc6e(_0x5d468a[_0x9f23('0x14')][_0x9f23('0x13')]);}})[_0x9f23('0x15')](function(_0x3b3e9f){logger['error'](_0x9f23('0x12'),_0x32ca4e,_0x3b3e9f);_0x4894ef(_0x3b3e9f);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 8faad68..637ddc6 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 _0x9c5a=['get','/:id','/:id/download','download','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceMailMessage.controller','isAuthenticated'];(function(_0x1dc222,_0x25bf17){var _0xc55cb1=function(_0x51386f){while(--_0x51386f){_0x1dc222['push'](_0x1dc222['shift']());}};_0xc55cb1(++_0x25bf17);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x115fe1,_0x1cc16c){_0x115fe1=_0x115fe1-0x0;var _0x551882=_0x9c5a[_0x115fe1];return _0x551882;};'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['show']);router[_0xa9c5('0x9')](_0xa9c5('0xb'),auth['isAuthenticated'](),controller[_0xa9c5('0xc')]);router[_0xa9c5('0xd')]('/',auth['isAuthenticated'](),controller[_0xa9c5('0xe')]);router[_0xa9c5('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xa9c5('0x10')]);router[_0xa9c5('0x11')](_0xa9c5('0xa'),auth[_0xa9c5('0x8')](),controller[_0xa9c5('0x12')]);module[_0xa9c5('0x13')]=router; \ No newline at end of file +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(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_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 diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index fa14029..047033d 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 _0x35c8=['STRING','BLOB','long','TIMESTAMP','sequelize','exports','getDataValue'];(function(_0x49b8c0,_0x1afa25){var _0x58c608=function(_0x40409b){while(--_0x40409b){_0x49b8c0['push'](_0x49b8c0['shift']());}};_0x58c608(++_0x1afa25);}(_0x35c8,0x154));var _0x835c=function(_0x18a779,_0x15dd46){_0x18a779=_0x18a779-0x0;var _0x2ed1bd=_0x35c8[_0x18a779];return _0x2ed1bd;};'use strict';var Sequelize=require(_0x835c('0x0'));module[_0x835c('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x27bd95){return this[_0x835c('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x835c('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x835c('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x835c('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x835c('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x835c('0x4')](_0x835c('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x835c('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x835c('0x3')],'defaultValue':''},'stamp':{'type':_0x835c('0x6'),'allowNull':![]}}; \ No newline at end of file +var _0x68f1=['long','TIMESTAMP','exports','VIRTUAL','STRING','BLOB'];(function(_0x3f384e,_0x23f615){var _0x3fca88=function(_0x2fe9b0){while(--_0x2fe9b0){_0x3f384e['push'](_0x3f384e['shift']());}};_0x3fca88(++_0x23f615);}(_0x68f1,0xaa));var _0x168f=function(_0x106daf,_0x570fb6){_0x106daf=_0x106daf-0x0;var _0x2b4a7d=_0x68f1[_0x106daf];return _0x2b4a7d;};'use strict';var Sequelize=require('sequelize');module[_0x168f('0x0')]={'name':{'type':Sequelize[_0x168f('0x1')],'get':function(_0x3f6abc){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x168f('0x2')],'defaultValue':''},'context':{'type':Sequelize[_0x168f('0x2')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x168f('0x2')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x168f('0x2')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x168f('0x2')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x168f('0x2')],'defaultValue':''},'recording':{'type':Sequelize[_0x168f('0x3')](_0x168f('0x4')),'defaultValue':null},'flag':{'type':Sequelize[_0x168f('0x2')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x168f('0x2')],'defaultValue':''},'stamp':{'type':_0x168f('0x5'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index f163244..ebba634 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 _0x693f=['mustache','util','path','sox','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','model','differenceBy','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','VIRTUAL','filter','merge','options','includeAll','include','rows','catch','show','find','create','body','params','download','msg_id','recording','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird'];(function(_0x20e06e,_0x15a44a){var _0x2b2387=function(_0x590bc5){while(--_0x590bc5){_0x20e06e['push'](_0x20e06e['shift']());}};_0x2b2387(++_0x15a44a);}(_0x693f,0x9d));var _0xf693=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x693f[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0xf693('0x0'));var emlformat=require(_0xf693('0x1'));var rimraf=require(_0xf693('0x2'));var zipdir=require(_0xf693('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf693('0x4'));var moment=require(_0xf693('0x5'));var BPromise=require(_0xf693('0x6'));var Mustache=require(_0xf693('0x7'));var util=require(_0xf693('0x8'));var path=require(_0xf693('0x9'));var sox=require(_0xf693('0xa'));var csv=require('to-csv');var ejs=require(_0xf693('0xb'));var fs=require('fs');var _=require(_0xf693('0xc'));var squel=require('squel');var crypto=require(_0xf693('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf693('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf693('0xf'));var Papa=require(_0xf693('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf693('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf693('0x12'))(_0xf693('0x13'));var utils=require(_0xf693('0x14'));var config=require(_0xf693('0x15'));var db=require(_0xf693('0x16'))['db'];function respondWithStatusCode(_0x5a5a35,_0x5d0d4c){_0x5d0d4c=_0x5d0d4c||0xcc;return function(_0xd08be1){if(_0xd08be1){return _0x5a5a35[_0xf693('0x17')](_0x5d0d4c);}return _0x5a5a35['status'](_0x5d0d4c)[_0xf693('0x18')]();};}function respondWithResult(_0x1bfd8d,_0x5a5f86){_0x5a5f86=_0x5a5f86||0xc8;return function(_0x5c42f0){if(_0x5c42f0){return _0x1bfd8d[_0xf693('0x19')](_0x5a5f86)[_0xf693('0x1a')](_0x5c42f0);}};}function respondWithFilteredResult(_0xbd92c6,_0x208f32){return function(_0x36d92c){if(_0x36d92c){var _0x5541a7=_0x36d92c[_0xf693('0x1b')],_0x1d9278=_0x208f32[_0xf693('0x1c')],_0x1c0dfc=_0x208f32[_0xf693('0x1c')]+_0x208f32['limit'],_0x3c8084;if(_0x1c0dfc>=_0x5541a7){_0x1c0dfc=_0x5541a7;_0x3c8084=0xc8;}else{_0x3c8084=0xce;}_0xbd92c6['status'](_0x3c8084);return _0xbd92c6['set'](_0xf693('0x1d'),_0x1d9278+'-'+_0x1c0dfc+'/'+_0x5541a7)[_0xf693('0x1a')](_0x36d92c);}return null;};}function patchUpdates(_0x3f4d4d){return function(_0x4543a1){try{jsonpatch[_0xf693('0x1e')](_0x4543a1,_0x3f4d4d,!![]);}catch(_0x58f0f0){return BPromise[_0xf693('0x1f')](_0x58f0f0);}return _0x4543a1[_0xf693('0x20')]();};}function saveUpdates(_0x5f89c8,_0x31b887){return function(_0x1d20fc){if(_0x1d20fc){return _0x1d20fc[_0xf693('0x21')](_0x5f89c8)[_0xf693('0x22')](function(_0x38f209){return _0x38f209;});}return null;};}function removeEntity(_0x50b20e,_0x505ada){return function(_0x1188c6){if(_0x1188c6){return _0x1188c6[_0xf693('0x23')]()[_0xf693('0x22')](function(){_0x50b20e[_0xf693('0x19')](0xcc)[_0xf693('0x18')]();});}};}function handleEntityNotFound(_0x200c95,_0x5407f5){return function(_0x179e25){if(!_0x179e25){_0x200c95[_0xf693('0x17')](0x194);}return _0x179e25;};}function handleError(_0xc5c088,_0x414a3f){_0x414a3f=_0x414a3f||0x1f4;return function(_0x4840e2){logger[_0xf693('0x24')](_0x4840e2[_0xf693('0x25')]);if(_0x4840e2[_0xf693('0x26')]){delete _0x4840e2[_0xf693('0x26')];}_0xc5c088[_0xf693('0x19')](_0x414a3f)[_0xf693('0x27')](_0x4840e2);};}exports[_0xf693('0x28')]=function(_0x423cda,_0x3b3bfc){var _0x1b5f98={},_0x4ca818={},_0x79c2b9={'count':0x0,'rows':[]};var _0xaccce0=_[_0xf693('0x29')](db[_0xf693('0x2a')][_0xf693('0x2b')],function(_0x7fdc22){return{'name':_0x7fdc22[_0xf693('0x2c')],'type':_0x7fdc22[_0xf693('0x2d')]['key']};});_0x4ca818[_0xf693('0x2e')]=_[_0xf693('0x2f')](_[_0xf693('0x29')](_0xaccce0,_0xf693('0x26')),['name']);_0x4ca818['query']=_[_0xf693('0x30')](_0x423cda[_0xf693('0x31')]);_0x4ca818['filters']=_[_0xf693('0x32')](_0x4ca818[_0xf693('0x2e')],_0x4ca818[_0xf693('0x31')]);_0x1b5f98[_0xf693('0x33')]=_['intersection'](_0x4ca818[_0xf693('0x2e')],qs[_0xf693('0x34')](_0x423cda[_0xf693('0x31')][_0xf693('0x34')]));_0x1b5f98[_0xf693('0x33')]=_0x1b5f98[_0xf693('0x33')][_0xf693('0x35')]?_0x1b5f98[_0xf693('0x33')]:_0x4ca818['model'];if(!_0x423cda[_0xf693('0x31')][_0xf693('0x36')](_0xf693('0x37'))){_0x1b5f98[_0xf693('0x38')]=qs[_0xf693('0x38')](_0x423cda[_0xf693('0x31')]['limit']);_0x1b5f98['offset']=qs[_0xf693('0x1c')](_0x423cda[_0xf693('0x31')][_0xf693('0x1c')]);}_0x1b5f98['order']=qs[_0xf693('0x39')](_0x423cda[_0xf693('0x31')][_0xf693('0x39')]);_0x1b5f98[_0xf693('0x3a')]=qs[_0xf693('0x3b')](_['pick'](_0x423cda[_0xf693('0x31')],_0x4ca818[_0xf693('0x3b')]),_0xaccce0);if(_0x423cda[_0xf693('0x31')]['filter']){_0x1b5f98[_0xf693('0x3a')]=_['merge'](_0x1b5f98[_0xf693('0x3a')],{'$or':_[_0xf693('0x29')](_0xaccce0,function(_0x1ec098){if(_0x1ec098[_0xf693('0x2d')]!==_0xf693('0x3c')){var _0x5a5580={};_0x5a5580[_0x1ec098[_0xf693('0x26')]]={'$like':'%'+_0x423cda[_0xf693('0x31')][_0xf693('0x3d')]+'%'};return _0x5a5580;}})});}_0x1b5f98=_[_0xf693('0x3e')]({},_0x1b5f98,_0x423cda[_0xf693('0x3f')]);var _0x24c5d4={'where':_0x1b5f98[_0xf693('0x3a')]};return db[_0xf693('0x2a')][_0xf693('0x1b')](_0x24c5d4)['then'](function(_0x244b29){_0x79c2b9['count']=_0x244b29;if(_0x423cda['query'][_0xf693('0x40')]){_0x1b5f98[_0xf693('0x41')]=[{'all':!![]}];}return db[_0xf693('0x2a')]['findAll'](_0x1b5f98);})[_0xf693('0x22')](function(_0x51ef9a){_0x79c2b9[_0xf693('0x42')]=_0x51ef9a;return _0x79c2b9;})['then'](respondWithFilteredResult(_0x3b3bfc,_0x1b5f98))[_0xf693('0x43')](handleError(_0x3b3bfc,null));};exports[_0xf693('0x44')]=function(_0x3391e7,_0xb597a8){var _0x307bdf={'raw':!![],'where':{'id':_0x3391e7['params']['id']}},_0x47bc1b={};_0x47bc1b['model']=_['keys'](db[_0xf693('0x2a')][_0xf693('0x2b')]);_0x47bc1b['query']=_['keys'](_0x3391e7['query']);_0x47bc1b[_0xf693('0x3b')]=_[_0xf693('0x32')](_0x47bc1b[_0xf693('0x2e')],_0x47bc1b[_0xf693('0x31')]);_0x307bdf['attributes']=_[_0xf693('0x32')](_0x47bc1b[_0xf693('0x2e')],qs[_0xf693('0x34')](_0x3391e7['query'][_0xf693('0x34')]));_0x307bdf[_0xf693('0x33')]=_0x307bdf['attributes'][_0xf693('0x35')]?_0x307bdf[_0xf693('0x33')]:_0x47bc1b['model'];if(_0x3391e7[_0xf693('0x31')][_0xf693('0x40')]){_0x307bdf['include']=[{'all':!![]}];}_0x307bdf=_[_0xf693('0x3e')]({},_0x307bdf,_0x3391e7[_0xf693('0x3f')]);return db[_0xf693('0x2a')][_0xf693('0x45')](_0x307bdf)['then'](handleEntityNotFound(_0xb597a8,null))[_0xf693('0x22')](respondWithResult(_0xb597a8,null))[_0xf693('0x43')](handleError(_0xb597a8,null));};exports[_0xf693('0x46')]=function(_0x1a1efa,_0x2ceb64){return db[_0xf693('0x2a')]['create'](_0x1a1efa[_0xf693('0x47')],{})[_0xf693('0x22')](respondWithResult(_0x2ceb64,0xc9))[_0xf693('0x43')](handleError(_0x2ceb64,null));};exports[_0xf693('0x21')]=function(_0x16dd1b,_0x4f0e31){if(_0x16dd1b[_0xf693('0x47')]['id']){delete _0x16dd1b[_0xf693('0x47')]['id'];}return db['VoiceMailMessage'][_0xf693('0x45')]({'where':{'id':_0x16dd1b['params']['id']}})['then'](handleEntityNotFound(_0x4f0e31,null))['then'](saveUpdates(_0x16dd1b[_0xf693('0x47')],null))[_0xf693('0x22')](respondWithResult(_0x4f0e31,null))[_0xf693('0x43')](handleError(_0x4f0e31,null));};exports[_0xf693('0x23')]=function(_0x4c5beb,_0x4f01ae){return db[_0xf693('0x2a')]['find']({'where':{'id':_0x4c5beb[_0xf693('0x48')]['id']}})[_0xf693('0x22')](handleEntityNotFound(_0x4f01ae,null))[_0xf693('0x22')](removeEntity(_0x4f01ae,null))['catch'](handleError(_0x4f01ae,null));};exports[_0xf693('0x49')]=function(_0x3e9bf4,_0x43cf4f,_0x393555){return db[_0xf693('0x2a')][_0xf693('0x45')]({'where':{'id':_0x3e9bf4['params']['id']},'attributes':['id','recording',_0xf693('0x4a')]})['then'](handleEntityNotFound(_0x43cf4f,null))['then'](function(_0x3bd401){if(_0x3bd401){if(!_0x3bd401[_0xf693('0x4b')]){throw new db['Sequelize'][(_0xf693('0x4c'))](_0xf693('0x4d'));}var _0x2e08d2={'Content-Type':_0xf693('0x4e'),'Content-Disposition':'attachment'};if(_0x3bd401['msg_id']){_0x2e08d2[_0xf693('0x4f')]=_0xf693('0x50')+_0x3bd401[_0xf693('0x4a')]+_0xf693('0x51');}_0x43cf4f['set'](_0x2e08d2);return _0x43cf4f[_0xf693('0x27')](new Buffer(_0x3bd401[_0xf693('0x4b')]));}})['catch'](handleError(_0x43cf4f,null));}; \ No newline at end of file +var _0x407f=['fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','then','rows','show','params','keys','find','catch','create','body','download','recording','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','.wav\x22','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','reject','update','error','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','model','differenceBy','query','filters','intersection','attributes'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x407f,0xc2));var _0xf407=function(_0x4e4d92,_0x43a617){_0x4e4d92=_0x4e4d92-0x0;var _0x12e150=_0x407f[_0x4e4d92];return _0x12e150;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf407('0x0'));var jsonpatch=require(_0xf407('0x1'));var rp=require(_0xf407('0x2'));var moment=require(_0xf407('0x3'));var BPromise=require(_0xf407('0x4'));var Mustache=require(_0xf407('0x5'));var util=require(_0xf407('0x6'));var path=require(_0xf407('0x7'));var sox=require(_0xf407('0x8'));var csv=require(_0xf407('0x9'));var ejs=require(_0xf407('0xa'));var fs=require('fs');var _=require(_0xf407('0xb'));var squel=require(_0xf407('0xc'));var crypto=require(_0xf407('0xd'));var jsforce=require(_0xf407('0xe'));var deskjs=require(_0xf407('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf407('0x10'));var Papa=require(_0xf407('0x11'));var Redis=require(_0xf407('0x12'));var authService=require(_0xf407('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf407('0x14'))(_0xf407('0x15'));var utils=require(_0xf407('0x16'));var config=require(_0xf407('0x17'));var db=require(_0xf407('0x18'))['db'];function respondWithStatusCode(_0x5637a5,_0x2ee485){_0x2ee485=_0x2ee485||0xcc;return function(_0x3f4ca0){if(_0x3f4ca0){return _0x5637a5[_0xf407('0x19')](_0x2ee485);}return _0x5637a5[_0xf407('0x1a')](_0x2ee485)[_0xf407('0x1b')]();};}function respondWithResult(_0x1759c3,_0x242f43){_0x242f43=_0x242f43||0xc8;return function(_0x5257ef){if(_0x5257ef){return _0x1759c3['status'](_0x242f43)['json'](_0x5257ef);}};}function respondWithFilteredResult(_0x280a9f,_0x593e36){return function(_0x454710){if(_0x454710){var _0x4c1320=_0x454710[_0xf407('0x1c')],_0x48fd5d=_0x593e36[_0xf407('0x1d')],_0x768926=_0x593e36[_0xf407('0x1d')]+_0x593e36[_0xf407('0x1e')],_0x331782;if(_0x768926>=_0x4c1320){_0x768926=_0x4c1320;_0x331782=0xc8;}else{_0x331782=0xce;}_0x280a9f[_0xf407('0x1a')](_0x331782);return _0x280a9f[_0xf407('0x1f')]('Content-Range',_0x48fd5d+'-'+_0x768926+'/'+_0x4c1320)[_0xf407('0x20')](_0x454710);}return null;};}function patchUpdates(_0x1cd48f){return function(_0x1848b4){try{jsonpatch[_0xf407('0x21')](_0x1848b4,_0x1cd48f,!![]);}catch(_0x54e838){return BPromise[_0xf407('0x22')](_0x54e838);}return _0x1848b4['save']();};}function saveUpdates(_0x2aa4c3,_0x39febd){return function(_0x2f7ed0){if(_0x2f7ed0){return _0x2f7ed0[_0xf407('0x23')](_0x2aa4c3)['then'](function(_0x4716c3){return _0x4716c3;});}return null;};}function removeEntity(_0x5de6fb,_0x23659c){return function(_0xa6f11e){if(_0xa6f11e){return _0xa6f11e['destroy']()['then'](function(){_0x5de6fb[_0xf407('0x1a')](0xcc)[_0xf407('0x1b')]();});}};}function handleEntityNotFound(_0x2558a1,_0x2cea00){return function(_0x9406cf){if(!_0x9406cf){_0x2558a1[_0xf407('0x19')](0x194);}return _0x9406cf;};}function handleError(_0x17309c,_0x5aecf2){_0x5aecf2=_0x5aecf2||0x1f4;return function(_0x44b0ad){logger[_0xf407('0x24')](_0x44b0ad[_0xf407('0x25')]);if(_0x44b0ad['name']){delete _0x44b0ad[_0xf407('0x26')];}_0x17309c[_0xf407('0x1a')](_0x5aecf2)[_0xf407('0x27')](_0x44b0ad);};}exports[_0xf407('0x28')]=function(_0x603cb1,_0x187c93){var _0x524b34={},_0x3953c5={},_0x5ec8dc={'count':0x0,'rows':[]};var _0x4fc4df=_[_0xf407('0x29')](db[_0xf407('0x2a')][_0xf407('0x2b')],function(_0x582453){return{'name':_0x582453[_0xf407('0x2c')],'type':_0x582453[_0xf407('0x2d')]['key']};});_0x3953c5[_0xf407('0x2e')]=_[_0xf407('0x2f')](_[_0xf407('0x29')](_0x4fc4df,_0xf407('0x26')),[_0xf407('0x26')]);_0x3953c5['query']=_['keys'](_0x603cb1[_0xf407('0x30')]);_0x3953c5[_0xf407('0x31')]=_[_0xf407('0x32')](_0x3953c5[_0xf407('0x2e')],_0x3953c5[_0xf407('0x30')]);_0x524b34[_0xf407('0x33')]=_[_0xf407('0x32')](_0x3953c5['model'],qs[_0xf407('0x34')](_0x603cb1['query'][_0xf407('0x34')]));_0x524b34[_0xf407('0x33')]=_0x524b34['attributes']['length']?_0x524b34['attributes']:_0x3953c5[_0xf407('0x2e')];if(!_0x603cb1[_0xf407('0x30')]['hasOwnProperty'](_0xf407('0x35'))){_0x524b34[_0xf407('0x1e')]=qs[_0xf407('0x1e')](_0x603cb1[_0xf407('0x30')]['limit']);_0x524b34['offset']=qs[_0xf407('0x1d')](_0x603cb1[_0xf407('0x30')][_0xf407('0x1d')]);}_0x524b34[_0xf407('0x36')]=qs[_0xf407('0x37')](_0x603cb1[_0xf407('0x30')][_0xf407('0x37')]);_0x524b34[_0xf407('0x38')]=qs[_0xf407('0x31')](_[_0xf407('0x39')](_0x603cb1['query'],_0x3953c5[_0xf407('0x31')]),_0x4fc4df);if(_0x603cb1['query'][_0xf407('0x3a')]){_0x524b34[_0xf407('0x38')]=_[_0xf407('0x3b')](_0x524b34[_0xf407('0x38')],{'$or':_[_0xf407('0x29')](_0x4fc4df,function(_0x5bf00b){if(_0x5bf00b[_0xf407('0x2d')]!==_0xf407('0x3c')){var _0x307272={};_0x307272[_0x5bf00b[_0xf407('0x26')]]={'$like':'%'+_0x603cb1['query'][_0xf407('0x3a')]+'%'};return _0x307272;}})});}_0x524b34=_[_0xf407('0x3b')]({},_0x524b34,_0x603cb1[_0xf407('0x3d')]);var _0x577b07={'where':_0x524b34['where']};return db[_0xf407('0x2a')]['count'](_0x577b07)['then'](function(_0x612d67){_0x5ec8dc[_0xf407('0x1c')]=_0x612d67;if(_0x603cb1['query'][_0xf407('0x3e')]){_0x524b34[_0xf407('0x3f')]=[{'all':!![]}];}return db[_0xf407('0x2a')][_0xf407('0x40')](_0x524b34);})[_0xf407('0x41')](function(_0x5c27c4){_0x5ec8dc[_0xf407('0x42')]=_0x5c27c4;return _0x5ec8dc;})['then'](respondWithFilteredResult(_0x187c93,_0x524b34))['catch'](handleError(_0x187c93,null));};exports[_0xf407('0x43')]=function(_0x1ddb15,_0x49b66c){var _0x225a1f={'raw':!![],'where':{'id':_0x1ddb15[_0xf407('0x44')]['id']}},_0x44b01a={};_0x44b01a[_0xf407('0x2e')]=_[_0xf407('0x45')](db[_0xf407('0x2a')][_0xf407('0x2b')]);_0x44b01a[_0xf407('0x30')]=_['keys'](_0x1ddb15[_0xf407('0x30')]);_0x44b01a['filters']=_[_0xf407('0x32')](_0x44b01a['model'],_0x44b01a[_0xf407('0x30')]);_0x225a1f['attributes']=_[_0xf407('0x32')](_0x44b01a[_0xf407('0x2e')],qs[_0xf407('0x34')](_0x1ddb15[_0xf407('0x30')][_0xf407('0x34')]));_0x225a1f[_0xf407('0x33')]=_0x225a1f[_0xf407('0x33')]['length']?_0x225a1f[_0xf407('0x33')]:_0x44b01a[_0xf407('0x2e')];if(_0x1ddb15[_0xf407('0x30')][_0xf407('0x3e')]){_0x225a1f[_0xf407('0x3f')]=[{'all':!![]}];}_0x225a1f=_[_0xf407('0x3b')]({},_0x225a1f,_0x1ddb15['options']);return db[_0xf407('0x2a')][_0xf407('0x46')](_0x225a1f)[_0xf407('0x41')](handleEntityNotFound(_0x49b66c,null))[_0xf407('0x41')](respondWithResult(_0x49b66c,null))[_0xf407('0x47')](handleError(_0x49b66c,null));};exports[_0xf407('0x48')]=function(_0x4c6da7,_0x1c20a5){return db[_0xf407('0x2a')][_0xf407('0x48')](_0x4c6da7['body'],{})[_0xf407('0x41')](respondWithResult(_0x1c20a5,0xc9))['catch'](handleError(_0x1c20a5,null));};exports[_0xf407('0x23')]=function(_0x1d4bff,_0x44bd4e){if(_0x1d4bff[_0xf407('0x49')]['id']){delete _0x1d4bff['body']['id'];}return db[_0xf407('0x2a')][_0xf407('0x46')]({'where':{'id':_0x1d4bff[_0xf407('0x44')]['id']}})['then'](handleEntityNotFound(_0x44bd4e,null))['then'](saveUpdates(_0x1d4bff[_0xf407('0x49')],null))[_0xf407('0x41')](respondWithResult(_0x44bd4e,null))[_0xf407('0x47')](handleError(_0x44bd4e,null));};exports['destroy']=function(_0x17a7ba,_0x2e2560){return db[_0xf407('0x2a')][_0xf407('0x46')]({'where':{'id':_0x17a7ba['params']['id']}})[_0xf407('0x41')](handleEntityNotFound(_0x2e2560,null))[_0xf407('0x41')](removeEntity(_0x2e2560,null))['catch'](handleError(_0x2e2560,null));};exports[_0xf407('0x4a')]=function(_0x19c457,_0x274a87,_0x57bf7d){return db[_0xf407('0x2a')][_0xf407('0x46')]({'where':{'id':_0x19c457[_0xf407('0x44')]['id']},'attributes':['id',_0xf407('0x4b'),'msg_id']})[_0xf407('0x41')](handleEntityNotFound(_0x274a87,null))[_0xf407('0x41')](function(_0x5b69d2){if(_0x5b69d2){if(!_0x5b69d2[_0xf407('0x4b')]){throw new db['Sequelize'][(_0xf407('0x4c'))](_0xf407('0x4d'));}var _0x58e478={'Content-Type':_0xf407('0x4e'),'Content-Disposition':_0xf407('0x4f')};if(_0x5b69d2['msg_id']){_0x58e478[_0xf407('0x50')]='attachment;\x20filename=\x22'+_0x5b69d2['msg_id']+_0xf407('0x51');}_0x274a87[_0xf407('0x1f')](_0x58e478);return _0x274a87[_0xf407('0x27')](new Buffer(_0x5b69d2[_0xf407('0x4b')]));}})[_0xf407('0x47')](handleError(_0x274a87,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index a70ba06..9315f64 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 _0x33c3=['bluebird','request-promise','path','rimraf','exports','define','VoiceMailMessage','dir','lodash','util','../../config/logger','moment'];(function(_0x2a2166,_0x3a077f){var _0x3bcf50=function(_0x3f0300){while(--_0x3f0300){_0x2a2166['push'](_0x2a2166['shift']());}};_0x3bcf50(++_0x3a077f);}(_0x33c3,0xd4));var _0x333c=function(_0x6f40c,_0x5b0329){_0x6f40c=_0x6f40c-0x0;var _0x2a29d8=_0x33c3[_0x6f40c];return _0x2a29d8;};'use strict';var _=require(_0x333c('0x0'));var util=require(_0x333c('0x1'));var logger=require(_0x333c('0x2'))('api');var moment=require(_0x333c('0x3'));var BPromise=require(_0x333c('0x4'));var rp=require(_0x333c('0x5'));var fs=require('fs');var path=require(_0x333c('0x6'));var rimraf=require(_0x333c('0x7'));var config=require('../../config/environment');var attributes=require('./voiceMailMessage.attributes');module[_0x333c('0x8')]=function(_0x2b9d0d,_0x5d6e22){return _0x2b9d0d[_0x333c('0x9')](_0x333c('0xa'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':'dir','fields':[_0x333c('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x6b86=['request-promise','path','./voiceMailMessage.attributes','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','moment','bluebird'];(function(_0x41082d,_0x339a79){var _0x2da643=function(_0x450907){while(--_0x450907){_0x41082d['push'](_0x41082d['shift']());}};_0x2da643(++_0x339a79);}(_0x6b86,0x124));var _0x66b8=function(_0x3bcb0b,_0x11f917){_0x3bcb0b=_0x3bcb0b-0x0;var _0x47c107=_0x6b86[_0x3bcb0b];return _0x47c107;};'use strict';var _=require(_0x66b8('0x0'));var util=require(_0x66b8('0x1'));var logger=require(_0x66b8('0x2'))('api');var moment=require(_0x66b8('0x3'));var BPromise=require(_0x66b8('0x4'));var rp=require(_0x66b8('0x5'));var fs=require('fs');var path=require(_0x66b8('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x66b8('0x7'));module['exports']=function(_0x4a75bf,_0x36f937){return _0x4a75bf['define'](_0x66b8('0x8'),attributes,{'tableName':_0x66b8('0x9'),'paranoid':![],'indexes':[{'name':_0x66b8('0xa'),'fields':[_0x66b8('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 d9b10d2..1510722 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 _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x1a25a5,_0xcbd392){var _0x211f6b=function(_0x228cb2){while(--_0x228cb2){_0x1a25a5['push'](_0x1a25a5['shift']());}};_0x211f6b(++_0xcbd392);}(_0xdb28,0x106));var _0x8db2=function(_0x45d78e,_0x2ed1ae){_0x45d78e=_0x45d78e-0x0;var _0x2daf38=_0xdb28[_0x45d78e];return _0x2daf38;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file +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(_0x5792d3,_0x3244bb){var _0x64f50b=function(_0x1ff46c){while(--_0x1ff46c){_0x5792d3['push'](_0x5792d3['shift']());}};_0x64f50b(++_0x3244bb);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x5f66[_0x3ab9ee];return _0x82ee88;};'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 01f17bd..32c4038 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 _0xab7e=['create','put','update','delete','destroy','/:id/sounds/:id2','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/sounds','getSounds','post'];(function(_0x28de57,_0x464fdb){var _0x3252f6=function(_0x159f83){while(--_0x159f83){_0x28de57['push'](_0x28de57['shift']());}};_0x3252f6(++_0x464fdb);}(_0xab7e,0x11b));var _0xeab7=function(_0x3b0f6f,_0x2931e4){_0x3b0f6f=_0x3b0f6f-0x0;var _0x2739a1=_0xab7e[_0x3b0f6f];return _0x2739a1;};'use strict';var multer=require(_0xeab7('0x0'));var util=require(_0xeab7('0x1'));var path=require(_0xeab7('0x2'));var timeout=require('connect-timeout');var express=require(_0xeab7('0x3'));var router=express[_0xeab7('0x4')]();var auth=require(_0xeab7('0x5'));var interaction=require(_0xeab7('0x6'));var config=require(_0xeab7('0x7'));var controller=require('./voiceMusicOnHold.controller');router[_0xeab7('0x8')]('/',auth['isAuthenticated'](),controller[_0xeab7('0x9')]);router[_0xeab7('0x8')](_0xeab7('0xa'),auth[_0xeab7('0xb')](),controller[_0xeab7('0xc')]);router[_0xeab7('0x8')](_0xeab7('0xd'),auth['isAuthenticated'](),controller[_0xeab7('0xe')]);router[_0xeab7('0xf')]('/',auth[_0xeab7('0xb')](),controller[_0xeab7('0x10')]);router[_0xeab7('0xf')](_0xeab7('0xd'),auth[_0xeab7('0xb')](),controller['addSound']);router[_0xeab7('0x11')](_0xeab7('0xa'),auth['isAuthenticated'](),controller[_0xeab7('0x12')]);router[_0xeab7('0x13')]('/:id',auth[_0xeab7('0xb')](),controller[_0xeab7('0x14')]);router[_0xeab7('0x13')](_0xeab7('0x15'),auth['isAuthenticated'](),controller['removeSound']);module[_0xeab7('0x16')]=router; \ No newline at end of file +var _0x57c9=['/:id','/:id/sounds','post','addSound','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x11a3bb,_0x5c5466){var _0x3c3e36=function(_0x59f16f){while(--_0x59f16f){_0x11a3bb['push'](_0x11a3bb['shift']());}};_0x3c3e36(++_0x5c5466);}(_0x57c9,0xd2));var _0x957c=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x57c9[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x957c('0x0'));var util=require(_0x957c('0x1'));var path=require(_0x957c('0x2'));var timeout=require(_0x957c('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x957c('0x4'));var interaction=require(_0x957c('0x5'));var config=require(_0x957c('0x6'));var controller=require('./voiceMusicOnHold.controller');router[_0x957c('0x7')]('/',auth[_0x957c('0x8')](),controller[_0x957c('0x9')]);router[_0x957c('0x7')](_0x957c('0xa'),auth[_0x957c('0x8')](),controller['show']);router['get'](_0x957c('0xb'),auth[_0x957c('0x8')](),controller['getSounds']);router[_0x957c('0xc')]('/',auth[_0x957c('0x8')](),controller['create']);router[_0x957c('0xc')](_0x957c('0xb'),auth[_0x957c('0x8')](),controller[_0x957c('0xd')]);router['put'](_0x957c('0xa'),auth['isAuthenticated'](),controller[_0x957c('0xe')]);router[_0x957c('0xf')]('/:id',auth[_0x957c('0x8')](),controller[_0x957c('0x10')]);router[_0x957c('0xf')](_0x957c('0x11'),auth[_0x957c('0x8')](),controller[_0x957c('0x12')]);module[_0x957c('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 4938338..065347c 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 _0x3af2=['custom','files','mp3nb','quietmp3nb','quietmp3','alpha','TIMESTAMP','BOOLEAN','sequelize','STRING','ENUM'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3af2,0xef));var _0x23af=function(_0x18f152,_0x41585a){_0x18f152=_0x18f152-0x0;var _0xa10b34=_0x3af2[_0x18f152];return _0xa10b34;};'use strict';var Sequelize=require(_0x23af('0x0'));module['exports']={'name':{'type':Sequelize[_0x23af('0x1')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x23af('0x2')](_0x23af('0x3'),_0x23af('0x4'),_0x23af('0x5'),_0x23af('0x6'),_0x23af('0x7'),'mp3'),'allowNull':!![],'defaultValue':_0x23af('0x4')},'directory':{'type':Sequelize[_0x23af('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0x23af('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x23af('0x1')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x23af('0x8')},'format':{'type':Sequelize[_0x23af('0x1')],'allowNull':!![]},'stamp':{'type':_0x23af('0x9')},'defaultEntry':{'type':Sequelize[_0x23af('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0x98f1=['exports','STRING','ENUM','files','mp3nb','quietmp3nb','quietmp3','mp3','BOOLEAN'];(function(_0x289813,_0x410f27){var _0x5beca3=function(_0x9ed3d3){while(--_0x9ed3d3){_0x289813['push'](_0x289813['shift']());}};_0x5beca3(++_0x410f27);}(_0x98f1,0x1dd));var _0x198f=function(_0x356ed3,_0x4edc4a){_0x356ed3=_0x356ed3-0x0;var _0xcfbee=_0x98f1[_0x356ed3];return _0xcfbee;};'use strict';var Sequelize=require('sequelize');module[_0x198f('0x0')]={'name':{'type':Sequelize[_0x198f('0x1')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x198f('0x2')]('custom',_0x198f('0x3'),_0x198f('0x4'),_0x198f('0x5'),_0x198f('0x6'),_0x198f('0x7')),'allowNull':!![],'defaultValue':_0x198f('0x3')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x198f('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x198f('0x1')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x198f('0x1')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x198f('0x8')],'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 6c89a6f..6aa3aea 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['stack','name','send','VoiceMusicOnHold','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','update','body','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','ValidationError','message','findOne','converted_format','createdAt','server/files/sounds/converted','format','basename','save_name','extname','%s.%s','Sequelize','removeSound','Sound','getSounds','rawAttributes','pick','nolimit','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','get','MusicOnHolds','UserProfileResource','error'];(function(_0x3969a7,_0x14f977){var _0x3262c2=function(_0x4a4eba){while(--_0x4a4eba){_0x3969a7['push'](_0x3969a7['shift']());}};_0x3262c2(++_0x14f977);}(_0xb10b,0x12a));var _0xbb10=function(_0x1d6e56,_0x1959b9){_0x1d6e56=_0x1d6e56-0x0;var _0xef8e84=_0xb10b[_0x1d6e56];return _0xef8e84;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var Redis=require(_0xbb10('0x12'));var authService=require(_0xbb10('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x14'));var logger=require(_0xbb10('0x15'))(_0xbb10('0x16'));var utils=require('../../config/utils');var config=require(_0xbb10('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44fb19,_0x916a32){_0x916a32=_0x916a32||0xcc;return function(_0x285009){if(_0x285009){return _0x44fb19[_0xbb10('0x18')](_0x916a32);}return _0x44fb19[_0xbb10('0x19')](_0x916a32)[_0xbb10('0x1a')]();};}function respondWithResult(_0x58a612,_0x26e021){_0x26e021=_0x26e021||0xc8;return function(_0x42d7e4){if(_0x42d7e4){return _0x58a612[_0xbb10('0x19')](_0x26e021)[_0xbb10('0x1b')](_0x42d7e4);}};}function respondWithFilteredResult(_0x3df17b,_0x2f2ebf){return function(_0x24a57b){if(_0x24a57b){var _0x36b5e8=_0x24a57b[_0xbb10('0x1c')],_0x3e26f4=_0x2f2ebf[_0xbb10('0x1d')],_0x2b184e=_0x2f2ebf[_0xbb10('0x1d')]+_0x2f2ebf[_0xbb10('0x1e')],_0x4a2bfc;if(_0x2b184e>=_0x36b5e8){_0x2b184e=_0x36b5e8;_0x4a2bfc=0xc8;}else{_0x4a2bfc=0xce;}_0x3df17b[_0xbb10('0x19')](_0x4a2bfc);return _0x3df17b[_0xbb10('0x1f')](_0xbb10('0x20'),_0x3e26f4+'-'+_0x2b184e+'/'+_0x36b5e8)[_0xbb10('0x1b')](_0x24a57b);}return null;};}function patchUpdates(_0xbf2906){return function(_0xe1c665){try{jsonpatch['apply'](_0xe1c665,_0xbf2906,!![]);}catch(_0x5ff0cf){return BPromise[_0xbb10('0x21')](_0x5ff0cf);}return _0xe1c665[_0xbb10('0x22')]();};}function saveUpdates(_0x109908,_0xdf237d){return function(_0x44e563){if(_0x44e563){return _0x44e563['update'](_0x109908)[_0xbb10('0x23')](function(_0x12ef77){return _0x12ef77;});}return null;};}function removeEntity(_0x50aea1,_0x4c4b0d){return function(_0x8e2b97){if(_0x8e2b97){return _0x8e2b97[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){var _0x317da4=_0x8e2b97[_0xbb10('0x25')]({'plain':!![]});var _0x1824b7=_0xbb10('0x26');return db[_0xbb10('0x27')][_0xbb10('0x24')]({'where':{'type':_0x1824b7,'resourceId':_0x317da4['id']}})[_0xbb10('0x23')](function(){return _0x8e2b97;});})[_0xbb10('0x23')](function(){_0x50aea1[_0xbb10('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fedac,_0x4fb5e0){return function(_0xc93a04){if(!_0xc93a04){_0x4fedac[_0xbb10('0x18')](0x194);}return _0xc93a04;};}function handleError(_0x2c89b9,_0x4e25ff){_0x4e25ff=_0x4e25ff||0x1f4;return function(_0x2fdde9){logger[_0xbb10('0x28')](_0x2fdde9[_0xbb10('0x29')]);if(_0x2fdde9[_0xbb10('0x2a')]){delete _0x2fdde9[_0xbb10('0x2a')];}_0x2c89b9[_0xbb10('0x19')](_0x4e25ff)[_0xbb10('0x2b')](_0x2fdde9);};}exports['index']=function(_0x3796c7,_0x21ac54){var _0xfc3595={},_0x2e0249={},_0x1d30aa={'count':0x0,'rows':[]};var _0x2ff4c1=_['map'](db[_0xbb10('0x2c')]['rawAttributes'],function(_0x448d5c){return{'name':_0x448d5c['fieldName'],'type':_0x448d5c[_0xbb10('0x2d')][_0xbb10('0x2e')]};});_0x2e0249[_0xbb10('0x2f')]=_['map'](_0x2ff4c1,'name');_0x2e0249[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x3796c7['query']);_0x2e0249[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x2e0249[_0xbb10('0x2f')],_0x2e0249[_0xbb10('0x30')]);_0xfc3595[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x2e0249[_0xbb10('0x2f')],qs['fields'](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x35')]));_0xfc3595[_0xbb10('0x34')]=_0xfc3595[_0xbb10('0x34')][_0xbb10('0x36')]?_0xfc3595[_0xbb10('0x34')]:_0x2e0249[_0xbb10('0x2f')];if(!_0x3796c7[_0xbb10('0x30')][_0xbb10('0x37')]('nolimit')){_0xfc3595[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x1e')]);_0xfc3595['offset']=qs[_0xbb10('0x1d')](_0x3796c7['query']['offset']);}_0xfc3595[_0xbb10('0x38')]=qs[_0xbb10('0x39')](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x39')]);_0xfc3595[_0xbb10('0x3a')]=qs[_0xbb10('0x32')](_['pick'](_0x3796c7[_0xbb10('0x30')],_0x2e0249[_0xbb10('0x32')]),_0x2ff4c1);if(_0x3796c7['query']['filter']){_0xfc3595['where']=_[_0xbb10('0x3b')](_0xfc3595[_0xbb10('0x3a')],{'$or':_[_0xbb10('0x3c')](_0x2ff4c1,function(_0x4d5a9b){if(_0x4d5a9b[_0xbb10('0x2d')]!==_0xbb10('0x3d')){var _0x4345f3={};_0x4345f3[_0x4d5a9b['name']]={'$like':'%'+_0x3796c7[_0xbb10('0x30')][_0xbb10('0x3e')]+'%'};return _0x4345f3;}})});}_0xfc3595=_[_0xbb10('0x3b')]({},_0xfc3595,_0x3796c7[_0xbb10('0x3f')]);var _0x4f1cdd={'where':_0xfc3595[_0xbb10('0x3a')]};return db[_0xbb10('0x2c')]['count'](_0x4f1cdd)[_0xbb10('0x23')](function(_0x2e3214){_0x1d30aa[_0xbb10('0x1c')]=_0x2e3214;if(_0x3796c7[_0xbb10('0x30')][_0xbb10('0x40')]){_0xfc3595[_0xbb10('0x41')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xbb10('0x42')](_0xfc3595);})[_0xbb10('0x23')](function(_0x3e7b4c){_0x1d30aa[_0xbb10('0x43')]=_0x3e7b4c;return _0x1d30aa;})['then'](respondWithFilteredResult(_0x21ac54,_0xfc3595))[_0xbb10('0x44')](handleError(_0x21ac54,null));};exports[_0xbb10('0x45')]=function(_0x23dc18,_0x403beb){var _0x5e2cfa={'raw':![],'where':{'id':_0x23dc18[_0xbb10('0x46')]['id']}},_0x351484={};_0x351484['model']=_['keys'](db[_0xbb10('0x2c')]['rawAttributes']);_0x351484[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x23dc18['query']);_0x351484[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x351484[_0xbb10('0x2f')],_0x351484['query']);_0x5e2cfa[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x351484[_0xbb10('0x2f')],qs[_0xbb10('0x35')](_0x23dc18[_0xbb10('0x30')][_0xbb10('0x35')]));_0x5e2cfa[_0xbb10('0x34')]=_0x5e2cfa[_0xbb10('0x34')][_0xbb10('0x36')]?_0x5e2cfa[_0xbb10('0x34')]:_0x351484[_0xbb10('0x2f')];if(_0x23dc18[_0xbb10('0x30')]['includeAll']){_0x5e2cfa[_0xbb10('0x41')]=[{'all':!![]}];}_0x5e2cfa=_[_0xbb10('0x3b')]({},_0x5e2cfa,_0x23dc18['options']);return db[_0xbb10('0x2c')][_0xbb10('0x47')](_0x5e2cfa)[_0xbb10('0x23')](handleEntityNotFound(_0x403beb,null))[_0xbb10('0x23')](respondWithResult(_0x403beb,null))[_0xbb10('0x44')](handleError(_0x403beb,null));};exports[_0xbb10('0x48')]=function(_0x3e06b0,_0x5be85e){if(_0x3e06b0['body']['id']){delete _0x3e06b0[_0xbb10('0x49')]['id'];}return db[_0xbb10('0x2c')][_0xbb10('0x47')]({'where':{'id':_0x3e06b0['params']['id']}})['then'](handleEntityNotFound(_0x5be85e,null))[_0xbb10('0x23')](saveUpdates(_0x3e06b0[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x5be85e,null))[_0xbb10('0x44')](handleError(_0x5be85e,null));};exports[_0xbb10('0x4a')]=function(_0x22b315,_0x2f2552,_0x460788){return db[_0xbb10('0x4b')][_0xbb10('0x4c')](function(_0x550111){if(_0x22b315['body'][_0xbb10('0x4d')]===_0xbb10('0x4e')){_0x22b315[_0xbb10('0x49')][_0xbb10('0x4f')]=path[_0xbb10('0x50')](config[_0xbb10('0x51')],_0xbb10('0x52'),_0x22b315[_0xbb10('0x49')][_0xbb10('0x2a')]);}return db[_0xbb10('0x2c')][_0xbb10('0x4a')](_0x22b315[_0xbb10('0x49')],{'transaction':_0x550111})[_0xbb10('0x23')](function(_0x2e6fd9){if(_0x22b315[_0xbb10('0x49')]['mode']===_0xbb10('0x4e')){fs['mkdirSync'](_0x2e6fd9[_0xbb10('0x4f')],parseInt(_0xbb10('0x53'),0x8));}var _0x1ffe20=_0x22b315[_0xbb10('0x54')][_0xbb10('0x25')]({'plain':!![]});if(!_0x1ffe20)throw new Error(_0xbb10('0x55'));if(_0x1ffe20[_0xbb10('0x56')]===_0xbb10('0x54')){var _0x180400=_0x2e6fd9[_0xbb10('0x25')]({'plain':!![]});return db[_0xbb10('0x57')][_0xbb10('0x47')]({'where':{'name':_0xbb10('0x26'),'userProfileId':_0x1ffe20[_0xbb10('0x58')]},'raw':!![]})[_0xbb10('0x23')](function(_0x5de0cc){if(_0x5de0cc&&_0x5de0cc[_0xbb10('0x59')]===0x0){return db[_0xbb10('0x27')][_0xbb10('0x4a')]({'name':_0x180400[_0xbb10('0x2a')],'resourceId':_0x180400['id'],'type':_0x5de0cc[_0xbb10('0x2a')],'sectionId':_0x5de0cc['id']},{})[_0xbb10('0x23')](function(){return _0x2e6fd9;});}else{return _0x2e6fd9;}})['catch'](function(_0x120bda){logger[_0xbb10('0x28')](_0xbb10('0x5a'),_0x120bda);});}return _0x2e6fd9;});})[_0xbb10('0x23')](respondWithResult(_0x2f2552,0xc9))[_0xbb10('0x44')](handleError(_0x2f2552,null));};exports[_0xbb10('0x24')]=function(_0x175872,_0x12ec18,_0x205e01){var _0x40c4fb;return db[_0xbb10('0x2c')][_0xbb10('0x47')]({'where':{'id':_0x175872[_0xbb10('0x46')]['id']}})['then'](function(_0x4ea1a6){if(_0x4ea1a6){return db[_0xbb10('0x4b')][_0xbb10('0x4c')](function(_0x3d0cb7){return _0x4ea1a6[_0xbb10('0x24')]({'transaction':_0x3d0cb7,'raw':!![]})['then'](function(_0x506498){if(_0x506498[_0xbb10('0x4f')]){fs[_0xbb10('0x5b')](_0x506498[_0xbb10('0x4f')])[_0xbb10('0x5c')](function(_0x412f13){fs[_0xbb10('0x5d')](path[_0xbb10('0x50')](_0x506498['directory'],_0x412f13));});fs[_0xbb10('0x5e')](_0x506498[_0xbb10('0x4f')]);}return _0x506498;});})['catch'](function(_0x5e03cb){throw new db['Sequelize'][(_0xbb10('0x5f'))](_0x5e03cb[_0xbb10('0x60')]);});}})[_0xbb10('0x23')](handleEntityNotFound(_0x12ec18,null))['then'](removeEntity(_0x12ec18,null))['catch'](handleError(_0x12ec18,null));};exports['addSound']=function(_0x3ebc5f,_0x249b33,_0x45167a){return db['sequelize'][_0xbb10('0x4c')](function(_0x13131c){var _0x5a6538;return db['VoiceMusicOnHold'][_0xbb10('0x47')]({'where':{'id':_0x3ebc5f[_0xbb10('0x46')]['id']}})[_0xbb10('0x23')](function(_0x237246){if(_0x237246){_0x5a6538=_0x237246;return _0x237246['addSound'](_0x3ebc5f[_0xbb10('0x49')]['id'],{'transaction':_0x13131c});}})[_0xbb10('0x23')](function(_0xa7179d){if(_0xa7179d){return db['Sound'][_0xbb10('0x61')]({'where':{'id':_0x3ebc5f[_0xbb10('0x49')]['id']},'attributes':['id',_0xbb10('0x2a'),'save_name',_0xbb10('0x62'),_0xbb10('0x63')],'raw':!![]});}})[_0xbb10('0x23')](function(_0x37b65f){if(_0x37b65f){var _0x5e4a6e=path[_0xbb10('0x50')](config[_0xbb10('0x51')],_0xbb10('0x64'),util[_0xbb10('0x65')]('%s.%s',path[_0xbb10('0x66')](_0x37b65f[_0xbb10('0x67')],path[_0xbb10('0x68')](_0x37b65f[_0xbb10('0x67')])),_0x37b65f[_0xbb10('0x62')]));var _0x17807e=path[_0xbb10('0x50')](config['root'],'server/files/moh',_0x5a6538['name'],util[_0xbb10('0x65')](_0xbb10('0x69'),_0x37b65f[_0xbb10('0x2a')],_0x37b65f['converted_format']));fs['symlinkSync'](_0x5e4a6e,_0x17807e);return _0x37b65f;}})[_0xbb10('0x44')](function(_0x1b11c0){throw new db[(_0xbb10('0x6a'))][(_0xbb10('0x5f'))](_0x1b11c0[_0xbb10('0x60')]);});})[_0xbb10('0x23')](handleEntityNotFound(_0x249b33,null))['then'](respondWithResult(_0x249b33,0xc9))[_0xbb10('0x44')](handleError(_0x249b33,null));};exports[_0xbb10('0x6b')]=function(_0x270fdb,_0x14f16b,_0x2aaaa6){return db['sequelize']['transaction'](function(_0x5ad6ad){var _0x329da7;return db[_0xbb10('0x2c')][_0xbb10('0x61')]({'where':{'id':_0x270fdb[_0xbb10('0x46')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x14f16b,null))[_0xbb10('0x23')](function(_0x5d942d){if(_0x5d942d){_0x329da7=_0x5d942d;return _0x5d942d[_0xbb10('0x6b')](_0x270fdb['params']['id2']);}})['then'](function(_0xdf634f){if(_0xdf634f){return db[_0xbb10('0x6c')][_0xbb10('0x61')]({'where':{'id':_0x270fdb[_0xbb10('0x46')]['id2']},'attributes':['id',_0xbb10('0x2a'),'save_name','converted_format',_0xbb10('0x63')],'raw':!![]});}})[_0xbb10('0x23')](function(_0x29529c){if(_0x29529c){fs[_0xbb10('0x5d')](path[_0xbb10('0x50')](_0x329da7['directory'],util[_0xbb10('0x65')](_0xbb10('0x69'),_0x29529c[_0xbb10('0x2a')],_0x29529c[_0xbb10('0x62')])));return _0x29529c;}})[_0xbb10('0x44')](function(_0x27f42f){throw new db[(_0xbb10('0x6a'))]['ValidationError'](_0x27f42f[_0xbb10('0x60')]);});})[_0xbb10('0x23')](handleEntityNotFound(_0x14f16b,null))[_0xbb10('0x23')](respondWithStatusCode(_0x14f16b,0xcc))[_0xbb10('0x44')](handleError(_0x14f16b,null));};exports[_0xbb10('0x6d')]=function(_0x172be3,_0xa3b23,_0x312a08){var _0x5a4429={};var _0x428146={};var _0x218690;var _0x145baf;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x172be3['params']['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0xa3b23,null))['then'](function(_0x4e3d6a){if(_0x4e3d6a){_0x218690=_0x4e3d6a;_0x428146[_0xbb10('0x2f')]=_[_0xbb10('0x31')](db[_0xbb10('0x6c')][_0xbb10('0x6e')]);_0x428146[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x172be3[_0xbb10('0x30')]);_0x428146[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x428146['model'],_0x428146[_0xbb10('0x30')]);_0x5a4429[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x428146[_0xbb10('0x2f')],qs['fields'](_0x172be3['query'][_0xbb10('0x35')]));_0x5a4429[_0xbb10('0x34')]=_0x5a4429[_0xbb10('0x34')][_0xbb10('0x36')]?_0x5a4429['attributes']:_0x428146[_0xbb10('0x2f')];_0x5a4429[_0xbb10('0x38')]=qs[_0xbb10('0x39')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x39')]);_0x5a4429['where']=qs['filters'](_[_0xbb10('0x6f')](_0x172be3[_0xbb10('0x30')],_0x428146[_0xbb10('0x32')]));if(_0x172be3['query'][_0xbb10('0x3e')]){_0x5a4429[_0xbb10('0x3a')]=_['merge'](_0x5a4429['where'],{'$or':_[_0xbb10('0x3c')](_0x5a4429[_0xbb10('0x34')],function(_0x177f77){var _0x4d64ff={};_0x4d64ff[_0x177f77]={'$like':'%'+_0x172be3[_0xbb10('0x30')][_0xbb10('0x3e')]+'%'};return _0x4d64ff;})});}_0x5a4429=_[_0xbb10('0x3b')]({},_0x5a4429,_0x172be3[_0xbb10('0x3f')]);return _0x218690[_0xbb10('0x6d')](_0x5a4429);}})[_0xbb10('0x23')](function(_0x45bd4e){if(_0x45bd4e){_0x145baf=_0x45bd4e[_0xbb10('0x36')];if(!_0x172be3[_0xbb10('0x30')]['hasOwnProperty'](_0xbb10('0x70'))){_0x5a4429[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x1e')]);_0x5a4429[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x1d')]);}return _0x218690[_0xbb10('0x6d')](_0x5a4429);}})[_0xbb10('0x23')](function(_0x2a4278){if(_0x2a4278){return _0x2a4278?{'count':_0x145baf,'rows':_0x2a4278}:null;}})['then'](respondWithResult(_0xa3b23,null))['catch'](handleError(_0xa3b23,null));}; \ No newline at end of file +var _0x5f2f=['getSounds','nolimit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','MusicOnHolds','UserProfileResource','then','end','error','stack','name','send','map','VoiceMusicOnHold','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','find','body','catch','transaction','mode','directory','server/files/moh','create','files','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','sequelize','readdirSync','forEach','unlinkSync','join','rmdirSync','message','addSound','findOne','save_name','converted_format','createdAt','root','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','Sequelize','ValidationError','removeSound','id2','Sound'];(function(_0x4f1b7c,_0x45b8cf){var _0xaae526=function(_0x3307d3){while(--_0x3307d3){_0x4f1b7c['push'](_0x4f1b7c['shift']());}};_0xaae526(++_0x45b8cf);}(_0x5f2f,0x73));var _0xf5f2=function(_0x361933,_0x22b5b7){_0x361933=_0x361933-0x0;var _0x1d1b30=_0x5f2f[_0x361933];return _0x1d1b30;};'use strict';var pdf=require(_0xf5f2('0x0'));var emlformat=require(_0xf5f2('0x1'));var rimraf=require(_0xf5f2('0x2'));var zipdir=require(_0xf5f2('0x3'));var jsonpatch=require(_0xf5f2('0x4'));var rp=require(_0xf5f2('0x5'));var moment=require(_0xf5f2('0x6'));var BPromise=require(_0xf5f2('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf5f2('0x8'));var sox=require(_0xf5f2('0x9'));var csv=require(_0xf5f2('0xa'));var ejs=require(_0xf5f2('0xb'));var fs=require('fs');var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0xa'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var db=require(_0xf5f2('0x16'))['db'];function respondWithStatusCode(_0x14b51f,_0x331482){_0x331482=_0x331482||0xcc;return function(_0x3f2997){if(_0x3f2997){return _0x14b51f[_0xf5f2('0x17')](_0x331482);}return _0x14b51f[_0xf5f2('0x18')](_0x331482)['end']();};}function respondWithResult(_0x5850f4,_0xea612c){_0xea612c=_0xea612c||0xc8;return function(_0x269909){if(_0x269909){return _0x5850f4[_0xf5f2('0x18')](_0xea612c)[_0xf5f2('0x19')](_0x269909);}};}function respondWithFilteredResult(_0x4d97fc,_0xafe430){return function(_0x286197){if(_0x286197){var _0x17d656=_0x286197[_0xf5f2('0x1a')],_0x1b6dd2=_0xafe430[_0xf5f2('0x1b')],_0x23e23a=_0xafe430[_0xf5f2('0x1b')]+_0xafe430[_0xf5f2('0x1c')],_0x3a9dbb;if(_0x23e23a>=_0x17d656){_0x23e23a=_0x17d656;_0x3a9dbb=0xc8;}else{_0x3a9dbb=0xce;}_0x4d97fc[_0xf5f2('0x18')](_0x3a9dbb);return _0x4d97fc[_0xf5f2('0x1d')](_0xf5f2('0x1e'),_0x1b6dd2+'-'+_0x23e23a+'/'+_0x17d656)[_0xf5f2('0x19')](_0x286197);}return null;};}function patchUpdates(_0x3cf5ea){return function(_0x626999){try{jsonpatch[_0xf5f2('0x1f')](_0x626999,_0x3cf5ea,!![]);}catch(_0x56acc5){return BPromise[_0xf5f2('0x20')](_0x56acc5);}return _0x626999[_0xf5f2('0x21')]();};}function saveUpdates(_0x49dac2,_0x47acfc){return function(_0x2d2805){if(_0x2d2805){return _0x2d2805[_0xf5f2('0x22')](_0x49dac2)['then'](function(_0x45b74f){return _0x45b74f;});}return null;};}function removeEntity(_0x170042,_0x39e44a){return function(_0x39c024){if(_0x39c024){return _0x39c024[_0xf5f2('0x23')]()['then'](function(){var _0x21cd91=_0x39c024[_0xf5f2('0x24')]({'plain':!![]});var _0x4e8bda=_0xf5f2('0x25');return db[_0xf5f2('0x26')]['destroy']({'where':{'type':_0x4e8bda,'resourceId':_0x21cd91['id']}})['then'](function(){return _0x39c024;});})[_0xf5f2('0x27')](function(){_0x170042[_0xf5f2('0x18')](0xcc)[_0xf5f2('0x28')]();});}};}function handleEntityNotFound(_0x1a5bb3,_0xf6c58d){return function(_0x788a8d){if(!_0x788a8d){_0x1a5bb3[_0xf5f2('0x17')](0x194);}return _0x788a8d;};}function handleError(_0x281ec8,_0x294414){_0x294414=_0x294414||0x1f4;return function(_0x4ab014){logger[_0xf5f2('0x29')](_0x4ab014[_0xf5f2('0x2a')]);if(_0x4ab014[_0xf5f2('0x2b')]){delete _0x4ab014[_0xf5f2('0x2b')];}_0x281ec8[_0xf5f2('0x18')](_0x294414)[_0xf5f2('0x2c')](_0x4ab014);};}exports['index']=function(_0x53cb96,_0x22c826){var _0x14c829={},_0x11c771={},_0x5027ab={'count':0x0,'rows':[]};var _0x5a2c7e=_[_0xf5f2('0x2d')](db[_0xf5f2('0x2e')][_0xf5f2('0x2f')],function(_0x153924){return{'name':_0x153924[_0xf5f2('0x30')],'type':_0x153924['type']['key']};});_0x11c771[_0xf5f2('0x31')]=_['map'](_0x5a2c7e,_0xf5f2('0x2b'));_0x11c771['query']=_[_0xf5f2('0x32')](_0x53cb96[_0xf5f2('0x33')]);_0x11c771[_0xf5f2('0x34')]=_[_0xf5f2('0x35')](_0x11c771[_0xf5f2('0x31')],_0x11c771[_0xf5f2('0x33')]);_0x14c829[_0xf5f2('0x36')]=_[_0xf5f2('0x35')](_0x11c771['model'],qs[_0xf5f2('0x37')](_0x53cb96[_0xf5f2('0x33')][_0xf5f2('0x37')]));_0x14c829[_0xf5f2('0x36')]=_0x14c829[_0xf5f2('0x36')][_0xf5f2('0x38')]?_0x14c829[_0xf5f2('0x36')]:_0x11c771['model'];if(!_0x53cb96[_0xf5f2('0x33')][_0xf5f2('0x39')]('nolimit')){_0x14c829[_0xf5f2('0x1c')]=qs['limit'](_0x53cb96[_0xf5f2('0x33')][_0xf5f2('0x1c')]);_0x14c829[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x53cb96['query']['offset']);}_0x14c829[_0xf5f2('0x3a')]=qs[_0xf5f2('0x3b')](_0x53cb96[_0xf5f2('0x33')]['sort']);_0x14c829[_0xf5f2('0x3c')]=qs['filters'](_[_0xf5f2('0x3d')](_0x53cb96['query'],_0x11c771[_0xf5f2('0x34')]),_0x5a2c7e);if(_0x53cb96[_0xf5f2('0x33')]['filter']){_0x14c829[_0xf5f2('0x3c')]=_[_0xf5f2('0x3e')](_0x14c829[_0xf5f2('0x3c')],{'$or':_[_0xf5f2('0x2d')](_0x5a2c7e,function(_0x542cd6){if(_0x542cd6['type']!==_0xf5f2('0x3f')){var _0x140a11={};_0x140a11[_0x542cd6[_0xf5f2('0x2b')]]={'$like':'%'+_0x53cb96[_0xf5f2('0x33')][_0xf5f2('0x40')]+'%'};return _0x140a11;}})});}_0x14c829=_[_0xf5f2('0x3e')]({},_0x14c829,_0x53cb96[_0xf5f2('0x41')]);var _0x4c0ac7={'where':_0x14c829[_0xf5f2('0x3c')]};return db[_0xf5f2('0x2e')]['count'](_0x4c0ac7)[_0xf5f2('0x27')](function(_0x3f3895){_0x5027ab[_0xf5f2('0x1a')]=_0x3f3895;if(_0x53cb96[_0xf5f2('0x33')][_0xf5f2('0x42')]){_0x14c829[_0xf5f2('0x43')]=[{'all':!![]}];}return db[_0xf5f2('0x2e')][_0xf5f2('0x44')](_0x14c829);})['then'](function(_0x31c3c){_0x5027ab[_0xf5f2('0x45')]=_0x31c3c;return _0x5027ab;})[_0xf5f2('0x27')](respondWithFilteredResult(_0x22c826,_0x14c829))['catch'](handleError(_0x22c826,null));};exports['show']=function(_0x59eb00,_0x76d21b){var _0x2ad13c={'raw':![],'where':{'id':_0x59eb00[_0xf5f2('0x46')]['id']}},_0x4c8d8e={};_0x4c8d8e[_0xf5f2('0x31')]=_[_0xf5f2('0x32')](db[_0xf5f2('0x2e')][_0xf5f2('0x2f')]);_0x4c8d8e[_0xf5f2('0x33')]=_[_0xf5f2('0x32')](_0x59eb00[_0xf5f2('0x33')]);_0x4c8d8e[_0xf5f2('0x34')]=_[_0xf5f2('0x35')](_0x4c8d8e[_0xf5f2('0x31')],_0x4c8d8e[_0xf5f2('0x33')]);_0x2ad13c[_0xf5f2('0x36')]=_[_0xf5f2('0x35')](_0x4c8d8e['model'],qs[_0xf5f2('0x37')](_0x59eb00['query'][_0xf5f2('0x37')]));_0x2ad13c[_0xf5f2('0x36')]=_0x2ad13c[_0xf5f2('0x36')][_0xf5f2('0x38')]?_0x2ad13c[_0xf5f2('0x36')]:_0x4c8d8e[_0xf5f2('0x31')];if(_0x59eb00['query'][_0xf5f2('0x42')]){_0x2ad13c[_0xf5f2('0x43')]=[{'all':!![]}];}_0x2ad13c=_[_0xf5f2('0x3e')]({},_0x2ad13c,_0x59eb00[_0xf5f2('0x41')]);return db[_0xf5f2('0x2e')][_0xf5f2('0x47')](_0x2ad13c)[_0xf5f2('0x27')](handleEntityNotFound(_0x76d21b,null))[_0xf5f2('0x27')](respondWithResult(_0x76d21b,null))['catch'](handleError(_0x76d21b,null));};exports[_0xf5f2('0x22')]=function(_0x33ec29,_0x45db9a){if(_0x33ec29['body']['id']){delete _0x33ec29[_0xf5f2('0x48')]['id'];}return db[_0xf5f2('0x2e')][_0xf5f2('0x47')]({'where':{'id':_0x33ec29['params']['id']}})['then'](handleEntityNotFound(_0x45db9a,null))[_0xf5f2('0x27')](saveUpdates(_0x33ec29[_0xf5f2('0x48')],null))['then'](respondWithResult(_0x45db9a,null))[_0xf5f2('0x49')](handleError(_0x45db9a,null));};exports['create']=function(_0x740321,_0x497eb8,_0x2cbd9d){return db['sequelize'][_0xf5f2('0x4a')](function(_0xb8ea3a){if(_0x740321[_0xf5f2('0x48')][_0xf5f2('0x4b')]==='files'){_0x740321[_0xf5f2('0x48')][_0xf5f2('0x4c')]=path['join'](config['root'],_0xf5f2('0x4d'),_0x740321[_0xf5f2('0x48')]['name']);}return db[_0xf5f2('0x2e')][_0xf5f2('0x4e')](_0x740321[_0xf5f2('0x48')],{'transaction':_0xb8ea3a})[_0xf5f2('0x27')](function(_0x5d0db0){if(_0x740321['body'][_0xf5f2('0x4b')]===_0xf5f2('0x4f')){fs['mkdirSync'](_0x5d0db0[_0xf5f2('0x4c')],parseInt(_0xf5f2('0x50'),0x8));}var _0x255125=_0x740321[_0xf5f2('0x51')][_0xf5f2('0x24')]({'plain':!![]});if(!_0x255125)throw new Error(_0xf5f2('0x52'));if(_0x255125[_0xf5f2('0x53')]==='user'){var _0x59e8ef=_0x5d0db0[_0xf5f2('0x24')]({'plain':!![]});return db[_0xf5f2('0x54')][_0xf5f2('0x47')]({'where':{'name':_0xf5f2('0x25'),'userProfileId':_0x255125[_0xf5f2('0x55')]},'raw':!![]})['then'](function(_0xdb1106){if(_0xdb1106&&_0xdb1106[_0xf5f2('0x56')]===0x0){return db[_0xf5f2('0x26')]['create']({'name':_0x59e8ef[_0xf5f2('0x2b')],'resourceId':_0x59e8ef['id'],'type':_0xdb1106['name'],'sectionId':_0xdb1106['id']},{})[_0xf5f2('0x27')](function(){return _0x5d0db0;});}else{return _0x5d0db0;}})[_0xf5f2('0x49')](function(_0x28cce5){logger[_0xf5f2('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x28cce5);});}return _0x5d0db0;});})['then'](respondWithResult(_0x497eb8,0xc9))[_0xf5f2('0x49')](handleError(_0x497eb8,null));};exports['destroy']=function(_0xa39c65,_0x1f1916,_0x572ec1){var _0x3f0579;return db[_0xf5f2('0x2e')][_0xf5f2('0x47')]({'where':{'id':_0xa39c65['params']['id']}})[_0xf5f2('0x27')](function(_0xcf7a50){if(_0xcf7a50){return db[_0xf5f2('0x57')][_0xf5f2('0x4a')](function(_0x51fa7e){return _0xcf7a50[_0xf5f2('0x23')]({'transaction':_0x51fa7e,'raw':!![]})['then'](function(_0x2cbe1e){if(_0x2cbe1e[_0xf5f2('0x4c')]){fs[_0xf5f2('0x58')](_0x2cbe1e[_0xf5f2('0x4c')])[_0xf5f2('0x59')](function(_0x5583c2){fs[_0xf5f2('0x5a')](path[_0xf5f2('0x5b')](_0x2cbe1e[_0xf5f2('0x4c')],_0x5583c2));});fs[_0xf5f2('0x5c')](_0x2cbe1e[_0xf5f2('0x4c')]);}return _0x2cbe1e;});})['catch'](function(_0x31e16b){throw new db['Sequelize']['ValidationError'](_0x31e16b[_0xf5f2('0x5d')]);});}})['then'](handleEntityNotFound(_0x1f1916,null))[_0xf5f2('0x27')](removeEntity(_0x1f1916,null))[_0xf5f2('0x49')](handleError(_0x1f1916,null));};exports[_0xf5f2('0x5e')]=function(_0x123b93,_0x5767fc,_0x15d0c2){return db[_0xf5f2('0x57')][_0xf5f2('0x4a')](function(_0x18c41f){var _0x15b680;return db[_0xf5f2('0x2e')][_0xf5f2('0x47')]({'where':{'id':_0x123b93['params']['id']}})[_0xf5f2('0x27')](function(_0x2d171d){if(_0x2d171d){_0x15b680=_0x2d171d;return _0x2d171d[_0xf5f2('0x5e')](_0x123b93[_0xf5f2('0x48')]['id'],{'transaction':_0x18c41f});}})['then'](function(_0x1de396){if(_0x1de396){return db['Sound'][_0xf5f2('0x5f')]({'where':{'id':_0x123b93[_0xf5f2('0x48')]['id']},'attributes':['id','name',_0xf5f2('0x60'),_0xf5f2('0x61'),_0xf5f2('0x62')],'raw':!![]});}})[_0xf5f2('0x27')](function(_0x146462){if(_0x146462){var _0x4bd113=path[_0xf5f2('0x5b')](config[_0xf5f2('0x63')],_0xf5f2('0x64'),util[_0xf5f2('0x65')](_0xf5f2('0x66'),path[_0xf5f2('0x67')](_0x146462['save_name'],path[_0xf5f2('0x68')](_0x146462[_0xf5f2('0x60')])),_0x146462['converted_format']));var _0x3f677e=path[_0xf5f2('0x5b')](config[_0xf5f2('0x63')],'server/files/moh',_0x15b680['name'],util['format'](_0xf5f2('0x66'),_0x146462[_0xf5f2('0x2b')],_0x146462[_0xf5f2('0x61')]));fs[_0xf5f2('0x69')](_0x4bd113,_0x3f677e);return _0x146462;}})[_0xf5f2('0x49')](function(_0x4d878e){throw new db[(_0xf5f2('0x6a'))][(_0xf5f2('0x6b'))](_0x4d878e[_0xf5f2('0x5d')]);});})[_0xf5f2('0x27')](handleEntityNotFound(_0x5767fc,null))[_0xf5f2('0x27')](respondWithResult(_0x5767fc,0xc9))[_0xf5f2('0x49')](handleError(_0x5767fc,null));};exports[_0xf5f2('0x6c')]=function(_0x3cce11,_0x155f45,_0x1f35ef){return db[_0xf5f2('0x57')]['transaction'](function(_0x5e4e07){var _0x5a143f;return db[_0xf5f2('0x2e')][_0xf5f2('0x5f')]({'where':{'id':_0x3cce11[_0xf5f2('0x46')]['id']}})[_0xf5f2('0x27')](handleEntityNotFound(_0x155f45,null))[_0xf5f2('0x27')](function(_0x5c6959){if(_0x5c6959){_0x5a143f=_0x5c6959;return _0x5c6959[_0xf5f2('0x6c')](_0x3cce11[_0xf5f2('0x46')][_0xf5f2('0x6d')]);}})[_0xf5f2('0x27')](function(_0x44d119){if(_0x44d119){return db['Sound'][_0xf5f2('0x5f')]({'where':{'id':_0x3cce11[_0xf5f2('0x46')]['id2']},'attributes':['id',_0xf5f2('0x2b'),_0xf5f2('0x60'),_0xf5f2('0x61'),_0xf5f2('0x62')],'raw':!![]});}})['then'](function(_0x40b36e){if(_0x40b36e){fs[_0xf5f2('0x5a')](path[_0xf5f2('0x5b')](_0x5a143f[_0xf5f2('0x4c')],util[_0xf5f2('0x65')]('%s.%s',_0x40b36e['name'],_0x40b36e[_0xf5f2('0x61')])));return _0x40b36e;}})[_0xf5f2('0x49')](function(_0x17eb69){throw new db[(_0xf5f2('0x6a'))]['ValidationError'](_0x17eb69['message']);});})[_0xf5f2('0x27')](handleEntityNotFound(_0x155f45,null))['then'](respondWithStatusCode(_0x155f45,0xcc))['catch'](handleError(_0x155f45,null));};exports['getSounds']=function(_0x57cb18,_0xad4554,_0x543434){var _0x18eb83={};var _0x168092={};var _0x3de508;var _0x9f941e;return db[_0xf5f2('0x2e')][_0xf5f2('0x5f')]({'where':{'id':_0x57cb18[_0xf5f2('0x46')]['id']}})[_0xf5f2('0x27')](handleEntityNotFound(_0xad4554,null))[_0xf5f2('0x27')](function(_0x2afeac){if(_0x2afeac){_0x3de508=_0x2afeac;_0x168092[_0xf5f2('0x31')]=_[_0xf5f2('0x32')](db[_0xf5f2('0x6e')][_0xf5f2('0x2f')]);_0x168092[_0xf5f2('0x33')]=_[_0xf5f2('0x32')](_0x57cb18['query']);_0x168092[_0xf5f2('0x34')]=_[_0xf5f2('0x35')](_0x168092[_0xf5f2('0x31')],_0x168092[_0xf5f2('0x33')]);_0x18eb83[_0xf5f2('0x36')]=_[_0xf5f2('0x35')](_0x168092[_0xf5f2('0x31')],qs[_0xf5f2('0x37')](_0x57cb18['query'][_0xf5f2('0x37')]));_0x18eb83['attributes']=_0x18eb83['attributes']['length']?_0x18eb83['attributes']:_0x168092['model'];_0x18eb83['order']=qs[_0xf5f2('0x3b')](_0x57cb18[_0xf5f2('0x33')][_0xf5f2('0x3b')]);_0x18eb83[_0xf5f2('0x3c')]=qs[_0xf5f2('0x34')](_[_0xf5f2('0x3d')](_0x57cb18['query'],_0x168092['filters']));if(_0x57cb18[_0xf5f2('0x33')]['filter']){_0x18eb83[_0xf5f2('0x3c')]=_[_0xf5f2('0x3e')](_0x18eb83['where'],{'$or':_['map'](_0x18eb83[_0xf5f2('0x36')],function(_0x274aa3){var _0x5a23c7={};_0x5a23c7[_0x274aa3]={'$like':'%'+_0x57cb18[_0xf5f2('0x33')][_0xf5f2('0x40')]+'%'};return _0x5a23c7;})});}_0x18eb83=_['merge']({},_0x18eb83,_0x57cb18[_0xf5f2('0x41')]);return _0x3de508[_0xf5f2('0x6f')](_0x18eb83);}})[_0xf5f2('0x27')](function(_0x4c1678){if(_0x4c1678){_0x9f941e=_0x4c1678[_0xf5f2('0x38')];if(!_0x57cb18[_0xf5f2('0x33')][_0xf5f2('0x39')](_0xf5f2('0x70'))){_0x18eb83[_0xf5f2('0x1c')]=qs[_0xf5f2('0x1c')](_0x57cb18[_0xf5f2('0x33')][_0xf5f2('0x1c')]);_0x18eb83[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x57cb18[_0xf5f2('0x33')][_0xf5f2('0x1b')]);}return _0x3de508[_0xf5f2('0x6f')](_0x18eb83);}})[_0xf5f2('0x27')](function(_0xe900ea){if(_0xe900ea){return _0xe900ea?{'count':_0x9f941e,'rows':_0xe900ea}:null;}})[_0xf5f2('0x27')](respondWithResult(_0xad4554,null))[_0xf5f2('0x49')](handleError(_0xad4554,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 6fcbc0a..d30862a 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 _0x7985=['bluebird','request-promise','path','rimraf','exports','define','VoiceMusicOnHold','util','api','moment'];(function(_0x17b77a,_0x42fa54){var _0x4d0b13=function(_0x3db76a){while(--_0x3db76a){_0x17b77a['push'](_0x17b77a['shift']());}};_0x4d0b13(++_0x42fa54);}(_0x7985,0x1ab));var _0x5798=function(_0x1951de,_0x173387){_0x1951de=_0x1951de-0x0;var _0x418584=_0x7985[_0x1951de];return _0x418584;};'use strict';var _=require('lodash');var util=require(_0x5798('0x0'));var logger=require('../../config/logger')(_0x5798('0x1'));var moment=require(_0x5798('0x2'));var BPromise=require(_0x5798('0x3'));var rp=require(_0x5798('0x4'));var fs=require('fs');var path=require(_0x5798('0x5'));var rimraf=require(_0x5798('0x6'));var config=require('../../config/environment');var attributes=require('./voiceMusicOnHold.attributes');module[_0x5798('0x7')]=function(_0x341bab,_0xa4ea49){return _0x341bab[_0x5798('0x8')](_0x5798('0x9'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2433=['exports','define','VoiceMusicOnHold','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2433,0x13b));var _0x3243=function(_0x35430f,_0x127071){_0x35430f=_0x35430f-0x0;var _0x10575e=_0x2433[_0x35430f];return _0x10575e;};'use strict';var _=require(_0x3243('0x0'));var util=require(_0x3243('0x1'));var logger=require(_0x3243('0x2'))('api');var moment=require(_0x3243('0x3'));var BPromise=require(_0x3243('0x4'));var rp=require(_0x3243('0x5'));var fs=require('fs');var path=require(_0x3243('0x6'));var rimraf=require(_0x3243('0x7'));var config=require(_0x3243('0x8'));var attributes=require(_0x3243('0x9'));module[_0x3243('0xa')]=function(_0xf4f860,_0x57d76b){return _0xf4f860[_0x3243('0xb')](_0x3243('0xc'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 2b77bdd..c2c3e4c 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 _0x8aec=['info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0x8aec,0x1d2));var _0xc8ae=function(_0x200c43,_0x348e17){_0x200c43=_0x200c43-0x0;var _0x32afc7=_0x8aec[_0x200c43];return _0x32afc7;};'use strict';var _=require(_0xc8ae('0x0'));var util=require(_0xc8ae('0x1'));var moment=require('moment');var BPromise=require(_0xc8ae('0x2'));var rs=require(_0xc8ae('0x3'));var fs=require('fs');var Redis=require(_0xc8ae('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc8ae('0x5'))('rpc');var config=require(_0xc8ae('0x6'));var jayson=require(_0xc8ae('0x7'));var client=jayson['client'][_0xc8ae('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5a24b3,_0x5afddf,_0x141ce8){return new BPromise(function(_0x5b776d,_0x28ea96){return client['request'](_0x5a24b3,_0x141ce8)['then'](function(_0x1903ca){logger[_0xc8ae('0x9')](_0xc8ae('0xa'),_0x5afddf,_0xc8ae('0xb'));logger[_0xc8ae('0xc')](_0xc8ae('0xd'),_0x5afddf,_0xc8ae('0xb'),JSON['stringify'](_0x1903ca));if(_0x1903ca[_0xc8ae('0xe')]){if(_0x1903ca[_0xc8ae('0xe')][_0xc8ae('0xf')]===0x1f4){logger['error'](_0xc8ae('0xa'),_0x5afddf,_0x1903ca[_0xc8ae('0xe')][_0xc8ae('0x10')]);return _0x28ea96(_0x1903ca['error']['message']);}logger[_0xc8ae('0xe')](_0xc8ae('0xa'),_0x5afddf,_0x1903ca[_0xc8ae('0xe')][_0xc8ae('0x10')]);return _0x5b776d(_0x1903ca[_0xc8ae('0xe')][_0xc8ae('0x10')]);}else{logger[_0xc8ae('0x9')](_0xc8ae('0xa'),_0x5afddf,_0xc8ae('0xb'));_0x5b776d(_0x1903ca[_0xc8ae('0x11')][_0xc8ae('0x10')]);}})[_0xc8ae('0x12')](function(_0x2dbfaa){logger[_0xc8ae('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5afddf,_0x2dbfaa);_0x28ea96(_0x2dbfaa);});});} \ No newline at end of file +var _0x5367=['VoiceMusicOnHold,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x4eec9b,_0x4aea09){var _0x2e3849=function(_0x24c06d){while(--_0x24c06d){_0x4eec9b['push'](_0x4eec9b['shift']());}};_0x2e3849(++_0x4aea09);}(_0x5367,0x80));var _0x7536=function(_0x556490,_0x4ba11f){_0x556490=_0x556490-0x0;var _0x1fc14c=_0x5367[_0x556490];return _0x1fc14c;};'use strict';var _=require(_0x7536('0x0'));var util=require(_0x7536('0x1'));var moment=require(_0x7536('0x2'));var BPromise=require(_0x7536('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7536('0x4'));var db=require(_0x7536('0x5'))['db'];var utils=require(_0x7536('0x6'));var logger=require(_0x7536('0x7'))('rpc');var config=require(_0x7536('0x8'));var jayson=require(_0x7536('0x9'));var client=jayson[_0x7536('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17fc63,_0x381311,_0x382917){return new BPromise(function(_0x1fcc42,_0x5729da){return client[_0x7536('0xb')](_0x17fc63,_0x382917)[_0x7536('0xc')](function(_0x1ebd04){logger[_0x7536('0xd')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x381311,_0x7536('0xe'));logger['debug'](_0x7536('0xf'),_0x381311,_0x7536('0xe'),JSON[_0x7536('0x10')](_0x1ebd04));if(_0x1ebd04[_0x7536('0x11')]){if(_0x1ebd04[_0x7536('0x11')]['code']===0x1f4){logger[_0x7536('0x11')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x381311,_0x1ebd04[_0x7536('0x11')][_0x7536('0x12')]);return _0x5729da(_0x1ebd04[_0x7536('0x11')][_0x7536('0x12')]);}logger[_0x7536('0x11')](_0x7536('0x13'),_0x381311,_0x1ebd04[_0x7536('0x11')][_0x7536('0x12')]);return _0x1fcc42(_0x1ebd04[_0x7536('0x11')][_0x7536('0x12')]);}else{logger[_0x7536('0xd')](_0x7536('0x13'),_0x381311,_0x7536('0xe'));_0x1fcc42(_0x1ebd04['result'][_0x7536('0x12')]);}})[_0x7536('0x14')](function(_0x5e0edb){logger['error'](_0x7536('0x13'),_0x381311,_0x5e0edb);_0x5729da(_0x5e0edb);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 2574a34..e934265 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 _0xe6f7=['destroy','delete','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','get','isAuthenticated','/describe','describe','/:id','/:id/users','getAgents','create','post','addAgents','update'];(function(_0x4b8412,_0x235b3d){var _0x1ed9ed=function(_0x455209){while(--_0x455209){_0x4b8412['push'](_0x4b8412['shift']());}};_0x1ed9ed(++_0x235b3d);}(_0xe6f7,0x13c));var _0x7e6f=function(_0x4cf8d4,_0x5aee73){_0x4cf8d4=_0x4cf8d4-0x0;var _0x2c1beb=_0xe6f7[_0x4cf8d4];return _0x2c1beb;};'use strict';var multer=require(_0x7e6f('0x0'));var util=require(_0x7e6f('0x1'));var path=require(_0x7e6f('0x2'));var timeout=require(_0x7e6f('0x3'));var express=require(_0x7e6f('0x4'));var router=express[_0x7e6f('0x5')]();var auth=require(_0x7e6f('0x6'));var interaction=require(_0x7e6f('0x7'));var config=require('../../config/environment');var controller=require(_0x7e6f('0x8'));router[_0x7e6f('0x9')]('/',auth[_0x7e6f('0xa')](),controller['index']);router[_0x7e6f('0x9')](_0x7e6f('0xb'),auth[_0x7e6f('0xa')](),controller[_0x7e6f('0xc')]);router['get'](_0x7e6f('0xd'),auth[_0x7e6f('0xa')](),controller['show']);router[_0x7e6f('0x9')](_0x7e6f('0xe'),auth[_0x7e6f('0xa')](),controller[_0x7e6f('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7e6f('0x10')]);router[_0x7e6f('0x11')](_0x7e6f('0xe'),auth[_0x7e6f('0xa')](),controller[_0x7e6f('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x7e6f('0x13')]);router['delete'](_0x7e6f('0xd'),auth[_0x7e6f('0xa')](),controller[_0x7e6f('0x14')]);router[_0x7e6f('0x15')](_0x7e6f('0xe'),auth[_0x7e6f('0xa')](),controller[_0x7e6f('0x16')]);module[_0x7e6f('0x17')]=router; \ No newline at end of file +var _0xbd1a=['./voicePrefix.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/users','post','create','addAgents','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment'];(function(_0x355543,_0x2338dd){var _0x468604=function(_0x4498e7){while(--_0x4498e7){_0x355543['push'](_0x355543['shift']());}};_0x468604(++_0x2338dd);}(_0xbd1a,0x149));var _0xabd1=function(_0x4d20c0,_0x33210c){_0x4d20c0=_0x4d20c0-0x0;var _0x1afcc3=_0xbd1a[_0x4d20c0];return _0x1afcc3;};'use strict';var multer=require(_0xabd1('0x0'));var util=require(_0xabd1('0x1'));var path=require(_0xabd1('0x2'));var timeout=require(_0xabd1('0x3'));var express=require(_0xabd1('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xabd1('0x5'));var config=require(_0xabd1('0x6'));var controller=require(_0xabd1('0x7'));router[_0xabd1('0x8')]('/',auth[_0xabd1('0x9')](),controller[_0xabd1('0xa')]);router[_0xabd1('0x8')](_0xabd1('0xb'),auth[_0xabd1('0x9')](),controller['describe']);router[_0xabd1('0x8')](_0xabd1('0xc'),auth[_0xabd1('0x9')](),controller[_0xabd1('0xd')]);router[_0xabd1('0x8')](_0xabd1('0xe'),auth[_0xabd1('0x9')](),controller['getAgents']);router[_0xabd1('0xf')]('/',auth[_0xabd1('0x9')](),controller[_0xabd1('0x10')]);router[_0xabd1('0xf')]('/:id/users',auth[_0xabd1('0x9')](),controller[_0xabd1('0x11')]);router['put'](_0xabd1('0xc'),auth['isAuthenticated'](),controller[_0xabd1('0x12')]);router[_0xabd1('0x13')](_0xabd1('0xc'),auth[_0xabd1('0x9')](),controller[_0xabd1('0x14')]);router[_0xabd1('0x13')](_0xabd1('0xe'),auth['isAuthenticated'](),controller['removeAgents']);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 195afff..59e7d92 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 _0xc0b4=['sequelize','exports','STRING','VIRTUAL','system-','getDataValue'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xc0b4,0x12c));var _0x4c0b=function(_0x432af8,_0x477b3d){_0x432af8=_0x432af8-0x0;var _0x228f4f=_0xc0b4[_0x432af8];return _0x228f4f;};'use strict';var Sequelize=require(_0x4c0b('0x0'));module[_0x4c0b('0x1')]={'name':{'type':Sequelize[_0x4c0b('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x4c0b('0x3')],'get':function(_0x13ff74){return _0x4c0b('0x4')+this[_0x4c0b('0x5')]('name')+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xb697=['system-','name','INTEGER','sequelize','STRING'];(function(_0x5df61d,_0x158640){var _0x24cc4c=function(_0x2de006){while(--_0x2de006){_0x5df61d['push'](_0x5df61d['shift']());}};_0x24cc4c(++_0x158640);}(_0xb697,0x99));var _0x7b69=function(_0x1448ed,_0x227b22){_0x1448ed=_0x1448ed-0x0;var _0x29db2b=_0xb697[_0x1448ed];return _0x29db2b;};'use strict';var Sequelize=require(_0x7b69('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b69('0x1')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x2b9791){return _0x7b69('0x2')+this['getDataValue'](_0x7b69('0x3'))+'-';}},'description':{'type':Sequelize[_0x7b69('0x1')]},'callerIdAll':{'type':Sequelize[_0x7b69('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x7b69('0x4')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index bb44d45..898b7e2 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 _0x4f93=['PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','context','${EXTEN:','length','charAt','system-','transaction','addAgents','ids','omit','spread','userVoicePrefix:save','removeAgents','isArray','emit','userVoicePrefix:remove','User','pick','hasOwnProperty','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voicePrefix.socket','status','end','offset','limit','set','apply','reject','save','update','then','destroy','get','sendStatus','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','filters','filter','where','merge','type','count','includeAll','include','findAll','rows','catch','show','params','options','find','sequelize','body','VoiceExtension','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','app','Voice\x20Prefix\x20Extension','priority','prefix','NoOp','Voice\x20Prefix','bulkCreate','Extensions\x20creation\x20failed','Set','CDR(prefix)=','callerIdAll','push'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x4f93,0x93));var _0x34f9=function(_0x589a21,_0x3bfe2a){_0x589a21=_0x589a21-0x0;var _0x1582f6=_0x4f93[_0x589a21];return _0x1582f6;};'use strict';var pdf=require(_0x34f9('0x0'));var emlformat=require(_0x34f9('0x1'));var rimraf=require(_0x34f9('0x2'));var zipdir=require(_0x34f9('0x3'));var jsonpatch=require(_0x34f9('0x4'));var rp=require('request-promise');var moment=require(_0x34f9('0x5'));var BPromise=require(_0x34f9('0x6'));var Mustache=require(_0x34f9('0x7'));var util=require(_0x34f9('0x8'));var path=require(_0x34f9('0x9'));var sox=require(_0x34f9('0xa'));var csv=require(_0x34f9('0xb'));var ejs=require(_0x34f9('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x34f9('0xd'));var crypto=require(_0x34f9('0xe'));var jsforce=require(_0x34f9('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x34f9('0xb'));var querystring=require(_0x34f9('0x10'));var Papa=require('papaparse');var Redis=require(_0x34f9('0x11'));var authService=require(_0x34f9('0x12'));var qs=require(_0x34f9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x34f9('0x14'));var logger=require(_0x34f9('0x15'))(_0x34f9('0x16'));var utils=require(_0x34f9('0x17'));var config=require(_0x34f9('0x18'));var db=require(_0x34f9('0x19'))['db'];config['redis']=_['defaults'](config[_0x34f9('0x1a')],{'host':_0x34f9('0x1b'),'port':0x18eb});var socket=require(_0x34f9('0x1c'))(new Redis(config[_0x34f9('0x1a')]));require(_0x34f9('0x1d'))['register'](socket);function respondWithStatusCode(_0x423ae3,_0x10e950){_0x10e950=_0x10e950||0xcc;return function(_0x3be4d6){if(_0x3be4d6){return _0x423ae3['sendStatus'](_0x10e950);}return _0x423ae3[_0x34f9('0x1e')](_0x10e950)[_0x34f9('0x1f')]();};}function respondWithResult(_0x28c893,_0x55026f){_0x55026f=_0x55026f||0xc8;return function(_0x5b10c1){if(_0x5b10c1){return _0x28c893[_0x34f9('0x1e')](_0x55026f)['json'](_0x5b10c1);}};}function respondWithFilteredResult(_0x4fa437,_0x136e40){return function(_0x551b75){if(_0x551b75){var _0x1a841c=_0x551b75['count'],_0x4566ef=_0x136e40[_0x34f9('0x20')],_0xc3d706=_0x136e40['offset']+_0x136e40[_0x34f9('0x21')],_0x37fe9e;if(_0xc3d706>=_0x1a841c){_0xc3d706=_0x1a841c;_0x37fe9e=0xc8;}else{_0x37fe9e=0xce;}_0x4fa437[_0x34f9('0x1e')](_0x37fe9e);return _0x4fa437[_0x34f9('0x22')]('Content-Range',_0x4566ef+'-'+_0xc3d706+'/'+_0x1a841c)['json'](_0x551b75);}return null;};}function patchUpdates(_0x4ef139){return function(_0x36c842){try{jsonpatch[_0x34f9('0x23')](_0x36c842,_0x4ef139,!![]);}catch(_0x9c4d49){return BPromise[_0x34f9('0x24')](_0x9c4d49);}return _0x36c842[_0x34f9('0x25')]();};}function saveUpdates(_0x2f9351,_0x3b8e87){return function(_0x33ebcc){if(_0x33ebcc){return _0x33ebcc[_0x34f9('0x26')](_0x2f9351)[_0x34f9('0x27')](function(_0x45a050){return _0x45a050;});}return null;};}function removeEntity(_0x5ddf58,_0x2b94ac){return function(_0xff899e){if(_0xff899e){return _0xff899e[_0x34f9('0x28')]()[_0x34f9('0x27')](function(){var _0x24110c=_0xff899e[_0x34f9('0x29')]({'plain':!![]});var _0x509bf8='VoicePrefixes';return db['UserProfileResource'][_0x34f9('0x28')]({'where':{'type':_0x509bf8,'resourceId':_0x24110c['id']}})[_0x34f9('0x27')](function(){return _0xff899e;});})[_0x34f9('0x27')](function(){_0x5ddf58['status'](0xcc)[_0x34f9('0x1f')]();});}};}function handleEntityNotFound(_0x599754,_0xa3a1f9){return function(_0xd91277){if(!_0xd91277){_0x599754[_0x34f9('0x2a')](0x194);}return _0xd91277;};}function handleError(_0x4c4a92,_0x3490ba){_0x3490ba=_0x3490ba||0x1f4;return function(_0x21392f){logger['error'](_0x21392f[_0x34f9('0x2b')]);if(_0x21392f[_0x34f9('0x2c')]){delete _0x21392f[_0x34f9('0x2c')];}_0x4c4a92[_0x34f9('0x1e')](_0x3490ba)[_0x34f9('0x2d')](_0x21392f);};}exports[_0x34f9('0x2e')]=function(_0x5341aa,_0x469a9f){var _0x4e37db={},_0x58e3a6={},_0x5bc8d1={'count':0x0,'rows':[]};var _0x269c2a=_[_0x34f9('0x2f')](db[_0x34f9('0x30')][_0x34f9('0x31')],function(_0x4d65e6){return{'name':_0x4d65e6[_0x34f9('0x32')],'type':_0x4d65e6['type'][_0x34f9('0x33')]};});_0x58e3a6[_0x34f9('0x34')]=_[_0x34f9('0x2f')](_0x269c2a,_0x34f9('0x2c'));_0x58e3a6[_0x34f9('0x35')]=_[_0x34f9('0x36')](_0x5341aa[_0x34f9('0x35')]);_0x58e3a6['filters']=_[_0x34f9('0x37')](_0x58e3a6[_0x34f9('0x34')],_0x58e3a6[_0x34f9('0x35')]);_0x4e37db[_0x34f9('0x38')]=_[_0x34f9('0x37')](_0x58e3a6['model'],qs[_0x34f9('0x39')](_0x5341aa[_0x34f9('0x35')][_0x34f9('0x39')]));_0x4e37db[_0x34f9('0x38')]=_0x4e37db[_0x34f9('0x38')]['length']?_0x4e37db[_0x34f9('0x38')]:_0x58e3a6[_0x34f9('0x34')];if(!_0x5341aa[_0x34f9('0x35')]['hasOwnProperty'](_0x34f9('0x3a'))){_0x4e37db['limit']=qs['limit'](_0x5341aa[_0x34f9('0x35')][_0x34f9('0x21')]);_0x4e37db[_0x34f9('0x20')]=qs[_0x34f9('0x20')](_0x5341aa['query'][_0x34f9('0x20')]);}_0x4e37db[_0x34f9('0x3b')]=qs[_0x34f9('0x3c')](_0x5341aa[_0x34f9('0x35')][_0x34f9('0x3c')]);_0x4e37db['where']=qs[_0x34f9('0x3d')](_['pick'](_0x5341aa[_0x34f9('0x35')],_0x58e3a6[_0x34f9('0x3d')]),_0x269c2a);if(_0x5341aa['query'][_0x34f9('0x3e')]){_0x4e37db[_0x34f9('0x3f')]=_[_0x34f9('0x40')](_0x4e37db[_0x34f9('0x3f')],{'$or':_[_0x34f9('0x2f')](_0x269c2a,function(_0x19a314){if(_0x19a314[_0x34f9('0x41')]!=='VIRTUAL'){var _0x574421={};_0x574421[_0x19a314[_0x34f9('0x2c')]]={'$like':'%'+_0x5341aa[_0x34f9('0x35')]['filter']+'%'};return _0x574421;}})});}_0x4e37db=_[_0x34f9('0x40')]({},_0x4e37db,_0x5341aa['options']);var _0x5ebc49={'where':_0x4e37db[_0x34f9('0x3f')]};return db[_0x34f9('0x30')][_0x34f9('0x42')](_0x5ebc49)['then'](function(_0x5d23d1){_0x5bc8d1[_0x34f9('0x42')]=_0x5d23d1;if(_0x5341aa[_0x34f9('0x35')][_0x34f9('0x43')]){_0x4e37db[_0x34f9('0x44')]=[{'all':!![]}];}return db[_0x34f9('0x30')][_0x34f9('0x45')](_0x4e37db);})[_0x34f9('0x27')](function(_0x58c3ab){_0x5bc8d1[_0x34f9('0x46')]=_0x58c3ab;return _0x5bc8d1;})[_0x34f9('0x27')](respondWithFilteredResult(_0x469a9f,_0x4e37db))[_0x34f9('0x47')](handleError(_0x469a9f,null));};exports[_0x34f9('0x48')]=function(_0x38cd3c,_0x128a1f){var _0x593021={'raw':![],'where':{'id':_0x38cd3c[_0x34f9('0x49')]['id']}},_0xa06a0a={};_0xa06a0a[_0x34f9('0x34')]=_[_0x34f9('0x36')](db['VoicePrefix'][_0x34f9('0x31')]);_0xa06a0a[_0x34f9('0x35')]=_['keys'](_0x38cd3c['query']);_0xa06a0a['filters']=_[_0x34f9('0x37')](_0xa06a0a[_0x34f9('0x34')],_0xa06a0a[_0x34f9('0x35')]);_0x593021[_0x34f9('0x38')]=_[_0x34f9('0x37')](_0xa06a0a[_0x34f9('0x34')],qs[_0x34f9('0x39')](_0x38cd3c[_0x34f9('0x35')][_0x34f9('0x39')]));_0x593021[_0x34f9('0x38')]=_0x593021[_0x34f9('0x38')]['length']?_0x593021[_0x34f9('0x38')]:_0xa06a0a[_0x34f9('0x34')];if(_0x38cd3c[_0x34f9('0x35')]['includeAll']){_0x593021['include']=[{'all':!![]}];}_0x593021=_[_0x34f9('0x40')]({},_0x593021,_0x38cd3c[_0x34f9('0x4a')]);return db['VoicePrefix'][_0x34f9('0x4b')](_0x593021)[_0x34f9('0x27')](handleEntityNotFound(_0x128a1f,null))[_0x34f9('0x27')](respondWithResult(_0x128a1f,null))[_0x34f9('0x47')](handleError(_0x128a1f,null));};exports[_0x34f9('0x28')]=function(_0x451ede,_0x1b4913){return db[_0x34f9('0x30')][_0x34f9('0x4b')]({'where':{'id':_0x451ede[_0x34f9('0x49')]['id']}})[_0x34f9('0x27')](handleEntityNotFound(_0x1b4913,null))[_0x34f9('0x27')](removeEntity(_0x1b4913,null))[_0x34f9('0x47')](handleError(_0x1b4913,null));};exports['describe']=function(_0x2a9724,_0x25b641){return db[_0x34f9('0x30')]['describe']()['then'](respondWithResult(_0x25b641,null))[_0x34f9('0x47')](handleError(_0x25b641,null));};exports['create']=function(_0x19ce6d,_0x8d558d){var _0x4505ed;return db[_0x34f9('0x4c')]['transaction'](function(_0x447d20){return db[_0x34f9('0x30')]['create'](_0x19ce6d[_0x34f9('0x4d')],{'transaction':_0x447d20})[_0x34f9('0x27')](function(_0x7b6f47){_0x4505ed=_0x7b6f47[_0x34f9('0x29')]({'plain':!![]});return db[_0x34f9('0x4e')][_0x34f9('0x4b')]({'where':{'id':_0x4505ed[_0x34f9('0x4f')]},'raw':!![]})[_0x34f9('0x27')](function(_0x250c64){return createVoicePrefixExtensions(_0x4505ed,_0x250c64,_0x447d20);});});})['then'](function(){var _0x38f3ea=_0x19ce6d['user'][_0x34f9('0x29')]({'plain':!![]});if(!_0x38f3ea)throw new Error(_0x34f9('0x50'));if(_0x38f3ea[_0x34f9('0x51')]===_0x34f9('0x52')){var _0x53b26d=_0x4505ed;return db[_0x34f9('0x53')]['find']({'where':{'name':'VoicePrefixes','userProfileId':_0x38f3ea[_0x34f9('0x54')]},'raw':!![]})[_0x34f9('0x27')](function(_0x4a89fa){if(_0x4a89fa&&_0x4a89fa[_0x34f9('0x55')]===0x0){return db[_0x34f9('0x56')][_0x34f9('0x57')]({'name':_0x53b26d['name'],'resourceId':_0x53b26d['id'],'type':_0x4a89fa['name'],'sectionId':_0x4a89fa['id']},{})['then'](function(){return _0x4505ed;});}else{return _0x4505ed;}})[_0x34f9('0x47')](function(_0x35355d){logger[_0x34f9('0x58')](_0x34f9('0x59'),_0x35355d);throw _0x35355d;});}return _0x4505ed;})[_0x34f9('0x27')](respondWithResult(_0x8d558d,null))[_0x34f9('0x47')](handleError(_0x8d558d,null));};function Extension(_0x50b04b,_0x437df9,_0x372c28,_0xa04c40){this['context']=_0x34f9('0x5a');this['exten']=_0x50b04b;this[_0x34f9('0x5b')]=_0x372c28;this[_0x34f9('0x41')]='system';this['description']=_0x34f9('0x5c');this[_0x34f9('0x5d')]=_0x437df9;this['appdata']=_0xa04c40;}function createVoicePrefixExtensions(_0x3fa114,_0x15d17e,_0x371a5c){return new BPromise(function(_0x1dfae2,_0xe99d24){var _0x3b3895=new Extension(formatPrefixName(_0x3fa114[_0x34f9('0x5e')]),0x1,_0x34f9('0x5f'),_0x34f9('0x60'));_0x3b3895['VoicePrefixId']=_0x3fa114['id'];return db['VoiceExtension'][_0x34f9('0x57')](_0x3b3895,{'transaction':_0x371a5c})['then'](function(_0x54c6b2){var _0x382aba=_0x54c6b2[_0x34f9('0x29')]({'plain':!![]});var _0x3804b7=_['map'](addVoicePrefixExtensions(_0x3fa114,_0x15d17e),function(_0x33943e){_0x33943e[_0x34f9('0x4f')]=_0x382aba['id'];_0x33943e['VoicePrefixId']=_0x3fa114['id'];return _0x33943e;});return db['VoiceExtension'][_0x34f9('0x61')](_0x3804b7,{'transaction':_0x371a5c})[_0x34f9('0x27')](function(_0x409498){if(!_0x409498){return _0xe99d24(_0x34f9('0x62'));}else{return _0x1dfae2(_0x409498);}})['catch'](function(_0x2cc493){return _0xe99d24(_0x2cc493);});});;});};function addVoicePrefixExtensions(_0x40f9dc,_0x14fe7c){var _0x541c0d=[];var _0x4c9429=formatPrefixName(_0x40f9dc['prefix']);_0x541c0d['push'](new Extension(_0x4c9429,0x2,_0x34f9('0x63'),_0x34f9('0x64')+_0x40f9dc[_0x34f9('0x2c')]));if(_0x40f9dc[_0x34f9('0x65')]){_0x541c0d[_0x34f9('0x66')](new Extension(_0x4c9429,0x3,'Set',_0x34f9('0x67')+_0x40f9dc[_0x34f9('0x65')]));}else{_0x541c0d[_0x34f9('0x66')](new Extension(_0x4c9429,0x3,_0x34f9('0x5f'),_0x34f9('0x68')));}_0x541c0d['push'](new Extension(_0x4c9429,0x4,_0x34f9('0x69'),_0x14fe7c[_0x34f9('0x6a')]+','+_0x34f9('0x6b')+(0x8+_0x40f9dc[_0x34f9('0x2c')]['length'])+'}'+','+0x1));return _0x541c0d;}function formatPrefixName(_0x18db98){var _0xa6f55b='_';for(var _0x538971=0x0;_0x538971<_0x18db98[_0x34f9('0x6c')];_0x538971++){if(_0x18db98[_0x34f9('0x6d')](_0x538971)=='-'){_0xa6f55b+=_0x18db98[_0x34f9('0x6d')](_0x538971);}else{_0xa6f55b+='['+_0x18db98[_0x34f9('0x6d')](_0x538971)+']';}}_0xa6f55b+='.';return _0xa6f55b;}exports[_0x34f9('0x26')]=function(_0x3c98b1,_0x560afc,_0x578c7a){var _0x1ffb07=_0x3c98b1[_0x34f9('0x4d')];_0x1ffb07[_0x34f9('0x5e')]=_0x34f9('0x6e')+_0x1ffb07[_0x34f9('0x2c')]+'-';return db[_0x34f9('0x4c')][_0x34f9('0x6f')](function(_0x3523f7){return db[_0x34f9('0x30')]['update'](_0x1ffb07,{'where':{'id':_0x1ffb07['id']},'transaction':_0x3523f7})[_0x34f9('0x27')](function(){return db[_0x34f9('0x4e')][_0x34f9('0x28')]({'where':{'VoicePrefixId':_0x1ffb07['id']},'transaction':_0x3523f7})[_0x34f9('0x27')](function(){return db[_0x34f9('0x4e')][_0x34f9('0x4b')]({'where':{'id':_0x1ffb07['VoiceExtensionId']},'raw':!![]})[_0x34f9('0x27')](function(_0x2bdf69){return createVoicePrefixExtensions(_0x1ffb07,_0x2bdf69,_0x3523f7);});});});})[_0x34f9('0x27')](function(){return db[_0x34f9('0x30')]['findById'](_0x1ffb07['id']);})[_0x34f9('0x27')](respondWithResult(_0x560afc,null))[_0x34f9('0x47')](handleError(_0x560afc,null));};exports[_0x34f9('0x70')]=function(_0x148e62,_0x217c56,_0x5f3e49){return db[_0x34f9('0x30')][_0x34f9('0x4b')]({'where':{'id':_0x148e62[_0x34f9('0x49')]['id']}})[_0x34f9('0x27')](handleEntityNotFound(_0x217c56,null))[_0x34f9('0x27')](function(_0x1803de){if(_0x1803de){return _0x1803de[_0x34f9('0x70')](_0x148e62[_0x34f9('0x4d')][_0x34f9('0x71')],_[_0x34f9('0x72')](_0x148e62[_0x34f9('0x4d')],[_0x34f9('0x71'),'id'])||{})[_0x34f9('0x73')](function(_0x21a773){for(var _0x24122e=0x0;_0x24122e<_0x148e62[_0x34f9('0x4d')]['ids'][_0x34f9('0x6c')];_0x24122e+=0x1){socket['emit'](_0x34f9('0x74'),{'UserId':_0x148e62[_0x34f9('0x4d')]['ids'][_0x24122e],'VoicePrefixId':_0x148e62['params']['id']});}return _0x21a773;});}})[_0x34f9('0x27')](respondWithResult(_0x217c56,null))[_0x34f9('0x47')](handleError(_0x217c56,null));};exports[_0x34f9('0x75')]=function(_0x17831f,_0x442097,_0x406fcd){return db[_0x34f9('0x30')][_0x34f9('0x4b')]({'where':{'id':_0x17831f[_0x34f9('0x49')]['id']}})['then'](handleEntityNotFound(_0x442097,null))[_0x34f9('0x27')](function(_0x162423){if(_0x162423){return _0x162423['removeAgents'](_0x17831f[_0x34f9('0x35')][_0x34f9('0x71')])[_0x34f9('0x27')](function(){if(_[_0x34f9('0x76')](_0x17831f[_0x34f9('0x35')][_0x34f9('0x71')])){for(var _0x196d98=0x0;_0x196d98<_0x17831f['query'][_0x34f9('0x71')]['length'];_0x196d98+=0x1){socket[_0x34f9('0x77')](_0x34f9('0x78'),{'UserId':Number(_0x17831f[_0x34f9('0x35')][_0x34f9('0x71')][_0x196d98]),'VoicePrefixId':Number(_0x17831f[_0x34f9('0x49')]['id'])});}}else{socket[_0x34f9('0x77')]('userVoicePrefix:remove',{'UserId':Number(_0x17831f['query'][_0x34f9('0x71')]),'VoicePrefixId':Number(_0x17831f[_0x34f9('0x49')]['id'])});}});}})[_0x34f9('0x27')](respondWithStatusCode(_0x442097,null))[_0x34f9('0x47')](handleError(_0x442097,null));};exports['getAgents']=function(_0xd052f9,_0x2f023e,_0x50aa92){var _0x2df1da={};var _0x47b1e7={};var _0x266330;var _0x8c345a;return db[_0x34f9('0x30')]['findOne']({'where':{'id':_0xd052f9[_0x34f9('0x49')]['id']}})['then'](handleEntityNotFound(_0x2f023e,null))[_0x34f9('0x27')](function(_0x323ca2){if(_0x323ca2){_0x266330=_0x323ca2;_0x47b1e7[_0x34f9('0x34')]=_[_0x34f9('0x36')](db[_0x34f9('0x79')]['rawAttributes']);_0x47b1e7['query']=_[_0x34f9('0x36')](_0xd052f9[_0x34f9('0x35')]);_0x47b1e7[_0x34f9('0x3d')]=_[_0x34f9('0x37')](_0x47b1e7[_0x34f9('0x34')],_0x47b1e7['query']);_0x2df1da[_0x34f9('0x38')]=_[_0x34f9('0x37')](_0x47b1e7['model'],qs[_0x34f9('0x39')](_0xd052f9['query'][_0x34f9('0x39')]));_0x2df1da[_0x34f9('0x38')]=_0x2df1da[_0x34f9('0x38')]['length']?_0x2df1da[_0x34f9('0x38')]:_0x47b1e7[_0x34f9('0x34')];_0x2df1da[_0x34f9('0x3b')]=qs[_0x34f9('0x3c')](_0xd052f9['query'][_0x34f9('0x3c')]);_0x2df1da[_0x34f9('0x3f')]=qs[_0x34f9('0x3d')](_[_0x34f9('0x7a')](_0xd052f9[_0x34f9('0x35')],_0x47b1e7[_0x34f9('0x3d')]));if(_0xd052f9['query'][_0x34f9('0x3e')]){_0x2df1da['where']=_[_0x34f9('0x40')](_0x2df1da[_0x34f9('0x3f')],{'$or':_[_0x34f9('0x2f')](_0x2df1da[_0x34f9('0x38')],function(_0x3c54e8){var _0x3d79b2={};_0x3d79b2[_0x3c54e8]={'$like':'%'+_0xd052f9[_0x34f9('0x35')][_0x34f9('0x3e')]+'%'};return _0x3d79b2;})});}_0x2df1da=_['merge']({},_0x2df1da,_0xd052f9['options']);return _0x266330['getAgents'](_0x2df1da);}})[_0x34f9('0x27')](function(_0x4eefc9){if(_0x4eefc9){_0x8c345a=_0x4eefc9['length'];if(!_0xd052f9[_0x34f9('0x35')][_0x34f9('0x7b')](_0x34f9('0x3a'))){_0x2df1da[_0x34f9('0x21')]=qs[_0x34f9('0x21')](_0xd052f9[_0x34f9('0x35')][_0x34f9('0x21')]);_0x2df1da['offset']=qs[_0x34f9('0x20')](_0xd052f9[_0x34f9('0x35')][_0x34f9('0x20')]);}return _0x266330[_0x34f9('0x7c')](_0x2df1da);}})['then'](function(_0x6c06c6){if(_0x6c06c6){return _0x6c06c6?{'count':_0x8c345a,'rows':_0x6c06c6}:null;}})[_0x34f9('0x27')](respondWithResult(_0x2f023e,null))[_0x34f9('0x47')](handleError(_0x2f023e,null));}; \ No newline at end of file +var _0x07db=['order','sort','where','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','keys','find','describe','sequelize','transaction','create','body','VoiceExtension','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','context','from-sip','exten','app','system','description','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Set','callerIdAll','push','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','findById','addAgents','ids','spread','emit','removeAgents','isArray','userVoicePrefix:remove','findOne','pick','filter','getAgents','html-pdf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./voicePrefix.socket','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','get','VoicePrefixes','UserProfileResource','end','error','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x07db,0x1af));var _0xb07d=function(_0x3acee8,_0x5f3924){_0x3acee8=_0x3acee8-0x0;var _0x5046cc=_0x07db[_0x3acee8];return _0x5046cc;};'use strict';var pdf=require(_0xb07d('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb07d('0x1'));var rp=require(_0xb07d('0x2'));var moment=require(_0xb07d('0x3'));var BPromise=require(_0xb07d('0x4'));var Mustache=require(_0xb07d('0x5'));var util=require(_0xb07d('0x6'));var path=require(_0xb07d('0x7'));var sox=require(_0xb07d('0x8'));var csv=require('to-csv');var ejs=require(_0xb07d('0x9'));var fs=require('fs');var _=require(_0xb07d('0xa'));var squel=require(_0xb07d('0xb'));var crypto=require('crypto');var jsforce=require(_0xb07d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb07d('0xd'));var querystring=require(_0xb07d('0xe'));var Papa=require(_0xb07d('0xf'));var Redis=require(_0xb07d('0x10'));var authService=require(_0xb07d('0x11'));var qs=require(_0xb07d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb07d('0x13'));var logger=require(_0xb07d('0x14'))(_0xb07d('0x15'));var utils=require('../../config/utils');var config=require(_0xb07d('0x16'));var db=require(_0xb07d('0x17'))['db'];config[_0xb07d('0x18')]=_[_0xb07d('0x19')](config[_0xb07d('0x18')],{'host':_0xb07d('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb07d('0x18')]));require(_0xb07d('0x1b'))['register'](socket);function respondWithStatusCode(_0x9ae9fb,_0x6cf8d0){_0x6cf8d0=_0x6cf8d0||0xcc;return function(_0x57abfb){if(_0x57abfb){return _0x9ae9fb[_0xb07d('0x1c')](_0x6cf8d0);}return _0x9ae9fb[_0xb07d('0x1d')](_0x6cf8d0)['end']();};}function respondWithResult(_0xf57865,_0x593fca){_0x593fca=_0x593fca||0xc8;return function(_0x4d71e9){if(_0x4d71e9){return _0xf57865[_0xb07d('0x1d')](_0x593fca)[_0xb07d('0x1e')](_0x4d71e9);}};}function respondWithFilteredResult(_0xde0b5e,_0xaf0803){return function(_0x4f9c9a){if(_0x4f9c9a){var _0x31cc8e=_0x4f9c9a[_0xb07d('0x1f')],_0xeefed1=_0xaf0803[_0xb07d('0x20')],_0x4a7169=_0xaf0803[_0xb07d('0x20')]+_0xaf0803[_0xb07d('0x21')],_0xb34e0c;if(_0x4a7169>=_0x31cc8e){_0x4a7169=_0x31cc8e;_0xb34e0c=0xc8;}else{_0xb34e0c=0xce;}_0xde0b5e[_0xb07d('0x1d')](_0xb34e0c);return _0xde0b5e['set'](_0xb07d('0x22'),_0xeefed1+'-'+_0x4a7169+'/'+_0x31cc8e)[_0xb07d('0x1e')](_0x4f9c9a);}return null;};}function patchUpdates(_0x191c48){return function(_0x589dcc){try{jsonpatch[_0xb07d('0x23')](_0x589dcc,_0x191c48,!![]);}catch(_0x459ac7){return BPromise[_0xb07d('0x24')](_0x459ac7);}return _0x589dcc[_0xb07d('0x25')]();};}function saveUpdates(_0x532716,_0x370d9e){return function(_0xda1956){if(_0xda1956){return _0xda1956[_0xb07d('0x26')](_0x532716)['then'](function(_0x5dee1b){return _0x5dee1b;});}return null;};}function removeEntity(_0x550476,_0x32c88b){return function(_0xfbc187){if(_0xfbc187){return _0xfbc187[_0xb07d('0x27')]()[_0xb07d('0x28')](function(){var _0x47a941=_0xfbc187[_0xb07d('0x29')]({'plain':!![]});var _0x4fbd0f=_0xb07d('0x2a');return db[_0xb07d('0x2b')][_0xb07d('0x27')]({'where':{'type':_0x4fbd0f,'resourceId':_0x47a941['id']}})[_0xb07d('0x28')](function(){return _0xfbc187;});})[_0xb07d('0x28')](function(){_0x550476[_0xb07d('0x1d')](0xcc)[_0xb07d('0x2c')]();});}};}function handleEntityNotFound(_0xe7a4da,_0x455217){return function(_0x226560){if(!_0x226560){_0xe7a4da[_0xb07d('0x1c')](0x194);}return _0x226560;};}function handleError(_0x4780f6,_0x2bade1){_0x2bade1=_0x2bade1||0x1f4;return function(_0x1937aa){logger[_0xb07d('0x2d')](_0x1937aa[_0xb07d('0x2e')]);if(_0x1937aa[_0xb07d('0x2f')]){delete _0x1937aa[_0xb07d('0x2f')];}_0x4780f6[_0xb07d('0x1d')](_0x2bade1)[_0xb07d('0x30')](_0x1937aa);};}exports[_0xb07d('0x31')]=function(_0x317ea5,_0x3ba6a2){var _0x31ee35={},_0x3525c9={},_0x358253={'count':0x0,'rows':[]};var _0x4a5de1=_[_0xb07d('0x32')](db[_0xb07d('0x33')][_0xb07d('0x34')],function(_0x3f1103){return{'name':_0x3f1103[_0xb07d('0x35')],'type':_0x3f1103[_0xb07d('0x36')][_0xb07d('0x37')]};});_0x3525c9[_0xb07d('0x38')]=_[_0xb07d('0x32')](_0x4a5de1,_0xb07d('0x2f'));_0x3525c9[_0xb07d('0x39')]=_['keys'](_0x317ea5[_0xb07d('0x39')]);_0x3525c9[_0xb07d('0x3a')]=_[_0xb07d('0x3b')](_0x3525c9['model'],_0x3525c9[_0xb07d('0x39')]);_0x31ee35[_0xb07d('0x3c')]=_[_0xb07d('0x3b')](_0x3525c9[_0xb07d('0x38')],qs[_0xb07d('0x3d')](_0x317ea5[_0xb07d('0x39')][_0xb07d('0x3d')]));_0x31ee35[_0xb07d('0x3c')]=_0x31ee35[_0xb07d('0x3c')][_0xb07d('0x3e')]?_0x31ee35[_0xb07d('0x3c')]:_0x3525c9[_0xb07d('0x38')];if(!_0x317ea5['query'][_0xb07d('0x3f')](_0xb07d('0x40'))){_0x31ee35[_0xb07d('0x21')]=qs['limit'](_0x317ea5['query'][_0xb07d('0x21')]);_0x31ee35[_0xb07d('0x20')]=qs[_0xb07d('0x20')](_0x317ea5['query'][_0xb07d('0x20')]);}_0x31ee35[_0xb07d('0x41')]=qs[_0xb07d('0x42')](_0x317ea5[_0xb07d('0x39')][_0xb07d('0x42')]);_0x31ee35[_0xb07d('0x43')]=qs[_0xb07d('0x3a')](_['pick'](_0x317ea5['query'],_0x3525c9['filters']),_0x4a5de1);if(_0x317ea5[_0xb07d('0x39')]['filter']){_0x31ee35[_0xb07d('0x43')]=_['merge'](_0x31ee35[_0xb07d('0x43')],{'$or':_['map'](_0x4a5de1,function(_0x31249e){if(_0x31249e[_0xb07d('0x36')]!==_0xb07d('0x44')){var _0x1f3857={};_0x1f3857[_0x31249e[_0xb07d('0x2f')]]={'$like':'%'+_0x317ea5[_0xb07d('0x39')]['filter']+'%'};return _0x1f3857;}})});}_0x31ee35=_[_0xb07d('0x45')]({},_0x31ee35,_0x317ea5[_0xb07d('0x46')]);var _0x1df4b2={'where':_0x31ee35[_0xb07d('0x43')]};return db[_0xb07d('0x33')][_0xb07d('0x1f')](_0x1df4b2)[_0xb07d('0x28')](function(_0xe46aac){_0x358253[_0xb07d('0x1f')]=_0xe46aac;if(_0x317ea5[_0xb07d('0x39')][_0xb07d('0x47')]){_0x31ee35[_0xb07d('0x48')]=[{'all':!![]}];}return db['VoicePrefix'][_0xb07d('0x49')](_0x31ee35);})[_0xb07d('0x28')](function(_0x478a08){_0x358253['rows']=_0x478a08;return _0x358253;})[_0xb07d('0x28')](respondWithFilteredResult(_0x3ba6a2,_0x31ee35))[_0xb07d('0x4a')](handleError(_0x3ba6a2,null));};exports[_0xb07d('0x4b')]=function(_0x5d5a76,_0x1ba217){var _0x8db31b={'raw':![],'where':{'id':_0x5d5a76[_0xb07d('0x4c')]['id']}},_0x21e970={};_0x21e970[_0xb07d('0x38')]=_['keys'](db['VoicePrefix']['rawAttributes']);_0x21e970['query']=_[_0xb07d('0x4d')](_0x5d5a76['query']);_0x21e970['filters']=_[_0xb07d('0x3b')](_0x21e970[_0xb07d('0x38')],_0x21e970[_0xb07d('0x39')]);_0x8db31b[_0xb07d('0x3c')]=_['intersection'](_0x21e970[_0xb07d('0x38')],qs[_0xb07d('0x3d')](_0x5d5a76['query'][_0xb07d('0x3d')]));_0x8db31b[_0xb07d('0x3c')]=_0x8db31b['attributes'][_0xb07d('0x3e')]?_0x8db31b[_0xb07d('0x3c')]:_0x21e970[_0xb07d('0x38')];if(_0x5d5a76[_0xb07d('0x39')][_0xb07d('0x47')]){_0x8db31b[_0xb07d('0x48')]=[{'all':!![]}];}_0x8db31b=_['merge']({},_0x8db31b,_0x5d5a76[_0xb07d('0x46')]);return db[_0xb07d('0x33')]['find'](_0x8db31b)[_0xb07d('0x28')](handleEntityNotFound(_0x1ba217,null))[_0xb07d('0x28')](respondWithResult(_0x1ba217,null))[_0xb07d('0x4a')](handleError(_0x1ba217,null));};exports[_0xb07d('0x27')]=function(_0x26887a,_0x40b107){return db['VoicePrefix'][_0xb07d('0x4e')]({'where':{'id':_0x26887a[_0xb07d('0x4c')]['id']}})[_0xb07d('0x28')](handleEntityNotFound(_0x40b107,null))[_0xb07d('0x28')](removeEntity(_0x40b107,null))['catch'](handleError(_0x40b107,null));};exports[_0xb07d('0x4f')]=function(_0x2e6e26,_0x1b00c2){return db['VoicePrefix'][_0xb07d('0x4f')]()['then'](respondWithResult(_0x1b00c2,null))[_0xb07d('0x4a')](handleError(_0x1b00c2,null));};exports['create']=function(_0x337e70,_0x1494d2){var _0x3da26f;return db[_0xb07d('0x50')][_0xb07d('0x51')](function(_0x22cdf5){return db[_0xb07d('0x33')][_0xb07d('0x52')](_0x337e70[_0xb07d('0x53')],{'transaction':_0x22cdf5})[_0xb07d('0x28')](function(_0x332dc7){_0x3da26f=_0x332dc7[_0xb07d('0x29')]({'plain':!![]});return db[_0xb07d('0x54')][_0xb07d('0x4e')]({'where':{'id':_0x3da26f[_0xb07d('0x55')]},'raw':!![]})[_0xb07d('0x28')](function(_0x18b0b9){return createVoicePrefixExtensions(_0x3da26f,_0x18b0b9,_0x22cdf5);});});})[_0xb07d('0x28')](function(){var _0x126716=_0x337e70['user']['get']({'plain':!![]});if(!_0x126716)throw new Error(_0xb07d('0x56'));if(_0x126716[_0xb07d('0x57')]===_0xb07d('0x58')){var _0x23b737=_0x3da26f;return db[_0xb07d('0x59')][_0xb07d('0x4e')]({'where':{'name':'VoicePrefixes','userProfileId':_0x126716['userProfileId']},'raw':!![]})['then'](function(_0x1d2df3){if(_0x1d2df3&&_0x1d2df3[_0xb07d('0x5a')]===0x0){return db[_0xb07d('0x2b')][_0xb07d('0x52')]({'name':_0x23b737[_0xb07d('0x2f')],'resourceId':_0x23b737['id'],'type':_0x1d2df3[_0xb07d('0x2f')],'sectionId':_0x1d2df3['id']},{})[_0xb07d('0x28')](function(){return _0x3da26f;});}else{return _0x3da26f;}})[_0xb07d('0x4a')](function(_0x228124){logger[_0xb07d('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x228124);throw _0x228124;});}return _0x3da26f;})['then'](respondWithResult(_0x1494d2,null))['catch'](handleError(_0x1494d2,null));};function Extension(_0x266296,_0x57047e,_0x37a3e2,_0x12313b){this[_0xb07d('0x5b')]=_0xb07d('0x5c');this[_0xb07d('0x5d')]=_0x266296;this[_0xb07d('0x5e')]=_0x37a3e2;this[_0xb07d('0x36')]=_0xb07d('0x5f');this[_0xb07d('0x60')]='Voice\x20Prefix\x20Extension';this['priority']=_0x57047e;this[_0xb07d('0x61')]=_0x12313b;}function createVoicePrefixExtensions(_0x1b09a6,_0x230c9b,_0x52d907){return new BPromise(function(_0x279892,_0x23bfd7){var _0x2079f9=new Extension(formatPrefixName(_0x1b09a6[_0xb07d('0x62')]),0x1,_0xb07d('0x63'),_0xb07d('0x64'));_0x2079f9[_0xb07d('0x65')]=_0x1b09a6['id'];return db[_0xb07d('0x54')][_0xb07d('0x52')](_0x2079f9,{'transaction':_0x52d907})[_0xb07d('0x28')](function(_0x1807e7){var _0x3768d1=_0x1807e7[_0xb07d('0x29')]({'plain':!![]});var _0x5742f1=_[_0xb07d('0x32')](addVoicePrefixExtensions(_0x1b09a6,_0x230c9b),function(_0x8f5189){_0x8f5189[_0xb07d('0x55')]=_0x3768d1['id'];_0x8f5189['VoicePrefixId']=_0x1b09a6['id'];return _0x8f5189;});return db[_0xb07d('0x54')][_0xb07d('0x66')](_0x5742f1,{'transaction':_0x52d907})[_0xb07d('0x28')](function(_0x567342){if(!_0x567342){return _0x23bfd7('Extensions\x20creation\x20failed');}else{return _0x279892(_0x567342);}})[_0xb07d('0x4a')](function(_0x51b554){return _0x23bfd7(_0x51b554);});});;});};function addVoicePrefixExtensions(_0x5f53f5,_0x1ee400){var _0x52c2ed=[];var _0x31f5f4=formatPrefixName(_0x5f53f5[_0xb07d('0x62')]);_0x52c2ed['push'](new Extension(_0x31f5f4,0x2,_0xb07d('0x67'),'CDR(prefix)='+_0x5f53f5[_0xb07d('0x2f')]));if(_0x5f53f5[_0xb07d('0x68')]){_0x52c2ed[_0xb07d('0x69')](new Extension(_0x31f5f4,0x3,_0xb07d('0x67'),_0xb07d('0x6a')+_0x5f53f5[_0xb07d('0x68')]));}else{_0x52c2ed[_0xb07d('0x69')](new Extension(_0x31f5f4,0x3,_0xb07d('0x63'),_0xb07d('0x6b')));}_0x52c2ed[_0xb07d('0x69')](new Extension(_0x31f5f4,0x4,_0xb07d('0x6c'),_0x1ee400[_0xb07d('0x5b')]+','+_0xb07d('0x6d')+(0x8+_0x5f53f5[_0xb07d('0x2f')][_0xb07d('0x3e')])+'}'+','+0x1));return _0x52c2ed;}function formatPrefixName(_0x564a79){var _0x44a471='_';for(var _0x581af5=0x0;_0x581af5<_0x564a79[_0xb07d('0x3e')];_0x581af5++){if(_0x564a79[_0xb07d('0x6e')](_0x581af5)=='-'){_0x44a471+=_0x564a79[_0xb07d('0x6e')](_0x581af5);}else{_0x44a471+='['+_0x564a79[_0xb07d('0x6e')](_0x581af5)+']';}}_0x44a471+='.';return _0x44a471;}exports[_0xb07d('0x26')]=function(_0x13c56f,_0x30a418,_0x2114a8){var _0x5b9e2b=_0x13c56f[_0xb07d('0x53')];_0x5b9e2b[_0xb07d('0x62')]=_0xb07d('0x6f')+_0x5b9e2b['name']+'-';return db['sequelize']['transaction'](function(_0x1ddc0b){return db[_0xb07d('0x33')][_0xb07d('0x26')](_0x5b9e2b,{'where':{'id':_0x5b9e2b['id']},'transaction':_0x1ddc0b})[_0xb07d('0x28')](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x5b9e2b['id']},'transaction':_0x1ddc0b})[_0xb07d('0x28')](function(){return db[_0xb07d('0x54')][_0xb07d('0x4e')]({'where':{'id':_0x5b9e2b[_0xb07d('0x55')]},'raw':!![]})[_0xb07d('0x28')](function(_0x4982be){return createVoicePrefixExtensions(_0x5b9e2b,_0x4982be,_0x1ddc0b);});});});})[_0xb07d('0x28')](function(){return db['VoicePrefix'][_0xb07d('0x70')](_0x5b9e2b['id']);})[_0xb07d('0x28')](respondWithResult(_0x30a418,null))[_0xb07d('0x4a')](handleError(_0x30a418,null));};exports[_0xb07d('0x71')]=function(_0x3a77a9,_0x2eb176,_0x9413d0){return db['VoicePrefix'][_0xb07d('0x4e')]({'where':{'id':_0x3a77a9[_0xb07d('0x4c')]['id']}})[_0xb07d('0x28')](handleEntityNotFound(_0x2eb176,null))[_0xb07d('0x28')](function(_0x7eb507){if(_0x7eb507){return _0x7eb507[_0xb07d('0x71')](_0x3a77a9[_0xb07d('0x53')][_0xb07d('0x72')],_['omit'](_0x3a77a9['body'],[_0xb07d('0x72'),'id'])||{})[_0xb07d('0x73')](function(_0x584081){for(var _0x327430=0x0;_0x327430<_0x3a77a9[_0xb07d('0x53')][_0xb07d('0x72')][_0xb07d('0x3e')];_0x327430+=0x1){socket[_0xb07d('0x74')]('userVoicePrefix:save',{'UserId':_0x3a77a9[_0xb07d('0x53')][_0xb07d('0x72')][_0x327430],'VoicePrefixId':_0x3a77a9[_0xb07d('0x4c')]['id']});}return _0x584081;});}})[_0xb07d('0x28')](respondWithResult(_0x2eb176,null))[_0xb07d('0x4a')](handleError(_0x2eb176,null));};exports[_0xb07d('0x75')]=function(_0x4ea4b0,_0x5ee7d8,_0x51c0ab){return db[_0xb07d('0x33')]['find']({'where':{'id':_0x4ea4b0[_0xb07d('0x4c')]['id']}})[_0xb07d('0x28')](handleEntityNotFound(_0x5ee7d8,null))['then'](function(_0x3784dc){if(_0x3784dc){return _0x3784dc[_0xb07d('0x75')](_0x4ea4b0[_0xb07d('0x39')][_0xb07d('0x72')])[_0xb07d('0x28')](function(){if(_[_0xb07d('0x76')](_0x4ea4b0[_0xb07d('0x39')][_0xb07d('0x72')])){for(var _0x35a3a1=0x0;_0x35a3a1<_0x4ea4b0[_0xb07d('0x39')][_0xb07d('0x72')][_0xb07d('0x3e')];_0x35a3a1+=0x1){socket[_0xb07d('0x74')](_0xb07d('0x77'),{'UserId':Number(_0x4ea4b0[_0xb07d('0x39')]['ids'][_0x35a3a1]),'VoicePrefixId':Number(_0x4ea4b0[_0xb07d('0x4c')]['id'])});}}else{socket['emit'](_0xb07d('0x77'),{'UserId':Number(_0x4ea4b0[_0xb07d('0x39')][_0xb07d('0x72')]),'VoicePrefixId':Number(_0x4ea4b0[_0xb07d('0x4c')]['id'])});}});}})[_0xb07d('0x28')](respondWithStatusCode(_0x5ee7d8,null))[_0xb07d('0x4a')](handleError(_0x5ee7d8,null));};exports['getAgents']=function(_0x37e3c0,_0x3fb304,_0xc25a1f){var _0x65fdc4={};var _0x4e5b3={};var _0x765b61;var _0xf39fed;return db[_0xb07d('0x33')][_0xb07d('0x78')]({'where':{'id':_0x37e3c0[_0xb07d('0x4c')]['id']}})[_0xb07d('0x28')](handleEntityNotFound(_0x3fb304,null))[_0xb07d('0x28')](function(_0x36e005){if(_0x36e005){_0x765b61=_0x36e005;_0x4e5b3[_0xb07d('0x38')]=_[_0xb07d('0x4d')](db['User'][_0xb07d('0x34')]);_0x4e5b3[_0xb07d('0x39')]=_[_0xb07d('0x4d')](_0x37e3c0[_0xb07d('0x39')]);_0x4e5b3[_0xb07d('0x3a')]=_['intersection'](_0x4e5b3['model'],_0x4e5b3[_0xb07d('0x39')]);_0x65fdc4[_0xb07d('0x3c')]=_['intersection'](_0x4e5b3[_0xb07d('0x38')],qs[_0xb07d('0x3d')](_0x37e3c0[_0xb07d('0x39')][_0xb07d('0x3d')]));_0x65fdc4['attributes']=_0x65fdc4[_0xb07d('0x3c')][_0xb07d('0x3e')]?_0x65fdc4[_0xb07d('0x3c')]:_0x4e5b3['model'];_0x65fdc4[_0xb07d('0x41')]=qs[_0xb07d('0x42')](_0x37e3c0['query'][_0xb07d('0x42')]);_0x65fdc4['where']=qs[_0xb07d('0x3a')](_[_0xb07d('0x79')](_0x37e3c0[_0xb07d('0x39')],_0x4e5b3['filters']));if(_0x37e3c0[_0xb07d('0x39')][_0xb07d('0x7a')]){_0x65fdc4[_0xb07d('0x43')]=_[_0xb07d('0x45')](_0x65fdc4['where'],{'$or':_[_0xb07d('0x32')](_0x65fdc4[_0xb07d('0x3c')],function(_0x26c21c){var _0x1b3c2d={};_0x1b3c2d[_0x26c21c]={'$like':'%'+_0x37e3c0[_0xb07d('0x39')][_0xb07d('0x7a')]+'%'};return _0x1b3c2d;})});}_0x65fdc4=_['merge']({},_0x65fdc4,_0x37e3c0[_0xb07d('0x46')]);return _0x765b61[_0xb07d('0x7b')](_0x65fdc4);}})[_0xb07d('0x28')](function(_0x4899ff){if(_0x4899ff){_0xf39fed=_0x4899ff[_0xb07d('0x3e')];if(!_0x37e3c0[_0xb07d('0x39')]['hasOwnProperty'](_0xb07d('0x40'))){_0x65fdc4[_0xb07d('0x21')]=qs[_0xb07d('0x21')](_0x37e3c0[_0xb07d('0x39')][_0xb07d('0x21')]);_0x65fdc4['offset']=qs[_0xb07d('0x20')](_0x37e3c0['query']['offset']);}return _0x765b61[_0xb07d('0x7b')](_0x65fdc4);}})[_0xb07d('0x28')](function(_0x41dbae){if(_0x41dbae){return _0x41dbae?{'count':_0xf39fed,'rows':_0x41dbae}:null;}})[_0xb07d('0x28')](respondWithResult(_0x3fb304,null))[_0xb07d('0x4a')](handleError(_0x3fb304,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 91e8555..187f363 100644 --- a/server/api/voicePrefix/voicePrefix.events.js +++ b/server/api/voicePrefix/voicePrefix.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['emit','hasOwnProperty','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','update','remove'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x34e8,0x12c));var _0x834e=function(_0x6a7788,_0x160633){_0x6a7788=_0x6a7788-0x0;var _0x1cec31=_0x34e8[_0x6a7788];return _0x1cec31;};'use strict';var EventEmitter=require(_0x834e('0x0'));var VoicePrefix=require(_0x834e('0x1'))['db'][_0x834e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x834e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x834e('0x4'),'afterDestroy':_0x834e('0x5')};function emitEvent(_0x472111){return function(_0x31bf20,_0x289ef2,_0x19a3e0){VoicePrefixEvents[_0x834e('0x6')](_0x472111+':'+_0x31bf20['id'],_0x31bf20);VoicePrefixEvents['emit'](_0x472111,_0x31bf20);_0x19a3e0(null);};}for(var e in events){if(events[_0x834e('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x834e('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0x3e74=['hasOwnProperty','exports','events','VoicePrefix','setMaxListeners','save','emit'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3e74,0x175));var _0x43e7=function(_0x150433,_0x31084a){_0x150433=_0x150433-0x0;var _0x3bfd81=_0x3e74[_0x150433];return _0x3bfd81;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0x43e7('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){VoicePrefixEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);VoicePrefixEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 29a4908..c780f35 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 _0x3804=['bluebird','request-promise','path','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','api','moment'];(function(_0x2e3d63,_0xb43a9b){var _0x105946=function(_0x466785){while(--_0x466785){_0x2e3d63['push'](_0x2e3d63['shift']());}};_0x105946(++_0xb43a9b);}(_0x3804,0x1dd));var _0x4380=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3804[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4380('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4380('0x1'));var moment=require(_0x4380('0x2'));var BPromise=require(_0x4380('0x3'));var rp=require(_0x4380('0x4'));var fs=require('fs');var path=require(_0x4380('0x5'));var rimraf=require('rimraf');var config=require(_0x4380('0x6'));var attributes=require(_0x4380('0x7'));module[_0x4380('0x8')]=function(_0x473ba3,_0x4e7b5a){return _0x473ba3[_0x4380('0x9')](_0x4380('0xa'),attributes,{'tableName':_0x4380('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea8f=['api','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','util'];(function(_0x4a0077,_0x4198fc){var _0x43064c=function(_0x2035bc){while(--_0x2035bc){_0x4a0077['push'](_0x4a0077['shift']());}};_0x43064c(++_0x4198fc);}(_0xea8f,0xdb));var _0xfea8=function(_0x559967,_0x4ecaaf){_0x559967=_0x559967-0x0;var _0x161a66=_0xea8f[_0x559967];return _0x161a66;};'use strict';var _=require(_0xfea8('0x0'));var util=require(_0xfea8('0x1'));var logger=require('../../config/logger')(_0xfea8('0x2'));var moment=require('moment');var BPromise=require(_0xfea8('0x3'));var rp=require(_0xfea8('0x4'));var fs=require('fs');var path=require(_0xfea8('0x5'));var rimraf=require(_0xfea8('0x6'));var config=require(_0xfea8('0x7'));var attributes=require(_0xfea8('0x8'));module[_0xfea8('0x9')]=function(_0x4f292d,_0x3ed07b){return _0x4f292d[_0xfea8('0xa')](_0xfea8('0xb'),attributes,{'tableName':_0xfea8('0xc'),'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 956aae4..5eef8e4 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 _0xda1e=['register','request','then','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','VoicePrefix,\x20%s,\x20%s','message','info','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','./voicePrefix.socket'];(function(_0x3fcd33,_0x2fe1ba){var _0x437ebd=function(_0x4ea902){while(--_0x4ea902){_0x3fcd33['push'](_0x3fcd33['shift']());}};_0x437ebd(++_0x2fe1ba);}(_0xda1e,0xeb));var _0xeda1=function(_0x3ab46c,_0x4d26cc){_0x3ab46c=_0x3ab46c-0x0;var _0x2c7e90=_0xda1e[_0x3ab46c];return _0x2c7e90;};'use strict';var _=require(_0xeda1('0x0'));var util=require('util');var moment=require(_0xeda1('0x1'));var BPromise=require(_0xeda1('0x2'));var rs=require(_0xeda1('0x3'));var fs=require('fs');var Redis=require(_0xeda1('0x4'));var db=require(_0xeda1('0x5'))['db'];var utils=require(_0xeda1('0x6'));var logger=require(_0xeda1('0x7'))(_0xeda1('0x8'));var config=require(_0xeda1('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xeda1('0xa')][_0xeda1('0xb')]({'port':0x232a});config[_0xeda1('0xc')]=_[_0xeda1('0xd')](config[_0xeda1('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xeda1('0xe'))[_0xeda1('0xf')](socket);function respondWithRpcPromise(_0x1f6708,_0x58b013,_0x28bde1){return new BPromise(function(_0x293001,_0x1161e6){return client[_0xeda1('0x10')](_0x1f6708,_0x28bde1)[_0xeda1('0x11')](function(_0x3f01fd){logger['info']('VoicePrefix,\x20%s,\x20%s',_0x58b013,_0xeda1('0x12'));logger[_0xeda1('0x13')](_0xeda1('0x14'),_0x58b013,_0xeda1('0x12'),JSON['stringify'](_0x3f01fd));if(_0x3f01fd['error']){if(_0x3f01fd[_0xeda1('0x15')]['code']===0x1f4){logger['error'](_0xeda1('0x16'),_0x58b013,_0x3f01fd[_0xeda1('0x15')][_0xeda1('0x17')]);return _0x1161e6(_0x3f01fd[_0xeda1('0x15')]['message']);}logger[_0xeda1('0x15')](_0xeda1('0x16'),_0x58b013,_0x3f01fd[_0xeda1('0x15')][_0xeda1('0x17')]);return _0x293001(_0x3f01fd[_0xeda1('0x15')][_0xeda1('0x17')]);}else{logger[_0xeda1('0x18')](_0xeda1('0x16'),_0x58b013,_0xeda1('0x12'));_0x293001(_0x3f01fd['result']['message']);}})['catch'](function(_0xfa39d){logger[_0xeda1('0x15')](_0xeda1('0x16'),_0x58b013,_0xfa39d);_0x1161e6(_0xfa39d);});});} \ No newline at end of file +var _0x20e1=['rpc','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoicePrefix,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x3d6a29,_0x540eac){var _0x170d1b=function(_0x543beb){while(--_0x543beb){_0x3d6a29['push'](_0x3d6a29['shift']());}};_0x170d1b(++_0x540eac);}(_0x20e1,0x9b));var _0x120e=function(_0x5e9c3a,_0x13acc2){_0x5e9c3a=_0x5e9c3a-0x0;var _0x12ccb4=_0x20e1[_0x5e9c3a];return _0x12ccb4;};'use strict';var _=require(_0x120e('0x0'));var util=require(_0x120e('0x1'));var moment=require(_0x120e('0x2'));var BPromise=require(_0x120e('0x3'));var rs=require(_0x120e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x120e('0x5'));var logger=require(_0x120e('0x6'))(_0x120e('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x120e('0x8')][_0x120e('0x9')]({'port':0x232a});config[_0x120e('0xa')]=_[_0x120e('0xb')](config[_0x120e('0xa')],{'host':_0x120e('0xc'),'port':0x18eb});var socket=require(_0x120e('0xd'))(new Redis(config[_0x120e('0xa')]));require('./voicePrefix.socket')[_0x120e('0xe')](socket);function respondWithRpcPromise(_0xc50d3,_0x4f59ce,_0x53400c){return new BPromise(function(_0x188a10,_0x27076f){return client[_0x120e('0xf')](_0xc50d3,_0x53400c)['then'](function(_0x3b7560){logger[_0x120e('0x10')]('VoicePrefix,\x20%s,\x20%s',_0x4f59ce,_0x120e('0x11'));logger[_0x120e('0x12')](_0x120e('0x13'),_0x4f59ce,_0x120e('0x11'),JSON[_0x120e('0x14')](_0x3b7560));if(_0x3b7560[_0x120e('0x15')]){if(_0x3b7560['error'][_0x120e('0x16')]===0x1f4){logger[_0x120e('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x4f59ce,_0x3b7560[_0x120e('0x15')][_0x120e('0x17')]);return _0x27076f(_0x3b7560['error'][_0x120e('0x17')]);}logger[_0x120e('0x15')](_0x120e('0x18'),_0x4f59ce,_0x3b7560['error'][_0x120e('0x17')]);return _0x188a10(_0x3b7560[_0x120e('0x15')][_0x120e('0x17')]);}else{logger[_0x120e('0x10')](_0x120e('0x18'),_0x4f59ce,_0x120e('0x11'));_0x188a10(_0x3b7560[_0x120e('0x19')][_0x120e('0x17')]);}})[_0x120e('0x1a')](function(_0x3fa941){logger[_0x120e('0x15')](_0x120e('0x18'),_0x4f59ce,_0x3fa941);_0x27076f(_0x3fa941);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 9c73c2b..f1638a3 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 _0xa18a=['register','length','voicePrefix:','save','remove','emit','removeListener'];(function(_0x423a86,_0x1bd372){var _0x1a1a53=function(_0x5af463){while(--_0x5af463){_0x423a86['push'](_0x423a86['shift']());}};_0x1a1a53(++_0x1bd372);}(_0xa18a,0xa4));var _0xaa18=function(_0x53f375,_0x1b03b1){_0x53f375=_0x53f375-0x0;var _0x34a443=_0xa18a[_0x53f375];return _0x34a443;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0xaa18('0x0'),_0xaa18('0x1'),'update'];function createListener(_0x7b9421,_0x46cb52){return function(_0x2f96b9){_0x46cb52[_0xaa18('0x2')](_0x7b9421,_0x2f96b9);};}function removeListener(_0x59e3ac,_0x241a58){return function(){VoicePrefixEvents[_0xaa18('0x3')](_0x59e3ac,_0x241a58);};}exports[_0xaa18('0x4')]=function(_0x5a2f7c){for(var _0x1399ee=0x0,_0x5983ff=events[_0xaa18('0x5')];_0x1399ee<_0x5983ff;_0x1399ee++){var _0x1e6973=events[_0x1399ee];var _0x4b0ce3=createListener(_0xaa18('0x6')+_0x1e6973,_0x5a2f7c);VoicePrefixEvents['on'](_0x1e6973,_0x4b0ce3);}}; \ No newline at end of file +var _0x6f22=['remove','update','emit','removeListener','length','voicePrefix:','./voicePrefix.events','save'];(function(_0x415760,_0x2a0fe1){var _0x104ac0=function(_0x1d098f){while(--_0x1d098f){_0x415760['push'](_0x415760['shift']());}};_0x104ac0(++_0x2a0fe1);}(_0x6f22,0xf6));var _0x26f2=function(_0x27fcd1,_0x4256fa){_0x27fcd1=_0x27fcd1-0x0;var _0x505780=_0x6f22[_0x27fcd1];return _0x505780;};'use strict';var VoicePrefixEvents=require(_0x26f2('0x0'));var events=[_0x26f2('0x1'),_0x26f2('0x2'),_0x26f2('0x3')];function createListener(_0x13285a,_0x46da94){return function(_0x225e48){_0x46da94[_0x26f2('0x4')](_0x13285a,_0x225e48);};}function removeListener(_0xc647ad,_0x34ad72){return function(){VoicePrefixEvents[_0x26f2('0x5')](_0xc647ad,_0x34ad72);};}exports['register']=function(_0x12ec5d){for(var _0x3b1097=0x0,_0x42492d=events[_0x26f2('0x6')];_0x3b1097<_0x42492d;_0x3b1097++){var _0x589541=events[_0x3b1097];var _0x5e4982=createListener(_0x26f2('0x7')+_0x589541,_0x12ec5d);VoicePrefixEvents['on'](_0x589541,_0x5e4982);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 829d8a8..4fd0e68 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 _0x8561=['getLists','/:id/blacklists','post','create','/:id/clone','addTeams','addAgents','/:id/lists','addLists','addBlackLists','put','update','delete','destroy','/:id/teams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','/:id','isAuthenticated','show','/:id/hoppers','getHopperFinals','/:id/hopper_black','getHopperBlacks','getTeams','/:id/users','getAgents','getMembers'];(function(_0x5d86ee,_0xf6a675){var _0x533120=function(_0x4d0628){while(--_0x4d0628){_0x5d86ee['push'](_0x5d86ee['shift']());}};_0x533120(++_0xf6a675);}(_0x8561,0x1e5));var _0x1856=function(_0x460ab9,_0x3815ac){_0x460ab9=_0x460ab9-0x0;var _0x27ef6e=_0x8561[_0x460ab9];return _0x27ef6e;};'use strict';var multer=require(_0x1856('0x0'));var util=require(_0x1856('0x1'));var path=require(_0x1856('0x2'));var timeout=require(_0x1856('0x3'));var express=require(_0x1856('0x4'));var router=express[_0x1856('0x5')]();var auth=require(_0x1856('0x6'));var interaction=require(_0x1856('0x7'));var config=require(_0x1856('0x8'));var controller=require(_0x1856('0x9'));router[_0x1856('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1856('0xa')](_0x1856('0xb'),auth[_0x1856('0xc')](),controller[_0x1856('0xd')]);router[_0x1856('0xa')](_0x1856('0xe'),auth['isAuthenticated'](),controller['getHoppers']);router['get']('/:id/hopper_histories',auth[_0x1856('0xc')](),controller['getHopperHistories']);router[_0x1856('0xa')]('/:id/hopper_finals',auth['isAuthenticated'](),controller[_0x1856('0xf')]);router['get'](_0x1856('0x10'),auth[_0x1856('0xc')](),controller[_0x1856('0x11')]);router[_0x1856('0xa')]('/:id/teams',auth[_0x1856('0xc')](),controller[_0x1856('0x12')]);router[_0x1856('0xa')](_0x1856('0x13'),auth['isAuthenticated'](),controller[_0x1856('0x14')]);router[_0x1856('0xa')]('/:id/members',auth[_0x1856('0xc')](),controller[_0x1856('0x15')]);router[_0x1856('0xa')]('/:id/lists',auth[_0x1856('0xc')](),controller[_0x1856('0x16')]);router[_0x1856('0xa')](_0x1856('0x17'),auth['isAuthenticated'](),controller['getBlackLists']);router[_0x1856('0x18')]('/',auth['isAuthenticated'](),controller[_0x1856('0x19')]);router[_0x1856('0x18')](_0x1856('0x1a'),auth[_0x1856('0xc')](),controller['clone']);router[_0x1856('0x18')]('/:id/teams',auth[_0x1856('0xc')](),controller[_0x1856('0x1b')]);router[_0x1856('0x18')](_0x1856('0x13'),auth[_0x1856('0xc')](),controller[_0x1856('0x1c')]);router[_0x1856('0x18')](_0x1856('0x1d'),auth[_0x1856('0xc')](),controller[_0x1856('0x1e')]);router[_0x1856('0x18')](_0x1856('0x17'),auth[_0x1856('0xc')](),controller[_0x1856('0x1f')]);router[_0x1856('0x20')](_0x1856('0xb'),auth['isAuthenticated'](),controller[_0x1856('0x21')]);router[_0x1856('0x22')]('/:id',auth[_0x1856('0xc')](),controller[_0x1856('0x23')]);router['delete'](_0x1856('0x24'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x1856('0x22')](_0x1856('0x13'),auth['isAuthenticated'](),controller[_0x1856('0x25')]);router[_0x1856('0x22')](_0x1856('0x1d'),auth[_0x1856('0xc')](),controller['removeLists']);router[_0x1856('0x22')](_0x1856('0x17'),auth[_0x1856('0xc')](),controller['removeBlackLists']);module[_0x1856('0x26')]=router; \ No newline at end of file +var _0x217b=['/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getAgents','/:id/lists','getLists','/:id/blacklists','getBlackLists','create','clone','post','/:id/users','addAgents','addBlackLists','put','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x217b,0x1a2));var _0xb217=function(_0xf73c09,_0x4e424e){_0xf73c09=_0xf73c09-0x0;var _0xa8923c=_0x217b[_0xf73c09];return _0xa8923c;};'use strict';var multer=require(_0xb217('0x0'));var util=require(_0xb217('0x1'));var path=require(_0xb217('0x2'));var timeout=require(_0xb217('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xb217('0x4'));var interaction=require(_0xb217('0x5'));var config=require('../../config/environment');var controller=require('./voiceQueue.controller');router[_0xb217('0x6')]('/',auth[_0xb217('0x7')](),controller[_0xb217('0x8')]);router[_0xb217('0x6')](_0xb217('0x9'),auth[_0xb217('0x7')](),controller[_0xb217('0xa')]);router[_0xb217('0x6')](_0xb217('0xb'),auth[_0xb217('0x7')](),controller[_0xb217('0xc')]);router[_0xb217('0x6')](_0xb217('0xd'),auth[_0xb217('0x7')](),controller[_0xb217('0xe')]);router[_0xb217('0x6')](_0xb217('0xf'),auth['isAuthenticated'](),controller[_0xb217('0x10')]);router[_0xb217('0x6')](_0xb217('0x11'),auth[_0xb217('0x7')](),controller[_0xb217('0x12')]);router[_0xb217('0x6')](_0xb217('0x13'),auth['isAuthenticated'](),controller['getTeams']);router[_0xb217('0x6')]('/:id/users',auth['isAuthenticated'](),controller[_0xb217('0x14')]);router[_0xb217('0x6')]('/:id/members',auth[_0xb217('0x7')](),controller['getMembers']);router[_0xb217('0x6')](_0xb217('0x15'),auth['isAuthenticated'](),controller[_0xb217('0x16')]);router[_0xb217('0x6')](_0xb217('0x17'),auth[_0xb217('0x7')](),controller[_0xb217('0x18')]);router['post']('/',auth[_0xb217('0x7')](),controller[_0xb217('0x19')]);router['post']('/:id/clone',auth[_0xb217('0x7')](),controller[_0xb217('0x1a')]);router[_0xb217('0x1b')]('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router[_0xb217('0x1b')](_0xb217('0x1c'),auth[_0xb217('0x7')](),controller[_0xb217('0x1d')]);router[_0xb217('0x1b')]('/:id/lists',auth[_0xb217('0x7')](),controller['addLists']);router['post']('/:id/blacklists',auth[_0xb217('0x7')](),controller[_0xb217('0x1e')]);router[_0xb217('0x1f')](_0xb217('0x9'),auth[_0xb217('0x7')](),controller[_0xb217('0x20')]);router[_0xb217('0x21')](_0xb217('0x9'),auth[_0xb217('0x7')](),controller['destroy']);router[_0xb217('0x21')](_0xb217('0x13'),auth[_0xb217('0x7')](),controller[_0xb217('0x22')]);router[_0xb217('0x21')]('/:id/users',auth[_0xb217('0x7')](),controller[_0xb217('0x23')]);router[_0xb217('0x21')]('/:id/lists',auth[_0xb217('0x7')](),controller[_0xb217('0x24')]);router[_0xb217('0x21')](_0xb217('0x17'),auth[_0xb217('0x7')](),controller[_0xb217('0x25')]);module[_0xb217('0x26')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 9dd6869..355d6d8 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(_0x7c7a41,_0x11a170){var _0x5c09d3=function(_0x5dec92){while(--_0x5dec92){_0x7c7a41['push'](_0x7c7a41['shift']());}};_0x5c09d3(++_0x11a170);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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(_0x51f632,_0x5a14d5){var _0x24cf36=function(_0x3f2799){while(--_0x3f2799){_0x51f632['push'](_0x51f632['shift']());}};_0x24cf36(++_0x5a14d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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 ac52091..d2c5eaf 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 _0xb57d=['scheduledAt','ContactId','ListId','NOW()','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','phone','ListId\x20=\x20?','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueue.socket','sendStatus','status','count','offset','set','Content-Range','json','reject','save','update','then','destroy','VoiceQueues','QueueCampaigns','outbound','filter','ignore','value','includes','type','find','UserProfileResource','end','stack','name','send','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','VIRTUAL','merge','VoiceQueue','includeAll','include','findAll','rows','catch','show','params','keys','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','clone','omit','createdAt','updatedAt','inbound','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','hasOwnProperty','pick','VoiceQueueId','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals','findOne','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','flatMap','forEach','penalty','sequelize','transaction','each','UserVoiceQueue','UserVoiceQueueRt','upsert','isNil','interface','emit','userVoiceQueue:save','removeTeams','select','field','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','union','compact','removeAgents','userVoiceQueue:remove','addAgents','ids','spread','isEmpty','format','SIP/%s','getAgents','getMembers','CmList','getLists','addLists','dialCheckDuplicateType','always','into','cm_hopper','fromQuery'];(function(_0x451402,_0x561cb8){var _0x4ffb7f=function(_0x1c263a){while(--_0x1c263a){_0x451402['push'](_0x451402['shift']());}};_0x4ffb7f(++_0x561cb8);}(_0xb57d,0x18d));var _0xdb57=function(_0x5815ee,_0x5336e8){_0x5815ee=_0x5815ee-0x0;var _0x5cb8f1=_0xb57d[_0x5815ee];return _0x5cb8f1;};'use strict';var pdf=require(_0xdb57('0x0'));var emlformat=require(_0xdb57('0x1'));var rimraf=require(_0xdb57('0x2'));var zipdir=require(_0xdb57('0x3'));var jsonpatch=require(_0xdb57('0x4'));var rp=require('request-promise');var moment=require(_0xdb57('0x5'));var BPromise=require(_0xdb57('0x6'));var Mustache=require(_0xdb57('0x7'));var util=require(_0xdb57('0x8'));var path=require('path');var sox=require(_0xdb57('0x9'));var csv=require(_0xdb57('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdb57('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdb57('0xc'));var deskjs=require(_0xdb57('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdb57('0xe'));var Redis=require(_0xdb57('0xf'));var authService=require(_0xdb57('0x10'));var qs=require(_0xdb57('0x11'));var as=require(_0xdb57('0x12'));var hardwareService=require(_0xdb57('0x13'));var logger=require('../../config/logger')(_0xdb57('0x14'));var utils=require('../../config/utils');var config=require(_0xdb57('0x15'));var db=require(_0xdb57('0x16'))['db'];config[_0xdb57('0x17')]=_[_0xdb57('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xdb57('0x19'))(new Redis(config[_0xdb57('0x17')]));require(_0xdb57('0x1a'))['register'](socket);function respondWithStatusCode(_0x201fde,_0x25a660){_0x25a660=_0x25a660||0xcc;return function(_0x20083e){if(_0x20083e){return _0x201fde[_0xdb57('0x1b')](_0x25a660);}return _0x201fde[_0xdb57('0x1c')](_0x25a660)['end']();};}function respondWithResult(_0x42924f,_0x42f86a){_0x42f86a=_0x42f86a||0xc8;return function(_0x33c36a){if(_0x33c36a){return _0x42924f[_0xdb57('0x1c')](_0x42f86a)['json'](_0x33c36a);}};}function respondWithFilteredResult(_0x178e75,_0x54e7b4){return function(_0x3ca09e){if(_0x3ca09e){var _0x14b4f0=_0x3ca09e[_0xdb57('0x1d')],_0xff26b2=_0x54e7b4[_0xdb57('0x1e')],_0x3858b2=_0x54e7b4[_0xdb57('0x1e')]+_0x54e7b4['limit'],_0x52091b;if(_0x3858b2>=_0x14b4f0){_0x3858b2=_0x14b4f0;_0x52091b=0xc8;}else{_0x52091b=0xce;}_0x178e75['status'](_0x52091b);return _0x178e75[_0xdb57('0x1f')](_0xdb57('0x20'),_0xff26b2+'-'+_0x3858b2+'/'+_0x14b4f0)[_0xdb57('0x21')](_0x3ca09e);}return null;};}function patchUpdates(_0x48b941){return function(_0x605557){try{jsonpatch['apply'](_0x605557,_0x48b941,!![]);}catch(_0x3ffda2){return BPromise[_0xdb57('0x22')](_0x3ffda2);}return _0x605557[_0xdb57('0x23')]();};}function saveUpdates(_0x582607,_0x1f4c0d){return function(_0xaa09d0){if(_0xaa09d0){return _0xaa09d0[_0xdb57('0x24')](_0x582607)[_0xdb57('0x25')](function(_0x3a1755){return _0x3a1755;});}return null;};}function removeEntity(_0x436f76,_0x141768){return function(_0x1dea3d){if(_0x1dea3d){return _0x1dea3d[_0xdb57('0x26')]()['then'](function(){var _0x574796=_0x1dea3d['get']({'plain':!![]});var _0x31e009=[{'name':_0xdb57('0x27'),'value':'inbound','ignore':![]},{'name':_0xdb57('0x28'),'value':_0xdb57('0x29'),'ignore':![]}];var _0x1a5301=_(_0x31e009)[_0xdb57('0x2a')](_0xdb57('0x2b'))['map'](_0xdb57('0x2c'))[_0xdb57('0x2c')]();if(_[_0xdb57('0x2d')](_0x1a5301,_0x574796[_0xdb57('0x2e')])){return;}var _0x51d0f0=_[_0xdb57('0x2f')](_0x31e009,['value',_0x574796[_0xdb57('0x2e')]])['name'];return db[_0xdb57('0x30')][_0xdb57('0x26')]({'where':{'type':_0x51d0f0,'resourceId':_0x574796['id']}})[_0xdb57('0x25')](function(){return _0x1dea3d;});})[_0xdb57('0x25')](function(){_0x436f76[_0xdb57('0x1c')](0xcc)[_0xdb57('0x31')]();});}};}function handleEntityNotFound(_0x563ed9,_0x17af2c){return function(_0x30817e){if(!_0x30817e){_0x563ed9[_0xdb57('0x1b')](0x194);}return _0x30817e;};}function handleError(_0x840739,_0x389877){_0x389877=_0x389877||0x1f4;return function(_0x185499){logger['error'](_0x185499[_0xdb57('0x32')]);if(_0x185499[_0xdb57('0x33')]){delete _0x185499[_0xdb57('0x33')];}_0x840739[_0xdb57('0x1c')](_0x389877)[_0xdb57('0x34')](_0x185499);};}exports['index']=function(_0x61cdf8,_0x1b6027){var _0x5eb11e={},_0xabdad1={},_0x1aee29={'count':0x0,'rows':[]};var _0x3fc32f=_[_0xdb57('0x35')](db['VoiceQueue'][_0xdb57('0x36')],function(_0x83dfba){return{'name':_0x83dfba[_0xdb57('0x37')],'type':_0x83dfba[_0xdb57('0x2e')][_0xdb57('0x38')]};});_0xabdad1[_0xdb57('0x39')]=_[_0xdb57('0x35')](_0x3fc32f,_0xdb57('0x33'));_0xabdad1['query']=_['keys'](_0x61cdf8[_0xdb57('0x3a')]);_0xabdad1[_0xdb57('0x3b')]=_[_0xdb57('0x3c')](_0xabdad1[_0xdb57('0x39')],_0xabdad1[_0xdb57('0x3a')]);_0x5eb11e[_0xdb57('0x3d')]=_[_0xdb57('0x3c')](_0xabdad1[_0xdb57('0x39')],qs[_0xdb57('0x3e')](_0x61cdf8[_0xdb57('0x3a')][_0xdb57('0x3e')]));_0x5eb11e[_0xdb57('0x3d')]=_0x5eb11e[_0xdb57('0x3d')][_0xdb57('0x3f')]?_0x5eb11e[_0xdb57('0x3d')]:_0xabdad1[_0xdb57('0x39')];if(!_0x61cdf8['query']['hasOwnProperty'](_0xdb57('0x40'))){_0x5eb11e[_0xdb57('0x41')]=qs['limit'](_0x61cdf8[_0xdb57('0x3a')][_0xdb57('0x41')]);_0x5eb11e[_0xdb57('0x1e')]=qs[_0xdb57('0x1e')](_0x61cdf8[_0xdb57('0x3a')]['offset']);}_0x5eb11e[_0xdb57('0x42')]=qs[_0xdb57('0x43')](_0x61cdf8[_0xdb57('0x3a')][_0xdb57('0x43')]);_0x5eb11e[_0xdb57('0x44')]=qs[_0xdb57('0x3b')](_['pick'](_0x61cdf8[_0xdb57('0x3a')],_0xabdad1[_0xdb57('0x3b')]),_0x3fc32f);if(_0x61cdf8[_0xdb57('0x3a')]['filter']){_0x5eb11e[_0xdb57('0x44')]=_['merge'](_0x5eb11e[_0xdb57('0x44')],{'$or':_[_0xdb57('0x35')](_0x3fc32f,function(_0x697595){if(_0x697595[_0xdb57('0x2e')]!==_0xdb57('0x45')){var _0x253304={};_0x253304[_0x697595[_0xdb57('0x33')]]={'$like':'%'+_0x61cdf8[_0xdb57('0x3a')]['filter']+'%'};return _0x253304;}})});}_0x5eb11e=_[_0xdb57('0x46')]({},_0x5eb11e,_0x61cdf8['options']);var _0x2f7474={'where':_0x5eb11e[_0xdb57('0x44')]};return db[_0xdb57('0x47')][_0xdb57('0x1d')](_0x2f7474)[_0xdb57('0x25')](function(_0x40a8a5){_0x1aee29[_0xdb57('0x1d')]=_0x40a8a5;if(_0x61cdf8[_0xdb57('0x3a')][_0xdb57('0x48')]){_0x5eb11e[_0xdb57('0x49')]=[{'all':!![]}];}return db[_0xdb57('0x47')][_0xdb57('0x4a')](_0x5eb11e);})[_0xdb57('0x25')](function(_0x5b4250){_0x1aee29[_0xdb57('0x4b')]=_0x5b4250;return _0x1aee29;})['then'](respondWithFilteredResult(_0x1b6027,_0x5eb11e))[_0xdb57('0x4c')](handleError(_0x1b6027,null));};exports[_0xdb57('0x4d')]=function(_0x2ede9d,_0x33d8a8){var _0x3acebf={'raw':![],'where':{'id':_0x2ede9d[_0xdb57('0x4e')]['id']}},_0x290a32={};_0x290a32[_0xdb57('0x39')]=_[_0xdb57('0x4f')](db['VoiceQueue']['rawAttributes']);_0x290a32[_0xdb57('0x3a')]=_['keys'](_0x2ede9d['query']);_0x290a32[_0xdb57('0x3b')]=_[_0xdb57('0x3c')](_0x290a32[_0xdb57('0x39')],_0x290a32[_0xdb57('0x3a')]);_0x3acebf[_0xdb57('0x3d')]=_[_0xdb57('0x3c')](_0x290a32['model'],qs['fields'](_0x2ede9d[_0xdb57('0x3a')][_0xdb57('0x3e')]));_0x3acebf['attributes']=_0x3acebf[_0xdb57('0x3d')][_0xdb57('0x3f')]?_0x3acebf[_0xdb57('0x3d')]:_0x290a32[_0xdb57('0x39')];if(_0x2ede9d[_0xdb57('0x3a')][_0xdb57('0x48')]){_0x3acebf[_0xdb57('0x49')]=[{'all':!![]}];}_0x3acebf=_[_0xdb57('0x46')]({},_0x3acebf,_0x2ede9d[_0xdb57('0x50')]);return db[_0xdb57('0x47')][_0xdb57('0x2f')](_0x3acebf)[_0xdb57('0x25')](handleEntityNotFound(_0x33d8a8,null))[_0xdb57('0x25')](respondWithResult(_0x33d8a8,null))[_0xdb57('0x4c')](handleError(_0x33d8a8,null));};exports['create']=function(_0x2da891,_0x290c83){return db['VoiceQueue'][_0xdb57('0x51')](_0x2da891[_0xdb57('0x52')],{})[_0xdb57('0x25')](function(_0x249e59){var _0x3da9fd=_0x2da891[_0xdb57('0x53')][_0xdb57('0x54')]({'plain':!![]});if(!_0x3da9fd)throw new Error(_0xdb57('0x55'));if(_0x3da9fd[_0xdb57('0x56')]===_0xdb57('0x53')){var _0x487405=_0x249e59[_0xdb57('0x54')]({'plain':!![]});var _0x4bd81c=[{'name':_0xdb57('0x27'),'value':'inbound'},{'name':_0xdb57('0x28'),'value':_0xdb57('0x29')}];var _0x22ab41=_['find'](_0x4bd81c,[_0xdb57('0x2c'),_0x487405['type']])[_0xdb57('0x33')];return db[_0xdb57('0x57')][_0xdb57('0x2f')]({'where':{'name':_0x22ab41,'userProfileId':_0x3da9fd[_0xdb57('0x58')]},'raw':!![]})[_0xdb57('0x25')](function(_0x243ba7){if(_0x243ba7&&_0x243ba7['autoAssociation']===0x0){return db[_0xdb57('0x30')][_0xdb57('0x51')]({'name':_0x487405[_0xdb57('0x33')],'resourceId':_0x487405['id'],'type':_0x243ba7['name'],'sectionId':_0x243ba7['id']},{})[_0xdb57('0x25')](function(){return _0x249e59;});}else{return _0x249e59;}})[_0xdb57('0x4c')](function(_0x1c2679){logger[_0xdb57('0x59')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1c2679);throw _0x1c2679;});}return _0x249e59;})[_0xdb57('0x25')](respondWithResult(_0x290c83,0xc9))[_0xdb57('0x4c')](handleError(_0x290c83,null));};exports[_0xdb57('0x5a')]=function(_0x160050,_0x2aa380){var _0x30fe47={'where':{'id':_0x160050[_0xdb57('0x4e')]['id']}},_0x5f137e={};_0x5f137e[_0xdb57('0x39')]=_[_0xdb57('0x4f')](db[_0xdb57('0x47')][_0xdb57('0x36')]);_0x30fe47[_0xdb57('0x3d')]=_[_0xdb57('0x3c')](_0x5f137e['model'],qs[_0xdb57('0x3e')](_0x160050[_0xdb57('0x3a')][_0xdb57('0x3e')]));_0x30fe47[_0xdb57('0x3d')]=_0x30fe47['attributes'][_0xdb57('0x3f')]?_0x30fe47[_0xdb57('0x3d')]:_0x5f137e[_0xdb57('0x39')];if(_0x160050['query'][_0xdb57('0x48')]){_0x30fe47['include']=[{'all':!![]}];}_0x30fe47=_['merge']({},_0x30fe47,_0x160050[_0xdb57('0x50')]);return db[_0xdb57('0x47')][_0xdb57('0x2f')](_0x30fe47)[_0xdb57('0x25')](handleEntityNotFound(_0x2aa380,null))[_0xdb57('0x25')](function(_0x49524e){if(_0x49524e){var _0x1fe87f=_0x49524e[_0xdb57('0x54')]({'plain':!![]});_0x1fe87f=qs[_0xdb57('0x5b')](_0x1fe87f,['id',_0xdb57('0x5c'),'updatedAt']);_0x160050['body']=_[_0xdb57('0x5b')](_0x160050[_0xdb57('0x52')],['id',_0xdb57('0x5c'),_0xdb57('0x5d')]);return db[_0xdb57('0x47')][_0xdb57('0x51')](_['merge'](_0x1fe87f,_0x160050[_0xdb57('0x52')]),{'include':_0x160050[_0xdb57('0x3a')]['includeAll']?[{'all':!![]}]:undefined})[_0xdb57('0x25')](function(_0x5b83a3){var _0x2bc7a0=_0x160050[_0xdb57('0x53')][_0xdb57('0x54')]({'plain':!![]});if(!_0x2bc7a0)throw new Error(_0xdb57('0x55'));if(_0x2bc7a0[_0xdb57('0x56')]===_0xdb57('0x53')){var _0x5f35c9=_0x5b83a3['get']({'plain':!![]});var _0x390bfa=[{'name':_0xdb57('0x27'),'value':_0xdb57('0x5e')},{'name':'QueueCampaigns','value':_0xdb57('0x29')}];var _0x1dc979=_['find'](_0x390bfa,[_0xdb57('0x2c'),_0x5f35c9[_0xdb57('0x2e')]])[_0xdb57('0x33')];return db['UserProfileSection']['find']({'where':{'name':_0x1dc979,'userProfileId':_0x2bc7a0[_0xdb57('0x58')]},'raw':!![]})[_0xdb57('0x25')](function(_0x5e3cf2){if(_0x5e3cf2&&_0x5e3cf2[_0xdb57('0x5f')]===0x0){return db[_0xdb57('0x30')]['create']({'name':_0x5f35c9[_0xdb57('0x33')],'resourceId':_0x5f35c9['id'],'type':_0x5e3cf2[_0xdb57('0x33')],'sectionId':_0x5e3cf2['id']},{})[_0xdb57('0x25')](function(){return _0x5b83a3;});}else{return _0x5b83a3;}})[_0xdb57('0x4c')](function(_0x54411f){logger[_0xdb57('0x59')](_0xdb57('0x60'),_0x54411f);throw _0x54411f;});}return _0x5b83a3;});}})[_0xdb57('0x25')](respondWithResult(_0x2aa380,0xc9))[_0xdb57('0x4c')](handleError(_0x2aa380,null));};exports[_0xdb57('0x24')]=function(_0x5a6acd,_0x51103e){if(_0x5a6acd[_0xdb57('0x52')]['id']){delete _0x5a6acd['body']['id'];}return db['VoiceQueue'][_0xdb57('0x2f')]({'where':{'id':_0x5a6acd[_0xdb57('0x4e')]['id']}})['then'](handleEntityNotFound(_0x51103e,null))['then'](saveUpdates(_0x5a6acd[_0xdb57('0x52')],null))[_0xdb57('0x25')](respondWithResult(_0x51103e,null))[_0xdb57('0x4c')](handleError(_0x51103e,null));};exports[_0xdb57('0x26')]=function(_0x1cf5b4,_0x5d1b05){return db[_0xdb57('0x47')][_0xdb57('0x2f')]({'where':{'id':_0x1cf5b4[_0xdb57('0x4e')]['id']}})[_0xdb57('0x25')](handleEntityNotFound(_0x5d1b05,null))[_0xdb57('0x25')](removeEntity(_0x5d1b05,null))[_0xdb57('0x4c')](handleError(_0x5d1b05,null));};exports[_0xdb57('0x61')]=function(_0x4e78e6,_0x41ca6c,_0x4e8bcb){var _0x49f0d1={'raw':![],'where':{}};var _0x4e2888={};var _0x1424b4={'count':0x0,'rows':[]};return db[_0xdb57('0x47')]['findOne']({'where':{'id':_0x4e78e6[_0xdb57('0x4e')]['id']}})[_0xdb57('0x25')](handleEntityNotFound(_0x41ca6c,null))[_0xdb57('0x25')](function(_0x58df55){if(_0x58df55){_0x4e2888['model']=_['keys'](db['CmHopper'][_0xdb57('0x36')]);_0x4e2888[_0xdb57('0x3a')]=_[_0xdb57('0x4f')](_0x4e78e6[_0xdb57('0x3a')]);_0x4e2888[_0xdb57('0x3b')]=_['intersection'](_0x4e2888[_0xdb57('0x39')],_0x4e2888['query']);_0x49f0d1[_0xdb57('0x3d')]=_[_0xdb57('0x3c')](_0x4e2888['model'],qs['fields'](_0x4e78e6[_0xdb57('0x3a')][_0xdb57('0x3e')]));_0x49f0d1[_0xdb57('0x3d')]=_0x49f0d1['attributes'][_0xdb57('0x3f')]?_0x49f0d1[_0xdb57('0x3d')]:_0x4e2888[_0xdb57('0x39')];if(!_0x4e78e6[_0xdb57('0x3a')][_0xdb57('0x62')](_0xdb57('0x40'))){_0x49f0d1[_0xdb57('0x41')]=qs['limit'](_0x4e78e6[_0xdb57('0x3a')][_0xdb57('0x41')]);_0x49f0d1[_0xdb57('0x1e')]=qs['offset'](_0x4e78e6[_0xdb57('0x3a')][_0xdb57('0x1e')]);}_0x49f0d1['order']=qs['sort'](_0x4e78e6[_0xdb57('0x3a')][_0xdb57('0x43')]);_0x49f0d1[_0xdb57('0x44')]=qs['filters'](_[_0xdb57('0x63')](_0x4e78e6[_0xdb57('0x3a')],_0x4e2888[_0xdb57('0x3b')]));_0x49f0d1[_0xdb57('0x44')][_0xdb57('0x64')]=_0x58df55['id'];if(_0x4e78e6[_0xdb57('0x3a')][_0xdb57('0x2a')]){_0x49f0d1[_0xdb57('0x44')]=_['merge'](_0x49f0d1['where'],{'$or':_[_0xdb57('0x35')](_0x49f0d1[_0xdb57('0x3d')],function(_0x5271db){var _0x2430aa={};_0x2430aa[_0x5271db]={'$like':'%'+_0x4e78e6[_0xdb57('0x3a')][_0xdb57('0x2a')]+'%'};return _0x2430aa;})});}_0x49f0d1=_[_0xdb57('0x46')]({},_0x49f0d1,_0x4e78e6[_0xdb57('0x50')]);return db[_0xdb57('0x65')][_0xdb57('0x1d')]({'where':_0x49f0d1['where']})[_0xdb57('0x25')](function(_0x57277b){_0x1424b4[_0xdb57('0x1d')]=_0x57277b;if(_0x4e78e6[_0xdb57('0x3a')][_0xdb57('0x48')]){_0x49f0d1[_0xdb57('0x49')]=[{'all':!![]}];}return db['CmHopper'][_0xdb57('0x4a')](_0x49f0d1);})['then'](function(_0x21e347){_0x1424b4[_0xdb57('0x4b')]=_0x21e347;return _0x1424b4;});}})[_0xdb57('0x25')](respondWithFilteredResult(_0x41ca6c,_0x49f0d1))['catch'](handleError(_0x41ca6c,null));};exports[_0xdb57('0x66')]=function(_0x33ac8a,_0x41ec06,_0x5ea7c5){var _0x394a66={'raw':!![],'where':{}};var _0x483424={};var _0x188ca9={'count':0x0,'rows':[]};return db[_0xdb57('0x47')]['findOne']({'where':{'id':_0x33ac8a[_0xdb57('0x4e')]['id']}})[_0xdb57('0x25')](handleEntityNotFound(_0x41ec06,null))[_0xdb57('0x25')](function(_0x4288c6){if(_0x4288c6){_0x483424['model']=_[_0xdb57('0x4f')](db[_0xdb57('0x67')][_0xdb57('0x36')]);_0x483424['query']=_[_0xdb57('0x4f')](_0x33ac8a[_0xdb57('0x3a')]);_0x483424[_0xdb57('0x3b')]=_[_0xdb57('0x3c')](_0x483424[_0xdb57('0x39')],_0x483424[_0xdb57('0x3a')]);_0x394a66[_0xdb57('0x3d')]=_[_0xdb57('0x3c')](_0x483424[_0xdb57('0x39')],qs['fields'](_0x33ac8a[_0xdb57('0x3a')]['fields']));_0x394a66[_0xdb57('0x3d')]=_0x394a66[_0xdb57('0x3d')][_0xdb57('0x3f')]?_0x394a66[_0xdb57('0x3d')]:_0x483424['model'];if(!_0x33ac8a[_0xdb57('0x3a')]['hasOwnProperty'](_0xdb57('0x40'))){_0x394a66['limit']=qs[_0xdb57('0x41')](_0x33ac8a[_0xdb57('0x3a')][_0xdb57('0x41')]);_0x394a66[_0xdb57('0x1e')]=qs[_0xdb57('0x1e')](_0x33ac8a[_0xdb57('0x3a')]['offset']);}_0x394a66[_0xdb57('0x42')]=qs[_0xdb57('0x43')](_0x33ac8a[_0xdb57('0x3a')]['sort']);_0x394a66[_0xdb57('0x44')]=qs[_0xdb57('0x3b')](_[_0xdb57('0x63')](_0x33ac8a['query'],_0x483424[_0xdb57('0x3b')]));_0x394a66[_0xdb57('0x44')][_0xdb57('0x64')]=_0x4288c6['id'];if(_0x33ac8a['query'][_0xdb57('0x2a')]){_0x394a66[_0xdb57('0x44')]=_[_0xdb57('0x46')](_0x394a66[_0xdb57('0x44')],{'$or':_['map'](_0x394a66[_0xdb57('0x3d')],function(_0x5f4387){var _0x352b35={};_0x352b35[_0x5f4387]={'$like':'%'+_0x33ac8a[_0xdb57('0x3a')][_0xdb57('0x2a')]+'%'};return _0x352b35;})});}_0x394a66=_[_0xdb57('0x46')]({},_0x394a66,_0x33ac8a['options']);return db[_0xdb57('0x67')][_0xdb57('0x1d')]({'where':_0x394a66[_0xdb57('0x44')]})[_0xdb57('0x25')](function(_0x1e4711){_0x188ca9[_0xdb57('0x1d')]=_0x1e4711;if(_0x33ac8a[_0xdb57('0x3a')][_0xdb57('0x48')]){_0x394a66[_0xdb57('0x49')]=[{'all':!![]}];}return db[_0xdb57('0x67')]['findAll'](_0x394a66);})[_0xdb57('0x25')](function(_0x6e2827){_0x188ca9[_0xdb57('0x4b')]=_0x6e2827;return _0x188ca9;});}})['then'](respondWithFilteredResult(_0x41ec06,_0x394a66))[_0xdb57('0x4c')](handleError(_0x41ec06,null));};exports[_0xdb57('0x68')]=function(_0x3d273a,_0x571eb1,_0x5ab749){var _0xa58e10={'raw':!![],'where':{}};var _0x775ca1={};var _0x3bdeb1={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xdb57('0x69')]({'where':{'id':_0x3d273a[_0xdb57('0x4e')]['id']}})[_0xdb57('0x25')](handleEntityNotFound(_0x571eb1,null))[_0xdb57('0x25')](function(_0x14e6ea){if(_0x14e6ea){_0x775ca1[_0xdb57('0x39')]=_[_0xdb57('0x4f')](db[_0xdb57('0x6a')][_0xdb57('0x36')]);_0x775ca1[_0xdb57('0x3a')]=_[_0xdb57('0x4f')](_0x3d273a['query']);_0x775ca1[_0xdb57('0x3b')]=_['intersection'](_0x775ca1[_0xdb57('0x39')],_0x775ca1['query']);_0xa58e10['attributes']=_[_0xdb57('0x3c')](_0x775ca1[_0xdb57('0x39')],qs[_0xdb57('0x3e')](_0x3d273a[_0xdb57('0x3a')][_0xdb57('0x3e')]));_0xa58e10[_0xdb57('0x3d')]=_0xa58e10[_0xdb57('0x3d')][_0xdb57('0x3f')]?_0xa58e10[_0xdb57('0x3d')]:_0x775ca1[_0xdb57('0x39')];if(!_0x3d273a[_0xdb57('0x3a')][_0xdb57('0x62')](_0xdb57('0x40'))){_0xa58e10['limit']=qs['limit'](_0x3d273a[_0xdb57('0x3a')][_0xdb57('0x41')]);_0xa58e10[_0xdb57('0x1e')]=qs[_0xdb57('0x1e')](_0x3d273a[_0xdb57('0x3a')]['offset']);}_0xa58e10[_0xdb57('0x42')]=qs[_0xdb57('0x43')](_0x3d273a[_0xdb57('0x3a')][_0xdb57('0x43')]);_0xa58e10['where']=qs[_0xdb57('0x3b')](_[_0xdb57('0x63')](_0x3d273a[_0xdb57('0x3a')],_0x775ca1[_0xdb57('0x3b')]));_0xa58e10[_0xdb57('0x44')][_0xdb57('0x64')]=_0x14e6ea['id'];if(_0x3d273a[_0xdb57('0x3a')][_0xdb57('0x2a')]){_0xa58e10['where']=_['merge'](_0xa58e10[_0xdb57('0x44')],{'$or':_[_0xdb57('0x35')](_0xa58e10['attributes'],function(_0x2b868f){var _0x195ccc={};_0x195ccc[_0x2b868f]={'$like':'%'+_0x3d273a[_0xdb57('0x3a')][_0xdb57('0x2a')]+'%'};return _0x195ccc;})});}_0xa58e10=_[_0xdb57('0x46')]({},_0xa58e10,_0x3d273a['options']);return db[_0xdb57('0x6a')][_0xdb57('0x1d')]({'where':_0xa58e10[_0xdb57('0x44')]})['then'](function(_0x346768){_0x3bdeb1['count']=_0x346768;if(_0x3d273a[_0xdb57('0x3a')][_0xdb57('0x48')]){_0xa58e10['include']=[{'all':!![]}];}return db[_0xdb57('0x6a')][_0xdb57('0x4a')](_0xa58e10);})[_0xdb57('0x25')](function(_0xbd24cd){_0x3bdeb1[_0xdb57('0x4b')]=_0xbd24cd;return _0x3bdeb1;});}})[_0xdb57('0x25')](respondWithFilteredResult(_0x571eb1,_0xa58e10))[_0xdb57('0x4c')](handleError(_0x571eb1,null));};exports[_0xdb57('0x6b')]=function(_0x53c7d6,_0x6de434,_0x1c0d87){var _0x3dfedb={'raw':!![],'where':{}};var _0x52ddf6={};var _0x30feb1={'count':0x0,'rows':[]};return db[_0xdb57('0x47')][_0xdb57('0x69')]({'where':{'id':_0x53c7d6[_0xdb57('0x4e')]['id']}})[_0xdb57('0x25')](handleEntityNotFound(_0x6de434,null))[_0xdb57('0x25')](function(_0x150b71){if(_0x150b71){_0x52ddf6['model']=_[_0xdb57('0x4f')](db[_0xdb57('0x6c')]['rawAttributes']);_0x52ddf6[_0xdb57('0x3a')]=_[_0xdb57('0x4f')](_0x53c7d6[_0xdb57('0x3a')]);_0x52ddf6[_0xdb57('0x3b')]=_[_0xdb57('0x3c')](_0x52ddf6[_0xdb57('0x39')],_0x52ddf6['query']);_0x3dfedb[_0xdb57('0x3d')]=_[_0xdb57('0x3c')](_0x52ddf6[_0xdb57('0x39')],qs[_0xdb57('0x3e')](_0x53c7d6[_0xdb57('0x3a')][_0xdb57('0x3e')]));_0x3dfedb['attributes']=_0x3dfedb[_0xdb57('0x3d')][_0xdb57('0x3f')]?_0x3dfedb[_0xdb57('0x3d')]:_0x52ddf6[_0xdb57('0x39')];if(!_0x53c7d6['query'][_0xdb57('0x62')](_0xdb57('0x40'))){_0x3dfedb['limit']=qs[_0xdb57('0x41')](_0x53c7d6[_0xdb57('0x3a')]['limit']);_0x3dfedb[_0xdb57('0x1e')]=qs[_0xdb57('0x1e')](_0x53c7d6['query']['offset']);}_0x3dfedb[_0xdb57('0x42')]=qs['sort'](_0x53c7d6[_0xdb57('0x3a')][_0xdb57('0x43')]);_0x3dfedb[_0xdb57('0x44')]=qs[_0xdb57('0x3b')](_[_0xdb57('0x63')](_0x53c7d6[_0xdb57('0x3a')],_0x52ddf6[_0xdb57('0x3b')]));_0x3dfedb[_0xdb57('0x44')][_0xdb57('0x64')]=_0x150b71['id'];if(_0x53c7d6[_0xdb57('0x3a')][_0xdb57('0x2a')]){_0x3dfedb['where']=_[_0xdb57('0x46')](_0x3dfedb[_0xdb57('0x44')],{'$or':_[_0xdb57('0x35')](_0x3dfedb[_0xdb57('0x3d')],function(_0xb166c9){var _0xeef9e7={};_0xeef9e7[_0xb166c9]={'$like':'%'+_0x53c7d6['query']['filter']+'%'};return _0xeef9e7;})});}_0x3dfedb=_[_0xdb57('0x46')]({},_0x3dfedb,_0x53c7d6[_0xdb57('0x50')]);return db['CmHopperBlack'][_0xdb57('0x1d')]({'where':_0x3dfedb[_0xdb57('0x44')]})[_0xdb57('0x25')](function(_0x467fa8){_0x30feb1[_0xdb57('0x1d')]=_0x467fa8;if(_0x53c7d6[_0xdb57('0x3a')]['includeAll']){_0x3dfedb[_0xdb57('0x49')]=[{'all':!![]}];}return db[_0xdb57('0x6c')][_0xdb57('0x4a')](_0x3dfedb);})[_0xdb57('0x25')](function(_0x1547a6){_0x30feb1[_0xdb57('0x4b')]=_0x1547a6;return _0x30feb1;});}})[_0xdb57('0x25')](respondWithFilteredResult(_0x6de434,_0x3dfedb))['catch'](handleError(_0x6de434,null));};exports[_0xdb57('0x6d')]=function(_0x114c70,_0x1780c5,_0x85b895){var _0x17fe36={};var _0x56e1c7={};var _0xa88604;var _0x1a5c14;return db[_0xdb57('0x47')][_0xdb57('0x69')]({'where':{'id':_0x114c70['params']['id']}})['then'](handleEntityNotFound(_0x1780c5,null))['then'](function(_0x2aaa87){if(_0x2aaa87){_0xa88604=_0x2aaa87;_0x56e1c7['model']=_[_0xdb57('0x4f')](db[_0xdb57('0x6e')][_0xdb57('0x36')]);_0x56e1c7['query']=_['keys'](_0x114c70[_0xdb57('0x3a')]);_0x56e1c7[_0xdb57('0x3b')]=_['intersection'](_0x56e1c7[_0xdb57('0x39')],_0x56e1c7[_0xdb57('0x3a')]);_0x17fe36['attributes']=_[_0xdb57('0x3c')](_0x56e1c7['model'],qs[_0xdb57('0x3e')](_0x114c70[_0xdb57('0x3a')]['fields']));_0x17fe36[_0xdb57('0x3d')]=_0x17fe36['attributes'][_0xdb57('0x3f')]?_0x17fe36['attributes']:_0x56e1c7['model'];_0x17fe36[_0xdb57('0x42')]=qs[_0xdb57('0x43')](_0x114c70[_0xdb57('0x3a')]['sort']);_0x17fe36[_0xdb57('0x44')]=qs[_0xdb57('0x3b')](_[_0xdb57('0x63')](_0x114c70[_0xdb57('0x3a')],_0x56e1c7['filters']));if(_0x114c70[_0xdb57('0x3a')][_0xdb57('0x2a')]){_0x17fe36[_0xdb57('0x44')]=_[_0xdb57('0x46')](_0x17fe36['where'],{'$or':_[_0xdb57('0x35')](_0x17fe36[_0xdb57('0x3d')],function(_0x34e895){var _0x554867={};_0x554867[_0x34e895]={'$like':'%'+_0x114c70[_0xdb57('0x3a')][_0xdb57('0x2a')]+'%'};return _0x554867;})});}_0x17fe36=_[_0xdb57('0x46')]({},_0x17fe36,_0x114c70[_0xdb57('0x50')]);return _0xa88604[_0xdb57('0x6d')](_0x17fe36);}})['then'](function(_0x50d4ad){if(_0x50d4ad){_0x1a5c14=_0x50d4ad[_0xdb57('0x3f')];if(!_0x114c70[_0xdb57('0x3a')][_0xdb57('0x62')]('nolimit')){_0x17fe36[_0xdb57('0x41')]=qs[_0xdb57('0x41')](_0x114c70[_0xdb57('0x3a')][_0xdb57('0x41')]);_0x17fe36[_0xdb57('0x1e')]=qs[_0xdb57('0x1e')](_0x114c70[_0xdb57('0x3a')][_0xdb57('0x1e')]);}return _0xa88604['getTeams'](_0x17fe36);}})['then'](function(_0x8d8567){if(_0x8d8567){return _0x8d8567?{'count':_0x1a5c14,'rows':_0x8d8567}:null;}})['then'](respondWithResult(_0x1780c5,null))[_0xdb57('0x4c')](handleError(_0x1780c5,null));};exports[_0xdb57('0x6f')]=function(_0x4b6e67,_0x5e86bf,_0x381a7e){var _0x59e676=_0x4b6e67[_0xdb57('0x52')][_0xdb57('0x70')];var _0x12c082=_['map'](_0x59e676,'id');return db[_0xdb57('0x6e')]['findAll']({'where':{'id':_0x12c082},'attributes':['id'],'include':[{'model':db[_0xdb57('0x71')],'as':_0xdb57('0x72'),'attributes':['id',_0xdb57('0x33'),_0xdb57('0x73'),_0xdb57('0x74'),'interface'],'raw':!![]}]})['then'](function(_0x567ce8){if(_0x567ce8){var _0x22a821=_[_0xdb57('0x75')](_0x567ce8,function(_0x1f8f96){var _0x31a968=_0x1f8f96[_0xdb57('0x54')]({'plain':!![]});_0x31a968['Agents'][_0xdb57('0x76')](function(_0x1cb837){_0x1cb837[_0xdb57('0x77')]=_[_0xdb57('0x2f')](_0x59e676,{'id':_0x31a968['id']})[_0xdb57('0x77')];});return _0x31a968['Agents'];});return db[_0xdb57('0x47')][_0xdb57('0x2f')]({'where':{'id':_0x4b6e67[_0xdb57('0x4e')]['id']}})[_0xdb57('0x25')](function(_0x65c160){return db[_0xdb57('0x78')][_0xdb57('0x79')](function(_0x36c821){return _0x65c160[_0xdb57('0x6f')](_0x12c082,{'transaction':_0x36c821})['then'](function(){return BPromise[_0xdb57('0x7a')](_0x22a821,function(_0x52ab76){return db[_0xdb57('0x7b')]['findOrCreate']({'where':{'UserId':_0x52ab76['id'],'VoiceQueueId':_0x4b6e67[_0xdb57('0x4e')]['id']},'defaults':{'penalty':_0x52ab76[_0xdb57('0x77')]},'transaction':_0x36c821});});})[_0xdb57('0x25')](function(){return BPromise['each'](_['filter'](_0x22a821,{'online':!![]}),function(_0x7d5fc3){return db[_0xdb57('0x7c')][_0xdb57('0x7d')]({'membername':_0x7d5fc3[_0xdb57('0x33')],'UserId':_0x7d5fc3['id'],'queue_name':_0x65c160['name'],'VoiceQueueId':_0x65c160['id'],'interface':_[_0xdb57('0x7e')](_0x7d5fc3[_0xdb57('0x7f')])?util['format']('SIP/%s',_0x7d5fc3[_0xdb57('0x33')]):_0x7d5fc3['interface'],'paused':_0x7d5fc3[_0xdb57('0x74')]||![],'penalty':_0x7d5fc3[_0xdb57('0x77')]},{'transaction':_0x36c821});});})[_0xdb57('0x25')](function(){_0x22a821[_0xdb57('0x76')](function(_0x1cae78){socket[_0xdb57('0x80')](_0xdb57('0x81'),{'UserId':_0x1cae78['id'],'VoiceQueueId':_0x65c160['id']});});});});});}})[_0xdb57('0x25')](respondWithStatusCode(_0x5e86bf,null))['catch'](handleError(_0x5e86bf,null));};exports[_0xdb57('0x82')]=function(_0x58e98b,_0x19d03f,_0x24b0be){return db[_0xdb57('0x6e')][_0xdb57('0x4a')]({'where':{'id':_0x58e98b['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xdb57('0x71')],'as':_0xdb57('0x72'),'attributes':['id'],'raw':!![]}]})[_0xdb57('0x25')](handleEntityNotFound(_0x19d03f,null))[_0xdb57('0x25')](function(_0x1aaf8e){var _0x57fa9b=_[_0xdb57('0x35')](_0x1aaf8e,'id');var _0x79b3f3=[];var _0x43ee03=[];var _0x370fb5=squel[_0xdb57('0x83')]();_0x370fb5[_0xdb57('0x84')]('tq.TeamId')[_0xdb57('0x85')](_0xdb57('0x86'),'tq')[_0xdb57('0x87')](_0xdb57('0x88'),'ut',_0xdb57('0x89'))[_0xdb57('0x44')]('VoiceQueueId\x20=\x20?',_0x58e98b[_0xdb57('0x4e')]['id']);for(var _0x3c5e11=0x0;_0x3c5e11<_0x1aaf8e[_0xdb57('0x3f')];_0x3c5e11+=0x1){let _0x357efa=_0x1aaf8e[_0x3c5e11];for(var _0x3ea039=0x0;_0x3ea039<_0x357efa[_0xdb57('0x72')][_0xdb57('0x3f')];_0x3ea039+=0x1){let _0x217a35=_0x357efa[_0xdb57('0x72')][_0x3ea039];var _0x2f79e8=_0x370fb5[_0xdb57('0x5a')]();_0x2f79e8[_0xdb57('0x44')](_0xdb57('0x8a'),_0x217a35['id']);_0x43ee03[_0xdb57('0x8b')](db[_0xdb57('0x78')][_0xdb57('0x3a')](_0x2f79e8[_0xdb57('0x8c')](),{'type':db['sequelize']['QueryTypes'][_0xdb57('0x8d')]})[_0xdb57('0x25')](function(_0x146cea){if(_0x146cea[_0xdb57('0x3f')]===0x1){return _0x217a35['id'];}else{var _0x4e5e5e=_[_0xdb57('0x8e')](_[_0xdb57('0x35')](_0x146cea,_0xdb57('0x8f')),function(_0x3187fd){return _[_0xdb57('0x2d')](_0x57fa9b,_0x3187fd);});if(_0x4e5e5e){return _0x217a35['id'];}}}));}}return BPromise['all'](_0x43ee03)['then'](function(_0x5e3295){_0x79b3f3=_(_0x79b3f3)[_0xdb57('0x90')](_0x5e3295)[_0xdb57('0x91')]()[_0xdb57('0x2c')]();return db['VoiceQueue'][_0xdb57('0x2f')]({'where':{'id':_0x58e98b[_0xdb57('0x4e')]['id']}})[_0xdb57('0x25')](function(_0x467492){return db[_0xdb57('0x78')]['transaction'](function(_0x2164a3){return _0x467492[_0xdb57('0x82')](_0x58e98b[_0xdb57('0x3a')]['ids'],{'transaction':_0x2164a3})[_0xdb57('0x25')](function(){if(!_['isEmpty'](_0x79b3f3)){return _0x467492[_0xdb57('0x92')](_0x79b3f3,{'transaction':_0x2164a3})[_0xdb57('0x25')](function(){return db[_0xdb57('0x7c')][_0xdb57('0x26')]({'where':{'VoiceQueueId':_0x58e98b[_0xdb57('0x4e')]['id'],'UserId':_0x79b3f3},'transaction':_0x2164a3});});}})[_0xdb57('0x25')](function(){_0x79b3f3[_0xdb57('0x76')](function(_0x8ddbf4){socket[_0xdb57('0x80')](_0xdb57('0x93'),{'UserId':_0x8ddbf4,'VoiceQueueId':_0x467492['id']});});});});});});})[_0xdb57('0x25')](respondWithStatusCode(_0x19d03f,null))[_0xdb57('0x4c')](handleError(_0x19d03f,null));};exports[_0xdb57('0x94')]=function(_0x9dcdba,_0x38bf06,_0xb8855){var _0x55cad4,_0x259581;return db[_0xdb57('0x47')][_0xdb57('0x2f')]({'where':{'id':_0x9dcdba[_0xdb57('0x4e')]['id']}})[_0xdb57('0x25')](handleEntityNotFound(_0x38bf06,null))[_0xdb57('0x25')](function(_0x43d84d){if(_0x43d84d){_0x259581=_0x43d84d;return _0x43d84d['addAgents'](_0x9dcdba[_0xdb57('0x52')][_0xdb57('0x95')],_[_0xdb57('0x5b')](_0x9dcdba[_0xdb57('0x52')],[_0xdb57('0x95'),'id'])||{})[_0xdb57('0x96')](function(_0x2f1e07){for(var _0x4a3215=0x0;_0x4a3215<_0x9dcdba[_0xdb57('0x52')][_0xdb57('0x95')][_0xdb57('0x3f')];_0x4a3215+=0x1){socket['emit'](_0xdb57('0x81'),{'UserId':_0x9dcdba[_0xdb57('0x52')]['ids'][_0x4a3215],'VoiceQueueId':_0x9dcdba[_0xdb57('0x4e')]['id']});}return _0x2f1e07;});}})[_0xdb57('0x25')](function(_0x3a5438){_0x55cad4=_0x3a5438||[];if(_0x259581){return db[_0xdb57('0x71')][_0xdb57('0x4a')]({'where':{'id':_0x9dcdba['body'][_0xdb57('0x95')]},'attributes':['id',_0xdb57('0x33'),_0xdb57('0x73'),_0xdb57('0x74'),_0xdb57('0x7f')],'raw':!![]});}})[_0xdb57('0x25')](function(_0x4c0682){if(!_[_0xdb57('0x97')](_0x4c0682)){var _0x9d5a38=[];for(var _0x46156f=0x0;_0x46156f<_0x4c0682['length'];_0x46156f++){if(_0x4c0682[_0x46156f][_0xdb57('0x73')]){_0x9d5a38[_0xdb57('0x8b')](db[_0xdb57('0x7c')][_0xdb57('0x7d')]({'membername':_0x4c0682[_0x46156f][_0xdb57('0x33')],'UserId':_0x4c0682[_0x46156f]['id'],'queue_name':_0x259581['name'],'VoiceQueueId':_0x259581['id'],'interface':_[_0xdb57('0x7e')](_0x4c0682[_0x46156f]['interface'])?util[_0xdb57('0x98')](_0xdb57('0x99'),_0x4c0682[_0x46156f]['name']):_0x4c0682[_0x46156f][_0xdb57('0x7f')],'paused':_0x4c0682[_0x46156f]['voicePause']||![],'penalty':_0x9dcdba[_0xdb57('0x52')][_0xdb57('0x77')]||0x0}));}}return BPromise['all'](_0x9d5a38);}})[_0xdb57('0x25')](function(){return _0x55cad4;})[_0xdb57('0x25')](respondWithResult(_0x38bf06,null))[_0xdb57('0x4c')](handleError(_0x38bf06,null));};exports[_0xdb57('0x92')]=function(_0x5023f9,_0x479ea7,_0x3c0ec1){return db[_0xdb57('0x47')][_0xdb57('0x2f')]({'where':{'id':_0x5023f9[_0xdb57('0x4e')]['id']}})[_0xdb57('0x25')](handleEntityNotFound(_0x479ea7,null))['then'](function(_0x591ddc){if(_0x591ddc){return _0x591ddc[_0xdb57('0x92')](_0x5023f9[_0xdb57('0x3a')][_0xdb57('0x95')])[_0xdb57('0x25')](function(){if(_['isArray'](_0x5023f9[_0xdb57('0x3a')]['ids'])){for(var _0x3286d5=0x0;_0x3286d5<_0x5023f9[_0xdb57('0x3a')][_0xdb57('0x95')][_0xdb57('0x3f')];_0x3286d5+=0x1){socket[_0xdb57('0x80')](_0xdb57('0x93'),{'UserId':Number(_0x5023f9[_0xdb57('0x3a')][_0xdb57('0x95')][_0x3286d5]),'VoiceQueueId':Number(_0x5023f9[_0xdb57('0x4e')]['id'])});}}else{socket[_0xdb57('0x80')](_0xdb57('0x93'),{'UserId':Number(_0x5023f9[_0xdb57('0x3a')][_0xdb57('0x95')]),'VoiceQueueId':Number(_0x5023f9['params']['id'])});}});}})[_0xdb57('0x25')](function(_0x2c7667){return db[_0xdb57('0x7c')][_0xdb57('0x26')]({'where':{'VoiceQueueId':_0x5023f9[_0xdb57('0x4e')]['id'],'UserId':_0x5023f9[_0xdb57('0x3a')][_0xdb57('0x95')]}})[_0xdb57('0x25')](function(){return _0x2c7667;});})[_0xdb57('0x25')](respondWithStatusCode(_0x479ea7,null))[_0xdb57('0x4c')](handleError(_0x479ea7,null));};exports['getAgents']=function(_0x1b07d8,_0x5aa073,_0xf9960f){var _0x3fdc05={};var _0x3d647b={};var _0x281839;var _0x2d0c1f;return db[_0xdb57('0x47')]['findOne']({'where':{'id':_0x1b07d8[_0xdb57('0x4e')]['id']}})[_0xdb57('0x25')](handleEntityNotFound(_0x5aa073,null))[_0xdb57('0x25')](function(_0x53c3c9){if(_0x53c3c9){_0x281839=_0x53c3c9;_0x3d647b[_0xdb57('0x39')]=_[_0xdb57('0x4f')](db[_0xdb57('0x71')][_0xdb57('0x36')]);_0x3d647b[_0xdb57('0x3a')]=_[_0xdb57('0x4f')](_0x1b07d8[_0xdb57('0x3a')]);_0x3d647b[_0xdb57('0x3b')]=_[_0xdb57('0x3c')](_0x3d647b[_0xdb57('0x39')],_0x3d647b[_0xdb57('0x3a')]);_0x3fdc05['attributes']=_[_0xdb57('0x3c')](_0x3d647b[_0xdb57('0x39')],qs[_0xdb57('0x3e')](_0x1b07d8['query'][_0xdb57('0x3e')]));_0x3fdc05[_0xdb57('0x3d')]=_0x3fdc05['attributes'][_0xdb57('0x3f')]?_0x3fdc05[_0xdb57('0x3d')]:_0x3d647b['model'];_0x3fdc05['order']=qs[_0xdb57('0x43')](_0x1b07d8[_0xdb57('0x3a')][_0xdb57('0x43')]);_0x3fdc05[_0xdb57('0x44')]=qs['filters'](_[_0xdb57('0x63')](_0x1b07d8['query'],_0x3d647b[_0xdb57('0x3b')]));if(_0x1b07d8[_0xdb57('0x3a')]['filter']){_0x3fdc05['where']=_[_0xdb57('0x46')](_0x3fdc05[_0xdb57('0x44')],{'$or':_[_0xdb57('0x35')](_0x3fdc05[_0xdb57('0x3d')],function(_0x16b0ab){var _0x2647eb={};_0x2647eb[_0x16b0ab]={'$like':'%'+_0x1b07d8['query'][_0xdb57('0x2a')]+'%'};return _0x2647eb;})});}_0x3fdc05=_['merge']({},_0x3fdc05,_0x1b07d8[_0xdb57('0x50')]);return _0x281839['getAgents'](_0x3fdc05);}})[_0xdb57('0x25')](function(_0xf284b2){if(_0xf284b2){_0x2d0c1f=_0xf284b2[_0xdb57('0x3f')];if(!_0x1b07d8[_0xdb57('0x3a')][_0xdb57('0x62')](_0xdb57('0x40'))){_0x3fdc05['limit']=qs[_0xdb57('0x41')](_0x1b07d8[_0xdb57('0x3a')][_0xdb57('0x41')]);_0x3fdc05[_0xdb57('0x1e')]=qs[_0xdb57('0x1e')](_0x1b07d8['query'][_0xdb57('0x1e')]);}return _0x281839[_0xdb57('0x9a')](_0x3fdc05);}})['then'](function(_0x7adbb0){if(_0x7adbb0){return _0x7adbb0?{'count':_0x2d0c1f,'rows':_0x7adbb0}:null;}})[_0xdb57('0x25')](respondWithResult(_0x5aa073,null))[_0xdb57('0x4c')](handleError(_0x5aa073,null));};exports[_0xdb57('0x9b')]=function(_0x5a6524,_0x2ce12f,_0x17fc2c){var _0x122ab5={};var _0x55222a={};var _0x42a946;var _0x477eb3;return db[_0xdb57('0x47')][_0xdb57('0x69')]({'where':{'id':_0x5a6524[_0xdb57('0x4e')]['id']}})[_0xdb57('0x25')](handleEntityNotFound(_0x2ce12f,null))[_0xdb57('0x25')](function(_0x3d37df){if(_0x3d37df){_0x42a946=_0x3d37df;_0x55222a[_0xdb57('0x39')]=_[_0xdb57('0x4f')](db[_0xdb57('0x7c')][_0xdb57('0x36')]);_0x55222a['query']=_[_0xdb57('0x4f')](_0x5a6524[_0xdb57('0x3a')]);_0x55222a['filters']=_[_0xdb57('0x3c')](_0x55222a['model'],_0x55222a[_0xdb57('0x3a')]);_0x122ab5[_0xdb57('0x3d')]=_[_0xdb57('0x3c')](_0x55222a[_0xdb57('0x39')],qs['fields'](_0x5a6524['query'][_0xdb57('0x3e')]));_0x122ab5[_0xdb57('0x3d')]=_0x122ab5[_0xdb57('0x3d')][_0xdb57('0x3f')]?_0x122ab5[_0xdb57('0x3d')]:_0x55222a[_0xdb57('0x39')];_0x122ab5[_0xdb57('0x42')]=qs[_0xdb57('0x43')](_0x5a6524[_0xdb57('0x3a')][_0xdb57('0x43')]);_0x122ab5[_0xdb57('0x44')]=qs['filters'](_[_0xdb57('0x63')](_0x5a6524[_0xdb57('0x3a')],_0x55222a[_0xdb57('0x3b')]));if(_0x5a6524['query'][_0xdb57('0x2a')]){_0x122ab5[_0xdb57('0x44')]=_[_0xdb57('0x46')](_0x122ab5[_0xdb57('0x44')],{'$or':_['map'](_0x122ab5['attributes'],function(_0x40babe){var _0x174a1c={};_0x174a1c[_0x40babe]={'$like':'%'+_0x5a6524[_0xdb57('0x3a')][_0xdb57('0x2a')]+'%'};return _0x174a1c;})});}_0x122ab5=_[_0xdb57('0x46')]({},_0x122ab5,_0x5a6524[_0xdb57('0x50')]);return _0x42a946[_0xdb57('0x9b')](_0x122ab5);}})[_0xdb57('0x25')](function(_0x459048){if(_0x459048){_0x477eb3=_0x459048['length'];if(!_0x5a6524['query']['hasOwnProperty'](_0xdb57('0x40'))){_0x122ab5[_0xdb57('0x41')]=qs[_0xdb57('0x41')](_0x5a6524['query'][_0xdb57('0x41')]);_0x122ab5[_0xdb57('0x1e')]=qs[_0xdb57('0x1e')](_0x5a6524['query'][_0xdb57('0x1e')]);}return _0x42a946[_0xdb57('0x9b')](_0x122ab5);}})['then'](function(_0x3c8938){return _0x3c8938?{'count':_0x477eb3,'rows':_0x3c8938}:null;})[_0xdb57('0x25')](respondWithResult(_0x2ce12f,null))[_0xdb57('0x4c')](handleError(_0x2ce12f,null));};exports['getLists']=function(_0x4a6e9f,_0x19f041,_0x3b543b){var _0x248b67={};var _0x1dc152={};var _0x4fcb4d;var _0x1032a6;return db[_0xdb57('0x47')]['findOne']({'where':{'id':_0x4a6e9f[_0xdb57('0x4e')]['id']}})[_0xdb57('0x25')](handleEntityNotFound(_0x19f041,null))[_0xdb57('0x25')](function(_0x27e069){if(_0x27e069){_0x4fcb4d=_0x27e069;_0x1dc152[_0xdb57('0x39')]=_['keys'](db[_0xdb57('0x9c')][_0xdb57('0x36')]);_0x1dc152['query']=_[_0xdb57('0x4f')](_0x4a6e9f['query']);_0x1dc152['filters']=_[_0xdb57('0x3c')](_0x1dc152[_0xdb57('0x39')],_0x1dc152[_0xdb57('0x3a')]);_0x248b67[_0xdb57('0x3d')]=_[_0xdb57('0x3c')](_0x1dc152[_0xdb57('0x39')],qs[_0xdb57('0x3e')](_0x4a6e9f[_0xdb57('0x3a')]['fields']));_0x248b67['attributes']=_0x248b67[_0xdb57('0x3d')]['length']?_0x248b67[_0xdb57('0x3d')]:_0x1dc152['model'];_0x248b67[_0xdb57('0x42')]=qs[_0xdb57('0x43')](_0x4a6e9f['query'][_0xdb57('0x43')]);_0x248b67[_0xdb57('0x44')]=qs[_0xdb57('0x3b')](_['pick'](_0x4a6e9f['query'],_0x1dc152['filters']));if(_0x4a6e9f[_0xdb57('0x3a')][_0xdb57('0x2a')]){_0x248b67['where']=_[_0xdb57('0x46')](_0x248b67[_0xdb57('0x44')],{'$or':_[_0xdb57('0x35')](_0x248b67[_0xdb57('0x3d')],function(_0x4f63ad){var _0x65a07c={};_0x65a07c[_0x4f63ad]={'$like':'%'+_0x4a6e9f[_0xdb57('0x3a')][_0xdb57('0x2a')]+'%'};return _0x65a07c;})});}_0x248b67=_[_0xdb57('0x46')]({},_0x248b67,_0x4a6e9f['options']);return _0x4fcb4d[_0xdb57('0x9d')](_0x248b67);}})[_0xdb57('0x25')](function(_0x59781d){if(_0x59781d){_0x1032a6=_0x59781d['length'];if(!_0x4a6e9f['query']['hasOwnProperty'](_0xdb57('0x40'))){_0x248b67[_0xdb57('0x41')]=qs[_0xdb57('0x41')](_0x4a6e9f['query'][_0xdb57('0x41')]);_0x248b67[_0xdb57('0x1e')]=qs['offset'](_0x4a6e9f['query']['offset']);}return _0x4fcb4d[_0xdb57('0x9d')](_0x248b67);}})[_0xdb57('0x25')](function(_0x22b20e){if(_0x22b20e){return _0x22b20e?{'count':_0x1032a6,'rows':_0x22b20e}:null;}})['then'](respondWithResult(_0x19f041,null))[_0xdb57('0x4c')](handleError(_0x19f041,null));};exports[_0xdb57('0x9e')]=function(_0xc882f4,_0xb915b2,_0x5e28ac){var _0x5cde90,_0xe3b259;return db['VoiceQueue'][_0xdb57('0x2f')]({'where':{'id':_0xc882f4['params']['id']}})[_0xdb57('0x25')](handleEntityNotFound(_0xb915b2,null))[_0xdb57('0x25')](function(_0x510ecc){if(_0x510ecc){_0xe3b259=_0x510ecc;return _0x510ecc[_0xdb57('0x9e')](_0xc882f4[_0xdb57('0x52')][_0xdb57('0x95')],_['omit'](_0xc882f4[_0xdb57('0x52')],[_0xdb57('0x95'),'id'])||{});}return null;})[_0xdb57('0x96')](function(_0x2fcc52){var _0x33b483;_0x5cde90=_0x2fcc52||[];var _0x143e00=[];if(_0x2fcc52){for(var _0x188dc0=0x0;_0x188dc0<_0x2fcc52[_0xdb57('0x3f')];_0x188dc0+=0x1){var _0x205e1f=_0x2fcc52[_0x188dc0][_0xdb57('0x54')]({'plain':!![]});_0xe3b259['dialCheckDuplicateType']=_0xc882f4[_0xdb57('0x52')][_0xdb57('0x9f')]?_0xc882f4['body']['dialCheckDuplicateType']:_0xe3b259['dialCheckDuplicateType'];switch(_0xe3b259['dialCheckDuplicateType']){case _0xdb57('0xa0'):_0x33b483=squel['insert']()[_0xdb57('0xa1')](_0xdb57('0xa2'))[_0xdb57('0xa3')](['phone',_0xdb57('0xa4'),_0xdb57('0xa5'),_0xdb57('0xa6'),_0xdb57('0x64'),_0xdb57('0x5c'),_0xdb57('0x5d')],squel[_0xdb57('0x83')]()[_0xdb57('0x84')]('phone','phone')['field'](_0xdb57('0xa7'),_0xdb57('0xa4'))[_0xdb57('0x84')]('id',_0xdb57('0xa5'))[_0xdb57('0x84')](_0x205e1f[_0xdb57('0xa8')]['toString'](),_0xdb57('0xa6'))['field'](_0xc882f4['params']['id'][_0xdb57('0x8c')](),_0xdb57('0x64'))[_0xdb57('0x84')]('NOW()','createdAt')[_0xdb57('0x84')](_0xdb57('0xa7'),'updatedAt')[_0xdb57('0x85')](_0xdb57('0xa9'))[_0xdb57('0x44')](_0xdb57('0xaa'))['where']('ListId\x20=\x20?',_0x205e1f['CmListId'][_0xdb57('0x8c')]())['where'](_0xdb57('0xab'))[_0xdb57('0x44')](_0xdb57('0xac'),squel[_0xdb57('0x83')]()[_0xdb57('0x84')](_0xdb57('0xad'))[_0xdb57('0x85')](_0xdb57('0xae'))[_0xdb57('0x44')](_0xdb57('0xaf'),_0xc882f4[_0xdb57('0x4e')]['id']['toString']()))[_0xdb57('0x44')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xdb57('0x84')](_0xdb57('0xb0'))['from'](_0xdb57('0xa2'))[_0xdb57('0x44')](_0xdb57('0xaf'),_0xc882f4[_0xdb57('0x4e')]['id'][_0xdb57('0x8c')]())))[_0xdb57('0x8c')]();break;case _0xdb57('0xb1'):_0x33b483=squel[_0xdb57('0xb2')]()[_0xdb57('0xa1')](_0xdb57('0xa2'))[_0xdb57('0xa3')](['phone',_0xdb57('0xa4'),_0xdb57('0xa5'),_0xdb57('0xa6'),'VoiceQueueId',_0xdb57('0x5c'),_0xdb57('0x5d')],squel[_0xdb57('0x83')]()[_0xdb57('0x84')](_0xdb57('0xb3'),'phone')['field'](_0xdb57('0xa7'),_0xdb57('0xa4'))[_0xdb57('0x84')]('id',_0xdb57('0xa5'))['field'](_0x205e1f[_0xdb57('0xa8')][_0xdb57('0x8c')](),_0xdb57('0xa6'))[_0xdb57('0x84')](_0xc882f4[_0xdb57('0x4e')]['id'][_0xdb57('0x8c')](),_0xdb57('0x64'))[_0xdb57('0x84')]('NOW()',_0xdb57('0x5c'))[_0xdb57('0x84')](_0xdb57('0xa7'),_0xdb57('0x5d'))[_0xdb57('0x85')](_0xdb57('0xa9'))['where'](_0xdb57('0xaa'))[_0xdb57('0x44')]('ListId\x20=\x20?',_0x205e1f[_0xdb57('0xa8')]['toString']())[_0xdb57('0x44')]('phone\x20IS\x20NOT\x20NULL')[_0xdb57('0x44')](_0xdb57('0xac'),squel[_0xdb57('0x83')]()[_0xdb57('0x84')](_0xdb57('0xb0'))['from'](_0xdb57('0xa2'))[_0xdb57('0x44')](_0xdb57('0xaf'),_0xc882f4[_0xdb57('0x4e')]['id'][_0xdb57('0x8c')]())))[_0xdb57('0x8c')]();break;default:_0x33b483=squel['insert']()[_0xdb57('0xa1')](_0xdb57('0xa2'))[_0xdb57('0xa3')](['phone',_0xdb57('0xa4'),'ContactId','ListId',_0xdb57('0x64'),_0xdb57('0x5c'),_0xdb57('0x5d')],squel['select']()[_0xdb57('0x84')](_0xdb57('0xb3'),'phone')['field'](_0xdb57('0xa7'),_0xdb57('0xa4'))['field']('id','ContactId')[_0xdb57('0x84')](_0x205e1f[_0xdb57('0xa8')][_0xdb57('0x8c')](),_0xdb57('0xa6'))[_0xdb57('0x84')](_0xc882f4[_0xdb57('0x4e')]['id'][_0xdb57('0x8c')](),_0xdb57('0x64'))[_0xdb57('0x84')]('NOW()',_0xdb57('0x5c'))[_0xdb57('0x84')]('NOW()',_0xdb57('0x5d'))[_0xdb57('0x85')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0xdb57('0x44')](_0xdb57('0xb4'),_0x205e1f[_0xdb57('0xa8')][_0xdb57('0x8c')]())['where'](_0xdb57('0xab')))[_0xdb57('0x8c')]();}_0x143e00[_0xdb57('0x8b')](db[_0xdb57('0x78')]['query'](_0x33b483));}return BPromise[_0xdb57('0xb5')](_0x143e00);}})[_0xdb57('0x25')](function(){return _0x5cde90;})[_0xdb57('0x25')](respondWithResult(_0xb915b2,null))[_0xdb57('0x4c')](handleError(_0xb915b2,null));};exports[_0xdb57('0xb6')]=function(_0xa5449c,_0x4ba207,_0x18fe53){return db[_0xdb57('0x47')][_0xdb57('0x2f')]({'where':{'id':_0xa5449c[_0xdb57('0x4e')]['id']}})[_0xdb57('0x25')](handleEntityNotFound(_0x4ba207,null))[_0xdb57('0x25')](function(_0x32a8a2){if(_0x32a8a2){return _0x32a8a2[_0xdb57('0xb6')](_0xa5449c[_0xdb57('0x3a')][_0xdb57('0x95')]);}})['then'](function(_0x3e97b5){if(_0x3e97b5){return db[_0xdb57('0x65')][_0xdb57('0x26')]({'where':{'ListId':_0xa5449c[_0xdb57('0x3a')][_0xdb57('0x95')],'VoiceQueueId':_0xa5449c['params']['id']}})[_0xdb57('0x25')](function(){return _0x3e97b5;});}})[_0xdb57('0x25')](respondWithStatusCode(_0x4ba207,null))['catch'](handleError(_0x4ba207,null));};exports['getBlackLists']=function(_0x4902d1,_0xb9037f,_0x42dcdd){var _0x400038={};var _0x416a81={};var _0x52905f;var _0x163957;return db[_0xdb57('0x47')][_0xdb57('0x69')]({'where':{'id':_0x4902d1[_0xdb57('0x4e')]['id']}})[_0xdb57('0x25')](handleEntityNotFound(_0xb9037f,null))['then'](function(_0x1e6534){if(_0x1e6534){_0x52905f=_0x1e6534;_0x416a81[_0xdb57('0x39')]=_[_0xdb57('0x4f')](db[_0xdb57('0x9c')][_0xdb57('0x36')]);_0x416a81['query']=_[_0xdb57('0x4f')](_0x4902d1['query']);_0x416a81['filters']=_[_0xdb57('0x3c')](_0x416a81[_0xdb57('0x39')],_0x416a81[_0xdb57('0x3a')]);_0x400038[_0xdb57('0x3d')]=_[_0xdb57('0x3c')](_0x416a81[_0xdb57('0x39')],qs[_0xdb57('0x3e')](_0x4902d1['query'][_0xdb57('0x3e')]));_0x400038[_0xdb57('0x3d')]=_0x400038[_0xdb57('0x3d')]['length']?_0x400038[_0xdb57('0x3d')]:_0x416a81[_0xdb57('0x39')];_0x400038[_0xdb57('0x42')]=qs[_0xdb57('0x43')](_0x4902d1[_0xdb57('0x3a')][_0xdb57('0x43')]);_0x400038[_0xdb57('0x44')]=qs['filters'](_[_0xdb57('0x63')](_0x4902d1[_0xdb57('0x3a')],_0x416a81[_0xdb57('0x3b')]));if(_0x4902d1['query'][_0xdb57('0x2a')]){_0x400038['where']=_[_0xdb57('0x46')](_0x400038[_0xdb57('0x44')],{'$or':_['map'](_0x400038['attributes'],function(_0x335eb1){var _0x575539={};_0x575539[_0x335eb1]={'$like':'%'+_0x4902d1['query'][_0xdb57('0x2a')]+'%'};return _0x575539;})});}_0x400038=_[_0xdb57('0x46')]({},_0x400038,_0x4902d1['options']);return _0x52905f[_0xdb57('0xb7')](_0x400038);}})[_0xdb57('0x25')](function(_0x208ba0){if(_0x208ba0){_0x163957=_0x208ba0[_0xdb57('0x3f')];if(!_0x4902d1[_0xdb57('0x3a')][_0xdb57('0x62')](_0xdb57('0x40'))){_0x400038['limit']=qs[_0xdb57('0x41')](_0x4902d1['query'][_0xdb57('0x41')]);_0x400038['offset']=qs[_0xdb57('0x1e')](_0x4902d1['query'][_0xdb57('0x1e')]);}return _0x52905f[_0xdb57('0xb7')](_0x400038);}})[_0xdb57('0x25')](function(_0xc188c0){if(_0xc188c0){return _0xc188c0?{'count':_0x163957,'rows':_0xc188c0}:null;}})[_0xdb57('0x25')](respondWithResult(_0xb9037f,null))['catch'](handleError(_0xb9037f,null));};exports[_0xdb57('0xb8')]=function(_0x7a6ff6,_0x1e4fff,_0x409ada){var _0x335714,_0x401552;return db[_0xdb57('0x47')]['find']({'where':{'id':_0x7a6ff6['params']['id']}})[_0xdb57('0x25')](handleEntityNotFound(_0x1e4fff,null))[_0xdb57('0x25')](function(_0xd27940){if(_0xd27940){_0x401552=_0xd27940;return _0xd27940['addBlackLists'](_0x7a6ff6[_0xdb57('0x52')][_0xdb57('0x95')],_[_0xdb57('0x5b')](_0x7a6ff6['body'],[_0xdb57('0x95'),'id'])||{});}return null;})['spread'](function(_0x1d728e){var _0x17bc98;_0x335714=_0x1d728e||[];var _0x476325=[];if(_0x1d728e){for(var _0x48449b=0x0;_0x48449b<_0x1d728e['length'];_0x48449b+=0x1){var _0x5100af=_0x1d728e[_0x48449b][_0xdb57('0x54')]({'plain':!![]});_0x17bc98=squel[_0xdb57('0xb2')]()[_0xdb57('0xa1')](_0xdb57('0xb9'))['fromQuery']([_0xdb57('0xb3'),'ContactId',_0xdb57('0xa6'),_0xdb57('0x64'),_0xdb57('0x5c'),_0xdb57('0x5d')],squel[_0xdb57('0x83')]()[_0xdb57('0x84')](_0xdb57('0xb3'),_0xdb57('0xb3'))[_0xdb57('0x84')]('id',_0xdb57('0xa5'))['field'](_0x5100af[_0xdb57('0xa8')][_0xdb57('0x8c')](),_0xdb57('0xa6'))[_0xdb57('0x84')](_0x7a6ff6['params']['id'][_0xdb57('0x8c')](),'VoiceQueueId')[_0xdb57('0x84')](_0xdb57('0xa7'),_0xdb57('0x5c'))[_0xdb57('0x84')](_0xdb57('0xa7'),_0xdb57('0x5d'))[_0xdb57('0x85')](_0xdb57('0xa9'))[_0xdb57('0x44')]('deletedAt\x20IS\x20NULL')[_0xdb57('0x44')](_0xdb57('0xb4'),_0x5100af[_0xdb57('0xa8')]['toString']())[_0xdb57('0x44')](_0xdb57('0xab')))[_0xdb57('0x8c')]();_0x476325[_0xdb57('0x8b')](db[_0xdb57('0x78')]['query'](_0x17bc98));}return BPromise[_0xdb57('0xb5')](_0x476325);}})['then'](function(){return _0x335714;})[_0xdb57('0x25')](respondWithResult(_0x1e4fff,null))[_0xdb57('0x4c')](handleError(_0x1e4fff,null));};exports[_0xdb57('0xba')]=function(_0x6b49b1,_0x301fc0,_0x319093){return db['VoiceQueue'][_0xdb57('0x2f')]({'where':{'id':_0x6b49b1[_0xdb57('0x4e')]['id']}})[_0xdb57('0x25')](handleEntityNotFound(_0x301fc0,null))[_0xdb57('0x25')](function(_0x3bb495){if(_0x3bb495){return _0x3bb495[_0xdb57('0xba')](_0x6b49b1['query']['ids']);}})[_0xdb57('0x25')](function(_0x1cb562){if(_0x1cb562){return db[_0xdb57('0x6c')][_0xdb57('0x26')]({'where':{'ListId':_0x6b49b1[_0xdb57('0x3a')][_0xdb57('0x95')],'VoiceQueueId':_0x6b49b1[_0xdb57('0x4e')]['id']}})[_0xdb57('0x25')](function(){return _0x1cb562;});}})['then'](respondWithStatusCode(_0x301fc0,null))[_0xdb57('0x4c')](handleError(_0x301fc0,null));}; \ No newline at end of file +var _0x0a4b=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','options','VoiceQueue','includeAll','rows','catch','show','params','length','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','keys','updatedAt','body','omit','createdAt','autoAssociation','destroy','pick','VoiceQueueId','CmHopper','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','findAll','CmHopperBlack','getTeams','Team','teams','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','addTeams','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','format','userVoiceQueue:save','ids','select','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','removeTeams','isEmpty','emit','addAgents','spread','isNil','isArray','userVoiceQueue:remove','getAgents','getMembers','CmList','getLists','addLists','dialCheckDuplicateType','always','insert','cm_hopper','ContactId','ListId','field','phone','scheduledAt','CmListId','NOW()','cm_contacts','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','into','fromQuery','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x2e25e6,_0x5f51f5){var _0x2d0000=function(_0x316109){while(--_0x316109){_0x2e25e6['push'](_0x2e25e6['shift']());}};_0x2d0000(++_0x5f51f5);}(_0x0a4b,0x168));var _0xb0a4=function(_0x2e70ad,_0x44b3de){_0x2e70ad=_0x2e70ad-0x0;var _0x39f6e0=_0x0a4b[_0x2e70ad];return _0x39f6e0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb0a4('0x0'));var rimraf=require(_0xb0a4('0x1'));var zipdir=require(_0xb0a4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb0a4('0x3'));var moment=require(_0xb0a4('0x4'));var BPromise=require(_0xb0a4('0x5'));var Mustache=require(_0xb0a4('0x6'));var util=require('util');var path=require(_0xb0a4('0x7'));var sox=require(_0xb0a4('0x8'));var csv=require(_0xb0a4('0x9'));var ejs=require(_0xb0a4('0xa'));var fs=require('fs');var _=require(_0xb0a4('0xb'));var squel=require(_0xb0a4('0xc'));var crypto=require(_0xb0a4('0xd'));var jsforce=require(_0xb0a4('0xe'));var deskjs=require(_0xb0a4('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb0a4('0x10'));var Papa=require(_0xb0a4('0x11'));var Redis=require(_0xb0a4('0x12'));var authService=require(_0xb0a4('0x13'));var qs=require(_0xb0a4('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb0a4('0x15'))(_0xb0a4('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xb0a4('0x17')]=_[_0xb0a4('0x18')](config[_0xb0a4('0x17')],{'host':_0xb0a4('0x19'),'port':0x18eb});var socket=require(_0xb0a4('0x1a'))(new Redis(config['redis']));require('./voiceQueue.socket')[_0xb0a4('0x1b')](socket);function respondWithStatusCode(_0x1eaeaa,_0x48760e){_0x48760e=_0x48760e||0xcc;return function(_0x41b6a8){if(_0x41b6a8){return _0x1eaeaa[_0xb0a4('0x1c')](_0x48760e);}return _0x1eaeaa[_0xb0a4('0x1d')](_0x48760e)[_0xb0a4('0x1e')]();};}function respondWithResult(_0x3f56c6,_0x5f5a37){_0x5f5a37=_0x5f5a37||0xc8;return function(_0x1fdb32){if(_0x1fdb32){return _0x3f56c6['status'](_0x5f5a37)['json'](_0x1fdb32);}};}function respondWithFilteredResult(_0x1321b5,_0x191499){return function(_0x431b52){if(_0x431b52){var _0x14aadc=_0x431b52[_0xb0a4('0x1f')],_0x43d1c5=_0x191499[_0xb0a4('0x20')],_0x5e1d03=_0x191499[_0xb0a4('0x20')]+_0x191499[_0xb0a4('0x21')],_0x371cbf;if(_0x5e1d03>=_0x14aadc){_0x5e1d03=_0x14aadc;_0x371cbf=0xc8;}else{_0x371cbf=0xce;}_0x1321b5[_0xb0a4('0x1d')](_0x371cbf);return _0x1321b5[_0xb0a4('0x22')](_0xb0a4('0x23'),_0x43d1c5+'-'+_0x5e1d03+'/'+_0x14aadc)[_0xb0a4('0x24')](_0x431b52);}return null;};}function patchUpdates(_0x663660){return function(_0x3c8250){try{jsonpatch[_0xb0a4('0x25')](_0x3c8250,_0x663660,!![]);}catch(_0x66f67c){return BPromise[_0xb0a4('0x26')](_0x66f67c);}return _0x3c8250[_0xb0a4('0x27')]();};}function saveUpdates(_0x5b3b50,_0x2ba909){return function(_0xc47624){if(_0xc47624){return _0xc47624[_0xb0a4('0x28')](_0x5b3b50)[_0xb0a4('0x29')](function(_0x270acd){return _0x270acd;});}return null;};}function removeEntity(_0x581db1,_0x29f90b){return function(_0x35b3fa){if(_0x35b3fa){return _0x35b3fa['destroy']()[_0xb0a4('0x29')](function(){var _0x4cb0e5=_0x35b3fa[_0xb0a4('0x2a')]({'plain':!![]});var _0x523eca=[{'name':_0xb0a4('0x2b'),'value':_0xb0a4('0x2c'),'ignore':![]},{'name':_0xb0a4('0x2d'),'value':_0xb0a4('0x2e'),'ignore':![]}];var _0x18f3d=_(_0x523eca)[_0xb0a4('0x2f')](_0xb0a4('0x30'))[_0xb0a4('0x31')](_0xb0a4('0x32'))[_0xb0a4('0x32')]();if(_[_0xb0a4('0x33')](_0x18f3d,_0x4cb0e5[_0xb0a4('0x34')])){return;}var _0x4b1c26=_['find'](_0x523eca,['value',_0x4cb0e5['type']])['name'];return db[_0xb0a4('0x35')]['destroy']({'where':{'type':_0x4b1c26,'resourceId':_0x4cb0e5['id']}})[_0xb0a4('0x29')](function(){return _0x35b3fa;});})['then'](function(){_0x581db1['status'](0xcc)[_0xb0a4('0x1e')]();});}};}function handleEntityNotFound(_0x3bd0a2,_0x5731b6){return function(_0x176870){if(!_0x176870){_0x3bd0a2[_0xb0a4('0x1c')](0x194);}return _0x176870;};}function handleError(_0x4c24bf,_0x750f4a){_0x750f4a=_0x750f4a||0x1f4;return function(_0x90f197){logger[_0xb0a4('0x36')](_0x90f197[_0xb0a4('0x37')]);if(_0x90f197[_0xb0a4('0x38')]){delete _0x90f197[_0xb0a4('0x38')];}_0x4c24bf[_0xb0a4('0x1d')](_0x750f4a)[_0xb0a4('0x39')](_0x90f197);};}exports[_0xb0a4('0x3a')]=function(_0x279650,_0x5f0a7e){var _0x100c9e={},_0x265833={},_0x3503d6={'count':0x0,'rows':[]};var _0x420f6b=_[_0xb0a4('0x31')](db['VoiceQueue'][_0xb0a4('0x3b')],function(_0x9bc735){return{'name':_0x9bc735[_0xb0a4('0x3c')],'type':_0x9bc735[_0xb0a4('0x34')][_0xb0a4('0x3d')]};});_0x265833[_0xb0a4('0x3e')]=_['map'](_0x420f6b,_0xb0a4('0x38'));_0x265833[_0xb0a4('0x3f')]=_['keys'](_0x279650[_0xb0a4('0x3f')]);_0x265833[_0xb0a4('0x40')]=_[_0xb0a4('0x41')](_0x265833[_0xb0a4('0x3e')],_0x265833[_0xb0a4('0x3f')]);_0x100c9e[_0xb0a4('0x42')]=_[_0xb0a4('0x41')](_0x265833[_0xb0a4('0x3e')],qs[_0xb0a4('0x43')](_0x279650[_0xb0a4('0x3f')][_0xb0a4('0x43')]));_0x100c9e['attributes']=_0x100c9e['attributes']['length']?_0x100c9e[_0xb0a4('0x42')]:_0x265833[_0xb0a4('0x3e')];if(!_0x279650[_0xb0a4('0x3f')][_0xb0a4('0x44')](_0xb0a4('0x45'))){_0x100c9e[_0xb0a4('0x21')]=qs[_0xb0a4('0x21')](_0x279650[_0xb0a4('0x3f')][_0xb0a4('0x21')]);_0x100c9e[_0xb0a4('0x20')]=qs['offset'](_0x279650[_0xb0a4('0x3f')][_0xb0a4('0x20')]);}_0x100c9e[_0xb0a4('0x46')]=qs[_0xb0a4('0x47')](_0x279650[_0xb0a4('0x3f')][_0xb0a4('0x47')]);_0x100c9e[_0xb0a4('0x48')]=qs[_0xb0a4('0x40')](_['pick'](_0x279650[_0xb0a4('0x3f')],_0x265833[_0xb0a4('0x40')]),_0x420f6b);if(_0x279650[_0xb0a4('0x3f')]['filter']){_0x100c9e[_0xb0a4('0x48')]=_[_0xb0a4('0x49')](_0x100c9e[_0xb0a4('0x48')],{'$or':_['map'](_0x420f6b,function(_0x49577b){if(_0x49577b[_0xb0a4('0x34')]!=='VIRTUAL'){var _0x4d86a9={};_0x4d86a9[_0x49577b[_0xb0a4('0x38')]]={'$like':'%'+_0x279650[_0xb0a4('0x3f')]['filter']+'%'};return _0x4d86a9;}})});}_0x100c9e=_['merge']({},_0x100c9e,_0x279650[_0xb0a4('0x4a')]);var _0x10ebfa={'where':_0x100c9e[_0xb0a4('0x48')]};return db[_0xb0a4('0x4b')][_0xb0a4('0x1f')](_0x10ebfa)[_0xb0a4('0x29')](function(_0x3d17ae){_0x3503d6['count']=_0x3d17ae;if(_0x279650['query'][_0xb0a4('0x4c')]){_0x100c9e['include']=[{'all':!![]}];}return db[_0xb0a4('0x4b')]['findAll'](_0x100c9e);})['then'](function(_0x225323){_0x3503d6[_0xb0a4('0x4d')]=_0x225323;return _0x3503d6;})[_0xb0a4('0x29')](respondWithFilteredResult(_0x5f0a7e,_0x100c9e))[_0xb0a4('0x4e')](handleError(_0x5f0a7e,null));};exports[_0xb0a4('0x4f')]=function(_0x23c506,_0x7dfd3d){var _0x4dc069={'raw':![],'where':{'id':_0x23c506[_0xb0a4('0x50')]['id']}},_0x29f7e2={};_0x29f7e2[_0xb0a4('0x3e')]=_['keys'](db['VoiceQueue']['rawAttributes']);_0x29f7e2[_0xb0a4('0x3f')]=_['keys'](_0x23c506[_0xb0a4('0x3f')]);_0x29f7e2[_0xb0a4('0x40')]=_[_0xb0a4('0x41')](_0x29f7e2[_0xb0a4('0x3e')],_0x29f7e2[_0xb0a4('0x3f')]);_0x4dc069['attributes']=_['intersection'](_0x29f7e2[_0xb0a4('0x3e')],qs[_0xb0a4('0x43')](_0x23c506[_0xb0a4('0x3f')]['fields']));_0x4dc069[_0xb0a4('0x42')]=_0x4dc069[_0xb0a4('0x42')][_0xb0a4('0x51')]?_0x4dc069[_0xb0a4('0x42')]:_0x29f7e2['model'];if(_0x23c506[_0xb0a4('0x3f')][_0xb0a4('0x4c')]){_0x4dc069[_0xb0a4('0x52')]=[{'all':!![]}];}_0x4dc069=_[_0xb0a4('0x49')]({},_0x4dc069,_0x23c506[_0xb0a4('0x4a')]);return db[_0xb0a4('0x4b')][_0xb0a4('0x53')](_0x4dc069)[_0xb0a4('0x29')](handleEntityNotFound(_0x7dfd3d,null))[_0xb0a4('0x29')](respondWithResult(_0x7dfd3d,null))[_0xb0a4('0x4e')](handleError(_0x7dfd3d,null));};exports[_0xb0a4('0x54')]=function(_0x5af7e1,_0xb3e0c9){return db['VoiceQueue'][_0xb0a4('0x54')](_0x5af7e1['body'],{})[_0xb0a4('0x29')](function(_0x14b785){var _0x44873d=_0x5af7e1[_0xb0a4('0x55')]['get']({'plain':!![]});if(!_0x44873d)throw new Error(_0xb0a4('0x56'));if(_0x44873d[_0xb0a4('0x57')]===_0xb0a4('0x55')){var _0xb3399c=_0x14b785[_0xb0a4('0x2a')]({'plain':!![]});var _0x20355b=[{'name':_0xb0a4('0x2b'),'value':_0xb0a4('0x2c')},{'name':'QueueCampaigns','value':_0xb0a4('0x2e')}];var _0x5141dd=_[_0xb0a4('0x53')](_0x20355b,[_0xb0a4('0x32'),_0xb3399c[_0xb0a4('0x34')]])['name'];return db['UserProfileSection'][_0xb0a4('0x53')]({'where':{'name':_0x5141dd,'userProfileId':_0x44873d[_0xb0a4('0x58')]},'raw':!![]})[_0xb0a4('0x29')](function(_0x257a8c){if(_0x257a8c&&_0x257a8c['autoAssociation']===0x0){return db[_0xb0a4('0x35')][_0xb0a4('0x54')]({'name':_0xb3399c[_0xb0a4('0x38')],'resourceId':_0xb3399c['id'],'type':_0x257a8c[_0xb0a4('0x38')],'sectionId':_0x257a8c['id']},{})[_0xb0a4('0x29')](function(){return _0x14b785;});}else{return _0x14b785;}})[_0xb0a4('0x4e')](function(_0x52938e){logger['error'](_0xb0a4('0x59'),_0x52938e);throw _0x52938e;});}return _0x14b785;})['then'](respondWithResult(_0xb3e0c9,0xc9))[_0xb0a4('0x4e')](handleError(_0xb3e0c9,null));};exports[_0xb0a4('0x5a')]=function(_0x2fe753,_0x50b282){var _0x380357={'where':{'id':_0x2fe753['params']['id']}},_0x51fab7={};_0x51fab7[_0xb0a4('0x3e')]=_[_0xb0a4('0x5b')](db[_0xb0a4('0x4b')]['rawAttributes']);_0x380357[_0xb0a4('0x42')]=_[_0xb0a4('0x41')](_0x51fab7[_0xb0a4('0x3e')],qs[_0xb0a4('0x43')](_0x2fe753['query'][_0xb0a4('0x43')]));_0x380357[_0xb0a4('0x42')]=_0x380357[_0xb0a4('0x42')][_0xb0a4('0x51')]?_0x380357[_0xb0a4('0x42')]:_0x51fab7['model'];if(_0x2fe753[_0xb0a4('0x3f')][_0xb0a4('0x4c')]){_0x380357[_0xb0a4('0x52')]=[{'all':!![]}];}_0x380357=_['merge']({},_0x380357,_0x2fe753['options']);return db[_0xb0a4('0x4b')][_0xb0a4('0x53')](_0x380357)[_0xb0a4('0x29')](handleEntityNotFound(_0x50b282,null))[_0xb0a4('0x29')](function(_0x58c6bb){if(_0x58c6bb){var _0x59c48a=_0x58c6bb[_0xb0a4('0x2a')]({'plain':!![]});_0x59c48a=qs['omit'](_0x59c48a,['id','createdAt',_0xb0a4('0x5c')]);_0x2fe753[_0xb0a4('0x5d')]=_[_0xb0a4('0x5e')](_0x2fe753[_0xb0a4('0x5d')],['id',_0xb0a4('0x5f'),_0xb0a4('0x5c')]);return db[_0xb0a4('0x4b')][_0xb0a4('0x54')](_[_0xb0a4('0x49')](_0x59c48a,_0x2fe753['body']),{'include':_0x2fe753[_0xb0a4('0x3f')][_0xb0a4('0x4c')]?[{'all':!![]}]:undefined})[_0xb0a4('0x29')](function(_0x987fc6){var _0x4f111b=_0x2fe753[_0xb0a4('0x55')]['get']({'plain':!![]});if(!_0x4f111b)throw new Error(_0xb0a4('0x56'));if(_0x4f111b['role']==='user'){var _0x5eea32=_0x987fc6['get']({'plain':!![]});var _0x433a9d=[{'name':'VoiceQueues','value':'inbound'},{'name':'QueueCampaigns','value':'outbound'}];var _0x62b4b9=_['find'](_0x433a9d,[_0xb0a4('0x32'),_0x5eea32[_0xb0a4('0x34')]])[_0xb0a4('0x38')];return db['UserProfileSection'][_0xb0a4('0x53')]({'where':{'name':_0x62b4b9,'userProfileId':_0x4f111b['userProfileId']},'raw':!![]})[_0xb0a4('0x29')](function(_0xe76344){if(_0xe76344&&_0xe76344[_0xb0a4('0x60')]===0x0){return db[_0xb0a4('0x35')][_0xb0a4('0x54')]({'name':_0x5eea32[_0xb0a4('0x38')],'resourceId':_0x5eea32['id'],'type':_0xe76344[_0xb0a4('0x38')],'sectionId':_0xe76344['id']},{})[_0xb0a4('0x29')](function(){return _0x987fc6;});}else{return _0x987fc6;}})[_0xb0a4('0x4e')](function(_0x3dd9d5){logger[_0xb0a4('0x36')](_0xb0a4('0x59'),_0x3dd9d5);throw _0x3dd9d5;});}return _0x987fc6;});}})[_0xb0a4('0x29')](respondWithResult(_0x50b282,0xc9))[_0xb0a4('0x4e')](handleError(_0x50b282,null));};exports[_0xb0a4('0x28')]=function(_0x1f5c04,_0xc39514){if(_0x1f5c04[_0xb0a4('0x5d')]['id']){delete _0x1f5c04[_0xb0a4('0x5d')]['id'];}return db['VoiceQueue'][_0xb0a4('0x53')]({'where':{'id':_0x1f5c04[_0xb0a4('0x50')]['id']}})[_0xb0a4('0x29')](handleEntityNotFound(_0xc39514,null))[_0xb0a4('0x29')](saveUpdates(_0x1f5c04[_0xb0a4('0x5d')],null))[_0xb0a4('0x29')](respondWithResult(_0xc39514,null))[_0xb0a4('0x4e')](handleError(_0xc39514,null));};exports[_0xb0a4('0x61')]=function(_0x3fd485,_0x3f5604){return db['VoiceQueue']['find']({'where':{'id':_0x3fd485[_0xb0a4('0x50')]['id']}})[_0xb0a4('0x29')](handleEntityNotFound(_0x3f5604,null))[_0xb0a4('0x29')](removeEntity(_0x3f5604,null))['catch'](handleError(_0x3f5604,null));};exports['getHoppers']=function(_0x3fd561,_0x41337,_0x50f079){var _0x58b487={'raw':![],'where':{}};var _0x36bf3f={};var _0x269641={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x3fd561[_0xb0a4('0x50')]['id']}})['then'](handleEntityNotFound(_0x41337,null))[_0xb0a4('0x29')](function(_0x3df8fe){if(_0x3df8fe){_0x36bf3f['model']=_[_0xb0a4('0x5b')](db['CmHopper'][_0xb0a4('0x3b')]);_0x36bf3f[_0xb0a4('0x3f')]=_[_0xb0a4('0x5b')](_0x3fd561[_0xb0a4('0x3f')]);_0x36bf3f['filters']=_[_0xb0a4('0x41')](_0x36bf3f[_0xb0a4('0x3e')],_0x36bf3f[_0xb0a4('0x3f')]);_0x58b487[_0xb0a4('0x42')]=_['intersection'](_0x36bf3f[_0xb0a4('0x3e')],qs[_0xb0a4('0x43')](_0x3fd561[_0xb0a4('0x3f')][_0xb0a4('0x43')]));_0x58b487[_0xb0a4('0x42')]=_0x58b487[_0xb0a4('0x42')][_0xb0a4('0x51')]?_0x58b487[_0xb0a4('0x42')]:_0x36bf3f[_0xb0a4('0x3e')];if(!_0x3fd561[_0xb0a4('0x3f')][_0xb0a4('0x44')](_0xb0a4('0x45'))){_0x58b487[_0xb0a4('0x21')]=qs[_0xb0a4('0x21')](_0x3fd561[_0xb0a4('0x3f')][_0xb0a4('0x21')]);_0x58b487[_0xb0a4('0x20')]=qs[_0xb0a4('0x20')](_0x3fd561[_0xb0a4('0x3f')]['offset']);}_0x58b487[_0xb0a4('0x46')]=qs[_0xb0a4('0x47')](_0x3fd561['query'][_0xb0a4('0x47')]);_0x58b487['where']=qs['filters'](_[_0xb0a4('0x62')](_0x3fd561['query'],_0x36bf3f['filters']));_0x58b487[_0xb0a4('0x48')][_0xb0a4('0x63')]=_0x3df8fe['id'];if(_0x3fd561[_0xb0a4('0x3f')][_0xb0a4('0x2f')]){_0x58b487['where']=_[_0xb0a4('0x49')](_0x58b487[_0xb0a4('0x48')],{'$or':_[_0xb0a4('0x31')](_0x58b487[_0xb0a4('0x42')],function(_0x53926a){var _0x66fa39={};_0x66fa39[_0x53926a]={'$like':'%'+_0x3fd561['query'][_0xb0a4('0x2f')]+'%'};return _0x66fa39;})});}_0x58b487=_['merge']({},_0x58b487,_0x3fd561['options']);return db['CmHopper']['count']({'where':_0x58b487[_0xb0a4('0x48')]})[_0xb0a4('0x29')](function(_0xb787f5){_0x269641[_0xb0a4('0x1f')]=_0xb787f5;if(_0x3fd561['query'][_0xb0a4('0x4c')]){_0x58b487[_0xb0a4('0x52')]=[{'all':!![]}];}return db[_0xb0a4('0x64')]['findAll'](_0x58b487);})[_0xb0a4('0x29')](function(_0x5ebcf8){_0x269641['rows']=_0x5ebcf8;return _0x269641;});}})['then'](respondWithFilteredResult(_0x41337,_0x58b487))[_0xb0a4('0x4e')](handleError(_0x41337,null));};exports[_0xb0a4('0x65')]=function(_0x26b46c,_0x2bcb3f,_0x3499b7){var _0x1967e0={'raw':!![],'where':{}};var _0x346f34={};var _0x30d533={'count':0x0,'rows':[]};return db[_0xb0a4('0x4b')][_0xb0a4('0x66')]({'where':{'id':_0x26b46c[_0xb0a4('0x50')]['id']}})[_0xb0a4('0x29')](handleEntityNotFound(_0x2bcb3f,null))[_0xb0a4('0x29')](function(_0x5e2a0f){if(_0x5e2a0f){_0x346f34[_0xb0a4('0x3e')]=_[_0xb0a4('0x5b')](db[_0xb0a4('0x67')][_0xb0a4('0x3b')]);_0x346f34[_0xb0a4('0x3f')]=_[_0xb0a4('0x5b')](_0x26b46c[_0xb0a4('0x3f')]);_0x346f34[_0xb0a4('0x40')]=_[_0xb0a4('0x41')](_0x346f34[_0xb0a4('0x3e')],_0x346f34['query']);_0x1967e0[_0xb0a4('0x42')]=_[_0xb0a4('0x41')](_0x346f34[_0xb0a4('0x3e')],qs['fields'](_0x26b46c['query'][_0xb0a4('0x43')]));_0x1967e0[_0xb0a4('0x42')]=_0x1967e0['attributes']['length']?_0x1967e0[_0xb0a4('0x42')]:_0x346f34[_0xb0a4('0x3e')];if(!_0x26b46c[_0xb0a4('0x3f')][_0xb0a4('0x44')](_0xb0a4('0x45'))){_0x1967e0[_0xb0a4('0x21')]=qs[_0xb0a4('0x21')](_0x26b46c[_0xb0a4('0x3f')][_0xb0a4('0x21')]);_0x1967e0['offset']=qs[_0xb0a4('0x20')](_0x26b46c[_0xb0a4('0x3f')][_0xb0a4('0x20')]);}_0x1967e0[_0xb0a4('0x46')]=qs[_0xb0a4('0x47')](_0x26b46c[_0xb0a4('0x3f')][_0xb0a4('0x47')]);_0x1967e0['where']=qs[_0xb0a4('0x40')](_[_0xb0a4('0x62')](_0x26b46c[_0xb0a4('0x3f')],_0x346f34[_0xb0a4('0x40')]));_0x1967e0[_0xb0a4('0x48')][_0xb0a4('0x63')]=_0x5e2a0f['id'];if(_0x26b46c['query'][_0xb0a4('0x2f')]){_0x1967e0[_0xb0a4('0x48')]=_[_0xb0a4('0x49')](_0x1967e0[_0xb0a4('0x48')],{'$or':_['map'](_0x1967e0[_0xb0a4('0x42')],function(_0x51b2a3){var _0x2f629c={};_0x2f629c[_0x51b2a3]={'$like':'%'+_0x26b46c[_0xb0a4('0x3f')]['filter']+'%'};return _0x2f629c;})});}_0x1967e0=_[_0xb0a4('0x49')]({},_0x1967e0,_0x26b46c[_0xb0a4('0x4a')]);return db[_0xb0a4('0x67')][_0xb0a4('0x1f')]({'where':_0x1967e0[_0xb0a4('0x48')]})[_0xb0a4('0x29')](function(_0x1bd49b){_0x30d533[_0xb0a4('0x1f')]=_0x1bd49b;if(_0x26b46c[_0xb0a4('0x3f')][_0xb0a4('0x4c')]){_0x1967e0[_0xb0a4('0x52')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x1967e0);})[_0xb0a4('0x29')](function(_0x34f296){_0x30d533[_0xb0a4('0x4d')]=_0x34f296;return _0x30d533;});}})['then'](respondWithFilteredResult(_0x2bcb3f,_0x1967e0))['catch'](handleError(_0x2bcb3f,null));};exports[_0xb0a4('0x68')]=function(_0x1b46f7,_0x2abe,_0x54b264){var _0x1318f8={'raw':!![],'where':{}};var _0xabf4d2={};var _0x4f1a9a={'count':0x0,'rows':[]};return db[_0xb0a4('0x4b')]['findOne']({'where':{'id':_0x1b46f7[_0xb0a4('0x50')]['id']}})[_0xb0a4('0x29')](handleEntityNotFound(_0x2abe,null))[_0xb0a4('0x29')](function(_0x1a57d7){if(_0x1a57d7){_0xabf4d2['model']=_[_0xb0a4('0x5b')](db[_0xb0a4('0x69')][_0xb0a4('0x3b')]);_0xabf4d2['query']=_['keys'](_0x1b46f7[_0xb0a4('0x3f')]);_0xabf4d2[_0xb0a4('0x40')]=_[_0xb0a4('0x41')](_0xabf4d2[_0xb0a4('0x3e')],_0xabf4d2[_0xb0a4('0x3f')]);_0x1318f8[_0xb0a4('0x42')]=_[_0xb0a4('0x41')](_0xabf4d2['model'],qs[_0xb0a4('0x43')](_0x1b46f7[_0xb0a4('0x3f')]['fields']));_0x1318f8[_0xb0a4('0x42')]=_0x1318f8['attributes'][_0xb0a4('0x51')]?_0x1318f8[_0xb0a4('0x42')]:_0xabf4d2[_0xb0a4('0x3e')];if(!_0x1b46f7[_0xb0a4('0x3f')][_0xb0a4('0x44')]('nolimit')){_0x1318f8[_0xb0a4('0x21')]=qs[_0xb0a4('0x21')](_0x1b46f7['query']['limit']);_0x1318f8[_0xb0a4('0x20')]=qs[_0xb0a4('0x20')](_0x1b46f7[_0xb0a4('0x3f')]['offset']);}_0x1318f8[_0xb0a4('0x46')]=qs[_0xb0a4('0x47')](_0x1b46f7[_0xb0a4('0x3f')][_0xb0a4('0x47')]);_0x1318f8[_0xb0a4('0x48')]=qs[_0xb0a4('0x40')](_[_0xb0a4('0x62')](_0x1b46f7['query'],_0xabf4d2[_0xb0a4('0x40')]));_0x1318f8[_0xb0a4('0x48')]['VoiceQueueId']=_0x1a57d7['id'];if(_0x1b46f7[_0xb0a4('0x3f')]['filter']){_0x1318f8['where']=_[_0xb0a4('0x49')](_0x1318f8[_0xb0a4('0x48')],{'$or':_['map'](_0x1318f8['attributes'],function(_0x120c7d){var _0x5547ec={};_0x5547ec[_0x120c7d]={'$like':'%'+_0x1b46f7['query'][_0xb0a4('0x2f')]+'%'};return _0x5547ec;})});}_0x1318f8=_[_0xb0a4('0x49')]({},_0x1318f8,_0x1b46f7['options']);return db[_0xb0a4('0x69')][_0xb0a4('0x1f')]({'where':_0x1318f8[_0xb0a4('0x48')]})[_0xb0a4('0x29')](function(_0x196ccc){_0x4f1a9a[_0xb0a4('0x1f')]=_0x196ccc;if(_0x1b46f7[_0xb0a4('0x3f')][_0xb0a4('0x4c')]){_0x1318f8[_0xb0a4('0x52')]=[{'all':!![]}];}return db[_0xb0a4('0x69')][_0xb0a4('0x6a')](_0x1318f8);})['then'](function(_0x5efdde){_0x4f1a9a[_0xb0a4('0x4d')]=_0x5efdde;return _0x4f1a9a;});}})['then'](respondWithFilteredResult(_0x2abe,_0x1318f8))['catch'](handleError(_0x2abe,null));};exports['getHopperBlacks']=function(_0x304faa,_0x332b90,_0x357f48){var _0x3c5c21={'raw':!![],'where':{}};var _0x4b0023={};var _0xba04db={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xb0a4('0x66')]({'where':{'id':_0x304faa['params']['id']}})[_0xb0a4('0x29')](handleEntityNotFound(_0x332b90,null))[_0xb0a4('0x29')](function(_0x1cb32b){if(_0x1cb32b){_0x4b0023[_0xb0a4('0x3e')]=_[_0xb0a4('0x5b')](db['CmHopperBlack'][_0xb0a4('0x3b')]);_0x4b0023[_0xb0a4('0x3f')]=_[_0xb0a4('0x5b')](_0x304faa['query']);_0x4b0023['filters']=_['intersection'](_0x4b0023[_0xb0a4('0x3e')],_0x4b0023['query']);_0x3c5c21[_0xb0a4('0x42')]=_[_0xb0a4('0x41')](_0x4b0023['model'],qs['fields'](_0x304faa[_0xb0a4('0x3f')]['fields']));_0x3c5c21[_0xb0a4('0x42')]=_0x3c5c21[_0xb0a4('0x42')][_0xb0a4('0x51')]?_0x3c5c21[_0xb0a4('0x42')]:_0x4b0023[_0xb0a4('0x3e')];if(!_0x304faa[_0xb0a4('0x3f')][_0xb0a4('0x44')](_0xb0a4('0x45'))){_0x3c5c21[_0xb0a4('0x21')]=qs[_0xb0a4('0x21')](_0x304faa['query'][_0xb0a4('0x21')]);_0x3c5c21[_0xb0a4('0x20')]=qs[_0xb0a4('0x20')](_0x304faa[_0xb0a4('0x3f')]['offset']);}_0x3c5c21[_0xb0a4('0x46')]=qs[_0xb0a4('0x47')](_0x304faa[_0xb0a4('0x3f')]['sort']);_0x3c5c21[_0xb0a4('0x48')]=qs[_0xb0a4('0x40')](_[_0xb0a4('0x62')](_0x304faa[_0xb0a4('0x3f')],_0x4b0023[_0xb0a4('0x40')]));_0x3c5c21['where'][_0xb0a4('0x63')]=_0x1cb32b['id'];if(_0x304faa[_0xb0a4('0x3f')]['filter']){_0x3c5c21[_0xb0a4('0x48')]=_[_0xb0a4('0x49')](_0x3c5c21[_0xb0a4('0x48')],{'$or':_[_0xb0a4('0x31')](_0x3c5c21[_0xb0a4('0x42')],function(_0x396e93){var _0x3b4373={};_0x3b4373[_0x396e93]={'$like':'%'+_0x304faa[_0xb0a4('0x3f')][_0xb0a4('0x2f')]+'%'};return _0x3b4373;})});}_0x3c5c21=_[_0xb0a4('0x49')]({},_0x3c5c21,_0x304faa[_0xb0a4('0x4a')]);return db[_0xb0a4('0x6b')]['count']({'where':_0x3c5c21[_0xb0a4('0x48')]})[_0xb0a4('0x29')](function(_0x572868){_0xba04db[_0xb0a4('0x1f')]=_0x572868;if(_0x304faa[_0xb0a4('0x3f')][_0xb0a4('0x4c')]){_0x3c5c21[_0xb0a4('0x52')]=[{'all':!![]}];}return db[_0xb0a4('0x6b')][_0xb0a4('0x6a')](_0x3c5c21);})[_0xb0a4('0x29')](function(_0x1d7282){_0xba04db[_0xb0a4('0x4d')]=_0x1d7282;return _0xba04db;});}})[_0xb0a4('0x29')](respondWithFilteredResult(_0x332b90,_0x3c5c21))[_0xb0a4('0x4e')](handleError(_0x332b90,null));};exports[_0xb0a4('0x6c')]=function(_0x19bdbb,_0xf14476,_0x13c0f3){var _0x177a32={};var _0x2fd78c={};var _0x1a2d94;var _0x5df626;return db['VoiceQueue'][_0xb0a4('0x66')]({'where':{'id':_0x19bdbb[_0xb0a4('0x50')]['id']}})[_0xb0a4('0x29')](handleEntityNotFound(_0xf14476,null))[_0xb0a4('0x29')](function(_0x154f86){if(_0x154f86){_0x1a2d94=_0x154f86;_0x2fd78c[_0xb0a4('0x3e')]=_[_0xb0a4('0x5b')](db[_0xb0a4('0x6d')][_0xb0a4('0x3b')]);_0x2fd78c[_0xb0a4('0x3f')]=_['keys'](_0x19bdbb[_0xb0a4('0x3f')]);_0x2fd78c['filters']=_[_0xb0a4('0x41')](_0x2fd78c[_0xb0a4('0x3e')],_0x2fd78c['query']);_0x177a32[_0xb0a4('0x42')]=_[_0xb0a4('0x41')](_0x2fd78c[_0xb0a4('0x3e')],qs[_0xb0a4('0x43')](_0x19bdbb['query'][_0xb0a4('0x43')]));_0x177a32[_0xb0a4('0x42')]=_0x177a32[_0xb0a4('0x42')][_0xb0a4('0x51')]?_0x177a32[_0xb0a4('0x42')]:_0x2fd78c[_0xb0a4('0x3e')];_0x177a32[_0xb0a4('0x46')]=qs[_0xb0a4('0x47')](_0x19bdbb[_0xb0a4('0x3f')][_0xb0a4('0x47')]);_0x177a32[_0xb0a4('0x48')]=qs[_0xb0a4('0x40')](_['pick'](_0x19bdbb[_0xb0a4('0x3f')],_0x2fd78c[_0xb0a4('0x40')]));if(_0x19bdbb['query']['filter']){_0x177a32[_0xb0a4('0x48')]=_[_0xb0a4('0x49')](_0x177a32[_0xb0a4('0x48')],{'$or':_[_0xb0a4('0x31')](_0x177a32[_0xb0a4('0x42')],function(_0xdc2a1d){var _0x2172ae={};_0x2172ae[_0xdc2a1d]={'$like':'%'+_0x19bdbb[_0xb0a4('0x3f')]['filter']+'%'};return _0x2172ae;})});}_0x177a32=_[_0xb0a4('0x49')]({},_0x177a32,_0x19bdbb[_0xb0a4('0x4a')]);return _0x1a2d94[_0xb0a4('0x6c')](_0x177a32);}})[_0xb0a4('0x29')](function(_0x1a50cd){if(_0x1a50cd){_0x5df626=_0x1a50cd[_0xb0a4('0x51')];if(!_0x19bdbb[_0xb0a4('0x3f')][_0xb0a4('0x44')](_0xb0a4('0x45'))){_0x177a32[_0xb0a4('0x21')]=qs[_0xb0a4('0x21')](_0x19bdbb[_0xb0a4('0x3f')][_0xb0a4('0x21')]);_0x177a32['offset']=qs['offset'](_0x19bdbb[_0xb0a4('0x3f')]['offset']);}return _0x1a2d94[_0xb0a4('0x6c')](_0x177a32);}})[_0xb0a4('0x29')](function(_0x176cbe){if(_0x176cbe){return _0x176cbe?{'count':_0x5df626,'rows':_0x176cbe}:null;}})['then'](respondWithResult(_0xf14476,null))[_0xb0a4('0x4e')](handleError(_0xf14476,null));};exports['addTeams']=function(_0x31d427,_0x15c4a6,_0x2040c7){var _0x3a7c4a=_0x31d427[_0xb0a4('0x5d')][_0xb0a4('0x6e')];var _0x3e40ad=_[_0xb0a4('0x31')](_0x3a7c4a,'id');return db[_0xb0a4('0x6d')][_0xb0a4('0x6a')]({'where':{'id':_0x3e40ad},'attributes':['id'],'include':[{'model':db[_0xb0a4('0x6f')],'as':_0xb0a4('0x70'),'attributes':['id',_0xb0a4('0x38'),_0xb0a4('0x71'),_0xb0a4('0x72'),_0xb0a4('0x73')],'raw':!![]}]})[_0xb0a4('0x29')](function(_0x107f7b){if(_0x107f7b){var _0x24f9b1=_[_0xb0a4('0x74')](_0x107f7b,function(_0x42f5e5){var _0xf9b82=_0x42f5e5['get']({'plain':!![]});_0xf9b82['Agents'][_0xb0a4('0x75')](function(_0xb9f4a5){_0xb9f4a5[_0xb0a4('0x76')]=_[_0xb0a4('0x53')](_0x3a7c4a,{'id':_0xf9b82['id']})['penalty'];});return _0xf9b82[_0xb0a4('0x70')];});return db['VoiceQueue']['find']({'where':{'id':_0x31d427['params']['id']}})[_0xb0a4('0x29')](function(_0x117d77){return db[_0xb0a4('0x77')][_0xb0a4('0x78')](function(_0x5213cf){return _0x117d77[_0xb0a4('0x79')](_0x3e40ad,{'transaction':_0x5213cf})[_0xb0a4('0x29')](function(){return BPromise[_0xb0a4('0x7a')](_0x24f9b1,function(_0x4c7ae0){return db[_0xb0a4('0x7b')][_0xb0a4('0x7c')]({'where':{'UserId':_0x4c7ae0['id'],'VoiceQueueId':_0x31d427[_0xb0a4('0x50')]['id']},'defaults':{'penalty':_0x4c7ae0[_0xb0a4('0x76')]},'transaction':_0x5213cf});});})[_0xb0a4('0x29')](function(){return BPromise[_0xb0a4('0x7a')](_[_0xb0a4('0x2f')](_0x24f9b1,{'online':!![]}),function(_0x533067){return db[_0xb0a4('0x7d')][_0xb0a4('0x7e')]({'membername':_0x533067['name'],'UserId':_0x533067['id'],'queue_name':_0x117d77[_0xb0a4('0x38')],'VoiceQueueId':_0x117d77['id'],'interface':_['isNil'](_0x533067['interface'])?util[_0xb0a4('0x7f')]('SIP/%s',_0x533067[_0xb0a4('0x38')]):_0x533067[_0xb0a4('0x73')],'paused':_0x533067[_0xb0a4('0x72')]||![],'penalty':_0x533067[_0xb0a4('0x76')]},{'transaction':_0x5213cf});});})[_0xb0a4('0x29')](function(){_0x24f9b1['forEach'](function(_0x47852a){socket['emit'](_0xb0a4('0x80'),{'UserId':_0x47852a['id'],'VoiceQueueId':_0x117d77['id']});});});});});}})[_0xb0a4('0x29')](respondWithStatusCode(_0x15c4a6,null))[_0xb0a4('0x4e')](handleError(_0x15c4a6,null));};exports['removeTeams']=function(_0x540674,_0x2daeb9,_0x3080b9){return db[_0xb0a4('0x6d')][_0xb0a4('0x6a')]({'where':{'id':_0x540674['query'][_0xb0a4('0x81')]},'attributes':['id'],'include':[{'model':db[_0xb0a4('0x6f')],'as':_0xb0a4('0x70'),'attributes':['id'],'raw':!![]}]})[_0xb0a4('0x29')](handleEntityNotFound(_0x2daeb9,null))['then'](function(_0x4083db){var _0x31e775=_[_0xb0a4('0x31')](_0x4083db,'id');var _0x16731e=[];var _0x3b2799=[];var _0x3722ed=squel[_0xb0a4('0x82')]();_0x3722ed['field']('tq.TeamId')[_0xb0a4('0x83')](_0xb0a4('0x84'),'tq')[_0xb0a4('0x85')](_0xb0a4('0x86'),'ut',_0xb0a4('0x87'))['where'](_0xb0a4('0x88'),_0x540674[_0xb0a4('0x50')]['id']);for(var _0xe0c671=0x0;_0xe0c671<_0x4083db['length'];_0xe0c671+=0x1){let _0x3cb0fe=_0x4083db[_0xe0c671];for(var _0x10d6e2=0x0;_0x10d6e2<_0x3cb0fe['Agents'][_0xb0a4('0x51')];_0x10d6e2+=0x1){let _0x2f6370=_0x3cb0fe[_0xb0a4('0x70')][_0x10d6e2];var _0x2b3d2d=_0x3722ed['clone']();_0x2b3d2d[_0xb0a4('0x48')](_0xb0a4('0x89'),_0x2f6370['id']);_0x3b2799[_0xb0a4('0x8a')](db[_0xb0a4('0x77')][_0xb0a4('0x3f')](_0x2b3d2d[_0xb0a4('0x8b')](),{'type':db[_0xb0a4('0x77')][_0xb0a4('0x8c')][_0xb0a4('0x8d')]})[_0xb0a4('0x29')](function(_0x1802b0){if(_0x1802b0['length']===0x1){return _0x2f6370['id'];}else{var _0x557dba=_[_0xb0a4('0x8e')](_[_0xb0a4('0x31')](_0x1802b0,_0xb0a4('0x8f')),function(_0x58c96d){return _['includes'](_0x31e775,_0x58c96d);});if(_0x557dba){return _0x2f6370['id'];}}}));}}return BPromise[_0xb0a4('0x90')](_0x3b2799)[_0xb0a4('0x29')](function(_0x44bb4b){_0x16731e=_(_0x16731e)[_0xb0a4('0x91')](_0x44bb4b)[_0xb0a4('0x92')]()['value']();return db['VoiceQueue'][_0xb0a4('0x53')]({'where':{'id':_0x540674['params']['id']}})[_0xb0a4('0x29')](function(_0x4d7ebf){return db[_0xb0a4('0x77')][_0xb0a4('0x78')](function(_0x557e8a){return _0x4d7ebf[_0xb0a4('0x93')](_0x540674[_0xb0a4('0x3f')][_0xb0a4('0x81')],{'transaction':_0x557e8a})[_0xb0a4('0x29')](function(){if(!_[_0xb0a4('0x94')](_0x16731e)){return _0x4d7ebf['removeAgents'](_0x16731e,{'transaction':_0x557e8a})['then'](function(){return db[_0xb0a4('0x7d')]['destroy']({'where':{'VoiceQueueId':_0x540674[_0xb0a4('0x50')]['id'],'UserId':_0x16731e},'transaction':_0x557e8a});});}})['then'](function(){_0x16731e[_0xb0a4('0x75')](function(_0x20d4f7){socket[_0xb0a4('0x95')]('userVoiceQueue:remove',{'UserId':_0x20d4f7,'VoiceQueueId':_0x4d7ebf['id']});});});});});});})[_0xb0a4('0x29')](respondWithStatusCode(_0x2daeb9,null))[_0xb0a4('0x4e')](handleError(_0x2daeb9,null));};exports[_0xb0a4('0x96')]=function(_0x1b10e1,_0x11abef,_0xc4385d){var _0x2a571e,_0x30f33c;return db[_0xb0a4('0x4b')][_0xb0a4('0x53')]({'where':{'id':_0x1b10e1[_0xb0a4('0x50')]['id']}})[_0xb0a4('0x29')](handleEntityNotFound(_0x11abef,null))[_0xb0a4('0x29')](function(_0x69a91a){if(_0x69a91a){_0x30f33c=_0x69a91a;return _0x69a91a['addAgents'](_0x1b10e1[_0xb0a4('0x5d')][_0xb0a4('0x81')],_[_0xb0a4('0x5e')](_0x1b10e1[_0xb0a4('0x5d')],['ids','id'])||{})[_0xb0a4('0x97')](function(_0x29620a){for(var _0x185834=0x0;_0x185834<_0x1b10e1['body'][_0xb0a4('0x81')][_0xb0a4('0x51')];_0x185834+=0x1){socket[_0xb0a4('0x95')](_0xb0a4('0x80'),{'UserId':_0x1b10e1[_0xb0a4('0x5d')][_0xb0a4('0x81')][_0x185834],'VoiceQueueId':_0x1b10e1[_0xb0a4('0x50')]['id']});}return _0x29620a;});}})[_0xb0a4('0x29')](function(_0x5aff41){_0x2a571e=_0x5aff41||[];if(_0x30f33c){return db[_0xb0a4('0x6f')][_0xb0a4('0x6a')]({'where':{'id':_0x1b10e1[_0xb0a4('0x5d')][_0xb0a4('0x81')]},'attributes':['id','name','online',_0xb0a4('0x72'),_0xb0a4('0x73')],'raw':!![]});}})[_0xb0a4('0x29')](function(_0x129468){if(!_[_0xb0a4('0x94')](_0x129468)){var _0x140268=[];for(var _0x5e5c87=0x0;_0x5e5c87<_0x129468[_0xb0a4('0x51')];_0x5e5c87++){if(_0x129468[_0x5e5c87][_0xb0a4('0x71')]){_0x140268[_0xb0a4('0x8a')](db[_0xb0a4('0x7d')][_0xb0a4('0x7e')]({'membername':_0x129468[_0x5e5c87][_0xb0a4('0x38')],'UserId':_0x129468[_0x5e5c87]['id'],'queue_name':_0x30f33c[_0xb0a4('0x38')],'VoiceQueueId':_0x30f33c['id'],'interface':_[_0xb0a4('0x98')](_0x129468[_0x5e5c87][_0xb0a4('0x73')])?util[_0xb0a4('0x7f')]('SIP/%s',_0x129468[_0x5e5c87]['name']):_0x129468[_0x5e5c87][_0xb0a4('0x73')],'paused':_0x129468[_0x5e5c87][_0xb0a4('0x72')]||![],'penalty':_0x1b10e1['body'][_0xb0a4('0x76')]||0x0}));}}return BPromise[_0xb0a4('0x90')](_0x140268);}})['then'](function(){return _0x2a571e;})[_0xb0a4('0x29')](respondWithResult(_0x11abef,null))[_0xb0a4('0x4e')](handleError(_0x11abef,null));};exports['removeAgents']=function(_0x57ea62,_0x5b9195,_0x330461){return db['VoiceQueue']['find']({'where':{'id':_0x57ea62[_0xb0a4('0x50')]['id']}})[_0xb0a4('0x29')](handleEntityNotFound(_0x5b9195,null))[_0xb0a4('0x29')](function(_0x28a05f){if(_0x28a05f){return _0x28a05f['removeAgents'](_0x57ea62[_0xb0a4('0x3f')][_0xb0a4('0x81')])[_0xb0a4('0x29')](function(){if(_[_0xb0a4('0x99')](_0x57ea62[_0xb0a4('0x3f')]['ids'])){for(var _0x248406=0x0;_0x248406<_0x57ea62[_0xb0a4('0x3f')][_0xb0a4('0x81')]['length'];_0x248406+=0x1){socket['emit'](_0xb0a4('0x9a'),{'UserId':Number(_0x57ea62[_0xb0a4('0x3f')][_0xb0a4('0x81')][_0x248406]),'VoiceQueueId':Number(_0x57ea62[_0xb0a4('0x50')]['id'])});}}else{socket[_0xb0a4('0x95')]('userVoiceQueue:remove',{'UserId':Number(_0x57ea62[_0xb0a4('0x3f')][_0xb0a4('0x81')]),'VoiceQueueId':Number(_0x57ea62['params']['id'])});}});}})[_0xb0a4('0x29')](function(_0x4b0b5e){return db[_0xb0a4('0x7d')]['destroy']({'where':{'VoiceQueueId':_0x57ea62['params']['id'],'UserId':_0x57ea62[_0xb0a4('0x3f')]['ids']}})[_0xb0a4('0x29')](function(){return _0x4b0b5e;});})['then'](respondWithStatusCode(_0x5b9195,null))[_0xb0a4('0x4e')](handleError(_0x5b9195,null));};exports[_0xb0a4('0x9b')]=function(_0x4b6cce,_0x327212,_0x435231){var _0x5195f5={};var _0x2ffc44={};var _0x1c8027;var _0x48924f;return db[_0xb0a4('0x4b')][_0xb0a4('0x66')]({'where':{'id':_0x4b6cce[_0xb0a4('0x50')]['id']}})[_0xb0a4('0x29')](handleEntityNotFound(_0x327212,null))[_0xb0a4('0x29')](function(_0x45ad9f){if(_0x45ad9f){_0x1c8027=_0x45ad9f;_0x2ffc44[_0xb0a4('0x3e')]=_[_0xb0a4('0x5b')](db[_0xb0a4('0x6f')][_0xb0a4('0x3b')]);_0x2ffc44[_0xb0a4('0x3f')]=_['keys'](_0x4b6cce[_0xb0a4('0x3f')]);_0x2ffc44[_0xb0a4('0x40')]=_['intersection'](_0x2ffc44[_0xb0a4('0x3e')],_0x2ffc44['query']);_0x5195f5[_0xb0a4('0x42')]=_[_0xb0a4('0x41')](_0x2ffc44[_0xb0a4('0x3e')],qs['fields'](_0x4b6cce[_0xb0a4('0x3f')][_0xb0a4('0x43')]));_0x5195f5[_0xb0a4('0x42')]=_0x5195f5[_0xb0a4('0x42')][_0xb0a4('0x51')]?_0x5195f5[_0xb0a4('0x42')]:_0x2ffc44[_0xb0a4('0x3e')];_0x5195f5[_0xb0a4('0x46')]=qs[_0xb0a4('0x47')](_0x4b6cce[_0xb0a4('0x3f')][_0xb0a4('0x47')]);_0x5195f5[_0xb0a4('0x48')]=qs['filters'](_[_0xb0a4('0x62')](_0x4b6cce[_0xb0a4('0x3f')],_0x2ffc44[_0xb0a4('0x40')]));if(_0x4b6cce[_0xb0a4('0x3f')]['filter']){_0x5195f5[_0xb0a4('0x48')]=_[_0xb0a4('0x49')](_0x5195f5['where'],{'$or':_[_0xb0a4('0x31')](_0x5195f5[_0xb0a4('0x42')],function(_0x3e388a){var _0x534e28={};_0x534e28[_0x3e388a]={'$like':'%'+_0x4b6cce[_0xb0a4('0x3f')][_0xb0a4('0x2f')]+'%'};return _0x534e28;})});}_0x5195f5=_[_0xb0a4('0x49')]({},_0x5195f5,_0x4b6cce[_0xb0a4('0x4a')]);return _0x1c8027[_0xb0a4('0x9b')](_0x5195f5);}})['then'](function(_0x5ab620){if(_0x5ab620){_0x48924f=_0x5ab620[_0xb0a4('0x51')];if(!_0x4b6cce[_0xb0a4('0x3f')][_0xb0a4('0x44')](_0xb0a4('0x45'))){_0x5195f5[_0xb0a4('0x21')]=qs[_0xb0a4('0x21')](_0x4b6cce[_0xb0a4('0x3f')][_0xb0a4('0x21')]);_0x5195f5[_0xb0a4('0x20')]=qs[_0xb0a4('0x20')](_0x4b6cce['query'][_0xb0a4('0x20')]);}return _0x1c8027[_0xb0a4('0x9b')](_0x5195f5);}})[_0xb0a4('0x29')](function(_0x208c61){if(_0x208c61){return _0x208c61?{'count':_0x48924f,'rows':_0x208c61}:null;}})[_0xb0a4('0x29')](respondWithResult(_0x327212,null))[_0xb0a4('0x4e')](handleError(_0x327212,null));};exports[_0xb0a4('0x9c')]=function(_0x25afe1,_0x478f74,_0xe5c013){var _0x36e508={};var _0x1fc75c={};var _0x48fddc;var _0x4a1af1;return db['VoiceQueue'][_0xb0a4('0x66')]({'where':{'id':_0x25afe1[_0xb0a4('0x50')]['id']}})['then'](handleEntityNotFound(_0x478f74,null))['then'](function(_0x4494ef){if(_0x4494ef){_0x48fddc=_0x4494ef;_0x1fc75c[_0xb0a4('0x3e')]=_[_0xb0a4('0x5b')](db[_0xb0a4('0x7d')][_0xb0a4('0x3b')]);_0x1fc75c[_0xb0a4('0x3f')]=_[_0xb0a4('0x5b')](_0x25afe1[_0xb0a4('0x3f')]);_0x1fc75c['filters']=_[_0xb0a4('0x41')](_0x1fc75c[_0xb0a4('0x3e')],_0x1fc75c[_0xb0a4('0x3f')]);_0x36e508['attributes']=_[_0xb0a4('0x41')](_0x1fc75c[_0xb0a4('0x3e')],qs['fields'](_0x25afe1['query'][_0xb0a4('0x43')]));_0x36e508[_0xb0a4('0x42')]=_0x36e508[_0xb0a4('0x42')][_0xb0a4('0x51')]?_0x36e508['attributes']:_0x1fc75c[_0xb0a4('0x3e')];_0x36e508[_0xb0a4('0x46')]=qs[_0xb0a4('0x47')](_0x25afe1[_0xb0a4('0x3f')]['sort']);_0x36e508[_0xb0a4('0x48')]=qs[_0xb0a4('0x40')](_[_0xb0a4('0x62')](_0x25afe1[_0xb0a4('0x3f')],_0x1fc75c['filters']));if(_0x25afe1[_0xb0a4('0x3f')][_0xb0a4('0x2f')]){_0x36e508[_0xb0a4('0x48')]=_['merge'](_0x36e508['where'],{'$or':_['map'](_0x36e508[_0xb0a4('0x42')],function(_0x23de9b){var _0xdaa6de={};_0xdaa6de[_0x23de9b]={'$like':'%'+_0x25afe1['query'][_0xb0a4('0x2f')]+'%'};return _0xdaa6de;})});}_0x36e508=_[_0xb0a4('0x49')]({},_0x36e508,_0x25afe1['options']);return _0x48fddc[_0xb0a4('0x9c')](_0x36e508);}})[_0xb0a4('0x29')](function(_0x55369c){if(_0x55369c){_0x4a1af1=_0x55369c[_0xb0a4('0x51')];if(!_0x25afe1[_0xb0a4('0x3f')]['hasOwnProperty'](_0xb0a4('0x45'))){_0x36e508[_0xb0a4('0x21')]=qs[_0xb0a4('0x21')](_0x25afe1[_0xb0a4('0x3f')][_0xb0a4('0x21')]);_0x36e508[_0xb0a4('0x20')]=qs[_0xb0a4('0x20')](_0x25afe1[_0xb0a4('0x3f')][_0xb0a4('0x20')]);}return _0x48fddc['getMembers'](_0x36e508);}})[_0xb0a4('0x29')](function(_0x54aa3a){return _0x54aa3a?{'count':_0x4a1af1,'rows':_0x54aa3a}:null;})['then'](respondWithResult(_0x478f74,null))[_0xb0a4('0x4e')](handleError(_0x478f74,null));};exports['getLists']=function(_0x30ca2b,_0x46fce0,_0x2e7bb1){var _0x3f04af={};var _0x369489={};var _0x2434c1;var _0x5c9051;return db[_0xb0a4('0x4b')][_0xb0a4('0x66')]({'where':{'id':_0x30ca2b[_0xb0a4('0x50')]['id']}})['then'](handleEntityNotFound(_0x46fce0,null))['then'](function(_0x4e3bea){if(_0x4e3bea){_0x2434c1=_0x4e3bea;_0x369489[_0xb0a4('0x3e')]=_[_0xb0a4('0x5b')](db[_0xb0a4('0x9d')]['rawAttributes']);_0x369489[_0xb0a4('0x3f')]=_[_0xb0a4('0x5b')](_0x30ca2b[_0xb0a4('0x3f')]);_0x369489['filters']=_[_0xb0a4('0x41')](_0x369489['model'],_0x369489[_0xb0a4('0x3f')]);_0x3f04af['attributes']=_['intersection'](_0x369489[_0xb0a4('0x3e')],qs[_0xb0a4('0x43')](_0x30ca2b[_0xb0a4('0x3f')][_0xb0a4('0x43')]));_0x3f04af['attributes']=_0x3f04af[_0xb0a4('0x42')]['length']?_0x3f04af[_0xb0a4('0x42')]:_0x369489[_0xb0a4('0x3e')];_0x3f04af[_0xb0a4('0x46')]=qs[_0xb0a4('0x47')](_0x30ca2b['query'][_0xb0a4('0x47')]);_0x3f04af[_0xb0a4('0x48')]=qs[_0xb0a4('0x40')](_[_0xb0a4('0x62')](_0x30ca2b[_0xb0a4('0x3f')],_0x369489[_0xb0a4('0x40')]));if(_0x30ca2b['query'][_0xb0a4('0x2f')]){_0x3f04af['where']=_['merge'](_0x3f04af[_0xb0a4('0x48')],{'$or':_[_0xb0a4('0x31')](_0x3f04af[_0xb0a4('0x42')],function(_0x417d3e){var _0x482688={};_0x482688[_0x417d3e]={'$like':'%'+_0x30ca2b[_0xb0a4('0x3f')][_0xb0a4('0x2f')]+'%'};return _0x482688;})});}_0x3f04af=_[_0xb0a4('0x49')]({},_0x3f04af,_0x30ca2b['options']);return _0x2434c1[_0xb0a4('0x9e')](_0x3f04af);}})[_0xb0a4('0x29')](function(_0x3622d8){if(_0x3622d8){_0x5c9051=_0x3622d8[_0xb0a4('0x51')];if(!_0x30ca2b[_0xb0a4('0x3f')][_0xb0a4('0x44')](_0xb0a4('0x45'))){_0x3f04af[_0xb0a4('0x21')]=qs['limit'](_0x30ca2b['query'][_0xb0a4('0x21')]);_0x3f04af['offset']=qs[_0xb0a4('0x20')](_0x30ca2b[_0xb0a4('0x3f')][_0xb0a4('0x20')]);}return _0x2434c1['getLists'](_0x3f04af);}})[_0xb0a4('0x29')](function(_0x50c64f){if(_0x50c64f){return _0x50c64f?{'count':_0x5c9051,'rows':_0x50c64f}:null;}})[_0xb0a4('0x29')](respondWithResult(_0x46fce0,null))[_0xb0a4('0x4e')](handleError(_0x46fce0,null));};exports[_0xb0a4('0x9f')]=function(_0x3fc6b0,_0x458f92,_0x5ae03b){var _0x331874,_0xbc6e42;return db['VoiceQueue'][_0xb0a4('0x53')]({'where':{'id':_0x3fc6b0[_0xb0a4('0x50')]['id']}})[_0xb0a4('0x29')](handleEntityNotFound(_0x458f92,null))[_0xb0a4('0x29')](function(_0x55f3e7){if(_0x55f3e7){_0xbc6e42=_0x55f3e7;return _0x55f3e7[_0xb0a4('0x9f')](_0x3fc6b0[_0xb0a4('0x5d')][_0xb0a4('0x81')],_['omit'](_0x3fc6b0['body'],[_0xb0a4('0x81'),'id'])||{});}return null;})[_0xb0a4('0x97')](function(_0x482714){var _0x21f49b;_0x331874=_0x482714||[];var _0x5cc1d6=[];if(_0x482714){for(var _0x1f5c5b=0x0;_0x1f5c5b<_0x482714[_0xb0a4('0x51')];_0x1f5c5b+=0x1){var _0x3ae10f=_0x482714[_0x1f5c5b]['get']({'plain':!![]});_0xbc6e42[_0xb0a4('0xa0')]=_0x3fc6b0['body'][_0xb0a4('0xa0')]?_0x3fc6b0['body'][_0xb0a4('0xa0')]:_0xbc6e42[_0xb0a4('0xa0')];switch(_0xbc6e42[_0xb0a4('0xa0')]){case _0xb0a4('0xa1'):_0x21f49b=squel[_0xb0a4('0xa2')]()['into'](_0xb0a4('0xa3'))['fromQuery'](['phone','scheduledAt',_0xb0a4('0xa4'),_0xb0a4('0xa5'),_0xb0a4('0x63'),'createdAt','updatedAt'],squel[_0xb0a4('0x82')]()[_0xb0a4('0xa6')](_0xb0a4('0xa7'),_0xb0a4('0xa7'))[_0xb0a4('0xa6')]('NOW()',_0xb0a4('0xa8'))[_0xb0a4('0xa6')]('id',_0xb0a4('0xa4'))[_0xb0a4('0xa6')](_0x3ae10f[_0xb0a4('0xa9')][_0xb0a4('0x8b')](),_0xb0a4('0xa5'))['field'](_0x3fc6b0[_0xb0a4('0x50')]['id']['toString'](),_0xb0a4('0x63'))[_0xb0a4('0xa6')](_0xb0a4('0xaa'),_0xb0a4('0x5f'))['field']('NOW()','updatedAt')[_0xb0a4('0x83')](_0xb0a4('0xab'))[_0xb0a4('0x48')]('deletedAt\x20IS\x20NULL')[_0xb0a4('0x48')]('ListId\x20=\x20?',_0x3ae10f['CmListId'][_0xb0a4('0x8b')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0xb0a4('0x48')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xb0a4('0xa6')](_0xb0a4('0xac'))['from'](_0xb0a4('0xad'))['where']('VoiceQueueId\x20=\x20?',_0x3fc6b0[_0xb0a4('0x50')]['id']['toString']()))[_0xb0a4('0x48')](_0xb0a4('0xae'),squel['select']()[_0xb0a4('0xa6')](_0xb0a4('0xaf'))[_0xb0a4('0x83')](_0xb0a4('0xa3'))['where'](_0xb0a4('0x88'),_0x3fc6b0['params']['id'][_0xb0a4('0x8b')]())))['toString']();break;case _0xb0a4('0xb0'):_0x21f49b=squel[_0xb0a4('0xa2')]()[_0xb0a4('0xb1')](_0xb0a4('0xa3'))[_0xb0a4('0xb2')]([_0xb0a4('0xa7'),_0xb0a4('0xa8'),_0xb0a4('0xa4'),'ListId',_0xb0a4('0x63'),_0xb0a4('0x5f'),_0xb0a4('0x5c')],squel[_0xb0a4('0x82')]()[_0xb0a4('0xa6')](_0xb0a4('0xa7'),_0xb0a4('0xa7'))[_0xb0a4('0xa6')](_0xb0a4('0xaa'),'scheduledAt')[_0xb0a4('0xa6')]('id',_0xb0a4('0xa4'))[_0xb0a4('0xa6')](_0x3ae10f[_0xb0a4('0xa9')][_0xb0a4('0x8b')](),_0xb0a4('0xa5'))[_0xb0a4('0xa6')](_0x3fc6b0[_0xb0a4('0x50')]['id'][_0xb0a4('0x8b')](),_0xb0a4('0x63'))[_0xb0a4('0xa6')](_0xb0a4('0xaa'),_0xb0a4('0x5f'))['field'](_0xb0a4('0xaa'),_0xb0a4('0x5c'))[_0xb0a4('0x83')](_0xb0a4('0xab'))[_0xb0a4('0x48')](_0xb0a4('0xb3'))['where'](_0xb0a4('0xb4'),_0x3ae10f['CmListId'][_0xb0a4('0x8b')]())[_0xb0a4('0x48')](_0xb0a4('0xb5'))[_0xb0a4('0x48')](_0xb0a4('0xae'),squel['select']()['field'](_0xb0a4('0xaf'))[_0xb0a4('0x83')](_0xb0a4('0xa3'))[_0xb0a4('0x48')](_0xb0a4('0x88'),_0x3fc6b0[_0xb0a4('0x50')]['id']['toString']())))[_0xb0a4('0x8b')]();break;default:_0x21f49b=squel[_0xb0a4('0xa2')]()[_0xb0a4('0xb1')](_0xb0a4('0xa3'))[_0xb0a4('0xb2')](['phone',_0xb0a4('0xa8'),_0xb0a4('0xa4'),_0xb0a4('0xa5'),_0xb0a4('0x63'),'createdAt',_0xb0a4('0x5c')],squel[_0xb0a4('0x82')]()['field']('phone','phone')[_0xb0a4('0xa6')](_0xb0a4('0xaa'),'scheduledAt')[_0xb0a4('0xa6')]('id',_0xb0a4('0xa4'))['field'](_0x3ae10f[_0xb0a4('0xa9')][_0xb0a4('0x8b')](),_0xb0a4('0xa5'))['field'](_0x3fc6b0[_0xb0a4('0x50')]['id'][_0xb0a4('0x8b')](),_0xb0a4('0x63'))['field'](_0xb0a4('0xaa'),_0xb0a4('0x5f'))[_0xb0a4('0xa6')]('NOW()',_0xb0a4('0x5c'))['from'](_0xb0a4('0xab'))[_0xb0a4('0x48')]('deletedAt\x20IS\x20NULL')[_0xb0a4('0x48')](_0xb0a4('0xb4'),_0x3ae10f[_0xb0a4('0xa9')][_0xb0a4('0x8b')]())[_0xb0a4('0x48')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x5cc1d6[_0xb0a4('0x8a')](db[_0xb0a4('0x77')][_0xb0a4('0x3f')](_0x21f49b));}return BPromise['all'](_0x5cc1d6);}})['then'](function(){return _0x331874;})[_0xb0a4('0x29')](respondWithResult(_0x458f92,null))['catch'](handleError(_0x458f92,null));};exports[_0xb0a4('0xb6')]=function(_0x324e0c,_0x23590c,_0x486ab4){return db[_0xb0a4('0x4b')][_0xb0a4('0x53')]({'where':{'id':_0x324e0c[_0xb0a4('0x50')]['id']}})[_0xb0a4('0x29')](handleEntityNotFound(_0x23590c,null))[_0xb0a4('0x29')](function(_0x3d2318){if(_0x3d2318){return _0x3d2318[_0xb0a4('0xb6')](_0x324e0c[_0xb0a4('0x3f')]['ids']);}})[_0xb0a4('0x29')](function(_0x266bd9){if(_0x266bd9){return db[_0xb0a4('0x64')][_0xb0a4('0x61')]({'where':{'ListId':_0x324e0c[_0xb0a4('0x3f')]['ids'],'VoiceQueueId':_0x324e0c[_0xb0a4('0x50')]['id']}})[_0xb0a4('0x29')](function(){return _0x266bd9;});}})[_0xb0a4('0x29')](respondWithStatusCode(_0x23590c,null))[_0xb0a4('0x4e')](handleError(_0x23590c,null));};exports['getBlackLists']=function(_0x58b485,_0x441821,_0x43e9ee){var _0x4a80ea={};var _0x4bbd64={};var _0x2e0bc6;var _0x187262;return db['VoiceQueue'][_0xb0a4('0x66')]({'where':{'id':_0x58b485[_0xb0a4('0x50')]['id']}})['then'](handleEntityNotFound(_0x441821,null))[_0xb0a4('0x29')](function(_0x121125){if(_0x121125){_0x2e0bc6=_0x121125;_0x4bbd64[_0xb0a4('0x3e')]=_[_0xb0a4('0x5b')](db[_0xb0a4('0x9d')][_0xb0a4('0x3b')]);_0x4bbd64[_0xb0a4('0x3f')]=_[_0xb0a4('0x5b')](_0x58b485['query']);_0x4bbd64[_0xb0a4('0x40')]=_[_0xb0a4('0x41')](_0x4bbd64[_0xb0a4('0x3e')],_0x4bbd64[_0xb0a4('0x3f')]);_0x4a80ea[_0xb0a4('0x42')]=_[_0xb0a4('0x41')](_0x4bbd64[_0xb0a4('0x3e')],qs[_0xb0a4('0x43')](_0x58b485[_0xb0a4('0x3f')]['fields']));_0x4a80ea[_0xb0a4('0x42')]=_0x4a80ea[_0xb0a4('0x42')][_0xb0a4('0x51')]?_0x4a80ea[_0xb0a4('0x42')]:_0x4bbd64[_0xb0a4('0x3e')];_0x4a80ea[_0xb0a4('0x46')]=qs[_0xb0a4('0x47')](_0x58b485[_0xb0a4('0x3f')][_0xb0a4('0x47')]);_0x4a80ea[_0xb0a4('0x48')]=qs[_0xb0a4('0x40')](_[_0xb0a4('0x62')](_0x58b485[_0xb0a4('0x3f')],_0x4bbd64[_0xb0a4('0x40')]));if(_0x58b485['query'][_0xb0a4('0x2f')]){_0x4a80ea[_0xb0a4('0x48')]=_['merge'](_0x4a80ea[_0xb0a4('0x48')],{'$or':_['map'](_0x4a80ea[_0xb0a4('0x42')],function(_0x902d3c){var _0x274260={};_0x274260[_0x902d3c]={'$like':'%'+_0x58b485['query'][_0xb0a4('0x2f')]+'%'};return _0x274260;})});}_0x4a80ea=_[_0xb0a4('0x49')]({},_0x4a80ea,_0x58b485['options']);return _0x2e0bc6[_0xb0a4('0xb7')](_0x4a80ea);}})['then'](function(_0x4a74b9){if(_0x4a74b9){_0x187262=_0x4a74b9[_0xb0a4('0x51')];if(!_0x58b485[_0xb0a4('0x3f')]['hasOwnProperty']('nolimit')){_0x4a80ea[_0xb0a4('0x21')]=qs[_0xb0a4('0x21')](_0x58b485[_0xb0a4('0x3f')][_0xb0a4('0x21')]);_0x4a80ea['offset']=qs[_0xb0a4('0x20')](_0x58b485[_0xb0a4('0x3f')][_0xb0a4('0x20')]);}return _0x2e0bc6[_0xb0a4('0xb7')](_0x4a80ea);}})[_0xb0a4('0x29')](function(_0x395e86){if(_0x395e86){return _0x395e86?{'count':_0x187262,'rows':_0x395e86}:null;}})[_0xb0a4('0x29')](respondWithResult(_0x441821,null))[_0xb0a4('0x4e')](handleError(_0x441821,null));};exports['addBlackLists']=function(_0x408540,_0x1e2676,_0x17cd22){var _0x18a841,_0x5824a2;return db[_0xb0a4('0x4b')]['find']({'where':{'id':_0x408540[_0xb0a4('0x50')]['id']}})[_0xb0a4('0x29')](handleEntityNotFound(_0x1e2676,null))[_0xb0a4('0x29')](function(_0x43ce01){if(_0x43ce01){_0x5824a2=_0x43ce01;return _0x43ce01[_0xb0a4('0xb8')](_0x408540[_0xb0a4('0x5d')][_0xb0a4('0x81')],_[_0xb0a4('0x5e')](_0x408540[_0xb0a4('0x5d')],[_0xb0a4('0x81'),'id'])||{});}return null;})[_0xb0a4('0x97')](function(_0x96bf22){var _0x522339;_0x18a841=_0x96bf22||[];var _0x292c33=[];if(_0x96bf22){for(var _0x37a323=0x0;_0x37a323<_0x96bf22['length'];_0x37a323+=0x1){var _0x3047e8=_0x96bf22[_0x37a323][_0xb0a4('0x2a')]({'plain':!![]});_0x522339=squel[_0xb0a4('0xa2')]()[_0xb0a4('0xb1')](_0xb0a4('0xb9'))[_0xb0a4('0xb2')]([_0xb0a4('0xa7'),_0xb0a4('0xa4'),_0xb0a4('0xa5'),'VoiceQueueId',_0xb0a4('0x5f'),_0xb0a4('0x5c')],squel[_0xb0a4('0x82')]()['field'](_0xb0a4('0xa7'),_0xb0a4('0xa7'))['field']('id',_0xb0a4('0xa4'))[_0xb0a4('0xa6')](_0x3047e8[_0xb0a4('0xa9')]['toString'](),_0xb0a4('0xa5'))[_0xb0a4('0xa6')](_0x408540['params']['id'][_0xb0a4('0x8b')](),_0xb0a4('0x63'))[_0xb0a4('0xa6')]('NOW()',_0xb0a4('0x5f'))[_0xb0a4('0xa6')](_0xb0a4('0xaa'),'updatedAt')[_0xb0a4('0x83')](_0xb0a4('0xab'))[_0xb0a4('0x48')]('deletedAt\x20IS\x20NULL')[_0xb0a4('0x48')](_0xb0a4('0xb4'),_0x3047e8['CmListId'][_0xb0a4('0x8b')]())['where'](_0xb0a4('0xb5')))[_0xb0a4('0x8b')]();_0x292c33[_0xb0a4('0x8a')](db[_0xb0a4('0x77')][_0xb0a4('0x3f')](_0x522339));}return BPromise[_0xb0a4('0x90')](_0x292c33);}})['then'](function(){return _0x18a841;})[_0xb0a4('0x29')](respondWithResult(_0x1e2676,null))['catch'](handleError(_0x1e2676,null));};exports[_0xb0a4('0xba')]=function(_0x1f370f,_0x5ff369,_0x3e0ce9){return db[_0xb0a4('0x4b')][_0xb0a4('0x53')]({'where':{'id':_0x1f370f[_0xb0a4('0x50')]['id']}})[_0xb0a4('0x29')](handleEntityNotFound(_0x5ff369,null))['then'](function(_0x230c72){if(_0x230c72){return _0x230c72[_0xb0a4('0xba')](_0x1f370f[_0xb0a4('0x3f')][_0xb0a4('0x81')]);}})[_0xb0a4('0x29')](function(_0x22daf6){if(_0x22daf6){return db[_0xb0a4('0x6b')][_0xb0a4('0x61')]({'where':{'ListId':_0x1f370f[_0xb0a4('0x3f')][_0xb0a4('0x81')],'VoiceQueueId':_0x1f370f[_0xb0a4('0x50')]['id']}})[_0xb0a4('0x29')](function(){return _0x22daf6;});}})['then'](respondWithStatusCode(_0x5ff369,null))[_0xb0a4('0x4e')](handleError(_0x5ff369,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 6a6a2bf..c8f2612 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 _0xa449=['VoiceQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x43244f,_0x1929f2){var _0x856cd7=function(_0x354e49){while(--_0x354e49){_0x43244f['push'](_0x43244f['shift']());}};_0x856cd7(++_0x1929f2);}(_0xa449,0x77));var _0x9a44=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xa449[_0x42cae2];return _0x5f256f;};'use strict';var EventEmitter=require(_0x9a44('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x9a44('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x9a44('0x2')](0x0);var events={'afterCreate':_0x9a44('0x3'),'afterUpdate':_0x9a44('0x4'),'afterDestroy':_0x9a44('0x5')};function emitEvent(_0x8222b8){return function(_0x229c7d,_0x4b3270,_0x487f37){VoiceQueueEvents['emit'](_0x8222b8+':'+_0x229c7d['id'],_0x229c7d);VoiceQueueEvents[_0x9a44('0x6')](_0x8222b8,_0x229c7d);_0x487f37(null);};}for(var e in events){if(events[_0x9a44('0x7')](e)){var event=events[e];VoiceQueue[_0x9a44('0x8')](e,emitEvent(event));}}module[_0x9a44('0x9')]=VoiceQueueEvents; \ No newline at end of file +var _0xa6c9=['events','../../mysqldb','VoiceQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa6c9,0x19e));var _0x9a6c=function(_0x198b1f,_0xcf168d){_0x198b1f=_0x198b1f-0x0;var _0x26d8de=_0xa6c9[_0x198b1f];return _0x26d8de;};'use strict';var EventEmitter=require(_0x9a6c('0x0'));var VoiceQueue=require(_0x9a6c('0x1'))['db'][_0x9a6c('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x9a6c('0x3')](0x0);var events={'afterCreate':_0x9a6c('0x4'),'afterUpdate':_0x9a6c('0x5'),'afterDestroy':_0x9a6c('0x6')};function emitEvent(_0x2bcd35){return function(_0x4e08ba,_0x1696ca,_0x34e8dc){VoiceQueueEvents[_0x9a6c('0x7')](_0x2bcd35+':'+_0x4e08ba['id'],_0x4e08ba);VoiceQueueEvents[_0x9a6c('0x7')](_0x2bcd35,_0x4e08ba);_0x34e8dc(null);};}for(var e in events){if(events[_0x9a6c('0x8')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index affe684..b96a5d2 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 _0xb44e=['./voiceQueue.attributes','define','voice_queues','util','../../config/logger','api','moment','path','rimraf'];(function(_0x5afb97,_0x42d4ef){var _0xe497fc=function(_0x36cf69){while(--_0x36cf69){_0x5afb97['push'](_0x5afb97['shift']());}};_0xe497fc(++_0x42d4ef);}(_0xb44e,0x93));var _0xeb44=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xb44e[_0x139a3c];return _0x2b375b;};'use strict';var _=require('lodash');var util=require(_0xeb44('0x0'));var logger=require(_0xeb44('0x1'))(_0xeb44('0x2'));var moment=require(_0xeb44('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeb44('0x4'));var rimraf=require(_0xeb44('0x5'));var config=require('../../config/environment');var attributes=require(_0xeb44('0x6'));module['exports']=function(_0x23d265,_0x5986a2){return _0x23d265[_0xeb44('0x7')]('VoiceQueue',attributes,{'tableName':_0xeb44('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x680a=['request-promise','rimraf','define','VoiceQueue','voice_queues','util','api','moment','bluebird'];(function(_0x132399,_0x1c4b0f){var _0x2a27e9=function(_0x4eac3b){while(--_0x4eac3b){_0x132399['push'](_0x132399['shift']());}};_0x2a27e9(++_0x1c4b0f);}(_0x680a,0x191));var _0xa680=function(_0x1a3aca,_0x345088){_0x1a3aca=_0x1a3aca-0x0;var _0x216226=_0x680a[_0x1a3aca];return _0x216226;};'use strict';var _=require('lodash');var util=require(_0xa680('0x0'));var logger=require('../../config/logger')(_0xa680('0x1'));var moment=require(_0xa680('0x2'));var BPromise=require(_0xa680('0x3'));var rp=require(_0xa680('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa680('0x5'));var config=require('../../config/environment');var attributes=require('./voiceQueue.attributes');module['exports']=function(_0x49316b,_0x3c9813){return _0x49316b[_0xa680('0x6')](_0xa680('0x7'),attributes,{'tableName':_0xa680('0x8'),'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 07cdef5..f21612d 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 _0xec90=['where','ShowVoiceQueue','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','GetVoiceQueue','findAll','options','limit','include','map','model','attributes','VoiceQueue','find','raw'];(function(_0x5e2a54,_0x424ad7){var _0x1c8b6b=function(_0x718a9b){while(--_0x718a9b){_0x5e2a54['push'](_0x5e2a54['shift']());}};_0x1c8b6b(++_0x424ad7);}(_0xec90,0x19c));var _0x0ec9=function(_0x5db65f,_0xf89cc8){_0x5db65f=_0x5db65f-0x0;var _0x34fb4b=_0xec90[_0x5db65f];return _0x34fb4b;};'use strict';var _=require(_0x0ec9('0x0'));var util=require(_0x0ec9('0x1'));var moment=require('moment');var BPromise=require(_0x0ec9('0x2'));var rs=require(_0x0ec9('0x3'));var fs=require('fs');var Redis=require(_0x0ec9('0x4'));var db=require(_0x0ec9('0x5'))['db'];var utils=require(_0x0ec9('0x6'));var logger=require(_0x0ec9('0x7'))(_0x0ec9('0x8'));var config=require(_0x0ec9('0x9'));var jayson=require(_0x0ec9('0xa'));var client=jayson[_0x0ec9('0xb')][_0x0ec9('0xc')]({'port':0x232a});config[_0x0ec9('0xd')]=_['defaults'](config[_0x0ec9('0xd')],{'host':_0x0ec9('0xe'),'port':0x18eb});var socket=require(_0x0ec9('0xf'))(new Redis(config[_0x0ec9('0xd')]));require(_0x0ec9('0x10'))[_0x0ec9('0x11')](socket);function respondWithRpcPromise(_0x1fa591,_0x3d3553,_0x1d025f){return new BPromise(function(_0x350a2f,_0xfd3ffa){return client['request'](_0x1fa591,_0x1d025f)[_0x0ec9('0x12')](function(_0xd25438){logger['info'](_0x0ec9('0x13'),_0x3d3553,_0x0ec9('0x14'));logger[_0x0ec9('0x15')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x3d3553,'request\x20sent',JSON[_0x0ec9('0x16')](_0xd25438));if(_0xd25438[_0x0ec9('0x17')]){if(_0xd25438[_0x0ec9('0x17')][_0x0ec9('0x18')]===0x1f4){logger['error'](_0x0ec9('0x13'),_0x3d3553,_0xd25438['error'][_0x0ec9('0x19')]);return _0xfd3ffa(_0xd25438['error'][_0x0ec9('0x19')]);}logger[_0x0ec9('0x17')](_0x0ec9('0x13'),_0x3d3553,_0xd25438['error'][_0x0ec9('0x19')]);return _0x350a2f(_0xd25438[_0x0ec9('0x17')][_0x0ec9('0x19')]);}else{logger[_0x0ec9('0x1a')](_0x0ec9('0x13'),_0x3d3553,_0x0ec9('0x14'));_0x350a2f(_0xd25438['result'][_0x0ec9('0x19')]);}})[_0x0ec9('0x1b')](function(_0x11e60f){logger[_0x0ec9('0x17')]('VoiceQueue,\x20%s,\x20%s',_0x3d3553,_0x11e60f);_0xfd3ffa(_0x11e60f);});});}exports[_0x0ec9('0x1c')]=function(_0x1acd72){var _0x34ca0d=this;return new Promise(function(_0xfad2bc,_0x2a711f){return db['VoiceQueue'][_0x0ec9('0x1d')]({'raw':_0x1acd72[_0x0ec9('0x1e')]?_0x1acd72[_0x0ec9('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x1acd72[_0x0ec9('0x1e')]?_0x1acd72[_0x0ec9('0x1e')]['where']||null:null,'attributes':_0x1acd72['options']?_0x1acd72[_0x0ec9('0x1e')]['attributes']||null:null,'limit':_0x1acd72[_0x0ec9('0x1e')]?_0x1acd72[_0x0ec9('0x1e')][_0x0ec9('0x1f')]||null:null,'include':_0x1acd72['options']?_0x1acd72[_0x0ec9('0x1e')][_0x0ec9('0x20')]?_['map'](_0x1acd72['options'][_0x0ec9('0x20')],function(_0x50fb2c){return{'model':db[_0x50fb2c['model']],'as':_0x50fb2c['as'],'attributes':_0x50fb2c['attributes'],'include':_0x50fb2c[_0x0ec9('0x20')]?_[_0x0ec9('0x21')](_0x50fb2c[_0x0ec9('0x20')],function(_0x291b7b){return{'model':db[_0x291b7b[_0x0ec9('0x22')]],'as':_0x291b7b['as'],'attributes':_0x291b7b[_0x0ec9('0x23')],'include':_0x291b7b['include']?_[_0x0ec9('0x21')](_0x291b7b[_0x0ec9('0x20')],function(_0x4ad686){return{'model':db[_0x4ad686['model']],'as':_0x4ad686['as'],'attributes':_0x4ad686[_0x0ec9('0x23')]};}):[]};}):[]};}):[]:[]})[_0x0ec9('0x12')](function(_0x2697cf){logger[_0x0ec9('0x1a')]('GetVoiceQueue',_0x1acd72);logger['debug'](_0x0ec9('0x1c'),_0x1acd72,JSON[_0x0ec9('0x16')](_0x2697cf));_0xfad2bc(_0x2697cf);})[_0x0ec9('0x1b')](function(_0xdc438e){logger[_0x0ec9('0x17')](_0x0ec9('0x1c'),_0xdc438e[_0x0ec9('0x19')],_0x1acd72);_0x2a711f(_0x34ca0d['error'](0x1f4,_0xdc438e[_0x0ec9('0x19')]));});});};exports['ShowVoiceQueue']=function(_0x5a0ef4){var _0x1c142b=this;return new Promise(function(_0x1ed10c,_0xc6855a){return db[_0x0ec9('0x24')][_0x0ec9('0x25')]({'raw':_0x5a0ef4['options']?_0x5a0ef4[_0x0ec9('0x1e')][_0x0ec9('0x26')]===undefined?!![]:![]:!![],'where':_0x5a0ef4[_0x0ec9('0x1e')]?_0x5a0ef4['options'][_0x0ec9('0x27')]||null:null,'attributes':_0x5a0ef4[_0x0ec9('0x1e')]?_0x5a0ef4[_0x0ec9('0x1e')][_0x0ec9('0x23')]||null:null,'include':_0x5a0ef4[_0x0ec9('0x1e')]?_0x5a0ef4[_0x0ec9('0x1e')]['include']?_[_0x0ec9('0x21')](_0x5a0ef4[_0x0ec9('0x1e')]['include'],function(_0x19a0ed){return{'model':db[_0x19a0ed[_0x0ec9('0x22')]],'as':_0x19a0ed['as'],'attributes':_0x19a0ed[_0x0ec9('0x23')],'include':_0x19a0ed[_0x0ec9('0x20')]?_[_0x0ec9('0x21')](_0x19a0ed['include'],function(_0xd7ece4){return{'model':db[_0xd7ece4[_0x0ec9('0x22')]],'as':_0xd7ece4['as'],'attributes':_0xd7ece4[_0x0ec9('0x23')],'include':_0xd7ece4[_0x0ec9('0x20')]?_[_0x0ec9('0x21')](_0xd7ece4['include'],function(_0x110ef6){return{'model':db[_0x110ef6[_0x0ec9('0x22')]],'as':_0x110ef6['as'],'attributes':_0x110ef6[_0x0ec9('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x12f780){logger['info'](_0x0ec9('0x28'),_0x5a0ef4);logger[_0x0ec9('0x15')](_0x0ec9('0x28'),_0x5a0ef4,JSON[_0x0ec9('0x16')](_0x12f780));_0x1ed10c(_0x12f780);})[_0x0ec9('0x1b')](function(_0x39ac6f){logger['error']('ShowVoiceQueue',_0x39ac6f[_0x0ec9('0x19')],_0x5a0ef4);_0xc6855a(_0x1c142b['error'](0x1f4,_0x39ac6f[_0x0ec9('0x19')]));});});}; \ No newline at end of file +var _0xb907=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','raw','options','where','attributes','limit','include','map','model','debug','find','ShowVoiceQueue'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb907,0x158));var _0x7b90=function(_0x445846,_0x1cf586){_0x445846=_0x445846-0x0;var _0x160050=_0xb907[_0x445846];return _0x160050;};'use strict';var _=require(_0x7b90('0x0'));var util=require(_0x7b90('0x1'));var moment=require(_0x7b90('0x2'));var BPromise=require(_0x7b90('0x3'));var rs=require(_0x7b90('0x4'));var fs=require('fs');var Redis=require(_0x7b90('0x5'));var db=require(_0x7b90('0x6'))['db'];var utils=require(_0x7b90('0x7'));var logger=require(_0x7b90('0x8'))(_0x7b90('0x9'));var config=require(_0x7b90('0xa'));var jayson=require(_0x7b90('0xb'));var client=jayson[_0x7b90('0xc')][_0x7b90('0xd')]({'port':0x232a});config[_0x7b90('0xe')]=_['defaults'](config[_0x7b90('0xe')],{'host':_0x7b90('0xf'),'port':0x18eb});var socket=require(_0x7b90('0x10'))(new Redis(config[_0x7b90('0xe')]));require(_0x7b90('0x11'))[_0x7b90('0x12')](socket);function respondWithRpcPromise(_0x269d85,_0x30940a,_0x1159c9){return new BPromise(function(_0x1dcd7b,_0x49895c){return client['request'](_0x269d85,_0x1159c9)[_0x7b90('0x13')](function(_0x2d9190){logger[_0x7b90('0x14')](_0x7b90('0x15'),_0x30940a,_0x7b90('0x16'));logger['debug'](_0x7b90('0x17'),_0x30940a,_0x7b90('0x16'),JSON[_0x7b90('0x18')](_0x2d9190));if(_0x2d9190[_0x7b90('0x19')]){if(_0x2d9190[_0x7b90('0x19')]['code']===0x1f4){logger[_0x7b90('0x19')](_0x7b90('0x15'),_0x30940a,_0x2d9190[_0x7b90('0x19')][_0x7b90('0x1a')]);return _0x49895c(_0x2d9190['error'][_0x7b90('0x1a')]);}logger[_0x7b90('0x19')](_0x7b90('0x15'),_0x30940a,_0x2d9190[_0x7b90('0x19')]['message']);return _0x1dcd7b(_0x2d9190[_0x7b90('0x19')]['message']);}else{logger[_0x7b90('0x14')](_0x7b90('0x15'),_0x30940a,_0x7b90('0x16'));_0x1dcd7b(_0x2d9190[_0x7b90('0x1b')][_0x7b90('0x1a')]);}})[_0x7b90('0x1c')](function(_0x3947bb){logger[_0x7b90('0x19')](_0x7b90('0x15'),_0x30940a,_0x3947bb);_0x49895c(_0x3947bb);});});}exports[_0x7b90('0x1d')]=function(_0x2f461b){var _0x77b22d=this;return new Promise(function(_0x537e00,_0x120396){return db[_0x7b90('0x1e')][_0x7b90('0x1f')]({'raw':_0x2f461b['options']?_0x2f461b['options'][_0x7b90('0x20')]===undefined?!![]:![]:!![],'where':_0x2f461b[_0x7b90('0x21')]?_0x2f461b['options'][_0x7b90('0x22')]||null:null,'attributes':_0x2f461b['options']?_0x2f461b[_0x7b90('0x21')][_0x7b90('0x23')]||null:null,'limit':_0x2f461b[_0x7b90('0x21')]?_0x2f461b[_0x7b90('0x21')][_0x7b90('0x24')]||null:null,'include':_0x2f461b[_0x7b90('0x21')]?_0x2f461b[_0x7b90('0x21')][_0x7b90('0x25')]?_[_0x7b90('0x26')](_0x2f461b[_0x7b90('0x21')][_0x7b90('0x25')],function(_0xb479c5){return{'model':db[_0xb479c5['model']],'as':_0xb479c5['as'],'attributes':_0xb479c5['attributes'],'include':_0xb479c5[_0x7b90('0x25')]?_[_0x7b90('0x26')](_0xb479c5[_0x7b90('0x25')],function(_0x1f3157){return{'model':db[_0x1f3157['model']],'as':_0x1f3157['as'],'attributes':_0x1f3157[_0x7b90('0x23')],'include':_0x1f3157[_0x7b90('0x25')]?_[_0x7b90('0x26')](_0x1f3157['include'],function(_0x520bec){return{'model':db[_0x520bec[_0x7b90('0x27')]],'as':_0x520bec['as'],'attributes':_0x520bec['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1adc16){logger['info'](_0x7b90('0x1d'),_0x2f461b);logger[_0x7b90('0x28')]('GetVoiceQueue',_0x2f461b,JSON[_0x7b90('0x18')](_0x1adc16));_0x537e00(_0x1adc16);})[_0x7b90('0x1c')](function(_0x12e41d){logger['error'](_0x7b90('0x1d'),_0x12e41d[_0x7b90('0x1a')],_0x2f461b);_0x120396(_0x77b22d['error'](0x1f4,_0x12e41d[_0x7b90('0x1a')]));});});};exports['ShowVoiceQueue']=function(_0x2e7166){var _0x24eefd=this;return new Promise(function(_0x31830a,_0x4690db){return db[_0x7b90('0x1e')][_0x7b90('0x29')]({'raw':_0x2e7166[_0x7b90('0x21')]?_0x2e7166[_0x7b90('0x21')][_0x7b90('0x20')]===undefined?!![]:![]:!![],'where':_0x2e7166[_0x7b90('0x21')]?_0x2e7166[_0x7b90('0x21')][_0x7b90('0x22')]||null:null,'attributes':_0x2e7166[_0x7b90('0x21')]?_0x2e7166['options']['attributes']||null:null,'include':_0x2e7166[_0x7b90('0x21')]?_0x2e7166['options'][_0x7b90('0x25')]?_[_0x7b90('0x26')](_0x2e7166[_0x7b90('0x21')]['include'],function(_0x1cc976){return{'model':db[_0x1cc976[_0x7b90('0x27')]],'as':_0x1cc976['as'],'attributes':_0x1cc976['attributes'],'include':_0x1cc976[_0x7b90('0x25')]?_['map'](_0x1cc976[_0x7b90('0x25')],function(_0x496fd7){return{'model':db[_0x496fd7[_0x7b90('0x27')]],'as':_0x496fd7['as'],'attributes':_0x496fd7[_0x7b90('0x23')],'include':_0x496fd7[_0x7b90('0x25')]?_[_0x7b90('0x26')](_0x496fd7[_0x7b90('0x25')],function(_0x2b173f){return{'model':db[_0x2b173f[_0x7b90('0x27')]],'as':_0x2b173f['as'],'attributes':_0x2b173f[_0x7b90('0x23')]};}):[]};}):[]};}):[]:[]})[_0x7b90('0x13')](function(_0x391fc5){logger[_0x7b90('0x14')](_0x7b90('0x2a'),_0x2e7166);logger[_0x7b90('0x28')]('ShowVoiceQueue',_0x2e7166,JSON['stringify'](_0x391fc5));_0x31830a(_0x391fc5);})[_0x7b90('0x1c')](function(_0x57c2d4){logger[_0x7b90('0x19')](_0x7b90('0x2a'),_0x57c2d4['message'],_0x2e7166);_0x4690db(_0x24eefd[_0x7b90('0x19')](0x1f4,_0x57c2d4['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 9985305..1706dd2 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 _0x7473=['removeListener','register','voiceQueue:','save','remove','update','emit'];(function(_0x14bee3,_0x1fcfb9){var _0x3e9bcc=function(_0x2910b1){while(--_0x2910b1){_0x14bee3['push'](_0x14bee3['shift']());}};_0x3e9bcc(++_0x1fcfb9);}(_0x7473,0xce));var _0x3747=function(_0x4dabd6,_0x488af6){_0x4dabd6=_0x4dabd6-0x0;var _0x2d7ef5=_0x7473[_0x4dabd6];return _0x2d7ef5;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x3747('0x0'),_0x3747('0x1'),_0x3747('0x2')];function createListener(_0x281c34,_0x5e7d10){return function(_0x3c4403){_0x5e7d10[_0x3747('0x3')](_0x281c34,_0x3c4403);};}function removeListener(_0x18ba98,_0x4268d9){return function(){VoiceQueueEvents[_0x3747('0x4')](_0x18ba98,_0x4268d9);};}exports[_0x3747('0x5')]=function(_0x182da1){for(var _0x23e123=0x0,_0xe543e6=events['length'];_0x23e123<_0xe543e6;_0x23e123++){var _0x1d989a=events[_0x23e123];var _0x3cfe1e=createListener(_0x3747('0x6')+_0x1d989a,_0x182da1);VoiceQueueEvents['on'](_0x1d989a,_0x3cfe1e);}}; \ No newline at end of file +var _0xd136=['voiceQueue:','save','remove','emit','removeListener','register','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd136,0x94));var _0x6d13=function(_0x477f70,_0x560b97){_0x477f70=_0x477f70-0x0;var _0x72688b=_0xd136[_0x477f70];return _0x72688b;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x6d13('0x0'),_0x6d13('0x1'),'update'];function createListener(_0x56824,_0x2d8f30){return function(_0x12b9d6){_0x2d8f30[_0x6d13('0x2')](_0x56824,_0x12b9d6);};}function removeListener(_0xec09ab,_0x387947){return function(){VoiceQueueEvents[_0x6d13('0x3')](_0xec09ab,_0x387947);};}exports[_0x6d13('0x4')]=function(_0x147026){for(var _0x4aabef=0x0,_0x335482=events[_0x6d13('0x5')];_0x4aabef<_0x335482;_0x4aabef++){var _0x4c563a=events[_0x4aabef];var _0x598021=createListener(_0x6d13('0x6')+_0x4c563a,_0x147026);VoiceQueueEvents['on'](_0x4c563a,_0x598021);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 1fd51d4..9ab7bdb 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 _0x4819=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','index','isAuthenticated','describe','/index','post','create','put','/:id','update','delete','exports','util','path','connect-timeout','express','Router'];(function(_0x1d39f6,_0x146f4a){var _0x3dbd7a=function(_0x4486f2){while(--_0x4486f2){_0x1d39f6['push'](_0x1d39f6['shift']());}};_0x3dbd7a(++_0x146f4a);}(_0x4819,0xcd));var _0x9481=function(_0x204a28,_0x359c57){_0x204a28=_0x204a28-0x0;var _0x2d8e3d=_0x4819[_0x204a28];return _0x2d8e3d;};'use strict';var multer=require('multer');var util=require(_0x9481('0x0'));var path=require(_0x9481('0x1'));var timeout=require(_0x9481('0x2'));var express=require(_0x9481('0x3'));var router=express[_0x9481('0x4')]();var auth=require(_0x9481('0x5'));var interaction=require(_0x9481('0x6'));var config=require(_0x9481('0x7'));var controller=require(_0x9481('0x8'));router[_0x9481('0x9')]('/',auth['isAuthenticated'](),controller[_0x9481('0xa')]);router['get']('/describe',auth[_0x9481('0xb')](),controller[_0x9481('0xc')]);router[_0x9481('0x9')](_0x9481('0xd'),auth[_0x9481('0xb')](),controller['getVoiceQueuesReport']);router[_0x9481('0x9')]('/:id',auth[_0x9481('0xb')](),controller['show']);router[_0x9481('0xe')]('/',auth[_0x9481('0xb')](),controller[_0x9481('0xf')]);router[_0x9481('0x10')](_0x9481('0x11'),auth[_0x9481('0xb')](),controller[_0x9481('0x12')]);router[_0x9481('0x13')](_0x9481('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x9481('0x14')]=router; \ No newline at end of file +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(_0x170673,_0x16fe08){var _0x15c4b3=function(_0x14e897){while(--_0x14e897){_0x170673['push'](_0x170673['shift']());}};_0x15c4b3(++_0x16fe08);}(_0xed1c,0xe4));var _0xced1=function(_0x3d0a31,_0x41ec7f){_0x3d0a31=_0x3d0a31-0x0;var _0x338c4a=_0xed1c[_0x3d0a31];return _0x338c4a;};'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 diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index e738ec1..74949bc 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 _0xa833=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0xa833,0x139));var _0x3a83=function(_0xef243c,_0xcab725){_0xef243c=_0xef243c-0x0;var _0x76a8d7=_0xa833[_0xef243c];return _0x76a8d7;};'use strict';var Sequelize=require(_0x3a83('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0x3a83('0x1')]},'uniqueid':{'type':Sequelize[_0x3a83('0x1')]},'calleridnum':{'type':Sequelize[_0x3a83('0x1')]},'calleridname':{'type':Sequelize[_0x3a83('0x1')]},'queue':{'type':Sequelize[_0x3a83('0x1')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x3a83('0x2')],'set':function(_0x492929){var _0x18176e=moment(_0x492929);var _0x1a5b41=moment(this['getDataValue']('queuecallerjoinAt'))['format'](_0x3a83('0x3'));var _0x49c9e2=_0x18176e[_0x3a83('0x4')](_0x1a5b41,_0x3a83('0x5'));this[_0x3a83('0x6')](_0x3a83('0x7'),_0x492929);this[_0x3a83('0x6')](_0x3a83('0x8'),_0x49c9e2||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x3a83('0x9')]},'queuecallerabandon':{'type':Sequelize[_0x3a83('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x3a83('0x2')]},'queuecallercomplete':{'type':Sequelize[_0x3a83('0xa')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x3a83('0x2')]},'queuecallerexit':{'type':Sequelize[_0x3a83('0xa')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x3a83('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0x3a83('0x1')],'comment':_0x3a83('0xb')},'originalposition':{'type':Sequelize[_0x3a83('0x9')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x3a83('0x1')]},'connectedlinename':{'type':Sequelize[_0x3a83('0x1')]},'accountcode':{'type':Sequelize[_0x3a83('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x3a83('0x1')]},'priority':{'type':Sequelize[_0x3a83('0x1')]},'holdtime':{'type':Sequelize[_0x3a83('0x9')]},'mohtime':{'type':Sequelize[_0x3a83('0x9')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x3a83('0x1')]},'transfer':{'type':Sequelize[_0x3a83('0xa')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x3a83('0x1')],'comment':_0x3a83('0xc')},'transferexten':{'type':Sequelize[_0x3a83('0x1')]},'transferuniqueid':{'type':Sequelize[_0x3a83('0x1')]},'disposition':{'type':Sequelize[_0x3a83('0x1')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd5c8=['diff','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xd5c8,0x166));var _0x8d5c=function(_0x3ba566,_0x5e009d){_0x3ba566=_0x3ba566-0x0;var _0x480317=_0xd5c8[_0x3ba566];return _0x480317;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x8d5c('0x0')]={'type':{'type':Sequelize[_0x8d5c('0x1')]},'uniqueid':{'type':Sequelize[_0x8d5c('0x1')]},'calleridnum':{'type':Sequelize[_0x8d5c('0x1')]},'calleridname':{'type':Sequelize[_0x8d5c('0x1')]},'queue':{'type':Sequelize[_0x8d5c('0x1')]},'queuecallerjoinAt':{'type':Sequelize[_0x8d5c('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0x8d5c('0x2')],'set':function(_0x885e2){var _0x5c11b0=moment(_0x885e2);var _0xd72ba3=moment(this['getDataValue']('queuecallerjoinAt'))[_0x8d5c('0x3')](_0x8d5c('0x4'));var _0x1ed3e9=_0x5c11b0[_0x8d5c('0x5')](_0xd72ba3,'seconds');this['setDataValue'](_0x8d5c('0x6'),_0x885e2);this['setDataValue'](_0x8d5c('0x7'),_0x1ed3e9||null);}},'position':{'type':Sequelize[_0x8d5c('0x8')]},'count':{'type':Sequelize[_0x8d5c('0x8')]},'queuecallerabandon':{'type':Sequelize[_0x8d5c('0x9')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x8d5c('0x2')]},'queuecallercomplete':{'type':Sequelize[_0x8d5c('0x9')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x8d5c('0x2')]},'queuecallerexit':{'type':Sequelize[_0x8d5c('0x9')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x8d5c('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0x8d5c('0x1')],'comment':_0x8d5c('0xa')},'originalposition':{'type':Sequelize[_0x8d5c('0x8')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x8d5c('0x1')]},'connectedlinename':{'type':Sequelize[_0x8d5c('0x1')]},'accountcode':{'type':Sequelize[_0x8d5c('0x1')]},'context':{'type':Sequelize[_0x8d5c('0x1')]},'exten':{'type':Sequelize[_0x8d5c('0x1')]},'priority':{'type':Sequelize[_0x8d5c('0x1')]},'holdtime':{'type':Sequelize[_0x8d5c('0x8')]},'mohtime':{'type':Sequelize[_0x8d5c('0x8')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x8d5c('0x1')]},'transfer':{'type':Sequelize[_0x8d5c('0x9')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x8d5c('0x1')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'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 017d5ca..1f9442f 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.controller.js +++ b/server/api/voiceQueueReport/voiceQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','offset','set','json','apply','reject','save','update','then','destroy','stack','name','send','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','filter','options','VoiceQueueReport','count','include','catch','show','params','keys','length','includeAll','find','create','body','describe','getVoiceQueuesReport','fields','limit','rows','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];config[_0x7995('0x1a')]=_[_0x7995('0x1b')](config[_0x7995('0x1a')],{'host':_0x7995('0x1c'),'port':0x18eb});var socket=require(_0x7995('0x1d'))(new Redis(config[_0x7995('0x1a')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x2b4e94,_0x2233dd){_0x2233dd=_0x2233dd||0xcc;return function(_0x24b5bb){if(_0x24b5bb){return _0x2b4e94[_0x7995('0x1e')](_0x2233dd);}return _0x2b4e94[_0x7995('0x1f')](_0x2233dd)[_0x7995('0x20')]();};}function respondWithResult(_0x2202ce,_0x41cbf0){_0x41cbf0=_0x41cbf0||0xc8;return function(_0x5377e5){if(_0x5377e5){return _0x2202ce[_0x7995('0x1f')](_0x41cbf0)['json'](_0x5377e5);}};}function respondWithFilteredResult(_0x2f832e,_0x37f297){return function(_0x43d4b8){if(_0x43d4b8){var _0x291317=_0x43d4b8['count'],_0x1e1415=_0x37f297[_0x7995('0x21')],_0x37a7d4=_0x37f297['offset']+_0x37f297['limit'],_0x4faa60;if(_0x37a7d4>=_0x291317){_0x37a7d4=_0x291317;_0x4faa60=0xc8;}else{_0x4faa60=0xce;}_0x2f832e[_0x7995('0x1f')](_0x4faa60);return _0x2f832e[_0x7995('0x22')]('Content-Range',_0x1e1415+'-'+_0x37a7d4+'/'+_0x291317)[_0x7995('0x23')](_0x43d4b8);}return null;};}function patchUpdates(_0x51f276){return function(_0x4b1a8e){try{jsonpatch[_0x7995('0x24')](_0x4b1a8e,_0x51f276,!![]);}catch(_0x327b1f){return BPromise[_0x7995('0x25')](_0x327b1f);}return _0x4b1a8e[_0x7995('0x26')]();};}function saveUpdates(_0x460924,_0x1c278a){return function(_0x5d40ae){if(_0x5d40ae){return _0x5d40ae[_0x7995('0x27')](_0x460924)[_0x7995('0x28')](function(_0x204507){return _0x204507;});}return null;};}function removeEntity(_0x285437,_0x563799){return function(_0x13bc35){if(_0x13bc35){return _0x13bc35[_0x7995('0x29')]()[_0x7995('0x28')](function(){_0x285437['status'](0xcc)[_0x7995('0x20')]();});}};}function handleEntityNotFound(_0x34e70c,_0x401dc3){return function(_0x268ce7){if(!_0x268ce7){_0x34e70c[_0x7995('0x1e')](0x194);}return _0x268ce7;};}function handleError(_0x2a307e,_0x56691a){_0x56691a=_0x56691a||0x1f4;return function(_0x47625f){logger['error'](_0x47625f[_0x7995('0x2a')]);if(_0x47625f[_0x7995('0x2b')]){delete _0x47625f[_0x7995('0x2b')];}_0x2a307e[_0x7995('0x1f')](_0x56691a)[_0x7995('0x2c')](_0x47625f);};}exports['index']=function(_0x9b2a15,_0x514445){var _0x456a28={},_0x3250e0={},_0x4253e5={'count':0x0,'rows':[]};var _0x574574=_['map'](db['VoiceQueueReport'][_0x7995('0x2d')],function(_0xe6b0b3){return{'name':_0xe6b0b3[_0x7995('0x2e')],'type':_0xe6b0b3[_0x7995('0x2f')][_0x7995('0x30')]};});_0x3250e0[_0x7995('0x31')]=_['map'](_0x574574,'name');_0x3250e0[_0x7995('0x32')]=_['keys'](_0x9b2a15[_0x7995('0x32')]);_0x3250e0[_0x7995('0x33')]=_[_0x7995('0x34')](_0x3250e0[_0x7995('0x31')],_0x3250e0[_0x7995('0x32')]);_0x456a28['attributes']=_[_0x7995('0x34')](_0x3250e0[_0x7995('0x31')],qs['fields'](_0x9b2a15['query']['fields']));_0x456a28[_0x7995('0x35')]=_0x456a28[_0x7995('0x35')]['length']?_0x456a28[_0x7995('0x35')]:_0x3250e0['model'];if(!_0x9b2a15[_0x7995('0x32')][_0x7995('0x36')](_0x7995('0x37'))){_0x456a28['limit']=qs['limit'](_0x9b2a15[_0x7995('0x32')]['limit']);_0x456a28['offset']=qs[_0x7995('0x21')](_0x9b2a15[_0x7995('0x32')]['offset']);}_0x456a28[_0x7995('0x38')]=qs[_0x7995('0x39')](_0x9b2a15[_0x7995('0x32')][_0x7995('0x39')]);_0x456a28[_0x7995('0x3a')]=qs['filters'](_[_0x7995('0x3b')](_0x9b2a15[_0x7995('0x32')],_0x3250e0[_0x7995('0x33')]),_0x574574);if(_0x9b2a15[_0x7995('0x32')]['filter']){_0x456a28[_0x7995('0x3a')]=_[_0x7995('0x3c')](_0x456a28[_0x7995('0x3a')],{'$or':_[_0x7995('0x3d')](_0x574574,function(_0x1f5bee){if(_0x1f5bee[_0x7995('0x2f')]!=='VIRTUAL'){var _0x183a68={};_0x183a68[_0x1f5bee[_0x7995('0x2b')]]={'$like':'%'+_0x9b2a15[_0x7995('0x32')][_0x7995('0x3e')]+'%'};return _0x183a68;}})});}_0x456a28=_[_0x7995('0x3c')]({},_0x456a28,_0x9b2a15[_0x7995('0x3f')]);var _0x14d638={'where':_0x456a28[_0x7995('0x3a')]};return db[_0x7995('0x40')][_0x7995('0x41')](_0x14d638)[_0x7995('0x28')](function(_0x270d52){_0x4253e5[_0x7995('0x41')]=_0x270d52;if(_0x9b2a15['query']['includeAll']){_0x456a28[_0x7995('0x42')]=[{'all':!![]}];}return db[_0x7995('0x40')]['findAll'](_0x456a28);})['then'](function(_0x3f8522){_0x4253e5['rows']=_0x3f8522;return _0x4253e5;})['then'](respondWithFilteredResult(_0x514445,_0x456a28))[_0x7995('0x43')](handleError(_0x514445,null));};exports[_0x7995('0x44')]=function(_0x35c8ff,_0x576b96){var _0x46ac4f={'raw':![],'where':{'id':_0x35c8ff[_0x7995('0x45')]['id']}},_0x5e85b9={};_0x5e85b9['model']=_['keys'](db[_0x7995('0x40')][_0x7995('0x2d')]);_0x5e85b9[_0x7995('0x32')]=_[_0x7995('0x46')](_0x35c8ff['query']);_0x5e85b9[_0x7995('0x33')]=_[_0x7995('0x34')](_0x5e85b9[_0x7995('0x31')],_0x5e85b9[_0x7995('0x32')]);_0x46ac4f['attributes']=_['intersection'](_0x5e85b9[_0x7995('0x31')],qs['fields'](_0x35c8ff[_0x7995('0x32')]['fields']));_0x46ac4f[_0x7995('0x35')]=_0x46ac4f['attributes'][_0x7995('0x47')]?_0x46ac4f[_0x7995('0x35')]:_0x5e85b9['model'];if(_0x35c8ff[_0x7995('0x32')][_0x7995('0x48')]){_0x46ac4f[_0x7995('0x42')]=[{'all':!![]}];}_0x46ac4f=_[_0x7995('0x3c')]({},_0x46ac4f,_0x35c8ff['options']);return db[_0x7995('0x40')][_0x7995('0x49')](_0x46ac4f)[_0x7995('0x28')](handleEntityNotFound(_0x576b96,null))['then'](respondWithResult(_0x576b96,null))[_0x7995('0x43')](handleError(_0x576b96,null));};exports[_0x7995('0x4a')]=function(_0x511567,_0x3d8ae3){return db[_0x7995('0x40')]['create'](_0x511567[_0x7995('0x4b')],{})[_0x7995('0x28')](respondWithResult(_0x3d8ae3,0xc9))['catch'](handleError(_0x3d8ae3,null));};exports[_0x7995('0x27')]=function(_0x5843ba,_0x1d87f9){if(_0x5843ba[_0x7995('0x4b')]['id']){delete _0x5843ba[_0x7995('0x4b')]['id'];}return db[_0x7995('0x40')][_0x7995('0x49')]({'where':{'id':_0x5843ba[_0x7995('0x45')]['id']}})[_0x7995('0x28')](handleEntityNotFound(_0x1d87f9,null))['then'](saveUpdates(_0x5843ba[_0x7995('0x4b')],null))[_0x7995('0x28')](respondWithResult(_0x1d87f9,null))[_0x7995('0x43')](handleError(_0x1d87f9,null));};exports['destroy']=function(_0x19da63,_0x1fe77e){return db[_0x7995('0x40')]['find']({'where':{'id':_0x19da63['params']['id']}})['then'](handleEntityNotFound(_0x1fe77e,null))[_0x7995('0x28')](removeEntity(_0x1fe77e,null))[_0x7995('0x43')](handleError(_0x1fe77e,null));};exports['describe']=function(_0x1cd85,_0x29f300){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x28')](respondWithResult(_0x29f300,null))['catch'](handleError(_0x29f300,null));};exports[_0x7995('0x4d')]=function(_0x4ab09f,_0x14fe7f){var _0x33c801={},_0x206d2a={},_0x50c7b5={'count':0x0,'rows':[]};_0x206d2a['model']=_['keys'](db['VoiceQueueReport'][_0x7995('0x2d')]);_0x206d2a[_0x7995('0x32')]=_[_0x7995('0x46')](_0x4ab09f[_0x7995('0x32')]);_0x206d2a[_0x7995('0x33')]=_[_0x7995('0x34')](_0x206d2a[_0x7995('0x31')],_0x206d2a[_0x7995('0x32')]);_0x33c801[_0x7995('0x35')]=_[_0x7995('0x34')](_0x206d2a[_0x7995('0x31')],qs[_0x7995('0x4e')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x4e')]));_0x33c801[_0x7995('0x35')]=_0x33c801[_0x7995('0x35')][_0x7995('0x47')]?_0x33c801[_0x7995('0x35')]:_0x206d2a[_0x7995('0x31')];if(!_0x4ab09f['query'][_0x7995('0x36')](_0x7995('0x37'))){_0x33c801[_0x7995('0x4f')]=qs[_0x7995('0x4f')](_0x4ab09f['query']['limit']);_0x33c801[_0x7995('0x21')]=qs[_0x7995('0x21')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x21')]);}_0x33c801['order']=qs[_0x7995('0x39')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x39')]);_0x33c801[_0x7995('0x3a')]=qs['filters'](_['pick'](_0x4ab09f[_0x7995('0x32')],_0x206d2a[_0x7995('0x33')]));if(_0x4ab09f[_0x7995('0x32')][_0x7995('0x3e')]){_0x33c801[_0x7995('0x3a')]=_[_0x7995('0x3c')](_0x33c801[_0x7995('0x3a')],{'$or':_[_0x7995('0x3d')](_0x33c801[_0x7995('0x35')],function(_0x50caf5){var _0x18f230={};_0x18f230[_0x50caf5]={'$like':'%'+_0x4ab09f[_0x7995('0x32')][_0x7995('0x3e')]+'%'};return _0x18f230;})});}_0x33c801=_[_0x7995('0x3c')]({},_0x33c801,_0x4ab09f['options']);var _0x51bf6a={'where':_0x33c801[_0x7995('0x3a')]};return db[_0x7995('0x40')]['count'](_0x51bf6a)[_0x7995('0x28')](function(_0x375fc9){_0x50c7b5[_0x7995('0x41')]=_0x375fc9;if(_0x4ab09f[_0x7995('0x32')][_0x7995('0x48')]){_0x33c801['include']=[{'all':!![]}];}return db[_0x7995('0x40')]['findAll'](_0x33c801);})[_0x7995('0x28')](function(_0xe31dcb){_0x50c7b5[_0x7995('0x50')]=_0xe31dcb;return _0x50c7b5;})[_0x7995('0x28')](respondWithFilteredResult(_0x14fe7f,_0x33c801,_0x7995('0x4d')))[_0x7995('0x43')](handleError(_0x14fe7f,null,_0x7995('0x4d')));}; \ No newline at end of file +var _0x9957=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','offset','set','json','apply','reject','save','update','then','destroy','stack','name','send','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','filter','options','VoiceQueueReport','count','include','catch','show','params','keys','length','includeAll','find','create','body','describe','getVoiceQueuesReport','fields','limit','rows','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];config[_0x7995('0x1a')]=_[_0x7995('0x1b')](config[_0x7995('0x1a')],{'host':_0x7995('0x1c'),'port':0x18eb});var socket=require(_0x7995('0x1d'))(new Redis(config[_0x7995('0x1a')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x2b4e94,_0x2233dd){_0x2233dd=_0x2233dd||0xcc;return function(_0x24b5bb){if(_0x24b5bb){return _0x2b4e94[_0x7995('0x1e')](_0x2233dd);}return _0x2b4e94[_0x7995('0x1f')](_0x2233dd)[_0x7995('0x20')]();};}function respondWithResult(_0x2202ce,_0x41cbf0){_0x41cbf0=_0x41cbf0||0xc8;return function(_0x5377e5){if(_0x5377e5){return _0x2202ce[_0x7995('0x1f')](_0x41cbf0)['json'](_0x5377e5);}};}function respondWithFilteredResult(_0x2f832e,_0x37f297){return function(_0x43d4b8){if(_0x43d4b8){var _0x291317=_0x43d4b8['count'],_0x1e1415=_0x37f297[_0x7995('0x21')],_0x37a7d4=_0x37f297['offset']+_0x37f297['limit'],_0x4faa60;if(_0x37a7d4>=_0x291317){_0x37a7d4=_0x291317;_0x4faa60=0xc8;}else{_0x4faa60=0xce;}_0x2f832e[_0x7995('0x1f')](_0x4faa60);return _0x2f832e[_0x7995('0x22')]('Content-Range',_0x1e1415+'-'+_0x37a7d4+'/'+_0x291317)[_0x7995('0x23')](_0x43d4b8);}return null;};}function patchUpdates(_0x51f276){return function(_0x4b1a8e){try{jsonpatch[_0x7995('0x24')](_0x4b1a8e,_0x51f276,!![]);}catch(_0x327b1f){return BPromise[_0x7995('0x25')](_0x327b1f);}return _0x4b1a8e[_0x7995('0x26')]();};}function saveUpdates(_0x460924,_0x1c278a){return function(_0x5d40ae){if(_0x5d40ae){return _0x5d40ae[_0x7995('0x27')](_0x460924)[_0x7995('0x28')](function(_0x204507){return _0x204507;});}return null;};}function removeEntity(_0x285437,_0x563799){return function(_0x13bc35){if(_0x13bc35){return _0x13bc35[_0x7995('0x29')]()[_0x7995('0x28')](function(){_0x285437['status'](0xcc)[_0x7995('0x20')]();});}};}function handleEntityNotFound(_0x34e70c,_0x401dc3){return function(_0x268ce7){if(!_0x268ce7){_0x34e70c[_0x7995('0x1e')](0x194);}return _0x268ce7;};}function handleError(_0x2a307e,_0x56691a){_0x56691a=_0x56691a||0x1f4;return function(_0x47625f){logger['error'](_0x47625f[_0x7995('0x2a')]);if(_0x47625f[_0x7995('0x2b')]){delete _0x47625f[_0x7995('0x2b')];}_0x2a307e[_0x7995('0x1f')](_0x56691a)[_0x7995('0x2c')](_0x47625f);};}exports['index']=function(_0x9b2a15,_0x514445){var _0x456a28={},_0x3250e0={},_0x4253e5={'count':0x0,'rows':[]};var _0x574574=_['map'](db['VoiceQueueReport'][_0x7995('0x2d')],function(_0xe6b0b3){return{'name':_0xe6b0b3[_0x7995('0x2e')],'type':_0xe6b0b3[_0x7995('0x2f')][_0x7995('0x30')]};});_0x3250e0[_0x7995('0x31')]=_['map'](_0x574574,'name');_0x3250e0[_0x7995('0x32')]=_['keys'](_0x9b2a15[_0x7995('0x32')]);_0x3250e0[_0x7995('0x33')]=_[_0x7995('0x34')](_0x3250e0[_0x7995('0x31')],_0x3250e0[_0x7995('0x32')]);_0x456a28['attributes']=_[_0x7995('0x34')](_0x3250e0[_0x7995('0x31')],qs['fields'](_0x9b2a15['query']['fields']));_0x456a28[_0x7995('0x35')]=_0x456a28[_0x7995('0x35')]['length']?_0x456a28[_0x7995('0x35')]:_0x3250e0['model'];if(!_0x9b2a15[_0x7995('0x32')][_0x7995('0x36')](_0x7995('0x37'))){_0x456a28['limit']=qs['limit'](_0x9b2a15[_0x7995('0x32')]['limit']);_0x456a28['offset']=qs[_0x7995('0x21')](_0x9b2a15[_0x7995('0x32')]['offset']);}_0x456a28[_0x7995('0x38')]=qs[_0x7995('0x39')](_0x9b2a15[_0x7995('0x32')][_0x7995('0x39')]);_0x456a28[_0x7995('0x3a')]=qs['filters'](_[_0x7995('0x3b')](_0x9b2a15[_0x7995('0x32')],_0x3250e0[_0x7995('0x33')]),_0x574574);if(_0x9b2a15[_0x7995('0x32')]['filter']){_0x456a28[_0x7995('0x3a')]=_[_0x7995('0x3c')](_0x456a28[_0x7995('0x3a')],{'$or':_[_0x7995('0x3d')](_0x574574,function(_0x1f5bee){if(_0x1f5bee[_0x7995('0x2f')]!=='VIRTUAL'){var _0x183a68={};_0x183a68[_0x1f5bee[_0x7995('0x2b')]]={'$like':'%'+_0x9b2a15[_0x7995('0x32')][_0x7995('0x3e')]+'%'};return _0x183a68;}})});}_0x456a28=_[_0x7995('0x3c')]({},_0x456a28,_0x9b2a15[_0x7995('0x3f')]);var _0x14d638={'where':_0x456a28[_0x7995('0x3a')]};return db[_0x7995('0x40')][_0x7995('0x41')](_0x14d638)[_0x7995('0x28')](function(_0x270d52){_0x4253e5[_0x7995('0x41')]=_0x270d52;if(_0x9b2a15['query']['includeAll']){_0x456a28[_0x7995('0x42')]=[{'all':!![]}];}return db[_0x7995('0x40')]['findAll'](_0x456a28);})['then'](function(_0x3f8522){_0x4253e5['rows']=_0x3f8522;return _0x4253e5;})['then'](respondWithFilteredResult(_0x514445,_0x456a28))[_0x7995('0x43')](handleError(_0x514445,null));};exports[_0x7995('0x44')]=function(_0x35c8ff,_0x576b96){var _0x46ac4f={'raw':![],'where':{'id':_0x35c8ff[_0x7995('0x45')]['id']}},_0x5e85b9={};_0x5e85b9['model']=_['keys'](db[_0x7995('0x40')][_0x7995('0x2d')]);_0x5e85b9[_0x7995('0x32')]=_[_0x7995('0x46')](_0x35c8ff['query']);_0x5e85b9[_0x7995('0x33')]=_[_0x7995('0x34')](_0x5e85b9[_0x7995('0x31')],_0x5e85b9[_0x7995('0x32')]);_0x46ac4f['attributes']=_['intersection'](_0x5e85b9[_0x7995('0x31')],qs['fields'](_0x35c8ff[_0x7995('0x32')]['fields']));_0x46ac4f[_0x7995('0x35')]=_0x46ac4f['attributes'][_0x7995('0x47')]?_0x46ac4f[_0x7995('0x35')]:_0x5e85b9['model'];if(_0x35c8ff[_0x7995('0x32')][_0x7995('0x48')]){_0x46ac4f[_0x7995('0x42')]=[{'all':!![]}];}_0x46ac4f=_[_0x7995('0x3c')]({},_0x46ac4f,_0x35c8ff['options']);return db[_0x7995('0x40')][_0x7995('0x49')](_0x46ac4f)[_0x7995('0x28')](handleEntityNotFound(_0x576b96,null))['then'](respondWithResult(_0x576b96,null))[_0x7995('0x43')](handleError(_0x576b96,null));};exports[_0x7995('0x4a')]=function(_0x511567,_0x3d8ae3){return db[_0x7995('0x40')]['create'](_0x511567[_0x7995('0x4b')],{})[_0x7995('0x28')](respondWithResult(_0x3d8ae3,0xc9))['catch'](handleError(_0x3d8ae3,null));};exports[_0x7995('0x27')]=function(_0x5843ba,_0x1d87f9){if(_0x5843ba[_0x7995('0x4b')]['id']){delete _0x5843ba[_0x7995('0x4b')]['id'];}return db[_0x7995('0x40')][_0x7995('0x49')]({'where':{'id':_0x5843ba[_0x7995('0x45')]['id']}})[_0x7995('0x28')](handleEntityNotFound(_0x1d87f9,null))['then'](saveUpdates(_0x5843ba[_0x7995('0x4b')],null))[_0x7995('0x28')](respondWithResult(_0x1d87f9,null))[_0x7995('0x43')](handleError(_0x1d87f9,null));};exports['destroy']=function(_0x19da63,_0x1fe77e){return db[_0x7995('0x40')]['find']({'where':{'id':_0x19da63['params']['id']}})['then'](handleEntityNotFound(_0x1fe77e,null))[_0x7995('0x28')](removeEntity(_0x1fe77e,null))[_0x7995('0x43')](handleError(_0x1fe77e,null));};exports['describe']=function(_0x1cd85,_0x29f300){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x28')](respondWithResult(_0x29f300,null))['catch'](handleError(_0x29f300,null));};exports[_0x7995('0x4d')]=function(_0x4ab09f,_0x14fe7f){var _0x33c801={},_0x206d2a={},_0x50c7b5={'count':0x0,'rows':[]};_0x206d2a['model']=_['keys'](db['VoiceQueueReport'][_0x7995('0x2d')]);_0x206d2a[_0x7995('0x32')]=_[_0x7995('0x46')](_0x4ab09f[_0x7995('0x32')]);_0x206d2a[_0x7995('0x33')]=_[_0x7995('0x34')](_0x206d2a[_0x7995('0x31')],_0x206d2a[_0x7995('0x32')]);_0x33c801[_0x7995('0x35')]=_[_0x7995('0x34')](_0x206d2a[_0x7995('0x31')],qs[_0x7995('0x4e')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x4e')]));_0x33c801[_0x7995('0x35')]=_0x33c801[_0x7995('0x35')][_0x7995('0x47')]?_0x33c801[_0x7995('0x35')]:_0x206d2a[_0x7995('0x31')];if(!_0x4ab09f['query'][_0x7995('0x36')](_0x7995('0x37'))){_0x33c801[_0x7995('0x4f')]=qs[_0x7995('0x4f')](_0x4ab09f['query']['limit']);_0x33c801[_0x7995('0x21')]=qs[_0x7995('0x21')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x21')]);}_0x33c801['order']=qs[_0x7995('0x39')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x39')]);_0x33c801[_0x7995('0x3a')]=qs['filters'](_['pick'](_0x4ab09f[_0x7995('0x32')],_0x206d2a[_0x7995('0x33')]));if(_0x4ab09f[_0x7995('0x32')][_0x7995('0x3e')]){_0x33c801[_0x7995('0x3a')]=_[_0x7995('0x3c')](_0x33c801[_0x7995('0x3a')],{'$or':_[_0x7995('0x3d')](_0x33c801[_0x7995('0x35')],function(_0x50caf5){var _0x18f230={};_0x18f230[_0x50caf5]={'$like':'%'+_0x4ab09f[_0x7995('0x32')][_0x7995('0x3e')]+'%'};return _0x18f230;})});}_0x33c801=_[_0x7995('0x3c')]({},_0x33c801,_0x4ab09f['options']);var _0x51bf6a={'where':_0x33c801[_0x7995('0x3a')]};return db[_0x7995('0x40')]['count'](_0x51bf6a)[_0x7995('0x28')](function(_0x375fc9){_0x50c7b5[_0x7995('0x41')]=_0x375fc9;if(_0x4ab09f[_0x7995('0x32')][_0x7995('0x48')]){_0x33c801['include']=[{'all':!![]}];}return db[_0x7995('0x40')]['findAll'](_0x33c801);})[_0x7995('0x28')](function(_0xe31dcb){_0x50c7b5[_0x7995('0x50')]=_0xe31dcb;return _0x50c7b5;})[_0x7995('0x28')](respondWithFilteredResult(_0x14fe7f,_0x33c801,_0x7995('0x4d')))[_0x7995('0x43')](handleError(_0x14fe7f,null,_0x7995('0x4d')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 964cb17..ebd668a 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 _0x97d3=['hook','events','../../mysqldb','VoiceQueueReport','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x228890,_0x16ba2f){var _0x3b7475=function(_0x5a5ad4){while(--_0x5a5ad4){_0x228890['push'](_0x228890['shift']());}};_0x3b7475(++_0x16ba2f);}(_0x97d3,0x99));var _0x397d=function(_0x1bc013,_0x7771c6){_0x1bc013=_0x1bc013-0x0;var _0x55df36=_0x97d3[_0x1bc013];return _0x55df36;};'use strict';var EventEmitter=require(_0x397d('0x0'));var VoiceQueueReport=require(_0x397d('0x1'))['db'][_0x397d('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x397d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x397d('0x4')};function emitEvent(_0x13c9ae){return function(_0x133466,_0x302d3c,_0x233add){VoiceQueueReportEvents[_0x397d('0x5')](_0x13c9ae+':'+_0x133466['id'],_0x133466);VoiceQueueReportEvents[_0x397d('0x5')](_0x13c9ae,_0x133466);_0x233add(null);};}for(var e in events){if(events[_0x397d('0x6')](e)){var event=events[e];VoiceQueueReport[_0x397d('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0x1e79=['save','update','remove','emit','hook','events','../../mysqldb','VoiceQueueReport'];(function(_0x9e9fd8,_0x2f4bd4){var _0x3387ff=function(_0x12d3b){while(--_0x12d3b){_0x9e9fd8['push'](_0x9e9fd8['shift']());}};_0x3387ff(++_0x2f4bd4);}(_0x1e79,0xa5));var _0x91e7=function(_0x5dcc69,_0x4f43bc){_0x5dcc69=_0x5dcc69-0x0;var _0x3b4bf1=_0x1e79[_0x5dcc69];return _0x3b4bf1;};'use strict';var EventEmitter=require(_0x91e7('0x0'));var VoiceQueueReport=require(_0x91e7('0x1'))['db'][_0x91e7('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x91e7('0x3'),'afterUpdate':_0x91e7('0x4'),'afterDestroy':_0x91e7('0x5')};function emitEvent(_0x28b576){return function(_0x58afd3,_0x4fe5e1,_0x526335){VoiceQueueReportEvents[_0x91e7('0x6')](_0x28b576+':'+_0x58afd3['id'],_0x58afd3);VoiceQueueReportEvents[_0x91e7('0x6')](_0x28b576,_0x58afd3);_0x526335(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x91e7('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index bcf45c8..288e394 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 _0x0b0e=['calleridnum','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','uniqueid'];(function(_0x529822,_0x555f7f){var _0x36801d=function(_0x5a3268){while(--_0x5a3268){_0x529822['push'](_0x529822['shift']());}};_0x36801d(++_0x555f7f);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x0b0e[_0x1caf6a];return _0x1bf493;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var logger=require(_0xe0b0('0x1'))('api');var moment=require(_0xe0b0('0x2'));var BPromise=require(_0xe0b0('0x3'));var rp=require(_0xe0b0('0x4'));var fs=require('fs');var path=require(_0xe0b0('0x5'));var rimraf=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var attributes=require(_0xe0b0('0x8'));module[_0xe0b0('0x9')]=function(_0x30e20d,_0x28e40f){return _0x30e20d[_0xe0b0('0xa')]('VoiceQueueReport',attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xe0b0('0xb')]},{'fields':[_0xe0b0('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['./voiceQueueReport.attributes','exports','define','report_queue','uniqueid','calleridnum','util','../../config/logger','request-promise','path','rimraf','../../config/environment'];(function(_0x286030,_0x402840){var _0x1b7876=function(_0x4dc477){while(--_0x4dc477){_0x286030['push'](_0x286030['shift']());}};_0x1b7876(++_0x402840);}(_0x757a,0xde));var _0xa757=function(_0x300253,_0x4ad96a){_0x300253=_0x300253-0x0;var _0x3d3283=_0x757a[_0x300253];return _0x3d3283;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('VoiceQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'fields':[_0xa757('0xa')]},{'fields':[_0xa757('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 5156156..357da4c 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 _0x0894=['then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetVoiceQueueReport','CreateVoiceQueueReport','VoiceQueueReport','UpdateVoiceQueueReport','update','body','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request'];(function(_0x414a93,_0x5226eb){var _0x59d9a0=function(_0x2e7593){while(--_0x2e7593){_0x414a93['push'](_0x414a93['shift']());}};_0x59d9a0(++_0x5226eb);}(_0x0894,0x97));var _0x4089=function(_0x49d90f,_0xa560c4){_0x49d90f=_0x49d90f-0x0;var _0x25d38b=_0x0894[_0x49d90f];return _0x25d38b;};'use strict';var _=require(_0x4089('0x0'));var util=require(_0x4089('0x1'));var moment=require('moment');var BPromise=require(_0x4089('0x2'));var rs=require(_0x4089('0x3'));var fs=require('fs');var Redis=require(_0x4089('0x4'));var db=require(_0x4089('0x5'))['db'];var utils=require(_0x4089('0x6'));var logger=require(_0x4089('0x7'))('rpc');var config=require(_0x4089('0x8'));var jayson=require(_0x4089('0x9'));var client=jayson[_0x4089('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x4089('0xb')],{'host':_0x4089('0xc'),'port':0x18eb});var socket=require(_0x4089('0xd'))(new Redis(config[_0x4089('0xb')]));require(_0x4089('0xe'))[_0x4089('0xf')](socket);function respondWithRpcPromise(_0x40f5bb,_0x1e52b7,_0x3dad8f){return new BPromise(function(_0x14230b,_0x511004){return client[_0x4089('0x10')](_0x40f5bb,_0x3dad8f)[_0x4089('0x11')](function(_0x33d3ae){logger[_0x4089('0x12')](_0x4089('0x13'),_0x1e52b7,_0x4089('0x14'));logger[_0x4089('0x15')](_0x4089('0x16'),_0x1e52b7,_0x4089('0x14'),JSON[_0x4089('0x17')](_0x33d3ae));if(_0x33d3ae[_0x4089('0x18')]){if(_0x33d3ae[_0x4089('0x18')]['code']===0x1f4){logger[_0x4089('0x18')]('VoiceQueueReport,\x20%s,\x20%s',_0x1e52b7,_0x33d3ae[_0x4089('0x18')][_0x4089('0x19')]);return _0x511004(_0x33d3ae[_0x4089('0x18')][_0x4089('0x19')]);}logger[_0x4089('0x18')](_0x4089('0x13'),_0x1e52b7,_0x33d3ae[_0x4089('0x18')]['message']);return _0x14230b(_0x33d3ae['error'][_0x4089('0x19')]);}else{logger[_0x4089('0x12')](_0x4089('0x13'),_0x1e52b7,_0x4089('0x14'));_0x14230b(_0x33d3ae['result']['message']);}})[_0x4089('0x1a')](function(_0x56128a){logger[_0x4089('0x18')](_0x4089('0x13'),_0x1e52b7,_0x56128a);_0x511004(_0x56128a);});});}exports['GetVoiceQueueReport']=function(_0x1d30c3){var _0x38c3d5=this;return new Promise(function(_0x27006f,_0x181417){return db['VoiceQueueReport'][_0x4089('0x1b')]({'raw':_0x1d30c3['options']?_0x1d30c3[_0x4089('0x1c')][_0x4089('0x1d')]===undefined?!![]:![]:!![],'where':_0x1d30c3[_0x4089('0x1c')]?_0x1d30c3[_0x4089('0x1c')][_0x4089('0x1e')]||null:null,'attributes':_0x1d30c3[_0x4089('0x1c')]?_0x1d30c3[_0x4089('0x1c')][_0x4089('0x1f')]||null:null,'limit':_0x1d30c3[_0x4089('0x1c')]?_0x1d30c3[_0x4089('0x1c')][_0x4089('0x20')]||null:null,'include':_0x1d30c3[_0x4089('0x1c')]?_0x1d30c3['options'][_0x4089('0x21')]?_[_0x4089('0x22')](_0x1d30c3['options'][_0x4089('0x21')],function(_0x22e263){return{'model':db[_0x22e263[_0x4089('0x23')]],'as':_0x22e263['as'],'attributes':_0x22e263['attributes'],'include':_0x22e263['include']?_[_0x4089('0x22')](_0x22e263['include'],function(_0x549ce2){return{'model':db[_0x549ce2[_0x4089('0x23')]],'as':_0x549ce2['as'],'attributes':_0x549ce2[_0x4089('0x1f')],'include':_0x549ce2[_0x4089('0x21')]?_[_0x4089('0x22')](_0x549ce2['include'],function(_0x240f47){return{'model':db[_0x240f47[_0x4089('0x23')]],'as':_0x240f47['as'],'attributes':_0x240f47[_0x4089('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5f2987){logger[_0x4089('0x12')](_0x4089('0x24'),_0x1d30c3);logger['debug'](_0x4089('0x24'),_0x1d30c3,JSON[_0x4089('0x17')](_0x5f2987));_0x27006f(_0x5f2987);})[_0x4089('0x1a')](function(_0x50e93f){logger['error'](_0x4089('0x24'),_0x50e93f[_0x4089('0x19')],_0x1d30c3);_0x181417(_0x38c3d5[_0x4089('0x18')](0x1f4,_0x50e93f[_0x4089('0x19')]));});});};exports[_0x4089('0x25')]=function(_0x2c6021){var _0x134ad4=this;return new Promise(function(_0x5b329f,_0x409ce6){return db[_0x4089('0x26')]['create'](_0x2c6021['body'],{'raw':_0x2c6021[_0x4089('0x1c')]?_0x2c6021[_0x4089('0x1c')][_0x4089('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x582871){logger[_0x4089('0x12')]('CreateVoiceQueueReport',_0x2c6021);logger['debug']('CreateVoiceQueueReport',_0x2c6021,JSON[_0x4089('0x17')](_0x582871));_0x5b329f(_0x582871);})[_0x4089('0x1a')](function(_0x2e45ba){logger['error']('CreateVoiceQueueReport',_0x2e45ba[_0x4089('0x19')],_0x2c6021);_0x409ce6(_0x134ad4[_0x4089('0x18')](0x1f4,_0x2e45ba[_0x4089('0x19')]));});});};exports[_0x4089('0x27')]=function(_0x45a7bd){var _0x294c4b=this;return new Promise(function(_0x4e8eb1,_0x139494){return db[_0x4089('0x26')][_0x4089('0x28')](_0x45a7bd[_0x4089('0x29')],{'raw':_0x45a7bd[_0x4089('0x1c')]?_0x45a7bd['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45a7bd[_0x4089('0x1c')]?_0x45a7bd['options'][_0x4089('0x1e')]||null:null,'attributes':_0x45a7bd[_0x4089('0x1c')]?_0x45a7bd[_0x4089('0x1c')]['attributes']||null:null,'limit':_0x45a7bd[_0x4089('0x1c')]?_0x45a7bd[_0x4089('0x1c')]['limit']||null:null})[_0x4089('0x11')](function(_0x3439df){logger[_0x4089('0x12')](_0x4089('0x27'),_0x45a7bd);logger[_0x4089('0x15')](_0x4089('0x27'),_0x45a7bd,JSON[_0x4089('0x17')](_0x3439df));_0x4e8eb1(_0x3439df);})[_0x4089('0x1a')](function(_0x2d1485){logger[_0x4089('0x18')](_0x4089('0x27'),_0x2d1485[_0x4089('0x19')],_0x45a7bd);_0x139494(_0x294c4b[_0x4089('0x18')](0x1f4,_0x2d1485['message']));});});}; \ No newline at end of file +var _0xed6f=['VoiceQueueReport','raw','UpdateVoiceQueueReport','update','body','limit','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetVoiceQueueReport','options','where','attributes','include','model','map','stringify','CreateVoiceQueueReport'];(function(_0x2a7666,_0x441d3a){var _0xf49bab=function(_0x3e4aeb){while(--_0x3e4aeb){_0x2a7666['push'](_0x2a7666['shift']());}};_0xf49bab(++_0x441d3a);}(_0xed6f,0xd8));var _0xfed6=function(_0x96baa6,_0x113c83){_0x96baa6=_0x96baa6-0x0;var _0x14c52b=_0xed6f[_0x96baa6];return _0x14c52b;};'use strict';var _=require(_0xfed6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfed6('0x1'));var fs=require('fs');var Redis=require(_0xfed6('0x2'));var db=require(_0xfed6('0x3'))['db'];var utils=require(_0xfed6('0x4'));var logger=require(_0xfed6('0x5'))(_0xfed6('0x6'));var config=require('../../config/environment');var jayson=require(_0xfed6('0x7'));var client=jayson[_0xfed6('0x8')][_0xfed6('0x9')]({'port':0x232a});config[_0xfed6('0xa')]=_[_0xfed6('0xb')](config[_0xfed6('0xa')],{'host':_0xfed6('0xc'),'port':0x18eb});var socket=require(_0xfed6('0xd'))(new Redis(config['redis']));require(_0xfed6('0xe'))[_0xfed6('0xf')](socket);function respondWithRpcPromise(_0x4c55b5,_0x2dfdf3,_0x461b5f){return new BPromise(function(_0x481483,_0x4a1777){return client[_0xfed6('0x10')](_0x4c55b5,_0x461b5f)[_0xfed6('0x11')](function(_0x1f926d){logger[_0xfed6('0x12')](_0xfed6('0x13'),_0x2dfdf3,_0xfed6('0x14'));logger[_0xfed6('0x15')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x2dfdf3,_0xfed6('0x14'),JSON['stringify'](_0x1f926d));if(_0x1f926d[_0xfed6('0x16')]){if(_0x1f926d[_0xfed6('0x16')][_0xfed6('0x17')]===0x1f4){logger[_0xfed6('0x16')](_0xfed6('0x13'),_0x2dfdf3,_0x1f926d[_0xfed6('0x16')][_0xfed6('0x18')]);return _0x4a1777(_0x1f926d[_0xfed6('0x16')][_0xfed6('0x18')]);}logger[_0xfed6('0x16')](_0xfed6('0x13'),_0x2dfdf3,_0x1f926d['error'][_0xfed6('0x18')]);return _0x481483(_0x1f926d[_0xfed6('0x16')]['message']);}else{logger['info'](_0xfed6('0x13'),_0x2dfdf3,_0xfed6('0x14'));_0x481483(_0x1f926d[_0xfed6('0x19')][_0xfed6('0x18')]);}})[_0xfed6('0x1a')](function(_0x56c343){logger['error'](_0xfed6('0x13'),_0x2dfdf3,_0x56c343);_0x4a1777(_0x56c343);});});}exports[_0xfed6('0x1b')]=function(_0x269efa){var _0x9b3d79=this;return new Promise(function(_0xf5c247,_0x41939c){return db['VoiceQueueReport']['findAll']({'raw':_0x269efa[_0xfed6('0x1c')]?_0x269efa[_0xfed6('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x269efa[_0xfed6('0x1c')]?_0x269efa[_0xfed6('0x1c')][_0xfed6('0x1d')]||null:null,'attributes':_0x269efa[_0xfed6('0x1c')]?_0x269efa[_0xfed6('0x1c')][_0xfed6('0x1e')]||null:null,'limit':_0x269efa['options']?_0x269efa[_0xfed6('0x1c')]['limit']||null:null,'include':_0x269efa[_0xfed6('0x1c')]?_0x269efa[_0xfed6('0x1c')][_0xfed6('0x1f')]?_['map'](_0x269efa[_0xfed6('0x1c')][_0xfed6('0x1f')],function(_0x339d43){return{'model':db[_0x339d43[_0xfed6('0x20')]],'as':_0x339d43['as'],'attributes':_0x339d43[_0xfed6('0x1e')],'include':_0x339d43[_0xfed6('0x1f')]?_['map'](_0x339d43[_0xfed6('0x1f')],function(_0x53eb85){return{'model':db[_0x53eb85[_0xfed6('0x20')]],'as':_0x53eb85['as'],'attributes':_0x53eb85[_0xfed6('0x1e')],'include':_0x53eb85[_0xfed6('0x1f')]?_[_0xfed6('0x21')](_0x53eb85[_0xfed6('0x1f')],function(_0x4be8d5){return{'model':db[_0x4be8d5[_0xfed6('0x20')]],'as':_0x4be8d5['as'],'attributes':_0x4be8d5[_0xfed6('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xfed6('0x11')](function(_0x4ab64b){logger[_0xfed6('0x12')](_0xfed6('0x1b'),_0x269efa);logger[_0xfed6('0x15')](_0xfed6('0x1b'),_0x269efa,JSON[_0xfed6('0x22')](_0x4ab64b));_0xf5c247(_0x4ab64b);})[_0xfed6('0x1a')](function(_0x524ca7){logger['error'](_0xfed6('0x1b'),_0x524ca7[_0xfed6('0x18')],_0x269efa);_0x41939c(_0x9b3d79[_0xfed6('0x16')](0x1f4,_0x524ca7[_0xfed6('0x18')]));});});};exports[_0xfed6('0x23')]=function(_0x273a0c){var _0x30013e=this;return new Promise(function(_0x4f3313,_0x139061){return db[_0xfed6('0x24')]['create'](_0x273a0c['body'],{'raw':_0x273a0c[_0xfed6('0x1c')]?_0x273a0c[_0xfed6('0x1c')][_0xfed6('0x25')]===undefined?!![]:![]:!![]})[_0xfed6('0x11')](function(_0x4ad0ef){logger[_0xfed6('0x12')]('CreateVoiceQueueReport',_0x273a0c);logger['debug'](_0xfed6('0x23'),_0x273a0c,JSON['stringify'](_0x4ad0ef));_0x4f3313(_0x4ad0ef);})[_0xfed6('0x1a')](function(_0x146cb4){logger[_0xfed6('0x16')]('CreateVoiceQueueReport',_0x146cb4['message'],_0x273a0c);_0x139061(_0x30013e[_0xfed6('0x16')](0x1f4,_0x146cb4[_0xfed6('0x18')]));});});};exports[_0xfed6('0x26')]=function(_0x19816b){var _0xd0c4ce=this;return new Promise(function(_0x350b25,_0x2cd5c3){return db['VoiceQueueReport'][_0xfed6('0x27')](_0x19816b[_0xfed6('0x28')],{'raw':_0x19816b[_0xfed6('0x1c')]?_0x19816b[_0xfed6('0x1c')][_0xfed6('0x25')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19816b[_0xfed6('0x1c')]?_0x19816b['options']['where']||null:null,'attributes':_0x19816b[_0xfed6('0x1c')]?_0x19816b[_0xfed6('0x1c')]['attributes']||null:null,'limit':_0x19816b[_0xfed6('0x1c')]?_0x19816b[_0xfed6('0x1c')][_0xfed6('0x29')]||null:null})['then'](function(_0x52753b){logger['info'](_0xfed6('0x26'),_0x19816b);logger[_0xfed6('0x15')]('UpdateVoiceQueueReport',_0x19816b,JSON[_0xfed6('0x22')](_0x52753b));_0x350b25(_0x52753b);})['catch'](function(_0x1e2bd2){logger[_0xfed6('0x16')]('UpdateVoiceQueueReport',_0x1e2bd2[_0xfed6('0x18')],_0x19816b);_0x2cd5c3(_0xd0c4ce[_0xfed6('0x16')](0x1f4,_0x1e2bd2['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 9317914..7ad4a6a 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 _0x279b=['emit','register','voiceQueueReport:','./voiceQueueReport.events','save','remove','update'];(function(_0x5f5828,_0x1581c0){var _0x20a42b=function(_0x10ada2){while(--_0x10ada2){_0x5f5828['push'](_0x5f5828['shift']());}};_0x20a42b(++_0x1581c0);}(_0x279b,0x137));var _0xb279=function(_0x49f6ae,_0x2f75b6){_0x49f6ae=_0x49f6ae-0x0;var _0x3e4d37=_0x279b[_0x49f6ae];return _0x3e4d37;};'use strict';var VoiceQueueReportEvents=require(_0xb279('0x0'));var events=[_0xb279('0x1'),_0xb279('0x2'),_0xb279('0x3')];function createListener(_0x5c9b8c,_0x4f3e16){return function(_0x591c31){_0x4f3e16[_0xb279('0x4')](_0x5c9b8c,_0x591c31);};}function removeListener(_0x261902,_0x49b710){return function(){VoiceQueueReportEvents['removeListener'](_0x261902,_0x49b710);};}exports[_0xb279('0x5')]=function(_0x4ad6b1){for(var _0x4b1a30=0x0,_0x35ab55=events['length'];_0x4b1a30<_0x35ab55;_0x4b1a30++){var _0x5c611a=events[_0x4b1a30];var _0x76ee5a=createListener(_0xb279('0x6')+_0x5c611a,_0x4ad6b1);VoiceQueueReportEvents['on'](_0x5c611a,_0x76ee5a);}}; \ No newline at end of file +var _0x5470=['emit','register','save','remove','update'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x5470,0x11f));var _0x0547=function(_0x1c2aa9,_0x22472f){_0x1c2aa9=_0x1c2aa9-0x0;var _0x53eaf8=_0x5470[_0x1c2aa9];return _0x53eaf8;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x0547('0x0'),_0x0547('0x1'),_0x0547('0x2')];function createListener(_0x14f88a,_0x142665){return function(_0x2a5e0d){_0x142665[_0x0547('0x3')](_0x14f88a,_0x2a5e0d);};}function removeListener(_0x1f95b8,_0xb690d6){return function(){VoiceQueueReportEvents['removeListener'](_0x1f95b8,_0xb690d6);};}exports[_0x0547('0x4')]=function(_0x35d304){for(var _0x3acd05=0x0,_0x70bd1e=events['length'];_0x3acd05<_0x70bd1e;_0x3acd05++){var _0x15476a=events[_0x3acd05];var _0x34e43a=createListener('voiceQueueReport:'+_0x15476a,_0x35d304);VoiceQueueReportEvents['on'](_0x15476a,_0x34e43a);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 06ae97c..6c315c1 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 _0xf220=['post','create','update','/:id','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','index','isAuthenticated','show'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xf220,0x113));var _0x0f22=function(_0x18367b,_0x595e60){_0x18367b=_0x18367b-0x0;var _0x485aa8=_0xf220[_0x18367b];return _0x485aa8;};'use strict';var multer=require('multer');var util=require(_0x0f22('0x0'));var path=require(_0x0f22('0x1'));var timeout=require(_0x0f22('0x2'));var express=require(_0x0f22('0x3'));var router=express[_0x0f22('0x4')]();var auth=require(_0x0f22('0x5'));var interaction=require(_0x0f22('0x6'));var config=require(_0x0f22('0x7'));var controller=require(_0x0f22('0x8'));router[_0x0f22('0x9')]('/',auth['isAuthenticated'](),controller[_0x0f22('0xa')]);router[_0x0f22('0x9')]('/:id',auth[_0x0f22('0xb')](),controller[_0x0f22('0xc')]);router[_0x0f22('0xd')]('/',auth[_0x0f22('0xb')](),controller[_0x0f22('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0f22('0xf')]);router['delete'](_0x0f22('0x10'),auth[_0x0f22('0xb')](),controller[_0x0f22('0x11')]);module['exports']=router; \ No newline at end of file +var _0x616a=['./voiceQueuesLog.controller','get','index','/:id','isAuthenticated','show','post','destroy','exports','multer','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xe92c6a,_0x2f346f){var _0x57cb64=function(_0x30f7a4){while(--_0x30f7a4){_0xe92c6a['push'](_0xe92c6a['shift']());}};_0x57cb64(++_0x2f346f);}(_0x616a,0x175));var _0xa616=function(_0x4c5cd9,_0x4d71d7){_0x4c5cd9=_0x4c5cd9-0x0;var _0x13cf2a=_0x616a[_0x4c5cd9];return _0x13cf2a;};'use strict';var multer=require(_0xa616('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa616('0x1')]();var auth=require(_0xa616('0x2'));var interaction=require(_0xa616('0x3'));var config=require('../../config/environment');var controller=require(_0xa616('0x4'));router[_0xa616('0x5')]('/',auth['isAuthenticated'](),controller[_0xa616('0x6')]);router[_0xa616('0x5')](_0xa616('0x7'),auth[_0xa616('0x8')](),controller[_0xa616('0x9')]);router[_0xa616('0xa')]('/',auth[_0xa616('0x8')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xa616('0x7'),auth[_0xa616('0x8')](),controller[_0xa616('0xb')]);module[_0xa616('0xc')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 6d0d34b..4f029fa 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 _0x3124=['sequelize','moment','exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x52cd71,_0xbc56f1){var _0x340b26=function(_0x499bad){while(--_0x499bad){_0x52cd71['push'](_0x52cd71['shift']());}};_0x340b26(++_0xbc56f1);}(_0x3124,0x149));var _0x4312=function(_0x5f57d5,_0x2674d2){_0x5f57d5=_0x5f57d5-0x0;var _0xae2a65=_0x3124[_0x5f57d5];return _0xae2a65;};'use strict';var Sequelize=require(_0x4312('0x0'));var moment=require(_0x4312('0x1'));module[_0x4312('0x2')]={'time':{'type':Sequelize[_0x4312('0x3')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x4312('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x4312('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x4312('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x4312('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x4312('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x4312('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x4312('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x4312('0x4')],'allowNull':![],'defaultValue':moment()[_0x4312('0x5')](_0x4312('0x6'))}}; \ No newline at end of file +var _0x52f9=['YYYY-MM-DD\x20HH:mm:ss','moment','exports','STRING','format'];(function(_0x33a2c4,_0x2ad1ad){var _0x45b9e1=function(_0x306ecb){while(--_0x306ecb){_0x33a2c4['push'](_0x33a2c4['shift']());}};_0x45b9e1(++_0x2ad1ad);}(_0x52f9,0xf1));var _0x952f=function(_0x4e27d5,_0x7708ae){_0x4e27d5=_0x4e27d5-0x0;var _0x219864=_0x52f9[_0x4e27d5];return _0x219864;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x952f('0x0'));module[_0x952f('0x1')]={'time':{'type':Sequelize[_0x952f('0x2')]},'callid':{'type':Sequelize[_0x952f('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x952f('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x952f('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x952f('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x952f('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x952f('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x952f('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x952f('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0x952f('0x3')](_0x952f('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index ecf8dba..907bb3d 100644 --- a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js +++ b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x2ae45f,_0x837a7a){var _0x17cb22=function(_0x3e742a){while(--_0x3e742a){_0x2ae45f['push'](_0x2ae45f['shift']());}};_0x17cb22(++_0x837a7a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file +var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x94ff4f,_0x4e7570){var _0x412c53=function(_0x19a85a){while(--_0x19a85a){_0x94ff4f['push'](_0x94ff4f['shift']());}};_0x412c53(++_0x4e7570);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 3d595c4..811aeb6 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 _0xe459=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','voice_queues_log','event_dtm','dtm','lodash'];(function(_0x49bf38,_0x42c116){var _0xb76377=function(_0x4284b4){while(--_0x4284b4){_0x49bf38['push'](_0x49bf38['shift']());}};_0xb76377(++_0x42c116);}(_0xe459,0xcf));var _0x9e45=function(_0x9d47db,_0x3ec431){_0x9d47db=_0x9d47db-0x0;var _0x1ed6ed=_0xe459[_0x9d47db];return _0x1ed6ed;};'use strict';var _=require(_0x9e45('0x0'));var util=require(_0x9e45('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9e45('0x2'));var BPromise=require(_0x9e45('0x3'));var rp=require(_0x9e45('0x4'));var fs=require('fs');var path=require(_0x9e45('0x5'));var rimraf=require(_0x9e45('0x6'));var config=require(_0x9e45('0x7'));var attributes=require('./voiceQueuesLog.attributes');module[_0x9e45('0x8')]=function(_0x56a44d,_0x3d2440){return _0x56a44d[_0x9e45('0x9')]('VoiceQueuesLog',attributes,{'tableName':_0x9e45('0xa'),'paranoid':![],'indexes':[{'name':_0x9e45('0xb'),'fields':['event',_0x9e45('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0xc293=['moment','bluebird','request-promise','path','./voiceQueuesLog.attributes','exports','define','voice_queues_log','event_dtm','util','../../config/logger','api'];(function(_0x1a9e78,_0x180720){var _0x113e06=function(_0x229c64){while(--_0x229c64){_0x1a9e78['push'](_0x1a9e78['shift']());}};_0x113e06(++_0x180720);}(_0xc293,0x111));var _0x3c29=function(_0x20d9ff,_0x1bcc4b){_0x20d9ff=_0x20d9ff-0x0;var _0x1f78aa=_0xc293[_0x20d9ff];return _0x1f78aa;};'use strict';var _=require('lodash');var util=require(_0x3c29('0x0'));var logger=require(_0x3c29('0x1'))(_0x3c29('0x2'));var moment=require(_0x3c29('0x3'));var BPromise=require(_0x3c29('0x4'));var rp=require(_0x3c29('0x5'));var fs=require('fs');var path=require(_0x3c29('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3c29('0x7'));module[_0x3c29('0x8')]=function(_0x37223,_0x54367c){return _0x37223[_0x3c29('0x9')]('VoiceQueuesLog',attributes,{'tableName':_0x3c29('0xa'),'paranoid':![],'indexes':[{'name':_0x3c29('0xb'),'fields':['event','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 389c1e2..9bea04d 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 _0x6f2f=['lodash','util','ioredis','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','code','error','VoiceQueuesLog,\x20%s,\x20%s','message','result','catch'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0x6f2f,0xbe));var _0xf6f2=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0x6f2f[_0x3826ad];return _0x17b900;};'use strict';var _=require(_0xf6f2('0x0'));var util=require(_0xf6f2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf6f2('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf6f2('0x3'))(_0xf6f2('0x4'));var config=require(_0xf6f2('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf6f2('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1c94ad,_0x26cd28,_0x774922){return new BPromise(function(_0x15a71c,_0x1873c8){return client[_0xf6f2('0x7')](_0x1c94ad,_0x774922)[_0xf6f2('0x8')](function(_0x294a85){logger[_0xf6f2('0x9')]('VoiceQueuesLog,\x20%s,\x20%s',_0x26cd28,_0xf6f2('0xa'));logger[_0xf6f2('0xb')](_0xf6f2('0xc'),_0x26cd28,_0xf6f2('0xa'),JSON['stringify'](_0x294a85));if(_0x294a85['error']){if(_0x294a85['error'][_0xf6f2('0xd')]===0x1f4){logger[_0xf6f2('0xe')](_0xf6f2('0xf'),_0x26cd28,_0x294a85[_0xf6f2('0xe')][_0xf6f2('0x10')]);return _0x1873c8(_0x294a85[_0xf6f2('0xe')]['message']);}logger[_0xf6f2('0xe')](_0xf6f2('0xf'),_0x26cd28,_0x294a85[_0xf6f2('0xe')][_0xf6f2('0x10')]);return _0x15a71c(_0x294a85[_0xf6f2('0xe')]['message']);}else{logger[_0xf6f2('0x9')](_0xf6f2('0xf'),_0x26cd28,_0xf6f2('0xa'));_0x15a71c(_0x294a85[_0xf6f2('0x11')][_0xf6f2('0x10')]);}})[_0xf6f2('0x12')](function(_0x17dec3){logger[_0xf6f2('0xe')](_0xf6f2('0xf'),_0x26cd28,_0x17dec3);_0x1873c8(_0x17dec3);});});} \ No newline at end of file +var _0x5eb8=['info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\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(_0x5e0179,_0x1fe438){var _0x17c4ac=function(_0x3f5177){while(--_0x3f5177){_0x5e0179['push'](_0x5e0179['shift']());}};_0x17c4ac(++_0x1fe438);}(_0x5eb8,0xb0));var _0x85eb=function(_0x426076,_0xfdf5d2){_0x426076=_0x426076-0x0;var _0x1e9565=_0x5eb8[_0x426076];return _0x1e9565;};'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')]('VoiceQueuesLog,\x20%s,\x20%s',_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x448345(_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);}else{logger[_0x85eb('0xd')]('VoiceQueuesLog,\x20%s,\x20%s',_0x16d7b9,_0x85eb('0xf'));_0x448345(_0x1f0036['result'][_0x85eb('0x13')]);}})[_0x85eb('0x14')](function(_0x3e23e8){logger[_0x85eb('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x16d7b9,_0x3e23e8);_0x5cd4ec(_0x3e23e8);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 287e9ce..c1e8654 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(_0x2827bc,_0x718200){var _0x179df7=function(_0x4f7b74){while(--_0x4f7b74){_0x2827bc['push'](_0x2827bc['shift']());}};_0x179df7(++_0x718200);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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(_0x16252d,_0xaad177){var _0xeb5dd5=function(_0x4852fd){while(--_0x4852fd){_0x16252d['push'](_0x16252d['shift']());}};_0xeb5dd5(++_0xaad177);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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 e4bfb8a..e9b7d6e 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 _0xe1a5=['FLOAT','BOOLEAN','DATE','createdAt','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','path','exports','VIRTUAL','getDataValue','STRING','setDataValue','membername','split','INTEGER','TEXT','NEW'];(function(_0x50521f,_0x4375b3){var _0x29b4be=function(_0x1cb06e){while(--_0x1cb06e){_0x50521f['push'](_0x50521f['shift']());}};_0x29b4be(++_0x4375b3);}(_0xe1a5,0x120));var _0x5e1a=function(_0x4dde23,_0x520ee2){_0x4dde23=_0x4dde23-0x0;var _0x201d04=_0xe1a5[_0x4dde23];return _0x201d04;};'use strict';var Sequelize=require(_0x5e1a('0x0'));var moment=require('moment');var path=require(_0x5e1a('0x1'));module[_0x5e1a('0x2')]={'format':{'type':Sequelize[_0x5e1a('0x3')],'get':function(){return this['getDataValue']('value')?path['extname'](this[_0x5e1a('0x4')]('value')):undefined;}},'uniqueid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x5e1a('0x5')],'set':function(_0x4ed9cc){if(_0x4ed9cc){this[_0x5e1a('0x6')]('channel',_0x4ed9cc);this[_0x5e1a('0x6')](_0x5e1a('0x7'),_0x4ed9cc[_0x5e1a('0x8')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x5e1a('0x5')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x5e1a('0x5')]},'connectedlinename':{'type':Sequelize[_0x5e1a('0x5')]},'accountcode':{'type':Sequelize[_0x5e1a('0x5')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x5e1a('0x5')]},'value':{'type':Sequelize[_0x5e1a('0x5')]},'type':{'type':Sequelize[_0x5e1a('0x5')]},'rating':{'type':Sequelize[_0x5e1a('0x9')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x5e1a('0x5')]},'userDisposition':{'type':Sequelize[_0x5e1a('0x5')]},'location':{'type':Sequelize[_0x5e1a('0xa')]},'transcribeName':{'type':Sequelize['STRING']},'transcribeStatus':{'type':Sequelize[_0x5e1a('0x5')],'defaultValue':_0x5e1a('0xb')},'fileUri':{'type':Sequelize[_0x5e1a('0xa')]},'fileText':{'type':Sequelize[_0x5e1a('0xa')]},'failureReason':{'type':Sequelize['TEXT']},'sentiment':{'type':Sequelize[_0x5e1a('0x5')]},'sPositive':{'type':Sequelize['FLOAT']},'sNegative':{'type':Sequelize[_0x5e1a('0xc')]},'sNeutral':{'type':Sequelize[_0x5e1a('0xc')]},'sMixed':{'type':Sequelize[_0x5e1a('0xc')]},'tempSentiment':{'type':Sequelize[_0x5e1a('0xd')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x5e1a('0xe')],'get':function(){return moment(this[_0x5e1a('0x4')](_0x5e1a('0xf')))[_0x5e1a('0x10')](_0x5e1a('0x11'))[_0x5e1a('0x12')]();}},'updatedAt':{'type':Sequelize[_0x5e1a('0xe')],'get':function(){return moment(this[_0x5e1a('0x4')](_0x5e1a('0x13')))['format']('MM-DD-YYYY\x20HH:mm')[_0x5e1a('0x12')]();}}}; \ No newline at end of file +var _0x6cc3=['VIRTUAL','getDataValue','extname','value','STRING','setDataValue','channel','membername','split','INTEGER','TEXT','FLOAT','BOOLEAN','DATE','createdAt','format','MM-DD-YYYY\x20HH:mm','moment','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6cc3,0xe2));var _0x36cc=function(_0x11a962,_0x3cc338){_0x11a962=_0x11a962-0x0;var _0x55d423=_0x6cc3[_0x11a962];return _0x55d423;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x36cc('0x0'));var path=require('path');module[_0x36cc('0x1')]={'format':{'type':Sequelize[_0x36cc('0x2')],'get':function(){return this[_0x36cc('0x3')]('value')?path[_0x36cc('0x4')](this[_0x36cc('0x3')](_0x36cc('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x36cc('0x6')]},'channel':{'type':Sequelize[_0x36cc('0x6')],'set':function(_0xacab8e){if(_0xacab8e){this[_0x36cc('0x7')](_0x36cc('0x8'),_0xacab8e);this['setDataValue'](_0x36cc('0x9'),_0xacab8e[_0x36cc('0xa')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x36cc('0x6')]},'calleridnum':{'type':Sequelize[_0x36cc('0x6')]},'calleridname':{'type':Sequelize[_0x36cc('0x6')]},'connectedlinenum':{'type':Sequelize[_0x36cc('0x6')]},'connectedlinename':{'type':Sequelize[_0x36cc('0x6')]},'accountcode':{'type':Sequelize[_0x36cc('0x6')]},'context':{'type':Sequelize[_0x36cc('0x6')]},'exten':{'type':Sequelize[_0x36cc('0x6')]},'value':{'type':Sequelize[_0x36cc('0x6')]},'type':{'type':Sequelize[_0x36cc('0x6')]},'rating':{'type':Sequelize[_0x36cc('0xb')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x36cc('0x6')]},'location':{'type':Sequelize[_0x36cc('0xc')]},'transcribeName':{'type':Sequelize[_0x36cc('0x6')]},'transcribeStatus':{'type':Sequelize[_0x36cc('0x6')],'defaultValue':'NEW'},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize['TEXT']},'failureReason':{'type':Sequelize[_0x36cc('0xc')]},'sentiment':{'type':Sequelize[_0x36cc('0x6')]},'sPositive':{'type':Sequelize[_0x36cc('0xd')]},'sNegative':{'type':Sequelize['FLOAT']},'sNeutral':{'type':Sequelize['FLOAT']},'sMixed':{'type':Sequelize[_0x36cc('0xd')]},'tempSentiment':{'type':Sequelize[_0x36cc('0xe')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x36cc('0xf')],'get':function(){return moment(this['getDataValue'](_0x36cc('0x10')))[_0x36cc('0x11')](_0x36cc('0x12'))['toString']();}},'updatedAt':{'type':Sequelize[_0x36cc('0xf')],'get':function(){return moment(this[_0x36cc('0x3')]('updatedAt'))[_0x36cc('0x11')]('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 8fdb77c..695b115 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 _0x069a=['VIRTUAL','options','include','VoiceRecording','findAll','rows','catch','show','params','includeAll','find','create','body','describe','download','../../components/encryptor','uniqueid','value','format','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','message','Not\x20found','downloads','sequelize','MD5','col','token','$and','push','extname','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','isNil','unlinkSync','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','findOne','recording','Setting','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','Transcript\x20not\x20available','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','then','error','stack','name','send','index','map','fieldName','type','key','model','differenceBy','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge'];(function(_0x5a09f3,_0x3827bb){var _0x5e6ce6=function(_0x3800fc){while(--_0x3800fc){_0x5a09f3['push'](_0x5a09f3['shift']());}};_0x5e6ce6(++_0x3827bb);}(_0x069a,0x18a));var _0xa069=function(_0x614e40,_0x2fbc7d){_0x614e40=_0x614e40-0x0;var _0x4a38b8=_0x069a[_0x614e40];return _0x4a38b8;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xa069('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa069('0x1'));var rp=require(_0xa069('0x2'));var moment=require(_0xa069('0x3'));var BPromise=require(_0xa069('0x4'));var Mustache=require('mustache');var util=require(_0xa069('0x5'));var path=require(_0xa069('0x6'));var sox=require(_0xa069('0x7'));var csv=require(_0xa069('0x8'));var ejs=require(_0xa069('0x9'));var fs=require('fs');var _=require(_0xa069('0xa'));var squel=require(_0xa069('0xb'));var crypto=require('crypto');var jsforce=require(_0xa069('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa069('0x8'));var querystring=require(_0xa069('0xd'));var Papa=require('papaparse');var AWS=require('aws-sdk');var uuidv4=require(_0xa069('0xe'));var Redis=require(_0xa069('0xf'));var authService=require(_0xa069('0x10'));var qs=require(_0xa069('0x11'));var as=require(_0xa069('0x12'));var hardwareService=require(_0xa069('0x13'));var logger=require(_0xa069('0x14'))(_0xa069('0x15'));var utils=require('../../config/utils');var config=require(_0xa069('0x16'));var db=require(_0xa069('0x17'))['db'];function respondWithStatusCode(_0x4d90c6,_0x11866b){_0x11866b=_0x11866b||0xcc;return function(_0x403166){if(_0x403166){return _0x4d90c6[_0xa069('0x18')](_0x11866b);}return _0x4d90c6[_0xa069('0x19')](_0x11866b)[_0xa069('0x1a')]();};}function respondWithResult(_0x149077,_0x3158ef){_0x3158ef=_0x3158ef||0xc8;return function(_0x5be59c){if(_0x5be59c){return _0x149077['status'](_0x3158ef)['json'](_0x5be59c);}};}function respondWithFilteredResult(_0x41f6bc,_0x32bc56){return function(_0x7b009f){if(_0x7b009f){var _0x4eff22=_0x7b009f[_0xa069('0x1b')],_0x3fcee4=_0x32bc56[_0xa069('0x1c')],_0x51bf94=_0x32bc56[_0xa069('0x1c')]+_0x32bc56[_0xa069('0x1d')],_0x1549dc;if(_0x51bf94>=_0x4eff22){_0x51bf94=_0x4eff22;_0x1549dc=0xc8;}else{_0x1549dc=0xce;}_0x41f6bc[_0xa069('0x19')](_0x1549dc);return _0x41f6bc['set'](_0xa069('0x1e'),_0x3fcee4+'-'+_0x51bf94+'/'+_0x4eff22)[_0xa069('0x1f')](_0x7b009f);}return null;};}function patchUpdates(_0xe412b0){return function(_0x18e3a5){try{jsonpatch[_0xa069('0x20')](_0x18e3a5,_0xe412b0,!![]);}catch(_0x283b1){return BPromise[_0xa069('0x21')](_0x283b1);}return _0x18e3a5['save']();};}function saveUpdates(_0x423295,_0x1940b7){return function(_0x384f84){if(_0x384f84){return _0x384f84['update'](_0x423295)['then'](function(_0x29e3f6){return _0x29e3f6;});}return null;};}function removeEntity(_0x469ebb,_0x2a9e8b){return function(_0x51d78e){if(_0x51d78e){return _0x51d78e['destroy']()[_0xa069('0x22')](function(){_0x469ebb[_0xa069('0x19')](0xcc)[_0xa069('0x1a')]();});}};}function handleEntityNotFound(_0x490229,_0x226573){return function(_0x4f50f9){if(!_0x4f50f9){_0x490229[_0xa069('0x18')](0x194);}return _0x4f50f9;};}function handleError(_0x1c70c9,_0x17a43f){_0x17a43f=_0x17a43f||0x1f4;return function(_0x2436b8){logger[_0xa069('0x23')](_0x2436b8[_0xa069('0x24')]);if(_0x2436b8[_0xa069('0x25')]){delete _0x2436b8[_0xa069('0x25')];}_0x1c70c9[_0xa069('0x19')](_0x17a43f)[_0xa069('0x26')](_0x2436b8);};}exports[_0xa069('0x27')]=function(_0x552946,_0x32227c){var _0x4226f5={},_0x281fd3={},_0x3bbea2={'count':0x0,'rows':[]};var _0x204f6e=_[_0xa069('0x28')](db['VoiceRecording']['rawAttributes'],function(_0x1c3a00){return{'name':_0x1c3a00[_0xa069('0x29')],'type':_0x1c3a00[_0xa069('0x2a')][_0xa069('0x2b')]};});_0x281fd3[_0xa069('0x2c')]=_[_0xa069('0x2d')](_[_0xa069('0x28')](_0x204f6e,_0xa069('0x25')),['format']);_0x281fd3[_0xa069('0x2e')]=_[_0xa069('0x2f')](_0x552946[_0xa069('0x2e')]);_0x281fd3['filters']=_[_0xa069('0x30')](_0x281fd3[_0xa069('0x2c')],_0x281fd3['query']);_0x4226f5[_0xa069('0x31')]=_[_0xa069('0x30')](_0x281fd3[_0xa069('0x2c')],qs['fields'](_0x552946[_0xa069('0x2e')][_0xa069('0x32')]));_0x4226f5[_0xa069('0x31')]=_0x4226f5['attributes'][_0xa069('0x33')]?_0x4226f5[_0xa069('0x31')]:_0x281fd3[_0xa069('0x2c')];if(!_0x552946[_0xa069('0x2e')][_0xa069('0x34')]('nolimit')){_0x4226f5[_0xa069('0x1d')]=qs[_0xa069('0x1d')](_0x552946[_0xa069('0x2e')]['limit']);_0x4226f5['offset']=qs['offset'](_0x552946['query'][_0xa069('0x1c')]);}_0x4226f5[_0xa069('0x35')]=qs[_0xa069('0x36')](_0x552946[_0xa069('0x2e')][_0xa069('0x36')]);_0x4226f5[_0xa069('0x37')]=qs[_0xa069('0x38')](_['pick'](_0x552946[_0xa069('0x2e')],_0x281fd3[_0xa069('0x38')]),_0x204f6e);if(_0x552946['query'][_0xa069('0x39')]){_0x4226f5['where']=_[_0xa069('0x3a')](_0x4226f5[_0xa069('0x37')],{'$or':_[_0xa069('0x28')](_0x204f6e,function(_0x5ca793){if(_0x5ca793[_0xa069('0x2a')]!==_0xa069('0x3b')){var _0x3afb8e={};_0x3afb8e[_0x5ca793[_0xa069('0x25')]]={'$like':'%'+_0x552946[_0xa069('0x2e')][_0xa069('0x39')]+'%'};return _0x3afb8e;}})});}_0x4226f5=_['merge']({},_0x4226f5,_0x552946[_0xa069('0x3c')]);var _0x1a42c4={'where':_0x4226f5[_0xa069('0x37')]};return db['VoiceRecording'][_0xa069('0x1b')](_0x1a42c4)['then'](function(_0x29b43b){_0x3bbea2['count']=_0x29b43b;if(_0x552946['query']['includeAll']){_0x4226f5[_0xa069('0x3d')]=[{'all':!![]}];}return db[_0xa069('0x3e')][_0xa069('0x3f')](_0x4226f5);})['then'](function(_0x2419a8){_0x3bbea2[_0xa069('0x40')]=_0x2419a8;return _0x3bbea2;})[_0xa069('0x22')](respondWithFilteredResult(_0x32227c,_0x4226f5))[_0xa069('0x41')](handleError(_0x32227c,null));};exports[_0xa069('0x42')]=function(_0x38ad26,_0x49219e){var _0x517ec7={'raw':![],'where':{'id':_0x38ad26[_0xa069('0x43')]['id']}},_0x5cfd53={};_0x5cfd53[_0xa069('0x2c')]=_['keys'](db['VoiceRecording']['rawAttributes']);_0x5cfd53[_0xa069('0x2e')]=_[_0xa069('0x2f')](_0x38ad26[_0xa069('0x2e')]);_0x5cfd53[_0xa069('0x38')]=_[_0xa069('0x30')](_0x5cfd53['model'],_0x5cfd53['query']);_0x517ec7[_0xa069('0x31')]=_[_0xa069('0x30')](_0x5cfd53[_0xa069('0x2c')],qs['fields'](_0x38ad26[_0xa069('0x2e')][_0xa069('0x32')]));_0x517ec7[_0xa069('0x31')]=_0x517ec7['attributes'][_0xa069('0x33')]?_0x517ec7[_0xa069('0x31')]:_0x5cfd53[_0xa069('0x2c')];if(_0x38ad26[_0xa069('0x2e')][_0xa069('0x44')]){_0x517ec7['include']=[{'all':!![]}];}_0x517ec7=_[_0xa069('0x3a')]({},_0x517ec7,_0x38ad26[_0xa069('0x3c')]);return db[_0xa069('0x3e')][_0xa069('0x45')](_0x517ec7)['then'](handleEntityNotFound(_0x49219e,null))[_0xa069('0x22')](respondWithResult(_0x49219e,null))[_0xa069('0x41')](handleError(_0x49219e,null));};exports['create']=function(_0x5aa0da,_0x4e9d61){return db['VoiceRecording'][_0xa069('0x46')](_0x5aa0da[_0xa069('0x47')],{})[_0xa069('0x22')](respondWithResult(_0x4e9d61,0xc9))['catch'](handleError(_0x4e9d61,null));};exports['update']=function(_0x181134,_0x29cce6){if(_0x181134[_0xa069('0x47')]['id']){delete _0x181134['body']['id'];}return db[_0xa069('0x3e')][_0xa069('0x45')]({'where':{'id':_0x181134['params']['id']}})['then'](handleEntityNotFound(_0x29cce6,null))[_0xa069('0x22')](saveUpdates(_0x181134[_0xa069('0x47')],null))[_0xa069('0x22')](respondWithResult(_0x29cce6,null))[_0xa069('0x41')](handleError(_0x29cce6,null));};exports[_0xa069('0x48')]=function(_0x58d252,_0x426242){return db['VoiceRecording'][_0xa069('0x48')]()[_0xa069('0x22')](respondWithResult(_0x426242,null))[_0xa069('0x41')](handleError(_0x426242,null));};exports[_0xa069('0x49')]=function(_0x4011bd,_0x20af49,_0x599986){var _0x62efb1=require(_0xa069('0x4a'));var _0x20d9b1=![];var _0x46c602={};if(_0x4011bd['query'][_0xa069('0x2a')]&&_0x4011bd['query']['type']===_0xa069('0x4b')){_0x46c602[_0xa069('0x4b')]=_0x4011bd[_0xa069('0x43')]['id'];}else{_0x46c602['id']=_0x4011bd[_0xa069('0x43')]['id'];}return db[_0xa069('0x3e')][_0xa069('0x45')]({'where':_0x46c602,'attributes':['id',_0xa069('0x4c')],'raw':!![]})['then'](handleEntityNotFound(_0x20af49,null))[_0xa069('0x22')](function(_0x26f84a){if(_0x26f84a){var _0x5bbd72=_0x26f84a['value'];var _0x2221b9=util[_0xa069('0x4d')](_0xa069('0x4e'),_0x5bbd72);if(fs[_0xa069('0x4f')](_0x2221b9)){_0x20d9b1=!![];return _0x62efb1[_0xa069('0x50')](_0x2221b9,_0x5bbd72,config[_0xa069('0x51')]['recording'])['then'](function(){return _0x26f84a;});}return _0x26f84a;}})[_0xa069('0x22')](function(_0x45ec5e){if(_0x45ec5e){var _0x17864a=_0x45ec5e[_0xa069('0x4c')];if(!fs[_0xa069('0x4f')](_0x17864a)){throw new db[(_0xa069('0x52'))][(_0xa069('0x53'))](_0xa069('0x54'));}if(_0x45ec5e[_0xa069('0x55')]){return _0x20af49[_0xa069('0x49')](_0x17864a,_0x45ec5e[_0xa069('0x55')]+path['extname'](_0x17864a),function(){if(_0x20d9b1){fs[_0xa069('0x56')](_0x17864a);}});}else{return _0x20af49[_0xa069('0x49')](_0x17864a,function(_0xb9be9){if(_0x20d9b1){fs[_0xa069('0x56')](_0x17864a);}});}}})[_0xa069('0x41')](function(_0x418010){if(_0x418010[_0xa069('0x57')]===_0xa069('0x54')){_0x20af49[_0xa069('0x19')](0x194)[_0xa069('0x26')](_0xa069('0x58'));}else{return handleError(_0x20af49,null);}});};exports[_0xa069('0x59')]=function(_0x3e8301,_0x5ebb8e,_0x58add4){var _0x19670d=require('../../components/encryptor');var _0x4852b2=![];var _0x51e039={'$and':[db[_0xa069('0x5a')][_0xa069('0x37')](db['sequelize']['fn'](_0xa069('0x5b'),db[_0xa069('0x5a')][_0xa069('0x5c')]('uniqueid')),_0x3e8301[_0xa069('0x2e')][_0xa069('0x5d')])]};if(_0x3e8301[_0xa069('0x2e')][_0xa069('0x2a')]&&_0x3e8301[_0xa069('0x2e')][_0xa069('0x2a')]===_0xa069('0x4b')){_0x51e039[_0xa069('0x5e')][_0xa069('0x5f')]({'uniqueid':_0x3e8301[_0xa069('0x43')]['id']});}else{_0x51e039[_0xa069('0x5e')][_0xa069('0x5f')]({'id':_0x3e8301[_0xa069('0x43')]['id']});}return db[_0xa069('0x3e')][_0xa069('0x45')]({'where':_0x51e039,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x5ebb8e,null))[_0xa069('0x22')](function(_0x434abb){if(_0x434abb){var _0x2aba03=util[_0xa069('0x4d')](_0xa069('0x4e'),_0x434abb[_0xa069('0x4c')]);if(fs['existsSync'](_0x2aba03)){_0x4852b2=!![];return _0x19670d[_0xa069('0x50')](_0x2aba03,_0x434abb[_0xa069('0x4c')],config[_0xa069('0x51')]['recording'])[_0xa069('0x22')](function(){return _0x434abb;});}return _0x434abb;}})['then'](function(_0x13196b){if(_0x13196b){if(!fs[_0xa069('0x4f')](_0x13196b[_0xa069('0x4c')])){throw new db[(_0xa069('0x52'))]['ValidationError'](_0xa069('0x54'));}if(_0x13196b[_0xa069('0x55')]){return _0x5ebb8e['download'](_0x13196b['value'],_0x13196b[_0xa069('0x55')]+path[_0xa069('0x60')](_0x13196b['value']),function(){if(_0x4852b2){fs[_0xa069('0x56')](_0x13196b[_0xa069('0x4c')]);}});}else{return _0x5ebb8e[_0xa069('0x49')](_0x13196b[_0xa069('0x4c')],function(_0xac37){if(_0x4852b2){fs[_0xa069('0x56')](_0x13196b[_0xa069('0x4c')]);}});}}})[_0xa069('0x41')](handleError(_0x5ebb8e,null));};exports[_0xa069('0x61')]=function(_0x2beecb,_0x725be8){return db[_0xa069('0x3e')][_0xa069('0x45')]({'where':{'id':_0x2beecb['params']['id']}})[_0xa069('0x22')](function(_0x999192){if(!_0x999192)throw new ReferenceError(_0xa069('0x62'));return _0x999192;})['then'](function(_0x445e77){var _0x59e745=_0x445e77[_0xa069('0x4c')];logger[_0xa069('0x63')](_0xa069('0x64'),_0x59e745);if(!_['isNil'](_0x445e77[_0xa069('0x4c')])&&fs[_0xa069('0x4f')](_0x59e745)){logger[_0xa069('0x63')](_0xa069('0x65')+_0x59e745+_0xa069('0x66'));fs['unlinkSync'](_0x59e745);}_0x59e745=_0x59e745+_0xa069('0x67');if(!_[_0xa069('0x68')](_0x445e77[_0xa069('0x4c')])&&fs[_0xa069('0x4f')](_0x59e745)){logger['info']('File:\x20\x22'+_0x59e745+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xa069('0x69')](_0x59e745);}return _0x445e77;})[_0xa069('0x22')](function(_0x2ce6a8){if(!_0x2ce6a8)throw new InternalError();return _0x2ce6a8[_0xa069('0x61')]();})[_0xa069('0x22')](function(){_0x725be8[_0xa069('0x19')](0xcc)[_0xa069('0x1a')]();})[_0xa069('0x41')](handleError(_0x725be8,null));};function getBucketslist(_0x12796b,_0x2c2a24,_0x2b94bb){return new Promise(function(_0x27d7c5,_0x25d1d0){var _0x39bb4a=new AWS['S3']({'accessKeyId':_0x2c2a24,'secretAccessKey':_0x12796b,'region':_0x2b94bb});_0x39bb4a[_0xa069('0x6a')]({},function(_0x5ebd4f,_0x382b56){if(_0x5ebd4f){return _0x25d1d0(_0x5ebd4f);}else{return _0x27d7c5(_0x382b56);}});});}function createBucket(_0x5a66a7,_0x534429,_0x585af5,_0x23ce8e){return new Promise(function(_0x35984e,_0x1396ba){var _0x583ee4=new AWS['S3']({'accessKeyId':_0x534429,'secretAccessKey':_0x5a66a7,'region':_0x585af5});_0x583ee4[_0xa069('0x6b')]({'Bucket':_0x23ce8e},function(_0x544229,_0x21b059){if(_0x544229){return _0x1396ba(_0x544229);}else{return _0x35984e(_0x21b059);}});});}function uploadFile(_0x5d2225,_0x3315c1,_0x5d40d6,_0xf27c66,_0xb65990,_0x4d392c){return new Promise(function(_0x344019,_0x1a92d5){var _0x3e4be3=new AWS['S3']({'accessKeyId':_0x3315c1,'secretAccessKey':_0x5d2225,'region':_0x5d40d6});_0x3e4be3[_0xa069('0x6c')]({'Bucket':_0xf27c66,'Key':_0xb65990,'Body':_0x4d392c},function(_0x586a59,_0x49cfdc){if(_0x586a59){return _0x1a92d5(_0x586a59);}else{return _0x344019(_0x49cfdc);}});});}function startTranscribe(_0x44c81a,_0x3bc943,_0x23da01,_0x36efe8,_0x5e791d,_0x508b80){return new Promise(function(_0x4227b0,_0x106888){var _0x2eadc1=new AWS[(_0xa069('0x6d'))]({'accessKeyId':_0x3bc943,'secretAccessKey':_0x44c81a,'region':_0x23da01});_0x2eadc1[_0xa069('0x6e')]({'TranscriptionJobName':_0x36efe8,'LanguageCode':_0x5e791d,'Media':{'MediaFileUri':_0x508b80}},function(_0x5f1401,_0x343618){if(_0x5f1401){return _0x106888(_0x5f1401);}else{return _0x4227b0(_0x343618);}});});}function transcribe(_0x3c3918,_0xec24ec,_0x12af1e,_0x234d99,_0xb08eea,_0x477eb6,_0x4b24c3){return new Promise(function(_0x4b8308,_0x391a23){var _0x4e3f67={};logger[_0xa069('0x63')](util[_0xa069('0x4d')](_0xa069('0x6f'),_0x3c3918,_0xb08eea));return uploadFile(_0xec24ec,_0x12af1e,_0x234d99,_0xb08eea,path[_0xa069('0x70')](_0x477eb6),fs[_0xa069('0x71')](_0x477eb6))['then'](function(_0x60d941){logger['info'](util[_0xa069('0x4d')](_0xa069('0x72'),_0x3c3918,_0xb08eea,_0x60d941['Location']));_0x4e3f67[_0xa069('0x73')]=_0x60d941['Bucket'];_0x4e3f67[_0xa069('0x74')]=_0x60d941[_0xa069('0x75')];logger[_0xa069('0x63')](util[_0xa069('0x4d')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x3c3918));return startTranscribe(_0xec24ec,_0x12af1e,_0x234d99,uuidv4(),_0x4b24c3,_0x60d941[_0xa069('0x75')]);})[_0xa069('0x22')](function(_0x52d327){logger['info'](util['format'](_0xa069('0x76'),_0x3c3918,_0x52d327[_0xa069('0x77')][_0xa069('0x78')]));_0x4e3f67[_0xa069('0x79')]=_0x52d327[_0xa069('0x77')]['TranscriptionJobName'];_0x4e3f67[_0xa069('0x7a')]=_0x52d327[_0xa069('0x77')]['TranscriptionJobStatus'];return _0x4b8308(_0x4e3f67);})[_0xa069('0x41')](function(_0x3e615a){return _0x391a23(_0x3e615a);});});}exports['runTranscribe']=function(_0x12a560,_0x293ced,_0x4e37c2){var _0x34e2f0;var _0x3e81d8;var _0x159d4a;var _0x2b0e5e=require('../../components/encryptor');return db['VoiceRecording'][_0xa069('0x7b')]({'where':{'id':_0x12a560[_0xa069('0x43')]['id']}})[_0xa069('0x22')](function(_0x11fa65){if(_0x11fa65){var _0x571695=util[_0xa069('0x4d')](_0xa069('0x4e'),_0x11fa65[_0xa069('0x4c')]);if(fs['existsSync'](_0x571695)){cypher=!![];return _0x2b0e5e[_0xa069('0x50')](_0x571695,_0x11fa65[_0xa069('0x4c')],config['secrets'][_0xa069('0x7c')])[_0xa069('0x22')](function(){return _0x11fa65;});}return _0x11fa65;}})[_0xa069('0x22')](function(_0x3beb3e){if(!_0x3beb3e){throw new db[(_0xa069('0x52'))]['ValidationError']('Voice\x20Recording\x20not\x20found');}_0x3e81d8=_0x3beb3e;return db[_0xa069('0x7d')][_0xa069('0x7b')]({'where':{'id':0x1}});})[_0xa069('0x22')](handleEntityNotFound(_0x293ced,null))[_0xa069('0x22')](function(_0x5d9b74){if(_0x5d9b74){_0x34e2f0=_0x5d9b74;if(!_0x34e2f0['transcribe']||!_0x34e2f0[_0xa069('0x7e')]||!_0x34e2f0[_0xa069('0x7f')]||!_0x34e2f0[_0xa069('0x80')]||!_0x34e2f0['bucket']){throw new db[(_0xa069('0x52'))]['ValidationError'](_0xa069('0x81'));}if(_0x12a560[_0xa069('0x47')][_0xa069('0x82')]&&(!_0x34e2f0[_0xa069('0x83')]||!_0x34e2f0[_0xa069('0x84')]||!_0x34e2f0[_0xa069('0x85')]||!_0x34e2f0['language']||!_0x34e2f0[_0xa069('0x73')])){throw new db['Sequelize'][(_0xa069('0x53'))](_0xa069('0x86'));}return db[_0xa069('0x87')][_0xa069('0x7b')]({'where':{'id':_0x34e2f0[_0xa069('0x7e')]}});}})[_0xa069('0x22')](function(_0x35c4cc){if(!_0x35c4cc){throw new db[(_0xa069('0x52'))][(_0xa069('0x53'))](_0xa069('0x88'));}if(!_0x35c4cc[_0xa069('0x89')]||!_0x35c4cc[_0xa069('0x8a')]){throw new db[(_0xa069('0x52'))][(_0xa069('0x53'))]('Cloud\x20Provider\x20not\x20configured');}_0x159d4a=_0x35c4cc;return getBucketslist(_0x159d4a[_0xa069('0x89')],_0x159d4a[_0xa069('0x8a')],_0x34e2f0['transcribeRegion']);})[_0xa069('0x22')](function(_0x3f9bad){if(_0x3f9bad&&_0x3f9bad[_0xa069('0x8b')]){var _0x45b926=_[_0xa069('0x45')](_0x3f9bad[_0xa069('0x8b')],function(_0x1453b8){return _0x1453b8[_0xa069('0x8c')]===_0x34e2f0[_0xa069('0x73')];});if(!_0x45b926){logger[_0xa069('0x63')](util[_0xa069('0x4d')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x12a560[_0xa069('0x43')]['id'],_0x34e2f0['bucket']));return createBucket(_0x159d4a[_0xa069('0x89')],_0x159d4a[_0xa069('0x8a')],_0x34e2f0[_0xa069('0x7f')],_0x34e2f0['bucket']);}logger[_0xa069('0x63')](util[_0xa069('0x4d')](_0xa069('0x8d'),_0x12a560[_0xa069('0x43')]['id'],_0x34e2f0['bucket']));return;}})[_0xa069('0x22')](function(_0x57d9d6){if(_0x3e81d8[_0xa069('0x7a')]===_0xa069('0x8e')){return transcribe(_0x12a560[_0xa069('0x43')]['id'],_0x159d4a[_0xa069('0x89')],_0x159d4a[_0xa069('0x8a')],_0x34e2f0[_0xa069('0x7f')],_0x34e2f0['bucket'],_0x3e81d8[_0xa069('0x4c')],_0x34e2f0[_0xa069('0x80')]);}else{logger[_0xa069('0x63')](util['format'](_0xa069('0x8f'),_0x12a560[_0xa069('0x43')]['id']));return{'transcribeStatus':_0xa069('0x90')};}})[_0xa069('0x22')](function(_0x247756){if(_0x247756){_0x247756[_0xa069('0x91')]=_0x12a560[_0xa069('0x47')][_0xa069('0x82')];return _0x3e81d8[_0xa069('0x92')](_0x247756);}})[_0xa069('0x22')](respondWithResult(_0x293ced,null))['catch'](handleError(_0x293ced,null));};function writeFile(_0x166cfa,_0x1c4eca){return new Promise(function(_0x1f24b6,_0x5c2654){fs[_0xa069('0x93')](_0x1c4eca,_0x166cfa,function(_0x518f94,_0x232c82){if(_0x518f94){return _0x5c2654(_0x518f94);}else{return _0x1f24b6(_0x232c82);}});});}exports[_0xa069('0x94')]=function(_0x473d89,_0x4e3bd1,_0x2c57e2){return db[_0xa069('0x3e')][_0xa069('0x7b')]({'where':{'id':_0x473d89['params']['id']}})[_0xa069('0x22')](handleEntityNotFound(_0x4e3bd1))['then'](function(_0x56fa91){if(_0x56fa91&&_0x56fa91[_0xa069('0x95')]){var _0x2146a4=_0x56fa91['fileText'];var _0xc50a6=config['root']+'/server/files/transcribes/transcribe_'+_0x56fa91['id']+'.txt';if(fs[_0xa069('0x4f')](_0xc50a6)){return _0xc50a6;}return writeFile(_0x2146a4,_0xc50a6)[_0xa069('0x22')](function(){return _0xc50a6;});}else{throw new db['Sequelize'][(_0xa069('0x53'))](_0xa069('0x96'));}})[_0xa069('0x22')](function(_0x3e6cec){return _0x4e3bd1[_0xa069('0x49')](_0x3e6cec);})[_0xa069('0x41')](handleError(_0x4e3bd1));}; \ No newline at end of file +var _0x02b3=['desk.js','to-csv','querystring','papaparse','aws-sdk','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','apply','reject','update','then','stack','name','send','index','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','map','format','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','includeAll','include','catch','show','params','filters','merge','find','create','body','describe','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','ValidationError','VoiceRecording\x20not\x20found','download','filename','unlink','message','Not\x20found','sequelize','MD5','col','token','$and','push','recording','Sequelize','extname','destroy','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','createBucket','upload','TranscribeService','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','[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','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce'];(function(_0x145ba1,_0x36734e){var _0x3dd637=function(_0x58acbe){while(--_0x58acbe){_0x145ba1['push'](_0x145ba1['shift']());}};_0x3dd637(++_0x36734e);}(_0x02b3,0x1bd));var _0x302b=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0x02b3[_0x474bc0];return _0x4b24cf;};'use strict';var pdf=require(_0x302b('0x0'));var emlformat=require(_0x302b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x302b('0x2'));var moment=require(_0x302b('0x3'));var BPromise=require(_0x302b('0x4'));var Mustache=require(_0x302b('0x5'));var util=require(_0x302b('0x6'));var path=require(_0x302b('0x7'));var sox=require(_0x302b('0x8'));var csv=require('to-csv');var ejs=require(_0x302b('0x9'));var fs=require('fs');var _=require(_0x302b('0xa'));var squel=require(_0x302b('0xb'));var crypto=require(_0x302b('0xc'));var jsforce=require(_0x302b('0xd'));var deskjs=require(_0x302b('0xe'));var toCsv=require(_0x302b('0xf'));var querystring=require(_0x302b('0x10'));var Papa=require(_0x302b('0x11'));var AWS=require(_0x302b('0x12'));var uuidv4=require('uuid/v4');var Redis=require('ioredis');var authService=require(_0x302b('0x13'));var qs=require(_0x302b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x302b('0x15'))(_0x302b('0x16'));var utils=require(_0x302b('0x17'));var config=require(_0x302b('0x18'));var db=require(_0x302b('0x19'))['db'];function respondWithStatusCode(_0x541881,_0x40a574){_0x40a574=_0x40a574||0xcc;return function(_0x4d04af){if(_0x4d04af){return _0x541881[_0x302b('0x1a')](_0x40a574);}return _0x541881['status'](_0x40a574)[_0x302b('0x1b')]();};}function respondWithResult(_0x2f0661,_0x53ba25){_0x53ba25=_0x53ba25||0xc8;return function(_0x598c14){if(_0x598c14){return _0x2f0661[_0x302b('0x1c')](_0x53ba25)[_0x302b('0x1d')](_0x598c14);}};}function respondWithFilteredResult(_0x3e48f3,_0x5a0aa0){return function(_0x394daf){if(_0x394daf){var _0x44f7a2=_0x394daf[_0x302b('0x1e')],_0x5245cc=_0x5a0aa0[_0x302b('0x1f')],_0x47e2a2=_0x5a0aa0[_0x302b('0x1f')]+_0x5a0aa0[_0x302b('0x20')],_0x3a6e49;if(_0x47e2a2>=_0x44f7a2){_0x47e2a2=_0x44f7a2;_0x3a6e49=0xc8;}else{_0x3a6e49=0xce;}_0x3e48f3[_0x302b('0x1c')](_0x3a6e49);return _0x3e48f3['set']('Content-Range',_0x5245cc+'-'+_0x47e2a2+'/'+_0x44f7a2)[_0x302b('0x1d')](_0x394daf);}return null;};}function patchUpdates(_0x41b7f7){return function(_0x1c636b){try{jsonpatch[_0x302b('0x21')](_0x1c636b,_0x41b7f7,!![]);}catch(_0x3529ff){return BPromise[_0x302b('0x22')](_0x3529ff);}return _0x1c636b['save']();};}function saveUpdates(_0x19c21a,_0x425351){return function(_0x28037a){if(_0x28037a){return _0x28037a[_0x302b('0x23')](_0x19c21a)[_0x302b('0x24')](function(_0x1b4c3d){return _0x1b4c3d;});}return null;};}function removeEntity(_0x16f38d,_0x261b4f){return function(_0x397da1){if(_0x397da1){return _0x397da1['destroy']()[_0x302b('0x24')](function(){_0x16f38d['status'](0xcc)[_0x302b('0x1b')]();});}};}function handleEntityNotFound(_0x2294a4,_0x58d115){return function(_0x405700){if(!_0x405700){_0x2294a4[_0x302b('0x1a')](0x194);}return _0x405700;};}function handleError(_0x10b094,_0x3e0745){_0x3e0745=_0x3e0745||0x1f4;return function(_0x58a59b){logger['error'](_0x58a59b[_0x302b('0x25')]);if(_0x58a59b[_0x302b('0x26')]){delete _0x58a59b[_0x302b('0x26')];}_0x10b094[_0x302b('0x1c')](_0x3e0745)[_0x302b('0x27')](_0x58a59b);};}exports[_0x302b('0x28')]=function(_0x3447d3,_0xd71ac9){var _0x36e09c={},_0x2b274c={},_0x50de83={'count':0x0,'rows':[]};var _0x273072=_['map'](db[_0x302b('0x29')][_0x302b('0x2a')],function(_0x2175df){return{'name':_0x2175df[_0x302b('0x2b')],'type':_0x2175df[_0x302b('0x2c')][_0x302b('0x2d')]};});_0x2b274c[_0x302b('0x2e')]=_[_0x302b('0x2f')](_[_0x302b('0x30')](_0x273072,'name'),[_0x302b('0x31')]);_0x2b274c['query']=_[_0x302b('0x32')](_0x3447d3[_0x302b('0x33')]);_0x2b274c['filters']=_[_0x302b('0x34')](_0x2b274c[_0x302b('0x2e')],_0x2b274c['query']);_0x36e09c['attributes']=_[_0x302b('0x34')](_0x2b274c[_0x302b('0x2e')],qs['fields'](_0x3447d3[_0x302b('0x33')][_0x302b('0x35')]));_0x36e09c[_0x302b('0x36')]=_0x36e09c['attributes'][_0x302b('0x37')]?_0x36e09c['attributes']:_0x2b274c[_0x302b('0x2e')];if(!_0x3447d3[_0x302b('0x33')][_0x302b('0x38')](_0x302b('0x39'))){_0x36e09c[_0x302b('0x20')]=qs[_0x302b('0x20')](_0x3447d3['query']['limit']);_0x36e09c[_0x302b('0x1f')]=qs[_0x302b('0x1f')](_0x3447d3['query']['offset']);}_0x36e09c[_0x302b('0x3a')]=qs['sort'](_0x3447d3[_0x302b('0x33')][_0x302b('0x3b')]);_0x36e09c['where']=qs['filters'](_['pick'](_0x3447d3[_0x302b('0x33')],_0x2b274c['filters']),_0x273072);if(_0x3447d3[_0x302b('0x33')]['filter']){_0x36e09c[_0x302b('0x3c')]=_['merge'](_0x36e09c[_0x302b('0x3c')],{'$or':_[_0x302b('0x30')](_0x273072,function(_0x250c8a){if(_0x250c8a[_0x302b('0x2c')]!==_0x302b('0x3d')){var _0x1a7a3c={};_0x1a7a3c[_0x250c8a[_0x302b('0x26')]]={'$like':'%'+_0x3447d3[_0x302b('0x33')]['filter']+'%'};return _0x1a7a3c;}})});}_0x36e09c=_['merge']({},_0x36e09c,_0x3447d3['options']);var _0x481226={'where':_0x36e09c[_0x302b('0x3c')]};return db[_0x302b('0x29')]['count'](_0x481226)[_0x302b('0x24')](function(_0x47d49b){_0x50de83[_0x302b('0x1e')]=_0x47d49b;if(_0x3447d3['query'][_0x302b('0x3e')]){_0x36e09c[_0x302b('0x3f')]=[{'all':!![]}];}return db[_0x302b('0x29')]['findAll'](_0x36e09c);})[_0x302b('0x24')](function(_0x5ce57e){_0x50de83['rows']=_0x5ce57e;return _0x50de83;})[_0x302b('0x24')](respondWithFilteredResult(_0xd71ac9,_0x36e09c))[_0x302b('0x40')](handleError(_0xd71ac9,null));};exports[_0x302b('0x41')]=function(_0x55deb9,_0x450948){var _0x5336b4={'raw':![],'where':{'id':_0x55deb9[_0x302b('0x42')]['id']}},_0x3ba657={};_0x3ba657['model']=_[_0x302b('0x32')](db[_0x302b('0x29')]['rawAttributes']);_0x3ba657[_0x302b('0x33')]=_[_0x302b('0x32')](_0x55deb9[_0x302b('0x33')]);_0x3ba657[_0x302b('0x43')]=_[_0x302b('0x34')](_0x3ba657[_0x302b('0x2e')],_0x3ba657[_0x302b('0x33')]);_0x5336b4['attributes']=_[_0x302b('0x34')](_0x3ba657['model'],qs[_0x302b('0x35')](_0x55deb9[_0x302b('0x33')][_0x302b('0x35')]));_0x5336b4['attributes']=_0x5336b4[_0x302b('0x36')]['length']?_0x5336b4[_0x302b('0x36')]:_0x3ba657['model'];if(_0x55deb9[_0x302b('0x33')][_0x302b('0x3e')]){_0x5336b4[_0x302b('0x3f')]=[{'all':!![]}];}_0x5336b4=_[_0x302b('0x44')]({},_0x5336b4,_0x55deb9['options']);return db[_0x302b('0x29')][_0x302b('0x45')](_0x5336b4)[_0x302b('0x24')](handleEntityNotFound(_0x450948,null))['then'](respondWithResult(_0x450948,null))['catch'](handleError(_0x450948,null));};exports[_0x302b('0x46')]=function(_0x86373a,_0x4b6392){return db['VoiceRecording']['create'](_0x86373a[_0x302b('0x47')],{})[_0x302b('0x24')](respondWithResult(_0x4b6392,0xc9))[_0x302b('0x40')](handleError(_0x4b6392,null));};exports[_0x302b('0x23')]=function(_0x9dc79b,_0x97ab22){if(_0x9dc79b[_0x302b('0x47')]['id']){delete _0x9dc79b['body']['id'];}return db[_0x302b('0x29')]['find']({'where':{'id':_0x9dc79b[_0x302b('0x42')]['id']}})[_0x302b('0x24')](handleEntityNotFound(_0x97ab22,null))[_0x302b('0x24')](saveUpdates(_0x9dc79b[_0x302b('0x47')],null))[_0x302b('0x24')](respondWithResult(_0x97ab22,null))[_0x302b('0x40')](handleError(_0x97ab22,null));};exports[_0x302b('0x48')]=function(_0x3f3293,_0x41ce20){return db['VoiceRecording'][_0x302b('0x48')]()[_0x302b('0x24')](respondWithResult(_0x41ce20,null))['catch'](handleError(_0x41ce20,null));};exports['download']=function(_0x201f91,_0x5a5237,_0x19cb53){var _0x2f4ef5=require(_0x302b('0x49'));var _0x1ce755=![];var _0x3f59be={};if(_0x201f91[_0x302b('0x33')][_0x302b('0x2c')]&&_0x201f91['query'][_0x302b('0x2c')]===_0x302b('0x4a')){_0x3f59be[_0x302b('0x4a')]=_0x201f91[_0x302b('0x42')]['id'];}else{_0x3f59be['id']=_0x201f91[_0x302b('0x42')]['id'];}return db[_0x302b('0x29')][_0x302b('0x45')]({'where':_0x3f59be,'attributes':['id',_0x302b('0x4b')],'raw':!![]})[_0x302b('0x24')](handleEntityNotFound(_0x5a5237,null))[_0x302b('0x24')](function(_0x205cc3){if(_0x205cc3){var _0xa68319=_0x205cc3[_0x302b('0x4b')];var _0x158760=util[_0x302b('0x31')](_0x302b('0x4c'),_0xa68319);if(fs[_0x302b('0x4d')](_0x158760)){_0x1ce755=!![];return _0x2f4ef5[_0x302b('0x4e')](_0x158760,_0xa68319,config[_0x302b('0x4f')]['recording'])[_0x302b('0x24')](function(){return _0x205cc3;});}return _0x205cc3;}})[_0x302b('0x24')](function(_0x37f0bb){if(_0x37f0bb){var _0x4f61fc=_0x37f0bb[_0x302b('0x4b')];if(!fs['existsSync'](_0x4f61fc)){throw new db['Sequelize'][(_0x302b('0x50'))](_0x302b('0x51'));}if(_0x37f0bb['filename']){return _0x5a5237[_0x302b('0x52')](_0x4f61fc,_0x37f0bb[_0x302b('0x53')]+path['extname'](_0x4f61fc),function(){if(_0x1ce755){fs[_0x302b('0x54')](_0x4f61fc);}});}else{return _0x5a5237[_0x302b('0x52')](_0x4f61fc,function(_0x176055){if(_0x1ce755){fs['unlink'](_0x4f61fc);}});}}})[_0x302b('0x40')](function(_0x3259e8){if(_0x3259e8[_0x302b('0x55')]===_0x302b('0x51')){_0x5a5237[_0x302b('0x1c')](0x194)[_0x302b('0x27')](_0x302b('0x56'));}else{return handleError(_0x5a5237,null);}});};exports['downloads']=function(_0x55895a,_0x18dadd,_0xa19fc3){var _0x4c52a7=require(_0x302b('0x49'));var _0x2718db=![];var _0x2b38c0={'$and':[db[_0x302b('0x57')][_0x302b('0x3c')](db['sequelize']['fn'](_0x302b('0x58'),db[_0x302b('0x57')][_0x302b('0x59')](_0x302b('0x4a'))),_0x55895a[_0x302b('0x33')][_0x302b('0x5a')])]};if(_0x55895a[_0x302b('0x33')][_0x302b('0x2c')]&&_0x55895a[_0x302b('0x33')][_0x302b('0x2c')]===_0x302b('0x4a')){_0x2b38c0[_0x302b('0x5b')][_0x302b('0x5c')]({'uniqueid':_0x55895a['params']['id']});}else{_0x2b38c0[_0x302b('0x5b')]['push']({'id':_0x55895a['params']['id']});}return db[_0x302b('0x29')]['find']({'where':_0x2b38c0,'attributes':['id',_0x302b('0x4b')],'raw':!![]})[_0x302b('0x24')](handleEntityNotFound(_0x18dadd,null))['then'](function(_0x4231f9){if(_0x4231f9){var _0xaa8d60=util[_0x302b('0x31')](_0x302b('0x4c'),_0x4231f9[_0x302b('0x4b')]);if(fs[_0x302b('0x4d')](_0xaa8d60)){_0x2718db=!![];return _0x4c52a7[_0x302b('0x4e')](_0xaa8d60,_0x4231f9[_0x302b('0x4b')],config[_0x302b('0x4f')][_0x302b('0x5d')])['then'](function(){return _0x4231f9;});}return _0x4231f9;}})['then'](function(_0x3a3df7){if(_0x3a3df7){if(!fs[_0x302b('0x4d')](_0x3a3df7['value'])){throw new db[(_0x302b('0x5e'))][(_0x302b('0x50'))](_0x302b('0x51'));}if(_0x3a3df7[_0x302b('0x53')]){return _0x18dadd['download'](_0x3a3df7[_0x302b('0x4b')],_0x3a3df7['filename']+path[_0x302b('0x5f')](_0x3a3df7[_0x302b('0x4b')]),function(){if(_0x2718db){fs[_0x302b('0x54')](_0x3a3df7[_0x302b('0x4b')]);}});}else{return _0x18dadd[_0x302b('0x52')](_0x3a3df7[_0x302b('0x4b')],function(_0x58e482){if(_0x2718db){fs[_0x302b('0x54')](_0x3a3df7['value']);}});}}})[_0x302b('0x40')](handleError(_0x18dadd,null));};exports[_0x302b('0x60')]=function(_0x2eb257,_0x1f3ecd){return db[_0x302b('0x29')][_0x302b('0x45')]({'where':{'id':_0x2eb257[_0x302b('0x42')]['id']}})[_0x302b('0x24')](function(_0x1f157d){if(!_0x1f157d)throw new ReferenceError('Entity\x20not\x20found');return _0x1f157d;})[_0x302b('0x24')](function(_0x268bd8){var _0x39da01=_0x268bd8[_0x302b('0x4b')];logger[_0x302b('0x61')](_0x302b('0x62'),_0x39da01);if(!_[_0x302b('0x63')](_0x268bd8['value'])&&fs['existsSync'](_0x39da01)){logger[_0x302b('0x61')](_0x302b('0x64')+_0x39da01+_0x302b('0x65'));fs[_0x302b('0x66')](_0x39da01);}_0x39da01=_0x39da01+_0x302b('0x67');if(!_[_0x302b('0x63')](_0x268bd8[_0x302b('0x4b')])&&fs[_0x302b('0x4d')](_0x39da01)){logger[_0x302b('0x61')](_0x302b('0x64')+_0x39da01+_0x302b('0x65'));fs[_0x302b('0x66')](_0x39da01);}return _0x268bd8;})[_0x302b('0x24')](function(_0x1fba1b){if(!_0x1fba1b)throw new InternalError();return _0x1fba1b[_0x302b('0x60')]();})[_0x302b('0x24')](function(){_0x1f3ecd[_0x302b('0x1c')](0xcc)[_0x302b('0x1b')]();})[_0x302b('0x40')](handleError(_0x1f3ecd,null));};function getBucketslist(_0x5c8b9b,_0x2d7767,_0x896fd6){return new Promise(function(_0x284710,_0x20d0b8){var _0x3139bd=new AWS['S3']({'accessKeyId':_0x2d7767,'secretAccessKey':_0x5c8b9b,'region':_0x896fd6});_0x3139bd['listBuckets']({},function(_0x52159a,_0x3d11f7){if(_0x52159a){return _0x20d0b8(_0x52159a);}else{return _0x284710(_0x3d11f7);}});});}function createBucket(_0x28385b,_0x6f36af,_0x273c9e,_0x43ab4a){return new Promise(function(_0x4f15b9,_0x5586fa){var _0x524fe3=new AWS['S3']({'accessKeyId':_0x6f36af,'secretAccessKey':_0x28385b,'region':_0x273c9e});_0x524fe3[_0x302b('0x68')]({'Bucket':_0x43ab4a},function(_0x44d460,_0x2dd99d){if(_0x44d460){return _0x5586fa(_0x44d460);}else{return _0x4f15b9(_0x2dd99d);}});});}function uploadFile(_0x5ef973,_0x234d0d,_0x1691ce,_0x1afa71,_0xafadc0,_0x9d0560){return new Promise(function(_0x5610d7,_0x22ecd8){var _0x3d0401=new AWS['S3']({'accessKeyId':_0x234d0d,'secretAccessKey':_0x5ef973,'region':_0x1691ce});_0x3d0401[_0x302b('0x69')]({'Bucket':_0x1afa71,'Key':_0xafadc0,'Body':_0x9d0560},function(_0x145dd9,_0x3b862c){if(_0x145dd9){return _0x22ecd8(_0x145dd9);}else{return _0x5610d7(_0x3b862c);}});});}function startTranscribe(_0x346c6f,_0x56e6e3,_0x492e31,_0x1d3296,_0x2fe260,_0x24a566){return new Promise(function(_0x24eaa0,_0x37598f){var _0x368afa=new AWS[(_0x302b('0x6a'))]({'accessKeyId':_0x56e6e3,'secretAccessKey':_0x346c6f,'region':_0x492e31});_0x368afa['startTranscriptionJob']({'TranscriptionJobName':_0x1d3296,'LanguageCode':_0x2fe260,'Media':{'MediaFileUri':_0x24a566}},function(_0x5a69f0,_0x3c909e){if(_0x5a69f0){return _0x37598f(_0x5a69f0);}else{return _0x24eaa0(_0x3c909e);}});});}function transcribe(_0x4f3318,_0x3be64d,_0x89b47b,_0x5488c9,_0x461e38,_0x1d784d,_0x248e82){return new Promise(function(_0x2d0d16,_0xb9dbe2){var _0x184d1c={};logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x4f3318,_0x461e38));return uploadFile(_0x3be64d,_0x89b47b,_0x5488c9,_0x461e38,path['basename'](_0x1d784d),fs[_0x302b('0x6b')](_0x1d784d))[_0x302b('0x24')](function(_0x5901c9){logger[_0x302b('0x61')](util[_0x302b('0x31')](_0x302b('0x6c'),_0x4f3318,_0x461e38,_0x5901c9[_0x302b('0x6d')]));_0x184d1c[_0x302b('0x6e')]=_0x5901c9[_0x302b('0x6f')];_0x184d1c[_0x302b('0x70')]=_0x5901c9[_0x302b('0x6d')];logger[_0x302b('0x61')](util[_0x302b('0x31')](_0x302b('0x71'),_0x4f3318));return startTranscribe(_0x3be64d,_0x89b47b,_0x5488c9,uuidv4(),_0x248e82,_0x5901c9[_0x302b('0x6d')]);})[_0x302b('0x24')](function(_0x158fbc){logger['info'](util[_0x302b('0x31')](_0x302b('0x72'),_0x4f3318,_0x158fbc[_0x302b('0x73')]['TranscriptionJobName']));_0x184d1c[_0x302b('0x74')]=_0x158fbc[_0x302b('0x73')][_0x302b('0x75')];_0x184d1c[_0x302b('0x76')]=_0x158fbc[_0x302b('0x73')][_0x302b('0x77')];return _0x2d0d16(_0x184d1c);})[_0x302b('0x40')](function(_0x5828e3){return _0xb9dbe2(_0x5828e3);});});}exports[_0x302b('0x78')]=function(_0x90c2a0,_0x51bb18,_0x5361a8){var _0x5c5c15;var _0x3c8db2;var _0x4ec39d;var _0x365c2a=require(_0x302b('0x49'));return db[_0x302b('0x29')][_0x302b('0x79')]({'where':{'id':_0x90c2a0[_0x302b('0x42')]['id']}})[_0x302b('0x24')](function(_0x5ca899){if(_0x5ca899){var _0x1e85d2=util[_0x302b('0x31')]('%s.cypher',_0x5ca899[_0x302b('0x4b')]);if(fs[_0x302b('0x4d')](_0x1e85d2)){cypher=!![];return _0x365c2a['decryptFile'](_0x1e85d2,_0x5ca899['value'],config[_0x302b('0x4f')][_0x302b('0x5d')])[_0x302b('0x24')](function(){return _0x5ca899;});}return _0x5ca899;}})['then'](function(_0x5e43b7){if(!_0x5e43b7){throw new db[(_0x302b('0x5e'))][(_0x302b('0x50'))](_0x302b('0x7a'));}_0x3c8db2=_0x5e43b7;return db[_0x302b('0x7b')][_0x302b('0x79')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x51bb18,null))[_0x302b('0x24')](function(_0x12d0c8){if(_0x12d0c8){_0x5c5c15=_0x12d0c8;if(!_0x5c5c15['transcribe']||!_0x5c5c15[_0x302b('0x7c')]||!_0x5c5c15[_0x302b('0x7d')]||!_0x5c5c15[_0x302b('0x7e')]||!_0x5c5c15[_0x302b('0x6e')]){throw new db[(_0x302b('0x5e'))][(_0x302b('0x50'))](_0x302b('0x7f'));}if(_0x90c2a0[_0x302b('0x47')][_0x302b('0x80')]&&(!_0x5c5c15[_0x302b('0x81')]||!_0x5c5c15[_0x302b('0x82')]||!_0x5c5c15[_0x302b('0x83')]||!_0x5c5c15[_0x302b('0x7e')]||!_0x5c5c15[_0x302b('0x6e')])){throw new db['Sequelize'][(_0x302b('0x50'))](_0x302b('0x84'));}return db[_0x302b('0x85')]['findOne']({'where':{'id':_0x5c5c15['transcribeAccountId']}});}})[_0x302b('0x24')](function(_0x794781){if(!_0x794781){throw new db[(_0x302b('0x5e'))][(_0x302b('0x50'))](_0x302b('0x86'));}if(!_0x794781['data1']||!_0x794781['data2']){throw new db['Sequelize'][(_0x302b('0x50'))](_0x302b('0x87'));}_0x4ec39d=_0x794781;return getBucketslist(_0x4ec39d[_0x302b('0x88')],_0x4ec39d[_0x302b('0x89')],_0x5c5c15['transcribeRegion']);})[_0x302b('0x24')](function(_0x1f2cbe){if(_0x1f2cbe&&_0x1f2cbe[_0x302b('0x8a')]){var _0x27fe75=_[_0x302b('0x45')](_0x1f2cbe['Buckets'],function(_0x98ea07){return _0x98ea07[_0x302b('0x8b')]===_0x5c5c15[_0x302b('0x6e')];});if(!_0x27fe75){logger[_0x302b('0x61')](util[_0x302b('0x31')](_0x302b('0x8c'),_0x90c2a0[_0x302b('0x42')]['id'],_0x5c5c15[_0x302b('0x6e')]));return createBucket(_0x4ec39d[_0x302b('0x88')],_0x4ec39d[_0x302b('0x89')],_0x5c5c15[_0x302b('0x7d')],_0x5c5c15['bucket']);}logger[_0x302b('0x61')](util[_0x302b('0x31')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x90c2a0[_0x302b('0x42')]['id'],_0x5c5c15[_0x302b('0x6e')]));return;}})[_0x302b('0x24')](function(_0x22ebf4){if(_0x3c8db2['transcribeStatus']===_0x302b('0x8d')){return transcribe(_0x90c2a0[_0x302b('0x42')]['id'],_0x4ec39d[_0x302b('0x88')],_0x4ec39d[_0x302b('0x89')],_0x5c5c15[_0x302b('0x7d')],_0x5c5c15['bucket'],_0x3c8db2[_0x302b('0x4b')],_0x5c5c15[_0x302b('0x7e')]);}else{logger[_0x302b('0x61')](util[_0x302b('0x31')](_0x302b('0x8e'),_0x90c2a0[_0x302b('0x42')]['id']));return{'transcribeStatus':_0x302b('0x8f')};}})['then'](function(_0x563853){if(_0x563853){_0x563853[_0x302b('0x90')]=_0x90c2a0['body'][_0x302b('0x80')];return _0x3c8db2[_0x302b('0x91')](_0x563853);}})[_0x302b('0x24')](respondWithResult(_0x51bb18,null))[_0x302b('0x40')](handleError(_0x51bb18,null));};function writeFile(_0x545163,_0x32d2d8){return new Promise(function(_0x4f9218,_0x448a17){fs[_0x302b('0x92')](_0x32d2d8,_0x545163,function(_0x266313,_0x56f73e){if(_0x266313){return _0x448a17(_0x266313);}else{return _0x4f9218(_0x56f73e);}});});}exports[_0x302b('0x93')]=function(_0x470257,_0x5379f5,_0x3f7bd7){return db['VoiceRecording'][_0x302b('0x79')]({'where':{'id':_0x470257[_0x302b('0x42')]['id']}})[_0x302b('0x24')](handleEntityNotFound(_0x5379f5))[_0x302b('0x24')](function(_0x184359){if(_0x184359&&_0x184359[_0x302b('0x94')]){var _0xb3c44e=_0x184359[_0x302b('0x94')];var _0x3482f7=config[_0x302b('0x95')]+_0x302b('0x96')+_0x184359['id']+_0x302b('0x97');if(fs[_0x302b('0x4d')](_0x3482f7)){return _0x3482f7;}return writeFile(_0xb3c44e,_0x3482f7)[_0x302b('0x24')](function(){return _0x3482f7;});}else{throw new db[(_0x302b('0x5e'))][(_0x302b('0x50'))](_0x302b('0x98'));}})[_0x302b('0x24')](function(_0xf00c8e){return _0x5379f5[_0x302b('0x52')](_0xf00c8e);})[_0x302b('0x40')](handleError(_0x5379f5));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 8cff122..3b55236 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 _0xf256=['lodash','util','api','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','exports','uniqueid'];(function(_0xd5acfb,_0x1747f8){var _0x3cdb89=function(_0x500377){while(--_0x500377){_0xd5acfb['push'](_0xd5acfb['shift']());}};_0x3cdb89(++_0x1747f8);}(_0xf256,0x1a4));var _0x6f25=function(_0x6e5096,_0x4913da){_0x6e5096=_0x6e5096-0x0;var _0x2a85fc=_0xf256[_0x6e5096];return _0x2a85fc;};'use strict';var _=require(_0x6f25('0x0'));var util=require(_0x6f25('0x1'));var logger=require('../../config/logger')(_0x6f25('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6f25('0x3'));var fs=require('fs');var path=require(_0x6f25('0x4'));var rimraf=require(_0x6f25('0x5'));var config=require(_0x6f25('0x6'));var attributes=require(_0x6f25('0x7'));module[_0x6f25('0x8')]=function(_0x4ae4d6,_0x47567e){return _0x4ae4d6['define']('VoiceRecording',attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x6f25('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7ea1=['./voiceRecording.attributes','exports','voice_recordings','uniqueid','lodash','util','../../config/logger','api','request-promise','path','../../config/environment'];(function(_0x4835d9,_0x2a37a2){var _0x9ad61a=function(_0x4ed89a){while(--_0x4ed89a){_0x4835d9['push'](_0x4835d9['shift']());}};_0x9ad61a(++_0x2a37a2);}(_0x7ea1,0xb4));var _0x17ea=function(_0xee2e7a,_0x58354d){_0xee2e7a=_0xee2e7a-0x0;var _0x319dd3=_0x7ea1[_0xee2e7a];return _0x319dd3;};'use strict';var _=require(_0x17ea('0x0'));var util=require(_0x17ea('0x1'));var logger=require(_0x17ea('0x2'))(_0x17ea('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x17ea('0x4'));var fs=require('fs');var path=require(_0x17ea('0x5'));var rimraf=require('rimraf');var config=require(_0x17ea('0x6'));var attributes=require(_0x17ea('0x7'));module[_0x17ea('0x8')]=function(_0x2c73bf,_0x421c59){return _0x2c73bf['define']('VoiceRecording',attributes,{'tableName':_0x17ea('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x17ea('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 1647c00..a3e23de 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(_0x51ec5c,_0x3506ef){var _0x5b04b8=function(_0x2e741f){while(--_0x2e741f){_0x51ec5c['push'](_0x51ec5c['shift']());}};_0x5b04b8(++_0x3506ef);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}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(_0x5a7d41,_0x4447e2){var _0x98d8fa=function(_0x2ce1cf){while(--_0x2ce1cf){_0x5a7d41['push'](_0x5a7d41['shift']());}};_0x98d8fa(++_0x4447e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 1bf16f5..9a293c9 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 _0x2542=['exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy'];(function(_0x4ada50,_0x54757b){var _0x3d85d5=function(_0x359a61){while(--_0x359a61){_0x4ada50['push'](_0x4ada50['shift']());}};_0x3d85d5(++_0x54757b);}(_0x2542,0x169));var _0x2254=function(_0x3e31f9,_0x2fc25e){_0x3e31f9=_0x3e31f9-0x0;var _0x429e15=_0x2542[_0x3e31f9];return _0x429e15;};'use strict';var multer=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var path=require(_0x2254('0x2'));var timeout=require(_0x2254('0x3'));var express=require('express');var router=express[_0x2254('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2254('0x5'));var config=require(_0x2254('0x6'));var controller=require(_0x2254('0x7'));router[_0x2254('0x8')]('/',auth[_0x2254('0x9')](),controller['index']);router[_0x2254('0x8')](_0x2254('0xa'),auth[_0x2254('0x9')](),controller[_0x2254('0xb')]);router[_0x2254('0xc')]('/',auth[_0x2254('0x9')](),controller[_0x2254('0xd')]);router[_0x2254('0xe')](_0x2254('0xa'),auth[_0x2254('0x9')](),controller[_0x2254('0xf')]);router['delete'](_0x2254('0xa'),auth[_0x2254('0x9')](),controller[_0x2254('0x10')]);module[_0x2254('0x11')]=router; \ No newline at end of file +var _0xc4aa=['connect-timeout','express','Router','./voiceTransferReport.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','multer','util','path'];(function(_0x1829c6,_0x4d98fd){var _0x19a7a0=function(_0x1292d5){while(--_0x1292d5){_0x1829c6['push'](_0x1829c6['shift']());}};_0x19a7a0(++_0x4d98fd);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xc4aa[_0x4b369d];return _0x571a98;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xac4a('0x6'));router[_0xac4a('0x7')]('/',auth[_0xac4a('0x8')](),controller[_0xac4a('0x9')]);router[_0xac4a('0x7')](_0xac4a('0xa'),auth[_0xac4a('0x8')](),controller[_0xac4a('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xac4a('0xc')]);router[_0xac4a('0xd')](_0xac4a('0xa'),auth['isAuthenticated'](),controller[_0xac4a('0xe')]);router[_0xac4a('0xf')](_0xac4a('0xa'),auth['isAuthenticated'](),controller[_0xac4a('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 3c3c2b6..9cff1dc 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 _0x524c=['moment','ENUM','attended','STRING','Yes'];(function(_0x516c00,_0x19f727){var _0x13ef00=function(_0x59d9bb){while(--_0x59d9bb){_0x516c00['push'](_0x516c00['shift']());}};_0x13ef00(++_0x19f727);}(_0x524c,0x6e));var _0xc524=function(_0xf374f3,_0x1d386a){_0xf374f3=_0xf374f3-0x0;var _0x3ed0cf=_0x524c[_0xf374f3];return _0x3ed0cf;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc524('0x0'));module['exports']={'type':{'type':Sequelize[_0xc524('0x1')]('blind',_0xc524('0x2'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xc524('0x3')]},'transferercalleridnum':{'type':Sequelize[_0xc524('0x3')]},'transferercalleridname':{'type':Sequelize[_0xc524('0x3')]},'transfererconnectedlinenum':{'type':Sequelize[_0xc524('0x3')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0xc524('0x3')]},'transfererexten':{'type':Sequelize[_0xc524('0x3')]},'transfererlinkedid':{'type':Sequelize[_0xc524('0x3')]},'transfereechannel':{'type':Sequelize[_0xc524('0x3')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0xc524('0x3')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0xc524('0x3')]},'transfereecontext':{'type':Sequelize[_0xc524('0x3')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0xc524('0x3')]},'isexternal':{'type':Sequelize[_0xc524('0x1')](_0xc524('0x4'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xc524('0x3')]}}; \ No newline at end of file +var _0x42c3=['ENUM','blind','attended','STRING','Yes','sequelize','exports'];(function(_0x3e6141,_0x4e159d){var _0x3d207=function(_0x2dee64){while(--_0x2dee64){_0x3e6141['push'](_0x3e6141['shift']());}};_0x3d207(++_0x4e159d);}(_0x42c3,0x15c));var _0x342c=function(_0x5e983a,_0x28011b){_0x5e983a=_0x5e983a-0x0;var _0x65c2fa=_0x42c3[_0x5e983a];return _0x65c2fa;};'use strict';var Sequelize=require(_0x342c('0x0'));var moment=require('moment');module[_0x342c('0x1')]={'type':{'type':Sequelize[_0x342c('0x2')](_0x342c('0x3'),_0x342c('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x342c('0x5')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x342c('0x5')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x342c('0x5')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x342c('0x5')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x342c('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x342c('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x342c('0x5')]},'transfereeexten':{'type':Sequelize[_0x342c('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x342c('0x5')]},'isexternal':{'type':Sequelize[_0x342c('0x2')](_0x342c('0x6'),'No')},'context':{'type':Sequelize[_0x342c('0x5')]},'extension':{'type':Sequelize[_0x342c('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 002149e..566bfc9 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 _0x39e2=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','params','find','catch','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','VoiceTransferReport','rawAttributes','type','key','model','query','keys','intersection'];(function(_0x5a5f06,_0x18fb01){var _0x3e43ae=function(_0x4b73f7){while(--_0x4b73f7){_0x5a5f06['push'](_0x5a5f06['shift']());}};_0x3e43ae(++_0x18fb01);}(_0x39e2,0x1ae));var _0x239e=function(_0x300191,_0x48ea3b){_0x300191=_0x300191-0x0;var _0x2e9066=_0x39e2[_0x300191];return _0x2e9066;};'use strict';var pdf=require(_0x239e('0x0'));var emlformat=require(_0x239e('0x1'));var rimraf=require(_0x239e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x239e('0x3'));var rp=require(_0x239e('0x4'));var moment=require(_0x239e('0x5'));var BPromise=require(_0x239e('0x6'));var Mustache=require(_0x239e('0x7'));var util=require(_0x239e('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x239e('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x239e('0xa'));var crypto=require(_0x239e('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x239e('0x9'));var querystring=require(_0x239e('0xc'));var Papa=require('papaparse');var Redis=require(_0x239e('0xd'));var authService=require(_0x239e('0xe'));var qs=require(_0x239e('0xf'));var as=require(_0x239e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x239e('0x11'));var config=require(_0x239e('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x487a45,_0x4c9548){_0x4c9548=_0x4c9548||0xcc;return function(_0x4bce5f){if(_0x4bce5f){return _0x487a45[_0x239e('0x13')](_0x4c9548);}return _0x487a45[_0x239e('0x14')](_0x4c9548)[_0x239e('0x15')]();};}function respondWithResult(_0x4edac2,_0x4717c2){_0x4717c2=_0x4717c2||0xc8;return function(_0x59b35b){if(_0x59b35b){return _0x4edac2[_0x239e('0x14')](_0x4717c2)[_0x239e('0x16')](_0x59b35b);}};}function respondWithFilteredResult(_0x53ec8b,_0x56b1f8){return function(_0x27552b){if(_0x27552b){var _0x1573e0=_0x27552b[_0x239e('0x17')],_0x397010=_0x56b1f8[_0x239e('0x18')],_0x4a5374=_0x56b1f8[_0x239e('0x18')]+_0x56b1f8[_0x239e('0x19')],_0x22be86;if(_0x4a5374>=_0x1573e0){_0x4a5374=_0x1573e0;_0x22be86=0xc8;}else{_0x22be86=0xce;}_0x53ec8b['status'](_0x22be86);return _0x53ec8b['set'](_0x239e('0x1a'),_0x397010+'-'+_0x4a5374+'/'+_0x1573e0)[_0x239e('0x16')](_0x27552b);}return null;};}function patchUpdates(_0x205795){return function(_0x34a32b){try{jsonpatch[_0x239e('0x1b')](_0x34a32b,_0x205795,!![]);}catch(_0x1b6d9f){return BPromise[_0x239e('0x1c')](_0x1b6d9f);}return _0x34a32b[_0x239e('0x1d')]();};}function saveUpdates(_0x279aab,_0x5f1427){return function(_0x4a4393){if(_0x4a4393){return _0x4a4393[_0x239e('0x1e')](_0x279aab)[_0x239e('0x1f')](function(_0x451a28){return _0x451a28;});}return null;};}function removeEntity(_0xd2aad0,_0x54414c){return function(_0x1d6f62){if(_0x1d6f62){return _0x1d6f62[_0x239e('0x20')]()[_0x239e('0x1f')](function(){_0xd2aad0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c8e94,_0x5b38d7){return function(_0xe552aa){if(!_0xe552aa){_0x2c8e94['sendStatus'](0x194);}return _0xe552aa;};}function handleError(_0x429926,_0x96c540){_0x96c540=_0x96c540||0x1f4;return function(_0xf8589b){logger[_0x239e('0x21')](_0xf8589b[_0x239e('0x22')]);if(_0xf8589b[_0x239e('0x23')]){delete _0xf8589b['name'];}_0x429926[_0x239e('0x14')](_0x96c540)[_0x239e('0x24')](_0xf8589b);};}exports['index']=function(_0x5f3eef,_0x158c46){var _0x12f649={},_0x918d1f={},_0x3fb770={'count':0x0,'rows':[]};var _0xcc4789=_[_0x239e('0x25')](db[_0x239e('0x26')][_0x239e('0x27')],function(_0x231416){return{'name':_0x231416['fieldName'],'type':_0x231416[_0x239e('0x28')][_0x239e('0x29')]};});_0x918d1f[_0x239e('0x2a')]=_[_0x239e('0x25')](_0xcc4789,_0x239e('0x23'));_0x918d1f[_0x239e('0x2b')]=_[_0x239e('0x2c')](_0x5f3eef[_0x239e('0x2b')]);_0x918d1f['filters']=_[_0x239e('0x2d')](_0x918d1f['model'],_0x918d1f[_0x239e('0x2b')]);_0x12f649[_0x239e('0x2e')]=_[_0x239e('0x2d')](_0x918d1f[_0x239e('0x2a')],qs[_0x239e('0x2f')](_0x5f3eef[_0x239e('0x2b')]['fields']));_0x12f649[_0x239e('0x2e')]=_0x12f649[_0x239e('0x2e')][_0x239e('0x30')]?_0x12f649[_0x239e('0x2e')]:_0x918d1f[_0x239e('0x2a')];if(!_0x5f3eef[_0x239e('0x2b')][_0x239e('0x31')](_0x239e('0x32'))){_0x12f649[_0x239e('0x19')]=qs[_0x239e('0x19')](_0x5f3eef[_0x239e('0x2b')]['limit']);_0x12f649[_0x239e('0x18')]=qs[_0x239e('0x18')](_0x5f3eef[_0x239e('0x2b')][_0x239e('0x18')]);}_0x12f649[_0x239e('0x33')]=qs['sort'](_0x5f3eef[_0x239e('0x2b')][_0x239e('0x34')]);_0x12f649[_0x239e('0x35')]=qs[_0x239e('0x36')](_[_0x239e('0x37')](_0x5f3eef[_0x239e('0x2b')],_0x918d1f[_0x239e('0x36')]),_0xcc4789);if(_0x5f3eef['query'][_0x239e('0x38')]){_0x12f649[_0x239e('0x35')]=_['merge'](_0x12f649[_0x239e('0x35')],{'$or':_[_0x239e('0x25')](_0xcc4789,function(_0x10e1c2){if(_0x10e1c2[_0x239e('0x28')]!==_0x239e('0x39')){var _0x14f91={};_0x14f91[_0x10e1c2[_0x239e('0x23')]]={'$like':'%'+_0x5f3eef['query'][_0x239e('0x38')]+'%'};return _0x14f91;}})});}_0x12f649=_[_0x239e('0x3a')]({},_0x12f649,_0x5f3eef[_0x239e('0x3b')]);var _0xd7d090={'where':_0x12f649[_0x239e('0x35')]};return db[_0x239e('0x26')][_0x239e('0x17')](_0xd7d090)[_0x239e('0x1f')](function(_0x7531ec){_0x3fb770[_0x239e('0x17')]=_0x7531ec;if(_0x5f3eef[_0x239e('0x2b')][_0x239e('0x3c')]){_0x12f649[_0x239e('0x3d')]=[{'all':!![]}];}return db[_0x239e('0x26')][_0x239e('0x3e')](_0x12f649);})['then'](function(_0x3dd8b3){_0x3fb770['rows']=_0x3dd8b3;return _0x3fb770;})[_0x239e('0x1f')](respondWithFilteredResult(_0x158c46,_0x12f649))['catch'](handleError(_0x158c46,null));};exports['show']=function(_0x2d8455,_0x45718d){var _0xd4675d={'raw':!![],'where':{'id':_0x2d8455[_0x239e('0x3f')]['id']}},_0x55ac54={};_0x55ac54[_0x239e('0x2a')]=_[_0x239e('0x2c')](db[_0x239e('0x26')]['rawAttributes']);_0x55ac54['query']=_[_0x239e('0x2c')](_0x2d8455['query']);_0x55ac54[_0x239e('0x36')]=_[_0x239e('0x2d')](_0x55ac54[_0x239e('0x2a')],_0x55ac54[_0x239e('0x2b')]);_0xd4675d['attributes']=_[_0x239e('0x2d')](_0x55ac54[_0x239e('0x2a')],qs[_0x239e('0x2f')](_0x2d8455[_0x239e('0x2b')][_0x239e('0x2f')]));_0xd4675d[_0x239e('0x2e')]=_0xd4675d[_0x239e('0x2e')]['length']?_0xd4675d['attributes']:_0x55ac54[_0x239e('0x2a')];if(_0x2d8455['query']['includeAll']){_0xd4675d[_0x239e('0x3d')]=[{'all':!![]}];}_0xd4675d=_[_0x239e('0x3a')]({},_0xd4675d,_0x2d8455[_0x239e('0x3b')]);return db[_0x239e('0x26')][_0x239e('0x40')](_0xd4675d)[_0x239e('0x1f')](handleEntityNotFound(_0x45718d,null))[_0x239e('0x1f')](respondWithResult(_0x45718d,null))[_0x239e('0x41')](handleError(_0x45718d,null));};exports[_0x239e('0x42')]=function(_0x24b561,_0x14b02f){return db[_0x239e('0x26')][_0x239e('0x42')](_0x24b561[_0x239e('0x43')],{})['then'](respondWithResult(_0x14b02f,0xc9))[_0x239e('0x41')](handleError(_0x14b02f,null));};exports[_0x239e('0x1e')]=function(_0x33a57f,_0x567762){if(_0x33a57f[_0x239e('0x43')]['id']){delete _0x33a57f[_0x239e('0x43')]['id'];}return db[_0x239e('0x26')]['find']({'where':{'id':_0x33a57f[_0x239e('0x3f')]['id']}})[_0x239e('0x1f')](handleEntityNotFound(_0x567762,null))[_0x239e('0x1f')](saveUpdates(_0x33a57f['body'],null))[_0x239e('0x1f')](respondWithResult(_0x567762,null))[_0x239e('0x41')](handleError(_0x567762,null));};exports['destroy']=function(_0x52d6c9,_0x5cc9d0){return db[_0x239e('0x26')][_0x239e('0x40')]({'where':{'id':_0x52d6c9['params']['id']}})[_0x239e('0x1f')](handleEntityNotFound(_0x5cc9d0,null))[_0x239e('0x1f')](removeEntity(_0x5cc9d0,null))[_0x239e('0x41')](handleError(_0x5cc9d0,null));}; \ No newline at end of file +var _0x8b35=['reject','then','destroy','error','name','send','index','VoiceTransferReport','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','rows','catch','params','include','find','create','body','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','json','apply'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8b35,0xfc));var _0x58b3=function(_0x505388,_0x255982){_0x505388=_0x505388-0x0;var _0x2e7a86=_0x8b35[_0x505388];return _0x2e7a86;};'use strict';var pdf=require(_0x58b3('0x0'));var emlformat=require(_0x58b3('0x1'));var rimraf=require(_0x58b3('0x2'));var zipdir=require(_0x58b3('0x3'));var jsonpatch=require(_0x58b3('0x4'));var rp=require('request-promise');var moment=require(_0x58b3('0x5'));var BPromise=require(_0x58b3('0x6'));var Mustache=require(_0x58b3('0x7'));var util=require(_0x58b3('0x8'));var path=require(_0x58b3('0x9'));var sox=require(_0x58b3('0xa'));var csv=require(_0x58b3('0xb'));var ejs=require(_0x58b3('0xc'));var fs=require('fs');var _=require(_0x58b3('0xd'));var squel=require(_0x58b3('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x58b3('0xb'));var querystring=require(_0x58b3('0xf'));var Papa=require(_0x58b3('0x10'));var Redis=require(_0x58b3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x58b3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x58b3('0x13'))('api');var utils=require(_0x58b3('0x14'));var config=require(_0x58b3('0x15'));var db=require(_0x58b3('0x16'))['db'];function respondWithStatusCode(_0x1c1f2a,_0x2fc1b3){_0x2fc1b3=_0x2fc1b3||0xcc;return function(_0xab8d41){if(_0xab8d41){return _0x1c1f2a[_0x58b3('0x17')](_0x2fc1b3);}return _0x1c1f2a[_0x58b3('0x18')](_0x2fc1b3)[_0x58b3('0x19')]();};}function respondWithResult(_0x1bfe74,_0x453d9f){_0x453d9f=_0x453d9f||0xc8;return function(_0x273fc8){if(_0x273fc8){return _0x1bfe74[_0x58b3('0x18')](_0x453d9f)['json'](_0x273fc8);}};}function respondWithFilteredResult(_0x78c845,_0x1d945f){return function(_0xf948de){if(_0xf948de){var _0x5d4bf9=_0xf948de['count'],_0x4aa8f6=_0x1d945f[_0x58b3('0x1a')],_0x9b7881=_0x1d945f[_0x58b3('0x1a')]+_0x1d945f[_0x58b3('0x1b')],_0x33d9bb;if(_0x9b7881>=_0x5d4bf9){_0x9b7881=_0x5d4bf9;_0x33d9bb=0xc8;}else{_0x33d9bb=0xce;}_0x78c845[_0x58b3('0x18')](_0x33d9bb);return _0x78c845[_0x58b3('0x1c')](_0x58b3('0x1d'),_0x4aa8f6+'-'+_0x9b7881+'/'+_0x5d4bf9)[_0x58b3('0x1e')](_0xf948de);}return null;};}function patchUpdates(_0x5b7a07){return function(_0x2ee1e1){try{jsonpatch[_0x58b3('0x1f')](_0x2ee1e1,_0x5b7a07,!![]);}catch(_0x22c2a5){return BPromise[_0x58b3('0x20')](_0x22c2a5);}return _0x2ee1e1['save']();};}function saveUpdates(_0x392b61,_0xc47f3f){return function(_0x57d4f8){if(_0x57d4f8){return _0x57d4f8['update'](_0x392b61)[_0x58b3('0x21')](function(_0x46ae26){return _0x46ae26;});}return null;};}function removeEntity(_0x97b25d,_0x8fb350){return function(_0x2cea0e){if(_0x2cea0e){return _0x2cea0e[_0x58b3('0x22')]()[_0x58b3('0x21')](function(){_0x97b25d['status'](0xcc)[_0x58b3('0x19')]();});}};}function handleEntityNotFound(_0x25e180,_0x38f3b6){return function(_0x4d1c08){if(!_0x4d1c08){_0x25e180['sendStatus'](0x194);}return _0x4d1c08;};}function handleError(_0x7f94be,_0x2518d0){_0x2518d0=_0x2518d0||0x1f4;return function(_0x20bed6){logger[_0x58b3('0x23')](_0x20bed6['stack']);if(_0x20bed6[_0x58b3('0x24')]){delete _0x20bed6[_0x58b3('0x24')];}_0x7f94be[_0x58b3('0x18')](_0x2518d0)[_0x58b3('0x25')](_0x20bed6);};}exports[_0x58b3('0x26')]=function(_0x57478d,_0x374335){var _0x1adb2e={},_0x4a0005={},_0x3376ef={'count':0x0,'rows':[]};var _0x501b6a=_['map'](db[_0x58b3('0x27')][_0x58b3('0x28')],function(_0x24e075){return{'name':_0x24e075[_0x58b3('0x29')],'type':_0x24e075[_0x58b3('0x2a')][_0x58b3('0x2b')]};});_0x4a0005['model']=_[_0x58b3('0x2c')](_0x501b6a,_0x58b3('0x24'));_0x4a0005[_0x58b3('0x2d')]=_['keys'](_0x57478d['query']);_0x4a0005[_0x58b3('0x2e')]=_[_0x58b3('0x2f')](_0x4a0005['model'],_0x4a0005[_0x58b3('0x2d')]);_0x1adb2e['attributes']=_[_0x58b3('0x2f')](_0x4a0005[_0x58b3('0x30')],qs[_0x58b3('0x31')](_0x57478d[_0x58b3('0x2d')][_0x58b3('0x31')]));_0x1adb2e[_0x58b3('0x32')]=_0x1adb2e[_0x58b3('0x32')][_0x58b3('0x33')]?_0x1adb2e[_0x58b3('0x32')]:_0x4a0005[_0x58b3('0x30')];if(!_0x57478d[_0x58b3('0x2d')][_0x58b3('0x34')](_0x58b3('0x35'))){_0x1adb2e['limit']=qs[_0x58b3('0x1b')](_0x57478d[_0x58b3('0x2d')][_0x58b3('0x1b')]);_0x1adb2e['offset']=qs['offset'](_0x57478d[_0x58b3('0x2d')][_0x58b3('0x1a')]);}_0x1adb2e[_0x58b3('0x36')]=qs['sort'](_0x57478d[_0x58b3('0x2d')][_0x58b3('0x37')]);_0x1adb2e[_0x58b3('0x38')]=qs[_0x58b3('0x2e')](_[_0x58b3('0x39')](_0x57478d[_0x58b3('0x2d')],_0x4a0005[_0x58b3('0x2e')]),_0x501b6a);if(_0x57478d[_0x58b3('0x2d')][_0x58b3('0x3a')]){_0x1adb2e[_0x58b3('0x38')]=_[_0x58b3('0x3b')](_0x1adb2e['where'],{'$or':_['map'](_0x501b6a,function(_0x73e5ee){if(_0x73e5ee['type']!=='VIRTUAL'){var _0x30104d={};_0x30104d[_0x73e5ee[_0x58b3('0x24')]]={'$like':'%'+_0x57478d['query'][_0x58b3('0x3a')]+'%'};return _0x30104d;}})});}_0x1adb2e=_[_0x58b3('0x3b')]({},_0x1adb2e,_0x57478d[_0x58b3('0x3c')]);var _0x39ad01={'where':_0x1adb2e[_0x58b3('0x38')]};return db[_0x58b3('0x27')][_0x58b3('0x3d')](_0x39ad01)[_0x58b3('0x21')](function(_0xfb3f44){_0x3376ef[_0x58b3('0x3d')]=_0xfb3f44;if(_0x57478d[_0x58b3('0x2d')][_0x58b3('0x3e')]){_0x1adb2e['include']=[{'all':!![]}];}return db[_0x58b3('0x27')]['findAll'](_0x1adb2e);})[_0x58b3('0x21')](function(_0x2bd5b3){_0x3376ef[_0x58b3('0x3f')]=_0x2bd5b3;return _0x3376ef;})[_0x58b3('0x21')](respondWithFilteredResult(_0x374335,_0x1adb2e))[_0x58b3('0x40')](handleError(_0x374335,null));};exports['show']=function(_0x780b2f,_0x27d789){var _0x497ad6={'raw':!![],'where':{'id':_0x780b2f[_0x58b3('0x41')]['id']}},_0x4d3c3d={};_0x4d3c3d[_0x58b3('0x30')]=_['keys'](db['VoiceTransferReport'][_0x58b3('0x28')]);_0x4d3c3d[_0x58b3('0x2d')]=_['keys'](_0x780b2f[_0x58b3('0x2d')]);_0x4d3c3d['filters']=_['intersection'](_0x4d3c3d[_0x58b3('0x30')],_0x4d3c3d[_0x58b3('0x2d')]);_0x497ad6['attributes']=_[_0x58b3('0x2f')](_0x4d3c3d[_0x58b3('0x30')],qs[_0x58b3('0x31')](_0x780b2f[_0x58b3('0x2d')][_0x58b3('0x31')]));_0x497ad6[_0x58b3('0x32')]=_0x497ad6['attributes']['length']?_0x497ad6[_0x58b3('0x32')]:_0x4d3c3d['model'];if(_0x780b2f[_0x58b3('0x2d')][_0x58b3('0x3e')]){_0x497ad6[_0x58b3('0x42')]=[{'all':!![]}];}_0x497ad6=_[_0x58b3('0x3b')]({},_0x497ad6,_0x780b2f[_0x58b3('0x3c')]);return db[_0x58b3('0x27')][_0x58b3('0x43')](_0x497ad6)[_0x58b3('0x21')](handleEntityNotFound(_0x27d789,null))['then'](respondWithResult(_0x27d789,null))[_0x58b3('0x40')](handleError(_0x27d789,null));};exports[_0x58b3('0x44')]=function(_0xe0adde,_0x862249){return db[_0x58b3('0x27')][_0x58b3('0x44')](_0xe0adde[_0x58b3('0x45')],{})[_0x58b3('0x21')](respondWithResult(_0x862249,0xc9))['catch'](handleError(_0x862249,null));};exports[_0x58b3('0x46')]=function(_0xa89b91,_0x3f691b){if(_0xa89b91[_0x58b3('0x45')]['id']){delete _0xa89b91[_0x58b3('0x45')]['id'];}return db[_0x58b3('0x27')][_0x58b3('0x43')]({'where':{'id':_0xa89b91[_0x58b3('0x41')]['id']}})['then'](handleEntityNotFound(_0x3f691b,null))[_0x58b3('0x21')](saveUpdates(_0xa89b91['body'],null))[_0x58b3('0x21')](respondWithResult(_0x3f691b,null))[_0x58b3('0x40')](handleError(_0x3f691b,null));};exports[_0x58b3('0x22')]=function(_0x35ad35,_0x1948cc){return db[_0x58b3('0x27')]['find']({'where':{'id':_0x35ad35[_0x58b3('0x41')]['id']}})['then'](handleEntityNotFound(_0x1948cc,null))['then'](removeEntity(_0x1948cc,null))['catch'](handleError(_0x1948cc,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 31f07b6..8edd95a 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 _0x2470=['rimraf','../../config/environment','./voiceTransferReport.attributes','define','VoiceTransferReport','report_call_transfer','lodash','util','api','moment','path'];(function(_0x28f3d8,_0x39a459){var _0x5b11d3=function(_0x4f894e){while(--_0x4f894e){_0x28f3d8['push'](_0x28f3d8['shift']());}};_0x5b11d3(++_0x39a459);}(_0x2470,0xb6));var _0x0247=function(_0x2e49fb,_0x2e7ff9){_0x2e49fb=_0x2e49fb-0x0;var _0x31bef1=_0x2470[_0x2e49fb];return _0x31bef1;};'use strict';var _=require(_0x0247('0x0'));var util=require(_0x0247('0x1'));var logger=require('../../config/logger')(_0x0247('0x2'));var moment=require(_0x0247('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0247('0x4'));var rimraf=require(_0x0247('0x5'));var config=require(_0x0247('0x6'));var attributes=require(_0x0247('0x7'));module['exports']=function(_0x4adc99,_0x41ed22){return _0x4adc99[_0x0247('0x8')](_0x0247('0x9'),attributes,{'tableName':_0x0247('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf3f=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','report_call_transfer'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xaf3f,0x11e));var _0xfaf3=function(_0x3e1294,_0x11392e){_0x3e1294=_0x3e1294-0x0;var _0x1b755c=_0xaf3f[_0x3e1294];return _0x1b755c;};'use strict';var _=require(_0xfaf3('0x0'));var util=require(_0xfaf3('0x1'));var logger=require(_0xfaf3('0x2'))(_0xfaf3('0x3'));var moment=require(_0xfaf3('0x4'));var BPromise=require(_0xfaf3('0x5'));var rp=require(_0xfaf3('0x6'));var fs=require('fs');var path=require(_0xfaf3('0x7'));var rimraf=require(_0xfaf3('0x8'));var config=require(_0xfaf3('0x9'));var attributes=require(_0xfaf3('0xa'));module[_0xfaf3('0xb')]=function(_0x511213,_0x313b49){return _0x511213['define']('VoiceTransferReport',attributes,{'tableName':_0xfaf3('0xc'),'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 b8baa9a..118727a 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 _0x9290=['stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw'];(function(_0x59e10c,_0x35c367){var _0x7ddcd7=function(_0x215bd0){while(--_0x215bd0){_0x59e10c['push'](_0x59e10c['shift']());}};_0x7ddcd7(++_0x35c367);}(_0x9290,0xe1));var _0x0929=function(_0x1306f3,_0x1da761){_0x1306f3=_0x1306f3-0x0;var _0xc1c7bf=_0x9290[_0x1306f3];return _0xc1c7bf;};'use strict';var _=require('lodash');var util=require(_0x0929('0x0'));var moment=require(_0x0929('0x1'));var BPromise=require(_0x0929('0x2'));var rs=require(_0x0929('0x3'));var fs=require('fs');var Redis=require(_0x0929('0x4'));var db=require(_0x0929('0x5'))['db'];var utils=require(_0x0929('0x6'));var logger=require(_0x0929('0x7'))(_0x0929('0x8'));var config=require(_0x0929('0x9'));var jayson=require(_0x0929('0xa'));var client=jayson[_0x0929('0xb')][_0x0929('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xd0a695,_0x1cb430,_0x212d69){return new BPromise(function(_0x529911,_0x3feaee){return client[_0x0929('0xd')](_0xd0a695,_0x212d69)[_0x0929('0xe')](function(_0x56d585){logger[_0x0929('0xf')](_0x0929('0x10'),_0x1cb430,_0x0929('0x11'));logger[_0x0929('0x12')](_0x0929('0x13'),_0x1cb430,_0x0929('0x11'),JSON['stringify'](_0x56d585));if(_0x56d585[_0x0929('0x14')]){if(_0x56d585['error'][_0x0929('0x15')]===0x1f4){logger[_0x0929('0x14')](_0x0929('0x10'),_0x1cb430,_0x56d585[_0x0929('0x14')]['message']);return _0x3feaee(_0x56d585[_0x0929('0x14')][_0x0929('0x16')]);}logger[_0x0929('0x14')](_0x0929('0x10'),_0x1cb430,_0x56d585[_0x0929('0x14')][_0x0929('0x16')]);return _0x529911(_0x56d585['error'][_0x0929('0x16')]);}else{logger[_0x0929('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0x1cb430,_0x0929('0x11'));_0x529911(_0x56d585[_0x0929('0x17')]['message']);}})[_0x0929('0x18')](function(_0x157b9d){logger[_0x0929('0x14')](_0x0929('0x10'),_0x1cb430,_0x157b9d);_0x3feaee(_0x157b9d);});});}exports[_0x0929('0x19')]=function(_0x26b244){var _0x3640aa=this;return new Promise(function(_0x19b028,_0x1068ec){return db[_0x0929('0x1a')][_0x0929('0x1b')](_0x26b244[_0x0929('0x1c')],{'raw':_0x26b244[_0x0929('0x1d')]?_0x26b244[_0x0929('0x1d')][_0x0929('0x1e')]===undefined?!![]:![]:!![]})[_0x0929('0xe')](function(_0x243022){logger[_0x0929('0xf')](_0x0929('0x19'),_0x26b244);logger['debug'](_0x0929('0x19'),_0x26b244,JSON[_0x0929('0x1f')](_0x243022));_0x19b028(_0x243022);})[_0x0929('0x18')](function(_0x13ae79){logger['error']('CreateVoiceTransferReport',_0x13ae79['message'],_0x26b244);_0x1068ec(_0x3640aa[_0x0929('0x14')](0x1f4,_0x13ae79[_0x0929('0x16')]));});});}; \ No newline at end of file +var _0xf9bd=['debug','stringify','error','message','catch','CreateVoiceTransferReport','VoiceTransferReport','body','options','raw','then','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','VoiceTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x4ab8e2,_0x23cb36){var _0x1e611d=function(_0x31984f){while(--_0x31984f){_0x4ab8e2['push'](_0x4ab8e2['shift']());}};_0x1e611d(++_0x23cb36);}(_0xf9bd,0x11f));var _0xdf9b=function(_0x5cae89,_0x169984){_0x5cae89=_0x5cae89-0x0;var _0x4cfe4c=_0xf9bd[_0x5cae89];return _0x4cfe4c;};'use strict';var _=require(_0xdf9b('0x0'));var util=require(_0xdf9b('0x1'));var moment=require('moment');var BPromise=require(_0xdf9b('0x2'));var rs=require(_0xdf9b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf9b('0x4'))['db'];var utils=require(_0xdf9b('0x5'));var logger=require(_0xdf9b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xdf9b('0x7'));var client=jayson[_0xdf9b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5065ac,_0x1aee3d,_0x5acca6){return new BPromise(function(_0x1cbf21,_0x1b7a61){return client[_0xdf9b('0x9')](_0x5065ac,_0x5acca6)['then'](function(_0x11e6bf){logger['info'](_0xdf9b('0xa'),_0x1aee3d,_0xdf9b('0xb'));logger[_0xdf9b('0xc')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x1aee3d,'request\x20sent',JSON[_0xdf9b('0xd')](_0x11e6bf));if(_0x11e6bf['error']){if(_0x11e6bf[_0xdf9b('0xe')]['code']===0x1f4){logger[_0xdf9b('0xe')](_0xdf9b('0xa'),_0x1aee3d,_0x11e6bf[_0xdf9b('0xe')][_0xdf9b('0xf')]);return _0x1b7a61(_0x11e6bf['error'][_0xdf9b('0xf')]);}logger[_0xdf9b('0xe')](_0xdf9b('0xa'),_0x1aee3d,_0x11e6bf[_0xdf9b('0xe')][_0xdf9b('0xf')]);return _0x1cbf21(_0x11e6bf['error'][_0xdf9b('0xf')]);}else{logger['info'](_0xdf9b('0xa'),_0x1aee3d,'request\x20sent');_0x1cbf21(_0x11e6bf['result']['message']);}})[_0xdf9b('0x10')](function(_0x4e7b88){logger[_0xdf9b('0xe')](_0xdf9b('0xa'),_0x1aee3d,_0x4e7b88);_0x1b7a61(_0x4e7b88);});});}exports[_0xdf9b('0x11')]=function(_0x4326ba){var _0x24d5cd=this;return new Promise(function(_0x4919ff,_0x1c661d){return db[_0xdf9b('0x12')]['create'](_0x4326ba[_0xdf9b('0x13')],{'raw':_0x4326ba[_0xdf9b('0x14')]?_0x4326ba[_0xdf9b('0x14')][_0xdf9b('0x15')]===undefined?!![]:![]:!![]})[_0xdf9b('0x16')](function(_0x25443d){logger['info']('CreateVoiceTransferReport',_0x4326ba);logger[_0xdf9b('0xc')](_0xdf9b('0x11'),_0x4326ba,JSON['stringify'](_0x25443d));_0x4919ff(_0x25443d);})['catch'](function(_0x4401dd){logger[_0xdf9b('0xe')]('CreateVoiceTransferReport',_0x4401dd[_0xdf9b('0xf')],_0x4326ba);_0x1c661d(_0x24d5cd[_0xdf9b('0xe')](0x1f4,_0x4401dd[_0xdf9b('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index a4a5666..f608f5b 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 _0x6ff1=['express','Router','../../components/auth/service','./webbar.controller','isAuthenticated','originate','post','/hangup','canUpdate','answer','/hold','hold','/unhold','unhold','/calls','calls','/transfer','transfer','exports'];(function(_0xaf4af7,_0x6a8b6f){var _0x596009=function(_0x563e6f){while(--_0x563e6f){_0xaf4af7['push'](_0xaf4af7['shift']());}};_0x596009(++_0x6a8b6f);}(_0x6ff1,0x10a));var _0x16ff=function(_0x1ba0da,_0x342203){_0x1ba0da=_0x1ba0da-0x0;var _0x2d10ad=_0x6ff1[_0x1ba0da];return _0x2d10ad;};'use strict';var express=require(_0x16ff('0x0'));var router=express[_0x16ff('0x1')]();var auth=require(_0x16ff('0x2'));var controller=require(_0x16ff('0x3'));router['post']('/originate',auth[_0x16ff('0x4')](),auth['canUpdate'](),controller[_0x16ff('0x5')]);router[_0x16ff('0x6')](_0x16ff('0x7'),auth[_0x16ff('0x4')](),auth['canUpdate'](),controller['hangup']);router['post']('/answer',auth[_0x16ff('0x4')](),auth[_0x16ff('0x8')](),controller[_0x16ff('0x9')]);router[_0x16ff('0x6')](_0x16ff('0xa'),auth[_0x16ff('0x4')](),auth[_0x16ff('0x8')](),controller[_0x16ff('0xb')]);router[_0x16ff('0x6')](_0x16ff('0xc'),auth[_0x16ff('0x4')](),auth[_0x16ff('0x8')](),controller[_0x16ff('0xd')]);router[_0x16ff('0x6')](_0x16ff('0xe'),auth[_0x16ff('0x4')](),auth[_0x16ff('0x8')](),controller[_0x16ff('0xf')]);router[_0x16ff('0x6')](_0x16ff('0x10'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x16ff('0x11')]);module[_0x16ff('0x12')]=router; \ No newline at end of file +var _0x04de=['./webbar.controller','post','/originate','isAuthenticated','canUpdate','originate','/hangup','/answer','answer','/hold','/unhold','unhold','/calls','/transfer','transfer','exports','express','Router','../../components/auth/service'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x04de,0x107));var _0xe04d=function(_0x34b212,_0x10400e){_0x34b212=_0x34b212-0x0;var _0xd2008a=_0x04de[_0x34b212];return _0xd2008a;};'use strict';var express=require(_0xe04d('0x0'));var router=express[_0xe04d('0x1')]();var auth=require(_0xe04d('0x2'));var controller=require(_0xe04d('0x3'));router[_0xe04d('0x4')](_0xe04d('0x5'),auth[_0xe04d('0x6')](),auth[_0xe04d('0x7')](),controller[_0xe04d('0x8')]);router[_0xe04d('0x4')](_0xe04d('0x9'),auth['isAuthenticated'](),auth['canUpdate'](),controller['hangup']);router['post'](_0xe04d('0xa'),auth[_0xe04d('0x6')](),auth[_0xe04d('0x7')](),controller[_0xe04d('0xb')]);router[_0xe04d('0x4')](_0xe04d('0xc'),auth[_0xe04d('0x6')](),auth[_0xe04d('0x7')](),controller['hold']);router[_0xe04d('0x4')](_0xe04d('0xd'),auth[_0xe04d('0x6')](),auth[_0xe04d('0x7')](),controller[_0xe04d('0xe')]);router[_0xe04d('0x4')](_0xe04d('0xf'),auth[_0xe04d('0x6')](),auth[_0xe04d('0x7')](),controller['calls']);router[_0xe04d('0x4')](_0xe04d('0x10'),auth[_0xe04d('0x6')](),auth[_0xe04d('0x7')](),controller[_0xe04d('0x11')]);module[_0xe04d('0x12')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 2b11b5a..6caf00a 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 _0x07b9=['hold','hold\x20fired:','hold\x20executed!','unhold','webbar:unhold','unhold\x20executed!','calls\x20fired:','filter','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','bluebird','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','string','callNumber\x20is\x20required','number','userId\x20is\x20required','transferNumber\x20is\x20required','info','emit','log','handleError:','error','stack','name','status','send','request','then','code','message','result','catch','User','agent','VoiceChannels','all','rows','UserId','length','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','format','webbar:originate','originate\x20executed!','hangup','sessionId','entityFound:','user:%s','webbar:hangup','answer','answer\x20fired:','webbar:answer'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0x07b9,0x143));var _0x907b=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0x07b9[_0x2f1762];return _0x8ab21;};'use strict';var path=require(_0x907b('0x0'));var fs=require('fs');var _=require(_0x907b('0x1'));var db=require(_0x907b('0x2'))['db'];var config=require(_0x907b('0x3'));var util=require('util');var BPromise=require(_0x907b('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0x907b('0x5')][_0x907b('0x6')]({'port':0x232a});var logger=require(_0x907b('0x7'))(_0x907b('0x8'));var Redis=require(_0x907b('0x9'));config[_0x907b('0xa')]=_[_0x907b('0xb')](config['redis'],{'host':_0x907b('0xc'),'port':0x18eb});var io=require(_0x907b('0xd'))(new Redis(config[_0x907b('0xa')]));var Schema=require(_0x907b('0xe'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x907b('0xf'),'required':[!![],_0x907b('0x10')]},'callerId':{'type':_0x907b('0xf')},'callbackUrl':{'type':_0x907b('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0x907b('0x11'),'required':[!![],_0x907b('0x12')]},'sessionId':{'type':_0x907b('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x907b('0x11'),'required':[!![],_0x907b('0x12')]},'sessionId':{'type':_0x907b('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x907b('0x12')]},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x907b('0xf'),'required':[!![],_0x907b('0x13')]}});var holdValidation=new Schema({'userId':{'type':_0x907b('0x11'),'required':[!![],_0x907b('0x12')]},'sessionId':{'type':_0x907b('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x907b('0x11'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x907b('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x907b('0x11'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x907b('0x12')]}});function emit(_0x17c314,_0xc9297a,_0x1e1f23){logger[_0x907b('0x14')](_0x17c314,_0xc9297a,JSON['stringify'](_0x1e1f23));io['to'](_0x17c314)[_0x907b('0x15')](_0xc9297a,_0x1e1f23);}function handleError(_0x160a6f){return function(_0x5d7cd3){console[_0x907b('0x16')](_0x907b('0x17'),_0x5d7cd3,_0x5d7cd3 instanceof RangeError);logger[_0x907b('0x18')](_0x5d7cd3[_0x907b('0x19')]);if(_0x5d7cd3 instanceof RangeError){if(_0x5d7cd3[_0x907b('0x1a')]){delete _0x5d7cd3[_0x907b('0x1a')];}_0x160a6f[_0x907b('0x1b')](0x194)[_0x907b('0x1c')](_0x5d7cd3);}else{if(_0x5d7cd3[_0x907b('0x1a')]){delete _0x5d7cd3[_0x907b('0x1a')];}_0x160a6f[_0x907b('0x1b')](0x1f4)[_0x907b('0x1c')](_0x5d7cd3);}};}function checkError(){return function(_0x3fe834){if(!_0x3fe834){throw new RangeError('NotFound');}return _0x3fe834;};}function respondWithRpcPromise(_0x2b1624,_0x103615){return new BPromise(function(_0x2daa51,_0x406e0b){var _0x450f3f=amiClient;return _0x450f3f[_0x907b('0x1d')](_0x2b1624,_0x103615)[_0x907b('0x1e')](function(_0x53beb1){if(_0x53beb1[_0x907b('0x18')]){if(_0x53beb1[_0x907b('0x18')][_0x907b('0x1f')]===0x1f4){return _0x406e0b(_0x53beb1[_0x907b('0x18')][_0x907b('0x20')]);}return _0x2daa51(_0x53beb1[_0x907b('0x18')][_0x907b('0x20')]);}else{_0x2daa51(_0x53beb1[_0x907b('0x21')]);}})[_0x907b('0x22')](function(_0xa28c16){_0x406e0b(_0xa28c16);});});}function getAgent(_0x594fd2){return db[_0x907b('0x23')]['findOne']({'where':{'id':_0x594fd2,'role':_0x907b('0x24')}})[_0x907b('0x1e')](checkError());}function getAgentCheckSession(_0x3bbab7,_0x5adecf){return new BPromise(function(_0x4acd74,_0x29a0f5){var _0x421463=respondWithRpcPromise(_0x907b('0x25'));var _0x8dcd13=getAgent(_0x3bbab7);Promise[_0x907b('0x26')]([_0x421463,_0x8dcd13])[_0x907b('0x1e')](function(_0x100f98){var _0x599099=_0x100f98[0x0];var _0x2b2b08=_0x100f98[0x1];var _0x270cfd=_['filter'](_0x599099[_0x907b('0x27')],function(_0x27d4be){return _0x27d4be[_0x907b('0x28')]==_0x2b2b08['id']&&_0x27d4be['sessionId']==_0x5adecf;});if(_0x270cfd[_0x907b('0x29')]==0x1){_0x4acd74(_0x2b2b08);}else{_0x29a0f5(new RangeError('sessionId\x20'+_0x5adecf+_0x907b('0x2a')));}});});}exports[_0x907b('0x2b')]=function(_0x474c74,_0x38a07d){logger[_0x907b('0x14')](_0x907b('0x2c'),_0x474c74[_0x907b('0x2d')]);var _0x3fd768=originateValidation[_0x907b('0xe')](_0x474c74[_0x907b('0x2d')]);if(_0x3fd768[_0x907b('0x29')]>0x0){return _0x38a07d['status'](0x190)[_0x907b('0x2e')](_0x3fd768);}var _0x481db0=_0x474c74['body'][_0x907b('0x2f')];var _0x5054d6=_0x474c74[_0x907b('0x2d')][_0x907b('0x30')];var _0x21bf85=_0x474c74[_0x907b('0x2d')][_0x907b('0x31')];var _0x2014ec=_0x474c74[_0x907b('0x2d')][_0x907b('0x32')];return getAgent(_0x481db0)[_0x907b('0x1e')](function(_0x16d58c){logger[_0x907b('0x14')]('entityFound:',_0x16d58c['name']);emit(util[_0x907b('0x33')]('user:%s',_0x16d58c['name']),_0x907b('0x34'),{'callNumber':_0x5054d6,'callerId':_0x21bf85,'callbackUrl':_0x2014ec});return _0x38a07d['status'](0xc8)[_0x907b('0x2e')]({'error':![],'message':_0x907b('0x35')});})[_0x907b('0x22')](handleError(_0x38a07d));};exports[_0x907b('0x36')]=function(_0x293a6d,_0x15f89d){logger['info']('hangup\x20fired:',_0x293a6d[_0x907b('0x2d')]);var _0x2e7975=hangupValidation[_0x907b('0xe')](_0x293a6d[_0x907b('0x2d')]);if(_0x2e7975[_0x907b('0x29')]>0x0){return _0x15f89d['status'](0x190)[_0x907b('0x2e')](_0x2e7975);}var _0x43638a=_0x293a6d['body'][_0x907b('0x2f')];var _0x648b6f=_0x293a6d[_0x907b('0x2d')][_0x907b('0x37')];return getAgent(_0x43638a)[_0x907b('0x1e')](function(_0x52f536){logger[_0x907b('0x14')](_0x907b('0x38'),_0x52f536[_0x907b('0x1a')]);emit(util[_0x907b('0x33')](_0x907b('0x39'),_0x52f536['name']),_0x907b('0x3a'),{'sessionId':_0x648b6f});return _0x15f89d[_0x907b('0x1b')](0xc8)[_0x907b('0x2e')]({'error':![],'message':'hangup\x20executed!'});})[_0x907b('0x22')](handleError(_0x15f89d));};exports[_0x907b('0x3b')]=function(_0x2424cb,_0x1af0d7){logger['info'](_0x907b('0x3c'),_0x2424cb[_0x907b('0x2d')]);var _0xa91941=answerValidation[_0x907b('0xe')](_0x2424cb[_0x907b('0x2d')]);if(_0xa91941[_0x907b('0x29')]>0x0){return _0x1af0d7[_0x907b('0x1b')](0x190)['json'](_0xa91941);}var _0x5b55d3=_0x2424cb['body']['userId'];var _0x4a792b=_0x2424cb[_0x907b('0x2d')][_0x907b('0x37')];return getAgent(_0x5b55d3)[_0x907b('0x1e')](function(_0x4b0362){logger['info'](_0x907b('0x38'),_0x4b0362['name']);emit(util['format']('user:%s',_0x4b0362[_0x907b('0x1a')]),_0x907b('0x3d'),{'sessionId':_0x4a792b});return _0x1af0d7[_0x907b('0x1b')](0xc8)[_0x907b('0x2e')]({'error':![],'message':'answer\x20executed!'});})['catch'](handleError(_0x1af0d7));};exports[_0x907b('0x3e')]=function(_0x4ef7c4,_0x49a35c){logger[_0x907b('0x14')](_0x907b('0x3f'),_0x4ef7c4[_0x907b('0x2d')]);var _0x32ab96=holdValidation[_0x907b('0xe')](_0x4ef7c4[_0x907b('0x2d')]);if(_0x32ab96[_0x907b('0x29')]>0x0){return _0x49a35c[_0x907b('0x1b')](0x190)[_0x907b('0x2e')](_0x32ab96);}var _0x38b5c5=_0x4ef7c4['body'][_0x907b('0x2f')];var _0x48e9c5=_0x4ef7c4[_0x907b('0x2d')]['sessionId'];return getAgent(_0x38b5c5)[_0x907b('0x1e')](function(_0x3bad4f){logger['info'](_0x907b('0x38'),_0x3bad4f[_0x907b('0x1a')]);emit(util['format'](_0x907b('0x39'),_0x3bad4f[_0x907b('0x1a')]),'webbar:hold',{'sessionId':_0x48e9c5});return _0x49a35c['status'](0xc8)[_0x907b('0x2e')]({'error':![],'message':_0x907b('0x40')});})[_0x907b('0x22')](handleError(_0x49a35c));};exports[_0x907b('0x41')]=function(_0x1c6203,_0x41fe10){logger['info']('unhold\x20fired:',_0x1c6203['body']);var _0x387972=unholdValidation['validate'](_0x1c6203[_0x907b('0x2d')]);if(_0x387972[_0x907b('0x29')]>0x0){return _0x41fe10[_0x907b('0x1b')](0x190)[_0x907b('0x2e')](_0x387972);}var _0x54bca3=_0x1c6203[_0x907b('0x2d')][_0x907b('0x2f')];var _0x2d4743=_0x1c6203[_0x907b('0x2d')][_0x907b('0x37')];return getAgent(_0x54bca3)[_0x907b('0x1e')](function(_0x4281c1){logger['info'](_0x907b('0x38'),_0x4281c1[_0x907b('0x1a')]);emit(util[_0x907b('0x33')](_0x907b('0x39'),_0x4281c1[_0x907b('0x1a')]),_0x907b('0x42'),{'sessionId':_0x2d4743});return _0x41fe10[_0x907b('0x1b')](0xc8)[_0x907b('0x2e')]({'error':![],'message':_0x907b('0x43')});})[_0x907b('0x22')](handleError(_0x41fe10));};exports['calls']=function(_0x268e63,_0x59483f){logger[_0x907b('0x14')](_0x907b('0x44'),_0x59483f[_0x907b('0x2d')]);var _0x4e0021=callsValidation[_0x907b('0xe')](_0x268e63[_0x907b('0x2d')]);if(_0x4e0021[_0x907b('0x29')]>0x0){return _0x59483f[_0x907b('0x1b')](0x190)[_0x907b('0x2e')](_0x4e0021);}var _0xf5d65d=_0x268e63['body'][_0x907b('0x2f')];var _0x1474de=respondWithRpcPromise('VoiceChannels');var _0x31f259=getAgent(_0xf5d65d);return Promise[_0x907b('0x26')]([_0x1474de,_0x31f259])[_0x907b('0x1e')](function(_0x53ba44){var _0x2f9870=_0x53ba44[0x0];var _0x20c275=_0x53ba44[0x1];var _0x2ceece=_[_0x907b('0x45')](_0x2f9870[_0x907b('0x27')],function(_0x10fbfa){return _0x10fbfa[_0x907b('0x28')]==_0x20c275['id'];});return _0x59483f[_0x907b('0x1b')](0xc8)[_0x907b('0x2e')]({'count':_0x2ceece['length'],'rows':_0x2ceece});})[_0x907b('0x22')](handleError(_0x59483f));};exports['conference']=function(_0x362716,_0x4a0711){logger['info'](_0x907b('0x46'),_0x362716[_0x907b('0x2d')]);var _0x582794=conferenceValidation[_0x907b('0xe')](_0x362716['body']);if(_0x582794[_0x907b('0x29')]>0x0){return _0x4a0711[_0x907b('0x1b')](0x190)['json'](_0x582794);}var _0xae67c8=_0x362716[_0x907b('0x2d')][_0x907b('0x2f')];return getAgent(_0xae67c8)['then'](function(_0x54dd7a){logger[_0x907b('0x14')](_0x907b('0x38'),_0x54dd7a[_0x907b('0x1a')]);emit(util['format'](_0x907b('0x39'),_0x54dd7a['name']),_0x907b('0x47'));return _0x4a0711[_0x907b('0x1b')](0xc8)['json']({'error':![],'message':_0x907b('0x48')});})['catch'](handleError(_0x4a0711));};exports[_0x907b('0x49')]=function(_0xb28b9b,_0x4f847b){logger['info'](_0x907b('0x4a'),_0xb28b9b['body']);var _0x442b9d=transferValidation[_0x907b('0xe')](_0xb28b9b[_0x907b('0x2d')]);if(_0x442b9d[_0x907b('0x29')]>0x0){return _0x4f847b[_0x907b('0x1b')](0x190)[_0x907b('0x2e')](_0x442b9d);}var _0x36bd29=_0xb28b9b[_0x907b('0x2d')]['userId'];var _0x2cc77d=_0xb28b9b[_0x907b('0x2d')]['sessionId'];var _0x4c0f80=_0xb28b9b[_0x907b('0x2d')][_0x907b('0x4b')];return getAgent(_0x36bd29)[_0x907b('0x1e')](function(_0x2a0bdb){logger[_0x907b('0x14')](_0x907b('0x38'),_0x2a0bdb[_0x907b('0x1a')]);emit(util[_0x907b('0x33')](_0x907b('0x39'),_0x2a0bdb[_0x907b('0x1a')]),'webbar:transfer',{'sessionId':_0x2cc77d,'transferNumber':_0x4c0f80});return _0x4f847b['status'](0xc8)['json']({'error':![],'message':_0x907b('0x4c')});})[_0x907b('0x22')](handleError(_0x4f847b));}; \ No newline at end of file +var _0x87cb=['hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','calls','calls\x20fired:','filter','conference','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','http','../../config/logger','webbarapi','ioredis','redis','defaults','socket.io-emitter','validate','number','userId\x20is\x20required','callNumber\x20is\x20required','string','sessionId\x20is\x20required','info','emit','log','handleError:','error','send','name','status','NotFound','request','code','message','result','User','agent','then','VoiceChannels','all','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','body','json','userId','callerId','callbackUrl','entityFound:','user:%s','webbar:originate','originate\x20executed!','catch','hangup','hangup\x20fired:','format','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','answer\x20executed!','hold','webbar:hold'];(function(_0x2f3a5a,_0x19264d){var _0x5710cd=function(_0xfb0fe){while(--_0xfb0fe){_0x2f3a5a['push'](_0x2f3a5a['shift']());}};_0x5710cd(++_0x19264d);}(_0x87cb,0xaa));var _0xb87c=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x87cb[_0x178e48];return _0x440d7e;};'use strict';var path=require(_0xb87c('0x0'));var fs=require('fs');var _=require(_0xb87c('0x1'));var db=require(_0xb87c('0x2'))['db'];var config=require(_0xb87c('0x3'));var util=require(_0xb87c('0x4'));var BPromise=require(_0xb87c('0x5'));var jayson=require('jayson/promise');var amiClient=jayson['client'][_0xb87c('0x6')]({'port':0x232a});var logger=require(_0xb87c('0x7'))(_0xb87c('0x8'));var Redis=require(_0xb87c('0x9'));config[_0xb87c('0xa')]=_[_0xb87c('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xb87c('0xc'))(new Redis(config[_0xb87c('0xa')]));var Schema=require(_0xb87c('0xd'));var originateValidation=new Schema({'userId':{'type':_0xb87c('0xe'),'required':[!![],_0xb87c('0xf')]},'callNumber':{'type':'string','required':[!![],_0xb87c('0x10')]},'callerId':{'type':_0xb87c('0x11')},'callbackUrl':{'type':_0xb87c('0x11')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0xb87c('0xf')]},'sessionId':{'type':_0xb87c('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xb87c('0xe'),'required':[!![],_0xb87c('0xf')]},'sessionId':{'type':_0xb87c('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xb87c('0x11'),'required':[!![],_0xb87c('0x12')]},'transferNumber':{'type':_0xb87c('0x11'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0xb87c('0xe'),'required':[!![],_0xb87c('0xf')]},'sessionId':{'type':_0xb87c('0x11'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xb87c('0xe'),'required':[!![],_0xb87c('0xf')]},'sessionId':{'type':_0xb87c('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xb87c('0xe'),'required':[!![],_0xb87c('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0xb87c('0xe'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x1bc036,_0x19b014,_0x24c7e0){logger[_0xb87c('0x13')](_0x1bc036,_0x19b014,JSON['stringify'](_0x24c7e0));io['to'](_0x1bc036)[_0xb87c('0x14')](_0x19b014,_0x24c7e0);}function handleError(_0x5ee991){return function(_0x4c4b6a){console[_0xb87c('0x15')](_0xb87c('0x16'),_0x4c4b6a,_0x4c4b6a instanceof RangeError);logger[_0xb87c('0x17')](_0x4c4b6a['stack']);if(_0x4c4b6a instanceof RangeError){if(_0x4c4b6a['name']){delete _0x4c4b6a['name'];}_0x5ee991['status'](0x194)[_0xb87c('0x18')](_0x4c4b6a);}else{if(_0x4c4b6a['name']){delete _0x4c4b6a[_0xb87c('0x19')];}_0x5ee991[_0xb87c('0x1a')](0x1f4)['send'](_0x4c4b6a);}};}function checkError(){return function(_0x297111){if(!_0x297111){throw new RangeError(_0xb87c('0x1b'));}return _0x297111;};}function respondWithRpcPromise(_0x5aa3c0,_0x569c82){return new BPromise(function(_0x423cda,_0x448000){var _0x9c992=amiClient;return _0x9c992[_0xb87c('0x1c')](_0x5aa3c0,_0x569c82)['then'](function(_0x3c7f29){if(_0x3c7f29['error']){if(_0x3c7f29[_0xb87c('0x17')][_0xb87c('0x1d')]===0x1f4){return _0x448000(_0x3c7f29[_0xb87c('0x17')][_0xb87c('0x1e')]);}return _0x423cda(_0x3c7f29[_0xb87c('0x17')][_0xb87c('0x1e')]);}else{_0x423cda(_0x3c7f29[_0xb87c('0x1f')]);}})['catch'](function(_0x5779fc){_0x448000(_0x5779fc);});});}function getAgent(_0x39a0c9){return db[_0xb87c('0x20')]['findOne']({'where':{'id':_0x39a0c9,'role':_0xb87c('0x21')}})[_0xb87c('0x22')](checkError());}function getAgentCheckSession(_0x441dcb,_0x4794b3){return new BPromise(function(_0x53bb92,_0x2c0ebd){var _0x338d7c=respondWithRpcPromise(_0xb87c('0x23'));var _0x4d6c1f=getAgent(_0x441dcb);Promise[_0xb87c('0x24')]([_0x338d7c,_0x4d6c1f])[_0xb87c('0x22')](function(_0x22171f){var _0x128a98=_0x22171f[0x0];var _0x285eec=_0x22171f[0x1];var _0x590837=_['filter'](_0x128a98[_0xb87c('0x25')],function(_0x3e3b0d){return _0x3e3b0d[_0xb87c('0x26')]==_0x285eec['id']&&_0x3e3b0d[_0xb87c('0x27')]==_0x4794b3;});if(_0x590837[_0xb87c('0x28')]==0x1){_0x53bb92(_0x285eec);}else{_0x2c0ebd(new RangeError(_0xb87c('0x29')+_0x4794b3+_0xb87c('0x2a')));}});});}exports[_0xb87c('0x2b')]=function(_0xd4938d,_0x228dab){logger['info']('originate\x20fired:',_0xd4938d[_0xb87c('0x2c')]);var _0x30a056=originateValidation['validate'](_0xd4938d[_0xb87c('0x2c')]);if(_0x30a056[_0xb87c('0x28')]>0x0){return _0x228dab[_0xb87c('0x1a')](0x190)[_0xb87c('0x2d')](_0x30a056);}var _0x5df232=_0xd4938d['body'][_0xb87c('0x2e')];var _0x2367e8=_0xd4938d[_0xb87c('0x2c')]['callNumber'];var _0x128956=_0xd4938d['body'][_0xb87c('0x2f')];var _0x52163c=_0xd4938d[_0xb87c('0x2c')][_0xb87c('0x30')];return getAgent(_0x5df232)['then'](function(_0x48b724){logger['info'](_0xb87c('0x31'),_0x48b724[_0xb87c('0x19')]);emit(util['format'](_0xb87c('0x32'),_0x48b724[_0xb87c('0x19')]),_0xb87c('0x33'),{'callNumber':_0x2367e8,'callerId':_0x128956,'callbackUrl':_0x52163c});return _0x228dab[_0xb87c('0x1a')](0xc8)[_0xb87c('0x2d')]({'error':![],'message':_0xb87c('0x34')});})[_0xb87c('0x35')](handleError(_0x228dab));};exports[_0xb87c('0x36')]=function(_0xbe9a14,_0x3c9633){logger[_0xb87c('0x13')](_0xb87c('0x37'),_0xbe9a14[_0xb87c('0x2c')]);var _0x590a66=hangupValidation[_0xb87c('0xd')](_0xbe9a14['body']);if(_0x590a66[_0xb87c('0x28')]>0x0){return _0x3c9633[_0xb87c('0x1a')](0x190)[_0xb87c('0x2d')](_0x590a66);}var _0x8cd9ff=_0xbe9a14[_0xb87c('0x2c')][_0xb87c('0x2e')];var _0x459330=_0xbe9a14['body'][_0xb87c('0x27')];return getAgent(_0x8cd9ff)[_0xb87c('0x22')](function(_0x3ab92d){logger['info'](_0xb87c('0x31'),_0x3ab92d['name']);emit(util[_0xb87c('0x38')](_0xb87c('0x32'),_0x3ab92d[_0xb87c('0x19')]),_0xb87c('0x39'),{'sessionId':_0x459330});return _0x3c9633[_0xb87c('0x1a')](0xc8)[_0xb87c('0x2d')]({'error':![],'message':_0xb87c('0x3a')});})['catch'](handleError(_0x3c9633));};exports[_0xb87c('0x3b')]=function(_0x7a5328,_0x303785){logger['info'](_0xb87c('0x3c'),_0x7a5328[_0xb87c('0x2c')]);var _0x443677=answerValidation['validate'](_0x7a5328[_0xb87c('0x2c')]);if(_0x443677[_0xb87c('0x28')]>0x0){return _0x303785[_0xb87c('0x1a')](0x190)[_0xb87c('0x2d')](_0x443677);}var _0xc008e4=_0x7a5328[_0xb87c('0x2c')][_0xb87c('0x2e')];var _0xbbcbe=_0x7a5328['body'][_0xb87c('0x27')];return getAgent(_0xc008e4)[_0xb87c('0x22')](function(_0x49de02){logger[_0xb87c('0x13')](_0xb87c('0x31'),_0x49de02[_0xb87c('0x19')]);emit(util[_0xb87c('0x38')]('user:%s',_0x49de02[_0xb87c('0x19')]),'webbar:answer',{'sessionId':_0xbbcbe});return _0x303785[_0xb87c('0x1a')](0xc8)[_0xb87c('0x2d')]({'error':![],'message':_0xb87c('0x3d')});})['catch'](handleError(_0x303785));};exports[_0xb87c('0x3e')]=function(_0x5c3337,_0x5d38da){logger[_0xb87c('0x13')]('hold\x20fired:',_0x5c3337['body']);var _0x4e5f6e=holdValidation[_0xb87c('0xd')](_0x5c3337['body']);if(_0x4e5f6e[_0xb87c('0x28')]>0x0){return _0x5d38da[_0xb87c('0x1a')](0x190)[_0xb87c('0x2d')](_0x4e5f6e);}var _0x2ab3a6=_0x5c3337[_0xb87c('0x2c')]['userId'];var _0x18e0e1=_0x5c3337['body']['sessionId'];return getAgent(_0x2ab3a6)[_0xb87c('0x22')](function(_0x571471){logger[_0xb87c('0x13')]('entityFound:',_0x571471['name']);emit(util[_0xb87c('0x38')]('user:%s',_0x571471[_0xb87c('0x19')]),_0xb87c('0x3f'),{'sessionId':_0x18e0e1});return _0x5d38da[_0xb87c('0x1a')](0xc8)[_0xb87c('0x2d')]({'error':![],'message':_0xb87c('0x40')});})['catch'](handleError(_0x5d38da));};exports[_0xb87c('0x41')]=function(_0x10fc2d,_0x59bd46){logger[_0xb87c('0x13')](_0xb87c('0x42'),_0x10fc2d[_0xb87c('0x2c')]);var _0x2a6f0a=unholdValidation[_0xb87c('0xd')](_0x10fc2d[_0xb87c('0x2c')]);if(_0x2a6f0a[_0xb87c('0x28')]>0x0){return _0x59bd46[_0xb87c('0x1a')](0x190)[_0xb87c('0x2d')](_0x2a6f0a);}var _0x107020=_0x10fc2d['body'][_0xb87c('0x2e')];var _0x5f33b9=_0x10fc2d[_0xb87c('0x2c')][_0xb87c('0x27')];return getAgent(_0x107020)[_0xb87c('0x22')](function(_0x2ec064){logger[_0xb87c('0x13')]('entityFound:',_0x2ec064['name']);emit(util[_0xb87c('0x38')]('user:%s',_0x2ec064[_0xb87c('0x19')]),_0xb87c('0x43'),{'sessionId':_0x5f33b9});return _0x59bd46[_0xb87c('0x1a')](0xc8)[_0xb87c('0x2d')]({'error':![],'message':'unhold\x20executed!'});})[_0xb87c('0x35')](handleError(_0x59bd46));};exports[_0xb87c('0x44')]=function(_0x5b8f7c,_0x4e9c03){logger[_0xb87c('0x13')](_0xb87c('0x45'),_0x4e9c03[_0xb87c('0x2c')]);var _0x8b114f=callsValidation[_0xb87c('0xd')](_0x5b8f7c[_0xb87c('0x2c')]);if(_0x8b114f[_0xb87c('0x28')]>0x0){return _0x4e9c03[_0xb87c('0x1a')](0x190)['json'](_0x8b114f);}var _0x32a4a0=_0x5b8f7c[_0xb87c('0x2c')][_0xb87c('0x2e')];var _0x2d524c=respondWithRpcPromise(_0xb87c('0x23'));var _0xb5c8ff=getAgent(_0x32a4a0);return Promise[_0xb87c('0x24')]([_0x2d524c,_0xb5c8ff])[_0xb87c('0x22')](function(_0x4474d0){var _0x12136e=_0x4474d0[0x0];var _0x50ecc1=_0x4474d0[0x1];var _0x44a631=_[_0xb87c('0x46')](_0x12136e[_0xb87c('0x25')],function(_0x18fa7d){return _0x18fa7d['UserId']==_0x50ecc1['id'];});return _0x4e9c03[_0xb87c('0x1a')](0xc8)[_0xb87c('0x2d')]({'count':_0x44a631[_0xb87c('0x28')],'rows':_0x44a631});})[_0xb87c('0x35')](handleError(_0x4e9c03));};exports[_0xb87c('0x47')]=function(_0x1eb9ee,_0x35f331){logger[_0xb87c('0x13')](_0xb87c('0x48'),_0x1eb9ee['body']);var _0x11f0cf=conferenceValidation[_0xb87c('0xd')](_0x1eb9ee[_0xb87c('0x2c')]);if(_0x11f0cf['length']>0x0){return _0x35f331['status'](0x190)[_0xb87c('0x2d')](_0x11f0cf);}var _0x1201b0=_0x1eb9ee[_0xb87c('0x2c')][_0xb87c('0x2e')];return getAgent(_0x1201b0)[_0xb87c('0x22')](function(_0x56a9b1){logger[_0xb87c('0x13')]('entityFound:',_0x56a9b1[_0xb87c('0x19')]);emit(util[_0xb87c('0x38')]('user:%s',_0x56a9b1['name']),'webbar:conference');return _0x35f331[_0xb87c('0x1a')](0xc8)[_0xb87c('0x2d')]({'error':![],'message':_0xb87c('0x49')});})[_0xb87c('0x35')](handleError(_0x35f331));};exports[_0xb87c('0x4a')]=function(_0x3cc4f1,_0x2f29db){logger[_0xb87c('0x13')](_0xb87c('0x4b'),_0x3cc4f1[_0xb87c('0x2c')]);var _0xec5f62=transferValidation[_0xb87c('0xd')](_0x3cc4f1[_0xb87c('0x2c')]);if(_0xec5f62[_0xb87c('0x28')]>0x0){return _0x2f29db[_0xb87c('0x1a')](0x190)[_0xb87c('0x2d')](_0xec5f62);}var _0x5e75a5=_0x3cc4f1[_0xb87c('0x2c')][_0xb87c('0x2e')];var _0x42084b=_0x3cc4f1[_0xb87c('0x2c')]['sessionId'];var _0x136c66=_0x3cc4f1[_0xb87c('0x2c')]['transferNumber'];return getAgent(_0x5e75a5)[_0xb87c('0x22')](function(_0x24db26){logger[_0xb87c('0x13')](_0xb87c('0x31'),_0x24db26[_0xb87c('0x19')]);emit(util[_0xb87c('0x38')](_0xb87c('0x32'),_0x24db26[_0xb87c('0x19')]),_0xb87c('0x4c'),{'sessionId':_0x42084b,'transferNumber':_0x136c66});return _0x2f29db[_0xb87c('0x1a')](0xc8)[_0xb87c('0x2d')]({'error':![],'message':_0xb87c('0x4d')});})[_0xb87c('0x35')](handleError(_0x2f29db));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 01dfbc1..eb0ff1a 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 _0x6f97=['post','addAnswer','/:id/users','/:id/notify','notify','/:id/send','send','put','/:id','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','path','connect-timeout','../../components/auth/service','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','create'];(function(_0x4d7f6f,_0xfe7678){var _0x51f512=function(_0x2be95f){while(--_0x2be95f){_0x4d7f6f['push'](_0x4d7f6f['shift']());}};_0x51f512(++_0xfe7678);}(_0x6f97,0x159));var _0x76f9=function(_0x5b47d9,_0x1327ce){_0x5b47d9=_0x5b47d9-0x0;var _0x4151f0=_0x6f97[_0x5b47d9];return _0x4151f0;};'use strict';var multer=require('multer');var util=require(_0x76f9('0x0'));var path=require(_0x76f9('0x1'));var timeout=require(_0x76f9('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x76f9('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappAccount.controller');router[_0x76f9('0x4')]('/',auth[_0x76f9('0x5')](),controller[_0x76f9('0x6')]);router[_0x76f9('0x4')](_0x76f9('0x7'),auth[_0x76f9('0x5')](),controller[_0x76f9('0x8')]);router[_0x76f9('0x4')]('/:id',auth[_0x76f9('0x5')](),controller[_0x76f9('0x9')]);router['get'](_0x76f9('0xa'),auth[_0x76f9('0x5')](),controller['getDispositions']);router[_0x76f9('0x4')](_0x76f9('0xb'),auth[_0x76f9('0x5')](),controller[_0x76f9('0xc')]);router[_0x76f9('0x4')]('/:id/users',auth[_0x76f9('0x5')](),controller['getAgents']);router['get'](_0x76f9('0xd'),auth['isAuthenticated'](),controller['getApplications']);router['post']('/',auth[_0x76f9('0x5')](),controller[_0x76f9('0xe')]);router[_0x76f9('0xf')](_0x76f9('0xa'),auth[_0x76f9('0x5')](),controller['addDisposition']);router[_0x76f9('0xf')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x76f9('0x10')]);router[_0x76f9('0xf')](_0x76f9('0x11'),auth['isAuthenticated'](),controller['addAgents']);router['post'](_0x76f9('0xd'),auth[_0x76f9('0x5')](),controller['addApplications']);router[_0x76f9('0xf')](_0x76f9('0x12'),controller[_0x76f9('0x13')]);router[_0x76f9('0xf')](_0x76f9('0x14'),auth[_0x76f9('0x5')](),controller[_0x76f9('0x15')]);router[_0x76f9('0x16')](_0x76f9('0x17'),auth[_0x76f9('0x5')](),controller['update']);router[_0x76f9('0x18')](_0x76f9('0x17'),auth[_0x76f9('0x5')](),controller[_0x76f9('0x19')]);router[_0x76f9('0x18')](_0x76f9('0xa'),auth[_0x76f9('0x5')](),controller[_0x76f9('0x1a')]);router['delete'](_0x76f9('0xb'),auth[_0x76f9('0x5')](),controller[_0x76f9('0x1b')]);router[_0x76f9('0x18')](_0x76f9('0x11'),auth[_0x76f9('0x5')](),controller[_0x76f9('0x1c')]);module[_0x76f9('0x1d')]=router; \ No newline at end of file +var _0x70c2=['/:id/dispositions','addDisposition','addAnswer','addApplications','/:id/notify','notify','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','getDispositions','/:id/canned_answers','/:id/users','getAgents','/:id/applications','getApplications','post','create'];(function(_0x7eaf5c,_0x2f0913){var _0x4b11cf=function(_0x482062){while(--_0x482062){_0x7eaf5c['push'](_0x7eaf5c['shift']());}};_0x4b11cf(++_0x2f0913);}(_0x70c2,0x13f));var _0x270c=function(_0x52ef13,_0x326463){_0x52ef13=_0x52ef13-0x0;var _0x42bed8=_0x70c2[_0x52ef13];return _0x42bed8;};'use strict';var multer=require(_0x270c('0x0'));var util=require(_0x270c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x270c('0x2'));var router=express[_0x270c('0x3')]();var auth=require(_0x270c('0x4'));var interaction=require(_0x270c('0x5'));var config=require(_0x270c('0x6'));var controller=require(_0x270c('0x7'));router[_0x270c('0x8')]('/',auth['isAuthenticated'](),controller[_0x270c('0x9')]);router[_0x270c('0x8')](_0x270c('0xa'),auth[_0x270c('0xb')](),controller[_0x270c('0xc')]);router[_0x270c('0x8')](_0x270c('0xd'),auth[_0x270c('0xb')](),controller[_0x270c('0xe')]);router[_0x270c('0x8')]('/:id/dispositions',auth[_0x270c('0xb')](),controller[_0x270c('0xf')]);router[_0x270c('0x8')](_0x270c('0x10'),auth[_0x270c('0xb')](),controller['getAnswers']);router[_0x270c('0x8')](_0x270c('0x11'),auth[_0x270c('0xb')](),controller[_0x270c('0x12')]);router[_0x270c('0x8')](_0x270c('0x13'),auth[_0x270c('0xb')](),controller[_0x270c('0x14')]);router[_0x270c('0x15')]('/',auth['isAuthenticated'](),controller[_0x270c('0x16')]);router[_0x270c('0x15')](_0x270c('0x17'),auth['isAuthenticated'](),controller[_0x270c('0x18')]);router[_0x270c('0x15')](_0x270c('0x10'),auth[_0x270c('0xb')](),controller[_0x270c('0x19')]);router['post'](_0x270c('0x11'),auth[_0x270c('0xb')](),controller['addAgents']);router['post'](_0x270c('0x13'),auth[_0x270c('0xb')](),controller[_0x270c('0x1a')]);router[_0x270c('0x15')](_0x270c('0x1b'),controller[_0x270c('0x1c')]);router[_0x270c('0x15')](_0x270c('0x1d'),auth[_0x270c('0xb')](),controller[_0x270c('0x1e')]);router[_0x270c('0x1f')](_0x270c('0xd'),auth['isAuthenticated'](),controller[_0x270c('0x20')]);router[_0x270c('0x21')](_0x270c('0xd'),auth[_0x270c('0xb')](),controller[_0x270c('0x22')]);router[_0x270c('0x21')](_0x270c('0x17'),auth[_0x270c('0xb')](),controller[_0x270c('0x23')]);router[_0x270c('0x21')](_0x270c('0x10'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x270c('0x21')]('/:id/users',auth[_0x270c('0xb')](),controller[_0x270c('0x24')]);module[_0x270c('0x25')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index a815e40..0c209d4 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 _0x6e14=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','ENUM','twilio','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x4b0c6e,_0x3797ce){var _0x2a0ab8=function(_0x1053c4){while(--_0x1053c4){_0x4b0c6e['push'](_0x4b0c6e['shift']());}};_0x2a0ab8(++_0x3797ce);}(_0x6e14,0x6c));var _0x46e1=function(_0x4be9db,_0x4b2c1b){_0x4be9db=_0x4be9db-0x0;var _0x20f265=_0x6e14[_0x4be9db];return _0x20f265;};'use strict';var Sequelize=require(_0x46e1('0x0'));var rs=require(_0x46e1('0x1'));module[_0x46e1('0x2')]={'name':{'type':Sequelize[_0x46e1('0x3')],'unique':_0x46e1('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x46e1('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x46e1('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x46e1('0x3')]},'type':{'type':Sequelize[_0x46e1('0x5')](_0x46e1('0x6'))},'accountSid':{'type':Sequelize[_0x46e1('0x3')]},'authToken':{'type':Sequelize[_0x46e1('0x3')]},'notificationTemplate':{'type':Sequelize[_0x46e1('0x7')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x46e1('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x46e1('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x46e1('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x46e1('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x46e1('0x8')],'defaultValue':![],'comment':_0x46e1('0xb'),'set':function(_0x2bbc99){if(!_0x2bbc99){this[_0x46e1('0xc')](_0x46e1('0xd'),null);}this[_0x46e1('0xc')](_0x46e1('0xe'),_0x2bbc99);}},'description':{'type':Sequelize[_0x46e1('0x3')]}}; \ No newline at end of file +var _0xae06=['mandatoryDisposition','exports','STRING','name','ENUM','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0xae06,0x12d));var _0x6ae0=function(_0x7fd779,_0xf677a9){_0x7fd779=_0x7fd779-0x0;var _0x5f47fd=_0xae06[_0x7fd779];return _0x5f47fd;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x6ae0('0x0')]={'name':{'type':Sequelize[_0x6ae0('0x1')],'unique':_0x6ae0('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x6ae0('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x6ae0('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0x6ae0('0x1')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x6ae0('0x3')]('twilio')},'accountSid':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x6ae0('0x1')]},'notificationTemplate':{'type':Sequelize[_0x6ae0('0x4')],'defaultValue':function(){return _0x6ae0('0x5');}},'notificationSound':{'type':Sequelize[_0x6ae0('0x6')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x6ae0('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6ae0('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6ae0('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6ae0('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6ae0('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6ae0('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x6ae0('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x6ae0('0x6')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5d0d4f){if(!_0x5d0d4f){this[_0x6ae0('0x9')](_0x6ae0('0xa'),null);}this['setDataValue'](_0x6ae0('0xb'),_0x5d0d4f);}},'description':{'type':Sequelize[_0x6ae0('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index d099a14..110e7d3 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 _0x5ec6=['destroy','stack','name','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','getDispositions','WhatsappAccountId','filter','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addAgents','omit','removeAgents','isArray','emit','userWhatsappAccount:remove','getAgents','addApplications','sequelize','WhatsappApplication','bulkCreate','findAndCountAll','getApplications','notify','whatsapp','account','orderBy','priority','asc','Applications','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','twilio','from','From','whatsapp:','Body','messageId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','list','contact','WhatsappInteraction','spread','interaction','created','applications','push','*,*,*,*','WhatsappMessage','ContactId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','send','\x0a','to\x20is\x20mandatory','List','defaults','out','Messages','dataValues','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','path','to-csv','ejs','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappAccount.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','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','get','WhatsappAccounts','UserProfileResource'];(function(_0xb61c4e,_0x4cc1ca){var _0x2a5cbb=function(_0x132f5b){while(--_0x132f5b){_0xb61c4e['push'](_0xb61c4e['shift']());}};_0x2a5cbb(++_0x4cc1ca);}(_0x5ec6,0x7f));var _0x65ec=function(_0x39992f,_0x244fde){_0x39992f=_0x39992f-0x0;var _0x20711f=_0x5ec6[_0x39992f];return _0x20711f;};'use strict';var pdf=require(_0x65ec('0x0'));var emlformat=require(_0x65ec('0x1'));var rimraf=require(_0x65ec('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65ec('0x3'));var rp=require('request-promise');var moment=require(_0x65ec('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x65ec('0x5'));var util=require('util');var path=require(_0x65ec('0x6'));var sox=require('sox');var csv=require(_0x65ec('0x7'));var ejs=require(_0x65ec('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x65ec('0x9'));var crypto=require(_0x65ec('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x65ec('0xb'));var toCsv=require(_0x65ec('0x7'));var querystring=require(_0x65ec('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65ec('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x65ec('0xe'));var hardwareService=require(_0x65ec('0xf'));var logger=require('../../config/logger')(_0x65ec('0x10'));var utils=require(_0x65ec('0x11'));var config=require('../../config/environment');var db=require(_0x65ec('0x12'))['db'];config[_0x65ec('0x13')]=_['defaults'](config[_0x65ec('0x13')],{'host':_0x65ec('0x14'),'port':0x18eb});var socket=require(_0x65ec('0x15'))(new Redis(config[_0x65ec('0x13')]));require(_0x65ec('0x16'))[_0x65ec('0x17')](socket);var jayson=require(_0x65ec('0x18'));var client=jayson[_0x65ec('0x19')]['http']({'port':0x232c});function checkPasswordPattern(_0x28be8b,_0x3ed6f7,_0x35d06b){if(_0x35d06b){var _0x4bbe88=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4bbe88['test'](_0x3ed6f7)){return _0x28be8b;}else{throw new db[(_0x65ec('0x1a'))][(_0x65ec('0x1b'))](_0x65ec('0x1c'));}}else{return _0x28be8b;}}function respondWithRpcPromise(_0x4f2c63,_0x25dae7,_0x286eac,_0x1254f8){return new BPromise(function(_0xb4ed90,_0x29ebc4){var _0xd81ed3=_0x1254f8||client;return _0xd81ed3[_0x65ec('0x1d')](_0x4f2c63,_0x286eac)[_0x65ec('0x1e')](function(_0x2127e2){logger[_0x65ec('0x1f')](_0x65ec('0x20'),_0x25dae7,_0x65ec('0x21'));logger[_0x65ec('0x22')](_0x65ec('0x23'),_0x25dae7,_0x65ec('0x21'),JSON[_0x65ec('0x24')](_0x2127e2));if(_0x2127e2[_0x65ec('0x25')]){if(_0x2127e2[_0x65ec('0x25')][_0x65ec('0x26')]===0x1f4){logger['error'](_0x65ec('0x20'),_0x25dae7,_0x2127e2[_0x65ec('0x25')][_0x65ec('0x27')]);return _0x29ebc4(_0x2127e2[_0x65ec('0x25')][_0x65ec('0x27')]);}logger[_0x65ec('0x25')](_0x65ec('0x20'),_0x25dae7,_0x2127e2['error'][_0x65ec('0x27')]);return _0xb4ed90(_0x2127e2[_0x65ec('0x25')][_0x65ec('0x27')]);}else{logger[_0x65ec('0x1f')](_0x65ec('0x20'),_0x25dae7,_0x65ec('0x21'));_0xb4ed90(_0x2127e2[_0x65ec('0x28')][_0x65ec('0x27')]);}})[_0x65ec('0x29')](function(_0x4c846b){logger[_0x65ec('0x25')](_0x65ec('0x20'),_0x25dae7,_0x4c846b);_0x29ebc4(_0x4c846b);});});}function respondWithStatusCode(_0x251831,_0x23b1a3){_0x23b1a3=_0x23b1a3||0xcc;return function(_0x4de451){if(_0x4de451){return _0x251831[_0x65ec('0x2a')](_0x23b1a3);}return _0x251831['status'](_0x23b1a3)[_0x65ec('0x2b')]();};}function respondWithResult(_0x1ada47,_0x1d0b5c){_0x1d0b5c=_0x1d0b5c||0xc8;return function(_0x30366c){if(_0x30366c){return _0x1ada47[_0x65ec('0x2c')](_0x1d0b5c)[_0x65ec('0x2d')](_0x30366c);}};}function respondWithFilteredResult(_0x46bf66,_0x39410f){return function(_0x984a82){if(_0x984a82){var _0xeec5d4=_0x984a82[_0x65ec('0x2e')],_0x3c97e2=_0x39410f['offset'],_0x4b435c=_0x39410f[_0x65ec('0x2f')]+_0x39410f[_0x65ec('0x30')],_0x50d81f;if(_0x4b435c>=_0xeec5d4){_0x4b435c=_0xeec5d4;_0x50d81f=0xc8;}else{_0x50d81f=0xce;}_0x46bf66['status'](_0x50d81f);return _0x46bf66[_0x65ec('0x31')](_0x65ec('0x32'),_0x3c97e2+'-'+_0x4b435c+'/'+_0xeec5d4)[_0x65ec('0x2d')](_0x984a82);}return null;};}function patchUpdates(_0x3c8dd7){return function(_0x491dc6){try{jsonpatch[_0x65ec('0x33')](_0x491dc6,_0x3c8dd7,!![]);}catch(_0x3b9dcb){return BPromise[_0x65ec('0x34')](_0x3b9dcb);}return _0x491dc6[_0x65ec('0x35')]();};}function saveUpdates(_0x3e4f4f,_0x3826fa){return function(_0x38dea3){if(_0x38dea3){return _0x38dea3[_0x65ec('0x36')](_0x3e4f4f)[_0x65ec('0x1e')](function(_0xff3f3c){return _0xff3f3c;});}return null;};}function removeEntity(_0x50db17,_0x6a5861){return function(_0x1e20c4){if(_0x1e20c4){return _0x1e20c4['destroy']()[_0x65ec('0x1e')](function(){var _0x24a242=_0x1e20c4[_0x65ec('0x37')]({'plain':!![]});var _0x2b8aca=_0x65ec('0x38');return db[_0x65ec('0x39')][_0x65ec('0x3a')]({'where':{'type':_0x2b8aca,'resourceId':_0x24a242['id']}})['then'](function(){return _0x1e20c4;});})[_0x65ec('0x1e')](function(){_0x50db17[_0x65ec('0x2c')](0xcc)[_0x65ec('0x2b')]();});}};}function handleEntityNotFound(_0x185447,_0x5028e3){return function(_0x5d8458){if(!_0x5d8458){_0x185447[_0x65ec('0x2a')](0x194);}return _0x5d8458;};}function handleError(_0x398edd,_0x940f13){_0x940f13=_0x940f13||0x1f4;return function(_0x55ac61){logger['error'](_0x55ac61[_0x65ec('0x3b')]);if(_0x55ac61['name']){delete _0x55ac61[_0x65ec('0x3c')];}_0x398edd[_0x65ec('0x2c')](_0x940f13)['send'](_0x55ac61);};}exports[_0x65ec('0x3d')]=function(_0x1fbc2b,_0x13aa56){var _0x5357bf={'include':[{'model':db[_0x65ec('0x3e')],'as':_0x65ec('0x3f')}]},_0x3cffbf={},_0x3b72cf={'count':0x0,'rows':[]};var _0x470bb3=_[_0x65ec('0x40')](db[_0x65ec('0x41')]['rawAttributes'],function(_0x28653a){return{'name':_0x28653a['fieldName'],'type':_0x28653a[_0x65ec('0x42')][_0x65ec('0x43')]};});_0x3cffbf[_0x65ec('0x44')]=_[_0x65ec('0x40')](_0x470bb3,_0x65ec('0x3c'));_0x3cffbf[_0x65ec('0x45')]=_['keys'](_0x1fbc2b[_0x65ec('0x45')]);_0x3cffbf['filters']=_['intersection'](_0x3cffbf[_0x65ec('0x44')],_0x3cffbf[_0x65ec('0x45')]);_0x5357bf[_0x65ec('0x46')]=_[_0x65ec('0x47')](_0x3cffbf[_0x65ec('0x44')],qs['fields'](_0x1fbc2b['query'][_0x65ec('0x48')]));_0x5357bf[_0x65ec('0x46')]=_0x5357bf[_0x65ec('0x46')][_0x65ec('0x49')]?_0x5357bf[_0x65ec('0x46')]:_0x3cffbf['model'];if(!_0x1fbc2b['query'][_0x65ec('0x4a')](_0x65ec('0x4b'))){_0x5357bf[_0x65ec('0x30')]=qs[_0x65ec('0x30')](_0x1fbc2b[_0x65ec('0x45')][_0x65ec('0x30')]);_0x5357bf[_0x65ec('0x2f')]=qs['offset'](_0x1fbc2b[_0x65ec('0x45')][_0x65ec('0x2f')]);}_0x5357bf[_0x65ec('0x4c')]=qs['sort'](_0x1fbc2b[_0x65ec('0x45')][_0x65ec('0x4d')]);_0x5357bf['where']=qs[_0x65ec('0x4e')](_[_0x65ec('0x4f')](_0x1fbc2b[_0x65ec('0x45')],_0x3cffbf[_0x65ec('0x4e')]),_0x470bb3);if(_0x1fbc2b[_0x65ec('0x45')]['filter']){_0x5357bf[_0x65ec('0x50')]=_[_0x65ec('0x51')](_0x5357bf[_0x65ec('0x50')],{'$or':_[_0x65ec('0x40')](_0x470bb3,function(_0x59c182){if(_0x59c182[_0x65ec('0x42')]!=='VIRTUAL'){var _0x1ed0f9={};_0x1ed0f9[_0x59c182[_0x65ec('0x3c')]]={'$like':'%'+_0x1fbc2b[_0x65ec('0x45')]['filter']+'%'};return _0x1ed0f9;}})});}_0x5357bf=_['merge']({},_0x5357bf,_0x1fbc2b[_0x65ec('0x52')]);var _0x45d2bc={'where':_0x5357bf[_0x65ec('0x50')]};return db[_0x65ec('0x41')][_0x65ec('0x2e')](_0x45d2bc)[_0x65ec('0x1e')](function(_0x1c546c){_0x3b72cf[_0x65ec('0x2e')]=_0x1c546c;if(_0x1fbc2b[_0x65ec('0x45')][_0x65ec('0x53')]){_0x5357bf[_0x65ec('0x54')]=[{'all':!![]}];}return db[_0x65ec('0x41')][_0x65ec('0x55')](_0x5357bf);})[_0x65ec('0x1e')](function(_0x11d2d6){_0x3b72cf[_0x65ec('0x56')]=_0x11d2d6;return _0x3b72cf;})[_0x65ec('0x1e')](respondWithFilteredResult(_0x13aa56,_0x5357bf))['catch'](handleError(_0x13aa56,null));};exports[_0x65ec('0x57')]=function(_0x2814f3,_0x4e0da8){var _0x3a474c={'raw':![],'where':{'id':_0x2814f3[_0x65ec('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0x65ec('0x3f')}]},_0x7add40={};_0x7add40[_0x65ec('0x44')]=_[_0x65ec('0x59')](db['WhatsappAccount'][_0x65ec('0x5a')]);_0x7add40['query']=_['keys'](_0x2814f3[_0x65ec('0x45')]);_0x7add40[_0x65ec('0x4e')]=_[_0x65ec('0x47')](_0x7add40['model'],_0x7add40[_0x65ec('0x45')]);_0x3a474c[_0x65ec('0x46')]=_[_0x65ec('0x47')](_0x7add40[_0x65ec('0x44')],qs[_0x65ec('0x48')](_0x2814f3[_0x65ec('0x45')][_0x65ec('0x48')]));_0x3a474c[_0x65ec('0x46')]=_0x3a474c[_0x65ec('0x46')]['length']?_0x3a474c['attributes']:_0x7add40[_0x65ec('0x44')];if(_0x2814f3['query'][_0x65ec('0x53')]){_0x3a474c['include']=[{'all':!![]}];}_0x3a474c=_[_0x65ec('0x51')]({},_0x3a474c,_0x2814f3[_0x65ec('0x52')]);return db[_0x65ec('0x41')][_0x65ec('0x5b')](_0x3a474c)[_0x65ec('0x1e')](handleEntityNotFound(_0x4e0da8,null))[_0x65ec('0x1e')](respondWithResult(_0x4e0da8,null))[_0x65ec('0x29')](handleError(_0x4e0da8,null));};exports['create']=function(_0x2c7657,_0x474bc0){return db[_0x65ec('0x41')][_0x65ec('0x5c')](_0x2c7657[_0x65ec('0x5d')],{})['then'](function(_0x20f60f){var _0x318be3=_0x2c7657[_0x65ec('0x5e')][_0x65ec('0x37')]({'plain':!![]});if(!_0x318be3)throw new Error(_0x65ec('0x5f'));if(_0x318be3[_0x65ec('0x60')]===_0x65ec('0x5e')){var _0x2e81ea=_0x20f60f['get']({'plain':!![]});var _0x311e78=_0x65ec('0x38');return db[_0x65ec('0x61')][_0x65ec('0x5b')]({'where':{'name':_0x311e78,'userProfileId':_0x318be3[_0x65ec('0x62')]},'raw':!![]})[_0x65ec('0x1e')](function(_0x192055){if(_0x192055&&_0x192055['autoAssociation']===0x0){return db['UserProfileResource'][_0x65ec('0x5c')]({'name':_0x2e81ea['name'],'resourceId':_0x2e81ea['id'],'type':_0x192055[_0x65ec('0x3c')],'sectionId':_0x192055['id']},{})[_0x65ec('0x1e')](function(){return _0x20f60f;});}else{return _0x20f60f;}})['catch'](function(_0x1baa17){logger[_0x65ec('0x25')](_0x65ec('0x63'),_0x1baa17);throw _0x1baa17;});}return _0x20f60f;})[_0x65ec('0x1e')](respondWithResult(_0x474bc0,0xc9))[_0x65ec('0x29')](handleError(_0x474bc0,null));};exports[_0x65ec('0x36')]=function(_0x2279ff,_0x5df65c){if(_0x2279ff['body']['id']){delete _0x2279ff[_0x65ec('0x5d')]['id'];}return db[_0x65ec('0x41')][_0x65ec('0x5b')]({'where':{'id':_0x2279ff['params']['id']},'include':[{'model':db[_0x65ec('0x3e')],'as':_0x65ec('0x3f')}]})[_0x65ec('0x1e')](handleEntityNotFound(_0x5df65c,null))[_0x65ec('0x1e')](saveUpdates(_0x2279ff[_0x65ec('0x5d')],null))[_0x65ec('0x1e')](respondWithResult(_0x5df65c,null))[_0x65ec('0x29')](handleError(_0x5df65c,null));};exports['destroy']=function(_0x464f67,_0x1e2731){return db[_0x65ec('0x41')][_0x65ec('0x5b')]({'where':{'id':_0x464f67[_0x65ec('0x58')]['id']}})[_0x65ec('0x1e')](handleEntityNotFound(_0x1e2731,null))[_0x65ec('0x1e')](removeEntity(_0x1e2731,null))[_0x65ec('0x29')](handleError(_0x1e2731,null));};exports[_0x65ec('0x64')]=function(_0x584811,_0x59a690){return db[_0x65ec('0x41')]['describe']()['then'](respondWithResult(_0x59a690,null))[_0x65ec('0x29')](handleError(_0x59a690,null));};exports[_0x65ec('0x65')]=function(_0x39d0ce,_0x547057,_0x501775){if(_0x39d0ce[_0x65ec('0x5d')]['id']){delete _0x39d0ce['body']['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x39d0ce[_0x65ec('0x58')]['id']}})['then'](handleEntityNotFound(_0x547057,null))[_0x65ec('0x1e')](function(_0x1e101c){if(_0x1e101c){_0x39d0ce[_0x65ec('0x5d')]['WhatsappAccountId']=_0x1e101c['id'];return db['Disposition'][_0x65ec('0x5c')](_0x39d0ce['body']);}})[_0x65ec('0x1e')](respondWithResult(_0x547057,null))[_0x65ec('0x29')](handleError(_0x547057,null));};exports[_0x65ec('0x66')]=function(_0x290c68,_0xc47b30,_0x2874ea){var _0xefa74d={'raw':![],'where':{}};var _0x572b15={};var _0x275a42={'count':0x0,'rows':[]};return db[_0x65ec('0x41')]['findOne']({'where':{'id':_0x290c68[_0x65ec('0x58')]['id']}})['then'](handleEntityNotFound(_0xc47b30,null))[_0x65ec('0x1e')](function(_0xf4dbce){if(_0xf4dbce){_0x572b15[_0x65ec('0x44')]=_[_0x65ec('0x59')](db['Disposition'][_0x65ec('0x5a')]);_0x572b15['query']=_[_0x65ec('0x59')](_0x290c68[_0x65ec('0x45')]);_0x572b15[_0x65ec('0x4e')]=_[_0x65ec('0x47')](_0x572b15['model'],_0x572b15['query']);_0xefa74d['attributes']=_[_0x65ec('0x47')](_0x572b15[_0x65ec('0x44')],qs[_0x65ec('0x48')](_0x290c68[_0x65ec('0x45')][_0x65ec('0x48')]));_0xefa74d[_0x65ec('0x46')]=_0xefa74d[_0x65ec('0x46')][_0x65ec('0x49')]?_0xefa74d[_0x65ec('0x46')]:_0x572b15[_0x65ec('0x44')];if(!_0x290c68[_0x65ec('0x45')][_0x65ec('0x4a')](_0x65ec('0x4b'))){_0xefa74d['limit']=qs[_0x65ec('0x30')](_0x290c68[_0x65ec('0x45')][_0x65ec('0x30')]);_0xefa74d[_0x65ec('0x2f')]=qs[_0x65ec('0x2f')](_0x290c68[_0x65ec('0x45')][_0x65ec('0x2f')]);}_0xefa74d[_0x65ec('0x4c')]=qs[_0x65ec('0x4d')](_0x290c68[_0x65ec('0x45')]['sort']);_0xefa74d[_0x65ec('0x50')]=qs['filters'](_['pick'](_0x290c68[_0x65ec('0x45')],_0x572b15[_0x65ec('0x4e')]));_0xefa74d[_0x65ec('0x50')][_0x65ec('0x67')]=_0xf4dbce['id'];if(_0x290c68[_0x65ec('0x45')][_0x65ec('0x68')]){_0xefa74d[_0x65ec('0x50')]=_[_0x65ec('0x51')](_0xefa74d['where'],{'$or':_[_0x65ec('0x40')](_0xefa74d['attributes'],function(_0x3850fd){var _0x1cad36={};_0x1cad36[_0x3850fd]={'$like':'%'+_0x290c68[_0x65ec('0x45')]['filter']+'%'};return _0x1cad36;})});}_0xefa74d=_[_0x65ec('0x51')]({},_0xefa74d,_0x290c68[_0x65ec('0x52')]);return db[_0x65ec('0x69')][_0x65ec('0x2e')]({'where':_0xefa74d[_0x65ec('0x50')]})[_0x65ec('0x1e')](function(_0x1172f3){_0x275a42['count']=_0x1172f3;if(_0x290c68[_0x65ec('0x45')][_0x65ec('0x53')]){_0xefa74d[_0x65ec('0x54')]=[{'all':!![]}];}return db[_0x65ec('0x69')]['findAll'](_0xefa74d);})['then'](function(_0x419e33){_0x275a42[_0x65ec('0x56')]=_0x419e33;return _0x275a42;});}})[_0x65ec('0x1e')](respondWithFilteredResult(_0xc47b30,_0xefa74d))[_0x65ec('0x29')](handleError(_0xc47b30,null));};exports[_0x65ec('0x6a')]=function(_0x277499,_0x5a171c,_0x3b0318){return db[_0x65ec('0x41')][_0x65ec('0x5b')]({'where':{'id':_0x277499[_0x65ec('0x58')]['id']}})[_0x65ec('0x1e')](handleEntityNotFound(_0x5a171c,null))[_0x65ec('0x1e')](function(_0x44b4e6){if(_0x44b4e6){return _0x44b4e6[_0x65ec('0x6a')](_0x277499['query'][_0x65ec('0x6b')]);}})[_0x65ec('0x1e')](respondWithStatusCode(_0x5a171c,null))['catch'](handleError(_0x5a171c,null));};exports[_0x65ec('0x6c')]=function(_0x2ca85,_0x28731c,_0x2606ea){if(_0x2ca85[_0x65ec('0x5d')]['id']){delete _0x2ca85[_0x65ec('0x5d')]['id'];}return db[_0x65ec('0x41')][_0x65ec('0x5b')]({'where':{'id':_0x2ca85[_0x65ec('0x58')]['id']}})[_0x65ec('0x1e')](handleEntityNotFound(_0x28731c,null))['then'](function(_0x5030f6){if(_0x5030f6){_0x2ca85[_0x65ec('0x5d')][_0x65ec('0x67')]=_0x5030f6['id'];return db[_0x65ec('0x6d')]['create'](_0x2ca85[_0x65ec('0x5d')]);}})[_0x65ec('0x1e')](respondWithResult(_0x28731c,null))[_0x65ec('0x29')](handleError(_0x28731c,null));};exports[_0x65ec('0x6e')]=function(_0x3d79a8,_0x386eba,_0x1ff60f){var _0x3f9105={'raw':![],'where':{}};var _0x27d5d5={};var _0x4f5e10={'count':0x0,'rows':[]};return db[_0x65ec('0x41')][_0x65ec('0x6f')]({'where':{'id':_0x3d79a8[_0x65ec('0x58')]['id']}})[_0x65ec('0x1e')](handleEntityNotFound(_0x386eba,null))[_0x65ec('0x1e')](function(_0xba5894){if(_0xba5894){_0x27d5d5['model']=_[_0x65ec('0x59')](db[_0x65ec('0x6d')][_0x65ec('0x5a')]);_0x27d5d5[_0x65ec('0x45')]=_[_0x65ec('0x59')](_0x3d79a8['query']);_0x27d5d5['filters']=_[_0x65ec('0x47')](_0x27d5d5[_0x65ec('0x44')],_0x27d5d5[_0x65ec('0x45')]);_0x3f9105[_0x65ec('0x46')]=_[_0x65ec('0x47')](_0x27d5d5[_0x65ec('0x44')],qs[_0x65ec('0x48')](_0x3d79a8[_0x65ec('0x45')][_0x65ec('0x48')]));_0x3f9105[_0x65ec('0x46')]=_0x3f9105[_0x65ec('0x46')]['length']?_0x3f9105[_0x65ec('0x46')]:_0x27d5d5['model'];if(!_0x3d79a8['query'][_0x65ec('0x4a')]('nolimit')){_0x3f9105[_0x65ec('0x30')]=qs[_0x65ec('0x30')](_0x3d79a8['query']['limit']);_0x3f9105[_0x65ec('0x2f')]=qs[_0x65ec('0x2f')](_0x3d79a8['query'][_0x65ec('0x2f')]);}_0x3f9105[_0x65ec('0x4c')]=qs['sort'](_0x3d79a8[_0x65ec('0x45')][_0x65ec('0x4d')]);_0x3f9105[_0x65ec('0x50')]=qs[_0x65ec('0x4e')](_['pick'](_0x3d79a8[_0x65ec('0x45')],_0x27d5d5[_0x65ec('0x4e')]));_0x3f9105['where'][_0x65ec('0x67')]=_0xba5894['id'];if(_0x3d79a8['query'][_0x65ec('0x68')]){_0x3f9105[_0x65ec('0x50')]=_[_0x65ec('0x51')](_0x3f9105['where'],{'$or':_['map'](_0x3f9105[_0x65ec('0x46')],function(_0x5b26b3){var _0x460044={};_0x460044[_0x5b26b3]={'$like':'%'+_0x3d79a8[_0x65ec('0x45')][_0x65ec('0x68')]+'%'};return _0x460044;})});}_0x3f9105=_['merge']({},_0x3f9105,_0x3d79a8[_0x65ec('0x52')]);return db['CannedAnswer']['count']({'where':_0x3f9105[_0x65ec('0x50')]})['then'](function(_0x102e66){_0x4f5e10[_0x65ec('0x2e')]=_0x102e66;if(_0x3d79a8['query']['includeAll']){_0x3f9105['include']=[{'all':!![]}];}return db[_0x65ec('0x6d')][_0x65ec('0x55')](_0x3f9105);})[_0x65ec('0x1e')](function(_0x596f1c){_0x4f5e10['rows']=_0x596f1c;return _0x4f5e10;});}})['then'](respondWithFilteredResult(_0x386eba,_0x3f9105))[_0x65ec('0x29')](handleError(_0x386eba,null));};exports[_0x65ec('0x70')]=function(_0xc908a7,_0x1c8cd1,_0x1df337){return db[_0x65ec('0x41')][_0x65ec('0x5b')]({'where':{'id':_0xc908a7[_0x65ec('0x58')]['id']}})[_0x65ec('0x1e')](handleEntityNotFound(_0x1c8cd1,null))[_0x65ec('0x1e')](function(_0x309341){if(_0x309341){return _0x309341['removeAnswers'](_0xc908a7[_0x65ec('0x45')][_0x65ec('0x6b')]);}})[_0x65ec('0x1e')](respondWithStatusCode(_0x1c8cd1,null))[_0x65ec('0x29')](handleError(_0x1c8cd1,null));};exports[_0x65ec('0x71')]=function(_0x47cf0c,_0x5c6a76,_0x44d1a7){return db[_0x65ec('0x41')][_0x65ec('0x5b')]({'where':{'id':_0x47cf0c['params']['id']}})['then'](handleEntityNotFound(_0x5c6a76,null))[_0x65ec('0x1e')](function(_0x3ccb0f){if(_0x3ccb0f){return _0x3ccb0f[_0x65ec('0x71')](_0x47cf0c[_0x65ec('0x5d')][_0x65ec('0x6b')],_[_0x65ec('0x72')](_0x47cf0c[_0x65ec('0x5d')],[_0x65ec('0x6b'),'id'])||{})['spread'](function(_0x6c71a){for(var _0x2d78f4=0x0;_0x2d78f4<_0x47cf0c[_0x65ec('0x5d')][_0x65ec('0x6b')][_0x65ec('0x49')];_0x2d78f4+=0x1){socket['emit']('userWhatsappAccount:save',{'UserId':_0x47cf0c['body'][_0x65ec('0x6b')][_0x2d78f4],'WhatsappAccountId':_0x47cf0c[_0x65ec('0x58')]['id']});}return _0x6c71a;});}})[_0x65ec('0x1e')](respondWithResult(_0x5c6a76,null))[_0x65ec('0x29')](handleError(_0x5c6a76,null));};exports[_0x65ec('0x73')]=function(_0x2a065e,_0x5ef5b8,_0x20481e){return db[_0x65ec('0x41')][_0x65ec('0x5b')]({'where':{'id':_0x2a065e['params']['id']}})[_0x65ec('0x1e')](handleEntityNotFound(_0x5ef5b8,null))[_0x65ec('0x1e')](function(_0x172697){if(_0x172697){return _0x172697[_0x65ec('0x73')](_0x2a065e['query'][_0x65ec('0x6b')])[_0x65ec('0x1e')](function(){if(_[_0x65ec('0x74')](_0x2a065e[_0x65ec('0x45')][_0x65ec('0x6b')])){for(var _0x11e8fe=0x0;_0x11e8fe<_0x2a065e['query'][_0x65ec('0x6b')][_0x65ec('0x49')];_0x11e8fe+=0x1){socket[_0x65ec('0x75')](_0x65ec('0x76'),{'UserId':Number(_0x2a065e[_0x65ec('0x45')][_0x65ec('0x6b')][_0x11e8fe]),'WhatsappAccountId':Number(_0x2a065e[_0x65ec('0x58')]['id'])});}}else{socket[_0x65ec('0x75')]('userWhatsappAccount:remove',{'UserId':Number(_0x2a065e['query'][_0x65ec('0x6b')]),'WhatsappAccountId':Number(_0x2a065e[_0x65ec('0x58')]['id'])});}});}})[_0x65ec('0x1e')](respondWithStatusCode(_0x5ef5b8,null))['catch'](handleError(_0x5ef5b8,null));};exports[_0x65ec('0x77')]=function(_0x152af1,_0x41daf9,_0x50953a){var _0x437d98={};var _0x2e4efe={};var _0x49a6a2;var _0x4848cc;return db[_0x65ec('0x41')][_0x65ec('0x6f')]({'where':{'id':_0x152af1[_0x65ec('0x58')]['id']}})[_0x65ec('0x1e')](handleEntityNotFound(_0x41daf9,null))[_0x65ec('0x1e')](function(_0x4587ea){if(_0x4587ea){_0x49a6a2=_0x4587ea;_0x2e4efe[_0x65ec('0x44')]=_['keys'](db['User'][_0x65ec('0x5a')]);_0x2e4efe[_0x65ec('0x45')]=_[_0x65ec('0x59')](_0x152af1[_0x65ec('0x45')]);_0x2e4efe[_0x65ec('0x4e')]=_['intersection'](_0x2e4efe['model'],_0x2e4efe['query']);_0x437d98[_0x65ec('0x46')]=_[_0x65ec('0x47')](_0x2e4efe[_0x65ec('0x44')],qs[_0x65ec('0x48')](_0x152af1['query'][_0x65ec('0x48')]));_0x437d98[_0x65ec('0x46')]=_0x437d98[_0x65ec('0x46')][_0x65ec('0x49')]?_0x437d98[_0x65ec('0x46')]:_0x2e4efe[_0x65ec('0x44')];_0x437d98['order']=qs[_0x65ec('0x4d')](_0x152af1[_0x65ec('0x45')][_0x65ec('0x4d')]);_0x437d98[_0x65ec('0x50')]=qs[_0x65ec('0x4e')](_[_0x65ec('0x4f')](_0x152af1[_0x65ec('0x45')],_0x2e4efe['filters']));if(_0x152af1[_0x65ec('0x45')][_0x65ec('0x68')]){_0x437d98[_0x65ec('0x50')]=_[_0x65ec('0x51')](_0x437d98[_0x65ec('0x50')],{'$or':_['map'](_0x437d98[_0x65ec('0x46')],function(_0x561a3d){var _0x36af99={};_0x36af99[_0x561a3d]={'$like':'%'+_0x152af1[_0x65ec('0x45')][_0x65ec('0x68')]+'%'};return _0x36af99;})});}_0x437d98=_[_0x65ec('0x51')]({},_0x437d98,_0x152af1[_0x65ec('0x52')]);return _0x49a6a2['getAgents'](_0x437d98);}})[_0x65ec('0x1e')](function(_0x23878c){if(_0x23878c){_0x4848cc=_0x23878c[_0x65ec('0x49')];if(!_0x152af1[_0x65ec('0x45')][_0x65ec('0x4a')](_0x65ec('0x4b'))){_0x437d98[_0x65ec('0x30')]=qs[_0x65ec('0x30')](_0x152af1['query'][_0x65ec('0x30')]);_0x437d98[_0x65ec('0x2f')]=qs['offset'](_0x152af1['query'][_0x65ec('0x2f')]);}return _0x49a6a2['getAgents'](_0x437d98);}})[_0x65ec('0x1e')](function(_0x23afc6){if(_0x23afc6){return _0x23afc6?{'count':_0x4848cc,'rows':_0x23afc6}:null;}})[_0x65ec('0x1e')](respondWithResult(_0x41daf9,null))['catch'](handleError(_0x41daf9,null));};exports[_0x65ec('0x78')]=function(_0x297db5,_0x4786be,_0x2203a6){return db[_0x65ec('0x41')][_0x65ec('0x6f')]({'where':{'id':_0x297db5[_0x65ec('0x58')]['id']}})[_0x65ec('0x1e')](handleEntityNotFound(_0x4786be,null))[_0x65ec('0x1e')](function(_0x586546){if(_0x586546){return db[_0x65ec('0x79')]['transaction'](function(_0x30c1d3){return db[_0x65ec('0x7a')][_0x65ec('0x3a')]({'where':{'WhatsappAccountId':_0x297db5['params']['id']},'transaction':_0x30c1d3})['then'](function(_0x361aa1){var _0x50407d=_['map'](_0x297db5['body'],function(_0x43c177){_0x43c177['WhatsappAccountId']=_0x297db5[_0x65ec('0x58')]['id'];return _0x43c177;});return db[_0x65ec('0x7a')][_0x65ec('0x7b')](_0x50407d,{'transaction':_0x30c1d3});});})[_0x65ec('0x1e')](function(){return db['WhatsappApplication'][_0x65ec('0x7c')]({'where':{'WhatsappAccountId':_0x297db5[_0x65ec('0x58')]['id']},'order':'priority'});});}})[_0x65ec('0x1e')](respondWithResult(_0x4786be,null))['catch'](handleError(_0x4786be,null));};exports[_0x65ec('0x7d')]=function(_0x3bb9df,_0x211085,_0xd1f1d1){var _0x2f3855={};var _0x39e285={};var _0x2f70c3;var _0x39ddfa;return db[_0x65ec('0x41')]['findOne']({'where':{'id':_0x3bb9df[_0x65ec('0x58')]['id']}})[_0x65ec('0x1e')](handleEntityNotFound(_0x211085,null))[_0x65ec('0x1e')](function(_0x7bfdae){if(_0x7bfdae){_0x2f70c3=_0x7bfdae;_0x39e285['model']=_[_0x65ec('0x59')](db[_0x65ec('0x7a')][_0x65ec('0x5a')]);_0x39e285[_0x65ec('0x45')]=_[_0x65ec('0x59')](_0x3bb9df[_0x65ec('0x45')]);_0x39e285[_0x65ec('0x4e')]=_['intersection'](_0x39e285['model'],_0x39e285[_0x65ec('0x45')]);_0x2f3855[_0x65ec('0x46')]=_[_0x65ec('0x47')](_0x39e285[_0x65ec('0x44')],qs[_0x65ec('0x48')](_0x3bb9df[_0x65ec('0x45')][_0x65ec('0x48')]));_0x2f3855[_0x65ec('0x46')]=_0x2f3855[_0x65ec('0x46')]['length']?_0x2f3855[_0x65ec('0x46')]:_0x39e285[_0x65ec('0x44')];_0x2f3855[_0x65ec('0x4c')]=qs[_0x65ec('0x4d')](_0x3bb9df[_0x65ec('0x45')][_0x65ec('0x4d')]);_0x2f3855[_0x65ec('0x50')]=qs[_0x65ec('0x4e')](_['pick'](_0x3bb9df[_0x65ec('0x45')],_0x39e285['filters']));if(_0x3bb9df[_0x65ec('0x45')][_0x65ec('0x68')]){_0x2f3855[_0x65ec('0x50')]=_[_0x65ec('0x51')](_0x2f3855[_0x65ec('0x50')],{'$or':_[_0x65ec('0x40')](_0x2f3855[_0x65ec('0x46')],function(_0x1aa45c){var _0x133d19={};_0x133d19[_0x1aa45c]={'$like':'%'+_0x3bb9df[_0x65ec('0x45')][_0x65ec('0x68')]+'%'};return _0x133d19;})});}_0x2f3855=_[_0x65ec('0x51')]({},_0x2f3855,_0x3bb9df[_0x65ec('0x52')]);return _0x2f70c3[_0x65ec('0x7d')](_0x2f3855);}})[_0x65ec('0x1e')](function(_0xed5827){if(_0xed5827){_0x39ddfa=_0xed5827[_0x65ec('0x49')];if(!_0x3bb9df[_0x65ec('0x45')][_0x65ec('0x4a')](_0x65ec('0x4b'))){_0x2f3855[_0x65ec('0x30')]=qs[_0x65ec('0x30')](_0x3bb9df[_0x65ec('0x45')][_0x65ec('0x30')]);_0x2f3855['offset']=qs[_0x65ec('0x2f')](_0x3bb9df[_0x65ec('0x45')][_0x65ec('0x2f')]);}return _0x2f70c3[_0x65ec('0x7d')](_0x2f3855);}})[_0x65ec('0x1e')](function(_0xc2ad21){if(_0xc2ad21){return _0xc2ad21?{'count':_0x39ddfa,'rows':_0xc2ad21}:null;}})['then'](respondWithResult(_0x211085,null))[_0x65ec('0x29')](handleError(_0x211085,null));};exports[_0x65ec('0x7e')]=function(_0x2577d2,_0x5cb76d,_0x1b2340){var _0x120933={'channel':_0x65ec('0x7f')};var _0x4e5a41=[];var _0x1cdddf=[];var _0x326cc7={};return db[_0x65ec('0x41')]['find']({'where':{'id':_0x2577d2[_0x65ec('0x58')]['id']},'include':[{'model':db[_0x65ec('0x7a')],'as':'Applications'}]})[_0x65ec('0x1e')](handleEntityNotFound(_0x5cb76d,null))[_0x65ec('0x1e')](function(_0x25ecfc){_0x120933[_0x65ec('0x80')]=_0x25ecfc;_0x120933['applications']=_[_0x65ec('0x81')](_0x25ecfc['Applications'],[_0x65ec('0x82')],[_0x65ec('0x83')]);if(_0x120933[_0x65ec('0x80')][_0x65ec('0x84')]){delete _0x120933[_0x65ec('0x80')]['Applications'];}return db[_0x65ec('0x85')][_0x65ec('0x64')]();})[_0x65ec('0x1e')](function(_0x2f60cb){if(!_0x2f60cb){throw new db[(_0x65ec('0x1a'))][(_0x65ec('0x1b'))](_0x65ec('0x86'));}_0x4e5a41=_[_0x65ec('0x87')](_[_0x65ec('0x59')](_0x2f60cb),[_0x65ec('0x88'),_0x65ec('0x89')]);_0x1cdddf=_[_0x65ec('0x87')](_[_0x65ec('0x59')](_0x2f60cb),[_0x65ec('0x88'),_0x65ec('0x89'),_0x65ec('0x8a'),'ListId']);_0x120933['body']={'mapKey':'mobile'};if(_0x120933[_0x65ec('0x80')][_0x65ec('0x42')]&&_0x120933[_0x65ec('0x80')][_0x65ec('0x42')]===_0x65ec('0x8b')){_0x120933['body'][_0x65ec('0x8c')]=_0x2577d2['body'][_0x65ec('0x8d')]['replace'](_0x65ec('0x8e'),'');_0x120933['body'][_0x65ec('0x5d')]=_0x2577d2['body'][_0x65ec('0x8f')];_0x120933['body'][_0x65ec('0x90')]=_0x2577d2[_0x65ec('0x5d')]['MessageSid'];}if(_0x120933[_0x65ec('0x5d')]['id']){delete _0x120933[_0x65ec('0x5d')]['id'];}if(_[_0x65ec('0x91')](_0x120933[_0x65ec('0x5d')][_0x65ec('0x8c')])){throw new db[(_0x65ec('0x1a'))][(_0x65ec('0x1b'))](_0x65ec('0x92'));}if(_[_0x65ec('0x91')](_0x120933['body'][_0x65ec('0x5d')])||_0x120933[_0x65ec('0x5d')]['body']===''){throw new db['Sequelize'][(_0x65ec('0x1b'))](_0x65ec('0x93'));}if(_[_0x65ec('0x91')](_0x120933[_0x65ec('0x5d')]['mapKey'])){throw new db[(_0x65ec('0x1a'))][(_0x65ec('0x1b'))](_0x65ec('0x94')+_0x1cdddf);}if(!_[_0x65ec('0x95')](_0x1cdddf,_0x120933[_0x65ec('0x5d')][_0x65ec('0x96')])){throw new db[(_0x65ec('0x1a'))][(_0x65ec('0x1b'))](_0x65ec('0x97')+_0x1cdddf);}_0x326cc7[_0x120933[_0x65ec('0x5d')][_0x65ec('0x96')]]=_0x120933['body'][_0x65ec('0x8c')];return db[_0x65ec('0x98')][_0x65ec('0x5b')]({'where':{'id':_0x120933[_0x65ec('0x80')][_0x65ec('0x99')]},'include':[{'model':db[_0x65ec('0x85')],'as':_0x65ec('0x9a'),'where':_0x326cc7,'limit':0x1,'order':[[_0x65ec('0x89'),_0x65ec('0x9b')]]}]});})[_0x65ec('0x1e')](handleEntityNotFound(_0x5cb76d,null))[_0x65ec('0x1e')](function(_0x18991a){if(_0x18991a){_0x120933[_0x65ec('0x9c')]=_[_0x65ec('0x72')](_0x18991a,['Contacts']);if(_0x18991a[_0x65ec('0x9a')][_0x65ec('0x49')]){return _0x18991a[_0x65ec('0x9a')][0x0];}var _0x36cbef=_['defaults'](_0x120933['body'],{'firstName':_0x120933['body']['from'],'ListId':_0x18991a['id']});_0x36cbef[_0x120933[_0x65ec('0x5d')][_0x65ec('0x96')]]=_0x120933[_0x65ec('0x5d')][_0x65ec('0x8c')];return db['CmContact'][_0x65ec('0x5c')](_0x36cbef,{'fields':_0x4e5a41,'raw':!![]});}})['then'](handleEntityNotFound(_0x5cb76d,null))[_0x65ec('0x1e')](function(_0x4c7cbb){if(_0x4c7cbb){_0x120933[_0x65ec('0x9d')]=_0x4c7cbb;var _0x4da116={'ContactId':_0x4c7cbb['id'],'phone':_0x120933['body']['from'],'WhatsappAccountId':_0x2577d2['params']['id']};var _0x58bf37={'ContactId':_0x4c7cbb['id'],'WhatsappAccountId':_0x2577d2['params']['id'],'closed':![]};return db[_0x65ec('0x9e')][_0x65ec('0x5b')]({'where':_0x58bf37})[_0x65ec('0x1e')](function(_0x569650){if(_0x569650){return[_0x569650,![]];}return db[_0x65ec('0x9e')][_0x65ec('0x5c')](_0x4da116)['then'](function(_0x285b77){return[_0x285b77,!![]];});});}})[_0x65ec('0x9f')](function(_0x56b3e4,_0x5a1b64){_0x120933[_0x65ec('0xa0')]=_0x56b3e4[_0x65ec('0x37')]({'plain':!![]});_0x120933[_0x65ec('0xa0')][_0x65ec('0xa1')]=![];if(_0x5a1b64){if(_0x120933[_0x65ec('0x80')]['autoclose']){_0x120933[_0x65ec('0xa2')][_0x65ec('0xa3')]({'id':0x0,'priority':_0x120933['applications']['length']+0x1,'app':'close','appdata':'unmanaged','interval':_0x65ec('0xa4')});}_0x120933[_0x65ec('0xa0')][_0x65ec('0xa1')]=!![];}return db[_0x65ec('0xa5')][_0x65ec('0x5c')]({'phone':_0x120933[_0x65ec('0x5d')][_0x65ec('0x8c')],'messageId':_0x120933[_0x65ec('0x5d')][_0x65ec('0x90')],'body':_0x120933[_0x65ec('0x5d')][_0x65ec('0x5d')],'WhatsappAccountId':_0x2577d2[_0x65ec('0x58')]['id'],'WhatsappInteractionId':_0x56b3e4['id'],'direction':'in','ContactId':_0x56b3e4[_0x65ec('0xa6')],'AttachmentId':_0x120933[_0x65ec('0x5d')]['AttachmentId']});})[_0x65ec('0x1e')](function(_0x1e3b53){_0x120933[_0x65ec('0x27')]=_0x1e3b53;if(_0x120933[_0x65ec('0xa0')]['UserId']){return db[_0x65ec('0xa7')][_0x65ec('0x5b')]({'attributes':['id','name'],'where':{'id':_0x120933['interaction']['UserId']}})[_0x65ec('0x1e')](function(_0x27c361){if(_0x27c361){_0x120933[_0x65ec('0xa2')][_0x65ec('0xa8')]({'id':0x0,'priority':0x0,'app':_0x65ec('0xa9'),'appdata':_0x27c361['name']+','+(_0x120933[_0x65ec('0x80')][_0x65ec('0xaa')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x65ec('0xab'),_0x65ec('0xac'),_0x120933);});}return respondWithRpcPromise(_0x65ec('0xab'),_0x65ec('0xac'),_0x120933);})['then'](function(_0x886c4e){if(_0x886c4e){var _0x235157=0xc8;var _0x1ba87c=_0x65ec('0xad');logger[_0x65ec('0x1f')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x1ba87c,_0x235157,_0x65ec('0xae'));logger['debug'](_0x65ec('0xaf'),_0x1ba87c,_0x235157,_0x65ec('0xae'),JSON[_0x65ec('0x24')](_0x886c4e));if(_0x120933[_0x65ec('0x80')][_0x65ec('0x42')]===_0x65ec('0x8b')){return _0x5cb76d[_0x65ec('0x2c')](_0x235157)[_0x65ec('0x31')](_0x65ec('0xb0'),'text/xml')[_0x65ec('0xb1')](_0x65ec('0xb2'));}else{return _0x5cb76d[_0x65ec('0x2c')](_0x235157)[_0x65ec('0x2d')](_0x886c4e);}}})[_0x65ec('0x29')](handleError(_0x5cb76d,null));};exports['send']=function(_0x36381a,_0x5ac2b0,_0x2fa462){var _0x22528e,_0x1929c7,_0x3af098;if(_[_0x65ec('0x91')](_0x36381a[_0x65ec('0x5d')][_0x65ec('0x5d')])||_0x36381a['body'][_0x65ec('0x5d')]===''){throw new db[(_0x65ec('0x1a'))][(_0x65ec('0x1b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x65ec('0x91')](_0x36381a[_0x65ec('0x5d')]['to'])){throw new db[(_0x65ec('0x1a'))][(_0x65ec('0x1b'))](_0x65ec('0xb3'));}_0x22528e=_0x36381a['body']['to'];return db[_0x65ec('0x41')][_0x65ec('0x5b')]({'where':{'id':_0x36381a[_0x65ec('0x58')]['id']},'include':[{'model':db[_0x65ec('0x98')],'as':_0x65ec('0xb4'),'include':[{'model':db[_0x65ec('0x85')],'as':_0x65ec('0x9a'),'where':{'mobile':_0x22528e},'limit':0x1,'order':[[_0x65ec('0x89'),_0x65ec('0x9b')]]}]}]})[_0x65ec('0x1e')](handleEntityNotFound(_0x5ac2b0,null))['then'](function(_0x4998a){if(_0x4998a&&_0x4998a[_0x65ec('0xb4')]){_0x1929c7=_0x4998a[_0x65ec('0x37')]({'plain':!![]});if(_0x1929c7[_0x65ec('0xb4')]&&_0x1929c7[_0x65ec('0xb4')][_0x65ec('0x9a')]['length']){return _0x1929c7[_0x65ec('0xb4')]['Contacts'][0x0];}return db[_0x65ec('0x85')][_0x65ec('0x5c')](_[_0x65ec('0xb5')](_0x36381a[_0x65ec('0x5d')],{'firstName':_0x22528e,'mobile':_0x22528e,'phone':_0x22528e,'ListId':_0x1929c7[_0x65ec('0x99')]}));}})[_0x65ec('0x1e')](handleEntityNotFound(_0x5ac2b0,null))[_0x65ec('0x1e')](function(_0x205916){if(_0x205916){_0x3af098=_0x205916;return db[_0x65ec('0x9e')][_0x65ec('0x5b')]({'where':{'ContactId':_0x3af098['id'],'closed':![],'WhatsappAccountId':_0x1929c7['id']}})['then'](function(_0x1cb25d){if(_0x1cb25d){return[_0x1cb25d,![]];}return db[_0x65ec('0x9e')][_0x65ec('0x5c')]({'UserId':_0x36381a[_0x65ec('0x5e')]['id'],'ContactId':_0x3af098['id'],'WhatsappAccountId':_0x1929c7['id'],'phone':_0x22528e,'firstMsgDirection':_0x65ec('0xb6'),'Messages':[_['merge'](_0x36381a[_0x65ec('0x5d')],{'read':![],'body':_0x36381a[_0x65ec('0x5d')][_0x65ec('0x5d')],'phone':_0x22528e,'WhatsappAccountId':_0x1929c7['id'],'UserId':_0x36381a[_0x65ec('0x5e')]['id'],'ContactId':_0x3af098['id']})]},{'include':[{'model':db[_0x65ec('0xa5')],'as':_0x65ec('0xb7')}]})[_0x65ec('0x1e')](function(_0x422bd2){return[_0x422bd2,!![]];});});}})[_0x65ec('0x9f')](function(_0x506ccf,_0x16eded){if(_0x16eded){return _0x506ccf;}return db[_0x65ec('0xa5')]['create'](_[_0x65ec('0x51')](_0x36381a['body'],{'read':![],'body':_0x36381a[_0x65ec('0x5d')][_0x65ec('0x5d')],'phone':_0x22528e,'WhatsappAccountId':_0x1929c7['id'],'WhatsappInteractionId':_0x506ccf['id'],'UserId':_0x36381a[_0x65ec('0x5e')]['id'],'ContactId':_0x3af098['id']}))[_0x65ec('0x1e')](function(_0x566320){_0x506ccf[_0x65ec('0xb8')][_0x65ec('0xb7')]=[];_0x506ccf[_0x65ec('0xb8')][_0x65ec('0xb7')]['push'](_0x566320['dataValues']);return _0x506ccf;});})[_0x65ec('0x1e')](respondWithResult(_0x5ac2b0,null))['catch'](handleError(_0x5ac2b0,null));}; \ No newline at end of file +var _0x69d3=['includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','contact','WhatsappInteraction','interaction','created','autoclose','push','close','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','to\x20is\x20mandatory','List','Messages','dataValues','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','test','Sequelize','ValidationError','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','params','Pause','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappAccounts','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','WhatsappAccountId','Disposition','create','getDispositions','findOne','order','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','removeAgents','isArray','emit','userWhatsappAccount:remove','User','getAgents','addApplications','sequelize','transaction','bulkCreate','WhatsappApplication','priority','getApplications','whatsapp','Applications','account','applications','asc','CmContact','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','mobile','from','From','replace','Body','messageId','MessageSid','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'];(function(_0x493a51,_0x45128c){var _0xc85756=function(_0x2c39a8){while(--_0x2c39a8){_0x493a51['push'](_0x493a51['shift']());}};_0xc85756(++_0x45128c);}(_0x69d3,0xda));var _0x369d=function(_0x46b9d5,_0x3fa62b){_0x46b9d5=_0x46b9d5-0x0;var _0x4c593d=_0x69d3[_0x46b9d5];return _0x4c593d;};'use strict';var pdf=require(_0x369d('0x0'));var emlformat=require(_0x369d('0x1'));var rimraf=require(_0x369d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x369d('0x3'));var rp=require(_0x369d('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x369d('0x5'));var util=require('util');var path=require('path');var sox=require(_0x369d('0x6'));var csv=require(_0x369d('0x7'));var ejs=require(_0x369d('0x8'));var fs=require('fs');var _=require(_0x369d('0x9'));var squel=require(_0x369d('0xa'));var crypto=require(_0x369d('0xb'));var jsforce=require(_0x369d('0xc'));var deskjs=require(_0x369d('0xd'));var toCsv=require(_0x369d('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x369d('0xe'));var authService=require(_0x369d('0xf'));var qs=require(_0x369d('0x10'));var as=require(_0x369d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x369d('0x12'));var utils=require(_0x369d('0x13'));var config=require(_0x369d('0x14'));var db=require(_0x369d('0x15'))['db'];config[_0x369d('0x16')]=_[_0x369d('0x17')](config['redis'],{'host':_0x369d('0x18'),'port':0x18eb});var socket=require(_0x369d('0x19'))(new Redis(config[_0x369d('0x16')]));require(_0x369d('0x1a'))[_0x369d('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});function checkPasswordPattern(_0x2dcc39,_0xa126c1,_0x389c43){if(_0x389c43){var _0x5b4f55=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5b4f55[_0x369d('0x1c')](_0xa126c1)){return _0x2dcc39;}else{throw new db[(_0x369d('0x1d'))][(_0x369d('0x1e'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x2dcc39;}}function respondWithRpcPromise(_0x368c05,_0x1f37ff,_0x4ea6c2,_0x572513){return new BPromise(function(_0x597b67,_0x2946be){var _0x4494b3=_0x572513||client;return _0x4494b3[_0x369d('0x1f')](_0x368c05,_0x4ea6c2)['then'](function(_0x410dbe){logger[_0x369d('0x20')](_0x369d('0x21'),_0x1f37ff,_0x369d('0x22'));logger[_0x369d('0x23')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x1f37ff,_0x369d('0x22'),JSON[_0x369d('0x24')](_0x410dbe));if(_0x410dbe[_0x369d('0x25')]){if(_0x410dbe[_0x369d('0x25')][_0x369d('0x26')]===0x1f4){logger[_0x369d('0x25')](_0x369d('0x21'),_0x1f37ff,_0x410dbe[_0x369d('0x25')]['message']);return _0x2946be(_0x410dbe['error'][_0x369d('0x27')]);}logger[_0x369d('0x25')](_0x369d('0x21'),_0x1f37ff,_0x410dbe[_0x369d('0x25')][_0x369d('0x27')]);return _0x597b67(_0x410dbe[_0x369d('0x25')][_0x369d('0x27')]);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x1f37ff,_0x369d('0x22'));_0x597b67(_0x410dbe[_0x369d('0x28')][_0x369d('0x27')]);}})[_0x369d('0x29')](function(_0x8aa521){logger[_0x369d('0x25')](_0x369d('0x21'),_0x1f37ff,_0x8aa521);_0x2946be(_0x8aa521);});});}function respondWithStatusCode(_0x570db4,_0x23656b){_0x23656b=_0x23656b||0xcc;return function(_0xe95742){if(_0xe95742){return _0x570db4[_0x369d('0x2a')](_0x23656b);}return _0x570db4[_0x369d('0x2b')](_0x23656b)[_0x369d('0x2c')]();};}function respondWithResult(_0x41367a,_0x3d1ce0){_0x3d1ce0=_0x3d1ce0||0xc8;return function(_0x4d42ea){if(_0x4d42ea){return _0x41367a[_0x369d('0x2b')](_0x3d1ce0)['json'](_0x4d42ea);}};}function respondWithFilteredResult(_0x57b94c,_0x38feda){return function(_0x1151b3){if(_0x1151b3){var _0x5844c7=_0x1151b3[_0x369d('0x2d')],_0x104540=_0x38feda[_0x369d('0x2e')],_0x5a14ce=_0x38feda[_0x369d('0x2e')]+_0x38feda[_0x369d('0x2f')],_0x37274f;if(_0x5a14ce>=_0x5844c7){_0x5a14ce=_0x5844c7;_0x37274f=0xc8;}else{_0x37274f=0xce;}_0x57b94c[_0x369d('0x2b')](_0x37274f);return _0x57b94c[_0x369d('0x30')]('Content-Range',_0x104540+'-'+_0x5a14ce+'/'+_0x5844c7)[_0x369d('0x31')](_0x1151b3);}return null;};}function patchUpdates(_0xecd4d0){return function(_0x219faf){try{jsonpatch[_0x369d('0x32')](_0x219faf,_0xecd4d0,!![]);}catch(_0x40f5c4){return BPromise[_0x369d('0x33')](_0x40f5c4);}return _0x219faf[_0x369d('0x34')]();};}function saveUpdates(_0xbb8401,_0x4ac9d5){return function(_0x128703){if(_0x128703){return _0x128703[_0x369d('0x35')](_0xbb8401)[_0x369d('0x36')](function(_0x1b4453){return _0x1b4453;});}return null;};}function removeEntity(_0x32a057,_0x54ce2b){return function(_0x35f326){if(_0x35f326){return _0x35f326[_0x369d('0x37')]()[_0x369d('0x36')](function(){var _0x3a0277=_0x35f326[_0x369d('0x38')]({'plain':!![]});var _0x3e6c14='WhatsappAccounts';return db[_0x369d('0x39')][_0x369d('0x37')]({'where':{'type':_0x3e6c14,'resourceId':_0x3a0277['id']}})[_0x369d('0x36')](function(){return _0x35f326;});})[_0x369d('0x36')](function(){_0x32a057[_0x369d('0x2b')](0xcc)[_0x369d('0x2c')]();});}};}function handleEntityNotFound(_0xfa13da,_0x22c498){return function(_0x1cf374){if(!_0x1cf374){_0xfa13da[_0x369d('0x2a')](0x194);}return _0x1cf374;};}function handleError(_0xddb3c1,_0x1edb38){_0x1edb38=_0x1edb38||0x1f4;return function(_0x2374b5){logger[_0x369d('0x25')](_0x2374b5[_0x369d('0x3a')]);if(_0x2374b5[_0x369d('0x3b')]){delete _0x2374b5[_0x369d('0x3b')];}_0xddb3c1[_0x369d('0x2b')](_0x1edb38)[_0x369d('0x3c')](_0x2374b5);};}exports[_0x369d('0x3d')]=function(_0x10c5b6,_0x305dea){var _0xb7837f={'include':[{'model':db['Pause'],'as':_0x369d('0x3e')}]},_0xd58366={},_0x4c09ff={'count':0x0,'rows':[]};var _0x319e5d=_[_0x369d('0x3f')](db[_0x369d('0x40')][_0x369d('0x41')],function(_0x1775ed){return{'name':_0x1775ed[_0x369d('0x42')],'type':_0x1775ed[_0x369d('0x43')][_0x369d('0x44')]};});_0xd58366['model']=_[_0x369d('0x3f')](_0x319e5d,_0x369d('0x3b'));_0xd58366[_0x369d('0x45')]=_[_0x369d('0x46')](_0x10c5b6[_0x369d('0x45')]);_0xd58366[_0x369d('0x47')]=_[_0x369d('0x48')](_0xd58366[_0x369d('0x49')],_0xd58366['query']);_0xb7837f['attributes']=_[_0x369d('0x48')](_0xd58366[_0x369d('0x49')],qs[_0x369d('0x4a')](_0x10c5b6['query']['fields']));_0xb7837f['attributes']=_0xb7837f[_0x369d('0x4b')][_0x369d('0x4c')]?_0xb7837f['attributes']:_0xd58366[_0x369d('0x49')];if(!_0x10c5b6[_0x369d('0x45')][_0x369d('0x4d')](_0x369d('0x4e'))){_0xb7837f['limit']=qs[_0x369d('0x2f')](_0x10c5b6['query'][_0x369d('0x2f')]);_0xb7837f['offset']=qs[_0x369d('0x2e')](_0x10c5b6[_0x369d('0x45')][_0x369d('0x2e')]);}_0xb7837f['order']=qs['sort'](_0x10c5b6[_0x369d('0x45')][_0x369d('0x4f')]);_0xb7837f[_0x369d('0x50')]=qs['filters'](_[_0x369d('0x51')](_0x10c5b6[_0x369d('0x45')],_0xd58366[_0x369d('0x47')]),_0x319e5d);if(_0x10c5b6[_0x369d('0x45')][_0x369d('0x52')]){_0xb7837f[_0x369d('0x50')]=_[_0x369d('0x53')](_0xb7837f[_0x369d('0x50')],{'$or':_[_0x369d('0x3f')](_0x319e5d,function(_0x4873a9){if(_0x4873a9[_0x369d('0x43')]!==_0x369d('0x54')){var _0xcc1465={};_0xcc1465[_0x4873a9[_0x369d('0x3b')]]={'$like':'%'+_0x10c5b6[_0x369d('0x45')][_0x369d('0x52')]+'%'};return _0xcc1465;}})});}_0xb7837f=_['merge']({},_0xb7837f,_0x10c5b6[_0x369d('0x55')]);var _0xa77af={'where':_0xb7837f[_0x369d('0x50')]};return db[_0x369d('0x40')][_0x369d('0x2d')](_0xa77af)[_0x369d('0x36')](function(_0x8a0406){_0x4c09ff[_0x369d('0x2d')]=_0x8a0406;if(_0x10c5b6[_0x369d('0x45')][_0x369d('0x56')]){_0xb7837f[_0x369d('0x57')]=[{'all':!![]}];}return db[_0x369d('0x40')]['findAll'](_0xb7837f);})[_0x369d('0x36')](function(_0x20d154){_0x4c09ff[_0x369d('0x58')]=_0x20d154;return _0x4c09ff;})[_0x369d('0x36')](respondWithFilteredResult(_0x305dea,_0xb7837f))[_0x369d('0x29')](handleError(_0x305dea,null));};exports['show']=function(_0x2d811b,_0x4c1a5b){var _0x103e9e={'raw':![],'where':{'id':_0x2d811b[_0x369d('0x59')]['id']},'include':[{'model':db[_0x369d('0x5a')],'as':_0x369d('0x3e')}]},_0x2709f7={};_0x2709f7[_0x369d('0x49')]=_[_0x369d('0x46')](db[_0x369d('0x40')][_0x369d('0x41')]);_0x2709f7[_0x369d('0x45')]=_['keys'](_0x2d811b['query']);_0x2709f7[_0x369d('0x47')]=_[_0x369d('0x48')](_0x2709f7[_0x369d('0x49')],_0x2709f7[_0x369d('0x45')]);_0x103e9e[_0x369d('0x4b')]=_['intersection'](_0x2709f7['model'],qs[_0x369d('0x4a')](_0x2d811b[_0x369d('0x45')]['fields']));_0x103e9e[_0x369d('0x4b')]=_0x103e9e['attributes'][_0x369d('0x4c')]?_0x103e9e[_0x369d('0x4b')]:_0x2709f7[_0x369d('0x49')];if(_0x2d811b['query'][_0x369d('0x56')]){_0x103e9e[_0x369d('0x57')]=[{'all':!![]}];}_0x103e9e=_[_0x369d('0x53')]({},_0x103e9e,_0x2d811b[_0x369d('0x55')]);return db['WhatsappAccount']['find'](_0x103e9e)[_0x369d('0x36')](handleEntityNotFound(_0x4c1a5b,null))[_0x369d('0x36')](respondWithResult(_0x4c1a5b,null))[_0x369d('0x29')](handleError(_0x4c1a5b,null));};exports['create']=function(_0x43afd7,_0x2dbbee){return db[_0x369d('0x40')]['create'](_0x43afd7['body'],{})[_0x369d('0x36')](function(_0x36e479){var _0x185242=_0x43afd7[_0x369d('0x5b')]['get']({'plain':!![]});if(!_0x185242)throw new Error(_0x369d('0x5c'));if(_0x185242[_0x369d('0x5d')]===_0x369d('0x5b')){var _0x1bc070=_0x36e479[_0x369d('0x38')]({'plain':!![]});var _0x50af03=_0x369d('0x5e');return db[_0x369d('0x5f')][_0x369d('0x60')]({'where':{'name':_0x50af03,'userProfileId':_0x185242['userProfileId']},'raw':!![]})[_0x369d('0x36')](function(_0x4ba127){if(_0x4ba127&&_0x4ba127[_0x369d('0x61')]===0x0){return db['UserProfileResource']['create']({'name':_0x1bc070['name'],'resourceId':_0x1bc070['id'],'type':_0x4ba127['name'],'sectionId':_0x4ba127['id']},{})[_0x369d('0x36')](function(){return _0x36e479;});}else{return _0x36e479;}})['catch'](function(_0x2f92b3){logger['error'](_0x369d('0x62'),_0x2f92b3);throw _0x2f92b3;});}return _0x36e479;})[_0x369d('0x36')](respondWithResult(_0x2dbbee,0xc9))[_0x369d('0x29')](handleError(_0x2dbbee,null));};exports['update']=function(_0x355043,_0x1895c1){if(_0x355043[_0x369d('0x63')]['id']){delete _0x355043[_0x369d('0x63')]['id'];}return db[_0x369d('0x40')][_0x369d('0x60')]({'where':{'id':_0x355043['params']['id']},'include':[{'model':db[_0x369d('0x5a')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x1895c1,null))['then'](saveUpdates(_0x355043[_0x369d('0x63')],null))[_0x369d('0x36')](respondWithResult(_0x1895c1,null))[_0x369d('0x29')](handleError(_0x1895c1,null));};exports[_0x369d('0x37')]=function(_0x17333d,_0x326657){return db[_0x369d('0x40')][_0x369d('0x60')]({'where':{'id':_0x17333d[_0x369d('0x59')]['id']}})[_0x369d('0x36')](handleEntityNotFound(_0x326657,null))[_0x369d('0x36')](removeEntity(_0x326657,null))[_0x369d('0x29')](handleError(_0x326657,null));};exports[_0x369d('0x64')]=function(_0x7ba3e5,_0x1440bb){return db[_0x369d('0x40')]['describe']()[_0x369d('0x36')](respondWithResult(_0x1440bb,null))['catch'](handleError(_0x1440bb,null));};exports[_0x369d('0x65')]=function(_0x2ecc06,_0x2492fb,_0x38efd7){if(_0x2ecc06[_0x369d('0x63')]['id']){delete _0x2ecc06['body']['id'];}return db[_0x369d('0x40')]['find']({'where':{'id':_0x2ecc06['params']['id']}})[_0x369d('0x36')](handleEntityNotFound(_0x2492fb,null))[_0x369d('0x36')](function(_0x373368){if(_0x373368){_0x2ecc06[_0x369d('0x63')][_0x369d('0x66')]=_0x373368['id'];return db[_0x369d('0x67')][_0x369d('0x68')](_0x2ecc06[_0x369d('0x63')]);}})['then'](respondWithResult(_0x2492fb,null))[_0x369d('0x29')](handleError(_0x2492fb,null));};exports[_0x369d('0x69')]=function(_0x4c741d,_0x2ef007,_0x37075c){var _0x41e4a2={'raw':![],'where':{}};var _0x59fecc={};var _0x320977={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x369d('0x6a')]({'where':{'id':_0x4c741d[_0x369d('0x59')]['id']}})[_0x369d('0x36')](handleEntityNotFound(_0x2ef007,null))[_0x369d('0x36')](function(_0xb768bd){if(_0xb768bd){_0x59fecc[_0x369d('0x49')]=_[_0x369d('0x46')](db['Disposition'][_0x369d('0x41')]);_0x59fecc[_0x369d('0x45')]=_['keys'](_0x4c741d[_0x369d('0x45')]);_0x59fecc['filters']=_[_0x369d('0x48')](_0x59fecc[_0x369d('0x49')],_0x59fecc[_0x369d('0x45')]);_0x41e4a2['attributes']=_[_0x369d('0x48')](_0x59fecc[_0x369d('0x49')],qs['fields'](_0x4c741d[_0x369d('0x45')][_0x369d('0x4a')]));_0x41e4a2[_0x369d('0x4b')]=_0x41e4a2['attributes'][_0x369d('0x4c')]?_0x41e4a2[_0x369d('0x4b')]:_0x59fecc[_0x369d('0x49')];if(!_0x4c741d[_0x369d('0x45')][_0x369d('0x4d')]('nolimit')){_0x41e4a2[_0x369d('0x2f')]=qs[_0x369d('0x2f')](_0x4c741d[_0x369d('0x45')][_0x369d('0x2f')]);_0x41e4a2[_0x369d('0x2e')]=qs['offset'](_0x4c741d['query'][_0x369d('0x2e')]);}_0x41e4a2[_0x369d('0x6b')]=qs[_0x369d('0x4f')](_0x4c741d[_0x369d('0x45')][_0x369d('0x4f')]);_0x41e4a2[_0x369d('0x50')]=qs['filters'](_[_0x369d('0x51')](_0x4c741d[_0x369d('0x45')],_0x59fecc['filters']));_0x41e4a2[_0x369d('0x50')]['WhatsappAccountId']=_0xb768bd['id'];if(_0x4c741d[_0x369d('0x45')]['filter']){_0x41e4a2[_0x369d('0x50')]=_[_0x369d('0x53')](_0x41e4a2['where'],{'$or':_[_0x369d('0x3f')](_0x41e4a2['attributes'],function(_0x26faf4){var _0x5de3f6={};_0x5de3f6[_0x26faf4]={'$like':'%'+_0x4c741d['query'][_0x369d('0x52')]+'%'};return _0x5de3f6;})});}_0x41e4a2=_[_0x369d('0x53')]({},_0x41e4a2,_0x4c741d[_0x369d('0x55')]);return db[_0x369d('0x67')][_0x369d('0x2d')]({'where':_0x41e4a2['where']})[_0x369d('0x36')](function(_0xaff7cc){_0x320977[_0x369d('0x2d')]=_0xaff7cc;if(_0x4c741d[_0x369d('0x45')][_0x369d('0x56')]){_0x41e4a2[_0x369d('0x57')]=[{'all':!![]}];}return db[_0x369d('0x67')][_0x369d('0x6c')](_0x41e4a2);})[_0x369d('0x36')](function(_0x5118b8){_0x320977[_0x369d('0x58')]=_0x5118b8;return _0x320977;});}})[_0x369d('0x36')](respondWithFilteredResult(_0x2ef007,_0x41e4a2))[_0x369d('0x29')](handleError(_0x2ef007,null));};exports[_0x369d('0x6d')]=function(_0x5727cd,_0x2d69c1,_0x528c40){return db[_0x369d('0x40')][_0x369d('0x60')]({'where':{'id':_0x5727cd[_0x369d('0x59')]['id']}})[_0x369d('0x36')](handleEntityNotFound(_0x2d69c1,null))[_0x369d('0x36')](function(_0x401f3b){if(_0x401f3b){return _0x401f3b[_0x369d('0x6d')](_0x5727cd[_0x369d('0x45')][_0x369d('0x6e')]);}})[_0x369d('0x36')](respondWithStatusCode(_0x2d69c1,null))[_0x369d('0x29')](handleError(_0x2d69c1,null));};exports[_0x369d('0x6f')]=function(_0x2030e1,_0x196a55,_0x5dee6e){if(_0x2030e1[_0x369d('0x63')]['id']){delete _0x2030e1['body']['id'];}return db['WhatsappAccount'][_0x369d('0x60')]({'where':{'id':_0x2030e1[_0x369d('0x59')]['id']}})[_0x369d('0x36')](handleEntityNotFound(_0x196a55,null))[_0x369d('0x36')](function(_0x147905){if(_0x147905){_0x2030e1[_0x369d('0x63')][_0x369d('0x66')]=_0x147905['id'];return db[_0x369d('0x70')][_0x369d('0x68')](_0x2030e1[_0x369d('0x63')]);}})[_0x369d('0x36')](respondWithResult(_0x196a55,null))[_0x369d('0x29')](handleError(_0x196a55,null));};exports[_0x369d('0x71')]=function(_0x1282c9,_0x3d7f75,_0x289d07){var _0xa3e58e={'raw':![],'where':{}};var _0xf7122a={};var _0x3277fe={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x369d('0x6a')]({'where':{'id':_0x1282c9['params']['id']}})[_0x369d('0x36')](handleEntityNotFound(_0x3d7f75,null))['then'](function(_0x4503bc){if(_0x4503bc){_0xf7122a[_0x369d('0x49')]=_['keys'](db[_0x369d('0x70')][_0x369d('0x41')]);_0xf7122a[_0x369d('0x45')]=_[_0x369d('0x46')](_0x1282c9[_0x369d('0x45')]);_0xf7122a['filters']=_['intersection'](_0xf7122a[_0x369d('0x49')],_0xf7122a[_0x369d('0x45')]);_0xa3e58e[_0x369d('0x4b')]=_[_0x369d('0x48')](_0xf7122a[_0x369d('0x49')],qs[_0x369d('0x4a')](_0x1282c9[_0x369d('0x45')][_0x369d('0x4a')]));_0xa3e58e[_0x369d('0x4b')]=_0xa3e58e[_0x369d('0x4b')]['length']?_0xa3e58e[_0x369d('0x4b')]:_0xf7122a['model'];if(!_0x1282c9[_0x369d('0x45')]['hasOwnProperty'](_0x369d('0x4e'))){_0xa3e58e[_0x369d('0x2f')]=qs['limit'](_0x1282c9[_0x369d('0x45')][_0x369d('0x2f')]);_0xa3e58e[_0x369d('0x2e')]=qs[_0x369d('0x2e')](_0x1282c9[_0x369d('0x45')]['offset']);}_0xa3e58e[_0x369d('0x6b')]=qs[_0x369d('0x4f')](_0x1282c9['query']['sort']);_0xa3e58e[_0x369d('0x50')]=qs[_0x369d('0x47')](_[_0x369d('0x51')](_0x1282c9['query'],_0xf7122a[_0x369d('0x47')]));_0xa3e58e['where'][_0x369d('0x66')]=_0x4503bc['id'];if(_0x1282c9['query'][_0x369d('0x52')]){_0xa3e58e[_0x369d('0x50')]=_[_0x369d('0x53')](_0xa3e58e[_0x369d('0x50')],{'$or':_[_0x369d('0x3f')](_0xa3e58e['attributes'],function(_0x162515){var _0x2a1467={};_0x2a1467[_0x162515]={'$like':'%'+_0x1282c9['query'][_0x369d('0x52')]+'%'};return _0x2a1467;})});}_0xa3e58e=_[_0x369d('0x53')]({},_0xa3e58e,_0x1282c9['options']);return db[_0x369d('0x70')][_0x369d('0x2d')]({'where':_0xa3e58e[_0x369d('0x50')]})[_0x369d('0x36')](function(_0x24f4da){_0x3277fe[_0x369d('0x2d')]=_0x24f4da;if(_0x1282c9['query'][_0x369d('0x56')]){_0xa3e58e[_0x369d('0x57')]=[{'all':!![]}];}return db[_0x369d('0x70')][_0x369d('0x6c')](_0xa3e58e);})[_0x369d('0x36')](function(_0xb753d5){_0x3277fe['rows']=_0xb753d5;return _0x3277fe;});}})[_0x369d('0x36')](respondWithFilteredResult(_0x3d7f75,_0xa3e58e))[_0x369d('0x29')](handleError(_0x3d7f75,null));};exports[_0x369d('0x72')]=function(_0x31b71f,_0x28f2d2,_0x53e840){return db['WhatsappAccount']['find']({'where':{'id':_0x31b71f['params']['id']}})[_0x369d('0x36')](handleEntityNotFound(_0x28f2d2,null))[_0x369d('0x36')](function(_0x846189){if(_0x846189){return _0x846189[_0x369d('0x72')](_0x31b71f[_0x369d('0x45')]['ids']);}})[_0x369d('0x36')](respondWithStatusCode(_0x28f2d2,null))['catch'](handleError(_0x28f2d2,null));};exports[_0x369d('0x73')]=function(_0x230352,_0x5dd1d2,_0x5edb81){return db[_0x369d('0x40')][_0x369d('0x60')]({'where':{'id':_0x230352[_0x369d('0x59')]['id']}})[_0x369d('0x36')](handleEntityNotFound(_0x5dd1d2,null))['then'](function(_0x2c1595){if(_0x2c1595){return _0x2c1595['addAgents'](_0x230352['body'][_0x369d('0x6e')],_[_0x369d('0x74')](_0x230352['body'],['ids','id'])||{})[_0x369d('0x75')](function(_0x3e2c11){for(var _0x23d402=0x0;_0x23d402<_0x230352['body'][_0x369d('0x6e')][_0x369d('0x4c')];_0x23d402+=0x1){socket['emit']('userWhatsappAccount:save',{'UserId':_0x230352[_0x369d('0x63')]['ids'][_0x23d402],'WhatsappAccountId':_0x230352['params']['id']});}return _0x3e2c11;});}})['then'](respondWithResult(_0x5dd1d2,null))[_0x369d('0x29')](handleError(_0x5dd1d2,null));};exports['removeAgents']=function(_0x695734,_0x178c16,_0x9cc59c){return db[_0x369d('0x40')]['find']({'where':{'id':_0x695734['params']['id']}})['then'](handleEntityNotFound(_0x178c16,null))[_0x369d('0x36')](function(_0x582956){if(_0x582956){return _0x582956[_0x369d('0x76')](_0x695734[_0x369d('0x45')][_0x369d('0x6e')])[_0x369d('0x36')](function(){if(_[_0x369d('0x77')](_0x695734['query'][_0x369d('0x6e')])){for(var _0x1897da=0x0;_0x1897da<_0x695734[_0x369d('0x45')][_0x369d('0x6e')][_0x369d('0x4c')];_0x1897da+=0x1){socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x695734['query'][_0x369d('0x6e')][_0x1897da]),'WhatsappAccountId':Number(_0x695734[_0x369d('0x59')]['id'])});}}else{socket[_0x369d('0x78')](_0x369d('0x79'),{'UserId':Number(_0x695734[_0x369d('0x45')][_0x369d('0x6e')]),'WhatsappAccountId':Number(_0x695734['params']['id'])});}});}})[_0x369d('0x36')](respondWithStatusCode(_0x178c16,null))['catch'](handleError(_0x178c16,null));};exports['getAgents']=function(_0x174710,_0x54228f,_0xbd2c82){var _0x406c47={};var _0x42ed6e={};var _0x19534b;var _0xd4bcc9;return db['WhatsappAccount'][_0x369d('0x6a')]({'where':{'id':_0x174710['params']['id']}})[_0x369d('0x36')](handleEntityNotFound(_0x54228f,null))['then'](function(_0x37275e){if(_0x37275e){_0x19534b=_0x37275e;_0x42ed6e[_0x369d('0x49')]=_[_0x369d('0x46')](db[_0x369d('0x7a')]['rawAttributes']);_0x42ed6e[_0x369d('0x45')]=_['keys'](_0x174710[_0x369d('0x45')]);_0x42ed6e[_0x369d('0x47')]=_[_0x369d('0x48')](_0x42ed6e[_0x369d('0x49')],_0x42ed6e[_0x369d('0x45')]);_0x406c47[_0x369d('0x4b')]=_[_0x369d('0x48')](_0x42ed6e[_0x369d('0x49')],qs[_0x369d('0x4a')](_0x174710['query']['fields']));_0x406c47[_0x369d('0x4b')]=_0x406c47['attributes'][_0x369d('0x4c')]?_0x406c47[_0x369d('0x4b')]:_0x42ed6e[_0x369d('0x49')];_0x406c47[_0x369d('0x6b')]=qs[_0x369d('0x4f')](_0x174710['query'][_0x369d('0x4f')]);_0x406c47[_0x369d('0x50')]=qs[_0x369d('0x47')](_['pick'](_0x174710[_0x369d('0x45')],_0x42ed6e['filters']));if(_0x174710[_0x369d('0x45')]['filter']){_0x406c47['where']=_[_0x369d('0x53')](_0x406c47[_0x369d('0x50')],{'$or':_['map'](_0x406c47['attributes'],function(_0x1ed603){var _0x251633={};_0x251633[_0x1ed603]={'$like':'%'+_0x174710[_0x369d('0x45')]['filter']+'%'};return _0x251633;})});}_0x406c47=_[_0x369d('0x53')]({},_0x406c47,_0x174710['options']);return _0x19534b[_0x369d('0x7b')](_0x406c47);}})['then'](function(_0x2124da){if(_0x2124da){_0xd4bcc9=_0x2124da[_0x369d('0x4c')];if(!_0x174710[_0x369d('0x45')]['hasOwnProperty'](_0x369d('0x4e'))){_0x406c47['limit']=qs['limit'](_0x174710['query']['limit']);_0x406c47['offset']=qs[_0x369d('0x2e')](_0x174710['query'][_0x369d('0x2e')]);}return _0x19534b['getAgents'](_0x406c47);}})['then'](function(_0x87bf74){if(_0x87bf74){return _0x87bf74?{'count':_0xd4bcc9,'rows':_0x87bf74}:null;}})['then'](respondWithResult(_0x54228f,null))[_0x369d('0x29')](handleError(_0x54228f,null));};exports[_0x369d('0x7c')]=function(_0x4296c0,_0x12eae4,_0x390bcd){return db['WhatsappAccount'][_0x369d('0x6a')]({'where':{'id':_0x4296c0[_0x369d('0x59')]['id']}})['then'](handleEntityNotFound(_0x12eae4,null))[_0x369d('0x36')](function(_0x2244cb){if(_0x2244cb){return db[_0x369d('0x7d')][_0x369d('0x7e')](function(_0x3a0283){return db['WhatsappApplication']['destroy']({'where':{'WhatsappAccountId':_0x4296c0[_0x369d('0x59')]['id']},'transaction':_0x3a0283})['then'](function(_0x17812b){var _0x5e6179=_['map'](_0x4296c0[_0x369d('0x63')],function(_0x2dc386){_0x2dc386['WhatsappAccountId']=_0x4296c0['params']['id'];return _0x2dc386;});return db['WhatsappApplication'][_0x369d('0x7f')](_0x5e6179,{'transaction':_0x3a0283});});})[_0x369d('0x36')](function(){return db[_0x369d('0x80')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x4296c0[_0x369d('0x59')]['id']},'order':_0x369d('0x81')});});}})[_0x369d('0x36')](respondWithResult(_0x12eae4,null))['catch'](handleError(_0x12eae4,null));};exports['getApplications']=function(_0x334de8,_0x1733a3,_0x2e5ba2){var _0x138690={};var _0x816301={};var _0x4c9707;var _0x32d567;return db[_0x369d('0x40')][_0x369d('0x6a')]({'where':{'id':_0x334de8['params']['id']}})['then'](handleEntityNotFound(_0x1733a3,null))[_0x369d('0x36')](function(_0x2a31f3){if(_0x2a31f3){_0x4c9707=_0x2a31f3;_0x816301['model']=_[_0x369d('0x46')](db['WhatsappApplication'][_0x369d('0x41')]);_0x816301['query']=_[_0x369d('0x46')](_0x334de8['query']);_0x816301[_0x369d('0x47')]=_[_0x369d('0x48')](_0x816301['model'],_0x816301[_0x369d('0x45')]);_0x138690[_0x369d('0x4b')]=_[_0x369d('0x48')](_0x816301[_0x369d('0x49')],qs[_0x369d('0x4a')](_0x334de8[_0x369d('0x45')][_0x369d('0x4a')]));_0x138690[_0x369d('0x4b')]=_0x138690[_0x369d('0x4b')][_0x369d('0x4c')]?_0x138690['attributes']:_0x816301[_0x369d('0x49')];_0x138690['order']=qs[_0x369d('0x4f')](_0x334de8[_0x369d('0x45')]['sort']);_0x138690['where']=qs['filters'](_[_0x369d('0x51')](_0x334de8[_0x369d('0x45')],_0x816301['filters']));if(_0x334de8[_0x369d('0x45')][_0x369d('0x52')]){_0x138690['where']=_[_0x369d('0x53')](_0x138690[_0x369d('0x50')],{'$or':_[_0x369d('0x3f')](_0x138690['attributes'],function(_0x391a45){var _0x4d0fd4={};_0x4d0fd4[_0x391a45]={'$like':'%'+_0x334de8[_0x369d('0x45')][_0x369d('0x52')]+'%'};return _0x4d0fd4;})});}_0x138690=_[_0x369d('0x53')]({},_0x138690,_0x334de8[_0x369d('0x55')]);return _0x4c9707[_0x369d('0x82')](_0x138690);}})[_0x369d('0x36')](function(_0x1dc92f){if(_0x1dc92f){_0x32d567=_0x1dc92f[_0x369d('0x4c')];if(!_0x334de8[_0x369d('0x45')][_0x369d('0x4d')]('nolimit')){_0x138690[_0x369d('0x2f')]=qs[_0x369d('0x2f')](_0x334de8[_0x369d('0x45')][_0x369d('0x2f')]);_0x138690[_0x369d('0x2e')]=qs[_0x369d('0x2e')](_0x334de8['query'][_0x369d('0x2e')]);}return _0x4c9707[_0x369d('0x82')](_0x138690);}})['then'](function(_0x156f3b){if(_0x156f3b){return _0x156f3b?{'count':_0x32d567,'rows':_0x156f3b}:null;}})[_0x369d('0x36')](respondWithResult(_0x1733a3,null))[_0x369d('0x29')](handleError(_0x1733a3,null));};exports['notify']=function(_0x168fb8,_0x456df9,_0x2588a2){var _0x442cde={'channel':_0x369d('0x83')};var _0x19e807=[];var _0x4cf4fa=[];var _0x48c95b={};return db['WhatsappAccount'][_0x369d('0x60')]({'where':{'id':_0x168fb8[_0x369d('0x59')]['id']},'include':[{'model':db[_0x369d('0x80')],'as':_0x369d('0x84')}]})[_0x369d('0x36')](handleEntityNotFound(_0x456df9,null))[_0x369d('0x36')](function(_0x1903e8){_0x442cde[_0x369d('0x85')]=_0x1903e8;_0x442cde[_0x369d('0x86')]=_['orderBy'](_0x1903e8['Applications'],[_0x369d('0x81')],[_0x369d('0x87')]);if(_0x442cde[_0x369d('0x85')][_0x369d('0x84')]){delete _0x442cde['account'][_0x369d('0x84')];}return db[_0x369d('0x88')]['describe']();})['then'](function(_0x8aba71){if(!_0x8aba71){throw new db[(_0x369d('0x1d'))][(_0x369d('0x1e'))](_0x369d('0x89'));}_0x19e807=_['difference'](_['keys'](_0x8aba71),[_0x369d('0x8a'),_0x369d('0x8b')]);_0x4cf4fa=_['difference'](_['keys'](_0x8aba71),[_0x369d('0x8a'),_0x369d('0x8b'),_0x369d('0x8c'),_0x369d('0x8d')]);_0x442cde[_0x369d('0x63')]={'mapKey':_0x369d('0x8e')};if(_0x442cde[_0x369d('0x85')][_0x369d('0x43')]&&_0x442cde[_0x369d('0x85')][_0x369d('0x43')]==='twilio'){_0x442cde[_0x369d('0x63')][_0x369d('0x8f')]=_0x168fb8[_0x369d('0x63')][_0x369d('0x90')][_0x369d('0x91')]('whatsapp:','');_0x442cde[_0x369d('0x63')][_0x369d('0x63')]=_0x168fb8[_0x369d('0x63')][_0x369d('0x92')];_0x442cde[_0x369d('0x63')][_0x369d('0x93')]=_0x168fb8['body'][_0x369d('0x94')];}if(_0x442cde[_0x369d('0x63')]['id']){delete _0x442cde['body']['id'];}if(_['isNil'](_0x442cde['body'][_0x369d('0x8f')])){throw new db[(_0x369d('0x1d'))][(_0x369d('0x1e'))](_0x369d('0x95'));}if(_['isNil'](_0x442cde[_0x369d('0x63')][_0x369d('0x63')])||_0x442cde['body'][_0x369d('0x63')]===''){throw new db[(_0x369d('0x1d'))][(_0x369d('0x1e'))](_0x369d('0x96'));}if(_[_0x369d('0x97')](_0x442cde[_0x369d('0x63')][_0x369d('0x98')])){throw new db[(_0x369d('0x1d'))][(_0x369d('0x1e'))](_0x369d('0x99')+_0x4cf4fa);}if(!_[_0x369d('0x9a')](_0x4cf4fa,_0x442cde[_0x369d('0x63')][_0x369d('0x98')])){throw new db[(_0x369d('0x1d'))][(_0x369d('0x1e'))](_0x369d('0x9b')+_0x4cf4fa);}_0x48c95b[_0x442cde[_0x369d('0x63')][_0x369d('0x98')]]=_0x442cde['body']['from'];return db[_0x369d('0x9c')][_0x369d('0x60')]({'where':{'id':_0x442cde['account'][_0x369d('0x8d')]},'include':[{'model':db['CmContact'],'as':_0x369d('0x9d'),'where':_0x48c95b,'limit':0x1,'order':[[_0x369d('0x8b'),_0x369d('0x9e')]]}]});})[_0x369d('0x36')](handleEntityNotFound(_0x456df9,null))['then'](function(_0x1ebeda){if(_0x1ebeda){_0x442cde[_0x369d('0x9f')]=_[_0x369d('0x74')](_0x1ebeda,[_0x369d('0x9d')]);if(_0x1ebeda[_0x369d('0x9d')]['length']){return _0x1ebeda[_0x369d('0x9d')][0x0];}var _0x20d5b3=_[_0x369d('0x17')](_0x442cde[_0x369d('0x63')],{'firstName':_0x442cde[_0x369d('0x63')]['from'],'ListId':_0x1ebeda['id']});_0x20d5b3[_0x442cde[_0x369d('0x63')][_0x369d('0x98')]]=_0x442cde[_0x369d('0x63')][_0x369d('0x8f')];return db[_0x369d('0x88')][_0x369d('0x68')](_0x20d5b3,{'fields':_0x19e807,'raw':!![]});}})[_0x369d('0x36')](handleEntityNotFound(_0x456df9,null))[_0x369d('0x36')](function(_0x1b5882){if(_0x1b5882){_0x442cde[_0x369d('0xa0')]=_0x1b5882;var _0xad2475={'ContactId':_0x1b5882['id'],'phone':_0x442cde[_0x369d('0x63')]['from'],'WhatsappAccountId':_0x168fb8[_0x369d('0x59')]['id']};var _0x6c9432={'ContactId':_0x1b5882['id'],'WhatsappAccountId':_0x168fb8[_0x369d('0x59')]['id'],'closed':![]};return db[_0x369d('0xa1')][_0x369d('0x60')]({'where':_0x6c9432})[_0x369d('0x36')](function(_0xb3f3f8){if(_0xb3f3f8){return[_0xb3f3f8,![]];}return db['WhatsappInteraction'][_0x369d('0x68')](_0xad2475)['then'](function(_0x23b25a){return[_0x23b25a,!![]];});});}})['spread'](function(_0x13a44b,_0x29402f){_0x442cde[_0x369d('0xa2')]=_0x13a44b[_0x369d('0x38')]({'plain':!![]});_0x442cde['interaction'][_0x369d('0xa3')]=![];if(_0x29402f){if(_0x442cde[_0x369d('0x85')][_0x369d('0xa4')]){_0x442cde[_0x369d('0x86')][_0x369d('0xa5')]({'id':0x0,'priority':_0x442cde[_0x369d('0x86')][_0x369d('0x4c')]+0x1,'app':_0x369d('0xa6'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x442cde[_0x369d('0xa2')][_0x369d('0xa3')]=!![];}return db[_0x369d('0xa7')]['create']({'phone':_0x442cde[_0x369d('0x63')][_0x369d('0x8f')],'messageId':_0x442cde[_0x369d('0x63')]['messageId'],'body':_0x442cde[_0x369d('0x63')]['body'],'WhatsappAccountId':_0x168fb8['params']['id'],'WhatsappInteractionId':_0x13a44b['id'],'direction':'in','ContactId':_0x13a44b[_0x369d('0xa8')],'AttachmentId':_0x442cde[_0x369d('0x63')][_0x369d('0xa9')]});})[_0x369d('0x36')](function(_0x31b546){_0x442cde[_0x369d('0x27')]=_0x31b546;if(_0x442cde[_0x369d('0xa2')][_0x369d('0xaa')]){return db[_0x369d('0x7a')][_0x369d('0x60')]({'attributes':['id',_0x369d('0x3b')],'where':{'id':_0x442cde[_0x369d('0xa2')][_0x369d('0xaa')]}})[_0x369d('0x36')](function(_0x3cf390){if(_0x3cf390){_0x442cde[_0x369d('0x86')][_0x369d('0xab')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3cf390[_0x369d('0x3b')]+','+(_0x442cde[_0x369d('0x85')][_0x369d('0xac')]||0xa),'interval':_0x369d('0xad')});}return respondWithRpcPromise(_0x369d('0xae'),'startRouting',_0x442cde);});}return respondWithRpcPromise(_0x369d('0xae'),_0x369d('0xaf'),_0x442cde);})[_0x369d('0x36')](function(_0x2d58a2){if(_0x2d58a2){var _0x2b034e=0xc8;var _0x5bcdd4='receiveMessage';logger[_0x369d('0x20')](_0x369d('0xb0'),_0x5bcdd4,_0x2b034e,_0x369d('0xb1'));logger[_0x369d('0x23')](_0x369d('0xb2'),_0x5bcdd4,_0x2b034e,_0x369d('0xb1'),JSON[_0x369d('0x24')](_0x2d58a2));if(_0x442cde[_0x369d('0x85')]['type']===_0x369d('0xb3')){return _0x456df9[_0x369d('0x2b')](_0x2b034e)[_0x369d('0x30')](_0x369d('0xb4'),_0x369d('0xb5'))[_0x369d('0x3c')]('\x0a');}else{return _0x456df9['status'](_0x2b034e)[_0x369d('0x31')](_0x2d58a2);}}})[_0x369d('0x29')](handleError(_0x456df9,null));};exports[_0x369d('0x3c')]=function(_0x1a31be,_0x419420,_0x40f545){var _0x35c012,_0x31f7f8,_0x370b73;if(_[_0x369d('0x97')](_0x1a31be[_0x369d('0x63')][_0x369d('0x63')])||_0x1a31be[_0x369d('0x63')][_0x369d('0x63')]===''){throw new db[(_0x369d('0x1d'))][(_0x369d('0x1e'))](_0x369d('0x96'));}if(_[_0x369d('0x97')](_0x1a31be['body']['to'])){throw new db[(_0x369d('0x1d'))][(_0x369d('0x1e'))](_0x369d('0xb6'));}_0x35c012=_0x1a31be[_0x369d('0x63')]['to'];return db[_0x369d('0x40')]['find']({'where':{'id':_0x1a31be['params']['id']},'include':[{'model':db[_0x369d('0x9c')],'as':_0x369d('0xb7'),'include':[{'model':db[_0x369d('0x88')],'as':_0x369d('0x9d'),'where':{'mobile':_0x35c012},'limit':0x1,'order':[[_0x369d('0x8b'),_0x369d('0x9e')]]}]}]})[_0x369d('0x36')](handleEntityNotFound(_0x419420,null))['then'](function(_0x438ccc){if(_0x438ccc&&_0x438ccc[_0x369d('0xb7')]){_0x31f7f8=_0x438ccc[_0x369d('0x38')]({'plain':!![]});if(_0x31f7f8[_0x369d('0xb7')]&&_0x31f7f8[_0x369d('0xb7')][_0x369d('0x9d')][_0x369d('0x4c')]){return _0x31f7f8['List'][_0x369d('0x9d')][0x0];}return db[_0x369d('0x88')]['create'](_[_0x369d('0x17')](_0x1a31be['body'],{'firstName':_0x35c012,'mobile':_0x35c012,'phone':_0x35c012,'ListId':_0x31f7f8['ListId']}));}})[_0x369d('0x36')](handleEntityNotFound(_0x419420,null))['then'](function(_0x11cf09){if(_0x11cf09){_0x370b73=_0x11cf09;return db['WhatsappInteraction'][_0x369d('0x60')]({'where':{'ContactId':_0x370b73['id'],'closed':![],'WhatsappAccountId':_0x31f7f8['id']}})[_0x369d('0x36')](function(_0x1a220f){if(_0x1a220f){return[_0x1a220f,![]];}return db[_0x369d('0xa1')][_0x369d('0x68')]({'UserId':_0x1a31be[_0x369d('0x5b')]['id'],'ContactId':_0x370b73['id'],'WhatsappAccountId':_0x31f7f8['id'],'phone':_0x35c012,'firstMsgDirection':'out','Messages':[_[_0x369d('0x53')](_0x1a31be[_0x369d('0x63')],{'read':![],'body':_0x1a31be[_0x369d('0x63')]['body'],'phone':_0x35c012,'WhatsappAccountId':_0x31f7f8['id'],'UserId':_0x1a31be[_0x369d('0x5b')]['id'],'ContactId':_0x370b73['id']})]},{'include':[{'model':db[_0x369d('0xa7')],'as':_0x369d('0xb8')}]})['then'](function(_0x3578a3){return[_0x3578a3,!![]];});});}})[_0x369d('0x75')](function(_0x399fec,_0x5758ca){if(_0x5758ca){return _0x399fec;}return db['WhatsappMessage'][_0x369d('0x68')](_[_0x369d('0x53')](_0x1a31be['body'],{'read':![],'body':_0x1a31be['body'][_0x369d('0x63')],'phone':_0x35c012,'WhatsappAccountId':_0x31f7f8['id'],'WhatsappInteractionId':_0x399fec['id'],'UserId':_0x1a31be['user']['id'],'ContactId':_0x370b73['id']}))[_0x369d('0x36')](function(_0x90fea7){_0x399fec[_0x369d('0xb9')][_0x369d('0xb8')]=[];_0x399fec['dataValues'][_0x369d('0xb8')][_0x369d('0xa5')](_0x90fea7['dataValues']);return _0x399fec;});})[_0x369d('0x36')](respondWithResult(_0x419420,null))[_0x369d('0x29')](handleError(_0x419420,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index ae8f3ed..846d4a9 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 _0x8ace=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','update'];(function(_0x294445,_0x322bb5){var _0x21cc50=function(_0xef1fd3){while(--_0xef1fd3){_0x294445['push'](_0x294445['shift']());}};_0x21cc50(++_0x322bb5);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x534c8f,_0x500079){_0x534c8f=_0x534c8f-0x0;var _0x5a57f5=_0x8ace[_0x534c8f];return _0x5a57f5;};'use strict';var EventEmitter=require(_0xe8ac('0x0'));var WhatsappAccount=require(_0xe8ac('0x1'))['db'][_0xe8ac('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xe8ac('0x3')](0x0);var events={'afterCreate':_0xe8ac('0x4'),'afterUpdate':_0xe8ac('0x5'),'afterDestroy':_0xe8ac('0x6')};function emitEvent(_0x274d7d){return function(_0x114351,_0xf6af00,_0x199794){WhatsappAccountEvents[_0xe8ac('0x7')](_0x274d7d+':'+_0x114351['id'],_0x114351);WhatsappAccountEvents[_0xe8ac('0x7')](_0x274d7d,_0x114351);_0x199794(null);};}for(var e in events){if(events[_0xe8ac('0x8')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0xe8ac('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0x323f=['save','update','remove','emit','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x2521ae,_0x3d8b15){var _0x3f0fd6=function(_0x28b5ae){while(--_0x28b5ae){_0x2521ae['push'](_0x2521ae['shift']());}};_0x3f0fd6(++_0x3d8b15);}(_0x323f,0x1ee));var _0xf323=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x323f[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xf323('0x0'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xf323('0x1')](0x0);var events={'afterCreate':_0xf323('0x2'),'afterUpdate':_0xf323('0x3'),'afterDestroy':_0xf323('0x4')};function emitEvent(_0x111042){return function(_0x2c9d35,_0xb4caa8,_0x2d4750){WhatsappAccountEvents[_0xf323('0x5')](_0x111042+':'+_0x2c9d35['id'],_0x2c9d35);WhatsappAccountEvents[_0xf323('0x5')](_0x111042,_0x2c9d35);_0x2d4750(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0xf323('0x6')](e,emitEvent(event));}}module[_0xf323('0x7')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 2a1cefa..995c3e7 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 _0x64ba=['request-promise','rimraf','../../config/environment','exports','define','whatsapp_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x64ba,0xde));var _0xa64b=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x64ba[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xa64b('0x0'));var util=require(_0xa64b('0x1'));var logger=require(_0xa64b('0x2'))(_0xa64b('0x3'));var moment=require(_0xa64b('0x4'));var BPromise=require(_0xa64b('0x5'));var rp=require(_0xa64b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa64b('0x7'));var config=require(_0xa64b('0x8'));var attributes=require('./whatsappAccount.attributes');module[_0xa64b('0x9')]=function(_0x74f2ad,_0x34eeab){return _0x74f2ad[_0xa64b('0xa')]('WhatsappAccount',attributes,{'tableName':_0xa64b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe541=['api','moment','bluebird','request-promise','rimraf','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash'];(function(_0x244b13,_0x257c15){var _0x3ac252=function(_0x9623ae){while(--_0x9623ae){_0x244b13['push'](_0x244b13['shift']());}};_0x3ac252(++_0x257c15);}(_0xe541,0xd0));var _0x1e54=function(_0x1f09fa,_0x3265ca){_0x1f09fa=_0x1f09fa-0x0;var _0x197c8d=_0xe541[_0x1f09fa];return _0x197c8d;};'use strict';var _=require(_0x1e54('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1e54('0x1'));var moment=require(_0x1e54('0x2'));var BPromise=require(_0x1e54('0x3'));var rp=require(_0x1e54('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1e54('0x5'));var config=require('../../config/environment');var attributes=require(_0x1e54('0x6'));module[_0x1e54('0x7')]=function(_0x59f0eb,_0x54cdf4){return _0x59f0eb[_0x1e54('0x8')](_0x1e54('0x9'),attributes,{'tableName':_0x1e54('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index ebfbe00..0e05fe1 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 _0x905b=['register','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','find','options','raw','where','attributes','include','map','model','ShowWhatsappAccount','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket'];(function(_0x3e2cf1,_0x2294a7){var _0x3796d0=function(_0x469880){while(--_0x469880){_0x3e2cf1['push'](_0x3e2cf1['shift']());}};_0x3796d0(++_0x2294a7);}(_0x905b,0x1a1));var _0xb905=function(_0x4a7e3f,_0x4f0484){_0x4a7e3f=_0x4a7e3f-0x0;var _0x1b526d=_0x905b[_0x4a7e3f];return _0x1b526d;};'use strict';var _=require(_0xb905('0x0'));var util=require('util');var moment=require(_0xb905('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb905('0x2'));var db=require(_0xb905('0x3'))['db'];var utils=require(_0xb905('0x4'));var logger=require(_0xb905('0x5'))(_0xb905('0x6'));var config=require(_0xb905('0x7'));var jayson=require(_0xb905('0x8'));var client=jayson['client'][_0xb905('0x9')]({'port':0x232a});config['redis']=_[_0xb905('0xa')](config[_0xb905('0xb')],{'host':_0xb905('0xc'),'port':0x18eb});var socket=require(_0xb905('0xd'))(new Redis(config[_0xb905('0xb')]));require(_0xb905('0xe'))[_0xb905('0xf')](socket);function respondWithRpcPromise(_0x113423,_0x3c35b1,_0x4c611d){return new BPromise(function(_0x286815,_0x42738b){return client[_0xb905('0x10')](_0x113423,_0x4c611d)[_0xb905('0x11')](function(_0x3d09d9){logger['info'](_0xb905('0x12'),_0x3c35b1,_0xb905('0x13'));logger[_0xb905('0x14')](_0xb905('0x15'),_0x3c35b1,_0xb905('0x13'),JSON[_0xb905('0x16')](_0x3d09d9));if(_0x3d09d9[_0xb905('0x17')]){if(_0x3d09d9['error']['code']===0x1f4){logger[_0xb905('0x17')](_0xb905('0x12'),_0x3c35b1,_0x3d09d9[_0xb905('0x17')][_0xb905('0x18')]);return _0x42738b(_0x3d09d9[_0xb905('0x17')][_0xb905('0x18')]);}logger[_0xb905('0x17')](_0xb905('0x12'),_0x3c35b1,_0x3d09d9[_0xb905('0x17')][_0xb905('0x18')]);return _0x286815(_0x3d09d9[_0xb905('0x17')][_0xb905('0x18')]);}else{logger[_0xb905('0x19')]('WhatsappAccount,\x20%s,\x20%s',_0x3c35b1,'request\x20sent');_0x286815(_0x3d09d9['result'][_0xb905('0x18')]);}})[_0xb905('0x1a')](function(_0x33c815){logger[_0xb905('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x3c35b1,_0x33c815);_0x42738b(_0x33c815);});});}exports['ShowWhatsappAccount']=function(_0x527b63){var _0x1f52e3=this;return new Promise(function(_0x5de2ae,_0x59fb4c){return db['WhatsappAccount'][_0xb905('0x1b')]({'raw':_0x527b63[_0xb905('0x1c')]?_0x527b63[_0xb905('0x1c')][_0xb905('0x1d')]===undefined?!![]:![]:!![],'where':_0x527b63[_0xb905('0x1c')]?_0x527b63['options'][_0xb905('0x1e')]||null:null,'attributes':_0x527b63[_0xb905('0x1c')]?_0x527b63[_0xb905('0x1c')][_0xb905('0x1f')]||null:null,'include':_0x527b63['options']?_0x527b63[_0xb905('0x1c')][_0xb905('0x20')]?_[_0xb905('0x21')](_0x527b63['options']['include'],function(_0x5c73bb){return{'model':db[_0x5c73bb[_0xb905('0x22')]],'as':_0x5c73bb['as'],'attributes':_0x5c73bb[_0xb905('0x1f')],'include':_0x5c73bb[_0xb905('0x20')]?_['map'](_0x5c73bb[_0xb905('0x20')],function(_0x38f9e2){return{'model':db[_0x38f9e2[_0xb905('0x22')]],'as':_0x38f9e2['as'],'attributes':_0x38f9e2[_0xb905('0x1f')],'include':_0x38f9e2[_0xb905('0x20')]?_[_0xb905('0x21')](_0x38f9e2[_0xb905('0x20')],function(_0x4e82ed){return{'model':db[_0x4e82ed[_0xb905('0x22')]],'as':_0x4e82ed['as'],'attributes':_0x4e82ed['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e47e0){logger[_0xb905('0x19')](_0xb905('0x23'),_0x527b63);logger['debug']('ShowWhatsappAccount',_0x527b63,JSON[_0xb905('0x16')](_0x3e47e0));_0x5de2ae(_0x3e47e0);})[_0xb905('0x1a')](function(_0x5881f5){logger[_0xb905('0x17')](_0xb905('0x23'),_0x5881f5[_0xb905('0x18')],_0x527b63);_0x59fb4c(_0x1f52e3[_0xb905('0x17')](0x1f4,_0x5881f5[_0xb905('0x18')]));});});}; \ No newline at end of file +var _0x7d4b=['map','include','model','then','ShowWhatsappAccount','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappAccount','find','options','raw','where','attributes'];(function(_0x56ad9d,_0x8946fb){var _0x10ccee=function(_0x4569f4){while(--_0x4569f4){_0x56ad9d['push'](_0x56ad9d['shift']());}};_0x10ccee(++_0x8946fb);}(_0x7d4b,0x12d));var _0xb7d4=function(_0x3917de,_0x4c4c1a){_0x3917de=_0x3917de-0x0;var _0x3d1cab=_0x7d4b[_0x3917de];return _0x3d1cab;};'use strict';var _=require(_0xb7d4('0x0'));var util=require(_0xb7d4('0x1'));var moment=require('moment');var BPromise=require(_0xb7d4('0x2'));var rs=require(_0xb7d4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb7d4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb7d4('0x5'))(_0xb7d4('0x6'));var config=require('../../config/environment');var jayson=require(_0xb7d4('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xb7d4('0x8')]=_[_0xb7d4('0x9')](config[_0xb7d4('0x8')],{'host':_0xb7d4('0xa'),'port':0x18eb});var socket=require(_0xb7d4('0xb'))(new Redis(config['redis']));require(_0xb7d4('0xc'))[_0xb7d4('0xd')](socket);function respondWithRpcPromise(_0x5df541,_0x3b5273,_0x3a369b){return new BPromise(function(_0x166e73,_0x4af8ff){return client[_0xb7d4('0xe')](_0x5df541,_0x3a369b)['then'](function(_0x4c9b85){logger[_0xb7d4('0xf')](_0xb7d4('0x10'),_0x3b5273,_0xb7d4('0x11'));logger[_0xb7d4('0x12')](_0xb7d4('0x13'),_0x3b5273,_0xb7d4('0x11'),JSON[_0xb7d4('0x14')](_0x4c9b85));if(_0x4c9b85[_0xb7d4('0x15')]){if(_0x4c9b85[_0xb7d4('0x15')][_0xb7d4('0x16')]===0x1f4){logger[_0xb7d4('0x15')](_0xb7d4('0x10'),_0x3b5273,_0x4c9b85[_0xb7d4('0x15')][_0xb7d4('0x17')]);return _0x4af8ff(_0x4c9b85[_0xb7d4('0x15')][_0xb7d4('0x17')]);}logger['error'](_0xb7d4('0x10'),_0x3b5273,_0x4c9b85['error'][_0xb7d4('0x17')]);return _0x166e73(_0x4c9b85[_0xb7d4('0x15')][_0xb7d4('0x17')]);}else{logger[_0xb7d4('0xf')]('WhatsappAccount,\x20%s,\x20%s',_0x3b5273,_0xb7d4('0x11'));_0x166e73(_0x4c9b85[_0xb7d4('0x18')][_0xb7d4('0x17')]);}})[_0xb7d4('0x19')](function(_0x3e0168){logger[_0xb7d4('0x15')](_0xb7d4('0x10'),_0x3b5273,_0x3e0168);_0x4af8ff(_0x3e0168);});});}exports['ShowWhatsappAccount']=function(_0x2bb0f1){var _0x12b6db=this;return new Promise(function(_0x5f25c8,_0x1a6f8c){return db[_0xb7d4('0x1a')][_0xb7d4('0x1b')]({'raw':_0x2bb0f1[_0xb7d4('0x1c')]?_0x2bb0f1[_0xb7d4('0x1c')][_0xb7d4('0x1d')]===undefined?!![]:![]:!![],'where':_0x2bb0f1[_0xb7d4('0x1c')]?_0x2bb0f1[_0xb7d4('0x1c')][_0xb7d4('0x1e')]||null:null,'attributes':_0x2bb0f1[_0xb7d4('0x1c')]?_0x2bb0f1[_0xb7d4('0x1c')][_0xb7d4('0x1f')]||null:null,'include':_0x2bb0f1[_0xb7d4('0x1c')]?_0x2bb0f1[_0xb7d4('0x1c')]['include']?_[_0xb7d4('0x20')](_0x2bb0f1[_0xb7d4('0x1c')][_0xb7d4('0x21')],function(_0x51ed74){return{'model':db[_0x51ed74[_0xb7d4('0x22')]],'as':_0x51ed74['as'],'attributes':_0x51ed74['attributes'],'include':_0x51ed74[_0xb7d4('0x21')]?_[_0xb7d4('0x20')](_0x51ed74[_0xb7d4('0x21')],function(_0xd8e8de){return{'model':db[_0xd8e8de['model']],'as':_0xd8e8de['as'],'attributes':_0xd8e8de[_0xb7d4('0x1f')],'include':_0xd8e8de['include']?_[_0xb7d4('0x20')](_0xd8e8de[_0xb7d4('0x21')],function(_0x5ec5a4){return{'model':db[_0x5ec5a4[_0xb7d4('0x22')]],'as':_0x5ec5a4['as'],'attributes':_0x5ec5a4[_0xb7d4('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb7d4('0x23')](function(_0x235c81){logger[_0xb7d4('0xf')](_0xb7d4('0x24'),_0x2bb0f1);logger['debug']('ShowWhatsappAccount',_0x2bb0f1,JSON[_0xb7d4('0x14')](_0x235c81));_0x5f25c8(_0x235c81);})['catch'](function(_0x4eb1ce){logger[_0xb7d4('0x15')](_0xb7d4('0x24'),_0x4eb1ce['message'],_0x2bb0f1);_0x1a6f8c(_0x12b6db['error'](0x1f4,_0x4eb1ce[_0xb7d4('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index e05a783..d0589f0 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 _0xb945=['whatsappAccount:','remove','update','emit','removeListener','register'];(function(_0x33ee05,_0x2f7cb7){var _0x349aa0=function(_0x3b1a38){while(--_0x3b1a38){_0x33ee05['push'](_0x33ee05['shift']());}};_0x349aa0(++_0x2f7cb7);}(_0xb945,0xc1));var _0x5b94=function(_0x361e8a,_0x458d1f){_0x361e8a=_0x361e8a-0x0;var _0x4f4f22=_0xb945[_0x361e8a];return _0x4f4f22;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=['save',_0x5b94('0x0'),_0x5b94('0x1')];function createListener(_0x2298c9,_0x35fc8b){return function(_0x59c2f3){_0x35fc8b[_0x5b94('0x2')](_0x2298c9,_0x59c2f3);};}function removeListener(_0x125dbe,_0x474ea0){return function(){WhatsappAccountEvents[_0x5b94('0x3')](_0x125dbe,_0x474ea0);};}exports[_0x5b94('0x4')]=function(_0x3638ee){for(var _0xf523c=0x0,_0x319138=events['length'];_0xf523c<_0x319138;_0xf523c++){var _0x501ead=events[_0xf523c];var _0x4836a9=createListener(_0x5b94('0x5')+_0x501ead,_0x3638ee);WhatsappAccountEvents['on'](_0x501ead,_0x4836a9);}}; \ No newline at end of file +var _0x07f0=['./whatsappAccount.events','save','remove','update','emit','register','length','whatsappAccount:'];(function(_0x27d563,_0x3ab87b){var _0x2348d4=function(_0x2c6be7){while(--_0x2c6be7){_0x27d563['push'](_0x27d563['shift']());}};_0x2348d4(++_0x3ab87b);}(_0x07f0,0x198));var _0x007f=function(_0xd22d95,_0xc59f8f){_0xd22d95=_0xd22d95-0x0;var _0x15d7a3=_0x07f0[_0xd22d95];return _0x15d7a3;};'use strict';var WhatsappAccountEvents=require(_0x007f('0x0'));var events=[_0x007f('0x1'),_0x007f('0x2'),_0x007f('0x3')];function createListener(_0x28bcfc,_0x38e4d9){return function(_0x1fc3d6){_0x38e4d9[_0x007f('0x4')](_0x28bcfc,_0x1fc3d6);};}function removeListener(_0x457f74,_0x194908){return function(){WhatsappAccountEvents['removeListener'](_0x457f74,_0x194908);};}exports[_0x007f('0x5')]=function(_0x4e9e00){for(var _0x6660a6=0x0,_0x30aa2a=events[_0x007f('0x6')];_0x6660a6<_0x30aa2a;_0x6660a6++){var _0x563396=events[_0x6660a6];var _0x23bda5=createListener(_0x007f('0x7')+_0x563396,_0x4e9e00);WhatsappAccountEvents['on'](_0x563396,_0x23bda5);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index ba55d44..c0617ec 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 _0xfdcc=['post','create','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','index','/:id','isAuthenticated'];(function(_0x121fa7,_0x14d948){var _0x2888d9=function(_0x441293){while(--_0x441293){_0x121fa7['push'](_0x121fa7['shift']());}};_0x2888d9(++_0x14d948);}(_0xfdcc,0xb9));var _0xcfdc=function(_0x2442b9,_0x3d87e9){_0x2442b9=_0x2442b9-0x0;var _0x31b571=_0xfdcc[_0x2442b9];return _0x31b571;};'use strict';var multer=require(_0xcfdc('0x0'));var util=require(_0xcfdc('0x1'));var path=require(_0xcfdc('0x2'));var timeout=require(_0xcfdc('0x3'));var express=require(_0xcfdc('0x4'));var router=express['Router']();var auth=require(_0xcfdc('0x5'));var interaction=require(_0xcfdc('0x6'));var config=require(_0xcfdc('0x7'));var controller=require(_0xcfdc('0x8'));router[_0xcfdc('0x9')]('/',auth['isAuthenticated'](),controller[_0xcfdc('0xa')]);router[_0xcfdc('0x9')](_0xcfdc('0xb'),auth[_0xcfdc('0xc')](),controller['show']);router[_0xcfdc('0xd')]('/',auth[_0xcfdc('0xc')](),controller[_0xcfdc('0xe')]);router['put'](_0xcfdc('0xb'),auth[_0xcfdc('0xc')](),controller[_0xcfdc('0xf')]);router[_0xcfdc('0x10')](_0xcfdc('0xb'),auth[_0xcfdc('0xc')](),controller[_0xcfdc('0x11')]);module['exports']=router; \ No newline at end of file +var _0x9423=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','isAuthenticated','index','get','/:id','create','put','update','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x3375c5,_0x586353){var _0x24823e=function(_0x1bc142){while(--_0x1bc142){_0x3375c5['push'](_0x3375c5['shift']());}};_0x24823e(++_0x586353);}(_0x9423,0x108));var _0x3942=function(_0x3ac1bc,_0x5edf1f){_0x3ac1bc=_0x3ac1bc-0x0;var _0x44a539=_0x9423[_0x3ac1bc];return _0x44a539;};'use strict';var multer=require(_0x3942('0x0'));var util=require(_0x3942('0x1'));var path=require(_0x3942('0x2'));var timeout=require(_0x3942('0x3'));var express=require(_0x3942('0x4'));var router=express[_0x3942('0x5')]();var auth=require(_0x3942('0x6'));var interaction=require(_0x3942('0x7'));var config=require(_0x3942('0x8'));var controller=require(_0x3942('0x9'));router['get']('/',auth[_0x3942('0xa')](),controller[_0x3942('0xb')]);router[_0x3942('0xc')](_0x3942('0xd'),auth[_0x3942('0xa')](),controller['show']);router['post']('/',auth[_0x3942('0xa')](),controller[_0x3942('0xe')]);router[_0x3942('0xf')]('/:id',auth[_0x3942('0xa')](),controller[_0x3942('0x10')]);router['delete'](_0x3942('0xd'),auth[_0x3942('0xa')](),controller[_0x3942('0x11')]);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 232a7d6..8b3e120 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 _0xde75=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xde75,0x64));var _0x5de7=function(_0x208b0a,_0x1eefb5){_0x208b0a=_0x208b0a-0x0;var _0x437711=_0xde75[_0x208b0a];return _0x437711;};'use strict';var Sequelize=require(_0x5de7('0x0'));module[_0x5de7('0x1')]={'priority':{'type':Sequelize[_0x5de7('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x5de7('0x3')],'allowNull':![],'defaultValue':_0x5de7('0x4')},'appdata':{'type':Sequelize[_0x5de7('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x5de7('0x3')],'defaultValue':_0x5de7('0x6')}}; \ No newline at end of file +var _0x600e=['exports','STRING','TEXT','*,*,*,*','sequelize'];(function(_0xd6e799,_0x253932){var _0x1ce8cf=function(_0x514bdf){while(--_0x514bdf){_0xd6e799['push'](_0xd6e799['shift']());}};_0x1ce8cf(++_0x253932);}(_0x600e,0xe5));var _0xe600=function(_0x227db3,_0x15015a){_0x227db3=_0x227db3-0x0;var _0x131b6d=_0x600e[_0x227db3];return _0x131b6d;};'use strict';var Sequelize=require(_0xe600('0x0'));module[_0xe600('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xe600('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xe600('0x3')]()},'description':{'type':Sequelize[_0xe600('0x2')]},'interval':{'type':Sequelize[_0xe600('0x2')],'defaultValue':_0xe600('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 30d0bd3..6c39873 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 _0x5096=['merge','VIRTUAL','filter','options','includeAll','WhatsappApplication','findAll','rows','catch','params','keys','include','find','create','body','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','count','offset','limit','set','json','apply','reject','save','update','destroy','then','end','error','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0xb6ea89,_0x14a899){var _0x3d5ab5=function(_0xc010d9){while(--_0xc010d9){_0xb6ea89['push'](_0xb6ea89['shift']());}};_0x3d5ab5(++_0x14a899);}(_0x5096,0x9d));var _0x6509=function(_0x1aad88,_0x551794){_0x1aad88=_0x1aad88-0x0;var _0x1bbfe9=_0x5096[_0x1aad88];return _0x1bbfe9;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x6509('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6509('0x1'));var moment=require(_0x6509('0x2'));var BPromise=require(_0x6509('0x3'));var Mustache=require(_0x6509('0x4'));var util=require(_0x6509('0x5'));var path=require(_0x6509('0x6'));var sox=require(_0x6509('0x7'));var csv=require(_0x6509('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6509('0x9'));var squel=require('squel');var crypto=require(_0x6509('0xa'));var jsforce=require(_0x6509('0xb'));var deskjs=require(_0x6509('0xc'));var toCsv=require(_0x6509('0x8'));var querystring=require(_0x6509('0xd'));var Papa=require(_0x6509('0xe'));var Redis=require(_0x6509('0xf'));var authService=require(_0x6509('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6509('0x11'));var hardwareService=require(_0x6509('0x12'));var logger=require('../../config/logger')(_0x6509('0x13'));var utils=require(_0x6509('0x14'));var config=require('../../config/environment');var db=require(_0x6509('0x15'))['db'];function respondWithStatusCode(_0x7ef080,_0x376c9f){_0x376c9f=_0x376c9f||0xcc;return function(_0x35e576){if(_0x35e576){return _0x7ef080[_0x6509('0x16')](_0x376c9f);}return _0x7ef080['status'](_0x376c9f)['end']();};}function respondWithResult(_0x4a0bbd,_0x407a5a){_0x407a5a=_0x407a5a||0xc8;return function(_0x3f1107){if(_0x3f1107){return _0x4a0bbd[_0x6509('0x17')](_0x407a5a)['json'](_0x3f1107);}};}function respondWithFilteredResult(_0xd01a90,_0x1c7311){return function(_0xacff7e){if(_0xacff7e){var _0x4217f2=_0xacff7e[_0x6509('0x18')],_0x2fd0b3=_0x1c7311[_0x6509('0x19')],_0xb32c23=_0x1c7311[_0x6509('0x19')]+_0x1c7311[_0x6509('0x1a')],_0x90f7da;if(_0xb32c23>=_0x4217f2){_0xb32c23=_0x4217f2;_0x90f7da=0xc8;}else{_0x90f7da=0xce;}_0xd01a90['status'](_0x90f7da);return _0xd01a90[_0x6509('0x1b')]('Content-Range',_0x2fd0b3+'-'+_0xb32c23+'/'+_0x4217f2)[_0x6509('0x1c')](_0xacff7e);}return null;};}function patchUpdates(_0x2bfe1e){return function(_0x37b189){try{jsonpatch[_0x6509('0x1d')](_0x37b189,_0x2bfe1e,!![]);}catch(_0x524cef){return BPromise[_0x6509('0x1e')](_0x524cef);}return _0x37b189[_0x6509('0x1f')]();};}function saveUpdates(_0x25720c,_0x462021){return function(_0x1b4c46){if(_0x1b4c46){return _0x1b4c46[_0x6509('0x20')](_0x25720c)['then'](function(_0x569b26){return _0x569b26;});}return null;};}function removeEntity(_0x26d9c4,_0x157ea0){return function(_0x4816ff){if(_0x4816ff){return _0x4816ff[_0x6509('0x21')]()[_0x6509('0x22')](function(){_0x26d9c4[_0x6509('0x17')](0xcc)[_0x6509('0x23')]();});}};}function handleEntityNotFound(_0x43ead3,_0x5f5a70){return function(_0x25c517){if(!_0x25c517){_0x43ead3['sendStatus'](0x194);}return _0x25c517;};}function handleError(_0x5ddcba,_0x5762cf){_0x5762cf=_0x5762cf||0x1f4;return function(_0x3d590b){logger[_0x6509('0x24')](_0x3d590b['stack']);if(_0x3d590b[_0x6509('0x25')]){delete _0x3d590b['name'];}_0x5ddcba['status'](_0x5762cf)[_0x6509('0x26')](_0x3d590b);};}exports[_0x6509('0x27')]=function(_0x542c61,_0x869542){var _0x16f4c7={},_0x15b9c0={},_0x143289={'count':0x0,'rows':[]};var _0x5f23e6=_[_0x6509('0x28')](db['WhatsappApplication'][_0x6509('0x29')],function(_0x2c2a04){return{'name':_0x2c2a04[_0x6509('0x2a')],'type':_0x2c2a04[_0x6509('0x2b')]['key']};});_0x15b9c0[_0x6509('0x2c')]=_[_0x6509('0x28')](_0x5f23e6,'name');_0x15b9c0[_0x6509('0x2d')]=_['keys'](_0x542c61['query']);_0x15b9c0[_0x6509('0x2e')]=_[_0x6509('0x2f')](_0x15b9c0[_0x6509('0x2c')],_0x15b9c0[_0x6509('0x2d')]);_0x16f4c7[_0x6509('0x30')]=_[_0x6509('0x2f')](_0x15b9c0['model'],qs[_0x6509('0x31')](_0x542c61[_0x6509('0x2d')][_0x6509('0x31')]));_0x16f4c7[_0x6509('0x30')]=_0x16f4c7[_0x6509('0x30')][_0x6509('0x32')]?_0x16f4c7['attributes']:_0x15b9c0[_0x6509('0x2c')];if(!_0x542c61[_0x6509('0x2d')][_0x6509('0x33')](_0x6509('0x34'))){_0x16f4c7[_0x6509('0x1a')]=qs[_0x6509('0x1a')](_0x542c61[_0x6509('0x2d')]['limit']);_0x16f4c7[_0x6509('0x19')]=qs[_0x6509('0x19')](_0x542c61[_0x6509('0x2d')][_0x6509('0x19')]);}_0x16f4c7[_0x6509('0x35')]=qs[_0x6509('0x36')](_0x542c61[_0x6509('0x2d')][_0x6509('0x36')]);_0x16f4c7[_0x6509('0x37')]=qs['filters'](_['pick'](_0x542c61[_0x6509('0x2d')],_0x15b9c0[_0x6509('0x2e')]),_0x5f23e6);if(_0x542c61['query']['filter']){_0x16f4c7['where']=_[_0x6509('0x38')](_0x16f4c7[_0x6509('0x37')],{'$or':_[_0x6509('0x28')](_0x5f23e6,function(_0x98a20f){if(_0x98a20f[_0x6509('0x2b')]!==_0x6509('0x39')){var _0x6af36b={};_0x6af36b[_0x98a20f[_0x6509('0x25')]]={'$like':'%'+_0x542c61[_0x6509('0x2d')][_0x6509('0x3a')]+'%'};return _0x6af36b;}})});}_0x16f4c7=_[_0x6509('0x38')]({},_0x16f4c7,_0x542c61[_0x6509('0x3b')]);var _0x5633e9={'where':_0x16f4c7['where']};return db['WhatsappApplication'][_0x6509('0x18')](_0x5633e9)[_0x6509('0x22')](function(_0x5d991d){_0x143289['count']=_0x5d991d;if(_0x542c61['query'][_0x6509('0x3c')]){_0x16f4c7['include']=[{'all':!![]}];}return db[_0x6509('0x3d')][_0x6509('0x3e')](_0x16f4c7);})[_0x6509('0x22')](function(_0x5a7088){_0x143289[_0x6509('0x3f')]=_0x5a7088;return _0x143289;})[_0x6509('0x22')](respondWithFilteredResult(_0x869542,_0x16f4c7))[_0x6509('0x40')](handleError(_0x869542,null));};exports['show']=function(_0x5a6d3c,_0x4cea75){var _0x53c1aa={'raw':!![],'where':{'id':_0x5a6d3c[_0x6509('0x41')]['id']}},_0x150a34={};_0x150a34[_0x6509('0x2c')]=_[_0x6509('0x42')](db[_0x6509('0x3d')][_0x6509('0x29')]);_0x150a34[_0x6509('0x2d')]=_['keys'](_0x5a6d3c[_0x6509('0x2d')]);_0x150a34[_0x6509('0x2e')]=_[_0x6509('0x2f')](_0x150a34['model'],_0x150a34['query']);_0x53c1aa[_0x6509('0x30')]=_[_0x6509('0x2f')](_0x150a34[_0x6509('0x2c')],qs[_0x6509('0x31')](_0x5a6d3c[_0x6509('0x2d')][_0x6509('0x31')]));_0x53c1aa[_0x6509('0x30')]=_0x53c1aa[_0x6509('0x30')][_0x6509('0x32')]?_0x53c1aa['attributes']:_0x150a34[_0x6509('0x2c')];if(_0x5a6d3c[_0x6509('0x2d')]['includeAll']){_0x53c1aa[_0x6509('0x43')]=[{'all':!![]}];}_0x53c1aa=_['merge']({},_0x53c1aa,_0x5a6d3c[_0x6509('0x3b')]);return db['WhatsappApplication'][_0x6509('0x44')](_0x53c1aa)[_0x6509('0x22')](handleEntityNotFound(_0x4cea75,null))[_0x6509('0x22')](respondWithResult(_0x4cea75,null))[_0x6509('0x40')](handleError(_0x4cea75,null));};exports[_0x6509('0x45')]=function(_0x1e150c,_0x187e3e){return db[_0x6509('0x3d')][_0x6509('0x45')](_0x1e150c[_0x6509('0x46')],{})[_0x6509('0x22')](respondWithResult(_0x187e3e,0xc9))['catch'](handleError(_0x187e3e,null));};exports['update']=function(_0x3f1667,_0x3e59e1){if(_0x3f1667[_0x6509('0x46')]['id']){delete _0x3f1667[_0x6509('0x46')]['id'];}return db['WhatsappApplication'][_0x6509('0x44')]({'where':{'id':_0x3f1667['params']['id']}})[_0x6509('0x22')](handleEntityNotFound(_0x3e59e1,null))['then'](saveUpdates(_0x3f1667[_0x6509('0x46')],null))['then'](respondWithResult(_0x3e59e1,null))[_0x6509('0x40')](handleError(_0x3e59e1,null));};exports[_0x6509('0x21')]=function(_0x4909db,_0x2fe144){return db[_0x6509('0x3d')][_0x6509('0x44')]({'where':{'id':_0x4909db['params']['id']}})[_0x6509('0x22')](handleEntityNotFound(_0x2fe144,null))[_0x6509('0x22')](removeEntity(_0x2fe144,null))[_0x6509('0x40')](handleError(_0x2fe144,null));}; \ No newline at end of file +var _0x00e9=['html-pdf','eml-format','rimraf','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','VIRTUAL','filter','options','WhatsappApplication','includeAll','include','rows','catch','show','find','create','body','params'];(function(_0x45d866,_0x19e07a){var _0x5a33bd=function(_0x1dd5f6){while(--_0x1dd5f6){_0x45d866['push'](_0x45d866['shift']());}};_0x5a33bd(++_0x19e07a);}(_0x00e9,0x1ea));var _0x900e=function(_0x12f533,_0x17a24d){_0x12f533=_0x12f533-0x0;var _0x594763=_0x00e9[_0x12f533];return _0x594763;};'use strict';var pdf=require(_0x900e('0x0'));var emlformat=require(_0x900e('0x1'));var rimraf=require(_0x900e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x900e('0x3'));var moment=require(_0x900e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x900e('0x5'));var path=require(_0x900e('0x6'));var sox=require(_0x900e('0x7'));var csv=require(_0x900e('0x8'));var ejs=require(_0x900e('0x9'));var fs=require('fs');var _=require(_0x900e('0xa'));var squel=require(_0x900e('0xb'));var crypto=require(_0x900e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x900e('0xd'));var toCsv=require(_0x900e('0x8'));var querystring=require(_0x900e('0xe'));var Papa=require(_0x900e('0xf'));var Redis=require(_0x900e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x900e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x900e('0x12'))(_0x900e('0x13'));var utils=require(_0x900e('0x14'));var config=require('../../config/environment');var db=require(_0x900e('0x15'))['db'];function respondWithStatusCode(_0xb5aba0,_0x4259c0){_0x4259c0=_0x4259c0||0xcc;return function(_0x320ad4){if(_0x320ad4){return _0xb5aba0[_0x900e('0x16')](_0x4259c0);}return _0xb5aba0[_0x900e('0x17')](_0x4259c0)[_0x900e('0x18')]();};}function respondWithResult(_0x16ba13,_0x55095b){_0x55095b=_0x55095b||0xc8;return function(_0x3f8cca){if(_0x3f8cca){return _0x16ba13[_0x900e('0x17')](_0x55095b)[_0x900e('0x19')](_0x3f8cca);}};}function respondWithFilteredResult(_0x2abe64,_0x56ad15){return function(_0x3f5137){if(_0x3f5137){var _0x1e3828=_0x3f5137[_0x900e('0x1a')],_0x3988a0=_0x56ad15['offset'],_0x4a4e27=_0x56ad15[_0x900e('0x1b')]+_0x56ad15['limit'],_0x204fe2;if(_0x4a4e27>=_0x1e3828){_0x4a4e27=_0x1e3828;_0x204fe2=0xc8;}else{_0x204fe2=0xce;}_0x2abe64[_0x900e('0x17')](_0x204fe2);return _0x2abe64['set'](_0x900e('0x1c'),_0x3988a0+'-'+_0x4a4e27+'/'+_0x1e3828)['json'](_0x3f5137);}return null;};}function patchUpdates(_0x453ca7){return function(_0x4e9da1){try{jsonpatch['apply'](_0x4e9da1,_0x453ca7,!![]);}catch(_0x40dbc3){return BPromise[_0x900e('0x1d')](_0x40dbc3);}return _0x4e9da1[_0x900e('0x1e')]();};}function saveUpdates(_0x26eb4a,_0x4a08cf){return function(_0x3d8bc7){if(_0x3d8bc7){return _0x3d8bc7[_0x900e('0x1f')](_0x26eb4a)[_0x900e('0x20')](function(_0x3639f8){return _0x3639f8;});}return null;};}function removeEntity(_0x5b5b73,_0x4d5773){return function(_0x274efb){if(_0x274efb){return _0x274efb[_0x900e('0x21')]()[_0x900e('0x20')](function(){_0x5b5b73[_0x900e('0x17')](0xcc)[_0x900e('0x18')]();});}};}function handleEntityNotFound(_0x532424,_0x1f1c8e){return function(_0x31d0f3){if(!_0x31d0f3){_0x532424[_0x900e('0x16')](0x194);}return _0x31d0f3;};}function handleError(_0x252dd6,_0x4ee87e){_0x4ee87e=_0x4ee87e||0x1f4;return function(_0x477614){logger[_0x900e('0x22')](_0x477614[_0x900e('0x23')]);if(_0x477614[_0x900e('0x24')]){delete _0x477614[_0x900e('0x24')];}_0x252dd6[_0x900e('0x17')](_0x4ee87e)['send'](_0x477614);};}exports[_0x900e('0x25')]=function(_0x1ee982,_0x34be03){var _0x3c95be={},_0x11900c={},_0x9ac7f={'count':0x0,'rows':[]};var _0x97f3f7=_[_0x900e('0x26')](db['WhatsappApplication'][_0x900e('0x27')],function(_0x22c56e){return{'name':_0x22c56e['fieldName'],'type':_0x22c56e[_0x900e('0x28')][_0x900e('0x29')]};});_0x11900c[_0x900e('0x2a')]=_[_0x900e('0x26')](_0x97f3f7,_0x900e('0x24'));_0x11900c[_0x900e('0x2b')]=_[_0x900e('0x2c')](_0x1ee982[_0x900e('0x2b')]);_0x11900c[_0x900e('0x2d')]=_['intersection'](_0x11900c['model'],_0x11900c[_0x900e('0x2b')]);_0x3c95be[_0x900e('0x2e')]=_[_0x900e('0x2f')](_0x11900c[_0x900e('0x2a')],qs[_0x900e('0x30')](_0x1ee982[_0x900e('0x2b')][_0x900e('0x30')]));_0x3c95be[_0x900e('0x2e')]=_0x3c95be[_0x900e('0x2e')][_0x900e('0x31')]?_0x3c95be[_0x900e('0x2e')]:_0x11900c[_0x900e('0x2a')];if(!_0x1ee982[_0x900e('0x2b')][_0x900e('0x32')](_0x900e('0x33'))){_0x3c95be[_0x900e('0x34')]=qs['limit'](_0x1ee982[_0x900e('0x2b')][_0x900e('0x34')]);_0x3c95be[_0x900e('0x1b')]=qs[_0x900e('0x1b')](_0x1ee982['query'][_0x900e('0x1b')]);}_0x3c95be['order']=qs[_0x900e('0x35')](_0x1ee982[_0x900e('0x2b')][_0x900e('0x35')]);_0x3c95be[_0x900e('0x36')]=qs[_0x900e('0x2d')](_[_0x900e('0x37')](_0x1ee982[_0x900e('0x2b')],_0x11900c[_0x900e('0x2d')]),_0x97f3f7);if(_0x1ee982['query']['filter']){_0x3c95be['where']=_[_0x900e('0x38')](_0x3c95be['where'],{'$or':_['map'](_0x97f3f7,function(_0x4f51db){if(_0x4f51db['type']!==_0x900e('0x39')){var _0x2046fb={};_0x2046fb[_0x4f51db[_0x900e('0x24')]]={'$like':'%'+_0x1ee982['query'][_0x900e('0x3a')]+'%'};return _0x2046fb;}})});}_0x3c95be=_[_0x900e('0x38')]({},_0x3c95be,_0x1ee982[_0x900e('0x3b')]);var _0x4f361d={'where':_0x3c95be[_0x900e('0x36')]};return db[_0x900e('0x3c')][_0x900e('0x1a')](_0x4f361d)['then'](function(_0x3ac72c){_0x9ac7f['count']=_0x3ac72c;if(_0x1ee982['query'][_0x900e('0x3d')]){_0x3c95be[_0x900e('0x3e')]=[{'all':!![]}];}return db[_0x900e('0x3c')]['findAll'](_0x3c95be);})[_0x900e('0x20')](function(_0x2022cc){_0x9ac7f[_0x900e('0x3f')]=_0x2022cc;return _0x9ac7f;})[_0x900e('0x20')](respondWithFilteredResult(_0x34be03,_0x3c95be))[_0x900e('0x40')](handleError(_0x34be03,null));};exports[_0x900e('0x41')]=function(_0x22d20e,_0x358bc0){var _0x1c4435={'raw':!![],'where':{'id':_0x22d20e['params']['id']}},_0x44bcc9={};_0x44bcc9[_0x900e('0x2a')]=_['keys'](db[_0x900e('0x3c')][_0x900e('0x27')]);_0x44bcc9[_0x900e('0x2b')]=_[_0x900e('0x2c')](_0x22d20e[_0x900e('0x2b')]);_0x44bcc9[_0x900e('0x2d')]=_[_0x900e('0x2f')](_0x44bcc9[_0x900e('0x2a')],_0x44bcc9[_0x900e('0x2b')]);_0x1c4435[_0x900e('0x2e')]=_[_0x900e('0x2f')](_0x44bcc9[_0x900e('0x2a')],qs[_0x900e('0x30')](_0x22d20e[_0x900e('0x2b')][_0x900e('0x30')]));_0x1c4435[_0x900e('0x2e')]=_0x1c4435[_0x900e('0x2e')]['length']?_0x1c4435['attributes']:_0x44bcc9[_0x900e('0x2a')];if(_0x22d20e[_0x900e('0x2b')][_0x900e('0x3d')]){_0x1c4435[_0x900e('0x3e')]=[{'all':!![]}];}_0x1c4435=_[_0x900e('0x38')]({},_0x1c4435,_0x22d20e[_0x900e('0x3b')]);return db[_0x900e('0x3c')][_0x900e('0x42')](_0x1c4435)[_0x900e('0x20')](handleEntityNotFound(_0x358bc0,null))[_0x900e('0x20')](respondWithResult(_0x358bc0,null))['catch'](handleError(_0x358bc0,null));};exports[_0x900e('0x43')]=function(_0x280462,_0x47d12f){return db[_0x900e('0x3c')]['create'](_0x280462[_0x900e('0x44')],{})['then'](respondWithResult(_0x47d12f,0xc9))['catch'](handleError(_0x47d12f,null));};exports['update']=function(_0x1299b6,_0x49a3ec){if(_0x1299b6[_0x900e('0x44')]['id']){delete _0x1299b6[_0x900e('0x44')]['id'];}return db[_0x900e('0x3c')][_0x900e('0x42')]({'where':{'id':_0x1299b6[_0x900e('0x45')]['id']}})['then'](handleEntityNotFound(_0x49a3ec,null))[_0x900e('0x20')](saveUpdates(_0x1299b6[_0x900e('0x44')],null))[_0x900e('0x20')](respondWithResult(_0x49a3ec,null))[_0x900e('0x40')](handleError(_0x49a3ec,null));};exports[_0x900e('0x21')]=function(_0x9ec12b,_0x3ea5bb){return db[_0x900e('0x3c')][_0x900e('0x42')]({'where':{'id':_0x9ec12b[_0x900e('0x45')]['id']}})[_0x900e('0x20')](handleEntityNotFound(_0x3ea5bb,null))[_0x900e('0x20')](removeEntity(_0x3ea5bb,null))['catch'](handleError(_0x3ea5bb,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 1507875..f5a60c0 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 _0xd3a0=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','define','WhatsappApplication','whatsapp_applications','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x29fcea,_0x257199){var _0x243673=function(_0x182f2c){while(--_0x182f2c){_0x29fcea['push'](_0x29fcea['shift']());}};_0x243673(++_0x257199);}(_0xd3a0,0xde));var _0x0d3a=function(_0x252eb5,_0x585fc5){_0x252eb5=_0x252eb5-0x0;var _0xc3e372=_0xd3a0[_0x252eb5];return _0xc3e372;};'use strict';var _=require(_0x0d3a('0x0'));var util=require('util');var logger=require(_0x0d3a('0x1'))(_0x0d3a('0x2'));var moment=require(_0x0d3a('0x3'));var BPromise=require(_0x0d3a('0x4'));var rp=require(_0x0d3a('0x5'));var fs=require('fs');var path=require(_0x0d3a('0x6'));var rimraf=require(_0x0d3a('0x7'));var config=require(_0x0d3a('0x8'));var attributes=require(_0x0d3a('0x9'));module['exports']=function(_0x1000df,_0xbb01ff){return _0x1000df[_0x0d3a('0xa')](_0x0d3a('0xb'),attributes,{'tableName':_0x0d3a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0d3a('0xd')});}; \ No newline at end of file +var _0x904c=['./whatsappApplication.attributes','exports','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0xfd9b19,_0x21d75f){var _0x514918=function(_0x52e212){while(--_0x52e212){_0xfd9b19['push'](_0xfd9b19['shift']());}};_0x514918(++_0x21d75f);}(_0x904c,0xc9));var _0xc904=function(_0x141acc,_0x524330){_0x141acc=_0x141acc-0x0;var _0x3e6ae3=_0x904c[_0x141acc];return _0x3e6ae3;};'use strict';var _=require(_0xc904('0x0'));var util=require('util');var logger=require(_0xc904('0x1'))(_0xc904('0x2'));var moment=require(_0xc904('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc904('0x4'));var rimraf=require(_0xc904('0x5'));var config=require(_0xc904('0x6'));var attributes=require(_0xc904('0x7'));module[_0xc904('0x8')]=function(_0x39a40f,_0x19c68c){return _0x39a40f['define'](_0xc904('0x9'),attributes,{'tableName':_0xc904('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc904('0xb'),'collate':_0xc904('0xc')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 82be707..99c837c 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 _0x04f9=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x04f9,0xb3));var _0x904f=function(_0x10e5c4,_0x4800f3){_0x10e5c4=_0x10e5c4-0x0;var _0x2b522a=_0x04f9[_0x10e5c4];return _0x2b522a;};'use strict';var _=require('lodash');var util=require(_0x904f('0x0'));var moment=require(_0x904f('0x1'));var BPromise=require(_0x904f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x904f('0x3'));var db=require(_0x904f('0x4'))['db'];var utils=require(_0x904f('0x5'));var logger=require(_0x904f('0x6'))(_0x904f('0x7'));var config=require(_0x904f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x904f('0x9')][_0x904f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x175c38,_0x21dce4,_0x34cbd7){return new BPromise(function(_0x506239,_0xa90c3f){return client[_0x904f('0xb')](_0x175c38,_0x34cbd7)[_0x904f('0xc')](function(_0x4f8d32){logger[_0x904f('0xd')](_0x904f('0xe'),_0x21dce4,_0x904f('0xf'));logger[_0x904f('0x10')](_0x904f('0x11'),_0x21dce4,_0x904f('0xf'),JSON[_0x904f('0x12')](_0x4f8d32));if(_0x4f8d32[_0x904f('0x13')]){if(_0x4f8d32[_0x904f('0x13')][_0x904f('0x14')]===0x1f4){logger[_0x904f('0x13')](_0x904f('0xe'),_0x21dce4,_0x4f8d32[_0x904f('0x13')][_0x904f('0x15')]);return _0xa90c3f(_0x4f8d32[_0x904f('0x13')][_0x904f('0x15')]);}logger[_0x904f('0x13')](_0x904f('0xe'),_0x21dce4,_0x4f8d32[_0x904f('0x13')][_0x904f('0x15')]);return _0x506239(_0x4f8d32[_0x904f('0x13')][_0x904f('0x15')]);}else{logger[_0x904f('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x21dce4,'request\x20sent');_0x506239(_0x4f8d32[_0x904f('0x16')][_0x904f('0x15')]);}})['catch'](function(_0x58c4d6){logger['error'](_0x904f('0xe'),_0x21dce4,_0x58c4d6);_0xa90c3f(_0x58c4d6);});});} \ No newline at end of file +var _0x2e88=['then','info','WhatsappApplication,\x20%s,\x20%s','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x2e88,0x95));var _0x82e8=function(_0x2ae2ad,_0xac5b0c){_0x2ae2ad=_0x2ae2ad-0x0;var _0x26dbd7=_0x2e88[_0x2ae2ad];return _0x26dbd7;};'use strict';var _=require(_0x82e8('0x0'));var util=require(_0x82e8('0x1'));var moment=require(_0x82e8('0x2'));var BPromise=require(_0x82e8('0x3'));var rs=require(_0x82e8('0x4'));var fs=require('fs');var Redis=require(_0x82e8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x82e8('0x6'));var logger=require(_0x82e8('0x7'))('rpc');var config=require(_0x82e8('0x8'));var jayson=require(_0x82e8('0x9'));var client=jayson['client'][_0x82e8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e2496,_0x3db496,_0x27df44){return new BPromise(function(_0x393c2c,_0x1ecc8f){return client[_0x82e8('0xb')](_0x1e2496,_0x27df44)[_0x82e8('0xc')](function(_0x80019f){logger[_0x82e8('0xd')](_0x82e8('0xe'),_0x3db496,'request\x20sent');logger[_0x82e8('0xf')](_0x82e8('0x10'),_0x3db496,_0x82e8('0x11'),JSON[_0x82e8('0x12')](_0x80019f));if(_0x80019f[_0x82e8('0x13')]){if(_0x80019f[_0x82e8('0x13')][_0x82e8('0x14')]===0x1f4){logger['error'](_0x82e8('0xe'),_0x3db496,_0x80019f[_0x82e8('0x13')][_0x82e8('0x15')]);return _0x1ecc8f(_0x80019f[_0x82e8('0x13')][_0x82e8('0x15')]);}logger['error'](_0x82e8('0xe'),_0x3db496,_0x80019f[_0x82e8('0x13')][_0x82e8('0x15')]);return _0x393c2c(_0x80019f[_0x82e8('0x13')]['message']);}else{logger[_0x82e8('0xd')](_0x82e8('0xe'),_0x3db496,_0x82e8('0x11'));_0x393c2c(_0x80019f[_0x82e8('0x16')][_0x82e8('0x15')]);}})['catch'](function(_0x39e7bc){logger[_0x82e8('0x13')]('WhatsappApplication,\x20%s,\x20%s',_0x3db496,_0x39e7bc);_0x1ecc8f(_0x39e7bc);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 4301077..3244962 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 _0x3e84=['destroy','removeTags','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','describe','show','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','/:id','delete','whatsappinteraction:destroy'];(function(_0x566438,_0x3abb6a){var _0x2d8c26=function(_0x9ac951){while(--_0x9ac951){_0x566438['push'](_0x566438['shift']());}};_0x2d8c26(++_0x3abb6a);}(_0x3e84,0xd4));var _0x43e8=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x3e84[_0x173d7e];return _0x2220d6;};'use strict';var multer=require('multer');var util=require(_0x43e8('0x0'));var path=require(_0x43e8('0x1'));var timeout=require(_0x43e8('0x2'));var express=require(_0x43e8('0x3'));var router=express[_0x43e8('0x4')]();var auth=require(_0x43e8('0x5'));var interaction=require(_0x43e8('0x6'));var config=require(_0x43e8('0x7'));var controller=require(_0x43e8('0x8'));router[_0x43e8('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x43e8('0x9')]('/describe',auth[_0x43e8('0xa')](),controller[_0x43e8('0xb')]);router[_0x43e8('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x43e8('0xc')]);router[_0x43e8('0x9')](_0x43e8('0xd'),auth[_0x43e8('0xa')](),controller['getMessages']);router[_0x43e8('0x9')](_0x43e8('0xe'),auth[_0x43e8('0xa')](),controller[_0x43e8('0xf')]);router[_0x43e8('0x10')]('/',auth[_0x43e8('0xa')](),controller[_0x43e8('0x11')]);router['post'](_0x43e8('0xd'),auth[_0x43e8('0xa')](),controller[_0x43e8('0x12')]);router[_0x43e8('0x10')](_0x43e8('0x13'),auth['isAuthenticated'](),interaction[_0x43e8('0x14')](_0x43e8('0x15'),_0x43e8('0x16')),controller[_0x43e8('0x17')]);router[_0x43e8('0x18')](_0x43e8('0x19'),auth[_0x43e8('0xa')](),interaction[_0x43e8('0x14')](_0x43e8('0x15'),'whatsappinteraction:update'),controller['update']);router[_0x43e8('0x1a')](_0x43e8('0x19'),auth[_0x43e8('0xa')](),interaction['tracked'](_0x43e8('0x15'),_0x43e8('0x1b')),controller[_0x43e8('0x1c')]);router[_0x43e8('0x1a')]('/:id/tags',auth['isAuthenticated'](),controller[_0x43e8('0x1d')]);module['exports']=router; \ No newline at end of file +var _0xf864=['show','/:id/messages','getMessages','/:id/download','post','addMessage','tracked','whatsappinteraction:addtags','addTags','put','/:id','update','delete','whatsapp','whatsappinteraction:destroy','/:id/tags','exports','multer','path','connect-timeout','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe'];(function(_0x33dea5,_0x4b2b54){var _0x49d63c=function(_0x3be0a5){while(--_0x3be0a5){_0x33dea5['push'](_0x33dea5['shift']());}};_0x49d63c(++_0x4b2b54);}(_0xf864,0x11f));var _0x4f86=function(_0x32d015,_0x76b26d){_0x32d015=_0x32d015-0x0;var _0x2dc686=_0xf864[_0x32d015];return _0x2dc686;};'use strict';var multer=require(_0x4f86('0x0'));var util=require('util');var path=require(_0x4f86('0x1'));var timeout=require(_0x4f86('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x4f86('0x3'));var config=require(_0x4f86('0x4'));var controller=require(_0x4f86('0x5'));router[_0x4f86('0x6')]('/',auth[_0x4f86('0x7')](),controller[_0x4f86('0x8')]);router[_0x4f86('0x6')](_0x4f86('0x9'),auth[_0x4f86('0x7')](),controller['describe']);router[_0x4f86('0x6')]('/:id',auth[_0x4f86('0x7')](),controller[_0x4f86('0xa')]);router[_0x4f86('0x6')](_0x4f86('0xb'),auth[_0x4f86('0x7')](),controller[_0x4f86('0xc')]);router[_0x4f86('0x6')](_0x4f86('0xd'),auth[_0x4f86('0x7')](),controller['download']);router[_0x4f86('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4f86('0xe')](_0x4f86('0xb'),auth[_0x4f86('0x7')](),controller[_0x4f86('0xf')]);router[_0x4f86('0xe')]('/:id/tags',auth[_0x4f86('0x7')](),interaction[_0x4f86('0x10')]('whatsapp',_0x4f86('0x11')),controller[_0x4f86('0x12')]);router[_0x4f86('0x13')](_0x4f86('0x14'),auth[_0x4f86('0x7')](),interaction[_0x4f86('0x10')]('whatsapp','whatsappinteraction:update'),controller[_0x4f86('0x15')]);router[_0x4f86('0x16')](_0x4f86('0x14'),auth['isAuthenticated'](),interaction[_0x4f86('0x10')](_0x4f86('0x17'),_0x4f86('0x18')),controller['destroy']);router[_0x4f86('0x16')](_0x4f86('0x19'),auth[_0x4f86('0x7')](),controller['removeTags']);module[_0x4f86('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index f76984f..3800d3a 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 _0xd791=['moment','exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xd791,0xc7));var _0x1d79=function(_0x25c57f,_0x30ca62){_0x25c57f=_0x25c57f-0x0;var _0x1e77d2=_0xd791[_0x25c57f];return _0x1e77d2;};'use strict';var Sequelize=require(_0x1d79('0x0'));var moment=require(_0x1d79('0x1'));module[_0x1d79('0x2')]={'closed':{'type':Sequelize[_0x1d79('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1d79('0x4')]},'disposition':{'type':Sequelize[_0x1d79('0x5')]},'note':{'type':Sequelize[_0x1d79('0x5')]},'phone':{'type':Sequelize[_0x1d79('0x5')]},'read1stAt':{'type':Sequelize[_0x1d79('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x1d79('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1d79('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x1d79('0x6')]('in',_0x1d79('0x7')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x7e9b=['exports','BOOLEAN','STRING','ENUM','out','DATE','sequelize','moment'];(function(_0x5528b5,_0x4bdb02){var _0x1d2d15=function(_0x56595c){while(--_0x56595c){_0x5528b5['push'](_0x5528b5['shift']());}};_0x1d2d15(++_0x4bdb02);}(_0x7e9b,0xe6));var _0xb7e9=function(_0x23a95e,_0x97e9f4){_0x23a95e=_0x23a95e-0x0;var _0x1084bd=_0x7e9b[_0x23a95e];return _0x1084bd;};'use strict';var Sequelize=require(_0xb7e9('0x0'));var moment=require(_0xb7e9('0x1'));module[_0xb7e9('0x2')]={'closed':{'type':Sequelize[_0xb7e9('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xb7e9('0x4')]},'note':{'type':Sequelize[_0xb7e9('0x4')]},'phone':{'type':Sequelize[_0xb7e9('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xb7e9('0x5')]('in',_0xb7e9('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb7e9('0x7')]},'lastMsgDirection':{'type':Sequelize[_0xb7e9('0x5')]('in',_0xb7e9('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 49d31f6..67f2db8 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 _0x814b=['index','rawAttributes','type','key','model','query','intersection','attributes','length','nolimit','limit','order','sort','filters','select','field','color','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','whatsapp_accounts','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','union','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','body','keys','some','compact','WhatsappAccountId','where','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$lte','\x20IS\x20NULL','\x20=\x20?','`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)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','isEmpty','t.id\x20IN\x20?','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','getWhatsappAccounts','toString','count','sequelize','fields','a.key','Account.key','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','Contact.phone','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','groupBy','all','rows','show','params','WhatsappInteraction','includeAll','merge','options','create','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','hasOwnProperty','WhatsappInteractionId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','spread','emit','whatsappInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','User','fullname','Contact','firstName','lastName','Attachment','Messages','direction','secret','read','WhatsappAccount','Account','Owner','get','mkdirSync','10px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Whatsapp','YYYY-MM-DD','closedAt','disposition','existsSync','basename','out','System','renderFile','downloadInteraction.html','toFile','transcript-','.pdf','log','unlinkSync','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','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','map','TagIds','split','forEach','push','catch'];(function(_0xdcca9a,_0x3822d9){var _0x6052fe=function(_0x5227a1){while(--_0x5227a1){_0xdcca9a['push'](_0xdcca9a['shift']());}};_0x6052fe(++_0x3822d9);}(_0x814b,0x1a2));var _0xb814=function(_0x115d5b,_0x26aff2){_0x115d5b=_0x115d5b-0x0;var _0x6cfc50=_0x814b[_0x115d5b];return _0x6cfc50;};'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'];config[_0xb814('0x1a')]=_[_0xb814('0x1b')](config[_0xb814('0x1a')],{'host':_0xb814('0x1c'),'port':0x18eb});var socket=require(_0xb814('0x1d'))(new Redis(config[_0xb814('0x1a')]));require(_0xb814('0x1e'))[_0xb814('0x1f')](socket);function respondWithStatusCode(_0x2ab627,_0x3f4881){_0x3f4881=_0x3f4881||0xcc;return function(_0x44fb96){if(_0x44fb96){return _0x2ab627[_0xb814('0x20')](_0x3f4881);}return _0x2ab627[_0xb814('0x21')](_0x3f4881)[_0xb814('0x22')]();};}function respondWithResult(_0x3a71d6,_0x45e0d0){_0x45e0d0=_0x45e0d0||0xc8;return function(_0x265a83){if(_0x265a83){return _0x3a71d6[_0xb814('0x21')](_0x45e0d0)[_0xb814('0x23')](_0x265a83);}};}function respondWithFilteredResult(_0x7a21ef,_0x48c9df){return function(_0x168a48){if(_0x168a48){var _0x55ba16=_0x168a48['count'],_0x270598=_0x48c9df['offset'],_0xfac75b=_0x48c9df[_0xb814('0x24')]+_0x48c9df['limit'],_0x4c3007;if(_0xfac75b>=_0x55ba16){_0xfac75b=_0x55ba16;_0x4c3007=0xc8;}else{_0x4c3007=0xce;}_0x7a21ef['status'](_0x4c3007);return _0x7a21ef[_0xb814('0x25')](_0xb814('0x26'),_0x270598+'-'+_0xfac75b+'/'+_0x55ba16)[_0xb814('0x23')](_0x168a48);}return null;};}function patchUpdates(_0x4e139e){return function(_0xf5b8aa){try{jsonpatch['apply'](_0xf5b8aa,_0x4e139e,!![]);}catch(_0x1e6393){return BPromise[_0xb814('0x27')](_0x1e6393);}return _0xf5b8aa[_0xb814('0x28')]();};}function saveUpdates(_0x470e81,_0x27352e){return function(_0x2bd039){if(_0x2bd039){return _0x2bd039[_0xb814('0x29')](_0x470e81)['then'](function(_0x2ead86){return _0x2ead86;});}return null;};}function removeEntity(_0x52b7a3,_0x3f81d0){return function(_0x457dac){if(_0x457dac){return _0x457dac[_0xb814('0x2a')]()[_0xb814('0x2b')](function(){_0x52b7a3[_0xb814('0x21')](0xcc)[_0xb814('0x22')]();});}};}function handleEntityNotFound(_0x3d836c,_0x5755ea){return function(_0x392222){if(!_0x392222){_0x3d836c[_0xb814('0x20')](0x194);}return _0x392222;};}function handleError(_0x1c2625,_0x349394){_0x349394=_0x349394||0x1f4;return function(_0x32ed56){logger[_0xb814('0x2c')](_0x32ed56[_0xb814('0x2d')]);if(_0x32ed56[_0xb814('0x2e')]){delete _0x32ed56['name'];}_0x1c2625[_0xb814('0x21')](_0x349394)[_0xb814('0x2f')](_0x32ed56);};}function getInteractionUsers(_0x52ed64,_0x9008b2){return new BPromise(function(_0x37d24d,_0x530744){try{if(_0x9008b2[_0x52ed64['id']]){_0x52ed64['Users']=_[_0xb814('0x30')](_0x9008b2[_0x52ed64['id']],function(_0x2051d0){return{'id':_0x2051d0['id'],'fullname':_0x2051d0['fullname']};});}}catch(_0x338a28){_0x530744(_0x338a28);}_0x37d24d(_0x52ed64);});}function getInteractionTags(_0x526610,_0x6efe9a){return new BPromise(function(_0x5f3e9b,_0x4cfc58){try{if(_0x526610[_0xb814('0x31')]){_0x526610['Tags']=[];_0x526610[_0xb814('0x31')][_0xb814('0x32')](',')[_0xb814('0x33')](function(_0x599f9f){_0x526610['Tags'][_0xb814('0x34')](_0x6efe9a[_0x599f9f]);});}delete _0x526610[_0xb814('0x31')];}catch(_0x523566){_0x4cfc58(_0x523566);}_0x5f3e9b(_0x526610);});}function updateWhatsappInteraction(_0x2c8943,_0xe558d5,_0x692c72){return new BPromise(function(_0x217b7e,_0x1b78de){return getInteractionUsers(_0x2c8943,_0x692c72)[_0xb814('0x2b')](function(_0x3672f3){return getInteractionTags(_0x3672f3,_0xe558d5);})['then'](function(_0x3207ec){_0x217b7e(_0x3207ec);})[_0xb814('0x35')](function(_0x30de5a){_0x1b78de(_0x30de5a);});});}exports[_0xb814('0x36')]=function(_0x14100d,_0x4ff31a){var _0x16ef82={},_0x57e6e6={},_0x43db67={'count':0x0,'rows':[]};var _0x16e21c=_[_0xb814('0x30')](db['WhatsappInteraction'][_0xb814('0x37')],function(_0xbdb3e9){return{'name':_0xbdb3e9['fieldName'],'type':_0xbdb3e9[_0xb814('0x38')][_0xb814('0x39')]};});_0x57e6e6[_0xb814('0x3a')]=_[_0xb814('0x30')](_0x16e21c,_0xb814('0x2e'));_0x57e6e6[_0xb814('0x3b')]=_['keys'](_0x14100d[_0xb814('0x3b')]);_0x57e6e6['filters']=_[_0xb814('0x3c')](_0x57e6e6['model'],_0x57e6e6[_0xb814('0x3b')]);_0x16ef82['attributes']=_[_0xb814('0x3c')](_0x57e6e6[_0xb814('0x3a')],qs['fields'](_0x14100d['query']['fields']));_0x16ef82['attributes']=_0x16ef82[_0xb814('0x3d')][_0xb814('0x3e')]?_0x16ef82[_0xb814('0x3d')]:_0x57e6e6[_0xb814('0x3a')];if(!_0x14100d['query']['hasOwnProperty'](_0xb814('0x3f'))){_0x16ef82['limit']=qs[_0xb814('0x40')](_0x14100d[_0xb814('0x3b')][_0xb814('0x40')]);_0x16ef82[_0xb814('0x24')]=qs[_0xb814('0x24')](_0x14100d[_0xb814('0x3b')][_0xb814('0x24')]);}_0x16ef82[_0xb814('0x41')]=qs[_0xb814('0x42')](_0x14100d['query']['sort']);_0x16ef82['where']=qs[_0xb814('0x43')](_['pick'](_0x14100d[_0xb814('0x3b')],_0x57e6e6['filters']),_0x16e21c);var _0x411723=[];var _0x44ff56=squel[_0xb814('0x44')]()[_0xb814('0x45')]('id')['field'](_0xb814('0x2e'))[_0xb814('0x45')](_0xb814('0x46'))[_0xb814('0x47')](_0xb814('0x48'));var _0x450a08=squel['select']()[_0xb814('0x45')](_0xb814('0x49'))[_0xb814('0x45')](_0xb814('0x4a'))[_0xb814('0x45')](_0xb814('0x4b'))[_0xb814('0x47')]('user_has_whatsapp_interactions','ui')['left_join'](_0xb814('0x4c'),'u',_0xb814('0x4d'));var _0x4c08d6=squel[_0xb814('0x44')]()[_0xb814('0x47')](_0xb814('0x4e'),'i')[_0xb814('0x4f')](_0xb814('0x50'),'c',_0xb814('0x51'))[_0xb814('0x4f')](_0xb814('0x4c'),'o','o.id\x20=\x20i.UserId')[_0xb814('0x4f')](_0xb814('0x52'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0xb814('0x4f')]('whatsapp_messages','me',_0xb814('0x53'))[_0xb814('0x4f')](_0xb814('0x54'),'it',_0xb814('0x55'))[_0xb814('0x4f')](_0xb814('0x48'),'t',_0xb814('0x56'));var _0x45480e=squel[_0xb814('0x57')]();var _0x2a422a=[];var _0x5e6df7=squel['expr']();var _0x32eca6;if(_0x14100d[_0xb814('0x3b')][_0xb814('0x58')]){_0x32eca6=as[_0xb814('0x59')](_0x14100d[_0xb814('0x3b')][_0xb814('0x58')]);var _0x135208=_0x32eca6['sqlOperator'];for(var _0x26fd0b=0x0;_0x26fd0b<_0x32eca6[_0xb814('0x5a')][_0xb814('0x3e')];_0x26fd0b++){var _0x5a916d=_0x32eca6[_0xb814('0x5a')][_0x26fd0b];var _0x4e6f3c='i';var _0x252293=_['find'](_0x16e21c,[_0xb814('0x2e'),_0x5a916d[_0xb814('0x45')]]);if(!_0x252293){switch(_0x5a916d['field']){case _0xb814('0x5b'):if(_0x5a916d[_0xb814('0x5c')]==0x1){_0x4c08d6[_0xb814('0x5d')]('`'+_0x5a916d['field']+_0xb814('0x5e'));}else{_0x4c08d6['having']('`'+_0x5a916d[_0xb814('0x45')]+_0xb814('0x5f'));}break;case'Contact':if(_0x5a916d[_0xb814('0x60')]==='$substring'){if(_0x5a916d['value'][_0xb814('0x32')]('\x20')[_0xb814('0x3e')]>0x1){_0x45480e[_0x135208](_0xb814('0x61'),qs['getFullTextValue'](_0x5a916d[_0xb814('0x5c')]),null);}else{var _0x538b0f='%'+_0x5a916d[_0xb814('0x5c')]+'%';_0x45480e[_0x135208](_0xb814('0x62'),_0x538b0f,_0x538b0f,_0x538b0f);}}else{_0x252293=_['find'](_0x16e21c,[_0xb814('0x2e'),'ContactId']);_0x5a916d[_0xb814('0x45')]=_0xb814('0x63');_0x135e13=as[_0xb814('0x64')](_0x4e6f3c,_0x252293[_0xb814('0x38')],_0x5a916d);_0x45480e[_0x135208](_0x135e13[_0xb814('0x65')],_0x135e13[_0xb814('0x5c')][_0xb814('0x66')],_0x135e13[_0xb814('0x5c')]['end']);}break;case _0xb814('0x67'):var _0x5441c5=_0x5a916d['value'][_0xb814('0x32')](',')[_0xb814('0x30')](function(_0x4d13db){return Number(_0x4d13db);});_0x5441c5[_0xb814('0x33')](function(_0x58b9a6){_0x5e6df7['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x58b9a6+',%');});_0x2a422a=_[_0xb814('0x68')](_0x2a422a,_0x5441c5);break;case'User':if(_0x5a916d[_0xb814('0x60')]===_0xb814('0x69')){_0x45480e[_0x135208](_0xb814('0x6a'),'%'+_0x5a916d['value']+'%',null);}else{_0x252293=_[_0xb814('0x6b')](_0x16e21c,['name',_0xb814('0x6c')]);_0x5a916d[_0xb814('0x45')]=_0xb814('0x6c');_0x135e13=as[_0xb814('0x64')](_0x4e6f3c,_0x252293[_0xb814('0x38')],_0x5a916d);_0x45480e[_0x135208](_0x135e13[_0xb814('0x65')],_0x135e13[_0xb814('0x5c')][_0xb814('0x66')],_0x135e13[_0xb814('0x5c')]['end']);}break;case _0xb814('0x6d'):_0x135e13=as[_0xb814('0x64')]('me',null,_0x5a916d);_0x45480e[_0x135208](_0x135e13[_0xb814('0x65')],_0x135e13[_0xb814('0x5c')][_0xb814('0x66')],_0x135e13[_0xb814('0x5c')]['end']);break;}}else{var _0x135e13=as['buildExpression'](_0x4e6f3c,_0x252293[_0xb814('0x38')],_0x5a916d);_0x45480e[_0x135208](_0x135e13[_0xb814('0x65')],_0x135e13[_0xb814('0x5c')]['start'],_0x135e13[_0xb814('0x5c')]['end']);}}}else{var _0x37e9c5=_(_0x14100d['query'])[_0xb814('0x6e')]()[_0xb814('0x30')](function(_0xa03cd2){return _[_0xb814('0x6f')](_0x16e21c,[_0xb814('0x2e'),_0xa03cd2])?_0xa03cd2:undefined;})[_0xb814('0x70')]()[_0xb814('0x5c')]();if(!_['isEmpty'](_0x37e9c5)){_0x37e9c5[_0xb814('0x33')](function(_0x51ca51){if(_0x51ca51===_0xb814('0x71')){_0x4c08d6[_0xb814('0x72')](_0xb814('0x73'),[][_0xb814('0x74')](_0x14100d[_0xb814('0x3b')][_0x51ca51]));}else if(_0x51ca51===_0xb814('0x75')){var _0x514dab=JSON[_0xb814('0x76')](_0x14100d[_0xb814('0x3b')][_0x51ca51])['$gte'];var _0x3bb2b4=JSON[_0xb814('0x76')](_0x14100d[_0xb814('0x3b')][_0x51ca51])[_0xb814('0x77')];_0x4c08d6[_0xb814('0x72')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x514dab,_0x3bb2b4);}else{if(_0x14100d[_0xb814('0x3b')][_0x51ca51]==='null'){_0x4c08d6[_0xb814('0x72')]('i.'+_0x51ca51+_0xb814('0x78'));}else{_0x4c08d6[_0xb814('0x72')]('i.'+_0x51ca51+_0xb814('0x79'),_0x14100d[_0xb814('0x3b')][_0x51ca51]);}}});}if(_0x14100d[_0xb814('0x3b')]['read']){if(_0x14100d['query']['read']==0x1){_0x4c08d6[_0xb814('0x5d')]('`unreadMessages`\x20=\x200');}else{_0x4c08d6[_0xb814('0x5d')](_0xb814('0x7a'));}}if(_0x14100d[_0xb814('0x3b')]['tag']){_0x2a422a=_[_0xb814('0x7b')](_0x14100d[_0xb814('0x3b')][_0xb814('0x7c')])?_0x14100d['query'][_0xb814('0x7c')]:new Array(_0x14100d[_0xb814('0x3b')][_0xb814('0x7c')]);_0x2a422a[_0xb814('0x33')](function(_0x555be0){_0x5e6df7['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x555be0+',%');});}if(_0x14100d[_0xb814('0x3b')][_0xb814('0x7d')]){var _0x39863d=_0x14100d[_0xb814('0x3b')][_0xb814('0x7d')][_0xb814('0x7e')]('\x5c','\x5c\x5c')[_0xb814('0x7e')]('\x27\x27',_0xb814('0x7f'));if(qs[_0xb814('0x80')](_0x39863d)){_0x45480e['or'](_0xb814('0x81'),_0x39863d+'%')['or'](_0xb814('0x82'),_0x39863d+'%');}else{_0x45480e['or'](_0xb814('0x83'),qs[_0xb814('0x84')](_0x39863d))['or'](_0xb814('0x85'),_0x39863d+'%');}}}_0x4c08d6[_0xb814('0x72')](_0x45480e);_0x4c08d6['group'](_0xb814('0x86'));var _0x33cfc4={'type':db[_0xb814('0x87')][_0xb814('0x88')][_0xb814('0x89')],'raw':!![]};var _0x283b0f=_0x4c08d6['clone']();_0x283b0f[_0xb814('0x45')]('i.id');_0x283b0f[_0xb814('0x45')](_0xb814('0x8a'),_0xb814('0x5b'));if(_0x16ef82[_0xb814('0x41')]){_0x16ef82[_0xb814('0x41')]['forEach'](function(_0x4c44ee){_0x4c08d6[_0xb814('0x41')]('i.'+_0x4c44ee[0x0],_0x4c44ee[0x1]===_0xb814('0x8b')?![]:!![]);});}if(!_[_0xb814('0x8c')](_0x2a422a)){_0x4c08d6[_0xb814('0x5d')](_0x5e6df7);_0x283b0f['where'](_0xb814('0x8d'),_0x2a422a);}BPromise['resolve']()[_0xb814('0x2b')](function(){if(!_0x32eca6){if(_0x14100d[_0xb814('0x3b')]['WhatsappAccountId']||_0x14100d['query'][_0xb814('0x8e')])return;_0x283b0f['where'](_0xb814('0x8f'));_0x4c08d6[_0xb814('0x72')](_0xb814('0x8f'));return;}return _0x14100d[_0xb814('0x90')][_0xb814('0x91')]({'attributes':['id'],'raw':!![]})[_0xb814('0x2b')](function(_0x40fe4a){if(_['isEmpty'](_0x40fe4a)){_0x283b0f[_0xb814('0x72')]('i.WhatsappAccountId\x20IS\x20NULL');_0x4c08d6[_0xb814('0x72')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x283b0f[_0xb814('0x72')](_0xb814('0x73'),_['map'](_0x40fe4a,'id'));_0x4c08d6[_0xb814('0x72')]('i.WhatsappAccountId\x20IN\x20?',_[_0xb814('0x30')](_0x40fe4a,'id'));}});})[_0xb814('0x2b')](function(){db['sequelize']['query'](_0x283b0f[_0xb814('0x92')](),_0x33cfc4)[_0xb814('0x2b')](function(_0x3309c5){_0x43db67[_0xb814('0x93')]=_0x3309c5[_0xb814('0x3e')];if(_0x43db67[_0xb814('0x93')]===0x0)return[];return db[_0xb814('0x94')][_0xb814('0x3b')](_0x44ff56[_0xb814('0x92')](),_0x33cfc4)[_0xb814('0x2b')](function(_0x53e705){_0x411723=_['keyBy'](_0x53e705,'id');_0x33cfc4=_['merge'](_0x33cfc4,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x14100d['query'][_0xb814('0x95')]){_0x16ef82[_0xb814('0x3d')][_0xb814('0x33')](function(_0x59f3ff){_0x4c08d6[_0xb814('0x45')]('i.'+_0x59f3ff);});}else{_0x4c08d6[_0xb814('0x45')](_0xb814('0x8a'),_0xb814('0x5b'));_0x4c08d6[_0xb814('0x45')](_0xb814('0x96'),_0xb814('0x97'));_0x4c08d6[_0xb814('0x45')]('a.mandatoryDisposition',_0xb814('0x98'));_0x4c08d6[_0xb814('0x45')](_0xb814('0x99'));_0x4c08d6[_0xb814('0x45')]('c.firstName',_0xb814('0x9a'));_0x4c08d6[_0xb814('0x45')](_0xb814('0x9b'),_0xb814('0x9c'));_0x4c08d6[_0xb814('0x45')]('c.email','Contact.email');_0x4c08d6[_0xb814('0x45')]('c.phone',_0xb814('0x9d'));_0x4c08d6[_0xb814('0x45')]('c.mobile',_0xb814('0x9e'));_0x4c08d6['field'](_0xb814('0x9f'),'Contact.fax');_0x4c08d6[_0xb814('0x45')](_0xb814('0xa0'),_0xb814('0xa1'));_0x4c08d6[_0xb814('0x45')](_0xb814('0xa2'),_0xb814('0xa3'));_0x4c08d6[_0xb814('0x45')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x16ef82[_0xb814('0x40')])_0x4c08d6['limit'](_0x16ef82['limit']);if(_0x16ef82[_0xb814('0x24')])_0x4c08d6[_0xb814('0x24')](_0x16ef82[_0xb814('0x24')]);return db['sequelize'][_0xb814('0x3b')](_0x4c08d6['toString'](),_0x33cfc4);})[_0xb814('0x2b')](function(_0x19d508){_0x450a08[_0xb814('0x72')](_0xb814('0xa4'),_['map'](_0x19d508,'id'));return db[_0xb814('0x94')][_0xb814('0x3b')](_0x450a08[_0xb814('0x92')](),_0x33cfc4)['then'](function(_0x1ebbf6){var _0x3fc77d=_[_0xb814('0xa5')](_0x1ebbf6,'WhatsappInteractionId');var _0x5d8626=[];_0x19d508[_0xb814('0x33')](function(_0x9dc06b){_0x5d8626[_0xb814('0x34')](updateWhatsappInteraction(_0x9dc06b,_0x411723,_0x3fc77d));});return BPromise[_0xb814('0xa6')](_0x5d8626);});});})[_0xb814('0x2b')](function(_0x37a7ab){_0x43db67[_0xb814('0xa7')]=_0x37a7ab;return _0x43db67;})[_0xb814('0x2b')](respondWithFilteredResult(_0x4ff31a,_0x16ef82));})[_0xb814('0x35')](handleError(_0x4ff31a,null));};exports[_0xb814('0xa8')]=function(_0x2569a5,_0x2a13fb){var _0x5b8d2e={'raw':![],'where':{'id':_0x2569a5[_0xb814('0xa9')]['id']}},_0x5416dc={};_0x5416dc['model']=_[_0xb814('0x6e')](db[_0xb814('0xaa')][_0xb814('0x37')]);_0x5416dc[_0xb814('0x3b')]=_[_0xb814('0x6e')](_0x2569a5[_0xb814('0x3b')]);_0x5416dc[_0xb814('0x43')]=_['intersection'](_0x5416dc['model'],_0x5416dc[_0xb814('0x3b')]);_0x5b8d2e['attributes']=_[_0xb814('0x3c')](_0x5416dc[_0xb814('0x3a')],qs[_0xb814('0x95')](_0x2569a5['query'][_0xb814('0x95')]));_0x5b8d2e[_0xb814('0x3d')]=_0x5b8d2e[_0xb814('0x3d')][_0xb814('0x3e')]?_0x5b8d2e[_0xb814('0x3d')]:_0x5416dc['model'];if(_0x2569a5[_0xb814('0x3b')][_0xb814('0xab')]){_0x5b8d2e['include']=[{'all':!![]}];}_0x5b8d2e=_[_0xb814('0xac')]({},_0x5b8d2e,_0x2569a5[_0xb814('0xad')]);return db[_0xb814('0xaa')]['find'](_0x5b8d2e)[_0xb814('0x2b')](handleEntityNotFound(_0x2a13fb,null))[_0xb814('0x2b')](respondWithResult(_0x2a13fb,null))['catch'](handleError(_0x2a13fb,null));};exports[_0xb814('0xae')]=function(_0x171f83,_0x5b5634){return db[_0xb814('0xaa')][_0xb814('0xae')](_0x171f83[_0xb814('0x6d')],{})[_0xb814('0x2b')](respondWithResult(_0x5b5634,0xc9))[_0xb814('0x35')](handleError(_0x5b5634,null));};exports[_0xb814('0x29')]=function(_0x40ae0b,_0x336a8f){if(_0x40ae0b[_0xb814('0x6d')]['id']){delete _0x40ae0b[_0xb814('0x6d')]['id'];}return db[_0xb814('0xaa')][_0xb814('0x6b')]({'where':{'id':_0x40ae0b['params']['id']}})['then'](handleEntityNotFound(_0x336a8f,null))[_0xb814('0x2b')](saveUpdates(_0x40ae0b['body'],null))['then'](respondWithResult(_0x336a8f,null))[_0xb814('0x35')](handleError(_0x336a8f,null));};exports['destroy']=function(_0x4f0427,_0x50cb34){return db[_0xb814('0xaa')][_0xb814('0x6b')]({'where':{'id':_0x4f0427[_0xb814('0xa9')]['id']}})['then'](handleEntityNotFound(_0x50cb34,null))[_0xb814('0x2b')](removeEntity(_0x50cb34,null))['catch'](handleError(_0x50cb34,null));};exports[_0xb814('0xaf')]=function(_0x2e6660,_0x49a8de){return db[_0xb814('0xaa')]['describe']()[_0xb814('0x2b')](respondWithResult(_0x49a8de,null))[_0xb814('0x35')](handleError(_0x49a8de,null));};exports[_0xb814('0xb0')]=function(_0x39ce17,_0x11efb8,_0xaf705d){return db[_0xb814('0xb1')][_0xb814('0x6b')]({'where':{'id':_0x39ce17[_0xb814('0xa9')]['id']}})[_0xb814('0x2b')](handleEntityNotFound(_0x11efb8,null))[_0xb814('0x2b')](function(_0x3e7a9a){if(_0x3e7a9a){return _0x3e7a9a[_0xb814('0xb0')](_0x39ce17[_0xb814('0x6d')][_0xb814('0xb2')],_['omit'](_0x39ce17[_0xb814('0x6d')],[_0xb814('0xb2'),'id'])||{});}})['then'](respondWithResult(_0x11efb8,null))[_0xb814('0x35')](handleError(_0x11efb8,null));};exports[_0xb814('0xb3')]=function(_0x1868d9,_0x570191,_0x56b2aa){var _0x473b30={'raw':![],'where':{}};var _0x4af71e={};var _0x2d40e6={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0xb814('0xb4')]({'where':{'id':_0x1868d9['params']['id']}})['then'](handleEntityNotFound(_0x570191,null))[_0xb814('0x2b')](function(_0x32c956){if(_0x32c956){_0x4af71e[_0xb814('0x3a')]=_[_0xb814('0x6e')](db[_0xb814('0xb1')][_0xb814('0x37')]);_0x4af71e[_0xb814('0x3b')]=_[_0xb814('0x6e')](_0x1868d9[_0xb814('0x3b')]);_0x4af71e[_0xb814('0x43')]=_[_0xb814('0x3c')](_0x4af71e['model'],_0x4af71e[_0xb814('0x3b')]);_0x473b30['attributes']=_[_0xb814('0x3c')](_0x4af71e[_0xb814('0x3a')],qs[_0xb814('0x95')](_0x1868d9['query'][_0xb814('0x95')]));_0x473b30[_0xb814('0x3d')]=_0x473b30[_0xb814('0x3d')][_0xb814('0x3e')]?_0x473b30[_0xb814('0x3d')]:_0x4af71e[_0xb814('0x3a')];if(!_0x1868d9[_0xb814('0x3b')][_0xb814('0xb5')](_0xb814('0x3f'))){_0x473b30[_0xb814('0x40')]=qs[_0xb814('0x40')](_0x1868d9[_0xb814('0x3b')][_0xb814('0x40')]);_0x473b30[_0xb814('0x24')]=qs[_0xb814('0x24')](_0x1868d9['query'][_0xb814('0x24')]);}_0x473b30[_0xb814('0x41')]=qs[_0xb814('0x42')](_0x1868d9['query']['sort']);_0x473b30[_0xb814('0x72')]=qs['filters'](_['pick'](_0x1868d9['query'],_0x4af71e['filters']));_0x473b30[_0xb814('0x72')][_0xb814('0xb6')]=_0x32c956['id'];if(_0x1868d9['query'][_0xb814('0x7d')]){_0x473b30[_0xb814('0x72')]=_[_0xb814('0xac')](_0x473b30[_0xb814('0x72')],{'$or':_[_0xb814('0x30')](_0x473b30[_0xb814('0x3d')],function(_0x20e608){var _0x7b9948={};_0x7b9948[_0x20e608]={'$like':'%'+_0x1868d9[_0xb814('0x3b')][_0xb814('0x7d')]+'%'};return _0x7b9948;})});}if(_0x1868d9[_0xb814('0x3b')]['$gte']){var _0x2a5dff=_0x1868d9['query'][_0xb814('0xb7')][_0xb814('0x32')](',');var _0x35e8f7={};_0x35e8f7[_0x2a5dff[0x0]]={'$gte':moment(_0x2a5dff[0x1])[_0xb814('0xb8')](_0xb814('0xb9'))};_0x473b30[_0xb814('0x72')]=_[_0xb814('0xac')](_0x473b30[_0xb814('0x72')],_0x35e8f7);}_0x473b30=_['merge']({},_0x473b30,_0x1868d9['options']);return db['WhatsappMessage'][_0xb814('0x93')]({'where':_0x473b30[_0xb814('0x72')]})[_0xb814('0x2b')](function(_0x3b7bee){_0x2d40e6[_0xb814('0x93')]=_0x3b7bee;if(_0x1868d9[_0xb814('0x3b')][_0xb814('0xab')]){_0x473b30[_0xb814('0xba')]=[{'all':!![]}];}return db[_0xb814('0xb1')][_0xb814('0xbb')](_0x473b30);})['then'](function(_0x5c989a){_0x2d40e6[_0xb814('0xa7')]=_0x5c989a;return _0x2d40e6;});}})[_0xb814('0x2b')](respondWithFilteredResult(_0x570191,_0x473b30))[_0xb814('0x35')](handleError(_0x570191,null));};exports[_0xb814('0xbc')]=function(_0x3f0c9c,_0x2642ab,_0x48358c){return db[_0xb814('0xaa')]['find']({'where':{'id':_0x3f0c9c[_0xb814('0xa9')]['id']}})[_0xb814('0x2b')](handleEntityNotFound(_0x2642ab,null))[_0xb814('0x2b')](function(_0x94aa05){if(_0x94aa05){return _0x94aa05[_0xb814('0xbd')](_0x3f0c9c[_0xb814('0x6d')][_0xb814('0xb2')],_['omit'](_0x3f0c9c[_0xb814('0x6d')],[_0xb814('0xb2'),'id'])||{})[_0xb814('0xbe')](function(){return db[_0xb814('0x67')]['findAll']({'attributes':['id',_0xb814('0x2e'),_0xb814('0x46')],'where':{'id':_0x3f0c9c[_0xb814('0x6d')][_0xb814('0xb2')]}});})[_0xb814('0x2b')](function(_0x4a2aa5){socket[_0xb814('0xbf')](_0xb814('0xc0'),{'id':Number(_0x3f0c9c[_0xb814('0xa9')]['id']),'tags':_0x4a2aa5||[]});return{'id':Number(_0x3f0c9c['params']['id']),'tags':_0x4a2aa5||[]};});}})[_0xb814('0x2b')](respondWithResult(_0x2642ab,null))['catch'](handleError(_0x2642ab,null));};exports[_0xb814('0xc1')]=function(_0x5b4315,_0x22f6f1,_0x3467bd){return db[_0xb814('0xaa')][_0xb814('0x6b')]({'where':{'id':_0x5b4315['params']['id']}})[_0xb814('0x2b')](handleEntityNotFound(_0x22f6f1,null))[_0xb814('0x2b')](function(_0x3fda0d){if(_0x3fda0d){return _0x3fda0d[_0xb814('0xc1')](_0x5b4315[_0xb814('0x3b')][_0xb814('0xb2')]);}})[_0xb814('0x2b')](respondWithStatusCode(_0x22f6f1,null))[_0xb814('0x35')](handleError(_0x22f6f1,null));};exports[_0xb814('0xc2')]=function(_0x152260,_0x3bc03a){var _0x368696=moment()[_0xb814('0xc3')]()[_0xb814('0x92')]();var _0x8e882a=path['join'](config[_0xb814('0xc4')],_0xb814('0xc5'),_0xb814('0xc6'),_0xb814('0xc7'));var _0x4017b6=path[_0xb814('0xc8')](config['root'],_0xb814('0xc5'),_0xb814('0xc6'),_0xb814('0xc9'));var _0x31b4f5=path['join'](_0x8e882a,_0x368696);var _0x5b5a26=util[_0xb814('0xb8')](_0xb814('0xca'),_0x152260[_0xb814('0xa9')]['id'],_0x368696);var _0x667ca1=path[_0xb814('0xc8')](_0x8e882a,_0x5b5a26);var _0x2c510a=[];_0x2c510a['push']({'model':db[_0xb814('0xcb')],'as':_0xb814('0xcb'),'attributes':['id',_0xb814('0xcc')],'raw':!![]});_0x2c510a[_0xb814('0x34')]({'model':db['CmContact'],'as':_0xb814('0xcd'),'attributes':['id',_0xb814('0xce'),_0xb814('0xcf')],'raw':!![]});if(_0x152260[_0xb814('0x3b')][_0xb814('0xc9')]){_0x2c510a['push']({'model':db[_0xb814('0xd0')],'as':_0xb814('0xd0'),'raw':!![]});}var _0x371dd7=[{'model':db[_0xb814('0xb1')],'as':_0xb814('0xd1'),'attributes':['id',_0xb814('0x6d'),_0xb814('0x75'),_0xb814('0xd2'),_0xb814('0xd3'),_0xb814('0xd4')],'include':_0x2c510a}];_0x371dd7[_0xb814('0x34')]({'model':db[_0xb814('0xd5')],'as':_0xb814('0xd6'),'attributes':['id','name']});_0x371dd7['push']({'model':db[_0xb814('0xcb')],'as':_0xb814('0xd7'),'attributes':['id',_0xb814('0xcc')]});return db['WhatsappInteraction'][_0xb814('0x6b')]({'where':{'id':_0x152260[_0xb814('0xa9')]['id']},'include':_0x371dd7})[_0xb814('0x2b')](handleEntityNotFound(_0x3bc03a,null))['then'](function(_0x10537d){if(_0x10537d){var _0xa651a=_0x10537d[_0xb814('0xd8')]({'plain':!![]});fs[_0xb814('0xd9')](_0x31b4f5);var _0x6ec0f5={'format':'A4','border':_0xb814('0xda'),'header':{'height':'40px','contents':{'first':_0xb814('0xdb')}},'footer':{'height':'30px','contents':{'default':util[_0xb814('0xb8')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\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[_0xb814('0xb8')](_0xb814('0xdc'),_0xb814('0xdd'),_0xa651a['id']),moment()['format'](_0xb814('0xde'))[_0xb814('0x92')]())}}};var _0x164304={'channel':'Whatsapp','account':_0xa651a[_0xb814('0xd6')]['name'],'agent':_0xa651a[_0xb814('0xd7')]?_0xa651a[_0xb814('0xd7')][_0xb814('0xcc')]:'N.A.','createdAt':moment(_0xa651a[_0xb814('0x75')])[_0xb814('0xb8')](_0xb814('0xb9'))[_0xb814('0x92')](),'closedAt':_0xa651a['closed']?moment(_0xa651a[_0xb814('0xdf')])[_0xb814('0xb8')](_0xb814('0xb9'))[_0xb814('0x92')]():'','disposition':_0xa651a[_0xb814('0xe0')],'messages':_(_0xa651a[_0xb814('0xd1')])[_0xb814('0x7d')]({'secret':![]})[_0xb814('0x30')](function(_0x9a33d0){if(_0x9a33d0['Attachment']){var _0x2fe47b=path[_0xb814('0xc8')](_0x4017b6,_0x9a33d0[_0xb814('0xd0')]['basename']);if(fs[_0xb814('0xe1')](_0x2fe47b)){fs['createReadStream'](_0x2fe47b)['pipe'](fs['createWriteStream'](path[_0xb814('0xc8')](_0x31b4f5,_0x9a33d0['Attachment'][_0xb814('0xe2')])));}}return{'date':moment(_0x9a33d0[_0xb814('0x75')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xb814('0x92')](),'sender':_0x9a33d0['direction']===_0xb814('0xe3')?_0x9a33d0['User']?_0x9a33d0[_0xb814('0xcb')][_0xb814('0xcc')]:_0xb814('0xe4'):_0x9a33d0['Contact']['firstName']+(_0x9a33d0['Contact'][_0xb814('0xcf')]?'\x20'+_0x9a33d0['Contact']['lastName']:''),'body':_0x9a33d0[_0xb814('0xd0')]?_0x9a33d0['Attachment']['basename']:_0x9a33d0['body'],'direction':_0x9a33d0[_0xb814('0xd2')]===_0xb814('0xe3')?'A':'C','secret':_0x9a33d0[_0xb814('0xd3')],'read':_0x9a33d0['read'],'attachment':_0x9a33d0[_0xb814('0xd0')]};})[_0xb814('0x5c')]()};return ejs[_0xb814('0xe5')](path[_0xb814('0xc8')](config[_0xb814('0xc4')],_0xb814('0xc5'),'views',_0xb814('0xe6')),{'interaction':_0x164304})[_0xb814('0x2b')](function(_0x28b818){return new BPromise(function(_0x171845,_0x4f2db2){pdf[_0xb814('0xae')](_0x28b818,_0x6ec0f5)[_0xb814('0xe7')](path[_0xb814('0xc8')](_0x31b4f5,_0xb814('0xe8')+_0xa651a['id']+'-'+_0x368696+_0xb814('0xe9')),function(_0x2cb01d,_0x1f4540){if(_0x2cb01d)return _0x4f2db2(_0x2cb01d);_0x171845(_0x1f4540);});});})[_0xb814('0x2b')](function(){return new BPromise(function(_0x81ebc0,_0x2e7959){zipdir(_0x31b4f5,{'saveTo':_0x667ca1},function(_0x47f054,_0x1aa70b){if(_0x47f054)return _0x2e7959(_0x47f054);return _0x81ebc0(_0x1aa70b);});})[_0xb814('0x2b')](function(){return new BPromise(function(_0x5706ad,_0x3b8438){rimraf(_0x31b4f5,function(_0x56e231){if(_0x56e231)_0x3b8438(_0x56e231);return _0x5706ad();});});})[_0xb814('0x2b')](function(){return _0x3bc03a[_0xb814('0xc2')](_0x667ca1,_0x5b5a26,function(_0x5e2273){if(_0x5e2273){console[_0xb814('0xea')]('err',_0x5e2273);}else{fs[_0xb814('0xeb')](_0x667ca1);}});});});}else{return _0x3bc03a[_0xb814('0x20')](0xc8);}})[_0xb814('0x35')](handleError(_0x3bc03a,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(_0x3d5591,_0x190e0c){var _0x520b55=function(_0x21c507){while(--_0x21c507){_0x3d5591['push'](_0x3d5591['shift']());}};_0x520b55(++_0x190e0c);}(_0xadb5,0xad));var _0x5adb=function(_0x5857f4,_0x26f207){_0x5857f4=_0x5857f4-0x0;var _0x2f4a58=_0xadb5[_0x5857f4];return _0x2f4a58;};'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 9d10116..3687fdf 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 _0x4d95=['remove','then','Users','map','findAll','unreadMessages','emit','catch','hook','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update'];(function(_0x11d97e,_0x5ada4e){var _0x5f4146=function(_0x1f0282){while(--_0x1f0282){_0x11d97e['push'](_0x11d97e['shift']());}};_0x5f4146(++_0x5ada4e);}(_0x4d95,0x1c9));var _0x54d9=function(_0x25d0c9,_0x593a72){_0x25d0c9=_0x25d0c9-0x0;var _0x30bc7c=_0x4d95[_0x25d0c9];return _0x30bc7c;};'use strict';var EventEmitter=require(_0x54d9('0x0'));var WhatsappInteraction=require(_0x54d9('0x1'))['db'][_0x54d9('0x2')];var WhatsappMessage=require('../../mysqldb')['db'][_0x54d9('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x54d9('0x4')](0x0);var events={'afterCreate':_0x54d9('0x5'),'afterUpdate':_0x54d9('0x6'),'afterDestroy':_0x54d9('0x7')};function emitEvent(_0x240e74){return function(_0x3844b3,_0x402083,_0x407460){_0x3844b3['getUsers']({'attributes':['id'],'raw':!![]})[_0x54d9('0x8')](function(_0x3e690f){_0x3844b3['setDataValue'](_0x54d9('0x9'),_0x3e690f[_0x54d9('0xa')](function(_0x53c342){return{'id':_0x53c342['id']};}));return WhatsappMessage[_0x54d9('0xb')]({'where':{'WhatsappInteractionId':_0x3844b3['id'],'direction':'in','read':![]},'raw':!![]});})[_0x54d9('0x8')](function(_0x51a270){_0x3844b3['setDataValue'](_0x54d9('0xc'),_0x51a270['length']);WhatsappInteractionEvents['emit'](_0x240e74+':'+_0x3844b3['id'],_0x3844b3);WhatsappInteractionEvents[_0x54d9('0xd')](_0x240e74,_0x3844b3);_0x407460(null);})[_0x54d9('0xe')](_0x407460(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x54d9('0xf')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0xa391=['map','findAll','setDataValue','unreadMessages','length','emit','hook','exports','../../mysqldb','WhatsappMessage','setMaxListeners','update','remove','getUsers','then','Users'];(function(_0x2f1ed4,_0x5b06cc){var _0x573cd3=function(_0x3736d7){while(--_0x3736d7){_0x2f1ed4['push'](_0x2f1ed4['shift']());}};_0x573cd3(++_0x5b06cc);}(_0xa391,0x138));var _0x1a39=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xa391[_0x50a0c2];return _0x5ebadd;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x1a39('0x0'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x1a39('0x0'))['db'][_0x1a39('0x1')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x1a39('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1a39('0x3'),'afterDestroy':_0x1a39('0x4')};function emitEvent(_0x348039){return function(_0x51941a,_0x5bc294,_0x529c87){_0x51941a[_0x1a39('0x5')]({'attributes':['id'],'raw':!![]})[_0x1a39('0x6')](function(_0x378546){_0x51941a['setDataValue'](_0x1a39('0x7'),_0x378546[_0x1a39('0x8')](function(_0x45b14d){return{'id':_0x45b14d['id']};}));return WhatsappMessage[_0x1a39('0x9')]({'where':{'WhatsappInteractionId':_0x51941a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1a39('0x6')](function(_0x522533){_0x51941a[_0x1a39('0xa')](_0x1a39('0xb'),_0x522533[_0x1a39('0xc')]);WhatsappInteractionEvents[_0x1a39('0xd')](_0x348039+':'+_0x51941a['id'],_0x51941a);WhatsappInteractionEvents[_0x1a39('0xd')](_0x348039,_0x51941a);_0x529c87(null);})['catch'](_0x529c87(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x1a39('0xe')](e,emitEvent(event));}}module[_0x1a39('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 7a72fe4..f55af8e 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 _0x21b7=['./whatsappInteraction.attributes','exports','whatsapp_interactions','changed','closed','closedAt','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2ec47f,_0x2d2d20){var _0xc0e5b5=function(_0x2462df){while(--_0x2462df){_0x2ec47f['push'](_0x2ec47f['shift']());}};_0xc0e5b5(++_0x2d2d20);}(_0x21b7,0x13a));var _0x721b=function(_0x3495a4,_0x5c962d){_0x3495a4=_0x3495a4-0x0;var _0x283ff9=_0x21b7[_0x3495a4];return _0x283ff9;};'use strict';var _=require('lodash');var util=require(_0x721b('0x0'));var logger=require(_0x721b('0x1'))(_0x721b('0x2'));var moment=require(_0x721b('0x3'));var BPromise=require(_0x721b('0x4'));var rp=require(_0x721b('0x5'));var fs=require('fs');var path=require(_0x721b('0x6'));var rimraf=require(_0x721b('0x7'));var config=require('../../config/environment');var attributes=require(_0x721b('0x8'));module[_0x721b('0x9')]=function(_0x4cd026,_0x16c664){return _0x4cd026['define']('WhatsappInteraction',attributes,{'tableName':_0x721b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x72b489,_0x44b097,_0x587b51){if(_0x72b489[_0x721b('0xb')](_0x721b('0xc'))){_0x72b489[_0x721b('0xd')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x587b51(null,_0x72b489);}}});}; \ No newline at end of file +var _0x52b3=['bluebird','path','rimraf','exports','WhatsappInteraction','whatsapp_interactions','changed','closed','util','../../config/logger','api','moment'];(function(_0x57f2d4,_0x32fef1){var _0x243649=function(_0x289159){while(--_0x289159){_0x57f2d4['push'](_0x57f2d4['shift']());}};_0x243649(++_0x32fef1);}(_0x52b3,0x1ac));var _0x352b=function(_0x222838,_0x256fb2){_0x222838=_0x222838-0x0;var _0x418261=_0x52b3[_0x222838];return _0x418261;};'use strict';var _=require('lodash');var util=require(_0x352b('0x0'));var logger=require(_0x352b('0x1'))(_0x352b('0x2'));var moment=require(_0x352b('0x3'));var BPromise=require(_0x352b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x352b('0x5'));var rimraf=require(_0x352b('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappInteraction.attributes');module[_0x352b('0x7')]=function(_0x35cf1f,_0x36ce67){return _0x35cf1f['define'](_0x352b('0x8'),attributes,{'tableName':_0x352b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x20428e,_0xeed351,_0x5c9fc7){if(_0x20428e[_0x352b('0xa')](_0x352b('0xb'))){_0x20428e['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x5c9fc7(null,_0x20428e);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 67c9e55..87abf28 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 _0x4f30=['catch','UpdateWhatsappInteraction','WhatsappInteraction','update','options','raw','where','attributes','limit','stringify','AddTagsToWhatsappInteraction','find','addTags','body','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','debug','request\x20sent','error','code','message'];(function(_0x4fe19c,_0x45d0fe){var _0x952ac7=function(_0x274a16){while(--_0x274a16){_0x4fe19c['push'](_0x4fe19c['shift']());}};_0x952ac7(++_0x45d0fe);}(_0x4f30,0x113));var _0x04f3=function(_0x38dc4a,_0x4a115d){_0x38dc4a=_0x38dc4a-0x0;var _0x433b9a=_0x4f30[_0x38dc4a];return _0x433b9a;};'use strict';var _=require(_0x04f3('0x0'));var util=require(_0x04f3('0x1'));var moment=require(_0x04f3('0x2'));var BPromise=require(_0x04f3('0x3'));var rs=require(_0x04f3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x04f3('0x5'))['db'];var utils=require(_0x04f3('0x6'));var logger=require(_0x04f3('0x7'))(_0x04f3('0x8'));var config=require(_0x04f3('0x9'));var jayson=require(_0x04f3('0xa'));var client=jayson[_0x04f3('0xb')][_0x04f3('0xc')]({'port':0x232a});config[_0x04f3('0xd')]=_[_0x04f3('0xe')](config[_0x04f3('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x04f3('0xf'))(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0x04f3('0x10')](socket);function respondWithRpcPromise(_0x580886,_0x16a30b,_0x2c6f78){return new BPromise(function(_0xd4657c,_0x5c3b41){return client[_0x04f3('0x11')](_0x580886,_0x2c6f78)[_0x04f3('0x12')](function(_0x2c55fd){logger[_0x04f3('0x13')](_0x04f3('0x14'),_0x16a30b,'request\x20sent');logger[_0x04f3('0x15')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x16a30b,_0x04f3('0x16'),JSON['stringify'](_0x2c55fd));if(_0x2c55fd[_0x04f3('0x17')]){if(_0x2c55fd[_0x04f3('0x17')][_0x04f3('0x18')]===0x1f4){logger[_0x04f3('0x17')](_0x04f3('0x14'),_0x16a30b,_0x2c55fd['error']['message']);return _0x5c3b41(_0x2c55fd['error'][_0x04f3('0x19')]);}logger[_0x04f3('0x17')](_0x04f3('0x14'),_0x16a30b,_0x2c55fd[_0x04f3('0x17')][_0x04f3('0x19')]);return _0xd4657c(_0x2c55fd['error'][_0x04f3('0x19')]);}else{logger[_0x04f3('0x13')](_0x04f3('0x14'),_0x16a30b,_0x04f3('0x16'));_0xd4657c(_0x2c55fd['result'][_0x04f3('0x19')]);}})[_0x04f3('0x1a')](function(_0x1d9a30){logger[_0x04f3('0x17')](_0x04f3('0x14'),_0x16a30b,_0x1d9a30);_0x5c3b41(_0x1d9a30);});});}exports[_0x04f3('0x1b')]=function(_0x55db88){var _0x447355=this;return new Promise(function(_0x2aa802,_0x4ecef6){return db[_0x04f3('0x1c')][_0x04f3('0x1d')](_0x55db88['body'],{'raw':_0x55db88['options']?_0x55db88[_0x04f3('0x1e')][_0x04f3('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55db88[_0x04f3('0x1e')]?_0x55db88[_0x04f3('0x1e')][_0x04f3('0x20')]||null:null,'attributes':_0x55db88[_0x04f3('0x1e')]?_0x55db88[_0x04f3('0x1e')][_0x04f3('0x21')]||null:null,'limit':_0x55db88[_0x04f3('0x1e')]?_0x55db88[_0x04f3('0x1e')][_0x04f3('0x22')]||null:null})['then'](function(_0x4abea3){logger['info'](_0x04f3('0x1b'),_0x55db88);logger[_0x04f3('0x15')]('UpdateWhatsappInteraction',_0x55db88,JSON[_0x04f3('0x23')](_0x4abea3));_0x2aa802(_0x4abea3);})['catch'](function(_0x4c0456){logger[_0x04f3('0x17')](_0x04f3('0x1b'),_0x4c0456[_0x04f3('0x19')],_0x55db88);_0x4ecef6(_0x447355[_0x04f3('0x17')](0x1f4,_0x4c0456[_0x04f3('0x19')]));});});};exports[_0x04f3('0x24')]=function(_0x58c17d){return new Promise(function(_0x6f40d6,_0x4539d2){return db[_0x04f3('0x1c')][_0x04f3('0x25')]({'where':_0x58c17d[_0x04f3('0x1e')]?_0x58c17d['options']['where']||null:null})[_0x04f3('0x12')](function(_0xb13dc6){if(_0xb13dc6){return _0xb13dc6[_0x04f3('0x26')](_0x58c17d[_0x04f3('0x27')][_0x04f3('0x28')],_[_0x04f3('0x29')](_0x58c17d['body'],[_0x04f3('0x28'),'id'])||{});}})['spread'](function(_0x1d0f0a){logger['info']('AddTags',_0x58c17d);logger['debug'](_0x04f3('0x2a'),_0x58c17d,JSON[_0x04f3('0x23')](_0x1d0f0a));_0x6f40d6(_0x1d0f0a);})['catch'](function(_0x5d485b){logger[_0x04f3('0x17')]('AddTags',_0x5d485b[_0x04f3('0x19')],_0x58c17d);_0x4539d2(_this[_0x04f3('0x17')](0x1f4,_0x5d485b['message']));});});}; \ No newline at end of file +var _0xbbde=['register','then','info','WhatsappInteraction,\x20%s,\x20%s','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','UpdateWhatsappInteraction','body','options','raw','attributes','limit','AddTagsToWhatsappInteraction','WhatsappInteraction','find','where','ids','omit','spread','AddTags','stringify','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./whatsappInteraction.socket'];(function(_0x577e65,_0x55d114){var _0x7a0f3a=function(_0x2e95fc){while(--_0x2e95fc){_0x577e65['push'](_0x577e65['shift']());}};_0x7a0f3a(++_0x55d114);}(_0xbbde,0x70));var _0xebbd=function(_0x193e28,_0x3dac1d){_0x193e28=_0x193e28-0x0;var _0x20ef59=_0xbbde[_0x193e28];return _0x20ef59;};'use strict';var _=require(_0xebbd('0x0'));var util=require('util');var moment=require(_0xebbd('0x1'));var BPromise=require(_0xebbd('0x2'));var rs=require(_0xebbd('0x3'));var fs=require('fs');var Redis=require(_0xebbd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xebbd('0x5'));var logger=require(_0xebbd('0x6'))(_0xebbd('0x7'));var config=require(_0xebbd('0x8'));var jayson=require(_0xebbd('0x9'));var client=jayson[_0xebbd('0xa')][_0xebbd('0xb')]({'port':0x232a});config['redis']=_[_0xebbd('0xc')](config['redis'],{'host':_0xebbd('0xd'),'port':0x18eb});var socket=require(_0xebbd('0xe'))(new Redis(config[_0xebbd('0xf')]));require(_0xebbd('0x10'))[_0xebbd('0x11')](socket);function respondWithRpcPromise(_0x85bc24,_0x51e5a7,_0x125490){return new BPromise(function(_0x54485f,_0x3bfc24){return client['request'](_0x85bc24,_0x125490)[_0xebbd('0x12')](function(_0xa24fe7){logger[_0xebbd('0x13')](_0xebbd('0x14'),_0x51e5a7,'request\x20sent');logger[_0xebbd('0x15')](_0xebbd('0x16'),_0x51e5a7,_0xebbd('0x17'),JSON['stringify'](_0xa24fe7));if(_0xa24fe7[_0xebbd('0x18')]){if(_0xa24fe7['error']['code']===0x1f4){logger[_0xebbd('0x18')](_0xebbd('0x14'),_0x51e5a7,_0xa24fe7['error'][_0xebbd('0x19')]);return _0x3bfc24(_0xa24fe7[_0xebbd('0x18')][_0xebbd('0x19')]);}logger['error'](_0xebbd('0x14'),_0x51e5a7,_0xa24fe7[_0xebbd('0x18')][_0xebbd('0x19')]);return _0x54485f(_0xa24fe7[_0xebbd('0x18')][_0xebbd('0x19')]);}else{logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x51e5a7,_0xebbd('0x17'));_0x54485f(_0xa24fe7[_0xebbd('0x1a')][_0xebbd('0x19')]);}})[_0xebbd('0x1b')](function(_0x8161c7){logger[_0xebbd('0x18')](_0xebbd('0x14'),_0x51e5a7,_0x8161c7);_0x3bfc24(_0x8161c7);});});}exports[_0xebbd('0x1c')]=function(_0x4dc585){var _0x88fcd1=this;return new Promise(function(_0x304893,_0x10e7e7){return db['WhatsappInteraction']['update'](_0x4dc585[_0xebbd('0x1d')],{'raw':_0x4dc585[_0xebbd('0x1e')]?_0x4dc585['options'][_0xebbd('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4dc585[_0xebbd('0x1e')]?_0x4dc585['options']['where']||null:null,'attributes':_0x4dc585[_0xebbd('0x1e')]?_0x4dc585['options'][_0xebbd('0x20')]||null:null,'limit':_0x4dc585[_0xebbd('0x1e')]?_0x4dc585[_0xebbd('0x1e')][_0xebbd('0x21')]||null:null})[_0xebbd('0x12')](function(_0x5709b4){logger[_0xebbd('0x13')](_0xebbd('0x1c'),_0x4dc585);logger['debug'](_0xebbd('0x1c'),_0x4dc585,JSON['stringify'](_0x5709b4));_0x304893(_0x5709b4);})[_0xebbd('0x1b')](function(_0x3d2990){logger['error'](_0xebbd('0x1c'),_0x3d2990['message'],_0x4dc585);_0x10e7e7(_0x88fcd1[_0xebbd('0x18')](0x1f4,_0x3d2990[_0xebbd('0x19')]));});});};exports[_0xebbd('0x22')]=function(_0x1f18e2){return new Promise(function(_0x220f58,_0x20ffd2){return db[_0xebbd('0x23')][_0xebbd('0x24')]({'where':_0x1f18e2[_0xebbd('0x1e')]?_0x1f18e2[_0xebbd('0x1e')][_0xebbd('0x25')]||null:null})[_0xebbd('0x12')](function(_0x6b7859){if(_0x6b7859){return _0x6b7859['addTags'](_0x1f18e2[_0xebbd('0x1d')][_0xebbd('0x26')],_[_0xebbd('0x27')](_0x1f18e2[_0xebbd('0x1d')],[_0xebbd('0x26'),'id'])||{});}})[_0xebbd('0x28')](function(_0x51fb68){logger[_0xebbd('0x13')]('AddTags',_0x1f18e2);logger[_0xebbd('0x15')](_0xebbd('0x29'),_0x1f18e2,JSON[_0xebbd('0x2a')](_0x51fb68));_0x220f58(_0x51fb68);})[_0xebbd('0x1b')](function(_0x178ef7){logger['error']('AddTags',_0x178ef7[_0xebbd('0x19')],_0x1f18e2);_0x20ffd2(_this[_0xebbd('0x18')](0x1f4,_0x178ef7['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 1a03c4e..5348bc9 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 _0x1c78=['save','remove','update','emit','removeListener','whatsappInteraction:'];(function(_0x1024c3,_0x53d986){var _0x4a2054=function(_0x3a5d87){while(--_0x3a5d87){_0x1024c3['push'](_0x1024c3['shift']());}};_0x4a2054(++_0x53d986);}(_0x1c78,0xc6));var _0x81c7=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x1c78[_0x5d4607];return _0x5e4a86;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x81c7('0x0'),_0x81c7('0x1'),_0x81c7('0x2')];function createListener(_0x382cb0,_0x138e07){return function(_0x21715f){_0x138e07[_0x81c7('0x3')](_0x382cb0,_0x21715f);};}function removeListener(_0x422635,_0x46fa20){return function(){WhatsappInteractionEvents[_0x81c7('0x4')](_0x422635,_0x46fa20);};}exports['register']=function(_0x188312){for(var _0x1add6b=0x0,_0xe24b8b=events['length'];_0x1add6b<_0xe24b8b;_0x1add6b++){var _0x51a3f1=events[_0x1add6b];var _0x9b0ede=createListener(_0x81c7('0x5')+_0x51a3f1,_0x188312);WhatsappInteractionEvents['on'](_0x51a3f1,_0x9b0ede);}}; \ No newline at end of file +var _0xd054=['./whatsappInteraction.events','save','remove','update','removeListener','register','whatsappInteraction:'];(function(_0x21b99a,_0x4f282b){var _0xfd634c=function(_0xe53ba3){while(--_0xe53ba3){_0x21b99a['push'](_0x21b99a['shift']());}};_0xfd634c(++_0x4f282b);}(_0xd054,0x150));var _0x4d05=function(_0x2fe7f5,_0x3ec1db){_0x2fe7f5=_0x2fe7f5-0x0;var _0x106f34=_0xd054[_0x2fe7f5];return _0x106f34;};'use strict';var WhatsappInteractionEvents=require(_0x4d05('0x0'));var events=[_0x4d05('0x1'),_0x4d05('0x2'),_0x4d05('0x3')];function createListener(_0x2bc5b5,_0x43f73d){return function(_0x43f839){_0x43f73d['emit'](_0x2bc5b5,_0x43f839);};}function removeListener(_0x14c14a,_0x171ce1){return function(){WhatsappInteractionEvents[_0x4d05('0x4')](_0x14c14a,_0x171ce1);};}exports[_0x4d05('0x5')]=function(_0x33135a){for(var _0x5ba092=0x0,_0x6d1622=events['length'];_0x5ba092<_0x6d1622;_0x5ba092++){var _0x24bff6=events[_0x5ba092];var _0x417769=createListener(_0x4d05('0x6')+_0x24bff6,_0x33135a);WhatsappInteractionEvents['on'](_0x24bff6,_0x417769);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 4e49f91..7c3b577 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 _0xf0d6=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','post','tracked','whatsapp','/:id/status','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','exports','multer','util','connect-timeout'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xf0d6,0x11b));var _0x6f0d=function(_0x24e9fa,_0x4ec604){_0x24e9fa=_0x24e9fa-0x0;var _0x1332d2=_0xf0d6[_0x24e9fa];return _0x1332d2;};'use strict';var multer=require(_0x6f0d('0x0'));var util=require(_0x6f0d('0x1'));var path=require('path');var timeout=require(_0x6f0d('0x2'));var express=require(_0x6f0d('0x3'));var router=express[_0x6f0d('0x4')]();var auth=require(_0x6f0d('0x5'));var interaction=require(_0x6f0d('0x6'));var config=require(_0x6f0d('0x7'));var controller=require('./whatsappMessage.controller');router[_0x6f0d('0x8')]('/',auth[_0x6f0d('0x9')](),controller[_0x6f0d('0xa')]);router['get'](_0x6f0d('0xb'),auth[_0x6f0d('0x9')](),controller[_0x6f0d('0xc')]);router[_0x6f0d('0x8')]('/:id',auth[_0x6f0d('0x9')](),controller['show']);router[_0x6f0d('0xd')]('/',auth['isAuthenticated'](),interaction[_0x6f0d('0xe')](_0x6f0d('0xf'),'whatsappmessage:create'),controller['create']);router[_0x6f0d('0xd')](_0x6f0d('0x10'),controller['status']);router[_0x6f0d('0x11')](_0x6f0d('0x12'),auth[_0x6f0d('0x9')](),controller[_0x6f0d('0x13')]);router['put'](_0x6f0d('0x14'),auth[_0x6f0d('0x9')](),controller[_0x6f0d('0x15')]);router[_0x6f0d('0x11')](_0x6f0d('0x16'),auth[_0x6f0d('0x9')](),controller[_0x6f0d('0x17')]);router[_0x6f0d('0x18')](_0x6f0d('0x12'),auth[_0x6f0d('0x9')](),controller['destroy']);module[_0x6f0d('0x19')]=router; \ No newline at end of file +var _0x6aa0=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappMessage.controller','isAuthenticated','index','/describe','describe','get','/:id','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','update','put','/:id/accept','/:id/reject','reject','exports','multer','util'];(function(_0x46dcd5,_0x56463a){var _0x5407d1=function(_0x5bf6c0){while(--_0x5bf6c0){_0x46dcd5['push'](_0x46dcd5['shift']());}};_0x5407d1(++_0x56463a);}(_0x6aa0,0x1a2));var _0x06aa=function(_0x22e9fe,_0x3d019f){_0x22e9fe=_0x22e9fe-0x0;var _0x47cd19=_0x6aa0[_0x22e9fe];return _0x47cd19;};'use strict';var multer=require(_0x06aa('0x0'));var util=require(_0x06aa('0x1'));var path=require(_0x06aa('0x2'));var timeout=require(_0x06aa('0x3'));var express=require(_0x06aa('0x4'));var router=express[_0x06aa('0x5')]();var auth=require(_0x06aa('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x06aa('0x7'));var controller=require(_0x06aa('0x8'));router['get']('/',auth[_0x06aa('0x9')](),controller[_0x06aa('0xa')]);router['get'](_0x06aa('0xb'),auth[_0x06aa('0x9')](),controller[_0x06aa('0xc')]);router[_0x06aa('0xd')](_0x06aa('0xe'),auth[_0x06aa('0x9')](),controller['show']);router[_0x06aa('0xf')]('/',auth[_0x06aa('0x9')](),interaction[_0x06aa('0x10')](_0x06aa('0x11'),_0x06aa('0x12')),controller[_0x06aa('0x13')]);router[_0x06aa('0xf')](_0x06aa('0x14'),controller[_0x06aa('0x15')]);router['put'](_0x06aa('0xe'),auth['isAuthenticated'](),controller[_0x06aa('0x16')]);router[_0x06aa('0x17')](_0x06aa('0x18'),auth[_0x06aa('0x9')](),controller['accept']);router[_0x06aa('0x17')](_0x06aa('0x19'),auth['isAuthenticated'](),controller[_0x06aa('0x1a')]);router['delete'](_0x06aa('0xe'),auth[_0x06aa('0x9')](),controller['destroy']);module[_0x06aa('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 84da1c4..df215b8 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 _0xbb8b=['BOOLEAN','ENUM','out','STRING','DATE','sequelize','medium'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xbb8b,0x1e8));var _0xbbb8=function(_0x573af5,_0x265bd5){_0x573af5=_0x573af5-0x0;var _0x5ad767=_0xbb8b[_0x573af5];return _0x5ad767;};'use strict';var Sequelize=require(_0xbbb8('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0xbbb8('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xbbb8('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbbb8('0x3')]('in',_0xbbb8('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xbbb8('0x5')](0xbe)},'phone':{'type':Sequelize[_0xbbb8('0x5')]},'readAt':{'type':Sequelize[_0xbbb8('0x6')]},'secret':{'type':Sequelize[_0xbbb8('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xf681=['BOOLEAN','out','STRING','exports','TEXT','medium'];(function(_0x4c1cc6,_0xcea9c4){var _0x1f75a4=function(_0x2eeb5f){while(--_0x2eeb5f){_0x4c1cc6['push'](_0x4c1cc6['shift']());}};_0x1f75a4(++_0xcea9c4);}(_0xf681,0xc9));var _0x1f68=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xf681[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0x1f68('0x0')]={'body':{'type':Sequelize[_0x1f68('0x1')](_0x1f68('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x1f68('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x1f68('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x1f68('0x5')](0xbe)},'phone':{'type':Sequelize[_0x1f68('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x1f68('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 26c8b79..dafaf2b 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 _0x6bdd=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappMessage,\x20%s,\x20%s','message','result','catch','sendStatus','end','json','offset','limit','set','apply','reject','update','stack','name','status','send','index','map','WhatsappMessage','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','show','params','create','body','find','destroy','describe','whatsapp-interactions','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','info','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','AcceptMessage','acceptMessage','interface','SIP/%s','channel','accept','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','event','WhatsappAccount','debug','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x243731,_0x265626){var _0x17b205=function(_0x2a07d1){while(--_0x2a07d1){_0x243731['push'](_0x243731['shift']());}};_0x17b205(++_0x265626);}(_0x6bdd,0x108));var _0xd6bd=function(_0x288536,_0x369b51){_0x288536=_0x288536-0x0;var _0x525e94=_0x6bdd[_0x288536];return _0x525e94;};'use strict';var pdf=require(_0xd6bd('0x0'));var emlformat=require(_0xd6bd('0x1'));var rimraf=require(_0xd6bd('0x2'));var zipdir=require(_0xd6bd('0x3'));var jsonpatch=require(_0xd6bd('0x4'));var rp=require(_0xd6bd('0x5'));var moment=require(_0xd6bd('0x6'));var BPromise=require(_0xd6bd('0x7'));var Mustache=require(_0xd6bd('0x8'));var util=require(_0xd6bd('0x9'));var path=require(_0xd6bd('0xa'));var sox=require(_0xd6bd('0xb'));var csv=require(_0xd6bd('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd6bd('0xd'));var squel=require(_0xd6bd('0xe'));var crypto=require(_0xd6bd('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xd6bd('0x10'));var toCsv=require(_0xd6bd('0xc'));var querystring=require(_0xd6bd('0x11'));var Papa=require(_0xd6bd('0x12'));var Redis=require(_0xd6bd('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xd6bd('0x14'));var as=require(_0xd6bd('0x15'));var hardwareService=require(_0xd6bd('0x16'));var logger=require(_0xd6bd('0x17'))(_0xd6bd('0x18'));var utils=require(_0xd6bd('0x19'));var config=require(_0xd6bd('0x1a'));var db=require('../../mysqldb')['db'];config[_0xd6bd('0x1b')]=_[_0xd6bd('0x1c')](config['redis'],{'host':_0xd6bd('0x1d'),'port':0x18eb});var socket=require(_0xd6bd('0x1e'))(new Redis(config['redis']));require(_0xd6bd('0x1f'))[_0xd6bd('0x20')](socket);var jayson=require('jayson/promise');var client=jayson[_0xd6bd('0x21')][_0xd6bd('0x22')]({'port':0x232c});var client9002=jayson[_0xd6bd('0x21')][_0xd6bd('0x22')]({'port':0x232a});function checkPasswordPattern(_0x1f1b77,_0x308b69,_0x37bfec){if(_0x37bfec){var _0x1898c6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1898c6[_0xd6bd('0x23')](_0x308b69)){return _0x1f1b77;}else{throw new db[(_0xd6bd('0x24'))][(_0xd6bd('0x25'))](_0xd6bd('0x26'));}}else{return _0x1f1b77;}}function respondWithRpcPromise(_0x415c22,_0x20329b,_0x3bbbff,_0x2dca02){return new BPromise(function(_0x39fd1b,_0x5a9a8f){var _0x546063=_0x2dca02||client;return _0x546063[_0xd6bd('0x27')](_0x415c22,_0x3bbbff)[_0xd6bd('0x28')](function(_0x2133ea){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x20329b,_0xd6bd('0x29'));logger['debug'](_0xd6bd('0x2a'),_0x20329b,_0xd6bd('0x29'),JSON[_0xd6bd('0x2b')](_0x2133ea));if(_0x2133ea[_0xd6bd('0x2c')]){if(_0x2133ea[_0xd6bd('0x2c')]['code']===0x1f4){logger[_0xd6bd('0x2c')](_0xd6bd('0x2d'),_0x20329b,_0x2133ea[_0xd6bd('0x2c')][_0xd6bd('0x2e')]);return _0x5a9a8f(_0x2133ea[_0xd6bd('0x2c')][_0xd6bd('0x2e')]);}logger['error'](_0xd6bd('0x2d'),_0x20329b,_0x2133ea[_0xd6bd('0x2c')][_0xd6bd('0x2e')]);return _0x39fd1b(_0x2133ea[_0xd6bd('0x2c')]['message']);}else{logger['info'](_0xd6bd('0x2d'),_0x20329b,'request\x20sent');_0x39fd1b(_0x2133ea[_0xd6bd('0x2f')][_0xd6bd('0x2e')]);}})[_0xd6bd('0x30')](function(_0x19593e){logger[_0xd6bd('0x2c')](_0xd6bd('0x2d'),_0x20329b,_0x19593e);_0x5a9a8f(_0x19593e);});});}function respondWithStatusCode(_0x2478af,_0x246751){_0x246751=_0x246751||0xcc;return function(_0x4632dd){if(_0x4632dd){return _0x2478af[_0xd6bd('0x31')](_0x246751);}return _0x2478af['status'](_0x246751)[_0xd6bd('0x32')]();};}function respondWithResult(_0x1e031d,_0x3a092e){_0x3a092e=_0x3a092e||0xc8;return function(_0x17cac1){if(_0x17cac1){return _0x1e031d['status'](_0x3a092e)[_0xd6bd('0x33')](_0x17cac1);}};}function respondWithFilteredResult(_0x2f36cd,_0x354362){return function(_0x24764d){if(_0x24764d){var _0x9d1157=_0x24764d['count'],_0x6a69c0=_0x354362[_0xd6bd('0x34')],_0x434faf=_0x354362[_0xd6bd('0x34')]+_0x354362[_0xd6bd('0x35')],_0x82df34;if(_0x434faf>=_0x9d1157){_0x434faf=_0x9d1157;_0x82df34=0xc8;}else{_0x82df34=0xce;}_0x2f36cd['status'](_0x82df34);return _0x2f36cd[_0xd6bd('0x36')]('Content-Range',_0x6a69c0+'-'+_0x434faf+'/'+_0x9d1157)[_0xd6bd('0x33')](_0x24764d);}return null;};}function patchUpdates(_0x5e50c8){return function(_0x566e94){try{jsonpatch[_0xd6bd('0x37')](_0x566e94,_0x5e50c8,!![]);}catch(_0x3754be){return BPromise[_0xd6bd('0x38')](_0x3754be);}return _0x566e94['save']();};}function saveUpdates(_0x29886b,_0x218fa0){return function(_0x4ea5cd){if(_0x4ea5cd){return _0x4ea5cd[_0xd6bd('0x39')](_0x29886b)[_0xd6bd('0x28')](function(_0xb5b3a1){return _0xb5b3a1;});}return null;};}function removeEntity(_0xd486d4,_0x5ac98f){return function(_0x3c866d){if(_0x3c866d){return _0x3c866d['destroy']()['then'](function(){_0xd486d4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bb442,_0x4aca3f){return function(_0x2ff4e5){if(!_0x2ff4e5){_0x2bb442[_0xd6bd('0x31')](0x194);}return _0x2ff4e5;};}function handleError(_0x5e1e23,_0x492af2){_0x492af2=_0x492af2||0x1f4;return function(_0x3da8e2){logger[_0xd6bd('0x2c')](_0x3da8e2[_0xd6bd('0x3a')]);if(_0x3da8e2[_0xd6bd('0x3b')]){delete _0x3da8e2[_0xd6bd('0x3b')];}_0x5e1e23[_0xd6bd('0x3c')](_0x492af2)[_0xd6bd('0x3d')](_0x3da8e2);};}exports[_0xd6bd('0x3e')]=function(_0xf29b63,_0x33472e){var _0x409cd3={},_0x661af9={},_0x58ab54={'count':0x0,'rows':[]};var _0x48ee06=_[_0xd6bd('0x3f')](db[_0xd6bd('0x40')][_0xd6bd('0x41')],function(_0x3d64d3){return{'name':_0x3d64d3['fieldName'],'type':_0x3d64d3[_0xd6bd('0x42')][_0xd6bd('0x43')]};});_0x661af9[_0xd6bd('0x44')]=_[_0xd6bd('0x3f')](_0x48ee06,_0xd6bd('0x3b'));_0x661af9[_0xd6bd('0x45')]=_[_0xd6bd('0x46')](_0xf29b63[_0xd6bd('0x45')]);_0x661af9[_0xd6bd('0x47')]=_[_0xd6bd('0x48')](_0x661af9[_0xd6bd('0x44')],_0x661af9['query']);_0x409cd3[_0xd6bd('0x49')]=_[_0xd6bd('0x48')](_0x661af9[_0xd6bd('0x44')],qs['fields'](_0xf29b63[_0xd6bd('0x45')][_0xd6bd('0x4a')]));_0x409cd3[_0xd6bd('0x49')]=_0x409cd3[_0xd6bd('0x49')][_0xd6bd('0x4b')]?_0x409cd3[_0xd6bd('0x49')]:_0x661af9['model'];if(!_0xf29b63['query'][_0xd6bd('0x4c')](_0xd6bd('0x4d'))){_0x409cd3[_0xd6bd('0x35')]=qs[_0xd6bd('0x35')](_0xf29b63[_0xd6bd('0x45')][_0xd6bd('0x35')]);_0x409cd3['offset']=qs[_0xd6bd('0x34')](_0xf29b63[_0xd6bd('0x45')][_0xd6bd('0x34')]);}_0x409cd3['order']=qs[_0xd6bd('0x4e')](_0xf29b63['query'][_0xd6bd('0x4e')]);_0x409cd3[_0xd6bd('0x4f')]=qs[_0xd6bd('0x47')](_[_0xd6bd('0x50')](_0xf29b63[_0xd6bd('0x45')],_0x661af9[_0xd6bd('0x47')]),_0x48ee06);if(_0xf29b63[_0xd6bd('0x45')][_0xd6bd('0x51')]){_0x409cd3[_0xd6bd('0x4f')]=_['merge'](_0x409cd3[_0xd6bd('0x4f')],{'$or':_[_0xd6bd('0x3f')](_0x48ee06,function(_0x9c4fda){if(_0x9c4fda[_0xd6bd('0x42')]!=='VIRTUAL'){var _0x3e1105={};_0x3e1105[_0x9c4fda['name']]={'$like':'%'+_0xf29b63['query'][_0xd6bd('0x51')]+'%'};return _0x3e1105;}})});}_0x409cd3=_[_0xd6bd('0x52')]({},_0x409cd3,_0xf29b63[_0xd6bd('0x53')]);var _0x33225a={'where':_0x409cd3[_0xd6bd('0x4f')]};return db['WhatsappMessage']['count'](_0x33225a)['then'](function(_0x366817){_0x58ab54[_0xd6bd('0x54')]=_0x366817;if(_0xf29b63[_0xd6bd('0x45')][_0xd6bd('0x55')]){_0x409cd3[_0xd6bd('0x56')]=[{'all':!![]}];}return db[_0xd6bd('0x40')][_0xd6bd('0x57')](_0x409cd3);})[_0xd6bd('0x28')](function(_0x33a17f){_0x58ab54['rows']=_0x33a17f;return _0x58ab54;})[_0xd6bd('0x28')](respondWithFilteredResult(_0x33472e,_0x409cd3))[_0xd6bd('0x30')](handleError(_0x33472e,null));};exports[_0xd6bd('0x58')]=function(_0xba680e,_0x5149b){var _0x1c75e9={'raw':!![],'where':{'id':_0xba680e[_0xd6bd('0x59')]['id']}},_0x5bd6b8={};_0x5bd6b8[_0xd6bd('0x44')]=_[_0xd6bd('0x46')](db['WhatsappMessage'][_0xd6bd('0x41')]);_0x5bd6b8[_0xd6bd('0x45')]=_[_0xd6bd('0x46')](_0xba680e['query']);_0x5bd6b8[_0xd6bd('0x47')]=_[_0xd6bd('0x48')](_0x5bd6b8[_0xd6bd('0x44')],_0x5bd6b8[_0xd6bd('0x45')]);_0x1c75e9['attributes']=_[_0xd6bd('0x48')](_0x5bd6b8['model'],qs[_0xd6bd('0x4a')](_0xba680e[_0xd6bd('0x45')][_0xd6bd('0x4a')]));_0x1c75e9[_0xd6bd('0x49')]=_0x1c75e9[_0xd6bd('0x49')]['length']?_0x1c75e9[_0xd6bd('0x49')]:_0x5bd6b8[_0xd6bd('0x44')];if(_0xba680e[_0xd6bd('0x45')][_0xd6bd('0x55')]){_0x1c75e9[_0xd6bd('0x56')]=[{'all':!![]}];}_0x1c75e9=_['merge']({},_0x1c75e9,_0xba680e[_0xd6bd('0x53')]);return db[_0xd6bd('0x40')]['find'](_0x1c75e9)[_0xd6bd('0x28')](handleEntityNotFound(_0x5149b,null))[_0xd6bd('0x28')](respondWithResult(_0x5149b,null))[_0xd6bd('0x30')](handleError(_0x5149b,null));};exports['create']=function(_0x4547b5,_0x2dfab1){return db[_0xd6bd('0x40')][_0xd6bd('0x5a')](_0x4547b5[_0xd6bd('0x5b')],{})[_0xd6bd('0x28')](respondWithResult(_0x2dfab1,0xc9))['catch'](handleError(_0x2dfab1,null));};exports[_0xd6bd('0x39')]=function(_0x12da3c,_0x1ca7fd){if(_0x12da3c[_0xd6bd('0x5b')]['id']){delete _0x12da3c['body']['id'];}return db[_0xd6bd('0x40')][_0xd6bd('0x5c')]({'where':{'id':_0x12da3c['params']['id']}})[_0xd6bd('0x28')](handleEntityNotFound(_0x1ca7fd,null))[_0xd6bd('0x28')](saveUpdates(_0x12da3c[_0xd6bd('0x5b')],null))[_0xd6bd('0x28')](respondWithResult(_0x1ca7fd,null))[_0xd6bd('0x30')](handleError(_0x1ca7fd,null));};exports[_0xd6bd('0x5d')]=function(_0xfe157a,_0x1888f3){return db[_0xd6bd('0x40')][_0xd6bd('0x5c')]({'where':{'id':_0xfe157a[_0xd6bd('0x59')]['id']}})[_0xd6bd('0x28')](handleEntityNotFound(_0x1888f3,null))[_0xd6bd('0x28')](removeEntity(_0x1888f3,null))[_0xd6bd('0x30')](handleError(_0x1888f3,null));};exports[_0xd6bd('0x5e')]=function(_0x52dd98,_0x4570de){return db[_0xd6bd('0x40')][_0xd6bd('0x5e')]()['then'](respondWithResult(_0x4570de,null))[_0xd6bd('0x30')](handleError(_0x4570de,null));};var interaction_log=require(_0xd6bd('0x17'))(_0xd6bd('0x5f'));exports['accept']=function(_0xa0051a,_0x1b30d8,_0x48c067){var _0x3d157a={'channel':_0xd6bd('0x60')};if(_0xa0051a['body']['id']){delete _0xa0051a[_0xd6bd('0x5b')]['id'];}_0xa0051a[_0xd6bd('0x5b')][_0xd6bd('0x61')]=!![];_0xa0051a[_0xd6bd('0x5b')][_0xd6bd('0x62')]=moment()[_0xd6bd('0x63')](_0xd6bd('0x64'));_0xa0051a[_0xd6bd('0x5b')]['UserId']=_0xa0051a[_0xd6bd('0x5b')][_0xd6bd('0x65')]||_0xa0051a['user']['id'];return db['WhatsappMessage'][_0xd6bd('0x5c')]({'where':{'id':_0xa0051a['params']['id'],'UserId':null},'include':[{'model':db[_0xd6bd('0x66')],'as':'Contact'}]})[_0xd6bd('0x28')](handleEntityNotFound(_0x1b30d8,null))['then'](saveUpdates(_0xa0051a['body'],null))[_0xd6bd('0x28')](function(_0x1e9e13){if(_0x1e9e13){_0x3d157a['message']=_0x1e9e13[_0xd6bd('0x67')]({'plain':!![]});return db[_0xd6bd('0x68')][_0xd6bd('0x5c')]({'where':{'id':_0x1e9e13[_0xd6bd('0x69')]}});}return null;})[_0xd6bd('0x28')](handleEntityNotFound(_0x1b30d8,null))[_0xd6bd('0x28')](function(_0x1b1fcb){if(_0x1b1fcb){return _0x1b1fcb['update']({'UserId':_0xa0051a[_0xd6bd('0x5b')][_0xd6bd('0x65')],'read1stAt':_[_0xd6bd('0x6a')](_0x1b1fcb[_0xd6bd('0x6b')])?moment()['format'](_0xd6bd('0x64')):undefined});}return null;})[_0xd6bd('0x28')](function(_0x5f54e8){if(_0x5f54e8){_0x3d157a[_0xd6bd('0x6c')]=_0x5f54e8[_0xd6bd('0x67')]({'plain':!![]});interaction_log[_0xd6bd('0x6d')](_0xd6bd('0x6e'),_0xa0051a[_0xd6bd('0x6f')]['id'],_0xa0051a[_0xd6bd('0x6f')][_0xd6bd('0x3b')],_0xa0051a[_0xd6bd('0x6f')]['role'],_0x3d157a[_0xd6bd('0x6c')]['id'],_0xa0051a['body']?JSON[_0xd6bd('0x2b')](_0xa0051a[_0xd6bd('0x5b')]):_0xd6bd('0x70'));return respondWithRpcPromise(_0xd6bd('0x71'),_0xd6bd('0x72'),_0x3d157a);}return null;})[_0xd6bd('0x28')](function(_0x34ab96){if(_0x34ab96){if(_0xa0051a[_0xd6bd('0x5b')]['manual']){_0x3d157a[_0xd6bd('0x2e')][_0xd6bd('0x73')]=util[_0xd6bd('0x63')](_0xd6bd('0x74'),_0xa0051a[_0xd6bd('0x6f')]['name']);_0x3d157a[_0xd6bd('0x2e')][_0xd6bd('0x75')]=_0x3d157a['channel'];_0x3d157a[_0xd6bd('0x2e')]['event']=_0xd6bd('0x76');return respondWithRpcPromise('EventManager',_0xd6bd('0x77'),{'event':_0xd6bd('0x78'),'message':_0x3d157a[_0xd6bd('0x2e')]},client9002)[_0xd6bd('0x28')](function(){return _0x3d157a;});}return _0x3d157a;}return null;})['then'](respondWithResult(_0x1b30d8,null))[_0xd6bd('0x30')](handleError(_0x1b30d8,null));};var interaction_log=require(_0xd6bd('0x17'))(_0xd6bd('0x5f'));exports[_0xd6bd('0x38')]=function(_0xfe00ef,_0x524326,_0x2067dd){var _0x30afea={'agent':{},'channel':_0xd6bd('0x60')};if(_0xfe00ef['body']['id']){delete _0xfe00ef[_0xd6bd('0x5b')]['id'];}_0xfe00ef[_0xd6bd('0x5b')][_0xd6bd('0x65')]=_0xfe00ef['body'][_0xd6bd('0x65')]||_0xfe00ef['user']['id'];_0x30afea['agent']['id']=_0xfe00ef[_0xd6bd('0x5b')][_0xd6bd('0x65')];return db[_0xd6bd('0x40')][_0xd6bd('0x5c')]({'where':{'id':_0xfe00ef[_0xd6bd('0x59')]['id'],'UserId':null}})[_0xd6bd('0x28')](handleEntityNotFound(_0x524326,null))[_0xd6bd('0x28')](function(_0x4a6a43){if(_0x4a6a43){_0x30afea[_0xd6bd('0x2e')]=_0x4a6a43[_0xd6bd('0x67')]({'plain':!![]});return db['WhatsappInteraction'][_0xd6bd('0x5c')]({'where':{'id':_0x4a6a43[_0xd6bd('0x69')]}});}return null;})[_0xd6bd('0x28')](handleEntityNotFound(_0x524326,null))[_0xd6bd('0x28')](function(_0x552d8f){if(_0x552d8f){_0x30afea['interaction']=_0x552d8f[_0xd6bd('0x67')]({'plain':!![]});interaction_log[_0xd6bd('0x6d')](_0xd6bd('0x79'),_0xfe00ef['user']['id'],_0xfe00ef[_0xd6bd('0x6f')][_0xd6bd('0x3b')],_0xfe00ef[_0xd6bd('0x6f')][_0xd6bd('0x7a')],_0x30afea[_0xd6bd('0x6c')]['id'],_0xfe00ef[_0xd6bd('0x5b')]?JSON[_0xd6bd('0x2b')](_0xfe00ef['body']):_0xd6bd('0x70'));return respondWithRpcPromise('RejectMessage',_0xd6bd('0x7b'),_0x30afea);}return null;})['then'](function(_0xadf04c){if(_0xadf04c){_0xadf04c[_0xd6bd('0x2e')][_0xd6bd('0x73')]=util[_0xd6bd('0x63')](_0xd6bd('0x74'),_0xfe00ef[_0xd6bd('0x6f')][_0xd6bd('0x3b')]);_0xadf04c['message'][_0xd6bd('0x75')]=_0x30afea['channel'];_0xadf04c[_0xd6bd('0x2e')][_0xd6bd('0x7c')]=_0xd6bd('0x38');respondWithRpcPromise(_0xd6bd('0x77'),_0xd6bd('0x77'),{'event':'rejectmessage','message':_0xadf04c[_0xd6bd('0x2e')]},client9002);return _0x30afea;}return null;})[_0xd6bd('0x28')](respondWithResult(_0x524326,null))[_0xd6bd('0x30')](handleError(_0x524326,null));};exports[_0xd6bd('0x3c')]=function(_0x1dfd64,_0x2210f8,_0x573d47){if(_0x1dfd64['body']['id']){delete _0x1dfd64[_0xd6bd('0x5b')]['id'];}var _0x13a841;return db[_0xd6bd('0x40')][_0xd6bd('0x5c')]({'where':{'id':_0x1dfd64[_0xd6bd('0x59')]['id']}})['then'](handleEntityNotFound(_0x2210f8,null))['then'](function(_0x124803){if(_0x124803){_0x13a841=_0x124803;return db[_0xd6bd('0x7d')][_0xd6bd('0x5c')]({'where':{'id':_0x124803['WhatsappAccountId']}});}})[_0xd6bd('0x28')](handleEntityNotFound(_0x2210f8,null))['then'](function(_0x1bf37d){if(_0x1bf37d){logger[_0xd6bd('0x7e')]('WhatsppMessage,\x20%s,\x20%s,\x20%s','status',_0xd6bd('0x7f'),_0x1bf37d[_0xd6bd('0x42')],util[_0xd6bd('0x80')](_0x1dfd64[_0xd6bd('0x5b')],{'showHidden':![],'depth':null}));switch(_0x1bf37d[_0xd6bd('0x42')]){case _0xd6bd('0x81'):if(_0x1dfd64[_0xd6bd('0x5b')][_0xd6bd('0x82')]&&_0x1dfd64[_0xd6bd('0x5b')]['MessageSid']===_0x13a841[_0xd6bd('0x83')]&&_0x1dfd64[_0xd6bd('0x5b')][_0xd6bd('0x84')]&&_0x1dfd64[_0xd6bd('0x5b')][_0xd6bd('0x84')]===_0xd6bd('0x61')){return _0x13a841[_0xd6bd('0x39')]({'read':!![]});}else{logger[_0xd6bd('0x2c')](_0xd6bd('0x85'),_0xd6bd('0x3c'),_0xd6bd('0x81'),util[_0xd6bd('0x80')](_0x1dfd64[_0xd6bd('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x13a841;}})[_0xd6bd('0x28')](respondWithResult(_0x2210f8,null))[_0xd6bd('0x30')](handleError(_0x2210f8,null));}; \ No newline at end of file +var _0xf3db=['defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','merge','options','WhatsappMessage','includeAll','include','rows','show','params','keys','create','body','find','describe','whatsapp-interactions','accept','whatsapp','read','YYYY-MM-DD\x20HH:mm:ss','UserId','Contact','get','WhatsappInteractionId','isNil','read1stAt','format','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','manual','interface','SIP/%s','user','channel','event','EventManager','acceptmessage','agent','WhatsappInteraction','RejectMessage','rejectMessage','rejectmessage','WhatsappAccount','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis'];(function(_0xd53f0,_0x5dc08a){var _0x21f8b7=function(_0x406159){while(--_0x406159){_0xd53f0['push'](_0xd53f0['shift']());}};_0x21f8b7(++_0x5dc08a);}(_0xf3db,0x184));var _0xbf3d=function(_0x23fdb1,_0x19b895){_0x23fdb1=_0x23fdb1-0x0;var _0x23708c=_0xf3db[_0x23fdb1];return _0x23708c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbf3d('0x0'));var rimraf=require(_0xbf3d('0x1'));var zipdir=require(_0xbf3d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbf3d('0x3'));var moment=require(_0xbf3d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbf3d('0x5'));var util=require(_0xbf3d('0x6'));var path=require(_0xbf3d('0x7'));var sox=require(_0xbf3d('0x8'));var csv=require(_0xbf3d('0x9'));var ejs=require(_0xbf3d('0xa'));var fs=require('fs');var _=require(_0xbf3d('0xb'));var squel=require(_0xbf3d('0xc'));var crypto=require(_0xbf3d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbf3d('0xe'));var toCsv=require(_0xbf3d('0x9'));var querystring=require(_0xbf3d('0xf'));var Papa=require(_0xbf3d('0x10'));var Redis=require('ioredis');var authService=require(_0xbf3d('0x11'));var qs=require(_0xbf3d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbf3d('0x13'));var logger=require(_0xbf3d('0x14'))(_0xbf3d('0x15'));var utils=require(_0xbf3d('0x16'));var config=require(_0xbf3d('0x17'));var db=require(_0xbf3d('0x18'))['db'];config[_0xbf3d('0x19')]=_[_0xbf3d('0x1a')](config[_0xbf3d('0x19')],{'host':_0xbf3d('0x1b'),'port':0x18eb});var socket=require(_0xbf3d('0x1c'))(new Redis(config['redis']));require(_0xbf3d('0x1d'))[_0xbf3d('0x1e')](socket);var jayson=require(_0xbf3d('0x1f'));var client=jayson[_0xbf3d('0x20')]['http']({'port':0x232c});var client9002=jayson['client'][_0xbf3d('0x21')]({'port':0x232a});function checkPasswordPattern(_0xe173bb,_0x1d6338,_0x3b2269){if(_0x3b2269){var _0x233f3b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x233f3b[_0xbf3d('0x22')](_0x1d6338)){return _0xe173bb;}else{throw new db[(_0xbf3d('0x23'))][(_0xbf3d('0x24'))](_0xbf3d('0x25'));}}else{return _0xe173bb;}}function respondWithRpcPromise(_0x55842b,_0x520e86,_0x3561a5,_0x379178){return new BPromise(function(_0x3295b8,_0x4fa785){var _0x46f391=_0x379178||client;return _0x46f391[_0xbf3d('0x26')](_0x55842b,_0x3561a5)[_0xbf3d('0x27')](function(_0x21c97f){logger[_0xbf3d('0x28')](_0xbf3d('0x29'),_0x520e86,'request\x20sent');logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x520e86,_0xbf3d('0x2a'),JSON[_0xbf3d('0x2b')](_0x21c97f));if(_0x21c97f['error']){if(_0x21c97f[_0xbf3d('0x2c')][_0xbf3d('0x2d')]===0x1f4){logger[_0xbf3d('0x2c')](_0xbf3d('0x29'),_0x520e86,_0x21c97f[_0xbf3d('0x2c')][_0xbf3d('0x2e')]);return _0x4fa785(_0x21c97f[_0xbf3d('0x2c')][_0xbf3d('0x2e')]);}logger[_0xbf3d('0x2c')](_0xbf3d('0x29'),_0x520e86,_0x21c97f[_0xbf3d('0x2c')][_0xbf3d('0x2e')]);return _0x3295b8(_0x21c97f[_0xbf3d('0x2c')]['message']);}else{logger[_0xbf3d('0x28')]('WhatsappMessage,\x20%s,\x20%s',_0x520e86,_0xbf3d('0x2a'));_0x3295b8(_0x21c97f[_0xbf3d('0x2f')][_0xbf3d('0x2e')]);}})[_0xbf3d('0x30')](function(_0x120345){logger[_0xbf3d('0x2c')](_0xbf3d('0x29'),_0x520e86,_0x120345);_0x4fa785(_0x120345);});});}function respondWithStatusCode(_0x2f2589,_0x253c7d){_0x253c7d=_0x253c7d||0xcc;return function(_0x5cdcae){if(_0x5cdcae){return _0x2f2589['sendStatus'](_0x253c7d);}return _0x2f2589[_0xbf3d('0x31')](_0x253c7d)[_0xbf3d('0x32')]();};}function respondWithResult(_0x347f78,_0x3c125f){_0x3c125f=_0x3c125f||0xc8;return function(_0x26f4f9){if(_0x26f4f9){return _0x347f78[_0xbf3d('0x31')](_0x3c125f)[_0xbf3d('0x33')](_0x26f4f9);}};}function respondWithFilteredResult(_0x485e9c,_0x109d33){return function(_0x50c563){if(_0x50c563){var _0x1eb6b2=_0x50c563[_0xbf3d('0x34')],_0x23beb4=_0x109d33[_0xbf3d('0x35')],_0x9022ed=_0x109d33[_0xbf3d('0x35')]+_0x109d33[_0xbf3d('0x36')],_0x407412;if(_0x9022ed>=_0x1eb6b2){_0x9022ed=_0x1eb6b2;_0x407412=0xc8;}else{_0x407412=0xce;}_0x485e9c[_0xbf3d('0x31')](_0x407412);return _0x485e9c[_0xbf3d('0x37')](_0xbf3d('0x38'),_0x23beb4+'-'+_0x9022ed+'/'+_0x1eb6b2)[_0xbf3d('0x33')](_0x50c563);}return null;};}function patchUpdates(_0x4ad966){return function(_0x3daac0){try{jsonpatch[_0xbf3d('0x39')](_0x3daac0,_0x4ad966,!![]);}catch(_0x289651){return BPromise[_0xbf3d('0x3a')](_0x289651);}return _0x3daac0[_0xbf3d('0x3b')]();};}function saveUpdates(_0x52ae41,_0x37ccf6){return function(_0x57a24d){if(_0x57a24d){return _0x57a24d[_0xbf3d('0x3c')](_0x52ae41)[_0xbf3d('0x27')](function(_0x137b5b){return _0x137b5b;});}return null;};}function removeEntity(_0x202316,_0x1b1812){return function(_0x4bccea){if(_0x4bccea){return _0x4bccea[_0xbf3d('0x3d')]()[_0xbf3d('0x27')](function(){_0x202316[_0xbf3d('0x31')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47d003,_0x420a43){return function(_0x4836f6){if(!_0x4836f6){_0x47d003[_0xbf3d('0x3e')](0x194);}return _0x4836f6;};}function handleError(_0x399ec2,_0x4c973c){_0x4c973c=_0x4c973c||0x1f4;return function(_0x2089cd){logger[_0xbf3d('0x2c')](_0x2089cd[_0xbf3d('0x3f')]);if(_0x2089cd['name']){delete _0x2089cd[_0xbf3d('0x40')];}_0x399ec2[_0xbf3d('0x31')](_0x4c973c)[_0xbf3d('0x41')](_0x2089cd);};}exports[_0xbf3d('0x42')]=function(_0x54e593,_0x122269){var _0x4e6c94={},_0x2a0f0b={},_0x47374f={'count':0x0,'rows':[]};var _0x1efef3=_['map'](db['WhatsappMessage'][_0xbf3d('0x43')],function(_0x1cfcca){return{'name':_0x1cfcca[_0xbf3d('0x44')],'type':_0x1cfcca['type'][_0xbf3d('0x45')]};});_0x2a0f0b[_0xbf3d('0x46')]=_[_0xbf3d('0x47')](_0x1efef3,_0xbf3d('0x40'));_0x2a0f0b[_0xbf3d('0x48')]=_['keys'](_0x54e593[_0xbf3d('0x48')]);_0x2a0f0b[_0xbf3d('0x49')]=_[_0xbf3d('0x4a')](_0x2a0f0b[_0xbf3d('0x46')],_0x2a0f0b[_0xbf3d('0x48')]);_0x4e6c94[_0xbf3d('0x4b')]=_[_0xbf3d('0x4a')](_0x2a0f0b[_0xbf3d('0x46')],qs[_0xbf3d('0x4c')](_0x54e593[_0xbf3d('0x48')][_0xbf3d('0x4c')]));_0x4e6c94[_0xbf3d('0x4b')]=_0x4e6c94[_0xbf3d('0x4b')][_0xbf3d('0x4d')]?_0x4e6c94[_0xbf3d('0x4b')]:_0x2a0f0b['model'];if(!_0x54e593['query'][_0xbf3d('0x4e')]('nolimit')){_0x4e6c94[_0xbf3d('0x36')]=qs[_0xbf3d('0x36')](_0x54e593['query']['limit']);_0x4e6c94['offset']=qs[_0xbf3d('0x35')](_0x54e593[_0xbf3d('0x48')][_0xbf3d('0x35')]);}_0x4e6c94['order']=qs[_0xbf3d('0x4f')](_0x54e593['query'][_0xbf3d('0x4f')]);_0x4e6c94[_0xbf3d('0x50')]=qs[_0xbf3d('0x49')](_[_0xbf3d('0x51')](_0x54e593[_0xbf3d('0x48')],_0x2a0f0b['filters']),_0x1efef3);if(_0x54e593[_0xbf3d('0x48')][_0xbf3d('0x52')]){_0x4e6c94['where']=_['merge'](_0x4e6c94[_0xbf3d('0x50')],{'$or':_['map'](_0x1efef3,function(_0xb32259){if(_0xb32259[_0xbf3d('0x53')]!==_0xbf3d('0x54')){var _0x20256d={};_0x20256d[_0xb32259[_0xbf3d('0x40')]]={'$like':'%'+_0x54e593['query'][_0xbf3d('0x52')]+'%'};return _0x20256d;}})});}_0x4e6c94=_[_0xbf3d('0x55')]({},_0x4e6c94,_0x54e593[_0xbf3d('0x56')]);var _0x137b1a={'where':_0x4e6c94[_0xbf3d('0x50')]};return db[_0xbf3d('0x57')]['count'](_0x137b1a)[_0xbf3d('0x27')](function(_0x234d20){_0x47374f[_0xbf3d('0x34')]=_0x234d20;if(_0x54e593['query'][_0xbf3d('0x58')]){_0x4e6c94[_0xbf3d('0x59')]=[{'all':!![]}];}return db[_0xbf3d('0x57')]['findAll'](_0x4e6c94);})[_0xbf3d('0x27')](function(_0x2d2bc9){_0x47374f[_0xbf3d('0x5a')]=_0x2d2bc9;return _0x47374f;})['then'](respondWithFilteredResult(_0x122269,_0x4e6c94))['catch'](handleError(_0x122269,null));};exports[_0xbf3d('0x5b')]=function(_0x52b67f,_0x3a4d4e){var _0x5309b6={'raw':!![],'where':{'id':_0x52b67f[_0xbf3d('0x5c')]['id']}},_0x3ec587={};_0x3ec587[_0xbf3d('0x46')]=_[_0xbf3d('0x5d')](db['WhatsappMessage'][_0xbf3d('0x43')]);_0x3ec587[_0xbf3d('0x48')]=_[_0xbf3d('0x5d')](_0x52b67f[_0xbf3d('0x48')]);_0x3ec587['filters']=_['intersection'](_0x3ec587['model'],_0x3ec587[_0xbf3d('0x48')]);_0x5309b6[_0xbf3d('0x4b')]=_['intersection'](_0x3ec587[_0xbf3d('0x46')],qs[_0xbf3d('0x4c')](_0x52b67f[_0xbf3d('0x48')]['fields']));_0x5309b6['attributes']=_0x5309b6[_0xbf3d('0x4b')]['length']?_0x5309b6[_0xbf3d('0x4b')]:_0x3ec587[_0xbf3d('0x46')];if(_0x52b67f[_0xbf3d('0x48')][_0xbf3d('0x58')]){_0x5309b6[_0xbf3d('0x59')]=[{'all':!![]}];}_0x5309b6=_['merge']({},_0x5309b6,_0x52b67f[_0xbf3d('0x56')]);return db[_0xbf3d('0x57')]['find'](_0x5309b6)[_0xbf3d('0x27')](handleEntityNotFound(_0x3a4d4e,null))['then'](respondWithResult(_0x3a4d4e,null))[_0xbf3d('0x30')](handleError(_0x3a4d4e,null));};exports['create']=function(_0x6712d6,_0x2aec2f){return db[_0xbf3d('0x57')][_0xbf3d('0x5e')](_0x6712d6[_0xbf3d('0x5f')],{})['then'](respondWithResult(_0x2aec2f,0xc9))['catch'](handleError(_0x2aec2f,null));};exports[_0xbf3d('0x3c')]=function(_0x4becc1,_0x49d0f7){if(_0x4becc1[_0xbf3d('0x5f')]['id']){delete _0x4becc1[_0xbf3d('0x5f')]['id'];}return db['WhatsappMessage']['find']({'where':{'id':_0x4becc1['params']['id']}})[_0xbf3d('0x27')](handleEntityNotFound(_0x49d0f7,null))[_0xbf3d('0x27')](saveUpdates(_0x4becc1[_0xbf3d('0x5f')],null))[_0xbf3d('0x27')](respondWithResult(_0x49d0f7,null))[_0xbf3d('0x30')](handleError(_0x49d0f7,null));};exports['destroy']=function(_0x2d3425,_0x18ff4e){return db[_0xbf3d('0x57')][_0xbf3d('0x60')]({'where':{'id':_0x2d3425[_0xbf3d('0x5c')]['id']}})[_0xbf3d('0x27')](handleEntityNotFound(_0x18ff4e,null))[_0xbf3d('0x27')](removeEntity(_0x18ff4e,null))[_0xbf3d('0x30')](handleError(_0x18ff4e,null));};exports[_0xbf3d('0x61')]=function(_0x5a839b,_0x3d4f59){return db['WhatsappMessage'][_0xbf3d('0x61')]()[_0xbf3d('0x27')](respondWithResult(_0x3d4f59,null))['catch'](handleError(_0x3d4f59,null));};var interaction_log=require('../../config/logger')(_0xbf3d('0x62'));exports[_0xbf3d('0x63')]=function(_0x3b32db,_0x1235a7,_0x247092){var _0x385a72={'channel':_0xbf3d('0x64')};if(_0x3b32db[_0xbf3d('0x5f')]['id']){delete _0x3b32db[_0xbf3d('0x5f')]['id'];}_0x3b32db[_0xbf3d('0x5f')][_0xbf3d('0x65')]=!![];_0x3b32db[_0xbf3d('0x5f')]['readAt']=moment()['format'](_0xbf3d('0x66'));_0x3b32db['body'][_0xbf3d('0x67')]=_0x3b32db[_0xbf3d('0x5f')][_0xbf3d('0x67')]||_0x3b32db['user']['id'];return db[_0xbf3d('0x57')][_0xbf3d('0x60')]({'where':{'id':_0x3b32db[_0xbf3d('0x5c')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xbf3d('0x68')}]})[_0xbf3d('0x27')](handleEntityNotFound(_0x1235a7,null))[_0xbf3d('0x27')](saveUpdates(_0x3b32db[_0xbf3d('0x5f')],null))[_0xbf3d('0x27')](function(_0x172333){if(_0x172333){_0x385a72[_0xbf3d('0x2e')]=_0x172333[_0xbf3d('0x69')]({'plain':!![]});return db['WhatsappInteraction'][_0xbf3d('0x60')]({'where':{'id':_0x172333[_0xbf3d('0x6a')]}});}return null;})[_0xbf3d('0x27')](handleEntityNotFound(_0x1235a7,null))[_0xbf3d('0x27')](function(_0x3ea8bd){if(_0x3ea8bd){return _0x3ea8bd[_0xbf3d('0x3c')]({'UserId':_0x3b32db[_0xbf3d('0x5f')][_0xbf3d('0x67')],'read1stAt':_[_0xbf3d('0x6b')](_0x3ea8bd[_0xbf3d('0x6c')])?moment()[_0xbf3d('0x6d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x5ee07f){if(_0x5ee07f){_0x385a72[_0xbf3d('0x6e')]=_0x5ee07f[_0xbf3d('0x69')]({'plain':!![]});interaction_log['info'](_0xbf3d('0x6f'),_0x3b32db['user']['id'],_0x3b32db['user'][_0xbf3d('0x40')],_0x3b32db['user'][_0xbf3d('0x70')],_0x385a72['interaction']['id'],_0x3b32db[_0xbf3d('0x5f')]?JSON[_0xbf3d('0x2b')](_0x3b32db[_0xbf3d('0x5f')]):'null');return respondWithRpcPromise(_0xbf3d('0x71'),_0xbf3d('0x72'),_0x385a72);}return null;})[_0xbf3d('0x27')](function(_0xfb4dd9){if(_0xfb4dd9){if(_0x3b32db[_0xbf3d('0x5f')][_0xbf3d('0x73')]){_0x385a72[_0xbf3d('0x2e')][_0xbf3d('0x74')]=util['format'](_0xbf3d('0x75'),_0x3b32db[_0xbf3d('0x76')][_0xbf3d('0x40')]);_0x385a72['message'][_0xbf3d('0x77')]=_0x385a72[_0xbf3d('0x77')];_0x385a72['message'][_0xbf3d('0x78')]='accept';return respondWithRpcPromise(_0xbf3d('0x79'),_0xbf3d('0x79'),{'event':_0xbf3d('0x7a'),'message':_0x385a72[_0xbf3d('0x2e')]},client9002)[_0xbf3d('0x27')](function(){return _0x385a72;});}return _0x385a72;}return null;})[_0xbf3d('0x27')](respondWithResult(_0x1235a7,null))['catch'](handleError(_0x1235a7,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports[_0xbf3d('0x3a')]=function(_0x2f9ecf,_0x3cf818,_0x4018a0){var _0x362b42={'agent':{},'channel':_0xbf3d('0x64')};if(_0x2f9ecf[_0xbf3d('0x5f')]['id']){delete _0x2f9ecf[_0xbf3d('0x5f')]['id'];}_0x2f9ecf['body'][_0xbf3d('0x67')]=_0x2f9ecf[_0xbf3d('0x5f')]['UserId']||_0x2f9ecf[_0xbf3d('0x76')]['id'];_0x362b42[_0xbf3d('0x7b')]['id']=_0x2f9ecf['body'][_0xbf3d('0x67')];return db[_0xbf3d('0x57')][_0xbf3d('0x60')]({'where':{'id':_0x2f9ecf[_0xbf3d('0x5c')]['id'],'UserId':null}})[_0xbf3d('0x27')](handleEntityNotFound(_0x3cf818,null))['then'](function(_0x440312){if(_0x440312){_0x362b42[_0xbf3d('0x2e')]=_0x440312[_0xbf3d('0x69')]({'plain':!![]});return db[_0xbf3d('0x7c')][_0xbf3d('0x60')]({'where':{'id':_0x440312[_0xbf3d('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x3cf818,null))['then'](function(_0x34f1c1){if(_0x34f1c1){_0x362b42[_0xbf3d('0x6e')]=_0x34f1c1['get']({'plain':!![]});interaction_log[_0xbf3d('0x28')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2f9ecf['user']['id'],_0x2f9ecf[_0xbf3d('0x76')][_0xbf3d('0x40')],_0x2f9ecf[_0xbf3d('0x76')]['role'],_0x362b42[_0xbf3d('0x6e')]['id'],_0x2f9ecf[_0xbf3d('0x5f')]?JSON[_0xbf3d('0x2b')](_0x2f9ecf[_0xbf3d('0x5f')]):'null');return respondWithRpcPromise(_0xbf3d('0x7d'),_0xbf3d('0x7e'),_0x362b42);}return null;})[_0xbf3d('0x27')](function(_0x118996){if(_0x118996){_0x118996[_0xbf3d('0x2e')][_0xbf3d('0x74')]=util[_0xbf3d('0x6d')](_0xbf3d('0x75'),_0x2f9ecf[_0xbf3d('0x76')][_0xbf3d('0x40')]);_0x118996[_0xbf3d('0x2e')]['channel']=_0x362b42[_0xbf3d('0x77')];_0x118996[_0xbf3d('0x2e')]['event']=_0xbf3d('0x3a');respondWithRpcPromise(_0xbf3d('0x79'),'EventManager',{'event':_0xbf3d('0x7f'),'message':_0x118996[_0xbf3d('0x2e')]},client9002);return _0x362b42;}return null;})['then'](respondWithResult(_0x3cf818,null))[_0xbf3d('0x30')](handleError(_0x3cf818,null));};exports[_0xbf3d('0x31')]=function(_0x47cb1b,_0x1f76b6,_0x3915da){if(_0x47cb1b['body']['id']){delete _0x47cb1b[_0xbf3d('0x5f')]['id'];}var _0x51225c;return db['WhatsappMessage'][_0xbf3d('0x60')]({'where':{'id':_0x47cb1b[_0xbf3d('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1f76b6,null))[_0xbf3d('0x27')](function(_0x1d374b){if(_0x1d374b){_0x51225c=_0x1d374b;return db[_0xbf3d('0x80')][_0xbf3d('0x60')]({'where':{'id':_0x1d374b[_0xbf3d('0x81')]}});}})[_0xbf3d('0x27')](handleEntityNotFound(_0x1f76b6,null))['then'](function(_0x3dccca){if(_0x3dccca){logger[_0xbf3d('0x82')](_0xbf3d('0x83'),_0xbf3d('0x31'),_0xbf3d('0x84'),_0x3dccca[_0xbf3d('0x53')],util[_0xbf3d('0x85')](_0x47cb1b[_0xbf3d('0x5f')],{'showHidden':![],'depth':null}));switch(_0x3dccca['type']){case _0xbf3d('0x86'):if(_0x47cb1b[_0xbf3d('0x5f')][_0xbf3d('0x87')]&&_0x47cb1b[_0xbf3d('0x5f')][_0xbf3d('0x87')]===_0x51225c['messageId']&&_0x47cb1b[_0xbf3d('0x5f')][_0xbf3d('0x88')]&&_0x47cb1b[_0xbf3d('0x5f')][_0xbf3d('0x88')]==='read'){return _0x51225c['update']({'read':!![]});}else{logger[_0xbf3d('0x2c')](_0xbf3d('0x89'),_0xbf3d('0x31'),_0xbf3d('0x86'),util[_0xbf3d('0x85')](_0x47cb1b['body'],{'showHidden':![],'depth':null}));}break;}return _0x51225c;}})['then'](respondWithResult(_0x1f76b6,null))[_0xbf3d('0x30')](handleError(_0x1f76b6,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 1ad4491..2c5f6a7 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(_0x210326,_0x45307c){var _0x1c44b0=function(_0x50c341){while(--_0x50c341){_0x210326['push'](_0x210326['shift']());}};_0x1c44b0(++_0x45307c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1e8a3f,_0x5315f6){_0x1e8a3f=_0x1e8a3f-0x0;var _0x33d4ea=_0x5f2f[_0x1e8a3f];return _0x33d4ea;};'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(_0x37bd68,_0x934c7){var _0x1f4539=function(_0x1aa636){while(--_0x1aa636){_0x37bd68['push'](_0x37bd68['shift']());}};_0x1f4539(++_0x934c7);}(_0x7a54,0x106));var _0x47a5=function(_0x21d3e2,_0x2cc41b){_0x21d3e2=_0x21d3e2-0x0;var _0x1dd320=_0x7a54[_0x21d3e2];return _0x1dd320;};'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 496a17c..fa0ae42 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 _0x7f22=['UserId','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','WhatsappAccount','WhatsappAccountId','type','twilio','authToken','phone','accountSid','create','whatsapp:','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','whatsapp_messages','messageId','body','FULLTEXT','get','direction','toLowerCase','out','secret'];(function(_0x445b99,_0x484fda){var _0x4de4f1=function(_0x36bdee){while(--_0x36bdee){_0x445b99['push'](_0x445b99['shift']());}};_0x4de4f1(++_0x484fda);}(_0x7f22,0x72));var _0x27f2=function(_0x3db747,_0x12e007){_0x3db747=_0x3db747-0x0;var _0x23d242=_0x7f22[_0x3db747];return _0x23d242;};'use strict';var _=require(_0x27f2('0x0'));var util=require('util');var logger=require(_0x27f2('0x1'))('api');var moment=require(_0x27f2('0x2'));var BPromise=require(_0x27f2('0x3'));var rp=require(_0x27f2('0x4'));var fs=require('fs');var path=require(_0x27f2('0x5'));var rimraf=require(_0x27f2('0x6'));var config=require(_0x27f2('0x7'));var attributes=require('./whatsappMessage.attributes');module[_0x27f2('0x8')]=function(_0x183b23,_0x22800e){return _0x183b23['define']('WhatsappMessage',attributes,{'tableName':_0x27f2('0x9'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x27f2('0xa')]},{'name':'fti_whatsapp_messages','fields':[_0x27f2('0xb')],'type':_0x27f2('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x262152,_0x51d89e,_0x136df9){var _0x2c066b=_0x183b23['models'];var _0x34be35=_0x262152[_0x27f2('0xd')]({'plain':!![]});if(_0x34be35[_0x27f2('0xe')][_0x27f2('0xf')]()==='in'||_0x34be35[_0x27f2('0xe')][_0x27f2('0xf')]()===_0x27f2('0x10')&&!_0x34be35[_0x27f2('0x11')]&&!_['isNil'](_0x34be35[_0x27f2('0x12')])){_0x2c066b['WhatsappInteraction'][_0x27f2('0x13')]({'where':{'id':_0x34be35[_0x27f2('0x14')]}})[_0x27f2('0x15')](function(_0x385286){if(_0x385286){_0x385286[_0x27f2('0x16')]({'lastMsgAt':_0x34be35[_0x27f2('0x17')],'lastMsgDirection':_0x34be35[_0x27f2('0xe')][_0x27f2('0xf')]()});}})[_0x27f2('0x18')](function(_0x18f0ea){console[_0x27f2('0x19')](_0x18f0ea);});}if(_0x34be35[_0x27f2('0xe')]===_0x27f2('0x10')&&!_0x34be35['secret']){var _0x29263a;_0x2c066b[_0x27f2('0x1a')]['find']({'where':{'id':_0x34be35[_0x27f2('0x1b')]},'raw':!![]})[_0x27f2('0x15')](function(_0x2f965c){_0x29263a=_0x2f965c;if(_0x29263a&&_0x29263a[_0x27f2('0x1c')]){switch(_0x29263a[_0x27f2('0x1c')]){case _0x27f2('0x1d'):var _0x341ac0=require(_0x27f2('0x1d'));if(_0x29263a['accountSid']&&_0x29263a[_0x27f2('0x1e')]&&_0x29263a[_0x27f2('0x1f')]){var _0x353ceb=new _0x341ac0(_0x29263a[_0x27f2('0x20')],_0x29263a[_0x27f2('0x1e')]);_0x353ceb['messages'][_0x27f2('0x21')]({'body':_0x34be35[_0x27f2('0xb')],'to':'whatsapp:'+_0x34be35['phone'],'from':_0x27f2('0x22')+_0x29263a[_0x27f2('0x1f')],'statusCallback':_0x29263a['remote']+_0x27f2('0x23')+_0x34be35['id']+_0x27f2('0x24')+_0x29263a[_0x27f2('0x25')]})[_0x27f2('0x15')](function(_0x325c33){if(_0x325c33['sid']){return _0x262152['update']({'messageId':_0x325c33[_0x27f2('0x26')]});}})[_0x27f2('0x18')](function(_0xa8f35c){logger[_0x27f2('0x19')](_0x27f2('0x27'),_0x27f2('0x28'),_0x27f2('0x1d'),util['inspect'](_0xa8f35c,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x27f2('0x27'),_0x27f2('0x28'),'twilio',_0x27f2('0x29'));}break;}}})[_0x27f2('0x2a')](function(){_0x136df9();});}else{_0x136df9();}}},'charset':_0x27f2('0x2b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x4698=['exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','WhatsappInteractionId','then','update','catch','error','WhatsappAccountId','type','twilio','accountSid','authToken','messages','create','whatsapp:','phone','remote','/api/whatsapp/messages/','/status?token=','token','sid','inspect','afterCreate','finally','utf8mb4','util','api','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes'];(function(_0x67834f,_0x481217){var _0x1c2302=function(_0x500d3b){while(--_0x500d3b){_0x67834f['push'](_0x67834f['shift']());}};_0x1c2302(++_0x481217);}(_0x4698,0x86));var _0x8469=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x4698[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require('lodash');var util=require(_0x8469('0x0'));var logger=require('../../config/logger')(_0x8469('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8469('0x2'));var fs=require('fs');var path=require(_0x8469('0x3'));var rimraf=require(_0x8469('0x4'));var config=require(_0x8469('0x5'));var attributes=require(_0x8469('0x6'));module[_0x8469('0x7')]=function(_0x4488bd,_0x355b12){return _0x4488bd[_0x8469('0x8')](_0x8469('0x9'),attributes,{'tableName':_0x8469('0xa'),'paranoid':![],'indexes':[{'name':_0x8469('0xb'),'fields':[_0x8469('0xb')]},{'name':_0x8469('0xc'),'fields':[_0x8469('0xd')],'type':_0x8469('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5af42e,_0x48a59c,_0x14d81b){var _0x4ba1a5=_0x4488bd[_0x8469('0xf')];var _0x5244b3=_0x5af42e[_0x8469('0x10')]({'plain':!![]});if(_0x5244b3['direction']['toLowerCase']()==='in'||_0x5244b3[_0x8469('0x11')][_0x8469('0x12')]()===_0x8469('0x13')&&!_0x5244b3[_0x8469('0x14')]&&!_[_0x8469('0x15')](_0x5244b3[_0x8469('0x16')])){_0x4ba1a5[_0x8469('0x17')]['findOne']({'where':{'id':_0x5244b3[_0x8469('0x18')]}})[_0x8469('0x19')](function(_0x345eae){if(_0x345eae){_0x345eae[_0x8469('0x1a')]({'lastMsgAt':_0x5244b3['createdAt'],'lastMsgDirection':_0x5244b3['direction'][_0x8469('0x12')]()});}})[_0x8469('0x1b')](function(_0x1e9b9b){console[_0x8469('0x1c')](_0x1e9b9b);});}if(_0x5244b3[_0x8469('0x11')]==='out'&&!_0x5244b3[_0x8469('0x14')]){var _0x4ced51;_0x4ba1a5['WhatsappAccount']['find']({'where':{'id':_0x5244b3[_0x8469('0x1d')]},'raw':!![]})['then'](function(_0x4be3c2){_0x4ced51=_0x4be3c2;if(_0x4ced51&&_0x4ced51[_0x8469('0x1e')]){switch(_0x4ced51[_0x8469('0x1e')]){case _0x8469('0x1f'):var _0x506760=require('twilio');if(_0x4ced51['accountSid']&&_0x4ced51['authToken']&&_0x4ced51['phone']){var _0x4857c7=new _0x506760(_0x4ced51[_0x8469('0x20')],_0x4ced51[_0x8469('0x21')]);_0x4857c7[_0x8469('0x22')][_0x8469('0x23')]({'body':_0x5244b3[_0x8469('0xd')],'to':_0x8469('0x24')+_0x5244b3[_0x8469('0x25')],'from':'whatsapp:'+_0x4ced51[_0x8469('0x25')],'statusCallback':_0x4ced51[_0x8469('0x26')]+_0x8469('0x27')+_0x5244b3['id']+_0x8469('0x28')+_0x4ced51[_0x8469('0x29')]})[_0x8469('0x19')](function(_0x407b30){if(_0x407b30[_0x8469('0x2a')]){return _0x5af42e[_0x8469('0x1a')]({'messageId':_0x407b30[_0x8469('0x2a')]});}})[_0x8469('0x1b')](function(_0x9f008e){logger[_0x8469('0x1c')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x8469('0x1f'),util[_0x8469('0x2b')](_0x9f008e,{'showHidden':![],'depth':null}));});}else{logger[_0x8469('0x1c')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x8469('0x2c'),_0x8469('0x1f'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})[_0x8469('0x2d')](function(){_0x14d81b();});}else{_0x14d81b();}}},'charset':_0x8469('0x2e'),'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 1f79939..874eb2e 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 _0x0555=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','info','request\x20sent','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','create','options','then','CreateWhatsappMessage','debug'];(function(_0xc66c50,_0x4dfbc1){var _0x48bc6f=function(_0x781d40){while(--_0x781d40){_0xc66c50['push'](_0xc66c50['shift']());}};_0x48bc6f(++_0x4dfbc1);}(_0x0555,0x84));var _0x5055=function(_0x6b4190,_0x4702bf){_0x6b4190=_0x6b4190-0x0;var _0x50e035=_0x0555[_0x6b4190];return _0x50e035;};'use strict';var _=require(_0x5055('0x0'));var util=require(_0x5055('0x1'));var moment=require(_0x5055('0x2'));var BPromise=require(_0x5055('0x3'));var rs=require(_0x5055('0x4'));var fs=require('fs');var Redis=require(_0x5055('0x5'));var db=require(_0x5055('0x6'))['db'];var utils=require(_0x5055('0x7'));var logger=require(_0x5055('0x8'))(_0x5055('0x9'));var config=require(_0x5055('0xa'));var jayson=require(_0x5055('0xb'));var client=jayson[_0x5055('0xc')][_0x5055('0xd')]({'port':0x232a});config[_0x5055('0xe')]=_[_0x5055('0xf')](config[_0x5055('0xe')],{'host':_0x5055('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5055('0xe')]));require('./whatsappMessage.socket')[_0x5055('0x11')](socket);function respondWithRpcPromise(_0x344a62,_0x2ac211,_0x253179){return new BPromise(function(_0x2847dd,_0x5662e3){return client[_0x5055('0x12')](_0x344a62,_0x253179)['then'](function(_0x2667e6){logger[_0x5055('0x13')]('WhatsappMessage,\x20%s,\x20%s',_0x2ac211,_0x5055('0x14'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x2ac211,_0x5055('0x14'),JSON[_0x5055('0x15')](_0x2667e6));if(_0x2667e6['error']){if(_0x2667e6[_0x5055('0x16')][_0x5055('0x17')]===0x1f4){logger[_0x5055('0x16')](_0x5055('0x18'),_0x2ac211,_0x2667e6[_0x5055('0x16')]['message']);return _0x5662e3(_0x2667e6[_0x5055('0x16')][_0x5055('0x19')]);}logger[_0x5055('0x16')](_0x5055('0x18'),_0x2ac211,_0x2667e6[_0x5055('0x16')]['message']);return _0x2847dd(_0x2667e6['error'][_0x5055('0x19')]);}else{logger['info'](_0x5055('0x18'),_0x2ac211,_0x5055('0x14'));_0x2847dd(_0x2667e6[_0x5055('0x1a')][_0x5055('0x19')]);}})[_0x5055('0x1b')](function(_0x39ff96){logger[_0x5055('0x16')](_0x5055('0x18'),_0x2ac211,_0x39ff96);_0x5662e3(_0x39ff96);});});}exports['CreateWhatsappMessage']=function(_0x38d9db){var _0x59ce55=this;return new Promise(function(_0x4a92bd,_0x241c9f){return db['WhatsappMessage'][_0x5055('0x1c')](_0x38d9db['body'],{'raw':_0x38d9db[_0x5055('0x1d')]?_0x38d9db[_0x5055('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x5055('0x1e')](function(_0x24b695){logger['info'](_0x5055('0x1f'),_0x38d9db);logger[_0x5055('0x20')](_0x5055('0x1f'),_0x38d9db,JSON[_0x5055('0x15')](_0x24b695));_0x4a92bd(_0x24b695);})['catch'](function(_0x41f6c3){logger[_0x5055('0x16')]('CreateWhatsappMessage',_0x41f6c3['message'],_0x38d9db);_0x241c9f(_0x59ce55[_0x5055('0x16')](0x1f4,_0x41f6c3[_0x5055('0x19')]));});});}; \ No newline at end of file +var _0x6db7=['WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateWhatsappMessage','WhatsappMessage','body','options','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then'];(function(_0x3bcf9e,_0x148a5d){var _0x1bb37c=function(_0xcaf5da){while(--_0xcaf5da){_0x3bcf9e['push'](_0x3bcf9e['shift']());}};_0x1bb37c(++_0x148a5d);}(_0x6db7,0x140));var _0x76db=function(_0x54a761,_0x431fd4){_0x54a761=_0x54a761-0x0;var _0x37d1da=_0x6db7[_0x54a761];return _0x37d1da;};'use strict';var _=require(_0x76db('0x0'));var util=require(_0x76db('0x1'));var moment=require('moment');var BPromise=require(_0x76db('0x2'));var rs=require(_0x76db('0x3'));var fs=require('fs');var Redis=require(_0x76db('0x4'));var db=require(_0x76db('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x76db('0x6'))(_0x76db('0x7'));var config=require(_0x76db('0x8'));var jayson=require(_0x76db('0x9'));var client=jayson[_0x76db('0xa')][_0x76db('0xb')]({'port':0x232a});config['redis']=_[_0x76db('0xc')](config[_0x76db('0xd')],{'host':_0x76db('0xe'),'port':0x18eb});var socket=require(_0x76db('0xf'))(new Redis(config[_0x76db('0xd')]));require(_0x76db('0x10'))[_0x76db('0x11')](socket);function respondWithRpcPromise(_0x1ba903,_0x1d8473,_0xa80c35){return new BPromise(function(_0x165b35,_0x7e0e8c){return client[_0x76db('0x12')](_0x1ba903,_0xa80c35)[_0x76db('0x13')](function(_0x10b433){logger['info'](_0x76db('0x14'),_0x1d8473,_0x76db('0x15'));logger['debug'](_0x76db('0x16'),_0x1d8473,_0x76db('0x15'),JSON[_0x76db('0x17')](_0x10b433));if(_0x10b433[_0x76db('0x18')]){if(_0x10b433[_0x76db('0x18')][_0x76db('0x19')]===0x1f4){logger['error'](_0x76db('0x14'),_0x1d8473,_0x10b433[_0x76db('0x18')]['message']);return _0x7e0e8c(_0x10b433[_0x76db('0x18')][_0x76db('0x1a')]);}logger[_0x76db('0x18')](_0x76db('0x14'),_0x1d8473,_0x10b433[_0x76db('0x18')][_0x76db('0x1a')]);return _0x165b35(_0x10b433['error'][_0x76db('0x1a')]);}else{logger[_0x76db('0x1b')](_0x76db('0x14'),_0x1d8473,_0x76db('0x15'));_0x165b35(_0x10b433['result'][_0x76db('0x1a')]);}})[_0x76db('0x1c')](function(_0x15b31a){logger[_0x76db('0x18')]('WhatsappMessage,\x20%s,\x20%s',_0x1d8473,_0x15b31a);_0x7e0e8c(_0x15b31a);});});}exports[_0x76db('0x1d')]=function(_0x4d7320){var _0x34c96c=this;return new Promise(function(_0x5cca3e,_0x4be655){return db[_0x76db('0x1e')]['create'](_0x4d7320[_0x76db('0x1f')],{'raw':_0x4d7320[_0x76db('0x20')]?_0x4d7320[_0x76db('0x20')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x16fd97){logger[_0x76db('0x1b')](_0x76db('0x1d'),_0x4d7320);logger[_0x76db('0x21')](_0x76db('0x1d'),_0x4d7320,JSON[_0x76db('0x17')](_0x16fd97));_0x5cca3e(_0x16fd97);})['catch'](function(_0x22e03c){logger[_0x76db('0x18')]('CreateWhatsappMessage',_0x22e03c[_0x76db('0x1a')],_0x4d7320);_0x4be655(_0x34c96c[_0x76db('0x18')](0x1f4,_0x22e03c[_0x76db('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 1d841e0..f71482f 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 _0xc418=['whatsappMessage:','./whatsappMessage.events','save','remove','update','emit','removeListener','register','length'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xc418,0xd9));var _0x8c41=function(_0x5b70ff,_0x19e63c){_0x5b70ff=_0x5b70ff-0x0;var _0x2755d3=_0xc418[_0x5b70ff];return _0x2755d3;};'use strict';var WhatsappMessageEvents=require(_0x8c41('0x0'));var events=[_0x8c41('0x1'),_0x8c41('0x2'),_0x8c41('0x3')];function createListener(_0x1b3f85,_0x218800){return function(_0xd10d2d){_0x218800[_0x8c41('0x4')](_0x1b3f85,_0xd10d2d);};}function removeListener(_0x4a0c2f,_0x41aa83){return function(){WhatsappMessageEvents[_0x8c41('0x5')](_0x4a0c2f,_0x41aa83);};}exports[_0x8c41('0x6')]=function(_0x141a52){for(var _0x4b5e4e=0x0,_0x1f2c94=events[_0x8c41('0x7')];_0x4b5e4e<_0x1f2c94;_0x4b5e4e++){var _0x1b7652=events[_0x4b5e4e];var _0x674f5a=createListener(_0x8c41('0x8')+_0x1b7652,_0x141a52);WhatsappMessageEvents['on'](_0x1b7652,_0x674f5a);}}; \ No newline at end of file +var _0x5b92=['save','update','emit','register','length','whatsappMessage:','./whatsappMessage.events'];(function(_0x177cc9,_0x3f6fdd){var _0x2fe577=function(_0xa98e83){while(--_0xa98e83){_0x177cc9['push'](_0x177cc9['shift']());}};_0x2fe577(++_0x3f6fdd);}(_0x5b92,0xdf));var _0x25b9=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x5b92[_0x55e08b];return _0xd1a7ff;};'use strict';var WhatsappMessageEvents=require(_0x25b9('0x0'));var events=[_0x25b9('0x1'),'remove',_0x25b9('0x2')];function createListener(_0x3ea2af,_0x10ef0c){return function(_0x499622){_0x10ef0c[_0x25b9('0x3')](_0x3ea2af,_0x499622);};}function removeListener(_0x446bbe,_0x5440a3){return function(){WhatsappMessageEvents['removeListener'](_0x446bbe,_0x5440a3);};}exports[_0x25b9('0x4')]=function(_0x189d38){for(var _0x12d028=0x0,_0x2f9009=events[_0x25b9('0x5')];_0x12d028<_0x2f9009;_0x12d028++){var _0x2f7b81=events[_0x12d028];var _0x862a56=createListener(_0x25b9('0x6')+_0x2f7b81,_0x189d38);WhatsappMessageEvents['on'](_0x2f7b81,_0x862a56);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 8065e54..3d1a621 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 _0xe4a4=['/:id/users','addAgents','put','update','delete','removeTeams','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller','get','/describe','isAuthenticated','describe','/:id','/:id/members','getMembers','/:id/teams','getAgents','create','post'];(function(_0x4bbfee,_0x5bc430){var _0x36c7b4=function(_0x4b6c27){while(--_0x4b6c27){_0x4bbfee['push'](_0x4bbfee['shift']());}};_0x36c7b4(++_0x5bc430);}(_0xe4a4,0x1e6));var _0x4e4a=function(_0x575b72,_0x1a7eb1){_0x575b72=_0x575b72-0x0;var _0x561c57=_0xe4a4[_0x575b72];return _0x561c57;};'use strict';var multer=require('multer');var util=require(_0x4e4a('0x0'));var path=require(_0x4e4a('0x1'));var timeout=require('connect-timeout');var express=require(_0x4e4a('0x2'));var router=express[_0x4e4a('0x3')]();var auth=require(_0x4e4a('0x4'));var interaction=require(_0x4e4a('0x5'));var config=require('../../config/environment');var controller=require(_0x4e4a('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x4e4a('0x7')](_0x4e4a('0x8'),auth[_0x4e4a('0x9')](),controller[_0x4e4a('0xa')]);router[_0x4e4a('0x7')](_0x4e4a('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x4e4a('0x7')](_0x4e4a('0xc'),auth[_0x4e4a('0x9')](),controller[_0x4e4a('0xd')]);router[_0x4e4a('0x7')](_0x4e4a('0xe'),auth[_0x4e4a('0x9')](),controller['getTeams']);router['get']('/:id/users',auth[_0x4e4a('0x9')](),controller[_0x4e4a('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4e4a('0x10')]);router[_0x4e4a('0x11')](_0x4e4a('0xe'),auth['isAuthenticated'](),controller['addTeams']);router[_0x4e4a('0x11')](_0x4e4a('0x12'),auth['isAuthenticated'](),controller[_0x4e4a('0x13')]);router[_0x4e4a('0x14')]('/:id',auth[_0x4e4a('0x9')](),controller[_0x4e4a('0x15')]);router[_0x4e4a('0x16')](_0x4e4a('0xb'),auth[_0x4e4a('0x9')](),controller['destroy']);router[_0x4e4a('0x16')](_0x4e4a('0xe'),auth['isAuthenticated'](),controller[_0x4e4a('0x17')]);router[_0x4e4a('0x16')](_0x4e4a('0x12'),auth[_0x4e4a('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x328e=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x328e,0xf4));var _0xe328=function(_0x22301d,_0x4dd4bb){_0x22301d=_0x22301d-0x0;var _0x1693ef=_0x328e[_0x22301d];return _0x1693ef;};'use strict';var multer=require(_0xe328('0x0'));var util=require(_0xe328('0x1'));var path=require(_0xe328('0x2'));var timeout=require(_0xe328('0x3'));var express=require(_0xe328('0x4'));var router=express[_0xe328('0x5')]();var auth=require(_0xe328('0x6'));var interaction=require(_0xe328('0x7'));var config=require(_0xe328('0x8'));var controller=require(_0xe328('0x9'));router[_0xe328('0xa')]('/',auth[_0xe328('0xb')](),controller[_0xe328('0xc')]);router[_0xe328('0xa')](_0xe328('0xd'),auth[_0xe328('0xb')](),controller[_0xe328('0xe')]);router[_0xe328('0xa')](_0xe328('0xf'),auth[_0xe328('0xb')](),controller[_0xe328('0x10')]);router[_0xe328('0xa')](_0xe328('0x11'),auth[_0xe328('0xb')](),controller[_0xe328('0x12')]);router[_0xe328('0xa')]('/:id/teams',auth[_0xe328('0xb')](),controller['getTeams']);router[_0xe328('0xa')](_0xe328('0x13'),auth[_0xe328('0xb')](),controller[_0xe328('0x14')]);router[_0xe328('0x15')]('/',auth[_0xe328('0xb')](),controller[_0xe328('0x16')]);router[_0xe328('0x15')](_0xe328('0x17'),auth[_0xe328('0xb')](),controller[_0xe328('0x18')]);router[_0xe328('0x15')](_0xe328('0x13'),auth['isAuthenticated'](),controller[_0xe328('0x19')]);router[_0xe328('0x1a')]('/:id',auth[_0xe328('0xb')](),controller[_0xe328('0x1b')]);router[_0xe328('0x1c')]('/:id',auth[_0xe328('0xb')](),controller['destroy']);router[_0xe328('0x1c')](_0xe328('0x17'),auth['isAuthenticated'](),controller[_0xe328('0x1d')]);router[_0xe328('0x1c')]('/:id/users',auth['isAuthenticated'](),controller[_0xe328('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 55bc4be..c9b3032 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 _0x94f3=['roundrobin','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x4f36cc,_0x4c83ec){var _0x232c29=function(_0x5a07e9){while(--_0x5a07e9){_0x4f36cc['push'](_0x4f36cc['shift']());}};_0x232c29(++_0x4c83ec);}(_0x94f3,0x119));var _0x394f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x94f3[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require('sequelize');module[_0x394f('0x0')]={'name':{'type':Sequelize[_0x394f('0x1')],'unique':_0x394f('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x394f('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x394f('0x4')](_0x394f('0x5'),_0x394f('0x6'),_0x394f('0x7'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5489=['sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x2ea387,_0x4816d0){var _0x30fb4e=function(_0x318598){while(--_0x318598){_0x2ea387['push'](_0x2ea387['shift']());}};_0x30fb4e(++_0x4816d0);}(_0x5489,0x99));var _0x9548=function(_0x51e21d,_0x202482){_0x51e21d=_0x51e21d-0x0;var _0x5b13ec=_0x5489[_0x51e21d];return _0x5b13ec;};'use strict';var Sequelize=require(_0x9548('0x0'));module[_0x9548('0x1')]={'name':{'type':Sequelize[_0x9548('0x2')],'unique':_0x9548('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x9548('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9548('0x5')](_0x9548('0x6'),_0x9548('0x7'),_0x9548('0x8'))},'description':{'type':Sequelize[_0x9548('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index a90f0dd..ce739d0 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 _0x5d4e=['nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','find','catch','create','user','UserProfileSection','userProfileId','autoAssociation','body','params','describe','getMembers','UserWhatsappQueue','hasOwnProperty','WhatsappQueueId','User','findAndCountAll','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','Team','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','select','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','all','union','compact','value','removeTeams','ids','isEmpty','removeAgents','addAgents','userWhatsappQueue:remove','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','limit','set','apply','save','update','then','destroy','get','WhatsappQueues','UserProfileResource','error','name','send','index','WhatsappQueue','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length'];(function(_0x547ff4,_0x416fa1){var _0xe41057=function(_0x1afe63){while(--_0x1afe63){_0x547ff4['push'](_0x547ff4['shift']());}};_0xe41057(++_0x416fa1);}(_0x5d4e,0x15b));var _0xe5d4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5d4e[_0xa464c9];return _0x3d73c4;};'use strict';var pdf=require(_0xe5d4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe5d4('0x1'));var zipdir=require(_0xe5d4('0x2'));var jsonpatch=require(_0xe5d4('0x3'));var rp=require(_0xe5d4('0x4'));var moment=require(_0xe5d4('0x5'));var BPromise=require(_0xe5d4('0x6'));var Mustache=require(_0xe5d4('0x7'));var util=require(_0xe5d4('0x8'));var path=require(_0xe5d4('0x9'));var sox=require(_0xe5d4('0xa'));var csv=require(_0xe5d4('0xb'));var ejs=require(_0xe5d4('0xc'));var fs=require('fs');var _=require(_0xe5d4('0xd'));var squel=require('squel');var crypto=require(_0xe5d4('0xe'));var jsforce=require(_0xe5d4('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xe5d4('0xb'));var querystring=require(_0xe5d4('0x10'));var Papa=require(_0xe5d4('0x11'));var Redis=require('ioredis');var authService=require(_0xe5d4('0x12'));var qs=require(_0xe5d4('0x13'));var as=require(_0xe5d4('0x14'));var hardwareService=require(_0xe5d4('0x15'));var logger=require('../../config/logger')(_0xe5d4('0x16'));var utils=require(_0xe5d4('0x17'));var config=require('../../config/environment');var db=require(_0xe5d4('0x18'))['db'];config[_0xe5d4('0x19')]=_['defaults'](config[_0xe5d4('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xe5d4('0x1a'))(new Redis(config[_0xe5d4('0x19')]));require(_0xe5d4('0x1b'))[_0xe5d4('0x1c')](socket);function respondWithStatusCode(_0x4a7d44,_0x104a7c){_0x104a7c=_0x104a7c||0xcc;return function(_0x17fee5){if(_0x17fee5){return _0x4a7d44[_0xe5d4('0x1d')](_0x104a7c);}return _0x4a7d44[_0xe5d4('0x1e')](_0x104a7c)[_0xe5d4('0x1f')]();};}function respondWithResult(_0x512f7d,_0x54f60c){_0x54f60c=_0x54f60c||0xc8;return function(_0x3bcb5b){if(_0x3bcb5b){return _0x512f7d[_0xe5d4('0x1e')](_0x54f60c)[_0xe5d4('0x20')](_0x3bcb5b);}};}function respondWithFilteredResult(_0x143ba7,_0x1b487c){return function(_0x51c432){if(_0x51c432){var _0x98db4a=_0x51c432['count'],_0x4cc550=_0x1b487c[_0xe5d4('0x21')],_0x3492e0=_0x1b487c['offset']+_0x1b487c[_0xe5d4('0x22')],_0x332af7;if(_0x3492e0>=_0x98db4a){_0x3492e0=_0x98db4a;_0x332af7=0xc8;}else{_0x332af7=0xce;}_0x143ba7[_0xe5d4('0x1e')](_0x332af7);return _0x143ba7[_0xe5d4('0x23')]('Content-Range',_0x4cc550+'-'+_0x3492e0+'/'+_0x98db4a)['json'](_0x51c432);}return null;};}function patchUpdates(_0x4bc522){return function(_0x1f536b){try{jsonpatch[_0xe5d4('0x24')](_0x1f536b,_0x4bc522,!![]);}catch(_0x2eab4c){return BPromise['reject'](_0x2eab4c);}return _0x1f536b[_0xe5d4('0x25')]();};}function saveUpdates(_0x165471,_0x4bbc76){return function(_0x576954){if(_0x576954){return _0x576954[_0xe5d4('0x26')](_0x165471)[_0xe5d4('0x27')](function(_0xcea08b){return _0xcea08b;});}return null;};}function removeEntity(_0x832fe4,_0x45282b){return function(_0x392fa0){if(_0x392fa0){return _0x392fa0[_0xe5d4('0x28')]()[_0xe5d4('0x27')](function(){var _0x357433=_0x392fa0[_0xe5d4('0x29')]({'plain':!![]});var _0x2707db=_0xe5d4('0x2a');return db[_0xe5d4('0x2b')][_0xe5d4('0x28')]({'where':{'type':_0x2707db,'resourceId':_0x357433['id']}})[_0xe5d4('0x27')](function(){return _0x392fa0;});})[_0xe5d4('0x27')](function(){_0x832fe4[_0xe5d4('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d3879,_0x469a64){return function(_0x3f07c1){if(!_0x3f07c1){_0x2d3879['sendStatus'](0x194);}return _0x3f07c1;};}function handleError(_0x84e0e3,_0x37e59a){_0x37e59a=_0x37e59a||0x1f4;return function(_0x3ad402){logger[_0xe5d4('0x2c')](_0x3ad402['stack']);if(_0x3ad402[_0xe5d4('0x2d')]){delete _0x3ad402[_0xe5d4('0x2d')];}_0x84e0e3[_0xe5d4('0x1e')](_0x37e59a)[_0xe5d4('0x2e')](_0x3ad402);};}exports[_0xe5d4('0x2f')]=function(_0x510bca,_0x13b20f){var _0x5a5f54={},_0x1ba10c={},_0x262263={'count':0x0,'rows':[]};var _0x3df043=_['map'](db[_0xe5d4('0x30')][_0xe5d4('0x31')],function(_0x1190a2){return{'name':_0x1190a2[_0xe5d4('0x32')],'type':_0x1190a2['type'][_0xe5d4('0x33')]};});_0x1ba10c[_0xe5d4('0x34')]=_[_0xe5d4('0x35')](_0x3df043,_0xe5d4('0x2d'));_0x1ba10c[_0xe5d4('0x36')]=_[_0xe5d4('0x37')](_0x510bca[_0xe5d4('0x36')]);_0x1ba10c[_0xe5d4('0x38')]=_[_0xe5d4('0x39')](_0x1ba10c[_0xe5d4('0x34')],_0x1ba10c[_0xe5d4('0x36')]);_0x5a5f54['attributes']=_[_0xe5d4('0x39')](_0x1ba10c['model'],qs['fields'](_0x510bca[_0xe5d4('0x36')][_0xe5d4('0x3a')]));_0x5a5f54[_0xe5d4('0x3b')]=_0x5a5f54['attributes'][_0xe5d4('0x3c')]?_0x5a5f54['attributes']:_0x1ba10c['model'];if(!_0x510bca[_0xe5d4('0x36')]['hasOwnProperty'](_0xe5d4('0x3d'))){_0x5a5f54[_0xe5d4('0x22')]=qs[_0xe5d4('0x22')](_0x510bca[_0xe5d4('0x36')][_0xe5d4('0x22')]);_0x5a5f54[_0xe5d4('0x21')]=qs[_0xe5d4('0x21')](_0x510bca[_0xe5d4('0x36')]['offset']);}_0x5a5f54[_0xe5d4('0x3e')]=qs[_0xe5d4('0x3f')](_0x510bca[_0xe5d4('0x36')][_0xe5d4('0x3f')]);_0x5a5f54[_0xe5d4('0x40')]=qs[_0xe5d4('0x38')](_[_0xe5d4('0x41')](_0x510bca[_0xe5d4('0x36')],_0x1ba10c['filters']),_0x3df043);if(_0x510bca[_0xe5d4('0x36')][_0xe5d4('0x42')]){_0x5a5f54[_0xe5d4('0x40')]=_[_0xe5d4('0x43')](_0x5a5f54[_0xe5d4('0x40')],{'$or':_[_0xe5d4('0x35')](_0x3df043,function(_0x18e78c){if(_0x18e78c['type']!==_0xe5d4('0x44')){var _0x27f683={};_0x27f683[_0x18e78c['name']]={'$like':'%'+_0x510bca[_0xe5d4('0x36')]['filter']+'%'};return _0x27f683;}})});}_0x5a5f54=_[_0xe5d4('0x43')]({},_0x5a5f54,_0x510bca[_0xe5d4('0x45')]);var _0xe1d6dc={'where':_0x5a5f54[_0xe5d4('0x40')]};return db[_0xe5d4('0x30')][_0xe5d4('0x46')](_0xe1d6dc)[_0xe5d4('0x27')](function(_0x20617f){_0x262263[_0xe5d4('0x46')]=_0x20617f;if(_0x510bca[_0xe5d4('0x36')][_0xe5d4('0x47')]){_0x5a5f54[_0xe5d4('0x48')]=[{'all':!![]}];}return db[_0xe5d4('0x30')][_0xe5d4('0x49')](_0x5a5f54);})[_0xe5d4('0x27')](function(_0x2f2b25){_0x262263[_0xe5d4('0x4a')]=_0x2f2b25;return _0x262263;})['then'](respondWithFilteredResult(_0x13b20f,_0x5a5f54))['catch'](handleError(_0x13b20f,null));};exports['show']=function(_0x4a828c,_0x404c36){var _0x55cb32={'raw':!![],'where':{'id':_0x4a828c['params']['id']}},_0x58d262={};_0x58d262[_0xe5d4('0x34')]=_[_0xe5d4('0x37')](db[_0xe5d4('0x30')][_0xe5d4('0x31')]);_0x58d262[_0xe5d4('0x36')]=_[_0xe5d4('0x37')](_0x4a828c[_0xe5d4('0x36')]);_0x58d262['filters']=_[_0xe5d4('0x39')](_0x58d262['model'],_0x58d262[_0xe5d4('0x36')]);_0x55cb32[_0xe5d4('0x3b')]=_[_0xe5d4('0x39')](_0x58d262[_0xe5d4('0x34')],qs[_0xe5d4('0x3a')](_0x4a828c[_0xe5d4('0x36')][_0xe5d4('0x3a')]));_0x55cb32[_0xe5d4('0x3b')]=_0x55cb32[_0xe5d4('0x3b')][_0xe5d4('0x3c')]?_0x55cb32[_0xe5d4('0x3b')]:_0x58d262['model'];if(_0x4a828c[_0xe5d4('0x36')][_0xe5d4('0x47')]){_0x55cb32[_0xe5d4('0x48')]=[{'all':!![]}];}_0x55cb32=_[_0xe5d4('0x43')]({},_0x55cb32,_0x4a828c[_0xe5d4('0x45')]);return db[_0xe5d4('0x30')][_0xe5d4('0x4b')](_0x55cb32)[_0xe5d4('0x27')](handleEntityNotFound(_0x404c36,null))[_0xe5d4('0x27')](respondWithResult(_0x404c36,null))[_0xe5d4('0x4c')](handleError(_0x404c36,null));};exports[_0xe5d4('0x4d')]=function(_0x5d60ca,_0x17fd97){return db['WhatsappQueue'][_0xe5d4('0x4d')](_0x5d60ca['body'],{})['then'](function(_0x1855cf){var _0x24d886=_0x5d60ca[_0xe5d4('0x4e')][_0xe5d4('0x29')]({'plain':!![]});if(!_0x24d886)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x24d886['role']===_0xe5d4('0x4e')){var _0x2ef27b=_0x1855cf[_0xe5d4('0x29')]({'plain':!![]});var _0x2b800a=_0xe5d4('0x2a');return db[_0xe5d4('0x4f')][_0xe5d4('0x4b')]({'where':{'name':_0x2b800a,'userProfileId':_0x24d886[_0xe5d4('0x50')]},'raw':!![]})[_0xe5d4('0x27')](function(_0x5f87cf){if(_0x5f87cf&&_0x5f87cf[_0xe5d4('0x51')]===0x0){return db[_0xe5d4('0x2b')]['create']({'name':_0x2ef27b['name'],'resourceId':_0x2ef27b['id'],'type':_0x5f87cf['name'],'sectionId':_0x5f87cf['id']},{})[_0xe5d4('0x27')](function(){return _0x1855cf;});}else{return _0x1855cf;}})[_0xe5d4('0x4c')](function(_0x5432a1){logger[_0xe5d4('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5432a1);throw _0x5432a1;});}return _0x1855cf;})['then'](respondWithResult(_0x17fd97,0xc9))['catch'](handleError(_0x17fd97,null));};exports[_0xe5d4('0x26')]=function(_0x226ca0,_0x362b36){if(_0x226ca0[_0xe5d4('0x52')]['id']){delete _0x226ca0[_0xe5d4('0x52')]['id'];}return db[_0xe5d4('0x30')][_0xe5d4('0x4b')]({'where':{'id':_0x226ca0[_0xe5d4('0x53')]['id']}})['then'](handleEntityNotFound(_0x362b36,null))[_0xe5d4('0x27')](saveUpdates(_0x226ca0[_0xe5d4('0x52')],null))[_0xe5d4('0x27')](respondWithResult(_0x362b36,null))[_0xe5d4('0x4c')](handleError(_0x362b36,null));};exports[_0xe5d4('0x28')]=function(_0x31b456,_0x83c44e){return db['WhatsappQueue'][_0xe5d4('0x4b')]({'where':{'id':_0x31b456[_0xe5d4('0x53')]['id']}})[_0xe5d4('0x27')](handleEntityNotFound(_0x83c44e,null))[_0xe5d4('0x27')](removeEntity(_0x83c44e,null))['catch'](handleError(_0x83c44e,null));};exports[_0xe5d4('0x54')]=function(_0x186691,_0x1e739b){return db[_0xe5d4('0x30')][_0xe5d4('0x54')]()[_0xe5d4('0x27')](respondWithResult(_0x1e739b,null))[_0xe5d4('0x4c')](handleError(_0x1e739b,null));};exports[_0xe5d4('0x55')]=function(_0x2b1117,_0x3bb4cb,_0x5eb520){var _0xd1a534={'raw':!![],'where':{}},_0x34e2eb={},_0x394580;return db[_0xe5d4('0x30')]['findOne']({'where':{'id':_0x2b1117['params']['id']}})[_0xe5d4('0x27')](handleEntityNotFound(_0x3bb4cb,null))[_0xe5d4('0x27')](function(_0xf032aa){if(_0xf032aa){_0x394580=_0xf032aa[_0xe5d4('0x29')]({'plain':!![]});_0x34e2eb[_0xe5d4('0x34')]=_[_0xe5d4('0x37')](db[_0xe5d4('0x56')][_0xe5d4('0x31')]);_0x34e2eb['query']=_[_0xe5d4('0x37')](_0x2b1117[_0xe5d4('0x36')]);_0x34e2eb['filters']=_[_0xe5d4('0x39')](_0x34e2eb[_0xe5d4('0x34')],_0x34e2eb[_0xe5d4('0x36')]);_0xd1a534[_0xe5d4('0x3b')]=_[_0xe5d4('0x39')](_0x34e2eb[_0xe5d4('0x34')],qs[_0xe5d4('0x3a')](_0x2b1117['query']['fields']));_0xd1a534['attributes']=_0xd1a534[_0xe5d4('0x3b')][_0xe5d4('0x3c')]?_0xd1a534[_0xe5d4('0x3b')]:_0x34e2eb[_0xe5d4('0x34')];if(!_0x2b1117['query'][_0xe5d4('0x57')]('nolimit')){_0xd1a534['limit']=qs[_0xe5d4('0x22')](_0x2b1117['query']['limit']);_0xd1a534[_0xe5d4('0x21')]=qs[_0xe5d4('0x21')](_0x2b1117['query']['offset']);}_0xd1a534[_0xe5d4('0x3e')]=qs[_0xe5d4('0x3f')](_0x2b1117[_0xe5d4('0x36')]['sort']);_0xd1a534[_0xe5d4('0x40')]=qs[_0xe5d4('0x38')](_['pick'](_0x2b1117['query'],_0x34e2eb[_0xe5d4('0x38')]));_0xd1a534[_0xe5d4('0x40')][_0xe5d4('0x58')]=_0xf032aa['id'];if(_0x2b1117[_0xe5d4('0x36')][_0xe5d4('0x42')]){_0xd1a534['where']=_[_0xe5d4('0x43')](_0xd1a534[_0xe5d4('0x40')],{'$or':_[_0xe5d4('0x35')](_0xd1a534[_0xe5d4('0x3b')],function(_0x3563d2){var _0x394c70={};_0x394c70[_0x3563d2]={'$like':'%'+_0x2b1117[_0xe5d4('0x36')][_0xe5d4('0x42')]+'%'};return _0x394c70;})});}_0xd1a534=_[_0xe5d4('0x43')]({},_0xd1a534,_0x2b1117['options']);return db[_0xe5d4('0x56')][_0xe5d4('0x49')](_0xd1a534);}})[_0xe5d4('0x27')](function(_0x27e5d7){if(_0x27e5d7){return db[_0xe5d4('0x59')][_0xe5d4('0x5a')]({'where':{'id':_[_0xe5d4('0x35')](_0x27e5d7,'UserId'),'role':_0xe5d4('0x5b')},'attributes':['id',_0xe5d4('0x2d'),_0xe5d4('0x5c'),_0xe5d4('0x5d'),_0xe5d4('0x5e')]});}})['then'](function(_0x2dbdbd){if(_0x2dbdbd){return{'count':_0x2dbdbd[_0xe5d4('0x46')],'rows':_['map'](_0x2dbdbd[_0xe5d4('0x4a')],function(_0x3415a0){return{'membername':_0x3415a0[_0xe5d4('0x2d')],'UserId':_0x3415a0['id'],'queue_name':_0x394580[_0xe5d4('0x2d')],'WhatsappQueueId':_0x394580['id'],'interface':util[_0xe5d4('0x5f')](_0xe5d4('0x60'),_0xe5d4('0x61'),_0x3415a0['name']),'penalty':0x0,'paused':_0x3415a0[_0xe5d4('0x5c')],'createdAt':_0x3415a0[_0xe5d4('0x5e')],'updatedAt':_0x3415a0['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xe5d4('0x27')](respondWithFilteredResult(_0x3bb4cb,_0xd1a534))[_0xe5d4('0x4c')](handleError(_0x3bb4cb,null));};exports[_0xe5d4('0x62')]=function(_0xbdd81,_0x41740a,_0x3e252d){var _0x2d0295={};var _0x124c00={};var _0x5bdc93;var _0x31522f;return db['WhatsappQueue'][_0xe5d4('0x63')]({'where':{'id':_0xbdd81[_0xe5d4('0x53')]['id']}})['then'](handleEntityNotFound(_0x41740a,null))[_0xe5d4('0x27')](function(_0xde70bc){if(_0xde70bc){_0x5bdc93=_0xde70bc;_0x124c00[_0xe5d4('0x34')]=_[_0xe5d4('0x37')](db[_0xe5d4('0x64')]['rawAttributes']);_0x124c00[_0xe5d4('0x36')]=_[_0xe5d4('0x37')](_0xbdd81[_0xe5d4('0x36')]);_0x124c00['filters']=_[_0xe5d4('0x39')](_0x124c00['model'],_0x124c00[_0xe5d4('0x36')]);_0x2d0295[_0xe5d4('0x3b')]=_[_0xe5d4('0x39')](_0x124c00[_0xe5d4('0x34')],qs[_0xe5d4('0x3a')](_0xbdd81[_0xe5d4('0x36')][_0xe5d4('0x3a')]));_0x2d0295[_0xe5d4('0x3b')]=_0x2d0295[_0xe5d4('0x3b')][_0xe5d4('0x3c')]?_0x2d0295[_0xe5d4('0x3b')]:_0x124c00['model'];_0x2d0295['order']=qs[_0xe5d4('0x3f')](_0xbdd81[_0xe5d4('0x36')]['sort']);_0x2d0295[_0xe5d4('0x40')]=qs[_0xe5d4('0x38')](_[_0xe5d4('0x41')](_0xbdd81[_0xe5d4('0x36')],_0x124c00[_0xe5d4('0x38')]));if(_0xbdd81[_0xe5d4('0x36')][_0xe5d4('0x42')]){_0x2d0295[_0xe5d4('0x40')]=_[_0xe5d4('0x43')](_0x2d0295[_0xe5d4('0x40')],{'$or':_[_0xe5d4('0x35')](_0x2d0295[_0xe5d4('0x3b')],function(_0x1b0080){var _0x2b5642={};_0x2b5642[_0x1b0080]={'$like':'%'+_0xbdd81['query'][_0xe5d4('0x42')]+'%'};return _0x2b5642;})});}_0x2d0295=_[_0xe5d4('0x43')]({},_0x2d0295,_0xbdd81[_0xe5d4('0x45')]);return _0x5bdc93[_0xe5d4('0x62')](_0x2d0295);}})['then'](function(_0x21b204){if(_0x21b204){_0x31522f=_0x21b204[_0xe5d4('0x3c')];if(!_0xbdd81[_0xe5d4('0x36')][_0xe5d4('0x57')]('nolimit')){_0x2d0295[_0xe5d4('0x22')]=qs[_0xe5d4('0x22')](_0xbdd81[_0xe5d4('0x36')]['limit']);_0x2d0295[_0xe5d4('0x21')]=qs[_0xe5d4('0x21')](_0xbdd81[_0xe5d4('0x36')][_0xe5d4('0x21')]);}return _0x5bdc93[_0xe5d4('0x62')](_0x2d0295);}})[_0xe5d4('0x27')](function(_0xcd93ac){if(_0xcd93ac){return _0xcd93ac?{'count':_0x31522f,'rows':_0xcd93ac}:null;}})[_0xe5d4('0x27')](respondWithResult(_0x41740a,null))[_0xe5d4('0x4c')](handleError(_0x41740a,null));};exports['addTeams']=function(_0x484b8e,_0xa62318,_0x3341da){var _0x2ebbf1=_0x484b8e[_0xe5d4('0x52')]['ids'];return db[_0xe5d4('0x64')]['findAll']({'where':{'id':_0x2ebbf1},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe5d4('0x65'),'attributes':['id',_0xe5d4('0x2d'),_0xe5d4('0x66'),_0xe5d4('0x67'),'interface'],'raw':!![]}]})[_0xe5d4('0x27')](function(_0x1327ce){if(_0x1327ce){var _0x218d74=_[_0xe5d4('0x68')](_0x1327ce,function(_0x39cfa5){var _0x53fc36=_0x39cfa5[_0xe5d4('0x29')]({'plain':!![]});return _0x53fc36[_0xe5d4('0x65')];});return db[_0xe5d4('0x30')]['find']({'where':{'id':_0x484b8e[_0xe5d4('0x53')]['id']}})[_0xe5d4('0x27')](function(_0x2d5c07){return db[_0xe5d4('0x69')][_0xe5d4('0x6a')](function(_0x103854){return _0x2d5c07['addTeams'](_0x2ebbf1,{'transaction':_0x103854})[_0xe5d4('0x27')](function(){return BPromise[_0xe5d4('0x6b')](_0x218d74,function(_0x569b31){return db[_0xe5d4('0x56')][_0xe5d4('0x6c')]({'where':{'UserId':_0x569b31['id'],'WhatsappQueueId':_0x484b8e['params']['id']},'transaction':_0x103854});});})[_0xe5d4('0x27')](function(){_0x218d74[_0xe5d4('0x6d')](function(_0x9359ea){socket[_0xe5d4('0x6e')](_0xe5d4('0x6f'),{'UserId':_0x9359ea['id'],'WhatsappQueueId':_0x2d5c07['id']});});});});});}})[_0xe5d4('0x27')](respondWithStatusCode(_0xa62318,null))[_0xe5d4('0x4c')](handleError(_0xa62318,null));};exports['removeTeams']=function(_0x4b8457,_0x56aacb,_0x5d95d8){return db['Team'][_0xe5d4('0x49')]({'where':{'id':_0x4b8457[_0xe5d4('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0xe5d4('0x59')],'as':_0xe5d4('0x65'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x56aacb,null))['then'](function(_0x26b1c9){var _0x580bfd=_[_0xe5d4('0x35')](_0x26b1c9,'id');var _0x1ba15f=[];var _0xb30c7f=[];var _0x3b1fe7=squel[_0xe5d4('0x70')]();_0x3b1fe7['field'](_0xe5d4('0x71'))[_0xe5d4('0x72')](_0xe5d4('0x73'),'tq')[_0xe5d4('0x74')](_0xe5d4('0x75'),'ut',_0xe5d4('0x76'))[_0xe5d4('0x40')]('WhatsappQueueId\x20=\x20?',_0x4b8457[_0xe5d4('0x53')]['id']);for(var _0x1253a6=0x0;_0x1253a6<_0x26b1c9[_0xe5d4('0x3c')];_0x1253a6+=0x1){let _0x13c573=_0x26b1c9[_0x1253a6];for(var _0x767ec0=0x0;_0x767ec0<_0x13c573['Agents'][_0xe5d4('0x3c')];_0x767ec0+=0x1){let _0x40df14=_0x13c573['Agents'][_0x767ec0];var _0x4d7d03=_0x3b1fe7[_0xe5d4('0x77')]();_0x4d7d03[_0xe5d4('0x40')](_0xe5d4('0x78'),_0x40df14['id']);_0xb30c7f[_0xe5d4('0x79')](db[_0xe5d4('0x69')]['query'](_0x4d7d03[_0xe5d4('0x7a')](),{'type':db[_0xe5d4('0x69')]['QueryTypes'][_0xe5d4('0x7b')]})['then'](function(_0x2f35fb){if(_0x2f35fb[_0xe5d4('0x3c')]===0x1){return _0x40df14['id'];}else{var _0x2d1a17=_[_0xe5d4('0x7c')](_['map'](_0x2f35fb,'TeamId'),function(_0x5afaa8){return _['includes'](_0x580bfd,_0x5afaa8);});if(_0x2d1a17){return _0x40df14['id'];}}}));}}return BPromise[_0xe5d4('0x7d')](_0xb30c7f)[_0xe5d4('0x27')](function(_0xbdee7a){_0x1ba15f=_(_0x1ba15f)[_0xe5d4('0x7e')](_0xbdee7a)[_0xe5d4('0x7f')]()[_0xe5d4('0x80')]();return db[_0xe5d4('0x30')][_0xe5d4('0x4b')]({'where':{'id':_0x4b8457['params']['id']}})[_0xe5d4('0x27')](function(_0x503c5b){return db[_0xe5d4('0x69')]['transaction'](function(_0x50c10c){return _0x503c5b[_0xe5d4('0x81')](_0x4b8457[_0xe5d4('0x36')][_0xe5d4('0x82')],{'transaction':_0x50c10c})[_0xe5d4('0x27')](function(){if(!_[_0xe5d4('0x83')](_0x1ba15f)){return _0x503c5b[_0xe5d4('0x84')](_0x1ba15f,{'transaction':_0x50c10c});}})[_0xe5d4('0x27')](function(){_0x1ba15f[_0xe5d4('0x6d')](function(_0x30ef2d){socket['emit']('userWhatsappQueue:remove',{'UserId':_0x30ef2d,'WhatsappQueueId':_0x503c5b['id']});});});});});});})[_0xe5d4('0x27')](respondWithStatusCode(_0x56aacb,null))[_0xe5d4('0x4c')](handleError(_0x56aacb,null));};exports[_0xe5d4('0x85')]=function(_0x3d012c,_0x16de9b,_0x48e546){return db[_0xe5d4('0x30')]['find']({'where':{'id':_0x3d012c[_0xe5d4('0x53')]['id']}})[_0xe5d4('0x27')](handleEntityNotFound(_0x16de9b,null))[_0xe5d4('0x27')](function(_0x467aba){if(_0x467aba){return _0x467aba[_0xe5d4('0x85')](_0x3d012c['body'][_0xe5d4('0x82')],_['omit'](_0x3d012c['body'],[_0xe5d4('0x82'),'id'])||{})['spread'](function(_0x80712b){for(var _0x8df151=0x0;_0x8df151<_0x3d012c[_0xe5d4('0x52')][_0xe5d4('0x82')][_0xe5d4('0x3c')];_0x8df151+=0x1){socket['emit'](_0xe5d4('0x6f'),{'UserId':_0x3d012c[_0xe5d4('0x52')]['ids'][_0x8df151],'WhatsappQueueId':_0x3d012c['params']['id']});}return _0x80712b;});}})[_0xe5d4('0x27')](respondWithResult(_0x16de9b,null))[_0xe5d4('0x4c')](handleError(_0x16de9b,null));};exports[_0xe5d4('0x84')]=function(_0x203f20,_0x125518,_0x330cda){return db['WhatsappQueue'][_0xe5d4('0x4b')]({'where':{'id':_0x203f20[_0xe5d4('0x53')]['id']}})[_0xe5d4('0x27')](handleEntityNotFound(_0x125518,null))[_0xe5d4('0x27')](function(_0x28e779){if(_0x28e779){return _0x28e779[_0xe5d4('0x84')](_0x203f20[_0xe5d4('0x36')][_0xe5d4('0x82')])[_0xe5d4('0x27')](function(){if(_['isArray'](_0x203f20[_0xe5d4('0x36')]['ids'])){for(var _0x29892e=0x0;_0x29892e<_0x203f20['query'][_0xe5d4('0x82')]['length'];_0x29892e+=0x1){socket[_0xe5d4('0x6e')](_0xe5d4('0x86'),{'UserId':Number(_0x203f20[_0xe5d4('0x36')][_0xe5d4('0x82')][_0x29892e]),'WhatsappQueueId':Number(_0x203f20[_0xe5d4('0x53')]['id'])});}}else{socket[_0xe5d4('0x6e')](_0xe5d4('0x86'),{'UserId':Number(_0x203f20['query'][_0xe5d4('0x82')]),'WhatsappQueueId':Number(_0x203f20[_0xe5d4('0x53')]['id'])});}});}})[_0xe5d4('0x27')](respondWithStatusCode(_0x125518,null))['catch'](handleError(_0x125518,null));};exports['getAgents']=function(_0x57fa2f,_0x408981,_0x210ab7){var _0x291cfd={};var _0xc25aff={};var _0x543c4b;var _0x4a50f8;return db[_0xe5d4('0x30')][_0xe5d4('0x63')]({'where':{'id':_0x57fa2f['params']['id']}})['then'](handleEntityNotFound(_0x408981,null))['then'](function(_0x28d733){if(_0x28d733){_0x543c4b=_0x28d733;_0xc25aff[_0xe5d4('0x34')]=_[_0xe5d4('0x37')](db[_0xe5d4('0x59')]['rawAttributes']);_0xc25aff[_0xe5d4('0x36')]=_[_0xe5d4('0x37')](_0x57fa2f[_0xe5d4('0x36')]);_0xc25aff['filters']=_[_0xe5d4('0x39')](_0xc25aff[_0xe5d4('0x34')],_0xc25aff[_0xe5d4('0x36')]);_0x291cfd['attributes']=_[_0xe5d4('0x39')](_0xc25aff[_0xe5d4('0x34')],qs['fields'](_0x57fa2f['query'][_0xe5d4('0x3a')]));_0x291cfd[_0xe5d4('0x3b')]=_0x291cfd[_0xe5d4('0x3b')][_0xe5d4('0x3c')]?_0x291cfd[_0xe5d4('0x3b')]:_0xc25aff[_0xe5d4('0x34')];_0x291cfd['order']=qs[_0xe5d4('0x3f')](_0x57fa2f[_0xe5d4('0x36')][_0xe5d4('0x3f')]);_0x291cfd[_0xe5d4('0x40')]=qs['filters'](_[_0xe5d4('0x41')](_0x57fa2f[_0xe5d4('0x36')],_0xc25aff[_0xe5d4('0x38')]));if(_0x57fa2f['query'][_0xe5d4('0x42')]){_0x291cfd[_0xe5d4('0x40')]=_[_0xe5d4('0x43')](_0x291cfd['where'],{'$or':_[_0xe5d4('0x35')](_0x291cfd['attributes'],function(_0xb314ea){var _0x54f3f3={};_0x54f3f3[_0xb314ea]={'$like':'%'+_0x57fa2f[_0xe5d4('0x36')][_0xe5d4('0x42')]+'%'};return _0x54f3f3;})});}_0x291cfd=_['merge']({},_0x291cfd,_0x57fa2f[_0xe5d4('0x45')]);return _0x543c4b[_0xe5d4('0x87')](_0x291cfd);}})[_0xe5d4('0x27')](function(_0x4eb0b5){if(_0x4eb0b5){_0x4a50f8=_0x4eb0b5[_0xe5d4('0x3c')];if(!_0x57fa2f[_0xe5d4('0x36')][_0xe5d4('0x57')](_0xe5d4('0x3d'))){_0x291cfd['limit']=qs[_0xe5d4('0x22')](_0x57fa2f[_0xe5d4('0x36')]['limit']);_0x291cfd['offset']=qs[_0xe5d4('0x21')](_0x57fa2f[_0xe5d4('0x36')][_0xe5d4('0x21')]);}return _0x543c4b[_0xe5d4('0x87')](_0x291cfd);}})[_0xe5d4('0x27')](function(_0x1478c3){if(_0x1478c3){return _0x1478c3?{'count':_0x4a50f8,'rows':_0x1478c3}:null;}})[_0xe5d4('0x27')](respondWithResult(_0x408981,null))['catch'](handleError(_0x408981,null));}; \ No newline at end of file +var _0x29ea=['../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','get','WhatsappQueues','UserProfileResource','destroy','error','name','send','map','WhatsappQueue','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','merge','VIRTUAL','options','include','findAll','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserWhatsappQueue','nolimit','WhatsappQueueId','filter','User','findAndCountAll','UserId','updatedAt','createdAt','format','%s/%s','getTeams','Team','addTeams','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','ids','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','TeamId','includes','union','compact','value','removeAgents','userWhatsappQueue:remove','addAgents','omit','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x9dac75,_0x36abbb){var _0x2e3260=function(_0x1588fc){while(--_0x1588fc){_0x9dac75['push'](_0x9dac75['shift']());}};_0x2e3260(++_0x36abbb);}(_0x29ea,0x73));var _0xa29e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x29ea[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0xa29e('0x0'));var emlformat=require(_0xa29e('0x1'));var rimraf=require(_0xa29e('0x2'));var zipdir=require(_0xa29e('0x3'));var jsonpatch=require(_0xa29e('0x4'));var rp=require('request-promise');var moment=require(_0xa29e('0x5'));var BPromise=require(_0xa29e('0x6'));var Mustache=require(_0xa29e('0x7'));var util=require(_0xa29e('0x8'));var path=require(_0xa29e('0x9'));var sox=require(_0xa29e('0xa'));var csv=require(_0xa29e('0xb'));var ejs=require(_0xa29e('0xc'));var fs=require('fs');var _=require(_0xa29e('0xd'));var squel=require('squel');var crypto=require(_0xa29e('0xe'));var jsforce=require(_0xa29e('0xf'));var deskjs=require(_0xa29e('0x10'));var toCsv=require(_0xa29e('0xb'));var querystring=require(_0xa29e('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa29e('0x12'));var hardwareService=require(_0xa29e('0x13'));var logger=require(_0xa29e('0x14'))(_0xa29e('0x15'));var utils=require(_0xa29e('0x16'));var config=require(_0xa29e('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xa29e('0x18')](config[_0xa29e('0x19')],{'host':_0xa29e('0x1a'),'port':0x18eb});var socket=require(_0xa29e('0x1b'))(new Redis(config[_0xa29e('0x19')]));require(_0xa29e('0x1c'))[_0xa29e('0x1d')](socket);function respondWithStatusCode(_0x23b962,_0xfe3e0b){_0xfe3e0b=_0xfe3e0b||0xcc;return function(_0x1e2d7e){if(_0x1e2d7e){return _0x23b962['sendStatus'](_0xfe3e0b);}return _0x23b962[_0xa29e('0x1e')](_0xfe3e0b)[_0xa29e('0x1f')]();};}function respondWithResult(_0x518faf,_0x13ed18){_0x13ed18=_0x13ed18||0xc8;return function(_0x434581){if(_0x434581){return _0x518faf[_0xa29e('0x1e')](_0x13ed18)[_0xa29e('0x20')](_0x434581);}};}function respondWithFilteredResult(_0x2aba5f,_0x278db9){return function(_0x317b86){if(_0x317b86){var _0x57662c=_0x317b86[_0xa29e('0x21')],_0x2d2784=_0x278db9[_0xa29e('0x22')],_0x82ea48=_0x278db9['offset']+_0x278db9['limit'],_0x2cfea1;if(_0x82ea48>=_0x57662c){_0x82ea48=_0x57662c;_0x2cfea1=0xc8;}else{_0x2cfea1=0xce;}_0x2aba5f['status'](_0x2cfea1);return _0x2aba5f[_0xa29e('0x23')](_0xa29e('0x24'),_0x2d2784+'-'+_0x82ea48+'/'+_0x57662c)[_0xa29e('0x20')](_0x317b86);}return null;};}function patchUpdates(_0x2ecae8){return function(_0x55e09b){try{jsonpatch[_0xa29e('0x25')](_0x55e09b,_0x2ecae8,!![]);}catch(_0x290472){return BPromise[_0xa29e('0x26')](_0x290472);}return _0x55e09b[_0xa29e('0x27')]();};}function saveUpdates(_0x5b48f6,_0x2f4a3d){return function(_0x2e903e){if(_0x2e903e){return _0x2e903e[_0xa29e('0x28')](_0x5b48f6)['then'](function(_0x127125){return _0x127125;});}return null;};}function removeEntity(_0x202c13,_0x180f8e){return function(_0x4c4b3f){if(_0x4c4b3f){return _0x4c4b3f['destroy']()[_0xa29e('0x29')](function(){var _0x267bf2=_0x4c4b3f[_0xa29e('0x2a')]({'plain':!![]});var _0x47f07a=_0xa29e('0x2b');return db[_0xa29e('0x2c')][_0xa29e('0x2d')]({'where':{'type':_0x47f07a,'resourceId':_0x267bf2['id']}})[_0xa29e('0x29')](function(){return _0x4c4b3f;});})['then'](function(){_0x202c13['status'](0xcc)[_0xa29e('0x1f')]();});}};}function handleEntityNotFound(_0x41975e,_0x457bdd){return function(_0x5ad841){if(!_0x5ad841){_0x41975e['sendStatus'](0x194);}return _0x5ad841;};}function handleError(_0x49c4e0,_0x5e0224){_0x5e0224=_0x5e0224||0x1f4;return function(_0x277848){logger[_0xa29e('0x2e')](_0x277848['stack']);if(_0x277848[_0xa29e('0x2f')]){delete _0x277848[_0xa29e('0x2f')];}_0x49c4e0['status'](_0x5e0224)[_0xa29e('0x30')](_0x277848);};}exports['index']=function(_0x3a5388,_0x31df16){var _0x5ea31e={},_0x5db8c9={},_0x547aac={'count':0x0,'rows':[]};var _0xd37ecc=_[_0xa29e('0x31')](db[_0xa29e('0x32')][_0xa29e('0x33')],function(_0x4e8be3){return{'name':_0x4e8be3[_0xa29e('0x34')],'type':_0x4e8be3[_0xa29e('0x35')][_0xa29e('0x36')]};});_0x5db8c9[_0xa29e('0x37')]=_[_0xa29e('0x31')](_0xd37ecc,_0xa29e('0x2f'));_0x5db8c9['query']=_[_0xa29e('0x38')](_0x3a5388[_0xa29e('0x39')]);_0x5db8c9[_0xa29e('0x3a')]=_[_0xa29e('0x3b')](_0x5db8c9[_0xa29e('0x37')],_0x5db8c9[_0xa29e('0x39')]);_0x5ea31e[_0xa29e('0x3c')]=_[_0xa29e('0x3b')](_0x5db8c9[_0xa29e('0x37')],qs[_0xa29e('0x3d')](_0x3a5388[_0xa29e('0x39')][_0xa29e('0x3d')]));_0x5ea31e[_0xa29e('0x3c')]=_0x5ea31e[_0xa29e('0x3c')][_0xa29e('0x3e')]?_0x5ea31e[_0xa29e('0x3c')]:_0x5db8c9[_0xa29e('0x37')];if(!_0x3a5388['query'][_0xa29e('0x3f')]('nolimit')){_0x5ea31e[_0xa29e('0x40')]=qs[_0xa29e('0x40')](_0x3a5388[_0xa29e('0x39')][_0xa29e('0x40')]);_0x5ea31e[_0xa29e('0x22')]=qs[_0xa29e('0x22')](_0x3a5388['query'][_0xa29e('0x22')]);}_0x5ea31e[_0xa29e('0x41')]=qs[_0xa29e('0x42')](_0x3a5388[_0xa29e('0x39')]['sort']);_0x5ea31e[_0xa29e('0x43')]=qs[_0xa29e('0x3a')](_[_0xa29e('0x44')](_0x3a5388[_0xa29e('0x39')],_0x5db8c9[_0xa29e('0x3a')]),_0xd37ecc);if(_0x3a5388[_0xa29e('0x39')]['filter']){_0x5ea31e[_0xa29e('0x43')]=_[_0xa29e('0x45')](_0x5ea31e[_0xa29e('0x43')],{'$or':_[_0xa29e('0x31')](_0xd37ecc,function(_0x1a6471){if(_0x1a6471[_0xa29e('0x35')]!==_0xa29e('0x46')){var _0x4935fe={};_0x4935fe[_0x1a6471[_0xa29e('0x2f')]]={'$like':'%'+_0x3a5388[_0xa29e('0x39')]['filter']+'%'};return _0x4935fe;}})});}_0x5ea31e=_[_0xa29e('0x45')]({},_0x5ea31e,_0x3a5388[_0xa29e('0x47')]);var _0x50cc70={'where':_0x5ea31e['where']};return db[_0xa29e('0x32')][_0xa29e('0x21')](_0x50cc70)[_0xa29e('0x29')](function(_0x5cba54){_0x547aac[_0xa29e('0x21')]=_0x5cba54;if(_0x3a5388[_0xa29e('0x39')]['includeAll']){_0x5ea31e[_0xa29e('0x48')]=[{'all':!![]}];}return db[_0xa29e('0x32')][_0xa29e('0x49')](_0x5ea31e);})[_0xa29e('0x29')](function(_0x1dc3dc){_0x547aac[_0xa29e('0x4a')]=_0x1dc3dc;return _0x547aac;})[_0xa29e('0x29')](respondWithFilteredResult(_0x31df16,_0x5ea31e))[_0xa29e('0x4b')](handleError(_0x31df16,null));};exports[_0xa29e('0x4c')]=function(_0x4ff0a0,_0x36464f){var _0x3e7312={'raw':!![],'where':{'id':_0x4ff0a0['params']['id']}},_0x2494d0={};_0x2494d0[_0xa29e('0x37')]=_[_0xa29e('0x38')](db[_0xa29e('0x32')][_0xa29e('0x33')]);_0x2494d0['query']=_[_0xa29e('0x38')](_0x4ff0a0[_0xa29e('0x39')]);_0x2494d0[_0xa29e('0x3a')]=_[_0xa29e('0x3b')](_0x2494d0[_0xa29e('0x37')],_0x2494d0[_0xa29e('0x39')]);_0x3e7312['attributes']=_['intersection'](_0x2494d0['model'],qs[_0xa29e('0x3d')](_0x4ff0a0[_0xa29e('0x39')][_0xa29e('0x3d')]));_0x3e7312[_0xa29e('0x3c')]=_0x3e7312['attributes'][_0xa29e('0x3e')]?_0x3e7312['attributes']:_0x2494d0[_0xa29e('0x37')];if(_0x4ff0a0[_0xa29e('0x39')]['includeAll']){_0x3e7312[_0xa29e('0x48')]=[{'all':!![]}];}_0x3e7312=_['merge']({},_0x3e7312,_0x4ff0a0[_0xa29e('0x47')]);return db[_0xa29e('0x32')][_0xa29e('0x4d')](_0x3e7312)[_0xa29e('0x29')](handleEntityNotFound(_0x36464f,null))[_0xa29e('0x29')](respondWithResult(_0x36464f,null))[_0xa29e('0x4b')](handleError(_0x36464f,null));};exports[_0xa29e('0x4e')]=function(_0x499d38,_0x1fb612){return db['WhatsappQueue']['create'](_0x499d38[_0xa29e('0x4f')],{})['then'](function(_0x1d9eed){var _0x1f2f96=_0x499d38[_0xa29e('0x50')][_0xa29e('0x2a')]({'plain':!![]});if(!_0x1f2f96)throw new Error(_0xa29e('0x51'));if(_0x1f2f96['role']===_0xa29e('0x50')){var _0x3776f3=_0x1d9eed[_0xa29e('0x2a')]({'plain':!![]});var _0x157edf=_0xa29e('0x2b');return db[_0xa29e('0x52')][_0xa29e('0x4d')]({'where':{'name':_0x157edf,'userProfileId':_0x1f2f96[_0xa29e('0x53')]},'raw':!![]})['then'](function(_0x4220a4){if(_0x4220a4&&_0x4220a4['autoAssociation']===0x0){return db[_0xa29e('0x2c')][_0xa29e('0x4e')]({'name':_0x3776f3['name'],'resourceId':_0x3776f3['id'],'type':_0x4220a4[_0xa29e('0x2f')],'sectionId':_0x4220a4['id']},{})['then'](function(){return _0x1d9eed;});}else{return _0x1d9eed;}})[_0xa29e('0x4b')](function(_0x2d12ba){logger['error'](_0xa29e('0x54'),_0x2d12ba);throw _0x2d12ba;});}return _0x1d9eed;})[_0xa29e('0x29')](respondWithResult(_0x1fb612,0xc9))[_0xa29e('0x4b')](handleError(_0x1fb612,null));};exports[_0xa29e('0x28')]=function(_0x4bf24c,_0x32dc84){if(_0x4bf24c[_0xa29e('0x4f')]['id']){delete _0x4bf24c[_0xa29e('0x4f')]['id'];}return db[_0xa29e('0x32')][_0xa29e('0x4d')]({'where':{'id':_0x4bf24c[_0xa29e('0x55')]['id']}})['then'](handleEntityNotFound(_0x32dc84,null))['then'](saveUpdates(_0x4bf24c[_0xa29e('0x4f')],null))[_0xa29e('0x29')](respondWithResult(_0x32dc84,null))[_0xa29e('0x4b')](handleError(_0x32dc84,null));};exports[_0xa29e('0x2d')]=function(_0x123fca,_0x2db180){return db[_0xa29e('0x32')]['find']({'where':{'id':_0x123fca[_0xa29e('0x55')]['id']}})[_0xa29e('0x29')](handleEntityNotFound(_0x2db180,null))['then'](removeEntity(_0x2db180,null))[_0xa29e('0x4b')](handleError(_0x2db180,null));};exports['describe']=function(_0x50a9ad,_0x1c12c3){return db['WhatsappQueue'][_0xa29e('0x56')]()[_0xa29e('0x29')](respondWithResult(_0x1c12c3,null))['catch'](handleError(_0x1c12c3,null));};exports[_0xa29e('0x57')]=function(_0x104e60,_0x355d9a,_0x5a86f5){var _0x38191b={'raw':!![],'where':{}},_0x1bdf50={},_0x33dcc4;return db['WhatsappQueue'][_0xa29e('0x58')]({'where':{'id':_0x104e60[_0xa29e('0x55')]['id']}})['then'](handleEntityNotFound(_0x355d9a,null))['then'](function(_0x3f49bf){if(_0x3f49bf){_0x33dcc4=_0x3f49bf[_0xa29e('0x2a')]({'plain':!![]});_0x1bdf50[_0xa29e('0x37')]=_[_0xa29e('0x38')](db[_0xa29e('0x59')][_0xa29e('0x33')]);_0x1bdf50[_0xa29e('0x39')]=_[_0xa29e('0x38')](_0x104e60[_0xa29e('0x39')]);_0x1bdf50[_0xa29e('0x3a')]=_[_0xa29e('0x3b')](_0x1bdf50[_0xa29e('0x37')],_0x1bdf50[_0xa29e('0x39')]);_0x38191b[_0xa29e('0x3c')]=_[_0xa29e('0x3b')](_0x1bdf50['model'],qs[_0xa29e('0x3d')](_0x104e60['query'][_0xa29e('0x3d')]));_0x38191b['attributes']=_0x38191b[_0xa29e('0x3c')][_0xa29e('0x3e')]?_0x38191b[_0xa29e('0x3c')]:_0x1bdf50[_0xa29e('0x37')];if(!_0x104e60[_0xa29e('0x39')][_0xa29e('0x3f')](_0xa29e('0x5a'))){_0x38191b[_0xa29e('0x40')]=qs[_0xa29e('0x40')](_0x104e60['query'][_0xa29e('0x40')]);_0x38191b['offset']=qs['offset'](_0x104e60[_0xa29e('0x39')][_0xa29e('0x22')]);}_0x38191b[_0xa29e('0x41')]=qs[_0xa29e('0x42')](_0x104e60[_0xa29e('0x39')][_0xa29e('0x42')]);_0x38191b[_0xa29e('0x43')]=qs[_0xa29e('0x3a')](_[_0xa29e('0x44')](_0x104e60[_0xa29e('0x39')],_0x1bdf50[_0xa29e('0x3a')]));_0x38191b[_0xa29e('0x43')][_0xa29e('0x5b')]=_0x3f49bf['id'];if(_0x104e60[_0xa29e('0x39')][_0xa29e('0x5c')]){_0x38191b['where']=_[_0xa29e('0x45')](_0x38191b[_0xa29e('0x43')],{'$or':_['map'](_0x38191b[_0xa29e('0x3c')],function(_0x590bce){var _0x1e992a={};_0x1e992a[_0x590bce]={'$like':'%'+_0x104e60['query']['filter']+'%'};return _0x1e992a;})});}_0x38191b=_[_0xa29e('0x45')]({},_0x38191b,_0x104e60[_0xa29e('0x47')]);return db[_0xa29e('0x59')][_0xa29e('0x49')](_0x38191b);}})['then'](function(_0x379907){if(_0x379907){return db[_0xa29e('0x5d')][_0xa29e('0x5e')]({'where':{'id':_[_0xa29e('0x31')](_0x379907,_0xa29e('0x5f')),'role':'agent'},'attributes':['id',_0xa29e('0x2f'),'whatsappPause',_0xa29e('0x60'),_0xa29e('0x61')]});}})[_0xa29e('0x29')](function(_0x2ee80c){if(_0x2ee80c){return{'count':_0x2ee80c['count'],'rows':_['map'](_0x2ee80c['rows'],function(_0x89a3b7){return{'membername':_0x89a3b7[_0xa29e('0x2f')],'UserId':_0x89a3b7['id'],'queue_name':_0x33dcc4[_0xa29e('0x2f')],'WhatsappQueueId':_0x33dcc4['id'],'interface':util[_0xa29e('0x62')](_0xa29e('0x63'),'SIP',_0x89a3b7[_0xa29e('0x2f')]),'penalty':0x0,'paused':_0x89a3b7['whatsappPause'],'createdAt':_0x89a3b7[_0xa29e('0x61')],'updatedAt':_0x89a3b7[_0xa29e('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa29e('0x29')](respondWithFilteredResult(_0x355d9a,_0x38191b))[_0xa29e('0x4b')](handleError(_0x355d9a,null));};exports[_0xa29e('0x64')]=function(_0x5b40c5,_0x10524c,_0x4035cc){var _0x153338={};var _0x12a885={};var _0x3fe53a;var _0x2b7579;return db[_0xa29e('0x32')][_0xa29e('0x58')]({'where':{'id':_0x5b40c5[_0xa29e('0x55')]['id']}})[_0xa29e('0x29')](handleEntityNotFound(_0x10524c,null))[_0xa29e('0x29')](function(_0x5a2b13){if(_0x5a2b13){_0x3fe53a=_0x5a2b13;_0x12a885[_0xa29e('0x37')]=_[_0xa29e('0x38')](db[_0xa29e('0x65')]['rawAttributes']);_0x12a885[_0xa29e('0x39')]=_['keys'](_0x5b40c5[_0xa29e('0x39')]);_0x12a885[_0xa29e('0x3a')]=_[_0xa29e('0x3b')](_0x12a885[_0xa29e('0x37')],_0x12a885[_0xa29e('0x39')]);_0x153338[_0xa29e('0x3c')]=_[_0xa29e('0x3b')](_0x12a885['model'],qs[_0xa29e('0x3d')](_0x5b40c5['query'][_0xa29e('0x3d')]));_0x153338[_0xa29e('0x3c')]=_0x153338[_0xa29e('0x3c')][_0xa29e('0x3e')]?_0x153338[_0xa29e('0x3c')]:_0x12a885['model'];_0x153338[_0xa29e('0x41')]=qs['sort'](_0x5b40c5[_0xa29e('0x39')][_0xa29e('0x42')]);_0x153338[_0xa29e('0x43')]=qs[_0xa29e('0x3a')](_[_0xa29e('0x44')](_0x5b40c5[_0xa29e('0x39')],_0x12a885[_0xa29e('0x3a')]));if(_0x5b40c5[_0xa29e('0x39')]['filter']){_0x153338[_0xa29e('0x43')]=_[_0xa29e('0x45')](_0x153338['where'],{'$or':_[_0xa29e('0x31')](_0x153338[_0xa29e('0x3c')],function(_0x59ec17){var _0x74134f={};_0x74134f[_0x59ec17]={'$like':'%'+_0x5b40c5['query'][_0xa29e('0x5c')]+'%'};return _0x74134f;})});}_0x153338=_['merge']({},_0x153338,_0x5b40c5[_0xa29e('0x47')]);return _0x3fe53a['getTeams'](_0x153338);}})['then'](function(_0x5585f0){if(_0x5585f0){_0x2b7579=_0x5585f0['length'];if(!_0x5b40c5[_0xa29e('0x39')][_0xa29e('0x3f')](_0xa29e('0x5a'))){_0x153338[_0xa29e('0x40')]=qs[_0xa29e('0x40')](_0x5b40c5[_0xa29e('0x39')]['limit']);_0x153338[_0xa29e('0x22')]=qs['offset'](_0x5b40c5[_0xa29e('0x39')][_0xa29e('0x22')]);}return _0x3fe53a[_0xa29e('0x64')](_0x153338);}})[_0xa29e('0x29')](function(_0x434b3f){if(_0x434b3f){return _0x434b3f?{'count':_0x2b7579,'rows':_0x434b3f}:null;}})[_0xa29e('0x29')](respondWithResult(_0x10524c,null))[_0xa29e('0x4b')](handleError(_0x10524c,null));};exports[_0xa29e('0x66')]=function(_0x3f5695,_0x401504,_0x3b8566){var _0x199f11=_0x3f5695[_0xa29e('0x4f')]['ids'];return db[_0xa29e('0x65')]['findAll']({'where':{'id':_0x199f11},'attributes':['id'],'include':[{'model':db[_0xa29e('0x5d')],'as':_0xa29e('0x67'),'attributes':['id',_0xa29e('0x2f'),_0xa29e('0x68'),'voicePause',_0xa29e('0x69')],'raw':!![]}]})['then'](function(_0x4e5e9e){if(_0x4e5e9e){var _0x4b567e=_[_0xa29e('0x6a')](_0x4e5e9e,function(_0x50521e){var _0x3bda83=_0x50521e[_0xa29e('0x2a')]({'plain':!![]});return _0x3bda83[_0xa29e('0x67')];});return db[_0xa29e('0x32')][_0xa29e('0x4d')]({'where':{'id':_0x3f5695[_0xa29e('0x55')]['id']}})['then'](function(_0x477907){return db[_0xa29e('0x6b')][_0xa29e('0x6c')](function(_0x31c8ad){return _0x477907[_0xa29e('0x66')](_0x199f11,{'transaction':_0x31c8ad})[_0xa29e('0x29')](function(){return BPromise[_0xa29e('0x6d')](_0x4b567e,function(_0x3b7e8f){return db[_0xa29e('0x59')][_0xa29e('0x6e')]({'where':{'UserId':_0x3b7e8f['id'],'WhatsappQueueId':_0x3f5695[_0xa29e('0x55')]['id']},'transaction':_0x31c8ad});});})['then'](function(){_0x4b567e[_0xa29e('0x6f')](function(_0x540de0){socket[_0xa29e('0x70')]('userWhatsappQueue:save',{'UserId':_0x540de0['id'],'WhatsappQueueId':_0x477907['id']});});});});});}})['then'](respondWithStatusCode(_0x401504,null))[_0xa29e('0x4b')](handleError(_0x401504,null));};exports['removeTeams']=function(_0x4228f4,_0x479235,_0x5a5823){return db[_0xa29e('0x65')][_0xa29e('0x49')]({'where':{'id':_0x4228f4[_0xa29e('0x39')][_0xa29e('0x71')]},'attributes':['id'],'include':[{'model':db[_0xa29e('0x5d')],'as':_0xa29e('0x67'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x479235,null))[_0xa29e('0x29')](function(_0x2da51e){var _0x51b41b=_[_0xa29e('0x31')](_0x2da51e,'id');var _0x8fb285=[];var _0x16d59a=[];var _0x39e9e5=squel[_0xa29e('0x72')]();_0x39e9e5[_0xa29e('0x73')](_0xa29e('0x74'))[_0xa29e('0x75')]('team_has_whatsapp_queues','tq')[_0xa29e('0x76')](_0xa29e('0x77'),'ut',_0xa29e('0x78'))[_0xa29e('0x43')](_0xa29e('0x79'),_0x4228f4[_0xa29e('0x55')]['id']);for(var _0xec16fd=0x0;_0xec16fd<_0x2da51e[_0xa29e('0x3e')];_0xec16fd+=0x1){let _0x2b331a=_0x2da51e[_0xec16fd];for(var _0x3599e1=0x0;_0x3599e1<_0x2b331a[_0xa29e('0x67')][_0xa29e('0x3e')];_0x3599e1+=0x1){let _0x3505f3=_0x2b331a['Agents'][_0x3599e1];var _0x7aec2a=_0x39e9e5[_0xa29e('0x7a')]();_0x7aec2a[_0xa29e('0x43')](_0xa29e('0x7b'),_0x3505f3['id']);_0x16d59a[_0xa29e('0x7c')](db['sequelize'][_0xa29e('0x39')](_0x7aec2a['toString'](),{'type':db[_0xa29e('0x6b')][_0xa29e('0x7d')]['SELECT']})[_0xa29e('0x29')](function(_0xe5744d){if(_0xe5744d[_0xa29e('0x3e')]===0x1){return _0x3505f3['id'];}else{var _0x332052=_['every'](_[_0xa29e('0x31')](_0xe5744d,_0xa29e('0x7e')),function(_0x40e529){return _[_0xa29e('0x7f')](_0x51b41b,_0x40e529);});if(_0x332052){return _0x3505f3['id'];}}}));}}return BPromise['all'](_0x16d59a)[_0xa29e('0x29')](function(_0x323c4d){_0x8fb285=_(_0x8fb285)[_0xa29e('0x80')](_0x323c4d)[_0xa29e('0x81')]()[_0xa29e('0x82')]();return db[_0xa29e('0x32')][_0xa29e('0x4d')]({'where':{'id':_0x4228f4[_0xa29e('0x55')]['id']}})[_0xa29e('0x29')](function(_0x1fee13){return db[_0xa29e('0x6b')][_0xa29e('0x6c')](function(_0x16a8a1){return _0x1fee13['removeTeams'](_0x4228f4[_0xa29e('0x39')][_0xa29e('0x71')],{'transaction':_0x16a8a1})[_0xa29e('0x29')](function(){if(!_['isEmpty'](_0x8fb285)){return _0x1fee13[_0xa29e('0x83')](_0x8fb285,{'transaction':_0x16a8a1});}})[_0xa29e('0x29')](function(){_0x8fb285['forEach'](function(_0x599264){socket[_0xa29e('0x70')](_0xa29e('0x84'),{'UserId':_0x599264,'WhatsappQueueId':_0x1fee13['id']});});});});});});})[_0xa29e('0x29')](respondWithStatusCode(_0x479235,null))[_0xa29e('0x4b')](handleError(_0x479235,null));};exports[_0xa29e('0x85')]=function(_0x8d2122,_0x1fe46e,_0x5aef3e){return db[_0xa29e('0x32')][_0xa29e('0x4d')]({'where':{'id':_0x8d2122[_0xa29e('0x55')]['id']}})['then'](handleEntityNotFound(_0x1fe46e,null))[_0xa29e('0x29')](function(_0x190082){if(_0x190082){return _0x190082[_0xa29e('0x85')](_0x8d2122[_0xa29e('0x4f')][_0xa29e('0x71')],_[_0xa29e('0x86')](_0x8d2122['body'],[_0xa29e('0x71'),'id'])||{})['spread'](function(_0x7b4bcb){for(var _0x12f372=0x0;_0x12f372<_0x8d2122[_0xa29e('0x4f')][_0xa29e('0x71')][_0xa29e('0x3e')];_0x12f372+=0x1){socket['emit']('userWhatsappQueue:save',{'UserId':_0x8d2122[_0xa29e('0x4f')][_0xa29e('0x71')][_0x12f372],'WhatsappQueueId':_0x8d2122[_0xa29e('0x55')]['id']});}return _0x7b4bcb;});}})[_0xa29e('0x29')](respondWithResult(_0x1fe46e,null))[_0xa29e('0x4b')](handleError(_0x1fe46e,null));};exports[_0xa29e('0x83')]=function(_0x57cdad,_0x2a0d50,_0x2b3cf3){return db['WhatsappQueue'][_0xa29e('0x4d')]({'where':{'id':_0x57cdad[_0xa29e('0x55')]['id']}})[_0xa29e('0x29')](handleEntityNotFound(_0x2a0d50,null))[_0xa29e('0x29')](function(_0x588f19){if(_0x588f19){return _0x588f19[_0xa29e('0x83')](_0x57cdad[_0xa29e('0x39')][_0xa29e('0x71')])[_0xa29e('0x29')](function(){if(_[_0xa29e('0x87')](_0x57cdad[_0xa29e('0x39')][_0xa29e('0x71')])){for(var _0x1d542c=0x0;_0x1d542c<_0x57cdad[_0xa29e('0x39')][_0xa29e('0x71')][_0xa29e('0x3e')];_0x1d542c+=0x1){socket[_0xa29e('0x70')](_0xa29e('0x84'),{'UserId':Number(_0x57cdad['query'][_0xa29e('0x71')][_0x1d542c]),'WhatsappQueueId':Number(_0x57cdad[_0xa29e('0x55')]['id'])});}}else{socket[_0xa29e('0x70')](_0xa29e('0x84'),{'UserId':Number(_0x57cdad['query'][_0xa29e('0x71')]),'WhatsappQueueId':Number(_0x57cdad[_0xa29e('0x55')]['id'])});}});}})[_0xa29e('0x29')](respondWithStatusCode(_0x2a0d50,null))[_0xa29e('0x4b')](handleError(_0x2a0d50,null));};exports[_0xa29e('0x88')]=function(_0x4fe3a8,_0x471092,_0x329219){var _0x25d09d={};var _0x5562f8={};var _0x2cec2e;var _0x3802c7;return db[_0xa29e('0x32')][_0xa29e('0x58')]({'where':{'id':_0x4fe3a8[_0xa29e('0x55')]['id']}})[_0xa29e('0x29')](handleEntityNotFound(_0x471092,null))['then'](function(_0x50ea5a){if(_0x50ea5a){_0x2cec2e=_0x50ea5a;_0x5562f8[_0xa29e('0x37')]=_[_0xa29e('0x38')](db['User'][_0xa29e('0x33')]);_0x5562f8['query']=_[_0xa29e('0x38')](_0x4fe3a8[_0xa29e('0x39')]);_0x5562f8['filters']=_[_0xa29e('0x3b')](_0x5562f8[_0xa29e('0x37')],_0x5562f8['query']);_0x25d09d[_0xa29e('0x3c')]=_[_0xa29e('0x3b')](_0x5562f8[_0xa29e('0x37')],qs[_0xa29e('0x3d')](_0x4fe3a8[_0xa29e('0x39')][_0xa29e('0x3d')]));_0x25d09d[_0xa29e('0x3c')]=_0x25d09d[_0xa29e('0x3c')]['length']?_0x25d09d[_0xa29e('0x3c')]:_0x5562f8[_0xa29e('0x37')];_0x25d09d[_0xa29e('0x41')]=qs[_0xa29e('0x42')](_0x4fe3a8[_0xa29e('0x39')][_0xa29e('0x42')]);_0x25d09d[_0xa29e('0x43')]=qs[_0xa29e('0x3a')](_[_0xa29e('0x44')](_0x4fe3a8[_0xa29e('0x39')],_0x5562f8['filters']));if(_0x4fe3a8[_0xa29e('0x39')][_0xa29e('0x5c')]){_0x25d09d[_0xa29e('0x43')]=_[_0xa29e('0x45')](_0x25d09d[_0xa29e('0x43')],{'$or':_[_0xa29e('0x31')](_0x25d09d[_0xa29e('0x3c')],function(_0x464dd4){var _0x357676={};_0x357676[_0x464dd4]={'$like':'%'+_0x4fe3a8[_0xa29e('0x39')][_0xa29e('0x5c')]+'%'};return _0x357676;})});}_0x25d09d=_[_0xa29e('0x45')]({},_0x25d09d,_0x4fe3a8[_0xa29e('0x47')]);return _0x2cec2e[_0xa29e('0x88')](_0x25d09d);}})[_0xa29e('0x29')](function(_0x509df5){if(_0x509df5){_0x3802c7=_0x509df5[_0xa29e('0x3e')];if(!_0x4fe3a8['query'][_0xa29e('0x3f')](_0xa29e('0x5a'))){_0x25d09d[_0xa29e('0x40')]=qs[_0xa29e('0x40')](_0x4fe3a8[_0xa29e('0x39')][_0xa29e('0x40')]);_0x25d09d[_0xa29e('0x22')]=qs['offset'](_0x4fe3a8[_0xa29e('0x39')][_0xa29e('0x22')]);}return _0x2cec2e[_0xa29e('0x88')](_0x25d09d);}})[_0xa29e('0x29')](function(_0x20c0de){if(_0x20c0de){return _0x20c0de?{'count':_0x3802c7,'rows':_0x20c0de}:null;}})['then'](respondWithResult(_0x471092,null))['catch'](handleError(_0x471092,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 34f19a5..048fb52 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 _0xe37e=['exports','events','save','emit','hasOwnProperty','hook'];(function(_0x495df6,_0x332b74){var _0x35f511=function(_0x241ee5){while(--_0x241ee5){_0x495df6['push'](_0x495df6['shift']());}};_0x35f511(++_0x332b74);}(_0xe37e,0xc7));var _0xee37=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0xe37e[_0x50aa2e];return _0x5e07f0;};'use strict';var EventEmitter=require(_0xee37('0x0'));var WhatsappQueue=require('../../mysqldb')['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xee37('0x1'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3cf935){return function(_0x141cb1,_0x129948,_0x4587c7){WhatsappQueueEvents[_0xee37('0x2')](_0x3cf935+':'+_0x141cb1['id'],_0x141cb1);WhatsappQueueEvents[_0xee37('0x2')](_0x3cf935,_0x141cb1);_0x4587c7(null);};}for(var e in events){if(events[_0xee37('0x3')](e)){var event=events[e];WhatsappQueue[_0xee37('0x4')](e,emitEvent(event));}}module[_0xee37('0x5')]=WhatsappQueueEvents; \ No newline at end of file +var _0xd38e=['emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x411570,_0x5ec0f3){var _0x2bea40=function(_0x4d1fa0){while(--_0x4d1fa0){_0x411570['push'](_0x411570['shift']());}};_0x2bea40(++_0x5ec0f3);}(_0xd38e,0x9d));var _0xed38=function(_0x338725,_0x5dc118){_0x338725=_0x338725-0x0;var _0x159b05=_0xd38e[_0x338725];return _0x159b05;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0xed38('0x0'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xed38('0x1')](0x0);var events={'afterCreate':_0xed38('0x2'),'afterUpdate':_0xed38('0x3'),'afterDestroy':_0xed38('0x4')};function emitEvent(_0x4694a8){return function(_0x589a97,_0x1d3d36,_0xa7cd35){WhatsappQueueEvents['emit'](_0x4694a8+':'+_0x589a97['id'],_0x589a97);WhatsappQueueEvents[_0xed38('0x5')](_0x4694a8,_0x589a97);_0xa7cd35(null);};}for(var e in events){if(events[_0xed38('0x6')](e)){var event=events[e];WhatsappQueue[_0xed38('0x7')](e,emitEvent(event));}}module[_0xed38('0x8')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 9b06b7b..bcb2a55 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 _0x0d82=['exports','define','WhatsappQueue','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes'];(function(_0x5d4c2d,_0xb82f70){var _0x535b88=function(_0x4680a2){while(--_0x4680a2){_0x5d4c2d['push'](_0x5d4c2d['shift']());}};_0x535b88(++_0xb82f70);}(_0x0d82,0x155));var _0x20d8=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x0d82[_0x1694f5];return _0x5b4321;};'use strict';var _=require('lodash');var util=require(_0x20d8('0x0'));var logger=require(_0x20d8('0x1'))(_0x20d8('0x2'));var moment=require(_0x20d8('0x3'));var BPromise=require(_0x20d8('0x4'));var rp=require(_0x20d8('0x5'));var fs=require('fs');var path=require(_0x20d8('0x6'));var rimraf=require(_0x20d8('0x7'));var config=require(_0x20d8('0x8'));var attributes=require(_0x20d8('0x9'));module[_0x20d8('0xa')]=function(_0x2273cd,_0x4856f6){return _0x2273cd[_0x20d8('0xb')](_0x20d8('0xc'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd5be=['util','api','moment','bluebird','request-promise','path','./whatsappQueue.attributes','WhatsappQueue'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xd5be,0x160));var _0xed5b=function(_0x2ac32b,_0x134b81){_0x2ac32b=_0x2ac32b-0x0;var _0x298c2e=_0xd5be[_0x2ac32b];return _0x298c2e;};'use strict';var _=require('lodash');var util=require(_0xed5b('0x0'));var logger=require('../../config/logger')(_0xed5b('0x1'));var moment=require(_0xed5b('0x2'));var BPromise=require(_0xed5b('0x3'));var rp=require(_0xed5b('0x4'));var fs=require('fs');var path=require(_0xed5b('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xed5b('0x6'));module['exports']=function(_0x5e44ce,_0x228e5d){return _0x5e44ce['define'](_0xed5b('0x7'),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 db3c522..aa68c50 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 _0xa6c7=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','socket.io-emitter','redis','request','then','info','request\x20sent','debug','stringify','error','code','WhatsappQueue,\x20%s,\x20%s','message','result','catch','WhatsappQueue','findAll','options','where','attributes','limit','include','model','GetWhatsappQueue','ShowWhatsappQueue','find','map','lodash','util','moment','bluebird'];(function(_0x4fabc8,_0x327294){var _0x169a16=function(_0x5e6692){while(--_0x5e6692){_0x4fabc8['push'](_0x4fabc8['shift']());}};_0x169a16(++_0x327294);}(_0xa6c7,0x1c4));var _0x7a6c=function(_0x5527f8,_0x341797){_0x5527f8=_0x5527f8-0x0;var _0x5e8889=_0xa6c7[_0x5527f8];return _0x5e8889;};'use strict';var _=require(_0x7a6c('0x0'));var util=require(_0x7a6c('0x1'));var moment=require(_0x7a6c('0x2'));var BPromise=require(_0x7a6c('0x3'));var rs=require(_0x7a6c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7a6c('0x5'));var logger=require(_0x7a6c('0x6'))(_0x7a6c('0x7'));var config=require(_0x7a6c('0x8'));var jayson=require(_0x7a6c('0x9'));var client=jayson[_0x7a6c('0xa')][_0x7a6c('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7a6c('0xc'))(new Redis(config[_0x7a6c('0xd')]));require('./whatsappQueue.socket')['register'](socket);function respondWithRpcPromise(_0x4d4775,_0x1187fa,_0x38d13c){return new BPromise(function(_0x1076d1,_0x2ec2ea){return client[_0x7a6c('0xe')](_0x4d4775,_0x38d13c)[_0x7a6c('0xf')](function(_0x4ee01c){logger[_0x7a6c('0x10')]('WhatsappQueue,\x20%s,\x20%s',_0x1187fa,_0x7a6c('0x11'));logger[_0x7a6c('0x12')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x1187fa,_0x7a6c('0x11'),JSON[_0x7a6c('0x13')](_0x4ee01c));if(_0x4ee01c[_0x7a6c('0x14')]){if(_0x4ee01c[_0x7a6c('0x14')][_0x7a6c('0x15')]===0x1f4){logger[_0x7a6c('0x14')](_0x7a6c('0x16'),_0x1187fa,_0x4ee01c[_0x7a6c('0x14')]['message']);return _0x2ec2ea(_0x4ee01c[_0x7a6c('0x14')]['message']);}logger['error'](_0x7a6c('0x16'),_0x1187fa,_0x4ee01c[_0x7a6c('0x14')][_0x7a6c('0x17')]);return _0x1076d1(_0x4ee01c['error'][_0x7a6c('0x17')]);}else{logger['info'](_0x7a6c('0x16'),_0x1187fa,'request\x20sent');_0x1076d1(_0x4ee01c[_0x7a6c('0x18')][_0x7a6c('0x17')]);}})[_0x7a6c('0x19')](function(_0x18c726){logger[_0x7a6c('0x14')](_0x7a6c('0x16'),_0x1187fa,_0x18c726);_0x2ec2ea(_0x18c726);});});}exports['GetWhatsappQueue']=function(_0x40d83d){var _0x563d6e=this;return new Promise(function(_0x3bc551,_0x11c6ea){return db[_0x7a6c('0x1a')][_0x7a6c('0x1b')]({'raw':_0x40d83d[_0x7a6c('0x1c')]?_0x40d83d[_0x7a6c('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x40d83d[_0x7a6c('0x1c')]?_0x40d83d[_0x7a6c('0x1c')][_0x7a6c('0x1d')]||null:null,'attributes':_0x40d83d[_0x7a6c('0x1c')]?_0x40d83d[_0x7a6c('0x1c')][_0x7a6c('0x1e')]||null:null,'limit':_0x40d83d[_0x7a6c('0x1c')]?_0x40d83d[_0x7a6c('0x1c')][_0x7a6c('0x1f')]||null:null,'include':_0x40d83d['options']?_0x40d83d[_0x7a6c('0x1c')][_0x7a6c('0x20')]?_['map'](_0x40d83d[_0x7a6c('0x1c')][_0x7a6c('0x20')],function(_0x261004){return{'model':db[_0x261004[_0x7a6c('0x21')]],'as':_0x261004['as'],'attributes':_0x261004[_0x7a6c('0x1e')],'include':_0x261004[_0x7a6c('0x20')]?_['map'](_0x261004[_0x7a6c('0x20')],function(_0x10f1b){return{'model':db[_0x10f1b[_0x7a6c('0x21')]],'as':_0x10f1b['as'],'attributes':_0x10f1b[_0x7a6c('0x1e')],'include':_0x10f1b['include']?_['map'](_0x10f1b[_0x7a6c('0x20')],function(_0x12d3ed){return{'model':db[_0x12d3ed[_0x7a6c('0x21')]],'as':_0x12d3ed['as'],'attributes':_0x12d3ed['attributes']};}):[]};}):[]};}):[]:[]})[_0x7a6c('0xf')](function(_0x9255d4){logger[_0x7a6c('0x10')]('GetWhatsappQueue',_0x40d83d);logger[_0x7a6c('0x12')](_0x7a6c('0x22'),_0x40d83d,JSON[_0x7a6c('0x13')](_0x9255d4));_0x3bc551(_0x9255d4);})[_0x7a6c('0x19')](function(_0x3b64c8){logger['error'](_0x7a6c('0x22'),_0x3b64c8[_0x7a6c('0x17')],_0x40d83d);_0x11c6ea(_0x563d6e[_0x7a6c('0x14')](0x1f4,_0x3b64c8[_0x7a6c('0x17')]));});});};exports[_0x7a6c('0x23')]=function(_0x5bb7ce){var _0x2a1153=this;return new Promise(function(_0x4d03be,_0xb0e8a){return db[_0x7a6c('0x1a')][_0x7a6c('0x24')]({'raw':_0x5bb7ce['options']?_0x5bb7ce[_0x7a6c('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x5bb7ce[_0x7a6c('0x1c')]?_0x5bb7ce[_0x7a6c('0x1c')][_0x7a6c('0x1d')]||null:null,'attributes':_0x5bb7ce[_0x7a6c('0x1c')]?_0x5bb7ce[_0x7a6c('0x1c')][_0x7a6c('0x1e')]||null:null,'include':_0x5bb7ce['options']?_0x5bb7ce['options'][_0x7a6c('0x20')]?_[_0x7a6c('0x25')](_0x5bb7ce[_0x7a6c('0x1c')][_0x7a6c('0x20')],function(_0x2a04e6){return{'model':db[_0x2a04e6[_0x7a6c('0x21')]],'as':_0x2a04e6['as'],'attributes':_0x2a04e6[_0x7a6c('0x1e')],'include':_0x2a04e6['include']?_['map'](_0x2a04e6['include'],function(_0x33179f){return{'model':db[_0x33179f[_0x7a6c('0x21')]],'as':_0x33179f['as'],'attributes':_0x33179f[_0x7a6c('0x1e')],'include':_0x33179f['include']?_[_0x7a6c('0x25')](_0x33179f[_0x7a6c('0x20')],function(_0x316968){return{'model':db[_0x316968[_0x7a6c('0x21')]],'as':_0x316968['as'],'attributes':_0x316968[_0x7a6c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7a6c('0xf')](function(_0xd75e85){logger['info'](_0x7a6c('0x23'),_0x5bb7ce);logger[_0x7a6c('0x12')](_0x7a6c('0x23'),_0x5bb7ce,JSON[_0x7a6c('0x13')](_0xd75e85));_0x4d03be(_0xd75e85);})['catch'](function(_0x354fb1){logger['error'](_0x7a6c('0x23'),_0x354fb1['message'],_0x5bb7ce);_0xb0e8a(_0x2a1153['error'](0x1f4,_0x354fb1[_0x7a6c('0x17')]));});});}; \ No newline at end of file +var _0x439d=['find','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','http','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','include','model','map','debug','ShowWhatsappQueue'];(function(_0x353cd6,_0xc795f6){var _0x55712a=function(_0x3b83e1){while(--_0x3b83e1){_0x353cd6['push'](_0x353cd6['shift']());}};_0x55712a(++_0xc795f6);}(_0x439d,0xdf));var _0xd439=function(_0x1b1c4f,_0x32eb9c){_0x1b1c4f=_0x1b1c4f-0x0;var _0x3f02c1=_0x439d[_0x1b1c4f];return _0x3f02c1;};'use strict';var _=require('lodash');var util=require(_0xd439('0x0'));var moment=require(_0xd439('0x1'));var BPromise=require(_0xd439('0x2'));var rs=require(_0xd439('0x3'));var fs=require('fs');var Redis=require(_0xd439('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd439('0x5'));var logger=require(_0xd439('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd439('0x7'));var client=jayson['client'][_0xd439('0x8')]({'port':0x232a});config[_0xd439('0x9')]=_['defaults'](config['redis'],{'host':_0xd439('0xa'),'port':0x18eb});var socket=require(_0xd439('0xb'))(new Redis(config[_0xd439('0x9')]));require(_0xd439('0xc'))[_0xd439('0xd')](socket);function respondWithRpcPromise(_0x3f338f,_0x2d1bc3,_0x419250){return new BPromise(function(_0x560849,_0x2f305e){return client[_0xd439('0xe')](_0x3f338f,_0x419250)[_0xd439('0xf')](function(_0x3dbb4e){logger[_0xd439('0x10')](_0xd439('0x11'),_0x2d1bc3,_0xd439('0x12'));logger['debug'](_0xd439('0x13'),_0x2d1bc3,_0xd439('0x12'),JSON[_0xd439('0x14')](_0x3dbb4e));if(_0x3dbb4e['error']){if(_0x3dbb4e[_0xd439('0x15')]['code']===0x1f4){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x2d1bc3,_0x3dbb4e[_0xd439('0x15')][_0xd439('0x16')]);return _0x2f305e(_0x3dbb4e[_0xd439('0x15')][_0xd439('0x16')]);}logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x2d1bc3,_0x3dbb4e[_0xd439('0x15')][_0xd439('0x16')]);return _0x560849(_0x3dbb4e['error'][_0xd439('0x16')]);}else{logger['info'](_0xd439('0x11'),_0x2d1bc3,_0xd439('0x12'));_0x560849(_0x3dbb4e['result']['message']);}})[_0xd439('0x17')](function(_0x421b72){logger[_0xd439('0x15')](_0xd439('0x11'),_0x2d1bc3,_0x421b72);_0x2f305e(_0x421b72);});});}exports[_0xd439('0x18')]=function(_0x55834c){var _0x2ce3cc=this;return new Promise(function(_0xdccd12,_0x2da40f){return db[_0xd439('0x19')][_0xd439('0x1a')]({'raw':_0x55834c[_0xd439('0x1b')]?_0x55834c['options'][_0xd439('0x1c')]===undefined?!![]:![]:!![],'where':_0x55834c[_0xd439('0x1b')]?_0x55834c[_0xd439('0x1b')][_0xd439('0x1d')]||null:null,'attributes':_0x55834c['options']?_0x55834c['options'][_0xd439('0x1e')]||null:null,'limit':_0x55834c[_0xd439('0x1b')]?_0x55834c[_0xd439('0x1b')]['limit']||null:null,'include':_0x55834c[_0xd439('0x1b')]?_0x55834c[_0xd439('0x1b')][_0xd439('0x1f')]?_['map'](_0x55834c[_0xd439('0x1b')][_0xd439('0x1f')],function(_0x107b26){return{'model':db[_0x107b26[_0xd439('0x20')]],'as':_0x107b26['as'],'attributes':_0x107b26[_0xd439('0x1e')],'include':_0x107b26['include']?_[_0xd439('0x21')](_0x107b26[_0xd439('0x1f')],function(_0x1998f1){return{'model':db[_0x1998f1[_0xd439('0x20')]],'as':_0x1998f1['as'],'attributes':_0x1998f1['attributes'],'include':_0x1998f1['include']?_[_0xd439('0x21')](_0x1998f1[_0xd439('0x1f')],function(_0x587291){return{'model':db[_0x587291[_0xd439('0x20')]],'as':_0x587291['as'],'attributes':_0x587291[_0xd439('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd439('0xf')](function(_0x43e2be){logger[_0xd439('0x10')](_0xd439('0x18'),_0x55834c);logger[_0xd439('0x22')](_0xd439('0x18'),_0x55834c,JSON[_0xd439('0x14')](_0x43e2be));_0xdccd12(_0x43e2be);})[_0xd439('0x17')](function(_0x43ce00){logger['error']('GetWhatsappQueue',_0x43ce00['message'],_0x55834c);_0x2da40f(_0x2ce3cc[_0xd439('0x15')](0x1f4,_0x43ce00['message']));});});};exports[_0xd439('0x23')]=function(_0x2b0f1b){var _0x12067b=this;return new Promise(function(_0x1194aa,_0x9df593){return db['WhatsappQueue'][_0xd439('0x24')]({'raw':_0x2b0f1b[_0xd439('0x1b')]?_0x2b0f1b[_0xd439('0x1b')][_0xd439('0x1c')]===undefined?!![]:![]:!![],'where':_0x2b0f1b['options']?_0x2b0f1b['options']['where']||null:null,'attributes':_0x2b0f1b[_0xd439('0x1b')]?_0x2b0f1b[_0xd439('0x1b')]['attributes']||null:null,'include':_0x2b0f1b['options']?_0x2b0f1b[_0xd439('0x1b')][_0xd439('0x1f')]?_['map'](_0x2b0f1b[_0xd439('0x1b')]['include'],function(_0x309873){return{'model':db[_0x309873['model']],'as':_0x309873['as'],'attributes':_0x309873[_0xd439('0x1e')],'include':_0x309873[_0xd439('0x1f')]?_['map'](_0x309873[_0xd439('0x1f')],function(_0x3513d3){return{'model':db[_0x3513d3['model']],'as':_0x3513d3['as'],'attributes':_0x3513d3[_0xd439('0x1e')],'include':_0x3513d3[_0xd439('0x1f')]?_[_0xd439('0x21')](_0x3513d3[_0xd439('0x1f')],function(_0xaaf097){return{'model':db[_0xaaf097[_0xd439('0x20')]],'as':_0xaaf097['as'],'attributes':_0xaaf097['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xa4a596){logger[_0xd439('0x10')](_0xd439('0x23'),_0x2b0f1b);logger[_0xd439('0x22')]('ShowWhatsappQueue',_0x2b0f1b,JSON[_0xd439('0x14')](_0xa4a596));_0x1194aa(_0xa4a596);})[_0xd439('0x17')](function(_0x4e3b43){logger[_0xd439('0x15')](_0xd439('0x23'),_0x4e3b43['message'],_0x2b0f1b);_0x9df593(_0x12067b[_0xd439('0x15')](0x1f4,_0x4e3b43['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index c6441bc..531d16b 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 _0xaf3f=['./whatsappQueue.events','save','remove','update','emit','register','length','whatsappQueue:'];(function(_0x56a626,_0x582d3c){var _0x388b44=function(_0xdfd9b1){while(--_0xdfd9b1){_0x56a626['push'](_0x56a626['shift']());}};_0x388b44(++_0x582d3c);}(_0xaf3f,0xa8));var _0xfaf3=function(_0x2f36d5,_0x1b79e0){_0x2f36d5=_0x2f36d5-0x0;var _0x393e6b=_0xaf3f[_0x2f36d5];return _0x393e6b;};'use strict';var WhatsappQueueEvents=require(_0xfaf3('0x0'));var events=[_0xfaf3('0x1'),_0xfaf3('0x2'),_0xfaf3('0x3')];function createListener(_0x24fcc4,_0x3c4b32){return function(_0x75081b){_0x3c4b32[_0xfaf3('0x4')](_0x24fcc4,_0x75081b);};}function removeListener(_0xcaef6c,_0x3f9f05){return function(){WhatsappQueueEvents['removeListener'](_0xcaef6c,_0x3f9f05);};}exports[_0xfaf3('0x5')]=function(_0x39cb26){for(var _0x15a5d9=0x0,_0x3daa9d=events[_0xfaf3('0x6')];_0x15a5d9<_0x3daa9d;_0x15a5d9++){var _0x47ba9b=events[_0x15a5d9];var _0x3b8d92=createListener(_0xfaf3('0x7')+_0x47ba9b,_0x39cb26);WhatsappQueueEvents['on'](_0x47ba9b,_0x3b8d92);}}; \ No newline at end of file +var _0xcbb7=['save','remove','update','removeListener','whatsappQueue:','./whatsappQueue.events'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0xcbb7,0x1df));var _0x7cbb=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcbb7[_0x20a584];return _0x4b41a8;};'use strict';var WhatsappQueueEvents=require(_0x7cbb('0x0'));var events=[_0x7cbb('0x1'),_0x7cbb('0x2'),_0x7cbb('0x3')];function createListener(_0x57cc8c,_0x4ad1df){return function(_0x528c59){_0x4ad1df['emit'](_0x57cc8c,_0x528c59);};}function removeListener(_0x5034e4,_0x662db0){return function(){WhatsappQueueEvents[_0x7cbb('0x4')](_0x5034e4,_0x662db0);};}exports['register']=function(_0x146393){for(var _0x4dfc35=0x0,_0x5a8213=events['length'];_0x4dfc35<_0x5a8213;_0x4dfc35++){var _0x3eab95=events[_0x4dfc35];var _0x3f43b0=createListener(_0x7cbb('0x5')+_0x3eab95,_0x146393);WhatsappQueueEvents['on'](_0x3eab95,_0x3f43b0);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 08dbc05..fdf0eca 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 _0xa498=['express','Router','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','put','update','delete','exports','multer','util','path'];(function(_0x4eb8f6,_0xadd652){var _0x5da2a5=function(_0x1d3396){while(--_0x1d3396){_0x4eb8f6['push'](_0x4eb8f6['shift']());}};_0x5da2a5(++_0xadd652);}(_0xa498,0x179));var _0x8a49=function(_0x4eaa4c,_0x2f7422){_0x4eaa4c=_0x4eaa4c-0x0;var _0x15aec6=_0xa498[_0x4eaa4c];return _0x15aec6;};'use strict';var multer=require(_0x8a49('0x0'));var util=require(_0x8a49('0x1'));var path=require(_0x8a49('0x2'));var timeout=require('connect-timeout');var express=require(_0x8a49('0x3'));var router=express[_0x8a49('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8a49('0x5'));var config=require(_0x8a49('0x6'));var controller=require(_0x8a49('0x7'));router[_0x8a49('0x8')]('/',auth[_0x8a49('0x9')](),controller[_0x8a49('0xa')]);router['get'](_0x8a49('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x8a49('0x8')](_0x8a49('0xc'),auth[_0x8a49('0x9')](),controller[_0x8a49('0xd')]);router[_0x8a49('0xe')]('/',auth[_0x8a49('0x9')](),controller['create']);router[_0x8a49('0xf')](_0x8a49('0xc'),auth[_0x8a49('0x9')](),controller[_0x8a49('0x10')]);router[_0x8a49('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x8a49('0x12')]=router; \ No newline at end of file +var _0xf081=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','destroy','exports'];(function(_0x253255,_0x5f141e){var _0x10082e=function(_0x1710fe){while(--_0x1710fe){_0x253255['push'](_0x253255['shift']());}};_0x10082e(++_0x5f141e);}(_0xf081,0x130));var _0x1f08=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0xf081[_0x12f688];return _0x59c3de;};'use strict';var multer=require(_0x1f08('0x0'));var util=require(_0x1f08('0x1'));var path=require(_0x1f08('0x2'));var timeout=require(_0x1f08('0x3'));var express=require(_0x1f08('0x4'));var router=express[_0x1f08('0x5')]();var auth=require(_0x1f08('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1f08('0x7'));var controller=require(_0x1f08('0x8'));router[_0x1f08('0x9')]('/',auth[_0x1f08('0xa')](),controller[_0x1f08('0xb')]);router['get'](_0x1f08('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x1f08('0x9')](_0x1f08('0xd'),auth[_0x1f08('0xa')](),controller[_0x1f08('0xe')]);router['post']('/',auth[_0x1f08('0xa')](),controller[_0x1f08('0xf')]);router[_0x1f08('0x10')](_0x1f08('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x1f08('0xd'),auth[_0x1f08('0xa')](),controller[_0x1f08('0x11')]);module[_0x1f08('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index d14e1e5..76f5ad1 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 _0x00bb=['sequelize','exports','STRING','DATE'];(function(_0x5c6b3a,_0x50d650){var _0x5d96b4=function(_0x51a0a7){while(--_0x51a0a7){_0x5c6b3a['push'](_0x5c6b3a['shift']());}};_0x5d96b4(++_0x50d650);}(_0x00bb,0x1d8));var _0xb00b=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x00bb[_0x433a86];return _0x23000c;};'use strict';var Sequelize=require(_0xb00b('0x0'));module[_0xb00b('0x1')]={'uniqueid':{'type':Sequelize[_0xb00b('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xb00b('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xb00b('0x3')]},'exitAt':{'type':Sequelize[_0xb00b('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x57a4f0,_0x534004){var _0x2b6993=function(_0x2033b8){while(--_0x2033b8){_0x57a4f0['push'](_0x57a4f0['shift']());}};_0x2b6993(++_0x534004);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index c6dab4a..ef6b5d1 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 _0x3445=['json','offset','limit','save','update','then','end','error','name','send','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','filter','where','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','merge','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status'];(function(_0x114adc,_0x1b1c55){var _0x19199a=function(_0x2c9442){while(--_0x2c9442){_0x114adc['push'](_0x114adc['shift']());}};_0x19199a(++_0x1b1c55);}(_0x3445,0x1b7));var _0x5344=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3445[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x5344('0x0'));var emlformat=require(_0x5344('0x1'));var rimraf=require(_0x5344('0x2'));var zipdir=require(_0x5344('0x3'));var jsonpatch=require(_0x5344('0x4'));var rp=require(_0x5344('0x5'));var moment=require(_0x5344('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5344('0x7'));var path=require(_0x5344('0x8'));var sox=require(_0x5344('0x9'));var csv=require(_0x5344('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5344('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5344('0xc'));var Papa=require(_0x5344('0xd'));var Redis=require(_0x5344('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x5344('0xf'));var as=require(_0x5344('0x10'));var hardwareService=require(_0x5344('0x11'));var logger=require(_0x5344('0x12'))(_0x5344('0x13'));var utils=require(_0x5344('0x14'));var config=require('../../config/environment');var db=require(_0x5344('0x15'))['db'];function respondWithStatusCode(_0x167214,_0x53ec8c){_0x53ec8c=_0x53ec8c||0xcc;return function(_0x2b9f5a){if(_0x2b9f5a){return _0x167214['sendStatus'](_0x53ec8c);}return _0x167214[_0x5344('0x16')](_0x53ec8c)['end']();};}function respondWithResult(_0x5e825e,_0x52f150){_0x52f150=_0x52f150||0xc8;return function(_0x9aee50){if(_0x9aee50){return _0x5e825e[_0x5344('0x16')](_0x52f150)[_0x5344('0x17')](_0x9aee50);}};}function respondWithFilteredResult(_0x1a4fca,_0x2cfb71){return function(_0x6eeedc){if(_0x6eeedc){var _0x16f302=_0x6eeedc['count'],_0x307f63=_0x2cfb71[_0x5344('0x18')],_0x41906d=_0x2cfb71[_0x5344('0x18')]+_0x2cfb71[_0x5344('0x19')],_0x405630;if(_0x41906d>=_0x16f302){_0x41906d=_0x16f302;_0x405630=0xc8;}else{_0x405630=0xce;}_0x1a4fca[_0x5344('0x16')](_0x405630);return _0x1a4fca['set']('Content-Range',_0x307f63+'-'+_0x41906d+'/'+_0x16f302)['json'](_0x6eeedc);}return null;};}function patchUpdates(_0x1a48b7){return function(_0x4bb855){try{jsonpatch['apply'](_0x4bb855,_0x1a48b7,!![]);}catch(_0x4a636e){return BPromise['reject'](_0x4a636e);}return _0x4bb855[_0x5344('0x1a')]();};}function saveUpdates(_0xa623c5,_0x228212){return function(_0x2e5511){if(_0x2e5511){return _0x2e5511[_0x5344('0x1b')](_0xa623c5)[_0x5344('0x1c')](function(_0x72a04c){return _0x72a04c;});}return null;};}function removeEntity(_0x373d9e,_0x22caa8){return function(_0xdcf9d1){if(_0xdcf9d1){return _0xdcf9d1['destroy']()['then'](function(){_0x373d9e[_0x5344('0x16')](0xcc)[_0x5344('0x1d')]();});}};}function handleEntityNotFound(_0x2cb34d,_0x434e0d){return function(_0x1f3157){if(!_0x1f3157){_0x2cb34d['sendStatus'](0x194);}return _0x1f3157;};}function handleError(_0x1226c6,_0x1c86fe){_0x1c86fe=_0x1c86fe||0x1f4;return function(_0xe1c211){logger[_0x5344('0x1e')](_0xe1c211['stack']);if(_0xe1c211[_0x5344('0x1f')]){delete _0xe1c211[_0x5344('0x1f')];}_0x1226c6[_0x5344('0x16')](_0x1c86fe)[_0x5344('0x20')](_0xe1c211);};}exports['index']=function(_0x4a9e3d,_0x30a760){var _0x30f6f8={},_0x3471a9={},_0x28b50b={'count':0x0,'rows':[]};var _0x494997=_[_0x5344('0x21')](db[_0x5344('0x22')][_0x5344('0x23')],function(_0x415e6e){return{'name':_0x415e6e[_0x5344('0x24')],'type':_0x415e6e[_0x5344('0x25')][_0x5344('0x26')]};});_0x3471a9['model']=_[_0x5344('0x21')](_0x494997,'name');_0x3471a9[_0x5344('0x27')]=_[_0x5344('0x28')](_0x4a9e3d[_0x5344('0x27')]);_0x3471a9[_0x5344('0x29')]=_[_0x5344('0x2a')](_0x3471a9[_0x5344('0x2b')],_0x3471a9[_0x5344('0x27')]);_0x30f6f8[_0x5344('0x2c')]=_[_0x5344('0x2a')](_0x3471a9['model'],qs[_0x5344('0x2d')](_0x4a9e3d[_0x5344('0x27')][_0x5344('0x2d')]));_0x30f6f8[_0x5344('0x2c')]=_0x30f6f8['attributes'][_0x5344('0x2e')]?_0x30f6f8[_0x5344('0x2c')]:_0x3471a9['model'];if(!_0x4a9e3d[_0x5344('0x27')][_0x5344('0x2f')]('nolimit')){_0x30f6f8[_0x5344('0x19')]=qs[_0x5344('0x19')](_0x4a9e3d['query'][_0x5344('0x19')]);_0x30f6f8[_0x5344('0x18')]=qs['offset'](_0x4a9e3d[_0x5344('0x27')][_0x5344('0x18')]);}_0x30f6f8[_0x5344('0x30')]=qs[_0x5344('0x31')](_0x4a9e3d[_0x5344('0x27')]['sort']);_0x30f6f8['where']=qs[_0x5344('0x29')](_['pick'](_0x4a9e3d['query'],_0x3471a9['filters']),_0x494997);if(_0x4a9e3d[_0x5344('0x27')][_0x5344('0x32')]){_0x30f6f8[_0x5344('0x33')]=_['merge'](_0x30f6f8[_0x5344('0x33')],{'$or':_['map'](_0x494997,function(_0x5c2d1a){if(_0x5c2d1a['type']!==_0x5344('0x34')){var _0x1d855f={};_0x1d855f[_0x5c2d1a[_0x5344('0x1f')]]={'$like':'%'+_0x4a9e3d[_0x5344('0x27')][_0x5344('0x32')]+'%'};return _0x1d855f;}})});}_0x30f6f8=_['merge']({},_0x30f6f8,_0x4a9e3d[_0x5344('0x35')]);var _0x1c314e={'where':_0x30f6f8[_0x5344('0x33')]};return db[_0x5344('0x22')]['count'](_0x1c314e)[_0x5344('0x1c')](function(_0x32e058){_0x28b50b[_0x5344('0x36')]=_0x32e058;if(_0x4a9e3d[_0x5344('0x27')][_0x5344('0x37')]){_0x30f6f8[_0x5344('0x38')]=[{'all':!![]}];}return db[_0x5344('0x22')][_0x5344('0x39')](_0x30f6f8);})['then'](function(_0x3bf6d8){_0x28b50b[_0x5344('0x3a')]=_0x3bf6d8;return _0x28b50b;})[_0x5344('0x1c')](respondWithFilteredResult(_0x30a760,_0x30f6f8))[_0x5344('0x3b')](handleError(_0x30a760,null));};exports['show']=function(_0x155996,_0x3b7fd6){var _0x51720d={'raw':!![],'where':{'id':_0x155996[_0x5344('0x3c')]['id']}},_0x167d2a={};_0x167d2a['model']=_[_0x5344('0x28')](db[_0x5344('0x22')]['rawAttributes']);_0x167d2a[_0x5344('0x27')]=_[_0x5344('0x28')](_0x155996[_0x5344('0x27')]);_0x167d2a[_0x5344('0x29')]=_[_0x5344('0x2a')](_0x167d2a[_0x5344('0x2b')],_0x167d2a[_0x5344('0x27')]);_0x51720d[_0x5344('0x2c')]=_['intersection'](_0x167d2a[_0x5344('0x2b')],qs['fields'](_0x155996[_0x5344('0x27')]['fields']));_0x51720d['attributes']=_0x51720d[_0x5344('0x2c')]['length']?_0x51720d['attributes']:_0x167d2a[_0x5344('0x2b')];if(_0x155996[_0x5344('0x27')]['includeAll']){_0x51720d['include']=[{'all':!![]}];}_0x51720d=_[_0x5344('0x3d')]({},_0x51720d,_0x155996[_0x5344('0x35')]);return db[_0x5344('0x22')][_0x5344('0x3e')](_0x51720d)['then'](handleEntityNotFound(_0x3b7fd6,null))[_0x5344('0x1c')](respondWithResult(_0x3b7fd6,null))['catch'](handleError(_0x3b7fd6,null));};exports[_0x5344('0x3f')]=function(_0x1c4249,_0xefbc2c){return db[_0x5344('0x22')][_0x5344('0x3f')](_0x1c4249['body'],{})[_0x5344('0x1c')](respondWithResult(_0xefbc2c,0xc9))['catch'](handleError(_0xefbc2c,null));};exports[_0x5344('0x1b')]=function(_0xd1d0c2,_0x56d502){if(_0xd1d0c2[_0x5344('0x40')]['id']){delete _0xd1d0c2[_0x5344('0x40')]['id'];}return db[_0x5344('0x22')][_0x5344('0x3e')]({'where':{'id':_0xd1d0c2['params']['id']}})[_0x5344('0x1c')](handleEntityNotFound(_0x56d502,null))[_0x5344('0x1c')](saveUpdates(_0xd1d0c2[_0x5344('0x40')],null))[_0x5344('0x1c')](respondWithResult(_0x56d502,null))[_0x5344('0x3b')](handleError(_0x56d502,null));};exports['destroy']=function(_0x325bf4,_0x2e17da){return db['WhatsappQueueReport'][_0x5344('0x3e')]({'where':{'id':_0x325bf4['params']['id']}})[_0x5344('0x1c')](handleEntityNotFound(_0x2e17da,null))[_0x5344('0x1c')](removeEntity(_0x2e17da,null))[_0x5344('0x3b')](handleError(_0x2e17da,null));};exports[_0x5344('0x41')]=function(_0x4676fa,_0x313d5b){return db[_0x5344('0x22')]['describe']()[_0x5344('0x1c')](respondWithResult(_0x313d5b,null))[_0x5344('0x3b')](handleError(_0x313d5b,null));}; \ No newline at end of file +var _0xe24e=['limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','where','pick','type','VIRTUAL','filter','merge','includeAll','include','rows','catch','params','keys','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','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','status','end','json','count'];(function(_0x1a5f1b,_0xf0df1b){var _0x6f5990=function(_0x3f1569){while(--_0x3f1569){_0x1a5f1b['push'](_0x1a5f1b['shift']());}};_0x6f5990(++_0xf0df1b);}(_0xe24e,0x15f));var _0xee24=function(_0xe30e17,_0xce02be){_0xe30e17=_0xe30e17-0x0;var _0x2342c9=_0xe24e[_0xe30e17];return _0x2342c9;};'use strict';var pdf=require(_0xee24('0x0'));var emlformat=require(_0xee24('0x1'));var rimraf=require(_0xee24('0x2'));var zipdir=require(_0xee24('0x3'));var jsonpatch=require(_0xee24('0x4'));var rp=require(_0xee24('0x5'));var moment=require(_0xee24('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xee24('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xee24('0x8'));var ejs=require(_0xee24('0x9'));var fs=require('fs');var _=require(_0xee24('0xa'));var squel=require(_0xee24('0xb'));var crypto=require(_0xee24('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xee24('0xd'));var toCsv=require(_0xee24('0x8'));var querystring=require(_0xee24('0xe'));var Papa=require(_0xee24('0xf'));var Redis=require(_0xee24('0x10'));var authService=require(_0xee24('0x11'));var qs=require(_0xee24('0x12'));var as=require(_0xee24('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee24('0x14'))(_0xee24('0x15'));var utils=require(_0xee24('0x16'));var config=require(_0xee24('0x17'));var db=require(_0xee24('0x18'))['db'];function respondWithStatusCode(_0x3b273a,_0x7a2c92){_0x7a2c92=_0x7a2c92||0xcc;return function(_0x3a3289){if(_0x3a3289){return _0x3b273a['sendStatus'](_0x7a2c92);}return _0x3b273a[_0xee24('0x19')](_0x7a2c92)[_0xee24('0x1a')]();};}function respondWithResult(_0x3035ac,_0x20a438){_0x20a438=_0x20a438||0xc8;return function(_0x3d6824){if(_0x3d6824){return _0x3035ac[_0xee24('0x19')](_0x20a438)[_0xee24('0x1b')](_0x3d6824);}};}function respondWithFilteredResult(_0x408297,_0xe7780d){return function(_0x2b8fe5){if(_0x2b8fe5){var _0x177564=_0x2b8fe5[_0xee24('0x1c')],_0x42db45=_0xe7780d['offset'],_0x729128=_0xe7780d['offset']+_0xe7780d[_0xee24('0x1d')],_0x3cfe7b;if(_0x729128>=_0x177564){_0x729128=_0x177564;_0x3cfe7b=0xc8;}else{_0x3cfe7b=0xce;}_0x408297[_0xee24('0x19')](_0x3cfe7b);return _0x408297[_0xee24('0x1e')](_0xee24('0x1f'),_0x42db45+'-'+_0x729128+'/'+_0x177564)[_0xee24('0x1b')](_0x2b8fe5);}return null;};}function patchUpdates(_0x27a0cf){return function(_0x4619f3){try{jsonpatch[_0xee24('0x20')](_0x4619f3,_0x27a0cf,!![]);}catch(_0x14ffbc){return BPromise[_0xee24('0x21')](_0x14ffbc);}return _0x4619f3[_0xee24('0x22')]();};}function saveUpdates(_0xffa04d,_0x3ec49f){return function(_0x2d961e){if(_0x2d961e){return _0x2d961e[_0xee24('0x23')](_0xffa04d)[_0xee24('0x24')](function(_0xd77d36){return _0xd77d36;});}return null;};}function removeEntity(_0x45f448,_0x443592){return function(_0x14064c){if(_0x14064c){return _0x14064c[_0xee24('0x25')]()[_0xee24('0x24')](function(){_0x45f448[_0xee24('0x19')](0xcc)[_0xee24('0x1a')]();});}};}function handleEntityNotFound(_0x677ce6,_0x19f587){return function(_0x41fad2){if(!_0x41fad2){_0x677ce6[_0xee24('0x26')](0x194);}return _0x41fad2;};}function handleError(_0x1ec6fd,_0x32cc84){_0x32cc84=_0x32cc84||0x1f4;return function(_0x1baadf){logger[_0xee24('0x27')](_0x1baadf[_0xee24('0x28')]);if(_0x1baadf[_0xee24('0x29')]){delete _0x1baadf[_0xee24('0x29')];}_0x1ec6fd[_0xee24('0x19')](_0x32cc84)[_0xee24('0x2a')](_0x1baadf);};}exports[_0xee24('0x2b')]=function(_0x47420a,_0x5617b6){var _0x3d6ef3={},_0x29de59={},_0xfcb7b3={'count':0x0,'rows':[]};var _0x26dd93=_[_0xee24('0x2c')](db[_0xee24('0x2d')][_0xee24('0x2e')],function(_0x6ccc9e){return{'name':_0x6ccc9e[_0xee24('0x2f')],'type':_0x6ccc9e['type'][_0xee24('0x30')]};});_0x29de59[_0xee24('0x31')]=_[_0xee24('0x2c')](_0x26dd93,'name');_0x29de59[_0xee24('0x32')]=_['keys'](_0x47420a[_0xee24('0x32')]);_0x29de59[_0xee24('0x33')]=_[_0xee24('0x34')](_0x29de59[_0xee24('0x31')],_0x29de59[_0xee24('0x32')]);_0x3d6ef3[_0xee24('0x35')]=_[_0xee24('0x34')](_0x29de59[_0xee24('0x31')],qs[_0xee24('0x36')](_0x47420a[_0xee24('0x32')][_0xee24('0x36')]));_0x3d6ef3['attributes']=_0x3d6ef3[_0xee24('0x35')][_0xee24('0x37')]?_0x3d6ef3[_0xee24('0x35')]:_0x29de59['model'];if(!_0x47420a[_0xee24('0x32')][_0xee24('0x38')]('nolimit')){_0x3d6ef3[_0xee24('0x1d')]=qs[_0xee24('0x1d')](_0x47420a['query'][_0xee24('0x1d')]);_0x3d6ef3['offset']=qs[_0xee24('0x39')](_0x47420a['query'][_0xee24('0x39')]);}_0x3d6ef3[_0xee24('0x3a')]=qs[_0xee24('0x3b')](_0x47420a[_0xee24('0x32')][_0xee24('0x3b')]);_0x3d6ef3[_0xee24('0x3c')]=qs['filters'](_[_0xee24('0x3d')](_0x47420a[_0xee24('0x32')],_0x29de59[_0xee24('0x33')]),_0x26dd93);if(_0x47420a['query']['filter']){_0x3d6ef3[_0xee24('0x3c')]=_['merge'](_0x3d6ef3['where'],{'$or':_['map'](_0x26dd93,function(_0x533032){if(_0x533032[_0xee24('0x3e')]!==_0xee24('0x3f')){var _0x2bb2f0={};_0x2bb2f0[_0x533032['name']]={'$like':'%'+_0x47420a[_0xee24('0x32')][_0xee24('0x40')]+'%'};return _0x2bb2f0;}})});}_0x3d6ef3=_[_0xee24('0x41')]({},_0x3d6ef3,_0x47420a['options']);var _0x2b749f={'where':_0x3d6ef3[_0xee24('0x3c')]};return db['WhatsappQueueReport'][_0xee24('0x1c')](_0x2b749f)[_0xee24('0x24')](function(_0x384666){_0xfcb7b3['count']=_0x384666;if(_0x47420a[_0xee24('0x32')][_0xee24('0x42')]){_0x3d6ef3[_0xee24('0x43')]=[{'all':!![]}];}return db['WhatsappQueueReport']['findAll'](_0x3d6ef3);})['then'](function(_0x1151a8){_0xfcb7b3[_0xee24('0x44')]=_0x1151a8;return _0xfcb7b3;})[_0xee24('0x24')](respondWithFilteredResult(_0x5617b6,_0x3d6ef3))[_0xee24('0x45')](handleError(_0x5617b6,null));};exports['show']=function(_0x911109,_0x4004a0){var _0x2c063c={'raw':!![],'where':{'id':_0x911109[_0xee24('0x46')]['id']}},_0x2b227e={};_0x2b227e[_0xee24('0x31')]=_[_0xee24('0x47')](db[_0xee24('0x2d')][_0xee24('0x2e')]);_0x2b227e['query']=_[_0xee24('0x47')](_0x911109[_0xee24('0x32')]);_0x2b227e['filters']=_[_0xee24('0x34')](_0x2b227e[_0xee24('0x31')],_0x2b227e['query']);_0x2c063c[_0xee24('0x35')]=_[_0xee24('0x34')](_0x2b227e[_0xee24('0x31')],qs[_0xee24('0x36')](_0x911109[_0xee24('0x32')][_0xee24('0x36')]));_0x2c063c['attributes']=_0x2c063c['attributes'][_0xee24('0x37')]?_0x2c063c[_0xee24('0x35')]:_0x2b227e[_0xee24('0x31')];if(_0x911109[_0xee24('0x32')][_0xee24('0x42')]){_0x2c063c[_0xee24('0x43')]=[{'all':!![]}];}_0x2c063c=_['merge']({},_0x2c063c,_0x911109['options']);return db[_0xee24('0x2d')][_0xee24('0x48')](_0x2c063c)[_0xee24('0x24')](handleEntityNotFound(_0x4004a0,null))[_0xee24('0x24')](respondWithResult(_0x4004a0,null))[_0xee24('0x45')](handleError(_0x4004a0,null));};exports['create']=function(_0x131c9f,_0x3f89ec){return db[_0xee24('0x2d')][_0xee24('0x49')](_0x131c9f[_0xee24('0x4a')],{})[_0xee24('0x24')](respondWithResult(_0x3f89ec,0xc9))[_0xee24('0x45')](handleError(_0x3f89ec,null));};exports[_0xee24('0x23')]=function(_0xc2e74f,_0x3e0ac5){if(_0xc2e74f['body']['id']){delete _0xc2e74f['body']['id'];}return db['WhatsappQueueReport']['find']({'where':{'id':_0xc2e74f[_0xee24('0x46')]['id']}})['then'](handleEntityNotFound(_0x3e0ac5,null))['then'](saveUpdates(_0xc2e74f['body'],null))[_0xee24('0x24')](respondWithResult(_0x3e0ac5,null))['catch'](handleError(_0x3e0ac5,null));};exports[_0xee24('0x25')]=function(_0x4ae33d,_0x55e3e9){return db[_0xee24('0x2d')][_0xee24('0x48')]({'where':{'id':_0x4ae33d[_0xee24('0x46')]['id']}})[_0xee24('0x24')](handleEntityNotFound(_0x55e3e9,null))[_0xee24('0x24')](removeEntity(_0x55e3e9,null))[_0xee24('0x45')](handleError(_0x55e3e9,null));};exports[_0xee24('0x4b')]=function(_0x14e958,_0x451551){return db[_0xee24('0x2d')][_0xee24('0x4b')]()[_0xee24('0x24')](respondWithResult(_0x451551,null))[_0xee24('0x45')](handleError(_0x451551,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 9420ed0..1ec30da 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 _0x8ee9=['uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./whatsappQueueReport.attributes','define','report_whatsapp_queue'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8ee9,0xbc));var _0x98ee=function(_0x26bf26,_0x5352f4){_0x26bf26=_0x26bf26-0x0;var _0x4e9dfd=_0x8ee9[_0x26bf26];return _0x4e9dfd;};'use strict';var _=require('lodash');var util=require(_0x98ee('0x0'));var logger=require(_0x98ee('0x1'))(_0x98ee('0x2'));var moment=require(_0x98ee('0x3'));var BPromise=require(_0x98ee('0x4'));var rp=require(_0x98ee('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x98ee('0x6'));var attributes=require(_0x98ee('0x7'));module['exports']=function(_0x299114,_0x5efac3){return _0x299114[_0x98ee('0x8')]('WhatsappQueueReport',attributes,{'tableName':_0x98ee('0x9'),'paranoid':![],'indexes':[{'name':_0x98ee('0xa'),'fields':[_0x98ee('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4271=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','uniqueid','lodash','util','../../config/logger'];(function(_0x449462,_0x4966db){var _0x3af298=function(_0x5ae432){while(--_0x5ae432){_0x449462['push'](_0x449462['shift']());}};_0x3af298(++_0x4966db);}(_0x4271,0x11a));var _0x1427=function(_0x3c8c80,_0x4d47cc){_0x3c8c80=_0x3c8c80-0x0;var _0x479a99=_0x4271[_0x3c8c80];return _0x479a99;};'use strict';var _=require(_0x1427('0x0'));var util=require(_0x1427('0x1'));var logger=require(_0x1427('0x2'))(_0x1427('0x3'));var moment=require(_0x1427('0x4'));var BPromise=require(_0x1427('0x5'));var rp=require(_0x1427('0x6'));var fs=require('fs');var path=require(_0x1427('0x7'));var rimraf=require(_0x1427('0x8'));var config=require(_0x1427('0x9'));var attributes=require(_0x1427('0xa'));module[_0x1427('0xb')]=function(_0x2771b7,_0x32f438){return _0x2771b7[_0x1427('0xc')](_0x1427('0xd'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x1427('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 648b786..75f704d 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 _0x4236=['WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','debug','raw','attributes','limit','UpdateWhatsappQueueReport','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','WhatsappQueueReport,\x20%s,\x20%s'];(function(_0x1a3ab4,_0x40de86){var _0x3167f6=function(_0x49d478){while(--_0x49d478){_0x1a3ab4['push'](_0x1a3ab4['shift']());}};_0x3167f6(++_0x40de86);}(_0x4236,0x152));var _0x6423=function(_0x14a4bf,_0x2c9226){_0x14a4bf=_0x14a4bf-0x0;var _0x53dd1c=_0x4236[_0x14a4bf];return _0x53dd1c;};'use strict';var _=require(_0x6423('0x0'));var util=require('util');var moment=require(_0x6423('0x1'));var BPromise=require(_0x6423('0x2'));var rs=require(_0x6423('0x3'));var fs=require('fs');var Redis=require(_0x6423('0x4'));var db=require(_0x6423('0x5'))['db'];var utils=require(_0x6423('0x6'));var logger=require(_0x6423('0x7'))(_0x6423('0x8'));var config=require(_0x6423('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x410ba0,_0x36a03c,_0x1a2795){return new BPromise(function(_0x1ba7ab,_0x38055f){return client[_0x6423('0xa')](_0x410ba0,_0x1a2795)[_0x6423('0xb')](function(_0x5c95bd){logger[_0x6423('0xc')](_0x6423('0xd'),_0x36a03c,'request\x20sent');logger['debug'](_0x6423('0xe'),_0x36a03c,_0x6423('0xf'),JSON[_0x6423('0x10')](_0x5c95bd));if(_0x5c95bd['error']){if(_0x5c95bd['error'][_0x6423('0x11')]===0x1f4){logger[_0x6423('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x36a03c,_0x5c95bd[_0x6423('0x12')][_0x6423('0x13')]);return _0x38055f(_0x5c95bd['error'][_0x6423('0x13')]);}logger[_0x6423('0x12')](_0x6423('0xd'),_0x36a03c,_0x5c95bd['error'][_0x6423('0x13')]);return _0x1ba7ab(_0x5c95bd[_0x6423('0x12')][_0x6423('0x13')]);}else{logger[_0x6423('0xc')](_0x6423('0xd'),_0x36a03c,_0x6423('0xf'));_0x1ba7ab(_0x5c95bd[_0x6423('0x14')][_0x6423('0x13')]);}})['catch'](function(_0x328908){logger[_0x6423('0x12')](_0x6423('0xd'),_0x36a03c,_0x328908);_0x38055f(_0x328908);});});}exports[_0x6423('0x15')]=function(_0x2e92a9){var _0x2fb216=this;return new Promise(function(_0x3395b5,_0x19e199){return db[_0x6423('0x16')][_0x6423('0x17')](_0x2e92a9[_0x6423('0x18')],{'raw':_0x2e92a9[_0x6423('0x19')]?_0x2e92a9[_0x6423('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x6423('0xb')](function(_0x3f7d15){logger['info']('CreateWhatsappQueueReport',_0x2e92a9);logger[_0x6423('0x1a')](_0x6423('0x15'),_0x2e92a9,JSON[_0x6423('0x10')](_0x3f7d15));_0x3395b5(_0x3f7d15);})['catch'](function(_0x5a04e4){logger[_0x6423('0x12')]('CreateWhatsappQueueReport',_0x5a04e4[_0x6423('0x13')],_0x2e92a9);_0x19e199(_0x2fb216['error'](0x1f4,_0x5a04e4['message']));});});};exports['UpdateWhatsappQueueReport']=function(_0x46262e){var _0x43e139=this;return new Promise(function(_0x39d967,_0xd9885f){return db[_0x6423('0x16')]['update'](_0x46262e[_0x6423('0x18')],{'raw':_0x46262e[_0x6423('0x19')]?_0x46262e[_0x6423('0x19')][_0x6423('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46262e[_0x6423('0x19')]?_0x46262e[_0x6423('0x19')]['where']||null:null,'attributes':_0x46262e[_0x6423('0x19')]?_0x46262e[_0x6423('0x19')][_0x6423('0x1c')]||null:null,'limit':_0x46262e[_0x6423('0x19')]?_0x46262e[_0x6423('0x19')][_0x6423('0x1d')]||null:null})['then'](function(_0x27d0f8){logger[_0x6423('0xc')](_0x6423('0x1e'),_0x46262e);logger[_0x6423('0x1a')](_0x6423('0x1e'),_0x46262e,JSON[_0x6423('0x10')](_0x27d0f8));_0x39d967(_0x27d0f8);})[_0x6423('0x1f')](function(_0x292f83){logger[_0x6423('0x12')](_0x6423('0x1e'),_0x292f83[_0x6423('0x13')],_0x46262e);_0xd9885f(_0x43e139[_0x6423('0x12')](0x1f4,_0x292f83[_0x6423('0x13')]));});});}; \ No newline at end of file +var _0x2295=['CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','UpdateWhatsappQueueReport','update','where','attributes','limit','debug','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch'];(function(_0x2f1d92,_0x5ea726){var _0xc0c236=function(_0x2b2d1e){while(--_0x2b2d1e){_0x2f1d92['push'](_0x2f1d92['shift']());}};_0xc0c236(++_0x5ea726);}(_0x2295,0xf3));var _0x5229=function(_0x5ea091,_0x4c4391){_0x5ea091=_0x5ea091-0x0;var _0x324a37=_0x2295[_0x5ea091];return _0x324a37;};'use strict';var _=require(_0x5229('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5229('0x1'));var rs=require(_0x5229('0x2'));var fs=require('fs');var Redis=require(_0x5229('0x3'));var db=require(_0x5229('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5229('0x5'))(_0x5229('0x6'));var config=require(_0x5229('0x7'));var jayson=require(_0x5229('0x8'));var client=jayson['client'][_0x5229('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5dcb86,_0x5eb5a5,_0x45cd83){return new BPromise(function(_0x2edf4c,_0x4c5e0e){return client[_0x5229('0xa')](_0x5dcb86,_0x45cd83)[_0x5229('0xb')](function(_0x5afee2){logger[_0x5229('0xc')](_0x5229('0xd'),_0x5eb5a5,_0x5229('0xe'));logger['debug']('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x5eb5a5,'request\x20sent',JSON[_0x5229('0xf')](_0x5afee2));if(_0x5afee2['error']){if(_0x5afee2['error'][_0x5229('0x10')]===0x1f4){logger[_0x5229('0x11')](_0x5229('0xd'),_0x5eb5a5,_0x5afee2[_0x5229('0x11')][_0x5229('0x12')]);return _0x4c5e0e(_0x5afee2['error']['message']);}logger['error'](_0x5229('0xd'),_0x5eb5a5,_0x5afee2[_0x5229('0x11')]['message']);return _0x2edf4c(_0x5afee2[_0x5229('0x11')][_0x5229('0x12')]);}else{logger['info'](_0x5229('0xd'),_0x5eb5a5,_0x5229('0xe'));_0x2edf4c(_0x5afee2[_0x5229('0x13')][_0x5229('0x12')]);}})[_0x5229('0x14')](function(_0x5e6929){logger[_0x5229('0x11')](_0x5229('0xd'),_0x5eb5a5,_0x5e6929);_0x4c5e0e(_0x5e6929);});});}exports[_0x5229('0x15')]=function(_0x2580b0){var _0x168c70=this;return new Promise(function(_0x41913b,_0x13699a){return db[_0x5229('0x16')][_0x5229('0x17')](_0x2580b0[_0x5229('0x18')],{'raw':_0x2580b0[_0x5229('0x19')]?_0x2580b0[_0x5229('0x19')][_0x5229('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0xe73317){logger[_0x5229('0xc')](_0x5229('0x15'),_0x2580b0);logger['debug'](_0x5229('0x15'),_0x2580b0,JSON[_0x5229('0xf')](_0xe73317));_0x41913b(_0xe73317);})['catch'](function(_0x23b448){logger[_0x5229('0x11')]('CreateWhatsappQueueReport',_0x23b448[_0x5229('0x12')],_0x2580b0);_0x13699a(_0x168c70[_0x5229('0x11')](0x1f4,_0x23b448['message']));});});};exports[_0x5229('0x1b')]=function(_0x32927f){var _0x4850b5=this;return new Promise(function(_0x32e23f,_0xbb748){return db[_0x5229('0x16')][_0x5229('0x1c')](_0x32927f[_0x5229('0x18')],{'raw':_0x32927f['options']?_0x32927f['options'][_0x5229('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32927f[_0x5229('0x19')]?_0x32927f[_0x5229('0x19')][_0x5229('0x1d')]||null:null,'attributes':_0x32927f[_0x5229('0x19')]?_0x32927f[_0x5229('0x19')][_0x5229('0x1e')]||null:null,'limit':_0x32927f[_0x5229('0x19')]?_0x32927f[_0x5229('0x19')][_0x5229('0x1f')]||null:null})[_0x5229('0xb')](function(_0x1b677b){logger[_0x5229('0xc')](_0x5229('0x1b'),_0x32927f);logger[_0x5229('0x20')](_0x5229('0x1b'),_0x32927f,JSON[_0x5229('0xf')](_0x1b677b));_0x32e23f(_0x1b677b);})['catch'](function(_0xc6af95){logger[_0x5229('0x11')]('UpdateWhatsappQueueReport',_0xc6af95[_0x5229('0x12')],_0x32927f);_0xbb748(_0x4850b5[_0x5229('0x11')](0x1f4,_0xc6af95[_0x5229('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 05b04e7..73bc7b2 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 _0x1e67=['util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','put','destroy','exports'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x1e67,0x1dc));var _0x71e6=function(_0x362148,_0x527680){_0x362148=_0x362148-0x0;var _0x5d6ed5=_0x1e67[_0x362148];return _0x5d6ed5;};'use strict';var multer=require('multer');var util=require(_0x71e6('0x0'));var path=require(_0x71e6('0x1'));var timeout=require(_0x71e6('0x2'));var express=require('express');var router=express[_0x71e6('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x71e6('0x4'));var config=require(_0x71e6('0x5'));var controller=require('./whatsappTransferReport.controller');router[_0x71e6('0x6')]('/',auth[_0x71e6('0x7')](),controller['index']);router[_0x71e6('0x6')](_0x71e6('0x8'),auth[_0x71e6('0x7')](),controller[_0x71e6('0x9')]);router[_0x71e6('0x6')](_0x71e6('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x71e6('0xb')](_0x71e6('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x71e6('0xa'),auth['isAuthenticated'](),controller[_0x71e6('0xc')]);module[_0x71e6('0xd')]=router; \ No newline at end of file +var _0x1660=['/:id','destroy','exports','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','post','put'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x1660,0x17a));var _0x0166=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x1660[_0x4565bf];return _0x5610ba;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0166('0x0'));var timeout=require(_0x0166('0x1'));var express=require(_0x0166('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x0166('0x3'));var config=require(_0x0166('0x4'));var controller=require('./whatsappTransferReport.controller');router[_0x0166('0x5')]('/',auth[_0x0166('0x6')](),controller[_0x0166('0x7')]);router['get'](_0x0166('0x8'),auth[_0x0166('0x6')](),controller[_0x0166('0x9')]);router[_0x0166('0x5')]('/:id',auth[_0x0166('0x6')](),controller['show']);router[_0x0166('0xa')]('/',auth[_0x0166('0x6')](),controller['create']);router[_0x0166('0xb')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x0166('0xc'),auth[_0x0166('0x6')](),controller[_0x0166('0xd')]);module[_0x0166('0xe')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index b4c68c3..6b29992 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 _0xb7e7=['queue','sequelize','STRING','account'];(function(_0x2b7730,_0x3e890d){var _0x25c69a=function(_0x860b70){while(--_0x860b70){_0x2b7730['push'](_0x2b7730['shift']());}};_0x25c69a(++_0x3e890d);}(_0xb7e7,0x121));var _0x7b7e=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0xb7e7[_0x432fca];return _0x3adba4;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x7b7e('0x2'),'agent',_0x7b7e('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xbaf0=['ENUM','account','agent','queue','exports','STRING'];(function(_0x580cee,_0x189c97){var _0x47dfe9=function(_0x6a17d3){while(--_0x6a17d3){_0x580cee['push'](_0x580cee['shift']());}};_0x47dfe9(++_0x189c97);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'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 diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index d21ba9f..3f71619 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 _0x42bd=['filter','merge','VIRTUAL','WhatsappTransferReport','count','includeAll','include','findAll','rows','catch','show','options','create','body','find','params','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x51e52e,_0x255df4){var _0x22f975=function(_0x1a63a5){while(--_0x1a63a5){_0x51e52e['push'](_0x51e52e['shift']());}};_0x22f975(++_0x255df4);}(_0x42bd,0x197));var _0xd42b=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x42bd[_0x502c7d];return _0x30b7ed;};'use strict';var pdf=require(_0xd42b('0x0'));var emlformat=require(_0xd42b('0x1'));var rimraf=require(_0xd42b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd42b('0x3'));var rp=require(_0xd42b('0x4'));var moment=require(_0xd42b('0x5'));var BPromise=require(_0xd42b('0x6'));var Mustache=require(_0xd42b('0x7'));var util=require(_0xd42b('0x8'));var path=require(_0xd42b('0x9'));var sox=require(_0xd42b('0xa'));var csv=require(_0xd42b('0xb'));var ejs=require(_0xd42b('0xc'));var fs=require('fs');var _=require(_0xd42b('0xd'));var squel=require('squel');var crypto=require(_0xd42b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xd42b('0xf'));var toCsv=require(_0xd42b('0xb'));var querystring=require(_0xd42b('0x10'));var Papa=require(_0xd42b('0x11'));var Redis=require('ioredis');var authService=require(_0xd42b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd42b('0x13'));var hardwareService=require(_0xd42b('0x14'));var logger=require(_0xd42b('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xd42b('0x16'));var db=require(_0xd42b('0x17'))['db'];function respondWithStatusCode(_0x5f2b1f,_0x3d6b89){_0x3d6b89=_0x3d6b89||0xcc;return function(_0x5bbcd0){if(_0x5bbcd0){return _0x5f2b1f['sendStatus'](_0x3d6b89);}return _0x5f2b1f[_0xd42b('0x18')](_0x3d6b89)[_0xd42b('0x19')]();};}function respondWithResult(_0x3ea620,_0x47be5f){_0x47be5f=_0x47be5f||0xc8;return function(_0x3ff780){if(_0x3ff780){return _0x3ea620[_0xd42b('0x18')](_0x47be5f)[_0xd42b('0x1a')](_0x3ff780);}};}function respondWithFilteredResult(_0x10f4a6,_0x5e1ada){return function(_0x56e590){if(_0x56e590){var _0x46ebad=_0x56e590['count'],_0x2fdf31=_0x5e1ada[_0xd42b('0x1b')],_0x20594e=_0x5e1ada[_0xd42b('0x1b')]+_0x5e1ada[_0xd42b('0x1c')],_0x11cfea;if(_0x20594e>=_0x46ebad){_0x20594e=_0x46ebad;_0x11cfea=0xc8;}else{_0x11cfea=0xce;}_0x10f4a6[_0xd42b('0x18')](_0x11cfea);return _0x10f4a6[_0xd42b('0x1d')](_0xd42b('0x1e'),_0x2fdf31+'-'+_0x20594e+'/'+_0x46ebad)[_0xd42b('0x1a')](_0x56e590);}return null;};}function patchUpdates(_0x3cb45f){return function(_0x3f15e8){try{jsonpatch[_0xd42b('0x1f')](_0x3f15e8,_0x3cb45f,!![]);}catch(_0x3e38ac){return BPromise[_0xd42b('0x20')](_0x3e38ac);}return _0x3f15e8[_0xd42b('0x21')]();};}function saveUpdates(_0x390d3b,_0x5d0a76){return function(_0x42b4cc){if(_0x42b4cc){return _0x42b4cc[_0xd42b('0x22')](_0x390d3b)['then'](function(_0x486f5b){return _0x486f5b;});}return null;};}function removeEntity(_0x232e85,_0x4387d2){return function(_0x297cd1){if(_0x297cd1){return _0x297cd1[_0xd42b('0x23')]()[_0xd42b('0x24')](function(){_0x232e85['status'](0xcc)[_0xd42b('0x19')]();});}};}function handleEntityNotFound(_0x456dc2,_0x10d027){return function(_0x44fecf){if(!_0x44fecf){_0x456dc2[_0xd42b('0x25')](0x194);}return _0x44fecf;};}function handleError(_0x2d1137,_0x121b00){_0x121b00=_0x121b00||0x1f4;return function(_0x47e885){logger[_0xd42b('0x26')](_0x47e885[_0xd42b('0x27')]);if(_0x47e885['name']){delete _0x47e885[_0xd42b('0x28')];}_0x2d1137[_0xd42b('0x18')](_0x121b00)[_0xd42b('0x29')](_0x47e885);};}exports[_0xd42b('0x2a')]=function(_0x21e4d4,_0x405ee0){var _0x3ea743={},_0x32c8a7={},_0x458b83={'count':0x0,'rows':[]};var _0x2417b5=_[_0xd42b('0x2b')](db['WhatsappTransferReport'][_0xd42b('0x2c')],function(_0x10a665){return{'name':_0x10a665[_0xd42b('0x2d')],'type':_0x10a665[_0xd42b('0x2e')][_0xd42b('0x2f')]};});_0x32c8a7[_0xd42b('0x30')]=_[_0xd42b('0x2b')](_0x2417b5,_0xd42b('0x28'));_0x32c8a7['query']=_[_0xd42b('0x31')](_0x21e4d4[_0xd42b('0x32')]);_0x32c8a7[_0xd42b('0x33')]=_[_0xd42b('0x34')](_0x32c8a7['model'],_0x32c8a7[_0xd42b('0x32')]);_0x3ea743[_0xd42b('0x35')]=_['intersection'](_0x32c8a7[_0xd42b('0x30')],qs[_0xd42b('0x36')](_0x21e4d4['query'][_0xd42b('0x36')]));_0x3ea743['attributes']=_0x3ea743['attributes'][_0xd42b('0x37')]?_0x3ea743[_0xd42b('0x35')]:_0x32c8a7[_0xd42b('0x30')];if(!_0x21e4d4[_0xd42b('0x32')][_0xd42b('0x38')](_0xd42b('0x39'))){_0x3ea743['limit']=qs[_0xd42b('0x1c')](_0x21e4d4[_0xd42b('0x32')]['limit']);_0x3ea743[_0xd42b('0x1b')]=qs['offset'](_0x21e4d4[_0xd42b('0x32')][_0xd42b('0x1b')]);}_0x3ea743[_0xd42b('0x3a')]=qs[_0xd42b('0x3b')](_0x21e4d4[_0xd42b('0x32')][_0xd42b('0x3b')]);_0x3ea743[_0xd42b('0x3c')]=qs[_0xd42b('0x33')](_['pick'](_0x21e4d4[_0xd42b('0x32')],_0x32c8a7['filters']),_0x2417b5);if(_0x21e4d4[_0xd42b('0x32')][_0xd42b('0x3d')]){_0x3ea743[_0xd42b('0x3c')]=_[_0xd42b('0x3e')](_0x3ea743[_0xd42b('0x3c')],{'$or':_['map'](_0x2417b5,function(_0xeb7a15){if(_0xeb7a15['type']!==_0xd42b('0x3f')){var _0x4b0ed9={};_0x4b0ed9[_0xeb7a15[_0xd42b('0x28')]]={'$like':'%'+_0x21e4d4[_0xd42b('0x32')][_0xd42b('0x3d')]+'%'};return _0x4b0ed9;}})});}_0x3ea743=_[_0xd42b('0x3e')]({},_0x3ea743,_0x21e4d4['options']);var _0x25fa24={'where':_0x3ea743[_0xd42b('0x3c')]};return db[_0xd42b('0x40')]['count'](_0x25fa24)[_0xd42b('0x24')](function(_0x4a424e){_0x458b83[_0xd42b('0x41')]=_0x4a424e;if(_0x21e4d4[_0xd42b('0x32')][_0xd42b('0x42')]){_0x3ea743[_0xd42b('0x43')]=[{'all':!![]}];}return db[_0xd42b('0x40')][_0xd42b('0x44')](_0x3ea743);})[_0xd42b('0x24')](function(_0x24968c){_0x458b83[_0xd42b('0x45')]=_0x24968c;return _0x458b83;})[_0xd42b('0x24')](respondWithFilteredResult(_0x405ee0,_0x3ea743))[_0xd42b('0x46')](handleError(_0x405ee0,null));};exports[_0xd42b('0x47')]=function(_0x49c0e7,_0x16a9ce){var _0x18f617={'raw':!![],'where':{'id':_0x49c0e7['params']['id']}},_0xfbf234={};_0xfbf234['model']=_[_0xd42b('0x31')](db[_0xd42b('0x40')][_0xd42b('0x2c')]);_0xfbf234['query']=_[_0xd42b('0x31')](_0x49c0e7[_0xd42b('0x32')]);_0xfbf234['filters']=_[_0xd42b('0x34')](_0xfbf234['model'],_0xfbf234['query']);_0x18f617[_0xd42b('0x35')]=_[_0xd42b('0x34')](_0xfbf234[_0xd42b('0x30')],qs[_0xd42b('0x36')](_0x49c0e7['query'][_0xd42b('0x36')]));_0x18f617[_0xd42b('0x35')]=_0x18f617[_0xd42b('0x35')]['length']?_0x18f617[_0xd42b('0x35')]:_0xfbf234[_0xd42b('0x30')];if(_0x49c0e7[_0xd42b('0x32')][_0xd42b('0x42')]){_0x18f617[_0xd42b('0x43')]=[{'all':!![]}];}_0x18f617=_[_0xd42b('0x3e')]({},_0x18f617,_0x49c0e7[_0xd42b('0x48')]);return db[_0xd42b('0x40')]['find'](_0x18f617)[_0xd42b('0x24')](handleEntityNotFound(_0x16a9ce,null))[_0xd42b('0x24')](respondWithResult(_0x16a9ce,null))[_0xd42b('0x46')](handleError(_0x16a9ce,null));};exports[_0xd42b('0x49')]=function(_0x2e908b,_0x203c56){return db[_0xd42b('0x40')][_0xd42b('0x49')](_0x2e908b['body'],{})['then'](respondWithResult(_0x203c56,0xc9))[_0xd42b('0x46')](handleError(_0x203c56,null));};exports[_0xd42b('0x22')]=function(_0x4b595d,_0x218741){if(_0x4b595d[_0xd42b('0x4a')]['id']){delete _0x4b595d[_0xd42b('0x4a')]['id'];}return db[_0xd42b('0x40')][_0xd42b('0x4b')]({'where':{'id':_0x4b595d[_0xd42b('0x4c')]['id']}})[_0xd42b('0x24')](handleEntityNotFound(_0x218741,null))['then'](saveUpdates(_0x4b595d[_0xd42b('0x4a')],null))[_0xd42b('0x24')](respondWithResult(_0x218741,null))[_0xd42b('0x46')](handleError(_0x218741,null));};exports[_0xd42b('0x23')]=function(_0x55da7b,_0x2b89d6){return db[_0xd42b('0x40')][_0xd42b('0x4b')]({'where':{'id':_0x55da7b[_0xd42b('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2b89d6,null))['then'](removeEntity(_0x2b89d6,null))[_0xd42b('0x46')](handleError(_0x2b89d6,null));};exports[_0xd42b('0x4d')]=function(_0x25b67f,_0x1f2e1c){return db['WhatsappTransferReport']['describe']()[_0xd42b('0x24')](respondWithResult(_0x1f2e1c,null))[_0xd42b('0x46')](handleError(_0x1f2e1c,null));}; \ No newline at end of file +var _0x5840=['sox','ejs','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','limit','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','WhatsappTransferReport','rawAttributes','fieldName','query','intersection','model','fields','attributes','length','nolimit','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','keys','options','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x5840,0x111));var _0x0584=function(_0x43feff,_0x22901a){_0x43feff=_0x43feff-0x0;var _0x35f5b5=_0x5840[_0x43feff];return _0x35f5b5;};'use strict';var pdf=require(_0x0584('0x0'));var emlformat=require(_0x0584('0x1'));var rimraf=require(_0x0584('0x2'));var zipdir=require(_0x0584('0x3'));var jsonpatch=require(_0x0584('0x4'));var rp=require(_0x0584('0x5'));var moment=require(_0x0584('0x6'));var BPromise=require(_0x0584('0x7'));var Mustache=require(_0x0584('0x8'));var util=require(_0x0584('0x9'));var path=require(_0x0584('0xa'));var sox=require(_0x0584('0xb'));var csv=require('to-csv');var ejs=require(_0x0584('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0584('0xd'));var crypto=require('crypto');var jsforce=require(_0x0584('0xe'));var deskjs=require(_0x0584('0xf'));var toCsv=require(_0x0584('0x10'));var querystring=require('querystring');var Papa=require(_0x0584('0x11'));var Redis=require(_0x0584('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0584('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0584('0x14'))(_0x0584('0x15'));var utils=require(_0x0584('0x16'));var config=require(_0x0584('0x17'));var db=require(_0x0584('0x18'))['db'];function respondWithStatusCode(_0x22b3e0,_0x22a8a5){_0x22a8a5=_0x22a8a5||0xcc;return function(_0x5d9f74){if(_0x5d9f74){return _0x22b3e0['sendStatus'](_0x22a8a5);}return _0x22b3e0['status'](_0x22a8a5)[_0x0584('0x19')]();};}function respondWithResult(_0x1aef52,_0x2468c3){_0x2468c3=_0x2468c3||0xc8;return function(_0x45de33){if(_0x45de33){return _0x1aef52[_0x0584('0x1a')](_0x2468c3)[_0x0584('0x1b')](_0x45de33);}};}function respondWithFilteredResult(_0x49c7a8,_0x2b9ee5){return function(_0x1dcc51){if(_0x1dcc51){var _0x39da91=_0x1dcc51[_0x0584('0x1c')],_0x32b33e=_0x2b9ee5[_0x0584('0x1d')],_0x21391c=_0x2b9ee5[_0x0584('0x1d')]+_0x2b9ee5[_0x0584('0x1e')],_0x12d357;if(_0x21391c>=_0x39da91){_0x21391c=_0x39da91;_0x12d357=0xc8;}else{_0x12d357=0xce;}_0x49c7a8[_0x0584('0x1a')](_0x12d357);return _0x49c7a8['set']('Content-Range',_0x32b33e+'-'+_0x21391c+'/'+_0x39da91)[_0x0584('0x1b')](_0x1dcc51);}return null;};}function patchUpdates(_0x3b258d){return function(_0x4c2452){try{jsonpatch['apply'](_0x4c2452,_0x3b258d,!![]);}catch(_0x12eaae){return BPromise[_0x0584('0x1f')](_0x12eaae);}return _0x4c2452[_0x0584('0x20')]();};}function saveUpdates(_0x34315b,_0x24049e){return function(_0x1d568e){if(_0x1d568e){return _0x1d568e[_0x0584('0x21')](_0x34315b)[_0x0584('0x22')](function(_0x22cd5c){return _0x22cd5c;});}return null;};}function removeEntity(_0x24470b,_0x26c315){return function(_0x159513){if(_0x159513){return _0x159513[_0x0584('0x23')]()['then'](function(){_0x24470b[_0x0584('0x1a')](0xcc)[_0x0584('0x19')]();});}};}function handleEntityNotFound(_0x39191d,_0x470c30){return function(_0xdc80f0){if(!_0xdc80f0){_0x39191d[_0x0584('0x24')](0x194);}return _0xdc80f0;};}function handleError(_0x4be419,_0x30971b){_0x30971b=_0x30971b||0x1f4;return function(_0x22d589){logger[_0x0584('0x25')](_0x22d589[_0x0584('0x26')]);if(_0x22d589[_0x0584('0x27')]){delete _0x22d589[_0x0584('0x27')];}_0x4be419[_0x0584('0x1a')](_0x30971b)['send'](_0x22d589);};}exports[_0x0584('0x28')]=function(_0x1e5380,_0x32443a){var _0xd16745={},_0x5d6a2d={},_0xa253a5={'count':0x0,'rows':[]};var _0x2535ba=_[_0x0584('0x29')](db[_0x0584('0x2a')][_0x0584('0x2b')],function(_0x2f6792){return{'name':_0x2f6792[_0x0584('0x2c')],'type':_0x2f6792['type']['key']};});_0x5d6a2d['model']=_[_0x0584('0x29')](_0x2535ba,_0x0584('0x27'));_0x5d6a2d['query']=_['keys'](_0x1e5380[_0x0584('0x2d')]);_0x5d6a2d['filters']=_[_0x0584('0x2e')](_0x5d6a2d[_0x0584('0x2f')],_0x5d6a2d[_0x0584('0x2d')]);_0xd16745['attributes']=_[_0x0584('0x2e')](_0x5d6a2d[_0x0584('0x2f')],qs[_0x0584('0x30')](_0x1e5380['query'][_0x0584('0x30')]));_0xd16745[_0x0584('0x31')]=_0xd16745[_0x0584('0x31')][_0x0584('0x32')]?_0xd16745['attributes']:_0x5d6a2d[_0x0584('0x2f')];if(!_0x1e5380[_0x0584('0x2d')]['hasOwnProperty'](_0x0584('0x33'))){_0xd16745[_0x0584('0x1e')]=qs['limit'](_0x1e5380['query']['limit']);_0xd16745[_0x0584('0x1d')]=qs[_0x0584('0x1d')](_0x1e5380[_0x0584('0x2d')][_0x0584('0x1d')]);}_0xd16745['order']=qs['sort'](_0x1e5380[_0x0584('0x2d')]['sort']);_0xd16745[_0x0584('0x34')]=qs[_0x0584('0x35')](_[_0x0584('0x36')](_0x1e5380[_0x0584('0x2d')],_0x5d6a2d[_0x0584('0x35')]),_0x2535ba);if(_0x1e5380[_0x0584('0x2d')][_0x0584('0x37')]){_0xd16745[_0x0584('0x34')]=_[_0x0584('0x38')](_0xd16745[_0x0584('0x34')],{'$or':_[_0x0584('0x29')](_0x2535ba,function(_0x3d24d3){if(_0x3d24d3[_0x0584('0x39')]!==_0x0584('0x3a')){var _0x3fcfe7={};_0x3fcfe7[_0x3d24d3[_0x0584('0x27')]]={'$like':'%'+_0x1e5380['query'][_0x0584('0x37')]+'%'};return _0x3fcfe7;}})});}_0xd16745=_['merge']({},_0xd16745,_0x1e5380['options']);var _0x1ad210={'where':_0xd16745[_0x0584('0x34')]};return db['WhatsappTransferReport'][_0x0584('0x1c')](_0x1ad210)[_0x0584('0x22')](function(_0x1f5d8f){_0xa253a5['count']=_0x1f5d8f;if(_0x1e5380['query'][_0x0584('0x3b')]){_0xd16745[_0x0584('0x3c')]=[{'all':!![]}];}return db[_0x0584('0x2a')][_0x0584('0x3d')](_0xd16745);})[_0x0584('0x22')](function(_0x535403){_0xa253a5[_0x0584('0x3e')]=_0x535403;return _0xa253a5;})[_0x0584('0x22')](respondWithFilteredResult(_0x32443a,_0xd16745))[_0x0584('0x3f')](handleError(_0x32443a,null));};exports['show']=function(_0x50d249,_0x2c7483){var _0x20c12f={'raw':!![],'where':{'id':_0x50d249['params']['id']}},_0x400c03={};_0x400c03['model']=_[_0x0584('0x40')](db[_0x0584('0x2a')][_0x0584('0x2b')]);_0x400c03['query']=_['keys'](_0x50d249[_0x0584('0x2d')]);_0x400c03['filters']=_[_0x0584('0x2e')](_0x400c03['model'],_0x400c03[_0x0584('0x2d')]);_0x20c12f[_0x0584('0x31')]=_['intersection'](_0x400c03[_0x0584('0x2f')],qs[_0x0584('0x30')](_0x50d249[_0x0584('0x2d')][_0x0584('0x30')]));_0x20c12f[_0x0584('0x31')]=_0x20c12f['attributes']['length']?_0x20c12f[_0x0584('0x31')]:_0x400c03[_0x0584('0x2f')];if(_0x50d249[_0x0584('0x2d')][_0x0584('0x3b')]){_0x20c12f[_0x0584('0x3c')]=[{'all':!![]}];}_0x20c12f=_[_0x0584('0x38')]({},_0x20c12f,_0x50d249[_0x0584('0x41')]);return db[_0x0584('0x2a')][_0x0584('0x42')](_0x20c12f)[_0x0584('0x22')](handleEntityNotFound(_0x2c7483,null))[_0x0584('0x22')](respondWithResult(_0x2c7483,null))[_0x0584('0x3f')](handleError(_0x2c7483,null));};exports[_0x0584('0x43')]=function(_0x5c09e3,_0x4ec182){return db[_0x0584('0x2a')][_0x0584('0x43')](_0x5c09e3[_0x0584('0x44')],{})[_0x0584('0x22')](respondWithResult(_0x4ec182,0xc9))[_0x0584('0x3f')](handleError(_0x4ec182,null));};exports[_0x0584('0x21')]=function(_0x34aff9,_0x894d08){if(_0x34aff9[_0x0584('0x44')]['id']){delete _0x34aff9[_0x0584('0x44')]['id'];}return db['WhatsappTransferReport'][_0x0584('0x42')]({'where':{'id':_0x34aff9[_0x0584('0x45')]['id']}})[_0x0584('0x22')](handleEntityNotFound(_0x894d08,null))['then'](saveUpdates(_0x34aff9['body'],null))['then'](respondWithResult(_0x894d08,null))[_0x0584('0x3f')](handleError(_0x894d08,null));};exports['destroy']=function(_0x74e31e,_0x4d93df){return db[_0x0584('0x2a')]['find']({'where':{'id':_0x74e31e[_0x0584('0x45')]['id']}})[_0x0584('0x22')](handleEntityNotFound(_0x4d93df,null))[_0x0584('0x22')](removeEntity(_0x4d93df,null))['catch'](handleError(_0x4d93df,null));};exports['describe']=function(_0x26b6c1,_0xb60e5b){return db[_0x0584('0x2a')][_0x0584('0x46')]()['then'](respondWithResult(_0xb60e5b,null))[_0x0584('0x3f')](handleError(_0xb60e5b,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 088e7c0..f5c9cad 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 _0xca05=['bluebird','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xca05,0x141));var _0x5ca0=function(_0x4ddc7e,_0xcb9b8){_0x4ddc7e=_0x4ddc7e-0x0;var _0xfbf0ec=_0xca05[_0x4ddc7e];return _0xfbf0ec;};'use strict';var _=require(_0x5ca0('0x0'));var util=require(_0x5ca0('0x1'));var logger=require(_0x5ca0('0x2'))(_0x5ca0('0x3'));var moment=require('moment');var BPromise=require(_0x5ca0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5ca0('0x5'));var rimraf=require(_0x5ca0('0x6'));var config=require(_0x5ca0('0x7'));var attributes=require(_0x5ca0('0x8'));module[_0x5ca0('0x9')]=function(_0x19f4f8,_0x2c86eb){return _0x19f4f8['define'](_0x5ca0('0xa'),attributes,{'tableName':_0x5ca0('0xb'),'paranoid':![],'indexes':[{'name':_0x5ca0('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9477=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','WhatsappTransferReport','uniqueid','lodash','util','../../config/logger'];(function(_0x534c1e,_0x249ea6){var _0x2e3899=function(_0x2886bf){while(--_0x2886bf){_0x534c1e['push'](_0x534c1e['shift']());}};_0x2e3899(++_0x249ea6);}(_0x9477,0x1bd));var _0x7947=function(_0x9e17c6,_0x2ec7ba){_0x9e17c6=_0x9e17c6-0x0;var _0x4fee6b=_0x9477[_0x9e17c6];return _0x4fee6b;};'use strict';var _=require(_0x7947('0x0'));var util=require(_0x7947('0x1'));var logger=require(_0x7947('0x2'))(_0x7947('0x3'));var moment=require(_0x7947('0x4'));var BPromise=require(_0x7947('0x5'));var rp=require(_0x7947('0x6'));var fs=require('fs');var path=require(_0x7947('0x7'));var rimraf=require(_0x7947('0x8'));var config=require(_0x7947('0x9'));var attributes=require(_0x7947('0xa'));module[_0x7947('0xb')]=function(_0x492db3,_0x33c127){return _0x492db3['define'](_0x7947('0xc'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x7947('0xd'),'fields':[_0x7947('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 150ebd3..aeeadcf 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(_0x4004a0,_0x20a63f){var _0x417fe3=function(_0xa214a7){while(--_0xa214a7){_0x4004a0['push'](_0x4004a0['shift']());}};_0x417fe3(++_0x20a63f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','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(_0x3199cd,_0x49aa09){var _0x1a98c0=function(_0x5714b2){while(--_0x5714b2){_0x3199cd['push'](_0x3199cd['shift']());}};_0x1a98c0(++_0x49aa09);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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 8b56228..5a8c548 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe94c=['seedDB','./config/seedDB','default','catch','error','exit','./mysqldb','./config/environment','./config/logger','app','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','sequelize','then','info','start','Online\x20apps:','map','online','join','Offline\x20apps:','filter','status','name','None'];(function(_0x4a9193,_0x5ea9a4){var _0x160be2=function(_0x36cb59){while(--_0x36cb59){_0x4a9193['push'](_0x4a9193['shift']());}};_0x160be2(++_0x5ea9a4);}(_0xe94c,0x1d1));var _0xce94=function(_0xf623b8,_0xd00397){_0xf623b8=_0xf623b8-0x0;var _0x852f78=_0xe94c[_0xf623b8];return _0x852f78;};'use strict';var _=require('lodash');var mysqldb=require(_0xce94('0x0'));var rpc=require('./rpc');var config=require(_0xce94('0x1'));var logger=require(_0xce94('0x2'))(_0xce94('0x3'));var pm2=require(_0xce94('0x4'));var pm2Config=require('./config/pm2/config');var schedule=require(_0xce94('0x5'));var chat=require(_0xce94('0x6'));var transcribe=require(_0xce94('0x7'));function main(){return mysqldb['db'][_0xce94('0x8')]['sync']()[_0xce94('0x9')](function(){return rpc['listen']();})[_0xce94('0x9')](function(_0x2b54f1){logger[_0xce94('0xa')](_0x2b54f1);return chat[_0xce94('0xb')]();})[_0xce94('0x9')](function(){return schedule[_0xce94('0xb')]();})[_0xce94('0x9')](function(){return transcribe[_0xce94('0xb')]();})['then'](function(_0x997360){logger['info'](_0x997360);return pm2[_0xce94('0xb')](pm2Config);})[_0xce94('0x9')](function(_0x4376dc){logger[_0xce94('0xa')](_0xce94('0xc'),_[_0xce94('0xd')](_['filter'](_0x4376dc,{'status':_0xce94('0xe')}),'name')[_0xce94('0xf')]());logger['info'](_0xce94('0x10'),_['map'](_[_0xce94('0x11')](_0x4376dc,function(_0x1c50e5){return _0x1c50e5[_0xce94('0x12')]!=='online';}),_0xce94('0x13'))[_0xce94('0xf')]()||_0xce94('0x14'));config[_0xce94('0x15')]&&require(_0xce94('0x16'))[_0xce94('0x17')]();require('./config/license')[_0xce94('0x17')]();})[_0xce94('0x18')](function(_0x52a1df){logger[_0xce94('0x19')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x52a1df);process[_0xce94('0x1a')](0x1);});}main(); \ No newline at end of file +var _0xee2c=['catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./config/environment','./config/logger','app','./config/pm2/config','./config/schedule','sync','then','listen','info','start','Online\x20apps:','map','online','join','filter','status','name','None','seedDB','./config/seedDB','default','./config/license'];(function(_0x9db884,_0x5ba530){var _0x458d7f=function(_0x1336ca){while(--_0x1336ca){_0x9db884['push'](_0x9db884['shift']());}};_0x458d7f(++_0x5ba530);}(_0xee2c,0xf7));var _0xcee2=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0xee2c[_0x2aec52];return _0x3b8835;};'use strict';var _=require('lodash');var mysqldb=require(_0xcee2('0x0'));var rpc=require('./rpc');var config=require(_0xcee2('0x1'));var logger=require(_0xcee2('0x2'))(_0xcee2('0x3'));var pm2=require('./config/pm2');var pm2Config=require(_0xcee2('0x4'));var schedule=require(_0xcee2('0x5'));var chat=require('./config/schedule/chat');var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db']['sequelize'][_0xcee2('0x6')]()[_0xcee2('0x7')](function(){return rpc[_0xcee2('0x8')]();})[_0xcee2('0x7')](function(_0xede732){logger[_0xcee2('0x9')](_0xede732);return chat[_0xcee2('0xa')]();})[_0xcee2('0x7')](function(){return schedule[_0xcee2('0xa')]();})[_0xcee2('0x7')](function(){return transcribe[_0xcee2('0xa')]();})[_0xcee2('0x7')](function(_0x1ebed3){logger[_0xcee2('0x9')](_0x1ebed3);return pm2['start'](pm2Config);})[_0xcee2('0x7')](function(_0x337b98){logger['info'](_0xcee2('0xb'),_[_0xcee2('0xc')](_['filter'](_0x337b98,{'status':_0xcee2('0xd')}),'name')[_0xcee2('0xe')]());logger['info']('Offline\x20apps:',_[_0xcee2('0xc')](_[_0xcee2('0xf')](_0x337b98,function(_0x1eb1aa){return _0x1eb1aa[_0xcee2('0x10')]!=='online';}),_0xcee2('0x11'))[_0xcee2('0xe')]()||_0xcee2('0x12'));config[_0xcee2('0x13')]&&require(_0xcee2('0x14'))[_0xcee2('0x15')]();require(_0xcee2('0x16'))[_0xcee2('0x15')]();})[_0xcee2('0x17')](function(_0x4d6f7f){logger[_0xcee2('0x18')](_0xcee2('0x19'),_0x4d6f7f);process[_0xcee2('0x1a')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 41a321e..a5dcf3e 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 _0x66c8=['closed','unmanaged','json','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','Basic','User','authenticate','pass','status','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','find','sub','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','use','User\x20not\x20found.','canUpdate','../../config/license/util','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','motion.token','redirect','/dashboards/general','send','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','promisify','sign','secret','options','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','jsonwebtoken','composable-middleware','basic-auth','crypto','bluebird','secrets','session','role','fullname','name','internal','userpic','md5secret','mailPause','faxPause','smsPause','openchannelPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','isChatInteractionAuthorized','isAuthenticated','user','ChatInteraction','findOne','params','disposition','then'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x66c8,0x9d));var _0x866c=function(_0x3a6308,_0x16650c){_0x3a6308=_0x3a6308-0x0;var _0x18e3f0=_0x66c8[_0x3a6308];return _0x18e3f0;};'use strict';var db=require(_0x866c('0x0'))['db'];var config=require(_0x866c('0x1'));var hardwareConf=require('../../config/license/hardware');var _=require('lodash');var jwt=require(_0x866c('0x2'));var expressJwt=require('express-jwt');var compose=require(_0x866c('0x3'));var basicAuth=require(_0x866c('0x4'));var crypto=require(_0x866c('0x5'));var BPromise=require(_0x866c('0x6'));var validateJwt=expressJwt({'secret':config[_0x866c('0x7')][_0x866c('0x8')]});var userAttributes=['id',_0x866c('0x9'),_0x866c('0xa'),_0x866c('0xb'),_0x866c('0xc'),'email',_0x866c('0xd'),'permissions',_0x866c('0xe'),'voicePause','chatPause',_0x866c('0xf'),_0x866c('0x10'),_0x866c('0x11'),_0x866c('0x12'),'pauseType',_0x866c('0x13'),_0x866c('0x14'),_0x866c('0x15'),_0x866c('0x16'),_0x866c('0x17'),_0x866c('0x18'),_0x866c('0x19'),_0x866c('0x1a'),_0x866c('0x1b'),_0x866c('0x1c'),_0x866c('0x1d'),'phoneBarEnableDtmfTone',_0x866c('0x1e'),_0x866c('0x1f'),_0x866c('0x20'),'phoneBarRemoteControl',_0x866c('0x21'),_0x866c('0x22'),_0x866c('0x23'),_0x866c('0x24')];exports[_0x866c('0x25')]=function(){return this[_0x866c('0x26')](!![])['use'](function(_0x1cdf88,_0x5c4c27,_0x375d15){if(_0x1cdf88[_0x866c('0x27')]){_0x375d15();}else{return db[_0x866c('0x28')][_0x866c('0x29')]({'where':{'id':_0x1cdf88[_0x866c('0x2a')]['id']},'attributes':['id','closed',_0x866c('0x2b')],'raw':!![]})[_0x866c('0x2c')](function(_0x3aa516){if(_0x3aa516&&_0x3aa516[_0x866c('0x2d')]){return _0x5c4c27['status'](_0x3aa516[_0x866c('0x2b')]===_0x866c('0x2e')?0x195:0x193)[_0x866c('0x2f')]({'message':_0x3aa516[_0x866c('0x2b')]==='unmanaged'?_0x866c('0x30'):_0x866c('0x31')});}else{_0x375d15();}})[_0x866c('0x32')](function(_0x4f3f08){_0x375d15(_0x4f3f08);});}});};exports[_0x866c('0x26')]=function isAuthenticated(_0x30bfc2){return compose()['use'](function(_0x246995,_0x1728a6,_0x4baa05){if(_0x246995[_0x866c('0x33')][_0x866c('0x34')]){if(_[_0x866c('0x35')](_0x246995[_0x866c('0x33')][_0x866c('0x34')],_0x866c('0x36'))){var _0x59b8e3=basicAuth(_0x246995);db[_0x866c('0x37')]['find']({'where':{'name':_0x59b8e3[_0x866c('0xb')]}})['then'](function(_0x93b4d1){if(!_0x93b4d1||!_0x93b4d1[_0x866c('0x38')](_0x59b8e3[_0x866c('0x39')])){return _0x1728a6[_0x866c('0x3a')](0x191)[_0x866c('0x2f')]({'message':_0x866c('0x3b')});}_0x246995[_0x866c('0x27')]={'id':_0x93b4d1['id']};_0x4baa05();})['catch'](function(_0x20b896){_0x4baa05(_0x20b896);});}else if(_['startsWith'](_0x246995[_0x866c('0x33')]['authorization'],_0x866c('0x3c'))){validateJwt(_0x246995,_0x1728a6,_0x4baa05);}else{if(_0x30bfc2){_0x4baa05();}else{return _0x1728a6[_0x866c('0x3a')](0x193)[_0x866c('0x2f')]({'message':_0x866c('0x3d')});}}}else if(_0x246995[_0x866c('0x3e')][_0x866c('0x3f')]){try{var _0x4fbfd7={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x866c('0x40')]()};verifyJwt(_0x246995['query'][_0x866c('0x3f')],_0x4fbfd7)['then'](function(_0x145da3){return db[_0x866c('0x37')][_0x866c('0x41')]({'where':{'id':_0x145da3[_0x866c('0x42')]}})[_0x866c('0x2c')](function(_0x4d1a34){if(!_0x4d1a34||!_[_0x866c('0x43')](_0x4d1a34[_0x866c('0x44')],_0x145da3['nonce'])){return _0x1728a6[_0x866c('0x3a')](0x191)[_0x866c('0x2f')]({'message':_0x866c('0x45')});}_0x246995[_0x866c('0x27')]={'id':_0x4d1a34['id']};_0x4baa05();});})[_0x866c('0x32')](function(){return _0x1728a6[_0x866c('0x3a')](0x191)['json']({'message':_0x866c('0x46')});});}catch(_0x3aab71){_0x4baa05(_0x3aab71);}}else if(_0x30bfc2){_0x4baa05();}else{return _0x1728a6[_0x866c('0x3a')](0x193)[_0x866c('0x2f')]({'message':_0x866c('0x3d')});}})[_0x866c('0x47')](function(_0x2d3446,_0x4b7863,_0xbcedc5){if(_0x2d3446[_0x866c('0x27')]){db[_0x866c('0x37')][_0x866c('0x41')]({'where':{'id':_0x2d3446[_0x866c('0x27')]['id']},'attributes':userAttributes})[_0x866c('0x2c')](function(_0x3b963c){if(!_0x3b963c){return _0x4b7863['status'](0x194)[_0x866c('0x2f')]({'message':_0x866c('0x48')});}_0x2d3446[_0x866c('0x27')]=_0x3b963c;_0xbcedc5();})[_0x866c('0x32')](function(_0x2d68d8){_0xbcedc5(_0x2d68d8);});}else if(_0x30bfc2){_0xbcedc5();}else{return _0x4b7863[_0x866c('0x3a')](0x194)['json']({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x866c('0x49')]=function canUpdate(){return compose()['use'](function(_0x2fa701,_0x10e401,_0x184d9d){return require(_0x866c('0x4a'))[_0x866c('0x4b')]()['then'](function(_0x30460b){if(_0x30460b[_0x866c('0x4c')]){_0x184d9d();}else{return _0x10e401[_0x866c('0x3a')](0x193)['json']({'message':_0x866c('0x4d')});}})[_0x866c('0x32')](function(_0xb86e84){_0x184d9d(_0xb86e84);});});};exports[_0x866c('0x4e')]=function(_0x3fd4ff,_0x376f52,_0x144a0a){_0x3fd4ff['isMiddleware']=!![];return _0x144a0a();};exports[_0x866c('0x4f')]=function signToken(_0x29f29e){return signJwt(_0x29f29e);};exports[_0x866c('0x50')]=function(_0x4b1677,_0x3a84be){if(!_0x4b1677[_0x866c('0x27')]){return _0x3a84be[_0x866c('0x3a')](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x32d205={'payload':{'id':_0x4b1677['user']['id'],'role':_0x4b1677[_0x866c('0x27')][_0x866c('0x9')]},'options':{'expiresIn':0x15180}};return signJwt(_0x32d205)[_0x866c('0x2c')](function(_0x4e04a6){_0x3a84be['cookie'](_0x866c('0x51'),_0x4e04a6);_0x3a84be[_0x866c('0x52')](_0x866c('0x53'));})[_0x866c('0x32')](function(_0x4c19d0){return _0x3a84be[_0x866c('0x3a')](0x1f4)[_0x866c('0x54')](_0x4c19d0);});};exports['retrieveApiKey']=function(_0x241e63){if(_[_0x866c('0x55')](_0x241e63['apiKeyNonce'])||_[_0x866c('0x55')](_0x241e63[_0x866c('0x56')])){return null;}else{return createJwt(_0x241e63);}};exports[_0x866c('0x57')]=function(_0x3ab01b){_0x3ab01b[_0x866c('0x44')]=generateNonce();_0x3ab01b[_0x866c('0x56')]=generateIssuedAt();return createJwt(_0x3ab01b);};exports[_0x866c('0x58')]=function(_0x931043,_0x126bd7){var _0x69523e=_0x931043[_0x866c('0x3e')][_0x866c('0x3f')];if(_0x69523e){var _0x364117={'nonce':_0x126bd7[_0x866c('0x44')],'iat':_0x126bd7[_0x866c('0x56')],'audience':hardwareConf[_0x866c('0x40')](),'issuer':hardwareConf[_0x866c('0x40')]()};return verifyJwt(_0x69523e,_0x364117)[_0x866c('0x2c')](function(){return generateApiKey(_0x126bd7);});}else{throw{'message':_0x866c('0x59')};}};function signJwt(_0x220f18){var _0x4107dc=BPromise[_0x866c('0x5a')](jwt[_0x866c('0x5b')],{'context':jwt});var _0x1c006d=_0x220f18[_0x866c('0x5c')]||config[_0x866c('0x7')]['session'];return new BPromise(function(_0x42c99b,_0xfe7113){_0x4107dc(_0x220f18['payload'],_0x1c006d,_0x220f18[_0x866c('0x5d')])[_0x866c('0x2c')](function(_0x2deafd){_0x42c99b(_0x2deafd);})[_0x866c('0x32')](function(_0x458f97){_0xfe7113(_0x458f97);});});}function verifyJwt(_0x52a849,_0x4076c8,_0x7845b1){var _0x158a81=BPromise['promisify'](jwt[_0x866c('0x5e')],{'context':jwt});var _0x124a97=_0x7845b1||config[_0x866c('0x7')][_0x866c('0x8')];return new BPromise(function(_0x43ab3a,_0x5d0edb){_0x158a81(_0x52a849,_0x124a97,_0x4076c8)[_0x866c('0x2c')](function(_0x321501){_0x43ab3a(_0x321501);})[_0x866c('0x32')](function(_0x3e6f3a){_0x5d0edb(_0x3e6f3a);});});}function generateNonce(){return crypto[_0x866c('0x5f')](0x10)[_0x866c('0x60')](_0x866c('0x61'));}function generateIssuedAt(){return Math[_0x866c('0x62')](Date[_0x866c('0x63')]()/0x3e8)['toString']();}function createJwt(_0x2adcd3){var _0x2d0eaf={'payload':{'iat':_0x2adcd3[_0x866c('0x56')],'nonce':_0x2adcd3[_0x866c('0x44')]},'options':{'algorithm':_0x866c('0x64'),'subject':_0x2adcd3['id'][_0x866c('0x60')](),'issuer':hardwareConf[_0x866c('0x40')](),'audience':hardwareConf[_0x866c('0x40')]()}};return signJwt(_0x2d0eaf)['then'](function(_0x29517c){return{'iat':_0x2adcd3['apiKeyIat'],'nonce':_0x2adcd3['apiKeyNonce'],'token':_0x29517c};});} \ No newline at end of file +var _0xfc9c=['phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk','interface','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','then','status','unmanaged','json','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','User','find','authenticate','Wrong\x20credentials.','Unknown\x20authorization\x20format','query','getUuid','apikey','sub','isEqual','apiKeyNonce','nonce','Invalid\x20API\x20access\x20key','User\x20object\x20not\x20found.','canUpdate','../../config/license/util','getLicense','update','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','promisify','payload','verify','randomBytes','toString','hex','now','HS512','../../config/environment','../../config/license/hardware','lodash','express-jwt','composable-middleware','basic-auth','bluebird','secrets','session','role','fullname','name','internal','email','permissions','md5secret','chatPause','mailPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay'];(function(_0x4b3092,_0x4835ac){var _0x4a8e70=function(_0x1a6263){while(--_0x1a6263){_0x4b3092['push'](_0x4b3092['shift']());}};_0x4a8e70(++_0x4835ac);}(_0xfc9c,0x1a7));var _0xcfc9=function(_0x4b6cd0,_0x229951){_0x4b6cd0=_0x4b6cd0-0x0;var _0x304b18=_0xfc9c[_0x4b6cd0];return _0x304b18;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0xcfc9('0x0'));var hardwareConf=require(_0xcfc9('0x1'));var _=require(_0xcfc9('0x2'));var jwt=require('jsonwebtoken');var expressJwt=require(_0xcfc9('0x3'));var compose=require(_0xcfc9('0x4'));var basicAuth=require(_0xcfc9('0x5'));var crypto=require('crypto');var BPromise=require(_0xcfc9('0x6'));var validateJwt=expressJwt({'secret':config[_0xcfc9('0x7')][_0xcfc9('0x8')]});var userAttributes=['id',_0xcfc9('0x9'),_0xcfc9('0xa'),_0xcfc9('0xb'),_0xcfc9('0xc'),_0xcfc9('0xd'),'userpic',_0xcfc9('0xe'),_0xcfc9('0xf'),'voicePause',_0xcfc9('0x10'),_0xcfc9('0x11'),'faxPause','smsPause',_0xcfc9('0x12'),_0xcfc9('0x13'),_0xcfc9('0x14'),_0xcfc9('0x15'),_0xcfc9('0x16'),_0xcfc9('0x17'),'allowmessenger',_0xcfc9('0x18'),'alias',_0xcfc9('0x19'),_0xcfc9('0x1a'),_0xcfc9('0x1b'),_0xcfc9('0x1c'),_0xcfc9('0x1d'),'phoneBarEnableSettings','phoneBarExpires',_0xcfc9('0x1e'),_0xcfc9('0x1f'),'phoneBarRemoteControlPort',_0xcfc9('0x20'),_0xcfc9('0x21'),'userProfileId'];exports[_0xcfc9('0x22')]=function(){return this[_0xcfc9('0x23')](!![])[_0xcfc9('0x24')](function(_0x4206c0,_0x3596a4,_0x198bf1){if(_0x4206c0[_0xcfc9('0x25')]){_0x198bf1();}else{return db[_0xcfc9('0x26')][_0xcfc9('0x27')]({'where':{'id':_0x4206c0[_0xcfc9('0x28')]['id']},'attributes':['id',_0xcfc9('0x29'),_0xcfc9('0x2a')],'raw':!![]})[_0xcfc9('0x2b')](function(_0x383dfe){if(_0x383dfe&&_0x383dfe[_0xcfc9('0x29')]){return _0x3596a4[_0xcfc9('0x2c')](_0x383dfe[_0xcfc9('0x2a')]===_0xcfc9('0x2d')?0x195:0x193)[_0xcfc9('0x2e')]({'message':_0x383dfe[_0xcfc9('0x2a')]===_0xcfc9('0x2d')?_0xcfc9('0x2f'):_0xcfc9('0x30')});}else{_0x198bf1();}})[_0xcfc9('0x31')](function(_0x926966){_0x198bf1(_0x926966);});}});};exports[_0xcfc9('0x23')]=function isAuthenticated(_0x843c18){return compose()[_0xcfc9('0x24')](function(_0x6047b,_0x1c29cf,_0x5837cc){if(_0x6047b[_0xcfc9('0x32')][_0xcfc9('0x33')]){if(_[_0xcfc9('0x34')](_0x6047b['headers']['authorization'],'Basic')){var _0x2dea1b=basicAuth(_0x6047b);db[_0xcfc9('0x35')][_0xcfc9('0x36')]({'where':{'name':_0x2dea1b[_0xcfc9('0xb')]}})[_0xcfc9('0x2b')](function(_0x4d47db){if(!_0x4d47db||!_0x4d47db[_0xcfc9('0x37')](_0x2dea1b['pass'])){return _0x1c29cf[_0xcfc9('0x2c')](0x191)[_0xcfc9('0x2e')]({'message':_0xcfc9('0x38')});}_0x6047b[_0xcfc9('0x25')]={'id':_0x4d47db['id']};_0x5837cc();})[_0xcfc9('0x31')](function(_0x4ba9b9){_0x5837cc(_0x4ba9b9);});}else if(_[_0xcfc9('0x34')](_0x6047b['headers']['authorization'],'Bearer')){validateJwt(_0x6047b,_0x1c29cf,_0x5837cc);}else{if(_0x843c18){_0x5837cc();}else{return _0x1c29cf[_0xcfc9('0x2c')](0x193)['json']({'message':_0xcfc9('0x39')});}}}else if(_0x6047b[_0xcfc9('0x3a')]['apikey']){try{var _0x4d20e7={'audience':hardwareConf[_0xcfc9('0x3b')](),'issuer':hardwareConf[_0xcfc9('0x3b')]()};verifyJwt(_0x6047b['query'][_0xcfc9('0x3c')],_0x4d20e7)[_0xcfc9('0x2b')](function(_0x4913f8){return db[_0xcfc9('0x35')][_0xcfc9('0x36')]({'where':{'id':_0x4913f8[_0xcfc9('0x3d')]}})[_0xcfc9('0x2b')](function(_0x2349f7){if(!_0x2349f7||!_[_0xcfc9('0x3e')](_0x2349f7[_0xcfc9('0x3f')],_0x4913f8[_0xcfc9('0x40')])){return _0x1c29cf[_0xcfc9('0x2c')](0x191)[_0xcfc9('0x2e')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}_0x6047b[_0xcfc9('0x25')]={'id':_0x2349f7['id']};_0x5837cc();});})['catch'](function(){return _0x1c29cf[_0xcfc9('0x2c')](0x191)['json']({'message':_0xcfc9('0x41')});});}catch(_0x23b9af){_0x5837cc(_0x23b9af);}}else if(_0x843c18){_0x5837cc();}else{return _0x1c29cf[_0xcfc9('0x2c')](0x193)[_0xcfc9('0x2e')]({'message':_0xcfc9('0x39')});}})[_0xcfc9('0x24')](function(_0x2e82d4,_0x516a20,_0x525194){if(_0x2e82d4[_0xcfc9('0x25')]){db[_0xcfc9('0x35')][_0xcfc9('0x36')]({'where':{'id':_0x2e82d4[_0xcfc9('0x25')]['id']},'attributes':userAttributes})['then'](function(_0x5c001a){if(!_0x5c001a){return _0x516a20[_0xcfc9('0x2c')](0x194)['json']({'message':'User\x20not\x20found.'});}_0x2e82d4['user']=_0x5c001a;_0x525194();})[_0xcfc9('0x31')](function(_0x555afc){_0x525194(_0x555afc);});}else if(_0x843c18){_0x525194();}else{return _0x516a20[_0xcfc9('0x2c')](0x194)[_0xcfc9('0x2e')]({'message':_0xcfc9('0x42')});}});};exports[_0xcfc9('0x43')]=function canUpdate(){return compose()[_0xcfc9('0x24')](function(_0x622535,_0x1ac2fe,_0x2c950b){return require(_0xcfc9('0x44'))[_0xcfc9('0x45')]()[_0xcfc9('0x2b')](function(_0x3f98d8){if(_0x3f98d8[_0xcfc9('0x46')]){_0x2c950b();}else{return _0x1ac2fe['status'](0x193)['json']({'message':'Forbidden'});}})[_0xcfc9('0x31')](function(_0x3d11b6){_0x2c950b(_0x3d11b6);});});};exports['isMiddleware']=function(_0x356ab0,_0x536128,_0x5cbce7){_0x356ab0['isMiddleware']=!![];return _0x5cbce7();};exports[_0xcfc9('0x47')]=function signToken(_0x352216){return signJwt(_0x352216);};exports[_0xcfc9('0x48')]=function(_0x46abb0,_0x4ee32b){if(!_0x46abb0['user']){return _0x4ee32b[_0xcfc9('0x2c')](0x194)['json']({'message':_0xcfc9('0x49')});}var _0x1e33ad={'payload':{'id':_0x46abb0[_0xcfc9('0x25')]['id'],'role':_0x46abb0[_0xcfc9('0x25')][_0xcfc9('0x9')]},'options':{'expiresIn':0x15180}};return signJwt(_0x1e33ad)[_0xcfc9('0x2b')](function(_0x41e398){_0x4ee32b[_0xcfc9('0x4a')](_0xcfc9('0x4b'),_0x41e398);_0x4ee32b[_0xcfc9('0x4c')](_0xcfc9('0x4d'));})['catch'](function(_0x21a0f4){return _0x4ee32b[_0xcfc9('0x2c')](0x1f4)['send'](_0x21a0f4);});};exports['retrieveApiKey']=function(_0x2ddcc5){if(_[_0xcfc9('0x4e')](_0x2ddcc5['apiKeyNonce'])||_[_0xcfc9('0x4e')](_0x2ddcc5[_0xcfc9('0x4f')])){return null;}else{return createJwt(_0x2ddcc5);}};exports['generateApiKey']=function(_0x57b968){_0x57b968[_0xcfc9('0x3f')]=generateNonce();_0x57b968['apiKeyIat']=generateIssuedAt();return createJwt(_0x57b968);};exports[_0xcfc9('0x50')]=function(_0x453a83,_0x528608){var _0x49f88e=_0x453a83[_0xcfc9('0x3a')][_0xcfc9('0x3c')];if(_0x49f88e){var _0x16e2bc={'nonce':_0x528608[_0xcfc9('0x3f')],'iat':_0x528608[_0xcfc9('0x4f')],'audience':hardwareConf[_0xcfc9('0x3b')](),'issuer':hardwareConf[_0xcfc9('0x3b')]()};return verifyJwt(_0x49f88e,_0x16e2bc)[_0xcfc9('0x2b')](function(){return generateApiKey(_0x528608);});}else{throw{'message':_0xcfc9('0x51')};}};function signJwt(_0x33244b){var _0x543c26=BPromise[_0xcfc9('0x52')](jwt['sign'],{'context':jwt});var _0x1e9aa6=_0x33244b['secret']||config[_0xcfc9('0x7')][_0xcfc9('0x8')];return new BPromise(function(_0x4be9e9,_0x1bf564){_0x543c26(_0x33244b[_0xcfc9('0x53')],_0x1e9aa6,_0x33244b['options'])['then'](function(_0x1a5665){_0x4be9e9(_0x1a5665);})[_0xcfc9('0x31')](function(_0xc5a2a1){_0x1bf564(_0xc5a2a1);});});}function verifyJwt(_0x2eedec,_0x57a936,_0x100adc){var _0x1e1f92=BPromise[_0xcfc9('0x52')](jwt[_0xcfc9('0x54')],{'context':jwt});var _0xee7b24=_0x100adc||config[_0xcfc9('0x7')][_0xcfc9('0x8')];return new BPromise(function(_0xf2853b,_0x182a2f){_0x1e1f92(_0x2eedec,_0xee7b24,_0x57a936)['then'](function(_0x597697){_0xf2853b(_0x597697);})[_0xcfc9('0x31')](function(_0x2a5b9f){_0x182a2f(_0x2a5b9f);});});}function generateNonce(){return crypto[_0xcfc9('0x55')](0x10)[_0xcfc9('0x56')](_0xcfc9('0x57'));}function generateIssuedAt(){return Math['floor'](Date[_0xcfc9('0x58')]()/0x3e8)[_0xcfc9('0x56')]();}function createJwt(_0x196f95){var _0x19fb84={'payload':{'iat':_0x196f95[_0xcfc9('0x4f')],'nonce':_0x196f95[_0xcfc9('0x3f')]},'options':{'algorithm':_0xcfc9('0x59'),'subject':_0x196f95['id'][_0xcfc9('0x56')](),'issuer':hardwareConf[_0xcfc9('0x3b')](),'audience':hardwareConf[_0xcfc9('0x3b')]()}};return signJwt(_0x19fb84)[_0xcfc9('0x2b')](function(_0x388fcb){return{'iat':_0x196f95[_0xcfc9('0x4f')],'nonce':_0x196f95[_0xcfc9('0x3f')],'token':_0x388fcb};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 4d2bc25..cf9a2b2 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 _0xa9e0=['update','close','crypto','bluebird','aes192','hasOwnProperty','encryptFile','createReadStream','createCipher','algorithm','data','final','binary','write','end','unlink','decryptFile'];(function(_0x10e7d4,_0x538ba6){var _0x34de14=function(_0x4f4567){while(--_0x4f4567){_0x10e7d4['push'](_0x10e7d4['shift']());}};_0x34de14(++_0x538ba6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var crypto=require(_0x0a9e('0x0'));var fs=require('fs');var BPromise=require(_0x0a9e('0x1'));var defaultOptions={'algorithm':_0x0a9e('0x2')};function combineOptions(_0x5dd881){var _0x550fbc={};for(var _0x18d5c9 in defaultOptions){if(defaultOptions['hasOwnProperty'](_0x18d5c9)){_0x550fbc[_0x18d5c9]=defaultOptions[_0x18d5c9];}}if(_0x5dd881){for(var _0x333808 in _0x5dd881){if(_0x5dd881[_0x0a9e('0x3')](_0x333808)){_0x550fbc[_0x333808]=_0x5dd881[_0x333808];}}}return _0x550fbc;}exports[_0x0a9e('0x4')]=function(_0x991246,_0x981158,_0x57b080,_0x219af0){return new BPromise(function(_0x441e3a,_0x2cc193){_0x219af0=combineOptions(_0x219af0);var _0x5f41ea=new Buffer(_0x57b080);var _0x503809=fs[_0x0a9e('0x5')](_0x991246);var _0x56465b=fs['createWriteStream'](_0x981158);var _0x39753a=crypto[_0x0a9e('0x6')](_0x219af0[_0x0a9e('0x7')],_0x5f41ea);_0x503809['on'](_0x0a9e('0x8'),function(_0xfeb75b){var _0xbd1168=new Buffer(_0x39753a['update'](_0xfeb75b),'binary');_0x56465b['write'](_0xbd1168);});_0x503809['on']('end',function(){try{var _0x273d4d=new Buffer(_0x39753a[_0x0a9e('0x9')](_0x0a9e('0xa')),_0x0a9e('0xa'));_0x56465b[_0x0a9e('0xb')](_0x273d4d);_0x56465b[_0x0a9e('0xc')]();_0x56465b['on']('close',function(){return _0x441e3a(_0x981158);});}catch(_0x4283ce){fs[_0x0a9e('0xd')](_0x981158);return _0x2cc193(_0x4283ce);}});});};exports[_0x0a9e('0xe')]=function(_0x281129,_0x44dcfd,_0x4d5611,_0x52a03d){return new BPromise(function(_0x22dccb,_0x5d0880){_0x52a03d=combineOptions(_0x52a03d);var _0x1985b6=new Buffer(_0x4d5611);var _0x519dfd=fs[_0x0a9e('0x5')](_0x281129);var _0x12066b=fs['createWriteStream'](_0x44dcfd);var _0x225616=crypto['createDecipher'](_0x52a03d[_0x0a9e('0x7')],_0x1985b6);_0x519dfd['on'](_0x0a9e('0x8'),function(_0x106033){var _0x205fd6=new Buffer(_0x225616[_0x0a9e('0xf')](_0x106033),_0x0a9e('0xa'));_0x12066b[_0x0a9e('0xb')](_0x205fd6);});_0x519dfd['on'](_0x0a9e('0xc'),function(){try{var _0x1314ae=new Buffer(_0x225616[_0x0a9e('0x9')](_0x0a9e('0xa')),_0x0a9e('0xa'));_0x12066b['write'](_0x1314ae);_0x12066b[_0x0a9e('0xc')]();_0x12066b['on'](_0x0a9e('0x10'),function(){return _0x22dccb(_0x44dcfd);});}catch(_0x53682f){fs[_0x0a9e('0xd')](_0x44dcfd);return _0x5d0880(_0x53682f);}});});}; \ No newline at end of file +var _0xd8b0=['data','binary','end','final','write','close','unlink','decryptFile','createReadStream','createDecipher','update','crypto','bluebird','hasOwnProperty','encryptFile','createWriteStream','createCipher','algorithm'];(function(_0x10bcda,_0x52df8e){var _0x4435ae=function(_0x3f6ff4){while(--_0x3f6ff4){_0x10bcda['push'](_0x10bcda['shift']());}};_0x4435ae(++_0x52df8e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var crypto=require(_0x0d8b('0x0'));var fs=require('fs');var BPromise=require(_0x0d8b('0x1'));var defaultOptions={'algorithm':'aes192'};function combineOptions(_0x585166){var _0x4b72b0={};for(var _0x3ff8df in defaultOptions){if(defaultOptions[_0x0d8b('0x2')](_0x3ff8df)){_0x4b72b0[_0x3ff8df]=defaultOptions[_0x3ff8df];}}if(_0x585166){for(var _0x43bca1 in _0x585166){if(_0x585166[_0x0d8b('0x2')](_0x43bca1)){_0x4b72b0[_0x43bca1]=_0x585166[_0x43bca1];}}}return _0x4b72b0;}exports[_0x0d8b('0x3')]=function(_0x577834,_0x5e15e6,_0x3f8b6f,_0x227c63){return new BPromise(function(_0x39f43a,_0x4a4470){_0x227c63=combineOptions(_0x227c63);var _0x413284=new Buffer(_0x3f8b6f);var _0x284169=fs['createReadStream'](_0x577834);var _0x129310=fs[_0x0d8b('0x4')](_0x5e15e6);var _0x3b027f=crypto[_0x0d8b('0x5')](_0x227c63[_0x0d8b('0x6')],_0x413284);_0x284169['on'](_0x0d8b('0x7'),function(_0x2c5e9e){var _0x28f87c=new Buffer(_0x3b027f['update'](_0x2c5e9e),_0x0d8b('0x8'));_0x129310['write'](_0x28f87c);});_0x284169['on'](_0x0d8b('0x9'),function(){try{var _0xc574a3=new Buffer(_0x3b027f[_0x0d8b('0xa')](_0x0d8b('0x8')),_0x0d8b('0x8'));_0x129310[_0x0d8b('0xb')](_0xc574a3);_0x129310[_0x0d8b('0x9')]();_0x129310['on'](_0x0d8b('0xc'),function(){return _0x39f43a(_0x5e15e6);});}catch(_0x1d4bbc){fs[_0x0d8b('0xd')](_0x5e15e6);return _0x4a4470(_0x1d4bbc);}});});};exports[_0x0d8b('0xe')]=function(_0xe65334,_0x1567ce,_0x2d4e1c,_0x4f6f21){return new BPromise(function(_0x23eb7b,_0xa86349){_0x4f6f21=combineOptions(_0x4f6f21);var _0x17f7df=new Buffer(_0x2d4e1c);var _0xe2e167=fs[_0x0d8b('0xf')](_0xe65334);var _0x5cd485=fs[_0x0d8b('0x4')](_0x1567ce);var _0x4586c2=crypto[_0x0d8b('0x10')](_0x4f6f21[_0x0d8b('0x6')],_0x17f7df);_0xe2e167['on'](_0x0d8b('0x7'),function(_0x18dd2d){var _0x264b39=new Buffer(_0x4586c2[_0x0d8b('0x11')](_0x18dd2d),'binary');_0x5cd485[_0x0d8b('0xb')](_0x264b39);});_0xe2e167['on'](_0x0d8b('0x9'),function(){try{var _0x196c0a=new Buffer(_0x4586c2[_0x0d8b('0xa')](_0x0d8b('0x8')),_0x0d8b('0x8'));_0x5cd485[_0x0d8b('0xb')](_0x196c0a);_0x5cd485[_0x0d8b('0x9')]();_0x5cd485['on']('close',function(){return _0x23eb7b(_0x1567ce);});}catch(_0x4f0a1a){fs[_0x0d8b('0xd')](_0x1567ce);return _0xa86349(_0x4f0a1a);}});});}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 57b407f..90702da 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 _0x4522=['Setting','find','split','splitSizeCsv','then','format','sequelize','SELECT','num','length','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.csv','existsSync','mkdirSync','join','each','csv','writeFileSync','Completed','%s.%s','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','lodash','to-csv','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','CSV'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4522,0x1a0));var _0x2452=function(_0x453a05,_0x102018){_0x453a05=_0x453a05-0x0;var _0xc42c7d=_0x4522[_0x453a05];return _0xc42c7d;};'use strict';var util=require('util');var path=require('path');var _=require(_0x2452('0x0'));var csv=require(_0x2452('0x1'));var fs=require('fs');var BPromise=require(_0x2452('0x2'));var zipdir=require('zip-dir');var rimraf=require(_0x2452('0x3'));var db=require(_0x2452('0x4'))['db'];var dbH=require(_0x2452('0x4'))[_0x2452('0x5')];var logger=require(_0x2452('0x6'))(_0x2452('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x2452('0x8')][0x2]);var QUERY=process[_0x2452('0x8')][0x3];var PATH=process[_0x2452('0x8')][0x4];function analyticExtractedReport(_0x149807,_0x3bc193){var _0x33b935={'status':_0x149807};var _0x24073f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3bc193){_0x33b935[_0x2452('0x9')]=_0x3bc193;}return db[_0x2452('0xa')][_0x2452('0xb')](_0x33b935,_0x24073f);}function main(){var _0x5a38e0=0x1388;var _0x5dc630;logger[_0x2452('0xc')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x2452('0xd')));return db[_0x2452('0xe')][_0x2452('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x2452('0x10'),_0x2452('0x11')]})[_0x2452('0x12')](function(_0x2c1e0f){if(_0x2c1e0f){_0x5dc630=_0x2c1e0f;_0x5a38e0=_0x5dc630[_0x2452('0x11')]||0x1388;}})['then'](function(){return dbH['sequelize']['query'](util[_0x2452('0x13')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x2452('0x14')]['QueryTypes'][_0x2452('0x15')]});})[_0x2452('0x12')](function(_0x5d0438){if(!_0x5d0438[0x0][_0x2452('0x16')]){return analyticExtractedReport('Empty');}var _0x3dd8cc=[];var _0x734b88=0x0;var _0x461d2b=!![];if(_0x5d0438&&_0x5d0438[_0x2452('0x17')]){var _0x4e1d20=_0x5d0438[0x0][_0x2452('0x16')]%(_0x734b88+_0x5a38e0);if(_0x5dc630[_0x2452('0x10')]){for(;_0x461d2b;_0x734b88+=_0x5a38e0,_0x4e1d20=_0x5d0438[0x0]['num']%(_0x734b88+_0x5a38e0)){if(_0x4e1d20==0x0||_0x4e1d20==_0x5d0438[0x0]['num']){_0x461d2b=![];}_0x3dd8cc[_0x2452('0x18')](dbH[_0x2452('0x14')][_0x2452('0x19')](util['format'](_0x2452('0x1a'),QUERY,_0x5a38e0,_0x734b88),{'type':dbH[_0x2452('0x14')][_0x2452('0x1b')][_0x2452('0x15')]}));}}else{_0x3dd8cc[_0x2452('0x18')](dbH[_0x2452('0x14')][_0x2452('0x19')](QUERY,{'type':dbH[_0x2452('0x14')]['QueryTypes']['SELECT']}));}}var _0x1f060d=path[_0x2452('0x1c')](PATH);var _0x4bb3ff=path[_0x2452('0x1d')](PATH,_0x2452('0x1e'));var _0x1d5720=_0x5dc630[_0x2452('0x10')]&&_0x3dd8cc[_0x2452('0x17')]>0x1;var _0x397f21=[];if(!fs[_0x2452('0x1f')](path['join'](_0x1f060d,_0x4bb3ff))&&_0x1d5720){fs[_0x2452('0x20')](path[_0x2452('0x21')](_0x1f060d,_0x4bb3ff));}return BPromise[_0x2452('0x22')](_0x3dd8cc,function(_0x231410){_0x397f21[_0x2452('0x18')](_0x231410);})['then'](function(){for(var _0x48783a=0x0;_0x48783a<_0x397f21[_0x2452('0x17')];_0x48783a+=0x1){var _0x159ba1;var _0x46fcbb=_0x397f21[_0x48783a];if(_0x1d5720){_0x159ba1=path[_0x2452('0x21')](_0x1f060d,_0x4bb3ff,util[_0x2452('0x13')]('%s%d.%s',_0x4bb3ff,_0x48783a,_0x2452('0x23')));}else{_0x159ba1=path[_0x2452('0x21')](_0x1f060d,util['format']('%s.%s',_0x4bb3ff,_0x2452('0x23')));}fs[_0x2452('0x24')](_0x159ba1,csv(_0x46fcbb));}})[_0x2452('0x12')](function(){if(_0x1d5720){zipdir(path[_0x2452('0x21')](_0x1f060d,_0x4bb3ff),{'saveTo':path[_0x2452('0x21')](_0x1f060d,util[_0x2452('0x13')]('%s.%s',_0x4bb3ff,'zip'))},function(_0x46b611,_0x454e0a){});rimraf(path[_0x2452('0x21')](_0x1f060d,_0x4bb3ff),function(){});}})['then'](function(){logger[_0x2452('0xc')](util[_0x2452('0x13')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x2452('0xd')));return analyticExtractedReport(_0x2452('0x25'),_0x1d5720?util[_0x2452('0x13')](_0x2452('0x26'),_0x4bb3ff,_0x1d5720?_0x2452('0x27'):_0x2452('0x23')):null);});})[_0x2452('0x28')](function(_0x115e09){logger[_0x2452('0xc')](util[_0x2452('0x13')](_0x2452('0x29'),EXTRACTED_REPORT_ID,_0x2452('0xd')),util[_0x2452('0x2a')](_0x115e09,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file +var _0x22fb=['savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','Empty','length','num','push','dirname','basename','.csv','split','join','mkdirSync','each','%s%d.%s','csv','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','inspect','Failed','lodash','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv'];(function(_0x49a445,_0x344228){var _0x57b915=function(_0x3ab3e3){while(--_0x3ab3e3){_0x49a445['push'](_0x49a445['shift']());}};_0x57b915(++_0x344228);}(_0x22fb,0x192));var _0xb22f=function(_0x3543ff,_0x433388){_0x3543ff=_0x3543ff-0x0;var _0x54058f=_0x22fb[_0x3543ff];return _0x54058f;};'use strict';var util=require('util');var path=require('path');var _=require(_0xb22f('0x0'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0xb22f('0x1'));var zipdir=require(_0xb22f('0x2'));var rimraf=require(_0xb22f('0x3'));var db=require(_0xb22f('0x4'))['db'];var dbH=require(_0xb22f('0x4'))['dbH'];var logger=require(_0xb22f('0x5'))(_0xb22f('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0xb22f('0x7')][0x2]);var QUERY=process[_0xb22f('0x7')][0x3];var PATH=process[_0xb22f('0x7')][0x4];function analyticExtractedReport(_0x367d4b,_0x47f61a){var _0x34433b={'status':_0x367d4b};var _0x22c509={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x47f61a){_0x34433b[_0xb22f('0x8')]=_0x47f61a;}return db[_0xb22f('0x9')][_0xb22f('0xa')](_0x34433b,_0x22c509);}function main(){var _0x3593fb=0x1388;var _0x188cea;logger[_0xb22f('0xb')](util[_0xb22f('0xc')](_0xb22f('0xd'),EXTRACTED_REPORT_ID,_0xb22f('0xe')));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xb22f('0xf')]})['then'](function(_0x4bb02a){if(_0x4bb02a){_0x188cea=_0x4bb02a;_0x3593fb=_0x188cea['splitSizeCsv']||0x1388;}})[_0xb22f('0x10')](function(){return dbH[_0xb22f('0x11')][_0xb22f('0x12')](util[_0xb22f('0xc')](_0xb22f('0x13'),QUERY),{'type':dbH[_0xb22f('0x11')]['QueryTypes'][_0xb22f('0x14')]});})['then'](function(_0x36e2a8){if(!_0x36e2a8[0x0]['num']){return analyticExtractedReport(_0xb22f('0x15'));}var _0x514a8f=[];var _0x160417=0x0;var _0xc36af4=!![];if(_0x36e2a8&&_0x36e2a8[_0xb22f('0x16')]){var _0x538da0=_0x36e2a8[0x0][_0xb22f('0x17')]%(_0x160417+_0x3593fb);if(_0x188cea['split']){for(;_0xc36af4;_0x160417+=_0x3593fb,_0x538da0=_0x36e2a8[0x0][_0xb22f('0x17')]%(_0x160417+_0x3593fb)){if(_0x538da0==0x0||_0x538da0==_0x36e2a8[0x0][_0xb22f('0x17')]){_0xc36af4=![];}_0x514a8f[_0xb22f('0x18')](dbH[_0xb22f('0x11')][_0xb22f('0x12')](util[_0xb22f('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3593fb,_0x160417),{'type':dbH[_0xb22f('0x11')]['QueryTypes'][_0xb22f('0x14')]}));}}else{_0x514a8f[_0xb22f('0x18')](dbH[_0xb22f('0x11')][_0xb22f('0x12')](QUERY,{'type':dbH[_0xb22f('0x11')]['QueryTypes']['SELECT']}));}}var _0x3da442=path[_0xb22f('0x19')](PATH);var _0xf34e0d=path[_0xb22f('0x1a')](PATH,_0xb22f('0x1b'));var _0xcb9a74=_0x188cea[_0xb22f('0x1c')]&&_0x514a8f[_0xb22f('0x16')]>0x1;var _0x583fbe=[];if(!fs['existsSync'](path[_0xb22f('0x1d')](_0x3da442,_0xf34e0d))&&_0xcb9a74){fs[_0xb22f('0x1e')](path['join'](_0x3da442,_0xf34e0d));}return BPromise[_0xb22f('0x1f')](_0x514a8f,function(_0x4364f5){_0x583fbe['push'](_0x4364f5);})[_0xb22f('0x10')](function(){for(var _0x2918be=0x0;_0x2918be<_0x583fbe['length'];_0x2918be+=0x1){var _0x3e471f;var _0x2c4a9e=_0x583fbe[_0x2918be];if(_0xcb9a74){_0x3e471f=path[_0xb22f('0x1d')](_0x3da442,_0xf34e0d,util[_0xb22f('0xc')](_0xb22f('0x20'),_0xf34e0d,_0x2918be,_0xb22f('0x21')));}else{_0x3e471f=path[_0xb22f('0x1d')](_0x3da442,util[_0xb22f('0xc')]('%s.%s',_0xf34e0d,'csv'));}fs['writeFileSync'](_0x3e471f,csv(_0x2c4a9e));}})[_0xb22f('0x10')](function(){if(_0xcb9a74){zipdir(path['join'](_0x3da442,_0xf34e0d),{'saveTo':path[_0xb22f('0x1d')](_0x3da442,util[_0xb22f('0xc')](_0xb22f('0x22'),_0xf34e0d,_0xb22f('0x23')))},function(_0x3bf636,_0x5b2a42){});rimraf(path['join'](_0x3da442,_0xf34e0d),function(){});}})[_0xb22f('0x10')](function(){logger[_0xb22f('0xb')](util[_0xb22f('0xc')](_0xb22f('0x24'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xb22f('0x25'),_0xcb9a74?util[_0xb22f('0xc')]('%s.%s',_0xf34e0d,_0xcb9a74?_0xb22f('0x23'):_0xb22f('0x21')):null);});})[_0xb22f('0x26')](function(_0x225194){logger[_0xb22f('0xb')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xb22f('0xe')),util[_0xb22f('0x27')](_0x225194,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xb22f('0x28'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 7a2c794..3c34933 100644 --- a/server/components/export/pdf.js +++ b/server/components/export/pdf.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','landscape','black','body','toString','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','pipe','finish','error','log','err','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','lodash','bluebird','pdfmake/src/printer','zip-dir','rimraf','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','splitSizePdf','then','length','push','sequelize','query'];(function(_0x338dd4,_0x5b69fe){var _0x56be5a=function(_0x278108){while(--_0x278108){_0x338dd4['push'](_0x338dd4['shift']());}};_0x56be5a(++_0x5b69fe);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var fs=require('fs');var BPromise=require(_0x0d8b('0x1'));var util=require('util');var path=require('path');var moment=require('moment');var PdfPrinter=require(_0x0d8b('0x2'));var zipdir=require(_0x0d8b('0x3'));var rimraf=require(_0x0d8b('0x4'));var db=require(_0x0d8b('0x5'))['db'];var dbH=require(_0x0d8b('0x5'))['dbH'];var logger=require('../../config/logger')(_0x0d8b('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x0d8b('0x7')][0x2]);var QUERY=process[_0x0d8b('0x7')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x0d8b('0x7')][0x5];var FORMAT=_0x0d8b('0x8');var _extractedReport;function analyticExtractedReport(_0x58e4e2,_0x129310){var _0x348e65={'status':_0x58e4e2};var _0x3b027f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x129310){_0x348e65[_0x0d8b('0x9')]=_0x129310;}return db[_0x0d8b('0xa')][_0x0d8b('0xb')](_0x348e65,_0x3b027f);}function getHeader(_0x2c5e9e){var _0x28f87c=[];for(var _0x48fa16 in _0x2c5e9e){if(_0x2c5e9e[_0x0d8b('0xc')](_0x48fa16)){_0x28f87c['push']({'text':_0x48fa16,'style':_0x0d8b('0xd')});}}return _0x28f87c;}function extractReport(_0xc574a3){var _0x340cc4=0x1388;var _0x92cdd8;if(!_0xc574a3[0x0][_0x0d8b('0xe')]){return analyticExtractedReport(_0x0d8b('0xf'));}var _0x15dd0f=[];var _0x31a8cc=0x0;var _0x1d4bbc=!![];var _0x2ce75e=path[_0x0d8b('0x10')](PATH);var _0xe65334=path[_0x0d8b('0x11')](PATH,_0x0d8b('0x12'));var _0x4f6f21=![];var _0x23eb7b=[];return db[_0x0d8b('0x13')][_0x0d8b('0x14')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0d8b('0x15'),_0x0d8b('0x16')]})['then'](function(_0x106a01){if(_0x106a01){_0x92cdd8=_0x106a01;_0x340cc4=_0x92cdd8[_0x0d8b('0x16')]||0x3e8;}})[_0x0d8b('0x17')](function(){if(_0xc574a3&&_0xc574a3[_0x0d8b('0x18')]){var _0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4);if(_0x92cdd8[_0x0d8b('0x15')]){for(;_0x1d4bbc;_0x31a8cc+=_0x340cc4,_0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4)){if(_0x333674==0x0||_0x333674==_0xc574a3[0x0]['num']){_0x1d4bbc=![];}_0x15dd0f[_0x0d8b('0x19')](dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')](_0x0d8b('0x1d'),QUERY,_0x340cc4,_0x31a8cc),{'type':dbH[_0x0d8b('0x1a')][_0x0d8b('0x1e')][_0x0d8b('0x1f')]}));}}else{_0x15dd0f['push'](dbH['sequelize'][_0x0d8b('0x1b')](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}_0x4f6f21=_0x92cdd8[_0x0d8b('0x15')]&&_0x15dd0f[_0x0d8b('0x18')]>0x1;if(!fs[_0x0d8b('0x20')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334))&&_0x4f6f21){fs[_0x0d8b('0x22')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334));}return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4562cb){_0x23eb7b[_0x0d8b('0x19')](_0x4562cb);});})['then'](function(){return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4463ee,_0x5363e3){var _0xe1ef20;var _0x4a0ae4=util[_0x0d8b('0x1c')](_0x0d8b('0x24'),NAME,_extractedReport[_0x0d8b('0x25')],moment(_extractedReport['startDate'])['format'](FORMAT),moment(_extractedReport[_0x0d8b('0x26')])[_0x0d8b('0x1c')](FORMAT));var _0x4c05ee={'pageSize':'A4','pageOrientation':_0x0d8b('0x27'),'content':[{'text':_0x4a0ae4,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x0d8b('0x28')}}};var _0x4b59e5={'headerRows':0x1,'body':[]};_0x4b59e5[_0x0d8b('0x29')]['push'](getHeader(_0x4463ee[0x0]));var _0x2ab00d;for(var _0x546bf6=0x0;_0x546bf6<_0x4463ee[_0x0d8b('0x18')];_0x546bf6+=0x1){_0x2ab00d=[];for(var _0x544735 in _0x4463ee[_0x546bf6]){if(_0x4463ee[_0x546bf6][_0x0d8b('0xc')](_0x544735)){_0x2ab00d[_0x0d8b('0x19')](_0x4463ee[_0x546bf6][_0x544735]?_[_0x0d8b('0x2a')](_0x4463ee[_0x546bf6][_0x544735]):'');}}_0x4b59e5['body']['push'](_0x2ab00d);}_0x4c05ee['content'][_0x0d8b('0x19')]({'table':_0x4b59e5});return new BPromise(function(_0x5515d2,_0x3cdf3c){var _0x54f6f3=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0x0d8b('0x2b'),'italics':__dirname+_0x0d8b('0x2c'),'bolditalics':__dirname+_0x0d8b('0x2d')}});var _0xdeee5d=_0x54f6f3[_0x0d8b('0x2e')](_0x4c05ee);if(_0x4f6f21){_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334,util[_0x0d8b('0x1c')](_0x0d8b('0x2f'),_0xe65334,_0x5363e3,'pdf'));}else{_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')]('%s.%s',_0xe65334,_0x0d8b('0x30')));}var _0x23f7f6=_0xdeee5d[_0x0d8b('0x31')](fs['createWriteStream'](_0xe1ef20));_0x23f7f6['on'](_0x0d8b('0x32'),function(){_0x5515d2();});_0x23f7f6['on'](_0x0d8b('0x33'),function(_0x206157){console[_0x0d8b('0x34')](_0x0d8b('0x35'),_0x206157);_0x3cdf3c(_0x206157);});_0xdeee5d['end']();});});})[_0x0d8b('0x17')](function(){if(_0x4f6f21){return new BPromise(function(_0x1649fc,_0x5ad0fe){zipdir(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),{'saveTo':path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x0d8b('0x37')))},function(_0x519088){if(_0x519088){_0x5ad0fe(_0x519088);}else{_0x1649fc();}});});}})['then'](function(){if(_0x4f6f21){rimraf(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),function(){});}})['then'](function(){logger['info'](util[_0x0d8b('0x1c')](_0x0d8b('0x38'),EXTRACTED_REPORT_ID,_0x0d8b('0x39')));return analyticExtractedReport(_0x0d8b('0x3a'),_0x4f6f21?util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x4f6f21?'zip':_0x0d8b('0x30')):null);});}function main(){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x3c'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')));return db[_0x0d8b('0xa')][_0x0d8b('0x3e')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x1d06b6){_extractedReport=_0x1d06b6;return dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x0d8b('0x1a')]['QueryTypes'][_0x0d8b('0x1f')]});})[_0x0d8b('0x17')](extractReport)[_0x0d8b('0x3f')](function(_0x26ac10){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x40'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')),util[_0x0d8b('0x41')](_0x26ac10,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x0d8b('0x42'));});}main(); \ No newline at end of file +var _0xb10b=['query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','SELECT','existsSync','join','mkdirSync','each','name','startDate','endDate','landscape','black','body','content','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','pdf','%s.%s','pipe','createWriteStream','finish','log','err','end','zip','info','Completed','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','lodash','util','path','moment','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','then','splitSizePdf','length','sequelize'];(function(_0x292509,_0x58017f){var _0x588874=function(_0x5354d8){while(--_0x5354d8){_0x292509['push'](_0x292509['shift']());}};_0x588874(++_0x58017f);}(_0xb10b,0x12a));var _0xbb10=function(_0x356127,_0x4873ac){_0x356127=_0x356127-0x0;var _0x5d4c75=_0xb10b[_0x356127];return _0x5d4c75;};'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 0d65bc8..845bfdf 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 _0xe6b0=['../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','format','XLSX','Setting','find','splitSizeXlsx','then','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','split','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','query','dirname','basename','join','mkdirSync','xlsx','%s.%s','writeFileSync','binary','zip','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','util','path','lodash','json2xls','bluebird'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0xe6b0,0x18b));var _0x0e6b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe6b0[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x0e6b('0x0'));var path=require(_0x0e6b('0x1'));var _=require(_0x0e6b('0x2'));var fs=require('fs');var json2xls=require(_0x0e6b('0x3'));var BPromise=require(_0x0e6b('0x4'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0x0e6b('0x5'))[_0x0e6b('0x6')];var logger=require('../../config/logger')(_0x0e6b('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x0e6b('0x8')][0x2]);var QUERY=process[_0x0e6b('0x8')][0x3];var PATH=process[_0x0e6b('0x8')][0x4];function analyticExtractedReport(_0x4a0d14,_0x32c62b){var _0x3250c5={'status':_0x4a0d14};var _0x174a5c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x32c62b){_0x3250c5[_0x0e6b('0x9')]=_0x32c62b;}return db[_0x0e6b('0xa')]['update'](_0x3250c5,_0x174a5c);}function main(){var _0x482491=0x1388;var _0x1334b2;logger['info'](util[_0x0e6b('0xb')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x0e6b('0xc')));return db[_0x0e6b('0xd')][_0x0e6b('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x0e6b('0xf')]})[_0x0e6b('0x10')](function(_0x21e4ef){if(_0x21e4ef){_0x1334b2=_0x21e4ef;_0x482491=_0x1334b2[_0x0e6b('0xf')]||0x1388;}})[_0x0e6b('0x10')](function(){return dbH['sequelize']['query'](util[_0x0e6b('0xb')](_0x0e6b('0x11'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0x0e6b('0x12')]});})['then'](function(_0x4f1736){if(!_0x4f1736[0x0][_0x0e6b('0x13')]){return analyticExtractedReport(_0x0e6b('0x14'));}var _0x1908e9=[];var _0x263d84=0x0;var _0x38f44c=!![];if(_0x1334b2[_0x0e6b('0x15')]){if(_0x4f1736&&_0x4f1736[_0x0e6b('0x16')]){var _0x52be15=_0x4f1736[0x0]['num']%(_0x263d84+_0x482491);for(;_0x38f44c;_0x263d84+=_0x482491,_0x52be15=_0x4f1736[0x0][_0x0e6b('0x13')]%(_0x263d84+_0x482491)){if(_0x52be15==0x0||_0x52be15==_0x4f1736[0x0]['num']){_0x38f44c=![];}_0x1908e9[_0x0e6b('0x17')](dbH['sequelize']['query'](util[_0x0e6b('0xb')](_0x0e6b('0x18'),QUERY,_0x482491,_0x263d84),{'type':dbH[_0x0e6b('0x19')]['QueryTypes'][_0x0e6b('0x12')]}));}}}else{_0x1908e9[_0x0e6b('0x17')](dbH[_0x0e6b('0x19')][_0x0e6b('0x1a')](QUERY,{'type':dbH[_0x0e6b('0x19')]['QueryTypes']['SELECT']}));}var _0x37a0fb=path[_0x0e6b('0x1b')](PATH);var _0x6f0662=path[_0x0e6b('0x1c')](PATH,'.xlsx');var _0xa9205c=_0x1334b2[_0x0e6b('0x15')]&&_0x1908e9[_0x0e6b('0x16')]>0x1;var _0x3f17dc=[];if(!fs['existsSync'](path[_0x0e6b('0x1d')](_0x37a0fb,_0x6f0662))&&_0xa9205c){fs[_0x0e6b('0x1e')](path[_0x0e6b('0x1d')](_0x37a0fb,_0x6f0662));}return BPromise['each'](_0x1908e9,function(_0x3e8e2a){_0x3f17dc[_0x0e6b('0x17')](_0x3e8e2a);})['then'](function(){for(var _0x3f6057=0x0;_0x3f6057<_0x3f17dc[_0x0e6b('0x16')];_0x3f6057+=0x1){var _0x575b30;var _0x40e916=_0x3f17dc[_0x3f6057];if(_0xa9205c){_0x575b30=path[_0x0e6b('0x1d')](_0x37a0fb,_0x6f0662,util[_0x0e6b('0xb')]('%s%d.%s',_0x6f0662,_0x3f6057,_0x0e6b('0x1f')));}else{_0x575b30=path['join'](_0x37a0fb,util[_0x0e6b('0xb')](_0x0e6b('0x20'),_0x6f0662,_0x0e6b('0x1f')));}fs[_0x0e6b('0x21')](_0x575b30,json2xls(_0x40e916),_0x0e6b('0x22'));}})[_0x0e6b('0x10')](function(){if(_0xa9205c){zipdir(path[_0x0e6b('0x1d')](_0x37a0fb,_0x6f0662),{'saveTo':path[_0x0e6b('0x1d')](_0x37a0fb,util['format']('%s.%s',_0x6f0662,_0x0e6b('0x23')))},function(_0x30621a,_0x3415ce){});rimraf(path[_0x0e6b('0x1d')](_0x37a0fb,_0x6f0662),function(){});}})[_0x0e6b('0x10')](function(){logger['info'](util[_0x0e6b('0xb')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0x0e6b('0x24'),_0xa9205c?util[_0x0e6b('0xb')](_0x0e6b('0x20'),_0x6f0662,_0xa9205c?'zip':_0x0e6b('0x1f')):null);});})[_0x0e6b('0x25')](function(_0x9cade7){logger['info'](util[_0x0e6b('0xb')](_0x0e6b('0x26'),EXTRACTED_REPORT_ID,_0x0e6b('0xc')),util['inspect'](_0x9cade7,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x0e6b('0x27'));});}main(); \ No newline at end of file +var _0xd76b=['format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','split','then','splitSizeXlsx','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','length','push','SELECT','.xlsx','existsSync','mkdirSync','join','%s%d.%s','xlsx','%s.%s','writeFileSync','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','util','path','json2xls','bluebird','rimraf','../../mysqldb','analytics','argv','savename','AnalyticExtractedReport','update','info'];(function(_0x14122b,_0x14d085){var _0x2e88a3=function(_0xae06f4){while(--_0xae06f4){_0x14122b['push'](_0x14122b['shift']());}};_0x2e88a3(++_0x14d085);}(_0xd76b,0x11a));var _0xbd76=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xd76b[_0x3511d3];return _0x5d6321;};'use strict';var util=require(_0xbd76('0x0'));var path=require(_0xbd76('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0xbd76('0x2'));var BPromise=require(_0xbd76('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0xbd76('0x4'));var db=require(_0xbd76('0x5'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require('../../config/logger')(_0xbd76('0x6'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xbd76('0x7')][0x3];var PATH=process[_0xbd76('0x7')][0x4];function analyticExtractedReport(_0x2ca197,_0x285b01){var _0x41d08c={'status':_0x2ca197};var _0x48746f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x285b01){_0x41d08c[_0xbd76('0x8')]=_0x285b01;}return db[_0xbd76('0x9')][_0xbd76('0xa')](_0x41d08c,_0x48746f);}function main(){var _0x58cc2f=0x1388;var _0x24f5b3;logger[_0xbd76('0xb')](util[_0xbd76('0xc')](_0xbd76('0xd'),EXTRACTED_REPORT_ID,_0xbd76('0xe')));return db['Setting'][_0xbd76('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbd76('0x10'),'splitSizeXlsx']})[_0xbd76('0x11')](function(_0x2e1904){if(_0x2e1904){_0x24f5b3=_0x2e1904;_0x58cc2f=_0x24f5b3[_0xbd76('0x12')]||0x1388;}})[_0xbd76('0x11')](function(){return dbH[_0xbd76('0x13')][_0xbd76('0x14')](util[_0xbd76('0xc')](_0xbd76('0x15'),QUERY),{'type':dbH[_0xbd76('0x13')][_0xbd76('0x16')]['SELECT']});})[_0xbd76('0x11')](function(_0x228c1c){if(!_0x228c1c[0x0][_0xbd76('0x17')]){return analyticExtractedReport(_0xbd76('0x18'));}var _0xcf27e8=[];var _0x5870eb=0x0;var _0x809b4c=!![];if(_0x24f5b3[_0xbd76('0x10')]){if(_0x228c1c&&_0x228c1c[_0xbd76('0x19')]){var _0x27d757=_0x228c1c[0x0][_0xbd76('0x17')]%(_0x5870eb+_0x58cc2f);for(;_0x809b4c;_0x5870eb+=_0x58cc2f,_0x27d757=_0x228c1c[0x0][_0xbd76('0x17')]%(_0x5870eb+_0x58cc2f)){if(_0x27d757==0x0||_0x27d757==_0x228c1c[0x0][_0xbd76('0x17')]){_0x809b4c=![];}_0xcf27e8[_0xbd76('0x1a')](dbH[_0xbd76('0x13')][_0xbd76('0x14')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x58cc2f,_0x5870eb),{'type':dbH[_0xbd76('0x13')][_0xbd76('0x16')][_0xbd76('0x1b')]}));}}}else{_0xcf27e8['push'](dbH[_0xbd76('0x13')]['query'](QUERY,{'type':dbH[_0xbd76('0x13')][_0xbd76('0x16')]['SELECT']}));}var _0x20af63=path['dirname'](PATH);var _0x2cc68c=path['basename'](PATH,_0xbd76('0x1c'));var _0x41beed=_0x24f5b3[_0xbd76('0x10')]&&_0xcf27e8[_0xbd76('0x19')]>0x1;var _0x5c7d30=[];if(!fs[_0xbd76('0x1d')](path['join'](_0x20af63,_0x2cc68c))&&_0x41beed){fs[_0xbd76('0x1e')](path[_0xbd76('0x1f')](_0x20af63,_0x2cc68c));}return BPromise['each'](_0xcf27e8,function(_0x12bc46){_0x5c7d30[_0xbd76('0x1a')](_0x12bc46);})[_0xbd76('0x11')](function(){for(var _0x5a8219=0x0;_0x5a8219<_0x5c7d30[_0xbd76('0x19')];_0x5a8219+=0x1){var _0x130422;var _0x23ed77=_0x5c7d30[_0x5a8219];if(_0x41beed){_0x130422=path[_0xbd76('0x1f')](_0x20af63,_0x2cc68c,util[_0xbd76('0xc')](_0xbd76('0x20'),_0x2cc68c,_0x5a8219,_0xbd76('0x21')));}else{_0x130422=path[_0xbd76('0x1f')](_0x20af63,util['format'](_0xbd76('0x22'),_0x2cc68c,_0xbd76('0x21')));}fs[_0xbd76('0x23')](_0x130422,json2xls(_0x23ed77),'binary');}})[_0xbd76('0x11')](function(){if(_0x41beed){zipdir(path[_0xbd76('0x1f')](_0x20af63,_0x2cc68c),{'saveTo':path[_0xbd76('0x1f')](_0x20af63,util[_0xbd76('0xc')](_0xbd76('0x22'),_0x2cc68c,'zip'))},function(_0x5bc5cd,_0x397ebc){});rimraf(path['join'](_0x20af63,_0x2cc68c),function(){});}})[_0xbd76('0x11')](function(){logger['info'](util['format'](_0xbd76('0x24'),EXTRACTED_REPORT_ID,_0xbd76('0xe')));return analyticExtractedReport(_0xbd76('0x25'),_0x41beed?util['format'](_0xbd76('0x22'),_0x2cc68c,_0x41beed?_0xbd76('0x26'):'xlsx'):null);});})[_0xbd76('0x27')](function(_0x244e93){logger['info'](util[_0xbd76('0xc')](_0xbd76('0x28'),EXTRACTED_REPORT_ID,_0xbd76('0xe')),util['inspect'](_0x244e93,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbd76('0x29'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 18c110b..9c1371f 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 _0xecd7=['$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','Hangup','destroy','sortBy','catch','error','lodash','util','Interval','findAll','then','intervals','models','VoiceExtension','IntervalId','map','exten','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','find','push','type','CDR(type)=%s','context','VoiceExtensionId','outbound','Set','CDR(destination)=','cutdigits','${EXTEN}','CDR(routeid)=','ExecIf'];(function(_0x2fd504,_0x4d6549){var _0x4fd3cd=function(_0x3b80f4){while(--_0x3b80f4){_0x2fd504['push'](_0x2fd504['shift']());}};_0x4fd3cd(++_0x4d6549);}(_0xecd7,0x18a));var _0x7ecd=function(_0x4c538d,_0x3c41c0){_0x4c538d=_0x4c538d-0x0;var _0x427ce6=_0xecd7[_0x4c538d];return _0x427ce6;};'use strict';var _=require(_0x7ecd('0x0'));var util=require(_0x7ecd('0x1'));function rewrite(_0x38f4c7,_0x270f49){var _0x521ab8=this;return _0x38f4c7['models'][_0x7ecd('0x2')][_0x7ecd('0x3')]({'raw':!![]})[_0x7ecd('0x4')](function(_0x1b25cc){_0x521ab8[_0x7ecd('0x5')]=_0x1b25cc;return _0x38f4c7[_0x7ecd('0x6')][_0x7ecd('0x7')][_0x7ecd('0x3')]({'where':{'IntervalId':_0x270f49[_0x7ecd('0x8')]},'raw':!![]});})[_0x7ecd('0x4')](function(_0x5824ae){return _0x38f4c7[_0x7ecd('0x6')][_0x7ecd('0x7')][_0x7ecd('0x3')]({'where':{'exten':{'$in':_['uniq'](_[_0x7ecd('0x9')](_0x5824ae,_0x7ecd('0xa')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})['then'](function(_0x3d2ab8){var _0x43d661=_[_0x7ecd('0xb')](_0x3d2ab8,{'priority':'1'});var _0x4f037b=_['filter'](_0x3d2ab8,{'isApp':0x1});var _0x1d59d8=_[_0x7ecd('0xc')](_0x4f037b,_0x7ecd('0xa'));var _0x2765e9=[_0x7ecd('0xd'),_0x7ecd('0xe')];var _0x3a5de6=[];var _0x170548=[];for(var _0x8d0c50 in _0x1d59d8){if(_0x1d59d8[_0x7ecd('0xf')](_0x8d0c50)){_0x521ab8[_0x7ecd('0x10')]=0x2;_0x521ab8[_0x7ecd('0x11')]=[];_0x521ab8[_0x7ecd('0x12')]=_[_0x7ecd('0x13')](_0x43d661,{'exten':_0x1d59d8[_0x8d0c50][0x0][_0x7ecd('0xa')]});_0x521ab8['extensions'][_0x7ecd('0x14')]({'type':_0x1d59d8[_0x8d0c50][0x0][_0x7ecd('0x15')],'app':'Set','appdata':util['format'](_0x7ecd('0x16'),_0x1d59d8[_0x8d0c50][0x0][_0x7ecd('0x15')]),'context':_0x1d59d8[_0x8d0c50][0x0][_0x7ecd('0x17')],'exten':_0x1d59d8[_0x8d0c50][0x0]['exten'],'priority':_0x521ab8[_0x7ecd('0x10')]++,'VoiceExtensionId':_0x1d59d8[_0x8d0c50][0x0][_0x7ecd('0x18')]});if(_0x1d59d8[_0x8d0c50][0x0][_0x7ecd('0x15')]===_0x7ecd('0x19')){if(_0x521ab8[_0x7ecd('0x12')]){_0x521ab8[_0x7ecd('0x11')]['push']({'type':_0x1d59d8[_0x8d0c50][0x0]['type'],'app':_0x7ecd('0x1a'),'appdata':_0x7ecd('0x1b')+(_0x521ab8[_0x7ecd('0x12')][_0x7ecd('0x1c')]?'${EXTEN:'+_0x521ab8[_0x7ecd('0x12')][_0x7ecd('0x1c')]+'}':_0x7ecd('0x1d')),'context':_0x1d59d8[_0x8d0c50][0x0][_0x7ecd('0x17')],'exten':_0x1d59d8[_0x8d0c50][0x0]['exten'],'priority':_0x521ab8['priority']++,'VoiceExtensionId':_0x1d59d8[_0x8d0c50][0x0][_0x7ecd('0x18')]});}_0x521ab8['extensions'][_0x7ecd('0x14')]({'type':_0x1d59d8[_0x8d0c50][0x0][_0x7ecd('0x15')],'app':'Set','appdata':_0x7ecd('0x1e')+_0x1d59d8[_0x8d0c50][0x0][_0x7ecd('0x18')],'context':_0x1d59d8[_0x8d0c50][0x0][_0x7ecd('0x17')],'exten':_0x1d59d8[_0x8d0c50][0x0][_0x7ecd('0xa')],'priority':_0x521ab8[_0x7ecd('0x10')]++,'VoiceExtensionId':_0x1d59d8[_0x8d0c50][0x0][_0x7ecd('0x18')]});var _0x506761=_0x521ab8[_0x7ecd('0x10')]++;_0x521ab8[_0x7ecd('0x11')]['push']({'type':_0x1d59d8[_0x8d0c50][0x0][_0x7ecd('0x15')],'app':_0x7ecd('0x1f'),'appdata':_0x7ecd('0x20')+(_0x506761+0x2)+_0x7ecd('0x21')+(_0x506761+0x1)+')','context':_0x1d59d8[_0x8d0c50][0x0]['context'],'exten':_0x1d59d8[_0x8d0c50][0x0][_0x7ecd('0xa')],'priority':_0x506761,'VoiceExtensionId':_0x1d59d8[_0x8d0c50][0x0][_0x7ecd('0x18')]});if(_0x521ab8[_0x7ecd('0x12')]){_0x521ab8[_0x7ecd('0x11')][_0x7ecd('0x14')]({'type':_0x1d59d8[_0x8d0c50][0x0][_0x7ecd('0x15')],'app':_0x7ecd('0x1a'),'appdata':_0x521ab8[_0x7ecd('0x12')][_0x7ecd('0x1c')]?_0x7ecd('0x22')+_0x521ab8['extension']['cutdigits']+'}':_0x7ecd('0x23'),'context':_0x1d59d8[_0x8d0c50][0x0][_0x7ecd('0x17')],'exten':_0x1d59d8[_0x8d0c50][0x0][_0x7ecd('0xa')],'priority':_0x521ab8[_0x7ecd('0x10')]++,'VoiceExtensionId':_0x1d59d8[_0x8d0c50][0x0][_0x7ecd('0x18')]});}_0x521ab8[_0x7ecd('0x11')][_0x7ecd('0x14')]({'type':_0x1d59d8[_0x8d0c50][0x0][_0x7ecd('0x15')],'app':_0x7ecd('0x1a'),'appdata':_0x7ecd('0x24')+_0x1d59d8[_0x8d0c50][0x0][_0x7ecd('0x18')],'context':_0x1d59d8[_0x8d0c50][0x0][_0x7ecd('0x17')],'exten':_0x1d59d8[_0x8d0c50][0x0]['exten'],'priority':_0x521ab8[_0x7ecd('0x10')]++,'VoiceExtensionId':_0x1d59d8[_0x8d0c50][0x0][_0x7ecd('0x18')]});if(_0x521ab8[_0x7ecd('0x12')]&&_0x521ab8[_0x7ecd('0x12')][_0x7ecd('0xf')](_0x7ecd('0x25'))&&_0x521ab8[_0x7ecd('0x12')][_0x7ecd('0x25')]!==_0x7ecd('0x26')){_0x521ab8[_0x7ecd('0x11')][_0x7ecd('0x14')]({'type':_0x1d59d8[_0x8d0c50][0x0][_0x7ecd('0x15')],'app':'Set','appdata':_0x7ecd('0x27'),'context':_0x1d59d8[_0x8d0c50][0x0][_0x7ecd('0x17')],'exten':_0x1d59d8[_0x8d0c50][0x0][_0x7ecd('0xa')],'priority':_0x521ab8[_0x7ecd('0x10')]++,'VoiceExtensionId':_0x1d59d8[_0x8d0c50][0x0][_0x7ecd('0x18')]});_0x521ab8[_0x7ecd('0x11')][_0x7ecd('0x14')]({'type':_0x1d59d8[_0x8d0c50][0x0][_0x7ecd('0x15')],'app':_0x7ecd('0x1a'),'appdata':_0x7ecd('0x28')+_0x521ab8[_0x7ecd('0x12')][_0x7ecd('0x25')]||_0x7ecd('0x29'),'context':_0x1d59d8[_0x8d0c50][0x0]['context'],'exten':_0x1d59d8[_0x8d0c50][0x0][_0x7ecd('0xa')],'priority':_0x521ab8[_0x7ecd('0x10')]++,'VoiceExtensionId':_0x1d59d8[_0x8d0c50][0x0]['VoiceExtensionId']});}}_0x521ab8[_0x7ecd('0x11')]['push']({'type':_0x1d59d8[_0x8d0c50][0x0][_0x7ecd('0x15')],'app':_0x7ecd('0x1a'),'appdata':_0x7ecd('0x2a'),'context':_0x1d59d8[_0x8d0c50][0x0]['context'],'exten':_0x1d59d8[_0x8d0c50][0x0][_0x7ecd('0xa')],'priority':_0x521ab8[_0x7ecd('0x10')]++,'VoiceExtensionId':_0x1d59d8[_0x8d0c50][0x0][_0x7ecd('0x18')]});_0x521ab8[_0x7ecd('0x11')]['push']({'type':_0x1d59d8[_0x8d0c50][0x0][_0x7ecd('0x15')],'app':_0x7ecd('0x1a'),'appdata':_0x7ecd('0x2b'),'context':_0x1d59d8[_0x8d0c50][0x0]['context'],'exten':_0x1d59d8[_0x8d0c50][0x0]['exten'],'priority':_0x521ab8[_0x7ecd('0x10')]++,'VoiceExtensionId':_0x1d59d8[_0x8d0c50][0x0][_0x7ecd('0x18')]});_0x521ab8[_0x7ecd('0x11')]['push']({'type':_0x1d59d8[_0x8d0c50][0x0][_0x7ecd('0x15')],'app':_0x7ecd('0x1a'),'appdata':_0x7ecd('0x2c'),'context':_0x1d59d8[_0x8d0c50][0x0][_0x7ecd('0x17')],'exten':_0x1d59d8[_0x8d0c50][0x0][_0x7ecd('0xa')],'priority':_0x521ab8[_0x7ecd('0x10')]++,'VoiceExtensionId':_0x1d59d8[_0x8d0c50][0x0]['VoiceExtensionId']});for(var _0xd2e3a1=0x0,_0x385cab=0x0;_0xd2e3a1<_0x1d59d8[_0x8d0c50][_0x7ecd('0x2d')];_0xd2e3a1+=0x1,_0x385cab=0x0){var _0x269e13=_0x1d59d8[_0x8d0c50][_0xd2e3a1];if(_0x269e13[_0x7ecd('0x15')]){_0x269e13[_0x7ecd('0x15')]=_0x269e13[_0x7ecd('0x15')]['toLowerCase']();}var _0x668780=[];var _0x2fcca0=[];delete _0x269e13['id'];delete _0x269e13[_0x7ecd('0x2e')];delete _0x269e13['updatedAt'];var _0x5b7a91=_0x269e13[_0x7ecd('0x2f')]!==_0x7ecd('0x30')?[_0x269e13[_0x7ecd('0x2f')]]:_0x269e13[_0x7ecd('0x8')]?_[_0x7ecd('0x9')](_['filter'](_0x521ab8[_0x7ecd('0x5')],{'IntervalId':_0x269e13[_0x7ecd('0x8')]}),'interval'):[];if(_0x269e13[_0x7ecd('0xf')]('tag')){if(_0x269e13[_0x7ecd('0x31')]&&_0x269e13[_0x7ecd('0x31')]!=='--'){_0x668780['push']({'type':_0x269e13['type'],'app':'Set','appdata':_0x7ecd('0x32')+_0x269e13['tag'],'context':_0x269e13['context'],'exten':_0x269e13[_0x7ecd('0xa')],'priority':_0x5b7a91[_0x7ecd('0x2d')]+_0x521ab8[_0x7ecd('0x10')]+_0x385cab++,'VoiceExtensionId':_0x269e13['VoiceExtensionId']});}}if(_0x269e13[_0x7ecd('0x15')]===_0x7ecd('0x19')&&_0x269e13[_0x7ecd('0xf')](_0x7ecd('0x33'))){if(_0x269e13[_0x7ecd('0x33')]){_0x668780[_0x7ecd('0x14')]({'type':_0x269e13[_0x7ecd('0x15')],'app':_0x7ecd('0x1f'),'appdata':_0x7ecd('0x34')+_0x269e13[_0x7ecd('0x33')]+')','context':_0x269e13[_0x7ecd('0x17')],'exten':_0x269e13[_0x7ecd('0xa')],'priority':_0x5b7a91['length']+_0x521ab8['priority']+_0x385cab++,'VoiceExtensionId':_0x269e13['VoiceExtensionId']});}else{_0x668780[_0x7ecd('0x14')]({'type':_0x269e13[_0x7ecd('0x15')],'app':'ExecIf','appdata':_0x7ecd('0x35'),'context':_0x269e13['context'],'exten':_0x269e13[_0x7ecd('0xa')],'priority':_0x5b7a91[_0x7ecd('0x2d')]+_0x521ab8[_0x7ecd('0x10')]+_0x385cab++,'VoiceExtensionId':_0x269e13[_0x7ecd('0x18')]});}}if(_0x269e13[_0x7ecd('0xf')](_0x7ecd('0x36'))){if(_0x2765e9[_0x7ecd('0x37')](_0x269e13[_0x7ecd('0x38')]['toLowerCase']())>=0x0&&_0x269e13[_0x7ecd('0x39')]!==_0x7ecd('0x3a')){if(_0x269e13[_0x7ecd('0x36')]){_0x668780[_0x7ecd('0x14')]({'type':_0x269e13[_0x7ecd('0x15')],'app':_0x7ecd('0x1f'),'appdata':_0x7ecd('0x3b'),'context':_0x269e13[_0x7ecd('0x17')],'exten':_0x269e13[_0x7ecd('0xa')],'priority':_0x5b7a91['length']+_0x521ab8[_0x7ecd('0x10')]+_0x385cab++,'VoiceExtensionId':_0x269e13[_0x7ecd('0x18')]});_0x668780['push']({'type':_0x269e13['type'],'app':_0x7ecd('0x1a'),'appdata':_0x7ecd('0x3c'),'context':_0x269e13[_0x7ecd('0x17')],'exten':_0x269e13[_0x7ecd('0xa')],'priority':_0x5b7a91[_0x7ecd('0x2d')]+_0x521ab8[_0x7ecd('0x10')]+_0x385cab++,'VoiceExtensionId':_0x269e13[_0x7ecd('0x18')]});}else{_0x668780[_0x7ecd('0x14')]({'type':_0x269e13[_0x7ecd('0x15')],'app':_0x7ecd('0x1f'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x269e13[_0x7ecd('0x17')],'exten':_0x269e13[_0x7ecd('0xa')],'priority':_0x5b7a91['length']+_0x521ab8[_0x7ecd('0x10')]+_0x385cab++,'VoiceExtensionId':_0x269e13['VoiceExtensionId']});_0x668780[_0x7ecd('0x14')]({'type':_0x269e13[_0x7ecd('0x15')],'app':_0x7ecd('0x1a'),'appdata':_0x7ecd('0x3d'),'context':_0x269e13[_0x7ecd('0x17')],'exten':_0x269e13[_0x7ecd('0xa')],'priority':_0x5b7a91[_0x7ecd('0x2d')]+_0x521ab8[_0x7ecd('0x10')]+_0x385cab++,'VoiceExtensionId':_0x269e13[_0x7ecd('0x18')]});}}}for(var _0x4be6bb=0x0;_0x4be6bb<_0x5b7a91[_0x7ecd('0x2d')];_0x4be6bb+=0x1){var _0x56edfb=_0x521ab8[_0x7ecd('0x10')]+_0x5b7a91[_0x7ecd('0x2d')];var _0xc273fa=_0x4be6bb===_0x5b7a91['length']-0x1?_0x521ab8[_0x7ecd('0x10')]+_0x668780[_0x7ecd('0x2d')]+_0x2fcca0['length']+0x2:_0x521ab8[_0x7ecd('0x10')]+_0x4be6bb+0x1;_0x668780['splice'](_0x4be6bb,0x0,{'type':_0x269e13['type'],'app':_0x7ecd('0x3e'),'appdata':_0x5b7a91[_0x4be6bb]+'?'+_0x269e13[_0x7ecd('0x17')]+_0x7ecd('0x3f')+_0x56edfb+':'+_0x269e13[_0x7ecd('0x17')]+_0x7ecd('0x3f')+_0xc273fa,'exten':_0x269e13[_0x7ecd('0xa')],'context':_0x269e13[_0x7ecd('0x17')],'priority':_0x521ab8[_0x7ecd('0x10')]+_0x4be6bb,'VoiceExtensionId':_0x1d59d8[_0x8d0c50][0x0][_0x7ecd('0x18')]});}_0x269e13['priority']=_0x668780[_0x7ecd('0x2d')]?_['last'](_0x668780)[_0x7ecd('0x10')]+0x1:_0x521ab8[_0x7ecd('0x10')];_0x521ab8[_0x7ecd('0x10')]=(_0x2fcca0[_0x7ecd('0x2d')]?_[_0x7ecd('0x40')](_0x2fcca0)[_0x7ecd('0x10')]:_0x269e13[_0x7ecd('0x10')])+0x1;_0x521ab8[_0x7ecd('0x11')]=_[_0x7ecd('0x41')](_0x521ab8[_0x7ecd('0x11')],_0x668780,[_0x269e13],_0x2fcca0);}_0x521ab8['extensions'][_0x7ecd('0x14')]({'type':_0x1d59d8[_0x8d0c50][0x0]['type'],'app':_0x7ecd('0x42'),'exten':_0x1d59d8[_0x8d0c50][0x0]['exten'],'context':_0x1d59d8[_0x8d0c50][0x0][_0x7ecd('0x17')],'priority':_0x521ab8['priority'],'VoiceExtensionId':_0x1d59d8[_0x8d0c50][0x0][_0x7ecd('0x18')]});_0x3a5de6[_0x7ecd('0x14')](_0x1d59d8[_0x8d0c50][0x0]['VoiceExtensionId']);_0x170548=_['concat'](_0x170548,_0x521ab8[_0x7ecd('0x11')]);}}return _0x38f4c7['transaction'](function(_0x1e202e){return _0x38f4c7['models'][_0x7ecd('0x7')][_0x7ecd('0x43')]({'where':{'VoiceExtensionId':{'$in':_0x3a5de6}},'transaction':_0x1e202e})['then'](function(_0x5375f3){return _0x38f4c7[_0x7ecd('0x6')][_0x7ecd('0x7')]['bulkCreate'](_[_0x7ecd('0x44')](_0x170548,_0x7ecd('0x10')),{'transaction':_0x1e202e});});});})[_0x7ecd('0x45')](function(_0x3eabc9){console[_0x7ecd('0x46')](_0x3eabc9);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0x79c6=['${EXTEN:','type','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=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','*,*,*,*','interval','map','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','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','Hangup','concat','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','exten','filter','groupBy','playback','hasOwnProperty','priority','extensions','extension','find','Set','format','context','VoiceExtensionId','outbound','push','cutdigits'];(function(_0x4a987d,_0x5783fc){var _0x2524a8=function(_0x2ac7f8){while(--_0x2ac7f8){_0x4a987d['push'](_0x4a987d['shift']());}};_0x2524a8(++_0x5783fc);}(_0x79c6,0x158));var _0x679c=function(_0x30033a,_0x5ce4a6){_0x30033a=_0x30033a-0x0;var _0x5e3518=_0x79c6[_0x30033a];return _0x5e3518;};'use strict';var _=require(_0x679c('0x0'));var util=require(_0x679c('0x1'));function rewrite(_0x43e3bb,_0x4a7364){var _0x226a2e=this;return _0x43e3bb[_0x679c('0x2')][_0x679c('0x3')][_0x679c('0x4')]({'raw':!![]})[_0x679c('0x5')](function(_0x22e27c){_0x226a2e[_0x679c('0x6')]=_0x22e27c;return _0x43e3bb[_0x679c('0x2')][_0x679c('0x7')][_0x679c('0x4')]({'where':{'IntervalId':_0x4a7364[_0x679c('0x8')]},'raw':!![]});})[_0x679c('0x5')](function(_0x160788){return _0x43e3bb[_0x679c('0x2')][_0x679c('0x7')][_0x679c('0x4')]({'where':{'exten':{'$in':_[_0x679c('0x9')](_['map'](_0x160788,_0x679c('0xa')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x679c('0x5')](function(_0x263b05){var _0x2e1d97=_[_0x679c('0xb')](_0x263b05,{'priority':'1'});var _0xa9117d=_[_0x679c('0xb')](_0x263b05,{'isApp':0x1});var _0xca2f44=_[_0x679c('0xc')](_0xa9117d,_0x679c('0xa'));var _0x5964fe=['queue',_0x679c('0xd')];var _0x489cee=[];var _0x572b1b=[];for(var _0x4a753a in _0xca2f44){if(_0xca2f44[_0x679c('0xe')](_0x4a753a)){_0x226a2e[_0x679c('0xf')]=0x2;_0x226a2e[_0x679c('0x10')]=[];_0x226a2e[_0x679c('0x11')]=_[_0x679c('0x12')](_0x2e1d97,{'exten':_0xca2f44[_0x4a753a][0x0][_0x679c('0xa')]});_0x226a2e[_0x679c('0x10')]['push']({'type':_0xca2f44[_0x4a753a][0x0]['type'],'app':_0x679c('0x13'),'appdata':util[_0x679c('0x14')]('CDR(type)=%s',_0xca2f44[_0x4a753a][0x0]['type']),'context':_0xca2f44[_0x4a753a][0x0][_0x679c('0x15')],'exten':_0xca2f44[_0x4a753a][0x0][_0x679c('0xa')],'priority':_0x226a2e[_0x679c('0xf')]++,'VoiceExtensionId':_0xca2f44[_0x4a753a][0x0][_0x679c('0x16')]});if(_0xca2f44[_0x4a753a][0x0]['type']===_0x679c('0x17')){if(_0x226a2e['extension']){_0x226a2e['extensions'][_0x679c('0x18')]({'type':_0xca2f44[_0x4a753a][0x0]['type'],'app':_0x679c('0x13'),'appdata':'CDR(destination)='+(_0x226a2e[_0x679c('0x11')][_0x679c('0x19')]?_0x679c('0x1a')+_0x226a2e[_0x679c('0x11')][_0x679c('0x19')]+'}':'${EXTEN}'),'context':_0xca2f44[_0x4a753a][0x0][_0x679c('0x15')],'exten':_0xca2f44[_0x4a753a][0x0][_0x679c('0xa')],'priority':_0x226a2e[_0x679c('0xf')]++,'VoiceExtensionId':_0xca2f44[_0x4a753a][0x0][_0x679c('0x16')]});}_0x226a2e[_0x679c('0x10')][_0x679c('0x18')]({'type':_0xca2f44[_0x4a753a][0x0][_0x679c('0x1b')],'app':'Set','appdata':_0x679c('0x1c')+_0xca2f44[_0x4a753a][0x0][_0x679c('0x16')],'context':_0xca2f44[_0x4a753a][0x0]['context'],'exten':_0xca2f44[_0x4a753a][0x0][_0x679c('0xa')],'priority':_0x226a2e[_0x679c('0xf')]++,'VoiceExtensionId':_0xca2f44[_0x4a753a][0x0][_0x679c('0x16')]});var _0x5121a2=_0x226a2e[_0x679c('0xf')]++;_0x226a2e[_0x679c('0x10')][_0x679c('0x18')]({'type':_0xca2f44[_0x4a753a][0x0]['type'],'app':_0x679c('0x1d'),'appdata':_0x679c('0x1e')+(_0x5121a2+0x2)+_0x679c('0x1f')+(_0x5121a2+0x1)+')','context':_0xca2f44[_0x4a753a][0x0][_0x679c('0x15')],'exten':_0xca2f44[_0x4a753a][0x0][_0x679c('0xa')],'priority':_0x5121a2,'VoiceExtensionId':_0xca2f44[_0x4a753a][0x0][_0x679c('0x16')]});if(_0x226a2e[_0x679c('0x11')]){_0x226a2e['extensions'][_0x679c('0x18')]({'type':_0xca2f44[_0x4a753a][0x0][_0x679c('0x1b')],'app':_0x679c('0x13'),'appdata':_0x226a2e[_0x679c('0x11')][_0x679c('0x19')]?_0x679c('0x20')+_0x226a2e['extension'][_0x679c('0x19')]+'}':_0x679c('0x21'),'context':_0xca2f44[_0x4a753a][0x0]['context'],'exten':_0xca2f44[_0x4a753a][0x0]['exten'],'priority':_0x226a2e[_0x679c('0xf')]++,'VoiceExtensionId':_0xca2f44[_0x4a753a][0x0]['VoiceExtensionId']});}_0x226a2e[_0x679c('0x10')][_0x679c('0x18')]({'type':_0xca2f44[_0x4a753a][0x0][_0x679c('0x1b')],'app':_0x679c('0x13'),'appdata':_0x679c('0x22')+_0xca2f44[_0x4a753a][0x0]['VoiceExtensionId'],'context':_0xca2f44[_0x4a753a][0x0][_0x679c('0x15')],'exten':_0xca2f44[_0x4a753a][0x0]['exten'],'priority':_0x226a2e['priority']++,'VoiceExtensionId':_0xca2f44[_0x4a753a][0x0][_0x679c('0x16')]});if(_0x226a2e['extension']&&_0x226a2e[_0x679c('0x11')][_0x679c('0xe')](_0x679c('0x23'))&&_0x226a2e[_0x679c('0x11')][_0x679c('0x23')]!==_0x679c('0x24')){_0x226a2e[_0x679c('0x10')][_0x679c('0x18')]({'type':_0xca2f44[_0x4a753a][0x0][_0x679c('0x1b')],'app':_0x679c('0x13'),'appdata':_0x679c('0x25'),'context':_0xca2f44[_0x4a753a][0x0][_0x679c('0x15')],'exten':_0xca2f44[_0x4a753a][0x0]['exten'],'priority':_0x226a2e[_0x679c('0xf')]++,'VoiceExtensionId':_0xca2f44[_0x4a753a][0x0][_0x679c('0x16')]});_0x226a2e[_0x679c('0x10')][_0x679c('0x18')]({'type':_0xca2f44[_0x4a753a][0x0][_0x679c('0x1b')],'app':_0x679c('0x13'),'appdata':_0x679c('0x26')+_0x226a2e[_0x679c('0x11')]['recordingFormat']||_0x679c('0x27'),'context':_0xca2f44[_0x4a753a][0x0][_0x679c('0x15')],'exten':_0xca2f44[_0x4a753a][0x0]['exten'],'priority':_0x226a2e[_0x679c('0xf')]++,'VoiceExtensionId':_0xca2f44[_0x4a753a][0x0][_0x679c('0x16')]});}}_0x226a2e[_0x679c('0x10')][_0x679c('0x18')]({'type':_0xca2f44[_0x4a753a][0x0][_0x679c('0x1b')],'app':_0x679c('0x13'),'appdata':_0x679c('0x28'),'context':_0xca2f44[_0x4a753a][0x0]['context'],'exten':_0xca2f44[_0x4a753a][0x0][_0x679c('0xa')],'priority':_0x226a2e[_0x679c('0xf')]++,'VoiceExtensionId':_0xca2f44[_0x4a753a][0x0][_0x679c('0x16')]});_0x226a2e[_0x679c('0x10')][_0x679c('0x18')]({'type':_0xca2f44[_0x4a753a][0x0]['type'],'app':_0x679c('0x13'),'appdata':_0x679c('0x29'),'context':_0xca2f44[_0x4a753a][0x0]['context'],'exten':_0xca2f44[_0x4a753a][0x0]['exten'],'priority':_0x226a2e[_0x679c('0xf')]++,'VoiceExtensionId':_0xca2f44[_0x4a753a][0x0][_0x679c('0x16')]});_0x226a2e[_0x679c('0x10')][_0x679c('0x18')]({'type':_0xca2f44[_0x4a753a][0x0]['type'],'app':_0x679c('0x13'),'appdata':_0x679c('0x2a'),'context':_0xca2f44[_0x4a753a][0x0][_0x679c('0x15')],'exten':_0xca2f44[_0x4a753a][0x0][_0x679c('0xa')],'priority':_0x226a2e[_0x679c('0xf')]++,'VoiceExtensionId':_0xca2f44[_0x4a753a][0x0][_0x679c('0x16')]});for(var _0x306bcf=0x0,_0xccd8ee=0x0;_0x306bcf<_0xca2f44[_0x4a753a][_0x679c('0x2b')];_0x306bcf+=0x1,_0xccd8ee=0x0){var _0x442659=_0xca2f44[_0x4a753a][_0x306bcf];if(_0x442659['type']){_0x442659[_0x679c('0x1b')]=_0x442659[_0x679c('0x1b')][_0x679c('0x2c')]();}var _0x524b9a=[];var _0x3f500f=[];delete _0x442659['id'];delete _0x442659[_0x679c('0x2d')];delete _0x442659[_0x679c('0x2e')];var _0x3f055d=_0x442659['interval']!==_0x679c('0x2f')?[_0x442659[_0x679c('0x30')]]:_0x442659[_0x679c('0x8')]?_[_0x679c('0x31')](_[_0x679c('0xb')](_0x226a2e[_0x679c('0x6')],{'IntervalId':_0x442659[_0x679c('0x8')]}),_0x679c('0x30')):[];if(_0x442659[_0x679c('0xe')](_0x679c('0x32'))){if(_0x442659[_0x679c('0x32')]&&_0x442659['tag']!=='--'){_0x524b9a[_0x679c('0x18')]({'type':_0x442659[_0x679c('0x1b')],'app':_0x679c('0x13'),'appdata':'CDR(tag)='+_0x442659[_0x679c('0x32')],'context':_0x442659['context'],'exten':_0x442659['exten'],'priority':_0x3f055d[_0x679c('0x2b')]+_0x226a2e[_0x679c('0xf')]+_0xccd8ee++,'VoiceExtensionId':_0x442659[_0x679c('0x16')]});}}if(_0x442659[_0x679c('0x1b')]===_0x679c('0x17')&&_0x442659['hasOwnProperty'](_0x679c('0x33'))){if(_0x442659['callerID']){_0x524b9a[_0x679c('0x18')]({'type':_0x442659[_0x679c('0x1b')],'app':_0x679c('0x1d'),'appdata':_0x679c('0x34')+_0x442659['callerID']+')','context':_0x442659[_0x679c('0x15')],'exten':_0x442659[_0x679c('0xa')],'priority':_0x3f055d[_0x679c('0x2b')]+_0x226a2e['priority']+_0xccd8ee++,'VoiceExtensionId':_0x442659[_0x679c('0x16')]});}else{_0x524b9a['push']({'type':_0x442659[_0x679c('0x1b')],'app':'ExecIf','appdata':_0x679c('0x35'),'context':_0x442659[_0x679c('0x15')],'exten':_0x442659['exten'],'priority':_0x3f055d[_0x679c('0x2b')]+_0x226a2e[_0x679c('0xf')]+_0xccd8ee++,'VoiceExtensionId':_0x442659[_0x679c('0x16')]});}}if(_0x442659['hasOwnProperty'](_0x679c('0x36'))){if(_0x5964fe['indexOf'](_0x442659[_0x679c('0x37')][_0x679c('0x2c')]())>=0x0&&_0x442659[_0x679c('0x38')]!==_0x679c('0x39')){if(_0x442659[_0x679c('0x36')]){_0x524b9a[_0x679c('0x18')]({'type':_0x442659['type'],'app':_0x679c('0x1d'),'appdata':_0x679c('0x3a'),'context':_0x442659[_0x679c('0x15')],'exten':_0x442659[_0x679c('0xa')],'priority':_0x3f055d['length']+_0x226a2e[_0x679c('0xf')]+_0xccd8ee++,'VoiceExtensionId':_0x442659['VoiceExtensionId']});_0x524b9a[_0x679c('0x18')]({'type':_0x442659[_0x679c('0x1b')],'app':_0x679c('0x13'),'appdata':_0x679c('0x3b'),'context':_0x442659[_0x679c('0x15')],'exten':_0x442659[_0x679c('0xa')],'priority':_0x3f055d[_0x679c('0x2b')]+_0x226a2e[_0x679c('0xf')]+_0xccd8ee++,'VoiceExtensionId':_0x442659[_0x679c('0x16')]});}else{_0x524b9a['push']({'type':_0x442659[_0x679c('0x1b')],'app':'ExecIf','appdata':_0x679c('0x3c'),'context':_0x442659[_0x679c('0x15')],'exten':_0x442659[_0x679c('0xa')],'priority':_0x3f055d[_0x679c('0x2b')]+_0x226a2e[_0x679c('0xf')]+_0xccd8ee++,'VoiceExtensionId':_0x442659[_0x679c('0x16')]});_0x524b9a[_0x679c('0x18')]({'type':_0x442659[_0x679c('0x1b')],'app':_0x679c('0x13'),'appdata':_0x679c('0x3d'),'context':_0x442659[_0x679c('0x15')],'exten':_0x442659[_0x679c('0xa')],'priority':_0x3f055d[_0x679c('0x2b')]+_0x226a2e[_0x679c('0xf')]+_0xccd8ee++,'VoiceExtensionId':_0x442659[_0x679c('0x16')]});}}}for(var _0x2dd7f1=0x0;_0x2dd7f1<_0x3f055d[_0x679c('0x2b')];_0x2dd7f1+=0x1){var _0x378217=_0x226a2e[_0x679c('0xf')]+_0x3f055d['length'];var _0x38a104=_0x2dd7f1===_0x3f055d['length']-0x1?_0x226a2e['priority']+_0x524b9a[_0x679c('0x2b')]+_0x3f500f[_0x679c('0x2b')]+0x2:_0x226a2e[_0x679c('0xf')]+_0x2dd7f1+0x1;_0x524b9a[_0x679c('0x3e')](_0x2dd7f1,0x0,{'type':_0x442659['type'],'app':_0x679c('0x3f'),'appdata':_0x3f055d[_0x2dd7f1]+'?'+_0x442659[_0x679c('0x15')]+_0x679c('0x40')+_0x378217+':'+_0x442659[_0x679c('0x15')]+',${EXTEN},'+_0x38a104,'exten':_0x442659[_0x679c('0xa')],'context':_0x442659[_0x679c('0x15')],'priority':_0x226a2e[_0x679c('0xf')]+_0x2dd7f1,'VoiceExtensionId':_0xca2f44[_0x4a753a][0x0][_0x679c('0x16')]});}_0x442659['priority']=_0x524b9a[_0x679c('0x2b')]?_[_0x679c('0x41')](_0x524b9a)['priority']+0x1:_0x226a2e[_0x679c('0xf')];_0x226a2e[_0x679c('0xf')]=(_0x3f500f['length']?_[_0x679c('0x41')](_0x3f500f)['priority']:_0x442659['priority'])+0x1;_0x226a2e[_0x679c('0x10')]=_['concat'](_0x226a2e['extensions'],_0x524b9a,[_0x442659],_0x3f500f);}_0x226a2e[_0x679c('0x10')][_0x679c('0x18')]({'type':_0xca2f44[_0x4a753a][0x0]['type'],'app':_0x679c('0x42'),'exten':_0xca2f44[_0x4a753a][0x0][_0x679c('0xa')],'context':_0xca2f44[_0x4a753a][0x0]['context'],'priority':_0x226a2e['priority'],'VoiceExtensionId':_0xca2f44[_0x4a753a][0x0][_0x679c('0x16')]});_0x489cee[_0x679c('0x18')](_0xca2f44[_0x4a753a][0x0][_0x679c('0x16')]);_0x572b1b=_[_0x679c('0x43')](_0x572b1b,_0x226a2e['extensions']);}}return _0x43e3bb['transaction'](function(_0x8f572d){return _0x43e3bb['models'][_0x679c('0x7')][_0x679c('0x44')]({'where':{'VoiceExtensionId':{'$in':_0x489cee}},'transaction':_0x8f572d})[_0x679c('0x5')](function(_0x115238){return _0x43e3bb[_0x679c('0x2')][_0x679c('0x7')][_0x679c('0x45')](_[_0x679c('0x46')](_0x572b1b,'priority'),{'transaction':_0x8f572d});});});})[_0x679c('0x47')](function(_0x42e342){console[_0x679c('0x48')](_0x42e342);});}exports[_0x679c('0x49')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 4e1d9c5..d4a6bcf 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 _0xe706=['toString','ListId','from','cm_contacts','deletedAt\x20IS\x20NULL','where','ListId\x20=\x20?','insert','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','\x20=\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','CmList','Lists','get','dialCheckDuplicateType','always','push','sequelize','VoiceQueueId','catch','onlyIfOpen','query','all','Campaign','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resume','resolve','emit','Unable\x20to\x20delete\x20temp\x20file:','info','CSV\x20import\x20process\x20stopped!','split','parse','pause','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','pick','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()'];(function(_0x5523e5,_0x1b347c){var _0x585f57=function(_0x4b1418){while(--_0x4b1418){_0x5523e5['push'](_0x5523e5['shift']());}};_0x585f57(++_0x1b347c);}(_0xe706,0xa3));var _0x6e70=function(_0x2aefb6,_0x1bd384){_0x2aefb6=_0x2aefb6-0x0;var _0x202772=_0xe706[_0x2aefb6];return _0x202772;};'use strict';var BPromise=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var _=require(_0x6e70('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var socket=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));require(_0x6e70('0xd'))[_0x6e70('0xe')](socket);try{if(!process[_0x6e70('0xf')][0x2]||process[_0x6e70('0xf')][0x2]===_0x6e70('0x10')||process[_0x6e70('0xf')][0x2]===_0x6e70('0x11')){throw new Error(_0x6e70('0x12'));}var FILEPATH=process[_0x6e70('0xf')][0x2];if(!process[_0x6e70('0xf')][0x3]||process[_0x6e70('0xf')][0x3]===_0x6e70('0x10')||process['argv'][0x3]==='null'||!process[_0x6e70('0xf')][0x4]||process[_0x6e70('0xf')][0x4]===_0x6e70('0x10')||process[_0x6e70('0xf')][0x4]===_0x6e70('0x11')){throw new Error(_0x6e70('0x13'));}var FIELDS=_[_0x6e70('0x14')](process[_0x6e70('0xf')][0x3]['split'](','),process['argv'][0x4]['split'](','));if(!process[_0x6e70('0xf')][0x5]||process['argv'][0x5]==='undefined'||process[_0x6e70('0xf')][0x5]===_0x6e70('0x11')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x6e70('0xf')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x6e70('0xf')][0x6]!==_0x6e70('0x10')&&process['argv'][0x6]!=='null'?process[_0x6e70('0xf')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x6e70('0xf')][0x7]!==_0x6e70('0x10')&&process['argv'][0x7]!=='null'?process[_0x6e70('0xf')][0x7]:null;if(!process[_0x6e70('0xf')][0x8]||process[_0x6e70('0xf')][0x8]===_0x6e70('0x10')||process[_0x6e70('0xf')][0x8]===_0x6e70('0x11')){throw new Error(_0x6e70('0x15'));}var SOCKET_TIMESTAMP=process[_0x6e70('0xf')][0x8];}catch(_0x29326f){logger[_0x6e70('0x16')](_0x29326f);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(_0x4a0cfe,_0x228350,_0x344b65,_0x27b294){var _0x502b2d={'message':_0x228350};_0x502b2d[_0x4a0cfe]=!![];if(_0x344b65){_0x502b2d[_0x6e70('0x17')]=_0x344b65;}if(_0x27b294){_0x502b2d[_0x6e70('0x18')]=_0x27b294;}return _0x502b2d;}function isEmail(_0x3337a6){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x3337a6);}function checkRow(_0x10fc91,_0x538b9c,_0x50aec2){return new BPromise(function(_0x4e97c7,_0x41e352){if(_[_0x6e70('0x19')](_0x10fc91)){return _0x41e352(handleCheckRowError('error',_0x6e70('0x1a'),null,_0x50aec2));}if(_0x10fc91[_0x6e70('0x1b')]&&_0x10fc91['errors'][_0x6e70('0x1c')]){var _0x67fb43=_[_0x6e70('0x1d')](_0x10fc91['errors'],'message')[_0x6e70('0x1e')](';');return _0x41e352(handleCheckRowError(_0x6e70('0x16'),_0x67fb43,null,_0x50aec2));}var _0x83c836={};for(var _0x114344 in FIELDS){if(FIELDS[_0x6e70('0x1f')](_0x114344)&&FIELDS[_0x114344]){_0x83c836[_0x114344]=_0x10fc91['data'][0x0][FIELDS[_0x114344]]||_0x10fc91[_0x6e70('0x20')][0x0]['\ufeff'+FIELDS[_0x114344]];}}if(!_0x83c836[_0x6e70('0x21')]){return _0x41e352(handleCheckRowError(_0x6e70('0x16'),_0x6e70('0x22'),null,_0x50aec2));}if(!_0x83c836[_0x6e70('0x23')]){return _0x41e352(handleCheckRowError(_0x6e70('0x16'),_0x6e70('0x24'),null,_0x50aec2));}if(_0x83c836[_0x6e70('0x25')]){var _0x3a0821=moment(_0x83c836[_0x6e70('0x25')],'YYYY-MM-DD');if(!_0x3a0821[_0x6e70('0x26')]()){return _0x41e352(handleCheckRowError('error',_0x6e70('0x27'),null,_0x50aec2));}}if(_0x83c836['email']){if(!isEmail(_0x83c836[_0x6e70('0x28')])){return _0x41e352(handleCheckRowError(_0x6e70('0x16'),_0x6e70('0x29'),null,_0x50aec2));}}_0x83c836['ListId']=LISTID;_0x83c836[_0x6e70('0x2a')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x6e70('0x1c')]&&_0x538b9c){var _0x5780a1={};for(var _0x13d673=0x0,_0x154925=DUPLICATES['length'];_0x13d673<_0x154925;_0x13d673+=0x1){_0x5780a1[DUPLICATES[_0x13d673]]=_0x83c836[DUPLICATES[_0x13d673]];}var _0x10d8f6=_[_0x6e70('0x2b')](_0x538b9c,_0x5780a1);if(_0x10d8f6){return _0x41e352(handleCheckRowError(_0x6e70('0x2c'),_0x6e70('0x2d'),_0x10d8f6,_0x50aec2));}}return db[_0x6e70('0x2e')][_0x6e70('0x2f')](_0x83c836,{'raw':!![],'hooks':![],'fields':_[_0x6e70('0x30')](_0x83c836)})[_0x6e70('0x31')](function(_0xf146fd){if(DUPLICATES&&DUPLICATES[_0x6e70('0x1c')]&&_0x538b9c){_0x538b9c['push'](_[_0x6e70('0x32')](_0x83c836,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xf146fd['id'];return _0x4e97c7();})['catch'](function(_0x23cd1a){return _0x41e352(handleCheckRowError(_0x6e70('0x16'),_0x6e70('0x33')+(_0x23cd1a[_0x6e70('0x34')]||JSON[_0x6e70('0x35')](_0x23cd1a)),null,_0x50aec2));});});}function checkHopper(){function _0x989b80(){return function(_0x2440be){logger[_0x6e70('0x16')](_0x6e70('0x36'),_0x6e70('0x37'),util[_0x6e70('0x38')](_0x2440be,{'showHidden':![],'depth':null}));};}var _0x23d5e2=function(_0x5594d3,_0x501b53){var _0x5446a2=squel['insert']()[_0x6e70('0x39')](_0x6e70('0x3a'))[_0x6e70('0x3b')]([_0x6e70('0x23'),_0x6e70('0x3c'),_0x6e70('0x3d'),'ListId',_0x501b53,_0x6e70('0x3e'),_0x6e70('0x3f')],squel[_0x6e70('0x40')]()[_0x6e70('0x41')](_0x6e70('0x23'),_0x6e70('0x23'))[_0x6e70('0x41')](_0x6e70('0x42'),'scheduledAt')[_0x6e70('0x41')]('id',_0x6e70('0x3d'))[_0x6e70('0x41')](LISTID[_0x6e70('0x43')](),_0x6e70('0x44'))[_0x6e70('0x41')](_0x5594d3['id'][_0x6e70('0x43')](),_0x501b53)['field']('NOW()','createdAt')[_0x6e70('0x41')](_0x6e70('0x42'),_0x6e70('0x3f'))[_0x6e70('0x45')](_0x6e70('0x46'))['where'](_0x6e70('0x47'))[_0x6e70('0x48')](_0x6e70('0x49'),LISTID['toString']())['where']('phone\x20IS\x20NOT\x20NULL')[_0x6e70('0x48')]('phone\x20NOT\x20IN\x20(?)',squel[_0x6e70('0x40')]()[_0x6e70('0x41')](_0x6e70('0x23'))[_0x6e70('0x45')]('cm_hopper')[_0x6e70('0x48')](_0x501b53+'\x20=\x20?',_0x5594d3['id'][_0x6e70('0x43')]())))[_0x6e70('0x43')]();return _0x5446a2;};var _0x2dafb5=function(_0x3478e2,_0x5bbc3a){var _0x291de6=squel[_0x6e70('0x4a')]()[_0x6e70('0x39')](_0x6e70('0x3a'))[_0x6e70('0x3b')]([_0x6e70('0x23'),_0x6e70('0x3c'),'ContactId',_0x6e70('0x44'),_0x5bbc3a,_0x6e70('0x3e'),_0x6e70('0x3f')],squel[_0x6e70('0x40')]()[_0x6e70('0x41')](_0x6e70('0x23'),_0x6e70('0x23'))['field'](_0x6e70('0x42'),'scheduledAt')[_0x6e70('0x41')]('id',_0x6e70('0x3d'))['field'](LISTID['toString'](),_0x6e70('0x44'))[_0x6e70('0x41')](_0x3478e2['id'][_0x6e70('0x43')](),_0x5bbc3a)['field']('NOW()',_0x6e70('0x3e'))[_0x6e70('0x41')](_0x6e70('0x42'),_0x6e70('0x3f'))[_0x6e70('0x45')](_0x6e70('0x46'))['where'](_0x6e70('0x47'))[_0x6e70('0x48')](_0x6e70('0x49'),LISTID[_0x6e70('0x43')]())[_0x6e70('0x48')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x6e70('0x48')](_0x6e70('0x4b'))[_0x6e70('0x48')](_0x6e70('0x4c'),squel[_0x6e70('0x40')]()['field'](_0x6e70('0x4d'))[_0x6e70('0x45')](_0x6e70('0x4e'))[_0x6e70('0x48')](_0x5bbc3a+_0x6e70('0x4f'),_0x3478e2['id']['toString']()))[_0x6e70('0x48')](_0x6e70('0x4c'),squel[_0x6e70('0x40')]()[_0x6e70('0x41')](_0x6e70('0x23'))[_0x6e70('0x45')]('cm_hopper')[_0x6e70('0x48')](_0x5bbc3a+_0x6e70('0x4f'),_0x3478e2['id']['toString']())))[_0x6e70('0x43')]();return _0x291de6;};function _0xebe5f7(_0x54efdf,_0x3cfaa9){var _0xb3f06c=squel[_0x6e70('0x4a')]()[_0x6e70('0x39')](_0x6e70('0x3a'))['fromQuery']([_0x6e70('0x23'),_0x6e70('0x3c'),_0x6e70('0x3d'),_0x6e70('0x44'),_0x3cfaa9,_0x6e70('0x3e'),_0x6e70('0x3f')],squel[_0x6e70('0x40')]()[_0x6e70('0x41')](_0x6e70('0x23'),_0x6e70('0x23'))[_0x6e70('0x41')](_0x6e70('0x42'),_0x6e70('0x3c'))[_0x6e70('0x41')]('id',_0x6e70('0x3d'))[_0x6e70('0x41')](LISTID[_0x6e70('0x43')](),_0x6e70('0x44'))[_0x6e70('0x41')](_0x54efdf['id'][_0x6e70('0x43')](),_0x3cfaa9)['field'](_0x6e70('0x42'),_0x6e70('0x3e'))[_0x6e70('0x41')](_0x6e70('0x42'),_0x6e70('0x3f'))[_0x6e70('0x45')]('cm_contacts')[_0x6e70('0x48')](_0x6e70('0x47'))['where'](_0x6e70('0x49'),LISTID[_0x6e70('0x43')]())[_0x6e70('0x48')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x6e70('0x48')](_0x6e70('0x4b')))[_0x6e70('0x43')]();return _0xb3f06c;}function _0x41a861(_0x10d299,_0x739946){var _0x30cd88=squel['insert']()['into'](_0x6e70('0x50'))[_0x6e70('0x3b')]([_0x6e70('0x23'),_0x6e70('0x3d'),'ListId',_0x739946,'createdAt',_0x6e70('0x3f')],squel[_0x6e70('0x40')]()['field']('phone',_0x6e70('0x23'))['field']('id',_0x6e70('0x3d'))[_0x6e70('0x41')](LISTID[_0x6e70('0x43')](),_0x6e70('0x44'))[_0x6e70('0x41')](_0x10d299['id'][_0x6e70('0x43')](),_0x739946)[_0x6e70('0x41')](_0x6e70('0x42'),'createdAt')[_0x6e70('0x41')](_0x6e70('0x42'),_0x6e70('0x3f'))[_0x6e70('0x45')](_0x6e70('0x46'))['where']('deletedAt\x20IS\x20NULL')['where'](_0x6e70('0x49'),LISTID[_0x6e70('0x43')]())[_0x6e70('0x48')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x6e70('0x48')](_0x6e70('0x4b')))[_0x6e70('0x43')]();return _0x30cd88;}return db[_0x6e70('0x51')][_0x6e70('0x52')]({'where':{'type':_0x6e70('0x53')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x6e70('0x54')],'as':_0x6e70('0x55'),'where':{'id':LISTID}}]})[_0x6e70('0x31')](function(_0x82a9a){var _0x515c0c=[];if(_0x82a9a){var _0xce964b;for(var _0x531097=0x0,_0x5b4046;_0x531097<_0x82a9a[_0x6e70('0x1c')];_0x531097+=0x1){_0x5b4046=_0x82a9a[_0x531097][_0x6e70('0x56')]({'plain':!![]});switch(_0x5b4046[_0x6e70('0x57')]){case _0x6e70('0x58'):_0x515c0c[_0x6e70('0x59')](db[_0x6e70('0x5a')]['query'](_0x2dafb5(_0x5b4046,_0x6e70('0x5b')))[_0x6e70('0x31')](function(){})[_0x6e70('0x5c')](_0x989b80()));break;case _0x6e70('0x5d'):_0x515c0c[_0x6e70('0x59')](db[_0x6e70('0x5a')][_0x6e70('0x5e')](_0x23d5e2(_0x5b4046,_0x6e70('0x5b')))[_0x6e70('0x31')](function(){})[_0x6e70('0x5c')](_0x989b80()));break;default:_0x515c0c['push'](db[_0x6e70('0x5a')][_0x6e70('0x5e')](_0xebe5f7(_0x5b4046,_0x6e70('0x5b')))['then'](function(){})['catch'](_0x989b80()));}}}return _0x515c0c;})[_0x6e70('0x5f')]()[_0x6e70('0x31')](function(){return db[_0x6e70('0x51')][_0x6e70('0x52')]({'where':{'type':_0x6e70('0x53')},'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0x6e70('0x31')](function(_0x241a21){var _0x56d4d9=[];if(_0x241a21){var _0x58666a;for(var _0x1c7c5f=0x0,_0xf7a034;_0x1c7c5f<_0x241a21[_0x6e70('0x1c')];_0x1c7c5f+=0x1){_0xf7a034=_0x241a21[_0x1c7c5f][_0x6e70('0x56')]({'plain':!![]});_0x56d4d9[_0x6e70('0x59')](db[_0x6e70('0x5a')][_0x6e70('0x5e')](_0x41a861(_0xf7a034,_0x6e70('0x5b')))[_0x6e70('0x31')](function(){})[_0x6e70('0x5c')](_0x989b80()));}}return _0x56d4d9;})[_0x6e70('0x5f')]();})[_0x6e70('0x31')](function(){return db[_0x6e70('0x60')]['findAll']({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x6e70('0x54')],'as':'Lists','where':{'id':LISTID}}]})[_0x6e70('0x31')](function(_0x4b2d40){var _0x5b5471=[];if(_0x4b2d40){for(var _0x402f6f=0x0,_0x48e04b;_0x402f6f<_0x4b2d40['length'];_0x402f6f+=0x1){_0x48e04b=_0x4b2d40[_0x402f6f][_0x6e70('0x56')]({'plain':!![]});switch(_0x48e04b[_0x6e70('0x57')]){case _0x6e70('0x58'):_0x5b5471['push'](db['sequelize']['query'](_0x2dafb5(_0x48e04b,_0x6e70('0x61')))['then'](function(){})[_0x6e70('0x5c')](_0x989b80()));break;case _0x6e70('0x5d'):_0x5b5471[_0x6e70('0x59')](db[_0x6e70('0x5a')][_0x6e70('0x5e')](_0x23d5e2(_0x48e04b,_0x6e70('0x61')))[_0x6e70('0x31')](function(){})['catch'](_0x989b80()));break;default:_0x5b5471[_0x6e70('0x59')](db[_0x6e70('0x5a')][_0x6e70('0x5e')](_0xebe5f7(_0x48e04b,'CampaignId'))[_0x6e70('0x31')](function(){})[_0x6e70('0x5c')](_0x989b80()));}}}return _0x5b5471;})[_0x6e70('0x5f')]();})[_0x6e70('0x31')](function(){return db[_0x6e70('0x60')][_0x6e70('0x52')]({'attributes':['id'],'include':[{'model':db[_0x6e70('0x54')],'as':_0x6e70('0x62'),'where':{'id':LISTID}}]})[_0x6e70('0x31')](function(_0x48f6fd){var _0x463eed=[];if(_0x48f6fd){for(var _0x39e6db=0x0,_0x53acc8;_0x39e6db<_0x48f6fd[_0x6e70('0x1c')];_0x39e6db+=0x1){_0x53acc8=_0x48f6fd[_0x39e6db][_0x6e70('0x56')]({'plain':!![]});_0x463eed['push'](db['sequelize'][_0x6e70('0x5e')](_0x41a861(_0x53acc8,'CampaignId'))[_0x6e70('0x31')](function(){})['catch'](_0x989b80()));}}return _0x463eed;})[_0x6e70('0x5f')]();})[_0x6e70('0x5c')](function(_0x106f32){logger[_0x6e70('0x16')](_0x6e70('0x63'),_0x6e70('0x64'),_0x106f32[_0x6e70('0x34')]);});}var processPromises=function(_0x5afbf5){return BPromise['all'](promises)[_0x6e70('0x31')](function(_0x4bf451){})[_0x6e70('0x5c')](function(_0xa2a4d5){logger[_0x6e70('0x16')](_0x6e70('0x65'),JSON['stringify'](_0xa2a4d5));})[_0x6e70('0x66')](function(){socket['emit'](_0x6e70('0x67')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x5afbf5){return _0x5afbf5[_0x6e70('0x68')]();}});};var endCsv=function(){return BPromise[_0x6e70('0x69')]()[_0x6e70('0x31')](function(){if(hopperContacts){return checkHopper();}})[_0x6e70('0x31')](function(){socket[_0x6e70('0x6a')](_0x6e70('0x67')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x1d6acf){logger['error'](_0x6e70('0x6b'),JSON['stringify'](_0x1d6acf));}finally{process['exit'](0x0);}});};process['on']('SIGINT',function(){logger[_0x6e70('0x6c')](_0x6e70('0x6d'));endCsv();});function main(){return BPromise[_0x6e70('0x69')]()[_0x6e70('0x31')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x6e70('0x6e')](',');return db['CmContact'][_0x6e70('0x52')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x6e70('0x31')](function(_0x48c30c){var _0x3c2d33=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x6e70('0x6f')](_0x3c2d33,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5d0585,_0x4a87e2){total+=0x1;var _0x25f60c=total;promises[_0x6e70('0x59')](checkRow(_0x5d0585,_0x48c30c,_0x25f60c)[_0x6e70('0x31')](function(){success+=0x1;})[_0x6e70('0x5c')](function(_0x3e6661){if(_0x3e6661[_0x6e70('0x16')]){errors+=0x1;delete _0x3e6661[_0x6e70('0x16')];}else if(_0x3e6661['duplicate']){duplicates+=0x1;delete _0x3e6661[_0x6e70('0x2c')];}rows['push'](_0x3e6661);}));if(total%0xc8===0x0){_0x4a87e2[_0x6e70('0x70')]();return processPromises(_0x4a87e2);}},'complete':function(){return processPromises()[_0x6e70('0x31')](function(){logger[_0x6e70('0x6c')](_0x6e70('0x71'));endCsv();});},'error':function(_0x4764d5,_0x41b7de){logger[_0x6e70('0x6c')]('CSV\x20parse\x20error',JSON[_0x6e70('0x35')](_0x4764d5));endCsv();}});})['catch'](function(_0x27bdf2){logger[_0x6e70('0x16')](_0x6e70('0x72'),JSON[_0x6e70('0x35')](_0x27bdf2));});}main(); \ No newline at end of file +var _0x0713=['papaparse','ioredis','../../../mysqldb','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','error','contact','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email\x20format\x20is\x20not\x20valid!','ListId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','insert','fromQuery','phone','scheduledAt','updatedAt','field','NOW()','ContactId','toString','createdAt','from','ListId\x20=\x20?','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','cm_hopper','\x20=\x20?','into','deletedAt\x20IS\x20NULL','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','cm_contacts','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','get','sequelize','query','VoiceQueueId','onlyIfOpen','push','all','CmList','Campaign','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','lodash','squel'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x3071('0x0'));var fs=require('fs');var squel=require(_0x3071('0x1'));var Papa=require(_0x3071('0x2'));var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var config=require('../../../config/environment');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));config[_0x3071('0x7')]=_[_0x3071('0x8')](config[_0x3071('0x7')],{'host':_0x3071('0x9'),'port':0x18eb});var socket=require(_0x3071('0xa'))(new Redis(config[_0x3071('0x7')]));require(_0x3071('0xb'))[_0x3071('0xc')](socket);try{if(!process[_0x3071('0xd')][0x2]||process[_0x3071('0xd')][0x2]===_0x3071('0xe')||process['argv'][0x2]===_0x3071('0xf')){throw new Error(_0x3071('0x10'));}var FILEPATH=process[_0x3071('0xd')][0x2];if(!process[_0x3071('0xd')][0x3]||process[_0x3071('0xd')][0x3]==='undefined'||process[_0x3071('0xd')][0x3]===_0x3071('0xf')||!process[_0x3071('0xd')][0x4]||process[_0x3071('0xd')][0x4]===_0x3071('0xe')||process['argv'][0x4]==='null'){throw new Error(_0x3071('0x11'));}var FIELDS=_['zipObject'](process[_0x3071('0xd')][0x3][_0x3071('0x12')](','),process['argv'][0x4][_0x3071('0x12')](','));if(!process['argv'][0x5]||process[_0x3071('0xd')][0x5]===_0x3071('0xe')||process[_0x3071('0xd')][0x5]===_0x3071('0xf')){throw new Error(_0x3071('0x13'));}var LISTID=process[_0x3071('0xd')][0x5];var COMPANYID=process[_0x3071('0xd')][0x6]&&process[_0x3071('0xd')][0x6]!==_0x3071('0xe')&&process[_0x3071('0xd')][0x6]!=='null'?process[_0x3071('0xd')][0x6]:null;var DUPLICATES=process[_0x3071('0xd')][0x7]&&process[_0x3071('0xd')][0x7]!==_0x3071('0xe')&&process[_0x3071('0xd')][0x7]!==_0x3071('0xf')?process[_0x3071('0xd')][0x7]:null;if(!process[_0x3071('0xd')][0x8]||process['argv'][0x8]===_0x3071('0xe')||process[_0x3071('0xd')][0x8]===_0x3071('0xf')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x3071('0xd')][0x8];}catch(_0x5cd80d){logger[_0x3071('0x14')](_0x5cd80d);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x43128c,_0x3762d8,_0x457b57,_0x33090c){var _0x34c50e={'message':_0x3762d8};_0x34c50e[_0x43128c]=!![];if(_0x457b57){_0x34c50e[_0x3071('0x15')]=_0x457b57;}if(_0x33090c){_0x34c50e[_0x3071('0x16')]=_0x33090c;}return _0x34c50e;}function isEmail(_0x542646){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x542646);}function checkRow(_0x2ce48a,_0xb05b1d,_0x412652){return new BPromise(function(_0x13df9f,_0x2793ef){if(_[_0x3071('0x17')](_0x2ce48a)){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x18'),null,_0x412652));}if(_0x2ce48a[_0x3071('0x19')]&&_0x2ce48a['errors'][_0x3071('0x1a')]){var _0x3f1e6e=_[_0x3071('0x1b')](_0x2ce48a['errors'],_0x3071('0x1c'))[_0x3071('0x1d')](';');return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3f1e6e,null,_0x412652));}var _0x950fde={};for(var _0x3fa3b8 in FIELDS){if(FIELDS[_0x3071('0x1e')](_0x3fa3b8)&&FIELDS[_0x3fa3b8]){_0x950fde[_0x3fa3b8]=_0x2ce48a[_0x3071('0x1f')][0x0][FIELDS[_0x3fa3b8]]||_0x2ce48a[_0x3071('0x1f')][0x0]['\ufeff'+FIELDS[_0x3fa3b8]];}}if(!_0x950fde[_0x3071('0x20')]){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x21'),null,_0x412652));}if(!_0x950fde['phone']){return _0x2793ef(handleCheckRowError('error',_0x3071('0x22'),null,_0x412652));}if(_0x950fde[_0x3071('0x23')]){var _0x6ddf96=moment(_0x950fde[_0x3071('0x23')],_0x3071('0x24'));if(!_0x6ddf96[_0x3071('0x25')]()){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x26'),null,_0x412652));}}if(_0x950fde['email']){if(!isEmail(_0x950fde['email'])){return _0x2793ef(handleCheckRowError('error',_0x3071('0x27'),null,_0x412652));}}_0x950fde[_0x3071('0x28')]=LISTID;_0x950fde['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x3071('0x1a')]&&_0xb05b1d){var _0x28747d={};for(var _0x25250e=0x0,_0x13ae2c=DUPLICATES['length'];_0x25250e<_0x13ae2c;_0x25250e+=0x1){_0x28747d[DUPLICATES[_0x25250e]]=_0x950fde[DUPLICATES[_0x25250e]];}var _0x218a82=_[_0x3071('0x29')](_0xb05b1d,_0x28747d);if(_0x218a82){return _0x2793ef(handleCheckRowError(_0x3071('0x2a'),_0x3071('0x2b'),_0x218a82,_0x412652));}}return db[_0x3071('0x2c')][_0x3071('0x2d')](_0x950fde,{'raw':!![],'hooks':![],'fields':_[_0x3071('0x2e')](_0x950fde)})[_0x3071('0x2f')](function(_0x596cc3){if(DUPLICATES&&DUPLICATES[_0x3071('0x1a')]&&_0xb05b1d){_0xb05b1d['push'](_['pick'](_0x950fde,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x596cc3['id'];return _0x13df9f();})[_0x3071('0x30')](function(_0xa3a7ae){return _0x2793ef(handleCheckRowError('error',_0x3071('0x31')+(_0xa3a7ae[_0x3071('0x1c')]||JSON[_0x3071('0x32')](_0xa3a7ae)),null,_0x412652));});});}function checkHopper(){function _0x14ac42(){return function(_0xc60572){logger[_0x3071('0x14')]('cmContact',_0x3071('0x33'),util[_0x3071('0x34')](_0xc60572,{'showHidden':![],'depth':null}));};}var _0x4ce6d4=function(_0x44ad05,_0x5b1392){var _0x28f855=squel[_0x3071('0x35')]()['into']('cm_hopper')[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x38'),'ContactId',_0x3071('0x28'),_0x5b1392,'createdAt',_0x3071('0x39')],squel['select']()[_0x3071('0x3a')](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')['field']('id',_0x3071('0x3c'))[_0x3071('0x3a')](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))['field'](_0x44ad05['id'][_0x3071('0x3d')](),_0x5b1392)[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),'updatedAt')[_0x3071('0x3f')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')['where'](_0x3071('0x40'),LISTID[_0x3071('0x3d')]())[_0x3071('0x41')](_0x3071('0x42'))[_0x3071('0x41')](_0x3071('0x43'),squel[_0x3071('0x44')]()[_0x3071('0x3a')]('phone')[_0x3071('0x3f')](_0x3071('0x45'))[_0x3071('0x41')](_0x5b1392+_0x3071('0x46'),_0x44ad05['id'][_0x3071('0x3d')]())))['toString']();return _0x28f855;};var _0x5c93c7=function(_0x1721d0,_0x3c2f5e){var _0x1fe5e0=squel[_0x3071('0x35')]()[_0x3071('0x47')]('cm_hopper')[_0x3071('0x36')](['phone',_0x3071('0x38'),'ContactId','ListId',_0x3c2f5e,_0x3071('0x3e'),'updatedAt'],squel[_0x3071('0x44')]()['field'](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')[_0x3071('0x3a')]('id','ContactId')[_0x3071('0x3a')](LISTID['toString'](),_0x3071('0x28'))[_0x3071('0x3a')](_0x1721d0['id']['toString'](),_0x3c2f5e)[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')]('cm_contacts')[_0x3071('0x41')](_0x3071('0x48'))[_0x3071('0x41')](_0x3071('0x40'),LISTID['toString']())[_0x3071('0x41')](_0x3071('0x49'),squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42'))[_0x3071('0x41')](_0x3071('0x43'),squel[_0x3071('0x44')]()[_0x3071('0x3a')](_0x3071('0x4b'))[_0x3071('0x3f')](_0x3071('0x4c'))[_0x3071('0x41')](_0x3c2f5e+_0x3071('0x46'),_0x1721d0['id'][_0x3071('0x3d')]()))[_0x3071('0x41')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x3071('0x3a')]('phone')[_0x3071('0x3f')](_0x3071('0x45'))[_0x3071('0x41')](_0x3c2f5e+'\x20=\x20?',_0x1721d0['id'][_0x3071('0x3d')]())))[_0x3071('0x3d')]();return _0x1fe5e0;};function _0x5bc69e(_0x4b8ec0,_0x1b89ea){var _0x15abc4=squel[_0x3071('0x35')]()[_0x3071('0x47')]('cm_hopper')[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x38'),_0x3071('0x3c'),_0x3071('0x28'),_0x1b89ea,'createdAt',_0x3071('0x39')],squel[_0x3071('0x44')]()[_0x3071('0x3a')](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')['field']('id',_0x3071('0x3c'))['field'](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))['field'](_0x4b8ec0['id'][_0x3071('0x3d')](),_0x1b89ea)[_0x3071('0x3a')]('NOW()',_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')]('cm_contacts')[_0x3071('0x41')](_0x3071('0x48'))[_0x3071('0x41')]('ListId\x20=\x20?',LISTID[_0x3071('0x3d')]())[_0x3071('0x41')](_0x3071('0x49'),squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42')))[_0x3071('0x3d')]();return _0x15abc4;}function _0x2e39ff(_0x3b47e8,_0x5cb3b3){var _0x5d1316=squel[_0x3071('0x35')]()[_0x3071('0x47')](_0x3071('0x4d'))[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x3c'),_0x3071('0x28'),_0x5cb3b3,_0x3071('0x3e'),_0x3071('0x39')],squel[_0x3071('0x44')]()['field'](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')]('id',_0x3071('0x3c'))[_0x3071('0x3a')](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))[_0x3071('0x3a')](_0x3b47e8['id']['toString'](),_0x5cb3b3)[_0x3071('0x3a')](_0x3071('0x3b'),'createdAt')['field'](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')](_0x3071('0x4e'))['where']('deletedAt\x20IS\x20NULL')[_0x3071('0x41')]('ListId\x20=\x20?',LISTID['toString']())['where']('id\x20IN\x20?',squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42')))['toString']();return _0x5d1316;}return db[_0x3071('0x4f')][_0x3071('0x50')]({'where':{'type':_0x3071('0x51')},'attributes':['id',_0x3071('0x52')],'include':[{'model':db['CmList'],'as':_0x3071('0x53'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x588406){var _0x1b35d3=[];if(_0x588406){var _0x29ee70;for(var _0x388cd1=0x0,_0x40c258;_0x388cd1<_0x588406[_0x3071('0x1a')];_0x388cd1+=0x1){_0x40c258=_0x588406[_0x388cd1][_0x3071('0x54')]({'plain':!![]});switch(_0x40c258[_0x3071('0x52')]){case'always':_0x1b35d3['push'](db[_0x3071('0x55')][_0x3071('0x56')](_0x5c93c7(_0x40c258,_0x3071('0x57')))['then'](function(){})['catch'](_0x14ac42()));break;case _0x3071('0x58'):_0x1b35d3[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x4ce6d4(_0x40c258,_0x3071('0x57')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;default:_0x1b35d3[_0x3071('0x59')](db['sequelize'][_0x3071('0x56')](_0x5bc69e(_0x40c258,'VoiceQueueId'))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}}return _0x1b35d3;})[_0x3071('0x5a')]()[_0x3071('0x2f')](function(){return db[_0x3071('0x4f')][_0x3071('0x50')]({'where':{'type':_0x3071('0x51')},'attributes':['id'],'include':[{'model':db[_0x3071('0x5b')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x138a94){var _0x1da477=[];if(_0x138a94){var _0x4f06c0;for(var _0x2a2e7a=0x0,_0x22ec7b;_0x2a2e7a<_0x138a94[_0x3071('0x1a')];_0x2a2e7a+=0x1){_0x22ec7b=_0x138a94[_0x2a2e7a]['get']({'plain':!![]});_0x1da477['push'](db[_0x3071('0x55')]['query'](_0x2e39ff(_0x22ec7b,_0x3071('0x57')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}return _0x1da477;})[_0x3071('0x5a')]();})[_0x3071('0x2f')](function(){return db[_0x3071('0x5c')][_0x3071('0x50')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x3071('0x5b')],'as':_0x3071('0x53'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x3cc937){var _0x98d0fb=[];if(_0x3cc937){for(var _0x1fea60=0x0,_0x435dcb;_0x1fea60<_0x3cc937[_0x3071('0x1a')];_0x1fea60+=0x1){_0x435dcb=_0x3cc937[_0x1fea60]['get']({'plain':!![]});switch(_0x435dcb[_0x3071('0x52')]){case'always':_0x98d0fb[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x5c93c7(_0x435dcb,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;case _0x3071('0x58'):_0x98d0fb[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x4ce6d4(_0x435dcb,'CampaignId'))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;default:_0x98d0fb['push'](db[_0x3071('0x55')][_0x3071('0x56')](_0x5bc69e(_0x435dcb,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}}return _0x98d0fb;})['all']();})['then'](function(){return db[_0x3071('0x5c')]['findAll']({'attributes':['id'],'include':[{'model':db[_0x3071('0x5b')],'as':_0x3071('0x5e'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x136278){var _0x22783b=[];if(_0x136278){for(var _0x2f31b7=0x0,_0x568386;_0x2f31b7<_0x136278[_0x3071('0x1a')];_0x2f31b7+=0x1){_0x568386=_0x136278[_0x2f31b7][_0x3071('0x54')]({'plain':!![]});_0x22783b[_0x3071('0x59')](db[_0x3071('0x55')]['query'](_0x2e39ff(_0x568386,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})['catch'](_0x14ac42()));}}return _0x22783b;})[_0x3071('0x5a')]();})[_0x3071('0x30')](function(_0x391887){logger[_0x3071('0x14')](_0x3071('0x5f'),'generalCheckHopper',_0x391887[_0x3071('0x1c')]);});}var processPromises=function(_0x479fe7){return BPromise[_0x3071('0x5a')](promises)[_0x3071('0x2f')](function(_0x39060f){})[_0x3071('0x30')](function(_0x1120ec){logger[_0x3071('0x14')](_0x3071('0x60'),JSON[_0x3071('0x32')](_0x1120ec));})['finally'](function(){socket[_0x3071('0x61')](_0x3071('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x479fe7){return _0x479fe7[_0x3071('0x63')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x3071('0x2f')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x3071('0x61')](_0x3071('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x3071('0x64')](FILEPATH);}catch(_0x5e0cbd){logger[_0x3071('0x14')](_0x3071('0x65'),JSON[_0x3071('0x32')](_0x5e0cbd));}finally{process[_0x3071('0x66')](0x0);}});};process['on'](_0x3071('0x67'),function(){logger[_0x3071('0x68')](_0x3071('0x69'));endCsv();});function main(){return BPromise[_0x3071('0x6a')]()[_0x3071('0x2f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x3071('0x2c')][_0x3071('0x50')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x3071('0x2f')](function(_0x5b2830){var _0x561030=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x561030,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4eb9e2,_0x8c77b7){total+=0x1;var _0x44b4c9=total;promises['push'](checkRow(_0x4eb9e2,_0x5b2830,_0x44b4c9)[_0x3071('0x2f')](function(){success+=0x1;})[_0x3071('0x30')](function(_0x1f61df){if(_0x1f61df['error']){errors+=0x1;delete _0x1f61df['error'];}else if(_0x1f61df[_0x3071('0x2a')]){duplicates+=0x1;delete _0x1f61df[_0x3071('0x2a')];}rows[_0x3071('0x59')](_0x1f61df);}));if(total%0xc8===0x0){_0x8c77b7[_0x3071('0x6b')]();return processPromises(_0x8c77b7);}},'complete':function(){return processPromises()[_0x3071('0x2f')](function(){logger[_0x3071('0x68')](_0x3071('0x6c'));endCsv();});},'error':function(_0x5eb60d,_0x58b62c){logger[_0x3071('0x68')](_0x3071('0x6d'),JSON[_0x3071('0x32')](_0x5eb60d));endCsv();}});})[_0x3071('0x30')](function(_0x5a3b64){logger[_0x3071('0x14')](_0x3071('0x6e'),JSON[_0x3071('0x32')](_0x5a3b64));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index b0455d1..6e98c87 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 _0xfaea=['writeFileSync','parse','createReadStream','data','rows','errors','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','length','SystemRow','appendFileSync','emit','SystemError','error','duplicates','CREATE\x20TABLE\x20','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','VoiceQueueId','voice_queues_has_cm_blacklists','voice_queues','campaigns_has_cm_lists','campaigns','CampaignId','each','then','finish','affectedRows','unlink','exit','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','papaparse','moment','ioredis','../../../mysqldb','import','redis','defaults','localhost','socket.io-emitter','format','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.id','cm_contacts.ListId','cm_contacts.priority','insert','into','cm_hopper','scheduledat','ContactId','createdAt','updatedAt','priority','UserId','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.phone','cm_contacts.createdAt','cm_contacts.updatedAt','cm_hopper_black','ListId\x20=\x20?','ListId','CompanyId','fromQuery','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','message','push','spread','catch','main','stringify','send','start','binding','socket_timestamp','root','header'];(function(_0x596225,_0x440aee){var _0x17e906=function(_0x47eb2d){while(--_0x47eb2d){_0x596225['push'](_0x596225['shift']());}};_0x17e906(++_0x440aee);}(_0xfaea,0x1a0));var _0xafae=function(_0x35c300,_0x284351){_0x35c300=_0x35c300-0x0;var _0x59e44b=_0xfaea[_0x35c300];return _0x59e44b;};'use strict';var fs=require('fs');var path=require(_0xafae('0x0'));var _=require(_0xafae('0x1'));var Papa=require(_0xafae('0x2'));var util=require('util');var BPromise=require('bluebird');var moment=require(_0xafae('0x3'));var squel=require('squel');var Redis=require(_0xafae('0x4'));var db=require(_0xafae('0x5'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xafae('0x6'));config[_0xafae('0x7')]=_[_0xafae('0x8')](config['redis'],{'host':_0xafae('0x9'),'port':0x18eb});var socket=require(_0xafae('0xa'))(new Redis(config[_0xafae('0x7')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xafae('0xb')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x109f88){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x109f88);}function selectNotIn(_0x124014,_0x2c47b2,_0x41cd87,_0x52506c,_0x4c46b8){return squel[_0xafae('0xc')]()[_0xafae('0xd')](_0xafae('0xe'))[_0xafae('0xf')](_0x52506c)[_0xafae('0x10')](_0x2c47b2,null,_0x2c47b2+_0xafae('0x11')+_0x52506c+'.'+_0x41cd87)[_0xafae('0x12')](_0x52506c+'.'+_0x41cd87+_0xafae('0x13')+_0x124014+'.'+_0x41cd87)[_0xafae('0x12')](_0x2c47b2+_0xafae('0x14')+_0x4c46b8['join']()+')');}function insertCmHopper(_0xf3a033,_0x258bf3,_0x23135c,_0x5f1928,_0x5b2290){var _0x2f63ff=['cm_contacts.phone','cm_contacts.scheduledat',_0xafae('0x15'),_0xafae('0x16'),_0x258bf3+'.'+_0x5f1928,'cm_contacts.createdAt','cm_contacts.updatedAt',_0xafae('0x17'),'cm_contacts.UserId','\x22'+_0x5b2290+'\x22'];return squel[_0xafae('0x18')]()[_0xafae('0x19')](_0xafae('0x1a'))['fromQuery']([_0xafae('0xe'),_0xafae('0x1b'),_0xafae('0x1c'),'ListId',_0x5f1928,_0xafae('0x1d'),_0xafae('0x1e'),_0xafae('0x1f'),_0xafae('0x20'),'recallme'],squel[_0xafae('0xc')]()[_0xafae('0x21')](_0x2f63ff)[_0xafae('0xf')](_0x258bf3)[_0xafae('0x10')](_0xafae('0x22'),null,_0xafae('0x23')+_0x258bf3+_0xafae('0x24'))[_0xafae('0x10')](_0x23135c,null,_0x23135c+_0xafae('0x11')+_0x258bf3+'.'+_0x5f1928)[_0xafae('0x12')](_0x258bf3+'.CmListId\x20=\x20?',_0xf3a033)[_0xafae('0x12')](_0xafae('0x25'),NOW)[_0xafae('0x12')](_0xafae('0x26'),selectNotIn(_0x258bf3,_0x23135c,_0x5f1928,_0xafae('0x1a'),[_0xafae('0x27'),'\x22onlyIfOpen\x22']))['where'](_0xafae('0x26'),selectNotIn(_0x258bf3,_0x23135c,_0x5f1928,_0xafae('0x1a'),[_0xafae('0x27')])))[_0xafae('0x28')]();}function insertCmHopperBlack(_0xd379a3,_0x992ae6,_0x19fa75,_0x4ceb58){var _0x2afc08=[_0xafae('0x29'),_0xafae('0x15'),_0xafae('0x16'),_0x992ae6+'.'+_0x4ceb58,_0xafae('0x2a'),_0xafae('0x2b')];return squel[_0xafae('0x18')]()[_0xafae('0x19')](_0xafae('0x2c'))['fromQuery'](['phone','ContactId','ListId',_0x4ceb58,_0xafae('0x1d'),'updatedAt'],squel[_0xafae('0xc')]()['fields'](_0x2afc08)[_0xafae('0xf')](_0x992ae6)[_0xafae('0x10')]('cm_contacts',null,_0xafae('0x23')+_0x992ae6+'.CmListId')[_0xafae('0x10')](_0x19fa75,null,_0x19fa75+_0xafae('0x11')+_0x992ae6+'.'+_0x4ceb58)[_0xafae('0x12')](_0x992ae6+'.CmListId\x20=\x20?',_0xd379a3)[_0xafae('0x12')](_0xafae('0x25'),NOW)[_0xafae('0x12')](_0xafae('0x26'),squel['select']()['field']('phone')[_0xafae('0xf')](_0xafae('0x2c'))[_0xafae('0x12')](_0xafae('0x2d'),_0xd379a3)[_0xafae('0x12')](_0x4ceb58+'\x20=\x20?',_0x992ae6+'.'+_0x4ceb58)))[_0xafae('0x28')]();}function insertCmContact(_0x1fcc02,_0x18b4f0,_0x155b82,_0x5a7cc2){var _0x29dd0a=_['concat'](_['keys'](_0x5a7cc2),[_0xafae('0x2e'),_0xafae('0x2f'),_0xafae('0x1d'),_0xafae('0x1e')]);return squel[_0xafae('0x18')]()[_0xafae('0x19')](_0xafae('0x22'))[_0xafae('0x30')](_0x29dd0a,squel[_0xafae('0xc')]()['fields'](_0x29dd0a)[_0xafae('0xf')](_0x18b4f0)[_0xafae('0x12')]('('+_0x155b82[_0xafae('0x10')](',')+')\x20NOT\x20IN\x20?',squel['select']()[_0xafae('0x21')](_0x155b82)['from']('cm_contacts')[_0xafae('0x12')](_0xafae('0x2d'),_0x1fcc02)[_0xafae('0x12')](_0xafae('0x31')))[_0xafae('0x12')](_0xafae('0x32'),squel[_0xafae('0xc')]()['field'](_0xafae('0x33'),_0xafae('0x34'))[_0xafae('0xf')](_0x18b4f0)[_0xafae('0x35')](_0x155b82[_0xafae('0x10')](','))))[_0xafae('0x28')]();}function handleStop(){logger[_0xafae('0x36')](_0xafae('0x37'));stopped=!![];}function handleUncaughtException(_0x4d5522){logger['error'](_0x4d5522[_0xafae('0x38')]);process['exit'](0x1);}function handleError(_0x38c271,_0x164ab5){stats['errors'][_0xafae('0x39')]({'name':_0x164ab5['code'],'message':_0x164ab5[_0xafae('0x38')],'row':_0x38c271});}function handleQuery(_0x4f75a3){logger[_0xafae('0x36')](_0x4f75a3);return db['sequelize']['query'](_0x4f75a3)[_0xafae('0x3a')](function(_0x3f4631){results[_0xafae('0x39')](_0x3f4631);})[_0xafae('0x3b')](function(_0x3902a7){logger['error'](_0x3902a7[_0xafae('0x38')]);});}function main(_0x3c2e87,_0x3596e5,_0x433574,_0x28485f){logger[_0xafae('0x36')](_0xafae('0x3c'),_0x3c2e87,JSON[_0xafae('0x3d')](_0x3596e5));process[_0xafae('0x3e')](_0xafae('0x3f'));var _0x2e12a7=_0x3596e5[_0xafae('0x40')];var _0x2ee821=_0x3596e5[_0xafae('0x41')];var _0x59e6a9=path['join'](config[_0xafae('0x42')],'server/files/tmp',_0x2ee821+'.csv');var _0x3ad308=_['keys'](_0x2e12a7)['join']();logger['info'](_0xafae('0x43'),_0x3ad308);fs[_0xafae('0x44')](_0x59e6a9,_0x3ad308+'\x0a');Papa[_0xafae('0x45')](fs[_0xafae('0x46')](_0x3c2e87),{'header':!![],'skipEmptyLines':!![],'step':function(_0x260b16,_0x518b6b){try{for(var _0x52fe87=0x0,_0x2c10ba=[];_0x52fe87<_0x260b16[_0xafae('0x47')]['length'];_0x52fe87++){stats[_0xafae('0x48')]+=0x1;if(_0x260b16[_0xafae('0x49')][_0x52fe87]){handleError(_0x260b16['data'][_0x52fe87],_0x260b16[_0xafae('0x49')][_0x52fe87]);}else{var _0x2480b3=[];for(var _0x4573b8 in _0x2e12a7){if(_0x2e12a7['hasOwnProperty'](_0x4573b8)){if(_0x260b16[_0xafae('0x47')][_0x52fe87][_0x2e12a7[_0x4573b8]]){var _0xb2c6a2=_[_0xafae('0x4a')](_0x260b16[_0xafae('0x47')][_0x52fe87][_0x2e12a7[_0x4573b8]]['replace'](/"/g,'\x27'));switch(_0x4573b8){case _0xafae('0x1b'):var _0x5e2458=moment(_0xb2c6a2,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x5e2458[_0xafae('0x4b')]()){_0x2c10ba['push']('\x22'+_0xb2c6a2+'\x22');}else{_0x2480b3[_0xafae('0x39')](_0xafae('0x4c'));}break;case _0xafae('0x1f'):var _0x14e5e9=parseInt(_0xb2c6a2);_0xb2c6a2=_[_0xafae('0x4d')](_0x14e5e9)||_0x14e5e9<0x0||_0x14e5e9>0x4?_0x28485f?0x3:0x2:_0x14e5e9;_0x2c10ba[_0xafae('0x39')]('\x22'+_0xb2c6a2+'\x22');break;case _0xafae('0x20'):var _0x20810f=parseInt(_0xb2c6a2);if(_[_0xafae('0x4e')](_0x20810f)&&_[_0xafae('0x4f')](_0x433574,_0x20810f)){_0x2c10ba['push']('\x22'+_0x20810f+'\x22');}else{_0x2480b3[_0xafae('0x39')](_0xafae('0x50'));}break;case _0xafae('0x51'):if(isEmail(_0xb2c6a2)){_0x2c10ba[_0xafae('0x39')]('\x22'+_0xb2c6a2+'\x22');}else{_0x2480b3[_0xafae('0x39')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x866ca0=moment(_0xb2c6a2,'YYYY-MM-DD',!![]);if(_0x866ca0[_0xafae('0x4b')]()){_0x2c10ba[_0xafae('0x39')]('\x22'+_0xb2c6a2+'\x22');}else{_0x2480b3[_0xafae('0x39')](_0xafae('0x52'));}break;default:_0x2c10ba[_0xafae('0x39')]('\x22'+_0xb2c6a2+'\x22');}}else{switch(_0x4573b8){case _0xafae('0x53'):case'phone':_0x2480b3[_0xafae('0x39')](_0x4573b8+_0xafae('0x54'));break;default:_0x2c10ba[_0xafae('0x39')]('\x22\x22');}}}}if(_0x2480b3[_0xafae('0x55')]){handleError(_0x260b16[_0xafae('0x47')][_0x52fe87],{'code':_0xafae('0x56'),'message':_0x2480b3['join']()});}else{fs[_0xafae('0x57')](_0x59e6a9,_0x2c10ba[_0xafae('0x10')]()+'\x0a');}_0x2c10ba=[];}if(!(stats['rows']%0xc8)){socket[_0xafae('0x58')]('contact:import:'+_0x2ee821,stats);stats['errors']=[];}}if(stopped){logger[_0xafae('0x36')]('Abort\x20parser');_0x518b6b['abort']();}}catch(_0x167534){handleError(_0x260b16[_0xafae('0x47')][_0x52fe87],{'code':_0xafae('0x59'),'message':_0x167534[_0xafae('0x38')]});logger[_0xafae('0x5a')]('step',_0x167534['message']);}},'complete':function(){try{var _0x4546a3=[];var _0x31824c=_0xafae('0x22');if(_0x3596e5[_0xafae('0x5b')]&&_0x3596e5[_0xafae('0x5b')][_0xafae('0x55')]){_0x31824c='cm_contacts_'+_0x2ee821;_0x4546a3[_0xafae('0x39')](_0xafae('0x5c')+_0x31824c+'\x20LIKE\x20cm_contacts;');}var _0x368b21=util[_0xafae('0xb')](_0xafae('0x5d'),_0x59e6a9,_0x31824c,_0x3ad308,_0x3596e5[_0xafae('0x2e')],_0x3596e5[_0xafae('0x2f')]||null,NOW,NOW);if(_[_0xafae('0x5e')](_0x2e12a7['scheduledat'])){_0x368b21+=_0xafae('0x5f');}_0x4546a3[_0xafae('0x39')](_0x368b21);if(_0x3596e5[_0xafae('0x5b')]&&_0x3596e5['duplicates']['length']){_0x4546a3[_0xafae('0x39')](insertCmContact(_0x3596e5[_0xafae('0x2e')],_0x31824c,_0x3596e5[_0xafae('0x5b')],_0x2e12a7));_0x4546a3['push'](_0xafae('0x60')+_0x31824c+';');}_0x4546a3[_0xafae('0x39')](insertCmHopper(_0x3596e5[_0xafae('0x2e')],_0xafae('0x61'),'voice_queues',_0xafae('0x62'),_0x28485f));_0x4546a3[_0xafae('0x39')](insertCmHopperBlack(_0x3596e5[_0xafae('0x2e')],_0xafae('0x63'),_0xafae('0x64'),_0xafae('0x62')));_0x4546a3[_0xafae('0x39')](insertCmHopper(_0x3596e5[_0xafae('0x2e')],_0xafae('0x65'),_0xafae('0x66'),_0xafae('0x67'),_0x28485f));_0x4546a3[_0xafae('0x39')](insertCmHopperBlack(_0x3596e5[_0xafae('0x2e')],'campaigns_has_cm_blacklists',_0xafae('0x66'),_0xafae('0x67')));BPromise[_0xafae('0x68')](_0x4546a3,handleQuery)[_0xafae('0x69')](function(_0x2c997d){stats[_0xafae('0x6a')]=!![];stats[_0xafae('0x6b')]=_0x3596e5[_0xafae('0x5b')]&&_0x3596e5[_0xafae('0x5b')][_0xafae('0x55')]?results[0x2]['affectedRows']:results[0x0][_0xafae('0x6b')];socket[_0xafae('0x58')]('contact:import:'+_0x2ee821,stats);fs['unlink'](_0x3c2e87);fs[_0xafae('0x6c')](_0x59e6a9);process[_0xafae('0x6d')](0x0);})[_0xafae('0x3b')](function(_0x453d92){logger[_0xafae('0x5a')](_0x453d92[_0xafae('0x38')]);process[_0xafae('0x6d')](0x1);});}catch(_0x5270c8){logger['error']('complete',_0x5270c8[_0xafae('0x38')]);process[_0xafae('0x6d')](0x1);}},'error':function(_0x386182,_0x4f1cef,_0x1edcae,_0x2c6cf1){throw new Error(_0x2c6cf1);}});}function validate(){if(process[_0xafae('0x6e')]&&process[_0xafae('0x6e')][_0xafae('0x55')]<0x4){throw new Error(_0xafae('0x6f'));}var _0x3a3aa7=path[_0xafae('0x10')](config['root'],'server/files/tmp',process[_0xafae('0x6e')][0x2]);if(!fs[_0xafae('0x70')](_0x3a3aa7)){throw new Error(_0xafae('0x71'));}var _0x379cc9={};try{_0x379cc9=JSON[_0xafae('0x45')](process[_0xafae('0x6e')][0x3]);if(!_0x379cc9[_0xafae('0x40')]){throw new Error(_0xafae('0x72'));}if(!_0x379cc9['binding'][_0xafae('0xe')]){throw new Error(_0xafae('0x73'));}if(!_0x379cc9[_0xafae('0x40')]['firstName']){throw new Error(_0xafae('0x74'));}var _0x1220f2=0x0;if(_0x379cc9[_0xafae('0x40')]['UserId']){_0x1220f2=0x1;}if(!_0x379cc9[_0xafae('0x2e')]){throw new Error(_0xafae('0x75'));}}catch(_0x139ce5){throw new Error('body\x20id\x20mandatory');}var _0xe82635=[];try{_0xe82635=_[_0xafae('0x76')](JSON[_0xafae('0x45')](process[_0xafae('0x6e')][0x4]),'id');}catch(_0x37550c){logger[_0xafae('0x36')](_0xafae('0x77'));}main(_0x3a3aa7,_0x379cc9,_0xe82635,_0x1220f2);}validate();process['on'](_0xafae('0x78'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0x3328=['fields','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','toString','cm_contacts.ListId','insert','cm_hopper_black','cm_contacts','ListId\x20=\x20?','concat','keys','ListId','deletedAt\x20IS\x20NULL','min_id','group','info','error','message','errors','code','sequelize','query','catch','main','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','header','writeFileSync','createReadStream','length','rows','data','replace','isValid','push','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','email','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','contact:import:','Abort\x20parser','abort','SystemError','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','campaigns','then','affectedRows','emit','unlink','exit','complete','argv','arguments\x20\x20\x20','existsSync','parse','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','bluebird','moment','squel','../../../config/environment','../../../config/logger','redis','defaults','localhost','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','where','\x20=\x20','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','fromQuery','scheduledat','ContactId','createdAt','updatedAt','priority','UserId'];(function(_0x10720a,_0x39a5fd){var _0x28c0ac=function(_0x265893){while(--_0x265893){_0x10720a['push'](_0x10720a['shift']());}};_0x28c0ac(++_0x39a5fd);}(_0x3328,0x1cf));var _0x8332=function(_0x1c69b6,_0x18b99b){_0x1c69b6=_0x1c69b6-0x0;var _0x4dfcf8=_0x3328[_0x1c69b6];return _0x4dfcf8;};'use strict';var fs=require('fs');var path=require(_0x8332('0x0'));var _=require(_0x8332('0x1'));var Papa=require(_0x8332('0x2'));var util=require(_0x8332('0x3'));var BPromise=require(_0x8332('0x4'));var moment=require(_0x8332('0x5'));var squel=require(_0x8332('0x6'));var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require(_0x8332('0x7'));var logger=require(_0x8332('0x8'))('import');config[_0x8332('0x9')]=_[_0x8332('0xa')](config[_0x8332('0x9')],{'host':_0x8332('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8332('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()['format'](_0x8332('0xc'));function isEmail(_0x13093f){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))*$/[_0x8332('0xd')](_0x13093f);}function selectNotIn(_0x1309b5,_0x3d6f1a,_0x524e41,_0x20d7d7,_0xc1b402){return squel[_0x8332('0xe')]()[_0x8332('0xf')](_0x8332('0x10'))[_0x8332('0x11')](_0x20d7d7)[_0x8332('0x12')](_0x3d6f1a,null,_0x3d6f1a+'.id\x20=\x20'+_0x20d7d7+'.'+_0x524e41)[_0x8332('0x13')](_0x20d7d7+'.'+_0x524e41+_0x8332('0x14')+_0x1309b5+'.'+_0x524e41)[_0x8332('0x13')](_0x3d6f1a+'.dialCheckDuplicateType\x20IN\x20('+_0xc1b402[_0x8332('0x12')]()+')');}function insertCmHopper(_0x457cbb,_0x516043,_0x145dc6,_0x55222f,_0xefbc90){var _0x3887be=[_0x8332('0x15'),_0x8332('0x16'),_0x8332('0x17'),'cm_contacts.ListId',_0x516043+'.'+_0x55222f,_0x8332('0x18'),_0x8332('0x19'),_0x8332('0x1a'),_0x8332('0x1b'),'\x22'+_0xefbc90+'\x22'];return squel['insert']()[_0x8332('0x1c')](_0x8332('0x1d'))[_0x8332('0x1e')]([_0x8332('0x10'),_0x8332('0x1f'),_0x8332('0x20'),'ListId',_0x55222f,_0x8332('0x21'),_0x8332('0x22'),_0x8332('0x23'),_0x8332('0x24'),'recallme'],squel[_0x8332('0xe')]()[_0x8332('0x25')](_0x3887be)[_0x8332('0x11')](_0x516043)[_0x8332('0x12')]('cm_contacts',null,_0x8332('0x26')+_0x516043+_0x8332('0x27'))[_0x8332('0x12')](_0x145dc6,null,_0x145dc6+_0x8332('0x28')+_0x516043+'.'+_0x55222f)['where'](_0x516043+_0x8332('0x29'),_0x457cbb)[_0x8332('0x13')](_0x8332('0x2a'),NOW)[_0x8332('0x13')](_0x8332('0x2b'),selectNotIn(_0x516043,_0x145dc6,_0x55222f,'cm_hopper',[_0x8332('0x2c'),'\x22onlyIfOpen\x22']))[_0x8332('0x13')](_0x8332('0x2b'),selectNotIn(_0x516043,_0x145dc6,_0x55222f,_0x8332('0x1d'),['\x22always\x22'])))[_0x8332('0x2d')]();}function insertCmHopperBlack(_0x26d843,_0x46011f,_0x3a7889,_0x3ec1d9){var _0x210a66=[_0x8332('0x15'),_0x8332('0x17'),_0x8332('0x2e'),_0x46011f+'.'+_0x3ec1d9,_0x8332('0x18'),_0x8332('0x19')];return squel[_0x8332('0x2f')]()[_0x8332('0x1c')](_0x8332('0x30'))[_0x8332('0x1e')]([_0x8332('0x10'),'ContactId','ListId',_0x3ec1d9,_0x8332('0x21'),_0x8332('0x22')],squel['select']()[_0x8332('0x25')](_0x210a66)[_0x8332('0x11')](_0x46011f)['join'](_0x8332('0x31'),null,_0x8332('0x26')+_0x46011f+_0x8332('0x27'))[_0x8332('0x12')](_0x3a7889,null,_0x3a7889+_0x8332('0x28')+_0x46011f+'.'+_0x3ec1d9)[_0x8332('0x13')](_0x46011f+_0x8332('0x29'),_0x26d843)['where'](_0x8332('0x2a'),NOW)[_0x8332('0x13')](_0x8332('0x2b'),squel[_0x8332('0xe')]()[_0x8332('0xf')](_0x8332('0x10'))[_0x8332('0x11')](_0x8332('0x30'))[_0x8332('0x13')](_0x8332('0x32'),_0x26d843)[_0x8332('0x13')](_0x3ec1d9+'\x20=\x20?',_0x46011f+'.'+_0x3ec1d9)))[_0x8332('0x2d')]();}function insertCmContact(_0xe43446,_0x49e8c0,_0x200189,_0x45ed90){var _0x39de87=_[_0x8332('0x33')](_[_0x8332('0x34')](_0x45ed90),[_0x8332('0x35'),'CompanyId','createdAt',_0x8332('0x22')]);return squel['insert']()[_0x8332('0x1c')](_0x8332('0x31'))[_0x8332('0x1e')](_0x39de87,squel[_0x8332('0xe')]()['fields'](_0x39de87)['from'](_0x49e8c0)[_0x8332('0x13')]('('+_0x200189[_0x8332('0x12')](',')+')\x20NOT\x20IN\x20?',squel[_0x8332('0xe')]()['fields'](_0x200189)['from']('cm_contacts')[_0x8332('0x13')](_0x8332('0x32'),_0xe43446)['where'](_0x8332('0x36')))[_0x8332('0x13')]('id\x20IN\x20?',squel['select']()[_0x8332('0xf')]('MIN(id)',_0x8332('0x37'))['from'](_0x49e8c0)[_0x8332('0x38')](_0x200189[_0x8332('0x12')](','))))['toString']();}function handleStop(){logger[_0x8332('0x39')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x1b99a8){logger[_0x8332('0x3a')](_0x1b99a8[_0x8332('0x3b')]);process['exit'](0x1);}function handleError(_0x3f1c69,_0x541a01){stats[_0x8332('0x3c')]['push']({'name':_0x541a01[_0x8332('0x3d')],'message':_0x541a01[_0x8332('0x3b')],'row':_0x3f1c69});}function handleQuery(_0x153e5f){logger[_0x8332('0x39')](_0x153e5f);return db[_0x8332('0x3e')][_0x8332('0x3f')](_0x153e5f)['spread'](function(_0x2323f3){results['push'](_0x2323f3);})[_0x8332('0x40')](function(_0x452711){logger['error'](_0x452711[_0x8332('0x3b')]);});}function main(_0x29f5a2,_0x2f97d6,_0x1c75f9,_0x129258){logger[_0x8332('0x39')](_0x8332('0x41'),_0x29f5a2,JSON[_0x8332('0x42')](_0x2f97d6));process[_0x8332('0x43')](_0x8332('0x44'));var _0x475891=_0x2f97d6[_0x8332('0x45')];var _0xdb90ff=_0x2f97d6[_0x8332('0x46')];var _0x65b5f4=path['join'](config[_0x8332('0x47')],_0x8332('0x48'),_0xdb90ff+'.csv');var _0x1f0fda=_[_0x8332('0x34')](_0x475891)[_0x8332('0x12')]();logger['info'](_0x8332('0x49'),_0x1f0fda);fs[_0x8332('0x4a')](_0x65b5f4,_0x1f0fda+'\x0a');Papa['parse'](fs[_0x8332('0x4b')](_0x29f5a2),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2333ce,_0x20b32e){try{for(var _0x3143d2=0x0,_0x170d19=[];_0x3143d2<_0x2333ce['data'][_0x8332('0x4c')];_0x3143d2++){stats[_0x8332('0x4d')]+=0x1;if(_0x2333ce[_0x8332('0x3c')][_0x3143d2]){handleError(_0x2333ce[_0x8332('0x4e')][_0x3143d2],_0x2333ce[_0x8332('0x3c')][_0x3143d2]);}else{var _0x5c730d=[];for(var _0x232706 in _0x475891){if(_0x475891['hasOwnProperty'](_0x232706)){if(_0x2333ce[_0x8332('0x4e')][_0x3143d2][_0x475891[_0x232706]]){var _0x517b0a=_['trim'](_0x2333ce['data'][_0x3143d2][_0x475891[_0x232706]][_0x8332('0x4f')](/"/g,'\x27'));switch(_0x232706){case _0x8332('0x1f'):var _0x26309e=moment(_0x517b0a,_0x8332('0xc'),!![]);if(_0x26309e[_0x8332('0x50')]()){_0x170d19[_0x8332('0x51')]('\x22'+_0x517b0a+'\x22');}else{_0x5c730d['push'](_0x8332('0x52'));}break;case _0x8332('0x23'):var _0x14b217=parseInt(_0x517b0a);_0x517b0a=_[_0x8332('0x53')](_0x14b217)||_0x14b217<0x0||_0x14b217>0x4?_0x129258?0x3:0x2:_0x14b217;_0x170d19[_0x8332('0x51')]('\x22'+_0x517b0a+'\x22');break;case _0x8332('0x24'):var _0x73eb8e=parseInt(_0x517b0a);if(_[_0x8332('0x54')](_0x73eb8e)&&_[_0x8332('0x55')](_0x1c75f9,_0x73eb8e)){_0x170d19['push']('\x22'+_0x73eb8e+'\x22');}else{_0x5c730d[_0x8332('0x51')]('agent\x20not\x20exists');}break;case _0x8332('0x56'):if(isEmail(_0x517b0a)){_0x170d19[_0x8332('0x51')]('\x22'+_0x517b0a+'\x22');}else{_0x5c730d[_0x8332('0x51')](_0x8332('0x57'));}break;case _0x8332('0x58'):var _0x494bcc=moment(_0x517b0a,'YYYY-MM-DD',!![]);if(_0x494bcc[_0x8332('0x50')]()){_0x170d19['push']('\x22'+_0x517b0a+'\x22');}else{_0x5c730d[_0x8332('0x51')](_0x8332('0x59'));}break;default:_0x170d19[_0x8332('0x51')]('\x22'+_0x517b0a+'\x22');}}else{switch(_0x232706){case _0x8332('0x5a'):case'phone':_0x5c730d[_0x8332('0x51')](_0x232706+_0x8332('0x5b'));break;default:_0x170d19[_0x8332('0x51')]('\x22\x22');}}}}if(_0x5c730d['length']){handleError(_0x2333ce[_0x8332('0x4e')][_0x3143d2],{'code':_0x8332('0x5c'),'message':_0x5c730d[_0x8332('0x12')]()});}else{fs['appendFileSync'](_0x65b5f4,_0x170d19[_0x8332('0x12')]()+'\x0a');}_0x170d19=[];}if(!(stats[_0x8332('0x4d')]%0xc8)){socket['emit'](_0x8332('0x5d')+_0xdb90ff,stats);stats[_0x8332('0x3c')]=[];}}if(stopped){logger[_0x8332('0x39')](_0x8332('0x5e'));_0x20b32e[_0x8332('0x5f')]();}}catch(_0x3c83d1){handleError(_0x2333ce['data'][_0x3143d2],{'code':_0x8332('0x60'),'message':_0x3c83d1[_0x8332('0x3b')]});logger[_0x8332('0x3a')]('step',_0x3c83d1['message']);}},'complete':function(){try{var _0x4f7d1d=[];var _0x4e0357=_0x8332('0x31');if(_0x2f97d6[_0x8332('0x61')]&&_0x2f97d6['duplicates'][_0x8332('0x4c')]){_0x4e0357=_0x8332('0x62')+_0xdb90ff;_0x4f7d1d['push'](_0x8332('0x63')+_0x4e0357+_0x8332('0x64'));}var _0x3bd420=util['format'](_0x8332('0x65'),_0x65b5f4,_0x4e0357,_0x1f0fda,_0x2f97d6[_0x8332('0x35')],_0x2f97d6[_0x8332('0x66')]||null,NOW,NOW);if(_[_0x8332('0x67')](_0x475891[_0x8332('0x1f')])){_0x3bd420+=_0x8332('0x68');}_0x4f7d1d[_0x8332('0x51')](_0x3bd420);if(_0x2f97d6['duplicates']&&_0x2f97d6[_0x8332('0x61')][_0x8332('0x4c')]){_0x4f7d1d['push'](insertCmContact(_0x2f97d6['ListId'],_0x4e0357,_0x2f97d6[_0x8332('0x61')],_0x475891));_0x4f7d1d[_0x8332('0x51')](_0x8332('0x69')+_0x4e0357+';');}_0x4f7d1d['push'](insertCmHopper(_0x2f97d6['ListId'],_0x8332('0x6a'),_0x8332('0x6b'),'VoiceQueueId',_0x129258));_0x4f7d1d[_0x8332('0x51')](insertCmHopperBlack(_0x2f97d6[_0x8332('0x35')],'voice_queues_has_cm_blacklists',_0x8332('0x6b'),'VoiceQueueId'));_0x4f7d1d[_0x8332('0x51')](insertCmHopper(_0x2f97d6['ListId'],'campaigns_has_cm_lists',_0x8332('0x6c'),'CampaignId',_0x129258));_0x4f7d1d[_0x8332('0x51')](insertCmHopperBlack(_0x2f97d6[_0x8332('0x35')],'campaigns_has_cm_blacklists',_0x8332('0x6c'),'CampaignId'));BPromise['each'](_0x4f7d1d,handleQuery)[_0x8332('0x6d')](function(_0x727239){stats['finish']=!![];stats['affectedRows']=_0x2f97d6[_0x8332('0x61')]&&_0x2f97d6[_0x8332('0x61')]['length']?results[0x2][_0x8332('0x6e')]:results[0x0]['affectedRows'];socket[_0x8332('0x6f')](_0x8332('0x5d')+_0xdb90ff,stats);fs[_0x8332('0x70')](_0x29f5a2);fs[_0x8332('0x70')](_0x65b5f4);process[_0x8332('0x71')](0x0);})['catch'](function(_0x1d6e21){logger[_0x8332('0x3a')](_0x1d6e21[_0x8332('0x3b')]);process['exit'](0x1);});}catch(_0x1187c7){logger[_0x8332('0x3a')](_0x8332('0x72'),_0x1187c7['message']);process['exit'](0x1);}},'error':function(_0x56191a,_0x589b09,_0x4711c8,_0xe3b649){throw new Error(_0xe3b649);}});}function validate(){if(process[_0x8332('0x73')]&&process['argv']['length']<0x4){throw new Error(_0x8332('0x74'));}var _0x32af4e=path[_0x8332('0x12')](config[_0x8332('0x47')],'server/files/tmp',process[_0x8332('0x73')][0x2]);if(!fs[_0x8332('0x75')](_0x32af4e)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x3059fc={};try{_0x3059fc=JSON[_0x8332('0x76')](process[_0x8332('0x73')][0x3]);if(!_0x3059fc[_0x8332('0x45')]){throw new Error(_0x8332('0x77'));}if(!_0x3059fc[_0x8332('0x45')][_0x8332('0x10')]){throw new Error(_0x8332('0x78'));}if(!_0x3059fc['binding']['firstName']){throw new Error(_0x8332('0x79'));}var _0x51ab22=0x0;if(_0x3059fc['binding'][_0x8332('0x24')]){_0x51ab22=0x1;}if(!_0x3059fc[_0x8332('0x35')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x306367){throw new Error(_0x8332('0x7a'));}var _0x19be2b=[];try{_0x19be2b=_['map'](JSON['parse'](process[_0x8332('0x73')][0x4]),'id');}catch(_0xdea0cf){logger[_0x8332('0x39')](_0x8332('0x7b'));}main(_0x32af4e,_0x3059fc,_0x19be2b,_0x51ab22);}validate();process['on'](_0x8332('0x7c'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index a2aa22e..f7c6f1d 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x09df=['destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','membername','Date','Answer\x20Time','answertime','Complete\x20Time','Duration','billableseconds','getSubjects','toLowerCase','inbound','push','variable','outbound','string','Outbound\x20Call','destcalleridnum','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','calleridnum','calleridname','destexten','Queue','queue','UniqueId','uniqueid','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name'];(function(_0x1d5a39,_0x1faf84){var _0x502842=function(_0x51155f){while(--_0x51155f){_0x1d5a39['push'](_0x1d5a39['shift']());}};_0x502842(++_0x1faf84);}(_0x09df,0x164));var _0xf09d=function(_0x1cd47d,_0x55bc75){_0x1cd47d=_0x1cd47d-0x0;var _0x29d52f=_0x09df[_0x1cd47d];return _0x29d52f;};'use strict';exports[_0xf09d('0x0')]=function(_0x28fd89,_0x4f828c){var _0x401dac=[{'type':'string','content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x28fd89[_0xf09d('0x1')]()){case'voice':switch(_0x4f828c['toLowerCase']()){case _0xf09d('0x2'):_0x401dac[_0xf09d('0x3')]({'type':'variable','content':'','variableName':'queue'});_0x401dac['push']({'type':_0xf09d('0x4'),'content':'','variableName':'calleridnum'});break;case _0xf09d('0x5'):_0x401dac[_0xf09d('0x3')]({'type':_0xf09d('0x6'),'content':_0xf09d('0x7'),'variableName':null});_0x401dac[_0xf09d('0x3')]({'type':_0xf09d('0x4'),'content':'','variableName':_0xf09d('0x8')});break;}}return _0x401dac;};exports['getDescriptions']=function(_0x404322,_0x227a55){var _0x56a961=[];switch(_0x404322[_0xf09d('0x1')]()){case'voice':switch(_0x227a55[_0xf09d('0x1')]()){case _0xf09d('0x2'):_0x56a961=[{'type':_0xf09d('0x6'),'content':_0xf09d('0x9'),'key':null,'keyType':null,'variableName':null},{'type':_0xf09d('0xa'),'content':'','key':_0xf09d('0xb'),'keyType':_0xf09d('0x4'),'variableName':_0xf09d('0xc')},{'type':_0xf09d('0xa'),'content':'','key':'Caller\x20Name','keyType':_0xf09d('0x4'),'variableName':_0xf09d('0xd')},{'type':_0xf09d('0xa'),'content':'','key':'Call\x20To','keyType':'variable','variableName':_0xf09d('0xe')},{'type':_0xf09d('0xa'),'content':'','key':_0xf09d('0xf'),'keyType':'variable','variableName':_0xf09d('0x10')},{'type':'keyValue','content':'','key':_0xf09d('0x11'),'keyType':_0xf09d('0x4'),'variableName':_0xf09d('0x12')},{'type':_0xf09d('0xa'),'content':'','key':'Date','keyType':_0xf09d('0x4'),'variableName':_0xf09d('0x13')},{'type':_0xf09d('0x6'),'content':_0xf09d('0x14'),'key':null,'keyType':null,'variableName':null},{'type':_0xf09d('0xa'),'content':'','key':_0xf09d('0x15'),'keyType':'variable','variableName':_0xf09d('0x16')},{'type':'keyValue','content':'','key':_0xf09d('0x17'),'keyType':_0xf09d('0x4'),'variableName':_0xf09d('0x8')},{'type':_0xf09d('0x6'),'content':_0xf09d('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0xf09d('0xa'),'content':'','key':'Agent\x20Ring','keyType':_0xf09d('0x4'),'variableName':_0xf09d('0x13')},{'type':_0xf09d('0xa'),'content':'','key':_0xf09d('0x19'),'keyType':_0xf09d('0x4'),'variableName':_0xf09d('0x1a')},{'type':_0xf09d('0xa'),'content':'','key':_0xf09d('0x1b'),'keyType':'variable','variableName':_0xf09d('0x1c')},{'type':'keyValue','content':'','key':_0xf09d('0x1d'),'keyType':'variable','variableName':_0xf09d('0x1e')},{'type':_0xf09d('0xa'),'content':'','key':_0xf09d('0x1f'),'keyType':_0xf09d('0x4'),'variableName':_0xf09d('0x20')}];break;case _0xf09d('0x5'):_0x56a961=[{'type':'string','content':_0xf09d('0x9'),'variableName':null},{'type':_0xf09d('0xa'),'content':'','key':_0xf09d('0x21'),'keyType':'variable','keyContent':'','variableName':'destcalleridnum'},{'type':'keyValue','content':'','key':_0xf09d('0x22'),'keyType':_0xf09d('0x4'),'keyContent':'','variableName':_0xf09d('0x23')},{'type':_0xf09d('0xa'),'content':'','key':_0xf09d('0x11'),'keyType':_0xf09d('0x4'),'keyContent':'','variableName':_0xf09d('0x12')},{'type':'keyValue','content':'','key':_0xf09d('0x24'),'keyType':'variable','keyContent':'','variableName':'starttime'},{'type':_0xf09d('0x6'),'content':_0xf09d('0x18')},{'type':'keyValue','content':'','key':_0xf09d('0x25'),'keyType':_0xf09d('0x4'),'keyContent':'','variableName':_0xf09d('0x26')},{'type':'keyValue','content':'','key':_0xf09d('0x27'),'keyType':_0xf09d('0x4'),'keyContent':'','variableName':'endtime'},{'type':_0xf09d('0xa'),'content':'','key':_0xf09d('0x28'),'keyType':'variable','keyContent':'','variableName':'duration'},{'type':_0xf09d('0xa'),'content':'','key':'Billable\x20Time','keyType':'variable','keyContent':'','variableName':_0xf09d('0x29')}];break;}}return _0x56a961;}; \ No newline at end of file +var _0xb78e=['Caller\x20Name','Call\x20To','Queue','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','Called\x20Number','Member\x20Name','membername','UniqueId','uniqueid','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','queue','variable','calleridnum','outbound','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0xb78e,0x1c9));var _0xeb78=function(_0x22854f,_0x56a1f2){_0x22854f=_0x22854f-0x0;var _0x4ea183=_0xb78e[_0x22854f];return _0x4ea183;};'use strict';exports[_0xeb78('0x0')]=function(_0x261300,_0x4b8534){var _0x1570f5=[{'type':_0xeb78('0x1'),'content':_0xeb78('0x2'),'variableName':null}];switch(_0x261300[_0xeb78('0x3')]()){case _0xeb78('0x4'):switch(_0x4b8534[_0xeb78('0x3')]()){case _0xeb78('0x5'):_0x1570f5[_0xeb78('0x6')]({'type':'variable','content':'','variableName':_0xeb78('0x7')});_0x1570f5[_0xeb78('0x6')]({'type':_0xeb78('0x8'),'content':'','variableName':_0xeb78('0x9')});break;case _0xeb78('0xa'):_0x1570f5[_0xeb78('0x6')]({'type':_0xeb78('0x1'),'content':'Outbound\x20Call','variableName':null});_0x1570f5[_0xeb78('0x6')]({'type':_0xeb78('0x8'),'content':'','variableName':_0xeb78('0xb')});break;}}return _0x1570f5;};exports[_0xeb78('0xc')]=function(_0x125e97,_0x402680){var _0x15137b=[];switch(_0x125e97[_0xeb78('0x3')]()){case _0xeb78('0x4'):switch(_0x402680['toLowerCase']()){case _0xeb78('0x5'):_0x15137b=[{'type':_0xeb78('0x1'),'content':_0xeb78('0xd'),'key':null,'keyType':null,'variableName':null},{'type':_0xeb78('0xe'),'content':'','key':_0xeb78('0xf'),'keyType':_0xeb78('0x8'),'variableName':_0xeb78('0x9')},{'type':_0xeb78('0xe'),'content':'','key':_0xeb78('0x10'),'keyType':_0xeb78('0x8'),'variableName':'calleridname'},{'type':_0xeb78('0xe'),'content':'','key':_0xeb78('0x11'),'keyType':'variable','variableName':'destexten'},{'type':'keyValue','content':'','key':_0xeb78('0x12'),'keyType':'variable','variableName':_0xeb78('0x7')},{'type':_0xeb78('0xe'),'content':'','key':'UniqueId','keyType':_0xeb78('0x8'),'variableName':'uniqueid'},{'type':_0xeb78('0xe'),'content':'','key':_0xeb78('0x13'),'keyType':'variable','variableName':_0xeb78('0x14')},{'type':_0xeb78('0x1'),'content':_0xeb78('0x15'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xeb78('0x16'),'keyType':_0xeb78('0x8'),'variableName':'destcalleridname'},{'type':'keyValue','content':'','key':_0xeb78('0x17'),'keyType':_0xeb78('0x8'),'variableName':_0xeb78('0xb')},{'type':_0xeb78('0x1'),'content':_0xeb78('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0xeb78('0xe'),'content':'','key':_0xeb78('0x19'),'keyType':_0xeb78('0x8'),'variableName':_0xeb78('0x14')},{'type':'keyValue','content':'','key':'Agent\x20Connect','keyType':'variable','variableName':'agentconnectAt'},{'type':_0xeb78('0xe'),'content':'','key':'Agent\x20Complete','keyType':_0xeb78('0x8'),'variableName':_0xeb78('0x1a')},{'type':'keyValue','content':'','key':_0xeb78('0x1b'),'keyType':'variable','variableName':_0xeb78('0x1c')},{'type':_0xeb78('0xe'),'content':'','key':_0xeb78('0x1d'),'keyType':_0xeb78('0x8'),'variableName':'talktime'}];break;case _0xeb78('0xa'):_0x15137b=[{'type':'string','content':_0xeb78('0xd'),'variableName':null},{'type':_0xeb78('0xe'),'content':'','key':_0xeb78('0x1e'),'keyType':'variable','keyContent':'','variableName':_0xeb78('0xb')},{'type':_0xeb78('0xe'),'content':'','key':_0xeb78('0x1f'),'keyType':_0xeb78('0x8'),'keyContent':'','variableName':_0xeb78('0x20')},{'type':_0xeb78('0xe'),'content':'','key':_0xeb78('0x21'),'keyType':_0xeb78('0x8'),'keyContent':'','variableName':_0xeb78('0x22')},{'type':_0xeb78('0xe'),'content':'','key':_0xeb78('0x13'),'keyType':'variable','keyContent':'','variableName':'starttime'},{'type':'string','content':_0xeb78('0x18')},{'type':_0xeb78('0xe'),'content':'','key':_0xeb78('0x23'),'keyType':'variable','keyContent':'','variableName':_0xeb78('0x24')},{'type':_0xeb78('0xe'),'content':'','key':_0xeb78('0x25'),'keyType':_0xeb78('0x8'),'keyContent':'','variableName':_0xeb78('0x26')},{'type':_0xeb78('0xe'),'content':'','key':_0xeb78('0x27'),'keyType':_0xeb78('0x8'),'keyContent':'','variableName':_0xeb78('0x28')},{'type':'keyValue','content':'','key':_0xeb78('0x29'),'keyType':'variable','keyContent':'','variableName':_0xeb78('0x2a')}];break;}}return _0x15137b;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 4341f27..b5edbf2 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcac6=['chat-interactions','whatsapp-interactions','upperFirst','InteractionId','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','stringify','null','Interaction','then','update','info','catch','error','user','clone','omit','body','html','phone','fax','mobile','../../mysqldb','../../config/logger','openchannel-interactions','fax-interactions','sms-interactions'];(function(_0x3669d5,_0x1e3897){var _0x48def1=function(_0x524bb0){while(--_0x524bb0){_0x3669d5['push'](_0x3669d5['shift']());}};_0x48def1(++_0x1e3897);}(_0xcac6,0xa3));var _0x6cac=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcac6[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var db=require(_0x6cac('0x0'))['db'];var loggers={'openchannel':require(_0x6cac('0x1'))(_0x6cac('0x2')),'mail':require(_0x6cac('0x1'))('mail-interactions'),'fax':require('../../config/logger')(_0x6cac('0x3')),'sms':require(_0x6cac('0x1'))(_0x6cac('0x4')),'chat':require(_0x6cac('0x1'))(_0x6cac('0x5')),'whatsapp':require(_0x6cac('0x1'))(_0x6cac('0x6'))};function getInteractionId(_0x51a850,_0x2abd7b,_0x21c42a){if(_0x51a850&&_0x51a850[_[_0x6cac('0x7')](_0x21c42a)+_0x6cac('0x8')]){return _0x51a850[_[_0x6cac('0x7')](_0x21c42a)+'InteractionId'];}else if(_0x51a850&&_0x51a850['id']){return _0x51a850['id'];}else if(_0x2abd7b&&_0x2abd7b['id']){return _0x2abd7b['id'];}else{return'unknown';}}function log(_0x44654a,_0x58564a,_0x1a0893,_0x31d8a0,_0x9cc09a,_0x275141){loggers[_0x9cc09a['toLowerCase']()][_0x44654a](_0x6cac('0x9'),_0x275141['toUpperCase'](),_0x58564a?_0x58564a['id']:null,_0x58564a?_0x58564a[_0x6cac('0xa')]:null,_0x58564a?_0x58564a[_0x6cac('0xb')]:null,getInteractionId(_0x1a0893,_0x31d8a0,_0x9cc09a),_0x1a0893?JSON[_0x6cac('0xc')](_0x1a0893):_0x6cac('0xd'));}function updateUser(_0x25d5e0,_0x15a71e,_0x544b50,_0x479bf1,_0x4fd561){db[_[_0x6cac('0x7')](_0x479bf1)+_0x6cac('0xe')]['findOne']({'where':{'id':getInteractionId(_0x15a71e,_0x544b50,_0x479bf1)}})[_0x6cac('0xf')](function(_0x47e205){if(_0x47e205){return _0x47e205[_0x6cac('0x10')]({'UserId':_0x25d5e0?_0x25d5e0['id']:null});}})[_0x6cac('0xf')](function(_0x5b002c){if(_0x5b002c){log(_0x6cac('0x11'),_0x25d5e0,_0x15a71e,_0x544b50,_0x479bf1,_0x4fd561);}})[_0x6cac('0x12')](function(){log(_0x6cac('0x13'),_0x25d5e0,_0x15a71e,_0x544b50,_0x479bf1,_0x4fd561);});}exports['tracked']=function(_0x11b86f,_0x4cd6b4){return function(_0x1a392b,_0x45adb0,_0x3c8e59){var _0x1346e4=_0x1a392b[_0x6cac('0x14')];var _0x3188aa={};var _0x1ae1cf=_0x1a392b['query'];if(_0x3188aa){_0x3188aa=_[_0x6cac('0x15')](_0x1a392b['body']);_0x3188aa=_[_0x6cac('0x16')](_0x3188aa,[_0x6cac('0x17'),_0x6cac('0x18'),_0x6cac('0x19'),_0x6cac('0x1a'),_0x6cac('0x1b')]);}updateUser(_0x1346e4,_0x3188aa,_0x1ae1cf,_0x11b86f,_0x4cd6b4);_0x3c8e59(null);};}; \ No newline at end of file +var _0xab5b=['html','fax','mobile','lodash','../../mysqldb','openchannel-interactions','../../config/logger','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','stringify','Interaction','findOne','then','update','info','catch','tracked','user','query','clone','omit','body'];(function(_0xc6db01,_0x559c47){var _0x262017=function(_0x380467){while(--_0x380467){_0xc6db01['push'](_0xc6db01['shift']());}};_0x262017(++_0x559c47);}(_0xab5b,0x11a));var _0xbab5=function(_0x5312a8,_0x19f6cd){_0x5312a8=_0x5312a8-0x0;var _0x252614=_0xab5b[_0x5312a8];return _0x252614;};'use strict';var _=require(_0xbab5('0x0'));var db=require(_0xbab5('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0xbab5('0x2')),'mail':require(_0xbab5('0x3'))('mail-interactions'),'fax':require('../../config/logger')(_0xbab5('0x4')),'sms':require('../../config/logger')(_0xbab5('0x5')),'chat':require(_0xbab5('0x3'))(_0xbab5('0x6')),'whatsapp':require(_0xbab5('0x3'))(_0xbab5('0x7'))};function getInteractionId(_0x5642aa,_0x102395,_0x10c7fe){if(_0x5642aa&&_0x5642aa[_[_0xbab5('0x8')](_0x10c7fe)+_0xbab5('0x9')]){return _0x5642aa[_[_0xbab5('0x8')](_0x10c7fe)+'InteractionId'];}else if(_0x5642aa&&_0x5642aa['id']){return _0x5642aa['id'];}else if(_0x102395&&_0x102395['id']){return _0x102395['id'];}else{return _0xbab5('0xa');}}function log(_0x31f54b,_0x37ccba,_0x4c9350,_0x226c55,_0xfbb62c,_0x49104d){loggers[_0xfbb62c[_0xbab5('0xb')]()][_0x31f54b](_0xbab5('0xc'),_0x49104d[_0xbab5('0xd')](),_0x37ccba?_0x37ccba['id']:null,_0x37ccba?_0x37ccba[_0xbab5('0xe')]:null,_0x37ccba?_0x37ccba['role']:null,getInteractionId(_0x4c9350,_0x226c55,_0xfbb62c),_0x4c9350?JSON[_0xbab5('0xf')](_0x4c9350):'null');}function updateUser(_0x332b0e,_0xee0909,_0x122c12,_0x2bae54,_0x40c9e1){db[_['upperFirst'](_0x2bae54)+_0xbab5('0x10')][_0xbab5('0x11')]({'where':{'id':getInteractionId(_0xee0909,_0x122c12,_0x2bae54)}})[_0xbab5('0x12')](function(_0x39e802){if(_0x39e802){return _0x39e802[_0xbab5('0x13')]({'UserId':_0x332b0e?_0x332b0e['id']:null});}})[_0xbab5('0x12')](function(_0xdfd788){if(_0xdfd788){log(_0xbab5('0x14'),_0x332b0e,_0xee0909,_0x122c12,_0x2bae54,_0x40c9e1);}})[_0xbab5('0x15')](function(){log('error',_0x332b0e,_0xee0909,_0x122c12,_0x2bae54,_0x40c9e1);});}exports[_0xbab5('0x16')]=function(_0x403414,_0x3213d6){return function(_0x505763,_0x5aa7be,_0x288a1b){var _0x3f039d=_0x505763[_0xbab5('0x17')];var _0x1dd0b2={};var _0x1d70a1=_0x505763[_0xbab5('0x18')];if(_0x1dd0b2){_0x1dd0b2=_[_0xbab5('0x19')](_0x505763['body']);_0x1dd0b2=_[_0xbab5('0x1a')](_0x1dd0b2,[_0xbab5('0x1b'),_0xbab5('0x1c'),'phone',_0xbab5('0x1d'),_0xbab5('0x1e')]);}updateUser(_0x3f039d,_0x1dd0b2,_0x1d70a1,_0x403414,_0x3213d6);_0x288a1b(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 24f544c..04599d8 100644 --- a/server/components/license/service.js +++ b/server/components/license/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x93ee=['%s:%s:%s','update','utf8','parse','use','License','then','count','status','catch','users','admin','user','crypto','util','composable-middleware','../../config/environment','license','data1','split','createDecipher','aes-256-ctr','format'];(function(_0x261a4a,_0x41ec2e){var _0x33da9d=function(_0xc6fafe){while(--_0xc6fafe){_0x261a4a['push'](_0x261a4a['shift']());}};_0x33da9d(++_0x41ec2e);}(_0x93ee,0xc5));var _0xe93e=function(_0x12e3e3,_0x501eaf){_0x12e3e3=_0x12e3e3-0x0;var _0x26602e=_0x93ee[_0x12e3e3];return _0x26602e;};'use strict';var crypto=require(_0xe93e('0x0'));var util=require(_0xe93e('0x1'));var compose=require(_0xe93e('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0xe93e('0x3'));function getValueFromLicense(_0x5b7553,_0x4e0660){if(_0x5b7553&&_0x4e0660){if(_0x4e0660['data1']&&_0x4e0660[_0xe93e('0x4')]){var _0x281f24=_0x4e0660[_0xe93e('0x5')];var _0x2ae245=_0x4e0660['license'];var _0x346c76=_0x281f24[_0xe93e('0x6')]('-')[0x4];var _0x49f5b1=_0x281f24['split']('-')[0x0];var _0x393941=crypto[_0xe93e('0x7')](_0xe93e('0x8'),util[_0xe93e('0x9')](_0xe93e('0xa'),_0x346c76,_0x281f24,_0x49f5b1));var _0x171055=_0x393941[_0xe93e('0xb')](_0x2ae245,'base64','utf8');_0x171055+=_0x393941['final'](_0xe93e('0xc'));var _0x1e4fdd=JSON[_0xe93e('0xd')](_0x171055);return _0x1e4fdd['hasOwnProperty'](_0x5b7553)?_0x1e4fdd[_0x5b7553]:null;}}return null;}function isLimit(_0x1929e9,_0x9bd7d0,_0x3ec577,_0x35f406){var _0x4e7654=_0x9bd7d0;return compose()[_0xe93e('0xe')](function(_0x27e96d,_0x55c7e5,_0x363053){return db[_0xe93e('0xf')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0xe93e('0x10')](function(_0x3b04de){var _0x44fdd0=getValueFromLicense(_0x1929e9,_0x3b04de);return _0x44fdd0?_0x44fdd0:_0x4e7654;})['then'](function(_0x314abe){_0x4e7654=_0x314abe;return _0x3ec577[_0xe93e('0x11')](_0x35f406);})[_0xe93e('0x10')](function(_0x23fed2){if(_0x23fed2>=_0x4e7654){return _0x55c7e5[_0xe93e('0x12')](0x193)['json']({'message':util[_0xe93e('0x9')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x1929e9)});}_0x363053();})[_0xe93e('0x13')](function(_0xb02c25){_0x363053(_0xb02c25);});});}function isUserLimit(){return isLimit(_0xe93e('0x14'),0x1,db['User'],{'where':{'$or':[{'role':_0xe93e('0x15')},{'role':_0xe93e('0x16')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0x3a27=['%s:%s:%s','update','utf8','final','parse','hasOwnProperty','use','License','findOne','then','count','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','admin','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format'];(function(_0x32d414,_0x4d23da){var _0x4e0bca=function(_0x15d397){while(--_0x15d397){_0x32d414['push'](_0x32d414['shift']());}};_0x4e0bca(++_0x4d23da);}(_0x3a27,0xdf));var _0x73a2=function(_0x17448c,_0x38f5e9){_0x17448c=_0x17448c-0x0;var _0x41c386=_0x3a27[_0x17448c];return _0x41c386;};'use strict';var crypto=require(_0x73a2('0x0'));var util=require(_0x73a2('0x1'));var compose=require(_0x73a2('0x2'));var db=require(_0x73a2('0x3'))['db'];var config=require(_0x73a2('0x4'));function getValueFromLicense(_0x5b136f,_0x426570){if(_0x5b136f&&_0x426570){if(_0x426570['data1']&&_0x426570['license']){var _0x5b3cbf=_0x426570[_0x73a2('0x5')];var _0x58aba5=_0x426570[_0x73a2('0x6')];var _0x53e29c=_0x5b3cbf[_0x73a2('0x7')]('-')[0x4];var _0x39d36e=_0x5b3cbf['split']('-')[0x0];var _0x4e2623=crypto[_0x73a2('0x8')](_0x73a2('0x9'),util[_0x73a2('0xa')](_0x73a2('0xb'),_0x53e29c,_0x5b3cbf,_0x39d36e));var _0x5b2c90=_0x4e2623[_0x73a2('0xc')](_0x58aba5,'base64',_0x73a2('0xd'));_0x5b2c90+=_0x4e2623[_0x73a2('0xe')](_0x73a2('0xd'));var _0x3389d1=JSON[_0x73a2('0xf')](_0x5b2c90);return _0x3389d1[_0x73a2('0x10')](_0x5b136f)?_0x3389d1[_0x5b136f]:null;}}return null;}function isLimit(_0x152fa1,_0x4bd453,_0x5efdeb,_0x54d743){var _0x3981a1=_0x4bd453;return compose()[_0x73a2('0x11')](function(_0x3dd781,_0x484772,_0x3061ad){return db[_0x73a2('0x12')][_0x73a2('0x13')]({'where':{'id':0x1},'raw':!![]})[_0x73a2('0x14')](function(_0x7cf5ef){var _0x5a45bd=getValueFromLicense(_0x152fa1,_0x7cf5ef);return _0x5a45bd?_0x5a45bd:_0x3981a1;})[_0x73a2('0x14')](function(_0x407770){_0x3981a1=_0x407770;return _0x5efdeb[_0x73a2('0x15')](_0x54d743);})[_0x73a2('0x14')](function(_0x20f955){if(_0x20f955>=_0x3981a1){return _0x484772['status'](0x193)[_0x73a2('0x16')]({'message':util[_0x73a2('0xa')](_0x73a2('0x17'),_0x152fa1)});}_0x3061ad();})['catch'](function(_0x682d51){_0x3061ad(_0x682d51);});});}function isUserLimit(){return isLimit(_0x73a2('0x18'),0x1,db['User'],{'where':{'$or':[{'role':_0x73a2('0x19')},{'role':'user'}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 34ef753..e588088 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 _0x7ad8=['DATE','$eq','$between','includes','$gt','value','add','days','format','YYYY-MM-DD','castTo','text','CAST(','\x20AS\x20','operator','field','$ne','$notIn','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','LIKE\x20?','$lt','>\x20?','$lte','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$endsWith','pop','utcOffset','hours','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','slice','forEach','shift','match','filter','map','push','buildExpression'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7ad8,0x184));var _0x87ad=function(_0x8e8ca7,_0x5a5e07){_0x8e8ca7=_0x8e8ca7-0x0;var _0x561381=_0x7ad8[_0x8e8ca7];return _0x561381;};'use strict';var _=require(_0x87ad('0x0'));var moment=require(_0x87ad('0x1'));exports[_0x87ad('0x2')]=function(_0x2073a7){var _0x3fc942={'conditions':[]};_0x3fc942[_0x87ad('0x3')]=_[_0x87ad('0x4')](_0x2073a7,_0x87ad('0x5'))?'or':_0x87ad('0x6');var _0x473ad3=_0x2073a7[_0x87ad('0x7')](_0x87ad('0x8'),'')[_0x87ad('0x7')](_0x87ad('0x5'),'')[_0x87ad('0x9')]('||');for(var _0x54c436=0x0;_0x54c436<_0x473ad3['length'];_0x54c436++){var _0x173e3f=_0x473ad3[_0x54c436][_0x87ad('0x9')](':=');var _0x1cced7=_0x173e3f[0x0];var _0x3e6654=_0x173e3f[_0x87ad('0xa')](0x1);_0x3e6654[_0x87ad('0xb')](function(_0x24833d){var _0x4d3897=_0x24833d[_0x87ad('0x9')]('[')[_0x87ad('0xc')]();var _0x51b3f7=_0x24833d[_0x87ad('0xd')](/\[(.*?)\]/g);_0x51b3f7['forEach'](function(_0x4cf51e){var _0x525595=_0x4cf51e[_0x87ad('0x9')]('[')[_0x87ad('0xe')](function(_0xacbe96){return _0xacbe96['indexOf'](']')>-0x1;})[_0x87ad('0xf')](function(_0x3aa2d1){return _0x3aa2d1[_0x87ad('0x9')](']')[0x0];})[0x0];_0x3fc942['conditions'][_0x87ad('0x10')]({'field':_0x1cced7,'operator':_0x4d3897,'value':_0x525595});});});}return _0x3fc942;};exports[_0x87ad('0x11')]=function(_0x3a88f8,_0x491c5e,_0x444015){var _0x242738={};if(_0x491c5e===_0x87ad('0x12')){if(_0x444015['operator']===_0x87ad('0x13')){_0x444015['operator']=_0x87ad('0x14');_0x444015['value']+=','+_0x444015['value'];}else if(_[_0x87ad('0x15')]([_0x87ad('0x16'),'$lte'],_0x444015['operator'])){_0x444015['value']=moment(_0x444015[_0x87ad('0x17')])[_0x87ad('0x18')](0x1,_0x87ad('0x19'))[_0x87ad('0x1a')](_0x87ad('0x1b'));}}if(_0x444015[_0x87ad('0x1c')]){_0x491c5e=_0x444015[_0x87ad('0x1c')];_0x242738[_0x87ad('0x1d')]=_0x87ad('0x1e')+_0x3a88f8+'.'+_0x444015['field']+_0x87ad('0x1f')+_0x444015[_0x87ad('0x1c')]+')\x20'+parseOperator(_0x444015[_0x87ad('0x20')]);}else{_0x242738[_0x87ad('0x1d')]=_0x3a88f8+'.'+_0x444015[_0x87ad('0x21')]+'\x20'+parseOperator(_0x444015[_0x87ad('0x20')]);}if(_[_0x87ad('0x15')]([_0x87ad('0x22'),_0x87ad('0x23')],_0x444015[_0x87ad('0x20')]))_0x242738[_0x87ad('0x1d')]='('+_0x242738[_0x87ad('0x1d')]+'\x20OR\x20'+_0x3a88f8+'.'+_0x444015[_0x87ad('0x21')]+_0x87ad('0x24');_0x242738[_0x87ad('0x17')]=parseValue(_0x491c5e,_0x444015[_0x87ad('0x20')],_0x444015[_0x87ad('0x17')]);return _0x242738;};function parseOperator(_0x5a0f93){var _0x49d6de;switch(_0x5a0f93){case _0x87ad('0x25'):_0x49d6de=_0x87ad('0x26');break;case _0x87ad('0x23'):_0x49d6de=_0x87ad('0x27');break;case'$eq':_0x49d6de=_0x87ad('0x28');break;case'$ne':_0x49d6de=_0x87ad('0x29');break;case _0x87ad('0x2a'):case _0x87ad('0x2b'):case'$endsWith':_0x49d6de=_0x87ad('0x2c');break;case _0x87ad('0x2d'):_0x49d6de='<\x20?';break;case _0x87ad('0x16'):_0x49d6de=_0x87ad('0x2e');break;case _0x87ad('0x2f'):_0x49d6de=_0x87ad('0x30');break;case _0x87ad('0x31'):_0x49d6de=_0x87ad('0x32');break;case'$between':_0x49d6de=_0x87ad('0x33');break;}return _0x49d6de;}function parseValue(_0x35a302,_0x35f945,_0x1e65a5){var _0x1a9c4c={'start':undefined,'end':undefined};switch(_0x35f945){case _0x87ad('0x25'):case _0x87ad('0x23'):_0x1a9c4c[_0x87ad('0x34')]=_0x1e65a5[_0x87ad('0x9')](',');break;case _0x87ad('0x2a'):_0x1a9c4c[_0x87ad('0x34')]='%'+_0x1e65a5+'%';break;case _0x87ad('0x2b'):_0x1a9c4c['start']=_0x1e65a5+'%';break;case _0x87ad('0x35'):_0x1a9c4c['start']='%'+_0x1e65a5;break;case _0x87ad('0x14'):var _0x16404a=_0x1e65a5['split'](',');var _0x1e65a5=_0x16404a[_0x87ad('0xc')]();var _0x1d8cda=_0x16404a[_0x87ad('0x36')]();if(_0x35a302==='DATE'){_0x1e65a5=moment(_0x1e65a5)[_0x87ad('0x37')](0x0,!![])['format']();_0x1d8cda=moment(_0x1d8cda)[_0x87ad('0x37')](0x0,!![])['add'](0x17,_0x87ad('0x38'))['add'](0x3b,'minutes')[_0x87ad('0x18')](0x3b,_0x87ad('0x39'))['format']();}_0x1a9c4c={'start':_0x1e65a5,'end':_0x1d8cda};break;default:_0x1a9c4c['start']=_0x1e65a5;break;}return _0x1a9c4c;} \ No newline at end of file +var _0x2993=['field','$ne','$notIn','text','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','$eq','=\x20?','<>\x20?','$startsWith','LIKE\x20?','$lt','<\x20?','>\x20?','$gte','$substring','start','pop','utcOffset','hours','add','minutes','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','split','length','forEach','shift','filter','push','DATE','$between','value','includes','$gt','$lte','operator','days','format','YYYY-MM-DD','castTo'];(function(_0x5f0c67,_0x385778){var _0x3f1d17=function(_0x3522c3){while(--_0x3522c3){_0x5f0c67['push'](_0x5f0c67['shift']());}};_0x3f1d17(++_0x385778);}(_0x2993,0x1db));var _0x3299=function(_0x158c8d,_0x374278){_0x158c8d=_0x158c8d-0x0;var _0x2ccedb=_0x2993[_0x158c8d];return _0x2ccedb;};'use strict';var _=require(_0x3299('0x0'));var moment=require(_0x3299('0x1'));exports[_0x3299('0x2')]=function(_0x11ca45){var _0x2136ad={'conditions':[]};_0x2136ad[_0x3299('0x3')]=_[_0x3299('0x4')](_0x11ca45,_0x3299('0x5'))?'or':_0x3299('0x6');var _0x2ba389=_0x11ca45[_0x3299('0x7')]('[$and]','')[_0x3299('0x7')](_0x3299('0x5'),'')[_0x3299('0x8')]('||');for(var _0xb8f347=0x0;_0xb8f347<_0x2ba389[_0x3299('0x9')];_0xb8f347++){var _0x4c3b00=_0x2ba389[_0xb8f347][_0x3299('0x8')](':=');var _0x52ecf9=_0x4c3b00[0x0];var _0x1cefda=_0x4c3b00['slice'](0x1);_0x1cefda[_0x3299('0xa')](function(_0x4a810e){var _0x13956a=_0x4a810e['split']('[')[_0x3299('0xb')]();var _0x319f70=_0x4a810e['match'](/\[(.*?)\]/g);_0x319f70[_0x3299('0xa')](function(_0x355545){var _0x165013=_0x355545[_0x3299('0x8')]('[')[_0x3299('0xc')](function(_0x4aaa24){return _0x4aaa24['indexOf'](']')>-0x1;})['map'](function(_0x239308){return _0x239308[_0x3299('0x8')](']')[0x0];})[0x0];_0x2136ad['conditions'][_0x3299('0xd')]({'field':_0x52ecf9,'operator':_0x13956a,'value':_0x165013});});});}return _0x2136ad;};exports['buildExpression']=function(_0x3caedb,_0xc446f2,_0x1f832c){var _0x199e36={};if(_0xc446f2===_0x3299('0xe')){if(_0x1f832c['operator']==='$eq'){_0x1f832c['operator']=_0x3299('0xf');_0x1f832c['value']+=','+_0x1f832c[_0x3299('0x10')];}else if(_[_0x3299('0x11')]([_0x3299('0x12'),_0x3299('0x13')],_0x1f832c[_0x3299('0x14')])){_0x1f832c[_0x3299('0x10')]=moment(_0x1f832c['value'])['add'](0x1,_0x3299('0x15'))[_0x3299('0x16')](_0x3299('0x17'));}}if(_0x1f832c[_0x3299('0x18')]){_0xc446f2=_0x1f832c[_0x3299('0x18')];_0x199e36['text']='CAST('+_0x3caedb+'.'+_0x1f832c[_0x3299('0x19')]+'\x20AS\x20'+_0x1f832c[_0x3299('0x18')]+')\x20'+parseOperator(_0x1f832c[_0x3299('0x14')]);}else{_0x199e36['text']=_0x3caedb+'.'+_0x1f832c[_0x3299('0x19')]+'\x20'+parseOperator(_0x1f832c[_0x3299('0x14')]);}if(_[_0x3299('0x11')]([_0x3299('0x1a'),_0x3299('0x1b')],_0x1f832c[_0x3299('0x14')]))_0x199e36['text']='('+_0x199e36[_0x3299('0x1c')]+_0x3299('0x1d')+_0x3caedb+'.'+_0x1f832c[_0x3299('0x19')]+_0x3299('0x1e');_0x199e36[_0x3299('0x10')]=parseValue(_0xc446f2,_0x1f832c[_0x3299('0x14')],_0x1f832c[_0x3299('0x10')]);return _0x199e36;};function parseOperator(_0x1e31ac){var _0x539886;switch(_0x1e31ac){case _0x3299('0x1f'):_0x539886=_0x3299('0x20');break;case'$notIn':_0x539886=_0x3299('0x21');break;case _0x3299('0x22'):_0x539886=_0x3299('0x23');break;case _0x3299('0x1a'):_0x539886=_0x3299('0x24');break;case'$substring':case _0x3299('0x25'):case'$endsWith':_0x539886=_0x3299('0x26');break;case _0x3299('0x27'):_0x539886=_0x3299('0x28');break;case _0x3299('0x12'):_0x539886=_0x3299('0x29');break;case'$lte':_0x539886='<=\x20?';break;case _0x3299('0x2a'):_0x539886='>=\x20?';break;case _0x3299('0xf'):_0x539886='BETWEEN\x20?\x20AND\x20?';break;}return _0x539886;}function parseValue(_0x32e97b,_0x5305b5,_0x3e68ed){var _0x1be970={'start':undefined,'end':undefined};switch(_0x5305b5){case'$in':case _0x3299('0x1b'):_0x1be970['start']=_0x3e68ed[_0x3299('0x8')](',');break;case _0x3299('0x2b'):_0x1be970[_0x3299('0x2c')]='%'+_0x3e68ed+'%';break;case'$startsWith':_0x1be970[_0x3299('0x2c')]=_0x3e68ed+'%';break;case'$endsWith':_0x1be970['start']='%'+_0x3e68ed;break;case _0x3299('0xf'):var _0x152a85=_0x3e68ed[_0x3299('0x8')](',');var _0x3e68ed=_0x152a85[_0x3299('0xb')]();var _0x345223=_0x152a85[_0x3299('0x2d')]();if(_0x32e97b==='DATE'){_0x3e68ed=moment(_0x3e68ed)[_0x3299('0x2e')](0x0,!![])[_0x3299('0x16')]();_0x345223=moment(_0x345223)[_0x3299('0x2e')](0x0,!![])['add'](0x17,_0x3299('0x2f'))[_0x3299('0x30')](0x3b,_0x3299('0x31'))[_0x3299('0x30')](0x3b,'seconds')[_0x3299('0x16')]();}_0x1be970={'start':_0x3e68ed,'end':_0x345223};break;default:_0x1be970[_0x3299('0x2c')]=_0x3e68ed;break;}return _0x1be970;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index f134b44..c6e15d2 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 _0xffaa=['unset','hasOwnProperty','isNumeric','^[0-9]*$','isEmail','getFullTextValue','forEach','push','toString','join','lodash','sequelize','moment','split','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','parse','$gte','format','YYYY-MM-DD','utc','subtract','limit','offset','sort','map','indexOf','cast','col','priority','unsigned','substr','DESC','ASC','omit','isArray','length'];(function(_0x2ae380,_0x4c7063){var _0x4ece2c=function(_0x2b744e){while(--_0x2b744e){_0x2ae380['push'](_0x2ae380['shift']());}};_0x4ece2c(++_0x4c7063);}(_0xffaa,0x130));var _0xaffa=function(_0x1a092d,_0x5aa939){_0x1a092d=_0x1a092d-0x0;var _0x399d46=_0xffaa[_0x1a092d];return _0x399d46;};'use strict';var _=require(_0xaffa('0x0'));var sequelize=require(_0xaffa('0x1'));var moment=require(_0xaffa('0x2'));var LIMIT_VALUE=0xfa;exports['fields']=function(_0x5d597a){var _0x124832=null;if(_0x5d597a){_0x124832=_0x5d597a[_0xaffa('0x3')](',');}return _0x124832;};exports[_0xaffa('0x4')]=function(_0xd01185,_0x444eef){var _0x46692a={};if(!_[_0xaffa('0x5')](_0xd01185)){_[_0xaffa('0x6')](_0xd01185,function(_0x4306c0,_0x281191){try{if(_0x444eef){var _0x48320d=_[_0xaffa('0x7')](_0x444eef,{'name':_0x281191})||{};if(_0x48320d[_0xaffa('0x8')]===_0xaffa('0x9')&&_[_0xaffa('0xa')](_0x4306c0)){var _0x5d2ebb=JSON[_0xaffa('0xb')](_0x4306c0);var _0x53c918={'$gte':moment(moment(_0x5d2ebb[_0xaffa('0xc')])[_0xaffa('0xd')](_0xaffa('0xe')))['utc']()[_0xaffa('0xd')](),'$lte':moment(moment(_0x5d2ebb['$lte'])['format']('YYYY-MM-DD'))[_0xaffa('0xf')]()[_0xaffa('0x10')](0x1,'s')[_0xaffa('0xd')]()};_0x46692a[_0x281191]=_0x53c918;}else{_0x46692a[_0x281191]=_['isArray'](_0x4306c0)?_0x4306c0:JSON[_0xaffa('0xb')](_0x4306c0);}}else{_0x46692a[_0x281191]=_['isArray'](_0x4306c0)?_0x4306c0:JSON[_0xaffa('0xb')](_0x4306c0);}}catch(_0x5b238c){_0x46692a[_0x281191]=_0x4306c0[_0xaffa('0x3')](',');}});}return _0x46692a;};exports[_0xaffa('0x11')]=function(_0x255025){_0x255025=parseInt(_0x255025,0xa);if(!_0x255025||_0x255025<0x0){_0x255025=LIMIT_VALUE;}return _0x255025;};exports[_0xaffa('0x12')]=function(_0x14f495){_0x14f495=parseInt(_0x14f495,0xa);if(!_0x14f495||_0x14f495<0x0){_0x14f495=0x0;}return _0x14f495;};exports[_0xaffa('0x13')]=function(_0x11d334){var _0x323a2f,_0x5cc262=null;if(_0x11d334){_0x323a2f=_0x11d334[_0xaffa('0x3')](',');_0x5cc262=_[_0xaffa('0x14')](_0x323a2f,function(_0x4b7d89){if(_0x4b7d89[_0xaffa('0x15')]('-')===0x0){return[_0x4b7d89==='priority'?sequelize[_0xaffa('0x16')](sequelize[_0xaffa('0x17')](_0xaffa('0x18')),_0xaffa('0x19')):_0x4b7d89[_0xaffa('0x1a')](0x1),_0xaffa('0x1b')];}else{return[_0x4b7d89==='priority'?sequelize[_0xaffa('0x16')](sequelize[_0xaffa('0x17')](_0xaffa('0x18')),_0xaffa('0x19')):_0x4b7d89,_0xaffa('0x1c')];}});}return _0x5cc262;};exports[_0xaffa('0x1d')]=function(_0x23e60f,_0x538663){if(_['isEmpty'](_0x23e60f)){return _0x23e60f;}if(_[_0xaffa('0x1e')](_0x23e60f)){for(var _0x256349=0x0;_0x256349<_0x23e60f[_0xaffa('0x1f')];_0x256349+=0x1){_0x23e60f[_0x256349]=this[_0xaffa('0x1d')](_0x23e60f[_0x256349],_0x538663);}return _0x23e60f;}if(!_['isObject'](_0x23e60f)){return _0x23e60f;}if(_['isString'](_0x538663)){_0x538663=[_0x538663];}if(!_[_0xaffa('0x1e')](_0x538663)){return _0x23e60f;}for(var _0x3f7dee=0x0;_0x3f7dee<_0x538663['length'];_0x3f7dee+=0x1){_[_0xaffa('0x20')](_0x23e60f,_0x538663[_0x3f7dee]);}for(var _0x298e2b in _0x23e60f){if(_0x23e60f[_0xaffa('0x21')](_0x298e2b)){_0x23e60f[_0x298e2b]=this[_0xaffa('0x1d')](_0x23e60f[_0x298e2b],_0x538663);}}return _0x23e60f;};exports[_0xaffa('0x22')]=function(_0x2f1320){return _0x2f1320['match'](RegExp(_0xaffa('0x23')))?!![]:![];};exports[_0xaffa('0x24')]=function(_0x4b7994){return _0x4b7994['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xaffa('0x25')]=function(_0x46ac99){var _0x348571=[];_0x46ac99[_0xaffa('0x3')]('\x20')[_0xaffa('0x26')](function(_0x411448){_0x348571[_0xaffa('0x27')]('+'+_0x411448[_0xaffa('0x28')]()+'*');});return _0x348571[_0xaffa('0x29')]('\x20');}; \ No newline at end of file +var _0xa8cc=['DESC','cast','omit','isArray','isObject','isString','unset','hasOwnProperty','match','^[0-9]*$','getFullTextValue','forEach','toString','join','sequelize','moment','fields','split','filters','isEmpty','find','type','DATE','isPlainObject','$gte','format','utc','YYYY-MM-DD','subtract','parse','limit','offset','sort','map','indexOf','col','priority','unsigned','substr'];(function(_0x340eaa,_0x57b5a2){var _0x1ae9c8=function(_0x1c464a){while(--_0x1c464a){_0x340eaa['push'](_0x340eaa['shift']());}};_0x1ae9c8(++_0x57b5a2);}(_0xa8cc,0xf8));var _0xca8c=function(_0x135145,_0x557f04){_0x135145=_0x135145-0x0;var _0x2f4f7c=_0xa8cc[_0x135145];return _0x2f4f7c;};'use strict';var _=require('lodash');var sequelize=require(_0xca8c('0x0'));var moment=require(_0xca8c('0x1'));var LIMIT_VALUE=0xfa;exports[_0xca8c('0x2')]=function(_0xa5d386){var _0x231161=null;if(_0xa5d386){_0x231161=_0xa5d386[_0xca8c('0x3')](',');}return _0x231161;};exports[_0xca8c('0x4')]=function(_0x5ccfb5,_0x4864d1){var _0x17f88e={};if(!_[_0xca8c('0x5')](_0x5ccfb5)){_['forOwn'](_0x5ccfb5,function(_0x5cacaa,_0x9ed034){try{if(_0x4864d1){var _0x1a8ec3=_[_0xca8c('0x6')](_0x4864d1,{'name':_0x9ed034})||{};if(_0x1a8ec3[_0xca8c('0x7')]===_0xca8c('0x8')&&_[_0xca8c('0x9')](_0x5cacaa)){var _0x161e5c=JSON['parse'](_0x5cacaa);var _0x2d4b45={'$gte':moment(moment(_0x161e5c[_0xca8c('0xa')])[_0xca8c('0xb')]('YYYY-MM-DD'))[_0xca8c('0xc')]()[_0xca8c('0xb')](),'$lte':moment(moment(_0x161e5c['$lte'])[_0xca8c('0xb')](_0xca8c('0xd')))[_0xca8c('0xc')]()[_0xca8c('0xe')](0x1,'s')['format']()};_0x17f88e[_0x9ed034]=_0x2d4b45;}else{_0x17f88e[_0x9ed034]=_['isArray'](_0x5cacaa)?_0x5cacaa:JSON['parse'](_0x5cacaa);}}else{_0x17f88e[_0x9ed034]=_['isArray'](_0x5cacaa)?_0x5cacaa:JSON[_0xca8c('0xf')](_0x5cacaa);}}catch(_0x312a9a){_0x17f88e[_0x9ed034]=_0x5cacaa[_0xca8c('0x3')](',');}});}return _0x17f88e;};exports[_0xca8c('0x10')]=function(_0x39efcc){_0x39efcc=parseInt(_0x39efcc,0xa);if(!_0x39efcc||_0x39efcc<0x0){_0x39efcc=LIMIT_VALUE;}return _0x39efcc;};exports[_0xca8c('0x11')]=function(_0x54f186){_0x54f186=parseInt(_0x54f186,0xa);if(!_0x54f186||_0x54f186<0x0){_0x54f186=0x0;}return _0x54f186;};exports[_0xca8c('0x12')]=function(_0x494d94){var _0x1f105f,_0x390207=null;if(_0x494d94){_0x1f105f=_0x494d94[_0xca8c('0x3')](',');_0x390207=_[_0xca8c('0x13')](_0x1f105f,function(_0x4c2d62){if(_0x4c2d62[_0xca8c('0x14')]('-')===0x0){return[_0x4c2d62==='priority'?sequelize['cast'](sequelize[_0xca8c('0x15')](_0xca8c('0x16')),_0xca8c('0x17')):_0x4c2d62[_0xca8c('0x18')](0x1),_0xca8c('0x19')];}else{return[_0x4c2d62===_0xca8c('0x16')?sequelize[_0xca8c('0x1a')](sequelize[_0xca8c('0x15')](_0xca8c('0x16')),_0xca8c('0x17')):_0x4c2d62,'ASC'];}});}return _0x390207;};exports[_0xca8c('0x1b')]=function(_0x4f367a,_0x5ac649){if(_[_0xca8c('0x5')](_0x4f367a)){return _0x4f367a;}if(_[_0xca8c('0x1c')](_0x4f367a)){for(var _0x1ebad4=0x0;_0x1ebad4<_0x4f367a['length'];_0x1ebad4+=0x1){_0x4f367a[_0x1ebad4]=this[_0xca8c('0x1b')](_0x4f367a[_0x1ebad4],_0x5ac649);}return _0x4f367a;}if(!_[_0xca8c('0x1d')](_0x4f367a)){return _0x4f367a;}if(_[_0xca8c('0x1e')](_0x5ac649)){_0x5ac649=[_0x5ac649];}if(!_[_0xca8c('0x1c')](_0x5ac649)){return _0x4f367a;}for(var _0x220c24=0x0;_0x220c24<_0x5ac649['length'];_0x220c24+=0x1){_[_0xca8c('0x1f')](_0x4f367a,_0x5ac649[_0x220c24]);}for(var _0x2c2a91 in _0x4f367a){if(_0x4f367a[_0xca8c('0x20')](_0x2c2a91)){_0x4f367a[_0x2c2a91]=this['omit'](_0x4f367a[_0x2c2a91],_0x5ac649);}}return _0x4f367a;};exports['isNumeric']=function(_0xa65fff){return _0xa65fff[_0xca8c('0x21')](RegExp(_0xca8c('0x22')))?!![]:![];};exports['isEmail']=function(_0x42147f){return _0x42147f['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xca8c('0x23')]=function(_0x4daa00){var _0x5437bc=[];_0x4daa00[_0xca8c('0x3')]('\x20')[_0xca8c('0x24')](function(_0x477795){_0x5437bc['push']('+'+_0x477795[_0xca8c('0x25')]()+'*');});return _0x5437bc[_0xca8c('0x26')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 1a88c9e..e36ba9f 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x100a=['toISOString','split','static','views','engine','html','ejs','view\x20engine','urlencoded','50mb','initialize','express','body-parser','method-override','errorhandler','path','passport','cors','moment','./environment','default','get','env','production','set','join','root','public','development','test','appPath','client','use','json\x20replacer'];(function(_0x42baf8,_0x402a8c){var _0x42f10b=function(_0x47e9a9){while(--_0x47e9a9){_0x42baf8['push'](_0x42baf8['shift']());}};_0x42f10b(++_0x402a8c);}(_0x100a,0x13d));var _0xa100=function(_0x3617e2,_0x4e4b18){_0x3617e2=_0x3617e2-0x0;var _0x18220f=_0x100a[_0x3617e2];return _0x18220f;};'use strict';var express=require(_0xa100('0x0'));var favicon=require('serve-favicon');var bodyParser=require(_0xa100('0x1'));var methodOverride=require(_0xa100('0x2'));var cookieParser=require('cookie-parser');var errorHandler=require(_0xa100('0x3'));var path=require(_0xa100('0x4'));var passport=require(_0xa100('0x5'));var cors=require(_0xa100('0x6'));var moment=require(_0xa100('0x7'));var config=require(_0xa100('0x8'));var db=require('../mysqldb')['db'];exports[_0xa100('0x9')]=function(_0x411c93){var _0x52e475=_0x411c93[_0xa100('0xa')](_0xa100('0xb'));if(_0x52e475===_0xa100('0xc')){_0x411c93[_0xa100('0xd')]('appPath',path[_0xa100('0xe')](config[_0xa100('0xf')],_0xa100('0x10')));}if(_0x52e475===_0xa100('0x11')||_0x52e475===_0xa100('0x12')){_0x411c93[_0xa100('0xd')](_0xa100('0x13'),path[_0xa100('0xe')](config[_0xa100('0xf')],_0xa100('0x14')));_0x411c93[_0xa100('0x15')](errorHandler());}_0x411c93['set'](_0xa100('0x16'),function(_0xb9d168,_0x54b569){if(this[_0xb9d168]instanceof Date){_0x54b569=this[_0xb9d168][_0xa100('0x17')]()[_0xa100('0x18')]('.')[0x0]+'Z';}return _0x54b569;});_0x411c93[_0xa100('0x15')](express[_0xa100('0x19')](_0x411c93[_0xa100('0xa')](_0xa100('0x13'))));_0x411c93[_0xa100('0xd')](_0xa100('0x1a'),config[_0xa100('0xf')]+'/server/views');_0x411c93[_0xa100('0x1b')](_0xa100('0x1c'),require(_0xa100('0x1d'))['renderFile']);_0x411c93[_0xa100('0xd')](_0xa100('0x1e'),_0xa100('0x1c'));_0x411c93[_0xa100('0x15')](bodyParser[_0xa100('0x1f')]({'limit':_0xa100('0x20'),'extended':!![]}));_0x411c93[_0xa100('0x15')](bodyParser['json']({'limit':_0xa100('0x20')}));_0x411c93['use'](cors());_0x411c93['use'](methodOverride());_0x411c93[_0xa100('0x15')](cookieParser());_0x411c93['use'](passport[_0xa100('0x21')]());}; \ No newline at end of file +var _0xa48d=['moment','../mysqldb','default','get','env','production','set','appPath','join','root','public','client','use','json\x20replacer','toISOString','views','/server/views','engine','html','renderFile','urlencoded','json','express','serve-favicon','body-parser','method-override','cookie-parser','passport'];(function(_0x4421cf,_0x3f3996){var _0x499fa3=function(_0x2ab147){while(--_0x2ab147){_0x4421cf['push'](_0x4421cf['shift']());}};_0x499fa3(++_0x3f3996);}(_0xa48d,0x86));var _0xda48=function(_0x3963a2,_0x125845){_0x3963a2=_0x3963a2-0x0;var _0x139ead=_0xa48d[_0x3963a2];return _0x139ead;};'use strict';var express=require(_0xda48('0x0'));var favicon=require(_0xda48('0x1'));var bodyParser=require(_0xda48('0x2'));var methodOverride=require(_0xda48('0x3'));var cookieParser=require(_0xda48('0x4'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0xda48('0x5'));var cors=require('cors');var moment=require(_0xda48('0x6'));var config=require('./environment');var db=require(_0xda48('0x7'))['db'];exports[_0xda48('0x8')]=function(_0x2d0a8c){var _0x3f6be2=_0x2d0a8c[_0xda48('0x9')](_0xda48('0xa'));if(_0x3f6be2===_0xda48('0xb')){_0x2d0a8c[_0xda48('0xc')](_0xda48('0xd'),path[_0xda48('0xe')](config[_0xda48('0xf')],_0xda48('0x10')));}if(_0x3f6be2==='development'||_0x3f6be2==='test'){_0x2d0a8c[_0xda48('0xc')](_0xda48('0xd'),path[_0xda48('0xe')](config['root'],_0xda48('0x11')));_0x2d0a8c[_0xda48('0x12')](errorHandler());}_0x2d0a8c[_0xda48('0xc')](_0xda48('0x13'),function(_0x307103,_0x157373){if(this[_0x307103]instanceof Date){_0x157373=this[_0x307103][_0xda48('0x14')]()['split']('.')[0x0]+'Z';}return _0x157373;});_0x2d0a8c[_0xda48('0x12')](express['static'](_0x2d0a8c[_0xda48('0x9')]('appPath')));_0x2d0a8c[_0xda48('0xc')](_0xda48('0x15'),config[_0xda48('0xf')]+_0xda48('0x16'));_0x2d0a8c[_0xda48('0x17')](_0xda48('0x18'),require('ejs')[_0xda48('0x19')]);_0x2d0a8c[_0xda48('0xc')]('view\x20engine',_0xda48('0x18'));_0x2d0a8c[_0xda48('0x12')](bodyParser[_0xda48('0x1a')]({'limit':'50mb','extended':!![]}));_0x2d0a8c[_0xda48('0x12')](bodyParser[_0xda48('0x1b')]({'limit':'50mb'}));_0x2d0a8c[_0xda48('0x12')](cors());_0x2d0a8c[_0xda48('0x12')](methodOverride());_0x2d0a8c[_0xda48('0x12')](cookieParser());_0x2d0a8c[_0xda48('0x12')](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 34d6d0d..176e6be 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 _0x90b5=['createHash','md5','update','digest','hex','getUuid','platform','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','macAddress','substring','lodash','bimedia-machine-uuid','child_process','execSync','orderBy','length','family','IPv4','internal','concat','head','mac','address','getFirstInterface','cpus','map','join'];(function(_0x36ea12,_0x3bcb0e){var _0x59fb1c=function(_0x3c4d78){while(--_0x3c4d78){_0x36ea12['push'](_0x36ea12['shift']());}};_0x59fb1c(++_0x3bcb0e);}(_0x90b5,0x139));var _0x590b=function(_0x40a20b,_0x45f82d){_0x40a20b=_0x40a20b-0x0;var _0x27897c=_0x90b5[_0x40a20b];return _0x27897c;};'use strict';var _=require(_0x590b('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x590b('0x1'));var exec=require(_0x590b('0x2'))[_0x590b('0x3')];function getInterfaces(){var _0xa7594d=[];var _0x5dd1b2=os['networkInterfaces']();var _0x2318b8=_[_0x590b('0x4')](_['keys'](_0x5dd1b2));for(var _0x208ef2=0x0;_0x208ef2<_0x2318b8[_0x590b('0x5')];_0x208ef2++){var _0x88a5f9=_0x5dd1b2[_0x2318b8[_0x208ef2]]['filter'](function(_0x30bc6e){return _0x30bc6e[_0x590b('0x6')]===_0x590b('0x7')&&_0x30bc6e[_0x590b('0x8')]===![];});_0xa7594d=_0xa7594d[_0x590b('0x9')](_0x88a5f9);}return _0xa7594d;}function getFirstInterface(){var _0x268b0a=_[_0x590b('0xa')](getInterfaces());return{'macAddress':_0x268b0a&&_0x268b0a[_0x590b('0xb')]?_0x268b0a[_0x590b('0xb')]:'00:00:00:00:00:00','ipAddress':_0x268b0a&&_0x268b0a[_0x590b('0xc')]?_0x268b0a[_0x590b('0xc')]:'127.0.0.1'};}exports[_0x590b('0xd')]=getFirstInterface;function getCPUhash(){var _0x4a5939=_[_0x590b('0x4')](os[_0x590b('0xe')]()[_0x590b('0xf')](function(_0x477069){return _0x477069['model'];}))[_0x590b('0x10')](':');return crypto[_0x590b('0x11')](_0x590b('0x12'))[_0x590b('0x13')](_0x4a5939)[_0x590b('0x14')](_0x590b('0x15'));}exports[_0x590b('0x16')]=function(){switch(os[_0x590b('0x17')]()){case _0x590b('0x18'):return exec(_0x590b('0x19'),{'encoding':_0x590b('0x1a')})[_0x590b('0x1b')]('\x0d\x0a','');default:var _0x3e4723=getFirstInterface();var _0x378490=getCPUhash();var _0x3b9601=_0x378490+'|'+os['hostname']()+'|'+_0x3e4723[_0x590b('0x1c')]+'|'+_0x3e4723['ipAddress'];var _0x5c788=crypto[_0x590b('0x11')](_0x590b('0x12'))['update'](_0x3b9601)['digest'](_0x590b('0x15'));return _0x5c788['substring'](0x0,0x8)+'-'+_0x5c788[_0x590b('0x1d')](0x8,0xc)+'-'+_0x5c788[_0x590b('0x1d')](0xc,0x10)+'-'+_0x5c788[_0x590b('0x1d')](0x10,0x14)+'-'+_0x5c788['substring'](0x14);}}; \ No newline at end of file +var _0x8ce1=['filter','IPv4','internal','concat','mac','00:00:00:00:00:00','address','getFirstInterface','cpus','map','model','join','createHash','md5','update','hex','getUuid','platform','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','digest','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces','orderBy','keys','length'];(function(_0x14d9a9,_0xaf9ae9){var _0x11e554=function(_0x3ed7a9){while(--_0x3ed7a9){_0x14d9a9['push'](_0x14d9a9['shift']());}};_0x11e554(++_0xaf9ae9);}(_0x8ce1,0x183));var _0x18ce=function(_0x43e832,_0xcbec72){_0x43e832=_0x43e832-0x0;var _0x314b9b=_0x8ce1[_0x43e832];return _0x314b9b;};'use strict';var _=require(_0x18ce('0x0'));var os=require('os');var crypto=require(_0x18ce('0x1'));var machine=require(_0x18ce('0x2'));var exec=require(_0x18ce('0x3'))[_0x18ce('0x4')];function getInterfaces(){var _0x22b196=[];var _0x211dc4=os[_0x18ce('0x5')]();var _0x1d842c=_[_0x18ce('0x6')](_[_0x18ce('0x7')](_0x211dc4));for(var _0x280142=0x0;_0x280142<_0x1d842c[_0x18ce('0x8')];_0x280142++){var _0x36f8db=_0x211dc4[_0x1d842c[_0x280142]][_0x18ce('0x9')](function(_0x359094){return _0x359094['family']===_0x18ce('0xa')&&_0x359094[_0x18ce('0xb')]===![];});_0x22b196=_0x22b196[_0x18ce('0xc')](_0x36f8db);}return _0x22b196;}function getFirstInterface(){var _0x1daeac=_['head'](getInterfaces());return{'macAddress':_0x1daeac&&_0x1daeac[_0x18ce('0xd')]?_0x1daeac[_0x18ce('0xd')]:_0x18ce('0xe'),'ipAddress':_0x1daeac&&_0x1daeac[_0x18ce('0xf')]?_0x1daeac['address']:'127.0.0.1'};}exports[_0x18ce('0x10')]=getFirstInterface;function getCPUhash(){var _0x1a373a=_[_0x18ce('0x6')](os[_0x18ce('0x11')]()[_0x18ce('0x12')](function(_0x5e8c23){return _0x5e8c23[_0x18ce('0x13')];}))[_0x18ce('0x14')](':');return crypto[_0x18ce('0x15')](_0x18ce('0x16'))[_0x18ce('0x17')](_0x1a373a)['digest'](_0x18ce('0x18'));}exports[_0x18ce('0x19')]=function(){switch(os[_0x18ce('0x1a')]()){case _0x18ce('0x1b'):return exec(_0x18ce('0x1c'),{'encoding':_0x18ce('0x1d')})[_0x18ce('0x1e')]('\x0d\x0a','');default:var _0x4a934f=getFirstInterface();var _0x959ce=getCPUhash();var _0x1357ef=_0x959ce+'|'+os[_0x18ce('0x1f')]()+'|'+_0x4a934f[_0x18ce('0x20')]+'|'+_0x4a934f[_0x18ce('0x21')];var _0x287880=crypto['createHash'](_0x18ce('0x16'))[_0x18ce('0x17')](_0x1357ef)[_0x18ce('0x22')]('hex');return _0x287880[_0x18ce('0x23')](0x0,0x8)+'-'+_0x287880[_0x18ce('0x23')](0x8,0xc)+'-'+_0x287880[_0x18ce('0x23')](0xc,0x10)+'-'+_0x287880['substring'](0x10,0x14)+'-'+_0x287880[_0x18ce('0x23')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index c0a9b68..ff68e49 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 _0xd916=['exports','GET','then','catch','createCipher','aes-256-ctr','secrets','session','update','utf8','base64','final','createDecipher','User','findOne','admin','email','|reason|','|uuid|','|machineUuid|','|name|','fullname','|email|','getFirstInterface','ipAddress','openIssue','Motion\x20License\x20Alert','Alert','active','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','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','error','message','finally','getUuid','License','spread','util','crypto','moment','request-promise','bluebird','version','../../mysqldb','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xd916,0x18a));var _0x6d91=function(_0xa87db6,_0x7fb711){_0xa87db6=_0xa87db6-0x0;var _0x48ae12=_0xd916[_0xa87db6];return _0x48ae12;};'use strict';var util=require(_0x6d91('0x0'));var crypto=require(_0x6d91('0x1'));var moment=require(_0x6d91('0x2'));var rp=require(_0x6d91('0x3'));var BPromise=require(_0x6d91('0x4'));var pkginfo=require('pkginfo')(module,_0x6d91('0x5'));var db=require(_0x6d91('0x6'))['db'];var config=require('../environment');var hardware=require('./hardware');var logger=require(_0x6d91('0x7'))(_0x6d91('0x8'));var jira=require('../../api/jira/jira.controller');var HOST=_0x6d91('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x3fcd82){return new BPromise(function(_0x1fd876,_0x418357){var _0x3b7135=util[_0x6d91('0xa')](_0x6d91('0xb'),HOST,_0x3fcd82,module['exports']['version']);if(oldToken){_0x3b7135=util['format']('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x3fcd82,module[_0x6d91('0xc')][_0x6d91('0x5')],oldToken);}var _0x2e2cdd={'uri':_0x3b7135,'method':_0x6d91('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x2e2cdd)[_0x6d91('0xe')](function(_0x540ddd){_0x1fd876(_0x540ddd);})[_0x6d91('0xf')](function(_0x25d942){_0x418357(_0x25d942);});});}function encryptDate(_0x342f93){var _0x218c03=crypto[_0x6d91('0x10')](_0x6d91('0x11'),config[_0x6d91('0x12')][_0x6d91('0x13')]);var _0x12cc2b=_0x218c03[_0x6d91('0x14')](_0x342f93,_0x6d91('0x15'),_0x6d91('0x16'));_0x12cc2b+=_0x218c03[_0x6d91('0x17')](_0x6d91('0x16'));return _0x12cc2b;}function decryptDate(_0x2bde07){var _0x4d9a21=crypto[_0x6d91('0x18')](_0x6d91('0x11'),config[_0x6d91('0x12')][_0x6d91('0x13')]);var _0x3602f3=_0x4d9a21[_0x6d91('0x14')](_0x2bde07,'base64',_0x6d91('0x15'));_0x3602f3+=_0x4d9a21['final']('utf8');return _0x3602f3;}function sendJiraAlert(_0x349249,_0x47d359,_0xa8cc9){var _0x535f4c='||FIELD||VALUE||\x0a';return db[_0x6d91('0x19')][_0x6d91('0x1a')]({'where':{'role':_0x6d91('0x1b')},'attributes':['fullname',_0x6d91('0x1c')],'raw':!![]})[_0x6d91('0xe')](function(_0x42e064){ADMIN=_0x42e064;_0x535f4c+=_0x6d91('0x1d')+_0xa8cc9+'|\x0a';_0x535f4c+=_0x6d91('0x1e')+_0x349249+'|\x0a';_0x535f4c+=_0x6d91('0x1f')+_0x47d359+'|\x0a';_0x535f4c+=_0x6d91('0x20')+ADMIN[_0x6d91('0x21')]+'|\x0a';_0x535f4c+=_0x6d91('0x22')+ADMIN[_0x6d91('0x1c')]+'|\x0a';return _0x535f4c;})[_0x6d91('0xe')](function(_0x91ab12){var _0x58e917=hardware[_0x6d91('0x23')]()[_0x6d91('0x24')];return jira[_0x6d91('0x25')]({'key':'MOTLICENSE','summary':_0x6d91('0x26'),'description':_0x91ab12,'issuetype':_0x6d91('0x27'),'oldToken':_0x349249,'newToken':_0x47d359,'email':ADMIN['email'],'name':ADMIN[_0x6d91('0x21')],'reason':GRAY_PERIOD_REASON,'ip':_0x58e917});});}function manageLicense(_0x72505e,_0x3ed163){var _0x1269f4=_0x3ed163['get']({'plain':!![]});httpRequest(_0x72505e)[_0x6d91('0xe')](function(_0x45388a){if(oldToken){oldToken=undefined;}if(_0x45388a[_0x6d91('0x28')]){if(!_0x1269f4['license']&&_0x1269f4[_0x6d91('0x8')]!=_0x45388a[_0x6d91('0x8')]||_0x1269f4[_0x6d91('0x8')]&&_0x1269f4[_0x6d91('0x29')]){logger['info'](_0x6d91('0x2a'));}if(_0x1269f4[_0x6d91('0x8')]&&!_0x1269f4[_0x6d91('0x29')]&&_0x1269f4['license']!=_0x45388a[_0x6d91('0x8')]){logger[_0x6d91('0x2b')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x1269f4[_0x6d91('0x8')]&&!_0x1269f4['data2']&&_0x1269f4['license']==_0x45388a['license']){return _0x3ed163;}return _0x3ed163[_0x6d91('0x14')]({'data1':_0x72505e,'data2':null,'license':_0x45388a[_0x6d91('0x8')]});}else{if(_0x45388a[_0x6d91('0x8')]||_0x1269f4[_0x6d91('0x8')]){if(!_0x1269f4[_0x6d91('0x29')]){if(_0x1269f4[_0x6d91('0x2c')]==_0x72505e){GRAY_PERIOD_REASON=_0x6d91('0x2d');logger[_0x6d91('0x2b')](_0x6d91('0x2e'));}else{GRAY_PERIOD_REASON='Changed';oldToken=_0x1269f4[_0x6d91('0x2c')];logger[_0x6d91('0x2b')](_0x6d91('0x2f'),_0x1269f4['data1'],_0x72505e);}sendJiraAlert(_0x1269f4[_0x6d91('0x2c')],_0x45388a['uuid'],GRAY_PERIOD_REASON);logger[_0x6d91('0x2b')](_0x6d91('0x30'),GRAY_PERIOD_REASON[_0x6d91('0x31')](),moment()[_0x6d91('0xa')](_0x6d91('0x32')));return _0x3ed163[_0x6d91('0x14')]({'data2':encryptDate(moment()[_0x6d91('0xa')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x6d91('0x33')](decryptDate(_0x1269f4['data2']),'days')>DAYS){logger[_0x6d91('0x2b')]('DEMO\x20START\x20AT\x20%s',moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0x3ed163['update']({'data1':_0x72505e,'data2':null,'license':null});}}}else{if(_0x1269f4[_0x6d91('0x2c')]!=_0x72505e){logger[_0x6d91('0x2b')](_0x6d91('0x2f'),_0x1269f4['data1'],_0x72505e);return _0x3ed163[_0x6d91('0x14')]({'data1':_0x72505e,'data2':null,'license':null});}}}return _0x3ed163;})[_0x6d91('0xe')](function(_0x345f6c){_0x3ed163=_0x345f6c;})[_0x6d91('0xf')](function(_0x5e8637){logger[_0x6d91('0x34')](_0x5e8637[_0x6d91('0x35')]);})[_0x6d91('0x36')](function(){setTimeout(function(){manageLicense(hardware[_0x6d91('0x37')](),_0x3ed163);},TIME);});}function defaultLicense(){var _0x9d889=hardware[_0x6d91('0x37')]();if(_0x9d889){return db[_0x6d91('0x38')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x9d889}})[_0x6d91('0x39')](function(_0x5f2080,_0x5281d6){logger[_0x6d91('0x2b')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x9d889);manageLicense(_0x9d889,_0x5f2080);})[_0x6d91('0xf')](function(_0x3c0b2b){logger['error'](_0x3c0b2b[_0x6d91('0x35')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0x1c3d=['toUpperCase','YYYY-MM-DD\x20HH:mm','diff','days','DEMO\x20START\x20AT\x20%s','message','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','default','crypto','moment','request-promise','bluebird','pkginfo','../environment','./hardware','../logger','license','../../api/jira/jira.controller','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','version','GET','then','catch','aes-256-ctr','utf8','base64','final','createDecipher','secrets','session','update','||FIELD||VALUE||\x0a','findOne','admin','fullname','|reason|','|name|','|email|','email','getFirstInterface','ipAddress','openIssue','Alert','get','active','data2','info','data1','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s'];(function(_0x3f2ea4,_0x4f2669){var _0x220efc=function(_0x471393){while(--_0x471393){_0x3f2ea4['push'](_0x3f2ea4['shift']());}};_0x220efc(++_0x4f2669);}(_0x1c3d,0x1b8));var _0xd1c3=function(_0x437351,_0x709928){_0x437351=_0x437351-0x0;var _0x40f093=_0x1c3d[_0x437351];return _0x40f093;};'use strict';var util=require('util');var crypto=require(_0xd1c3('0x0'));var moment=require(_0xd1c3('0x1'));var rp=require(_0xd1c3('0x2'));var BPromise=require(_0xd1c3('0x3'));var pkginfo=require(_0xd1c3('0x4'))(module,'version');var db=require('../../mysqldb')['db'];var config=require(_0xd1c3('0x5'));var hardware=require(_0xd1c3('0x6'));var logger=require(_0xd1c3('0x7'))(_0xd1c3('0x8'));var jira=require(_0xd1c3('0x9'));var HOST=_0xd1c3('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x5adcb7){return new BPromise(function(_0x398766,_0x420ab0){var _0x5db2f0=util[_0xd1c3('0xb')](_0xd1c3('0xc'),HOST,_0x5adcb7,module[_0xd1c3('0xd')][_0xd1c3('0xe')]);if(oldToken){_0x5db2f0=util[_0xd1c3('0xb')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x5adcb7,module['exports'][_0xd1c3('0xe')],oldToken);}var _0x1d7795={'uri':_0x5db2f0,'method':_0xd1c3('0xf'),'timeout':0xea60,'json':!![]};return rp(_0x1d7795)[_0xd1c3('0x10')](function(_0x57a4ab){_0x398766(_0x57a4ab);})[_0xd1c3('0x11')](function(_0x373ffb){_0x420ab0(_0x373ffb);});});}function encryptDate(_0x280405){var _0x159691=crypto['createCipher'](_0xd1c3('0x12'),config['secrets']['session']);var _0x11d1f3=_0x159691['update'](_0x280405,_0xd1c3('0x13'),_0xd1c3('0x14'));_0x11d1f3+=_0x159691[_0xd1c3('0x15')]('base64');return _0x11d1f3;}function decryptDate(_0xaaa259){var _0x4230f7=crypto[_0xd1c3('0x16')](_0xd1c3('0x12'),config[_0xd1c3('0x17')][_0xd1c3('0x18')]);var _0x586fa7=_0x4230f7[_0xd1c3('0x19')](_0xaaa259,_0xd1c3('0x14'),_0xd1c3('0x13'));_0x586fa7+=_0x4230f7['final']('utf8');return _0x586fa7;}function sendJiraAlert(_0x14f6cb,_0x3a1a74,_0x3f1df3){var _0x54a450=_0xd1c3('0x1a');return db['User'][_0xd1c3('0x1b')]({'where':{'role':_0xd1c3('0x1c')},'attributes':[_0xd1c3('0x1d'),'email'],'raw':!![]})['then'](function(_0x7942b7){ADMIN=_0x7942b7;_0x54a450+=_0xd1c3('0x1e')+_0x3f1df3+'|\x0a';_0x54a450+='|uuid|'+_0x14f6cb+'|\x0a';_0x54a450+='|machineUuid|'+_0x3a1a74+'|\x0a';_0x54a450+=_0xd1c3('0x1f')+ADMIN[_0xd1c3('0x1d')]+'|\x0a';_0x54a450+=_0xd1c3('0x20')+ADMIN[_0xd1c3('0x21')]+'|\x0a';return _0x54a450;})[_0xd1c3('0x10')](function(_0x46ed40){var _0x137fd5=hardware[_0xd1c3('0x22')]()[_0xd1c3('0x23')];return jira[_0xd1c3('0x24')]({'key':'MOTLICENSE','summary':'Motion\x20License\x20Alert','description':_0x46ed40,'issuetype':_0xd1c3('0x25'),'oldToken':_0x14f6cb,'newToken':_0x3a1a74,'email':ADMIN[_0xd1c3('0x21')],'name':ADMIN[_0xd1c3('0x1d')],'reason':GRAY_PERIOD_REASON,'ip':_0x137fd5});});}function manageLicense(_0x227f24,_0x5d1988){var _0x3dc860=_0x5d1988[_0xd1c3('0x26')]({'plain':!![]});httpRequest(_0x227f24)['then'](function(_0xcb5283){if(oldToken){oldToken=undefined;}if(_0xcb5283[_0xd1c3('0x27')]){if(!_0x3dc860[_0xd1c3('0x8')]&&_0x3dc860[_0xd1c3('0x8')]!=_0xcb5283[_0xd1c3('0x8')]||_0x3dc860[_0xd1c3('0x8')]&&_0x3dc860[_0xd1c3('0x28')]){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x3dc860[_0xd1c3('0x8')]&&!_0x3dc860[_0xd1c3('0x28')]&&_0x3dc860[_0xd1c3('0x8')]!=_0xcb5283[_0xd1c3('0x8')]){logger[_0xd1c3('0x29')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x3dc860[_0xd1c3('0x8')]&&!_0x3dc860[_0xd1c3('0x28')]&&_0x3dc860['license']==_0xcb5283[_0xd1c3('0x8')]){return _0x5d1988;}return _0x5d1988['update']({'data1':_0x227f24,'data2':null,'license':_0xcb5283[_0xd1c3('0x8')]});}else{if(_0xcb5283[_0xd1c3('0x8')]||_0x3dc860[_0xd1c3('0x8')]){if(!_0x3dc860[_0xd1c3('0x28')]){if(_0x3dc860[_0xd1c3('0x2a')]==_0x227f24){GRAY_PERIOD_REASON=_0xd1c3('0x2b');logger[_0xd1c3('0x29')](_0xd1c3('0x2c'));}else{GRAY_PERIOD_REASON=_0xd1c3('0x2d');oldToken=_0x3dc860['data1'];logger[_0xd1c3('0x29')](_0xd1c3('0x2e'),_0x3dc860['data1'],_0x227f24);}sendJiraAlert(_0x3dc860[_0xd1c3('0x2a')],_0xcb5283['uuid'],GRAY_PERIOD_REASON);logger[_0xd1c3('0x29')](_0xd1c3('0x2f'),GRAY_PERIOD_REASON[_0xd1c3('0x30')](),moment()['format'](_0xd1c3('0x31')));return _0x5d1988[_0xd1c3('0x19')]({'data2':encryptDate(moment()[_0xd1c3('0xb')](_0xd1c3('0x31')))});}else{if(moment()[_0xd1c3('0x32')](decryptDate(_0x3dc860[_0xd1c3('0x28')]),_0xd1c3('0x33'))>DAYS){logger[_0xd1c3('0x29')](_0xd1c3('0x34'),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0x5d1988[_0xd1c3('0x19')]({'data1':_0x227f24,'data2':null,'license':null});}}}else{if(_0x3dc860['data1']!=_0x227f24){logger[_0xd1c3('0x29')](_0xd1c3('0x2e'),_0x3dc860[_0xd1c3('0x2a')],_0x227f24);return _0x5d1988[_0xd1c3('0x19')]({'data1':_0x227f24,'data2':null,'license':null});}}}return _0x5d1988;})[_0xd1c3('0x10')](function(_0x3690f8){_0x5d1988=_0x3690f8;})['catch'](function(_0x2dcf77){logger['error'](_0x2dcf77[_0xd1c3('0x35')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0xd1c3('0x36')](),_0x5d1988);},TIME);});}function defaultLicense(){var _0x5eaa6d=hardware['getUuid']();if(_0x5eaa6d){return db[_0xd1c3('0x37')][_0xd1c3('0x38')]({'where':{'id':0x1},'defaults':{'data1':_0x5eaa6d}})[_0xd1c3('0x39')](function(_0x57b57f,_0x43b819){logger[_0xd1c3('0x29')](_0xd1c3('0x3a'),_0x5eaa6d);manageLicense(_0x5eaa6d,_0x57b57f);})['catch'](function(_0x222bf3){logger[_0xd1c3('0x3b')](_0x222bf3[_0xd1c3('0x35')]);});}}exports[_0xd1c3('0x3c')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 19d1f9c..342d05f 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 _0x0f3c=['../../mysqldb','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','split','createDecipher','aes-256-ctr','format','%s:%s:%s','base64','utf8','final','parse','demo','uuid','getUuid','secrets','session','update','gray','add','days','grayReason','changed','disabled','2027-01-01T00:00:00.000Z','Breaking\x20license','message','Demo\x20license','License','defaults','then','crypto','util','../environment'];(function(_0x1d50f2,_0x3c3ec6){var _0x3769b8=function(_0x50926a){while(--_0x50926a){_0x1d50f2['push'](_0x1d50f2['shift']());}};_0x3769b8(++_0x3c3ec6);}(_0x0f3c,0x189));var _0xc0f3=function(_0x2d1f62,_0x2ec382){_0x2d1f62=_0x2d1f62-0x0;var _0x3ea32b=_0x0f3c[_0x2d1f62];return _0x3ea32b;};'use strict';var crypto=require(_0xc0f3('0x0'));var util=require(_0xc0f3('0x1'));var _=require('lodash');var moment=require('moment');var hardware=require('./hardware');var config=require(_0xc0f3('0x2'));var db=require(_0xc0f3('0x3'))['db'];function checkLicense(_0xa6a874,_0x2d1f5d){if(_0xa6a874){try{var _0x1be43d=_0x2d1f5d||_0xa6a874[_0xc0f3('0x4')];if(_[_0xc0f3('0x5')](_0x1be43d)){throw new Error(_0xc0f3('0x6'));}var _0x4b76a0=_0xa6a874[_0xc0f3('0x7')];var _0x2c517e=_0xa6a874['data2'];var _0x435864=_0x4b76a0[_0xc0f3('0x8')]('-')[0x4];var _0x5dd244=_0x4b76a0[_0xc0f3('0x8')]('-')[0x0];var _0x31ddbe=crypto[_0xc0f3('0x9')](_0xc0f3('0xa'),util[_0xc0f3('0xb')](_0xc0f3('0xc'),_0x435864,_0x4b76a0,_0x5dd244));var _0x232e04=_0x31ddbe['update'](_0x1be43d,_0xc0f3('0xd'),_0xc0f3('0xe'));_0x232e04+=_0x31ddbe[_0xc0f3('0xf')]('utf8');var _0x6bb993=JSON[_0xc0f3('0x10')](_0x232e04);_0x6bb993[_0xc0f3('0x11')]=![];_0x6bb993[_0xc0f3('0x12')]=_0x4b76a0;_0x6bb993['machineUuid']=hardware[_0xc0f3('0x13')]();if(_0x2c517e){var _0x165e13=crypto[_0xc0f3('0x9')](_0xc0f3('0xa'),config[_0xc0f3('0x14')][_0xc0f3('0x15')]);var _0x311731=_0x165e13[_0xc0f3('0x16')](_0x2c517e,_0xc0f3('0xd'),_0xc0f3('0xe'));_0x311731+=_0x165e13[_0xc0f3('0xf')](_0xc0f3('0xe'));_0x6bb993[_0xc0f3('0x17')]=_0x311731;_0x6bb993['deadline']=moment(_0x311731)[_0xc0f3('0x18')](0x7,_0xc0f3('0x19'))[_0xc0f3('0xb')]();_0x6bb993[_0xc0f3('0x1a')]=_0x6bb993[_0xc0f3('0x12')]!=_0x6bb993['machineUuid']?_0xc0f3('0x1b'):_0xc0f3('0x1c');}return _0x6bb993;}catch(_0x2f107b){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xc0f3('0x1d'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xc0f3('0x1e'),'uuid':_0xa6a874[_0xc0f3('0x7')],'machineUuid':hardware['getUuid'](),'message':_0x2f107b[_0xc0f3('0x1f')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xc0f3('0x20'),'uuid':_0xa6a874[_0xc0f3('0x7')],'machineUuid':hardware[_0xc0f3('0x13')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports['getLicense']=function(_0x37a752){return db[_0xc0f3('0x21')]['find'](_[_0xc0f3('0x22')](_0x37a752,{'raw':!![],'where':{'id':0x1}}))[_0xc0f3('0x23')](function(_0x2c32ab){return checkLicense(_0x2c32ab,null);});};exports['checkLicense']=checkLicense; \ No newline at end of file +var _0xa2d7=['2027-01-01T00:00:00.000Z','Breaking\x20license','message','Demo\x20license','License','then','checkLicense','crypto','util','lodash','moment','../environment','../../mysqldb','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','aes-256-ctr','format','utf8','final','parse','demo','uuid','machineUuid','getUuid','secrets','session','update','gray','deadline','add','changed','disabled'];(function(_0x1807ee,_0x489705){var _0x122fed=function(_0x12252e){while(--_0x12252e){_0x1807ee['push'](_0x1807ee['shift']());}};_0x122fed(++_0x489705);}(_0xa2d7,0xbb));var _0x7a2d=function(_0x1fa272,_0x1c96f4){_0x1fa272=_0x1fa272-0x0;var _0x14d4ac=_0xa2d7[_0x1fa272];return _0x14d4ac;};'use strict';var crypto=require(_0x7a2d('0x0'));var util=require(_0x7a2d('0x1'));var _=require(_0x7a2d('0x2'));var moment=require(_0x7a2d('0x3'));var hardware=require('./hardware');var config=require(_0x7a2d('0x4'));var db=require(_0x7a2d('0x5'))['db'];function checkLicense(_0x2de08b,_0x43a277){if(_0x2de08b){try{var _0x576623=_0x43a277||_0x2de08b[_0x7a2d('0x6')];if(_[_0x7a2d('0x7')](_0x576623)){throw new Error(_0x7a2d('0x8'));}var _0x5161c4=_0x2de08b[_0x7a2d('0x9')];var _0x2d7b89=_0x2de08b[_0x7a2d('0xa')];var _0x3c5aea=_0x5161c4['split']('-')[0x4];var _0x13399c=_0x5161c4[_0x7a2d('0xb')]('-')[0x0];var _0x455002=crypto['createDecipher'](_0x7a2d('0xc'),util[_0x7a2d('0xd')]('%s:%s:%s',_0x3c5aea,_0x5161c4,_0x13399c));var _0x4d36d1=_0x455002['update'](_0x576623,'base64',_0x7a2d('0xe'));_0x4d36d1+=_0x455002[_0x7a2d('0xf')](_0x7a2d('0xe'));var _0x47afc3=JSON[_0x7a2d('0x10')](_0x4d36d1);_0x47afc3[_0x7a2d('0x11')]=![];_0x47afc3[_0x7a2d('0x12')]=_0x5161c4;_0x47afc3[_0x7a2d('0x13')]=hardware[_0x7a2d('0x14')]();if(_0x2d7b89){var _0x148286=crypto['createDecipher'](_0x7a2d('0xc'),config[_0x7a2d('0x15')][_0x7a2d('0x16')]);var _0x28decd=_0x148286[_0x7a2d('0x17')](_0x2d7b89,'base64',_0x7a2d('0xe'));_0x28decd+=_0x148286[_0x7a2d('0xf')](_0x7a2d('0xe'));_0x47afc3[_0x7a2d('0x18')]=_0x28decd;_0x47afc3[_0x7a2d('0x19')]=moment(_0x28decd)[_0x7a2d('0x1a')](0x7,'days')[_0x7a2d('0xd')]();_0x47afc3['grayReason']=_0x47afc3[_0x7a2d('0x12')]!=_0x47afc3[_0x7a2d('0x13')]?_0x7a2d('0x1b'):_0x7a2d('0x1c');}return _0x47afc3;}catch(_0x4e4ebc){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x7a2d('0x1d'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x7a2d('0x1e'),'uuid':_0x2de08b[_0x7a2d('0x9')],'machineUuid':hardware[_0x7a2d('0x14')](),'message':_0x4e4ebc[_0x7a2d('0x1f')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x7a2d('0x1d'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x7a2d('0x20'),'uuid':_0x2de08b['data1'],'machineUuid':hardware[_0x7a2d('0x14')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports['getLicense']=function(_0x4fee17){return db[_0x7a2d('0x21')]['find'](_['defaults'](_0x4fee17,{'raw':!![],'where':{'id':0x1}}))[_0x7a2d('0x22')](function(_0x44430c){return checkLicense(_0x44430c,null);});};exports[_0x7a2d('0x23')]=checkLicense; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index aaf8d59..fb189de 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 _0xc4be=['myappanuglar-secret','app-id','secret','exports'];(function(_0x497b32,_0x159015){var _0x4c9d3b=function(_0x24dd7d){while(--_0x24dd7d){_0x497b32['push'](_0x497b32['shift']());}};_0x4c9d3b(++_0x159015);}(_0xc4be,0x1bb));var _0xec4b=function(_0x20b67d,_0x4a8505){_0x20b67d=_0x20b67d-0x0;var _0x4dfe4c=_0xc4be[_0x20b67d];return _0x4dfe4c;};'use strict';module[_0xec4b('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0xec4b('0x1'),'GOOGLE_ID':_0xec4b('0x2'),'GOOGLE_SECRET':_0xec4b('0x3'),'DEBUG':''}; \ No newline at end of file +var _0xef2b=['secret','exports','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0xef2b,0x164));var _0xbef2=function(_0x904fb0,_0x1df266){_0x904fb0=_0x904fb0-0x0;var _0x2fc4c0=_0xef2b[_0x904fb0];return _0x2fc4c0;};'use strict';module[_0xbef2('0x0')]={'DOMAIN':_0xbef2('0x1'),'SESSION_SECRET':_0xbef2('0x2'),'GOOGLE_ID':_0xbef2('0x3'),'GOOGLE_SECRET':_0xbef2('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 3b27b79..846394e 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3be5=['toUpperCase','message','Logger','File','error','transports','%s-%s','info','debugLevel','util','INFO','join','/var','log','xcally','format','%s-%s.log','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x8585ff,_0x9232d){var _0x3ff111=function(_0x1c40bc){while(--_0x1c40bc){_0x8585ff['push'](_0x8585ff['shift']());}};_0x3ff111(++_0x9232d);}(_0x3be5,0xed));var _0x53be=function(_0x54d862,_0xc76627){_0x54d862=_0x54d862-0x0;var _0x96263=_0x3be5[_0x54d862];return _0x96263;};'use strict';var moment=require('moment');var winston=require('winston');var util=require(_0x53be('0x0'));var path=require('path');var debugLevel=_0x53be('0x1');function filename(_0xf605a3,_0x168e07){return path[_0x53be('0x2')](_0x53be('0x3'),_0x53be('0x4'),_0x53be('0x5'),util[_0x53be('0x6')](_0x53be('0x7'),_0xf605a3,_0x168e07));}function formatter(_0x2a7c9d,_0x3a9830){return util['format'](_0x53be('0x8'),moment()[_0x53be('0x6')](_0x53be('0x9')),_0x3a9830['level'][_0x53be('0xa')](),_0x2a7c9d,_0x3a9830[_0x53be('0xb')]);}module['exports']=function(_0x2d0d96){return new winston[(_0x53be('0xc'))]({'transports':[new winston['transports'][(_0x53be('0xd'))]({'name':util[_0x53be('0x6')]('%s-%s',_0x2d0d96,'error'),'filename':filename(_0x2d0d96,_0x53be('0xe')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x26e936){return formatter(_0x2d0d96,_0x26e936);}}),new winston[(_0x53be('0xf'))][(_0x53be('0xd'))]({'name':util[_0x53be('0x6')](_0x53be('0x10'),_0x2d0d96,_0x53be('0x11')),'filename':filename(_0x2d0d96,_0x53be('0x11')),'level':_0x53be('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3600fb){return formatter(_0x2d0d96,_0x3600fb);}}),new winston[(_0x53be('0xf'))]['Console']({'level':process['env'][_0x53be('0x12')]||debugLevel,'json':![],'formatter':function(_0x1719b1){return formatter(_0x2d0d96,_0x1719b1);}})]});}; \ No newline at end of file +var _0x522e=['info','Console','env','moment','path','INFO','join','log','format','level','toUpperCase','message','exports','Logger','File','%s-%s','error','transports'];(function(_0x2417cb,_0x30f452){var _0x4dabae=function(_0x41659a){while(--_0x41659a){_0x2417cb['push'](_0x2417cb['shift']());}};_0x4dabae(++_0x30f452);}(_0x522e,0x18f));var _0xe522=function(_0xa9aa8a,_0x375d3b){_0xa9aa8a=_0xa9aa8a-0x0;var _0x26e0c1=_0x522e[_0xa9aa8a];return _0x26e0c1;};'use strict';var moment=require(_0xe522('0x0'));var winston=require('winston');var util=require('util');var path=require(_0xe522('0x1'));var debugLevel=_0xe522('0x2');function filename(_0x3c910c,_0x561b1c){return path[_0xe522('0x3')]('/var',_0xe522('0x4'),'xcally',util[_0xe522('0x5')]('%s-%s.log',_0x3c910c,_0x561b1c));}function formatter(_0x479ba8,_0x1a960f){return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x1a960f[_0xe522('0x6')][_0xe522('0x7')](),_0x479ba8,_0x1a960f[_0xe522('0x8')]);}module[_0xe522('0x9')]=function(_0x3ad65f){return new winston[(_0xe522('0xa'))]({'transports':[new winston['transports'][(_0xe522('0xb'))]({'name':util[_0xe522('0x5')](_0xe522('0xc'),_0x3ad65f,_0xe522('0xd')),'filename':filename(_0x3ad65f,_0xe522('0xd')),'level':_0xe522('0xd'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1adf41){return formatter(_0x3ad65f,_0x1adf41);}}),new winston[(_0xe522('0xe'))][(_0xe522('0xb'))]({'name':util[_0xe522('0x5')](_0xe522('0xc'),_0x3ad65f,_0xe522('0xf')),'filename':filename(_0x3ad65f,_0xe522('0xf')),'level':_0xe522('0xf'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5ad967){return formatter(_0x3ad65f,_0x5ad967);}}),new winston[(_0xe522('0xe'))][(_0xe522('0x10'))]({'level':process[_0xe522('0x11')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x75a6c0){return formatter(_0x3ad65f,_0x75a6c0);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 41d7de8..de6ea96 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 _0x92bc=['join','../../services/ami/index.js','agi','email','../../services/email/index.js','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express'];(function(_0x4102a1,_0x2baefd){var _0x443434=function(_0x28591c){while(--_0x28591c){_0x4102a1['push'](_0x4102a1['shift']());}};_0x443434(++_0x2baefd);}(_0x92bc,0x106));var _0xc92b=function(_0x5dcbbb,_0x32b3b2){_0x5dcbbb=_0x5dcbbb-0x0;var _0x3f4e24=_0x92bc[_0x5dcbbb];return _0x3f4e24;};'use strict';var path=require(_0xc92b('0x0'));var os=require('os');var config={'apps':[{'name':_0xc92b('0x1'),'script':path[_0xc92b('0x2')](__dirname,'../../services/express/index.js')},{'name':'ami','script':path[_0xc92b('0x2')](__dirname,_0xc92b('0x3'))},{'name':_0xc92b('0x4'),'script':path[_0xc92b('0x2')](__dirname,'../../services/agi/index.js')},{'name':_0xc92b('0x5'),'script':path[_0xc92b('0x2')](__dirname,_0xc92b('0x6'))},{'name':'routing','script':path['join'](__dirname,_0xc92b('0x7'))},{'name':_0xc92b('0x8'),'script':path['join'](__dirname,_0xc92b('0x9'))}]};module[_0xc92b('0xa')]=config; \ No newline at end of file +var _0xd84c=['routing','../../services/routing/index.js','xdr','exports','express','join','ami','agi','../../services/agi/index.js','email','../../services/email/index.js'];(function(_0x5229c4,_0x411bae){var _0x4d71d2=function(_0x341c85){while(--_0x341c85){_0x5229c4['push'](_0x5229c4['shift']());}};_0x4d71d2(++_0x411bae);}(_0xd84c,0x12d));var _0xcd84=function(_0x1607bc,_0xade596){_0x1607bc=_0x1607bc-0x0;var _0x44e0fa=_0xd84c[_0x1607bc];return _0x44e0fa;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0xcd84('0x0'),'script':path[_0xcd84('0x1')](__dirname,'../../services/express/index.js')},{'name':_0xcd84('0x2'),'script':path[_0xcd84('0x1')](__dirname,'../../services/ami/index.js')},{'name':_0xcd84('0x3'),'script':path[_0xcd84('0x1')](__dirname,_0xcd84('0x4'))},{'name':_0xcd84('0x5'),'script':path[_0xcd84('0x1')](__dirname,_0xcd84('0x6'))},{'name':_0xcd84('0x7'),'script':path[_0xcd84('0x1')](__dirname,_0xcd84('0x8'))},{'name':_0xcd84('0x9'),'script':path[_0xcd84('0x1')](__dirname,'../../services/xdr/index.js')}]};module[_0xcd84('0xa')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 594afa2..eb355d8 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 _0xee14=['dump','saved','./config','connect','connected','start','then','disconnect','stop','restart','list','describe','delete'];(function(_0x509b2a,_0xf91802){var _0x59ff9e=function(_0x5af97a){while(--_0x5af97a){_0x509b2a['push'](_0x509b2a['shift']());}};_0x59ff9e(++_0xf91802);}(_0xee14,0x13a));var _0x4ee1=function(_0x20f6ea,_0x2bb61d){_0x20f6ea=_0x20f6ea-0x0;var _0x5d7e8c=_0xee14[_0x20f6ea];return _0x5d7e8c;};'use strict';var pm2=require('pm2');var BPromise=require('bluebird');var config=require(_0x4ee1('0x0'));function connect(){return new BPromise(function(_0x674696,_0x34e49d){return pm2[_0x4ee1('0x1')](function(_0x18e3c4){if(_0x18e3c4){return _0x34e49d(_0x18e3c4);}return _0x674696(_0x4ee1('0x2'));});});};exports[_0x4ee1('0x3')]=function(_0x1e5fb6){return connect()[_0x4ee1('0x4')](function(){return new BPromise(function(_0x4bc729,_0xba6d36){return pm2['start'](_0x1e5fb6,function(_0x327c18,_0x3a45a3){if(_0x327c18){return _0xba6d36(_0x327c18);}pm2[_0x4ee1('0x5')]();return _0x4bc729(_0x3a45a3);});});});};exports[_0x4ee1('0x6')]=function(_0xdfe9c1){return connect()[_0x4ee1('0x4')](function(){return new BPromise(function(_0x58a32f,_0x33dbe6){return pm2[_0x4ee1('0x6')](_0xdfe9c1,function(_0x4e88e8,_0x3fa61b){if(_0x4e88e8){return _0x33dbe6(_0x4e88e8);}pm2[_0x4ee1('0x5')]();return _0x58a32f(_0x3fa61b);});});});};exports[_0x4ee1('0x7')]=function(_0x191da7){return connect()['then'](function(){return new BPromise(function(_0x1b3737,_0x22b251){return pm2[_0x4ee1('0x7')](_0x191da7,function(_0x2d5d3c,_0x2f864e){if(_0x2d5d3c){return _0x22b251(_0x2d5d3c);}pm2[_0x4ee1('0x5')]();return _0x1b3737(_0x2f864e);});});});};exports['list']=function(){return connect()[_0x4ee1('0x4')](function(){return new BPromise(function(_0x461f99,_0x1096a5){return pm2[_0x4ee1('0x8')](function(_0x46d2c2,_0x1c342a){if(_0x46d2c2){return _0x1096a5(_0x46d2c2);}pm2[_0x4ee1('0x5')]();return _0x461f99(_0x1c342a);});});});};exports[_0x4ee1('0x9')]=function(_0xb7eafd){return connect()['then'](function(){return new BPromise(function(_0x2f9194,_0x38008f){return pm2[_0x4ee1('0x9')](_0xb7eafd,function(_0x1b1e0e,_0x123c5e){if(_0x1b1e0e){return _0x38008f(_0x1b1e0e);}pm2[_0x4ee1('0x5')]();return _0x2f9194(_0x123c5e);});});});};exports[_0x4ee1('0xa')]=function(_0x2b8f0e){return connect()[_0x4ee1('0x4')](function(){return new BPromise(function(_0x3a0967,_0x274de5){return pm2['delete'](_0x2b8f0e,function(_0x236215,_0x3db827){if(_0x236215){return _0x274de5(_0x236215);}pm2[_0x4ee1('0x5')]();return _0x3a0967(_0x3db827);});});});};exports[_0x4ee1('0xb')]=function(){return connect()[_0x4ee1('0x4')](function(){return new BPromise(function(_0x383ab0,_0x48a959){return pm2[_0x4ee1('0xb')](function(_0x333e96){if(_0x333e96){return _0x48a959(_0x333e96);}return _0x383ab0(_0x4ee1('0xc'));});});});}; \ No newline at end of file +var _0x234f=['dump','saved','pm2','bluebird','./config','then','start','stop','disconnect','restart','list','delete'];(function(_0x3453a5,_0x3e47df){var _0x63b270=function(_0x4b964d){while(--_0x4b964d){_0x3453a5['push'](_0x3453a5['shift']());}};_0x63b270(++_0x3e47df);}(_0x234f,0xb6));var _0xf234=function(_0x12b307,_0x1060e4){_0x12b307=_0x12b307-0x0;var _0x5d0828=_0x234f[_0x12b307];return _0x5d0828;};'use strict';var pm2=require(_0xf234('0x0'));var BPromise=require(_0xf234('0x1'));var config=require(_0xf234('0x2'));function connect(){return new BPromise(function(_0x2692da,_0x3fa40d){return pm2['connect'](function(_0x4ca67f){if(_0x4ca67f){return _0x3fa40d(_0x4ca67f);}return _0x2692da('connected');});});};exports['start']=function(_0x2d3ec1){return connect()[_0xf234('0x3')](function(){return new BPromise(function(_0x3f7fb4,_0x3bfa94){return pm2[_0xf234('0x4')](_0x2d3ec1,function(_0x508303,_0x493208){if(_0x508303){return _0x3bfa94(_0x508303);}pm2['disconnect']();return _0x3f7fb4(_0x493208);});});});};exports[_0xf234('0x5')]=function(_0x99e475){return connect()[_0xf234('0x3')](function(){return new BPromise(function(_0xd2df7a,_0x20af6f){return pm2[_0xf234('0x5')](_0x99e475,function(_0x29cfe3,_0x301d84){if(_0x29cfe3){return _0x20af6f(_0x29cfe3);}pm2[_0xf234('0x6')]();return _0xd2df7a(_0x301d84);});});});};exports[_0xf234('0x7')]=function(_0xdb85ad){return connect()[_0xf234('0x3')](function(){return new BPromise(function(_0x4e573a,_0x30df4e){return pm2[_0xf234('0x7')](_0xdb85ad,function(_0x2c5035,_0x170fa1){if(_0x2c5035){return _0x30df4e(_0x2c5035);}pm2['disconnect']();return _0x4e573a(_0x170fa1);});});});};exports[_0xf234('0x8')]=function(){return connect()['then'](function(){return new BPromise(function(_0xa12b0e,_0x55374a){return pm2[_0xf234('0x8')](function(_0x35569a,_0x4a6d55){if(_0x35569a){return _0x55374a(_0x35569a);}pm2[_0xf234('0x6')]();return _0xa12b0e(_0x4a6d55);});});});};exports['describe']=function(_0x4aa580){return connect()[_0xf234('0x3')](function(){return new BPromise(function(_0x16d902,_0x5726e0){return pm2['describe'](_0x4aa580,function(_0x2da3aa,_0xe9c33f){if(_0x2da3aa){return _0x5726e0(_0x2da3aa);}pm2[_0xf234('0x6')]();return _0x16d902(_0xe9c33f);});});});};exports[_0xf234('0x9')]=function(_0x10512e){return connect()[_0xf234('0x3')](function(){return new BPromise(function(_0x53be45,_0x62f530){return pm2[_0xf234('0x9')](_0x10512e,function(_0x3269c3,_0xbb9471){if(_0x3269c3){return _0x62f530(_0x3269c3);}pm2[_0xf234('0x6')]();return _0x53be45(_0xbb9471);});});});};exports['dump']=function(){return connect()['then'](function(){return new BPromise(function(_0x23bf9c,_0x4e53c1){return pm2[_0xf234('0xa')](function(_0x5b8fdc){if(_0x5b8fdc){return _0x4e53c1(_0x5b8fdc);}return _0x23bf9c(_0xf234('0xb'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 64e0ac5..6fe0b19 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 _0x0b40=['error','start','lodash','moment','ioredis','../../config/environment','defaults','localhost','socket.io-emitter','redis','Setting','chatTimeout','then','findAll','lastMsgAt','subtract','minutes','ChatInteraction','system','format','YYYY-MM-DD\x20HH:mm:ss','length','emit','catch'];(function(_0x386b03,_0x5d0000){var _0xd3d524=function(_0x474754){while(--_0x474754){_0x386b03['push'](_0x386b03['shift']());}};_0xd3d524(++_0x5d0000);}(_0x0b40,0xc2));var _0x00b4=function(_0x4b4f24,_0x5654a8){_0x4b4f24=_0x4b4f24-0x0;var _0x1c13d4=_0x0b40[_0x4b4f24];return _0x1c13d4;};'use strict';var _=require(_0x00b4('0x0'));var moment=require(_0x00b4('0x1'));var Redis=require(_0x00b4('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0x00b4('0x3'));config['redis']=_[_0x00b4('0x4')](config['redis'],{'host':_0x00b4('0x5'),'port':0x18eb});var io=require(_0x00b4('0x6'))(new Redis(config[_0x00b4('0x7')]));function closeInteractions(){var _0x542855=0x0;var _0x228ff7=[];return db[_0x00b4('0x8')]['find']({'raw':!![],'attributes':['id',_0x00b4('0x9')],'where':{'id':0x1}})[_0x00b4('0xa')](function(_0x547aec){_0x542855=_0x547aec[_0x00b4('0x9')];if(_0x542855){return db['ChatInteraction'][_0x00b4('0xb')]({'raw':!![],'attributes':['id',_0x00b4('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x00b4('0xd')](_0x547aec[_0x00b4('0x9')],_0x00b4('0xe'))}}});}else{return[];}})['then'](function(_0x558652){_0x228ff7=_0x558652;if(_0x542855){return db[_0x00b4('0xf')]['update']({'closeReason':_0x00b4('0x10'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x00b4('0x11')](_0x00b4('0x12'))},{'where':{'id':_['map'](_0x228ff7||[],'id')}});}})[_0x00b4('0xa')](function(_0x29fa57){for(var _0x4c8ff3=0x0;_0x4c8ff3<_0x228ff7[_0x00b4('0x13')];_0x4c8ff3++){io[_0x00b4('0x14')]('chatInteraction:update',{'id':_0x228ff7[_0x4c8ff3]['id'],'closed':!![]});}})[_0x00b4('0x15')](function(_0x56050d){console[_0x00b4('0x16')](_0x56050d);});}exports[_0x00b4('0x17')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x3287=['start','lodash','moment','../../config/environment','redis','localhost','socket.io-emitter','Setting','chatTimeout','then','findAll','lastMsgAt','minutes','ChatInteraction','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','emit','chatInteraction:update','catch','error'];(function(_0x45642c,_0x1a1426){var _0x9012c4=function(_0x2fed6c){while(--_0x2fed6c){_0x45642c['push'](_0x45642c['shift']());}};_0x9012c4(++_0x1a1426);}(_0x3287,0x171));var _0x7328=function(_0x2b6876,_0x24532f){_0x2b6876=_0x2b6876-0x0;var _0x191963=_0x3287[_0x2b6876];return _0x191963;};'use strict';var _=require(_0x7328('0x0'));var moment=require(_0x7328('0x1'));var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var config=require(_0x7328('0x2'));config[_0x7328('0x3')]=_['defaults'](config['redis'],{'host':_0x7328('0x4'),'port':0x18eb});var io=require(_0x7328('0x5'))(new Redis(config[_0x7328('0x3')]));function closeInteractions(){var _0x54470d=0x0;var _0x174adb=[];return db[_0x7328('0x6')]['find']({'raw':!![],'attributes':['id',_0x7328('0x7')],'where':{'id':0x1}})[_0x7328('0x8')](function(_0x15ff50){_0x54470d=_0x15ff50[_0x7328('0x7')];if(_0x54470d){return db['ChatInteraction'][_0x7328('0x9')]({'raw':!![],'attributes':['id',_0x7328('0xa')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x15ff50[_0x7328('0x7')],_0x7328('0xb'))}}});}else{return[];}})[_0x7328('0x8')](function(_0x4bf7ea){_0x174adb=_0x4bf7ea;if(_0x54470d){return db[_0x7328('0xc')][_0x7328('0xd')]({'closeReason':_0x7328('0xe'),'disposition':_0x7328('0xf'),'closed':!![],'closedAt':moment()[_0x7328('0x10')](_0x7328('0x11'))},{'where':{'id':_['map'](_0x174adb||[],'id')}});}})[_0x7328('0x8')](function(_0x20e2f5){for(var _0xe99d39=0x0;_0xe99d39<_0x174adb['length'];_0xe99d39++){io[_0x7328('0x12')](_0x7328('0x13'),{'id':_0x174adb[_0xe99d39]['id'],'closed':!![]});}})[_0x7328('0x14')](function(_0x4c464d){console[_0x7328('0x15')](_0x4c464d);});}exports[_0x7328('0x16')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 21b06a0..c746770 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 _0x3240=['auth','user','pass','format','name','email','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','../../files/reports','savename','%s.%s','basename','join','status','Sent','attachments','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','existsSync','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','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','then','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','map','toString','keyBy','difference','intersection','exists','stop','deleteJob','delete\x20cron','length','index','resolve','run\x20job','active','isBetween','startAt','endAt','cron','start','add\x20cron','stop\x20cron','update','update\x20cron','run','util','path','moment','cron-job-manager','jayson/promise','bluebird','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','info','MailAccount','Smtp','service','host','port','secure','authentication'];(function(_0x3fcadd,_0x375953){var _0x538258=function(_0x2cd7f1){while(--_0x2cd7f1){_0x3fcadd['push'](_0x3fcadd['shift']());}};_0x538258(++_0x375953);}(_0x3240,0x1c3));var _0x0324=function(_0x13ec98,_0x461532){_0x13ec98=_0x13ec98-0x0;var _0x175bed=_0x3240[_0x13ec98];return _0x175bed;};'use strict';var fs=require('fs');var util=require(_0x0324('0x0'));var path=require(_0x0324('0x1'));var _=require('lodash');var moment=require(_0x0324('0x2'));var CronJobManager=require(_0x0324('0x3'));var jayson=require(_0x0324('0x4'));var BPromise=require(_0x0324('0x5'));var logger=require(_0x0324('0x6'))('schedule');var db=require(_0x0324('0x7'))['db'];var analyticCustomReportController=require(_0x0324('0x8'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x0324('0x9')][_0x0324('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x250810,_0x1c3395){return function(){logger[_0x0324('0xb')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x250810['email']);var _0x4ace6e=!![];var _0x3b3d72={'tls':{'rejectUnauthorized':![]}};if(_0x250810[_0x0324('0xc')][_0x0324('0xd')][_0x0324('0xe')]){_0x3b3d72[_0x0324('0xe')]=_0x250810[_0x0324('0xc')][_0x0324('0xd')][_0x0324('0xe')];}else{_0x3b3d72['host']=_0x250810[_0x0324('0xc')][_0x0324('0xd')][_0x0324('0xf')];_0x3b3d72[_0x0324('0x10')]=_0x250810[_0x0324('0xc')][_0x0324('0xd')][_0x0324('0x10')];_0x3b3d72['secure']=_0x250810[_0x0324('0xc')][_0x0324('0xd')][_0x0324('0x11')];}if(_0x250810[_0x0324('0xc')][_0x0324('0xd')][_0x0324('0x12')]){_0x3b3d72[_0x0324('0x13')]={'user':_0x250810[_0x0324('0xc')]['Smtp'][_0x0324('0x14')],'pass':_0x250810[_0x0324('0xc')][_0x0324('0xd')][_0x0324('0x15')]};}var _0x419f13={'account':_0x3b3d72,'message':{'from':util[_0x0324('0x16')]('\x22%s\x22\x20<%s>',_0x250810[_0x0324('0xc')][_0x0324('0x17')],_0x250810[_0x0324('0xc')][_0x0324('0x18')]||_0x250810['MailAccount']['Smtp'][_0x0324('0x14')]),'to':_0x250810['email'],'cc':_0x250810['cc'],'bcc':_0x250810[_0x0324('0x19')],'subject':util[_0x0324('0x16')](_0x0324('0x1a'),_0x1c3395[_0x0324('0x17')],_0x250810['subtractNumber'],_0x250810[_0x0324('0x1b')])}};var _0x33ef87=path['join'](__dirname,_0x0324('0x1c'));var _0x306947=_0x1c3395[_0x0324('0x1d')];var _0x4cc515=util[_0x0324('0x16')](_0x0324('0x1e'),path[_0x0324('0x1f')](_0x1c3395['savename'],path['extname'](_0x1c3395['savename'])),'zip');var _0x191d32=path[_0x0324('0x20')](_0x33ef87,_0x306947);var _0x2ba61f=path[_0x0324('0x20')](_0x33ef87,_0x4cc515);if(fs['existsSync'](_0x191d32)){_0x1c3395[_0x0324('0x21')]=_0x0324('0x22');_0x419f13['message'][_0x0324('0x23')]=[{'filename':_0x306947,'path':_0x191d32}];_0x419f13[_0x0324('0x24')][_0x0324('0x25')]=util[_0x0324('0x16')](_0x0324('0x26'),JSON[_0x0324('0x27')](_0x1c3395,null,0x2));}else if(fs[_0x0324('0x28')](_0x2ba61f)){_0x1c3395[_0x0324('0x21')]=_0x0324('0x22');_0x419f13['message'][_0x0324('0x23')]=[{'filename':_0x4cc515,'path':_0x2ba61f}];}else{_0x419f13[_0x0324('0x24')][_0x0324('0x25')]=_0x0324('0x29');if(!_0x250810[_0x0324('0x2a')]){_0x4ace6e=![];logger[_0x0324('0xb')](_0x0324('0x2b'));}}if(_0x4ace6e){return client[_0x0324('0x2c')](_0x0324('0x2d'),_0x419f13)['then'](function(_0x1b733c){if(_0x1b733c[_0x0324('0x2e')]){return logger['error'](_0x0324('0x2f'),JSON['stringify'](_0x1b733c));}return logger[_0x0324('0xb')](_0x0324('0x30'));})[_0x0324('0x31')](function(_0x3d735a){return logger[_0x0324('0x2e')](_0x0324('0x2f'),JSON[_0x0324('0x27')](_0x3d735a));});}};}function handleError(){return function(_0x146799){return logger['error'](JSON['stringify'](_0x146799));};}function handleResult(_0x4c8475){return function(_0x3e2357){logger[_0x0324('0xb')](_0x0324('0x32'),JSON[_0x0324('0x27')](_0x3e2357));if(_0x4c8475[_0x0324('0xc')]&&_0x4c8475[_0x0324('0xc')][_0x0324('0xd')]&&!_[_0x0324('0x33')](_0x4c8475[_0x0324('0x18')])){setTimeout(handleSendEmail(_0x4c8475,_0x3e2357),0x3c*0x3e8);}};}function handleJob(_0x41318c){return function(){try{if(_[_0x0324('0x33')](_0x41318c[_0x0324('0x34')])){return logger[_0x0324('0xb')](_0x0324('0x35'));}if(_['isNil'](_0x41318c[_0x0324('0x1b')])){return logger[_0x0324('0xb')](_0x0324('0x36'));}var _0x4d37de={'startDate':moment()[_0x0324('0x37')](_0x41318c[_0x0324('0x34')],_0x41318c[_0x0324('0x1b')])[_0x0324('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x0324('0x16')](_0x0324('0x38')),'type':_0x0324('0x39'),'output':_0x41318c[_0x0324('0x3a')],'name':_0x41318c[_0x0324('0x17')]};if(!_[_0x0324('0x33')](_0x41318c['DefaultReportId'])){logger[_0x0324('0xb')](_0x0324('0x3b'),_0x41318c[_0x0324('0x3c')]);return analyticDefaultReportController[_0x0324('0x3d')]({'id':_0x41318c['DefaultReportId']},_0x4d37de)[_0x0324('0x3e')](handleResult(_0x41318c))['catch'](handleError());}if(!_['isNil'](_0x41318c['CustomReportId'])){logger[_0x0324('0xb')](_0x0324('0x3f'),_0x41318c[_0x0324('0x40')]);return analyticCustomReportController[_0x0324('0x3d')]({'id':_0x41318c[_0x0324('0x40')]},_0x4d37de)['then'](handleResult(_0x41318c))[_0x0324('0x31')](handleError());}}catch(_0x22a16f){logger[_0x0324('0x2e')](JSON[_0x0324('0x27')](_0x22a16f));}return logger['info'](_0x0324('0x41'));};}function getJobs(_0x3824fd){var _0xaf2996={};if(_0x3824fd){_0xaf2996['id']=_0x3824fd;}return db[_0x0324('0x42')][_0x0324('0x43')]({'where':_0xaf2996,'include':[{'model':db['MailAccount'],'attributes':['id',_0x0324('0x17'),'email'],'include':[{'model':db[_0x0324('0x44')],'as':_0x0324('0xd')}]}]})[_0x0324('0x3e')](function(_0x2900ee){var _0x5ef3a0=_[_0x0324('0x45')](manager['jobs']);var _0x35d48d=_[_0x0324('0x46')](_0x2900ee,function(_0x5cd020){return _0x5cd020['id'][_0x0324('0x47')]();});var _0x5d87b1=_[_0x0324('0x48')](_0x2900ee,function(_0x15fe8a){return _0x15fe8a['id']['toString']();});var _0x305314=_0x3824fd?_0x35d48d:_[_0x0324('0x49')](_0x35d48d,_0x5ef3a0);var _0x5cd64d=_[_0x0324('0x4a')](_0x35d48d,_0x5ef3a0);var _0xe1b638=_[_0x0324('0x49')](_0x5ef3a0,_0x35d48d);var _0x5196d5;var _0x3e27c9;for(_0x5196d5=0x0;_0x5196d5<_0xe1b638['length']&&!_0x3824fd;_0x5196d5+=0x1){_0x3e27c9=_0xe1b638[_0x5196d5][_0x0324('0x47')]();if(manager[_0x0324('0x4b')](_0x3e27c9)){manager[_0x0324('0x4c')](_0x3e27c9);manager[_0x0324('0x4d')](_0x3e27c9);logger['info'](_0x0324('0x4e'),_0x3e27c9);}}logger[_0x0324('0xb')]('toRun',JSON[_0x0324('0x27')](_0x305314));for(_0x5196d5=0x0;_0x5196d5<_0x305314[_0x0324('0x4f')];_0x5196d5+=0x1){_0x3e27c9=_0x305314[_0x5196d5][_0x0324('0x47')]();logger[_0x0324('0xb')](_0x0324('0x50'),_0x3e27c9);if(_0x3824fd){logger[_0x0324('0xb')]('my\x20id',_0x3824fd);logger[_0x0324('0xb')](JSON[_0x0324('0x27')](_0x5d87b1[_0x3e27c9]));BPromise[_0x0324('0x51')]()['then'](handleJob(_0x5d87b1[_0x3e27c9]));logger[_0x0324('0xb')](_0x0324('0x52'),_0x5d87b1[_0x3e27c9][_0x0324('0x17')],_0x5d87b1[_0x3e27c9]['cron']);}else if(_0x5d87b1[_0x3e27c9]['cron']&&_0x5d87b1[_0x3e27c9][_0x0324('0x53')]&&moment()[_0x0324('0x54')](_0x5d87b1[_0x3e27c9][_0x0324('0x55')],_0x5d87b1[_0x3e27c9][_0x0324('0x56')])){manager['add'](_0x3e27c9,_0x5d87b1[_0x3e27c9][_0x0324('0x57')],handleJob(_0x5d87b1[_0x3e27c9]));manager[_0x0324('0x58')](_0x3e27c9);logger[_0x0324('0xb')](_0x0324('0x59'),_0x5d87b1[_0x3e27c9][_0x0324('0x17')],_0x5d87b1[_0x3e27c9][_0x0324('0x57')]);}else if(manager[_0x0324('0x4b')](_0x3e27c9)){manager['stop'](_0x3e27c9);manager[_0x0324('0x4d')](_0x3e27c9);logger[_0x0324('0xb')](_0x0324('0x5a'),_0x5d87b1[_0x3e27c9]['name'],_0x5d87b1[_0x3e27c9][_0x0324('0x57')]);}}for(_0x5196d5=0x0,_0x3e27c9;_0x5196d5<_0x5cd64d[_0x0324('0x4f')]&&!_0x3824fd;_0x5196d5+=0x1){_0x3e27c9=_0x5cd64d[_0x5196d5][_0x0324('0x47')]();if(manager[_0x0324('0x4b')](_0x3e27c9)){if(_0x5d87b1[_0x3e27c9]['cron']&&_0x5d87b1[_0x3e27c9]['active']&&moment()[_0x0324('0x54')](_0x5d87b1[_0x3e27c9]['startAt'],_0x5d87b1[_0x3e27c9]['endAt'])){manager[_0x0324('0x5b')](_0x3e27c9,_0x5d87b1[_0x3e27c9]['cron'],handleJob(_0x5d87b1[_0x3e27c9]));logger[_0x0324('0xb')](_0x0324('0x5c'),_0x5d87b1[_0x3e27c9][_0x0324('0x17')],_0x5d87b1[_0x3e27c9][_0x0324('0x57')]);}else{manager['stop'](_0x3e27c9);manager[_0x0324('0x4d')](_0x3e27c9);logger[_0x0324('0xb')](_0x0324('0x5a'),_0x5d87b1[_0x3e27c9][_0x0324('0x17')],_0x5d87b1[_0x3e27c9][_0x0324('0x57')]);}}}})['catch'](function(_0x14323d){logger['error'](JSON['stringify'](_0x14323d));});}exports[_0x0324('0x5d')]=function(_0x1586fd){return getJobs(_0x1586fd);};exports[_0x0324('0x58')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x7e98=['subtractUnit','../../files/reports','%s.%s','savename','extname','zip','join','status','message','attachments','stringify','existsSync','Sent','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','info','empty\x20file,\x20email\x20not\x20sent','SendMail','then','error','error\x20mail','email\x20sent','catch','isNil','subtractNumber\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','jobs','map','toString','keyBy','difference','intersection','length','stop','delete\x20cron','index','my\x20id','resolve','cron','active','isBetween','startAt','endAt','add','exists','deleteJob','stop\x20cron','update','run','start','util','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','host','port','secure','auth','pass','format','\x22%s\x22\x20<%s>','name','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber'];(function(_0x488224,_0x1c7957){var _0x4c04f3=function(_0x59456c){while(--_0x59456c){_0x488224['push'](_0x488224['shift']());}};_0x4c04f3(++_0x1c7957);}(_0x7e98,0x152));var _0x87e9=function(_0xb1c128,_0x5af64e){_0xb1c128=_0xb1c128-0x0;var _0x28e5a6=_0x7e98[_0xb1c128];return _0x28e5a6;};'use strict';var fs=require('fs');var util=require(_0x87e9('0x0'));var path=require(_0x87e9('0x1'));var _=require(_0x87e9('0x2'));var moment=require(_0x87e9('0x3'));var CronJobManager=require(_0x87e9('0x4'));var jayson=require(_0x87e9('0x5'));var BPromise=require(_0x87e9('0x6'));var logger=require(_0x87e9('0x7'))(_0x87e9('0x8'));var db=require(_0x87e9('0x9'))['db'];var analyticCustomReportController=require(_0x87e9('0xa'));var analyticDefaultReportController=require(_0x87e9('0xb'));var client=jayson[_0x87e9('0xc')][_0x87e9('0xd')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x1c8c4e,_0x206a20){return function(){logger['info'](_0x87e9('0xe'),_0x1c8c4e[_0x87e9('0xf')]);var _0x2dfe91=!![];var _0x45e76a={'tls':{'rejectUnauthorized':![]}};if(_0x1c8c4e[_0x87e9('0x10')][_0x87e9('0x11')]['service']){_0x45e76a['service']=_0x1c8c4e[_0x87e9('0x10')][_0x87e9('0x11')]['service'];}else{_0x45e76a[_0x87e9('0x12')]=_0x1c8c4e[_0x87e9('0x10')][_0x87e9('0x11')][_0x87e9('0x12')];_0x45e76a[_0x87e9('0x13')]=_0x1c8c4e[_0x87e9('0x10')]['Smtp'][_0x87e9('0x13')];_0x45e76a[_0x87e9('0x14')]=_0x1c8c4e[_0x87e9('0x10')]['Smtp'][_0x87e9('0x14')];}if(_0x1c8c4e['MailAccount'][_0x87e9('0x11')]['authentication']){_0x45e76a[_0x87e9('0x15')]={'user':_0x1c8c4e['MailAccount'][_0x87e9('0x11')]['user'],'pass':_0x1c8c4e[_0x87e9('0x10')]['Smtp'][_0x87e9('0x16')]};}var _0x47448c={'account':_0x45e76a,'message':{'from':util[_0x87e9('0x17')](_0x87e9('0x18'),_0x1c8c4e[_0x87e9('0x10')][_0x87e9('0x19')],_0x1c8c4e[_0x87e9('0x10')][_0x87e9('0xf')]||_0x1c8c4e[_0x87e9('0x10')][_0x87e9('0x11')][_0x87e9('0x1a')]),'to':_0x1c8c4e[_0x87e9('0xf')],'cc':_0x1c8c4e['cc'],'bcc':_0x1c8c4e[_0x87e9('0x1b')],'subject':util[_0x87e9('0x17')](_0x87e9('0x1c'),_0x206a20['name'],_0x1c8c4e[_0x87e9('0x1d')],_0x1c8c4e[_0x87e9('0x1e')])}};var _0x5684f1=path['join'](__dirname,_0x87e9('0x1f'));var _0x52e65c=_0x206a20['savename'];var _0x5f348e=util['format'](_0x87e9('0x20'),path['basename'](_0x206a20[_0x87e9('0x21')],path[_0x87e9('0x22')](_0x206a20[_0x87e9('0x21')])),_0x87e9('0x23'));var _0x2816cb=path[_0x87e9('0x24')](_0x5684f1,_0x52e65c);var _0x146070=path[_0x87e9('0x24')](_0x5684f1,_0x5f348e);if(fs['existsSync'](_0x2816cb)){_0x206a20[_0x87e9('0x25')]='Sent';_0x47448c[_0x87e9('0x26')][_0x87e9('0x27')]=[{'filename':_0x52e65c,'path':_0x2816cb}];_0x47448c[_0x87e9('0x26')]['text']=util['format']('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x87e9('0x28')](_0x206a20,null,0x2));}else if(fs[_0x87e9('0x29')](_0x146070)){_0x206a20[_0x87e9('0x25')]=_0x87e9('0x2a');_0x47448c[_0x87e9('0x26')]['attachments']=[{'filename':_0x5f348e,'path':_0x146070}];}else{_0x47448c['message'][_0x87e9('0x2b')]=_0x87e9('0x2c');if(!_0x1c8c4e['sendIfEmpty']){_0x2dfe91=![];logger[_0x87e9('0x2d')](_0x87e9('0x2e'));}}if(_0x2dfe91){return client['request'](_0x87e9('0x2f'),_0x47448c)[_0x87e9('0x30')](function(_0x24dfba){if(_0x24dfba[_0x87e9('0x31')]){return logger[_0x87e9('0x31')](_0x87e9('0x32'),JSON[_0x87e9('0x28')](_0x24dfba));}return logger[_0x87e9('0x2d')](_0x87e9('0x33'));})[_0x87e9('0x34')](function(_0x1dec54){return logger[_0x87e9('0x31')](_0x87e9('0x32'),JSON[_0x87e9('0x28')](_0x1dec54));});}};}function handleError(){return function(_0x3bf2c3){return logger['error'](JSON[_0x87e9('0x28')](_0x3bf2c3));};}function handleResult(_0x4cec9b){return function(_0x33bf2f){logger[_0x87e9('0x2d')]('data',JSON[_0x87e9('0x28')](_0x33bf2f));if(_0x4cec9b[_0x87e9('0x10')]&&_0x4cec9b[_0x87e9('0x10')][_0x87e9('0x11')]&&!_[_0x87e9('0x35')](_0x4cec9b[_0x87e9('0xf')])){setTimeout(handleSendEmail(_0x4cec9b,_0x33bf2f),0x3c*0x3e8);}};}function handleJob(_0x4abf64){return function(){try{if(_[_0x87e9('0x35')](_0x4abf64[_0x87e9('0x1d')])){return logger[_0x87e9('0x2d')](_0x87e9('0x36'));}if(_['isNil'](_0x4abf64['subtractUnit'])){return logger[_0x87e9('0x2d')]('subtractUnit\x20null\x20or\x20undefined');}var _0x878814={'startDate':moment()[_0x87e9('0x37')](_0x4abf64[_0x87e9('0x1d')],_0x4abf64[_0x87e9('0x1e')])[_0x87e9('0x17')](_0x87e9('0x38')),'endDate':moment()['format'](_0x87e9('0x38')),'type':_0x87e9('0x39'),'output':_0x4abf64['output'],'name':_0x4abf64[_0x87e9('0x19')]};if(!_['isNil'](_0x4abf64[_0x87e9('0x3a')])){logger[_0x87e9('0x2d')](_0x87e9('0x3b'),_0x4abf64['DefaultReportId']);return analyticDefaultReportController[_0x87e9('0x3c')]({'id':_0x4abf64[_0x87e9('0x3a')]},_0x878814)[_0x87e9('0x30')](handleResult(_0x4abf64))[_0x87e9('0x34')](handleError());}if(!_[_0x87e9('0x35')](_0x4abf64[_0x87e9('0x3d')])){logger[_0x87e9('0x2d')](_0x87e9('0x3e'),_0x4abf64[_0x87e9('0x3d')]);return analyticCustomReportController[_0x87e9('0x3c')]({'id':_0x4abf64['CustomReportId']},_0x878814)[_0x87e9('0x30')](handleResult(_0x4abf64))[_0x87e9('0x34')](handleError());}}catch(_0x1ebc39){logger[_0x87e9('0x31')](JSON['stringify'](_0x1ebc39));}return logger[_0x87e9('0x2d')](_0x87e9('0x3f'));};}function getJobs(_0x4a7df2){var _0x192c0c={};if(_0x4a7df2){_0x192c0c['id']=_0x4a7df2;}return db[_0x87e9('0x40')][_0x87e9('0x41')]({'where':_0x192c0c,'include':[{'model':db[_0x87e9('0x10')],'attributes':['id','name',_0x87e9('0xf')],'include':[{'model':db[_0x87e9('0x42')],'as':'Smtp'}]}]})[_0x87e9('0x30')](function(_0x1b4693){var _0x3ac029=_[_0x87e9('0x43')](manager[_0x87e9('0x44')]);var _0x4bc811=_[_0x87e9('0x45')](_0x1b4693,function(_0x451adc){return _0x451adc['id'][_0x87e9('0x46')]();});var _0x239acd=_[_0x87e9('0x47')](_0x1b4693,function(_0x8c8fc1){return _0x8c8fc1['id'][_0x87e9('0x46')]();});var _0x504710=_0x4a7df2?_0x4bc811:_[_0x87e9('0x48')](_0x4bc811,_0x3ac029);var _0x5ecea2=_[_0x87e9('0x49')](_0x4bc811,_0x3ac029);var _0xde6ef6=_[_0x87e9('0x48')](_0x3ac029,_0x4bc811);var _0x5bab30;var _0x2af695;for(_0x5bab30=0x0;_0x5bab30<_0xde6ef6[_0x87e9('0x4a')]&&!_0x4a7df2;_0x5bab30+=0x1){_0x2af695=_0xde6ef6[_0x5bab30][_0x87e9('0x46')]();if(manager['exists'](_0x2af695)){manager[_0x87e9('0x4b')](_0x2af695);manager['deleteJob'](_0x2af695);logger[_0x87e9('0x2d')](_0x87e9('0x4c'),_0x2af695);}}logger['info']('toRun',JSON[_0x87e9('0x28')](_0x504710));for(_0x5bab30=0x0;_0x5bab30<_0x504710[_0x87e9('0x4a')];_0x5bab30+=0x1){_0x2af695=_0x504710[_0x5bab30][_0x87e9('0x46')]();logger['info'](_0x87e9('0x4d'),_0x2af695);if(_0x4a7df2){logger[_0x87e9('0x2d')](_0x87e9('0x4e'),_0x4a7df2);logger[_0x87e9('0x2d')](JSON[_0x87e9('0x28')](_0x239acd[_0x2af695]));BPromise[_0x87e9('0x4f')]()['then'](handleJob(_0x239acd[_0x2af695]));logger['info']('run\x20job',_0x239acd[_0x2af695][_0x87e9('0x19')],_0x239acd[_0x2af695][_0x87e9('0x50')]);}else if(_0x239acd[_0x2af695][_0x87e9('0x50')]&&_0x239acd[_0x2af695][_0x87e9('0x51')]&&moment()[_0x87e9('0x52')](_0x239acd[_0x2af695][_0x87e9('0x53')],_0x239acd[_0x2af695][_0x87e9('0x54')])){manager[_0x87e9('0x55')](_0x2af695,_0x239acd[_0x2af695]['cron'],handleJob(_0x239acd[_0x2af695]));manager['start'](_0x2af695);logger[_0x87e9('0x2d')]('add\x20cron',_0x239acd[_0x2af695][_0x87e9('0x19')],_0x239acd[_0x2af695][_0x87e9('0x50')]);}else if(manager[_0x87e9('0x56')](_0x2af695)){manager[_0x87e9('0x4b')](_0x2af695);manager[_0x87e9('0x57')](_0x2af695);logger[_0x87e9('0x2d')](_0x87e9('0x58'),_0x239acd[_0x2af695][_0x87e9('0x19')],_0x239acd[_0x2af695][_0x87e9('0x50')]);}}for(_0x5bab30=0x0,_0x2af695;_0x5bab30<_0x5ecea2[_0x87e9('0x4a')]&&!_0x4a7df2;_0x5bab30+=0x1){_0x2af695=_0x5ecea2[_0x5bab30]['toString']();if(manager[_0x87e9('0x56')](_0x2af695)){if(_0x239acd[_0x2af695][_0x87e9('0x50')]&&_0x239acd[_0x2af695][_0x87e9('0x51')]&&moment()[_0x87e9('0x52')](_0x239acd[_0x2af695][_0x87e9('0x53')],_0x239acd[_0x2af695][_0x87e9('0x54')])){manager[_0x87e9('0x59')](_0x2af695,_0x239acd[_0x2af695]['cron'],handleJob(_0x239acd[_0x2af695]));logger[_0x87e9('0x2d')]('update\x20cron',_0x239acd[_0x2af695][_0x87e9('0x19')],_0x239acd[_0x2af695]['cron']);}else{manager['stop'](_0x2af695);manager[_0x87e9('0x57')](_0x2af695);logger[_0x87e9('0x2d')]('stop\x20cron',_0x239acd[_0x2af695]['name'],_0x239acd[_0x2af695][_0x87e9('0x50')]);}}}})[_0x87e9('0x34')](function(_0x34c807){logger['error'](JSON[_0x87e9('0x28')](_0x34c807));});}exports[_0x87e9('0x5a')]=function(_0x5a27bf){return getJobs(_0x5a27bf);};exports[_0x87e9('0x5b')]=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 bc25283..bfcf4fd 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 _0xe46e=['language','bucket','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data2','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Negative','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','sentiment','Transcript\x20not\x20available','findOne','Cloud\x20Provider\x20not\x20configured','Positive','Mixed','name','SequelizeValidationError','error','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','push','all','catch','start','lodash','aws-sdk','../../config/logger','transcribe','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','transcribeName','data1','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','[RECORDING:%d]\x20Get\x20transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId'];(function(_0x1f0679,_0x53d43c){var _0x3dc3a4=function(_0x49ba8f){while(--_0x49ba8f){_0x1f0679['push'](_0x1f0679['shift']());}};_0x3dc3a4(++_0x53d43c);}(_0xe46e,0xb5));var _0xee46=function(_0x35c7a8,_0x1ce305){_0x35c7a8=_0x35c7a8-0x0;var _0x231e0f=_0xe46e[_0x35c7a8];return _0x231e0f;};var _=require(_0xee46('0x0'));var AWS=require(_0xee46('0x1'));var rp=require('request-promise');var util=require('util');var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require(_0xee46('0x2'))(_0xee46('0x3'));function getTranscriptionJob(_0x5ab396,_0x2a1bbf,_0x27b97a,_0x1b7799){return new Promise(function(_0xfd37a0,_0xbf41ec){var _0x3b978b=new AWS['TranscribeService']({'accessKeyId':_0x2a1bbf,'secretAccessKey':_0x5ab396,'region':_0x27b97a});_0x3b978b[_0xee46('0x4')]({'TranscriptionJobName':_0x1b7799},function(_0x20fc51,_0x2bda67){if(_0x20fc51){return _0xbf41ec(_0x20fc51);}else{return _0xfd37a0(_0x2bda67);}});});}function sentiment(_0x24d6bf,_0x2852ea,_0x18f838,_0x3e0436,_0x48f7be){return new Promise(function(_0x2b3cd3,_0x125864){var _0x1cd218=new AWS[(_0xee46('0x5'))]({'accessKeyId':_0x2852ea,'secretAccessKey':_0x24d6bf,'region':_0x18f838});_0x1cd218[_0xee46('0x6')]({'Text':_0x3e0436,'LanguageCode':_0x48f7be[_0xee46('0x7')](0x0,0x2)},function(_0x20ebe4,_0x54416e){if(_0x20ebe4){return _0x125864(_0x20ebe4);}else{return _0x2b3cd3(_0x54416e);}});});}function checkTranscribeJob(_0x113bf2,_0x568890,_0x43ffe3){var _0x44182b;return new BPromise(function(_0x54e1fe,_0x43d0ab){logger[_0xee46('0x8')](util[_0xee46('0x9')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x113bf2['id'],_0x113bf2[_0xee46('0xa')]));return getTranscriptionJob(_0x43ffe3[_0xee46('0xb')],_0x43ffe3['data2'],_0x568890[_0xee46('0xc')],_0x113bf2['transcribeName'])[_0xee46('0xd')](function(_0x861be5){logger[_0xee46('0x8')](util[_0xee46('0x9')](_0xee46('0xe'),_0x113bf2['id'],_0x113bf2[_0xee46('0xa')],_0x861be5[_0xee46('0xf')][_0xee46('0x10')]));if(!_0x113bf2[_0xee46('0x11')]){switch(_0x861be5[_0xee46('0xf')]['TranscriptionJobStatus']){case _0xee46('0x12'):var _0x36ea9c={'transcribeStatus':_0x861be5[_0xee46('0xf')][_0xee46('0x10')],'fileUri':_0x861be5[_0xee46('0xf')][_0xee46('0x13')]['TranscriptFileUri']};logger['info'](util[_0xee46('0x9')](_0xee46('0x14'),_0x113bf2['id']));return rp({'uri':_0x861be5[_0xee46('0xf')]['Transcript'][_0xee46('0x15')],'json':!![]})[_0xee46('0xd')](function(_0xf51210){logger[_0xee46('0x8')](util[_0xee46('0x9')](_0xee46('0x16'),_0x113bf2['id']));if(_0xf51210&&_0xf51210[_0xee46('0x17')]&&_0xf51210[_0xee46('0x17')][_0xee46('0x18')]&&_0xf51210[_0xee46('0x17')][_0xee46('0x18')][_0xee46('0x19')]){_0x36ea9c[_0xee46('0x11')]='';for(var _0x2488d5=0x0;_0x2488d5<_0xf51210['results'][_0xee46('0x18')][_0xee46('0x19')];_0x2488d5++){_0x36ea9c['fileText']+=_0xf51210[_0xee46('0x17')][_0xee46('0x18')][_0x2488d5][_0xee46('0x1a')]+'';}}return _0x113bf2['update'](_0x36ea9c);})[_0xee46('0xd')](function(){logger[_0xee46('0x8')](util[_0xee46('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x113bf2['id']));if(!_0x113bf2[_0xee46('0x1b')]){throw new db[(_0xee46('0x1c'))][(_0xee46('0x1d'))](_0xee46('0x1e'));}if(!_0x568890['sentiment']||!_0x568890[_0xee46('0x1f')]||!_0x568890['sentimentRegion']||!_0x568890[_0xee46('0x20')]||!_0x568890[_0xee46('0x21')]){throw new db[(_0xee46('0x1c'))][(_0xee46('0x1d'))](_0xee46('0x22'));}if(!_0x36ea9c[_0xee46('0x11')]){throw new Error('Transcript\x20not\x20available');}if(_0x568890[_0xee46('0x1f')]===_0x43ffe3['id']){return _0x43ffe3;}else{return db[_0xee46('0x23')]['findOne']({'where':{'id':_settings[_0xee46('0x1f')]}});}})[_0xee46('0xd')](function(_0x4ab694){if(!_0x4ab694){throw new db[(_0xee46('0x1c'))]['ValidationError'](_0xee46('0x24'));}if(!_0x4ab694[_0xee46('0xb')]||!_0x4ab694[_0xee46('0x25')]){throw new db[(_0xee46('0x1c'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x44182b=_0x4ab694;logger[_0xee46('0x8')](util[_0xee46('0x9')](_0xee46('0x26'),_0x113bf2['id']));return sentiment(_0x44182b['data1'],_0x44182b[_0xee46('0x25')],_0x568890[_0xee46('0x27')],_0x36ea9c[_0xee46('0x11')],_0x568890['language']);})[_0xee46('0xd')](function(_0x210967){logger[_0xee46('0x8')](util['format'](_0xee46('0x28'),_0x113bf2['id']));return _0x113bf2[_0xee46('0x29')]({'sentiment':_0x210967[_0xee46('0x2a')],'sPositive':_0x210967[_0xee46('0x2b')]['Positive'],'sNegative':_0x210967['SentimentScore'][_0xee46('0x2c')],'sMixed':_0x210967[_0xee46('0x2b')]['Mixed'],'sNeutral':_0x210967[_0xee46('0x2b')][_0xee46('0x2d')]});})[_0xee46('0xd')](function(){logger[_0xee46('0x8')](util['format'](_0xee46('0x2e'),_0x113bf2['id']));_0x54e1fe();});case _0xee46('0x2f'):return _0x113bf2['update']({'transcribeStatus':_0xee46('0x2f'),'failureReason':_0x861be5[_0xee46('0xf')][_0xee46('0x30')]})[_0xee46('0xd')](function(){logger[_0xee46('0x8')](util[_0xee46('0x9')](_0xee46('0x2e'),_0x113bf2['id']));_0x54e1fe();});default:logger[_0xee46('0x8')](util[_0xee46('0x9')](_0xee46('0x31'),_0x113bf2['id']));break;}}else{return BPromise['resolve']()['then'](function(){if(!_0x113bf2[_0xee46('0x1b')]){throw new db[(_0xee46('0x1c'))][(_0xee46('0x1d'))](_0xee46('0x1e'));}if(!_0x568890[_0xee46('0x32')]||!_0x568890[_0xee46('0x1f')]||!_0x568890[_0xee46('0x27')]||!_0x568890[_0xee46('0x20')]||!_0x568890[_0xee46('0x21')]){throw new db['Sequelize'][(_0xee46('0x1d'))](_0xee46('0x22'));}if(!_0x113bf2[_0xee46('0x11')]){throw new Error(_0xee46('0x33'));}if(_0x568890['sentimentAccountId']===_0x43ffe3['id']){return _0x43ffe3;}else{return db['CloudProvider'][_0xee46('0x34')]({'where':{'id':_settings[_0xee46('0x1f')]}});}})['then'](function(_0x2d15f6){if(!_0x2d15f6){throw new db['Sequelize'][(_0xee46('0x1d'))](_0xee46('0x24'));}if(!_0x2d15f6[_0xee46('0xb')]||!_0x2d15f6[_0xee46('0x25')]){throw new db[(_0xee46('0x1c'))]['ValidationError'](_0xee46('0x35'));}_0x44182b=_0x2d15f6;logger['info'](util[_0xee46('0x9')](_0xee46('0x26'),_0x113bf2['id']));return sentiment(_0x44182b[_0xee46('0xb')],_0x44182b[_0xee46('0x25')],_0x568890[_0xee46('0x27')],_0x113bf2[_0xee46('0x11')],_0x568890[_0xee46('0x20')]);})[_0xee46('0xd')](function(_0x72f3ce){logger[_0xee46('0x8')](util[_0xee46('0x9')](_0xee46('0x28'),_0x113bf2['id']));return _0x113bf2[_0xee46('0x29')]({'sentiment':_0x72f3ce[_0xee46('0x2a')],'sPositive':_0x72f3ce[_0xee46('0x2b')][_0xee46('0x36')],'sNegative':_0x72f3ce[_0xee46('0x2b')][_0xee46('0x2c')],'sMixed':_0x72f3ce['SentimentScore'][_0xee46('0x37')],'sNeutral':_0x72f3ce['SentimentScore'][_0xee46('0x2d')],'transcribeStatus':_0xee46('0x12')});})['then'](function(){logger[_0xee46('0x8')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x113bf2['id']));_0x54e1fe();});}})['catch'](function(_0x47a2bf){if(_0x47a2bf){if(!_0x47a2bf[_0xee46('0x38')]||_0x47a2bf[_0xee46('0x38')]!==_0xee46('0x39')){logger[_0xee46('0x3a')](util[_0xee46('0x9')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x113bf2['id']),util[_0xee46('0x3b')](_0x47a2bf,{'showHidden':![],'depth':null}));}}_0x54e1fe();});});}function checkTranscribe(){var _0x5a1386;var _0x46b30f;var _0xe44195;return db[_0xee46('0x3c')][_0xee46('0x3d')]({'where':{'transcribeStatus':_0xee46('0x3e')}})['then'](function(_0xbca323){if(!_0xbca323||!_0xbca323[_0xee46('0x19')]){throw new db[(_0xee46('0x1c'))][(_0xee46('0x1d'))](_0xee46('0x3f'));}_0x5a1386=_0xbca323;return db[_0xee46('0x40')]['findOne']({'where':{'id':0x1}});})['then'](function(_0x227673){if(!_0x227673){throw new db['Sequelize'][(_0xee46('0x1d'))](_0xee46('0x41'));}_0x46b30f=_0x227673;if(!_0x46b30f[_0xee46('0x3')]||!_0x46b30f[_0xee46('0x42')]||!_0x46b30f['transcribeRegion']||!_0x46b30f[_0xee46('0x20')]||!_0x46b30f[_0xee46('0x21')]){throw new db[(_0xee46('0x1c'))][(_0xee46('0x1d'))]('Transcribe\x20not\x20configured');}return db[_0xee46('0x23')][_0xee46('0x34')]({'where':{'id':_0x46b30f[_0xee46('0x42')]}});})[_0xee46('0xd')](function(_0x3896aa){if(!_0x3896aa){throw new db[(_0xee46('0x1c'))][(_0xee46('0x1d'))](_0xee46('0x24'));}if(!_0x3896aa['data1']||!_0x3896aa[_0xee46('0x25')]){throw new db[(_0xee46('0x1c'))][(_0xee46('0x1d'))](_0xee46('0x35'));}_0xe44195=_0x3896aa;var _0x246f0b=[];_0x5a1386['forEach'](function(_0x518e5d){_0x246f0b[_0xee46('0x43')](checkTranscribeJob(_0x518e5d,_0x46b30f,_0xe44195));});return BPromise[_0xee46('0x44')](_0x246f0b);})[_0xee46('0x45')](function(_0x1cc079){if(_0x1cc079){if(!_0x1cc079['name']||_0x1cc079[_0xee46('0x38')]!==_0xee46('0x39')){logger['error'](util[_0xee46('0x3b')](_0x1cc079,{'showHidden':![],'depth':null}));}}});}exports[_0xee46('0x46')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x7463=['lodash','request-promise','util','bluebird','../../mysqldb','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','transcribeName','data2','then','info','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','TranscriptionJobStatus','COMPLETED','[RECORDING:%d]\x20Get\x20transcript','Transcript','TranscriptFileUri','results','transcripts','length','transcript','update','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Positive','SentimentScore','Negative','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','Cloud\x20Provider\x20not\x20available','catch','name','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Transcribe\x20not\x20configured','forEach','push','all','SequelizeValidationError','start'];(function(_0x16a67a,_0x7ac9a7){var _0x5e3b3c=function(_0x2c89c6){while(--_0x2c89c6){_0x16a67a['push'](_0x16a67a['shift']());}};_0x5e3b3c(++_0x7ac9a7);}(_0x7463,0x15e));var _0x3746=function(_0x511b76,_0x4727fa){_0x511b76=_0x511b76-0x0;var _0x5424ff=_0x7463[_0x511b76];return _0x5424ff;};var _=require(_0x3746('0x0'));var AWS=require('aws-sdk');var rp=require(_0x3746('0x1'));var util=require(_0x3746('0x2'));var BPromise=require(_0x3746('0x3'));var db=require(_0x3746('0x4'))['db'];var logger=require('../../config/logger')(_0x3746('0x5'));function getTranscriptionJob(_0x582855,_0x3cf5b4,_0x2bf7c6,_0x5cae42){return new Promise(function(_0x36b8d0,_0x1521ff){var _0x5ed629=new AWS[(_0x3746('0x6'))]({'accessKeyId':_0x3cf5b4,'secretAccessKey':_0x582855,'region':_0x2bf7c6});_0x5ed629[_0x3746('0x7')]({'TranscriptionJobName':_0x5cae42},function(_0x12e0aa,_0x9170b8){if(_0x12e0aa){return _0x1521ff(_0x12e0aa);}else{return _0x36b8d0(_0x9170b8);}});});}function sentiment(_0x5e7ce5,_0x37a295,_0x3550f7,_0x1844f8,_0x2eda35){return new Promise(function(_0x4180a6,_0x4f0100){var _0x2cfaf6=new AWS[(_0x3746('0x8'))]({'accessKeyId':_0x37a295,'secretAccessKey':_0x5e7ce5,'region':_0x3550f7});_0x2cfaf6[_0x3746('0x9')]({'Text':_0x1844f8,'LanguageCode':_0x2eda35[_0x3746('0xa')](0x0,0x2)},function(_0x5d549b,_0x29e35b){if(_0x5d549b){return _0x4f0100(_0x5d549b);}else{return _0x4180a6(_0x29e35b);}});});}function checkTranscribeJob(_0x5826ca,_0x27820d,_0x92145c){var _0x1fc391;return new BPromise(function(_0x217168,_0x3ce127){logger['info'](util['format']('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x5826ca['id'],_0x5826ca[_0x3746('0xb')]));return getTranscriptionJob(_0x92145c['data1'],_0x92145c[_0x3746('0xc')],_0x27820d['transcribeRegion'],_0x5826ca[_0x3746('0xb')])[_0x3746('0xd')](function(_0x280b12){logger[_0x3746('0xe')](util[_0x3746('0xf')](_0x3746('0x10'),_0x5826ca['id'],_0x5826ca[_0x3746('0xb')],_0x280b12[_0x3746('0x11')]['TranscriptionJobStatus']));if(!_0x5826ca[_0x3746('0x12')]){switch(_0x280b12[_0x3746('0x11')][_0x3746('0x13')]){case _0x3746('0x14'):var _0x60e9f={'transcribeStatus':_0x280b12['TranscriptionJob']['TranscriptionJobStatus'],'fileUri':_0x280b12[_0x3746('0x11')]['Transcript']['TranscriptFileUri']};logger[_0x3746('0xe')](util[_0x3746('0xf')](_0x3746('0x15'),_0x5826ca['id']));return rp({'uri':_0x280b12[_0x3746('0x11')][_0x3746('0x16')][_0x3746('0x17')],'json':!![]})['then'](function(_0x1136e1){logger[_0x3746('0xe')](util[_0x3746('0xf')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x5826ca['id']));if(_0x1136e1&&_0x1136e1[_0x3746('0x18')]&&_0x1136e1['results'][_0x3746('0x19')]&&_0x1136e1[_0x3746('0x18')]['transcripts'][_0x3746('0x1a')]){_0x60e9f[_0x3746('0x12')]='';for(var _0x8c72f0=0x0;_0x8c72f0<_0x1136e1[_0x3746('0x18')][_0x3746('0x19')]['length'];_0x8c72f0++){_0x60e9f[_0x3746('0x12')]+=_0x1136e1[_0x3746('0x18')][_0x3746('0x19')][_0x8c72f0][_0x3746('0x1b')]+'';}}return _0x5826ca[_0x3746('0x1c')](_0x60e9f);})[_0x3746('0xd')](function(){logger[_0x3746('0xe')](util[_0x3746('0xf')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5826ca['id']));if(!_0x5826ca[_0x3746('0x1d')]){throw new db[(_0x3746('0x1e'))]['ValidationError'](_0x3746('0x1f'));}if(!_0x27820d[_0x3746('0x20')]||!_0x27820d[_0x3746('0x21')]||!_0x27820d[_0x3746('0x22')]||!_0x27820d[_0x3746('0x23')]||!_0x27820d[_0x3746('0x24')]){throw new db['Sequelize'][(_0x3746('0x25'))](_0x3746('0x26'));}if(!_0x60e9f[_0x3746('0x12')]){throw new Error(_0x3746('0x27'));}if(_0x27820d[_0x3746('0x21')]===_0x92145c['id']){return _0x92145c;}else{return db[_0x3746('0x28')][_0x3746('0x29')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x3746('0xd')](function(_0x36f3bc){if(!_0x36f3bc){throw new db[(_0x3746('0x1e'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x36f3bc[_0x3746('0x2a')]||!_0x36f3bc['data2']){throw new db[(_0x3746('0x1e'))][(_0x3746('0x25'))](_0x3746('0x2b'));}_0x1fc391=_0x36f3bc;logger['info'](util[_0x3746('0xf')](_0x3746('0x2c'),_0x5826ca['id']));return sentiment(_0x1fc391[_0x3746('0x2a')],_0x1fc391[_0x3746('0xc')],_0x27820d[_0x3746('0x22')],_0x60e9f[_0x3746('0x12')],_0x27820d[_0x3746('0x23')]);})['then'](function(_0x1055e9){logger[_0x3746('0xe')](util['format'](_0x3746('0x2d'),_0x5826ca['id']));return _0x5826ca['update']({'sentiment':_0x1055e9[_0x3746('0x2e')],'sPositive':_0x1055e9['SentimentScore'][_0x3746('0x2f')],'sNegative':_0x1055e9[_0x3746('0x30')][_0x3746('0x31')],'sMixed':_0x1055e9[_0x3746('0x30')][_0x3746('0x32')],'sNeutral':_0x1055e9[_0x3746('0x30')][_0x3746('0x33')]});})[_0x3746('0xd')](function(){logger[_0x3746('0xe')](util['format'](_0x3746('0x34'),_0x5826ca['id']));_0x217168();});case _0x3746('0x35'):return _0x5826ca[_0x3746('0x1c')]({'transcribeStatus':_0x3746('0x35'),'failureReason':_0x280b12['TranscriptionJob'][_0x3746('0x36')]})[_0x3746('0xd')](function(){logger['info'](util['format'](_0x3746('0x34'),_0x5826ca['id']));_0x217168();});default:logger[_0x3746('0xe')](util[_0x3746('0xf')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x5826ca['id']));break;}}else{return BPromise['resolve']()[_0x3746('0xd')](function(){if(!_0x5826ca[_0x3746('0x1d')]){throw new db[(_0x3746('0x1e'))][(_0x3746('0x25'))](_0x3746('0x1f'));}if(!_0x27820d[_0x3746('0x20')]||!_0x27820d['sentimentAccountId']||!_0x27820d[_0x3746('0x22')]||!_0x27820d[_0x3746('0x23')]||!_0x27820d[_0x3746('0x24')]){throw new db[(_0x3746('0x1e'))][(_0x3746('0x25'))](_0x3746('0x26'));}if(!_0x5826ca['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x27820d[_0x3746('0x21')]===_0x92145c['id']){return _0x92145c;}else{return db[_0x3746('0x28')][_0x3746('0x29')]({'where':{'id':_settings[_0x3746('0x21')]}});}})[_0x3746('0xd')](function(_0x186a75){if(!_0x186a75){throw new db[(_0x3746('0x1e'))][(_0x3746('0x25'))](_0x3746('0x37'));}if(!_0x186a75['data1']||!_0x186a75['data2']){throw new db[(_0x3746('0x1e'))][(_0x3746('0x25'))](_0x3746('0x2b'));}_0x1fc391=_0x186a75;logger['info'](util[_0x3746('0xf')](_0x3746('0x2c'),_0x5826ca['id']));return sentiment(_0x1fc391[_0x3746('0x2a')],_0x1fc391[_0x3746('0xc')],_0x27820d[_0x3746('0x22')],_0x5826ca['fileText'],_0x27820d[_0x3746('0x23')]);})[_0x3746('0xd')](function(_0x218d38){logger[_0x3746('0xe')](util[_0x3746('0xf')](_0x3746('0x2d'),_0x5826ca['id']));return _0x5826ca['update']({'sentiment':_0x218d38[_0x3746('0x2e')],'sPositive':_0x218d38['SentimentScore'][_0x3746('0x2f')],'sNegative':_0x218d38[_0x3746('0x30')][_0x3746('0x31')],'sMixed':_0x218d38[_0x3746('0x30')][_0x3746('0x32')],'sNeutral':_0x218d38[_0x3746('0x30')][_0x3746('0x33')],'transcribeStatus':_0x3746('0x14')});})[_0x3746('0xd')](function(){logger[_0x3746('0xe')](util[_0x3746('0xf')](_0x3746('0x34'),_0x5826ca['id']));_0x217168();});}})[_0x3746('0x38')](function(_0x3799b5){if(_0x3799b5){if(!_0x3799b5['name']||_0x3799b5[_0x3746('0x39')]!=='SequelizeValidationError'){logger[_0x3746('0x3a')](util['format'](_0x3746('0x3b'),_0x5826ca['id']),util[_0x3746('0x3c')](_0x3799b5,{'showHidden':![],'depth':null}));}}_0x217168();});});}function checkTranscribe(){var _0xa2790c;var _0x363685;var _0x3b6660;return db['VoiceRecording'][_0x3746('0x3d')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x3746('0xd')](function(_0x560f78){if(!_0x560f78||!_0x560f78['length']){throw new db[(_0x3746('0x1e'))][(_0x3746('0x25'))](_0x3746('0x3e'));}_0xa2790c=_0x560f78;return db[_0x3746('0x3f')]['findOne']({'where':{'id':0x1}});})[_0x3746('0xd')](function(_0xd33666){if(!_0xd33666){throw new db[(_0x3746('0x1e'))][(_0x3746('0x25'))]('Settings\x20not\x20available');}_0x363685=_0xd33666;if(!_0x363685[_0x3746('0x5')]||!_0x363685['transcribeAccountId']||!_0x363685['transcribeRegion']||!_0x363685[_0x3746('0x23')]||!_0x363685[_0x3746('0x24')]){throw new db[(_0x3746('0x1e'))][(_0x3746('0x25'))](_0x3746('0x40'));}return db[_0x3746('0x28')][_0x3746('0x29')]({'where':{'id':_0x363685['transcribeAccountId']}});})['then'](function(_0x10ca96){if(!_0x10ca96){throw new db[(_0x3746('0x1e'))][(_0x3746('0x25'))](_0x3746('0x37'));}if(!_0x10ca96['data1']||!_0x10ca96['data2']){throw new db['Sequelize'][(_0x3746('0x25'))](_0x3746('0x2b'));}_0x3b6660=_0x10ca96;var _0x3d6185=[];_0xa2790c[_0x3746('0x41')](function(_0x400b4a){_0x3d6185[_0x3746('0x42')](checkTranscribeJob(_0x400b4a,_0x363685,_0x3b6660));});return BPromise[_0x3746('0x43')](_0x3d6185);})[_0x3746('0x38')](function(_0xe3f702){if(_0xe3f702){if(!_0xe3f702[_0x3746('0x39')]||_0xe3f702[_0x3746('0x39')]!==_0x3746('0x44')){logger['error'](util[_0x3746('0x3c')](_0xe3f702,{'showHidden':![],'depth':null}));}}});}exports[_0x3746('0x45')]=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 c6dfa61..3b1e402 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x12fc=['hopper2','push','Biondo','innocenzo.biondo','@xcally.com','now','Innocenzo','CmContact','destroy','bulkCreate','then','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2'];(function(_0x256fda,_0x23cb52){var _0x333a5a=function(_0x50754d){while(--_0x50754d){_0x256fda['push'](_0x256fda['shift']());}};_0x333a5a(++_0x23cb52);}(_0x12fc,0x166));var _0xc12f=function(_0x326efa,_0x470335){_0x326efa=_0x326efa-0x0;var _0x529d4f=_0x12fc[_0x326efa];return _0x529d4f;};'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[_0xc12f('0x0')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xc12f('0x1')+i,'phone':0xf879fb460+i,'email':_0xc12f('0x2')+i+_0xc12f('0x3')});}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[_0xc12f('0x4')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xc12f('0x5')+i,'lastName':_0xc12f('0x1')+i,'phone':0xf879fb460+i,'email':_0xc12f('0x2')+i+_0xc12f('0x3')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0xc12f('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xc12f('0x4')](),'updatedAt':Date[_0xc12f('0x4')]()});}db[_0xc12f('0x6')][_0xc12f('0x7')]({'where':{}})['then'](function(){return db[_0xc12f('0x6')][_0xc12f('0x8')](contacts);})[_0xc12f('0x9')](function(){console[_0xc12f('0xa')](_0xc12f('0xb'),_0xc12f('0xc'));return db['CmHopper']['destroy']({'where':{}});})[_0xc12f('0x9')](function(){return db[_0xc12f('0xd')][_0xc12f('0x8')](hopper);})[_0xc12f('0x9')](function(){console['log'](_0xc12f('0xb'),_0xc12f('0xe'));return db[_0xc12f('0x6')][_0xc12f('0x8')](contacts2);})[_0xc12f('0x9')](function(){console['log'](_0xc12f('0xb'),_0xc12f('0xf'));return db[_0xc12f('0xd')]['bulkCreate'](hopper2);})[_0xc12f('0x9')](function(){console['log'](_0xc12f('0xb'),_0xc12f('0x10'));})['catch'](function(_0x6055bf){console[_0xc12f('0xa')](_0x6055bf);}); \ No newline at end of file +var _0x1642=['destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','catch','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact'];(function(_0x443251,_0x2e8685){var _0x2580b8=function(_0x26c8fc){while(--_0x26c8fc){_0x443251['push'](_0x443251['shift']());}};_0x2580b8(++_0x2e8685);}(_0x1642,0x184));var _0x2164=function(_0x3605ee,_0x5a636a){_0x3605ee=_0x3605ee-0x0;var _0x2d99af=_0x1642[_0x3605ee];return _0x2d99af;};'use strict';var util=require('util');var db=require(_0x2164('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x2164('0x1')]({'id':i,'firstName':_0x2164('0x2')+i,'lastName':_0x2164('0x3')+i,'phone':0xf879fb460+i,'email':_0x2164('0x4')+i+_0x2164('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x2164('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x2164('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2164('0x6')](),'updatedAt':Date[_0x2164('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x2164('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x2164('0x3')+i,'phone':0xf879fb460+i,'email':_0x2164('0x4')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x2164('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2164('0x6')](),'updatedAt':Date[_0x2164('0x6')]()});}db[_0x2164('0x7')][_0x2164('0x8')]({'where':{}})[_0x2164('0x9')](function(){return db[_0x2164('0x7')][_0x2164('0xa')](contacts);})[_0x2164('0x9')](function(){console[_0x2164('0xb')](_0x2164('0xc'),_0x2164('0xd'));return db[_0x2164('0xe')][_0x2164('0x8')]({'where':{}});})[_0x2164('0x9')](function(){return db[_0x2164('0xe')][_0x2164('0xa')](hopper);})['then'](function(){console[_0x2164('0xb')]('finished\x20populating',_0x2164('0xf'));return db['CmContact'][_0x2164('0xa')](contacts2);})['then'](function(){console[_0x2164('0xb')]('finished\x20populating',_0x2164('0x10'));return db[_0x2164('0xe')][_0x2164('0xa')](hopper2);})['then'](function(){console[_0x2164('0xb')](_0x2164('0xc'),'hopper2');})[_0x2164('0x11')](function(_0x477c60){console['log'](_0x477c60);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index d1d6fec..4d6e7d7 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8ec=['%s%s','password','friend','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','../mysqldb','push','format','agent'];(function(_0x3d5df9,_0x5b3623){var _0x50ba39=function(_0x3c0de0){while(--_0x3c0de0){_0x3d5df9['push'](_0x3d5df9['shift']());}};_0x50ba39(++_0x5b3623);}(_0xd8ec,0x1d7));var _0xcd8e=function(_0x594821,_0x153b6c){_0x594821=_0x594821-0x0;var _0x139112=_0xd8ec[_0x594821];return _0x139112;};'use strict';var util=require('util');var db=require(_0xcd8e('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xcd8e('0x1')]({'name':util[_0xcd8e('0x2')]('%s%s',_0xcd8e('0x3'),i),'fullname':util[_0xcd8e('0x2')](_0xcd8e('0x4'),_0xcd8e('0x3'),i),'email':util[_0xcd8e('0x2')]('%s%s@xcally.com','agent',i),'role':_0xcd8e('0x3'),'password':_0xcd8e('0x5'),'internal':0xfa0+i,'type':_0xcd8e('0x6'),'transport':['udp','ws',_0xcd8e('0x7')],'disallow':[_0xcd8e('0x8')],'allow':[_0xcd8e('0x9')],'defaultuser':util[_0xcd8e('0x2')](_0xcd8e('0x4'),_0xcd8e('0x3'),i),'encryption':'yes','avpf':_0xcd8e('0xa'),'force_avp':_0xcd8e('0xa'),'icesupport':_0xcd8e('0xa'),'dtlsenable':_0xcd8e('0xa'),'dtlsverify':'no','dtlscertfile':_0xcd8e('0xb'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':'actpass','callerid':util['format'](_0xcd8e('0xc'),util[_0xcd8e('0x2')](_0xcd8e('0x4'),_0xcd8e('0x3'),i),0xfa0+i)});}db[_0xcd8e('0xd')][_0xcd8e('0xe')](users)[_0xcd8e('0xf')](function(){console[_0xcd8e('0x10')](_0xcd8e('0x11'));})[_0xcd8e('0x12')](function(_0xf6b857){console[_0xcd8e('0x10')](_0xf6b857);}); \ No newline at end of file +var _0x44a4=['/etc/pki/tls/certs/motion.crt','actpass','format','\x22%s\x22\x20<%s>','User','bulkCreate','then','add\x20user','catch','util','push','agent','%s%s','%s%s@xcally.com','password','friend','wss','all','ulaw','yes'];(function(_0x6a3450,_0x5edf9e){var _0x579dc4=function(_0x5a8172){while(--_0x5a8172){_0x6a3450['push'](_0x6a3450['shift']());}};_0x579dc4(++_0x5edf9e);}(_0x44a4,0x95));var _0x444a=function(_0x12f48d,_0x2871dc){_0x12f48d=_0x12f48d-0x0;var _0x58f602=_0x44a4[_0x12f48d];return _0x58f602;};'use strict';var util=require(_0x444a('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x444a('0x1')]({'name':util['format']('%s%s',_0x444a('0x2'),i),'fullname':util['format'](_0x444a('0x3'),_0x444a('0x2'),i),'email':util['format'](_0x444a('0x4'),_0x444a('0x2'),i),'role':_0x444a('0x2'),'password':_0x444a('0x5'),'internal':0xfa0+i,'type':_0x444a('0x6'),'transport':['udp','ws',_0x444a('0x7')],'disallow':[_0x444a('0x8')],'allow':[_0x444a('0x9')],'defaultuser':util['format'](_0x444a('0x3'),_0x444a('0x2'),i),'encryption':_0x444a('0xa'),'avpf':_0x444a('0xa'),'force_avp':_0x444a('0xa'),'icesupport':_0x444a('0xa'),'dtlsenable':_0x444a('0xa'),'dtlsverify':'no','dtlscertfile':_0x444a('0xb'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x444a('0xc'),'callerid':util[_0x444a('0xd')](_0x444a('0xe'),util['format'](_0x444a('0x3'),_0x444a('0x2'),i),0xfa0+i)});}db[_0x444a('0xf')][_0x444a('0x10')](users)[_0x444a('0x11')](function(){console['log'](_0x444a('0x12'));})[_0x444a('0x13')](function(_0x105682){console['log'](_0x105682);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index cf6a399..03e80e7 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9b23=['remotePort','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','telephone','type','findOne','then','autoAssociation','ChatQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','UserProfileResource','resourceId','map','where','Campaign','ivr','format','length','user:%s','handshake','query','find','userProfileId','ChatInteraction','MailInteraction','MailInteractions','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','admin','hasOwnProperty','include','push','FaxQueue','SmsQueue','MailQueue','Trunk','voice:inbound','VoiceQueues','ChatQueue','FaxQueues','OpenchannelQueue','WhatsappQueue','Telephones','IvrCampaigns','voice:outbound','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','fax','sms','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','ChatInteractions','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','address','request','remoteAddress'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x9b23,0x136));var _0x39b2=function(_0x342db7,_0x162bf0){_0x342db7=_0x342db7-0x0;var _0x4c3b3c=_0x9b23[_0x342db7];return _0x4c3b3c;};'use strict';var _=require(_0x39b2('0x0'));var util=require(_0x39b2('0x1'));var BPromise=require(_0x39b2('0x2'));var db=require(_0x39b2('0x3'))['db'];var config=require(_0x39b2('0x4'));var queryQueues={'attributes':['id',_0x39b2('0x5')],'include':[{'as':_0x39b2('0x6'),'model':db[_0x39b2('0x7')],'attributes':['id',_0x39b2('0x5'),_0x39b2('0x8')],'raw':!![],'where':{'role':_0x39b2('0x9')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x39b2('0x5')],'where':{'role':_0x39b2('0xa')}};var queryTrunks={'raw':!![],'attributes':['id',_0x39b2('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0x39b2('0x5')],'where':{'role':_0x39b2('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x39b2('0x5'),_0x39b2('0xb')],'where':{'type':'ivr'}};function getAssociatedResources(_0x47f80c,_0x2c8778,_0x4bdba){return db['UserProfileSection'][_0x39b2('0xc')]({'where':{'name':_0x47f80c,'userProfileId':_0x2c8778},'raw':!![]})[_0x39b2('0xd')](function(_0x14bfcb){if(_0x14bfcb){if(_0x14bfcb[_0x39b2('0xe')]){switch(_0x47f80c){case'VoiceQueues':case _0x39b2('0xf'):case'FaxQueues':case'SmsQueues':case _0x39b2('0x10'):case _0x39b2('0x11'):case _0x39b2('0x12'):return db[_0x4bdba][_0x39b2('0x13')](queryQueues);case'Telephones':return db[_0x4bdba][_0x39b2('0x13')](queryTelephones);case _0x39b2('0x14'):return db[_0x4bdba][_0x39b2('0x13')](queryTrunks);case'IvrCampaigns':return db[_0x4bdba][_0x39b2('0x13')](queryCampaigns);}}else{return db[_0x39b2('0x15')][_0x39b2('0x13')]({'attributes':[_0x39b2('0x16')],'where':{'sectionId':_0x14bfcb['id']},'raw':!![]})[_0x39b2('0xd')](function(_0x366e20){if(_0x366e20){var _0x2b1e13={'where':{'id':_[_0x39b2('0x17')](_0x366e20,_0x39b2('0x16'))},'raw':!![]};switch(_0x4bdba){case _0x39b2('0x7'):_0x2b1e13[_0x39b2('0x18')][_0x39b2('0x8')]=_0x39b2('0xa');break;case _0x39b2('0x19'):_0x2b1e13[_0x39b2('0x18')][_0x39b2('0xb')]=_0x39b2('0x1a');break;}return db[_0x4bdba][_0x39b2('0x13')](_0x2b1e13);}else{return[];}});}}else{return[];}})['then'](function(_0x4d026e){return _0x4d026e;});}function joinOrLeaveQueues(_0x116b0a,_0x568174,_0x3d798f,_0x4ef3ff){_0x116b0a[_0x568174](util[_0x39b2('0x1b')]('%s:queue:%s',_0x3d798f,_0x4ef3ff[_0x39b2('0x5')]));if(_0x4ef3ff[_0x39b2('0x6')]){for(var _0xba4a90=0x0;_0xba4a90<_0x4ef3ff['Agents'][_0x39b2('0x1c')];_0xba4a90+=0x1){_0x116b0a[_0x568174](util[_0x39b2('0x1b')](_0x39b2('0x1d'),_0x4ef3ff['Agents'][_0xba4a90][_0x39b2('0x5')]));}}}function joinOrLeave(_0x303ce3,_0x180969,_0x17dddc){var _0x207818;if(_0x303ce3[_0x39b2('0x1e')][_0x39b2('0x1f')]['id']){db[_0x39b2('0x7')][_0x39b2('0x20')]({'attributes':['id',_0x39b2('0x5'),'role',_0x39b2('0x21')],'where':{'id':_0x303ce3[_0x39b2('0x1e')][_0x39b2('0x1f')]['id']},'include':[{'model':db[_0x39b2('0x22')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x39b2('0x23')],'as':_0x39b2('0x24'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x39b2('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x39b2('0x26')],'as':_0x39b2('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x39b2('0x28')],'as':_0x39b2('0x29'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x39b2('0x2a'),'attributes':['id'],'raw':!![]}]})[_0x39b2('0xd')](function(_0x17f74d){if(_0x17f74d){_0x207818=_0x17f74d;_0x303ce3[_0x180969](util['format'](_0x39b2('0x1d'),_0x17f74d['name']));var _0x3ceee9=[];switch(_0x17f74d[_0x39b2('0x8')]){case _0x39b2('0x2b'):_0x303ce3[_0x180969]('voice:inbound');_0x303ce3[_0x180969]('voice:outbound');if(queryQueues[_0x39b2('0x2c')](_0x39b2('0x2d'))){delete queryQueues[_0x39b2('0x2d')];}_0x3ceee9[_0x39b2('0x2e')](db['VoiceQueue']['findAll'](queryQueues));_0x3ceee9[_0x39b2('0x2e')](db['ChatQueue']['findAll'](queryQueues));_0x3ceee9[_0x39b2('0x2e')](db[_0x39b2('0x2f')][_0x39b2('0x13')](queryQueues));_0x3ceee9['push'](db[_0x39b2('0x30')][_0x39b2('0x13')](queryQueues));_0x3ceee9[_0x39b2('0x2e')](db[_0x39b2('0x31')][_0x39b2('0x13')](queryQueues));_0x3ceee9[_0x39b2('0x2e')](db['OpenchannelQueue']['findAll'](queryQueues));_0x3ceee9['push'](db['WhatsappQueue'][_0x39b2('0x13')](queryQueues));_0x3ceee9['push'](db[_0x39b2('0x7')][_0x39b2('0x13')](queryTelephones));_0x3ceee9['push'](db[_0x39b2('0x32')]['findAll'](queryTrunks));_0x3ceee9[_0x39b2('0x2e')](db[_0x39b2('0x19')][_0x39b2('0x13')](queryCampaigns));_0x3ceee9[_0x39b2('0x2e')](db['User'][_0x39b2('0x13')](queryAgents));break;case'user':_0x303ce3[_0x180969](_0x39b2('0x33'));_0x303ce3[_0x180969]('voice:outbound');_0x3ceee9[_0x39b2('0x2e')](getAssociatedResources(_0x39b2('0x34'),_0x17f74d[_0x39b2('0x21')],'VoiceQueue'));_0x3ceee9[_0x39b2('0x2e')](getAssociatedResources('ChatQueues',_0x17f74d[_0x39b2('0x21')],_0x39b2('0x35')));_0x3ceee9[_0x39b2('0x2e')](getAssociatedResources(_0x39b2('0x36'),_0x17f74d[_0x39b2('0x21')],_0x39b2('0x2f')));_0x3ceee9[_0x39b2('0x2e')](getAssociatedResources('SmsQueues',_0x17f74d[_0x39b2('0x21')],_0x39b2('0x30')));_0x3ceee9[_0x39b2('0x2e')](getAssociatedResources(_0x39b2('0x10'),_0x17f74d[_0x39b2('0x21')],'MailQueue'));_0x3ceee9['push'](getAssociatedResources(_0x39b2('0x11'),_0x17f74d[_0x39b2('0x21')],_0x39b2('0x37')));_0x3ceee9[_0x39b2('0x2e')](getAssociatedResources(_0x39b2('0x12'),_0x17f74d[_0x39b2('0x21')],_0x39b2('0x38')));_0x3ceee9[_0x39b2('0x2e')](getAssociatedResources(_0x39b2('0x39'),_0x17f74d[_0x39b2('0x21')],'User'));_0x3ceee9[_0x39b2('0x2e')](getAssociatedResources(_0x39b2('0x14'),_0x17f74d[_0x39b2('0x21')],_0x39b2('0x32')));_0x3ceee9['push'](getAssociatedResources(_0x39b2('0x3a'),_0x17f74d[_0x39b2('0x21')],_0x39b2('0x19')));_0x3ceee9['push'](db[_0x39b2('0x7')][_0x39b2('0x13')](queryAgents));break;case'agent':_0x303ce3[_0x180969]('voice:inbound');_0x303ce3[_0x180969](_0x39b2('0x3b'));_0x3ceee9[_0x39b2('0x2e')](_0x17f74d['getVoiceQueues']({'attributes':['id','name']}));_0x3ceee9[_0x39b2('0x2e')](_0x17f74d['getChatQueues']({'attributes':['id',_0x39b2('0x5')]}));_0x3ceee9[_0x39b2('0x2e')](_0x17f74d[_0x39b2('0x3c')]({'attributes':['id',_0x39b2('0x5')]}));_0x3ceee9[_0x39b2('0x2e')](_0x17f74d[_0x39b2('0x3d')]({'attributes':['id',_0x39b2('0x5')]}));_0x3ceee9['push'](_0x17f74d[_0x39b2('0x3e')]({'attributes':['id',_0x39b2('0x5')]}));_0x3ceee9[_0x39b2('0x2e')](_0x17f74d[_0x39b2('0x3f')]({'attributes':['id','name']}));_0x3ceee9[_0x39b2('0x2e')](_0x17f74d[_0x39b2('0x40')]({'attributes':['id',_0x39b2('0x5')]}));break;}return BPromise[_0x39b2('0x41')](_0x3ceee9);}})[_0x39b2('0xd')](function(_0x32149a){if(_0x32149a&&_0x32149a[_0x39b2('0x1c')]){for(var _0x48a041=0x0;_0x48a041<_0x32149a[_0x39b2('0x1c')];_0x48a041+=0x1){for(var _0x385d08=0x0;_0x385d08<_0x32149a[_0x48a041]['length'];_0x385d08+=0x1){switch(_0x48a041){case 0x0:joinOrLeaveQueues(_0x303ce3,_0x180969,'voice',_0x32149a[_0x48a041][_0x385d08]);break;case 0x1:joinOrLeaveQueues(_0x303ce3,_0x180969,'chat',_0x32149a[_0x48a041][_0x385d08]);break;case 0x2:joinOrLeaveQueues(_0x303ce3,_0x180969,_0x39b2('0x42'),_0x32149a[_0x48a041][_0x385d08]);break;case 0x3:joinOrLeaveQueues(_0x303ce3,_0x180969,_0x39b2('0x43'),_0x32149a[_0x48a041][_0x385d08]);break;case 0x4:joinOrLeaveQueues(_0x303ce3,_0x180969,'mail',_0x32149a[_0x48a041][_0x385d08]);break;case 0x5:joinOrLeaveQueues(_0x303ce3,_0x180969,_0x39b2('0x44'),_0x32149a[_0x48a041][_0x385d08]);break;case 0x6:joinOrLeaveQueues(_0x303ce3,_0x180969,_0x39b2('0x45'),_0x32149a[_0x48a041][_0x385d08]);break;case 0x7:_0x303ce3[_0x180969](util['format'](_0x39b2('0x46'),_0x32149a[_0x48a041][_0x385d08]['name']));break;case 0x8:_0x303ce3[_0x180969](util[_0x39b2('0x1b')](_0x39b2('0x47'),_0x32149a[_0x48a041][_0x385d08]['name']));break;case 0x9:_0x303ce3[_0x180969](util[_0x39b2('0x1b')](_0x39b2('0x48'),_0x32149a[_0x48a041][_0x385d08][_0x39b2('0xb')],_0x32149a[_0x48a041][_0x385d08][_0x39b2('0x5')]));break;case 0xa:_0x303ce3[_0x180969](util[_0x39b2('0x1b')](_0x39b2('0x1d'),_0x32149a[_0x48a041][_0x385d08][_0x39b2('0x5')]));break;}}}}})[_0x39b2('0xd')](function(){if(_0x180969===_0x39b2('0x49')){var _0x5bc2fc=_[_0x39b2('0x17')](_0x207818[_0x39b2('0x4a')],'id');return _0x207818[_0x39b2('0x4b')](_0x5bc2fc)[_0x39b2('0xd')](function(){for(var _0x2d8d85=0x0;_0x2d8d85<_0x5bc2fc[_0x39b2('0x1c')];_0x2d8d85+=0x1){_0x17dddc[_0x39b2('0x4c')](_0x39b2('0x4d'),{'ChatInteractionId':Number(_0x5bc2fc[_0x2d8d85]),'UserId':Number(_0x207818['id'])});}});}})[_0x39b2('0xd')](function(){if(_0x180969===_0x39b2('0x49')){var _0x325197=_['map'](_0x207818[_0x39b2('0x24')],'id');return _0x207818[_0x39b2('0x4e')](_0x325197)['then'](function(){for(var _0x377cde=0x0;_0x377cde<_0x325197[_0x39b2('0x1c')];_0x377cde+=0x1){_0x17dddc[_0x39b2('0x4c')](_0x39b2('0x4f'),{'MailInteractionId':Number(_0x325197[_0x377cde]),'UserId':Number(_0x207818['id'])});}});}})[_0x39b2('0xd')](function(){if(_0x180969==='leave'){var _0x54ce11=_[_0x39b2('0x17')](_0x207818['FaxInteractions'],'id');return _0x207818[_0x39b2('0x50')](_0x54ce11)[_0x39b2('0xd')](function(){for(var _0x3eb830=0x0;_0x3eb830<_0x54ce11['length'];_0x3eb830+=0x1){_0x17dddc['emit']('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x54ce11[_0x3eb830]),'UserId':Number(_0x207818['id'])});}});}})['then'](function(){if(_0x180969===_0x39b2('0x49')){var _0x32b82f=_[_0x39b2('0x17')](_0x207818[_0x39b2('0x27')],'id');return _0x207818[_0x39b2('0x51')](_0x32b82f)[_0x39b2('0xd')](function(){for(var _0x5570df=0x0;_0x5570df<_0x32b82f['length'];_0x5570df+=0x1){_0x17dddc[_0x39b2('0x4c')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x32b82f[_0x5570df]),'UserId':Number(_0x207818['id'])});}});}})[_0x39b2('0xd')](function(){if(_0x180969==='leave'){var _0x5ac039=_['map'](_0x207818['OpenchannelInteractions'],'id');return _0x207818[_0x39b2('0x52')](_0x5ac039)['then'](function(){for(var _0x13ecb2=0x0;_0x13ecb2<_0x5ac039[_0x39b2('0x1c')];_0x13ecb2+=0x1){_0x17dddc[_0x39b2('0x4c')](_0x39b2('0x53'),{'OpenchannelInteractionId':Number(_0x5ac039[_0x13ecb2]),'UserId':Number(_0x207818['id'])});}});}})[_0x39b2('0xd')](function(){if(_0x180969===_0x39b2('0x49')){var _0x97c6a2=_['map'](_0x207818[_0x39b2('0x2a')],'id');return _0x207818[_0x39b2('0x54')](_0x97c6a2)[_0x39b2('0xd')](function(){for(var _0x59db78=0x0;_0x59db78<_0x97c6a2['length'];_0x59db78+=0x1){_0x17dddc[_0x39b2('0x4c')](_0x39b2('0x55'),{'WhatsappInteractionId':Number(_0x97c6a2[_0x59db78]),'UserId':Number(_0x207818['id'])});}});}})[_0x39b2('0x56')](function(_0x1289dc){_0x303ce3[_0x39b2('0x57')](_0x1289dc);});}}function onDisconnect(_0xd0f61f,_0x1fd7d0){joinOrLeave(_0xd0f61f,'leave',_0x1fd7d0);}function onConnect(_0x3a82c2){joinOrLeave(_0x3a82c2,_0x39b2('0x58'));}exports[_0x39b2('0x59')]=function(_0x1202e8){_0x1202e8['on'](_0x39b2('0x5a'),function(_0x3aec73){_0x3aec73['setMaxListeners'](0x0);_0x3aec73[_0x39b2('0x5b')]=_0x3aec73[_0x39b2('0x5c')][_0x39b2('0x5a')][_0x39b2('0x5d')]+':'+_0x3aec73[_0x39b2('0x5c')][_0x39b2('0x5a')][_0x39b2('0x5e')];_0x3aec73[_0x39b2('0x5f')]=new Date();_0x3aec73['log']=function(_0x177213){console[_0x39b2('0x57')](_0x39b2('0x60')+_0x3aec73[_0x39b2('0x61')][_0x39b2('0x5')]+'['+_0x3aec73[_0x39b2('0x5b')]+']',_0x177213);};_0x3aec73['on'](_0x39b2('0x62'),function(){onDisconnect(_0x3aec73,_0x1202e8);_0x3aec73['log'](_0x39b2('0x63'));});onConnect(_0x3aec73);_0x3aec73[_0x39b2('0x57')](_0x39b2('0x64'));});}; \ No newline at end of file +var _0x6b54=['MailQueue','OpenchannelQueue','WhatsappQueue','Campaign','user','voice:inbound','userProfileId','Trunk','IvrCampaigns','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','leave','removeChatInteractions','user_has_chat_interactions:remove','MailInteractions','removeMailInteractions','emit','user_has_mail_interactions:remove','FaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','default','connection','setMaxListeners','address','request','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','name','Agents','User','role','agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','UserProfileResource','resourceId','map','where','format','%s:queue:%s','length','user:%s','handshake','query','find','ChatInteraction','ChatInteractions','MailInteraction','FaxInteraction','SmsInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteractions','admin','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue'];(function(_0x57aef4,_0x2b9e3e){var _0x5c68a7=function(_0x1be236){while(--_0x1be236){_0x57aef4['push'](_0x57aef4['shift']());}};_0x5c68a7(++_0x2b9e3e);}(_0x6b54,0x176));var _0x46b5=function(_0x1a9730,_0xbb4703){_0x1a9730=_0x1a9730-0x0;var _0x1b66e6=_0x6b54[_0x1a9730];return _0x1b66e6;};'use strict';var _=require(_0x46b5('0x0'));var util=require(_0x46b5('0x1'));var BPromise=require(_0x46b5('0x2'));var db=require(_0x46b5('0x3'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x46b5('0x4')],'include':[{'as':_0x46b5('0x5'),'model':db[_0x46b5('0x6')],'attributes':['id',_0x46b5('0x4'),_0x46b5('0x7')],'raw':!![],'where':{'role':_0x46b5('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x46b5('0x4')],'where':{'role':_0x46b5('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0x46b5('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x46b5('0x4')],'where':{'role':_0x46b5('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x46b5('0xa')],'where':{'type':_0x46b5('0xb')}};function getAssociatedResources(_0x41e880,_0x4829f6,_0x29cc22){return db[_0x46b5('0xc')][_0x46b5('0xd')]({'where':{'name':_0x41e880,'userProfileId':_0x4829f6},'raw':!![]})[_0x46b5('0xe')](function(_0x5e1a37){if(_0x5e1a37){if(_0x5e1a37[_0x46b5('0xf')]){switch(_0x41e880){case _0x46b5('0x10'):case _0x46b5('0x11'):case _0x46b5('0x12'):case _0x46b5('0x13'):case _0x46b5('0x14'):case _0x46b5('0x15'):case _0x46b5('0x16'):return db[_0x29cc22][_0x46b5('0x17')](queryQueues);case _0x46b5('0x18'):return db[_0x29cc22][_0x46b5('0x17')](queryTelephones);case _0x46b5('0x19'):return db[_0x29cc22][_0x46b5('0x17')](queryTrunks);case'IvrCampaigns':return db[_0x29cc22][_0x46b5('0x17')](queryCampaigns);}}else{return db[_0x46b5('0x1a')][_0x46b5('0x17')]({'attributes':[_0x46b5('0x1b')],'where':{'sectionId':_0x5e1a37['id']},'raw':!![]})[_0x46b5('0xe')](function(_0x3c5928){if(_0x3c5928){var _0xdf59df={'where':{'id':_[_0x46b5('0x1c')](_0x3c5928,'resourceId')},'raw':!![]};switch(_0x29cc22){case'User':_0xdf59df[_0x46b5('0x1d')][_0x46b5('0x7')]=_0x46b5('0x9');break;case'Campaign':_0xdf59df[_0x46b5('0x1d')]['type']=_0x46b5('0xb');break;}return db[_0x29cc22][_0x46b5('0x17')](_0xdf59df);}else{return[];}});}}else{return[];}})[_0x46b5('0xe')](function(_0x5c970b){return _0x5c970b;});}function joinOrLeaveQueues(_0x47a876,_0x3d84a6,_0x34cf16,_0x37ecd9){_0x47a876[_0x3d84a6](util[_0x46b5('0x1e')](_0x46b5('0x1f'),_0x34cf16,_0x37ecd9[_0x46b5('0x4')]));if(_0x37ecd9[_0x46b5('0x5')]){for(var _0x1cb0ef=0x0;_0x1cb0ef<_0x37ecd9[_0x46b5('0x5')][_0x46b5('0x20')];_0x1cb0ef+=0x1){_0x47a876[_0x3d84a6](util[_0x46b5('0x1e')](_0x46b5('0x21'),_0x37ecd9['Agents'][_0x1cb0ef][_0x46b5('0x4')]));}}}function joinOrLeave(_0x12d610,_0x8105c1,_0x20c695){var _0x543f9c;if(_0x12d610[_0x46b5('0x22')][_0x46b5('0x23')]['id']){db['User'][_0x46b5('0x24')]({'attributes':['id',_0x46b5('0x4'),'role','userProfileId'],'where':{'id':_0x12d610[_0x46b5('0x22')]['query']['id']},'include':[{'model':db[_0x46b5('0x25')],'as':_0x46b5('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x46b5('0x27')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x46b5('0x28')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x46b5('0x29')],'as':_0x46b5('0x2a'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x46b5('0x2b'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x46b5('0x2c'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x34e7a1){if(_0x34e7a1){_0x543f9c=_0x34e7a1;_0x12d610[_0x8105c1](util[_0x46b5('0x1e')]('user:%s',_0x34e7a1['name']));var _0x275c86=[];switch(_0x34e7a1[_0x46b5('0x7')]){case _0x46b5('0x2d'):_0x12d610[_0x8105c1]('voice:inbound');_0x12d610[_0x8105c1](_0x46b5('0x2e'));if(queryQueues[_0x46b5('0x2f')](_0x46b5('0x30'))){delete queryQueues[_0x46b5('0x30')];}_0x275c86[_0x46b5('0x31')](db[_0x46b5('0x32')]['findAll'](queryQueues));_0x275c86[_0x46b5('0x31')](db[_0x46b5('0x33')][_0x46b5('0x17')](queryQueues));_0x275c86['push'](db[_0x46b5('0x34')]['findAll'](queryQueues));_0x275c86[_0x46b5('0x31')](db[_0x46b5('0x35')][_0x46b5('0x17')](queryQueues));_0x275c86[_0x46b5('0x31')](db[_0x46b5('0x36')][_0x46b5('0x17')](queryQueues));_0x275c86[_0x46b5('0x31')](db[_0x46b5('0x37')][_0x46b5('0x17')](queryQueues));_0x275c86[_0x46b5('0x31')](db[_0x46b5('0x38')][_0x46b5('0x17')](queryQueues));_0x275c86['push'](db[_0x46b5('0x6')][_0x46b5('0x17')](queryTelephones));_0x275c86['push'](db['Trunk']['findAll'](queryTrunks));_0x275c86[_0x46b5('0x31')](db[_0x46b5('0x39')]['findAll'](queryCampaigns));_0x275c86[_0x46b5('0x31')](db[_0x46b5('0x6')][_0x46b5('0x17')](queryAgents));break;case _0x46b5('0x3a'):_0x12d610[_0x8105c1](_0x46b5('0x3b'));_0x12d610[_0x8105c1](_0x46b5('0x2e'));_0x275c86[_0x46b5('0x31')](getAssociatedResources('VoiceQueues',_0x34e7a1[_0x46b5('0x3c')],_0x46b5('0x32')));_0x275c86[_0x46b5('0x31')](getAssociatedResources(_0x46b5('0x11'),_0x34e7a1[_0x46b5('0x3c')],_0x46b5('0x33')));_0x275c86[_0x46b5('0x31')](getAssociatedResources(_0x46b5('0x12'),_0x34e7a1[_0x46b5('0x3c')],'FaxQueue'));_0x275c86[_0x46b5('0x31')](getAssociatedResources('SmsQueues',_0x34e7a1[_0x46b5('0x3c')],_0x46b5('0x35')));_0x275c86[_0x46b5('0x31')](getAssociatedResources(_0x46b5('0x14'),_0x34e7a1['userProfileId'],_0x46b5('0x36')));_0x275c86['push'](getAssociatedResources(_0x46b5('0x15'),_0x34e7a1[_0x46b5('0x3c')],_0x46b5('0x37')));_0x275c86[_0x46b5('0x31')](getAssociatedResources('WhatsappQueues',_0x34e7a1['userProfileId'],_0x46b5('0x38')));_0x275c86[_0x46b5('0x31')](getAssociatedResources(_0x46b5('0x18'),_0x34e7a1[_0x46b5('0x3c')],_0x46b5('0x6')));_0x275c86['push'](getAssociatedResources('Trunks',_0x34e7a1['userProfileId'],_0x46b5('0x3d')));_0x275c86['push'](getAssociatedResources(_0x46b5('0x3e'),_0x34e7a1[_0x46b5('0x3c')],_0x46b5('0x39')));_0x275c86['push'](db[_0x46b5('0x6')][_0x46b5('0x17')](queryAgents));break;case _0x46b5('0x8'):_0x12d610[_0x8105c1](_0x46b5('0x3b'));_0x12d610[_0x8105c1](_0x46b5('0x2e'));_0x275c86['push'](_0x34e7a1[_0x46b5('0x3f')]({'attributes':['id',_0x46b5('0x4')]}));_0x275c86['push'](_0x34e7a1[_0x46b5('0x40')]({'attributes':['id',_0x46b5('0x4')]}));_0x275c86[_0x46b5('0x31')](_0x34e7a1[_0x46b5('0x41')]({'attributes':['id',_0x46b5('0x4')]}));_0x275c86[_0x46b5('0x31')](_0x34e7a1[_0x46b5('0x42')]({'attributes':['id',_0x46b5('0x4')]}));_0x275c86[_0x46b5('0x31')](_0x34e7a1[_0x46b5('0x43')]({'attributes':['id',_0x46b5('0x4')]}));_0x275c86['push'](_0x34e7a1[_0x46b5('0x44')]({'attributes':['id',_0x46b5('0x4')]}));_0x275c86[_0x46b5('0x31')](_0x34e7a1[_0x46b5('0x45')]({'attributes':['id',_0x46b5('0x4')]}));break;}return BPromise[_0x46b5('0x46')](_0x275c86);}})[_0x46b5('0xe')](function(_0x5526c5){if(_0x5526c5&&_0x5526c5[_0x46b5('0x20')]){for(var _0x57446d=0x0;_0x57446d<_0x5526c5[_0x46b5('0x20')];_0x57446d+=0x1){for(var _0x5c06cd=0x0;_0x5c06cd<_0x5526c5[_0x57446d][_0x46b5('0x20')];_0x5c06cd+=0x1){switch(_0x57446d){case 0x0:joinOrLeaveQueues(_0x12d610,_0x8105c1,_0x46b5('0x47'),_0x5526c5[_0x57446d][_0x5c06cd]);break;case 0x1:joinOrLeaveQueues(_0x12d610,_0x8105c1,_0x46b5('0x48'),_0x5526c5[_0x57446d][_0x5c06cd]);break;case 0x2:joinOrLeaveQueues(_0x12d610,_0x8105c1,_0x46b5('0x49'),_0x5526c5[_0x57446d][_0x5c06cd]);break;case 0x3:joinOrLeaveQueues(_0x12d610,_0x8105c1,_0x46b5('0x4a'),_0x5526c5[_0x57446d][_0x5c06cd]);break;case 0x4:joinOrLeaveQueues(_0x12d610,_0x8105c1,_0x46b5('0x4b'),_0x5526c5[_0x57446d][_0x5c06cd]);break;case 0x5:joinOrLeaveQueues(_0x12d610,_0x8105c1,_0x46b5('0x4c'),_0x5526c5[_0x57446d][_0x5c06cd]);break;case 0x6:joinOrLeaveQueues(_0x12d610,_0x8105c1,_0x46b5('0x4d'),_0x5526c5[_0x57446d][_0x5c06cd]);break;case 0x7:_0x12d610[_0x8105c1](util[_0x46b5('0x1e')](_0x46b5('0x4e'),_0x5526c5[_0x57446d][_0x5c06cd][_0x46b5('0x4')]));break;case 0x8:_0x12d610[_0x8105c1](util[_0x46b5('0x1e')](_0x46b5('0x4f'),_0x5526c5[_0x57446d][_0x5c06cd][_0x46b5('0x4')]));break;case 0x9:_0x12d610[_0x8105c1](util[_0x46b5('0x1e')]('campaign:%s:%s',_0x5526c5[_0x57446d][_0x5c06cd][_0x46b5('0xa')],_0x5526c5[_0x57446d][_0x5c06cd]['name']));break;case 0xa:_0x12d610[_0x8105c1](util['format']('user:%s',_0x5526c5[_0x57446d][_0x5c06cd][_0x46b5('0x4')]));break;}}}}})[_0x46b5('0xe')](function(){if(_0x8105c1===_0x46b5('0x50')){var _0x3776d9=_[_0x46b5('0x1c')](_0x543f9c[_0x46b5('0x26')],'id');return _0x543f9c[_0x46b5('0x51')](_0x3776d9)[_0x46b5('0xe')](function(){for(var _0x4abf35=0x0;_0x4abf35<_0x3776d9[_0x46b5('0x20')];_0x4abf35+=0x1){_0x20c695['emit'](_0x46b5('0x52'),{'ChatInteractionId':Number(_0x3776d9[_0x4abf35]),'UserId':Number(_0x543f9c['id'])});}});}})['then'](function(){if(_0x8105c1===_0x46b5('0x50')){var _0x5cabb7=_[_0x46b5('0x1c')](_0x543f9c[_0x46b5('0x53')],'id');return _0x543f9c[_0x46b5('0x54')](_0x5cabb7)['then'](function(){for(var _0x4676f9=0x0;_0x4676f9<_0x5cabb7['length'];_0x4676f9+=0x1){_0x20c695[_0x46b5('0x55')](_0x46b5('0x56'),{'MailInteractionId':Number(_0x5cabb7[_0x4676f9]),'UserId':Number(_0x543f9c['id'])});}});}})['then'](function(){if(_0x8105c1===_0x46b5('0x50')){var _0x239d0e=_[_0x46b5('0x1c')](_0x543f9c[_0x46b5('0x57')],'id');return _0x543f9c['removeFaxInteractions'](_0x239d0e)[_0x46b5('0xe')](function(){for(var _0x578e32=0x0;_0x578e32<_0x239d0e[_0x46b5('0x20')];_0x578e32+=0x1){_0x20c695[_0x46b5('0x55')](_0x46b5('0x58'),{'FaxInteractionId':Number(_0x239d0e[_0x578e32]),'UserId':Number(_0x543f9c['id'])});}});}})[_0x46b5('0xe')](function(){if(_0x8105c1==='leave'){var _0x2791e8=_['map'](_0x543f9c[_0x46b5('0x2a')],'id');return _0x543f9c[_0x46b5('0x59')](_0x2791e8)[_0x46b5('0xe')](function(){for(var _0x2f40a5=0x0;_0x2f40a5<_0x2791e8[_0x46b5('0x20')];_0x2f40a5+=0x1){_0x20c695[_0x46b5('0x55')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x2791e8[_0x2f40a5]),'UserId':Number(_0x543f9c['id'])});}});}})['then'](function(){if(_0x8105c1==='leave'){var _0x28fe3a=_['map'](_0x543f9c[_0x46b5('0x2b')],'id');return _0x543f9c['removeOpenchannelInteractions'](_0x28fe3a)[_0x46b5('0xe')](function(){for(var _0x4a4daf=0x0;_0x4a4daf<_0x28fe3a[_0x46b5('0x20')];_0x4a4daf+=0x1){_0x20c695[_0x46b5('0x55')](_0x46b5('0x5a'),{'OpenchannelInteractionId':Number(_0x28fe3a[_0x4a4daf]),'UserId':Number(_0x543f9c['id'])});}});}})[_0x46b5('0xe')](function(){if(_0x8105c1===_0x46b5('0x50')){var _0x41a0fc=_[_0x46b5('0x1c')](_0x543f9c[_0x46b5('0x2c')],'id');return _0x543f9c[_0x46b5('0x5b')](_0x41a0fc)[_0x46b5('0xe')](function(){for(var _0x44656b=0x0;_0x44656b<_0x41a0fc[_0x46b5('0x20')];_0x44656b+=0x1){_0x20c695[_0x46b5('0x55')](_0x46b5('0x5c'),{'WhatsappInteractionId':Number(_0x41a0fc[_0x44656b]),'UserId':Number(_0x543f9c['id'])});}});}})[_0x46b5('0x5d')](function(_0x3df4dc){_0x12d610[_0x46b5('0x5e')](_0x3df4dc);});}}function onDisconnect(_0x4ccb32,_0x2821db){joinOrLeave(_0x4ccb32,'leave',_0x2821db);}function onConnect(_0x251770){joinOrLeave(_0x251770,'join');}exports[_0x46b5('0x5f')]=function(_0x2cc3f3){_0x2cc3f3['on'](_0x46b5('0x60'),function(_0x944b80){_0x944b80[_0x46b5('0x61')](0x0);_0x944b80[_0x46b5('0x62')]=_0x944b80[_0x46b5('0x63')][_0x46b5('0x60')]['remoteAddress']+':'+_0x944b80[_0x46b5('0x63')][_0x46b5('0x60')][_0x46b5('0x64')];_0x944b80[_0x46b5('0x65')]=new Date();_0x944b80[_0x46b5('0x5e')]=function(_0x30118c){console['log'](_0x46b5('0x66')+_0x944b80[_0x46b5('0x67')]['name']+'['+_0x944b80['address']+']',_0x30118c);};_0x944b80['on'](_0x46b5('0x68'),function(){onDisconnect(_0x944b80,_0x2cc3f3);_0x944b80[_0x46b5('0x5e')](_0x46b5('0x69'));});onConnect(_0x944b80);_0x944b80[_0x46b5('0x5e')](_0x46b5('0x6a'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index c53f10c..0fbc95a 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 _0x7e7f=['catch','get','channel','event','UserId','User','name','outgoingmessage','closed','find','interface','format','SIP/%s','default','length','hasOwnProperty','model','hook','callback','toLowerCase','../../mysqldb','jayson/promise','triggers','client','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','closedinteraction','ChatMessage','newmessage','Sms','SmsInteraction','SmsMessage','WhatsappInteraction','Whatsapp','FaxInteraction','Fax','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','error','code','Trigger,\x20%s'];(function(_0x208505,_0x241a77){var _0x1a985f=function(_0x4a5110){while(--_0x4a5110){_0x208505['push'](_0x208505['shift']());}};_0x1a985f(++_0x241a77);}(_0x7e7f,0x152));var _0xf7e7=function(_0x360b48,_0x4915e7){_0x360b48=_0x360b48-0x0;var _0x5bacbb=_0x7e7f[_0x360b48];return _0x5bacbb;};'use strict';var util=require('util');var db=require(_0xf7e7('0x0'))['db'];var jayson=require(_0xf7e7('0x1'));var logger=require('../logger')(_0xf7e7('0x2'));var client=jayson[_0xf7e7('0x3')]['http']({'port':0x232a});var triggers=[{'channel':_0xf7e7('0x4'),'model':_0xf7e7('0x5'),'event':_0xf7e7('0x6'),'condition':_0xf7e7('0x7'),'callback':afterCreate},{'channel':_0xf7e7('0x4'),'model':_0xf7e7('0x5'),'event':_0xf7e7('0x8'),'condition':_0xf7e7('0x9'),'callback':afterUpdate},{'channel':'Chat','model':_0xf7e7('0xa'),'event':_0xf7e7('0x6'),'condition':_0xf7e7('0xb'),'callback':afterCreateMessage},{'channel':_0xf7e7('0xc'),'model':'SmsInteraction','event':_0xf7e7('0x6'),'condition':_0xf7e7('0x7'),'callback':afterCreate},{'channel':'Sms','model':_0xf7e7('0xd'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0xf7e7('0xc'),'model':_0xf7e7('0xe'),'event':_0xf7e7('0x6'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Whatsapp','model':_0xf7e7('0xf'),'event':'afterCreate','condition':_0xf7e7('0x7'),'callback':afterCreate},{'channel':_0xf7e7('0x10'),'model':_0xf7e7('0xf'),'event':_0xf7e7('0x8'),'condition':_0xf7e7('0x9'),'callback':afterUpdate},{'channel':_0xf7e7('0x10'),'model':'WhatsappMessage','event':_0xf7e7('0x6'),'condition':_0xf7e7('0xb'),'callback':afterCreateMessage},{'channel':'Fax','model':_0xf7e7('0x11'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0xf7e7('0x12'),'model':_0xf7e7('0x11'),'event':'afterUpdate','condition':_0xf7e7('0x9'),'callback':afterUpdate},{'channel':_0xf7e7('0x12'),'model':_0xf7e7('0x13'),'event':_0xf7e7('0x6'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xf7e7('0x14'),'model':_0xf7e7('0x15'),'event':_0xf7e7('0x6'),'condition':_0xf7e7('0x7'),'callback':afterCreate},{'channel':_0xf7e7('0x14'),'model':_0xf7e7('0x15'),'event':_0xf7e7('0x8'),'condition':_0xf7e7('0x9'),'callback':afterUpdate},{'channel':_0xf7e7('0x14'),'model':_0xf7e7('0x16'),'event':_0xf7e7('0x6'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xf7e7('0x17'),'model':_0xf7e7('0x18'),'event':_0xf7e7('0x6'),'condition':_0xf7e7('0x7'),'callback':afterCreate},{'channel':_0xf7e7('0x17'),'model':_0xf7e7('0x18'),'event':_0xf7e7('0x8'),'condition':_0xf7e7('0x9'),'callback':afterUpdate},{'channel':_0xf7e7('0x17'),'model':_0xf7e7('0x19'),'event':_0xf7e7('0x6'),'condition':_0xf7e7('0xb'),'callback':afterCreateMessage}];function request(_0x125cd8){return client[_0xf7e7('0x1a')](_0xf7e7('0x1b'),_0x125cd8)[_0xf7e7('0x1c')](function(_0x4678c5){logger[_0xf7e7('0x1d')]('Trigger,\x20%s','EventManager',_0x4678c5);if(_0x4678c5['error']){if(_0x4678c5[_0xf7e7('0x1e')][_0xf7e7('0x1f')]===0x1f4){logger[_0xf7e7('0x1e')](_0xf7e7('0x20'),_0xf7e7('0x1b'),_0x4678c5[_0xf7e7('0x1e')]);}}})[_0xf7e7('0x21')](function(_0x3c9dc6){logger['error'](_0xf7e7('0x20'),_0xf7e7('0x1b'),_0x3c9dc6);});}function afterCreateMessage(_0x3eba5d,_0xe13dbd){return function(_0x136084,_0x2dfd1c){_0x136084=_0x136084[_0xf7e7('0x22')]({'plain':!![]});_0x136084[_0xf7e7('0x23')]=_0x3eba5d;_0x136084[_0xf7e7('0x24')]=_0x136084['direction'];if(_0x136084[_0xf7e7('0x25')]){return db[_0xf7e7('0x26')]['find']({'where':{'id':_0x136084['UserId']},'attributes':['id','name'],'raw':!![]})[_0xf7e7('0x1c')](function(_0x5b1778){_0x136084['interface']=util['format']('SIP/%s',_0x5b1778[_0xf7e7('0x27')]);_0x136084[_0xf7e7('0x23')]=_0x3eba5d;return request({'event':'incomingmessage','message':_0x136084});})[_0xf7e7('0x21')](function(_0x35c9b0){console[_0xf7e7('0x1e')](_0x35c9b0);});}else{return request({'event':_0xf7e7('0x28'),'message':_0x136084});}};}function afterCreate(_0x2bad99,_0x18c91c){return function(_0x319e95,_0x536a09){_0x319e95=_0x319e95[_0xf7e7('0x22')]({'plain':!![]});_0x319e95['channel']=_0x2bad99;_0x319e95[_0xf7e7('0x24')]='opened';return request({'event':_0x18c91c,'message':_0x319e95});};}function afterUpdate(_0xc94cac,_0x5cd2b9){return function(_0x437051,_0x357a11){if(_0x437051['changed'](_0xf7e7('0x29'))&&_0x437051['closed']){_0x437051=_0x437051['get']({'plain':!![]});_0x437051['channel']=_0xc94cac;_0x437051[_0xf7e7('0x24')]=_0xf7e7('0x29');if(_0x437051['UserId']){return db['User'][_0xf7e7('0x2a')]({'where':{'id':_0x437051[_0xf7e7('0x25')]},'attributes':['id',_0xf7e7('0x27')],'raw':!![]})[_0xf7e7('0x1c')](function(_0x34b525){_0x437051[_0xf7e7('0x2b')]=util[_0xf7e7('0x2c')](_0xf7e7('0x2d'),_0x34b525[_0xf7e7('0x27')]);return request({'event':_0x5cd2b9,'message':_0x437051});})['catch'](function(_0x283281){console[_0xf7e7('0x1e')](_0x283281);});}else{return request({'event':_0x5cd2b9,'message':_0x437051});}}};}exports[_0xf7e7('0x2e')]=function(){for(var _0xe6f150=0x0;_0xe6f150=_0x272089[_0x9966('0x17')]){throw Error(_0x9966('0x18'));}_0x490426(_0x5d9f44);})[_0x9966('0x19')](function(_0x5a9c33){_0x28dbb0(_0x5a9c33);});});}; \ No newline at end of file +var _0xfea5=['updateAttributes','getLicense','role','count','agent','then','agents','lodash','bluebird','../mysqldb','voice','mail','fax','sms','openchannel','getChannels','isValidChannel','toLowerCase','includes','clearBlockUser','isUndefined'];(function(_0x2199aa,_0x720129){var _0xad777b=function(_0x5e449d){while(--_0x5e449d){_0x2199aa['push'](_0x2199aa['shift']());}};_0xad777b(++_0x720129);}(_0xfea5,0x1c0));var _0x5fea=function(_0x4dcc9a,_0x1d9053){_0x4dcc9a=_0x4dcc9a-0x0;var _0x43ed7f=_0xfea5[_0x4dcc9a];return _0x43ed7f;};'use strict';var _=require(_0x5fea('0x0'));var BPromise=require(_0x5fea('0x1'));var db=require(_0x5fea('0x2'))['db'];var util=require('./license/util');var channels=[_0x5fea('0x3'),_0x5fea('0x4'),'chat',_0x5fea('0x5'),_0x5fea('0x6'),'whatsapp',_0x5fea('0x7')];exports[_0x5fea('0x8')]=function(){return channels;};exports[_0x5fea('0x9')]=function(_0x1206c4){_0x1206c4=_0x1206c4[_0x5fea('0xa')]();return _[_0x5fea('0xb')](channels,_0x1206c4);};exports[_0x5fea('0xc')]=function(_0x278360,_0x15192e,_0x5e0166,_0x27c5f2){var _0x1a15f1={'loginAttempts':_0x15192e,'blocked':_0x5e0166};if(!_[_0x5fea('0xd')](_0x27c5f2)){_0x1a15f1['blockedAt']=_0x27c5f2;}return _0x278360[_0x5fea('0xe')](_0x1a15f1);};exports[_0x5fea('0xf')]=function(_0x36a80c){return new BPromise(function(_0x5aae6a,_0x19e3f2){var _0x21a89a=0x0;if(_0x36a80c[_0x5fea('0x10')]!=='agent'){_0x5aae6a(_0x36a80c);}db['User'][_0x5fea('0x11')]({'where':{'role':_0x5fea('0x12'),'online':!![],'id':{'$ne':_0x36a80c['id']}}})[_0x5fea('0x13')](function(_0x2f474f){_0x21a89a=_0x2f474f;return util[_0x5fea('0xf')]();})['then'](function(_0x42749a){if(_0x42749a&&_0x42749a['agents']&&_0x21a89a>=_0x42749a[_0x5fea('0x14')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x5aae6a(_0x36a80c);})['catch'](function(_0x3d366f){_0x19e3f2(_0x3d366f);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 4beb159..387123e 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4e8=['404','status','json','send','exports'];(function(_0x376aab,_0xcecd14){var _0x10881d=function(_0x2bd590){while(--_0x2bd590){_0x376aab['push'](_0x376aab['shift']());}};_0x10881d(++_0xcecd14);}(_0xf4e8,0x1d5));var _0x8f4e=function(_0x465371,_0xc830d0){_0x465371=_0x465371-0x0;var _0x3bfb77=_0xf4e8[_0x465371];return _0x3bfb77;};'use strict';module[_0x8f4e('0x0')][0x194]=function pageNotFound(_0x35cded,_0x1e3aed){var _0x2168e5=_0x8f4e('0x1');var _0x57474c=0x194;var _0x944276={'status':_0x57474c};_0x1e3aed['status'](_0x944276[_0x8f4e('0x2')]);_0x1e3aed['render'](_0x2168e5,{},function(_0x447e51,_0x51076b){if(_0x447e51){return _0x1e3aed['status'](_0x944276[_0x8f4e('0x2')])[_0x8f4e('0x3')](_0x944276);}_0x1e3aed[_0x8f4e('0x4')](_0x51076b);});}; \ No newline at end of file +var _0xf19b=['json','send','exports','status','render'];(function(_0x4bac97,_0x38b81f){var _0x21a18f=function(_0x2f40f4){while(--_0x2f40f4){_0x4bac97['push'](_0x4bac97['shift']());}};_0x21a18f(++_0x38b81f);}(_0xf19b,0x84));var _0xbf19=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xf19b[_0x297fd3];return _0x2af381;};'use strict';module[_0xbf19('0x0')][0x194]=function pageNotFound(_0x304f2a,_0x311979){var _0x3f83a7='404';var _0x4f7acb=0x194;var _0x27d60a={'status':_0x4f7acb};_0x311979[_0xbf19('0x1')](_0x27d60a[_0xbf19('0x1')]);_0x311979[_0xbf19('0x2')](_0x3f83a7,{},function(_0x1cd940,_0x3a1a16){if(_0x1cd940){return _0x311979[_0xbf19('0x1')](_0x27d60a['status'])[_0xbf19('0x3')](_0x27d60a);}_0x311979[_0xbf19('0x4')](_0x3a1a16);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 980095c..974daf2 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3663=['../api/user/user.model','VoiceChanSpy','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMail','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','Action','CannedAnswer','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','ZohoConfiguration','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','Network','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/notification/notification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','hasOne','cascade','UserId','hasMany','Recordings','VoiceQueuesRt','VoiceExtension','Extensions','HopperFinals','HopperHistory','ReportAgentPreview','OpenchannelInteractions','ChatInteractions','SmsInteractions','MailInteractions','WhatsappInteraction','Notifications','SenderId','belongsTo','belongsToMany','Groups','chat_group_has_users','Contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_sms_interactions','user_has_whatsapp_interactions','UserVoiceQueue','MailQueues','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','UserSmsQueue','OpenchannelQueues','WhatsappQueues','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProject','SquareProjects','user_has_square_projects','SpiedAgents','Applications','moh_has_sounds','Members','VoiceQueueId','HopperBlacks','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','voice_queues_has_cm_lists','Agents','Teams','team_has_voice_queues','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','ContactId','MailAccount','MailAccountId','Disposition','Answers','Interactions','List','ListId','mandatoryDispositionPauseId','MailInteractionId','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','Interaction','Account','restrict','TagId','MailQueueReport','Items','Dispositions','FaxAccountId','Exntensions','FaxQueue','FaxInteractionId','fax_interaction_has_tags','user_has_fax_interactions','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','AttachmentId','team_has_openchannel_queues','ChatWebsiteId','ChatProactiveAction','ProactiveActions','ChatApplication','Agent','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','team_has_chat_queues','ChatGroupId','CompanyId','Hoppers','cm_user_has_contacts','cm_contact_has_tags','Queue','OwnerId','CampaignId','Automation','All','AutomationAllId','OneAny','AutomationAnyId','Actions','AutomationId','MailApplications','ChatApplications','FaxApplications','AnalyticDefaultReport','DefaultReportId','Mohs','whatsapp_interaction_has_tags','TriggerAllId','AnyConditions','AnyCondition','TriggerId','Fields','AnalyticMetric','MetricId','Configurations','Subjects','SubjectId','SalesforceConfiguration','Descriptions','DescriptionId','AccountId','Description','Field','FieldId','VariableId','DeskConfiguration','DeskAccount','int_desk_configuration_has_tags','ZohoField','Subject','int_zendesk_configuration_has_tags','FreshdeskField','VtigerField','ServicenowAccount','Dynamics365Configuration','FreshsalesField','ToId','SessionId','ProjectId','VoiceQueues','team_has_mail_queues','team_has_fax_queues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','BlackLists','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToAgent','ToChatQueueId','ToChatWebsiteId','FromUserId','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','Queues','userProfileId','UserProfileSection','UserProfileSections','sectionId','WhatsappAccountId','WhatsappMessage','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','path','../config/environment','sequelize','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','mysql','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','127.0.0.1','name','username','password','options','User'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0x3663,0x1cf));var _0x3366=function(_0x4dfc30,_0x2f8ea3){_0x4dfc30=_0x4dfc30-0x0;var _0x4cabbe=_0x3663[_0x4dfc30];return _0x4cabbe;};'use strict';var path=require(_0x3366('0x0'));var config=require(_0x3366('0x1'));var Sequelize=require(_0x3366('0x2'));var _=require('lodash');var jstz=require(_0x3366('0x3'));var timezone=jstz[_0x3366('0x4')]();config['sequelize']=_[_0x3366('0x5')](config[_0x3366('0x2')],{'database':_0x3366('0x6'),'username':_0x3366('0x7'),'password':_0x3366('0x8'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x3366('0x9'),'dialectOptions':{'charset':_0x3366('0xa')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x3366('0xb'),'collate':_0x3366('0xc')}}});config[_0x3366('0xd')]=_['defaultsDeep'](config[_0x3366('0xd')],{'database':_0x3366('0x6'),'username':_0x3366('0x7'),'password':'xC@LL1234','options':{'host':_0x3366('0xe'),'port':0xcea,'dialect':_0x3366('0x9'),'dialectOptions':{'charset':_0x3366('0xa')},'logging':![],'timezone':timezone[_0x3366('0xf')](),'define':{'charset':_0x3366('0xb'),'collate':_0x3366('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x3366('0x2')]['database'],config['sequelize'][_0x3366('0x10')],config[_0x3366('0x2')][_0x3366('0x11')],config[_0x3366('0x2')][_0x3366('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x3366('0xd')]['database'],config['sequelizeHistory'][_0x3366('0x10')],config['sequelizeHistory'][_0x3366('0x11')],config[_0x3366('0xd')][_0x3366('0x12')])};db[_0x3366('0x13')]=db[_0x3366('0x2')]['import'](_0x3366('0x14'));db[_0x3366('0x15')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0x17'));db[_0x3366('0x18')]=db['sequelize']['import'](_0x3366('0x19'));db['VoiceExtension']=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0x1a'));db[_0x3366('0x1b')]=db[_0x3366('0x2')][_0x3366('0x16')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x3366('0x1c')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0x1d'));db[_0x3366('0x1e')]=db['sequelize']['import'](_0x3366('0x1f'));db[_0x3366('0x20')]=db[_0x3366('0x2')]['import']('../api/screenRecording/screenRecording.model');db[_0x3366('0x21')]=db[_0x3366('0x2')][_0x3366('0x16')]('../api/voiceMail/voiceMail.model');db[_0x3366('0x22')]=db['sequelize'][_0x3366('0x16')](_0x3366('0x23'));db[_0x3366('0x24')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0x25'));db[_0x3366('0x26')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0x27'));db['VoiceAgentReport']=db[_0x3366('0x2')][_0x3366('0x16')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x3366('0x28')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0x29'));db[_0x3366('0x2a')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0x2b'));db[_0x3366('0x2c')]=db[_0x3366('0x2')][_0x3366('0x16')]('../api/trunk/trunk.model');db['VoiceTransferReport']=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0x2d'));db[_0x3366('0x2e')]=db['sequelize'][_0x3366('0x16')](_0x3366('0x2f'));db['UserVoiceQueue']=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0x30'));db['UserChatQueue']=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0x31'));db['UserMailQueue']=db[_0x3366('0x2')]['import'](_0x3366('0x32'));db[_0x3366('0x33')]=db[_0x3366('0x2')][_0x3366('0x16')]('../api/userFaxQueue/userFaxQueue.model');db['UserSmsQueue']=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0x34'));db[_0x3366('0x35')]=db[_0x3366('0x2')]['import'](_0x3366('0x36'));db[_0x3366('0x37')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0x38'));db[_0x3366('0x39')]=db[_0x3366('0x2')]['import'](_0x3366('0x3a'));db[_0x3366('0x3b')]=db['sequelize'][_0x3366('0x16')](_0x3366('0x3c'));db['MailAccount']=db['sequelize'][_0x3366('0x16')](_0x3366('0x3d'));db[_0x3366('0x3e')]=db[_0x3366('0x2')]['import']('../api/mailQueue/mailQueue.model');db[_0x3366('0x3f')]=db[_0x3366('0x2')][_0x3366('0x16')]('../api/mailSubstatus/mailSubstatus.model');db[_0x3366('0x40')]=db[_0x3366('0x2')]['import'](_0x3366('0x41'));db[_0x3366('0x42')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0x43'));db[_0x3366('0x44')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0x45'));db['MailQueueReport']=db[_0x3366('0x2')]['import']('../api/mailQueueReport/mailQueueReport.model');db[_0x3366('0x46')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0x47'));db[_0x3366('0x48')]=db['sequelize']['import']('../api/dashboardItem/dashboardItem.model');db[_0x3366('0x49')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0x4a'));db[_0x3366('0x4b')]=db['sequelize'][_0x3366('0x16')](_0x3366('0x4c'));db[_0x3366('0x4d')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0x4e'));db[_0x3366('0x4f')]=db[_0x3366('0x2')][_0x3366('0x16')]('../api/faxMessage/faxMessage.model');db['FaxQueue']=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0x50'));db[_0x3366('0x51')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0x52'));db[_0x3366('0x53')]=db[_0x3366('0x2')][_0x3366('0x16')]('../api/smsAccount/smsAccount.model');db[_0x3366('0x54')]=db[_0x3366('0x2')][_0x3366('0x16')]('../api/smsApplication/smsApplication.model');db[_0x3366('0x55')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0x56'));db[_0x3366('0x57')]=db[_0x3366('0x2')]['import'](_0x3366('0x58'));db[_0x3366('0x59')]=db[_0x3366('0x2')][_0x3366('0x16')]('../api/smsQueue/smsQueue.model');db['OpenchannelAccount']=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0x5a'));db['OpenchannelApplication']=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0x5b'));db[_0x3366('0x5c')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0x5d'));db[_0x3366('0x5e')]=db[_0x3366('0x2')]['import'](_0x3366('0x5f'));db[_0x3366('0x60')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0x61'));db[_0x3366('0x62')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0x63'));db[_0x3366('0x64')]=db['sequelize'][_0x3366('0x16')]('../api/openchannelQueueReport/openchannelQueueReport.model');db['ChatApplication']=db['sequelize']['import'](_0x3366('0x65'));db[_0x3366('0x66')]=db['sequelize'][_0x3366('0x16')](_0x3366('0x67'));db[_0x3366('0x68')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0x69'));db[_0x3366('0x6a')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0x6b'));db[_0x3366('0x6c')]=db[_0x3366('0x2')]['import']('../api/chatQueue/chatQueue.model');db[_0x3366('0x6d')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0x6e'));db['ChatProactiveAction']=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0x6f'));db[_0x3366('0x70')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0x71'));db[_0x3366('0x72')]=db[_0x3366('0x2')]['import'](_0x3366('0x73'));db[_0x3366('0x74')]=db[_0x3366('0x2')]['import'](_0x3366('0x75'));db[_0x3366('0x76')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0x77'));db[_0x3366('0x78')]=db[_0x3366('0x2')][_0x3366('0x16')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0x3366('0x79')]=db['sequelize']['import'](_0x3366('0x7a'));db['ReportAgentPreview']=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0x7b'));db['CmCustomField']=db['sequelize'][_0x3366('0x16')](_0x3366('0x7c'));db[_0x3366('0x7d')]=db['sequelize'][_0x3366('0x16')]('../api/action/action.model');db['Automation']=db['sequelize'][_0x3366('0x16')]('../api/automation/automation.model');db[_0x3366('0x7e')]=db[_0x3366('0x2')][_0x3366('0x16')]('../api/cannedAnswer/cannedAnswer.model');db['Disposition']=db['sequelize'][_0x3366('0x16')]('../api/disposition/disposition.model');db[_0x3366('0x7f')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0x80'));db[_0x3366('0x81')]=db[_0x3366('0x2')]['import'](_0x3366('0x82'));db[_0x3366('0x83')]=db['sequelize'][_0x3366('0x16')](_0x3366('0x84'));db[_0x3366('0x85')]=db[_0x3366('0x2')][_0x3366('0x16')]('../api/cdr/cdr.model');db[_0x3366('0x86')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0x87'));db[_0x3366('0x88')]=db[_0x3366('0x2')][_0x3366('0x16')]('../api/schedule/schedule.model');db[_0x3366('0x89')]=db['sequelize'][_0x3366('0x16')](_0x3366('0x8a'));db[_0x3366('0x8b')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0x8c'));db[_0x3366('0x8d')]=db['sequelize'][_0x3366('0x16')](_0x3366('0x8e'));db[_0x3366('0x8f')]=db[_0x3366('0x2')]['import']('../api/trigger/trigger.model');db[_0x3366('0x90')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0x91'));db[_0x3366('0x92')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0x93'));db['IntegrationReport']=db['sequelize'][_0x3366('0x16')](_0x3366('0x94'));db[_0x3366('0x95')]=db['sequelize']['import'](_0x3366('0x96'));db['AnalyticDefaultReport']=db[_0x3366('0x2')]['import'](_0x3366('0x97'));db[_0x3366('0x98')]=db[_0x3366('0x2')][_0x3366('0x16')]('../api/analyticExtractedReport/analyticExtractedReport.model');db['AnalyticMetric']=db['sequelize']['import'](_0x3366('0x99'));db[_0x3366('0x9a')]=db[_0x3366('0x2')][_0x3366('0x16')]('../api/analyticFieldReport/analyticFieldReport.model');db['AnalyticTreeReport']=db[_0x3366('0x2')][_0x3366('0x16')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0x3366('0x9b')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0x9c'));db['SalesforceConfiguration']=db['sequelize'][_0x3366('0x16')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0x3366('0x9d')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0x9e'));db[_0x3366('0x9f')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0xa0'));db[_0x3366('0xa1')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0xa2'));db[_0x3366('0xa3')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0xa4'));db['DeskAccount']=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0xa5'));db['DeskConfiguration']=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0xa6'));db[_0x3366('0xa7')]=db[_0x3366('0x2')]['import']('../api/intDeskField/intDeskField.model');db[_0x3366('0xa8')]=db[_0x3366('0x2')][_0x3366('0x16')]('../api/intZohoAccount/intZohoAccount.model');db[_0x3366('0xa9')]=db['sequelize'][_0x3366('0x16')]('../api/intZohoConfiguration/intZohoConfiguration.model');db['ZohoField']=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0xaa'));db[_0x3366('0xab')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0xac'));db[_0x3366('0xad')]=db[_0x3366('0x2')][_0x3366('0x16')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x3366('0xae')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0xaf'));db[_0x3366('0xb0')]=db[_0x3366('0x2')][_0x3366('0x16')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x3366('0xb1')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0xb2'));db['FreshdeskField']=db[_0x3366('0x2')][_0x3366('0x16')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0x3366('0xb3')]=db['sequelize']['import']('../api/intVtigerAccount/intVtigerAccount.model');db[_0x3366('0xb4')]=db['sequelize'][_0x3366('0x16')](_0x3366('0xb5'));db['VtigerField']=db[_0x3366('0x2')]['import'](_0x3366('0xb6'));db['ServicenowAccount']=db[_0x3366('0x2')]['import'](_0x3366('0xb7'));db[_0x3366('0xb8')]=db['sequelize'][_0x3366('0x16')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x3366('0xb9')]=db['sequelize'][_0x3366('0x16')](_0x3366('0xba'));db[_0x3366('0xbb')]=db[_0x3366('0x2')][_0x3366('0x16')]('../api/intDynamics365Account/intDynamics365Account.model');db['Dynamics365Configuration']=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0xbc'));db[_0x3366('0xbd')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0xbe'));db[_0x3366('0xbf')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0xc0'));db[_0x3366('0xc1')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0xc2'));db['FreshsalesField']=db[_0x3366('0x2')][_0x3366('0x16')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0x3366('0x92')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0x93'));db[_0x3366('0xc3')]=db[_0x3366('0x2')][_0x3366('0x16')]('../api/network/network.model');db[_0x3366('0xc4')]=db[_0x3366('0x2')]['import'](_0x3366('0xc5'));db[_0x3366('0xc6')]=db['sequelize'][_0x3366('0x16')](_0x3366('0xc7'));db[_0x3366('0xc8')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0xc9'));db[_0x3366('0xca')]=db[_0x3366('0x2')][_0x3366('0x16')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0x3366('0xcb')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0xcc'));db[_0x3366('0xcd')]=db[_0x3366('0x2')]['import'](_0x3366('0xce'));db[_0x3366('0xcf')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0xd0'));db[_0x3366('0xd1')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0xd2'));db['JscriptyProject']=db[_0x3366('0x2')][_0x3366('0x16')]('../api/jscriptyProject/jscriptyProject.model');db[_0x3366('0xd3')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0xd4'));db[_0x3366('0xd5')]=db['sequelize'][_0x3366('0x16')](_0x3366('0xd6'));db['SquareProject']=db['sequelize'][_0x3366('0x16')]('../api/squareProject/squareProject.model');db[_0x3366('0xd7')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0xd8'));db[_0x3366('0xd9')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0xda'));db[_0x3366('0xdb')]=db[_0x3366('0x2')][_0x3366('0x16')]('../api/team/team.model');db['License']=db[_0x3366('0x2')][_0x3366('0x16')]('../api/license/license.model');db[_0x3366('0xdc')]=db['sequelize'][_0x3366('0x16')](_0x3366('0xdd'));db[_0x3366('0xde')]=db[_0x3366('0x2')]['import'](_0x3366('0xdf'));db[_0x3366('0xe0')]=db[_0x3366('0x2')]['import']('../api/attachment/attachment.model');db[_0x3366('0xe1')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0xe2'));db[_0x3366('0xe3')]=db[_0x3366('0x2')]['import'](_0x3366('0xe4'));db[_0x3366('0xe5')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0xe6'));db[_0x3366('0xe7')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0xe8'));db['OpenchannelTransferReport']=db['sequelize'][_0x3366('0x16')](_0x3366('0xe9'));db['SmsTransferReport']=db[_0x3366('0x2')][_0x3366('0x16')]('../api/smsTransferReport/smsTransferReport.model');db[_0x3366('0xea')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0xeb'));db[_0x3366('0xec')]=db['sequelize'][_0x3366('0x16')](_0x3366('0xed'));db[_0x3366('0xee')]=db['sequelize'][_0x3366('0x16')](_0x3366('0xef'));db['UserProfileSection']=db[_0x3366('0x2')]['import'](_0x3366('0xf0'));db[_0x3366('0xf1')]=db[_0x3366('0x2')][_0x3366('0x16')]('../api/userProfileResource/userProfileResource.model');db['Notification']=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0xf2'));db[_0x3366('0xf3')]=db['sequelize'][_0x3366('0x16')](_0x3366('0xf4'));db[_0x3366('0xf5')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0xf6'));db['WhatsappInteraction']=db[_0x3366('0x2')][_0x3366('0x16')]('../api/whatsappInteraction/whatsappInteraction.model');db['WhatsappMessage']=db[_0x3366('0x2')]['import'](_0x3366('0xf7'));db[_0x3366('0xf8')]=db['sequelize']['import'](_0x3366('0xf9'));db[_0x3366('0xfa')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0xfb'));db[_0x3366('0xfc')]=db[_0x3366('0x2')][_0x3366('0x16')](_0x3366('0xfd'));db['CloudProvider']=db[_0x3366('0x2')][_0x3366('0x16')]('../api/cloudProvider/cloudProvider.model');db[_0x3366('0x13')][_0x3366('0xfe')](db[_0x3366('0x21')],{'as':_0x3366('0x21'),'onDelete':_0x3366('0xff'),'foreignKey':_0x3366('0x100')});db[_0x3366('0x13')][_0x3366('0x101')](db[_0x3366('0x1e')],{'as':_0x3366('0x102'),'foreignKey':_0x3366('0x100')});db['User']['hasMany'](db[_0x3366('0x2e')],{'as':_0x3366('0x103'),'foreignKey':_0x3366('0x100')});db[_0x3366('0x13')][_0x3366('0x101')](db[_0x3366('0x104')],{'as':_0x3366('0x105'),'onDelete':_0x3366('0xff'),'hooks':!![]});db[_0x3366('0x13')][_0x3366('0x101')](db[_0x3366('0x78')],{'as':_0x3366('0x106'),'foreignKey':_0x3366('0x100')});db[_0x3366('0x13')][_0x3366('0x101')](db['CmHopperHistory'],{'as':_0x3366('0x107'),'foreignKey':_0x3366('0x100')});db[_0x3366('0x13')]['hasMany'](db[_0x3366('0x108')],{'as':'ReportAgentPreview','foreignKey':_0x3366('0x100')});db[_0x3366('0x13')][_0x3366('0x101')](db[_0x3366('0x5c')],{'as':_0x3366('0x109'),'foreignKey':_0x3366('0x100')});db[_0x3366('0x13')][_0x3366('0x101')](db[_0x3366('0x66')],{'as':_0x3366('0x10a'),'foreignKey':_0x3366('0x100')});db[_0x3366('0x13')][_0x3366('0x101')](db['SmsInteraction'],{'as':_0x3366('0x10b'),'foreignKey':'UserId'});db['User'][_0x3366('0x101')](db[_0x3366('0x4d')],{'as':'FaxInteractions','foreignKey':_0x3366('0x100')});db[_0x3366('0x13')][_0x3366('0x101')](db[_0x3366('0x40')],{'as':_0x3366('0x10c'),'foreignKey':'UserId'});db['User'][_0x3366('0x101')](db[_0x3366('0x10d')],{'as':'WhatsappInteractions','foreignKey':_0x3366('0x100')});db[_0x3366('0x13')][_0x3366('0x101')](db['Notification'],{'as':_0x3366('0x10e'),'foreignKey':_0x3366('0x10f')});db[_0x3366('0x13')][_0x3366('0x110')](db[_0x3366('0xee')],{'as':_0x3366('0xee'),'foreignKey':'userProfileId'});db['User'][_0x3366('0x111')](db[_0x3366('0x6d')],{'as':_0x3366('0x112'),'through':_0x3366('0x113')});db[_0x3366('0x13')]['belongsToMany'](db['CmContact'],{'as':_0x3366('0x114'),'through':'cm_user_has_contacts'});db[_0x3366('0x13')][_0x3366('0x111')](db[_0x3366('0xea')],{'as':_0x3366('0x115'),'through':_0x3366('0x116')});db[_0x3366('0x13')][_0x3366('0x111')](db[_0x3366('0xdb')],{'through':_0x3366('0x117')});db[_0x3366('0x13')][_0x3366('0x111')](db[_0x3366('0x40')],{'as':_0x3366('0x10c'),'through':_0x3366('0x118')});db[_0x3366('0x13')][_0x3366('0x111')](db[_0x3366('0x66')],{'as':_0x3366('0x10a'),'through':'user_has_chat_interactions'});db['User'][_0x3366('0x111')](db[_0x3366('0x4d')],{'as':_0x3366('0x119'),'through':'user_has_fax_interactions'});db[_0x3366('0x13')]['belongsToMany'](db[_0x3366('0x55')],{'as':_0x3366('0x10b'),'through':_0x3366('0x11a')});db[_0x3366('0x13')][_0x3366('0x111')](db['OpenchannelInteraction'],{'as':_0x3366('0x109'),'through':'user_has_openchannel_interactions'});db['User'][_0x3366('0x111')](db['WhatsappInteraction'],{'as':'WhatsappInteractions','through':_0x3366('0x11b')});db['User'][_0x3366('0x111')](db[_0x3366('0x1c')],{'as':'VoiceQueues','through':_0x3366('0x11c'),'required':![]});db[_0x3366('0x13')][_0x3366('0x111')](db['MailQueue'],{'as':_0x3366('0x11d'),'through':'UserMailQueue','required':![]});db[_0x3366('0x13')][_0x3366('0x111')](db['ChatQueue'],{'as':_0x3366('0x11e'),'through':_0x3366('0x11f'),'required':![],'hooks':!![]});db[_0x3366('0x13')][_0x3366('0x111')](db['FaxQueue'],{'as':_0x3366('0x120'),'through':'UserFaxQueue','required':![]});db[_0x3366('0x13')][_0x3366('0x111')](db['SmsQueue'],{'as':_0x3366('0x121'),'through':_0x3366('0x122'),'required':![]});db[_0x3366('0x13')][_0x3366('0x111')](db[_0x3366('0x60')],{'as':_0x3366('0x123'),'through':_0x3366('0x35'),'required':![]});db['User']['belongsToMany'](db[_0x3366('0xfc')],{'as':_0x3366('0x124'),'through':'UserWhatsappQueue','required':![]});db[_0x3366('0x13')][_0x3366('0x111')](db[_0x3366('0xea')],{'through':_0x3366('0x116')});db[_0x3366('0x13')][_0x3366('0x111')](db['VoicePrefix'],{'as':_0x3366('0x125'),'through':_0x3366('0x126'),'required':![]});db['User']['belongsToMany'](db[_0x3366('0x62')],{'as':_0x3366('0x127'),'through':_0x3366('0x128')});db['User'][_0x3366('0x111')](db[_0x3366('0x49')],{'as':_0x3366('0x129'),'through':_0x3366('0x12a')});db[_0x3366('0x13')]['belongsToMany'](db['MailAccount'],{'as':_0x3366('0x12b'),'through':_0x3366('0x12c')});db[_0x3366('0x13')][_0x3366('0x111')](db[_0x3366('0x12d')],{'as':_0x3366('0x12e'),'through':_0x3366('0x12f')});db[_0x3366('0x13')][_0x3366('0x111')](db[_0x3366('0x53')],{'as':_0x3366('0x130'),'through':_0x3366('0x131')});db[_0x3366('0x13')][_0x3366('0x111')](db[_0x3366('0xf3')],{'as':_0x3366('0x132'),'through':_0x3366('0x133')});db[_0x3366('0x13')]['belongsToMany'](db[_0x3366('0x134')],{'as':_0x3366('0x135'),'through':_0x3366('0x136')});db[_0x3366('0x15')][_0x3366('0x101')](db['VoiceExtension'],{'as':_0x3366('0x137'),'onDelete':_0x3366('0xff'),'foreignKey':'ChanSpyId'});db[_0x3366('0x18')]['hasMany'](db[_0x3366('0x104')],{'onDelete':_0x3366('0xff')});db[_0x3366('0x104')][_0x3366('0x101')](db[_0x3366('0x104')],{'as':_0x3366('0x138'),'onDelete':'cascade'});db[_0x3366('0x1b')][_0x3366('0x111')](db[_0x3366('0x89')],{'as':'Sounds','through':_0x3366('0x139')});db['VoiceQueue']['hasMany'](db[_0x3366('0x2e')],{'as':_0x3366('0x13a'),'foreignKey':_0x3366('0x13b')});db[_0x3366('0x1c')][_0x3366('0x101')](db[_0x3366('0x74')],{'as':'Hoppers','foreignKey':'VoiceQueueId'});db[_0x3366('0x1c')][_0x3366('0x101')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x3366('0x13b')});db['VoiceQueue']['hasMany'](db[_0x3366('0x79')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x3366('0x101')](db[_0x3366('0x108')],{'as':_0x3366('0x108'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x3366('0x101')](db[_0x3366('0x76')],{'as':_0x3366('0x13c'),'foreignKey':_0x3366('0x13b')});db[_0x3366('0x1c')][_0x3366('0x101')](db[_0x3366('0xcb')],{'as':'JscriptySessions','foreignKey':_0x3366('0x13b')});db[_0x3366('0x1c')][_0x3366('0x110')](db[_0x3366('0x2c')],{'as':_0x3366('0x2c'),'foreignKey':_0x3366('0x13d')});db[_0x3366('0x1c')][_0x3366('0x110')](db[_0x3366('0x2c')],{'as':_0x3366('0x13e'),'foreignKey':_0x3366('0x13f')});db[_0x3366('0x1c')]['belongsTo'](db[_0x3366('0x81')],{'as':_0x3366('0x81'),'foreignKey':_0x3366('0x140')});db['VoiceQueue'][_0x3366('0x110')](db[_0x3366('0x83')],{'as':_0x3366('0x141'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x3366('0x1c')]['belongsToMany'](db[_0x3366('0xea')],{'as':'Lists','through':_0x3366('0x142')});db[_0x3366('0x1c')][_0x3366('0x111')](db[_0x3366('0x13')],{'as':_0x3366('0x143'),'through':_0x3366('0x11c')});db[_0x3366('0x1c')][_0x3366('0x111')](db[_0x3366('0xdb')],{'as':_0x3366('0x144'),'through':_0x3366('0x145')});db[_0x3366('0x1c')]['belongsToMany'](db['CmList'],{'as':'BlackLists','through':_0x3366('0x146')});db[_0x3366('0x1e')][_0x3366('0x110')](db[_0x3366('0x13')],{'as':'User','foreignKey':'UserId'});db[_0x3366('0x20')]['belongsTo'](db[_0x3366('0x13')],{'as':'User','foreignKey':'UserId'});db[_0x3366('0x21')]['hasMany'](db['VoiceMailMessage'],{'as':_0x3366('0x147'),'onDelete':_0x3366('0xff'),'foreignKey':'mailboxuser','sourceKey':_0x3366('0x148')});db[_0x3366('0x22')][_0x3366('0x110')](db[_0x3366('0x21')],{'foreignKey':_0x3366('0x149'),'targetKey':'mailbox'});db[_0x3366('0x24')][_0x3366('0x101')](db[_0x3366('0x28')],{'as':_0x3366('0x14a'),'foreignKey':_0x3366('0x14b'),'constraints':![]});db[_0x3366('0x24')][_0x3366('0x101')](db[_0x3366('0x14c')],{'as':_0x3366('0x14d'),'foreignKey':_0x3366('0x14b'),'constraints':![]});db['VoiceCallReport'][_0x3366('0x110')](db[_0x3366('0x13')],{'as':_0x3366('0x13'),'foreignKey':_0x3366('0x100')});db[_0x3366('0x24')][_0x3366('0x110')](db[_0x3366('0x72')],{'as':_0x3366('0x14e'),'foreignKey':_0x3366('0x14f')});db[_0x3366('0x39')][_0x3366('0x110')](db[_0x3366('0x150')],{'as':_0x3366('0x150'),'foreignKey':_0x3366('0x151')});db[_0x3366('0x3b')]['belongsTo'](db[_0x3366('0x150')],{'as':_0x3366('0x150'),'foreignKey':_0x3366('0x151')});db['MailAccount']['hasOne'](db[_0x3366('0x39')],{'as':'Imap','onDelete':_0x3366('0xff')});db[_0x3366('0x150')][_0x3366('0xfe')](db[_0x3366('0x3b')],{'as':'Smtp','onDelete':_0x3366('0xff')});db[_0x3366('0x150')][_0x3366('0x101')](db[_0x3366('0x152')],{'as':'Dispositions','foreignKey':_0x3366('0x151')});db[_0x3366('0x150')][_0x3366('0x101')](db['CannedAnswer'],{'as':_0x3366('0x153'),'foreignKey':'MailAccountId'});db[_0x3366('0x150')][_0x3366('0x101')](db[_0x3366('0x42')],{'as':'Messages','foreignKey':'MailAccountId'});db[_0x3366('0x150')][_0x3366('0x101')](db[_0x3366('0x40')],{'as':_0x3366('0x154')});db[_0x3366('0x150')][_0x3366('0x101')](db[_0x3366('0x44')],{'as':'Applications'});db[_0x3366('0x150')][_0x3366('0x110')](db['CmList'],{'as':_0x3366('0x155'),'foreignKey':_0x3366('0x156')});db['MailAccount']['belongsTo'](db[_0x3366('0x8d')],{'as':_0x3366('0x8d'),'foreignKey':'TemplateId'});db[_0x3366('0x150')][_0x3366('0x110')](db[_0x3366('0x83')],{'as':_0x3366('0x141'),'foreignKey':_0x3366('0x157')});db[_0x3366('0x150')][_0x3366('0x111')](db[_0x3366('0x13')],{'as':'Agents','through':_0x3366('0x12c')});db[_0x3366('0x3e')][_0x3366('0x111')](db['User'],{'as':_0x3366('0x143'),'through':'UserMailQueue'});db[_0x3366('0x3e')][_0x3366('0x111')](db[_0x3366('0xdb')],{'through':'team_has_mail_queues','as':_0x3366('0x144')});db[_0x3366('0x40')][_0x3366('0x101')](db[_0x3366('0x42')],{'as':'Messages','onDelete':_0x3366('0xff'),'foreignKey':_0x3366('0x158')});db['MailInteraction']['belongsTo'](db[_0x3366('0x150')],{'as':'Account','foreignKey':_0x3366('0x151')});db['MailInteraction'][_0x3366('0x110')](db[_0x3366('0x72')],{'as':_0x3366('0x14e'),'foreignKey':_0x3366('0x14f')});db[_0x3366('0x40')]['belongsTo'](db['User'],{'as':_0x3366('0x159'),'foreignKey':_0x3366('0x100')});db[_0x3366('0x40')][_0x3366('0x111')](db[_0x3366('0x8b')],{'through':_0x3366('0x15a'),'as':_0x3366('0x15b')});db['MailInteraction']['belongsToMany'](db[_0x3366('0x8b')],{'through':_0x3366('0x15a'),'as':_0x3366('0x15c')});db[_0x3366('0x40')][_0x3366('0x111')](db[_0x3366('0x13')],{'as':_0x3366('0x15d'),'through':'user_has_mail_interactions','foreignKey':_0x3366('0x158')});db[_0x3366('0x42')][_0x3366('0x101')](db[_0x3366('0xe0')],{'as':_0x3366('0x15e'),'onDelete':'cascade'});db['MailMessage']['belongsTo'](db[_0x3366('0x13')],{'as':'User'});db[_0x3366('0x42')][_0x3366('0x110')](db[_0x3366('0x72')],{'onDelete':_0x3366('0xff'),'as':_0x3366('0x14e')});db[_0x3366('0x42')][_0x3366('0x110')](db[_0x3366('0x40')],{'as':_0x3366('0x15f'),'foreignKey':_0x3366('0x158')});db[_0x3366('0x42')][_0x3366('0x110')](db[_0x3366('0x150')],{'as':_0x3366('0x160'),'foreignKey':_0x3366('0x151')});db[_0x3366('0x44')][_0x3366('0x110')](db[_0x3366('0x13')],{'onDelete':_0x3366('0x161')});db[_0x3366('0x44')][_0x3366('0x110')](db[_0x3366('0x3e')],{'onDelete':'restrict'});db[_0x3366('0x44')]['belongsTo'](db[_0x3366('0x150')],{'onDelete':_0x3366('0x161')});db[_0x3366('0x44')][_0x3366('0x110')](db['Interval'],{'onDelete':'restrict','foreignKey':_0x3366('0x140')});db['MailApplication']['belongsTo'](db[_0x3366('0x8b')],{'onDelete':'restrict','foreignKey':_0x3366('0x162')});db[_0x3366('0x163')][_0x3366('0x110')](db['MailAccount'],{});db[_0x3366('0x163')][_0x3366('0x110')](db[_0x3366('0xea')],{'as':_0x3366('0x155'),'foreignKey':'ListId'});db[_0x3366('0x163')][_0x3366('0x110')](db[_0x3366('0x72')],{'as':'Contact','foreignKey':'ContactId'});db['MailQueueReport'][_0x3366('0x110')](db[_0x3366('0x40')],{});db[_0x3366('0x163')][_0x3366('0x110')](db[_0x3366('0x42')],{});db[_0x3366('0x163')][_0x3366('0x110')](db[_0x3366('0x13')],{});db[_0x3366('0x163')][_0x3366('0x110')](db[_0x3366('0x3e')],{});db[_0x3366('0x46')][_0x3366('0x101')](db[_0x3366('0x48')],{'as':_0x3366('0x164'),'onDelete':_0x3366('0xff')});db[_0x3366('0x49')][_0x3366('0x101')](db[_0x3366('0x152')],{'as':_0x3366('0x165'),'foreignKey':_0x3366('0x166')});db['FaxAccount'][_0x3366('0x101')](db[_0x3366('0x7e')],{'as':'Answers','foreignKey':_0x3366('0x166')});db[_0x3366('0x49')]['hasMany'](db['FaxInteraction'],{'as':_0x3366('0x154')});db[_0x3366('0x49')]['hasMany'](db[_0x3366('0x4b')],{'as':'Applications'});db[_0x3366('0x49')][_0x3366('0x101')](db[_0x3366('0x104')],{'as':_0x3366('0x167'),'onDelete':_0x3366('0xff')});db[_0x3366('0x49')]['hasMany'](db[_0x3366('0x4f')],{'as':_0x3366('0x147')});db['FaxAccount']['belongsTo'](db[_0x3366('0x2c')],{'as':_0x3366('0x2c')});db[_0x3366('0x49')][_0x3366('0x110')](db[_0x3366('0xea')],{'as':'List','foreignKey':_0x3366('0x156')});db[_0x3366('0x49')][_0x3366('0x110')](db[_0x3366('0x83')],{'as':_0x3366('0x141'),'foreignKey':_0x3366('0x157')});db[_0x3366('0x49')][_0x3366('0x111')](db[_0x3366('0x13')],{'as':'Agents','through':_0x3366('0x12a')});db[_0x3366('0x4b')][_0x3366('0x110')](db[_0x3366('0x13')],{'onDelete':'restrict'});db[_0x3366('0x4b')][_0x3366('0x110')](db[_0x3366('0x168')],{'onDelete':'restrict'});db[_0x3366('0x4b')][_0x3366('0x110')](db['FaxAccount'],{'onDelete':_0x3366('0x161')});db[_0x3366('0x4b')][_0x3366('0x110')](db[_0x3366('0x8b')],{'onDelete':_0x3366('0x161'),'foreignKey':_0x3366('0x162')});db['FaxInteraction'][_0x3366('0x101')](db['FaxMessage'],{'as':_0x3366('0x147'),'onDelete':_0x3366('0xff'),'foreignKey':_0x3366('0x169')});db['FaxInteraction']['belongsTo'](db[_0x3366('0x49')],{'as':_0x3366('0x160'),'foreignKey':_0x3366('0x166')});db[_0x3366('0x4d')]['belongsTo'](db[_0x3366('0x72')],{'as':_0x3366('0x14e'),'foreignKey':_0x3366('0x14f')});db['FaxInteraction'][_0x3366('0x110')](db[_0x3366('0x13')],{'as':'Owner','foreignKey':_0x3366('0x100')});db[_0x3366('0x4d')][_0x3366('0x111')](db[_0x3366('0x8b')],{'through':_0x3366('0x16a'),'as':_0x3366('0x15b')});db[_0x3366('0x4d')][_0x3366('0x111')](db[_0x3366('0x8b')],{'through':'fax_interaction_has_tags','as':_0x3366('0x15c')});db['FaxInteraction'][_0x3366('0x111')](db[_0x3366('0x13')],{'as':_0x3366('0x15d'),'through':_0x3366('0x16b'),'foreignKey':_0x3366('0x169')});db[_0x3366('0x4f')]['belongsTo'](db['User'],{'onDelete':'cascade','as':_0x3366('0x13')});db[_0x3366('0x4f')][_0x3366('0x110')](db['FaxInteraction'],{'as':'Interaction','foreignKey':_0x3366('0x169')});db[_0x3366('0x4f')]['belongsTo'](db[_0x3366('0x72')],{'onDelete':'cascade','as':_0x3366('0x14e')});db[_0x3366('0x4f')][_0x3366('0x110')](db['Attachment'],{'as':_0x3366('0xe0'),'foreignKey':'AttachmentId'});db[_0x3366('0x4f')][_0x3366('0x110')](db['FaxAccount'],{'as':'Account','foreignKey':'FaxAccountId'});db[_0x3366('0x168')]['belongsToMany'](db['User'],{'as':_0x3366('0x143'),'through':'UserFaxQueue'});db[_0x3366('0x168')][_0x3366('0x111')](db['Team'],{'through':'team_has_fax_queues','as':_0x3366('0x144')});db[_0x3366('0x51')][_0x3366('0x110')](db['FaxAccount'],{});db[_0x3366('0x51')][_0x3366('0x110')](db[_0x3366('0xea')],{'as':_0x3366('0x155'),'foreignKey':_0x3366('0x156')});db[_0x3366('0x51')][_0x3366('0x110')](db[_0x3366('0x72')],{'as':_0x3366('0x14e'),'foreignKey':_0x3366('0x14f')});db[_0x3366('0x51')][_0x3366('0x110')](db[_0x3366('0x4d')],{});db[_0x3366('0x51')][_0x3366('0x110')](db[_0x3366('0x4f')],{});db['FaxQueueReport']['belongsTo'](db[_0x3366('0x13')],{});db[_0x3366('0x51')][_0x3366('0x110')](db['FaxQueue'],{});db[_0x3366('0x53')][_0x3366('0x101')](db['Disposition'],{'as':_0x3366('0x165'),'foreignKey':_0x3366('0x16c')});db[_0x3366('0x53')][_0x3366('0x101')](db[_0x3366('0x7e')],{'as':_0x3366('0x153'),'foreignKey':'SmsAccountId'});db[_0x3366('0x53')][_0x3366('0x101')](db['SmsMessage'],{'as':_0x3366('0x147'),'foreignKey':_0x3366('0x16c')});db[_0x3366('0x53')]['hasMany'](db[_0x3366('0x55')],{'as':'Interactions'});db[_0x3366('0x53')][_0x3366('0x101')](db[_0x3366('0x54')],{'as':_0x3366('0x138')});db['SmsAccount'][_0x3366('0x110')](db[_0x3366('0xea')],{'as':'List','foreignKey':'ListId'});db[_0x3366('0x53')][_0x3366('0x110')](db[_0x3366('0x83')],{'as':'mandatoryDispositionPause','foreignKey':_0x3366('0x157')});db['SmsAccount'][_0x3366('0x111')](db[_0x3366('0x13')],{'as':'Agents','through':_0x3366('0x131')});db[_0x3366('0x54')][_0x3366('0x110')](db[_0x3366('0x13')],{'onDelete':_0x3366('0x161')});db[_0x3366('0x54')][_0x3366('0x110')](db['SmsQueue'],{'onDelete':_0x3366('0x161')});db[_0x3366('0x54')][_0x3366('0x110')](db['SmsAccount'],{'onDelete':_0x3366('0x161')});db[_0x3366('0x54')]['belongsTo'](db[_0x3366('0x81')],{'onDelete':_0x3366('0x161'),'foreignKey':_0x3366('0x140')});db[_0x3366('0x54')]['belongsTo'](db['Tag'],{'onDelete':_0x3366('0x161'),'foreignKey':_0x3366('0x162')});db[_0x3366('0x55')]['hasMany'](db['SmsMessage'],{'as':_0x3366('0x147'),'onDelete':_0x3366('0xff'),'foreignKey':_0x3366('0x16d')});db[_0x3366('0x55')][_0x3366('0x110')](db[_0x3366('0x53')],{'as':'Account','foreignKey':'SmsAccountId'});db[_0x3366('0x55')][_0x3366('0x110')](db[_0x3366('0x72')],{'as':'Contact','foreignKey':_0x3366('0x14f')});db['SmsInteraction'][_0x3366('0x110')](db[_0x3366('0x13')],{'as':_0x3366('0x159'),'foreignKey':_0x3366('0x100')});db[_0x3366('0x55')]['belongsToMany'](db[_0x3366('0x8b')],{'through':_0x3366('0x16e'),'as':_0x3366('0x15b')});db[_0x3366('0x55')][_0x3366('0x111')](db[_0x3366('0x8b')],{'through':_0x3366('0x16e'),'as':_0x3366('0x15c')});db[_0x3366('0x55')]['belongsToMany'](db[_0x3366('0x13')],{'as':_0x3366('0x15d'),'through':_0x3366('0x11a'),'foreignKey':_0x3366('0x16d')});db[_0x3366('0x57')][_0x3366('0x110')](db[_0x3366('0x13')],{'as':'User'});db[_0x3366('0x57')]['belongsTo'](db[_0x3366('0x72')],{'onDelete':_0x3366('0xff'),'as':_0x3366('0x14e')});db['SmsMessage'][_0x3366('0x110')](db[_0x3366('0x55')],{'onDelete':'cascade','as':_0x3366('0x15f'),'foreignKey':'SmsInteractionId'});db['SmsMessage'][_0x3366('0x110')](db[_0x3366('0x53')],{'as':_0x3366('0x160'),'foreignKey':_0x3366('0x16c')});db[_0x3366('0x59')][_0x3366('0x111')](db[_0x3366('0x13')],{'as':_0x3366('0x143'),'through':_0x3366('0x122'),'foreignKey':'SmsQueueId'});db[_0x3366('0x59')][_0x3366('0x111')](db[_0x3366('0xdb')],{'through':_0x3366('0x16f'),'as':_0x3366('0x144')});db[_0x3366('0x12d')][_0x3366('0x101')](db[_0x3366('0x152')],{'as':_0x3366('0x165'),'foreignKey':_0x3366('0x170')});db[_0x3366('0x12d')][_0x3366('0x101')](db['CannedAnswer'],{'as':_0x3366('0x153'),'foreignKey':_0x3366('0x170')});db['OpenchannelAccount'][_0x3366('0x101')](db[_0x3366('0x5c')],{'as':'Interactions','foreignKey':_0x3366('0x170')});db[_0x3366('0x12d')][_0x3366('0x101')](db[_0x3366('0x5e')],{'as':_0x3366('0x147'),'foreignKey':'OpenchannelAccountId'});db[_0x3366('0x12d')][_0x3366('0x101')](db[_0x3366('0x171')],{'as':'Applications','foreignKey':_0x3366('0x170')});db['OpenchannelAccount'][_0x3366('0x110')](db[_0x3366('0xea')],{'as':_0x3366('0x155'),'foreignKey':_0x3366('0x156')});db[_0x3366('0x12d')][_0x3366('0x110')](db[_0x3366('0x83')],{'as':_0x3366('0x141'),'foreignKey':_0x3366('0x157')});db['OpenchannelAccount'][_0x3366('0x111')](db[_0x3366('0x13')],{'as':_0x3366('0x143'),'through':_0x3366('0x12f')});db['OpenchannelApplication'][_0x3366('0x110')](db[_0x3366('0x13')],{'onDelete':_0x3366('0x161')});db[_0x3366('0x171')][_0x3366('0x110')](db[_0x3366('0x60')],{'onDelete':_0x3366('0x161'),'foreignKey':_0x3366('0x172')});db[_0x3366('0x171')][_0x3366('0x110')](db[_0x3366('0x12d')],{'onDelete':'restrict','foreignKey':_0x3366('0x170')});db['OpenchannelApplication'][_0x3366('0x110')](db[_0x3366('0x81')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x3366('0x171')][_0x3366('0x110')](db[_0x3366('0x8b')],{'onDelete':_0x3366('0x161'),'foreignKey':_0x3366('0x162')});db[_0x3366('0x5c')][_0x3366('0x101')](db[_0x3366('0x5e')],{'as':'Messages','onDelete':_0x3366('0xff'),'foreignKey':_0x3366('0x173')});db[_0x3366('0x5c')]['belongsTo'](db['OpenchannelAccount'],{'as':_0x3366('0x160'),'foreignKey':_0x3366('0x170')});db['OpenchannelInteraction'][_0x3366('0x110')](db[_0x3366('0x72')],{'as':_0x3366('0x14e'),'foreignKey':_0x3366('0x14f')});db['OpenchannelInteraction'][_0x3366('0x110')](db[_0x3366('0x13')],{'as':_0x3366('0x159'),'foreignKey':'UserId'});db[_0x3366('0x5c')][_0x3366('0x111')](db[_0x3366('0x8b')],{'through':_0x3366('0x174'),'as':_0x3366('0x15b')});db[_0x3366('0x5c')][_0x3366('0x111')](db[_0x3366('0x8b')],{'through':_0x3366('0x174'),'as':_0x3366('0x15c')});db[_0x3366('0x5c')][_0x3366('0x111')](db[_0x3366('0x13')],{'as':_0x3366('0x15d'),'through':_0x3366('0x175'),'foreignKey':_0x3366('0x173')});db[_0x3366('0x5e')][_0x3366('0x110')](db[_0x3366('0x13')],{'onDelete':_0x3366('0xff'),'as':_0x3366('0x13')});db['OpenchannelMessage'][_0x3366('0x110')](db['CmContact'],{'onDelete':'cascade','as':_0x3366('0x14e')});db['OpenchannelMessage'][_0x3366('0x110')](db['OpenchannelInteraction'],{'onDelete':_0x3366('0xff'),'as':_0x3366('0x15f'),'foreignKey':_0x3366('0x173')});db[_0x3366('0x5e')]['belongsTo'](db['Attachment'],{'as':_0x3366('0xe0'),'foreignKey':_0x3366('0x176')});db['OpenchannelMessage']['belongsTo'](db[_0x3366('0x12d')],{'as':'Account','foreignKey':_0x3366('0x170')});db[_0x3366('0x60')][_0x3366('0x111')](db[_0x3366('0x13')],{'as':_0x3366('0x143'),'through':'UserOpenchannelQueue','foreignKey':_0x3366('0x172')});db[_0x3366('0x60')][_0x3366('0x111')](db[_0x3366('0xdb')],{'through':_0x3366('0x177'),'as':_0x3366('0x144')});db[_0x3366('0x62')][_0x3366('0x101')](db[_0x3366('0x152')],{'as':_0x3366('0x165'),'foreignKey':_0x3366('0x178')});db[_0x3366('0x62')][_0x3366('0x101')](db[_0x3366('0x7e')],{'as':_0x3366('0x153'),'foreignKey':'ChatWebsiteId'});db[_0x3366('0x62')][_0x3366('0x101')](db[_0x3366('0x179')],{'as':_0x3366('0x17a')});db[_0x3366('0x62')][_0x3366('0x101')](db[_0x3366('0x66')],{'as':'Interactions'});db[_0x3366('0x62')][_0x3366('0x101')](db[_0x3366('0x17b')],{'as':'Applications'});db[_0x3366('0x62')][_0x3366('0x101')](db['ChatMessage'],{'as':_0x3366('0x147')});db['ChatWebsite'][_0x3366('0x110')](db[_0x3366('0xea')],{'as':'List','foreignKey':_0x3366('0x156')});db[_0x3366('0x62')][_0x3366('0x110')](db[_0x3366('0x81')],{'as':_0x3366('0x81'),'foreignKey':_0x3366('0x140')});db['ChatWebsite'][_0x3366('0x110')](db[_0x3366('0x83')],{'as':_0x3366('0x141'),'foreignKey':_0x3366('0x157')});db['ChatWebsite'][_0x3366('0x111')](db['User'],{'as':_0x3366('0x143'),'through':_0x3366('0x128')});db[_0x3366('0x64')][_0x3366('0x110')](db['OpenchannelAccount'],{});db[_0x3366('0x64')][_0x3366('0x110')](db['CmList'],{'as':_0x3366('0x155'),'foreignKey':_0x3366('0x156')});db[_0x3366('0x64')][_0x3366('0x110')](db[_0x3366('0x72')],{'as':_0x3366('0x14e'),'foreignKey':_0x3366('0x14f')});db[_0x3366('0x64')]['belongsTo'](db[_0x3366('0x5c')],{});db['OpenchannelQueueReport'][_0x3366('0x110')](db[_0x3366('0x5e')],{});db[_0x3366('0x64')][_0x3366('0x110')](db['User'],{});db[_0x3366('0x64')][_0x3366('0x110')](db[_0x3366('0x60')],{});db[_0x3366('0x17b')][_0x3366('0x110')](db[_0x3366('0x13')],{'as':_0x3366('0x17c'),'foreignKey':'UserId','onDelete':_0x3366('0x161')});db[_0x3366('0x17b')]['belongsTo'](db['ChatQueue'],{'as':'Queue','foreignKey':'ChatQueueId','onDelete':_0x3366('0x161')});db[_0x3366('0x17b')]['belongsTo'](db[_0x3366('0x62')],{'as':_0x3366('0x17d'),'foreignKey':_0x3366('0x178'),'onDelete':_0x3366('0x161')});db[_0x3366('0x17b')][_0x3366('0x110')](db[_0x3366('0x8b')],{'onDelete':_0x3366('0x161'),'foreignKey':_0x3366('0x162')});db[_0x3366('0x66')][_0x3366('0x101')](db[_0x3366('0x68')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x3366('0x17e')});db[_0x3366('0x66')][_0x3366('0x110')](db[_0x3366('0x62')],{'as':'Account','foreignKey':_0x3366('0x178')});db[_0x3366('0x66')]['belongsTo'](db[_0x3366('0x72')],{'as':_0x3366('0x14e'),'foreignKey':'ContactId'});db['ChatInteraction']['belongsTo'](db[_0x3366('0x13')],{'as':_0x3366('0x159'),'foreignKey':_0x3366('0x100')});db[_0x3366('0x66')]['belongsToMany'](db[_0x3366('0x8b')],{'through':_0x3366('0x17f'),'as':_0x3366('0x15b')});db[_0x3366('0x66')][_0x3366('0x111')](db[_0x3366('0x8b')],{'through':_0x3366('0x17f'),'as':_0x3366('0x15c')});db[_0x3366('0x66')]['belongsToMany'](db[_0x3366('0x13')],{'as':'Users','through':_0x3366('0x180'),'foreignKey':_0x3366('0x17e')});db[_0x3366('0x68')][_0x3366('0x110')](db[_0x3366('0x13')],{'onDelete':_0x3366('0xff'),'as':_0x3366('0x13')});db['ChatMessage'][_0x3366('0x110')](db[_0x3366('0x72')],{'onDelete':_0x3366('0xff'),'as':_0x3366('0x14e'),'foreignKey':_0x3366('0x14f')});db[_0x3366('0x68')][_0x3366('0x110')](db[_0x3366('0x66')],{'onDelete':_0x3366('0xff'),'as':_0x3366('0x15f'),'foreignKey':_0x3366('0x17e')});db['ChatMessage']['belongsTo'](db[_0x3366('0xe0')],{'as':_0x3366('0xe0'),'foreignKey':_0x3366('0x176')});db[_0x3366('0x68')]['belongsTo'](db[_0x3366('0x62')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x3366('0x6a')][_0x3366('0x110')](db[_0x3366('0x72')],{'onDelete':_0x3366('0xff'),'as':_0x3366('0x14e'),'foreignKey':_0x3366('0x14f')});db[_0x3366('0x6a')]['belongsTo'](db[_0x3366('0x62')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x3366('0x6c')][_0x3366('0x111')](db['User'],{'as':_0x3366('0x143'),'through':_0x3366('0x11f'),'hooks':!![]});db[_0x3366('0x6c')][_0x3366('0x111')](db[_0x3366('0xdb')],{'through':_0x3366('0x181'),'as':_0x3366('0x144')});db[_0x3366('0x6d')][_0x3366('0x101')](db[_0x3366('0xc6')],{'as':_0x3366('0x147'),'foreignKey':_0x3366('0x182'),'onDelete':_0x3366('0xff')});db[_0x3366('0x6d')][_0x3366('0x111')](db[_0x3366('0x13')],{'as':_0x3366('0x13a'),'through':_0x3366('0x113')});db['ChatProactiveAction'][_0x3366('0x110')](db[_0x3366('0x62')],{'as':_0x3366('0x17d'),'foreignKey':'ChatWebsiteId'});db[_0x3366('0x70')][_0x3366('0x101')](db[_0x3366('0x72')],{'as':_0x3366('0x114'),'foreignKey':_0x3366('0x183')});db[_0x3366('0x72')][_0x3366('0x101')](db[_0x3366('0x74')],{'as':_0x3366('0x184'),'foreignKey':'ContactId'});db['CmContact'][_0x3366('0x101')](db[_0x3366('0x78')],{'as':_0x3366('0x106'),'foreignKey':_0x3366('0x14f')});db[_0x3366('0x72')][_0x3366('0x101')](db[_0x3366('0x79')],{'as':'HopperHistories','foreignKey':'ContactId'});db['CmContact'][_0x3366('0x101')](db[_0x3366('0x108')],{'as':_0x3366('0x108'),'foreignKey':_0x3366('0x14f')});db[_0x3366('0x72')]['hasMany'](db[_0x3366('0xcb')],{'as':'JscriptySessions','foreignKey':_0x3366('0x14f')});db['CmContact'][_0x3366('0x101')](db[_0x3366('0x5c')],{'as':_0x3366('0x109'),'foreignKey':_0x3366('0x14f'),'onDelete':_0x3366('0x161')});db[_0x3366('0x72')][_0x3366('0x101')](db[_0x3366('0x66')],{'as':_0x3366('0x10a'),'foreignKey':_0x3366('0x14f'),'onDelete':_0x3366('0x161')});db['CmContact']['hasMany'](db[_0x3366('0x55')],{'as':_0x3366('0x10b'),'foreignKey':_0x3366('0x14f'),'onDelete':'restrict'});db['CmContact'][_0x3366('0x101')](db[_0x3366('0x4d')],{'as':_0x3366('0x119'),'foreignKey':'ContactId','onDelete':_0x3366('0x161')});db['CmContact'][_0x3366('0x101')](db[_0x3366('0x40')],{'as':_0x3366('0x10c'),'foreignKey':_0x3366('0x14f'),'onDelete':'restrict'});db[_0x3366('0x72')][_0x3366('0x110')](db['CmCompany'],{'as':'Company','foreignKey':_0x3366('0x183')});db[_0x3366('0x72')][_0x3366('0x110')](db[_0x3366('0xea')],{'as':_0x3366('0x155'),'foreignKey':_0x3366('0x156'),'onDelete':_0x3366('0xff')});db[_0x3366('0x72')][_0x3366('0x111')](db[_0x3366('0x13')],{'as':'Users','through':_0x3366('0x185')});db[_0x3366('0x72')][_0x3366('0x111')](db[_0x3366('0x8b')],{'as':_0x3366('0x15b'),'through':_0x3366('0x186')});db['CmContact']['belongsToMany'](db[_0x3366('0x8b')],{'through':'cm_contact_has_tags','as':_0x3366('0x15c')});db[_0x3366('0x74')][_0x3366('0x110')](db[_0x3366('0x72')],{'as':'Contact','foreignKey':_0x3366('0x14f'),'onDelete':_0x3366('0xff')});db[_0x3366('0x74')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x3366('0x156'),'onDelete':_0x3366('0xff')});db[_0x3366('0x74')][_0x3366('0x110')](db[_0x3366('0x13')],{'as':_0x3366('0x17c'),'foreignKey':_0x3366('0x100')});db[_0x3366('0x74')][_0x3366('0x110')](db[_0x3366('0x1c')],{'as':_0x3366('0x187'),'foreignKey':_0x3366('0x13b'),'onDelete':'cascade'});db[_0x3366('0x74')][_0x3366('0x110')](db[_0x3366('0xdc')],{'as':'Campaign','foreignKey':'CampaignId','onDelete':_0x3366('0xff')});db['CmHopper'][_0x3366('0x110')](db['User'],{'as':_0x3366('0x159'),'foreignKey':_0x3366('0x188')});db[_0x3366('0x76')][_0x3366('0x110')](db[_0x3366('0x72')],{'as':'Contact','foreignKey':_0x3366('0x14f'),'onDelete':_0x3366('0xff')});db[_0x3366('0x76')]['belongsTo'](db['CmList'],{'as':_0x3366('0x155'),'foreignKey':'ListId','onDelete':_0x3366('0xff')});db[_0x3366('0x76')][_0x3366('0x110')](db[_0x3366('0x1c')],{'as':_0x3366('0x187'),'foreignKey':_0x3366('0x13b'),'onDelete':_0x3366('0xff')});db['CmHopperBlack'][_0x3366('0x110')](db[_0x3366('0xdc')],{'as':_0x3366('0xdc'),'foreignKey':_0x3366('0x189'),'onDelete':'cascade'});db[_0x3366('0x18a')][_0x3366('0x101')](db['Condition'],{'as':{'plural':_0x3366('0x18b'),'singular':'OneAll'},'foreignKey':_0x3366('0x18c'),'onDelete':_0x3366('0xff'),'hooks':!![]});db[_0x3366('0x18a')][_0x3366('0x101')](db[_0x3366('0x7f')],{'as':{'plural':'Any','singular':_0x3366('0x18d')},'foreignKey':_0x3366('0x18e'),'onDelete':_0x3366('0xff'),'hooks':!![]});db[_0x3366('0x18a')][_0x3366('0x101')](db['Action'],{'as':_0x3366('0x18f'),'foreignKey':_0x3366('0x190'),'onDelete':'cascade','hooks':!![]});db[_0x3366('0x81')][_0x3366('0x101')](db[_0x3366('0x81')],{'as':'Intervals','foreignKey':_0x3366('0x140'),'onDelete':_0x3366('0xff'),'hooks':!![],'required':![]});db[_0x3366('0x81')][_0x3366('0x101')](db[_0x3366('0x104')],{'as':_0x3366('0x105'),'foreignKey':_0x3366('0x140'),'onDelete':_0x3366('0x161')});db[_0x3366('0x81')]['hasMany'](db[_0x3366('0x44')],{'as':_0x3366('0x191'),'foreignKey':_0x3366('0x140')});db['Interval']['hasMany'](db['ChatApplication'],{'as':_0x3366('0x192'),'foreignKey':_0x3366('0x140')});db[_0x3366('0x81')][_0x3366('0x101')](db[_0x3366('0x4b')],{'as':_0x3366('0x193'),'foreignKey':_0x3366('0x140')});db[_0x3366('0x81')][_0x3366('0x101')](db['SmsApplication'],{'as':'SmsApplications','foreignKey':_0x3366('0x140')});db['Schedule']['belongsTo'](db['MailAccount'],{});db[_0x3366('0x88')][_0x3366('0x110')](db[_0x3366('0x194')],{'foreignKey':_0x3366('0x195')});db['Schedule'][_0x3366('0x110')](db[_0x3366('0x95')],{'foreignKey':'CustomReportId'});db['Sound'][_0x3366('0x111')](db[_0x3366('0x1b')],{'as':_0x3366('0x196'),'through':_0x3366('0x139'),'onDelete':_0x3366('0x161')});db[_0x3366('0x8b')]['belongsToMany'](db[_0x3366('0x72')],{'through':_0x3366('0x186')});db[_0x3366('0x8b')][_0x3366('0x111')](db['ChatInteraction'],{'through':_0x3366('0x17f')});db[_0x3366('0x8b')][_0x3366('0x111')](db[_0x3366('0x40')],{'through':_0x3366('0x15a')});db[_0x3366('0x8b')][_0x3366('0x111')](db[_0x3366('0x55')],{'through':_0x3366('0x16e')});db[_0x3366('0x8b')]['belongsToMany'](db[_0x3366('0x4d')],{'through':_0x3366('0x16a')});db[_0x3366('0x8b')]['belongsToMany'](db[_0x3366('0x5c')],{'through':'openchannel_interaction_has_tags'});db[_0x3366('0x8b')]['belongsToMany'](db[_0x3366('0x10d')],{'through':_0x3366('0x197')});db[_0x3366('0x8f')][_0x3366('0x101')](db['Condition'],{'as':{'plural':'AllConditions','singular':'AllCondition'},'foreignKey':_0x3366('0x198'),'onDelete':_0x3366('0xff'),'hooks':!![]});db[_0x3366('0x8f')]['hasMany'](db[_0x3366('0x7f')],{'as':{'plural':_0x3366('0x199'),'singular':_0x3366('0x19a')},'foreignKey':'TriggerAnyId','onDelete':_0x3366('0xff'),'hooks':!![]});db['Trigger'][_0x3366('0x101')](db[_0x3366('0x7d')],{'as':'Actions','foreignKey':_0x3366('0x19b'),'onDelete':_0x3366('0xff'),'hooks':!![]});db[_0x3366('0x95')][_0x3366('0x101')](db['AnalyticFieldReport'],{'as':_0x3366('0x19c'),'onDelete':'cascade','foreignKey':'CustomReportId','hooks':!![]});db[_0x3366('0x194')][_0x3366('0x101')](db['AnalyticFieldReport'],{'as':_0x3366('0x19c'),'onDelete':_0x3366('0xff'),'foreignKey':_0x3366('0x195')});db[_0x3366('0x19d')][_0x3366('0x101')](db[_0x3366('0x9a')],{'as':_0x3366('0x19c'),'onDelete':_0x3366('0xff'),'foreignKey':_0x3366('0x19e')});db[_0x3366('0x9a')][_0x3366('0x110')](db['AnalyticMetric'],{'foreignKey':_0x3366('0x19e')});db[_0x3366('0x9b')][_0x3366('0x101')](db['SalesforceConfiguration'],{'as':_0x3366('0x19f'),'onDelete':_0x3366('0xff'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x3366('0x101')](db[_0x3366('0x9d')],{'as':_0x3366('0x1a0'),'onDelete':_0x3366('0xff'),'foreignKey':_0x3366('0x1a1')});db[_0x3366('0x1a2')]['hasMany'](db[_0x3366('0x9d')],{'as':_0x3366('0x1a3'),'onDelete':_0x3366('0xff'),'foreignKey':_0x3366('0x1a4')});db[_0x3366('0x1a2')][_0x3366('0x101')](db['SalesforceField'],{'as':_0x3366('0x19c'),'onDelete':_0x3366('0xff'),'foreignKey':'FieldId'});db[_0x3366('0x1a2')]['belongsTo'](db['SalesforceAccount'],{'as':'Account','foreignKey':_0x3366('0x1a5')});db[_0x3366('0x9d')][_0x3366('0x101')](db[_0x3366('0x9d')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x3366('0x9d')][_0x3366('0x101')](db[_0x3366('0x9d')],{'as':_0x3366('0x1a6'),'foreignKey':'DescriptionId'});db['SalesforceField']['hasMany'](db[_0x3366('0x9d')],{'as':_0x3366('0x1a7'),'foreignKey':_0x3366('0x1a8')});db[_0x3366('0x9d')][_0x3366('0x110')](db[_0x3366('0x90')],{'as':'Variable','foreignKey':_0x3366('0x1a9')});db[_0x3366('0x9f')]['hasMany'](db['SugarcrmConfiguration'],{'as':_0x3366('0x19f'),'onDelete':_0x3366('0xff'),'foreignKey':_0x3366('0x1a5')});db[_0x3366('0xa1')][_0x3366('0x101')](db[_0x3366('0xa3')],{'as':_0x3366('0x1a0'),'onDelete':'cascade','foreignKey':_0x3366('0x1a1')});db['SugarcrmConfiguration']['hasMany'](db[_0x3366('0xa3')],{'as':_0x3366('0x1a3'),'onDelete':_0x3366('0xff'),'foreignKey':_0x3366('0x1a4')});db[_0x3366('0xa1')]['hasMany'](db[_0x3366('0xa3')],{'as':_0x3366('0x19c'),'onDelete':_0x3366('0xff'),'foreignKey':_0x3366('0x1a8')});db[_0x3366('0xa1')]['belongsTo'](db[_0x3366('0x9f')],{'as':_0x3366('0x160'),'foreignKey':_0x3366('0x1a5')});db['SugarcrmField'][_0x3366('0x101')](db[_0x3366('0xa3')],{'as':'Subject','foreignKey':_0x3366('0x1a1')});db[_0x3366('0xa3')][_0x3366('0x101')](db[_0x3366('0xa3')],{'as':'Description','foreignKey':_0x3366('0x1a4')});db[_0x3366('0xa3')][_0x3366('0x101')](db[_0x3366('0xa3')],{'as':_0x3366('0x1a7'),'foreignKey':_0x3366('0x1a8')});db[_0x3366('0xa3')][_0x3366('0x110')](db[_0x3366('0x90')],{'as':_0x3366('0x90'),'foreignKey':_0x3366('0x1a9')});db['DeskAccount'][_0x3366('0x101')](db['DeskConfiguration'],{'as':_0x3366('0x19f'),'onDelete':_0x3366('0xff'),'foreignKey':_0x3366('0x1a5')});db['DeskConfiguration'][_0x3366('0x101')](db[_0x3366('0xa7')],{'as':_0x3366('0x1a0'),'onDelete':_0x3366('0xff'),'foreignKey':_0x3366('0x1a1')});db['DeskConfiguration'][_0x3366('0x101')](db[_0x3366('0xa7')],{'as':'Descriptions','onDelete':_0x3366('0xff'),'foreignKey':_0x3366('0x1a4')});db[_0x3366('0x1aa')][_0x3366('0x101')](db[_0x3366('0xa7')],{'as':_0x3366('0x19c'),'onDelete':_0x3366('0xff'),'foreignKey':_0x3366('0x1a8')});db[_0x3366('0x1aa')][_0x3366('0x110')](db[_0x3366('0x1ab')],{'as':_0x3366('0x160'),'foreignKey':_0x3366('0x1a5')});db[_0x3366('0x1aa')][_0x3366('0x111')](db[_0x3366('0x8b')],{'through':_0x3366('0x1ac')});db[_0x3366('0xa7')][_0x3366('0x101')](db[_0x3366('0xa7')],{'as':'Subject','foreignKey':_0x3366('0x1a1')});db['DeskField'][_0x3366('0x101')](db['DeskField'],{'as':'Description','foreignKey':_0x3366('0x1a4')});db[_0x3366('0xa7')]['hasMany'](db[_0x3366('0xa7')],{'as':_0x3366('0x1a7'),'foreignKey':'FieldId'});db[_0x3366('0xa7')]['belongsTo'](db[_0x3366('0x90')],{'as':_0x3366('0x90'),'foreignKey':_0x3366('0x1a9')});db[_0x3366('0xa8')][_0x3366('0x101')](db[_0x3366('0xa9')],{'as':_0x3366('0x19f'),'onDelete':_0x3366('0xff'),'foreignKey':_0x3366('0x1a5')});db['ZohoConfiguration'][_0x3366('0x101')](db['ZohoField'],{'as':'Subjects','onDelete':_0x3366('0xff'),'foreignKey':_0x3366('0x1a1')});db[_0x3366('0xa9')]['hasMany'](db[_0x3366('0x1ad')],{'as':_0x3366('0x1a3'),'onDelete':_0x3366('0xff'),'foreignKey':_0x3366('0x1a4')});db[_0x3366('0xa9')][_0x3366('0x101')](db[_0x3366('0x1ad')],{'as':'Fields','onDelete':_0x3366('0xff'),'foreignKey':_0x3366('0x1a8')});db[_0x3366('0xa9')]['belongsTo'](db[_0x3366('0xa8')],{'as':_0x3366('0x160'),'foreignKey':_0x3366('0x1a5')});db[_0x3366('0x1ad')][_0x3366('0x101')](db['ZohoField'],{'as':_0x3366('0x1ae'),'foreignKey':_0x3366('0x1a1')});db[_0x3366('0x1ad')][_0x3366('0x101')](db['ZohoField'],{'as':_0x3366('0x1a6'),'foreignKey':'DescriptionId'});db[_0x3366('0x1ad')][_0x3366('0x101')](db[_0x3366('0x1ad')],{'as':'Field','foreignKey':_0x3366('0x1a8')});db[_0x3366('0x1ad')][_0x3366('0x110')](db[_0x3366('0x90')],{'as':_0x3366('0x90'),'foreignKey':_0x3366('0x1a9')});db[_0x3366('0xab')][_0x3366('0x101')](db[_0x3366('0xad')],{'as':_0x3366('0x19f'),'onDelete':_0x3366('0xff'),'foreignKey':_0x3366('0x1a5')});db[_0x3366('0xad')]['hasMany'](db[_0x3366('0xae')],{'as':'Subjects','foreignKey':_0x3366('0x1a1')});db[_0x3366('0xad')][_0x3366('0x101')](db['ZendeskField'],{'as':_0x3366('0x1a3'),'foreignKey':_0x3366('0x1a4')});db[_0x3366('0xad')][_0x3366('0x101')](db[_0x3366('0xae')],{'as':_0x3366('0x19c'),'foreignKey':_0x3366('0x1a8')});db[_0x3366('0xad')]['belongsTo'](db[_0x3366('0xab')],{'as':_0x3366('0x160'),'foreignKey':'AccountId'});db[_0x3366('0xad')][_0x3366('0x111')](db[_0x3366('0x8b')],{'through':_0x3366('0x1af')});db[_0x3366('0xae')][_0x3366('0x101')](db[_0x3366('0xae')],{'as':'Subject','foreignKey':_0x3366('0x1a1')});db['ZendeskField'][_0x3366('0x101')](db[_0x3366('0xae')],{'as':_0x3366('0x1a6'),'foreignKey':_0x3366('0x1a4')});db['ZendeskField']['hasMany'](db[_0x3366('0xae')],{'as':_0x3366('0x1a7'),'foreignKey':_0x3366('0x1a8')});db[_0x3366('0xae')][_0x3366('0x110')](db['Variable'],{'as':_0x3366('0x90'),'foreignKey':_0x3366('0x1a9')});db[_0x3366('0xb0')][_0x3366('0x101')](db[_0x3366('0xb1')],{'as':'Configurations','onDelete':_0x3366('0xff'),'foreignKey':_0x3366('0x1a5')});db['FreshdeskConfiguration'][_0x3366('0x101')](db[_0x3366('0x1b0')],{'as':_0x3366('0x1a0'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x3366('0xb1')]['hasMany'](db[_0x3366('0x1b0')],{'as':_0x3366('0x1a3'),'onDelete':'cascade','foreignKey':_0x3366('0x1a4')});db[_0x3366('0xb1')][_0x3366('0x101')](db[_0x3366('0x1b0')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x3366('0x1a8')});db[_0x3366('0xb1')][_0x3366('0x110')](db[_0x3366('0xb0')],{'as':_0x3366('0x160'),'foreignKey':_0x3366('0x1a5')});db[_0x3366('0xb1')][_0x3366('0x111')](db[_0x3366('0x8b')],{'through':'int_freshdesk_configuration_has_tags'});db[_0x3366('0x1b0')][_0x3366('0x101')](db[_0x3366('0x1b0')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x3366('0x1b0')][_0x3366('0x101')](db[_0x3366('0x1b0')],{'as':_0x3366('0x1a6'),'foreignKey':_0x3366('0x1a4')});db[_0x3366('0x1b0')]['hasMany'](db[_0x3366('0x1b0')],{'as':_0x3366('0x1a7'),'foreignKey':_0x3366('0x1a8')});db[_0x3366('0x1b0')][_0x3366('0x110')](db[_0x3366('0x90')],{'as':_0x3366('0x90'),'foreignKey':_0x3366('0x1a9')});db['VtigerAccount'][_0x3366('0x101')](db['VtigerConfiguration'],{'as':_0x3366('0x19f'),'onDelete':_0x3366('0xff'),'foreignKey':_0x3366('0x1a5')});db[_0x3366('0xb4')][_0x3366('0x101')](db[_0x3366('0x1b1')],{'as':_0x3366('0x1a0'),'foreignKey':_0x3366('0x1a1')});db[_0x3366('0xb4')][_0x3366('0x101')](db[_0x3366('0x1b1')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['VtigerConfiguration'][_0x3366('0x101')](db[_0x3366('0x1b1')],{'as':_0x3366('0x19c'),'foreignKey':_0x3366('0x1a8')});db[_0x3366('0xb4')][_0x3366('0x110')](db['VtigerAccount'],{'as':_0x3366('0x160'),'foreignKey':_0x3366('0x1a5')});db[_0x3366('0x1b1')]['hasMany'](db[_0x3366('0x1b1')],{'as':_0x3366('0x1ae'),'foreignKey':_0x3366('0x1a1')});db[_0x3366('0x1b1')]['hasMany'](db[_0x3366('0x1b1')],{'as':'Description','foreignKey':_0x3366('0x1a4')});db[_0x3366('0x1b1')][_0x3366('0x101')](db[_0x3366('0x1b1')],{'as':_0x3366('0x1a7'),'foreignKey':_0x3366('0x1a8')});db['VtigerField']['belongsTo'](db[_0x3366('0x90')],{'as':_0x3366('0x90'),'foreignKey':_0x3366('0x1a9')});db[_0x3366('0x1b2')][_0x3366('0x101')](db[_0x3366('0xb8')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x3366('0x1a5')});db[_0x3366('0xb8')][_0x3366('0x101')](db[_0x3366('0xb9')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x3366('0xb8')][_0x3366('0x101')](db[_0x3366('0xb9')],{'as':_0x3366('0x1a3'),'foreignKey':'DescriptionId'});db[_0x3366('0xb8')][_0x3366('0x101')](db[_0x3366('0xb9')],{'as':'Fields','foreignKey':_0x3366('0x1a8')});db[_0x3366('0xb8')]['belongsTo'](db['ServicenowAccount'],{'as':_0x3366('0x160'),'foreignKey':'AccountId'});db[_0x3366('0xb9')][_0x3366('0x101')](db['ServicenowField'],{'as':_0x3366('0x1ae'),'foreignKey':_0x3366('0x1a1')});db[_0x3366('0xb9')]['hasMany'](db['ServicenowField'],{'as':_0x3366('0x1a6'),'foreignKey':_0x3366('0x1a4')});db[_0x3366('0xb9')][_0x3366('0x101')](db[_0x3366('0xb9')],{'as':_0x3366('0x1a7'),'foreignKey':_0x3366('0x1a8')});db['ServicenowField'][_0x3366('0x110')](db[_0x3366('0x90')],{'as':'Variable','foreignKey':_0x3366('0x1a9')});db[_0x3366('0xbb')][_0x3366('0x101')](db[_0x3366('0x1b3')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x3366('0x1a5')});db['Dynamics365Configuration'][_0x3366('0x101')](db[_0x3366('0xbd')],{'as':_0x3366('0x1a0'),'onDelete':_0x3366('0xff'),'foreignKey':_0x3366('0x1a1')});db[_0x3366('0x1b3')][_0x3366('0x101')](db[_0x3366('0xbd')],{'as':_0x3366('0x1a3'),'onDelete':'cascade','foreignKey':_0x3366('0x1a4')});db[_0x3366('0x1b3')][_0x3366('0x101')](db[_0x3366('0xbd')],{'as':_0x3366('0x19c'),'onDelete':_0x3366('0xff'),'foreignKey':_0x3366('0x1a8')});db['Dynamics365Configuration'][_0x3366('0x110')](db['Dynamics365Account'],{'as':'Account','foreignKey':_0x3366('0x1a5')});db[_0x3366('0xbd')][_0x3366('0x101')](db[_0x3366('0xbd')],{'as':'Subject','foreignKey':_0x3366('0x1a1')});db[_0x3366('0xbd')][_0x3366('0x101')](db[_0x3366('0xbd')],{'as':'Description','foreignKey':_0x3366('0x1a4')});db[_0x3366('0xbd')][_0x3366('0x101')](db['Dynamics365Field'],{'as':'Field','foreignKey':_0x3366('0x1a8')});db['Dynamics365Field'][_0x3366('0x110')](db[_0x3366('0x90')],{'as':'Variable','foreignKey':_0x3366('0x1a9')});db['FreshsalesAccount'][_0x3366('0x101')](db[_0x3366('0xc1')],{'as':_0x3366('0x19f'),'onDelete':_0x3366('0xff'),'foreignKey':_0x3366('0x1a5')});db[_0x3366('0xc1')][_0x3366('0x101')](db[_0x3366('0x1b4')],{'as':_0x3366('0x1a0'),'foreignKey':'SubjectId'});db[_0x3366('0xc1')][_0x3366('0x101')](db[_0x3366('0x1b4')],{'as':'Descriptions','foreignKey':_0x3366('0x1a4')});db['FreshsalesConfiguration'][_0x3366('0x101')](db[_0x3366('0x1b4')],{'as':'Fields','foreignKey':'FieldId'});db[_0x3366('0xc1')][_0x3366('0x110')](db['FreshsalesAccount'],{'as':'Account','foreignKey':_0x3366('0x1a5')});db[_0x3366('0x1b4')][_0x3366('0x101')](db[_0x3366('0x1b4')],{'as':_0x3366('0x1ae'),'foreignKey':'SubjectId'});db[_0x3366('0x1b4')][_0x3366('0x101')](db[_0x3366('0x1b4')],{'as':_0x3366('0x1a6'),'foreignKey':_0x3366('0x1a4')});db['FreshsalesField'][_0x3366('0x101')](db[_0x3366('0x1b4')],{'as':_0x3366('0x1a7'),'foreignKey':_0x3366('0x1a8')});db[_0x3366('0x1b4')][_0x3366('0x110')](db[_0x3366('0x90')],{'as':'Variable','foreignKey':_0x3366('0x1a9')});db[_0x3366('0xc4')][_0x3366('0x110')](db[_0x3366('0x62')],{});db[_0x3366('0xc4')][_0x3366('0x110')](db[_0x3366('0xea')],{'as':_0x3366('0x155'),'foreignKey':'ListId'});db['ChatQueueReport']['belongsTo'](db[_0x3366('0x72')],{'as':_0x3366('0x14e'),'foreignKey':_0x3366('0x14f')});db[_0x3366('0xc4')][_0x3366('0x110')](db[_0x3366('0x66')],{});db[_0x3366('0xc4')][_0x3366('0x110')](db[_0x3366('0x68')],{});db[_0x3366('0xc4')][_0x3366('0x110')](db[_0x3366('0x13')],{});db[_0x3366('0xc4')][_0x3366('0x110')](db['ChatQueue'],{});db[_0x3366('0xc6')][_0x3366('0x110')](db['User'],{'onDelete':'cascade','foreignKey':'FromId'});db[_0x3366('0xc6')][_0x3366('0x110')](db[_0x3366('0x13')],{'onDelete':_0x3366('0xff'),'foreignKey':_0x3366('0x1b5')});db['JscriptySessionReport'][_0x3366('0x101')](db[_0x3366('0xca')],{'foreignKey':_0x3366('0x1b6'),'onDelete':_0x3366('0xff')});db[_0x3366('0xcb')][_0x3366('0x101')](db[_0x3366('0xc8')],{'foreignKey':_0x3366('0x1b6'),'onDelete':'cascade'});db['SmsQueueReport'][_0x3366('0x110')](db['SmsAccount'],{});db[_0x3366('0xcd')]['belongsTo'](db['CmList'],{'as':_0x3366('0x155'),'foreignKey':'ListId'});db['SmsQueueReport'][_0x3366('0x110')](db[_0x3366('0x72')],{'as':_0x3366('0x14e'),'foreignKey':_0x3366('0x14f')});db[_0x3366('0xcd')][_0x3366('0x110')](db[_0x3366('0x55')],{});db[_0x3366('0xcd')]['belongsTo'](db[_0x3366('0x57')],{});db[_0x3366('0xcd')][_0x3366('0x110')](db[_0x3366('0x13')],{});db[_0x3366('0xcd')][_0x3366('0x110')](db['SmsQueue'],{});db['JscriptyProject'][_0x3366('0x101')](db[_0x3366('0xcb')],{'foreignKey':_0x3366('0x1b7')});db['JscriptyProject'][_0x3366('0x101')](db[_0x3366('0xca')],{'foreignKey':_0x3366('0x1b7')});db['JscriptyProject'][_0x3366('0x101')](db[_0x3366('0xc8')],{'foreignKey':'ProjectId'});db[_0x3366('0x134')][_0x3366('0x111')](db[_0x3366('0x13')],{'as':_0x3366('0x15d'),'through':_0x3366('0x136')});db[_0x3366('0xdb')]['belongsToMany'](db[_0x3366('0x13')],{'as':_0x3366('0x143'),'through':'user_has_teams'});db['Team'][_0x3366('0x111')](db[_0x3366('0x1c')],{'through':_0x3366('0x145'),'as':_0x3366('0x1b8')});db[_0x3366('0xdb')][_0x3366('0x111')](db[_0x3366('0x3e')],{'through':_0x3366('0x1b9'),'as':'MailQueues'});db[_0x3366('0xdb')][_0x3366('0x111')](db[_0x3366('0x6c')],{'through':_0x3366('0x181'),'as':_0x3366('0x11e')});db['Team'][_0x3366('0x111')](db[_0x3366('0x168')],{'through':_0x3366('0x1ba'),'as':'FaxQueues'});db[_0x3366('0xdb')][_0x3366('0x111')](db[_0x3366('0x59')],{'through':_0x3366('0x16f'),'as':_0x3366('0x121')});db['Team']['belongsToMany'](db[_0x3366('0x60')],{'through':'team_has_openchannel_queues','as':_0x3366('0x123')});db[_0x3366('0xdb')][_0x3366('0x111')](db[_0x3366('0xfc')],{'through':_0x3366('0x1bb'),'as':'WhatsappQueues'});db[_0x3366('0xdc')][_0x3366('0x101')](db[_0x3366('0x74')],{'as':_0x3366('0x184'),'foreignKey':_0x3366('0x189')});db['Campaign'][_0x3366('0x101')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x3366('0x189')});db[_0x3366('0xdc')][_0x3366('0x101')](db[_0x3366('0x79')],{'as':'HopperHistories','foreignKey':_0x3366('0x189')});db['Campaign'][_0x3366('0x101')](db['CmHopperBlack'],{'as':_0x3366('0x13c'),'foreignKey':'CampaignId'});db[_0x3366('0xdc')][_0x3366('0x110')](db['Trunk'],{'as':_0x3366('0x2c'),'foreignKey':_0x3366('0x13d')});db[_0x3366('0xdc')]['belongsTo'](db[_0x3366('0x2c')],{'as':_0x3366('0x13e'),'foreignKey':_0x3366('0x13f')});db['Campaign'][_0x3366('0x110')](db[_0x3366('0x81')],{'as':_0x3366('0x81'),'foreignKey':_0x3366('0x140')});db['Campaign'][_0x3366('0x110')](db[_0x3366('0x134')],{'as':_0x3366('0x134'),'foreignKey':_0x3366('0x1bc')});db['Campaign'][_0x3366('0x111')](db[_0x3366('0xea')],{'as':_0x3366('0x115'),'through':_0x3366('0x1bd')});db[_0x3366('0xdc')][_0x3366('0x111')](db[_0x3366('0xea')],{'as':_0x3366('0x1be'),'through':'campaigns_has_cm_blacklists'});db[_0x3366('0xe3')][_0x3366('0x110')](db['MailMessage'],{});db['MailTransferReport'][_0x3366('0x110')](db[_0x3366('0x40')],{});db[_0x3366('0xe3')][_0x3366('0x110')](db['MailAccount'],{'foreignKey':_0x3366('0x1bf'),'as':_0x3366('0x1c0')});db[_0x3366('0xe3')][_0x3366('0x110')](db['User'],{'foreignKey':'FromUserId','as':_0x3366('0x1c1')});db[_0x3366('0xe3')]['belongsTo'](db[_0x3366('0x13')],{'foreignKey':_0x3366('0x1c2'),'as':'ToAgent'});db[_0x3366('0xe3')]['belongsTo'](db[_0x3366('0x3e')],{'foreignKey':_0x3366('0x1c3'),'as':_0x3366('0x1c4')});db[_0x3366('0xe3')][_0x3366('0x110')](db[_0x3366('0x150')],{'foreignKey':_0x3366('0x1c5'),'as':_0x3366('0x1c6')});db[_0x3366('0xe5')]['belongsTo'](db[_0x3366('0x68')],{});db[_0x3366('0xe5')][_0x3366('0x110')](db[_0x3366('0x66')],{});db[_0x3366('0xe5')][_0x3366('0x110')](db['ChatWebsite'],{'foreignKey':_0x3366('0x1c7'),'as':_0x3366('0x1c0')});db[_0x3366('0xe5')][_0x3366('0x110')](db[_0x3366('0x13')],{'foreignKey':'FromUserId','as':_0x3366('0x1c1')});db[_0x3366('0xe5')]['belongsTo'](db[_0x3366('0x13')],{'foreignKey':'ToUserId','as':_0x3366('0x1c8')});db[_0x3366('0xe5')]['belongsTo'](db[_0x3366('0x6c')],{'foreignKey':_0x3366('0x1c9'),'as':_0x3366('0x1c4')});db[_0x3366('0xe5')]['belongsTo'](db[_0x3366('0x62')],{'foreignKey':_0x3366('0x1ca'),'as':_0x3366('0x1c6')});db[_0x3366('0xe7')][_0x3366('0x110')](db[_0x3366('0x4f')],{});db['FaxTransferReport'][_0x3366('0x110')](db[_0x3366('0x4d')],{});db[_0x3366('0xe7')][_0x3366('0x110')](db[_0x3366('0x49')],{'foreignKey':'FromFaxAccountId','as':'FromAccount'});db[_0x3366('0xe7')]['belongsTo'](db[_0x3366('0x13')],{'foreignKey':_0x3366('0x1cb'),'as':'FromAgent'});db[_0x3366('0xe7')][_0x3366('0x110')](db['User'],{'foreignKey':_0x3366('0x1c2'),'as':_0x3366('0x1c8')});db[_0x3366('0xe7')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x3366('0x1cc'),'as':_0x3366('0x1c4')});db[_0x3366('0xe7')][_0x3366('0x110')](db[_0x3366('0x49')],{'foreignKey':_0x3366('0x1cd'),'as':_0x3366('0x1c6')});db[_0x3366('0x1ce')][_0x3366('0x110')](db[_0x3366('0x5e')],{});db['OpenchannelTransferReport'][_0x3366('0x110')](db[_0x3366('0x5c')],{});db[_0x3366('0x1ce')][_0x3366('0x110')](db[_0x3366('0x12d')],{'foreignKey':_0x3366('0x1cf'),'as':_0x3366('0x1c0')});db['OpenchannelTransferReport'][_0x3366('0x110')](db[_0x3366('0x13')],{'foreignKey':'FromUserId','as':_0x3366('0x1c1')});db[_0x3366('0x1ce')]['belongsTo'](db[_0x3366('0x13')],{'foreignKey':'ToUserId','as':_0x3366('0x1c8')});db[_0x3366('0x1ce')][_0x3366('0x110')](db[_0x3366('0x60')],{'foreignKey':_0x3366('0x1d0'),'as':_0x3366('0x1c4')});db[_0x3366('0x1ce')][_0x3366('0x110')](db['OpenchannelAccount'],{'foreignKey':_0x3366('0x1d1'),'as':_0x3366('0x1c6')});db[_0x3366('0x1d2')][_0x3366('0x110')](db['SmsMessage'],{});db[_0x3366('0x1d2')]['belongsTo'](db[_0x3366('0x55')],{});db[_0x3366('0x1d2')][_0x3366('0x110')](db[_0x3366('0x53')],{'foreignKey':_0x3366('0x1d3'),'as':'FromAccount'});db[_0x3366('0x1d2')][_0x3366('0x110')](db[_0x3366('0x13')],{'foreignKey':_0x3366('0x1cb'),'as':_0x3366('0x1c1')});db[_0x3366('0x1d2')][_0x3366('0x110')](db[_0x3366('0x13')],{'foreignKey':'ToUserId','as':_0x3366('0x1c8')});db[_0x3366('0x1d2')][_0x3366('0x110')](db[_0x3366('0x59')],{'foreignKey':_0x3366('0x1d4'),'as':_0x3366('0x1c4')});db[_0x3366('0x1d2')][_0x3366('0x110')](db[_0x3366('0x53')],{'foreignKey':_0x3366('0x1d5'),'as':'ToAccount'});db['CmList'][_0x3366('0x101')](db[_0x3366('0x152')],{'as':_0x3366('0x165'),'foreignKey':_0x3366('0x156')});db['CmList']['hasMany'](db['CmCustomField'],{'as':'CustomFields','foreignKey':_0x3366('0x156')});db[_0x3366('0xea')][_0x3366('0x101')](db[_0x3366('0x72')],{'as':_0x3366('0x114'),'onDelete':'cascade','foreignKey':'ListId'});db[_0x3366('0xea')][_0x3366('0x101')](db[_0x3366('0x78')],{'as':_0x3366('0x106'),'foreignKey':'ListId'});db[_0x3366('0xea')][_0x3366('0x101')](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':_0x3366('0x156')});db[_0x3366('0xea')]['hasMany'](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x3366('0x156')});db['CmList']['belongsToMany'](db[_0x3366('0x1c')],{'as':_0x3366('0x1d6'),'through':_0x3366('0x142')});db['CmList'][_0x3366('0x111')](db[_0x3366('0x13')],{'as':_0x3366('0x143'),'through':_0x3366('0x116')});db[_0x3366('0xec')][_0x3366('0x101')](db[_0x3366('0x104')],{'as':'Extensions','onDelete':_0x3366('0xff')});db[_0x3366('0xec')][_0x3366('0x111')](db[_0x3366('0x13')],{'as':_0x3366('0x143'),'through':_0x3366('0x126')});db['UserProfile'][_0x3366('0x101')](db['User'],{'as':_0x3366('0x15d'),'foreignKey':_0x3366('0x1d7')});db[_0x3366('0xee')][_0x3366('0x101')](db[_0x3366('0x1d8')],{'as':_0x3366('0x1d9'),'foreignKey':_0x3366('0x1d7'),'onDelete':_0x3366('0xff')});db[_0x3366('0x1d8')][_0x3366('0x101')](db[_0x3366('0xf1')],{'as':'Resources','foreignKey':_0x3366('0x1da'),'onDelete':'cascade'});db[_0x3366('0xf3')]['hasMany'](db[_0x3366('0x152')],{'as':_0x3366('0x165'),'foreignKey':_0x3366('0x1db')});db['WhatsappAccount'][_0x3366('0x101')](db['CannedAnswer'],{'as':_0x3366('0x153'),'foreignKey':_0x3366('0x1db')});db[_0x3366('0xf3')]['hasMany'](db[_0x3366('0x1dc')],{'as':'Messages','foreignKey':_0x3366('0x1db')});db[_0x3366('0xf3')][_0x3366('0x101')](db[_0x3366('0x10d')],{'as':_0x3366('0x154')});db[_0x3366('0xf3')][_0x3366('0x101')](db[_0x3366('0xf5')],{'as':'Applications'});db['WhatsappAccount'][_0x3366('0x110')](db['CmList'],{'as':_0x3366('0x155'),'foreignKey':'ListId'});db[_0x3366('0xf3')][_0x3366('0x110')](db[_0x3366('0x83')],{'as':_0x3366('0x141'),'foreignKey':_0x3366('0x157')});db[_0x3366('0xf3')][_0x3366('0x111')](db['User'],{'as':_0x3366('0x143'),'through':'user_has_whatsapp_accounts'});db[_0x3366('0xf5')]['belongsTo'](db[_0x3366('0x13')],{'onDelete':_0x3366('0x161')});db[_0x3366('0xf5')][_0x3366('0x110')](db[_0x3366('0xfc')],{'onDelete':'restrict'});db['WhatsappApplication'][_0x3366('0x110')](db[_0x3366('0xf3')],{'onDelete':'restrict'});db[_0x3366('0xf5')][_0x3366('0x110')](db[_0x3366('0x81')],{'onDelete':_0x3366('0x161'),'foreignKey':_0x3366('0x140')});db[_0x3366('0xf5')]['belongsTo'](db[_0x3366('0x8b')],{'onDelete':_0x3366('0x161'),'foreignKey':_0x3366('0x162')});db[_0x3366('0x10d')][_0x3366('0x101')](db['WhatsappMessage'],{'as':_0x3366('0x147'),'onDelete':_0x3366('0xff'),'foreignKey':_0x3366('0x1dd')});db[_0x3366('0x10d')][_0x3366('0x110')](db[_0x3366('0xf3')],{'as':_0x3366('0x160'),'foreignKey':_0x3366('0x1db')});db[_0x3366('0x10d')][_0x3366('0x110')](db[_0x3366('0x72')],{'as':_0x3366('0x14e'),'foreignKey':'ContactId'});db[_0x3366('0x10d')]['belongsTo'](db[_0x3366('0x13')],{'as':'Owner','foreignKey':'UserId'});db['WhatsappInteraction'][_0x3366('0x111')](db['Tag'],{'through':_0x3366('0x197'),'as':'Tags'});db['WhatsappInteraction'][_0x3366('0x111')](db[_0x3366('0x8b')],{'through':_0x3366('0x197'),'as':'ThroughTags'});db['WhatsappInteraction'][_0x3366('0x111')](db[_0x3366('0x13')],{'as':_0x3366('0x15d'),'through':_0x3366('0x11b'),'foreignKey':_0x3366('0x1dd')});db[_0x3366('0x1dc')][_0x3366('0x110')](db[_0x3366('0x13')],{'as':_0x3366('0x13')});db[_0x3366('0x1dc')][_0x3366('0x110')](db[_0x3366('0x72')],{'onDelete':_0x3366('0xff'),'as':_0x3366('0x14e')});db[_0x3366('0x1dc')][_0x3366('0x110')](db[_0x3366('0x10d')],{'onDelete':_0x3366('0xff'),'as':'Interaction','foreignKey':_0x3366('0x1dd')});db['WhatsappMessage'][_0x3366('0x110')](db[_0x3366('0xf3')],{'as':'Account','foreignKey':_0x3366('0x1db')});db[_0x3366('0xf8')][_0x3366('0x110')](db[_0x3366('0xf3')],{});db[_0x3366('0xf8')][_0x3366('0x110')](db[_0x3366('0xea')],{'as':_0x3366('0x155'),'foreignKey':_0x3366('0x156')});db[_0x3366('0xf8')][_0x3366('0x110')](db[_0x3366('0x72')],{'as':_0x3366('0x14e'),'foreignKey':_0x3366('0x14f')});db[_0x3366('0xf8')][_0x3366('0x110')](db[_0x3366('0x10d')],{});db[_0x3366('0xf8')][_0x3366('0x110')](db[_0x3366('0xfc')],{});db[_0x3366('0xf8')][_0x3366('0x110')](db[_0x3366('0x1dc')],{});db['WhatsappQueueReport'][_0x3366('0x110')](db[_0x3366('0x13')],{});db['WhatsappTransferReport'][_0x3366('0x110')](db['WhatsappMessage'],{});db['WhatsappTransferReport'][_0x3366('0x110')](db[_0x3366('0x10d')],{});db[_0x3366('0xfa')][_0x3366('0x110')](db[_0x3366('0xf3')],{'foreignKey':_0x3366('0x1de'),'as':'FromAccount'});db['WhatsappTransferReport']['belongsTo'](db[_0x3366('0xf3')],{'foreignKey':_0x3366('0x1df'),'as':_0x3366('0x1c6')});db['WhatsappTransferReport'][_0x3366('0x110')](db['WhatsappQueue'],{'foreignKey':_0x3366('0x1e0'),'as':'ToQueue'});db['WhatsappTransferReport'][_0x3366('0x110')](db['User'],{'foreignKey':_0x3366('0x1cb'),'as':'FromAgent'});db['WhatsappTransferReport'][_0x3366('0x110')](db['User'],{'foreignKey':_0x3366('0x1c2'),'as':_0x3366('0x1c8')});db[_0x3366('0xfc')][_0x3366('0x111')](db[_0x3366('0x13')],{'as':'Agents','through':_0x3366('0x37'),'foreignKey':_0x3366('0x1e1')});db[_0x3366('0xfc')][_0x3366('0x111')](db[_0x3366('0xdb')],{'through':_0x3366('0x1bb'),'as':_0x3366('0x144')});module[_0x3366('0x1e2')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x869e=['../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticExtractedReport','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','Network','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','SquareReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','Team','../api/team/team.model','../api/license/license.model','Campaign','../api/campaign/campaign.model','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','UserProfileResource','../api/userProfileResource/userProfileResource.model','../api/notification/notification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','User','hasOne','VoiceMail','cascade','UserId','hasMany','Recordings','UserVoiceQueueRt','VoiceExtension','Extensions','HopperFinals','ReportAgentPreview','ChatInteractions','SmsInteractions','MailInteractions','WhatsappInteraction','WhatsappInteractions','Notification','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','ChatInteraction','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','UserMailQueue','UserChatQueue','FaxQueues','SmsQueues','UserOpenchannelQueue','UserWhatsappQueue','ChatWebsite','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','user_has_whatsapp_accounts','user_has_square_projects','VoiceChanSpy','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','CmHopperHistory','HopperBlacks','JscriptySessions','TrunkId','TrunkBackupId','Interval','IntervalId','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','QueueCalls','uniqueid','Contact','ContactId','MailServerOut','MailAccountId','Imap','Smtp','Dispositions','Answers','Interactions','MailApplication','List','TemplateId','team_has_mail_queues','Teams','MailMessage','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','Users','restrict','ListId','Items','FaxAccountId','Exntensions','mandatoryDispositionPause','TagId','FaxInteractionId','fax_interaction_has_tags','ThroughTags','Interaction','AttachmentId','UserFaxQueue','team_has_fax_queues','SmsAccountId','sms_interaction_has_tags','SmsInteractionId','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','OpenchannelApplication','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelQueueId','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','Agent','ChatQueueId','Website','chat_interaction_has_tags','user_has_chat_interactions','ChatInteractionId','team_has_chat_queues','ChatGroupId','CmCompany','CompanyId','Hoppers','HopperHistories','OpenchannelInteractions','Company','cm_contact_has_tags','CampaignId','OwnerId','Automation','Condition','All','OneAll','Any','OneAny','Actions','AutomationId','Intervals','MailApplications','ChatApplications','Schedule','AnalyticDefaultReport','CustomReportId','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerId','Fields','DefaultReportId','MetricId','SalesforceAccount','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Field','VariableId','SugarcrmAccount','Description','DeskConfiguration','ZendeskField','int_zendesk_configuration_has_tags','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','ServicenowConfiguration','FreshsalesField','FromId','ToId','SessionId','ProjectId','MailQueues','ChatQueues','OpenchannelQueues','team_has_whatsapp_queues','WhatsappQueues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToMailQueueId','ToMailAccountId','ToAccount','FromChatWebsiteId','ToAgent','ToQueue','ToChatWebsiteId','ToFaxQueueId','OpenchannelTransferReport','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','CustomFields','HopperHistory','Queues','user_has_voice_prefixes','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','path','../config/environment','sequelize','jstz','determine','defaultsDeep','xcall','xC@LL1234','127.0.0.1','mysql','utf8','utf8_general_ci','sequelizeHistory','motion2','utf8mb4','name','password','options','database','username','import','../api/user/user.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','../api/condition/condition.model','../api/interval/interval.model','Pause','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration'];(function(_0x338090,_0xf37d18){var _0x4c9a9b=function(_0x1c4865){while(--_0x1c4865){_0x338090['push'](_0x338090['shift']());}};_0x4c9a9b(++_0xf37d18);}(_0x869e,0x15c));var _0xe869=function(_0x18494b,_0x10b6da){_0x18494b=_0x18494b-0x0;var _0x15aece=_0x869e[_0x18494b];return _0x15aece;};'use strict';var path=require(_0xe869('0x0'));var config=require(_0xe869('0x1'));var Sequelize=require(_0xe869('0x2'));var _=require('lodash');var jstz=require(_0xe869('0x3'));var timezone=jstz[_0xe869('0x4')]();config[_0xe869('0x2')]=_[_0xe869('0x5')](config[_0xe869('0x2')],{'database':'motion2','username':_0xe869('0x6'),'password':_0xe869('0x7'),'options':{'host':_0xe869('0x8'),'port':0xcea,'dialect':_0xe869('0x9'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xe869('0xa'),'collate':_0xe869('0xb')}}});config[_0xe869('0xc')]=_[_0xe869('0x5')](config[_0xe869('0xc')],{'database':_0xe869('0xd'),'username':_0xe869('0x6'),'password':_0xe869('0x7'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xe869('0xe')},'logging':![],'timezone':timezone[_0xe869('0xf')](),'define':{'charset':_0xe869('0xa'),'collate':_0xe869('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0xe869('0x2')]['username'],config[_0xe869('0x2')][_0xe869('0x10')],config['sequelize'][_0xe869('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xe869('0xc')][_0xe869('0x12')],config[_0xe869('0xc')][_0xe869('0x13')],config['sequelizeHistory']['password'],config['sequelizeHistory'][_0xe869('0x11')])};db['User']=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0x15'));db['VoiceChanSpy']=db[_0xe869('0x2')][_0xe869('0x14')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0xe869('0x16')]=db['sequelize'][_0xe869('0x14')](_0xe869('0x17'));db['VoiceExtension']=db['sequelize'][_0xe869('0x14')]('../api/voiceExtension/voiceExtension.model');db[_0xe869('0x18')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0x19'));db[_0xe869('0x1a')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0x1b'));db[_0xe869('0x1c')]=db[_0xe869('0x2')]['import'](_0xe869('0x1d'));db[_0xe869('0x1e')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0x1f'));db['VoiceMail']=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0x20'));db[_0xe869('0x21')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0x22'));db[_0xe869('0x23')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0x24'));db[_0xe869('0x25')]=db[_0xe869('0x2')]['import'](_0xe869('0x26'));db[_0xe869('0x27')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0x28'));db[_0xe869('0x29')]=db['sequelize'][_0xe869('0x14')](_0xe869('0x2a'));db['MemberReport']=db['sequelize'][_0xe869('0x14')]('../api/memberReport/memberReport.model');db[_0xe869('0x2b')]=db['sequelize']['import'](_0xe869('0x2c'));db[_0xe869('0x2d')]=db[_0xe869('0x2')]['import'](_0xe869('0x2e'));db['UserVoiceQueueRt']=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0x2f'));db[_0xe869('0x30')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0x31'));db['UserChatQueue']=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0x32'));db['UserMailQueue']=db['sequelize'][_0xe869('0x14')]('../api/userMailQueue/userMailQueue.model');db['UserFaxQueue']=db[_0xe869('0x2')][_0xe869('0x14')]('../api/userFaxQueue/userFaxQueue.model');db[_0xe869('0x33')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0x34'));db['UserOpenchannelQueue']=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0x35'));db['UserWhatsappQueue']=db[_0xe869('0x2')][_0xe869('0x14')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0xe869('0x36')]=db[_0xe869('0x2')]['import'](_0xe869('0x37'));db['MailServerOut']=db[_0xe869('0x2')][_0xe869('0x14')]('../api/mailServerOut/mailServerOut.model');db[_0xe869('0x38')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0x39'));db[_0xe869('0x3a')]=db['sequelize'][_0xe869('0x14')](_0xe869('0x3b'));db[_0xe869('0x3c')]=db['sequelize'][_0xe869('0x14')](_0xe869('0x3d'));db[_0xe869('0x3e')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0x3f'));db['MailMessage']=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0x40'));db['MailApplication']=db[_0xe869('0x2')]['import'](_0xe869('0x41'));db[_0xe869('0x42')]=db[_0xe869('0x2')][_0xe869('0x14')]('../api/mailQueueReport/mailQueueReport.model');db[_0xe869('0x43')]=db[_0xe869('0x2')]['import'](_0xe869('0x44'));db[_0xe869('0x45')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0x46'));db[_0xe869('0x47')]=db['sequelize'][_0xe869('0x14')]('../api/faxAccount/faxAccount.model');db[_0xe869('0x48')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0x49'));db[_0xe869('0x4a')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0x4b'));db[_0xe869('0x4c')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0x4d'));db[_0xe869('0x4e')]=db[_0xe869('0x2')]['import'](_0xe869('0x4f'));db[_0xe869('0x50')]=db['sequelize'][_0xe869('0x14')]('../api/faxQueueReport/faxQueueReport.model');db[_0xe869('0x51')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0x52'));db[_0xe869('0x53')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0x54'));db[_0xe869('0x55')]=db[_0xe869('0x2')]['import'](_0xe869('0x56'));db[_0xe869('0x57')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0x58'));db[_0xe869('0x59')]=db['sequelize'][_0xe869('0x14')]('../api/smsQueue/smsQueue.model');db[_0xe869('0x5a')]=db['sequelize']['import'](_0xe869('0x5b'));db['OpenchannelApplication']=db['sequelize'][_0xe869('0x14')](_0xe869('0x5c'));db[_0xe869('0x5d')]=db[_0xe869('0x2')][_0xe869('0x14')]('../api/openchannelInteraction/openchannelInteraction.model');db['OpenchannelMessage']=db['sequelize'][_0xe869('0x14')]('../api/openchannelMessage/openchannelMessage.model');db[_0xe869('0x5e')]=db[_0xe869('0x2')]['import'](_0xe869('0x5f'));db['ChatWebsite']=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0x60'));db[_0xe869('0x61')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0x62'));db[_0xe869('0x63')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0x64'));db['ChatInteraction']=db['sequelize'][_0xe869('0x14')](_0xe869('0x65'));db[_0xe869('0x66')]=db['sequelize']['import'](_0xe869('0x67'));db[_0xe869('0x68')]=db['sequelize'][_0xe869('0x14')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0xe869('0x69')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0x6a'));db[_0xe869('0x6b')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0x6c'));db[_0xe869('0x6d')]=db[_0xe869('0x2')][_0xe869('0x14')]('../api/chatProactiveAction/chatProactiveAction.model');db['CmCompany']=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0x6e'));db[_0xe869('0x6f')]=db['sequelize'][_0xe869('0x14')](_0xe869('0x70'));db[_0xe869('0x71')]=db[_0xe869('0x2')]['import'](_0xe869('0x72'));db[_0xe869('0x73')]=db['sequelize'][_0xe869('0x14')](_0xe869('0x74'));db[_0xe869('0x75')]=db[_0xe869('0x2')][_0xe869('0x14')]('../api/cmHopperFinal/cmHopperFinal.model');db['CmHopperHistory']=db['sequelize'][_0xe869('0x14')](_0xe869('0x76'));db['ReportAgentPreview']=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0x77'));db[_0xe869('0x78')]=db[_0xe869('0x2')]['import'](_0xe869('0x79'));db[_0xe869('0x7a')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0x7b'));db['Automation']=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0x7c'));db[_0xe869('0x7d')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0x7e'));db[_0xe869('0x7f')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0x80'));db['Condition']=db[_0xe869('0x2')]['import'](_0xe869('0x81'));db['Interval']=db[_0xe869('0x2')]['import'](_0xe869('0x82'));db[_0xe869('0x83')]=db[_0xe869('0x2')][_0xe869('0x14')]('../api/pause/pause.model');db[_0xe869('0x84')]=db['sequelize'][_0xe869('0x14')](_0xe869('0x85'));db[_0xe869('0x86')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0x87'));db['Schedule']=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0x88'));db[_0xe869('0x89')]=db[_0xe869('0x2')]['import'](_0xe869('0x8a'));db[_0xe869('0x8b')]=db[_0xe869('0x2')]['import'](_0xe869('0x8c'));db[_0xe869('0x8d')]=db['sequelize'][_0xe869('0x14')](_0xe869('0x8e'));db[_0xe869('0x8f')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0x90'));db[_0xe869('0x91')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0x92'));db[_0xe869('0x93')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0x94'));db['IntegrationReport']=db[_0xe869('0x2')]['import'](_0xe869('0x95'));db[_0xe869('0x96')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0x97'));db['AnalyticDefaultReport']=db[_0xe869('0x2')]['import']('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0xe869('0x98')]=db[_0xe869('0x2')][_0xe869('0x14')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0xe869('0x99')]=db['sequelize'][_0xe869('0x14')](_0xe869('0x9a'));db[_0xe869('0x9b')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0x9c'));db[_0xe869('0x9d')]=db['sequelize']['import']('../api/analyticTreeReport/analyticTreeReport.model');db['SalesforceAccount']=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0x9e'));db[_0xe869('0x9f')]=db[_0xe869('0x2')][_0xe869('0x14')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0xe869('0xa0')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0xa1'));db['SugarcrmAccount']=db['sequelize'][_0xe869('0x14')](_0xe869('0xa2'));db[_0xe869('0xa3')]=db['sequelize']['import'](_0xe869('0xa4'));db[_0xe869('0xa5')]=db[_0xe869('0x2')]['import']('../api/intSugarcrmField/intSugarcrmField.model');db[_0xe869('0xa6')]=db[_0xe869('0x2')][_0xe869('0x14')]('../api/intDeskAccount/intDeskAccount.model');db['DeskConfiguration']=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0xa7'));db[_0xe869('0xa8')]=db[_0xe869('0x2')]['import'](_0xe869('0xa9'));db[_0xe869('0xaa')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0xab'));db[_0xe869('0xac')]=db[_0xe869('0x2')][_0xe869('0x14')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0xe869('0xad')]=db[_0xe869('0x2')]['import']('../api/intZohoField/intZohoField.model');db[_0xe869('0xae')]=db[_0xe869('0x2')]['import'](_0xe869('0xaf'));db[_0xe869('0xb0')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0xb1'));db['ZendeskField']=db['sequelize'][_0xe869('0x14')](_0xe869('0xb2'));db[_0xe869('0xb3')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0xb4'));db['FreshdeskConfiguration']=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0xb5'));db[_0xe869('0xb6')]=db[_0xe869('0x2')]['import'](_0xe869('0xb7'));db[_0xe869('0xb8')]=db[_0xe869('0x2')][_0xe869('0x14')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0xe869('0xb9')]=db[_0xe869('0x2')]['import'](_0xe869('0xba'));db[_0xe869('0xbb')]=db[_0xe869('0x2')][_0xe869('0x14')]('../api/intVtigerField/intVtigerField.model');db[_0xe869('0xbc')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0xbd'));db['ServicenowConfiguration']=db[_0xe869('0x2')]['import'](_0xe869('0xbe'));db[_0xe869('0xbf')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0xc0'));db[_0xe869('0xc1')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0xc2'));db[_0xe869('0xc3')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0xc4'));db[_0xe869('0xc5')]=db[_0xe869('0x2')][_0xe869('0x14')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0xe869('0xc6')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0xc7'));db[_0xe869('0xc8')]=db[_0xe869('0x2')][_0xe869('0x14')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db['FreshsalesField']=db[_0xe869('0x2')][_0xe869('0x14')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0xe869('0x93')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0x94'));db[_0xe869('0xc9')]=db[_0xe869('0x2')][_0xe869('0x14')]('../api/network/network.model');db[_0xe869('0xca')]=db['sequelize'][_0xe869('0x14')](_0xe869('0xcb'));db[_0xe869('0xcc')]=db['sequelize']['import'](_0xe869('0xcd'));db[_0xe869('0xce')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0xcf'));db[_0xe869('0xd0')]=db['sequelize']['import']('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0xe869('0xd1')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0xd2'));db[_0xe869('0xd3')]=db[_0xe869('0x2')][_0xe869('0x14')]('../api/smsQueueReport/smsQueueReport.model');db[_0xe869('0xd4')]=db[_0xe869('0x2')][_0xe869('0x14')]('../api/squareReport/squareReport.model');db['SquareDetailsReport']=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0xd5'));db[_0xe869('0xd6')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0xd7'));db[_0xe869('0xd8')]=db['sequelize'][_0xe869('0x14')](_0xe869('0xd9'));db[_0xe869('0xda')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0xdb'));db[_0xe869('0xdc')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0xdd'));db[_0xe869('0xde')]=db[_0xe869('0x2')]['import'](_0xe869('0xdf'));db[_0xe869('0xe0')]=db[_0xe869('0x2')][_0xe869('0x14')]('../api/squareMessage/squareMessage.model');db[_0xe869('0xe1')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0xe2'));db['License']=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0xe3'));db[_0xe869('0xe4')]=db['sequelize']['import'](_0xe869('0xe5'));db['Migration']=db['sequelize'][_0xe869('0x14')](_0xe869('0xe6'));db[_0xe869('0xe7')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0xe8'));db[_0xe869('0xe9')]=db['sequelize'][_0xe869('0x14')](_0xe869('0xea'));db[_0xe869('0xeb')]=db[_0xe869('0x2')][_0xe869('0x14')]('../api/mailTransferReport/mailTransferReport.model');db[_0xe869('0xec')]=db[_0xe869('0x2')]['import'](_0xe869('0xed'));db[_0xe869('0xee')]=db[_0xe869('0x2')]['import'](_0xe869('0xef'));db['OpenchannelTransferReport']=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0xf0'));db[_0xe869('0xf1')]=db[_0xe869('0x2')][_0xe869('0x14')]('../api/smsTransferReport/smsTransferReport.model');db[_0xe869('0xf2')]=db['sequelize'][_0xe869('0x14')](_0xe869('0xf3'));db[_0xe869('0xf4')]=db['sequelize'][_0xe869('0x14')](_0xe869('0xf5'));db[_0xe869('0xf6')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0xf7'));db[_0xe869('0xf8')]=db[_0xe869('0x2')][_0xe869('0x14')]('../api/userProfileSection/userProfileSection.model');db[_0xe869('0xf9')]=db['sequelize'][_0xe869('0x14')](_0xe869('0xfa'));db['Notification']=db['sequelize'][_0xe869('0x14')](_0xe869('0xfb'));db[_0xe869('0xfc')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0xfd'));db['WhatsappApplication']=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0xfe'));db['WhatsappInteraction']=db['sequelize'][_0xe869('0x14')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0xe869('0xff')]=db['sequelize'][_0xe869('0x14')](_0xe869('0x100'));db[_0xe869('0x101')]=db['sequelize'][_0xe869('0x14')](_0xe869('0x102'));db[_0xe869('0x103')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0x104'));db[_0xe869('0x105')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0x106'));db[_0xe869('0x107')]=db[_0xe869('0x2')][_0xe869('0x14')](_0xe869('0x108'));db[_0xe869('0x109')][_0xe869('0x10a')](db[_0xe869('0x10b')],{'as':_0xe869('0x10b'),'onDelete':_0xe869('0x10c'),'foreignKey':_0xe869('0x10d')});db[_0xe869('0x109')][_0xe869('0x10e')](db[_0xe869('0x1c')],{'as':_0xe869('0x10f'),'foreignKey':_0xe869('0x10d')});db[_0xe869('0x109')][_0xe869('0x10e')](db[_0xe869('0x110')],{'as':'VoiceQueuesRt','foreignKey':_0xe869('0x10d')});db['User']['hasMany'](db[_0xe869('0x111')],{'as':_0xe869('0x112'),'onDelete':'cascade','hooks':!![]});db[_0xe869('0x109')][_0xe869('0x10e')](db[_0xe869('0x75')],{'as':_0xe869('0x113'),'foreignKey':_0xe869('0x10d')});db[_0xe869('0x109')][_0xe869('0x10e')](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':_0xe869('0x10d')});db['User'][_0xe869('0x10e')](db[_0xe869('0x114')],{'as':_0xe869('0x114'),'foreignKey':_0xe869('0x10d')});db['User']['hasMany'](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':_0xe869('0x10d')});db[_0xe869('0x109')]['hasMany'](db['ChatInteraction'],{'as':_0xe869('0x115'),'foreignKey':_0xe869('0x10d')});db[_0xe869('0x109')][_0xe869('0x10e')](db[_0xe869('0x55')],{'as':_0xe869('0x116'),'foreignKey':'UserId'});db[_0xe869('0x109')]['hasMany'](db['FaxInteraction'],{'as':'FaxInteractions','foreignKey':'UserId'});db[_0xe869('0x109')][_0xe869('0x10e')](db[_0xe869('0x3e')],{'as':_0xe869('0x117'),'foreignKey':_0xe869('0x10d')});db[_0xe869('0x109')]['hasMany'](db[_0xe869('0x118')],{'as':_0xe869('0x119'),'foreignKey':_0xe869('0x10d')});db['User'][_0xe869('0x10e')](db[_0xe869('0x11a')],{'as':'Notifications','foreignKey':'SenderId'});db[_0xe869('0x109')][_0xe869('0x11b')](db[_0xe869('0xf6')],{'as':_0xe869('0xf6'),'foreignKey':_0xe869('0x11c')});db[_0xe869('0x109')][_0xe869('0x11d')](db[_0xe869('0x6b')],{'as':_0xe869('0x11e'),'through':_0xe869('0x11f')});db[_0xe869('0x109')]['belongsToMany'](db['CmContact'],{'as':_0xe869('0x120'),'through':_0xe869('0x121')});db[_0xe869('0x109')][_0xe869('0x11d')](db[_0xe869('0xf2')],{'as':_0xe869('0x122'),'through':_0xe869('0x123')});db[_0xe869('0x109')][_0xe869('0x11d')](db[_0xe869('0xe1')],{'through':_0xe869('0x124')});db[_0xe869('0x109')][_0xe869('0x11d')](db['MailInteraction'],{'as':_0xe869('0x117'),'through':_0xe869('0x125')});db[_0xe869('0x109')][_0xe869('0x11d')](db[_0xe869('0x126')],{'as':_0xe869('0x115'),'through':'user_has_chat_interactions'});db[_0xe869('0x109')][_0xe869('0x11d')](db[_0xe869('0x4a')],{'as':_0xe869('0x127'),'through':_0xe869('0x128')});db['User'][_0xe869('0x11d')](db[_0xe869('0x55')],{'as':_0xe869('0x116'),'through':_0xe869('0x129')});db['User'][_0xe869('0x11d')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','through':_0xe869('0x12a')});db[_0xe869('0x109')][_0xe869('0x11d')](db[_0xe869('0x118')],{'as':'WhatsappInteractions','through':_0xe869('0x12b')});db[_0xe869('0x109')]['belongsToMany'](db['VoiceQueue'],{'as':_0xe869('0x12c'),'through':'UserVoiceQueue','required':![]});db[_0xe869('0x109')][_0xe869('0x11d')](db[_0xe869('0x3a')],{'as':'MailQueues','through':_0xe869('0x12d'),'required':![]});db['User'][_0xe869('0x11d')](db[_0xe869('0x69')],{'as':'ChatQueues','through':_0xe869('0x12e'),'required':![],'hooks':!![]});db[_0xe869('0x109')][_0xe869('0x11d')](db[_0xe869('0x4e')],{'as':_0xe869('0x12f'),'through':'UserFaxQueue','required':![]});db[_0xe869('0x109')][_0xe869('0x11d')](db[_0xe869('0x59')],{'as':_0xe869('0x130'),'through':'UserSmsQueue','required':![]});db[_0xe869('0x109')][_0xe869('0x11d')](db[_0xe869('0x5e')],{'as':'OpenchannelQueues','through':_0xe869('0x131'),'required':![]});db[_0xe869('0x109')][_0xe869('0x11d')](db[_0xe869('0x105')],{'as':'WhatsappQueues','through':_0xe869('0x132'),'required':![]});db[_0xe869('0x109')][_0xe869('0x11d')](db[_0xe869('0xf2')],{'through':'cm_user_has_lists'});db[_0xe869('0x109')]['belongsToMany'](db[_0xe869('0xf4')],{'as':'VoicePrefixes','through':'user_has_voice_prefixes','required':![]});db[_0xe869('0x109')][_0xe869('0x11d')](db[_0xe869('0x133')],{'as':_0xe869('0x134'),'through':_0xe869('0x135')});db[_0xe869('0x109')]['belongsToMany'](db[_0xe869('0x47')],{'as':_0xe869('0x136'),'through':_0xe869('0x137')});db[_0xe869('0x109')]['belongsToMany'](db[_0xe869('0x38')],{'as':_0xe869('0x138'),'through':_0xe869('0x139')});db['User'][_0xe869('0x11d')](db[_0xe869('0x5a')],{'as':'OpenchannelAccounts','through':_0xe869('0x13a')});db['User'][_0xe869('0x11d')](db[_0xe869('0x51')],{'as':_0xe869('0x13b'),'through':_0xe869('0x13c')});db['User']['belongsToMany'](db[_0xe869('0xfc')],{'as':'WhatsappAccounts','through':_0xe869('0x13d')});db['User'][_0xe869('0x11d')](db[_0xe869('0xdc')],{'as':'SquareProjects','through':_0xe869('0x13e')});db[_0xe869('0x13f')][_0xe869('0x10e')](db['VoiceExtension'],{'as':_0xe869('0x140'),'onDelete':_0xe869('0x10c'),'foreignKey':_0xe869('0x141')});db['VoiceContext'][_0xe869('0x10e')](db[_0xe869('0x111')],{'onDelete':'cascade'});db[_0xe869('0x111')]['hasMany'](db[_0xe869('0x111')],{'as':_0xe869('0x142'),'onDelete':_0xe869('0x10c')});db[_0xe869('0x18')][_0xe869('0x11d')](db[_0xe869('0x89')],{'as':_0xe869('0x143'),'through':_0xe869('0x144')});db[_0xe869('0x1a')]['hasMany'](db[_0xe869('0x110')],{'as':_0xe869('0x145'),'foreignKey':_0xe869('0x146')});db['VoiceQueue'][_0xe869('0x10e')](db[_0xe869('0x71')],{'as':'Hoppers','foreignKey':_0xe869('0x146')});db[_0xe869('0x1a')]['hasMany'](db[_0xe869('0x75')],{'as':_0xe869('0x113'),'foreignKey':_0xe869('0x146')});db[_0xe869('0x1a')][_0xe869('0x10e')](db[_0xe869('0x147')],{'as':'HopperHistories','foreignKey':_0xe869('0x146')});db[_0xe869('0x1a')][_0xe869('0x10e')](db[_0xe869('0x114')],{'as':_0xe869('0x114'),'foreignKey':_0xe869('0x146')});db[_0xe869('0x1a')][_0xe869('0x10e')](db[_0xe869('0x73')],{'as':_0xe869('0x148'),'foreignKey':'VoiceQueueId'});db['VoiceQueue']['hasMany'](db[_0xe869('0xd1')],{'as':_0xe869('0x149'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xe869('0x11b')](db[_0xe869('0x2b')],{'as':'Trunk','foreignKey':_0xe869('0x14a')});db[_0xe869('0x1a')][_0xe869('0x11b')](db[_0xe869('0x2b')],{'as':'TrunkBackup','foreignKey':_0xe869('0x14b')});db['VoiceQueue'][_0xe869('0x11b')](db['Interval'],{'as':_0xe869('0x14c'),'foreignKey':_0xe869('0x14d')});db[_0xe869('0x1a')]['belongsTo'](db[_0xe869('0x83')],{'as':'mandatoryDispositionPause','foreignKey':_0xe869('0x14e')});db[_0xe869('0x1a')][_0xe869('0x11d')](db['CmList'],{'as':_0xe869('0x122'),'through':_0xe869('0x14f')});db[_0xe869('0x1a')][_0xe869('0x11d')](db[_0xe869('0x109')],{'as':_0xe869('0x150'),'through':_0xe869('0x30')});db[_0xe869('0x1a')][_0xe869('0x11d')](db['Team'],{'as':'Teams','through':_0xe869('0x151')});db[_0xe869('0x1a')]['belongsToMany'](db['CmList'],{'as':_0xe869('0x152'),'through':_0xe869('0x153')});db[_0xe869('0x1c')][_0xe869('0x11b')](db['User'],{'as':_0xe869('0x109'),'foreignKey':_0xe869('0x10d')});db[_0xe869('0x1e')][_0xe869('0x11b')](db['User'],{'as':_0xe869('0x109'),'foreignKey':_0xe869('0x10d')});db[_0xe869('0x10b')][_0xe869('0x10e')](db[_0xe869('0x21')],{'as':_0xe869('0x154'),'onDelete':_0xe869('0x10c'),'foreignKey':'mailboxuser','sourceKey':'mailbox'});db['VoiceMailMessage'][_0xe869('0x11b')](db[_0xe869('0x10b')],{'foreignKey':_0xe869('0x155'),'targetKey':'mailbox'});db[_0xe869('0x23')][_0xe869('0x10e')](db[_0xe869('0x29')],{'as':_0xe869('0x156'),'foreignKey':'uniqueid','constraints':![]});db[_0xe869('0x23')][_0xe869('0x10e')](db['VoiceAgentReport'],{'as':'AgentReports','foreignKey':_0xe869('0x157'),'constraints':![]});db[_0xe869('0x23')][_0xe869('0x11b')](db[_0xe869('0x109')],{'as':_0xe869('0x109'),'foreignKey':_0xe869('0x10d')});db[_0xe869('0x23')][_0xe869('0x11b')](db[_0xe869('0x6f')],{'as':_0xe869('0x158'),'foreignKey':_0xe869('0x159')});db['MailServerIn'][_0xe869('0x11b')](db['MailAccount'],{'as':_0xe869('0x38'),'foreignKey':'MailAccountId'});db[_0xe869('0x15a')][_0xe869('0x11b')](db[_0xe869('0x38')],{'as':_0xe869('0x38'),'foreignKey':_0xe869('0x15b')});db[_0xe869('0x38')][_0xe869('0x10a')](db[_0xe869('0x36')],{'as':_0xe869('0x15c'),'onDelete':_0xe869('0x10c')});db[_0xe869('0x38')][_0xe869('0x10a')](db[_0xe869('0x15a')],{'as':_0xe869('0x15d'),'onDelete':_0xe869('0x10c')});db[_0xe869('0x38')][_0xe869('0x10e')](db[_0xe869('0x7f')],{'as':_0xe869('0x15e'),'foreignKey':_0xe869('0x15b')});db[_0xe869('0x38')][_0xe869('0x10e')](db[_0xe869('0x7d')],{'as':_0xe869('0x15f'),'foreignKey':'MailAccountId'});db[_0xe869('0x38')][_0xe869('0x10e')](db['MailMessage'],{'as':_0xe869('0x154'),'foreignKey':_0xe869('0x15b')});db[_0xe869('0x38')][_0xe869('0x10e')](db[_0xe869('0x3e')],{'as':_0xe869('0x160')});db[_0xe869('0x38')]['hasMany'](db[_0xe869('0x161')],{'as':_0xe869('0x142')});db[_0xe869('0x38')][_0xe869('0x11b')](db['CmList'],{'as':_0xe869('0x162'),'foreignKey':'ListId'});db['MailAccount'][_0xe869('0x11b')](db[_0xe869('0x8d')],{'as':'Template','foreignKey':_0xe869('0x163')});db[_0xe869('0x38')]['belongsTo'](db[_0xe869('0x83')],{'as':'mandatoryDispositionPause','foreignKey':_0xe869('0x14e')});db[_0xe869('0x38')][_0xe869('0x11d')](db['User'],{'as':_0xe869('0x150'),'through':_0xe869('0x139')});db['MailQueue'][_0xe869('0x11d')](db[_0xe869('0x109')],{'as':_0xe869('0x150'),'through':_0xe869('0x12d')});db['MailQueue'][_0xe869('0x11d')](db[_0xe869('0xe1')],{'through':_0xe869('0x164'),'as':_0xe869('0x165')});db[_0xe869('0x3e')][_0xe869('0x10e')](db[_0xe869('0x166')],{'as':_0xe869('0x154'),'onDelete':_0xe869('0x10c'),'foreignKey':_0xe869('0x167')});db['MailInteraction'][_0xe869('0x11b')](db[_0xe869('0x38')],{'as':_0xe869('0x168'),'foreignKey':_0xe869('0x15b')});db[_0xe869('0x3e')][_0xe869('0x11b')](db[_0xe869('0x6f')],{'as':_0xe869('0x158'),'foreignKey':_0xe869('0x159')});db[_0xe869('0x3e')]['belongsTo'](db[_0xe869('0x109')],{'as':_0xe869('0x169'),'foreignKey':'UserId'});db[_0xe869('0x3e')][_0xe869('0x11d')](db[_0xe869('0x8b')],{'through':_0xe869('0x16a'),'as':_0xe869('0x16b')});db[_0xe869('0x3e')][_0xe869('0x11d')](db[_0xe869('0x8b')],{'through':_0xe869('0x16a'),'as':'ThroughTags'});db['MailInteraction'][_0xe869('0x11d')](db[_0xe869('0x109')],{'as':_0xe869('0x16c'),'through':_0xe869('0x125'),'foreignKey':'MailInteractionId'});db[_0xe869('0x166')][_0xe869('0x10e')](db[_0xe869('0xe7')],{'as':'Attachments','onDelete':_0xe869('0x10c')});db['MailMessage'][_0xe869('0x11b')](db[_0xe869('0x109')],{'as':'User'});db[_0xe869('0x166')][_0xe869('0x11b')](db['CmContact'],{'onDelete':_0xe869('0x10c'),'as':'Contact'});db[_0xe869('0x166')][_0xe869('0x11b')](db[_0xe869('0x3e')],{'as':'Interaction','foreignKey':'MailInteractionId'});db[_0xe869('0x166')][_0xe869('0x11b')](db[_0xe869('0x38')],{'as':_0xe869('0x168'),'foreignKey':_0xe869('0x15b')});db['MailApplication'][_0xe869('0x11b')](db[_0xe869('0x109')],{'onDelete':'restrict'});db[_0xe869('0x161')][_0xe869('0x11b')](db[_0xe869('0x3a')],{'onDelete':_0xe869('0x16d')});db['MailApplication'][_0xe869('0x11b')](db[_0xe869('0x38')],{'onDelete':_0xe869('0x16d')});db[_0xe869('0x161')]['belongsTo'](db[_0xe869('0x14c')],{'onDelete':'restrict','foreignKey':_0xe869('0x14d')});db[_0xe869('0x161')][_0xe869('0x11b')](db['Tag'],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xe869('0x42')][_0xe869('0x11b')](db[_0xe869('0x38')],{});db['MailQueueReport'][_0xe869('0x11b')](db[_0xe869('0xf2')],{'as':'List','foreignKey':_0xe869('0x16e')});db[_0xe869('0x42')][_0xe869('0x11b')](db['CmContact'],{'as':_0xe869('0x158'),'foreignKey':_0xe869('0x159')});db['MailQueueReport'][_0xe869('0x11b')](db[_0xe869('0x3e')],{});db[_0xe869('0x42')][_0xe869('0x11b')](db['MailMessage'],{});db[_0xe869('0x42')][_0xe869('0x11b')](db['User'],{});db[_0xe869('0x42')]['belongsTo'](db[_0xe869('0x3a')],{});db['Dashboard'][_0xe869('0x10e')](db[_0xe869('0x45')],{'as':_0xe869('0x16f'),'onDelete':_0xe869('0x10c')});db[_0xe869('0x47')][_0xe869('0x10e')](db[_0xe869('0x7f')],{'as':_0xe869('0x15e'),'foreignKey':_0xe869('0x170')});db[_0xe869('0x47')][_0xe869('0x10e')](db['CannedAnswer'],{'as':_0xe869('0x15f'),'foreignKey':'FaxAccountId'});db[_0xe869('0x47')][_0xe869('0x10e')](db['FaxInteraction'],{'as':_0xe869('0x160')});db[_0xe869('0x47')][_0xe869('0x10e')](db[_0xe869('0x48')],{'as':_0xe869('0x142')});db['FaxAccount'][_0xe869('0x10e')](db[_0xe869('0x111')],{'as':_0xe869('0x171'),'onDelete':'cascade'});db[_0xe869('0x47')][_0xe869('0x10e')](db['FaxMessage'],{'as':_0xe869('0x154')});db[_0xe869('0x47')][_0xe869('0x11b')](db[_0xe869('0x2b')],{'as':_0xe869('0x2b')});db[_0xe869('0x47')][_0xe869('0x11b')](db['CmList'],{'as':_0xe869('0x162'),'foreignKey':_0xe869('0x16e')});db[_0xe869('0x47')][_0xe869('0x11b')](db['Pause'],{'as':_0xe869('0x172'),'foreignKey':_0xe869('0x14e')});db[_0xe869('0x47')][_0xe869('0x11d')](db[_0xe869('0x109')],{'as':_0xe869('0x150'),'through':_0xe869('0x137')});db['FaxApplication'][_0xe869('0x11b')](db['User'],{'onDelete':_0xe869('0x16d')});db[_0xe869('0x48')][_0xe869('0x11b')](db[_0xe869('0x4e')],{'onDelete':_0xe869('0x16d')});db[_0xe869('0x48')][_0xe869('0x11b')](db[_0xe869('0x47')],{'onDelete':_0xe869('0x16d')});db[_0xe869('0x48')][_0xe869('0x11b')](db[_0xe869('0x8b')],{'onDelete':_0xe869('0x16d'),'foreignKey':_0xe869('0x173')});db['FaxInteraction']['hasMany'](db['FaxMessage'],{'as':_0xe869('0x154'),'onDelete':_0xe869('0x10c'),'foreignKey':_0xe869('0x174')});db[_0xe869('0x4a')][_0xe869('0x11b')](db[_0xe869('0x47')],{'as':_0xe869('0x168'),'foreignKey':_0xe869('0x170')});db[_0xe869('0x4a')][_0xe869('0x11b')](db['CmContact'],{'as':_0xe869('0x158'),'foreignKey':_0xe869('0x159')});db[_0xe869('0x4a')]['belongsTo'](db[_0xe869('0x109')],{'as':_0xe869('0x169'),'foreignKey':'UserId'});db[_0xe869('0x4a')][_0xe869('0x11d')](db['Tag'],{'through':'fax_interaction_has_tags','as':_0xe869('0x16b')});db[_0xe869('0x4a')][_0xe869('0x11d')](db[_0xe869('0x8b')],{'through':_0xe869('0x175'),'as':_0xe869('0x176')});db[_0xe869('0x4a')][_0xe869('0x11d')](db[_0xe869('0x109')],{'as':'Users','through':_0xe869('0x128'),'foreignKey':_0xe869('0x174')});db[_0xe869('0x4c')][_0xe869('0x11b')](db[_0xe869('0x109')],{'onDelete':_0xe869('0x10c'),'as':_0xe869('0x109')});db[_0xe869('0x4c')][_0xe869('0x11b')](db[_0xe869('0x4a')],{'as':_0xe869('0x177'),'foreignKey':_0xe869('0x174')});db[_0xe869('0x4c')][_0xe869('0x11b')](db[_0xe869('0x6f')],{'onDelete':'cascade','as':_0xe869('0x158')});db['FaxMessage'][_0xe869('0x11b')](db['Attachment'],{'as':'Attachment','foreignKey':_0xe869('0x178')});db[_0xe869('0x4c')]['belongsTo'](db[_0xe869('0x47')],{'as':_0xe869('0x168'),'foreignKey':'FaxAccountId'});db['FaxQueue'][_0xe869('0x11d')](db[_0xe869('0x109')],{'as':'Agents','through':_0xe869('0x179')});db[_0xe869('0x4e')][_0xe869('0x11d')](db[_0xe869('0xe1')],{'through':_0xe869('0x17a'),'as':_0xe869('0x165')});db[_0xe869('0x50')]['belongsTo'](db['FaxAccount'],{});db[_0xe869('0x50')]['belongsTo'](db[_0xe869('0xf2')],{'as':_0xe869('0x162'),'foreignKey':_0xe869('0x16e')});db['FaxQueueReport'][_0xe869('0x11b')](db['CmContact'],{'as':_0xe869('0x158'),'foreignKey':_0xe869('0x159')});db[_0xe869('0x50')][_0xe869('0x11b')](db[_0xe869('0x4a')],{});db['FaxQueueReport'][_0xe869('0x11b')](db['FaxMessage'],{});db[_0xe869('0x50')][_0xe869('0x11b')](db[_0xe869('0x109')],{});db['FaxQueueReport'][_0xe869('0x11b')](db['FaxQueue'],{});db[_0xe869('0x51')][_0xe869('0x10e')](db[_0xe869('0x7f')],{'as':_0xe869('0x15e'),'foreignKey':_0xe869('0x17b')});db[_0xe869('0x51')]['hasMany'](db[_0xe869('0x7d')],{'as':_0xe869('0x15f'),'foreignKey':_0xe869('0x17b')});db[_0xe869('0x51')][_0xe869('0x10e')](db[_0xe869('0x57')],{'as':_0xe869('0x154'),'foreignKey':'SmsAccountId'});db['SmsAccount']['hasMany'](db['SmsInteraction'],{'as':_0xe869('0x160')});db[_0xe869('0x51')]['hasMany'](db[_0xe869('0x53')],{'as':_0xe869('0x142')});db['SmsAccount'][_0xe869('0x11b')](db[_0xe869('0xf2')],{'as':_0xe869('0x162'),'foreignKey':_0xe869('0x16e')});db[_0xe869('0x51')][_0xe869('0x11b')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xe869('0x14e')});db['SmsAccount'][_0xe869('0x11d')](db['User'],{'as':_0xe869('0x150'),'through':_0xe869('0x13c')});db[_0xe869('0x53')][_0xe869('0x11b')](db[_0xe869('0x109')],{'onDelete':_0xe869('0x16d')});db[_0xe869('0x53')][_0xe869('0x11b')](db[_0xe869('0x59')],{'onDelete':'restrict'});db['SmsApplication'][_0xe869('0x11b')](db[_0xe869('0x51')],{'onDelete':'restrict'});db[_0xe869('0x53')][_0xe869('0x11b')](db[_0xe869('0x14c')],{'onDelete':_0xe869('0x16d'),'foreignKey':'IntervalId'});db['SmsApplication'][_0xe869('0x11b')](db[_0xe869('0x8b')],{'onDelete':_0xe869('0x16d'),'foreignKey':'TagId'});db[_0xe869('0x55')][_0xe869('0x10e')](db[_0xe869('0x57')],{'as':_0xe869('0x154'),'onDelete':'cascade','foreignKey':'SmsInteractionId'});db[_0xe869('0x55')][_0xe869('0x11b')](db[_0xe869('0x51')],{'as':_0xe869('0x168'),'foreignKey':'SmsAccountId'});db[_0xe869('0x55')][_0xe869('0x11b')](db[_0xe869('0x6f')],{'as':_0xe869('0x158'),'foreignKey':_0xe869('0x159')});db[_0xe869('0x55')]['belongsTo'](db[_0xe869('0x109')],{'as':_0xe869('0x169'),'foreignKey':'UserId'});db['SmsInteraction'][_0xe869('0x11d')](db['Tag'],{'through':'sms_interaction_has_tags','as':_0xe869('0x16b')});db[_0xe869('0x55')][_0xe869('0x11d')](db['Tag'],{'through':_0xe869('0x17c'),'as':_0xe869('0x176')});db[_0xe869('0x55')]['belongsToMany'](db[_0xe869('0x109')],{'as':'Users','through':_0xe869('0x129'),'foreignKey':_0xe869('0x17d')});db[_0xe869('0x57')]['belongsTo'](db[_0xe869('0x109')],{'as':_0xe869('0x109')});db[_0xe869('0x57')][_0xe869('0x11b')](db[_0xe869('0x6f')],{'onDelete':'cascade','as':_0xe869('0x158')});db[_0xe869('0x57')]['belongsTo'](db['SmsInteraction'],{'onDelete':_0xe869('0x10c'),'as':_0xe869('0x177'),'foreignKey':_0xe869('0x17d')});db[_0xe869('0x57')]['belongsTo'](db[_0xe869('0x51')],{'as':_0xe869('0x168'),'foreignKey':_0xe869('0x17b')});db[_0xe869('0x59')]['belongsToMany'](db[_0xe869('0x109')],{'as':'Agents','through':'UserSmsQueue','foreignKey':'SmsQueueId'});db[_0xe869('0x59')][_0xe869('0x11d')](db[_0xe869('0xe1')],{'through':_0xe869('0x17e'),'as':'Teams'});db[_0xe869('0x5a')][_0xe869('0x10e')](db['Disposition'],{'as':_0xe869('0x15e'),'foreignKey':_0xe869('0x17f')});db['OpenchannelAccount'][_0xe869('0x10e')](db[_0xe869('0x7d')],{'as':'Answers','foreignKey':'OpenchannelAccountId'});db[_0xe869('0x5a')]['hasMany'](db['OpenchannelInteraction'],{'as':_0xe869('0x160'),'foreignKey':_0xe869('0x17f')});db[_0xe869('0x5a')][_0xe869('0x10e')](db[_0xe869('0x180')],{'as':'Messages','foreignKey':'OpenchannelAccountId'});db[_0xe869('0x5a')][_0xe869('0x10e')](db[_0xe869('0x181')],{'as':_0xe869('0x142'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount']['belongsTo'](db[_0xe869('0xf2')],{'as':_0xe869('0x162'),'foreignKey':_0xe869('0x16e')});db[_0xe869('0x5a')][_0xe869('0x11b')](db[_0xe869('0x83')],{'as':_0xe869('0x172'),'foreignKey':_0xe869('0x14e')});db[_0xe869('0x5a')][_0xe869('0x11d')](db[_0xe869('0x109')],{'as':_0xe869('0x150'),'through':_0xe869('0x13a')});db['OpenchannelApplication'][_0xe869('0x11b')](db['User'],{'onDelete':'restrict'});db[_0xe869('0x181')]['belongsTo'](db[_0xe869('0x5e')],{'onDelete':_0xe869('0x16d'),'foreignKey':'OpenchannelQueueId'});db[_0xe869('0x181')]['belongsTo'](db[_0xe869('0x5a')],{'onDelete':'restrict','foreignKey':'OpenchannelAccountId'});db['OpenchannelApplication'][_0xe869('0x11b')](db[_0xe869('0x14c')],{'onDelete':_0xe869('0x16d'),'foreignKey':_0xe869('0x14d')});db[_0xe869('0x181')][_0xe869('0x11b')](db[_0xe869('0x8b')],{'onDelete':_0xe869('0x16d'),'foreignKey':_0xe869('0x173')});db[_0xe869('0x5d')][_0xe869('0x10e')](db[_0xe869('0x180')],{'as':_0xe869('0x154'),'onDelete':_0xe869('0x10c'),'foreignKey':_0xe869('0x182')});db[_0xe869('0x5d')]['belongsTo'](db['OpenchannelAccount'],{'as':_0xe869('0x168'),'foreignKey':_0xe869('0x17f')});db[_0xe869('0x5d')][_0xe869('0x11b')](db['CmContact'],{'as':_0xe869('0x158'),'foreignKey':_0xe869('0x159')});db[_0xe869('0x5d')][_0xe869('0x11b')](db[_0xe869('0x109')],{'as':'Owner','foreignKey':_0xe869('0x10d')});db['OpenchannelInteraction'][_0xe869('0x11d')](db[_0xe869('0x8b')],{'through':'openchannel_interaction_has_tags','as':_0xe869('0x16b')});db[_0xe869('0x5d')]['belongsToMany'](db['Tag'],{'through':_0xe869('0x183'),'as':_0xe869('0x176')});db[_0xe869('0x5d')]['belongsToMany'](db[_0xe869('0x109')],{'as':_0xe869('0x16c'),'through':_0xe869('0x12a'),'foreignKey':_0xe869('0x182')});db['OpenchannelMessage']['belongsTo'](db[_0xe869('0x109')],{'onDelete':_0xe869('0x10c'),'as':_0xe869('0x109')});db['OpenchannelMessage'][_0xe869('0x11b')](db[_0xe869('0x6f')],{'onDelete':_0xe869('0x10c'),'as':_0xe869('0x158')});db[_0xe869('0x180')]['belongsTo'](db['OpenchannelInteraction'],{'onDelete':'cascade','as':'Interaction','foreignKey':'OpenchannelInteractionId'});db[_0xe869('0x180')][_0xe869('0x11b')](db[_0xe869('0xe7')],{'as':_0xe869('0xe7'),'foreignKey':_0xe869('0x178')});db[_0xe869('0x180')][_0xe869('0x11b')](db[_0xe869('0x5a')],{'as':_0xe869('0x168'),'foreignKey':'OpenchannelAccountId'});db[_0xe869('0x5e')][_0xe869('0x11d')](db[_0xe869('0x109')],{'as':'Agents','through':_0xe869('0x131'),'foreignKey':_0xe869('0x184')});db[_0xe869('0x5e')][_0xe869('0x11d')](db[_0xe869('0xe1')],{'through':_0xe869('0x185'),'as':_0xe869('0x165')});db[_0xe869('0x133')]['hasMany'](db[_0xe869('0x7f')],{'as':_0xe869('0x15e'),'foreignKey':'ChatWebsiteId'});db[_0xe869('0x133')][_0xe869('0x10e')](db['CannedAnswer'],{'as':_0xe869('0x15f'),'foreignKey':_0xe869('0x186')});db[_0xe869('0x133')][_0xe869('0x10e')](db['ChatProactiveAction'],{'as':_0xe869('0x187')});db['ChatWebsite'][_0xe869('0x10e')](db[_0xe869('0x126')],{'as':_0xe869('0x160')});db[_0xe869('0x133')][_0xe869('0x10e')](db['ChatApplication'],{'as':'Applications'});db[_0xe869('0x133')][_0xe869('0x10e')](db[_0xe869('0x66')],{'as':_0xe869('0x154')});db[_0xe869('0x133')]['belongsTo'](db[_0xe869('0xf2')],{'as':_0xe869('0x162'),'foreignKey':_0xe869('0x16e')});db[_0xe869('0x133')]['belongsTo'](db[_0xe869('0x14c')],{'as':_0xe869('0x14c'),'foreignKey':_0xe869('0x14d')});db['ChatWebsite'][_0xe869('0x11b')](db[_0xe869('0x83')],{'as':_0xe869('0x172'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xe869('0x133')][_0xe869('0x11d')](db['User'],{'as':_0xe869('0x150'),'through':'user_has_chat_websites'});db[_0xe869('0x61')][_0xe869('0x11b')](db[_0xe869('0x5a')],{});db[_0xe869('0x61')][_0xe869('0x11b')](db[_0xe869('0xf2')],{'as':_0xe869('0x162'),'foreignKey':_0xe869('0x16e')});db[_0xe869('0x61')][_0xe869('0x11b')](db['CmContact'],{'as':_0xe869('0x158'),'foreignKey':'ContactId'});db['OpenchannelQueueReport'][_0xe869('0x11b')](db[_0xe869('0x5d')],{});db[_0xe869('0x61')]['belongsTo'](db[_0xe869('0x180')],{});db['OpenchannelQueueReport'][_0xe869('0x11b')](db[_0xe869('0x109')],{});db[_0xe869('0x61')]['belongsTo'](db[_0xe869('0x5e')],{});db[_0xe869('0x63')][_0xe869('0x11b')](db['User'],{'as':_0xe869('0x188'),'foreignKey':_0xe869('0x10d'),'onDelete':'restrict'});db[_0xe869('0x63')][_0xe869('0x11b')](db[_0xe869('0x69')],{'as':'Queue','foreignKey':_0xe869('0x189'),'onDelete':'restrict'});db[_0xe869('0x63')][_0xe869('0x11b')](db[_0xe869('0x133')],{'as':_0xe869('0x18a'),'foreignKey':_0xe869('0x186'),'onDelete':_0xe869('0x16d')});db[_0xe869('0x63')][_0xe869('0x11b')](db[_0xe869('0x8b')],{'onDelete':'restrict','foreignKey':_0xe869('0x173')});db[_0xe869('0x126')][_0xe869('0x10e')](db[_0xe869('0x66')],{'as':_0xe869('0x154'),'onDelete':_0xe869('0x10c'),'foreignKey':'ChatInteractionId'});db[_0xe869('0x126')][_0xe869('0x11b')](db[_0xe869('0x133')],{'as':_0xe869('0x168'),'foreignKey':_0xe869('0x186')});db[_0xe869('0x126')]['belongsTo'](db[_0xe869('0x6f')],{'as':'Contact','foreignKey':_0xe869('0x159')});db[_0xe869('0x126')][_0xe869('0x11b')](db[_0xe869('0x109')],{'as':_0xe869('0x169'),'foreignKey':_0xe869('0x10d')});db[_0xe869('0x126')][_0xe869('0x11d')](db[_0xe869('0x8b')],{'through':_0xe869('0x18b'),'as':_0xe869('0x16b')});db[_0xe869('0x126')][_0xe869('0x11d')](db['Tag'],{'through':_0xe869('0x18b'),'as':_0xe869('0x176')});db['ChatInteraction'][_0xe869('0x11d')](db[_0xe869('0x109')],{'as':_0xe869('0x16c'),'through':_0xe869('0x18c'),'foreignKey':_0xe869('0x18d')});db['ChatMessage']['belongsTo'](db[_0xe869('0x109')],{'onDelete':_0xe869('0x10c'),'as':_0xe869('0x109')});db[_0xe869('0x66')][_0xe869('0x11b')](db[_0xe869('0x6f')],{'onDelete':'cascade','as':'Contact','foreignKey':_0xe869('0x159')});db[_0xe869('0x66')][_0xe869('0x11b')](db[_0xe869('0x126')],{'onDelete':_0xe869('0x10c'),'as':'Interaction','foreignKey':_0xe869('0x18d')});db[_0xe869('0x66')]['belongsTo'](db['Attachment'],{'as':_0xe869('0xe7'),'foreignKey':_0xe869('0x178')});db['ChatMessage'][_0xe869('0x11b')](db['ChatWebsite'],{'as':_0xe869('0x168'),'foreignKey':'ChatWebsiteId'});db[_0xe869('0x68')]['belongsTo'](db[_0xe869('0x6f')],{'onDelete':_0xe869('0x10c'),'as':_0xe869('0x158'),'foreignKey':_0xe869('0x159')});db[_0xe869('0x68')][_0xe869('0x11b')](db[_0xe869('0x133')],{'as':_0xe869('0x168'),'foreignKey':'ChatWebsiteId'});db['ChatQueue'][_0xe869('0x11d')](db[_0xe869('0x109')],{'as':_0xe869('0x150'),'through':_0xe869('0x12e'),'hooks':!![]});db[_0xe869('0x69')]['belongsToMany'](db[_0xe869('0xe1')],{'through':_0xe869('0x18e'),'as':_0xe869('0x165')});db[_0xe869('0x6b')][_0xe869('0x10e')](db[_0xe869('0xcc')],{'as':_0xe869('0x154'),'foreignKey':_0xe869('0x18f'),'onDelete':'cascade'});db[_0xe869('0x6b')]['belongsToMany'](db[_0xe869('0x109')],{'as':_0xe869('0x145'),'through':_0xe869('0x11f')});db[_0xe869('0x6d')][_0xe869('0x11b')](db[_0xe869('0x133')],{'as':_0xe869('0x18a'),'foreignKey':_0xe869('0x186')});db[_0xe869('0x190')][_0xe869('0x10e')](db[_0xe869('0x6f')],{'as':'Contacts','foreignKey':_0xe869('0x191')});db[_0xe869('0x6f')][_0xe869('0x10e')](db[_0xe869('0x71')],{'as':_0xe869('0x192'),'foreignKey':'ContactId'});db['CmContact'][_0xe869('0x10e')](db[_0xe869('0x75')],{'as':_0xe869('0x113'),'foreignKey':_0xe869('0x159')});db[_0xe869('0x6f')]['hasMany'](db[_0xe869('0x147')],{'as':_0xe869('0x193'),'foreignKey':_0xe869('0x159')});db[_0xe869('0x6f')][_0xe869('0x10e')](db[_0xe869('0x114')],{'as':_0xe869('0x114'),'foreignKey':_0xe869('0x159')});db[_0xe869('0x6f')]['hasMany'](db[_0xe869('0xd1')],{'as':_0xe869('0x149'),'foreignKey':'ContactId'});db[_0xe869('0x6f')][_0xe869('0x10e')](db[_0xe869('0x5d')],{'as':_0xe869('0x194'),'foreignKey':_0xe869('0x159'),'onDelete':_0xe869('0x16d')});db['CmContact']['hasMany'](db[_0xe869('0x126')],{'as':'ChatInteractions','foreignKey':_0xe869('0x159'),'onDelete':_0xe869('0x16d')});db[_0xe869('0x6f')][_0xe869('0x10e')](db[_0xe869('0x55')],{'as':'SmsInteractions','foreignKey':_0xe869('0x159'),'onDelete':_0xe869('0x16d')});db['CmContact'][_0xe869('0x10e')](db['FaxInteraction'],{'as':'FaxInteractions','foreignKey':'ContactId','onDelete':_0xe869('0x16d')});db[_0xe869('0x6f')]['hasMany'](db[_0xe869('0x3e')],{'as':_0xe869('0x117'),'foreignKey':'ContactId','onDelete':_0xe869('0x16d')});db['CmContact'][_0xe869('0x11b')](db[_0xe869('0x190')],{'as':_0xe869('0x195'),'foreignKey':_0xe869('0x191')});db[_0xe869('0x6f')][_0xe869('0x11b')](db['CmList'],{'as':_0xe869('0x162'),'foreignKey':_0xe869('0x16e'),'onDelete':_0xe869('0x10c')});db[_0xe869('0x6f')]['belongsToMany'](db[_0xe869('0x109')],{'as':_0xe869('0x16c'),'through':_0xe869('0x121')});db[_0xe869('0x6f')][_0xe869('0x11d')](db[_0xe869('0x8b')],{'as':'Tags','through':_0xe869('0x196')});db[_0xe869('0x6f')][_0xe869('0x11d')](db[_0xe869('0x8b')],{'through':_0xe869('0x196'),'as':_0xe869('0x176')});db[_0xe869('0x71')][_0xe869('0x11b')](db['CmContact'],{'as':_0xe869('0x158'),'foreignKey':_0xe869('0x159'),'onDelete':_0xe869('0x10c')});db['CmHopper']['belongsTo'](db[_0xe869('0xf2')],{'as':_0xe869('0x162'),'foreignKey':'ListId','onDelete':_0xe869('0x10c')});db['CmHopper'][_0xe869('0x11b')](db['User'],{'as':'Agent','foreignKey':_0xe869('0x10d')});db[_0xe869('0x71')][_0xe869('0x11b')](db[_0xe869('0x1a')],{'as':'Queue','foreignKey':_0xe869('0x146'),'onDelete':'cascade'});db['CmHopper']['belongsTo'](db[_0xe869('0xe4')],{'as':_0xe869('0xe4'),'foreignKey':_0xe869('0x197'),'onDelete':_0xe869('0x10c')});db[_0xe869('0x71')][_0xe869('0x11b')](db['User'],{'as':_0xe869('0x169'),'foreignKey':_0xe869('0x198')});db[_0xe869('0x73')]['belongsTo'](db[_0xe869('0x6f')],{'as':_0xe869('0x158'),'foreignKey':_0xe869('0x159'),'onDelete':_0xe869('0x10c')});db[_0xe869('0x73')][_0xe869('0x11b')](db[_0xe869('0xf2')],{'as':_0xe869('0x162'),'foreignKey':'ListId','onDelete':_0xe869('0x10c')});db['CmHopperBlack'][_0xe869('0x11b')](db[_0xe869('0x1a')],{'as':'Queue','foreignKey':_0xe869('0x146'),'onDelete':_0xe869('0x10c')});db['CmHopperBlack'][_0xe869('0x11b')](db[_0xe869('0xe4')],{'as':'Campaign','foreignKey':_0xe869('0x197'),'onDelete':'cascade'});db[_0xe869('0x199')]['hasMany'](db[_0xe869('0x19a')],{'as':{'plural':_0xe869('0x19b'),'singular':_0xe869('0x19c')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0xe869('0x199')]['hasMany'](db[_0xe869('0x19a')],{'as':{'plural':_0xe869('0x19d'),'singular':_0xe869('0x19e')},'foreignKey':'AutomationAnyId','onDelete':_0xe869('0x10c'),'hooks':!![]});db[_0xe869('0x199')]['hasMany'](db['Action'],{'as':_0xe869('0x19f'),'foreignKey':_0xe869('0x1a0'),'onDelete':'cascade','hooks':!![]});db['Interval'][_0xe869('0x10e')](db[_0xe869('0x14c')],{'as':_0xe869('0x1a1'),'foreignKey':_0xe869('0x14d'),'onDelete':_0xe869('0x10c'),'hooks':!![],'required':![]});db[_0xe869('0x14c')]['hasMany'](db[_0xe869('0x111')],{'as':_0xe869('0x112'),'foreignKey':'IntervalId','onDelete':_0xe869('0x16d')});db[_0xe869('0x14c')][_0xe869('0x10e')](db['MailApplication'],{'as':_0xe869('0x1a2'),'foreignKey':_0xe869('0x14d')});db[_0xe869('0x14c')]['hasMany'](db[_0xe869('0x63')],{'as':_0xe869('0x1a3'),'foreignKey':'IntervalId'});db[_0xe869('0x14c')][_0xe869('0x10e')](db[_0xe869('0x48')],{'as':'FaxApplications','foreignKey':'IntervalId'});db[_0xe869('0x14c')][_0xe869('0x10e')](db[_0xe869('0x53')],{'as':'SmsApplications','foreignKey':'IntervalId'});db[_0xe869('0x1a4')][_0xe869('0x11b')](db[_0xe869('0x38')],{});db[_0xe869('0x1a4')][_0xe869('0x11b')](db[_0xe869('0x1a5')],{'foreignKey':'DefaultReportId'});db[_0xe869('0x1a4')]['belongsTo'](db[_0xe869('0x96')],{'foreignKey':_0xe869('0x1a6')});db[_0xe869('0x89')][_0xe869('0x11d')](db['VoiceMusicOnHold'],{'as':'Mohs','through':_0xe869('0x144'),'onDelete':'restrict'});db[_0xe869('0x8b')][_0xe869('0x11d')](db['CmContact'],{'through':_0xe869('0x196')});db[_0xe869('0x8b')]['belongsToMany'](db[_0xe869('0x126')],{'through':_0xe869('0x18b')});db['Tag'][_0xe869('0x11d')](db['MailInteraction'],{'through':_0xe869('0x16a')});db[_0xe869('0x8b')][_0xe869('0x11d')](db[_0xe869('0x55')],{'through':_0xe869('0x17c')});db[_0xe869('0x8b')][_0xe869('0x11d')](db['FaxInteraction'],{'through':_0xe869('0x175')});db[_0xe869('0x8b')]['belongsToMany'](db['OpenchannelInteraction'],{'through':_0xe869('0x183')});db[_0xe869('0x8b')]['belongsToMany'](db['WhatsappInteraction'],{'through':_0xe869('0x1a7')});db[_0xe869('0x8f')][_0xe869('0x10e')](db[_0xe869('0x19a')],{'as':{'plural':_0xe869('0x1a8'),'singular':_0xe869('0x1a9')},'foreignKey':_0xe869('0x1aa'),'onDelete':_0xe869('0x10c'),'hooks':!![]});db[_0xe869('0x8f')][_0xe869('0x10e')](db['Condition'],{'as':{'plural':_0xe869('0x1ab'),'singular':_0xe869('0x1ac')},'foreignKey':'TriggerAnyId','onDelete':'cascade','hooks':!![]});db[_0xe869('0x8f')][_0xe869('0x10e')](db[_0xe869('0x7a')],{'as':_0xe869('0x19f'),'foreignKey':_0xe869('0x1ad'),'onDelete':'cascade','hooks':!![]});db['AnalyticCustomReport'][_0xe869('0x10e')](db[_0xe869('0x9b')],{'as':_0xe869('0x1ae'),'onDelete':_0xe869('0x10c'),'foreignKey':'CustomReportId','hooks':!![]});db[_0xe869('0x1a5')][_0xe869('0x10e')](db[_0xe869('0x9b')],{'as':_0xe869('0x1ae'),'onDelete':_0xe869('0x10c'),'foreignKey':_0xe869('0x1af')});db[_0xe869('0x99')]['hasMany'](db[_0xe869('0x9b')],{'as':_0xe869('0x1ae'),'onDelete':'cascade','foreignKey':_0xe869('0x1b0')});db[_0xe869('0x9b')][_0xe869('0x11b')](db[_0xe869('0x99')],{'foreignKey':_0xe869('0x1b0')});db[_0xe869('0x1b1')][_0xe869('0x10e')](db[_0xe869('0x9f')],{'as':_0xe869('0x1b2'),'onDelete':_0xe869('0x10c'),'foreignKey':_0xe869('0x1b3')});db[_0xe869('0x9f')][_0xe869('0x10e')](db['SalesforceField'],{'as':_0xe869('0x1b4'),'onDelete':_0xe869('0x10c'),'foreignKey':_0xe869('0x1b5')});db['SalesforceConfiguration']['hasMany'](db[_0xe869('0xa0')],{'as':_0xe869('0x1b6'),'onDelete':'cascade','foreignKey':_0xe869('0x1b7')});db[_0xe869('0x9f')][_0xe869('0x10e')](db['SalesforceField'],{'as':_0xe869('0x1ae'),'onDelete':'cascade','foreignKey':_0xe869('0x1b8')});db[_0xe869('0x9f')][_0xe869('0x11b')](db[_0xe869('0x1b1')],{'as':_0xe869('0x168'),'foreignKey':'AccountId'});db[_0xe869('0xa0')]['hasMany'](db[_0xe869('0xa0')],{'as':_0xe869('0x1b9'),'foreignKey':'SubjectId'});db['SalesforceField'][_0xe869('0x10e')](db['SalesforceField'],{'as':'Description','foreignKey':'DescriptionId'});db[_0xe869('0xa0')][_0xe869('0x10e')](db[_0xe869('0xa0')],{'as':_0xe869('0x1ba'),'foreignKey':'FieldId'});db['SalesforceField'][_0xe869('0x11b')](db[_0xe869('0x91')],{'as':'Variable','foreignKey':_0xe869('0x1bb')});db[_0xe869('0x1bc')][_0xe869('0x10e')](db[_0xe869('0xa3')],{'as':_0xe869('0x1b2'),'onDelete':_0xe869('0x10c'),'foreignKey':_0xe869('0x1b3')});db[_0xe869('0xa3')][_0xe869('0x10e')](db[_0xe869('0xa5')],{'as':_0xe869('0x1b4'),'onDelete':_0xe869('0x10c'),'foreignKey':_0xe869('0x1b5')});db[_0xe869('0xa3')][_0xe869('0x10e')](db[_0xe869('0xa5')],{'as':_0xe869('0x1b6'),'onDelete':'cascade','foreignKey':_0xe869('0x1b7')});db[_0xe869('0xa3')]['hasMany'](db[_0xe869('0xa5')],{'as':_0xe869('0x1ae'),'onDelete':_0xe869('0x10c'),'foreignKey':'FieldId'});db[_0xe869('0xa3')]['belongsTo'](db[_0xe869('0x1bc')],{'as':_0xe869('0x168'),'foreignKey':_0xe869('0x1b3')});db[_0xe869('0xa5')][_0xe869('0x10e')](db[_0xe869('0xa5')],{'as':_0xe869('0x1b9'),'foreignKey':_0xe869('0x1b5')});db['SugarcrmField'][_0xe869('0x10e')](db['SugarcrmField'],{'as':_0xe869('0x1bd'),'foreignKey':_0xe869('0x1b7')});db['SugarcrmField'][_0xe869('0x10e')](db['SugarcrmField'],{'as':_0xe869('0x1ba'),'foreignKey':'FieldId'});db['SugarcrmField'][_0xe869('0x11b')](db[_0xe869('0x91')],{'as':_0xe869('0x91'),'foreignKey':_0xe869('0x1bb')});db['DeskAccount'][_0xe869('0x10e')](db['DeskConfiguration'],{'as':_0xe869('0x1b2'),'onDelete':_0xe869('0x10c'),'foreignKey':_0xe869('0x1b3')});db[_0xe869('0x1be')][_0xe869('0x10e')](db['DeskField'],{'as':_0xe869('0x1b4'),'onDelete':_0xe869('0x10c'),'foreignKey':_0xe869('0x1b5')});db[_0xe869('0x1be')][_0xe869('0x10e')](db[_0xe869('0xa8')],{'as':_0xe869('0x1b6'),'onDelete':'cascade','foreignKey':_0xe869('0x1b7')});db[_0xe869('0x1be')][_0xe869('0x10e')](db['DeskField'],{'as':_0xe869('0x1ae'),'onDelete':'cascade','foreignKey':_0xe869('0x1b8')});db['DeskConfiguration']['belongsTo'](db[_0xe869('0xa6')],{'as':'Account','foreignKey':_0xe869('0x1b3')});db[_0xe869('0x1be')][_0xe869('0x11d')](db[_0xe869('0x8b')],{'through':'int_desk_configuration_has_tags'});db[_0xe869('0xa8')]['hasMany'](db['DeskField'],{'as':_0xe869('0x1b9'),'foreignKey':_0xe869('0x1b5')});db[_0xe869('0xa8')][_0xe869('0x10e')](db[_0xe869('0xa8')],{'as':_0xe869('0x1bd'),'foreignKey':_0xe869('0x1b7')});db[_0xe869('0xa8')][_0xe869('0x10e')](db[_0xe869('0xa8')],{'as':'Field','foreignKey':'FieldId'});db[_0xe869('0xa8')][_0xe869('0x11b')](db[_0xe869('0x91')],{'as':'Variable','foreignKey':_0xe869('0x1bb')});db['ZohoAccount'][_0xe869('0x10e')](db['ZohoConfiguration'],{'as':_0xe869('0x1b2'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xe869('0xac')][_0xe869('0x10e')](db['ZohoField'],{'as':_0xe869('0x1b4'),'onDelete':_0xe869('0x10c'),'foreignKey':_0xe869('0x1b5')});db[_0xe869('0xac')][_0xe869('0x10e')](db[_0xe869('0xad')],{'as':'Descriptions','onDelete':_0xe869('0x10c'),'foreignKey':_0xe869('0x1b7')});db[_0xe869('0xac')]['hasMany'](db['ZohoField'],{'as':_0xe869('0x1ae'),'onDelete':'cascade','foreignKey':_0xe869('0x1b8')});db[_0xe869('0xac')][_0xe869('0x11b')](db[_0xe869('0xaa')],{'as':_0xe869('0x168'),'foreignKey':'AccountId'});db[_0xe869('0xad')][_0xe869('0x10e')](db[_0xe869('0xad')],{'as':_0xe869('0x1b9'),'foreignKey':_0xe869('0x1b5')});db['ZohoField'][_0xe869('0x10e')](db['ZohoField'],{'as':_0xe869('0x1bd'),'foreignKey':_0xe869('0x1b7')});db[_0xe869('0xad')]['hasMany'](db['ZohoField'],{'as':_0xe869('0x1ba'),'foreignKey':'FieldId'});db[_0xe869('0xad')][_0xe869('0x11b')](db[_0xe869('0x91')],{'as':_0xe869('0x91'),'foreignKey':_0xe869('0x1bb')});db[_0xe869('0xae')][_0xe869('0x10e')](db[_0xe869('0xb0')],{'as':_0xe869('0x1b2'),'onDelete':_0xe869('0x10c'),'foreignKey':_0xe869('0x1b3')});db[_0xe869('0xb0')][_0xe869('0x10e')](db[_0xe869('0x1bf')],{'as':_0xe869('0x1b4'),'foreignKey':_0xe869('0x1b5')});db['ZendeskConfiguration'][_0xe869('0x10e')](db['ZendeskField'],{'as':_0xe869('0x1b6'),'foreignKey':_0xe869('0x1b7')});db['ZendeskConfiguration'][_0xe869('0x10e')](db[_0xe869('0x1bf')],{'as':_0xe869('0x1ae'),'foreignKey':_0xe869('0x1b8')});db['ZendeskConfiguration']['belongsTo'](db[_0xe869('0xae')],{'as':_0xe869('0x168'),'foreignKey':_0xe869('0x1b3')});db[_0xe869('0xb0')]['belongsToMany'](db['Tag'],{'through':_0xe869('0x1c0')});db['ZendeskField'][_0xe869('0x10e')](db[_0xe869('0x1bf')],{'as':'Subject','foreignKey':_0xe869('0x1b5')});db['ZendeskField'][_0xe869('0x10e')](db[_0xe869('0x1bf')],{'as':'Description','foreignKey':_0xe869('0x1b7')});db[_0xe869('0x1bf')][_0xe869('0x10e')](db[_0xe869('0x1bf')],{'as':'Field','foreignKey':_0xe869('0x1b8')});db['ZendeskField'][_0xe869('0x11b')](db[_0xe869('0x91')],{'as':_0xe869('0x91'),'foreignKey':_0xe869('0x1bb')});db[_0xe869('0xb3')]['hasMany'](db[_0xe869('0x1c1')],{'as':_0xe869('0x1b2'),'onDelete':_0xe869('0x10c'),'foreignKey':_0xe869('0x1b3')});db[_0xe869('0x1c1')][_0xe869('0x10e')](db[_0xe869('0xb6')],{'as':'Subjects','onDelete':_0xe869('0x10c'),'foreignKey':_0xe869('0x1b5')});db[_0xe869('0x1c1')][_0xe869('0x10e')](db[_0xe869('0xb6')],{'as':'Descriptions','onDelete':_0xe869('0x10c'),'foreignKey':_0xe869('0x1b7')});db[_0xe869('0x1c1')][_0xe869('0x10e')](db[_0xe869('0xb6')],{'as':_0xe869('0x1ae'),'onDelete':_0xe869('0x10c'),'foreignKey':'FieldId'});db[_0xe869('0x1c1')][_0xe869('0x11b')](db[_0xe869('0xb3')],{'as':_0xe869('0x168'),'foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0xe869('0x11d')](db[_0xe869('0x8b')],{'through':_0xe869('0x1c2')});db[_0xe869('0xb6')][_0xe869('0x10e')](db[_0xe869('0xb6')],{'as':_0xe869('0x1b9'),'foreignKey':_0xe869('0x1b5')});db[_0xe869('0xb6')][_0xe869('0x10e')](db[_0xe869('0xb6')],{'as':_0xe869('0x1bd'),'foreignKey':_0xe869('0x1b7')});db[_0xe869('0xb6')][_0xe869('0x10e')](db[_0xe869('0xb6')],{'as':'Field','foreignKey':_0xe869('0x1b8')});db[_0xe869('0xb6')]['belongsTo'](db['Variable'],{'as':_0xe869('0x91'),'foreignKey':'VariableId'});db['VtigerAccount'][_0xe869('0x10e')](db['VtigerConfiguration'],{'as':'Configurations','onDelete':_0xe869('0x10c'),'foreignKey':'AccountId'});db[_0xe869('0xb9')][_0xe869('0x10e')](db['VtigerField'],{'as':_0xe869('0x1b4'),'foreignKey':_0xe869('0x1b5')});db[_0xe869('0xb9')]['hasMany'](db[_0xe869('0xbb')],{'as':_0xe869('0x1b6'),'foreignKey':'DescriptionId'});db[_0xe869('0xb9')]['hasMany'](db[_0xe869('0xbb')],{'as':_0xe869('0x1ae'),'foreignKey':_0xe869('0x1b8')});db[_0xe869('0xb9')][_0xe869('0x11b')](db[_0xe869('0xb8')],{'as':'Account','foreignKey':'AccountId'});db[_0xe869('0xbb')][_0xe869('0x10e')](db[_0xe869('0xbb')],{'as':_0xe869('0x1b9'),'foreignKey':_0xe869('0x1b5')});db[_0xe869('0xbb')]['hasMany'](db[_0xe869('0xbb')],{'as':'Description','foreignKey':_0xe869('0x1b7')});db[_0xe869('0xbb')][_0xe869('0x10e')](db['VtigerField'],{'as':_0xe869('0x1ba'),'foreignKey':_0xe869('0x1b8')});db[_0xe869('0xbb')][_0xe869('0x11b')](db['Variable'],{'as':_0xe869('0x91'),'foreignKey':_0xe869('0x1bb')});db[_0xe869('0xbc')][_0xe869('0x10e')](db[_0xe869('0x1c3')],{'as':_0xe869('0x1b2'),'onDelete':'cascade','foreignKey':_0xe869('0x1b3')});db[_0xe869('0x1c3')][_0xe869('0x10e')](db[_0xe869('0xbf')],{'as':_0xe869('0x1b4'),'foreignKey':_0xe869('0x1b5')});db[_0xe869('0x1c3')][_0xe869('0x10e')](db[_0xe869('0xbf')],{'as':'Descriptions','foreignKey':_0xe869('0x1b7')});db[_0xe869('0x1c3')][_0xe869('0x10e')](db[_0xe869('0xbf')],{'as':'Fields','foreignKey':_0xe869('0x1b8')});db[_0xe869('0x1c3')][_0xe869('0x11b')](db[_0xe869('0xbc')],{'as':'Account','foreignKey':_0xe869('0x1b3')});db[_0xe869('0xbf')]['hasMany'](db['ServicenowField'],{'as':_0xe869('0x1b9'),'foreignKey':_0xe869('0x1b5')});db[_0xe869('0xbf')][_0xe869('0x10e')](db[_0xe869('0xbf')],{'as':_0xe869('0x1bd'),'foreignKey':_0xe869('0x1b7')});db['ServicenowField'][_0xe869('0x10e')](db[_0xe869('0xbf')],{'as':_0xe869('0x1ba'),'foreignKey':_0xe869('0x1b8')});db[_0xe869('0xbf')][_0xe869('0x11b')](db['Variable'],{'as':_0xe869('0x91'),'foreignKey':_0xe869('0x1bb')});db[_0xe869('0xc1')][_0xe869('0x10e')](db[_0xe869('0xc3')],{'as':_0xe869('0x1b2'),'onDelete':_0xe869('0x10c'),'foreignKey':_0xe869('0x1b3')});db['Dynamics365Configuration']['hasMany'](db[_0xe869('0xc5')],{'as':_0xe869('0x1b4'),'onDelete':'cascade','foreignKey':'SubjectId'});db['Dynamics365Configuration']['hasMany'](db[_0xe869('0xc5')],{'as':_0xe869('0x1b6'),'onDelete':'cascade','foreignKey':_0xe869('0x1b7')});db[_0xe869('0xc3')][_0xe869('0x10e')](db[_0xe869('0xc5')],{'as':_0xe869('0x1ae'),'onDelete':_0xe869('0x10c'),'foreignKey':'FieldId'});db[_0xe869('0xc3')]['belongsTo'](db['Dynamics365Account'],{'as':_0xe869('0x168'),'foreignKey':_0xe869('0x1b3')});db[_0xe869('0xc5')][_0xe869('0x10e')](db['Dynamics365Field'],{'as':'Subject','foreignKey':'SubjectId'});db[_0xe869('0xc5')][_0xe869('0x10e')](db[_0xe869('0xc5')],{'as':'Description','foreignKey':_0xe869('0x1b7')});db['Dynamics365Field']['hasMany'](db[_0xe869('0xc5')],{'as':_0xe869('0x1ba'),'foreignKey':'FieldId'});db['Dynamics365Field'][_0xe869('0x11b')](db[_0xe869('0x91')],{'as':_0xe869('0x91'),'foreignKey':_0xe869('0x1bb')});db['FreshsalesAccount']['hasMany'](db[_0xe869('0xc8')],{'as':_0xe869('0x1b2'),'onDelete':_0xe869('0x10c'),'foreignKey':_0xe869('0x1b3')});db['FreshsalesConfiguration'][_0xe869('0x10e')](db[_0xe869('0x1c4')],{'as':_0xe869('0x1b4'),'foreignKey':'SubjectId'});db[_0xe869('0xc8')][_0xe869('0x10e')](db['FreshsalesField'],{'as':_0xe869('0x1b6'),'foreignKey':_0xe869('0x1b7')});db[_0xe869('0xc8')][_0xe869('0x10e')](db[_0xe869('0x1c4')],{'as':_0xe869('0x1ae'),'foreignKey':_0xe869('0x1b8')});db[_0xe869('0xc8')][_0xe869('0x11b')](db[_0xe869('0xc6')],{'as':_0xe869('0x168'),'foreignKey':_0xe869('0x1b3')});db[_0xe869('0x1c4')][_0xe869('0x10e')](db['FreshsalesField'],{'as':'Subject','foreignKey':_0xe869('0x1b5')});db['FreshsalesField'][_0xe869('0x10e')](db[_0xe869('0x1c4')],{'as':_0xe869('0x1bd'),'foreignKey':_0xe869('0x1b7')});db[_0xe869('0x1c4')][_0xe869('0x10e')](db['FreshsalesField'],{'as':'Field','foreignKey':'FieldId'});db[_0xe869('0x1c4')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0xe869('0x1bb')});db[_0xe869('0xca')]['belongsTo'](db[_0xe869('0x133')],{});db[_0xe869('0xca')]['belongsTo'](db[_0xe869('0xf2')],{'as':_0xe869('0x162'),'foreignKey':_0xe869('0x16e')});db[_0xe869('0xca')][_0xe869('0x11b')](db[_0xe869('0x6f')],{'as':_0xe869('0x158'),'foreignKey':_0xe869('0x159')});db['ChatQueueReport'][_0xe869('0x11b')](db['ChatInteraction'],{});db[_0xe869('0xca')][_0xe869('0x11b')](db[_0xe869('0x66')],{});db['ChatQueueReport']['belongsTo'](db[_0xe869('0x109')],{});db[_0xe869('0xca')][_0xe869('0x11b')](db['ChatQueue'],{});db[_0xe869('0xcc')][_0xe869('0x11b')](db['User'],{'onDelete':_0xe869('0x10c'),'foreignKey':_0xe869('0x1c5')});db[_0xe869('0xcc')][_0xe869('0x11b')](db[_0xe869('0x109')],{'onDelete':_0xe869('0x10c'),'foreignKey':_0xe869('0x1c6')});db[_0xe869('0xd1')][_0xe869('0x10e')](db[_0xe869('0xd0')],{'foreignKey':_0xe869('0x1c7'),'onDelete':_0xe869('0x10c')});db[_0xe869('0xd1')][_0xe869('0x10e')](db[_0xe869('0xce')],{'foreignKey':_0xe869('0x1c7'),'onDelete':_0xe869('0x10c')});db['SmsQueueReport'][_0xe869('0x11b')](db[_0xe869('0x51')],{});db['SmsQueueReport']['belongsTo'](db[_0xe869('0xf2')],{'as':_0xe869('0x162'),'foreignKey':'ListId'});db[_0xe869('0xd3')][_0xe869('0x11b')](db[_0xe869('0x6f')],{'as':_0xe869('0x158'),'foreignKey':'ContactId'});db[_0xe869('0xd3')][_0xe869('0x11b')](db[_0xe869('0x55')],{});db[_0xe869('0xd3')][_0xe869('0x11b')](db[_0xe869('0x57')],{});db[_0xe869('0xd3')][_0xe869('0x11b')](db[_0xe869('0x109')],{});db['SmsQueueReport'][_0xe869('0x11b')](db['SmsQueue'],{});db['JscriptyProject'][_0xe869('0x10e')](db['JscriptySessionReport'],{'foreignKey':_0xe869('0x1c8')});db[_0xe869('0xd6')][_0xe869('0x10e')](db[_0xe869('0xd0')],{'foreignKey':_0xe869('0x1c8')});db[_0xe869('0xd6')][_0xe869('0x10e')](db[_0xe869('0xce')],{'foreignKey':_0xe869('0x1c8')});db[_0xe869('0xdc')][_0xe869('0x11d')](db[_0xe869('0x109')],{'as':'Users','through':_0xe869('0x13e')});db[_0xe869('0xe1')][_0xe869('0x11d')](db[_0xe869('0x109')],{'as':_0xe869('0x150'),'through':'user_has_teams'});db[_0xe869('0xe1')][_0xe869('0x11d')](db['VoiceQueue'],{'through':_0xe869('0x151'),'as':_0xe869('0x12c')});db[_0xe869('0xe1')][_0xe869('0x11d')](db[_0xe869('0x3a')],{'through':_0xe869('0x164'),'as':_0xe869('0x1c9')});db[_0xe869('0xe1')][_0xe869('0x11d')](db[_0xe869('0x69')],{'through':'team_has_chat_queues','as':_0xe869('0x1ca')});db['Team']['belongsToMany'](db['FaxQueue'],{'through':'team_has_fax_queues','as':'FaxQueues'});db[_0xe869('0xe1')][_0xe869('0x11d')](db['SmsQueue'],{'through':_0xe869('0x17e'),'as':_0xe869('0x130')});db['Team'][_0xe869('0x11d')](db[_0xe869('0x5e')],{'through':_0xe869('0x185'),'as':_0xe869('0x1cb')});db[_0xe869('0xe1')][_0xe869('0x11d')](db[_0xe869('0x105')],{'through':_0xe869('0x1cc'),'as':_0xe869('0x1cd')});db['Campaign'][_0xe869('0x10e')](db['CmHopper'],{'as':_0xe869('0x192'),'foreignKey':_0xe869('0x197')});db['Campaign'][_0xe869('0x10e')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xe869('0x197')});db[_0xe869('0xe4')]['hasMany'](db[_0xe869('0x147')],{'as':'HopperHistories','foreignKey':'CampaignId'});db[_0xe869('0xe4')][_0xe869('0x10e')](db[_0xe869('0x73')],{'as':'HopperBlacks','foreignKey':_0xe869('0x197')});db[_0xe869('0xe4')]['belongsTo'](db['Trunk'],{'as':_0xe869('0x2b'),'foreignKey':_0xe869('0x14a')});db['Campaign']['belongsTo'](db[_0xe869('0x2b')],{'as':'TrunkBackup','foreignKey':_0xe869('0x14b')});db[_0xe869('0xe4')]['belongsTo'](db['Interval'],{'as':_0xe869('0x14c'),'foreignKey':'IntervalId'});db['Campaign'][_0xe869('0x11b')](db[_0xe869('0xdc')],{'as':_0xe869('0xdc'),'foreignKey':_0xe869('0x1ce')});db[_0xe869('0xe4')][_0xe869('0x11d')](db[_0xe869('0xf2')],{'as':'Lists','through':_0xe869('0x1cf')});db[_0xe869('0xe4')][_0xe869('0x11d')](db[_0xe869('0xf2')],{'as':_0xe869('0x152'),'through':_0xe869('0x1d0')});db[_0xe869('0xeb')][_0xe869('0x11b')](db['MailMessage'],{});db[_0xe869('0xeb')][_0xe869('0x11b')](db['MailInteraction'],{});db[_0xe869('0xeb')][_0xe869('0x11b')](db[_0xe869('0x38')],{'foreignKey':_0xe869('0x1d1'),'as':_0xe869('0x1d2')});db[_0xe869('0xeb')][_0xe869('0x11b')](db['User'],{'foreignKey':_0xe869('0x1d3'),'as':_0xe869('0x1d4')});db[_0xe869('0xeb')][_0xe869('0x11b')](db[_0xe869('0x109')],{'foreignKey':_0xe869('0x1d5'),'as':'ToAgent'});db[_0xe869('0xeb')][_0xe869('0x11b')](db[_0xe869('0x3a')],{'foreignKey':_0xe869('0x1d6'),'as':'ToQueue'});db[_0xe869('0xeb')]['belongsTo'](db[_0xe869('0x38')],{'foreignKey':_0xe869('0x1d7'),'as':_0xe869('0x1d8')});db['ChatTransferReport'][_0xe869('0x11b')](db[_0xe869('0x66')],{});db['ChatTransferReport'][_0xe869('0x11b')](db[_0xe869('0x126')],{});db[_0xe869('0xec')]['belongsTo'](db[_0xe869('0x133')],{'foreignKey':_0xe869('0x1d9'),'as':_0xe869('0x1d2')});db[_0xe869('0xec')][_0xe869('0x11b')](db['User'],{'foreignKey':_0xe869('0x1d3'),'as':_0xe869('0x1d4')});db[_0xe869('0xec')][_0xe869('0x11b')](db[_0xe869('0x109')],{'foreignKey':_0xe869('0x1d5'),'as':_0xe869('0x1da')});db[_0xe869('0xec')][_0xe869('0x11b')](db['ChatQueue'],{'foreignKey':'ToChatQueueId','as':_0xe869('0x1db')});db[_0xe869('0xec')][_0xe869('0x11b')](db['ChatWebsite'],{'foreignKey':_0xe869('0x1dc'),'as':_0xe869('0x1d8')});db[_0xe869('0xee')]['belongsTo'](db[_0xe869('0x4c')],{});db[_0xe869('0xee')][_0xe869('0x11b')](db[_0xe869('0x4a')],{});db[_0xe869('0xee')][_0xe869('0x11b')](db[_0xe869('0x47')],{'foreignKey':'FromFaxAccountId','as':_0xe869('0x1d2')});db[_0xe869('0xee')][_0xe869('0x11b')](db['User'],{'foreignKey':_0xe869('0x1d3'),'as':_0xe869('0x1d4')});db[_0xe869('0xee')][_0xe869('0x11b')](db[_0xe869('0x109')],{'foreignKey':_0xe869('0x1d5'),'as':_0xe869('0x1da')});db[_0xe869('0xee')][_0xe869('0x11b')](db[_0xe869('0x4e')],{'foreignKey':_0xe869('0x1dd'),'as':_0xe869('0x1db')});db[_0xe869('0xee')][_0xe869('0x11b')](db[_0xe869('0x47')],{'foreignKey':'ToFaxAccountId','as':_0xe869('0x1d8')});db['OpenchannelTransferReport'][_0xe869('0x11b')](db[_0xe869('0x180')],{});db[_0xe869('0x1de')][_0xe869('0x11b')](db[_0xe869('0x5d')],{});db['OpenchannelTransferReport'][_0xe869('0x11b')](db[_0xe869('0x5a')],{'foreignKey':'FromOpenchannelAccountId','as':_0xe869('0x1d2')});db[_0xe869('0x1de')]['belongsTo'](db[_0xe869('0x109')],{'foreignKey':_0xe869('0x1d3'),'as':_0xe869('0x1d4')});db[_0xe869('0x1de')][_0xe869('0x11b')](db[_0xe869('0x109')],{'foreignKey':'ToUserId','as':_0xe869('0x1da')});db[_0xe869('0x1de')][_0xe869('0x11b')](db['OpenchannelQueue'],{'foreignKey':_0xe869('0x1df'),'as':_0xe869('0x1db')});db[_0xe869('0x1de')][_0xe869('0x11b')](db[_0xe869('0x5a')],{'foreignKey':_0xe869('0x1e0'),'as':_0xe869('0x1d8')});db[_0xe869('0xf1')]['belongsTo'](db[_0xe869('0x57')],{});db[_0xe869('0xf1')]['belongsTo'](db[_0xe869('0x55')],{});db['SmsTransferReport'][_0xe869('0x11b')](db['SmsAccount'],{'foreignKey':_0xe869('0x1e1'),'as':'FromAccount'});db[_0xe869('0xf1')]['belongsTo'](db[_0xe869('0x109')],{'foreignKey':_0xe869('0x1d3'),'as':_0xe869('0x1d4')});db['SmsTransferReport'][_0xe869('0x11b')](db[_0xe869('0x109')],{'foreignKey':_0xe869('0x1d5'),'as':_0xe869('0x1da')});db[_0xe869('0xf1')]['belongsTo'](db[_0xe869('0x59')],{'foreignKey':'ToSmsQueueId','as':_0xe869('0x1db')});db[_0xe869('0xf1')][_0xe869('0x11b')](db[_0xe869('0x51')],{'foreignKey':'ToSmsAccountId','as':_0xe869('0x1d8')});db[_0xe869('0xf2')]['hasMany'](db[_0xe869('0x7f')],{'as':_0xe869('0x15e'),'foreignKey':_0xe869('0x16e')});db['CmList'][_0xe869('0x10e')](db[_0xe869('0x78')],{'as':_0xe869('0x1e2'),'foreignKey':_0xe869('0x16e')});db['CmList']['hasMany'](db[_0xe869('0x6f')],{'as':_0xe869('0x120'),'onDelete':_0xe869('0x10c'),'foreignKey':_0xe869('0x16e')});db[_0xe869('0xf2')][_0xe869('0x10e')](db[_0xe869('0x75')],{'as':'HopperFinals','foreignKey':_0xe869('0x16e')});db[_0xe869('0xf2')][_0xe869('0x10e')](db[_0xe869('0x147')],{'as':_0xe869('0x1e3'),'foreignKey':_0xe869('0x16e')});db[_0xe869('0xf2')][_0xe869('0x10e')](db[_0xe869('0x114')],{'as':_0xe869('0x114'),'foreignKey':'ListId'});db[_0xe869('0xf2')][_0xe869('0x11d')](db['VoiceQueue'],{'as':_0xe869('0x1e4'),'through':_0xe869('0x14f')});db[_0xe869('0xf2')]['belongsToMany'](db['User'],{'as':_0xe869('0x150'),'through':_0xe869('0x123')});db[_0xe869('0xf4')]['hasMany'](db[_0xe869('0x111')],{'as':_0xe869('0x112'),'onDelete':'cascade'});db['VoicePrefix'][_0xe869('0x11d')](db[_0xe869('0x109')],{'as':_0xe869('0x150'),'through':_0xe869('0x1e5')});db[_0xe869('0xf6')]['hasMany'](db[_0xe869('0x109')],{'as':_0xe869('0x16c'),'foreignKey':_0xe869('0x11c')});db[_0xe869('0xf6')][_0xe869('0x10e')](db[_0xe869('0xf8')],{'as':_0xe869('0x1e6'),'foreignKey':_0xe869('0x11c'),'onDelete':_0xe869('0x10c')});db['UserProfileSection'][_0xe869('0x10e')](db[_0xe869('0xf9')],{'as':_0xe869('0x1e7'),'foreignKey':_0xe869('0x1e8'),'onDelete':_0xe869('0x10c')});db[_0xe869('0xfc')][_0xe869('0x10e')](db['Disposition'],{'as':_0xe869('0x15e'),'foreignKey':_0xe869('0x1e9')});db[_0xe869('0xfc')][_0xe869('0x10e')](db['CannedAnswer'],{'as':_0xe869('0x15f'),'foreignKey':_0xe869('0x1e9')});db[_0xe869('0xfc')][_0xe869('0x10e')](db[_0xe869('0xff')],{'as':_0xe869('0x154'),'foreignKey':_0xe869('0x1e9')});db['WhatsappAccount'][_0xe869('0x10e')](db[_0xe869('0x118')],{'as':_0xe869('0x160')});db[_0xe869('0xfc')][_0xe869('0x10e')](db['WhatsappApplication'],{'as':'Applications'});db[_0xe869('0xfc')][_0xe869('0x11b')](db['CmList'],{'as':_0xe869('0x162'),'foreignKey':'ListId'});db['WhatsappAccount'][_0xe869('0x11b')](db[_0xe869('0x83')],{'as':_0xe869('0x172'),'foreignKey':'mandatoryDispositionPauseId'});db['WhatsappAccount'][_0xe869('0x11d')](db[_0xe869('0x109')],{'as':_0xe869('0x150'),'through':_0xe869('0x13d')});db[_0xe869('0x1ea')][_0xe869('0x11b')](db[_0xe869('0x109')],{'onDelete':_0xe869('0x16d')});db[_0xe869('0x1ea')]['belongsTo'](db[_0xe869('0x105')],{'onDelete':_0xe869('0x16d')});db[_0xe869('0x1ea')][_0xe869('0x11b')](db[_0xe869('0xfc')],{'onDelete':_0xe869('0x16d')});db['WhatsappApplication']['belongsTo'](db[_0xe869('0x14c')],{'onDelete':_0xe869('0x16d'),'foreignKey':'IntervalId'});db[_0xe869('0x1ea')]['belongsTo'](db[_0xe869('0x8b')],{'onDelete':_0xe869('0x16d'),'foreignKey':_0xe869('0x173')});db[_0xe869('0x118')][_0xe869('0x10e')](db['WhatsappMessage'],{'as':'Messages','onDelete':_0xe869('0x10c'),'foreignKey':'WhatsappInteractionId'});db[_0xe869('0x118')][_0xe869('0x11b')](db[_0xe869('0xfc')],{'as':_0xe869('0x168'),'foreignKey':'WhatsappAccountId'});db[_0xe869('0x118')][_0xe869('0x11b')](db[_0xe869('0x6f')],{'as':_0xe869('0x158'),'foreignKey':_0xe869('0x159')});db[_0xe869('0x118')][_0xe869('0x11b')](db[_0xe869('0x109')],{'as':_0xe869('0x169'),'foreignKey':_0xe869('0x10d')});db[_0xe869('0x118')]['belongsToMany'](db[_0xe869('0x8b')],{'through':_0xe869('0x1a7'),'as':'Tags'});db[_0xe869('0x118')][_0xe869('0x11d')](db[_0xe869('0x8b')],{'through':_0xe869('0x1a7'),'as':_0xe869('0x176')});db['WhatsappInteraction'][_0xe869('0x11d')](db[_0xe869('0x109')],{'as':'Users','through':_0xe869('0x12b'),'foreignKey':'WhatsappInteractionId'});db['WhatsappMessage'][_0xe869('0x11b')](db[_0xe869('0x109')],{'as':_0xe869('0x109')});db['WhatsappMessage'][_0xe869('0x11b')](db[_0xe869('0x6f')],{'onDelete':_0xe869('0x10c'),'as':_0xe869('0x158')});db[_0xe869('0xff')][_0xe869('0x11b')](db['WhatsappInteraction'],{'onDelete':_0xe869('0x10c'),'as':_0xe869('0x177'),'foreignKey':_0xe869('0x1eb')});db[_0xe869('0xff')]['belongsTo'](db['WhatsappAccount'],{'as':_0xe869('0x168'),'foreignKey':_0xe869('0x1e9')});db[_0xe869('0x101')][_0xe869('0x11b')](db['WhatsappAccount'],{});db[_0xe869('0x101')]['belongsTo'](db['CmList'],{'as':_0xe869('0x162'),'foreignKey':_0xe869('0x16e')});db[_0xe869('0x101')][_0xe869('0x11b')](db[_0xe869('0x6f')],{'as':'Contact','foreignKey':_0xe869('0x159')});db[_0xe869('0x101')][_0xe869('0x11b')](db[_0xe869('0x118')],{});db[_0xe869('0x101')][_0xe869('0x11b')](db['WhatsappQueue'],{});db[_0xe869('0x101')]['belongsTo'](db[_0xe869('0xff')],{});db['WhatsappQueueReport'][_0xe869('0x11b')](db[_0xe869('0x109')],{});db[_0xe869('0x103')][_0xe869('0x11b')](db[_0xe869('0xff')],{});db[_0xe869('0x103')][_0xe869('0x11b')](db[_0xe869('0x118')],{});db[_0xe869('0x103')][_0xe869('0x11b')](db[_0xe869('0xfc')],{'foreignKey':_0xe869('0x1ec'),'as':_0xe869('0x1d2')});db[_0xe869('0x103')][_0xe869('0x11b')](db[_0xe869('0xfc')],{'foreignKey':_0xe869('0x1ed'),'as':_0xe869('0x1d8')});db[_0xe869('0x103')][_0xe869('0x11b')](db[_0xe869('0x105')],{'foreignKey':_0xe869('0x1ee'),'as':'ToQueue'});db['WhatsappTransferReport'][_0xe869('0x11b')](db[_0xe869('0x109')],{'foreignKey':_0xe869('0x1d3'),'as':_0xe869('0x1d4')});db[_0xe869('0x103')][_0xe869('0x11b')](db['User'],{'foreignKey':_0xe869('0x1d5'),'as':_0xe869('0x1da')});db[_0xe869('0x105')][_0xe869('0x11d')](db[_0xe869('0x109')],{'as':'Agents','through':_0xe869('0x132'),'foreignKey':_0xe869('0x1ef')});db[_0xe869('0x105')][_0xe869('0x11d')](db[_0xe869('0xe1')],{'through':_0xe869('0x1cc'),'as':_0xe869('0x165')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 855fd06..ed4468e 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2957=['./api/intFreshsalesField','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','./api/squareReportDetail','./api/jscriptyProject','/api/settings','./api/setting','./api/squareOdbc','/api/square/projects','./api/squareProject','./api/squareMessage','/api/teams','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/notifications','./api/notification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','join','root','/www','static','/demo','/snippet','snippet','1.0.16','/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','appPath','/index.html','path','express','express-winston','util','./errors','./config/environment','./config/logger','api','auth','default','use','logger','format','method','headers','x-forwarded-for','remoteAddress','url','statusCode','responseTime','user','role','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','device','agent_id','connection','name','other','agent_name','./api/user','./api/voiceChanSpy','./api/voiceContext','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','/api/trunks','./api/trunk','./api/voiceTransferReport','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/fax/accounts','./api/faxAccount','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','./api/smsInteraction','/api/sms/messages','/api/sms/queues','./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/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/conditions','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/schedule','/api/sounds','./api/sound','/api/tags','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','/api/integrations','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','./api/intSugarcrmField','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration'];(function(_0x512fe4,_0xcd4205){var _0x87e6b4=function(_0x560234){while(--_0x560234){_0x512fe4['push'](_0x512fe4['shift']());}};_0x87e6b4(++_0xcd4205);}(_0x2957,0x177));var _0x7295=function(_0x14e58e,_0x2d3499){_0x14e58e=_0x14e58e-0x0;var _0x346d74=_0x2957[_0x14e58e];return _0x346d74;};'use strict';var path=require(_0x7295('0x0'));var express=require(_0x7295('0x1'));var ewinston=require(_0x7295('0x2'));var util=require(_0x7295('0x3'));var errors=require(_0x7295('0x4'));var config=require(_0x7295('0x5'));var logger=require(_0x7295('0x6'))(_0x7295('0x7'));var authLogger=require('./config/logger')(_0x7295('0x8'));exports[_0x7295('0x9')]=function(_0x27cd90){_0x27cd90[_0x7295('0xa')](ewinston[_0x7295('0xb')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x799b,_0x1708fb){return util[_0x7295('0xc')]('%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s',_0x799b[_0x7295('0xd')],_0x799b[_0x7295('0xe')]['x-forwarded-for']?_0x799b['headers'][_0x7295('0xf')]:_0x799b['connection'][_0x7295('0x10')]||_0x799b['ip'],_0x799b[_0x7295('0x11')],_0x1708fb[_0x7295('0x12')],_0x1708fb[_0x7295('0x13')],_0x799b[_0x7295('0x14')]?_0x799b[_0x7295('0x14')]['id']:null,_0x799b[_0x7295('0x14')]?_0x799b['user']['name']:null,_0x799b['user']?_0x799b[_0x7295('0x14')][_0x7295('0x15')]:null);}}));_0x27cd90[_0x7295('0xa')](ewinston[_0x7295('0xb')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x2387e1,_0x482889){var _0x1d922e=_0x7295('0x16');if(_0x2387e1[_0x7295('0x17')]&&_0x2387e1['body'][_0x7295('0x18')]&&_0x2387e1[_0x7295('0x17')][_0x7295('0x19')]){_0x1d922e='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x7295('0xc')](_0x1d922e,_0x2387e1[_0x7295('0xd')],_0x2387e1[_0x7295('0xe')][_0x7295('0xf')]?_0x2387e1[_0x7295('0xe')][_0x7295('0xf')]:_0x2387e1[_0x7295('0x1a')][_0x7295('0x10')]||_0x2387e1['ip'],_0x2387e1['url'],_0x482889[_0x7295('0x12')],_0x482889[_0x7295('0x13')],_0x2387e1[_0x7295('0x14')]?_0x2387e1[_0x7295('0x14')]['id']:null,_0x2387e1[_0x7295('0x14')]?_0x2387e1[_0x7295('0x14')][_0x7295('0x1b')]:null,_0x2387e1[_0x7295('0x14')]?_0x2387e1[_0x7295('0x14')][_0x7295('0x15')]:null,_0x2387e1['body']&&_0x2387e1[_0x7295('0x17')]['device']?_0x2387e1[_0x7295('0x17')][_0x7295('0x18')]:_0x7295('0x1c'),_0x2387e1[_0x7295('0x17')]&&_0x2387e1['body'][_0x7295('0x19')]?_0x2387e1[_0x7295('0x17')][_0x7295('0x19')]:'',_0x2387e1['body']&&_0x2387e1[_0x7295('0x17')][_0x7295('0x1d')]?_0x2387e1[_0x7295('0x17')][_0x7295('0x1d')]:'');},'ignoreRoute':function(_0x2f3caa){var _0x35001d=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x35001d['test'](_0x2f3caa[_0x7295('0x11')]);}}));_0x27cd90['use']('/api/users',require(_0x7295('0x1e')));_0x27cd90[_0x7295('0xa')]('/api/voice/chanspy',require(_0x7295('0x1f')));_0x27cd90[_0x7295('0xa')]('/api/voice/contexts',require(_0x7295('0x20')));_0x27cd90[_0x7295('0xa')]('/api/voice/extensions',require(_0x7295('0x21')));_0x27cd90[_0x7295('0xa')]('/api/voice/mohs',require(_0x7295('0x22')));_0x27cd90['use'](_0x7295('0x23'),require(_0x7295('0x24')));_0x27cd90[_0x7295('0xa')](_0x7295('0x25'),require('./api/voiceRecording'));_0x27cd90[_0x7295('0xa')](_0x7295('0x26'),require(_0x7295('0x27')));_0x27cd90[_0x7295('0xa')](_0x7295('0x28'),require('./api/voiceMail'));_0x27cd90[_0x7295('0xa')]('/api/voice/mails/messages',require(_0x7295('0x29')));_0x27cd90[_0x7295('0xa')]('/api/voice/calls/reports',require(_0x7295('0x2a')));_0x27cd90[_0x7295('0xa')](_0x7295('0x2b'),require(_0x7295('0x2c')));_0x27cd90['use']('/api/voice/agents/reports',require(_0x7295('0x2d')));_0x27cd90[_0x7295('0xa')]('/api/voice/queues/reports',require(_0x7295('0x2e')));_0x27cd90[_0x7295('0xa')](_0x7295('0x2f'),require('./api/memberReport'));_0x27cd90[_0x7295('0xa')](_0x7295('0x30'),require(_0x7295('0x31')));_0x27cd90[_0x7295('0xa')]('/api/voice/transfers/reports',require(_0x7295('0x32')));_0x27cd90[_0x7295('0xa')]('/api/mail/out_servers',require(_0x7295('0x33')));_0x27cd90[_0x7295('0xa')](_0x7295('0x34'),require(_0x7295('0x35')));_0x27cd90[_0x7295('0xa')](_0x7295('0x36'),require(_0x7295('0x37')));_0x27cd90[_0x7295('0xa')](_0x7295('0x38'),require(_0x7295('0x39')));_0x27cd90[_0x7295('0xa')](_0x7295('0x3a'),require(_0x7295('0x3b')));_0x27cd90[_0x7295('0xa')](_0x7295('0x3c'),require(_0x7295('0x3d')));_0x27cd90[_0x7295('0xa')](_0x7295('0x3e'),require(_0x7295('0x3f')));_0x27cd90['use'](_0x7295('0x40'),require(_0x7295('0x41')));_0x27cd90['use'](_0x7295('0x42'),require('./api/dashboard'));_0x27cd90[_0x7295('0xa')]('/api/dashboards/items',require('./api/dashboardItem'));_0x27cd90[_0x7295('0xa')](_0x7295('0x43'),require(_0x7295('0x44')));_0x27cd90[_0x7295('0xa')](_0x7295('0x45'),require('./api/faxApplication'));_0x27cd90['use'](_0x7295('0x46'),require(_0x7295('0x47')));_0x27cd90[_0x7295('0xa')](_0x7295('0x48'),require('./api/faxMessage'));_0x27cd90[_0x7295('0xa')](_0x7295('0x49'),require(_0x7295('0x4a')));_0x27cd90[_0x7295('0xa')](_0x7295('0x4b'),require(_0x7295('0x4c')));_0x27cd90[_0x7295('0xa')](_0x7295('0x4d'),require(_0x7295('0x4e')));_0x27cd90[_0x7295('0xa')](_0x7295('0x4f'),require(_0x7295('0x50')));_0x27cd90['use']('/api/sms/interactions',require(_0x7295('0x51')));_0x27cd90[_0x7295('0xa')](_0x7295('0x52'),require('./api/smsMessage'));_0x27cd90['use'](_0x7295('0x53'),require(_0x7295('0x54')));_0x27cd90[_0x7295('0xa')](_0x7295('0x55'),require(_0x7295('0x56')));_0x27cd90[_0x7295('0xa')](_0x7295('0x57'),require(_0x7295('0x58')));_0x27cd90[_0x7295('0xa')](_0x7295('0x59'),require(_0x7295('0x5a')));_0x27cd90[_0x7295('0xa')](_0x7295('0x5b'),require(_0x7295('0x5c')));_0x27cd90[_0x7295('0xa')](_0x7295('0x5d'),require(_0x7295('0x5e')));_0x27cd90['use'](_0x7295('0x5f'),require(_0x7295('0x60')));_0x27cd90[_0x7295('0xa')](_0x7295('0x61'),require(_0x7295('0x62')));_0x27cd90[_0x7295('0xa')](_0x7295('0x63'),require(_0x7295('0x64')));_0x27cd90[_0x7295('0xa')](_0x7295('0x65'),require(_0x7295('0x66')));_0x27cd90[_0x7295('0xa')](_0x7295('0x67'),require(_0x7295('0x68')));_0x27cd90[_0x7295('0xa')](_0x7295('0x69'),require(_0x7295('0x6a')));_0x27cd90[_0x7295('0xa')]('/api/chat/queues',require(_0x7295('0x6b')));_0x27cd90[_0x7295('0xa')](_0x7295('0x6c'),require(_0x7295('0x6d')));_0x27cd90[_0x7295('0xa')]('/api/chat/proactive_actions',require(_0x7295('0x6e')));_0x27cd90['use'](_0x7295('0x6f'),require(_0x7295('0x70')));_0x27cd90[_0x7295('0xa')]('/api/cm/contacts',require('./api/cmContact'));_0x27cd90[_0x7295('0xa')](_0x7295('0x71'),require(_0x7295('0x72')));_0x27cd90['use'](_0x7295('0x73'),require(_0x7295('0x74')));_0x27cd90[_0x7295('0xa')]('/api/cm/hopper_final',require(_0x7295('0x75')));_0x27cd90[_0x7295('0xa')](_0x7295('0x76'),require(_0x7295('0x77')));_0x27cd90[_0x7295('0xa')](_0x7295('0x78'),require(_0x7295('0x79')));_0x27cd90['use']('/api/actions',require(_0x7295('0x7a')));_0x27cd90[_0x7295('0xa')](_0x7295('0x7b'),require(_0x7295('0x7c')));_0x27cd90[_0x7295('0xa')](_0x7295('0x7d'),require(_0x7295('0x7e')));_0x27cd90[_0x7295('0xa')]('/api/dispositions',require('./api/disposition'));_0x27cd90[_0x7295('0xa')](_0x7295('0x7f'),require('./api/condition'));_0x27cd90[_0x7295('0xa')](_0x7295('0x80'),require(_0x7295('0x81')));_0x27cd90['use'](_0x7295('0x82'),require(_0x7295('0x83')));_0x27cd90[_0x7295('0xa')](_0x7295('0x84'),require(_0x7295('0x85')));_0x27cd90[_0x7295('0xa')](_0x7295('0x86'),require(_0x7295('0x87')));_0x27cd90['use']('/api/schedules',require(_0x7295('0x88')));_0x27cd90['use'](_0x7295('0x89'),require(_0x7295('0x8a')));_0x27cd90[_0x7295('0xa')](_0x7295('0x8b'),require('./api/tag'));_0x27cd90[_0x7295('0xa')](_0x7295('0x8c'),require(_0x7295('0x8d')));_0x27cd90[_0x7295('0xa')](_0x7295('0x8e'),require(_0x7295('0x8f')));_0x27cd90['use'](_0x7295('0x90'),require('./api/variable'));_0x27cd90[_0x7295('0xa')](_0x7295('0x91'),require('./api/integration'));_0x27cd90['use']('/api/integrations/reports',require(_0x7295('0x92')));_0x27cd90[_0x7295('0xa')](_0x7295('0x93'),require('./api/analyticCustomReport'));_0x27cd90[_0x7295('0xa')](_0x7295('0x94'),require('./api/analyticDefaultReport'));_0x27cd90[_0x7295('0xa')](_0x7295('0x95'),require(_0x7295('0x96')));_0x27cd90[_0x7295('0xa')](_0x7295('0x97'),require(_0x7295('0x98')));_0x27cd90['use'](_0x7295('0x99'),require(_0x7295('0x9a')));_0x27cd90['use'](_0x7295('0x9b'),require(_0x7295('0x9c')));_0x27cd90['use'](_0x7295('0x9d'),require(_0x7295('0x9e')));_0x27cd90[_0x7295('0xa')](_0x7295('0x9f'),require(_0x7295('0xa0')));_0x27cd90['use'](_0x7295('0xa1'),require(_0x7295('0xa2')));_0x27cd90[_0x7295('0xa')]('/api/integrations/sugarcrm/accounts',require(_0x7295('0xa3')));_0x27cd90[_0x7295('0xa')]('/api/integrations/sugarcrm/configurations',require(_0x7295('0xa4')));_0x27cd90['use']('/api/integrations/sugarcrm/fields',require(_0x7295('0xa5')));_0x27cd90[_0x7295('0xa')]('/api/integrations/desk/accounts',require(_0x7295('0xa6')));_0x27cd90['use'](_0x7295('0xa7'),require(_0x7295('0xa8')));_0x27cd90[_0x7295('0xa')](_0x7295('0xa9'),require(_0x7295('0xaa')));_0x27cd90[_0x7295('0xa')](_0x7295('0xab'),require('./api/intZohoAccount'));_0x27cd90['use']('/api/integrations/zoho/configurations',require(_0x7295('0xac')));_0x27cd90[_0x7295('0xa')]('/api/integrations/zoho/fields',require(_0x7295('0xad')));_0x27cd90[_0x7295('0xa')](_0x7295('0xae'),require('./api/intZendeskAccount'));_0x27cd90['use'](_0x7295('0xaf'),require(_0x7295('0xb0')));_0x27cd90[_0x7295('0xa')](_0x7295('0xb1'),require(_0x7295('0xb2')));_0x27cd90[_0x7295('0xa')](_0x7295('0xb3'),require('./api/intFreshdeskAccount'));_0x27cd90[_0x7295('0xa')]('/api/integrations/freshdesk/configurations',require(_0x7295('0xb4')));_0x27cd90[_0x7295('0xa')](_0x7295('0xb5'),require('./api/intFreshdeskField'));_0x27cd90[_0x7295('0xa')]('/api/integrations/vtiger/accounts',require(_0x7295('0xb6')));_0x27cd90[_0x7295('0xa')](_0x7295('0xb7'),require(_0x7295('0xb8')));_0x27cd90['use'](_0x7295('0xb9'),require(_0x7295('0xba')));_0x27cd90[_0x7295('0xa')](_0x7295('0xbb'),require('./api/intServicenowAccount'));_0x27cd90[_0x7295('0xa')]('/api/integrations/servicenow/configurations',require(_0x7295('0xbc')));_0x27cd90[_0x7295('0xa')]('/api/integrations/servicenow/fields',require(_0x7295('0xbd')));_0x27cd90[_0x7295('0xa')](_0x7295('0xbe'),require(_0x7295('0xbf')));_0x27cd90[_0x7295('0xa')](_0x7295('0xc0'),require(_0x7295('0xc1')));_0x27cd90[_0x7295('0xa')]('/api/integrations/dynamics365/fields',require(_0x7295('0xc2')));_0x27cd90[_0x7295('0xa')](_0x7295('0xc3'),require(_0x7295('0xc4')));_0x27cd90['use'](_0x7295('0xc5'),require(_0x7295('0xc6')));_0x27cd90[_0x7295('0xa')]('/api/integrations/freshsales/fields',require(_0x7295('0xc7')));_0x27cd90[_0x7295('0xa')]('/api/networks',require(_0x7295('0xc8')));_0x27cd90[_0x7295('0xa')](_0x7295('0xc9'),require(_0x7295('0xca')));_0x27cd90[_0x7295('0xa')](_0x7295('0xcb'),require(_0x7295('0xcc')));_0x27cd90['use'](_0x7295('0xcd'),require('./api/jscriptyAnswerReport'));_0x27cd90['use'](_0x7295('0xce'),require('./api/jscriptyQuestionReport'));_0x27cd90['use']('/api/jscripty/sessions/reports',require('./api/jscriptySessionReport'));_0x27cd90['use'](_0x7295('0xcf'),require(_0x7295('0xd0')));_0x27cd90['use'](_0x7295('0xd1'),require(_0x7295('0xd2')));_0x27cd90[_0x7295('0xa')]('/api/square/details/reports',require(_0x7295('0xd3')));_0x27cd90[_0x7295('0xa')]('/api/jscripty/projects',require(_0x7295('0xd4')));_0x27cd90['use'](_0x7295('0xd5'),require(_0x7295('0xd6')));_0x27cd90[_0x7295('0xa')]('/api/square/odbc',require(_0x7295('0xd7')));_0x27cd90[_0x7295('0xa')](_0x7295('0xd8'),require(_0x7295('0xd9')));_0x27cd90[_0x7295('0xa')]('/api/square/recordings',require('./api/squareRecording'));_0x27cd90[_0x7295('0xa')]('/api/square/messages',require(_0x7295('0xda')));_0x27cd90['use'](_0x7295('0xdb'),require('./api/team'));_0x27cd90[_0x7295('0xa')](_0x7295('0xdc'),require(_0x7295('0xdd')));_0x27cd90[_0x7295('0xa')](_0x7295('0xde'),require(_0x7295('0xdf')));_0x27cd90[_0x7295('0xa')](_0x7295('0xe0'),require(_0x7295('0xe1')));_0x27cd90['use'](_0x7295('0xe2'),require(_0x7295('0xe3')));_0x27cd90[_0x7295('0xa')](_0x7295('0xe4'),require(_0x7295('0xe5')));_0x27cd90[_0x7295('0xa')](_0x7295('0xe6'),require(_0x7295('0xe7')));_0x27cd90[_0x7295('0xa')]('/api/chat/reports/transfer',require(_0x7295('0xe8')));_0x27cd90[_0x7295('0xa')](_0x7295('0xe9'),require(_0x7295('0xea')));_0x27cd90[_0x7295('0xa')](_0x7295('0xeb'),require(_0x7295('0xec')));_0x27cd90[_0x7295('0xa')](_0x7295('0xed'),require(_0x7295('0xee')));_0x27cd90[_0x7295('0xa')](_0x7295('0xef'),require('./api/cmList'));_0x27cd90[_0x7295('0xa')]('/api/voice/prefixes',require(_0x7295('0xf0')));_0x27cd90[_0x7295('0xa')](_0x7295('0xf1'),require(_0x7295('0xf2')));_0x27cd90[_0x7295('0xa')]('/api/userProfile/sections',require(_0x7295('0xf3')));_0x27cd90[_0x7295('0xa')](_0x7295('0xf4'),require(_0x7295('0xf5')));_0x27cd90[_0x7295('0xa')](_0x7295('0xf6'),require(_0x7295('0xf7')));_0x27cd90[_0x7295('0xa')](_0x7295('0xf8'),require(_0x7295('0xf9')));_0x27cd90['use']('/api/whatsapp/applications',require(_0x7295('0xfa')));_0x27cd90[_0x7295('0xa')](_0x7295('0xfb'),require(_0x7295('0xfc')));_0x27cd90['use'](_0x7295('0xfd'),require(_0x7295('0xfe')));_0x27cd90[_0x7295('0xa')]('/api/whatsapp/reports/queue',require('./api/whatsappQueueReport'));_0x27cd90[_0x7295('0xa')](_0x7295('0xff'),require('./api/whatsappTransferReport'));_0x27cd90[_0x7295('0xa')](_0x7295('0x100'),require(_0x7295('0x101')));_0x27cd90[_0x7295('0xa')](_0x7295('0x102'),require(_0x7295('0x103')));_0x27cd90[_0x7295('0xa')]('/api/auth/local',require('./api/authLocal'));_0x27cd90['use']('/api/auth/google',require('./api/authGoogle'));_0x27cd90[_0x7295('0xa')]('/api/jira',require(_0x7295('0x104')));_0x27cd90[_0x7295('0xa')](_0x7295('0x105'),require(_0x7295('0x106')));_0x27cd90[_0x7295('0xa')](_0x7295('0x107'),require(_0x7295('0x108')));_0x27cd90[_0x7295('0xa')](_0x7295('0x109'),require(_0x7295('0x10a')));_0x27cd90[_0x7295('0xa')](_0x7295('0x10b'),require(_0x7295('0x10c')));_0x27cd90['use'](_0x7295('0x10d'),require(_0x7295('0x10e')));_0x27cd90[_0x7295('0xa')](_0x7295('0x10f'),express['static'](path[_0x7295('0x110')](config[_0x7295('0x111')],_0x7295('0x10f'))));_0x27cd90[_0x7295('0xa')](_0x7295('0x112'),express[_0x7295('0x113')](path[_0x7295('0x110')](config[_0x7295('0x111')],'/www')));_0x27cd90[_0x7295('0xa')]('/demo',express['static'](path[_0x7295('0x110')](config['root'],_0x7295('0x114'))));_0x27cd90[_0x7295('0xa')](_0x7295('0x115'),express[_0x7295('0x113')](path['join'](config[_0x7295('0x111')],_0x7295('0x116'),_0x7295('0x117'))));_0x27cd90[_0x7295('0xa')](_0x7295('0x118'),express[_0x7295('0x113')](path[_0x7295('0x110')](config['root'],'/server/files/plugins')));_0x27cd90[_0x7295('0x119')](_0x7295('0x11a'))[_0x7295('0x11b')](errors[0x194]);_0x27cd90['route']('/*')['get'](function(_0x3635a7,_0x12ad7d){_0x12ad7d['sendFile'](path[_0x7295('0x11c')](_0x27cd90['get'](_0x7295('0x11d'))+_0x7295('0x11e')));});}; \ No newline at end of file +var _0x3d5b=['/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','./api/attachment','/api/plugins','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','/api/userProfile/sections','/api/userProfile/resources','/api/notifications','./api/notification','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','./api/version','./api/system','/api/pm2','/api/webbar','./api/webbar','/apidoc','/www','static','join','root','/demo','snippet','1.0.16','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','appPath','path','express','util','./errors','./config/logger','auth','default','use','logger','format','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','method','headers','x-forwarded-for','remoteAddress','url','statusCode','responseTime','user','name','role','body','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','other','agent_id','agent_name','test','/api/users','./api/user','/api/voice/chanspy','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','/api/mail/applications','/api/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/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','/api/intervals','./api/interval','/api/pauses','/api/cdr','./api/cdr','/api/voiceQueuesLog','/api/schedules'];(function(_0x80b9b8,_0x2a2163){var _0xb7fe18=function(_0x4db660){while(--_0x4db660){_0x80b9b8['push'](_0x80b9b8['shift']());}};_0xb7fe18(++_0x2a2163);}(_0x3d5b,0x1c3));var _0xb3d5=function(_0x3e9ae3,_0x4e7332){_0x3e9ae3=_0x3e9ae3-0x0;var _0x203226=_0x3d5b[_0x3e9ae3];return _0x203226;};'use strict';var path=require(_0xb3d5('0x0'));var express=require(_0xb3d5('0x1'));var ewinston=require('express-winston');var util=require(_0xb3d5('0x2'));var errors=require(_0xb3d5('0x3'));var config=require('./config/environment');var logger=require('./config/logger')('api');var authLogger=require(_0xb3d5('0x4'))(_0xb3d5('0x5'));exports[_0xb3d5('0x6')]=function(_0x281e4d){_0x281e4d[_0xb3d5('0x7')](ewinston[_0xb3d5('0x8')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x517fe9,_0x366b32){return util[_0xb3d5('0x9')](_0xb3d5('0xa'),_0x517fe9[_0xb3d5('0xb')],_0x517fe9[_0xb3d5('0xc')]['x-forwarded-for']?_0x517fe9[_0xb3d5('0xc')][_0xb3d5('0xd')]:_0x517fe9['connection'][_0xb3d5('0xe')]||_0x517fe9['ip'],_0x517fe9[_0xb3d5('0xf')],_0x366b32[_0xb3d5('0x10')],_0x366b32[_0xb3d5('0x11')],_0x517fe9[_0xb3d5('0x12')]?_0x517fe9[_0xb3d5('0x12')]['id']:null,_0x517fe9[_0xb3d5('0x12')]?_0x517fe9['user'][_0xb3d5('0x13')]:null,_0x517fe9[_0xb3d5('0x12')]?_0x517fe9['user'][_0xb3d5('0x14')]:null);}}));_0x281e4d[_0xb3d5('0x7')](ewinston[_0xb3d5('0x8')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x3fd056,_0x4c8a6c){var _0x594227='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x3fd056[_0xb3d5('0x15')]&&_0x3fd056['body'][_0xb3d5('0x16')]&&_0x3fd056['body']['agent_id']){_0x594227=_0xb3d5('0x17');}return util['format'](_0x594227,_0x3fd056['method'],_0x3fd056['headers'][_0xb3d5('0xd')]?_0x3fd056['headers'][_0xb3d5('0xd')]:_0x3fd056['connection']['remoteAddress']||_0x3fd056['ip'],_0x3fd056['url'],_0x4c8a6c[_0xb3d5('0x10')],_0x4c8a6c[_0xb3d5('0x11')],_0x3fd056['user']?_0x3fd056['user']['id']:null,_0x3fd056[_0xb3d5('0x12')]?_0x3fd056['user'][_0xb3d5('0x13')]:null,_0x3fd056[_0xb3d5('0x12')]?_0x3fd056[_0xb3d5('0x12')][_0xb3d5('0x14')]:null,_0x3fd056['body']&&_0x3fd056[_0xb3d5('0x15')][_0xb3d5('0x16')]?_0x3fd056[_0xb3d5('0x15')][_0xb3d5('0x16')]:_0xb3d5('0x18'),_0x3fd056['body']&&_0x3fd056['body'][_0xb3d5('0x19')]?_0x3fd056['body'][_0xb3d5('0x19')]:'',_0x3fd056[_0xb3d5('0x15')]&&_0x3fd056[_0xb3d5('0x15')]['agent_name']?_0x3fd056[_0xb3d5('0x15')][_0xb3d5('0x1a')]:'');},'ignoreRoute':function(_0x6a1db6){var _0x40a814=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x40a814[_0xb3d5('0x1b')](_0x6a1db6['url']);}}));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x1c'),require(_0xb3d5('0x1d')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x1e'),require('./api/voiceChanSpy'));_0x281e4d[_0xb3d5('0x7')]('/api/voice/contexts',require('./api/voiceContext'));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x1f'),require(_0xb3d5('0x20')));_0x281e4d['use'](_0xb3d5('0x21'),require('./api/voiceMusicOnHold'));_0x281e4d['use'](_0xb3d5('0x22'),require(_0xb3d5('0x23')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x24'),require('./api/voiceRecording'));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x25'),require(_0xb3d5('0x26')));_0x281e4d['use'](_0xb3d5('0x27'),require(_0xb3d5('0x28')));_0x281e4d[_0xb3d5('0x7')]('/api/voice/mails/messages',require(_0xb3d5('0x29')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x2a'),require(_0xb3d5('0x2b')));_0x281e4d['use'](_0xb3d5('0x2c'),require(_0xb3d5('0x2d')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x2e'),require(_0xb3d5('0x2f')));_0x281e4d['use'](_0xb3d5('0x30'),require('./api/voiceQueueReport'));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x31'),require(_0xb3d5('0x32')));_0x281e4d[_0xb3d5('0x7')]('/api/trunks',require(_0xb3d5('0x33')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x34'),require('./api/voiceTransferReport'));_0x281e4d['use'](_0xb3d5('0x35'),require(_0xb3d5('0x36')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x37'),require(_0xb3d5('0x38')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x39'),require(_0xb3d5('0x3a')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x3b'),require('./api/mailSubstatus'));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x3c'),require(_0xb3d5('0x3d')));_0x281e4d[_0xb3d5('0x7')]('/api/mail/messages',require(_0xb3d5('0x3e')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x3f'),require('./api/mailApplication'));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x40'),require('./api/mailQueueReport'));_0x281e4d['use'](_0xb3d5('0x41'),require(_0xb3d5('0x42')));_0x281e4d['use'](_0xb3d5('0x43'),require(_0xb3d5('0x44')));_0x281e4d['use'](_0xb3d5('0x45'),require(_0xb3d5('0x46')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x47'),require(_0xb3d5('0x48')));_0x281e4d['use'](_0xb3d5('0x49'),require('./api/faxInteraction'));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x4a'),require(_0xb3d5('0x4b')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x4c'),require('./api/faxQueue'));_0x281e4d[_0xb3d5('0x7')]('/api/fax/reports/queue',require(_0xb3d5('0x4d')));_0x281e4d['use'](_0xb3d5('0x4e'),require(_0xb3d5('0x4f')));_0x281e4d['use'](_0xb3d5('0x50'),require(_0xb3d5('0x51')));_0x281e4d[_0xb3d5('0x7')]('/api/sms/interactions',require(_0xb3d5('0x52')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x53'),require(_0xb3d5('0x54')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x55'),require(_0xb3d5('0x56')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x57'),require(_0xb3d5('0x58')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x59'),require(_0xb3d5('0x5a')));_0x281e4d[_0xb3d5('0x7')]('/api/openchannel/interactions',require(_0xb3d5('0x5b')));_0x281e4d[_0xb3d5('0x7')]('/api/openchannel/messages',require('./api/openchannelMessage'));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x5c'),require(_0xb3d5('0x5d')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x5e'),require('./api/chatWebsite'));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x5f'),require(_0xb3d5('0x60')));_0x281e4d[_0xb3d5('0x7')]('/api/chat/applications',require(_0xb3d5('0x61')));_0x281e4d[_0xb3d5('0x7')]('/api/chat/interactions',require(_0xb3d5('0x62')));_0x281e4d[_0xb3d5('0x7')]('/api/chat/messages',require(_0xb3d5('0x63')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x64'),require(_0xb3d5('0x65')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x66'),require(_0xb3d5('0x67')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x68'),require('./api/chatGroup'));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x69'),require(_0xb3d5('0x6a')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x6b'),require('./api/cmCompany'));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x6c'),require(_0xb3d5('0x6d')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x6e'),require(_0xb3d5('0x6f')));_0x281e4d['use']('/api/cm/hopper_black',require(_0xb3d5('0x70')));_0x281e4d['use'](_0xb3d5('0x71'),require(_0xb3d5('0x72')));_0x281e4d[_0xb3d5('0x7')]('/api/cm/hopper_history',require('./api/cmHopperHistory'));_0x281e4d[_0xb3d5('0x7')]('/api/cm/custom_fields',require('./api/cmCustomField'));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x73'),require(_0xb3d5('0x74')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x75'),require(_0xb3d5('0x76')));_0x281e4d['use'](_0xb3d5('0x77'),require(_0xb3d5('0x78')));_0x281e4d['use'](_0xb3d5('0x79'),require(_0xb3d5('0x7a')));_0x281e4d[_0xb3d5('0x7')]('/api/conditions',require(_0xb3d5('0x7b')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x7c'),require(_0xb3d5('0x7d')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x7e'),require('./api/pause'));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x7f'),require(_0xb3d5('0x80')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x81'),require('./api/voiceQueuesLog'));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x82'),require('./api/schedule'));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x83'),require(_0xb3d5('0x84')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x85'),require(_0xb3d5('0x86')));_0x281e4d['use'](_0xb3d5('0x87'),require(_0xb3d5('0x88')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x89'),require(_0xb3d5('0x8a')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x8b'),require(_0xb3d5('0x8c')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x8d'),require('./api/integration'));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x8e'),require(_0xb3d5('0x8f')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x90'),require(_0xb3d5('0x91')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x92'),require(_0xb3d5('0x93')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x94'),require(_0xb3d5('0x95')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x96'),require('./api/analyticMetric'));_0x281e4d[_0xb3d5('0x7')]('/api/analytics/field_reports',require(_0xb3d5('0x97')));_0x281e4d['use'](_0xb3d5('0x98'),require(_0xb3d5('0x99')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x9a'),require('./api/intSalesforceAccount'));_0x281e4d['use'](_0xb3d5('0x9b'),require(_0xb3d5('0x9c')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x9d'),require('./api/intSalesforceField'));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x9e'),require(_0xb3d5('0x9f')));_0x281e4d[_0xb3d5('0x7')]('/api/integrations/sugarcrm/configurations',require('./api/intSugarcrmConfiguration'));_0x281e4d['use'](_0xb3d5('0xa0'),require(_0xb3d5('0xa1')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0xa2'),require(_0xb3d5('0xa3')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0xa4'),require(_0xb3d5('0xa5')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0xa6'),require(_0xb3d5('0xa7')));_0x281e4d['use']('/api/integrations/zoho/accounts',require(_0xb3d5('0xa8')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0xa9'),require(_0xb3d5('0xaa')));_0x281e4d['use'](_0xb3d5('0xab'),require(_0xb3d5('0xac')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0xad'),require(_0xb3d5('0xae')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0xaf'),require('./api/intZendeskConfiguration'));_0x281e4d['use']('/api/integrations/zendesk/fields',require(_0xb3d5('0xb0')));_0x281e4d['use'](_0xb3d5('0xb1'),require(_0xb3d5('0xb2')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0xb3'),require('./api/intFreshdeskConfiguration'));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0xb4'),require(_0xb3d5('0xb5')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0xb6'),require(_0xb3d5('0xb7')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0xb8'),require(_0xb3d5('0xb9')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0xba'),require('./api/intVtigerField'));_0x281e4d[_0xb3d5('0x7')]('/api/integrations/servicenow/accounts',require(_0xb3d5('0xbb')));_0x281e4d['use'](_0xb3d5('0xbc'),require(_0xb3d5('0xbd')));_0x281e4d[_0xb3d5('0x7')]('/api/integrations/servicenow/fields',require(_0xb3d5('0xbe')));_0x281e4d[_0xb3d5('0x7')]('/api/integrations/dynamics365/accounts',require(_0xb3d5('0xbf')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0xc0'),require(_0xb3d5('0xc1')));_0x281e4d['use'](_0xb3d5('0xc2'),require(_0xb3d5('0xc3')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0xc4'),require(_0xb3d5('0xc5')));_0x281e4d[_0xb3d5('0x7')]('/api/integrations/freshsales/configurations',require(_0xb3d5('0xc6')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0xc7'),require(_0xb3d5('0xc8')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0xc9'),require(_0xb3d5('0xca')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0xcb'),require(_0xb3d5('0xcc')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0xcd'),require(_0xb3d5('0xce')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0xcf'),require('./api/jscriptyAnswerReport'));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0xd0'),require(_0xb3d5('0xd1')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0xd2'),require(_0xb3d5('0xd3')));_0x281e4d['use']('/api/sms/reports/queue',require(_0xb3d5('0xd4')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0xd5'),require(_0xb3d5('0xd6')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0xd7'),require(_0xb3d5('0xd8')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0xd9'),require(_0xb3d5('0xda')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0xdb'),require(_0xb3d5('0xdc')));_0x281e4d['use'](_0xb3d5('0xdd'),require(_0xb3d5('0xde')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0xdf'),require(_0xb3d5('0xe0')));_0x281e4d['use'](_0xb3d5('0xe1'),require('./api/squareRecording'));_0x281e4d[_0xb3d5('0x7')]('/api/square/messages',require(_0xb3d5('0xe2')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0xe3'),require(_0xb3d5('0xe4')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0xe5'),require(_0xb3d5('0xe6')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0xe7'),require(_0xb3d5('0xe8')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0xe9'),require(_0xb3d5('0xea')));_0x281e4d[_0xb3d5('0x7')]('/api/attachments',require(_0xb3d5('0xeb')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0xec'),require(_0xb3d5('0xed')));_0x281e4d['use']('/api/mail/reports/transfer',require(_0xb3d5('0xee')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0xef'),require('./api/chatTransferReport'));_0x281e4d[_0xb3d5('0x7')]('/api/fax/reports/transfer',require(_0xb3d5('0xf0')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0xf1'),require(_0xb3d5('0xf2')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0xf3'),require(_0xb3d5('0xf4')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0xf5'),require('./api/cmList'));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0xf6'),require(_0xb3d5('0xf7')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0xf8'),require('./api/userProfile'));_0x281e4d['use'](_0xb3d5('0xf9'),require('./api/userProfileSection'));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0xfa'),require('./api/userProfileResource'));_0x281e4d['use'](_0xb3d5('0xfb'),require(_0xb3d5('0xfc')));_0x281e4d[_0xb3d5('0x7')]('/api/whatsapp/accounts',require(_0xb3d5('0xfd')));_0x281e4d['use'](_0xb3d5('0xfe'),require(_0xb3d5('0xff')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x100'),require(_0xb3d5('0x101')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x102'),require(_0xb3d5('0x103')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x104'),require(_0xb3d5('0x105')));_0x281e4d['use']('/api/whatsapp/reports/transfer',require(_0xb3d5('0x106')));_0x281e4d[_0xb3d5('0x7')]('/api/whatsapp/queues',require(_0xb3d5('0x107')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x108'),require('./api/cloudProvider'));_0x281e4d['use']('/api/auth/local',require(_0xb3d5('0x109')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x10a'),require(_0xb3d5('0x10b')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x10c'),require(_0xb3d5('0x10d')));_0x281e4d['use'](_0xb3d5('0x10e'),require(_0xb3d5('0x10f')));_0x281e4d[_0xb3d5('0x7')]('/api/version',require(_0xb3d5('0x110')));_0x281e4d[_0xb3d5('0x7')]('/api/system',require(_0xb3d5('0x111')));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x112'),require('./api/pm2'));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x113'),require(_0xb3d5('0x114')));_0x281e4d[_0xb3d5('0x7')]('/apidoc',express['static'](path['join'](config['root'],_0xb3d5('0x115'))));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x116'),express[_0xb3d5('0x117')](path[_0xb3d5('0x118')](config[_0xb3d5('0x119')],'/www')));_0x281e4d['use'](_0xb3d5('0x11a'),express[_0xb3d5('0x117')](path[_0xb3d5('0x118')](config[_0xb3d5('0x119')],_0xb3d5('0x11a'))));_0x281e4d[_0xb3d5('0x7')]('/snippet',express['static'](path[_0xb3d5('0x118')](config[_0xb3d5('0x119')],_0xb3d5('0x11b'),_0xb3d5('0x11c'))));_0x281e4d[_0xb3d5('0x7')](_0xb3d5('0x11d'),express['static'](path['join'](config[_0xb3d5('0x119')],_0xb3d5('0x11e'))));_0x281e4d[_0xb3d5('0x11f')](_0xb3d5('0x120'))[_0xb3d5('0x121')](errors[0x194]);_0x281e4d[_0xb3d5('0x11f')]('/*')['get'](function(_0x36ec45,_0x2577dc){_0x2577dc['sendFile'](path['resolve'](_0x281e4d['get'](_0xb3d5('0x122'))+'/index.html'));});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index fb3e9a9..7f9aeda 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xddd9=['../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','jayson/promise','bluebird','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc'];(function(_0x596818,_0x357c06){var _0xed04e5=function(_0x114357){while(--_0x114357){_0x596818['push'](_0x596818['shift']());}};_0xed04e5(++_0x357c06);}(_0xddd9,0xb4));var _0x9ddd=function(_0x1e6b78,_0x1d0638){_0x1e6b78=_0x1e6b78-0x0;var _0x590b02=_0xddd9[_0x1e6b78];return _0x590b02;};'use strict';var jayson=require(_0x9ddd('0x0'));var BPromise=require(_0x9ddd('0x1'));var _=require(_0x9ddd('0x2'));var config=require(_0x9ddd('0x3'));exports[_0x9ddd('0x4')]=function(){return new BPromise(function(_0x178c3c,_0x2cdced){var _0x2de2fc={};_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require(_0x9ddd('0x6')));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require(_0x9ddd('0x7')));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require(_0x9ddd('0x8')));_0x2de2fc=_['merge'](_0x2de2fc,require(_0x9ddd('0x9')));_0x2de2fc=_['merge'](_0x2de2fc,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require(_0x9ddd('0xa')));_0x2de2fc=_['merge'](_0x2de2fc,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x2de2fc=_['merge'](_0x2de2fc,require(_0x9ddd('0xb')));_0x2de2fc=_['merge'](_0x2de2fc,require('../api/trunk/trunk.rpc'));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require(_0x9ddd('0xc')));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require(_0x9ddd('0xd')));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require(_0x9ddd('0xe')));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require(_0x9ddd('0xf')));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require(_0x9ddd('0x10')));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require(_0x9ddd('0x11')));_0x2de2fc=_['merge'](_0x2de2fc,require(_0x9ddd('0x12')));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require(_0x9ddd('0x13')));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require(_0x9ddd('0x14')));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require(_0x9ddd('0x15')));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require('../api/faxApplication/faxApplication.rpc'));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require(_0x9ddd('0x16')));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require(_0x9ddd('0x17')));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require('../api/faxQueue/faxQueue.rpc'));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require(_0x9ddd('0x18')));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require(_0x9ddd('0x19')));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require(_0x9ddd('0x1a')));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require(_0x9ddd('0x1b')));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require(_0x9ddd('0x1c')));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require(_0x9ddd('0x1d')));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require(_0x9ddd('0x1e')));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require(_0x9ddd('0x1f')));_0x2de2fc=_['merge'](_0x2de2fc,require('../api/chatInteraction/chatInteraction.rpc'));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require('../api/chatMessage/chatMessage.rpc'));_0x2de2fc=_['merge'](_0x2de2fc,require(_0x9ddd('0x20')));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require(_0x9ddd('0x21')));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require('../api/cmHopper/cmHopper.rpc'));_0x2de2fc=_['merge'](_0x2de2fc,require(_0x9ddd('0x22')));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require(_0x9ddd('0x23')));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require(_0x9ddd('0x24')));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require(_0x9ddd('0x25')));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require('../api/interval/interval.rpc'));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require(_0x9ddd('0x26')));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require(_0x9ddd('0x27')));_0x2de2fc=_['merge'](_0x2de2fc,require(_0x9ddd('0x28')));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require('../api/trigger/trigger.rpc'));_0x2de2fc=_['merge'](_0x2de2fc,require('../api/variable/variable.rpc'));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require(_0x9ddd('0x29')));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require(_0x9ddd('0x2a')));_0x2de2fc=_['merge'](_0x2de2fc,require(_0x9ddd('0x2b')));_0x2de2fc=_['merge'](_0x2de2fc,require(_0x9ddd('0x2c')));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require(_0x9ddd('0x2d')));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require(_0x9ddd('0x2e')));_0x2de2fc=_['merge'](_0x2de2fc,require(_0x9ddd('0x2f')));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require(_0x9ddd('0x30')));_0x2de2fc=_['merge'](_0x2de2fc,require(_0x9ddd('0x31')));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require(_0x9ddd('0x32')));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require(_0x9ddd('0x33')));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x2de2fc=_['merge'](_0x2de2fc,require(_0x9ddd('0x34')));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require(_0x9ddd('0x35')));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require('../api/squareOdbc/squareOdbc.rpc'));_0x2de2fc=_['merge'](_0x2de2fc,require(_0x9ddd('0x36')));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require('../api/squareRecording/squareRecording.rpc'));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require(_0x9ddd('0x37')));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require(_0x9ddd('0x38')));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require(_0x9ddd('0x39')));_0x2de2fc=_['merge'](_0x2de2fc,require('../api/plugin/plugin.rpc'));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require(_0x9ddd('0x3a')));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require(_0x9ddd('0x3b')));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require(_0x9ddd('0x3c')));_0x2de2fc=_[_0x9ddd('0x5')](_0x2de2fc,require(_0x9ddd('0x3d')));var _0x450455=jayson[_0x9ddd('0x3e')](_0x2de2fc)[_0x9ddd('0x3f')]();var _0x21ef79=config[_0x9ddd('0x40')][_0x9ddd('0x41')]||config[_0x9ddd('0x41')]+0x1;var _0x3edfd9=config['rpc']['ip']||'localhost';_0x450455['on'](_0x9ddd('0x42'),function(_0x212c9b){return _0x2cdced(_0x212c9b);});_0x450455[_0x9ddd('0x4')](_0x21ef79,_0x3edfd9,function(){console[_0x9ddd('0x43')](_0x9ddd('0x44'),_0x3edfd9,_0x21ef79);require('../config/triggers')['default']();return _0x178c3c('RPC\x20listening\x20on\x20'+_0x3edfd9+':'+_0x21ef79);});});}; \ No newline at end of file +var _0x5f3e=['port','localhost','error','listen','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','bluebird','lodash','../config/environment','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','rpc'];(function(_0x43a485,_0x336240){var _0x10ffa6=function(_0x34ab8d){while(--_0x34ab8d){_0x43a485['push'](_0x43a485['shift']());}};_0x10ffa6(++_0x336240);}(_0x5f3e,0xc7));var _0xe5f3=function(_0x712dc7,_0x328e9f){_0x712dc7=_0x712dc7-0x0;var _0x5c1aa8=_0x5f3e[_0x712dc7];return _0x5c1aa8;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xe5f3('0x0'));var _=require(_0xe5f3('0x1'));var config=require(_0xe5f3('0x2'));exports['listen']=function(){return new BPromise(function(_0x2785fb,_0x356e6b){var _0x48abe4={};_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require('../api/user/user.rpc'));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require(_0xe5f3('0x4')));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require(_0xe5f3('0x5')));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require(_0xe5f3('0x6')));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require(_0xe5f3('0x7')));_0x48abe4=_['merge'](_0x48abe4,require(_0xe5f3('0x8')));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require(_0xe5f3('0x9')));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x48abe4=_['merge'](_0x48abe4,require('../api/memberReport/memberReport.rpc'));_0x48abe4=_['merge'](_0x48abe4,require(_0xe5f3('0xa')));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require(_0xe5f3('0xb')));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require(_0xe5f3('0xc')));_0x48abe4=_['merge'](_0x48abe4,require(_0xe5f3('0xd')));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require(_0xe5f3('0xe')));_0x48abe4=_['merge'](_0x48abe4,require(_0xe5f3('0xf')));_0x48abe4=_['merge'](_0x48abe4,require(_0xe5f3('0x10')));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require(_0xe5f3('0x11')));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require(_0xe5f3('0x12')));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require(_0xe5f3('0x13')));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require(_0xe5f3('0x14')));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require('../api/faxApplication/faxApplication.rpc'));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require('../api/faxInteraction/faxInteraction.rpc'));_0x48abe4=_['merge'](_0x48abe4,require(_0xe5f3('0x15')));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require(_0xe5f3('0x16')));_0x48abe4=_['merge'](_0x48abe4,require(_0xe5f3('0x17')));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require(_0xe5f3('0x18')));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require(_0xe5f3('0x19')));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require('../api/smsMessage/smsMessage.rpc'));_0x48abe4=_['merge'](_0x48abe4,require('../api/smsQueue/smsQueue.rpc'));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require(_0xe5f3('0x1a')));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require(_0xe5f3('0x1b')));_0x48abe4=_['merge'](_0x48abe4,require(_0xe5f3('0x1c')));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require(_0xe5f3('0x1d')));_0x48abe4=_['merge'](_0x48abe4,require(_0xe5f3('0x1e')));_0x48abe4=_['merge'](_0x48abe4,require(_0xe5f3('0x1f')));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require(_0xe5f3('0x20')));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require('../api/cmContact/cmContact.rpc'));_0x48abe4=_['merge'](_0x48abe4,require(_0xe5f3('0x21')));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require(_0xe5f3('0x22')));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require(_0xe5f3('0x23')));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x48abe4=_['merge'](_0x48abe4,require(_0xe5f3('0x24')));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require(_0xe5f3('0x25')));_0x48abe4=_['merge'](_0x48abe4,require(_0xe5f3('0x26')));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require(_0xe5f3('0x27')));_0x48abe4=_['merge'](_0x48abe4,require(_0xe5f3('0x28')));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require('../api/trigger/trigger.rpc'));_0x48abe4=_['merge'](_0x48abe4,require('../api/variable/variable.rpc'));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require(_0xe5f3('0x29')));_0x48abe4=_['merge'](_0x48abe4,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require(_0xe5f3('0x2a')));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require(_0xe5f3('0x2b')));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require(_0xe5f3('0x2c')));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require(_0xe5f3('0x2d')));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require(_0xe5f3('0x2e')));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require(_0xe5f3('0x2f')));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require('../api/squareReport/squareReport.rpc'));_0x48abe4=_['merge'](_0x48abe4,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require(_0xe5f3('0x30')));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require(_0xe5f3('0x31')));_0x48abe4=_['merge'](_0x48abe4,require(_0xe5f3('0x32')));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require(_0xe5f3('0x33')));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require(_0xe5f3('0x34')));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require('../api/attachment/attachment.rpc'));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require('../api/plugin/plugin.rpc'));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require(_0xe5f3('0x35')));_0x48abe4=_['merge'](_0x48abe4,require(_0xe5f3('0x36')));_0x48abe4=_[_0xe5f3('0x3')](_0x48abe4,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x21cb62=jayson[_0xe5f3('0x37')](_0x48abe4)['http']();var _0x2e395b=config[_0xe5f3('0x38')]['port']||config[_0xe5f3('0x39')]+0x1;var _0x2001c8=config[_0xe5f3('0x38')]['ip']||_0xe5f3('0x3a');_0x21cb62['on'](_0xe5f3('0x3b'),function(_0x127746){return _0x356e6b(_0x127746);});_0x21cb62[_0xe5f3('0x3c')](_0x2e395b,_0x2001c8,function(){console['log'](_0xe5f3('0x3d'),_0x2001c8,_0x2e395b);require(_0xe5f3('0x3e'))['default']();return _0x2785fb(_0xe5f3('0x3f')+_0x2001c8+':'+_0x2e395b);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index d589439..bfce39c 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 _0x70e0=['format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','join','EXEC\x20%s\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','./error','setEncoding','utf8','headers','emit','ready','line','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','substr','indexOf','length','match','error','code','close','E_AGI_SOCKET_CLOSE','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','inherits','prototype','command','sync','answer','getData','sendRequest'];(function(_0x10b5b5,_0x49e621){var _0x4a6111=function(_0x184ba3){while(--_0x184ba3){_0x10b5b5['push'](_0x10b5b5['shift']());}};_0x4a6111(++_0x49e621);}(_0x70e0,0x17b));var _0x070e=function(_0x4fcf4e,_0x361510){_0x4fcf4e=_0x4fcf4e-0x0;var _0x457555=_0x70e0[_0x4fcf4e];return _0x457555;};'use strict';var util=require(_0x070e('0x0'));var _=require(_0x070e('0x1'));var EventEmitter=require(_0x070e('0x2'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0x070e('0x3'));function AGIChannel(_0xee173){var _0x277d32=this,_0x2593e5=new AGIReply(),_0x5c90fc=![],_0x7bce9b={};EventEmitter['call'](_0x277d32);_0xee173[_0x070e('0x4')]('utf8');_0xee173['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x2593e5['setEncoding'](_0x070e('0x5'));_0x2593e5['on'](_0x070e('0x6'),function(_0x604664){for(var _0x2611e6 in _0x604664){_0x277d32[_0x2611e6]=_0x604664[_0x2611e6];}_0x277d32[_0x070e('0x7')](_0x070e('0x8'));});_0x2593e5['on'](_0x070e('0x9'),function(_0x4e99e6){if(_0x4e99e6['toLowerCase']()==_0x070e('0xa')){_0x277d32[_0x070e('0x7')](_0x070e('0xa'));return;}if(_0x4e99e6[_0x070e('0xb')](0x0,0xb)==_0x070e('0xc')){_0x5c90fc=!![];}if(_0x5c90fc){_0x7bce9b['rx']+=_0x4e99e6+'\x0a';if(_0x4e99e6[_0x070e('0xd')](_0x070e('0xe'))!=-0x1){_0x5c90fc=![];}}else{_0x7bce9b['rx']=_0x4e99e6;}if(_0x5c90fc){return;}if(typeof _0x7bce9b['cb']==_0x070e('0xf')){var _0x39d2b9=_0x7bce9b['rx']['substring'](0x0,0x3),_0x5bf079=null,_0x2930b8=null;_0x39d2b9=parseInt(_0x39d2b9);if(isNaN(_0x39d2b9)){_0x7bce9b['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x39d2b9!=0xc8){_0x7bce9b['cb'](null,{'code':_0x39d2b9,'result':-0x1,'extra':'KO'});return;}_0x5bf079=_0x7bce9b['rx'][_0x070e('0xb')](0x4)['replace']('result=','');if(_0x5bf079['indexOf']('\x20')!=-0x1){_0x5bf079=_0x5bf079[_0x070e('0x10')](0x0,_0x5bf079[_0x070e('0x11')]('\x20'));}if(_['startsWith'](_0x5bf079,'-1')){_0x5bf079=parseInt(_0x5bf079);}_0x2930b8=_0x7bce9b['rx']['split']('\x20');if(_0x2930b8[_0x070e('0x12')]==0x3){_0x2930b8=_0x2930b8[0x2][_0x070e('0xb')](0x1,_0x2930b8[0x2][_0x070e('0x12')]-0x1);}else if(_0x2930b8[_0x070e('0x12')]>0x3){var _0x5bc71e=/\((.+)\)/;var _0x49861b=_0x7bce9b['rx'][_0x070e('0x13')](_0x5bc71e);if(_0x49861b){_0x2930b8=_0x49861b[0x1];}else{_0x2930b8=null;}}else{_0x2930b8=null;}_0x7bce9b['cb'](null,{'code':_0x39d2b9,'result':_0x5bf079,'extra':_0x2930b8});}});_0xee173['on'](_0x070e('0x14'),function(_0x38f6e6){_0x277d32[_0x070e('0x7')](_0x070e('0x14'),new AGIError('E_AGI_SOCKET_ERROR',_0x38f6e6[_0x070e('0x15')]));});_0xee173['on'](_0x070e('0x16'),function(){_0x277d32[_0x070e('0x7')](_0x070e('0x16'),new AGIError(_0x070e('0x17')));});_0xee173['on']('timeout',function(){_0x277d32['emit']('timeout',new AGIError(_0x070e('0x18')));_0xee173[_0x070e('0x19')]();});_0xee173[_0x070e('0x1a')](_0x2593e5);this['command']=function(_0x5b184,_0x5dc5d2){var _0x5b184=_0x5b184||'',_0x5dc5d2=typeof _0x5dc5d2==_0x070e('0xf')?_0x5dc5d2:new Function();_0x7bce9b={'tx':_0x5b184,'rx':'','cb':_0x5dc5d2};_0xee173[_0x070e('0x1b')](_0x5b184+'\x0a');},this[_0x070e('0x16')]=function(){_0xee173[_0x070e('0x19')]();};}util[_0x070e('0x1c')](AGIChannel,EventEmitter);AGIChannel[_0x070e('0x1d')]['sendRequest']=function(_0x2f8055){return this[_0x070e('0x1e')][_0x070e('0x1f')](this,_0x2f8055);};AGIChannel['prototype'][_0x070e('0x20')]=function(){return this['sendRequest']('ANSWER');};AGIChannel[_0x070e('0x1d')][_0x070e('0x21')]=function(_0x41deb1,_0x1743cc,_0x4763c6){_0x41deb1=_0x41deb1===undefined?'beep':_0x41deb1;_0x1743cc=_0x1743cc===undefined?'5':_0x1743cc;_0x4763c6=_0x4763c6===undefined?'1':_0x4763c6;return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x24'),_0x41deb1,_0x1743cc*0x3e8,_0x4763c6));};AGIChannel[_0x070e('0x1d')][_0x070e('0x25')]=function(_0x28d7f2){_0x28d7f2=_0x28d7f2||_0x070e('0x26');return this[_0x070e('0x22')](util['format'](_0x070e('0x27'),_0x28d7f2));};AGIChannel[_0x070e('0x1d')][_0x070e('0x28')]=function(_0x56fc12,_0x5c5f0d){if(_[_0x070e('0x29')](_0x5c5f0d)){return this[_0x070e('0x22')](util[_0x070e('0x23')]('EXEC\x20%s\x20%s',_0x56fc12,_0x5c5f0d[_0x070e('0x2a')](',')));}return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x2b'),_0x56fc12,_0x5c5f0d));};AGIChannel['prototype']['setContext']=function(_0x523b75){return this['sendRequest'](util[_0x070e('0x23')]('SET\x20CONTEXT\x20%s',_0x523b75));};AGIChannel[_0x070e('0x1d')][_0x070e('0x2c')]=function(_0x4f8130){return this['sendRequest'](util[_0x070e('0x23')](_0x070e('0x2d'),_0x4f8130));};AGIChannel['prototype']['setPriority']=function(_0x41ade4){return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x2e'),_0x41ade4));};AGIChannel[_0x070e('0x1d')]['hangup']=function(){return this['sendRequest'](_0x070e('0x2f'));};AGIChannel[_0x070e('0x1d')][_0x070e('0x30')]=function(_0xf57ed,_0xf11439){var _0x4deaf8=_[_0x070e('0x31')](_0xf11439)||_[_0x070e('0x32')](_0xf11439)?_0xf11439['toString']():_0xf11439;return this[_0x070e('0x22')](util[_0x070e('0x23')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0xf57ed,_0x4deaf8?_0x4deaf8['toString']()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x070e('0x1d')][_0x070e('0x33')]=function(_0x39dfaa,_0x334733){return this[_0x070e('0x22')](util['format'](_0x070e('0x34'),_0x39dfaa,_0x334733));};AGIChannel[_0x070e('0x1d')][_0x070e('0x35')]=function(_0x487276,_0x268c5d){return this[_0x070e('0x22')](util[_0x070e('0x23')]('SAY\x20DIGITS\x20%s\x20%s',_0x487276,_0x268c5d));};AGIChannel[_0x070e('0x1d')][_0x070e('0x36')]=function(_0x4800a9,_0x173602){return this['sendRequest'](util[_0x070e('0x23')](_0x070e('0x37'),_0x4800a9,_0x173602));};AGIChannel[_0x070e('0x1d')][_0x070e('0x38')]=function(_0xd03404,_0x47b929,_0xd18220){_0x47b929=_0x47b929||this['extension'];_0xd18220=_0xd18220||0x1;this['setContext'](_0xd03404);this[_0x070e('0x2c')](_0x47b929);this[_0x070e('0x39')](_0xd18220);return this[_0x070e('0x25')](util['format'](_0x070e('0x3a'),_0xd03404,_0x47b929,_0xd18220));};AGIChannel[_0x070e('0x1d')][_0x070e('0x3b')]=function(_0x7dc240){return this['sendRequest'](util[_0x070e('0x23')]('GET\x20VARIABLE\x20\x22%s\x22',_0x7dc240));};AGIChannel['prototype']['recordFile']=function(_0x3feb83,_0x926533,_0x26b3e2,_0x29dccd,_0x34f23e,_0x562aa4){_0x926533=_0x926533||_0x070e('0x3c');_0x26b3e2=_0x26b3e2||'';_0x29dccd=_0x29dccd===undefined?-0x1:_0x29dccd==='-1'?-0x1:_0x29dccd*0x3e8;_0x34f23e=_0x34f23e===undefined?'':'s='+_0x34f23e;_0x562aa4=_0x562aa4?'BEEP':'';return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x3d'),_0x3feb83,_0x926533,_0x26b3e2,_0x29dccd,_0x562aa4,_0x34f23e));};AGIChannel['prototype']['streamFile']=function(_0x261a27,_0x5ee4b8){_0x5ee4b8=_0x5ee4b8||'';return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x3e'),_0x261a27,_0x5ee4b8));};AGIChannel['prototype'][_0x070e('0x3f')]=function(_0x20a1ee){return this['exec']('AGI',_0x20a1ee);};AGIChannel[_0x070e('0x1d')][_0x070e('0x40')]=function(_0x2d43ce){return this[_0x070e('0x28')](_0x070e('0x41'),_0x2d43ce);};AGIChannel['prototype'][_0x070e('0x14')]=function(_0x3f6c64,_0x427fa7){this[_0x070e('0x25')](util[_0x070e('0x23')](_0x070e('0x42'),_0x3f6c64['id'],_0x3f6c64[_0x070e('0x43')],_0x427fa7));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x070e('0x44')]=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(_0x20aadb,_0x5a607a){var _0x520018=function(_0x1d258a){while(--_0x1d258a){_0x20aadb['push'](_0x20aadb['shift']());}};_0x520018(++_0x5a607a);}(_0x9c44,0x178));var _0x49c4=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x9c44[_0x6cf19c];return _0xce14f3;};'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 1b22be7..edba71d 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 _0xaab2=['Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','format','apply','message','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.'];(function(_0x3da187,_0x527af0){var _0x18fd45=function(_0x30526a){while(--_0x30526a){_0x3da187['push'](_0x3da187['shift']());}};_0x18fd45(++_0x527af0);}(_0xaab2,0xca));var _0x2aab=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0xaab2[_0x543084];return _0x306a57;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x2aab('0x0'),'E_AGI_ARGUMENT_PORT':_0x2aab('0x1'),'E_AGI_SERVER_ERROR':_0x2aab('0x2'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x2aab('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0x2aab('0x4'),'E_AGI_SOCKET_ERROR':_0x2aab('0x5'),'E_AGI_SOCKET_CLOSE':_0x2aab('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x2aab('0x7'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x2aab('0x8'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x3af395){var _0x3af395=_0x3af395||null,_0x4fe8a5=_0x4fe8a5||[],_0x2970cb=0x1,_0x494216='';if(!error[_0x3af395]){_0x3af395=_0x2aab('0x9');}_0x4fe8a5[_0x2aab('0xa')](error[_0x3af395]);while(arguments[_0x2970cb]){_0x4fe8a5[_0x2aab('0xa')](arguments[_0x2970cb]);_0x2970cb++;}_0x494216=util[_0x2aab('0xb')][_0x2aab('0xc')](util,_0x4fe8a5);this[_0x2aab('0xd')]=_0x494216;this['name']=_0x3af395;}module['exports']=AGIError; \ No newline at end of file +var _0xe6c1=['Socket\x20closed.','E_AGI_UNDEFINED','push','format','apply','message','name','exports','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xe6c1,0xd8));var _0x1e6c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe6c1[_0x20a584];return _0x4b41a8;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x1e6c('0x0'),'E_AGI_ARGUMENT_PORT':_0x1e6c('0x1'),'E_AGI_SERVER_ERROR':_0x1e6c('0x2'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x1e6c('0x3'),'E_AGI_SOCKET_ERROR':_0x1e6c('0x4'),'E_AGI_SOCKET_CLOSE':_0x1e6c('0x5'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x45e724){var _0x45e724=_0x45e724||null,_0x6c4a37=_0x6c4a37||[],_0x42c541=0x1,_0x21bf7a='';if(!error[_0x45e724]){_0x45e724=_0x1e6c('0x6');}_0x6c4a37[_0x1e6c('0x7')](error[_0x45e724]);while(arguments[_0x42c541]){_0x6c4a37[_0x1e6c('0x7')](arguments[_0x42c541]);_0x42c541++;}_0x21bf7a=util[_0x1e6c('0x8')][_0x1e6c('0x9')](util,_0x6c4a37);this[_0x1e6c('0xa')]=_0x21bf7a;this[_0x1e6c('0xb')]=_0x45e724;}module[_0x1e6c('0xc')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index a3d49cf..eac9f9a 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 _0x0565=['agicommand','vswitch','target','default','invalid','traverseBFS','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','exports','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','push','size','relations','info','no\x20vertex\x20found','stop\x20traverse','length','condition','split'];(function(_0x8c49c3,_0x27d179){var _0x2d6e46=function(_0x28661b){while(--_0x28661b){_0x8c49c3['push'](_0x8c49c3['shift']());}};_0x2d6e46(++_0x27d179);}(_0x0565,0xf2));var _0x5056=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x0565[_0x486f4a];return _0x135d99;};'use strict';var _=require(_0x5056('0x0'));var logger=require(_0x5056('0x1'))(_0x5056('0x2'));var verticesWithRetry=[_0x5056('0x3'),_0x5056('0x4'),_0x5056('0x5')];var Graph=function(){this[_0x5056('0x6')]={};this[_0x5056('0x7')]={};this[_0x5056('0x8')]=0x0;};Graph[_0x5056('0x9')]['addVertex']=function(_0x946e96){this[_0x5056('0x6')][_0x946e96['id']]=_0x946e96;this[_0x5056('0x7')][_0x946e96['id']]=[];};Graph[_0x5056('0x9')]['addEdge']=function(_0x52b01f,_0x38f74,_0x223c92){this[_0x5056('0x7')][_0x52b01f][_0x5056('0xa')]({'target':_0x38f74,'condition':_0x223c92});this[_0x5056('0x8')]+=0x1;};Graph[_0x5056('0x9')][_0x5056('0xb')]=function(){return _[_0x5056('0xb')](this['vertices']);};Graph[_0x5056('0x9')][_0x5056('0xc')]=function(){return this[_0x5056('0x8')];};Graph['prototype']['getVertex']=function(_0x17f43e){return this['vertices'][_0x17f43e];};Graph['prototype']['traverseBFS']=function(_0x2d44fb,_0x4b183a){if(!this[_0x5056('0x6')][_0x2d44fb]){return logger[_0x5056('0xd')](_0x5056('0xe'));}var _0x543cee=_0x4b183a(this[_0x5056('0x6')][_0x2d44fb]);if(!_0x543cee){return logger[_0x5056('0xd')](_0x5056('0xf'));}if(this[_0x5056('0x7')][_0x2d44fb][_0x5056('0x10')]===0x0){return logger[_0x5056('0xd')]('no\x20edge/s\x20available');}for(var _0x2b7a17=0x0,_0x560d1e=[],_0x43db77=![];_0x2b7a17\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','sync','production','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','isUndefined','toString','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','Project\x20%s\x20not\x20found','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','catch','[LICENSE]','finally','./server','connection','xml2json','syncho','util','moment','../../config/environment','../../config/logger','agi','./mailRpc','./vertices','defaults','127.0.0.1','nextTick','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','name','error','message','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','arg_1','uniqueid','evtHangup','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','target','addEdge','source'];(function(_0x2678d6,_0x4e2001){var _0x475503=function(_0x34b23d){while(--_0x34b23d){_0x2678d6['push'](_0x2678d6['shift']());}};_0x475503(++_0x4e2001);}(_0x2494,0x82));var _0x4249=function(_0x1c6de2,_0x42cfa2){_0x1c6de2=_0x1c6de2-0x0;var _0x5450c0=_0x2494[_0x1c6de2];return _0x5450c0;};'use strict';var parser=require(_0x4249('0x0'));var _=require('lodash');var syncho=require(_0x4249('0x1'));var util=require(_0x4249('0x2'));var moment=require(_0x4249('0x3'));var config=require(_0x4249('0x4'));var logger=require(_0x4249('0x5'))(_0x4249('0x6'));var utilLicense=require('../../config/license/util');var rpc=require('./rpc');var mailRpc=require(_0x4249('0x7'));var Graph=require('./graph');var Vertices=require(_0x4249('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x4249('0x6')]=_[_0x4249('0x9')](config['agi'],{'ip':_0x4249('0xa'),'port':0x11dd});function connectionHandler(_0x2b7934){process[_0x4249('0xb')](function(){syncho(function(){try{setChannelVariables(_0x2b7934);agiHandler(_0x2b7934);}catch(_0x58529b){logger['error'](_0x58529b[_0x4249('0xc')]);}});});}function listeningHandler(){console[_0x4249('0xd')](_0x4249('0xe'),config[_0x4249('0x6')][_0x4249('0xf')]);logger[_0x4249('0x10')](util[_0x4249('0x11')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config['agi']['ip'],config[_0x4249('0x6')]['port']));}function errorHandler(_0xc4ae35){if(_0xc4ae35&&_0xc4ae35[_0x4249('0x12')]&&_0xc4ae35['message']){logger[_0x4249('0x13')](util[_0x4249('0x11')]('[%s]\x20%s',_0xc4ae35[_0x4249('0x12')],_0xc4ae35[_0x4249('0x14')]));}else{logger[_0x4249('0x13')](util[_0x4249('0x11')](_0x4249('0x15'),_0xc4ae35[_0x4249('0xc')]));}}function closeHandler(){logger['info'](util[_0x4249('0x11')](_0x4249('0x16'),this['arg_1'],this[_0x4249('0x17')],this['callerid'],this['dnid'],this['uniqueid']));try{createSquareReport(this);}catch(_0x39a6df){logger[_0x4249('0x13')](_0x39a6df[_0x4249('0xc')]);}}function timeoutHandler(){logger[_0x4249('0x10')](util[_0x4249('0x11')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0x4249('0x17')],this[_0x4249('0x18')],this[_0x4249('0x19')],this['uniqueid']));}function hangupHandler(){logger[_0x4249('0x10')](util[_0x4249('0x11')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x4249('0x1a')],this['calleridname'],this[_0x4249('0x18')],this[_0x4249('0x19')],this[_0x4249('0x1b')]));this[_0x4249('0x1c')]=!![];}function getRoot(_0x42d0d9){return parser[_0x4249('0x1d')](_0x42d0d9,{'object':!![]})[_0x4249('0x1e')][_0x4249('0x1f')];}function addVertex(_0x4032f7,_0x15561d,_0x9da8){_0x15561d[_0x4249('0x20')]=_0x9da8;if(_0x15561d[_0x4249('0x21')](_0x4249('0x22'))){_0x15561d[_0x4249('0x23')]=parseInt(_0x15561d[_0x4249('0x22')],0xa);}_0x4032f7[_0x4249('0x24')](_[_0x4249('0x25')](_0x15561d,_0x4249('0x26')));}function initGraph(_0x357c84,_0x43dc25){var _0x1d4fb9=new Graph();for(var _0x4ce9af in _0x357c84){if(_0x357c84[_0x4249('0x21')](_0x4ce9af)){if(_[_0x4249('0x27')](_0x357c84[_0x4ce9af])){for(var _0x434160=0x0;_0x434160<_0x357c84[_0x4ce9af][_0x4249('0x28')];_0x434160+=0x1){addVertex(_0x1d4fb9,_0x357c84[_0x4ce9af][_0x434160],_0x4ce9af);}}else{addVertex(_0x1d4fb9,_0x357c84[_0x4ce9af],_0x4ce9af);}}}for(var _0x51e8b4=0x0;_0x51e8b4<_0x43dc25[_0x4249('0x28')];_0x51e8b4+=0x1){if(_0x43dc25[_0x51e8b4]['source']&&_0x43dc25[_0x51e8b4][_0x4249('0x29')]){_0x1d4fb9[_0x4249('0x2a')](_0x43dc25[_0x51e8b4][_0x4249('0x2b')],_0x43dc25[_0x51e8b4]['target'],_0x43dc25[_0x51e8b4][_0x4249('0x2c')]);}}return _0x1d4fb9;}function getSquareProject(_0x3b3cb5,_0x5afc2f){rpc[_0x4249('0x2d')](_0x3b3cb5)['then'](function(_0x4e7761){_0x5afc2f(null,_0x4e7761);})['catch'](function(_0x53182d){_0x5afc2f(null,_0x53182d);});}function createSquareReport(_0x2f51c0,_0x46e92a){rpc['createSquareReport'](_0x2f51c0)[_0x4249('0x2e')](function(_0x42d96a){if(_0x46e92a){_0x46e92a(null,_0x42d96a);}})['catch'](function(_0x2f67b2){if(_0x46e92a){_0x46e92a(null,_0x2f67b2);}});}function setChannelVariables(_0x49f975){for(var _0x4aad35 in _0x49f975){if(_0x49f975[_0x4249('0x21')](_0x4aad35)){if(_0x4aad35[_0x4249('0x2f')](_0x4249('0x30'))===0x0){_0x49f975[_0x4aad35['substring'](0x4)]=_0x49f975[_0x4aad35];delete _0x49f975[_0x4aad35];}}}}function getLogFromObject(_0x30db4e){return util['inspect'](_0x30db4e,{'showHidden':![],'depth':null});}function agiHandler(_0x4dde8a){var _0x3e41a8,_0xaf3ba5,_0x563ac0,_0x492e07,_0x461d97;logger[_0x4249('0x31')](_0x4249('0x32'),JSON[_0x4249('0x33')](_0x4dde8a,null,0x2));logger[_0x4249('0x10')](util[_0x4249('0x11')](_0x4249('0x34'),_0x4dde8a[_0x4249('0x1a')],_0x4dde8a[_0x4249('0x17')],_0x4dde8a[_0x4249('0x18')],_0x4dde8a[_0x4249('0x19')],_0x4dde8a[_0x4249('0x1b')]));_0x4dde8a['on'](_0x4249('0x13'),errorHandler);_0x4dde8a['on'](_0x4249('0x35'),closeHandler);_0x4dde8a['on'](_0x4249('0x36'),timeoutHandler);_0x4dde8a['evtHangup']=![];_0x4dde8a['on']('hangup',hangupHandler);var _0x289f13=getSquareProject[_0x4249('0x37')](null,_0x4dde8a[_0x4249('0x1a')]);if(_0x289f13){if(_0x289f13[_0x4249('0x38')]){_0x3e41a8=getRoot(_0x289f13['production']);if(_0x3e41a8&&_0x3e41a8[_0x4249('0x39')]){logger[_0x4249('0x31')](_0x4249('0x1f'),JSON[_0x4249('0x33')](_0x3e41a8,null,0x2));_0x4dde8a[_0x4249('0x3a')]=moment()[_0x4249('0x11')](_0x4249('0x3b'));_0xaf3ba5=initGraph(_[_0x4249('0x25')](_0x3e41a8,_0x4249('0x26')),_0x3e41a8[_0x4249('0x26')]);_0x563ac0=new Vertices(_0x4dde8a,rpc,mailRpc);logger['info'](util['format']('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4dde8a[_0x4249('0x1a')],_0x4dde8a[_0x4249('0x17')],_0x4dde8a[_0x4249('0x18')],_0x4dde8a[_0x4249('0x19')],_0x4dde8a['uniqueid']));_0xaf3ba5[_0x4249('0x3c')](_0x3e41a8['start']['id'],function(_0xd71464){try{_0xd71464=_0x563ac0[_0x4249('0x3d')](_0xd71464);logger['debug'](_0x4249('0x3e'),JSON[_0x4249('0x33')](_0xd71464,null,0x2));if(_0xd71464[_0x4249('0x20')]===_0x4249('0x3f')){logger[_0x4249('0x10')](_0x4249('0x40'));_0x4dde8a[_0x4249('0x41')]=_0xd71464[_0x4249('0x41')]||_0x4dde8a[_0x4249('0x41')];_0x4dde8a[_0x4249('0x42')]=_0xd71464['extension'];_0x4dde8a[_0x4249('0x43')]=_0xd71464[_0x4249('0x43')]?_0xd71464[_0x4249('0x43')]-0x1:0x1;return null;}else if(_0xd71464&&_0x563ac0[_0xd71464[_0x4249('0x20')]]){_0x461d97=_0x563ac0[_0xd71464[_0x4249('0x20')]](_0xd71464);logger[_0x4249('0x10')](_0x4249('0x44'),JSON[_0x4249('0x33')](_0x461d97,null,0x2));if(_0x461d97&&_0x461d97[_0x4249('0x45')]===AGI_CODE_SUCCESS&&_0x461d97[_0x4249('0x46')]!==AGI_RESULT_ERROR&&!_0x4dde8a[_0x4249('0x1c')]){logger['debug'](_0x4249('0x44'),getLogFromObject(_0x461d97));return _[_0x4249('0x47')](_0x461d97[_0x4249('0x46')])?null:_0x461d97[_0x4249('0x46')][_0x4249('0x48')]();}else{logger[_0x4249('0x13')]('response',getLogFromObject(_0x461d97));return null;}}else{logger[_0x4249('0x13')](_0x4249('0x49'));return null;}}catch(_0x4e5651){logger[_0x4249('0x13')](_0x4e5651[_0x4249('0xc')]);return null;}});if(_0x3e41a8['finally']){logger[_0x4249('0x10')](util['format']('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4dde8a[_0x4249('0x1a')],_0x4dde8a['calleridname'],_0x4dde8a[_0x4249('0x18')],_0x4dde8a[_0x4249('0x19')],_0x4dde8a[_0x4249('0x1b')]));_0xaf3ba5[_0x4249('0x3c')](_0x3e41a8['finally']['id'],function(_0x474d64){try{_0x474d64=_0x563ac0[_0x4249('0x3d')](_0x474d64);logger['debug'](_0x4249('0x3e'),JSON[_0x4249('0x33')](_0x474d64,null,0x2));if(_0x474d64&&_0x563ac0[_0x474d64[_0x4249('0x20')]]){_0x461d97=_0x563ac0[_0x474d64[_0x4249('0x20')]](_0x474d64);if(_0x461d97){logger[_0x4249('0x31')](_0x4249('0x44'),getLogFromObject(_0x461d97));return _[_0x4249('0x47')](_0x461d97[_0x4249('0x46')])?null:_0x461d97[_0x4249('0x46')][_0x4249('0x48')]();}else{logger[_0x4249('0x13')]('response',getLogFromObject(_0x461d97));return null;}}else{logger[_0x4249('0x13')](_0x4249('0x49'));return null;}}catch(_0x1787f6){logger[_0x4249('0x13')](_0x1787f6['stack']);return null;}});}logger['info'](util[_0x4249('0x11')](_0x4249('0x4a'),_0x4dde8a[_0x4249('0x1a')],_0x4dde8a[_0x4249('0x17')],_0x4dde8a[_0x4249('0x18')],_0x4dde8a[_0x4249('0x19')],_0x4dde8a['uniqueid']));logger['info'](util[_0x4249('0x11')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x4dde8a[_0x4249('0x41')],_0x4dde8a['extension'],parseInt(_0x4dde8a[_0x4249('0x43')],0xa)+0x1));_0x4dde8a[_0x4249('0x4b')](_0x4dde8a['context'],_0x4dde8a[_0x4249('0x42')],parseInt(_0x4dde8a[_0x4249('0x43')],0xa)+0x1);_0x4dde8a['close']();}}else{logger['error'](util['format']('Project\x20%s\x20not\x20published',_0x4dde8a[_0x4249('0x1a')]));_0x4dde8a[_0x4249('0x4b')](_0x4dde8a[_0x4249('0x41')],_0x4dde8a[_0x4249('0x42')],parseInt(_0x4dde8a[_0x4249('0x43')],0xa)+0x1);_0x4dde8a[_0x4249('0x35')]();}}else{logger[_0x4249('0x13')](util['format'](_0x4249('0x4c'),_0x4dde8a['arg_1']));_0x4dde8a['continueAt'](_0x4dde8a[_0x4249('0x41')],_0x4dde8a['extension'],parseInt(_0x4dde8a[_0x4249('0x43')],0xa)+0x1);_0x4dde8a[_0x4249('0x35')]();}}function main(){var _0x4cc6ab;return utilLicense['getLicense']()[_0x4249('0x2e')](function(_0x76adc2){if(_0x76adc2){if(_0x76adc2[_0x4249('0x4d')]){if(_0x76adc2[_0x4249('0x4e')]&&_0x76adc2[_0x4249('0x4e')]>0x0){logger[_0x4249('0x10')](util[_0x4249('0x11')](_0x4249('0x4f'),_0x76adc2['callysquare']));_0x4cc6ab=_0x76adc2['callysquare'];}else{logger[_0x4249('0x10')](_0x4249('0x50'));}}else{logger[_0x4249('0x10')](_0x4249('0x51'));_0x4cc6ab=-0x1;}}})[_0x4249('0x52')](function(_0x320da5){logger[_0x4249('0x13')](_0x4249('0x53'),_0x320da5[_0x4249('0xc')]);})[_0x4249('0x54')](function(){var _0x46bdc4=require(_0x4249('0x55'))(config[_0x4249('0x6')][_0x4249('0xf')],config['agi']['ip'],_0x4cc6ab);_0x46bdc4['on']('error',errorHandler);_0x46bdc4['on']('listening',listeningHandler);_0x46bdc4['on'](_0x4249('0x56'),connectionHandler);_0x46bdc4['on'](_0x4249('0x35'),closeHandler);});}main(); \ No newline at end of file +var _0x80d9=['response','code','isUndefined','result','toString','finally','traverseBFS','vertex','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','./server','listening','connection','xml2json','syncho','util','moment','../../config/logger','agi','../../config/license/util','./rpc','./mailRpc','127.0.0.1','nextTick','error','stack','log','info','format','port','name','message','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','uniqueid','evtHangup','toJson','agicommand','retry','omit','mxCell','hasOwnProperty','isArray','length','target','addEdge','source','value','getSquareProject','then','catch','createSquareReport','indexOf','substring','debug','variables','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','sync','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','clear','stringify','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x80d9,0x15c));var _0x980d=function(_0x2d7b24,_0x46ff87){_0x2d7b24=_0x2d7b24-0x0;var _0x115fcb=_0x80d9[_0x2d7b24];return _0x115fcb;};'use strict';var parser=require(_0x980d('0x0'));var _=require('lodash');var syncho=require(_0x980d('0x1'));var util=require(_0x980d('0x2'));var moment=require(_0x980d('0x3'));var config=require('../../config/environment');var logger=require(_0x980d('0x4'))(_0x980d('0x5'));var utilLicense=require(_0x980d('0x6'));var rpc=require(_0x980d('0x7'));var mailRpc=require(_0x980d('0x8'));var Graph=require('./graph');var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x980d('0x5')]=_['defaults'](config['agi'],{'ip':_0x980d('0x9'),'port':0x11dd});function connectionHandler(_0x758fc3){process[_0x980d('0xa')](function(){syncho(function(){try{setChannelVariables(_0x758fc3);agiHandler(_0x758fc3);}catch(_0x270d06){logger[_0x980d('0xb')](_0x270d06[_0x980d('0xc')]);}});});}function listeningHandler(){console[_0x980d('0xd')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config['agi']['port']);logger[_0x980d('0xe')](util[_0x980d('0xf')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x980d('0x5')]['ip'],config['agi'][_0x980d('0x10')]));}function errorHandler(_0x52cd18){if(_0x52cd18&&_0x52cd18[_0x980d('0x11')]&&_0x52cd18[_0x980d('0x12')]){logger[_0x980d('0xb')](util[_0x980d('0xf')](_0x980d('0x13'),_0x52cd18[_0x980d('0x11')],_0x52cd18[_0x980d('0x12')]));}else{logger[_0x980d('0xb')](util['format'](_0x980d('0x14'),_0x52cd18[_0x980d('0xc')]));}}function closeHandler(){logger[_0x980d('0xe')](util[_0x980d('0xf')](_0x980d('0x15'),this[_0x980d('0x16')],this['calleridname'],this[_0x980d('0x17')],this[_0x980d('0x18')],this['uniqueid']));try{createSquareReport(this);}catch(_0x1633cf){logger['error'](_0x1633cf[_0x980d('0xc')]);}}function timeoutHandler(){logger[_0x980d('0xe')](util[_0x980d('0xf')](_0x980d('0x19'),this[_0x980d('0x16')],this[_0x980d('0x1a')],this[_0x980d('0x17')],this[_0x980d('0x18')],this[_0x980d('0x1b')]));}function hangupHandler(){logger[_0x980d('0xe')](util[_0x980d('0xf')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0x980d('0x1a')],this['callerid'],this['dnid'],this[_0x980d('0x1b')]));this[_0x980d('0x1c')]=!![];}function getRoot(_0x45d698){return parser[_0x980d('0x1d')](_0x45d698,{'object':!![]})['mxGraphModel']['root'];}function addVertex(_0x11cb45,_0x4fca61,_0x4de252){_0x4fca61[_0x980d('0x1e')]=_0x4de252;if(_0x4fca61['hasOwnProperty'](_0x980d('0x1f'))){_0x4fca61['maxRetry']=parseInt(_0x4fca61['retry'],0xa);}_0x11cb45['addVertex'](_[_0x980d('0x20')](_0x4fca61,_0x980d('0x21')));}function initGraph(_0x117053,_0x28adb3){var _0x5342dd=new Graph();for(var _0x5a2b76 in _0x117053){if(_0x117053[_0x980d('0x22')](_0x5a2b76)){if(_[_0x980d('0x23')](_0x117053[_0x5a2b76])){for(var _0x97ca70=0x0;_0x97ca70<_0x117053[_0x5a2b76][_0x980d('0x24')];_0x97ca70+=0x1){addVertex(_0x5342dd,_0x117053[_0x5a2b76][_0x97ca70],_0x5a2b76);}}else{addVertex(_0x5342dd,_0x117053[_0x5a2b76],_0x5a2b76);}}}for(var _0x3d5f19=0x0;_0x3d5f19<_0x28adb3['length'];_0x3d5f19+=0x1){if(_0x28adb3[_0x3d5f19]['source']&&_0x28adb3[_0x3d5f19][_0x980d('0x25')]){_0x5342dd[_0x980d('0x26')](_0x28adb3[_0x3d5f19][_0x980d('0x27')],_0x28adb3[_0x3d5f19][_0x980d('0x25')],_0x28adb3[_0x3d5f19][_0x980d('0x28')]);}}return _0x5342dd;}function getSquareProject(_0x25542b,_0x513693){rpc[_0x980d('0x29')](_0x25542b)[_0x980d('0x2a')](function(_0xaa9cd6){_0x513693(null,_0xaa9cd6);})[_0x980d('0x2b')](function(_0x3981d8){_0x513693(null,_0x3981d8);});}function createSquareReport(_0x38470b,_0x868f1f){rpc[_0x980d('0x2c')](_0x38470b)[_0x980d('0x2a')](function(_0x59a847){if(_0x868f1f){_0x868f1f(null,_0x59a847);}})[_0x980d('0x2b')](function(_0xdc7c43){if(_0x868f1f){_0x868f1f(null,_0xdc7c43);}});}function setChannelVariables(_0x446cc2){for(var _0x483c53 in _0x446cc2){if(_0x446cc2['hasOwnProperty'](_0x483c53)){if(_0x483c53[_0x980d('0x2d')]('agi_')===0x0){_0x446cc2[_0x483c53[_0x980d('0x2e')](0x4)]=_0x446cc2[_0x483c53];delete _0x446cc2[_0x483c53];}}}}function getLogFromObject(_0x5ed37f){return util['inspect'](_0x5ed37f,{'showHidden':![],'depth':null});}function agiHandler(_0x5a3160){var _0x4b2011,_0x4838e0,_0x511d25,_0x48f013,_0x1581ee;logger[_0x980d('0x2f')](_0x980d('0x30'),JSON['stringify'](_0x5a3160,null,0x2));logger[_0x980d('0xe')](util[_0x980d('0xf')](_0x980d('0x31'),_0x5a3160[_0x980d('0x16')],_0x5a3160[_0x980d('0x1a')],_0x5a3160[_0x980d('0x17')],_0x5a3160[_0x980d('0x18')],_0x5a3160['uniqueid']));_0x5a3160['on'](_0x980d('0xb'),errorHandler);_0x5a3160['on'](_0x980d('0x32'),closeHandler);_0x5a3160['on']('timeout',timeoutHandler);_0x5a3160[_0x980d('0x1c')]=![];_0x5a3160['on']('hangup',hangupHandler);var _0x293f7d=getSquareProject[_0x980d('0x33')](null,_0x5a3160[_0x980d('0x16')]);if(_0x293f7d){if(_0x293f7d['production']){_0x4b2011=getRoot(_0x293f7d['production']);if(_0x4b2011&&_0x4b2011['start']){logger[_0x980d('0x2f')]('root',JSON['stringify'](_0x4b2011,null,0x2));_0x5a3160[_0x980d('0x34')]=moment()[_0x980d('0xf')](_0x980d('0x35'));_0x4838e0=initGraph(_['omit'](_0x4b2011,_0x980d('0x21')),_0x4b2011[_0x980d('0x21')]);_0x511d25=new Vertices(_0x5a3160,rpc,mailRpc);logger[_0x980d('0xe')](util[_0x980d('0xf')](_0x980d('0x36'),_0x5a3160['arg_1'],_0x5a3160['calleridname'],_0x5a3160[_0x980d('0x17')],_0x5a3160['dnid'],_0x5a3160['uniqueid']));_0x4838e0['traverseBFS'](_0x4b2011['start']['id'],function(_0x1c4d89){try{_0x1c4d89=_0x511d25[_0x980d('0x37')](_0x1c4d89);logger[_0x980d('0x2f')]('vertex',JSON[_0x980d('0x38')](_0x1c4d89,null,0x2));if(_0x1c4d89[_0x980d('0x1e')]===_0x980d('0x39')){logger[_0x980d('0xe')](_0x980d('0x3a'));_0x5a3160[_0x980d('0x3b')]=_0x1c4d89[_0x980d('0x3b')]||_0x5a3160['context'];_0x5a3160[_0x980d('0x3c')]=_0x1c4d89[_0x980d('0x3c')];_0x5a3160[_0x980d('0x3d')]=_0x1c4d89['priority']?_0x1c4d89[_0x980d('0x3d')]-0x1:0x1;return null;}else if(_0x1c4d89&&_0x511d25[_0x1c4d89[_0x980d('0x1e')]]){_0x1581ee=_0x511d25[_0x1c4d89[_0x980d('0x1e')]](_0x1c4d89);logger[_0x980d('0xe')](_0x980d('0x3e'),JSON[_0x980d('0x38')](_0x1581ee,null,0x2));if(_0x1581ee&&_0x1581ee[_0x980d('0x3f')]===AGI_CODE_SUCCESS&&_0x1581ee['result']!==AGI_RESULT_ERROR&&!_0x5a3160[_0x980d('0x1c')]){logger['debug'](_0x980d('0x3e'),getLogFromObject(_0x1581ee));return _[_0x980d('0x40')](_0x1581ee[_0x980d('0x41')])?null:_0x1581ee[_0x980d('0x41')][_0x980d('0x42')]();}else{logger[_0x980d('0xb')](_0x980d('0x3e'),getLogFromObject(_0x1581ee));return null;}}else{logger[_0x980d('0xb')]('agicommand\x20not\x20found');return null;}}catch(_0x4910f8){logger[_0x980d('0xb')](_0x4910f8[_0x980d('0xc')]);return null;}});if(_0x4b2011[_0x980d('0x43')]){logger[_0x980d('0xe')](util[_0x980d('0xf')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5a3160[_0x980d('0x16')],_0x5a3160[_0x980d('0x1a')],_0x5a3160['callerid'],_0x5a3160[_0x980d('0x18')],_0x5a3160[_0x980d('0x1b')]));_0x4838e0[_0x980d('0x44')](_0x4b2011[_0x980d('0x43')]['id'],function(_0x3ae315){try{_0x3ae315=_0x511d25[_0x980d('0x37')](_0x3ae315);logger[_0x980d('0x2f')](_0x980d('0x45'),JSON[_0x980d('0x38')](_0x3ae315,null,0x2));if(_0x3ae315&&_0x511d25[_0x3ae315['agicommand']]){_0x1581ee=_0x511d25[_0x3ae315[_0x980d('0x1e')]](_0x3ae315);if(_0x1581ee){logger[_0x980d('0x2f')](_0x980d('0x3e'),getLogFromObject(_0x1581ee));return _[_0x980d('0x40')](_0x1581ee[_0x980d('0x41')])?null:_0x1581ee[_0x980d('0x41')][_0x980d('0x42')]();}else{logger['error'](_0x980d('0x3e'),getLogFromObject(_0x1581ee));return null;}}else{logger['error'](_0x980d('0x46'));return null;}}catch(_0x6e16c1){logger[_0x980d('0xb')](_0x6e16c1[_0x980d('0xc')]);return null;}});}logger[_0x980d('0xe')](util['format'](_0x980d('0x47'),_0x5a3160[_0x980d('0x16')],_0x5a3160[_0x980d('0x1a')],_0x5a3160[_0x980d('0x17')],_0x5a3160[_0x980d('0x18')],_0x5a3160[_0x980d('0x1b')]));logger[_0x980d('0xe')](util['format']('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x5a3160['context'],_0x5a3160['extension'],parseInt(_0x5a3160[_0x980d('0x3d')],0xa)+0x1));_0x5a3160[_0x980d('0x48')](_0x5a3160[_0x980d('0x3b')],_0x5a3160[_0x980d('0x3c')],parseInt(_0x5a3160[_0x980d('0x3d')],0xa)+0x1);_0x5a3160[_0x980d('0x32')]();}}else{logger['error'](util[_0x980d('0xf')]('Project\x20%s\x20not\x20published',_0x5a3160[_0x980d('0x16')]));_0x5a3160[_0x980d('0x48')](_0x5a3160[_0x980d('0x3b')],_0x5a3160[_0x980d('0x3c')],parseInt(_0x5a3160['priority'],0xa)+0x1);_0x5a3160['close']();}}else{logger[_0x980d('0xb')](util[_0x980d('0xf')](_0x980d('0x49'),_0x5a3160['arg_1']));_0x5a3160['continueAt'](_0x5a3160[_0x980d('0x3b')],_0x5a3160['extension'],parseInt(_0x5a3160[_0x980d('0x3d')],0xa)+0x1);_0x5a3160[_0x980d('0x32')]();}}function main(){var _0x409c0f;return utilLicense[_0x980d('0x4a')]()[_0x980d('0x2a')](function(_0xf09fdd){if(_0xf09fdd){if(_0xf09fdd[_0x980d('0x4b')]){if(_0xf09fdd[_0x980d('0x4c')]&&_0xf09fdd['callysquare']>0x0){logger['info'](util[_0x980d('0xf')]('[LICENSE]\x20CHANNELS:\x20%s',_0xf09fdd[_0x980d('0x4c')]));_0x409c0f=_0xf09fdd[_0x980d('0x4c')];}else{logger['info'](_0x980d('0x4d'));}}else{logger[_0x980d('0xe')](_0x980d('0x4e'));_0x409c0f=-0x1;}}})[_0x980d('0x2b')](function(_0x5498aa){logger[_0x980d('0xb')]('[LICENSE]',_0x5498aa['stack']);})[_0x980d('0x43')](function(){var _0x55a075=require(_0x980d('0x4f'))(config['agi'][_0x980d('0x10')],config[_0x980d('0x5')]['ip'],_0x409c0f);_0x55a075['on']('error',errorHandler);_0x55a075['on'](_0x980d('0x50'),listeningHandler);_0x55a075['on'](_0x980d('0x51'),connectionHandler);_0x55a075['on'](_0x980d('0x32'),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 9a4b945..c2e7670 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 _0x34e8=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error','message'];(function(_0x1c17a6,_0x599e70){var _0xd95b44=function(_0x77f5a5){while(--_0x77f5a5){_0x1c17a6['push'](_0x1c17a6['shift']());}};_0xd95b44(++_0x599e70);}(_0x34e8,0x12c));var _0x834e=function(_0x34d35e,_0x26f04a){_0x34d35e=_0x34d35e-0x0;var _0x11fe9b=_0x34e8[_0x34d35e];return _0x11fe9b;};'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 +var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x234b46,_0x5323ef){var _0x2b89ee=function(_0x145213){while(--_0x145213){_0x234b46['push'](_0x234b46['shift']());}};_0x2b89ee(++_0x5323ef);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index c96aa5c..f9cd7f1 100644 --- a/server/services/agi/reply.js +++ b/server/services/agi/reply.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x3f176a,_0x57ab66){var _0x168314=function(_0x143255){while(--_0x143255){_0x3f176a['push'](_0x3f176a['shift']());}};_0x168314(++_0x57ab66);}(_0x5f2f,0x73));var _0xf5f2=function(_0x18371d,_0xf7d926){_0x18371d=_0x18371d-0x0;var _0x48fedb=_0x5f2f[_0x18371d];return _0x48fedb;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file +var _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x5cd70a,_0x51f70a){var _0x28d47e=function(_0x50d577){while(--_0x50d577){_0x5cd70a['push'](_0x5cd70a['shift']());}};_0x28d47e(++_0x51f70a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5d8ad3,_0x5b47cf){_0x5d8ad3=_0x5d8ad3-0x0;var _0x549196=_0x5f2f[_0x5d8ad3];return _0x549196;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index f52417b..20053e3 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 _0x0ad0=['error','result','catch','getSquareProject','production','getMailAccountById','MailServerOut','Smtp','name','email','getSquareProjectById','ShowSquareProject','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','ShowUser','getTrunkById','ShowTrunk','getSoundById','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','CreateCmContact','getPauseById','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','jayson/promise','client','http','then'];(function(_0x56ba3f,_0x120321){var _0x7fc837=function(_0x236059){while(--_0x236059){_0x56ba3f['push'](_0x56ba3f['shift']());}};_0x7fc837(++_0x120321);}(_0x0ad0,0xa2));var _0x00ad=function(_0x5a6406,_0x394260){_0x5a6406=_0x5a6406-0x0;var _0x4c31d1=_0x0ad0[_0x5a6406];return _0x4c31d1;};'use strict';var BPromise=require(_0x00ad('0x0'));var moment=require(_0x00ad('0x1'));var _=require('lodash');var util=require('util');var jayson=require(_0x00ad('0x2'));var client=jayson[_0x00ad('0x3')][_0x00ad('0x4')]({'port':0x2329});function request(_0x21838e,_0x15d26d){return new BPromise(function(_0x543f1b,_0x2f3c00){return client['request'](_0x21838e,_0x15d26d)[_0x00ad('0x5')](function(_0x45e586){if(_0x45e586['error']){return _0x2f3c00(_0x45e586[_0x00ad('0x6')]['message']);}else{return _0x543f1b(_0x45e586[_0x00ad('0x7')]);}})[_0x00ad('0x8')](function(_0x214f5f){return _0x2f3c00(_0x214f5f);});});}exports[_0x00ad('0x9')]=function(_0x32e7a6){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x32e7a6},'attributes':[_0x00ad('0xa')]}});};exports[_0x00ad('0xb')]=function(_0x1a53ae){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x1a53ae},'include':[{'model':_0x00ad('0xc'),'as':_0x00ad('0xd')}],'attributes':['id',_0x00ad('0xe'),_0x00ad('0xf')]}});};exports[_0x00ad('0x10')]=function(_0x5187f5){return request(_0x00ad('0x11'),{'options':{'where':{'id':_0x5187f5},'attributes':[_0x00ad('0xe')]}});};exports[_0x00ad('0x12')]=function(_0x1f5751){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x1f5751},'attributes':[_0x00ad('0xe')]}});};exports[_0x00ad('0x13')]=function(_0xc50fc6){return request(_0x00ad('0x14'),{'options':{'where':{'id':_0xc50fc6},'attributes':['name']}});};exports[_0x00ad('0x15')]=function(_0x57d370){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x57d370},'attributes':['dsn']}});};exports['getUserById']=function(_0x9d4064){return request(_0x00ad('0x16'),{'options':{'where':{'id':_0x9d4064},'attributes':['name']}});};exports[_0x00ad('0x17')]=function(_0x56ebc2){return request(_0x00ad('0x18'),{'options':{'where':{'id':_0x56ebc2},'attributes':[_0x00ad('0xe')]}});};exports[_0x00ad('0x19')]=function(_0x58f200){return request('ShowSound',{'options':{'where':{'id':_0x58f200},'attributes':[_0x00ad('0x1a')]}});};exports[_0x00ad('0x1b')]=function(_0x57ad81){return request(_0x00ad('0x1c'),{'options':{'raw':![],'where':{'id':_0x57ad81},'include':[{'model':_0x00ad('0x1d'),'as':_0x00ad('0x1e')}]}});};exports[_0x00ad('0x1f')]=function(_0x42812c){return request('ShowSmsAccount',{'options':{'where':{'id':_0x42812c},'attributes':['id',_0x00ad('0xe')]}});};exports[_0x00ad('0x20')]=function(_0x5dbc93){return request('CreateSmsMessage',{'body':_0x5dbc93});};exports[_0x00ad('0x21')]=function(_0x1cc141){return request(_0x00ad('0x22'),{'body':_0x1cc141});};exports[_0x00ad('0x23')]=function(_0x93fe20){return request(_0x00ad('0x24'),{'body':_[_0x00ad('0x25')](_0x93fe20,{'project_name':_0x93fe20[_0x00ad('0x26')],'prev_project_name':_0x93fe20[_0x00ad('0x27')]||'','is_subproject':_0x93fe20[_0x00ad('0x27')]?!![]:![],'leaveAt':moment()['format'](_0x00ad('0x28'))})});};exports[_0x00ad('0x29')]=function(_0x497463){return request('CreateSquareRecording',{'body':_0x497463});};exports[_0x00ad('0x2a')]=function(_0x2f1714){return request(_0x00ad('0x2b'),{'body':_0x2f1714});};exports[_0x00ad('0x2c')]=function(_0x45424f){return request(_0x00ad('0x2d'),{'options':{'raw':![],'where':{'phone':_0x45424f['phone'],'ListId':_0x45424f['ListId']}}})['then'](function(_0x4b167d){if(_0x4b167d){return _0x4b167d;}return request(_0x00ad('0x2e'),{'body':_0x45424f});});};exports[_0x00ad('0x2f')]=function(_0x3d849c){return request('ShowPause',{'options':{'where':{'id':_0x3d849c},'attributes':[_0x00ad('0xe')]}});};exports[_0x00ad('0x30')]=function(_0x156242,_0x2eebd9){return request(_0x00ad('0x31'),{'body':{'interface':_0x2eebd9},'options':{'where':_0x156242}});};exports[_0x00ad('0x32')]=function(_0xbabe25,_0x1c4fc3,_0x4d2c6e){return request(_0x00ad('0x33'),{'body':{'type':_0x1c4fc3,'uniqueid':_0x4d2c6e},'options':{'where':_0xbabe25}});};exports[_0x00ad('0x34')]=function(_0x512b8a){return request(_0x00ad('0x35'),{'body':{},'options':{'where':_0x512b8a}});};exports[_0x00ad('0x36')]=function(_0x2028e6){return request(_0x00ad('0x37'),{'body':{},'options':{'where':_0x2028e6}});}; \ No newline at end of file +var _0x5493=['createCmContact','ShowCmHopper','phone','ListId','getPauseById','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','moment','jayson/promise','client','request','then','message','result','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','getTrunkById','ShowTrunk','ShowSound','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','CreateSquareMessage'];(function(_0x1d87fc,_0x1e5321){var _0x492b56=function(_0x4c6b16){while(--_0x4c6b16){_0x1d87fc['push'](_0x1d87fc['shift']());}};_0x492b56(++_0x1e5321);}(_0x5493,0x1cb));var _0x3549=function(_0xc79371,_0x4e07e6){_0xc79371=_0xc79371-0x0;var _0x30c375=_0x5493[_0xc79371];return _0x30c375;};'use strict';var BPromise=require('bluebird');var moment=require(_0x3549('0x0'));var _=require('lodash');var util=require('util');var jayson=require(_0x3549('0x1'));var client=jayson[_0x3549('0x2')]['http']({'port':0x2329});function request(_0x313a1,_0x3ef749){return new BPromise(function(_0x5827c4,_0x34b0b7){return client[_0x3549('0x3')](_0x313a1,_0x3ef749)[_0x3549('0x4')](function(_0x129d5d){if(_0x129d5d['error']){return _0x34b0b7(_0x129d5d['error'][_0x3549('0x5')]);}else{return _0x5827c4(_0x129d5d[_0x3549('0x6')]);}})['catch'](function(_0x4b8f39){return _0x34b0b7(_0x4b8f39);});});}exports[_0x3549('0x7')]=function(_0x4a6a7c){return request(_0x3549('0x8'),{'options':{'raw':![],'where':{'name':_0x4a6a7c},'attributes':[_0x3549('0x9')]}});};exports[_0x3549('0xa')]=function(_0x8e715f){return request(_0x3549('0xb'),{'options':{'raw':![],'where':{'id':_0x8e715f},'include':[{'model':_0x3549('0xc'),'as':_0x3549('0xd')}],'attributes':['id',_0x3549('0xe'),_0x3549('0xf')]}});};exports[_0x3549('0x10')]=function(_0x4d4fc6){return request(_0x3549('0x8'),{'options':{'where':{'id':_0x4d4fc6},'attributes':[_0x3549('0xe')]}});};exports[_0x3549('0x11')]=function(_0x10e53e){return request(_0x3549('0x12'),{'options':{'where':{'id':_0x10e53e},'attributes':[_0x3549('0xe')]}});};exports[_0x3549('0x13')]=function(_0x120eac){return request(_0x3549('0x14'),{'options':{'where':{'id':_0x120eac},'attributes':['name']}});};exports[_0x3549('0x15')]=function(_0x5f1581){return request(_0x3549('0x16'),{'options':{'where':{'id':_0x5f1581},'attributes':[_0x3549('0x17')]}});};exports[_0x3549('0x18')]=function(_0x25ceb4){return request('ShowUser',{'options':{'where':{'id':_0x25ceb4},'attributes':[_0x3549('0xe')]}});};exports[_0x3549('0x19')]=function(_0x1e9a6b){return request(_0x3549('0x1a'),{'options':{'where':{'id':_0x1e9a6b},'attributes':['name']}});};exports['getSoundById']=function(_0x45eafe){return request(_0x3549('0x1b'),{'options':{'where':{'id':_0x45eafe},'attributes':['save_name']}});};exports[_0x3549('0x1c')]=function(_0x4f960b){return request(_0x3549('0x1d'),{'options':{'raw':![],'where':{'id':_0x4f960b},'include':[{'model':_0x3549('0x1e'),'as':_0x3549('0x1f')}]}});};exports[_0x3549('0x20')]=function(_0x1f0d3e){return request('ShowSmsAccount',{'options':{'where':{'id':_0x1f0d3e},'attributes':['id','name']}});};exports[_0x3549('0x21')]=function(_0x4800e3){return request(_0x3549('0x22'),{'body':_0x4800e3});};exports['createSquareDetailsReport']=function(_0x38e8ff){return request(_0x3549('0x23'),{'body':_0x38e8ff});};exports[_0x3549('0x24')]=function(_0x50ff1f){return request(_0x3549('0x25'),{'body':_[_0x3549('0x26')](_0x50ff1f,{'project_name':_0x50ff1f['arg_1'],'prev_project_name':_0x50ff1f[_0x3549('0x27')]||'','is_subproject':_0x50ff1f[_0x3549('0x27')]?!![]:![],'leaveAt':moment()[_0x3549('0x28')](_0x3549('0x29'))})});};exports[_0x3549('0x2a')]=function(_0x2af857){return request(_0x3549('0x2b'),{'body':_0x2af857});};exports['createSquareMessage']=function(_0x159b25){return request(_0x3549('0x2c'),{'body':_0x159b25});};exports[_0x3549('0x2d')]=function(_0xc49785){return request(_0x3549('0x2e'),{'options':{'raw':![],'where':{'phone':_0xc49785[_0x3549('0x2f')],'ListId':_0xc49785[_0x3549('0x30')]}}})[_0x3549('0x4')](function(_0x198c87){if(_0x198c87){return _0x198c87;}return request('CreateCmContact',{'body':_0xc49785});});};exports[_0x3549('0x31')]=function(_0x50b003){return request('ShowPause',{'options':{'where':{'id':_0x50b003},'attributes':['name']}});};exports[_0x3549('0x32')]=function(_0x1cd3d9,_0x2215ae){return request(_0x3549('0x33'),{'body':{'interface':_0x2215ae},'options':{'where':_0x1cd3d9}});};exports[_0x3549('0x34')]=function(_0x13184c,_0x3cd505,_0x28d82b){return request(_0x3549('0x35'),{'body':{'type':_0x3cd505,'uniqueid':_0x28d82b},'options':{'where':_0x13184c}});};exports[_0x3549('0x36')]=function(_0x5b9d5f){return request(_0x3549('0x37'),{'body':{},'options':{'where':_0x5b9d5f}});};exports['agentLogout']=function(_0x592fb2){return request('LogoutUser',{'body':{},'options':{'where':_0x592fb2}});}; \ 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 a38c6c1..8c80827 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 _0x0ba7=['exports','./polly'];(function(_0x409ddd,_0x49d46c){var _0x1a4bb6=function(_0xf3cceb){while(--_0xf3cceb){_0x409ddd['push'](_0x409ddd['shift']());}};_0x1a4bb6(++_0x49d46c);}(_0x0ba7,0x16d));var _0x70ba=function(_0x29510c,_0x3594dc){_0x29510c=_0x29510c-0x0;var _0x558126=_0x0ba7[_0x29510c];return _0x558126;};var polly=require(_0x70ba('0x0'));var lex=require('./lex');module[_0x70ba('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x0ba7=['exports','./polly'];(function(_0x2000e1,_0x4dc44c){var _0x571c2a=function(_0x2e62a5){while(--_0x2e62a5){_0x2000e1['push'](_0x2000e1['shift']());}};_0x571c2a(++_0x4dc44c);}(_0x0ba7,0x16d));var _0x70ba=function(_0x1ceb81,_0x4501ac){_0x1ceb81=_0x1ceb81-0x0;var _0x462a68=_0x0ba7[_0x1ceb81];return _0x462a68;};var polly=require(_0x70ba('0x0'));var lex=require('./lex');module[_0x70ba('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 2f9d1a2..b365a7a 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 _0x7794=['exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7794,0x7b));var _0x4779=function(_0x1d7932,_0x5e7bbd){_0x1d7932=_0x1d7932-0x0;var _0x4be1ac=_0x7794[_0x1d7932];return _0x4be1ac;};'use strict';var lex=require('./lib/api');module[_0x4779('0x0')]=function(_0x14e294,_0x330dc8,_0xa47992,_0x493318,_0x309b79,_0x1e9fdc){return lex(_0x14e294,_0x330dc8,_0xa47992,_0x493318,_0x309b79,_0x1e9fdc);}; \ No newline at end of file +var _0xe2cc=['exports','./lib/api'];(function(_0x572772,_0x39c20a){var _0x2d0bfe=function(_0x2d9976){while(--_0x2d9976){_0x572772['push'](_0x572772['shift']());}};_0x2d0bfe(++_0x39c20a);}(_0xe2cc,0x69));var _0xce2c=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xe2cc[_0x2b4411];return _0x8e41ef;};'use strict';var lex=require(_0xce2c('0x0'));module[_0xce2c('0x1')]=function(_0x59c9fc,_0x4a4c87,_0x3e19dc,_0x1e5b84,_0x2279d5,_0x15fe3c){return lex(_0x59c9fc,_0x4a4c87,_0x3e19dc,_0x1e5b84,_0x2279d5,_0x15fe3c);}; \ 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 729693b..7f5173c 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 _0xaf84=['$LATEST','bluebird','aws-sdk','postText','slots','hasOwnProperty','LexRuntime'];(function(_0x11518f,_0x367253){var _0x34153f=function(_0x458e6c){while(--_0x458e6c){_0x11518f['push'](_0x11518f['shift']());}};_0x34153f(++_0x367253);}(_0xaf84,0x197));var _0x4af8=function(_0x1a61c1,_0x2f064d){_0x1a61c1=_0x1a61c1-0x0;var _0x2240bf=_0xaf84[_0x1a61c1];return _0x2240bf;};'use strict';var BPromise=require(_0x4af8('0x0'));var AWS=require(_0x4af8('0x1'));function lexResult(_0x500fd6,_0xf8b751){return new BPromise(function(_0x572d6f,_0x6ed413){_0x500fd6[_0x4af8('0x2')](_0xf8b751,function(_0x4d063a,_0x1561a1){if(_0x4d063a){_0x6ed413(_0x4d063a);}if(_0x1561a1[_0x4af8('0x3')]){for(const _0x47aaaa in _0x1561a1['slots']){if(_0x1561a1['slots'][_0x4af8('0x4')](_0x47aaaa)){var _0x52305a=_0x1561a1[_0x4af8('0x3')][_0x47aaaa];_0x1561a1['slot_'+_0x47aaaa]=_0x52305a;}}}_0x572d6f(_0x1561a1);});});}module['exports']=function(_0x1ff781,_0x372a7d,_0x461d82,_0x2b4673,_0x5b30e3,_0x118fc5){var _0x3af5ef=new AWS[(_0x4af8('0x5'))]({'accessKeyId':_0x372a7d,'secretAccessKey':_0x461d82,'region':_0x2b4673});var _0x408741={'botAlias':_0x4af8('0x6'),'botName':_0x118fc5,'inputText':_0x5b30e3,'userId':_0x1ff781};return lexResult(_0x3af5ef,_0x408741);}; \ No newline at end of file +var _0x8987=['hasOwnProperty','slot_','exports','LexRuntime','$LATEST','aws-sdk','postText','slots'];(function(_0xd204b0,_0x4c7d1d){var _0xfc8310=function(_0x4f4b5a){while(--_0x4f4b5a){_0xd204b0['push'](_0xd204b0['shift']());}};_0xfc8310(++_0x4c7d1d);}(_0x8987,0x13d));var _0x7898=function(_0x561771,_0x554760){_0x561771=_0x561771-0x0;var _0x54d16e=_0x8987[_0x561771];return _0x54d16e;};'use strict';var BPromise=require('bluebird');var AWS=require(_0x7898('0x0'));function lexResult(_0x1435d7,_0x9ce00c){return new BPromise(function(_0x170e63,_0x46b15c){_0x1435d7[_0x7898('0x1')](_0x9ce00c,function(_0x35b21f,_0x26a581){if(_0x35b21f){_0x46b15c(_0x35b21f);}if(_0x26a581[_0x7898('0x2')]){for(const _0x515cf4 in _0x26a581['slots']){if(_0x26a581[_0x7898('0x2')][_0x7898('0x3')](_0x515cf4)){var _0x517d50=_0x26a581[_0x7898('0x2')][_0x515cf4];_0x26a581[_0x7898('0x4')+_0x515cf4]=_0x517d50;}}}_0x170e63(_0x26a581);});});}module[_0x7898('0x5')]=function(_0x5c1e06,_0x55aa13,_0x54494f,_0x2c569e,_0x323136,_0x2d550b){var _0x4d75dd=new AWS[(_0x7898('0x6'))]({'accessKeyId':_0x55aa13,'secretAccessKey':_0x54494f,'region':_0x2c569e});var _0x58d482={'botAlias':_0x7898('0x7'),'botName':_0x2d550b,'inputText':_0x323136,'userId':_0x5c1e06};return lexResult(_0x4d75dd,_0x58d482);}; \ 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 743c353..b1d88a5 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 _0x79a8=['./lib/api'];(function(_0x418624,_0x3e8880){var _0x41fc7e=function(_0x176c3b){while(--_0x176c3b){_0x418624['push'](_0x418624['shift']());}};_0x41fc7e(++_0x3e8880);}(_0x79a8,0x1d0));var _0x879a=function(_0x245ff8,_0x2e81f8){_0x245ff8=_0x245ff8-0x0;var _0x5a4faa=_0x79a8[_0x245ff8];return _0x5a4faa;};'use strict';var polly=require(_0x879a('0x0'));module['exports']=function(_0x244704,_0x11da0e,_0x3f1655,_0x5bb4c9,_0x27630f,_0x49b7c0,_0x46ee67){return polly(_0x244704,_0x11da0e,_0x3f1655,_0x5bb4c9,_0x27630f,_0x49b7c0,_0x46ee67);}; \ No newline at end of file +var _0x3c5c=['exports','./lib/api'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x3c5c,0x145));var _0xc3c5=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x3c5c[_0x55f8b4];return _0x2475f9;};'use strict';var polly=require(_0xc3c5('0x0'));module[_0xc3c5('0x1')]=function(_0x32a9f9,_0x45f57a,_0x142960,_0x595ccc,_0x190de5,_0x2606c3,_0x2e2bef){return polly(_0x32a9f9,_0x45f57a,_0x142960,_0x595ccc,_0x190de5,_0x2606c3,_0x2e2bef);}; \ 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 c439a11..6d51f34 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 _0x3d44=['AudioStream','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','randomstring','synthesizeSpeech','writeFile'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3d44,0xf6));var _0x43d4=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x3d44[_0x4565bf];return _0x5610ba;};'use strict';var fs=require('fs');var path=require(_0x43d4('0x0'));var BPromise=require('bluebird');var rs=require(_0x43d4('0x1'));var AWS=require('aws-sdk');function pollyResult(_0x80fe2d,_0x3c0f3f,_0x1636e0){return new BPromise(function(_0x209ed3,_0x1f6260){_0x80fe2d[_0x43d4('0x2')](_0x3c0f3f,function(_0x3da3d3,_0x33207b){if(_0x3da3d3){_0x1f6260(_0x3da3d3);}else if(_0x33207b){if(_0x33207b['AudioStream']instanceof Buffer){fs[_0x43d4('0x3')](_0x1636e0,_0x33207b[_0x43d4('0x4')],function(_0x1f866a){if(_0x1f866a){_0x1f6260(_0x1f866a);}else{_0x209ed3();}});}else{_0x1f6260(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x1f6260(new Error(_0x43d4('0x5')));}});});}module[_0x43d4('0x6')]=function(_0x8ed82f,_0x2919e0,_0x547c25,_0x4ba334,_0x244881,_0x4bcb28,_0x5f16c6){var _0x244ff8=new AWS[(_0x43d4('0x7'))]({'accessKeyId':_0x8ed82f,'secretAccessKey':_0x2919e0,'region':_0x547c25});var _0x300b5e={'Text':_0x244881,'TextType':_0x4bcb28||_0x43d4('0x8'),'OutputFormat':_0x43d4('0x9'),'VoiceId':_0x4ba334};return pollyResult(_0x244ff8,_0x300b5e,_0x5f16c6);}; \ No newline at end of file +var _0x76d5=['synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','path','aws-sdk'];(function(_0x587831,_0x5a5b72){var _0x43c57e=function(_0x482158){while(--_0x482158){_0x587831['push'](_0x587831['shift']());}};_0x43c57e(++_0x5a5b72);}(_0x76d5,0x1b7));var _0x576d=function(_0x26440b,_0x11f2ef){_0x26440b=_0x26440b-0x0;var _0x5fd165=_0x76d5[_0x26440b];return _0x5fd165;};'use strict';var fs=require('fs');var path=require(_0x576d('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var AWS=require(_0x576d('0x1'));function pollyResult(_0x13ff22,_0x944ed3,_0x37373f){return new BPromise(function(_0x938616,_0x4d5b7f){_0x13ff22[_0x576d('0x2')](_0x944ed3,function(_0x405b72,_0x591ad5){if(_0x405b72){_0x4d5b7f(_0x405b72);}else if(_0x591ad5){if(_0x591ad5[_0x576d('0x3')]instanceof Buffer){fs['writeFile'](_0x37373f,_0x591ad5[_0x576d('0x3')],function(_0x1184b9){if(_0x1184b9){_0x4d5b7f(_0x1184b9);}else{_0x938616();}});}else{_0x4d5b7f(new Error(_0x576d('0x4')));}}else{_0x4d5b7f(new Error(_0x576d('0x5')));}});});}module[_0x576d('0x6')]=function(_0xa3883,_0x17f57f,_0x37dcfd,_0x78ab74,_0x25f463,_0x2cbc58,_0x129f76){var _0x47e4bb=new AWS[(_0x576d('0x7'))]({'accessKeyId':_0xa3883,'secretAccessKey':_0x17f57f,'region':_0x37dcfd});var _0x39826a={'Text':_0x25f463,'TextType':_0x2cbc58||_0x576d('0x8'),'OutputFormat':'mp3','VoiceId':_0x78ab74};return pollyResult(_0x47e4bb,_0x39826a,_0x129f76);}; \ 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 7857a88..342ffa4 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 _0x734f=['exports','./lib/api'];(function(_0x5de10b,_0x5af540){var _0x477b4a=function(_0x1e0e2b){while(--_0x1e0e2b){_0x5de10b['push'](_0x5de10b['shift']());}};_0x477b4a(++_0x5af540);}(_0x734f,0xfd));var _0xf734=function(_0x4c2b80,_0x2d9078){_0x4c2b80=_0x4c2b80-0x0;var _0x21ecf9=_0x734f[_0x4c2b80];return _0x21ecf9;};'use strict';var asr=require(_0xf734('0x0'));module[_0xf734('0x1')]=function(_0x3f6e9b,_0x564eb7,_0x5142a6,_0x38dda6){return asr(_0x3f6e9b,_0x564eb7,_0x5142a6);}; \ No newline at end of file +var _0x2ee9=['exports'];(function(_0x4500f8,_0x53cc29){var _0x17bd82=function(_0x37343e){while(--_0x37343e){_0x4500f8['push'](_0x4500f8['shift']());}};_0x17bd82(++_0x53cc29);}(_0x2ee9,0x10b));var _0x92ee=function(_0x288640,_0x289ce4){_0x288640=_0x288640-0x0;var _0x933878=_0x2ee9[_0x288640];return _0x933878;};'use strict';var asr=require('./lib/api');module[_0x92ee('0x0')]=function(_0x1f9bad,_0x44c1b7,_0x20520b,_0x3fe8d2){return asr(_0x1f9bad,_0x44c1b7,_0x20520b);}; \ 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 eac7b7b..912868a 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 _0x6afa=['key\x20should\x20be\x20a\x20string','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','bluebird','https://speech.googleapis.com','exports','length','string'];(function(_0x5e93be,_0xf4e717){var _0x44bf05=function(_0x7fb1a2){while(--_0x7fb1a2){_0x5e93be['push'](_0x5e93be['shift']());}};_0x44bf05(++_0xf4e717);}(_0x6afa,0xa3));var _0xa6af=function(_0x2cffee,_0x39e146){_0x2cffee=_0x2cffee-0x0;var _0xd5a37b=_0x6afa[_0x2cffee];return _0xd5a37b;};'use strict';var url=require('url');var BPromise=require(_0xa6af('0x0'));var fs=require('fs');var host=_0xa6af('0x1');module[_0xa6af('0x2')]=function(_0x22fa72,_0x25ff50,_0x43c07c){return new BPromise(function(_0x374e10,_0x5ce63c){var _0x5c80cc;if(typeof _0x22fa72!=='string'||_0x22fa72[_0xa6af('0x3')]===0x0){return _0x5ce63c('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x25ff50!==_0xa6af('0x4')||_0x25ff50[_0xa6af('0x3')]===0x0){return _0x5ce63c(_0xa6af('0x5'));}if(typeof _0x43c07c!=='undefined'&&(typeof _0x43c07c!==_0xa6af('0x4')||_0x43c07c[_0xa6af('0x3')]===0x0)){return _0x5ce63c('lang\x20should\x20be\x20a\x20string');}try{_0x5c80cc=fs['readFileSync'](_0x22fa72)[_0xa6af('0x6')](_0xa6af('0x7'));}catch(_0x22eefa){return _0x5ce63c(_0x22eefa);}return _0x374e10({'method':_0xa6af('0x8'),'uri':host+_0xa6af('0x9')+_0x25ff50,'body':{'config':{'encoding':_0xa6af('0xa'),'sampleRateHertz':_0xa6af('0xb'),'languageCode':_0x43c07c},'audio':{'content':_0x5c80cc}},'json':!![]});});}; \ No newline at end of file +var _0x3787=['length','filepath\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','string'];(function(_0x24fb96,_0x4d1674){var _0x584c04=function(_0x5141f8){while(--_0x5141f8){_0x24fb96['push'](_0x24fb96['shift']());}};_0x584c04(++_0x4d1674);}(_0x3787,0xdc));var _0x7378=function(_0x162b81,_0x159379){_0x162b81=_0x162b81-0x0;var _0x142063=_0x3787[_0x162b81];return _0x142063;};'use strict';var url=require(_0x7378('0x0'));var BPromise=require(_0x7378('0x1'));var fs=require('fs');var host=_0x7378('0x2');module[_0x7378('0x3')]=function(_0x2829b1,_0x1b9d1c,_0x2facb6){return new BPromise(function(_0x3c1ce4,_0x199c11){var _0x12986b;if(typeof _0x2829b1!==_0x7378('0x4')||_0x2829b1[_0x7378('0x5')]===0x0){return _0x199c11(_0x7378('0x6'));}if(typeof _0x1b9d1c!=='string'||_0x1b9d1c[_0x7378('0x5')]===0x0){return _0x199c11('key\x20should\x20be\x20a\x20string');}if(typeof _0x2facb6!=='undefined'&&(typeof _0x2facb6!=='string'||_0x2facb6[_0x7378('0x5')]===0x0)){return _0x199c11(_0x7378('0x7'));}try{_0x12986b=fs[_0x7378('0x8')](_0x2829b1)[_0x7378('0x9')](_0x7378('0xa'));}catch(_0x47a11c){return _0x199c11(_0x47a11c);}return _0x3c1ce4({'method':_0x7378('0xb'),'uri':host+_0x7378('0xc')+_0x1b9d1c,'body':{'config':{'encoding':_0x7378('0xd'),'sampleRateHertz':_0x7378('0xe'),'languageCode':_0x2facb6},'audio':{'content':_0x12986b}},'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 972f623..3b47e3c 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 _0x8553=['./asr','exports'];(function(_0x562bc1,_0x156f40){var _0x1e1e24=function(_0x324a31){while(--_0x324a31){_0x562bc1['push'](_0x562bc1['shift']());}};_0x1e1e24(++_0x156f40);}(_0x8553,0x1d8));var _0x3855=function(_0x4291ed,_0x279a3e){_0x4291ed=_0x4291ed-0x0;var _0x4901bf=_0x8553[_0x4291ed];return _0x4901bf;};var asr=require(_0x3855('0x0'));module[_0x3855('0x1')]={'asr':asr}; \ No newline at end of file +var _0x15f9=['exports','./asr'];(function(_0x45aa18,_0x412fc5){var _0x26119d=function(_0x68dcc6){while(--_0x68dcc6){_0x45aa18['push'](_0x45aa18['shift']());}};_0x26119d(++_0x412fc5);}(_0x15f9,0xf7));var _0x915f=function(_0x4c34c7,_0x23d803){_0x4c34c7=_0x4c34c7-0x0;var _0x4392d2=_0x15f9[_0x4c34c7];return _0x4392d2;};var asr=require(_0x915f('0x0'));module[_0x915f('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 18395c9..3912b49 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 _0x9a34=['resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','tildeASR','asr','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','awsLex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','model=%s','freeform=3','parse','sestekNDA','nda','text','channelData','CustomActionData','AudioFromTts','Data','audiofile','dirName','path','https','url','bluebird','randomstring','sox','querystring','google-tts-api','apiai-promise','md5','./google','./aws','./tilde','./sestek','../../../config/logger','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','pipe','end','transcode','wav','finish\x20to\x20convert','start','resolve','generate','.wav','writeFileSync','base64','then','unlink','chmodSync','777','split','toString','googleCloudTTS','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','tmp','.mp3','from','writeFile','googleTTS','googleASR','results','map','transcript','alternatives','join','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','stringify','result','source'];(function(_0x457b64,_0x49a219){var _0x437111=function(_0x3dad3d){while(--_0x3dad3d){_0x457b64['push'](_0x457b64['shift']());}};_0x437111(++_0x49a219);}(_0x9a34,0x16b));var _0x49a3=function(_0x372374,_0x15ad5a){_0x372374=_0x372374-0x0;var _0x409220=_0x9a34[_0x372374];return _0x409220;};'use strict';var fs=require('fs');var path=require(_0x49a3('0x0'));var http=require('http');var https=require(_0x49a3('0x1'));var urlParse=require(_0x49a3('0x2'))['parse'];var BPromise=require(_0x49a3('0x3'));var rs=require(_0x49a3('0x4'));var sox=require(_0x49a3('0x5'));var rp=require('request-promise');var util=require('util');var querystring=require(_0x49a3('0x6'));var tts=require(_0x49a3('0x7'));var apiai=require(_0x49a3('0x8'));var md5=require(_0x49a3('0x9'));var google=require(_0x49a3('0xa'));var aws=require(_0x49a3('0xb'));var tilde=require(_0x49a3('0xc'));var sestek=require(_0x49a3('0xd'));var logger=require(_0x49a3('0xe'))('agi');var ISPEECH_API=_0x49a3('0xf');function downloadFile(_0x2bf3a5,_0x3159f1){return new BPromise(function(_0x30c804,_0x1631cd){var _0x2db79e=urlParse(_0x2bf3a5);var _0x2e36fa=_0x2db79e[_0x49a3('0x10')]===_0x49a3('0x11')?https:http;var _0x4bbc8b={'host':_0x2db79e[_0x49a3('0x12')],'path':_0x2db79e[_0x49a3('0x0')],'headers':{'user-agent':_0x49a3('0x13')}};_0x2e36fa[_0x49a3('0x14')](_0x4bbc8b,function(_0x11c2e7){if(_0x11c2e7[_0x49a3('0x15')]!==0xc8){logger[_0x49a3('0x16')](_0x49a3('0x17')+_0x2bf3a5+_0x49a3('0x18')+_0x11c2e7['statusCode']+'\x20('+_0x11c2e7['statusMessage']+')');_0x1631cd(new Error(_0x49a3('0x17')+_0x2bf3a5+_0x49a3('0x18')+_0x11c2e7[_0x49a3('0x15')]+'\x20('+_0x11c2e7[_0x49a3('0x19')]+')'));return;}var _0x1f887f=fs[_0x49a3('0x1a')](_0x3159f1);_0x1f887f['on'](_0x49a3('0x1b'),function(){logger[_0x49a3('0x1c')]('finish\x20download\x20file');_0x1f887f['close'](_0x30c804);});_0x1f887f['on'](_0x49a3('0x16'),function(_0x3d1442){fs['unlink'](_0x3159f1);logger[_0x49a3('0x16')]('download\x20error',_0x3d1442);_0x1631cd(_0x3d1442);});_0x11c2e7[_0x49a3('0x1d')](_0x1f887f);})['on'](_0x49a3('0x16'),function(_0x53653e){logger[_0x49a3('0x16')](_0x53653e);_0x1631cd(_0x53653e);})['end']();});}function uploadFile(_0x4f36a4){return new BPromise(function(_0x32b65f,_0x273373){var _0x2e1717=urlParse(_0x4f36a4);var _0x23c941=_0x2e1717['protocol']===_0x49a3('0x11')?https:http;var _0xe75e49={'host':_0x2e1717[_0x49a3('0x12')],'path':_0x2e1717[_0x49a3('0x0')],'headers':{'user-agent':_0x49a3('0x13')}};_0x23c941['get'](_0xe75e49,function(_0x2ea71b){if(_0x2ea71b[_0x49a3('0x15')]!==0xc8){_0x273373(new Error(_0x49a3('0x17')+_0x4f36a4+_0x49a3('0x18')+_0x2ea71b[_0x49a3('0x15')]+'\x20('+_0x2ea71b[_0x49a3('0x19')]+')'));return;}var _0x1c315a='';_0x2ea71b['on']('data',function(_0x15f3d6){_0x1c315a+=_0x15f3d6;});_0x2ea71b['on'](_0x49a3('0x1e'),function(){_0x32b65f(_0x1c315a);});})['on'](_0x49a3('0x16'),function(_0x592cf4){_0x273373(_0x592cf4);})['end']();});}function convertFile(_0x510249,_0x53c4a0){return new BPromise(function(_0x5d2ae2,_0x46505c){var _0x2ddc4d=sox[_0x49a3('0x1f')](_0x510249,_0x53c4a0,{'sampleRate':0x1f40,'format':_0x49a3('0x20'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2ddc4d['on'](_0x49a3('0x16'),function(_0xfc8364){logger[_0x49a3('0x16')]('error\x20convert',_0xfc8364);_0x46505c(_0xfc8364);});_0x2ddc4d['on']('end',function(){logger[_0x49a3('0x1c')](_0x49a3('0x21'));_0x5d2ae2();});_0x2ddc4d[_0x49a3('0x22')]();});}function base64Decode(_0x3a3fd9,_0x202c41){var _0x1c3977=path[_0x49a3('0x23')](__dirname,'tmp',rs[_0x49a3('0x24')](0x4)+_0x49a3('0x25'));fs[_0x49a3('0x26')](_0x1c3977,_0x3a3fd9,_0x49a3('0x27'));return convertFile(_0x1c3977,_0x202c41)[_0x49a3('0x28')](function(){try{fs[_0x49a3('0x29')](_0x1c3977);fs[_0x49a3('0x2a')](_0x202c41,_0x49a3('0x2b'));}catch(_0x2d357e){logger[_0x49a3('0x16')](_0x2d357e);}return _0x202c41[_0x49a3('0x2c')]('.')[0x0];});}function base64Encode(_0xa7f915){var _0x3510c7=fs['readFileSync'](_0xa7f915);return new Buffer(_0x3510c7)[_0x49a3('0x2d')]('base64');}exports[_0x49a3('0x2e')]=function(_0x3f0d4a,_0x1f6863,_0x3451b5,_0x50825d,_0x3612b1,_0x4ded31){var _0x22aa72,_0x2bd88f;var _0x4fb98a='https://texttospeech.googleapis.com/v1/';var _0x43d07b=_0x49a3('0x2f')+_0x3f0d4a;var _0x442534={};if(_0x1f6863===_0x49a3('0x30')){_0x442534[_0x49a3('0x31')]={'ssml':_0x3451b5};}else{_0x442534[_0x49a3('0x31')]={'text':_0x3451b5};};_0x442534[_0x49a3('0x32')]={'languageCode':_0x50825d,'ssmlGender':_0x3612b1};_0x442534[_0x49a3('0x33')]={'audioEncoding':_0x49a3('0x34'),'sampleRateHertz':0x1f40};var _0x116313={'url':_0x4fb98a+_0x49a3('0x35')+_0x43d07b,'method':_0x49a3('0x36'),'json':!![],'body':_0x442534};return rp(_0x116313)[_0x49a3('0x28')](function(_0x2eccf2){return new BPromise(function(_0xe9925b,_0x784737){_0x22aa72=path[_0x49a3('0x23')](__dirname,_0x49a3('0x37'),rs[_0x49a3('0x24')](0x4)+_0x49a3('0x38'));var _0x5bd6a0=Buffer[_0x49a3('0x39')](_0x2eccf2['audioContent'],'base64');return fs[_0x49a3('0x3a')](_0x22aa72,_0x5bd6a0,function(_0x13c4a3){_0x784737(_0x13c4a3);},function(_0x46da48){fs[_0x49a3('0x2a')](_0x22aa72,_0x49a3('0x2b'));_0xe9925b(_0x46da48);});});})['then'](function(_0x5472f1){_0x2bd88f=path[_0x49a3('0x23')](__dirname,_0x49a3('0x37'),rs[_0x49a3('0x24')](0x4)+_0x49a3('0x25'));return convertFile(_0x22aa72,_0x2bd88f);})[_0x49a3('0x28')](function(){try{fs[_0x49a3('0x29')](_0x22aa72);fs[_0x49a3('0x2a')](_0x2bd88f,'777');}catch(_0x300be1){logger[_0x49a3('0x16')](_0x300be1);}logger[_0x49a3('0x1c')]('googleCloudTTS\x20path',_0x2bd88f[_0x49a3('0x2c')]('.')[0x0]);return _0x2bd88f[_0x49a3('0x2c')]('.')[0x0];});};exports[_0x49a3('0x3b')]=function(_0x12032f,_0x3e852f){var _0xb29ef1,_0x196e12;return tts(_0x12032f,_0x3e852f||'en',0x1)['then'](function(_0x3d23e3){logger[_0x49a3('0x1c')](_0x3d23e3);_0xb29ef1=path[_0x49a3('0x23')](__dirname,'tmp',rs['generate'](0x4)+_0x49a3('0x38'));return downloadFile(_0x3d23e3,_0xb29ef1);})[_0x49a3('0x28')](function(){_0x196e12=path[_0x49a3('0x23')](__dirname,_0x49a3('0x37'),rs[_0x49a3('0x24')](0x4)+_0x49a3('0x25'));return convertFile(_0xb29ef1,_0x196e12);})[_0x49a3('0x28')](function(){try{fs[_0x49a3('0x29')](_0xb29ef1);fs['chmodSync'](_0x196e12,_0x49a3('0x2b'));}catch(_0x589839){logger[_0x49a3('0x16')](_0x589839);}logger['info']('goggleTTS\x20path',_0x196e12[_0x49a3('0x2c')]('.')[0x0]);return _0x196e12[_0x49a3('0x2c')]('.')[0x0];});};exports[_0x49a3('0x3c')]=function(_0x169ee7,_0xbeedc3,_0x2ec76c){return google['asr'](_0x169ee7,_0xbeedc3,_0x2ec76c)[_0x49a3('0x28')](function(_0x133c7c){logger['info'](_0x133c7c['uri']);return rp(_0x133c7c);})[_0x49a3('0x28')](function(_0x5aebdf){var _0x27c9aa='';var _0xf91f3e=0x0;try{fs[_0x49a3('0x29')](_0x169ee7);}catch(_0x5bf3db){logger[_0x49a3('0x16')](_0x5bf3db);}if(_0x5aebdf&&_0x5aebdf[_0x49a3('0x3d')]){_0x27c9aa=_0x5aebdf[_0x49a3('0x3d')][_0x49a3('0x3e')](function(_0x40481d){return _0x40481d&&_0x40481d['alternatives'][0x0]&&_0x40481d['alternatives'][0x0][_0x49a3('0x3f')]?_0x40481d[_0x49a3('0x40')][0x0]['transcript']:'';})[_0x49a3('0x41')]('\x0a');_0xf91f3e=_0x5aebdf['results'][_0x49a3('0x3e')](function(_0x2e9c2f){return _0x2e9c2f&&_0x2e9c2f[_0x49a3('0x40')][0x0]&&_0x2e9c2f['alternatives'][0x0][_0x49a3('0x42')]?_0x2e9c2f['alternatives'][0x0][_0x49a3('0x42')]:0x0;})[_0x49a3('0x41')]('\x0a');}logger[_0x49a3('0x1c')](_0x49a3('0x43'),_0x27c9aa);logger[_0x49a3('0x1c')]('googleASR\x20confidence',_0xf91f3e);return{'transcript':_0x27c9aa,'confidence':_0xf91f3e};})[_0x49a3('0x44')](function(_0xc312c1){logger[_0x49a3('0x16')](_0x49a3('0x45'),_0xc312c1[_0x49a3('0x15')],_0xc312c1[_0x49a3('0x46')],_0xc312c1[_0x49a3('0x47')]);});};exports[_0x49a3('0x48')]=function(_0xa59feb,_0x1dea48,_0x300444,_0xa950fc){var _0x21975a=apiai(_0x1dea48,{'language':_0xa950fc||'en'});return _0x21975a[_0x49a3('0x49')](_0x300444,{'sessionId':md5(_0xa59feb)})[_0x49a3('0x28')](function(_0x564329){logger[_0x49a3('0x1c')](JSON[_0x49a3('0x4a')](_0x564329));return{'source':_0x564329[_0x49a3('0x4b')][_0x49a3('0x4c')],'resolvedQuery':_0x564329[_0x49a3('0x4b')][_0x49a3('0x4d')],'action':_0x564329[_0x49a3('0x4b')][_0x49a3('0x4e')],'actionIncomplete':_0x564329[_0x49a3('0x4b')][_0x49a3('0x4f')],'speech':_0x564329['result'][_0x49a3('0x50')][_0x49a3('0x51')],'score':_0x564329['result'][_0x49a3('0x52')],'statusCode':_0x564329[_0x49a3('0x53')][_0x49a3('0x54')],'endConversation':_0x564329[_0x49a3('0x4b')][_0x49a3('0x55')][_0x49a3('0x56')]||![],'isFallbackIntent':_0x564329[_0x49a3('0x4b')][_0x49a3('0x55')][_0x49a3('0x57')]};});};exports[_0x49a3('0x58')]=function(_0x3f1f21,_0x1f492,_0x2c586c,_0x288f2d){return tilde[_0x49a3('0x59')](_0x3f1f21,_0x1f492,_0x2c586c,_0x288f2d)[_0x49a3('0x28')](function(_0x1bd313){try{fs['unlink'](_0x3f1f21);}catch(_0x5c5d12){logger[_0x49a3('0x16')](_0x5c5d12);}logger[_0x49a3('0x1c')](_0x49a3('0x5a'),_0x1bd313['transcript']);logger[_0x49a3('0x1c')](_0x49a3('0x5b'),_0x1bd313[_0x49a3('0x42')]);return _0x1bd313;});};exports[_0x49a3('0x5c')]=function(_0x380477,_0x56301d,_0x53e8c4,_0x5187a5,_0x3e2abd,_0x5bf420){var _0x4a7ef0=path['resolve'](__dirname,'tmp',rs[_0x49a3('0x24')](0x4)+'.mp3');var _0x44db53;return aws['polly'](_0x380477,_0x56301d,_0x53e8c4,_0x5187a5,_0x3e2abd,_0x5bf420,_0x4a7ef0)[_0x49a3('0x28')](function(){_0x44db53=path[_0x49a3('0x23')](__dirname,_0x49a3('0x37'),rs[_0x49a3('0x24')](0x4)+_0x49a3('0x25'));return convertFile(_0x4a7ef0,_0x44db53);})[_0x49a3('0x28')](function(){try{fs[_0x49a3('0x29')](_0x4a7ef0);fs[_0x49a3('0x2a')](_0x44db53,'777');}catch(_0x449cfe){logger[_0x49a3('0x16')](_0x449cfe);}return _0x44db53[_0x49a3('0x2c')]('.')[0x0];});};exports[_0x49a3('0x5d')]=function(_0x47be78,_0x3b48e3,_0x4d0fef,_0x3b0a51,_0x486f90,_0x2fb99a){return aws['lex'](_0x47be78,_0x3b48e3,_0x4d0fef,_0x3b0a51,_0x486f90,_0x2fb99a)['then'](function(_0x592b5b){logger['info'](JSON['stringify'](_0x592b5b));return _0x592b5b;});};exports[_0x49a3('0x5e')]=function(_0x59fc44,_0x2d9b27,_0x360992,_0x3000a2){var _0x22e818=util['format'](_0x49a3('0x5f'),ISPEECH_API,_0x59fc44,encodeURIComponent(_0x2d9b27),_0x360992,_0x3000a2);var _0x286b5d=path[_0x49a3('0x23')](__dirname,_0x49a3('0x37'),rs[_0x49a3('0x24')](0x4)+_0x49a3('0x38'));var _0x47df62;return downloadFile(_0x22e818,_0x286b5d)['then'](function(){_0x47df62=path['resolve'](__dirname,_0x49a3('0x37'),rs['generate'](0x4)+_0x49a3('0x25'));return convertFile(_0x286b5d,_0x47df62);})[_0x49a3('0x28')](function(){try{fs[_0x49a3('0x29')](_0x286b5d);fs['chmodSync'](_0x47df62,'777');}catch(_0x4ca3d7){logger[_0x49a3('0x16')](_0x4ca3d7);}return _0x47df62[_0x49a3('0x2c')]('.')[0x0];});};exports[_0x49a3('0x60')]=function(_0x6372ad,_0x21d52f,_0x5070e7,_0xfc0193){var _0x146c16=util[_0x49a3('0x61')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x21d52f,_0x5070e7,base64Encode(_0x6372ad),_0xfc0193?util[_0x49a3('0x61')](_0x49a3('0x62'),encodeURIComponent(_0xfc0193)):_0x49a3('0x63'));return uploadFile(_0x146c16)[_0x49a3('0x28')](function(_0x31183a){return querystring[_0x49a3('0x64')](_0x31183a);});};exports[_0x49a3('0x65')]=function(_0x1a8094,_0xf177d6){return sestek[_0x49a3('0x66')](_0x1a8094,_0xf177d6)[_0x49a3('0x28')](function(_0x4d5484){logger[_0x49a3('0x1c')](JSON['stringify'](_0x4d5484));var _0x2a4463={'speech':_0x4d5484[_0x49a3('0x67')],'action':_0x4d5484[_0x49a3('0x68')]?_0x4d5484[_0x49a3('0x68')]['CustomAction']:undefined,'actiondata':_0x4d5484[_0x49a3('0x68')]?_0x4d5484[_0x49a3('0x68')][_0x49a3('0x69')]:undefined};if(_0x4d5484[_0x49a3('0x68')]&&_0x4d5484[_0x49a3('0x68')][_0x49a3('0x6a')]){return base64Decode(_0x4d5484[_0x49a3('0x68')][_0x49a3('0x6a')][_0x49a3('0x6b')],path[_0x49a3('0x23')](__dirname,'tmp',rs[_0x49a3('0x24')](0x4)+_0x49a3('0x25')))['then'](function(_0x39bdbe){_0x2a4463[_0x49a3('0x6c')]=_0x39bdbe;return _0x2a4463;});}return _0x2a4463;});};exports[_0x49a3('0x6d')]=function(){return __dirname;}; \ No newline at end of file +var _0xa88a=['transcode','wav','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','base64','then','777','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','voice','audioConfig','MP3','POST','from','writeFile','chmodSync','googleCloudTTS\x20path','split','.mp3','googleASR','asr','results','map','alternatives','transcript','confidence','join','googleASR\x20transcription','googleASR\x20confidence','[%s]\x20%s:%s','name','googleDialogflow','textRequest','stringify','result','source','action','actionIncomplete','speech','isFallbackIntent','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','polly','awsLex','lex','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','model=%s','freeform=3','sestekNDA','nda','text','channelData','AudioFromTts','Data','audiofile','dirName','http','https','url','parse','randomstring','sox','request-promise','util','google-tts-api','apiai-promise','./google','./aws','./sestek','../../../config/logger','agi','protocol','host','path','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','https:'];(function(_0x24e69f,_0x29f5ee){var _0x96891e=function(_0x391be1){while(--_0x391be1){_0x24e69f['push'](_0x24e69f['shift']());}};_0x96891e(++_0x29f5ee);}(_0xa88a,0x113));var _0xaa88=function(_0x11811d,_0x13bad1){_0x11811d=_0x11811d-0x0;var _0x4b7928=_0xa88a[_0x11811d];return _0x4b7928;};'use strict';var fs=require('fs');var path=require('path');var http=require(_0xaa88('0x0'));var https=require(_0xaa88('0x1'));var urlParse=require(_0xaa88('0x2'))[_0xaa88('0x3')];var BPromise=require('bluebird');var rs=require(_0xaa88('0x4'));var sox=require(_0xaa88('0x5'));var rp=require(_0xaa88('0x6'));var util=require(_0xaa88('0x7'));var querystring=require('querystring');var tts=require(_0xaa88('0x8'));var apiai=require(_0xaa88('0x9'));var md5=require('md5');var google=require(_0xaa88('0xa'));var aws=require(_0xaa88('0xb'));var tilde=require('./tilde');var sestek=require(_0xaa88('0xc'));var logger=require(_0xaa88('0xd'))(_0xaa88('0xe'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x11939b,_0x53aeb5){return new BPromise(function(_0x291538,_0x51a306){var _0x78af13=urlParse(_0x11939b);var _0x3a6ce5=_0x78af13[_0xaa88('0xf')]==='https:'?https:http;var _0x29e60a={'host':_0x78af13[_0xaa88('0x10')],'path':_0x78af13[_0xaa88('0x11')],'headers':{'user-agent':_0xaa88('0x12')}};_0x3a6ce5[_0xaa88('0x13')](_0x29e60a,function(_0x3645fa){if(_0x3645fa[_0xaa88('0x14')]!==0xc8){logger[_0xaa88('0x15')](_0xaa88('0x16')+_0x11939b+_0xaa88('0x17')+_0x3645fa[_0xaa88('0x14')]+'\x20('+_0x3645fa['statusMessage']+')');_0x51a306(new Error('request\x20to\x20'+_0x11939b+_0xaa88('0x17')+_0x3645fa['statusCode']+'\x20('+_0x3645fa[_0xaa88('0x18')]+')'));return;}var _0x2e96a7=fs['createWriteStream'](_0x53aeb5);_0x2e96a7['on'](_0xaa88('0x19'),function(){logger[_0xaa88('0x1a')](_0xaa88('0x1b'));_0x2e96a7[_0xaa88('0x1c')](_0x291538);});_0x2e96a7['on']('error',function(_0x1bb7d7){fs[_0xaa88('0x1d')](_0x53aeb5);logger[_0xaa88('0x15')](_0xaa88('0x1e'),_0x1bb7d7);_0x51a306(_0x1bb7d7);});_0x3645fa[_0xaa88('0x1f')](_0x2e96a7);})['on']('error',function(_0x389cf5){logger[_0xaa88('0x15')](_0x389cf5);_0x51a306(_0x389cf5);})[_0xaa88('0x20')]();});}function uploadFile(_0x4aa02b){return new BPromise(function(_0x2b57df,_0x143c59){var _0x329ec0=urlParse(_0x4aa02b);var _0x379912=_0x329ec0[_0xaa88('0xf')]===_0xaa88('0x21')?https:http;var _0x29af33={'host':_0x329ec0[_0xaa88('0x10')],'path':_0x329ec0['path'],'headers':{'user-agent':_0xaa88('0x12')}};_0x379912[_0xaa88('0x13')](_0x29af33,function(_0xeafb0a){if(_0xeafb0a[_0xaa88('0x14')]!==0xc8){_0x143c59(new Error(_0xaa88('0x16')+_0x4aa02b+_0xaa88('0x17')+_0xeafb0a['statusCode']+'\x20('+_0xeafb0a[_0xaa88('0x18')]+')'));return;}var _0x1ec3e7='';_0xeafb0a['on']('data',function(_0x3a6a9d){_0x1ec3e7+=_0x3a6a9d;});_0xeafb0a['on']('end',function(){_0x2b57df(_0x1ec3e7);});})['on'](_0xaa88('0x15'),function(_0x46c493){_0x143c59(_0x46c493);})[_0xaa88('0x20')]();});}function convertFile(_0xc0d5ed,_0x1071d1){return new BPromise(function(_0x3839f3,_0x51ad96){var _0x562b1d=sox[_0xaa88('0x22')](_0xc0d5ed,_0x1071d1,{'sampleRate':0x1f40,'format':_0xaa88('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x562b1d['on']('error',function(_0x1b82d5){logger[_0xaa88('0x15')]('error\x20convert',_0x1b82d5);_0x51ad96(_0x1b82d5);});_0x562b1d['on']('end',function(){logger[_0xaa88('0x1a')](_0xaa88('0x24'));_0x3839f3();});_0x562b1d[_0xaa88('0x25')]();});}function base64Decode(_0x2a47dc,_0x45c1d8){var _0x5ed9ac=path[_0xaa88('0x26')](__dirname,_0xaa88('0x27'),rs[_0xaa88('0x28')](0x4)+_0xaa88('0x29'));fs['writeFileSync'](_0x5ed9ac,_0x2a47dc,_0xaa88('0x2a'));return convertFile(_0x5ed9ac,_0x45c1d8)[_0xaa88('0x2b')](function(){try{fs['unlink'](_0x5ed9ac);fs['chmodSync'](_0x45c1d8,_0xaa88('0x2c'));}catch(_0x361f0){logger[_0xaa88('0x15')](_0x361f0);}return _0x45c1d8['split']('.')[0x0];});}function base64Encode(_0x984323){var _0x311158=fs[_0xaa88('0x2d')](_0x984323);return new Buffer(_0x311158)[_0xaa88('0x2e')](_0xaa88('0x2a'));}exports[_0xaa88('0x2f')]=function(_0x2cb44e,_0xcb1582,_0x17bf54,_0x48dc9d,_0x23b16d,_0x5a1972){var _0x1ffd51,_0x456d8d;var _0x4a0aa2=_0xaa88('0x30');var _0x29bbde=_0xaa88('0x31')+_0x2cb44e;var _0x3f800e={};if(_0xcb1582===_0xaa88('0x32')){_0x3f800e['input']={'ssml':_0x17bf54};}else{_0x3f800e['input']={'text':_0x17bf54};};_0x3f800e[_0xaa88('0x33')]={'languageCode':_0x48dc9d,'ssmlGender':_0x23b16d};_0x3f800e[_0xaa88('0x34')]={'audioEncoding':_0xaa88('0x35'),'sampleRateHertz':0x1f40};var _0x5a7e14={'url':_0x4a0aa2+'text:synthesize'+_0x29bbde,'method':_0xaa88('0x36'),'json':!![],'body':_0x3f800e};return rp(_0x5a7e14)[_0xaa88('0x2b')](function(_0x2395a8){return new BPromise(function(_0x491641,_0x44dec6){_0x1ffd51=path[_0xaa88('0x26')](__dirname,_0xaa88('0x27'),rs[_0xaa88('0x28')](0x4)+'.mp3');var _0x443ba8=Buffer[_0xaa88('0x37')](_0x2395a8['audioContent'],_0xaa88('0x2a'));return fs[_0xaa88('0x38')](_0x1ffd51,_0x443ba8,function(_0x128e68){_0x44dec6(_0x128e68);},function(_0x10c39f){fs['chmodSync'](_0x1ffd51,'777');_0x491641(_0x10c39f);});});})[_0xaa88('0x2b')](function(_0x172b32){_0x456d8d=path[_0xaa88('0x26')](__dirname,_0xaa88('0x27'),rs[_0xaa88('0x28')](0x4)+_0xaa88('0x29'));return convertFile(_0x1ffd51,_0x456d8d);})[_0xaa88('0x2b')](function(){try{fs[_0xaa88('0x1d')](_0x1ffd51);fs[_0xaa88('0x39')](_0x456d8d,'777');}catch(_0x484392){logger[_0xaa88('0x15')](_0x484392);}logger[_0xaa88('0x1a')](_0xaa88('0x3a'),_0x456d8d[_0xaa88('0x3b')]('.')[0x0]);return _0x456d8d['split']('.')[0x0];});};exports['googleTTS']=function(_0x2c5005,_0x324c44){var _0x444419,_0x2f9aed;return tts(_0x2c5005,_0x324c44||'en',0x1)[_0xaa88('0x2b')](function(_0x3e5fe1){logger[_0xaa88('0x1a')](_0x3e5fe1);_0x444419=path[_0xaa88('0x26')](__dirname,_0xaa88('0x27'),rs[_0xaa88('0x28')](0x4)+_0xaa88('0x3c'));return downloadFile(_0x3e5fe1,_0x444419);})[_0xaa88('0x2b')](function(){_0x2f9aed=path['resolve'](__dirname,_0xaa88('0x27'),rs['generate'](0x4)+_0xaa88('0x29'));return convertFile(_0x444419,_0x2f9aed);})[_0xaa88('0x2b')](function(){try{fs[_0xaa88('0x1d')](_0x444419);fs[_0xaa88('0x39')](_0x2f9aed,_0xaa88('0x2c'));}catch(_0x29bd1a){logger[_0xaa88('0x15')](_0x29bd1a);}logger['info']('goggleTTS\x20path',_0x2f9aed['split']('.')[0x0]);return _0x2f9aed[_0xaa88('0x3b')]('.')[0x0];});};exports[_0xaa88('0x3d')]=function(_0x5c5d25,_0x19f522,_0x56ca3f){return google[_0xaa88('0x3e')](_0x5c5d25,_0x19f522,_0x56ca3f)[_0xaa88('0x2b')](function(_0x2161ee){logger[_0xaa88('0x1a')](_0x2161ee['uri']);return rp(_0x2161ee);})[_0xaa88('0x2b')](function(_0x2843b7){var _0x106847='';var _0x15d5a0=0x0;try{fs[_0xaa88('0x1d')](_0x5c5d25);}catch(_0x36c38e){logger[_0xaa88('0x15')](_0x36c38e);}if(_0x2843b7&&_0x2843b7[_0xaa88('0x3f')]){_0x106847=_0x2843b7[_0xaa88('0x3f')][_0xaa88('0x40')](function(_0x2c6b08){return _0x2c6b08&&_0x2c6b08[_0xaa88('0x41')][0x0]&&_0x2c6b08[_0xaa88('0x41')][0x0][_0xaa88('0x42')]?_0x2c6b08[_0xaa88('0x41')][0x0]['transcript']:'';})['join']('\x0a');_0x15d5a0=_0x2843b7[_0xaa88('0x3f')][_0xaa88('0x40')](function(_0x429394){return _0x429394&&_0x429394['alternatives'][0x0]&&_0x429394['alternatives'][0x0][_0xaa88('0x43')]?_0x429394[_0xaa88('0x41')][0x0]['confidence']:0x0;})[_0xaa88('0x44')]('\x0a');}logger[_0xaa88('0x1a')](_0xaa88('0x45'),_0x106847);logger['info'](_0xaa88('0x46'),_0x15d5a0);return{'transcript':_0x106847,'confidence':_0x15d5a0};})['catch'](function(_0x3f9a89){logger['error'](_0xaa88('0x47'),_0x3f9a89[_0xaa88('0x14')],_0x3f9a89[_0xaa88('0x48')],_0x3f9a89['message']);});};exports[_0xaa88('0x49')]=function(_0x6d8a0c,_0x36a4b0,_0x47ec55,_0x3c8f16){var _0x208cb4=apiai(_0x36a4b0,{'language':_0x3c8f16||'en'});return _0x208cb4[_0xaa88('0x4a')](_0x47ec55,{'sessionId':md5(_0x6d8a0c)})[_0xaa88('0x2b')](function(_0x2f9170){logger['info'](JSON[_0xaa88('0x4b')](_0x2f9170));return{'source':_0x2f9170[_0xaa88('0x4c')][_0xaa88('0x4d')],'resolvedQuery':_0x2f9170[_0xaa88('0x4c')]['resolvedQuery'],'action':_0x2f9170['result'][_0xaa88('0x4e')],'actionIncomplete':_0x2f9170[_0xaa88('0x4c')][_0xaa88('0x4f')],'speech':_0x2f9170['result']['fulfillment'][_0xaa88('0x50')],'score':_0x2f9170[_0xaa88('0x4c')]['score'],'statusCode':_0x2f9170['status']['code'],'endConversation':_0x2f9170['result']['metadata']['endConversation']||![],'isFallbackIntent':_0x2f9170[_0xaa88('0x4c')]['metadata'][_0xaa88('0x51')]};});};exports[_0xaa88('0x52')]=function(_0x3de04d,_0x492f4f,_0x1abb9e,_0x1b1201){return tilde['asr'](_0x3de04d,_0x492f4f,_0x1abb9e,_0x1b1201)[_0xaa88('0x2b')](function(_0x425c1c){try{fs['unlink'](_0x3de04d);}catch(_0x1a1562){logger['error'](_0x1a1562);}logger[_0xaa88('0x1a')](_0xaa88('0x53'),_0x425c1c[_0xaa88('0x42')]);logger[_0xaa88('0x1a')](_0xaa88('0x54'),_0x425c1c[_0xaa88('0x43')]);return _0x425c1c;});};exports['awsPolly']=function(_0x12572a,_0x4cb70e,_0x5cfca8,_0x3704fa,_0x4e4c97,_0xb8c4a5){var _0x167e8e=path['resolve'](__dirname,_0xaa88('0x27'),rs[_0xaa88('0x28')](0x4)+_0xaa88('0x3c'));var _0x222383;return aws[_0xaa88('0x55')](_0x12572a,_0x4cb70e,_0x5cfca8,_0x3704fa,_0x4e4c97,_0xb8c4a5,_0x167e8e)[_0xaa88('0x2b')](function(){_0x222383=path[_0xaa88('0x26')](__dirname,_0xaa88('0x27'),rs['generate'](0x4)+_0xaa88('0x29'));return convertFile(_0x167e8e,_0x222383);})['then'](function(){try{fs['unlink'](_0x167e8e);fs[_0xaa88('0x39')](_0x222383,_0xaa88('0x2c'));}catch(_0x2147cd){logger[_0xaa88('0x15')](_0x2147cd);}return _0x222383['split']('.')[0x0];});};exports[_0xaa88('0x56')]=function(_0x9dbced,_0x2aed6a,_0x5d3eb7,_0x213236,_0x1ce940,_0x548c8c){return aws[_0xaa88('0x57')](_0x9dbced,_0x2aed6a,_0x5d3eb7,_0x213236,_0x1ce940,_0x548c8c)[_0xaa88('0x2b')](function(_0x9381d1){logger[_0xaa88('0x1a')](JSON[_0xaa88('0x4b')](_0x9381d1));return _0x9381d1;});};exports[_0xaa88('0x58')]=function(_0x29f8aa,_0x3f3813,_0x4a8324,_0x2d65a7){var _0x486392=util[_0xaa88('0x59')](_0xaa88('0x5a'),ISPEECH_API,_0x29f8aa,encodeURIComponent(_0x3f3813),_0x4a8324,_0x2d65a7);var _0x4abe8e=path[_0xaa88('0x26')](__dirname,_0xaa88('0x27'),rs[_0xaa88('0x28')](0x4)+_0xaa88('0x3c'));var _0xdd6c40;return downloadFile(_0x486392,_0x4abe8e)[_0xaa88('0x2b')](function(){_0xdd6c40=path[_0xaa88('0x26')](__dirname,_0xaa88('0x27'),rs[_0xaa88('0x28')](0x4)+'.wav');return convertFile(_0x4abe8e,_0xdd6c40);})[_0xaa88('0x2b')](function(){try{fs[_0xaa88('0x1d')](_0x4abe8e);fs[_0xaa88('0x39')](_0xdd6c40,_0xaa88('0x2c'));}catch(_0x5883c5){logger[_0xaa88('0x15')](_0x5883c5);}return _0xdd6c40[_0xaa88('0x3b')]('.')[0x0];});};exports[_0xaa88('0x5b')]=function(_0x162dc8,_0x3740bd,_0x5e76b9,_0x471ee8){var _0x1a7268=util[_0xaa88('0x59')](_0xaa88('0x5c'),ISPEECH_API,_0x3740bd,_0x5e76b9,base64Encode(_0x162dc8),_0x471ee8?util['format'](_0xaa88('0x5d'),encodeURIComponent(_0x471ee8)):_0xaa88('0x5e'));return uploadFile(_0x1a7268)['then'](function(_0x339755){return querystring[_0xaa88('0x3')](_0x339755);});};exports[_0xaa88('0x5f')]=function(_0x461001,_0x3aa7d0){return sestek[_0xaa88('0x60')](_0x461001,_0x3aa7d0)[_0xaa88('0x2b')](function(_0x288a28){logger['info'](JSON[_0xaa88('0x4b')](_0x288a28));var _0x6bfaa6={'speech':_0x288a28[_0xaa88('0x61')],'action':_0x288a28[_0xaa88('0x62')]?_0x288a28[_0xaa88('0x62')]['CustomAction']:undefined,'actiondata':_0x288a28['channelData']?_0x288a28['channelData']['CustomActionData']:undefined};if(_0x288a28['channelData']&&_0x288a28['channelData'][_0xaa88('0x63')]){return base64Decode(_0x288a28[_0xaa88('0x62')][_0xaa88('0x63')][_0xaa88('0x64')],path[_0xaa88('0x26')](__dirname,_0xaa88('0x27'),rs[_0xaa88('0x28')](0x4)+'.wav'))[_0xaa88('0x2b')](function(_0x47009c){_0x6bfaa6[_0xaa88('0x65')]=_0x47009c;return _0x6bfaa6;});}return _0x6bfaa6;});};exports[_0xaa88('0x66')]=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 8f34e03..a8f1b7e 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 nda=require('./nda');module['exports']={'nda':nda}; \ No newline at end of file +var _0xab7b=['./nda'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xab7b,0x12f));var _0xbab7=function(_0x44c742,_0x5d69a4){_0x44c742=_0x44c742-0x0;var _0x40fcf0=_0xab7b[_0x44c742];return _0x40fcf0;};var nda=require(_0xbab7('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 d929588..13a3b89 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 _0xb9a6=['resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','dnid','extension','Bearer\x20','access_token','project','channelData','ProjectName','ndagenerate_audio','body','AudioOutputSettings','custom_action','custom_action_data','CustomActionData','info','stringify','url','../../../../../config/logger','agi','exports','POST','ndauth_url','/token','password','then'];(function(_0x209003,_0x4df2a8){var _0xf696eb=function(_0x4e0063){while(--_0x4e0063){_0x209003['push'](_0x209003['shift']());}};_0xf696eb(++_0x4df2a8);}(_0xb9a6,0x137));var _0x6b9a=function(_0x162565,_0x56dcf9){_0x162565=_0x162565-0x0;var _0x24537f=_0xb9a6[_0x162565];return _0x24537f;};'use strict';var rp=require('request-promise');var url=require(_0x6b9a('0x0'));var logger=require(_0x6b9a('0x1'))(_0x6b9a('0x2'));module[_0x6b9a('0x3')]=function(_0x296ed6,_0x1b0fee){var _0x173255={'method':_0x6b9a('0x4'),'uri':url['resolve'](_0x1b0fee[_0x6b9a('0x5')],_0x6b9a('0x6')),'form':{'grant_type':'password','username':_0x1b0fee['username'],'password':_0x1b0fee[_0x6b9a('0x7')]},'json':!![]};return rp(_0x173255)[_0x6b9a('0x8')](function(_0x380b11){var _0x2df9c0={'method':'POST','uri':url[_0x6b9a('0x9')](_0x1b0fee[_0x6b9a('0xa')],_0x6b9a('0xb')),'body':{'type':_0x1b0fee[_0x6b9a('0xc')]||_0x6b9a('0xd'),'channelId':_0x6b9a('0xe'),'conversation':{'id':_0x296ed6[_0x6b9a('0xf')]},'from':{'id':_0x296ed6[_0x6b9a('0x10')],'name':_0x296ed6['calleridname']},'recipient':{'id':_0x296ed6[_0x6b9a('0x11')],'name':_0x296ed6[_0x6b9a('0x12')]},'text':_0x1b0fee['text'],'channelData':{}},'headers':{'Authorization':_0x6b9a('0x13')+_0x380b11[_0x6b9a('0x14')]},'json':!![]};if(_0x1b0fee[_0x6b9a('0x15')]){_0x2df9c0['body'][_0x6b9a('0x16')][_0x6b9a('0x17')]=_0x1b0fee['project'];}if(_0x1b0fee[_0x6b9a('0x18')]=='1'){_0x2df9c0[_0x6b9a('0x19')][_0x6b9a('0x16')][_0x6b9a('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x1b0fee['custom_action']){_0x2df9c0['body'][_0x6b9a('0x16')]['CustomAction']=_0x1b0fee[_0x6b9a('0x1b')];if(_0x1b0fee[_0x6b9a('0x1c')]){_0x2df9c0[_0x6b9a('0x19')]['channelData'][_0x6b9a('0x1d')]=_0x1b0fee[_0x6b9a('0x1c')];}}logger[_0x6b9a('0x1e')](JSON[_0x6b9a('0x1f')](_0x2df9c0));return rp(_0x2df9c0);});}; \ No newline at end of file +var _0x870e=['resolve','ndauth_url','username','password','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','uniqueid','callerid','dnid','Bearer\x20','channelData','ProjectName','project','ndagenerate_audio','body','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','request-promise','url','../../../../../config/logger','agi','exports'];(function(_0x4b91c4,_0x23f35f){var _0x25cb80=function(_0x48e283){while(--_0x48e283){_0x4b91c4['push'](_0x4b91c4['shift']());}};_0x25cb80(++_0x23f35f);}(_0x870e,0x191));var _0xe870=function(_0x1748bf,_0x5e8653){_0x1748bf=_0x1748bf-0x0;var _0x4de181=_0x870e[_0x1748bf];return _0x4de181;};'use strict';var rp=require(_0xe870('0x0'));var url=require(_0xe870('0x1'));var logger=require(_0xe870('0x2'))(_0xe870('0x3'));module[_0xe870('0x4')]=function(_0x3bd1c9,_0x563e8e){var _0x33509c={'method':'POST','uri':url[_0xe870('0x5')](_0x563e8e[_0xe870('0x6')],'/token'),'form':{'grant_type':'password','username':_0x563e8e[_0xe870('0x7')],'password':_0x563e8e[_0xe870('0x8')]},'json':!![]};return rp(_0x33509c)['then'](function(_0x2118b1){var _0x5795cb={'method':'POST','uri':url[_0xe870('0x5')](_0x563e8e[_0xe870('0x9')],_0xe870('0xa')),'body':{'type':_0x563e8e[_0xe870('0xb')]||_0xe870('0xc'),'channelId':'Nda','conversation':{'id':_0x3bd1c9[_0xe870('0xd')]},'from':{'id':_0x3bd1c9[_0xe870('0xe')],'name':_0x3bd1c9['calleridname']},'recipient':{'id':_0x3bd1c9[_0xe870('0xf')],'name':_0x3bd1c9['extension']},'text':_0x563e8e['text'],'channelData':{}},'headers':{'Authorization':_0xe870('0x10')+_0x2118b1['access_token']},'json':!![]};if(_0x563e8e['project']){_0x5795cb['body'][_0xe870('0x11')][_0xe870('0x12')]=_0x563e8e[_0xe870('0x13')];}if(_0x563e8e[_0xe870('0x14')]=='1'){_0x5795cb[_0xe870('0x15')][_0xe870('0x11')][_0xe870('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xe870('0x17')};}if(_0x563e8e[_0xe870('0x18')]){_0x5795cb[_0xe870('0x15')][_0xe870('0x11')][_0xe870('0x19')]=_0x563e8e[_0xe870('0x18')];if(_0x563e8e[_0xe870('0x1a')]){_0x5795cb[_0xe870('0x15')][_0xe870('0x11')][_0xe870('0x1b')]=_0x563e8e[_0xe870('0x1a')];}}logger[_0xe870('0x1c')](JSON['stringify'](_0x5795cb));return rp(_0x5795cb);});}; \ 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 a11c8c4..ab49b92 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 _0xaa7f=['exports','./lib/api'];(function(_0xd6ca7,_0xf8aca2){var _0x5f269f=function(_0x1c58b9){while(--_0x1c58b9){_0xd6ca7['push'](_0xd6ca7['shift']());}};_0x5f269f(++_0xf8aca2);}(_0xaa7f,0xc5));var _0xfaa7=function(_0x368c25,_0x4e1cd8){_0x368c25=_0x368c25-0x0;var _0xe78d2e=_0xaa7f[_0x368c25];return _0xe78d2e;};'use strict';var asr=require(_0xfaa7('0x0'));module[_0xfaa7('0x1')]=function(_0x46246b,_0x387983,_0x1e7f70,_0x2854c2){return asr(_0x46246b,_0x387983,_0x1e7f70,_0x2854c2);}; \ No newline at end of file +var _0xc828=['exports'];(function(_0x2f257e,_0x49af2c){var _0x16293c=function(_0x59f6d9){while(--_0x59f6d9){_0x2f257e['push'](_0x2f257e['shift']());}};_0x16293c(++_0x49af2c);}(_0xc828,0xc6));var _0x8c82=function(_0x851ea9,_0x91259e){_0x851ea9=_0x851ea9-0x0;var _0x214a17=_0xc828[_0x851ea9];return _0x214a17;};'use strict';var asr=require('./lib/api');module[_0x8c82('0x0')]=function(_0x234fef,_0x16ee43,_0x7d250a,_0x43cbac){return asr(_0x234fef,_0x16ee43,_0x7d250a,_0x43cbac);}; \ 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 58d1829..34c19d3 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 _0xe8b1=['terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','bluebird','lodash','moment','crypto','agi','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','stringify','createReadStream','data','send','close','EOS','error','Tilde\x20ASR\x20send\x20error'];(function(_0x51d167,_0x3920de){var _0x1607bf=function(_0x325dc3){while(--_0x325dc3){_0x51d167['push'](_0x51d167['shift']());}};_0x1607bf(++_0x3920de);}(_0xe8b1,0x17a));var _0x1e8b=function(_0x1ed99c,_0x52bb43){_0x1ed99c=_0x1ed99c-0x0;var _0x19c308=_0xe8b1[_0x1ed99c];return _0x19c308;};'use strict';var BPromise=require(_0x1e8b('0x0'));var _=require(_0x1e8b('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x1e8b('0x2'));var crypto=require(_0x1e8b('0x3'));var logger=require('../../../../../../config/logger')(_0x1e8b('0x4'));module[_0x1e8b('0x5')]=function(_0x57e782,_0x1c81a1,_0x31ce64,_0x1f5590){return new BPromise(function(_0x2a804e,_0x32580e){logger[_0x1e8b('0x6')]('Tilde\x20URI',_0x1f5590||_0x1e8b('0x7'));var _0x4d2c61=new WebSocket(_0x1f5590||_0x1e8b('0x7'),{'perMessageDeflate':![]});var _0x38ea3b='';var _0x34996e='0';var _0x35c7ee='1';var _0x52ecfe='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x4c9853(_0x165be4){var _0x46ed5b=crypto[_0x1e8b('0x8')](_0x1e8b('0x9'));_0x46ed5b['update'](_0x165be4);return _0x46ed5b[_0x1e8b('0xa')](_0x1e8b('0xb'));}function _0x4a90cd(){try{logger[_0x1e8b('0x6')](_0x1e8b('0xc'));var _0x3195b3=moment()[_0x1e8b('0xd')]();var _0x414379=_0x4c9853(_0x3195b3+_0x1c81a1+_0x31ce64);_0x4d2c61['send'](JSON[_0x1e8b('0xe')]({'appID':_0x1c81a1,'timestamp':_0x3195b3,'appKey':_0x414379}));var _0x19fd42=fs[_0x1e8b('0xf')](_0x57e782);_0x19fd42['on'](_0x1e8b('0x10'),function(_0x1f55e8){_0x4d2c61[_0x1e8b('0x11')](_0x1f55e8);});_0x19fd42['on'](_0x1e8b('0x12'),function(){_0x4d2c61[_0x1e8b('0x11')](_0x1e8b('0x13'));});}catch(_0x7be64f){logger[_0x1e8b('0x14')](_0x1e8b('0x15'),JSON['stringify'](_0x7be64f));_0x4d2c61[_0x1e8b('0x16')]();}}function _0x14bb51(_0x465ca6){try{if(_0x465ca6){var _0x4c0682=JSON[_0x1e8b('0x17')](_0x465ca6);switch(_0x4c0682[_0x1e8b('0x18')]){case 0x0:if(_0x4c0682[_0x1e8b('0x19')]){if(_0x4c0682[_0x1e8b('0x19')][_0x1e8b('0x1a')]){logger['info'](_0x1e8b('0x1b'),JSON['stringify'](_0x4c0682['result'][_0x1e8b('0x1c')]));_0x38ea3b=_0x4c0682[_0x1e8b('0x19')]['hypotheses'][0x0][_0x1e8b('0x1d')];_0x34996e=_0x4c0682['result']['hypotheses'][0x0][_0x1e8b('0x1e')];_0x35c7ee='0';_0x52ecfe='Success.';_0x4d2c61[_0x1e8b('0x16')]();}}break;case 0x1:logger[_0x1e8b('0x6')](_0x1e8b('0x1f'));_0x35c7ee='1';_0x52ecfe=_0x1e8b('0x1f');break;case 0x2:logger[_0x1e8b('0x6')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x35c7ee='2';_0x52ecfe=_0x1e8b('0x20');break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x35c7ee='9';_0x52ecfe='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x1e8b('0x6')](_0x1e8b('0x21'));_0x35c7ee='10';_0x52ecfe=_0x1e8b('0x21');break;case 0xb:logger[_0x1e8b('0x6')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x35c7ee='11';_0x52ecfe=_0x1e8b('0x22');}}}catch(_0x656a66){logger[_0x1e8b('0x14')](_0x1e8b('0x23'),JSON[_0x1e8b('0xe')](_0x656a66));_0x4d2c61['terminate']();}}function _0x42869a(){logger['info'](_0x1e8b('0x24'));_0x2a804e({'transcript':_0x38ea3b,'confidence':_0x34996e,'status':_0x35c7ee,'status_message':_0x52ecfe});}function _0x10fd43(_0x279484){logger[_0x1e8b('0x14')](_0x1e8b('0x25'));if(!_[_0x1e8b('0x26')](_0x279484)){logger['error'](_[_0x1e8b('0x27')](_0x279484)?JSON['stringify'](_0x279484):_0x279484);}}_0x4d2c61['on']('open',_0x4a90cd);_0x4d2c61['on']('message',_0x14bb51);_0x4d2c61['on'](_0x1e8b('0x12'),_0x42869a);_0x4d2c61['on']('error',_0x10fd43);});}; \ No newline at end of file +var _0xb8f1=['message','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','digest','info','Open\x20Tilde\x20ASR\x20socket','stringify','createReadStream','data','send','close','EOS','error','Tilde\x20ASR\x20send\x20error','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Success.','terminate','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','open'];(function(_0x3d9adc,_0x584c60){var _0xb055d3=function(_0x3f0705){while(--_0x3f0705){_0x3d9adc['push'](_0x3d9adc['shift']());}};_0xb055d3(++_0x584c60);}(_0xb8f1,0x89));var _0x1b8f=function(_0x2e62c1,_0x2469d5){_0x2e62c1=_0x2e62c1-0x0;var _0x123212=_0xb8f1[_0x2e62c1];return _0x123212;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require('crypto');var logger=require('../../../../../../config/logger')('agi');module['exports']=function(_0x511987,_0x2b445f,_0x2f2362,_0x4301d3){return new BPromise(function(_0x31620b,_0x436beb){logger['info'](_0x1b8f('0x0'),_0x4301d3||_0x1b8f('0x1'));var _0x22e81e=new WebSocket(_0x4301d3||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x52b9fc='';var _0xfda19c='0';var _0x5e645c='1';var _0x441217='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x47d8a7(_0x40df1d){var _0x2dc8d3=crypto[_0x1b8f('0x2')](_0x1b8f('0x3'));_0x2dc8d3['update'](_0x40df1d);return _0x2dc8d3[_0x1b8f('0x4')]('hex');}function _0x4c4232(){try{logger[_0x1b8f('0x5')](_0x1b8f('0x6'));var _0x4ca630=moment()['unix']();var _0x1dbd16=_0x47d8a7(_0x4ca630+_0x2b445f+_0x2f2362);_0x22e81e['send'](JSON[_0x1b8f('0x7')]({'appID':_0x2b445f,'timestamp':_0x4ca630,'appKey':_0x1dbd16}));var _0xfe0cb=fs[_0x1b8f('0x8')](_0x511987);_0xfe0cb['on'](_0x1b8f('0x9'),function(_0x343973){_0x22e81e[_0x1b8f('0xa')](_0x343973);});_0xfe0cb['on'](_0x1b8f('0xb'),function(){_0x22e81e[_0x1b8f('0xa')](_0x1b8f('0xc'));});}catch(_0x4dfcf8){logger[_0x1b8f('0xd')](_0x1b8f('0xe'),JSON[_0x1b8f('0x7')](_0x4dfcf8));_0x22e81e['terminate']();}}function _0x3b7f45(_0x4bca53){try{if(_0x4bca53){var _0x1434b2=JSON['parse'](_0x4bca53);switch(_0x1434b2[_0x1b8f('0xf')]){case 0x0:if(_0x1434b2['result']){if(_0x1434b2[_0x1b8f('0x10')][_0x1b8f('0x11')]){logger['info'](_0x1b8f('0x12'),JSON[_0x1b8f('0x7')](_0x1434b2[_0x1b8f('0x10')][_0x1b8f('0x13')]));_0x52b9fc=_0x1434b2['result']['hypotheses'][0x0]['transcript'];_0xfda19c=_0x1434b2['result']['hypotheses'][0x0][_0x1b8f('0x14')];_0x5e645c='0';_0x441217=_0x1b8f('0x15');_0x22e81e[_0x1b8f('0x16')]();}}break;case 0x1:logger[_0x1b8f('0x5')](_0x1b8f('0x17'));_0x5e645c='1';_0x441217=_0x1b8f('0x17');break;case 0x2:logger[_0x1b8f('0x5')](_0x1b8f('0x18'));_0x5e645c='2';_0x441217=_0x1b8f('0x18');break;case 0x9:logger['info'](_0x1b8f('0x19'));_0x5e645c='9';_0x441217=_0x1b8f('0x19');break;case 0xa:logger['info'](_0x1b8f('0x1a'));_0x5e645c='10';_0x441217=_0x1b8f('0x1a');break;case 0xb:logger[_0x1b8f('0x5')](_0x1b8f('0x1b'));_0x5e645c='11';_0x441217=_0x1b8f('0x1b');}}}catch(_0x4cb884){logger['error'](_0x1b8f('0x1c'),JSON['stringify'](_0x4cb884));_0x22e81e[_0x1b8f('0x16')]();}}function _0x263d43(){logger[_0x1b8f('0x5')](_0x1b8f('0x1d'));_0x31620b({'transcript':_0x52b9fc,'confidence':_0xfda19c,'status':_0x5e645c,'status_message':_0x441217});}function _0xa81afe(_0x58b6d8){logger[_0x1b8f('0xd')](_0x1b8f('0x1e'));if(!_[_0x1b8f('0x1f')](_0x58b6d8)){logger[_0x1b8f('0xd')](_['isObject'](_0x58b6d8)?JSON[_0x1b8f('0x7')](_0x58b6d8):_0x58b6d8);}}_0x22e81e['on'](_0x1b8f('0x20'),_0x4c4232);_0x22e81e['on'](_0x1b8f('0x21'),_0x3b7f45);_0x22e81e['on']('close',_0x263d43);_0x22e81e['on']('error',_0xa81afe);});}; \ 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 ec968c1..b9dddc1 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 _0xada7=['./asr'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0xada7,0x120));var _0x7ada=function(_0x120c88,_0x2d7ce4){_0x120c88=_0x120c88-0x0;var _0x447024=_0xada7[_0x120c88];return _0x447024;};var asr=require(_0x7ada('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x5e6c=['exports'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x5e6c,0x1dc));var _0xc5e6=function(_0x5140bf,_0x16bb0c){_0x5140bf=_0x5140bf-0x0;var _0x12dbf0=_0x5e6c[_0x5140bf];return _0x12dbf0;};var asr=require('./asr');module[_0xc5e6('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 39045f3..e063a07 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 _0x2285=['net','events','EventEmitter','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','inherits','exports'];(function(_0x32c78e,_0x32cc40){var _0x5dc750=function(_0x1ff439){while(--_0x1ff439){_0x32c78e['push'](_0x32c78e['shift']());}};_0x5dc750(++_0x32cc40);}(_0x2285,0x177));var _0x5228=function(_0x6ad5d5,_0x1ebdc7){_0x6ad5d5=_0x6ad5d5-0x0;var _0x5c8001=_0x2285[_0x6ad5d5];return _0x5c8001;};'use strict';var util=require('util');var net=require(_0x5228('0x0'));var EventEmitter=require(_0x5228('0x1'))[_0x5228('0x2')];var AGIError=require(_0x5228('0x3'));var AGIChannel=require(_0x5228('0x4'));var AGIServer=function(_0x4f0eae,_0x2cb384,_0x527cb3){var _0x5bf024=this,_0x4f0eae=_0x4f0eae||0x11dd,_0x2cb384=_0x2cb384||_0x5228('0x5'),_0x322927=null,_0x5ef1d3=0x0;EventEmitter[_0x5228('0x6')](_0x5bf024);function _0x192393(){if(!_0x4f0eae){_0x5bf024[_0x5228('0x7')](_0x5228('0x8'),new AGIError(_0x5228('0x9')));return![];}_0x322927=net[_0x5228('0xa')]();_0x322927[_0x5228('0xb')](_0x4f0eae,_0x2cb384);_0x322927['on'](_0x5228('0xc'),function(){_0x5bf024[_0x5228('0x7')]('listening');});_0x322927['on'](_0x5228('0xd'),function(_0x3a7e5){_0x322927[_0x5228('0xe')](function(_0x128f28,_0x594038){if(_0x128f28){_0x5bf024[_0x5228('0x7')](_0x5228('0x8'),new AGIError(_0x5228('0xf'),_0x128f28));}else if(_0x527cb3&&_0x527cb3<0x0){_0x5bf024[_0x5228('0x7')]('error',new AGIError(_0x5228('0x10')));_0x3a7e5[_0x5228('0x11')]();}else if(_0x527cb3&&_0x527cb3>0x0&&_0x527cb3<_0x594038){_0x5ef1d3+=0x1;_0x5bf024[_0x5228('0x7')](_0x5228('0x8'),new AGIError(_0x5228('0x12'),_0x5ef1d3));_0x3a7e5[_0x5228('0x11')]();}else{var _0x4d74d7=new AGIChannel(_0x3a7e5);_0x4d74d7['on'](_0x5228('0x13'),function(){_0x5bf024[_0x5228('0x7')]('connection',_0x4d74d7);});}});});_0x322927['on'](_0x5228('0x8'),function(_0x271e3b){_0x5bf024['emit'](_0x5228('0x8'),new AGIError(_0x5228('0xf'),_0x271e3b[_0x5228('0x14')]));});_0x322927['on'](_0x5228('0x15'),function(){_0x5bf024['emit'](_0x5228('0x15'),new AGIError(_0x5228('0x16')));});}process['nextTick'](function(){_0x192393();});};util[_0x5228('0x17')](AGIServer,EventEmitter);module[_0x5228('0x18')]=function(_0x2bcbd0,_0x47cc51,_0x2dfc47){return new AGIServer(_0x2bcbd0,_0x47cc51,_0x2dfc47);}; \ No newline at end of file +var _0x57cf=['nextTick','inherits','exports','util','net','events','EventEmitter','./error','./channel','error','E_AGI_ARGUMENT_PORT','listening','emit','connection','getConnections','destroy','ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x57cf,0x11b));var _0xf57c=function(_0xcaf223,_0xd39f07){_0xcaf223=_0xcaf223-0x0;var _0x17e00d=_0x57cf[_0xcaf223];return _0x17e00d;};'use strict';var util=require(_0xf57c('0x0'));var net=require(_0xf57c('0x1'));var EventEmitter=require(_0xf57c('0x2'))[_0xf57c('0x3')];var AGIError=require(_0xf57c('0x4'));var AGIChannel=require(_0xf57c('0x5'));var AGIServer=function(_0x42e107,_0x1262b4,_0x41391c){var _0x16d54f=this,_0x42e107=_0x42e107||0x11dd,_0x1262b4=_0x1262b4||'127.0.0.1',_0x4a5d1d=null,_0x12b00f=0x0;EventEmitter['call'](_0x16d54f);function _0x21a69d(){if(!_0x42e107){_0x16d54f['emit'](_0xf57c('0x6'),new AGIError(_0xf57c('0x7')));return![];}_0x4a5d1d=net['createServer']();_0x4a5d1d['listen'](_0x42e107,_0x1262b4);_0x4a5d1d['on'](_0xf57c('0x8'),function(){_0x16d54f[_0xf57c('0x9')](_0xf57c('0x8'));});_0x4a5d1d['on'](_0xf57c('0xa'),function(_0x5f20f2){_0x4a5d1d[_0xf57c('0xb')](function(_0x3e7ca9,_0x224d82){if(_0x3e7ca9){_0x16d54f['emit'](_0xf57c('0x6'),new AGIError('E_AGI_SERVER_ERROR',_0x3e7ca9));}else if(_0x41391c&&_0x41391c<0x0){_0x16d54f[_0xf57c('0x9')](_0xf57c('0x6'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x5f20f2[_0xf57c('0xc')]();}else if(_0x41391c&&_0x41391c>0x0&&_0x41391c<_0x224d82){_0x12b00f+=0x1;_0x16d54f['emit'](_0xf57c('0x6'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x12b00f));_0x5f20f2[_0xf57c('0xc')]();}else{var _0xc56c5=new AGIChannel(_0x5f20f2);_0xc56c5['on'](_0xf57c('0xd'),function(){_0x16d54f[_0xf57c('0x9')](_0xf57c('0xa'),_0xc56c5);});}});});_0x4a5d1d['on'](_0xf57c('0x6'),function(_0x1fb5f5){_0x16d54f[_0xf57c('0x9')]('error',new AGIError(_0xf57c('0xe'),_0x1fb5f5['code']));});_0x4a5d1d['on'](_0xf57c('0xf'),function(){_0x16d54f[_0xf57c('0x9')]('close',new AGIError(_0xf57c('0x10')));});}process[_0xf57c('0x11')](function(){_0x21a69d();});};util[_0xf57c('0x12')](AGIServer,EventEmitter);module[_0xf57c('0x13')]=function(_0x9c27f0,_0x5f2529,_0x3c6e33){return new AGIServer(_0x9c27f0,_0x5f2529,_0x3c6e33);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 3525d01..e66a7bf 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 _0x01b5=['out','audiofile','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','first','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_secret_access_key','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','no\x20key\x20configured','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','context','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','true','false','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','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','ispeechTTS','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','findBy','AGENT\x20%s\x20FOUND\x20BY','success','failure','logout','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20NOT\x20FOUND\x20BY','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','operation','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','indexOf','XMCS-QUEUE','QUEUE','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','\x22%s\x22\x20<%s>','email','user','bcc','service','host','port','secure','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','Enter\x20in\x20START\x20(%s)\x20block','yes','Answer','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','agi://%s/square,\x22%s\x22,\x22%s\x22','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','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','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','path','util','lodash','shelljs','odbc','randomstring','mustache','request-promise','../../config/logger','agi','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','then','name','getVoiceQueue','getVoiceQueueById','catch','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','IntervalId','interval','map','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','info','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','extension','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','scheduledAt','callback','Callback\x20scheduled\x20at\x20','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','agentLogin','shellCommand','exec','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','googleTTS','google_tts_language','method','timeout','PUT','toUpperCase','rawBody','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','url','headers','render','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','options','googleDialogflow','key','sestekNDA','ispeech_tts_language','ispeechASR','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_polly_region','Amy','awsLex','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','clear','clone','hasOwnProperty','isString','includes','recursiveNodeIndex','isArray','replaceAllVariables','saveRestApiResult','isPlainObject','%s.%s','length','setVariable','replaceObjectAllVariables','stringify','split','replaceAll','extra','toString','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','isConfigured','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','result','mrcprecog','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_INSTANCE','command','args','Wait\x20%s\x20seconds\x20before\x20answer','wait','answer','list_id','delay','add','minutes','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','query','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','sip_id','DIAL','SIP/%s','opts','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','Dialogflow\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','password','no\x20password\x20configured'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x01b5,0xca));var _0x501b=function(_0x43b96b,_0x3bc895){_0x43b96b=_0x43b96b-0x0;var _0x3f6e99=_0x01b5[_0x43b96b];return _0x3f6e99;};'use strict';var fs=require('fs');var path=require(_0x501b('0x0'));var util=require(_0x501b('0x1'));var _=require(_0x501b('0x2'));var sh=require(_0x501b('0x3'));var odbc=require(_0x501b('0x4'))();var rs=require(_0x501b('0x5'));var moment=require('moment');var Mustache=require(_0x501b('0x6'));var rp=require(_0x501b('0x7'));var logger=require(_0x501b('0x8'))(_0x501b('0x9'));var config=require('../../config/environment');var scripts=require(_0x501b('0xa'));var FILES_PATH=_0x501b('0xb');var recursiveMapAttributes=[_0x501b('0xc'),'rawBody'];var verticesWithRetry=[_0x501b('0xd'),_0x501b('0xe'),_0x501b('0xf')];var AGIVertices=function(_0x4c0526,_0x1e06cd,_0x444bc3){this[_0x501b('0x10')]=_0x4c0526;this[_0x501b('0x11')]=_0x1e06cd;this[_0x501b('0x12')]=_0x444bc3;};AGIVertices[_0x501b('0x13')][_0x501b('0x14')]=function(_0x316a7e,_0x1bf904){this['rpc']['getVariableById'](_0x316a7e)[_0x501b('0x15')](function(_0x2c3191){_0x1bf904(null,_0x2c3191?_0x2c3191[_0x501b('0x16')]:![]);})['catch'](function(_0x425c63){_0x1bf904(_0x425c63);});};AGIVertices[_0x501b('0x13')][_0x501b('0x17')]=function(_0x257452,_0x31ee8e){this[_0x501b('0x11')][_0x501b('0x18')](_0x257452)[_0x501b('0x15')](function(_0x46c6c3){_0x31ee8e(null,_0x46c6c3?_0x46c6c3[_0x501b('0x16')]:![]);})[_0x501b('0x19')](function(_0x11d417){_0x31ee8e(_0x11d417);});};AGIVertices[_0x501b('0x13')][_0x501b('0x1a')]=function(_0x4bf03e,_0x5547d9){this[_0x501b('0x11')][_0x501b('0x1b')](_0x4bf03e)['then'](function(_0x1554b0){_0x5547d9(null,_0x1554b0?_0x1554b0['name']:![]);})[_0x501b('0x19')](function(_0x4f0b3b){_0x5547d9(_0x4f0b3b);});};AGIVertices[_0x501b('0x13')][_0x501b('0x1c')]=function(_0x88a27c,_0x38f904){this[_0x501b('0x11')][_0x501b('0x1d')](_0x88a27c)[_0x501b('0x15')](function(_0x1b6e06){_0x38f904(null,_0x1b6e06?_0x1b6e06['dsn']:![]);})['catch'](function(_0x574386){_0x38f904(_0x574386);});};AGIVertices['prototype'][_0x501b('0x1e')]=function(_0x4c2461,_0x2a9802){this[_0x501b('0x11')][_0x501b('0x1f')](_0x4c2461)['then'](function(_0x74bd33){_0x2a9802(null,_0x74bd33?_0x74bd33[_0x501b('0x16')]:![]);})[_0x501b('0x19')](function(_0x11a0b3){_0x2a9802(_0x11a0b3);});};AGIVertices['prototype'][_0x501b('0x20')]=function(_0x554a68,_0x1b29a2){this[_0x501b('0x11')][_0x501b('0x21')](_0x554a68)['then'](function(_0x40a19d){_0x1b29a2(null,_0x40a19d?_0x40a19d[_0x501b('0x16')]:![]);})['catch'](function(_0x1eec86){_0x1b29a2(_0x1eec86);});};AGIVertices[_0x501b('0x13')][_0x501b('0x22')]=function(_0x21f4de,_0x5b170b){var _0x205269=this;this[_0x501b('0x11')][_0x501b('0x23')](_0x21f4de)['then'](function(_0x31e108){_0x5b170b(null,_0x31e108?_0x205269[_0x501b('0x24')](_0x31e108[_0x501b('0x25')]):![]);})[_0x501b('0x19')](function(_0xc0172a){_0x5b170b(_0xc0172a);});};AGIVertices['prototype'][_0x501b('0x26')]=function(_0x22fabd,_0x3e31fd){this['rpc'][_0x501b('0x27')](_0x22fabd)[_0x501b('0x15')](function(_0x3395b1){_0x3e31fd(null,_0x3395b1?_0x3395b1:![]);})[_0x501b('0x19')](function(_0x148d8b){_0x3e31fd(_0x148d8b);});};AGIVertices['prototype']['sendMailMessage']=function(_0x154902,_0x2dbf9b,_0x4372fa){this[_0x501b('0x12')][_0x501b('0x28')](_0x154902,_0x2dbf9b)['then'](function(){_0x4372fa(null);})[_0x501b('0x19')](function(_0x10769d){_0x4372fa(_0x10769d);});};AGIVertices[_0x501b('0x13')]['getIntervals']=function(_0x43b144,_0x337f5a){this[_0x501b('0x11')]['getIntervalById'](_0x43b144)[_0x501b('0x15')](function(_0x326c5c){if(_0x326c5c){if(_0x326c5c[_0x501b('0x29')]){_0x337f5a(null,[_0x326c5c[_0x501b('0x2a')]]);}else{_0x337f5a(null,_[_0x501b('0x2b')](_0x326c5c['Intervals'],'interval'));}}else{_0x337f5a(null,![]);}})[_0x501b('0x19')](function(_0x1a08d5){_0x337f5a(_0x1a08d5);});};AGIVertices[_0x501b('0x13')]['getSoundPath']=function(_0x1e81a8){return util[_0x501b('0x2c')](_0x501b('0x2d'),FILES_PATH,_0x1e81a8);};AGIVertices['prototype'][_0x501b('0x2e')]=function(_0x301372,_0x4619bf,_0x66f556){odbc[_0x501b('0x2f')](_0x301372,function(_0x3493a0){if(_0x3493a0){logger[_0x501b('0x30')](_0x501b('0x31'),_0x3493a0);_0x66f556(_0x3493a0);}else{logger['info'](_0x501b('0x32'));odbc['query'](_0x4619bf,function(_0x16e73a,_0x5ada01){if(_0x16e73a){logger['info'](_0x501b('0x33'),_0x4619bf);_0x66f556(_0x16e73a);}else{logger[_0x501b('0x34')](_0x501b('0x35'),_0x4619bf);odbc[_0x501b('0x36')](function(_0xb18d47){if(_0xb18d47){logger[_0x501b('0x30')](_0x501b('0x37'),_0xb18d47);}_0x66f556(null,_0x5ada01);});}});}});};AGIVertices[_0x501b('0x13')][_0x501b('0x38')]=function(_0x448a58,_0x5b6926){this[_0x501b('0x11')][_0x501b('0x39')](_0x448a58)[_0x501b('0x15')](function(_0x5609de){_0x5b6926(null,_0x5609de?_0x5609de:![]);})['catch'](function(_0x17eade){_0x5b6926(_0x17eade);});};AGIVertices[_0x501b('0x13')]['createSmsMessage']=function(_0x281318,_0x485c73){this[_0x501b('0x11')][_0x501b('0x3a')](_0x281318)[_0x501b('0x15')](function(_0x4efcba){_0x485c73(null,_0x4efcba);})[_0x501b('0x19')](function(_0x267140){_0x485c73(_0x267140);});};AGIVertices[_0x501b('0x13')][_0x501b('0x3b')]=function(_0x4cd237,_0x304a90,_0x2e7e65){this[_0x501b('0x11')][_0x501b('0x3b')]({'uniqueid':this['channel'][_0x501b('0x3c')],'node':_0x4cd237[_0x501b('0x3d')],'application':_0x4cd237[_0x501b('0x3e')],'data':_0x304a90||null,'project_name':this[_0x501b('0x10')][_0x501b('0x3f')],'callerid':this[_0x501b('0x10')][_0x501b('0x40')]})[_0x501b('0x15')](function(_0x520eac){if(_0x2e7e65){_0x2e7e65(null,_0x520eac);}})['catch'](function(_0x5f0b4a){if(_0x2e7e65){_0x2e7e65(_0x5f0b4a);}});};AGIVertices[_0x501b('0x13')][_0x501b('0x41')]=function(_0x221ac5,_0x40d4e6,_0x4bacf3,_0x37e6cd){this[_0x501b('0x11')][_0x501b('0x41')]({'uniqueid':this[_0x501b('0x10')][_0x501b('0x3c')],'callerid':this[_0x501b('0x10')][_0x501b('0x40')],'calleridname':this[_0x501b('0x10')][_0x501b('0x42')],'context':this[_0x501b('0x10')]['context'],'extension':this[_0x501b('0x10')][_0x501b('0x43')],'priority':this[_0x501b('0x10')]['priority'],'accountcode':this[_0x501b('0x10')]['accountcode'],'dnid':this['channel'][_0x501b('0x44')],'projectName':this[_0x501b('0x10')][_0x501b('0x3f')],'saveName':_0x40d4e6,'filename':_0x221ac5[_0x501b('0x45')]||_0x40d4e6,'savePath':_0x4bacf3})['then'](function(_0xb49c4e){_0x37e6cd(null,_0xb49c4e);})[_0x501b('0x19')](function(_0x128ea3){_0x37e6cd(_0x128ea3);});};AGIVertices[_0x501b('0x13')]['createSquareMessage']=function(_0x53da17,_0x32e47a,_0x33047a){this[_0x501b('0x11')][_0x501b('0x46')]({'uniqueid':this[_0x501b('0x10')][_0x501b('0x3c')],'body':_0x53da17,'direction':_0x32e47a})['then'](function(_0x1f12c8){if(_0x33047a){_0x33047a(null,_0x1f12c8);}})['catch'](function(_0x4da2bc){if(_0x33047a){_0x33047a(_0x4da2bc);}});};AGIVertices['prototype'][_0x501b('0x47')]=function(_0x168920,_0x443656){this['rpc']['createCmContact']({'firstName':_[_0x501b('0x48')](_0x168920[_0x501b('0x16')])||_[_0x501b('0x49')](_0x168920['name'])?_0x501b('0x4a')+Math[_0x501b('0x4b')]():_0x168920[_0x501b('0x16')],'lastName':_[_0x501b('0x48')](_0x168920['lastName'])||_[_0x501b('0x49')](_0x168920[_0x501b('0x4c')])?null:_0x168920[_0x501b('0x4c')],'phone':_0x168920[_0x501b('0x4d')],'ListId':_0x168920['list_id'],'scheduledat':_0x168920[_0x501b('0x4e')],'callbackUniqueid':this[_0x501b('0x10')]['uniqueid'],'tags':_0x501b('0x4f'),'description':_0x501b('0x50')+_0x168920[_0x501b('0x4e')]['toString'](),'priority':_0x168920[_0x501b('0x51')]})[_0x501b('0x15')](function(_0x34d5d7){_0x443656(null,_0x34d5d7);})[_0x501b('0x19')](function(_0x4184df){_0x443656(_0x4184df);});};AGIVertices['prototype'][_0x501b('0x52')]=function(_0x48a7f9,_0x1d77db){this['rpc'][_0x501b('0x53')](_0x48a7f9)[_0x501b('0x15')](function(_0x4b93c2){_0x1d77db(null,_0x4b93c2?_0x4b93c2[_0x501b('0x16')]:![]);})[_0x501b('0x19')](function(_0xb02b08){_0x1d77db(_0xb02b08);});};AGIVertices[_0x501b('0x13')][_0x501b('0x54')]=function(_0x379fa4,_0x16eee7,_0x4bc399){var _0x1e9639={'role':_0x501b('0x55')};_0x1e9639[_0x379fa4]=this['channel']['callerid'];this[_0x501b('0x11')][_0x501b('0x54')](_0x1e9639,_0x16eee7,this[_0x501b('0x10')][_0x501b('0x3c')])[_0x501b('0x15')](function(_0x35008b){_0x4bc399(null,_[_0x501b('0x49')](_0x35008b)?![]:!![]);})[_0x501b('0x19')](function(_0x4eb8c6){logger[_0x501b('0x30')](_0x4eb8c6);_0x4bc399(null,![]);});};AGIVertices[_0x501b('0x13')]['agentUnpause']=function(_0x2c6f93,_0x1d68e9){var _0x182ca4={'role':_0x501b('0x55')};_0x182ca4[_0x2c6f93]=this[_0x501b('0x10')][_0x501b('0x40')];this[_0x501b('0x11')][_0x501b('0x56')](_0x182ca4)[_0x501b('0x15')](function(_0x1ee5df){_0x1d68e9(null,_[_0x501b('0x49')](_0x1ee5df)?![]:!![]);})[_0x501b('0x19')](function(_0x1eb230){logger['error'](_0x1eb230);_0x1d68e9(null,![]);});};AGIVertices['prototype'][_0x501b('0x57')]=function(_0x4db6f4,_0x49001b){var _0x1f5f7b={'role':_0x501b('0x55')};_0x1f5f7b[_0x4db6f4]=this['channel']['callerid'];this['rpc'][_0x501b('0x57')](_0x1f5f7b)[_0x501b('0x15')](function(_0x5c3184){_0x49001b(null,_[_0x501b('0x49')](_0x5c3184)?![]:!![]);})[_0x501b('0x19')](function(_0x3bcbb5){logger[_0x501b('0x30')](_0x3bcbb5);_0x49001b(null,![]);});};AGIVertices[_0x501b('0x13')]['agentLogin']=function(_0x2df48e,_0x5d8f57){var _0x19052b={'role':_0x501b('0x55')};_0x19052b[_0x2df48e]=this[_0x501b('0x10')]['callerid'];var _0x160fdf=_0x2df48e!=_0x501b('0x58')?util[_0x501b('0x2c')](_0x501b('0x59'),'LOCAL',this[_0x501b('0x10')]['callerid']):undefined;this[_0x501b('0x11')][_0x501b('0x5a')](_0x19052b,_0x160fdf)['then'](function(_0x2907ac){_0x5d8f57(null,_[_0x501b('0x49')](_0x2907ac)?![]:!![]);})['catch'](function(_0x5b57a9){logger[_0x501b('0x30')](_0x5b57a9);_0x5d8f57(null,![]);});};AGIVertices['prototype'][_0x501b('0x5b')]=function(_0x34a4c6,_0x40eb44){sh[_0x501b('0x5c')](_['trim'](_0x34a4c6),function(_0x32dd4b,_0x553eef){var _0x443c8d=_0x553eef[_0x501b('0x5d')](/(\r\n|\n|\r)/gm,'');_0x40eb44(null,_0x443c8d);});};AGIVertices[_0x501b('0x13')][_0x501b('0x5e')]=function(_0x25fec1,_0x52e10a){scripts[_0x501b('0x5e')](_0x25fec1[_0x501b('0x5f')],_0x25fec1[_0x501b('0x60')]||_0x501b('0x61'),_0x25fec1[_0x501b('0x61')],_0x25fec1[_0x501b('0x62')]||_0x501b('0x63'),_0x25fec1[_0x501b('0x64')]||_0x501b('0x65'),_0x25fec1[_0x501b('0x66')]||'MP3')[_0x501b('0x15')](function(_0x443a61){_0x52e10a(null,_0x443a61);})[_0x501b('0x19')](function(_0x20421e){_0x52e10a(_0x20421e);});};AGIVertices['prototype'][_0x501b('0x67')]=function(_0x864434,_0x22440e){scripts['googleTTS'](_0x864434[_0x501b('0x61')],_0x864434[_0x501b('0x68')]||'en',0x1)[_0x501b('0x15')](function(_0x34ce26){_0x22440e(null,_0x34ce26);})['catch'](function(_0x1eb94e){_0x22440e(_0x1eb94e);});};AGIVertices[_0x501b('0x13')]['restAPI']=function(_0x4f70d1,_0x1528c7){var _0x52bb7b={'uri':_0x4f70d1['url'],'method':_0x4f70d1[_0x501b('0x69')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x4f70d1['timeout'])==='number'&&parseInt(_0x4f70d1[_0x501b('0x6a')])>=0x1?parseInt(_0x4f70d1[_0x501b('0x6a')])*0x3e8:0x5*0x3e8};if(_['includes'](['POST',_0x501b('0x6b')],_0x52bb7b[_0x501b('0x69')][_0x501b('0x6c')]())){try{_0x52bb7b['body']=_0x4f70d1[_0x501b('0x6d')]?JSON['parse'](_0x4f70d1[_0x501b('0x6d')]):{};}catch(_0x4453f3){logger[_0x501b('0x30')](_0x501b('0x6e'),_0x4453f3);}}try{_0x52bb7b['headers']=_0x4f70d1['rawHeaders']?JSON[_0x501b('0x6f')](_0x4f70d1[_0x501b('0xc')]):{};}catch(_0x5c0010){logger[_0x501b('0x30')](_0x501b('0x70'),_0x5c0010);}if(_0x4f70d1[_0x501b('0x71')]){try{var _0xbe13e4=require(_0x4f70d1[_0x501b('0x71')])[_0x501b('0x72')](this,_0x52bb7b);_0x52bb7b[_0x501b('0x73')]=Mustache['render'](_0x4f70d1[_0x501b('0x74')],_0xbe13e4,{},['$$','$$']);if(_0x52bb7b[_0x501b('0x75')]){_0x52bb7b[_0x501b('0x75')]=JSON[_0x501b('0x6f')](Mustache[_0x501b('0x76')](JSON['stringify'](_0x52bb7b[_0x501b('0x75')]),_0xbe13e4,{},['$$','$$']));}if(_0x52bb7b[_0x501b('0x77')]){_0x52bb7b['body']=JSON['parse'](Mustache[_0x501b('0x76')](JSON['stringify'](_0x52bb7b[_0x501b('0x77')]),_0xbe13e4,{},['$$','$$']));}}catch(_0x2de008){logger[_0x501b('0x30')](_0x501b('0x78'),_0x2de008);}}rp(_0x52bb7b)[_0x501b('0x15')](function(_0x59dc24){var _0x3c6f86={'statusCode':_0x59dc24[_0x501b('0x79')]||0xc8,'statusMessage':_0x59dc24[_0x501b('0x7a')]||'OK','headers':_0x59dc24[_0x501b('0x75')]||{},'body':_0x59dc24[_0x501b('0x77')]||{}};_0x1528c7(null,_0x3c6f86);})[_0x501b('0x19')](function(_0x425052){var _0x145b5c={'statusCode':_0x425052['statusCode']||0x1f4,'statusMessage':_0x425052['message']||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x425052[_0x501b('0x7b')][_0x501b('0x75')]||{},'body':_0x425052[_0x501b('0x7b')]['body']||{}};_0x1528c7(null,_0x145b5c);});};AGIVertices['prototype']['googleDialogflow']=function(_0x13bb5f,_0x129b11){scripts[_0x501b('0x7c')](this[_0x501b('0x10')][_0x501b('0x3c')],_0x13bb5f[_0x501b('0x7d')],_0x13bb5f['text'],_0x13bb5f['dialogflow_language']||'en')[_0x501b('0x15')](function(_0x254aa6){_0x129b11(null,_0x254aa6);})[_0x501b('0x19')](function(_0x12b9cf){_0x129b11(_0x12b9cf);});};AGIVertices['prototype'][_0x501b('0x7e')]=function(_0x195b94,_0x21e535){scripts[_0x501b('0x7e')](this[_0x501b('0x10')],_0x195b94)[_0x501b('0x15')](function(_0x4d3c94){_0x21e535(null,_0x4d3c94);})[_0x501b('0x19')](function(_0x3b4386){_0x21e535(_0x3b4386);});};AGIVertices[_0x501b('0x13')]['ispeechTTS']=function(_0x37d633,_0xac8f2a){scripts['ispeechTTS'](_0x37d633['key'],_0x37d633[_0x501b('0x61')],_0x37d633[_0x501b('0x7f')]||_0x501b('0x63'),_0x37d633['speed'])[_0x501b('0x15')](function(_0x95d84f){_0xac8f2a(null,_0x95d84f);})[_0x501b('0x19')](function(_0x1de687){_0xac8f2a(_0x1de687);});};AGIVertices['prototype'][_0x501b('0x80')]=function(_0x135cb2,_0x2ee46d,_0x4c39ce){scripts[_0x501b('0x80')](_0x2ee46d,_0x135cb2[_0x501b('0x7d')],_0x135cb2[_0x501b('0x81')]||'en-US',this['isConfigured'](_0x135cb2[_0x501b('0x82')])?_0x135cb2['model']:undefined)[_0x501b('0x15')](function(_0x1cb38a){_0x4c39ce(null,_0x1cb38a);})[_0x501b('0x19')](function(_0x153707){_0x4c39ce(_0x153707);});};AGIVertices[_0x501b('0x13')][_0x501b('0x83')]=function(_0x2c4a5d,_0x5b9f0){scripts[_0x501b('0x83')](_0x2c4a5d[_0x501b('0x84')],_0x2c4a5d['aws_secret_access_key'],_0x2c4a5d[_0x501b('0x85')],_0x2c4a5d['aws_polly_voice']||_0x501b('0x86'),_0x2c4a5d[_0x501b('0x61')],_0x2c4a5d['aws_text_type']||_0x501b('0x61'))[_0x501b('0x15')](function(_0x2646d7){_0x5b9f0(null,_0x2646d7);})[_0x501b('0x19')](function(_0x4b4d42){_0x5b9f0(_0x4b4d42);});};AGIVertices['prototype'][_0x501b('0x87')]=function(_0x3a2e92,_0x3516dc){scripts[_0x501b('0x87')](this[_0x501b('0x10')][_0x501b('0x3c')],_0x3a2e92[_0x501b('0x84')],_0x3a2e92['aws_secret_access_key'],_0x3a2e92['aws_lex_region'],_0x3a2e92[_0x501b('0x61')],_0x3a2e92[_0x501b('0x88')])['then'](function(_0x5f1779){_0x3516dc(null,_0x5f1779);})[_0x501b('0x19')](function(_0x23bea4){_0x3516dc(_0x23bea4);});};AGIVertices[_0x501b('0x13')][_0x501b('0x89')]=function(_0x20ddb0,_0x4b6b1a,_0x38e8a1){scripts[_0x501b('0x89')](_0x4b6b1a,_0x20ddb0[_0x501b('0x7d')],_0x20ddb0[_0x501b('0x8a')]||_0x501b('0x63'))[_0x501b('0x15')](function(_0x2599a3){_0x38e8a1(null,_0x2599a3);})[_0x501b('0x19')](function(_0x4db3d8){_0x38e8a1(_0x4db3d8);});};AGIVertices['prototype']['tildeASR']=function(_0x119edb,_0x19b1da,_0x3c2ccc){scripts[_0x501b('0x8b')](_0x19b1da,_0x119edb['appid'],_0x119edb[_0x501b('0x8c')],_0x119edb['uri'])[_0x501b('0x15')](function(_0x589e97){_0x3c2ccc(null,_0x589e97);})[_0x501b('0x19')](function(_0x4de7f7){_0x3c2ccc(_0x4de7f7);});};AGIVertices[_0x501b('0x13')][_0x501b('0x8d')]=function(_0x5f0b61){var _0x1d76af=_['includes'](verticesWithRetry,_0x5f0b61[_0x501b('0x3e')])?_0x5f0b61:_[_0x501b('0x8e')](_0x5f0b61);for(var _0x4ad8a7 in _0x1d76af){if(_0x1d76af[_0x501b('0x8f')](_0x4ad8a7)){if(_0x1d76af[_0x4ad8a7]&&_[_0x501b('0x90')](_0x1d76af[_0x4ad8a7])){if(_[_0x501b('0x91')](recursiveMapAttributes,_0x4ad8a7)){_0x1d76af[_0x4ad8a7]=this['replaceObjectAllVariables'](_0x1d76af[_0x4ad8a7]);}else{_0x1d76af[_0x4ad8a7]=this['replaceAllVariables'](_0x1d76af[_0x4ad8a7]);}}}}return _0x1d76af;};AGIVertices[_0x501b('0x13')]['recursiveNodeIndex']=function(_0x11580b){for(var _0x50be02 in _0x11580b){if(_0x11580b[_0x501b('0x8f')](_0x50be02)){if(_['isPlainObject'](_0x11580b[_0x50be02])){this[_0x501b('0x92')](_0x11580b[_0x50be02]);}else if(_[_0x501b('0x93')](_0x11580b[_0x50be02])){for(var _0x141c48=0x0;_0x141c48<_0x11580b[_0x50be02]['length'];_0x141c48++){this[_0x501b('0x92')](_0x11580b[_0x50be02][_0x141c48]);}}else if(_[_0x501b('0x90')](_0x11580b[_0x50be02])){_0x11580b[_0x50be02]=this[_0x501b('0x94')](_0x11580b[_0x50be02]);}}}};AGIVertices[_0x501b('0x13')][_0x501b('0x95')]=function(_0x50062f,_0x311c93){for(var _0x37e1b2 in _0x50062f){if(_0x50062f['hasOwnProperty'](_0x37e1b2)){if(_[_0x501b('0x96')](_0x50062f[_0x37e1b2])){if(!_['isEmpty'](_0x50062f[_0x37e1b2])){this[_0x501b('0x95')](_0x50062f[_0x37e1b2],util['format'](_0x501b('0x97'),_0x311c93,_0x37e1b2));}}else if(_[_0x501b('0x93')](_0x50062f[_0x37e1b2])){for(var _0x26590f=0x0;_0x26590f<_0x50062f[_0x37e1b2][_0x501b('0x98')];_0x26590f++){this[_0x501b('0x95')](_0x50062f[_0x37e1b2][_0x26590f],util[_0x501b('0x2c')](_0x501b('0x97'),_0x311c93,_0x37e1b2+'['+_0x26590f+']'));}}else{if(!_[_0x501b('0x49')](_0x50062f[_0x37e1b2])){this[_0x501b('0x10')][_0x501b('0x99')](util[_0x501b('0x2c')](_0x501b('0x97'),_0x311c93,_0x37e1b2),_0x50062f[_0x37e1b2]);}}}}};AGIVertices['prototype'][_0x501b('0x9a')]=function(_0x21e71b){try{var _0x2ffa8e=JSON[_0x501b('0x6f')](_0x21e71b);this[_0x501b('0x92')](_0x2ffa8e);return JSON[_0x501b('0x9b')](_0x2ffa8e);}catch(_0x205d8b){return this['replaceAllVariables'](_0x21e71b);}};AGIVertices['prototype'][_0x501b('0x94')]=function(_0x860aca){var _0x2cb030=_0x860aca[_0x501b('0x9c')]('{');for(var _0x144c27=0x1;_0x144c27<_0x2cb030[_0x501b('0x98')];_0x144c27+=0x1){var _0x4210a6=_0x2cb030[_0x144c27][_0x501b('0x9c')]('}');if(_0x4210a6['length']>0x1){_0x860aca=_0x860aca[_0x501b('0x9d')]('{'+_0x4210a6[0x0]+'}',this[_0x501b('0x10')][_0x501b('0x14')](_0x4210a6[0x0])[_0x501b('0x9e')]||_0x4210a6[0x0]);}}if(_0x2cb030[_0x501b('0x98')]===0x1){return _0x860aca[_0x501b('0x9f')]();}return this['replaceAllVariables'](_0x860aca);};AGIVertices[_0x501b('0x13')][_0x501b('0xa0')]=function(_0x49c128,_0x1e61b4){var _0x5813f1=this[_0x501b('0x10')][_0x501b('0x14')](_0x49c128);if(_0x5813f1['result']===-0x1){return _0x5813f1;}logger['info'](util[_0x501b('0x2c')](_0x501b('0xa1'),_0x1e61b4,_0x5813f1['extra']));return this[_0x501b('0x10')][_0x501b('0x99')](_0x1e61b4,_0x5813f1[_0x501b('0x9e')]);};AGIVertices[_0x501b('0x13')][_0x501b('0xa2')]=function(_0x36ee71){return _0x36ee71&&_0x36ee71!=='0'&&_0x36ee71!=='-1'&&_0x36ee71!=='';};AGIVertices[_0x501b('0x13')][_0x501b('0xa3')]=function(_0x3c7051){this[_0x501b('0x3b')]['sync'](this,_0x3c7051,'-');_0x3c7051[_0x501b('0xa4')]=_0x3c7051[_0x501b('0xa3')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x501b('0x13')]['mrcpsynth']=function(_0x4a88b3){logger['info'](util[_0x501b('0x2c')](_0x501b('0xa5'),_0x4a88b3[_0x501b('0x3d')]));if(!this[_0x501b('0xa2')](_0x4a88b3[_0x501b('0x61')])){return this['channel'][_0x501b('0xa6')](_0x501b('0xa7'));}var _0x332b3a='\x22'+_0x4a88b3['text']+'\x22';if(this[_0x501b('0xa2')](_0x4a88b3[_0x501b('0x7b')])){_0x332b3a+=','+_0x4a88b3[_0x501b('0x7b')];}var _0x21a0b1=this[_0x501b('0x10')][_0x501b('0x5c')](_0x501b('0xa8'),_0x332b3a);if(_0x21a0b1[_0x501b('0xa9')]===-0x1){return _0x21a0b1;}return this[_0x501b('0x10')][_0x501b('0xa6')](util[_0x501b('0x2c')]('Executed\x20command\x20MRCPSynth\x20%s',_0x332b3a));};AGIVertices[_0x501b('0x13')][_0x501b('0xaa')]=function(_0x3f25d4){logger['info'](util[_0x501b('0x2c')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x3f25d4[_0x501b('0x3d')]));if(!this[_0x501b('0xa2')](_0x3f25d4[_0x501b('0xab')])){return this['channel'][_0x501b('0xa6')](_0x501b('0xac'));}var _0x75ee42=_0x3f25d4[_0x501b('0xab')];if(this[_0x501b('0xa2')](_0x3f25d4['options'])){_0x75ee42+=','+_0x3f25d4[_0x501b('0x7b')];}var _0x340441=this[_0x501b('0x10')][_0x501b('0x5c')](_0x501b('0xad'),_0x75ee42);if(_0x340441[_0x501b('0xa9')]===-0x1){return _0x340441;}var _0x537d8c=this[_0x501b('0xa0')](_0x501b('0xae'),_0x501b('0xaf'));if(_0x537d8c[_0x501b('0xa9')]===-0x1){return _0x537d8c;}var _0x5270b0=this[_0x501b('0xa0')](_0x501b('0xb0'),'MRCP_RECOG_TRANSCRIPT');if(_0x5270b0['result']===-0x1){return _0x5270b0;}var _0x19c955=this[_0x501b('0xa0')]('RECOG_INSTANCE()',_0x501b('0xb1'));if(_0x19c955[_0x501b('0xa9')]===-0x1){return _0x19c955;}return this['channel'][_0x501b('0xa6')](util[_0x501b('0x2c')]('Executed\x20command\x20MRCPRecog\x20%s',_0x75ee42));};AGIVertices[_0x501b('0x13')]['agi']=function(_0x143cb8){logger[_0x501b('0x34')](util['format']('Enter\x20in\x20AGI\x20(%s)\x20block',_0x143cb8[_0x501b('0x3d')]));return this['channel'][_0x501b('0x9')]([_0x143cb8[_0x501b('0xb2')],_0x143cb8[_0x501b('0xb3')]]);};AGIVertices[_0x501b('0x13')]['answer']=function(_0xda5e6e){logger['info'](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0xda5e6e[_0x501b('0x3d')]));if(this[_0x501b('0xa2')](_0xda5e6e['timeout'])){logger['info'](util[_0x501b('0x2c')](_0x501b('0xb4'),_0xda5e6e[_0x501b('0x6a')]));var _0x2cb220=this[_0x501b('0x10')][_0x501b('0xb5')](_0xda5e6e[_0x501b('0x6a')]);if(_0x2cb220[_0x501b('0xa9')]===-0x1){return _0x2cb220;}}return this[_0x501b('0x10')][_0x501b('0xb6')]();};AGIVertices['prototype']['callback']=function(_0xf8371d){logger[_0x501b('0x34')](util[_0x501b('0x2c')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0xf8371d[_0x501b('0x3d')]));if(!this['isConfigured'](_0xf8371d[_0x501b('0xb7')])){return this[_0x501b('0x10')]['error'](_0xf8371d,'no\x20list\x20selected');}_0xf8371d[_0x501b('0x4e')]=moment();if(this[_0x501b('0xa2')](_0xf8371d[_0x501b('0xb8')])){_0xf8371d['scheduledAt']=moment()[_0x501b('0xb9')](_0xf8371d['delay'],_0x501b('0xba'));}if(!this[_0x501b('0xa2')](_0xf8371d[_0x501b('0x51')])){_0xf8371d[_0x501b('0x51')]=0x2;}this[_0x501b('0x47')][_0x501b('0x72')](this,_0xf8371d);return this['channel'][_0x501b('0xa6')](util[_0x501b('0x2c')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0xf8371d[_0x501b('0x4d')],_0xf8371d[_0x501b('0xb7')],_0xf8371d[_0x501b('0x4e')]));};AGIVertices[_0x501b('0x13')]['custom_app']=function(_0x495004){logger[_0x501b('0x34')](util['format'](_0x501b('0xbb'),_0x495004[_0x501b('0x3d')]));var _0x21e37b=this[_0x501b('0x10')][_0x501b('0x5c')](_0x495004[_0x501b('0xbc')],_0x495004[_0x501b('0x7b')]);if(_0x21e37b[_0x501b('0xa9')]===-0x1){return _0x21e37b;}return this[_0x501b('0x10')][_0x501b('0xa6')](util[_0x501b('0x2c')](_0x501b('0xbd'),_0x495004[_0x501b('0xbc')],_0x495004[_0x501b('0x7b')]));};AGIVertices[_0x501b('0x13')][_0x501b('0xbe')]=function(_0x32553e){logger[_0x501b('0x34')](util[_0x501b('0x2c')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x32553e['label']));if(!this[_0x501b('0xa2')](_0x32553e[_0x501b('0x61')])){return this[_0x501b('0x10')][_0x501b('0xa6')](_0x501b('0xa7'));}var _0x5de2a8='\x22'+_0x32553e[_0x501b('0x61')]+'\x22';if(this[_0x501b('0xa2')](_0x32553e[_0x501b('0x7b')])){_0x5de2a8+=','+_0x32553e[_0x501b('0x7b')];}var _0xd6320d=this['channel'][_0x501b('0x5c')](_0x501b('0xa8'),_0x5de2a8);if(_0xd6320d[_0x501b('0xa9')]===-0x1){return _0xd6320d;}return this[_0x501b('0x10')][_0x501b('0xa6')](util[_0x501b('0x2c')](_0x501b('0xbf'),_0x5de2a8));};AGIVertices[_0x501b('0x13')][_0x501b('0xc0')]=function(_0x4f1a5a){logger['info'](util[_0x501b('0x2c')](_0x501b('0xc1'),_0x4f1a5a['label']));if(!this[_0x501b('0xa2')](_0x4f1a5a[_0x501b('0x61')])){return this[_0x501b('0x10')][_0x501b('0xa6')](_0x501b('0xa7'));}var _0x59f6a6='\x22'+_0x4f1a5a['text']+'\x22';if(this['isConfigured'](_0x4f1a5a[_0x501b('0x7b')])){_0x59f6a6+=','+_0x4f1a5a['options'];}var _0x36ce52=this[_0x501b('0x10')]['exec'](_0x501b('0xa8'),_0x59f6a6);if(_0x36ce52[_0x501b('0xa9')]===-0x1){return _0x36ce52;}return this[_0x501b('0x10')][_0x501b('0xa6')](util[_0x501b('0x2c')](_0x501b('0xbf'),_0x59f6a6));};AGIVertices[_0x501b('0x13')][_0x501b('0xc2')]=function(_0x67efaa){logger['info'](util[_0x501b('0x2c')](_0x501b('0xc3'),_0x67efaa['label']));if(!this[_0x501b('0xa2')](_0x67efaa[_0x501b('0xab')])){return this[_0x501b('0x10')][_0x501b('0xa6')](_0x501b('0xac'));}var _0x51c72f=_0x67efaa['grammar'];if(this['isConfigured'](_0x67efaa[_0x501b('0x7b')])){_0x51c72f+=','+_0x67efaa['options'];}var _0xee8dc6=this[_0x501b('0x10')][_0x501b('0x5c')](_0x501b('0xad'),_0x51c72f);if(_0xee8dc6[_0x501b('0xa9')]===-0x1){return _0xee8dc6;}var _0x193a4a=this['getAndSetVariable'](_0x501b('0xae'),_0x501b('0xc4'));if(_0x193a4a['result']===-0x1){return _0x193a4a;}var _0x391461=this[_0x501b('0xa0')](_0x501b('0xb0'),_0x501b('0xc5'));if(_0x391461[_0x501b('0xa9')]===-0x1){return _0x391461;}var _0x4ce3a6=this[_0x501b('0xa0')](_0x501b('0xc6'),'LUMENVOX_ASR_INSTANCE');if(_0x4ce3a6[_0x501b('0xa9')]===-0x1){return _0x4ce3a6;}return this[_0x501b('0x10')]['noop'](util[_0x501b('0x2c')](_0x501b('0xc7'),_0x51c72f));};AGIVertices[_0x501b('0x13')][_0x501b('0xc8')]=function(_0x44e258){logger[_0x501b('0x34')](util['format'](_0x501b('0xc9'),_0x44e258['label']));if(!this['isConfigured'](_0x44e258[_0x501b('0xab')])){return this['channel'][_0x501b('0xa6')](_0x501b('0xac'));}var _0x3ecca=_0x44e258[_0x501b('0xab')];if(this[_0x501b('0xa2')](_0x44e258[_0x501b('0x7b')])){_0x3ecca+=','+_0x44e258[_0x501b('0x7b')];}var _0x29001e=this[_0x501b('0x10')][_0x501b('0x5c')](_0x501b('0xad'),_0x3ecca);if(_0x29001e['result']===-0x1){return _0x29001e;}var _0x282d44=this[_0x501b('0xa0')](_0x501b('0xae'),'SESTEK_ASR_CONFIDENCE');if(_0x282d44[_0x501b('0xa9')]===-0x1){return _0x282d44;}var _0x554395=this['getAndSetVariable']('RECOG_INPUT()',_0x501b('0xca'));if(_0x554395[_0x501b('0xa9')]===-0x1){return _0x554395;}var _0xc76a87=this[_0x501b('0xa0')](_0x501b('0xc6'),'SESTEK_ASR_INSTANCE');if(_0xc76a87['result']===-0x1){return _0xc76a87;}return this['channel']['noop'](util[_0x501b('0x2c')](_0x501b('0xc7'),_0x3ecca));};AGIVertices[_0x501b('0x13')][_0x501b('0xcb')]=function(_0x3c3cdb){logger['info'](util['format'](_0x501b('0xcc'),_0x3c3cdb[_0x501b('0x3d')]));if(!this[_0x501b('0xa2')](_0x3c3cdb['odbc_id'])){return this[_0x501b('0x10')]['error'](_0x3c3cdb,'no\x20database\x20selected');}var _0x36ffdc=this[_0x501b('0x1c')][_0x501b('0x72')](this,_0x3c3cdb[_0x501b('0xcd')]);if(!_0x36ffdc){return this['channel'][_0x501b('0x30')](_0x3c3cdb,_0x501b('0xce'));}if(!this[_0x501b('0xa2')](_0x3c3cdb['query'])){return this['channel'][_0x501b('0x30')](_0x3c3cdb,'no\x20query\x20configured');}var _0x3f2652=_0x3c3cdb[_0x501b('0xcf')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x501b('0x10')][_0x501b('0xa6')](util['format']('query:\x20%s',_0x3f2652));var _0x397a25=this[_0x501b('0x2e')][_0x501b('0x72')](this,_0x36ffdc,_0x3f2652);this['createSquareDetailsReport'][_0x501b('0x72')](this,_0x3c3cdb,_0x3f2652);if(!this[_0x501b('0xa2')](_0x3c3cdb[_0x501b('0xd0')])){return this[_0x501b('0x10')][_0x501b('0xa6')](_0x501b('0xd1'));}var _0x4f63c7=this['getVariable'][_0x501b('0x72')](this,_0x3c3cdb[_0x501b('0xd0')]);if(!_0x4f63c7){return this[_0x501b('0x10')][_0x501b('0x30')](_0x3c3cdb,_0x501b('0xd2'));}var _0xf88d21=this;_0x397a25[_0x501b('0xd3')](function(_0x21d7de,_0x495047){Object[_0x501b('0xd4')](_0x21d7de)[_0x501b('0xd3')](function(_0x549cb1){_0xf88d21[_0x501b('0x10')][_0x501b('0x99')](util['format'](_0x501b('0xd5'),_0x4f63c7,_0x495047,_0x549cb1),_0x21d7de[_0x549cb1]);});});this[_0x501b('0x10')]['setVariable'](util[_0x501b('0x2c')](_0x501b('0xd6'),_0x4f63c7),_0x397a25[_0x501b('0x98')]);return this[_0x501b('0x10')][_0x501b('0xa6')](util['format']('variable\x20%s\x20set',_0x4f63c7));};AGIVertices[_0x501b('0x13')]['dial']=function(_0x23b336){logger[_0x501b('0xd7')](util[_0x501b('0x2c')](_0x501b('0xd8'),_0x23b336[_0x501b('0x3d')]));if(!this[_0x501b('0xa2')](_0x23b336['sip_id'])){return this[_0x501b('0x10')][_0x501b('0x30')](_0x23b336,_0x501b('0xd9'));}var _0x58822a=this[_0x501b('0x1e')][_0x501b('0x72')](this,_0x23b336[_0x501b('0xda')]);if(!_0x58822a){return this[_0x501b('0x10')]['error'](_0x23b336,'no\x20user\x20found');}var _0x35d3cb=this[_0x501b('0x10')][_0x501b('0x5c')](_0x501b('0xdb'),[util['format'](_0x501b('0xdc'),_0x58822a),_0x23b336[_0x501b('0x6a')],_0x23b336[_0x501b('0xdd')],_0x23b336[_0x501b('0x74')]]);if(_0x35d3cb[_0x501b('0xa9')]===-0x1){return _0x35d3cb;}return this['channel'][_0x501b('0xa6')](util[_0x501b('0x2c')]('Executed\x20command\x20%s',_0x501b('0xdb')));};AGIVertices[_0x501b('0x13')][_0x501b('0xde')]=function(_0xfa46e3){logger[_0x501b('0x34')](util[_0x501b('0x2c')](_0x501b('0xdf'),_0xfa46e3['label']));if(!this[_0x501b('0xa2')](_0xfa46e3['key'])){return this['channel'][_0x501b('0xa6')]('no\x20key\x20configured');}if(!this['isConfigured'](_0xfa46e3[_0x501b('0x61')])){return this[_0x501b('0x10')][_0x501b('0xa6')](_0x501b('0xa7'));}this['channel'][_0x501b('0xe0')]=!![];this[_0x501b('0x3b')](_0xfa46e3);this[_0x501b('0x46')](_0xfa46e3['text'],'in');this[_0x501b('0x10')][_0x501b('0xa6')](util[_0x501b('0x2c')](_0x501b('0xe1'),_0xfa46e3['text']));var _0x46d6e9=this[_0x501b('0x7c')]['sync'](this,_0xfa46e3);if(_0x46d6e9){for(var _0x3a5fa6 in _0x46d6e9){if(_0x46d6e9[_0x501b('0x8f')](_0x3a5fa6)){this[_0x501b('0x10')][_0x501b('0x99')](util[_0x501b('0x2c')](_0x501b('0xe2'),_0x3a5fa6['toUpperCase']()),_0x46d6e9[_0x3a5fa6]);}}this[_0x501b('0x46')](_0x46d6e9[_0x501b('0xe3')],'out');return this[_0x501b('0x10')]['noop'](util[_0x501b('0x2c')]('Dialogflow\x20Result\x20%s',_0x46d6e9['speech']));}return this[_0x501b('0x10')][_0x501b('0x30')](_0xfa46e3,_0x501b('0xe4'));};AGIVertices[_0x501b('0x13')][_0x501b('0xe5')]=function(_0x3305b7){logger[_0x501b('0x34')](util[_0x501b('0x2c')](_0x501b('0xe6'),_0x3305b7['label']));if(!this['isConfigured'](_0x3305b7[_0x501b('0xe7')])){return this['channel'][_0x501b('0xa6')](_0x501b('0xe8'));}if(!this[_0x501b('0xa2')](_0x3305b7['username'])){return this['channel'][_0x501b('0xa6')]('no\x20username\x20configured');}if(!this['isConfigured'](_0x3305b7[_0x501b('0xe9')])){return this[_0x501b('0x10')][_0x501b('0xa6')](_0x501b('0xea'));}if(!this['isConfigured'](_0x3305b7['ndassistant_url'])){return this['channel']['noop'](_0x501b('0xa7'));}this[_0x501b('0x10')][_0x501b('0xe0')]=!![];this[_0x501b('0x3b')](_0x3305b7);this['createSquareMessage'](_0x3305b7[_0x501b('0x61')],'in');this[_0x501b('0x10')][_0x501b('0xa6')](util[_0x501b('0x2c')]('Trying\x20SestekNDA:\x20%s',_0x3305b7[_0x501b('0x61')]));var _0x20a143=this[_0x501b('0x7e')][_0x501b('0x72')](this,_0x3305b7);if(_0x20a143){for(var _0x15279d in _0x20a143){if(_0x20a143[_0x501b('0x8f')](_0x15279d)){this[_0x501b('0x10')][_0x501b('0x99')](util[_0x501b('0x2c')]('SESTEK_NDA_%s',_0x15279d[_0x501b('0x6c')]()),_0x20a143[_0x15279d]);}}this['createSquareMessage'](_0x20a143['speech'],_0x501b('0xeb'));if(_0x20a143['audiofile']){this[_0x501b('0x10')][_0x501b('0xa6')](util[_0x501b('0x2c')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x20a143[_0x501b('0xec')]));var _0x5dfcbe=this[_0x501b('0x10')][_0x501b('0xed')](_0x20a143[_0x501b('0xec')]);try{fs[_0x501b('0xee')](_0x20a143[_0x501b('0xec')]+_0x501b('0xef'));}catch(_0x168ce5){logger[_0x501b('0x30')](_0x168ce5);}return _0x5dfcbe;}else{return this[_0x501b('0x10')]['noop'](util[_0x501b('0x2c')](_0x501b('0xf0'),_0x20a143[_0x501b('0xe3')]));}}return this['channel'][_0x501b('0x30')](_0x3305b7,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x501b('0x13')]['end']=function(_0x50b339){logger[_0x501b('0x34')](util[_0x501b('0x2c')](_0x501b('0xf1'),_0x50b339[_0x501b('0x3d')]));return this[_0x501b('0x10')][_0x501b('0xa6')]('end');};AGIVertices[_0x501b('0x13')][_0x501b('0xf2')]=function(_0xb24e32){logger['info'](util['format'](_0x501b('0xf3'),_0xb24e32[_0x501b('0x3d')]));var _0x597c40='';if(_0xb24e32[_0x501b('0xf4')]){if(!this['isConfigured'](_0xb24e32[_0x501b('0xf4')])){return this[_0x501b('0x10')][_0x501b('0x30')](_0xb24e32,_0x501b('0xf5'));}else{var _0x186866=parseInt(_0xb24e32[_0x501b('0xf4')],0xa);if(isNaN(_0x186866)){_0x597c40=_0xb24e32['trunk_id'];}else{_0x597c40=this['getTrunk'][_0x501b('0x72')](this,_0xb24e32[_0x501b('0xf4')]);if(!_0x597c40){return this[_0x501b('0x10')]['error'](_0xb24e32,_0x501b('0xf6'));}}}}else if(_0xb24e32[_0x501b('0xf7')]){_0x597c40=_0xb24e32[_0x501b('0xf7')];}else{return this[_0x501b('0x10')][_0x501b('0x30')](_0xb24e32,'no\x20trunk\x20selected');}var _0x45f758=this[_0x501b('0x10')][_0x501b('0x5c')](_0x501b('0xdb'),[util[_0x501b('0x2c')](_0x501b('0xf8'),_0x597c40,_0xb24e32[_0x501b('0x4d')]),_0xb24e32[_0x501b('0x6a')],_0xb24e32[_0x501b('0xdd')],_0xb24e32[_0x501b('0x74')]]);if(_0x45f758[_0x501b('0xa9')]===-0x1){return _0x45f758;}return this['channel'][_0x501b('0xa6')](util[_0x501b('0x2c')](_0x501b('0xf9'),'DIAL'));};AGIVertices[_0x501b('0x13')][_0x501b('0xfa')]=function(_0x415cdf){logger['info'](util['format'](_0x501b('0xfb'),_0x415cdf[_0x501b('0x3d')]));return this[_0x501b('0x10')]['noop'](_0x501b('0xfa'));};AGIVertices['prototype']['getdigits']=function(_0x29a164){logger[_0x501b('0x34')](util[_0x501b('0x2c')](_0x501b('0xfc'),_0x29a164[_0x501b('0x3d')]));if(_0x29a164['retry']===0x0){return this[_0x501b('0xa3')](_0x29a164);}_0x29a164[_0x501b('0xa4')]-=0x1;if(!this[_0x501b('0xa2')](_0x29a164['file_id'])){return this[_0x501b('0x10')]['error'](_0x29a164,_0x501b('0xfd'));}var _0x2cb649=this[_0x501b('0x22')][_0x501b('0x72')](this,_0x29a164[_0x501b('0xfe')]);if(!_0x2cb649){return this[_0x501b('0x10')][_0x501b('0x30')](_0x29a164,_0x501b('0xff'));}if(!this[_0x501b('0xa2')](_0x29a164[_0x501b('0xd0')])){return this[_0x501b('0x10')]['error'](_0x501b('0xd1'));}var _0x6c0e2b=this[_0x501b('0x10')][_0x501b('0x100')](_0x2cb649,_0x29a164[_0x501b('0x101')],_0x29a164[_0x501b('0x102')]);var _0x3dfb7a=_0x6c0e2b[_0x501b('0xa9')]?_0x6c0e2b[_0x501b('0xa9')][_0x501b('0x9f')]():'';logger[_0x501b('0x34')](_0x501b('0x103'),JSON[_0x501b('0x9b')](_0x6c0e2b));if(_0x6c0e2b[_0x501b('0xa9')]===-0x1){this[_0x501b('0x3b')][_0x501b('0x72')](this,_0x29a164,_0x3dfb7a);return _0x6c0e2b;}else if(_0x6c0e2b[_0x501b('0x9e')]===_0x501b('0x6a')){_0x6c0e2b[_0x501b('0xa9')]=_0x3dfb7a[_0x501b('0x98')]>=parseInt(_0x29a164[_0x501b('0x104')])?'x':'i';}else{_0x6c0e2b[_0x501b('0xa9')]=_0x3dfb7a[_0x501b('0x98')]>=parseInt(_0x29a164['mindigit'])&&_0x3dfb7a[_0x501b('0x98')]<=parseInt(_0x29a164[_0x501b('0x102')])?'x':'i';}var _0x27969f=this[_0x501b('0x14')][_0x501b('0x72')](this,_0x29a164['variable_id']);if(!_0x27969f){return this[_0x501b('0x10')]['error'](_0x29a164,_0x501b('0xd2'));}this['channel'][_0x501b('0x99')](_0x27969f,_0x3dfb7a);if(this[_0x501b('0xa2')](_0x29a164[_0x501b('0x105')])){var _0x593b1f=parseInt(_0x29a164[_0x501b('0x105')],0xa);var _0x283470=rs[_0x501b('0x106')]({'charset':'*','length':_0x593b1f});var _0x5d26c7=_0x3dfb7a[_0x501b('0x98')];if(_0x5d26c7>0x0){if(_0x5d26c7>_0x593b1f){this[_0x501b('0x3b')][_0x501b('0x72')](this,_0x29a164,_0x29a164['hiddendigitspos']===_0x501b('0x107')?_0x283470+_0x3dfb7a[_0x501b('0x108')](_0x593b1f):_0x3dfb7a[_0x501b('0x108')](0x0,_0x5d26c7-_0x593b1f)+_0x283470);}else{this[_0x501b('0x3b')][_0x501b('0x72')](this,_0x29a164,rs[_0x501b('0x106')]({'charset':'*','length':_0x5d26c7}));}}else{this[_0x501b('0x3b')][_0x501b('0x72')](this,_0x29a164,'');}}else{this[_0x501b('0x3b')][_0x501b('0x72')](this,_0x29a164,_0x3dfb7a);}return _0x6c0e2b;};AGIVertices['prototype'][_0x501b('0xf')]=function(_0x2678d2){logger[_0x501b('0x34')](util[_0x501b('0x2c')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x2678d2[_0x501b('0x3d')]));return this[_0x501b('0xe')](_0x2678d2);};AGIVertices[_0x501b('0x13')][_0x501b('0x109')]=function(_0x16ab2e){logger['info'](util[_0x501b('0x2c')](_0x501b('0x10a'),_0x16ab2e['label']));this['createSquareDetailsReport']['sync'](this,_0x16ab2e,_0x16ab2e['goalname']);return this[_0x501b('0x10')]['noop'](util[_0x501b('0x2c')](_0x501b('0x10b'),_0x16ab2e['goalname']));};AGIVertices['prototype'][_0x501b('0x10c')]=function(_0x57b8c1){logger[_0x501b('0x34')](util[_0x501b('0x2c')](_0x501b('0x10d'),_0x57b8c1[_0x501b('0x3d')]));if(!this[_0x501b('0xa2')](_0x57b8c1[_0x501b('0x84')])||!this[_0x501b('0xa2')](_0x57b8c1[_0x501b('0x10e')])){return this[_0x501b('0x10')][_0x501b('0xa6')](_0x501b('0x10f'));}if(!this[_0x501b('0xa2')](_0x57b8c1[_0x501b('0x61')])){return this['channel']['noop'](_0x501b('0xa7'));}this[_0x501b('0x10')][_0x501b('0xa6')](util[_0x501b('0x2c')](_0x501b('0x110'),_0x57b8c1[_0x501b('0x61')]));var _0x32b6d7=this[_0x501b('0x83')][_0x501b('0x72')](this,_0x57b8c1);if(_0x32b6d7){this[_0x501b('0x10')][_0x501b('0xa6')](util[_0x501b('0x2c')](_0x501b('0x111'),_0x32b6d7));var _0x244366=this['channel'][_0x501b('0xed')](_0x32b6d7);try{fs[_0x501b('0xee')](_0x32b6d7+_0x501b('0xef'));}catch(_0x611ba1){logger[_0x501b('0x30')](_0x611ba1);}return _0x244366;}return this[_0x501b('0x10')][_0x501b('0x30')](_0x57b8c1,_0x501b('0x112'));};AGIVertices[_0x501b('0x13')]['awslex']=function(_0x3cd441){logger['info'](util[_0x501b('0x2c')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x3cd441[_0x501b('0x3d')]));if(!this[_0x501b('0xa2')](_0x3cd441['aws_access_key_id'])||!this[_0x501b('0xa2')](_0x3cd441[_0x501b('0x10e')])){return this[_0x501b('0x10')][_0x501b('0xa6')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x501b('0xa2')](_0x3cd441[_0x501b('0x88')])){return this['channel'][_0x501b('0xa6')](_0x501b('0x113'));}if(!this[_0x501b('0xa2')](_0x3cd441['text'])){return this[_0x501b('0x10')][_0x501b('0xa6')](_0x501b('0xa7'));}this[_0x501b('0x10')][_0x501b('0xe0')]=!![];this[_0x501b('0x3b')](_0x3cd441);this[_0x501b('0x46')](_0x3cd441[_0x501b('0x61')],'in');this[_0x501b('0x10')][_0x501b('0xa6')](util['format'](_0x501b('0x114'),_0x3cd441[_0x501b('0x61')]));var _0x5df21e=this[_0x501b('0x87')][_0x501b('0x72')](this,_0x3cd441);if(_0x5df21e){for(var _0x4320f0 in _0x5df21e){if(_0x5df21e[_0x501b('0x8f')](_0x4320f0)&&_[_0x501b('0x90')](_0x5df21e[_0x4320f0])){this['channel'][_0x501b('0x99')](util[_0x501b('0x2c')](_0x501b('0x115'),_0x4320f0[_0x501b('0x6c')]()),_0x5df21e[_0x4320f0]);}}if(_[_0x501b('0x49')](_0x5df21e[_0x501b('0x116')])){return this['channel'][_0x501b('0xa6')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x501b('0x46')](_0x5df21e[_0x501b('0x116')],_0x501b('0xeb'));return this[_0x501b('0x10')][_0x501b('0xa6')](util[_0x501b('0x2c')](_0x501b('0x117'),_0x5df21e[_0x501b('0x116')]));}}return this[_0x501b('0x10')][_0x501b('0x30')](_0x3cd441,_0x501b('0x118'));};AGIVertices[_0x501b('0x13')][_0x501b('0x119')]=function(_0x5abf5c){logger['info'](util[_0x501b('0x2c')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x5abf5c[_0x501b('0x3d')],_0x5abf5c[_0x501b('0x6a')]));if(!this['isConfigured'](_0x5abf5c['key'])){return this[_0x501b('0x10')][_0x501b('0xa6')](_0x501b('0x11a'));}var _0x4d0d77=_0x501b('0x11b');var _0x45358d=util['format'](_0x501b('0x11c'),FILES_PATH,rs[_0x501b('0x106')](0x4));var _0x5051ef=util['format'](_0x501b('0x97'),_0x45358d,_0x4d0d77);var _0x4b8d31=!![];if(_0x5abf5c[_0x501b('0x11d')]===_0x501b('0x11e')){_0x4b8d31=![];}var _0x54ee7d=this[_0x501b('0x10')][_0x501b('0x11f')](_0x45358d,_0x4d0d77,_0x5abf5c[_0x501b('0x120')],_0x5abf5c['timeout'],undefined,_0x4b8d31);if(_0x54ee7d[_0x501b('0xa9')]!==-0x1){this[_0x501b('0x10')][_0x501b('0xa6')](util['format']('google\x20%s\x20file\x20created',_0x5051ef));var _0x4c4055=this[_0x501b('0x89')][_0x501b('0x72')](this,_0x5abf5c,_0x5051ef);if(_0x4c4055){for(var _0xad0770 in _0x4c4055){if(_0x4c4055[_0x501b('0x8f')](_0xad0770)){this['channel'][_0x501b('0x99')](util[_0x501b('0x2c')](_0x501b('0x121'),_0xad0770[_0x501b('0x6c')]()),_0x4c4055[_0xad0770]);}}return this[_0x501b('0x10')]['noop'](util['format']('GoogleASR\x20Result\x20%s',JSON[_0x501b('0x9b')](_0x4c4055)));}}return _0x54ee7d;};AGIVertices[_0x501b('0x13')][_0x501b('0x122')]=function(_0x115c0f){logger[_0x501b('0x34')](util['format'](_0x501b('0x123'),_0x115c0f[_0x501b('0x3d')]));if(!this['isConfigured'](_0x115c0f[_0x501b('0x124')])){return this[_0x501b('0x10')]['noop']('no\x20appid\x20configured');}if(!this['isConfigured'](_0x115c0f['appsecret'])){return this[_0x501b('0x10')][_0x501b('0xa6')](_0x501b('0x125'));}var _0x6cf758=_0x501b('0x11b');var _0x400105=util[_0x501b('0x2c')](_0x501b('0x11c'),FILES_PATH,rs[_0x501b('0x106')](0x4));var _0x2874e6=util[_0x501b('0x2c')](_0x501b('0x97'),_0x400105,_0x6cf758);var _0x23a8b2=!![];if(_0x115c0f[_0x501b('0x11d')]===_0x501b('0x11e')){_0x23a8b2=![];}var _0x28ab22=this[_0x501b('0x10')][_0x501b('0x11f')](_0x400105,_0x6cf758,_0x115c0f[_0x501b('0x120')],_0x115c0f[_0x501b('0x6a')],undefined,_0x23a8b2);if(_0x28ab22['result']!==-0x1){this[_0x501b('0x10')]['noop'](util[_0x501b('0x2c')](_0x501b('0x126'),_0x2874e6));var _0x4f4b73=this[_0x501b('0x8b')][_0x501b('0x72')](this,_0x115c0f,_0x2874e6);if(_0x4f4b73){for(var _0x4b9642 in _0x4f4b73){if(_0x4f4b73[_0x501b('0x8f')](_0x4b9642)){this[_0x501b('0x10')]['setVariable'](util[_0x501b('0x2c')]('TILDE_ASR_%s',_0x4b9642['toUpperCase']()),_0x4f4b73[_0x4b9642]);}}return this[_0x501b('0x10')][_0x501b('0xa6')](util['format'](_0x501b('0x127'),JSON[_0x501b('0x9b')](_0x4f4b73)));}}return _0x28ab22;};AGIVertices[_0x501b('0x13')][_0x501b('0x128')]=function(_0x33b5e5){logger[_0x501b('0x34')](util[_0x501b('0x2c')](_0x501b('0x129'),_0x33b5e5[_0x501b('0x3d')]));return this[_0x501b('0x10')]['continueAt'](_0x33b5e5[_0x501b('0x12a')],_0x33b5e5[_0x501b('0x43')],_0x33b5e5[_0x501b('0x12b')]);};AGIVertices[_0x501b('0x13')][_0x501b('0x12c')]=function(_0x3da583){logger[_0x501b('0x34')](util[_0x501b('0x2c')](_0x501b('0x12d'),_0x3da583['label']));if(!this[_0x501b('0xa2')](_0x3da583['condition'])){return this['channel'][_0x501b('0x30')](_0x3da583,_0x501b('0x12e'));}try{var _0x26d1bc=eval(_0x3da583[_0x501b('0x12f')])?_0x501b('0x130'):_0x501b('0x131');this['channel'][_0x501b('0xa6')](util[_0x501b('0x2c')]('EVAL\x20CONDITION\x20%s\x20%s',_0x3da583[_0x501b('0x12f')],_0x26d1bc));return{'code':0xc8,'result':_0x26d1bc};}catch(_0x54f4d5){return{'code':0xc8,'result':_0x501b('0x131')};}};AGIVertices['prototype'][_0x501b('0x132')]=function(_0x5dd2bb){logger[_0x501b('0x34')](util[_0x501b('0x2c')](_0x501b('0x133'),_0x5dd2bb[_0x501b('0x3d')]));if(!this[_0x501b('0xa2')](_0x5dd2bb[_0x501b('0x134')])){return this[_0x501b('0x10')][_0x501b('0x30')](_0x5dd2bb,_0x501b('0x135'));}var _0x1e4b55=this['getIntervals'][_0x501b('0x72')](this,_0x5dd2bb[_0x501b('0x134')]);if(!_0x1e4b55){return this[_0x501b('0x10')][_0x501b('0x30')](_0x5dd2bb,_0x501b('0x136'));}for(var _0x432022=0x0;_0x432022<_0x1e4b55['length'];_0x432022+=0x1){var _0x4ef8f6=this[_0x501b('0x10')]['getVariable'](util['format']('IFTIME(%s?true:false)',_0x1e4b55[_0x432022]));if(_0x4ef8f6[_0x501b('0xa9')]===-0x1){return _0x4ef8f6;}logger['info'](util[_0x501b('0x2c')](_0x501b('0x137'),_0x1e4b55[_0x432022],_0x4ef8f6[_0x501b('0x9e')]));if(_0x4ef8f6[_0x501b('0x9e')]===_0x501b('0x130')){logger[_0x501b('0x34')](util[_0x501b('0x2c')](_0x501b('0x137'),_0x1e4b55[_0x432022],_0x501b('0x130')));this['channel'][_0x501b('0xa6')](util[_0x501b('0x2c')](_0x501b('0x137'),_0x1e4b55[_0x432022],_0x501b('0x130')));return{'code':0xc8,'result':'true'};}else{logger['info'](util['format']('IFTIME\x20%s\x20%s',_0x1e4b55[_0x432022],'false'));this['channel'][_0x501b('0xa6')](util[_0x501b('0x2c')](_0x501b('0x137'),_0x1e4b55[_0x432022],_0x501b('0x131')));}}return{'code':0xc8,'result':_0x501b('0x131')};};AGIVertices[_0x501b('0x13')][_0x501b('0x138')]=function(_0x396c30){logger[_0x501b('0x34')](util['format'](_0x501b('0x139'),_0x396c30[_0x501b('0x3d')]));return this[_0x501b('0x10')][_0x501b('0x138')]();};AGIVertices[_0x501b('0x13')]['ispeechasr']=function(_0x3833a8){logger[_0x501b('0x34')](util[_0x501b('0x2c')](_0x501b('0x13a'),_0x3833a8['label']));if(!this[_0x501b('0xa2')](_0x3833a8[_0x501b('0x7d')])){return this['channel'][_0x501b('0xa6')](_0x501b('0x11a'));}var _0x13e2d6=_0x501b('0x11b');var _0x383376=util[_0x501b('0x2c')](_0x501b('0x11c'),FILES_PATH,rs[_0x501b('0x106')](0x4));var _0x4cc21e=util['format'](_0x501b('0x97'),_0x383376,_0x13e2d6);var _0x7d36ff=!![];if(_0x3833a8[_0x501b('0x11d')]===_0x501b('0x11e')){_0x7d36ff=![];}var _0x5474bf=this[_0x501b('0x10')]['recordFile'](_0x383376,_0x13e2d6,_0x3833a8['intKey'],_0x3833a8['timeout'],undefined,_0x7d36ff);if(_0x5474bf[_0x501b('0xa9')]!==-0x1){this[_0x501b('0x10')][_0x501b('0xa6')](util[_0x501b('0x2c')](_0x501b('0x13b'),_0x4cc21e));var _0x45c595=this['ispeechASR'][_0x501b('0x72')](this,_0x3833a8,_0x4cc21e);if(_0x45c595){for(var _0x59aaf2 in _0x45c595){if(_0x45c595[_0x501b('0x8f')](_0x59aaf2)){this[_0x501b('0x10')][_0x501b('0x99')](util[_0x501b('0x2c')](_0x501b('0x13c'),_0x59aaf2[_0x501b('0x6c')]()),_0x45c595[_0x59aaf2]);}}return this['channel']['noop'](util[_0x501b('0x2c')](_0x501b('0x13d'),JSON['stringify'](_0x45c595)));}}return _0x5474bf;};AGIVertices['prototype'][_0x501b('0x13e')]=function(_0x7cbc39){logger['info'](util[_0x501b('0x2c')](_0x501b('0x13f'),_0x7cbc39[_0x501b('0x3d')]));if(!this[_0x501b('0xa2')](_0x7cbc39[_0x501b('0x7d')])){return this[_0x501b('0x10')][_0x501b('0xa6')](_0x501b('0x11a'));}if(!this['isConfigured'](_0x7cbc39[_0x501b('0x61')])){return this['channel']['noop']('no\x20text\x20configured');}this[_0x501b('0x10')][_0x501b('0xa6')](util[_0x501b('0x2c')](_0x501b('0x140'),_0x7cbc39['text']));var _0x1fa480=this[_0x501b('0x141')][_0x501b('0x72')](this,_0x7cbc39);if(_0x1fa480){this['channel'][_0x501b('0xa6')](util['format'](_0x501b('0x13b'),_0x1fa480));var _0x31ad55=this[_0x501b('0x10')][_0x501b('0xed')](_0x1fa480,_0x7cbc39[_0x501b('0x120')]);try{fs[_0x501b('0xee')](_0x1fa480+_0x501b('0xef'));}catch(_0x22340e){logger[_0x501b('0x30')](_0x22340e);}return _0x31ad55;}return this['channel'][_0x501b('0x30')](_0x7cbc39,_0x501b('0x142'));};AGIVertices[_0x501b('0x13')][_0x501b('0x143')]=function(_0x43bf61){logger[_0x501b('0x34')](util[_0x501b('0x2c')](_0x501b('0x144'),_0x43bf61['label']));if(!this[_0x501b('0xa2')](_0x43bf61['findBy'])){return this[_0x501b('0x10')]['error'](_0x43bf61,_0x501b('0x145'));}logger[_0x501b('0x34')](util[_0x501b('0x2c')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x501b('0x10')][_0x501b('0x40')],_0x43bf61[_0x501b('0x146')]));var _0x31b5af=this['agentLogin'][_0x501b('0x72')](this,_0x43bf61['findBy']);if(_0x31b5af){logger[_0x501b('0x34')](util['format'](_0x501b('0x147'),this[_0x501b('0x10')][_0x501b('0x40')],_0x43bf61[_0x501b('0x146')]));this['channel'][_0x501b('0xa6')](util[_0x501b('0x2c')](_0x501b('0x147'),this[_0x501b('0x10')][_0x501b('0x40')],_0x43bf61[_0x501b('0x146')]));return{'code':0xc8,'result':_0x501b('0x148')};}else{logger['info'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x501b('0x40')],_0x43bf61['findBy']));this[_0x501b('0x10')]['noop'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x501b('0x10')][_0x501b('0x40')],_0x43bf61['findBy']));return{'code':0xc8,'result':_0x501b('0x149')};}};AGIVertices[_0x501b('0x13')][_0x501b('0x14a')]=function(_0x4968e5){logger['info'](util[_0x501b('0x2c')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x4968e5['label']));if(!this[_0x501b('0xa2')](_0x4968e5[_0x501b('0x146')])){return this[_0x501b('0x10')][_0x501b('0x30')](_0x4968e5,_0x501b('0x145'));}logger['info'](util['format'](_0x501b('0x14b'),this['channel'][_0x501b('0x40')],_0x4968e5[_0x501b('0x146')]));var _0x1c5937=this[_0x501b('0x57')][_0x501b('0x72')](this,_0x4968e5[_0x501b('0x146')]);if(_0x1c5937){logger[_0x501b('0x34')](util['format'](_0x501b('0x147'),this['channel'][_0x501b('0x40')],_0x4968e5['findBy']));this['channel'][_0x501b('0xa6')](util[_0x501b('0x2c')](_0x501b('0x147'),this[_0x501b('0x10')]['callerid'],_0x4968e5[_0x501b('0x146')]));return{'code':0xc8,'result':'success'};}else{logger[_0x501b('0x34')](util[_0x501b('0x2c')](_0x501b('0x14c'),this[_0x501b('0x10')][_0x501b('0x40')],_0x4968e5['findBy']));this['channel'][_0x501b('0xa6')](util['format'](_0x501b('0x14c'),this[_0x501b('0x10')]['callerid'],_0x4968e5[_0x501b('0x146')]));return{'code':0xc8,'result':_0x501b('0x149')};}};AGIVertices['prototype'][_0x501b('0x14d')]=function(_0x45f5b9){logger[_0x501b('0x34')](util[_0x501b('0x2c')](_0x501b('0x14e'),_0x45f5b9[_0x501b('0x3d')]));if(!this[_0x501b('0xa2')](_0x45f5b9['operation'])){return this['channel'][_0x501b('0x30')](_0x45f5b9,_0x501b('0x14f'));}this[_0x501b('0x10')][_0x501b('0xa6')](util[_0x501b('0x2c')]('math\x20%s',_0x45f5b9[_0x501b('0x150')]));var _0xbda7ca=eval(_0x45f5b9['operation']);if(!this[_0x501b('0xa2')](_0x45f5b9[_0x501b('0xd0')])){return this['channel'][_0x501b('0xa6')](_0x501b('0xd1'));}var _0x4f26b0=this[_0x501b('0x14')][_0x501b('0x72')](this,_0x45f5b9[_0x501b('0xd0')]);if(!_0x4f26b0){return this[_0x501b('0x10')][_0x501b('0x30')](_0x45f5b9,_0x501b('0xd2'));}if(_[_0x501b('0x93')](_0xbda7ca)){var _0x2fd3cd=this;_0xbda7ca[_0x501b('0xd3')](function(_0x5556b5,_0x35b1fb){_0x2fd3cd[_0x501b('0x10')][_0x501b('0x99')](util[_0x501b('0x2c')](_0x501b('0x151'),_0x4f26b0,_0x35b1fb),_0x5556b5);});return this['channel']['noop'](util[_0x501b('0x2c')]('variable\x20%s[key]\x20set',_0x4f26b0));}else{return this['channel'][_0x501b('0x99')](_0x4f26b0,_0xbda7ca);}};AGIVertices[_0x501b('0x13')][_0x501b('0xd')]=function(_0x40190e){logger[_0x501b('0x34')](util[_0x501b('0x2c')](_0x501b('0x152'),_0x40190e[_0x501b('0x3d')]));if(_0x40190e['retry']===0x0){return this['maxRetry'](_0x40190e);}_0x40190e[_0x501b('0xa4')]-=0x1;if(!this[_0x501b('0xa2')](_0x40190e[_0x501b('0xfe')])){return this[_0x501b('0x10')]['error'](_0x40190e,_0x501b('0xfd'));}var _0x28ec1b=this['getSound'][_0x501b('0x72')](this,_0x40190e[_0x501b('0xfe')]);if(!_0x28ec1b){return this[_0x501b('0x10')][_0x501b('0x30')](_0x40190e,'no\x20file\x20audio\x20found');}var _0x4d65db=this[_0x501b('0x10')][_0x501b('0x100')](_0x28ec1b,_0x40190e[_0x501b('0x101')],_0x40190e[_0x501b('0x153')]);var _0x5dc0dd=_0x4d65db['result'];if(_0x4d65db['result']===-0x1){this['createSquareDetailsReport'][_0x501b('0x72')](this,_0x40190e,'-1');return _0x4d65db;}else if(_0x4d65db[_0x501b('0x9e')]===_0x501b('0x6a')){_0x4d65db['result']=_0x4d65db[_0x501b('0xa9')][_0x501b('0x98')]>0x0?_0x4d65db[_0x501b('0xa9')]:'t';}else if(_[_0x501b('0x48')](_0x4d65db['result'])){_0x4d65db['result']='#';_0x5dc0dd='#';}if(!this[_0x501b('0xa2')](_0x40190e['variable_id'])){this[_0x501b('0x10')][_0x501b('0xa6')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x4b20e8=this[_0x501b('0x14')]['sync'](this,_0x40190e[_0x501b('0xd0')]);if(!_0x4b20e8){return this[_0x501b('0x10')][_0x501b('0x30')](_0x40190e,_0x501b('0xd2'));}this['channel'][_0x501b('0x99')](_0x4b20e8,_0x5dc0dd);}this[_0x501b('0x3b')][_0x501b('0x72')](this,_0x40190e,_0x5dc0dd);return _0x4d65db;};AGIVertices['prototype'][_0x501b('0xa6')]=function(_0x1c2e40){logger['info'](util[_0x501b('0x2c')](_0x501b('0x154'),_0x1c2e40['label']));return this[_0x501b('0x10')][_0x501b('0xa6')](_0x1c2e40[_0x501b('0x155')]||_0x1c2e40[_0x501b('0x3d')]);};AGIVertices['prototype'][_0x501b('0x156')]=function(_0x810e94){logger['info'](util[_0x501b('0x2c')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x810e94['label']));if(!this[_0x501b('0xa2')](_0x810e94['findBy'])){return this[_0x501b('0x10')]['error'](_0x810e94,'no\x20find\x20by\x20configured');}logger[_0x501b('0x34')](util[_0x501b('0x2c')](_0x501b('0x14b'),this[_0x501b('0x10')][_0x501b('0x40')],_0x810e94[_0x501b('0x146')]));var _0x21e427=this[_0x501b('0x52')][_0x501b('0x72')](this,_0x810e94['pause_id']);var _0x3ec967=this[_0x501b('0x54')][_0x501b('0x72')](this,_0x810e94[_0x501b('0x146')],_0x21e427);if(_0x3ec967){logger['info'](util[_0x501b('0x2c')](_0x501b('0x147'),this[_0x501b('0x10')][_0x501b('0x40')],_0x810e94['findBy']));this[_0x501b('0x10')][_0x501b('0xa6')](util[_0x501b('0x2c')](_0x501b('0x147'),this[_0x501b('0x10')]['callerid'],_0x810e94['findBy']));return{'code':0xc8,'result':_0x501b('0x148')};}else{logger[_0x501b('0x34')](util[_0x501b('0x2c')](_0x501b('0x14c'),this[_0x501b('0x10')][_0x501b('0x40')],_0x810e94[_0x501b('0x146')]));this['channel'][_0x501b('0xa6')](util['format'](_0x501b('0x147'),this[_0x501b('0x10')][_0x501b('0x40')],_0x810e94[_0x501b('0x146')]));return{'code':0xc8,'result':_0x501b('0x149')};}};AGIVertices[_0x501b('0x13')][_0x501b('0x157')]=function(_0x58b962){logger['info'](util['format'](_0x501b('0x158'),_0x58b962[_0x501b('0x3d')]));if(!this['isConfigured'](_0x58b962[_0x501b('0xfe')])){return this['channel'][_0x501b('0x30')](_0x58b962,_0x501b('0xfd'));}var _0x4aab8b=this[_0x501b('0x22')][_0x501b('0x72')](this,_0x58b962['file_id']);if(!_0x4aab8b){return this[_0x501b('0x10')][_0x501b('0x30')](_0x58b962,'no\x20file\x20audio\x20found');}var _0x274880=this[_0x501b('0x10')]['exec'](_0x501b('0x159'),[_0x4aab8b,_0x58b962[_0x501b('0xdd')]]);if(_0x274880[_0x501b('0xa9')]===-0x1){return _0x274880;}return this[_0x501b('0x10')][_0x501b('0xa6')](util['format'](_0x501b('0xbd'),_0x501b('0x159'),_0x4aab8b));};AGIVertices[_0x501b('0x13')]['queue']=function(_0x339743){logger[_0x501b('0x34')](util[_0x501b('0x2c')](_0x501b('0x15a'),_0x339743[_0x501b('0x3d')]));if(!this[_0x501b('0xa2')](_0x339743[_0x501b('0x15b')])){return this[_0x501b('0x10')][_0x501b('0x30')](_0x339743,'no\x20queue\x20selected');}var _0x2cd29d='';var _0xb09589=parseInt(_0x339743[_0x501b('0x15b')],0xa);if(isNaN(_0xb09589)){_0x2cd29d=_0x339743[_0x501b('0x15b')];}else{_0x2cd29d=this[_0x501b('0x17')][_0x501b('0x72')](this,_0x339743[_0x501b('0x15b')]);if(!_0x2cd29d){return this['channel'][_0x501b('0x30')](_0x339743,'no\x20queue\x20found');}}var _0x1a2ae2='';if(this['isConfigured'](_0x339743['file_id'])){var _0x3bfcf8=this[_0x501b('0x22')][_0x501b('0x72')](this,_0x339743['file_id']);if(_0x3bfcf8){_0x1a2ae2=_0x3bfcf8;}}this[_0x501b('0x3b')][_0x501b('0x72')](this,_0x339743,_0x2cd29d);if(_0x339743[_0x501b('0xdd')]['indexOf']('x')<0x0){_0x339743[_0x501b('0xdd')]+='x';}if(_0x339743[_0x501b('0xdd')][_0x501b('0x15c')]('X')<0x0){_0x339743[_0x501b('0xdd')]+='X';}this['channel']['setVariable'](_0x501b('0x15d'),_0x2cd29d?_0x2cd29d['toLowerCase']():'');var _0x57ab09=this[_0x501b('0x10')]['exec'](_0x501b('0x15e'),[_0x2cd29d,_0x339743[_0x501b('0xdd')],_0x339743[_0x501b('0x74')],_0x1a2ae2,_0x339743[_0x501b('0x6a')],_0x339743['agi'],_0x339743['macro'],_0x339743[_0x501b('0x15f')],'',_0x339743[_0x501b('0x160')]]);if(_0x57ab09[_0x501b('0xa9')]===-0x1){return _0x57ab09;}return this[_0x501b('0x10')][_0x501b('0xa6')](util[_0x501b('0x2c')](_0x501b('0xbd'),_0x501b('0x15e'),_0x2cd29d));};AGIVertices['prototype'][_0x501b('0x161')]=function(_0xee4153){logger[_0x501b('0x34')](util[_0x501b('0x2c')](_0x501b('0x162'),_0xee4153[_0x501b('0x3d')]));var _0x5abb85=_0xee4153[_0x501b('0x163')]||'wav';var _0x54f450=util[_0x501b('0x2c')]('%s_%s',this['channel'][_0x501b('0x3c')],rs[_0x501b('0x106')](0x5));var _0x4a26ea=util[_0x501b('0x2c')]('%s/recordings/%s.%s',FILES_PATH,_0x54f450,_0x5abb85);var _0x47f0a2=util[_0x501b('0x2c')]('%s/recordings/%s',FILES_PATH,_0x54f450);this['createSquareRecording'][_0x501b('0x72')](this,_0xee4153,_0x54f450,_0x4a26ea);this[_0x501b('0x10')][_0x501b('0x99')](_0x501b('0x164'),_0x54f450);logger['info'](_0x501b('0x165'),_0x47f0a2,_0x5abb85,_0xee4153['escape_digits'],_0xee4153['timeout']);return this[_0x501b('0x10')][_0x501b('0x11f')](_0x47f0a2,_0x5abb85,_0xee4153[_0x501b('0x166')],_0xee4153[_0x501b('0x6a')],undefined,!![]);};AGIVertices[_0x501b('0x13')][_0x501b('0x167')]=function(_0x4ee06e){logger[_0x501b('0x34')](util[_0x501b('0x2c')](_0x501b('0x168'),_0x4ee06e[_0x501b('0x3d')]));if(!this['isConfigured'](_0x4ee06e[_0x501b('0x74')])){return this[_0x501b('0x10')][_0x501b('0xa6')](_0x501b('0x169'));}var _0x15e652=this[_0x501b('0x16a')]['sync'](this,_0x4ee06e);logger[_0x501b('0x34')](util[_0x501b('0x2c')]('Response:',util['inspect'](_0x15e652,{'showHidden':![],'depth':null})));if(!this[_0x501b('0xa2')](_0x4ee06e[_0x501b('0xd0')])){return this[_0x501b('0x10')][_0x501b('0xa6')](_0x501b('0x16b'));}var _0x297fc1=this[_0x501b('0x14')][_0x501b('0x72')](this,_0x4ee06e[_0x501b('0xd0')]);if(!_0x297fc1){return this[_0x501b('0x10')][_0x501b('0x30')](_0x4ee06e,'no\x20variable\x20found');}this[_0x501b('0x10')][_0x501b('0x99')](util['format'](_0x501b('0x16c'),_0x297fc1),_0x15e652['statusCode']?_0x15e652[_0x501b('0x79')]:_0x501b('0x16d'));this['channel'][_0x501b('0x99')](util[_0x501b('0x2c')]('%s_STATUS_MESSAGE',_0x297fc1),_0x15e652['statusMessage']?_0x15e652['statusMessage']:'OK');if(_0x15e652[_0x501b('0x77')]){try{this[_0x501b('0x95')](_0x15e652['body'],_0x297fc1);}catch(_0x37c6af){logger[_0x501b('0x30')](util[_0x501b('0x2c')](_0x501b('0x16e'),_0x297fc1));}}return this[_0x501b('0x10')][_0x501b('0xa6')](util[_0x501b('0x2c')](_0x501b('0x16f'),_0x297fc1));};AGIVertices[_0x501b('0x13')]['saydigits']=function(_0x4041e3){logger[_0x501b('0x34')](util['format'](_0x501b('0x170'),_0x4041e3[_0x501b('0x3d')]));return this[_0x501b('0x10')][_0x501b('0x171')](_0x4041e3[_0x501b('0x172')][_0x501b('0x5d')](/\s+/g,''),_0x4041e3[_0x501b('0x166')]);};AGIVertices['prototype'][_0x501b('0x173')]=function(_0x46204b){logger['info'](util[_0x501b('0x2c')](_0x501b('0x174'),_0x46204b[_0x501b('0x3d')]));return this[_0x501b('0x10')][_0x501b('0x175')](_0x46204b[_0x501b('0x176')][_0x501b('0x5d')](/\s+/g,''),_0x46204b['escape_digits']);};AGIVertices['prototype'][_0x501b('0x177')]=function(_0x52006e){logger['info'](util[_0x501b('0x2c')](_0x501b('0x178'),_0x52006e['label']));return this[_0x501b('0x10')]['sayPhonetic'](_0x52006e[_0x501b('0x61')],_0x52006e[_0x501b('0x166')]);};AGIVertices[_0x501b('0x13')][_0x501b('0x179')]=function(_0x5322d4){logger['info'](util[_0x501b('0x2c')](_0x501b('0x17a'),_0x5322d4[_0x501b('0x3d')]));if(!this[_0x501b('0xa2')](_0x5322d4[_0x501b('0x17b')])){return this[_0x501b('0x10')][_0x501b('0xa6')](_0x501b('0x17c'));}var _0x5bffa9=this[_0x501b('0x26')]['sync'](this,_0x5322d4[_0x501b('0x17b')]);if(!_0x5bffa9||!_0x5bffa9[_0x501b('0x17d')]){return this['channel'][_0x501b('0x30')](_0x5322d4,'no\x20mail\x20account\x20found');}var _0x4f6ae2={'from':util['format'](_0x501b('0x17e'),_0x5bffa9[_0x501b('0x16')],_0x5bffa9[_0x501b('0x17f')]||_0x5bffa9[_0x501b('0x17d')][_0x501b('0x180')]),'to':_0x5322d4['to']||'','cc':_0x5322d4['cc']||'','bcc':_0x5322d4[_0x501b('0x181')]||'','subject':_0x5322d4['subject'],'html':_0x5322d4[_0x501b('0x61')],'text':_0x5322d4[_0x501b('0x61')]};var _0x41876e={'tls':{'rejectUnauthorized':![]}};if(_0x5bffa9[_0x501b('0x17d')][_0x501b('0x182')]){_0x41876e['service']=_0x5bffa9['Smtp']['service'];}else{_0x41876e[_0x501b('0x183')]=_0x5bffa9[_0x501b('0x17d')][_0x501b('0x183')];_0x41876e['port']=_0x5bffa9['Smtp'][_0x501b('0x184')];_0x41876e[_0x501b('0x185')]=_0x5bffa9['Smtp']['secure'];}if(_0x5bffa9[_0x501b('0x17d')]['authentication']){_0x41876e['auth']={'user':_0x5bffa9[_0x501b('0x17d')][_0x501b('0x180')],'pass':_0x5bffa9['Smtp'][_0x501b('0x186')]};}if(this['isConfigured'](_0x5322d4[_0x501b('0x187')])){}logger[_0x501b('0xd7')](_0x501b('0x188'),JSON[_0x501b('0x9b')](_0x4f6ae2));this[_0x501b('0x3b')][_0x501b('0x72')](this,_0x5322d4,_0x5322d4['account_id']);this[_0x501b('0x10')]['noop'](util[_0x501b('0x2c')](_0x501b('0x189'),_0x5bffa9[_0x501b('0x16')]));this[_0x501b('0x28')]['sync'](this,_0x41876e,_0x4f6ae2);return this[_0x501b('0x10')][_0x501b('0xa6')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x501b('0x13')]['sendFax']=function(_0x6e7bb3){logger[_0x501b('0x34')](util[_0x501b('0x2c')](_0x501b('0x18a'),_0x6e7bb3[_0x501b('0x3d')]));return this[_0x501b('0x10')]['noop'](_0x501b('0x18b'));};AGIVertices[_0x501b('0x13')][_0x501b('0x18c')]=function(_0x551044){logger[_0x501b('0x34')](util['format'](_0x501b('0x18d'),_0x551044['label']));if(!this[_0x501b('0xa2')](_0x551044[_0x501b('0x18e')])){return this[_0x501b('0x10')]['noop']('no\x20sms\x20account\x20configured');}var _0x1ed41e=this[_0x501b('0x38')][_0x501b('0x72')](this,_0x551044[_0x501b('0x18e')]);if(!_0x1ed41e){return this[_0x501b('0x10')][_0x501b('0x30')](_0x551044,'no\x20sms\x20account\x20found');}var _0x25bc8a={'body':_0x551044[_0x501b('0x18f')],'phone':_0x551044['to']||'','SmsAccountId':_0x1ed41e['id']};logger[_0x501b('0xd7')](_0x501b('0x190'),JSON[_0x501b('0x9b')](_0x25bc8a));this[_0x501b('0x3b')][_0x501b('0x72')](this,_0x551044,_0x551044[_0x501b('0x18e')]);this[_0x501b('0x10')][_0x501b('0xa6')](util[_0x501b('0x2c')](_0x501b('0x191'),_0x1ed41e[_0x501b('0x16')]));this[_0x501b('0x3a')]['sync'](this,_0x25bc8a);return this[_0x501b('0x10')][_0x501b('0xa6')](_0x501b('0x192'));};AGIVertices['prototype'][_0x501b('0x193')]=function(_0x7edf43){logger['info'](util[_0x501b('0x2c')](_0x501b('0x194'),_0x7edf43[_0x501b('0x3d')]));if(!this[_0x501b('0xa2')](_0x7edf43['variable_id'])){return this[_0x501b('0x10')][_0x501b('0x30')](_0x7edf43,_0x501b('0x195'));}var _0x3c8f28=this['getVariable'][_0x501b('0x72')](this,_0x7edf43['variable_id']);if(!_0x3c8f28){return this[_0x501b('0x10')][_0x501b('0x30')](_0x7edf43,_0x501b('0xd2'));}return this[_0x501b('0x10')][_0x501b('0x99')](_0x3c8f28,_0x7edf43['variable_value']);};AGIVertices['prototype']['start']=function(_0x55a47c){logger[_0x501b('0x34')](util['format'](_0x501b('0x196'),_0x55a47c[_0x501b('0x3d')]));this[_0x501b('0x10')]['noop']('START\x20CALLY\x20SQUARE');if(_0x55a47c[_0x501b('0xb6')]===_0x501b('0x197')){this[_0x501b('0x10')][_0x501b('0xa6')](_0x501b('0x198'));return this[_0x501b('0x10')]['answer']();}return this[_0x501b('0x10')]['noop']('Skipped\x20Answer');};AGIVertices['prototype'][_0x501b('0x199')]=function(_0x795a4d){logger['info'](util[_0x501b('0x2c')](_0x501b('0x19a'),_0x795a4d['label']));if(!this['isConfigured'](_0x795a4d[_0x501b('0x19b')])){return this[_0x501b('0x10')][_0x501b('0x30')](_0x795a4d,_0x501b('0x19c'));}var _0x3e28cc=this[_0x501b('0x1a')]['sync'](this,_0x795a4d[_0x501b('0x19b')]);if(!this[_0x501b('0xa2')](_0x3e28cc)){return this[_0x501b('0x10')]['error'](_0x795a4d,util['format'](_0x501b('0x19d'),_0x795a4d[_0x501b('0x19b')]));}if(_0x3e28cc===this[_0x501b('0x10')][_0x501b('0x3f')]){return this[_0x501b('0x10')][_0x501b('0x30')](_0x795a4d,_0x501b('0x19e'));}this[_0x501b('0x3b')][_0x501b('0x72')](this,_0x795a4d,_0x3e28cc);var _0x2cb219=this[_0x501b('0x10')][_0x501b('0x5c')](_0x501b('0x19f'),util[_0x501b('0x2c')](_0x501b('0x1a0'),config[_0x501b('0x9')][_0x501b('0x183')]||'127.0.0.1',_0x3e28cc,this['channel'][_0x501b('0x3f')]));if(_0x2cb219[_0x501b('0xa9')]===-0x1){return _0x2cb219;}return this[_0x501b('0x10')][_0x501b('0xa6')](util[_0x501b('0x2c')](_0x501b('0xbd'),_0x501b('0x19f'),_0x3e28cc));};AGIVertices[_0x501b('0x13')][_0x501b('0x1a1')]=function(_0x202d58){logger[_0x501b('0x34')](util[_0x501b('0x2c')](_0x501b('0x1a2'),_0x202d58[_0x501b('0x3d')]));var _0x343f3f=this[_0x501b('0x5b')][_0x501b('0x72')](this,_0x202d58[_0x501b('0xb2')]);this[_0x501b('0x3b')][_0x501b('0x72')](this,_0x202d58,_0x202d58[_0x501b('0xb2')]);if(this[_0x501b('0xa2')](_0x202d58['variable_id'])){var _0x1fce12=this[_0x501b('0x14')]['sync'](this,_0x202d58[_0x501b('0xd0')]);if(_0x1fce12){this[_0x501b('0x10')][_0x501b('0x99')](_0x1fce12,_0x343f3f);return this[_0x501b('0x10')][_0x501b('0xa6')](util[_0x501b('0x2c')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x202d58['command'],_0x1fce12));}}return this['channel'][_0x501b('0xa6')](util[_0x501b('0x2c')](_0x501b('0x1a3'),_0x202d58[_0x501b('0xb2')]));};AGIVertices['prototype'][_0x501b('0x1a4')]=function(_0x4390fb){logger[_0x501b('0x34')](util['format'](_0x501b('0x1a5'),_0x4390fb[_0x501b('0x3d')]));_0x4390fb[_0x501b('0x61')]=_0x4390fb['text'][_0x501b('0x5d')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x501b('0xa2')](_0x4390fb['apiKey'])){return this[_0x501b('0x10')][_0x501b('0xa6')](_0x501b('0x1a6'));}if(!this['isConfigured'](_0x4390fb[_0x501b('0x61')])){return this[_0x501b('0x10')][_0x501b('0xa6')](_0x501b('0xa7'));}this[_0x501b('0x10')][_0x501b('0xa6')](util[_0x501b('0x2c')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x4390fb[_0x501b('0x61')]));var _0x17d0a6=this[_0x501b('0x5e')][_0x501b('0x72')](this,_0x4390fb);if(_0x17d0a6){this[_0x501b('0x10')][_0x501b('0xa6')](util[_0x501b('0x2c')](_0x501b('0x1a7'),_0x17d0a6));var _0x3e9cd4=this[_0x501b('0x10')]['streamFile'](_0x17d0a6);try{fs['unlink'](_0x17d0a6+_0x501b('0xef'));}catch(_0x2dc46b){logger['error'](_0x2dc46b);}return _0x3e9cd4;}return this[_0x501b('0x10')][_0x501b('0x30')](_0x4390fb,_0x501b('0x1a8'));};AGIVertices[_0x501b('0x13')][_0x501b('0x1a9')]=function(_0x1bcd61){logger[_0x501b('0x34')](util[_0x501b('0x2c')](_0x501b('0x1aa'),_0x1bcd61[_0x501b('0x3d')]));_0x1bcd61[_0x501b('0x61')]=_0x1bcd61['text'][_0x501b('0x5d')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x501b('0xa2')](_0x1bcd61[_0x501b('0x61')])){return this[_0x501b('0x10')][_0x501b('0xa6')](_0x501b('0xa7'));}this[_0x501b('0x10')][_0x501b('0xa6')](util[_0x501b('0x2c')]('Trying\x20Google\x20TTS\x20%s',_0x1bcd61['text']));var _0x2cf03d=this['googleTTS']['sync'](this,_0x1bcd61);if(_0x2cf03d){this[_0x501b('0x10')][_0x501b('0xa6')](util['format']('Google\x20TTS\x20%s\x20file\x20created',_0x2cf03d));var _0x2d3ec5=this['channel']['streamFile'](_0x2cf03d);try{fs['unlink'](_0x2cf03d+_0x501b('0xef'));}catch(_0x1df6b1){logger['error'](_0x1df6b1);}return _0x2d3ec5;}return this['channel'][_0x501b('0x30')](_0x1bcd61,_0x501b('0x1ab'));};AGIVertices[_0x501b('0x13')][_0x501b('0x1ac')]=function(_0x1a3417){logger[_0x501b('0x34')](util[_0x501b('0x2c')](_0x501b('0x1ad'),_0x1a3417['label']));if(!this[_0x501b('0xa2')](_0x1a3417[_0x501b('0x146')])){return this[_0x501b('0x10')][_0x501b('0x30')](_0x1a3417,_0x501b('0x145'));}logger[_0x501b('0x34')](util['format'](_0x501b('0x14b'),this[_0x501b('0x10')][_0x501b('0x40')],_0x1a3417[_0x501b('0x146')]));var _0x4f0ab7=this[_0x501b('0x56')][_0x501b('0x72')](this,_0x1a3417[_0x501b('0x146')]);if(_0x4f0ab7){logger[_0x501b('0x34')](util[_0x501b('0x2c')](_0x501b('0x147'),this['channel'][_0x501b('0x40')],_0x1a3417[_0x501b('0x146')]));this['channel'][_0x501b('0xa6')](util['format'](_0x501b('0x147'),this[_0x501b('0x10')]['callerid'],_0x1a3417[_0x501b('0x146')]));return{'code':0xc8,'result':'success'};}else{logger[_0x501b('0x34')](util[_0x501b('0x2c')](_0x501b('0x14c'),this['channel'][_0x501b('0x40')],_0x1a3417[_0x501b('0x146')]));this[_0x501b('0x10')][_0x501b('0xa6')](util[_0x501b('0x2c')](_0x501b('0x14c'),this[_0x501b('0x10')]['callerid'],_0x1a3417[_0x501b('0x146')]));return{'code':0xc8,'result':_0x501b('0x149')};}};AGIVertices['prototype'][_0x501b('0x1ae')]=function(_0x5fa261){logger[_0x501b('0x34')](util['format']('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x5fa261[_0x501b('0x3d')]));var _0x4f6862=this['channel'][_0x501b('0x5c')](_0x501b('0x1af'),[_0x5fa261[_0x501b('0x1b0')],_0x5fa261[_0x501b('0x7b')]]);if(_0x4f6862[_0x501b('0xa9')]===-0x1){return _0x4f6862;}return this[_0x501b('0x10')][_0x501b('0xa6')](util[_0x501b('0x2c')](_0x501b('0xbd'),_0x501b('0x1af'),_0x5fa261[_0x501b('0x1b0')]));};AGIVertices[_0x501b('0x13')][_0x501b('0x1b1')]=function(_0x38546e){logger[_0x501b('0x34')](util[_0x501b('0x2c')](_0x501b('0x1b2'),_0x38546e[_0x501b('0x3d')]));if(!this[_0x501b('0xa2')](_0x38546e[_0x501b('0xd0')])){return this[_0x501b('0x10')][_0x501b('0x30')](_0x38546e,'no\x20variable\x20selected');}var _0xc66c3d=this[_0x501b('0x14')]['sync'](this,_0x38546e['variable_id']);if(!_0xc66c3d){return this[_0x501b('0x10')]['error'](_0x38546e,_0x501b('0xd2'));}var _0x53384f=this[_0x501b('0x10')][_0x501b('0x14')](_0xc66c3d);return{'code':0xc8,'result':_0x53384f[_0x501b('0x9e')]?_0x53384f[_0x501b('0x9e')]:'-'};};String[_0x501b('0x13')][_0x501b('0x9d')]=function(_0x30cb5f,_0x4945a0){return this[_0x501b('0x9c')](_0x30cb5f)[_0x501b('0x1b3')](_0x4945a0);};module[_0x501b('0x1b4')]=AGIVertices; \ No newline at end of file +var _0x0915=['odbc','randomstring','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','getVariable','getVariableById','name','catch','getVoiceQueueById','then','prototype','getSquareProject','getSquareOdbc','getSquareOdbcById','getUser','getTrunk','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','IntervalId','interval','map','Intervals','getQueryOdbc','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','createSquareRecording','callerid','calleridname','context','extension','dnid','arg_1','file','createSquareMessage','createCmContact','isNil','callback_','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','toUpperCase','body','parse','headers','rawHeaders','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','options','googleDialogflow','dialogflow_language','sestekNDA','ispeechTTS','key','text','ispeech_tts_language','ispeechASR','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','isArray','length','isEmpty','saveRestApiResult','format','%s.%s','setVariable','split','extra','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','isConfigured','maxRetry','retry','noop','no\x20text\x20configured','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','grammar','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','add','delay','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','replace','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','sip_id','no\x20user\x20selected','no\x20user\x20found','SIP/%s','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','.wav','SestekNDA\x20Result\x20%s','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','opts','finally','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','response','maxdigit','test','mindigit','generate','hiddendigitspos','substr','goal','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','streamFile','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','%s/recordings/%s','beep','recordFile','intKey','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','no\x20appid\x20configured','no\x20appsecret\x20configured','NOBEEP','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','false','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','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','no\x20find\x20by\x20configured','failure','math','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','file_id','getData','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','getVoiceQueue','no\x20queue\x20found','indexOf','toLowerCase','macro','gosub','position','Executed\x20command\x20%s\x20%s','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','%s_STATUS_CODE','200','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','host','port','secure','auth','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','sms_text','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','yes','Answer','Skipped\x20Answer','subproject','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','replaceAll','join','exports','path','util','lodash','shelljs'];(function(_0x2d8469,_0x1302df){var _0x4e3f8b=function(_0x593901){while(--_0x593901){_0x2d8469['push'](_0x2d8469['shift']());}};_0x4e3f8b(++_0x1302df);}(_0x0915,0x1c5));var _0x5091=function(_0x29c3b2,_0x3c12ac){_0x29c3b2=_0x29c3b2-0x0;var _0x4b3aa7=_0x0915[_0x29c3b2];return _0x4b3aa7;};'use strict';var fs=require('fs');var path=require(_0x5091('0x0'));var util=require(_0x5091('0x1'));var _=require(_0x5091('0x2'));var sh=require(_0x5091('0x3'));var odbc=require(_0x5091('0x4'))();var rs=require(_0x5091('0x5'));var moment=require('moment');var Mustache=require('mustache');var rp=require('request-promise');var logger=require(_0x5091('0x6'))(_0x5091('0x7'));var config=require(_0x5091('0x8'));var scripts=require(_0x5091('0x9'));var FILES_PATH=_0x5091('0xa');var recursiveMapAttributes=['rawHeaders',_0x5091('0xb')];var verticesWithRetry=[_0x5091('0xc'),_0x5091('0xd'),_0x5091('0xe')];var AGIVertices=function(_0x32597b,_0x5abd05,_0x4af6c3){this[_0x5091('0xf')]=_0x32597b;this[_0x5091('0x10')]=_0x5abd05;this[_0x5091('0x11')]=_0x4af6c3;};AGIVertices['prototype'][_0x5091('0x12')]=function(_0x1adf9e,_0x3dab2e){this['rpc'][_0x5091('0x13')](_0x1adf9e)['then'](function(_0x1f87b9){_0x3dab2e(null,_0x1f87b9?_0x1f87b9[_0x5091('0x14')]:![]);})[_0x5091('0x15')](function(_0x37a654){_0x3dab2e(_0x37a654);});};AGIVertices['prototype']['getVoiceQueue']=function(_0x26c259,_0x200f12){this[_0x5091('0x10')][_0x5091('0x16')](_0x26c259)[_0x5091('0x17')](function(_0x462337){_0x200f12(null,_0x462337?_0x462337['name']:![]);})[_0x5091('0x15')](function(_0x4c0916){_0x200f12(_0x4c0916);});};AGIVertices[_0x5091('0x18')][_0x5091('0x19')]=function(_0x4c4eff,_0x3c8d00){this['rpc']['getSquareProjectById'](_0x4c4eff)[_0x5091('0x17')](function(_0x189ac6){_0x3c8d00(null,_0x189ac6?_0x189ac6['name']:![]);})[_0x5091('0x15')](function(_0x397657){_0x3c8d00(_0x397657);});};AGIVertices[_0x5091('0x18')][_0x5091('0x1a')]=function(_0x2bfaea,_0x2d8ba1){this[_0x5091('0x10')][_0x5091('0x1b')](_0x2bfaea)[_0x5091('0x17')](function(_0x415a2e){_0x2d8ba1(null,_0x415a2e?_0x415a2e['dsn']:![]);})[_0x5091('0x15')](function(_0x47aaf2){_0x2d8ba1(_0x47aaf2);});};AGIVertices[_0x5091('0x18')][_0x5091('0x1c')]=function(_0x16a323,_0x1408b2){this[_0x5091('0x10')]['getUserById'](_0x16a323)[_0x5091('0x17')](function(_0x9ee833){_0x1408b2(null,_0x9ee833?_0x9ee833['name']:![]);})[_0x5091('0x15')](function(_0x1798a4){_0x1408b2(_0x1798a4);});};AGIVertices[_0x5091('0x18')][_0x5091('0x1d')]=function(_0x33efb4,_0x4705ca){this['rpc'][_0x5091('0x1e')](_0x33efb4)['then'](function(_0x4656ed){_0x4705ca(null,_0x4656ed?_0x4656ed[_0x5091('0x14')]:![]);})[_0x5091('0x15')](function(_0x748ee0){_0x4705ca(_0x748ee0);});};AGIVertices[_0x5091('0x18')]['getSound']=function(_0x325117,_0x4adfc2){var _0x617661=this;this[_0x5091('0x10')][_0x5091('0x1f')](_0x325117)[_0x5091('0x17')](function(_0x329da3){_0x4adfc2(null,_0x329da3?_0x617661[_0x5091('0x20')](_0x329da3[_0x5091('0x21')]):![]);})[_0x5091('0x15')](function(_0x55f3db){_0x4adfc2(_0x55f3db);});};AGIVertices['prototype'][_0x5091('0x22')]=function(_0x1df65e,_0x3d7164){this[_0x5091('0x10')][_0x5091('0x23')](_0x1df65e)[_0x5091('0x17')](function(_0x53a6d7){_0x3d7164(null,_0x53a6d7?_0x53a6d7:![]);})[_0x5091('0x15')](function(_0x4d8631){_0x3d7164(_0x4d8631);});};AGIVertices[_0x5091('0x18')]['sendMailMessage']=function(_0x22b826,_0x14b62a,_0x335ad7){this[_0x5091('0x11')][_0x5091('0x24')](_0x22b826,_0x14b62a)['then'](function(){_0x335ad7(null);})['catch'](function(_0x436cbf){_0x335ad7(_0x436cbf);});};AGIVertices['prototype'][_0x5091('0x25')]=function(_0xddc8c1,_0x4a34b5){this[_0x5091('0x10')]['getIntervalById'](_0xddc8c1)[_0x5091('0x17')](function(_0x18a0f6){if(_0x18a0f6){if(_0x18a0f6[_0x5091('0x26')]){_0x4a34b5(null,[_0x18a0f6[_0x5091('0x27')]]);}else{_0x4a34b5(null,_[_0x5091('0x28')](_0x18a0f6[_0x5091('0x29')],_0x5091('0x27')));}}else{_0x4a34b5(null,![]);}})[_0x5091('0x15')](function(_0x5d192a){_0x4a34b5(_0x5d192a);});};AGIVertices[_0x5091('0x18')]['getSoundPath']=function(_0x2fa773){return util['format']('%s/sounds/converted/%s',FILES_PATH,_0x2fa773);};AGIVertices[_0x5091('0x18')][_0x5091('0x2a')]=function(_0x225635,_0xb8980d,_0x3c3505){odbc['open'](_0x225635,function(_0x231275){if(_0x231275){logger['error'](_0x5091('0x2b'),_0x231275);_0x3c3505(_0x231275);}else{logger[_0x5091('0x2c')](_0x5091('0x2d'));odbc[_0x5091('0x2e')](_0xb8980d,function(_0xd5d3be,_0xdc9187){if(_0xd5d3be){logger[_0x5091('0x2c')](_0x5091('0x2f'),_0xb8980d);_0x3c3505(_0xd5d3be);}else{logger[_0x5091('0x2c')](_0x5091('0x30'),_0xb8980d);odbc[_0x5091('0x31')](function(_0x406b76){if(_0x406b76){logger[_0x5091('0x32')](_0x5091('0x33'),_0x406b76);}_0x3c3505(null,_0xdc9187);});}});}});};AGIVertices[_0x5091('0x18')][_0x5091('0x34')]=function(_0x1560ea,_0x208a12){this[_0x5091('0x10')][_0x5091('0x35')](_0x1560ea)[_0x5091('0x17')](function(_0xf840ba){_0x208a12(null,_0xf840ba?_0xf840ba:![]);})[_0x5091('0x15')](function(_0x4c3fb){_0x208a12(_0x4c3fb);});};AGIVertices[_0x5091('0x18')][_0x5091('0x36')]=function(_0xa551bd,_0x33fcee){this[_0x5091('0x10')]['createSmsMessage'](_0xa551bd)[_0x5091('0x17')](function(_0x5d884f){_0x33fcee(null,_0x5d884f);})[_0x5091('0x15')](function(_0x1c09b0){_0x33fcee(_0x1c09b0);});};AGIVertices[_0x5091('0x18')]['createSquareDetailsReport']=function(_0x4472ae,_0x34ee64,_0x3c2ec4){this[_0x5091('0x10')][_0x5091('0x37')]({'uniqueid':this[_0x5091('0xf')][_0x5091('0x38')],'node':_0x4472ae[_0x5091('0x39')],'application':_0x4472ae[_0x5091('0x3a')],'data':_0x34ee64||null,'project_name':this[_0x5091('0xf')]['arg_1'],'callerid':this['channel']['callerid']})[_0x5091('0x17')](function(_0x59569c){if(_0x3c2ec4){_0x3c2ec4(null,_0x59569c);}})[_0x5091('0x15')](function(_0x572059){if(_0x3c2ec4){_0x3c2ec4(_0x572059);}});};AGIVertices[_0x5091('0x18')]['createSquareRecording']=function(_0x6de925,_0x11d3f1,_0x51fdcd,_0xf6bdf0){this[_0x5091('0x10')][_0x5091('0x3b')]({'uniqueid':this[_0x5091('0xf')][_0x5091('0x38')],'callerid':this['channel'][_0x5091('0x3c')],'calleridname':this[_0x5091('0xf')][_0x5091('0x3d')],'context':this['channel'][_0x5091('0x3e')],'extension':this['channel'][_0x5091('0x3f')],'priority':this['channel']['priority'],'accountcode':this[_0x5091('0xf')]['accountcode'],'dnid':this[_0x5091('0xf')][_0x5091('0x40')],'projectName':this[_0x5091('0xf')][_0x5091('0x41')],'saveName':_0x11d3f1,'filename':_0x6de925[_0x5091('0x42')]||_0x11d3f1,'savePath':_0x51fdcd})['then'](function(_0x5b9e52){_0xf6bdf0(null,_0x5b9e52);})[_0x5091('0x15')](function(_0x3e8f01){_0xf6bdf0(_0x3e8f01);});};AGIVertices[_0x5091('0x18')][_0x5091('0x43')]=function(_0x2af2be,_0x5f0685,_0x5a3397){this[_0x5091('0x10')]['createSquareMessage']({'uniqueid':this[_0x5091('0xf')][_0x5091('0x38')],'body':_0x2af2be,'direction':_0x5f0685})[_0x5091('0x17')](function(_0x5bfad6){if(_0x5a3397){_0x5a3397(null,_0x5bfad6);}})[_0x5091('0x15')](function(_0x380f3f){if(_0x5a3397){_0x5a3397(_0x380f3f);}});};AGIVertices[_0x5091('0x18')][_0x5091('0x44')]=function(_0x4a6834,_0x269c82){this[_0x5091('0x10')]['createCmContact']({'firstName':_['isEmpty'](_0x4a6834[_0x5091('0x14')])||_[_0x5091('0x45')](_0x4a6834[_0x5091('0x14')])?_0x5091('0x46')+Math['random']():_0x4a6834[_0x5091('0x14')],'lastName':_['isEmpty'](_0x4a6834[_0x5091('0x47')])||_[_0x5091('0x45')](_0x4a6834[_0x5091('0x47')])?null:_0x4a6834[_0x5091('0x47')],'phone':_0x4a6834[_0x5091('0x48')],'ListId':_0x4a6834[_0x5091('0x49')],'scheduledat':_0x4a6834[_0x5091('0x4a')],'callbackUniqueid':this['channel'][_0x5091('0x38')],'tags':_0x5091('0x4b'),'description':_0x5091('0x4c')+_0x4a6834[_0x5091('0x4a')][_0x5091('0x4d')](),'priority':_0x4a6834[_0x5091('0x4e')]})[_0x5091('0x17')](function(_0x498dfd){_0x269c82(null,_0x498dfd);})['catch'](function(_0x48d477){_0x269c82(_0x48d477);});};AGIVertices[_0x5091('0x18')][_0x5091('0x4f')]=function(_0x3d2790,_0x48d738){this['rpc'][_0x5091('0x50')](_0x3d2790)[_0x5091('0x17')](function(_0xf74ca1){_0x48d738(null,_0xf74ca1?_0xf74ca1[_0x5091('0x14')]:![]);})[_0x5091('0x15')](function(_0x388237){_0x48d738(_0x388237);});};AGIVertices['prototype'][_0x5091('0x51')]=function(_0x406545,_0x4d09b1,_0x27551d){var _0x1bc34={'role':_0x5091('0x52')};_0x1bc34[_0x406545]=this['channel'][_0x5091('0x3c')];this['rpc'][_0x5091('0x51')](_0x1bc34,_0x4d09b1,this['channel']['uniqueid'])['then'](function(_0x12dddf){_0x27551d(null,_[_0x5091('0x45')](_0x12dddf)?![]:!![]);})[_0x5091('0x15')](function(_0x115875){logger[_0x5091('0x32')](_0x115875);_0x27551d(null,![]);});};AGIVertices[_0x5091('0x18')][_0x5091('0x53')]=function(_0x10f101,_0x1f0d62){var _0x2434fd={'role':'agent'};_0x2434fd[_0x10f101]=this['channel']['callerid'];this['rpc'][_0x5091('0x53')](_0x2434fd)[_0x5091('0x17')](function(_0x1c0458){_0x1f0d62(null,_[_0x5091('0x45')](_0x1c0458)?![]:!![]);})[_0x5091('0x15')](function(_0x259dc5){logger[_0x5091('0x32')](_0x259dc5);_0x1f0d62(null,![]);});};AGIVertices[_0x5091('0x18')][_0x5091('0x54')]=function(_0x125c06,_0x57cb06){var _0x3003cd={'role':'agent'};_0x3003cd[_0x125c06]=this[_0x5091('0xf')]['callerid'];this[_0x5091('0x10')][_0x5091('0x54')](_0x3003cd)[_0x5091('0x17')](function(_0x4f8050){_0x57cb06(null,_[_0x5091('0x45')](_0x4f8050)?![]:!![]);})[_0x5091('0x15')](function(_0x533a0c){logger[_0x5091('0x32')](_0x533a0c);_0x57cb06(null,![]);});};AGIVertices[_0x5091('0x18')][_0x5091('0x55')]=function(_0xf6875f,_0x1ff014){var _0x33b116={'role':_0x5091('0x52')};_0x33b116[_0xf6875f]=this[_0x5091('0xf')][_0x5091('0x3c')];var _0x277e4a=_0xf6875f!=_0x5091('0x56')?util['format'](_0x5091('0x57'),_0x5091('0x58'),this['channel'][_0x5091('0x3c')]):undefined;this[_0x5091('0x10')]['agentLogin'](_0x33b116,_0x277e4a)[_0x5091('0x17')](function(_0x352b1b){_0x1ff014(null,_[_0x5091('0x45')](_0x352b1b)?![]:!![]);})[_0x5091('0x15')](function(_0x46621c){logger[_0x5091('0x32')](_0x46621c);_0x1ff014(null,![]);});};AGIVertices['prototype'][_0x5091('0x59')]=function(_0x12c99f,_0x358019){sh[_0x5091('0x5a')](_[_0x5091('0x5b')](_0x12c99f),function(_0x5da9c6,_0x3a510f){var _0x1b158f=_0x3a510f['replace'](/(\r\n|\n|\r)/gm,'');_0x358019(null,_0x1b158f);});};AGIVertices[_0x5091('0x18')][_0x5091('0x5c')]=function(_0x4ddf90,_0x1714c9){scripts[_0x5091('0x5c')](_0x4ddf90[_0x5091('0x5d')],_0x4ddf90[_0x5091('0x5e')]||'text',_0x4ddf90['text'],_0x4ddf90[_0x5091('0x5f')]||_0x5091('0x60'),_0x4ddf90[_0x5091('0x61')]||_0x5091('0x62'),_0x4ddf90[_0x5091('0x63')]||_0x5091('0x64'))[_0x5091('0x17')](function(_0x7ad9ba){_0x1714c9(null,_0x7ad9ba);})[_0x5091('0x15')](function(_0x497d2d){_0x1714c9(_0x497d2d);});};AGIVertices['prototype']['googleTTS']=function(_0x21bf4f,_0xc67e25){scripts[_0x5091('0x65')](_0x21bf4f['text'],_0x21bf4f[_0x5091('0x66')]||'en',0x1)[_0x5091('0x17')](function(_0x55bd06){_0xc67e25(null,_0x55bd06);})[_0x5091('0x15')](function(_0x113c0d){_0xc67e25(_0x113c0d);});};AGIVertices[_0x5091('0x18')][_0x5091('0x67')]=function(_0x3527cd,_0x113fb2){var _0xfdb70b={'uri':_0x3527cd[_0x5091('0x68')],'method':_0x3527cd[_0x5091('0x69')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3527cd[_0x5091('0x6a')])===_0x5091('0x6b')&&parseInt(_0x3527cd[_0x5091('0x6a')])>=0x1?parseInt(_0x3527cd['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x5091('0x6c')]([_0x5091('0x6d'),'PUT'],_0xfdb70b[_0x5091('0x69')][_0x5091('0x6e')]())){try{_0xfdb70b[_0x5091('0x6f')]=_0x3527cd[_0x5091('0xb')]?JSON[_0x5091('0x70')](_0x3527cd[_0x5091('0xb')]):{};}catch(_0x2f9103){logger[_0x5091('0x32')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x2f9103);}}try{_0xfdb70b[_0x5091('0x71')]=_0x3527cd[_0x5091('0x72')]?JSON['parse'](_0x3527cd[_0x5091('0x72')]):{};}catch(_0x397692){logger[_0x5091('0x32')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x397692);}if(_0x3527cd['computedVariables']){try{var _0x2a708f=require(_0x3527cd[_0x5091('0x73')])[_0x5091('0x74')](this,_0xfdb70b);_0xfdb70b[_0x5091('0x75')]=Mustache[_0x5091('0x76')](_0x3527cd[_0x5091('0x68')],_0x2a708f,{},['$$','$$']);if(_0xfdb70b[_0x5091('0x71')]){_0xfdb70b[_0x5091('0x71')]=JSON[_0x5091('0x70')](Mustache[_0x5091('0x76')](JSON[_0x5091('0x77')](_0xfdb70b['headers']),_0x2a708f,{},['$$','$$']));}if(_0xfdb70b[_0x5091('0x6f')]){_0xfdb70b[_0x5091('0x6f')]=JSON[_0x5091('0x70')](Mustache[_0x5091('0x76')](JSON[_0x5091('0x77')](_0xfdb70b[_0x5091('0x6f')]),_0x2a708f,{},['$$','$$']));}}catch(_0x35d2c5){logger[_0x5091('0x32')](_0x5091('0x78'),_0x35d2c5);}}rp(_0xfdb70b)[_0x5091('0x17')](function(_0x9238de){var _0x4bc513={'statusCode':_0x9238de[_0x5091('0x79')]||0xc8,'statusMessage':_0x9238de['statusMessage']||'OK','headers':_0x9238de[_0x5091('0x71')]||{},'body':_0x9238de[_0x5091('0x6f')]||{}};_0x113fb2(null,_0x4bc513);})[_0x5091('0x15')](function(_0x536f99){var _0x49757a={'statusCode':_0x536f99[_0x5091('0x79')]||0x1f4,'statusMessage':_0x536f99[_0x5091('0x7a')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x536f99[_0x5091('0x7b')][_0x5091('0x71')]||{},'body':_0x536f99[_0x5091('0x7b')]['body']||{}};_0x113fb2(null,_0x49757a);});};AGIVertices[_0x5091('0x18')][_0x5091('0x7c')]=function(_0x45f402,_0x2a7df9){scripts[_0x5091('0x7c')](this[_0x5091('0xf')][_0x5091('0x38')],_0x45f402['key'],_0x45f402['text'],_0x45f402[_0x5091('0x7d')]||'en')['then'](function(_0x32025c){_0x2a7df9(null,_0x32025c);})['catch'](function(_0x4781fd){_0x2a7df9(_0x4781fd);});};AGIVertices['prototype']['sestekNDA']=function(_0x3e5f01,_0x5e23b4){scripts[_0x5091('0x7e')](this[_0x5091('0xf')],_0x3e5f01)[_0x5091('0x17')](function(_0x5a9401){_0x5e23b4(null,_0x5a9401);})['catch'](function(_0x6de568){_0x5e23b4(_0x6de568);});};AGIVertices[_0x5091('0x18')][_0x5091('0x7f')]=function(_0x1292ae,_0x56cb37){scripts[_0x5091('0x7f')](_0x1292ae[_0x5091('0x80')],_0x1292ae[_0x5091('0x81')],_0x1292ae[_0x5091('0x82')]||_0x5091('0x60'),_0x1292ae['speed'])['then'](function(_0x15e6ce){_0x56cb37(null,_0x15e6ce);})[_0x5091('0x15')](function(_0x3c6d37){_0x56cb37(_0x3c6d37);});};AGIVertices[_0x5091('0x18')][_0x5091('0x83')]=function(_0xb415a,_0x1f583d,_0x2c14fe){scripts[_0x5091('0x83')](_0x1f583d,_0xb415a[_0x5091('0x80')],_0xb415a[_0x5091('0x84')]||_0x5091('0x60'),this['isConfigured'](_0xb415a[_0x5091('0x85')])?_0xb415a['model']:undefined)[_0x5091('0x17')](function(_0x4f2646){_0x2c14fe(null,_0x4f2646);})[_0x5091('0x15')](function(_0x41d4e5){_0x2c14fe(_0x41d4e5);});};AGIVertices[_0x5091('0x18')][_0x5091('0x86')]=function(_0x18fe10,_0x4e0052){scripts['awsPolly'](_0x18fe10[_0x5091('0x87')],_0x18fe10['aws_secret_access_key'],_0x18fe10[_0x5091('0x88')],_0x18fe10[_0x5091('0x89')]||_0x5091('0x8a'),_0x18fe10['text'],_0x18fe10[_0x5091('0x8b')]||_0x5091('0x81'))[_0x5091('0x17')](function(_0x251ab7){_0x4e0052(null,_0x251ab7);})[_0x5091('0x15')](function(_0x428fb8){_0x4e0052(_0x428fb8);});};AGIVertices[_0x5091('0x18')][_0x5091('0x8c')]=function(_0x90e585,_0x4e2513){scripts[_0x5091('0x8c')](this[_0x5091('0xf')][_0x5091('0x38')],_0x90e585[_0x5091('0x87')],_0x90e585[_0x5091('0x8d')],_0x90e585[_0x5091('0x8e')],_0x90e585[_0x5091('0x81')],_0x90e585[_0x5091('0x8f')])[_0x5091('0x17')](function(_0x2cfa9e){_0x4e2513(null,_0x2cfa9e);})[_0x5091('0x15')](function(_0x50dd48){_0x4e2513(_0x50dd48);});};AGIVertices[_0x5091('0x18')][_0x5091('0x90')]=function(_0x1ed201,_0x1fd5e3,_0x2c0f2d){scripts[_0x5091('0x90')](_0x1fd5e3,_0x1ed201[_0x5091('0x80')],_0x1ed201[_0x5091('0x91')]||'en-US')[_0x5091('0x17')](function(_0x28c819){_0x2c0f2d(null,_0x28c819);})[_0x5091('0x15')](function(_0x4ed33d){_0x2c0f2d(_0x4ed33d);});};AGIVertices[_0x5091('0x18')]['tildeASR']=function(_0x546011,_0xaa6511,_0x37614b){scripts[_0x5091('0x92')](_0xaa6511,_0x546011[_0x5091('0x93')],_0x546011[_0x5091('0x94')],_0x546011[_0x5091('0x75')])['then'](function(_0x3601d3){_0x37614b(null,_0x3601d3);})[_0x5091('0x15')](function(_0x17fb4b){_0x37614b(_0x17fb4b);});};AGIVertices[_0x5091('0x18')][_0x5091('0x95')]=function(_0x1111c8){var _0x492fa8=_[_0x5091('0x6c')](verticesWithRetry,_0x1111c8['agicommand'])?_0x1111c8:_['clone'](_0x1111c8);for(var _0x2961f7 in _0x492fa8){if(_0x492fa8['hasOwnProperty'](_0x2961f7)){if(_0x492fa8[_0x2961f7]&&_[_0x5091('0x96')](_0x492fa8[_0x2961f7])){if(_['includes'](recursiveMapAttributes,_0x2961f7)){_0x492fa8[_0x2961f7]=this[_0x5091('0x97')](_0x492fa8[_0x2961f7]);}else{_0x492fa8[_0x2961f7]=this[_0x5091('0x98')](_0x492fa8[_0x2961f7]);}}}}return _0x492fa8;};AGIVertices['prototype'][_0x5091('0x99')]=function(_0x1304f8){for(var _0x58ba22 in _0x1304f8){if(_0x1304f8[_0x5091('0x9a')](_0x58ba22)){if(_[_0x5091('0x9b')](_0x1304f8[_0x58ba22])){this['recursiveNodeIndex'](_0x1304f8[_0x58ba22]);}else if(_[_0x5091('0x9c')](_0x1304f8[_0x58ba22])){for(var _0x11c50b=0x0;_0x11c50b<_0x1304f8[_0x58ba22][_0x5091('0x9d')];_0x11c50b++){this[_0x5091('0x99')](_0x1304f8[_0x58ba22][_0x11c50b]);}}else if(_[_0x5091('0x96')](_0x1304f8[_0x58ba22])){_0x1304f8[_0x58ba22]=this['replaceAllVariables'](_0x1304f8[_0x58ba22]);}}}};AGIVertices[_0x5091('0x18')]['saveRestApiResult']=function(_0x522c18,_0x1e9c29){for(var _0x3ea320 in _0x522c18){if(_0x522c18['hasOwnProperty'](_0x3ea320)){if(_[_0x5091('0x9b')](_0x522c18[_0x3ea320])){if(!_[_0x5091('0x9e')](_0x522c18[_0x3ea320])){this[_0x5091('0x9f')](_0x522c18[_0x3ea320],util[_0x5091('0xa0')](_0x5091('0xa1'),_0x1e9c29,_0x3ea320));}}else if(_[_0x5091('0x9c')](_0x522c18[_0x3ea320])){for(var _0x457086=0x0;_0x457086<_0x522c18[_0x3ea320][_0x5091('0x9d')];_0x457086++){this[_0x5091('0x9f')](_0x522c18[_0x3ea320][_0x457086],util[_0x5091('0xa0')](_0x5091('0xa1'),_0x1e9c29,_0x3ea320+'['+_0x457086+']'));}}else{if(!_[_0x5091('0x45')](_0x522c18[_0x3ea320])){this['channel'][_0x5091('0xa2')](util[_0x5091('0xa0')](_0x5091('0xa1'),_0x1e9c29,_0x3ea320),_0x522c18[_0x3ea320]);}}}}};AGIVertices[_0x5091('0x18')][_0x5091('0x97')]=function(_0x3bbbb8){try{var _0x2943bf=JSON[_0x5091('0x70')](_0x3bbbb8);this[_0x5091('0x99')](_0x2943bf);return JSON[_0x5091('0x77')](_0x2943bf);}catch(_0x37412a){return this[_0x5091('0x98')](_0x3bbbb8);}};AGIVertices[_0x5091('0x18')][_0x5091('0x98')]=function(_0x228fbd){var _0x5c89ae=_0x228fbd[_0x5091('0xa3')]('{');for(var _0x39ef72=0x1;_0x39ef72<_0x5c89ae[_0x5091('0x9d')];_0x39ef72+=0x1){var _0x47fd12=_0x5c89ae[_0x39ef72][_0x5091('0xa3')]('}');if(_0x47fd12['length']>0x1){_0x228fbd=_0x228fbd['replaceAll']('{'+_0x47fd12[0x0]+'}',this[_0x5091('0xf')][_0x5091('0x12')](_0x47fd12[0x0])[_0x5091('0xa4')]||_0x47fd12[0x0]);}}if(_0x5c89ae[_0x5091('0x9d')]===0x1){return _0x228fbd[_0x5091('0x4d')]();}return this['replaceAllVariables'](_0x228fbd);};AGIVertices[_0x5091('0x18')]['getAndSetVariable']=function(_0x4806be,_0x2b57bb){var _0x81f08c=this[_0x5091('0xf')][_0x5091('0x12')](_0x4806be);if(_0x81f08c[_0x5091('0xa5')]===-0x1){return _0x81f08c;}logger[_0x5091('0x2c')](util[_0x5091('0xa0')](_0x5091('0xa6'),_0x2b57bb,_0x81f08c[_0x5091('0xa4')]));return this[_0x5091('0xf')][_0x5091('0xa2')](_0x2b57bb,_0x81f08c[_0x5091('0xa4')]);};AGIVertices['prototype'][_0x5091('0xa7')]=function(_0x54e7b0){return _0x54e7b0&&_0x54e7b0!=='0'&&_0x54e7b0!=='-1'&&_0x54e7b0!=='';};AGIVertices['prototype'][_0x5091('0xa8')]=function(_0x6f3e7){this[_0x5091('0x37')][_0x5091('0x74')](this,_0x6f3e7,'-');_0x6f3e7[_0x5091('0xa9')]=_0x6f3e7[_0x5091('0xa8')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x5091('0x18')]['mrcpsynth']=function(_0x157392){logger[_0x5091('0x2c')](util[_0x5091('0xa0')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x157392[_0x5091('0x39')]));if(!this[_0x5091('0xa7')](_0x157392[_0x5091('0x81')])){return this[_0x5091('0xf')][_0x5091('0xaa')](_0x5091('0xab'));}var _0x4cadb9='\x22'+_0x157392['text']+'\x22';if(this['isConfigured'](_0x157392[_0x5091('0x7b')])){_0x4cadb9+=','+_0x157392[_0x5091('0x7b')];}var _0x44b1a1=this[_0x5091('0xf')][_0x5091('0x5a')]('MRCPSynth',_0x4cadb9);if(_0x44b1a1['result']===-0x1){return _0x44b1a1;}return this['channel'][_0x5091('0xaa')](util[_0x5091('0xa0')]('Executed\x20command\x20MRCPSynth\x20%s',_0x4cadb9));};AGIVertices[_0x5091('0x18')][_0x5091('0xac')]=function(_0x2ebfbc){logger[_0x5091('0x2c')](util['format'](_0x5091('0xad'),_0x2ebfbc[_0x5091('0x39')]));if(!this[_0x5091('0xa7')](_0x2ebfbc['grammar'])){return this[_0x5091('0xf')][_0x5091('0xaa')](_0x5091('0xae'));}var _0x22721=_0x2ebfbc[_0x5091('0xaf')];if(this[_0x5091('0xa7')](_0x2ebfbc[_0x5091('0x7b')])){_0x22721+=','+_0x2ebfbc[_0x5091('0x7b')];}var _0x9bf5a5=this['channel'][_0x5091('0x5a')](_0x5091('0xb0'),_0x22721);if(_0x9bf5a5[_0x5091('0xa5')]===-0x1){return _0x9bf5a5;}var _0x265336=this[_0x5091('0xb1')](_0x5091('0xb2'),'MRCP_RECOG_CONFIDENCE');if(_0x265336[_0x5091('0xa5')]===-0x1){return _0x265336;}var _0x502e4b=this[_0x5091('0xb1')](_0x5091('0xb3'),_0x5091('0xb4'));if(_0x502e4b[_0x5091('0xa5')]===-0x1){return _0x502e4b;}var _0x142086=this[_0x5091('0xb1')](_0x5091('0xb5'),_0x5091('0xb6'));if(_0x142086[_0x5091('0xa5')]===-0x1){return _0x142086;}return this[_0x5091('0xf')][_0x5091('0xaa')](util[_0x5091('0xa0')](_0x5091('0xb7'),_0x22721));};AGIVertices[_0x5091('0x18')][_0x5091('0x7')]=function(_0x30f20d){logger[_0x5091('0x2c')](util[_0x5091('0xa0')](_0x5091('0xb8'),_0x30f20d['label']));return this[_0x5091('0xf')][_0x5091('0x7')]([_0x30f20d['command'],_0x30f20d['args']]);};AGIVertices[_0x5091('0x18')][_0x5091('0xb9')]=function(_0x2864f7){logger['info'](util['format'](_0x5091('0xba'),_0x2864f7[_0x5091('0x39')]));if(this[_0x5091('0xa7')](_0x2864f7[_0x5091('0x6a')])){logger[_0x5091('0x2c')](util[_0x5091('0xa0')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x2864f7[_0x5091('0x6a')]));var _0x124e1c=this[_0x5091('0xf')][_0x5091('0xbb')](_0x2864f7[_0x5091('0x6a')]);if(_0x124e1c['result']===-0x1){return _0x124e1c;}}return this[_0x5091('0xf')][_0x5091('0xb9')]();};AGIVertices[_0x5091('0x18')][_0x5091('0x4b')]=function(_0x4ae62d){logger['info'](util[_0x5091('0xa0')](_0x5091('0xbc'),_0x4ae62d[_0x5091('0x39')]));if(!this[_0x5091('0xa7')](_0x4ae62d[_0x5091('0x49')])){return this[_0x5091('0xf')][_0x5091('0x32')](_0x4ae62d,_0x5091('0xbd'));}_0x4ae62d[_0x5091('0x4a')]=moment();if(this[_0x5091('0xa7')](_0x4ae62d['delay'])){_0x4ae62d[_0x5091('0x4a')]=moment()[_0x5091('0xbe')](_0x4ae62d[_0x5091('0xbf')],'minutes');}if(!this['isConfigured'](_0x4ae62d[_0x5091('0x4e')])){_0x4ae62d[_0x5091('0x4e')]=0x2;}this[_0x5091('0x44')][_0x5091('0x74')](this,_0x4ae62d);return this[_0x5091('0xf')][_0x5091('0xaa')](util['format'](_0x5091('0xc0'),_0x4ae62d[_0x5091('0x48')],_0x4ae62d[_0x5091('0x49')],_0x4ae62d[_0x5091('0x4a')]));};AGIVertices[_0x5091('0x18')][_0x5091('0xc1')]=function(_0x2f90d1){logger['info'](util[_0x5091('0xa0')](_0x5091('0xc2'),_0x2f90d1[_0x5091('0x39')]));var _0xb3cf94=this[_0x5091('0xf')]['exec'](_0x2f90d1[_0x5091('0xc3')],_0x2f90d1['options']);if(_0xb3cf94['result']===-0x1){return _0xb3cf94;}return this[_0x5091('0xf')]['noop'](util[_0x5091('0xa0')]('Executed\x20command\x20%s\x20%s',_0x2f90d1['application'],_0x2f90d1[_0x5091('0x7b')]));};AGIVertices[_0x5091('0x18')]['lumenvoxtts']=function(_0x250ee5){logger[_0x5091('0x2c')](util['format']('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x250ee5[_0x5091('0x39')]));if(!this[_0x5091('0xa7')](_0x250ee5[_0x5091('0x81')])){return this[_0x5091('0xf')]['noop']('no\x20text\x20configured');}var _0x44cb43='\x22'+_0x250ee5[_0x5091('0x81')]+'\x22';if(this[_0x5091('0xa7')](_0x250ee5[_0x5091('0x7b')])){_0x44cb43+=','+_0x250ee5[_0x5091('0x7b')];}var _0x4d9b41=this[_0x5091('0xf')][_0x5091('0x5a')](_0x5091('0xc4'),_0x44cb43);if(_0x4d9b41[_0x5091('0xa5')]===-0x1){return _0x4d9b41;}return this['channel'][_0x5091('0xaa')](util[_0x5091('0xa0')](_0x5091('0xc5'),_0x44cb43));};AGIVertices[_0x5091('0x18')][_0x5091('0xc6')]=function(_0x1bcbb2){logger[_0x5091('0x2c')](util[_0x5091('0xa0')](_0x5091('0xc7'),_0x1bcbb2[_0x5091('0x39')]));if(!this[_0x5091('0xa7')](_0x1bcbb2[_0x5091('0x81')])){return this[_0x5091('0xf')][_0x5091('0xaa')](_0x5091('0xab'));}var _0x2d6cad='\x22'+_0x1bcbb2[_0x5091('0x81')]+'\x22';if(this['isConfigured'](_0x1bcbb2[_0x5091('0x7b')])){_0x2d6cad+=','+_0x1bcbb2[_0x5091('0x7b')];}var _0x2b31cf=this['channel']['exec'](_0x5091('0xc4'),_0x2d6cad);if(_0x2b31cf[_0x5091('0xa5')]===-0x1){return _0x2b31cf;}return this[_0x5091('0xf')][_0x5091('0xaa')](util[_0x5091('0xa0')](_0x5091('0xc5'),_0x2d6cad));};AGIVertices[_0x5091('0x18')][_0x5091('0xc8')]=function(_0x5021ff){logger[_0x5091('0x2c')](util[_0x5091('0xa0')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x5021ff[_0x5091('0x39')]));if(!this[_0x5091('0xa7')](_0x5021ff[_0x5091('0xaf')])){return this[_0x5091('0xf')][_0x5091('0xaa')](_0x5091('0xae'));}var _0x1d23e2=_0x5021ff['grammar'];if(this['isConfigured'](_0x5021ff[_0x5091('0x7b')])){_0x1d23e2+=','+_0x5021ff[_0x5091('0x7b')];}var _0x331ef2=this[_0x5091('0xf')][_0x5091('0x5a')](_0x5091('0xb0'),_0x1d23e2);if(_0x331ef2[_0x5091('0xa5')]===-0x1){return _0x331ef2;}var _0x31caa3=this[_0x5091('0xb1')](_0x5091('0xb2'),_0x5091('0xc9'));if(_0x31caa3[_0x5091('0xa5')]===-0x1){return _0x31caa3;}var _0x188faf=this['getAndSetVariable'](_0x5091('0xb3'),_0x5091('0xca'));if(_0x188faf['result']===-0x1){return _0x188faf;}var _0x135668=this['getAndSetVariable'](_0x5091('0xb5'),_0x5091('0xcb'));if(_0x135668[_0x5091('0xa5')]===-0x1){return _0x135668;}return this[_0x5091('0xf')][_0x5091('0xaa')](util[_0x5091('0xa0')](_0x5091('0xb7'),_0x1d23e2));};AGIVertices[_0x5091('0x18')][_0x5091('0xcc')]=function(_0x226b70){logger['info'](util[_0x5091('0xa0')](_0x5091('0xcd'),_0x226b70[_0x5091('0x39')]));if(!this[_0x5091('0xa7')](_0x226b70[_0x5091('0xaf')])){return this[_0x5091('0xf')][_0x5091('0xaa')](_0x5091('0xae'));}var _0xbfff59=_0x226b70[_0x5091('0xaf')];if(this[_0x5091('0xa7')](_0x226b70['options'])){_0xbfff59+=','+_0x226b70[_0x5091('0x7b')];}var _0x147026=this['channel'][_0x5091('0x5a')](_0x5091('0xb0'),_0xbfff59);if(_0x147026[_0x5091('0xa5')]===-0x1){return _0x147026;}var _0x4bd6e1=this[_0x5091('0xb1')](_0x5091('0xb2'),_0x5091('0xce'));if(_0x4bd6e1[_0x5091('0xa5')]===-0x1){return _0x4bd6e1;}var _0x52091d=this[_0x5091('0xb1')](_0x5091('0xb3'),_0x5091('0xcf'));if(_0x52091d[_0x5091('0xa5')]===-0x1){return _0x52091d;}var _0x18aa06=this['getAndSetVariable'](_0x5091('0xb5'),_0x5091('0xd0'));if(_0x18aa06[_0x5091('0xa5')]===-0x1){return _0x18aa06;}return this[_0x5091('0xf')][_0x5091('0xaa')](util[_0x5091('0xa0')](_0x5091('0xb7'),_0xbfff59));};AGIVertices['prototype']['database']=function(_0x3d32be){logger['info'](util[_0x5091('0xa0')](_0x5091('0xd1'),_0x3d32be[_0x5091('0x39')]));if(!this[_0x5091('0xa7')](_0x3d32be[_0x5091('0xd2')])){return this['channel']['error'](_0x3d32be,_0x5091('0xd3'));}var _0x5301d8=this[_0x5091('0x1a')]['sync'](this,_0x3d32be[_0x5091('0xd2')]);if(!_0x5301d8){return this[_0x5091('0xf')][_0x5091('0x32')](_0x3d32be,_0x5091('0xd4'));}if(!this[_0x5091('0xa7')](_0x3d32be[_0x5091('0x2e')])){return this['channel']['error'](_0x3d32be,_0x5091('0xd5'));}var _0x4a494b=_0x3d32be[_0x5091('0x2e')][_0x5091('0xd6')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x5091('0xaa')](util[_0x5091('0xa0')]('query:\x20%s',_0x4a494b));var _0x59914d=this[_0x5091('0x2a')][_0x5091('0x74')](this,_0x5301d8,_0x4a494b);this[_0x5091('0x37')][_0x5091('0x74')](this,_0x3d32be,_0x4a494b);if(!this[_0x5091('0xa7')](_0x3d32be[_0x5091('0xd7')])){return this[_0x5091('0xf')][_0x5091('0xaa')](_0x5091('0xd8'));}var _0x59ae4d=this['getVariable'][_0x5091('0x74')](this,_0x3d32be[_0x5091('0xd7')]);if(!_0x59ae4d){return this[_0x5091('0xf')][_0x5091('0x32')](_0x3d32be,_0x5091('0xd9'));}var _0x15e83f=this;_0x59914d['forEach'](function(_0x20993d,_0x3aae07){Object['keys'](_0x20993d)[_0x5091('0xda')](function(_0x44cb4b){_0x15e83f[_0x5091('0xf')][_0x5091('0xa2')](util['format'](_0x5091('0xdb'),_0x59ae4d,_0x3aae07,_0x44cb4b),_0x20993d[_0x44cb4b]);});});this[_0x5091('0xf')][_0x5091('0xa2')](util['format'](_0x5091('0xdc'),_0x59ae4d),_0x59914d[_0x5091('0x9d')]);return this[_0x5091('0xf')]['noop'](util[_0x5091('0xa0')](_0x5091('0xdd'),_0x59ae4d));};AGIVertices[_0x5091('0x18')][_0x5091('0xde')]=function(_0x3ed27b){logger[_0x5091('0xdf')](util[_0x5091('0xa0')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x3ed27b[_0x5091('0x39')]));if(!this[_0x5091('0xa7')](_0x3ed27b[_0x5091('0xe0')])){return this['channel'][_0x5091('0x32')](_0x3ed27b,_0x5091('0xe1'));}var _0x6b3cb5=this[_0x5091('0x1c')][_0x5091('0x74')](this,_0x3ed27b['sip_id']);if(!_0x6b3cb5){return this[_0x5091('0xf')][_0x5091('0x32')](_0x3ed27b,_0x5091('0xe2'));}var _0xcfd15c=this[_0x5091('0xf')][_0x5091('0x5a')]('DIAL',[util[_0x5091('0xa0')](_0x5091('0xe3'),_0x6b3cb5),_0x3ed27b[_0x5091('0x6a')],_0x3ed27b['opts'],_0x3ed27b[_0x5091('0x68')]]);if(_0xcfd15c['result']===-0x1){return _0xcfd15c;}return this[_0x5091('0xf')][_0x5091('0xaa')](util[_0x5091('0xa0')](_0x5091('0xe4'),_0x5091('0xe5')));};AGIVertices[_0x5091('0x18')][_0x5091('0xe6')]=function(_0x16de86){logger[_0x5091('0x2c')](util[_0x5091('0xa0')](_0x5091('0xe7'),_0x16de86['label']));if(!this[_0x5091('0xa7')](_0x16de86[_0x5091('0x80')])){return this['channel']['noop']('no\x20key\x20configured');}if(!this[_0x5091('0xa7')](_0x16de86[_0x5091('0x81')])){return this['channel']['noop'](_0x5091('0xab'));}this[_0x5091('0xf')][_0x5091('0xe8')]=!![];this[_0x5091('0x37')](_0x16de86);this[_0x5091('0x43')](_0x16de86[_0x5091('0x81')],'in');this[_0x5091('0xf')][_0x5091('0xaa')](util[_0x5091('0xa0')]('Trying\x20Dialogflow:\x20%s',_0x16de86['text']));var _0x2697b9=this[_0x5091('0x7c')][_0x5091('0x74')](this,_0x16de86);if(_0x2697b9){for(var _0x598368 in _0x2697b9){if(_0x2697b9[_0x5091('0x9a')](_0x598368)){this['channel'][_0x5091('0xa2')](util['format']('DIALOGFLOW_%s',_0x598368['toUpperCase']()),_0x2697b9[_0x598368]);}}this[_0x5091('0x43')](_0x2697b9[_0x5091('0xe9')],_0x5091('0xea'));return this[_0x5091('0xf')][_0x5091('0xaa')](util[_0x5091('0xa0')](_0x5091('0xeb'),_0x2697b9[_0x5091('0xe9')]));}return this[_0x5091('0xf')][_0x5091('0x32')](_0x16de86,_0x5091('0xec'));};AGIVertices['prototype'][_0x5091('0xed')]=function(_0x383c45){logger['info'](util[_0x5091('0xa0')](_0x5091('0xee'),_0x383c45[_0x5091('0x39')]));if(!this['isConfigured'](_0x383c45[_0x5091('0xef')])){return this[_0x5091('0xf')][_0x5091('0xaa')](_0x5091('0xf0'));}if(!this[_0x5091('0xa7')](_0x383c45[_0x5091('0xf1')])){return this['channel'][_0x5091('0xaa')](_0x5091('0xf2'));}if(!this[_0x5091('0xa7')](_0x383c45[_0x5091('0xf3')])){return this[_0x5091('0xf')]['noop'](_0x5091('0xf4'));}if(!this[_0x5091('0xa7')](_0x383c45['ndassistant_url'])){return this[_0x5091('0xf')]['noop'](_0x5091('0xab'));}this[_0x5091('0xf')][_0x5091('0xe8')]=!![];this[_0x5091('0x37')](_0x383c45);this[_0x5091('0x43')](_0x383c45[_0x5091('0x81')],'in');this['channel'][_0x5091('0xaa')](util[_0x5091('0xa0')](_0x5091('0xf5'),_0x383c45['text']));var _0x2e1acd=this[_0x5091('0x7e')][_0x5091('0x74')](this,_0x383c45);if(_0x2e1acd){for(var _0x5aacaa in _0x2e1acd){if(_0x2e1acd['hasOwnProperty'](_0x5aacaa)){this[_0x5091('0xf')][_0x5091('0xa2')](util[_0x5091('0xa0')](_0x5091('0xf6'),_0x5aacaa[_0x5091('0x6e')]()),_0x2e1acd[_0x5aacaa]);}}this[_0x5091('0x43')](_0x2e1acd[_0x5091('0xe9')],_0x5091('0xea'));if(_0x2e1acd[_0x5091('0xf7')]){this['channel'][_0x5091('0xaa')](util[_0x5091('0xa0')](_0x5091('0xf8'),_0x2e1acd[_0x5091('0xf7')]));var _0x294f53=this[_0x5091('0xf')]['streamFile'](_0x2e1acd[_0x5091('0xf7')]);try{fs[_0x5091('0xf9')](_0x2e1acd[_0x5091('0xf7')]+_0x5091('0xfa'));}catch(_0x42af10){logger[_0x5091('0x32')](_0x42af10);}return _0x294f53;}else{return this[_0x5091('0xf')][_0x5091('0xaa')](util['format'](_0x5091('0xfb'),_0x2e1acd[_0x5091('0xe9')]));}}return this[_0x5091('0xf')][_0x5091('0x32')](_0x383c45,'SestekNDA\x20is\x20unreachable');};AGIVertices['prototype']['end']=function(_0x3f2aeb){logger['info'](util[_0x5091('0xa0')](_0x5091('0xfc'),_0x3f2aeb['label']));return this['channel'][_0x5091('0xaa')](_0x5091('0xfd'));};AGIVertices[_0x5091('0x18')][_0x5091('0xfe')]=function(_0x1663f7){logger['info'](util[_0x5091('0xa0')](_0x5091('0xff'),_0x1663f7['label']));var _0x3ed23b='';if(_0x1663f7[_0x5091('0x100')]){if(!this[_0x5091('0xa7')](_0x1663f7['trunk_id'])){return this[_0x5091('0xf')][_0x5091('0x32')](_0x1663f7,_0x5091('0x101'));}else{var _0x26a57c=parseInt(_0x1663f7[_0x5091('0x100')],0xa);if(isNaN(_0x26a57c)){_0x3ed23b=_0x1663f7[_0x5091('0x100')];}else{_0x3ed23b=this[_0x5091('0x1d')][_0x5091('0x74')](this,_0x1663f7['trunk_id']);if(!_0x3ed23b){return this['channel'][_0x5091('0x32')](_0x1663f7,'no\x20trunk\x20found');}}}}else if(_0x1663f7[_0x5091('0x102')]){_0x3ed23b=_0x1663f7[_0x5091('0x102')];}else{return this[_0x5091('0xf')][_0x5091('0x32')](_0x1663f7,_0x5091('0x101'));}var _0x437c74=this[_0x5091('0xf')][_0x5091('0x5a')](_0x5091('0xe5'),[util[_0x5091('0xa0')](_0x5091('0x103'),_0x3ed23b,_0x1663f7['phone']),_0x1663f7[_0x5091('0x6a')],_0x1663f7[_0x5091('0x104')],_0x1663f7['url']]);if(_0x437c74[_0x5091('0xa5')]===-0x1){return _0x437c74;}return this['channel'][_0x5091('0xaa')](util['format'](_0x5091('0xe4'),_0x5091('0xe5')));};AGIVertices[_0x5091('0x18')][_0x5091('0x105')]=function(_0x5be0a0){logger[_0x5091('0x2c')](util[_0x5091('0xa0')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x5be0a0[_0x5091('0x39')]));return this[_0x5091('0xf')][_0x5091('0xaa')](_0x5091('0x105'));};AGIVertices[_0x5091('0x18')][_0x5091('0xd')]=function(_0x3bbd8c){logger[_0x5091('0x2c')](util[_0x5091('0xa0')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x3bbd8c[_0x5091('0x39')]));if(_0x3bbd8c['retry']===0x0){return this[_0x5091('0xa8')](_0x3bbd8c);}_0x3bbd8c[_0x5091('0xa9')]-=0x1;if(!this[_0x5091('0xa7')](_0x3bbd8c['file_id'])){return this[_0x5091('0xf')][_0x5091('0x32')](_0x3bbd8c,_0x5091('0x106'));}var _0x3d313e=this[_0x5091('0x107')]['sync'](this,_0x3bbd8c['file_id']);if(!_0x3d313e){return this['channel'][_0x5091('0x32')](_0x3bbd8c,_0x5091('0x108'));}if(!this[_0x5091('0xa7')](_0x3bbd8c[_0x5091('0xd7')])){return this['channel'][_0x5091('0x32')](_0x5091('0xd8'));}var _0x43378f=this['channel']['getData'](_0x3d313e,_0x3bbd8c[_0x5091('0x109')],_0x3bbd8c[_0x5091('0x10a')]);var _0x917933=_0x43378f[_0x5091('0xa5')]?_0x43378f[_0x5091('0xa5')]['toString']():'';logger[_0x5091('0x2c')](_0x5091('0x10b'),JSON[_0x5091('0x77')](_0x43378f));if(_0x43378f[_0x5091('0xa5')]===-0x1){this[_0x5091('0x37')][_0x5091('0x74')](this,_0x3bbd8c,_0x917933);return _0x43378f;}else if(_0x43378f['extra']==='timeout'){_0x43378f[_0x5091('0xa5')]=_0x917933[_0x5091('0x9d')]>=parseInt(_0x3bbd8c[_0x5091('0x10c')])?'x':'i';}else{_0x43378f['result']=_0x917933[_0x5091('0x9d')]>=parseInt(_0x3bbd8c[_0x5091('0x10c')])&&_0x917933['length']<=parseInt(_0x3bbd8c[_0x5091('0x10a')])?'x':'i';}var _0x22ac0c=this[_0x5091('0x12')][_0x5091('0x74')](this,_0x3bbd8c['variable_id']);if(!_0x22ac0c){return this[_0x5091('0xf')]['error'](_0x3bbd8c,_0x5091('0xd9'));}this[_0x5091('0xf')]['setVariable'](_0x22ac0c,_0x917933);if(this[_0x5091('0xa7')](_0x3bbd8c['hiddendigitsnum'])){var _0x27efd1=parseInt(_0x3bbd8c['hiddendigitsnum'],0xa);var _0x32e909=rs[_0x5091('0x10d')]({'charset':'*','length':_0x27efd1});var _0x298780=_0x917933['length'];if(_0x298780>0x0){if(_0x298780>_0x27efd1){this[_0x5091('0x37')][_0x5091('0x74')](this,_0x3bbd8c,_0x3bbd8c[_0x5091('0x10e')]==='first'?_0x32e909+_0x917933[_0x5091('0x10f')](_0x27efd1):_0x917933[_0x5091('0x10f')](0x0,_0x298780-_0x27efd1)+_0x32e909);}else{this[_0x5091('0x37')][_0x5091('0x74')](this,_0x3bbd8c,rs[_0x5091('0x10d')]({'charset':'*','length':_0x298780}));}}else{this[_0x5091('0x37')]['sync'](this,_0x3bbd8c,'');}}else{this['createSquareDetailsReport'][_0x5091('0x74')](this,_0x3bbd8c,_0x917933);}return _0x43378f;};AGIVertices['prototype'][_0x5091('0xe')]=function(_0x41681e){logger[_0x5091('0x2c')](util[_0x5091('0xa0')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x41681e[_0x5091('0x39')]));return this[_0x5091('0xd')](_0x41681e);};AGIVertices['prototype'][_0x5091('0x110')]=function(_0x1cd9c0){logger[_0x5091('0x2c')](util[_0x5091('0xa0')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x1cd9c0['label']));this[_0x5091('0x37')][_0x5091('0x74')](this,_0x1cd9c0,_0x1cd9c0[_0x5091('0x111')]);return this[_0x5091('0xf')]['noop'](util[_0x5091('0xa0')](_0x5091('0x112'),_0x1cd9c0[_0x5091('0x111')]));};AGIVertices['prototype']['awspolly']=function(_0x351a8f){logger[_0x5091('0x2c')](util[_0x5091('0xa0')](_0x5091('0x113'),_0x351a8f[_0x5091('0x39')]));if(!this[_0x5091('0xa7')](_0x351a8f[_0x5091('0x87')])||!this[_0x5091('0xa7')](_0x351a8f[_0x5091('0x8d')])){return this[_0x5091('0xf')][_0x5091('0xaa')](_0x5091('0x114'));}if(!this[_0x5091('0xa7')](_0x351a8f[_0x5091('0x81')])){return this[_0x5091('0xf')][_0x5091('0xaa')](_0x5091('0xab'));}this[_0x5091('0xf')][_0x5091('0xaa')](util[_0x5091('0xa0')](_0x5091('0x115'),_0x351a8f['text']));var _0x616fdb=this[_0x5091('0x86')]['sync'](this,_0x351a8f);if(_0x616fdb){this['channel'][_0x5091('0xaa')](util[_0x5091('0xa0')]('aws\x20Polly\x20%s\x20file\x20created',_0x616fdb));var _0x34114b=this[_0x5091('0xf')][_0x5091('0x116')](_0x616fdb);try{fs['unlink'](_0x616fdb+_0x5091('0xfa'));}catch(_0x98fbd6){logger[_0x5091('0x32')](_0x98fbd6);}return _0x34114b;}return this[_0x5091('0xf')][_0x5091('0x32')](_0x351a8f,_0x5091('0x117'));};AGIVertices[_0x5091('0x18')]['awslex']=function(_0x14e2be){logger[_0x5091('0x2c')](util[_0x5091('0xa0')](_0x5091('0x118'),_0x14e2be['label']));if(!this[_0x5091('0xa7')](_0x14e2be['aws_access_key_id'])||!this[_0x5091('0xa7')](_0x14e2be[_0x5091('0x8d')])){return this['channel'][_0x5091('0xaa')](_0x5091('0x114'));}if(!this[_0x5091('0xa7')](_0x14e2be[_0x5091('0x8f')])){return this[_0x5091('0xf')][_0x5091('0xaa')](_0x5091('0x119'));}if(!this[_0x5091('0xa7')](_0x14e2be['text'])){return this['channel'][_0x5091('0xaa')](_0x5091('0xab'));}this[_0x5091('0xf')][_0x5091('0xe8')]=!![];this[_0x5091('0x37')](_0x14e2be);this['createSquareMessage'](_0x14e2be[_0x5091('0x81')],'in');this['channel'][_0x5091('0xaa')](util[_0x5091('0xa0')](_0x5091('0x11a'),_0x14e2be[_0x5091('0x81')]));var _0x573a25=this[_0x5091('0x8c')][_0x5091('0x74')](this,_0x14e2be);if(_0x573a25){for(var _0x278931 in _0x573a25){if(_0x573a25['hasOwnProperty'](_0x278931)&&_[_0x5091('0x96')](_0x573a25[_0x278931])){this['channel']['setVariable'](util[_0x5091('0xa0')]('AWS_LEX_%s',_0x278931[_0x5091('0x6e')]()),_0x573a25[_0x278931]);}}if(_['isNil'](_0x573a25['message'])){return this[_0x5091('0xf')][_0x5091('0xaa')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x5091('0x43')](_0x573a25[_0x5091('0x7a')],_0x5091('0xea'));return this[_0x5091('0xf')][_0x5091('0xaa')](util[_0x5091('0xa0')](_0x5091('0x11b'),_0x573a25[_0x5091('0x7a')]));}}return this[_0x5091('0xf')][_0x5091('0x32')](_0x14e2be,_0x5091('0x11c'));};AGIVertices[_0x5091('0x18')][_0x5091('0x11d')]=function(_0x4e0b19){logger[_0x5091('0x2c')](util[_0x5091('0xa0')](_0x5091('0x11e'),_0x4e0b19[_0x5091('0x39')],_0x4e0b19[_0x5091('0x6a')]));if(!this[_0x5091('0xa7')](_0x4e0b19['key'])){return this['channel']['noop'](_0x5091('0x11f'));}var _0x20bf24=_0x5091('0x120');var _0x4e08f4=util['format'](_0x5091('0x121'),FILES_PATH,rs[_0x5091('0x10d')](0x4));var _0x3de5d1=util[_0x5091('0xa0')]('%s.%s',_0x4e08f4,_0x20bf24);var _0x246702=!![];if(_0x4e0b19[_0x5091('0x122')]==='NOBEEP'){_0x246702=![];}var _0x100a02=this['channel'][_0x5091('0x123')](_0x4e08f4,_0x20bf24,_0x4e0b19[_0x5091('0x124')],_0x4e0b19[_0x5091('0x6a')],undefined,_0x246702);if(_0x100a02[_0x5091('0xa5')]!==-0x1){this[_0x5091('0xf')]['noop'](util[_0x5091('0xa0')]('google\x20%s\x20file\x20created',_0x3de5d1));var _0x54fc96=this[_0x5091('0x90')][_0x5091('0x74')](this,_0x4e0b19,_0x3de5d1);if(_0x54fc96){for(var _0x1b6d7e in _0x54fc96){if(_0x54fc96[_0x5091('0x9a')](_0x1b6d7e)){this[_0x5091('0xf')][_0x5091('0xa2')](util[_0x5091('0xa0')](_0x5091('0x125'),_0x1b6d7e[_0x5091('0x6e')]()),_0x54fc96[_0x1b6d7e]);}}return this[_0x5091('0xf')]['noop'](util[_0x5091('0xa0')](_0x5091('0x126'),JSON['stringify'](_0x54fc96)));}}return _0x100a02;};AGIVertices[_0x5091('0x18')][_0x5091('0x127')]=function(_0xd79ccc){logger[_0x5091('0x2c')](util[_0x5091('0xa0')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0xd79ccc[_0x5091('0x39')]));if(!this[_0x5091('0xa7')](_0xd79ccc['appid'])){return this['channel']['noop'](_0x5091('0x128'));}if(!this['isConfigured'](_0xd79ccc[_0x5091('0x94')])){return this[_0x5091('0xf')][_0x5091('0xaa')](_0x5091('0x129'));}var _0x4dc6ec=_0x5091('0x120');var _0x1a34fc=util[_0x5091('0xa0')](_0x5091('0x121'),FILES_PATH,rs[_0x5091('0x10d')](0x4));var _0x1676e4=util['format']('%s.%s',_0x1a34fc,_0x4dc6ec);var _0x145767=!![];if(_0xd79ccc[_0x5091('0x122')]===_0x5091('0x12a')){_0x145767=![];}var _0x4ebad1=this[_0x5091('0xf')]['recordFile'](_0x1a34fc,_0x4dc6ec,_0xd79ccc['intKey'],_0xd79ccc[_0x5091('0x6a')],undefined,_0x145767);if(_0x4ebad1[_0x5091('0xa5')]!==-0x1){this[_0x5091('0xf')][_0x5091('0xaa')](util['format'](_0x5091('0x12b'),_0x1676e4));var _0x6d44b6=this[_0x5091('0x92')][_0x5091('0x74')](this,_0xd79ccc,_0x1676e4);if(_0x6d44b6){for(var _0x4db85e in _0x6d44b6){if(_0x6d44b6['hasOwnProperty'](_0x4db85e)){this[_0x5091('0xf')][_0x5091('0xa2')](util[_0x5091('0xa0')](_0x5091('0x12c'),_0x4db85e[_0x5091('0x6e')]()),_0x6d44b6[_0x4db85e]);}}return this[_0x5091('0xf')][_0x5091('0xaa')](util[_0x5091('0xa0')](_0x5091('0x12d'),JSON[_0x5091('0x77')](_0x6d44b6)));}}return _0x4ebad1;};AGIVertices['prototype'][_0x5091('0x12e')]=function(_0x5c98ce){logger['info'](util[_0x5091('0xa0')](_0x5091('0x12f'),_0x5c98ce[_0x5091('0x39')]));return this[_0x5091('0xf')][_0x5091('0x130')](_0x5c98ce[_0x5091('0x3e')],_0x5c98ce[_0x5091('0x3f')],_0x5c98ce[_0x5091('0x131')]);};AGIVertices['prototype'][_0x5091('0x132')]=function(_0x2edb67){logger[_0x5091('0x2c')](util[_0x5091('0xa0')](_0x5091('0x133'),_0x2edb67[_0x5091('0x39')]));if(!this[_0x5091('0xa7')](_0x2edb67['condition'])){return this[_0x5091('0xf')][_0x5091('0x32')](_0x2edb67,'no\x20condition\x20configured');}try{var _0x4b17f6=eval(_0x2edb67[_0x5091('0x134')])?_0x5091('0x135'):'false';this[_0x5091('0xf')][_0x5091('0xaa')](util[_0x5091('0xa0')](_0x5091('0x136'),_0x2edb67[_0x5091('0x134')],_0x4b17f6));return{'code':0xc8,'result':_0x4b17f6};}catch(_0x544ad0){return{'code':0xc8,'result':'false'};}};AGIVertices['prototype']['gotoiftime']=function(_0xabc52c){logger[_0x5091('0x2c')](util[_0x5091('0xa0')](_0x5091('0x137'),_0xabc52c[_0x5091('0x39')]));if(!this[_0x5091('0xa7')](_0xabc52c[_0x5091('0x138')])){return this['channel']['error'](_0xabc52c,_0x5091('0x139'));}var _0x88cb61=this[_0x5091('0x25')][_0x5091('0x74')](this,_0xabc52c['interval_id']);if(!_0x88cb61){return this[_0x5091('0xf')][_0x5091('0x32')](_0xabc52c,_0x5091('0x13a'));}for(var _0xae7c1e=0x0;_0xae7c1e<_0x88cb61['length'];_0xae7c1e+=0x1){var _0x10e664=this[_0x5091('0xf')][_0x5091('0x12')](util[_0x5091('0xa0')](_0x5091('0x13b'),_0x88cb61[_0xae7c1e]));if(_0x10e664['result']===-0x1){return _0x10e664;}logger[_0x5091('0x2c')](util[_0x5091('0xa0')](_0x5091('0x13c'),_0x88cb61[_0xae7c1e],_0x10e664[_0x5091('0xa4')]));if(_0x10e664[_0x5091('0xa4')]==='true'){logger[_0x5091('0x2c')](util['format'](_0x5091('0x13c'),_0x88cb61[_0xae7c1e],_0x5091('0x135')));this[_0x5091('0xf')][_0x5091('0xaa')](util[_0x5091('0xa0')](_0x5091('0x13c'),_0x88cb61[_0xae7c1e],_0x5091('0x135')));return{'code':0xc8,'result':_0x5091('0x135')};}else{logger[_0x5091('0x2c')](util['format'](_0x5091('0x13c'),_0x88cb61[_0xae7c1e],_0x5091('0x13d')));this[_0x5091('0xf')][_0x5091('0xaa')](util[_0x5091('0xa0')](_0x5091('0x13c'),_0x88cb61[_0xae7c1e],_0x5091('0x13d')));}}return{'code':0xc8,'result':_0x5091('0x13d')};};AGIVertices[_0x5091('0x18')][_0x5091('0x13e')]=function(_0x352f63){logger[_0x5091('0x2c')](util['format'](_0x5091('0x13f'),_0x352f63['label']));return this[_0x5091('0xf')][_0x5091('0x13e')]();};AGIVertices[_0x5091('0x18')][_0x5091('0x140')]=function(_0x47332b){logger[_0x5091('0x2c')](util[_0x5091('0xa0')](_0x5091('0x141'),_0x47332b[_0x5091('0x39')]));if(!this[_0x5091('0xa7')](_0x47332b['key'])){return this[_0x5091('0xf')][_0x5091('0xaa')](_0x5091('0x11f'));}var _0x38797c=_0x5091('0x120');var _0x252aa3=util[_0x5091('0xa0')](_0x5091('0x121'),FILES_PATH,rs[_0x5091('0x10d')](0x4));var _0x5b15fc=util[_0x5091('0xa0')](_0x5091('0xa1'),_0x252aa3,_0x38797c);var _0x1b2fb9=!![];if(_0x47332b[_0x5091('0x122')]==='NOBEEP'){_0x1b2fb9=![];}var _0xdc8da2=this[_0x5091('0xf')]['recordFile'](_0x252aa3,_0x38797c,_0x47332b[_0x5091('0x124')],_0x47332b[_0x5091('0x6a')],undefined,_0x1b2fb9);if(_0xdc8da2['result']!==-0x1){this[_0x5091('0xf')]['noop'](util[_0x5091('0xa0')](_0x5091('0x142'),_0x5b15fc));var _0x2820d2=this[_0x5091('0x83')][_0x5091('0x74')](this,_0x47332b,_0x5b15fc);if(_0x2820d2){for(var _0x431bae in _0x2820d2){if(_0x2820d2['hasOwnProperty'](_0x431bae)){this[_0x5091('0xf')][_0x5091('0xa2')](util[_0x5091('0xa0')](_0x5091('0x143'),_0x431bae[_0x5091('0x6e')]()),_0x2820d2[_0x431bae]);}}return this['channel']['noop'](util[_0x5091('0xa0')](_0x5091('0x144'),JSON[_0x5091('0x77')](_0x2820d2)));}}return _0xdc8da2;};AGIVertices['prototype'][_0x5091('0x145')]=function(_0x52c99e){logger['info'](util[_0x5091('0xa0')](_0x5091('0x146'),_0x52c99e['label']));if(!this[_0x5091('0xa7')](_0x52c99e[_0x5091('0x80')])){return this[_0x5091('0xf')]['noop']('no\x20key\x20configured');}if(!this['isConfigured'](_0x52c99e[_0x5091('0x81')])){return this[_0x5091('0xf')][_0x5091('0xaa')](_0x5091('0xab'));}this[_0x5091('0xf')]['noop'](util[_0x5091('0xa0')](_0x5091('0x147'),_0x52c99e[_0x5091('0x81')]));var _0x144341=this[_0x5091('0x7f')][_0x5091('0x74')](this,_0x52c99e);if(_0x144341){this[_0x5091('0xf')][_0x5091('0xaa')](util['format'](_0x5091('0x142'),_0x144341));var _0x525301=this['channel'][_0x5091('0x116')](_0x144341,_0x52c99e[_0x5091('0x124')]);try{fs[_0x5091('0xf9')](_0x144341+'.wav');}catch(_0x5c7fbc){logger[_0x5091('0x32')](_0x5c7fbc);}return _0x525301;}return this[_0x5091('0xf')]['error'](_0x52c99e,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x5091('0x18')][_0x5091('0x148')]=function(_0x995f59){logger['info'](util[_0x5091('0xa0')](_0x5091('0x149'),_0x995f59[_0x5091('0x39')]));if(!this[_0x5091('0xa7')](_0x995f59[_0x5091('0x14a')])){return this[_0x5091('0xf')][_0x5091('0x32')](_0x995f59,'no\x20find\x20by\x20configured');}logger['info'](util['format'](_0x5091('0x14b'),this[_0x5091('0xf')][_0x5091('0x3c')],_0x995f59[_0x5091('0x14a')]));var _0x234d94=this['agentLogin']['sync'](this,_0x995f59['findBy']);if(_0x234d94){logger[_0x5091('0x2c')](util[_0x5091('0xa0')](_0x5091('0x14c'),this['channel'][_0x5091('0x3c')],_0x995f59[_0x5091('0x14a')]));this[_0x5091('0xf')]['noop'](util[_0x5091('0xa0')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x5091('0xf')][_0x5091('0x3c')],_0x995f59[_0x5091('0x14a')]));return{'code':0xc8,'result':_0x5091('0x14d')};}else{logger[_0x5091('0x2c')](util[_0x5091('0xa0')](_0x5091('0x14e'),this[_0x5091('0xf')][_0x5091('0x3c')],_0x995f59[_0x5091('0x14a')]));this[_0x5091('0xf')]['noop'](util[_0x5091('0xa0')](_0x5091('0x14e'),this['channel']['callerid'],_0x995f59[_0x5091('0x14a')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x5091('0x14f')]=function(_0x516f5){logger[_0x5091('0x2c')](util[_0x5091('0xa0')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x516f5[_0x5091('0x39')]));if(!this[_0x5091('0xa7')](_0x516f5[_0x5091('0x14a')])){return this[_0x5091('0xf')]['error'](_0x516f5,_0x5091('0x150'));}logger[_0x5091('0x2c')](util[_0x5091('0xa0')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x5091('0xf')][_0x5091('0x3c')],_0x516f5[_0x5091('0x14a')]));var _0x148eb5=this['agentLogout'][_0x5091('0x74')](this,_0x516f5[_0x5091('0x14a')]);if(_0x148eb5){logger[_0x5091('0x2c')](util['format'](_0x5091('0x14c'),this[_0x5091('0xf')][_0x5091('0x3c')],_0x516f5[_0x5091('0x14a')]));this[_0x5091('0xf')]['noop'](util[_0x5091('0xa0')](_0x5091('0x14c'),this['channel']['callerid'],_0x516f5[_0x5091('0x14a')]));return{'code':0xc8,'result':_0x5091('0x14d')};}else{logger[_0x5091('0x2c')](util[_0x5091('0xa0')](_0x5091('0x14e'),this[_0x5091('0xf')][_0x5091('0x3c')],_0x516f5['findBy']));this['channel'][_0x5091('0xaa')](util[_0x5091('0xa0')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x5091('0x3c')],_0x516f5[_0x5091('0x14a')]));return{'code':0xc8,'result':_0x5091('0x151')};}};AGIVertices[_0x5091('0x18')][_0x5091('0x152')]=function(_0x284f28){logger['info'](util[_0x5091('0xa0')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x284f28[_0x5091('0x39')]));if(!this[_0x5091('0xa7')](_0x284f28[_0x5091('0x153')])){return this[_0x5091('0xf')][_0x5091('0x32')](_0x284f28,_0x5091('0x154'));}this[_0x5091('0xf')][_0x5091('0xaa')](util[_0x5091('0xa0')](_0x5091('0x155'),_0x284f28[_0x5091('0x153')]));var _0x4fce4e=eval(_0x284f28[_0x5091('0x153')]);if(!this['isConfigured'](_0x284f28['variable_id'])){return this[_0x5091('0xf')][_0x5091('0xaa')](_0x5091('0xd8'));}var _0x37e7f5=this['getVariable'][_0x5091('0x74')](this,_0x284f28[_0x5091('0xd7')]);if(!_0x37e7f5){return this['channel'][_0x5091('0x32')](_0x284f28,_0x5091('0xd9'));}if(_['isArray'](_0x4fce4e)){var _0x22e46e=this;_0x4fce4e[_0x5091('0xda')](function(_0x529290,_0x2f91f4){_0x22e46e[_0x5091('0xf')][_0x5091('0xa2')](util['format'](_0x5091('0x156'),_0x37e7f5,_0x2f91f4),_0x529290);});return this[_0x5091('0xf')][_0x5091('0xaa')](util['format'](_0x5091('0x157'),_0x37e7f5));}else{return this[_0x5091('0xf')][_0x5091('0xa2')](_0x37e7f5,_0x4fce4e);}};AGIVertices[_0x5091('0x18')][_0x5091('0xc')]=function(_0x3bfb85){logger[_0x5091('0x2c')](util[_0x5091('0xa0')](_0x5091('0x158'),_0x3bfb85[_0x5091('0x39')]));if(_0x3bfb85['retry']===0x0){return this[_0x5091('0xa8')](_0x3bfb85);}_0x3bfb85['retry']-=0x1;if(!this[_0x5091('0xa7')](_0x3bfb85['file_id'])){return this[_0x5091('0xf')][_0x5091('0x32')](_0x3bfb85,_0x5091('0x106'));}var _0x2ff268=this[_0x5091('0x107')][_0x5091('0x74')](this,_0x3bfb85[_0x5091('0x159')]);if(!_0x2ff268){return this[_0x5091('0xf')][_0x5091('0x32')](_0x3bfb85,_0x5091('0x108'));}var _0x383ed0=this[_0x5091('0xf')][_0x5091('0x15a')](_0x2ff268,_0x3bfb85[_0x5091('0x109')],_0x3bfb85['digit']);var _0xb97b2d=_0x383ed0[_0x5091('0xa5')];if(_0x383ed0['result']===-0x1){this['createSquareDetailsReport']['sync'](this,_0x3bfb85,'-1');return _0x383ed0;}else if(_0x383ed0['extra']==='timeout'){_0x383ed0[_0x5091('0xa5')]=_0x383ed0[_0x5091('0xa5')][_0x5091('0x9d')]>0x0?_0x383ed0[_0x5091('0xa5')]:'t';}else if(_['isEmpty'](_0x383ed0[_0x5091('0xa5')])){_0x383ed0[_0x5091('0xa5')]='#';_0xb97b2d='#';}if(!this['isConfigured'](_0x3bfb85[_0x5091('0xd7')])){this[_0x5091('0xf')][_0x5091('0xaa')](_0x5091('0xd8'));}else{var _0x17cd4b=this[_0x5091('0x12')][_0x5091('0x74')](this,_0x3bfb85[_0x5091('0xd7')]);if(!_0x17cd4b){return this[_0x5091('0xf')][_0x5091('0x32')](_0x3bfb85,_0x5091('0xd9'));}this[_0x5091('0xf')]['setVariable'](_0x17cd4b,_0xb97b2d);}this[_0x5091('0x37')][_0x5091('0x74')](this,_0x3bfb85,_0xb97b2d);return _0x383ed0;};AGIVertices[_0x5091('0x18')][_0x5091('0xaa')]=function(_0x28582c){logger[_0x5091('0x2c')](util['format'](_0x5091('0x15b'),_0x28582c[_0x5091('0x39')]));return this[_0x5091('0xf')]['noop'](_0x28582c[_0x5091('0x15c')]||_0x28582c[_0x5091('0x39')]);};AGIVertices[_0x5091('0x18')][_0x5091('0x15d')]=function(_0x4bc3e0){logger[_0x5091('0x2c')](util['format']('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x4bc3e0[_0x5091('0x39')]));if(!this[_0x5091('0xa7')](_0x4bc3e0['findBy'])){return this['channel'][_0x5091('0x32')](_0x4bc3e0,'no\x20find\x20by\x20configured');}logger[_0x5091('0x2c')](util['format'](_0x5091('0x14b'),this[_0x5091('0xf')]['callerid'],_0x4bc3e0[_0x5091('0x14a')]));var _0x331910=this['getPause'][_0x5091('0x74')](this,_0x4bc3e0[_0x5091('0x15e')]);var _0x559bfd=this['agentPause']['sync'](this,_0x4bc3e0[_0x5091('0x14a')],_0x331910);if(_0x559bfd){logger[_0x5091('0x2c')](util[_0x5091('0xa0')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x5091('0xf')][_0x5091('0x3c')],_0x4bc3e0[_0x5091('0x14a')]));this[_0x5091('0xf')]['noop'](util[_0x5091('0xa0')](_0x5091('0x14c'),this[_0x5091('0xf')]['callerid'],_0x4bc3e0[_0x5091('0x14a')]));return{'code':0xc8,'result':'success'};}else{logger[_0x5091('0x2c')](util[_0x5091('0xa0')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x5091('0xf')][_0x5091('0x3c')],_0x4bc3e0[_0x5091('0x14a')]));this[_0x5091('0xf')][_0x5091('0xaa')](util[_0x5091('0xa0')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x5091('0xf')]['callerid'],_0x4bc3e0[_0x5091('0x14a')]));return{'code':0xc8,'result':_0x5091('0x151')};}};AGIVertices[_0x5091('0x18')][_0x5091('0x15f')]=function(_0x2b5bac){logger[_0x5091('0x2c')](util[_0x5091('0xa0')](_0x5091('0x160'),_0x2b5bac[_0x5091('0x39')]));if(!this[_0x5091('0xa7')](_0x2b5bac[_0x5091('0x159')])){return this['channel']['error'](_0x2b5bac,_0x5091('0x106'));}var _0x4d9d4a=this[_0x5091('0x107')][_0x5091('0x74')](this,_0x2b5bac[_0x5091('0x159')]);if(!_0x4d9d4a){return this[_0x5091('0xf')]['error'](_0x2b5bac,'no\x20file\x20audio\x20found');}var _0x236569=this[_0x5091('0xf')][_0x5091('0x5a')](_0x5091('0x161'),[_0x4d9d4a,_0x2b5bac[_0x5091('0x104')]]);if(_0x236569['result']===-0x1){return _0x236569;}return this['channel'][_0x5091('0xaa')](util['format']('Executed\x20command\x20%s\x20%s','PLAYBACK',_0x4d9d4a));};AGIVertices[_0x5091('0x18')][_0x5091('0x162')]=function(_0x5562d0){logger['info'](util['format'](_0x5091('0x163'),_0x5562d0[_0x5091('0x39')]));if(!this[_0x5091('0xa7')](_0x5562d0[_0x5091('0x164')])){return this['channel'][_0x5091('0x32')](_0x5562d0,_0x5091('0x165'));}var _0x527f1c='';var _0x35f25d=parseInt(_0x5562d0[_0x5091('0x164')],0xa);if(isNaN(_0x35f25d)){_0x527f1c=_0x5562d0['queue_id'];}else{_0x527f1c=this[_0x5091('0x166')][_0x5091('0x74')](this,_0x5562d0['queue_id']);if(!_0x527f1c){return this[_0x5091('0xf')][_0x5091('0x32')](_0x5562d0,_0x5091('0x167'));}}var _0x371b50='';if(this['isConfigured'](_0x5562d0['file_id'])){var _0x4f1ea8=this[_0x5091('0x107')][_0x5091('0x74')](this,_0x5562d0['file_id']);if(_0x4f1ea8){_0x371b50=_0x4f1ea8;}}this[_0x5091('0x37')]['sync'](this,_0x5562d0,_0x527f1c);if(_0x5562d0[_0x5091('0x104')]['indexOf']('x')<0x0){_0x5562d0[_0x5091('0x104')]+='x';}if(_0x5562d0['opts'][_0x5091('0x168')]('X')<0x0){_0x5562d0['opts']+='X';}this[_0x5091('0xf')]['setVariable']('XMCS-QUEUE',_0x527f1c?_0x527f1c[_0x5091('0x169')]():'');var _0x4dc9fc=this['channel'][_0x5091('0x5a')]('QUEUE',[_0x527f1c,_0x5562d0[_0x5091('0x104')],_0x5562d0['url'],_0x371b50,_0x5562d0[_0x5091('0x6a')],_0x5562d0[_0x5091('0x7')],_0x5562d0[_0x5091('0x16a')],_0x5562d0[_0x5091('0x16b')],'',_0x5562d0[_0x5091('0x16c')]]);if(_0x4dc9fc[_0x5091('0xa5')]===-0x1){return _0x4dc9fc;}return this[_0x5091('0xf')][_0x5091('0xaa')](util[_0x5091('0xa0')](_0x5091('0x16d'),'QUEUE',_0x527f1c));};AGIVertices[_0x5091('0x18')][_0x5091('0x16e')]=function(_0x49bd13){logger[_0x5091('0x2c')](util['format'](_0x5091('0x16f'),_0x49bd13[_0x5091('0x39')]));var _0x292293=_0x49bd13[_0x5091('0x170')]||_0x5091('0x120');var _0x560d0f=util[_0x5091('0xa0')]('%s_%s',this['channel']['uniqueid'],rs[_0x5091('0x10d')](0x5));var _0x3389ca=util['format'](_0x5091('0x171'),FILES_PATH,_0x560d0f,_0x292293);var _0x440839=util[_0x5091('0xa0')]('%s/recordings/%s',FILES_PATH,_0x560d0f);this[_0x5091('0x3b')]['sync'](this,_0x49bd13,_0x560d0f,_0x3389ca);this[_0x5091('0xf')][_0x5091('0xa2')](_0x5091('0x172'),_0x560d0f);logger['info'](_0x5091('0x173'),_0x440839,_0x292293,_0x49bd13[_0x5091('0x174')],_0x49bd13[_0x5091('0x6a')]);return this[_0x5091('0xf')][_0x5091('0x123')](_0x440839,_0x292293,_0x49bd13[_0x5091('0x174')],_0x49bd13[_0x5091('0x6a')],undefined,!![]);};AGIVertices[_0x5091('0x18')][_0x5091('0x175')]=function(_0x3157f0){logger['info'](util[_0x5091('0xa0')](_0x5091('0x176'),_0x3157f0[_0x5091('0x39')]));if(!this['isConfigured'](_0x3157f0[_0x5091('0x68')])){return this[_0x5091('0xf')][_0x5091('0xaa')](_0x5091('0x177'));}var _0x3a775d=this['restAPI'][_0x5091('0x74')](this,_0x3157f0);logger['info'](util[_0x5091('0xa0')](_0x5091('0x178'),util['inspect'](_0x3a775d,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x3157f0[_0x5091('0xd7')])){return this[_0x5091('0xf')][_0x5091('0xaa')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x2dce1c=this[_0x5091('0x12')][_0x5091('0x74')](this,_0x3157f0[_0x5091('0xd7')]);if(!_0x2dce1c){return this[_0x5091('0xf')][_0x5091('0x32')](_0x3157f0,_0x5091('0xd9'));}this[_0x5091('0xf')][_0x5091('0xa2')](util[_0x5091('0xa0')](_0x5091('0x179'),_0x2dce1c),_0x3a775d[_0x5091('0x79')]?_0x3a775d[_0x5091('0x79')]:_0x5091('0x17a'));this[_0x5091('0xf')][_0x5091('0xa2')](util[_0x5091('0xa0')]('%s_STATUS_MESSAGE',_0x2dce1c),_0x3a775d[_0x5091('0x17b')]?_0x3a775d[_0x5091('0x17b')]:'OK');if(_0x3a775d[_0x5091('0x6f')]){try{this['saveRestApiResult'](_0x3a775d[_0x5091('0x6f')],_0x2dce1c);}catch(_0x46b1d4){logger[_0x5091('0x32')](util['format'](_0x5091('0x17c'),_0x2dce1c));}}return this['channel'][_0x5091('0xaa')](util['format'](_0x5091('0xdd'),_0x2dce1c));};AGIVertices[_0x5091('0x18')]['saydigits']=function(_0x503c86){logger[_0x5091('0x2c')](util[_0x5091('0xa0')](_0x5091('0x17d'),_0x503c86[_0x5091('0x39')]));return this[_0x5091('0xf')][_0x5091('0x17e')](_0x503c86[_0x5091('0x17f')][_0x5091('0xd6')](/\s+/g,''),_0x503c86[_0x5091('0x174')]);};AGIVertices['prototype'][_0x5091('0x180')]=function(_0x50bcb7){logger['info'](util[_0x5091('0xa0')](_0x5091('0x181'),_0x50bcb7[_0x5091('0x39')]));return this[_0x5091('0xf')][_0x5091('0x182')](_0x50bcb7[_0x5091('0x6b')][_0x5091('0xd6')](/\s+/g,''),_0x50bcb7[_0x5091('0x174')]);};AGIVertices[_0x5091('0x18')][_0x5091('0x183')]=function(_0x1f9cd2){logger[_0x5091('0x2c')](util[_0x5091('0xa0')](_0x5091('0x184'),_0x1f9cd2[_0x5091('0x39')]));return this[_0x5091('0xf')][_0x5091('0x185')](_0x1f9cd2[_0x5091('0x81')],_0x1f9cd2[_0x5091('0x174')]);};AGIVertices[_0x5091('0x18')][_0x5091('0x186')]=function(_0x64c287){logger[_0x5091('0x2c')](util[_0x5091('0xa0')](_0x5091('0x187'),_0x64c287[_0x5091('0x39')]));if(!this[_0x5091('0xa7')](_0x64c287[_0x5091('0x188')])){return this[_0x5091('0xf')][_0x5091('0xaa')](_0x5091('0x189'));}var _0x3e6ad0=this[_0x5091('0x22')][_0x5091('0x74')](this,_0x64c287[_0x5091('0x188')]);if(!_0x3e6ad0||!_0x3e6ad0[_0x5091('0x18a')]){return this[_0x5091('0xf')][_0x5091('0x32')](_0x64c287,_0x5091('0x18b'));}var _0x6fcffc={'from':util[_0x5091('0xa0')](_0x5091('0x18c'),_0x3e6ad0[_0x5091('0x14')],_0x3e6ad0[_0x5091('0x18d')]||_0x3e6ad0[_0x5091('0x18a')][_0x5091('0x18e')]),'to':_0x64c287['to']||'','cc':_0x64c287['cc']||'','bcc':_0x64c287[_0x5091('0x18f')]||'','subject':_0x64c287[_0x5091('0x190')],'html':_0x64c287['text'],'text':_0x64c287[_0x5091('0x81')]};var _0x50ee40={'tls':{'rejectUnauthorized':![]}};if(_0x3e6ad0[_0x5091('0x18a')]['service']){_0x50ee40[_0x5091('0x191')]=_0x3e6ad0['Smtp']['service'];}else{_0x50ee40[_0x5091('0x192')]=_0x3e6ad0[_0x5091('0x18a')]['host'];_0x50ee40[_0x5091('0x193')]=_0x3e6ad0['Smtp'][_0x5091('0x193')];_0x50ee40['secure']=_0x3e6ad0[_0x5091('0x18a')][_0x5091('0x194')];}if(_0x3e6ad0[_0x5091('0x18a')]['authentication']){_0x50ee40[_0x5091('0x195')]={'user':_0x3e6ad0[_0x5091('0x18a')][_0x5091('0x18e')],'pass':_0x3e6ad0['Smtp'][_0x5091('0x196')]};}if(this[_0x5091('0xa7')](_0x64c287[_0x5091('0x197')])){}logger[_0x5091('0xdf')](_0x5091('0x198'),JSON[_0x5091('0x77')](_0x6fcffc));this['createSquareDetailsReport']['sync'](this,_0x64c287,_0x64c287[_0x5091('0x188')]);this['channel']['noop'](util['format'](_0x5091('0x199'),_0x3e6ad0['name']));this[_0x5091('0x24')][_0x5091('0x74')](this,_0x50ee40,_0x6fcffc);return this['channel'][_0x5091('0xaa')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x5091('0x18')][_0x5091('0x19a')]=function(_0xacbc34){logger[_0x5091('0x2c')](util[_0x5091('0xa0')](_0x5091('0x19b'),_0xacbc34[_0x5091('0x39')]));return this['channel'][_0x5091('0xaa')](_0x5091('0x19c'));};AGIVertices['prototype'][_0x5091('0x19d')]=function(_0x3cda54){logger[_0x5091('0x2c')](util[_0x5091('0xa0')](_0x5091('0x19e'),_0x3cda54[_0x5091('0x39')]));if(!this[_0x5091('0xa7')](_0x3cda54[_0x5091('0x19f')])){return this[_0x5091('0xf')][_0x5091('0xaa')](_0x5091('0x1a0'));}var _0x10f8cf=this[_0x5091('0x34')][_0x5091('0x74')](this,_0x3cda54[_0x5091('0x19f')]);if(!_0x10f8cf){return this[_0x5091('0xf')][_0x5091('0x32')](_0x3cda54,'no\x20sms\x20account\x20found');}var _0x1f2821={'body':_0x3cda54[_0x5091('0x1a1')],'phone':_0x3cda54['to']||'','SmsAccountId':_0x10f8cf['id']};logger[_0x5091('0xdf')](_0x5091('0x1a2'),JSON[_0x5091('0x77')](_0x1f2821));this['createSquareDetailsReport'][_0x5091('0x74')](this,_0x3cda54,_0x3cda54[_0x5091('0x19f')]);this['channel']['noop'](util[_0x5091('0xa0')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x10f8cf[_0x5091('0x14')]));this['createSmsMessage']['sync'](this,_0x1f2821);return this[_0x5091('0xf')][_0x5091('0xaa')](_0x5091('0x1a3'));};AGIVertices[_0x5091('0x18')][_0x5091('0x1a4')]=function(_0x44fa86){logger['info'](util[_0x5091('0xa0')](_0x5091('0x1a5'),_0x44fa86[_0x5091('0x39')]));if(!this['isConfigured'](_0x44fa86[_0x5091('0xd7')])){return this['channel'][_0x5091('0x32')](_0x44fa86,_0x5091('0x1a6'));}var _0x292d91=this[_0x5091('0x12')][_0x5091('0x74')](this,_0x44fa86[_0x5091('0xd7')]);if(!_0x292d91){return this['channel'][_0x5091('0x32')](_0x44fa86,'no\x20variable\x20found');}return this[_0x5091('0xf')]['setVariable'](_0x292d91,_0x44fa86[_0x5091('0x1a7')]);};AGIVertices['prototype'][_0x5091('0x1a8')]=function(_0xded8a8){logger[_0x5091('0x2c')](util[_0x5091('0xa0')](_0x5091('0x1a9'),_0xded8a8['label']));this[_0x5091('0xf')][_0x5091('0xaa')]('START\x20CALLY\x20SQUARE');if(_0xded8a8['answer']===_0x5091('0x1aa')){this[_0x5091('0xf')][_0x5091('0xaa')](_0x5091('0x1ab'));return this['channel'][_0x5091('0xb9')]();}return this[_0x5091('0xf')][_0x5091('0xaa')](_0x5091('0x1ac'));};AGIVertices[_0x5091('0x18')][_0x5091('0x1ad')]=function(_0x102d2c){logger['info'](util[_0x5091('0xa0')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x102d2c['label']));if(!this[_0x5091('0xa7')](_0x102d2c[_0x5091('0x1ae')])){return this[_0x5091('0xf')]['error'](_0x102d2c,_0x5091('0x1af'));}var _0x3742e5=this[_0x5091('0x19')][_0x5091('0x74')](this,_0x102d2c[_0x5091('0x1ae')]);if(!this['isConfigured'](_0x3742e5)){return this['channel'][_0x5091('0x32')](_0x102d2c,util[_0x5091('0xa0')](_0x5091('0x1b0'),_0x102d2c[_0x5091('0x1ae')]));}if(_0x3742e5===this[_0x5091('0xf')][_0x5091('0x41')]){return this[_0x5091('0xf')][_0x5091('0x32')](_0x102d2c,_0x5091('0x1b1'));}this[_0x5091('0x37')][_0x5091('0x74')](this,_0x102d2c,_0x3742e5);var _0x416457=this[_0x5091('0xf')][_0x5091('0x5a')](_0x5091('0x1b2'),util[_0x5091('0xa0')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x5091('0x7')]['host']||'127.0.0.1',_0x3742e5,this[_0x5091('0xf')]['arg_1']));if(_0x416457[_0x5091('0xa5')]===-0x1){return _0x416457;}return this['channel'][_0x5091('0xaa')](util[_0x5091('0xa0')]('Executed\x20command\x20%s\x20%s',_0x5091('0x1b2'),_0x3742e5));};AGIVertices[_0x5091('0x18')][_0x5091('0x1b3')]=function(_0x4956b9){logger[_0x5091('0x2c')](util['format'](_0x5091('0x1b4'),_0x4956b9[_0x5091('0x39')]));var _0x4b83ce=this[_0x5091('0x59')]['sync'](this,_0x4956b9[_0x5091('0x1b5')]);this[_0x5091('0x37')][_0x5091('0x74')](this,_0x4956b9,_0x4956b9[_0x5091('0x1b5')]);if(this[_0x5091('0xa7')](_0x4956b9[_0x5091('0xd7')])){var _0x37c580=this[_0x5091('0x12')]['sync'](this,_0x4956b9['variable_id']);if(_0x37c580){this[_0x5091('0xf')][_0x5091('0xa2')](_0x37c580,_0x4b83ce);return this[_0x5091('0xf')]['noop'](util[_0x5091('0xa0')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x4956b9[_0x5091('0x1b5')],_0x37c580));}}return this['channel'][_0x5091('0xaa')](util['format'](_0x5091('0x1b6'),_0x4956b9['command']));};AGIVertices[_0x5091('0x18')]['google_cloud_tts']=function(_0x3f21d1){logger['info'](util['format'](_0x5091('0x1b7'),_0x3f21d1[_0x5091('0x39')]));_0x3f21d1[_0x5091('0x81')]=_0x3f21d1['text'][_0x5091('0xd6')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x3f21d1[_0x5091('0x5d')])){return this[_0x5091('0xf')][_0x5091('0xaa')]('no\x20apiKey\x20configured');}if(!this[_0x5091('0xa7')](_0x3f21d1[_0x5091('0x81')])){return this[_0x5091('0xf')]['noop']('no\x20text\x20configured');}this[_0x5091('0xf')][_0x5091('0xaa')](util['format'](_0x5091('0x1b8'),_0x3f21d1[_0x5091('0x81')]));var _0xc3b4a9=this[_0x5091('0x5c')][_0x5091('0x74')](this,_0x3f21d1);if(_0xc3b4a9){this[_0x5091('0xf')][_0x5091('0xaa')](util[_0x5091('0xa0')](_0x5091('0x1b9'),_0xc3b4a9));var _0x423eb3=this[_0x5091('0xf')]['streamFile'](_0xc3b4a9);try{fs[_0x5091('0xf9')](_0xc3b4a9+_0x5091('0xfa'));}catch(_0x121573){logger['error'](_0x121573);}return _0x423eb3;}return this[_0x5091('0xf')]['error'](_0x3f21d1,_0x5091('0x1ba'));};AGIVertices[_0x5091('0x18')][_0x5091('0x1bb')]=function(_0x51fc58){logger[_0x5091('0x2c')](util[_0x5091('0xa0')](_0x5091('0x1bc'),_0x51fc58[_0x5091('0x39')]));_0x51fc58[_0x5091('0x81')]=_0x51fc58['text'][_0x5091('0xd6')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x51fc58[_0x5091('0x81')])){return this[_0x5091('0xf')]['noop'](_0x5091('0xab'));}this[_0x5091('0xf')][_0x5091('0xaa')](util[_0x5091('0xa0')](_0x5091('0x1bd'),_0x51fc58[_0x5091('0x81')]));var _0x1ad58d=this['googleTTS'][_0x5091('0x74')](this,_0x51fc58);if(_0x1ad58d){this['channel'][_0x5091('0xaa')](util[_0x5091('0xa0')]('Google\x20TTS\x20%s\x20file\x20created',_0x1ad58d));var _0x26b23a=this['channel']['streamFile'](_0x1ad58d);try{fs[_0x5091('0xf9')](_0x1ad58d+_0x5091('0xfa'));}catch(_0x330691){logger[_0x5091('0x32')](_0x330691);}return _0x26b23a;}return this[_0x5091('0xf')]['error'](_0x51fc58,_0x5091('0x1be'));};AGIVertices[_0x5091('0x18')]['unpause']=function(_0x3ff631){logger[_0x5091('0x2c')](util[_0x5091('0xa0')](_0x5091('0x1bf'),_0x3ff631['label']));if(!this[_0x5091('0xa7')](_0x3ff631[_0x5091('0x14a')])){return this[_0x5091('0xf')][_0x5091('0x32')](_0x3ff631,'no\x20find\x20by\x20configured');}logger[_0x5091('0x2c')](util['format'](_0x5091('0x14b'),this[_0x5091('0xf')]['callerid'],_0x3ff631[_0x5091('0x14a')]));var _0x3ac739=this['agentUnpause'][_0x5091('0x74')](this,_0x3ff631[_0x5091('0x14a')]);if(_0x3ac739){logger[_0x5091('0x2c')](util[_0x5091('0xa0')](_0x5091('0x14c'),this[_0x5091('0xf')][_0x5091('0x3c')],_0x3ff631[_0x5091('0x14a')]));this['channel'][_0x5091('0xaa')](util[_0x5091('0xa0')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x5091('0xf')][_0x5091('0x3c')],_0x3ff631[_0x5091('0x14a')]));return{'code':0xc8,'result':_0x5091('0x14d')};}else{logger['info'](util['format'](_0x5091('0x14e'),this[_0x5091('0xf')]['callerid'],_0x3ff631[_0x5091('0x14a')]));this['channel'][_0x5091('0xaa')](util[_0x5091('0xa0')](_0x5091('0x14e'),this[_0x5091('0xf')]['callerid'],_0x3ff631[_0x5091('0x14a')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x5091('0x18')][_0x5091('0x1c0')]=function(_0x15d5ef){logger['info'](util[_0x5091('0xa0')](_0x5091('0x1c1'),_0x15d5ef['label']));var _0x5425f3=this[_0x5091('0xf')][_0x5091('0x5a')]('VOICEMAIL',[_0x15d5ef[_0x5091('0x1c2')],_0x15d5ef['options']]);if(_0x5425f3['result']===-0x1){return _0x5425f3;}return this[_0x5091('0xf')][_0x5091('0xaa')](util['format'](_0x5091('0x16d'),_0x5091('0x1c3'),_0x15d5ef[_0x5091('0x1c2')]));};AGIVertices[_0x5091('0x18')][_0x5091('0x1c4')]=function(_0x4d990b){logger[_0x5091('0x2c')](util['format'](_0x5091('0x1c5'),_0x4d990b[_0x5091('0x39')]));if(!this['isConfigured'](_0x4d990b[_0x5091('0xd7')])){return this[_0x5091('0xf')][_0x5091('0x32')](_0x4d990b,_0x5091('0x1a6'));}var _0x452e6b=this[_0x5091('0x12')][_0x5091('0x74')](this,_0x4d990b[_0x5091('0xd7')]);if(!_0x452e6b){return this[_0x5091('0xf')][_0x5091('0x32')](_0x4d990b,_0x5091('0xd9'));}var _0x23aed0=this['channel'][_0x5091('0x12')](_0x452e6b);return{'code':0xc8,'result':_0x23aed0[_0x5091('0xa4')]?_0x23aed0[_0x5091('0xa4')]:'-'};};String[_0x5091('0x18')][_0x5091('0x1c6')]=function(_0x39871a,_0x5c4c1a){return this['split'](_0x39871a)[_0x5091('0x1c7')](_0x5c4c1a);};module[_0x5091('0x1c8')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index c7877df..7daf949 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 _0xe14d=['agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','channels','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','Action','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','format','uniqueid','updateAcw','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','[ACW][START]\x20%s','message','saveUnpause','update','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','startAcw','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','util','lodash','moment','../ami','acw','../rpc/user','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup'];(function(_0xf78361,_0x1e4739){var _0x326050=function(_0x5188be){while(--_0x5188be){_0xf78361['push'](_0xf78361['shift']());}};_0x326050(++_0x1e4739);}(_0xe14d,0x1ee));var _0xde14=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0xe14d[_0x494d1f];return _0x457b6e;};'use strict';var util=require(_0xde14('0x0'));var _=require(_0xde14('0x1'));var moment=require(_0xde14('0x2'));var ami=require(_0xde14('0x3'));var logger=require('../../../config/logger')(_0xde14('0x4'));var RpcUser=require(_0xde14('0x5'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x1c3e94){this[_0xde14('0x6')]=_0x1c3e94[_0xde14('0x6')];this[_0xde14('0x7')]=_0x1c3e94[_0xde14('0x7')];this[_0xde14('0x8')]=_0x1c3e94['timers'];this['channels']={};ami['on'](_0xde14('0x9'),this[_0xde14('0xa')][_0xde14('0xb')](this));ami['on'](_0xde14('0xc'),this[_0xde14('0xd')][_0xde14('0xb')](this));ami['on'](_0xde14('0xe'),this[_0xde14('0xf')]['bind'](this));ami['on'](_0xde14('0x10'),this[_0xde14('0x11')][_0xde14('0xb')](this));ami['on'](_0xde14('0x12'),this[_0xde14('0x13')][_0xde14('0xb')](this));ami['on'](_0xde14('0x14'),this[_0xde14('0x15')][_0xde14('0xb')](this));ami['on'](_0xde14('0x16'),this[_0xde14('0x17')][_0xde14('0xb')](this));}function getDiff(_0x3521d4){var _0x281c54=moment()[_0xde14('0x18')](0x0);var _0x54c58b=moment(_0x3521d4)['milliseconds'](0x0);return _0x281c54[_0xde14('0x19')](_0x54c58b,_0xde14('0x1a'));}Acw[_0xde14('0x1b')]['startAcw']=function(_0x16aa55){try{var _0x31adb3=this;var _0x257390=this[_0xde14('0x1c')][_0x16aa55][_0xde14('0x1d')];var _0x1b9d4b=this[_0xde14('0x1c')][_0x16aa55][_0xde14('0x1e')];var _0x3cc317=this[_0xde14('0x6')][_0x1b9d4b];var _0x590a8b=![];var _0x3f5fcf=_0xde14('0x1f');if(_0x3cc317[_0xde14('0x20')]){if(_0x3cc317[_0xde14('0x21')]['name']){_0x590a8b=!![];_0x3f5fcf=_0x3cc317[_0xde14('0x21')]['name'];}}ami[_0xde14('0x22')]({'action':'QueuePause','interface':_0x257390,'paused':!![],'reason':_0x3f5fcf})[_0xde14('0x23')](function(_0x30fcf1){if(_0x31adb3[_0xde14('0x7')][_0x257390]){return RpcUser[_0xde14('0x24')](_0x31adb3[_0xde14('0x7')][_0x257390]['id'])[_0xde14('0x23')](function(_0x40b648){if(_0x40b648&&!_0x40b648[_0xde14('0x25')]){logger[_0xde14('0x26')](_0xde14('0x27'),_0x16aa55,_0x257390,_0x1b9d4b);var _0x475f2f=_0x31adb3[_0xde14('0x1c')][_0x16aa55][_0xde14('0x28')]&&_0x31adb3['channels'][_0x16aa55][_0xde14('0x29')]?_0x31adb3[_0xde14('0x1c')][_0x16aa55][_0xde14('0x29')]:_0x16aa55;return RpcUser[_0xde14('0x2a')](_0x31adb3[_0xde14('0x7')][_0x257390],_0x3f5fcf,_0x475f2f)[_0xde14('0x23')](function(_0x310d75){if(!_0x590a8b){_0x31adb3[_0xde14('0x8')][_0x257390]={};logger[_0xde14('0x26')](_0xde14('0x2b'),_0x16aa55,_0x31adb3['voiceQueues'][_0x1b9d4b][_0xde14('0x2c')],_0x257390,_0x1b9d4b);_0x31adb3[_0xde14('0x8')][_0x257390][_0xde14('0x2d')]=setTimeout(_0x31adb3[_0xde14('0x2e')]['bind'](_0x31adb3,_0x257390),_0x31adb3[_0xde14('0x6')][_0x1b9d4b][_0xde14('0x2c')]*0x3e8);_0x31adb3[_0xde14('0x8')][_0x257390]['lastPauseAt']=moment()[_0xde14('0x2f')]('YYYY-MM-DD\x20HH:mm:ss');_0x31adb3[_0xde14('0x8')][_0x257390][_0xde14('0x30')]=_0x16aa55;_0x31adb3[_0xde14('0x8')][_0x257390][_0xde14('0x1e')]=_0x1b9d4b;_0x31adb3[_0xde14('0x8')][_0x257390][_0xde14('0x31')]=function(){var _0xae9dca=getDiff(_0x31adb3[_0xde14('0x8')][_0x257390]['lastPauseAt']);clearTimeout(_0x31adb3[_0xde14('0x8')][_0x257390][_0xde14('0x2d')]);_0x31adb3['timers'][_0x257390][_0xde14('0x2d')]=![];RpcVoiceAgentReport['update']({'acwtime':_0xae9dca},_0x31adb3[_0xde14('0x8')][_0x257390][_0xde14('0x30')],_0x257390)[_0xde14('0x23')](function(_0x21a916){logger[_0xde14('0x26')]('[%s][UPDATE][ACWTIME:%s]',_0x16aa55,_0xae9dca,_0x21a916);})[_0xde14('0x32')](function(_0x57b98b){logger['error'](_0xde14('0x33'),_0x16aa55,_0x57b98b);});delete _0x31adb3[_0xde14('0x8')][_0x257390];};}});}else{logger[_0xde14('0x26')](_0xde14('0x34'),_0x16aa55,_0x257390,_0x1b9d4b);}});}})[_0xde14('0x32')](function(_0xa41c1e){logger[_0xde14('0x35')](_0xde14('0x2b'),_0x16aa55,_0x31adb3[_0xde14('0x6')][_0x1b9d4b]['acwTimeout'],_0x257390,_0x1b9d4b);})['finally'](function(){delete _0x31adb3[_0xde14('0x1c')][_0x16aa55];});}catch(_0x403007){logger[_0xde14('0x35')](_0xde14('0x36'),_0x403007[_0xde14('0x37')]);}};Acw[_0xde14('0x1b')][_0xde14('0x2e')]=function(_0x2b0bc4){try{var _0x2ac7ba=this;if(_0x2ac7ba['timers'][_0x2b0bc4]){_0x2ac7ba[_0xde14('0x8')][_0x2b0bc4]['timer']=![];var _0x4a363c=_0x2ac7ba['timers'][_0x2b0bc4][_0xde14('0x30')];var _0x258759=_0x2ac7ba[_0xde14('0x8')][_0x2b0bc4][_0xde14('0x1e')];var _0x1228d8=_0x2ac7ba[_0xde14('0x6')][_0x258759][_0xde14('0x2c')];logger[_0xde14('0x26')]('[TIMER][STOP][AGENT:%s]',_0x2b0bc4);RpcUser[_0xde14('0x38')](this[_0xde14('0x7')][_0x2b0bc4]);RpcVoiceAgentReport[_0xde14('0x39')]({'acwtime':_0x1228d8,'agentacw':!![]},_0x4a363c,_0x2b0bc4)[_0xde14('0x23')](function(_0x346566){logger[_0xde14('0x26')](_0xde14('0x3a'),_0x4a363c,_0x1228d8,_0x346566);})[_0xde14('0x32')](function(_0x50db0d){logger[_0xde14('0x35')](_0xde14('0x33'),_0x4a363c,_0x50db0d);});}else{logger[_0xde14('0x35')](_0xde14('0x3b'),_0x2b0bc4);if(_0x2ac7ba['timers']){logger['info'](_0xde14('0x3c'),JSON[_0xde14('0x3d')](_0x2ac7ba[_0xde14('0x8')]));}}}catch(_0x171080){logger[_0xde14('0x35')]('[ACW][STOP]\x20%s',_0x171080[_0xde14('0x37')]);}};Acw[_0xde14('0x1b')][_0xde14('0xa')]=function(_0x595fd5){try{if(this[_0xde14('0x6')][_0x595fd5['queue']]&&(this[_0xde14('0x6')][_0x595fd5['queue']][_0xde14('0x4')]||this[_0xde14('0x6')][_0x595fd5[_0xde14('0x1e')]][_0xde14('0x20')])){if(this[_0xde14('0x7')][_0x595fd5[_0xde14('0x1d')]]){this[_0xde14('0x1c')][_0x595fd5[_0xde14('0x30')]]={'queue':_0x595fd5['queue'],'interface':_0x595fd5[_0xde14('0x1d')],'destlinkedid':_0x595fd5['destlinkedid']};}}}catch(_0x430b22){logger['error'](_0xde14('0x3e'),_0x430b22[_0xde14('0x37')]);}};Acw[_0xde14('0x1b')][_0xde14('0x17')]=function(_0x40e7ae){try{if(this[_0xde14('0x6')][_0x40e7ae[_0xde14('0x1e')]]&&(this[_0xde14('0x6')][_0x40e7ae['queue']][_0xde14('0x4')]||this[_0xde14('0x6')][_0x40e7ae[_0xde14('0x1e')]][_0xde14('0x20')])){if(this['agents'][_0x40e7ae[_0xde14('0x1d')]]){this[_0xde14('0x1c')][_0x40e7ae[_0xde14('0x30')]]={'queue':_0x40e7ae[_0xde14('0x1e')],'interface':_0x40e7ae[_0xde14('0x1d')]};}}}catch(_0x19e12c){logger['error'](_0xde14('0x3f'),_0x19e12c['message']);}};Acw[_0xde14('0x1b')][_0xde14('0xd')]=function(_0x48a677){try{if(this[_0xde14('0x1c')][_0x48a677[_0xde14('0x30')]]&&_[_0xde14('0x40')](this[_0xde14('0x1c')][_0x48a677[_0xde14('0x30')]][_0xde14('0x28')])){logger[_0xde14('0x26')]('[%s][HANGUP:UNIQUEID]',_0x48a677[_0xde14('0x30')]);this['startAcw'](_0x48a677[_0xde14('0x30')]);}else if(this[_0xde14('0x1c')][_0x48a677[_0xde14('0x41')]]&&_[_0xde14('0x40')](this[_0xde14('0x1c')][_0x48a677[_0xde14('0x41')]][_0xde14('0x28')])){logger[_0xde14('0x26')](_0xde14('0x42'),_0x48a677[_0xde14('0x41')]);this['startAcw'](_0x48a677[_0xde14('0x41')]);}}catch(_0x1688c6){logger[_0xde14('0x35')](_0xde14('0x43'),_0x1688c6[_0xde14('0x37')]);}};Acw['prototype'][_0xde14('0xf')]=function(_0x4dc2e3){try{if(this[_0xde14('0x1c')][_0x4dc2e3[_0xde14('0x30')]]&&this[_0xde14('0x1c')][_0x4dc2e3[_0xde14('0x30')]][_0xde14('0x28')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x4dc2e3[_0xde14('0x30')]);this['startAcw'](_0x4dc2e3[_0xde14('0x30')]);}else if(this[_0xde14('0x1c')][_0x4dc2e3[_0xde14('0x41')]]&&this[_0xde14('0x1c')][_0x4dc2e3[_0xde14('0x41')]][_0xde14('0x28')]){logger[_0xde14('0x26')](_0xde14('0x44'),_0x4dc2e3[_0xde14('0x41')]);this['startAcw'](_0x4dc2e3[_0xde14('0x41')]);}}catch(_0x2c972b){logger[_0xde14('0x35')](_0xde14('0x45'),_0x2c972b[_0xde14('0x37')]);}};Acw['prototype'][_0xde14('0x13')]=function(_0x58790d){try{if(!_[_0xde14('0x46')](this[_0xde14('0x1c')][_0x58790d[_0xde14('0x47')]])){this[_0xde14('0x48')](_0x58790d[_0xde14('0x47')]);if(this[_0xde14('0x1c')][_0x58790d[_0xde14('0x49')]]){this[_0xde14('0x1c')][_0x58790d['secondtransfereruniqueid']]['attended']=!![];this['channels'][_0x58790d[_0xde14('0x4a')]]=this['channels'][_0x58790d['secondtransfereruniqueid']];delete this[_0xde14('0x1c')][_0x58790d[_0xde14('0x49')]];}}else if(!_[_0xde14('0x46')](this[_0xde14('0x1c')][_0x58790d[_0xde14('0x4a')]])){this[_0xde14('0x48')](_0x58790d[_0xde14('0x4a')]);if(this[_0xde14('0x1c')][_0x58790d[_0xde14('0x4b')]]){this['channels'][_0x58790d[_0xde14('0x4b')]][_0xde14('0x28')]=!![];this[_0xde14('0x1c')][_0x58790d['transfereeuniqueid']]=this[_0xde14('0x1c')][_0x58790d['origtransfereruniqueid']];delete this[_0xde14('0x1c')][_0x58790d[_0xde14('0x4b')]];}}}catch(_0x40ab83){logger[_0xde14('0x35')](_0xde14('0x4c'),_0x40ab83[_0xde14('0x37')]);}};Acw[_0xde14('0x1b')]['syncBlindTransfer']=function(_0x3a357a){try{if(this[_0xde14('0x1c')][_0x3a357a[_0xde14('0x4d')]]){logger[_0xde14('0x26')](_0xde14('0x4e'),JSON[_0xde14('0x3d')](_0x3a357a[_0xde14('0x4d')]));this['startAcw'](_0x3a357a['transfereruniqueid']);}else if(this[_0xde14('0x1c')][_0x3a357a[_0xde14('0x4f')]]){logger[_0xde14('0x26')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0xde14('0x3d')](_0x3a357a[_0xde14('0x4f')]));this[_0xde14('0x48')](_0x3a357a[_0xde14('0x4f')]);}}catch(_0x51e8ca){logger['error'](_0xde14('0x50'),_0x51e8ca[_0xde14('0x37')]);}};Acw[_0xde14('0x1b')][_0xde14('0x11')]=function(_0x136c21){try{if(this[_0xde14('0x6')][_0x136c21[_0xde14('0x1e')]]&&this[_0xde14('0x6')][_0x136c21[_0xde14('0x1e')]][_0xde14('0x51')]===_0xde14('0x52')){if(this[_0xde14('0x7')][_0x136c21[_0xde14('0x1d')]]){logger[_0xde14('0x26')](_0xde14('0x53'),_0x136c21[_0xde14('0x30')],_0x136c21[_0xde14('0x1d')],_0x136c21[_0xde14('0x1e')]);return RpcUser[_0xde14('0x2a')](this[_0xde14('0x7')][_0x136c21[_0xde14('0x1d')]],_0xde14('0x54'),_0x136c21[_0xde14('0x30')]);}}}catch(_0x4809fa){logger[_0xde14('0x35')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x4809fa[_0xde14('0x37')]);}};module['exports']=Acw; \ No newline at end of file +var _0x7dfd=['mandatoryDispositionPause','name','QueuePause','getAgent','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','timer','stopAcw','acwTimeout','lastPauseAt','updateAcw','update','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','saveUnpause','prototype','interface','[ACW][syncAgentConnect]\x20%s','message','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','exports','util','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','bind','hanguprequest','syncHangupRequest','syncHangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','startAcw','queue','mandatoryDisposition'];(function(_0x17c860,_0x3e2265){var _0x5435bd=function(_0x54ec2d){while(--_0x54ec2d){_0x17c860['push'](_0x17c860['shift']());}};_0x5435bd(++_0x3e2265);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xd7df('0x0'));var _=require(_0xd7df('0x1'));var moment=require(_0xd7df('0x2'));var ami=require(_0xd7df('0x3'));var logger=require(_0xd7df('0x4'))(_0xd7df('0x5'));var RpcUser=require(_0xd7df('0x6'));var RpcVoiceAgentReport=require(_0xd7df('0x7'));function Acw(_0x3ef231){this[_0xd7df('0x8')]=_0x3ef231[_0xd7df('0x8')];this[_0xd7df('0x9')]=_0x3ef231[_0xd7df('0x9')];this[_0xd7df('0xa')]=_0x3ef231[_0xd7df('0xa')];this[_0xd7df('0xb')]={};ami['on'](_0xd7df('0xc'),this['syncAgentConnect'][_0xd7df('0xd')](this));ami['on'](_0xd7df('0xe'),this[_0xd7df('0xf')][_0xd7df('0xd')](this));ami['on']('hangup',this[_0xd7df('0x10')]['bind'](this));ami['on'](_0xd7df('0x11'),this['syncAgentRingNoAnswer'][_0xd7df('0xd')](this));ami['on'](_0xd7df('0x12'),this[_0xd7df('0x13')][_0xd7df('0xd')](this));ami['on'](_0xd7df('0x14'),this[_0xd7df('0x15')][_0xd7df('0xd')](this));ami['on'](_0xd7df('0x16'),this[_0xd7df('0x17')][_0xd7df('0xd')](this));}function getDiff(_0xa70589){var _0x4723b7=moment()[_0xd7df('0x18')](0x0);var _0x196632=moment(_0xa70589)[_0xd7df('0x18')](0x0);return _0x4723b7[_0xd7df('0x19')](_0x196632,_0xd7df('0x1a'));}Acw['prototype'][_0xd7df('0x1b')]=function(_0x23cdbc){try{var _0x513b13=this;var _0x18d38f=this[_0xd7df('0xb')][_0x23cdbc]['interface'];var _0x43bc73=this[_0xd7df('0xb')][_0x23cdbc][_0xd7df('0x1c')];var _0x5210e5=this[_0xd7df('0x8')][_0x43bc73];var _0x471621=![];var _0x3cea3='ACW';if(_0x5210e5[_0xd7df('0x1d')]){if(_0x5210e5[_0xd7df('0x1e')][_0xd7df('0x1f')]){_0x471621=!![];_0x3cea3=_0x5210e5['mandatoryDispositionPause'][_0xd7df('0x1f')];}}ami['Action']({'action':_0xd7df('0x20'),'interface':_0x18d38f,'paused':!![],'reason':_0x3cea3})['then'](function(_0x3ae7c3){if(_0x513b13[_0xd7df('0x9')][_0x18d38f]){return RpcUser[_0xd7df('0x21')](_0x513b13['agents'][_0x18d38f]['id'])[_0xd7df('0x22')](function(_0x502ae8){if(_0x502ae8&&!_0x502ae8[_0xd7df('0x23')]){logger[_0xd7df('0x24')](_0xd7df('0x25'),_0x23cdbc,_0x18d38f,_0x43bc73);var _0x29f354=_0x513b13[_0xd7df('0xb')][_0x23cdbc][_0xd7df('0x26')]&&_0x513b13[_0xd7df('0xb')][_0x23cdbc]['destlinkedid']?_0x513b13['channels'][_0x23cdbc][_0xd7df('0x27')]:_0x23cdbc;return RpcUser[_0xd7df('0x28')](_0x513b13[_0xd7df('0x9')][_0x18d38f],_0x3cea3,_0x29f354)[_0xd7df('0x22')](function(_0x13f190){if(!_0x471621){_0x513b13[_0xd7df('0xa')][_0x18d38f]={};logger[_0xd7df('0x24')](_0xd7df('0x29'),_0x23cdbc,_0x513b13[_0xd7df('0x8')][_0x43bc73]['acwTimeout'],_0x18d38f,_0x43bc73);_0x513b13[_0xd7df('0xa')][_0x18d38f][_0xd7df('0x2a')]=setTimeout(_0x513b13[_0xd7df('0x2b')][_0xd7df('0xd')](_0x513b13,_0x18d38f),_0x513b13[_0xd7df('0x8')][_0x43bc73][_0xd7df('0x2c')]*0x3e8);_0x513b13[_0xd7df('0xa')][_0x18d38f][_0xd7df('0x2d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x513b13['timers'][_0x18d38f]['uniqueid']=_0x23cdbc;_0x513b13['timers'][_0x18d38f][_0xd7df('0x1c')]=_0x43bc73;_0x513b13['timers'][_0x18d38f][_0xd7df('0x2e')]=function(){var _0x156612=getDiff(_0x513b13['timers'][_0x18d38f][_0xd7df('0x2d')]);clearTimeout(_0x513b13[_0xd7df('0xa')][_0x18d38f]['timer']);_0x513b13[_0xd7df('0xa')][_0x18d38f][_0xd7df('0x2a')]=![];RpcVoiceAgentReport[_0xd7df('0x2f')]({'acwtime':_0x156612},_0x513b13[_0xd7df('0xa')][_0x18d38f][_0xd7df('0x30')],_0x18d38f)[_0xd7df('0x22')](function(_0x5a658f){logger[_0xd7df('0x24')](_0xd7df('0x31'),_0x23cdbc,_0x156612,_0x5a658f);})[_0xd7df('0x32')](function(_0x1d81b2){logger[_0xd7df('0x33')](_0xd7df('0x34'),_0x23cdbc,_0x1d81b2);});delete _0x513b13[_0xd7df('0xa')][_0x18d38f];};}});}else{logger[_0xd7df('0x24')](_0xd7df('0x35'),_0x23cdbc,_0x18d38f,_0x43bc73);}});}})[_0xd7df('0x32')](function(_0x2e828e){logger['error']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x23cdbc,_0x513b13[_0xd7df('0x8')][_0x43bc73]['acwTimeout'],_0x18d38f,_0x43bc73);})[_0xd7df('0x36')](function(){delete _0x513b13[_0xd7df('0xb')][_0x23cdbc];});}catch(_0xa0ed20){logger[_0xd7df('0x33')]('[ACW][START]\x20%s',_0xa0ed20['message']);}};Acw['prototype'][_0xd7df('0x2b')]=function(_0x15e682){try{var _0x55c43f=this;if(_0x55c43f[_0xd7df('0xa')][_0x15e682]){_0x55c43f[_0xd7df('0xa')][_0x15e682][_0xd7df('0x2a')]=![];var _0x574567=_0x55c43f['timers'][_0x15e682][_0xd7df('0x30')];var _0x45642c=_0x55c43f['timers'][_0x15e682][_0xd7df('0x1c')];var _0x564ce2=_0x55c43f[_0xd7df('0x8')][_0x45642c][_0xd7df('0x2c')];logger[_0xd7df('0x24')]('[TIMER][STOP][AGENT:%s]',_0x15e682);RpcUser[_0xd7df('0x37')](this[_0xd7df('0x9')][_0x15e682]);RpcVoiceAgentReport[_0xd7df('0x2f')]({'acwtime':_0x564ce2,'agentacw':!![]},_0x574567,_0x15e682)[_0xd7df('0x22')](function(_0x54ea42){logger[_0xd7df('0x24')](_0xd7df('0x31'),_0x574567,_0x564ce2,_0x54ea42);})[_0xd7df('0x32')](function(_0x4f6286){logger[_0xd7df('0x33')](_0xd7df('0x34'),_0x574567,_0x4f6286);});}else{logger[_0xd7df('0x33')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x15e682);if(_0x55c43f[_0xd7df('0xa')]){logger[_0xd7df('0x24')]('[ACW][TIMERS]',JSON['stringify'](_0x55c43f[_0xd7df('0xa')]));}}}catch(_0x211feb){logger[_0xd7df('0x33')]('[ACW][STOP]\x20%s',_0x211feb['message']);}};Acw[_0xd7df('0x38')]['syncAgentConnect']=function(_0xe606f4){try{if(this['voiceQueues'][_0xe606f4['queue']]&&(this[_0xd7df('0x8')][_0xe606f4['queue']][_0xd7df('0x5')]||this[_0xd7df('0x8')][_0xe606f4[_0xd7df('0x1c')]][_0xd7df('0x1d')])){if(this[_0xd7df('0x9')][_0xe606f4[_0xd7df('0x39')]]){this[_0xd7df('0xb')][_0xe606f4[_0xd7df('0x30')]]={'queue':_0xe606f4[_0xd7df('0x1c')],'interface':_0xe606f4['interface'],'destlinkedid':_0xe606f4[_0xd7df('0x27')]};}}}catch(_0x4b9076){logger[_0xd7df('0x33')](_0xd7df('0x3a'),_0x4b9076[_0xd7df('0x3b')]);}};Acw[_0xd7df('0x38')][_0xd7df('0x17')]=function(_0x145223){try{if(this[_0xd7df('0x8')][_0x145223[_0xd7df('0x1c')]]&&(this[_0xd7df('0x8')][_0x145223['queue']][_0xd7df('0x5')]||this[_0xd7df('0x8')][_0x145223['queue']]['mandatoryDisposition'])){if(this[_0xd7df('0x9')][_0x145223[_0xd7df('0x39')]]){this[_0xd7df('0xb')][_0x145223['uniqueid']]={'queue':_0x145223['queue'],'interface':_0x145223[_0xd7df('0x39')]};}}}catch(_0x49a763){logger[_0xd7df('0x33')](_0xd7df('0x3c'),_0x49a763[_0xd7df('0x3b')]);}};Acw[_0xd7df('0x38')][_0xd7df('0xf')]=function(_0x28c13f){try{if(this[_0xd7df('0xb')][_0x28c13f[_0xd7df('0x30')]]&&_[_0xd7df('0x3d')](this[_0xd7df('0xb')][_0x28c13f[_0xd7df('0x30')]][_0xd7df('0x26')])){logger['info'](_0xd7df('0x3e'),_0x28c13f[_0xd7df('0x30')]);this[_0xd7df('0x1b')](_0x28c13f[_0xd7df('0x30')]);}else if(this[_0xd7df('0xb')][_0x28c13f['linkedid']]&&_[_0xd7df('0x3d')](this[_0xd7df('0xb')][_0x28c13f[_0xd7df('0x3f')]]['attended'])){logger[_0xd7df('0x24')]('[%s][HANGUP:LINKEDID]',_0x28c13f[_0xd7df('0x3f')]);this[_0xd7df('0x1b')](_0x28c13f[_0xd7df('0x3f')]);}}catch(_0x579bec){logger[_0xd7df('0x33')]('[ACW][syncHangupRequest]\x20%s',_0x579bec['message']);}};Acw['prototype'][_0xd7df('0x10')]=function(_0x4a6cf5){try{if(this[_0xd7df('0xb')][_0x4a6cf5[_0xd7df('0x30')]]&&this[_0xd7df('0xb')][_0x4a6cf5[_0xd7df('0x30')]][_0xd7df('0x26')]){logger[_0xd7df('0x24')](_0xd7df('0x40'),_0x4a6cf5[_0xd7df('0x30')]);this[_0xd7df('0x1b')](_0x4a6cf5[_0xd7df('0x30')]);}else if(this[_0xd7df('0xb')][_0x4a6cf5[_0xd7df('0x3f')]]&&this[_0xd7df('0xb')][_0x4a6cf5[_0xd7df('0x3f')]][_0xd7df('0x26')]){logger[_0xd7df('0x24')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x4a6cf5[_0xd7df('0x3f')]);this[_0xd7df('0x1b')](_0x4a6cf5['linkedid']);}}catch(_0x56819b){logger[_0xd7df('0x33')]('[ACW][syncHangup]\x20%s',_0x56819b[_0xd7df('0x3b')]);}};Acw['prototype'][_0xd7df('0x13')]=function(_0x28151a){try{if(!_[_0xd7df('0x41')](this['channels'][_0x28151a['transfereeuniqueid']])){this['startAcw'](_0x28151a[_0xd7df('0x42')]);if(this[_0xd7df('0xb')][_0x28151a[_0xd7df('0x43')]]){this[_0xd7df('0xb')][_0x28151a[_0xd7df('0x43')]][_0xd7df('0x26')]=!![];this['channels'][_0x28151a[_0xd7df('0x44')]]=this[_0xd7df('0xb')][_0x28151a[_0xd7df('0x43')]];delete this[_0xd7df('0xb')][_0x28151a[_0xd7df('0x43')]];}}else if(!_[_0xd7df('0x41')](this[_0xd7df('0xb')][_0x28151a[_0xd7df('0x44')]])){this[_0xd7df('0x1b')](_0x28151a[_0xd7df('0x44')]);if(this[_0xd7df('0xb')][_0x28151a[_0xd7df('0x45')]]){this[_0xd7df('0xb')][_0x28151a[_0xd7df('0x45')]][_0xd7df('0x26')]=!![];this[_0xd7df('0xb')][_0x28151a[_0xd7df('0x42')]]=this[_0xd7df('0xb')][_0x28151a[_0xd7df('0x45')]];delete this[_0xd7df('0xb')][_0x28151a[_0xd7df('0x45')]];}}}catch(_0x393a3a){logger[_0xd7df('0x33')](_0xd7df('0x46'),_0x393a3a[_0xd7df('0x3b')]);}};Acw[_0xd7df('0x38')]['syncBlindTransfer']=function(_0x57ec6f){try{if(this[_0xd7df('0xb')][_0x57ec6f[_0xd7df('0x47')]]){logger[_0xd7df('0x24')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0xd7df('0x48')](_0x57ec6f[_0xd7df('0x47')]));this[_0xd7df('0x1b')](_0x57ec6f[_0xd7df('0x47')]);}else if(this['channels'][_0x57ec6f[_0xd7df('0x49')]]){logger[_0xd7df('0x24')](_0xd7df('0x4a'),JSON[_0xd7df('0x48')](_0x57ec6f[_0xd7df('0x49')]));this[_0xd7df('0x1b')](_0x57ec6f[_0xd7df('0x49')]);}}catch(_0x2fdad0){logger['error'](_0xd7df('0x4b'),_0x2fdad0[_0xd7df('0x3b')]);}};Acw['prototype']['syncAgentRingNoAnswer']=function(_0x481fa5){try{if(this[_0xd7df('0x8')][_0x481fa5[_0xd7df('0x1c')]]&&this[_0xd7df('0x8')][_0x481fa5[_0xd7df('0x1c')]]['autopause']===_0xd7df('0x4c')){if(this[_0xd7df('0x9')][_0x481fa5[_0xd7df('0x39')]]){logger[_0xd7df('0x24')](_0xd7df('0x4d'),_0x481fa5[_0xd7df('0x30')],_0x481fa5[_0xd7df('0x39')],_0x481fa5['queue']);return RpcUser['savePause'](this[_0xd7df('0x9')][_0x481fa5['interface']],_0xd7df('0x4e'),_0x481fa5[_0xd7df('0x30')]);}}}catch(_0x1efefa){logger['error']('[ACW][syncAgentRingNoAnswer]\x20%s',_0x1efefa[_0xd7df('0x3b')]);}};module[_0xd7df('0x4f')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index b431e1c..f9e727c 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 _0xa80a=['port','username','Action','promisify','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','catch','log','asterisk-manager','bluebird','moment','util','ami','../../config/environment','asterisk'];(function(_0x34f683,_0xb0184){var _0x49c0bd=function(_0x395f64){while(--_0x395f64){_0x34f683['push'](_0x34f683['shift']());}};_0x49c0bd(++_0xb0184);}(_0xa80a,0x1e3));var _0xaa80=function(_0x54deeb,_0x6dbfc4){_0x54deeb=_0x54deeb-0x0;var _0x3cffa8=_0xa80a[_0x54deeb];return _0x3cffa8;};'use strict';var Manager=require(_0xaa80('0x0'));var BPromise=require(_0xaa80('0x1'));var moment=require(_0xaa80('0x2'));var util=require(_0xaa80('0x3'));var _=require('lodash');var logger=require('../../config/logger')(_0xaa80('0x4'));var config=require(_0xaa80('0x5'));var ami=new Manager(config[_0xaa80('0x6')][_0xaa80('0x7')],config[_0xaa80('0x6')]['ip'],config[_0xaa80('0x6')][_0xaa80('0x8')],config['asterisk']['password'],!![]);ami['keepConnected']();ami[_0xaa80('0x9')]=BPromise[_0xaa80('0xa')](ami['action']);function error(_0x16cef2){logger[_0xaa80('0xb')](util[_0xaa80('0xc')](_0xaa80('0xd'),config[_0xaa80('0x6')]['username'],config['asterisk']['ip'],config[_0xaa80('0x6')][_0xaa80('0x7')],util[_0xaa80('0xe')](_0x16cef2,![],null)));}function close(){logger[_0xaa80('0xb')](util[_0xaa80('0xc')](_0xaa80('0xf'),config[_0xaa80('0x6')][_0xaa80('0x8')],config[_0xaa80('0x6')]['ip'],config[_0xaa80('0x6')][_0xaa80('0x7')]));}ami[_0xaa80('0x10')]=function(){return function(){return ami['Action']({'action':_0xaa80('0x11')});};};ami[_0xaa80('0x12')]=function(){return function(){return ami['Action']({'action':_0xaa80('0x13')});};};ami[_0xaa80('0x14')]=function(){return function(){return ami[_0xaa80('0x9')]({'action':_0xaa80('0x15')});};};ami[_0xaa80('0x16')]=function(){return function(){return ami[_0xaa80('0x9')]({'action':'queuesummary'});};};ami[_0xaa80('0x17')]=function(){return function(){return ami[_0xaa80('0x9')]({'action':'coreshowchannels'});};};function connect(_0x151562){logger[_0xaa80('0x18')](util[_0xaa80('0xc')](_0xaa80('0x19'),config[_0xaa80('0x6')]['username'],config['asterisk']['ip'],config[_0xaa80('0x6')][_0xaa80('0x7')]));ami[_0xaa80('0x1a')]('error',error);ami['once'](_0xaa80('0x1b'),close);}ami['on'](_0xaa80('0x1c'),connect);ami['on'](_0xaa80('0x1d'),function(_0x1581af){logger[_0xaa80('0x18')](util[_0xaa80('0xc')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0xaa80('0x8')],config[_0xaa80('0x6')]['ip'],config[_0xaa80('0x6')][_0xaa80('0x7')],util[_0xaa80('0xe')](_0x1581af,![],null)));});ami['on']('fullybooted',function(_0x340c40){logger[_0xaa80('0x18')](util[_0xaa80('0xc')](_0xaa80('0x1e'),config[_0xaa80('0x6')]['username'],config[_0xaa80('0x6')]['ip'],config[_0xaa80('0x6')][_0xaa80('0x7')]));return BPromise[_0xaa80('0x1f')]()[_0xaa80('0x20')](ami[_0xaa80('0x10')]())[_0xaa80('0x20')](ami[_0xaa80('0x12')]())['then'](ami[_0xaa80('0x14')]())['then'](ami[_0xaa80('0x16')]())['then'](ami[_0xaa80('0x17')]())[_0xaa80('0x21')](function(_0x1c13b0){console[_0xaa80('0x22')](_0x1c13b0);});});ami['once'](_0xaa80('0xb'),error);ami['once'](_0xaa80('0x1b'),close);module['exports']=ami; \ No newline at end of file +var _0xe138=['resolve','then','actionQueueSummary','log','exports','moment','util','lodash','../../config/logger','../../config/environment','asterisk','port','username','keepConnected','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','sipshowregistry','actionDeviceStateList','Action','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0xe138,0x11d));var _0x8e13=function(_0x2b8bd5,_0x3d2b4b){_0x2b8bd5=_0x2b8bd5-0x0;var _0x255dd8=_0xe138[_0x2b8bd5];return _0x255dd8;};'use strict';var Manager=require('asterisk-manager');var BPromise=require('bluebird');var moment=require(_0x8e13('0x0'));var util=require(_0x8e13('0x1'));var _=require(_0x8e13('0x2'));var logger=require(_0x8e13('0x3'))('ami');var config=require(_0x8e13('0x4'));var ami=new Manager(config[_0x8e13('0x5')][_0x8e13('0x6')],config[_0x8e13('0x5')]['ip'],config['asterisk'][_0x8e13('0x7')],config[_0x8e13('0x5')]['password'],!![]);ami[_0x8e13('0x8')]();ami['Action']=BPromise['promisify'](ami[_0x8e13('0x9')]);function error(_0xab760d){logger[_0x8e13('0xa')](util[_0x8e13('0xb')](_0x8e13('0xc'),config[_0x8e13('0x5')][_0x8e13('0x7')],config[_0x8e13('0x5')]['ip'],config[_0x8e13('0x5')][_0x8e13('0x6')],util[_0x8e13('0xd')](_0xab760d,![],null)));}function close(){logger[_0x8e13('0xa')](util[_0x8e13('0xb')](_0x8e13('0xe'),config[_0x8e13('0x5')][_0x8e13('0x7')],config['asterisk']['ip'],config[_0x8e13('0x5')][_0x8e13('0x6')]));}ami['actionSipShowRegistry']=function(){return function(){return ami['Action']({'action':_0x8e13('0xf')});};};ami[_0x8e13('0x10')]=function(){return function(){return ami[_0x8e13('0x11')]({'action':'devicestatelist'});};};ami[_0x8e13('0x12')]=function(){return function(){return ami[_0x8e13('0x11')]({'action':_0x8e13('0x13')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0x8e13('0x11')]({'action':_0x8e13('0x14')});};};ami[_0x8e13('0x15')]=function(){return function(){return ami[_0x8e13('0x11')]({'action':'coreshowchannels'});};};function connect(_0x3cbb48){logger[_0x8e13('0x16')](util[_0x8e13('0xb')](_0x8e13('0x17'),config[_0x8e13('0x5')][_0x8e13('0x7')],config['asterisk']['ip'],config['asterisk'][_0x8e13('0x6')]));ami[_0x8e13('0x18')]('error',error);ami[_0x8e13('0x18')](_0x8e13('0x19'),close);}ami['on'](_0x8e13('0x1a'),connect);ami['on'](_0x8e13('0x1b'),function(_0x5cc5ef){logger[_0x8e13('0x16')](util[_0x8e13('0xb')](_0x8e13('0x1c'),config['asterisk']['username'],config[_0x8e13('0x5')]['ip'],config['asterisk'][_0x8e13('0x6')],util[_0x8e13('0xd')](_0x5cc5ef,![],null)));});ami['on'](_0x8e13('0x1d'),function(_0x465091){logger['info'](util['format']('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x8e13('0x5')][_0x8e13('0x7')],config[_0x8e13('0x5')]['ip'],config[_0x8e13('0x5')][_0x8e13('0x6')]));return BPromise[_0x8e13('0x1e')]()[_0x8e13('0x1f')](ami['actionSipShowRegistry']())['then'](ami[_0x8e13('0x10')]())[_0x8e13('0x1f')](ami[_0x8e13('0x12')]())[_0x8e13('0x1f')](ami[_0x8e13('0x20')]())[_0x8e13('0x1f')](ami['actionCoreShowChannels']())['catch'](function(_0x4b184d){console[_0x8e13('0x21')](_0x4b184d);});});ami[_0x8e13('0x18')](_0x8e13('0xa'),error);ami[_0x8e13('0x18')](_0x8e13('0x19'),close);module[_0x8e13('0x22')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index e7e4559..9fe06b0 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 _0xaa06=['ami','client','http','Request','request','then','rpc','error','memberReport','message','result','jayson/promise','bluebird'];(function(_0x2dbd54,_0x173004){var _0x4e0233=function(_0x50854e){while(--_0x50854e){_0x2dbd54['push'](_0x2dbd54['shift']());}};_0x4e0233(++_0x173004);}(_0xaa06,0xa7));var _0x6aa0=function(_0x49abe3,_0x469007){_0x49abe3=_0x49abe3-0x0;var _0x4fd200=_0xaa06[_0x49abe3];return _0x4fd200;};'use strict';var jayson=require(_0x6aa0('0x0'));var BPromise=require(_0x6aa0('0x1'));var logger=require('../../config/logger')(_0x6aa0('0x2'));var client=jayson[_0x6aa0('0x3')][_0x6aa0('0x4')]({'port':0x2329});client[_0x6aa0('0x5')]=function(_0x27a63a,_0x5aa9ad){return new BPromise(function(_0x422fc6,_0x4a1b25){return client[_0x6aa0('0x6')](_0x27a63a,_0x5aa9ad)[_0x6aa0('0x7')](function(_0x1f77ff){logger['debug'](_0x6aa0('0x8'),'memberReport',_0x27a63a,_0x5aa9ad,_0x1f77ff);if(_0x1f77ff[_0x6aa0('0x9')]){logger[_0x6aa0('0x9')](_0x6aa0('0x8'),_0x6aa0('0xa'),_0x27a63a,_0x1f77ff['error'][_0x6aa0('0xb')],_0x5aa9ad);return _0x4a1b25(_0x1f77ff[_0x6aa0('0x9')][_0x6aa0('0xb')]);}else{return _0x422fc6(_0x1f77ff[_0x6aa0('0xc')]);}})['catch'](function(_0x4977ad){logger[_0x6aa0('0x9')](_0x6aa0('0x8'),_0x6aa0('0xa'),_0x27a63a,_0x4977ad,_0x5aa9ad);return _0x4a1b25(_0x4977ad);});});};module['exports']=client; \ No newline at end of file +var _0x848c=['catch','exports','jayson/promise','bluebird','../../config/logger','ami','client','Request','request','debug','error','rpc','message','result'];(function(_0xc115b,_0x19e7c7){var _0x481438=function(_0x59fe74){while(--_0x59fe74){_0xc115b['push'](_0xc115b['shift']());}};_0x481438(++_0x19e7c7);}(_0x848c,0x1ec));var _0xc848=function(_0x2c32fb,_0x45b9a8){_0x2c32fb=_0x2c32fb-0x0;var _0x1f2836=_0x848c[_0x2c32fb];return _0x1f2836;};'use strict';var jayson=require(_0xc848('0x0'));var BPromise=require(_0xc848('0x1'));var logger=require(_0xc848('0x2'))(_0xc848('0x3'));var client=jayson[_0xc848('0x4')]['http']({'port':0x2329});client[_0xc848('0x5')]=function(_0x17402f,_0x167de6){return new BPromise(function(_0x3ffb28,_0x316a6e){return client[_0xc848('0x6')](_0x17402f,_0x167de6)['then'](function(_0x2f7948){logger[_0xc848('0x7')]('rpc','memberReport',_0x17402f,_0x167de6,_0x2f7948);if(_0x2f7948[_0xc848('0x8')]){logger[_0xc848('0x8')](_0xc848('0x9'),'memberReport',_0x17402f,_0x2f7948[_0xc848('0x8')][_0xc848('0xa')],_0x167de6);return _0x316a6e(_0x2f7948[_0xc848('0x8')][_0xc848('0xa')]);}else{return _0x3ffb28(_0x2f7948[_0xc848('0xb')]);}})[_0xc848('0xc')](function(_0x5c54ca){logger['error']('rpc','memberReport',_0x17402f,_0x5c54ca,_0x167de6);return _0x316a6e(_0x5c54ca);});});};module[_0xc848('0xd')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 85e3703..708a34d 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 _0xe773=['countmachineretry','countagentrejectretry','ContactId','ListId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','dialCutDigit','number','substring','getQueue','exports','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','queue','active','type','dialQueueTimeout','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry'];(function(_0x16ebd6,_0xc374c2){var _0x424208=function(_0x58befb){while(--_0x58befb){_0x16ebd6['push'](_0x16ebd6['shift']());}};_0x424208(++_0xc374c2);}(_0xe773,0x19a));var _0x3e77=function(_0x3c1f48,_0x16817b){_0x3c1f48=_0x3c1f48-0x0;var _0x27d379=_0xe773[_0x3c1f48];return _0x27d379;};'use strict';var util=require('util');var _=require(_0x3e77('0x0'));var moment=require(_0x3e77('0x1'));function checkNameSurname(_0x2f35f5,_0x532e5e,_0x22ad46){var _0x1fc5fb='';if(!_[_0x3e77('0x2')](_0x532e5e)&&_0x3e77('0x3')===typeof _0x532e5e){_0x1fc5fb+=_0x532e5e;}if(!_[_0x3e77('0x2')](_0x22ad46)&&'string'===typeof _0x22ad46){_0x1fc5fb+='\x20'+_0x22ad46;}if(_0x1fc5fb!==''){return _0x1fc5fb;}return _0x2f35f5;}function Action(_0x21828a,_0x33cc7c,_0x1fc36e){this[_0x3e77('0x4')]=_0x21828a;this[_0x3e77('0x5')]=_0x1fc36e||undefined;this[_0x3e77('0x6')]=checkNameSurname(_0x33cc7c[_0x3e77('0x7')][_0x3e77('0x8')],_0x33cc7c[_0x3e77('0x7')][_0x3e77('0x9')],_0x33cc7c[_0x3e77('0x7')]['lastName']);this['number']=_0x33cc7c[_0x3e77('0x7')][_0x3e77('0x8')];this[_0x3e77('0xa')]=_0x21828a[_0x3e77('0x6')];this[_0x3e77('0xb')]=_0x33cc7c['active']||![];this[_0x3e77('0xc')]=_0x21828a['type'];this['dialQueueTimeout']=_0x21828a[_0x3e77('0xd')]||0x3;this['scheduledat']=_0x33cc7c['scheduledat'];this[_0x3e77('0xe')]=_0x33cc7c[_0x3e77('0xe')];this[_0x3e77('0xf')]=_0x33cc7c['countcongestionretry'];this[_0x3e77('0x10')]=_0x33cc7c['countnoanswerretry'];this[_0x3e77('0x11')]=_0x33cc7c[_0x3e77('0x11')];this['countdropretry']=_0x33cc7c[_0x3e77('0x12')];this[_0x3e77('0x13')]=_0x33cc7c[_0x3e77('0x13')];this[_0x3e77('0x14')]=_0x33cc7c[_0x3e77('0x14')];this[_0x3e77('0x15')]=_0x33cc7c['countagentrejectretry'];this[_0x3e77('0x16')]=_0x33cc7c[_0x3e77('0x16')];this[_0x3e77('0x17')]=_0x33cc7c[_0x3e77('0x17')];this['UserId']=_0x33cc7c['UserId'];this[_0x3e77('0x18')]=_0x33cc7c['VoiceQueueId'];this[_0x3e77('0x19')]=_0x33cc7c[_0x3e77('0x19')];this[_0x3e77('0x1a')]=_0x33cc7c['id'];this[_0x3e77('0x1b')]=_0x33cc7c[_0x3e77('0x7')][_0x3e77('0x9')]||'';this['starttime']=moment()[_0x3e77('0x1c')](_0x3e77('0x1d'));this[_0x3e77('0x1e')]=_0x33cc7c[_0x3e77('0x1e')];this[_0x3e77('0x1f')]=_0x33cc7c[_0x3e77('0x1f')];this[_0x3e77('0x20')]=_0x33cc7c[_0x3e77('0x20')];this['recallme']=_0x33cc7c[_0x3e77('0x21')];this[_0x3e77('0x22')]='';this[_0x3e77('0x23')]='';}Action[_0x3e77('0x24')]['getCaller']=function(){return util[_0x3e77('0x1c')](_0x3e77('0x25'),this[_0x3e77('0x6')],this[_0x3e77('0x4')][_0x3e77('0x26')]>0x0?this[_0x3e77('0x27')][_0x3e77('0x28')](this[_0x3e77('0x4')][_0x3e77('0x26')]):this[_0x3e77('0x27')]);};Action[_0x3e77('0x24')][_0x3e77('0x29')]=function(){return this['queue'];};module[_0x3e77('0x2a')]=Action; \ No newline at end of file +var _0xbc8b=['callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller','dialCutDigit','substring','prototype','getQueue','exports','lodash','isNil','string','voiceQueue','name','Contact','firstName','lastName','number','phone','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback'];(function(_0x486236,_0x325e27){var _0x58d527=function(_0x4ad5f9){while(--_0x4ad5f9){_0x486236['push'](_0x486236['shift']());}};_0x58d527(++_0x325e27);}(_0xbc8b,0x16b));var _0xbbc8=function(_0x134827,_0x21f6ed){_0x134827=_0x134827-0x0;var _0x366671=_0xbc8b[_0x134827];return _0x366671;};'use strict';var util=require('util');var _=require(_0xbbc8('0x0'));var moment=require('moment');function checkNameSurname(_0x12415b,_0x258371,_0x472e52){var _0x1bb600='';if(!_[_0xbbc8('0x1')](_0x258371)&&_0xbbc8('0x2')===typeof _0x258371){_0x1bb600+=_0x258371;}if(!_['isNil'](_0x472e52)&&_0xbbc8('0x2')===typeof _0x472e52){_0x1bb600+='\x20'+_0x472e52;}if(_0x1bb600!==''){return _0x1bb600;}return _0x12415b;}function Action(_0x9ae972,_0x15cdc6,_0x21f15a){this[_0xbbc8('0x3')]=_0x9ae972;this['uniqueid']=_0x21f15a||undefined;this[_0xbbc8('0x4')]=checkNameSurname(_0x15cdc6[_0xbbc8('0x5')]['phone'],_0x15cdc6[_0xbbc8('0x5')][_0xbbc8('0x6')],_0x15cdc6[_0xbbc8('0x5')][_0xbbc8('0x7')]);this[_0xbbc8('0x8')]=_0x15cdc6[_0xbbc8('0x5')][_0xbbc8('0x9')];this[_0xbbc8('0xa')]=_0x9ae972[_0xbbc8('0x4')];this[_0xbbc8('0xb')]=_0x15cdc6[_0xbbc8('0xb')]||![];this[_0xbbc8('0xc')]=_0x9ae972['type'];this[_0xbbc8('0xd')]=_0x9ae972[_0xbbc8('0xd')]||0x3;this[_0xbbc8('0xe')]=_0x15cdc6['scheduledat'];this['countbusyretry']=_0x15cdc6[_0xbbc8('0xf')];this['countcongestionretry']=_0x15cdc6[_0xbbc8('0x10')];this[_0xbbc8('0x11')]=_0x15cdc6[_0xbbc8('0x11')];this[_0xbbc8('0x12')]=_0x15cdc6[_0xbbc8('0x12')];this[_0xbbc8('0x13')]=_0x15cdc6[_0xbbc8('0x13')];this[_0xbbc8('0x14')]=_0x15cdc6[_0xbbc8('0x14')];this[_0xbbc8('0x15')]=_0x15cdc6[_0xbbc8('0x15')];this[_0xbbc8('0x16')]=_0x15cdc6[_0xbbc8('0x16')];this[_0xbbc8('0x17')]=_0x15cdc6['ContactId'];this[_0xbbc8('0x18')]=_0x15cdc6[_0xbbc8('0x18')];this[_0xbbc8('0x19')]=_0x15cdc6[_0xbbc8('0x19')];this['VoiceQueueId']=_0x15cdc6[_0xbbc8('0x1a')];this['CampaignId']=_0x15cdc6[_0xbbc8('0x1b')];this[_0xbbc8('0x1c')]=_0x15cdc6['id'];this['ContactFirstName']=_0x15cdc6[_0xbbc8('0x5')][_0xbbc8('0x6')]||'';this[_0xbbc8('0x1d')]=moment()[_0xbbc8('0x1e')](_0xbbc8('0x1f'));this[_0xbbc8('0x20')]=_0x15cdc6[_0xbbc8('0x20')];this['callbackuniqueid']=_0x15cdc6[_0xbbc8('0x21')];this['callbackat']=_0x15cdc6[_0xbbc8('0x22')];this[_0xbbc8('0x23')]=_0x15cdc6[_0xbbc8('0x23')];this[_0xbbc8('0x24')]='';this[_0xbbc8('0x25')]='';}Action['prototype'][_0xbbc8('0x26')]=function(){return util[_0xbbc8('0x1e')]('\x22%s\x22\x20<%s>',this['name'],this['voiceQueue'][_0xbbc8('0x27')]>0x0?this[_0xbbc8('0x8')][_0xbbc8('0x28')](this[_0xbbc8('0x3')][_0xbbc8('0x27')]):this[_0xbbc8('0x8')]);};Action[_0xbbc8('0x29')][_0xbbc8('0x2a')]=function(){return this['queue'];};module[_0xbbc8('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index ae6e466..bd7a900 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 _0x2ff6=['starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','state','statedesc','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x2ff6,0x96));var _0x62ff=function(_0x1895e2,_0x26731a){_0x1895e2=_0x1895e2-0x0;var _0x29ab2f=_0x2ff6[_0x1895e2];return _0x29ab2f;};'use strict';var util=require(_0x62ff('0x0'));var _=require(_0x62ff('0x1'));var moment=require('moment');function getSeconds(_0x4f9294,_0x3bd72e){var _0x53cef3=moment(_0x4f9294)[_0x62ff('0x2')](0x0);var _0x2e914b=moment(_0x3bd72e)['milliseconds'](0x0);return _0x53cef3[_0x62ff('0x3')](_0x2e914b,_0x62ff('0x4'));}function AgentComplete(_0x42a37f,_0xb46272){this[_0x62ff('0x5')]=0x4;this[_0x62ff('0x6')]='Answer';this[_0x62ff('0x7')]=_0x42a37f[_0x62ff('0x7')];this[_0x62ff('0x8')]=_0x42a37f['type'];this['campaigntype']=_0x42a37f[_0x62ff('0x8')]===_0x62ff('0x9')?_0x62ff('0xa'):_0x42a37f[_0x62ff('0x8')];this[_0x62ff('0xb')]=_0x42a37f[_0x62ff('0xb')];this[_0x62ff('0xc')]=_0x42a37f['countcongestionretry'];this['countnoanswerretry']=_0x42a37f[_0x62ff('0xd')];this['countglobal']=_0x42a37f['countbusyretry']+_0x42a37f[_0x62ff('0xc')]+_0x42a37f[_0x62ff('0xd')]+_0x42a37f[_0x62ff('0xe')]+_0x42a37f[_0x62ff('0xf')]+_0x42a37f[_0x62ff('0x10')]+_0x42a37f[_0x62ff('0x11')]+_0x42a37f[_0x62ff('0x12')];this[_0x62ff('0xe')]=_0x42a37f[_0x62ff('0xe')];this[_0x62ff('0xf')]=_0x42a37f[_0x62ff('0xf')];this['countabandonedretry']=_0x42a37f[_0x62ff('0x10')];this['countmachineretry']=_0x42a37f[_0x62ff('0x11')];this['countagentrejectretry']=_0x42a37f[_0x62ff('0x12')];this[_0x62ff('0x13')]=_0xb46272[_0x62ff('0x13')];this['calleridname']=_0x42a37f[_0x62ff('0x14')];this[_0x62ff('0x15')]=_0x42a37f['number'];this[_0x62ff('0x16')]=_0x42a37f[_0x62ff('0x16')];this[_0x62ff('0x17')]=_0x42a37f[_0x62ff('0x17')];this[_0x62ff('0x18')]=_0x42a37f['answertime'];this[_0x62ff('0x19')]=moment()[_0x62ff('0x1a')](_0x62ff('0x1b'));this[_0x62ff('0x1c')]=getSeconds(_0x42a37f[_0x62ff('0x17')],_0x42a37f[_0x62ff('0x16')]);this[_0x62ff('0x1d')]=getSeconds(_0x42a37f[_0x62ff('0x18')],_0x42a37f[_0x62ff('0x17')]);this['talktime']=getSeconds(this['endtime'],_0x42a37f['answertime']);this['queue']=_0xb46272['queue'];this[_0x62ff('0x1e')]=_0xb46272[_0x62ff('0x1e')];this['reason']=_0xb46272[_0x62ff('0x1f')];this[_0x62ff('0x20')]=_0x42a37f['callback'];this[_0x62ff('0x21')]=_0x42a37f[_0x62ff('0x21')];this[_0x62ff('0x22')]=_0x42a37f['callbackat'];this[_0x62ff('0x23')]=_0x42a37f[_0x62ff('0x23')];this['ContactId']=_0x42a37f['ContactId'];this[_0x62ff('0x24')]=_0x42a37f[_0x62ff('0x24')];this[_0x62ff('0x25')]=_0x42a37f[_0x62ff('0x25')];this[_0x62ff('0x26')]=_0x42a37f[_0x62ff('0x26')];this[_0x62ff('0x27')]=_0x42a37f[_0x62ff('0x27')];this[_0x62ff('0x28')]=_0x42a37f[_0x62ff('0x28')]||'';this['originatecalleridname']=_0x42a37f[_0x62ff('0x29')]||'';}module[_0x62ff('0x2a')]=AgentComplete; \ No newline at end of file +var _0x9863=['UserId','VoiceQueueId','originatecalleridnum','exports','util','lodash','moment','diff','seconds','state','statedesc','Answer','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x1feefe,_0x2018ad){var _0x56471a=function(_0x8745df){while(--_0x8745df){_0x1feefe['push'](_0x1feefe['shift']());}};_0x56471a(++_0x2018ad);}(_0x9863,0xea));var _0x3986=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9863[_0x122ef9];return _0x42fba0;};'use strict';var util=require(_0x3986('0x0'));var _=require(_0x3986('0x1'));var moment=require(_0x3986('0x2'));function getSeconds(_0x39e38b,_0x311b24){var _0x4db342=moment(_0x39e38b)['milliseconds'](0x0);var _0x4472a6=moment(_0x311b24)['milliseconds'](0x0);return _0x4db342[_0x3986('0x3')](_0x4472a6,_0x3986('0x4'));}function AgentComplete(_0x5f5712,_0x2bd6a1){this[_0x3986('0x5')]=0x4;this[_0x3986('0x6')]=_0x3986('0x7');this[_0x3986('0x8')]=_0x5f5712[_0x3986('0x8')];this[_0x3986('0x9')]=_0x5f5712[_0x3986('0x9')];this['campaigntype']=_0x5f5712[_0x3986('0x9')]===_0x3986('0xa')?'queue':_0x5f5712[_0x3986('0x9')];this[_0x3986('0xb')]=_0x5f5712[_0x3986('0xb')];this[_0x3986('0xc')]=_0x5f5712['countcongestionretry'];this[_0x3986('0xd')]=_0x5f5712[_0x3986('0xd')];this[_0x3986('0xe')]=_0x5f5712[_0x3986('0xb')]+_0x5f5712['countcongestionretry']+_0x5f5712[_0x3986('0xd')]+_0x5f5712[_0x3986('0xf')]+_0x5f5712[_0x3986('0x10')]+_0x5f5712[_0x3986('0x11')]+_0x5f5712[_0x3986('0x12')]+_0x5f5712['countagentrejectretry'];this[_0x3986('0xf')]=_0x5f5712[_0x3986('0xf')];this[_0x3986('0x10')]=_0x5f5712['countdropretry'];this['countabandonedretry']=_0x5f5712[_0x3986('0x11')];this[_0x3986('0x12')]=_0x5f5712[_0x3986('0x12')];this[_0x3986('0x13')]=_0x5f5712['countagentrejectretry'];this[_0x3986('0x14')]=_0x2bd6a1[_0x3986('0x14')];this[_0x3986('0x15')]=_0x5f5712[_0x3986('0x16')];this[_0x3986('0x17')]=_0x5f5712[_0x3986('0x18')];this[_0x3986('0x19')]=_0x5f5712[_0x3986('0x19')];this['responsetime']=_0x5f5712[_0x3986('0x1a')];this[_0x3986('0x1b')]=_0x5f5712[_0x3986('0x1b')];this[_0x3986('0x1c')]=moment()['format'](_0x3986('0x1d'));this[_0x3986('0x1e')]=getSeconds(_0x5f5712[_0x3986('0x1a')],_0x5f5712[_0x3986('0x19')]);this[_0x3986('0x1f')]=getSeconds(_0x5f5712[_0x3986('0x1b')],_0x5f5712[_0x3986('0x1a')]);this[_0x3986('0x20')]=getSeconds(this[_0x3986('0x1c')],_0x5f5712['answertime']);this[_0x3986('0x21')]=_0x2bd6a1[_0x3986('0x21')];this[_0x3986('0x22')]=_0x2bd6a1['membername'];this[_0x3986('0x23')]=_0x2bd6a1[_0x3986('0x23')];this[_0x3986('0x24')]=_0x5f5712[_0x3986('0x24')];this['callbackuniqueid']=_0x5f5712[_0x3986('0x25')];this[_0x3986('0x26')]=_0x5f5712[_0x3986('0x26')];this[_0x3986('0x27')]=_0x5f5712[_0x3986('0x27')];this[_0x3986('0x28')]=_0x5f5712[_0x3986('0x28')];this[_0x3986('0x29')]=_0x5f5712['ListId'];this[_0x3986('0x2a')]=_0x5f5712[_0x3986('0x2a')];this[_0x3986('0x2b')]=_0x5f5712[_0x3986('0x2b')];this['CampaignId']=_0x5f5712['CampaignId'];this[_0x3986('0x2c')]=_0x5f5712['originatecalleridnum']||'';this['originatecalleridname']=_0x5f5712['originatecalleridname']||'';}module[_0x3986('0x2d')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index e9e5124..9712ac6 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 _0x08cb=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme'];(function(_0x3e65c7,_0x10f83e){var _0x4085ec=function(_0x18938d){while(--_0x18938d){_0x3e65c7['push'](_0x3e65c7['shift']());}};_0x4085ec(++_0x10f83e);}(_0x08cb,0xf2));var _0xb08c=function(_0x2f3b2b,_0x23bfb8){_0x2f3b2b=_0x2f3b2b-0x0;var _0x59c2b9=_0x08cb[_0x2f3b2b];return _0x59c2b9;};'use strict';var util=require(_0xb08c('0x0'));var _=require('lodash');var moment=require(_0xb08c('0x1'));function getSeconds(_0x14f159,_0x458a63){var _0x46aa15=moment(_0x14f159)[_0xb08c('0x2')](0x0);var _0x181b99=moment(_0x458a63)[_0xb08c('0x2')](0x0);return _0x46aa15['diff'](_0x181b99,_0xb08c('0x3'));}function Final(_0x130f25){this['uniqueid']=_0x130f25[_0xb08c('0x4')];this[_0xb08c('0x5')]=_0x130f25[_0xb08c('0x5')];this[_0xb08c('0x6')]=_0x130f25[_0xb08c('0x6')];this[_0xb08c('0x7')]=_0x130f25[_0xb08c('0x6')]===_0xb08c('0x8')?_0xb08c('0x9'):_0x130f25[_0xb08c('0x6')];this[_0xb08c('0xa')]=_0x130f25[_0xb08c('0xa')];this['countcongestionretry']=_0x130f25[_0xb08c('0xb')];this[_0xb08c('0xc')]=_0x130f25[_0xb08c('0xc')];this[_0xb08c('0xd')]=_0x130f25[_0xb08c('0xa')]+_0x130f25[_0xb08c('0xb')]+_0x130f25[_0xb08c('0xc')]+_0x130f25[_0xb08c('0xe')]+_0x130f25[_0xb08c('0xf')]+_0x130f25[_0xb08c('0x10')]+_0x130f25[_0xb08c('0x11')]+_0x130f25[_0xb08c('0x12')];this['countnosuchnumberretry']=_0x130f25[_0xb08c('0xe')];this[_0xb08c('0xf')]=_0x130f25[_0xb08c('0xf')];this[_0xb08c('0x10')]=_0x130f25[_0xb08c('0x10')];this[_0xb08c('0x11')]=_0x130f25[_0xb08c('0x11')];this[_0xb08c('0x12')]=_0x130f25[_0xb08c('0x12')];this[_0xb08c('0x9')]=_0x130f25[_0xb08c('0x9')];this[_0xb08c('0x13')]=_0x130f25[_0xb08c('0x13')];this[_0xb08c('0x14')]=_0x130f25[_0xb08c('0x14')];this['starttime']=_0x130f25[_0xb08c('0x15')];this[_0xb08c('0x16')]=_0x130f25[_0xb08c('0x16')];this[_0xb08c('0x17')]=_0x130f25['responsetime'];this['ringtime']=_0x130f25[_0xb08c('0x18')]||0x0;this[_0xb08c('0x19')]=_0x130f25[_0xb08c('0x19')]||0x0;this[_0xb08c('0x1a')]=_0x130f25['talktime']||0x0;this['callback']=_0x130f25[_0xb08c('0x1b')];this['callbackuniqueid']=_0x130f25[_0xb08c('0x1c')];this['callbackat']=_0x130f25[_0xb08c('0x1d')];this[_0xb08c('0x1e')]=_0x130f25['recallme'];this[_0xb08c('0x1f')]=_0x130f25['ContactId'];this['ListId']=_0x130f25[_0xb08c('0x20')];this['UserId']=_0x130f25[_0xb08c('0x21')];this['VoiceQueueId']=_0x130f25[_0xb08c('0x22')];this[_0xb08c('0x23')]=_0x130f25['CampaignId'];this[_0xb08c('0x24')]=_0x130f25['originatecalleridnum']||'';this[_0xb08c('0x25')]=_0x130f25[_0xb08c('0x25')]||'';}module[_0xb08c('0x26')]=Final; \ No newline at end of file +var _0x520b=['CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','ContactId','UserId','VoiceQueueId'];(function(_0x5cb893,_0x3cf5dd){var _0x2ee069=function(_0x3a002d){while(--_0x3a002d){_0x5cb893['push'](_0x5cb893['shift']());}};_0x2ee069(++_0x3cf5dd);}(_0x520b,0xb8));var _0xb520=function(_0x4cc492,_0x162c85){_0x4cc492=_0x4cc492-0x0;var _0x1f36b9=_0x520b[_0x4cc492];return _0x1f36b9;};'use strict';var util=require(_0xb520('0x0'));var _=require('lodash');var moment=require(_0xb520('0x1'));function getSeconds(_0x398b47,_0x260a22){var _0x19c952=moment(_0x398b47)['milliseconds'](0x0);var _0x39c630=moment(_0x260a22)['milliseconds'](0x0);return _0x19c952[_0xb520('0x2')](_0x39c630,_0xb520('0x3'));}function Final(_0x55eaa9){this[_0xb520('0x4')]=_0x55eaa9[_0xb520('0x4')];this[_0xb520('0x5')]=_0x55eaa9[_0xb520('0x5')];this[_0xb520('0x6')]=_0x55eaa9['type'];this[_0xb520('0x7')]=_0x55eaa9[_0xb520('0x6')]===_0xb520('0x8')?_0xb520('0x9'):_0x55eaa9[_0xb520('0x6')];this[_0xb520('0xa')]=_0x55eaa9['countbusyretry'];this['countcongestionretry']=_0x55eaa9[_0xb520('0xb')];this[_0xb520('0xc')]=_0x55eaa9[_0xb520('0xc')];this[_0xb520('0xd')]=_0x55eaa9[_0xb520('0xa')]+_0x55eaa9[_0xb520('0xb')]+_0x55eaa9[_0xb520('0xc')]+_0x55eaa9['countnosuchnumberretry']+_0x55eaa9[_0xb520('0xe')]+_0x55eaa9['countabandonedretry']+_0x55eaa9[_0xb520('0xf')]+_0x55eaa9[_0xb520('0x10')];this['countnosuchnumberretry']=_0x55eaa9['countnosuchnumberretry'];this[_0xb520('0xe')]=_0x55eaa9[_0xb520('0xe')];this[_0xb520('0x11')]=_0x55eaa9[_0xb520('0x11')];this[_0xb520('0xf')]=_0x55eaa9[_0xb520('0xf')];this[_0xb520('0x10')]=_0x55eaa9[_0xb520('0x10')];this[_0xb520('0x9')]=_0x55eaa9[_0xb520('0x9')];this['calleridname']=_0x55eaa9[_0xb520('0x12')];this[_0xb520('0x13')]=_0x55eaa9[_0xb520('0x13')];this[_0xb520('0x14')]=_0x55eaa9['starttime'];this[_0xb520('0x15')]=_0x55eaa9['responsetime'];this[_0xb520('0x16')]=_0x55eaa9['responsetime'];this[_0xb520('0x17')]=_0x55eaa9[_0xb520('0x17')]||0x0;this[_0xb520('0x18')]=_0x55eaa9[_0xb520('0x18')]||0x0;this['talktime']=_0x55eaa9[_0xb520('0x19')]||0x0;this[_0xb520('0x1a')]=_0x55eaa9['callback'];this[_0xb520('0x1b')]=_0x55eaa9[_0xb520('0x1b')];this[_0xb520('0x1c')]=_0x55eaa9[_0xb520('0x1c')];this['recallme']=_0x55eaa9['recallme'];this[_0xb520('0x1d')]=_0x55eaa9[_0xb520('0x1d')];this['ListId']=_0x55eaa9['ListId'];this[_0xb520('0x1e')]=_0x55eaa9[_0xb520('0x1e')];this[_0xb520('0x1f')]=_0x55eaa9[_0xb520('0x1f')];this['CampaignId']=_0x55eaa9[_0xb520('0x20')];this[_0xb520('0x21')]=_0x55eaa9['originatecalleridnum']||'';this[_0xb520('0x22')]=_0x55eaa9[_0xb520('0x22')]||'';}module[_0xb520('0x23')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index c8e6694..44f2dde 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 _0x6d6a=['uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','lodash','moment','milliseconds','seconds','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry'];(function(_0x458945,_0x34e95d){var _0x1ae546=function(_0x5dbd47){while(--_0x5dbd47){_0x458945['push'](_0x458945['shift']());}};_0x1ae546(++_0x34e95d);}(_0x6d6a,0x1a4));var _0xa6d6=function(_0x4fa489,_0x4cba6b){_0x4fa489=_0x4fa489-0x0;var _0x41d2ce=_0x6d6a[_0x4fa489];return _0x41d2ce;};'use strict';var util=require('util');var _=require(_0xa6d6('0x0'));var moment=require(_0xa6d6('0x1'));function getSeconds(_0x1af644,_0x2c3b91){var _0xb11cac=moment(_0x1af644)[_0xa6d6('0x2')](0x0);var _0x326630=moment(_0x2c3b91)['milliseconds'](0x0);return _0xb11cac['diff'](_0x326630,_0xa6d6('0x3'));}function Hangup(_0x3f6935,_0x58df16){this['state']=0x4;this[_0xa6d6('0x4')]=_0xa6d6('0x5');this[_0xa6d6('0x6')]=_0x3f6935[_0xa6d6('0x6')];this[_0xa6d6('0x7')]=_0x3f6935[_0xa6d6('0x7')];this[_0xa6d6('0x8')]=_0x3f6935[_0xa6d6('0x7')]===_0xa6d6('0x9')?_0xa6d6('0xa'):_0x3f6935['type'];this[_0xa6d6('0xb')]=_0x3f6935[_0xa6d6('0xb')];this[_0xa6d6('0xc')]=_0x3f6935[_0xa6d6('0xc')];this[_0xa6d6('0xd')]=_0x3f6935[_0xa6d6('0xd')];this[_0xa6d6('0xe')]=_0x3f6935['countbusyretry']+_0x3f6935['countcongestionretry']+_0x3f6935[_0xa6d6('0xd')]+_0x3f6935['countnosuchnumberretry']+_0x3f6935[_0xa6d6('0xf')]+_0x3f6935[_0xa6d6('0x10')]+_0x3f6935[_0xa6d6('0x11')]+_0x3f6935[_0xa6d6('0x12')];this[_0xa6d6('0x13')]=_0x3f6935['countnosuchnumberretry'];this[_0xa6d6('0xf')]=_0x3f6935[_0xa6d6('0xf')];this[_0xa6d6('0x10')]=_0x3f6935[_0xa6d6('0x10')];this[_0xa6d6('0x11')]=_0x3f6935['countmachineretry'];this[_0xa6d6('0x12')]=_0x3f6935[_0xa6d6('0x12')];this[_0xa6d6('0x14')]=_0x58df16[_0xa6d6('0x14')];this[_0xa6d6('0x15')]=_0x3f6935[_0xa6d6('0x16')];this[_0xa6d6('0x17')]=_0x3f6935[_0xa6d6('0x18')];this[_0xa6d6('0x19')]=_0x3f6935[_0xa6d6('0x19')];this[_0xa6d6('0x1a')]=_0x3f6935[_0xa6d6('0x1a')];this[_0xa6d6('0x1b')]=moment()[_0xa6d6('0x1c')](_0xa6d6('0x1d'));this[_0xa6d6('0x1e')]=getSeconds(_0x3f6935[_0xa6d6('0x1a')],_0x3f6935[_0xa6d6('0x19')]);this[_0xa6d6('0x1f')]=0x0;this[_0xa6d6('0x20')]=getSeconds(this[_0xa6d6('0x1b')],_0x3f6935[_0xa6d6('0x1a')]);this[_0xa6d6('0xa')]=_0x3f6935[_0xa6d6('0xa')];this[_0xa6d6('0x21')]=_0xa6d6('0x22');this[_0xa6d6('0x23')]=_0x58df16['cause-txt'];this[_0xa6d6('0x24')]=_0x3f6935['callback'];this['callbackuniqueid']=_0x3f6935[_0xa6d6('0x25')];this[_0xa6d6('0x26')]=_0x3f6935[_0xa6d6('0x26')];this[_0xa6d6('0x27')]=_0x3f6935[_0xa6d6('0x27')];this['ContactId']=_0x3f6935[_0xa6d6('0x28')];this[_0xa6d6('0x29')]=_0x3f6935[_0xa6d6('0x29')];this[_0xa6d6('0x2a')]=_0x3f6935[_0xa6d6('0x2a')];this['VoiceQueueId']=_0x3f6935['VoiceQueueId'];this[_0xa6d6('0x2b')]=_0x3f6935[_0xa6d6('0x2b')];}module['exports']=Hangup; \ No newline at end of file +var _0x27eb=['exports','lodash','moment','diff','seconds','state','statedesc','Answer','scheduledat','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','queue','membername','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x3fafb9,_0x5d6612){var _0xada4d4=function(_0x5e8a40){while(--_0x5e8a40){_0x3fafb9['push'](_0x3fafb9['shift']());}};_0xada4d4(++_0x5d6612);}(_0x27eb,0x12e));var _0xb27e=function(_0xe094f2,_0x45e7ad){_0xe094f2=_0xe094f2-0x0;var _0x4f45d4=_0x27eb[_0xe094f2];return _0x4f45d4;};'use strict';var util=require('util');var _=require(_0xb27e('0x0'));var moment=require(_0xb27e('0x1'));function getSeconds(_0x484c9e,_0x1c873d){var _0x29c372=moment(_0x484c9e)['milliseconds'](0x0);var _0x2d1e83=moment(_0x1c873d)['milliseconds'](0x0);return _0x29c372[_0xb27e('0x2')](_0x2d1e83,_0xb27e('0x3'));}function Hangup(_0xaf4a54,_0x2c2550){this[_0xb27e('0x4')]=0x4;this[_0xb27e('0x5')]=_0xb27e('0x6');this[_0xb27e('0x7')]=_0xaf4a54[_0xb27e('0x7')];this[_0xb27e('0x8')]=_0xaf4a54[_0xb27e('0x8')];this['campaigntype']=_0xaf4a54[_0xb27e('0x8')]==='outbound'?'queue':_0xaf4a54[_0xb27e('0x8')];this[_0xb27e('0x9')]=_0xaf4a54[_0xb27e('0x9')];this[_0xb27e('0xa')]=_0xaf4a54['countcongestionretry'];this[_0xb27e('0xb')]=_0xaf4a54[_0xb27e('0xb')];this[_0xb27e('0xc')]=_0xaf4a54['countbusyretry']+_0xaf4a54['countcongestionretry']+_0xaf4a54[_0xb27e('0xb')]+_0xaf4a54[_0xb27e('0xd')]+_0xaf4a54[_0xb27e('0xe')]+_0xaf4a54[_0xb27e('0xf')]+_0xaf4a54['countmachineretry']+_0xaf4a54[_0xb27e('0x10')];this['countnosuchnumberretry']=_0xaf4a54[_0xb27e('0xd')];this[_0xb27e('0xe')]=_0xaf4a54[_0xb27e('0xe')];this[_0xb27e('0xf')]=_0xaf4a54['countabandonedretry'];this[_0xb27e('0x11')]=_0xaf4a54['countmachineretry'];this[_0xb27e('0x10')]=_0xaf4a54[_0xb27e('0x10')];this[_0xb27e('0x12')]=_0x2c2550[_0xb27e('0x12')];this[_0xb27e('0x13')]=_0xaf4a54[_0xb27e('0x14')];this['calleridnum']=_0xaf4a54[_0xb27e('0x15')];this['starttime']=_0xaf4a54[_0xb27e('0x16')];this[_0xb27e('0x17')]=_0xaf4a54['responsetime'];this[_0xb27e('0x18')]=moment()['format'](_0xb27e('0x19'));this[_0xb27e('0x1a')]=getSeconds(_0xaf4a54[_0xb27e('0x17')],_0xaf4a54[_0xb27e('0x16')]);this[_0xb27e('0x1b')]=0x0;this[_0xb27e('0x1c')]=getSeconds(this[_0xb27e('0x18')],_0xaf4a54[_0xb27e('0x17')]);this[_0xb27e('0x1d')]=_0xaf4a54[_0xb27e('0x1d')];this[_0xb27e('0x1e')]=_0xb27e('0x1f');this['reason']=_0x2c2550[_0xb27e('0x20')];this['callback']=_0xaf4a54[_0xb27e('0x21')];this['callbackuniqueid']=_0xaf4a54[_0xb27e('0x22')];this[_0xb27e('0x23')]=_0xaf4a54['callbackat'];this[_0xb27e('0x24')]=_0xaf4a54[_0xb27e('0x24')];this[_0xb27e('0x25')]=_0xaf4a54[_0xb27e('0x25')];this[_0xb27e('0x26')]=_0xaf4a54[_0xb27e('0x26')];this[_0xb27e('0x27')]=_0xaf4a54[_0xb27e('0x27')];this[_0xb27e('0x28')]=_0xaf4a54[_0xb27e('0x28')];this[_0xb27e('0x29')]=_0xaf4a54[_0xb27e('0x29')];}module[_0xb27e('0x2a')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index ac85f73..afd94b5 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 _0x96c8=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','calleridname','name','number','starttime','responsetime','endtime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme'];(function(_0x5ab5e3,_0x3862ba){var _0x4200e4=function(_0x41eb38){while(--_0x41eb38){_0x5ab5e3['push'](_0x5ab5e3['shift']());}};_0x4200e4(++_0x3862ba);}(_0x96c8,0xa3));var _0x896c=function(_0x2f3808,_0x584dc8){_0x2f3808=_0x2f3808-0x0;var _0x48c811=_0x96c8[_0x2f3808];return _0x48c811;};'use strict';var util=require('util');var _=require(_0x896c('0x0'));var moment=require(_0x896c('0x1'));function getSeconds(_0x53809d,_0x2d7278){var _0x317cea=moment(_0x53809d)['milliseconds'](0x0);var _0x5e3506=moment(_0x2d7278)[_0x896c('0x2')](0x0);return _0x317cea[_0x896c('0x3')](_0x5e3506,_0x896c('0x4'));}function History(_0x28ad5c){this['uniqueid']=_0x28ad5c[_0x896c('0x5')];this[_0x896c('0x6')]=_0x28ad5c[_0x896c('0x6')]||undefined;this[_0x896c('0x7')]=_0x28ad5c[_0x896c('0x7')];this[_0x896c('0x8')]=_0x28ad5c['type']===_0x896c('0x9')?_0x896c('0xa'):_0x28ad5c[_0x896c('0x7')];this[_0x896c('0xb')]=_0x28ad5c[_0x896c('0xb')];this[_0x896c('0xc')]=_0x28ad5c[_0x896c('0xc')];this['countnoanswerretry']=_0x28ad5c[_0x896c('0xd')];this[_0x896c('0xe')]=_0x28ad5c[_0x896c('0xb')]+_0x28ad5c[_0x896c('0xc')]+_0x28ad5c['countnoanswerretry']+_0x28ad5c[_0x896c('0xf')]+_0x28ad5c[_0x896c('0x10')]+_0x28ad5c['countabandonedretry']+_0x28ad5c['countmachineretry']+_0x28ad5c[_0x896c('0x11')];this[_0x896c('0xf')]=_0x28ad5c[_0x896c('0xf')];this['countdropretry']=_0x28ad5c['countdropretry'];this[_0x896c('0x12')]=_0x28ad5c[_0x896c('0x12')];this['countmachineretry']=_0x28ad5c[_0x896c('0x13')];this[_0x896c('0x11')]=_0x28ad5c['countagentrejectretry'];this[_0x896c('0xa')]=_0x28ad5c[_0x896c('0xa')];this[_0x896c('0x14')]=_0x28ad5c[_0x896c('0x15')];this['calleridnum']=_0x28ad5c[_0x896c('0x16')];this[_0x896c('0x17')]=_0x28ad5c[_0x896c('0x17')];this[_0x896c('0x18')]=_0x28ad5c['responsetime'];this[_0x896c('0x19')]=_0x28ad5c[_0x896c('0x18')];this[_0x896c('0x1a')]=getSeconds(_0x28ad5c[_0x896c('0x18')],_0x28ad5c[_0x896c('0x17')]);this[_0x896c('0x1b')]=0x0;this['talktime']=0x0;this['callback']=_0x28ad5c[_0x896c('0x1c')];this[_0x896c('0x1d')]=_0x28ad5c['callbackuniqueid'];this[_0x896c('0x1e')]=_0x28ad5c[_0x896c('0x1e')];this[_0x896c('0x1f')]=_0x28ad5c['recallme'];this[_0x896c('0x20')]=_0x28ad5c[_0x896c('0x20')];this['ListId']=_0x28ad5c[_0x896c('0x21')];this[_0x896c('0x22')]=_0x28ad5c['UserId'];this[_0x896c('0x23')]=_0x28ad5c[_0x896c('0x23')];this[_0x896c('0x24')]=_0x28ad5c[_0x896c('0x24')];this[_0x896c('0x25')]=_0x28ad5c[_0x896c('0x25')]||'';this[_0x896c('0x26')]=_0x28ad5c[_0x896c('0x26')]||'';}module['exports']=History; \ No newline at end of file +var _0x96fa=['exports','util','lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname'];(function(_0x257edf,_0x122776){var _0x4d5cd8=function(_0x212656){while(--_0x212656){_0x257edf['push'](_0x257edf['shift']());}};_0x4d5cd8(++_0x122776);}(_0x96fa,0xc4));var _0xa96f=function(_0x2f4afe,_0x216a7e){_0x2f4afe=_0x2f4afe-0x0;var _0x794690=_0x96fa[_0x2f4afe];return _0x794690;};'use strict';var util=require(_0xa96f('0x0'));var _=require(_0xa96f('0x1'));var moment=require(_0xa96f('0x2'));function getSeconds(_0x467ef0,_0x31b4de){var _0x3cdf4d=moment(_0x467ef0)['milliseconds'](0x0);var _0x3d1f37=moment(_0x31b4de)[_0xa96f('0x3')](0x0);return _0x3cdf4d[_0xa96f('0x4')](_0x3d1f37,'seconds');}function History(_0x44f2ae){this[_0xa96f('0x5')]=_0x44f2ae[_0xa96f('0x5')];this['scheduledat']=_0x44f2ae[_0xa96f('0x6')]||undefined;this[_0xa96f('0x7')]=_0x44f2ae[_0xa96f('0x7')];this[_0xa96f('0x8')]=_0x44f2ae[_0xa96f('0x7')]===_0xa96f('0x9')?_0xa96f('0xa'):_0x44f2ae['type'];this[_0xa96f('0xb')]=_0x44f2ae[_0xa96f('0xb')];this['countcongestionretry']=_0x44f2ae[_0xa96f('0xc')];this['countnoanswerretry']=_0x44f2ae[_0xa96f('0xd')];this[_0xa96f('0xe')]=_0x44f2ae[_0xa96f('0xb')]+_0x44f2ae['countcongestionretry']+_0x44f2ae['countnoanswerretry']+_0x44f2ae[_0xa96f('0xf')]+_0x44f2ae[_0xa96f('0x10')]+_0x44f2ae[_0xa96f('0x11')]+_0x44f2ae[_0xa96f('0x12')]+_0x44f2ae[_0xa96f('0x13')];this[_0xa96f('0xf')]=_0x44f2ae[_0xa96f('0xf')];this[_0xa96f('0x10')]=_0x44f2ae['countdropretry'];this[_0xa96f('0x11')]=_0x44f2ae[_0xa96f('0x11')];this[_0xa96f('0x12')]=_0x44f2ae[_0xa96f('0x12')];this[_0xa96f('0x13')]=_0x44f2ae[_0xa96f('0x13')];this['queue']=_0x44f2ae[_0xa96f('0xa')];this[_0xa96f('0x14')]=_0x44f2ae['name'];this['calleridnum']=_0x44f2ae[_0xa96f('0x15')];this[_0xa96f('0x16')]=_0x44f2ae['starttime'];this[_0xa96f('0x17')]=_0x44f2ae[_0xa96f('0x17')];this[_0xa96f('0x18')]=_0x44f2ae[_0xa96f('0x17')];this[_0xa96f('0x19')]=getSeconds(_0x44f2ae[_0xa96f('0x17')],_0x44f2ae['starttime']);this[_0xa96f('0x1a')]=0x0;this[_0xa96f('0x1b')]=0x0;this['callback']=_0x44f2ae['callback'];this[_0xa96f('0x1c')]=_0x44f2ae[_0xa96f('0x1c')];this['callbackat']=_0x44f2ae[_0xa96f('0x1d')];this[_0xa96f('0x1e')]=_0x44f2ae[_0xa96f('0x1e')];this[_0xa96f('0x1f')]=_0x44f2ae[_0xa96f('0x1f')];this[_0xa96f('0x20')]=_0x44f2ae['ListId'];this['UserId']=_0x44f2ae[_0xa96f('0x21')];this[_0xa96f('0x22')]=_0x44f2ae[_0xa96f('0x22')];this[_0xa96f('0x23')]=_0x44f2ae[_0xa96f('0x23')];this[_0xa96f('0x24')]=_0x44f2ae[_0xa96f('0x24')]||'';this['originatecalleridname']=_0x44f2ae[_0xa96f('0x25')]||'';}module[_0xa96f('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 02f219c..0693e78 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 _0xb658=['getContactDialerIvr','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','saveInDb','merge','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','isSuccess','isTrunkReachable','active','status','reachable','SIP/%s','unmonitored','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','outboundAnswerAgiCallsDay','state','statedesc','membername','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','HANGUP','HangupInAMD','[syncHangupInAMDIvr][createHistory]','countnoanswerretry','countdropretry','stateGlobal','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','cause-txt','agent','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','droptime','responsetime','dialQueueTimeout','dropreason','agiafterat','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','Drop','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','[syncAgentComplete][createHistory][11]','channel','actionid','locked','paused','stateinterface','queueBooked','push','pick','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','run','[Catch][Preview][syncQueueStatusComplete]','finally','[unlock][syncQueueStatusComplete]','rrmemory','_rr','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','Failure','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','command','iftime\x20%s,%s','interval','content','indexOf','true','all','some','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','dialPowerLevel','predictive','booked','Queue','method\x20not\x20recognized','dialActive','checkIsTrunkReachable','dialGlobalInterval','checkIfTimeIntervals','dialTimezone','[syncQueueSummary]','launchHandleIvr','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','object','voiceQueue\x20is\x20undefine','Contact','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueOptions','dialer','ACTIVE','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','%s%s','XMD-','toUpper','callerid','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','dialPrefix','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','reason','NoSuchNumber','log','buildObj','nosuchnumber','custom:status_nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','NO\x20ANSWER\x20evt','NO\x20ANSWER\x20action','NO\x20ANSWER\x20history','noanswer','custom:status_noanswer','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','EMITTING\x20status_busy\x20for','busy','[syncAgentComplete][createHistory][5]','Congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','Global','Success','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','abandonmentRate','agentBusyFactor','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','Agent','voicePause','Contact\x20updated','dialRecallInQueue','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','[getContactDialer2]','tryOriginatePredictive','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','----\x20Agent\x20Busy\x20Factor\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','[busyFactor]','p\x20=\x20','interval\x20=\x20','Umin\x20=\x20','exports','util','bluebird','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','predictiveCalls','syncQueueSummary','../ami','redis','defaults','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','./action','./history','./final','./queueCallerAbandon','./hangup','XCALLY_IP_AGI','127.0.0.1','roundrobin','prototype','tail','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncHangup','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','message','AGENTS_NOT_LOGGED','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','name','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','[ifTime][Action]','Error','stringify','milliseconds','emit','type','outbound','strategy','answered','loggedIn','pTalking','sumHoldTime','talking','total','unmanaged','abandoned','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','Trunk','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','isEmpty','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','info','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','diff','seconds','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','\x22%s\x22\x20<%s>','string','\x22\x22\x20<>','error','inspect','stack','length','hasOwnProperty','originated','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','[getContactDialer2][ReScheduled]','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','waiting','sendMessageOneNotActive','available','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','endtime','starttime','[uniqueid]','clearZombieChannels','enqueue','isNil','Action','catch','No\x20such\x20channel','queue','[Dialer][checkChannel]','updateOriginated','[Dialer][checkChannel][ivr]','countReScheduled','then','[countReScheduled]\x20','resolve','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','averageHandleTime','avgHandleTime','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xb658,0x15a));var _0x8b65=function(_0x14fdc0,_0x3fc782){_0x14fdc0=_0x14fdc0-0x0;var _0x4242b2=_0xb658[_0x14fdc0];return _0x4242b2;};'use strict';var util=require(_0x8b65('0x0'));var _=require('lodash');var BPromise=require(_0x8b65('0x1'));var uuid=require('uuid');var moment=require(_0x8b65('0x2'));var rr=require('rr');var md5=require(_0x8b65('0x3'));var Redis=require(_0x8b65('0x4'));var ut=require(_0x8b65('0x5'));var config=require(_0x8b65('0x6'));var logger=require(_0x8b65('0x7'))('dialer');var loggerBooked=require(_0x8b65('0x7'))('booked');var loggerPredictive=require(_0x8b65('0x7'))('predictive');var loggerPredictiveCalls=require(_0x8b65('0x7'))(_0x8b65('0x8'));var loggerSyncQueueSummary=require(_0x8b65('0x7'))(_0x8b65('0x9'));var ami=require(_0x8b65('0xa'));config[_0x8b65('0xb')]=_[_0x8b65('0xc')](config[_0x8b65('0xb')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var cmHopper=require(_0x8b65('0xd'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x8b65('0xe'));var cmHopperBlack=require(_0x8b65('0xf'));var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require(_0x8b65('0x10'));var History=require(_0x8b65('0x11'));var Final=require(_0x8b65('0x12'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0x8b65('0x13'));var Hangup=require(_0x8b65('0x14'));var ipAgi=process['env'][_0x8b65('0x15')]||_0x8b65('0x16');var strategy={'rrmemory':'rrmemory','roundrobin':_0x8b65('0x17')};var Sequence=function(){};Sequence[_0x8b65('0x18')]['enqueue']=function(_0x4aabc1){this[_0x8b65('0x19')]=this[_0x8b65('0x19')]?this['tail']['finally'](_0x4aabc1):_0x4aabc1();};function Dialer(_0x449f01,_0x5a6275){this[_0x8b65('0x1a')]=new Sequence();this[_0x8b65('0x1b')]=_0x5a6275;this[_0x8b65('0x1c')]=_0x449f01[_0x8b65('0x1c')];this[_0x8b65('0x1d')]=_0x449f01['campaigns'];this[_0x8b65('0x1e')]=_0x449f01['agents'];this[_0x8b65('0x1f')]=_0x449f01[_0x8b65('0x1f')];this[_0x8b65('0x20')]=config['maxNumberOriginate']||0x2;this[_0x8b65('0x21')]={};this[_0x8b65('0x22')]={};this[_0x8b65('0x23')]={};this[_0x8b65('0x24')]={};this[_0x8b65('0x25')]={};this[_0x8b65('0x26')]={};this[_0x8b65('0x27')]={};this['ivrOriginated']={};this['queueBooked']={};this[_0x8b65('0x28')]={};ami['on'](_0x8b65('0x29'),this[_0x8b65('0x2a')][_0x8b65('0x2b')](this));ami['on'](_0x8b65('0x2c'),this[_0x8b65('0x2d')]['bind'](this));ami['on'](_0x8b65('0x2e'),this[_0x8b65('0x2f')][_0x8b65('0x2b')](this));ami['on'](_0x8b65('0x30'),this[_0x8b65('0x31')]['bind'](this));ami['on'](_0x8b65('0x32'),this[_0x8b65('0x9')][_0x8b65('0x2b')](this));ami['on']('hangup',this[_0x8b65('0x33')]['bind'](this));ami['on']('newexten',this[_0x8b65('0x34')][_0x8b65('0x2b')](this));ami['on'](_0x8b65('0x35'),this[_0x8b65('0x36')][_0x8b65('0x2b')](this));ami['on'](_0x8b65('0x37'),this[_0x8b65('0x38')][_0x8b65('0x2b')](this));ami['on']('queuestatuscomplete',this[_0x8b65('0x39')][_0x8b65('0x2b')](this));this[_0x8b65('0x3a')]();this[_0x8b65('0x3b')]();}function isNotNull(_0x1a1255){return _0x1a1255!==null&&!_['isUndefined'](_0x1a1255);}function checkIsLoggedIn(_0x234232,_0x1fe749){return function(){if(_0x1fe749<=0x0){_0x234232[_0x8b65('0x3c')]=_0x8b65('0x3d');throw _0x234232['name']+_0x8b65('0x3e');}};}function isActive(_0x148728){return _0x148728;}function checkIsActive(_0x118203,_0x11a02f){return function(){if(!isActive(_0x11a02f)){_0x118203[_0x8b65('0x3c')]=_0x8b65('0x3f');throw _0x118203[_0x8b65('0x40')]+'\x20NOT\x20Active';}};}function checkInterval(_0x12228a){return function(){if(!isNotNull(_0x12228a[_0x8b65('0x41')])){_0x12228a['message']=_0x8b65('0x42');throw _0x12228a[_0x8b65('0x40')]+_0x8b65('0x43');}if(!isNotNull(_0x12228a[_0x8b65('0x41')][_0x8b65('0x44')])){_0x12228a[_0x8b65('0x3c')]=_0x8b65('0x42');throw _0x12228a[_0x8b65('0x40')]+_0x8b65('0x43');}if(!isNotNull(_['isEmpty'](_0x12228a[_0x8b65('0x41')][_0x8b65('0x44')]))){_0x12228a[_0x8b65('0x3c')]=_0x8b65('0x42');throw _0x12228a['name']+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x490cc1,_0x31df27,_0x3e4be6){return{'action':_0x490cc1,'response':_0x31df27,'message':_0x3e4be6,'stack':_0x3e4be6};}function myreject(_0x334213){return function(_0x2d7719){return _0x334213(msgResponse(_0x8b65('0x45'),_0x8b65('0x46'),JSON[_0x8b65('0x47')](_0x2d7719)));};}function getSeconds(_0x549656,_0x12fd65){var _0x530615=moment(_0x549656)['milliseconds'](0x0);var _0x2c6158=moment(_0x12fd65)[_0x8b65('0x48')](0x0);return _0x530615['diff'](_0x2c6158,'seconds');}function emit(_0x3e300f,_0x260228,_0x5ba2d2){io['to'](_0x3e300f)[_0x8b65('0x49')](_0x260228,_0x5ba2d2);}function emitVoiceQueueSummary(_0x372e4d){if(_0x372e4d[_0x8b65('0x4a')]===_0x8b65('0x4b')){var _0x36fe11={'id':_0x372e4d['id'],'name':_0x372e4d[_0x8b65('0x40')],'strategy':_0x372e4d[_0x8b65('0x4c')],'answered':_0x372e4d[_0x8b65('0x4d')],'available':_0x372e4d['available'],'loggedIn':_0x372e4d[_0x8b65('0x4e')],'pTalking':_0x372e4d[_0x8b65('0x4f')],'sumBillable':_0x372e4d['sumBillable'],'sumDuration':_0x372e4d['sumDuration'],'sumHoldTime':_0x372e4d[_0x8b65('0x50')]||0x0,'talking':_0x372e4d[_0x8b65('0x51')],'total':_0x372e4d[_0x8b65('0x52')],'type':_0x372e4d[_0x8b65('0x4a')],'unmanaged':_0x372e4d[_0x8b65('0x53')],'abandoned':_0x372e4d[_0x8b65('0x54')],'waiting':_0x372e4d['waiting'],'loggedInDb':_0x372e4d[_0x8b65('0x55')],'dialActive':_0x372e4d['dialActive'],'dialMethod':_0x372e4d[_0x8b65('0x56')],'dialOriginateCallerIdName':_0x372e4d[_0x8b65('0x57')],'dialOriginateCallerIdNumber':_0x372e4d[_0x8b65('0x58')],'dialOriginateTimeout':_0x372e4d[_0x8b65('0x59')],'dialPrefix':_0x372e4d['dialPrefix'],'outboundAnswerAgiCallsDay':_0x372e4d['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x372e4d[_0x8b65('0x5a')],'outboundBlacklistCallsDay':_0x372e4d[_0x8b65('0x5b')],'outboundBusyCallsDay':_0x372e4d['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x372e4d[_0x8b65('0x5c')],'outboundDropCallsDayACS':_0x372e4d[_0x8b65('0x5d')],'outboundDropCallsDayCallersExit':_0x372e4d[_0x8b65('0x5e')],'outboundDropCallsDayTimeout':_0x372e4d[_0x8b65('0x5f')],'outboundNoAnswerCallsDay':_0x372e4d[_0x8b65('0x60')],'outboundNoSuchCallsDay':_0x372e4d[_0x8b65('0x61')],'outboundOriginateFailureCallsDay':_0x372e4d[_0x8b65('0x62')],'outboundReCallsDay':_0x372e4d[_0x8b65('0x63')],'outboundRejectCallsDay':_0x372e4d['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x372e4d['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x372e4d[_0x8b65('0x64')],'predictiveIntervalAvgHoldtime':_0x372e4d[_0x8b65('0x65')],'predictiveIntervalAvgTalktime':_0x372e4d[_0x8b65('0x66')],'predictiveIntervalDroppedCallsCallersExit':_0x372e4d['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x372e4d[_0x8b65('0x67')],'predictiveIntervalErlangCalls':_0x372e4d['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x372e4d[_0x8b65('0x68')],'predictiveIntervalHitRate':_0x372e4d[_0x8b65('0x69')],'predictiveIntervalMultiplicativeFactor':_0x372e4d['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x372e4d[_0x8b65('0x6a')],'predictiveIntervalAvailable':_0x372e4d[_0x8b65('0x6b')],'predictiveIntervalTotalCalls':_0x372e4d[_0x8b65('0x6c')],'message':_0x372e4d[_0x8b65('0x3c')],'originated':_0x372e4d['originated'],'erlangCalls':_0x372e4d[_0x8b65('0x6d')],'erlangCallToSecond':_0x372e4d['erlangCallToSecond'],'erlangAbandonmentRate':_0x372e4d[_0x8b65('0x6e')],'erlangBusyFactor':_0x372e4d[_0x8b65('0x6f')],'startPredictive':_0x372e4d[_0x8b65('0x26')],'startProgressive':_0x372e4d[_0x8b65('0x27')]};if(_0x372e4d[_0x8b65('0x70')]){_0x36fe11[_0x8b65('0x70')]={'id':_0x372e4d['Trunk']['id'],'name':_0x372e4d[_0x8b65('0x70')]['name'],'active':_0x372e4d[_0x8b65('0x70')]['active'],'callerid':_0x372e4d[_0x8b65('0x70')]['callerid']};}if(_0x372e4d['Interval']){_0x36fe11['Interval']={'id':_0x372e4d[_0x8b65('0x41')]['id'],'name':_0x372e4d[_0x8b65('0x41')][_0x8b65('0x40')]};}var _0xbdfb5a=md5(JSON[_0x8b65('0x47')](_0x36fe11));if(_0x372e4d[_0x8b65('0x3')]!==_0xbdfb5a){_0x372e4d[_0x8b65('0x3')]=_0xbdfb5a;emit(util[_0x8b65('0x71')](_0x8b65('0x72'),_0x36fe11[_0x8b65('0x40')]),_0x8b65('0x73'),_0x36fe11);}}}function emitCampaignSummary(_0x19797f){if(_0x19797f['type']===_0x8b65('0x74')){emit(util['format'](_0x8b65('0x75'),_0x19797f[_0x8b65('0x40')]),'campaign:save',_0x19797f);}}function checkGetDataPredictive(_0x57cdf9){if(isNotNull(_0x57cdf9)){if(!_[_0x8b65('0x76')](_0x57cdf9)){loggerPredictive['info'](_0x8b65('0x77'));loggerPredictive['info'](_0x8b65('0x78'),_0x57cdf9[_0x8b65('0x6c')]);loggerPredictive['info'](_0x8b65('0x79'),_0x57cdf9[_0x8b65('0x64')]);loggerPredictive[_0x8b65('0x7a')](_0x8b65('0x7b'),_0x57cdf9[_0x8b65('0x67')]);loggerPredictive['info']('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x57cdf9[_0x8b65('0x7c')]);loggerPredictive[_0x8b65('0x7a')](_0x8b65('0x7d'),_0x57cdf9[_0x8b65('0x65')]);loggerPredictive[_0x8b65('0x7a')](_0x8b65('0x7e'),_0x57cdf9['predictiveIntervalAvgTalktime']);loggerPredictive['info'](_0x8b65('0x7f'));if(_0x57cdf9[_0x8b65('0x6c')]>0x0){if(!_[_0x8b65('0x80')](_0x57cdf9['predictiveIntervalAvgTalktime'])&&_0x57cdf9['predictiveIntervalAvgTalktime']>0x0){return!![];}else{loggerPredictive[_0x8b65('0x7a')](_0x8b65('0x81'));}if(!_[_0x8b65('0x80')](_0x57cdf9[_0x8b65('0x65')])&&_0x57cdf9[_0x8b65('0x65')]>0x0){return!![];}else{loggerPredictive[_0x8b65('0x7a')](_0x8b65('0x82'));}}else{loggerPredictive[_0x8b65('0x7a')](_0x8b65('0x83'));}}else{loggerPredictive['info']('History\x20information\x20are\x20empty');}}else{loggerPredictive[_0x8b65('0x7a')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x187e2f){return function(_0x34833c){loggerPredictive[_0x8b65('0x7a')](_0x8b65('0x84'));loggerPredictive['info']('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x34833c[_0x8b65('0x6d')]);loggerPredictive[_0x8b65('0x7a')](_0x8b65('0x85'),_0x34833c['erlangCallToSecond']);loggerPredictive[_0x8b65('0x7a')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x34833c[_0x8b65('0x6e')]);loggerPredictive[_0x8b65('0x7a')](_0x8b65('0x86'),_0x34833c[_0x8b65('0x6f')]);loggerPredictive[_0x8b65('0x7a')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x34833c[_0x8b65('0x6e')]);loggerPredictive['info'](_0x8b65('0x7f'));_['merge'](_0x187e2f,_0x34833c);};}function getDiff(_0x422512){var _0xa5fc96=moment()['milliseconds'](0x0);var _0x371bc6=moment(_0x422512)['milliseconds'](0x0);return _0xa5fc96[_0x8b65('0x87')](_0x371bc6,_0x8b65('0x88'));}function ifInterval(_0xf66b24,_0x4761ed){if(_[_0x8b65('0x80')](_0x4761ed)){return![];}if(getDiff(_0x4761ed)<_0xf66b24*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x6597ea){if(isNotNull(_0x6597ea)){if(!_[_0x8b65('0x80')](_0x6597ea[_0x8b65('0x27')])){_0x6597ea[_0x8b65('0x27')]=undefined;loggerPredictive[_0x8b65('0x7a')](_0x6597ea[_0x8b65('0x40')],_0x8b65('0x89'));}if(!_['isUndefined'](_0x6597ea[_0x8b65('0x26')])){_0x6597ea['startPredictive']=undefined;loggerPredictive[_0x8b65('0x7a')](_0x6597ea[_0x8b65('0x40')],_0x8b65('0x8a'));}if(!_[_0x8b65('0x80')](_0x6597ea[_0x8b65('0x8b')])){clearInterval(_0x6597ea[_0x8b65('0x8b')]);_0x6597ea[_0x8b65('0x8b')]=undefined;loggerPredictive[_0x8b65('0x7a')](_0x6597ea[_0x8b65('0x40')],_0x8b65('0x8c'));}}}function erlangb(_0x40f04c,_0x1b71b4){if(_0x1b71b4===0x0){return 0x0;}var _0x66505a=0x1;for(var _0x43f08c=0x1;_0x43f08c<=_0x1b71b4;_0x43f08c+=0x1){_0x66505a=0x1+_0x66505a*_0x43f08c/_0x40f04c;}return 0x1/_0x66505a;}function isVoiceQueueOutbound(_0x240146){return _0x240146==='outbound';}function isNotPreview(_0x3c91a3){return _0x3c91a3!==_0x8b65('0x1b');}function isCampaignIvr(_0x316db9){return _0x316db9===_0x8b65('0x74');}function getCallerId(_0x54e78c,_0xaf73a,_0x1077a6){if(!_['isUndefined'](_0x1077a6)&&'string'===typeof _0x1077a6&&!_[_0x8b65('0x76')](_0x1077a6)){if(!_[_0x8b65('0x80')](_0xaf73a)&&'string'===typeof _0xaf73a&&!_[_0x8b65('0x76')](_0xaf73a)){return util[_0x8b65('0x71')](_0x8b65('0x8d'),_0xaf73a,_0x1077a6);}return util['format'](_0x8b65('0x8d'),_0x1077a6,_0x1077a6);}if(!_[_0x8b65('0x80')](_0x54e78c)&&_0x8b65('0x8e')===typeof _0x54e78c&&!_['isEmpty'](_0x54e78c)){return _0x54e78c;}return _0x8b65('0x8f');}function loggerCatchQueueSummary(_0x1da343,_0x6e9b6e){return function(_0x3e15f8){freeVariablesPredictive(_0x6e9b6e);emitVoiceQueueSummary(_0x6e9b6e);emitCampaignSummary(_0x6e9b6e);loggerSyncQueueSummary[_0x8b65('0x90')](_0x1da343,util[_0x8b65('0x91')](_0x3e15f8,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x48e347,_0x3c0c6d){return function(_0x409aa9){loggerPredictive[_0x8b65('0x90')](_0x3c0c6d[_0x8b65('0x40')],_0x48e347);loggerPredictive['error'](_0x409aa9[_0x8b65('0x92')]);freeVariablesPredictive(_0x3c0c6d);};}function loggerCatch(_0x507cb3){return function(_0x392cab){logger[_0x8b65('0x90')](_0x507cb3,util[_0x8b65('0x91')](_0x392cab,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x5cc366){return _0x5cc366&&!_[_0x8b65('0x80')](_0x5cc366)&&_0x5cc366[_0x8b65('0x93')]>0x0;}function decremetOriginate(_0x1d9032){if(!_[_0x8b65('0x80')](_0x1d9032)&&_0x1d9032!==null){if(_0x1d9032[_0x8b65('0x94')](_0x8b65('0x95'))){if(_0x1d9032[_0x8b65('0x95')]>0x0){_0x1d9032[_0x8b65('0x95')]-=0x1;}else{logger[_0x8b65('0x90')](_0x8b65('0x96'));}}}else{logger['error'](_0x8b65('0x97'));}}function checkContactLowerLimitOriginate(_0x5e00ad,_0x24ad05,_0x5d9e0b){if(_0x24ad05>_0x5d9e0b){for(var _0x2fd9c8=0x0;_0x2fd9c8<_0x24ad05-_0x5d9e0b;_0x2fd9c8+=0x1){decremetOriginate(_0x5e00ad);}}}function loggerGetContactDialer(_0x11f337,_0x270b2b,_0x4f9b82){return function(_0x3f1562){checkContactLowerLimitOriginate(_0x270b2b,_0x4f9b82,0x0);logger[_0x8b65('0x90')](_0x11f337,util[_0x8b65('0x91')](_0x3f1562,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x217148){return function(_0x15c488){if(isNotNull(_0x15c488)&&isNotNull(_0x15c488[0x0])){if(_0x15c488[0x0][_0x8b65('0x98')]>0x0){_0x217148['message']='RESCHEDULED_CONTACTS';logger[_0x8b65('0x7a')](_0x8b65('0x99')+_0x217148[_0x8b65('0x40')],_0x15c488[0x0][_0x8b65('0x98')],'contacts');}else{_0x217148[_0x8b65('0x3c')]=_0x8b65('0x9a');logger['info'](_0x8b65('0x9b')+_0x217148[_0x8b65('0x40')]);}}};}function notSendMessagesQueue(_0x590634){if(_0x590634['sendMessageOneNotActive']){freeVariablesPredictive(_0x590634);if(_0x590634[_0x8b65('0x95')]===0x0&&_0x590634[_0x8b65('0x51')]===0x0&&_0x590634[_0x8b65('0x9c')]===0x0&&(_0x590634[_0x8b65('0x4f')]||0x0)===0x0){_0x590634[_0x8b65('0x9d')]=![];_0x590634[_0x8b65('0x9e')]=0x0;_0x590634['message']=_0x8b65('0x3f');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x590634[_0x8b65('0x40')],_0x8b65('0x9f'));}else{_0x590634['message']=_0x8b65('0xa0');loggerSyncQueueSummary[_0x8b65('0x90')](_0x8b65('0xa1'),_0x590634[_0x8b65('0x40')],_0x8b65('0xa2'));}emitVoiceQueueSummary(_0x590634);}}function notSendMessagesCampaign(_0xbff27d){if(_0xbff27d[_0x8b65('0x9d')]){if(_0xbff27d['originated']===0x0){_0xbff27d[_0x8b65('0x9d')]=![];_0xbff27d['message']=_0x8b65('0x3f');loggerSyncQueueSummary[_0x8b65('0x90')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0xbff27d[_0x8b65('0x40')],'is\x20not\x20active');}else{_0xbff27d[_0x8b65('0x3c')]=_0x8b65('0xa0');loggerSyncQueueSummary[_0x8b65('0x90')](_0x8b65('0xa3'),_0xbff27d[_0x8b65('0x40')],_0x8b65('0xa2'));}emitCampaignSummary(_0xbff27d);}}function createObjHistory(_0xb838b9,_0x4c6845,_0x2f0e51,_0x467c90,_0x389b56){_0xb838b9['message']=_0x2f0e51;var _0x575e59=new Action(_0xb838b9,_0x4c6845);var _0x3d0ea2=new History(_0x575e59);_0x3d0ea2['state']=_0x467c90;_0x3d0ea2['statedesc']=_0x389b56;_0x3d0ea2[_0x8b65('0xa4')]=_0x575e59[_0x8b65('0xa5')];return _0x3d0ea2;}Dialer[_0x8b65('0x18')][_0x8b65('0x3b')]=function(){var _0x242dfb=this;setInterval(function(){_0x242dfb['clearZombieChannels'](_0x242dfb[_0x8b65('0x24')],_0x8b65('0xa6'));_0x242dfb[_0x8b65('0xa7')](_0x242dfb[_0x8b65('0x22')],'[actions]');},0x32c8);};Dialer['prototype'][_0x8b65('0xa7')]=function(_0x29b24c,_0x32e8c5){var _0x23a301=this;for(var _0x301983 in _0x29b24c){if(_0x29b24c['hasOwnProperty'](_0x301983)){this[_0x8b65('0x1a')][_0x8b65('0xa8')](function(){if(!_[_0x8b65('0xa9')](_0x29b24c[_0x301983])){return ami[_0x8b65('0xaa')]({'action':'status','channel':_0x29b24c[_0x301983]['channel']})[_0x8b65('0xab')](function(_0x465d8b){if(_0x465d8b[_0x8b65('0x3c')]===_0x8b65('0xac')){setTimeout(function(){if(_0x29b24c[_0x301983]&&_0x29b24c[_0x301983]['type']!==_0x8b65('0x74')){_0x23a301['updateOriginated'](_0x23a301[_0x8b65('0x1c')][_0x29b24c[_0x301983][_0x8b65('0xad')]]);logger[_0x8b65('0x90')](_0x8b65('0xae'),_0x32e8c5,_0x301983,_0x29b24c[_0x301983][_0x8b65('0xad')]);delete _0x29b24c[_0x301983];}if(_0x29b24c[_0x301983]&&_0x29b24c[_0x301983][_0x8b65('0x4a')]===_0x8b65('0x74')){_0x23a301[_0x8b65('0xaf')](_0x23a301[_0x8b65('0x1d')][_0x29b24c[_0x301983][_0x8b65('0xad')]]);logger[_0x8b65('0x90')](_0x8b65('0xb0'),_0x32e8c5,_0x301983,_0x29b24c[_0x301983][_0x8b65('0xad')]);delete _0x29b24c[_0x301983];}},0x2328);}});}});}}};Dialer[_0x8b65('0x18')][_0x8b65('0xb1')]=function(_0x4c41f7){return BPromise['resolve']()[_0x8b65('0xb2')](cmHopper[_0x8b65('0xb1')](_0x4c41f7))[_0x8b65('0xab')](loggerCatch(_0x8b65('0xb3')));};Dialer[_0x8b65('0x18')]['checkIsBlackList']=function(_0x157cce){return BPromise[_0x8b65('0xb4')]()[_0x8b65('0xb2')](cmHopperBlack[_0x8b65('0xb5')](_0x157cce))[_0x8b65('0xab')](loggerCatch(_0x8b65('0xb6')));};Dialer[_0x8b65('0x18')][_0x8b65('0xb7')]=function(_0x4fc669){return BPromise[_0x8b65('0xb4')]()[_0x8b65('0xb2')](cmHopperBlack['checkIsBlackListIvr'](_0x4fc669))[_0x8b65('0xab')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer['prototype'][_0x8b65('0xb8')]=function(_0x59620d){return BPromise[_0x8b65('0xb4')]()[_0x8b65('0xb2')](cmHopperHistory[_0x8b65('0xb9')](_0x59620d))[_0x8b65('0xab')](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0x8b65('0x18')]['rescheduleContact']=function(_0x2a9f26){return BPromise[_0x8b65('0xb4')]()[_0x8b65('0xb2')](cmHopper[_0x8b65('0xba')](_0x2a9f26))[_0x8b65('0xab')](loggerCatch(_0x8b65('0xbb')));};Dialer[_0x8b65('0x18')]['unlockContact']=function(_0x46ab14,_0x55a97b,_0xf10cc1){return BPromise[_0x8b65('0xb4')]()['then'](cmHopper[_0x8b65('0xbc')](_0x46ab14,_0x55a97b,_0xf10cc1))['catch'](loggerCatch(_0x8b65('0xbd')));};Dialer[_0x8b65('0x18')][_0x8b65('0xbe')]=function(_0x2f14c6,_0x3e3b65,_0x44c881,_0x1dbcb4){return BPromise[_0x8b65('0xb4')]()[_0x8b65('0xb2')](cmHopper[_0x8b65('0xbe')](_0x2f14c6,_0x3e3b65,_0x44c881,_0x1dbcb4))[_0x8b65('0xab')](loggerCatch(_0x8b65('0xbf')));};Dialer[_0x8b65('0x18')]['getContactDialerIvr']=function(_0x44ccb8,_0x3889dc,_0x4faf4e){return BPromise[_0x8b65('0xb4')]()[_0x8b65('0xb2')](cmHopper[_0x8b65('0xc0')](_0x44ccb8,_0x3889dc,_0x4faf4e))[_0x8b65('0xab')](loggerCatch(_0x8b65('0xbf')));};Dialer[_0x8b65('0x18')][_0x8b65('0xc1')]=function(_0x38aee9){return BPromise[_0x8b65('0xb4')]()[_0x8b65('0xb2')](voiceQueueRt['getVoiceQueueRtPauses'](_0x38aee9))[_0x8b65('0xab')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x8b65('0x18')][_0x8b65('0xc2')]=function(_0x75986f){return BPromise[_0x8b65('0xb4')]()[_0x8b65('0xb2')](cmHopper[_0x8b65('0xc2')](_0x75986f))[_0x8b65('0xab')](loggerCatch(_0x8b65('0xc3')));};Dialer[_0x8b65('0x18')][_0x8b65('0xc4')]=function(_0x30341b){return BPromise[_0x8b65('0xb4')]()[_0x8b65('0xb2')](cmHopperHistory[_0x8b65('0xc4')](_0x30341b))[_0x8b65('0xab')](loggerCatch(_0x8b65('0xc5')));};Dialer[_0x8b65('0x18')][_0x8b65('0xaf')]=function(_0x45b066){if(!_['isUndefined'](_0x45b066)&&_0x45b066!==null){if(_0x45b066['hasOwnProperty'](_0x8b65('0x95'))){if(_0x45b066['originated']>0x0){_0x45b066[_0x8b65('0x95')]-=0x1;}else{logger['error'](_0x8b65('0xc6'));}}}else{logger[_0x8b65('0x90')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x8b65('0x18')][_0x8b65('0xc7')]=function(_0x4856cf,_0xa3fb93){var _0x10469d=this;return function(_0x292964){_0x10469d[_0x8b65('0xaf')](_0xa3fb93);logger[_0x8b65('0x90')](_0x4856cf,util['inspect'](_0x292964,{'showHidden':![],'depth':null}));};};Dialer[_0x8b65('0x18')][_0x8b65('0xc8')]=function(_0xb9999,_0x449e62,_0x4ee75a){var _0xbda5c4={'state':0x19,'statedesc':'notFound'};this[_0x8b65('0xaf')](_0x449e62);this[_0x8b65('0xc9')](_[_0x8b65('0xca')](_0xbda5c4,_['pick'](_0x4ee75a,[_0x8b65('0xcb'),_0x8b65('0xcc'),_0x8b65('0xcd'),_0x8b65('0xce'),_0x8b65('0xcf')])),_0x8b65('0xd0'),'[emptyContact]');logger[_0x8b65('0x90')](_0xb9999);};Dialer[_0x8b65('0x18')][_0x8b65('0xd1')]=function(_0x2819fa){return _0x2819fa==='Success';};Dialer[_0x8b65('0x18')][_0x8b65('0xd2')]=function(_0x4320b1){return!_[_0x8b65('0x80')](_0x4320b1)&&_0x4320b1&&!_['isUndefined'](_0x4320b1['name'])&&!_['isUndefined'](_0x4320b1['active'])&&_0x4320b1[_0x8b65('0xd3')]&&(this[_0x8b65('0x1f')][util[_0x8b65('0x71')]('SIP/%s',_0x4320b1[_0x8b65('0x40')])][_0x8b65('0xd4')]===_0x8b65('0xd5')||this['trunks'][util[_0x8b65('0x71')](_0x8b65('0xd6'),_0x4320b1['name'])]['status']===_0x8b65('0xd7'));};Dialer[_0x8b65('0x18')][_0x8b65('0xc9')]=function(_0x2ae80d,_0x2f1652,_0x535094){this[_0x8b65('0xc4')](_0x2ae80d)['catch'](loggerCatch(_0x2f1652));this[_0x8b65('0xc2')](_0x2ae80d)[_0x8b65('0xab')](loggerCatch(_0x535094));};Dialer[_0x8b65('0x18')]['syncVarSet']=function(_0x3a8a86){var _0xbd1c0=this[_0x8b65('0x24')][_0x3a8a86[_0x8b65('0xd8')]];var _0x2b8f7a;if(!_[_0x8b65('0xa9')](_0x3a8a86)&&!_['isNil'](_0x3a8a86[_0x8b65('0xd9')])&&!_[_0x8b65('0xa9')](_0x3a8a86[_0x8b65('0xd9')][_0x8b65('0xda')])&&_0x3a8a86[_0x8b65('0xdb')]===_0x8b65('0xdc')&&_0xbd1c0){if(_0xbd1c0['type']!==_0x8b65('0x74')&&this['voiceQueues'][_0xbd1c0[_0x8b65('0xad')]][_0x8b65('0xdd')]&&_0x3a8a86[_0x8b65('0xde')]==='HANGUP'){delete this[_0x8b65('0x24')][_0x3a8a86['uniqueid']];this[_0x8b65('0xaf')](this[_0x8b65('0x1c')][_0xbd1c0[_0x8b65('0xad')]]);this[_0x8b65('0x1c')][_0xbd1c0[_0x8b65('0xad')]][_0x8b65('0x5a')]+=0x1;this[_0x8b65('0x1c')][_0xbd1c0['queue']][_0x8b65('0xdf')]+=0x1;_0x2b8f7a=new Hangup(_0xbd1c0,_0x3a8a86);_0x2b8f7a[_0x8b65('0xe0')]=0x12;_0x2b8f7a[_0x8b65('0xe1')]='HangupInAMD';_0x2b8f7a[_0x8b65('0xe2')]=_0x8b65('0xe3');this[_0x8b65('0xc9')](_0x2b8f7a,_0x8b65('0xe4'),_0x8b65('0xe5'));}if(_0xbd1c0[_0x8b65('0x4a')]!==_0x8b65('0x74')&&this[_0x8b65('0x1c')][_0xbd1c0[_0x8b65('0xad')]]['dialAMDActive']&&_0x3a8a86[_0x8b65('0xde')]===_0x8b65('0xe6')){var _0x25297f=this;return new BPromise(function(_0x3b6790,_0x21522f){delete _0x25297f[_0x8b65('0x24')][_0x3a8a86[_0x8b65('0xd8')]];_0x25297f[_0x8b65('0xaf')](_0x25297f[_0x8b65('0x1c')][_0xbd1c0['queue']]);_0x25297f[_0x8b65('0x1c')][_0xbd1c0[_0x8b65('0xad')]]['outboundAnswerCallsDay']+=0x1;_0x25297f[_0x8b65('0x1c')][_0xbd1c0['queue']][_0x8b65('0xdf')]+=0x1;var _0x127908=_0x25297f['voiceQueues'][_0xbd1c0[_0x8b65('0xad')]];var _0x5f555b=new Hangup(_0xbd1c0,_0x3a8a86);_0x5f555b[_0x8b65('0xe0')]=0x13;_0x5f555b[_0x8b65('0xe1')]=_0x8b65('0xe7');_0x5f555b[_0x8b65('0xe2')]=_0x8b65('0xe3');_0x5f555b[_0x8b65('0xe8')]+=0x1;_0x5f555b[_0x8b65('0xe9')]+=0x1;_0x5f555b[_0x8b65('0xea')]=!![];_0x25297f[_0x8b65('0xc4')](_0x5f555b)[_0x8b65('0xab')](loggerCatch(_0x8b65('0xeb')));if(_0x5f555b[_0x8b65('0xec')]+_0x5f555b[_0x8b65('0xed')]+_0x5f555b['countnoanswerretry']+_0x5f555b[_0x8b65('0xee')]+_0x5f555b['countdropretry']+_0x5f555b[_0x8b65('0xef')]+_0x5f555b['countmachineretry']+_0x5f555b[_0x8b65('0xf0')]>=_0x127908[_0x8b65('0xf1')]){_0x25297f['stateGlobal'](_0x5f555b,_0x3b6790,_0x21522f,_0x8b65('0xf2'));}else{if(_0x5f555b[_0x8b65('0xe8')]>=_0x127908[_0x8b65('0xf3')]){_0x25297f[_0x8b65('0xf4')](_0x5f555b,_0x3b6790,_0x21522f,_0x8b65('0xf5'));}else{_0x25297f[_0x8b65('0xba')]({'active':![],'countmachineretry':_0x5f555b[_0x8b65('0xe8')],'scheduledat':moment()[_0x8b65('0xf6')](_0x127908[_0x8b65('0xf7')],_0x8b65('0xf8'))[_0x8b65('0x71')](_0x8b65('0xf9')),'ContactId':_0x5f555b['ContactId'],'ListId':_0x5f555b[_0x8b65('0xcc')],'VoiceQueueId':_0x5f555b[_0x8b65('0xce')]||undefined,'CampaignId':_0x5f555b[_0x8b65('0xcf')]||undefined})[_0x8b65('0xab')](loggerCatch(_0x8b65('0xfa')));_0x3b6790({'reschedule':0x1});}}});}if(_0xbd1c0['type']===_0x8b65('0x74')&&this[_0x8b65('0x1d')][_0xbd1c0['queue']]['dialAMDActive']&&_0x3a8a86['value']===_0x8b65('0xfb')){delete this[_0x8b65('0x24')][_0x3a8a86[_0x8b65('0xd8')]];this[_0x8b65('0xaf')](this[_0x8b65('0x1d')][_0xbd1c0[_0x8b65('0xad')]]);_0x2b8f7a=new Hangup(_0xbd1c0,_0x3a8a86);_0x2b8f7a['state']=0x12;_0x2b8f7a[_0x8b65('0xe1')]=_0x8b65('0xfc');_0x2b8f7a['membername']=_0x8b65('0xe3');this[_0x8b65('0xc9')](_0x2b8f7a,_0x8b65('0xfd'),'[syncHangupInAMDIvr]');}if(_0xbd1c0[_0x8b65('0x4a')]==='ivr'&&this['campaigns'][_0xbd1c0[_0x8b65('0xad')]][_0x8b65('0xdd')]&&_0x3a8a86[_0x8b65('0xde')]===_0x8b65('0xe6')){var _0x25297f=this;return new BPromise(function(_0xb928f0,_0x5e7b07){delete _0x25297f['uniqueId'][_0x3a8a86[_0x8b65('0xd8')]];_0x25297f[_0x8b65('0xaf')](_0x25297f[_0x8b65('0x1d')][_0xbd1c0[_0x8b65('0xad')]]);_0x25297f[_0x8b65('0x1d')][_0xbd1c0['queue']][_0x8b65('0x5a')]+=0x1;_0x25297f[_0x8b65('0x1d')][_0xbd1c0[_0x8b65('0xad')]][_0x8b65('0xdf')]+=0x1;var _0x552b03=_0x25297f[_0x8b65('0x1d')][_0xbd1c0[_0x8b65('0xad')]];var _0x371db8=new Hangup(_0xbd1c0,_0x3a8a86);_0x371db8[_0x8b65('0xe0')]=0x13;_0x371db8[_0x8b65('0xe1')]=_0x8b65('0xe7');_0x371db8[_0x8b65('0xe2')]=_0x8b65('0xe3');_0x371db8[_0x8b65('0xe8')]+=0x1;_0x371db8['countglobal']+=0x1;_0x371db8[_0x8b65('0xea')]=!![];_0x25297f[_0x8b65('0xc4')](_0x371db8)['catch'](loggerCatch(_0x8b65('0xeb')));if(_0x371db8[_0x8b65('0xec')]+_0x371db8[_0x8b65('0xed')]+_0x371db8[_0x8b65('0xfe')]+_0x371db8[_0x8b65('0xee')]+_0x371db8[_0x8b65('0xff')]+_0x371db8[_0x8b65('0xef')]+_0x371db8[_0x8b65('0xe8')]+_0x371db8[_0x8b65('0xf0')]>=_0x552b03['dialGlobalMaxRetry']){_0x25297f[_0x8b65('0x100')](_0x371db8,_0xb928f0,_0x5e7b07,_0x8b65('0xf2'));}else{if(_0x371db8['countmachineretry']>=_0x552b03[_0x8b65('0xf3')]){_0x25297f[_0x8b65('0xf4')](_0x371db8,_0xb928f0,_0x5e7b07,_0x8b65('0xf5'));}else{_0x25297f[_0x8b65('0xba')]({'active':![],'countmachineretry':_0x371db8[_0x8b65('0xe8')],'scheduledat':moment()[_0x8b65('0xf6')](_0x552b03[_0x8b65('0xf7')],_0x8b65('0xf8'))['format'](_0x8b65('0xf9')),'ContactId':_0x371db8['ContactId'],'ListId':_0x371db8[_0x8b65('0xcc')],'VoiceQueueId':_0x371db8[_0x8b65('0xce')]||undefined,'CampaignId':_0x371db8[_0x8b65('0xcf')]||undefined})['catch'](loggerCatch(_0x8b65('0xfa')));_0xb928f0({'reschedule':0x1});}}});}}};Dialer[_0x8b65('0x18')][_0x8b65('0x33')]=function(_0x50b1d7){var _0x168795=this[_0x8b65('0x24')][_0x50b1d7[_0x8b65('0xd8')]];var _0x2b704c=this;var _0x431e31;if(_0x168795&&_0x168795[_0x8b65('0x4a')]===_0x8b65('0x74')){delete this[_0x8b65('0x24')][_0x50b1d7['uniqueid']];this['updateOriginated'](this['campaigns'][_0x168795['queue']]);this[_0x8b65('0x1d')][_0x168795[_0x8b65('0xad')]][_0x8b65('0x101')]+=0x1;_0x431e31=new Hangup(_0x168795,_0x50b1d7);this['createHistory'](_0x431e31)[_0x8b65('0xab')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x8b65('0xc2')](_0x431e31)[_0x8b65('0xab')](loggerCatch(_0x8b65('0x102')));}if(_0x168795&&_0x168795['type']!=='ivr'&&isNotNull(this[_0x8b65('0x1c')][_0x168795[_0x8b65('0xad')]][_0x8b65('0x103')])){delete this[_0x8b65('0x24')][_0x50b1d7['uniqueid']];this['updateOriginated'](this['voiceQueues'][_0x168795['queue']]);this['voiceQueues'][_0x168795['queue']][_0x8b65('0x5a')]+=0x1;this[_0x8b65('0x1c')][_0x168795[_0x8b65('0xad')]][_0x8b65('0xdf')]+=0x1;_0x431e31=new Hangup(_0x168795,_0x50b1d7);_0x431e31['state']=0x10;_0x431e31['statedesc']=_0x8b65('0x104');_0x431e31[_0x8b65('0xe2')]=_0x8b65('0x105');this['createHistory'](_0x431e31)[_0x8b65('0xab')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x8b65('0xc2')](_0x431e31)['catch'](loggerCatch(_0x8b65('0x102')));}if(_0x168795&&_0x168795[_0x8b65('0x4a')]!==_0x8b65('0x74')&&!isNotNull(this['voiceQueues'][_0x168795[_0x8b65('0xad')]][_0x8b65('0x103')])){delete this['uniqueId'][_0x50b1d7[_0x8b65('0xd8')]];this[_0x8b65('0xaf')](this['voiceQueues'][_0x168795[_0x8b65('0xad')]]);this['voiceQueues'][_0x168795[_0x8b65('0xad')]][_0x8b65('0x106')]+=0x1;_0x431e31=new Hangup(_0x168795,_0x50b1d7);_0x431e31[_0x8b65('0xe0')]=0xc;_0x431e31['statedesc']=_0x50b1d7[_0x8b65('0x107')];_0x431e31[_0x8b65('0xe2')]='Unknow';this[_0x8b65('0xc4')](_0x431e31)[_0x8b65('0xab')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x8b65('0xc2')](_0x431e31)[_0x8b65('0xab')](loggerCatch(_0x8b65('0x102')));}};Dialer[_0x8b65('0x18')]['syncAgentComplete']=function(_0x18eea0){var _0x2bc988=this[_0x8b65('0x24')][_0x18eea0[_0x8b65('0xd8')]];var _0x15cbd5=this;if(this['voiceQueues'][_0x18eea0['queue']]){if(_0x2bc988&&_0x2bc988['type']!==_0x8b65('0x74')){delete this[_0x8b65('0x24')][_0x18eea0[_0x8b65('0xd8')]];this['voiceQueues'][_0x18eea0[_0x8b65('0xad')]][_0x8b65('0x5a')]+=0x1;var _0x2671d9=new AgentComplete(_0x2bc988,_0x18eea0);if(_0x18eea0['reason']===_0x8b65('0x108')){_0x2671d9['agiafterat']=this[_0x8b65('0x1c')][_0x18eea0[_0x8b65('0xad')]][_0x8b65('0x109')]&&this[_0x8b65('0x1c')][_0x18eea0[_0x8b65('0xad')]][_0x8b65('0x10a')]?moment()[_0x8b65('0x71')](_0x8b65('0xf9')):undefined;}this[_0x8b65('0xc4')](_0x2671d9)[_0x8b65('0xab')](loggerCatch(_0x8b65('0x10b')));this[_0x8b65('0xc2')](_0x2671d9)[_0x8b65('0xab')](loggerCatch(_0x8b65('0x10c')));}}};Dialer[_0x8b65('0x18')][_0x8b65('0x2a')]=function(_0xcb7f0c){if(this[_0x8b65('0x1c')][_0xcb7f0c['queue']]){if(this[_0x8b65('0x24')][_0xcb7f0c[_0x8b65('0xd8')]]&&this[_0x8b65('0x24')][_0xcb7f0c[_0x8b65('0xd8')]][_0x8b65('0x4a')]!==_0x8b65('0x74')){this[_0x8b65('0xaf')](this[_0x8b65('0x1c')][_0xcb7f0c[_0x8b65('0xad')]]);this[_0x8b65('0x24')][_0xcb7f0c[_0x8b65('0xd8')]][_0x8b65('0x10d')]=moment()[_0x8b65('0x71')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x8b65('0x18')][_0x8b65('0x10e')]=function(_0x3c3fe6){this[_0x8b65('0xc4')](_0x3c3fe6)[_0x8b65('0xab')](loggerCatch(_0x8b65('0x10b')));this[_0x8b65('0xc2')](_0x3c3fe6)[_0x8b65('0xab')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer[_0x8b65('0x18')][_0x8b65('0x2d')]=function(_0x282f45){var _0x176564=this[_0x8b65('0x24')][_0x282f45['uniqueid']];var _0x47ba4a=this;if(this[_0x8b65('0x1c')][_0x282f45[_0x8b65('0xad')]]){if(_0x176564&&_0x176564[_0x8b65('0x4a')]!==_0x8b65('0x74')){delete this[_0x8b65('0x24')][_0x282f45['uniqueid']];this[_0x8b65('0xaf')](this['voiceQueues'][_0x282f45[_0x8b65('0xad')]]);_0x176564[_0x8b65('0x10f')]=moment()[_0x8b65('0x71')](_0x8b65('0xf9'));var _0x8150f3=new QueueCallerAbandon(_0x176564,_0x282f45);if(getSeconds(_0x176564[_0x8b65('0x10f')],_0x176564[_0x8b65('0x110')])>=_0x176564[_0x8b65('0x111')]){this['voiceQueues'][_0x282f45['queue']][_0x8b65('0x67')]+=0x1;this[_0x8b65('0x1c')][_0x282f45[_0x8b65('0xad')]][_0x8b65('0x5f')]+=0x1;this['voiceQueues'][_0x282f45['queue']][_0x8b65('0x68')]+=0x1;_0x8150f3[_0x8b65('0xe0')]=0xa;_0x8150f3[_0x8b65('0xe1')]='Drop';_0x8150f3[_0x8b65('0x112')]='TIMEOUT';_0x8150f3[_0x8b65('0x113')]=this[_0x8b65('0x1c')][_0x282f45[_0x8b65('0xad')]]['dialQueueProject2']?moment()[_0x8b65('0x71')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x8150f3['countdropretry']+=0x1;_0x8150f3[_0x8b65('0xe9')]+=0x1;if(_0x8150f3[_0x8b65('0xff')]>=this[_0x8b65('0x1c')][_0x282f45[_0x8b65('0xad')]][_0x8b65('0x114')]){this['queueCallerAbandonCreateState'](_0x8150f3);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x8150f3[_0x8b65('0xff')],'scheduledat':moment()[_0x8b65('0xf6')](this[_0x8b65('0x1c')][_0x282f45['queue']][_0x8b65('0x115')],'minutes')['format'](_0x8b65('0xf9')),'ContactId':_0x176564[_0x8b65('0xcb')],'ListId':_0x176564[_0x8b65('0xcc')],'VoiceQueueId':_0x176564[_0x8b65('0xce')]||undefined,'CampaignId':_0x176564[_0x8b65('0xcf')]||undefined})[_0x8b65('0xab')](loggerCatch(_0x8b65('0x116')));var _0x40c9cd=new History(_0x8150f3);_0x40c9cd[_0x8b65('0xe0')]=0xa;_0x40c9cd[_0x8b65('0xe1')]=_0x8b65('0x117');_0x40c9cd[_0x8b65('0xa5')]=moment()[_0x8b65('0x71')](_0x8b65('0xf9'));_0x40c9cd[_0x8b65('0xa4')]=_0x40c9cd['starttime'];_0x40c9cd[_0x8b65('0x118')]=_0x8150f3[_0x8b65('0x118')];_0x40c9cd['calleridnum']=_0x8150f3[_0x8b65('0x119')];this['createHistory'](_0x40c9cd)[_0x8b65('0xab')](loggerCatch(_0x8b65('0x11a')));}}else{this[_0x8b65('0x1c')][_0x282f45[_0x8b65('0xad')]][_0x8b65('0x7c')]+=0x1;this['voiceQueues'][_0x282f45[_0x8b65('0xad')]]['outboundDropCallsDayCallersExit']+=0x1;_0x8150f3[_0x8b65('0xe0')]=0xb;_0x8150f3[_0x8b65('0xe1')]=_0x8b65('0x11b');_0x8150f3[_0x8b65('0x112')]=_0x8b65('0x11c');_0x8150f3[_0x8b65('0xef')]+=0x1;_0x8150f3['countglobal']+=0x1;if(_0x8150f3[_0x8b65('0xef')]>=this['voiceQueues'][_0x282f45[_0x8b65('0xad')]]['dialAbandonedMaxRetry']){this['queueCallerAbandonCreateState'](_0x8150f3);}else{this[_0x8b65('0xba')]({'active':![],'countabandonedretry':_0x8150f3[_0x8b65('0xef')],'scheduledat':moment()['add'](this[_0x8b65('0x1c')][_0x282f45['queue']][_0x8b65('0x11d')],_0x8b65('0xf8'))[_0x8b65('0x71')](_0x8b65('0xf9')),'ContactId':_0x176564[_0x8b65('0xcb')],'ListId':_0x176564[_0x8b65('0xcc')],'VoiceQueueId':_0x176564[_0x8b65('0xce')]||undefined,'CampaignId':_0x176564[_0x8b65('0xcf')]||undefined})[_0x8b65('0xab')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x40c9cd=new History(_0x8150f3);_0x40c9cd[_0x8b65('0xe0')]=0xb;_0x40c9cd[_0x8b65('0xe1')]=_0x8b65('0x11b');_0x40c9cd[_0x8b65('0xa5')]=moment()[_0x8b65('0x71')](_0x8b65('0xf9'));_0x40c9cd[_0x8b65('0xa4')]=_0x40c9cd['starttime'];_0x40c9cd['calleridname']=_0x8150f3['calleridname'];_0x40c9cd['calleridnum']=_0x8150f3[_0x8b65('0x119')];this[_0x8b65('0xc4')](_0x40c9cd)[_0x8b65('0xab')](loggerCatch(_0x8b65('0x11e')));}}}}};Dialer[_0x8b65('0x18')][_0x8b65('0x34')]=function(_0x47a8c9){if(this['actions'][_0x47a8c9['uniqueid']]){this[_0x8b65('0x22')][_0x47a8c9[_0x8b65('0xd8')]][_0x8b65('0x11f')]=_0x47a8c9[_0x8b65('0x11f')];}if(this[_0x8b65('0x24')][_0x47a8c9[_0x8b65('0xd8')]]){this[_0x8b65('0x24')][_0x47a8c9['uniqueid']][_0x8b65('0x11f')]=_0x47a8c9[_0x8b65('0x11f')];}};Dialer[_0x8b65('0x18')][_0x8b65('0x38')]=function(_0x3f9057){if(strategy[this[_0x8b65('0x1c')][this['actions'][_0x3f9057[_0x8b65('0x120')]][_0x8b65('0xad')]][_0x8b65('0x4c')]]==='roundrobin'){if(this[_0x8b65('0x22')][_0x3f9057[_0x8b65('0x120')]]&&_[_0x8b65('0xa9')](this[_0x8b65('0x22')][_0x3f9057[_0x8b65('0x120')]][_0x8b65('0x121')])&&_0x3f9057[_0x8b65('0xd4')]==='1'&&_0x3f9057[_0x8b65('0x122')]==='0'){if(this[_0x8b65('0x1e')][_0x3f9057[_0x8b65('0x123')]]){if(!this['agents'][_0x3f9057[_0x8b65('0x123')]]['locked']){this[_0x8b65('0x1e')][_0x3f9057['stateinterface']][_0x8b65('0x121')]=!![];this[_0x8b65('0x22')][_0x3f9057[_0x8b65('0x120')]][_0x8b65('0x121')]=!![];this['actions'][_0x3f9057[_0x8b65('0x120')]][_0x8b65('0x123')]=_0x3f9057[_0x8b65('0x123')];}}}}else if((strategy[this[_0x8b65('0x1c')][this['actions'][_0x3f9057[_0x8b65('0x120')]][_0x8b65('0xad')]][_0x8b65('0x4c')]]||'rrmemory')==='rrmemory'){if(this[_0x8b65('0x22')][_0x3f9057[_0x8b65('0x120')]]){if(this[_0x8b65('0x1e')][_0x3f9057['stateinterface']]){this[_0x8b65('0x22')][_0x3f9057[_0x8b65('0x120')]]['stateinterface']=_0x3f9057[_0x8b65('0x123')];if(_['isNil'](this[_0x8b65('0x124')][this[_0x8b65('0x22')][_0x3f9057[_0x8b65('0x120')]][_0x8b65('0xad')]])){this[_0x8b65('0x124')][this['actions'][_0x3f9057[_0x8b65('0x120')]][_0x8b65('0xad')]]=[];}this[_0x8b65('0x124')][this[_0x8b65('0x22')][_0x3f9057[_0x8b65('0x120')]]['queue']][_0x8b65('0x125')](_[_0x8b65('0xca')](_[_0x8b65('0x126')](this['actions'][_0x3f9057[_0x8b65('0x120')]],[_0x8b65('0x127'),_0x8b65('0x123')]),{'status':_0x3f9057[_0x8b65('0xd4')],'paused':_0x3f9057[_0x8b65('0x122')]}));}}}};function unlockQueueStatus(_0x2c359a,_0x5a2349){setTimeout(function(){if(_[_0x8b65('0x80')](_0x2c359a[_0x8b65('0x128')])){loggerBooked[_0x8b65('0x90')](_0x8b65('0x129'),_0x5a2349);}_0x2c359a[_0x8b65('0x128')]=!![];loggerBooked['info']('[booked][unlockQueueStatus]',_0x5a2349,JSON[_0x8b65('0x47')](_[_0x8b65('0x126')](_0x2c359a,['name',_0x8b65('0x128')])));},0x1f3);}Dialer['prototype'][_0x8b65('0x39')]=function(_0x43f4bb){var _0x2380db=this;var _0x17a6b5=_0x2380db[_0x8b65('0x1c')][_0x2380db[_0x8b65('0x22')][_0x43f4bb['actionid']]['queue']];if(strategy[this[_0x8b65('0x1c')][this[_0x8b65('0x22')][_0x43f4bb[_0x8b65('0x120')]][_0x8b65('0xad')]][_0x8b65('0x4c')]]===_0x8b65('0x17')){if(this[_0x8b65('0x22')][_0x43f4bb[_0x8b65('0x120')]]&&this['actions'][_0x43f4bb['actionid']]['stateinterface']){this['preview'][_0x8b65('0x12a')](this[_0x8b65('0x22')][_0x43f4bb[_0x8b65('0x120')]]['idHopper'],this[_0x8b65('0x22')][_0x43f4bb[_0x8b65('0x120')]][_0x8b65('0x123')])['catch'](function(_0x13cd2e){logger[_0x8b65('0x90')](_0x8b65('0x12b'),util[_0x8b65('0x91')](_0x13cd2e,{'showHidden':![],'depth':null}));})[_0x8b65('0x12c')](function(){_0x2380db[_0x8b65('0xaf')](_0x2380db[_0x8b65('0x1c')][_0x2380db[_0x8b65('0x22')][_0x43f4bb['actionid']][_0x8b65('0xad')]]);_0x2380db[_0x8b65('0x1e')][_0x2380db[_0x8b65('0x22')][_0x43f4bb[_0x8b65('0x120')]][_0x8b65('0x123')]]['locked']=![];delete _0x2380db[_0x8b65('0x22')][_0x43f4bb[_0x8b65('0x120')]];unlockQueueStatus(_0x17a6b5);});}else{this['updateOriginated'](this[_0x8b65('0x1c')][this['actions'][_0x43f4bb[_0x8b65('0x120')]][_0x8b65('0xad')]]);this[_0x8b65('0xba')]({'active':![],'ContactId':this[_0x8b65('0x22')][_0x43f4bb[_0x8b65('0x120')]][_0x8b65('0xcb')],'ListId':this['actions'][_0x43f4bb[_0x8b65('0x120')]]['ListId'],'VoiceQueueId':this[_0x8b65('0x22')][_0x43f4bb[_0x8b65('0x120')]][_0x8b65('0xce')]||undefined,'CampaignId':this['actions'][_0x43f4bb[_0x8b65('0x120')]][_0x8b65('0xcf')]||undefined})['catch'](loggerCatch(_0x8b65('0x12d')));delete this[_0x8b65('0x22')][_0x43f4bb[_0x8b65('0x120')]];unlockQueueStatus(_0x17a6b5);}}else if((strategy[this[_0x8b65('0x1c')][this['actions'][_0x43f4bb[_0x8b65('0x120')]]['queue']]['strategy']]||_0x8b65('0x12e'))==='rrmemory'){var _0x360a3a;if(this[_0x8b65('0x22')][_0x43f4bb['actionid']]&&!_[_0x8b65('0x76')](this['queueBooked'][this[_0x8b65('0x22')][_0x43f4bb[_0x8b65('0x120')]][_0x8b65('0xad')]])){if(this[_0x8b65('0x28')][_0x2380db[_0x8b65('0x22')][_0x43f4bb['actionid']][_0x8b65('0xad')]]){this[_0x8b65('0x28')][_0x2380db[_0x8b65('0x22')][_0x43f4bb[_0x8b65('0x120')]][_0x8b65('0xad')]]=this[_0x8b65('0x28')][this[_0x8b65('0x22')][_0x43f4bb[_0x8b65('0x120')]]['queue']]?this[_0x8b65('0x28')][this[_0x8b65('0x22')][_0x43f4bb[_0x8b65('0x120')]][_0x8b65('0xad')]]:this[_0x8b65('0x124')][this['actions'][_0x43f4bb[_0x8b65('0x120')]]['queue']]?this[_0x8b65('0x124')][this['actions'][_0x43f4bb[_0x8b65('0x120')]]['queue']][_0x8b65('0x12f')]||0x0:0x0;}this['queueBooked'][this[_0x8b65('0x22')][_0x43f4bb['actionid']][_0x8b65('0xad')]]['_rr']=this['queueBookedRR'][this[_0x8b65('0x22')][_0x43f4bb[_0x8b65('0x120')]]['queue']];for(var _0x5a374d=0x0;_0x5a374d=0x0?!![]:![];})['catch'](myreject(_0x2d22fd)));}}else{_0x31485e[_0x8b65('0x125')](ami['Action']({'action':'command','command':util[_0x8b65('0x71')](_0x8b65('0x145'),_0x3d9bae,!_[_0x8b65('0x80')](config[_0x8b65('0x141')][_0x2ac632])?_0x2ac632:'')})[_0x8b65('0xb2')](function(_0x30867d){return _0x30867d[_0x8b65('0x147')]['indexOf'](_0x8b65('0x149'))>=0x0?!![]:![];})[_0x8b65('0xab')](myreject(_0x2d22fd)));}BPromise[_0x8b65('0x14a')](_0x31485e)[_0x8b65('0xb2')](function(_0x37be25){var _0x225c54=_[_0x8b65('0x14b')](_0x37be25);if(_0x225c54){return _0x3478a2(_0x225c54);}else{_0x57748e[_0x8b65('0x3c')]=_0x309db0?'GLOBAL_INTERVAL_IS_OVERTIME':'INTERVAL_IS_OVERTIME';return _0x2d22fd(msgResponse('[ifTime][promiseAll]','Failure','Global:\x20'+_0x309db0+'\x20'+_0x3c2c1e+_0x8b65('0x14c')+util[_0x8b65('0x91')](_0x3d9bae,{'showHidden':![],'depth':null})+_0x8b65('0x14d')+_0x2ac632));}})[_0x8b65('0xab')](function(_0x49728b){return _0x2d22fd(msgResponse(_0x8b65('0x13c'),_0x8b65('0x13f'),JSON[_0x8b65('0x47')](_0x49728b)));});});};Dialer[_0x8b65('0x18')][_0x8b65('0x14e')]=function(_0x287dbf){var _0x3b1d3d=this;return function(){switch(_0x287dbf[_0x8b65('0x56')]){case _0x8b65('0x14f'):freeVariablesPredictive(_0x287dbf);_0x3b1d3d[_0x8b65('0x150')](_0x287dbf,0x1);break;case'power':freeVariablesPredictive(_0x287dbf);_0x3b1d3d[_0x8b65('0x150')](_0x287dbf,_0x287dbf[_0x8b65('0x151')]);break;case _0x8b65('0x152'):_0x3b1d3d['predictive'](_0x287dbf);break;case _0x8b65('0x153'):freeVariablesPredictive(_0x287dbf);_0x3b1d3d[_0x8b65('0x150')](_0x287dbf,0x1);break;default:freeVariablesPredictive(_0x287dbf);logger['error'](_0x8b65('0x154'),_0x287dbf[_0x8b65('0x40')],_0x8b65('0x155'));}};};Dialer[_0x8b65('0x18')]['launchHandleIvr']=function(_0xa98604){var _0x39d36b=this;return function(){_0x39d36b['handleIvr'](_0xa98604);};};Dialer[_0x8b65('0x18')][_0x8b65('0x9')]=function(_0x17e3dd){var _0x184b16=this;if(isNotPreview(_0x17e3dd[_0x8b65('0x56')])){if(isVoiceQueueOutbound(_0x17e3dd['type'])&&isActive(_0x17e3dd[_0x8b65('0x156')])){_0x17e3dd[_0x8b65('0x9d')]=!![];BPromise['resolve']()['then'](checkIsLoggedIn(_0x17e3dd,_0x17e3dd[_0x8b65('0x4e')]))[_0x8b65('0xb2')](checkIsActive(_0x17e3dd,_0x17e3dd[_0x8b65('0x156')]))[_0x8b65('0xb2')](checkInterval(_0x17e3dd))[_0x8b65('0xb2')](_0x184b16[_0x8b65('0x157')](_0x17e3dd))[_0x8b65('0xb2')](_0x184b16[_0x8b65('0x13b')](_0x17e3dd[_0x8b65('0x158')],_0x17e3dd['dialTimezone'],_0x17e3dd[_0x8b65('0x40')],_0x17e3dd))[_0x8b65('0xb2')](_0x184b16[_0x8b65('0x159')](_0x17e3dd[_0x8b65('0x41')],_0x17e3dd[_0x8b65('0x15a')],_0x17e3dd[_0x8b65('0x40')],_0x17e3dd))[_0x8b65('0xb2')](_0x184b16[_0x8b65('0x14e')](_0x17e3dd))[_0x8b65('0xab')](loggerCatchQueueSummary(_0x8b65('0x15b'),_0x17e3dd));}else{notSendMessagesQueue(_0x17e3dd);}}else{freeVariablesPredictive(_0x17e3dd);}};Dialer['prototype'][_0x8b65('0x137')]=function(){var _0x5e174c=this;var _0x3f8805;for(var _0x316721 in this['campaigns']){if(this['campaigns'][_0x8b65('0x94')](_0x316721)){_0x3f8805=this[_0x8b65('0x1d')][_0x316721];if(isCampaignIvr(_0x3f8805[_0x8b65('0x4a')])&&isActive(_0x3f8805[_0x8b65('0xd3')])){_0x3f8805[_0x8b65('0x9d')]=!![];BPromise['resolve']()[_0x8b65('0xb2')](checkIsActive(_0x3f8805,_0x3f8805[_0x8b65('0xd3')]))[_0x8b65('0xb2')](checkInterval(_0x3f8805))[_0x8b65('0xb2')](_0x5e174c[_0x8b65('0x157')](_0x3f8805))[_0x8b65('0xb2')](_0x5e174c[_0x8b65('0x13b')](_0x3f8805[_0x8b65('0x158')],_0x3f8805[_0x8b65('0x15a')],_0x3f8805[_0x8b65('0x40')],_0x3f8805))[_0x8b65('0xb2')](_0x5e174c[_0x8b65('0x159')](_0x3f8805['Interval'],_0x3f8805['dialTimezone'],_0x3f8805[_0x8b65('0x40')],_0x3f8805))['then'](_0x5e174c[_0x8b65('0x15c')](_0x3f8805))['catch'](loggerCatchQueueSummary(_0x8b65('0x15d'),_0x3f8805));}else{notSendMessagesCampaign(_0x3f8805);}}}};function getCallerIdRandom(_0x4d3a9b,_0x59be67){var _0x3916d9,_0x23cdc4,_0x3beeb0;if(_0x59be67<=0x0){_0x59be67=0x1;}_0x3916d9=new RegExp(_0x8b65('0x15e')+_0x59be67+'}$');_0x23cdc4=Math[_0x8b65('0x15f')](0xa,_0x59be67-0x1);_0x3beeb0=Math[_0x8b65('0x15f')](0xa,_0x59be67)-0x1;return util['format']('%s',_[_0x8b65('0x160')](_0x4d3a9b,_0x3916d9,_[_0x8b65('0x161')](_0x23cdc4,_0x3beeb0)));}function extractCalleridName(_0x16fddd){var _0x4a970a=_0x16fddd[_0x8b65('0x162')](/"(.*?)"/);return _0x4a970a?_0x4a970a[0x1]:_0x16fddd;}function extractCalleridNumber(_0x1e59e5){var _0x5cee4b=_0x1e59e5[_0x8b65('0x162')](/<(.*?)>/);return _0x5cee4b?_0x5cee4b[0x1]:_0x1e59e5;}Dialer['prototype']['actionOriginate']=function(_0x2e296b,_0x5d6bf8){var _0x5e4aa5=this;var _0x545a3d=uuid['v4']();this[_0x8b65('0x22')][_0x545a3d]=new Action(_0x2e296b,_0x5d6bf8,_0x545a3d);return new BPromise(function(_0x147008,_0x8fddee){if(_[_0x8b65('0x80')](_0x2e296b)&&_0x8b65('0x163')!==typeof _0x2e296b){return _0x8fddee(msgResponse('originate',_0x8b65('0x13f'),_0x8b65('0x164')));}if(_[_0x8b65('0x80')](_0x5d6bf8[_0x8b65('0x165')][_0x8b65('0x166')])||_0x5d6bf8[_0x8b65('0x165')][_0x8b65('0x166')]===null){return _0x8fddee(msgResponse(_0x8b65('0x167'),'Failure',_0x8b65('0x168')));}var _0x36b383={'XMD-CALLERID':_0x5e4aa5['actions'][_0x545a3d][_0x8b65('0x169')](),'XMD-AGI':_0x2e296b[_0x8b65('0x103')]?util[_0x8b65('0x71')](_0x8b65('0x16a'),ipAgi,_0x2e296b[_0x8b65('0x103')]):_0x8b65('0x16b'),'XMD-AGIAFTER':_0x2e296b[_0x8b65('0x109')]?util[_0x8b65('0x71')]('\x22agi://%s/square,%s\x22',ipAgi,_0x2e296b['dialQueueProject2']):_0x8b65('0x16b'),'XMD-QUEUE':_0x2e296b[_0x8b65('0x4a')]===_0x8b65('0x4b')?util['format']('\x22%s,%s%s,,,%s\x22',_0x2e296b[_0x8b65('0x40')],_0x2e296b[_0x8b65('0x16c')]||'',_0x2e296b['dialAgiAfterHangupAgent']?'c':'',_0x2e296b['dialQueueTimeout']||0x3):_0x8b65('0x16b'),'XMD-CONTACTID':_0x5d6bf8['ContactId'],'XMD-CDRTYPE':_0x8b65('0x16d'),'CALLERID(all)':_0x5e4aa5[_0x8b65('0x22')][_0x545a3d]['getCaller'](),'XMD-AMD':_0x2e296b[_0x8b65('0xdd')]?_0x8b65('0x16e'):'NONE','XMD-DESTINATION':_0x8b65('0xdc')};if(_0x2e296b[_0x8b65('0xdd')]){_0x36b383[_0x8b65('0x16f')]=_0x2e296b['dialAMDInitialSilence']||0x9c4;_0x36b383[_0x8b65('0x170')]=_0x2e296b[_0x8b65('0x171')]||0x5dc;_0x36b383[_0x8b65('0x172')]=_0x2e296b[_0x8b65('0x173')]||0x320;_0x36b383[_0x8b65('0x174')]=_0x2e296b['dialAMDTotalAnalysisTime']||0x1388;_0x36b383[_0x8b65('0x175')]=_0x2e296b[_0x8b65('0x176')]||0x64;_0x36b383['XMD-AMDBETWEENWORDSSILENCE']=_0x2e296b[_0x8b65('0x177')]||0x32;_0x36b383[_0x8b65('0x178')]=_0x2e296b[_0x8b65('0x179')]||0x3;_0x36b383['XMD-AMDSILENCETHRESHOLD']=_0x2e296b[_0x8b65('0x17a')]||0x100;_0x36b383[_0x8b65('0x17b')]=_0x2e296b['dialAMDMaximumWordLength']||0x1388;}if(_0x2e296b[_0x8b65('0x4a')]==='outbound'){_0x36b383[_0x8b65('0x17c')]=_0x5d6bf8[_0x8b65('0xce')];}else{_0x36b383[_0x8b65('0x17d')]=_0x5d6bf8[_0x8b65('0xcf')];}for(var _0x55b343 in _0x5d6bf8[_0x8b65('0x165')]){if(_0x5d6bf8[_0x8b65('0x165')]['hasOwnProperty'](_0x55b343)){if(isNotNull(_0x5d6bf8[_0x8b65('0x165')][_0x55b343])&&_0x55b343!=='id'&&_0x55b343!==_0x8b65('0x17e')&&_0x55b343!=='createdAt'&&_0x55b343!=='updatedAt'){_0x36b383[util['format'](_0x8b65('0x17f'),_0x8b65('0x180'),_[_0x8b65('0x181')](_0x55b343))]=_0x5d6bf8[_0x8b65('0x165')][_0x55b343];}}}var _0x49f1b3=_0x5e4aa5[_0x8b65('0xd2')](_0x2e296b['Trunk'])?getCallerId(_0x2e296b[_0x8b65('0x70')][_0x8b65('0x182')],_0x2e296b[_0x8b65('0x57')],_0x2e296b[_0x8b65('0x183')]>0x0?getCallerIdRandom(_0x2e296b[_0x8b65('0x58')],_0x2e296b[_0x8b65('0x183')]):_0x2e296b[_0x8b65('0x58')]):getCallerId(_['isNil'](_0x2e296b[_0x8b65('0x138')])?_0x2e296b[_0x8b65('0x70')][_0x8b65('0x182')]:_0x2e296b[_0x8b65('0x138')][_0x8b65('0x182')],_0x2e296b[_0x8b65('0x57')],_0x2e296b[_0x8b65('0x183')]>0x0?getCallerIdRandom(_0x2e296b[_0x8b65('0x58')],_0x2e296b['dialRandomLastDigitCallerIdNumber']):_0x2e296b[_0x8b65('0x58')]);if(_0x49f1b3){_0x36b383[_0x8b65('0x184')]=_0x5e4aa5[_0x8b65('0x22')][_0x545a3d][_0x8b65('0x185')]=extractCalleridName(_0x49f1b3);_0x36b383[_0x8b65('0x186')]=_0x5e4aa5[_0x8b65('0x22')][_0x545a3d][_0x8b65('0x187')]=extractCalleridNumber(_0x49f1b3);}return ami[_0x8b65('0xaa')]({'actionid':_0x545a3d,'action':'originate','channel':_0x5e4aa5[_0x8b65('0xd2')](_0x2e296b[_0x8b65('0x70')])?util[_0x8b65('0x71')](_0x8b65('0x188'),_0x2e296b['Trunk']['name'],isNotNull(_0x2e296b['dialPrefix'])?_0x2e296b['dialPrefix'][_0x8b65('0x189')]()||'':'',_0x2e296b[_0x8b65('0x18a')]>0x0?_0x5d6bf8['Contact']['phone'][_0x8b65('0x18b')](_0x2e296b[_0x8b65('0x18a')]):_0x5d6bf8[_0x8b65('0x165')][_0x8b65('0x166')]):util['format'](_0x8b65('0x188'),_['isNil'](_0x2e296b[_0x8b65('0x138')])?_0x2e296b[_0x8b65('0x70')]['name']:_0x2e296b[_0x8b65('0x138')][_0x8b65('0x40')],isNotNull(_0x2e296b[_0x8b65('0x18c')])?_0x2e296b[_0x8b65('0x18c')]['trim']()||'':'',_0x2e296b[_0x8b65('0x18a')]>0x0?_0x5d6bf8['Contact'][_0x8b65('0x166')][_0x8b65('0x18b')](_0x2e296b[_0x8b65('0x18a')]):_0x5d6bf8[_0x8b65('0x165')][_0x8b65('0x166')]),'callerid':_0x49f1b3,'Exten':_0x8b65('0xdc'),'Context':'from-sip','Priority':'1','variable':_0x36b383,'timeout':(_0x2e296b[_0x8b65('0x59')]||0x1e)*0x3e8,'async':!![],'channelid':_0x545a3d})[_0x8b65('0xb2')](function(_0x233b5a){return _0x147008(_0x233b5a);})[_0x8b65('0xab')](function(_0x3810c4){_0x2e296b[_0x8b65('0x62')]+=0x1;var _0x2c1ec4=new History(_0x5e4aa5[_0x8b65('0x22')][_0x545a3d]);logger[_0x8b65('0x90')](util[_0x8b65('0x71')](_0x8b65('0x18d'),JSON[_0x8b65('0x47')](_0x3810c4)));_0x2c1ec4['state']=0xe;_0x2c1ec4[_0x8b65('0xe1')]='OriginateError';_0x2c1ec4['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2c1ec4[_0x8b65('0xa4')]=_0x2c1ec4['starttime'];_0x5e4aa5[_0x8b65('0xc4')](_0x2c1ec4)[_0x8b65('0xab')](loggerCatch(_0x8b65('0x18e')));_0x5e4aa5[_0x8b65('0xc2')](_0x2c1ec4)[_0x8b65('0xab')](loggerCatch('[originate][error]'))[_0x8b65('0x12c')](function(){delete _0x5e4aa5[_0x8b65('0x22')][_0x545a3d];return _0x8fddee(msgResponse(_0x8b65('0x167'),_0x8b65('0x46'),_0x8b65('0x18f')));});});});};Dialer[_0x8b65('0x18')][_0x8b65('0x2f')]=function(_0x58179b){var _0x36d315=this['actions'][_0x58179b[_0x8b65('0x120')]];var _0x2cce43=this;if(_0x36d315){delete this[_0x8b65('0x22')][_0x58179b[_0x8b65('0x120')]];_0x36d315[_0x8b65('0x110')]=moment()[_0x8b65('0x71')](_0x8b65('0xf9'));var _0x6ca1a6=_0x36d315['type']===_0x8b65('0x74')?this[_0x8b65('0x1d')][_0x36d315['queue']]:this['voiceQueues'][_0x36d315['getQueue']()];if(!this[_0x8b65('0xd1')](_0x58179b[_0x8b65('0x190')])){this[_0x8b65('0xaf')](_0x6ca1a6);return this[_0x8b65('0x191')](_0x36d315,_0x6ca1a6,_0x58179b)[_0x8b65('0xb2')](function(_0x3dc573){})[_0x8b65('0xab')](loggerCatch(_0x8b65('0x192')));}else{this[_0x8b65('0x24')][_0x58179b['uniqueid']]=_0x36d315;}}};Dialer[_0x8b65('0x18')][_0x8b65('0x193')]=function(_0x2e42e9,_0x24424f,_0x5658c7){var _0x59c389=new History(_0x24424f);if(_0x59c389[_0x8b65('0xec')]+_0x59c389[_0x8b65('0xed')]+_0x59c389[_0x8b65('0xfe')]+_0x59c389['countnosuchnumberretry']+_0x59c389['countdropretry']+_0x59c389[_0x8b65('0xef')]+_0x59c389[_0x8b65('0xe8')]+_0x59c389[_0x8b65('0xf0')]>=_0x5658c7[_0x8b65('0xf1')]-0x1){return!![];}switch(_0x2e42e9){case 0x3:if(_0x59c389['countnoanswerretry']>=_0x5658c7[_0x8b65('0x194')]-0x1){return!![];}else{this[_0x8b65('0xba')]({'active':![],'countnoanswerretry':_0x59c389[_0x8b65('0xfe')]+=0x1,'scheduledat':moment()[_0x8b65('0xf6')](_0x5658c7[_0x8b65('0x195')],_0x8b65('0xf8'))[_0x8b65('0x71')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x59c389[_0x8b65('0xcb')],'ListId':_0x59c389['ListId'],'VoiceQueueId':_0x59c389[_0x8b65('0xce')]||undefined,'CampaignId':_0x59c389['CampaignId']||undefined})['catch'](loggerCatch(_0x8b65('0x196')));}break;case 0x5:if(_0x59c389['countbusyretry']>=_0x5658c7[_0x8b65('0x197')]-0x1){return!![];}else{this[_0x8b65('0xba')]({'active':![],'countbusyretry':_0x59c389['countbusyretry']+=0x1,'scheduledat':moment()[_0x8b65('0xf6')](_0x5658c7[_0x8b65('0x198')],'minutes')[_0x8b65('0x71')](_0x8b65('0xf9')),'ContactId':_0x59c389[_0x8b65('0xcb')],'ListId':_0x59c389[_0x8b65('0xcc')],'VoiceQueueId':_0x59c389[_0x8b65('0xce')]||undefined,'CampaignId':_0x59c389[_0x8b65('0xcf')]||undefined})[_0x8b65('0xab')](loggerCatch(_0x8b65('0x199')));}break;case 0x8:if(_0x59c389[_0x8b65('0xed')]>=_0x5658c7[_0x8b65('0x19a')]-0x1){return!![];}else{this[_0x8b65('0xba')]({'active':![],'countcongestionretry':_0x59c389[_0x8b65('0xed')]+=0x1,'scheduledat':moment()[_0x8b65('0xf6')](_0x5658c7[_0x8b65('0x19b')],'minutes')[_0x8b65('0x71')](_0x8b65('0xf9')),'ContactId':_0x59c389[_0x8b65('0xcb')],'ListId':_0x59c389[_0x8b65('0xcc')],'VoiceQueueId':_0x59c389['VoiceQueueId']||undefined,'CampaignId':_0x59c389[_0x8b65('0xcf')]||undefined})[_0x8b65('0xab')](loggerCatch('[rescheduleContact]\x20[Congestion]'));}break;case 0x0:if(_0x59c389['countnosuchnumberretry']>=_0x5658c7[_0x8b65('0x19c')]-0x1){return!![];}else{this[_0x8b65('0xba')]({'active':![],'countnosuchnumberretry':_0x59c389[_0x8b65('0xee')]+=0x1,'scheduledat':moment()[_0x8b65('0xf6')](_0x5658c7[_0x8b65('0x19d')],_0x8b65('0xf8'))[_0x8b65('0x71')](_0x8b65('0xf9')),'ContactId':_0x59c389[_0x8b65('0xcb')],'ListId':_0x59c389[_0x8b65('0xcc')],'VoiceQueueId':_0x59c389[_0x8b65('0xce')]||undefined,'CampaignId':_0x59c389[_0x8b65('0xcf')]||undefined})[_0x8b65('0xab')](loggerCatch(_0x8b65('0x19e')));}break;case 0xa:if(_0x59c389['countdropretry']>=_0x5658c7[_0x8b65('0x114')]-0x1){return!![];}else{this[_0x8b65('0xba')]({'active':![],'countdropretry':_0x59c389[_0x8b65('0xff')]+=0x1,'scheduledat':moment()[_0x8b65('0xf6')](_0x5658c7[_0x8b65('0x115')],_0x8b65('0xf8'))[_0x8b65('0x71')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x59c389[_0x8b65('0xcb')],'ListId':_0x59c389[_0x8b65('0xcc')],'VoiceQueueId':_0x59c389[_0x8b65('0xce')]||undefined,'CampaignId':_0x59c389[_0x8b65('0xcf')]||undefined})['catch'](loggerCatch(_0x8b65('0x116')));}break;case 0xb:if(_0x59c389[_0x8b65('0xef')]>=_0x5658c7[_0x8b65('0x19f')]-0x1){return!![];}else{this[_0x8b65('0xba')]({'active':![],'countabandonedretry':_0x59c389[_0x8b65('0xef')]+=0x1,'scheduledat':moment()['add'](_0x5658c7[_0x8b65('0x11d')],_0x8b65('0xf8'))[_0x8b65('0x71')](_0x8b65('0xf9')),'ContactId':_0x59c389[_0x8b65('0xcb')],'ListId':_0x59c389['ListId'],'VoiceQueueId':_0x59c389[_0x8b65('0xce')]||undefined,'CampaignId':_0x59c389['CampaignId']||undefined})[_0x8b65('0xab')](loggerCatch(_0x8b65('0x1a0')));}break;case 0x13:if(_0x59c389[_0x8b65('0xe8')]>=_0x5658c7[_0x8b65('0xf3')]-0x1){return!![];}else{this[_0x8b65('0xba')]({'active':![],'countmachineretry':_0x59c389[_0x8b65('0xe8')]+=0x1,'scheduledat':moment()[_0x8b65('0xf6')](_0x5658c7[_0x8b65('0xf7')],_0x8b65('0xf8'))[_0x8b65('0x71')](_0x8b65('0xf9')),'ContactId':_0x59c389[_0x8b65('0xcb')],'ListId':_0x59c389[_0x8b65('0xcc')],'VoiceQueueId':_0x59c389['VoiceQueueId']||undefined,'CampaignId':_0x59c389['CampaignId']||undefined})[_0x8b65('0xab')](loggerCatch(_0x8b65('0xfa')));}break;case 0x14:if(_0x59c389[_0x8b65('0xf0')]>=_0x5658c7[_0x8b65('0x1a1')]-0x1){return!![];}else{this[_0x8b65('0xba')]({'active':![],'countagentrejectretry':_0x59c389[_0x8b65('0xf0')]+=0x1,'scheduledat':moment()[_0x8b65('0xf6')](_0x5658c7[_0x8b65('0x1a2')],'minutes')[_0x8b65('0x71')](_0x8b65('0xf9')),'ContactId':_0x59c389[_0x8b65('0xcb')],'ListId':_0x59c389[_0x8b65('0xcc')],'VoiceQueueId':_0x59c389[_0x8b65('0xce')]||undefined,'CampaignId':_0x59c389[_0x8b65('0xcf')]||undefined})[_0x8b65('0xab')](loggerCatch(_0x8b65('0x1a3')));}break;default:return!![];}};Dialer[_0x8b65('0x18')][_0x8b65('0x191')]=function(_0x382720,_0x536c6b,_0x1725c7){var _0x351428=this;var _0x36a2c2=new History(_0x382720);return new BPromise(function(_0x48a3f0,_0x2fa09f){if(_[_0x8b65('0x80')](_0x536c6b)&&'object'!==typeof _0x536c6b){return _0x2fa09f(msgResponse(_0x8b65('0x1a4'),'Failure','entity\x20is\x20undefine'));}if(_['isUndefined'](_0x1725c7)&&_0x8b65('0x163')!==typeof _0x1725c7){return _0x2fa09f(msgResponse('[callProgressDetecting]',_0x8b65('0x13f'),_0x8b65('0x1a5')));}switch(_0x1725c7[_0x8b65('0x1a6')]){case'0':_0x536c6b['outboundNoSuchCallsDay']+=0x1;_0x36a2c2['state']=0x0;_0x36a2c2[_0x8b65('0xe1')]=_0x8b65('0x1a7');_0x36a2c2[_0x8b65('0xee')]+=0x1;_0x36a2c2['countglobal']+=0x1;console[_0x8b65('0x1a8')]('EMITTING\x20status_nosuchnumber\x20for',ut[_0x8b65('0x1a9')](_0x382720,_0x8b65('0x1aa')));ami[_0x8b65('0x49')](_0x8b65('0x1ab'),ut[_0x8b65('0x1a9')](_0x382720,'nosuchnumber'));_0x351428['createHistory'](_0x36a2c2)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x351428[_0x8b65('0x193')](0x0,_0x382720,_0x536c6b)){if(_0x36a2c2[_0x8b65('0xee')]>=_0x536c6b[_0x8b65('0x19c')]){_0x351428['createStateFinal'](_0x36a2c2,_0x48a3f0,_0x2fa09f,_0x8b65('0x1ac'));}else{_0x351428[_0x8b65('0x100')](_0x36a2c2,_0x48a3f0,_0x2fa09f,_0x8b65('0x1ac'));}}break;case'3':_0x536c6b[_0x8b65('0x60')]+=0x1;_0x36a2c2[_0x8b65('0xe0')]=0x3;_0x36a2c2[_0x8b65('0xe1')]=_0x8b65('0x1ad');_0x36a2c2['countnoanswerretry']+=0x1;_0x36a2c2[_0x8b65('0xe9')]+=0x1;console[_0x8b65('0x1a8')](_0x8b65('0x1ae'),_0x1725c7);console['log'](_0x8b65('0x1af'),_0x382720);console[_0x8b65('0x1a8')]('NO\x20ANSWER\x20entity',_0x536c6b);console[_0x8b65('0x1a8')](_0x8b65('0x1b0'),_0x36a2c2);console[_0x8b65('0x1a8')]('EMITTING\x20status_noanswer\x20for',ut[_0x8b65('0x1a9')](_0x382720,_0x8b65('0x1b1')));ami[_0x8b65('0x49')](_0x8b65('0x1b2'),ut[_0x8b65('0x1a9')](_0x382720,_0x8b65('0x1b1')));_0x351428[_0x8b65('0xc4')](_0x36a2c2)[_0x8b65('0xab')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x351428[_0x8b65('0x193')](0x3,_0x382720,_0x536c6b)){if(_0x36a2c2[_0x8b65('0xfe')]>=_0x536c6b['dialNoAnswerMaxRetry']){_0x351428['createStateFinal'](_0x36a2c2,_0x48a3f0,_0x2fa09f,_0x8b65('0x1b3'));}else{_0x351428[_0x8b65('0x100')](_0x36a2c2,_0x48a3f0,_0x2fa09f,_0x8b65('0x1b3'));}}break;case'5':_0x536c6b[_0x8b65('0x1b4')]+=0x1;_0x36a2c2['state']=0x5;_0x36a2c2['statedesc']=_0x8b65('0x1b5');_0x36a2c2[_0x8b65('0xec')]+=0x1;_0x36a2c2['countglobal']+=0x1;console['log'](_0x8b65('0x1b6'),ut[_0x8b65('0x1a9')](_0x382720,'busy'));ami[_0x8b65('0x49')]('custom:status_busy',ut[_0x8b65('0x1a9')](_0x382720,_0x8b65('0x1b7')));_0x351428[_0x8b65('0xc4')](_0x36a2c2)[_0x8b65('0xab')](loggerCatch(_0x8b65('0x1b8')));if(_0x351428[_0x8b65('0x193')](0x5,_0x382720,_0x536c6b)){if(_0x36a2c2['countbusyretry']>=_0x536c6b[_0x8b65('0x197')]){_0x351428[_0x8b65('0xf4')](_0x36a2c2,_0x48a3f0,_0x2fa09f,'reason\x205\x20busy');}else{_0x351428[_0x8b65('0x100')](_0x36a2c2,_0x48a3f0,_0x2fa09f,'reason\x205\x20busy');}}break;case'8':_0x536c6b[_0x8b65('0x5c')]+=0x1;_0x36a2c2[_0x8b65('0xe0')]=0x8;_0x36a2c2['statedesc']=_0x8b65('0x1b9');_0x36a2c2[_0x8b65('0xed')]+=0x1;_0x36a2c2[_0x8b65('0xe9')]+=0x1;_0x351428[_0x8b65('0xc4')](_0x36a2c2)[_0x8b65('0xab')](loggerCatch(_0x8b65('0x1ba')));if(_0x351428['checkRetriveMax'](0x8,_0x382720,_0x536c6b)){if(_0x36a2c2[_0x8b65('0xed')]>=_0x536c6b['dialCongestionMaxRetry']){_0x351428[_0x8b65('0xf4')](_0x36a2c2,_0x48a3f0,_0x2fa09f,_0x8b65('0x1bb'));}else{_0x351428[_0x8b65('0x100')](_0x36a2c2,_0x48a3f0,_0x2fa09f,_0x8b65('0x1bb'));}}break;case'11':_0x536c6b[_0x8b65('0x1bc')]+=0x1;_0x36a2c2[_0x8b65('0xe0')]=0xb;_0x36a2c2[_0x8b65('0xe1')]=_0x8b65('0x11b');_0x36a2c2[_0x8b65('0xef')]+=0x1;_0x36a2c2[_0x8b65('0xe9')]+=0x1;_0x351428[_0x8b65('0xc4')](_0x36a2c2)[_0x8b65('0xab')](loggerCatch(_0x8b65('0x11e')));if(_0x351428[_0x8b65('0x193')](0xb,_0x382720,_0x536c6b)){if(_0x36a2c2[_0x8b65('0xef')]>=_0x536c6b[_0x8b65('0x19f')]){_0x351428[_0x8b65('0xf4')](_0x36a2c2,_0x48a3f0,_0x2fa09f,_0x8b65('0x1bd'));}else{_0x351428[_0x8b65('0x100')](_0x36a2c2,_0x48a3f0,_0x2fa09f,_0x8b65('0x1bd'));}}break;case'20':_0x536c6b[_0x8b65('0x1be')]+=0x1;_0x36a2c2['state']=0x14;_0x36a2c2['statedesc']='AgentReject';_0x36a2c2['countagentrejectretry']+=0x1;_0x36a2c2[_0x8b65('0xe9')]+=0x1;_0x351428[_0x8b65('0xc4')](_0x36a2c2)[_0x8b65('0xab')](loggerCatch(_0x8b65('0x1bf')));if(_0x351428[_0x8b65('0x193')](0x14,_0x382720,_0x536c6b)){if(_0x36a2c2[_0x8b65('0xf0')]>=_0x536c6b[_0x8b65('0x1a1')]){_0x351428[_0x8b65('0xf4')](_0x36a2c2,_0x48a3f0,_0x2fa09f,_0x8b65('0x1c0'));}else{_0x351428[_0x8b65('0x100')](_0x36a2c2,_0x48a3f0,_0x2fa09f,_0x8b65('0x1c0'));}}break;default:_0x536c6b[_0x8b65('0x106')]+=0x1;_0x36a2c2[_0x8b65('0xe0')]=0xc;_0x36a2c2[_0x8b65('0xe1')]=_0x1725c7[_0x8b65('0x1a6')];_0x351428[_0x8b65('0xc4')](_0x36a2c2)[_0x8b65('0xab')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x351428[_0x8b65('0x193')](_0x1725c7[_0x8b65('0x1a6')],_0x382720,_0x536c6b)){if(_0x36a2c2[_0x8b65('0xec')]+_0x36a2c2['countcongestionretry']+_0x36a2c2[_0x8b65('0xfe')]+_0x36a2c2[_0x8b65('0xee')]+_0x36a2c2[_0x8b65('0xff')]+_0x36a2c2[_0x8b65('0xef')]+_0x36a2c2[_0x8b65('0xe8')]+_0x36a2c2[_0x8b65('0xf0')]>=_0x536c6b['dialGlobalMaxRetry']){_0x351428[_0x8b65('0x100')](_0x36a2c2,_0x48a3f0,_0x2fa09f,_0x1725c7[_0x8b65('0x1a6')]);}else{_0x351428[_0x8b65('0xf4')](_0x36a2c2,_0x48a3f0,_0x2fa09f,_0x1725c7[_0x8b65('0x1a6')]);}}}});};Dialer[_0x8b65('0x18')][_0x8b65('0x100')]=function(_0xd97558,_0x176256,_0x2a08e1,_0xf20676){var _0x18f44c=new Final(_0xd97558);_0x18f44c[_0x8b65('0xe0')]=0xf;_0x18f44c[_0x8b65('0xe1')]=_0x8b65('0x1c1');this['createStateFinal'](_0x18f44c,_0x176256,_0x2a08e1,_0xf20676);};Dialer[_0x8b65('0x18')][_0x8b65('0xf4')]=function(_0x4fd996,_0x1ee819,_0x3341dc,_0x4bfa57){this[_0x8b65('0xc2')](_0x4fd996)['then'](function(_0x48e3a8){return _0x1ee819(msgResponse(_0x8b65('0x1a4'),_0x8b65('0x1c2'),_0x4bfa57));})[_0x8b65('0xab')](function(_0x2d8c7b){return _0x3341dc(msgResponse(_0x8b65('0x1c3'),_0x8b65('0x13f'),_0x8b65('0x1c4')));});};Dialer[_0x8b65('0x18')][_0x8b65('0x152')]=function(_0x1828dc){var _0x461282=this;var _0x1e3d46=_0x1828dc['dialPredictiveOptimizationPercentage']/0x64;var _0xc0dc75=_0x1828dc[_0x8b65('0x5f')]/(_0x1828dc[_0x8b65('0x5f')]+_0x1828dc[_0x8b65('0x5a')]);var _0x4404e9=Math['round'](_0x1828dc[_0x8b65('0x6b')]*(_0x1828dc['predictiveIntervalMaxThreshold']/0x64));var _0x314884=Math[_0x8b65('0x1c5')](_0x1828dc[_0x8b65('0x6b')]*(_0x1828dc['predictiveIntervalMinThreshold']/0x64));var _0x412cb6=_0x1828dc[_0x8b65('0x9e')]+_0x1828dc['talking'];var _0x179e68=Math[_0x8b65('0x1c6')](_0x1828dc[_0x8b65('0x6d')]*_0x1828dc[_0x8b65('0x6e')]*_0x1828dc['predictiveIntervalHitRate']*_0x1828dc[_0x8b65('0x1c7')]);if(_[_0x8b65('0x80')](_0x1828dc[_0x8b65('0x27')])){if(!_[_0x8b65('0x80')](_0x1828dc[_0x8b65('0x26')])){_0x1828dc[_0x8b65('0x26')]=undefined;loggerPredictive['error'](_0x8b65('0x1c8'),_0x8b65('0x1c9'));}if(!_[_0x8b65('0x80')](_0x1828dc['handlePredictive'])){loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0x8b65('0x1ca'));clearInterval(_0x1828dc['handlePredictive']);_0x1828dc['handlePredictive']=undefined;}_0x1828dc[_0x8b65('0x27')]=moment()[_0x8b65('0x71')](_0x8b65('0xf9'));loggerPredictive[_0x8b65('0x7a')](_0x1828dc[_0x8b65('0x40')],_0x8b65('0x1cb'),_0x1828dc[_0x8b65('0x27')]);this[_0x8b65('0x150')](_0x1828dc,0x1);}else if(ifInterval(_0x1828dc[_0x8b65('0x1cc')],_0x1828dc[_0x8b65('0x27')])){this[_0x8b65('0x150')](_0x1828dc,0x1);loggerPredictiveCalls['info']('[startMethodPredictive][StartProgressive][Loop]',_0x1828dc[_0x8b65('0x27')],_0x1828dc[_0x8b65('0x40')]);_0x1828dc['erlangCalls']=0x0;_0x1828dc[_0x8b65('0x68')]=0x0;}else if(_0x1e3d46<_0xc0dc75&&_0x1828dc[_0x8b65('0x1cd')]===_0x8b65('0x1ce')){freeVariablesPredictive(_0x1828dc);loggerPredictive['info'](_0x8b65('0x1cf'),_0x8b65('0x1d0'),_0xc0dc75,'startProgressive',_0x1828dc[_0x8b65('0x40')]);}else if(_0x179e68<_0x1828dc['predictiveIntervalErlangCallsDroppedCalls']&&_0x1828dc[_0x8b65('0x1cd')]===_0x8b65('0x1ce')){freeVariablesPredictive(_0x1828dc);loggerPredictive['info'](_0x8b65('0x1d1'),_0x8b65('0x1d2'),_0x179e68,_0x8b65('0x1d3'),_0x1828dc[_0x8b65('0x68')],_0x8b65('0x27'),_0x1828dc[_0x8b65('0x40')]);}else if(!ifInterval(_0x1828dc[_0x8b65('0x1cc')],_0x1828dc[_0x8b65('0x27')])&&_['isUndefined'](_0x1828dc['startPredictive'])&&!_[_0x8b65('0x80')](_0x1828dc[_0x8b65('0x27')])){_0x1828dc[_0x8b65('0x26')]=moment()[_0x8b65('0x71')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x8b65('0x7a')](_0x1828dc[_0x8b65('0x40')],'started\x20in\x20predictive\x20at',_0x1828dc[_0x8b65('0x26')]);this[_0x8b65('0xb8')](_0x1828dc[_0x8b65('0x1cc')])['then'](this[_0x8b65('0x1d4')](_0x1828dc))[_0x8b65('0xb2')](mergeDataErlangB(_0x1828dc))['then'](this[_0x8b65('0x1d5')](_0x1828dc))['catch'](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x1828dc));}else if(!ifInterval(_0x1828dc[_0x8b65('0x1cc')],_0x1828dc[_0x8b65('0x26')])){_0x1828dc['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x1828dc[_0x8b65('0x26')]=moment()[_0x8b65('0x71')](_0x8b65('0xf9'));loggerPredictive[_0x8b65('0x7a')](_0x1828dc[_0x8b65('0x40')],_0x8b65('0x1d6'),_0x1828dc[_0x8b65('0x26')]);clearInterval(_0x1828dc[_0x8b65('0x8b')]);_0x1828dc['handlePredictive']=undefined;this[_0x8b65('0xb8')](_0x1828dc[_0x8b65('0x1cc')])['then'](this[_0x8b65('0x1d4')](_0x1828dc))[_0x8b65('0xb2')](mergeDataErlangB(_0x1828dc))[_0x8b65('0xb2')](this[_0x8b65('0x1d5')](_0x1828dc))[_0x8b65('0xab')](loggerCatchPredictive(_0x8b65('0x1d7'),_0x1828dc));}else if(_0x1828dc[_0x8b65('0x6b')]&&_0x412cb6<_0x1828dc[_0x8b65('0x6b')]-_0x314884){freeVariablesPredictive(_0x1828dc);loggerPredictive[_0x8b65('0x7a')](_0x1828dc[_0x8b65('0x40')],_0x8b65('0x1d8'),_0x412cb6,_0x8b65('0x1d9'),_0x1828dc[_0x8b65('0x6b')],'-',_0x314884,'=',_0x1828dc[_0x8b65('0x6b')]-_0x314884,')');}else if(_0x1828dc[_0x8b65('0x6b')]&&_0x412cb6>_0x1828dc[_0x8b65('0x6b')]+_0x4404e9){freeVariablesPredictive(_0x1828dc);loggerPredictive[_0x8b65('0x7a')](_0x1828dc['name'],_0x8b65('0x1d8'),_0x412cb6,_0x8b65('0x1da'),_0x1828dc['predictiveIntervalAvailable'],'+',_0x4404e9,'=',_0x1828dc[_0x8b65('0x6b')]+_0x4404e9,')');}};Dialer['prototype']['getDataPredictive']=function(_0x21d913){var _0x862725=this;return function(_0x33331e){return new BPromise(function(_0x3f7719,_0xd10d3b){_[_0x8b65('0xca')](_0x21d913,_0x33331e[0x0]);if(checkGetDataPredictive(_0x33331e[0x0])){var _0x1dd36e=_0x21d913[_0x8b65('0x6b')]=_0x21d913[_0x8b65('0x51')]+_0x21d913[_0x8b65('0x9e')];var _0x515577=_0x21d913[_0x8b65('0x1cc')]*0x3c;var _0x3f32c6=_0x33331e[0x0][_0x8b65('0x66')]+_0x33331e[0x0][_0x8b65('0x65')];var _0x4877b2=(_0x33331e[0x0][_0x8b65('0x64')]+_0x33331e[0x0][_0x8b65('0x67')]+_0x33331e[0x0][_0x8b65('0x7c')])/_0x33331e[0x0][_0x8b65('0x6c')];_0x21d913['predictiveIntervalHitRate']=_0x4877b2>0x0?_0x4877b2:0x1;switch(_0x21d913[_0x8b65('0x1cd')]){case _0x8b65('0x1ce'):var _0x2fa119=_0x21d913[_0x8b65('0x1db')]/0x64;return _0x862725['abandonmentRate'](_0x1dd36e,_0x515577,_0x3f32c6,_0x4877b2,_0x2fa119)[_0x8b65('0xb2')](function(_0xd94ec8){return _0x3f7719(_0xd94ec8);});case'agentBusyFactor':var _0x102460=_0x21d913['dialPredictiveOptimizationPercentage']/0x64;return _0x862725[_0x8b65('0x1dc')](_0x1dd36e,_0x515577,_0x3f32c6,_0x4877b2,_0x102460)[_0x8b65('0xb2')](function(_0x57c0b7){return _0x3f7719(_0x57c0b7);});default:return _0xd10d3b(msgResponse(_0x8b65('0x1dd'),_0x8b65('0x13f'),_0x8b65('0x1de')));}}else{return _0xd10d3b(msgResponse(_0x8b65('0x1dd'),_0x8b65('0x13f'),_0x8b65('0x1df')));}});};};Dialer[_0x8b65('0x18')][_0x8b65('0x1e0')]=function(_0x35249c){var _0xaa91d3=this;return function(_0x307fc0){return new BPromise(function(_0x477772,_0xff8560){_[_0x8b65('0xca')](_0x35249c,_0x307fc0[0x0]);if(checkGetDataPredictive(_0x307fc0[0x0])){loggerPredictive[_0x8b65('0x7a')](JSON[_0x8b65('0x47')](_0x307fc0[0x0]));if(_0x35249c[_0x8b65('0x1cd')]===_0x8b65('0x1ce')){return _0xaa91d3['getVoiceQueueRtPauses'](_0x35249c['id'])[_0x8b65('0xb2')](function(_0x13c35d){var _0x35b856=_0x35249c[_0x8b65('0x4e')]-_0x13c35d[0x0]['outboundQueuePauses'];var _0x5cdffc=_0x35249c[_0x8b65('0x1cc')]*0x3c;var _0xfd5509=_0x307fc0[0x0][_0x8b65('0x66')]+_0x307fc0[0x0]['predictiveIntervalAvgHoldtime'];var _0xfa8aa6=(_0x307fc0[0x0][_0x8b65('0x64')]+_0x307fc0[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x307fc0[0x0][_0x8b65('0x7c')])/_0x307fc0[0x0][_0x8b65('0x6c')];var _0x29a725=_0x35249c[_0x8b65('0x1db')]/0x64;_0x35249c['predictiveIntervalPauses']=_0x13c35d[0x0][_0x8b65('0x1e1')]||0x0;_0x35249c['predictiveIntervalHitRate']=_0xfa8aa6>0x0?_0xfa8aa6:0x1;return _0xaa91d3[_0x8b65('0x1e2')](_0x35b856,_0x5cdffc,_0xfd5509,_0xfa8aa6,_0x29a725);})[_0x8b65('0xb2')](function(_0x163f3c){return _0x477772(_0x163f3c);})['catch'](function(_0x3231b3){return _0xff8560(msgResponse('[CatchErlangB]',_0x8b65('0x13f'),JSON[_0x8b65('0x47')](_0x3231b3)));});}if(_0x35249c[_0x8b65('0x1cd')]===_0x8b65('0x1e3')){return _0xaa91d3[_0x8b65('0xc1')](_0x35249c['id'])[_0x8b65('0xb2')](function(_0x2459b3){var _0x3b51f1=_0x35249c['loggedIn']-_0x2459b3[0x0]['outboundQueuePauses'];var _0x1210e3=_0x35249c[_0x8b65('0x1cc')]*0x3c;var _0x529469=_0x307fc0[0x0][_0x8b65('0x66')]+_0x307fc0[0x0][_0x8b65('0x65')];var _0x470a73=(_0x307fc0[0x0][_0x8b65('0x64')]+_0x307fc0[0x0][_0x8b65('0x67')]+_0x307fc0[0x0][_0x8b65('0x7c')])/_0x307fc0[0x0][_0x8b65('0x6c')];var _0x6e29f7=_0x35249c[_0x8b65('0x1db')]/0x64;_0x35249c[_0x8b65('0x6a')]=_0x2459b3[0x0][_0x8b65('0x1e1')]||0x0;_0x35249c[_0x8b65('0x69')]=_0x470a73>0x0?_0x470a73:0x1;return _0xaa91d3[_0x8b65('0x1dc')](_0x3b51f1,_0x1210e3,_0x529469,_0x470a73,_0x6e29f7);})[_0x8b65('0xb2')](function(_0x118617){return _0x477772(_0x118617);})['catch'](function(_0x38eeb2){return _0xff8560(msgResponse(_0x8b65('0x1e4'),_0x8b65('0x13f'),JSON['stringify'](_0x38eeb2)));});}}else{return _0xff8560(msgResponse(_0x8b65('0x1dd'),_0x8b65('0x13f'),_0x8b65('0x1df')));}});};};Dialer[_0x8b65('0x18')]['startMethodPredictive']=function(_0x2b0d5f){var _0x31c6cc=this;return function(){var _0xd33f73=0x0;var _0x3efb7e=Math[_0x8b65('0x1c6')](_0x2b0d5f['erlangCallToSecond']*0x3e8);if(_0x3efb7e>0x0){_0x3efb7e=_0x3efb7e<0x64?0x64:_0x3efb7e;loggerPredictive['info'](_0x2b0d5f[_0x8b65('0x40')],_0x8b65('0x1e5'),_0x3efb7e,_0x8b65('0x48'));_0x2b0d5f[_0x8b65('0x8b')]=setInterval(function(){_0x31c6cc['handlePredictive'](_0x2b0d5f);loggerPredictiveCalls[_0x8b65('0x7a')](_0x8b65('0x1e6'),_0xd33f73+=0x1);},_0x3efb7e);}else{loggerPredictive[_0x8b65('0x7a')](_0x2b0d5f[_0x8b65('0x40')],_0x8b65('0x1e7'));}};};Dialer[_0x8b65('0x18')][_0x8b65('0x1e8')]=function(_0x3f68ba,_0x4b163c){var _0x5dab0d=this;return function(_0x371e34){if(_['isEmpty'](_0x371e34)){if(_[_0x8b65('0xa9')](_0x4b163c['UserId'])||!_0x4b163c['recallme']){if(_0x3f68ba[_0x8b65('0x56')]===_0x8b65('0x153')){_0x3f68ba['queueStatusComplete']=_[_0x8b65('0x80')](_0x3f68ba['queueStatusComplete'])?!![]:_0x3f68ba['queueStatusComplete'];var _0x546ba2=uuid['v4']();_0x5dab0d['actions'][_0x546ba2]=new Action(_0x3f68ba,_0x4b163c,_0x546ba2);loggerBooked[_0x8b65('0x7a')](_0x8b65('0x1e9'),_0x546ba2,_0x8b65('0x1ea'),JSON[_0x8b65('0x47')](_0x3f68ba[_0x8b65('0x128')]),_0x8b65('0x1eb'),_0x3f68ba['name']);if(_0x3f68ba[_0x8b65('0x128')]){_0x3f68ba[_0x8b65('0x128')]=![];_0x5dab0d[_0x8b65('0x124')][_0x5dab0d[_0x8b65('0x22')][_0x546ba2]['queue']]=[];ami['Action']({'actionid':_0x546ba2,'action':_0x8b65('0x1ec'),'queue':_0x3f68ba[_0x8b65('0x40')]})['catch'](function(_0x3252e7){_0x5dab0d[_0x8b65('0xaf')](_0x3f68ba);_0x5dab0d[_0x8b65('0xba')]({'active':![],'ContactId':_0x5dab0d[_0x8b65('0x22')][_0x546ba2][_0x8b65('0xcb')],'ListId':_0x5dab0d[_0x8b65('0x22')][_0x546ba2][_0x8b65('0xcc')],'VoiceQueueId':_0x5dab0d[_0x8b65('0x22')][_0x546ba2][_0x8b65('0xce')]||undefined,'CampaignId':_0x5dab0d[_0x8b65('0x22')][_0x546ba2][_0x8b65('0xcf')]||undefined})[_0x8b65('0xab')](loggerCatch(_0x8b65('0x1ed')));delete _0x5dab0d[_0x8b65('0x22')][_0x546ba2];});}else{loggerBooked[_0x8b65('0x7a')](_0x8b65('0x1ee'),JSON[_0x8b65('0x47')](_0x3f68ba['queueStatusComplete']),'Queue:\x20',_0x3f68ba[_0x8b65('0x40')]);_0x5dab0d[_0x8b65('0xaf')](_0x3f68ba);_0x5dab0d[_0x8b65('0xba')]({'active':![],'ContactId':_0x5dab0d[_0x8b65('0x22')][_0x546ba2][_0x8b65('0xcb')],'ListId':_0x5dab0d[_0x8b65('0x22')][_0x546ba2][_0x8b65('0xcc')],'VoiceQueueId':_0x5dab0d[_0x8b65('0x22')][_0x546ba2]['VoiceQueueId']||undefined,'CampaignId':_0x5dab0d[_0x8b65('0x22')][_0x546ba2][_0x8b65('0xcf')]||undefined})[_0x8b65('0xab')](loggerCatch(_0x8b65('0x1ed')));delete _0x5dab0d[_0x8b65('0x22')][_0x546ba2];}}else{return _0x5dab0d['actionOriginate'](_0x3f68ba,_0x4b163c);}}else{if(getDiff(_0x4b163c[_0x8b65('0x1ef')])<_0x3f68ba['dialRecallMeTimeout']*0x3c){if(_0x4b163c[_0x8b65('0x1f0')]&&!_0x4b163c['Agent'][_0x8b65('0x1f1')]){_0x5dab0d[_0x8b65('0x1b')][_0x8b65('0x12a')](_0x4b163c['id'])[_0x8b65('0x12c')](function(){_0x5dab0d[_0x8b65('0xaf')](_0x3f68ba);});}else{_0x5dab0d['unlockContact']({'active':![]},_0x4b163c['id'],0x1)[_0x8b65('0x12c')](function(){console['log'](_0x8b65('0x1f2'));_0x5dab0d[_0x8b65('0xaf')](_0x3f68ba);});}}else{_0x3f68ba[_0x8b65('0x63')]+=0x1;_0x5dab0d[_0x8b65('0xaf')](_0x3f68ba);if(_0x3f68ba[_0x8b65('0x1f3')]){_0x5dab0d[_0x8b65('0xba')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4b163c[_0x8b65('0xcb')],'ListId':_0x4b163c[_0x8b65('0xcc')],'VoiceQueueId':_0x4b163c[_0x8b65('0xce')]||undefined,'CampaignId':_0x4b163c['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x5dab0d[_0x8b65('0xc4')](createObjHistory(_0x3f68ba,_0x4b163c,_0x8b65('0x1f4'),0x17,'RecallInQueue'))['catch'](loggerCatch(_0x8b65('0x1f5')));}else{_0x5dab0d[_0x8b65('0xc9')](createObjHistory(_0x3f68ba,_0x4b163c,_0x8b65('0x1f6'),0x16,_0x8b65('0x1f7')),_0x8b65('0x1f8'),_0x8b65('0x1f9'));}}}}else{_0x3f68ba[_0x8b65('0x5b')]+=0x1;_0x5dab0d[_0x8b65('0xc9')](createObjHistory(_0x3f68ba,_0x4b163c,_0x8b65('0x1fa'),0xd,_0x8b65('0x1fb')),_0x8b65('0x1fc'),'[Originate][MoveBlacklist]');throw'inBlackList';}};};Dialer['prototype']['handleIvr']=function(_0x4bdcb9){var _0x3f2c26=this;var _0x410554=[];var _0x523d78=_0x4bdcb9['limitCalls']-_0x4bdcb9[_0x8b65('0x95')]-_0x4bdcb9[_0x8b65('0x1fd')];emitCampaignSummary(_0x4bdcb9);if(_0x523d78>0x0){if(_0x523d78>this['maxNumberOriginate']){_0x523d78=this[_0x8b65('0x20')];}_0x4bdcb9['temp']+=_0x523d78;this[_0x8b65('0xc0')](_0x4bdcb9['id'],_0x523d78,_0x4bdcb9[_0x8b65('0x1fe')])[_0x8b65('0xb2')](function(_0x4a0801){_0x4bdcb9[_0x8b65('0x1fd')]-=_0x523d78;_0x4bdcb9[_0x8b65('0x1fd')]=_0x4bdcb9['temp']>0x0?_0x4bdcb9[_0x8b65('0x1fd')]:0x0;if(!checkContactEmpty(_0x4a0801)){_0x4bdcb9[_0x8b65('0x3c')]=_0x8b65('0x9a');logger[_0x8b65('0x7a')](_0x8b65('0x1ff')+_0x4bdcb9[_0x8b65('0x40')]);}else{_0x4bdcb9[_0x8b65('0x95')]+=_0x4a0801[_0x8b65('0x93')];_0x4bdcb9[_0x8b65('0x3c')]=_0x8b65('0x200');for(var _0x284a1a=0x0;_0x284a1a<_0x4a0801[_0x8b65('0x93')];_0x284a1a+=0x1){_0x4bdcb9[_0x8b65('0x201')]+=0x1;if(_['isNil'](_0x4a0801[_0x284a1a])||_[_0x8b65('0xa9')](_0x4a0801[_0x284a1a][_0x8b65('0x165')])||_[_0x8b65('0xa9')](_0x4a0801[_0x284a1a][_0x8b65('0x165')]['phone'])){_0x3f2c26['emptyContact'](_0x8b65('0x202'),_0x4bdcb9,_0x4a0801[_0x284a1a]);}else{_0x3f2c26[_0x8b65('0xb7')](_['pick'](_0x4a0801[_0x284a1a],['CampaignId',_0x8b65('0x203')]))[_0x8b65('0xb2')](_0x3f2c26[_0x8b65('0x1e8')](_0x4bdcb9,_0x4a0801[_0x284a1a]))[_0x8b65('0xab')](_0x3f2c26['loggerHandler'](_0x8b65('0x204'),_0x4bdcb9));}}}})[_0x8b65('0xab')](loggerGetContactDialer(_0x8b65('0x205'),_0x4bdcb9,_0x523d78));}};Dialer[_0x8b65('0x18')][_0x8b65('0x150')]=function(_0x5cfb17,_0xad5606){var _0x1f0d8e=this;var _0x3ceb10=[];var _0x5dec86=_0xad5606>=0x1?_0xad5606:0x1;var _0x3069fc=[];if(_0x5cfb17['dialMethod']===_0x8b65('0x153')){_0x5dec86=0x1;}var _0x34d841=Math[_0x8b65('0x1c6')](_0x5cfb17['available']*_0x5dec86)-_0x5cfb17['originated']-_0x5cfb17['temp'];emitVoiceQueueSummary(_0x5cfb17);if(_0x5cfb17[_0x8b65('0x206')]>0x0){var _0x585639=_0x5cfb17['dialLimitQueue']-_0x5cfb17['originated']-_0x5cfb17['talking']-_0x5cfb17[_0x8b65('0x1fd')]-_0x5cfb17['pTalking'];if(_0x34d841>_0x585639){_0x34d841=_0x585639;}}if(_0x34d841>0x0){if(_0x5cfb17[_0x8b65('0x56')]===_0x8b65('0x153')){_0x34d841=0x1;}if(_0x34d841>this[_0x8b65('0x20')]){_0x34d841=this[_0x8b65('0x20')];}_0x5cfb17['temp']+=_0x34d841;for(var _0x503ecb in this[_0x8b65('0x1e')]){if(this['agents'][_0x8b65('0x94')](_0x503ecb)){if(this[_0x8b65('0x1e')][_0x503ecb][_0x8b65('0xe0')]===_0x8b65('0x207')&&this['agents'][_0x503ecb][_0x8b65('0xd4')]===_0x8b65('0xd5')){_0x3ceb10[_0x8b65('0x125')](this[_0x8b65('0x1e')][_0x503ecb]['id']);}}}this[_0x8b65('0xbe')](_0x5cfb17['id'],_0x3ceb10,_0x34d841,_0x5cfb17[_0x8b65('0x1fe')])['then'](function(_0x1af58b){_0x5cfb17[_0x8b65('0x1fd')]-=_0x34d841;_0x5cfb17['temp']=_0x5cfb17[_0x8b65('0x1fd')]>0x0?_0x5cfb17[_0x8b65('0x1fd')]:0x0;if(!checkContactEmpty(_0x1af58b)){_0x1f0d8e[_0x8b65('0xb1')](_0x5cfb17)[_0x8b65('0xb2')](sendMessageReschedule(_0x5cfb17))[_0x8b65('0xab')](loggerCatch(_0x8b65('0xb3')));}else{_0x5cfb17['originated']+=_0x1af58b[_0x8b65('0x93')];_0x5cfb17[_0x8b65('0x3c')]=_0x5cfb17['dialMethod']===_0x8b65('0x153')?_0x8b65('0x16e'):_0x8b65('0x200');for(var _0x2286c1=0x0;_0x2286c1<_0x1af58b[_0x8b65('0x93')];_0x2286c1+=0x1){if(_[_0x8b65('0xa9')](_0x1af58b[_0x2286c1])||_[_0x8b65('0xa9')](_0x1af58b[_0x2286c1]['Contact'])||_[_0x8b65('0xa9')](_0x1af58b[_0x2286c1][_0x8b65('0x165')][_0x8b65('0x166')])){_0x1f0d8e['emptyContact']('[actionOriginate]\x20',_0x5cfb17,_0x1af58b[_0x2286c1]);}else{_0x1f0d8e[_0x8b65('0xb5')](_['pick'](_0x1af58b[_0x2286c1],['VoiceQueueId','Contact.phone']))[_0x8b65('0xb2')](_0x1f0d8e['checkContactBlack'](_0x5cfb17,_0x1af58b[_0x2286c1]))[_0x8b65('0xab')](_0x1f0d8e['loggerHandler']('[actionOriginate]\x20',_0x5cfb17));}}}})[_0x8b65('0xab')](loggerGetContactDialer(_0x8b65('0x208'),_0x5cfb17,_0x34d841));}};Dialer[_0x8b65('0x18')][_0x8b65('0x8b')]=function(_0x2f30de){var _0x502294=this;if(_0x2f30de[_0x8b65('0x206')]>0x0){var _0x3ace0c=_0x2f30de[_0x8b65('0x206')]-_0x2f30de[_0x8b65('0x95')]-_0x2f30de[_0x8b65('0x51')];if(_0x3ace0c>0x0){this[_0x8b65('0x209')](_0x2f30de);}else{loggerPredictiveCalls[_0x8b65('0x7a')]('[handlePredictive][limitChannel]');}}else{this[_0x8b65('0x209')](_0x2f30de);}};Dialer[_0x8b65('0x18')]['tryOriginatePredictive']=function(_0x282abb){var _0x9a0a46=this;var _0x5eb7c3=[];_0x282abb['originated']+=0x1;for(var _0x390da6 in this[_0x8b65('0x1e')]){if(this[_0x8b65('0x1e')][_0x8b65('0x94')](_0x390da6)){if(this['agents'][_0x390da6][_0x8b65('0xe0')]===_0x8b65('0x207')&&this['agents'][_0x390da6]['status']===_0x8b65('0xd5')){_0x5eb7c3[_0x8b65('0x125')](this['agents'][_0x390da6]['id']);}}}this[_0x8b65('0xbe')](_0x282abb['id'],_0x5eb7c3,0x1,_0x282abb['dialOrderByScheduledAt'])[_0x8b65('0xb2')](function(_0x5bb096){if(!checkContactEmpty(_0x5bb096)){checkContactLowerLimitOriginate(_0x282abb,0x1,0x0);_0x9a0a46[_0x8b65('0xb1')](_0x282abb)['then'](sendMessageReschedule(_0x282abb))[_0x8b65('0xab')](loggerCatch(_0x8b65('0xb3')));}else{_0x282abb['message']=_0x8b65('0x200');if(_[_0x8b65('0xa9')](_0x5bb096[0x0])||_[_0x8b65('0xa9')](_0x5bb096[0x0][_0x8b65('0x165')])||_['isNil'](_0x5bb096[0x0][_0x8b65('0x165')][_0x8b65('0x166')])){_0x9a0a46[_0x8b65('0xc8')](_0x8b65('0x202'),_0x282abb,_0x5bb096[0x0]);}else{_0x9a0a46[_0x8b65('0xb5')](_[_0x8b65('0x126')](_0x5bb096[0x0],[_0x8b65('0xce'),_0x8b65('0x203')]))[_0x8b65('0xb2')](_0x9a0a46['checkContactBlack'](_0x282abb,_0x5bb096[0x0]))[_0x8b65('0xab')](_0x9a0a46[_0x8b65('0xc7')](_0x8b65('0x20a'),_0x282abb));}}})['catch'](loggerGetContactDialer('[getContactDialerPredictive]',_0x282abb,0x1));emitVoiceQueueSummary(_0x282abb);};Dialer[_0x8b65('0x18')][_0x8b65('0x1e2')]=function(_0xc8736a,_0x50a97b,_0x54719a,_0x413c93,_0x184c5c,_0x3042a2){loggerPredictive['info'](_0x8b65('0x20b'));loggerPredictive['info'](_0x8b65('0x20c'),_0xc8736a);loggerPredictive[_0x8b65('0x7a')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x50a97b);loggerPredictive[_0x8b65('0x7a')](_0x8b65('0x20d'),_0x54719a);loggerPredictive['info']('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x413c93);loggerPredictive[_0x8b65('0x7a')](_0x8b65('0x20e'),_0x184c5c);loggerPredictive[_0x8b65('0x7a')]('---------------------------');return new BPromise(function(_0x1d7263,_0x1018b5){if(_0xc8736a<=0x0||isNaN(_0xc8736a)){return _0x1018b5(msgResponse(_0x8b65('0x20f'),'Error',_0x8b65('0x210')+_0xc8736a));}if(_0x54719a<=0x0||isNaN(_0x54719a)){return _0x1018b5(msgResponse(_0x8b65('0x20f'),_0x8b65('0x46'),_0x8b65('0x211')+_0x54719a));}if(_0x413c93<=0x0||isNaN(_0x413c93)){return _0x1018b5(msgResponse('[abandonmentRate]','Error','p\x20=\x20'+_0x413c93));}if(_0x50a97b<=0x0||isNaN(_0x50a97b)){return _0x1018b5(msgResponse('[abandonmentRate]',_0x8b65('0x46'),'interval\x20=\x20'+_0x50a97b));}if(_0x184c5c<=0x0||isNaN(_0x184c5c)){return _0x1018b5(msgResponse(_0x8b65('0x20f'),'Error','Amax\x20=\x20'+_0x184c5c));}_0x3042a2=_0x3042a2||0x0;var _0x6ebfe9=0x1/_0x54719a;var _0x128150=0x0;var _0x3a0037=0x0;var _0x56ab72=0x0;var _0x34973e=0x0;for(var _0x470d3a=0x0;_0x56ab72<_0x184c5c;_0x470d3a+=0x1){_0x3a0037=_0x470d3a/_0x50a97b;_0x128150=(_0x413c93*_0x3a0037+_0x3042a2)/_0x6ebfe9;_0x56ab72=erlangb(_0x128150,_0xc8736a);_0x34973e=_0x128150/_0xc8736a*(0x1-erlangb(_0x128150,_0xc8736a));}return _0x1d7263({'erlangCalls':_0x470d3a,'erlangCallToSecond':_0x50a97b/_0x470d3a,'erlangAbandonmentRate':_0x56ab72,'erlangBusyFactor':_0x34973e});});};Dialer[_0x8b65('0x18')][_0x8b65('0x1dc')]=function(_0x59080a,_0x50e0fa,_0x343900,_0x396a3d,_0x4abe87,_0x1ff011){loggerPredictive[_0x8b65('0x7a')](_0x8b65('0x212'));loggerPredictive[_0x8b65('0x7a')](_0x8b65('0x20c'),_0x59080a);loggerPredictive[_0x8b65('0x7a')](_0x8b65('0x213'),_0x50e0fa);loggerPredictive[_0x8b65('0x7a')](_0x8b65('0x20d'),_0x343900);loggerPredictive['info'](_0x8b65('0x214'),_0x396a3d);loggerPredictive[_0x8b65('0x7a')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4abe87);loggerPredictive['info'](_0x8b65('0x7f'));return new BPromise(function(_0x93079,_0x38255b){if(_0x59080a<=0x0||isNaN(_0x59080a)){return _0x38255b(msgResponse(_0x8b65('0x215'),_0x8b65('0x46'),_0x8b65('0x210')+_0x59080a));}if(_0x343900<=0x0||isNaN(_0x343900)){return _0x38255b(msgResponse(_0x8b65('0x215'),_0x8b65('0x46'),_0x8b65('0x211')+_0x343900));}if(_0x396a3d<=0x0||isNaN(_0x396a3d)){return _0x38255b(msgResponse('[busyFactor]',_0x8b65('0x46'),_0x8b65('0x216')+_0x396a3d));}if(_0x50e0fa<=0x0||isNaN(_0x50e0fa)){return _0x38255b(msgResponse(_0x8b65('0x215'),'Error',_0x8b65('0x217')+_0x50e0fa));}if(_0x4abe87<=0x0||isNaN(_0x4abe87)){return _0x38255b(msgResponse(_0x8b65('0x215'),_0x8b65('0x46'),_0x8b65('0x218')+_0x4abe87));}_0x1ff011=_0x1ff011||0x0;var _0x201ed4=0x1/_0x343900;var _0xca7b6e=0x0;var _0x1e6b71=0x0;var _0x2ee683=0x0;var _0x34bb3e=0x0;for(var _0x249533=0x0;_0x34bb3e<_0x4abe87;_0x249533+=0x1){_0x1e6b71=_0x249533/_0x50e0fa;_0xca7b6e=(_0x396a3d*_0x1e6b71+_0x1ff011)/_0x201ed4;_0x2ee683=erlangb(_0xca7b6e,_0x59080a);_0x34bb3e=_0xca7b6e/_0x59080a*(0x1-erlangb(_0xca7b6e,_0x59080a));}return _0x93079({'erlangCalls':_0x249533,'erlangCallToSecond':_0x50e0fa/_0x249533,'erlangAbandonmentRate':_0x2ee683,'erlangBusyFactor':_0x34bb3e});});};module[_0x8b65('0x219')]=Dialer; \ No newline at end of file +var _0x01e4=['Intervals','INTERVAL_IS_NULL','Error','stringify','milliseconds','diff','emit','type','outbound','answered','loggedIn','pTalking','sumDuration','talking','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','callerid','voice:queue:%s','voice_queue:save','campaign:ivr:%s','campaign:save','info','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','seconds','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','ivr','string','isEmpty','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','clearZombieChannels','actions','[actions]','hasOwnProperty','sequence','isNil','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','merge','pick','ContactId','ListId','UserId','VoiceQueueId','[emptyContact][createHistory]','[emptyContact]','isSuccess','active','format','SIP/%s','reachable','unmonitored','saveInDb','uniqueid','variable','amdstatus','exten','value','HANGUP','membername','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','countglobal','amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','CampaignId','dialAMDActive','AMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[syncAgentComplete][createHistory][0]','countdropretry','reason19\x20machine....','createStateFinal','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr]','cause-txt','Unknow','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','answertime','queueCallerAbandonCreateState','syncQueueCallerAbandon','droptime','dialQueueTimeout','dropreason','TIMEOUT','dialDropMaxRetry','[rescheduleContact][Drop]','Drop','starttime','endtime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','CALLEREXIT','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','strategy','roundrobin','locked','paused','stateinterface','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','length','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock2]','[booked][unlock3]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','interval','content','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','power','handlePower','method\x20not\x20recognized','launchHandleIvr','handleIvr','checkIfTime','dialGlobalInterval','dialTimezone','[syncCampaigns]','pow','replace','random','match','actionOriginate','object','originate','phone','Contact','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialer','ACTIVE','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','%s%s','XMD-','toUpper','isTrunkReachable','dialRandomLastDigitCallerIdNumber','originatecalleridnum','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','responsetime','getQueue','response','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','callProgressDetecting','[callProgressDetecting]','evt\x20is\x20undefine','log','EMITTING\x20status_nosuchnumber\x20for','buildObj','nosuchnumber','custom:status_nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','NO\x20ANSWER\x20evt','NO\x20ANSWER\x20action','NO\x20ANSWER\x20entity','NO\x20ANSWER\x20history','EMITTING\x20status_noanswer\x20for','noanswer','custom:status_noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','EMITTING\x20status_busy\x20for','busy','custom:status_busy','reason\x205\x20busy','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','Abandoned','reason\x2011\x20abandoned','AgentReject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Success','[moveContactManagedDialer][0]','contact\x20not\x20moved','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','available','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','started\x20in\x20predictive\x20at','getDataPredictive','recalculate\x20predictive\x20at','startMethodPredictive','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','outboundQueuePauses','dialPredictiveOptimizationPercentage','abandonmentRate','[CatchErlangB]','check\x20failure','one\x20call\x20every:','[handlePredictive]','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','Agent','voicePause','Contact\x20updated','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','limitCalls','temp','ivrTotalCallsDays','emptyContact','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','dialOrderByScheduledAt','[countReScheduled]\x20','RUNNING','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','[actionOriginate]\x20','checkContactBlack','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','Umin\x20=\x20','util','lodash','uuid','md5','ioredis','../preview/util/util','../../../config/logger','booked','predictive','syncQueueSummary','../ami','redis','defaults','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./hangup','env','XCALLY_IP_AGI','rrmemory','prototype','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','syncVarSet','queuemember','syncQueueMember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','name','\x20AGENTS\x20NOT\x20LOGGED','\x20NOT\x20Active','Interval','\x20INTERVAL_IS_NULL'];(function(_0x2f58c4,_0x329d7d){var _0x11dbca=function(_0x30be00){while(--_0x30be00){_0x2f58c4['push'](_0x2f58c4['shift']());}};_0x11dbca(++_0x329d7d);}(_0x01e4,0x1dd));var _0x401e=function(_0x1468e3,_0x35b82e){_0x1468e3=_0x1468e3-0x0;var _0x57c1f4=_0x01e4[_0x1468e3];return _0x57c1f4;};'use strict';var util=require(_0x401e('0x0'));var _=require(_0x401e('0x1'));var BPromise=require('bluebird');var uuid=require(_0x401e('0x2'));var moment=require('moment');var rr=require('rr');var md5=require(_0x401e('0x3'));var Redis=require(_0x401e('0x4'));var ut=require(_0x401e('0x5'));var config=require('../../../config/environment/');var logger=require('../../../config/logger')('dialer');var loggerBooked=require(_0x401e('0x6'))(_0x401e('0x7'));var loggerPredictive=require(_0x401e('0x6'))(_0x401e('0x8'));var loggerPredictiveCalls=require(_0x401e('0x6'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x401e('0x6'))(_0x401e('0x9'));var ami=require(_0x401e('0xa'));config[_0x401e('0xb')]=_[_0x401e('0xc')](config[_0x401e('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0x401e('0xd'))(new Redis(config['redis']));var cmHopper=require(_0x401e('0xe'));var cmHopperFinal=require(_0x401e('0xf'));var cmHopperHistory=require(_0x401e('0x10'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x401e('0x11'));var Action=require(_0x401e('0x12'));var History=require(_0x401e('0x13'));var Final=require(_0x401e('0x14'));var AgentComplete=require(_0x401e('0x15'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0x401e('0x16'));var ipAgi=process[_0x401e('0x17')][_0x401e('0x18')]||'127.0.0.1';var strategy={'rrmemory':_0x401e('0x19'),'roundrobin':'roundrobin'};var Sequence=function(){};Sequence[_0x401e('0x1a')][_0x401e('0x1b')]=function(_0x4ae4ed){this['tail']=this['tail']?this[_0x401e('0x1c')][_0x401e('0x1d')](_0x4ae4ed):_0x4ae4ed();};function Dialer(_0x1248d2,_0x25acb0){this['sequence']=new Sequence();this[_0x401e('0x1e')]=_0x25acb0;this['voiceQueues']=_0x1248d2[_0x401e('0x1f')];this[_0x401e('0x20')]=_0x1248d2[_0x401e('0x20')];this[_0x401e('0x21')]=_0x1248d2[_0x401e('0x21')];this[_0x401e('0x22')]=_0x1248d2[_0x401e('0x22')];this[_0x401e('0x23')]=config[_0x401e('0x23')]||0x2;this[_0x401e('0x24')]={};this['actions']={};this[_0x401e('0x25')]={};this[_0x401e('0x26')]={};this[_0x401e('0x27')]={};this[_0x401e('0x28')]={};this[_0x401e('0x29')]={};this[_0x401e('0x2a')]={};this[_0x401e('0x2b')]={};this['queueBookedRR']={};ami['on'](_0x401e('0x2c'),this[_0x401e('0x2d')][_0x401e('0x2e')](this));ami['on'](_0x401e('0x2f'),this['syncQueueCallerAbandon'][_0x401e('0x2e')](this));ami['on']('originateresponse',this[_0x401e('0x30')][_0x401e('0x2e')](this));ami['on'](_0x401e('0x31'),this[_0x401e('0x32')]['bind'](this));ami['on'](_0x401e('0x33'),this['syncQueueSummary'][_0x401e('0x2e')](this));ami['on'](_0x401e('0x34'),this[_0x401e('0x35')][_0x401e('0x2e')](this));ami['on'](_0x401e('0x36'),this[_0x401e('0x37')][_0x401e('0x2e')](this));ami['on']('varset',this[_0x401e('0x38')][_0x401e('0x2e')](this));ami['on'](_0x401e('0x39'),this[_0x401e('0x3a')][_0x401e('0x2e')](this));ami['on']('queuestatuscomplete',this[_0x401e('0x3b')][_0x401e('0x2e')](this));this[_0x401e('0x3c')]();this[_0x401e('0x3d')]();}function isNotNull(_0x584211){return _0x584211!==null&&!_[_0x401e('0x3e')](_0x584211);}function checkIsLoggedIn(_0x4a456f,_0x5e0b6f){return function(){if(_0x5e0b6f<=0x0){_0x4a456f[_0x401e('0x3f')]='AGENTS_NOT_LOGGED';throw _0x4a456f[_0x401e('0x40')]+_0x401e('0x41');}};}function isActive(_0x8f34de){return _0x8f34de;}function checkIsActive(_0x11fe3d,_0x2514b7){return function(){if(!isActive(_0x2514b7)){_0x11fe3d[_0x401e('0x3f')]='NOT_ACTIVE';throw _0x11fe3d['name']+_0x401e('0x42');}};}function checkInterval(_0x2e68be){return function(){if(!isNotNull(_0x2e68be[_0x401e('0x43')])){_0x2e68be[_0x401e('0x3f')]='INTERVAL_IS_NULL';throw _0x2e68be[_0x401e('0x40')]+_0x401e('0x44');}if(!isNotNull(_0x2e68be[_0x401e('0x43')][_0x401e('0x45')])){_0x2e68be[_0x401e('0x3f')]=_0x401e('0x46');throw _0x2e68be[_0x401e('0x40')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_['isEmpty'](_0x2e68be[_0x401e('0x43')]['Intervals']))){_0x2e68be[_0x401e('0x3f')]=_0x401e('0x46');throw _0x2e68be[_0x401e('0x40')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x301eb6,_0x3b5207,_0x15c137){return{'action':_0x301eb6,'response':_0x3b5207,'message':_0x15c137,'stack':_0x15c137};}function myreject(_0x46cd0d){return function(_0x235078){return _0x46cd0d(msgResponse('[ifTime][Action]',_0x401e('0x47'),JSON[_0x401e('0x48')](_0x235078)));};}function getSeconds(_0x1d9527,_0x1ded83){var _0x58b006=moment(_0x1d9527)[_0x401e('0x49')](0x0);var _0x17f4b2=moment(_0x1ded83)[_0x401e('0x49')](0x0);return _0x58b006[_0x401e('0x4a')](_0x17f4b2,'seconds');}function emit(_0x4d510d,_0x3bf99d,_0x296acb){io['to'](_0x4d510d)[_0x401e('0x4b')](_0x3bf99d,_0x296acb);}function emitVoiceQueueSummary(_0x208ac2){if(_0x208ac2[_0x401e('0x4c')]===_0x401e('0x4d')){var _0x233122={'id':_0x208ac2['id'],'name':_0x208ac2[_0x401e('0x40')],'strategy':_0x208ac2['strategy'],'answered':_0x208ac2[_0x401e('0x4e')],'available':_0x208ac2['available'],'loggedIn':_0x208ac2[_0x401e('0x4f')],'pTalking':_0x208ac2[_0x401e('0x50')],'sumBillable':_0x208ac2['sumBillable'],'sumDuration':_0x208ac2[_0x401e('0x51')],'sumHoldTime':_0x208ac2['sumHoldTime']||0x0,'talking':_0x208ac2[_0x401e('0x52')],'total':_0x208ac2['total'],'type':_0x208ac2['type'],'unmanaged':_0x208ac2[_0x401e('0x53')],'abandoned':_0x208ac2[_0x401e('0x54')],'waiting':_0x208ac2[_0x401e('0x55')],'loggedInDb':_0x208ac2[_0x401e('0x56')],'dialActive':_0x208ac2[_0x401e('0x57')],'dialMethod':_0x208ac2[_0x401e('0x58')],'dialOriginateCallerIdName':_0x208ac2[_0x401e('0x59')],'dialOriginateCallerIdNumber':_0x208ac2[_0x401e('0x5a')],'dialOriginateTimeout':_0x208ac2[_0x401e('0x5b')],'dialPrefix':_0x208ac2['dialPrefix'],'outboundAnswerAgiCallsDay':_0x208ac2[_0x401e('0x5c')],'outboundAnswerCallsDay':_0x208ac2[_0x401e('0x5d')],'outboundBlacklistCallsDay':_0x208ac2[_0x401e('0x5e')],'outboundBusyCallsDay':_0x208ac2[_0x401e('0x5f')],'outboundCongestionCallsDay':_0x208ac2[_0x401e('0x60')],'outboundDropCallsDayACS':_0x208ac2[_0x401e('0x61')],'outboundDropCallsDayCallersExit':_0x208ac2[_0x401e('0x62')],'outboundDropCallsDayTimeout':_0x208ac2[_0x401e('0x63')],'outboundNoAnswerCallsDay':_0x208ac2[_0x401e('0x64')],'outboundNoSuchCallsDay':_0x208ac2[_0x401e('0x65')],'outboundOriginateFailureCallsDay':_0x208ac2[_0x401e('0x66')],'outboundReCallsDay':_0x208ac2[_0x401e('0x67')],'outboundRejectCallsDay':_0x208ac2[_0x401e('0x68')],'outboundUnknownCallsDay':_0x208ac2[_0x401e('0x69')],'predictiveIntervalAnsweredCalls':_0x208ac2['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x208ac2['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x208ac2[_0x401e('0x6a')],'predictiveIntervalDroppedCallsCallersExit':_0x208ac2[_0x401e('0x6b')],'predictiveIntervalDroppedCallsTimeout':_0x208ac2[_0x401e('0x6c')],'predictiveIntervalErlangCalls':_0x208ac2['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x208ac2[_0x401e('0x6d')],'predictiveIntervalHitRate':_0x208ac2[_0x401e('0x6e')],'predictiveIntervalMultiplicativeFactor':_0x208ac2[_0x401e('0x6f')],'predictiveIntervalPauses':_0x208ac2[_0x401e('0x70')],'predictiveIntervalAvailable':_0x208ac2[_0x401e('0x71')],'predictiveIntervalTotalCalls':_0x208ac2[_0x401e('0x72')],'message':_0x208ac2[_0x401e('0x3f')],'originated':_0x208ac2[_0x401e('0x73')],'erlangCalls':_0x208ac2['erlangCalls'],'erlangCallToSecond':_0x208ac2[_0x401e('0x74')],'erlangAbandonmentRate':_0x208ac2[_0x401e('0x75')],'erlangBusyFactor':_0x208ac2[_0x401e('0x76')],'startPredictive':_0x208ac2[_0x401e('0x28')],'startProgressive':_0x208ac2[_0x401e('0x29')]};if(_0x208ac2[_0x401e('0x77')]){_0x233122['Trunk']={'id':_0x208ac2[_0x401e('0x77')]['id'],'name':_0x208ac2[_0x401e('0x77')]['name'],'active':_0x208ac2[_0x401e('0x77')]['active'],'callerid':_0x208ac2['Trunk'][_0x401e('0x78')]};}if(_0x208ac2['Interval']){_0x233122[_0x401e('0x43')]={'id':_0x208ac2[_0x401e('0x43')]['id'],'name':_0x208ac2[_0x401e('0x43')][_0x401e('0x40')]};}var _0x29e07e=md5(JSON[_0x401e('0x48')](_0x233122));if(_0x208ac2[_0x401e('0x3')]!==_0x29e07e){_0x208ac2[_0x401e('0x3')]=_0x29e07e;emit(util['format'](_0x401e('0x79'),_0x233122[_0x401e('0x40')]),_0x401e('0x7a'),_0x233122);}}}function emitCampaignSummary(_0x239e32){if(_0x239e32[_0x401e('0x4c')]==='ivr'){emit(util['format'](_0x401e('0x7b'),_0x239e32[_0x401e('0x40')]),_0x401e('0x7c'),_0x239e32);}}function checkGetDataPredictive(_0x338ca1){if(isNotNull(_0x338ca1)){if(!_['isEmpty'](_0x338ca1)){loggerPredictive[_0x401e('0x7d')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive['info']('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x338ca1[_0x401e('0x72')]);loggerPredictive[_0x401e('0x7d')](_0x401e('0x7e'),_0x338ca1[_0x401e('0x7f')]);loggerPredictive['info'](_0x401e('0x80'),_0x338ca1[_0x401e('0x6c')]);loggerPredictive[_0x401e('0x7d')](_0x401e('0x81'),_0x338ca1[_0x401e('0x6b')]);loggerPredictive[_0x401e('0x7d')](_0x401e('0x82'),_0x338ca1[_0x401e('0x83')]);loggerPredictive['info'](_0x401e('0x84'),_0x338ca1['predictiveIntervalAvgTalktime']);loggerPredictive[_0x401e('0x7d')](_0x401e('0x85'));if(_0x338ca1[_0x401e('0x72')]>0x0){if(!_[_0x401e('0x3e')](_0x338ca1[_0x401e('0x6a')])&&_0x338ca1['predictiveIntervalAvgTalktime']>0x0){return!![];}else{loggerPredictive['info'](_0x401e('0x86'));}if(!_[_0x401e('0x3e')](_0x338ca1[_0x401e('0x83')])&&_0x338ca1['predictiveIntervalAvgHoldtime']>0x0){return!![];}else{loggerPredictive[_0x401e('0x7d')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive['info'](_0x401e('0x87'));}}else{loggerPredictive[_0x401e('0x7d')](_0x401e('0x88'));}}else{loggerPredictive['info'](_0x401e('0x88'));}return![];}function mergeDataErlangB(_0x1c9b1c){return function(_0x420809){loggerPredictive[_0x401e('0x7d')](_0x401e('0x89'));loggerPredictive[_0x401e('0x7d')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x420809[_0x401e('0x8a')]);loggerPredictive[_0x401e('0x7d')](_0x401e('0x8b'),_0x420809[_0x401e('0x74')]);loggerPredictive[_0x401e('0x7d')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x420809[_0x401e('0x75')]);loggerPredictive[_0x401e('0x7d')](_0x401e('0x8c'),_0x420809[_0x401e('0x76')]);loggerPredictive[_0x401e('0x7d')](_0x401e('0x8d'),_0x420809[_0x401e('0x75')]);loggerPredictive['info']('---------------------------');_['merge'](_0x1c9b1c,_0x420809);};}function getDiff(_0x12f70b){var _0x35a40d=moment()['milliseconds'](0x0);var _0x366597=moment(_0x12f70b)['milliseconds'](0x0);return _0x35a40d[_0x401e('0x4a')](_0x366597,_0x401e('0x8e'));}function ifInterval(_0x2759a2,_0x3cb1d1){if(_['isUndefined'](_0x3cb1d1)){return![];}if(getDiff(_0x3cb1d1)<_0x2759a2*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x3e0da5){if(isNotNull(_0x3e0da5)){if(!_[_0x401e('0x3e')](_0x3e0da5[_0x401e('0x29')])){_0x3e0da5['startProgressive']=undefined;loggerPredictive[_0x401e('0x7d')](_0x3e0da5[_0x401e('0x40')],_0x401e('0x8f'));}if(!_[_0x401e('0x3e')](_0x3e0da5[_0x401e('0x28')])){_0x3e0da5['startPredictive']=undefined;loggerPredictive[_0x401e('0x7d')](_0x3e0da5['name'],_0x401e('0x90'));}if(!_[_0x401e('0x3e')](_0x3e0da5[_0x401e('0x91')])){clearInterval(_0x3e0da5[_0x401e('0x91')]);_0x3e0da5['handlePredictive']=undefined;loggerPredictive['info'](_0x3e0da5[_0x401e('0x40')],_0x401e('0x92'));}}}function erlangb(_0x58cfd6,_0xa3af36){if(_0xa3af36===0x0){return 0x0;}var _0x4eabb5=0x1;for(var _0x9d8f32=0x1;_0x9d8f32<=_0xa3af36;_0x9d8f32+=0x1){_0x4eabb5=0x1+_0x4eabb5*_0x9d8f32/_0x58cfd6;}return 0x1/_0x4eabb5;}function isVoiceQueueOutbound(_0x52f1d4){return _0x52f1d4===_0x401e('0x4d');}function isNotPreview(_0x7d4be3){return _0x7d4be3!==_0x401e('0x1e');}function isCampaignIvr(_0x234224){return _0x234224===_0x401e('0x93');}function getCallerId(_0x362be0,_0x31b196,_0xf9f3d0){if(!_[_0x401e('0x3e')](_0xf9f3d0)&&_0x401e('0x94')===typeof _0xf9f3d0&&!_[_0x401e('0x95')](_0xf9f3d0)){if(!_['isUndefined'](_0x31b196)&&_0x401e('0x94')===typeof _0x31b196&&!_['isEmpty'](_0x31b196)){return util['format'](_0x401e('0x96'),_0x31b196,_0xf9f3d0);}return util['format']('\x22%s\x22\x20<%s>',_0xf9f3d0,_0xf9f3d0);}if(!_['isUndefined'](_0x362be0)&&'string'===typeof _0x362be0&&!_['isEmpty'](_0x362be0)){return _0x362be0;}return _0x401e('0x97');}function loggerCatchQueueSummary(_0x4a621e,_0x208339){return function(_0x576720){freeVariablesPredictive(_0x208339);emitVoiceQueueSummary(_0x208339);emitCampaignSummary(_0x208339);loggerSyncQueueSummary[_0x401e('0x98')](_0x4a621e,util[_0x401e('0x99')](_0x576720,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x4dae03,_0x2128c0){return function(_0x4688b2){loggerPredictive[_0x401e('0x98')](_0x2128c0['name'],_0x4dae03);loggerPredictive[_0x401e('0x98')](_0x4688b2[_0x401e('0x9a')]);freeVariablesPredictive(_0x2128c0);};}function loggerCatch(_0x585c4d){return function(_0x4da020){logger[_0x401e('0x98')](_0x585c4d,util[_0x401e('0x99')](_0x4da020,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x21397e){return _0x21397e&&!_[_0x401e('0x3e')](_0x21397e)&&_0x21397e['length']>0x0;}function decremetOriginate(_0x3c4d17){if(!_['isUndefined'](_0x3c4d17)&&_0x3c4d17!==null){if(_0x3c4d17['hasOwnProperty'](_0x401e('0x73'))){if(_0x3c4d17[_0x401e('0x73')]>0x0){_0x3c4d17[_0x401e('0x73')]-=0x1;}else{logger['error'](_0x401e('0x9b'));}}}else{logger['error'](_0x401e('0x9c'));}}function checkContactLowerLimitOriginate(_0x23ad58,_0x57c8b2,_0x1ec610){if(_0x57c8b2>_0x1ec610){for(var _0x5398b8=0x0;_0x5398b8<_0x57c8b2-_0x1ec610;_0x5398b8+=0x1){decremetOriginate(_0x23ad58);}}}function loggerGetContactDialer(_0x4d2b4a,_0x5165d7,_0x34a107){return function(_0x450420){checkContactLowerLimitOriginate(_0x5165d7,_0x34a107,0x0);logger[_0x401e('0x98')](_0x4d2b4a,util[_0x401e('0x99')](_0x450420,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x102241){return function(_0x49f0ee){if(isNotNull(_0x49f0ee)&&isNotNull(_0x49f0ee[0x0])){if(_0x49f0ee[0x0][_0x401e('0x9d')]>0x0){_0x102241[_0x401e('0x3f')]=_0x401e('0x9e');logger['info'](_0x401e('0x9f')+_0x102241[_0x401e('0x40')],_0x49f0ee[0x0][_0x401e('0x9d')],_0x401e('0xa0'));}else{_0x102241[_0x401e('0x3f')]=_0x401e('0xa1');logger[_0x401e('0x7d')](_0x401e('0xa2')+_0x102241[_0x401e('0x40')]);}}};}function notSendMessagesQueue(_0x5e1a26){if(_0x5e1a26[_0x401e('0xa3')]){freeVariablesPredictive(_0x5e1a26);if(_0x5e1a26[_0x401e('0x73')]===0x0&&_0x5e1a26[_0x401e('0x52')]===0x0&&_0x5e1a26[_0x401e('0x55')]===0x0&&(_0x5e1a26[_0x401e('0x50')]||0x0)===0x0){_0x5e1a26[_0x401e('0xa3')]=![];_0x5e1a26['available']=0x0;_0x5e1a26['message']=_0x401e('0xa4');loggerSyncQueueSummary[_0x401e('0x98')](_0x401e('0xa5'),_0x5e1a26[_0x401e('0x40')],_0x401e('0xa6'));}else{_0x5e1a26[_0x401e('0x3f')]=_0x401e('0xa7');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x5e1a26[_0x401e('0x40')],_0x401e('0xa8'));}emitVoiceQueueSummary(_0x5e1a26);}}function notSendMessagesCampaign(_0x4ecac6){if(_0x4ecac6[_0x401e('0xa3')]){if(_0x4ecac6[_0x401e('0x73')]===0x0){_0x4ecac6['sendMessageOneNotActive']=![];_0x4ecac6[_0x401e('0x3f')]=_0x401e('0xa4');loggerSyncQueueSummary['error'](_0x401e('0xa9'),_0x4ecac6[_0x401e('0x40')],_0x401e('0xa6'));}else{_0x4ecac6[_0x401e('0x3f')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x401e('0x98')](_0x401e('0xa9'),_0x4ecac6[_0x401e('0x40')],_0x401e('0xa8'));}emitCampaignSummary(_0x4ecac6);}}function createObjHistory(_0x12035f,_0x1c65da,_0x5e857e,_0x3b56f1,_0x250aae){_0x12035f['message']=_0x5e857e;var _0x181e4c=new Action(_0x12035f,_0x1c65da);var _0x20ac67=new History(_0x181e4c);_0x20ac67[_0x401e('0xaa')]=_0x3b56f1;_0x20ac67[_0x401e('0xab')]=_0x250aae;_0x20ac67['endtime']=_0x181e4c['starttime'];return _0x20ac67;}Dialer[_0x401e('0x1a')][_0x401e('0x3d')]=function(){var _0x4a7a62=this;setInterval(function(){_0x4a7a62[_0x401e('0xac')](_0x4a7a62[_0x401e('0x26')],'[uniqueid]');_0x4a7a62[_0x401e('0xac')](_0x4a7a62[_0x401e('0xad')],_0x401e('0xae'));},0x32c8);};Dialer[_0x401e('0x1a')][_0x401e('0xac')]=function(_0x5d227d,_0x37117e){var _0x51576e=this;for(var _0x479146 in _0x5d227d){if(_0x5d227d[_0x401e('0xaf')](_0x479146)){this[_0x401e('0xb0')][_0x401e('0x1b')](function(){if(!_[_0x401e('0xb1')](_0x5d227d[_0x479146])){return ami[_0x401e('0xb2')]({'action':_0x401e('0xb3'),'channel':_0x5d227d[_0x479146][_0x401e('0xb4')]})[_0x401e('0xb5')](function(_0x2cd6b1){if(_0x2cd6b1[_0x401e('0x3f')]===_0x401e('0xb6')){setTimeout(function(){if(_0x5d227d[_0x479146]&&_0x5d227d[_0x479146][_0x401e('0x4c')]!=='ivr'){_0x51576e[_0x401e('0xb7')](_0x51576e[_0x401e('0x1f')][_0x5d227d[_0x479146][_0x401e('0xb8')]]);logger[_0x401e('0x98')]('[Dialer][checkChannel]',_0x37117e,_0x479146,_0x5d227d[_0x479146][_0x401e('0xb8')]);delete _0x5d227d[_0x479146];}if(_0x5d227d[_0x479146]&&_0x5d227d[_0x479146][_0x401e('0x4c')]===_0x401e('0x93')){_0x51576e[_0x401e('0xb7')](_0x51576e['campaigns'][_0x5d227d[_0x479146][_0x401e('0xb8')]]);logger[_0x401e('0x98')](_0x401e('0xb9'),_0x37117e,_0x479146,_0x5d227d[_0x479146][_0x401e('0xb8')]);delete _0x5d227d[_0x479146];}},0x2328);}});}});}}};Dialer[_0x401e('0x1a')][_0x401e('0xba')]=function(_0xfc71a9){return BPromise[_0x401e('0xbb')]()[_0x401e('0xbc')](cmHopper['countReScheduled'](_0xfc71a9))['catch'](loggerCatch('[countReScheduled]\x20'));};Dialer[_0x401e('0x1a')][_0x401e('0xbd')]=function(_0x1e4b1f){return BPromise['resolve']()[_0x401e('0xbc')](cmHopperBlack['checkIsBlackList'](_0x1e4b1f))[_0x401e('0xb5')](loggerCatch(_0x401e('0xbe')));};Dialer[_0x401e('0x1a')][_0x401e('0xbf')]=function(_0x40d21a){return BPromise[_0x401e('0xbb')]()[_0x401e('0xbc')](cmHopperBlack[_0x401e('0xbf')](_0x40d21a))['catch'](loggerCatch(_0x401e('0xc0')));};Dialer['prototype'][_0x401e('0xc1')]=function(_0x1d3bef){return BPromise[_0x401e('0xbb')]()[_0x401e('0xbc')](cmHopperHistory[_0x401e('0xc2')](_0x1d3bef))[_0x401e('0xb5')](loggerCatch(_0x401e('0xc3')));};Dialer[_0x401e('0x1a')][_0x401e('0xc4')]=function(_0x4c014d){return BPromise[_0x401e('0xbb')]()['then'](cmHopper[_0x401e('0xc4')](_0x4c014d))['catch'](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0x401e('0x1a')]['unlockContact']=function(_0xd1b7a8,_0xa27354,_0x16cd30){return BPromise['resolve']()['then'](cmHopper[_0x401e('0xc5')](_0xd1b7a8,_0xa27354,_0x16cd30))[_0x401e('0xb5')](loggerCatch(_0x401e('0xc6')));};Dialer[_0x401e('0x1a')]['getContactDialer']=function(_0x13fa77,_0x94b1d3,_0x27f422,_0x4b1aca){return BPromise['resolve']()['then'](cmHopper[_0x401e('0xc7')](_0x13fa77,_0x94b1d3,_0x27f422,_0x4b1aca))[_0x401e('0xb5')](loggerCatch(_0x401e('0xc8')));};Dialer[_0x401e('0x1a')][_0x401e('0xc9')]=function(_0x2af463,_0x2f0f58,_0x259f74){return BPromise[_0x401e('0xbb')]()['then'](cmHopper[_0x401e('0xc9')](_0x2af463,_0x2f0f58,_0x259f74))['catch'](loggerCatch('[getContactDialer]\x20'));};Dialer[_0x401e('0x1a')][_0x401e('0xca')]=function(_0x3c203b){return BPromise[_0x401e('0xbb')]()[_0x401e('0xbc')](voiceQueueRt[_0x401e('0xca')](_0x3c203b))['catch'](loggerCatch(_0x401e('0xcb')));};Dialer['prototype'][_0x401e('0xcc')]=function(_0x128f47){return BPromise[_0x401e('0xbb')]()[_0x401e('0xbc')](cmHopper[_0x401e('0xcc')](_0x128f47))[_0x401e('0xb5')](loggerCatch(_0x401e('0xcd')));};Dialer[_0x401e('0x1a')][_0x401e('0xce')]=function(_0x4aa7cb){return BPromise[_0x401e('0xbb')]()[_0x401e('0xbc')](cmHopperHistory[_0x401e('0xce')](_0x4aa7cb))[_0x401e('0xb5')](loggerCatch('[createHistory]\x20'));};Dialer['prototype'][_0x401e('0xb7')]=function(_0x4ca60f){if(!_[_0x401e('0x3e')](_0x4ca60f)&&_0x4ca60f!==null){if(_0x4ca60f[_0x401e('0xaf')]('originated')){if(_0x4ca60f[_0x401e('0x73')]>0x0){_0x4ca60f[_0x401e('0x73')]-=0x1;}else{logger[_0x401e('0x98')](_0x401e('0xcf'));}}}else{logger[_0x401e('0x98')](_0x401e('0xd0'));}};Dialer[_0x401e('0x1a')][_0x401e('0xd1')]=function(_0x399510,_0xf2dab5){var _0x82aec1=this;return function(_0x197741){_0x82aec1[_0x401e('0xb7')](_0xf2dab5);logger[_0x401e('0x98')](_0x399510,util[_0x401e('0x99')](_0x197741,{'showHidden':![],'depth':null}));};};Dialer['prototype']['emptyContact']=function(_0x463a9f,_0x244e81,_0x50a2fb){var _0xaf4fd={'state':0x19,'statedesc':_0x401e('0xd2')};this['updateOriginated'](_0x244e81);this['saveInDb'](_[_0x401e('0xd3')](_0xaf4fd,_[_0x401e('0xd4')](_0x50a2fb,[_0x401e('0xd5'),_0x401e('0xd6'),_0x401e('0xd7'),_0x401e('0xd8'),'CampaignId'])),_0x401e('0xd9'),_0x401e('0xda'));logger[_0x401e('0x98')](_0x463a9f);};Dialer[_0x401e('0x1a')][_0x401e('0xdb')]=function(_0x40e173){return _0x40e173==='Success';};Dialer['prototype']['isTrunkReachable']=function(_0xf591ee){return!_[_0x401e('0x3e')](_0xf591ee)&&_0xf591ee&&!_[_0x401e('0x3e')](_0xf591ee[_0x401e('0x40')])&&!_[_0x401e('0x3e')](_0xf591ee[_0x401e('0xdc')])&&_0xf591ee[_0x401e('0xdc')]&&(this[_0x401e('0x22')][util[_0x401e('0xdd')](_0x401e('0xde'),_0xf591ee['name'])][_0x401e('0xb3')]===_0x401e('0xdf')||this[_0x401e('0x22')][util[_0x401e('0xdd')]('SIP/%s',_0xf591ee[_0x401e('0x40')])][_0x401e('0xb3')]===_0x401e('0xe0'));};Dialer['prototype'][_0x401e('0xe1')]=function(_0x36122b,_0x1608b9,_0x25a693){this[_0x401e('0xce')](_0x36122b)[_0x401e('0xb5')](loggerCatch(_0x1608b9));this[_0x401e('0xcc')](_0x36122b)[_0x401e('0xb5')](loggerCatch(_0x25a693));};Dialer[_0x401e('0x1a')]['syncVarSet']=function(_0x45fb8f){var _0x30a1ae=this[_0x401e('0x26')][_0x45fb8f[_0x401e('0xe2')]];var _0x9a457b;if(!_['isNil'](_0x45fb8f)&&!_['isNil'](_0x45fb8f[_0x401e('0xe3')])&&!_[_0x401e('0xb1')](_0x45fb8f['variable'][_0x401e('0xe4')])&&_0x45fb8f[_0x401e('0xe5')]==='xcally-motion-dialer'&&_0x30a1ae){if(_0x30a1ae[_0x401e('0x4c')]!==_0x401e('0x93')&&this[_0x401e('0x1f')][_0x30a1ae[_0x401e('0xb8')]]['dialAMDActive']&&_0x45fb8f[_0x401e('0xe6')]===_0x401e('0xe7')){delete this[_0x401e('0x26')][_0x45fb8f['uniqueid']];this['updateOriginated'](this[_0x401e('0x1f')][_0x30a1ae[_0x401e('0xb8')]]);this[_0x401e('0x1f')][_0x30a1ae[_0x401e('0xb8')]]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x30a1ae['queue']][_0x401e('0x5c')]+=0x1;_0x9a457b=new Hangup(_0x30a1ae,_0x45fb8f);_0x9a457b['state']=0x12;_0x9a457b[_0x401e('0xab')]='HangupInAMD';_0x9a457b[_0x401e('0xe8')]='AMD';this[_0x401e('0xe1')](_0x9a457b,_0x401e('0xe9'),_0x401e('0xea'));}if(_0x30a1ae[_0x401e('0x4c')]!==_0x401e('0x93')&&this[_0x401e('0x1f')][_0x30a1ae['queue']]['dialAMDActive']&&_0x45fb8f[_0x401e('0xe6')]===_0x401e('0xeb')){var _0x502614=this;return new BPromise(function(_0x330db2,_0x17b3e2){delete _0x502614['uniqueId'][_0x45fb8f[_0x401e('0xe2')]];_0x502614[_0x401e('0xb7')](_0x502614[_0x401e('0x1f')][_0x30a1ae[_0x401e('0xb8')]]);_0x502614[_0x401e('0x1f')][_0x30a1ae['queue']][_0x401e('0x5d')]+=0x1;_0x502614[_0x401e('0x1f')][_0x30a1ae[_0x401e('0xb8')]][_0x401e('0x5c')]+=0x1;var _0x4b4396=_0x502614['voiceQueues'][_0x30a1ae[_0x401e('0xb8')]];var _0x5f4734=new Hangup(_0x30a1ae,_0x45fb8f);_0x5f4734[_0x401e('0xaa')]=0x13;_0x5f4734['statedesc']=_0x401e('0xec');_0x5f4734[_0x401e('0xe8')]='AMD';_0x5f4734[_0x401e('0xed')]+=0x1;_0x5f4734[_0x401e('0xee')]+=0x1;_0x5f4734[_0x401e('0xef')]=!![];_0x502614[_0x401e('0xce')](_0x5f4734)[_0x401e('0xb5')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x5f4734[_0x401e('0xf0')]+_0x5f4734[_0x401e('0xf1')]+_0x5f4734[_0x401e('0xf2')]+_0x5f4734[_0x401e('0xf3')]+_0x5f4734['countdropretry']+_0x5f4734[_0x401e('0xf4')]+_0x5f4734[_0x401e('0xed')]+_0x5f4734[_0x401e('0xf5')]>=_0x4b4396[_0x401e('0xf6')]){_0x502614[_0x401e('0xf7')](_0x5f4734,_0x330db2,_0x17b3e2,'reason19\x20machine....');}else{if(_0x5f4734[_0x401e('0xed')]>=_0x4b4396[_0x401e('0xf8')]){_0x502614['createStateFinal'](_0x5f4734,_0x330db2,_0x17b3e2,'reason\x2019\x20machine....');}else{_0x502614[_0x401e('0xc4')]({'active':![],'countmachineretry':_0x5f4734[_0x401e('0xed')],'scheduledat':moment()[_0x401e('0xf9')](_0x4b4396[_0x401e('0xfa')],_0x401e('0xfb'))['format'](_0x401e('0xfc')),'ContactId':_0x5f4734[_0x401e('0xd5')],'ListId':_0x5f4734[_0x401e('0xd6')],'VoiceQueueId':_0x5f4734['VoiceQueueId']||undefined,'CampaignId':_0x5f4734[_0x401e('0xfd')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x330db2({'reschedule':0x1});}}});}if(_0x30a1ae[_0x401e('0x4c')]===_0x401e('0x93')&&this['campaigns'][_0x30a1ae[_0x401e('0xb8')]][_0x401e('0xfe')]&&_0x45fb8f[_0x401e('0xe6')]===_0x401e('0xe7')){delete this[_0x401e('0x26')][_0x45fb8f[_0x401e('0xe2')]];this[_0x401e('0xb7')](this[_0x401e('0x20')][_0x30a1ae['queue']]);_0x9a457b=new Hangup(_0x30a1ae,_0x45fb8f);_0x9a457b[_0x401e('0xaa')]=0x12;_0x9a457b[_0x401e('0xab')]='HangupInAMD';_0x9a457b[_0x401e('0xe8')]=_0x401e('0xff');this[_0x401e('0xe1')](_0x9a457b,_0x401e('0x100'),_0x401e('0x101'));}if(_0x30a1ae[_0x401e('0x4c')]===_0x401e('0x93')&&this[_0x401e('0x20')][_0x30a1ae['queue']]['dialAMDActive']&&_0x45fb8f[_0x401e('0xe6')]===_0x401e('0xeb')){var _0x502614=this;return new BPromise(function(_0x3de81,_0x271336){delete _0x502614['uniqueId'][_0x45fb8f['uniqueid']];_0x502614[_0x401e('0xb7')](_0x502614[_0x401e('0x20')][_0x30a1ae[_0x401e('0xb8')]]);_0x502614[_0x401e('0x20')][_0x30a1ae[_0x401e('0xb8')]]['outboundAnswerCallsDay']+=0x1;_0x502614[_0x401e('0x20')][_0x30a1ae[_0x401e('0xb8')]][_0x401e('0x5c')]+=0x1;var _0x47b69b=_0x502614[_0x401e('0x20')][_0x30a1ae['queue']];var _0x566db4=new Hangup(_0x30a1ae,_0x45fb8f);_0x566db4[_0x401e('0xaa')]=0x13;_0x566db4[_0x401e('0xab')]='Machine';_0x566db4[_0x401e('0xe8')]=_0x401e('0xff');_0x566db4[_0x401e('0xed')]+=0x1;_0x566db4[_0x401e('0xee')]+=0x1;_0x566db4[_0x401e('0xef')]=!![];_0x502614[_0x401e('0xce')](_0x566db4)[_0x401e('0xb5')](loggerCatch(_0x401e('0x102')));if(_0x566db4[_0x401e('0xf0')]+_0x566db4['countcongestionretry']+_0x566db4[_0x401e('0xf2')]+_0x566db4[_0x401e('0xf3')]+_0x566db4[_0x401e('0x103')]+_0x566db4[_0x401e('0xf4')]+_0x566db4[_0x401e('0xed')]+_0x566db4[_0x401e('0xf5')]>=_0x47b69b[_0x401e('0xf6')]){_0x502614[_0x401e('0xf7')](_0x566db4,_0x3de81,_0x271336,_0x401e('0x104'));}else{if(_0x566db4[_0x401e('0xed')]>=_0x47b69b[_0x401e('0xf8')]){_0x502614[_0x401e('0x105')](_0x566db4,_0x3de81,_0x271336,'reason\x2019\x20machine....');}else{_0x502614[_0x401e('0xc4')]({'active':![],'countmachineretry':_0x566db4[_0x401e('0xed')],'scheduledat':moment()['add'](_0x47b69b[_0x401e('0xfa')],'minutes')[_0x401e('0xdd')](_0x401e('0xfc')),'ContactId':_0x566db4[_0x401e('0xd5')],'ListId':_0x566db4[_0x401e('0xd6')],'VoiceQueueId':_0x566db4['VoiceQueueId']||undefined,'CampaignId':_0x566db4['CampaignId']||undefined})[_0x401e('0xb5')](loggerCatch(_0x401e('0x106')));_0x3de81({'reschedule':0x1});}}});}}};Dialer[_0x401e('0x1a')][_0x401e('0x35')]=function(_0xcadb7e){var _0x2c634f=this[_0x401e('0x26')][_0xcadb7e[_0x401e('0xe2')]];var _0x595211=this;var _0x1d555e;if(_0x2c634f&&_0x2c634f[_0x401e('0x4c')]==='ivr'){delete this[_0x401e('0x26')][_0xcadb7e[_0x401e('0xe2')]];this['updateOriginated'](this[_0x401e('0x20')][_0x2c634f[_0x401e('0xb8')]]);this['campaigns'][_0x2c634f[_0x401e('0xb8')]][_0x401e('0x107')]+=0x1;_0x1d555e=new Hangup(_0x2c634f,_0xcadb7e);this[_0x401e('0xce')](_0x1d555e)['catch'](loggerCatch(_0x401e('0x108')));this[_0x401e('0xcc')](_0x1d555e)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x2c634f&&_0x2c634f['type']!==_0x401e('0x93')&&isNotNull(this[_0x401e('0x1f')][_0x2c634f[_0x401e('0xb8')]][_0x401e('0x109')])){delete this['uniqueId'][_0xcadb7e[_0x401e('0xe2')]];this[_0x401e('0xb7')](this[_0x401e('0x1f')][_0x2c634f['queue']]);this[_0x401e('0x1f')][_0x2c634f['queue']]['outboundAnswerCallsDay']+=0x1;this[_0x401e('0x1f')][_0x2c634f[_0x401e('0xb8')]]['outboundAnswerAgiCallsDay']+=0x1;_0x1d555e=new Hangup(_0x2c634f,_0xcadb7e);_0x1d555e[_0x401e('0xaa')]=0x10;_0x1d555e[_0x401e('0xab')]=_0x401e('0x10a');_0x1d555e[_0x401e('0xe8')]=_0x401e('0x10b');this[_0x401e('0xce')](_0x1d555e)[_0x401e('0xb5')](loggerCatch(_0x401e('0x108')));this[_0x401e('0xcc')](_0x1d555e)['catch'](loggerCatch(_0x401e('0x10c')));}if(_0x2c634f&&_0x2c634f[_0x401e('0x4c')]!==_0x401e('0x93')&&!isNotNull(this['voiceQueues'][_0x2c634f['queue']][_0x401e('0x109')])){delete this[_0x401e('0x26')][_0xcadb7e[_0x401e('0xe2')]];this[_0x401e('0xb7')](this[_0x401e('0x1f')][_0x2c634f[_0x401e('0xb8')]]);this[_0x401e('0x1f')][_0x2c634f[_0x401e('0xb8')]][_0x401e('0x69')]+=0x1;_0x1d555e=new Hangup(_0x2c634f,_0xcadb7e);_0x1d555e['state']=0xc;_0x1d555e[_0x401e('0xab')]=_0xcadb7e[_0x401e('0x10d')];_0x1d555e[_0x401e('0xe8')]=_0x401e('0x10e');this[_0x401e('0xce')](_0x1d555e)[_0x401e('0xb5')](loggerCatch(_0x401e('0x108')));this['moveContactManagedDialer'](_0x1d555e)[_0x401e('0xb5')](loggerCatch(_0x401e('0x10c')));}};Dialer[_0x401e('0x1a')][_0x401e('0x32')]=function(_0xd6405b){var _0x5a643f=this[_0x401e('0x26')][_0xd6405b[_0x401e('0xe2')]];var _0x106562=this;if(this[_0x401e('0x1f')][_0xd6405b[_0x401e('0xb8')]]){if(_0x5a643f&&_0x5a643f[_0x401e('0x4c')]!==_0x401e('0x93')){delete this[_0x401e('0x26')][_0xd6405b[_0x401e('0xe2')]];this[_0x401e('0x1f')][_0xd6405b[_0x401e('0xb8')]][_0x401e('0x5d')]+=0x1;var _0x371725=new AgentComplete(_0x5a643f,_0xd6405b);if(_0xd6405b[_0x401e('0x10f')]===_0x401e('0x110')){_0x371725[_0x401e('0x111')]=this['voiceQueues'][_0xd6405b['queue']][_0x401e('0x112')]&&this['voiceQueues'][_0xd6405b['queue']][_0x401e('0x113')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0x401e('0xce')](_0x371725)[_0x401e('0xb5')](loggerCatch(_0x401e('0x114')));this[_0x401e('0xcc')](_0x371725)['catch'](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x401e('0x1a')]['syncAgentConnect']=function(_0x5b4e8c){if(this[_0x401e('0x1f')][_0x5b4e8c[_0x401e('0xb8')]]){if(this['uniqueId'][_0x5b4e8c['uniqueid']]&&this['uniqueId'][_0x5b4e8c[_0x401e('0xe2')]][_0x401e('0x4c')]!==_0x401e('0x93')){this[_0x401e('0xb7')](this[_0x401e('0x1f')][_0x5b4e8c[_0x401e('0xb8')]]);this[_0x401e('0x26')][_0x5b4e8c[_0x401e('0xe2')]][_0x401e('0x115')]=moment()[_0x401e('0xdd')](_0x401e('0xfc'));}}};Dialer[_0x401e('0x1a')][_0x401e('0x116')]=function(_0x54bb72){this[_0x401e('0xce')](_0x54bb72)[_0x401e('0xb5')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x401e('0xcc')](_0x54bb72)[_0x401e('0xb5')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer['prototype'][_0x401e('0x117')]=function(_0x56820a){var _0x492817=this[_0x401e('0x26')][_0x56820a[_0x401e('0xe2')]];var _0xe407a5=this;if(this[_0x401e('0x1f')][_0x56820a[_0x401e('0xb8')]]){if(_0x492817&&_0x492817[_0x401e('0x4c')]!=='ivr'){delete this[_0x401e('0x26')][_0x56820a['uniqueid']];this[_0x401e('0xb7')](this[_0x401e('0x1f')][_0x56820a[_0x401e('0xb8')]]);_0x492817[_0x401e('0x118')]=moment()['format'](_0x401e('0xfc'));var _0x4f3d81=new QueueCallerAbandon(_0x492817,_0x56820a);if(getSeconds(_0x492817['droptime'],_0x492817['responsetime'])>=_0x492817[_0x401e('0x119')]){this[_0x401e('0x1f')][_0x56820a[_0x401e('0xb8')]][_0x401e('0x6c')]+=0x1;this['voiceQueues'][_0x56820a[_0x401e('0xb8')]]['outboundDropCallsDayTimeout']+=0x1;this[_0x401e('0x1f')][_0x56820a['queue']][_0x401e('0x6d')]+=0x1;_0x4f3d81[_0x401e('0xaa')]=0xa;_0x4f3d81[_0x401e('0xab')]='Drop';_0x4f3d81[_0x401e('0x11a')]=_0x401e('0x11b');_0x4f3d81[_0x401e('0x111')]=this[_0x401e('0x1f')][_0x56820a[_0x401e('0xb8')]][_0x401e('0x112')]?moment()[_0x401e('0xdd')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x4f3d81['countdropretry']+=0x1;_0x4f3d81['countglobal']+=0x1;if(_0x4f3d81[_0x401e('0x103')]>=this[_0x401e('0x1f')][_0x56820a[_0x401e('0xb8')]][_0x401e('0x11c')]){this[_0x401e('0x116')](_0x4f3d81);}else{this[_0x401e('0xc4')]({'active':![],'countdropretry':_0x4f3d81[_0x401e('0x103')],'scheduledat':moment()[_0x401e('0xf9')](this[_0x401e('0x1f')][_0x56820a['queue']]['dialDropRetryFrequency'],'minutes')[_0x401e('0xdd')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x492817['ContactId'],'ListId':_0x492817['ListId'],'VoiceQueueId':_0x492817[_0x401e('0xd8')]||undefined,'CampaignId':_0x492817[_0x401e('0xfd')]||undefined})['catch'](loggerCatch(_0x401e('0x11d')));var _0x5631ae=new History(_0x4f3d81);_0x5631ae[_0x401e('0xaa')]=0xa;_0x5631ae[_0x401e('0xab')]=_0x401e('0x11e');_0x5631ae[_0x401e('0x11f')]=moment()['format'](_0x401e('0xfc'));_0x5631ae[_0x401e('0x120')]=_0x5631ae['starttime'];_0x5631ae[_0x401e('0x121')]=_0x4f3d81['calleridname'];_0x5631ae[_0x401e('0x122')]=_0x4f3d81['calleridnum'];this[_0x401e('0xce')](_0x5631ae)['catch'](loggerCatch(_0x401e('0x123')));}}else{this[_0x401e('0x1f')][_0x56820a[_0x401e('0xb8')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x401e('0x1f')][_0x56820a[_0x401e('0xb8')]][_0x401e('0x62')]+=0x1;_0x4f3d81[_0x401e('0xaa')]=0xb;_0x4f3d81[_0x401e('0xab')]='Abandoned';_0x4f3d81['dropreason']=_0x401e('0x124');_0x4f3d81[_0x401e('0xf4')]+=0x1;_0x4f3d81[_0x401e('0xee')]+=0x1;if(_0x4f3d81['countabandonedretry']>=this[_0x401e('0x1f')][_0x56820a[_0x401e('0xb8')]][_0x401e('0x125')]){this[_0x401e('0x116')](_0x4f3d81);}else{this[_0x401e('0xc4')]({'active':![],'countabandonedretry':_0x4f3d81[_0x401e('0xf4')],'scheduledat':moment()[_0x401e('0xf9')](this['voiceQueues'][_0x56820a['queue']]['dialAbandonedRetryFrequency'],_0x401e('0xfb'))[_0x401e('0xdd')](_0x401e('0xfc')),'ContactId':_0x492817[_0x401e('0xd5')],'ListId':_0x492817[_0x401e('0xd6')],'VoiceQueueId':_0x492817[_0x401e('0xd8')]||undefined,'CampaignId':_0x492817[_0x401e('0xfd')]||undefined})[_0x401e('0xb5')](loggerCatch(_0x401e('0x126')));var _0x5631ae=new History(_0x4f3d81);_0x5631ae[_0x401e('0xaa')]=0xb;_0x5631ae[_0x401e('0xab')]='Abandoned';_0x5631ae[_0x401e('0x11f')]=moment()[_0x401e('0xdd')](_0x401e('0xfc'));_0x5631ae[_0x401e('0x120')]=_0x5631ae[_0x401e('0x11f')];_0x5631ae[_0x401e('0x121')]=_0x4f3d81[_0x401e('0x121')];_0x5631ae['calleridnum']=_0x4f3d81[_0x401e('0x122')];this[_0x401e('0xce')](_0x5631ae)[_0x401e('0xb5')](loggerCatch(_0x401e('0x127')));}}}}};Dialer['prototype'][_0x401e('0x37')]=function(_0xd87f0e){if(this[_0x401e('0xad')][_0xd87f0e[_0x401e('0xe2')]]){this[_0x401e('0xad')][_0xd87f0e[_0x401e('0xe2')]][_0x401e('0xb4')]=_0xd87f0e[_0x401e('0xb4')];}if(this[_0x401e('0x26')][_0xd87f0e[_0x401e('0xe2')]]){this[_0x401e('0x26')][_0xd87f0e['uniqueid']][_0x401e('0xb4')]=_0xd87f0e[_0x401e('0xb4')];}};Dialer[_0x401e('0x1a')][_0x401e('0x3a')]=function(_0x2d6a50){if(strategy[this[_0x401e('0x1f')][this[_0x401e('0xad')][_0x2d6a50[_0x401e('0x128')]][_0x401e('0xb8')]][_0x401e('0x129')]]===_0x401e('0x12a')){if(this['actions'][_0x2d6a50[_0x401e('0x128')]]&&_[_0x401e('0xb1')](this['actions'][_0x2d6a50[_0x401e('0x128')]][_0x401e('0x12b')])&&_0x2d6a50[_0x401e('0xb3')]==='1'&&_0x2d6a50[_0x401e('0x12c')]==='0'){if(this[_0x401e('0x21')][_0x2d6a50[_0x401e('0x12d')]]){if(!this[_0x401e('0x21')][_0x2d6a50[_0x401e('0x12d')]][_0x401e('0x12b')]){this[_0x401e('0x21')][_0x2d6a50[_0x401e('0x12d')]][_0x401e('0x12b')]=!![];this[_0x401e('0xad')][_0x2d6a50[_0x401e('0x128')]][_0x401e('0x12b')]=!![];this[_0x401e('0xad')][_0x2d6a50[_0x401e('0x128')]]['stateinterface']=_0x2d6a50[_0x401e('0x12d')];}}}}else if((strategy[this[_0x401e('0x1f')][this['actions'][_0x2d6a50[_0x401e('0x128')]][_0x401e('0xb8')]][_0x401e('0x129')]]||'rrmemory')===_0x401e('0x19')){if(this[_0x401e('0xad')][_0x2d6a50[_0x401e('0x128')]]){if(this[_0x401e('0x21')][_0x2d6a50[_0x401e('0x12d')]]){this[_0x401e('0xad')][_0x2d6a50[_0x401e('0x128')]][_0x401e('0x12d')]=_0x2d6a50[_0x401e('0x12d')];if(_[_0x401e('0xb1')](this[_0x401e('0x2b')][this[_0x401e('0xad')][_0x2d6a50[_0x401e('0x128')]][_0x401e('0xb8')]])){this[_0x401e('0x2b')][this[_0x401e('0xad')][_0x2d6a50['actionid']][_0x401e('0xb8')]]=[];}this[_0x401e('0x2b')][this['actions'][_0x2d6a50[_0x401e('0x128')]][_0x401e('0xb8')]][_0x401e('0x12e')](_[_0x401e('0xd3')](_['pick'](this[_0x401e('0xad')][_0x2d6a50[_0x401e('0x128')]],[_0x401e('0x12f'),_0x401e('0x12d')]),{'status':_0x2d6a50[_0x401e('0xb3')],'paused':_0x2d6a50['paused']}));}}}};function unlockQueueStatus(_0x35a0e5,_0x51ae6a){setTimeout(function(){if(_['isUndefined'](_0x35a0e5[_0x401e('0x130')])){loggerBooked[_0x401e('0x98')](_0x401e('0x131'),_0x51ae6a);}_0x35a0e5[_0x401e('0x130')]=!![];loggerBooked[_0x401e('0x7d')](_0x401e('0x132'),_0x51ae6a,JSON['stringify'](_[_0x401e('0xd4')](_0x35a0e5,['name',_0x401e('0x130')])));},0x1f3);}Dialer['prototype'][_0x401e('0x3b')]=function(_0x4b1f13){var _0x2e2ece=this;var _0x5b7fb2=_0x2e2ece['voiceQueues'][_0x2e2ece[_0x401e('0xad')][_0x4b1f13[_0x401e('0x128')]]['queue']];if(strategy[this[_0x401e('0x1f')][this['actions'][_0x4b1f13['actionid']][_0x401e('0xb8')]][_0x401e('0x129')]]===_0x401e('0x12a')){if(this[_0x401e('0xad')][_0x4b1f13[_0x401e('0x128')]]&&this[_0x401e('0xad')][_0x4b1f13['actionid']][_0x401e('0x12d')]){this[_0x401e('0x1e')][_0x401e('0x133')](this[_0x401e('0xad')][_0x4b1f13[_0x401e('0x128')]][_0x401e('0x12f')],this[_0x401e('0xad')][_0x4b1f13['actionid']][_0x401e('0x12d')])[_0x401e('0xb5')](function(_0x36f3c4){logger[_0x401e('0x98')](_0x401e('0x134'),util[_0x401e('0x99')](_0x36f3c4,{'showHidden':![],'depth':null}));})[_0x401e('0x1d')](function(){_0x2e2ece[_0x401e('0xb7')](_0x2e2ece[_0x401e('0x1f')][_0x2e2ece[_0x401e('0xad')][_0x4b1f13[_0x401e('0x128')]][_0x401e('0xb8')]]);_0x2e2ece['agents'][_0x2e2ece['actions'][_0x4b1f13[_0x401e('0x128')]][_0x401e('0x12d')]][_0x401e('0x12b')]=![];delete _0x2e2ece['actions'][_0x4b1f13['actionid']];unlockQueueStatus(_0x5b7fb2);});}else{this['updateOriginated'](this[_0x401e('0x1f')][this['actions'][_0x4b1f13[_0x401e('0x128')]][_0x401e('0xb8')]]);this[_0x401e('0xc4')]({'active':![],'ContactId':this[_0x401e('0xad')][_0x4b1f13['actionid']][_0x401e('0xd5')],'ListId':this[_0x401e('0xad')][_0x4b1f13[_0x401e('0x128')]][_0x401e('0xd6')],'VoiceQueueId':this[_0x401e('0xad')][_0x4b1f13[_0x401e('0x128')]][_0x401e('0xd8')]||undefined,'CampaignId':this[_0x401e('0xad')][_0x4b1f13[_0x401e('0x128')]]['CampaignId']||undefined})[_0x401e('0xb5')](loggerCatch(_0x401e('0x135')));delete this[_0x401e('0xad')][_0x4b1f13['actionid']];unlockQueueStatus(_0x5b7fb2);}}else if((strategy[this['voiceQueues'][this[_0x401e('0xad')][_0x4b1f13[_0x401e('0x128')]][_0x401e('0xb8')]][_0x401e('0x129')]]||_0x401e('0x19'))==='rrmemory'){var _0x2f486e;if(this[_0x401e('0xad')][_0x4b1f13[_0x401e('0x128')]]&&!_[_0x401e('0x95')](this[_0x401e('0x2b')][this[_0x401e('0xad')][_0x4b1f13['actionid']]['queue']])){if(this['queueBookedRR'][_0x2e2ece[_0x401e('0xad')][_0x4b1f13[_0x401e('0x128')]]['queue']]){this['queueBookedRR'][_0x2e2ece[_0x401e('0xad')][_0x4b1f13[_0x401e('0x128')]]['queue']]=this[_0x401e('0x136')][this[_0x401e('0xad')][_0x4b1f13[_0x401e('0x128')]][_0x401e('0xb8')]]?this[_0x401e('0x136')][this[_0x401e('0xad')][_0x4b1f13[_0x401e('0x128')]][_0x401e('0xb8')]]:this[_0x401e('0x2b')][this[_0x401e('0xad')][_0x4b1f13['actionid']][_0x401e('0xb8')]]?this[_0x401e('0x2b')][this[_0x401e('0xad')][_0x4b1f13[_0x401e('0x128')]][_0x401e('0xb8')]]['_rr']||0x0:0x0;}this[_0x401e('0x2b')][this['actions'][_0x4b1f13[_0x401e('0x128')]]['queue']][_0x401e('0x137')]=this['queueBookedRR'][this[_0x401e('0xad')][_0x4b1f13[_0x401e('0x128')]][_0x401e('0xb8')]];for(var _0x5809b0=0x0;_0x5809b0=0x0?!![]:![];})[_0x401e('0xb5')](myreject(_0x139407)));}}else{_0x55a56d[_0x401e('0x12e')](ami['Action']({'action':_0x401e('0x14d'),'command':util['format'](_0x401e('0x14e'),_0x6e47d1,!_[_0x401e('0x3e')](config['timezones'][_0x4fb661])?_0x4fb661:'')})[_0x401e('0xbc')](function(_0x10b0f8){return _0x10b0f8[_0x401e('0x150')][_0x401e('0x151')](_0x401e('0x152'))>=0x0?!![]:![];})[_0x401e('0xb5')](myreject(_0x139407)));}BPromise[_0x401e('0x153')](_0x55a56d)['then'](function(_0x3fe348){var _0x814871=_[_0x401e('0x154')](_0x3fe348);if(_0x814871){return _0x4a87a5(_0x814871);}else{_0x2bee32[_0x401e('0x3f')]=_0x1c342c?_0x401e('0x155'):_0x401e('0x156');return _0x139407(msgResponse('[ifTime][promiseAll]','Failure','Global:\x20'+_0x1c342c+'\x20'+_0x4e33d0+_0x401e('0x157')+util[_0x401e('0x99')](_0x6e47d1,{'showHidden':![],'depth':null})+_0x401e('0x158')+_0x4fb661));}})['catch'](function(_0x56f813){return _0x139407(msgResponse(_0x401e('0x144'),_0x401e('0x146'),JSON['stringify'](_0x56f813)));});});};Dialer[_0x401e('0x1a')][_0x401e('0x159')]=function(_0x323b61){var _0x471daa=this;return function(){switch(_0x323b61[_0x401e('0x58')]){case'progressive':freeVariablesPredictive(_0x323b61);_0x471daa['handlePower'](_0x323b61,0x1);break;case _0x401e('0x15a'):freeVariablesPredictive(_0x323b61);_0x471daa[_0x401e('0x15b')](_0x323b61,_0x323b61['dialPowerLevel']);break;case _0x401e('0x8'):_0x471daa[_0x401e('0x8')](_0x323b61);break;case _0x401e('0x7'):freeVariablesPredictive(_0x323b61);_0x471daa[_0x401e('0x15b')](_0x323b61,0x1);break;default:freeVariablesPredictive(_0x323b61);logger[_0x401e('0x98')]('Queue',_0x323b61['name'],_0x401e('0x15c'));}};};Dialer[_0x401e('0x1a')][_0x401e('0x15d')]=function(_0x284fe4){var _0x513452=this;return function(){_0x513452[_0x401e('0x15e')](_0x284fe4);};};Dialer[_0x401e('0x1a')][_0x401e('0x9')]=function(_0x48548c){var _0x12fac1=this;if(isNotPreview(_0x48548c['dialMethod'])){if(isVoiceQueueOutbound(_0x48548c[_0x401e('0x4c')])&&isActive(_0x48548c['dialActive'])){_0x48548c['sendMessageOneNotActive']=!![];BPromise[_0x401e('0xbb')]()['then'](checkIsLoggedIn(_0x48548c,_0x48548c[_0x401e('0x4f')]))[_0x401e('0xbc')](checkIsActive(_0x48548c,_0x48548c[_0x401e('0x57')]))[_0x401e('0xbc')](checkInterval(_0x48548c))['then'](_0x12fac1[_0x401e('0x141')](_0x48548c))[_0x401e('0xbc')](_0x12fac1[_0x401e('0x15f')](_0x48548c[_0x401e('0x160')],_0x48548c['dialTimezone'],_0x48548c[_0x401e('0x40')],_0x48548c))[_0x401e('0xbc')](_0x12fac1[_0x401e('0x145')](_0x48548c[_0x401e('0x43')],_0x48548c['dialTimezone'],_0x48548c[_0x401e('0x40')],_0x48548c))[_0x401e('0xbc')](_0x12fac1[_0x401e('0x159')](_0x48548c))[_0x401e('0xb5')](loggerCatchQueueSummary('[syncQueueSummary]',_0x48548c));}else{notSendMessagesQueue(_0x48548c);}}else{freeVariablesPredictive(_0x48548c);}};Dialer[_0x401e('0x1a')]['syncCampaigns']=function(){var _0x255146=this;var _0x34fea1;for(var _0x58e285 in this[_0x401e('0x20')]){if(this['campaigns'][_0x401e('0xaf')](_0x58e285)){_0x34fea1=this['campaigns'][_0x58e285];if(isCampaignIvr(_0x34fea1[_0x401e('0x4c')])&&isActive(_0x34fea1[_0x401e('0xdc')])){_0x34fea1[_0x401e('0xa3')]=!![];BPromise[_0x401e('0xbb')]()[_0x401e('0xbc')](checkIsActive(_0x34fea1,_0x34fea1[_0x401e('0xdc')]))[_0x401e('0xbc')](checkInterval(_0x34fea1))[_0x401e('0xbc')](_0x255146['checkIsTrunkReachable'](_0x34fea1))[_0x401e('0xbc')](_0x255146[_0x401e('0x15f')](_0x34fea1[_0x401e('0x160')],_0x34fea1[_0x401e('0x161')],_0x34fea1[_0x401e('0x40')],_0x34fea1))[_0x401e('0xbc')](_0x255146[_0x401e('0x145')](_0x34fea1[_0x401e('0x43')],_0x34fea1[_0x401e('0x161')],_0x34fea1[_0x401e('0x40')],_0x34fea1))['then'](_0x255146[_0x401e('0x15d')](_0x34fea1))[_0x401e('0xb5')](loggerCatchQueueSummary(_0x401e('0x162'),_0x34fea1));}else{notSendMessagesCampaign(_0x34fea1);}}}};function getCallerIdRandom(_0x1ba0f8,_0xaf5592){var _0x4100a2,_0x16ed94,_0x8b6e85;if(_0xaf5592<=0x0){_0xaf5592=0x1;}_0x4100a2=new RegExp('\x5cw{0,'+_0xaf5592+'}$');_0x16ed94=Math['pow'](0xa,_0xaf5592-0x1);_0x8b6e85=Math[_0x401e('0x163')](0xa,_0xaf5592)-0x1;return util[_0x401e('0xdd')]('%s',_[_0x401e('0x164')](_0x1ba0f8,_0x4100a2,_[_0x401e('0x165')](_0x16ed94,_0x8b6e85)));}function extractCalleridName(_0x4f6f5f){var _0x2bbda5=_0x4f6f5f['match'](/"(.*?)"/);return _0x2bbda5?_0x2bbda5[0x1]:_0x4f6f5f;}function extractCalleridNumber(_0x50ace6){var _0x29b7ef=_0x50ace6[_0x401e('0x166')](/<(.*?)>/);return _0x29b7ef?_0x29b7ef[0x1]:_0x50ace6;}Dialer['prototype'][_0x401e('0x167')]=function(_0x205949,_0x5ec824){var _0x7cebbd=this;var _0x3b77a5=uuid['v4']();this[_0x401e('0xad')][_0x3b77a5]=new Action(_0x205949,_0x5ec824,_0x3b77a5);return new BPromise(function(_0x4bd44c,_0x21e5f6){if(_[_0x401e('0x3e')](_0x205949)&&_0x401e('0x168')!==typeof _0x205949){return _0x21e5f6(msgResponse(_0x401e('0x169'),'Failure','voiceQueue\x20is\x20undefine'));}if(_[_0x401e('0x3e')](_0x5ec824['Contact'][_0x401e('0x16a')])||_0x5ec824[_0x401e('0x16b')]['phone']===null){return _0x21e5f6(msgResponse(_0x401e('0x169'),_0x401e('0x146'),_0x401e('0x16c')));}var _0x3fbe32={'XMD-CALLERID':_0x7cebbd[_0x401e('0xad')][_0x3b77a5][_0x401e('0x16d')](),'XMD-AGI':_0x205949['dialQueueProject']?util[_0x401e('0xdd')](_0x401e('0x16e'),ipAgi,_0x205949[_0x401e('0x109')]):_0x401e('0x16f'),'XMD-AGIAFTER':_0x205949[_0x401e('0x112')]?util['format'](_0x401e('0x16e'),ipAgi,_0x205949[_0x401e('0x112')]):_0x401e('0x16f'),'XMD-QUEUE':_0x205949[_0x401e('0x4c')]===_0x401e('0x4d')?util['format'](_0x401e('0x170'),_0x205949[_0x401e('0x40')],_0x205949[_0x401e('0x171')]||'',_0x205949['dialAgiAfterHangupAgent']?'c':'',_0x205949[_0x401e('0x119')]||0x3):'NONE','XMD-CONTACTID':_0x5ec824['ContactId'],'XMD-CDRTYPE':_0x401e('0x172'),'CALLERID(all)':_0x7cebbd[_0x401e('0xad')][_0x3b77a5]['getCaller'](),'XMD-AMD':_0x205949[_0x401e('0xfe')]?_0x401e('0x173'):_0x401e('0x16f'),'XMD-DESTINATION':_0x401e('0x174')};if(_0x205949[_0x401e('0xfe')]){_0x3fbe32[_0x401e('0x175')]=_0x205949[_0x401e('0x176')]||0x9c4;_0x3fbe32[_0x401e('0x177')]=_0x205949[_0x401e('0x178')]||0x5dc;_0x3fbe32[_0x401e('0x179')]=_0x205949[_0x401e('0x17a')]||0x320;_0x3fbe32[_0x401e('0x17b')]=_0x205949['dialAMDTotalAnalysisTime']||0x1388;_0x3fbe32['XMD-AMDMINWORDLENGTH']=_0x205949[_0x401e('0x17c')]||0x64;_0x3fbe32[_0x401e('0x17d')]=_0x205949[_0x401e('0x17e')]||0x32;_0x3fbe32[_0x401e('0x17f')]=_0x205949['dialAMDMaximumNumberOfWords']||0x3;_0x3fbe32['XMD-AMDSILENCETHRESHOLD']=_0x205949[_0x401e('0x180')]||0x100;_0x3fbe32['XMD-AMDMAXIMUMWORDLENGTH']=_0x205949[_0x401e('0x181')]||0x1388;}if(_0x205949['type']==='outbound'){_0x3fbe32[_0x401e('0x182')]=_0x5ec824['VoiceQueueId'];}else{_0x3fbe32[_0x401e('0x183')]=_0x5ec824[_0x401e('0xfd')];}for(var _0x14a887 in _0x5ec824[_0x401e('0x16b')]){if(_0x5ec824[_0x401e('0x16b')][_0x401e('0xaf')](_0x14a887)){if(isNotNull(_0x5ec824[_0x401e('0x16b')][_0x14a887])&&_0x14a887!=='id'&&_0x14a887!==_0x401e('0x184')&&_0x14a887!==_0x401e('0x185')&&_0x14a887!=='updatedAt'){_0x3fbe32[util[_0x401e('0xdd')](_0x401e('0x186'),_0x401e('0x187'),_[_0x401e('0x188')](_0x14a887))]=_0x5ec824['Contact'][_0x14a887];}}}var _0x4c2116=_0x7cebbd[_0x401e('0x189')](_0x205949[_0x401e('0x77')])?getCallerId(_0x205949[_0x401e('0x77')][_0x401e('0x78')],_0x205949[_0x401e('0x59')],_0x205949[_0x401e('0x18a')]>0x0?getCallerIdRandom(_0x205949[_0x401e('0x5a')],_0x205949[_0x401e('0x18a')]):_0x205949['dialOriginateCallerIdNumber']):getCallerId(_[_0x401e('0xb1')](_0x205949['TrunkBackup'])?_0x205949[_0x401e('0x77')][_0x401e('0x78')]:_0x205949[_0x401e('0x142')]['callerid'],_0x205949[_0x401e('0x59')],_0x205949[_0x401e('0x18a')]>0x0?getCallerIdRandom(_0x205949[_0x401e('0x5a')],_0x205949['dialRandomLastDigitCallerIdNumber']):_0x205949['dialOriginateCallerIdNumber']);if(_0x4c2116){_0x3fbe32['XMD-ORIGINATECALLERIDNAME']=_0x7cebbd['actions'][_0x3b77a5]['originatecalleridname']=extractCalleridName(_0x4c2116);_0x3fbe32['XMD-ORIGINATECALLERIDNUM']=_0x7cebbd['actions'][_0x3b77a5][_0x401e('0x18b')]=extractCalleridNumber(_0x4c2116);}return ami[_0x401e('0xb2')]({'actionid':_0x3b77a5,'action':_0x401e('0x169'),'channel':_0x7cebbd[_0x401e('0x189')](_0x205949[_0x401e('0x77')])?util[_0x401e('0xdd')](_0x401e('0x18c'),_0x205949['Trunk'][_0x401e('0x40')],isNotNull(_0x205949['dialPrefix'])?_0x205949[_0x401e('0x18d')][_0x401e('0x18e')]()||'':'',_0x205949[_0x401e('0x18f')]>0x0?_0x5ec824[_0x401e('0x16b')][_0x401e('0x16a')][_0x401e('0x190')](_0x205949[_0x401e('0x18f')]):_0x5ec824[_0x401e('0x16b')]['phone']):util[_0x401e('0xdd')](_0x401e('0x18c'),_[_0x401e('0xb1')](_0x205949[_0x401e('0x142')])?_0x205949[_0x401e('0x77')][_0x401e('0x40')]:_0x205949[_0x401e('0x142')][_0x401e('0x40')],isNotNull(_0x205949[_0x401e('0x18d')])?_0x205949[_0x401e('0x18d')]['trim']()||'':'',_0x205949[_0x401e('0x18f')]>0x0?_0x5ec824[_0x401e('0x16b')][_0x401e('0x16a')][_0x401e('0x190')](_0x205949[_0x401e('0x18f')]):_0x5ec824[_0x401e('0x16b')][_0x401e('0x16a')]),'callerid':_0x4c2116,'Exten':_0x401e('0x174'),'Context':_0x401e('0x191'),'Priority':'1','variable':_0x3fbe32,'timeout':(_0x205949[_0x401e('0x5b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3b77a5})['then'](function(_0x5d2e9e){return _0x4bd44c(_0x5d2e9e);})[_0x401e('0xb5')](function(_0x4f61ec){_0x205949[_0x401e('0x66')]+=0x1;var _0x94b79b=new History(_0x7cebbd['actions'][_0x3b77a5]);logger[_0x401e('0x98')](util['format'](_0x401e('0x192'),JSON[_0x401e('0x48')](_0x4f61ec)));_0x94b79b[_0x401e('0xaa')]=0xe;_0x94b79b[_0x401e('0xab')]=_0x401e('0x193');_0x94b79b[_0x401e('0x11f')]=moment()[_0x401e('0xdd')]('YYYY-MM-DD\x20HH:mm:ss');_0x94b79b[_0x401e('0x120')]=_0x94b79b[_0x401e('0x11f')];_0x7cebbd[_0x401e('0xce')](_0x94b79b)[_0x401e('0xb5')](loggerCatch(_0x401e('0x194')));_0x7cebbd[_0x401e('0xcc')](_0x94b79b)[_0x401e('0xb5')](loggerCatch(_0x401e('0x194')))[_0x401e('0x1d')](function(){delete _0x7cebbd[_0x401e('0xad')][_0x3b77a5];return _0x21e5f6(msgResponse(_0x401e('0x169'),'Error',_0x401e('0x195')));});});});};Dialer[_0x401e('0x1a')]['syncOriginateResponse']=function(_0x1f3c55){var _0x394a89=this[_0x401e('0xad')][_0x1f3c55['actionid']];var _0xfb241c=this;if(_0x394a89){delete this[_0x401e('0xad')][_0x1f3c55[_0x401e('0x128')]];_0x394a89[_0x401e('0x196')]=moment()[_0x401e('0xdd')](_0x401e('0xfc'));var _0x7bee76=_0x394a89[_0x401e('0x4c')]===_0x401e('0x93')?this[_0x401e('0x20')][_0x394a89[_0x401e('0xb8')]]:this[_0x401e('0x1f')][_0x394a89[_0x401e('0x197')]()];if(!this[_0x401e('0xdb')](_0x1f3c55[_0x401e('0x198')])){this[_0x401e('0xb7')](_0x7bee76);return this['callProgressDetecting'](_0x394a89,_0x7bee76,_0x1f3c55)[_0x401e('0xbc')](function(_0x16cdc6){})[_0x401e('0xb5')](loggerCatch(_0x401e('0x199')));}else{this[_0x401e('0x26')][_0x1f3c55['uniqueid']]=_0x394a89;}}};Dialer[_0x401e('0x1a')][_0x401e('0x19a')]=function(_0x11fac3,_0x31b3e7,_0x2f3df0){var _0x2c5a52=new History(_0x31b3e7);if(_0x2c5a52[_0x401e('0xf0')]+_0x2c5a52[_0x401e('0xf1')]+_0x2c5a52[_0x401e('0xf2')]+_0x2c5a52[_0x401e('0xf3')]+_0x2c5a52[_0x401e('0x103')]+_0x2c5a52['countabandonedretry']+_0x2c5a52[_0x401e('0xed')]+_0x2c5a52[_0x401e('0xf5')]>=_0x2f3df0['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x11fac3){case 0x3:if(_0x2c5a52[_0x401e('0xf2')]>=_0x2f3df0['dialNoAnswerMaxRetry']-0x1){return!![];}else{this[_0x401e('0xc4')]({'active':![],'countnoanswerretry':_0x2c5a52[_0x401e('0xf2')]+=0x1,'scheduledat':moment()[_0x401e('0xf9')](_0x2f3df0[_0x401e('0x19b')],'minutes')[_0x401e('0xdd')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2c5a52['ContactId'],'ListId':_0x2c5a52[_0x401e('0xd6')],'VoiceQueueId':_0x2c5a52[_0x401e('0xd8')]||undefined,'CampaignId':_0x2c5a52['CampaignId']||undefined})[_0x401e('0xb5')](loggerCatch(_0x401e('0x19c')));}break;case 0x5:if(_0x2c5a52[_0x401e('0xf0')]>=_0x2f3df0[_0x401e('0x19d')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countbusyretry':_0x2c5a52[_0x401e('0xf0')]+=0x1,'scheduledat':moment()['add'](_0x2f3df0[_0x401e('0x19e')],_0x401e('0xfb'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2c5a52['ContactId'],'ListId':_0x2c5a52[_0x401e('0xd6')],'VoiceQueueId':_0x2c5a52[_0x401e('0xd8')]||undefined,'CampaignId':_0x2c5a52['CampaignId']||undefined})[_0x401e('0xb5')](loggerCatch('[rescheduleContact]\x20[Busy]'));}break;case 0x8:if(_0x2c5a52[_0x401e('0xf1')]>=_0x2f3df0[_0x401e('0x19f')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countcongestionretry':_0x2c5a52[_0x401e('0xf1')]+=0x1,'scheduledat':moment()['add'](_0x2f3df0[_0x401e('0x1a0')],'minutes')['format'](_0x401e('0xfc')),'ContactId':_0x2c5a52[_0x401e('0xd5')],'ListId':_0x2c5a52[_0x401e('0xd6')],'VoiceQueueId':_0x2c5a52[_0x401e('0xd8')]||undefined,'CampaignId':_0x2c5a52[_0x401e('0xfd')]||undefined})[_0x401e('0xb5')](loggerCatch(_0x401e('0x1a1')));}break;case 0x0:if(_0x2c5a52[_0x401e('0xf3')]>=_0x2f3df0[_0x401e('0x1a2')]-0x1){return!![];}else{this[_0x401e('0xc4')]({'active':![],'countnosuchnumberretry':_0x2c5a52[_0x401e('0xf3')]+=0x1,'scheduledat':moment()[_0x401e('0xf9')](_0x2f3df0[_0x401e('0x1a3')],_0x401e('0xfb'))[_0x401e('0xdd')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2c5a52[_0x401e('0xd5')],'ListId':_0x2c5a52['ListId'],'VoiceQueueId':_0x2c5a52[_0x401e('0xd8')]||undefined,'CampaignId':_0x2c5a52[_0x401e('0xfd')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x2c5a52[_0x401e('0x103')]>=_0x2f3df0['dialDropMaxRetry']-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countdropretry':_0x2c5a52[_0x401e('0x103')]+=0x1,'scheduledat':moment()[_0x401e('0xf9')](_0x2f3df0[_0x401e('0x1a4')],_0x401e('0xfb'))[_0x401e('0xdd')](_0x401e('0xfc')),'ContactId':_0x2c5a52['ContactId'],'ListId':_0x2c5a52[_0x401e('0xd6')],'VoiceQueueId':_0x2c5a52[_0x401e('0xd8')]||undefined,'CampaignId':_0x2c5a52[_0x401e('0xfd')]||undefined})[_0x401e('0xb5')](loggerCatch('[rescheduleContact][Drop]'));}break;case 0xb:if(_0x2c5a52[_0x401e('0xf4')]>=_0x2f3df0[_0x401e('0x125')]-0x1){return!![];}else{this[_0x401e('0xc4')]({'active':![],'countabandonedretry':_0x2c5a52[_0x401e('0xf4')]+=0x1,'scheduledat':moment()[_0x401e('0xf9')](_0x2f3df0['dialAbandonedRetryFrequency'],_0x401e('0xfb'))['format'](_0x401e('0xfc')),'ContactId':_0x2c5a52[_0x401e('0xd5')],'ListId':_0x2c5a52[_0x401e('0xd6')],'VoiceQueueId':_0x2c5a52['VoiceQueueId']||undefined,'CampaignId':_0x2c5a52['CampaignId']||undefined})[_0x401e('0xb5')](loggerCatch(_0x401e('0x126')));}break;case 0x13:if(_0x2c5a52[_0x401e('0xed')]>=_0x2f3df0['dialMachineMaxRetry']-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countmachineretry':_0x2c5a52[_0x401e('0xed')]+=0x1,'scheduledat':moment()[_0x401e('0xf9')](_0x2f3df0[_0x401e('0xfa')],_0x401e('0xfb'))['format'](_0x401e('0xfc')),'ContactId':_0x2c5a52[_0x401e('0xd5')],'ListId':_0x2c5a52[_0x401e('0xd6')],'VoiceQueueId':_0x2c5a52[_0x401e('0xd8')]||undefined,'CampaignId':_0x2c5a52[_0x401e('0xfd')]||undefined})[_0x401e('0xb5')](loggerCatch(_0x401e('0x106')));}break;case 0x14:if(_0x2c5a52[_0x401e('0xf5')]>=_0x2f3df0[_0x401e('0x1a5')]-0x1){return!![];}else{this[_0x401e('0xc4')]({'active':![],'countagentrejectretry':_0x2c5a52[_0x401e('0xf5')]+=0x1,'scheduledat':moment()[_0x401e('0xf9')](_0x2f3df0[_0x401e('0x1a6')],_0x401e('0xfb'))[_0x401e('0xdd')](_0x401e('0xfc')),'ContactId':_0x2c5a52['ContactId'],'ListId':_0x2c5a52[_0x401e('0xd6')],'VoiceQueueId':_0x2c5a52[_0x401e('0xd8')]||undefined,'CampaignId':_0x2c5a52[_0x401e('0xfd')]||undefined})[_0x401e('0xb5')](loggerCatch(_0x401e('0x1a7')));}break;default:return!![];}};Dialer[_0x401e('0x1a')][_0x401e('0x1a8')]=function(_0x29be42,_0x3620c6,_0x267546){var _0x54c65b=this;var _0x1385eb=new History(_0x29be42);return new BPromise(function(_0x5381da,_0x16f6a8){if(_[_0x401e('0x3e')](_0x3620c6)&&_0x401e('0x168')!==typeof _0x3620c6){return _0x16f6a8(msgResponse(_0x401e('0x1a9'),_0x401e('0x146'),'entity\x20is\x20undefine'));}if(_['isUndefined'](_0x267546)&&_0x401e('0x168')!==typeof _0x267546){return _0x16f6a8(msgResponse(_0x401e('0x1a9'),_0x401e('0x146'),_0x401e('0x1aa')));}switch(_0x267546[_0x401e('0x10f')]){case'0':_0x3620c6['outboundNoSuchCallsDay']+=0x1;_0x1385eb[_0x401e('0xaa')]=0x0;_0x1385eb[_0x401e('0xab')]='NoSuchNumber';_0x1385eb['countnosuchnumberretry']+=0x1;_0x1385eb['countglobal']+=0x1;console[_0x401e('0x1ab')](_0x401e('0x1ac'),ut[_0x401e('0x1ad')](_0x29be42,_0x401e('0x1ae')));ami['emit'](_0x401e('0x1af'),ut['buildObj'](_0x29be42,'nosuchnumber'));_0x54c65b[_0x401e('0xce')](_0x1385eb)[_0x401e('0xb5')](loggerCatch(_0x401e('0x102')));if(_0x54c65b[_0x401e('0x19a')](0x0,_0x29be42,_0x3620c6)){if(_0x1385eb[_0x401e('0xf3')]>=_0x3620c6[_0x401e('0x1a2')]){_0x54c65b[_0x401e('0x105')](_0x1385eb,_0x5381da,_0x16f6a8,_0x401e('0x1b0'));}else{_0x54c65b[_0x401e('0xf7')](_0x1385eb,_0x5381da,_0x16f6a8,_0x401e('0x1b0'));}}break;case'3':_0x3620c6[_0x401e('0x64')]+=0x1;_0x1385eb['state']=0x3;_0x1385eb[_0x401e('0xab')]=_0x401e('0x1b1');_0x1385eb[_0x401e('0xf2')]+=0x1;_0x1385eb['countglobal']+=0x1;console['log'](_0x401e('0x1b2'),_0x267546);console['log'](_0x401e('0x1b3'),_0x29be42);console[_0x401e('0x1ab')](_0x401e('0x1b4'),_0x3620c6);console[_0x401e('0x1ab')](_0x401e('0x1b5'),_0x1385eb);console[_0x401e('0x1ab')](_0x401e('0x1b6'),ut[_0x401e('0x1ad')](_0x29be42,_0x401e('0x1b7')));ami[_0x401e('0x4b')](_0x401e('0x1b8'),ut[_0x401e('0x1ad')](_0x29be42,'noanswer'));_0x54c65b['createHistory'](_0x1385eb)[_0x401e('0xb5')](loggerCatch(_0x401e('0x1b9')));if(_0x54c65b[_0x401e('0x19a')](0x3,_0x29be42,_0x3620c6)){if(_0x1385eb[_0x401e('0xf2')]>=_0x3620c6['dialNoAnswerMaxRetry']){_0x54c65b[_0x401e('0x105')](_0x1385eb,_0x5381da,_0x16f6a8,_0x401e('0x1ba'));}else{_0x54c65b[_0x401e('0xf7')](_0x1385eb,_0x5381da,_0x16f6a8,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x3620c6[_0x401e('0x5f')]+=0x1;_0x1385eb[_0x401e('0xaa')]=0x5;_0x1385eb[_0x401e('0xab')]='Busy';_0x1385eb[_0x401e('0xf0')]+=0x1;_0x1385eb[_0x401e('0xee')]+=0x1;console[_0x401e('0x1ab')](_0x401e('0x1bb'),ut['buildObj'](_0x29be42,_0x401e('0x1bc')));ami[_0x401e('0x4b')](_0x401e('0x1bd'),ut['buildObj'](_0x29be42,_0x401e('0x1bc')));_0x54c65b[_0x401e('0xce')](_0x1385eb)[_0x401e('0xb5')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x54c65b[_0x401e('0x19a')](0x5,_0x29be42,_0x3620c6)){if(_0x1385eb[_0x401e('0xf0')]>=_0x3620c6[_0x401e('0x19d')]){_0x54c65b[_0x401e('0x105')](_0x1385eb,_0x5381da,_0x16f6a8,_0x401e('0x1be'));}else{_0x54c65b[_0x401e('0xf7')](_0x1385eb,_0x5381da,_0x16f6a8,_0x401e('0x1be'));}}break;case'8':_0x3620c6[_0x401e('0x60')]+=0x1;_0x1385eb[_0x401e('0xaa')]=0x8;_0x1385eb['statedesc']='Congestion';_0x1385eb['countcongestionretry']+=0x1;_0x1385eb[_0x401e('0xee')]+=0x1;_0x54c65b['createHistory'](_0x1385eb)[_0x401e('0xb5')](loggerCatch(_0x401e('0x1bf')));if(_0x54c65b[_0x401e('0x19a')](0x8,_0x29be42,_0x3620c6)){if(_0x1385eb['countcongestionretry']>=_0x3620c6[_0x401e('0x19f')]){_0x54c65b[_0x401e('0x105')](_0x1385eb,_0x5381da,_0x16f6a8,_0x401e('0x1c0'));}else{_0x54c65b[_0x401e('0xf7')](_0x1385eb,_0x5381da,_0x16f6a8,_0x401e('0x1c0'));}}break;case'11':_0x3620c6[_0x401e('0x1c1')]+=0x1;_0x1385eb[_0x401e('0xaa')]=0xb;_0x1385eb[_0x401e('0xab')]=_0x401e('0x1c2');_0x1385eb[_0x401e('0xf4')]+=0x1;_0x1385eb['countglobal']+=0x1;_0x54c65b['createHistory'](_0x1385eb)[_0x401e('0xb5')](loggerCatch(_0x401e('0x127')));if(_0x54c65b[_0x401e('0x19a')](0xb,_0x29be42,_0x3620c6)){if(_0x1385eb['countabandonedretry']>=_0x3620c6[_0x401e('0x125')]){_0x54c65b[_0x401e('0x105')](_0x1385eb,_0x5381da,_0x16f6a8,_0x401e('0x1c3'));}else{_0x54c65b[_0x401e('0xf7')](_0x1385eb,_0x5381da,_0x16f6a8,_0x401e('0x1c3'));}}break;case'20':_0x3620c6[_0x401e('0x68')]+=0x1;_0x1385eb[_0x401e('0xaa')]=0x14;_0x1385eb[_0x401e('0xab')]=_0x401e('0x1c4');_0x1385eb['countagentrejectretry']+=0x1;_0x1385eb[_0x401e('0xee')]+=0x1;_0x54c65b[_0x401e('0xce')](_0x1385eb)['catch'](loggerCatch(_0x401e('0x1c5')));if(_0x54c65b[_0x401e('0x19a')](0x14,_0x29be42,_0x3620c6)){if(_0x1385eb[_0x401e('0xf5')]>=_0x3620c6[_0x401e('0x1a5')]){_0x54c65b[_0x401e('0x105')](_0x1385eb,_0x5381da,_0x16f6a8,'reason\x2020\x20agentreject');}else{_0x54c65b[_0x401e('0xf7')](_0x1385eb,_0x5381da,_0x16f6a8,_0x401e('0x1c6'));}}break;default:_0x3620c6[_0x401e('0x69')]+=0x1;_0x1385eb['state']=0xc;_0x1385eb['statedesc']=_0x267546[_0x401e('0x10f')];_0x54c65b[_0x401e('0xce')](_0x1385eb)[_0x401e('0xb5')](loggerCatch(_0x401e('0x1c7')));if(_0x54c65b['checkRetriveMax'](_0x267546[_0x401e('0x10f')],_0x29be42,_0x3620c6)){if(_0x1385eb[_0x401e('0xf0')]+_0x1385eb[_0x401e('0xf1')]+_0x1385eb[_0x401e('0xf2')]+_0x1385eb[_0x401e('0xf3')]+_0x1385eb['countdropretry']+_0x1385eb[_0x401e('0xf4')]+_0x1385eb['countmachineretry']+_0x1385eb[_0x401e('0xf5')]>=_0x3620c6[_0x401e('0xf6')]){_0x54c65b[_0x401e('0xf7')](_0x1385eb,_0x5381da,_0x16f6a8,_0x267546[_0x401e('0x10f')]);}else{_0x54c65b[_0x401e('0x105')](_0x1385eb,_0x5381da,_0x16f6a8,_0x267546[_0x401e('0x10f')]);}}}});};Dialer[_0x401e('0x1a')][_0x401e('0xf7')]=function(_0x45d9a9,_0x25da1b,_0x3474f2,_0x3e5631){var _0x117746=new Final(_0x45d9a9);_0x117746[_0x401e('0xaa')]=0xf;_0x117746['statedesc']='Global';this['createStateFinal'](_0x117746,_0x25da1b,_0x3474f2,_0x3e5631);};Dialer['prototype'][_0x401e('0x105')]=function(_0x359118,_0x3cd6a8,_0x28a1b8,_0xa6d0dc){this[_0x401e('0xcc')](_0x359118)[_0x401e('0xbc')](function(_0xe8ca4c){return _0x3cd6a8(msgResponse('[callProgressDetecting]',_0x401e('0x1c8'),_0xa6d0dc));})[_0x401e('0xb5')](function(_0x4f805d){return _0x28a1b8(msgResponse(_0x401e('0x1c9'),_0x401e('0x146'),_0x401e('0x1ca')));});};Dialer[_0x401e('0x1a')][_0x401e('0x8')]=function(_0x4b7272){var _0x2dc457=this;var _0x4c73e6=_0x4b7272['dialPredictiveOptimizationPercentage']/0x64;var _0x41fd76=_0x4b7272[_0x401e('0x63')]/(_0x4b7272[_0x401e('0x63')]+_0x4b7272[_0x401e('0x5d')]);var _0x64c57e=Math['round'](_0x4b7272[_0x401e('0x71')]*(_0x4b7272[_0x401e('0x1cb')]/0x64));var _0x146ce4=Math[_0x401e('0x1cc')](_0x4b7272[_0x401e('0x71')]*(_0x4b7272[_0x401e('0x1cd')]/0x64));var _0x48e548=_0x4b7272[_0x401e('0x1ce')]+_0x4b7272[_0x401e('0x52')];var _0xd5301=Math[_0x401e('0x1cf')](_0x4b7272[_0x401e('0x8a')]*_0x4b7272[_0x401e('0x75')]*_0x4b7272[_0x401e('0x6e')]*_0x4b7272[_0x401e('0x6f')]);if(_['isUndefined'](_0x4b7272[_0x401e('0x29')])){if(!_['isUndefined'](_0x4b7272['startPredictive'])){_0x4b7272[_0x401e('0x28')]=undefined;loggerPredictive[_0x401e('0x98')](_0x401e('0x1d0'),_0x401e('0x1d1'));}if(!_[_0x401e('0x3e')](_0x4b7272[_0x401e('0x91')])){loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0x401e('0x1d2'));clearInterval(_0x4b7272[_0x401e('0x91')]);_0x4b7272['handlePredictive']=undefined;}_0x4b7272[_0x401e('0x29')]=moment()[_0x401e('0xdd')](_0x401e('0xfc'));loggerPredictive['info'](_0x4b7272[_0x401e('0x40')],'collection\x20data\x20in\x20progressive\x20at',_0x4b7272[_0x401e('0x29')]);this[_0x401e('0x15b')](_0x4b7272,0x1);}else if(ifInterval(_0x4b7272['dialPredictiveInterval'],_0x4b7272[_0x401e('0x29')])){this['handlePower'](_0x4b7272,0x1);loggerPredictiveCalls[_0x401e('0x7d')]('[startMethodPredictive][StartProgressive][Loop]',_0x4b7272[_0x401e('0x29')],_0x4b7272[_0x401e('0x40')]);_0x4b7272[_0x401e('0x8a')]=0x0;_0x4b7272[_0x401e('0x6d')]=0x0;}else if(_0x4c73e6<_0x41fd76&&_0x4b7272[_0x401e('0x1d3')]===_0x401e('0x1d4')){freeVariablesPredictive(_0x4b7272);loggerPredictive[_0x401e('0x7d')](_0x401e('0x1d5'),_0x401e('0x1d6'),_0x41fd76,_0x401e('0x29'),_0x4b7272['name']);}else if(_0xd5301<_0x4b7272['predictiveIntervalErlangCallsDroppedCalls']&&_0x4b7272[_0x401e('0x1d3')]==='dropRate'){freeVariablesPredictive(_0x4b7272);loggerPredictive[_0x401e('0x7d')](_0x401e('0x1d7'),_0x401e('0x1d8'),_0xd5301,_0x401e('0x1d9'),_0x4b7272[_0x401e('0x6d')],'startProgressive',_0x4b7272[_0x401e('0x40')]);}else if(!ifInterval(_0x4b7272[_0x401e('0x1da')],_0x4b7272[_0x401e('0x29')])&&_[_0x401e('0x3e')](_0x4b7272[_0x401e('0x28')])&&!_[_0x401e('0x3e')](_0x4b7272[_0x401e('0x29')])){_0x4b7272[_0x401e('0x28')]=moment()[_0x401e('0xdd')](_0x401e('0xfc'));loggerPredictive[_0x401e('0x7d')](_0x4b7272[_0x401e('0x40')],_0x401e('0x1db'),_0x4b7272[_0x401e('0x28')]);this[_0x401e('0xc1')](_0x4b7272[_0x401e('0x1da')])[_0x401e('0xbc')](this[_0x401e('0x1dc')](_0x4b7272))[_0x401e('0xbc')](mergeDataErlangB(_0x4b7272))[_0x401e('0xbc')](this['startMethodPredictive'](_0x4b7272))[_0x401e('0xb5')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x4b7272));}else if(!ifInterval(_0x4b7272[_0x401e('0x1da')],_0x4b7272[_0x401e('0x28')])){_0x4b7272['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x4b7272['startPredictive']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x401e('0x7d')](_0x4b7272[_0x401e('0x40')],_0x401e('0x1dd'),_0x4b7272['startPredictive']);clearInterval(_0x4b7272[_0x401e('0x91')]);_0x4b7272[_0x401e('0x91')]=undefined;this[_0x401e('0xc1')](_0x4b7272['dialPredictiveInterval'])[_0x401e('0xbc')](this[_0x401e('0x1dc')](_0x4b7272))[_0x401e('0xbc')](mergeDataErlangB(_0x4b7272))[_0x401e('0xbc')](this[_0x401e('0x1de')](_0x4b7272))['catch'](loggerCatchPredictive(_0x401e('0x1df'),_0x4b7272));}else if(_0x4b7272[_0x401e('0x71')]&&_0x48e548<_0x4b7272['predictiveIntervalAvailable']-_0x146ce4){freeVariablesPredictive(_0x4b7272);loggerPredictive[_0x401e('0x7d')](_0x4b7272[_0x401e('0x40')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x48e548,_0x401e('0x1e0'),_0x4b7272[_0x401e('0x71')],'-',_0x146ce4,'=',_0x4b7272[_0x401e('0x71')]-_0x146ce4,')');}else if(_0x4b7272['predictiveIntervalAvailable']&&_0x48e548>_0x4b7272['predictiveIntervalAvailable']+_0x64c57e){freeVariablesPredictive(_0x4b7272);loggerPredictive['info'](_0x4b7272[_0x401e('0x40')],_0x401e('0x1e1'),_0x48e548,')\x20are\x20more\x20than\x20threshold\x20(',_0x4b7272[_0x401e('0x71')],'+',_0x64c57e,'=',_0x4b7272['predictiveIntervalAvailable']+_0x64c57e,')');}};Dialer[_0x401e('0x1a')][_0x401e('0x1dc')]=function(_0x1574a7){var _0x33a776=this;return function(_0x5589ed){return new BPromise(function(_0x2011c7,_0x328efa){_[_0x401e('0xd3')](_0x1574a7,_0x5589ed[0x0]);if(checkGetDataPredictive(_0x5589ed[0x0])){var _0x134895=_0x1574a7[_0x401e('0x71')]=_0x1574a7['talking']+_0x1574a7[_0x401e('0x1ce')];var _0x762632=_0x1574a7['dialPredictiveInterval']*0x3c;var _0x19c8d0=_0x5589ed[0x0][_0x401e('0x6a')]+_0x5589ed[0x0]['predictiveIntervalAvgHoldtime'];var _0x40652b=(_0x5589ed[0x0]['predictiveIntervalAnsweredCalls']+_0x5589ed[0x0][_0x401e('0x6c')]+_0x5589ed[0x0][_0x401e('0x6b')])/_0x5589ed[0x0]['predictiveIntervalTotalCalls'];_0x1574a7[_0x401e('0x6e')]=_0x40652b>0x0?_0x40652b:0x1;switch(_0x1574a7[_0x401e('0x1d3')]){case _0x401e('0x1d4'):var _0x4b7fbf=_0x1574a7['dialPredictiveOptimizationPercentage']/0x64;return _0x33a776['abandonmentRate'](_0x134895,_0x762632,_0x19c8d0,_0x40652b,_0x4b7fbf)['then'](function(_0x418140){return _0x2011c7(_0x418140);});case _0x401e('0x1e2'):var _0x5234ca=_0x1574a7['dialPredictiveOptimizationPercentage']/0x64;return _0x33a776[_0x401e('0x1e3')](_0x134895,_0x762632,_0x19c8d0,_0x40652b,_0x5234ca)[_0x401e('0xbc')](function(_0x3a748d){return _0x2011c7(_0x3a748d);});default:return _0x328efa(msgResponse(_0x401e('0x1e4'),_0x401e('0x146'),_0x401e('0x1e5')));}}else{return _0x328efa(msgResponse(_0x401e('0x1e4'),_0x401e('0x146'),'check\x20failure'));}});};};Dialer[_0x401e('0x1a')][_0x401e('0x1e6')]=function(_0x11af0d){var _0x5dcf7e=this;return function(_0x56c992){return new BPromise(function(_0x2fd911,_0x58c8bf){_[_0x401e('0xd3')](_0x11af0d,_0x56c992[0x0]);if(checkGetDataPredictive(_0x56c992[0x0])){loggerPredictive[_0x401e('0x7d')](JSON[_0x401e('0x48')](_0x56c992[0x0]));if(_0x11af0d[_0x401e('0x1d3')]===_0x401e('0x1d4')){return _0x5dcf7e[_0x401e('0xca')](_0x11af0d['id'])['then'](function(_0x10af5d){var _0x5e3ed2=_0x11af0d[_0x401e('0x4f')]-_0x10af5d[0x0][_0x401e('0x1e7')];var _0x3b255a=_0x11af0d[_0x401e('0x1da')]*0x3c;var _0x319fa4=_0x56c992[0x0][_0x401e('0x6a')]+_0x56c992[0x0][_0x401e('0x83')];var _0xfdb5e7=(_0x56c992[0x0]['predictiveIntervalAnsweredCalls']+_0x56c992[0x0][_0x401e('0x6c')]+_0x56c992[0x0][_0x401e('0x6b')])/_0x56c992[0x0][_0x401e('0x72')];var _0x1f17fc=_0x11af0d[_0x401e('0x1e8')]/0x64;_0x11af0d['predictiveIntervalPauses']=_0x10af5d[0x0][_0x401e('0x1e7')]||0x0;_0x11af0d['predictiveIntervalHitRate']=_0xfdb5e7>0x0?_0xfdb5e7:0x1;return _0x5dcf7e[_0x401e('0x1e9')](_0x5e3ed2,_0x3b255a,_0x319fa4,_0xfdb5e7,_0x1f17fc);})['then'](function(_0x505f4f){return _0x2fd911(_0x505f4f);})[_0x401e('0xb5')](function(_0x57a078){return _0x58c8bf(msgResponse(_0x401e('0x1ea'),_0x401e('0x146'),JSON['stringify'](_0x57a078)));});}if(_0x11af0d[_0x401e('0x1d3')]===_0x401e('0x1e2')){return _0x5dcf7e[_0x401e('0xca')](_0x11af0d['id'])[_0x401e('0xbc')](function(_0x81a9de){var _0x25d310=_0x11af0d[_0x401e('0x4f')]-_0x81a9de[0x0][_0x401e('0x1e7')];var _0x2ddc06=_0x11af0d['dialPredictiveInterval']*0x3c;var _0x5eb197=_0x56c992[0x0][_0x401e('0x6a')]+_0x56c992[0x0]['predictiveIntervalAvgHoldtime'];var _0x2dcf71=(_0x56c992[0x0][_0x401e('0x7f')]+_0x56c992[0x0][_0x401e('0x6c')]+_0x56c992[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x56c992[0x0][_0x401e('0x72')];var _0x2f9df=_0x11af0d[_0x401e('0x1e8')]/0x64;_0x11af0d[_0x401e('0x70')]=_0x81a9de[0x0][_0x401e('0x1e7')]||0x0;_0x11af0d[_0x401e('0x6e')]=_0x2dcf71>0x0?_0x2dcf71:0x1;return _0x5dcf7e[_0x401e('0x1e3')](_0x25d310,_0x2ddc06,_0x5eb197,_0x2dcf71,_0x2f9df);})[_0x401e('0xbc')](function(_0x4d0fb4){return _0x2fd911(_0x4d0fb4);})[_0x401e('0xb5')](function(_0x1136cb){return _0x58c8bf(msgResponse(_0x401e('0x1ea'),_0x401e('0x146'),JSON['stringify'](_0x1136cb)));});}}else{return _0x58c8bf(msgResponse(_0x401e('0x1e4'),'Failure',_0x401e('0x1eb')));}});};};Dialer[_0x401e('0x1a')][_0x401e('0x1de')]=function(_0x12f060){var _0x347912=this;return function(){var _0x12cb61=0x0;var _0x31450c=Math[_0x401e('0x1cf')](_0x12f060[_0x401e('0x74')]*0x3e8);if(_0x31450c>0x0){_0x31450c=_0x31450c<0x64?0x64:_0x31450c;loggerPredictive[_0x401e('0x7d')](_0x12f060['name'],_0x401e('0x1ec'),_0x31450c,'milliseconds');_0x12f060[_0x401e('0x91')]=setInterval(function(){_0x347912[_0x401e('0x91')](_0x12f060);loggerPredictiveCalls[_0x401e('0x7d')](_0x401e('0x1ed'),_0x12cb61+=0x1);},_0x31450c);}else{loggerPredictive[_0x401e('0x7d')](_0x12f060[_0x401e('0x40')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x401e('0x1a')]['checkContactBlack']=function(_0x26ba0d,_0x4aa7f2){var _0x52720c=this;return function(_0x294839){if(_['isEmpty'](_0x294839)){if(_[_0x401e('0xb1')](_0x4aa7f2[_0x401e('0xd7')])||!_0x4aa7f2[_0x401e('0x1ee')]){if(_0x26ba0d[_0x401e('0x58')]===_0x401e('0x7')){_0x26ba0d[_0x401e('0x130')]=_['isUndefined'](_0x26ba0d[_0x401e('0x130')])?!![]:_0x26ba0d[_0x401e('0x130')];var _0x268fe4=uuid['v4']();_0x52720c['actions'][_0x268fe4]=new Action(_0x26ba0d,_0x4aa7f2,_0x268fe4);loggerBooked[_0x401e('0x7d')](_0x401e('0x1ef'),_0x268fe4,_0x401e('0x1f0'),JSON[_0x401e('0x48')](_0x26ba0d[_0x401e('0x130')]),_0x401e('0x1f1'),_0x26ba0d[_0x401e('0x40')]);if(_0x26ba0d[_0x401e('0x130')]){_0x26ba0d[_0x401e('0x130')]=![];_0x52720c[_0x401e('0x2b')][_0x52720c['actions'][_0x268fe4][_0x401e('0xb8')]]=[];ami[_0x401e('0xb2')]({'actionid':_0x268fe4,'action':_0x401e('0x1f2'),'queue':_0x26ba0d[_0x401e('0x40')]})[_0x401e('0xb5')](function(_0x3f2e64){_0x52720c['updateOriginated'](_0x26ba0d);_0x52720c[_0x401e('0xc4')]({'active':![],'ContactId':_0x52720c['actions'][_0x268fe4][_0x401e('0xd5')],'ListId':_0x52720c['actions'][_0x268fe4][_0x401e('0xd6')],'VoiceQueueId':_0x52720c['actions'][_0x268fe4]['VoiceQueueId']||undefined,'CampaignId':_0x52720c[_0x401e('0xad')][_0x268fe4][_0x401e('0xfd')]||undefined})[_0x401e('0xb5')](loggerCatch(_0x401e('0x1f3')));delete _0x52720c[_0x401e('0xad')][_0x268fe4];});}else{loggerBooked[_0x401e('0x7d')]('[booked][checkContactBlack][else]',JSON[_0x401e('0x48')](_0x26ba0d['queueStatusComplete']),_0x401e('0x1f1'),_0x26ba0d[_0x401e('0x40')]);_0x52720c[_0x401e('0xb7')](_0x26ba0d);_0x52720c[_0x401e('0xc4')]({'active':![],'ContactId':_0x52720c[_0x401e('0xad')][_0x268fe4][_0x401e('0xd5')],'ListId':_0x52720c[_0x401e('0xad')][_0x268fe4][_0x401e('0xd6')],'VoiceQueueId':_0x52720c[_0x401e('0xad')][_0x268fe4][_0x401e('0xd8')]||undefined,'CampaignId':_0x52720c[_0x401e('0xad')][_0x268fe4][_0x401e('0xfd')]||undefined})[_0x401e('0xb5')](loggerCatch(_0x401e('0x1f3')));delete _0x52720c[_0x401e('0xad')][_0x268fe4];}}else{return _0x52720c[_0x401e('0x167')](_0x26ba0d,_0x4aa7f2);}}else{if(getDiff(_0x4aa7f2[_0x401e('0x1f4')])<_0x26ba0d['dialRecallMeTimeout']*0x3c){if(_0x4aa7f2[_0x401e('0x1f5')]&&!_0x4aa7f2['Agent'][_0x401e('0x1f6')]){_0x52720c[_0x401e('0x1e')][_0x401e('0x133')](_0x4aa7f2['id'])[_0x401e('0x1d')](function(){_0x52720c['updateOriginated'](_0x26ba0d);});}else{_0x52720c[_0x401e('0xc5')]({'active':![]},_0x4aa7f2['id'],0x1)[_0x401e('0x1d')](function(){console[_0x401e('0x1ab')](_0x401e('0x1f7'));_0x52720c[_0x401e('0xb7')](_0x26ba0d);});}}else{_0x26ba0d[_0x401e('0x67')]+=0x1;_0x52720c[_0x401e('0xb7')](_0x26ba0d);if(_0x26ba0d[_0x401e('0x1f8')]){_0x52720c['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4aa7f2[_0x401e('0xd5')],'ListId':_0x4aa7f2[_0x401e('0xd6')],'VoiceQueueId':_0x4aa7f2['VoiceQueueId']||undefined,'CampaignId':_0x4aa7f2[_0x401e('0xfd')]||undefined})[_0x401e('0xb5')](loggerCatch(_0x401e('0x1f9')));_0x52720c[_0x401e('0xce')](createObjHistory(_0x26ba0d,_0x4aa7f2,'RECALLINQUEUE',0x17,'RecallInQueue'))[_0x401e('0xb5')](loggerCatch(_0x401e('0x1fa')));}else{_0x52720c[_0x401e('0xe1')](createObjHistory(_0x26ba0d,_0x4aa7f2,_0x401e('0x1fb'),0x16,'RecallFailedTimeout'),'[Originate][HistoryRecallClose][historyCatch]',_0x401e('0x1fc'));}}}}else{_0x26ba0d['outboundBlacklistCallsDay']+=0x1;_0x52720c['saveInDb'](createObjHistory(_0x26ba0d,_0x4aa7f2,_0x401e('0x1fd'),0xd,_0x401e('0x1fe')),_0x401e('0x1ff'),'[Originate][MoveBlacklist]');throw'inBlackList';}};};Dialer[_0x401e('0x1a')][_0x401e('0x15e')]=function(_0x5873fa){var _0x49a95d=this;var _0x3e4638=[];var _0x29780f=_0x5873fa[_0x401e('0x200')]-_0x5873fa[_0x401e('0x73')]-_0x5873fa[_0x401e('0x201')];emitCampaignSummary(_0x5873fa);if(_0x29780f>0x0){if(_0x29780f>this[_0x401e('0x23')]){_0x29780f=this[_0x401e('0x23')];}_0x5873fa[_0x401e('0x201')]+=_0x29780f;this[_0x401e('0xc9')](_0x5873fa['id'],_0x29780f,_0x5873fa['dialOrderByScheduledAt'])[_0x401e('0xbc')](function(_0x546855){_0x5873fa[_0x401e('0x201')]-=_0x29780f;_0x5873fa['temp']=_0x5873fa['temp']>0x0?_0x5873fa[_0x401e('0x201')]:0x0;if(!checkContactEmpty(_0x546855)){_0x5873fa[_0x401e('0x3f')]=_0x401e('0xa1');logger[_0x401e('0x7d')]('[getContactCampaign2][Empty]'+_0x5873fa['name']);}else{_0x5873fa[_0x401e('0x73')]+=_0x546855[_0x401e('0x138')];_0x5873fa[_0x401e('0x3f')]='RUNNING';for(var _0x30deae=0x0;_0x30deae<_0x546855['length'];_0x30deae+=0x1){_0x5873fa[_0x401e('0x202')]+=0x1;if(_['isNil'](_0x546855[_0x30deae])||_[_0x401e('0xb1')](_0x546855[_0x30deae][_0x401e('0x16b')])||_['isNil'](_0x546855[_0x30deae][_0x401e('0x16b')][_0x401e('0x16a')])){_0x49a95d[_0x401e('0x203')]('[actionOriginate]\x20',_0x5873fa,_0x546855[_0x30deae]);}else{_0x49a95d['checkIsBlackListIvr'](_[_0x401e('0xd4')](_0x546855[_0x30deae],['CampaignId',_0x401e('0x204')]))[_0x401e('0xbc')](_0x49a95d['checkContactBlack'](_0x5873fa,_0x546855[_0x30deae]))['catch'](_0x49a95d[_0x401e('0xd1')](_0x401e('0x205'),_0x5873fa));}}}})['catch'](loggerGetContactDialer(_0x401e('0x206'),_0x5873fa,_0x29780f));}};Dialer['prototype'][_0x401e('0x15b')]=function(_0x12e90a,_0x41aa2b){var _0x4c8e6f=this;var _0x2f1d03=[];var _0x23f1da=_0x41aa2b>=0x1?_0x41aa2b:0x1;var _0x4e62a4=[];if(_0x12e90a['dialMethod']===_0x401e('0x7')){_0x23f1da=0x1;}var _0x4ae595=Math[_0x401e('0x1cf')](_0x12e90a[_0x401e('0x1ce')]*_0x23f1da)-_0x12e90a[_0x401e('0x73')]-_0x12e90a['temp'];emitVoiceQueueSummary(_0x12e90a);if(_0x12e90a[_0x401e('0x207')]>0x0){var _0x29d0c0=_0x12e90a[_0x401e('0x207')]-_0x12e90a['originated']-_0x12e90a['talking']-_0x12e90a[_0x401e('0x201')]-_0x12e90a[_0x401e('0x50')];if(_0x4ae595>_0x29d0c0){_0x4ae595=_0x29d0c0;}}if(_0x4ae595>0x0){if(_0x12e90a[_0x401e('0x58')]===_0x401e('0x7')){_0x4ae595=0x1;}if(_0x4ae595>this['maxNumberOriginate']){_0x4ae595=this['maxNumberOriginate'];}_0x12e90a['temp']+=_0x4ae595;for(var _0x5c418c in this[_0x401e('0x21')]){if(this[_0x401e('0x21')][_0x401e('0xaf')](_0x5c418c)){if(this[_0x401e('0x21')][_0x5c418c][_0x401e('0xaa')]==='not_inuse'&&this[_0x401e('0x21')][_0x5c418c]['status']===_0x401e('0xdf')){_0x2f1d03['push'](this[_0x401e('0x21')][_0x5c418c]['id']);}}}this[_0x401e('0xc7')](_0x12e90a['id'],_0x2f1d03,_0x4ae595,_0x12e90a[_0x401e('0x208')])[_0x401e('0xbc')](function(_0x470cf5){_0x12e90a[_0x401e('0x201')]-=_0x4ae595;_0x12e90a[_0x401e('0x201')]=_0x12e90a[_0x401e('0x201')]>0x0?_0x12e90a[_0x401e('0x201')]:0x0;if(!checkContactEmpty(_0x470cf5)){_0x4c8e6f[_0x401e('0xba')](_0x12e90a)[_0x401e('0xbc')](sendMessageReschedule(_0x12e90a))[_0x401e('0xb5')](loggerCatch(_0x401e('0x209')));}else{_0x12e90a['originated']+=_0x470cf5[_0x401e('0x138')];_0x12e90a[_0x401e('0x3f')]=_0x12e90a[_0x401e('0x58')]==='booked'?_0x401e('0x173'):_0x401e('0x20a');for(var _0x33a099=0x0;_0x33a099<_0x470cf5[_0x401e('0x138')];_0x33a099+=0x1){if(_[_0x401e('0xb1')](_0x470cf5[_0x33a099])||_['isNil'](_0x470cf5[_0x33a099]['Contact'])||_['isNil'](_0x470cf5[_0x33a099][_0x401e('0x16b')][_0x401e('0x16a')])){_0x4c8e6f[_0x401e('0x203')]('[actionOriginate]\x20',_0x12e90a,_0x470cf5[_0x33a099]);}else{_0x4c8e6f['checkIsBlackList'](_['pick'](_0x470cf5[_0x33a099],[_0x401e('0xd8'),_0x401e('0x204')]))[_0x401e('0xbc')](_0x4c8e6f['checkContactBlack'](_0x12e90a,_0x470cf5[_0x33a099]))[_0x401e('0xb5')](_0x4c8e6f[_0x401e('0xd1')]('[actionOriginate]\x20',_0x12e90a));}}}})[_0x401e('0xb5')](loggerGetContactDialer(_0x401e('0x20b'),_0x12e90a,_0x4ae595));}};Dialer['prototype'][_0x401e('0x91')]=function(_0x332591){var _0x505036=this;if(_0x332591[_0x401e('0x207')]>0x0){var _0x31836d=_0x332591[_0x401e('0x207')]-_0x332591['originated']-_0x332591[_0x401e('0x52')];if(_0x31836d>0x0){this['tryOriginatePredictive'](_0x332591);}else{loggerPredictiveCalls[_0x401e('0x7d')](_0x401e('0x20c'));}}else{this[_0x401e('0x20d')](_0x332591);}};Dialer[_0x401e('0x1a')][_0x401e('0x20d')]=function(_0x16f24f){var _0x55bdf8=this;var _0x407e0c=[];_0x16f24f[_0x401e('0x73')]+=0x1;for(var _0x39f230 in this[_0x401e('0x21')]){if(this[_0x401e('0x21')][_0x401e('0xaf')](_0x39f230)){if(this[_0x401e('0x21')][_0x39f230][_0x401e('0xaa')]==='not_inuse'&&this[_0x401e('0x21')][_0x39f230][_0x401e('0xb3')]===_0x401e('0xdf')){_0x407e0c['push'](this[_0x401e('0x21')][_0x39f230]['id']);}}}this[_0x401e('0xc7')](_0x16f24f['id'],_0x407e0c,0x1,_0x16f24f[_0x401e('0x208')])[_0x401e('0xbc')](function(_0x389488){if(!checkContactEmpty(_0x389488)){checkContactLowerLimitOriginate(_0x16f24f,0x1,0x0);_0x55bdf8[_0x401e('0xba')](_0x16f24f)['then'](sendMessageReschedule(_0x16f24f))[_0x401e('0xb5')](loggerCatch('[countReScheduled]\x20'));}else{_0x16f24f['message']=_0x401e('0x20a');if(_['isNil'](_0x389488[0x0])||_[_0x401e('0xb1')](_0x389488[0x0][_0x401e('0x16b')])||_[_0x401e('0xb1')](_0x389488[0x0]['Contact'][_0x401e('0x16a')])){_0x55bdf8[_0x401e('0x203')](_0x401e('0x20e'),_0x16f24f,_0x389488[0x0]);}else{_0x55bdf8[_0x401e('0xbd')](_['pick'](_0x389488[0x0],[_0x401e('0xd8'),'Contact.phone']))['then'](_0x55bdf8[_0x401e('0x20f')](_0x16f24f,_0x389488[0x0]))['catch'](_0x55bdf8[_0x401e('0xd1')](_0x401e('0x210'),_0x16f24f));}}})[_0x401e('0xb5')](loggerGetContactDialer(_0x401e('0x211'),_0x16f24f,0x1));emitVoiceQueueSummary(_0x16f24f);};Dialer[_0x401e('0x1a')][_0x401e('0x1e9')]=function(_0x320940,_0x27cc59,_0x4a9c1e,_0x659f94,_0x5796f8,_0x587c6c){loggerPredictive[_0x401e('0x7d')](_0x401e('0x212'));loggerPredictive['info'](_0x401e('0x213'),_0x320940);loggerPredictive[_0x401e('0x7d')](_0x401e('0x214'),_0x27cc59);loggerPredictive[_0x401e('0x7d')](_0x401e('0x215'),_0x4a9c1e);loggerPredictive[_0x401e('0x7d')](_0x401e('0x216'),_0x659f94);loggerPredictive['info'](_0x401e('0x217'),_0x5796f8);loggerPredictive[_0x401e('0x7d')](_0x401e('0x85'));return new BPromise(function(_0x3468f0,_0x28660a){if(_0x320940<=0x0||isNaN(_0x320940)){return _0x28660a(msgResponse(_0x401e('0x218'),_0x401e('0x47'),_0x401e('0x219')+_0x320940));}if(_0x4a9c1e<=0x0||isNaN(_0x4a9c1e)){return _0x28660a(msgResponse(_0x401e('0x218'),_0x401e('0x47'),'Ts\x20=\x20'+_0x4a9c1e));}if(_0x659f94<=0x0||isNaN(_0x659f94)){return _0x28660a(msgResponse(_0x401e('0x218'),_0x401e('0x47'),_0x401e('0x21a')+_0x659f94));}if(_0x27cc59<=0x0||isNaN(_0x27cc59)){return _0x28660a(msgResponse(_0x401e('0x218'),_0x401e('0x47'),_0x401e('0x21b')+_0x27cc59));}if(_0x5796f8<=0x0||isNaN(_0x5796f8)){return _0x28660a(msgResponse('[abandonmentRate]',_0x401e('0x47'),_0x401e('0x21c')+_0x5796f8));}_0x587c6c=_0x587c6c||0x0;var _0x349407=0x1/_0x4a9c1e;var _0x54a815=0x0;var _0x350897=0x0;var _0x6c7e91=0x0;var _0x42842d=0x0;for(var _0x525449=0x0;_0x6c7e91<_0x5796f8;_0x525449+=0x1){_0x350897=_0x525449/_0x27cc59;_0x54a815=(_0x659f94*_0x350897+_0x587c6c)/_0x349407;_0x6c7e91=erlangb(_0x54a815,_0x320940);_0x42842d=_0x54a815/_0x320940*(0x1-erlangb(_0x54a815,_0x320940));}return _0x3468f0({'erlangCalls':_0x525449,'erlangCallToSecond':_0x27cc59/_0x525449,'erlangAbandonmentRate':_0x6c7e91,'erlangBusyFactor':_0x42842d});});};Dialer[_0x401e('0x1a')][_0x401e('0x1e3')]=function(_0x2496ad,_0x5f5b15,_0x59c7bd,_0x4a774d,_0x21c020,_0x2b28df){loggerPredictive['info'](_0x401e('0x21d'));loggerPredictive[_0x401e('0x7d')](_0x401e('0x213'),_0x2496ad);loggerPredictive[_0x401e('0x7d')](_0x401e('0x214'),_0x5f5b15);loggerPredictive[_0x401e('0x7d')](_0x401e('0x215'),_0x59c7bd);loggerPredictive[_0x401e('0x7d')](_0x401e('0x216'),_0x4a774d);loggerPredictive[_0x401e('0x7d')](_0x401e('0x21e'),_0x21c020);loggerPredictive['info'](_0x401e('0x85'));return new BPromise(function(_0x178142,_0x3a74b3){if(_0x2496ad<=0x0||isNaN(_0x2496ad)){return _0x3a74b3(msgResponse(_0x401e('0x21f'),_0x401e('0x47'),_0x401e('0x219')+_0x2496ad));}if(_0x59c7bd<=0x0||isNaN(_0x59c7bd)){return _0x3a74b3(msgResponse(_0x401e('0x21f'),_0x401e('0x47'),_0x401e('0x220')+_0x59c7bd));}if(_0x4a774d<=0x0||isNaN(_0x4a774d)){return _0x3a74b3(msgResponse('[busyFactor]','Error','p\x20=\x20'+_0x4a774d));}if(_0x5f5b15<=0x0||isNaN(_0x5f5b15)){return _0x3a74b3(msgResponse(_0x401e('0x21f'),_0x401e('0x47'),_0x401e('0x21b')+_0x5f5b15));}if(_0x21c020<=0x0||isNaN(_0x21c020)){return _0x3a74b3(msgResponse('[busyFactor]',_0x401e('0x47'),_0x401e('0x221')+_0x21c020));}_0x2b28df=_0x2b28df||0x0;var _0x20d4b3=0x1/_0x59c7bd;var _0x6c27c3=0x0;var _0x3de21f=0x0;var _0x1a1a57=0x0;var _0x70f30f=0x0;for(var _0x3e8fc6=0x0;_0x70f30f<_0x21c020;_0x3e8fc6+=0x1){_0x3de21f=_0x3e8fc6/_0x5f5b15;_0x6c27c3=(_0x4a774d*_0x3de21f+_0x2b28df)/_0x20d4b3;_0x1a1a57=erlangb(_0x6c27c3,_0x2496ad);_0x70f30f=_0x6c27c3/_0x2496ad*(0x1-erlangb(_0x6c27c3,_0x2496ad));}return _0x178142({'erlangCalls':_0x3e8fc6,'erlangCallToSecond':_0x5f5b15/_0x3e8fc6,'erlangAbandonmentRate':_0x1a1a57,'erlangBusyFactor':_0x70f30f});});};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 c784895..a13d677 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 _0x1c10=['UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x2210ff,_0x85bbb0){var _0x1e21fb=function(_0xdfa158){while(--_0xdfa158){_0x2210ff['push'](_0x2210ff['shift']());}};_0x1e21fb(++_0x85bbb0);}(_0x1c10,0x15e));var _0x01c1=function(_0x6ff427,_0x1ebe10){_0x6ff427=_0x6ff427-0x0;var _0x28820c=_0x1c10[_0x6ff427];return _0x28820c;};'use strict';var util=require(_0x01c1('0x0'));var _=require(_0x01c1('0x1'));var moment=require('moment');function getSeconds(_0xc00c11,_0x55e7e8){var _0xda1e3e=moment(_0xc00c11)[_0x01c1('0x2')](0x0);var _0x4013b7=moment(_0x55e7e8)[_0x01c1('0x2')](0x0);return _0xda1e3e[_0x01c1('0x3')](_0x4013b7,_0x01c1('0x4'));}function QueueCallerAbandon(_0x31ac31,_0x363874){this[_0x01c1('0x5')]=_0x31ac31[_0x01c1('0x5')];this['type']=_0x31ac31[_0x01c1('0x6')];this['campaigntype']=_0x31ac31[_0x01c1('0x6')]==='outbound'?_0x01c1('0x7'):_0x31ac31[_0x01c1('0x6')];this[_0x01c1('0x8')]=_0x31ac31['countbusyretry'];this[_0x01c1('0x9')]=_0x31ac31[_0x01c1('0x9')];this[_0x01c1('0xa')]=_0x31ac31[_0x01c1('0xa')];this[_0x01c1('0xb')]=_0x31ac31['countbusyretry']+_0x31ac31['countcongestionretry']+_0x31ac31[_0x01c1('0xa')]+_0x31ac31[_0x01c1('0xc')]+_0x31ac31[_0x01c1('0xd')]+_0x31ac31[_0x01c1('0xe')]+_0x31ac31[_0x01c1('0xf')]+_0x31ac31[_0x01c1('0x10')];this['countnosuchnumberretry']=_0x31ac31[_0x01c1('0xc')];this[_0x01c1('0xd')]=_0x31ac31[_0x01c1('0xd')];this[_0x01c1('0xe')]=_0x31ac31[_0x01c1('0xe')];this[_0x01c1('0xf')]=_0x31ac31[_0x01c1('0xf')];this[_0x01c1('0x10')]=_0x31ac31[_0x01c1('0x10')];this[_0x01c1('0x11')]=_0x363874[_0x01c1('0x11')];this[_0x01c1('0x12')]=_0x31ac31[_0x01c1('0x13')];this[_0x01c1('0x14')]=_0x31ac31[_0x01c1('0x15')];this[_0x01c1('0x16')]=_0x31ac31[_0x01c1('0x16')];this[_0x01c1('0x17')]=_0x31ac31[_0x01c1('0x17')];this[_0x01c1('0x18')]=_0x31ac31[_0x01c1('0x18')];this[_0x01c1('0x19')]=this[_0x01c1('0x18')];this[_0x01c1('0x1a')]=getSeconds(_0x31ac31[_0x01c1('0x17')],_0x31ac31[_0x01c1('0x16')]);this['holdtime']=getSeconds(this[_0x01c1('0x18')],_0x31ac31[_0x01c1('0x17')]);this[_0x01c1('0x1b')]=0x0;this['queue']=_0x363874['queue'];this[_0x01c1('0x1c')]=_0x363874[_0x01c1('0x1d')];this[_0x01c1('0x1e')]=_0x363874['reason'];this[_0x01c1('0x1f')]=_0x31ac31['callback'];this[_0x01c1('0x20')]=_0x31ac31[_0x01c1('0x20')];this[_0x01c1('0x21')]=_0x31ac31['callbackat'];this[_0x01c1('0x22')]=_0x31ac31['recallme'];this[_0x01c1('0x23')]=_0x31ac31[_0x01c1('0x23')];this['ListId']=_0x31ac31[_0x01c1('0x24')];this['UserId']=_0x31ac31[_0x01c1('0x25')];this[_0x01c1('0x26')]=_0x31ac31[_0x01c1('0x26')];this[_0x01c1('0x27')]=_0x31ac31['CampaignId'];this[_0x01c1('0x28')]=_0x31ac31[_0x01c1('0x28')]||'';this['originatecalleridname']=_0x31ac31[_0x01c1('0x29')]||'';}module[_0x01c1('0x2a')]=QueueCallerAbandon; \ No newline at end of file +var _0xd4cd=['queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','uniqueid','calleridname','calleridnum','starttime','responsetime','droptime','endtime','ringtime','membername','reason','callback','callbackuniqueid','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound'];(function(_0x4b7060,_0x368491){var _0x2ac354=function(_0x29cc08){while(--_0x29cc08){_0x4b7060['push'](_0x4b7060['shift']());}};_0x2ac354(++_0x368491);}(_0xd4cd,0x1cb));var _0xdd4c=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xd4cd[_0x6cf19c];return _0xce14f3;};'use strict';var util=require(_0xdd4c('0x0'));var _=require(_0xdd4c('0x1'));var moment=require('moment');function getSeconds(_0x53bad8,_0x1661ee){var _0x5a99e8=moment(_0x53bad8)[_0xdd4c('0x2')](0x0);var _0x428cfe=moment(_0x1661ee)[_0xdd4c('0x2')](0x0);return _0x5a99e8[_0xdd4c('0x3')](_0x428cfe,_0xdd4c('0x4'));}function QueueCallerAbandon(_0x165213,_0x18758f){this[_0xdd4c('0x5')]=_0x165213[_0xdd4c('0x5')];this[_0xdd4c('0x6')]=_0x165213['type'];this[_0xdd4c('0x7')]=_0x165213[_0xdd4c('0x6')]===_0xdd4c('0x8')?_0xdd4c('0x9'):_0x165213['type'];this[_0xdd4c('0xa')]=_0x165213[_0xdd4c('0xa')];this['countcongestionretry']=_0x165213[_0xdd4c('0xb')];this['countnoanswerretry']=_0x165213['countnoanswerretry'];this[_0xdd4c('0xc')]=_0x165213[_0xdd4c('0xa')]+_0x165213[_0xdd4c('0xb')]+_0x165213[_0xdd4c('0xd')]+_0x165213[_0xdd4c('0xe')]+_0x165213[_0xdd4c('0xf')]+_0x165213['countabandonedretry']+_0x165213['countmachineretry']+_0x165213[_0xdd4c('0x10')];this['countnosuchnumberretry']=_0x165213['countnosuchnumberretry'];this[_0xdd4c('0xf')]=_0x165213[_0xdd4c('0xf')];this[_0xdd4c('0x11')]=_0x165213[_0xdd4c('0x11')];this[_0xdd4c('0x12')]=_0x165213[_0xdd4c('0x12')];this[_0xdd4c('0x10')]=_0x165213[_0xdd4c('0x10')];this[_0xdd4c('0x13')]=_0x18758f[_0xdd4c('0x13')];this[_0xdd4c('0x14')]=_0x165213['name'];this[_0xdd4c('0x15')]=_0x165213['number'];this['starttime']=_0x165213[_0xdd4c('0x16')];this[_0xdd4c('0x17')]=_0x165213['responsetime'];this[_0xdd4c('0x18')]=_0x165213[_0xdd4c('0x18')];this[_0xdd4c('0x19')]=this['droptime'];this[_0xdd4c('0x1a')]=getSeconds(_0x165213['responsetime'],_0x165213[_0xdd4c('0x16')]);this['holdtime']=getSeconds(this['droptime'],_0x165213[_0xdd4c('0x17')]);this['talktime']=0x0;this[_0xdd4c('0x9')]=_0x18758f[_0xdd4c('0x9')];this[_0xdd4c('0x1b')]=_0x18758f['connectedlinename'];this[_0xdd4c('0x1c')]=_0x18758f[_0xdd4c('0x1c')];this['callback']=_0x165213[_0xdd4c('0x1d')];this['callbackuniqueid']=_0x165213[_0xdd4c('0x1e')];this['callbackat']=_0x165213['callbackat'];this['recallme']=_0x165213[_0xdd4c('0x1f')];this[_0xdd4c('0x20')]=_0x165213[_0xdd4c('0x20')];this[_0xdd4c('0x21')]=_0x165213[_0xdd4c('0x21')];this['UserId']=_0x165213['UserId'];this[_0xdd4c('0x22')]=_0x165213['VoiceQueueId'];this['CampaignId']=_0x165213[_0xdd4c('0x23')];this[_0xdd4c('0x24')]=_0x165213[_0xdd4c('0x24')]||'';this[_0xdd4c('0x25')]=_0x165213[_0xdd4c('0x25')]||'';}module[_0xdd4c('0x26')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 5844c64..aeef9f2 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 _0xdbdd=['AttachmentId','exports','util','lodash','moment','uniqueid','format','%s/%s/%s','tech','Trunk','name','localstationid','headerinfo','path'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xdbdd,0x72));var _0xddbd=function(_0x49fb96,_0x3ad5f5){_0x49fb96=_0x49fb96-0x0;var _0x30c4c7=_0xdbdd[_0x49fb96];return _0x30c4c7;};'use strict';var util=require(_0xddbd('0x0'));var _=require(_0xddbd('0x1'));var moment=require(_0xddbd('0x2'));function Action(_0x3739fc,_0x34b595,_0xb3f1c7){this[_0xddbd('0x3')]=_0x3739fc||undefined;this['channel']=util[_0xddbd('0x4')](_0xddbd('0x5'),_0x34b595[_0xddbd('0x6')],_0x34b595[_0xddbd('0x7')][_0xddbd('0x8')],_0xb3f1c7['fax']);this[_0xddbd('0x9')]=_0x34b595[_0xddbd('0x9')];this[_0xddbd('0xa')]=_0x34b595['headerinfo'];this['path']=_0xb3f1c7[_0xddbd('0xb')];this[_0xddbd('0xc')]=_0xb3f1c7[_0xddbd('0xc')];}module[_0xddbd('0xd')]=Action; \ No newline at end of file +var _0x4092=['format','%s/%s/%s','Trunk','fax','localstationid','headerinfo','path','AttachmentId','exports','util','lodash','moment','uniqueid','channel'];(function(_0x555d87,_0x207a9c){var _0x47a78e=function(_0x20691b){while(--_0x20691b){_0x555d87['push'](_0x555d87['shift']());}};_0x47a78e(++_0x207a9c);}(_0x4092,0x167));var _0x2409=function(_0x178a9c,_0x562a28){_0x178a9c=_0x178a9c-0x0;var _0x3fd933=_0x4092[_0x178a9c];return _0x3fd933;};'use strict';var util=require(_0x2409('0x0'));var _=require(_0x2409('0x1'));var moment=require(_0x2409('0x2'));function Action(_0x424166,_0x20f0aa,_0x3d8f1f){this[_0x2409('0x3')]=_0x424166||undefined;this[_0x2409('0x4')]=util[_0x2409('0x5')](_0x2409('0x6'),_0x20f0aa['tech'],_0x20f0aa[_0x2409('0x7')]['name'],_0x3d8f1f[_0x2409('0x8')]);this[_0x2409('0x9')]=_0x20f0aa['localstationid'];this['headerinfo']=_0x20f0aa[_0x2409('0xa')];this[_0x2409('0xb')]=_0x3d8f1f[_0x2409('0xb')];this[_0x2409('0xc')]=_0x3d8f1f[_0x2409('0xc')];}module[_0x2409('0xd')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 057b2a9..be3e5a4 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 _0x2843=['merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20faxRiceive\x20','faxpages','updateStatus','faxstatusstring','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','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','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Is\x20Valid','exports','util','lodash','bluebird','uuid','path','tiff2pdf','./util/gs','../../../config/logger','./channel','./util/util','./action','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','prototype','value','channelstate','channelstatedesc','variable','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','notify','fax','\x20notify\x20','stringify','catch','\x20receiveFax\x20'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2843,0x18e));var _0x3284=function(_0x3cb6dc,_0x120dd3){_0x3cb6dc=_0x3cb6dc-0x0;var _0x47ec89=_0x2843[_0x3cb6dc];return _0x47ec89;};'use strict';var util=require(_0x3284('0x0'));var _=require(_0x3284('0x1'));var BPromise=require(_0x3284('0x2'));var uuid=require(_0x3284('0x3'));var moment=require('moment');var path=require(_0x3284('0x4'));var tiff2pdf=require(_0x3284('0x5'));var gs=require(_0x3284('0x6'));var logger=require(_0x3284('0x7'))('fax');var ami=require('../ami');var rpcDb=require('./rpcDb');var Channel=require(_0x3284('0x8'));var ut=require(_0x3284('0x9'));var Action=require(_0x3284('0xa'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x3284('0xb'));var faxMessage=require(_0x3284('0xc'));function Fax(_0x5abbf3){this[_0x3284('0xd')]={};this[_0x3284('0xe')]=_0x5abbf3[_0x3284('0xe')];this[_0x3284('0xf')]=_0x5abbf3[_0x3284('0xf')];this[_0x3284('0x10')]={};ami['on'](_0x3284('0x11'),this[_0x3284('0x12')][_0x3284('0x13')](this));ami['on'](_0x3284('0x14'),this[_0x3284('0x15')][_0x3284('0x13')](this));ami['on'](_0x3284('0x16'),this[_0x3284('0x17')]['bind'](this));ami['on']('newexten',this[_0x3284('0x18')][_0x3284('0x13')](this));ami['on'](_0x3284('0x19'),this[_0x3284('0x1a')][_0x3284('0x13')](this));ami['on'](_0x3284('0x1b'),this[_0x3284('0x1c')][_0x3284('0x13')](this));ami['on'](_0x3284('0x1d'),this[_0x3284('0x1e')][_0x3284('0x13')](this));ami['on'](_0x3284('0x1f'),this[_0x3284('0x20')][_0x3284('0x13')](this));}Fax['prototype'][_0x3284('0x12')]=function(_0x91b1a3){if(_0x91b1a3[_0x3284('0x21')]===_0x3284('0x22')){for(var _0x5412bc in this[_0x3284('0xe')]){if(this[_0x3284('0xe')][_0x3284('0x23')](_0x5412bc)){if(_0x91b1a3[_0x3284('0x24')]===this['faxAccounts'][_0x5412bc][_0x3284('0x25')]){this['channels'][_0x91b1a3[_0x3284('0x26')]]={};this[_0x3284('0xd')][_0x91b1a3['uniqueid']]['channel']=_0x91b1a3[_0x3284('0x27')];this['channels'][_0x91b1a3[_0x3284('0x26')]]['id']=this[_0x3284('0xe')][_0x5412bc]['id'];this[_0x3284('0xd')][_0x91b1a3['uniqueid']][_0x3284('0x28')]=this[_0x3284('0xe')][_0x5412bc][_0x3284('0x28')];logger[_0x3284('0x29')](_0x91b1a3[_0x3284('0x26')],_0x3284('0x2a'));}}}}if(this[_0x3284('0x10')][_0x91b1a3[_0x3284('0x26')]]){this[_0x3284('0xd')][_0x91b1a3[_0x3284('0x26')]]={};this[_0x3284('0xd')][_0x91b1a3[_0x3284('0x26')]][_0x3284('0x27')]=_0x91b1a3[_0x3284('0x27')];logger['info'](_0x91b1a3[_0x3284('0x26')],_0x3284('0x2a'));}};Fax[_0x3284('0x2b')]['syncVarSet']=function(_0x40f6db){if(this['channels'][_0x40f6db[_0x3284('0x26')]]){for(var _0x5f4295 in _0x40f6db['variable']){if(_0x40f6db['variable'][_0x3284('0x23')](_0x5f4295)){this[_0x3284('0xd')][_0x40f6db['uniqueid']][_0x5f4295]=_0x40f6db[_0x3284('0x2c')];}}}};Fax[_0x3284('0x2b')][_0x3284('0x17')]=function(_0x532feb){if(this[_0x3284('0xd')][_0x532feb[_0x3284('0x26')]]){this['channels'][_0x532feb[_0x3284('0x26')]][_0x3284('0x2d')]=_0x532feb[_0x3284('0x2d')];this[_0x3284('0xd')][_0x532feb[_0x3284('0x26')]]['channelstatedesc']=_0x532feb[_0x3284('0x2e')];}};Fax[_0x3284('0x2b')][_0x3284('0x18')]=function(_0x3a0e59){if(this['channels'][_0x3a0e59['uniqueid']]){for(var _0x326f89 in _0x3a0e59[_0x3284('0x2f')]){if(_0x3a0e59['variable'][_0x3284('0x23')](_0x326f89)){this[_0x3284('0xd')][_0x3a0e59[_0x3284('0x26')]][_0x326f89]=_0x3a0e59[_0x3284('0x2c')];}}}};Fax[_0x3284('0x2b')][_0x3284('0x1a')]=function(_0x2dcc6e){if(this['channels'][_0x2dcc6e[_0x3284('0x26')]]){this['channels'][_0x2dcc6e[_0x3284('0x26')]][_0x3284('0x30')]=_0x2dcc6e[_0x3284('0x30')];this[_0x3284('0xd')][_0x2dcc6e[_0x3284('0x26')]][_0x3284('0x31')]=_0x2dcc6e[_0x3284('0x31')];this['channels'][_0x2dcc6e[_0x3284('0x26')]][_0x3284('0x25')]=_0x2dcc6e[_0x3284('0x25')];this[_0x3284('0xd')][_0x2dcc6e[_0x3284('0x26')]][_0x3284('0x32')]=_0x2dcc6e[_0x3284('0x32')];logger['info'](_0x2dcc6e[_0x3284('0x26')],_0x3284('0x33'));}};Fax[_0x3284('0x2b')][_0x3284('0x1c')]=function(_0x2c63f0){var _0x17348a=this;if(this['channels'][_0x2c63f0[_0x3284('0x26')]]){var _0x2d8c35=this[_0x3284('0xd')][_0x2c63f0[_0x3284('0x26')]]['id'];this[_0x3284('0xd')][_0x2c63f0[_0x3284('0x26')]][_0x3284('0x34')]=_0x2c63f0[_0x3284('0x34')];this['channels'][_0x2c63f0[_0x3284('0x26')]][_0x3284('0x35')]=_0x2c63f0[_0x3284('0x35')];this[_0x3284('0xd')][_0x2c63f0[_0x3284('0x26')]][_0x3284('0x25')]=_0x2c63f0[_0x3284('0x25')];this[_0x3284('0xd')][_0x2c63f0['uniqueid']]['resolution']=_0x2c63f0[_0x3284('0x36')];this[_0x3284('0xd')][_0x2c63f0['uniqueid']][_0x3284('0x37')]=_0x2c63f0[_0x3284('0x37')];this[_0x3284('0xd')][_0x2c63f0[_0x3284('0x26')]][_0x3284('0x32')]=_0x2c63f0[_0x3284('0x32')];this['channels'][_0x2c63f0[_0x3284('0x26')]][_0x3284('0x38')]=_0x2c63f0['calleridnum'];if(this['channels'][_0x2c63f0[_0x3284('0x26')]][_0x3284('0x35')]>0x0){tiff2pdf(_0x2c63f0[_0x3284('0x32')],_0x3284('0x39'),function(_0x112ff2){logger[_0x3284('0x29')](_0x2c63f0[_0x3284('0x26')],_0x3284('0x3a'),_0x112ff2[_0x3284('0x3b')]);attachment[_0x3284('0x3c')]({'name':path[_0x3284('0x3d')](_0x2c63f0[_0x3284('0x32')])['name'],'basename':path[_0x3284('0x3d')](_0x2c63f0[_0x3284('0x32')])[_0x3284('0x28')]+_0x3284('0x3e'),'type':_0x3284('0x3f')})['then'](function(_0x203861){faxAccount[_0x3284('0x40')](_0x2d8c35,{'from':_0x2c63f0['calleridnum'],'mapKey':_0x3284('0x41'),'body':path[_0x3284('0x3d')](_0x2c63f0[_0x3284('0x32')])['name']+_0x3284('0x3e'),'AttachmentId':_0x203861['id']})['catch'](function(_0x358ce0){logger['error'](_0x2c63f0[_0x3284('0x26')],_0x3284('0x42'),JSON[_0x3284('0x43')](_0x358ce0));});})[_0x3284('0x44')](function(_0x27d49f){logger['error'](_0x2c63f0[_0x3284('0x26')],'\x20receiveFax\x20',JSON[_0x3284('0x43')](_0x27d49f));});});}logger[_0x3284('0x29')](_0x2c63f0['uniqueid'],_0x3284('0x45'));}};Fax[_0x3284('0x2b')][_0x3284('0x20')]=function(_0xbc33fa){if(this[_0x3284('0x10')][_0xbc33fa[_0x3284('0x26')]]){_[_0x3284('0x46')](this[_0x3284('0xd')][_0xbc33fa[_0x3284('0x26')]],_[_0x3284('0x47')](_0xbc33fa,[_0x3284('0x48'),_0x3284('0x49')]));}};function updateStatus(_0x169520){if(_0x169520[_0x3284('0x4a')]){faxMessage[_0x3284('0x4b')](_0x169520['AttachmentId'],{'failMessage':_0x3284('0x4c')})[_0x3284('0x4d')](function(_0x39665c){ut[_0x3284('0x4e')]('[Fax][Message][Error][Updated]',_0x39665c);})['catch'](function(_0x3bc9cf){ut[_0x3284('0x4e')](_0x3284('0x4f'),_0x3bc9cf);});}else{ut['logger'](_0x3284('0x50'));}}Fax[_0x3284('0x2b')]['updateStatus']=function(_0x20eebd,_0x373093,_0xfa5c31){var _0x20e1c3=this;var _0x4d8063={};if(_0x373093){_0x4d8063={'read':_0x373093};}else{_0x4d8063={'failMessage':_0xfa5c31};}if(this[_0x3284('0x10')][_0x20eebd][_0x3284('0x4a')]){faxMessage[_0x3284('0x4b')](this[_0x3284('0x10')][_0x20eebd][_0x3284('0x4a')],_0x4d8063)['then'](function(_0x566258){ut[_0x3284('0x4e')](_0x3284('0x51'),_0x566258);})[_0x3284('0x44')](function(_0x58c5d7){ut[_0x3284('0x4e')](_0x3284('0x52'),_0x58c5d7);})[_0x3284('0x53')](function(){delete _0x20e1c3['channels'][_0x20eebd];delete _0x20e1c3[_0x3284('0x10')][_0x20eebd];});}else{ut[_0x3284('0x4e')]('[Fax][Message][NoUpdate2]');delete this[_0x3284('0xd')][_0x20eebd];delete this['actions'][_0x20eebd];}};Fax['prototype'][_0x3284('0x1e')]=function(_0xa714ef){var _0x1624e4=this;if(this[_0x3284('0xd')][_0xa714ef[_0x3284('0x26')]]){if(this[_0x3284('0x10')][_0xa714ef[_0x3284('0x26')]]){this[_0x3284('0xd')][_0xa714ef[_0x3284('0x26')]]['id']=this['actions'][_0xa714ef['uniqueid']]['id'];this['channels'][_0xa714ef[_0x3284('0x26')]][_0x3284('0x28')]=this[_0x3284('0x10')][_0xa714ef[_0x3284('0x26')]]['name'];}logger[_0x3284('0x29')](_0xa714ef[_0x3284('0x26')],this['actions'][_0xa714ef[_0x3284('0x26')]]?'\x20hangup\x20sendFile\x20':_0x3284('0x54'),JSON[_0x3284('0x43')](this['channels'][_0xa714ef[_0x3284('0x26')]]));if(this[_0x3284('0x10')][_0xa714ef['uniqueid']]){if(this[_0x3284('0xd')][_0xa714ef[_0x3284('0x26')]][_0x3284('0x55')]>0x0&&this[_0x3284('0xd')][_0xa714ef[_0x3284('0x26')]][_0x3284('0x19')]==='SUCCESS'){this['updateStatus'](_0xa714ef[_0x3284('0x26')],!![]);}else{this[_0x3284('0x56')](_0xa714ef[_0x3284('0x26')],![],this[_0x3284('0xd')][_0xa714ef[_0x3284('0x26')]]['faxstatusstring']?'SENDING\x20FAILED:\x20'+this[_0x3284('0xd')][_0xa714ef[_0x3284('0x26')]][_0x3284('0x57')]:_0x3284('0x58'));}}}};Fax[_0x3284('0x2b')][_0x3284('0x59')]=function(_0x301ee8){var _0x252398=this;return new BPromise(function(_0x235b28,_0x3085a0){_0x252398[_0x3284('0x5a')](_0x301ee8,_0x252398[_0x3284('0xe')][_0x301ee8[_0x3284('0x5b')]])[_0x3284('0x4d')](function(_0x2605a2){ut[_0x3284('0x4e')](_0x3284('0x5c'),_0x2605a2);_0x235b28(ut[_0x3284('0x3b')](_0x3284('0x5d')));})['catch'](function(_0x32c344){ut[_0x3284('0x4e')](_0x3284('0x5e'),_0x32c344);updateStatus(_0x301ee8);_0x3085a0(ut[_0x3284('0x3b')](_0x3284('0x5f')));});});};Fax[_0x3284('0x2b')][_0x3284('0x60')]=function(_0x5f2b7f){var _0xdcdbb0=this;return new BPromise(function(_0x28945f,_0xe392da){var _0x39858c=_0xdcdbb0[_0x3284('0x61')](_0xdcdbb0[_0x3284('0xe')][_0x5f2b7f[_0x3284('0x5b')]]['Trunk'],_0x5f2b7f);if(_0x39858c['isValid']){_0x28945f(ut[_0x3284('0x3b')]('Trunk\x20Reachable'));}else{_0xe392da(ut[_0x3284('0x3b')](_0x39858c['message']));}});};function originate(_0x4ea980,_0x426419,_0x252822){return new BPromise(function(_0x376fe0,_0x70a43f){if(_0x252822){var _0x55465c=util[_0x3284('0x62')](_0x3284('0x63'),path[_0x3284('0x3d')](_0x4ea980[_0x3284('0x4')])[_0x3284('0x28')],_0x4ea980[_0x3284('0x4')]);gs[_0x3284('0x64')](_0x55465c)[_0x3284('0x4d')](function(){_0x4ea980[_0x3284('0x4')]=util[_0x3284('0x62')]('%s/%s.tif',path[_0x3284('0x3d')](_0x4ea980['path'])[_0x3284('0x65')],path[_0x3284('0x3d')](_0x4ea980[_0x3284('0x4')])[_0x3284('0x28')]);_0x426419['XMF-PATH']=_0x4ea980[_0x3284('0x4')];ut['logger'](_0x3284('0x66'),'');ami[_0x3284('0x67')](ut[_0x3284('0x68')](_0x4ea980,_0x426419))[_0x3284('0x4d')](function(_0xe7ae99){_0x376fe0(_0xe7ae99);})[_0x3284('0x44')](function(_0x23a617){_0x70a43f(_0x23a617);});})[_0x3284('0x44')](function(_0x412846){_0x70a43f(_0x412846);});}else{ami['Action'](ut[_0x3284('0x68')](_0x4ea980,_0x426419))['then'](function(_0xf2eb96){_0x376fe0(_0xf2eb96);})[_0x3284('0x44')](function(_0x2d03fa){_0x70a43f(_0x2d03fa);});}});}Fax[_0x3284('0x2b')][_0x3284('0x5a')]=function(_0x3e1132,_0x1574d6){var _0x3525d1=this;return new BPromise(function(_0x49b287,_0x3b9d5d){var _0x1f5890=uuid['v4']();var _0x1a84b3=ut[_0x3284('0x69')](_0x3e1132,_0x1574d6);_0x3525d1['actions'][_0x1f5890]=new Action(_0x1f5890,_0x1574d6,_0x3e1132);var _0x3e66db=_0x3525d1['actions'][_0x1f5890];if(path[_0x3284('0x3d')](_0x3e1132[_0x3284('0x4')])[_0x3284('0x6a')]===_0x3284('0x3e')){originate(_0x3e66db,_0x1a84b3,!![])[_0x3284('0x4d')](function(_0x95ce8){_0x49b287(_0x95ce8);})[_0x3284('0x44')](function(_0x2bf8cd){_0x3b9d5d(_0x2bf8cd);});}else{originate(_0x3e66db,_0x1a84b3,![])[_0x3284('0x4d')](function(_0x529ad9){_0x49b287(_0x529ad9);})[_0x3284('0x44')](function(_0x2269a9){_0x3b9d5d(_0x2269a9);});}});};Fax[_0x3284('0x2b')][_0x3284('0x6b')]=function(_0x54e69){return!_[_0x3284('0x6c')](_0x54e69)&&!_['isNil'](_0x54e69['name'])&&!_[_0x3284('0x6c')](_0x54e69[_0x3284('0x6d')])&&_0x54e69['active']&&!_[_0x3284('0x6c')](this['trunks'][util[_0x3284('0x62')](_0x3284('0x6e'),_0x54e69[_0x3284('0x28')])])&&!_[_0x3284('0x6c')](this[_0x3284('0xf')][util[_0x3284('0x62')](_0x3284('0x6e'),_0x54e69[_0x3284('0x28')])][_0x3284('0x31')])&&(this[_0x3284('0xf')][util[_0x3284('0x62')](_0x3284('0x6e'),_0x54e69['name'])][_0x3284('0x31')]==='reachable'||this['trunks'][util[_0x3284('0x62')](_0x3284('0x6e'),_0x54e69[_0x3284('0x28')])][_0x3284('0x31')]==='unmonitored');};Fax['prototype'][_0x3284('0x61')]=function(_0xe1bf,_0x2afa26){if(!this['isTrunkReachable'](_0xe1bf)){ut['logger'](_0x3284('0x6f'),_[_0x3284('0x6c')](_0xe1bf)?'':_0xe1bf['name']+_0x3284('0x70'));return{'isValid':![],'message':_0x3284('0x71')};}if(_['isNil'](_0x2afa26[_0x3284('0x41')])){ut['logger'](_0x3284('0x72'),JSON['stringify'](_0x2afa26));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x3284('0x6c')](_0x2afa26[_0x3284('0x4')])){ut[_0x3284('0x4e')]('[Fax][checkTrunk][Empty\x20path]',JSON['stringify'](_0x2afa26));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x3284('0x73')};};module[_0x3284('0x74')]=Fax; \ No newline at end of file +var _0xd4d1=['syncNewState','newexten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','syncNewchannel','context','hasOwnProperty','exten','localstationid','channels','uniqueid','name','info','\x20syncNewchannel\x20','channel','prototype','variable','value','channelstate','channelstatedesc','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','.pdf','application/pdf','then','catch','stringify','\x20receiveFax\x20','merge','pick','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED','send','execOriginate','FaxAccountId','Fax\x20received','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','fax','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','bind','varset','syncVarSet','newstate'];(function(_0xb69ad4,_0x1bdbcf){var _0x797b27=function(_0x4c9368){while(--_0x4c9368){_0xb69ad4['push'](_0xb69ad4['shift']());}};_0x797b27(++_0x1bdbcf);}(_0xd4d1,0x14d));var _0x1d4d=function(_0x5f17ef,_0x45ed02){_0x5f17ef=_0x5f17ef-0x0;var _0x4683c0=_0xd4d1[_0x5f17ef];return _0x4683c0;};'use strict';var util=require(_0x1d4d('0x0'));var _=require(_0x1d4d('0x1'));var BPromise=require(_0x1d4d('0x2'));var uuid=require(_0x1d4d('0x3'));var moment=require(_0x1d4d('0x4'));var path=require(_0x1d4d('0x5'));var tiff2pdf=require(_0x1d4d('0x6'));var gs=require(_0x1d4d('0x7'));var logger=require('../../../config/logger')(_0x1d4d('0x8'));var ami=require('../ami');var rpcDb=require(_0x1d4d('0x9'));var Channel=require(_0x1d4d('0xa'));var ut=require(_0x1d4d('0xb'));var Action=require(_0x1d4d('0xc'));var faxAccount=require(_0x1d4d('0xd'));var attachment=require(_0x1d4d('0xe'));var faxMessage=require(_0x1d4d('0xf'));function Fax(_0x212ca8){this['channels']={};this['faxAccounts']=_0x212ca8[_0x1d4d('0x10')];this['trunks']=_0x212ca8[_0x1d4d('0x11')];this[_0x1d4d('0x12')]={};ami['on'](_0x1d4d('0x13'),this['syncNewchannel'][_0x1d4d('0x14')](this));ami['on'](_0x1d4d('0x15'),this[_0x1d4d('0x16')][_0x1d4d('0x14')](this));ami['on'](_0x1d4d('0x17'),this[_0x1d4d('0x18')][_0x1d4d('0x14')](this));ami['on'](_0x1d4d('0x19'),this['syncNewExten'][_0x1d4d('0x14')](this));ami['on'](_0x1d4d('0x1a'),this[_0x1d4d('0x1b')][_0x1d4d('0x14')](this));ami['on'](_0x1d4d('0x1c'),this[_0x1d4d('0x1d')][_0x1d4d('0x14')](this));ami['on'](_0x1d4d('0x1e'),this[_0x1d4d('0x1f')][_0x1d4d('0x14')](this));ami['on'](_0x1d4d('0x20'),this[_0x1d4d('0x21')][_0x1d4d('0x14')](this));}Fax['prototype'][_0x1d4d('0x22')]=function(_0xbbdc02){if(_0xbbdc02[_0x1d4d('0x23')]==='from-voip-provider'){for(var _0x3fa310 in this[_0x1d4d('0x10')]){if(this[_0x1d4d('0x10')][_0x1d4d('0x24')](_0x3fa310)){if(_0xbbdc02[_0x1d4d('0x25')]===this[_0x1d4d('0x10')][_0x3fa310][_0x1d4d('0x26')]){this[_0x1d4d('0x27')][_0xbbdc02[_0x1d4d('0x28')]]={};this['channels'][_0xbbdc02[_0x1d4d('0x28')]]['channel']=_0xbbdc02['channel'];this[_0x1d4d('0x27')][_0xbbdc02[_0x1d4d('0x28')]]['id']=this[_0x1d4d('0x10')][_0x3fa310]['id'];this[_0x1d4d('0x27')][_0xbbdc02[_0x1d4d('0x28')]][_0x1d4d('0x29')]=this[_0x1d4d('0x10')][_0x3fa310][_0x1d4d('0x29')];logger[_0x1d4d('0x2a')](_0xbbdc02[_0x1d4d('0x28')],_0x1d4d('0x2b'));}}}}if(this[_0x1d4d('0x12')][_0xbbdc02[_0x1d4d('0x28')]]){this[_0x1d4d('0x27')][_0xbbdc02[_0x1d4d('0x28')]]={};this[_0x1d4d('0x27')][_0xbbdc02['uniqueid']][_0x1d4d('0x2c')]=_0xbbdc02['channel'];logger[_0x1d4d('0x2a')](_0xbbdc02[_0x1d4d('0x28')],_0x1d4d('0x2b'));}};Fax[_0x1d4d('0x2d')]['syncVarSet']=function(_0x8c0d79){if(this[_0x1d4d('0x27')][_0x8c0d79[_0x1d4d('0x28')]]){for(var _0x54809a in _0x8c0d79[_0x1d4d('0x2e')]){if(_0x8c0d79[_0x1d4d('0x2e')][_0x1d4d('0x24')](_0x54809a)){this['channels'][_0x8c0d79[_0x1d4d('0x28')]][_0x54809a]=_0x8c0d79[_0x1d4d('0x2f')];}}}};Fax['prototype']['syncNewState']=function(_0x72a907){if(this[_0x1d4d('0x27')][_0x72a907[_0x1d4d('0x28')]]){this[_0x1d4d('0x27')][_0x72a907[_0x1d4d('0x28')]][_0x1d4d('0x30')]=_0x72a907[_0x1d4d('0x30')];this[_0x1d4d('0x27')][_0x72a907[_0x1d4d('0x28')]][_0x1d4d('0x31')]=_0x72a907['channelstatedesc'];}};Fax[_0x1d4d('0x2d')]['syncNewExten']=function(_0x317861){if(this['channels'][_0x317861[_0x1d4d('0x28')]]){for(var _0x29b4ae in _0x317861[_0x1d4d('0x2e')]){if(_0x317861[_0x1d4d('0x2e')][_0x1d4d('0x24')](_0x29b4ae)){this['channels'][_0x317861[_0x1d4d('0x28')]][_0x29b4ae]=_0x317861[_0x1d4d('0x2f')];}}}};Fax['prototype'][_0x1d4d('0x1b')]=function(_0x289a13){if(this[_0x1d4d('0x27')][_0x289a13[_0x1d4d('0x28')]]){this[_0x1d4d('0x27')][_0x289a13[_0x1d4d('0x28')]]['operation']=_0x289a13['operation'];this[_0x1d4d('0x27')][_0x289a13[_0x1d4d('0x28')]][_0x1d4d('0x32')]=_0x289a13[_0x1d4d('0x32')];this['channels'][_0x289a13[_0x1d4d('0x28')]][_0x1d4d('0x26')]=_0x289a13[_0x1d4d('0x26')];this[_0x1d4d('0x27')][_0x289a13['uniqueid']][_0x1d4d('0x33')]=_0x289a13['filename'];logger[_0x1d4d('0x2a')](_0x289a13[_0x1d4d('0x28')],_0x1d4d('0x34'));}};Fax['prototype'][_0x1d4d('0x1d')]=function(_0x2d8549){var _0x529a7c=this;if(this['channels'][_0x2d8549[_0x1d4d('0x28')]]){var _0xdbc9c5=this['channels'][_0x2d8549[_0x1d4d('0x28')]]['id'];this[_0x1d4d('0x27')][_0x2d8549[_0x1d4d('0x28')]][_0x1d4d('0x35')]=_0x2d8549[_0x1d4d('0x35')];this[_0x1d4d('0x27')][_0x2d8549[_0x1d4d('0x28')]][_0x1d4d('0x36')]=_0x2d8549['pagestransferred'];this[_0x1d4d('0x27')][_0x2d8549['uniqueid']]['localstationid']=_0x2d8549['localstationid'];this['channels'][_0x2d8549['uniqueid']][_0x1d4d('0x37')]=_0x2d8549[_0x1d4d('0x37')];this[_0x1d4d('0x27')][_0x2d8549[_0x1d4d('0x28')]][_0x1d4d('0x38')]=_0x2d8549[_0x1d4d('0x38')];this[_0x1d4d('0x27')][_0x2d8549[_0x1d4d('0x28')]][_0x1d4d('0x33')]=_0x2d8549[_0x1d4d('0x33')];this[_0x1d4d('0x27')][_0x2d8549[_0x1d4d('0x28')]][_0x1d4d('0x39')]=_0x2d8549['calleridnum'];if(this[_0x1d4d('0x27')][_0x2d8549[_0x1d4d('0x28')]]['pagestransferred']>0x0){tiff2pdf(_0x2d8549[_0x1d4d('0x33')],_0x1d4d('0x3a'),function(_0x5d2f2c){logger['info'](_0x2d8549[_0x1d4d('0x28')],_0x1d4d('0x3b'),_0x5d2f2c[_0x1d4d('0x3c')]);attachment['create']({'name':path['parse'](_0x2d8549[_0x1d4d('0x33')])[_0x1d4d('0x29')],'basename':path[_0x1d4d('0x3d')](_0x2d8549[_0x1d4d('0x33')])[_0x1d4d('0x29')]+_0x1d4d('0x3e'),'type':_0x1d4d('0x3f')})[_0x1d4d('0x40')](function(_0x49dfd1){faxAccount['notify'](_0xdbc9c5,{'from':_0x2d8549[_0x1d4d('0x39')],'mapKey':'fax','body':path[_0x1d4d('0x3d')](_0x2d8549[_0x1d4d('0x33')])[_0x1d4d('0x29')]+_0x1d4d('0x3e'),'AttachmentId':_0x49dfd1['id']})[_0x1d4d('0x41')](function(_0x43a004){logger['error'](_0x2d8549[_0x1d4d('0x28')],'\x20notify\x20',JSON[_0x1d4d('0x42')](_0x43a004));});})[_0x1d4d('0x41')](function(_0x13040d){logger['error'](_0x2d8549['uniqueid'],_0x1d4d('0x43'),JSON[_0x1d4d('0x42')](_0x13040d));});});}logger['info'](_0x2d8549[_0x1d4d('0x28')],_0x1d4d('0x43'));}};Fax[_0x1d4d('0x2d')]['syncOriginateResponse']=function(_0x59fd45){if(this[_0x1d4d('0x12')][_0x59fd45[_0x1d4d('0x28')]]){_[_0x1d4d('0x44')](this[_0x1d4d('0x27')][_0x59fd45['uniqueid']],_[_0x1d4d('0x45')](_0x59fd45,['response',_0x1d4d('0x46')]));}};function updateStatus(_0x14e4d0){if(_0x14e4d0[_0x1d4d('0x47')]){faxMessage[_0x1d4d('0x48')](_0x14e4d0[_0x1d4d('0x47')],{'failMessage':_0x1d4d('0x49')})[_0x1d4d('0x40')](function(_0x48a592){ut[_0x1d4d('0x4a')]('[Fax][Message][Error][Updated]',_0x48a592);})['catch'](function(_0x5035b1){ut[_0x1d4d('0x4a')](_0x1d4d('0x4b'),_0x5035b1);});}else{ut['logger'](_0x1d4d('0x4c'));}}Fax['prototype']['updateStatus']=function(_0xb7af90,_0x4429b2,_0x3e68ed){var _0x1520c6=this;var _0x5aec3f={};if(_0x4429b2){_0x5aec3f={'read':_0x4429b2};}else{_0x5aec3f={'failMessage':_0x3e68ed};}if(this[_0x1d4d('0x12')][_0xb7af90][_0x1d4d('0x47')]){faxMessage[_0x1d4d('0x48')](this[_0x1d4d('0x12')][_0xb7af90][_0x1d4d('0x47')],_0x5aec3f)[_0x1d4d('0x40')](function(_0x358a5f){ut[_0x1d4d('0x4a')](_0x1d4d('0x4d'),_0x358a5f);})['catch'](function(_0x2c814d){ut[_0x1d4d('0x4a')](_0x1d4d('0x4e'),_0x2c814d);})[_0x1d4d('0x4f')](function(){delete _0x1520c6[_0x1d4d('0x27')][_0xb7af90];delete _0x1520c6['actions'][_0xb7af90];});}else{ut['logger'](_0x1d4d('0x50'));delete this['channels'][_0xb7af90];delete this[_0x1d4d('0x12')][_0xb7af90];}};Fax[_0x1d4d('0x2d')][_0x1d4d('0x1f')]=function(_0x583fdc){var _0x502ee9=this;if(this[_0x1d4d('0x27')][_0x583fdc['uniqueid']]){if(this['actions'][_0x583fdc[_0x1d4d('0x28')]]){this[_0x1d4d('0x27')][_0x583fdc[_0x1d4d('0x28')]]['id']=this[_0x1d4d('0x12')][_0x583fdc[_0x1d4d('0x28')]]['id'];this[_0x1d4d('0x27')][_0x583fdc['uniqueid']][_0x1d4d('0x29')]=this['actions'][_0x583fdc[_0x1d4d('0x28')]]['name'];}logger[_0x1d4d('0x2a')](_0x583fdc['uniqueid'],this[_0x1d4d('0x12')][_0x583fdc[_0x1d4d('0x28')]]?'\x20hangup\x20sendFile\x20':_0x1d4d('0x51'),JSON[_0x1d4d('0x42')](this[_0x1d4d('0x27')][_0x583fdc['uniqueid']]));if(this['actions'][_0x583fdc['uniqueid']]){if(this['channels'][_0x583fdc['uniqueid']][_0x1d4d('0x52')]>0x0&&this[_0x1d4d('0x27')][_0x583fdc[_0x1d4d('0x28')]][_0x1d4d('0x1a')]===_0x1d4d('0x53')){this[_0x1d4d('0x54')](_0x583fdc[_0x1d4d('0x28')],!![]);}else{this[_0x1d4d('0x54')](_0x583fdc[_0x1d4d('0x28')],![],this[_0x1d4d('0x27')][_0x583fdc[_0x1d4d('0x28')]][_0x1d4d('0x55')]?'SENDING\x20FAILED:\x20'+this[_0x1d4d('0x27')][_0x583fdc[_0x1d4d('0x28')]][_0x1d4d('0x55')]:_0x1d4d('0x56'));}}}};Fax[_0x1d4d('0x2d')][_0x1d4d('0x57')]=function(_0xb193a){var _0x4a6c49=this;return new BPromise(function(_0x4b1f76,_0x228bce){_0x4a6c49[_0x1d4d('0x58')](_0xb193a,_0x4a6c49[_0x1d4d('0x10')][_0xb193a[_0x1d4d('0x59')]])[_0x1d4d('0x40')](function(_0x35d4b5){ut['logger']('[Fax][execOriginate][success]',_0x35d4b5);_0x4b1f76(ut['message'](_0x1d4d('0x5a')));})[_0x1d4d('0x41')](function(_0x554c9b){ut[_0x1d4d('0x4a')]('[Fax][execOriginate][failure]',_0x554c9b);updateStatus(_0xb193a);_0x228bce(ut['message'](_0x1d4d('0x5b')));});});};Fax['prototype'][_0x1d4d('0x5c')]=function(_0x2f9ac8){var _0x15cc3c=this;return new BPromise(function(_0x15cf41,_0x264d43){var _0x4f51fb=_0x15cc3c[_0x1d4d('0x5d')](_0x15cc3c[_0x1d4d('0x10')][_0x2f9ac8['FaxAccountId']][_0x1d4d('0x5e')],_0x2f9ac8);if(_0x4f51fb[_0x1d4d('0x5f')]){_0x15cf41(ut[_0x1d4d('0x3c')](_0x1d4d('0x60')));}else{_0x264d43(ut[_0x1d4d('0x3c')](_0x4f51fb['message']));}});};function originate(_0x254dd7,_0x171f0e,_0x531cc4){return new BPromise(function(_0x40867b,_0x13ced9){if(_0x531cc4){var _0x485e75=util[_0x1d4d('0x61')](_0x1d4d('0x62'),path[_0x1d4d('0x3d')](_0x254dd7[_0x1d4d('0x5')])['name'],_0x254dd7[_0x1d4d('0x5')]);gs[_0x1d4d('0x63')](_0x485e75)[_0x1d4d('0x40')](function(){_0x254dd7[_0x1d4d('0x5')]=util[_0x1d4d('0x61')](_0x1d4d('0x64'),path['parse'](_0x254dd7[_0x1d4d('0x5')])[_0x1d4d('0x65')],path[_0x1d4d('0x3d')](_0x254dd7[_0x1d4d('0x5')])[_0x1d4d('0x29')]);_0x171f0e[_0x1d4d('0x66')]=_0x254dd7[_0x1d4d('0x5')];ut[_0x1d4d('0x4a')]('Convert\x20pdf\x20to\x20tif','');ami['Action'](ut[_0x1d4d('0x67')](_0x254dd7,_0x171f0e))[_0x1d4d('0x40')](function(_0x11f97c){_0x40867b(_0x11f97c);})['catch'](function(_0x1a5a96){_0x13ced9(_0x1a5a96);});})['catch'](function(_0x25560f){_0x13ced9(_0x25560f);});}else{ami['Action'](ut['variablesAction'](_0x254dd7,_0x171f0e))[_0x1d4d('0x40')](function(_0x1d7665){_0x40867b(_0x1d7665);})[_0x1d4d('0x41')](function(_0x34a373){_0x13ced9(_0x34a373);});}});}Fax[_0x1d4d('0x2d')]['execOriginate']=function(_0x4e5fdd,_0x580096){var _0x512532=this;return new BPromise(function(_0x5311f7,_0x2e8427){var _0x5922da=uuid['v4']();var _0x55c8e7=ut[_0x1d4d('0x68')](_0x4e5fdd,_0x580096);_0x512532[_0x1d4d('0x12')][_0x5922da]=new Action(_0x5922da,_0x580096,_0x4e5fdd);var _0xf4e073=_0x512532[_0x1d4d('0x12')][_0x5922da];if(path[_0x1d4d('0x3d')](_0x4e5fdd[_0x1d4d('0x5')])[_0x1d4d('0x69')]===_0x1d4d('0x3e')){originate(_0xf4e073,_0x55c8e7,!![])['then'](function(_0x26edfd){_0x5311f7(_0x26edfd);})['catch'](function(_0x276932){_0x2e8427(_0x276932);});}else{originate(_0xf4e073,_0x55c8e7,![])[_0x1d4d('0x40')](function(_0x38fdac){_0x5311f7(_0x38fdac);})[_0x1d4d('0x41')](function(_0x127648){_0x2e8427(_0x127648);});}});};Fax[_0x1d4d('0x2d')][_0x1d4d('0x6a')]=function(_0x377221){return!_['isNil'](_0x377221)&&!_[_0x1d4d('0x6b')](_0x377221[_0x1d4d('0x29')])&&!_['isNil'](_0x377221[_0x1d4d('0x6c')])&&_0x377221[_0x1d4d('0x6c')]&&!_[_0x1d4d('0x6b')](this[_0x1d4d('0x11')][util[_0x1d4d('0x61')](_0x1d4d('0x6d'),_0x377221[_0x1d4d('0x29')])])&&!_[_0x1d4d('0x6b')](this[_0x1d4d('0x11')][util[_0x1d4d('0x61')]('SIP/%s',_0x377221[_0x1d4d('0x29')])]['status'])&&(this['trunks'][util[_0x1d4d('0x61')](_0x1d4d('0x6d'),_0x377221['name'])][_0x1d4d('0x32')]===_0x1d4d('0x6e')||this[_0x1d4d('0x11')][util[_0x1d4d('0x61')]('SIP/%s',_0x377221[_0x1d4d('0x29')])][_0x1d4d('0x32')]==='unmonitored');};Fax['prototype'][_0x1d4d('0x5d')]=function(_0x3763fd,_0x331a51){if(!this[_0x1d4d('0x6a')](_0x3763fd)){ut[_0x1d4d('0x4a')](_0x1d4d('0x6f'),_[_0x1d4d('0x6b')](_0x3763fd)?'':_0x3763fd[_0x1d4d('0x29')]+_0x1d4d('0x70'));return{'isValid':![],'message':_0x1d4d('0x71')};}if(_[_0x1d4d('0x6b')](_0x331a51['fax'])){ut[_0x1d4d('0x4a')](_0x1d4d('0x72'),JSON[_0x1d4d('0x42')](_0x331a51));return{'isValid':![],'message':_0x1d4d('0x73')};}if(_[_0x1d4d('0x6b')](_0x331a51[_0x1d4d('0x5')])){ut['logger'](_0x1d4d('0x74'),JSON[_0x1d4d('0x42')](_0x331a51));return{'isValid':![],'message':_0x1d4d('0x75')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x1d4d('0x76')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index c4e1df6..4226ba0 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 _0xcece=['util','bluebird','preview','../rpc/faxAccount','error','notify','resolve','then','catch','[Notify]\x20'];(function(_0xe9c8e4,_0x3aa2f6){var _0x2037fa=function(_0xcb43b1){while(--_0xcb43b1){_0xe9c8e4['push'](_0xe9c8e4['shift']());}};_0x2037fa(++_0x3aa2f6);}(_0xcece,0x1a4));var _0xecec=function(_0x3fcc3d,_0xf8278){_0x3fcc3d=_0x3fcc3d-0x0;var _0x5300db=_0xcece[_0x3fcc3d];return _0x5300db;};'use strict';var util=require(_0xecec('0x0'));var BPromise=require(_0xecec('0x1'));var logger=require('../../../config/logger')(_0xecec('0x2'));var _=require('lodash');var faxAccount=require(_0xecec('0x3'));function loggerCatch(_0x35b08f){return function(_0x535d83){logger[_0xecec('0x4')](_0x35b08f,util['inspect'](_0x535d83,{'showHidden':![],'depth':null}));};}exports[_0xecec('0x5')]=function(_0x4121c6,_0x13dde4){return BPromise[_0xecec('0x6')]()[_0xecec('0x7')](faxAccount[_0xecec('0x5')](_0x4121c6,_0x13dde4))[_0xecec('0x8')](loggerCatch(_0xecec('0x9')));}; \ No newline at end of file +var _0x3860=['inspect','notify','then','catch','[Notify]\x20','../../../config/logger','preview','../rpc/faxAccount','error'];(function(_0x541965,_0x48b809){var _0x2c682f=function(_0x41569e){while(--_0x41569e){_0x541965['push'](_0x541965['shift']());}};_0x2c682f(++_0x48b809);}(_0x3860,0x17f));var _0x0386=function(_0x30115a,_0x49593a){_0x30115a=_0x30115a-0x0;var _0x815b95=_0x3860[_0x30115a];return _0x815b95;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0x0386('0x0'))(_0x0386('0x1'));var _=require('lodash');var faxAccount=require(_0x0386('0x2'));function loggerCatch(_0x1a1308){return function(_0x1b533a){logger[_0x0386('0x3')](_0x1a1308,util[_0x0386('0x4')](_0x1b533a,{'showHidden':![],'depth':null}));};}exports[_0x0386('0x5')]=function(_0x1ba75d,_0x22a450){return BPromise['resolve']()[_0x0386('0x6')](faxAccount[_0x0386('0x5')](_0x1ba75d,_0x22a450))[_0x0386('0x7')](loggerCatch(_0x0386('0x8')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 5d21c57..4cdddf8 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 _0x43a6=['fax','bluebird','child_process','exec','execute','info','Exec\x20gs','inspect'];(function(_0x4db3d2,_0x1d0a57){var _0x5c655c=function(_0x5975bb){while(--_0x5975bb){_0x4db3d2['push'](_0x4db3d2['shift']());}};_0x5c655c(++_0x1d0a57);}(_0x43a6,0xe8));var _0x643a=function(_0xee2e7a,_0x58354d){_0xee2e7a=_0xee2e7a-0x0;var _0x319dd3=_0x43a6[_0xee2e7a];return _0x319dd3;};'use strict';var util=require('util');var logger=require('../../../../config/logger')(_0x643a('0x0'));var BPromise=require(_0x643a('0x1'));var exec=require(_0x643a('0x2'))[_0x643a('0x3')];exports[_0x643a('0x4')]=function(_0x312ab5){return new BPromise(function(_0x54ab15,_0x25e1e3){exec(_0x312ab5,function(_0x42cd8f,_0x60f9ab,_0x1c80ea){logger[_0x643a('0x5')](_0x643a('0x6'),_0x60f9ab);if(_0x42cd8f){logger['info'](_0x643a('0x6'),'\x20Error\x20:',util[_0x643a('0x7')](_0x42cd8f,{'showHidden':![],'depth':null}),_0x60f9ab,_0x1c80ea);_0x25e1e3(_0x42cd8f);}_0x54ab15(_0x60f9ab);});});}; \ No newline at end of file +var _0x7271=['util','../../../../config/logger','fax','bluebird','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect'];(function(_0x76a6bf,_0x2f3986){var _0x24ff2d=function(_0x376129){while(--_0x376129){_0x76a6bf['push'](_0x76a6bf['shift']());}};_0x24ff2d(++_0x2f3986);}(_0x7271,0x6e));var _0x1727=function(_0x293a83,_0x5dbd2e){_0x293a83=_0x293a83-0x0;var _0x151df8=_0x7271[_0x293a83];return _0x151df8;};'use strict';var util=require(_0x1727('0x0'));var logger=require(_0x1727('0x1'))(_0x1727('0x2'));var BPromise=require(_0x1727('0x3'));var exec=require(_0x1727('0x4'))[_0x1727('0x5')];exports[_0x1727('0x6')]=function(_0x4c2b87){return new BPromise(function(_0x53ddef,_0x5e0260){exec(_0x4c2b87,function(_0x3e2bfa,_0x417174,_0xd0f81f){logger[_0x1727('0x7')](_0x1727('0x8'),_0x417174);if(_0x3e2bfa){logger[_0x1727('0x7')](_0x1727('0x8'),_0x1727('0x9'),util[_0x1727('0xa')](_0x3e2bfa,{'showHidden':![],'depth':null}),_0x417174,_0xd0f81f);_0x5e0260(_0x3e2bfa);}_0x53ddef(_0x417174);});});}; \ 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 c6ce453..02403b5 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 _0x878f=['inspect','maxrate','modem','gateway','faxdetect','localstationid','path','uniqueid','originate','channel','from-sip','format','\x22%s\x22\x20<%s>','headerinfo','lodash','moment','../../../../config/logger','fax','message','logger','info'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x878f,0x173));var _0xf878=function(_0x17610c,_0x20331c){_0x17610c=_0x17610c-0x0;var _0x23e333=_0x878f[_0x17610c];return _0x23e333;};'use strict';var util=require('util');var _=require(_0xf878('0x0'));var moment=require(_0xf878('0x1'));var logger=require(_0xf878('0x2'))(_0xf878('0x3'));exports[_0xf878('0x4')]=function(_0x3d74cf){return{'message':_0x3d74cf};};exports[_0xf878('0x5')]=function(_0x45a37b,_0x240b48){logger[_0xf878('0x6')](_0x45a37b,util[_0xf878('0x7')](_0x240b48,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x4ac8d8,_0x3c5f5c){var _0x62b420={'XMF-ECM':_0x3c5f5c['ecm'],'XMF-HEADERINFO':_0x3c5f5c['headerinfo'],'XMF-MINRATE':_0x3c5f5c['minrate'],'XMF-MAXRATE':_0x3c5f5c[_0xf878('0x8')],'XMF-MODEM':util['format']('\x22%s\x22',_0x3c5f5c[_0xf878('0x9')]),'XMF-GATEWAY':_0x3c5f5c[_0xf878('0xa')],'XMF-FAXDETECT':_0x3c5f5c[_0xf878('0xb')],'XMF-T38TIMEOUT':_0x3c5f5c['t38timeout'],'XMF-LOCALSTATIONID':_0x3c5f5c[_0xf878('0xc')],'XMF-PATH':_0x4ac8d8[_0xf878('0xd')]};return _0x62b420;};exports['variablesAction']=function(_0xdf76,_0x4f7e7f){return{'actionid':_0xdf76[_0xf878('0xe')],'action':_0xf878('0xf'),'channel':_0xdf76[_0xf878('0x10')],'Exten':'xcally-motion-fax','Context':_0xf878('0x11'),'Priority':'1','callerid':util[_0xf878('0x12')](_0xf878('0x13'),_0xdf76['headerinfo']?_0xdf76[_0xf878('0x14')]:'',_0xdf76[_0xf878('0xc')]),'variable':_0x4f7e7f,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0xdf76[_0xf878('0xe')]};}; \ No newline at end of file +var _0xdace=['t38timeout','variablesAction','uniqueid','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','localstationid','util','moment','../../../../config/logger','fax','logger','inspect','addVariables','ecm','headerinfo','maxrate','format','\x22%s\x22','faxdetect'];(function(_0x560924,_0x258a47){var _0x5c694d=function(_0x599a81){while(--_0x599a81){_0x560924['push'](_0x560924['shift']());}};_0x5c694d(++_0x258a47);}(_0xdace,0xc5));var _0xedac=function(_0x4664db,_0x1de672){_0x4664db=_0x4664db-0x0;var _0x5615b4=_0xdace[_0x4664db];return _0x5615b4;};'use strict';var util=require(_0xedac('0x0'));var _=require('lodash');var moment=require(_0xedac('0x1'));var logger=require(_0xedac('0x2'))(_0xedac('0x3'));exports['message']=function(_0x413d77){return{'message':_0x413d77};};exports[_0xedac('0x4')]=function(_0x15d3bd,_0xefb142){logger['info'](_0x15d3bd,util[_0xedac('0x5')](_0xefb142,{'showHidden':![],'depth':null}));};exports[_0xedac('0x6')]=function(_0x39328a,_0x5ecbd3){var _0x4081c6={'XMF-ECM':_0x5ecbd3[_0xedac('0x7')],'XMF-HEADERINFO':_0x5ecbd3[_0xedac('0x8')],'XMF-MINRATE':_0x5ecbd3['minrate'],'XMF-MAXRATE':_0x5ecbd3[_0xedac('0x9')],'XMF-MODEM':util[_0xedac('0xa')](_0xedac('0xb'),_0x5ecbd3['modem']),'XMF-GATEWAY':_0x5ecbd3['gateway'],'XMF-FAXDETECT':_0x5ecbd3[_0xedac('0xc')],'XMF-T38TIMEOUT':_0x5ecbd3[_0xedac('0xd')],'XMF-LOCALSTATIONID':_0x5ecbd3['localstationid'],'XMF-PATH':_0x39328a['path']};return _0x4081c6;};exports[_0xedac('0xe')]=function(_0x25395d,_0x57f637){return{'actionid':_0x25395d[_0xedac('0xf')],'action':'originate','channel':_0x25395d[_0xedac('0x10')],'Exten':_0xedac('0x11'),'Context':_0xedac('0x12'),'Priority':'1','callerid':util[_0xedac('0xa')](_0xedac('0x13'),_0x25395d[_0xedac('0x8')]?_0x25395d[_0xedac('0x8')]:'',_0x25395d[_0xedac('0x14')]),'variable':_0x57f637,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x25395d['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index b621d9b..a344dd8 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 _0xf9f7=['./rpc/integrations/dynamics365','get','hour','resolve','getAgents','initAgents','then','initTelephones','initTrunks','getVoiceQueues','initVoiceQueues','initTriggers','initTemplates','getZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initDeskAccounts','getZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initVoiceCallReports','catch','log','listen','sync','bluebird','util','moment','./server','./realtime','./report','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger'];(function(_0x17d8cb,_0x26c927){var _0x2e632a=function(_0x52a165){while(--_0x52a165){_0x17d8cb['push'](_0x17d8cb['shift']());}};_0x2e632a(++_0x26c927);}(_0xf9f7,0x12c));var _0x7f9f=function(_0x246346,_0x335ee5){_0x246346=_0x246346-0x0;var _0x5e0957=_0xf9f7[_0x246346];return _0x5e0957;};'use strict';var BPromise=require(_0x7f9f('0x0'));var util=require(_0x7f9f('0x1'));var moment=require(_0x7f9f('0x2'));var server=require(_0x7f9f('0x3'));var Realtime=require(_0x7f9f('0x4'));var Report=require(_0x7f9f('0x5'));var Acw=require('./acw');var Trigger=require('./trigger');var Dialer=require(_0x7f9f('0x6'));var Preview=require(_0x7f9f('0x7'));var Fax=require(_0x7f9f('0x8'));var user=require(_0x7f9f('0x9'));var voiceQueue=require(_0x7f9f('0xa'));var voiceQueueReport=require(_0x7f9f('0xb'));var voiceCallReport=require(_0x7f9f('0xc'));var trunk=require(_0x7f9f('0xd'));var trigger=require(_0x7f9f('0xe'));var template=require(_0x7f9f('0xf'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x7f9f('0x10'));var voiceExtension=require(_0x7f9f('0x11'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x7f9f('0x12'));var salesforce=require(_0x7f9f('0x13'));var sugarcrm=require(_0x7f9f('0x14'));var freshdesk=require(_0x7f9f('0x15'));var desk=require(_0x7f9f('0x16'));var zoho=require(_0x7f9f('0x17'));var vtiger=require(_0x7f9f('0x18'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x7f9f('0x19'));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()[_0x7f9f('0x1a')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x7f9f('0x1a')](_0x7f9f('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x7f9f('0x1c')]()['then'](user[_0x7f9f('0x1d')]())['then'](realtime[_0x7f9f('0x1e')]())[_0x7f9f('0x1f')](user['getTelephones']())[_0x7f9f('0x1f')](realtime[_0x7f9f('0x20')]())['then'](trunk['getTrunks']())[_0x7f9f('0x1f')](realtime[_0x7f9f('0x21')]())[_0x7f9f('0x1f')](voiceQueue[_0x7f9f('0x22')]())[_0x7f9f('0x1f')](realtime[_0x7f9f('0x23')]())[_0x7f9f('0x1f')](trigger['getTriggers']())['then'](realtime[_0x7f9f('0x24')]())[_0x7f9f('0x1f')](template['getTemplates']())[_0x7f9f('0x1f')](realtime[_0x7f9f('0x25')]())[_0x7f9f('0x1f')](zendesk[_0x7f9f('0x26')]())[_0x7f9f('0x1f')](realtime['initZendeskAccounts']())['then'](salesforce[_0x7f9f('0x27')]())['then'](realtime['initSalesforceAccounts']())[_0x7f9f('0x1f')](sugarcrm[_0x7f9f('0x28')]())[_0x7f9f('0x1f')](realtime[_0x7f9f('0x29')]())[_0x7f9f('0x1f')](freshdesk[_0x7f9f('0x2a')]())[_0x7f9f('0x1f')](realtime['initFreshdeskAccounts']())[_0x7f9f('0x1f')](desk['getDeskAccounts']())[_0x7f9f('0x1f')](realtime[_0x7f9f('0x2b')]())[_0x7f9f('0x1f')](zoho[_0x7f9f('0x2c')]())[_0x7f9f('0x1f')](realtime['initZohoAccounts']())['then'](vtiger[_0x7f9f('0x2d')]())[_0x7f9f('0x1f')](realtime['initVtigerAccounts']())[_0x7f9f('0x1f')](freshsales[_0x7f9f('0x2e')]())[_0x7f9f('0x1f')](realtime['initFreshsalesAccounts']())[_0x7f9f('0x1f')](servicenow[_0x7f9f('0x2f')]())[_0x7f9f('0x1f')](realtime[_0x7f9f('0x30')]())[_0x7f9f('0x1f')](dynamics365[_0x7f9f('0x31')]())[_0x7f9f('0x1f')](realtime[_0x7f9f('0x32')]())[_0x7f9f('0x1f')](campaign[_0x7f9f('0x33')]())[_0x7f9f('0x1f')](realtime[_0x7f9f('0x34')]())[_0x7f9f('0x1f')](voiceExtension[_0x7f9f('0x35')]())[_0x7f9f('0x1f')](realtime['initVoiceExtensions']())[_0x7f9f('0x1f')](faxAccount[_0x7f9f('0x36')]())[_0x7f9f('0x1f')](realtime[_0x7f9f('0x37')]())[_0x7f9f('0x1f')](function(){return realtime;});}function initParams(){return BPromise[_0x7f9f('0x1c')]()[_0x7f9f('0x1f')](voiceQueueReport[_0x7f9f('0x38')]())[_0x7f9f('0x1f')](realtime[_0x7f9f('0x39')]())[_0x7f9f('0x1f')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x7f9f('0x1f')](realtime[_0x7f9f('0x3a')]())[_0x7f9f('0x1f')](cmHopperHistory[_0x7f9f('0x3b')]())[_0x7f9f('0x1f')](realtime['initCampaignHopperHistory']())['then'](voiceCallReport['getVoiceCallReports']())[_0x7f9f('0x1f')](realtime[_0x7f9f('0x3c')]())['then'](function(_0x1596e6){})[_0x7f9f('0x3d')](function(_0x47a471){console[_0x7f9f('0x3e')](_0x47a471);});}function main(){return server[_0x7f9f('0x3f')](realtime,preview,fax)[_0x7f9f('0x1f')](function(_0x24e2d0){return initRealtime();})[_0x7f9f('0x1f')](function(){return initParams();})['then'](function(){report[_0x7f9f('0x40')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x482207){console[_0x7f9f('0x3e')](_0x482207);});}main(); \ No newline at end of file +var _0xcccb=['./rpc/integrations/servicenow','get','hour','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','log','listen','bluebird','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/zoho','./rpc/integrations/freshsales'];(function(_0x19fe78,_0x143db6){var _0x108e32=function(_0x57f13c){while(--_0x57f13c){_0x19fe78['push'](_0x19fe78['shift']());}};_0x108e32(++_0x143db6);}(_0xcccb,0x136));var _0xbccc=function(_0x3800e8,_0x1dd9c2){_0x3800e8=_0x3800e8-0x0;var _0x1df8ff=_0xcccb[_0x3800e8];return _0x1df8ff;};'use strict';var BPromise=require(_0xbccc('0x0'));var util=require('util');var moment=require(_0xbccc('0x1'));var server=require(_0xbccc('0x2'));var Realtime=require(_0xbccc('0x3'));var Report=require(_0xbccc('0x4'));var Acw=require(_0xbccc('0x5'));var Trigger=require(_0xbccc('0x6'));var Dialer=require(_0xbccc('0x7'));var Preview=require(_0xbccc('0x8'));var Fax=require(_0xbccc('0x9'));var user=require(_0xbccc('0xa'));var voiceQueue=require(_0xbccc('0xb'));var voiceQueueReport=require(_0xbccc('0xc'));var voiceCallReport=require(_0xbccc('0xd'));var trunk=require(_0xbccc('0xe'));var trigger=require(_0xbccc('0xf'));var template=require(_0xbccc('0x10'));var cmHopperHistory=require(_0xbccc('0x11'));var campaign=require(_0xbccc('0x12'));var voiceExtension=require(_0xbccc('0x13'));var faxAccount=require(_0xbccc('0x14'));var zendesk=require(_0xbccc('0x15'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xbccc('0x16'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require('./rpc/integrations/desk');var zoho=require(_0xbccc('0x17'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0xbccc('0x18'));var servicenow=require(_0xbccc('0x19'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xbccc('0x1a')](_0xbccc('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xbccc('0x1a')](_0xbccc('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0xbccc('0x1c')](user[_0xbccc('0x1d')]())[_0xbccc('0x1c')](realtime[_0xbccc('0x1e')]())[_0xbccc('0x1c')](user[_0xbccc('0x1f')]())['then'](realtime[_0xbccc('0x20')]())['then'](trunk[_0xbccc('0x21')]())['then'](realtime[_0xbccc('0x22')]())[_0xbccc('0x1c')](voiceQueue[_0xbccc('0x23')]())[_0xbccc('0x1c')](realtime[_0xbccc('0x24')]())[_0xbccc('0x1c')](trigger[_0xbccc('0x25')]())[_0xbccc('0x1c')](realtime['initTriggers']())[_0xbccc('0x1c')](template['getTemplates']())[_0xbccc('0x1c')](realtime[_0xbccc('0x26')]())[_0xbccc('0x1c')](zendesk['getZendeskAccounts']())[_0xbccc('0x1c')](realtime[_0xbccc('0x27')]())[_0xbccc('0x1c')](salesforce[_0xbccc('0x28')]())[_0xbccc('0x1c')](realtime[_0xbccc('0x29')]())['then'](sugarcrm[_0xbccc('0x2a')]())[_0xbccc('0x1c')](realtime[_0xbccc('0x2b')]())[_0xbccc('0x1c')](freshdesk['getFreshdeskAccounts']())['then'](realtime[_0xbccc('0x2c')]())[_0xbccc('0x1c')](desk[_0xbccc('0x2d')]())[_0xbccc('0x1c')](realtime[_0xbccc('0x2e')]())['then'](zoho['getZohoAccounts']())[_0xbccc('0x1c')](realtime[_0xbccc('0x2f')]())[_0xbccc('0x1c')](vtiger[_0xbccc('0x30')]())[_0xbccc('0x1c')](realtime[_0xbccc('0x31')]())[_0xbccc('0x1c')](freshsales['getFreshsalesAccounts']())[_0xbccc('0x1c')](realtime[_0xbccc('0x32')]())[_0xbccc('0x1c')](servicenow['getServicenowAccounts']())[_0xbccc('0x1c')](realtime[_0xbccc('0x33')]())['then'](dynamics365['getDynamics365Accounts']())[_0xbccc('0x1c')](realtime[_0xbccc('0x34')]())[_0xbccc('0x1c')](campaign[_0xbccc('0x35')]())[_0xbccc('0x1c')](realtime[_0xbccc('0x36')]())[_0xbccc('0x1c')](voiceExtension[_0xbccc('0x37')]())['then'](realtime[_0xbccc('0x38')]())[_0xbccc('0x1c')](faxAccount[_0xbccc('0x39')]())[_0xbccc('0x1c')](realtime['initFaxAccounts']())['then'](function(){return realtime;});}function initParams(){return BPromise[_0xbccc('0x3a')]()['then'](voiceQueueReport[_0xbccc('0x3b')]())[_0xbccc('0x1c')](realtime[_0xbccc('0x3c')]())['then'](cmHopperHistory['getVoiceQueueHopperHistory']())[_0xbccc('0x1c')](realtime['initVoiceQueueHopperHistory']())[_0xbccc('0x1c')](cmHopperHistory[_0xbccc('0x3d')]())[_0xbccc('0x1c')](realtime[_0xbccc('0x3e')]())[_0xbccc('0x1c')](voiceCallReport[_0xbccc('0x3f')]())[_0xbccc('0x1c')](realtime[_0xbccc('0x40')]())[_0xbccc('0x1c')](function(_0x1bc448){})['catch'](function(_0x427150){console[_0xbccc('0x41')](_0x427150);});}function main(){return server[_0xbccc('0x42')](realtime,preview,fax)[_0xbccc('0x1c')](function(_0x36369c){return initRealtime();})['then'](function(){return initParams();})['then'](function(){report['sync']();setInterval(initRealtime,0x1388);})['catch'](function(_0x20b6e6){console['log'](_0x20b6e6);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index b9c4951..e96fbc3 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 _0xbfb3=['not_inuse','inuse','statePause','toNumber','format','interface','user:%s','user:save','exports','lodash','util','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','toLowerCase'];(function(_0x3566d0,_0x34a49f){var _0x3fd4da=function(_0xa00005){while(--_0xa00005){_0x3566d0['push'](_0x3566d0['shift']());}};_0x3fd4da(++_0x34a49f);}(_0xbfb3,0xa5));var _0x3bfb=function(_0x51ec85,_0x1b1be3){_0x51ec85=_0x51ec85-0x0;var _0x233598=_0xbfb3[_0x51ec85];return _0x233598;};'use strict';var _=require(_0x3bfb('0x0'));var util=require(_0x3bfb('0x1'));var moment=require(_0x3bfb('0x2'));var md5=require(_0x3bfb('0x3'));var Redis=require(_0x3bfb('0x4'));var config=require(_0x3bfb('0x5'));config[_0x3bfb('0x6')]=_[_0x3bfb('0x7')](config[_0x3bfb('0x6')],{'host':_0x3bfb('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3bfb('0x6')]));function Agent(_0x1c86a6){this['id']=_0x1c86a6['id']||0x0;this[_0x3bfb('0x9')]=_0x1c86a6[_0x3bfb('0x9')]||'';this['email']=_0x1c86a6[_0x3bfb('0xa')]||'';this[_0x3bfb('0xb')]=_0x1c86a6[_0x3bfb('0xb')]||'';this[_0x3bfb('0xc')]=_0x1c86a6[_0x3bfb('0xc')]||'';this[_0x3bfb('0xd')]=_0x3bfb('0xe');this[_0x3bfb('0xf')]=0x0;this[_0x3bfb('0x10')]=_0x3bfb('0xe');this[_0x3bfb('0x11')]='';this[_0x3bfb('0x12')]='';this[_0x3bfb('0x13')]='';this['interface']='';this[_0x3bfb('0x14')]=_0x1c86a6['online']||![];this[_0x3bfb('0x15')]='unknown';this[_0x3bfb('0x16')]=0x0;this[_0x3bfb('0x17')]='';this[_0x3bfb('0x18')]='';this[_0x3bfb('0x19')]=![];this[_0x3bfb('0x1a')]=![];this['md5']='';}Agent[_0x3bfb('0x1b')][_0x3bfb('0x1c')]=function(_0x26c1cc){var _0xeea0da;if(_0x26c1cc&&_0x26c1cc[_0x3bfb('0xd')]){_0xeea0da=_0x26c1cc[_0x3bfb('0xd')][_0x3bfb('0x1d')]();switch(_0xeea0da){case _0x3bfb('0x1e'):_0xeea0da='idle';break;case _0x3bfb('0x1f'):_0xeea0da='talking';break;}}if(_0xeea0da&&this[_0x3bfb('0x15')]!==_0xeea0da||_0x26c1cc[_0x3bfb('0x20')]){this['voiceStatusTime']=_[_0x3bfb('0x21')](moment()[_0x3bfb('0x22')]('x'));}if(_0xeea0da){this[_0x3bfb('0x15')]=_0xeea0da;}var _0x1ae217={'id':this['id'],'name':this[_0x3bfb('0x9')],'email':this[_0x3bfb('0xa')],'accountcode':this[_0x3bfb('0xb')],'fullname':this['fullname'],'state':this[_0x3bfb('0xd')],'stateTime':this[_0x3bfb('0xf')],'status':this[_0x3bfb('0x10')],'address':this['address'],'online':this['online'],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x3bfb('0x17')],'voiceStatusQueue':this[_0x3bfb('0x18')],'interface':this[_0x3bfb('0x23')],'onhold':this[_0x3bfb('0x19')]};var _0x3bc7d6=md5(JSON['stringify'](_0x1ae217));if(this['md5']!==_0x3bc7d6){this[_0x3bfb('0x3')]=_0x3bc7d6;io['to'](util[_0x3bfb('0x22')](_0x3bfb('0x24'),_0x1ae217[_0x3bfb('0x9')]))['emit'](_0x3bfb('0x25'),_0x1ae217);}};module[_0x3bfb('0x26')]=Agent; \ No newline at end of file +var _0xf42b=['fullname','state','unknown','stateTime','status','address','mobile','online','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','updateStatusRealtime','not_inuse','idle','talking','voiceStatus','statePause','toNumber','format','interface','stringify','user:%s','user:save','lodash','util','moment','md5','ioredis','defaults','redis','name','email','accountcode'];(function(_0x142808,_0x27447b){var _0x5b5834=function(_0x4994b3){while(--_0x4994b3){_0x142808['push'](_0x142808['shift']());}};_0x5b5834(++_0x27447b);}(_0xf42b,0x177));var _0xbf42=function(_0x4df692,_0xc9144b){_0x4df692=_0x4df692-0x0;var _0x2ab2c5=_0xf42b[_0x4df692];return _0x2ab2c5;};'use strict';var _=require(_0xbf42('0x0'));var util=require(_0xbf42('0x1'));var moment=require(_0xbf42('0x2'));var md5=require(_0xbf42('0x3'));var Redis=require(_0xbf42('0x4'));var config=require('../../../config/environment');config['redis']=_[_0xbf42('0x5')](config[_0xbf42('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x275a9e){this['id']=_0x275a9e['id']||0x0;this['name']=_0x275a9e[_0xbf42('0x7')]||'';this[_0xbf42('0x8')]=_0x275a9e[_0xbf42('0x8')]||'';this[_0xbf42('0x9')]=_0x275a9e['accountcode']||'';this['fullname']=_0x275a9e[_0xbf42('0xa')]||'';this[_0xbf42('0xb')]=_0xbf42('0xc');this[_0xbf42('0xd')]=0x0;this[_0xbf42('0xe')]=_0xbf42('0xc');this[_0xbf42('0xf')]='';this['phone']='';this[_0xbf42('0x10')]='';this['interface']='';this[_0xbf42('0x11')]=_0x275a9e['online']||![];this['voiceStatus']=_0xbf42('0xc');this[_0xbf42('0x12')]=0x0;this[_0xbf42('0x13')]='';this[_0xbf42('0x14')]='';this[_0xbf42('0x15')]=![];this[_0xbf42('0x16')]=![];this[_0xbf42('0x3')]='';}Agent['prototype'][_0xbf42('0x17')]=function(_0x25b2ea){var _0x22fce9;if(_0x25b2ea&&_0x25b2ea['state']){_0x22fce9=_0x25b2ea['state']['toLowerCase']();switch(_0x22fce9){case _0xbf42('0x18'):_0x22fce9=_0xbf42('0x19');break;case'inuse':_0x22fce9=_0xbf42('0x1a');break;}}if(_0x22fce9&&this[_0xbf42('0x1b')]!==_0x22fce9||_0x25b2ea[_0xbf42('0x1c')]){this[_0xbf42('0x12')]=_[_0xbf42('0x1d')](moment()[_0xbf42('0x1e')]('x'));}if(_0x22fce9){this[_0xbf42('0x1b')]=_0x22fce9;}var _0x52b573={'id':this['id'],'name':this[_0xbf42('0x7')],'email':this['email'],'accountcode':this['accountcode'],'fullname':this['fullname'],'state':this[_0xbf42('0xb')],'stateTime':this[_0xbf42('0xd')],'status':this['status'],'address':this[_0xbf42('0xf')],'online':this[_0xbf42('0x11')],'voiceStatus':this[_0xbf42('0x1b')],'voiceStatusTime':this[_0xbf42('0x12')],'voiceStatusCallerIdNumber':this[_0xbf42('0x13')],'voiceStatusQueue':this[_0xbf42('0x14')],'interface':this[_0xbf42('0x1f')],'onhold':this['onhold']};var _0x372429=md5(JSON[_0xbf42('0x20')](_0x52b573));if(this[_0xbf42('0x3')]!==_0x372429){this[_0xbf42('0x3')]=_0x372429;io['to'](util[_0xbf42('0x1e')](_0xbf42('0x21'),_0x52b573['name']))['emit'](_0xbf42('0x22'),_0x52b573);}};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 c73a2e9..a7b4c6a 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 _0xfad1=['dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrTotalCallsDays','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xfad1,0x12a));var _0x1fad=function(_0xd217f7,_0x30c4d6){_0xd217f7=_0xd217f7-0x0;var _0x31c9f6=_0xfad1[_0xd217f7];return _0x31c9f6;};'use strict';function Campaign(_0xda6746){this['id']=_0xda6746['id']||0x0;this['name']=_0xda6746[_0x1fad('0x0')]||'';this[_0x1fad('0x1')]=_0xda6746[_0x1fad('0x1')]||_0x1fad('0x2');this[_0x1fad('0x3')]=0x0;this[_0x1fad('0x4')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x1fad('0x5')]=0x0;this['message']='';this['sendMessageOneNotActive']=!![];this[_0x1fad('0x6')]=_0xda6746[_0x1fad('0x6')];this[_0x1fad('0x7')]=_0xda6746['limitCalls'];this[_0x1fad('0x8')]=_0xda6746[_0x1fad('0x8')]||null;this[_0x1fad('0x9')]=_0xda6746[_0x1fad('0x9')]?_0xda6746['dialGlobalInterval']:null;this[_0x1fad('0xa')]=_0xda6746[_0x1fad('0xa')];this[_0x1fad('0xb')]=_0xda6746[_0x1fad('0xb')];this['dialOriginateTimeout']=_0xda6746[_0x1fad('0xc')]||0x1e;this['dialCongestionMaxRetry']=_0xda6746[_0x1fad('0xd')];this[_0x1fad('0xe')]=_0xda6746[_0x1fad('0xe')];this['dialBusyMaxRetry']=_0xda6746[_0x1fad('0xf')];this[_0x1fad('0x10')]=_0xda6746['dialBusyRetryFrequency'];this[_0x1fad('0x11')]=_0xda6746['dialNoAnswerMaxRetry'];this[_0x1fad('0x12')]=_0xda6746[_0x1fad('0x12')];this[_0x1fad('0x13')]=_0xda6746[_0x1fad('0x13')];this[_0x1fad('0x14')]=_0xda6746[_0x1fad('0x14')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0xda6746[_0x1fad('0x15')]||0x96;this['dialDropMaxRetry']=_0xda6746[_0x1fad('0x16')]||0x3;this[_0x1fad('0x17')]=_0xda6746['dialDropRetryFrequency']||0x96;this[_0x1fad('0x18')]=_0xda6746['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0xda6746['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0xda6746['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0xda6746[_0x1fad('0x19')]||0x96;this[_0x1fad('0x1a')]=_0xda6746[_0x1fad('0x1a')]||0x3;this[_0x1fad('0x1b')]=_0xda6746[_0x1fad('0x1b')]||0x96;this[_0x1fad('0x1c')]=_0xda6746[_0x1fad('0x1c')]||'DESC';this[_0x1fad('0x1d')]=_0xda6746[_0x1fad('0x1d')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0xda6746[_0x1fad('0x1e')]||undefined;this[_0x1fad('0x1f')]=_0xda6746[_0x1fad('0x1f')]||undefined;this['TrunkBackup']=_0xda6746[_0x1fad('0x20')]?_0xda6746['TrunkBackup']:undefined;this[_0x1fad('0x21')]=_0xda6746[_0x1fad('0x21')]?_0xda6746['Trunk']:undefined;this[_0x1fad('0x22')]=_0xda6746['Interval']?_0xda6746[_0x1fad('0x22')]:undefined;this['SquareProject']=_0xda6746[_0x1fad('0x23')]?_0xda6746['SquareProject']:undefined;this[_0x1fad('0x24')]=_0xda6746['SquareProject']?_0xda6746[_0x1fad('0x23')]['name']:undefined;this[_0x1fad('0x25')]=_0xda6746[_0x1fad('0x25')]||![];this['dialAMDInitialSilence']=_0xda6746[_0x1fad('0x26')];this[_0x1fad('0x27')]=_0xda6746[_0x1fad('0x27')];this[_0x1fad('0x28')]=_0xda6746['dialAMDAfterGreetingSilence'];this[_0x1fad('0x29')]=_0xda6746[_0x1fad('0x29')];this[_0x1fad('0x2a')]=_0xda6746['dialAMDMinWordLength'];this[_0x1fad('0x2b')]=_0xda6746[_0x1fad('0x2b')];this[_0x1fad('0x2c')]=_0xda6746[_0x1fad('0x2c')];this[_0x1fad('0x2d')]=_0xda6746[_0x1fad('0x2d')];this[_0x1fad('0x2e')]=_0xda6746[_0x1fad('0x2e')];}module[_0x1fad('0x2f')]=Campaign; \ No newline at end of file +var _0x5755=['dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime'];(function(_0xd41389,_0x578e18){var _0x4838f1=function(_0x4c6e9b){while(--_0x4c6e9b){_0xd41389['push'](_0xd41389['shift']());}};_0x4838f1(++_0x578e18);}(_0x5755,0x1ab));var _0x5575=function(_0x1405ff,_0x928bd9){_0x1405ff=_0x1405ff-0x0;var _0x3625bb=_0x5755[_0x1405ff];return _0x3625bb;};'use strict';function Campaign(_0x4e6403){this['id']=_0x4e6403['id']||0x0;this[_0x5575('0x0')]=_0x4e6403[_0x5575('0x0')]||'';this[_0x5575('0x1')]=_0x4e6403[_0x5575('0x1')]||_0x5575('0x2');this[_0x5575('0x3')]=0x0;this[_0x5575('0x4')]=0x0;this[_0x5575('0x5')]=0x0;this['ivrTotalCallsDays']=0x0;this['message']='';this[_0x5575('0x6')]=!![];this[_0x5575('0x7')]=_0x4e6403[_0x5575('0x7')];this[_0x5575('0x8')]=_0x4e6403['limitCalls'];this['dialTimezone']=_0x4e6403[_0x5575('0x9')]||null;this[_0x5575('0xa')]=_0x4e6403[_0x5575('0xa')]?_0x4e6403['dialGlobalInterval']:null;this[_0x5575('0xb')]=_0x4e6403[_0x5575('0xb')];this['dialOriginateCallerIdNumber']=_0x4e6403[_0x5575('0xc')];this['dialOriginateTimeout']=_0x4e6403[_0x5575('0xd')]||0x1e;this[_0x5575('0xe')]=_0x4e6403[_0x5575('0xe')];this['dialCongestionRetryFrequency']=_0x4e6403['dialCongestionRetryFrequency'];this[_0x5575('0xf')]=_0x4e6403[_0x5575('0xf')];this[_0x5575('0x10')]=_0x4e6403['dialBusyRetryFrequency'];this['dialNoAnswerMaxRetry']=_0x4e6403[_0x5575('0x11')];this[_0x5575('0x12')]=_0x4e6403[_0x5575('0x12')];this[_0x5575('0x13')]=_0x4e6403[_0x5575('0x13')];this[_0x5575('0x14')]=_0x4e6403[_0x5575('0x14')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x4e6403['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x4e6403[_0x5575('0x15')]||0x3;this[_0x5575('0x16')]=_0x4e6403[_0x5575('0x16')]||0x96;this[_0x5575('0x17')]=_0x4e6403['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x4e6403[_0x5575('0x18')]||0x96;this[_0x5575('0x19')]=_0x4e6403[_0x5575('0x19')]||0x3;this[_0x5575('0x1a')]=_0x4e6403[_0x5575('0x1a')]||0x96;this[_0x5575('0x1b')]=_0x4e6403[_0x5575('0x1b')]||0x3;this['dialAgentRejectRetryFrequency']=_0x4e6403[_0x5575('0x1c')]||0x96;this[_0x5575('0x1d')]=_0x4e6403[_0x5575('0x1d')]||_0x5575('0x1e');this['dialPrefix']=_0x4e6403['dialPrefix']||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x4e6403[_0x5575('0x1f')]||undefined;this[_0x5575('0x20')]=_0x4e6403[_0x5575('0x20')]||undefined;this[_0x5575('0x21')]=_0x4e6403[_0x5575('0x21')]?_0x4e6403[_0x5575('0x21')]:undefined;this[_0x5575('0x22')]=_0x4e6403['Trunk']?_0x4e6403[_0x5575('0x22')]:undefined;this['Interval']=_0x4e6403[_0x5575('0x23')]?_0x4e6403[_0x5575('0x23')]:undefined;this[_0x5575('0x24')]=_0x4e6403[_0x5575('0x24')]?_0x4e6403[_0x5575('0x24')]:undefined;this[_0x5575('0x25')]=_0x4e6403[_0x5575('0x24')]?_0x4e6403[_0x5575('0x24')][_0x5575('0x0')]:undefined;this[_0x5575('0x26')]=_0x4e6403[_0x5575('0x26')]||![];this[_0x5575('0x27')]=_0x4e6403[_0x5575('0x27')];this[_0x5575('0x28')]=_0x4e6403['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x4e6403[_0x5575('0x29')];this[_0x5575('0x2a')]=_0x4e6403[_0x5575('0x2a')];this[_0x5575('0x2b')]=_0x4e6403['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x4e6403['dialAMDBetweenWordsSilence'];this[_0x5575('0x2c')]=_0x4e6403[_0x5575('0x2c')];this['dialAMDSilenceThreshold']=_0x4e6403['dialAMDSilenceThreshold'];this[_0x5575('0x2d')]=_0x4e6403[_0x5575('0x2d')];}module[_0x5575('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 13a92dc..6d9a9e8 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 _0xe6da=['unmanaged','lastapplication','duration','billableseconds','holdtime','type','disposition','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','uniqueid','answered','endtime'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0xe6da,0x1ee));var _0xae6d=function(_0x192115,_0x3fec0a){_0x192115=_0x192115-0x0;var _0x1b9282=_0xe6da[_0x192115];return _0x1b9282;};'use strict';function Channel(){this['starttime']=null;this[_0xae6d('0x0')]='';this[_0xae6d('0x1')]='';this[_0xae6d('0x2')]=0x0;this[_0xae6d('0x3')]='';this[_0xae6d('0x4')]=undefined;this[_0xae6d('0x5')]=undefined;this[_0xae6d('0x6')]=0x0;this['context']='';this[_0xae6d('0x7')]=0x0;this['linkedid']=0x0;this['exten']=0x0;this[_0xae6d('0x8')]=![];this['answertime']=null;this[_0xae6d('0x9')]=null;this[_0xae6d('0xa')]=![];this['abandoned']=![];this[_0xae6d('0xb')]='';this['lastdata']='';this[_0xae6d('0xc')]=0x0;this[_0xae6d('0xd')]=0x0;this[_0xae6d('0xe')]=0x0;this[_0xae6d('0xf')]=null;this['tag']=null;this[_0xae6d('0x10')]=null;this['monitor']=![];this[_0xae6d('0x11')]=null;this[_0xae6d('0x12')]=null;this[_0xae6d('0x13')]=[];this[_0xae6d('0x14')]=undefined;this[_0xae6d('0x15')]=undefined;this[_0xae6d('0x16')]=0x0;}module[_0xae6d('0x17')]=Channel; \ No newline at end of file +var _0x0e3b=['monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','channel','destinationchannel','calleridname','connectedlinenum','connectedlinename','context','uniqueid','exten','answered','answertime','endtime','abandoned','lastdata','duration','billableseconds','holdtime','disposition','monitor'];(function(_0x5e0100,_0x5e4986){var _0x50aedd=function(_0x222da2){while(--_0x222da2){_0x5e0100['push'](_0x5e0100['shift']());}};_0x50aedd(++_0x5e4986);}(_0x0e3b,0x125));var _0xb0e3=function(_0x557ff2,_0x5d76c7){_0x557ff2=_0x557ff2-0x0;var _0x578d53=_0x0e3b[_0x557ff2];return _0x578d53;};'use strict';function Channel(){this[_0xb0e3('0x0')]=null;this[_0xb0e3('0x1')]='';this[_0xb0e3('0x2')]='';this['calleridnum']=0x0;this[_0xb0e3('0x3')]='';this[_0xb0e3('0x4')]=undefined;this[_0xb0e3('0x5')]=undefined;this['accountcode']=0x0;this[_0xb0e3('0x6')]='';this[_0xb0e3('0x7')]=0x0;this['linkedid']=0x0;this[_0xb0e3('0x8')]=0x0;this[_0xb0e3('0x9')]=![];this[_0xb0e3('0xa')]=null;this[_0xb0e3('0xb')]=null;this['unmanaged']=![];this[_0xb0e3('0xc')]=![];this['lastapplication']='';this[_0xb0e3('0xd')]='';this[_0xb0e3('0xe')]=0x0;this[_0xb0e3('0xf')]=0x0;this[_0xb0e3('0x10')]=0x0;this['type']=null;this['tag']=null;this[_0xb0e3('0x11')]=null;this[_0xb0e3('0x12')]=![];this[_0xb0e3('0x13')]=null;this[_0xb0e3('0x14')]=null;this[_0xb0e3('0x15')]=[];this[_0xb0e3('0x16')]=undefined;this[_0xb0e3('0x17')]=undefined;this[_0xb0e3('0x18')]=0x0;}module[_0xb0e3('0x19')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index e771e52..40dd913 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 _0xc43c=['name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports'];(function(_0x3569bb,_0x1c4977){var _0x44bdbc=function(_0x24ffda){while(--_0x24ffda){_0x3569bb['push'](_0x3569bb['shift']());}};_0x44bdbc(++_0x1c4977);}(_0xc43c,0x152));var _0xcc43=function(_0x760548,_0x589699){_0x760548=_0x760548-0x0;var _0x1a6009=_0xc43c[_0x760548];return _0x1a6009;};'use strict';function DeskAccount(_0x5a04d4){this['id']=_0x5a04d4['id']||0x0;this[_0xcc43('0x0')]=_0x5a04d4[_0xcc43('0x0')]||'';this[_0xcc43('0x1')]=_0x5a04d4[_0xcc43('0x1')]||'';this[_0xcc43('0x2')]=_0x5a04d4['remoteUri']||'';this[_0xcc43('0x3')]=_0x5a04d4[_0xcc43('0x3')]||'';this['password']=_0x5a04d4[_0xcc43('0x4')]||'';this[_0xcc43('0x5')]=_0x5a04d4[_0xcc43('0x5')]||'';this[_0xcc43('0x6')]=_0x5a04d4[_0xcc43('0x6')]||'';this[_0xcc43('0x7')]=_0x5a04d4[_0xcc43('0x7')]||'';this[_0xcc43('0x8')]=_0x5a04d4[_0xcc43('0x8')]||'';this[_0xcc43('0x9')]=_0x5a04d4['type']||'';this[_0xcc43('0xa')]=_0x5a04d4[_0xcc43('0xa')]||'';this[_0xcc43('0xb')]=_0x5a04d4[_0xcc43('0xb')]||{};}module[_0xcc43('0xc')]=DeskAccount; \ No newline at end of file +var _0x7da7=['token','tokenSecret','type','serverUrl','Configurations','name','remoteUri','authType','password','consumerKey','consumerSecret'];(function(_0x340c24,_0x5daa84){var _0x446d16=function(_0x146f5c){while(--_0x146f5c){_0x340c24['push'](_0x340c24['shift']());}};_0x446d16(++_0x5daa84);}(_0x7da7,0x10d));var _0x77da=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x7da7[_0x36eaaa];return _0x461349;};'use strict';function DeskAccount(_0xf386d6){this['id']=_0xf386d6['id']||0x0;this[_0x77da('0x0')]=_0xf386d6[_0x77da('0x0')]||'';this['username']=_0xf386d6['username']||'';this[_0x77da('0x1')]=_0xf386d6[_0x77da('0x1')]||'';this['authType']=_0xf386d6[_0x77da('0x2')]||'';this[_0x77da('0x3')]=_0xf386d6['password']||'';this[_0x77da('0x4')]=_0xf386d6[_0x77da('0x4')]||'';this['consumerSecret']=_0xf386d6[_0x77da('0x5')]||'';this['token']=_0xf386d6[_0x77da('0x6')]||'';this[_0x77da('0x7')]=_0xf386d6[_0x77da('0x7')]||'';this[_0x77da('0x8')]=_0xf386d6[_0x77da('0x8')]||'';this['serverUrl']=_0xf386d6[_0x77da('0x9')]||'';this[_0x77da('0xa')]=_0xf386d6[_0x77da('0xa')]||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index c5f80be..5b40aca 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 _0x263e=['tenantId','clientId','clientSecret','serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x6ca1db,_0x569d05){var _0x5bcc1b=function(_0x5346ca){while(--_0x5346ca){_0x6ca1db['push'](_0x6ca1db['shift']());}};_0x5bcc1b(++_0x569d05);}(_0x263e,0x1c8));var _0xe263=function(_0x241eb9,_0x5ccc3f){_0x241eb9=_0x241eb9-0x0;var _0x4f916b=_0x263e[_0x241eb9];return _0x4f916b;};'use strict';function Dynamics365Account(_0x50ee3e){this['id']=_0x50ee3e['id']||0x0;this[_0xe263('0x0')]=_0x50ee3e[_0xe263('0x0')]||'';this['username']=_0x50ee3e[_0xe263('0x1')]||'';this['password']=_0x50ee3e['password']||'';this[_0xe263('0x2')]=_0x50ee3e[_0xe263('0x2')]||'';this[_0xe263('0x3')]=_0x50ee3e[_0xe263('0x3')]||'';this[_0xe263('0x4')]=_0x50ee3e['clientId']||'';this[_0xe263('0x5')]=_0x50ee3e[_0xe263('0x5')]||{};this[_0xe263('0x6')]=_0x50ee3e[_0xe263('0x6')]||'';this[_0xe263('0x7')]=_0x50ee3e[_0xe263('0x7')]||{};}module[_0xe263('0x8')]=Dynamics365Account; \ No newline at end of file +var _0xd002=['clientId','serverUrl','exports','name','username','password','remoteUri','tenantId'];(function(_0x1e5919,_0x310368){var _0x45dfe7=function(_0x48139b){while(--_0x48139b){_0x1e5919['push'](_0x1e5919['shift']());}};_0x45dfe7(++_0x310368);}(_0xd002,0x13b));var _0x2d00=function(_0x44ab45,_0x248f1e){_0x44ab45=_0x44ab45-0x0;var _0x33ce9f=_0xd002[_0x44ab45];return _0x33ce9f;};'use strict';function Dynamics365Account(_0x370c4a){this['id']=_0x370c4a['id']||0x0;this[_0x2d00('0x0')]=_0x370c4a[_0x2d00('0x0')]||'';this[_0x2d00('0x1')]=_0x370c4a[_0x2d00('0x1')]||'';this[_0x2d00('0x2')]=_0x370c4a[_0x2d00('0x2')]||'';this[_0x2d00('0x3')]=_0x370c4a['remoteUri']||'';this[_0x2d00('0x4')]=_0x370c4a['tenantId']||'';this[_0x2d00('0x5')]=_0x370c4a[_0x2d00('0x5')]||'';this['clientSecret']=_0x370c4a['clientSecret']||{};this[_0x2d00('0x6')]=_0x370c4a['serverUrl']||'';this['Configurations']=_0x370c4a['Configurations']||{};}module[_0x2d00('0x7')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index bda83a3..66cad2f 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 _0x5900=['v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem'];(function(_0x2c0fe4,_0x3c60cc){var _0x19c3ed=function(_0x52ad20){while(--_0x52ad20){_0x2c0fe4['push'](_0x2c0fe4['shift']());}};_0x19c3ed(++_0x3c60cc);}(_0x5900,0x184));var _0x0590=function(_0x18063f,_0x3efbaf){_0x18063f=_0x18063f-0x0;var _0x116771=_0x5900[_0x18063f];return _0x116771;};'use strict';function FaxAccount(_0x30ee0b){this['id']=_0x30ee0b['id']||0x0;this[_0x0590('0x0')]=_0x30ee0b[_0x0590('0x0')]||'';this[_0x0590('0x1')]=_0x30ee0b[_0x0590('0x1')];this[_0x0590('0x2')]=_0x30ee0b['ecm'];this[_0x0590('0x3')]=_0x30ee0b[_0x0590('0x3')];this[_0x0590('0x4')]=_0x30ee0b[_0x0590('0x4')];this['minrate']=_0x30ee0b[_0x0590('0x5')]||0x960;this[_0x0590('0x6')]=_0x30ee0b[_0x0590('0x6')]||0x3840;this[_0x0590('0x7')]=_0x30ee0b[_0x0590('0x7')]||_0x0590('0x8');this[_0x0590('0x9')]=_0x30ee0b[_0x0590('0x9')]||'no';this[_0x0590('0xa')]=_0x30ee0b[_0x0590('0xa')]||'no';this[_0x0590('0xb')]=_0x30ee0b[_0x0590('0xb')]||0x1388;this[_0x0590('0xc')]=_0x30ee0b['tech']||_0x0590('0xd');this[_0x0590('0xe')]=_0x30ee0b['Trunk']?_0x30ee0b[_0x0590('0xe')]:undefined;this[_0x0590('0xf')]=_0x30ee0b[_0x0590('0xf')];this[_0x0590('0x10')]=_0x30ee0b[_0x0590('0x10')];}module[_0x0590('0x11')]=FaxAccount; \ No newline at end of file +var _0x582b=['description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','t38timeout','tech','SIP','Trunk','ListId','key','name'];(function(_0xc1136d,_0x3d339f){var _0x3ba510=function(_0x1e5a6b){while(--_0x1e5a6b){_0xc1136d['push'](_0xc1136d['shift']());}};_0x3ba510(++_0x3d339f);}(_0x582b,0x185));var _0xb582=function(_0x4d8656,_0x17dfc1){_0x4d8656=_0x4d8656-0x0;var _0x4b54f2=_0x582b[_0x4d8656];return _0x4b54f2;};'use strict';function FaxAccount(_0x2663d4){this['id']=_0x2663d4['id']||0x0;this[_0xb582('0x0')]=_0x2663d4[_0xb582('0x0')]||'';this['description']=_0x2663d4[_0xb582('0x1')];this['ecm']=_0x2663d4[_0xb582('0x2')];this[_0xb582('0x3')]=_0x2663d4[_0xb582('0x3')];this[_0xb582('0x4')]=_0x2663d4[_0xb582('0x4')];this[_0xb582('0x5')]=_0x2663d4[_0xb582('0x5')]||0x960;this[_0xb582('0x6')]=_0x2663d4['maxrate']||0x3840;this[_0xb582('0x7')]=_0x2663d4[_0xb582('0x7')]||'v17,v27,v29';this[_0xb582('0x8')]=_0x2663d4['gateway']||'no';this['faxdetect']=_0x2663d4['faxdetect']||'no';this[_0xb582('0x9')]=_0x2663d4[_0xb582('0x9')]||0x1388;this[_0xb582('0xa')]=_0x2663d4[_0xb582('0xa')]||_0xb582('0xb');this[_0xb582('0xc')]=_0x2663d4[_0xb582('0xc')]?_0x2663d4[_0xb582('0xc')]:undefined;this[_0xb582('0xd')]=_0x2663d4[_0xb582('0xd')];this[_0xb582('0xe')]=_0x2663d4[_0xb582('0xe')];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 5e96cf2..8e13789 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 _0xb40e=['Configurations','name','username','apiKey','token','serverUrl'];(function(_0x411a57,_0x569f06){var _0x482ac9=function(_0x3aefe1){while(--_0x3aefe1){_0x411a57['push'](_0x411a57['shift']());}};_0x482ac9(++_0x569f06);}(_0xb40e,0x14b));var _0xeb40=function(_0xf34109,_0x380779){_0xf34109=_0xf34109-0x0;var _0x570bfc=_0xb40e[_0xf34109];return _0x570bfc;};'use strict';function FreshdeskAccount(_0x32e2fe){this['id']=_0x32e2fe['id']||0x0;this['name']=_0x32e2fe[_0xeb40('0x0')]||'';this[_0xeb40('0x1')]=_0x32e2fe[_0xeb40('0x1')]||'';this[_0xeb40('0x2')]=_0x32e2fe[_0xeb40('0x3')]||'';this['remoteUri']=_0x32e2fe['remoteUri']||'';this[_0xeb40('0x4')]=_0x32e2fe[_0xeb40('0x4')]||'';this[_0xeb40('0x5')]=_0x32e2fe['Configurations']||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0x277c=['serverUrl','Configurations','exports','name','username','apiKey','remoteUri'];(function(_0x5e1c53,_0x33cfc1){var _0x5f17cf=function(_0x20a33a){while(--_0x20a33a){_0x5e1c53['push'](_0x5e1c53['shift']());}};_0x5f17cf(++_0x33cfc1);}(_0x277c,0xf8));var _0xc277=function(_0x222ee9,_0x36452a){_0x222ee9=_0x222ee9-0x0;var _0x1b57fc=_0x277c[_0x222ee9];return _0x1b57fc;};'use strict';function FreshdeskAccount(_0x5e4a38){this['id']=_0x5e4a38['id']||0x0;this[_0xc277('0x0')]=_0x5e4a38[_0xc277('0x0')]||'';this[_0xc277('0x1')]=_0x5e4a38['username']||'';this[_0xc277('0x2')]=_0x5e4a38['token']||'';this[_0xc277('0x3')]=_0x5e4a38[_0xc277('0x3')]||'';this['serverUrl']=_0x5e4a38[_0xc277('0x4')]||'';this[_0xc277('0x5')]=_0x5e4a38[_0xc277('0x5')]||{};}module[_0xc277('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 f02014e..30e5efa 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 _0xcd94=['remoteUri','serverUrl','Configurations','exports','name','apiKey','token'];(function(_0x5cb903,_0x14f1c2){var _0x10940f=function(_0x58a8e3){while(--_0x58a8e3){_0x5cb903['push'](_0x5cb903['shift']());}};_0x10940f(++_0x14f1c2);}(_0xcd94,0x1ee));var _0x4cd9=function(_0x10b2d5,_0x5a7743){_0x10b2d5=_0x10b2d5-0x0;var _0x14b8d1=_0xcd94[_0x10b2d5];return _0x14b8d1;};'use strict';function FreshsalesAccount(_0x7bcc5e){this['id']=_0x7bcc5e['id']||0x0;this[_0x4cd9('0x0')]=_0x7bcc5e[_0x4cd9('0x0')]||'';this['username']=_0x7bcc5e['username']||'';this[_0x4cd9('0x1')]=_0x7bcc5e[_0x4cd9('0x2')]||'';this['remoteUri']=_0x7bcc5e[_0x4cd9('0x3')]||'';this[_0x4cd9('0x4')]=_0x7bcc5e[_0x4cd9('0x4')]||'';this[_0x4cd9('0x5')]=_0x7bcc5e[_0x4cd9('0x5')]||{};}module[_0x4cd9('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0x9fe2=['username','apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x9fe2,0x6f));var _0x29fe=function(_0x13419e,_0x3e04e9){_0x13419e=_0x13419e-0x0;var _0x112be5=_0x9fe2[_0x13419e];return _0x112be5;};'use strict';function FreshsalesAccount(_0xdafd9b){this['id']=_0xdafd9b['id']||0x0;this[_0x29fe('0x0')]=_0xdafd9b[_0x29fe('0x0')]||'';this[_0x29fe('0x1')]=_0xdafd9b['username']||'';this[_0x29fe('0x2')]=_0xdafd9b[_0x29fe('0x3')]||'';this[_0x29fe('0x4')]=_0xdafd9b[_0x29fe('0x4')]||'';this[_0x29fe('0x5')]=_0xdafd9b[_0x29fe('0x5')]||'';this[_0x29fe('0x6')]=_0xdafd9b['Configurations']||{};}module[_0x29fe('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 332afb6..47babc9 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 _0xc4b9=['count','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','connectedlinenum','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','variables','exports','type','inbound','uniqueid','calleridname','queuecallerleaveAt'];(function(_0x1513ee,_0x53c62b){var _0x27d56b=function(_0x2ef6c8){while(--_0x2ef6c8){_0x1513ee['push'](_0x1513ee['shift']());}};_0x27d56b(++_0x53c62b);}(_0xc4b9,0x12f));var _0x9c4b=function(_0x5ba6e5,_0x51c613){_0x5ba6e5=_0x5ba6e5-0x0;var _0x26f3af=_0xc4b9[_0x5ba6e5];return _0x26f3af;};'use strict';function QueueReport(){this[_0x9c4b('0x0')]=_0x9c4b('0x1');this[_0x9c4b('0x2')]='';this['calleridnum']='';this[_0x9c4b('0x3')]='';this['queue']='';this['queuecallerjoinAt']=null;this[_0x9c4b('0x4')]=null;this['position']=0x1;this[_0x9c4b('0x5')]=0x1;this[_0x9c4b('0x6')]=![];this['queuecallerabandonAt']=null;this[_0x9c4b('0x7')]=![];this[_0x9c4b('0x8')]=null;this[_0x9c4b('0x9')]=![];this[_0x9c4b('0xa')]=null;this[_0x9c4b('0xb')]=0x1;this['channel']='';this[_0x9c4b('0xc')]='';this['connectedlinename']='';this[_0x9c4b('0xd')]='';this[_0x9c4b('0xe')]='';this[_0x9c4b('0xf')]='';this[_0x9c4b('0x10')]='';this[_0x9c4b('0x11')]=0x0;this[_0x9c4b('0x12')]=![];this[_0x9c4b('0x13')]='';this['mohtime']=0x0;this[_0x9c4b('0x14')]={};}module[_0x9c4b('0x15')]=QueueReport; \ No newline at end of file +var _0x0c8a=['queuecallercompleteAt','queuecallerexit','channel','connectedlinenum','connectedlinename','context','exten','priority','holdtime','assigned','lastAssignedTo','mohtime','variables','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandonAt','queuecallercomplete'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0c8a,0x76));var _0xa0c8=function(_0x600d90,_0x4d9b77){_0x600d90=_0x600d90-0x0;var _0x5a8f83=_0x0c8a[_0x600d90];return _0x5a8f83;};'use strict';function QueueReport(){this[_0xa0c8('0x0')]=_0xa0c8('0x1');this[_0xa0c8('0x2')]='';this[_0xa0c8('0x3')]='';this[_0xa0c8('0x4')]='';this[_0xa0c8('0x5')]='';this[_0xa0c8('0x6')]=null;this[_0xa0c8('0x7')]=null;this[_0xa0c8('0x8')]=0x1;this[_0xa0c8('0x9')]=0x1;this['queuecallerabandon']=![];this[_0xa0c8('0xa')]=null;this[_0xa0c8('0xb')]=![];this[_0xa0c8('0xc')]=null;this[_0xa0c8('0xd')]=![];this['queuecallerexitAt']=null;this['originalposition']=0x1;this[_0xa0c8('0xe')]='';this[_0xa0c8('0xf')]='';this[_0xa0c8('0x10')]='';this['accountcode']='';this[_0xa0c8('0x11')]='';this[_0xa0c8('0x12')]='';this[_0xa0c8('0x13')]='';this[_0xa0c8('0x14')]=0x0;this[_0xa0c8('0x15')]=![];this[_0xa0c8('0x16')]='';this[_0xa0c8('0x17')]=0x0;this[_0xa0c8('0x18')]={};}module[_0xa0c8('0x19')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 571164b..f42bf24 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 _0x32e9=['type','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken'];(function(_0x3098eb,_0x2f36ec){var _0x18e3f6=function(_0x228a3c){while(--_0x228a3c){_0x3098eb['push'](_0x3098eb['shift']());}};_0x18e3f6(++_0x2f36ec);}(_0x32e9,0xf6));var _0x932e=function(_0xee1ec9,_0x2f0599){_0xee1ec9=_0xee1ec9-0x0;var _0x102a53=_0x32e9[_0xee1ec9];return _0x102a53;};'use strict';function SalesforceAccount(_0x27c0d4){this['id']=_0x27c0d4['id']||0x0;this[_0x932e('0x0')]=_0x27c0d4[_0x932e('0x0')]||'';this['username']=_0x27c0d4[_0x932e('0x1')]||'';this[_0x932e('0x2')]=_0x27c0d4['remoteUri']||'';this['password']=_0x27c0d4[_0x932e('0x3')]||'';this[_0x932e('0x4')]=_0x27c0d4[_0x932e('0x4')]||'';this[_0x932e('0x5')]=_0x27c0d4[_0x932e('0x5')]||'';this[_0x932e('0x6')]=_0x27c0d4[_0x932e('0x6')]||'';this[_0x932e('0x7')]=_0x27c0d4[_0x932e('0x7')]||'integrationTab';this[_0x932e('0x8')]=_0x27c0d4['serverUrl']||'';this[_0x932e('0x9')]=_0x27c0d4['Configurations']||{};}module[_0x932e('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x2bb9=['clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','name','username','remoteUri','password','clientId'];(function(_0x3bbd1f,_0x119571){var _0x4cb1fe=function(_0x354967){while(--_0x354967){_0x3bbd1f['push'](_0x3bbd1f['shift']());}};_0x4cb1fe(++_0x119571);}(_0x2bb9,0x15b));var _0x92bb=function(_0x220e7c,_0x1e92d2){_0x220e7c=_0x220e7c-0x0;var _0x4c8de4=_0x2bb9[_0x220e7c];return _0x4c8de4;};'use strict';function SalesforceAccount(_0x4d5c76){this['id']=_0x4d5c76['id']||0x0;this[_0x92bb('0x0')]=_0x4d5c76[_0x92bb('0x0')]||'';this[_0x92bb('0x1')]=_0x4d5c76[_0x92bb('0x1')]||'';this[_0x92bb('0x2')]=_0x4d5c76[_0x92bb('0x2')]||'';this[_0x92bb('0x3')]=_0x4d5c76[_0x92bb('0x3')]||'';this[_0x92bb('0x4')]=_0x4d5c76['clientId']||'';this[_0x92bb('0x5')]=_0x4d5c76[_0x92bb('0x5')]||'';this[_0x92bb('0x6')]=_0x4d5c76[_0x92bb('0x6')]||'';this[_0x92bb('0x7')]=_0x4d5c76[_0x92bb('0x7')]||_0x92bb('0x8');this[_0x92bb('0x9')]=_0x4d5c76[_0x92bb('0x9')]||'';this[_0x92bb('0xa')]=_0x4d5c76[_0x92bb('0xa')]||{};}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 c22707f..c6d1a1c 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 _0x1ce8=['serverUrl','Configurations','name','username','password','remoteUri'];(function(_0x3f7cd5,_0x4d1a60){var _0x429e2a=function(_0x161b02){while(--_0x161b02){_0x3f7cd5['push'](_0x3f7cd5['shift']());}};_0x429e2a(++_0x4d1a60);}(_0x1ce8,0x1ee));var _0x81ce=function(_0x2d939c,_0xfc448f){_0x2d939c=_0x2d939c-0x0;var _0x908e5b=_0x1ce8[_0x2d939c];return _0x908e5b;};'use strict';function ServicenowAccount(_0x13189f){this['id']=_0x13189f['id']||0x0;this[_0x81ce('0x0')]=_0x13189f[_0x81ce('0x0')]||'';this[_0x81ce('0x1')]=_0x13189f[_0x81ce('0x1')]||'';this[_0x81ce('0x2')]=_0x13189f[_0x81ce('0x2')]||'';this[_0x81ce('0x3')]=_0x13189f[_0x81ce('0x3')]||'';this['serverUrl']=_0x13189f[_0x81ce('0x4')]||'';this[_0x81ce('0x5')]=_0x13189f[_0x81ce('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0xfe5b=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x183228,_0x26f970){var _0x562d6c=function(_0xa2963){while(--_0xa2963){_0x183228['push'](_0x183228['shift']());}};_0x562d6c(++_0x26f970);}(_0xfe5b,0x16a));var _0xbfe5=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xfe5b[_0x4709c0];return _0x13348b;};'use strict';function ServicenowAccount(_0x293f01){this['id']=_0x293f01['id']||0x0;this[_0xbfe5('0x0')]=_0x293f01['name']||'';this['username']=_0x293f01[_0xbfe5('0x1')]||'';this[_0xbfe5('0x2')]=_0x293f01[_0xbfe5('0x2')]||'';this[_0xbfe5('0x3')]=_0x293f01['remoteUri']||'';this['serverUrl']=_0x293f01[_0xbfe5('0x4')]||'';this[_0xbfe5('0x5')]=_0x293f01['Configurations']||{};}module[_0xbfe5('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 0e8d66f..0b31794 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 _0xba8b=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x2e2f84,_0x24e46f){var _0x448191=function(_0x336e06){while(--_0x336e06){_0x2e2f84['push'](_0x2e2f84['shift']());}};_0x448191(++_0x24e46f);}(_0xba8b,0xa1));var _0xbba8=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xba8b[_0x4565bf];return _0x5610ba;};'use strict';function SugarcrmAccount(_0x2f07c9){this['id']=_0x2f07c9['id']||0x0;this[_0xbba8('0x0')]=_0x2f07c9['name']||'';this['username']=_0x2f07c9[_0xbba8('0x1')]||'';this[_0xbba8('0x2')]=_0x2f07c9['password']||'';this['remoteUri']=_0x2f07c9[_0xbba8('0x3')]||'';this['serverUrl']=_0x2f07c9[_0xbba8('0x4')]||'';this[_0xbba8('0x5')]=_0x2f07c9[_0xbba8('0x5')]||{};}module[_0xbba8('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x0a17=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x40f65b,_0x1062c2){var _0x136f8f=function(_0x384dd9){while(--_0x384dd9){_0x40f65b['push'](_0x40f65b['shift']());}};_0x136f8f(++_0x1062c2);}(_0x0a17,0x116));var _0x70a1=function(_0x327e55,_0x18a4e3){_0x327e55=_0x327e55-0x0;var _0x43a33c=_0x0a17[_0x327e55];return _0x43a33c;};'use strict';function SugarcrmAccount(_0x3fc75d){this['id']=_0x3fc75d['id']||0x0;this['name']=_0x3fc75d[_0x70a1('0x0')]||'';this[_0x70a1('0x1')]=_0x3fc75d[_0x70a1('0x1')]||'';this[_0x70a1('0x2')]=_0x3fc75d[_0x70a1('0x2')]||'';this[_0x70a1('0x3')]=_0x3fc75d[_0x70a1('0x3')]||'';this[_0x70a1('0x4')]=_0x3fc75d[_0x70a1('0x4')]||'';this['Configurations']=_0x3fc75d[_0x70a1('0x5')]||{};}module[_0x70a1('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 28c7e6b..251e1b3 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 _0x3018=['accountcode','state','unknown','status','address','exports','name'];(function(_0x439f8f,_0x32e76b){var _0x3b4b59=function(_0x11853a){while(--_0x11853a){_0x439f8f['push'](_0x439f8f['shift']());}};_0x3b4b59(++_0x32e76b);}(_0x3018,0x164));var _0x8301=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x3018[_0x2be8c2];return _0x97f531;};'use strict';function Telephone(_0x2b164f){this['id']=_0x2b164f['id']||0x0;this['name']=_0x2b164f[_0x8301('0x0')]||'';this[_0x8301('0x1')]=_0x2b164f[_0x8301('0x1')]||'';this[_0x8301('0x2')]=_0x8301('0x3');this['stateTime']=0x0;this[_0x8301('0x4')]=_0x8301('0x3');this[_0x8301('0x5')]='';}module[_0x8301('0x6')]=Telephone; \ No newline at end of file +var _0x0bb6=['state','stateTime','unknown','address','exports','name','accountcode'];(function(_0x257ffa,_0x5a4530){var _0xd12fc7=function(_0xc681c8){while(--_0xc681c8){_0x257ffa['push'](_0x257ffa['shift']());}};_0xd12fc7(++_0x5a4530);}(_0x0bb6,0x83));var _0x60bb=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x0bb6[_0xfae23b];return _0x200640;};'use strict';function Telephone(_0x1635e5){this['id']=_0x1635e5['id']||0x0;this[_0x60bb('0x0')]=_0x1635e5[_0x60bb('0x0')]||'';this['accountcode']=_0x1635e5[_0x60bb('0x1')]||'';this[_0x60bb('0x2')]='unknown';this[_0x60bb('0x3')]=0x0;this['status']=_0x60bb('0x4');this[_0x60bb('0x5')]='';}module[_0x60bb('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 7bea600..c13b7d2 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 _0x9048=['name','html'];(function(_0x1d43cd,_0x518b48){var _0x1f9d90=function(_0x49484c){while(--_0x49484c){_0x1d43cd['push'](_0x1d43cd['shift']());}};_0x1f9d90(++_0x518b48);}(_0x9048,0x1b2));var _0x8904=function(_0x57399d,_0x44c083){_0x57399d=_0x57399d-0x0;var _0x146276=_0x9048[_0x57399d];return _0x146276;};'use strict';function template(_0x8121e6){this['id']=_0x8121e6['id']||0x0;this[_0x8904('0x0')]=_0x8121e6[_0x8904('0x0')]||'';this['html']=_0x8121e6[_0x8904('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0x30ef=['html','name'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x30ef,0x129));var _0xf30e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x30ef[_0x3dd15e];return _0x231fd0;};'use strict';function template(_0x2a7c03){this['id']=_0x2a7c03['id']||0x0;this[_0xf30e('0x0')]=_0x2a7c03[_0xf30e('0x0')]||'';this['html']=_0x2a7c03[_0xf30e('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index e8b5d00..5f8d327 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 _0x54ef=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x5ba391,_0x9a6ea2){var _0x8434ad=function(_0x352884){while(--_0x352884){_0x5ba391['push'](_0x5ba391['shift']());}};_0x8434ad(++_0x9a6ea2);}(_0x54ef,0x112));var _0xf54e=function(_0x32515f,_0x45169c){_0x32515f=_0x32515f-0x0;var _0x3f567e=_0x54ef[_0x32515f];return _0x3f567e;};'use strict';function Trigger(_0x19d4d5){this['id']=_0x19d4d5['id']||0x0;this[_0xf54e('0x0')]=_0x19d4d5[_0xf54e('0x0')]||'';this['channel']=_0x19d4d5[_0xf54e('0x1')]||_0xf54e('0x2');this[_0xf54e('0x3')]=_0x19d4d5[_0xf54e('0x3')]||![];this[_0xf54e('0x4')]=_0x19d4d5[_0xf54e('0x4')]||[];this[_0xf54e('0x5')]=_0x19d4d5['AnyConditions']||[];this['Actions']=_0x19d4d5[_0xf54e('0x6')]||[];}module[_0xf54e('0x7')]=Trigger; \ No newline at end of file +var _0x4b84=['name','channel','status','AllConditions','Actions'];(function(_0x4cd054,_0x167ed4){var _0x32808a=function(_0x496212){while(--_0x496212){_0x4cd054['push'](_0x4cd054['shift']());}};_0x32808a(++_0x167ed4);}(_0x4b84,0x1cc));var _0x44b8=function(_0x423097,_0x8a09f4){_0x423097=_0x423097-0x0;var _0x3a73f1=_0x4b84[_0x423097];return _0x3a73f1;};'use strict';function Trigger(_0x90ff31){this['id']=_0x90ff31['id']||0x0;this[_0x44b8('0x0')]=_0x90ff31['name']||'';this['channel']=_0x90ff31[_0x44b8('0x1')]||'voice';this['status']=_0x90ff31[_0x44b8('0x2')]||![];this[_0x44b8('0x3')]=_0x90ff31[_0x44b8('0x3')]||[];this['AnyConditions']=_0x90ff31['AnyConditions']||[];this['Actions']=_0x90ff31[_0x44b8('0x4')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index bb4f214..af8487d 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 _0x2d3d=['name','state','stateTime','status','registry','host','port','domain','refresh','stateRegistry','unknown','registrationtime','exports','active'];(function(_0xc34fca,_0x3e149d){var _0x3dd217=function(_0x8b7893){while(--_0x8b7893){_0xc34fca['push'](_0xc34fca['shift']());}};_0x3dd217(++_0x3e149d);}(_0x2d3d,0x1a3));var _0xd2d3=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x2d3d[_0x4565bf];return _0x5610ba;};'use strict';function Trunk(_0x2cea71){this['id']=_0x2cea71['id']||0x0;this[_0xd2d3('0x0')]=_0x2cea71[_0xd2d3('0x0')]||![];this[_0xd2d3('0x1')]=_0x2cea71[_0xd2d3('0x1')]||'';this[_0xd2d3('0x2')]='unknown';this[_0xd2d3('0x3')]=0x0;this[_0xd2d3('0x4')]='unknown';this['registry']=_0x2cea71[_0xd2d3('0x5')]&&_0x2cea71[_0xd2d3('0x5')]['indexOf'](':')?_0x2cea71[_0xd2d3('0x5')]['split'](':')[0x0]:'';this[_0xd2d3('0x6')]='';this[_0xd2d3('0x7')]='';this[_0xd2d3('0x8')]='';this['domainport']='';this[_0xd2d3('0x9')]='';this[_0xd2d3('0xa')]=_0xd2d3('0xb');this[_0xd2d3('0xc')]='';this['address']='';}module[_0xd2d3('0xd')]=Trunk; \ No newline at end of file +var _0xa75b=['stateRegistry','registrationtime','address','exports','name','state','unknown','stateTime','status','registry','indexOf','split','domain'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa75b,0x170));var _0xba75=function(_0x4aaf4a,_0x1a8f95){_0x4aaf4a=_0x4aaf4a-0x0;var _0x3d642b=_0xa75b[_0x4aaf4a];return _0x3d642b;};'use strict';function Trunk(_0x5b33c5){this['id']=_0x5b33c5['id']||0x0;this['active']=_0x5b33c5['active']||![];this[_0xba75('0x0')]=_0x5b33c5[_0xba75('0x0')]||'';this[_0xba75('0x1')]=_0xba75('0x2');this[_0xba75('0x3')]=0x0;this[_0xba75('0x4')]=_0xba75('0x2');this[_0xba75('0x5')]=_0x5b33c5[_0xba75('0x5')]&&_0x5b33c5[_0xba75('0x5')][_0xba75('0x6')](':')?_0x5b33c5[_0xba75('0x5')][_0xba75('0x7')](':')[0x0]:'';this['host']='';this['port']='';this[_0xba75('0x8')]='';this['domainport']='';this['refresh']='';this[_0xba75('0x9')]='unknown';this[_0xba75('0xa')]='';this[_0xba75('0xb')]='';}module[_0xba75('0xc')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 86e8076..116339f 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 _0x8ecb=['exports','exten','recordingFormat','mandatoryDisposition'];(function(_0x25b4a4,_0x2e081b){var _0x707267=function(_0x440123){while(--_0x440123){_0x25b4a4['push'](_0x25b4a4['shift']());}};_0x707267(++_0x2e081b);}(_0x8ecb,0xe9));var _0xb8ec=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x8ecb[_0x23e7c1];return _0x1add43;};'use strict';function voiceExtension(_0x2748fc){this['id']=_0x2748fc['id']||0x0;this[_0xb8ec('0x0')]=_0x2748fc[_0xb8ec('0x0')]||'';this[_0xb8ec('0x1')]=_0x2748fc['recordingFormat']||'none';this[_0xb8ec('0x2')]=_0x2748fc[_0xb8ec('0x2')]||![];}module[_0xb8ec('0x3')]=voiceExtension; \ No newline at end of file +var _0xcc24=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0xae31b8,_0x40f4d1){var _0x53d934=function(_0x4ac320){while(--_0x4ac320){_0xae31b8['push'](_0xae31b8['shift']());}};_0x53d934(++_0x40f4d1);}(_0xcc24,0xc2));var _0x4cc2=function(_0x15d228,_0x2ad87d){_0x15d228=_0x15d228-0x0;var _0x4d1b25=_0xcc24[_0x15d228];return _0x4d1b25;};'use strict';function voiceExtension(_0x55150){this['id']=_0x55150['id']||0x0;this['exten']=_0x55150[_0x4cc2('0x0')]||'';this[_0x4cc2('0x1')]=_0x55150[_0x4cc2('0x1')]||_0x4cc2('0x2');this[_0x4cc2('0x3')]=_0x55150['mandatoryDisposition']||![];}module[_0x4cc2('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 5ad889b..f8f95da 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 _0xf6ce=['abandoned','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','unavailable','onhold','wav','wav49','gsm','rrmemory','name','monitor_format','type','inbound','total','answered','sumDuration','sumHoldTime','unmanaged'];(function(_0x53a882,_0x5a2537){var _0x1a6bea=function(_0x393a1d){while(--_0x393a1d){_0x53a882['push'](_0x53a882['shift']());}};_0x1a6bea(++_0x5a2537);}(_0xf6ce,0x15a));var _0xef6c=function(_0x3c64dd,_0x536fa1){_0x3c64dd=_0x3c64dd-0x0;var _0x213167=_0xf6ce[_0x3c64dd];return _0x213167;};'use strict';var statusDesc=[_0xef6c('0x0'),_0xef6c('0x1'),_0xef6c('0x2'),_0xef6c('0x3'),_0xef6c('0x4'),_0xef6c('0x5'),'ringing','ringinuse',_0xef6c('0x6')];var monitorFormat={'wav':_0xef6c('0x7'),'wav49':_0xef6c('0x8'),'gsm':_0xef6c('0x9')};var strategy={'rrmemory':_0xef6c('0xa'),'roundrobin':'roundrobin'};function VoiceQueue(_0x30e8aa){this['id']=_0x30e8aa['id']||0x0;this['name']=_0x30e8aa[_0xef6c('0xb')]||'';this[_0xef6c('0xc')]=_0x30e8aa[_0xef6c('0xc')]||'';this['type']=_0x30e8aa[_0xef6c('0xd')]||_0xef6c('0xe');this['waiting']=0x0;this['talking']=0x0;this[_0xef6c('0xf')]=0x0;this[_0xef6c('0x10')]=0x0;this[_0xef6c('0x11')]=0x0;this[_0xef6c('0x12')]=0x0;this['sumBillable']=0x0;this[_0xef6c('0x13')]=0x0;this[_0xef6c('0x14')]=0x0;this['loggedIn']=0x0;this[_0xef6c('0x15')]=0x0;this['acw']=_0x30e8aa[_0xef6c('0x16')]||![];this[_0xef6c('0x17')]=_0x30e8aa[_0xef6c('0x17')]||0xa;this['autopause']=_0x30e8aa[_0xef6c('0x18')]||'no';this[_0xef6c('0x19')]=!![];this[_0xef6c('0x1a')]='';this[_0xef6c('0x1b')]=0x0;this[_0xef6c('0x1c')]=0x0;this[_0xef6c('0x1d')]=_0x30e8aa[_0xef6c('0x1d')]||null;this[_0xef6c('0x1e')]=_0x30e8aa[_0xef6c('0x1e')]?_0x30e8aa[_0xef6c('0x1e')]:null;this[_0xef6c('0x1f')]=_0x30e8aa[_0xef6c('0x1f')];this['dialMethod']=_0x30e8aa[_0xef6c('0x20')]||_0xef6c('0x21');this[_0xef6c('0x22')]=_0x30e8aa['dialLimitChannel']||0x0;this[_0xef6c('0x23')]=_0x30e8aa[_0xef6c('0x23')]||0x0;this[_0xef6c('0x24')]=_0x30e8aa['dialPowerLevel']||0x1;this[_0xef6c('0x25')]=_0x30e8aa[_0xef6c('0x25')]||_0xef6c('0x26');this[_0xef6c('0x27')]=_0x30e8aa[_0xef6c('0x27')]||0.03;this[_0xef6c('0x28')]=_0x30e8aa['dialPredictiveInterval']||0x258;this[_0xef6c('0x29')]=_0x30e8aa[_0xef6c('0x29')]||_0xef6c('0x2a');this[_0xef6c('0x2b')]=_0x30e8aa['dialOriginateCallerIdNumber']||_0xef6c('0x2a');this['dialOriginateTimeout']=_0x30e8aa[_0xef6c('0x2c')]||0x1e;this[_0xef6c('0x2d')]=_0x30e8aa[_0xef6c('0x2d')]||_0xef6c('0x2e');this[_0xef6c('0x2f')]=_0x30e8aa[_0xef6c('0x2f')]||0x3;this[_0xef6c('0x30')]=_0x30e8aa['dialQueueProject']||undefined;this[_0xef6c('0x31')]=_0x30e8aa[_0xef6c('0x31')]||0x3;this[_0xef6c('0x32')]=_0x30e8aa[_0xef6c('0x32')]||0x96;this[_0xef6c('0x33')]=_0x30e8aa[_0xef6c('0x33')]||0x3;this['dialBusyRetryFrequency']=_0x30e8aa['dialBusyRetryFrequency']||0x96;this[_0xef6c('0x34')]=_0x30e8aa[_0xef6c('0x34')]||0x3;this[_0xef6c('0x35')]=_0x30e8aa[_0xef6c('0x35')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x30e8aa[_0xef6c('0x36')]||0x3;this[_0xef6c('0x37')]=_0x30e8aa[_0xef6c('0x37')]||0x96;this[_0xef6c('0x38')]=_0x30e8aa[_0xef6c('0x38')]||0x3;this[_0xef6c('0x39')]=_0x30e8aa['dialDropRetryFrequency']||0x96;this[_0xef6c('0x3a')]=_0x30e8aa[_0xef6c('0x3a')]||0x3;this[_0xef6c('0x3b')]=_0x30e8aa[_0xef6c('0x3b')]||0x96;this['dialMachineMaxRetry']=_0x30e8aa['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x30e8aa[_0xef6c('0x3c')]||0x96;this[_0xef6c('0x3d')]=_0x30e8aa[_0xef6c('0x3d')]||0x3;this[_0xef6c('0x3e')]=_0x30e8aa[_0xef6c('0x3e')]||0x96;this['dialGlobalMaxRetry']=_0x30e8aa[_0xef6c('0x3f')]||0x4;this[_0xef6c('0x40')]=_0x30e8aa[_0xef6c('0x40')]?_0x30e8aa['Trunk']:undefined;this[_0xef6c('0x41')]=_0x30e8aa['TrunkBackup']?_0x30e8aa[_0xef6c('0x41')]:undefined;this[_0xef6c('0x42')]=_0x30e8aa[_0xef6c('0x42')]||undefined;this[_0xef6c('0x43')]=_0x30e8aa[_0xef6c('0x43')]?_0x30e8aa[_0xef6c('0x43')]:undefined;this['dialOrderByScheduledAt']=_0x30e8aa[_0xef6c('0x44')]||'DESC';this['dialRandomLastDigitCallerIdNumber']=_0x30e8aa[_0xef6c('0x45')]||undefined;this[_0xef6c('0x46')]=_0x30e8aa['dialCutDigit']||undefined;this[_0xef6c('0x47')]=strategy[_0x30e8aa[_0xef6c('0x47')]]||'rrmemory';this[_0xef6c('0x48')]=!![];this['dialAMDActive']=_0x30e8aa[_0xef6c('0x49')]||![];this[_0xef6c('0x4a')]=_0x30e8aa['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x30e8aa[_0xef6c('0x4b')];this[_0xef6c('0x4c')]=_0x30e8aa[_0xef6c('0x4c')];this[_0xef6c('0x4d')]=_0x30e8aa[_0xef6c('0x4d')];this[_0xef6c('0x4e')]=_0x30e8aa[_0xef6c('0x4e')];this[_0xef6c('0x4f')]=_0x30e8aa[_0xef6c('0x4f')];this[_0xef6c('0x50')]=_0x30e8aa['dialAMDMaximumNumberOfWords'];this[_0xef6c('0x51')]=_0x30e8aa['dialAMDSilenceThreshold'];this[_0xef6c('0x52')]=_0x30e8aa[_0xef6c('0x52')];this[_0xef6c('0x53')]=0x0;this[_0xef6c('0x54')]=0x0;this[_0xef6c('0x55')]=_0x30e8aa[_0xef6c('0x55')];this['outboundAnswerCallsDay']=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0xef6c('0x56')]=0x0;this[_0xef6c('0x57')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0xef6c('0x58')]=0x0;this[_0xef6c('0x59')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xef6c('0x5a')]=0x0;this[_0xef6c('0x5b')]=0x0;this[_0xef6c('0x5c')]=0x0;this[_0xef6c('0x5d')]=0x0;this[_0xef6c('0x5e')]=0x0;this[_0xef6c('0x5f')]=0x0;this[_0xef6c('0x60')]=undefined;this['startPredictive']=undefined;this[_0xef6c('0x61')]=undefined;this[_0xef6c('0x62')]=1.05;this[_0xef6c('0x63')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0xef6c('0x64')]=0x0;this[_0xef6c('0x65')]=0x0;this[_0xef6c('0x66')]=0x0;this[_0xef6c('0x67')]=0x0;this[_0xef6c('0x68')]=0x0;this[_0xef6c('0x69')]=_0x30e8aa[_0xef6c('0x6a')]||0x14;this[_0xef6c('0x6b')]=_0x30e8aa[_0xef6c('0x6a')]||0xa;this[_0xef6c('0x6c')]=0x0;this[_0xef6c('0x6d')]=0x0;this[_0xef6c('0x6e')]=0x1;this['erlangCalls']=0x0;this[_0xef6c('0x6f')]=0x0;this[_0xef6c('0x70')]=0x0;this[_0xef6c('0x71')]=0x0;this[_0xef6c('0x72')]=_0x30e8aa[_0xef6c('0x72')]||0x1e;this[_0xef6c('0x73')]=_0x30e8aa[_0xef6c('0x73')]||![];this[_0xef6c('0x74')]=_0x30e8aa[_0xef6c('0x74')]||undefined;this[_0xef6c('0x75')]=_0x30e8aa[_0xef6c('0x75')]||![];this[_0xef6c('0x76')]=_0x30e8aa[_0xef6c('0x76')]||![];this[_0xef6c('0xc')]=monitorFormat[_0x30e8aa['monitor_format']]?monitorFormat[_0x30e8aa[_0xef6c('0xc')]]:undefined;this[_0xef6c('0x77')]=_0x30e8aa['mandatoryDisposition']||![];this[_0xef6c('0x78')]=_0x30e8aa['mandatoryDispositionPause']?_0x30e8aa[_0xef6c('0x78')]:undefined;}module[_0xef6c('0x79')]=VoiceQueue; \ No newline at end of file +var _0xad10=['dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','unavailable','onhold','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','loggedIn','available','acw','acwTimeout','autopause','message','originated','temp','dialTimezone','dialGlobalInterval','dialMethod','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','TrunkBackup'];(function(_0x3accb6,_0x38f4e8){var _0x1cdb0d=function(_0x53e7e0){while(--_0x53e7e0){_0x3accb6['push'](_0x3accb6['shift']());}};_0x1cdb0d(++_0x38f4e8);}(_0xad10,0x118));var _0x0ad1=function(_0x3f7df4,_0x429989){_0x3f7df4=_0x3f7df4-0x0;var _0x11560c=_0xad10[_0x3f7df4];return _0x11560c;};'use strict';var statusDesc=[_0x0ad1('0x0'),_0x0ad1('0x1'),_0x0ad1('0x2'),_0x0ad1('0x3'),'invalid',_0x0ad1('0x4'),'ringing','ringinuse',_0x0ad1('0x5')];var monitorFormat={'wav':_0x0ad1('0x6'),'wav49':_0x0ad1('0x7'),'gsm':_0x0ad1('0x8')};var strategy={'rrmemory':_0x0ad1('0x9'),'roundrobin':_0x0ad1('0xa')};function VoiceQueue(_0xaf0631){this['id']=_0xaf0631['id']||0x0;this[_0x0ad1('0xb')]=_0xaf0631[_0x0ad1('0xb')]||'';this[_0x0ad1('0xc')]=_0xaf0631[_0x0ad1('0xc')]||'';this[_0x0ad1('0xd')]=_0xaf0631[_0x0ad1('0xd')]||_0x0ad1('0xe');this[_0x0ad1('0xf')]=0x0;this[_0x0ad1('0x10')]=0x0;this[_0x0ad1('0x11')]=0x0;this[_0x0ad1('0x12')]=0x0;this[_0x0ad1('0x13')]=0x0;this[_0x0ad1('0x14')]=0x0;this[_0x0ad1('0x15')]=0x0;this[_0x0ad1('0x16')]=0x0;this['abandoned']=0x0;this[_0x0ad1('0x17')]=0x0;this[_0x0ad1('0x18')]=0x0;this[_0x0ad1('0x19')]=_0xaf0631[_0x0ad1('0x19')]||![];this[_0x0ad1('0x1a')]=_0xaf0631[_0x0ad1('0x1a')]||0xa;this[_0x0ad1('0x1b')]=_0xaf0631[_0x0ad1('0x1b')]||'no';this['sendMessageOneNotActive']=!![];this[_0x0ad1('0x1c')]='';this[_0x0ad1('0x1d')]=0x0;this[_0x0ad1('0x1e')]=0x0;this['dialTimezone']=_0xaf0631[_0x0ad1('0x1f')]||null;this[_0x0ad1('0x20')]=_0xaf0631[_0x0ad1('0x20')]?_0xaf0631[_0x0ad1('0x20')]:null;this['dialActive']=_0xaf0631['dialActive'];this[_0x0ad1('0x21')]=_0xaf0631[_0x0ad1('0x21')]||'progressive';this['dialLimitChannel']=_0xaf0631[_0x0ad1('0x22')]||0x0;this['dialLimitQueue']=_0xaf0631[_0x0ad1('0x23')]||0x0;this['dialPowerLevel']=_0xaf0631['dialPowerLevel']||0x1;this[_0x0ad1('0x24')]=_0xaf0631[_0x0ad1('0x24')]||_0x0ad1('0x25');this['dialPredictiveOptimizationPercentage']=_0xaf0631[_0x0ad1('0x26')]||0.03;this['dialPredictiveInterval']=_0xaf0631[_0x0ad1('0x27')]||0x258;this[_0x0ad1('0x28')]=_0xaf0631[_0x0ad1('0x28')]||_0x0ad1('0x29');this[_0x0ad1('0x2a')]=_0xaf0631[_0x0ad1('0x2a')]||_0x0ad1('0x29');this['dialOriginateTimeout']=_0xaf0631['dialOriginateTimeout']||0x1e;this['dialQueueOptions']=_0xaf0631[_0x0ad1('0x2b')]||'tTxX';this[_0x0ad1('0x2c')]=_0xaf0631[_0x0ad1('0x2c')]||0x3;this['dialQueueProject']=_0xaf0631[_0x0ad1('0x2d')]||undefined;this['dialCongestionMaxRetry']=_0xaf0631['dialCongestionMaxRetry']||0x3;this[_0x0ad1('0x2e')]=_0xaf0631[_0x0ad1('0x2e')]||0x96;this['dialBusyMaxRetry']=_0xaf0631[_0x0ad1('0x2f')]||0x3;this[_0x0ad1('0x30')]=_0xaf0631['dialBusyRetryFrequency']||0x96;this['dialNoAnswerMaxRetry']=_0xaf0631[_0x0ad1('0x31')]||0x3;this['dialNoAnswerRetryFrequency']=_0xaf0631[_0x0ad1('0x32')]||0x96;this[_0x0ad1('0x33')]=_0xaf0631[_0x0ad1('0x33')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0xaf0631[_0x0ad1('0x34')]||0x96;this['dialDropMaxRetry']=_0xaf0631['dialDropMaxRetry']||0x3;this[_0x0ad1('0x35')]=_0xaf0631[_0x0ad1('0x35')]||0x96;this['dialAbandonedMaxRetry']=_0xaf0631[_0x0ad1('0x36')]||0x3;this['dialAbandonedRetryFrequency']=_0xaf0631['dialAbandonedRetryFrequency']||0x96;this[_0x0ad1('0x37')]=_0xaf0631[_0x0ad1('0x37')]||0x3;this[_0x0ad1('0x38')]=_0xaf0631['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0xaf0631['dialAgentRejectMaxRetry']||0x3;this[_0x0ad1('0x39')]=_0xaf0631['dialAgentRejectRetryFrequency']||0x96;this['dialGlobalMaxRetry']=_0xaf0631['dialGlobalMaxRetry']||0x4;this['Trunk']=_0xaf0631['Trunk']?_0xaf0631['Trunk']:undefined;this[_0x0ad1('0x3a')]=_0xaf0631['TrunkBackup']?_0xaf0631[_0x0ad1('0x3a')]:undefined;this['dialPrefix']=_0xaf0631[_0x0ad1('0x3b')]||undefined;this[_0x0ad1('0x3c')]=_0xaf0631[_0x0ad1('0x3c')]?_0xaf0631['Interval']:undefined;this[_0x0ad1('0x3d')]=_0xaf0631[_0x0ad1('0x3d')]||_0x0ad1('0x3e');this[_0x0ad1('0x3f')]=_0xaf0631[_0x0ad1('0x3f')]||undefined;this[_0x0ad1('0x40')]=_0xaf0631[_0x0ad1('0x40')]||undefined;this[_0x0ad1('0x41')]=strategy[_0xaf0631[_0x0ad1('0x41')]]||_0x0ad1('0x9');this[_0x0ad1('0x42')]=!![];this[_0x0ad1('0x43')]=_0xaf0631[_0x0ad1('0x43')]||![];this[_0x0ad1('0x44')]=_0xaf0631[_0x0ad1('0x44')];this[_0x0ad1('0x45')]=_0xaf0631[_0x0ad1('0x45')];this[_0x0ad1('0x46')]=_0xaf0631[_0x0ad1('0x46')];this[_0x0ad1('0x47')]=_0xaf0631[_0x0ad1('0x47')];this[_0x0ad1('0x48')]=_0xaf0631[_0x0ad1('0x48')];this['dialAMDBetweenWordsSilence']=_0xaf0631[_0x0ad1('0x49')];this[_0x0ad1('0x4a')]=_0xaf0631[_0x0ad1('0x4a')];this[_0x0ad1('0x4b')]=_0xaf0631[_0x0ad1('0x4b')];this[_0x0ad1('0x4c')]=_0xaf0631['dialAMDMaximumWordLength'];this[_0x0ad1('0x4d')]=0x0;this[_0x0ad1('0x4e')]=0x0;this[_0x0ad1('0x4f')]=_0xaf0631[_0x0ad1('0x4f')];this['outboundAnswerCallsDay']=0x0;this['outboundAnswerAgiCallsDay']=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x0ad1('0x50')]=0x0;this[_0x0ad1('0x51')]=0x0;this[_0x0ad1('0x52')]=0x0;this[_0x0ad1('0x53')]=0x0;this[_0x0ad1('0x54')]=0x0;this[_0x0ad1('0x55')]=0x0;this[_0x0ad1('0x56')]=0x0;this[_0x0ad1('0x57')]=0x0;this['outboundDropCallsDayACS']=0x0;this['outboundReCallsDay']=0x0;this[_0x0ad1('0x58')]=0x0;this[_0x0ad1('0x59')]=undefined;this[_0x0ad1('0x5a')]=undefined;this[_0x0ad1('0x5b')]=undefined;this[_0x0ad1('0x5c')]=1.05;this[_0x0ad1('0x5d')]=0x0;this[_0x0ad1('0x5e')]=0x0;this[_0x0ad1('0x5f')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x0ad1('0x60')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this['predictiveIntervalPauses']=0x0;this[_0x0ad1('0x61')]=0x0;this['predictiveIntervalMaxThreshold']=_0xaf0631[_0x0ad1('0x62')]||0x14;this[_0x0ad1('0x63')]=_0xaf0631[_0x0ad1('0x62')]||0xa;this[_0x0ad1('0x64')]=0x0;this[_0x0ad1('0x65')]=0x0;this[_0x0ad1('0x66')]=0x1;this[_0x0ad1('0x67')]=0x0;this[_0x0ad1('0x68')]=0x0;this[_0x0ad1('0x69')]=0x0;this['erlangBusyFactor']=0x0;this[_0x0ad1('0x6a')]=_0xaf0631[_0x0ad1('0x6a')]||0x1e;this['dialRecallInQueue']=_0xaf0631[_0x0ad1('0x6b')]||![];this['dialQueueProject2']=_0xaf0631['dialQueueProject2']||undefined;this[_0x0ad1('0x6c')]=_0xaf0631[_0x0ad1('0x6c')]||![];this[_0x0ad1('0x6d')]=_0xaf0631['dialAgiAfterHangupAgent']||![];this[_0x0ad1('0xc')]=monitorFormat[_0xaf0631[_0x0ad1('0xc')]]?monitorFormat[_0xaf0631[_0x0ad1('0xc')]]:undefined;this[_0x0ad1('0x6e')]=_0xaf0631[_0x0ad1('0x6e')]||![];this[_0x0ad1('0x6f')]=_0xaf0631['mandatoryDispositionPause']?_0xaf0631[_0x0ad1('0x6f')]:undefined;}module[_0x0ad1('0x70')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index fc582fc..926f2dc 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 _0x7d6e=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x333535,_0x5171a1){var _0x4b96f1=function(_0x209bb3){while(--_0x209bb3){_0x333535['push'](_0x333535['shift']());}};_0x4b96f1(++_0x5171a1);}(_0x7d6e,0x1c8));var _0xe7d6=function(_0x2d0d9f,_0x22c0d8){_0x2d0d9f=_0x2d0d9f-0x0;var _0x30243d=_0x7d6e[_0x2d0d9f];return _0x30243d;};'use strict';function VtigerAccount(_0x39bfad){this['id']=_0x39bfad['id']||0x0;this[_0xe7d6('0x0')]=_0x39bfad[_0xe7d6('0x0')]||'';this[_0xe7d6('0x1')]=_0x39bfad[_0xe7d6('0x1')]||'';this[_0xe7d6('0x2')]=_0x39bfad[_0xe7d6('0x2')]||'';this[_0xe7d6('0x3')]=_0x39bfad['remoteUri']||'';this[_0xe7d6('0x4')]=_0x39bfad[_0xe7d6('0x4')]||'';this[_0xe7d6('0x5')]=_0x39bfad[_0xe7d6('0x5')]||{};}module[_0xe7d6('0x6')]=VtigerAccount; \ No newline at end of file +var _0x9abc=['serverUrl','Configurations','exports','username','accessKey','remoteUri'];(function(_0x3526ea,_0x4ae281){var _0x11a2a7=function(_0x472366){while(--_0x472366){_0x3526ea['push'](_0x3526ea['shift']());}};_0x11a2a7(++_0x4ae281);}(_0x9abc,0x165));var _0xc9ab=function(_0x4095fd,_0x51e8b1){_0x4095fd=_0x4095fd-0x0;var _0x44dd78=_0x9abc[_0x4095fd];return _0x44dd78;};'use strict';function VtigerAccount(_0x427e4c){this['id']=_0x427e4c['id']||0x0;this['name']=_0x427e4c['name']||'';this[_0xc9ab('0x0')]=_0x427e4c[_0xc9ab('0x0')]||'';this[_0xc9ab('0x1')]=_0x427e4c['accessKey']||'';this['remoteUri']=_0x427e4c[_0xc9ab('0x2')]||'';this[_0xc9ab('0x3')]=_0x427e4c[_0xc9ab('0x3')]||'';this[_0xc9ab('0x4')]=_0x427e4c[_0xc9ab('0x4')]||{};}module[_0xc9ab('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 e6ee511..2c24e2c 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(_0x2c72d2,_0x568409){_0x2c72d2=_0x2c72d2-0x0;var _0x46cbed=_0xdb28[_0x2c72d2];return _0x46cbed;};'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 _0xadb5=['token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xadb5,0xad));var _0x5adb=function(_0x4d8a06,_0x53d89e){_0x4d8a06=_0x4d8a06-0x0;var _0x317da8=_0xadb5[_0x4d8a06];return _0x317da8;};'use strict';function ZendeskAccount(_0x1f969c){this['id']=_0x1f969c['id']||0x0;this[_0x5adb('0x0')]=_0x1f969c['name']||'';this[_0x5adb('0x1')]=_0x1f969c[_0x5adb('0x1')]||'';this[_0x5adb('0x2')]=_0x1f969c['password']||'';this[_0x5adb('0x3')]=_0x1f969c[_0x5adb('0x3')]||'';this[_0x5adb('0x4')]=_0x1f969c['remoteUri']||'';this[_0x5adb('0x5')]=_0x1f969c[_0x5adb('0x5')]||'';this[_0x5adb('0x6')]=_0x1f969c[_0x5adb('0x6')]||_0x5adb('0x7');this[_0x5adb('0x8')]=_0x1f969c[_0x5adb('0x8')]||'';this[_0x5adb('0x9')]=_0x1f969c[_0x5adb('0x9')]||{};}module[_0x5adb('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index af2e3b9..5a0be5b 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 _0xa478=['Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken'];(function(_0x153c6a,_0x2a217a){var _0xce898f=function(_0x84c97c){while(--_0x84c97c){_0x153c6a['push'](_0x153c6a['shift']());}};_0xce898f(++_0x2a217a);}(_0xa478,0x136));var _0x8a47=function(_0x34f0fb,_0x3323b2){_0x34f0fb=_0x34f0fb-0x0;var _0x9b7b2b=_0xa478[_0x34f0fb];return _0x9b7b2b;};'use strict';function ZohoAccount(_0x22222c){this['id']=_0x22222c['id']||0x0;this[_0x8a47('0x0')]=_0x22222c[_0x8a47('0x0')]||'';this[_0x8a47('0x1')]=_0x22222c[_0x8a47('0x1')]||'';this[_0x8a47('0x2')]=_0x22222c[_0x8a47('0x2')]||'';this[_0x8a47('0x3')]=_0x22222c[_0x8a47('0x3')]||'';this[_0x8a47('0x4')]=_0x22222c[_0x8a47('0x4')]||'';this[_0x8a47('0x5')]=_0x22222c['clientSecret']||'';this[_0x8a47('0x6')]=_0x22222c[_0x8a47('0x6')]||'';this[_0x8a47('0x7')]=_0x22222c[_0x8a47('0x7')]||'';this['refreshToken']=_0x22222c[_0x8a47('0x8')]||'';this['Configurations']=_0x22222c[_0x8a47('0x9')]||{};}module[_0x8a47('0xa')]=ZohoAccount; \ No newline at end of file +var _0xa6ea=['name','description','host','zone','clientId','clientSecret','code','refreshToken','Configurations','exports'];(function(_0x3e59da,_0x2f09a8){var _0x2a130c=function(_0x421be5){while(--_0x421be5){_0x3e59da['push'](_0x3e59da['shift']());}};_0x2a130c(++_0x2f09a8);}(_0xa6ea,0x122));var _0xaa6e=function(_0x28c8c9,_0x172d10){_0x28c8c9=_0x28c8c9-0x0;var _0x365a70=_0xa6ea[_0x28c8c9];return _0x365a70;};'use strict';function ZohoAccount(_0x5802d8){this['id']=_0x5802d8['id']||0x0;this[_0xaa6e('0x0')]=_0x5802d8[_0xaa6e('0x0')]||'';this[_0xaa6e('0x1')]=_0x5802d8[_0xaa6e('0x1')]||'';this[_0xaa6e('0x2')]=_0x5802d8[_0xaa6e('0x2')]||'';this['zone']=_0x5802d8[_0xaa6e('0x3')]||'';this[_0xaa6e('0x4')]=_0x5802d8[_0xaa6e('0x4')]||'';this[_0xaa6e('0x5')]=_0x5802d8[_0xaa6e('0x5')]||'';this['serverUrl']=_0x5802d8['serverUrl']||'';this[_0xaa6e('0x6')]=_0x5802d8[_0xaa6e('0x6')]||'';this[_0xaa6e('0x7')]=_0x5802d8[_0xaa6e('0x7')]||'';this[_0xaa6e('0x8')]=_0x5802d8[_0xaa6e('0x8')]||{};}module[_0xaa6e('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 a956649..fec9f8d 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 _0x303a=['countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','exports','util','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','calleridname','phone','Contact','firstName','lastName','active','scheduledat','countbusyretry','countcongestionretry'];(function(_0x59ea35,_0x473755){var _0x1bc334=function(_0x3536a5){while(--_0x3536a5){_0x59ea35['push'](_0x59ea35['shift']());}};_0x1bc334(++_0x473755);}(_0x303a,0x114));var _0xa303=function(_0x13ac10,_0x46e79e){_0x13ac10=_0x13ac10-0x0;var _0x28eda2=_0x303a[_0x13ac10];return _0x28eda2;};'use strict';var util=require(_0xa303('0x0'));var _=require(_0xa303('0x1'));var moment=require(_0xa303('0x2'));function checkNameSurname(_0x5edc0b,_0x16ca52,_0x25a379){var _0xcf3730='';if(!_[_0xa303('0x3')](_0x16ca52)&&_0xa303('0x4')===typeof _0x16ca52){_0xcf3730+=_0x16ca52;}if(!_[_0xa303('0x3')](_0x25a379)&&_0xa303('0x4')===typeof _0x25a379){_0xcf3730+='\x20'+_0x25a379;}if(_0xcf3730!==''){return _0xcf3730;}return _0x5edc0b;}function Action(_0x3445f7,_0x586c67,_0x31475e,_0x6c988d,_0x4f40d6){this[_0xa303('0x5')]=_0x31475e||undefined;this[_0xa303('0x6')]=_0x3445f7['id'];this[_0xa303('0x7')]=_0x586c67[_0xa303('0x8')];this[_0xa303('0x9')]=_0x586c67[_0xa303('0x9')];this[_0xa303('0xa')]=_0xa303('0x7');this[_0xa303('0xb')]=![];this[_0xa303('0xc')]=_[_0xa303('0x3')](_0x3445f7[_0xa303('0xd')])?undefined:_0x3445f7[_0xa303('0xd')][_0xa303('0x8')];this[_0xa303('0xe')]=this[_0xa303('0xc')]?util[_0xa303('0xf')]('SIP/%s',this[_0xa303('0xc')]):_0x6c988d||undefined;this[_0xa303('0x10')]=checkNameSurname(_0x3445f7['Contact'][_0xa303('0x11')],_0x3445f7[_0xa303('0x12')][_0xa303('0x13')],_0x3445f7['Contact'][_0xa303('0x14')]);this[_0xa303('0x15')]=_0x3445f7[_0xa303('0x15')]||![];this['calleridnum']=_0x3445f7[_0xa303('0x12')][_0xa303('0x11')];this[_0xa303('0x16')]=_0x3445f7['scheduledat'];this[_0xa303('0x17')]=_0x3445f7[_0xa303('0x17')]||0x0;this['countcongestionretry']=_0x3445f7[_0xa303('0x18')]||0x0;this[_0xa303('0x19')]=_0x3445f7[_0xa303('0x19')]||0x0;this['countglobal']=(_0x3445f7[_0xa303('0x17')]||0x0)+(_0x3445f7['countcongestionretry']||0x0)+(_0x3445f7[_0xa303('0x19')]||0x0)+(_0x3445f7[_0xa303('0x1a')]||0x0)+(_0x3445f7[_0xa303('0x1b')]||0x0)+(_0x3445f7[_0xa303('0x1c')]||0x0)+(_0x3445f7['countmachineretry']||0x0)+(_0x3445f7['countagentrejectretry']||0x0);this[_0xa303('0x1a')]=_0x3445f7[_0xa303('0x1a')]||0x0;this[_0xa303('0x1b')]=_0x3445f7[_0xa303('0x1b')]||0x0;this[_0xa303('0x1c')]=_0x3445f7[_0xa303('0x1c')]||0x0;this[_0xa303('0x1d')]=_0x3445f7[_0xa303('0x1d')]||0x0;this[_0xa303('0x1e')]=_0x3445f7[_0xa303('0x1e')]||0x0;this[_0xa303('0x1f')]=_0x3445f7[_0xa303('0x1f')];this[_0xa303('0x20')]=_0x3445f7[_0xa303('0x20')];this[_0xa303('0x21')]=_0x3445f7[_0xa303('0x21')];this['recallme']=_0x3445f7['recallme'];this[_0xa303('0x22')]=_0x3445f7['ContactId'];this[_0xa303('0x23')]=_0x3445f7[_0xa303('0x23')];this['UserId']=_['isNil'](_0x3445f7[_0xa303('0xd')])?_0x3445f7[_0xa303('0x24')]:_0x3445f7[_0xa303('0xd')]['id'];this['VoiceQueueId']=_0x3445f7[_0xa303('0x25')];this['originatecalleridnum']='';this[_0xa303('0x26')]='';}Action[_0xa303('0x27')][_0xa303('0x28')]=function(){return util[_0xa303('0xf')](_0xa303('0x29'),this[_0xa303('0x10')],this['number']);};module[_0xa303('0x2a')]=Action; \ No newline at end of file +var _0xccc6=['uniqueid','idContact','name','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','\x22%s\x22\x20<%s>','number','exports','util','string','isNil'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0xccc6,0xcf));var _0x6ccc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xccc6[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0x6ccc('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x46360d,_0x51f099,_0x4dcb3f){var _0x2d344f='';if(!_['isNil'](_0x51f099)&&_0x6ccc('0x1')===typeof _0x51f099){_0x2d344f+=_0x51f099;}if(!_[_0x6ccc('0x2')](_0x4dcb3f)&&'string'===typeof _0x4dcb3f){_0x2d344f+='\x20'+_0x4dcb3f;}if(_0x2d344f!==''){return _0x2d344f;}return _0x46360d;}function Action(_0x3958fc,_0x2bb628,_0x487794,_0x5a0e94,_0x1382e5){this[_0x6ccc('0x3')]=_0x487794||undefined;this[_0x6ccc('0x4')]=_0x3958fc['id'];this['queue']=_0x2bb628[_0x6ccc('0x5')];this['type']=_0x2bb628['type'];this['campaigntype']='queue';this[_0x6ccc('0x6')]=![];this[_0x6ccc('0x7')]=_[_0x6ccc('0x2')](_0x3958fc[_0x6ccc('0x8')])?undefined:_0x3958fc[_0x6ccc('0x8')][_0x6ccc('0x5')];this[_0x6ccc('0x9')]=this[_0x6ccc('0x7')]?util[_0x6ccc('0xa')](_0x6ccc('0xb'),this[_0x6ccc('0x7')]):_0x5a0e94||undefined;this[_0x6ccc('0xc')]=checkNameSurname(_0x3958fc[_0x6ccc('0xd')][_0x6ccc('0xe')],_0x3958fc[_0x6ccc('0xd')][_0x6ccc('0xf')],_0x3958fc[_0x6ccc('0xd')][_0x6ccc('0x10')]);this[_0x6ccc('0x11')]=_0x3958fc[_0x6ccc('0x11')]||![];this[_0x6ccc('0x12')]=_0x3958fc['Contact'][_0x6ccc('0xe')];this[_0x6ccc('0x13')]=_0x3958fc['scheduledat'];this[_0x6ccc('0x14')]=_0x3958fc[_0x6ccc('0x14')]||0x0;this[_0x6ccc('0x15')]=_0x3958fc[_0x6ccc('0x15')]||0x0;this[_0x6ccc('0x16')]=_0x3958fc[_0x6ccc('0x16')]||0x0;this[_0x6ccc('0x17')]=(_0x3958fc[_0x6ccc('0x14')]||0x0)+(_0x3958fc['countcongestionretry']||0x0)+(_0x3958fc['countnoanswerretry']||0x0)+(_0x3958fc[_0x6ccc('0x18')]||0x0)+(_0x3958fc[_0x6ccc('0x19')]||0x0)+(_0x3958fc['countabandonedretry']||0x0)+(_0x3958fc[_0x6ccc('0x1a')]||0x0)+(_0x3958fc[_0x6ccc('0x1b')]||0x0);this[_0x6ccc('0x18')]=_0x3958fc[_0x6ccc('0x18')]||0x0;this['countdropretry']=_0x3958fc[_0x6ccc('0x19')]||0x0;this['countabandonedretry']=_0x3958fc[_0x6ccc('0x1c')]||0x0;this['countmachineretry']=_0x3958fc[_0x6ccc('0x1a')]||0x0;this[_0x6ccc('0x1b')]=_0x3958fc['countagentrejectretry']||0x0;this[_0x6ccc('0x1d')]=_0x3958fc[_0x6ccc('0x1d')];this[_0x6ccc('0x1e')]=_0x3958fc[_0x6ccc('0x1e')];this[_0x6ccc('0x1f')]=_0x3958fc[_0x6ccc('0x1f')];this[_0x6ccc('0x20')]=_0x3958fc[_0x6ccc('0x20')];this[_0x6ccc('0x21')]=_0x3958fc[_0x6ccc('0x21')];this[_0x6ccc('0x22')]=_0x3958fc[_0x6ccc('0x22')];this[_0x6ccc('0x23')]=_[_0x6ccc('0x2')](_0x3958fc[_0x6ccc('0x8')])?_0x3958fc[_0x6ccc('0x23')]:_0x3958fc[_0x6ccc('0x8')]['id'];this[_0x6ccc('0x24')]=_0x3958fc[_0x6ccc('0x24')];this[_0x6ccc('0x25')]='';this[_0x6ccc('0x26')]='';}Action['prototype']['getCaller']=function(){return util[_0x6ccc('0xa')](_0x6ccc('0x27'),this['calleridname'],this[_0x6ccc('0x28')]);};module[_0x6ccc('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 8caad43..bff0f83 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 _0x24c6=['custom:agentcomplete','complete','decrementTalkink','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','NOANSWER','countnoanswerretry','NoAnswer','noanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','rescheduleContact','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','outboundAbandonedCallsDay','countabandonedretry','Abandoned','countabandonedetry','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedRetryFrequency','[Dialer][decrementTalkink][no\x20Hangup][Preview]','dialstatus','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','ANSWER','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','[callProgressDetectingAgent][logNoSuch]','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','Contact','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','[Blacklist][error]','active','SIP/%s','execRun','unlock','recallme','isValid','checkIsBlackList','Contact.phone','checkInBlack','Call\x20unsuccessful','validateContact','Agent','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','ACTIVE','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialCutDigit','phone','substring','trim','dialRandomLastDigitCallerIdNumber','getCallerId','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','[originateFailure][logOriginateFailure]','actionid','clone','responsetime','isFailure','unlockContact','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','syncHangup','cause','[syncHangup][talking][cause]','callProgressDetectingCustomer','statedesc','transfer','[syncHangup][talking][transfer]','syncDialEnd','destuniqueid','addVariable','variables','filterKey','variable','keys','error','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','uuid','moment','md5','../../../config/environment','../../../config/logger','actionPreview','./rpcDb','./util/util','defaults','redis','socket.io-emitter','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','hangup','bind','hanguprequest','syncHangupRequest','dialend','newexten','syncVarSet','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','outbound','name','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','talking','unmanaged','abandoned','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','sendMessageOneNotActive','available','message','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','syncCampaigns','prototype','hasOwnProperty','preview','booked','type','clearZombieChannels','setMessage','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','VoiceQueueId','ListId','Action','status','channel','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','size','recallMe','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','voicePause','run','logger2','[RecallMe]','catch','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','createCustomerHistory','RecallFailedTimeout','createCustomerFinal','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','acw','custom:agentConnectPreview','buildAcw'];(function(_0x1c2ccf,_0x1a408c){var _0x1be606=function(_0x1b075e){while(--_0x1b075e){_0x1c2ccf['push'](_0x1c2ccf['shift']());}};_0x1be606(++_0x1a408c);}(_0x24c6,0x90));var _0x624c=function(_0x2bc5cc,_0x1bbb3e){_0x2bc5cc=_0x2bc5cc-0x0;var _0x1da473=_0x24c6[_0x2bc5cc];return _0x1da473;};'use strict';var util=require(_0x624c('0x0'));var _=require(_0x624c('0x1'));var BPromise=require(_0x624c('0x2'));var uuid=require(_0x624c('0x3'));var moment=require(_0x624c('0x4'));var md5=require(_0x624c('0x5'));var Redis=require('ioredis');var config=require(_0x624c('0x6'));var logger=require(_0x624c('0x7'))('preview');var loggerAction=require(_0x624c('0x7'))(_0x624c('0x8'));var ami=require('../ami');var rpcDb=require(_0x624c('0x9'));var Action=require('./action');var ut=require(_0x624c('0xa'));config['redis']=_[_0x624c('0xb')](config[_0x624c('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0x624c('0xd'))(new Redis(config[_0x624c('0xc')]));var Sequence=function(){};Sequence['prototype'][_0x624c('0xe')]=function(_0x3dfd82){this['tail']=this[_0x624c('0xf')]?this[_0x624c('0xf')][_0x624c('0x10')](_0x3dfd82):_0x3dfd82();};function Preview(_0x1c6b05){this[_0x624c('0x11')]=new Sequence();this[_0x624c('0x12')]=_0x1c6b05[_0x624c('0x13')];this['trunks']=_0x1c6b05[_0x624c('0x14')];this[_0x624c('0x15')]={};this['agents']=_0x1c6b05[_0x624c('0x16')];this[_0x624c('0x17')]=0x0;ami['on']('originateresponse',this[_0x624c('0x18')]['bind'](this));ami['on'](_0x624c('0x19'),this['syncHangup'][_0x624c('0x1a')](this));ami['on'](_0x624c('0x1b'),this[_0x624c('0x1c')][_0x624c('0x1a')](this));ami['on'](_0x624c('0x1d'),this['syncDialEnd']['bind'](this));ami['on'](_0x624c('0x1e'),this['syncNewExten'][_0x624c('0x1a')](this));ami['on']('varset',this[_0x624c('0x1f')]['bind'](this));ami['on']('attendedtransfer',this[_0x624c('0x20')][_0x624c('0x1a')](this));ami['on'](_0x624c('0x21'),this[_0x624c('0x22')]['bind'](this));this[_0x624c('0x23')](this[_0x624c('0x12')]);}function emit(_0x54278e,_0xeca39d,_0xa27e9d){io['to'](_0x54278e)[_0x624c('0x24')](_0xeca39d,_0xa27e9d);}function emitCampaignPreview(_0x154d8e){if(_0x154d8e['type']===_0x624c('0x25')){var _0x146e32={'id':_0x154d8e['id'],'name':_0x154d8e[_0x624c('0x26')],'strategy':_0x154d8e[_0x624c('0x27')],'answered':_0x154d8e[_0x624c('0x28')],'available':_0x154d8e['available'],'loggedIn':_0x154d8e[_0x624c('0x29')],'pTalking':_0x154d8e[_0x624c('0x2a')],'sumBillable':_0x154d8e[_0x624c('0x2b')],'sumDuration':_0x154d8e[_0x624c('0x2c')],'sumHoldTime':_0x154d8e['sumHoldTime']||0x0,'talking':_0x154d8e[_0x624c('0x2d')],'total':_0x154d8e['total'],'type':_0x154d8e['type'],'unmanaged':_0x154d8e[_0x624c('0x2e')],'abandoned':_0x154d8e[_0x624c('0x2f')],'waiting':_0x154d8e['waiting'],'loggedInDb':_0x154d8e['loggedInDb'],'dialActive':_0x154d8e[_0x624c('0x30')],'dialMethod':_0x154d8e[_0x624c('0x31')],'dialOriginateCallerIdName':_0x154d8e[_0x624c('0x32')],'dialOriginateCallerIdNumber':_0x154d8e[_0x624c('0x33')],'dialOriginateTimeout':_0x154d8e[_0x624c('0x34')],'dialPrefix':_0x154d8e[_0x624c('0x35')],'outboundAnswerAgiCallsDay':_0x154d8e['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x154d8e[_0x624c('0x36')],'outboundBlacklistCallsDay':_0x154d8e[_0x624c('0x37')],'outboundBusyCallsDay':_0x154d8e[_0x624c('0x38')],'outboundCongestionCallsDay':_0x154d8e[_0x624c('0x39')],'outboundDropCallsDayACS':_0x154d8e[_0x624c('0x3a')],'outboundDropCallsDayCallersExit':_0x154d8e['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x154d8e[_0x624c('0x3b')],'outboundNoAnswerCallsDay':_0x154d8e[_0x624c('0x3c')],'outboundNoSuchCallsDay':_0x154d8e[_0x624c('0x3d')],'outboundOriginateFailureCallsDay':_0x154d8e[_0x624c('0x3e')],'outboundReCallsDay':_0x154d8e['outboundReCallsDay'],'outboundRejectCallsDay':_0x154d8e['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x154d8e[_0x624c('0x3f')],'outboundAbandonedCallsDay':_0x154d8e['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x154d8e[_0x624c('0x40')],'predictiveIntervalAvgHoldtime':_0x154d8e['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x154d8e['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x154d8e[_0x624c('0x41')],'predictiveIntervalDroppedCallsTimeout':_0x154d8e[_0x624c('0x42')],'predictiveIntervalErlangCalls':_0x154d8e['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x154d8e[_0x624c('0x43')],'predictiveIntervalHitRate':_0x154d8e[_0x624c('0x44')],'predictiveIntervalMultiplicativeFactor':_0x154d8e[_0x624c('0x45')],'predictiveIntervalPauses':_0x154d8e[_0x624c('0x46')],'predictiveIntervalAvailable':_0x154d8e[_0x624c('0x47')],'predictiveIntervalTotalCalls':_0x154d8e[_0x624c('0x48')],'message':_0x154d8e['message'],'originated':_0x154d8e[_0x624c('0x49')],'erlangCalls':_0x154d8e[_0x624c('0x4a')],'erlangCallToSecond':_0x154d8e[_0x624c('0x4b')],'erlangAbandonmentRate':_0x154d8e[_0x624c('0x4c')],'erlangBusyFactor':_0x154d8e[_0x624c('0x4d')],'startPredictive':_0x154d8e[_0x624c('0x4e')],'startProgressive':_0x154d8e[_0x624c('0x4f')]};if(_0x154d8e[_0x624c('0x50')]){_0x146e32[_0x624c('0x50')]={'id':_0x154d8e[_0x624c('0x50')]['id'],'name':_0x154d8e[_0x624c('0x50')][_0x624c('0x26')],'active':_0x154d8e['Trunk']['active'],'callerid':_0x154d8e['Trunk'][_0x624c('0x51')]};}if(_0x154d8e['Interval']){_0x146e32['Interval']={'id':_0x154d8e[_0x624c('0x52')]['id'],'name':_0x154d8e[_0x624c('0x52')][_0x624c('0x26')]};}var _0x5073f3=md5(JSON[_0x624c('0x53')](_0x146e32));if(_0x154d8e[_0x624c('0x5')]!==_0x5073f3){_0x154d8e[_0x624c('0x5')]=_0x5073f3;emit(util[_0x624c('0x54')](_0x624c('0x55'),_0x146e32[_0x624c('0x26')]),_0x624c('0x56'),_0x146e32);}}}function emitVoiceQueueChannelRemove(_0x1a4d54){logger[_0x624c('0x57')](_0x624c('0x58'),JSON[_0x624c('0x53')](_0x1a4d54));emit(util[_0x624c('0x54')](_0x624c('0x55'),_0x1a4d54[_0x624c('0x26')]),'voice_queue_channel:remove',_0x1a4d54);}function notSendMessagesQueue(_0x380ffe){if(_0x380ffe[_0x624c('0x59')]){if(_0x380ffe['originated']===0x0&&_0x380ffe['pTalking']===0x0){_0x380ffe[_0x624c('0x59')]=![];_0x380ffe[_0x624c('0x5a')]=0x0;_0x380ffe['paused']=0x0;_0x380ffe[_0x624c('0x5b')]=_0x624c('0x5c');ut[_0x624c('0x5d')](_0x624c('0x5e'),_0x380ffe[_0x624c('0x26')]+'\x20is\x20not\x20active');}else{_0x380ffe[_0x624c('0x5b')]=_0x624c('0x5f');ut[_0x624c('0x5d')](_0x624c('0x5e'),_0x380ffe[_0x624c('0x26')]+'\x20is\x20disactive');}emitCampaignPreview(_0x380ffe);}}Preview['prototype'][_0x624c('0x23')]=function(){var _0x57c857=this;setInterval(function(){_0x57c857[_0x624c('0x60')]();},0x7cf);};Preview[_0x624c('0x61')][_0x624c('0x60')]=function(){var _0x18696a=this[_0x624c('0x12')];this[_0x624c('0x17')]+=0x1;for(var _0x24b7f8 in _0x18696a){if(_0x18696a[_0x624c('0x62')](_0x24b7f8)&&(_0x18696a[_0x24b7f8][_0x624c('0x31')]===_0x624c('0x63')||_0x18696a[_0x24b7f8][_0x624c('0x31')]===_0x624c('0x64'))&&_0x18696a[_0x24b7f8][_0x624c('0x65')]===_0x624c('0x25')){if(this['clockClearZombieChannels']>0x7){this[_0x624c('0x17')]=0x0;this[_0x624c('0x66')]();}}if(_0x18696a[_0x624c('0x62')](_0x24b7f8)&&_0x18696a[_0x24b7f8][_0x624c('0x31')]===_0x624c('0x63')&&_0x18696a[_0x24b7f8]['type']==='outbound'){if(_0x18696a[_0x24b7f8][_0x624c('0x30')]){this[_0x624c('0x67')](_0x18696a[_0x24b7f8]);this['recallMe'](_0x18696a[_0x24b7f8]);}else{notSendMessagesQueue(_0x18696a[_0x24b7f8]);}}}};Preview[_0x624c('0x61')][_0x624c('0x68')]=function(_0x4d99cc){var _0x242d38=this;this[_0x624c('0x11')][_0x624c('0xe')](function(){if(!_[_0x624c('0x69')](_0x242d38[_0x624c('0x15')][_0x4d99cc])){loggerAction['info'](_0x624c('0x6a'),_0x4d99cc,_0x624c('0x6b'),_0x242d38[_0x624c('0x15')][_0x4d99cc][_0x624c('0x6c')],_0x624c('0x6d'),JSON[_0x624c('0x53')](_0x242d38[_0x624c('0x12')][_0x242d38[_0x624c('0x15')][_0x4d99cc]['queue']]['originated']),_0x624c('0x6e'),JSON['stringify'](_0x242d38['campaignsPreview'][_0x242d38[_0x624c('0x15')][_0x4d99cc][_0x624c('0x6c')]][_0x624c('0x2a')]),JSON[_0x624c('0x53')](_0x242d38[_0x624c('0x15')][_0x4d99cc][_0x624c('0x6f')]),JSON['stringify'](_[_0x624c('0x70')](_0x242d38['actions'][_0x4d99cc],[_0x624c('0x71'),'UserId',_0x624c('0x72'),_0x624c('0x73')])));return ami[_0x624c('0x74')]({'action':_0x624c('0x75'),'channel':_0x242d38[_0x624c('0x15')][_0x4d99cc][_0x624c('0x76')]})['catch'](function(_0x59aa0d){if(_0x59aa0d[_0x624c('0x5b')]===_0x624c('0x77')){setTimeout(function(){if(_0x242d38[_0x624c('0x15')][_0x4d99cc]){ut[_0x624c('0x78')](_0x242d38['campaignsPreview'][_0x242d38[_0x624c('0x15')][_0x4d99cc][_0x624c('0x6c')]],_0x624c('0x79'));if(_0x242d38[_0x624c('0x15')][_0x4d99cc][_0x624c('0x6f')]===!![]){ut['decrementTalkink'](_0x242d38[_0x624c('0x12')][_0x242d38[_0x624c('0x15')][_0x4d99cc][_0x624c('0x6c')]],_0x624c('0x79'));ut['loggerError'](_0x624c('0x7a')+_0x4d99cc,_0x242d38['actions'][_0x4d99cc][_0x624c('0x6c')]);}ut[_0x624c('0x7b')](_0x624c('0x7c')+_0x4d99cc,_0x242d38[_0x624c('0x15')][_0x4d99cc][_0x624c('0x6c')]);delete _0x242d38[_0x624c('0x15')][_0x4d99cc];}},0x2328);}});}});};Preview[_0x624c('0x61')][_0x624c('0x66')]=function(){var _0x1da596=this;loggerAction[_0x624c('0x57')]('[action]',_[_0x624c('0x7d')](this[_0x624c('0x15')]));for(var _0x37c4c6 in this[_0x624c('0x15')]){if(_0x1da596[_0x624c('0x15')][_0x624c('0x62')](_0x37c4c6)){_0x1da596[_0x624c('0x68')](_0x37c4c6);}}};Preview[_0x624c('0x61')][_0x624c('0x7e')]=function(_0x2b5ded){var _0x4276ce=this;rpcDb[_0x624c('0x7f')](_0x2b5ded['id'],ut[_0x624c('0x80')](this[_0x624c('0x16')]))[_0x624c('0x81')](function(_0x5f0cbb){if(!_[_0x624c('0x69')](_0x5f0cbb)){for(var _0xcc0c53=0x0;_0xcc0c53<_0x5f0cbb[_0x624c('0x82')];_0xcc0c53+=0x1){if(ut[_0x624c('0x83')](_0x5f0cbb[_0xcc0c53][_0x624c('0x84')])<_0x2b5ded[_0x624c('0x85')]*0x3c){if(_0x5f0cbb[_0xcc0c53]['Agent']&&!_0x5f0cbb[_0xcc0c53]['Agent'][_0x624c('0x86')]){_0x4276ce[_0x624c('0x87')](_0x5f0cbb[_0xcc0c53]['id'])[_0x624c('0x81')](ut[_0x624c('0x88')](_0x624c('0x89')))[_0x624c('0x8a')](ut[_0x624c('0x88')](_0x624c('0x89')));}else{rpcDb[_0x624c('0x8b')](_0x5f0cbb[_0xcc0c53]['id']);}}else{var _0x5c8983=new Action(_0x5f0cbb[_0xcc0c53],_0x2b5ded);_0x5c8983[_0x624c('0x8c')]=moment()['format'](_0x624c('0x8d'));_0x2b5ded[_0x624c('0x8e')]+=0x1;ut[_0x624c('0x8f')](_0x5c8983,0x17,_0x624c('0x90'));if(_0x2b5ded[_0x624c('0x91')]){rpcDb['rescheduleContactInQueue'](ut['createBody'](_0x5f0cbb[_0xcc0c53]));rpcDb[_0x624c('0x92')](_0x5c8983,'[HistoryDialRecallInQueue][historyCatch]');}else{ut['logCustomer'](_0x5c8983,0x16,_0x624c('0x93'));rpcDb[_0x624c('0x92')](_0x5c8983,'[HistoryRecallClose]');rpcDb[_0x624c('0x94')](_0x5c8983,_0x624c('0x95'));}}}}})['catch'](ut['logger2'](_0x624c('0x96')));};Preview['prototype'][_0x624c('0x67')]=function(_0x404bcc){_0x404bcc[_0x624c('0x59')]=!![];if(ut[_0x624c('0x97')](_0x404bcc[_0x624c('0x29')])){_0x404bcc[_0x624c('0x5b')]=_0x624c('0x98');}else if(!ut[_0x624c('0x99')](_0x404bcc[_0x624c('0x30')])){_0x404bcc[_0x624c('0x5b')]='NOT_ACTIVE';}else if(!this[_0x624c('0x9a')](_0x404bcc[_0x624c('0x50')])){if(!this[_0x624c('0x9a')](_0x404bcc[_0x624c('0x9b')])){_0x404bcc['message']='TRUNK_IS_NOT_REACHABLE';}else{_0x404bcc[_0x624c('0x5b')]='ACTIVE';}}else{_0x404bcc[_0x624c('0x5b')]='ACTIVE';}emitCampaignPreview(_0x404bcc);};Preview[_0x624c('0x61')]['callProgressDetectingCustomer']=function(_0x8443c6,_0x12e9ad,_0x13ad1d){var _0x10a367=this;var _0x26e869=this[_0x624c('0x15')][_0x12e9ad];var _0x2c42c4=this[_0x624c('0x12')][_0x26e869[_0x624c('0x6c')]];var _0x571616;if(_0x2c42c4){switch(_0x13ad1d){case'1':_0x2c42c4['outboundNoSuchCallsDay']+=0x1;_0x26e869[_0x624c('0x9c')]+=0x1;_0x26e869[_0x624c('0x9d')]=ut[_0x624c('0x9e')](_0x26e869);ut[_0x624c('0x8f')](_0x26e869,0x0,_0x624c('0x9f'));ami[_0x624c('0x24')](_0x624c('0xa0'),ut[_0x624c('0xa1')](_0x26e869,'nosuchnumber'));rpcDb[_0x624c('0x92')](_0x26e869,'[callProgressDetectingCustomer][logNoSuch]');if(ut[_0x624c('0x9e')](_0x26e869)>=_0x2c42c4['dialGlobalMaxRetry']){_0x571616=ut[_0x624c('0xa2')](_0x26e869,0xf,_0x624c('0xa3'));rpcDb[_0x624c('0x94')](_0x571616,_0x624c('0xa4'));}else{if(_0x26e869['countnosuchnumberretry']>=_0x2c42c4['dialNoSuchNumberMaxRetry']){rpcDb[_0x624c('0x94')](_0x26e869,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb['rescheduleContact'](ut[_0x624c('0xa5')](_0x26e869,_0x624c('0x9c'),_0x2c42c4[_0x624c('0xa6')]),_0x26e869[_0x624c('0xa7')],_0x26e869[_0x624c('0xa8')]);}}delete this[_0x624c('0x15')][_0x8443c6[_0x624c('0xa9')]];break;case'ANSWER':var _0xc4273=moment()[_0x624c('0x54')](_0x624c('0x8d'));_0x26e869['responsetime']=_0xc4273;_0x26e869['answertime']=_0xc4273;_0x26e869['dialAnswer']=!![];_0x2c42c4['pTalking']+=0x1;logger[_0x624c('0x57')](_0x624c('0xaa'),_0x26e869[_0x624c('0xab')],_0x624c('0xac'),_0x2c42c4[_0x624c('0x26')],_0x624c('0x6e'),_0x2c42c4[_0x624c('0x2a')]);ami[_0x624c('0x24')](_0x624c('0xad'),ut['buildObj'](_0x26e869,'connect'));if(_0x2c42c4[_0x624c('0xae')]){ami['emit'](_0x624c('0xaf'),ut[_0x624c('0xb0')](_0x26e869));}break;case'16':ami[_0x624c('0x24')](_0x624c('0xb1'),ut[_0x624c('0xa1')](_0x26e869,_0x624c('0xb2')));emitVoiceQueueChannelRemove(ut[_0x624c('0xa1')](_0x26e869,_0x624c('0xb2')));_0x2c42c4['outboundAnswerCallsDay']+=0x1;_0x2c42c4['total']+=0x1;_0x2c42c4['answered']+=0x1;ut[_0x624c('0xb3')](_0x2c42c4,_0x624c('0xb4'));_0x26e869[_0x624c('0x9d')]=ut['totalGlobal'](_0x26e869);ut[_0x624c('0x8f')](_0x26e869,0x4,_0x624c('0xb5'));rpcDb['createCustomerHistory'](_0x26e869,_0x624c('0xb6'));rpcDb[_0x624c('0x94')](_0x26e869,_0x624c('0xb7'));rpcDb[_0x624c('0xb8')](_0x26e869);_0x2c42c4[_0x624c('0x2c')]+=_0x26e869[_0x624c('0xb9')];_0x2c42c4[_0x624c('0x2b')]+=_0x26e869['talktime'];logger[_0x624c('0x57')](_0x624c('0xba'),_0x26e869['uniqueid'],_0x624c('0xac'),_0x2c42c4[_0x624c('0x26')],'pTalking:\x20',_0x2c42c4[_0x624c('0x2a')]);delete this[_0x624c('0x15')][_0x8443c6[_0x624c('0xa9')]];break;case _0x624c('0xbb'):_0x2c42c4[_0x624c('0x38')]+=0x1;_0x26e869[_0x624c('0xbc')]+=0x1;_0x26e869[_0x624c('0x9d')]=ut[_0x624c('0x9e')](_0x26e869);ut[_0x624c('0x8f')](_0x26e869,0x5,_0x624c('0xbd'));ami[_0x624c('0x24')](_0x624c('0xbe'),ut['buildObj'](_0x26e869,_0x624c('0xbf')));rpcDb['createCustomerHistory'](_0x26e869,_0x624c('0xc0'));if(ut[_0x624c('0x9e')](_0x26e869)>=_0x2c42c4[_0x624c('0xc1')]){_0x571616=ut[_0x624c('0xa2')](_0x26e869,0xf,_0x624c('0xa3'));rpcDb['createCustomerFinal'](_0x571616,_0x624c('0xc2'));}else{if(_0x26e869[_0x624c('0xbc')]>=_0x2c42c4[_0x624c('0xc3')]){rpcDb[_0x624c('0x94')](_0x26e869,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x26e869,'countbusyretry',_0x2c42c4[_0x624c('0xc4')]),_0x26e869[_0x624c('0xa7')],_0x26e869[_0x624c('0xa8')]);}}break;case _0x624c('0xc5'):_0x2c42c4[_0x624c('0x3c')]+=0x1;_0x26e869[_0x624c('0xc6')]+=0x1;_0x26e869['countglobal']=ut[_0x624c('0x9e')](_0x26e869);ut[_0x624c('0x8f')](_0x26e869,0x3,_0x624c('0xc7'));ami[_0x624c('0x24')]('custom:agentnoanswer',ut[_0x624c('0xa1')](_0x26e869,_0x624c('0xc8')));rpcDb[_0x624c('0x92')](_0x26e869,'[callProgressDetectingCustomer][logNoAnswer]');if(ut['totalGlobal'](_0x26e869)>=_0x2c42c4['dialGlobalMaxRetry']){_0x571616=ut[_0x624c('0xa2')](_0x26e869,0xf,'Global');rpcDb[_0x624c('0x94')](_0x571616,_0x624c('0xc9'));}else{if(_0x26e869[_0x624c('0xc6')]>=_0x2c42c4[_0x624c('0xca')]){rpcDb[_0x624c('0x94')](_0x26e869,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x624c('0xcb')](ut[_0x624c('0xa5')](_0x26e869,'countnoanswerretry',_0x2c42c4[_0x624c('0xcc')]),_0x26e869[_0x624c('0xa7')],_0x26e869[_0x624c('0xa8')]);}}break;case _0x624c('0xcd'):_0x2c42c4[_0x624c('0x39')]+=0x1;_0x26e869[_0x624c('0xce')]+=0x1;_0x26e869[_0x624c('0x9d')]=ut[_0x624c('0x9e')](_0x26e869);ut[_0x624c('0x8f')](_0x26e869,0x8,_0x624c('0xcf'));rpcDb[_0x624c('0x92')](_0x26e869,_0x624c('0xd0'));if(ut['totalGlobal'](_0x26e869)>=_0x2c42c4[_0x624c('0xc1')]){_0x571616=ut[_0x624c('0xa2')](_0x26e869,0xf,_0x624c('0xa3'));rpcDb[_0x624c('0x94')](_0x571616,_0x624c('0xd1'));}else{if(_0x26e869['countcongestionretry']>=_0x2c42c4[_0x624c('0xd2')]){rpcDb[_0x624c('0x94')](_0x26e869,_0x624c('0xd0'));}else{rpcDb['rescheduleContact'](ut[_0x624c('0xa5')](_0x26e869,_0x624c('0xce'),_0x2c42c4['dialBusyRetryFrequency']),_0x26e869['unlockAgent'],_0x26e869[_0x624c('0xa8')]);}}break;case _0x624c('0xd3'):_0x2c42c4[_0x624c('0xd4')]+=0x1;_0x26e869[_0x624c('0xd5')]+=0x1;_0x26e869[_0x624c('0x9d')]=ut[_0x624c('0x9e')](_0x26e869);ut[_0x624c('0x8f')](_0x26e869,0x14,_0x624c('0xd6'));rpcDb[_0x624c('0x92')](_0x26e869,'[syncHangupRequest][logAgentReject]');if(ut[_0x624c('0x9e')](_0x26e869)>=_0x2c42c4[_0x624c('0xc1')]){_0x571616=ut[_0x624c('0xa2')](_0x26e869,0x14,'AgentReject');rpcDb[_0x624c('0x94')](_0x571616,_0x624c('0xd7'));}else{if(_0x26e869['countagentrejectretry']>=_0x2c42c4[_0x624c('0xd8')]){rpcDb[_0x624c('0x94')](_0x26e869,_0x624c('0xd7'));}else{rpcDb[_0x624c('0xcb')](ut[_0x624c('0xa5')](_0x26e869,'countagentrejectretry',_0x2c42c4[_0x624c('0xd9')]),_0x26e869[_0x624c('0xa7')],_0x26e869[_0x624c('0xa8')]);}}break;case'ABANDONED':_0x2c42c4[_0x624c('0xda')]+=0x1;_0x26e869[_0x624c('0xdb')]+=0x1;_0x26e869[_0x624c('0x9d')]=ut[_0x624c('0x9e')](_0x26e869);ut[_0x624c('0x8f')](_0x26e869,0xb,_0x624c('0xdc'));rpcDb[_0x624c('0x92')](_0x26e869,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0x624c('0x9e')](_0x26e869)>=_0x2c42c4[_0x624c('0xc1')]){_0x571616=ut['cloneAction'](_0x26e869,0xf,_0x624c('0xa3'));rpcDb[_0x624c('0x94')](_0x571616,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x26e869[_0x624c('0xdd')]>=_0x2c42c4['dialAbandonedMaxRety']){rpcDb[_0x624c('0x94')](_0x26e869,_0x624c('0xde'));}else{rpcDb[_0x624c('0xcb')](ut[_0x624c('0xa5')](_0x26e869,'countabandonedretry',_0x2c42c4[_0x624c('0xdf')]),_0x26e869[_0x624c('0xa7')],_0x26e869[_0x624c('0xa8')]);}}break;default:if(_0x26e869[_0x624c('0x6f')]){ut[_0x624c('0xb3')](_0x2c42c4,'[default]');ut[_0x624c('0x7b')](_0x624c('0xe0')+_0x2c42c4['name'],_0x8443c6);}_0x2c42c4[_0x624c('0x3f')]+=0x1;_0x26e869[_0x624c('0x9d')]=ut[_0x624c('0x9e')](_0x26e869);ut['logCustomer'](_0x26e869,0xc,_0x8443c6['cause-txt']||_0x8443c6[_0x624c('0xe1')]);rpcDb[_0x624c('0x92')](_0x26e869,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0x624c('0x9e')](_0x26e869)>=_0x2c42c4[_0x624c('0xc1')]){_0x571616=ut[_0x624c('0xa2')](_0x26e869,0xf,_0x624c('0xa3'));rpcDb[_0x624c('0x94')](_0x571616,_0x624c('0xe2'));}else{rpcDb[_0x624c('0x94')](_0x26e869,_0x624c('0xe2'));}delete this[_0x624c('0x15')][_0x8443c6[_0x624c('0xa9')]];}if(!(_0x26e869[_0x624c('0x6f')]&&_0x13ad1d==='16')){ut[_0x624c('0x78')](_0x2c42c4,_0x624c('0xe3'));logger[_0x624c('0x57')](_0x624c('0xe4'),_0x26e869[_0x624c('0xab')],_0x624c('0xac'),_0x2c42c4[_0x624c('0x26')],_0x624c('0x6d'),_0x2c42c4[_0x624c('0x49')]);}if(_0x13ad1d!==_0x624c('0xe5')){delete this[_0x624c('0x15')][_0x8443c6['linkedid']];delete this[_0x624c('0x15')][_0x8443c6[_0x624c('0xe6')]];}}};Preview[_0x624c('0x61')][_0x624c('0xe7')]=function(_0x10c05b,_0x3326dd,_0xc44d6d){if(_[_0x624c('0xe8')](_0x3326dd)&&_0x624c('0xe9')!==typeof _0x3326dd){return;}if(_[_0x624c('0xe8')](_0xc44d6d)&&_0x624c('0xe9')!==typeof _0xc44d6d){return;}switch(_0xc44d6d[_0x624c('0xea')]){case'0':ut['logAgent'](_0x10c05b,0x0,_0x624c('0x9f'));rpcDb['createAgentHistory'](_0x10c05b,_0x624c('0xeb'));break;case'3':ut[_0x624c('0xec')](_0x10c05b,0x3,_0x624c('0xc7'));rpcDb[_0x624c('0xed')](_0x10c05b,_0x624c('0xee'));break;case'5':ut[_0x624c('0xec')](_0x10c05b,0x5,_0x624c('0xbd'));rpcDb[_0x624c('0xed')](_0x10c05b,_0x624c('0xef'));break;case'8':ut['logAgent'](_0x10c05b,0x8,_0x624c('0xcf'));rpcDb['createAgentHistory'](_0x10c05b,_0x624c('0xf0'));break;case'22':ut[_0x624c('0xec')](_0x10c05b,0x16,'AnswerAGI');rpcDb['createAgentHistory'](_0x10c05b,_0x624c('0xf1'));break;default:ut[_0x624c('0xec')](_0x10c05b,0xc,_0xc44d6d[_0x624c('0xea')]);rpcDb[_0x624c('0xed')](_0x10c05b,_0x624c('0xf0'));}ut[_0x624c('0x78')](_0x3326dd,_0x624c('0xf2'));logger[_0x624c('0x57')](_0x624c('0xf3'),_0x10c05b[_0x624c('0xab')],'\x20Queue',_0x3326dd[_0x624c('0x26')],_0x624c('0x6d'),_0x3326dd[_0x624c('0x49')]);delete this[_0x624c('0x15')][_0x10c05b[_0x624c('0xab')]];};Preview[_0x624c('0x61')]['checkInBlack']=function(_0x36240b,_0x31fc90,_0x233b91,_0x36d698,_0x115575){var _0x3c2bcc=this;return new BPromise(function(_0x25c4f3,_0xd6726d){if(_[_0x624c('0x69')](_0x31fc90)||_['isNil'](_0x31fc90[_0x624c('0xf4')])||_[_0x624c('0x69')](_0x31fc90[_0x624c('0xf4')]['phone'])||_[_0x624c('0x69')](_0x31fc90[_0x624c('0x72')])){_0xd6726d(ut['message'](_0x624c('0xf5'),_0x36d698,_0x115575));return;}var _0x2e03cf=uuid['v4']();var _0x11808b=_0x3c2bcc[_0x624c('0x12')][_0x31fc90[_0x624c('0x6b')]['name']];var _0x200379=_0x233b91?_0x3c2bcc[_0x624c('0x16')][_0x233b91]['id']:undefined;_0x3c2bcc[_0x624c('0x15')][_0x2e03cf]=new Action(_0x31fc90,_0x11808b,_0x2e03cf,_0x233b91,_0x200379);var _0x19456a=_0x3c2bcc[_0x624c('0x15')][_0x2e03cf];_0x19456a[_0x624c('0xa7')]=_0x36d698;_0x19456a[_0x624c('0xa8')]=_0x115575;_0x19456a[_0x624c('0xf6')]=_0x233b91;if(_[_0x624c('0xf7')](_0x36240b)){_0x3c2bcc[_0x624c('0xf8')](_0x19456a,_0x11808b,_0x31fc90,_0x233b91)[_0x624c('0x81')](function(_0x4a83ef){logger[_0x624c('0x57')](_0x624c('0xf9'),'Queue:\x20'+_0x19456a[_0x624c('0x6c')]+_0x624c('0xfa')+_0x19456a[_0x624c('0xfb')],JSON[_0x624c('0x53')](_0x4a83ef));ami[_0x624c('0x24')](_0x624c('0xfc'),ut['buildObj'](_0x19456a,_0x624c('0xfd')));_0x25c4f3(ut['message'](_0x624c('0xfe')));})[_0x624c('0x8a')](function(_0x2c735e){ut[_0x624c('0x5d')](_0x624c('0xff'),_0x2c735e);_0xd6726d(ut['message']('Call\x20failed',_0x36d698,_0x115575));});}else{_0x11808b[_0x624c('0x37')]+=0x1;ut['logBlacklist'](_0x19456a);rpcDb['createHistory'](_0x19456a,_0x624c('0x100'));delete _0x3c2bcc['actions'][_0x2e03cf];_0xd6726d(ut['message']('Contact\x20in\x20black\x20List',_0x36d698,_0x115575));}});};Preview[_0x624c('0x61')][_0x624c('0x9a')]=function(_0x1e52bc){return!_[_0x624c('0x69')](_0x1e52bc)&&!_[_0x624c('0x69')](_0x1e52bc[_0x624c('0x26')])&&!_[_0x624c('0x69')](_0x1e52bc['active'])&&_0x1e52bc[_0x624c('0x101')]&&!_[_0x624c('0x69')](this[_0x624c('0x14')][util['format'](_0x624c('0x102'),_0x1e52bc[_0x624c('0x26')])])&&!_['isNil'](this[_0x624c('0x14')][util[_0x624c('0x54')](_0x624c('0x102'),_0x1e52bc[_0x624c('0x26')])]['status'])&&(this[_0x624c('0x14')][util[_0x624c('0x54')]('SIP/%s',_0x1e52bc[_0x624c('0x26')])]['status']==='reachable'||this[_0x624c('0x14')][util[_0x624c('0x54')](_0x624c('0x102'),_0x1e52bc[_0x624c('0x26')])][_0x624c('0x75')]==='unmonitored');};Preview['prototype'][_0x624c('0x87')]=function(_0xa61be6,_0x5dd1b3){var _0x1450bc=this;return new BPromise(function(_0x1b23ff,_0x4d485a){_0x1450bc[_0x624c('0x103')](_0xa61be6,_0x5dd1b3)[_0x624c('0x81')](function(_0x19816a){_0x1b23ff(_[_0x624c('0x70')](_0x19816a,[_0x624c('0x5b')]));})[_0x624c('0x8a')](function(_0x5b4082){if(_0x5b4082[_0x624c('0x104')]){rpcDb['unlockContact'](_0xa61be6);}if(_0x5b4082[_0x624c('0x101')]){rpcDb[_0x624c('0x8b')](_0xa61be6);}_0x4d485a(_[_0x624c('0x70')](_0x5b4082,[_0x624c('0x5b')]));});});};Preview[_0x624c('0x61')][_0x624c('0x103')]=function(_0x18ef54,_0x15f249){var _0x506b33=this;return new BPromise(function(_0x2cb88a,_0x3a9251){var _0x11a3be,_0x56746a;rpcDb['getContactPreview'](_0x18ef54)[_0x624c('0x81')](function(_0x49cba2){if(!_[_0x624c('0x69')](_0x49cba2[0x0])){_0x56746a=_0x49cba2[0x0][_0x624c('0x105')]?![]:!![];_0x11a3be=_0x49cba2[0x0][_0x624c('0x105')]?!![]:![];_0x11a3be=_0x15f249?!![]:_0x11a3be;}var _0xb56836=_0x506b33['validateContact'](_0x49cba2);if(_0xb56836[_0x624c('0x106')]){rpcDb[_0x624c('0x107')](_[_0x624c('0x70')](_0x49cba2[0x0],[_0x624c('0x72'),_0x624c('0x108')]))[_0x624c('0x81')](function(_0xb53ec2){_0x506b33[_0x624c('0x109')](_0xb53ec2,_0x49cba2[0x0],_0x15f249,_0x56746a,_0x11a3be)[_0x624c('0x81')](function(_0xefdb96){_0x2cb88a(_0xefdb96);})[_0x624c('0x8a')](function(_0x30c947){_0x3a9251(_0x30c947);});})['catch'](function(_0xf996a5){ut[_0x624c('0x5d')]('[Preview][checkIsBlackList]',_0xf996a5);_0x3a9251(ut[_0x624c('0x5b')](_0x624c('0x10a'),_0x56746a,_0x11a3be));});}else{_0x3a9251(ut[_0x624c('0x5b')](_0xb56836[_0x624c('0x5b')],_0x56746a,_0x11a3be));}})[_0x624c('0x8a')](function(_0x4bcdaa){ut[_0x624c('0x5d')]('[Preview][getContactPreview]',_0x4bcdaa);_0x3a9251(ut[_0x624c('0x5b')](_0x624c('0x10a'),![],!![]));});});};Preview[_0x624c('0x61')][_0x624c('0x10b')]=function(_0x8398a2){if(_[_0x624c('0x69')](_0x8398a2)||_[_0x624c('0xf7')](_0x8398a2)||!_['isNil'](_0x8398a2[0x0][_0x624c('0x10c')])&&_[_0x624c('0x69')](_0x8398a2[0x0][_0x624c('0x10c')][_0x624c('0x26')])){ut['logger'](_0x624c('0x10d'),_0x8398a2);return{'isValid':![],'message':_0x624c('0x10e')};}var _0x1087d6=this['campaignsPreview'][_0x8398a2[0x0][_0x624c('0x6b')][_0x624c('0x26')]];_0x1087d6['message']=_0x624c('0x10f');if(_[_0x624c('0x69')](_0x1087d6)){ut[_0x624c('0x5d')](_0x624c('0x110'),_0x1087d6);return{'isValid':![],'message':_0x624c('0x111')};}if(!this[_0x624c('0x9a')](_0x1087d6[_0x624c('0x50')])){ut[_0x624c('0x5d')](_0x624c('0x112'),_0x624c('0x113')+_0x1087d6[_0x624c('0x26')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x624c('0x9a')](_0x1087d6[_0x624c('0x9b')])){ut[_0x624c('0x5d')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x1087d6['name']+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut[_0x624c('0x99')](_0x1087d6[_0x624c('0x30')])){ut[_0x624c('0x5d')](_0x624c('0x114'),_0x1087d6[_0x624c('0x26')]+_0x624c('0x115'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x1087d6[_0x624c('0x26')]+_0x624c('0x115')};}return{'isValid':!![],'message':_0x624c('0x116')};};Preview['prototype'][_0x624c('0xf8')]=function(_0x553e1c,_0x4a16cf,_0x307d90,_0x1f5e2e){var _0x16ff51=this;return new BPromise(function(_0x3ac71e,_0x573170){var _0x3758e5=_0x553e1c[_0x624c('0xab')];var _0x341541=_0x16ff51['isTrunkReachable'](_0x4a16cf[_0x624c('0x50')])?util[_0x624c('0x54')](_0x624c('0x117'),_0x4a16cf[_0x624c('0x50')][_0x624c('0x26')],_['isNil'](_0x4a16cf['dialPrefix'])?'':_0x4a16cf['dialPrefix']['trim']()||'',_0x4a16cf[_0x624c('0x118')]>0x0?_0x307d90[_0x624c('0xf4')][_0x624c('0x119')][_0x624c('0x11a')](_0x4a16cf[_0x624c('0x118')]):_0x307d90['Contact'][_0x624c('0x119')]):util['format'](_0x624c('0x117'),_['isNil'](_0x4a16cf[_0x624c('0x9b')])?_0x4a16cf['Trunk'][_0x624c('0x26')]:_0x4a16cf['TrunkBackup'][_0x624c('0x26')],_[_0x624c('0x69')](_0x4a16cf['dialPrefix'])?'':_0x4a16cf[_0x624c('0x35')][_0x624c('0x11b')]()||'',_0x4a16cf[_0x624c('0x118')]>0x0?_0x307d90[_0x624c('0xf4')][_0x624c('0x119')][_0x624c('0x11a')](_0x4a16cf[_0x624c('0x118')]):_0x307d90[_0x624c('0xf4')][_0x624c('0x119')]);var _0x437ee0=_0x16ff51[_0x624c('0x9a')](_0x4a16cf[_0x624c('0x50')])?ut['getCallerId'](_0x4a16cf[_0x624c('0x50')]['callerid'],_0x4a16cf[_0x624c('0x32')],_0x4a16cf[_0x624c('0x11c')]>0x0?ut['getCallerIdRandom'](_0x4a16cf[_0x624c('0x33')],_0x4a16cf[_0x624c('0x11c')]):_0x4a16cf['dialOriginateCallerIdNumber']):ut[_0x624c('0x11d')](_['isNil'](_0x4a16cf[_0x624c('0x9b')])?_0x4a16cf[_0x624c('0x50')][_0x624c('0x51')]:_0x4a16cf[_0x624c('0x9b')][_0x624c('0x51')],_0x4a16cf['dialOriginateCallerIdName'],_0x4a16cf['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x624c('0x11e')](_0x4a16cf['dialOriginateCallerIdNumber'],_0x4a16cf[_0x624c('0x11c')]):_0x4a16cf[_0x624c('0x33')]);if(_0x437ee0){_0x553e1c[_0x624c('0x11f')]=ut[_0x624c('0x120')](_0x437ee0);_0x553e1c[_0x624c('0x121')]=ut[_0x624c('0x122')](_0x437ee0);}var _0x40192a=ut[_0x624c('0x123')](_0x4a16cf,_0x307d90,_0x341541,_0x437ee0,_0x3758e5,_0x553e1c);_[_0x624c('0x124')](_0x553e1c,ut[_0x624c('0x125')](_0x40192a));_0x553e1c['starttime']=moment()[_0x624c('0x54')](_0x624c('0x8d'));ami[_0x624c('0x74')](ut['variablesAction'](_0x553e1c,_0x4a16cf,_0x40192a,_0x553e1c[_0x624c('0xa8')],_0x1f5e2e))['then'](function(_0x2a7f05){_0x4a16cf[_0x624c('0x49')]+=0x1;logger['info']('[originated][increment]',_0x3758e5,'\x20Queue',_0x4a16cf[_0x624c('0x26')],_0x624c('0x6d'),_0x4a16cf[_0x624c('0x49')]);_0x3ac71e(_0x2a7f05);})[_0x624c('0x8a')](function(_0x270182){ut[_0x624c('0xec')](_0x553e1c,0xe,'OriginateError');rpcDb['createAgentHistory'](_0x553e1c,_0x624c('0x126'));_0x573170(_0x270182);});});};Preview[_0x624c('0x61')]['syncNewExten']=function(_0x6bc273){if(this['actions'][_0x6bc273[_0x624c('0xa9')]]){this['actions'][_0x6bc273[_0x624c('0xa9')]][_0x624c('0x76')]=_0x6bc273['channel'];}};Preview[_0x624c('0x61')][_0x624c('0x18')]=function(_0x3c17fd){var _0x51d06a=this;var _0x15c479=this[_0x624c('0x15')][_0x3c17fd[_0x624c('0x127')]];if(_0x15c479){if(_0x15c479[_0x624c('0xf6')]&&this[_0x624c('0x16')][_0x15c479[_0x624c('0xf6')]]){ut['logLookAgent'](_0x15c479,this[_0x624c('0x16')][_0x15c479[_0x624c('0xf6')]][_0x624c('0x26')],this[_0x624c('0x16')][_0x15c479[_0x624c('0xf6')]]['id']);}var _0x543708=_[_0x624c('0x128')](_0x15c479);_0x543708[_0x624c('0x129')]=moment()['format'](_0x624c('0x8d'));var _0x19172d=_0x51d06a[_0x624c('0x12')][_0x15c479[_0x624c('0x6c')]];if(ut[_0x624c('0x12a')](_0x3c17fd['response'])){if(_0x15c479['unlockAgent']){rpcDb[_0x624c('0x12b')](_0x15c479[_0x624c('0xfb')]);}if(_0x15c479['activeContact']){rpcDb['disableContact'](_0x15c479[_0x624c('0xfb')]);}ami[_0x624c('0x24')](_0x624c('0x12c'),ut['buildObj'](_0x15c479,_0x624c('0x12d')));this['callProgressDetectingAgent'](_0x543708,_0x19172d,_0x3c17fd);}else{_0x15c479['starttime']=moment()['format'](_0x624c('0x8d'));ut[_0x624c('0xec')](_0x543708,0x4,_0x624c('0xb5'));rpcDb[_0x624c('0xed')](_0x543708,_0x624c('0x12e'));}}};Preview[_0x624c('0x61')][_0x624c('0x12f')]=function(_0x46f429){var _0x599775=this;var _0x26b55a=this[_0x624c('0x15')][_0x46f429[_0x624c('0xa9')]];var _0x2d9779;if(_0x26b55a){_0x2d9779=this[_0x624c('0x12')][_0x26b55a['queue']];logger[_0x624c('0x57')]('[syncHangup][talking]',_0x46f429[_0x624c('0xa9')],'\x20Queue',_0x2d9779[_0x624c('0x26')],_0x624c('0x6e'),_0x2d9779[_0x624c('0x2a')]);}if(this[_0x624c('0x15')][_0x46f429['linkedid']]&&_0x46f429['linkedid']!==_0x46f429[_0x624c('0xab')]){if(_0x46f429[_0x624c('0x130')]==='16'&&this['actions'][_0x46f429['linkedid']]['dialAnswer']){this['callProgressDetectingCustomer'](_0x46f429,_0x46f429['linkedid'],_0x46f429[_0x624c('0x130')]);}else if(this[_0x624c('0x15')][_0x46f429[_0x624c('0xa9')]][_0x624c('0x6f')]){logger[_0x624c('0x57')](_0x624c('0x131'),_0x46f429[_0x624c('0xa9')],_0x46f429[_0x624c('0x130')],_0x624c('0xac'),_0x2d9779[_0x624c('0x26')],_0x624c('0x6e'),_0x2d9779[_0x624c('0x2a')]);this[_0x624c('0x132')](_0x46f429,_0x46f429[_0x624c('0xa9')],_0x46f429[_0x624c('0x130')]);}}else if(_0x26b55a&&_[_0x624c('0x69')](_0x26b55a[_0x624c('0x133')])&&_0x2d9779['dialQueueProject']&&_0x46f429[_0x624c('0xa9')]===_0x46f429[_0x624c('0xab')]&&_[_0x624c('0x69')](_0x46f429[_0x624c('0xea')])&&_0x46f429[_0x624c('0x130')]==='16'&&_0x46f429['channelstate']==='6'&&_[_0x624c('0xe8')](_0x26b55a[_0x624c('0x134')])){if(_0x26b55a[_0x624c('0xa7')]){rpcDb[_0x624c('0x12b')](_0x26b55a[_0x624c('0xfb')]);}if(_0x26b55a['activeContact']){rpcDb['disableContact'](_0x26b55a['idContact']);}_0x46f429[_0x624c('0xea')]='22';this[_0x624c('0xe7')](_0x26b55a,_0x2d9779,_0x46f429);}else if(_0x26b55a&&_0x26b55a[_0x624c('0x134')]){if(_0x46f429[_0x624c('0x130')]==='16'&&this['actions'][_0x46f429['linkedid']][_0x624c('0x6f')]){logger[_0x624c('0x57')](_0x624c('0x135'),_0x46f429['linkedid'],_0x46f429[_0x624c('0x130')],_0x624c('0xac'),_0x2d9779['name'],_0x624c('0x6e'),_0x2d9779['pTalking']);this['callProgressDetectingCustomer'](_0x46f429,_0x46f429['linkedid'],_0x46f429[_0x624c('0x130')]);}else if(this[_0x624c('0x15')][_0x46f429[_0x624c('0xa9')]][_0x624c('0x6f')]){logger[_0x624c('0x57')](_0x624c('0x131'),_0x46f429[_0x624c('0xa9')],_0x46f429[_0x624c('0x130')],_0x624c('0xac'),_0x2d9779[_0x624c('0x26')],_0x624c('0x6e'),_0x2d9779[_0x624c('0x2a')]);this[_0x624c('0x132')](_0x46f429,_0x46f429[_0x624c('0xa9')],_0x46f429[_0x624c('0x130')]);}}};Preview[_0x624c('0x61')][_0x624c('0x136')]=function(_0x2127d0){if(this['actions'][_0x2127d0[_0x624c('0xe6')]]&&_0x2127d0[_0x624c('0xe6')]!==_0x2127d0[_0x624c('0x137')]){this[_0x624c('0x132')](_0x2127d0,_0x2127d0['destlinkedid'],_0x2127d0[_0x624c('0xe1')]);}};Preview[_0x624c('0x61')]['syncHangupRequest']=function(_0x4489ed){if(this['actions'][_0x4489ed['linkedid']]&&_0x4489ed[_0x624c('0xa9')]!==_0x4489ed['uniqueid']&&!this[_0x624c('0x15')][_0x4489ed[_0x624c('0xa9')]][_0x624c('0x6f')]){if(_0x4489ed['cause']==='1'){this['callProgressDetectingCustomer'](_0x4489ed,_0x4489ed[_0x624c('0xa9')],_0x4489ed[_0x624c('0x130')]);}}};Preview['prototype'][_0x624c('0x138')]=function(_0x114dda,_0x5a9e28,_0x3a7b5a){if(this['actions'][_0x114dda]){if(_['isNil'](this[_0x624c('0x15')][_0x114dda][_0x624c('0x139')])){this[_0x624c('0x15')][_0x114dda][_0x624c('0x139')]={};}this['actions'][_0x114dda][_0x624c('0x139')][_0x5a9e28]=_0x3a7b5a;}};Preview[_0x624c('0x61')]['syncVarSet']=function(_0x2aac65){try{if(!_['isNil'](_0x2aac65)){if(ut[_0x624c('0x13a')](_['keys'](_0x2aac65[_0x624c('0x13b')])[0x0])){this[_0x624c('0x138')](_0x2aac65[_0x624c('0xab')],_[_0x624c('0x13c')](_0x2aac65[_0x624c('0x13b')])[0x0],_0x2aac65['value']);}}}catch(_0x93cab4){logger[_0x624c('0x13d')]('[syncVarSet][Preview]',util['inspect'](_0x93cab4,{'showHidden':![],'depth':null}));}};Preview[_0x624c('0x61')][_0x624c('0x20')]=function(_0x4174a4){if(_0x4174a4){if(this['actions'][_0x4174a4['transfertargetlinkedid']]){this[_0x624c('0x15')][_0x4174a4[_0x624c('0x13e')]][_0x624c('0x134')]=!![];}}};Preview[_0x624c('0x61')][_0x624c('0x22')]=function(_0x2ddafa){if(_0x2ddafa){if(this[_0x624c('0x15')][_0x2ddafa['transfererlinkedid']]){this['actions'][_0x2ddafa[_0x624c('0x13f')]][_0x624c('0x134')]=!![];}}};module[_0x624c('0x140')]=Preview; \ No newline at end of file +var _0x11b7=['Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','Contact','substring','dialCutDigit','getCallerId','callerid','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','[originateFailure][logOriginateFailure]','syncOriginateResponse','actionid','lookAgent','clone','responsetime','isFailure','rejected','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','destuniqueid','addVariable','variables','keys','variable','value','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','moment','md5','../../../config/environment','../../../config/logger','preview','actionPreview','./rpcDb','./action','./util/util','redis','defaults','localhost','prototype','enqueue','tail','finally','campaignsPreview','trunks','agents','clockClearZombieChannels','originateresponse','bind','hangup','syncHangup','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','name','strategy','loggedIn','sumBillable','sumHoldTime','talking','total','type','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCallToSecond','erlangBusyFactor','startProgressive','Trunk','Interval','stringify','voice:queue:%s','voice_queue:save','voice_queue_channel:remove','originated','pTalking','sendMessageOneNotActive','available','paused','message','NOT_ACTIVE','\x20is\x20not\x20active','IS_DISACTIVED','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','loopCampaigns','syncCampaigns','hasOwnProperty','outbound','setMessage','recallMe','sequence','isNil','actions','queue','pTalking:\x20','dialAnswer','contactId','UserId','ListId','status','catch','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','[Dialer][checkChannel][pTalking][Preview]','loggerError','clearZombieChannels','info','[action]','size','clearZombieChannel','getContactRecallMe','then','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','format','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','TrunkBackup','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','ANSWER','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','emit','custom:agentconnect','buildObj','connect','acw','custom:agentConnectPreview','buildAcw','complete','answered','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','BUSY','countbusyretry','Busy','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','rescheduleContact','NOANSWER','NoAnswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','outboundCongestionCallsDay','countcongestionretry','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','dialBusyRetryFrequency','CANCEL','outboundRejectCallsDay','countagentrejectretry','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','countabandonedretry','[default]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','destlinkedid','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','createAgentHistory','Congestion','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','phone','VoiceQueueId','Contact\x20is\x20undefined','Queue','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','isTrunkReachable','active','SIP/%s','unmonitored','execRun','pick','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20Backup\x20is\x20not\x20active'];(function(_0x2f4f15,_0x1786f3){var _0x3f163c=function(_0xef9a4c){while(--_0xef9a4c){_0x2f4f15['push'](_0x2f4f15['shift']());}};_0x3f163c(++_0x1786f3);}(_0x11b7,0x180));var _0x711b=function(_0x398896,_0x535e72){_0x398896=_0x398896-0x0;var _0x929cb2=_0x11b7[_0x398896];return _0x929cb2;};'use strict';var util=require(_0x711b('0x0'));var _=require(_0x711b('0x1'));var BPromise=require('bluebird');var uuid=require(_0x711b('0x2'));var moment=require(_0x711b('0x3'));var md5=require(_0x711b('0x4'));var Redis=require('ioredis');var config=require(_0x711b('0x5'));var logger=require(_0x711b('0x6'))(_0x711b('0x7'));var loggerAction=require(_0x711b('0x6'))(_0x711b('0x8'));var ami=require('../ami');var rpcDb=require(_0x711b('0x9'));var Action=require(_0x711b('0xa'));var ut=require(_0x711b('0xb'));config[_0x711b('0xc')]=_[_0x711b('0xd')](config[_0x711b('0xc')],{'host':_0x711b('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x711b('0xc')]));var Sequence=function(){};Sequence[_0x711b('0xf')][_0x711b('0x10')]=function(_0x2d8b94){this['tail']=this['tail']?this[_0x711b('0x11')][_0x711b('0x12')](_0x2d8b94):_0x2d8b94();};function Preview(_0x3ceeb9){this['sequence']=new Sequence();this[_0x711b('0x13')]=_0x3ceeb9['voiceQueues'];this[_0x711b('0x14')]=_0x3ceeb9['trunks'];this['actions']={};this['agents']=_0x3ceeb9[_0x711b('0x15')];this[_0x711b('0x16')]=0x0;ami['on'](_0x711b('0x17'),this['syncOriginateResponse'][_0x711b('0x18')](this));ami['on'](_0x711b('0x19'),this[_0x711b('0x1a')][_0x711b('0x18')](this));ami['on']('hanguprequest',this[_0x711b('0x1b')]['bind'](this));ami['on'](_0x711b('0x1c'),this[_0x711b('0x1d')][_0x711b('0x18')](this));ami['on'](_0x711b('0x1e'),this[_0x711b('0x1f')][_0x711b('0x18')](this));ami['on']('varset',this[_0x711b('0x20')]['bind'](this));ami['on'](_0x711b('0x21'),this[_0x711b('0x22')][_0x711b('0x18')](this));ami['on'](_0x711b('0x23'),this[_0x711b('0x24')]['bind'](this));this['loopCampaigns'](this['campaignsPreview']);}function emit(_0x55213e,_0x278cf7,_0x1904b5){io['to'](_0x55213e)['emit'](_0x278cf7,_0x1904b5);}function emitCampaignPreview(_0x488880){if(_0x488880['type']==='outbound'){var _0x507216={'id':_0x488880['id'],'name':_0x488880[_0x711b('0x25')],'strategy':_0x488880[_0x711b('0x26')],'answered':_0x488880['answered'],'available':_0x488880['available'],'loggedIn':_0x488880[_0x711b('0x27')],'pTalking':_0x488880['pTalking'],'sumBillable':_0x488880[_0x711b('0x28')],'sumDuration':_0x488880['sumDuration'],'sumHoldTime':_0x488880[_0x711b('0x29')]||0x0,'talking':_0x488880[_0x711b('0x2a')],'total':_0x488880[_0x711b('0x2b')],'type':_0x488880[_0x711b('0x2c')],'unmanaged':_0x488880['unmanaged'],'abandoned':_0x488880['abandoned'],'waiting':_0x488880['waiting'],'loggedInDb':_0x488880[_0x711b('0x2d')],'dialActive':_0x488880[_0x711b('0x2e')],'dialMethod':_0x488880[_0x711b('0x2f')],'dialOriginateCallerIdName':_0x488880[_0x711b('0x30')],'dialOriginateCallerIdNumber':_0x488880['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x488880[_0x711b('0x31')],'dialPrefix':_0x488880[_0x711b('0x32')],'outboundAnswerAgiCallsDay':_0x488880[_0x711b('0x33')],'outboundAnswerCallsDay':_0x488880[_0x711b('0x34')],'outboundBlacklistCallsDay':_0x488880[_0x711b('0x35')],'outboundBusyCallsDay':_0x488880[_0x711b('0x36')],'outboundCongestionCallsDay':_0x488880['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x488880[_0x711b('0x37')],'outboundDropCallsDayCallersExit':_0x488880[_0x711b('0x38')],'outboundDropCallsDayTimeout':_0x488880[_0x711b('0x39')],'outboundNoAnswerCallsDay':_0x488880[_0x711b('0x3a')],'outboundNoSuchCallsDay':_0x488880[_0x711b('0x3b')],'outboundOriginateFailureCallsDay':_0x488880[_0x711b('0x3c')],'outboundReCallsDay':_0x488880[_0x711b('0x3d')],'outboundRejectCallsDay':_0x488880['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x488880[_0x711b('0x3e')],'outboundAbandonedCallsDay':_0x488880[_0x711b('0x3f')],'predictiveIntervalAnsweredCalls':_0x488880[_0x711b('0x40')],'predictiveIntervalAvgHoldtime':_0x488880[_0x711b('0x41')],'predictiveIntervalAvgTalktime':_0x488880[_0x711b('0x42')],'predictiveIntervalDroppedCallsCallersExit':_0x488880[_0x711b('0x43')],'predictiveIntervalDroppedCallsTimeout':_0x488880['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x488880[_0x711b('0x44')],'predictiveIntervalErlangCallsDroppedCalls':_0x488880['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x488880[_0x711b('0x45')],'predictiveIntervalMultiplicativeFactor':_0x488880[_0x711b('0x46')],'predictiveIntervalPauses':_0x488880[_0x711b('0x47')],'predictiveIntervalAvailable':_0x488880[_0x711b('0x48')],'predictiveIntervalTotalCalls':_0x488880[_0x711b('0x49')],'message':_0x488880['message'],'originated':_0x488880['originated'],'erlangCalls':_0x488880['erlangCalls'],'erlangCallToSecond':_0x488880[_0x711b('0x4a')],'erlangAbandonmentRate':_0x488880['erlangAbandonmentRate'],'erlangBusyFactor':_0x488880[_0x711b('0x4b')],'startPredictive':_0x488880['startPredictive'],'startProgressive':_0x488880[_0x711b('0x4c')]};if(_0x488880[_0x711b('0x4d')]){_0x507216[_0x711b('0x4d')]={'id':_0x488880['Trunk']['id'],'name':_0x488880['Trunk'][_0x711b('0x25')],'active':_0x488880[_0x711b('0x4d')]['active'],'callerid':_0x488880['Trunk']['callerid']};}if(_0x488880[_0x711b('0x4e')]){_0x507216[_0x711b('0x4e')]={'id':_0x488880[_0x711b('0x4e')]['id'],'name':_0x488880[_0x711b('0x4e')][_0x711b('0x25')]};}var _0x2ed7f4=md5(JSON[_0x711b('0x4f')](_0x507216));if(_0x488880[_0x711b('0x4')]!==_0x2ed7f4){_0x488880[_0x711b('0x4')]=_0x2ed7f4;emit(util['format'](_0x711b('0x50'),_0x507216['name']),_0x711b('0x51'),_0x507216);}}}function emitVoiceQueueChannelRemove(_0x3d1657){logger['info']('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x711b('0x4f')](_0x3d1657));emit(util['format'](_0x711b('0x50'),_0x3d1657[_0x711b('0x25')]),_0x711b('0x52'),_0x3d1657);}function notSendMessagesQueue(_0x1a9409){if(_0x1a9409['sendMessageOneNotActive']){if(_0x1a9409[_0x711b('0x53')]===0x0&&_0x1a9409[_0x711b('0x54')]===0x0){_0x1a9409[_0x711b('0x55')]=![];_0x1a9409[_0x711b('0x56')]=0x0;_0x1a9409[_0x711b('0x57')]=0x0;_0x1a9409[_0x711b('0x58')]=_0x711b('0x59');ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x1a9409[_0x711b('0x25')]+_0x711b('0x5a'));}else{_0x1a9409['message']=_0x711b('0x5b');ut[_0x711b('0x5c')](_0x711b('0x5d'),_0x1a9409['name']+_0x711b('0x5e'));}emitCampaignPreview(_0x1a9409);}}Preview['prototype'][_0x711b('0x5f')]=function(){var _0x5c4c84=this;setInterval(function(){_0x5c4c84[_0x711b('0x60')]();},0x7cf);};Preview[_0x711b('0xf')][_0x711b('0x60')]=function(){var _0x233658=this[_0x711b('0x13')];this[_0x711b('0x16')]+=0x1;for(var _0x476b50 in _0x233658){if(_0x233658[_0x711b('0x61')](_0x476b50)&&(_0x233658[_0x476b50][_0x711b('0x2f')]===_0x711b('0x7')||_0x233658[_0x476b50]['dialMethod']==='booked')&&_0x233658[_0x476b50][_0x711b('0x2c')]===_0x711b('0x62')){if(this[_0x711b('0x16')]>0x7){this[_0x711b('0x16')]=0x0;this['clearZombieChannels']();}}if(_0x233658[_0x711b('0x61')](_0x476b50)&&_0x233658[_0x476b50][_0x711b('0x2f')]==='preview'&&_0x233658[_0x476b50]['type']===_0x711b('0x62')){if(_0x233658[_0x476b50][_0x711b('0x2e')]){this[_0x711b('0x63')](_0x233658[_0x476b50]);this[_0x711b('0x64')](_0x233658[_0x476b50]);}else{notSendMessagesQueue(_0x233658[_0x476b50]);}}}};Preview[_0x711b('0xf')]['clearZombieChannel']=function(_0x9759c5){var _0x37c419=this;this[_0x711b('0x65')][_0x711b('0x10')](function(){if(!_[_0x711b('0x66')](_0x37c419[_0x711b('0x67')][_0x9759c5])){loggerAction['info']('[clearZombieChannels][talking]',_0x9759c5,'Queue',_0x37c419['actions'][_0x9759c5][_0x711b('0x68')],'originated:\x20',JSON[_0x711b('0x4f')](_0x37c419['campaignsPreview'][_0x37c419[_0x711b('0x67')][_0x9759c5][_0x711b('0x68')]][_0x711b('0x53')]),_0x711b('0x69'),JSON['stringify'](_0x37c419[_0x711b('0x13')][_0x37c419[_0x711b('0x67')][_0x9759c5]['queue']]['pTalking']),JSON[_0x711b('0x4f')](_0x37c419[_0x711b('0x67')][_0x9759c5][_0x711b('0x6a')]),JSON['stringify'](_['pick'](_0x37c419[_0x711b('0x67')][_0x9759c5],[_0x711b('0x6b'),_0x711b('0x6c'),'VoiceQueueId',_0x711b('0x6d')])));return ami['Action']({'action':_0x711b('0x6e'),'channel':_0x37c419[_0x711b('0x67')][_0x9759c5]['channel']})[_0x711b('0x6f')](function(_0x28c7f8){if(_0x28c7f8[_0x711b('0x58')]===_0x711b('0x70')){setTimeout(function(){if(_0x37c419['actions'][_0x9759c5]){ut['updateOriginated'](_0x37c419[_0x711b('0x13')][_0x37c419[_0x711b('0x67')][_0x9759c5][_0x711b('0x68')]],_0x711b('0x71'));if(_0x37c419[_0x711b('0x67')][_0x9759c5][_0x711b('0x6a')]===!![]){ut[_0x711b('0x72')](_0x37c419[_0x711b('0x13')][_0x37c419[_0x711b('0x67')][_0x9759c5]['queue']],'[clearZombieChannel]');ut['loggerError'](_0x711b('0x73')+_0x9759c5,_0x37c419[_0x711b('0x67')][_0x9759c5][_0x711b('0x68')]);}ut[_0x711b('0x74')]('[Dialer][checkChannel][Preview]'+_0x9759c5,_0x37c419[_0x711b('0x67')][_0x9759c5][_0x711b('0x68')]);delete _0x37c419[_0x711b('0x67')][_0x9759c5];}},0x2328);}});}});};Preview[_0x711b('0xf')][_0x711b('0x75')]=function(){var _0x2ccc6e=this;loggerAction[_0x711b('0x76')](_0x711b('0x77'),_[_0x711b('0x78')](this[_0x711b('0x67')]));for(var _0x1302c6 in this[_0x711b('0x67')]){if(_0x2ccc6e[_0x711b('0x67')]['hasOwnProperty'](_0x1302c6)){_0x2ccc6e[_0x711b('0x79')](_0x1302c6);}}};Preview[_0x711b('0xf')][_0x711b('0x64')]=function(_0x4eb64a){var _0x1441b8=this;rpcDb[_0x711b('0x7a')](_0x4eb64a['id'],ut['agentReadyId'](this[_0x711b('0x15')]))[_0x711b('0x7b')](function(_0x185464){if(!_[_0x711b('0x66')](_0x185464)){for(var _0x2fa63f=0x0;_0x2fa63f<_0x185464['length'];_0x2fa63f+=0x1){if(ut[_0x711b('0x7c')](_0x185464[_0x2fa63f][_0x711b('0x7d')])<_0x4eb64a[_0x711b('0x7e')]*0x3c){if(_0x185464[_0x2fa63f][_0x711b('0x7f')]&&!_0x185464[_0x2fa63f][_0x711b('0x7f')][_0x711b('0x80')]){_0x1441b8[_0x711b('0x81')](_0x185464[_0x2fa63f]['id'])[_0x711b('0x7b')](ut[_0x711b('0x82')](_0x711b('0x83')))[_0x711b('0x6f')](ut[_0x711b('0x82')](_0x711b('0x83')));}else{rpcDb[_0x711b('0x84')](_0x185464[_0x2fa63f]['id']);}}else{var _0x344281=new Action(_0x185464[_0x2fa63f],_0x4eb64a);_0x344281[_0x711b('0x85')]=moment()[_0x711b('0x86')](_0x711b('0x87'));_0x4eb64a[_0x711b('0x3d')]+=0x1;ut[_0x711b('0x88')](_0x344281,0x17,_0x711b('0x89'));if(_0x4eb64a[_0x711b('0x8a')]){rpcDb[_0x711b('0x8b')](ut[_0x711b('0x8c')](_0x185464[_0x2fa63f]));rpcDb['createCustomerHistory'](_0x344281,_0x711b('0x8d'));}else{ut[_0x711b('0x88')](_0x344281,0x16,_0x711b('0x8e'));rpcDb[_0x711b('0x8f')](_0x344281,_0x711b('0x90'));rpcDb[_0x711b('0x91')](_0x344281,_0x711b('0x90'));}}}}})['catch'](ut[_0x711b('0x82')](_0x711b('0x92')));};Preview[_0x711b('0xf')]['setMessage']=function(_0x3d6030){_0x3d6030[_0x711b('0x55')]=!![];if(ut[_0x711b('0x93')](_0x3d6030[_0x711b('0x27')])){_0x3d6030['message']=_0x711b('0x94');}else if(!ut[_0x711b('0x95')](_0x3d6030[_0x711b('0x2e')])){_0x3d6030[_0x711b('0x58')]=_0x711b('0x59');}else if(!this['isTrunkReachable'](_0x3d6030[_0x711b('0x4d')])){if(!this['isTrunkReachable'](_0x3d6030[_0x711b('0x96')])){_0x3d6030[_0x711b('0x58')]='TRUNK_IS_NOT_REACHABLE';}else{_0x3d6030[_0x711b('0x58')]=_0x711b('0x97');}}else{_0x3d6030[_0x711b('0x58')]='ACTIVE';}emitCampaignPreview(_0x3d6030);};Preview[_0x711b('0xf')][_0x711b('0x98')]=function(_0x5f024f,_0x3ef1ed,_0x22fea6){var _0x5e7725=this;var _0x4d2a7e=this['actions'][_0x3ef1ed];var _0x434b29=this[_0x711b('0x13')][_0x4d2a7e[_0x711b('0x68')]];var _0x89e233;if(_0x434b29){switch(_0x22fea6){case'1':_0x434b29['outboundNoSuchCallsDay']+=0x1;_0x4d2a7e[_0x711b('0x99')]+=0x1;_0x4d2a7e[_0x711b('0x9a')]=ut[_0x711b('0x9b')](_0x4d2a7e);ut[_0x711b('0x88')](_0x4d2a7e,0x0,'NoSuchNumber');ami['emit'](_0x711b('0x9c'),ut['buildObj'](_0x4d2a7e,_0x711b('0x9d')));rpcDb[_0x711b('0x8f')](_0x4d2a7e,_0x711b('0x9e'));if(ut['totalGlobal'](_0x4d2a7e)>=_0x434b29[_0x711b('0x9f')]){_0x89e233=ut[_0x711b('0xa0')](_0x4d2a7e,0xf,'Global');rpcDb[_0x711b('0x91')](_0x89e233,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x4d2a7e['countnosuchnumberretry']>=_0x434b29[_0x711b('0xa1')]){rpcDb[_0x711b('0x91')](_0x4d2a7e,_0x711b('0xa2'));}else{rpcDb['rescheduleContact'](ut[_0x711b('0xa3')](_0x4d2a7e,_0x711b('0x99'),_0x434b29[_0x711b('0xa4')]),_0x4d2a7e[_0x711b('0xa5')],_0x4d2a7e[_0x711b('0xa6')]);}}delete this[_0x711b('0x67')][_0x5f024f[_0x711b('0xa7')]];break;case _0x711b('0xa8'):var _0x4b4ccd=moment()['format'](_0x711b('0x87'));_0x4d2a7e['responsetime']=_0x4b4ccd;_0x4d2a7e[_0x711b('0xa9')]=_0x4b4ccd;_0x4d2a7e[_0x711b('0x6a')]=!![];_0x434b29[_0x711b('0x54')]+=0x1;logger[_0x711b('0x76')](_0x711b('0xaa'),_0x4d2a7e[_0x711b('0xab')],_0x711b('0xac'),_0x434b29[_0x711b('0x25')],_0x711b('0x69'),_0x434b29[_0x711b('0x54')]);ami[_0x711b('0xad')](_0x711b('0xae'),ut[_0x711b('0xaf')](_0x4d2a7e,_0x711b('0xb0')));if(_0x434b29[_0x711b('0xb1')]){ami[_0x711b('0xad')](_0x711b('0xb2'),ut[_0x711b('0xb3')](_0x4d2a7e));}break;case'16':ami[_0x711b('0xad')]('custom:agentcomplete',ut[_0x711b('0xaf')](_0x4d2a7e,'complete'));emitVoiceQueueChannelRemove(ut[_0x711b('0xaf')](_0x4d2a7e,_0x711b('0xb4')));_0x434b29[_0x711b('0x34')]+=0x1;_0x434b29[_0x711b('0x2b')]+=0x1;_0x434b29[_0x711b('0xb5')]+=0x1;ut[_0x711b('0x72')](_0x434b29,_0x711b('0xb6'));_0x4d2a7e['countglobal']=ut[_0x711b('0x9b')](_0x4d2a7e);ut[_0x711b('0x88')](_0x4d2a7e,0x4,_0x711b('0xb7'));rpcDb[_0x711b('0x8f')](_0x4d2a7e,_0x711b('0xb8'));rpcDb['createCustomerFinal'](_0x4d2a7e,_0x711b('0xb9'));rpcDb[_0x711b('0xba')](_0x4d2a7e);_0x434b29[_0x711b('0xbb')]+=_0x4d2a7e[_0x711b('0xbc')];_0x434b29['sumBillable']+=_0x4d2a7e[_0x711b('0xbc')];logger[_0x711b('0x76')]('[syncHangup][talking][decrement]',_0x4d2a7e[_0x711b('0xab')],_0x711b('0xac'),_0x434b29[_0x711b('0x25')],_0x711b('0x69'),_0x434b29[_0x711b('0x54')]);delete this[_0x711b('0x67')][_0x5f024f[_0x711b('0xa7')]];break;case _0x711b('0xbd'):_0x434b29['outboundBusyCallsDay']+=0x1;_0x4d2a7e[_0x711b('0xbe')]+=0x1;_0x4d2a7e['countglobal']=ut['totalGlobal'](_0x4d2a7e);ut[_0x711b('0x88')](_0x4d2a7e,0x5,_0x711b('0xbf'));ami[_0x711b('0xad')](_0x711b('0xc0'),ut['buildObj'](_0x4d2a7e,'busy'));rpcDb[_0x711b('0x8f')](_0x4d2a7e,_0x711b('0xc1'));if(ut[_0x711b('0x9b')](_0x4d2a7e)>=_0x434b29[_0x711b('0x9f')]){_0x89e233=ut['cloneAction'](_0x4d2a7e,0xf,_0x711b('0xc2'));rpcDb['createCustomerFinal'](_0x89e233,_0x711b('0xc3'));}else{if(_0x4d2a7e['countbusyretry']>=_0x434b29[_0x711b('0xc4')]){rpcDb[_0x711b('0x91')](_0x4d2a7e,_0x711b('0xc1'));}else{rpcDb[_0x711b('0xc5')](ut[_0x711b('0xa3')](_0x4d2a7e,_0x711b('0xbe'),_0x434b29['dialBusyRetryFrequency']),_0x4d2a7e['unlockAgent'],_0x4d2a7e[_0x711b('0xa6')]);}}break;case _0x711b('0xc6'):_0x434b29[_0x711b('0x3a')]+=0x1;_0x4d2a7e['countnoanswerretry']+=0x1;_0x4d2a7e[_0x711b('0x9a')]=ut[_0x711b('0x9b')](_0x4d2a7e);ut['logCustomer'](_0x4d2a7e,0x3,_0x711b('0xc7'));ami[_0x711b('0xad')]('custom:agentnoanswer',ut[_0x711b('0xaf')](_0x4d2a7e,_0x711b('0xc8')));rpcDb[_0x711b('0x8f')](_0x4d2a7e,_0x711b('0xc9'));if(ut[_0x711b('0x9b')](_0x4d2a7e)>=_0x434b29['dialGlobalMaxRetry']){_0x89e233=ut['cloneAction'](_0x4d2a7e,0xf,_0x711b('0xc2'));rpcDb[_0x711b('0x91')](_0x89e233,_0x711b('0xca'));}else{if(_0x4d2a7e['countnoanswerretry']>=_0x434b29[_0x711b('0xcb')]){rpcDb[_0x711b('0x91')](_0x4d2a7e,_0x711b('0xc9'));}else{rpcDb[_0x711b('0xc5')](ut['scheduledAt'](_0x4d2a7e,'countnoanswerretry',_0x434b29['dialNoAnswerRetryFrequency']),_0x4d2a7e[_0x711b('0xa5')],_0x4d2a7e[_0x711b('0xa6')]);}}break;case'CONGESTION':_0x434b29[_0x711b('0xcc')]+=0x1;_0x4d2a7e[_0x711b('0xcd')]+=0x1;_0x4d2a7e[_0x711b('0x9a')]=ut[_0x711b('0x9b')](_0x4d2a7e);ut[_0x711b('0x88')](_0x4d2a7e,0x8,'Congestion');rpcDb[_0x711b('0x8f')](_0x4d2a7e,'[callProgressDetectingCustomer][logCongestion]');if(ut['totalGlobal'](_0x4d2a7e)>=_0x434b29[_0x711b('0x9f')]){_0x89e233=ut['cloneAction'](_0x4d2a7e,0xf,'Global');rpcDb['createCustomerFinal'](_0x89e233,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x4d2a7e['countcongestionretry']>=_0x434b29[_0x711b('0xce')]){rpcDb['createCustomerFinal'](_0x4d2a7e,_0x711b('0xcf'));}else{rpcDb[_0x711b('0xc5')](ut[_0x711b('0xa3')](_0x4d2a7e,_0x711b('0xcd'),_0x434b29[_0x711b('0xd0')]),_0x4d2a7e[_0x711b('0xa5')],_0x4d2a7e[_0x711b('0xa6')]);}}break;case _0x711b('0xd1'):_0x434b29[_0x711b('0xd2')]+=0x1;_0x4d2a7e[_0x711b('0xd3')]+=0x1;_0x4d2a7e[_0x711b('0x9a')]=ut[_0x711b('0x9b')](_0x4d2a7e);ut[_0x711b('0x88')](_0x4d2a7e,0x14,'AgentReject');rpcDb[_0x711b('0x8f')](_0x4d2a7e,_0x711b('0xd4'));if(ut['totalGlobal'](_0x4d2a7e)>=_0x434b29[_0x711b('0x9f')]){_0x89e233=ut[_0x711b('0xa0')](_0x4d2a7e,0x14,_0x711b('0xd5'));rpcDb[_0x711b('0x91')](_0x89e233,_0x711b('0xd6'));}else{if(_0x4d2a7e[_0x711b('0xd3')]>=_0x434b29['dialAgentRejectMaxRetry']){rpcDb[_0x711b('0x91')](_0x4d2a7e,_0x711b('0xd6'));}else{rpcDb[_0x711b('0xc5')](ut[_0x711b('0xa3')](_0x4d2a7e,_0x711b('0xd3'),_0x434b29['dialAgentRejectRetryFrequency']),_0x4d2a7e[_0x711b('0xa5')],_0x4d2a7e[_0x711b('0xa6')]);}}break;case'ABANDONED':_0x434b29[_0x711b('0x3f')]+=0x1;_0x4d2a7e['countabandonedretry']+=0x1;_0x4d2a7e[_0x711b('0x9a')]=ut[_0x711b('0x9b')](_0x4d2a7e);ut[_0x711b('0x88')](_0x4d2a7e,0xb,_0x711b('0xd7'));rpcDb[_0x711b('0x8f')](_0x4d2a7e,_0x711b('0xd8'));if(ut['totalGlobal'](_0x4d2a7e)>=_0x434b29[_0x711b('0x9f')]){_0x89e233=ut[_0x711b('0xa0')](_0x4d2a7e,0xf,'Global');rpcDb['createCustomerFinal'](_0x89e233,_0x711b('0xd8'));}else{if(_0x4d2a7e[_0x711b('0xd9')]>=_0x434b29[_0x711b('0xda')]){rpcDb['createCustomerFinal'](_0x4d2a7e,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0x711b('0xc5')](ut[_0x711b('0xa3')](_0x4d2a7e,_0x711b('0xdb'),_0x434b29['dialAbandonedRetryFrequency']),_0x4d2a7e['unlockAgent'],_0x4d2a7e[_0x711b('0xa6')]);}}break;default:if(_0x4d2a7e[_0x711b('0x6a')]){ut[_0x711b('0x72')](_0x434b29,_0x711b('0xdc'));ut[_0x711b('0x74')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x434b29[_0x711b('0x25')],_0x5f024f);}_0x434b29[_0x711b('0x3e')]+=0x1;_0x4d2a7e[_0x711b('0x9a')]=ut[_0x711b('0x9b')](_0x4d2a7e);ut['logCustomer'](_0x4d2a7e,0xc,_0x5f024f[_0x711b('0xdd')]||_0x5f024f[_0x711b('0xde')]);rpcDb[_0x711b('0x8f')](_0x4d2a7e,_0x711b('0xdf'));if(ut[_0x711b('0x9b')](_0x4d2a7e)>=_0x434b29['dialGlobalMaxRetry']){_0x89e233=ut['cloneAction'](_0x4d2a7e,0xf,'Global');rpcDb[_0x711b('0x91')](_0x89e233,_0x711b('0xe0'));}else{rpcDb[_0x711b('0x91')](_0x4d2a7e,_0x711b('0xe0'));}delete this[_0x711b('0x67')][_0x5f024f[_0x711b('0xa7')]];}if(!(_0x4d2a7e[_0x711b('0x6a')]&&_0x22fea6==='16')){ut[_0x711b('0xe1')](_0x434b29,'[callProgressDetectingCustomer]');logger['info'](_0x711b('0xe2'),_0x4d2a7e[_0x711b('0xab')],_0x711b('0xac'),_0x434b29[_0x711b('0x25')],_0x711b('0xe3'),_0x434b29['originated']);}if(_0x22fea6!==_0x711b('0xa8')){delete this[_0x711b('0x67')][_0x5f024f[_0x711b('0xa7')]];delete this[_0x711b('0x67')][_0x5f024f[_0x711b('0xe4')]];}}};Preview['prototype']['callProgressDetectingAgent']=function(_0x33dafc,_0x51563a,_0x2db2ae){if(_[_0x711b('0xe5')](_0x51563a)&&_0x711b('0xe6')!==typeof _0x51563a){return;}if(_[_0x711b('0xe5')](_0x2db2ae)&&_0x711b('0xe6')!==typeof _0x2db2ae){return;}switch(_0x2db2ae[_0x711b('0xe7')]){case'0':ut[_0x711b('0xe8')](_0x33dafc,0x0,'NoSuchNumber');rpcDb['createAgentHistory'](_0x33dafc,_0x711b('0xe9'));break;case'3':ut['logAgent'](_0x33dafc,0x3,'NoAnswer');rpcDb['createAgentHistory'](_0x33dafc,_0x711b('0xea'));break;case'5':ut[_0x711b('0xe8')](_0x33dafc,0x5,_0x711b('0xbf'));rpcDb[_0x711b('0xeb')](_0x33dafc,'[callProgressDetectingAgent][logBusy]');break;case'8':ut['logAgent'](_0x33dafc,0x8,_0x711b('0xec'));rpcDb[_0x711b('0xeb')](_0x33dafc,_0x711b('0xed'));break;case'22':ut[_0x711b('0xe8')](_0x33dafc,0x16,_0x711b('0xee'));rpcDb['createAgentHistory'](_0x33dafc,_0x711b('0xef'));break;default:ut[_0x711b('0xe8')](_0x33dafc,0xc,_0x2db2ae['reason']);rpcDb[_0x711b('0xeb')](_0x33dafc,_0x711b('0xed'));}ut[_0x711b('0xe1')](_0x51563a,_0x711b('0xf0'));logger[_0x711b('0x76')](_0x711b('0xf1'),_0x33dafc['uniqueid'],_0x711b('0xac'),_0x51563a[_0x711b('0x25')],_0x711b('0xe3'),_0x51563a[_0x711b('0x53')]);delete this[_0x711b('0x67')][_0x33dafc[_0x711b('0xab')]];};Preview[_0x711b('0xf')][_0x711b('0xf2')]=function(_0x377db0,_0x248d22,_0x3d9d66,_0x27d378,_0x186e7c){var _0x33e18e=this;return new BPromise(function(_0x1d7c52,_0x191d7f){if(_['isNil'](_0x248d22)||_[_0x711b('0x66')](_0x248d22['Contact'])||_[_0x711b('0x66')](_0x248d22['Contact'][_0x711b('0xf3')])||_[_0x711b('0x66')](_0x248d22[_0x711b('0xf4')])){_0x191d7f(ut[_0x711b('0x58')](_0x711b('0xf5'),_0x27d378,_0x186e7c));return;}var _0xd3d7d3=uuid['v4']();var _0x373e0f=_0x33e18e[_0x711b('0x13')][_0x248d22[_0x711b('0xf6')][_0x711b('0x25')]];var _0x38f87c=_0x3d9d66?_0x33e18e['agents'][_0x3d9d66]['id']:undefined;_0x33e18e[_0x711b('0x67')][_0xd3d7d3]=new Action(_0x248d22,_0x373e0f,_0xd3d7d3,_0x3d9d66,_0x38f87c);var _0x4bb138=_0x33e18e[_0x711b('0x67')][_0xd3d7d3];_0x4bb138[_0x711b('0xa5')]=_0x27d378;_0x4bb138[_0x711b('0xa6')]=_0x186e7c;_0x4bb138['lookAgent']=_0x3d9d66;if(_['isEmpty'](_0x377db0)){_0x33e18e[_0x711b('0xf7')](_0x4bb138,_0x373e0f,_0x248d22,_0x3d9d66)[_0x711b('0x7b')](function(_0x16807a){logger[_0x711b('0x76')](_0x711b('0xf8'),_0x711b('0xf9')+_0x4bb138['queue']+_0x711b('0xfa')+_0x4bb138[_0x711b('0xfb')],JSON[_0x711b('0x4f')](_0x16807a));ami['emit']('custom:agentcalled',ut['buildObj'](_0x4bb138,_0x711b('0xfc')));_0x1d7c52(ut[_0x711b('0x58')](_0x711b('0xfd')));})[_0x711b('0x6f')](function(_0x44b330){ut['logger'](_0x711b('0xfe'),_0x44b330);_0x191d7f(ut[_0x711b('0x58')](_0x711b('0xff'),_0x27d378,_0x186e7c));});}else{_0x373e0f['outboundBlacklistCallsDay']+=0x1;ut[_0x711b('0x100')](_0x4bb138);rpcDb[_0x711b('0x101')](_0x4bb138,_0x711b('0x102'));delete _0x33e18e['actions'][_0xd3d7d3];_0x191d7f(ut[_0x711b('0x58')](_0x711b('0x103'),_0x27d378,_0x186e7c));}});};Preview['prototype'][_0x711b('0x104')]=function(_0x4eff18){return!_[_0x711b('0x66')](_0x4eff18)&&!_[_0x711b('0x66')](_0x4eff18[_0x711b('0x25')])&&!_[_0x711b('0x66')](_0x4eff18[_0x711b('0x105')])&&_0x4eff18[_0x711b('0x105')]&&!_[_0x711b('0x66')](this[_0x711b('0x14')][util[_0x711b('0x86')]('SIP/%s',_0x4eff18['name'])])&&!_['isNil'](this[_0x711b('0x14')][util[_0x711b('0x86')](_0x711b('0x106'),_0x4eff18[_0x711b('0x25')])][_0x711b('0x6e')])&&(this[_0x711b('0x14')][util[_0x711b('0x86')](_0x711b('0x106'),_0x4eff18[_0x711b('0x25')])][_0x711b('0x6e')]==='reachable'||this[_0x711b('0x14')][util[_0x711b('0x86')](_0x711b('0x106'),_0x4eff18[_0x711b('0x25')])]['status']===_0x711b('0x107'));};Preview['prototype'][_0x711b('0x81')]=function(_0x580444,_0x4bec44){var _0x24f6af=this;return new BPromise(function(_0x174fe9,_0x717aa7){_0x24f6af[_0x711b('0x108')](_0x580444,_0x4bec44)[_0x711b('0x7b')](function(_0x46b03f){_0x174fe9(_[_0x711b('0x109')](_0x46b03f,[_0x711b('0x58')]));})[_0x711b('0x6f')](function(_0x331afa){if(_0x331afa[_0x711b('0x10a')]){rpcDb[_0x711b('0x10b')](_0x580444);}if(_0x331afa[_0x711b('0x105')]){rpcDb[_0x711b('0x84')](_0x580444);}_0x717aa7(_['pick'](_0x331afa,['message']));});});};Preview[_0x711b('0xf')][_0x711b('0x108')]=function(_0x2da3fe,_0x1361db){var _0x178513=this;return new BPromise(function(_0x1cce88,_0x542d53){var _0x13d684,_0xb8cf4c;rpcDb[_0x711b('0x10c')](_0x2da3fe)['then'](function(_0x23c0d2){if(!_[_0x711b('0x66')](_0x23c0d2[0x0])){_0xb8cf4c=_0x23c0d2[0x0]['recallme']?![]:!![];_0x13d684=_0x23c0d2[0x0][_0x711b('0x10d')]?!![]:![];_0x13d684=_0x1361db?!![]:_0x13d684;}var _0xb6e97=_0x178513[_0x711b('0x10e')](_0x23c0d2);if(_0xb6e97[_0x711b('0x10f')]){rpcDb[_0x711b('0x110')](_[_0x711b('0x109')](_0x23c0d2[0x0],['VoiceQueueId',_0x711b('0x111')]))[_0x711b('0x7b')](function(_0x263ea3){_0x178513[_0x711b('0xf2')](_0x263ea3,_0x23c0d2[0x0],_0x1361db,_0xb8cf4c,_0x13d684)[_0x711b('0x7b')](function(_0x348c29){_0x1cce88(_0x348c29);})[_0x711b('0x6f')](function(_0x2b654d){_0x542d53(_0x2b654d);});})[_0x711b('0x6f')](function(_0x3532ef){ut[_0x711b('0x5c')](_0x711b('0x112'),_0x3532ef);_0x542d53(ut[_0x711b('0x58')](_0x711b('0x113'),_0xb8cf4c,_0x13d684));});}else{_0x542d53(ut[_0x711b('0x58')](_0xb6e97[_0x711b('0x58')],_0xb8cf4c,_0x13d684));}})[_0x711b('0x6f')](function(_0x4f3dd7){ut[_0x711b('0x5c')](_0x711b('0x114'),_0x4f3dd7);_0x542d53(ut[_0x711b('0x58')](_0x711b('0x113'),![],!![]));});});};Preview['prototype'][_0x711b('0x10e')]=function(_0x1740fd){if(_[_0x711b('0x66')](_0x1740fd)||_['isEmpty'](_0x1740fd)||!_[_0x711b('0x66')](_0x1740fd[0x0]['Agent'])&&_[_0x711b('0x66')](_0x1740fd[0x0][_0x711b('0x7f')]['name'])){ut[_0x711b('0x5c')](_0x711b('0x115'),_0x1740fd);return{'isValid':![],'message':_0x711b('0x116')};}var _0x1f681e=this[_0x711b('0x13')][_0x1740fd[0x0]['Queue'][_0x711b('0x25')]];_0x1f681e[_0x711b('0x58')]=_0x711b('0x97');if(_[_0x711b('0x66')](_0x1f681e)){ut[_0x711b('0x5c')](_0x711b('0x117'),_0x1f681e);return{'isValid':![],'message':_0x711b('0x118')};}if(!this['isTrunkReachable'](_0x1f681e[_0x711b('0x4d')])){ut[_0x711b('0x5c')](_0x711b('0x119'),_0x711b('0x11a')+_0x1f681e[_0x711b('0x25')]+'\x20Trunk\x20is\x20not\x20active');if(!this['isTrunkReachable'](_0x1f681e[_0x711b('0x96')])){ut[_0x711b('0x5c')](_0x711b('0x119'),_0x1f681e[_0x711b('0x25')]+_0x711b('0x11b'));return{'isValid':![],'message':_0x711b('0x11c')};}}if(!ut[_0x711b('0x95')](_0x1f681e[_0x711b('0x2e')])){ut['logger'](_0x711b('0x11d'),_0x1f681e[_0x711b('0x25')]+_0x711b('0x11e'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x1f681e[_0x711b('0x25')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x711b('0x11f')};};Preview['prototype'][_0x711b('0xf7')]=function(_0xeb9ca7,_0x21382f,_0x2edaad,_0x88ad6){var _0x25f241=this;return new BPromise(function(_0x3c0933,_0xa2a59){var _0x4d1d31=_0xeb9ca7['uniqueid'];var _0x2799b2=_0x25f241['isTrunkReachable'](_0x21382f[_0x711b('0x4d')])?util['format'](_0x711b('0x120'),_0x21382f[_0x711b('0x4d')][_0x711b('0x25')],_['isNil'](_0x21382f['dialPrefix'])?'':_0x21382f['dialPrefix'][_0x711b('0x121')]()||'',_0x21382f['dialCutDigit']>0x0?_0x2edaad[_0x711b('0x122')][_0x711b('0xf3')][_0x711b('0x123')](_0x21382f[_0x711b('0x124')]):_0x2edaad[_0x711b('0x122')][_0x711b('0xf3')]):util['format'](_0x711b('0x120'),_[_0x711b('0x66')](_0x21382f[_0x711b('0x96')])?_0x21382f[_0x711b('0x4d')][_0x711b('0x25')]:_0x21382f[_0x711b('0x96')]['name'],_['isNil'](_0x21382f['dialPrefix'])?'':_0x21382f[_0x711b('0x32')][_0x711b('0x121')]()||'',_0x21382f[_0x711b('0x124')]>0x0?_0x2edaad[_0x711b('0x122')][_0x711b('0xf3')][_0x711b('0x123')](_0x21382f[_0x711b('0x124')]):_0x2edaad[_0x711b('0x122')][_0x711b('0xf3')]);var _0x393184=_0x25f241[_0x711b('0x104')](_0x21382f[_0x711b('0x4d')])?ut[_0x711b('0x125')](_0x21382f[_0x711b('0x4d')][_0x711b('0x126')],_0x21382f[_0x711b('0x30')],_0x21382f['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x711b('0x127')](_0x21382f['dialOriginateCallerIdNumber'],_0x21382f[_0x711b('0x128')]):_0x21382f[_0x711b('0x129')]):ut['getCallerId'](_['isNil'](_0x21382f[_0x711b('0x96')])?_0x21382f[_0x711b('0x4d')]['callerid']:_0x21382f['TrunkBackup'][_0x711b('0x126')],_0x21382f[_0x711b('0x30')],_0x21382f['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x711b('0x127')](_0x21382f[_0x711b('0x129')],_0x21382f[_0x711b('0x128')]):_0x21382f[_0x711b('0x129')]);if(_0x393184){_0xeb9ca7['originatecalleridname']=ut[_0x711b('0x12a')](_0x393184);_0xeb9ca7[_0x711b('0x12b')]=ut[_0x711b('0x12c')](_0x393184);}var _0x3c0fbb=ut[_0x711b('0x12d')](_0x21382f,_0x2edaad,_0x2799b2,_0x393184,_0x4d1d31,_0xeb9ca7);_[_0x711b('0x12e')](_0xeb9ca7,ut[_0x711b('0x12f')](_0x3c0fbb));_0xeb9ca7[_0x711b('0x85')]=moment()[_0x711b('0x86')](_0x711b('0x87'));ami['Action'](ut[_0x711b('0x130')](_0xeb9ca7,_0x21382f,_0x3c0fbb,_0xeb9ca7[_0x711b('0xa6')],_0x88ad6))[_0x711b('0x7b')](function(_0x595611){_0x21382f[_0x711b('0x53')]+=0x1;logger['info']('[originated][increment]',_0x4d1d31,_0x711b('0xac'),_0x21382f[_0x711b('0x25')],_0x711b('0xe3'),_0x21382f[_0x711b('0x53')]);_0x3c0933(_0x595611);})[_0x711b('0x6f')](function(_0x189a90){ut[_0x711b('0xe8')](_0xeb9ca7,0xe,'OriginateError');rpcDb[_0x711b('0xeb')](_0xeb9ca7,_0x711b('0x131'));_0xa2a59(_0x189a90);});});};Preview[_0x711b('0xf')]['syncNewExten']=function(_0x55e7d4){if(this[_0x711b('0x67')][_0x55e7d4[_0x711b('0xa7')]]){this['actions'][_0x55e7d4['linkedid']]['channel']=_0x55e7d4['channel'];}};Preview[_0x711b('0xf')][_0x711b('0x132')]=function(_0x217b38){var _0x570904=this;var _0xf6edef=this[_0x711b('0x67')][_0x217b38[_0x711b('0x133')]];if(_0xf6edef){if(_0xf6edef['lookAgent']&&this[_0x711b('0x15')][_0xf6edef['lookAgent']]){ut['logLookAgent'](_0xf6edef,this[_0x711b('0x15')][_0xf6edef[_0x711b('0x134')]][_0x711b('0x25')],this[_0x711b('0x15')][_0xf6edef['lookAgent']]['id']);}var _0x5cbf29=_[_0x711b('0x135')](_0xf6edef);_0x5cbf29[_0x711b('0x136')]=moment()['format'](_0x711b('0x87'));var _0x3cc74a=_0x570904[_0x711b('0x13')][_0xf6edef[_0x711b('0x68')]];if(ut[_0x711b('0x137')](_0x217b38['response'])){if(_0xf6edef[_0x711b('0xa5')]){rpcDb['unlockContact'](_0xf6edef[_0x711b('0xfb')]);}if(_0xf6edef['activeContact']){rpcDb[_0x711b('0x84')](_0xf6edef['idContact']);}ami['emit']('custom:agentringnoanswer',ut[_0x711b('0xaf')](_0xf6edef,_0x711b('0x138')));this[_0x711b('0x139')](_0x5cbf29,_0x3cc74a,_0x217b38);}else{_0xf6edef[_0x711b('0x85')]=moment()[_0x711b('0x86')](_0x711b('0x87'));ut[_0x711b('0xe8')](_0x5cbf29,0x4,_0x711b('0xb7'));rpcDb[_0x711b('0xeb')](_0x5cbf29,_0x711b('0x13a'));}}};Preview[_0x711b('0xf')][_0x711b('0x1a')]=function(_0xb77b24){var _0xb05d=this;var _0x289d69=this[_0x711b('0x67')][_0xb77b24[_0x711b('0xa7')]];var _0x186ec9;if(_0x289d69){_0x186ec9=this[_0x711b('0x13')][_0x289d69[_0x711b('0x68')]];logger['info'](_0x711b('0x13b'),_0xb77b24['linkedid'],_0x711b('0xac'),_0x186ec9['name'],_0x711b('0x69'),_0x186ec9[_0x711b('0x54')]);}if(this[_0x711b('0x67')][_0xb77b24[_0x711b('0xa7')]]&&_0xb77b24[_0x711b('0xa7')]!==_0xb77b24[_0x711b('0xab')]){if(_0xb77b24[_0x711b('0x13c')]==='16'&&this[_0x711b('0x67')][_0xb77b24[_0x711b('0xa7')]][_0x711b('0x6a')]){this[_0x711b('0x98')](_0xb77b24,_0xb77b24[_0x711b('0xa7')],_0xb77b24['cause']);}else if(this[_0x711b('0x67')][_0xb77b24[_0x711b('0xa7')]][_0x711b('0x6a')]){logger[_0x711b('0x76')]('[syncHangup][talking][cause]',_0xb77b24[_0x711b('0xa7')],_0xb77b24[_0x711b('0x13c')],_0x711b('0xac'),_0x186ec9[_0x711b('0x25')],_0x711b('0x69'),_0x186ec9['pTalking']);this[_0x711b('0x98')](_0xb77b24,_0xb77b24[_0x711b('0xa7')],_0xb77b24[_0x711b('0x13c')]);}}else if(_0x289d69&&_[_0x711b('0x66')](_0x289d69[_0x711b('0x13d')])&&_0x186ec9[_0x711b('0x13e')]&&_0xb77b24['linkedid']===_0xb77b24[_0x711b('0xab')]&&_[_0x711b('0x66')](_0xb77b24['reason'])&&_0xb77b24['cause']==='16'&&_0xb77b24[_0x711b('0x13f')]==='6'&&_[_0x711b('0xe5')](_0x289d69[_0x711b('0x140')])){if(_0x289d69[_0x711b('0xa5')]){rpcDb['unlockContact'](_0x289d69[_0x711b('0xfb')]);}if(_0x289d69[_0x711b('0xa6')]){rpcDb[_0x711b('0x84')](_0x289d69['idContact']);}_0xb77b24['reason']='22';this[_0x711b('0x139')](_0x289d69,_0x186ec9,_0xb77b24);}else if(_0x289d69&&_0x289d69['transfer']){if(_0xb77b24['cause']==='16'&&this[_0x711b('0x67')][_0xb77b24[_0x711b('0xa7')]][_0x711b('0x6a')]){logger[_0x711b('0x76')](_0x711b('0x141'),_0xb77b24[_0x711b('0xa7')],_0xb77b24['cause'],_0x711b('0xac'),_0x186ec9[_0x711b('0x25')],'pTalking:\x20',_0x186ec9[_0x711b('0x54')]);this['callProgressDetectingCustomer'](_0xb77b24,_0xb77b24[_0x711b('0xa7')],_0xb77b24[_0x711b('0x13c')]);}else if(this[_0x711b('0x67')][_0xb77b24['linkedid']][_0x711b('0x6a')]){logger[_0x711b('0x76')](_0x711b('0x142'),_0xb77b24[_0x711b('0xa7')],_0xb77b24[_0x711b('0x13c')],_0x711b('0xac'),_0x186ec9['name'],_0x711b('0x69'),_0x186ec9[_0x711b('0x54')]);this[_0x711b('0x98')](_0xb77b24,_0xb77b24[_0x711b('0xa7')],_0xb77b24[_0x711b('0x13c')]);}}};Preview[_0x711b('0xf')][_0x711b('0x1d')]=function(_0x3139ba){if(this[_0x711b('0x67')][_0x3139ba[_0x711b('0xe4')]]&&_0x3139ba[_0x711b('0xe4')]!==_0x3139ba[_0x711b('0x143')]){this[_0x711b('0x98')](_0x3139ba,_0x3139ba[_0x711b('0xe4')],_0x3139ba[_0x711b('0xde')]);}};Preview['prototype'][_0x711b('0x1b')]=function(_0x42082){if(this[_0x711b('0x67')][_0x42082[_0x711b('0xa7')]]&&_0x42082[_0x711b('0xa7')]!==_0x42082[_0x711b('0xab')]&&!this[_0x711b('0x67')][_0x42082['linkedid']][_0x711b('0x6a')]){if(_0x42082[_0x711b('0x13c')]==='1'){this[_0x711b('0x98')](_0x42082,_0x42082[_0x711b('0xa7')],_0x42082[_0x711b('0x13c')]);}}};Preview[_0x711b('0xf')][_0x711b('0x144')]=function(_0x23da26,_0x997d50,_0x1b02a0){if(this['actions'][_0x23da26]){if(_['isNil'](this['actions'][_0x23da26][_0x711b('0x145')])){this[_0x711b('0x67')][_0x23da26][_0x711b('0x145')]={};}this['actions'][_0x23da26][_0x711b('0x145')][_0x997d50]=_0x1b02a0;}};Preview[_0x711b('0xf')]['syncVarSet']=function(_0x111a99){try{if(!_['isNil'](_0x111a99)){if(ut['filterKey'](_[_0x711b('0x146')](_0x111a99[_0x711b('0x147')])[0x0])){this['addVariable'](_0x111a99[_0x711b('0xab')],_[_0x711b('0x146')](_0x111a99['variable'])[0x0],_0x111a99[_0x711b('0x148')]);}}}catch(_0x27f4b4){logger['error'](_0x711b('0x149'),util[_0x711b('0x14a')](_0x27f4b4,{'showHidden':![],'depth':null}));}};Preview['prototype']['syncAttendedTransfer']=function(_0x1e7755){if(_0x1e7755){if(this[_0x711b('0x67')][_0x1e7755[_0x711b('0x14b')]]){this[_0x711b('0x67')][_0x1e7755[_0x711b('0x14b')]][_0x711b('0x140')]=!![];}}};Preview['prototype']['syncBlindTransfer']=function(_0x21f779){if(_0x21f779){if(this[_0x711b('0x67')][_0x21f779['transfererlinkedid']]){this['actions'][_0x21f779[_0x711b('0x14c')]][_0x711b('0x140')]=!![];}}};module[_0x711b('0x14d')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 298f3d0..fe68015 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 _0xa41a=['queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util','bluebird','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','resolve','createHistory','catch','[createHistory]\x20','then','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','active','countReScheduled','unlockContact','disableContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','answertime','connectedlinename','membername','context','from-sip','xcally-motion-preview','holdtime','assigned'];(function(_0x44e6fd,_0x25a37a){var _0x11e582=function(_0x4a0271){while(--_0x4a0271){_0x44e6fd['push'](_0x44e6fd['shift']());}};_0x11e582(++_0x25a37a);}(_0xa41a,0x6b));var _0xaa41=function(_0x530bee,_0x17c5b8){_0x530bee=_0x530bee-0x0;var _0x456c4b=_0xa41a[_0x530bee];return _0x456c4b;};'use strict';var util=require(_0xaa41('0x0'));var BPromise=require(_0xaa41('0x1'));var logger=require('../../../config/logger')(_0xaa41('0x2'));var _=require(_0xaa41('0x3'));var cmHopper=require(_0xaa41('0x4'));var cmHopperFinal=require(_0xaa41('0x5'));var cmHopperHistory=require(_0xaa41('0x6'));var cmHopperBlack=require(_0xaa41('0x7'));var voiceQueueRt=require(_0xaa41('0x8'));var agentReportPreview=require(_0xaa41('0x9'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x2122a0){return function(_0x1ec9d4){logger['error'](_0x2122a0,util['inspect'](_0x1ec9d4,{'showHidden':![],'depth':null}));};}function create(_0x179545){return BPromise[_0xaa41('0xa')]()['then'](cmHopperHistory[_0xaa41('0xb')](_0x179545))[_0xaa41('0xc')](loggerCatch(_0xaa41('0xd')));}function createAgent(_0x1cc344){return BPromise[_0xaa41('0xa')]()[_0xaa41('0xe')](agentReportPreview[_0xaa41('0xb')](_0x1cc344))[_0xaa41('0xc')](loggerCatch(_0xaa41('0xd')));}function moveContact(_0x5c9fc7){return BPromise[_0xaa41('0xa')]()[_0xaa41('0xe')](cmHopper['moveContactManagedDialer'](_0x5c9fc7,!![]))['catch'](loggerCatch(_0xaa41('0xf')));}exports['checkIsBlackList']=function(_0x19bd69){return BPromise[_0xaa41('0xa')]()[_0xaa41('0xe')](cmHopperBlack[_0xaa41('0x10')](_0x19bd69))[_0xaa41('0xc')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0xaa41('0x11')]=function(_0x178170){return BPromise[_0xaa41('0xa')]()[_0xaa41('0xe')](cmHopper[_0xaa41('0x11')](_0x178170))[_0xaa41('0xc')](loggerCatch(_0xaa41('0x12')));};exports['createHistory']=function(_0x2d868a,_0x16b930){create(_0x2d868a)[_0xaa41('0xc')](loggerCatch(_0x16b930));moveContact(_0x2d868a)[_0xaa41('0xc')](loggerCatch(_0x16b930));};exports[_0xaa41('0x13')]=function(_0xd20ddf,_0x29efe5){createAgent(_0xd20ddf)[_0xaa41('0xc')](loggerCatch(_0x29efe5));};exports[_0xaa41('0x14')]=function(_0x4fe1a4,_0x5cd936){create(_0x4fe1a4)[_0xaa41('0xc')](loggerCatch(_0x5cd936));};exports[_0xaa41('0x15')]=function(_0x35c753,_0x54c488){moveContact(_0x35c753)[_0xaa41('0xc')](loggerCatch(_0x54c488));};exports[_0xaa41('0x16')]=function(_0x4e768e,_0x513c61,_0x1b1910){if(_0x513c61){_0x4e768e['UserId']=null;}if(_0x1b1910){_0x4e768e[_0xaa41('0x17')]=![];}return BPromise[_0xaa41('0xa')]()[_0xaa41('0xe')](cmHopper[_0xaa41('0x16')](_0x4e768e))[_0xaa41('0xc')](loggerCatch('[rescheduleContact]\x20'));};exports[_0xaa41('0x18')]=function(_0x43a85c){return BPromise[_0xaa41('0xa')]()[_0xaa41('0xe')](cmHopper[_0xaa41('0x18')](_0x43a85c))[_0xaa41('0xc')](loggerCatch('[countReScheduled]\x20'));};exports['unlockContact']=function(_0x16aec5){return BPromise['resolve']()['then'](cmHopper[_0xaa41('0x19')]({'UserId':null},_0x16aec5,0x1))['catch'](loggerCatch('[unlockContact]\x20'));};exports[_0xaa41('0x1a')]=function(_0x9c8c21){return BPromise[_0xaa41('0xa')]()[_0xaa41('0xe')](cmHopper[_0xaa41('0x19')]({'active':![]},_0x9c8c21,0x1))[_0xaa41('0xc')](loggerCatch('[activeContact]\x20'));};exports[_0xaa41('0x1b')]=function(_0x1f0275){var _0x63c18c={};_0x63c18c[_0xaa41('0x1c')]=_0x1f0275[_0xaa41('0x1c')];_0x63c18c[_0xaa41('0x1d')]=_0x1f0275[_0xaa41('0x1d')];_0x63c18c[_0xaa41('0x1e')]=_0x1f0275['calleridnum'];_0x63c18c[_0xaa41('0x1f')]=_0x1f0275['calleridname'];_0x63c18c['queue']=_0x1f0275[_0xaa41('0x20')];_0x63c18c[_0xaa41('0x21')]=_0x1f0275['answertime'];_0x63c18c[_0xaa41('0x22')]=_0x1f0275[_0xaa41('0x23')];_0x63c18c['queuecallercomplete']=0x1;_0x63c18c['queuecallercompleteAt']=_0x1f0275['endtime'];_0x63c18c[_0xaa41('0x24')]=_0x1f0275[_0xaa41('0x25')];_0x63c18c[_0xaa41('0x26')]=_0xaa41('0x27');_0x63c18c['exten']=_0xaa41('0x28');_0x63c18c[_0xaa41('0x29')]=0x0;_0x63c18c[_0xaa41('0x2a')]=0x1;_0x63c18c['lastAssignedTo']=_0x1f0275[_0xaa41('0x25')];_0x63c18c[_0xaa41('0x2b')]=_0xaa41('0x2c');return BPromise['resolve']()[_0xaa41('0xe')](voiceQueueReport[_0xaa41('0x2d')](_0x63c18c))['catch'](loggerCatch(_0xaa41('0x2e')));};exports[_0xaa41('0x2f')]=function(_0x2298ed,_0x5cec87){return BPromise[_0xaa41('0xa')]()['then'](cmHopper[_0xaa41('0x2f')](_0x2298ed,_0x5cec87))[_0xaa41('0xc')](loggerCatch(_0xaa41('0x30')));};exports['rescheduleContactInQueue']=function(_0x526377){return BPromise['resolve']()[_0xaa41('0xe')](cmHopper[_0xaa41('0x16')](_0x526377,!![],!![]))[_0xaa41('0xc')](loggerCatch(_0xaa41('0x31')));}; \ No newline at end of file +var _0x7da7=['../rpc/voiceQueueRt','../rpc/voiceQueueReport','error','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','util','bluebird','../../../config/logger','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack'];(function(_0x435044,_0x36ab8e){var _0x33d4c6=function(_0x15efa0){while(--_0x15efa0){_0x435044['push'](_0x435044['shift']());}};_0x33d4c6(++_0x36ab8e);}(_0x7da7,0x10d));var _0x77da=function(_0x2adfb1,_0x406e6e){_0x2adfb1=_0x2adfb1-0x0;var _0xa52d45=_0x7da7[_0x2adfb1];return _0xa52d45;};'use strict';var util=require(_0x77da('0x0'));var BPromise=require(_0x77da('0x1'));var logger=require(_0x77da('0x2'))('preview');var _=require('lodash');var cmHopper=require(_0x77da('0x3'));var cmHopperFinal=require(_0x77da('0x4'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x77da('0x5'));var voiceQueueRt=require(_0x77da('0x6'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x77da('0x7'));function loggerCatch(_0xc54a12){return function(_0x47da81){logger[_0x77da('0x8')](_0xc54a12,util['inspect'](_0x47da81,{'showHidden':![],'depth':null}));};}function create(_0x1191de){return BPromise[_0x77da('0x9')]()[_0x77da('0xa')](cmHopperHistory[_0x77da('0xb')](_0x1191de))[_0x77da('0xc')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x40c86e){return BPromise[_0x77da('0x9')]()[_0x77da('0xa')](agentReportPreview['createHistory'](_0x40c86e))[_0x77da('0xc')](loggerCatch(_0x77da('0xd')));}function moveContact(_0x163350){return BPromise[_0x77da('0x9')]()['then'](cmHopper[_0x77da('0xe')](_0x163350,!![]))[_0x77da('0xc')](loggerCatch(_0x77da('0xf')));}exports['checkIsBlackList']=function(_0x4a7748){return BPromise[_0x77da('0x9')]()[_0x77da('0xa')](cmHopperBlack['checkIsBlackList'](_0x4a7748))[_0x77da('0xc')](loggerCatch(_0x77da('0x10')));};exports[_0x77da('0x11')]=function(_0x3c87c2){return BPromise['resolve']()[_0x77da('0xa')](cmHopper['getContactPreview'](_0x3c87c2))[_0x77da('0xc')](loggerCatch(_0x77da('0x12')));};exports[_0x77da('0xb')]=function(_0x4500c4,_0x4ecd98){create(_0x4500c4)['catch'](loggerCatch(_0x4ecd98));moveContact(_0x4500c4)['catch'](loggerCatch(_0x4ecd98));};exports['createAgentHistory']=function(_0x103e46,_0x295bef){createAgent(_0x103e46)[_0x77da('0xc')](loggerCatch(_0x295bef));};exports[_0x77da('0x13')]=function(_0x19a00c,_0x12d2b1){create(_0x19a00c)[_0x77da('0xc')](loggerCatch(_0x12d2b1));};exports[_0x77da('0x14')]=function(_0x544104,_0x492063){moveContact(_0x544104)[_0x77da('0xc')](loggerCatch(_0x492063));};exports[_0x77da('0x15')]=function(_0x507979,_0x45a122,_0x304a2b){if(_0x45a122){_0x507979[_0x77da('0x16')]=null;}if(_0x304a2b){_0x507979['active']=![];}return BPromise['resolve']()[_0x77da('0xa')](cmHopper['rescheduleContact'](_0x507979))[_0x77da('0xc')](loggerCatch(_0x77da('0x17')));};exports[_0x77da('0x18')]=function(_0x27b6c7){return BPromise[_0x77da('0x9')]()[_0x77da('0xa')](cmHopper[_0x77da('0x18')](_0x27b6c7))['catch'](loggerCatch('[countReScheduled]\x20'));};exports[_0x77da('0x19')]=function(_0x2d009f){return BPromise[_0x77da('0x9')]()[_0x77da('0xa')](cmHopper['unlockContact']({'UserId':null},_0x2d009f,0x1))[_0x77da('0xc')](loggerCatch(_0x77da('0x1a')));};exports[_0x77da('0x1b')]=function(_0x36115b){return BPromise[_0x77da('0x9')]()['then'](cmHopper[_0x77da('0x19')]({'active':![]},_0x36115b,0x1))[_0x77da('0xc')](loggerCatch(_0x77da('0x1c')));};exports[_0x77da('0x1d')]=function(_0x496ecd){var _0x5b4638={};_0x5b4638['type']=_0x496ecd[_0x77da('0x1e')];_0x5b4638[_0x77da('0x1f')]=_0x496ecd[_0x77da('0x1f')];_0x5b4638[_0x77da('0x20')]=_0x496ecd[_0x77da('0x20')];_0x5b4638['calleridname']=_0x496ecd[_0x77da('0x21')];_0x5b4638[_0x77da('0x22')]=_0x496ecd[_0x77da('0x22')];_0x5b4638[_0x77da('0x23')]=_0x496ecd[_0x77da('0x24')];_0x5b4638[_0x77da('0x25')]=_0x496ecd['answertime'];_0x5b4638[_0x77da('0x26')]=0x1;_0x5b4638[_0x77da('0x27')]=_0x496ecd[_0x77da('0x28')];_0x5b4638[_0x77da('0x29')]=_0x496ecd[_0x77da('0x2a')];_0x5b4638[_0x77da('0x2b')]=_0x77da('0x2c');_0x5b4638[_0x77da('0x2d')]='xcally-motion-preview';_0x5b4638['holdtime']=0x0;_0x5b4638[_0x77da('0x2e')]=0x1;_0x5b4638[_0x77da('0x2f')]=_0x496ecd['membername'];_0x5b4638[_0x77da('0x30')]=_0x77da('0x31');return BPromise[_0x77da('0x9')]()[_0x77da('0xa')](voiceQueueReport[_0x77da('0x32')](_0x5b4638))[_0x77da('0xc')](loggerCatch(_0x77da('0x33')));};exports['getContactRecallMe']=function(_0x42e4a9,_0x4df4b9){return BPromise['resolve']()['then'](cmHopper[_0x77da('0x34')](_0x42e4a9,_0x4df4b9))['catch'](loggerCatch(_0x77da('0x35')));};exports[_0x77da('0x36')]=function(_0xce9df2){return BPromise[_0x77da('0x9')]()[_0x77da('0xa')](cmHopper[_0x77da('0x15')](_0xce9df2,!![],!![]))[_0x77da('0xc')](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 3b4752b..6b5f9b0 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 _0xf108=['interface','channelAgent','buildAcw','hasOwnProperty','not_inuse','status','reachable','push','getDiff','createBody','CampaignId','filterKey','type','campaigntype','dialAnswer','membername','calleridname','scheduledat','countcongestionretry','countglobal','callback','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-cdrtype','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','moment','../../../../config/logger','preview','milliseconds','diff','seconds','loggerCatch','inspect','logger','info','loggerError','error','logger2','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','isNil','addVariables','Queue','ContactId','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_UNIQUEID','Contact','tags','createdAt','updatedAt','%s%s','XMD-','toLowerVariables','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','state','Blacklist','responsetime','logAgent','YYYY-MM-DD\x20HH:mm:ss','ringtime','starttime','logLookAgent','UserId','logCustomer','statedesc','endtime','answertime','isFailure','Failure','variablesAction','RECALL','uniqueid','originate','calleridnum','from-sip','timeout','totalGlobal','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','active','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','name','queue'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xf108,0x1d9));var _0x8f10=function(_0x3994b3,_0x162e22){_0x3994b3=_0x3994b3-0x0;var _0x3e0325=_0xf108[_0x3994b3];return _0x3e0325;};'use strict';var util=require(_0x8f10('0x0'));var _=require('lodash');var moment=require(_0x8f10('0x1'));var logger=require(_0x8f10('0x2'))(_0x8f10('0x3'));var ipAgi=process['env']['XCALLY_IP_AGI']||'127.0.0.1';function getSeconds(_0x440ee7,_0x12a726){var _0x511ab7=moment(_0x440ee7)[_0x8f10('0x4')](0x0);var _0x2e3419=moment(_0x12a726)[_0x8f10('0x4')](0x0);return _0x511ab7[_0x8f10('0x5')](_0x2e3419,_0x8f10('0x6'));}exports[_0x8f10('0x7')]=function(_0x22e5df){return function(_0x3a5d06){logger['error'](_0x22e5df,util[_0x8f10('0x8')](_0x3a5d06,{'showHidden':![],'depth':null}));};};exports[_0x8f10('0x9')]=function(_0x1bbe48,_0x1d863a){logger[_0x8f10('0xa')](_0x1bbe48,util[_0x8f10('0x8')](_0x1d863a,{'showHidden':![],'depth':null}));};exports[_0x8f10('0xb')]=function(_0x3ebfd4,_0x440f86){logger[_0x8f10('0xc')](_0x3ebfd4,util[_0x8f10('0x8')](_0x440f86,{'showHidden':![],'depth':null}));};exports[_0x8f10('0xd')]=function(_0x236b4b){return function(_0x170036){logger[_0x8f10('0xa')](_0x236b4b,util['inspect'](_0x170036,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x22ad7e,_0x455d66,_0x472b6f){return{'message':_0x22ad7e,'unlock':_0x455d66,'active':_0x472b6f};};exports[_0x8f10('0xe')]=function(_0x1eaced,_0x1126c5,_0x34952c){if(!_[_0x8f10('0xf')](_0x34952c)&&_0x8f10('0x10')===typeof _0x34952c&&!_['isEmpty'](_0x34952c)){if(!_[_0x8f10('0xf')](_0x1126c5)&&_0x8f10('0x10')===typeof _0x1126c5&&!_[_0x8f10('0x11')](_0x1126c5)){return util['format'](_0x8f10('0x12'),_0x1126c5,_0x34952c);}return util[_0x8f10('0x13')]('\x22%s\x22\x20<%s>',_0x34952c,_0x34952c);}if(!_[_0x8f10('0xf')](_0x1eaced)&&_0x8f10('0x10')===typeof _0x1eaced&&!_[_0x8f10('0x11')](_0x1eaced)){return _0x1eaced;}return _0x8f10('0x14');};exports['isActive']=function(_0x56aa3f){if(_[_0x8f10('0x15')](_0x56aa3f)){return![];}return _0x56aa3f;};exports[_0x8f10('0x16')]=function(_0x3a6165,_0x34d6be,_0x301775,_0xfdb66e,_0x468fa9,_0x3fc95d){var _0x7bde34={'XMD-QUEUE':_0x34d6be[_0x8f10('0x17')]?_0x34d6be[_0x8f10('0x17')]['name']:'','XMD-CALLERID':_0xfdb66e,'XMD-CALLERID-PREVIEW':_0x3fc95d?util[_0x8f10('0x13')]('\x22%s\x22\x20<%s>',_0x3fc95d['calleridname'],_0x3fc95d['calleridnum']):_0xfdb66e,'XMD-DIALID':_0x468fa9,'XMD-CONTACTID':_0x34d6be[_0x8f10('0x18')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0xfdb66e,'XMD-VOICEQUEUEID':_0x34d6be[_0x8f10('0x19')],'XMD-DIALCHANNEL':_0x301775,'XMD-DIALTIMEOUT':_0x3a6165[_0x8f10('0x1a')]||0x1e,'XMD-DIALOPTIONS':util[_0x8f10('0x13')](_0x8f10('0x1b'),_0x3a6165[_0x8f10('0x1c')]?'g':'',_[_0x8f10('0x11')](_0x3a6165[_0x8f10('0x1d')])?'':_0x8f10('0x1e')),'XMD-DIALURL':_0x3a6165[_0x8f10('0x1f')]||'','XMD-AGI':_0x3a6165[_0x8f10('0x20')]?util[_0x8f10('0x13')](_0x8f10('0x21'),ipAgi,_0x3a6165[_0x8f10('0x20')]):_0x8f10('0x22'),'XMD-AGIAFTER':_0x3a6165['dialQueueProject2']?util[_0x8f10('0x13')](_0x8f10('0x21'),ipAgi,_0x3a6165['dialQueueProject2']):'NONE','XMD-ORIGINATECALLERIDNUM':_0x3fc95d?_0x3fc95d['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x3fc95d?_0x3fc95d[_0x8f10('0x23')]:'','XMD-DESTINATION':_0x8f10('0x24')};if(!_[_0x8f10('0x11')](_0x3a6165[_0x8f10('0x1d')])){_0x7bde34[util[_0x8f10('0x13')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x3a6165[_0x8f10('0x1d')];_0x7bde34[util['format']('%s',_0x8f10('0x25'))]=_0x468fa9;}if(_0x34d6be&&_0x34d6be[_0x8f10('0x26')]){for(var _0x429a99 in _0x34d6be['Contact']){if(_0x34d6be[_0x8f10('0x26')]['hasOwnProperty'](_0x429a99)){if(!_['isNil'](_0x34d6be[_0x8f10('0x26')][_0x429a99])&&_0x429a99!=='id'&&_0x429a99!==_0x8f10('0x27')&&_0x429a99!==_0x8f10('0x28')&&_0x429a99!==_0x8f10('0x29')){_0x7bde34[util[_0x8f10('0x13')](_0x8f10('0x2a'),_0x8f10('0x2b'),_['toUpper'](_0x429a99))]=_0x34d6be['Contact'][_0x429a99];}}}}return _0x7bde34;};exports[_0x8f10('0x2c')]=function(_0x57ecb0){var _0x38364b={};for(var _0x16ea79 in _0x57ecb0){if(_0x57ecb0['hasOwnProperty'](_0x16ea79)){_0x38364b[util['format']('%s',_[_0x8f10('0x2d')](_0x16ea79))]=_0x57ecb0[_0x16ea79];}}return{'variables':_0x38364b};};exports['updateOriginated']=function(_0x37a86b,_0x557deb){if(!_[_0x8f10('0x15')](_0x37a86b)){if(_0x37a86b['hasOwnProperty']('originated')){if(_0x37a86b[_0x8f10('0x2e')]>0x0){_0x37a86b['originated']-=0x1;}else{logger[_0x8f10('0xc')](_0x8f10('0x2f'),_0x557deb);}}}else{logger[_0x8f10('0xc')](_0x8f10('0x30'),_0x557deb);}};exports[_0x8f10('0x31')]=function(_0x4d48a9){var _0x2cd50e=moment()[_0x8f10('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x4d48a9[_0x8f10('0x32')]=0xd;_0x4d48a9['statedesc']=_0x8f10('0x33');_0x4d48a9['starttime']=_0x2cd50e;_0x4d48a9[_0x8f10('0x34')]=_0x2cd50e;_0x4d48a9['endtime']=_0x2cd50e;};exports[_0x8f10('0x35')]=function(_0x5d2fc7,_0x4b00ad,_0x18168a){var _0x5b1372=moment()[_0x8f10('0x13')](_0x8f10('0x36'));_0x5d2fc7[_0x8f10('0x32')]=_0x4b00ad;_0x5d2fc7['statedesc']=_0x18168a;_0x5d2fc7[_0x8f10('0x34')]=_0x5b1372;_0x5d2fc7[_0x8f10('0x37')]=getSeconds(_0x5d2fc7[_0x8f10('0x34')],_0x5d2fc7[_0x8f10('0x38')]);};exports[_0x8f10('0x39')]=function(_0x21d166,_0x236ad6,_0x7e540){_0x21d166['membername']=_0x236ad6;_0x21d166[_0x8f10('0x3a')]=_0x7e540;};exports[_0x8f10('0x3b')]=function(_0x529a6b,_0x1bdc54,_0x4c41bd){var _0x7eb2f1=moment()[_0x8f10('0x13')](_0x8f10('0x36'));_0x529a6b[_0x8f10('0x32')]=_0x1bdc54;_0x529a6b[_0x8f10('0x3c')]=_0x4c41bd;_0x529a6b[_0x8f10('0x34')]=_0x529a6b[_0x8f10('0x34')]?_0x529a6b[_0x8f10('0x34')]:_0x7eb2f1;_0x529a6b[_0x8f10('0x3d')]=_0x529a6b[_0x8f10('0x3d')]?_0x529a6b[_0x8f10('0x3d')]:_0x7eb2f1;_0x529a6b[_0x8f10('0x37')]=getSeconds(_0x529a6b[_0x8f10('0x34')]||0x0,_0x529a6b[_0x8f10('0x38')]||0x0);_0x529a6b['talktime']=_0x529a6b[_0x8f10('0x3e')]?getSeconds(_0x529a6b[_0x8f10('0x3d')],_0x529a6b['answertime']):0x0;};exports[_0x8f10('0x3f')]=function(_0x8309c1){return _0x8309c1===_0x8f10('0x40');};exports[_0x8f10('0x41')]=function(_0x982918,_0x134fed,_0x390ad6,_0x4ba4af,_0x42e0ad){var _0x24f320=_0x4ba4af?_0x8f10('0x42'):_0x982918['calleridname'];_0x24f320=_0x42e0ad?'BOOKED':_0x24f320;return{'actionid':_0x982918[_0x8f10('0x43')],'action':_0x8f10('0x44'),'channel':_0x982918['channelAgent'],'callerid':util[_0x8f10('0x13')](_0x8f10('0x12'),_0x24f320,_0x982918[_0x8f10('0x45')]),'Exten':_0x8f10('0x24'),'Context':_0x8f10('0x46'),'Priority':'1','variable':_0x390ad6,'timeout':(_0x134fed[_0x8f10('0x47')]||0x1e)*0x3e8,'async':!![],'channelid':_0x982918['uniqueid']};};exports[_0x8f10('0x48')]=function(_0x243982){return _0x243982[_0x8f10('0x49')]+_0x243982['countcongestionretry']+_0x243982[_0x8f10('0x4a')]+_0x243982[_0x8f10('0x4b')]+_0x243982[_0x8f10('0x4c')];};exports[_0x8f10('0x4d')]=function(_0x488b2d){var _0x190f91=_[_0x8f10('0x4e')](_0x488b2d);_0x190f91['state']=0xf;_0x190f91[_0x8f10('0x3c')]='Global';return _0x190f91;};exports['scheduledAt']=function(_0x414b4b,_0x351b47,_0x268275){var _0x362ce3={};_0x362ce3[_0x351b47]=_0x414b4b[_0x351b47];_0x362ce3[_0x8f10('0x4f')]=![];_0x362ce3['scheduledat']=moment()[_0x8f10('0x50')](_0x268275,_0x8f10('0x51'))[_0x8f10('0x13')](_0x8f10('0x36'));_0x362ce3[_0x8f10('0x18')]=_0x414b4b[_0x8f10('0x18')];_0x362ce3[_0x8f10('0x52')]=_0x414b4b[_0x8f10('0x52')];_0x362ce3[_0x8f10('0x19')]=_0x414b4b[_0x8f10('0x19')]||undefined;return _0x362ce3;};exports[_0x8f10('0x53')]=function(_0x452276,_0x16ada8){if(!_['isNil'](_0x452276)){if(_0x452276[_0x8f10('0x54')]>0x0){_0x452276[_0x8f10('0x54')]-=0x1;}else{logger[_0x8f10('0xc')](_0x16ada8,_0x8f10('0x55'));}}else{logger[_0x8f10('0xc')](_0x16ada8,_0x8f10('0x56'));}};exports[_0x8f10('0x57')]=function(_0x34eb2c){if(_0x34eb2c<=0x0){return!![];}return![];};exports[_0x8f10('0x58')]=function(_0x205140,_0x2dc85a){_0x205140['lastevent']=_0x2dc85a;_0x205140[_0x8f10('0x59')]=_0x205140[_0x8f10('0x5a')];_0x205140[_0x8f10('0x5b')]=_0x205140[_0x8f10('0x5c')];return _0x205140;};exports[_0x8f10('0x5d')]=function(_0x560aa4){var _0x5d6a24={};_0x5d6a24[_0x8f10('0x5a')]=_0x560aa4[_0x8f10('0x5a')];_0x5d6a24[_0x8f10('0x5b')]=_0x560aa4[_0x8f10('0x5c')];_0x5d6a24[_0x8f10('0x43')]=_0x560aa4[_0x8f10('0x43')];return _0x5d6a24;};exports['agentReadyId']=function(_0x189106){var _0xc73b90=[];for(var _0x152275 in _0x189106){if(_0x189106[_0x8f10('0x5e')](_0x152275)){if(!_[_0x8f10('0x15')](_0x189106[_0x152275])&&_0x189106[_0x152275][_0x8f10('0x32')]===_0x8f10('0x5f')&&_0x189106[_0x152275][_0x8f10('0x60')]===_0x8f10('0x61')){_0xc73b90[_0x8f10('0x62')](_0x189106[_0x152275]['id']);}}}return _0xc73b90;};exports[_0x8f10('0x63')]=function(_0x2b7eea){var _0x2c2c8d=moment()[_0x8f10('0x4')](0x0);var _0x41bdd7=moment(_0x2b7eea)[_0x8f10('0x4')](0x0);return _0x2c2c8d['diff'](_0x41bdd7,_0x8f10('0x6'));};exports[_0x8f10('0x64')]=function(_0x56304e){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x56304e[_0x8f10('0x18')],'ListId':_0x56304e[_0x8f10('0x52')],'VoiceQueueId':_0x56304e[_0x8f10('0x19')]||undefined,'CampaignId':_0x56304e[_0x8f10('0x65')]||undefined};};exports[_0x8f10('0x66')]=function(_0x57b2aa){if(_0x57b2aa===_0x8f10('0x43')||_0x57b2aa==='idContact'||_0x57b2aa===_0x8f10('0x5a')||_0x57b2aa===_0x8f10('0x67')||_0x57b2aa===_0x8f10('0x68')||_0x57b2aa===_0x8f10('0x69')||_0x57b2aa===_0x8f10('0x6a')||_0x57b2aa==='channelAgent'||_0x57b2aa===_0x8f10('0x6b')||_0x57b2aa===_0x8f10('0x4f')||_0x57b2aa===_0x8f10('0x45')||_0x57b2aa===_0x8f10('0x6c')||_0x57b2aa===_0x8f10('0x49')||_0x57b2aa===_0x8f10('0x6d')||_0x57b2aa===_0x8f10('0x4a')||_0x57b2aa===_0x8f10('0x6e')||_0x57b2aa===_0x8f10('0x6f')||_0x57b2aa==='callbackuniqueid'||_0x57b2aa===_0x8f10('0x70')||_0x57b2aa===_0x8f10('0x71')||_0x57b2aa===_0x8f10('0x18')||_0x57b2aa===_0x8f10('0x52')||_0x57b2aa==='UserId'||_0x57b2aa===_0x8f10('0x19')||_0x57b2aa===_0x8f10('0x72')||_0x57b2aa===_0x8f10('0x73')||_0x57b2aa===_0x8f10('0x74')||_0x57b2aa===_0x8f10('0x75')||_0x57b2aa===_0x8f10('0x76')||_0x57b2aa===_0x8f10('0x77')||_0x57b2aa==='xmd-dialtimeout'||_0x57b2aa===_0x8f10('0x78')||_0x57b2aa===_0x8f10('0x79')||_0x57b2aa==='xmd-dialchannel'||_0x57b2aa==='xmd-contactid'||_0x57b2aa===_0x8f10('0x7a')||_0x57b2aa==='xmd-callerid'||_0x57b2aa===_0x8f10('0x7b')||_0x57b2aa==='xmd-agi'||_0x57b2aa===_0x8f10('0x7c')||_0x57b2aa===_0x8f10('0x7d')||_0x57b2aa===_0x8f10('0x7e')||_0x57b2aa===_0x8f10('0x7f')||_0x57b2aa===_0x8f10('0x80')||_0x57b2aa===_0x8f10('0x81')||_0x57b2aa===_0x8f10('0x82')||_0x57b2aa===_0x8f10('0x83')||_0x57b2aa===_0x8f10('0x7c')||_0x57b2aa==='rtpaudioqosbridged'||_0x57b2aa==='rtpaudioqosjitter'||_0x57b2aa===_0x8f10('0x7f')||_0x57b2aa===_0x8f10('0x80')||_0x57b2aa===_0x8f10('0x81')||_0x57b2aa===_0x8f10('0x82')||_0x57b2aa===_0x8f10('0x83')||_0x57b2aa===_0x8f10('0x84')||_0x57b2aa===_0x8f10('0x85')||_0x57b2aa==='state'||_0x57b2aa===_0x8f10('0x3c')){return![];}return!![];};exports[_0x8f10('0x86')]=function(_0x34d660,_0x56d447){var _0x2a74e8,_0x2f4c93,_0x38a979;if(_0x56d447<=0x0){_0x56d447=0x1;}_0x2a74e8=new RegExp('\x5cw{0,'+_0x56d447+'}$');_0x2f4c93=Math[_0x8f10('0x87')](0xa,_0x56d447-0x1);_0x38a979=Math[_0x8f10('0x87')](0xa,_0x56d447)-0x1;return util[_0x8f10('0x13')]('%s',_[_0x8f10('0x88')](_0x34d660,_0x2a74e8,_[_0x8f10('0x89')](_0x2f4c93,_0x38a979)));};exports[_0x8f10('0x8a')]=function(_0x41ad72){var _0x18bdb6=_0x41ad72[_0x8f10('0x8b')](/"(.*?)"/);return _0x18bdb6?_0x18bdb6[0x1]:_0x41ad72;};exports[_0x8f10('0x8c')]=function(_0x549c8c){var _0x2ab8d8=_0x549c8c[_0x8f10('0x8b')](/<(.*?)>/);return _0x2ab8d8?_0x2ab8d8[0x1]:_0x549c8c;}; \ No newline at end of file +var _0xc4d8=['CampaignId','idContact','type','campaigntype','dialAnswer','countglobal','callback','callbackuniqueid','callbackat','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosbridged','rtpaudioqosrtt','bridgepeer','pow','extractCalleridName','match','extractCalleridNumber','util','moment','../../../../config/logger','XCALLY_IP_AGI','milliseconds','diff','seconds','loggerCatch','error','inspect','logger','loggerError','logger2','info','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','dialer','VoiceQueueId','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','tags','createdAt','updatedAt','toLowerVariables','toLower','updateOriginated','hasOwnProperty','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','starttime','responsetime','endtime','logAgent','ringtime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','Failure','variablesAction','BOOKED','uniqueid','originate','channelAgent','from-sip','totalGlobal','countbusyretry','countcongestionretry','countagentrejectretry','countnosuchnumberretry','clone','scheduledAt','active','scheduledat','add','minutes','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','interface','agentReadyId','not_inuse','status','getDiff'];(function(_0x5cc3d4,_0xbcbf9b){var _0x17ca31=function(_0x5dbd6d){while(--_0x5dbd6d){_0x5cc3d4['push'](_0x5cc3d4['shift']());}};_0x17ca31(++_0xbcbf9b);}(_0xc4d8,0xa6));var _0x8c4d=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xc4d8[_0x373dee];return _0x46798f;};'use strict';var util=require(_0x8c4d('0x0'));var _=require('lodash');var moment=require(_0x8c4d('0x1'));var logger=require(_0x8c4d('0x2'))('preview');var ipAgi=process['env'][_0x8c4d('0x3')]||'127.0.0.1';function getSeconds(_0x58a4db,_0x3ea55c){var _0x706828=moment(_0x58a4db)[_0x8c4d('0x4')](0x0);var _0xa1bc80=moment(_0x3ea55c)[_0x8c4d('0x4')](0x0);return _0x706828[_0x8c4d('0x5')](_0xa1bc80,_0x8c4d('0x6'));}exports[_0x8c4d('0x7')]=function(_0x3369b8){return function(_0x521b76){logger[_0x8c4d('0x8')](_0x3369b8,util[_0x8c4d('0x9')](_0x521b76,{'showHidden':![],'depth':null}));};};exports[_0x8c4d('0xa')]=function(_0x3ccfda,_0x4d9e0c){logger['info'](_0x3ccfda,util[_0x8c4d('0x9')](_0x4d9e0c,{'showHidden':![],'depth':null}));};exports[_0x8c4d('0xb')]=function(_0x38b109,_0x1cc3f8){logger[_0x8c4d('0x8')](_0x38b109,util[_0x8c4d('0x9')](_0x1cc3f8,{'showHidden':![],'depth':null}));};exports[_0x8c4d('0xc')]=function(_0x7c2f4a){return function(_0x50de53){logger[_0x8c4d('0xd')](_0x7c2f4a,util[_0x8c4d('0x9')](_0x50de53,{'showHidden':![],'depth':null}));};};exports[_0x8c4d('0xe')]=function(_0xe19c12,_0xda4bf5,_0x207f67){return{'message':_0xe19c12,'unlock':_0xda4bf5,'active':_0x207f67};};exports[_0x8c4d('0xf')]=function(_0x220cfa,_0x51eb2e,_0x512f85){if(!_[_0x8c4d('0x10')](_0x512f85)&&_0x8c4d('0x11')===typeof _0x512f85&&!_['isEmpty'](_0x512f85)){if(!_[_0x8c4d('0x10')](_0x51eb2e)&&_0x8c4d('0x11')===typeof _0x51eb2e&&!_[_0x8c4d('0x12')](_0x51eb2e)){return util['format'](_0x8c4d('0x13'),_0x51eb2e,_0x512f85);}return util[_0x8c4d('0x14')](_0x8c4d('0x13'),_0x512f85,_0x512f85);}if(!_[_0x8c4d('0x10')](_0x220cfa)&&_0x8c4d('0x11')===typeof _0x220cfa&&!_['isEmpty'](_0x220cfa)){return _0x220cfa;}return _0x8c4d('0x15');};exports[_0x8c4d('0x16')]=function(_0x48b376){if(_[_0x8c4d('0x17')](_0x48b376)){return![];}return _0x48b376;};exports[_0x8c4d('0x18')]=function(_0x2ad16e,_0x10ec67,_0x1fcc76,_0x10ef16,_0x17c206,_0x29b216){var _0x17708c={'XMD-QUEUE':_0x10ec67['Queue']?_0x10ec67[_0x8c4d('0x19')][_0x8c4d('0x1a')]:'','XMD-CALLERID':_0x10ef16,'XMD-CALLERID-PREVIEW':_0x29b216?util[_0x8c4d('0x14')](_0x8c4d('0x13'),_0x29b216[_0x8c4d('0x1b')],_0x29b216[_0x8c4d('0x1c')]):_0x10ef16,'XMD-DIALID':_0x17c206,'XMD-CONTACTID':_0x10ec67['ContactId'],'XMD-CDRTYPE':_0x8c4d('0x1d'),'CALLERID(all)':_0x10ef16,'XMD-VOICEQUEUEID':_0x10ec67[_0x8c4d('0x1e')],'XMD-DIALCHANNEL':_0x1fcc76,'XMD-DIALTIMEOUT':_0x2ad16e['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x8c4d('0x14')]('\x22rtTxX%s%s\x22',_0x2ad16e[_0x8c4d('0x1f')]?'g':'',_['isEmpty'](_0x2ad16e[_0x8c4d('0x20')])?'':_0x8c4d('0x21')),'XMD-DIALURL':_0x2ad16e[_0x8c4d('0x22')]||'','XMD-AGI':_0x2ad16e[_0x8c4d('0x23')]?util[_0x8c4d('0x14')](_0x8c4d('0x24'),ipAgi,_0x2ad16e[_0x8c4d('0x23')]):'NONE','XMD-AGIAFTER':_0x2ad16e['dialQueueProject2']?util[_0x8c4d('0x14')](_0x8c4d('0x24'),ipAgi,_0x2ad16e[_0x8c4d('0x1f')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x29b216?_0x29b216[_0x8c4d('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x29b216?_0x29b216[_0x8c4d('0x26')]:'','XMD-DESTINATION':_0x8c4d('0x27')};if(!_['isEmpty'](_0x2ad16e[_0x8c4d('0x20')])){_0x17708c[util[_0x8c4d('0x14')]('%s',_0x8c4d('0x28'))]=_0x2ad16e[_0x8c4d('0x20')];_0x17708c[util[_0x8c4d('0x14')]('%s',_0x8c4d('0x29'))]=_0x17c206;}if(_0x10ec67&&_0x10ec67['Contact']){for(var _0x45a417 in _0x10ec67[_0x8c4d('0x2a')]){if(_0x10ec67['Contact']['hasOwnProperty'](_0x45a417)){if(!_['isNil'](_0x10ec67[_0x8c4d('0x2a')][_0x45a417])&&_0x45a417!=='id'&&_0x45a417!==_0x8c4d('0x2b')&&_0x45a417!==_0x8c4d('0x2c')&&_0x45a417!==_0x8c4d('0x2d')){_0x17708c[util[_0x8c4d('0x14')]('%s%s','XMD-',_['toUpper'](_0x45a417))]=_0x10ec67[_0x8c4d('0x2a')][_0x45a417];}}}}return _0x17708c;};exports[_0x8c4d('0x2e')]=function(_0x27775e){var _0x5d2185={};for(var _0x425a76 in _0x27775e){if(_0x27775e['hasOwnProperty'](_0x425a76)){_0x5d2185[util[_0x8c4d('0x14')]('%s',_[_0x8c4d('0x2f')](_0x425a76))]=_0x27775e[_0x425a76];}}return{'variables':_0x5d2185};};exports[_0x8c4d('0x30')]=function(_0x4268ff,_0x48a6c4){if(!_[_0x8c4d('0x17')](_0x4268ff)){if(_0x4268ff[_0x8c4d('0x31')](_0x8c4d('0x32'))){if(_0x4268ff[_0x8c4d('0x32')]>0x0){_0x4268ff[_0x8c4d('0x32')]-=0x1;}else{logger[_0x8c4d('0x8')](_0x8c4d('0x33'),_0x48a6c4);}}}else{logger[_0x8c4d('0x8')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x48a6c4);}};exports[_0x8c4d('0x34')]=function(_0x4b3ab0){var _0x10f960=moment()[_0x8c4d('0x14')](_0x8c4d('0x35'));_0x4b3ab0[_0x8c4d('0x36')]=0xd;_0x4b3ab0[_0x8c4d('0x37')]='Blacklist';_0x4b3ab0[_0x8c4d('0x38')]=_0x10f960;_0x4b3ab0[_0x8c4d('0x39')]=_0x10f960;_0x4b3ab0[_0x8c4d('0x3a')]=_0x10f960;};exports[_0x8c4d('0x3b')]=function(_0x1af06a,_0x25ade8,_0x3e5eed){var _0x299bb1=moment()[_0x8c4d('0x14')](_0x8c4d('0x35'));_0x1af06a[_0x8c4d('0x36')]=_0x25ade8;_0x1af06a['statedesc']=_0x3e5eed;_0x1af06a[_0x8c4d('0x39')]=_0x299bb1;_0x1af06a[_0x8c4d('0x3c')]=getSeconds(_0x1af06a['responsetime'],_0x1af06a['starttime']);};exports[_0x8c4d('0x3d')]=function(_0x2b032a,_0x40d23c,_0x391f9a){_0x2b032a[_0x8c4d('0x3e')]=_0x40d23c;_0x2b032a[_0x8c4d('0x3f')]=_0x391f9a;};exports[_0x8c4d('0x40')]=function(_0x1fa027,_0x5b60ff,_0x388fb7){var _0x379c5e=moment()[_0x8c4d('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x1fa027[_0x8c4d('0x36')]=_0x5b60ff;_0x1fa027[_0x8c4d('0x37')]=_0x388fb7;_0x1fa027['responsetime']=_0x1fa027[_0x8c4d('0x39')]?_0x1fa027['responsetime']:_0x379c5e;_0x1fa027[_0x8c4d('0x3a')]=_0x1fa027[_0x8c4d('0x3a')]?_0x1fa027[_0x8c4d('0x3a')]:_0x379c5e;_0x1fa027[_0x8c4d('0x3c')]=getSeconds(_0x1fa027['responsetime']||0x0,_0x1fa027[_0x8c4d('0x38')]||0x0);_0x1fa027[_0x8c4d('0x41')]=_0x1fa027[_0x8c4d('0x42')]?getSeconds(_0x1fa027[_0x8c4d('0x3a')],_0x1fa027['answertime']):0x0;};exports['isFailure']=function(_0x47a1b2){return _0x47a1b2===_0x8c4d('0x43');};exports[_0x8c4d('0x44')]=function(_0xe6405a,_0x4f1593,_0x4971a0,_0x2ef142,_0x2ca73f){var _0x5f4799=_0x2ef142?'RECALL':_0xe6405a[_0x8c4d('0x1b')];_0x5f4799=_0x2ca73f?_0x8c4d('0x45'):_0x5f4799;return{'actionid':_0xe6405a[_0x8c4d('0x46')],'action':_0x8c4d('0x47'),'channel':_0xe6405a[_0x8c4d('0x48')],'callerid':util['format'](_0x8c4d('0x13'),_0x5f4799,_0xe6405a['calleridnum']),'Exten':'xcally-motion-preview','Context':_0x8c4d('0x49'),'Priority':'1','variable':_0x4971a0,'timeout':(_0x4f1593['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0xe6405a['uniqueid']};};exports[_0x8c4d('0x4a')]=function(_0x36bfed){return _0x36bfed[_0x8c4d('0x4b')]+_0x36bfed[_0x8c4d('0x4c')]+_0x36bfed['countnoanswerretry']+_0x36bfed[_0x8c4d('0x4d')]+_0x36bfed[_0x8c4d('0x4e')];};exports['cloneAction']=function(_0x44c0d8){var _0x3aca1e=_[_0x8c4d('0x4f')](_0x44c0d8);_0x3aca1e[_0x8c4d('0x36')]=0xf;_0x3aca1e[_0x8c4d('0x37')]='Global';return _0x3aca1e;};exports[_0x8c4d('0x50')]=function(_0x1b7801,_0x3018e2,_0x406817){var _0x482860={};_0x482860[_0x3018e2]=_0x1b7801[_0x3018e2];_0x482860[_0x8c4d('0x51')]=![];_0x482860[_0x8c4d('0x52')]=moment()[_0x8c4d('0x53')](_0x406817,_0x8c4d('0x54'))[_0x8c4d('0x14')](_0x8c4d('0x35'));_0x482860[_0x8c4d('0x55')]=_0x1b7801[_0x8c4d('0x55')];_0x482860[_0x8c4d('0x56')]=_0x1b7801[_0x8c4d('0x56')];_0x482860[_0x8c4d('0x1e')]=_0x1b7801[_0x8c4d('0x1e')]||undefined;return _0x482860;};exports[_0x8c4d('0x57')]=function(_0x1ab584,_0x1e9ada){if(!_[_0x8c4d('0x17')](_0x1ab584)){if(_0x1ab584[_0x8c4d('0x58')]>0x0){_0x1ab584[_0x8c4d('0x58')]-=0x1;}else{logger[_0x8c4d('0x8')](_0x1e9ada,_0x8c4d('0x59'));}}else{logger['error'](_0x1e9ada,_0x8c4d('0x5a'));}};exports[_0x8c4d('0x5b')]=function(_0x4c7c5a){if(_0x4c7c5a<=0x0){return!![];}return![];};exports[_0x8c4d('0x5c')]=function(_0x369656,_0x292179){_0x369656[_0x8c4d('0x5d')]=_0x292179;_0x369656[_0x8c4d('0x1a')]=_0x369656[_0x8c4d('0x5e')];_0x369656['interface']=_0x369656['channelAgent'];return _0x369656;};exports['buildAcw']=function(_0x503bb6){var _0x5add43={};_0x5add43['queue']=_0x503bb6['queue'];_0x5add43[_0x8c4d('0x5f')]=_0x503bb6['channelAgent'];_0x5add43['uniqueid']=_0x503bb6[_0x8c4d('0x46')];return _0x5add43;};exports[_0x8c4d('0x60')]=function(_0x204d13){var _0x5ae50f=[];for(var _0x2206a5 in _0x204d13){if(_0x204d13[_0x8c4d('0x31')](_0x2206a5)){if(!_[_0x8c4d('0x17')](_0x204d13[_0x2206a5])&&_0x204d13[_0x2206a5][_0x8c4d('0x36')]===_0x8c4d('0x61')&&_0x204d13[_0x2206a5][_0x8c4d('0x62')]==='reachable'){_0x5ae50f['push'](_0x204d13[_0x2206a5]['id']);}}}return _0x5ae50f;};exports[_0x8c4d('0x63')]=function(_0x3e9782){var _0x32989b=moment()[_0x8c4d('0x4')](0x0);var _0x40fc8c=moment(_0x3e9782)[_0x8c4d('0x4')](0x0);return _0x32989b[_0x8c4d('0x5')](_0x40fc8c,_0x8c4d('0x6'));};exports['createBody']=function(_0x1bcd0d){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1bcd0d[_0x8c4d('0x55')],'ListId':_0x1bcd0d[_0x8c4d('0x56')],'VoiceQueueId':_0x1bcd0d['VoiceQueueId']||undefined,'CampaignId':_0x1bcd0d[_0x8c4d('0x64')]||undefined};};exports['filterKey']=function(_0x1087fb){if(_0x1087fb==='uniqueid'||_0x1087fb===_0x8c4d('0x65')||_0x1087fb===_0x8c4d('0x5e')||_0x1087fb===_0x8c4d('0x66')||_0x1087fb===_0x8c4d('0x67')||_0x1087fb===_0x8c4d('0x68')||_0x1087fb===_0x8c4d('0x3e')||_0x1087fb==='channelAgent'||_0x1087fb===_0x8c4d('0x1b')||_0x1087fb===_0x8c4d('0x51')||_0x1087fb===_0x8c4d('0x1c')||_0x1087fb===_0x8c4d('0x52')||_0x1087fb===_0x8c4d('0x4b')||_0x1087fb===_0x8c4d('0x4c')||_0x1087fb==='countnoanswerretry'||_0x1087fb===_0x8c4d('0x69')||_0x1087fb===_0x8c4d('0x6a')||_0x1087fb===_0x8c4d('0x6b')||_0x1087fb===_0x8c4d('0x6c')||_0x1087fb==='recallme'||_0x1087fb===_0x8c4d('0x55')||_0x1087fb==='ListId'||_0x1087fb==='UserId'||_0x1087fb==='VoiceQueueId'||_0x1087fb===_0x8c4d('0x6d')||_0x1087fb===_0x8c4d('0x6e')||_0x1087fb===_0x8c4d('0x6f')||_0x1087fb===_0x8c4d('0x70')||_0x1087fb==='xmd-listid'||_0x1087fb===_0x8c4d('0x71')||_0x1087fb===_0x8c4d('0x72')||_0x1087fb==='xmd-dialoptions'||_0x1087fb===_0x8c4d('0x73')||_0x1087fb===_0x8c4d('0x74')||_0x1087fb===_0x8c4d('0x75')||_0x1087fb===_0x8c4d('0x76')||_0x1087fb==='xmd-callerid'||_0x1087fb==='xmd-agiafter'||_0x1087fb===_0x8c4d('0x77')||_0x1087fb===_0x8c4d('0x78')||_0x1087fb==='rtpaudioqosbridged'||_0x1087fb===_0x8c4d('0x79')||_0x1087fb===_0x8c4d('0x7a')||_0x1087fb===_0x8c4d('0x7b')||_0x1087fb===_0x8c4d('0x7c')||_0x1087fb==='rtpaudioqosrtt'||_0x1087fb===_0x8c4d('0x7d')||_0x1087fb==='rtpaudioqos'||_0x1087fb===_0x8c4d('0x7e')||_0x1087fb===_0x8c4d('0x79')||_0x1087fb===_0x8c4d('0x7a')||_0x1087fb===_0x8c4d('0x7b')||_0x1087fb===_0x8c4d('0x7c')||_0x1087fb===_0x8c4d('0x7f')||_0x1087fb===_0x8c4d('0x7d')||_0x1087fb===_0x8c4d('0x80')||_0x1087fb==='bridgepvtcallid'||_0x1087fb===_0x8c4d('0x36')||_0x1087fb===_0x8c4d('0x37')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x5acf24,_0x553e76){var _0x29dc89,_0x1bf919,_0x375642;if(_0x553e76<=0x0){_0x553e76=0x1;}_0x29dc89=new RegExp('\x5cw{0,'+_0x553e76+'}$');_0x1bf919=Math['pow'](0xa,_0x553e76-0x1);_0x375642=Math[_0x8c4d('0x81')](0xa,_0x553e76)-0x1;return util[_0x8c4d('0x14')]('%s',_['replace'](_0x5acf24,_0x29dc89,_['random'](_0x1bf919,_0x375642)));};exports[_0x8c4d('0x82')]=function(_0x39d7fd){var _0x503f18=_0x39d7fd[_0x8c4d('0x83')](/"(.*?)"/);return _0x503f18?_0x503f18[0x1]:_0x39d7fd;};exports[_0x8c4d('0x84')]=function(_0x17fa52){var _0x34a5ac=_0x17fa52[_0x8c4d('0x83')](/<(.*?)>/);return _0x34a5ac?_0x34a5ac[0x1]:_0x17fa52;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 6a99fe4..0c6d286 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 _0xb10b=['voicequeuechannelhangup','queueadd','string','number','queueremove','queuepause','boolean','reload','voicechannel'];(function(_0x2f3570,_0x4d7940){var _0x5bbab8=function(_0xf7e8e1){while(--_0xf7e8e1){_0x2f3570['push'](_0x2f3570['shift']());}};_0x5bbab8(++_0x4d7940);}(_0xb10b,0x12a));var _0xbb10=function(_0x5a7cbc,_0x573d85){_0x5a7cbc=_0x5a7cbc-0x0;var _0x44d2cc=_0xb10b[_0x5a7cbc];return _0x44d2cc;};'use strict';exports[_0xbb10('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]},'membername':{'type':_0xbb10('0x1'),'required':!![]},'penalty':{'type':_0xbb10('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xbb10('0x3')]={'queue':{'type':_0xbb10('0x1'),'required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x4')]={'interface':{'type':_0xbb10('0x1'),'required':!![]},'paused':{'type':_0xbb10('0x5')},'reason':{'type':'string','required':![]}};exports[_0xbb10('0x6')]={'module':{'type':_0xbb10('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x7')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]},'filename':{'type':_0xbb10('0x1')},'format':{'type':_0xbb10('0x1')},'mixmonitorid':{'type':_0xbb10('0x1')}};exports[_0xbb10('0x8')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xbb10('0x1'),'required':!![]},'context':{'type':_0xbb10('0x1')}}; \ No newline at end of file +var _0xb10b=['voicequeuechannelhangup','queueadd','string','number','queueremove','queuepause','boolean','reload','voicechannel'];(function(_0x599daf,_0x141f1b){var _0x4c3521=function(_0x45feac){while(--_0x45feac){_0x599daf['push'](_0x599daf['shift']());}};_0x4c3521(++_0x141f1b);}(_0xb10b,0x12a));var _0xbb10=function(_0x895358,_0x32f914){_0x895358=_0x895358-0x0;var _0x26e26e=_0xb10b[_0x895358];return _0x26e26e;};'use strict';exports[_0xbb10('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]},'membername':{'type':_0xbb10('0x1'),'required':!![]},'penalty':{'type':_0xbb10('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xbb10('0x3')]={'queue':{'type':_0xbb10('0x1'),'required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x4')]={'interface':{'type':_0xbb10('0x1'),'required':!![]},'paused':{'type':_0xbb10('0x5')},'reason':{'type':'string','required':![]}};exports[_0xbb10('0x6')]={'module':{'type':_0xbb10('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x7')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]},'filename':{'type':_0xbb10('0x1')},'format':{'type':_0xbb10('0x1')},'mixmonitorid':{'type':_0xbb10('0x1')}};exports[_0xbb10('0x8')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xbb10('0x1'),'required':!![]},'context':{'type':_0xbb10('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index fa4267c..5d8ae4b 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 _0x70ed=['exports','bluebird','util','lodash','moment','../model/agent','../model/trunk','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/freshsalesAccount','../model/faxAccount','agents','trunks','voiceQueues','triggers','campaigns','templates','outbound','channels','queueChannels','outboundChannels','timers','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','deskAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','hasOwnProperty','mapKeys','SIP/%s','name','isNil','format','interface','total','answered','sumHoldTime','sumDuration','ivrTotalCallsDays','ivrAnswerCallsDay','isEmpty','abandoned','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','length','telephones','initTrunks','isUndefined','initVoiceQueues','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','zohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initDynamics365Accounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','unmanaged','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','diff','queuecallercomplete','initVoiceCallReports','disposition','duration','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions'];(function(_0x164b84,_0x5296d2){var _0x46822b=function(_0x3998d8){while(--_0x3998d8){_0x164b84['push'](_0x164b84['shift']());}};_0x46822b(++_0x5296d2);}(_0x70ed,0x1b5));var _0xd70e=function(_0x263a2f,_0x1e81e3){_0x263a2f=_0x263a2f-0x0;var _0x8020e8=_0x70ed[_0x263a2f];return _0x8020e8;};'use strict';var BPromise=require(_0xd70e('0x0'));var util=require(_0xd70e('0x1'));var _=require(_0xd70e('0x2'));var moment=require(_0xd70e('0x3'));var Agent=require(_0xd70e('0x4'));var Telephone=require('../model/telephone');var Trunk=require(_0xd70e('0x5'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0xd70e('0x6'));var Template=require(_0xd70e('0x7'));var Campaign=require(_0xd70e('0x8'));var VoiceExtension=require(_0xd70e('0x9'));var ZendeskAccount=require(_0xd70e('0xa'));var SalesforceAccount=require(_0xd70e('0xb'));var FreshdeskAccount=require(_0xd70e('0xc'));var SugarcrmAccount=require(_0xd70e('0xd'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xd70e('0xe'));var VtigerAccount=require(_0xd70e('0xf'));var ServicenowAccount=require(_0xd70e('0x10'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0xd70e('0x11'));var FaxAccount=require(_0xd70e('0x12'));var Realtime=function(){this[_0xd70e('0x13')]={};this['telephones']={};this[_0xd70e('0x14')]={};this[_0xd70e('0x15')]={};this[_0xd70e('0x16')]={};this[_0xd70e('0x17')]={};this[_0xd70e('0x18')]={};this[_0xd70e('0x19')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xd70e('0x1a')]={};this[_0xd70e('0x1b')]={};this[_0xd70e('0x1c')]={};this[_0xd70e('0x1d')]={};this[_0xd70e('0x1e')]={};this[_0xd70e('0x1f')]={};this[_0xd70e('0x20')]={};this[_0xd70e('0x21')]={};this['zohoAccounts']={};this[_0xd70e('0x22')]={};this['vtigerAccounts']={};this[_0xd70e('0x23')]={};this[_0xd70e('0x24')]={};this['freshsalesAccounts']={};this[_0xd70e('0x25')]={};};function freeIsNotKey(_0xa2d53b,_0x3872bd,_0x221f5f){var _0x1f20b2=_['mapKeys'](_0xa2d53b,function(_0x26c29f,_0xa48a20){return _0x26c29f[_0x221f5f];});for(var _0x4be686 in _0x3872bd){if(_0x3872bd[_0xd70e('0x26')](_0x4be686)){if(!_0x1f20b2[_0x4be686]){delete _0x3872bd[_0x4be686];}}}}function freeIsNotKeySip(_0x2ea429,_0x4b3730){var _0x291c0c=_[_0xd70e('0x27')](_0x2ea429,function(_0x37f8fd,_0x5b32d6){return util['format'](_0xd70e('0x28'),_0x37f8fd[_0xd70e('0x29')]);});for(var _0x38f67f in _0x4b3730){if(_0x4b3730[_0xd70e('0x26')](_0x38f67f)){if(!_0x291c0c[_0x38f67f]){delete _0x4b3730[_0x38f67f];}}}}function freeIsNotKeyAgent(_0x318fe4,_0x58ceea){var _0x84edb=_['mapKeys'](_0x318fe4,function(_0x2a4a0a,_0x553394){var _0x2c03e3=_[_0xd70e('0x2a')](_0x2a4a0a['interface'])?util[_0xd70e('0x2b')](_0xd70e('0x28'),_0x2a4a0a[_0xd70e('0x29')]):_0x2a4a0a[_0xd70e('0x2c')];return _0x2c03e3;});for(var _0x417f2f in _0x58ceea){if(_0x58ceea['hasOwnProperty'](_0x417f2f)){if(!_0x84edb[_0x417f2f]){delete _0x58ceea[_0x417f2f];}}}}function clearVoiceCallReports(_0x457b2b){_0x457b2b[_0xd70e('0x2d')]=0x0;_0x457b2b[_0xd70e('0x2e')]=0x0;_0x457b2b[_0xd70e('0x2f')]=0x0;_0x457b2b[_0xd70e('0x30')]=0x0;_0x457b2b['sumBillable']=0x0;}function clearCampaigns(_0xd76889){if(!_['isEmpty'](_0xd76889)){for(var _0x169465 in _0xd76889){if(_0xd76889[_0xd70e('0x26')](_0x169465)){_0xd76889[_0x169465][_0xd70e('0x31')]=0x0;_0xd76889[_0x169465][_0xd70e('0x32')]=0x0;}}}}function clearVoiceQueues(_0x493e34){if(!_[_0xd70e('0x33')](_0x493e34)){for(var _0x12cf3c in _0x493e34){if(_0x493e34[_0xd70e('0x26')](_0x12cf3c)){_0x493e34[_0x12cf3c][_0xd70e('0x2d')]=0x0;_0x493e34[_0x12cf3c][_0xd70e('0x2e')]=0x0;_0x493e34[_0x12cf3c]['unmanaged']=0x0;_0x493e34[_0x12cf3c][_0xd70e('0x34')]=0x0;_0x493e34[_0x12cf3c]['sumHoldTime']=0x0;_0x493e34[_0x12cf3c]['sumDuration']=0x0;_0x493e34[_0x12cf3c][_0xd70e('0x35')]=0x0;_0x493e34[_0x12cf3c][_0xd70e('0x36')]=0x0;_0x493e34[_0x12cf3c][_0xd70e('0x37')]=0x0;_0x493e34[_0x12cf3c][_0xd70e('0x38')]=0x0;_0x493e34[_0x12cf3c]['outboundCongestionCallsDay']=0x0;_0x493e34[_0x12cf3c][_0xd70e('0x39')]=0x0;_0x493e34[_0x12cf3c]['outboundUnknownCallsDay']=0x0;_0x493e34[_0x12cf3c][_0xd70e('0x3a')]=0x0;_0x493e34[_0x12cf3c]['outboundDropCallsDayCallersExit']=0x0;_0x493e34[_0x12cf3c]['outboundBlacklistCallsDay']=0x0;_0x493e34[_0x12cf3c][_0xd70e('0x3b')]=0x0;_0x493e34[_0x12cf3c][_0xd70e('0x3c')]=0x0;_0x493e34[_0x12cf3c][_0xd70e('0x3d')]=0x0;_0x493e34[_0x12cf3c][_0xd70e('0x36')]=0x0;_0x493e34[_0x12cf3c][_0xd70e('0x3e')]=0x0;_0x493e34[_0x12cf3c][_0xd70e('0x3f')]=!![];}}}}Realtime['prototype'][_0xd70e('0x40')]=function(_0x42f78e,_0x1c38bd){for(var _0x56eb4d in _0x1c38bd){if(_0x42f78e[_0xd70e('0x26')](_0x56eb4d)){_0x42f78e[_0x56eb4d]=_0x1c38bd[_0x56eb4d];}}};Realtime[_0xd70e('0x41')]['initAgents']=function(){var _0x37777c=this;return function(_0x140b34){if(_0x140b34){freeIsNotKeyAgent(_0x140b34,_0x37777c[_0xd70e('0x13')]);for(var _0x4b30c5=0x0,_0x28e2cb={},_0x5ef330={};_0x4b30c5<_0x140b34[_0xd70e('0x42')];_0x4b30c5+=0x1){_0x28e2cb=_0x140b34[_0x4b30c5];var _0x1dccc9=_[_0xd70e('0x2a')](_0x28e2cb['interface'])?util[_0xd70e('0x2b')](_0xd70e('0x28'),_0x28e2cb['name']):_0x28e2cb[_0xd70e('0x2c')];if(_['isUndefined'](_0x37777c[_0xd70e('0x13')][_0x1dccc9])){_0x37777c[_0xd70e('0x13')][_0x1dccc9]=new Agent(_0x28e2cb);}else{_0x37777c[_0xd70e('0x40')](_0x37777c[_0xd70e('0x13')][_0x1dccc9],_0x28e2cb);}}}return _0x37777c[_0xd70e('0x13')];};};Realtime[_0xd70e('0x41')]['initTelephones']=function(){var _0x4f8a59=this;return function(_0x2cbd27){if(_0x2cbd27){freeIsNotKeySip(_0x2cbd27,_0x4f8a59[_0xd70e('0x43')]);for(var _0x2d473f=0x0,_0x580290={},_0x4fddf1={};_0x2d473f<_0x2cbd27['length'];_0x2d473f+=0x1){_0x580290=_0x2cbd27[_0x2d473f];if(_['isUndefined'](_0x4f8a59[_0xd70e('0x43')][util[_0xd70e('0x2b')]('SIP/%s',_0x580290[_0xd70e('0x29')])])){_0x4f8a59[_0xd70e('0x43')][util[_0xd70e('0x2b')](_0xd70e('0x28'),_0x580290[_0xd70e('0x29')])]=new Telephone(_0x580290);}else{_0x4f8a59[_0xd70e('0x40')](_0x4f8a59['telephones'][util[_0xd70e('0x2b')](_0xd70e('0x28'),_0x580290['name'])],_0x580290);}}}return _0x4f8a59[_0xd70e('0x43')];};};Realtime[_0xd70e('0x41')][_0xd70e('0x44')]=function(){var _0x1bd314=this;return function(_0x22a6d6){if(_0x22a6d6){freeIsNotKeySip(_0x22a6d6,_0x1bd314[_0xd70e('0x14')]);for(var _0x3edeba=0x0,_0x76d76a={},_0x285497={};_0x3edeba<_0x22a6d6['length'];_0x3edeba+=0x1){_0x76d76a=_0x22a6d6[_0x3edeba];if(_[_0xd70e('0x45')](_0x1bd314['trunks'][util['format']('SIP/%s',_0x76d76a[_0xd70e('0x29')])])){_0x1bd314[_0xd70e('0x14')][util['format'](_0xd70e('0x28'),_0x76d76a['name'])]=new Trunk(_0x76d76a);}else{_0x1bd314['mergeFromDatabase'](_0x1bd314[_0xd70e('0x14')][util[_0xd70e('0x2b')](_0xd70e('0x28'),_0x76d76a[_0xd70e('0x29')])],_0x76d76a);}}}return _0x1bd314[_0xd70e('0x14')];};};Realtime['prototype'][_0xd70e('0x46')]=function(){var _0x2d3dad=this;return function(_0x1fba18){if(_0x1fba18){freeIsNotKey(_0x1fba18,_0x2d3dad[_0xd70e('0x15')],_0xd70e('0x29'));for(var _0x12b393=0x0,_0x160923={},_0x297e63={};_0x12b393<_0x1fba18['length'];_0x12b393+=0x1){_0x160923=_0x1fba18[_0x12b393];if(_[_0xd70e('0x45')](_0x2d3dad['voiceQueues'][_0x160923[_0xd70e('0x29')]])){_0x2d3dad[_0xd70e('0x15')][_0x160923['name']]=new VoiceQueue(_0x160923);}else{_0x2d3dad['mergeFromDatabase'](_0x2d3dad[_0xd70e('0x15')][_0x160923[_0xd70e('0x29')]],_0x160923);}}}return _0x2d3dad['voiceQueues'];};};Realtime[_0xd70e('0x41')][_0xd70e('0x47')]=function(){var _0x546452=this;return function(_0x33968c){if(_0x33968c){freeIsNotKey(_0x33968c,_0x546452[_0xd70e('0x16')],'id');for(var _0x5e830a=0x0,_0x136433={},_0x210389={};_0x5e830a<_0x33968c['length'];_0x5e830a+=0x1){_0x136433=_0x33968c[_0x5e830a];if(_[_0xd70e('0x45')](_0x546452['triggers'][_0x136433['id']])){_0x546452[_0xd70e('0x16')][_0x136433['id']]=new Trigger(_0x136433);}else{_0x546452[_0xd70e('0x40')](_0x546452[_0xd70e('0x16')][_0x136433['id']],_0x136433);}}}return _0x546452['triggers'];};};Realtime['prototype'][_0xd70e('0x48')]=function(){var _0xcb0de0=this;return function(_0x38c76e){if(_0x38c76e){freeIsNotKey(_0x38c76e,_0xcb0de0['templates'],'id');for(var _0x428522=0x0,_0x2e7fb0={},_0x1d53ca={};_0x428522<_0x38c76e[_0xd70e('0x42')];_0x428522+=0x1){_0x2e7fb0=_0x38c76e[_0x428522];if(_[_0xd70e('0x45')](_0xcb0de0[_0xd70e('0x18')][_0x2e7fb0['id']])){_0xcb0de0[_0xd70e('0x18')][_0x2e7fb0['id']]=new Template(_0x2e7fb0);}else{_0xcb0de0['mergeFromDatabase'](_0xcb0de0[_0xd70e('0x18')][_0x2e7fb0['id']],_0x2e7fb0);}}}return _0xcb0de0[_0xd70e('0x18')];};};Realtime[_0xd70e('0x41')][_0xd70e('0x49')]=function(){var _0x41a91a=this;return function(_0x51361e){if(_0x51361e){freeIsNotKey(_0x51361e,_0x41a91a[_0xd70e('0x1e')],'id');for(var _0x5000bc=0x0,_0x206767={},_0x43c443={};_0x5000bc<_0x51361e['length'];_0x5000bc+=0x1){_0x206767=_0x51361e[_0x5000bc];if(_[_0xd70e('0x45')](_0x41a91a[_0xd70e('0x1e')][_0x206767['id']])){_0x41a91a[_0xd70e('0x1e')][_0x206767['id']]=new ZendeskAccount(_0x206767);}else{_0x41a91a[_0xd70e('0x40')](_0x41a91a[_0xd70e('0x1e')][_0x206767['id']],_0x206767);}}}return _0x41a91a[_0xd70e('0x1e')];};};Realtime['prototype'][_0xd70e('0x4a')]=function(){var _0x44e99f=this;return function(_0x552efc){if(_0x552efc){freeIsNotKey(_0x552efc,_0x44e99f[_0xd70e('0x1f')],'id');for(var _0x10a00f=0x0,_0x41027f={},_0x16e90b={};_0x10a00f<_0x552efc[_0xd70e('0x42')];_0x10a00f+=0x1){_0x41027f=_0x552efc[_0x10a00f];if(_['isUndefined'](_0x44e99f[_0xd70e('0x1f')][_0x41027f['id']])){_0x44e99f[_0xd70e('0x1f')][_0x41027f['id']]=new SalesforceAccount(_0x41027f);}else{_0x44e99f['mergeFromDatabase'](_0x44e99f[_0xd70e('0x1f')][_0x41027f['id']],_0x41027f);}}}return _0x44e99f[_0xd70e('0x1f')];};};Realtime[_0xd70e('0x41')]['initFreshdeskAccounts']=function(){var _0x13e103=this;return function(_0x2d80fa){if(_0x2d80fa){freeIsNotKey(_0x2d80fa,_0x13e103[_0xd70e('0x21')],'id');for(var _0x335701=0x0,_0x290eae={},_0x32272c={};_0x335701<_0x2d80fa[_0xd70e('0x42')];_0x335701+=0x1){_0x290eae=_0x2d80fa[_0x335701];if(_[_0xd70e('0x45')](_0x13e103[_0xd70e('0x21')][_0x290eae['id']])){_0x13e103['freshdeskAccounts'][_0x290eae['id']]=new FreshdeskAccount(_0x290eae);}else{_0x13e103[_0xd70e('0x40')](_0x13e103[_0xd70e('0x21')][_0x290eae['id']],_0x290eae);}}}return _0x13e103[_0xd70e('0x21')];};};Realtime[_0xd70e('0x41')]['initZohoAccounts']=function(){var _0x4efef9=this;return function(_0x1f03ec){if(_0x1f03ec){freeIsNotKey(_0x1f03ec,_0x4efef9[_0xd70e('0x4b')],'id');for(var _0x5e0016=0x0,_0x291580={},_0x1be960={};_0x5e0016<_0x1f03ec['length'];_0x5e0016+=0x1){_0x291580=_0x1f03ec[_0x5e0016];if(_[_0xd70e('0x45')](_0x4efef9[_0xd70e('0x4b')][_0x291580['id']])){_0x4efef9[_0xd70e('0x4b')][_0x291580['id']]=new ZohoAccount(_0x291580);}else{_0x4efef9['mergeFromDatabase'](_0x4efef9[_0xd70e('0x4b')][_0x291580['id']],_0x291580);}}}return _0x4efef9[_0xd70e('0x4b')];};};Realtime[_0xd70e('0x41')][_0xd70e('0x4c')]=function(){var _0x296edf=this;return function(_0x192a5a){if(_0x192a5a){freeIsNotKey(_0x192a5a,_0x296edf[_0xd70e('0x22')],'id');for(var _0x34f0ed=0x0,_0x23d04c={},_0x5e8b1c={};_0x34f0ed<_0x192a5a[_0xd70e('0x42')];_0x34f0ed+=0x1){_0x23d04c=_0x192a5a[_0x34f0ed];if(_[_0xd70e('0x45')](_0x296edf[_0xd70e('0x22')][_0x23d04c['id']])){_0x296edf['deskAccounts'][_0x23d04c['id']]=new DeskAccount(_0x23d04c);}else{_0x296edf[_0xd70e('0x40')](_0x296edf[_0xd70e('0x22')][_0x23d04c['id']],_0x23d04c);}}}return _0x296edf[_0xd70e('0x22')];};};Realtime[_0xd70e('0x41')][_0xd70e('0x4d')]=function(){var _0xc5758=this;return function(_0x4ad73d){if(_0x4ad73d){freeIsNotKey(_0x4ad73d,_0xc5758[_0xd70e('0x20')],'id');for(var _0x4681d9=0x0,_0x3f5730={},_0x54e4b2={};_0x4681d9<_0x4ad73d[_0xd70e('0x42')];_0x4681d9+=0x1){_0x3f5730=_0x4ad73d[_0x4681d9];if(_['isUndefined'](_0xc5758[_0xd70e('0x20')][_0x3f5730['id']])){_0xc5758['sugarcrmAccounts'][_0x3f5730['id']]=new SugarcrmAccount(_0x3f5730);}else{_0xc5758['mergeFromDatabase'](_0xc5758[_0xd70e('0x20')][_0x3f5730['id']],_0x3f5730);}}}return _0xc5758['sugarcrmAccounts'];};};Realtime['prototype'][_0xd70e('0x4e')]=function(){var _0x5d0746=this;return function(_0x34867a){if(_0x34867a){freeIsNotKey(_0x34867a,_0x5d0746[_0xd70e('0x4f')],'id');for(var _0x579a5b=0x0,_0x355572={},_0x1c35ae={};_0x579a5b<_0x34867a[_0xd70e('0x42')];_0x579a5b+=0x1){_0x355572=_0x34867a[_0x579a5b];if(_[_0xd70e('0x45')](_0x5d0746['vtigerAccounts'][_0x355572['id']])){_0x5d0746[_0xd70e('0x4f')][_0x355572['id']]=new VtigerAccount(_0x355572);}else{_0x5d0746[_0xd70e('0x40')](_0x5d0746[_0xd70e('0x4f')][_0x355572['id']],_0x355572);}}}return _0x5d0746[_0xd70e('0x4f')];};};Realtime[_0xd70e('0x41')]['initServicenowAccounts']=function(){var _0x553841=this;return function(_0x5471a6){if(_0x5471a6){freeIsNotKey(_0x5471a6,_0x553841[_0xd70e('0x23')],'id');for(var _0xde12b9=0x0,_0x5812be={},_0x23fb35={};_0xde12b9<_0x5471a6['length'];_0xde12b9+=0x1){_0x5812be=_0x5471a6[_0xde12b9];if(_[_0xd70e('0x45')](_0x553841[_0xd70e('0x23')][_0x5812be['id']])){_0x553841['servicenowAccounts'][_0x5812be['id']]=new ServicenowAccount(_0x5812be);}else{_0x553841['mergeFromDatabase'](_0x553841[_0xd70e('0x23')][_0x5812be['id']],_0x5812be);}}}return _0x553841[_0xd70e('0x23')];};};Realtime[_0xd70e('0x41')][_0xd70e('0x50')]=function(){var _0x67c8a4=this;return function(_0x4d624c){if(_0x4d624c){freeIsNotKey(_0x4d624c,_0x67c8a4[_0xd70e('0x24')],'id');for(var _0x5e36de=0x0,_0x384d06={},_0x2427b0={};_0x5e36de<_0x4d624c['length'];_0x5e36de+=0x1){_0x384d06=_0x4d624c[_0x5e36de];if(_[_0xd70e('0x45')](_0x67c8a4[_0xd70e('0x24')][_0x384d06['id']])){_0x67c8a4[_0xd70e('0x24')][_0x384d06['id']]=new Dynamics365Account(_0x384d06);}else{_0x67c8a4[_0xd70e('0x40')](_0x67c8a4[_0xd70e('0x24')][_0x384d06['id']],_0x384d06);}}}return _0x67c8a4[_0xd70e('0x24')];};};Realtime[_0xd70e('0x41')][_0xd70e('0x51')]=function(){var _0x4a29e1=this;return function(_0x1d0079){if(_0x1d0079){freeIsNotKey(_0x1d0079,_0x4a29e1['freshsalesAccounts'],'id');for(var _0x1909a4=0x0,_0x129356={},_0x154821={};_0x1909a4<_0x1d0079['length'];_0x1909a4+=0x1){_0x129356=_0x1d0079[_0x1909a4];if(_['isUndefined'](_0x4a29e1[_0xd70e('0x52')][_0x129356['id']])){_0x4a29e1[_0xd70e('0x52')][_0x129356['id']]=new FreshsalesAccount(_0x129356);}else{_0x4a29e1[_0xd70e('0x40')](_0x4a29e1['freshsalesAccounts'][_0x129356['id']],_0x129356);}}}return _0x4a29e1[_0xd70e('0x52')];};};Realtime[_0xd70e('0x41')][_0xd70e('0x53')]=function(){var _0x3eccd2=this;return function(_0x5a2f64){for(var _0x466825=0x0;_0x466825<_0x5a2f64[_0xd70e('0x42')];_0x466825+=0x1){_[_0xd70e('0x54')](_0x3eccd2['voiceQueues'][_0x5a2f64[_0x466825]['name']],_0x5a2f64[_0x466825]);}return _0x3eccd2['voiceQueues'];};};Realtime[_0xd70e('0x41')][_0xd70e('0x55')]=function(){var _0x2a516d=this;return function(_0x560419){clearVoiceQueues(_0x2a516d[_0xd70e('0x15')]);if(_0x560419){_0x560419=_[_0xd70e('0x56')](_0x560419,_0xd70e('0x57'));for(var _0x147f9d in _0x560419){if(_0x560419[_0xd70e('0x26')](_0x147f9d)){var _0x23ea7b={};for(var _0x4ce985=0x0;_0x4ce985<_0x560419[_0x147f9d][_0xd70e('0x42')];_0x4ce985+=0x1){var _0xe108b2=_0x560419[_0x147f9d][_0x4ce985][_0xd70e('0x58')];if(_0x2a516d[_0xd70e('0x15')][_0xe108b2]){if(_0x560419[_0x147f9d][_0x4ce985][_0xd70e('0x59')]){_0x2a516d['voiceQueues'][_0xe108b2][_0xd70e('0x5a')]+=0x1;}if(_0x560419[_0x147f9d][_0x4ce985][_0xd70e('0x5b')]){_0x2a516d['voiceQueues'][_0xe108b2]['abandoned']+=0x1;}_0x2a516d[_0xd70e('0x15')][_0xe108b2][_0xd70e('0x2f')]+=moment(_0x560419[_0x147f9d][_0x4ce985][_0xd70e('0x5c')])['diff'](moment(_0x560419[_0x147f9d][_0x4ce985][_0xd70e('0x5d')]),_0xd70e('0x5e'))||0x0;if(_0x4ce985===_0x560419[_0x147f9d]['length']-0x1){_0x2a516d[_0xd70e('0x15')][_0xe108b2]['sumDuration']+=moment(_0x560419[_0x147f9d][_0x4ce985][_0xd70e('0x5f')]||_0x560419[_0x147f9d][_0x4ce985][_0xd70e('0x60')]||_0x560419[_0x147f9d][_0x4ce985]['queuecallerexitAt'])[_0xd70e('0x61')](moment(_0x560419[_0x147f9d][_0x4ce985][_0xd70e('0x5d')]),_0xd70e('0x5e'))||0x0;_0x2a516d[_0xd70e('0x15')][_0xe108b2]['total']+=0x1;if(_0x560419[_0x147f9d][_0x4ce985][_0xd70e('0x62')]){_0x2a516d[_0xd70e('0x15')][_0xe108b2]['answered']+=0x1;_0x2a516d[_0xd70e('0x15')][_0xe108b2][_0xd70e('0x35')]+=moment(_0x560419[_0x147f9d][_0x4ce985][_0xd70e('0x5f')])[_0xd70e('0x61')](moment(_0x560419[_0x147f9d][_0x4ce985][_0xd70e('0x5c')]),'seconds')||0x0;}}else{_0x2a516d[_0xd70e('0x15')][_0xe108b2][_0xd70e('0x30')]+=_0x2a516d['voiceQueues'][_0xe108b2]['sumHoldTime']||0x0;}}}}}}return _0x2a516d[_0xd70e('0x15')];};};Realtime[_0xd70e('0x41')][_0xd70e('0x63')]=function(){var _0x234018=this;return function(_0x2ee9df){clearVoiceCallReports(_0x234018[_0xd70e('0x19')]);if(_0x2ee9df){for(var _0x4094d0=0x0;_0x4094d0<_0x2ee9df[_0xd70e('0x42')];_0x4094d0+=0x1){_0x234018[_0xd70e('0x19')][_0xd70e('0x2d')]+=0x1;_0x234018[_0xd70e('0x19')][_0xd70e('0x30')]+=_0x2ee9df[_0x4094d0]['duration'];if(_0x2ee9df[_0x4094d0][_0xd70e('0x64')]==='ANSWERED'){_0x234018[_0xd70e('0x19')]['answered']+=0x1;_0x234018[_0xd70e('0x19')]['sumHoldTime']+=_0x2ee9df[_0x4094d0][_0xd70e('0x65')]-_0x2ee9df[_0x4094d0][_0xd70e('0x66')]||0x0;_0x234018[_0xd70e('0x19')]['sumBillable']+=_0x2ee9df[_0x4094d0][_0xd70e('0x66')];}}}return _0x234018[_0xd70e('0x19')];};};Realtime[_0xd70e('0x41')][_0xd70e('0x67')]=function(){var _0x581879=this;return function(_0x1d6eb4){if(_0x1d6eb4){freeIsNotKey(_0x1d6eb4,_0x581879[_0xd70e('0x17')],'name');for(var _0x267d7b=0x0,_0x3b25d3={};_0x267d7b<_0x1d6eb4[_0xd70e('0x42')];_0x267d7b+=0x1){_0x3b25d3=_0x1d6eb4[_0x267d7b];if(_[_0xd70e('0x45')](_0x581879[_0xd70e('0x17')][_0x3b25d3[_0xd70e('0x29')]])){_0x581879[_0xd70e('0x17')][_0x3b25d3['name']]=new Campaign(_0x3b25d3);}else{_0x581879[_0xd70e('0x40')](_0x581879[_0xd70e('0x17')][_0x3b25d3[_0xd70e('0x29')]],_0x3b25d3);_0x581879[_0xd70e('0x17')][_0x3b25d3[_0xd70e('0x29')]][_0xd70e('0x68')]=_0x3b25d3[_0xd70e('0x69')]?_0x3b25d3[_0xd70e('0x69')][_0xd70e('0x29')]:undefined;}}}return _0x581879[_0xd70e('0x17')];};};Realtime[_0xd70e('0x41')][_0xd70e('0x6a')]=function(){var _0x9ffb91=this;return function(_0x460a3e){if(_0x460a3e){freeIsNotKey(_0x460a3e,_0x9ffb91['voiceExtensions'],'id');for(var _0x5894fb=0x0,_0x5daa2c={};_0x5894fb<_0x460a3e['length'];_0x5894fb+=0x1){_0x5daa2c=_0x460a3e[_0x5894fb];if(_['isUndefined'](_0x9ffb91[_0xd70e('0x6b')][_0x5daa2c['id']])){_0x9ffb91[_0xd70e('0x6b')][_0x5daa2c['id']]=new VoiceExtension(_0x5daa2c);}else{_0x9ffb91['mergeFromDatabase'](_0x9ffb91['voiceExtensions'][_0x5daa2c['id']],_0x5daa2c);}}}return _0x9ffb91[_0xd70e('0x6b')];};};Realtime[_0xd70e('0x41')]['initCampaignHopperHistory']=function(){var _0x22a620=this;return function(_0x5122b8){clearCampaigns(_0x22a620[_0xd70e('0x17')]);for(var _0x5e23f4=0x0;_0x5e23f4<_0x5122b8['length'];_0x5e23f4+=0x1){_[_0xd70e('0x54')](_0x22a620[_0xd70e('0x17')][_0x5122b8[_0x5e23f4][_0xd70e('0x29')]],_0x5122b8[_0x5e23f4]);}return _0x22a620[_0xd70e('0x17')];};};Realtime[_0xd70e('0x41')]['initFaxAccounts']=function(){var _0x5d6af3=this;return function(_0x1796e1){if(_0x1796e1){freeIsNotKey(_0x1796e1,_0x5d6af3['faxAccounts'],'id');for(var _0x1380f4=0x0,_0x278497={},_0x22f915={};_0x1380f4<_0x1796e1[_0xd70e('0x42')];_0x1380f4+=0x1){_0x278497=_0x1796e1[_0x1380f4];if(_[_0xd70e('0x45')](_0x5d6af3[_0xd70e('0x25')][_0x278497['id']])){_0x5d6af3[_0xd70e('0x25')][_0x278497['id']]=new FaxAccount(_0x278497);}else{_0x5d6af3[_0xd70e('0x40')](_0x5d6af3[_0xd70e('0x25')][_0x278497['id']],_0x278497);}}}return _0x5d6af3[_0xd70e('0x25')];};};module[_0xd70e('0x6c')]=Realtime; \ No newline at end of file +var _0x91f4=['initTrunks','initVoiceQueues','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','deskAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','unmanaged','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','faxAccounts','exports','util','lodash','moment','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/freshsalesAccount','telephones','trunks','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','channels','timers','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','mapKeys','hasOwnProperty','format','SIP/%s','isNil','interface','name','total','answered','sumHoldTime','sumBillable','ivrTotalCallsDays','isEmpty','abandoned','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','prototype','agents','length','isUndefined','mergeFromDatabase','initTelephones'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x91f4,0x179));var _0x491f=function(_0x2d3378,_0x3d9942){_0x2d3378=_0x2d3378-0x0;var _0x17fc50=_0x91f4[_0x2d3378];return _0x17fc50;};'use strict';var BPromise=require('bluebird');var util=require(_0x491f('0x0'));var _=require(_0x491f('0x1'));var moment=require(_0x491f('0x2'));var Agent=require('../model/agent');var Telephone=require(_0x491f('0x3'));var Trunk=require(_0x491f('0x4'));var VoiceQueue=require(_0x491f('0x5'));var Trigger=require(_0x491f('0x6'));var Template=require(_0x491f('0x7'));var Campaign=require(_0x491f('0x8'));var VoiceExtension=require(_0x491f('0x9'));var ZendeskAccount=require(_0x491f('0xa'));var SalesforceAccount=require(_0x491f('0xb'));var FreshdeskAccount=require(_0x491f('0xc'));var SugarcrmAccount=require(_0x491f('0xd'));var ZohoAccount=require(_0x491f('0xe'));var DeskAccount=require(_0x491f('0xf'));var VtigerAccount=require(_0x491f('0x10'));var ServicenowAccount=require(_0x491f('0x11'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0x491f('0x12'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this['agents']={};this[_0x491f('0x13')]={};this[_0x491f('0x14')]={};this[_0x491f('0x15')]={};this[_0x491f('0x16')]={};this[_0x491f('0x17')]={};this[_0x491f('0x18')]={};this[_0x491f('0x19')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x491f('0x1a')]={};this[_0x491f('0x1b')]={};this['queueChannels']={};this['outboundChannels']={};this[_0x491f('0x1c')]={};this[_0x491f('0x1d')]={};this[_0x491f('0x1e')]={};this[_0x491f('0x1f')]={};this[_0x491f('0x20')]={};this[_0x491f('0x21')]={};this['deskAccounts']={};this[_0x491f('0x22')]={};this[_0x491f('0x23')]={};this[_0x491f('0x24')]={};this[_0x491f('0x25')]={};this['faxAccounts']={};};function freeIsNotKey(_0x2e8418,_0x1e58b6,_0x169609){var _0x599b6f=_[_0x491f('0x26')](_0x2e8418,function(_0x568a50,_0x59e700){return _0x568a50[_0x169609];});for(var _0x1a931b in _0x1e58b6){if(_0x1e58b6[_0x491f('0x27')](_0x1a931b)){if(!_0x599b6f[_0x1a931b]){delete _0x1e58b6[_0x1a931b];}}}}function freeIsNotKeySip(_0xef6689,_0x36f82f){var _0x2e1b23=_['mapKeys'](_0xef6689,function(_0x4599bf,_0x3cd014){return util[_0x491f('0x28')](_0x491f('0x29'),_0x4599bf['name']);});for(var _0x138645 in _0x36f82f){if(_0x36f82f[_0x491f('0x27')](_0x138645)){if(!_0x2e1b23[_0x138645]){delete _0x36f82f[_0x138645];}}}}function freeIsNotKeyAgent(_0x457d0f,_0x475c8d){var _0x4dd127=_['mapKeys'](_0x457d0f,function(_0xb56514,_0x23a237){var _0x46ba8a=_[_0x491f('0x2a')](_0xb56514[_0x491f('0x2b')])?util[_0x491f('0x28')](_0x491f('0x29'),_0xb56514[_0x491f('0x2c')]):_0xb56514[_0x491f('0x2b')];return _0x46ba8a;});for(var _0x53d88a in _0x475c8d){if(_0x475c8d[_0x491f('0x27')](_0x53d88a)){if(!_0x4dd127[_0x53d88a]){delete _0x475c8d[_0x53d88a];}}}}function clearVoiceCallReports(_0x204250){_0x204250[_0x491f('0x2d')]=0x0;_0x204250[_0x491f('0x2e')]=0x0;_0x204250[_0x491f('0x2f')]=0x0;_0x204250['sumDuration']=0x0;_0x204250[_0x491f('0x30')]=0x0;}function clearCampaigns(_0x50850a){if(!_['isEmpty'](_0x50850a)){for(var _0x13ca84 in _0x50850a){if(_0x50850a[_0x491f('0x27')](_0x13ca84)){_0x50850a[_0x13ca84][_0x491f('0x31')]=0x0;_0x50850a[_0x13ca84]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x5aaf7c){if(!_[_0x491f('0x32')](_0x5aaf7c)){for(var _0x3624d4 in _0x5aaf7c){if(_0x5aaf7c[_0x491f('0x27')](_0x3624d4)){_0x5aaf7c[_0x3624d4][_0x491f('0x2d')]=0x0;_0x5aaf7c[_0x3624d4][_0x491f('0x2e')]=0x0;_0x5aaf7c[_0x3624d4]['unmanaged']=0x0;_0x5aaf7c[_0x3624d4][_0x491f('0x33')]=0x0;_0x5aaf7c[_0x3624d4][_0x491f('0x2f')]=0x0;_0x5aaf7c[_0x3624d4][_0x491f('0x34')]=0x0;_0x5aaf7c[_0x3624d4]['sumBillable']=0x0;_0x5aaf7c[_0x3624d4][_0x491f('0x35')]=0x0;_0x5aaf7c[_0x3624d4][_0x491f('0x36')]=0x0;_0x5aaf7c[_0x3624d4][_0x491f('0x37')]=0x0;_0x5aaf7c[_0x3624d4][_0x491f('0x38')]=0x0;_0x5aaf7c[_0x3624d4][_0x491f('0x39')]=0x0;_0x5aaf7c[_0x3624d4][_0x491f('0x3a')]=0x0;_0x5aaf7c[_0x3624d4][_0x491f('0x3b')]=0x0;_0x5aaf7c[_0x3624d4][_0x491f('0x3c')]=0x0;_0x5aaf7c[_0x3624d4][_0x491f('0x3d')]=0x0;_0x5aaf7c[_0x3624d4]['outboundOriginateFailureCallsDay']=0x0;_0x5aaf7c[_0x3624d4][_0x491f('0x3e')]=0x0;_0x5aaf7c[_0x3624d4][_0x491f('0x3f')]=0x0;_0x5aaf7c[_0x3624d4][_0x491f('0x35')]=0x0;_0x5aaf7c[_0x3624d4]['outboundAnswerCallsDay']=0x0;_0x5aaf7c[_0x3624d4][_0x491f('0x40')]=!![];}}}}Realtime[_0x491f('0x41')]['mergeFromDatabase']=function(_0x104eb8,_0x490e0b){for(var _0xad3de0 in _0x490e0b){if(_0x104eb8[_0x491f('0x27')](_0xad3de0)){_0x104eb8[_0xad3de0]=_0x490e0b[_0xad3de0];}}};Realtime[_0x491f('0x41')]['initAgents']=function(){var _0x32b525=this;return function(_0x324918){if(_0x324918){freeIsNotKeyAgent(_0x324918,_0x32b525[_0x491f('0x42')]);for(var _0x55c73e=0x0,_0x319aa8={},_0x241af6={};_0x55c73e<_0x324918[_0x491f('0x43')];_0x55c73e+=0x1){_0x319aa8=_0x324918[_0x55c73e];var _0x2dfd29=_[_0x491f('0x2a')](_0x319aa8[_0x491f('0x2b')])?util[_0x491f('0x28')](_0x491f('0x29'),_0x319aa8[_0x491f('0x2c')]):_0x319aa8['interface'];if(_[_0x491f('0x44')](_0x32b525[_0x491f('0x42')][_0x2dfd29])){_0x32b525[_0x491f('0x42')][_0x2dfd29]=new Agent(_0x319aa8);}else{_0x32b525[_0x491f('0x45')](_0x32b525[_0x491f('0x42')][_0x2dfd29],_0x319aa8);}}}return _0x32b525[_0x491f('0x42')];};};Realtime[_0x491f('0x41')][_0x491f('0x46')]=function(){var _0x1793db=this;return function(_0x43d29f){if(_0x43d29f){freeIsNotKeySip(_0x43d29f,_0x1793db[_0x491f('0x13')]);for(var _0x153399=0x0,_0x15bb38={},_0x29aa99={};_0x153399<_0x43d29f[_0x491f('0x43')];_0x153399+=0x1){_0x15bb38=_0x43d29f[_0x153399];if(_[_0x491f('0x44')](_0x1793db[_0x491f('0x13')][util[_0x491f('0x28')](_0x491f('0x29'),_0x15bb38[_0x491f('0x2c')])])){_0x1793db[_0x491f('0x13')][util['format'](_0x491f('0x29'),_0x15bb38[_0x491f('0x2c')])]=new Telephone(_0x15bb38);}else{_0x1793db[_0x491f('0x45')](_0x1793db[_0x491f('0x13')][util[_0x491f('0x28')](_0x491f('0x29'),_0x15bb38[_0x491f('0x2c')])],_0x15bb38);}}}return _0x1793db[_0x491f('0x13')];};};Realtime[_0x491f('0x41')][_0x491f('0x47')]=function(){var _0x275ac9=this;return function(_0x2e66d1){if(_0x2e66d1){freeIsNotKeySip(_0x2e66d1,_0x275ac9[_0x491f('0x14')]);for(var _0xeff960=0x0,_0x21acae={},_0x310fb5={};_0xeff960<_0x2e66d1['length'];_0xeff960+=0x1){_0x21acae=_0x2e66d1[_0xeff960];if(_[_0x491f('0x44')](_0x275ac9[_0x491f('0x14')][util[_0x491f('0x28')]('SIP/%s',_0x21acae[_0x491f('0x2c')])])){_0x275ac9[_0x491f('0x14')][util[_0x491f('0x28')]('SIP/%s',_0x21acae[_0x491f('0x2c')])]=new Trunk(_0x21acae);}else{_0x275ac9[_0x491f('0x45')](_0x275ac9['trunks'][util[_0x491f('0x28')](_0x491f('0x29'),_0x21acae[_0x491f('0x2c')])],_0x21acae);}}}return _0x275ac9[_0x491f('0x14')];};};Realtime[_0x491f('0x41')][_0x491f('0x48')]=function(){var _0x2d8f68=this;return function(_0x127d1d){if(_0x127d1d){freeIsNotKey(_0x127d1d,_0x2d8f68[_0x491f('0x15')],_0x491f('0x2c'));for(var _0xa92c86=0x0,_0x109fa0={},_0x5be13e={};_0xa92c86<_0x127d1d[_0x491f('0x43')];_0xa92c86+=0x1){_0x109fa0=_0x127d1d[_0xa92c86];if(_[_0x491f('0x44')](_0x2d8f68[_0x491f('0x15')][_0x109fa0['name']])){_0x2d8f68[_0x491f('0x15')][_0x109fa0[_0x491f('0x2c')]]=new VoiceQueue(_0x109fa0);}else{_0x2d8f68[_0x491f('0x45')](_0x2d8f68[_0x491f('0x15')][_0x109fa0[_0x491f('0x2c')]],_0x109fa0);}}}return _0x2d8f68[_0x491f('0x15')];};};Realtime[_0x491f('0x41')][_0x491f('0x49')]=function(){var _0x299b3c=this;return function(_0x232644){if(_0x232644){freeIsNotKey(_0x232644,_0x299b3c['triggers'],'id');for(var _0x540740=0x0,_0x5341f4={},_0x4d0a6c={};_0x540740<_0x232644[_0x491f('0x43')];_0x540740+=0x1){_0x5341f4=_0x232644[_0x540740];if(_[_0x491f('0x44')](_0x299b3c[_0x491f('0x16')][_0x5341f4['id']])){_0x299b3c[_0x491f('0x16')][_0x5341f4['id']]=new Trigger(_0x5341f4);}else{_0x299b3c[_0x491f('0x45')](_0x299b3c[_0x491f('0x16')][_0x5341f4['id']],_0x5341f4);}}}return _0x299b3c[_0x491f('0x16')];};};Realtime[_0x491f('0x41')][_0x491f('0x4a')]=function(){var _0x3215a7=this;return function(_0x4ec550){if(_0x4ec550){freeIsNotKey(_0x4ec550,_0x3215a7[_0x491f('0x18')],'id');for(var _0x2bdeff=0x0,_0x4a02eb={},_0xff7e32={};_0x2bdeff<_0x4ec550[_0x491f('0x43')];_0x2bdeff+=0x1){_0x4a02eb=_0x4ec550[_0x2bdeff];if(_['isUndefined'](_0x3215a7['templates'][_0x4a02eb['id']])){_0x3215a7[_0x491f('0x18')][_0x4a02eb['id']]=new Template(_0x4a02eb);}else{_0x3215a7[_0x491f('0x45')](_0x3215a7[_0x491f('0x18')][_0x4a02eb['id']],_0x4a02eb);}}}return _0x3215a7[_0x491f('0x18')];};};Realtime['prototype'][_0x491f('0x4b')]=function(){var _0x5a5fad=this;return function(_0x10ca05){if(_0x10ca05){freeIsNotKey(_0x10ca05,_0x5a5fad[_0x491f('0x1d')],'id');for(var _0xce502f=0x0,_0x300567={},_0x2dbac0={};_0xce502f<_0x10ca05[_0x491f('0x43')];_0xce502f+=0x1){_0x300567=_0x10ca05[_0xce502f];if(_[_0x491f('0x44')](_0x5a5fad['zendeskAccounts'][_0x300567['id']])){_0x5a5fad[_0x491f('0x1d')][_0x300567['id']]=new ZendeskAccount(_0x300567);}else{_0x5a5fad[_0x491f('0x45')](_0x5a5fad[_0x491f('0x1d')][_0x300567['id']],_0x300567);}}}return _0x5a5fad[_0x491f('0x1d')];};};Realtime['prototype'][_0x491f('0x4c')]=function(){var _0x4b08b6=this;return function(_0x58433f){if(_0x58433f){freeIsNotKey(_0x58433f,_0x4b08b6[_0x491f('0x1e')],'id');for(var _0x8bfa82=0x0,_0x42b784={},_0x52e559={};_0x8bfa82<_0x58433f[_0x491f('0x43')];_0x8bfa82+=0x1){_0x42b784=_0x58433f[_0x8bfa82];if(_['isUndefined'](_0x4b08b6[_0x491f('0x1e')][_0x42b784['id']])){_0x4b08b6['salesforceAccounts'][_0x42b784['id']]=new SalesforceAccount(_0x42b784);}else{_0x4b08b6[_0x491f('0x45')](_0x4b08b6[_0x491f('0x1e')][_0x42b784['id']],_0x42b784);}}}return _0x4b08b6['salesforceAccounts'];};};Realtime[_0x491f('0x41')][_0x491f('0x4d')]=function(){var _0x5c06b0=this;return function(_0x1cb094){if(_0x1cb094){freeIsNotKey(_0x1cb094,_0x5c06b0[_0x491f('0x20')],'id');for(var _0x44b867=0x0,_0x4d1d6a={},_0x237943={};_0x44b867<_0x1cb094['length'];_0x44b867+=0x1){_0x4d1d6a=_0x1cb094[_0x44b867];if(_['isUndefined'](_0x5c06b0[_0x491f('0x20')][_0x4d1d6a['id']])){_0x5c06b0['freshdeskAccounts'][_0x4d1d6a['id']]=new FreshdeskAccount(_0x4d1d6a);}else{_0x5c06b0[_0x491f('0x45')](_0x5c06b0['freshdeskAccounts'][_0x4d1d6a['id']],_0x4d1d6a);}}}return _0x5c06b0[_0x491f('0x20')];};};Realtime[_0x491f('0x41')][_0x491f('0x4e')]=function(){var _0x2577c2=this;return function(_0x2196a0){if(_0x2196a0){freeIsNotKey(_0x2196a0,_0x2577c2['zohoAccounts'],'id');for(var _0x2b8aa7=0x0,_0x5a311f={},_0xb0fc65={};_0x2b8aa7<_0x2196a0[_0x491f('0x43')];_0x2b8aa7+=0x1){_0x5a311f=_0x2196a0[_0x2b8aa7];if(_[_0x491f('0x44')](_0x2577c2['zohoAccounts'][_0x5a311f['id']])){_0x2577c2[_0x491f('0x21')][_0x5a311f['id']]=new ZohoAccount(_0x5a311f);}else{_0x2577c2[_0x491f('0x45')](_0x2577c2['zohoAccounts'][_0x5a311f['id']],_0x5a311f);}}}return _0x2577c2['zohoAccounts'];};};Realtime['prototype'][_0x491f('0x4f')]=function(){var _0x5dca52=this;return function(_0x1276e7){if(_0x1276e7){freeIsNotKey(_0x1276e7,_0x5dca52[_0x491f('0x50')],'id');for(var _0x22b8b7=0x0,_0x19c268={},_0x340749={};_0x22b8b7<_0x1276e7['length'];_0x22b8b7+=0x1){_0x19c268=_0x1276e7[_0x22b8b7];if(_[_0x491f('0x44')](_0x5dca52['deskAccounts'][_0x19c268['id']])){_0x5dca52[_0x491f('0x50')][_0x19c268['id']]=new DeskAccount(_0x19c268);}else{_0x5dca52[_0x491f('0x45')](_0x5dca52[_0x491f('0x50')][_0x19c268['id']],_0x19c268);}}}return _0x5dca52[_0x491f('0x50')];};};Realtime['prototype']['initSugarcrmAccounts']=function(){var _0x54ec1e=this;return function(_0x4e4ad9){if(_0x4e4ad9){freeIsNotKey(_0x4e4ad9,_0x54ec1e['sugarcrmAccounts'],'id');for(var _0xddeaff=0x0,_0x276978={},_0x25e0ee={};_0xddeaff<_0x4e4ad9[_0x491f('0x43')];_0xddeaff+=0x1){_0x276978=_0x4e4ad9[_0xddeaff];if(_[_0x491f('0x44')](_0x54ec1e[_0x491f('0x1f')][_0x276978['id']])){_0x54ec1e['sugarcrmAccounts'][_0x276978['id']]=new SugarcrmAccount(_0x276978);}else{_0x54ec1e[_0x491f('0x45')](_0x54ec1e[_0x491f('0x1f')][_0x276978['id']],_0x276978);}}}return _0x54ec1e[_0x491f('0x1f')];};};Realtime[_0x491f('0x41')][_0x491f('0x51')]=function(){var _0x1708b9=this;return function(_0x41f20d){if(_0x41f20d){freeIsNotKey(_0x41f20d,_0x1708b9[_0x491f('0x22')],'id');for(var _0x306faf=0x0,_0x3edb12={},_0x17a201={};_0x306faf<_0x41f20d[_0x491f('0x43')];_0x306faf+=0x1){_0x3edb12=_0x41f20d[_0x306faf];if(_['isUndefined'](_0x1708b9[_0x491f('0x22')][_0x3edb12['id']])){_0x1708b9['vtigerAccounts'][_0x3edb12['id']]=new VtigerAccount(_0x3edb12);}else{_0x1708b9[_0x491f('0x45')](_0x1708b9['vtigerAccounts'][_0x3edb12['id']],_0x3edb12);}}}return _0x1708b9[_0x491f('0x22')];};};Realtime[_0x491f('0x41')][_0x491f('0x52')]=function(){var _0x2932ea=this;return function(_0x217df9){if(_0x217df9){freeIsNotKey(_0x217df9,_0x2932ea['servicenowAccounts'],'id');for(var _0x425388=0x0,_0x67497f={},_0x18c8bd={};_0x425388<_0x217df9['length'];_0x425388+=0x1){_0x67497f=_0x217df9[_0x425388];if(_[_0x491f('0x44')](_0x2932ea[_0x491f('0x23')][_0x67497f['id']])){_0x2932ea[_0x491f('0x23')][_0x67497f['id']]=new ServicenowAccount(_0x67497f);}else{_0x2932ea[_0x491f('0x45')](_0x2932ea[_0x491f('0x23')][_0x67497f['id']],_0x67497f);}}}return _0x2932ea[_0x491f('0x23')];};};Realtime[_0x491f('0x41')][_0x491f('0x53')]=function(){var _0x141803=this;return function(_0x52622a){if(_0x52622a){freeIsNotKey(_0x52622a,_0x141803[_0x491f('0x24')],'id');for(var _0x11b09a=0x0,_0x49be72={},_0x583826={};_0x11b09a<_0x52622a[_0x491f('0x43')];_0x11b09a+=0x1){_0x49be72=_0x52622a[_0x11b09a];if(_['isUndefined'](_0x141803[_0x491f('0x24')][_0x49be72['id']])){_0x141803[_0x491f('0x24')][_0x49be72['id']]=new Dynamics365Account(_0x49be72);}else{_0x141803[_0x491f('0x45')](_0x141803[_0x491f('0x24')][_0x49be72['id']],_0x49be72);}}}return _0x141803[_0x491f('0x24')];};};Realtime[_0x491f('0x41')][_0x491f('0x54')]=function(){var _0x23657b=this;return function(_0xf8f387){if(_0xf8f387){freeIsNotKey(_0xf8f387,_0x23657b[_0x491f('0x25')],'id');for(var _0x4d4b47=0x0,_0x2299a0={},_0x101df6={};_0x4d4b47<_0xf8f387[_0x491f('0x43')];_0x4d4b47+=0x1){_0x2299a0=_0xf8f387[_0x4d4b47];if(_[_0x491f('0x44')](_0x23657b[_0x491f('0x25')][_0x2299a0['id']])){_0x23657b[_0x491f('0x25')][_0x2299a0['id']]=new FreshsalesAccount(_0x2299a0);}else{_0x23657b['mergeFromDatabase'](_0x23657b[_0x491f('0x25')][_0x2299a0['id']],_0x2299a0);}}}return _0x23657b[_0x491f('0x25')];};};Realtime['prototype']['initVoiceQueueHopperHistory']=function(){var _0x541420=this;return function(_0x1fb54c){for(var _0x1a93fb=0x0;_0x1a93fb<_0x1fb54c[_0x491f('0x43')];_0x1a93fb+=0x1){_[_0x491f('0x55')](_0x541420['voiceQueues'][_0x1fb54c[_0x1a93fb][_0x491f('0x2c')]],_0x1fb54c[_0x1a93fb]);}return _0x541420[_0x491f('0x15')];};};Realtime[_0x491f('0x41')][_0x491f('0x56')]=function(){var _0x10a506=this;return function(_0x1863ef){clearVoiceQueues(_0x10a506['voiceQueues']);if(_0x1863ef){_0x1863ef=_[_0x491f('0x57')](_0x1863ef,_0x491f('0x58'));for(var _0x2e6b57 in _0x1863ef){if(_0x1863ef[_0x491f('0x27')](_0x2e6b57)){var _0x49da22={};for(var _0x599858=0x0;_0x599858<_0x1863ef[_0x2e6b57][_0x491f('0x43')];_0x599858+=0x1){var _0x3f18b4=_0x1863ef[_0x2e6b57][_0x599858][_0x491f('0x59')];if(_0x10a506['voiceQueues'][_0x3f18b4]){if(_0x1863ef[_0x2e6b57][_0x599858][_0x491f('0x5a')]){_0x10a506['voiceQueues'][_0x3f18b4][_0x491f('0x5b')]+=0x1;}if(_0x1863ef[_0x2e6b57][_0x599858][_0x491f('0x5c')]){_0x10a506[_0x491f('0x15')][_0x3f18b4]['abandoned']+=0x1;}_0x10a506['voiceQueues'][_0x3f18b4][_0x491f('0x2f')]+=moment(_0x1863ef[_0x2e6b57][_0x599858][_0x491f('0x5d')])[_0x491f('0x5e')](moment(_0x1863ef[_0x2e6b57][_0x599858][_0x491f('0x5f')]),_0x491f('0x60'))||0x0;if(_0x599858===_0x1863ef[_0x2e6b57][_0x491f('0x43')]-0x1){_0x10a506['voiceQueues'][_0x3f18b4][_0x491f('0x34')]+=moment(_0x1863ef[_0x2e6b57][_0x599858][_0x491f('0x61')]||_0x1863ef[_0x2e6b57][_0x599858][_0x491f('0x62')]||_0x1863ef[_0x2e6b57][_0x599858][_0x491f('0x63')])[_0x491f('0x5e')](moment(_0x1863ef[_0x2e6b57][_0x599858][_0x491f('0x5f')]),_0x491f('0x60'))||0x0;_0x10a506['voiceQueues'][_0x3f18b4][_0x491f('0x2d')]+=0x1;if(_0x1863ef[_0x2e6b57][_0x599858]['queuecallercomplete']){_0x10a506[_0x491f('0x15')][_0x3f18b4][_0x491f('0x2e')]+=0x1;_0x10a506[_0x491f('0x15')][_0x3f18b4][_0x491f('0x30')]+=moment(_0x1863ef[_0x2e6b57][_0x599858][_0x491f('0x61')])['diff'](moment(_0x1863ef[_0x2e6b57][_0x599858]['queuecallerleaveAt']),_0x491f('0x60'))||0x0;}}else{_0x10a506['voiceQueues'][_0x3f18b4][_0x491f('0x34')]+=_0x10a506[_0x491f('0x15')][_0x3f18b4]['sumHoldTime']||0x0;}}}}}}return _0x10a506['voiceQueues'];};};Realtime[_0x491f('0x41')]['initVoiceCallReports']=function(){var _0x1ddf4d=this;return function(_0x431b06){clearVoiceCallReports(_0x1ddf4d[_0x491f('0x19')]);if(_0x431b06){for(var _0x3ac63b=0x0;_0x3ac63b<_0x431b06[_0x491f('0x43')];_0x3ac63b+=0x1){_0x1ddf4d[_0x491f('0x19')][_0x491f('0x2d')]+=0x1;_0x1ddf4d[_0x491f('0x19')][_0x491f('0x34')]+=_0x431b06[_0x3ac63b][_0x491f('0x64')];if(_0x431b06[_0x3ac63b][_0x491f('0x65')]===_0x491f('0x66')){_0x1ddf4d[_0x491f('0x19')]['answered']+=0x1;_0x1ddf4d[_0x491f('0x19')][_0x491f('0x2f')]+=_0x431b06[_0x3ac63b][_0x491f('0x64')]-_0x431b06[_0x3ac63b][_0x491f('0x67')]||0x0;_0x1ddf4d[_0x491f('0x19')][_0x491f('0x30')]+=_0x431b06[_0x3ac63b][_0x491f('0x67')];}}}return _0x1ddf4d[_0x491f('0x19')];};};Realtime[_0x491f('0x41')][_0x491f('0x68')]=function(){var _0x3553d7=this;return function(_0x437da8){if(_0x437da8){freeIsNotKey(_0x437da8,_0x3553d7['campaigns'],_0x491f('0x2c'));for(var _0x5394e0=0x0,_0x3edf65={};_0x5394e0<_0x437da8[_0x491f('0x43')];_0x5394e0+=0x1){_0x3edf65=_0x437da8[_0x5394e0];if(_['isUndefined'](_0x3553d7[_0x491f('0x17')][_0x3edf65[_0x491f('0x2c')]])){_0x3553d7[_0x491f('0x17')][_0x3edf65['name']]=new Campaign(_0x3edf65);}else{_0x3553d7[_0x491f('0x45')](_0x3553d7[_0x491f('0x17')][_0x3edf65[_0x491f('0x2c')]],_0x3edf65);_0x3553d7[_0x491f('0x17')][_0x3edf65[_0x491f('0x2c')]][_0x491f('0x69')]=_0x3edf65[_0x491f('0x6a')]?_0x3edf65[_0x491f('0x6a')]['name']:undefined;}}}return _0x3553d7[_0x491f('0x17')];};};Realtime[_0x491f('0x41')][_0x491f('0x6b')]=function(){var _0x34a3da=this;return function(_0x5eb74e){if(_0x5eb74e){freeIsNotKey(_0x5eb74e,_0x34a3da[_0x491f('0x1a')],'id');for(var _0x21e9ba=0x0,_0xfce723={};_0x21e9ba<_0x5eb74e[_0x491f('0x43')];_0x21e9ba+=0x1){_0xfce723=_0x5eb74e[_0x21e9ba];if(_[_0x491f('0x44')](_0x34a3da[_0x491f('0x1a')][_0xfce723['id']])){_0x34a3da[_0x491f('0x1a')][_0xfce723['id']]=new VoiceExtension(_0xfce723);}else{_0x34a3da[_0x491f('0x45')](_0x34a3da[_0x491f('0x1a')][_0xfce723['id']],_0xfce723);}}}return _0x34a3da[_0x491f('0x1a')];};};Realtime[_0x491f('0x41')][_0x491f('0x6c')]=function(){var _0x32fc40=this;return function(_0x1a46f8){clearCampaigns(_0x32fc40[_0x491f('0x17')]);for(var _0x1bd3cf=0x0;_0x1bd3cf<_0x1a46f8[_0x491f('0x43')];_0x1bd3cf+=0x1){_['merge'](_0x32fc40[_0x491f('0x17')][_0x1a46f8[_0x1bd3cf][_0x491f('0x2c')]],_0x1a46f8[_0x1bd3cf]);}return _0x32fc40[_0x491f('0x17')];};};Realtime[_0x491f('0x41')][_0x491f('0x6d')]=function(){var _0x28619d=this;return function(_0x2f1202){if(_0x2f1202){freeIsNotKey(_0x2f1202,_0x28619d[_0x491f('0x6e')],'id');for(var _0x194948=0x0,_0x24bb46={},_0xa48e6e={};_0x194948<_0x2f1202[_0x491f('0x43')];_0x194948+=0x1){_0x24bb46=_0x2f1202[_0x194948];if(_['isUndefined'](_0x28619d[_0x491f('0x6e')][_0x24bb46['id']])){_0x28619d[_0x491f('0x6e')][_0x24bb46['id']]=new FaxAccount(_0x24bb46);}else{_0x28619d['mergeFromDatabase'](_0x28619d[_0x491f('0x6e')][_0x24bb46['id']],_0x24bb46);}}}return _0x28619d['faxAccounts'];};};module[_0x491f('0x6f')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 3b251cf..eb2785e 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 _0xedc7=['exten','type','queue','lastdata','context','from-voip-provider','xcally-motion-preview','calleridnum','originatecalleridnum','destinationchannel','channel','callerid','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','monitor','monitors','monitorFilename','connectedlinename','membername','xcally-motion-dialer','isArray','voiceDialReport','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','blindTransfer','exports','bluebird','lodash','util','../../../config/environment','../../../config/logger','../ami','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./userReport','agents','telephones','sync','realtime','xdr','disabled','voiceQueueReport','bind','custom:voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','prototype','findAgent','find','accountcode','isNil','name','interface','format','SIP/%s','length','connectedlinenum','assigned','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','create','match','voiceCallReport','destination'];(function(_0x25f983,_0x352b9d){var _0x50a304=function(_0x2bc5db){while(--_0x2bc5db){_0x25f983['push'](_0x25f983['shift']());}};_0x50a304(++_0x352b9d);}(_0xedc7,0x117));var _0x7edc=function(_0x423106,_0x4c07e0){_0x423106=_0x423106-0x0;var _0x1611ae=_0xedc7[_0x423106];return _0x1611ae;};'use strict';var BPromise=require(_0x7edc('0x0'));var _=require(_0x7edc('0x1'));var moment=require('moment');var util=require(_0x7edc('0x2'));var config=require(_0x7edc('0x3'));var logger=require(_0x7edc('0x4'))('ami');var ami=require(_0x7edc('0x5'));var RpcVoiceAgentReport=require(_0x7edc('0x6'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x7edc('0x7'));var RpcMemberReport=require(_0x7edc('0x8'));var RpcVoiceQueueReport=require(_0x7edc('0x9'));var RpcVoiceRecording=require(_0x7edc('0xa'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x7edc('0xb'));var VoiceCallReport=require(_0x7edc('0xc'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x7edc('0xd'));function Report(_0x1a316b){this['realtime']=_0x1a316b;this[_0x7edc('0xe')]=_0x1a316b[_0x7edc('0xe')];this['telephones']=_0x1a316b[_0x7edc('0xf')];}Report['prototype'][_0x7edc('0x10')]=function(_0x10b04d){var _0x2d0bfe=new VoiceQueueReport(this[_0x7edc('0x11')]);var _0x5f11e3=new VoiceAgentReport(this['realtime']);var _0x2a88e9=new VoiceDialReport(this[_0x7edc('0x11')]);var _0x5ad380=new VoiceCallReport(this[_0x7edc('0x11')]);var _0x22116d=new UserReport(this['realtime']);if(config[_0x7edc('0x12')]&&config['xdr'][_0x7edc('0x13')]){ami['on']('custom:voiceQueueReport',this[_0x7edc('0x14')][_0x7edc('0x15')](this));ami['on'](_0x7edc('0x16'),this['voiceCallReport'][_0x7edc('0x15')](this));ami['on'](_0x7edc('0x17'),this[_0x7edc('0x18')][_0x7edc('0x15')](this));ami['on'](_0x7edc('0x19'),this['voiceDialReport'][_0x7edc('0x15')](this));ami['on'](_0x7edc('0x1a'),this['blindTransfer']['bind'](this));ami['on'](_0x7edc('0x1b'),this[_0x7edc('0x1c')]['bind'](this));}};Report[_0x7edc('0x1d')][_0x7edc('0x1e')]=function(_0x2e18ff){var _0x16b1d8=undefined;_0x16b1d8=_[_0x7edc('0x1f')](this[_0x7edc('0xe')],function(_0x51f36d){return _0x51f36d[_0x7edc('0x20')]==_0x2e18ff||_0x51f36d['name']==_0x2e18ff;});if(_[_0x7edc('0x21')](_0x16b1d8)){var _0x325180=_[_0x7edc('0x1f')](this[_0x7edc('0xf')],function(_0x43e2f0){return _0x43e2f0['accountcode']==_0x2e18ff||_0x43e2f0[_0x7edc('0x22')]==_0x2e18ff;});if(_0x325180){_0x16b1d8=_[_0x7edc('0x1f')](this[_0x7edc('0xe')],function(_0x297202){return _0x297202[_0x7edc('0x23')]==util[_0x7edc('0x24')](_0x7edc('0x25'),_0x325180[_0x7edc('0x22')]);});}}return _0x16b1d8;};Report[_0x7edc('0x1d')][_0x7edc('0x14')]=function(_0x5f1d4c){for(var _0x379786=0x0;_0x379786<_0x5f1d4c[_0x7edc('0x26')];_0x379786+=0x1){var _0x4c47b=this[_0x7edc('0x1e')](_0x5f1d4c[_0x379786][_0x7edc('0x27')]);if(_0x4c47b){_0x5f1d4c[_0x379786][_0x7edc('0x20')]=_0x4c47b[_0x7edc('0x20')];_0x5f1d4c[_0x379786][_0x7edc('0x28')]=!![];_0x5f1d4c[_0x379786]['lastAssignedTo']=_0x4c47b[_0x7edc('0x22')];_0x5f1d4c[_0x379786][_0x7edc('0x23')]=_[_0x7edc('0x21')](_0x4c47b[_0x7edc('0x23')])?util[_0x7edc('0x24')]('SIP/%s',_0x4c47b[_0x7edc('0x22')]):_0x4c47b[_0x7edc('0x23')];if(_0x5f1d4c[_0x379786][_0x7edc('0x29')]){_0x5f1d4c[_0x379786][_0x7edc('0x2a')]=moment()[_0x7edc('0x24')](_0x7edc('0x2b'));}if(_0x5f1d4c[_0x379786][_0x7edc('0x2c')]){_0x5f1d4c[_0x379786]['queuecallerexitAt']=moment()[_0x7edc('0x24')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport['voiceQueueReport'](_0x5f1d4c[_0x379786]);}RpcVoiceQueueReport[_0x7edc('0x2d')](_0x5f1d4c[_0x379786]);}};function extractCalleridNumber(_0x1832c0){var _0x3b8301=_0x1832c0[_0x7edc('0x2e')](/<(.*?)>/);return _0x3b8301?_0x3b8301[0x1]:_0x1832c0;}Report[_0x7edc('0x1d')][_0x7edc('0x2f')]=function(_0x492d9f){_0x492d9f[_0x7edc('0x30')]=_0x492d9f[_0x7edc('0x30')]||_0x492d9f[_0x7edc('0x31')];if(_0x492d9f[_0x7edc('0x32')]=='dialer'){_0x492d9f['lastapplication']=_0x7edc('0x33');_0x492d9f[_0x7edc('0x34')]=_0x492d9f[_0x7edc('0x33')];if(_0x492d9f[_0x7edc('0x35')]==_0x7edc('0x36')){_0x492d9f[_0x7edc('0x20')]='';_0x492d9f[_0x7edc('0x30')]=extractCalleridNumber(_0x492d9f['callerid']);}else if(_0x492d9f[_0x7edc('0x35')]=='from-sip'){if(_0x492d9f[_0x7edc('0x30')]==_0x7edc('0x37')){_0x492d9f[_0x7edc('0x30')]=extractCalleridNumber(_0x492d9f['calleridpreview']);_0x492d9f[_0x7edc('0x38')]=_0x492d9f[_0x7edc('0x39')];_0x492d9f[_0x7edc('0x3a')]=[_0x492d9f[_0x7edc('0x3b')],_0x492d9f[_0x7edc('0x3b')]=_0x492d9f['destinationchannel']][0x0];_0x492d9f[_0x7edc('0x3c')]=_0x492d9f['calleridpreview'];}else{_0x492d9f[_0x7edc('0x30')]=_0x492d9f['calleridnum'];_0x492d9f[_0x7edc('0x38')]=_0x492d9f[_0x7edc('0x39')];if(_0x492d9f[_0x7edc('0x3d')]==_0x7edc('0x3e')){_0x492d9f['accountcode']=_0x492d9f['connectedlinenum'];}else{_0x492d9f[_0x7edc('0x20')]='';}}}}else{_0x492d9f['callerid']=util[_0x7edc('0x24')](_0x7edc('0x3f'),_0x492d9f[_0x7edc('0x40')],_0x492d9f['calleridnum']);}RpcVoiceCallReport['create'](_0x492d9f);if(_0x492d9f[_0x7edc('0x41')]){for(var _0x30e36f=0x0;_0x30e36f<_0x492d9f[_0x7edc('0x42')][_0x7edc('0x26')];_0x30e36f+=0x1){_0x492d9f[_0x7edc('0x43')]=_0x492d9f[_0x7edc('0x42')][_0x30e36f]['filename'];_0x492d9f['createdAt']=_0x492d9f[_0x7edc('0x42')][_0x30e36f]['createdAt'];if(_0x492d9f[_0x7edc('0x31')]==_0x7edc('0x37')){_0x492d9f[_0x7edc('0x38')]=_0x492d9f[_0x7edc('0x27')];_0x492d9f[_0x7edc('0x40')]=_0x492d9f[_0x7edc('0x44')];_0x492d9f[_0x7edc('0x27')]=_0x492d9f[_0x7edc('0x20')];_0x492d9f[_0x7edc('0x44')]=_0x492d9f[_0x7edc('0x45')];_0x492d9f[_0x7edc('0x31')]=_0x492d9f['originatecalleridnum'];}else if(_0x492d9f['exten']==_0x7edc('0x46')){_0x492d9f[_0x7edc('0x38')]=_0x492d9f[_0x7edc('0x30')];_0x492d9f[_0x7edc('0x31')]=_0x492d9f[_0x7edc('0x39')];}RpcVoiceRecording[_0x7edc('0x2d')](_0x492d9f);}}};Report[_0x7edc('0x1d')][_0x7edc('0x18')]=function(_0x3afeb5){if(_[_0x7edc('0x47')](_0x3afeb5)){_0x3afeb5['forEach'](function(_0x5304b7){RpcVoiceAgentReport['create'](_0x5304b7);});}else{RpcVoiceAgentReport[_0x7edc('0x2d')](_0x3afeb5);}};Report[_0x7edc('0x1d')][_0x7edc('0x48')]=function(_0x3aee8e){RpcVoiceDialReport['create'](_0x3aee8e);var _0x3e3e35=undefined;var _0x40e516=_0x3aee8e[_0x7edc('0x3b')];if(_[_0x7edc('0x49')](_0x40e516,_0x7edc('0x4a'))){var _0x1b6410=_0x40e516[_0x7edc('0x4b')](_0x40e516[_0x7edc('0x4c')]('/')+0x1,_0x40e516[_0x7edc('0x4c')]('@'));_0x3e3e35=_['find'](this[_0x7edc('0xe')],function(_0x786bf0){return _0x786bf0[_0x7edc('0x4d')]==_0x1b6410||_0x786bf0[_0x7edc('0x4e')]==_0x1b6410||_0x786bf0[_0x7edc('0x20')]==_0x1b6410;});}else{var _0x1b6410=_0x40e516[_0x7edc('0x4b')](_0x40e516[_0x7edc('0x4c')]('/')+0x1,_0x40e516[_0x7edc('0x4f')]('-'));_0x3e3e35=this['findAgent'](_0x1b6410);}if(_0x3e3e35){_0x3aee8e[_0x7edc('0x23')]=_[_0x7edc('0x21')](_0x3e3e35[_0x7edc('0x23')])?util[_0x7edc('0x24')](_0x7edc('0x25'),_0x3e3e35[_0x7edc('0x22')]):_0x3e3e35[_0x7edc('0x23')];_0x3aee8e['membername']=_0x3e3e35[_0x7edc('0x22')];_0x3aee8e[_0x7edc('0x20')]=_0x3e3e35[_0x7edc('0x20')];RpcMemberReport[_0x7edc('0x48')](_0x3aee8e);}};Report[_0x7edc('0x1d')]['blindTransfer']=function(_0x53fc56){RpcVoiceTransferReport[_0x7edc('0x50')](_0x53fc56);};Report['prototype'][_0x7edc('0x1c')]=function(_0x183516){RpcVoiceTransferReport['attendedTransfer'](_0x183516);};module[_0x7edc('0x51')]=Report; \ No newline at end of file +var _0xaff2=['create','destination','exten','type','dialer','lastapplication','queue','lastdata','context','from-voip-provider','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','channel','destinationchannel','callerid','disposition','calleridname','monitors','monitorFilename','createdAt','membername','xcally-motion-dialer','voiceAgentReport','voiceDialReport','Local','substring','indexOf','mobile','phone','attendedTransfer','exports','lodash','moment','../../../config/environment','ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','sync','xdr','custom:voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','custom:voiceAgentReport','custom:voiceDialReport','blindTransfer','attendedtransfer','findAgent','find','accountcode','name','isNil','interface','format','SIP/%s','prototype','voiceQueueReport','length','connectedlinenum','assigned','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xaff2,0x15d));var _0x2aff=function(_0x5de1bc,_0x434be1){_0x5de1bc=_0x5de1bc-0x0;var _0x19f4b8=_0xaff2[_0x5de1bc];return _0x19f4b8;};'use strict';var BPromise=require('bluebird');var _=require(_0x2aff('0x0'));var moment=require(_0x2aff('0x1'));var util=require('util');var config=require(_0x2aff('0x2'));var logger=require('../../../config/logger')(_0x2aff('0x3'));var ami=require('../ami');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x2aff('0x4'));var RpcVoiceDialReport=require(_0x2aff('0x5'));var RpcMemberReport=require(_0x2aff('0x6'));var RpcVoiceQueueReport=require(_0x2aff('0x7'));var RpcVoiceRecording=require(_0x2aff('0x8'));var RpcVoiceTransferReport=require(_0x2aff('0x9'));var VoiceQueueReport=require(_0x2aff('0xa'));var VoiceCallReport=require(_0x2aff('0xb'));var VoiceAgentReport=require(_0x2aff('0xc'));var VoiceDialReport=require(_0x2aff('0xd'));var UserReport=require(_0x2aff('0xe'));function Report(_0xec0730){this[_0x2aff('0xf')]=_0xec0730;this[_0x2aff('0x10')]=_0xec0730[_0x2aff('0x10')];this['telephones']=_0xec0730[_0x2aff('0x11')];}Report['prototype'][_0x2aff('0x12')]=function(_0x124926){var _0x572702=new VoiceQueueReport(this['realtime']);var _0x462cde=new VoiceAgentReport(this[_0x2aff('0xf')]);var _0x24d37c=new VoiceDialReport(this[_0x2aff('0xf')]);var _0x1ebb7f=new VoiceCallReport(this[_0x2aff('0xf')]);var _0x261150=new UserReport(this[_0x2aff('0xf')]);if(config[_0x2aff('0x13')]&&config[_0x2aff('0x13')]['disabled']){ami['on'](_0x2aff('0x14'),this['voiceQueueReport']['bind'](this));ami['on'](_0x2aff('0x15'),this[_0x2aff('0x16')][_0x2aff('0x17')](this));ami['on'](_0x2aff('0x18'),this['voiceAgentReport'][_0x2aff('0x17')](this));ami['on'](_0x2aff('0x19'),this['voiceDialReport'][_0x2aff('0x17')](this));ami['on']('blindtransfer',this[_0x2aff('0x1a')][_0x2aff('0x17')](this));ami['on'](_0x2aff('0x1b'),this['attendedTransfer'][_0x2aff('0x17')](this));}};Report['prototype'][_0x2aff('0x1c')]=function(_0x29d931){var _0x11a381=undefined;_0x11a381=_[_0x2aff('0x1d')](this[_0x2aff('0x10')],function(_0x435a4e){return _0x435a4e[_0x2aff('0x1e')]==_0x29d931||_0x435a4e[_0x2aff('0x1f')]==_0x29d931;});if(_[_0x2aff('0x20')](_0x11a381)){var _0x2c9792=_[_0x2aff('0x1d')](this[_0x2aff('0x11')],function(_0x14c1db){return _0x14c1db['accountcode']==_0x29d931||_0x14c1db[_0x2aff('0x1f')]==_0x29d931;});if(_0x2c9792){_0x11a381=_['find'](this[_0x2aff('0x10')],function(_0x2dd864){return _0x2dd864[_0x2aff('0x21')]==util[_0x2aff('0x22')](_0x2aff('0x23'),_0x2c9792[_0x2aff('0x1f')]);});}}return _0x11a381;};Report[_0x2aff('0x24')][_0x2aff('0x25')]=function(_0x5c8b82){for(var _0x3cde68=0x0;_0x3cde68<_0x5c8b82[_0x2aff('0x26')];_0x3cde68+=0x1){var _0x33ae08=this[_0x2aff('0x1c')](_0x5c8b82[_0x3cde68][_0x2aff('0x27')]);if(_0x33ae08){_0x5c8b82[_0x3cde68][_0x2aff('0x1e')]=_0x33ae08['accountcode'];_0x5c8b82[_0x3cde68][_0x2aff('0x28')]=!![];_0x5c8b82[_0x3cde68]['lastAssignedTo']=_0x33ae08[_0x2aff('0x1f')];_0x5c8b82[_0x3cde68]['interface']=_[_0x2aff('0x20')](_0x33ae08['interface'])?util['format'](_0x2aff('0x23'),_0x33ae08[_0x2aff('0x1f')]):_0x33ae08[_0x2aff('0x21')];if(_0x5c8b82[_0x3cde68][_0x2aff('0x29')]){_0x5c8b82[_0x3cde68][_0x2aff('0x2a')]=moment()[_0x2aff('0x22')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x5c8b82[_0x3cde68][_0x2aff('0x2b')]){_0x5c8b82[_0x3cde68][_0x2aff('0x2c')]=moment()[_0x2aff('0x22')](_0x2aff('0x2d'));}RpcMemberReport[_0x2aff('0x25')](_0x5c8b82[_0x3cde68]);}RpcVoiceQueueReport[_0x2aff('0x2e')](_0x5c8b82[_0x3cde68]);}};function extractCalleridNumber(_0x44c5ab){var _0x439648=_0x44c5ab['match'](/<(.*?)>/);return _0x439648?_0x439648[0x1]:_0x44c5ab;}Report['prototype'][_0x2aff('0x16')]=function(_0x5f22d7){_0x5f22d7[_0x2aff('0x2f')]=_0x5f22d7['destination']||_0x5f22d7[_0x2aff('0x30')];if(_0x5f22d7[_0x2aff('0x31')]==_0x2aff('0x32')){_0x5f22d7[_0x2aff('0x33')]=_0x2aff('0x34');_0x5f22d7[_0x2aff('0x35')]=_0x5f22d7[_0x2aff('0x34')];if(_0x5f22d7[_0x2aff('0x36')]==_0x2aff('0x37')){_0x5f22d7['accountcode']='';_0x5f22d7[_0x2aff('0x2f')]=extractCalleridNumber(_0x5f22d7['callerid']);}else if(_0x5f22d7['context']=='from-sip'){if(_0x5f22d7[_0x2aff('0x2f')]==_0x2aff('0x38')){_0x5f22d7[_0x2aff('0x2f')]=extractCalleridNumber(_0x5f22d7[_0x2aff('0x39')]);_0x5f22d7[_0x2aff('0x3a')]=_0x5f22d7[_0x2aff('0x3b')];_0x5f22d7['destinationchannel']=[_0x5f22d7[_0x2aff('0x3c')],_0x5f22d7[_0x2aff('0x3c')]=_0x5f22d7[_0x2aff('0x3d')]][0x0];_0x5f22d7[_0x2aff('0x3e')]=_0x5f22d7[_0x2aff('0x39')];}else{_0x5f22d7[_0x2aff('0x2f')]=_0x5f22d7[_0x2aff('0x3a')];_0x5f22d7['calleridnum']=_0x5f22d7[_0x2aff('0x3b')];if(_0x5f22d7[_0x2aff('0x3f')]=='ANSWERED'){_0x5f22d7['accountcode']=_0x5f22d7[_0x2aff('0x27')];}else{_0x5f22d7['accountcode']='';}}}}else{_0x5f22d7[_0x2aff('0x3e')]=util[_0x2aff('0x22')]('\x22%s\x22\x20<%s>',_0x5f22d7[_0x2aff('0x40')],_0x5f22d7[_0x2aff('0x3a')]);}RpcVoiceCallReport[_0x2aff('0x2e')](_0x5f22d7);if(_0x5f22d7['monitor']){for(var _0x284748=0x0;_0x284748<_0x5f22d7[_0x2aff('0x41')]['length'];_0x284748+=0x1){_0x5f22d7[_0x2aff('0x42')]=_0x5f22d7[_0x2aff('0x41')][_0x284748]['filename'];_0x5f22d7['createdAt']=_0x5f22d7[_0x2aff('0x41')][_0x284748][_0x2aff('0x43')];if(_0x5f22d7[_0x2aff('0x30')]=='xcally-motion-preview'){_0x5f22d7[_0x2aff('0x3a')]=_0x5f22d7[_0x2aff('0x27')];_0x5f22d7['calleridname']=_0x5f22d7['connectedlinename'];_0x5f22d7[_0x2aff('0x27')]=_0x5f22d7[_0x2aff('0x1e')];_0x5f22d7['connectedlinename']=_0x5f22d7[_0x2aff('0x44')];_0x5f22d7[_0x2aff('0x30')]=_0x5f22d7[_0x2aff('0x3b')];}else if(_0x5f22d7[_0x2aff('0x30')]==_0x2aff('0x45')){_0x5f22d7[_0x2aff('0x3a')]=_0x5f22d7[_0x2aff('0x2f')];_0x5f22d7[_0x2aff('0x30')]=_0x5f22d7[_0x2aff('0x3b')];}RpcVoiceRecording['create'](_0x5f22d7);}}};Report[_0x2aff('0x24')][_0x2aff('0x46')]=function(_0x4403fc){if(_['isArray'](_0x4403fc)){_0x4403fc['forEach'](function(_0x2cf4e2){RpcVoiceAgentReport['create'](_0x2cf4e2);});}else{RpcVoiceAgentReport[_0x2aff('0x2e')](_0x4403fc);}};Report['prototype'][_0x2aff('0x47')]=function(_0xc4942e){RpcVoiceDialReport[_0x2aff('0x2e')](_0xc4942e);var _0x56c71e=undefined;var _0x1fd296=_0xc4942e[_0x2aff('0x3c')];if(_['startsWith'](_0x1fd296,_0x2aff('0x48'))){var _0x397daa=_0x1fd296[_0x2aff('0x49')](_0x1fd296[_0x2aff('0x4a')]('/')+0x1,_0x1fd296[_0x2aff('0x4a')]('@'));_0x56c71e=_['find'](this['agents'],function(_0x1d2ceb){return _0x1d2ceb[_0x2aff('0x4b')]==_0x397daa||_0x1d2ceb[_0x2aff('0x4c')]==_0x397daa||_0x1d2ceb['accountcode']==_0x397daa;});}else{var _0x397daa=_0x1fd296[_0x2aff('0x49')](_0x1fd296[_0x2aff('0x4a')]('/')+0x1,_0x1fd296['lastIndexOf']('-'));_0x56c71e=this['findAgent'](_0x397daa);}if(_0x56c71e){_0xc4942e['interface']=_['isNil'](_0x56c71e[_0x2aff('0x21')])?util[_0x2aff('0x22')](_0x2aff('0x23'),_0x56c71e['name']):_0x56c71e[_0x2aff('0x21')];_0xc4942e['membername']=_0x56c71e[_0x2aff('0x1f')];_0xc4942e['accountcode']=_0x56c71e[_0x2aff('0x1e')];RpcMemberReport['voiceDialReport'](_0xc4942e);}};Report[_0x2aff('0x24')][_0x2aff('0x1a')]=function(_0xccbdb3){RpcVoiceTransferReport[_0x2aff('0x1a')](_0xccbdb3);};Report[_0x2aff('0x24')][_0x2aff('0x4d')]=function(_0x322e45){RpcVoiceTransferReport[_0x2aff('0x4d')](_0x322e45);};module[_0x2aff('0x4e')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index cce9f78..e2bed62 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 _0x5cbe=['accountcode','peerstatus','peer','registered','status','address','[syncPeerStatus][UserReport]','lodash','bluebird','util','ioredis','../../../config/environment','../../../config/logger','../ami','redis','defaults','agents','telephones','registryentry','bind','registry','syncRegistry','devicestatechange','syncPeerStatus','loopSyncRealTimeShow','resolve','then','actionDeviceStateList','actionSipPeerStatus','catch','[loopSyncRealTimeShow]','error','actionSipShowRegistry','prototype','isNotNull','isUndefined','emit','trunks','username','state','merge','omit','event','actionid','format','trunk:%s','name','trunk:save','[syncRegistry][UserReport]','inspect','syncDeviceState','local','toLowerCase','inuse','device','stateTime','toNumber','updateStatusRealtime','telephone:%s','telephone:save','startsWith','Queue','substring','indexOf','mobile'];(function(_0x3e8449,_0x54e064){var _0x4a7b27=function(_0x12d9aa){while(--_0x12d9aa){_0x3e8449['push'](_0x3e8449['shift']());}};_0x4a7b27(++_0x54e064);}(_0x5cbe,0xca));var _0xe5cb=function(_0x28d124,_0x3ddb9a){_0x28d124=_0x28d124-0x0;var _0x15d6b9=_0x5cbe[_0x28d124];return _0x15d6b9;};'use strict';var _=require(_0xe5cb('0x0'));var moment=require('moment');var BPromise=require(_0xe5cb('0x1'));var util=require(_0xe5cb('0x2'));var Redis=require(_0xe5cb('0x3'));var config=require(_0xe5cb('0x4'));var logger=require(_0xe5cb('0x5'))('ami');var ami=require(_0xe5cb('0x6'));config[_0xe5cb('0x7')]=_[_0xe5cb('0x8')](config[_0xe5cb('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe5cb('0x7')]));function UserReport(_0xfc863e){this['trunks']=_0xfc863e['trunks'];this[_0xe5cb('0x9')]=_0xfc863e[_0xe5cb('0x9')];this[_0xe5cb('0xa')]=_0xfc863e[_0xe5cb('0xa')];ami['on'](_0xe5cb('0xb'),this['syncRegistry'][_0xe5cb('0xc')](this));ami['on'](_0xe5cb('0xd'),this[_0xe5cb('0xe')][_0xe5cb('0xc')](this));ami['on'](_0xe5cb('0xf'),this['syncDeviceState']['bind'](this));ami['on']('peerstatus',this[_0xe5cb('0x10')][_0xe5cb('0xc')](this));this[_0xe5cb('0x11')]();return BPromise[_0xe5cb('0x12')]()[_0xe5cb('0x13')](ami['actionSipShowRegistry']())[_0xe5cb('0x13')](ami[_0xe5cb('0x14')]())['then'](ami[_0xe5cb('0x15')]())[_0xe5cb('0x16')](loggerCatch(_0xe5cb('0x17')));}function loggerCatch(_0x5c0640){return function(_0x27b06d){logger[_0xe5cb('0x18')](_0x5c0640,util['inspect'](_0x27b06d,{'showHidden':![],'depth':null}));};}UserReport['prototype'][_0xe5cb('0x11')]=function(){setInterval(function(){BPromise[_0xe5cb('0x12')]()[_0xe5cb('0x13')](ami[_0xe5cb('0x19')]())[_0xe5cb('0x13')](ami[_0xe5cb('0x14')]())['then'](ami[_0xe5cb('0x15')]())['catch'](loggerCatch(_0xe5cb('0x17')));},0x32c8);};UserReport[_0xe5cb('0x1a')][_0xe5cb('0x1b')]=function(_0xdc192b){return _0xdc192b!==null&&!_[_0xe5cb('0x1c')](_0xdc192b);};UserReport['prototype'][_0xe5cb('0x1d')]=function(_0x1df416,_0xaefd22,_0x4cee09){io['to'](_0x1df416)[_0xe5cb('0x1d')](_0xaefd22,_0x4cee09);};UserReport['prototype']['syncRegistry']=function(_0x2e8e51){try{if(this[_0xe5cb('0x1b')](_0x2e8e51)){var _0x7fd316=_['find'](this[_0xe5cb('0x1e')],{'registry':_0x2e8e51[_0xe5cb('0x1f')]});if(_0x7fd316){_0x2e8e51['stateRegistry']=_0x2e8e51[_0xe5cb('0x20')];_[_0xe5cb('0x21')](_0x7fd316,_[_0xe5cb('0x22')](_0x2e8e51,[_0xe5cb('0x23'),_0xe5cb('0x24'),_0xe5cb('0x1f'),_0xe5cb('0x20')]));this[_0xe5cb('0x1d')](util[_0xe5cb('0x25')](_0xe5cb('0x26'),_0x7fd316[_0xe5cb('0x27')]),_0xe5cb('0x28'),_0x7fd316);}}}catch(_0x21ebe9){logger[_0xe5cb('0x18')](_0xe5cb('0x29'),util[_0xe5cb('0x2a')](_0x21ebe9,{'showHidden':![],'depth':null}));}};UserReport[_0xe5cb('0x1a')][_0xe5cb('0x2b')]=function(_0x3169b7){try{if(this[_0xe5cb('0x1b')](_0x3169b7)){if(this[_0xe5cb('0x9')][_0x3169b7['device']]){if(!this[_0xe5cb('0x9')][_0x3169b7['device']][_0xe5cb('0x2c')]||_0x3169b7['state'][_0xe5cb('0x2d')]()==_0xe5cb('0x2e')){this[_0xe5cb('0x9')][_0x3169b7[_0xe5cb('0x2f')]][_0xe5cb('0x2c')]=![];if(this['agents'][_0x3169b7['device']][_0xe5cb('0x20')]!==_0x3169b7['state'][_0xe5cb('0x2d')]()){this['agents'][_0x3169b7[_0xe5cb('0x2f')]][_0xe5cb('0x30')]=_[_0xe5cb('0x31')](moment()[_0xe5cb('0x25')]('x'));}this['agents'][_0x3169b7[_0xe5cb('0x2f')]]['state']=_0x3169b7[_0xe5cb('0x20')][_0xe5cb('0x2d')]();this[_0xe5cb('0x9')][_0x3169b7[_0xe5cb('0x2f')]][_0xe5cb('0x32')](_0x3169b7);}}else if(this[_0xe5cb('0xa')][_0x3169b7[_0xe5cb('0x2f')]]){if(this[_0xe5cb('0xa')][_0x3169b7['device']]['state']!==_0x3169b7[_0xe5cb('0x20')][_0xe5cb('0x2d')]()){this[_0xe5cb('0xa')][_0x3169b7[_0xe5cb('0x2f')]][_0xe5cb('0x30')]=_[_0xe5cb('0x31')](moment()[_0xe5cb('0x25')]('x'));}this[_0xe5cb('0xa')][_0x3169b7[_0xe5cb('0x2f')]][_0xe5cb('0x20')]=_0x3169b7['state'][_0xe5cb('0x2d')]();this['emit'](util['format'](_0xe5cb('0x33'),this['telephones'][_0x3169b7[_0xe5cb('0x2f')]][_0xe5cb('0x27')]),_0xe5cb('0x34'),this[_0xe5cb('0xa')][_0x3169b7[_0xe5cb('0x2f')]]);}else if(this['trunks'][_0x3169b7[_0xe5cb('0x2f')]]){if(this[_0xe5cb('0x1e')][_0x3169b7[_0xe5cb('0x2f')]][_0xe5cb('0x20')]!==_0x3169b7['state'][_0xe5cb('0x2d')]()){this[_0xe5cb('0x1e')][_0x3169b7[_0xe5cb('0x2f')]][_0xe5cb('0x30')]=_[_0xe5cb('0x31')](moment()[_0xe5cb('0x25')]('x'));}this[_0xe5cb('0x1e')][_0x3169b7['device']][_0xe5cb('0x20')]=_0x3169b7[_0xe5cb('0x20')][_0xe5cb('0x2d')]();this[_0xe5cb('0x1d')](util[_0xe5cb('0x25')](_0xe5cb('0x26'),this['trunks'][_0x3169b7[_0xe5cb('0x2f')]]['name']),'trunk:save',this[_0xe5cb('0x1e')][_0x3169b7[_0xe5cb('0x2f')]]);}else if(_[_0xe5cb('0x35')](_0x3169b7[_0xe5cb('0x2f')],_0xe5cb('0x36'))){}else if(_[_0xe5cb('0x35')](_0x3169b7[_0xe5cb('0x2f')],'Local')){var _0x1c9f91=_0x3169b7[_0xe5cb('0x2f')];var _0x1529c7=_0x1c9f91[_0xe5cb('0x37')](_0x1c9f91[_0xe5cb('0x38')]('/')+0x1,_0x1c9f91[_0xe5cb('0x38')]('@'));var _0x243694=_['find'](this[_0xe5cb('0x9')],function(_0x175758){return _0x175758[_0xe5cb('0x39')]==_0x1529c7||_0x175758['phone']==_0x1529c7||_0x175758[_0xe5cb('0x3a')]==_0x1529c7;});if(_0x243694){if(_0x243694[_0xe5cb('0x20')]!==_0x3169b7[_0xe5cb('0x20')][_0xe5cb('0x2d')]()){_0x243694[_0xe5cb('0x30')]=_['toNumber'](moment()[_0xe5cb('0x25')]('x'));}_0x243694[_0xe5cb('0x20')]=_0x3169b7['state'][_0xe5cb('0x2d')]();_0x243694[_0xe5cb('0x2c')]=!![];_0x243694[_0xe5cb('0x32')](_0x3169b7);}}else{}}}catch(_0x35a605){logger[_0xe5cb('0x18')]('[syncDeviceState][UserReport]',util[_0xe5cb('0x2a')](_0x35a605,{'showHidden':![],'depth':null}));}};UserReport[_0xe5cb('0x1a')][_0xe5cb('0x10')]=function(_0x400110){try{if(this['isNotNull'](_0x400110)&&this[_0xe5cb('0x1b')](_0x400110[_0xe5cb('0x3b')])){if(this[_0xe5cb('0x9')][_0x400110['peer']]){if(!this['agents'][_0x400110[_0xe5cb('0x3c')]][_0xe5cb('0x2c')]||_0x400110[_0xe5cb('0x3b')][_0xe5cb('0x2d')]()==_0xe5cb('0x3d')){this[_0xe5cb('0x9')][_0x400110['peer']]['local']=![];this['agents'][_0x400110[_0xe5cb('0x3c')]][_0xe5cb('0x3e')]=_0x400110[_0xe5cb('0x3b')][_0xe5cb('0x2d')]();this[_0xe5cb('0x9')][_0x400110['peer']][_0xe5cb('0x3f')]=_0x400110[_0xe5cb('0x3f')];this[_0xe5cb('0x9')][_0x400110[_0xe5cb('0x3c')]][_0xe5cb('0x32')](_0x400110);}}else if(this[_0xe5cb('0xa')][_0x400110['peer']]){this[_0xe5cb('0xa')][_0x400110[_0xe5cb('0x3c')]][_0xe5cb('0x3e')]=_0x400110['peerstatus'][_0xe5cb('0x2d')]();this[_0xe5cb('0xa')][_0x400110[_0xe5cb('0x3c')]][_0xe5cb('0x3f')]=_0x400110[_0xe5cb('0x3f')];this[_0xe5cb('0x1d')](util[_0xe5cb('0x25')](_0xe5cb('0x33'),this[_0xe5cb('0xa')][_0x400110['peer']][_0xe5cb('0x27')]),_0xe5cb('0x34'),this[_0xe5cb('0xa')][_0x400110[_0xe5cb('0x3c')]]);}else if(this[_0xe5cb('0x1e')][_0x400110[_0xe5cb('0x3c')]]){this[_0xe5cb('0x1e')][_0x400110[_0xe5cb('0x3c')]][_0xe5cb('0x3e')]=_0x400110['peerstatus'][_0xe5cb('0x2d')]();this[_0xe5cb('0x1e')][_0x400110['peer']][_0xe5cb('0x3f')]=_0x400110[_0xe5cb('0x3f')];this[_0xe5cb('0x1d')](util[_0xe5cb('0x25')](_0xe5cb('0x26'),this[_0xe5cb('0x1e')][_0x400110[_0xe5cb('0x3c')]][_0xe5cb('0x27')]),_0xe5cb('0x28'),this[_0xe5cb('0x1e')][_0x400110[_0xe5cb('0x3c')]]);}else{}}}catch(_0x1e0eb9){logger['error'](_0xe5cb('0x40'),util[_0xe5cb('0x2a')](_0x1e0eb9,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file +var _0xfa8f=['catch','error','prototype','[loopSyncRealTimeShow]','isNotNull','isUndefined','emit','find','username','stateRegistry','omit','event','actionid','trunk:%s','name','trunk:save','[syncRegistry][UserReport]','device','local','state','toLowerCase','stateTime','toNumber','format','telephone:%s','telephone:save','startsWith','Queue','Local','substring','indexOf','peer','registered','status','address','updateStatusRealtime','[syncPeerStatus][UserReport]','inspect','exports','moment','util','ioredis','../../../config/environment','../../../config/logger','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','syncRegistry','bind','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','resolve','actionSipShowRegistry','then','actionDeviceStateList','actionSipPeerStatus'];(function(_0x32fbee,_0x73466b){var _0x9dc2ae=function(_0x3897eb){while(--_0x3897eb){_0x32fbee['push'](_0x32fbee['shift']());}};_0x9dc2ae(++_0x73466b);}(_0xfa8f,0x123));var _0xffa8=function(_0x2a8059,_0x1e1138){_0x2a8059=_0x2a8059-0x0;var _0x4c0f5e=_0xfa8f[_0x2a8059];return _0x4c0f5e;};'use strict';var _=require('lodash');var moment=require(_0xffa8('0x0'));var BPromise=require('bluebird');var util=require(_0xffa8('0x1'));var Redis=require(_0xffa8('0x2'));var config=require(_0xffa8('0x3'));var logger=require(_0xffa8('0x4'))('ami');var ami=require(_0xffa8('0x5'));config[_0xffa8('0x6')]=_[_0xffa8('0x7')](config[_0xffa8('0x6')],{'host':_0xffa8('0x8'),'port':0x18eb});var io=require(_0xffa8('0x9'))(new Redis(config['redis']));function UserReport(_0x2b3345){this[_0xffa8('0xa')]=_0x2b3345[_0xffa8('0xa')];this[_0xffa8('0xb')]=_0x2b3345['agents'];this[_0xffa8('0xc')]=_0x2b3345[_0xffa8('0xc')];ami['on']('registryentry',this['syncRegistry']['bind'](this));ami['on']('registry',this[_0xffa8('0xd')][_0xffa8('0xe')](this));ami['on'](_0xffa8('0xf'),this[_0xffa8('0x10')][_0xffa8('0xe')](this));ami['on'](_0xffa8('0x11'),this[_0xffa8('0x12')][_0xffa8('0xe')](this));this['loopSyncRealTimeShow']();return BPromise[_0xffa8('0x13')]()['then'](ami[_0xffa8('0x14')]())[_0xffa8('0x15')](ami[_0xffa8('0x16')]())[_0xffa8('0x15')](ami[_0xffa8('0x17')]())[_0xffa8('0x18')](loggerCatch('[loopSyncRealTimeShow]'));}function loggerCatch(_0x3c4985){return function(_0x721203){logger[_0xffa8('0x19')](_0x3c4985,util['inspect'](_0x721203,{'showHidden':![],'depth':null}));};}UserReport[_0xffa8('0x1a')]['loopSyncRealTimeShow']=function(){setInterval(function(){BPromise[_0xffa8('0x13')]()[_0xffa8('0x15')](ami['actionSipShowRegistry']())[_0xffa8('0x15')](ami['actionDeviceStateList']())[_0xffa8('0x15')](ami['actionSipPeerStatus']())[_0xffa8('0x18')](loggerCatch(_0xffa8('0x1b')));},0x32c8);};UserReport[_0xffa8('0x1a')][_0xffa8('0x1c')]=function(_0x5d389f){return _0x5d389f!==null&&!_[_0xffa8('0x1d')](_0x5d389f);};UserReport[_0xffa8('0x1a')][_0xffa8('0x1e')]=function(_0x386cdd,_0xf91789,_0x378968){io['to'](_0x386cdd)[_0xffa8('0x1e')](_0xf91789,_0x378968);};UserReport[_0xffa8('0x1a')][_0xffa8('0xd')]=function(_0xfd62b9){try{if(this['isNotNull'](_0xfd62b9)){var _0x2d4346=_[_0xffa8('0x1f')](this[_0xffa8('0xa')],{'registry':_0xfd62b9[_0xffa8('0x20')]});if(_0x2d4346){_0xfd62b9[_0xffa8('0x21')]=_0xfd62b9['state'];_['merge'](_0x2d4346,_[_0xffa8('0x22')](_0xfd62b9,[_0xffa8('0x23'),_0xffa8('0x24'),_0xffa8('0x20'),'state']));this[_0xffa8('0x1e')](util['format'](_0xffa8('0x25'),_0x2d4346[_0xffa8('0x26')]),_0xffa8('0x27'),_0x2d4346);}}}catch(_0x1899d2){logger['error'](_0xffa8('0x28'),util['inspect'](_0x1899d2,{'showHidden':![],'depth':null}));}};UserReport['prototype']['syncDeviceState']=function(_0x538c88){try{if(this[_0xffa8('0x1c')](_0x538c88)){if(this[_0xffa8('0xb')][_0x538c88['device']]){if(!this[_0xffa8('0xb')][_0x538c88[_0xffa8('0x29')]][_0xffa8('0x2a')]||_0x538c88['state']['toLowerCase']()=='inuse'){this[_0xffa8('0xb')][_0x538c88[_0xffa8('0x29')]]['local']=![];if(this['agents'][_0x538c88[_0xffa8('0x29')]][_0xffa8('0x2b')]!==_0x538c88['state'][_0xffa8('0x2c')]()){this[_0xffa8('0xb')][_0x538c88[_0xffa8('0x29')]][_0xffa8('0x2d')]=_[_0xffa8('0x2e')](moment()[_0xffa8('0x2f')]('x'));}this[_0xffa8('0xb')][_0x538c88['device']][_0xffa8('0x2b')]=_0x538c88[_0xffa8('0x2b')][_0xffa8('0x2c')]();this[_0xffa8('0xb')][_0x538c88[_0xffa8('0x29')]]['updateStatusRealtime'](_0x538c88);}}else if(this[_0xffa8('0xc')][_0x538c88[_0xffa8('0x29')]]){if(this[_0xffa8('0xc')][_0x538c88[_0xffa8('0x29')]][_0xffa8('0x2b')]!==_0x538c88[_0xffa8('0x2b')]['toLowerCase']()){this[_0xffa8('0xc')][_0x538c88['device']][_0xffa8('0x2d')]=_[_0xffa8('0x2e')](moment()[_0xffa8('0x2f')]('x'));}this['telephones'][_0x538c88['device']][_0xffa8('0x2b')]=_0x538c88[_0xffa8('0x2b')]['toLowerCase']();this[_0xffa8('0x1e')](util['format'](_0xffa8('0x30'),this[_0xffa8('0xc')][_0x538c88['device']][_0xffa8('0x26')]),_0xffa8('0x31'),this['telephones'][_0x538c88[_0xffa8('0x29')]]);}else if(this['trunks'][_0x538c88[_0xffa8('0x29')]]){if(this[_0xffa8('0xa')][_0x538c88[_0xffa8('0x29')]]['state']!==_0x538c88[_0xffa8('0x2b')][_0xffa8('0x2c')]()){this[_0xffa8('0xa')][_0x538c88[_0xffa8('0x29')]][_0xffa8('0x2d')]=_[_0xffa8('0x2e')](moment()[_0xffa8('0x2f')]('x'));}this['trunks'][_0x538c88[_0xffa8('0x29')]][_0xffa8('0x2b')]=_0x538c88[_0xffa8('0x2b')][_0xffa8('0x2c')]();this[_0xffa8('0x1e')](util[_0xffa8('0x2f')]('trunk:%s',this[_0xffa8('0xa')][_0x538c88[_0xffa8('0x29')]]['name']),_0xffa8('0x27'),this[_0xffa8('0xa')][_0x538c88[_0xffa8('0x29')]]);}else if(_[_0xffa8('0x32')](_0x538c88[_0xffa8('0x29')],_0xffa8('0x33'))){}else if(_[_0xffa8('0x32')](_0x538c88[_0xffa8('0x29')],_0xffa8('0x34'))){var _0x1f2e18=_0x538c88['device'];var _0x1428ba=_0x1f2e18[_0xffa8('0x35')](_0x1f2e18[_0xffa8('0x36')]('/')+0x1,_0x1f2e18[_0xffa8('0x36')]('@'));var _0x3c0bce=_[_0xffa8('0x1f')](this['agents'],function(_0x259041){return _0x259041['mobile']==_0x1428ba||_0x259041['phone']==_0x1428ba||_0x259041['accountcode']==_0x1428ba;});if(_0x3c0bce){if(_0x3c0bce[_0xffa8('0x2b')]!==_0x538c88['state'][_0xffa8('0x2c')]()){_0x3c0bce[_0xffa8('0x2d')]=_[_0xffa8('0x2e')](moment()[_0xffa8('0x2f')]('x'));}_0x3c0bce[_0xffa8('0x2b')]=_0x538c88[_0xffa8('0x2b')][_0xffa8('0x2c')]();_0x3c0bce[_0xffa8('0x2a')]=!![];_0x3c0bce['updateStatusRealtime'](_0x538c88);}}else{}}}catch(_0x54ffce){logger['error']('[syncDeviceState][UserReport]',util['inspect'](_0x54ffce,{'showHidden':![],'depth':null}));}};UserReport[_0xffa8('0x1a')][_0xffa8('0x12')]=function(_0x114003){try{if(this[_0xffa8('0x1c')](_0x114003)&&this[_0xffa8('0x1c')](_0x114003[_0xffa8('0x11')])){if(this['agents'][_0x114003['peer']]){if(!this['agents'][_0x114003[_0xffa8('0x37')]][_0xffa8('0x2a')]||_0x114003[_0xffa8('0x11')][_0xffa8('0x2c')]()==_0xffa8('0x38')){this[_0xffa8('0xb')][_0x114003[_0xffa8('0x37')]][_0xffa8('0x2a')]=![];this[_0xffa8('0xb')][_0x114003[_0xffa8('0x37')]][_0xffa8('0x39')]=_0x114003[_0xffa8('0x11')][_0xffa8('0x2c')]();this['agents'][_0x114003['peer']]['address']=_0x114003[_0xffa8('0x3a')];this[_0xffa8('0xb')][_0x114003[_0xffa8('0x37')]][_0xffa8('0x3b')](_0x114003);}}else if(this[_0xffa8('0xc')][_0x114003['peer']]){this[_0xffa8('0xc')][_0x114003[_0xffa8('0x37')]][_0xffa8('0x39')]=_0x114003[_0xffa8('0x11')][_0xffa8('0x2c')]();this[_0xffa8('0xc')][_0x114003[_0xffa8('0x37')]][_0xffa8('0x3a')]=_0x114003[_0xffa8('0x3a')];this['emit'](util[_0xffa8('0x2f')](_0xffa8('0x30'),this[_0xffa8('0xc')][_0x114003[_0xffa8('0x37')]][_0xffa8('0x26')]),_0xffa8('0x31'),this[_0xffa8('0xc')][_0x114003[_0xffa8('0x37')]]);}else if(this[_0xffa8('0xa')][_0x114003[_0xffa8('0x37')]]){this[_0xffa8('0xa')][_0x114003['peer']][_0xffa8('0x39')]=_0x114003['peerstatus'][_0xffa8('0x2c')]();this[_0xffa8('0xa')][_0x114003['peer']][_0xffa8('0x3a')]=_0x114003[_0xffa8('0x3a')];this[_0xffa8('0x1e')](util['format'](_0xffa8('0x25'),this[_0xffa8('0xa')][_0x114003[_0xffa8('0x37')]][_0xffa8('0x26')]),_0xffa8('0x27'),this[_0xffa8('0xa')][_0x114003[_0xffa8('0x37')]]);}else{}}}catch(_0x494275){logger[_0xffa8('0x19')](_0xffa8('0x3c'),util[_0xffa8('0x3d')](_0x494275,{'showHidden':![],'depth':null}));}};module[_0xffa8('0x3e')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 6126569..eae99ff 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 _0x5733=['bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','agentcomplete','syncAgentComplete','varset','hangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','uniqueid','destuniqueid','YYYY-MM-DD\x20HH:mm:ss','called','queue','inbound','merge','omit','event','format','user:%s','membername','error','[syncAgentCalled][VoiceAgentReport]','inspect','lastevent','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','interface','pick','user:agentconnect','agentringnoanswerAt','answered_elsewhere','answeredelsewheremembername','custom:agentansweredelsewhere','[syncAgentConnect][VoiceAgentReport]','reason','rejected','custom:agentringnoanswer','syncQueueCallerAbandon','hasOwnProperty','abandoned','[syncQueueCallerAbandon][VoiceAgentReport]','agentconnectAt','agentcompleteAt','complete','talktime','transfer','agent','acw','acwtime','acwTimeout','destconnectedlinenum','custom:agentcomplete','[syncAgentComplete][VoiceAgentReport]','addVariable','keys','value','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','memberrealtime','isNil','includes','syncHangup','custom:voiceAgentReport','values','syncAttendedTransfer','transfereeuniqueid','diff','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','transfereruniqueid','seconds','channel','substring','lastIndexOf','onhold','[syncMusicOnHoldStop][VoiceAgentReport]','lodash','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled'];(function(_0x3a7ae8,_0x4bb95d){var _0x1f3726=function(_0xbdeb91){while(--_0xbdeb91){_0x3a7ae8['push'](_0x3a7ae8['shift']());}};_0x1f3726(++_0x4bb95d);}(_0x5733,0x66));var _0x3573=function(_0x4a1369,_0x50c255){_0x4a1369=_0x4a1369-0x0;var _0x2428fb=_0x5733[_0x4a1369];return _0x2428fb;};'use strict';var _=require(_0x3573('0x0'));var moment=require('moment');var util=require('util');var Redis=require(_0x3573('0x1'));var config=require(_0x3573('0x2'));var logger=require(_0x3573('0x3'))(_0x3573('0x4'));var ami=require(_0x3573('0x5'));config[_0x3573('0x6')]=_[_0x3573('0x7')](config[_0x3573('0x6')],{'host':_0x3573('0x8'),'port':0x18eb});var io=require(_0x3573('0x9'))(new Redis(config[_0x3573('0x6')]));function VoiceAgentReport(_0x547f95){this[_0x3573('0xa')]={};this[_0x3573('0xb')]=_0x547f95[_0x3573('0xb')];this[_0x3573('0xc')]=_0x547f95[_0x3573('0xc')];this[_0x3573('0xd')]={};ami['on'](_0x3573('0xe'),this[_0x3573('0xf')][_0x3573('0x10')](this));ami['on'](_0x3573('0x11'),this[_0x3573('0x12')][_0x3573('0x10')](this));ami['on'](_0x3573('0x13'),this[_0x3573('0x14')][_0x3573('0x10')](this));ami['on'](_0x3573('0x15'),this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0x3573('0x16'),this[_0x3573('0x17')]['bind'](this));ami['on'](_0x3573('0x18'),this['syncVarSet'][_0x3573('0x10')](this));ami['on'](_0x3573('0x19'),this['syncHangup']['bind'](this));ami['on'](_0x3573('0x1a'),this[_0x3573('0x1b')][_0x3573('0x10')](this));ami['on'](_0x3573('0x1c'),this[_0x3573('0x1d')][_0x3573('0x10')](this));ami['on'](_0x3573('0x1e'),this['syncAttendedTransfer'][_0x3573('0x10')](this));ami['on'](_0x3573('0x1f'),this[_0x3573('0x20')][_0x3573('0x10')](this));}VoiceAgentReport[_0x3573('0x21')]['emit']=function(_0x5bfc78,_0x4b9e1a,_0xd4fdc9){io['to'](_0x5bfc78)[_0x3573('0x22')](_0x4b9e1a,_0xd4fdc9);};VoiceAgentReport[_0x3573('0x21')][_0x3573('0x23')]=function(_0x14d639){return _0x14d639!==null&&!_[_0x3573('0x24')](_0x14d639);};VoiceAgentReport['prototype'][_0x3573('0xf')]=function(_0x5bccb9){try{if(this[_0x3573('0x23')](_0x5bccb9)){if(_['isUndefined'](this[_0x3573('0xa')][_0x5bccb9[_0x3573('0x25')]])){this[_0x3573('0xa')][_0x5bccb9['uniqueid']]={};}if(_['isUndefined'](this[_0x3573('0xa')][_0x5bccb9[_0x3573('0x25')]][_0x5bccb9[_0x3573('0x26')]])){this[_0x3573('0xa')][_0x5bccb9[_0x3573('0x25')]][_0x5bccb9['destuniqueid']]={'agentcalledAt':moment()['format'](_0x3573('0x27')),'lastevent':_0x3573('0x28'),'variables':this[_0x3573('0xd')][_0x5bccb9[_0x3573('0x25')]],'type':this[_0x3573('0xb')][_0x5bccb9[_0x3573('0x29')]]?this[_0x3573('0xb')][_0x5bccb9['queue']]['type']||'inbound':_0x3573('0x2a')};}_[_0x3573('0x2b')](this[_0x3573('0xa')][_0x5bccb9[_0x3573('0x25')]][_0x5bccb9[_0x3573('0x26')]],_[_0x3573('0x2c')](_0x5bccb9,[_0x3573('0x2d'),'privilege']));ami['emit']('custom:agentcalled',this[_0x3573('0xa')][_0x5bccb9[_0x3573('0x25')]][_0x5bccb9['destuniqueid']]);this[_0x3573('0x22')](util[_0x3573('0x2e')](_0x3573('0x2f'),_0x5bccb9[_0x3573('0x30')]),'user:called',this[_0x3573('0xa')][_0x5bccb9['uniqueid']][_0x5bccb9['destuniqueid']]);}}catch(_0x56115d){logger[_0x3573('0x31')](_0x3573('0x32'),util[_0x3573('0x33')](_0x56115d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3573('0x21')][_0x3573('0x12')]=function(_0x5928b5){try{if(this[_0x3573('0x23')](_0x5928b5)){if(this['channels'][_0x5928b5[_0x3573('0x25')]]){for(var _0x172813 in this[_0x3573('0xa')][_0x5928b5[_0x3573('0x25')]]){if(this[_0x3573('0xa')][_0x5928b5['uniqueid']]['hasOwnProperty'](_0x172813)){if(_0x5928b5[_0x3573('0x26')]===_0x172813){this[_0x3573('0xa')][_0x5928b5[_0x3573('0x25')]][_0x172813]['agentconnectAt']=moment()[_0x3573('0x2e')](_0x3573('0x27'));this['channels'][_0x5928b5[_0x3573('0x25')]][_0x172813][_0x3573('0x34')]='connect';this[_0x3573('0xa')][_0x5928b5[_0x3573('0x25')]][_0x172813]['holdtime']=_0x5928b5['holdtime'];this[_0x3573('0xa')][_0x5928b5[_0x3573('0x25')]][_0x172813][_0x3573('0x35')]=_0x5928b5[_0x3573('0x35')];this[_0x3573('0xa')][_0x5928b5[_0x3573('0x25')]][_0x172813][_0x3573('0x36')]=_0x5928b5['connectedlinename'];this['channels'][_0x5928b5[_0x3573('0x25')]][_0x172813][_0x3573('0x37')]=_0x5928b5[_0x3573('0x37')];this[_0x3573('0xa')][_0x5928b5[_0x3573('0x25')]][_0x172813][_0x3573('0x38')]=_0x5928b5[_0x3573('0x38')];_[_0x3573('0x2b')](this[_0x3573('0xc')][_0x5928b5[_0x3573('0x39')]],_[_0x3573('0x3a')](_0x5928b5,['queue','destconnectedlinenum']));this[_0x3573('0x22')](util[_0x3573('0x2e')](_0x3573('0x2f'),_0x5928b5[_0x3573('0x30')]),_0x3573('0x3b'),this[_0x3573('0xa')][_0x5928b5[_0x3573('0x25')]][_0x5928b5[_0x3573('0x26')]]);ami[_0x3573('0x22')]('custom:agentconnect',this[_0x3573('0xa')][_0x5928b5['uniqueid']][_0x172813]);}else if(!this[_0x3573('0xa')][_0x5928b5['uniqueid']][_0x172813][_0x3573('0x13')]&&!this[_0x3573('0xa')][_0x5928b5['uniqueid']][_0x172813][_0x3573('0x16')]){this[_0x3573('0xa')][_0x5928b5[_0x3573('0x25')]][_0x172813][_0x3573('0x13')]=!![];this['channels'][_0x5928b5['uniqueid']][_0x172813][_0x3573('0x3c')]=moment()[_0x3573('0x2e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x3573('0xa')][_0x5928b5[_0x3573('0x25')]][_0x172813]['reason']=_0x3573('0x3d');this['channels'][_0x5928b5['uniqueid']][_0x172813][_0x3573('0x34')]=_0x3573('0x3d');this[_0x3573('0xa')][_0x5928b5['uniqueid']][_0x172813]['answeredelsewheredestinationuniqueid']=_0x5928b5['destuniqueid'];this[_0x3573('0xa')][_0x5928b5[_0x3573('0x25')]][_0x172813][_0x3573('0x3e')]=_0x5928b5[_0x3573('0x30')];ami[_0x3573('0x22')](_0x3573('0x3f'),this[_0x3573('0xa')][_0x5928b5[_0x3573('0x25')]][_0x172813]);}}}}}}catch(_0x28b354){logger[_0x3573('0x31')](_0x3573('0x40'),util[_0x3573('0x33')](_0x28b354,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x3573('0x14')]=function(_0x4fd8e3){try{if(this[_0x3573('0x23')](_0x4fd8e3)){if(this[_0x3573('0xa')][_0x4fd8e3['uniqueid']]&&this['channels'][_0x4fd8e3[_0x3573('0x25')]][_0x4fd8e3['destuniqueid']]){this[_0x3573('0xa')][_0x4fd8e3[_0x3573('0x25')]][_0x4fd8e3['destuniqueid']][_0x3573('0x13')]=!![];this['channels'][_0x4fd8e3['uniqueid']][_0x4fd8e3[_0x3573('0x26')]][_0x3573('0x3c')]=moment()[_0x3573('0x2e')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x4fd8e3[_0x3573('0x25')]][_0x4fd8e3['destuniqueid']][_0x3573('0x41')]=_0x3573('0x42');this[_0x3573('0xa')][_0x4fd8e3[_0x3573('0x25')]][_0x4fd8e3['destuniqueid']][_0x3573('0x34')]=_0x3573('0x42');ami[_0x3573('0x22')](_0x3573('0x43'),this['channels'][_0x4fd8e3[_0x3573('0x25')]][_0x4fd8e3['destuniqueid']]);}}}catch(_0x685e44){logger['error']('[syncAgentRingNoAnswer][VoiceAgentReport]',util[_0x3573('0x33')](_0x685e44,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3573('0x21')][_0x3573('0x44')]=function(_0x133571){try{if(this[_0x3573('0x23')](_0x133571)){if(this[_0x3573('0xa')][_0x133571[_0x3573('0x25')]]){for(var _0x5275ae in this[_0x3573('0xa')][_0x133571[_0x3573('0x25')]]){if(this['channels'][_0x133571[_0x3573('0x25')]][_0x3573('0x45')](_0x5275ae)&&!this[_0x3573('0xa')][_0x133571[_0x3573('0x25')]][_0x5275ae]['agentringnoanswer']&&!this[_0x3573('0xa')][_0x133571[_0x3573('0x25')]][_0x5275ae]['agentcomplete']){this['channels'][_0x133571[_0x3573('0x25')]][_0x5275ae][_0x3573('0x13')]=!![];this[_0x3573('0xa')][_0x133571['uniqueid']][_0x5275ae][_0x3573('0x3c')]=moment()[_0x3573('0x2e')](_0x3573('0x27'));this[_0x3573('0xa')][_0x133571[_0x3573('0x25')]][_0x5275ae][_0x3573('0x41')]=_0x3573('0x46');this[_0x3573('0xa')][_0x133571[_0x3573('0x25')]][_0x5275ae][_0x3573('0x34')]=_0x3573('0x46');ami[_0x3573('0x22')]('custom:agentqueuecallerabandon',this['channels'][_0x133571[_0x3573('0x25')]][_0x5275ae]);}}}}}catch(_0x258284){logger['error'](_0x3573('0x47'),util[_0x3573('0x33')](_0x258284,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x3573('0x17')]=function(_0x5d4941){try{if(this[_0x3573('0x23')](_0x5d4941)){if(this[_0x3573('0xa')][_0x5d4941[_0x3573('0x25')]]){for(var _0x30bfd4 in this['channels'][_0x5d4941[_0x3573('0x25')]]){if(this[_0x3573('0xa')][_0x5d4941[_0x3573('0x25')]][_0x3573('0x45')](_0x30bfd4)){if(this['channels'][_0x5d4941[_0x3573('0x25')]][_0x30bfd4][_0x3573('0x48')]&&!this['channels'][_0x5d4941['uniqueid']][_0x30bfd4][_0x3573('0x16')]){this[_0x3573('0xa')][_0x5d4941[_0x3573('0x25')]][_0x30bfd4][_0x3573('0x16')]=!![];this[_0x3573('0xa')][_0x5d4941['uniqueid']][_0x30bfd4][_0x3573('0x49')]=moment()['format'](_0x3573('0x27'));this[_0x3573('0xa')][_0x5d4941[_0x3573('0x25')]][_0x30bfd4]['lastevent']=_0x3573('0x4a');this[_0x3573('0xa')][_0x5d4941[_0x3573('0x25')]][_0x30bfd4][_0x3573('0x4b')]=_0x5d4941[_0x3573('0x4b')];this['channels'][_0x5d4941[_0x3573('0x25')]][_0x30bfd4][_0x3573('0x41')]=_0x5d4941[_0x3573('0x41')]==_0x3573('0x4c')?_0x3573('0x4d'):_0x5d4941['reason'];if(this[_0x3573('0xb')][_0x5d4941[_0x3573('0x29')]]&&this[_0x3573('0xb')][_0x5d4941[_0x3573('0x29')]][_0x3573('0x4e')]){this[_0x3573('0xa')][_0x5d4941['uniqueid']][_0x30bfd4]['agentacw']=!![];this[_0x3573('0xa')][_0x5d4941[_0x3573('0x25')]][_0x30bfd4][_0x3573('0x4f')]=this[_0x3573('0xb')][_0x5d4941[_0x3573('0x29')]][_0x3573('0x50')];}this[_0x3573('0xc')][_0x5d4941[_0x3573('0x39')]]=_[_0x3573('0x2c')](this['agents'][_0x5d4941['interface']],['queue',_0x3573('0x51')]);this[_0x3573('0x22')](util[_0x3573('0x2e')](_0x3573('0x2f'),_0x5d4941['membername']),'user:agentcomplete',this[_0x3573('0xa')][_0x5d4941[_0x3573('0x25')]][_0x30bfd4]);ami[_0x3573('0x22')](_0x3573('0x52'),this[_0x3573('0xa')][_0x5d4941[_0x3573('0x25')]][_0x30bfd4]);}}}}}}catch(_0x9f934a){logger[_0x3573('0x31')](_0x3573('0x53'),util[_0x3573('0x33')](_0x9f934a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3573('0x21')]['syncVarSet']=function(_0x1983a0){try{if(this['isNotNull'](_0x1983a0)){this[_0x3573('0x54')](_0x1983a0[_0x3573('0x25')],_[_0x3573('0x55')](_0x1983a0['variable'])[0x0],_0x1983a0[_0x3573('0x56')]);if(this[_0x3573('0xa')][_0x1983a0[_0x3573('0x25')]]){for(var _0x292fde in this[_0x3573('0xa')][_0x1983a0[_0x3573('0x25')]]){if(this[_0x3573('0xa')][_0x1983a0['uniqueid']]['hasOwnProperty'](_0x292fde)){if(_[_0x3573('0x24')](this['channels'][_0x1983a0['uniqueid']][_0x292fde][_0x3573('0xd')])){this['channels'][_0x1983a0[_0x3573('0x25')]][_0x292fde][_0x3573('0xd')]={};}this[_0x3573('0xa')][_0x1983a0[_0x3573('0x25')]][_0x292fde][_0x3573('0xd')]=this['variables'][_0x1983a0[_0x3573('0x25')]];}}}}}catch(_0x5eb4b0){logger[_0x3573('0x31')]('[syncVarSet][VoiceAgentReport]',util[_0x3573('0x33')](_0x5eb4b0,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3573('0x21')]['addVariable']=function(_0x36ffda,_0x461915,_0x5a3c79){var _0x395823=[_0x3573('0x57'),_0x3573('0x58'),_0x3573('0x59'),_0x3573('0x5a'),_0x3573('0x5b'),_0x3573('0x5c'),_0x3573('0x5d'),'rtpaudioqosrttbridged',_0x3573('0x5e'),'sipuri',_0x3573('0x5f'),_0x3573('0x60'),_0x3573('0x61'),_0x3573('0x62'),'memberinterface',_0x3573('0x63'),_0x3573('0x30'),'memberpenalty',_0x3573('0x64')];if(!_[_0x3573('0x65')](_0x461915)&&!_[_0x3573('0x66')](_0x395823,_0x461915)){if(_[_0x3573('0x24')](this[_0x3573('0xd')][_0x36ffda])){this[_0x3573('0xd')][_0x36ffda]={};}this[_0x3573('0xd')][_0x36ffda][_0x461915]=_0x5a3c79;}};VoiceAgentReport[_0x3573('0x21')][_0x3573('0x67')]=function(_0x5856b5){try{if(this[_0x3573('0x23')](_0x5856b5)){if(this[_0x3573('0xa')][_0x5856b5[_0x3573('0x25')]]){for(var _0x424a3c in this[_0x3573('0xa')][_0x5856b5[_0x3573('0x25')]]){if(this[_0x3573('0xa')][_0x5856b5['uniqueid']][_0x3573('0x45')](_0x424a3c)){if(this[_0x3573('0xa')][_0x5856b5[_0x3573('0x25')]][_0x424a3c][_0x3573('0x41')]=='transfer'&&this[_0x3573('0xa')][_0x5856b5[_0x3573('0x25')]][_0x424a3c][_0x3573('0x16')]){this[_0x3573('0xa')][_0x5856b5['uniqueid']][_0x424a3c][_0x3573('0x49')]=moment()[_0x3573('0x2e')](_0x3573('0x27'));}}}ami[_0x3573('0x22')](_0x3573('0x68'),_[_0x3573('0x69')](this[_0x3573('0xa')][_0x5856b5[_0x3573('0x25')]]));delete this['channels'][_0x5856b5[_0x3573('0x25')]];}if(this[_0x3573('0xd')][_0x5856b5[_0x3573('0x25')]]){delete this['variables'][_0x5856b5[_0x3573('0x25')]];}}}catch(_0x242eb6){logger[_0x3573('0x31')]('[syncHangup][VoiceAgentReport]',util[_0x3573('0x33')](_0x242eb6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3573('0x21')][_0x3573('0x6a')]=function(_0x53b4fc){try{if(this['isNotNull'](_0x53b4fc)){if(this['channels'][_0x53b4fc[_0x3573('0x6b')]]){for(var _0x588f69 in this[_0x3573('0xa')][_0x53b4fc[_0x3573('0x6b')]]){if(this[_0x3573('0xa')][_0x53b4fc[_0x3573('0x6b')]]['hasOwnProperty'](_0x588f69)){if(_0x53b4fc['origtransfereruniqueid']===_0x588f69){var _0x461ad9=moment();this[_0x3573('0xa')][_0x53b4fc[_0x3573('0x6b')]][_0x588f69][_0x3573('0x16')]=!![];this[_0x3573('0xa')][_0x53b4fc[_0x3573('0x6b')]][_0x588f69][_0x3573('0x49')]=moment()[_0x3573('0x2e')](_0x3573('0x27'));this['channels'][_0x53b4fc[_0x3573('0x6b')]][_0x588f69][_0x3573('0x41')]=_0x3573('0x4c');this['channels'][_0x53b4fc[_0x3573('0x6b')]][_0x588f69][_0x3573('0x34')]=_0x3573('0x4a');this[_0x3573('0xa')][_0x53b4fc[_0x3573('0x6b')]][_0x588f69][_0x3573('0x4b')]=_0x461ad9[_0x3573('0x6c')](this['channels'][_0x53b4fc[_0x3573('0x6b')]][_0x588f69][_0x3573('0x48')],'seconds');}}}}if(this[_0x3573('0xa')][_0x53b4fc[_0x3573('0x6d')]]){var _0x441961=this[_0x3573('0xa')][_0x53b4fc[_0x3573('0x6d')]];this[_0x3573('0xa')][_0x53b4fc[_0x3573('0x6d')]]=this[_0x3573('0xa')][_0x53b4fc[_0x3573('0x6b')]];this[_0x3573('0xa')][_0x53b4fc[_0x3573('0x6b')]]=_0x441961;}}}catch(_0x13b81f){logger[_0x3573('0x31')](_0x3573('0x6e'),util['inspect'](_0x13b81f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3573('0x21')]['syncBlindTransfer']=function(_0x5ed15f){try{if(this[_0x3573('0x23')](_0x5ed15f)){if(this[_0x3573('0xa')][_0x5ed15f[_0x3573('0x6b')]]){for(var _0xa60399 in this[_0x3573('0xa')][_0x5ed15f[_0x3573('0x6b')]]){if(this[_0x3573('0xa')][_0x5ed15f[_0x3573('0x6b')]][_0x3573('0x45')](_0xa60399)){if(_0x5ed15f[_0x3573('0x6f')]===_0xa60399){var _0x306865=moment();this[_0x3573('0xa')][_0x5ed15f['transfereeuniqueid']][_0xa60399][_0x3573('0x16')]=!![];this[_0x3573('0xa')][_0x5ed15f[_0x3573('0x6b')]][_0xa60399][_0x3573('0x49')]=_0x306865;this[_0x3573('0xa')][_0x5ed15f[_0x3573('0x6b')]][_0xa60399][_0x3573('0x41')]='transfer';this[_0x3573('0xa')][_0x5ed15f['transfereeuniqueid']][_0xa60399][_0x3573('0x34')]=_0x3573('0x4a');this[_0x3573('0xa')][_0x5ed15f[_0x3573('0x6b')]][_0xa60399][_0x3573('0x4b')]=_0x306865[_0x3573('0x6c')](this[_0x3573('0xa')][_0x5ed15f['transfereeuniqueid']][_0xa60399]['agentconnectAt'],_0x3573('0x70'));}}}}}}catch(_0x22c915){logger[_0x3573('0x31')]('[syncBlindTransfer][VoiceAgentReport]',util[_0x3573('0x33')](_0x22c915,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3573('0x21')][_0x3573('0x1b')]=function(_0x3f44ba){var _0x14b3ab='';try{if(this[_0x3573('0x23')](_0x3f44ba)){if(_0x3f44ba['channel']){_0x14b3ab=_0x3f44ba[_0x3573('0x71')][_0x3573('0x72')](0x0,_0x3f44ba['channel'][_0x3573('0x73')]('-'));if(this[_0x3573('0xc')][_0x14b3ab]){this['agents'][_0x14b3ab][_0x3573('0x74')]=!![];}}}}catch(_0x41327c){logger[_0x3573('0x31')]('[syncMusicOnHoldStart][VoiceAgentReport]',util[_0x3573('0x33')](_0x41327c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3573('0x21')][_0x3573('0x1d')]=function(_0x726ba9){var _0x3daf6f='';try{if(this[_0x3573('0x23')](_0x726ba9)){if(_0x726ba9[_0x3573('0x71')]){_0x3daf6f=_0x726ba9['channel'][_0x3573('0x72')](0x0,_0x726ba9[_0x3573('0x71')][_0x3573('0x73')]('-'));if(this[_0x3573('0xc')][_0x3daf6f]){this[_0x3573('0xc')][_0x3daf6f][_0x3573('0x74')]=![];}}}}catch(_0x5a9c9f){logger[_0x3573('0x31')](_0x3573('0x75'),util[_0x3573('0x33')](_0x5a9c9f,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0x184b=['user:called','error','[syncAgentCalled][VoiceAgentReport]','hasOwnProperty','agentconnectAt','lastevent','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','interface','pick','destconnectedlinenum','user:%s','user:agentconnect','agentringnoanswerAt','YYYY-MM-DD\x20HH:mm:ss','reason','answered_elsewhere','answeredelsewheredestinationuniqueid','custom:agentansweredelsewhere','[syncAgentConnect][VoiceAgentReport]','inspect','syncAgentRingNoAnswer','rejected','custom:agentringnoanswer','[syncAgentRingNoAnswer][VoiceAgentReport]','abandoned','agentcompleteAt','complete','talktime','transfer','acw','acwtime','acwTimeout','user:agentcomplete','custom:agentcomplete','[syncAgentComplete][VoiceAgentReport]','addVariable','keys','variable','value','[syncVarSet][VoiceAgentReport]','rtpaudioqosbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberlastcall','memberpenalty','isNil','includes','custom:voiceAgentReport','values','[syncHangup][VoiceAgentReport]','transfereeuniqueid','origtransfereruniqueid','seconds','secondtransfereruniqueid','transfereruniqueid','diff','channel','onhold','[syncMusicOnHoldStart][VoiceAgentReport]','lastIndexOf','[syncMusicOnHoldStop][VoiceAgentReport]','exports','lodash','moment','util','ioredis','../../../config/environment','ami','redis','defaults','localhost','socket.io-emitter','channels','agents','variables','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','uniqueid','destuniqueid','voiceQueues','queue','type','inbound','merge','omit','custom:agentcalled','format','membername'];(function(_0x524d7f,_0x61d98b){var _0x49514b=function(_0x36899f){while(--_0x36899f){_0x524d7f['push'](_0x524d7f['shift']());}};_0x49514b(++_0x61d98b);}(_0x184b,0xc1));var _0xb184=function(_0x24a317,_0x4cbd51){_0x24a317=_0x24a317-0x0;var _0x47b701=_0x184b[_0x24a317];return _0x47b701;};'use strict';var _=require(_0xb184('0x0'));var moment=require(_0xb184('0x1'));var util=require(_0xb184('0x2'));var Redis=require(_0xb184('0x3'));var config=require(_0xb184('0x4'));var logger=require('../../../config/logger')(_0xb184('0x5'));var ami=require('../ami');config[_0xb184('0x6')]=_[_0xb184('0x7')](config[_0xb184('0x6')],{'host':_0xb184('0x8'),'port':0x18eb});var io=require(_0xb184('0x9'))(new Redis(config['redis']));function VoiceAgentReport(_0x559210){this[_0xb184('0xa')]={};this['voiceQueues']=_0x559210['voiceQueues'];this['agents']=_0x559210[_0xb184('0xb')];this[_0xb184('0xc')]={};ami['on']('agentcalled',this[_0xb184('0xd')][_0xb184('0xe')](this));ami['on'](_0xb184('0xf'),this[_0xb184('0x10')][_0xb184('0xe')](this));ami['on'](_0xb184('0x11'),this['syncAgentRingNoAnswer'][_0xb184('0xe')](this));ami['on'](_0xb184('0x12'),this[_0xb184('0x13')][_0xb184('0xe')](this));ami['on'](_0xb184('0x14'),this[_0xb184('0x15')][_0xb184('0xe')](this));ami['on'](_0xb184('0x16'),this[_0xb184('0x17')][_0xb184('0xe')](this));ami['on'](_0xb184('0x18'),this[_0xb184('0x19')][_0xb184('0xe')](this));ami['on'](_0xb184('0x1a'),this[_0xb184('0x1b')][_0xb184('0xe')](this));ami['on'](_0xb184('0x1c'),this[_0xb184('0x1d')][_0xb184('0xe')](this));ami['on'](_0xb184('0x1e'),this[_0xb184('0x1f')][_0xb184('0xe')](this));ami['on'](_0xb184('0x20'),this[_0xb184('0x21')][_0xb184('0xe')](this));}VoiceAgentReport[_0xb184('0x22')][_0xb184('0x23')]=function(_0x264235,_0x3c7381,_0x49ad70){io['to'](_0x264235)[_0xb184('0x23')](_0x3c7381,_0x49ad70);};VoiceAgentReport[_0xb184('0x22')][_0xb184('0x24')]=function(_0x31b697){return _0x31b697!==null&&!_['isUndefined'](_0x31b697);};VoiceAgentReport[_0xb184('0x22')][_0xb184('0xd')]=function(_0x4f4eba){try{if(this[_0xb184('0x24')](_0x4f4eba)){if(_[_0xb184('0x25')](this[_0xb184('0xa')][_0x4f4eba[_0xb184('0x26')]])){this[_0xb184('0xa')][_0x4f4eba['uniqueid']]={};}if(_[_0xb184('0x25')](this['channels'][_0x4f4eba['uniqueid']][_0x4f4eba[_0xb184('0x27')]])){this['channels'][_0x4f4eba[_0xb184('0x26')]][_0x4f4eba['destuniqueid']]={'agentcalledAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':'called','variables':this['variables'][_0x4f4eba[_0xb184('0x26')]],'type':this[_0xb184('0x28')][_0x4f4eba[_0xb184('0x29')]]?this['voiceQueues'][_0x4f4eba[_0xb184('0x29')]][_0xb184('0x2a')]||_0xb184('0x2b'):'inbound'};}_[_0xb184('0x2c')](this[_0xb184('0xa')][_0x4f4eba[_0xb184('0x26')]][_0x4f4eba[_0xb184('0x27')]],_[_0xb184('0x2d')](_0x4f4eba,['event','privilege']));ami[_0xb184('0x23')](_0xb184('0x2e'),this['channels'][_0x4f4eba[_0xb184('0x26')]][_0x4f4eba[_0xb184('0x27')]]);this[_0xb184('0x23')](util[_0xb184('0x2f')]('user:%s',_0x4f4eba[_0xb184('0x30')]),_0xb184('0x31'),this[_0xb184('0xa')][_0x4f4eba['uniqueid']][_0x4f4eba[_0xb184('0x27')]]);}}catch(_0x336c99){logger[_0xb184('0x32')](_0xb184('0x33'),util['inspect'](_0x336c99,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb184('0x22')][_0xb184('0x10')]=function(_0x23b2c6){try{if(this[_0xb184('0x24')](_0x23b2c6)){if(this[_0xb184('0xa')][_0x23b2c6['uniqueid']]){for(var _0x14447c in this[_0xb184('0xa')][_0x23b2c6[_0xb184('0x26')]]){if(this[_0xb184('0xa')][_0x23b2c6[_0xb184('0x26')]][_0xb184('0x34')](_0x14447c)){if(_0x23b2c6[_0xb184('0x27')]===_0x14447c){this['channels'][_0x23b2c6[_0xb184('0x26')]][_0x14447c][_0xb184('0x35')]=moment()[_0xb184('0x2f')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xb184('0xa')][_0x23b2c6['uniqueid']][_0x14447c][_0xb184('0x36')]='connect';this[_0xb184('0xa')][_0x23b2c6[_0xb184('0x26')]][_0x14447c]['holdtime']=_0x23b2c6[_0xb184('0x37')];this[_0xb184('0xa')][_0x23b2c6[_0xb184('0x26')]][_0x14447c]['connectedlinenum']=_0x23b2c6[_0xb184('0x38')];this[_0xb184('0xa')][_0x23b2c6[_0xb184('0x26')]][_0x14447c][_0xb184('0x39')]=_0x23b2c6[_0xb184('0x39')];this['channels'][_0x23b2c6['uniqueid']][_0x14447c][_0xb184('0x3a')]=_0x23b2c6[_0xb184('0x3a')];this[_0xb184('0xa')][_0x23b2c6[_0xb184('0x26')]][_0x14447c][_0xb184('0x3b')]=_0x23b2c6[_0xb184('0x3b')];_[_0xb184('0x2c')](this[_0xb184('0xb')][_0x23b2c6[_0xb184('0x3c')]],_[_0xb184('0x3d')](_0x23b2c6,['queue',_0xb184('0x3e')]));this[_0xb184('0x23')](util[_0xb184('0x2f')](_0xb184('0x3f'),_0x23b2c6[_0xb184('0x30')]),_0xb184('0x40'),this['channels'][_0x23b2c6['uniqueid']][_0x23b2c6[_0xb184('0x27')]]);ami['emit']('custom:agentconnect',this['channels'][_0x23b2c6[_0xb184('0x26')]][_0x14447c]);}else if(!this[_0xb184('0xa')][_0x23b2c6[_0xb184('0x26')]][_0x14447c][_0xb184('0x11')]&&!this['channels'][_0x23b2c6['uniqueid']][_0x14447c][_0xb184('0x14')]){this[_0xb184('0xa')][_0x23b2c6[_0xb184('0x26')]][_0x14447c]['agentringnoanswer']=!![];this[_0xb184('0xa')][_0x23b2c6['uniqueid']][_0x14447c][_0xb184('0x41')]=moment()['format'](_0xb184('0x42'));this[_0xb184('0xa')][_0x23b2c6[_0xb184('0x26')]][_0x14447c][_0xb184('0x43')]=_0xb184('0x44');this[_0xb184('0xa')][_0x23b2c6[_0xb184('0x26')]][_0x14447c]['lastevent']=_0xb184('0x44');this[_0xb184('0xa')][_0x23b2c6[_0xb184('0x26')]][_0x14447c][_0xb184('0x45')]=_0x23b2c6[_0xb184('0x27')];this[_0xb184('0xa')][_0x23b2c6[_0xb184('0x26')]][_0x14447c]['answeredelsewheremembername']=_0x23b2c6[_0xb184('0x30')];ami[_0xb184('0x23')](_0xb184('0x46'),this[_0xb184('0xa')][_0x23b2c6[_0xb184('0x26')]][_0x14447c]);}}}}}}catch(_0x43c77f){logger['error'](_0xb184('0x47'),util[_0xb184('0x48')](_0x43c77f,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xb184('0x49')]=function(_0x50bb4e){try{if(this[_0xb184('0x24')](_0x50bb4e)){if(this[_0xb184('0xa')][_0x50bb4e[_0xb184('0x26')]]&&this['channels'][_0x50bb4e['uniqueid']][_0x50bb4e[_0xb184('0x27')]]){this['channels'][_0x50bb4e[_0xb184('0x26')]][_0x50bb4e[_0xb184('0x27')]][_0xb184('0x11')]=!![];this['channels'][_0x50bb4e[_0xb184('0x26')]][_0x50bb4e['destuniqueid']][_0xb184('0x41')]=moment()[_0xb184('0x2f')](_0xb184('0x42'));this[_0xb184('0xa')][_0x50bb4e[_0xb184('0x26')]][_0x50bb4e[_0xb184('0x27')]][_0xb184('0x43')]=_0xb184('0x4a');this['channels'][_0x50bb4e[_0xb184('0x26')]][_0x50bb4e[_0xb184('0x27')]][_0xb184('0x36')]=_0xb184('0x4a');ami[_0xb184('0x23')](_0xb184('0x4b'),this[_0xb184('0xa')][_0x50bb4e[_0xb184('0x26')]][_0x50bb4e['destuniqueid']]);}}}catch(_0x42fe00){logger[_0xb184('0x32')](_0xb184('0x4c'),util[_0xb184('0x48')](_0x42fe00,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb184('0x22')][_0xb184('0x13')]=function(_0x2623a0){try{if(this[_0xb184('0x24')](_0x2623a0)){if(this['channels'][_0x2623a0[_0xb184('0x26')]]){for(var _0x26bfa7 in this[_0xb184('0xa')][_0x2623a0[_0xb184('0x26')]]){if(this[_0xb184('0xa')][_0x2623a0[_0xb184('0x26')]][_0xb184('0x34')](_0x26bfa7)&&!this[_0xb184('0xa')][_0x2623a0['uniqueid']][_0x26bfa7][_0xb184('0x11')]&&!this[_0xb184('0xa')][_0x2623a0[_0xb184('0x26')]][_0x26bfa7][_0xb184('0x14')]){this[_0xb184('0xa')][_0x2623a0[_0xb184('0x26')]][_0x26bfa7][_0xb184('0x11')]=!![];this[_0xb184('0xa')][_0x2623a0[_0xb184('0x26')]][_0x26bfa7][_0xb184('0x41')]=moment()[_0xb184('0x2f')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xb184('0xa')][_0x2623a0['uniqueid']][_0x26bfa7][_0xb184('0x43')]=_0xb184('0x4d');this[_0xb184('0xa')][_0x2623a0[_0xb184('0x26')]][_0x26bfa7][_0xb184('0x36')]=_0xb184('0x4d');ami[_0xb184('0x23')]('custom:agentqueuecallerabandon',this['channels'][_0x2623a0[_0xb184('0x26')]][_0x26bfa7]);}}}}}catch(_0x344bb0){logger['error']('[syncQueueCallerAbandon][VoiceAgentReport]',util[_0xb184('0x48')](_0x344bb0,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb184('0x22')][_0xb184('0x15')]=function(_0x5bfcbd){try{if(this[_0xb184('0x24')](_0x5bfcbd)){if(this['channels'][_0x5bfcbd['uniqueid']]){for(var _0x1f5bf5 in this[_0xb184('0xa')][_0x5bfcbd[_0xb184('0x26')]]){if(this[_0xb184('0xa')][_0x5bfcbd[_0xb184('0x26')]]['hasOwnProperty'](_0x1f5bf5)){if(this[_0xb184('0xa')][_0x5bfcbd[_0xb184('0x26')]][_0x1f5bf5][_0xb184('0x35')]&&!this[_0xb184('0xa')][_0x5bfcbd[_0xb184('0x26')]][_0x1f5bf5][_0xb184('0x14')]){this[_0xb184('0xa')][_0x5bfcbd[_0xb184('0x26')]][_0x1f5bf5][_0xb184('0x14')]=!![];this['channels'][_0x5bfcbd[_0xb184('0x26')]][_0x1f5bf5][_0xb184('0x4e')]=moment()[_0xb184('0x2f')](_0xb184('0x42'));this[_0xb184('0xa')][_0x5bfcbd[_0xb184('0x26')]][_0x1f5bf5]['lastevent']=_0xb184('0x4f');this[_0xb184('0xa')][_0x5bfcbd['uniqueid']][_0x1f5bf5][_0xb184('0x50')]=_0x5bfcbd[_0xb184('0x50')];this['channels'][_0x5bfcbd[_0xb184('0x26')]][_0x1f5bf5]['reason']=_0x5bfcbd[_0xb184('0x43')]==_0xb184('0x51')?'agent':_0x5bfcbd[_0xb184('0x43')];if(this[_0xb184('0x28')][_0x5bfcbd[_0xb184('0x29')]]&&this['voiceQueues'][_0x5bfcbd[_0xb184('0x29')]][_0xb184('0x52')]){this[_0xb184('0xa')][_0x5bfcbd[_0xb184('0x26')]][_0x1f5bf5]['agentacw']=!![];this[_0xb184('0xa')][_0x5bfcbd[_0xb184('0x26')]][_0x1f5bf5][_0xb184('0x53')]=this[_0xb184('0x28')][_0x5bfcbd[_0xb184('0x29')]][_0xb184('0x54')];}this[_0xb184('0xb')][_0x5bfcbd[_0xb184('0x3c')]]=_[_0xb184('0x2d')](this[_0xb184('0xb')][_0x5bfcbd[_0xb184('0x3c')]],[_0xb184('0x29'),_0xb184('0x3e')]);this[_0xb184('0x23')](util[_0xb184('0x2f')](_0xb184('0x3f'),_0x5bfcbd[_0xb184('0x30')]),_0xb184('0x55'),this[_0xb184('0xa')][_0x5bfcbd[_0xb184('0x26')]][_0x1f5bf5]);ami[_0xb184('0x23')](_0xb184('0x56'),this[_0xb184('0xa')][_0x5bfcbd[_0xb184('0x26')]][_0x1f5bf5]);}}}}}}catch(_0x1409ec){logger[_0xb184('0x32')](_0xb184('0x57'),util[_0xb184('0x48')](_0x1409ec,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xb184('0x17')]=function(_0x10a0e2){try{if(this[_0xb184('0x24')](_0x10a0e2)){this[_0xb184('0x58')](_0x10a0e2[_0xb184('0x26')],_[_0xb184('0x59')](_0x10a0e2[_0xb184('0x5a')])[0x0],_0x10a0e2[_0xb184('0x5b')]);if(this[_0xb184('0xa')][_0x10a0e2['uniqueid']]){for(var _0xfcf188 in this['channels'][_0x10a0e2[_0xb184('0x26')]]){if(this[_0xb184('0xa')][_0x10a0e2['uniqueid']][_0xb184('0x34')](_0xfcf188)){if(_[_0xb184('0x25')](this[_0xb184('0xa')][_0x10a0e2[_0xb184('0x26')]][_0xfcf188][_0xb184('0xc')])){this[_0xb184('0xa')][_0x10a0e2['uniqueid']][_0xfcf188][_0xb184('0xc')]={};}this[_0xb184('0xa')][_0x10a0e2[_0xb184('0x26')]][_0xfcf188][_0xb184('0xc')]=this[_0xb184('0xc')][_0x10a0e2[_0xb184('0x26')]];}}}}}catch(_0x1e9940){logger[_0xb184('0x32')](_0xb184('0x5c'),util[_0xb184('0x48')](_0x1e9940,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb184('0x22')]['addVariable']=function(_0x11bf39,_0x3896db,_0x209efc){var _0x17c4f0=['rtpaudioqos',_0xb184('0x5d'),'rtpaudioqosjitter','rtpaudioqosjitterbridged',_0xb184('0x5e'),_0xb184('0x5f'),_0xb184('0x60'),_0xb184('0x61'),_0xb184('0x62'),'sipuri',_0xb184('0x63'),_0xb184('0x64'),_0xb184('0x65'),'memberdynamic','memberinterface',_0xb184('0x66'),_0xb184('0x30'),_0xb184('0x67'),'memberrealtime'];if(!_[_0xb184('0x68')](_0x3896db)&&!_[_0xb184('0x69')](_0x17c4f0,_0x3896db)){if(_[_0xb184('0x25')](this[_0xb184('0xc')][_0x11bf39])){this['variables'][_0x11bf39]={};}this[_0xb184('0xc')][_0x11bf39][_0x3896db]=_0x209efc;}};VoiceAgentReport[_0xb184('0x22')][_0xb184('0x19')]=function(_0x3fecc3){try{if(this[_0xb184('0x24')](_0x3fecc3)){if(this['channels'][_0x3fecc3[_0xb184('0x26')]]){for(var _0x48766c in this[_0xb184('0xa')][_0x3fecc3[_0xb184('0x26')]]){if(this[_0xb184('0xa')][_0x3fecc3[_0xb184('0x26')]][_0xb184('0x34')](_0x48766c)){if(this[_0xb184('0xa')][_0x3fecc3[_0xb184('0x26')]][_0x48766c][_0xb184('0x43')]==_0xb184('0x51')&&this[_0xb184('0xa')][_0x3fecc3['uniqueid']][_0x48766c]['agentcomplete']){this[_0xb184('0xa')][_0x3fecc3['uniqueid']][_0x48766c][_0xb184('0x4e')]=moment()['format'](_0xb184('0x42'));}}}ami[_0xb184('0x23')](_0xb184('0x6a'),_[_0xb184('0x6b')](this[_0xb184('0xa')][_0x3fecc3['uniqueid']]));delete this[_0xb184('0xa')][_0x3fecc3[_0xb184('0x26')]];}if(this[_0xb184('0xc')][_0x3fecc3[_0xb184('0x26')]]){delete this[_0xb184('0xc')][_0x3fecc3[_0xb184('0x26')]];}}}catch(_0x5c3895){logger[_0xb184('0x32')](_0xb184('0x6c'),util[_0xb184('0x48')](_0x5c3895,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xb184('0x1f')]=function(_0x404ff4){try{if(this[_0xb184('0x24')](_0x404ff4)){if(this[_0xb184('0xa')][_0x404ff4[_0xb184('0x6d')]]){for(var _0x25c2eb in this[_0xb184('0xa')][_0x404ff4[_0xb184('0x6d')]]){if(this['channels'][_0x404ff4[_0xb184('0x6d')]][_0xb184('0x34')](_0x25c2eb)){if(_0x404ff4[_0xb184('0x6e')]===_0x25c2eb){var _0x5f36e0=moment();this['channels'][_0x404ff4[_0xb184('0x6d')]][_0x25c2eb]['agentcomplete']=!![];this['channels'][_0x404ff4['transfereeuniqueid']][_0x25c2eb][_0xb184('0x4e')]=moment()[_0xb184('0x2f')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xb184('0xa')][_0x404ff4['transfereeuniqueid']][_0x25c2eb]['reason']=_0xb184('0x51');this[_0xb184('0xa')][_0x404ff4[_0xb184('0x6d')]][_0x25c2eb]['lastevent']=_0xb184('0x4f');this['channels'][_0x404ff4[_0xb184('0x6d')]][_0x25c2eb][_0xb184('0x50')]=_0x5f36e0['diff'](this[_0xb184('0xa')][_0x404ff4[_0xb184('0x6d')]][_0x25c2eb][_0xb184('0x35')],_0xb184('0x6f'));}}}}if(this['channels'][_0x404ff4[_0xb184('0x70')]]){var _0x4df8ad=this[_0xb184('0xa')][_0x404ff4[_0xb184('0x70')]];this['channels'][_0x404ff4[_0xb184('0x70')]]=this[_0xb184('0xa')][_0x404ff4['transfereeuniqueid']];this[_0xb184('0xa')][_0x404ff4['transfereeuniqueid']]=_0x4df8ad;}}}catch(_0x5a7b7b){logger['error']('[syncAttendedTransfer][VoiceAgentReport]',util[_0xb184('0x48')](_0x5a7b7b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb184('0x22')][_0xb184('0x21')]=function(_0x5639bf){try{if(this[_0xb184('0x24')](_0x5639bf)){if(this[_0xb184('0xa')][_0x5639bf['transfereeuniqueid']]){for(var _0x23043a in this['channels'][_0x5639bf[_0xb184('0x6d')]]){if(this[_0xb184('0xa')][_0x5639bf[_0xb184('0x6d')]][_0xb184('0x34')](_0x23043a)){if(_0x5639bf[_0xb184('0x71')]===_0x23043a){var _0x298e7e=moment();this[_0xb184('0xa')][_0x5639bf[_0xb184('0x6d')]][_0x23043a][_0xb184('0x14')]=!![];this[_0xb184('0xa')][_0x5639bf[_0xb184('0x6d')]][_0x23043a][_0xb184('0x4e')]=_0x298e7e;this[_0xb184('0xa')][_0x5639bf[_0xb184('0x6d')]][_0x23043a][_0xb184('0x43')]=_0xb184('0x51');this[_0xb184('0xa')][_0x5639bf[_0xb184('0x6d')]][_0x23043a]['lastevent']='complete';this[_0xb184('0xa')][_0x5639bf[_0xb184('0x6d')]][_0x23043a][_0xb184('0x50')]=_0x298e7e[_0xb184('0x72')](this[_0xb184('0xa')][_0x5639bf[_0xb184('0x6d')]][_0x23043a][_0xb184('0x35')],_0xb184('0x6f'));}}}}}}catch(_0x6e0aae){logger[_0xb184('0x32')]('[syncBlindTransfer][VoiceAgentReport]',util[_0xb184('0x48')](_0x6e0aae,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb184('0x22')][_0xb184('0x1b')]=function(_0x9433dd){var _0xaf0f14='';try{if(this[_0xb184('0x24')](_0x9433dd)){if(_0x9433dd[_0xb184('0x73')]){_0xaf0f14=_0x9433dd[_0xb184('0x73')]['substring'](0x0,_0x9433dd['channel']['lastIndexOf']('-'));if(this[_0xb184('0xb')][_0xaf0f14]){this[_0xb184('0xb')][_0xaf0f14][_0xb184('0x74')]=!![];}}}}catch(_0x54790f){logger[_0xb184('0x32')](_0xb184('0x75'),util['inspect'](_0x54790f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb184('0x22')][_0xb184('0x1d')]=function(_0x541c74){var _0x5a6547='';try{if(this[_0xb184('0x24')](_0x541c74)){if(_0x541c74[_0xb184('0x73')]){_0x5a6547=_0x541c74['channel']['substring'](0x0,_0x541c74[_0xb184('0x73')][_0xb184('0x76')]('-'));if(this[_0xb184('0xb')][_0x5a6547]){this['agents'][_0x5a6547][_0xb184('0x74')]=![];}}}}catch(_0x1af8bb){logger[_0xb184('0x32')](_0xb184('0x77'),util[_0xb184('0x48')](_0x1af8bb,{'showHidden':![],'depth':null}));}};module[_0xb184('0x78')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 61fe6ba..f2e8922 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 _0x5e40=['[syncMusicOnHoldStart][VoiceCallReport]','milliseconds','[syncMusicOnHoldStop][VoiceCallReport]','bluebird','lodash','util','path','ioredis','../../../config/environment','../ami','../model/channel','not_inuse','inuse','unavailable','ringing','ringinuse','onhold','set','queue','dial','playback','voicemail','FAILED','NO\x20ANSWER','ANSWERED','BUSY','redis','defaults','channels','agents','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','varset','syncVarSet','hangup','newcallerid','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','then','actionCoreShowChannels','catch','log','prototype','isNotNull','syncNewCallerId','linkedid','uniqueid','[syncNewCallerId][VoiceCallReport]','inspect','OutgoingSpoolFailed','isUndefined','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','keys','from-sip','split','channel','destconnectedlinenum','format','user:%s','name','user:agentconnect','accountcode','error','[syncNewChannel][VoiceCallReport]','exten','application','applicationdata','appdata','duration','seconds','merge','pick','lastapplication','lastdata','match','[syncNewExten][VoiceCallReport]','syncNewState','channelstate','answered','answertime','holdtime','diff','calleridnum','xcally-motion-preview','connectedlinename','destinationchannel','UserId','membername','[syncNewState][VoiceCallReport]','syncMixMonitorFilename','.wav49','find','monitors','isNil','push','rec','variable','value','xmd-callerid','callerid','type','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','destination','xmcs-queue','sipcallid','parse','sipcalllinkedid','[syncVarSet][VoiceCallReport]','syncHangup','endtime','billableseconds','emit','user:agentcomplete','syncAttendedTransfer','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','transfereecalleridnum','extension','BlindTransfer','transfererchannel','mohstarttime'];(function(_0x27e6e9,_0x58740b){var _0x509342=function(_0x3814d9){while(--_0x3814d9){_0x27e6e9['push'](_0x27e6e9['shift']());}};_0x509342(++_0x58740b);}(_0x5e40,0x1a4));var _0x05e4=function(_0xe836b8,_0xe8b231){_0xe836b8=_0xe836b8-0x0;var _0xfcf4e0=_0x5e40[_0xe836b8];return _0xfcf4e0;};'use strict';var BPromise=require(_0x05e4('0x0'));var _=require(_0x05e4('0x1'));var moment=require('moment');var util=require(_0x05e4('0x2'));var path=require(_0x05e4('0x3'));var Redis=require(_0x05e4('0x4'));var config=require(_0x05e4('0x5'));var logger=require('../../../config/logger')('ami');var ami=require(_0x05e4('0x6'));var Channel=require(_0x05e4('0x7'));var statusDesc=['unknown',_0x05e4('0x8'),_0x05e4('0x9'),'busy','invalid',_0x05e4('0xa'),_0x05e4('0xb'),_0x05e4('0xc'),_0x05e4('0xd')];var applications=[_0x05e4('0xe'),_0x05e4('0xf'),'agi',_0x05e4('0x10'),_0x05e4('0x11'),_0x05e4('0x12')];var dispositions=['NO\x20ANSWER',_0x05e4('0x13'),_0x05e4('0x13'),_0x05e4('0x14'),'NO\x20ANSWER','NO\x20ANSWER',_0x05e4('0x15'),_0x05e4('0x16'),_0x05e4('0x13'),_0x05e4('0x13'),_0x05e4('0x13')];var actions={};config[_0x05e4('0x17')]=_[_0x05e4('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x05e4('0x17')]));function VoiceCallReport(_0x340f93){this[_0x05e4('0x19')]=_0x340f93[_0x05e4('0x19')];this[_0x05e4('0x1a')]=_0x340f93['agents'];ami['on']('coreshowchannel',this[_0x05e4('0x1b')][_0x05e4('0x1c')](this));ami['on'](_0x05e4('0x1d'),this[_0x05e4('0x1b')][_0x05e4('0x1c')](this));ami['on'](_0x05e4('0x1e'),this[_0x05e4('0x1f')]['bind'](this));ami['on'](_0x05e4('0x20'),this['syncNewState']['bind'](this));ami['on'](_0x05e4('0x21'),this[_0x05e4('0x22')][_0x05e4('0x1c')](this));ami['on'](_0x05e4('0x23'),this['syncHangup'][_0x05e4('0x1c')](this));ami['on'](_0x05e4('0x24'),this['syncNewCallerId']['bind'](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x05e4('0x1c')](this));ami['on']('blindtransfer',this[_0x05e4('0x25')][_0x05e4('0x1c')](this));ami['on'](_0x05e4('0x26'),this[_0x05e4('0x27')]['bind'](this));ami['on'](_0x05e4('0x28'),this['syncMusicOnHoldStop'][_0x05e4('0x1c')](this));return BPromise['resolve']()[_0x05e4('0x29')](ami[_0x05e4('0x2a')]())[_0x05e4('0x2b')](function(_0x468b4e){console[_0x05e4('0x2c')](_0x468b4e);});}VoiceCallReport[_0x05e4('0x2d')][_0x05e4('0x2e')]=function(_0x492546){return _0x492546!==null&&!_['isUndefined'](_0x492546);};VoiceCallReport[_0x05e4('0x2d')]['emit']=function(_0x4249ac,_0x1bc5e2,_0xf4e96e){io['to'](_0x4249ac)['emit'](_0x1bc5e2,_0xf4e96e);};VoiceCallReport[_0x05e4('0x2d')][_0x05e4('0x2f')]=function(_0x13cae4){try{if(this[_0x05e4('0x2e')](_0x13cae4)){if(_0x13cae4['uniqueid']===_0x13cae4[_0x05e4('0x30')]){if(!_['isUndefined'](this[_0x05e4('0x19')][_0x13cae4['uniqueid']])){_['merge'](this[_0x05e4('0x19')][_0x13cae4[_0x05e4('0x31')]],_['pick'](_0x13cae4,_['keys'](this['channels'][_0x13cae4[_0x05e4('0x31')]])));}}}}catch(_0xc954cc){logger['error'](_0x05e4('0x32'),util[_0x05e4('0x33')](_0xc954cc,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x05e4('0x1f')]=function(_0x3ab528){try{if(this['isNotNull'](_0x3ab528)){if(_0x3ab528[_0x05e4('0x31')]===_0x3ab528[_0x05e4('0x30')]&&_0x3ab528['channel']!=_0x05e4('0x34')){if(_[_0x05e4('0x35')](this[_0x05e4('0x19')][_0x3ab528['uniqueid']])){this[_0x05e4('0x19')][_0x3ab528[_0x05e4('0x31')]]=new Channel();this[_0x05e4('0x19')][_0x3ab528[_0x05e4('0x31')]][_0x05e4('0x36')]=moment()['format'](_0x05e4('0x37'));this['channels'][_0x3ab528[_0x05e4('0x31')]][_0x05e4('0x38')]=dispositions[_[_0x05e4('0x39')](_0x3ab528['channelstate'])];_['merge'](this[_0x05e4('0x19')][_0x3ab528[_0x05e4('0x31')]],_['pick'](_0x3ab528,_[_0x05e4('0x3a')](this[_0x05e4('0x19')][_0x3ab528[_0x05e4('0x31')]])));if(_0x3ab528['context']===_0x05e4('0x3b')){if(this[_0x05e4('0x1a')][_0x3ab528['channel'][_0x05e4('0x3c')]('-')[0x0]]){this[_0x05e4('0x1a')][_0x3ab528[_0x05e4('0x3d')][_0x05e4('0x3c')]('-')[0x0]][_0x05e4('0x3e')]=_0x3ab528['exten'];this['emit'](util[_0x05e4('0x3f')](_0x05e4('0x40'),this[_0x05e4('0x1a')][_0x3ab528['channel']['split']('-')[0x0]][_0x05e4('0x41')]),_0x05e4('0x42'),{'destaccountcode':this['agents'][_0x3ab528['channel'][_0x05e4('0x3c')]('-')[0x0]][_0x05e4('0x43')],'destconnectedlinenum':_0x3ab528['exten']});}}}}}}catch(_0x22591c){logger[_0x05e4('0x44')](_0x05e4('0x45'),util[_0x05e4('0x33')](_0x22591c,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x05e4('0x1b')]=function(_0x5e2359){try{if(this[_0x05e4('0x2e')](_0x5e2359)){if(_0x5e2359[_0x05e4('0x31')]===_0x5e2359['linkedid']&&_0x5e2359[_0x05e4('0x46')]!='h'&&_0x5e2359['channel']!=_0x05e4('0x34')){_0x5e2359[_0x05e4('0x47')]=_0x5e2359[_0x05e4('0x47')]['toLowerCase']();_0x5e2359[_0x05e4('0x48')]=(_0x5e2359[_0x05e4('0x49')]||_0x5e2359[_0x05e4('0x48')])['toLowerCase']();if(_[_0x05e4('0x35')](this[_0x05e4('0x19')][_0x5e2359[_0x05e4('0x31')]])){this[_0x05e4('0x19')][_0x5e2359[_0x05e4('0x31')]]=new Channel();this[_0x05e4('0x19')][_0x5e2359[_0x05e4('0x31')]][_0x05e4('0x36')]=_0x5e2359[_0x05e4('0x4a')]?moment()['subtract'](moment[_0x05e4('0x4a')](_0x5e2359[_0x05e4('0x4a')])[_0x05e4('0x4b')](),_0x05e4('0x4b'))[_0x05e4('0x3f')](_0x05e4('0x37')):moment()['format'](_0x05e4('0x37'));this['channels'][_0x5e2359[_0x05e4('0x31')]][_0x05e4('0x38')]=_0x05e4('0x14');}_[_0x05e4('0x4c')](this[_0x05e4('0x19')][_0x5e2359[_0x05e4('0x31')]],_[_0x05e4('0x4d')](_0x5e2359,_[_0x05e4('0x3a')](this[_0x05e4('0x19')][_0x5e2359[_0x05e4('0x31')]])));if(_['includes'](applications,_0x5e2359[_0x05e4('0x47')])){this[_0x05e4('0x19')][_0x5e2359['uniqueid']][_0x05e4('0x4e')]=_0x5e2359['application'];this[_0x05e4('0x19')][_0x5e2359['uniqueid']][_0x05e4('0x4f')]=_0x5e2359['applicationdata'];if(_0x5e2359['application']===_0x05e4('0xe')&&_['startsWith'](_0x5e2359[_0x05e4('0x48')],'cdr(')){var _0x98966a=_0x5e2359[_0x05e4('0x48')][_0x05e4('0x3c')]('=');var _0x53e0c2=_0x98966a[0x0][_0x05e4('0x50')](/cdr\((.*)\)/);if(_0x53e0c2){this[_0x05e4('0x19')][_0x5e2359[_0x05e4('0x31')]][_0x53e0c2[0x1]]=_0x98966a[0x1];}}else if(_0x5e2359[_0x05e4('0x47')]===_0x05e4('0xf')){this[_0x05e4('0x19')][_0x5e2359[_0x05e4('0x31')]][_0x05e4('0xf')]=_0x5e2359[_0x05e4('0x48')]['split'](',')[0x0];}}}}}catch(_0x1168c9){logger[_0x05e4('0x44')](_0x05e4('0x51'),util[_0x05e4('0x33')](_0x1168c9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x05e4('0x2d')][_0x05e4('0x52')]=function(_0x5d6719){try{if(this[_0x05e4('0x2e')](_0x5d6719)){if(_0x5d6719[_0x05e4('0x31')]!==_0x5d6719[_0x05e4('0x30')]){if(this[_0x05e4('0x19')][_0x5d6719['linkedid']]){if(_0x5d6719[_0x05e4('0x53')]==='6'){if(!this[_0x05e4('0x19')][_0x5d6719[_0x05e4('0x30')]][_0x05e4('0x54')]){var _0x25462d=moment();this[_0x05e4('0x19')][_0x5d6719[_0x05e4('0x30')]][_0x05e4('0x54')]=!![];this['channels'][_0x5d6719['linkedid']][_0x05e4('0x55')]=_0x25462d[_0x05e4('0x3f')](_0x05e4('0x37'));if(this[_0x05e4('0x19')][_0x5d6719[_0x05e4('0x30')]][_0x05e4('0x36')]){this['channels'][_0x5d6719[_0x05e4('0x30')]][_0x05e4('0x56')]=_0x25462d[_0x05e4('0x57')](this[_0x05e4('0x19')][_0x5d6719[_0x05e4('0x30')]][_0x05e4('0x36')],'seconds');}}this['channels'][_0x5d6719['linkedid']]['linkedid']=_0x5d6719[_0x05e4('0x31')];if(_0x5d6719[_0x05e4('0x58')]!==_0x05e4('0x59')){this[_0x05e4('0x19')][_0x5d6719[_0x05e4('0x30')]]['connectedlinenum']=_0x5d6719[_0x05e4('0x58')];}this['channels'][_0x5d6719[_0x05e4('0x30')]][_0x05e4('0x5a')]=_0x5d6719['calleridname'];this[_0x05e4('0x19')][_0x5d6719[_0x05e4('0x30')]][_0x05e4('0x5b')]=_0x5d6719[_0x05e4('0x3d')];this[_0x05e4('0x19')][_0x5d6719[_0x05e4('0x30')]]['disposition']=dispositions[_[_0x05e4('0x39')](_0x5d6719['channelstate'])];if(this['agents'][_0x5d6719[_0x05e4('0x3d')][_0x05e4('0x3c')]('-')[0x0]]){this[_0x05e4('0x19')][_0x5d6719[_0x05e4('0x30')]][_0x05e4('0x5c')]=this['agents'][_0x5d6719[_0x05e4('0x3d')][_0x05e4('0x3c')]('-')[0x0]]['id'];this[_0x05e4('0x19')][_0x5d6719[_0x05e4('0x30')]][_0x05e4('0x5d')]=this[_0x05e4('0x1a')][_0x5d6719[_0x05e4('0x3d')]['split']('-')[0x0]][_0x05e4('0x41')];}}}}else{if(this[_0x05e4('0x19')][_0x5d6719[_0x05e4('0x31')]]){if(_0x5d6719[_0x05e4('0x53')]==='6'){if(this[_0x05e4('0x1a')][_0x5d6719[_0x05e4('0x3d')][_0x05e4('0x3c')]('-')[0x0]]){this[_0x05e4('0x19')][_0x5d6719['uniqueid']][_0x05e4('0x5c')]=this[_0x05e4('0x1a')][_0x5d6719[_0x05e4('0x3d')][_0x05e4('0x3c')]('-')[0x0]]['id'];this[_0x05e4('0x19')][_0x5d6719['uniqueid']][_0x05e4('0x5d')]=this[_0x05e4('0x1a')][_0x5d6719[_0x05e4('0x3d')]['split']('-')[0x0]][_0x05e4('0x41')];}}}}}}catch(_0x511e6d){logger['error'](_0x05e4('0x5e'),util['inspect'](_0x511e6d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x05e4('0x2d')][_0x05e4('0x5f')]=function(_0x398e9b,_0x566051){if(this['channels'][_0x398e9b]){this[_0x05e4('0x19')][_0x398e9b]['monitor']=!![];if(_['endsWith'](_0x566051,'.wav49')){_0x566051=_0x566051['replace'](_0x05e4('0x60'),'.WAV');}this[_0x05e4('0x19')][_0x398e9b]['monitorFilename']=_0x566051;var _0xfd0efc=_[_0x05e4('0x61')](this[_0x05e4('0x19')][_0x398e9b][_0x05e4('0x62')],{'filename':_0x566051});if(_[_0x05e4('0x63')](_0xfd0efc)){this[_0x05e4('0x19')][_0x398e9b]['monitors'][_0x05e4('0x64')]({'filename':_0x566051,'createdAt':moment()[_0x05e4('0x3f')](_0x05e4('0x37')),'mixmonitorid':'','status':_0x05e4('0x65')});}}};VoiceCallReport[_0x05e4('0x2d')]['syncVarSet']=function(_0x11dd1d){try{if(this[_0x05e4('0x2e')](_0x11dd1d)){if(this[_0x05e4('0x19')][_0x11dd1d['uniqueid']]&&_0x11dd1d[_0x05e4('0x3d')]!=_0x05e4('0x34')){if(this[_0x05e4('0x2e')](_0x11dd1d['variable'])){if(this['isNotNull'](_0x11dd1d['variable']['mixmonitor_filename'])){this[_0x05e4('0x5f')](_0x11dd1d[_0x05e4('0x31')],_0x11dd1d['value']);}else if(this[_0x05e4('0x2e')](_0x11dd1d[_0x05e4('0x66')]['xmd-phone'])){this[_0x05e4('0x19')][_0x11dd1d[_0x05e4('0x31')]][_0x05e4('0x58')]=_0x11dd1d[_0x05e4('0x67')];}else if(this[_0x05e4('0x2e')](_0x11dd1d['variable'][_0x05e4('0x68')])){this[_0x05e4('0x19')][_0x11dd1d[_0x05e4('0x31')]][_0x05e4('0x69')]=_0x11dd1d[_0x05e4('0x67')];}else if(this[_0x05e4('0x2e')](_0x11dd1d[_0x05e4('0x66')]['xmd-cdrtype'])){this[_0x05e4('0x19')][_0x11dd1d['uniqueid']][_0x05e4('0x6a')]=_0x11dd1d[_0x05e4('0x67')];}else if(this[_0x05e4('0x2e')](_0x11dd1d[_0x05e4('0x66')]['xmd-queue'])){this[_0x05e4('0x19')][_0x11dd1d[_0x05e4('0x31')]][_0x05e4('0xf')]=_0x11dd1d[_0x05e4('0x67')][_0x05e4('0x3c')](',')[0x0];}else if(this[_0x05e4('0x2e')](_0x11dd1d[_0x05e4('0x66')][_0x05e4('0x6b')])){this[_0x05e4('0x19')][_0x11dd1d[_0x05e4('0x31')]][_0x05e4('0x6c')]=_0x11dd1d[_0x05e4('0x67')];}else if(this['isNotNull'](_0x11dd1d[_0x05e4('0x66')][_0x05e4('0x6d')])){this[_0x05e4('0x19')][_0x11dd1d[_0x05e4('0x31')]][_0x05e4('0x6e')]=_0x11dd1d['value'];}else if(this['isNotNull'](_0x11dd1d[_0x05e4('0x66')]['xmd-callerid-preview'])){this['channels'][_0x11dd1d[_0x05e4('0x31')]]['calleridpreview']=_0x11dd1d['value'];}else if(this[_0x05e4('0x2e')](_0x11dd1d[_0x05e4('0x66')][_0x05e4('0x6f')])){this[_0x05e4('0x19')][_0x11dd1d[_0x05e4('0x31')]]['queue']=_0x11dd1d[_0x05e4('0x67')];}else if(this[_0x05e4('0x2e')](_0x11dd1d['variable'][_0x05e4('0x70')])){this[_0x05e4('0x19')][_0x11dd1d[_0x05e4('0x31')]]['sipcalluniqueid']=_0x11dd1d['value'];}}}else if(this[_0x05e4('0x2e')](_0x11dd1d[_0x05e4('0x66')]['mixmonitor_filename'])){if(_0x11dd1d[_0x05e4('0x67')]){var _0x54fb9b=path[_0x05e4('0x71')](_0x11dd1d[_0x05e4('0x67')])['name'];this['syncMixMonitorFilename'](_0x54fb9b,_0x11dd1d[_0x05e4('0x67')]);}}else if(this[_0x05e4('0x19')][_0x11dd1d['linkedid']]){if(this['isNotNull'](_0x11dd1d[_0x05e4('0x66')])){if(this['isNotNull'](_0x11dd1d[_0x05e4('0x66')][_0x05e4('0x70')])){this[_0x05e4('0x19')][_0x11dd1d[_0x05e4('0x30')]][_0x05e4('0x72')]=_0x11dd1d[_0x05e4('0x67')];}}}}}catch(_0x3592d1){logger[_0x05e4('0x44')](_0x05e4('0x73'),util[_0x05e4('0x33')](_0x3592d1,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x05e4('0x2d')][_0x05e4('0x74')]=function(_0x3db185){try{if(this[_0x05e4('0x2e')](_0x3db185)){if(this[_0x05e4('0x19')][_0x3db185['uniqueid']]){var _0x5b832a=moment();this[_0x05e4('0x19')][_0x3db185['uniqueid']][_0x05e4('0x75')]=_0x5b832a[_0x05e4('0x3f')](_0x05e4('0x37'));this[_0x05e4('0x19')][_0x3db185[_0x05e4('0x31')]][_0x05e4('0x4a')]=_0x5b832a[_0x05e4('0x57')](this['channels'][_0x3db185[_0x05e4('0x31')]][_0x05e4('0x36')],_0x05e4('0x4b'));if(this[_0x05e4('0x19')][_0x3db185[_0x05e4('0x31')]]['answered']){this[_0x05e4('0x19')][_0x3db185[_0x05e4('0x31')]][_0x05e4('0x76')]=_0x5b832a[_0x05e4('0x57')](this['channels'][_0x3db185[_0x05e4('0x31')]][_0x05e4('0x55')],_0x05e4('0x4b'));this[_0x05e4('0x19')][_0x3db185[_0x05e4('0x31')]]['holdtime']=this[_0x05e4('0x19')][_0x3db185['uniqueid']][_0x05e4('0x4a')]-this[_0x05e4('0x19')][_0x3db185[_0x05e4('0x31')]][_0x05e4('0x76')];}if(_0x3db185['context']===_0x05e4('0x3b')){if(this[_0x05e4('0x1a')][_0x3db185[_0x05e4('0x3d')][_0x05e4('0x3c')]('-')[0x0]]){this[_0x05e4('0x1a')][_0x3db185['channel'][_0x05e4('0x3c')]('-')[0x0]]=_['omit'](this[_0x05e4('0x1a')][_0x3db185[_0x05e4('0x3d')]['split']('-')[0x0]],[_0x05e4('0x3e')]);this[_0x05e4('0x77')](util[_0x05e4('0x3f')](_0x05e4('0x40'),this[_0x05e4('0x1a')][_0x3db185[_0x05e4('0x3d')][_0x05e4('0x3c')]('-')[0x0]]['name']),_0x05e4('0x78'),{'destaccountcode':this['agents'][_0x3db185['channel'][_0x05e4('0x3c')]('-')[0x0]][_0x05e4('0x43')]});}}ami[_0x05e4('0x77')]('custom:voiceCallReport',this[_0x05e4('0x19')][_0x3db185[_0x05e4('0x31')]]);delete this[_0x05e4('0x19')][_0x3db185[_0x05e4('0x31')]];}}}catch(_0x349414){logger[_0x05e4('0x44')]('[syncHangup][VoiceCallReport]',util['inspect'](_0x349414,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x05e4('0x2d')][_0x05e4('0x79')]=function(_0x46dbf1){try{if(this[_0x05e4('0x2e')](_0x46dbf1)){if(this[_0x05e4('0x19')][_0x46dbf1[_0x05e4('0x7a')]]){this[_0x05e4('0x19')][_0x46dbf1[_0x05e4('0x7a')]][_0x05e4('0x7b')]=_0x46dbf1[_0x05e4('0x7c')];this[_0x05e4('0x19')][_0x46dbf1['transfereeuniqueid']][_0x05e4('0x7d')]=_0x46dbf1[_0x05e4('0x7e')];if(this[_0x05e4('0x19')][_0x46dbf1[_0x05e4('0x7f')]]){var _0x499dda=this[_0x05e4('0x19')][_0x46dbf1['secondtransfereruniqueid']];this[_0x05e4('0x19')][_0x46dbf1[_0x05e4('0x7f')]]=this[_0x05e4('0x19')][_0x46dbf1[_0x05e4('0x7a')]];this[_0x05e4('0x19')][_0x46dbf1['transfereeuniqueid']]=_0x499dda;}}else if(this[_0x05e4('0x19')][_0x46dbf1[_0x05e4('0x80')]]){this[_0x05e4('0x19')][_0x46dbf1['transfertargetuniqueid']][_0x05e4('0x7b')]=_0x46dbf1[_0x05e4('0x7c')];this['channels'][_0x46dbf1[_0x05e4('0x80')]][_0x05e4('0x7d')]=_0x46dbf1['transfertargetcalleridnum'];if(this['channels'][_0x46dbf1[_0x05e4('0x81')]]){var _0x499dda=this[_0x05e4('0x19')][_0x46dbf1[_0x05e4('0x81')]];this['channels'][_0x46dbf1[_0x05e4('0x81')]]=this['channels'][_0x46dbf1[_0x05e4('0x80')]];this[_0x05e4('0x19')][_0x46dbf1[_0x05e4('0x80')]]=_0x499dda;}}}}catch(_0x1363a9){logger['error'](_0x05e4('0x82'),util['inspect'](_0x1363a9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x05e4('0x2d')][_0x05e4('0x25')]=function(_0x4e4e70){try{if(this['isNotNull'](_0x4e4e70)){if(this[_0x05e4('0x19')][_0x4e4e70[_0x05e4('0x7a')]]){this[_0x05e4('0x19')][_0x4e4e70[_0x05e4('0x7a')]]['transfercalleridnum']=_0x4e4e70[_0x05e4('0x83')];this[_0x05e4('0x19')][_0x4e4e70[_0x05e4('0x7a')]][_0x05e4('0x7d')]=_0x4e4e70[_0x05e4('0x84')];this[_0x05e4('0x74')]({'event':_0x05e4('0x85'),'uniqueid':_0x4e4e70[_0x05e4('0x7a')],'context':_0x4e4e70['context'],'channel':_0x4e4e70[_0x05e4('0x86')]});}}}catch(_0x59419a){logger[_0x05e4('0x44')]('[syncBlindTransfer][VoiceCallReport]',util[_0x05e4('0x33')](_0x59419a,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncMusicOnHoldStart']=function(_0x48ec7d){try{if(this[_0x05e4('0x2e')](_0x48ec7d)){if(this[_0x05e4('0x19')][_0x48ec7d[_0x05e4('0x31')]]){if(!_[_0x05e4('0x63')](this[_0x05e4('0x19')][_0x48ec7d['uniqueid']][_0x05e4('0x55')])){this['channels'][_0x48ec7d[_0x05e4('0x31')]][_0x05e4('0x87')]=moment()[_0x05e4('0x3f')](_0x05e4('0x37'));}}}}catch(_0x42d3a1){logger[_0x05e4('0x44')](_0x05e4('0x88'),util[_0x05e4('0x33')](_0x42d3a1,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x05e4('0x2d')]['syncMusicOnHoldStop']=function(_0x3c37ec){try{if(this['isNotNull'](_0x3c37ec)){if(this['channels'][_0x3c37ec['uniqueid']]){if(!_['isNil'](this['channels'][_0x3c37ec[_0x05e4('0x31')]]['mohstarttime'])){this[_0x05e4('0x19')][_0x3c37ec[_0x05e4('0x31')]]['mohtime']+=moment()[_0x05e4('0x89')](0x0)[_0x05e4('0x57')](this[_0x05e4('0x19')][_0x3c37ec[_0x05e4('0x31')]][_0x05e4('0x87')],'seconds');delete this[_0x05e4('0x19')][_0x3c37ec['uniqueid']]['mohstarttime'];}}}}catch(_0x5f43bd){logger[_0x05e4('0x44')](_0x05e4('0x8a'),util[_0x05e4('0x33')](_0x5f43bd,{'showHidden':![],'depth':null}));}};module['exports']=VoiceCallReport; \ No newline at end of file +var _0xc285=['destinationchannel','toNumber','UserId','membername','[syncNewState][VoiceCallReport]','syncMixMonitorFilename','monitor','.wav49','replace','find','isNil','monitors','push','rec','variable','mixmonitor_filename','value','xmd-callerid','callerid','xmd-cdrtype','type','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','xmcs-queue','sipcallid','sipcalluniqueid','parse','sipcalllinkedid','endtime','billableseconds','from-sip','omit','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','extension','BlindTransfer','transfererchannel','answertime','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','mohtime','exports','bluebird','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../model/channel','unknown','not_inuse','inuse','invalid','unavailable','ringing','onhold','set','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','localhost','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','syncNewState','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','syncAttendedTransfer','blindtransfer','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','resolve','then','log','prototype','isNotNull','isUndefined','emit','uniqueid','linkedid','merge','pick','keys','error','[syncNewCallerId][VoiceCallReport]','inspect','channel','OutgoingSpoolFailed','format','YYYY-MM-DD\x20HH:mm:ss','disposition','channelstate','context','split','destconnectedlinenum','exten','user:%s','name','accountcode','[syncNewChannel][VoiceCallReport]','application','toLowerCase','applicationdata','appdata','starttime','duration','subtract','seconds','includes','startsWith','cdr(','match','[syncNewExten][VoiceCallReport]','answered','holdtime','diff','connectedlinenum','connectedlinename','calleridname'];(function(_0x403e49,_0x46991f){var _0x2da222=function(_0x5ed5a6){while(--_0x5ed5a6){_0x403e49['push'](_0x403e49['shift']());}};_0x2da222(++_0x46991f);}(_0xc285,0xcc));var _0x5c28=function(_0x1eb4e0,_0x4ebc2d){_0x1eb4e0=_0x1eb4e0-0x0;var _0x18ec21=_0xc285[_0x1eb4e0];return _0x18ec21;};'use strict';var BPromise=require(_0x5c28('0x0'));var _=require(_0x5c28('0x1'));var moment=require(_0x5c28('0x2'));var util=require(_0x5c28('0x3'));var path=require('path');var Redis=require(_0x5c28('0x4'));var config=require(_0x5c28('0x5'));var logger=require(_0x5c28('0x6'))(_0x5c28('0x7'));var ami=require('../ami');var Channel=require(_0x5c28('0x8'));var statusDesc=[_0x5c28('0x9'),_0x5c28('0xa'),_0x5c28('0xb'),'busy',_0x5c28('0xc'),_0x5c28('0xd'),_0x5c28('0xe'),'ringinuse',_0x5c28('0xf')];var applications=[_0x5c28('0x10'),_0x5c28('0x11'),_0x5c28('0x12'),_0x5c28('0x13'),_0x5c28('0x14'),_0x5c28('0x15')];var dispositions=[_0x5c28('0x16'),_0x5c28('0x17'),_0x5c28('0x17'),_0x5c28('0x16'),'NO\x20ANSWER','NO\x20ANSWER',_0x5c28('0x18'),_0x5c28('0x19'),'FAILED',_0x5c28('0x17'),_0x5c28('0x17')];var actions={};config[_0x5c28('0x1a')]=_[_0x5c28('0x1b')](config['redis'],{'host':_0x5c28('0x1c'),'port':0x18eb});var io=require(_0x5c28('0x1d'))(new Redis(config[_0x5c28('0x1a')]));function VoiceCallReport(_0x2fbed7){this[_0x5c28('0x1e')]=_0x2fbed7[_0x5c28('0x1e')];this[_0x5c28('0x1f')]=_0x2fbed7[_0x5c28('0x1f')];ami['on'](_0x5c28('0x20'),this[_0x5c28('0x21')][_0x5c28('0x22')](this));ami['on'](_0x5c28('0x23'),this['syncNewExten']['bind'](this));ami['on'](_0x5c28('0x24'),this[_0x5c28('0x25')]['bind'](this));ami['on'](_0x5c28('0x26'),this[_0x5c28('0x27')][_0x5c28('0x22')](this));ami['on']('varset',this[_0x5c28('0x28')]['bind'](this));ami['on'](_0x5c28('0x29'),this[_0x5c28('0x2a')][_0x5c28('0x22')](this));ami['on'](_0x5c28('0x2b'),this[_0x5c28('0x2c')][_0x5c28('0x22')](this));ami['on']('attendedtransfer',this[_0x5c28('0x2d')][_0x5c28('0x22')](this));ami['on'](_0x5c28('0x2e'),this['syncBlindTransfer'][_0x5c28('0x22')](this));ami['on'](_0x5c28('0x2f'),this[_0x5c28('0x30')][_0x5c28('0x22')](this));ami['on']('musiconholdstop',this[_0x5c28('0x31')][_0x5c28('0x22')](this));return BPromise[_0x5c28('0x32')]()[_0x5c28('0x33')](ami['actionCoreShowChannels']())['catch'](function(_0x331811){console[_0x5c28('0x34')](_0x331811);});}VoiceCallReport[_0x5c28('0x35')][_0x5c28('0x36')]=function(_0x5b8e1e){return _0x5b8e1e!==null&&!_[_0x5c28('0x37')](_0x5b8e1e);};VoiceCallReport['prototype'][_0x5c28('0x38')]=function(_0x1ff9ce,_0x3d276a,_0x343ad4){io['to'](_0x1ff9ce)['emit'](_0x3d276a,_0x343ad4);};VoiceCallReport[_0x5c28('0x35')][_0x5c28('0x2c')]=function(_0x2384d1){try{if(this[_0x5c28('0x36')](_0x2384d1)){if(_0x2384d1[_0x5c28('0x39')]===_0x2384d1[_0x5c28('0x3a')]){if(!_[_0x5c28('0x37')](this[_0x5c28('0x1e')][_0x2384d1[_0x5c28('0x39')]])){_[_0x5c28('0x3b')](this['channels'][_0x2384d1['uniqueid']],_[_0x5c28('0x3c')](_0x2384d1,_[_0x5c28('0x3d')](this[_0x5c28('0x1e')][_0x2384d1['uniqueid']])));}}}}catch(_0x57ff20){logger[_0x5c28('0x3e')](_0x5c28('0x3f'),util[_0x5c28('0x40')](_0x57ff20,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x5c28('0x25')]=function(_0x305b42){try{if(this[_0x5c28('0x36')](_0x305b42)){if(_0x305b42['uniqueid']===_0x305b42[_0x5c28('0x3a')]&&_0x305b42[_0x5c28('0x41')]!=_0x5c28('0x42')){if(_['isUndefined'](this[_0x5c28('0x1e')][_0x305b42[_0x5c28('0x39')]])){this['channels'][_0x305b42['uniqueid']]=new Channel();this['channels'][_0x305b42[_0x5c28('0x39')]]['starttime']=moment()[_0x5c28('0x43')](_0x5c28('0x44'));this[_0x5c28('0x1e')][_0x305b42['uniqueid']][_0x5c28('0x45')]=dispositions[_['toNumber'](_0x305b42[_0x5c28('0x46')])];_[_0x5c28('0x3b')](this[_0x5c28('0x1e')][_0x305b42[_0x5c28('0x39')]],_[_0x5c28('0x3c')](_0x305b42,_[_0x5c28('0x3d')](this[_0x5c28('0x1e')][_0x305b42[_0x5c28('0x39')]])));if(_0x305b42[_0x5c28('0x47')]==='from-sip'){if(this[_0x5c28('0x1f')][_0x305b42[_0x5c28('0x41')][_0x5c28('0x48')]('-')[0x0]]){this[_0x5c28('0x1f')][_0x305b42[_0x5c28('0x41')][_0x5c28('0x48')]('-')[0x0]][_0x5c28('0x49')]=_0x305b42[_0x5c28('0x4a')];this[_0x5c28('0x38')](util['format'](_0x5c28('0x4b'),this[_0x5c28('0x1f')][_0x305b42[_0x5c28('0x41')][_0x5c28('0x48')]('-')[0x0]][_0x5c28('0x4c')]),'user:agentconnect',{'destaccountcode':this[_0x5c28('0x1f')][_0x305b42[_0x5c28('0x41')][_0x5c28('0x48')]('-')[0x0]][_0x5c28('0x4d')],'destconnectedlinenum':_0x305b42[_0x5c28('0x4a')]});}}}}}}catch(_0x5f4210){logger[_0x5c28('0x3e')](_0x5c28('0x4e'),util[_0x5c28('0x40')](_0x5f4210,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5c28('0x35')][_0x5c28('0x21')]=function(_0x5701fb){try{if(this[_0x5c28('0x36')](_0x5701fb)){if(_0x5701fb[_0x5c28('0x39')]===_0x5701fb[_0x5c28('0x3a')]&&_0x5701fb[_0x5c28('0x4a')]!='h'&&_0x5701fb[_0x5c28('0x41')]!='OutgoingSpoolFailed'){_0x5701fb[_0x5c28('0x4f')]=_0x5701fb[_0x5c28('0x4f')][_0x5c28('0x50')]();_0x5701fb[_0x5c28('0x51')]=(_0x5701fb[_0x5c28('0x52')]||_0x5701fb[_0x5c28('0x51')])[_0x5c28('0x50')]();if(_[_0x5c28('0x37')](this[_0x5c28('0x1e')][_0x5701fb[_0x5c28('0x39')]])){this[_0x5c28('0x1e')][_0x5701fb[_0x5c28('0x39')]]=new Channel();this[_0x5c28('0x1e')][_0x5701fb[_0x5c28('0x39')]][_0x5c28('0x53')]=_0x5701fb[_0x5c28('0x54')]?moment()[_0x5c28('0x55')](moment[_0x5c28('0x54')](_0x5701fb[_0x5c28('0x54')])['seconds'](),_0x5c28('0x56'))['format']('YYYY-MM-DD\x20HH:mm:ss'):moment()[_0x5c28('0x43')](_0x5c28('0x44'));this[_0x5c28('0x1e')][_0x5701fb[_0x5c28('0x39')]][_0x5c28('0x45')]=_0x5c28('0x16');}_[_0x5c28('0x3b')](this[_0x5c28('0x1e')][_0x5701fb['uniqueid']],_[_0x5c28('0x3c')](_0x5701fb,_[_0x5c28('0x3d')](this['channels'][_0x5701fb[_0x5c28('0x39')]])));if(_[_0x5c28('0x57')](applications,_0x5701fb[_0x5c28('0x4f')])){this[_0x5c28('0x1e')][_0x5701fb[_0x5c28('0x39')]]['lastapplication']=_0x5701fb['application'];this['channels'][_0x5701fb[_0x5c28('0x39')]]['lastdata']=_0x5701fb[_0x5c28('0x51')];if(_0x5701fb['application']===_0x5c28('0x10')&&_[_0x5c28('0x58')](_0x5701fb[_0x5c28('0x51')],_0x5c28('0x59'))){var _0x30a45a=_0x5701fb[_0x5c28('0x51')][_0x5c28('0x48')]('=');var _0x4e9ffd=_0x30a45a[0x0][_0x5c28('0x5a')](/cdr\((.*)\)/);if(_0x4e9ffd){this[_0x5c28('0x1e')][_0x5701fb[_0x5c28('0x39')]][_0x4e9ffd[0x1]]=_0x30a45a[0x1];}}else if(_0x5701fb[_0x5c28('0x4f')]==='queue'){this[_0x5c28('0x1e')][_0x5701fb[_0x5c28('0x39')]]['queue']=_0x5701fb[_0x5c28('0x51')]['split'](',')[0x0];}}}}}catch(_0x44bda1){logger['error'](_0x5c28('0x5b'),util['inspect'](_0x44bda1,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5c28('0x35')][_0x5c28('0x27')]=function(_0x5b6a18){try{if(this[_0x5c28('0x36')](_0x5b6a18)){if(_0x5b6a18[_0x5c28('0x39')]!==_0x5b6a18[_0x5c28('0x3a')]){if(this[_0x5c28('0x1e')][_0x5b6a18[_0x5c28('0x3a')]]){if(_0x5b6a18[_0x5c28('0x46')]==='6'){if(!this[_0x5c28('0x1e')][_0x5b6a18[_0x5c28('0x3a')]]['answered']){var _0x24f60f=moment();this['channels'][_0x5b6a18['linkedid']][_0x5c28('0x5c')]=!![];this[_0x5c28('0x1e')][_0x5b6a18[_0x5c28('0x3a')]]['answertime']=_0x24f60f['format']('YYYY-MM-DD\x20HH:mm:ss');if(this['channels'][_0x5b6a18['linkedid']][_0x5c28('0x53')]){this[_0x5c28('0x1e')][_0x5b6a18[_0x5c28('0x3a')]][_0x5c28('0x5d')]=_0x24f60f[_0x5c28('0x5e')](this['channels'][_0x5b6a18['linkedid']][_0x5c28('0x53')],_0x5c28('0x56'));}}this[_0x5c28('0x1e')][_0x5b6a18[_0x5c28('0x3a')]]['linkedid']=_0x5b6a18[_0x5c28('0x39')];if(_0x5b6a18['calleridnum']!=='xcally-motion-preview'){this[_0x5c28('0x1e')][_0x5b6a18[_0x5c28('0x3a')]][_0x5c28('0x5f')]=_0x5b6a18['calleridnum'];}this[_0x5c28('0x1e')][_0x5b6a18[_0x5c28('0x3a')]][_0x5c28('0x60')]=_0x5b6a18[_0x5c28('0x61')];this[_0x5c28('0x1e')][_0x5b6a18[_0x5c28('0x3a')]][_0x5c28('0x62')]=_0x5b6a18['channel'];this[_0x5c28('0x1e')][_0x5b6a18['linkedid']]['disposition']=dispositions[_[_0x5c28('0x63')](_0x5b6a18[_0x5c28('0x46')])];if(this['agents'][_0x5b6a18['channel'][_0x5c28('0x48')]('-')[0x0]]){this['channels'][_0x5b6a18[_0x5c28('0x3a')]][_0x5c28('0x64')]=this[_0x5c28('0x1f')][_0x5b6a18[_0x5c28('0x41')][_0x5c28('0x48')]('-')[0x0]]['id'];this['channels'][_0x5b6a18[_0x5c28('0x3a')]][_0x5c28('0x65')]=this[_0x5c28('0x1f')][_0x5b6a18['channel'][_0x5c28('0x48')]('-')[0x0]][_0x5c28('0x4c')];}}}}else{if(this[_0x5c28('0x1e')][_0x5b6a18[_0x5c28('0x39')]]){if(_0x5b6a18['channelstate']==='6'){if(this[_0x5c28('0x1f')][_0x5b6a18[_0x5c28('0x41')]['split']('-')[0x0]]){this['channels'][_0x5b6a18[_0x5c28('0x39')]][_0x5c28('0x64')]=this[_0x5c28('0x1f')][_0x5b6a18[_0x5c28('0x41')][_0x5c28('0x48')]('-')[0x0]]['id'];this['channels'][_0x5b6a18[_0x5c28('0x39')]][_0x5c28('0x65')]=this['agents'][_0x5b6a18[_0x5c28('0x41')][_0x5c28('0x48')]('-')[0x0]][_0x5c28('0x4c')];}}}}}}catch(_0x3d41ab){logger[_0x5c28('0x3e')](_0x5c28('0x66'),util[_0x5c28('0x40')](_0x3d41ab,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5c28('0x35')][_0x5c28('0x67')]=function(_0x2281ec,_0x50903b){if(this[_0x5c28('0x1e')][_0x2281ec]){this[_0x5c28('0x1e')][_0x2281ec][_0x5c28('0x68')]=!![];if(_['endsWith'](_0x50903b,_0x5c28('0x69'))){_0x50903b=_0x50903b[_0x5c28('0x6a')]('.wav49','.WAV');}this['channels'][_0x2281ec]['monitorFilename']=_0x50903b;var _0x9bf52=_[_0x5c28('0x6b')](this[_0x5c28('0x1e')][_0x2281ec]['monitors'],{'filename':_0x50903b});if(_[_0x5c28('0x6c')](_0x9bf52)){this[_0x5c28('0x1e')][_0x2281ec][_0x5c28('0x6d')][_0x5c28('0x6e')]({'filename':_0x50903b,'createdAt':moment()[_0x5c28('0x43')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0x5c28('0x6f')});}}};VoiceCallReport['prototype']['syncVarSet']=function(_0x518cd7){try{if(this[_0x5c28('0x36')](_0x518cd7)){if(this[_0x5c28('0x1e')][_0x518cd7[_0x5c28('0x39')]]&&_0x518cd7[_0x5c28('0x41')]!='OutgoingSpoolFailed'){if(this[_0x5c28('0x36')](_0x518cd7[_0x5c28('0x70')])){if(this[_0x5c28('0x36')](_0x518cd7['variable'][_0x5c28('0x71')])){this['syncMixMonitorFilename'](_0x518cd7['uniqueid'],_0x518cd7[_0x5c28('0x72')]);}else if(this[_0x5c28('0x36')](_0x518cd7['variable']['xmd-phone'])){this[_0x5c28('0x1e')][_0x518cd7[_0x5c28('0x39')]]['calleridnum']=_0x518cd7[_0x5c28('0x72')];}else if(this[_0x5c28('0x36')](_0x518cd7['variable'][_0x5c28('0x73')])){this[_0x5c28('0x1e')][_0x518cd7[_0x5c28('0x39')]][_0x5c28('0x74')]=_0x518cd7['value'];}else if(this[_0x5c28('0x36')](_0x518cd7[_0x5c28('0x70')][_0x5c28('0x75')])){this['channels'][_0x518cd7[_0x5c28('0x39')]][_0x5c28('0x76')]=_0x518cd7[_0x5c28('0x72')];}else if(this[_0x5c28('0x36')](_0x518cd7['variable'][_0x5c28('0x77')])){this['channels'][_0x518cd7[_0x5c28('0x39')]]['queue']=_0x518cd7[_0x5c28('0x72')]['split'](',')[0x0];}else if(this[_0x5c28('0x36')](_0x518cd7[_0x5c28('0x70')][_0x5c28('0x78')])){this[_0x5c28('0x1e')][_0x518cd7[_0x5c28('0x39')]][_0x5c28('0x79')]=_0x518cd7[_0x5c28('0x72')];}else if(this[_0x5c28('0x36')](_0x518cd7[_0x5c28('0x70')][_0x5c28('0x7a')])){this[_0x5c28('0x1e')][_0x518cd7['uniqueid']][_0x5c28('0x7b')]=_0x518cd7[_0x5c28('0x72')];}else if(this['isNotNull'](_0x518cd7['variable'][_0x5c28('0x7c')])){this[_0x5c28('0x1e')][_0x518cd7[_0x5c28('0x39')]]['calleridpreview']=_0x518cd7[_0x5c28('0x72')];}else if(this[_0x5c28('0x36')](_0x518cd7[_0x5c28('0x70')][_0x5c28('0x7d')])){this[_0x5c28('0x1e')][_0x518cd7[_0x5c28('0x39')]][_0x5c28('0x11')]=_0x518cd7['value'];}else if(this['isNotNull'](_0x518cd7['variable'][_0x5c28('0x7e')])){this[_0x5c28('0x1e')][_0x518cd7[_0x5c28('0x39')]][_0x5c28('0x7f')]=_0x518cd7['value'];}}}else if(this[_0x5c28('0x36')](_0x518cd7[_0x5c28('0x70')][_0x5c28('0x71')])){if(_0x518cd7[_0x5c28('0x72')]){var _0x331796=path[_0x5c28('0x80')](_0x518cd7[_0x5c28('0x72')])[_0x5c28('0x4c')];this[_0x5c28('0x67')](_0x331796,_0x518cd7[_0x5c28('0x72')]);}}else if(this['channels'][_0x518cd7[_0x5c28('0x3a')]]){if(this['isNotNull'](_0x518cd7['variable'])){if(this[_0x5c28('0x36')](_0x518cd7[_0x5c28('0x70')]['sipcallid'])){this[_0x5c28('0x1e')][_0x518cd7[_0x5c28('0x3a')]][_0x5c28('0x81')]=_0x518cd7[_0x5c28('0x72')];}}}}}catch(_0x1b55fe){logger[_0x5c28('0x3e')]('[syncVarSet][VoiceCallReport]',util['inspect'](_0x1b55fe,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5c28('0x35')]['syncHangup']=function(_0x392855){try{if(this[_0x5c28('0x36')](_0x392855)){if(this['channels'][_0x392855[_0x5c28('0x39')]]){var _0x44fe66=moment();this['channels'][_0x392855['uniqueid']][_0x5c28('0x82')]=_0x44fe66[_0x5c28('0x43')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x5c28('0x1e')][_0x392855[_0x5c28('0x39')]]['duration']=_0x44fe66[_0x5c28('0x5e')](this[_0x5c28('0x1e')][_0x392855[_0x5c28('0x39')]][_0x5c28('0x53')],'seconds');if(this[_0x5c28('0x1e')][_0x392855['uniqueid']][_0x5c28('0x5c')]){this[_0x5c28('0x1e')][_0x392855[_0x5c28('0x39')]][_0x5c28('0x83')]=_0x44fe66[_0x5c28('0x5e')](this[_0x5c28('0x1e')][_0x392855[_0x5c28('0x39')]]['answertime'],'seconds');this[_0x5c28('0x1e')][_0x392855[_0x5c28('0x39')]][_0x5c28('0x5d')]=this['channels'][_0x392855[_0x5c28('0x39')]]['duration']-this[_0x5c28('0x1e')][_0x392855[_0x5c28('0x39')]][_0x5c28('0x83')];}if(_0x392855[_0x5c28('0x47')]===_0x5c28('0x84')){if(this['agents'][_0x392855[_0x5c28('0x41')][_0x5c28('0x48')]('-')[0x0]]){this['agents'][_0x392855[_0x5c28('0x41')]['split']('-')[0x0]]=_[_0x5c28('0x85')](this[_0x5c28('0x1f')][_0x392855['channel'][_0x5c28('0x48')]('-')[0x0]],[_0x5c28('0x49')]);this['emit'](util['format'](_0x5c28('0x4b'),this[_0x5c28('0x1f')][_0x392855[_0x5c28('0x41')][_0x5c28('0x48')]('-')[0x0]][_0x5c28('0x4c')]),'user:agentcomplete',{'destaccountcode':this[_0x5c28('0x1f')][_0x392855[_0x5c28('0x41')][_0x5c28('0x48')]('-')[0x0]][_0x5c28('0x4d')]});}}ami[_0x5c28('0x38')](_0x5c28('0x86'),this[_0x5c28('0x1e')][_0x392855[_0x5c28('0x39')]]);delete this[_0x5c28('0x1e')][_0x392855[_0x5c28('0x39')]];}}}catch(_0x52786e){logger[_0x5c28('0x3e')](_0x5c28('0x87'),util[_0x5c28('0x40')](_0x52786e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5c28('0x35')]['syncAttendedTransfer']=function(_0x480132){try{if(this[_0x5c28('0x36')](_0x480132)){if(this['channels'][_0x480132['transfereeuniqueid']]){this[_0x5c28('0x1e')][_0x480132[_0x5c28('0x88')]][_0x5c28('0x89')]=_0x480132[_0x5c28('0x8a')];this[_0x5c28('0x1e')][_0x480132[_0x5c28('0x88')]][_0x5c28('0x8b')]=_0x480132[_0x5c28('0x8c')];if(this[_0x5c28('0x1e')][_0x480132[_0x5c28('0x8d')]]){var _0x46fb6c=this[_0x5c28('0x1e')][_0x480132[_0x5c28('0x8d')]];this[_0x5c28('0x1e')][_0x480132[_0x5c28('0x8d')]]=this[_0x5c28('0x1e')][_0x480132[_0x5c28('0x88')]];this['channels'][_0x480132[_0x5c28('0x88')]]=_0x46fb6c;}}else if(this[_0x5c28('0x1e')][_0x480132[_0x5c28('0x8e')]]){this[_0x5c28('0x1e')][_0x480132['transfertargetuniqueid']][_0x5c28('0x89')]=_0x480132[_0x5c28('0x8a')];this['channels'][_0x480132['transfertargetuniqueid']]['transferconnectedlinenum']=_0x480132['transfertargetcalleridnum'];if(this['channels'][_0x480132['origtransfereruniqueid']]){var _0x46fb6c=this[_0x5c28('0x1e')][_0x480132['origtransfereruniqueid']];this[_0x5c28('0x1e')][_0x480132['origtransfereruniqueid']]=this[_0x5c28('0x1e')][_0x480132['transfertargetuniqueid']];this[_0x5c28('0x1e')][_0x480132[_0x5c28('0x8e')]]=_0x46fb6c;}}}}catch(_0x3fa676){logger[_0x5c28('0x3e')]('[syncAttendedTransfer][VoiceCallReport]',util['inspect'](_0x3fa676,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5c28('0x35')]['syncBlindTransfer']=function(_0x286f37){try{if(this[_0x5c28('0x36')](_0x286f37)){if(this[_0x5c28('0x1e')][_0x286f37['transfereeuniqueid']]){this[_0x5c28('0x1e')][_0x286f37[_0x5c28('0x88')]][_0x5c28('0x89')]=_0x286f37['transfereecalleridnum'];this[_0x5c28('0x1e')][_0x286f37[_0x5c28('0x88')]][_0x5c28('0x8b')]=_0x286f37[_0x5c28('0x8f')];this[_0x5c28('0x2a')]({'event':_0x5c28('0x90'),'uniqueid':_0x286f37['transfereeuniqueid'],'context':_0x286f37[_0x5c28('0x47')],'channel':_0x286f37[_0x5c28('0x91')]});}}}catch(_0x46497d){logger[_0x5c28('0x3e')]('[syncBlindTransfer][VoiceCallReport]',util[_0x5c28('0x40')](_0x46497d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5c28('0x35')][_0x5c28('0x30')]=function(_0x1e113d){try{if(this[_0x5c28('0x36')](_0x1e113d)){if(this[_0x5c28('0x1e')][_0x1e113d[_0x5c28('0x39')]]){if(!_['isNil'](this[_0x5c28('0x1e')][_0x1e113d[_0x5c28('0x39')]][_0x5c28('0x92')])){this[_0x5c28('0x1e')][_0x1e113d[_0x5c28('0x39')]][_0x5c28('0x93')]=moment()[_0x5c28('0x43')](_0x5c28('0x44'));}}}}catch(_0x305bfe){logger[_0x5c28('0x3e')](_0x5c28('0x94'),util[_0x5c28('0x40')](_0x305bfe,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5c28('0x35')][_0x5c28('0x31')]=function(_0x44f56f){try{if(this[_0x5c28('0x36')](_0x44f56f)){if(this['channels'][_0x44f56f['uniqueid']]){if(!_['isNil'](this[_0x5c28('0x1e')][_0x44f56f[_0x5c28('0x39')]][_0x5c28('0x93')])){this[_0x5c28('0x1e')][_0x44f56f[_0x5c28('0x39')]][_0x5c28('0x95')]+=moment()['milliseconds'](0x0)[_0x5c28('0x5e')](this[_0x5c28('0x1e')][_0x44f56f[_0x5c28('0x39')]][_0x5c28('0x93')],_0x5c28('0x56'));delete this[_0x5c28('0x1e')][_0x44f56f[_0x5c28('0x39')]]['mohstarttime'];}}}}catch(_0x30f496){logger['error']('[syncMusicOnHoldStop][VoiceCallReport]',util[_0x5c28('0x40')](_0x30f496,{'showHidden':![],'depth':null}));}};module[_0x5c28('0x96')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 4cb5b42..be1793d 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 _0x29e0=['dialstatus','connectedlinenum','connectedlinename','answertime','format','lastevent','connect','voice_outbound_channel:save','keys','variable','outboundrouteid','value','error','[syncVarSet][VoiceDialReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','sipcallid','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','includes','syncHangup','duration','endtime','diff','starttime','seconds','complete','answered','holdtime','billableseconds','sumBillable','sumDuration','custom:voiceDialReport','info','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','voice_outbound_channel:remove','[syncHangup][VoiceDialReport]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','channels','outbound','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','syncVarSet','hangup','prototype','isNotNull','isUndefined','emit','uniqueid','merge','YYYY-MM-DD\x20HH:mm:ss','called','substring','channel','lastIndexOf','event','voice:outbound','custom:dialbegin','inspect'];(function(_0x18d29b,_0x3034d2){var _0x3c354f=function(_0xb6ea2){while(--_0xb6ea2){_0x18d29b['push'](_0x18d29b['shift']());}};_0x3c354f(++_0x3034d2);}(_0x29e0,0x1c8));var _0x029e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x29e0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x029e('0x0'));var moment=require(_0x029e('0x1'));var util=require(_0x029e('0x2'));var Redis=require(_0x029e('0x3'));var config=require(_0x029e('0x4'));var logger=require(_0x029e('0x5'))(_0x029e('0x6'));var ami=require(_0x029e('0x7'));config[_0x029e('0x8')]=_[_0x029e('0x9')](config[_0x029e('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x029e('0x8')]));function VoiceDialReport(_0x3571ef){this[_0x029e('0xa')]=_0x3571ef['outboundChannels'];this[_0x029e('0xb')]=_0x3571ef['outbound'];this[_0x029e('0xc')]={};ami['on'](_0x029e('0xd'),this[_0x029e('0xe')][_0x029e('0xf')](this));ami['on'](_0x029e('0x10'),this[_0x029e('0x11')]['bind'](this));ami['on'](_0x029e('0x12'),this[_0x029e('0x13')][_0x029e('0xf')](this));ami['on'](_0x029e('0x14'),this['syncHangup'][_0x029e('0xf')](this));}VoiceDialReport[_0x029e('0x15')][_0x029e('0x16')]=function(_0x1a9e07){return _0x1a9e07!==null&&!_[_0x029e('0x17')](_0x1a9e07);};VoiceDialReport[_0x029e('0x15')][_0x029e('0x18')]=function(_0x272d04,_0x31381c,_0x5a3708){io['to'](_0x272d04)[_0x029e('0x18')](_0x31381c,_0x5a3708);};VoiceDialReport['prototype'][_0x029e('0xe')]=function(_0x427f82){try{if(this[_0x029e('0x16')](_0x427f82)){if(this[_0x029e('0xa')][_0x427f82[_0x029e('0x19')]]){_[_0x029e('0x1a')](this[_0x029e('0xa')][_0x427f82['uniqueid']],{'starttime':moment()['format'](_0x029e('0x1b')),'lastevent':_0x029e('0x1c'),'interface':_0x427f82['channel'][_0x029e('0x1d')](0x0,_0x427f82[_0x029e('0x1e')][_0x029e('0x1f')]('-')),'membername':_0x427f82['channel'][_0x029e('0x1d')](_0x427f82[_0x029e('0x1e')][_0x029e('0x1f')]('/')+0x1,_0x427f82[_0x029e('0x1e')][_0x029e('0x1f')]('-'))},_['omit'](_0x427f82,[_0x029e('0x20'),'privilege']));this['emit'](_0x029e('0x21'),'voice_outbound_channel:save',this[_0x029e('0xa')][_0x427f82[_0x029e('0x19')]]);ami[_0x029e('0x18')](_0x029e('0x22'),this[_0x029e('0xa')][_0x427f82[_0x029e('0x19')]]);}}}catch(_0x42c41c){logger['error']('[syncDialBegin][VoiceDialReport]',util[_0x029e('0x23')](_0x42c41c,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x029e('0x15')][_0x029e('0x11')]=function(_0x1c1dd9){try{if(this[_0x029e('0x16')](_0x1c1dd9)){if(this[_0x029e('0xa')][_0x1c1dd9[_0x029e('0x19')]]){this['channels'][_0x1c1dd9['uniqueid']][_0x029e('0x24')]=_0x1c1dd9[_0x029e('0x24')];if(_0x1c1dd9[_0x029e('0x24')]==='ANSWER'){this[_0x029e('0xa')][_0x1c1dd9['uniqueid']][_0x029e('0x25')]=_0x1c1dd9[_0x029e('0x25')];this['channels'][_0x1c1dd9[_0x029e('0x19')]]['connectedlinename']=_0x1c1dd9[_0x029e('0x26')];this['channels'][_0x1c1dd9[_0x029e('0x19')]][_0x029e('0x27')]=moment()[_0x029e('0x28')](_0x029e('0x1b'));this[_0x029e('0xa')][_0x1c1dd9['uniqueid']][_0x029e('0x29')]=_0x029e('0x2a');ami[_0x029e('0x18')]('custom:dialconnect',this[_0x029e('0xa')][_0x1c1dd9[_0x029e('0x19')]]);}this[_0x029e('0x18')](_0x029e('0x21'),_0x029e('0x2b'),this[_0x029e('0xa')][_0x1c1dd9[_0x029e('0x19')]]);}}}catch(_0x55c5b2){logger['error']('[syncDialEnd][VoiceDialReport]',util[_0x029e('0x23')](_0x55c5b2,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['syncVarSet']=function(_0x2a2a13){try{if(this[_0x029e('0x16')](_0x2a2a13)){this['addVariable'](_0x2a2a13[_0x029e('0x19')],_[_0x029e('0x2c')](_0x2a2a13[_0x029e('0x2d')])[0x0],_0x2a2a13['value']);if(this['isNotNull'](_0x2a2a13['variable'])&&this[_0x029e('0x16')](_0x2a2a13['variable'][_0x029e('0x2e')])){if(_['isUndefined'](this[_0x029e('0xa')][_0x2a2a13[_0x029e('0x19')]])){this[_0x029e('0xa')][_0x2a2a13[_0x029e('0x19')]]={'routeId':_0x2a2a13[_0x029e('0x2f')],'variables':this[_0x029e('0xc')][_0x2a2a13[_0x029e('0x19')]]};this[_0x029e('0x18')](_0x029e('0x21'),'voice_outbound_channel:save',this[_0x029e('0xa')][_0x2a2a13[_0x029e('0x19')]]);}}}}catch(_0x3c4e84){logger[_0x029e('0x30')](_0x029e('0x31'),util['inspect'](_0x3c4e84,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x029e('0x15')]['addVariable']=function(_0x127f6e,_0x40f78c,_0xf6519e){var _0x418017=[_0x029e('0x32'),_0x029e('0x33'),_0x029e('0x34'),_0x029e('0x35'),_0x029e('0x36'),_0x029e('0x37'),'rtpaudioqosrtt','rtpaudioqosrttbridged',_0x029e('0x38'),'sipuri','bridgepeer',_0x029e('0x39'),'membercalls',_0x029e('0x3a'),_0x029e('0x3b'),_0x029e('0x3c'),_0x029e('0x3d'),_0x029e('0x3e'),'memberrealtime'];if(!_['isNil'](_0x40f78c)&&!_[_0x029e('0x3f')](_0x418017,_0x40f78c)){if(_['isUndefined'](this['variables'][_0x127f6e])){this[_0x029e('0xc')][_0x127f6e]={};}this[_0x029e('0xc')][_0x127f6e][_0x40f78c]=_0xf6519e;}};VoiceDialReport[_0x029e('0x15')][_0x029e('0x40')]=function(_0x2ebbb3){try{if(this['isNotNull'](_0x2ebbb3)){if(this[_0x029e('0xa')][_0x2ebbb3[_0x029e('0x19')]]){this[_0x029e('0xa')][_0x2ebbb3[_0x029e('0x19')]]['endtime']=moment()['format'](_0x029e('0x1b'));this[_0x029e('0xa')][_0x2ebbb3[_0x029e('0x19')]][_0x029e('0x41')]=moment(this['channels'][_0x2ebbb3[_0x029e('0x19')]][_0x029e('0x42')])[_0x029e('0x43')](this[_0x029e('0xa')][_0x2ebbb3[_0x029e('0x19')]][_0x029e('0x44')],_0x029e('0x45'));this[_0x029e('0xa')][_0x2ebbb3['uniqueid']][_0x029e('0x29')]=_0x029e('0x46');this[_0x029e('0xb')]['total']+=0x1;if(this[_0x029e('0xa')][_0x2ebbb3[_0x029e('0x19')]][_0x029e('0x27')]){this[_0x029e('0xb')][_0x029e('0x47')]+=0x1;this[_0x029e('0xa')][_0x2ebbb3[_0x029e('0x19')]][_0x029e('0x48')]=moment(this[_0x029e('0xa')][_0x2ebbb3[_0x029e('0x19')]]['answertime'])[_0x029e('0x43')](this[_0x029e('0xa')][_0x2ebbb3[_0x029e('0x19')]][_0x029e('0x44')],'seconds');this['channels'][_0x2ebbb3[_0x029e('0x19')]][_0x029e('0x49')]=moment(this[_0x029e('0xa')][_0x2ebbb3[_0x029e('0x19')]]['endtime'])['diff'](this['channels'][_0x2ebbb3[_0x029e('0x19')]]['answertime'],'seconds');this[_0x029e('0xb')]['sumHoldTime']+=this[_0x029e('0xa')][_0x2ebbb3[_0x029e('0x19')]][_0x029e('0x48')]||0x0;this[_0x029e('0xb')][_0x029e('0x4a')]+=this['channels'][_0x2ebbb3[_0x029e('0x19')]][_0x029e('0x49')];}this[_0x029e('0xb')][_0x029e('0x4b')]+=this[_0x029e('0xa')][_0x2ebbb3['uniqueid']][_0x029e('0x41')];ami[_0x029e('0x18')](_0x029e('0x4c'),this[_0x029e('0xa')][_0x2ebbb3[_0x029e('0x19')]]);ami[_0x029e('0x18')]('custom:dialend',this[_0x029e('0xa')][_0x2ebbb3[_0x029e('0x19')]]);this[_0x029e('0x18')](_0x029e('0x21'),'voice_outbound:save',this[_0x029e('0xb')]);logger[_0x029e('0x4d')](_0x029e('0x4e'),JSON['stringify'](this[_0x029e('0xa')][_0x2ebbb3[_0x029e('0x19')]]));this[_0x029e('0x18')](_0x029e('0x21'),_0x029e('0x4f'),this[_0x029e('0xa')][_0x2ebbb3['uniqueid']]);delete this[_0x029e('0xa')][_0x2ebbb3[_0x029e('0x19')]];}if(this[_0x029e('0xc')][_0x2ebbb3['uniqueid']]){delete this[_0x029e('0xc')][_0x2ebbb3[_0x029e('0x19')]];}}}catch(_0x336979){logger['error'](_0x029e('0x50'),util[_0x029e('0x23')](_0x336979,{'showHidden':![],'depth':null}));}};module[_0x029e('0x51')]=VoiceDialReport; \ No newline at end of file +var _0x24ba=['isNotNull','isUndefined','prototype','emit','merge','uniqueid','called','substring','lastIndexOf','channel','omit','event','privilege','voice_outbound_channel:save','error','[syncDialBegin][VoiceDialReport]','inspect','dialstatus','ANSWER','connectedlinenum','connectedlinename','format','YYYY-MM-DD\x20HH:mm:ss','lastevent','connect','voice:outbound','[syncDialEnd][VoiceDialReport]','addVariable','keys','variable','value','outboundrouteid','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','duration','endtime','starttime','complete','outbound','total','answertime','answered','holdtime','diff','seconds','billableseconds','sumHoldTime','sumDuration','custom:voiceDialReport','info','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[syncHangup][VoiceDialReport]','exports','lodash','util','../../../config/environment','../../../config/logger','ami','../ami','redis','localhost','socket.io-emitter','channels','variables','dialbegin','bind','dialend','syncDialEnd','varset','syncVarSet','hangup','syncHangup'];(function(_0x348c60,_0x49bc62){var _0x152939=function(_0x538a1a){while(--_0x538a1a){_0x348c60['push'](_0x348c60['shift']());}};_0x152939(++_0x49bc62);}(_0x24ba,0xf2));var _0xa24b=function(_0x2646bc,_0xc54066){_0x2646bc=_0x2646bc-0x0;var _0x26a1b7=_0x24ba[_0x2646bc];return _0x26a1b7;};'use strict';var _=require(_0xa24b('0x0'));var moment=require('moment');var util=require(_0xa24b('0x1'));var Redis=require('ioredis');var config=require(_0xa24b('0x2'));var logger=require(_0xa24b('0x3'))(_0xa24b('0x4'));var ami=require(_0xa24b('0x5'));config[_0xa24b('0x6')]=_['defaults'](config['redis'],{'host':_0xa24b('0x7'),'port':0x18eb});var io=require(_0xa24b('0x8'))(new Redis(config['redis']));function VoiceDialReport(_0x527b57){this[_0xa24b('0x9')]=_0x527b57['outboundChannels'];this['outbound']=_0x527b57['outbound'];this[_0xa24b('0xa')]={};ami['on'](_0xa24b('0xb'),this['syncDialBegin'][_0xa24b('0xc')](this));ami['on'](_0xa24b('0xd'),this[_0xa24b('0xe')][_0xa24b('0xc')](this));ami['on'](_0xa24b('0xf'),this[_0xa24b('0x10')][_0xa24b('0xc')](this));ami['on'](_0xa24b('0x11'),this[_0xa24b('0x12')][_0xa24b('0xc')](this));}VoiceDialReport['prototype'][_0xa24b('0x13')]=function(_0x1c01b9){return _0x1c01b9!==null&&!_[_0xa24b('0x14')](_0x1c01b9);};VoiceDialReport[_0xa24b('0x15')][_0xa24b('0x16')]=function(_0x447343,_0x2d4948,_0x6eaf88){io['to'](_0x447343)[_0xa24b('0x16')](_0x2d4948,_0x6eaf88);};VoiceDialReport[_0xa24b('0x15')]['syncDialBegin']=function(_0xe1580){try{if(this[_0xa24b('0x13')](_0xe1580)){if(this[_0xa24b('0x9')][_0xe1580['uniqueid']]){_[_0xa24b('0x17')](this[_0xa24b('0x9')][_0xe1580[_0xa24b('0x18')]],{'starttime':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0xa24b('0x19'),'interface':_0xe1580['channel'][_0xa24b('0x1a')](0x0,_0xe1580['channel'][_0xa24b('0x1b')]('-')),'membername':_0xe1580[_0xa24b('0x1c')][_0xa24b('0x1a')](_0xe1580['channel'][_0xa24b('0x1b')]('/')+0x1,_0xe1580[_0xa24b('0x1c')][_0xa24b('0x1b')]('-'))},_[_0xa24b('0x1d')](_0xe1580,[_0xa24b('0x1e'),_0xa24b('0x1f')]));this[_0xa24b('0x16')]('voice:outbound',_0xa24b('0x20'),this[_0xa24b('0x9')][_0xe1580[_0xa24b('0x18')]]);ami[_0xa24b('0x16')]('custom:dialbegin',this[_0xa24b('0x9')][_0xe1580['uniqueid']]);}}}catch(_0x5dc80a){logger[_0xa24b('0x21')](_0xa24b('0x22'),util[_0xa24b('0x23')](_0x5dc80a,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xa24b('0xe')]=function(_0x383343){try{if(this[_0xa24b('0x13')](_0x383343)){if(this[_0xa24b('0x9')][_0x383343['uniqueid']]){this[_0xa24b('0x9')][_0x383343['uniqueid']][_0xa24b('0x24')]=_0x383343['dialstatus'];if(_0x383343[_0xa24b('0x24')]===_0xa24b('0x25')){this['channels'][_0x383343[_0xa24b('0x18')]][_0xa24b('0x26')]=_0x383343[_0xa24b('0x26')];this['channels'][_0x383343[_0xa24b('0x18')]]['connectedlinename']=_0x383343[_0xa24b('0x27')];this[_0xa24b('0x9')][_0x383343['uniqueid']]['answertime']=moment()[_0xa24b('0x28')](_0xa24b('0x29'));this[_0xa24b('0x9')][_0x383343[_0xa24b('0x18')]][_0xa24b('0x2a')]=_0xa24b('0x2b');ami[_0xa24b('0x16')]('custom:dialconnect',this['channels'][_0x383343[_0xa24b('0x18')]]);}this[_0xa24b('0x16')](_0xa24b('0x2c'),'voice_outbound_channel:save',this['channels'][_0x383343['uniqueid']]);}}}catch(_0x3120f7){logger[_0xa24b('0x21')](_0xa24b('0x2d'),util[_0xa24b('0x23')](_0x3120f7,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xa24b('0x10')]=function(_0x1db177){try{if(this[_0xa24b('0x13')](_0x1db177)){this[_0xa24b('0x2e')](_0x1db177[_0xa24b('0x18')],_[_0xa24b('0x2f')](_0x1db177[_0xa24b('0x30')])[0x0],_0x1db177[_0xa24b('0x31')]);if(this[_0xa24b('0x13')](_0x1db177[_0xa24b('0x30')])&&this['isNotNull'](_0x1db177[_0xa24b('0x30')][_0xa24b('0x32')])){if(_[_0xa24b('0x14')](this[_0xa24b('0x9')][_0x1db177[_0xa24b('0x18')]])){this['channels'][_0x1db177[_0xa24b('0x18')]]={'routeId':_0x1db177['value'],'variables':this[_0xa24b('0xa')][_0x1db177[_0xa24b('0x18')]]};this[_0xa24b('0x16')](_0xa24b('0x2c'),_0xa24b('0x20'),this['channels'][_0x1db177[_0xa24b('0x18')]]);}}}}catch(_0x14a54a){logger[_0xa24b('0x21')]('[syncVarSet][VoiceDialReport]',util[_0xa24b('0x23')](_0x14a54a,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xa24b('0x15')][_0xa24b('0x2e')]=function(_0x1fc250,_0x2fc2ec,_0x20cccb){var _0x25e3d1=['rtpaudioqos',_0xa24b('0x33'),_0xa24b('0x34'),_0xa24b('0x35'),_0xa24b('0x36'),_0xa24b('0x37'),_0xa24b('0x38'),_0xa24b('0x39'),_0xa24b('0x3a'),_0xa24b('0x3b'),'bridgepeer',_0xa24b('0x3c'),_0xa24b('0x3d'),'memberdynamic',_0xa24b('0x3e'),_0xa24b('0x3f'),'membername',_0xa24b('0x40'),_0xa24b('0x41')];if(!_[_0xa24b('0x42')](_0x2fc2ec)&&!_['includes'](_0x25e3d1,_0x2fc2ec)){if(_[_0xa24b('0x14')](this[_0xa24b('0xa')][_0x1fc250])){this['variables'][_0x1fc250]={};}this[_0xa24b('0xa')][_0x1fc250][_0x2fc2ec]=_0x20cccb;}};VoiceDialReport[_0xa24b('0x15')][_0xa24b('0x12')]=function(_0x32af6a){try{if(this['isNotNull'](_0x32af6a)){if(this[_0xa24b('0x9')][_0x32af6a[_0xa24b('0x18')]]){this[_0xa24b('0x9')][_0x32af6a[_0xa24b('0x18')]]['endtime']=moment()[_0xa24b('0x28')](_0xa24b('0x29'));this[_0xa24b('0x9')][_0x32af6a[_0xa24b('0x18')]][_0xa24b('0x43')]=moment(this[_0xa24b('0x9')][_0x32af6a['uniqueid']][_0xa24b('0x44')])['diff'](this['channels'][_0x32af6a[_0xa24b('0x18')]][_0xa24b('0x45')],'seconds');this['channels'][_0x32af6a[_0xa24b('0x18')]]['lastevent']=_0xa24b('0x46');this[_0xa24b('0x47')][_0xa24b('0x48')]+=0x1;if(this['channels'][_0x32af6a[_0xa24b('0x18')]][_0xa24b('0x49')]){this[_0xa24b('0x47')][_0xa24b('0x4a')]+=0x1;this[_0xa24b('0x9')][_0x32af6a[_0xa24b('0x18')]][_0xa24b('0x4b')]=moment(this['channels'][_0x32af6a[_0xa24b('0x18')]]['answertime'])[_0xa24b('0x4c')](this[_0xa24b('0x9')][_0x32af6a[_0xa24b('0x18')]][_0xa24b('0x45')],_0xa24b('0x4d'));this['channels'][_0x32af6a[_0xa24b('0x18')]][_0xa24b('0x4e')]=moment(this[_0xa24b('0x9')][_0x32af6a[_0xa24b('0x18')]][_0xa24b('0x44')])[_0xa24b('0x4c')](this[_0xa24b('0x9')][_0x32af6a[_0xa24b('0x18')]][_0xa24b('0x49')],_0xa24b('0x4d'));this[_0xa24b('0x47')][_0xa24b('0x4f')]+=this[_0xa24b('0x9')][_0x32af6a[_0xa24b('0x18')]][_0xa24b('0x4b')]||0x0;this[_0xa24b('0x47')]['sumBillable']+=this['channels'][_0x32af6a[_0xa24b('0x18')]]['billableseconds'];}this[_0xa24b('0x47')][_0xa24b('0x50')]+=this[_0xa24b('0x9')][_0x32af6a[_0xa24b('0x18')]][_0xa24b('0x43')];ami[_0xa24b('0x16')](_0xa24b('0x51'),this['channels'][_0x32af6a[_0xa24b('0x18')]]);ami[_0xa24b('0x16')]('custom:dialend',this['channels'][_0x32af6a[_0xa24b('0x18')]]);this[_0xa24b('0x16')](_0xa24b('0x2c'),'voice_outbound:save',this[_0xa24b('0x47')]);logger[_0xa24b('0x52')](_0xa24b('0x53'),JSON[_0xa24b('0x54')](this[_0xa24b('0x9')][_0x32af6a[_0xa24b('0x18')]]));this[_0xa24b('0x16')](_0xa24b('0x2c'),'voice_outbound_channel:remove',this[_0xa24b('0x9')][_0x32af6a['uniqueid']]);delete this[_0xa24b('0x9')][_0x32af6a['uniqueid']];}if(this[_0xa24b('0xa')][_0x32af6a['uniqueid']]){delete this[_0xa24b('0xa')][_0x32af6a[_0xa24b('0x18')]];}}}catch(_0x4a35cb){logger['error'](_0xa24b('0x55'),util[_0xa24b('0x23')](_0x4a35cb,{'showHidden':![],'depth':null}));}};module[_0xa24b('0x56')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 431ad70..1012e35 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 _0xdffd=['syncHangup','fullybooted','syncFullyBooted','musiconholdstart','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isUndefined','isEmpty','hasOwnProperty','originated','talking','waiting','queueStatusComplete','unlockRR','prototype','clearZombieChannels','channels','switch','Action','status','channel','catch','message','No\x20such\x20channel','[voiceQueueReport][checkChannel]','queueReports','error','[voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','inspect','emit','emitVoiceQueueChannelSave','format','voice:queue:%s','name','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice_queue_channel:remove','emitVoiceQueueSummary','type','inbound','strategy','answered','pTalking','sumDuration','sumHoldTime','unmanaged','abandoned','Trunk','active','callerid','Interval','voice_queue:save','isNotNull','queues','queuesummary','then','[queuesummary]','queue','countBy','callers','toNumber','loggedIn','available','loggedin','custom:queuesummary','syncNewExten','uniqueid','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','merge','keys','[syncQueueCallerJoin][VoiceQueueReport]','syncQueueCallerAbandon','last','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerexitreason','ABANDONED','[syncQueueCallerAbandon][VoiceQueueReport]','queuecallerleaveAt','connectedlinenum','connectedlinename','[syncQueueCallerLeave][VoiceQueueReport]','COMPLETEDBYAGENT','syncAgentComplete','lastAssignedTo','membername','queuecallerexitAt','transfer','reason','COMPLETED','startsWith','toLowerCase','local/','linkedid','queuecallerexit','add','seconds','FORWARDTRANSFER','transfertype','FORWARD','transferexten','destexten','transferuniqueid','COMPLETEDBY','[syncAgentComplete][VoiceQueueReport]','addVariable','variable','value','queuestatus','CONTINUE','TIMEOUT','lastevent','timeout','custom:timeout','queuecallerabandonAt','queueposition','EXITWITHKEY','[syncVarSet][VoiceQueueReport]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','length','diff','total','sumBillable','custom:queuecallerabandon','custom:voiceQueueReport','[syncHangup][VoiceQueueReport]','transfereeuniqueid','ATTENDEDTRANSFER','secondtransfereruniqueid','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','[syncAttendedTransfer][VoiceQueueReport]','BLINDTRANSFER','BLIND','BlindTransfer','context','[syncBlindTransfer][VoiceQueueReport]','syncMusicOnHoldStart','mohstarttime','syncMusicOnHoldStop','mohtime','milliseconds','[syncMusicOnHoldStop][VoiceQueueReport]','exports','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','enqueue','tail','sequence','agents','queueChannels','voiceQueues','flagQueueSummary','campaigns','variables','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','syncQueueCallerJoin','queuecallerabandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','agentconnect','varset','syncVarSet'];(function(_0x468c23,_0x2aac29){var _0x4a88f0=function(_0x1b6e6b){while(--_0x1b6e6b){_0x468c23['push'](_0x468c23['shift']());}};_0x4a88f0(++_0x2aac29);}(_0xdffd,0x17b));var _0xddff=function(_0xc8e0dc,_0x44f34b){_0xc8e0dc=_0xc8e0dc-0x0;var _0x56ccbf=_0xdffd[_0xc8e0dc];return _0x56ccbf;};'use strict';var _=require('lodash');var moment=require(_0xddff('0x0'));var BPromise=require(_0xddff('0x1'));var util=require('util');var md5=require(_0xddff('0x2'));var Redis=require(_0xddff('0x3'));var config=require(_0xddff('0x4'));var logger=require(_0xddff('0x5'))(_0xddff('0x6'));var ami=require(_0xddff('0x7'));var QueueReport=require('../model/queueReport');config[_0xddff('0x8')]=_[_0xddff('0x9')](config[_0xddff('0x8')],{'host':_0xddff('0xa'),'port':0x18eb});var io=require(_0xddff('0xb'))(new Redis(config[_0xddff('0x8')]));var Sequence=function(){};Sequence['prototype'][_0xddff('0xc')]=function(_0x337f67){this[_0xddff('0xd')]=this['tail']?this['tail']['finally'](_0x337f67):_0x337f67();};function VoiceQueueReport(_0x23f048){this[_0xddff('0xe')]=new Sequence();this['queueReports']={};this[_0xddff('0xf')]=_0x23f048[_0xddff('0xf')];this['channels']=_0x23f048[_0xddff('0x10')];this[_0xddff('0x11')]=_0x23f048[_0xddff('0x11')];this[_0xddff('0x12')]=!![];this[_0xddff('0x13')]=_0x23f048[_0xddff('0x13')];this[_0xddff('0x14')]={};ami['on']('queuesummary',this[_0xddff('0x15')][_0xddff('0x16')](this));ami['on'](_0xddff('0x17'),this[_0xddff('0x18')][_0xddff('0x16')](this));ami['on']('queuecallerjoin',this[_0xddff('0x19')]['bind'](this));ami['on'](_0xddff('0x1a'),this['syncQueueCallerAbandon'][_0xddff('0x16')](this));ami['on'](_0xddff('0x1b'),this[_0xddff('0x1c')][_0xddff('0x16')](this));ami['on'](_0xddff('0x1d'),this['syncAgentComplete'][_0xddff('0x16')](this));ami['on'](_0xddff('0x1e'),this['syncAgentConnect'][_0xddff('0x16')](this));ami['on'](_0xddff('0x1f'),this[_0xddff('0x20')][_0xddff('0x16')](this));ami['on']('hangup',this[_0xddff('0x21')][_0xddff('0x16')](this));ami['on'](_0xddff('0x22'),this[_0xddff('0x23')][_0xddff('0x16')](this));ami['on'](_0xddff('0x24'),this['syncMusicOnHoldStart'][_0xddff('0x16')](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop'][_0xddff('0x16')](this));ami['on']('attendedtransfer',this[_0xddff('0x25')][_0xddff('0x16')](this));ami['on'](_0xddff('0x26'),this[_0xddff('0x27')][_0xddff('0x16')](this));this[_0xddff('0x28')]();this[_0xddff('0x29')]();}function isNotNull(_0x3ddd8f){return _0x3ddd8f!==null&&!_[_0xddff('0x2a')](_0x3ddd8f);}function clearChannels(_0x1ccb9e){if(!_[_0xddff('0x2b')](_0x1ccb9e)){for(var _0x114875 in _0x1ccb9e){if(_0x1ccb9e[_0xddff('0x2c')](_0x114875)){delete _0x1ccb9e[_0x114875];}}}}function clearCampaigns(_0x129f24){if(!_[_0xddff('0x2b')](_0x129f24)){for(var _0x402053 in _0x129f24){if(_0x129f24[_0xddff('0x2c')](_0x402053)){_0x129f24[_0x402053][_0xddff('0x2d')]=0x0;}}}}function clearVoiceQueues(_0xb51af9){if(!_[_0xddff('0x2b')](_0xb51af9)){for(var _0x115835 in _0xb51af9){if(_0xb51af9[_0xddff('0x2c')](_0x115835)){_0xb51af9[_0x115835][_0xddff('0x2d')]=0x0;_0xb51af9[_0x115835][_0xddff('0x2e')]=0x0;_0xb51af9[_0x115835]['pTalking']=0x0;_0xb51af9[_0x115835][_0xddff('0x2f')]=0x0;_0xb51af9[_0x115835][_0xddff('0x30')]=!![];}}}}function clearAgentBooked(_0x5e2b59){if(!_[_0xddff('0x2b')](_0x5e2b59)){for(var _0x40089a in _0x5e2b59){if(_0x5e2b59['hasOwnProperty'](_0x40089a)){_0x5e2b59[_0x40089a][_0xddff('0x31')]=!![];}}}}VoiceQueueReport[_0xddff('0x32')][_0xddff('0x33')]=function(){var _0x10ebe5=this;for(var _0x4afbf5 in this['channels']){if(this[_0xddff('0x34')][_0xddff('0x2c')](_0x4afbf5)&&!this[_0xddff('0x34')][_0x4afbf5][_0xddff('0x35')]){this[_0xddff('0xe')][_0xddff('0xc')](function(){if(!_['isNil'](_0x10ebe5[_0xddff('0x34')][_0x4afbf5])){return ami[_0xddff('0x36')]({'action':_0xddff('0x37'),'channel':_0x10ebe5[_0xddff('0x34')][_0x4afbf5][_0xddff('0x38')]})[_0xddff('0x39')](function(_0x31b106){if(_0x31b106[_0xddff('0x3a')]===_0xddff('0x3b')){setTimeout(function(){if(_0x10ebe5[_0xddff('0x34')][_0x4afbf5]){delete _0x10ebe5[_0xddff('0x34')][_0x4afbf5];logger['error'](_0xddff('0x3c'),_0x4afbf5);}if(_0x10ebe5[_0xddff('0x3d')][_0x4afbf5]){delete _0x10ebe5['queueReports'][_0x4afbf5];logger[_0xddff('0x3e')]('[voiceQueueReport][checkQueueReport]',_0x4afbf5);}if(_0x10ebe5[_0xddff('0x14')][_0x4afbf5]){delete _0x10ebe5['variables'][_0x4afbf5];logger[_0xddff('0x3e')](_0xddff('0x3f'),_0x4afbf5);}},0x1f40);}});}});}}};VoiceQueueReport[_0xddff('0x32')][_0xddff('0x23')]=function(){logger[_0xddff('0x3e')](_0xddff('0x40'));clearChannels(this[_0xddff('0x34')]);this[_0xddff('0x41')](this[_0xddff('0x3d')]);clearAgentBooked(this['agents']);clearVoiceQueues(this[_0xddff('0x11')]);clearCampaigns(this[_0xddff('0x13')]);};VoiceQueueReport[_0xddff('0x32')][_0xddff('0x41')]=function(_0x3405e7){var _0x4f2286=this;if(!_['isEmpty'](_0x3405e7)){for(var _0x1dae29 in _0x3405e7){if(_0x3405e7[_0xddff('0x2c')](_0x1dae29)){_0x4f2286[_0xddff('0x42')](_0x3405e7[_0x1dae29]);delete _0x3405e7[_0x1dae29];}}}};function loggerCatch(_0x4befdb){return function(_0x41dca3){logger[_0xddff('0x3e')](_0x4befdb,util[_0xddff('0x43')](_0x41dca3,{'showHidden':![],'depth':null}));};}VoiceQueueReport[_0xddff('0x32')][_0xddff('0x44')]=function(_0x29976a,_0x53e586,_0x3afc33){io['to'](_0x29976a)[_0xddff('0x44')](_0x53e586,_0x3afc33);};VoiceQueueReport[_0xddff('0x32')][_0xddff('0x45')]=function(_0x10a72c){this[_0xddff('0x44')](util[_0xddff('0x46')](_0xddff('0x47'),_0x10a72c[_0xddff('0x48')]),'voice_queue_channel:save',_0x10a72c);};VoiceQueueReport['prototype'][_0xddff('0x42')]=function(_0x54fecb){logger[_0xddff('0x49')](_0xddff('0x4a'),JSON[_0xddff('0x4b')](_0x54fecb));this[_0xddff('0x44')](util['format'](_0xddff('0x47'),_0x54fecb[_0xddff('0x48')]),_0xddff('0x4c'),_0x54fecb);};VoiceQueueReport['prototype'][_0xddff('0x4d')]=function(_0x22e3b7){if(_0x22e3b7[_0xddff('0x4e')]===_0xddff('0x4f')){var _0x5b1f6f={'id':_0x22e3b7['id'],'name':_0x22e3b7['name'],'strategy':_0x22e3b7[_0xddff('0x50')],'answered':_0x22e3b7[_0xddff('0x51')],'available':_0x22e3b7['available'],'loggedIn':_0x22e3b7['loggedIn'],'pTalking':_0x22e3b7[_0xddff('0x52')],'sumBillable':_0x22e3b7['sumBillable'],'sumDuration':_0x22e3b7[_0xddff('0x53')],'sumHoldTime':_0x22e3b7[_0xddff('0x54')]||0x0,'talking':_0x22e3b7['talking'],'total':_0x22e3b7['total'],'type':_0x22e3b7[_0xddff('0x4e')],'unmanaged':_0x22e3b7[_0xddff('0x55')],'abandoned':_0x22e3b7[_0xddff('0x56')],'waiting':_0x22e3b7[_0xddff('0x2f')]};if(_0x22e3b7[_0xddff('0x57')]){_0x5b1f6f[_0xddff('0x57')]={'id':_0x22e3b7[_0xddff('0x57')]['id'],'name':_0x22e3b7[_0xddff('0x57')][_0xddff('0x48')],'active':_0x22e3b7[_0xddff('0x57')][_0xddff('0x58')],'callerid':_0x22e3b7['Trunk'][_0xddff('0x59')]};}if(_0x22e3b7['Interval']){_0x5b1f6f[_0xddff('0x5a')]={'id':_0x22e3b7[_0xddff('0x5a')]['id'],'name':_0x22e3b7[_0xddff('0x5a')]['name']};}var _0x229279=md5(JSON[_0xddff('0x4b')](_0x5b1f6f));if(_0x22e3b7[_0xddff('0x2')]!==_0x229279){_0x22e3b7['md5']=_0x229279;this['emit'](util[_0xddff('0x46')](_0xddff('0x47'),_0x5b1f6f[_0xddff('0x48')]),_0xddff('0x5b'),_0x5b1f6f);}}};VoiceQueueReport[_0xddff('0x32')][_0xddff('0x5c')]=function(_0x5bda48){return _0x5bda48!==null&&!_['isUndefined'](_0x5bda48);};VoiceQueueReport[_0xddff('0x32')]['loopQueueShow']=function(){var _0x2f8c6f=this;setInterval(function(){_0x2f8c6f['clearZombieChannels']();ami['Action']({'action':_0xddff('0x5d')})[_0xddff('0x39')](loggerCatch('[queues]'));},0x2710);};VoiceQueueReport['prototype'][_0xddff('0x28')]=function(){var _0x3bc1d1=this;setInterval(function(){if(_0x3bc1d1['flagQueueSummary']){return ami[_0xddff('0x36')]({'action':_0xddff('0x5e')})[_0xddff('0x5f')](function(_0x53539e){_0x3bc1d1[_0xddff('0x12')]=![];})[_0xddff('0x39')](loggerCatch(_0xddff('0x60')));}},0x3e8);};VoiceQueueReport[_0xddff('0x32')][_0xddff('0x15')]=function(_0x35f260){try{if(this[_0xddff('0x5c')](_0x35f260)&&this[_0xddff('0x5c')](_0x35f260['queue'])){if(this['voiceQueues'][_0x35f260[_0xddff('0x61')]]){var _0x2d6bc9=_[_0xddff('0x62')](this[_0xddff('0x34')],_0xddff('0x61'))[_0x35f260[_0xddff('0x61')]]||0x0;var _0x195240=_0x2d6bc9-_0x35f260[_0xddff('0x63')];if(this[_0xddff('0x11')][_0x35f260[_0xddff('0x61')]][_0xddff('0x2f')]!==_[_0xddff('0x64')](_0x35f260[_0xddff('0x63')])||this['voiceQueues'][_0x35f260[_0xddff('0x61')]][_0xddff('0x65')]!==_['toNumber'](_0x35f260['loggedin'])||this['voiceQueues'][_0x35f260[_0xddff('0x61')]][_0xddff('0x66')]!==_[_0xddff('0x64')](_0x35f260[_0xddff('0x66')])||this[_0xddff('0x11')][_0x35f260[_0xddff('0x61')]][_0xddff('0x2e')]!==_0x195240){this[_0xddff('0x11')][_0x35f260[_0xddff('0x61')]][_0xddff('0x2f')]=_['toNumber'](_0x35f260[_0xddff('0x63')]);this[_0xddff('0x11')][_0x35f260[_0xddff('0x61')]][_0xddff('0x65')]=_[_0xddff('0x64')](_0x35f260[_0xddff('0x67')]);this[_0xddff('0x11')][_0x35f260[_0xddff('0x61')]]['available']=_[_0xddff('0x64')](_0x35f260['available']);this[_0xddff('0x11')][_0x35f260[_0xddff('0x61')]][_0xddff('0x2e')]=_0x195240>0x0?_0x195240:0x0;this[_0xddff('0x11')][_0x35f260[_0xddff('0x61')]][_0xddff('0x2e')]=this['voiceQueues'][_0x35f260[_0xddff('0x61')]][_0xddff('0x2e')]>_[_0xddff('0x64')](_0x35f260[_0xddff('0x67')])?_[_0xddff('0x64')](_0x35f260[_0xddff('0x67')]):this[_0xddff('0x11')][_0x35f260['queue']][_0xddff('0x2e')];this[_0xddff('0x4d')](this['voiceQueues'][_0x35f260['queue']]);}ami[_0xddff('0x44')](_0xddff('0x68'),this['voiceQueues'][_0x35f260[_0xddff('0x61')]]);}}}catch(_0x2788d8){logger['error']('[syncQueueSummary][VoiceQueueReport]',util[_0xddff('0x43')](_0x2788d8,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xddff('0x18')]=function(_0x380320){this['flagQueueSummary']=!![];};VoiceQueueReport[_0xddff('0x32')][_0xddff('0x69')]=function(_0x392320){};VoiceQueueReport[_0xddff('0x32')][_0xddff('0x19')]=function(_0x4dab78){try{if(this[_0xddff('0x5c')](_0x4dab78)){if(_[_0xddff('0x2a')](this[_0xddff('0x3d')][_0x4dab78[_0xddff('0x6a')]])){this[_0xddff('0x3d')][_0x4dab78[_0xddff('0x6a')]]=[];this['channels'][_0x4dab78[_0xddff('0x6a')]]={};}var _0x6baee=new QueueReport();_0x6baee['name']=_0x4dab78['queue'];_0x6baee[_0xddff('0x4e')]=this['voiceQueues'][_0x6baee[_0xddff('0x48')]]&&this[_0xddff('0x11')][_0x6baee[_0xddff('0x48')]][_0xddff('0x4e')]?this[_0xddff('0x11')][_0x6baee['name']]['type']||_0xddff('0x4f'):_0xddff('0x4f');_0x6baee[_0xddff('0x61')]=_0x4dab78[_0xddff('0x61')];_0x6baee[_0xddff('0x6b')]=moment()[_0xddff('0x46')](_0xddff('0x6c'));_0x6baee[_0xddff('0x6d')]=_0x4dab78[_0xddff('0x6d')];_0x6baee['count']=_0x4dab78[_0xddff('0x6e')];_[_0xddff('0x6f')](_0x6baee,_['pick'](_0x4dab78,_[_0xddff('0x70')](_0x6baee)));this[_0xddff('0x3d')][_0x4dab78[_0xddff('0x6a')]]['push'](_0x6baee);this[_0xddff('0x34')][_0x4dab78[_0xddff('0x6a')]]=_0x6baee;this[_0xddff('0x45')](_0x6baee);}}catch(_0x324fbd){logger[_0xddff('0x3e')](_0xddff('0x71'),util[_0xddff('0x43')](_0x324fbd,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xddff('0x32')][_0xddff('0x72')]=function(_0xe91d17){try{if(this[_0xddff('0x5c')](_0xe91d17)){if(this[_0xddff('0x3d')][_0xe91d17[_0xddff('0x6a')]]){var _0x23af04=_[_0xddff('0x73')](this[_0xddff('0x3d')][_0xe91d17[_0xddff('0x6a')]]);_0x23af04[_0xddff('0x74')]=![];_0x23af04[_0xddff('0x75')]=null;_0x23af04[_0xddff('0x76')]=_0xe91d17[_0xddff('0x76')];_0x23af04[_0xddff('0x77')]=_0xe91d17[_0xddff('0x77')];_0x23af04[_0xddff('0x1a')]=!![];_0x23af04['queuecallerabandonAt']=moment()[_0xddff('0x46')](_0xddff('0x6c'));_0x23af04[_0xddff('0x78')]=_0xddff('0x79');_0x23af04['lastAssignedTo']=null;this['channels'][_0xe91d17[_0xddff('0x6a')]]=_0x23af04;this[_0xddff('0x42')](_0x23af04);}}}catch(_0x5c7ebb){logger[_0xddff('0x3e')](_0xddff('0x7a'),util['inspect'](_0x5c7ebb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xddff('0x32')][_0xddff('0x1c')]=function(_0x15c814){try{if(this[_0xddff('0x5c')](_0x15c814)){if(this['queueReports'][_0x15c814[_0xddff('0x6a')]]){var _0x364ee5=_[_0xddff('0x73')](this[_0xddff('0x3d')][_0x15c814[_0xddff('0x6a')]]);_0x364ee5[_0xddff('0x7b')]=moment()[_0xddff('0x46')](_0xddff('0x6c'));_0x364ee5[_0xddff('0x7c')]=_0x15c814[_0xddff('0x7c')];_0x364ee5[_0xddff('0x7d')]=_0x15c814[_0xddff('0x7d')];this['channels'][_0x15c814[_0xddff('0x6a')]]=_0x364ee5;this[_0xddff('0x45')](_0x364ee5);}}}catch(_0x2843a8){logger[_0xddff('0x3e')](_0xddff('0x7e'),util['inspect'](_0x2843a8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xddff('0x32')]['syncAgentConnect']=function(_0x4e4935){try{if(this['isNotNull'](_0x4e4935)){if(this[_0xddff('0x3d')][_0x4e4935[_0xddff('0x6a')]]){var _0x1890de=_[_0xddff('0x73')](this[_0xddff('0x3d')][_0x4e4935[_0xddff('0x6a')]]);_0x1890de['queuecallercomplete']=!![];_0x1890de[_0xddff('0x78')]=_0xddff('0x7f');}}}catch(_0x4185d2){logger[_0xddff('0x3e')]('[syncAgentConnect][VoiceQueueReport]',util[_0xddff('0x43')](_0x4185d2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xddff('0x32')][_0xddff('0x80')]=function(_0x5a803c){try{if(this[_0xddff('0x5c')](_0x5a803c)){if(this[_0xddff('0x3d')][_0x5a803c[_0xddff('0x6a')]]){var _0x3440cd=_[_0xddff('0x73')](this[_0xddff('0x3d')][_0x5a803c[_0xddff('0x6a')]]);_0x3440cd[_0xddff('0x1a')]=![];_0x3440cd['queuecallerabandonAt']=null;_0x3440cd['assigned']=!![];_0x3440cd[_0xddff('0x81')]=_0x5a803c[_0xddff('0x82')];_0x3440cd[_0xddff('0x76')]=_0x5a803c[_0xddff('0x76')];_0x3440cd[_0xddff('0x74')]=!![];_0x3440cd['queuecallerexit']=![];_0x3440cd[_0xddff('0x83')]=null;if(!_0x3440cd[_0xddff('0x84')]){if(_0x5a803c[_0xddff('0x85')]==_0xddff('0x84')){_0x3440cd[_0xddff('0x78')]=_0xddff('0x86');}else{if(_[_0xddff('0x87')](_0x5a803c[_0xddff('0x38')][_0xddff('0x88')](),_0xddff('0x89'))){if(this[_0xddff('0x3d')][_0x5a803c[_0xddff('0x8a')]]){var _0x4fdd69=_['last'](this['queueReports'][_0x5a803c['linkedid']]);_0x4fdd69[_0xddff('0x74')]=![];_0x4fdd69[_0xddff('0x8b')]=!![];_0x4fdd69[_0xddff('0x83')]=moment(_0x3440cd[_0xddff('0x6b')])[_0xddff('0x8c')](_0x5a803c['holdtime'],_0xddff('0x8d'))[_0xddff('0x46')](_0xddff('0x6c'));_0x4fdd69[_0xddff('0x78')]=_0xddff('0x8e');_0x4fdd69['transfer']=!![];_0x4fdd69[_0xddff('0x8f')]=_0xddff('0x90');_0x4fdd69[_0xddff('0x91')]=_0x5a803c[_0xddff('0x92')];_0x4fdd69[_0xddff('0x93')]=_0x5a803c['uniqueid'];var _0x147078=this[_0xddff('0x3d')][_0x5a803c['linkedid']];this[_0xddff('0x3d')][_0x5a803c['linkedid']]=this[_0xddff('0x3d')][_0x5a803c[_0xddff('0x6a')]];this[_0xddff('0x3d')][_0x5a803c[_0xddff('0x6a')]]=_0x147078;}}else{_0x3440cd[_0xddff('0x78')]=_0xddff('0x94')+_0x5a803c[_0xddff('0x85')]['toUpperCase']();}}}this[_0xddff('0x34')][_0x5a803c[_0xddff('0x6a')]]=_0x3440cd;this[_0xddff('0x42')](_0x3440cd);}}}catch(_0x205b6a){logger['error'](_0xddff('0x95'),util['inspect'](_0x205b6a,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xddff('0x20')]=function(_0x238c13){try{if(this[_0xddff('0x5c')](_0x238c13)){this[_0xddff('0x96')](_0x238c13[_0xddff('0x6a')],_[_0xddff('0x70')](_0x238c13[_0xddff('0x97')])[0x0],_0x238c13[_0xddff('0x98')]);if(this[_0xddff('0x3d')][_0x238c13[_0xddff('0x6a')]]){var _0x398372=_[_0xddff('0x73')](this[_0xddff('0x3d')][_0x238c13[_0xddff('0x6a')]]);if(_0x398372){if(this[_0xddff('0x5c')](_0x238c13[_0xddff('0x97')])&&this[_0xddff('0x5c')](_0x238c13[_0xddff('0x97')][_0xddff('0x99')])){switch(_0x238c13[_0xddff('0x98')]){case _0xddff('0x9a'):_0x398372[_0xddff('0x8b')]=![];_0x398372[_0xddff('0x83')]=null;break;case _0xddff('0x9b'):_0x398372[_0xddff('0x9c')]=_0xddff('0x9d');ami[_0xddff('0x44')](_0xddff('0x9e'),_0x398372);break;default:_0x398372[_0xddff('0x8b')]=!![];_0x398372[_0xddff('0x83')]=moment()[_0xddff('0x46')](_0xddff('0x6c'));_0x398372[_0xddff('0x7b')]=moment()[_0xddff('0x46')](_0xddff('0x6c'));}_0x398372[_0xddff('0x1a')]=![];_0x398372[_0xddff('0x9f')]=null;_0x398372[_0xddff('0x78')]=_0x238c13[_0xddff('0x98')];this[_0xddff('0x34')][_0x238c13[_0xddff('0x6a')]]=_0x398372;this[_0xddff('0x42')](_0x398372);}else if(this[_0xddff('0x5c')](_0x238c13[_0xddff('0x97')])&&this[_0xddff('0x5c')](_0x238c13[_0xddff('0x97')][_0xddff('0xa0')])){if(!_0x398372[_0xddff('0x1a')]){_0x398372[_0xddff('0x8b')]=!![];_0x398372['queuecallerexitAt']=moment()['format'](_0xddff('0x6c'));_0x398372[_0xddff('0x78')]=_0xddff('0xa1');_0x398372[_0xddff('0x7b')]=moment()[_0xddff('0x46')](_0xddff('0x6c'));this[_0xddff('0x34')][_0x238c13[_0xddff('0x6a')]]=_0x398372;}}_0x398372[_0xddff('0x14')]=this['variables'][_0x238c13[_0xddff('0x6a')]];}}}}catch(_0x2a2ff3){logger[_0xddff('0x3e')](_0xddff('0xa2'),util[_0xddff('0x43')](_0x2a2ff3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xddff('0x32')][_0xddff('0x96')]=function(_0x458df1,_0x420f36,_0x17ab09){var _0x1d8373=['rtpaudioqos',_0xddff('0xa3'),_0xddff('0xa4'),_0xddff('0xa5'),_0xddff('0xa6'),'rtpaudioqoslossbridged',_0xddff('0xa7'),_0xddff('0xa8'),_0xddff('0xa9'),_0xddff('0xaa'),_0xddff('0xab'),_0xddff('0xac'),_0xddff('0xad'),'memberdynamic',_0xddff('0xae'),_0xddff('0xaf'),_0xddff('0x82'),_0xddff('0xb0'),_0xddff('0xb1')];if(!_[_0xddff('0xb2')](_0x420f36)&&!_[_0xddff('0xb3')](_0x1d8373,_0x420f36)){if(_[_0xddff('0x2a')](this[_0xddff('0x14')][_0x458df1])){this[_0xddff('0x14')][_0x458df1]={};}this[_0xddff('0x14')][_0x458df1][_0x420f36]=_0x17ab09;}};VoiceQueueReport[_0xddff('0x32')][_0xddff('0x21')]=function(_0xf115ac){try{if(this[_0xddff('0x5c')](_0xf115ac)){if(this[_0xddff('0x3d')][_0xf115ac[_0xddff('0x6a')]]){for(var _0x1620c1=0x0,_0x1aa3c3={};_0x1620c10x0?_0x432979:0x0;this[_0x1f2f('0x13')][_0x367485[_0x1f2f('0x60')]][_0x1f2f('0x50')]=this[_0x1f2f('0x13')][_0x367485[_0x1f2f('0x60')]]['talking']>_[_0x1f2f('0x63')](_0x367485[_0x1f2f('0x65')])?_[_0x1f2f('0x63')](_0x367485['loggedin']):this['voiceQueues'][_0x367485['queue']][_0x1f2f('0x50')];this[_0x1f2f('0x49')](this[_0x1f2f('0x13')][_0x367485[_0x1f2f('0x60')]]);}ami[_0x1f2f('0x41')](_0x1f2f('0x66'),this['voiceQueues'][_0x367485[_0x1f2f('0x60')]]);}}}catch(_0x23c119){logger[_0x1f2f('0x39')](_0x1f2f('0x67'),util[_0x1f2f('0x40')](_0x23c119,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1f2f('0xd')][_0x1f2f('0x68')]=function(_0x98aae4){this[_0x1f2f('0x14')]=!![];};VoiceQueueReport['prototype'][_0x1f2f('0x69')]=function(_0x5b2523){};VoiceQueueReport['prototype'][_0x1f2f('0x1b')]=function(_0x507a0f){try{if(this['isNotNull'](_0x507a0f)){if(_['isUndefined'](this[_0x1f2f('0x11')][_0x507a0f[_0x1f2f('0x6a')]])){this[_0x1f2f('0x11')][_0x507a0f['uniqueid']]=[];this['channels'][_0x507a0f[_0x1f2f('0x6a')]]={};}var _0x16ced6=new QueueReport();_0x16ced6[_0x1f2f('0x44')]=_0x507a0f[_0x1f2f('0x60')];_0x16ced6['type']=this[_0x1f2f('0x13')][_0x16ced6[_0x1f2f('0x44')]]&&this['voiceQueues'][_0x16ced6[_0x1f2f('0x44')]][_0x1f2f('0x4a')]?this[_0x1f2f('0x13')][_0x16ced6[_0x1f2f('0x44')]][_0x1f2f('0x4a')]||_0x1f2f('0x4b'):_0x1f2f('0x4b');_0x16ced6[_0x1f2f('0x60')]=_0x507a0f['queue'];_0x16ced6[_0x1f2f('0x6b')]=moment()[_0x1f2f('0x43')](_0x1f2f('0x6c'));_0x16ced6[_0x1f2f('0x6d')]=_0x507a0f[_0x1f2f('0x6d')];_0x16ced6[_0x1f2f('0x6e')]=_0x507a0f[_0x1f2f('0x6e')];_[_0x1f2f('0x6f')](_0x16ced6,_['pick'](_0x507a0f,_['keys'](_0x16ced6)));this[_0x1f2f('0x11')][_0x507a0f[_0x1f2f('0x6a')]][_0x1f2f('0x70')](_0x16ced6);this[_0x1f2f('0x35')][_0x507a0f[_0x1f2f('0x6a')]]=_0x16ced6;this['emitVoiceQueueChannelSave'](_0x16ced6);}}catch(_0x1272c2){logger['error'](_0x1f2f('0x71'),util[_0x1f2f('0x40')](_0x1272c2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1f2f('0xd')][_0x1f2f('0x1c')]=function(_0xaccaee){try{if(this[_0x1f2f('0x5a')](_0xaccaee)){if(this[_0x1f2f('0x11')][_0xaccaee[_0x1f2f('0x6a')]]){var _0x27cf8d=_[_0x1f2f('0x72')](this[_0x1f2f('0x11')][_0xaccaee['uniqueid']]);_0x27cf8d[_0x1f2f('0x73')]=![];_0x27cf8d['queuecallercompleteAt']=null;_0x27cf8d[_0x1f2f('0x74')]=_0xaccaee[_0x1f2f('0x74')];_0x27cf8d[_0x1f2f('0x75')]=_0xaccaee['originalposition'];_0x27cf8d['queuecallerabandon']=!![];_0x27cf8d[_0x1f2f('0x76')]=moment()['format'](_0x1f2f('0x6c'));_0x27cf8d['queuecallerexitreason']=_0x1f2f('0x77');_0x27cf8d['lastAssignedTo']=null;this[_0x1f2f('0x35')][_0xaccaee['uniqueid']]=_0x27cf8d;this[_0x1f2f('0x45')](_0x27cf8d);}}}catch(_0x5f344d){logger['error'](_0x1f2f('0x78'),util[_0x1f2f('0x40')](_0x5f344d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1f2f('0xd')][_0x1f2f('0x1e')]=function(_0x32047e){try{if(this['isNotNull'](_0x32047e)){if(this[_0x1f2f('0x11')][_0x32047e['uniqueid']]){var _0x530913=_[_0x1f2f('0x72')](this['queueReports'][_0x32047e[_0x1f2f('0x6a')]]);_0x530913[_0x1f2f('0x79')]=moment()[_0x1f2f('0x43')]('YYYY-MM-DD\x20HH:mm:ss');_0x530913[_0x1f2f('0x7a')]=_0x32047e[_0x1f2f('0x7a')];_0x530913[_0x1f2f('0x7b')]=_0x32047e[_0x1f2f('0x7b')];this['channels'][_0x32047e[_0x1f2f('0x6a')]]=_0x530913;this[_0x1f2f('0x42')](_0x530913);}}}catch(_0x23ad9c){logger['error']('[syncQueueCallerLeave][VoiceQueueReport]',util[_0x1f2f('0x40')](_0x23ad9c,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x1f2f('0x7c')]=function(_0x72aa88){try{if(this[_0x1f2f('0x5a')](_0x72aa88)){if(this[_0x1f2f('0x11')][_0x72aa88[_0x1f2f('0x6a')]]){var _0x184a97=_[_0x1f2f('0x72')](this[_0x1f2f('0x11')][_0x72aa88[_0x1f2f('0x6a')]]);_0x184a97[_0x1f2f('0x73')]=!![];_0x184a97[_0x1f2f('0x7d')]=_0x1f2f('0x7e');}}}catch(_0x3823e1){logger[_0x1f2f('0x39')]('[syncAgentConnect][VoiceQueueReport]',util[_0x1f2f('0x40')](_0x3823e1,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x1f2f('0x20')]=function(_0x109f3b){try{if(this['isNotNull'](_0x109f3b)){if(this['queueReports'][_0x109f3b[_0x1f2f('0x6a')]]){var _0x360268=_[_0x1f2f('0x72')](this[_0x1f2f('0x11')][_0x109f3b['uniqueid']]);_0x360268['queuecallerabandon']=![];_0x360268[_0x1f2f('0x76')]=null;_0x360268[_0x1f2f('0x7f')]=!![];_0x360268[_0x1f2f('0x80')]=_0x109f3b[_0x1f2f('0x81')];_0x360268['holdtime']=_0x109f3b[_0x1f2f('0x74')];_0x360268[_0x1f2f('0x73')]=!![];_0x360268[_0x1f2f('0x82')]=![];_0x360268[_0x1f2f('0x83')]=null;if(!_0x360268['transfer']){if(_0x109f3b['reason']==_0x1f2f('0x84')){_0x360268[_0x1f2f('0x7d')]='COMPLETED';}else{if(_[_0x1f2f('0x85')](_0x109f3b[_0x1f2f('0x86')][_0x1f2f('0x87')](),_0x1f2f('0x88'))){if(this[_0x1f2f('0x11')][_0x109f3b[_0x1f2f('0x89')]]){var _0x1f860a=_[_0x1f2f('0x72')](this[_0x1f2f('0x11')][_0x109f3b[_0x1f2f('0x89')]]);_0x1f860a[_0x1f2f('0x73')]=![];_0x1f860a[_0x1f2f('0x82')]=!![];_0x1f860a[_0x1f2f('0x83')]=moment(_0x360268[_0x1f2f('0x6b')])[_0x1f2f('0x8a')](_0x109f3b[_0x1f2f('0x74')],_0x1f2f('0x8b'))[_0x1f2f('0x43')]('YYYY-MM-DD\x20HH:mm:ss');_0x1f860a[_0x1f2f('0x7d')]=_0x1f2f('0x8c');_0x1f860a[_0x1f2f('0x84')]=!![];_0x1f860a['transfertype']=_0x1f2f('0x8d');_0x1f860a[_0x1f2f('0x8e')]=_0x109f3b[_0x1f2f('0x8f')];_0x1f860a[_0x1f2f('0x90')]=_0x109f3b[_0x1f2f('0x6a')];var _0x9585a3=this[_0x1f2f('0x11')][_0x109f3b[_0x1f2f('0x89')]];this[_0x1f2f('0x11')][_0x109f3b['linkedid']]=this[_0x1f2f('0x11')][_0x109f3b[_0x1f2f('0x6a')]];this[_0x1f2f('0x11')][_0x109f3b[_0x1f2f('0x6a')]]=_0x9585a3;}}else{_0x360268[_0x1f2f('0x7d')]=_0x1f2f('0x91')+_0x109f3b[_0x1f2f('0x92')]['toUpperCase']();}}}this['channels'][_0x109f3b['uniqueid']]=_0x360268;this['emitVoiceQueueChannelRemove'](_0x360268);}}}catch(_0x101415){logger[_0x1f2f('0x39')]('[syncAgentComplete][VoiceQueueReport]',util[_0x1f2f('0x40')](_0x101415,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1f2f('0xd')][_0x1f2f('0x22')]=function(_0x2a3f62){try{if(this[_0x1f2f('0x5a')](_0x2a3f62)){this[_0x1f2f('0x93')](_0x2a3f62[_0x1f2f('0x6a')],_['keys'](_0x2a3f62['variable'])[0x0],_0x2a3f62[_0x1f2f('0x94')]);if(this[_0x1f2f('0x11')][_0x2a3f62['uniqueid']]){var _0x3f17f9=_[_0x1f2f('0x72')](this[_0x1f2f('0x11')][_0x2a3f62['uniqueid']]);if(_0x3f17f9){if(this['isNotNull'](_0x2a3f62[_0x1f2f('0x95')])&&this[_0x1f2f('0x5a')](_0x2a3f62['variable'][_0x1f2f('0x96')])){switch(_0x2a3f62[_0x1f2f('0x94')]){case _0x1f2f('0x97'):_0x3f17f9[_0x1f2f('0x82')]=![];_0x3f17f9[_0x1f2f('0x83')]=null;break;case _0x1f2f('0x98'):_0x3f17f9['lastevent']='timeout';ami[_0x1f2f('0x41')](_0x1f2f('0x99'),_0x3f17f9);break;default:_0x3f17f9['queuecallerexit']=!![];_0x3f17f9[_0x1f2f('0x83')]=moment()[_0x1f2f('0x43')]('YYYY-MM-DD\x20HH:mm:ss');_0x3f17f9[_0x1f2f('0x79')]=moment()[_0x1f2f('0x43')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3f17f9[_0x1f2f('0x9a')]=![];_0x3f17f9['queuecallerabandonAt']=null;_0x3f17f9[_0x1f2f('0x7d')]=_0x2a3f62[_0x1f2f('0x94')];this[_0x1f2f('0x35')][_0x2a3f62['uniqueid']]=_0x3f17f9;this['emitVoiceQueueChannelRemove'](_0x3f17f9);}else if(this['isNotNull'](_0x2a3f62[_0x1f2f('0x95')])&&this[_0x1f2f('0x5a')](_0x2a3f62[_0x1f2f('0x95')][_0x1f2f('0x9b')])){if(!_0x3f17f9[_0x1f2f('0x9a')]){_0x3f17f9[_0x1f2f('0x82')]=!![];_0x3f17f9[_0x1f2f('0x83')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3f17f9[_0x1f2f('0x7d')]=_0x1f2f('0x9c');_0x3f17f9[_0x1f2f('0x79')]=moment()[_0x1f2f('0x43')](_0x1f2f('0x6c'));this[_0x1f2f('0x35')][_0x2a3f62[_0x1f2f('0x6a')]]=_0x3f17f9;}}_0x3f17f9['variables']=this[_0x1f2f('0x3c')][_0x2a3f62[_0x1f2f('0x6a')]];}}}}catch(_0xe5b793){logger['error'](_0x1f2f('0x9d'),util[_0x1f2f('0x40')](_0xe5b793,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1f2f('0xd')][_0x1f2f('0x93')]=function(_0x292877,_0x21d32d,_0x18ea3a){var _0xc918dd=['rtpaudioqos',_0x1f2f('0x9e'),_0x1f2f('0x9f'),_0x1f2f('0xa0'),_0x1f2f('0xa1'),_0x1f2f('0xa2'),_0x1f2f('0xa3'),_0x1f2f('0xa4'),_0x1f2f('0xa5'),_0x1f2f('0xa6'),_0x1f2f('0xa7'),_0x1f2f('0xa8'),_0x1f2f('0xa9'),_0x1f2f('0xaa'),_0x1f2f('0xab'),_0x1f2f('0xac'),_0x1f2f('0x81'),_0x1f2f('0xad'),'memberrealtime'];if(!_[_0x1f2f('0xae')](_0x21d32d)&&!_['includes'](_0xc918dd,_0x21d32d)){if(_['isUndefined'](this[_0x1f2f('0x3c')][_0x292877])){this['variables'][_0x292877]={};}this[_0x1f2f('0x3c')][_0x292877][_0x21d32d]=_0x18ea3a;}};VoiceQueueReport[_0x1f2f('0xd')][_0x1f2f('0xaf')]=function(_0x59f83b){try{if(this[_0x1f2f('0x5a')](_0x59f83b)){if(this[_0x1f2f('0x11')][_0x59f83b[_0x1f2f('0x6a')]]){for(var _0x289cb4=0x0,_0x8376b6={};_0x289cb4=0x0?moment(_0x67a0ae[_0x9f3d('0x1c')])['diff'](_0x67a0ae[_0x9f3d('0x1b')],'seconds'):null,'data1':'outbound','data2':_0x67a0ae[_0x9f3d('0x17')],'data3':_0x67a0ae['exten'],'data4':_0x67a0ae[_0x9f3d('0x1d')]||null,'role':'agent','internal':_0x67a0ae['accountcode']?_[_0x9f3d('0x16')](_0x67a0ae[_0x9f3d('0x17')]):undefined,'uniqueid':_0x67a0ae[_0x9f3d('0x18')]},'log':_0x9f3d('0x8')});}; \ No newline at end of file +var _0x4c45=['diff','queuecallerleaveAt','seconds','calleridnum','exten','queue','agent','accountcode','toNumber','uniqueid','voiceDialReport','CreateMemberReport','membername','starttime','endtime','outbound','dialstring','moment','lodash','util','../client','queuecallercompleteAt','queuecallerexitAt','Request','voice','interface','format','TALKING'];(function(_0x5d52f5,_0x538904){var _0x27577f=function(_0x5e2e33){while(--_0x5e2e33){_0x5d52f5['push'](_0x5d52f5['shift']());}};_0x27577f(++_0x538904);}(_0x4c45,0xb9));var _0x54c4=function(_0x688c18,_0x29e208){_0x688c18=_0x688c18-0x0;var _0x469bca=_0x4c45[_0x688c18];return _0x469bca;};'use strict';var moment=require(_0x54c4('0x0'));var _=require(_0x54c4('0x1'));var util=require(_0x54c4('0x2'));var client=require(_0x54c4('0x3'));exports['voiceQueueReport']=function(_0xfb9c3){var _0x2acfb1=_0xfb9c3[_0x54c4('0x4')]||_0xfb9c3[_0x54c4('0x5')];return client[_0x54c4('0x6')]('CreateMemberReport',{'body':{'channel':_0x54c4('0x7'),'membername':_0xfb9c3['lastAssignedTo'],'interface':_['isNil'](_0xfb9c3[_0x54c4('0x8')])?util[_0x54c4('0x9')]('SIP/%s',_0xfb9c3['lastAssignedTo']):_0xfb9c3[_0x54c4('0x8')],'type':_0x54c4('0xa'),'enterAt':_0xfb9c3['queuecallerleaveAt'],'exitAt':_0x2acfb1,'duration':moment(_0x2acfb1)[_0x54c4('0xb')](_0xfb9c3[_0x54c4('0xc')],_0x54c4('0xd')),'data1':'inbound','data2':_0xfb9c3[_0x54c4('0xe')],'data3':_0xfb9c3[_0x54c4('0xf')],'data4':null,'data5':_0xfb9c3[_0x54c4('0x10')],'role':_0x54c4('0x11'),'internal':_0xfb9c3[_0x54c4('0x12')]?_[_0x54c4('0x13')](_0xfb9c3[_0x54c4('0x12')]):undefined,'uniqueid':_0xfb9c3[_0x54c4('0x14')]},'log':'CreateMemberReport'});};exports[_0x54c4('0x15')]=function(_0x3ef260){return client[_0x54c4('0x6')](_0x54c4('0x16'),{'body':{'channel':_0x54c4('0x7'),'membername':_0x3ef260[_0x54c4('0x17')],'interface':_0x3ef260[_0x54c4('0x8')],'type':_0x54c4('0xa'),'enterAt':_0x3ef260[_0x54c4('0x18')],'exitAt':_0x3ef260[_0x54c4('0x19')],'duration':moment(_0x3ef260[_0x54c4('0x19')])[_0x54c4('0xb')](_0x3ef260[_0x54c4('0x18')],'seconds')>=0x0?moment(_0x3ef260[_0x54c4('0x19')])[_0x54c4('0xb')](_0x3ef260[_0x54c4('0x18')],_0x54c4('0xd')):null,'data1':_0x54c4('0x1a'),'data2':_0x3ef260['accountcode'],'data3':_0x3ef260['exten'],'data4':_0x3ef260[_0x54c4('0x1b')]||null,'role':'agent','internal':_0x3ef260[_0x54c4('0x12')]?_[_0x54c4('0x13')](_0x3ef260['accountcode']):undefined,'uniqueid':_0x3ef260[_0x54c4('0x14')]},'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 a5a4d4f..d575a45 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 _0xc36d=['../client','getTemplates','Request','GetTemplate','html'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xc36d,0x7d));var _0xdc36=function(_0x114d1f,_0x55548e){_0x114d1f=_0x114d1f-0x0;var _0x5b91d4=_0xc36d[_0x114d1f];return _0x5b91d4;};'use strict';var client=require(_0xdc36('0x0'));exports[_0xdc36('0x1')]=function(_0x2d50af){return function(_0x16dd4a){return client[_0xdc36('0x2')](_0xdc36('0x3'),{'options':{'raw':!![],'attributes':['id','name',_0xdc36('0x4')]},'log':_0xdc36('0x3')});};}; \ No newline at end of file +var _0xf45e=['name','html','../client','Request','GetTemplate'];(function(_0x8a0d94,_0x16fcee){var _0x48f382=function(_0x46ab83){while(--_0x46ab83){_0x8a0d94['push'](_0x8a0d94['shift']());}};_0x48f382(++_0x16fcee);}(_0xf45e,0x115));var _0xef45=function(_0xf82311,_0x29504b){_0xf82311=_0xf82311-0x0;var _0x39d8fa=_0xf45e[_0xf82311];return _0x39d8fa;};'use strict';var client=require(_0xef45('0x0'));exports['getTemplates']=function(_0xaffb7e){return function(_0x5762da){return client[_0xef45('0x1')](_0xef45('0x2'),{'options':{'raw':!![],'attributes':['id',_0xef45('0x3'),_0xef45('0x4')]},'log':_0xef45('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index c80be9e..e6df05a 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 _0xb5a9=['data3','data4','data5','data6','GetTrigger','../client','getTriggers','Request','name','status','Condition','AllConditions','field','operator','AnyConditions','value','Action','Actions','action','data1','data2'];(function(_0x6c28f8,_0x3487d5){var _0x45b2c7=function(_0xe4f64b){while(--_0xe4f64b){_0x6c28f8['push'](_0x6c28f8['shift']());}};_0x45b2c7(++_0x3487d5);}(_0xb5a9,0x98));var _0x9b5a=function(_0x4a52a2,_0x2ce85d){_0x4a52a2=_0x4a52a2-0x0;var _0x3a2160=_0xb5a9[_0x4a52a2];return _0x3a2160;};'use strict';var client=require(_0x9b5a('0x0'));exports[_0x9b5a('0x1')]=function(_0x6c5f4d){return function(_0x5f3981){return client[_0x9b5a('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x9b5a('0x3'),'channel',_0x9b5a('0x4')],'include':[{'model':_0x9b5a('0x5'),'as':_0x9b5a('0x6'),'attributes':['id',_0x9b5a('0x7'),_0x9b5a('0x8'),'value']},{'model':_0x9b5a('0x5'),'as':_0x9b5a('0x9'),'attributes':['id',_0x9b5a('0x7'),_0x9b5a('0x8'),_0x9b5a('0xa')]},{'model':_0x9b5a('0xb'),'as':_0x9b5a('0xc'),'attributes':['id',_0x9b5a('0xd'),_0x9b5a('0xe'),_0x9b5a('0xf'),_0x9b5a('0x10'),_0x9b5a('0x11'),_0x9b5a('0x12'),_0x9b5a('0x13'),'data7']}]},'log':_0x9b5a('0x14')});};}; \ No newline at end of file +var _0xadf3=['channel','Condition','field','operator','value','AnyConditions','Action','data1','data2','data3','data5','data6','data7','../client','GetTrigger','name'];(function(_0x1db973,_0x40bb01){var _0x4b8e00=function(_0x4699b5){while(--_0x4699b5){_0x1db973['push'](_0x1db973['shift']());}};_0x4b8e00(++_0x40bb01);}(_0xadf3,0x19d));var _0x3adf=function(_0x5cd8da,_0x3ffe4c){_0x5cd8da=_0x5cd8da-0x0;var _0x124e6b=_0xadf3[_0x5cd8da];return _0x124e6b;};'use strict';var client=require(_0x3adf('0x0'));exports['getTriggers']=function(_0x2b4667){return function(_0x388a57){return client['Request'](_0x3adf('0x1'),{'options':{'raw':![],'attributes':['id',_0x3adf('0x2'),_0x3adf('0x3'),'status'],'include':[{'model':_0x3adf('0x4'),'as':'AllConditions','attributes':['id',_0x3adf('0x5'),_0x3adf('0x6'),_0x3adf('0x7')]},{'model':_0x3adf('0x4'),'as':_0x3adf('0x8'),'attributes':['id',_0x3adf('0x5'),_0x3adf('0x6'),_0x3adf('0x7')]},{'model':_0x3adf('0x9'),'as':'Actions','attributes':['id','action',_0x3adf('0xa'),_0x3adf('0xb'),_0x3adf('0xc'),'data4',_0x3adf('0xd'),_0x3adf('0xe'),_0x3adf('0xf')]}]},'log':_0x3adf('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index d320627..b2dd995 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 _0xa01b=['registry','../client','getTrunks','Request','GetTrunk','name'];(function(_0x280d0f,_0x3e1ba4){var _0x180062=function(_0x1e7b44){while(--_0x1e7b44){_0x280d0f['push'](_0x280d0f['shift']());}};_0x180062(++_0x3e1ba4);}(_0xa01b,0x8b));var _0xba01=function(_0x1f2ba6,_0x3bfabe){_0x1f2ba6=_0x1f2ba6-0x0;var _0x3a1738=_0xa01b[_0x1f2ba6];return _0x3a1738;};'use strict';var client=require(_0xba01('0x0'));exports[_0xba01('0x1')]=function(_0x5390a1){return function(_0x3d040e){return client[_0xba01('0x2')](_0xba01('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xba01('0x4'),_0xba01('0x5')]},'log':_0xba01('0x3')});};}; \ No newline at end of file +var _0xe1fe=['getTrunks','Request','name','registry','GetTrunk','../client'];(function(_0x15b71c,_0x25708f){var _0x35c8c8=function(_0x36b4d6){while(--_0x36b4d6){_0x15b71c['push'](_0x15b71c['shift']());}};_0x35c8c8(++_0x25708f);}(_0xe1fe,0xdd));var _0xee1f=function(_0x23258e,_0xd7e076){_0x23258e=_0x23258e-0x0;var _0x2b4ad8=_0xe1fe[_0x23258e];return _0x2b4ad8;};'use strict';var client=require(_0xee1f('0x0'));exports[_0xee1f('0x1')]=function(_0xe1b937){return function(_0x460378){return client[_0xee1f('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xee1f('0x3'),_0xee1f('0x4')]},'log':_0xee1f('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index d934913..813439a 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 _0x97f6=['fullname','online','lastLoginAt','pauseType','phone','mobile','getAgents','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser','lastPauseAt','interface','Request','GetUser','agent','name','email','accountcode'];(function(_0x47401b,_0x241726){var _0x4fcd8b=function(_0x3ec2bf){while(--_0x3ec2bf){_0x47401b['push'](_0x47401b['shift']());}};_0x4fcd8b(++_0x241726);}(_0x97f6,0x1c2));var _0x697f=function(_0x480ab2,_0x20b3a7){_0x480ab2=_0x480ab2-0x0;var _0x35c362=_0x97f6[_0x480ab2];return _0x35c362;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x697f('0x0')](_0x697f('0x1'),{'options':{'raw':![],'where':{'role':_0x697f('0x2')},'attributes':['id',_0x697f('0x3'),_0x697f('0x4'),_0x697f('0x5'),_0x697f('0x6'),_0x697f('0x7'),_0x697f('0x8'),_0x697f('0x9'),'lastPauseAt','voicePause',_0x697f('0xa'),_0x697f('0xb'),'interface']},'log':_0x697f('0xc')});};};exports[_0x697f('0xd')]=function(){return function(){return client[_0x697f('0x0')](_0x697f('0x1'),{'options':{'raw':!![],'where':{'role':_0x697f('0xe')},'attributes':['id',_0x697f('0x3'),_0x697f('0x5'),_0x697f('0xf')]},'log':'getTelephones'});};};exports[_0x697f('0x10')]=function(_0x3b394e,_0x78cf4e,_0x204dd4){return client['Request'](_0x697f('0x11'),{'body':{'type':_0x78cf4e,'uniqueid':_0x204dd4},'options':{'where':{'id':_0x3b394e['id']}},'log':'savePause'});};exports[_0x697f('0x12')]=function(_0x5aac26){return client[_0x697f('0x0')](_0x697f('0x13'),{'body':{},'options':{'where':{'id':_0x5aac26['id']}},'log':_0x697f('0x10')});};exports[_0x697f('0x14')]=function(_0x22e562){return client['Request'](_0x697f('0x15'),{'options':{'raw':![],'where':{'role':_0x697f('0x2'),'id':_0x22e562},'attributes':['id','name',_0x697f('0x4'),_0x697f('0x5'),_0x697f('0x6'),_0x697f('0x7'),_0x697f('0x8'),_0x697f('0x9'),_0x697f('0x16'),'voicePause',_0x697f('0x17')]},'log':_0x697f('0x14')});}; \ No newline at end of file +var _0x0c28=['getTelephones','GetUser','telephone','PauseUser','savePause','saveUnpause','UnpauseUser','getAgent','ShowUser','voicePause','../client','Request','agent','name','email','fullname','online','lastLoginAt','pauseType','lastPauseAt','mobile','interface'];(function(_0x3a5ccc,_0x17e02c){var _0x4b74f3=function(_0x160175){while(--_0x160175){_0x3a5ccc['push'](_0x3a5ccc['shift']());}};_0x4b74f3(++_0x17e02c);}(_0x0c28,0x8e));var _0x80c2=function(_0x3ccec1,_0x198e8a){_0x3ccec1=_0x3ccec1-0x0;var _0x34d531=_0x0c28[_0x3ccec1];return _0x34d531;};'use strict';var client=require(_0x80c2('0x0'));exports['getAgents']=function(){return function(){return client[_0x80c2('0x1')]('GetUser',{'options':{'raw':![],'where':{'role':_0x80c2('0x2')},'attributes':['id',_0x80c2('0x3'),_0x80c2('0x4'),'accountcode',_0x80c2('0x5'),_0x80c2('0x6'),_0x80c2('0x7'),_0x80c2('0x8'),_0x80c2('0x9'),'voicePause','phone',_0x80c2('0xa'),_0x80c2('0xb')]},'log':'getAgents'});};};exports[_0x80c2('0xc')]=function(){return function(){return client[_0x80c2('0x1')](_0x80c2('0xd'),{'options':{'raw':!![],'where':{'role':_0x80c2('0xe')},'attributes':['id',_0x80c2('0x3'),'accountcode','internal']},'log':_0x80c2('0xc')});};};exports['savePause']=function(_0x399bd4,_0x272c60,_0x106750){return client['Request'](_0x80c2('0xf'),{'body':{'type':_0x272c60,'uniqueid':_0x106750},'options':{'where':{'id':_0x399bd4['id']}},'log':_0x80c2('0x10')});};exports[_0x80c2('0x11')]=function(_0x102f3c){return client[_0x80c2('0x1')](_0x80c2('0x12'),{'body':{},'options':{'where':{'id':_0x102f3c['id']}},'log':'savePause'});};exports[_0x80c2('0x13')]=function(_0x353023){return client[_0x80c2('0x1')](_0x80c2('0x14'),{'options':{'raw':![],'where':{'role':_0x80c2('0x2'),'id':_0x353023},'attributes':['id',_0x80c2('0x3'),_0x80c2('0x4'),'accountcode',_0x80c2('0x5'),'online',_0x80c2('0x7'),_0x80c2('0x8'),_0x80c2('0x9'),_0x80c2('0x15'),_0x80c2('0xb')]},'log':'getAgent'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 4cda036..a8f0e18 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 _0xc004=['Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create'];(function(_0x51489a,_0x5523a5){var _0x135ad4=function(_0x1f83ed){while(--_0x1f83ed){_0x51489a['push'](_0x51489a['shift']());}};_0x135ad4(++_0x5523a5);}(_0xc004,0x1ea));var _0x4c00=function(_0x50f112,_0xd38e53){_0x50f112=_0x50f112-0x0;var _0x4ecf28=_0xc004[_0x50f112];return _0x4ecf28;};'use strict';var client=require(_0x4c00('0x0'));exports[_0x4c00('0x1')]=function(_0x48c35d){return client[_0x4c00('0x2')]('CreateVoiceAgentReport',{'body':_0x48c35d,'log':_0x4c00('0x3')});};exports[_0x4c00('0x4')]=function(_0x28e6aa,_0x281f35,_0x1451f2){return client[_0x4c00('0x2')](_0x4c00('0x5'),{'body':_0x28e6aa,'options':{'where':{'uniqueid':_0x281f35,'interface':_0x1451f2,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0x2367=['UpdateVoiceAgentReport','../client','create','CreateVoiceAgentReport','update','Request'];(function(_0x32ca2f,_0x5583b8){var _0x3619ea=function(_0x2a87af){while(--_0x2a87af){_0x32ca2f['push'](_0x32ca2f['shift']());}};_0x3619ea(++_0x5583b8);}(_0x2367,0x7f));var _0x7236=function(_0x221363,_0x2d6814){_0x221363=_0x221363-0x0;var _0x151f9b=_0x2367[_0x221363];return _0x151f9b;};'use strict';var client=require(_0x7236('0x0'));exports[_0x7236('0x1')]=function(_0x2d0e90){return client['Request'](_0x7236('0x2'),{'body':_0x2d0e90,'log':_0x7236('0x2')});};exports[_0x7236('0x3')]=function(_0x3c90b5,_0x239271,_0x1c0c8a){return client[_0x7236('0x4')](_0x7236('0x5'),{'body':_0x3c90b5,'options':{'where':{'uniqueid':_0x239271,'interface':_0x1c0c8a,'agentcomplete':!![]}},'log':_0x7236('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index cf679df..44708d4 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 _0xacbd=['billableseconds','GetVoiceCallReports','moment','lodash','create','Request','merge','context','CreateVoiceCallReport','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','disposition'];(function(_0x414f67,_0x861aed){var _0x338537=function(_0x4696fd){while(--_0x4696fd){_0x414f67['push'](_0x414f67['shift']());}};_0x338537(++_0x861aed);}(_0xacbd,0xb6));var _0xdacb=function(_0x58be67,_0x413a87){_0x58be67=_0x58be67-0x0;var _0x34994a=_0xacbd[_0x58be67];return _0x34994a;};'use strict';var moment=require(_0xdacb('0x0'));var util=require('util');var _=require(_0xdacb('0x1'));var client=require('../client');exports[_0xdacb('0x2')]=function(_0x5f438f){return client[_0xdacb('0x3')]('CreateVoiceCallReport',{'body':_[_0xdacb('0x4')](_0x5f438f,{'source':_0x5f438f['calleridnum'],'destinationcontext':_0x5f438f[_0xdacb('0x5')],'callerid':_0x5f438f['callerid'],'amaflags':'DOCUMENTATION'}),'log':_0xdacb('0x6')});};exports[_0xdacb('0x7')]=function(){return function(){return client[_0xdacb('0x3')](_0xdacb('0x8'),{'options':{'where':{'type':[_0xdacb('0x9')],'createdAt':{'$between':[moment()[_0xdacb('0xa')](_0xdacb('0xb'))[_0xdacb('0xc')](_0xdacb('0xd')),moment()[_0xdacb('0xe')]('day')['format']('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['type',_0xdacb('0xf'),'duration',_0xdacb('0x10')]},'log':_0xdacb('0x11')});};}; \ No newline at end of file +var _0x0dac=['outbound','startOf','day','YYYY-MM-DD\x20HH:mm:ss','endOf','format','type','disposition','billableseconds','moment','util','../client','Request','CreateVoiceCallReport','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport'];(function(_0x2bf888,_0x374f0b){var _0x3038d6=function(_0xe1b6d9){while(--_0xe1b6d9){_0x2bf888['push'](_0x2bf888['shift']());}};_0x3038d6(++_0x374f0b);}(_0x0dac,0x99));var _0xc0da=function(_0x3fb1b2,_0x56c458){_0x3fb1b2=_0x3fb1b2-0x0;var _0x16358d=_0x0dac[_0x3fb1b2];return _0x16358d;};'use strict';var moment=require(_0xc0da('0x0'));var util=require(_0xc0da('0x1'));var _=require('lodash');var client=require(_0xc0da('0x2'));exports['create']=function(_0x4c0a33){return client[_0xc0da('0x3')](_0xc0da('0x4'),{'body':_['merge'](_0x4c0a33,{'source':_0x4c0a33['calleridnum'],'destinationcontext':_0x4c0a33['context'],'callerid':_0x4c0a33[_0xc0da('0x5')],'amaflags':_0xc0da('0x6')}),'log':'CreateVoiceCallReport'});};exports[_0xc0da('0x7')]=function(){return function(){return client['Request'](_0xc0da('0x8'),{'options':{'where':{'type':[_0xc0da('0x9')],'createdAt':{'$between':[moment()[_0xc0da('0xa')](_0xc0da('0xb'))['format'](_0xc0da('0xc')),moment()[_0xc0da('0xd')](_0xc0da('0xb'))[_0xc0da('0xe')](_0xc0da('0xc'))]}},'attributes':[_0xc0da('0xf'),_0xc0da('0x10'),'duration',_0xc0da('0x11')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 29cc6f9..206aed4 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 _0x8dea=['Request','CreateVoiceDialReport','../client','create'];(function(_0x2a7a5c,_0x1e39d5){var _0x4baa36=function(_0x306a90){while(--_0x306a90){_0x2a7a5c['push'](_0x2a7a5c['shift']());}};_0x4baa36(++_0x1e39d5);}(_0x8dea,0xf2));var _0xa8de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8dea[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xa8de('0x0'));exports[_0xa8de('0x1')]=function(_0x506453){return client[_0xa8de('0x2')](_0xa8de('0x3'),{'body':_0x506453,'log':_0xa8de('0x3')});}; \ No newline at end of file +var _0xf78b=['create','Request','CreateVoiceDialReport','../client'];(function(_0x39696d,_0x24f2f2){var _0x2e1bc0=function(_0x360253){while(--_0x360253){_0x39696d['push'](_0x39696d['shift']());}};_0x2e1bc0(++_0x24f2f2);}(_0xf78b,0x113));var _0xbf78=function(_0x1b17a9,_0x5dba43){_0x1b17a9=_0x1b17a9-0x0;var _0x3e5bc5=_0xf78b[_0x1b17a9];return _0x3e5bc5;};'use strict';var client=require(_0xbf78('0x0'));exports[_0xbf78('0x1')]=function(_0x3c4e9e){return client[_0xbf78('0x2')](_0xbf78('0x3'),{'body':_0x3c4e9e,'log':_0xbf78('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index db66a4a..9bac516 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 _0x174b=['exten','recordingFormat','getVoiceExtensions','../client','GetVoiceExtension'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x174b,0x19d));var _0xb174=function(_0x2b70b4,_0x1d3cbe){_0x2b70b4=_0x2b70b4-0x0;var _0x40b83e=_0x174b[_0x2b70b4];return _0x40b83e;};'use strict';var client=require(_0xb174('0x0'));exports['getVoiceExtensions']=function(){return function(){return client['Request'](_0xb174('0x1'),{'options':{'raw':!![],'attributes':['id',_0xb174('0x2'),_0xb174('0x3')],'where':{'VoiceExtensionId':null}},'log':_0xb174('0x4')});};}; \ No newline at end of file +var _0x4e34=['Request','GetVoiceExtension','getVoiceExtensions'];(function(_0x46750d,_0x1573a8){var _0x5ba12a=function(_0x3ffa7c){while(--_0x3ffa7c){_0x46750d['push'](_0x46750d['shift']());}};_0x5ba12a(++_0x1573a8);}(_0x4e34,0x19e));var _0x44e3=function(_0x5ee287,_0x2e5f1e){_0x5ee287=_0x5ee287-0x0;var _0x24bfa0=_0x4e34[_0x5ee287];return _0x24bfa0;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client[_0x44e3('0x0')](_0x44e3('0x1'),{'options':{'raw':!![],'attributes':['id','exten','recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x44e3('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index c16cb22..0b1876e 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 _0x041c=['dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMinThreshold','Trunk','active','Pause','mandatoryDispositionPause','TrunkBackup','callerid','Interval','interval','../client','Request','GetVoiceQueue','name','acw','acwTimeout','monitor_format','type','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueProject','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x041c,0x1c7));var _0xc041=function(_0x36a909,_0x352857){_0x36a909=_0x36a909-0x0;var _0x532ace=_0x041c[_0x36a909];return _0x532ace;};'use strict';var client=require(_0xc041('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0xc041('0x1')](_0xc041('0x2'),{'options':{'raw':![],'attributes':['id',_0xc041('0x3'),_0xc041('0x4'),_0xc041('0x5'),'autopause',_0xc041('0x6'),_0xc041('0x7'),'dialActive',_0xc041('0x8'),'dialLimitChannel',_0xc041('0x9'),_0xc041('0xa'),_0xc041('0xb'),_0xc041('0xc'),'dialPredictiveInterval',_0xc041('0xd'),_0xc041('0xe'),'dialOriginateTimeout',_0xc041('0xf'),'dialQueueTimeout',_0xc041('0x10'),'dialCongestionMaxRetry',_0xc041('0x11'),'dialBusyMaxRetry',_0xc041('0x12'),_0xc041('0x13'),'dialNoAnswerRetryFrequency',_0xc041('0x14'),'dialTimezone',_0xc041('0x15'),_0xc041('0x16'),'dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence',_0xc041('0x17'),_0xc041('0x18'),'dialAMDTotalAnalysisTime',_0xc041('0x19'),_0xc041('0x1a'),_0xc041('0x1b'),'dialAMDSilenceThreshold',_0xc041('0x1c'),_0xc041('0x1d'),_0xc041('0x1e'),'dialRecallInQueue',_0xc041('0x1f'),_0xc041('0x20'),_0xc041('0x21'),'dialQueueProject2',_0xc041('0x6'),_0xc041('0x22'),_0xc041('0x23'),_0xc041('0x24'),'dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency',_0xc041('0x25'),_0xc041('0x26'),_0xc041('0x27'),'dialAbandonedRetryFrequency',_0xc041('0x28'),_0xc041('0x29'),_0xc041('0x2a'),_0xc041('0x2b'),_0xc041('0x2c'),'dialPredictiveIntervalMaxThreshold',_0xc041('0x2d')],'include':[{'model':_0xc041('0x2e'),'as':_0xc041('0x2e'),'attributes':['id',_0xc041('0x3'),'callerid',_0xc041('0x2f')]},{'model':_0xc041('0x30'),'as':_0xc041('0x31'),'attributes':['id',_0xc041('0x3')]},{'model':_0xc041('0x2e'),'as':_0xc041('0x32'),'attributes':['id',_0xc041('0x3'),_0xc041('0x33'),_0xc041('0x2f')]},{'model':'Interval','as':_0xc041('0x34'),'attributes':['id','name'],'include':[{'model':_0xc041('0x34'),'as':'Intervals','attributes':['id',_0xc041('0x3'),_0xc041('0x35')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0x9542=['mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','Pause','mandatoryDispositionPause','Interval','../client','Request','name','acw','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency'];(function(_0x3d49b6,_0x1fbd2b){var _0x2a6765=function(_0x162bb6){while(--_0x162bb6){_0x3d49b6['push'](_0x3d49b6['shift']());}};_0x2a6765(++_0x1fbd2b);}(_0x9542,0x174));var _0x2954=function(_0xebfad6,_0x2c286b){_0xebfad6=_0xebfad6-0x0;var _0x2e6073=_0x9542[_0xebfad6];return _0x2e6073;};'use strict';var client=require(_0x2954('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0x2954('0x1')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x2954('0x2'),_0x2954('0x3'),'acwTimeout','autopause',_0x2954('0x4'),_0x2954('0x5'),_0x2954('0x6'),_0x2954('0x7'),_0x2954('0x8'),_0x2954('0x9'),'dialPowerLevel',_0x2954('0xa'),_0x2954('0xb'),_0x2954('0xc'),_0x2954('0xd'),'dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions',_0x2954('0xe'),'dialQueueProject',_0x2954('0xf'),_0x2954('0x10'),'dialBusyMaxRetry',_0x2954('0x11'),_0x2954('0x12'),_0x2954('0x13'),_0x2954('0x14'),_0x2954('0x15'),_0x2954('0x16'),_0x2954('0x17'),_0x2954('0x18'),'dialAMDActive','dialAMDInitialSilence',_0x2954('0x19'),_0x2954('0x1a'),'dialAMDTotalAnalysisTime',_0x2954('0x1b'),_0x2954('0x1c'),'dialAMDMaximumNumberOfWords',_0x2954('0x1d'),'dialAMDMaximumWordLength',_0x2954('0x1e'),_0x2954('0x1f'),'dialRecallInQueue',_0x2954('0x20'),_0x2954('0x21'),'dialAgiAfterHangupClient',_0x2954('0x22'),_0x2954('0x4'),_0x2954('0x23'),_0x2954('0x24'),_0x2954('0x25'),_0x2954('0x26'),'dialNoSuchNumberRetryFrequency',_0x2954('0x27'),'dialDropRetryFrequency','dialAbandonedMaxRetry',_0x2954('0x28'),'dialMachineMaxRetry',_0x2954('0x29'),_0x2954('0x2a'),_0x2954('0x2b'),_0x2954('0x2c'),_0x2954('0x2d'),_0x2954('0x2e')],'include':[{'model':_0x2954('0x2f'),'as':_0x2954('0x2f'),'attributes':['id',_0x2954('0x2'),_0x2954('0x30'),'active']},{'model':_0x2954('0x31'),'as':_0x2954('0x32'),'attributes':['id',_0x2954('0x2')]},{'model':_0x2954('0x2f'),'as':'TrunkBackup','attributes':['id',_0x2954('0x2'),_0x2954('0x30'),'active']},{'model':'Interval','as':_0x2954('0x33'),'attributes':['id',_0x2954('0x2')],'include':[{'model':_0x2954('0x33'),'as':'Intervals','attributes':['id',_0x2954('0x2'),'interval']}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 3fb9d34..d504127 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 _0x7672=['queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','moment','lodash','create','Request','CreateVoiceQueueReport','GetVoiceQueueReport','day','YYYY-MM-DD\x20HH:mm:ss','endOf','format','uniqueid'];(function(_0x5d7bc3,_0x1f37b3){var _0x497220=function(_0x2aabe9){while(--_0x2aabe9){_0x5d7bc3['push'](_0x5d7bc3['shift']());}};_0x497220(++_0x1f37b3);}(_0x7672,0xb2));var _0x2767=function(_0x1e8e3f,_0x311a59){_0x1e8e3f=_0x1e8e3f-0x0;var _0x780985=_0x7672[_0x1e8e3f];return _0x780985;};'use strict';var moment=require(_0x2767('0x0'));var _=require(_0x2767('0x1'));var client=require('../client');exports[_0x2767('0x2')]=function(_0x29bd7d){return client[_0x2767('0x3')](_0x2767('0x4'),{'body':_0x29bd7d,'log':_0x2767('0x4')});};exports['getVoiceQueueReports']=function(){return function(){return client[_0x2767('0x3')](_0x2767('0x5'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0x2767('0x6'))['format'](_0x2767('0x7')),moment()[_0x2767('0x8')](_0x2767('0x6'))[_0x2767('0x9')](_0x2767('0x7'))]}},'attributes':[_0x2767('0xa'),_0x2767('0xb'),_0x2767('0xc'),_0x2767('0xd'),_0x2767('0xe'),_0x2767('0xf'),_0x2767('0x10'),_0x2767('0x11'),_0x2767('0x12'),_0x2767('0x13')]},'log':_0x2767('0x14')});};}; \ No newline at end of file +var _0x1646=['day','format','endOf','uniqueid','queuecallerjoinAt','queuecallerleaveAt','queuecallerexit','queuecallerabandon','GetVoiceQueueReports','lodash','create','Request','CreateVoiceQueueReport','GetVoiceQueueReport','startOf'];(function(_0x16792b,_0x11de9b){var _0x47e251=function(_0x4db7c7){while(--_0x4db7c7){_0x16792b['push'](_0x16792b['shift']());}};_0x47e251(++_0x11de9b);}(_0x1646,0x117));var _0x6164=function(_0x328b1c,_0xec0b4f){_0x328b1c=_0x328b1c-0x0;var _0x4dbeaa=_0x1646[_0x328b1c];return _0x4dbeaa;};'use strict';var moment=require('moment');var _=require(_0x6164('0x0'));var client=require('../client');exports[_0x6164('0x1')]=function(_0x2685f5){return client[_0x6164('0x2')](_0x6164('0x3'),{'body':_0x2685f5,'log':_0x6164('0x3')});};exports['getVoiceQueueReports']=function(){return function(){return client['Request'](_0x6164('0x4'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x6164('0x5')](_0x6164('0x6'))[_0x6164('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x6164('0x8')]('day')[_0x6164('0x7')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x6164('0x9'),'queue',_0x6164('0xa'),_0x6164('0xb'),'queuecallercomplete','queuecallercompleteAt',_0x6164('0xc'),'queuecallerexitAt',_0x6164('0xd'),'queuecallerabandonAt']},'log':_0x6164('0xe')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 406aef2..af0df05 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 _0x5094=['../client','Request','GetVoiceQueueRtPauses','getVoiceQueueRtPauses'];(function(_0x95a12,_0x38bed8){var _0x3805e9=function(_0x1c0874){while(--_0x1c0874){_0x95a12['push'](_0x95a12['shift']());}};_0x3805e9(++_0x38bed8);}(_0x5094,0x18c));var _0x4509=function(_0x820d7b,_0xa5564c){_0x820d7b=_0x820d7b-0x0;var _0x249af0=_0x5094[_0x820d7b];return _0x249af0;};'use strict';var client=require(_0x4509('0x0'));exports['getVoiceQueueRtPauses']=function(_0x1e3d71){return function(){return client[_0x4509('0x1')](_0x4509('0x2'),{'options':{'where':{'VoiceQueueId':_0x1e3d71,'paused':!![]},'raw':!![]},'log':_0x4509('0x3')});};}; \ No newline at end of file +var _0x5f6a=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses','Request'];(function(_0x283bbe,_0x46749e){var _0x541b44=function(_0x2ab6db){while(--_0x2ab6db){_0x283bbe['push'](_0x283bbe['shift']());}};_0x541b44(++_0x46749e);}(_0x5f6a,0x7f));var _0xa5f6=function(_0xc652f0,_0x2a007b){_0xc652f0=_0xc652f0-0x0;var _0x49f886=_0x5f6a[_0xc652f0];return _0x49f886;};'use strict';var client=require('../client');exports[_0xa5f6('0x0')]=function(_0x511138){return function(){return client[_0xa5f6('0x1')](_0xa5f6('0x2'),{'options':{'where':{'VoiceQueueId':_0x511138,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index f13ab17..8ae0277 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 _0x4162=['create','Request','monitorFilename','lodash'];(function(_0x1e17eb,_0x2e15c5){var _0x4de4c7=function(_0x52d003){while(--_0x52d003){_0x1e17eb['push'](_0x1e17eb['shift']());}};_0x4de4c7(++_0x2e15c5);}(_0x4162,0xdb));var _0x2416=function(_0x4725a8,_0x42c3dc){_0x4725a8=_0x4725a8-0x0;var _0x4eb754=_0x4162[_0x4725a8];return _0x4eb754;};'use strict';var _=require(_0x2416('0x0'));var client=require('../client');exports[_0x2416('0x1')]=function(_0x4c50d8){return client[_0x2416('0x2')]('CreateVoiceRecording',{'body':_['merge'](_0x4c50d8,{'value':_0x4c50d8[_0x2416('0x3')]}),'log':'CreateVoiceRecording'});}; \ No newline at end of file +var _0xfe5c=['CreateVoiceRecording','monitorFilename','../client'];(function(_0x817d9b,_0x3c37e3){var _0x2752e1=function(_0x2b434e){while(--_0x2b434e){_0x817d9b['push'](_0x817d9b['shift']());}};_0x2752e1(++_0x3c37e3);}(_0xfe5c,0x18b));var _0xcfe5=function(_0x18a01e,_0x451f12){_0x18a01e=_0x18a01e-0x0;var _0xc4f293=_0xfe5c[_0x18a01e];return _0xc4f293;};'use strict';var _=require('lodash');var client=require(_0xcfe5('0x0'));exports['create']=function(_0x783a80){return client['Request'](_0xcfe5('0x1'),{'body':_['merge'](_0x783a80,{'value':_0x783a80[_0xcfe5('0x2')]}),'log':_0xcfe5('0x1')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index d8c4af4..c84900f 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 _0xe90b=['CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transfererexten','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','result','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','Request'];(function(_0xd67ffb,_0x2f7ebc){var _0x51d5fb=function(_0x1e2dfd){while(--_0x1e2dfd){_0xd67ffb['push'](_0xd67ffb['shift']());}};_0x51d5fb(++_0x2f7ebc);}(_0xe90b,0xf5));var _0xbe90=function(_0x372ce7,_0x556ad1){_0x372ce7=_0x372ce7-0x0;var _0xf3232a=_0xe90b[_0x372ce7];return _0xf3232a;};'use strict';var client=require('../client');exports['blindTransfer']=function(_0x3a1fe3){return client[_0xbe90('0x0')](_0xbe90('0x1'),{'body':{'result':_0x3a1fe3['result'],'transfererchannel':_0x3a1fe3[_0xbe90('0x2')],'transferercalleridnum':_0x3a1fe3[_0xbe90('0x3')],'transferercalleridname':_0x3a1fe3['transferercalleridname'],'transfererconnectedlinenum':_0x3a1fe3[_0xbe90('0x4')],'transfererconnectedlinename':_0x3a1fe3[_0xbe90('0x5')],'transfereraccountcode':_0x3a1fe3[_0xbe90('0x6')],'transferercontext':_0x3a1fe3['transferercontext'],'transfererexten':_0x3a1fe3[_0xbe90('0x7')],'transfererlinkedid':_0x3a1fe3[_0xbe90('0x8')],'transfereechannel':_0x3a1fe3['transfereechannel'],'transfereecalleridnum':_0x3a1fe3[_0xbe90('0x9')],'transfereecalleridname':_0x3a1fe3[_0xbe90('0xa')],'transfereeconnectedlinenum':_0x3a1fe3[_0xbe90('0xb')],'transfereeconnectedlinename':_0x3a1fe3[_0xbe90('0xc')],'transfereeaccountcode':_0x3a1fe3['transfereeaccountcode'],'transfereecontext':_0x3a1fe3[_0xbe90('0xd')],'transfereeexten':_0x3a1fe3[_0xbe90('0xe')],'transfereelinkedid':_0x3a1fe3[_0xbe90('0xf')],'isexternal':_0x3a1fe3[_0xbe90('0x10')],'context':_0x3a1fe3[_0xbe90('0x11')],'extension':_0x3a1fe3[_0xbe90('0x12')],'type':_0xbe90('0x13')},'log':_0xbe90('0x1')});};exports[_0xbe90('0x14')]=function(_0x42f408){return client[_0xbe90('0x0')](_0xbe90('0x1'),{'body':{'result':_0x42f408[_0xbe90('0x15')],'transfererchannel':_0x42f408[_0xbe90('0x16')],'transferercalleridnum':_0x42f408[_0xbe90('0x17')],'transferercalleridname':_0x42f408['origtransferercalleridname'],'transfererconnectedlinenum':_0x42f408[_0xbe90('0x18')],'transfererconnectedlinename':_0x42f408[_0xbe90('0x19')],'transfereraccountcode':_0x42f408[_0xbe90('0x1a')],'transferercontext':_0x42f408[_0xbe90('0x1b')],'transfererexten':_0x42f408[_0xbe90('0x1c')],'transfererlinkedid':_0x42f408['origtransfererlinkedid'],'transfereechannel':_0x42f408[_0xbe90('0x1d')],'transfereecalleridnum':_0x42f408[_0xbe90('0x1e')],'transfereecalleridname':_0x42f408[_0xbe90('0x1f')],'transfereeconnectedlinenum':_0x42f408[_0xbe90('0x20')],'transfereeconnectedlinename':_0x42f408[_0xbe90('0x21')],'transfereeaccountcode':_0x42f408[_0xbe90('0x22')],'transfereecontext':_0x42f408[_0xbe90('0x23')],'transfereeexten':_0x42f408[_0xbe90('0x24')],'transfereelinkedid':_0x42f408[_0xbe90('0x25')],'isexternal':_0x42f408[_0xbe90('0x10')],'context':_0x42f408[_0xbe90('0x26')],'extension':_0x42f408[_0xbe90('0x27')],'type':_0xbe90('0x28')},'log':_0xbe90('0x1')});}; \ No newline at end of file +var _0x324b=['transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','Request','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','origtransferercontext','../client','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfereechannel','transfereecalleridnum'];(function(_0x1794b4,_0x4c2023){var _0x53e2db=function(_0x2e6cda){while(--_0x2e6cda){_0x1794b4['push'](_0x1794b4['shift']());}};_0x53e2db(++_0x4c2023);}(_0x324b,0x1d3));var _0xb324=function(_0x35c321,_0x3f2af2){_0x35c321=_0x35c321-0x0;var _0x1b5f2d=_0x324b[_0x35c321];return _0x1b5f2d;};'use strict';var client=require(_0xb324('0x0'));exports['blindTransfer']=function(_0x449417){return client['Request'](_0xb324('0x1'),{'body':{'result':_0x449417[_0xb324('0x2')],'transfererchannel':_0x449417[_0xb324('0x3')],'transferercalleridnum':_0x449417[_0xb324('0x4')],'transferercalleridname':_0x449417[_0xb324('0x5')],'transfererconnectedlinenum':_0x449417[_0xb324('0x6')],'transfererconnectedlinename':_0x449417[_0xb324('0x7')],'transfereraccountcode':_0x449417[_0xb324('0x8')],'transferercontext':_0x449417[_0xb324('0x9')],'transfererexten':_0x449417[_0xb324('0xa')],'transfererlinkedid':_0x449417['transfererlinkedid'],'transfereechannel':_0x449417[_0xb324('0xb')],'transfereecalleridnum':_0x449417[_0xb324('0xc')],'transfereecalleridname':_0x449417[_0xb324('0xd')],'transfereeconnectedlinenum':_0x449417[_0xb324('0xe')],'transfereeconnectedlinename':_0x449417['transfereeconnectedlinename'],'transfereeaccountcode':_0x449417[_0xb324('0xf')],'transfereecontext':_0x449417[_0xb324('0x10')],'transfereeexten':_0x449417[_0xb324('0x11')],'transfereelinkedid':_0x449417[_0xb324('0x12')],'isexternal':_0x449417[_0xb324('0x13')],'context':_0x449417[_0xb324('0x14')],'extension':_0x449417[_0xb324('0x15')],'type':_0xb324('0x16')},'log':'CreateVoiceTransferReport'});};exports['attendedTransfer']=function(_0x9676c6){return client[_0xb324('0x17')](_0xb324('0x1'),{'body':{'result':_0x9676c6['result'],'transfererchannel':_0x9676c6[_0xb324('0x18')],'transferercalleridnum':_0x9676c6[_0xb324('0x19')],'transferercalleridname':_0x9676c6[_0xb324('0x1a')],'transfererconnectedlinenum':_0x9676c6[_0xb324('0x1b')],'transfererconnectedlinename':_0x9676c6[_0xb324('0x1c')],'transfereraccountcode':_0x9676c6[_0xb324('0x1d')],'transferercontext':_0x9676c6[_0xb324('0x1e')],'transfererexten':_0x9676c6['secondtransfererexten'],'transfererlinkedid':_0x9676c6['origtransfererlinkedid'],'transfereechannel':_0x9676c6[_0xb324('0x1f')],'transfereecalleridnum':_0x9676c6[_0xb324('0x20')],'transfereecalleridname':_0x9676c6[_0xb324('0x21')],'transfereeconnectedlinenum':_0x9676c6[_0xb324('0x22')],'transfereeconnectedlinename':_0x9676c6[_0xb324('0x23')],'transfereeaccountcode':_0x9676c6[_0xb324('0x24')],'transfereecontext':_0x9676c6[_0xb324('0x25')],'transfereeexten':_0x9676c6[_0xb324('0x26')],'transfereelinkedid':_0x9676c6['transfertargetlinkedid'],'isexternal':_0x9676c6['isexternal'],'context':_0x9676c6[_0xb324('0x27')],'extension':_0x9676c6['origtransfererexten'],'type':'attended'},'log':_0xb324('0x1')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 82ad3d0..a5b861f 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 _0xf41e=['Action','message','catch','isConnected','username','command','content','voiceQueues','hasOwnProperty','strategy','answered','loggedIn','sumDuration','sumHoldTime','total','type','unmanaged','abandoned','waiting','loggedInDb','outbound','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','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','callerid','Interval','push','channels','length','ami\x20disconnected','voicechannel','validate','map','find','uniqueid','channel','%s.%s','filename','MixMonitor','ai(mixmonitorid)','then','isNil','monitors','/var/spool/asterisk/monitor/','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','status','stop','wav','toLowerCase','StopMixMonitor\x20Success','values','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','context','telephones','trunks','outboundChannels','campaigns','run','Event\x20name\x20mandatory','emit','custom:','faxAccounts','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','jayson/promise','bluebird','moment','../../../config/environment','../properties','../ami','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','pause','QueuePause','error','asterisk','join','pick','keys','module','action','Reload'];(function(_0x1ec653,_0x98f8ba){var _0x205bed=function(_0x36922b){while(--_0x36922b){_0x1ec653['push'](_0x1ec653['shift']());}};_0x205bed(++_0x98f8ba);}(_0xf41e,0x195));var _0xef41=function(_0x485329,_0x4b3930){_0x485329=_0x485329-0x0;var _0x4df2ab=_0xf41e[_0x485329];return _0x4df2ab;};'use strict';var _=require(_0xef41('0x0'));var util=require(_0xef41('0x1'));var jayson=require(_0xef41('0x2'));var schema=require('validate');var BPromise=require(_0xef41('0x3'));var moment=require(_0xef41('0x4'));var config=require(_0xef41('0x5'));var properties=require(_0xef41('0x6'));var ami=require(_0xef41('0x7'));exports[_0xef41('0x8')]=function(_0x5bf199,_0x38ab1e,_0x3d11fd){return new BPromise(function(_0x4edfbd,_0x5d0562){var _0x2d334f={'QueuePause':function(_0x1d6f30){return new Promise(function(_0x4e1d4d,_0x30ab97){var _0x172760=util[_0xef41('0x9')](_0xef41('0xa'),_0xef41('0xb'),_0x1d6f30[_0xef41('0xc')]);if(_0x5bf199['timers']&&_0x5bf199[_0xef41('0xd')][_0x172760]&&_0x5bf199[_0xef41('0xd')][_0x172760][_0xef41('0xe')]){_0x5bf199[_0xef41('0xd')][_0x172760][_0xef41('0xf')]();}if(_0x5bf199[_0xef41('0x10')][_0x172760]){_0x5bf199[_0xef41('0x10')][_0x172760]['updateStatusRealtime']({'statePause':_0x1d6f30[_0xef41('0x11')]?!![]:![]});}_0x4e1d4d({'code':0xc8,'message':_0xef41('0x12')});});},'Reload':function(_0x4c79f7){var _0x1d25d4=this;return new Promise(function(_0x206af4,_0xd3c954){if(ami['isConnected']()==![]){return _0xd3c954(_0x1d25d4[_0xef41('0x13')](0x1f4,[config['asterisk']['ip'],config[_0xef41('0x14')]['username'],'ami\x20disconnected'][_0xef41('0x15')]('\x20')));}_0x4c79f7=_[_0xef41('0x16')](_0x4c79f7,_[_0xef41('0x17')](properties[_0xef41('0x18')]));_0x4c79f7[_0xef41('0x19')]=_0xef41('0x1a');return ami[_0xef41('0x1b')](_0x4c79f7)['then'](function(_0x8cc98){_0x206af4({'code':0xc8,'message':_0x8cc98[_0xef41('0x1c')]});})[_0xef41('0x1d')](function(_0x141fcf){_0xd3c954(_0x1d25d4['error'](0x1f5,_0x141fcf[_0xef41('0x1c')]));});});},'Command':function(_0x46aa23){var _0x9f8c10=this;return new Promise(function(_0x5f3b8d,_0xdc47e7){if(ami[_0xef41('0x1e')]()==![]){return _0xdc47e7(_0x9f8c10['error'](0x1f4,[config[_0xef41('0x14')]['ip'],config[_0xef41('0x14')][_0xef41('0x1f')],'ami\x20disconnected']['join']('\x20')));}_0x46aa23=_[_0xef41('0x16')](_0x46aa23,_0xef41('0x20'));_0x46aa23[_0xef41('0x19')]='Command';return ami[_0xef41('0x1b')](_0x46aa23)['then'](function(_0x1ef809){_0x5f3b8d({'code':0xc8,'message':_0x1ef809[_0xef41('0x21')]});})[_0xef41('0x1d')](function(_0x3cbdde){_0xdc47e7(_0x9f8c10[_0xef41('0x13')](0x1f5,_0x3cbdde[_0xef41('0x1c')]));});});},'VoiceQueues':function(_0x8bf02c){return new Promise(function(_0x42a648,_0x2abcef){var _0xf91dd2=[];for(var _0x3b461d in _0x5bf199['voiceQueues']){if(_0x5bf199[_0xef41('0x22')][_0xef41('0x23')](_0x3b461d)){var _0x1a9371=_0x5bf199['voiceQueues'][_0x3b461d];var _0x2a8441={'id':_0x1a9371['id'],'name':_0x1a9371[_0xef41('0xc')],'strategy':_0x1a9371[_0xef41('0x24')],'answered':_0x1a9371[_0xef41('0x25')],'available':_0x1a9371['available'],'loggedIn':_0x1a9371[_0xef41('0x26')],'pTalking':_0x1a9371['pTalking'],'sumBillable':_0x1a9371['sumBillable'],'sumDuration':_0x1a9371[_0xef41('0x27')],'sumHoldTime':_0x1a9371[_0xef41('0x28')]||0x0,'talking':_0x1a9371['talking'],'total':_0x1a9371[_0xef41('0x29')],'type':_0x1a9371[_0xef41('0x2a')],'unmanaged':_0x1a9371[_0xef41('0x2b')],'abandoned':_0x1a9371[_0xef41('0x2c')],'waiting':_0x1a9371[_0xef41('0x2d')],'loggedInDb':_0x1a9371[_0xef41('0x2e')]};if(_0x1a9371[_0xef41('0x2a')]===_0xef41('0x2f')){_0x2a8441['dialActive']=_0x1a9371['dialActive'];_0x2a8441[_0xef41('0x30')]=_0x1a9371[_0xef41('0x30')];_0x2a8441[_0xef41('0x31')]=_0x1a9371[_0xef41('0x31')];_0x2a8441['dialOriginateCallerIdNumber']=_0x1a9371[_0xef41('0x32')];_0x2a8441[_0xef41('0x33')]=_0x1a9371[_0xef41('0x33')];_0x2a8441['dialPrefix']=_0x1a9371[_0xef41('0x34')];_0x2a8441[_0xef41('0x35')]=_0x1a9371[_0xef41('0x35')];_0x2a8441[_0xef41('0x36')]=_0x1a9371[_0xef41('0x36')];_0x2a8441[_0xef41('0x37')]=_0x1a9371['outboundBlacklistCallsDay'];_0x2a8441[_0xef41('0x38')]=_0x1a9371[_0xef41('0x38')];_0x2a8441[_0xef41('0x39')]=_0x1a9371[_0xef41('0x39')];_0x2a8441[_0xef41('0x3a')]=_0x1a9371[_0xef41('0x3a')];_0x2a8441[_0xef41('0x3b')]=_0x1a9371[_0xef41('0x3b')];_0x2a8441[_0xef41('0x3c')]=_0x1a9371[_0xef41('0x3c')];_0x2a8441[_0xef41('0x3d')]=_0x1a9371['outboundNoAnswerCallsDay'];_0x2a8441['outboundNoSuchCallsDay']=_0x1a9371[_0xef41('0x3e')];_0x2a8441[_0xef41('0x3f')]=_0x1a9371[_0xef41('0x3f')];_0x2a8441[_0xef41('0x40')]=_0x1a9371['outboundReCallsDay'];_0x2a8441[_0xef41('0x41')]=_0x1a9371[_0xef41('0x41')];_0x2a8441[_0xef41('0x42')]=_0x1a9371[_0xef41('0x42')];_0x2a8441['predictiveIntervalAnsweredCalls']=_0x1a9371[_0xef41('0x43')];_0x2a8441['predictiveIntervalAvgHoldtime']=_0x1a9371[_0xef41('0x44')];_0x2a8441[_0xef41('0x45')]=_0x1a9371[_0xef41('0x45')];_0x2a8441['predictiveIntervalDroppedCallsCallersExit']=_0x1a9371[_0xef41('0x46')];_0x2a8441['predictiveIntervalDroppedCallsTimeout']=_0x1a9371[_0xef41('0x47')];_0x2a8441['predictiveIntervalErlangCalls']=_0x1a9371[_0xef41('0x48')];_0x2a8441[_0xef41('0x49')]=_0x1a9371[_0xef41('0x49')];_0x2a8441[_0xef41('0x4a')]=_0x1a9371[_0xef41('0x4a')];_0x2a8441[_0xef41('0x4b')]=_0x1a9371[_0xef41('0x4b')];_0x2a8441[_0xef41('0x4c')]=_0x1a9371[_0xef41('0x4c')];_0x2a8441[_0xef41('0x4d')]=_0x1a9371[_0xef41('0x4d')];_0x2a8441[_0xef41('0x4e')]=_0x1a9371['predictiveIntervalTotalCalls'];_0x2a8441[_0xef41('0x1c')]=_0x1a9371['message'];_0x2a8441[_0xef41('0x4f')]=_0x1a9371[_0xef41('0x4f')];_0x2a8441['erlangCalls']=_0x1a9371[_0xef41('0x50')];_0x2a8441['erlangCallToSecond']=_0x1a9371[_0xef41('0x51')];_0x2a8441[_0xef41('0x52')]=_0x1a9371[_0xef41('0x52')];_0x2a8441[_0xef41('0x53')]=_0x1a9371[_0xef41('0x53')];_0x2a8441['startPredictive']=_0x1a9371['startPredictive'];_0x2a8441[_0xef41('0x54')]=_0x1a9371[_0xef41('0x54')];}if(_0x1a9371[_0xef41('0x55')]){_0x2a8441[_0xef41('0x55')]={'id':_0x1a9371[_0xef41('0x55')]['id'],'name':_0x1a9371[_0xef41('0x55')]['name'],'active':_0x1a9371[_0xef41('0x55')][_0xef41('0x56')],'callerid':_0x1a9371['Trunk'][_0xef41('0x57')]};}if(_0x1a9371['Interval']){_0x2a8441[_0xef41('0x58')]={'id':_0x1a9371[_0xef41('0x58')]['id'],'name':_0x1a9371['Interval']['name']};}_0xf91dd2[_0xef41('0x59')](_0x2a8441);}}_0x42a648({'count':_0xf91dd2['length'],'rows':_0xf91dd2});});},'VoiceChannels':function(_0x2ab47f){return new Promise(function(_0x1d986d,_0x3449a5){var _0x2f7cac=_['values'](_0x5bf199[_0xef41('0x5a')]);_0x1d986d({'count':_0x2f7cac[_0xef41('0x5b')],'rows':_0x2f7cac});});},'VoiceChannelMixMonitor':function(_0x22f146){var _0x388afe=this;return new Promise(function(_0x1b000d,_0x40c855){if(ami[_0xef41('0x1e')]()==![]){return _0x40c855(_0x388afe[_0xef41('0x13')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0xef41('0x1f')],_0xef41('0x5c')][_0xef41('0x15')]('\x20')));}var _0x562b84=schema(properties[_0xef41('0x5d')])[_0xef41('0x5e')](_0x22f146);if(_0x562b84[_0xef41('0x5b')]>0x0){return _0x40c855(_0x388afe[_0xef41('0x13')](0x1f4,_[_0xef41('0x5f')](_0x562b84,_0xef41('0x1c'))['join'](',\x20')));}var _0x32b855=_[_0xef41('0x60')](_0x5bf199[_0xef41('0x5a')],{'uniqueid':_0x22f146[_0xef41('0x61')]});if(_0x32b855&&_0x32b855[_0xef41('0x62')]){var _0x4b1623=util[_0xef41('0x9')](_0xef41('0x63'),_0x22f146[_0xef41('0x64')]||_0x22f146['uniqueid'],_0x22f146[_0xef41('0x9')]||'wav');return ami['Action']({'action':_0xef41('0x65'),'channel':_0x32b855['channel'],'file':_0x4b1623,'options':_0xef41('0x66')})[_0xef41('0x67')](function(_0x43d10e){var _0x237689=_['find'](_0x32b855['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x4b1623['toLowerCase']()});if(_[_0xef41('0x68')](_0x237689)){_0x32b855[_0xef41('0x69')][_0xef41('0x59')]({'filename':_0xef41('0x6a')+_0x4b1623['toLowerCase'](),'createdAt':moment()[_0xef41('0x9')](_0xef41('0x6b')),'mixmonitorid':_0x43d10e[_0xef41('0x6c')],'status':_0xef41('0x6d')});}else{_0x237689['mixmonitorid']=_0x43d10e[_0xef41('0x6c')];_0x237689['status']=_0xef41('0x6d');}_0x1b000d({'code':0xc8,'message':[_0x22f146['uniqueid'],_0xef41('0x6e'),_0x43d10e[_0xef41('0x6c')]][_0xef41('0x15')]('\x20'),'mixmonitorid':_0x43d10e[_0xef41('0x6c')]});})['catch'](function(_0x1bf3fe){_0x40c855(_0x388afe[_0xef41('0x13')](0x1f5,[_0x22f146['uniqueid'],_0x1bf3fe[_0xef41('0x1c')]['toLowerCase']()][_0xef41('0x15')]('\x20')));});}else{return _0x40c855(_0x388afe[_0xef41('0x13')](0x1f5,_0xef41('0x6f')));}});},'VoiceChannelStopMixMonitor':function(_0x514746){var _0x1470f2=this;return new Promise(function(_0x4a7375,_0x401198){if(ami[_0xef41('0x1e')]()==![]){return _0x401198(_0x1470f2['error'](0x1f4,[config[_0xef41('0x14')]['ip'],config['asterisk'][_0xef41('0x1f')],_0xef41('0x5c')][_0xef41('0x15')]('\x20')));}var _0x1dda90=schema(properties[_0xef41('0x5d')])[_0xef41('0x5e')](_0x514746);if(_0x1dda90[_0xef41('0x5b')]>0x0){return _0x401198(_0x1470f2['error'](0x1f4,_[_0xef41('0x5f')](_0x1dda90,_0xef41('0x1c'))[_0xef41('0x15')](',\x20')));}var _0x585f50=_[_0xef41('0x60')](_0x5bf199[_0xef41('0x5a')],{'uniqueid':_0x514746[_0xef41('0x61')]});if(_0x585f50){return BPromise[_0xef41('0x70')]()[_0xef41('0x67')](function(){if(_0x585f50[_0xef41('0x62')]){return ami['Action']({'action':_0xef41('0x71'),'channel':_0x585f50[_0xef41('0x62')],'mixmonitorid':_0x514746[_0xef41('0x6c')]})['catch'](function(_0x375336){});}})[_0xef41('0x67')](function(){if(_0x585f50['destinationchannel']){return ami[_0xef41('0x1b')]({'action':'StopMixMonitor','channel':_0x585f50['destinationchannel'],'mixmonitorid':_0x514746[_0xef41('0x6c')]})[_0xef41('0x1d')](function(_0x420039){});}})[_0xef41('0x67')](function(_0x37492f){var _0x52c220=_[_0xef41('0x60')](_0x585f50['monitors'],{'mixmonitorid':_0x514746[_0xef41('0x6c')]});if(_0x52c220){_0x52c220[_0xef41('0x72')]=_0xef41('0x73');}})[_0xef41('0x67')](function(){var _0x4fa482=util[_0xef41('0x9')](_0xef41('0x63'),_0x514746['filename']||_0x514746[_0xef41('0x61')],_0x514746['format']||_0xef41('0x74'));var _0x1ba05d=_[_0xef41('0x60')](_0x585f50['monitors'],{'filename':_0xef41('0x6a')+_0x4fa482[_0xef41('0x75')]()});if(_0x1ba05d){_0x1ba05d[_0xef41('0x72')]='stop';}})['then'](function(){_0x4a7375({'code':0xc8,'message':[_0x514746[_0xef41('0x61')],_0xef41('0x76')]['join']('\x20')});})['catch'](function(_0x5ccb29){_0x401198(_0x1470f2[_0xef41('0x13')](0x1f5,[_0x514746[_0xef41('0x61')],_0x5ccb29[_0xef41('0x1c')]['toLowerCase']()][_0xef41('0x15')]('\x20')));});}else{return _0x401198(_0x1470f2[_0xef41('0x13')](0x1f5,_0xef41('0x6f')));}});},'VoiceQueuesChannels':function(_0x395f4b){return new Promise(function(_0x212f63,_0x4ca38d){var _0x200d14=_[_0xef41('0x77')](_0x5bf199[_0xef41('0x78')]);_0x212f63({'count':_0x200d14[_0xef41('0x5b')],'rows':_0x200d14});});},'VoiceQueuesChannel':function(_0x85aad5){var _0x4f660c=this;return new Promise(function(_0xb797da,_0xcb6bdd){var _0x47a0c0=schema(properties[_0xef41('0x79')])['validate'](_0x85aad5);if(_0x47a0c0[_0xef41('0x5b')]>0x0){return _0xcb6bdd(_0x4f660c['error'](0x1f4,_[_0xef41('0x5f')](_0x47a0c0,'message')['join'](',\x20')));}var _0x2c0eac=_['find'](_0x5bf199['queueChannels'],{'uniqueid':_0x85aad5[_0xef41('0x61')]});if(_0x2c0eac){_0xb797da(_0x2c0eac);}else{return _0xcb6bdd(_0x4f660c[_0xef41('0x13')](0x1f5,_0xef41('0x6f')));}});},'VoiceQueuesChannelHangup':function(_0x4e77a5){var _0x2c509a=this;return new Promise(function(_0x138985,_0x2fade9){if(ami[_0xef41('0x1e')]()==![]){return _0x2fade9(_0x2c509a['error'](0x1f4,[config[_0xef41('0x14')]['ip'],config['asterisk'][_0xef41('0x1f')],'ami\x20disconnected']['join']('\x20')));}var _0xad1e9b=schema(properties[_0xef41('0x7a')])[_0xef41('0x5e')](_0x4e77a5);if(_0xad1e9b['length']>0x0){return _0x2fade9(_0x2c509a[_0xef41('0x13')](0x1f4,_[_0xef41('0x5f')](_0xad1e9b,'message')[_0xef41('0x15')](',\x20')));}var _0x7f082f=_[_0xef41('0x60')](_0x5bf199[_0xef41('0x78')],{'uniqueid':_0x4e77a5[_0xef41('0x61')]});if(_0x7f082f&&_0x7f082f[_0xef41('0x62')]){return ami[_0xef41('0x1b')]({'action':_0xef41('0x7b'),'channel':_0x7f082f[_0xef41('0x62')]})['then'](function(_0x27d4ea){_0x138985({'code':0xc8,'message':[_0x4e77a5['uniqueid'],_0x27d4ea['message']['toLowerCase']()][_0xef41('0x15')]('\x20')});})[_0xef41('0x1d')](function(_0x4838fe){_0x2fade9(_0x2c509a['error'](0x1f5,[_0x4e77a5['uniqueid'],_0x4838fe[_0xef41('0x1c')]['toLowerCase']()][_0xef41('0x15')]('\x20')));});}else{return _0x2fade9(_0x2c509a[_0xef41('0x13')](0x1f5,_0xef41('0x6f')));}});},'VoiceQueuesChannelRedirect':function(_0x4bd0b0){var _0x4dbab0=this;return new Promise(function(_0x263449,_0x10aaa5){if(ami['isConnected']()==![]){return _0x10aaa5(_0x4dbab0[_0xef41('0x13')](0x1f4,[config[_0xef41('0x14')]['ip'],config[_0xef41('0x14')][_0xef41('0x1f')],'ami\x20disconnected']['join']('\x20')));}var _0x280f56=schema(properties[_0xef41('0x7c')])[_0xef41('0x5e')](_0x4bd0b0);if(_0x280f56['length']>0x0){return _0x10aaa5(_0x4dbab0[_0xef41('0x13')](0x1f4,_[_0xef41('0x5f')](_0x280f56,_0xef41('0x1c'))['join'](',\x20')));}var _0x4f56bb=_[_0xef41('0x60')](_0x5bf199['queueChannels'],{'uniqueid':_0x4bd0b0[_0xef41('0x61')]});if(_0x4f56bb&&_0x4f56bb[_0xef41('0x62')]){return ami[_0xef41('0x1b')]({'action':_0xef41('0x7d'),'channel':_0x4f56bb[_0xef41('0x62')],'exten':_0x4bd0b0['exten'],'context':_0x4bd0b0[_0xef41('0x7e')]||_0x4f56bb[_0xef41('0x7e')],'priority':0x1})[_0xef41('0x67')](function(_0x575c45){_0x263449({'code':0xc8,'message':[_0x4bd0b0['uniqueid'],_0x575c45['message'][_0xef41('0x75')]()][_0xef41('0x15')]('\x20')});})[_0xef41('0x1d')](function(_0x35b991){_0x10aaa5(_0x4dbab0['error'](0x1f5,[_0x4bd0b0[_0xef41('0x61')],_0x35b991[_0xef41('0x1c')][_0xef41('0x75')]()][_0xef41('0x15')]('\x20')));});}else{return _0x10aaa5(_0x4dbab0['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x4bb497){return new Promise(function(_0x403a64,_0x5298a9){var _0xa409bd=_[_0xef41('0x77')](_0x5bf199[_0xef41('0x10')]);_0x403a64({'count':_0xa409bd['length'],'rows':_0xa409bd});});},'Telephones':function(_0x378d9c){return new Promise(function(_0x549f7e,_0x1ca3d6){var _0x19f39c=_['values'](_0x5bf199[_0xef41('0x7f')]);_0x549f7e({'count':_0x19f39c[_0xef41('0x5b')],'rows':_0x19f39c});});},'Trunks':function(_0x57a189){return new Promise(function(_0x1b9281,_0x278031){var _0x2aa966=_[_0xef41('0x77')](_0x5bf199[_0xef41('0x80')]);_0x1b9281({'count':_0x2aa966[_0xef41('0x5b')],'rows':_0x2aa966});});},'OutboundChannels':function(_0x4d1ee8){return new Promise(function(_0x1eff66,_0x3153cd){var _0x589dd3=_[_0xef41('0x77')](_0x5bf199[_0xef41('0x81')]);_0x1eff66({'count':_0x589dd3[_0xef41('0x5b')],'rows':_0x589dd3});});},'Outbound':function(_0x1bcb24){return new Promise(function(_0x58941d,_0x529b52){_0x58941d(_0x5bf199['outbound']);});},'Campaigns':function(_0x5392d0){return new Promise(function(_0x23752a,_0x1a6160){var _0x44cf25=_[_0xef41('0x77')](_0x5bf199[_0xef41('0x82')]);_0x23752a({'count':_0x44cf25['length'],'rows':_0x44cf25});});},'VoiceQueuesPreview':function(_0x220888){var _0x48c59a=this;return new Promise(function(_0x33ff12,_0x312eb1){_0x38ab1e[_0xef41('0x83')](_0x220888['id'])[_0xef41('0x67')](function(_0x13b648){_0x33ff12({'code':0xc8,'message':_0x13b648['message']});})[_0xef41('0x1d')](function(_0x3f762a){_0x312eb1(_0x48c59a['error'](0x1f4,_0x3f762a[_0xef41('0x1c')]));});});},'EventManager':function(_0xf18628){var _0x5c5b96=this;return new Promise(function(_0x43c242,_0xa45791){if(!_0xf18628['event']){return _0xa45791(_0x5c5b96[_0xef41('0x13')](0x1f4,_0xef41('0x84')));}ami[_0xef41('0x85')](_0xef41('0x86')+_0xf18628['event'],_0xf18628[_0xef41('0x1c')]);_0x43c242({'code':0xc8,'message':_0xf18628});});},'FaxAccounts':function(_0x2147a6){return new Promise(function(_0x407199,_0x365e8e){var _0x41504e=_[_0xef41('0x77')](_0x5bf199[_0xef41('0x87')]);_0x407199({'count':_0x41504e[_0xef41('0x5b')],'rows':_0x41504e});});},'SendFax':function(_0x1c00bc){var _0x431c8c=this;return new Promise(function(_0xc20e25,_0x19a7de){_0x3d11fd[_0xef41('0x88')](_0x1c00bc)[_0xef41('0x67')](function(_0x2c3a24){_0xc20e25({'code':0xc8,'message':_0x2c3a24['message']});})[_0xef41('0x1d')](function(_0x3cf356){_0x19a7de(_0x431c8c[_0xef41('0x13')](0x1f4,_0x3cf356['message']));});});},'CheckAfterSend':function(_0x46ff76){var _0x34c711=this;return new Promise(function(_0x98e8e9,_0x36867d){_0x3d11fd[_0xef41('0x89')](_0x46ff76)[_0xef41('0x67')](function(_0x588076){_0x98e8e9({'code':0xc8,'message':_0x588076['message']});})[_0xef41('0x1d')](function(_0x66c765){_0x36867d(_0x34c711[_0xef41('0x13')](0x1f4,_0x66c765[_0xef41('0x1c')]));});});}};var _0x35990a=jayson[_0xef41('0x8a')](_0x2d334f)[_0xef41('0x8b')]();_0x35990a['on'](_0xef41('0x13'),function(_0x4e7a6e){return _0x5d0562(_0x4e7a6e);});_0x35990a[_0xef41('0x8')](0x232a,_0xef41('0x8c'),function(){console[_0xef41('0x8d')](_0xef41('0x8e'),0x232a);return _0x4edfbd(_0xef41('0x8f')+0x232a);});});}; \ No newline at end of file +var _0x5e15=['dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','values','voicechannel','validate','map','find','channels','uniqueid','channel','%s.%s','filename','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','catch','resolve','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','queueChannels','voicequeuechannel','voicequeuechannelhangup','Redirect','context','telephones','trunks','outboundChannels','run','Event\x20name\x20mandatory','emit','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','../properties','listen','format','%s/%s','SIP','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','pick','keys','action','Action','then','message','ami\x20disconnected','join','command','Command','content','voiceQueues','hasOwnProperty','name','strategy','answered','available','loggedIn','sumBillable','sumHoldTime','talking','total','type','unmanaged','abandoned','loggedInDb','outbound','dialActive','dialMethod'];(function(_0x32e050,_0x1386a0){var _0x6181be=function(_0x1f3834){while(--_0x1f3834){_0x32e050['push'](_0x32e050['shift']());}};_0x6181be(++_0x1386a0);}(_0x5e15,0x1ec));var _0x55e1=function(_0x3b3008,_0x4d7025){_0x3b3008=_0x3b3008-0x0;var _0x518681=_0x5e15[_0x3b3008];return _0x518681;};'use strict';var _=require(_0x55e1('0x0'));var util=require(_0x55e1('0x1'));var jayson=require(_0x55e1('0x2'));var schema=require('validate');var BPromise=require('bluebird');var moment=require('moment');var config=require('../../../config/environment');var properties=require(_0x55e1('0x3'));var ami=require('../ami');exports[_0x55e1('0x4')]=function(_0x1569e7,_0x4eafc7,_0xc0fa8d){return new BPromise(function(_0x5507e5,_0x2ab712){var _0x5142e4={'QueuePause':function(_0x3bf9c1){return new Promise(function(_0x19746d,_0x5c14e2){var _0x3ba10a=util[_0x55e1('0x5')](_0x55e1('0x6'),_0x55e1('0x7'),_0x3bf9c1['name']);if(_0x1569e7[_0x55e1('0x8')]&&_0x1569e7[_0x55e1('0x8')][_0x3ba10a]&&_0x1569e7[_0x55e1('0x8')][_0x3ba10a][_0x55e1('0x9')]){_0x1569e7['timers'][_0x3ba10a][_0x55e1('0xa')]();}if(_0x1569e7[_0x55e1('0xb')][_0x3ba10a]){_0x1569e7['agents'][_0x3ba10a][_0x55e1('0xc')]({'statePause':_0x3bf9c1[_0x55e1('0xd')]?!![]:![]});}_0x19746d({'code':0xc8,'message':_0x55e1('0xe')});});},'Reload':function(_0x4a6695){var _0x3d4b40=this;return new Promise(function(_0x62a2fd,_0x4abeb5){if(ami[_0x55e1('0xf')]()==![]){return _0x4abeb5(_0x3d4b40[_0x55e1('0x10')](0x1f4,[config[_0x55e1('0x11')]['ip'],config[_0x55e1('0x11')][_0x55e1('0x12')],'ami\x20disconnected']['join']('\x20')));}_0x4a6695=_[_0x55e1('0x13')](_0x4a6695,_[_0x55e1('0x14')](properties['module']));_0x4a6695[_0x55e1('0x15')]='Reload';return ami[_0x55e1('0x16')](_0x4a6695)[_0x55e1('0x17')](function(_0x508d4c){_0x62a2fd({'code':0xc8,'message':_0x508d4c[_0x55e1('0x18')]});})['catch'](function(_0x573fea){_0x4abeb5(_0x3d4b40[_0x55e1('0x10')](0x1f5,_0x573fea[_0x55e1('0x18')]));});});},'Command':function(_0x2de89d){var _0x2f9625=this;return new Promise(function(_0x56370a,_0x2a3671){if(ami[_0x55e1('0xf')]()==![]){return _0x2a3671(_0x2f9625[_0x55e1('0x10')](0x1f4,[config[_0x55e1('0x11')]['ip'],config[_0x55e1('0x11')][_0x55e1('0x12')],_0x55e1('0x19')][_0x55e1('0x1a')]('\x20')));}_0x2de89d=_[_0x55e1('0x13')](_0x2de89d,_0x55e1('0x1b'));_0x2de89d['action']=_0x55e1('0x1c');return ami[_0x55e1('0x16')](_0x2de89d)[_0x55e1('0x17')](function(_0x62ef8e){_0x56370a({'code':0xc8,'message':_0x62ef8e[_0x55e1('0x1d')]});})['catch'](function(_0x54a81c){_0x2a3671(_0x2f9625[_0x55e1('0x10')](0x1f5,_0x54a81c[_0x55e1('0x18')]));});});},'VoiceQueues':function(_0x4e0e09){return new Promise(function(_0x6963c6,_0x300dbd){var _0x20a73b=[];for(var _0x23745d in _0x1569e7['voiceQueues']){if(_0x1569e7[_0x55e1('0x1e')][_0x55e1('0x1f')](_0x23745d)){var _0x11b56c=_0x1569e7['voiceQueues'][_0x23745d];var _0x22cbbb={'id':_0x11b56c['id'],'name':_0x11b56c[_0x55e1('0x20')],'strategy':_0x11b56c[_0x55e1('0x21')],'answered':_0x11b56c[_0x55e1('0x22')],'available':_0x11b56c[_0x55e1('0x23')],'loggedIn':_0x11b56c[_0x55e1('0x24')],'pTalking':_0x11b56c['pTalking'],'sumBillable':_0x11b56c[_0x55e1('0x25')],'sumDuration':_0x11b56c['sumDuration'],'sumHoldTime':_0x11b56c[_0x55e1('0x26')]||0x0,'talking':_0x11b56c[_0x55e1('0x27')],'total':_0x11b56c[_0x55e1('0x28')],'type':_0x11b56c[_0x55e1('0x29')],'unmanaged':_0x11b56c[_0x55e1('0x2a')],'abandoned':_0x11b56c[_0x55e1('0x2b')],'waiting':_0x11b56c['waiting'],'loggedInDb':_0x11b56c[_0x55e1('0x2c')]};if(_0x11b56c[_0x55e1('0x29')]===_0x55e1('0x2d')){_0x22cbbb[_0x55e1('0x2e')]=_0x11b56c['dialActive'];_0x22cbbb[_0x55e1('0x2f')]=_0x11b56c[_0x55e1('0x2f')];_0x22cbbb[_0x55e1('0x30')]=_0x11b56c[_0x55e1('0x30')];_0x22cbbb[_0x55e1('0x31')]=_0x11b56c[_0x55e1('0x31')];_0x22cbbb[_0x55e1('0x32')]=_0x11b56c[_0x55e1('0x32')];_0x22cbbb[_0x55e1('0x33')]=_0x11b56c[_0x55e1('0x33')];_0x22cbbb[_0x55e1('0x34')]=_0x11b56c[_0x55e1('0x34')];_0x22cbbb[_0x55e1('0x35')]=_0x11b56c[_0x55e1('0x35')];_0x22cbbb[_0x55e1('0x36')]=_0x11b56c[_0x55e1('0x36')];_0x22cbbb[_0x55e1('0x37')]=_0x11b56c[_0x55e1('0x37')];_0x22cbbb[_0x55e1('0x38')]=_0x11b56c[_0x55e1('0x38')];_0x22cbbb[_0x55e1('0x39')]=_0x11b56c[_0x55e1('0x39')];_0x22cbbb[_0x55e1('0x3a')]=_0x11b56c[_0x55e1('0x3a')];_0x22cbbb[_0x55e1('0x3b')]=_0x11b56c[_0x55e1('0x3b')];_0x22cbbb[_0x55e1('0x3c')]=_0x11b56c['outboundNoAnswerCallsDay'];_0x22cbbb[_0x55e1('0x3d')]=_0x11b56c[_0x55e1('0x3d')];_0x22cbbb[_0x55e1('0x3e')]=_0x11b56c[_0x55e1('0x3e')];_0x22cbbb[_0x55e1('0x3f')]=_0x11b56c[_0x55e1('0x3f')];_0x22cbbb['outboundRejectCallsDay']=_0x11b56c[_0x55e1('0x40')];_0x22cbbb[_0x55e1('0x41')]=_0x11b56c[_0x55e1('0x41')];_0x22cbbb['predictiveIntervalAnsweredCalls']=_0x11b56c['predictiveIntervalAnsweredCalls'];_0x22cbbb['predictiveIntervalAvgHoldtime']=_0x11b56c[_0x55e1('0x42')];_0x22cbbb[_0x55e1('0x43')]=_0x11b56c[_0x55e1('0x43')];_0x22cbbb[_0x55e1('0x44')]=_0x11b56c['predictiveIntervalDroppedCallsCallersExit'];_0x22cbbb[_0x55e1('0x45')]=_0x11b56c[_0x55e1('0x45')];_0x22cbbb[_0x55e1('0x46')]=_0x11b56c['predictiveIntervalErlangCalls'];_0x22cbbb[_0x55e1('0x47')]=_0x11b56c['predictiveIntervalErlangCallsDroppedCalls'];_0x22cbbb[_0x55e1('0x48')]=_0x11b56c[_0x55e1('0x48')];_0x22cbbb[_0x55e1('0x49')]=_0x11b56c['predictiveIntervalMultiplicativeFactor'];_0x22cbbb[_0x55e1('0x4a')]=_0x11b56c[_0x55e1('0x4a')];_0x22cbbb[_0x55e1('0x4b')]=_0x11b56c[_0x55e1('0x4b')];_0x22cbbb['predictiveIntervalTotalCalls']=_0x11b56c['predictiveIntervalTotalCalls'];_0x22cbbb[_0x55e1('0x18')]=_0x11b56c[_0x55e1('0x18')];_0x22cbbb[_0x55e1('0x4c')]=_0x11b56c['originated'];_0x22cbbb['erlangCalls']=_0x11b56c[_0x55e1('0x4d')];_0x22cbbb['erlangCallToSecond']=_0x11b56c['erlangCallToSecond'];_0x22cbbb['erlangAbandonmentRate']=_0x11b56c[_0x55e1('0x4e')];_0x22cbbb[_0x55e1('0x4f')]=_0x11b56c[_0x55e1('0x4f')];_0x22cbbb['startPredictive']=_0x11b56c[_0x55e1('0x50')];_0x22cbbb[_0x55e1('0x51')]=_0x11b56c[_0x55e1('0x51')];}if(_0x11b56c['Trunk']){_0x22cbbb[_0x55e1('0x52')]={'id':_0x11b56c[_0x55e1('0x52')]['id'],'name':_0x11b56c[_0x55e1('0x52')][_0x55e1('0x20')],'active':_0x11b56c[_0x55e1('0x52')][_0x55e1('0x53')],'callerid':_0x11b56c[_0x55e1('0x52')][_0x55e1('0x54')]};}if(_0x11b56c['Interval']){_0x22cbbb[_0x55e1('0x55')]={'id':_0x11b56c[_0x55e1('0x55')]['id'],'name':_0x11b56c[_0x55e1('0x55')][_0x55e1('0x20')]};}_0x20a73b[_0x55e1('0x56')](_0x22cbbb);}}_0x6963c6({'count':_0x20a73b[_0x55e1('0x57')],'rows':_0x20a73b});});},'VoiceChannels':function(_0x49b514){return new Promise(function(_0x1368ba,_0x4e042d){var _0x212f86=_[_0x55e1('0x58')](_0x1569e7['channels']);_0x1368ba({'count':_0x212f86[_0x55e1('0x57')],'rows':_0x212f86});});},'VoiceChannelMixMonitor':function(_0x395980){var _0x3ca317=this;return new Promise(function(_0x225ad,_0x6136a2){if(ami[_0x55e1('0xf')]()==![]){return _0x6136a2(_0x3ca317[_0x55e1('0x10')](0x1f4,[config[_0x55e1('0x11')]['ip'],config[_0x55e1('0x11')][_0x55e1('0x12')],_0x55e1('0x19')][_0x55e1('0x1a')]('\x20')));}var _0xc55166=schema(properties[_0x55e1('0x59')])[_0x55e1('0x5a')](_0x395980);if(_0xc55166['length']>0x0){return _0x6136a2(_0x3ca317['error'](0x1f4,_[_0x55e1('0x5b')](_0xc55166,_0x55e1('0x18'))[_0x55e1('0x1a')](',\x20')));}var _0x4eebec=_[_0x55e1('0x5c')](_0x1569e7[_0x55e1('0x5d')],{'uniqueid':_0x395980[_0x55e1('0x5e')]});if(_0x4eebec&&_0x4eebec[_0x55e1('0x5f')]){var _0x4cc5bc=util[_0x55e1('0x5')](_0x55e1('0x60'),_0x395980[_0x55e1('0x61')]||_0x395980['uniqueid'],_0x395980['format']||_0x55e1('0x62'));return ami[_0x55e1('0x16')]({'action':_0x55e1('0x63'),'channel':_0x4eebec[_0x55e1('0x5f')],'file':_0x4cc5bc,'options':_0x55e1('0x64')})['then'](function(_0x30d3ec){var _0x314c0c=_[_0x55e1('0x5c')](_0x4eebec[_0x55e1('0x65')],{'filename':_0x55e1('0x66')+_0x4cc5bc[_0x55e1('0x67')]()});if(_[_0x55e1('0x68')](_0x314c0c)){_0x4eebec[_0x55e1('0x65')][_0x55e1('0x56')]({'filename':_0x55e1('0x66')+_0x4cc5bc[_0x55e1('0x67')](),'createdAt':moment()[_0x55e1('0x5')](_0x55e1('0x69')),'mixmonitorid':_0x30d3ec[_0x55e1('0x6a')],'status':_0x55e1('0x6b')});}else{_0x314c0c[_0x55e1('0x6a')]=_0x30d3ec[_0x55e1('0x6a')];_0x314c0c[_0x55e1('0x6c')]=_0x55e1('0x6b');}_0x225ad({'code':0xc8,'message':[_0x395980[_0x55e1('0x5e')],'MixMonitor\x20Success',_0x30d3ec[_0x55e1('0x6a')]][_0x55e1('0x1a')]('\x20'),'mixmonitorid':_0x30d3ec['mixmonitorid']});})[_0x55e1('0x6d')](function(_0x5ea336){_0x6136a2(_0x3ca317[_0x55e1('0x10')](0x1f5,[_0x395980[_0x55e1('0x5e')],_0x5ea336[_0x55e1('0x18')][_0x55e1('0x67')]()][_0x55e1('0x1a')]('\x20')));});}else{return _0x6136a2(_0x3ca317[_0x55e1('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x2da471){var _0x1d1c39=this;return new Promise(function(_0x393403,_0x4bc43e){if(ami[_0x55e1('0xf')]()==![]){return _0x4bc43e(_0x1d1c39[_0x55e1('0x10')](0x1f4,[config[_0x55e1('0x11')]['ip'],config[_0x55e1('0x11')][_0x55e1('0x12')],_0x55e1('0x19')][_0x55e1('0x1a')]('\x20')));}var _0x1e92f5=schema(properties[_0x55e1('0x59')])['validate'](_0x2da471);if(_0x1e92f5[_0x55e1('0x57')]>0x0){return _0x4bc43e(_0x1d1c39['error'](0x1f4,_[_0x55e1('0x5b')](_0x1e92f5,'message')[_0x55e1('0x1a')](',\x20')));}var _0x4f4160=_[_0x55e1('0x5c')](_0x1569e7[_0x55e1('0x5d')],{'uniqueid':_0x2da471[_0x55e1('0x5e')]});if(_0x4f4160){return BPromise[_0x55e1('0x6e')]()['then'](function(){if(_0x4f4160[_0x55e1('0x5f')]){return ami[_0x55e1('0x16')]({'action':_0x55e1('0x6f'),'channel':_0x4f4160[_0x55e1('0x5f')],'mixmonitorid':_0x2da471[_0x55e1('0x6a')]})[_0x55e1('0x6d')](function(_0x1031c5){});}})[_0x55e1('0x17')](function(){if(_0x4f4160[_0x55e1('0x70')]){return ami[_0x55e1('0x16')]({'action':'StopMixMonitor','channel':_0x4f4160[_0x55e1('0x70')],'mixmonitorid':_0x2da471[_0x55e1('0x6a')]})['catch'](function(_0x51ab2e){});}})['then'](function(_0x279b63){var _0x5bf1f2=_[_0x55e1('0x5c')](_0x4f4160[_0x55e1('0x65')],{'mixmonitorid':_0x2da471[_0x55e1('0x6a')]});if(_0x5bf1f2){_0x5bf1f2[_0x55e1('0x6c')]=_0x55e1('0x71');}})['then'](function(){var _0x2f4339=util[_0x55e1('0x5')](_0x55e1('0x60'),_0x2da471[_0x55e1('0x61')]||_0x2da471[_0x55e1('0x5e')],_0x2da471[_0x55e1('0x5')]||_0x55e1('0x62'));var _0x5c55a9=_[_0x55e1('0x5c')](_0x4f4160[_0x55e1('0x65')],{'filename':_0x55e1('0x66')+_0x2f4339['toLowerCase']()});if(_0x5c55a9){_0x5c55a9[_0x55e1('0x6c')]=_0x55e1('0x71');}})[_0x55e1('0x17')](function(){_0x393403({'code':0xc8,'message':[_0x2da471[_0x55e1('0x5e')],_0x55e1('0x72')][_0x55e1('0x1a')]('\x20')});})['catch'](function(_0x21903c){_0x4bc43e(_0x1d1c39[_0x55e1('0x10')](0x1f5,[_0x2da471[_0x55e1('0x5e')],_0x21903c[_0x55e1('0x18')][_0x55e1('0x67')]()][_0x55e1('0x1a')]('\x20')));});}else{return _0x4bc43e(_0x1d1c39[_0x55e1('0x10')](0x1f5,_0x55e1('0x73')));}});},'VoiceQueuesChannels':function(_0xb45248){return new Promise(function(_0x3c2db6,_0x3b0bba){var _0x4c87f0=_[_0x55e1('0x58')](_0x1569e7[_0x55e1('0x74')]);_0x3c2db6({'count':_0x4c87f0[_0x55e1('0x57')],'rows':_0x4c87f0});});},'VoiceQueuesChannel':function(_0x1ee211){var _0x1c314c=this;return new Promise(function(_0x151d23,_0x44e5cb){var _0x54f4b0=schema(properties[_0x55e1('0x75')])[_0x55e1('0x5a')](_0x1ee211);if(_0x54f4b0[_0x55e1('0x57')]>0x0){return _0x44e5cb(_0x1c314c[_0x55e1('0x10')](0x1f4,_['map'](_0x54f4b0,'message')[_0x55e1('0x1a')](',\x20')));}var _0x2e1289=_[_0x55e1('0x5c')](_0x1569e7[_0x55e1('0x74')],{'uniqueid':_0x1ee211[_0x55e1('0x5e')]});if(_0x2e1289){_0x151d23(_0x2e1289);}else{return _0x44e5cb(_0x1c314c[_0x55e1('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x29ba9e){var _0x745453=this;return new Promise(function(_0x5c5053,_0x1d9638){if(ami[_0x55e1('0xf')]()==![]){return _0x1d9638(_0x745453[_0x55e1('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x55e1('0x11')]['username'],_0x55e1('0x19')][_0x55e1('0x1a')]('\x20')));}var _0x1c13a6=schema(properties[_0x55e1('0x76')])['validate'](_0x29ba9e);if(_0x1c13a6['length']>0x0){return _0x1d9638(_0x745453[_0x55e1('0x10')](0x1f4,_[_0x55e1('0x5b')](_0x1c13a6,_0x55e1('0x18'))['join'](',\x20')));}var _0x56976f=_[_0x55e1('0x5c')](_0x1569e7[_0x55e1('0x74')],{'uniqueid':_0x29ba9e[_0x55e1('0x5e')]});if(_0x56976f&&_0x56976f['channel']){return ami['Action']({'action':'Hangup','channel':_0x56976f[_0x55e1('0x5f')]})[_0x55e1('0x17')](function(_0x32cc2d){_0x5c5053({'code':0xc8,'message':[_0x29ba9e['uniqueid'],_0x32cc2d[_0x55e1('0x18')]['toLowerCase']()][_0x55e1('0x1a')]('\x20')});})['catch'](function(_0x56ca42){_0x1d9638(_0x745453['error'](0x1f5,[_0x29ba9e[_0x55e1('0x5e')],_0x56ca42['message'][_0x55e1('0x67')]()][_0x55e1('0x1a')]('\x20')));});}else{return _0x1d9638(_0x745453[_0x55e1('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x130641){var _0x14942e=this;return new Promise(function(_0x305aa1,_0xf18d02){if(ami['isConnected']()==![]){return _0xf18d02(_0x14942e[_0x55e1('0x10')](0x1f4,[config[_0x55e1('0x11')]['ip'],config[_0x55e1('0x11')][_0x55e1('0x12')],_0x55e1('0x19')][_0x55e1('0x1a')]('\x20')));}var _0x459186=schema(properties['voicequeuechannelredirect'])[_0x55e1('0x5a')](_0x130641);if(_0x459186[_0x55e1('0x57')]>0x0){return _0xf18d02(_0x14942e[_0x55e1('0x10')](0x1f4,_['map'](_0x459186,_0x55e1('0x18'))['join'](',\x20')));}var _0x2de2b5=_[_0x55e1('0x5c')](_0x1569e7[_0x55e1('0x74')],{'uniqueid':_0x130641[_0x55e1('0x5e')]});if(_0x2de2b5&&_0x2de2b5['channel']){return ami[_0x55e1('0x16')]({'action':_0x55e1('0x77'),'channel':_0x2de2b5[_0x55e1('0x5f')],'exten':_0x130641['exten'],'context':_0x130641[_0x55e1('0x78')]||_0x2de2b5[_0x55e1('0x78')],'priority':0x1})[_0x55e1('0x17')](function(_0xba79f5){_0x305aa1({'code':0xc8,'message':[_0x130641['uniqueid'],_0xba79f5[_0x55e1('0x18')][_0x55e1('0x67')]()][_0x55e1('0x1a')]('\x20')});})[_0x55e1('0x6d')](function(_0x22bd56){_0xf18d02(_0x14942e['error'](0x1f5,[_0x130641['uniqueid'],_0x22bd56[_0x55e1('0x18')][_0x55e1('0x67')]()][_0x55e1('0x1a')]('\x20')));});}else{return _0xf18d02(_0x14942e[_0x55e1('0x10')](0x1f5,_0x55e1('0x73')));}});},'Agents':function(_0x363bcc){return new Promise(function(_0x2f8fa8,_0xddd71f){var _0x170518=_[_0x55e1('0x58')](_0x1569e7[_0x55e1('0xb')]);_0x2f8fa8({'count':_0x170518[_0x55e1('0x57')],'rows':_0x170518});});},'Telephones':function(_0x5726d3){return new Promise(function(_0x272037,_0x5c731c){var _0x6d25ac=_[_0x55e1('0x58')](_0x1569e7[_0x55e1('0x79')]);_0x272037({'count':_0x6d25ac['length'],'rows':_0x6d25ac});});},'Trunks':function(_0x4cb807){return new Promise(function(_0x3b6c0b,_0xe03813){var _0x239879=_[_0x55e1('0x58')](_0x1569e7[_0x55e1('0x7a')]);_0x3b6c0b({'count':_0x239879[_0x55e1('0x57')],'rows':_0x239879});});},'OutboundChannels':function(_0x48946d){return new Promise(function(_0x580bfd,_0x3a2f47){var _0x131095=_[_0x55e1('0x58')](_0x1569e7[_0x55e1('0x7b')]);_0x580bfd({'count':_0x131095['length'],'rows':_0x131095});});},'Outbound':function(_0x18790d){return new Promise(function(_0x1cd350,_0x3af0d0){_0x1cd350(_0x1569e7[_0x55e1('0x2d')]);});},'Campaigns':function(_0x28c120){return new Promise(function(_0x4ea22f,_0x3bfe16){var _0x278f52=_[_0x55e1('0x58')](_0x1569e7['campaigns']);_0x4ea22f({'count':_0x278f52[_0x55e1('0x57')],'rows':_0x278f52});});},'VoiceQueuesPreview':function(_0x3d7ff8){var _0x1f6635=this;return new Promise(function(_0x1f1725,_0x365fd9){_0x4eafc7[_0x55e1('0x7c')](_0x3d7ff8['id'])[_0x55e1('0x17')](function(_0x240c0e){_0x1f1725({'code':0xc8,'message':_0x240c0e['message']});})[_0x55e1('0x6d')](function(_0x3ed55a){_0x365fd9(_0x1f6635[_0x55e1('0x10')](0x1f4,_0x3ed55a['message']));});});},'EventManager':function(_0x1b9223){var _0x5618a4=this;return new Promise(function(_0xcd917b,_0xa14021){if(!_0x1b9223['event']){return _0xa14021(_0x5618a4[_0x55e1('0x10')](0x1f4,_0x55e1('0x7d')));}ami[_0x55e1('0x7e')]('custom:'+_0x1b9223['event'],_0x1b9223[_0x55e1('0x18')]);_0xcd917b({'code':0xc8,'message':_0x1b9223});});},'FaxAccounts':function(_0x4e2818){return new Promise(function(_0x3d7148,_0x467309){var _0x504edc=_[_0x55e1('0x58')](_0x1569e7[_0x55e1('0x7f')]);_0x3d7148({'count':_0x504edc[_0x55e1('0x57')],'rows':_0x504edc});});},'SendFax':function(_0x4ef276){var _0x4fe6c3=this;return new Promise(function(_0x26cb93,_0x140116){_0xc0fa8d[_0x55e1('0x80')](_0x4ef276)[_0x55e1('0x17')](function(_0x1a3379){_0x26cb93({'code':0xc8,'message':_0x1a3379[_0x55e1('0x18')]});})[_0x55e1('0x6d')](function(_0x4e75f0){_0x140116(_0x4fe6c3[_0x55e1('0x10')](0x1f4,_0x4e75f0[_0x55e1('0x18')]));});});},'CheckAfterSend':function(_0x31875b){var _0x517265=this;return new Promise(function(_0x3e81c8,_0x233f49){_0xc0fa8d[_0x55e1('0x81')](_0x31875b)[_0x55e1('0x17')](function(_0x541778){_0x3e81c8({'code':0xc8,'message':_0x541778[_0x55e1('0x18')]});})['catch'](function(_0x433372){_0x233f49(_0x517265[_0x55e1('0x10')](0x1f4,_0x433372[_0x55e1('0x18')]));});});}};var _0x5f3cc3=jayson[_0x55e1('0x82')](_0x5142e4)[_0x55e1('0x83')]();_0x5f3cc3['on']('error',function(_0x128805){return _0x2ab712(_0x128805);});_0x5f3cc3[_0x55e1('0x4')](0x232a,_0x55e1('0x84'),function(){console[_0x55e1('0x85')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x5507e5(_0x55e1('0x86')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 480860e..441fcca 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 _0xd527=['[%s][%s]\x20Contact\x20found:%s','xmd-contactid2','user:%s','format','trigger:%s','merge','[%s][%s]\x20Contact\x20not\x20found','resolve','createContact','name','action','toLowerCase','catch','[%s][%s]\x20Error\x20creating\x20contact','stringify','util','lodash','ioredis','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','info','[%s][%s]','emit','data2','data1','firstName','calleridname','destcalleridname','','destcalleridnum','uniqueid','then','showContact','omit'];(function(_0x18bf62,_0x5c27d6){var _0x49c15d=function(_0x102d94){while(--_0x102d94){_0x18bf62['push'](_0x18bf62['shift']());}};_0x49c15d(++_0x5c27d6);}(_0xd527,0x195));var _0x7d52=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0xd527[_0x51c819];return _0x15c5d2;};'use strict';var BPromise=require('bluebird');var util=require(_0x7d52('0x0'));var _=require(_0x7d52('0x1'));var Redis=require(_0x7d52('0x2'));var config=require(_0x7d52('0x3'));var logger=require(_0x7d52('0x4'))(_0x7d52('0x5'));var cmContactRpc=require(_0x7d52('0x6'));config[_0x7d52('0x7')]=_[_0x7d52('0x8')](config[_0x7d52('0x7')],{'host':_0x7d52('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x4788b2,_0x4c9005,_0x4228df,_0xb2b79e){logger[_0x7d52('0xa')](_0x7d52('0xb'),_0x4788b2,'',_0x4c9005,_0x4228df,JSON['stringify'](_0xb2b79e));io['to'](_0x4c9005)[_0x7d52('0xc')](_0x4228df,_0xb2b79e);}exports['exec']=function(_0x12b704,_0x31f3ce,_0x1c9d26){_0x1c9d26['autoCreate']=0x0;if(_0x31f3ce[_0x7d52('0xd')]&&parseInt(_0x31f3ce[_0x7d52('0xd')],0xa)){var _0x3d6eed={'ListId':parseInt(_0x31f3ce[_0x7d52('0xe')],0xa),'phone':_0x1c9d26['calleridnum']};if(_['isNil'](_0x1c9d26['routeId'])){_0x3d6eed[_0x7d52('0xf')]=_0x1c9d26[_0x7d52('0x10')]&&_0x1c9d26[_0x7d52('0x10')]!==''?_0x1c9d26['calleridname']:_0x1c9d26['calleridnum']||_0x1c9d26['uniqueid'];}else{_0x3d6eed['firstName']=_0x1c9d26['destcalleridname']&&_0x1c9d26[_0x7d52('0x11')]!==_0x7d52('0x12')?_0x1c9d26[_0x7d52('0x11')]:_0x1c9d26[_0x7d52('0x13')]||_0x1c9d26[_0x7d52('0x14')];_0x3d6eed['phone']=_0x1c9d26[_0x7d52('0x11')]&&_0x1c9d26[_0x7d52('0x11')]!==_0x7d52('0x12')?_0x1c9d26[_0x7d52('0x11')]:_0x1c9d26[_0x7d52('0x13')]||_0x1c9d26['uniqueid'];}BPromise['resolve']()[_0x7d52('0x15')](cmContactRpc[_0x7d52('0x16')]({'where':_[_0x7d52('0x17')](_0x3d6eed,[_0x7d52('0xf')])}))[_0x7d52('0x15')](function(_0xb05603){if(_0xb05603){logger[_0x7d52('0xa')](_0x7d52('0x18'),_0x1c9d26[_0x7d52('0x14')],'',_0xb05603['id']);if(_0x12b704){_0x1c9d26[_0x7d52('0x19')]=_0xb05603['id'];emit(_0x1c9d26['uniqueid'],util['format'](_0x7d52('0x1a'),_0x12b704['name']),util[_0x7d52('0x1b')](_0x7d52('0x1c'),_0x31f3ce['action']['toLowerCase']()),_[_0x7d52('0x1d')](_0x1c9d26,{'ListId':parseInt(_0x31f3ce['data1'],0xa)}));}return;}else{logger['info'](_0x7d52('0x1e'),_0x1c9d26[_0x7d52('0x14')],'');return BPromise[_0x7d52('0x1f')]()[_0x7d52('0x15')](cmContactRpc[_0x7d52('0x20')](_0x3d6eed));}})[_0x7d52('0x15')](function(_0x552e87){if(_0x552e87){logger[_0x7d52('0xa')]('[%s][%s]\x20Contact\x20created:%s',_0x1c9d26[_0x7d52('0x14')],'',_0x552e87['id']);if(_0x12b704){_0x1c9d26['xmd-contactid2']=_0x552e87['id'];emit(_0x1c9d26[_0x7d52('0x14')],util[_0x7d52('0x1b')](_0x7d52('0x1a'),_0x12b704[_0x7d52('0x21')]),util[_0x7d52('0x1b')]('trigger:%s',_0x31f3ce[_0x7d52('0x22')][_0x7d52('0x23')]()),_[_0x7d52('0x1d')](_0x1c9d26,{'ListId':parseInt(_0x31f3ce[_0x7d52('0xe')],0xa)}));}}})[_0x7d52('0x24')](function(_0xa618b0){logger['error'](_0x7d52('0x25'),_0x1c9d26[_0x7d52('0x14')],'',JSON[_0x7d52('0x26')](_0xa618b0));});}else{if(_0x12b704){logger['info']('[%s][%s]\x20Autocreate\x20disabled',_0x1c9d26[_0x7d52('0x14')],'');emit(_0x1c9d26[_0x7d52('0x14')],util[_0x7d52('0x1b')](_0x7d52('0x1a'),_0x12b704[_0x7d52('0x21')]),util['format'](_0x7d52('0x1c'),_0x31f3ce[_0x7d52('0x22')]['toLowerCase']()),_[_0x7d52('0x1d')]({'ListId':parseInt(_0x31f3ce[_0x7d52('0xe')],0xa)},_0x1c9d26));}}}; \ No newline at end of file +var _0x500b=['createContact','[%s][%s]\x20Contact\x20created:%s','format','merge','catch','error','[%s][%s]\x20Error\x20creating\x20contact','[%s][%s]\x20Autocreate\x20disabled','util','lodash','ioredis','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','info','[%s][%s]','stringify','autoCreate','data2','data1','calleridnum','isNil','routeId','firstName','calleridname','uniqueid','destcalleridname','destcalleridnum','resolve','then','showContact','omit','[%s][%s]\x20Contact\x20found:%s','xmd-contactid2','user:%s','name','trigger:%s','action','toLowerCase'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x500b,0x18b));var _0xb500=function(_0x411dc3,_0x47a8e4){_0x411dc3=_0x411dc3-0x0;var _0x5b870b=_0x500b[_0x411dc3];return _0x5b870b;};'use strict';var BPromise=require('bluebird');var util=require(_0xb500('0x0'));var _=require(_0xb500('0x1'));var Redis=require(_0xb500('0x2'));var config=require(_0xb500('0x3'));var logger=require(_0xb500('0x4'))(_0xb500('0x5'));var cmContactRpc=require(_0xb500('0x6'));config[_0xb500('0x7')]=_[_0xb500('0x8')](config['redis'],{'host':_0xb500('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb500('0x7')]));function emit(_0x37f66a,_0x59ad7f,_0x11a40f,_0x1d416e){logger[_0xb500('0xa')](_0xb500('0xb'),_0x37f66a,'',_0x59ad7f,_0x11a40f,JSON[_0xb500('0xc')](_0x1d416e));io['to'](_0x59ad7f)['emit'](_0x11a40f,_0x1d416e);}exports['exec']=function(_0x4939dc,_0x41036c,_0x36335c){_0x36335c[_0xb500('0xd')]=0x0;if(_0x41036c[_0xb500('0xe')]&&parseInt(_0x41036c[_0xb500('0xe')],0xa)){var _0x3662f9={'ListId':parseInt(_0x41036c[_0xb500('0xf')],0xa),'phone':_0x36335c[_0xb500('0x10')]};if(_[_0xb500('0x11')](_0x36335c[_0xb500('0x12')])){_0x3662f9[_0xb500('0x13')]=_0x36335c[_0xb500('0x14')]&&_0x36335c[_0xb500('0x14')]!==''?_0x36335c[_0xb500('0x14')]:_0x36335c[_0xb500('0x10')]||_0x36335c[_0xb500('0x15')];}else{_0x3662f9['firstName']=_0x36335c[_0xb500('0x16')]&&_0x36335c[_0xb500('0x16')]!==''?_0x36335c[_0xb500('0x16')]:_0x36335c[_0xb500('0x17')]||_0x36335c[_0xb500('0x15')];_0x3662f9['phone']=_0x36335c[_0xb500('0x16')]&&_0x36335c['destcalleridname']!==''?_0x36335c[_0xb500('0x16')]:_0x36335c[_0xb500('0x17')]||_0x36335c[_0xb500('0x15')];}BPromise[_0xb500('0x18')]()[_0xb500('0x19')](cmContactRpc[_0xb500('0x1a')]({'where':_[_0xb500('0x1b')](_0x3662f9,[_0xb500('0x13')])}))[_0xb500('0x19')](function(_0x133524){if(_0x133524){logger[_0xb500('0xa')](_0xb500('0x1c'),_0x36335c['uniqueid'],'',_0x133524['id']);if(_0x4939dc){_0x36335c[_0xb500('0x1d')]=_0x133524['id'];emit(_0x36335c['uniqueid'],util['format'](_0xb500('0x1e'),_0x4939dc[_0xb500('0x1f')]),util['format'](_0xb500('0x20'),_0x41036c[_0xb500('0x21')][_0xb500('0x22')]()),_['merge'](_0x36335c,{'ListId':parseInt(_0x41036c[_0xb500('0xf')],0xa)}));}return;}else{logger['info']('[%s][%s]\x20Contact\x20not\x20found',_0x36335c[_0xb500('0x15')],'');return BPromise[_0xb500('0x18')]()['then'](cmContactRpc[_0xb500('0x23')](_0x3662f9));}})[_0xb500('0x19')](function(_0x41a801){if(_0x41a801){logger['info'](_0xb500('0x24'),_0x36335c['uniqueid'],'',_0x41a801['id']);if(_0x4939dc){_0x36335c[_0xb500('0x1d')]=_0x41a801['id'];emit(_0x36335c['uniqueid'],util[_0xb500('0x25')](_0xb500('0x1e'),_0x4939dc[_0xb500('0x1f')]),util['format'](_0xb500('0x20'),_0x41036c[_0xb500('0x21')][_0xb500('0x22')]()),_[_0xb500('0x26')](_0x36335c,{'ListId':parseInt(_0x41036c[_0xb500('0xf')],0xa)}));}}})[_0xb500('0x27')](function(_0x26fda8){logger[_0xb500('0x28')](_0xb500('0x29'),_0x36335c[_0xb500('0x15')],'',JSON[_0xb500('0xc')](_0x26fda8));});}else{if(_0x4939dc){logger[_0xb500('0xa')](_0xb500('0x2a'),_0x36335c['uniqueid'],'');emit(_0x36335c['uniqueid'],util[_0xb500('0x25')]('user:%s',_0x4939dc[_0xb500('0x1f')]),util['format'](_0xb500('0x20'),_0x41036c['action'][_0xb500('0x22')]()),_[_0xb500('0x26')]({'ListId':parseInt(_0x41036c['data1'],0xa)},_0x36335c));}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index daccfce..5fe9802 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 _0x93cc=['winArguments','format','user:%s','name','trigger:%s:%s','action','jscripty','trigger:%s','exec','integration','accounts','queue','urlforward','parse','search','AllConditions','length','checkConditions','channel','AnyConditions','some','account','chat','ChatWebsiteId','value','upperFirst','operator','AccountId','interaction','message','event','agent','membername','lastevent','routeId','exports','lodash','mustache','ioredis','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','defaults','localhost','socket.io-emitter','popup','url','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','servicenowAccounts','custom:agentcalled','syncCustomEvent','custom:agentconnect','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:queuecallerabandon','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:rejectmessage','prototype','emit','info','stringify','clone','log','SYNCCUSTOMNEW!!!','checkTriggers','interface','hasOwnProperty','checkTrigger','merge','Actions','toLowerCase','contactmanager','motionbar','browser','data1','TemplateId','data2','html','render','uri','buildUri','isNil','data3','location','uriLocation','data4','windowWidth','data5','windowHeight','600','data6','winApplication'];(function(_0x382946,_0x52c2a1){var _0x21ed2c=function(_0x529a94){while(--_0x529a94){_0x382946['push'](_0x382946['shift']());}};_0x21ed2c(++_0x52c2a1);}(_0x93cc,0x116));var _0xc93c=function(_0x5e0ef5,_0xd6da15){_0x5e0ef5=_0x5e0ef5-0x0;var _0x5e6ac4=_0x93cc[_0x5e0ef5];return _0x5e6ac4;};'use strict';var util=require('util');var _=require(_0xc93c('0x0'));var url=require('url');var Mustache=require(_0xc93c('0x1'));var Redis=require(_0xc93c('0x2'));var urlforward=require('./urlforward');var integration=require(_0xc93c('0x3'));var cmContact=require(_0xc93c('0x4'));var script=require(_0xc93c('0x5'));var cmContactRpc=require('../rpc/cmContact');var config=require(_0xc93c('0x6'));var logger=require(_0xc93c('0x7'))(_0xc93c('0x8'));var ami=require(_0xc93c('0x9'));config[_0xc93c('0xa')]=_[_0xc93c('0xb')](config[_0xc93c('0xa')],{'host':_0xc93c('0xc'),'port':0x18eb});var io=require(_0xc93c('0xd'))(new Redis(config[_0xc93c('0xa')]));var operators={'equals':function(_0x41aa41,_0x2f1929){return _0x41aa41==_0x2f1929;},'not_equals':function(_0x4a71d3,_0x176879){return _0x4a71d3!=_0x176879;}};var barAndWebActions=[_0xc93c('0xe'),_0xc93c('0xf'),_0xc93c('0x10')];function Trigger(_0x3e01a9){this[_0xc93c('0x11')]=_0x3e01a9[_0xc93c('0x11')];this['agents']=_0x3e01a9[_0xc93c('0x12')];this['voiceQueues']=_0x3e01a9[_0xc93c('0x13')];this[_0xc93c('0x14')]=_0x3e01a9[_0xc93c('0x14')];this[_0xc93c('0x15')]=_0x3e01a9['voiceExtensions'];this[_0xc93c('0x16')]=_0x3e01a9[_0xc93c('0x16')];this[_0xc93c('0x17')]=_0x3e01a9[_0xc93c('0x17')];this[_0xc93c('0x18')]=_0x3e01a9[_0xc93c('0x18')];this['sugarcrmAccounts']=_0x3e01a9[_0xc93c('0x19')];this[_0xc93c('0x1a')]=_0x3e01a9[_0xc93c('0x1a')];this[_0xc93c('0x1b')]=_0x3e01a9[_0xc93c('0x1b')];this[_0xc93c('0x1c')]=_0x3e01a9[_0xc93c('0x1c')];this['servicenowAccounts']=_0x3e01a9['servicenowAccounts'];this['dynamics365Accounts']=_0x3e01a9[_0xc93c('0x1d')];this[_0xc93c('0x1e')]=_0x3e01a9['freshsalesAccounts'];this['accounts']={'zendesk':this[_0xc93c('0x16')],'salesforce':this[_0xc93c('0x18')],'freshdesk':this[_0xc93c('0x17')],'sugarcrm':this[_0xc93c('0x19')],'zoho':this['zohoAccounts'],'desk':this[_0xc93c('0x1b')],'vtiger':this[_0xc93c('0x1c')],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0xc93c('0x1e')],'servicenow':this[_0xc93c('0x1f')]};ami['on'](_0xc93c('0x20'),this[_0xc93c('0x21')]['bind'](this));ami['on'](_0xc93c('0x22'),this[_0xc93c('0x21')][_0xc93c('0x23')](this));ami['on'](_0xc93c('0x24'),this['syncCustomEvent'][_0xc93c('0x23')](this));ami['on'](_0xc93c('0x25'),this[_0xc93c('0x21')][_0xc93c('0x23')](this));ami['on'](_0xc93c('0x26'),this[_0xc93c('0x21')][_0xc93c('0x23')](this));ami['on'](_0xc93c('0x27'),this[_0xc93c('0x21')][_0xc93c('0x23')](this));ami['on'](_0xc93c('0x28'),this[_0xc93c('0x21')][_0xc93c('0x23')](this));ami['on'](_0xc93c('0x29'),this[_0xc93c('0x21')][_0xc93c('0x23')](this));ami['on']('custom:timeout',this[_0xc93c('0x21')]['bind'](this));ami['on']('custom:dialbegin',this[_0xc93c('0x2a')][_0xc93c('0x23')](this));ami['on'](_0xc93c('0x2b'),this[_0xc93c('0x2a')][_0xc93c('0x23')](this));ami['on'](_0xc93c('0x2c'),this[_0xc93c('0x2a')]['bind'](this));ami['on'](_0xc93c('0x2d'),this[_0xc93c('0x21')][_0xc93c('0x23')](this));ami['on'](_0xc93c('0x2e'),this[_0xc93c('0x21')][_0xc93c('0x23')](this));ami['on'](_0xc93c('0x2f'),this[_0xc93c('0x21')][_0xc93c('0x23')](this));ami['on'](_0xc93c('0x30'),this[_0xc93c('0x21')][_0xc93c('0x23')](this));ami['on']('custom:acceptmessage',this[_0xc93c('0x21')][_0xc93c('0x23')](this));ami['on'](_0xc93c('0x31'),this[_0xc93c('0x21')]['bind'](this));}Trigger[_0xc93c('0x32')][_0xc93c('0x33')]=function(_0xc2e021,_0x3cfef9,_0x4c7d5e){logger[_0xc93c('0x34')](_0xc2e021,_0x3cfef9,JSON[_0xc93c('0x35')](_0x4c7d5e));io['to'](_0xc2e021)[_0xc93c('0x33')](_0x3cfef9,_0x4c7d5e);};Trigger['prototype']['syncCustomEvent']=function(_0x5b4f23){var _0x43f554=_[_0xc93c('0x36')](_0x5b4f23);this['checkTriggers'](_0x43f554);};Trigger[_0xc93c('0x32')]['syncCustomEventNew']=function(_0x81ee){console[_0xc93c('0x37')](_0xc93c('0x38'),_0x81ee);var _0x581ffc=_[_0xc93c('0x36')](_0x81ee);this[_0xc93c('0x39')](_0x581ffc);};Trigger[_0xc93c('0x32')][_0xc93c('0x2a')]=function(_0x28d318){if(this[_0xc93c('0x12')][_0x28d318[_0xc93c('0x3a')]]){this['syncCustomEvent'](_0x28d318);}};Trigger[_0xc93c('0x32')][_0xc93c('0x39')]=function(_0x3aeb8c){var _0x350b2b;for(var _0x4be143 in this[_0xc93c('0x11')]){if(this['triggers'][_0xc93c('0x3b')](_0x4be143)){if(this[_0xc93c('0x11')][_0x4be143]['status']){_0x350b2b=this[_0xc93c('0x3c')](this[_0xc93c('0x11')][_0x4be143],_0x3aeb8c);if(_0x350b2b){_[_0xc93c('0x3d')](_0x3aeb8c,_0x3aeb8c['variables']);for(var _0x5393ab=0x0,_0x234865,_0x3a0351,_0x3f8721;_0x5393ab0x0){_0x34dc65=_[_0x0a9e('0x26')](_0x5bfb33,_0x1dc186);}return _0x34dc65;}function getCustomFields(_0x140511,_0x1538a4){var _0x11c3b6=[];var _0x14de77={'custom_fields':{}};if(_0x140511['length']>0x0){_[_0x0a9e('0x27')](_0x140511,function(_0x468813){if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813['nameField']&&!_0x468813[_0x0a9e('0x2a')]){_0x14de77[_0x468813[_0x0a9e('0x2b')][_0x0a9e('0x2c')]()]=_0x468813[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813[_0x0a9e('0x2f')]&&_0x468813[_0x0a9e('0x2a')]){_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x468813['content'][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x30')&&_0x468813[_0x0a9e('0x31')]&&_0x468813[_0x0a9e('0x2f')]&&_0x468813['customField']){_0x1538a4[_0x468813[_0x0a9e('0x31')]]&&(_0x14de77[_0x0a9e('0x32')][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x31')]][_0x0a9e('0x2e')]());}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x33')&&_0x468813[_0x0a9e('0x34')]&&_0x468813['Variable'][_0x0a9e('0x35')]&&_0x468813['idField']&&_0x468813[_0x0a9e('0x2a')]){_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]&&(_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]['toString']());}});}if(_0x14de77['priority']){_0x14de77[_0x0a9e('0x36')]=Number(_0x14de77['priority']);}return _0x14de77;}function getTicket(_0x24936a,_0x3d9717,_0x381c37,_0x1ef87a,_0x4f41ae){logger[_0x0a9e('0xb')](_0x0a9e('0x37'));var _0x3cae=_['merge']({'subject':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x39')],_0x4f41ae,'\x20'),'type':_0x0a9e('0x3a'),'status':'new','labels':['xCALLY',_0x0a9e('0x3b'),_0x0a9e('0x3c')]['concat'](getTags(_0x1ef87a[_0x0a9e('0x3d')],_0x0a9e('0x35'))),'description':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x3e')],_0x4f41ae,'\x0a'),'_links':{'assigned_user':{'href':util['format']('/api/v2/users/%d',_0x3d9717['id']),'class':_0x0a9e('0x3f')}},'message':{'direction':'in','body':intUtil[_0x0a9e('0x38')](_0x1ef87a['Descriptions'],_0x4f41ae,'\x0a')}},getCustomFields(_0x1ef87a[_0x0a9e('0x40')],_0x4f41ae));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x41'),_0x24936a['remoteUri'],_0x381c37['id']),'method':_0x0a9e('0x42'),'body':_0x3cae});}exports[_0x0a9e('0x43')]=function(_0x274e8e,_0x43dd5b,_0x13cb1f,_0xeaa5e5,_0x2881b3,_0x45a9b8){var _0x23b089,_0x3da2cd;_0x45a9b8[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x45a9b8[_0x0a9e('0x16')]);_0x45a9b8[_0x0a9e('0x45')]=intUtil[_0x0a9e('0x44')](_0x45a9b8['serverUrl']);if(_0x2881b3&&_0x2881b3['monitor_format']){logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x47'));_0x43dd5b[_0x0a9e('0x48')]=util[_0x0a9e('0xd')](_0x0a9e('0x49'),_0x45a9b8[_0x0a9e('0x45')],_0x43dd5b[_0x0a9e('0x4a')],md5(_0x43dd5b[_0x0a9e('0x4a')]));}else{_0x43dd5b[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x45a9b8);return getUser(_0x45a9b8,_0xeaa5e5[_0x0a9e('0x4c')])['then'](function(_0x117c99){_0x23b089=_0x117c99;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x23b089['id']);return getEndUser(_0x45a9b8,_0x43dd5b[_0x0a9e('0x4e')],_0x43dd5b[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x21eb86){_0x3da2cd=_0x21eb86;logger[_0x0a9e('0xb')]('The\x20Enduser\x20ID\x20is:',_0x3da2cd['id']);return getTicket(_0x45a9b8,_0x23b089,_0x3da2cd,_0x13cb1f,_0x43dd5b);})[_0x0a9e('0x12')](function(_0x48fd45){if(_0x48fd45){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')]('The\x20Ticket\x20ID\x20is:',_0x48fd45['id']);switch(_0x45a9b8[_0x0a9e('0x28')]){case _0x0a9e('0x51'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5['name']),_0x0a9e('0x54'),{'recordId':_0x48fd45['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x56'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5[_0x0a9e('0x35')]),_0x0a9e('0x57'),{'uri':util['format'](_0x0a9e('0x58'),_0x48fd45['id'])});break;default:logger[_0x0a9e('0x59')]('[QUEUE]','Desk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x1adfee){console[_0x0a9e('0x59')](_0x1adfee);logger[_0x0a9e('0x59')](_0x0a9e('0x46'),JSON[_0x0a9e('0x19')](_0x1adfee));});};exports[_0x0a9e('0x5a')]=function(_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){var _0x14d602,_0x5bb3ed;_0x39d77d[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x39d77d['remoteUri']);_0x39d77d['serverUrl']=intUtil[_0x0a9e('0x44')](_0x39d77d['serverUrl']);if(_0x204173&&_0x204173[_0x0a9e('0x5b')]&&_0x204173['recordingFormat']!==_0x0a9e('0x5c')){logger[_0x0a9e('0xb')](_0x0a9e('0x5d'),'Recording\x20is\x20enabled!');_0x375c18[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39d77d['serverUrl'],_0x375c18[_0x0a9e('0x4a')],md5(_0x375c18[_0x0a9e('0x4a')]));}headers['Authorization']=getAuth(_0x39d77d);return getUser(_0x39d77d,_0x4b1b9f[_0x0a9e('0x4c')])['then'](function(_0x211ef9){_0x14d602=_0x211ef9;logger['info'](_0x0a9e('0x4d'),_0x14d602['id']);return getEndUser(_0x39d77d,_0x375c18['destcalleridname'],_0x375c18['destcalleridnum']);})['then'](function(_0x2da03c){_0x5bb3ed=_0x2da03c;logger['info'](_0x0a9e('0x5e'),_0x5bb3ed['id']);return getTicket(_0x39d77d,_0x14d602,_0x5bb3ed,_0x5d38ae,_0x375c18);})[_0x0a9e('0x12')](function(_0x3cfd00){if(_0x3cfd00){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x3cfd00['id']);switch(_0x39d77d[_0x0a9e('0x28')]){case'integrationTab':logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0x4b1b9f[_0x0a9e('0x35')]),'trigger:desk:display',{'recordId':_0x3cfd00['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')]('[QUEUE]',_0x0a9e('0x56'));emit(util['format'](_0x0a9e('0x53'),_0x4b1b9f['name']),'trigger:browser:url',{'uri':util['format'](_0x0a9e('0x60'),_0x39d77d['remoteUri'],_0x3cfd00['id'])});break;default:logger[_0x0a9e('0x59')](_0x0a9e('0x5d'),_0x0a9e('0x61'));}}})[_0x0a9e('0x62')](function(_0x1cca9f){logger[_0x0a9e('0x59')]('[OUTBOUND]',JSON[_0x0a9e('0x19')](_0x1cca9f));});};exports['unmanaged']=function(_0xca4ade,_0x1f07cb,_0x51aaf7,_0x5adf8f,_0x453360,_0x156f1c){var _0x119677,_0x32e134;_0x156f1c['remoteUri']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x16')]);_0x156f1c['serverUrl']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x45')]);if(_0x453360&&_0x453360[_0x0a9e('0x63')]){logger[_0x0a9e('0xb')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',_0x0a9e('0x47'));_0x1f07cb[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x156f1c[_0x0a9e('0x45')],_0x1f07cb['uniqueid'],md5(_0x1f07cb['uniqueid']));}else{_0x1f07cb[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x156f1c);return getUser(_0x156f1c)[_0x0a9e('0x12')](function(_0x19c995){_0x119677=_0x19c995;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x119677['id']);return getEndUser(_0x156f1c,_0x1f07cb[_0x0a9e('0x4e')],_0x1f07cb[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x1cc4f3){_0x32e134=_0x1cc4f3;logger[_0x0a9e('0xb')](_0x0a9e('0x5e'),_0x32e134['id']);return getTicket(_0x156f1c,_0x119677,_0x32e134,_0x51aaf7,_0x1f07cb);})[_0x0a9e('0x12')](function(_0x2b8192){if(_0x2b8192){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x2b8192['id']);}})['catch'](function(_0x1b0b98){logger[_0x0a9e('0x59')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',JSON[_0x0a9e('0x19')](_0x1b0b98));});}; \ No newline at end of file +var _0xa9e0=['Getting\x20agent\x20with\x20email','format','total_entries','find','_embedded','entries','then','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','stringify','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','%s/customers/search','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','work','length','map','forEach','type','string','customField','nameField','toLowerCase','content','toString','idField','variable','variableName','custom_fields','customVariable','Variable','name','priority','Creating\x20new\x20ticket...','getString','Subjects','phone','Motion','CTI','Tags','Descriptions','user','Fields','%s/customers/%d/cases','POST','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Ticket\x20created!','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','outbound','recordingFormat','none','[OUTBOUND]','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','%s/agent/tickets/%s','Desk\x20account\x20type\x20not\x20recognized','catch','monitor_format','lastevent','lodash','request-promise','md5','./util','../../../../config/logger','desk','redis','defaults','socket.io-emitter','emit','validateEmail','info'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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 23f61ab..f6c653d 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 _0x1521=['content','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','phonecall','phonecalls','callDirection','queue','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','bluebird','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','socket.io-emitter','POST','clientId','remoteUri','username','password','clientSecret','then','access_token','catch','error','toUpperCase','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','email','userEmail','length','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','systemuserid','userId','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','destcalleridnum','calleridnum','/systemusers(','4.0','headers','odata-entityid','substring','lastIndexOf','enduserId','GET','contacts?$select=telephone1','toLowerCase','outbound','telephone1',']\x20Enduser\x20created!','string','nameField','customField','idField','indexOf'];(function(_0x2e7a43,_0x3b3df4){var _0x52e9e1=function(_0x2c08cf){while(--_0x2c08cf){_0x2e7a43['push'](_0x2e7a43['shift']());}};_0x52e9e1(++_0x3b3df4);}(_0x1521,0x19d));var _0x1152=function(_0x51674a,_0x77ccff){_0x51674a=_0x51674a-0x0;var _0x13fca6=_0x1521[_0x51674a];return _0x13fca6;};'use strict';var _=require(_0x1152('0x0'));var BPromise=require(_0x1152('0x1'));var rp=require('request-promise');var util=require(_0x1152('0x2'));var intUtil=require(_0x1152('0x3'));var md5=require(_0x1152('0x4'));var Redis=require(_0x1152('0x5'));var logger=require(_0x1152('0x6'))(_0x1152('0x7'));var config=require(_0x1152('0x8'));config[_0x1152('0x9')]=_[_0x1152('0xa')](config[_0x1152('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x1152('0xb'))(new Redis(config[_0x1152('0x9')]));function getAuthToken(_0x340eae,_0x23a150,_0x25e0de){var _0x446b6b={'method':_0x1152('0xc'),'uri':_0x23a150,'form':{'client_id':_0x340eae[_0x1152('0xd')],'resource':_0x340eae[_0x1152('0xe')],'username':_0x340eae[_0x1152('0xf')],'password':_0x340eae[_0x1152('0x10')],'grant_type':_0x1152('0x10'),'client_secret':_0x340eae[_0x1152('0x11')]},'json':!![]};return rp(_0x446b6b)[_0x1152('0x12')](function(_0x1b193c){return _0x1b193c[_0x1152('0x13')];})[_0x1152('0x14')](function(_0x449070){logger[_0x1152('0x15')]('['+[_0x25e0de[_0x1152('0x16')]()]+']\x20Wrong\x20credentials!');return _0x449070[_0x1152('0x17')];});}function getUser(_0x47853f,_0x8bea0b,_0x2e2e7a,_0x56b5f8,_0x564438,_0x3c992d){return new BPromise(function(_0x1a653b,_0x34573e){return getAuthToken(_0x8bea0b,_0x56b5f8,_0x3c992d)[_0x1152('0x12')](function(_0x29d963){var _0x2468ae={'method':'GET','uri':_0x564438+_0x1152('0x18'),'headers':{'Authorization':_0x1152('0x19')+_0x29d963,'OData-Version':'4.0'},'json':!![]};return rp(_0x2468ae);})[_0x1152('0x12')](function(_0x1947f9){var _0x5977ae=_0x1947f9[_0x1152('0x1a')];var _0x6a305c=![];var _0x4eb8ac=null;if(!_['isNil'](_0x2e2e7a)){if(intUtil['validateEmail'](_0x2e2e7a[_0x1152('0x1b')])){_0x47853f[_0x1152('0x1c')]=_0x2e2e7a[_0x1152('0x1b')];for(_0x4eb8ac=0x0;_0x4eb8ac<_0x5977ae[_0x1152('0x1d')];_0x4eb8ac++){if(_0x5977ae[_0x4eb8ac][_0x1152('0x1e')]===_0x2e2e7a['email']&&!_0x5977ae[_0x4eb8ac][_0x1152('0x1f')]){_0x6a305c=!![];logger['info']('['+[_0x3c992d['toUpperCase']()]+_0x1152('0x20')+_0x5977ae[_0x4eb8ac][_0x1152('0x21')]+'!');_0x47853f[_0x1152('0x22')]=_0x5977ae[_0x4eb8ac][_0x1152('0x21')];}}}}if(!_0x6a305c){logger[_0x1152('0x23')]('['+[_0x3c992d[_0x1152('0x16')]()]+_0x1152('0x24'));_0x47853f[_0x1152('0x1c')]=_0x8bea0b['username'];for(_0x4eb8ac=0x0;_0x4eb8ac<_0x5977ae[_0x1152('0x1d')];_0x4eb8ac++){if(_0x5977ae[_0x4eb8ac][_0x1152('0x1e')]===_0x8bea0b[_0x1152('0xf')]){_0x47853f[_0x1152('0x22')]=_0x5977ae[_0x4eb8ac][_0x1152('0x21')];}}}_0x1a653b(_0x47853f);})[_0x1152('0x14')](function(_0x45c7cb){_0x34573e(_0x45c7cb[_0x1152('0x17')]);});});}function createEndUser(_0x48e542,_0x23d635,_0x27be86,_0x24ec50,_0x39ca60,_0x5cf272){return new BPromise(function(_0x4f230d,_0x240c7b){return getAuthToken(_0x23d635,_0x27be86,_0x5cf272)[_0x1152('0x12')](function(_0x27e87d){var _0x43e81b=_0x5cf272['toLowerCase']()==='outbound'?_0x39ca60[_0x1152('0x25')]:_0x39ca60[_0x1152('0x26')];var _0x3aead2={'method':_0x1152('0xc'),'uri':_0x24ec50+'contacts','body':{'telephone1':_0x43e81b,'fullname':_0x43e81b,'firstname':_0x43e81b,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x1152('0x27')+_0x48e542[_0x1152('0x22')]+')'},'headers':{'Authorization':_0x1152('0x19')+_0x27e87d,'OData-Version':_0x1152('0x28')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x3aead2);})[_0x1152('0x12')](function(_0xa5bec7){var _0x311600=_0xa5bec7[_0x1152('0x29')][_0x1152('0x2a')];var _0x4aa61f=_0x311600[_0x1152('0x2b')](_0x311600[_0x1152('0x2c')]('(')+0x1,_0x311600[_0x1152('0x2c')](')'));_0x48e542[_0x1152('0x2d')]=_0x4aa61f;_0x4f230d(_0x48e542);})[_0x1152('0x14')](function(_0x36a7ca){_0x240c7b(_0x36a7ca[_0x1152('0x17')]);});});}function getEndUser(_0x3040b9,_0x3ce4ef,_0x53b684,_0x44a4ec,_0x37427c,_0x442466){return new BPromise(function(_0x3b2b9c,_0x5f2330){return getAuthToken(_0x3ce4ef,_0x53b684,_0x442466)[_0x1152('0x12')](function(_0x59ccb7){var _0x1566f8={'method':_0x1152('0x2e'),'uri':_0x44a4ec+_0x1152('0x2f'),'headers':{'Authorization':_0x1152('0x19')+_0x59ccb7,'If-None-Match':null,'OData-Version':_0x1152('0x28')},'json':!![]};return rp(_0x1566f8);})['then'](function(_0x1cf070){var _0xdea7ef=null;if(_0x1cf070){var _0x43c7e9=_0x1cf070['value'];var _0x32f5d2=![];for(_0xdea7ef=0x0;_0xdea7ef<_0x43c7e9[_0x1152('0x1d')];_0xdea7ef++){var _0x160744=_0x442466[_0x1152('0x30')]()===_0x1152('0x31')?_0x37427c[_0x1152('0x25')]:_0x37427c['calleridnum'];if(_0x43c7e9[_0xdea7ef][_0x1152('0x32')]===_0x160744){_0x32f5d2=!![];_0x3040b9[_0x1152('0x2d')]=_0x43c7e9[_0xdea7ef]['contactid'];}}if(_0x32f5d2){_0x3b2b9c(_0x3040b9);}else{return createEndUser(_0x3040b9,_0x3ce4ef,_0x53b684,_0x44a4ec,_0x37427c,_0x442466)[_0x1152('0x12')](function(_0x18ad66){logger[_0x1152('0x23')]('['+[_0x442466['toUpperCase']()]+_0x1152('0x33'),_0x18ad66[_0x1152('0x2d')]);_0x3b2b9c(_0x18ad66);});}}else{return createEndUser(_0x3040b9,_0x3ce4ef,_0x53b684,_0x44a4ec,_0x37427c,_0x442466)['then'](function(_0x54bdfc){logger[_0x1152('0x23')]('['+[_0x442466[_0x1152('0x16')]()]+']\x20Enduser\x20Created!',_0x54bdfc[_0x1152('0x2d')]);_0x3b2b9c(_0x54bdfc);});}});});}function getCustomFields(_0x3c4908,_0x36fb6e,_0x81f75d){var _0x15ff2d={};if(_0x3c4908[_0x1152('0x1d')]>0x0){_['forEach'](_0x3c4908,function(_0x140bf0){if(_0x140bf0['type']===_0x1152('0x34')&&_0x140bf0[_0x1152('0x35')]&&!_0x140bf0[_0x1152('0x36')]){var _0x1588d9=_0x140bf0[_0x1152('0x37')][_0x1152('0x30')]();var _0x5d4260=_0x1588d9[_0x1152('0x2b')](0x0,_0x1588d9['indexOf']('_'));var _0x59e5a9=_0x1588d9[_0x1152('0x2b')](_0x1588d9[_0x1152('0x38')]('_')+0x1);if(_0x5d4260===_0x81f75d){_0x15ff2d[_0x59e5a9]=_0x140bf0[_0x1152('0x39')];}}});}return _0x15ff2d;}function getTicket(_0x3e6687,_0x155b2c,_0x4b1c8e,_0x490a1f,_0x4edcd6,_0x30c2de,_0x1d1c44){return new BPromise(function(_0x212276,_0x295562){var _0x102dbf;return getAuthToken(_0x155b2c,_0x4b1c8e,_0x1d1c44)[_0x1152('0x12')](function(_0x433298){if(_0x30c2de[_0x1152('0x3a')]===_0x1152('0x3b')){_0x102dbf={'method':_0x1152('0xc'),'uri':_0x490a1f+_0x1152('0x3c'),'body':Object[_0x1152('0x3d')]({},{'title':intUtil[_0x1152('0x3e')](_0x30c2de[_0x1152('0x3f')],_0x4edcd6,'\x20'),'description':intUtil['getString'](_0x30c2de[_0x1152('0x40')],_0x4edcd6,'\x0a'),'customerid_contact@odata.bind':_0x1152('0x41')+_0x3e6687['enduserId']+')','ownerid@odata.bind':_0x1152('0x27')+_0x3e6687['userId']+')','caseorigincode':'1'},getCustomFields(_0x30c2de[_0x1152('0x42')],_0x4edcd6,_0x30c2de['ticketType'])),'headers':{'Authorization':_0x1152('0x19')+_0x433298,'OData-Version':_0x1152('0x28')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x30c2de[_0x1152('0x3a')]===_0x1152('0x43')){_0x102dbf={'method':'POST','uri':_0x490a1f+_0x1152('0x44'),'body':Object[_0x1152('0x3d')]({},{'subject':intUtil[_0x1152('0x3e')](_0x30c2de['Subjects'],_0x4edcd6,'\x20'),'phonenumber':String(_0x4edcd6[_0x1152('0x26')]),'description':intUtil['getString'](_0x30c2de['Descriptions'],_0x4edcd6,'\x0a'),'regardingobjectid_contact@odata.bind':_0x1152('0x41')+_0x3e6687['enduserId']+')','ownerid@odata.bind':'/systemusers('+_0x3e6687[_0x1152('0x22')]+')','directioncode':_0x3e6687[_0x1152('0x45')]===_0x1152('0x46')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0x3e6687[_0x1152('0x22')]+')','participationtypemask':_0x3e6687[_0x1152('0x45')]===_0x1152('0x46')?0x2:0x1},{'partyid_contact@odata.bind':_0x1152('0x41')+_0x3e6687[_0x1152('0x2d')]+')','participationtypemask':_0x3e6687[_0x1152('0x45')]===_0x1152('0x46')?0x1:0x2}]},getCustomFields(_0x30c2de[_0x1152('0x42')],_0x4edcd6,_0x30c2de[_0x1152('0x3a')])),'headers':{'Authorization':'Bearer\x20'+_0x433298,'OData-Version':_0x1152('0x28')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x102dbf);})[_0x1152('0x12')](function(_0x1caad5){var _0x47ef79=_0x1caad5[_0x1152('0x29')][_0x1152('0x2a')];var _0x2c9614=_0x47ef79[_0x1152('0x2b')](_0x47ef79[_0x1152('0x2c')]('(')+0x1,_0x47ef79[_0x1152('0x2c')](')'));_0x3e6687['ticketId']=_0x2c9614;_0x212276(_0x3e6687);})[_0x1152('0x14')](function(_0x377213){_0x295562(_0x377213['message']);});});}function emit(_0x478602,_0x280c4a,_0x43e732,_0x286a7a){var _0x2e6a36={'uri':util[_0x1152('0x47')](_0x1152('0x48'),_0x478602,_0x43e732,_0x286a7a)};io['to'](util[_0x1152('0x47')]('user:%s',_0x280c4a))[_0x1152('0x49')](_0x1152('0x4a'),_0x2e6a36);}exports['cs']=function(_0x3445ac,_0x414a3d,_0x4446f3,_0x130f61,_0x2d24ca,_0x1c7bed,_0x15156e,_0x2f294c){var _0x2b64cd={};_0x1c7bed[_0x1152('0xe')]=intUtil[_0x1152('0x4b')](_0x1c7bed[_0x1152('0xe')]);_0x1c7bed[_0x1152('0x4c')]=intUtil['stripTrailingSlash'](_0x1c7bed[_0x1152('0x4c')]);_0x2b64cd[_0x1152('0x45')]=_0x2f294c===_0x1152('0x46')||_0x2f294c===_0x1152('0x4d')?'queue':_0x1152('0x31');var _0x3f6a55=util['format']('%s/api/data/v9.0/',_0x1c7bed['remoteUri']);var _0x4f3293=util[_0x1152('0x47')](_0x1152('0x4e'),_0x1c7bed[_0x1152('0x4f')]);var _0x4c2f78=util[_0x1152('0x47')](_0x1152('0x50'),_0x1c7bed[_0x1152('0x4c')],_0x414a3d[_0x1152('0x51')],md5(_0x414a3d['uniqueid']));if(_0x2d24ca&&_0x2d24ca[_0x1152('0x52')]){logger[_0x1152('0x23')](_0x1152('0x53'),_0x1152('0x54'));_0x414a3d[_0x1152('0x55')]=_0x4c2f78;}else if(_0x15156e&&_0x15156e['recordingFormat']&&_0x15156e['recordingFormat']!=='none'){logger[_0x1152('0x23')](_0x1152('0x56'),_0x1152('0x54'));_0x414a3d[_0x1152('0x55')]=_0x4c2f78;}else{_0x414a3d[_0x1152('0x55')]='';}return getUser(_0x2b64cd,_0x1c7bed,_0x130f61,_0x4f3293,_0x3f6a55,_0x2f294c)[_0x1152('0x12')](function(_0x3cede4){logger[_0x1152('0x23')]('['+_0x2f294c['toUpperCase']()+_0x1152('0x57'),_0x3cede4['userId']);logger[_0x1152('0x23')]('['+_0x2f294c[_0x1152('0x16')]()+']\x20The\x20User\x20email\x20is:',_0x3cede4[_0x1152('0x1c')]);return getEndUser(_0x3cede4,_0x1c7bed,_0x4f3293,_0x3f6a55,_0x414a3d,_0x2f294c);})[_0x1152('0x12')](function(_0x2ded3d){logger['info']('['+_0x2f294c['toUpperCase']()+']\x20The\x20Enduser\x20ID\x20is:',_0x2ded3d[_0x1152('0x2d')]);logger[_0x1152('0x23')]('['+_0x2f294c[_0x1152('0x16')]()+_0x1152('0x58'),_0x414a3d[_0x1152('0x26')]);return getTicket(_0x2ded3d,_0x1c7bed,_0x4f3293,_0x3f6a55,_0x414a3d,_0x4446f3,_0x2f294c);})['then'](function(_0x4af4e1){logger['info'](util[_0x1152('0x47')]('['+_0x2f294c['toUpperCase']()+_0x1152('0x59'),_0x4446f3[_0x1152('0x3a')],_0x4af4e1[_0x1152('0x5a')]));logger['info'](util[_0x1152('0x47')]('['+_0x2f294c[_0x1152('0x16')]()+']\x20Call\x20direction:\x20%s',_0x2f294c));if(_0x2f294c!==_0x1152('0x4d')){logger['info']('['+_0x2f294c['toUpperCase']()+']',_0x1152('0x5b'));emit(_0x1c7bed['remoteUri'],_0x130f61[_0x1152('0x5c')],_0x4446f3[_0x1152('0x3a')],_0x4af4e1[_0x1152('0x5a')]);}})['catch'](function(_0x46b7f6){logger[_0x1152('0x15')]('['+_0x2f294c['toUpperCase']()+_0x1152('0x5d'),util['inspect'](_0x46b7f6,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xb485=['queue','headers','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','monitor_format','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','bluebird','request-promise','util','md5','../../../../config/logger','dynamics365','../../../../config/environment','defaults','redis','localhost','POST','remoteUri','username','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','isNil','validateEmail','userEmail','email','length','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','userId','systemuserid','info','destcalleridnum','/systemusers(','odata-entityid','substring','lastIndexOf','enduserId','4.0','toLowerCase','outbound','calleridnum','telephone1','contactid',']\x20Enduser\x20created!','forEach','type','nameField','idField','indexOf','ticketType','incident','incidents','assign','Subjects','getString','/contacts(','Fields','phonecall','phonecalls','callDirection'];(function(_0x10dc60,_0x2fcce1){var _0x47dec5=function(_0x24b5e4){while(--_0x24b5e4){_0x10dc60['push'](_0x10dc60['shift']());}};_0x47dec5(++_0x2fcce1);}(_0xb485,0x194));var _0x5b48=function(_0xfb56ff,_0xe8be82){_0xfb56ff=_0xfb56ff-0x0;var _0x5079ac=_0xb485[_0xfb56ff];return _0x5079ac;};'use strict';var _=require('lodash');var BPromise=require(_0x5b48('0x0'));var rp=require(_0x5b48('0x1'));var util=require(_0x5b48('0x2'));var intUtil=require('./util');var md5=require(_0x5b48('0x3'));var Redis=require('ioredis');var logger=require(_0x5b48('0x4'))(_0x5b48('0x5'));var config=require(_0x5b48('0x6'));config['redis']=_[_0x5b48('0x7')](config[_0x5b48('0x8')],{'host':_0x5b48('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5b48('0x8')]));function getAuthToken(_0x4d7faf,_0xf1fab4,_0x4b0d1b){var _0x20db65={'method':_0x5b48('0xa'),'uri':_0xf1fab4,'form':{'client_id':_0x4d7faf['clientId'],'resource':_0x4d7faf[_0x5b48('0xb')],'username':_0x4d7faf[_0x5b48('0xc')],'password':_0x4d7faf[_0x5b48('0xd')],'grant_type':_0x5b48('0xd'),'client_secret':_0x4d7faf[_0x5b48('0xe')]},'json':!![]};return rp(_0x20db65)[_0x5b48('0xf')](function(_0x53e146){return _0x53e146[_0x5b48('0x10')];})[_0x5b48('0x11')](function(_0x2b2065){logger[_0x5b48('0x12')]('['+[_0x4b0d1b[_0x5b48('0x13')]()]+_0x5b48('0x14'));return _0x2b2065[_0x5b48('0x15')];});}function getUser(_0x2c98b7,_0xf6a1e3,_0x1e5df6,_0x29ffeb,_0x2aa7e9,_0x3706ee){return new BPromise(function(_0x50dea2,_0x1279d5){return getAuthToken(_0xf6a1e3,_0x29ffeb,_0x3706ee)[_0x5b48('0xf')](function(_0x5d855a){var _0x557886={'method':_0x5b48('0x16'),'uri':_0x2aa7e9+_0x5b48('0x17'),'headers':{'Authorization':_0x5b48('0x18')+_0x5d855a,'OData-Version':'4.0'},'json':!![]};return rp(_0x557886);})['then'](function(_0xdb2e8d){var _0x12a3a8=_0xdb2e8d[_0x5b48('0x19')];var _0x4bc08e=![];var _0x3c6afd=null;if(!_[_0x5b48('0x1a')](_0x1e5df6)){if(intUtil[_0x5b48('0x1b')](_0x1e5df6['email'])){_0x2c98b7[_0x5b48('0x1c')]=_0x1e5df6[_0x5b48('0x1d')];for(_0x3c6afd=0x0;_0x3c6afd<_0x12a3a8[_0x5b48('0x1e')];_0x3c6afd++){if(_0x12a3a8[_0x3c6afd][_0x5b48('0x1f')]===_0x1e5df6[_0x5b48('0x1d')]&&!_0x12a3a8[_0x3c6afd][_0x5b48('0x20')]){_0x4bc08e=!![];logger['info']('['+[_0x3706ee['toUpperCase']()]+_0x5b48('0x21')+_0x12a3a8[_0x3c6afd]['systemuserid']+'!');_0x2c98b7[_0x5b48('0x22')]=_0x12a3a8[_0x3c6afd][_0x5b48('0x23')];}}}}if(!_0x4bc08e){logger[_0x5b48('0x24')]('['+[_0x3706ee[_0x5b48('0x13')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x2c98b7[_0x5b48('0x1c')]=_0xf6a1e3[_0x5b48('0xc')];for(_0x3c6afd=0x0;_0x3c6afd<_0x12a3a8[_0x5b48('0x1e')];_0x3c6afd++){if(_0x12a3a8[_0x3c6afd][_0x5b48('0x1f')]===_0xf6a1e3[_0x5b48('0xc')]){_0x2c98b7[_0x5b48('0x22')]=_0x12a3a8[_0x3c6afd][_0x5b48('0x23')];}}}_0x50dea2(_0x2c98b7);})[_0x5b48('0x11')](function(_0x147564){_0x1279d5(_0x147564[_0x5b48('0x15')]);});});}function createEndUser(_0x277547,_0x10985f,_0x31e1a7,_0x52f91d,_0x214cf0,_0x3c86f8){return new BPromise(function(_0x179bbd,_0x5a2309){return getAuthToken(_0x10985f,_0x31e1a7,_0x3c86f8)[_0x5b48('0xf')](function(_0x2b2a49){var _0x1450bd=_0x3c86f8['toLowerCase']()==='outbound'?_0x214cf0[_0x5b48('0x25')]:_0x214cf0['calleridnum'];var _0x3efdbf={'method':_0x5b48('0xa'),'uri':_0x52f91d+'contacts','body':{'telephone1':_0x1450bd,'fullname':_0x1450bd,'firstname':_0x1450bd,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x5b48('0x26')+_0x277547['userId']+')'},'headers':{'Authorization':_0x5b48('0x18')+_0x2b2a49,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x3efdbf);})[_0x5b48('0xf')](function(_0x4c8161){var _0x17dbad=_0x4c8161['headers'][_0x5b48('0x27')];var _0x396d8b=_0x17dbad[_0x5b48('0x28')](_0x17dbad[_0x5b48('0x29')]('(')+0x1,_0x17dbad[_0x5b48('0x29')](')'));_0x277547[_0x5b48('0x2a')]=_0x396d8b;_0x179bbd(_0x277547);})[_0x5b48('0x11')](function(_0x1b3fa1){_0x5a2309(_0x1b3fa1[_0x5b48('0x15')]);});});}function getEndUser(_0x5aa741,_0x4f0c44,_0x213391,_0x47a2eb,_0x1036bd,_0x44b61){return new BPromise(function(_0x1901ee,_0x21d1fa){return getAuthToken(_0x4f0c44,_0x213391,_0x44b61)[_0x5b48('0xf')](function(_0x2546b6){var _0x13866b={'method':_0x5b48('0x16'),'uri':_0x47a2eb+'contacts?$select=telephone1','headers':{'Authorization':_0x5b48('0x18')+_0x2546b6,'If-None-Match':null,'OData-Version':_0x5b48('0x2b')},'json':!![]};return rp(_0x13866b);})['then'](function(_0x3fda6e){var _0x3e10c3=null;if(_0x3fda6e){var _0x2577f8=_0x3fda6e['value'];var _0x39ce9e=![];for(_0x3e10c3=0x0;_0x3e10c3<_0x2577f8['length'];_0x3e10c3++){var _0x34feab=_0x44b61[_0x5b48('0x2c')]()===_0x5b48('0x2d')?_0x1036bd['destcalleridnum']:_0x1036bd[_0x5b48('0x2e')];if(_0x2577f8[_0x3e10c3][_0x5b48('0x2f')]===_0x34feab){_0x39ce9e=!![];_0x5aa741['enduserId']=_0x2577f8[_0x3e10c3][_0x5b48('0x30')];}}if(_0x39ce9e){_0x1901ee(_0x5aa741);}else{return createEndUser(_0x5aa741,_0x4f0c44,_0x213391,_0x47a2eb,_0x1036bd,_0x44b61)[_0x5b48('0xf')](function(_0x54b226){logger[_0x5b48('0x24')]('['+[_0x44b61['toUpperCase']()]+_0x5b48('0x31'),_0x54b226['enduserId']);_0x1901ee(_0x54b226);});}}else{return createEndUser(_0x5aa741,_0x4f0c44,_0x213391,_0x47a2eb,_0x1036bd,_0x44b61)['then'](function(_0x2b6901){logger[_0x5b48('0x24')]('['+[_0x44b61[_0x5b48('0x13')]()]+']\x20Enduser\x20Created!',_0x2b6901[_0x5b48('0x2a')]);_0x1901ee(_0x2b6901);});}});});}function getCustomFields(_0x1bbbe5,_0x55c8a4,_0x27eca6){var _0x8c6cb9={};if(_0x1bbbe5[_0x5b48('0x1e')]>0x0){_[_0x5b48('0x32')](_0x1bbbe5,function(_0x4ee15d){if(_0x4ee15d[_0x5b48('0x33')]==='string'&&_0x4ee15d[_0x5b48('0x34')]&&!_0x4ee15d['customField']){var _0x3a3877=_0x4ee15d[_0x5b48('0x35')][_0x5b48('0x2c')]();var _0x471fd7=_0x3a3877['substring'](0x0,_0x3a3877[_0x5b48('0x36')]('_'));var _0x393a18=_0x3a3877[_0x5b48('0x28')](_0x3a3877['indexOf']('_')+0x1);if(_0x471fd7===_0x27eca6){_0x8c6cb9[_0x393a18]=_0x4ee15d['content'];}}});}return _0x8c6cb9;}function getTicket(_0x49a188,_0x211bd7,_0x4f9307,_0x5d9a7b,_0x18e5c3,_0x2dd729,_0x1f5ec6){return new BPromise(function(_0x132e8e,_0x221e0f){var _0x3dccda;return getAuthToken(_0x211bd7,_0x4f9307,_0x1f5ec6)[_0x5b48('0xf')](function(_0x155012){if(_0x2dd729[_0x5b48('0x37')]===_0x5b48('0x38')){_0x3dccda={'method':_0x5b48('0xa'),'uri':_0x5d9a7b+_0x5b48('0x39'),'body':Object[_0x5b48('0x3a')]({},{'title':intUtil['getString'](_0x2dd729[_0x5b48('0x3b')],_0x18e5c3,'\x20'),'description':intUtil[_0x5b48('0x3c')](_0x2dd729['Descriptions'],_0x18e5c3,'\x0a'),'customerid_contact@odata.bind':_0x5b48('0x3d')+_0x49a188[_0x5b48('0x2a')]+')','ownerid@odata.bind':'/systemusers('+_0x49a188[_0x5b48('0x22')]+')','caseorigincode':'1'},getCustomFields(_0x2dd729[_0x5b48('0x3e')],_0x18e5c3,_0x2dd729[_0x5b48('0x37')])),'headers':{'Authorization':'Bearer\x20'+_0x155012,'OData-Version':_0x5b48('0x2b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2dd729[_0x5b48('0x37')]===_0x5b48('0x3f')){_0x3dccda={'method':_0x5b48('0xa'),'uri':_0x5d9a7b+_0x5b48('0x40'),'body':Object['assign']({},{'subject':intUtil[_0x5b48('0x3c')](_0x2dd729[_0x5b48('0x3b')],_0x18e5c3,'\x20'),'phonenumber':String(_0x18e5c3['calleridnum']),'description':intUtil['getString'](_0x2dd729['Descriptions'],_0x18e5c3,'\x0a'),'regardingobjectid_contact@odata.bind':_0x5b48('0x3d')+_0x49a188[_0x5b48('0x2a')]+')','ownerid@odata.bind':_0x5b48('0x26')+_0x49a188[_0x5b48('0x22')]+')','directioncode':_0x49a188[_0x5b48('0x41')]===_0x5b48('0x42')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x5b48('0x26')+_0x49a188[_0x5b48('0x22')]+')','participationtypemask':_0x49a188[_0x5b48('0x41')]===_0x5b48('0x42')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x49a188[_0x5b48('0x2a')]+')','participationtypemask':_0x49a188[_0x5b48('0x41')]===_0x5b48('0x42')?0x1:0x2}]},getCustomFields(_0x2dd729[_0x5b48('0x3e')],_0x18e5c3,_0x2dd729[_0x5b48('0x37')])),'headers':{'Authorization':_0x5b48('0x18')+_0x155012,'OData-Version':_0x5b48('0x2b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x3dccda);})[_0x5b48('0xf')](function(_0x38ff4d){var _0x38cd29=_0x38ff4d[_0x5b48('0x43')][_0x5b48('0x27')];var _0x1cf9a6=_0x38cd29[_0x5b48('0x28')](_0x38cd29['lastIndexOf']('(')+0x1,_0x38cd29[_0x5b48('0x29')](')'));_0x49a188[_0x5b48('0x44')]=_0x1cf9a6;_0x132e8e(_0x49a188);})[_0x5b48('0x11')](function(_0x3132ce){_0x221e0f(_0x3132ce[_0x5b48('0x15')]);});});}function emit(_0xe65536,_0x3995e9,_0x349f5a,_0x3c781a){var _0x260c2e={'uri':util[_0x5b48('0x45')](_0x5b48('0x46'),_0xe65536,_0x349f5a,_0x3c781a)};io['to'](util[_0x5b48('0x45')](_0x5b48('0x47'),_0x3995e9))[_0x5b48('0x48')](_0x5b48('0x49'),_0x260c2e);}exports['cs']=function(_0x3e4ae4,_0x483a19,_0x403729,_0x28e808,_0x20f857,_0x2a02da,_0x8b2b38,_0x5459ce){var _0x220182={};_0x2a02da[_0x5b48('0xb')]=intUtil[_0x5b48('0x4a')](_0x2a02da[_0x5b48('0xb')]);_0x2a02da[_0x5b48('0x4b')]=intUtil['stripTrailingSlash'](_0x2a02da[_0x5b48('0x4b')]);_0x220182['callDirection']=_0x5459ce===_0x5b48('0x42')||_0x5459ce==='unmanaged'?_0x5b48('0x42'):'outbound';var _0x5c0703=util[_0x5b48('0x45')](_0x5b48('0x4c'),_0x2a02da['remoteUri']);var _0x5083c4=util[_0x5b48('0x45')](_0x5b48('0x4d'),_0x2a02da['tenantId']);var _0xeeffd4=util[_0x5b48('0x45')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2a02da[_0x5b48('0x4b')],_0x483a19[_0x5b48('0x4e')],md5(_0x483a19[_0x5b48('0x4e')]));if(_0x20f857&&_0x20f857[_0x5b48('0x4f')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x483a19[_0x5b48('0x50')]=_0xeeffd4;}else if(_0x8b2b38&&_0x8b2b38['recordingFormat']&&_0x8b2b38[_0x5b48('0x51')]!==_0x5b48('0x52')){logger[_0x5b48('0x24')](_0x5b48('0x53'),_0x5b48('0x54'));_0x483a19[_0x5b48('0x50')]=_0xeeffd4;}else{_0x483a19[_0x5b48('0x50')]='';}return getUser(_0x220182,_0x2a02da,_0x28e808,_0x5083c4,_0x5c0703,_0x5459ce)[_0x5b48('0xf')](function(_0x9e3d6e){logger[_0x5b48('0x24')]('['+_0x5459ce[_0x5b48('0x13')]()+_0x5b48('0x55'),_0x9e3d6e[_0x5b48('0x22')]);logger['info']('['+_0x5459ce[_0x5b48('0x13')]()+_0x5b48('0x56'),_0x9e3d6e[_0x5b48('0x1c')]);return getEndUser(_0x9e3d6e,_0x2a02da,_0x5083c4,_0x5c0703,_0x483a19,_0x5459ce);})[_0x5b48('0xf')](function(_0x208437){logger[_0x5b48('0x24')]('['+_0x5459ce[_0x5b48('0x13')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x208437['enduserId']);logger[_0x5b48('0x24')]('['+_0x5459ce[_0x5b48('0x13')]()+_0x5b48('0x57'),_0x483a19['calleridnum']);return getTicket(_0x208437,_0x2a02da,_0x5083c4,_0x5c0703,_0x483a19,_0x403729,_0x5459ce);})[_0x5b48('0xf')](function(_0x34a824){logger['info'](util['format']('['+_0x5459ce[_0x5b48('0x13')]()+_0x5b48('0x58'),_0x403729[_0x5b48('0x37')],_0x34a824[_0x5b48('0x44')]));logger[_0x5b48('0x24')](util[_0x5b48('0x45')]('['+_0x5459ce[_0x5b48('0x13')]()+']\x20Call\x20direction:\x20%s',_0x5459ce));if(_0x5459ce!==_0x5b48('0x59')){logger[_0x5b48('0x24')]('['+_0x5459ce['toUpperCase']()+']',_0x5b48('0x5a'));emit(_0x2a02da['remoteUri'],_0x28e808[_0x5b48('0x5b')],_0x403729[_0x5b48('0x37')],_0x34a824[_0x5b48('0x44')]);}})[_0x5b48('0x11')](function(_0x886a){logger['error']('['+_0x5459ce[_0x5b48('0x13')]()+_0x5b48('0x5c'),util[_0x5b48('0x5d')](_0x886a,{'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 af6bb82..4aa6017 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 _0x762e=['merge','format','calleridnum','Subjects','getString','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','value','remoteUri','Ticket\x20created!','validateEmail','%s/api/v2/agents','then','length','info','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','Enduser\x20found!','POST','Enduser\x20created.','Basic\x20%s','toString','base64','debug','stringify','map','forEach','type','string','nameField','customField','toLowerCase','content','variable','variableName','idField','customVariable','push','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','outbound','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','catch','error','unmanaged','lastevent','toUpperCase','lodash','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...'];(function(_0x18b9bd,_0x43663f){var _0x1a9a03=function(_0xaeaa55){while(--_0xaeaa55){_0x18b9bd['push'](_0x18b9bd['shift']());}};_0x1a9a03(++_0x43663f);}(_0x762e,0x1c7));var _0xe762=function(_0x4a1726,_0x32eab5){_0x4a1726=_0x4a1726-0x0;var _0x45ddd0=_0x762e[_0x4a1726];return _0x45ddd0;};'use strict';var _=require(_0xe762('0x0'));var rp=require('request-promise');var md5=require(_0xe762('0x1'));var util=require(_0xe762('0x2'));var Redis=require(_0xe762('0x3'));var intUtil=require(_0xe762('0x4'));var config=require(_0xe762('0x5'));var logger=require(_0xe762('0x6'))(_0xe762('0x7'));config[_0xe762('0x8')]=_[_0xe762('0x9')](config[_0xe762('0x8')],{'host':_0xe762('0xa'),'port':0x18eb});var io=require(_0xe762('0xb'))(new Redis(config[_0xe762('0x8')]));var headers={'Content-Type':'application/json','Accept':_0xe762('0xc')};function emit(_0x45e221,_0x1dd925,_0x21153d){io['to'](_0x45e221)[_0xe762('0xd')](_0x1dd925,_0x21153d);}function getTicket(_0x2960d2,_0x3ef84a,_0x21e1bb,_0x3fbb7d,_0x350a73){logger['info'](_0xe762('0xe'));var _0x39cdfa=_[_0xe762('0xf')]({'responder_id':_0x3ef84a['id'],'requester_id':_0x21e1bb['id'],'name':util[_0xe762('0x10')]('Caller\x20-\x20%s',_0x350a73['calleridname']),'phone':_0x350a73[_0xe762('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x3fbb7d[_0xe762('0x12')],_0x350a73,'\x20'),'description':intUtil[_0xe762('0x13')](_0x3fbb7d[_0xe762('0x14')],_0x350a73,_0xe762('0x15')),'tags':getTags(_0x3fbb7d[_0xe762('0x16')],_0xe762('0x17'))},getCustomFields(_0x3fbb7d[_0xe762('0x18')],_0x350a73));_0x39cdfa[_0xe762('0x19')]=_[_0xe762('0x1a')](_['keyBy'](_0x39cdfa[_0xe762('0x19')],'id'),_0xe762('0x1b'));return request({'uri':util[_0xe762('0x10')]('%s/api/v2/tickets',_0x2960d2[_0xe762('0x1c')]),'method':'POST','body':_0x39cdfa})['then'](function(_0x31b28d){logger['info'](_0xe762('0x1d'));return _0x31b28d;});}function getUser(_0x701a5b,_0x4fa1ee){if(intUtil[_0xe762('0x1e')](_0x4fa1ee)){return request({'uri':util[_0xe762('0x10')](_0xe762('0x1f'),_0x701a5b[_0xe762('0x1c')]),'qs':{'email':_0x4fa1ee}})[_0xe762('0x20')](function(_0x39b78c){if(_0x39b78c[_0xe762('0x21')]){logger[_0xe762('0x22')](_0xe762('0x23'));return _[_0xe762('0x24')](_0x39b78c,function(_0xeb1078){return _0xeb1078[_0xe762('0x25')][_0xe762('0x26')]===_0x4fa1ee;});}else{logger[_0xe762('0x22')](_0xe762('0x27'));return request({'uri':util[_0xe762('0x10')](_0xe762('0x28'),_0x701a5b[_0xe762('0x1c')])})[_0xe762('0x20')](function(_0x41cf1c){logger[_0xe762('0x22')](_0xe762('0x29'));return _0x41cf1c;});}});}else{logger[_0xe762('0x22')](_0xe762('0x2a'));return request({'uri':util['format'](_0xe762('0x28'),_0x701a5b[_0xe762('0x1c')])})['then'](function(_0x5c641a){logger['info'](_0xe762('0x29'));return _0x5c641a;});}}function getEndUser(_0x4dbfb8,_0x536b66,_0x2572d4){logger[_0xe762('0x22')]('Searching\x20enduser\x20with\x20phone',_0x2572d4);return request({'uri':util[_0xe762('0x10')](_0xe762('0x2b'),_0x4dbfb8[_0xe762('0x1c')]),'qs':{'phone':_0x2572d4}})[_0xe762('0x20')](function(_0x5d8399){if(_0x5d8399[_0xe762('0x21')]){logger[_0xe762('0x22')](_0xe762('0x2c'));return _['find'](_0x5d8399,{'phone':_0x2572d4});}else{logger[_0xe762('0x22')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0xe762('0x2b'),_0x4dbfb8[_0xe762('0x1c')]),'method':_0xe762('0x2d'),'body':{'name':_0x536b66,'phone':_0x2572d4}})['then'](function(_0x54482b){logger[_0xe762('0x22')](_0xe762('0x2e'));return _0x54482b;});}});}function getAuth(_0x2acb0e){return util['format'](_0xe762('0x2f'),new Buffer(_0x2acb0e['apiKey']+':X')[_0xe762('0x30')](_0xe762('0x31')));}function request(_0x55605c){logger[_0xe762('0x32')]('[HTTP]',JSON[_0xe762('0x33')](_0x55605c));return rp(_['defaults'](_0x55605c,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x352ccd,_0x2e77e2){var _0x4a7c73=[];if(_0x352ccd&&_0x352ccd[_0xe762('0x21')]>0x0){_0x4a7c73=_[_0xe762('0x34')](_0x352ccd,_0x2e77e2);}return _0x4a7c73;}function getCustomFields(_0x4815cf,_0x3d8416){var _0x1ef58=[];var _0x58c9b4={'custom_fields':[]};if(_0x4815cf['length']>0x0){_[_0xe762('0x35')](_0x4815cf,function(_0x2f7c50){if(_0x2f7c50[_0xe762('0x36')]===_0xe762('0x37')&&_0x2f7c50[_0xe762('0x38')]&&!_0x2f7c50[_0xe762('0x39')]){_0x58c9b4[_0x2f7c50[_0xe762('0x38')][_0xe762('0x3a')]()]=_0x2f7c50[_0xe762('0x3b')][_0xe762('0x30')]();}else if(_0x2f7c50[_0xe762('0x36')]===_0xe762('0x37')&&_0x2f7c50['idField']&&_0x2f7c50[_0xe762('0x39')]){_0x58c9b4['custom_fields']['push']({'id':_0x2f7c50['idField'],'value':_0x2f7c50[_0xe762('0x3b')][_0xe762('0x30')]()});}else if(_0x2f7c50[_0xe762('0x36')]===_0xe762('0x3c')&&_0x2f7c50[_0xe762('0x3d')]&&_0x2f7c50[_0xe762('0x3e')]&&_0x2f7c50[_0xe762('0x39')]){_0x3d8416[_0x2f7c50[_0xe762('0x3d')]]&&_0x58c9b4[_0xe762('0x19')]['push']({'id':_0x2f7c50[_0xe762('0x3e')],'value':_0x3d8416[_0x2f7c50[_0xe762('0x3d')]][_0xe762('0x30')]()});}else if(_0x2f7c50[_0xe762('0x36')]===_0xe762('0x3f')&&_0x2f7c50['Variable']&&_0x2f7c50['Variable'][_0xe762('0x17')]&&_0x2f7c50[_0xe762('0x3e')]&&_0x2f7c50[_0xe762('0x39')]){_0x3d8416[_0x2f7c50['Variable'][_0xe762('0x17')][_0xe762('0x3a')]()]&&_0x58c9b4[_0xe762('0x19')][_0xe762('0x40')]({'id':_0x2f7c50[_0xe762('0x3e')],'value':_0x3d8416[_0x2f7c50['Variable'][_0xe762('0x17')][_0xe762('0x3a')]()][_0xe762('0x30')]()});}});}return _0x58c9b4;}exports[_0xe762('0x41')]=function(_0x30e239,_0x5a0d38,_0x4f6790,_0x249759,_0x3b9641,_0x425b76){var _0x190249,_0x3ad1d6;_0x425b76[_0xe762('0x1c')]=intUtil[_0xe762('0x42')](_0x425b76[_0xe762('0x1c')]);_0x425b76[_0xe762('0x43')]=intUtil[_0xe762('0x42')](_0x425b76[_0xe762('0x43')]);if(_0x3b9641&&_0x3b9641[_0xe762('0x44')]){logger['info'](_0xe762('0x45'),_0xe762('0x46'));_0x5a0d38[_0xe762('0x47')]=util[_0xe762('0x10')](_0xe762('0x48'),_0x425b76[_0xe762('0x43')],_0x5a0d38[_0xe762('0x49')],md5(_0x5a0d38['uniqueid']));}else{_0x5a0d38[_0xe762('0x47')]='';}headers['Authorization']=getAuth(_0x425b76);return getUser(_0x425b76,_0x249759[_0xe762('0x26')])[_0xe762('0x20')](function(_0x5015a7){_0x190249=_0x5015a7;logger[_0xe762('0x22')](_0xe762('0x4a'),_0x190249['id']);return getEndUser(_0x425b76,_0x5a0d38[_0xe762('0x4b')],_0x5a0d38[_0xe762('0x11')]);})['then'](function(_0x1f40c5){_0x3ad1d6=_0x1f40c5;logger['info'](_0xe762('0x4c'),_0x3ad1d6['id']);return getTicket(_0x425b76,_0x190249,_0x3ad1d6,_0x4f6790,_0x5a0d38);})[_0xe762('0x20')](function(_0x3e0b9b){if(_0x3e0b9b&&_0x3e0b9b['id']){logger[_0xe762('0x22')](_0xe762('0x1d'));logger['info'](_0xe762('0x4d'),_0x3e0b9b['id']);logger[_0xe762('0x22')](_0xe762('0x45'),_0xe762('0x4e'));emit(util['format'](_0xe762('0x4f'),_0x249759[_0xe762('0x17')]),_0xe762('0x50'),{'uri':util[_0xe762('0x10')](_0xe762('0x51'),_0x425b76['remoteUri'],_0x3e0b9b['id'])});}})['catch'](function(_0x10bd09){logger['error']('[QUEUE]',JSON[_0xe762('0x33')](_0x10bd09));});};exports[_0xe762('0x52')]=function(_0x2910b3,_0x25bee1,_0x2763f9,_0x24d318,_0x19d46f,_0x13dfd9,_0xf8c714){var _0x2d21cc,_0x75b42;_0x13dfd9[_0xe762('0x1c')]=intUtil['stripTrailingSlash'](_0x13dfd9[_0xe762('0x1c')]);_0x13dfd9['serverUrl']=intUtil[_0xe762('0x42')](_0x13dfd9[_0xe762('0x43')]);if(_0xf8c714&&_0xf8c714[_0xe762('0x53')]&&_0xf8c714[_0xe762('0x53')]!==_0xe762('0x54')){logger[_0xe762('0x22')](_0xe762('0x55'),_0xe762('0x46'));_0x25bee1[_0xe762('0x47')]=util[_0xe762('0x10')](_0xe762('0x48'),_0x13dfd9[_0xe762('0x43')],_0x25bee1[_0xe762('0x49')],md5(_0x25bee1[_0xe762('0x49')]));}headers[_0xe762('0x56')]=getAuth(_0x13dfd9);return getUser(_0x13dfd9,_0x24d318[_0xe762('0x26')])[_0xe762('0x20')](function(_0x486b6b){_0x2d21cc=_0x486b6b;logger[_0xe762('0x22')]('The\x20User\x20ID\x20is:',_0x2d21cc['id']);return getEndUser(_0x13dfd9,_0x25bee1[_0xe762('0x57')],_0x25bee1[_0xe762('0x58')]);})[_0xe762('0x20')](function(_0x6200a){_0x75b42=_0x6200a;logger[_0xe762('0x22')]('The\x20Enduser\x20ID\x20is:',_0x75b42['id']);return getTicket(_0x13dfd9,_0x2d21cc,_0x75b42,_0x2763f9,_0x25bee1);})[_0xe762('0x20')](function(_0x3e833c){if(_0x3e833c&&_0x3e833c['id']){logger['info'](_0xe762('0x1d'));logger[_0xe762('0x22')](_0xe762('0x4d'),_0x3e833c['id']);logger[_0xe762('0x22')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xe762('0x10')](_0xe762('0x4f'),_0x24d318[_0xe762('0x17')]),_0xe762('0x50'),{'uri':util['format'](_0xe762('0x51'),_0x13dfd9[_0xe762('0x1c')],_0x3e833c['id'])});}})[_0xe762('0x59')](function(_0x17f46a){logger[_0xe762('0x5a')]('[OUTBOUND]',JSON[_0xe762('0x33')](_0x17f46a));});};exports[_0xe762('0x5b')]=function(_0x3837ac,_0x5becae,_0x57e3b4,_0x497abe,_0x353246,_0x21b659){var _0x54955c,_0x4d635e;_0x21b659['remoteUri']=intUtil[_0xe762('0x42')](_0x21b659['remoteUri']);_0x21b659[_0xe762('0x43')]=intUtil[_0xe762('0x42')](_0x21b659['serverUrl']);if(_0x353246&&_0x353246[_0xe762('0x44')]){logger[_0xe762('0x22')]('['+_0x5becae[_0xe762('0x5c')][_0xe762('0x5d')]()+']','Recording\x20is\x20enabled!');_0x5becae[_0xe762('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x21b659[_0xe762('0x43')],_0x5becae[_0xe762('0x49')],md5(_0x5becae[_0xe762('0x49')]));}else{_0x5becae[_0xe762('0x47')]='';}headers[_0xe762('0x56')]=getAuth(_0x21b659);return getUser(_0x21b659,'')[_0xe762('0x20')](function(_0xf9a422){_0x54955c=_0xf9a422;logger[_0xe762('0x22')](_0xe762('0x4a'),_0x54955c['id']);return getEndUser(_0x21b659,_0x5becae[_0xe762('0x4b')],_0x5becae[_0xe762('0x11')]);})[_0xe762('0x20')](function(_0x2e7db8){_0x4d635e=_0x2e7db8;logger[_0xe762('0x22')](_0xe762('0x4c'),_0x4d635e['id']);return getTicket(_0x21b659,_0x54955c,_0x4d635e,_0x57e3b4,_0x5becae);})[_0xe762('0x20')](function(_0xc6f5e4){if(_0xc6f5e4){logger[_0xe762('0x22')](_0xe762('0x1d'));logger[_0xe762('0x22')](_0xe762('0x4d'),_0xc6f5e4['id']);}})[_0xe762('0x59')](function(_0x3520ae){logger['error']('['+_0x5becae['lastevent'][_0xe762('0x5d')]()+']',JSON['stringify'](_0x3520ae));});}; \ No newline at end of file +var _0x6b77=['queue','stripTrailingSlash','serverUrl','monitor_format','[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','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','stringify','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','lastevent','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','socket.io-emitter','application/json','emit','info','merge','format','Caller\x20-\x20%s','calleridname','getString','Subjects','Descriptions','Tags','name','Fields','custom_fields','mapValues','keyBy','%s/api/v2/tickets','remoteUri','POST','Ticket\x20created!','%s/api/v2/agents','then','length','Agent\x20found!','contact','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','Enduser\x20found!','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Basic\x20%s','apiKey','toString','[HTTP]','GET','map','string','nameField','customField','toLowerCase','content','idField','type','variable','push','variableName','customVariable','Variable'];(function(_0x252f2a,_0x130b8b){var _0x4a98ec=function(_0x37c787){while(--_0x37c787){_0x252f2a['push'](_0x252f2a['shift']());}};_0x4a98ec(++_0x130b8b);}(_0x6b77,0x183));var _0x76b7=function(_0x298485,_0xe4453a){_0x298485=_0x298485-0x0;var _0x57d04b=_0x6b77[_0x298485];return _0x57d04b;};'use strict';var _=require(_0x76b7('0x0'));var rp=require(_0x76b7('0x1'));var md5=require(_0x76b7('0x2'));var util=require(_0x76b7('0x3'));var Redis=require(_0x76b7('0x4'));var intUtil=require(_0x76b7('0x5'));var config=require(_0x76b7('0x6'));var logger=require(_0x76b7('0x7'))(_0x76b7('0x8'));config[_0x76b7('0x9')]=_[_0x76b7('0xa')](config[_0x76b7('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x76b7('0xb'))(new Redis(config[_0x76b7('0x9')]));var headers={'Content-Type':_0x76b7('0xc'),'Accept':'application/json'};function emit(_0x41ab59,_0x305b11,_0x265c12){io['to'](_0x41ab59)[_0x76b7('0xd')](_0x305b11,_0x265c12);}function getTicket(_0xf51116,_0x513bb9,_0x5bd3a9,_0x305e72,_0xe2ce6c){logger[_0x76b7('0xe')]('Creating\x20new\x20ticket...');var _0x2ac8e4=_[_0x76b7('0xf')]({'responder_id':_0x513bb9['id'],'requester_id':_0x5bd3a9['id'],'name':util[_0x76b7('0x10')](_0x76b7('0x11'),_0xe2ce6c[_0x76b7('0x12')]),'phone':_0xe2ce6c['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x76b7('0x13')](_0x305e72[_0x76b7('0x14')],_0xe2ce6c,'\x20'),'description':intUtil[_0x76b7('0x13')](_0x305e72[_0x76b7('0x15')],_0xe2ce6c,'
'),'tags':getTags(_0x305e72[_0x76b7('0x16')],_0x76b7('0x17'))},getCustomFields(_0x305e72[_0x76b7('0x18')],_0xe2ce6c));_0x2ac8e4[_0x76b7('0x19')]=_[_0x76b7('0x1a')](_[_0x76b7('0x1b')](_0x2ac8e4[_0x76b7('0x19')],'id'),'value');return request({'uri':util[_0x76b7('0x10')](_0x76b7('0x1c'),_0xf51116[_0x76b7('0x1d')]),'method':_0x76b7('0x1e'),'body':_0x2ac8e4})['then'](function(_0x58b244){logger['info'](_0x76b7('0x1f'));return _0x58b244;});}function getUser(_0x3c765a,_0x37188a){if(intUtil['validateEmail'](_0x37188a)){return request({'uri':util[_0x76b7('0x10')](_0x76b7('0x20'),_0x3c765a[_0x76b7('0x1d')]),'qs':{'email':_0x37188a}})[_0x76b7('0x21')](function(_0x2321b4){if(_0x2321b4[_0x76b7('0x22')]){logger[_0x76b7('0xe')](_0x76b7('0x23'));return _['find'](_0x2321b4,function(_0x55e102){return _0x55e102[_0x76b7('0x24')][_0x76b7('0x25')]===_0x37188a;});}else{logger[_0x76b7('0xe')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x76b7('0x10')](_0x76b7('0x26'),_0x3c765a[_0x76b7('0x1d')])})['then'](function(_0x3163c0){logger[_0x76b7('0xe')](_0x76b7('0x27'));return _0x3163c0;});}});}else{logger[_0x76b7('0xe')](_0x76b7('0x28'));return request({'uri':util['format'](_0x76b7('0x26'),_0x3c765a[_0x76b7('0x1d')])})[_0x76b7('0x21')](function(_0x5e450b){logger[_0x76b7('0xe')](_0x76b7('0x27'));return _0x5e450b;});}}function getEndUser(_0x368059,_0x38c916,_0x288e8c){logger[_0x76b7('0xe')]('Searching\x20enduser\x20with\x20phone',_0x288e8c);return request({'uri':util['format'](_0x76b7('0x29'),_0x368059[_0x76b7('0x1d')]),'qs':{'phone':_0x288e8c}})[_0x76b7('0x21')](function(_0x226835){if(_0x226835[_0x76b7('0x22')]){logger[_0x76b7('0xe')](_0x76b7('0x2a'));return _[_0x76b7('0x2b')](_0x226835,{'phone':_0x288e8c});}else{logger['info'](_0x76b7('0x2c'));return request({'uri':util[_0x76b7('0x10')]('%s/api/v2/contacts',_0x368059[_0x76b7('0x1d')]),'method':_0x76b7('0x1e'),'body':{'name':_0x38c916,'phone':_0x288e8c}})[_0x76b7('0x21')](function(_0x208dc3){logger['info']('Enduser\x20created.');return _0x208dc3;});}});}function getAuth(_0x5ad92c){return util[_0x76b7('0x10')](_0x76b7('0x2d'),new Buffer(_0x5ad92c[_0x76b7('0x2e')]+':X')[_0x76b7('0x2f')]('base64'));}function request(_0x4ff683){logger['debug'](_0x76b7('0x30'),JSON['stringify'](_0x4ff683));return rp(_['defaults'](_0x4ff683,{'method':_0x76b7('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x1d25b1,_0x4e1b91){var _0x2e511b=[];if(_0x1d25b1&&_0x1d25b1[_0x76b7('0x22')]>0x0){_0x2e511b=_[_0x76b7('0x32')](_0x1d25b1,_0x4e1b91);}return _0x2e511b;}function getCustomFields(_0x2b584d,_0x3ac47a){var _0xed6072=[];var _0x2c0854={'custom_fields':[]};if(_0x2b584d[_0x76b7('0x22')]>0x0){_['forEach'](_0x2b584d,function(_0x5a25a8){if(_0x5a25a8['type']===_0x76b7('0x33')&&_0x5a25a8[_0x76b7('0x34')]&&!_0x5a25a8[_0x76b7('0x35')]){_0x2c0854[_0x5a25a8[_0x76b7('0x34')][_0x76b7('0x36')]()]=_0x5a25a8[_0x76b7('0x37')][_0x76b7('0x2f')]();}else if(_0x5a25a8['type']===_0x76b7('0x33')&&_0x5a25a8[_0x76b7('0x38')]&&_0x5a25a8[_0x76b7('0x35')]){_0x2c0854['custom_fields']['push']({'id':_0x5a25a8[_0x76b7('0x38')],'value':_0x5a25a8[_0x76b7('0x37')][_0x76b7('0x2f')]()});}else if(_0x5a25a8[_0x76b7('0x39')]===_0x76b7('0x3a')&&_0x5a25a8['variableName']&&_0x5a25a8[_0x76b7('0x38')]&&_0x5a25a8[_0x76b7('0x35')]){_0x3ac47a[_0x5a25a8['variableName']]&&_0x2c0854['custom_fields'][_0x76b7('0x3b')]({'id':_0x5a25a8['idField'],'value':_0x3ac47a[_0x5a25a8[_0x76b7('0x3c')]][_0x76b7('0x2f')]()});}else if(_0x5a25a8['type']===_0x76b7('0x3d')&&_0x5a25a8[_0x76b7('0x3e')]&&_0x5a25a8[_0x76b7('0x3e')]['name']&&_0x5a25a8[_0x76b7('0x38')]&&_0x5a25a8[_0x76b7('0x35')]){_0x3ac47a[_0x5a25a8[_0x76b7('0x3e')][_0x76b7('0x17')][_0x76b7('0x36')]()]&&_0x2c0854[_0x76b7('0x19')][_0x76b7('0x3b')]({'id':_0x5a25a8[_0x76b7('0x38')],'value':_0x3ac47a[_0x5a25a8['Variable'][_0x76b7('0x17')][_0x76b7('0x36')]()]['toString']()});}});}return _0x2c0854;}exports[_0x76b7('0x3f')]=function(_0x73d593,_0x34674e,_0x2df974,_0x5c3848,_0xb35600,_0x16ab9c){var _0xb53bea,_0x1898d3;_0x16ab9c['remoteUri']=intUtil[_0x76b7('0x40')](_0x16ab9c[_0x76b7('0x1d')]);_0x16ab9c[_0x76b7('0x41')]=intUtil[_0x76b7('0x40')](_0x16ab9c[_0x76b7('0x41')]);if(_0xb35600&&_0xb35600[_0x76b7('0x42')]){logger[_0x76b7('0xe')](_0x76b7('0x43'),_0x76b7('0x44'));_0x34674e[_0x76b7('0x45')]=util[_0x76b7('0x10')](_0x76b7('0x46'),_0x16ab9c['serverUrl'],_0x34674e[_0x76b7('0x47')],md5(_0x34674e[_0x76b7('0x47')]));}else{_0x34674e['recordingURL']='';}headers[_0x76b7('0x48')]=getAuth(_0x16ab9c);return getUser(_0x16ab9c,_0x5c3848[_0x76b7('0x25')])[_0x76b7('0x21')](function(_0xa639f2){_0xb53bea=_0xa639f2;logger[_0x76b7('0xe')](_0x76b7('0x49'),_0xb53bea['id']);return getEndUser(_0x16ab9c,_0x34674e[_0x76b7('0x12')],_0x34674e['calleridnum']);})[_0x76b7('0x21')](function(_0x25b997){_0x1898d3=_0x25b997;logger[_0x76b7('0xe')](_0x76b7('0x4a'),_0x1898d3['id']);return getTicket(_0x16ab9c,_0xb53bea,_0x1898d3,_0x2df974,_0x34674e);})[_0x76b7('0x21')](function(_0x13a5a3){if(_0x13a5a3&&_0x13a5a3['id']){logger[_0x76b7('0xe')](_0x76b7('0x1f'));logger[_0x76b7('0xe')](_0x76b7('0x4b'),_0x13a5a3['id']);logger['info'](_0x76b7('0x43'),_0x76b7('0x4c'));emit(util[_0x76b7('0x10')](_0x76b7('0x4d'),_0x5c3848[_0x76b7('0x17')]),_0x76b7('0x4e'),{'uri':util[_0x76b7('0x10')](_0x76b7('0x4f'),_0x16ab9c[_0x76b7('0x1d')],_0x13a5a3['id'])});}})[_0x76b7('0x50')](function(_0x54e9ca){logger[_0x76b7('0x51')](_0x76b7('0x43'),JSON[_0x76b7('0x52')](_0x54e9ca));});};exports[_0x76b7('0x53')]=function(_0x6f4370,_0x469f06,_0x2a8b7a,_0x4ef606,_0x14d007,_0x3739f4,_0x538eee){var _0x2fc689,_0x3175f6;_0x3739f4[_0x76b7('0x1d')]=intUtil[_0x76b7('0x40')](_0x3739f4[_0x76b7('0x1d')]);_0x3739f4['serverUrl']=intUtil['stripTrailingSlash'](_0x3739f4[_0x76b7('0x41')]);if(_0x538eee&&_0x538eee[_0x76b7('0x54')]&&_0x538eee[_0x76b7('0x54')]!==_0x76b7('0x55')){logger[_0x76b7('0xe')](_0x76b7('0x56'),'Recording\x20is\x20enabled!');_0x469f06[_0x76b7('0x45')]=util[_0x76b7('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3739f4[_0x76b7('0x41')],_0x469f06[_0x76b7('0x47')],md5(_0x469f06[_0x76b7('0x47')]));}headers[_0x76b7('0x48')]=getAuth(_0x3739f4);return getUser(_0x3739f4,_0x4ef606[_0x76b7('0x25')])[_0x76b7('0x21')](function(_0x4cfe70){_0x2fc689=_0x4cfe70;logger['info'](_0x76b7('0x49'),_0x2fc689['id']);return getEndUser(_0x3739f4,_0x469f06[_0x76b7('0x57')],_0x469f06[_0x76b7('0x58')]);})[_0x76b7('0x21')](function(_0x3403d3){_0x3175f6=_0x3403d3;logger['info'](_0x76b7('0x4a'),_0x3175f6['id']);return getTicket(_0x3739f4,_0x2fc689,_0x3175f6,_0x2a8b7a,_0x469f06);})[_0x76b7('0x21')](function(_0x3256b0){if(_0x3256b0&&_0x3256b0['id']){logger[_0x76b7('0xe')](_0x76b7('0x1f'));logger[_0x76b7('0xe')](_0x76b7('0x4b'),_0x3256b0['id']);logger[_0x76b7('0xe')]('[OUTBOUND]',_0x76b7('0x4c'));emit(util[_0x76b7('0x10')](_0x76b7('0x4d'),_0x4ef606['name']),_0x76b7('0x4e'),{'uri':util[_0x76b7('0x10')](_0x76b7('0x4f'),_0x3739f4[_0x76b7('0x1d')],_0x3256b0['id'])});}})[_0x76b7('0x50')](function(_0x8ab85f){logger[_0x76b7('0x51')](_0x76b7('0x56'),JSON[_0x76b7('0x52')](_0x8ab85f));});};exports['unmanaged']=function(_0x4567b7,_0x284399,_0x3abcbe,_0x1d8782,_0x4d3d7b,_0x21b5ac){var _0x5e2228,_0x23504c;_0x21b5ac[_0x76b7('0x1d')]=intUtil['stripTrailingSlash'](_0x21b5ac[_0x76b7('0x1d')]);_0x21b5ac[_0x76b7('0x41')]=intUtil['stripTrailingSlash'](_0x21b5ac['serverUrl']);if(_0x4d3d7b&&_0x4d3d7b[_0x76b7('0x42')]){logger[_0x76b7('0xe')]('['+_0x284399['lastevent']['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x284399['recordingURL']=util[_0x76b7('0x10')](_0x76b7('0x46'),_0x21b5ac[_0x76b7('0x41')],_0x284399[_0x76b7('0x47')],md5(_0x284399[_0x76b7('0x47')]));}else{_0x284399[_0x76b7('0x45')]='';}headers[_0x76b7('0x48')]=getAuth(_0x21b5ac);return getUser(_0x21b5ac,'')[_0x76b7('0x21')](function(_0x37a598){_0x5e2228=_0x37a598;logger[_0x76b7('0xe')]('The\x20User\x20ID\x20is:',_0x5e2228['id']);return getEndUser(_0x21b5ac,_0x284399['calleridname'],_0x284399['calleridnum']);})[_0x76b7('0x21')](function(_0x489115){_0x23504c=_0x489115;logger['info'](_0x76b7('0x4a'),_0x23504c['id']);return getTicket(_0x21b5ac,_0x5e2228,_0x23504c,_0x3abcbe,_0x284399);})[_0x76b7('0x21')](function(_0x20be97){if(_0x20be97){logger[_0x76b7('0xe')](_0x76b7('0x1f'));logger['info'](_0x76b7('0x4b'),_0x20be97['id']);}})[_0x76b7('0x50')](function(_0x297be3){logger['error']('['+_0x284399[_0x76b7('0x59')]['toUpperCase']()+']',JSON[_0x76b7('0x52')](_0x297be3));});}; \ 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 f626253..9c9f819 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 _0x6e37=['stripTrailingSlash','adminEmail','username','toLowerCase','outbound','calleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','defaults','redis','localhost','socket.io-emitter','GET','/api/selector/owners','info','then','users','length','email','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userId','Admin\x20selected','userEmail','message','/api/contacts/filters','headers','Getting\x20contacts\x20filter','filters','/api/contacts/view/','Searching\x20contact\x20with\x20phone','contactNumber','find','work_number','mobile_number','Contact\x20found:','endUserId','Contact\x20created:','POST','format','YYYY-MM-DDTHH:mm:ss','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','add','ticketId','task','Task\x20created:','user:%s','emit','trigger:browser:url','apiKey','remoteUri','serverUrl'];(function(_0x434e0a,_0x1ebc29){var _0xe3c6f6=function(_0x28d1d7){while(--_0x28d1d7){_0x434e0a['push'](_0x434e0a['shift']());}};_0xe3c6f6(++_0x1ebc29);}(_0x6e37,0x16c));var _0x76e3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6e37[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x76e3('0x0'));var rp=require(_0x76e3('0x1'));var md5=require(_0x76e3('0x2'));var util=require(_0x76e3('0x3'));var moment=require(_0x76e3('0x4'));var Promise=require(_0x76e3('0x5'));var Redis=require(_0x76e3('0x6'));var intUtil=require(_0x76e3('0x7'));var config=require(_0x76e3('0x8'));var logger=require('../../../../config/logger')('freshsales');config['redis']=_[_0x76e3('0x9')](config[_0x76e3('0xa')],{'host':_0x76e3('0xb'),'port':0x18eb});var io=require(_0x76e3('0xc'))(new Redis(config[_0x76e3('0xa')]));function getAdminId(_0x43249a,_0x1ad960,_0x5ef48,_0x3440ae){return new Promise(function(_0x40bd29,_0x4c09a9){var _0x3cc726=![];var _0x113574={'method':_0x76e3('0xd'),'uri':_0x3440ae+_0x76e3('0xe'),'json':!![]};_0x113574['headers']=_0x5ef48;logger[_0x76e3('0xf')]('Getting\x20admin\x20information');return rp(_0x113574)[_0x76e3('0x10')](function(_0x2b8d3b){if(_0x2b8d3b){var _0x4dc686=_0x2b8d3b[_0x76e3('0x11')];var _0x4e7742=null;for(_0x4e7742=0x0;_0x4e7742<_0x4dc686[_0x76e3('0x12')];_0x4e7742++){if(_0x4dc686[_0x4e7742][_0x76e3('0x13')]===_0x43249a['adminEmail']){_0x43249a['adminId']=_0x4dc686[_0x4e7742]['id'];_0x3cc726=!![];}}if(_0x3cc726){logger['info'](_0x76e3('0x14'),_0x43249a[_0x76e3('0x15')]);_0x40bd29(_0x43249a);}else{_0x4c09a9({'statusCode':0x194,'message':_0x76e3('0x16')});}}else{_0x4c09a9({'statusCode':0x194,'message':_0x76e3('0x16')});}})[_0x76e3('0x17')](function(_0xabb647){logger[_0x76e3('0x18')]('['+[_0x1ad960[_0x76e3('0x19')]()]+']',_0xabb647['message']);_0x4c09a9(_0xabb647);});});}function getUser(_0x123383,_0xe9ed20,_0xffd91f){return function(_0x25ed70){return new Promise(function(_0x162ecb,_0x5016b8){var _0x3ccb7c={'method':_0x76e3('0xd'),'uri':_0xffd91f+'/api/selector/owners','json':!![]};_0x3ccb7c['headers']=_0xe9ed20;logger[_0x76e3('0xf')](_0x76e3('0x1a'));return rp(_0x3ccb7c)[_0x76e3('0x10')](function(_0x3e4601){if(_0x3e4601){var _0x1fab86=_0x3e4601[_0x76e3('0x11')];var _0x1dfb21=![];var _0x1bbbaa=null;if(_0x25ed70[_0x76e3('0x1b')]!==null){logger[_0x76e3('0xf')](_0x76e3('0x1c'),_0x25ed70[_0x76e3('0x1b')]);_0x25ed70['userEmail']=_0x25ed70[_0x76e3('0x1b')];for(_0x1bbbaa=0x0;_0x1bbbaa<_0x1fab86[_0x76e3('0x12')];_0x1bbbaa++){if(_0x1fab86[_0x1bbbaa]['email']===_0x25ed70['agentEmail']){_0x1dfb21=!![];_0x25ed70['userId']=_0x1fab86[_0x1bbbaa]['id'];logger[_0x76e3('0xf')]('User\x20found:',_0x25ed70[_0x76e3('0x1d')]);}}}if(!_0x1dfb21){logger[_0x76e3('0xf')](_0x76e3('0x1e'));_0x25ed70[_0x76e3('0x1f')]=_0x25ed70['adminEmail'];_0x25ed70[_0x76e3('0x1d')]=_0x25ed70['adminId'];_0x1dfb21=!![];}if(_0x1dfb21){_0x162ecb(_0x25ed70);}else{_0x5016b8({'statusCode':0x194,'message':_0x76e3('0x16')});}}else{_0x5016b8({'statusCode':0x194,'message':_0x76e3('0x16')});}})[_0x76e3('0x17')](function(_0x2e46a5){logger[_0x76e3('0x18')]('['+[_0x123383[_0x76e3('0x19')]()]+']',_0x2e46a5[_0x76e3('0x20')]);_0x5016b8(_0x2e46a5);});});};}function getEndUser(_0x410a52,_0x1e7f66,_0x41f129){return function(_0x50c8bf){return new Promise(function(_0x1d641b,_0x25644b){var _0x3b2ffa=0x0;var _0x2437cc={'method':_0x76e3('0xd'),'uri':_0x41f129+_0x76e3('0x21'),'json':!![]};_0x2437cc[_0x76e3('0x22')]=_0x1e7f66;logger[_0x76e3('0xf')](_0x76e3('0x23'));return rp(_0x2437cc)[_0x76e3('0x10')](function(_0x5761dc){_0x5761dc[_0x76e3('0x24')]['forEach'](function(_0x3272ef){if(_0x3272ef['name']==='All\x20Contacts'){_0x3b2ffa=_0x3272ef['id'];}});})[_0x76e3('0x10')](function(){logger[_0x76e3('0xf')]('Getting\x20contact\x20list');var _0x3a1a93={'method':_0x76e3('0xd'),'uri':_0x41f129+_0x76e3('0x25')+_0x3b2ffa,'json':!![]};_0x3a1a93[_0x76e3('0x22')]=_0x1e7f66;return rp(_0x3a1a93);})[_0x76e3('0x10')](function(_0x5d2339){logger[_0x76e3('0xf')](_0x76e3('0x26'),_0x50c8bf[_0x76e3('0x27')]);if(_0x5d2339['contacts'][_0x76e3('0x12')]>0x0){var _0x123c16=_[_0x76e3('0x28')](_0x5d2339['contacts'],function(_0x1da638){if(_0x1da638[_0x76e3('0x29')]===_0x50c8bf[_0x76e3('0x27')]||_0x1da638[_0x76e3('0x2a')]===_0x50c8bf['contactNumber']){return _0x1da638;}});if(_0x123c16){_0x50c8bf['endUserId']=_0x123c16['id'];logger[_0x76e3('0xf')](_0x76e3('0x2b'),_0x50c8bf[_0x76e3('0x2c')]);_0x1d641b(_0x50c8bf);}else{return createEndUser(_0x50c8bf,_0x410a52,_0x1e7f66,_0x41f129)['then'](function(_0x202de1){logger[_0x76e3('0xf')](_0x76e3('0x2d'),_0x50c8bf[_0x76e3('0x2c')]);_0x1d641b(_0x202de1);});}}else{return createEndUser(_0x50c8bf,_0x410a52,_0x1e7f66,_0x41f129)[_0x76e3('0x10')](function(_0x3bd687){logger[_0x76e3('0xf')]('Contact\x20created:',_0x50c8bf['endUserId']);_0x1d641b(_0x3bd687);});}})['catch'](function(_0x1568ec){throw new Error(_0x1568ec[_0x76e3('0x20')]);});});};}function createEndUser(_0xb43c08,_0x15e2a2,_0x379b57,_0x369b8b){return new Promise(function(_0xbc5ea9,_0x5f51fd){var _0x588a0e=moment();var _0x3aa3da={'method':_0x76e3('0x2e'),'uri':_0x369b8b+'/api/contacts','body':{'contact':{'last_name':_0xb43c08[_0x76e3('0x27')],'work_number':_0xb43c08[_0x76e3('0x27')],'mobile_number':_0xb43c08[_0x76e3('0x27')],'owner_id':_0xb43c08[_0x76e3('0x1d')],'created_at':_0x588a0e[_0x76e3('0x2f')](_0x76e3('0x30'))}},'json':!![]};_0x3aa3da['headers']=_0x379b57;logger[_0x76e3('0xf')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x3aa3da)['then'](function(_0x3be60e){_0xb43c08[_0x76e3('0x2c')]=_0x3be60e[_0x76e3('0x31')]['id'];_0xbc5ea9(_0xb43c08);})['catch'](function(_0x2682b9){logger['error']('['+[_0x15e2a2[_0x76e3('0x19')]()]+']',_0x2682b9[_0x76e3('0x20')]);_0x5f51fd(_0x2682b9[_0x76e3('0x20')]);});});}function getTicket(_0x42d1f4,_0x1ae8b9,_0x1c593b,_0x56ceee,_0x2d2ba6){return function(_0x4479c0){logger[_0x76e3('0xf')](_0x76e3('0x32'));return new Promise(function(_0xb1efdf,_0x2bca0d){var _0x4319f3=moment();var _0x8eeb3={'method':'POST','uri':_0x1c593b+_0x76e3('0x33'),'body':{'title':intUtil[_0x76e3('0x34')](_0x56ceee[_0x76e3('0x35')],_0x2d2ba6,'\x20'),'description':intUtil[_0x76e3('0x34')](_0x56ceee[_0x76e3('0x36')],_0x2d2ba6,'\x0a'),'owner_id':_0x4479c0[_0x76e3('0x1d')],'creater_id':_0x4479c0[_0x76e3('0x15')],'targetable_id':_0x4479c0['endUserId'],'targetable_type':_0x76e3('0x37'),'created_at':_0x4319f3[_0x76e3('0x2f')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x4319f3[_0x76e3('0x38')](0x1e,'m')[_0x76e3('0x2f')](_0x76e3('0x30'))},'json':!![]};_0x8eeb3['headers']=_0x1ae8b9;return rp(_0x8eeb3)[_0x76e3('0x10')](function(_0xae7008){_0x4479c0[_0x76e3('0x39')]=_0xae7008[_0x76e3('0x3a')]['id'];logger[_0x76e3('0xf')](_0x76e3('0x3b'),_0x4479c0[_0x76e3('0x39')]);_0xb1efdf(_0x4479c0);})['catch'](function(_0x58648b){logger['error']('['+[_0x42d1f4[_0x76e3('0x19')]()]+']',_0x58648b[_0x76e3('0x20')]);_0x2bca0d(_0x58648b[_0x76e3('0x20')]);});});};}function emit(_0xb45feb,_0x522c2e,_0x1150e5){var _0x1f73cf={'uri':_0xb45feb+'/contacts/'+_0x1150e5};io['to'](util[_0x76e3('0x2f')](_0x76e3('0x3c'),_0x522c2e))[_0x76e3('0x3d')](_0x76e3('0x3e'),_0x1f73cf);}exports['cs']=function(_0x5e7d7f,_0x36d922,_0x259176,_0x16119d,_0x536e65,_0xa9025b,_0x3d710a,_0x3e1f43){var _0x430cd9={};var _0xd04ef5={'Authorization':'Token\x20token='+_0xa9025b[_0x76e3('0x3f')]};_0xa9025b[_0x76e3('0x40')]=intUtil['stripTrailingSlash'](_0xa9025b[_0x76e3('0x40')]);_0xa9025b[_0x76e3('0x41')]=intUtil[_0x76e3('0x42')](_0xa9025b['serverUrl']);var _0x50f4ea=_0xa9025b[_0x76e3('0x40')];_0x430cd9[_0x76e3('0x43')]=_0xa9025b[_0x76e3('0x44')];_0x430cd9[_0x76e3('0x27')]=_0x3e1f43[_0x76e3('0x45')]()===_0x76e3('0x46')?_0x36d922['destcalleridnum']:_0x36d922[_0x76e3('0x47')];_0x430cd9[_0x76e3('0x48')]=_0x3e1f43===_0x76e3('0x49')||_0x3e1f43===_0x76e3('0x4a')?'queue':_0x76e3('0x46');if(_0x16119d){_0x430cd9['agentEmail']=_0x16119d[_0x76e3('0x13')];}var _0x1999ba=util[_0x76e3('0x2f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xa9025b['serverUrl'],_0x36d922[_0x76e3('0x4b')],md5(_0x36d922[_0x76e3('0x4b')]));if(_0x536e65&&_0x536e65[_0x76e3('0x4c')]){logger[_0x76e3('0xf')](_0x76e3('0x4d'),_0x76e3('0x4e'));_0x36d922['recordingURL']=_0x1999ba;}else if(_0x3d710a&&_0x3d710a['recordingFormat']&&_0x3d710a[_0x76e3('0x4f')]!==_0x76e3('0x50')){logger[_0x76e3('0xf')]('[OUTBOUND]',_0x76e3('0x4e'));_0x36d922[_0x76e3('0x51')]=_0x1999ba;}else{_0x36d922[_0x76e3('0x51')]='';}return getAdminId(_0x430cd9,_0x3e1f43,_0xd04ef5,_0x50f4ea)[_0x76e3('0x10')](getUser(_0x3e1f43,_0xd04ef5,_0x50f4ea))[_0x76e3('0x10')](getEndUser(_0x3e1f43,_0xd04ef5,_0x50f4ea))[_0x76e3('0x10')](getTicket(_0x3e1f43,_0xd04ef5,_0x50f4ea,_0x259176,_0x36d922))[_0x76e3('0x10')](function(_0x499f14){logger[_0x76e3('0xf')](util[_0x76e3('0x2f')](_0x76e3('0x52'),_0x499f14['ticketId']));if(_0x3e1f43!==_0x76e3('0x4a')){logger[_0x76e3('0xf')]('['+[_0x3e1f43[_0x76e3('0x19')]()]+']',_0x76e3('0x53'));emit(_0x50f4ea,_0x16119d[_0x76e3('0x54')],_0x499f14[_0x76e3('0x2c')]);}})[_0x76e3('0x17')](function(_0x123a00){logger['error']('['+[_0x3e1f43['toUpperCase']()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x76e3('0x55')](_0x123a00,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xabe7=['apiKey','remoteUri','stripTrailingSlash','serverUrl','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','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','lodash','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','adminId','Requested\x20Resource\x20not\x20Found','error','message','GET','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','email','User\x20found:','userId','Admin\x20selected','adminEmail','catch','toUpperCase','Getting\x20contacts\x20filter','filters','forEach','Getting\x20contact\x20list','/api/contacts/view/','Searching\x20contact\x20with\x20phone','contacts','find','work_number','contactNumber','mobile_number','endUserId','Contact\x20found:','Contact\x20created:','/api/contacts','YYYY-MM-DDTHH:mm:ss','contact','Creating\x20new\x20task','POST','/api/tasks','getString','Subjects','Descriptions','format','add','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token='];(function(_0x206077,_0x40cc92){var _0x7aa5b4=function(_0x3b9f3d){while(--_0x3b9f3d){_0x206077['push'](_0x206077['shift']());}};_0x7aa5b4(++_0x40cc92);}(_0xabe7,0xce));var _0x7abe=function(_0x3ccee0,_0x102168){_0x3ccee0=_0x3ccee0-0x0;var _0x37fb35=_0xabe7[_0x3ccee0];return _0x37fb35;};'use strict';var _=require(_0x7abe('0x0'));var rp=require(_0x7abe('0x1'));var md5=require(_0x7abe('0x2'));var util=require(_0x7abe('0x3'));var moment=require(_0x7abe('0x4'));var Promise=require(_0x7abe('0x5'));var Redis=require(_0x7abe('0x6'));var intUtil=require(_0x7abe('0x7'));var config=require(_0x7abe('0x8'));var logger=require(_0x7abe('0x9'))(_0x7abe('0xa'));config[_0x7abe('0xb')]=_[_0x7abe('0xc')](config[_0x7abe('0xb')],{'host':_0x7abe('0xd'),'port':0x18eb});var io=require(_0x7abe('0xe'))(new Redis(config[_0x7abe('0xb')]));function getAdminId(_0x5551c7,_0x20f182,_0x46e4c3,_0x40c75f){return new Promise(function(_0x18b18e,_0xfd79d3){var _0x25e57e=![];var _0x4ab152={'method':'GET','uri':_0x40c75f+_0x7abe('0xf'),'json':!![]};_0x4ab152[_0x7abe('0x10')]=_0x46e4c3;logger[_0x7abe('0x11')](_0x7abe('0x12'));return rp(_0x4ab152)[_0x7abe('0x13')](function(_0x1a6195){if(_0x1a6195){var _0x109536=_0x1a6195[_0x7abe('0x14')];var _0x1ccf61=null;for(_0x1ccf61=0x0;_0x1ccf61<_0x109536[_0x7abe('0x15')];_0x1ccf61++){if(_0x109536[_0x1ccf61]['email']===_0x5551c7['adminEmail']){_0x5551c7['adminId']=_0x109536[_0x1ccf61]['id'];_0x25e57e=!![];}}if(_0x25e57e){logger[_0x7abe('0x11')]('Admin\x20found:',_0x5551c7[_0x7abe('0x16')]);_0x18b18e(_0x5551c7);}else{_0xfd79d3({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0xfd79d3({'statusCode':0x194,'message':_0x7abe('0x17')});}})['catch'](function(_0x346e13){logger[_0x7abe('0x18')]('['+[_0x20f182['toUpperCase']()]+']',_0x346e13[_0x7abe('0x19')]);_0xfd79d3(_0x346e13);});});}function getUser(_0x13c0c7,_0x4d0b22,_0xb159fd){return function(_0xff055a){return new Promise(function(_0x49f51b,_0x1f02fc){var _0x1d3354={'method':_0x7abe('0x1a'),'uri':_0xb159fd+_0x7abe('0xf'),'json':!![]};_0x1d3354[_0x7abe('0x10')]=_0x4d0b22;logger[_0x7abe('0x11')](_0x7abe('0x1b'));return rp(_0x1d3354)[_0x7abe('0x13')](function(_0x155441){if(_0x155441){var _0x5d52ea=_0x155441[_0x7abe('0x14')];var _0xc42dc0=![];var _0x5b2d3d=null;if(_0xff055a[_0x7abe('0x1c')]!==null){logger[_0x7abe('0x11')](_0x7abe('0x1d'),_0xff055a['agentEmail']);_0xff055a['userEmail']=_0xff055a[_0x7abe('0x1c')];for(_0x5b2d3d=0x0;_0x5b2d3d<_0x5d52ea['length'];_0x5b2d3d++){if(_0x5d52ea[_0x5b2d3d][_0x7abe('0x1e')]===_0xff055a[_0x7abe('0x1c')]){_0xc42dc0=!![];_0xff055a['userId']=_0x5d52ea[_0x5b2d3d]['id'];logger[_0x7abe('0x11')](_0x7abe('0x1f'),_0xff055a[_0x7abe('0x20')]);}}}if(!_0xc42dc0){logger[_0x7abe('0x11')](_0x7abe('0x21'));_0xff055a['userEmail']=_0xff055a[_0x7abe('0x22')];_0xff055a[_0x7abe('0x20')]=_0xff055a['adminId'];_0xc42dc0=!![];}if(_0xc42dc0){_0x49f51b(_0xff055a);}else{_0x1f02fc({'statusCode':0x194,'message':_0x7abe('0x17')});}}else{_0x1f02fc({'statusCode':0x194,'message':_0x7abe('0x17')});}})[_0x7abe('0x23')](function(_0x238016){logger['error']('['+[_0x13c0c7[_0x7abe('0x24')]()]+']',_0x238016[_0x7abe('0x19')]);_0x1f02fc(_0x238016);});});};}function getEndUser(_0x24e0e4,_0x523c62,_0x40ec51){return function(_0x5c70c9){return new Promise(function(_0x3ad479,_0xf438f6){var _0x3f90c3=0x0;var _0x59a45f={'method':'GET','uri':_0x40ec51+'/api/contacts/filters','json':!![]};_0x59a45f[_0x7abe('0x10')]=_0x523c62;logger[_0x7abe('0x11')](_0x7abe('0x25'));return rp(_0x59a45f)[_0x7abe('0x13')](function(_0x34c3d3){_0x34c3d3[_0x7abe('0x26')][_0x7abe('0x27')](function(_0x4d450d){if(_0x4d450d['name']==='All\x20Contacts'){_0x3f90c3=_0x4d450d['id'];}});})['then'](function(){logger['info'](_0x7abe('0x28'));var _0x5bf489={'method':_0x7abe('0x1a'),'uri':_0x40ec51+_0x7abe('0x29')+_0x3f90c3,'json':!![]};_0x5bf489[_0x7abe('0x10')]=_0x523c62;return rp(_0x5bf489);})[_0x7abe('0x13')](function(_0x70f091){logger[_0x7abe('0x11')](_0x7abe('0x2a'),_0x5c70c9['contactNumber']);if(_0x70f091[_0x7abe('0x2b')][_0x7abe('0x15')]>0x0){var _0xd0a82a=_[_0x7abe('0x2c')](_0x70f091['contacts'],function(_0x51c92b){if(_0x51c92b[_0x7abe('0x2d')]===_0x5c70c9[_0x7abe('0x2e')]||_0x51c92b[_0x7abe('0x2f')]===_0x5c70c9['contactNumber']){return _0x51c92b;}});if(_0xd0a82a){_0x5c70c9[_0x7abe('0x30')]=_0xd0a82a['id'];logger['info'](_0x7abe('0x31'),_0x5c70c9[_0x7abe('0x30')]);_0x3ad479(_0x5c70c9);}else{return createEndUser(_0x5c70c9,_0x24e0e4,_0x523c62,_0x40ec51)[_0x7abe('0x13')](function(_0x630bde){logger[_0x7abe('0x11')](_0x7abe('0x32'),_0x5c70c9[_0x7abe('0x30')]);_0x3ad479(_0x630bde);});}}else{return createEndUser(_0x5c70c9,_0x24e0e4,_0x523c62,_0x40ec51)['then'](function(_0x763194){logger[_0x7abe('0x11')](_0x7abe('0x32'),_0x5c70c9[_0x7abe('0x30')]);_0x3ad479(_0x763194);});}})[_0x7abe('0x23')](function(_0x196883){throw new Error(_0x196883[_0x7abe('0x19')]);});});};}function createEndUser(_0x2bd9bf,_0x1e2903,_0x125c39,_0x17b2a6){return new Promise(function(_0x115dc1,_0xe2530d){var _0x37f9c3=moment();var _0xbb0807={'method':'POST','uri':_0x17b2a6+_0x7abe('0x33'),'body':{'contact':{'last_name':_0x2bd9bf[_0x7abe('0x2e')],'work_number':_0x2bd9bf[_0x7abe('0x2e')],'mobile_number':_0x2bd9bf['contactNumber'],'owner_id':_0x2bd9bf[_0x7abe('0x20')],'created_at':_0x37f9c3['format'](_0x7abe('0x34'))}},'json':!![]};_0xbb0807[_0x7abe('0x10')]=_0x125c39;logger[_0x7abe('0x11')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0xbb0807)[_0x7abe('0x13')](function(_0x339543){_0x2bd9bf[_0x7abe('0x30')]=_0x339543[_0x7abe('0x35')]['id'];_0x115dc1(_0x2bd9bf);})[_0x7abe('0x23')](function(_0x1e1850){logger[_0x7abe('0x18')]('['+[_0x1e2903[_0x7abe('0x24')]()]+']',_0x1e1850[_0x7abe('0x19')]);_0xe2530d(_0x1e1850['message']);});});}function getTicket(_0x29e503,_0x85c795,_0xc762ef,_0x1970ff,_0x4cbc67){return function(_0x176eb4){logger[_0x7abe('0x11')](_0x7abe('0x36'));return new Promise(function(_0x52216e,_0x30e890){var _0x49cb9e=moment();var _0xb4ea23={'method':_0x7abe('0x37'),'uri':_0xc762ef+_0x7abe('0x38'),'body':{'title':intUtil[_0x7abe('0x39')](_0x1970ff[_0x7abe('0x3a')],_0x4cbc67,'\x20'),'description':intUtil['getString'](_0x1970ff[_0x7abe('0x3b')],_0x4cbc67,'\x0a'),'owner_id':_0x176eb4[_0x7abe('0x20')],'creater_id':_0x176eb4['adminId'],'targetable_id':_0x176eb4[_0x7abe('0x30')],'targetable_type':'Contact','created_at':_0x49cb9e[_0x7abe('0x3c')](_0x7abe('0x34')),'due_date':_0x49cb9e[_0x7abe('0x3d')](0x1e,'m')[_0x7abe('0x3c')](_0x7abe('0x34'))},'json':!![]};_0xb4ea23[_0x7abe('0x10')]=_0x85c795;return rp(_0xb4ea23)['then'](function(_0x402a12){_0x176eb4[_0x7abe('0x3e')]=_0x402a12[_0x7abe('0x3f')]['id'];logger[_0x7abe('0x11')](_0x7abe('0x40'),_0x176eb4[_0x7abe('0x3e')]);_0x52216e(_0x176eb4);})[_0x7abe('0x23')](function(_0x194129){logger[_0x7abe('0x18')]('['+[_0x29e503[_0x7abe('0x24')]()]+']',_0x194129[_0x7abe('0x19')]);_0x30e890(_0x194129[_0x7abe('0x19')]);});});};}function emit(_0x3c7312,_0x82c244,_0x46dd74){var _0x978224={'uri':_0x3c7312+_0x7abe('0x41')+_0x46dd74};io['to'](util[_0x7abe('0x3c')](_0x7abe('0x42'),_0x82c244))[_0x7abe('0x43')](_0x7abe('0x44'),_0x978224);}exports['cs']=function(_0x1c1b1c,_0x10260d,_0x5ae231,_0xaf4d6d,_0x42bc1d,_0x2f091b,_0x303e4d,_0xd19a82){var _0x167960={};var _0x31cee5={'Authorization':_0x7abe('0x45')+_0x2f091b[_0x7abe('0x46')]};_0x2f091b[_0x7abe('0x47')]=intUtil[_0x7abe('0x48')](_0x2f091b[_0x7abe('0x47')]);_0x2f091b['serverUrl']=intUtil['stripTrailingSlash'](_0x2f091b[_0x7abe('0x49')]);var _0x337738=_0x2f091b['remoteUri'];_0x167960[_0x7abe('0x22')]=_0x2f091b['username'];_0x167960['contactNumber']=_0xd19a82[_0x7abe('0x4a')]()===_0x7abe('0x4b')?_0x10260d[_0x7abe('0x4c')]:_0x10260d[_0x7abe('0x4d')];_0x167960[_0x7abe('0x4e')]=_0xd19a82===_0x7abe('0x4f')||_0xd19a82===_0x7abe('0x50')?_0x7abe('0x4f'):_0x7abe('0x4b');if(_0xaf4d6d){_0x167960[_0x7abe('0x1c')]=_0xaf4d6d[_0x7abe('0x1e')];}var _0x5669f2=util[_0x7abe('0x3c')](_0x7abe('0x51'),_0x2f091b[_0x7abe('0x49')],_0x10260d['uniqueid'],md5(_0x10260d['uniqueid']));if(_0x42bc1d&&_0x42bc1d[_0x7abe('0x52')]){logger[_0x7abe('0x11')](_0x7abe('0x53'),_0x7abe('0x54'));_0x10260d['recordingURL']=_0x5669f2;}else if(_0x303e4d&&_0x303e4d[_0x7abe('0x55')]&&_0x303e4d['recordingFormat']!==_0x7abe('0x56')){logger[_0x7abe('0x11')](_0x7abe('0x57'),'Recording\x20is\x20enabled!');_0x10260d['recordingURL']=_0x5669f2;}else{_0x10260d[_0x7abe('0x58')]='';}return getAdminId(_0x167960,_0xd19a82,_0x31cee5,_0x337738)['then'](getUser(_0xd19a82,_0x31cee5,_0x337738))[_0x7abe('0x13')](getEndUser(_0xd19a82,_0x31cee5,_0x337738))[_0x7abe('0x13')](getTicket(_0xd19a82,_0x31cee5,_0x337738,_0x5ae231,_0x10260d))[_0x7abe('0x13')](function(_0x899121){logger[_0x7abe('0x11')](util['format'](_0x7abe('0x59'),_0x899121[_0x7abe('0x3e')]));if(_0xd19a82!==_0x7abe('0x50')){logger['info']('['+[_0xd19a82[_0x7abe('0x24')]()]+']',_0x7abe('0x5a'));emit(_0x337738,_0xaf4d6d['name'],_0x899121[_0x7abe('0x30')]);}})[_0x7abe('0x23')](function(_0x217d23){logger['error']('['+[_0xd19a82[_0x7abe('0x24')]()]+_0x7abe('0x5b'),util['inspect'](_0x217d23,{'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 9059617..bfbed12 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 _0xe605=['./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','zoho','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','log','EVENT\x20UNKNOWN','freshdesk','vtiger','dynamics365','unknown\x20integration','../../../../config/logger','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','util','./salesforce','./sugarcrm','./freshdesk','./zoho'];(function(_0x37e3d3,_0x48a25a){var _0x5b3db5=function(_0x126b52){while(--_0x126b52){_0x37e3d3['push'](_0x37e3d3['shift']());}};_0x5b3db5(++_0x48a25a);}(_0xe605,0x92));var _0x5e60=function(_0x1cb0ec,_0x66923e){_0x1cb0ec=_0x1cb0ec-0x0;var _0x4d64e0=_0xe605[_0x1cb0ec];return _0x4d64e0;};'use strict';var _=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0x5e60('0x2'));var sugarcrm=require(_0x5e60('0x3'));var freshdesk=require(_0x5e60('0x4'));var zoho=require(_0x5e60('0x5'));var desk=require(_0x5e60('0x6'));var vtiger=require(_0x5e60('0x7'));var servicenow=require(_0x5e60('0x8'));var dynamics365=require(_0x5e60('0x9'));var freshsales=require(_0x5e60('0xa'));var integrations=[_0x5e60('0xb'),_0x5e60('0xc'),_0x5e60('0xd'),'freshdesk',_0x5e60('0xe'),'desk','vtiger','dynamics365',_0x5e60('0xf'),_0x5e60('0x10')];exports[_0x5e60('0x11')]=function(_0x2c5425,_0x331b3e,_0x2cbe4e,_0x56f05a,_0x6ab0ce,_0x527f7b){if(_0x2cbe4e){if(_[_0x5e60('0x12')](integrations,_0x2c5425[_0x5e60('0x13')][_0x5e60('0x14')]())){try{var _0x51e7f6=null;var _0x371df7='';var _0x178782=_0x2cbe4e[_0x2c5425[_0x5e60('0x13')][_0x5e60('0x14')]()];if(_0x178782){var _0x2874c4=_0x178782[_0x2c5425[_0x5e60('0x15')]];if(_0x2874c4){var _0x4fd10e=_[_0x5e60('0x16')](_0x2874c4[_0x5e60('0x17')],{'id':parseInt(_0x2c5425[_0x5e60('0x18')],0xa)});if(_0x4fd10e){if(_0x56f05a){if(_0x6ab0ce&&_0x331b3e[_0x5e60('0x19')]){_0x371df7='queue';}else if(_0x331b3e[_0x5e60('0x1a')]){_0x371df7='outbound';}else{console[_0x5e60('0x1b')](_0x5e60('0x1c'),_0x331b3e);}}else{_0x371df7='unmanaged';}switch(_0x2c5425[_0x5e60('0x13')][_0x5e60('0x14')]()){case _0x5e60('0xb'):zendesk[_0x371df7](_0x2c5425,_0x331b3e,_0x4fd10e,_0x56f05a,_0x6ab0ce,_0x2874c4,_0x527f7b);break;case _0x5e60('0xc'):salesforce[_0x371df7](_0x2c5425,_0x331b3e,_0x4fd10e,_0x56f05a,_0x6ab0ce,_0x2874c4,_0x527f7b);break;case'sugarcrm':sugarcrm[_0x371df7](_0x2c5425,_0x331b3e,_0x4fd10e,_0x56f05a,_0x6ab0ce,_0x2874c4,_0x527f7b);break;case _0x5e60('0x1d'):freshdesk[_0x371df7](_0x2c5425,_0x331b3e,_0x4fd10e,_0x56f05a,_0x6ab0ce,_0x2874c4,_0x527f7b);break;case _0x5e60('0xe'):zoho[_0x371df7](_0x2c5425,_0x331b3e,_0x4fd10e,_0x56f05a,_0x6ab0ce,_0x2874c4,_0x527f7b);break;case'desk':desk[_0x371df7](_0x2c5425,_0x331b3e,_0x4fd10e,_0x56f05a,_0x6ab0ce,_0x2874c4,_0x527f7b);break;case _0x5e60('0x1e'):vtiger[_0x371df7](_0x2c5425,_0x331b3e,_0x4fd10e,_0x56f05a,_0x6ab0ce,_0x2874c4,_0x527f7b);break;case _0x5e60('0xf'):freshsales['cs'](_0x2c5425,_0x331b3e,_0x4fd10e,_0x56f05a,_0x6ab0ce,_0x2874c4,_0x527f7b,_0x371df7);break;case _0x5e60('0x10'):servicenow['cs'](_0x2c5425,_0x331b3e,_0x4fd10e,_0x56f05a,_0x6ab0ce,_0x2874c4,_0x527f7b,_0x371df7);break;case _0x5e60('0x1f'):dynamics365['cs'](_0x2c5425,_0x331b3e,_0x4fd10e,_0x56f05a,_0x6ab0ce,_0x2874c4,_0x527f7b,_0x371df7);break;default:console[_0x5e60('0x1b')](_0x5e60('0x20'));}}else{_0x51e7f6=require(_0x5e60('0x21'))(_0x2c5425[_0x5e60('0x13')][_0x5e60('0x14')]());_0x51e7f6[_0x5e60('0x22')](_0x5e60('0x23'),util['format'](_0x5e60('0x24'),_0x2c5425['data1'][_0x5e60('0x14')](),_0x2c5425[_0x5e60('0x18')]));}}else{_0x51e7f6=require(_0x5e60('0x21'))(_0x2c5425[_0x5e60('0x13')][_0x5e60('0x14')]());_0x51e7f6[_0x5e60('0x22')](_0x5e60('0x23'),util['format'](_0x5e60('0x25'),_0x2c5425[_0x5e60('0x13')][_0x5e60('0x14')](),_0x2c5425['data2']));}}else{}}catch(_0x45cb62){console[_0x5e60('0x22')](_0x45cb62);}}}}; \ No newline at end of file +var _0x0598=['../../../../config/logger','error','[EXEC]','data3','%s\x20account\x20#%s\x20not\x20found','data2','lodash','util','./salesforce','./zoho','./desk','./freshsales','zendesk','freshdesk','zoho','desk','vtiger','servicenow','exec','includes','data1','toLowerCase','Configurations','queue','routeId','unmanaged','salesforce','log'];(function(_0x190dbd,_0x24a507){var _0x868d27=function(_0x253c6f){while(--_0x253c6f){_0x190dbd['push'](_0x190dbd['shift']());}};_0x868d27(++_0x24a507);}(_0x0598,0x92));var _0x8059=function(_0x6b02d1,_0x561b58){_0x6b02d1=_0x6b02d1-0x0;var _0x52b7ec=_0x0598[_0x6b02d1];return _0x52b7ec;};'use strict';var _=require(_0x8059('0x0'));var util=require(_0x8059('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0x8059('0x2'));var sugarcrm=require('./sugarcrm');var freshdesk=require('./freshdesk');var zoho=require(_0x8059('0x3'));var desk=require(_0x8059('0x4'));var vtiger=require('./vtiger');var servicenow=require('./servicenow');var dynamics365=require('./dynamics365');var freshsales=require(_0x8059('0x5'));var integrations=[_0x8059('0x6'),'salesforce','sugarcrm',_0x8059('0x7'),_0x8059('0x8'),_0x8059('0x9'),_0x8059('0xa'),'dynamics365','freshsales',_0x8059('0xb')];exports[_0x8059('0xc')]=function(_0x336f85,_0x5097d6,_0x283b63,_0x52a60d,_0x551d9e,_0x2a60d7){if(_0x283b63){if(_[_0x8059('0xd')](integrations,_0x336f85['data1']['toLowerCase']())){try{var _0x4f98b8=null;var _0x1ead10='';var _0x2d26e2=_0x283b63[_0x336f85[_0x8059('0xe')][_0x8059('0xf')]()];if(_0x2d26e2){var _0x35c1f3=_0x2d26e2[_0x336f85['data2']];if(_0x35c1f3){var _0x11218f=_['find'](_0x35c1f3[_0x8059('0x10')],{'id':parseInt(_0x336f85['data3'],0xa)});if(_0x11218f){if(_0x52a60d){if(_0x551d9e&&_0x5097d6[_0x8059('0x11')]){_0x1ead10=_0x8059('0x11');}else if(_0x5097d6[_0x8059('0x12')]){_0x1ead10='outbound';}else{console['log']('EVENT\x20UNKNOWN',_0x5097d6);}}else{_0x1ead10=_0x8059('0x13');}switch(_0x336f85[_0x8059('0xe')][_0x8059('0xf')]()){case _0x8059('0x6'):zendesk[_0x1ead10](_0x336f85,_0x5097d6,_0x11218f,_0x52a60d,_0x551d9e,_0x35c1f3,_0x2a60d7);break;case _0x8059('0x14'):salesforce[_0x1ead10](_0x336f85,_0x5097d6,_0x11218f,_0x52a60d,_0x551d9e,_0x35c1f3,_0x2a60d7);break;case'sugarcrm':sugarcrm[_0x1ead10](_0x336f85,_0x5097d6,_0x11218f,_0x52a60d,_0x551d9e,_0x35c1f3,_0x2a60d7);break;case _0x8059('0x7'):freshdesk[_0x1ead10](_0x336f85,_0x5097d6,_0x11218f,_0x52a60d,_0x551d9e,_0x35c1f3,_0x2a60d7);break;case _0x8059('0x8'):zoho[_0x1ead10](_0x336f85,_0x5097d6,_0x11218f,_0x52a60d,_0x551d9e,_0x35c1f3,_0x2a60d7);break;case _0x8059('0x9'):desk[_0x1ead10](_0x336f85,_0x5097d6,_0x11218f,_0x52a60d,_0x551d9e,_0x35c1f3,_0x2a60d7);break;case _0x8059('0xa'):vtiger[_0x1ead10](_0x336f85,_0x5097d6,_0x11218f,_0x52a60d,_0x551d9e,_0x35c1f3,_0x2a60d7);break;case'freshsales':freshsales['cs'](_0x336f85,_0x5097d6,_0x11218f,_0x52a60d,_0x551d9e,_0x35c1f3,_0x2a60d7,_0x1ead10);break;case _0x8059('0xb'):servicenow['cs'](_0x336f85,_0x5097d6,_0x11218f,_0x52a60d,_0x551d9e,_0x35c1f3,_0x2a60d7,_0x1ead10);break;case'dynamics365':dynamics365['cs'](_0x336f85,_0x5097d6,_0x11218f,_0x52a60d,_0x551d9e,_0x35c1f3,_0x2a60d7,_0x1ead10);break;default:console[_0x8059('0x15')]('unknown\x20integration');}}else{_0x4f98b8=require(_0x8059('0x16'))(_0x336f85['data1'][_0x8059('0xf')]());_0x4f98b8[_0x8059('0x17')](_0x8059('0x18'),util['format']('%s\x20configuration\x20#%s\x20not\x20found',_0x336f85[_0x8059('0xe')][_0x8059('0xf')](),_0x336f85[_0x8059('0x19')]));}}else{_0x4f98b8=require(_0x8059('0x16'))(_0x336f85['data1'][_0x8059('0xf')]());_0x4f98b8[_0x8059('0x17')](_0x8059('0x18'),util['format'](_0x8059('0x1a'),_0x336f85[_0x8059('0xe')][_0x8059('0xf')](),_0x336f85[_0x8059('0x1b')]));}}else{}}catch(_0x59d3a6){console[_0x8059('0x17')](_0x59d3a6);}}}}; \ 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 8959ce2..d51be47 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 _0xe3d1=['Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','upperFirst','create','type','idField','content','variable','variableName','toString','customVariable','Variable','name','password','concat','Connection','remoteUri','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','catch','stringify','outbound','recordingFormat','none','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','trigger:salesforce:display','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','jsforce','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','ticketType','Task','utc','getString','Subjects','Descriptions','Case','assign','ContactId','isNil','validateEmail','sobject','User','then','find','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','display_name','info','user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','Contact','execute','length','Lead','contact','lead','Phone','format'];(function(_0x5695a2,_0xf3ce4a){var _0x4bc1f3=function(_0x4c8c81){while(--_0x4c8c81){_0x5695a2['push'](_0x5695a2['shift']());}};_0x4bc1f3(++_0xf3ce4a);}(_0xe3d1,0x17e));var _0x1e3d=function(_0x47604d,_0x15a014){_0x47604d=_0x47604d-0x0;var _0x388e4c=_0xe3d1[_0x47604d];return _0x388e4c;};'use strict';var _=require(_0x1e3d('0x0'));var rp=require(_0x1e3d('0x1'));var moment=require(_0x1e3d('0x2'));var BPromise=require(_0x1e3d('0x3'));var md5=require('md5');var jsforce=require(_0x1e3d('0x4'));var util=require('util');var Redis=require(_0x1e3d('0x5'));var intUtil=require('./util');var config=require(_0x1e3d('0x6'));var logger=require(_0x1e3d('0x7'))('salesforce');config[_0x1e3d('0x8')]=_[_0x1e3d('0x9')](config[_0x1e3d('0x8')],{'host':_0x1e3d('0xa'),'port':0x18eb});var io=require(_0x1e3d('0xb'))(new Redis(config[_0x1e3d('0x8')]));function emit(_0x6bd1ef,_0x3eeed8,_0x1ad720){io['to'](_0x6bd1ef)[_0x1e3d('0xc')](_0x3eeed8,_0x1ad720);}function getTicket(_0x3a80df,_0x4860e3,_0x26f885,_0x43d173,_0x2ca3a2,_0x21c84c,_0x2aefdd,_0x277680){var _0x4e9da4={};if(_0x43d173[_0x1e3d('0xd')]===_0x1e3d('0xe')){_0x4e9da4=Object['assign']({},{'OwnerId':_0x4860e3['id'],'ActivityDate':moment[_0x1e3d('0xf')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x1e3d('0x10')](_0x43d173[_0x1e3d('0x11')],_0x2ca3a2,'\x20'),'Description':intUtil[_0x1e3d('0x10')](_0x43d173[_0x1e3d('0x12')],_0x2ca3a2,'\x0a')},getCustomFields(_0x21c84c,_0x2ca3a2));if(_0x26f885){_0x4e9da4['WhoId']=_0x26f885['id'];}}else if(_0x43d173[_0x1e3d('0xd')]===_0x1e3d('0x13')){_0x4e9da4=Object[_0x1e3d('0x14')]({},{'OwnerId':_0x4860e3['id'],'Subject':intUtil[_0x1e3d('0x10')](_0x43d173[_0x1e3d('0x11')],_0x2ca3a2,'\x20'),'Description':intUtil[_0x1e3d('0x10')](_0x43d173[_0x1e3d('0x12')],_0x2ca3a2,'\x0a')},getCustomFields(_0x21c84c,_0x2ca3a2));if(_0x26f885){_0x4e9da4[_0x1e3d('0x15')]=_0x26f885['id'];}}return _0x2aefdd['sobject'](_0x43d173['ticketType'])['create'](_0x4e9da4);}function getUser(_0x58bb88,_0x255281,_0xd34003){if(!_[_0x1e3d('0x16')](_0x255281)&&intUtil[_0x1e3d('0x17')](_0x255281)){var _0xe73c90={'Email':_0x255281};var _0x527902={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0xd34003[_0x1e3d('0x18')](_0x1e3d('0x19'))['find'](_0xe73c90,_0x527902)['execute']()[_0x1e3d('0x1a')](function(_0xbcf7ca){if(_0xbcf7ca['length']){var _0x37df57=_[_0x1e3d('0x1b')](_0xbcf7ca,function(_0x4f2d3e){return _0x4f2d3e[_0x1e3d('0x1c')]===_0x255281;});if(_0x37df57){logger['info'](_0x1e3d('0x1d'),_0x255281);return BPromise[_0x1e3d('0x1e')]({'id':_0x37df57['Id'],'name':_0x37df57[_0x1e3d('0x1f')]});}}else{logger['info'](_0x1e3d('0x20'),_0x255281);return _0xd34003[_0x1e3d('0x21')]()[_0x1e3d('0x1a')](function(_0x5c76f4){return BPromise[_0x1e3d('0x1e')]({'id':_0x5c76f4['user_id'],'name':_0x5c76f4[_0x1e3d('0x22')]});});}});}else{logger[_0x1e3d('0x23')](_0x1e3d('0x20'),_0x255281);return _0xd34003[_0x1e3d('0x21')]()['then'](function(_0x2049e2){return BPromise[_0x1e3d('0x1e')]({'id':_0x2049e2[_0x1e3d('0x24')],'name':_0x2049e2[_0x1e3d('0x22')]});});}}function getEndUser(_0x3647c0,_0x82fef6,_0x2fa3b9,_0x419301,_0x4260fb){var _0x35c693={'Phone':_0x419301};var _0x50fd38={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x1e3d('0x1a')](function(){if(_0x82fef6[_0x1e3d('0xd')]===_0x1e3d('0xe')){logger['info'](_0x1e3d('0x25'),_0x419301,_0x82fef6['moduleSearch']);switch(_0x82fef6['moduleSearch']){case'contact_lead':return _0x4260fb['sobject'](_0x1e3d('0x26'))['find'](_0x35c693,_0x50fd38)[_0x1e3d('0x27')]()[_0x1e3d('0x1a')](function(_0x171fb1){if(_0x171fb1&&_0x171fb1[_0x1e3d('0x28')]){return _0x171fb1;}else{return _0x4260fb[_0x1e3d('0x18')](_0x1e3d('0x29'))[_0x1e3d('0x1b')](_0x35c693,_0x50fd38);}});case _0x1e3d('0x2a'):return _0x4260fb[_0x1e3d('0x18')]('Contact')[_0x1e3d('0x1b')](_0x35c693,_0x50fd38)['execute']();case _0x1e3d('0x2b'):return _0x4260fb[_0x1e3d('0x18')](_0x1e3d('0x29'))[_0x1e3d('0x1b')](_0x35c693,_0x50fd38);default:return null;}}else if(_0x82fef6[_0x1e3d('0xd')]==='Case'){logger[_0x1e3d('0x23')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x419301,_0x1e3d('0x2a'));return _0x4260fb[_0x1e3d('0x18')](_0x1e3d('0x26'))[_0x1e3d('0x1b')](_0x35c693,_0x50fd38)[_0x1e3d('0x27')]();}})[_0x1e3d('0x1a')](function(_0x2c1439){if(_0x2c1439&&_0x2c1439[_0x1e3d('0x28')]){var _0x512d40=_['find'](_0x2c1439,function(_0x4cceb6){return _0x4cceb6['Phone']===_0x419301;});if(_0x512d40){return BPromise[_0x1e3d('0x1e')]({'id':_0x512d40['Id'],'name':_0x512d40[_0x1e3d('0x1f')],'phone':_0x512d40[_0x1e3d('0x2c')]});}}})[_0x1e3d('0x1a')](function(_0x534302){if(_0x534302){logger['info']('Enduser\x20with\x20phone\x20%s\x20found.',_0x419301);return BPromise[_0x1e3d('0x1e')](_0x534302);}else{logger['info']('Enduser\x20with\x20phone\x20%s\x20not\x20found.',_0x419301);var _0x4a3217={'LastName':_0x2fa3b9!==''?_0x2fa3b9:util[_0x1e3d('0x2d')](_0x1e3d('0x2e'),_0x419301),'Phone':_0x419301};if(_0x82fef6[_0x1e3d('0x2f')]){if(_0x82fef6['moduleCreate']===_0x1e3d('0x2a')){logger[_0x1e3d('0x23')](_0x1e3d('0x30'),_0x419301,_0x82fef6[_0x1e3d('0x2f')]);}else if(_0x82fef6[_0x1e3d('0x2f')]===_0x1e3d('0x2b')&&_0x82fef6[_0x1e3d('0xd')]===_0x1e3d('0xe')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x419301,_0x82fef6[_0x1e3d('0x2f')]);_0x4a3217[_0x1e3d('0x31')]=_0x1e3d('0x32');}else{return null;}}return _0x4260fb[_0x1e3d('0x18')](_[_0x1e3d('0x33')](_0x82fef6[_0x1e3d('0x2f')]))[_0x1e3d('0x34')](_0x4a3217);}});}function getCustomFields(_0x24c9d5,_0x684988){var _0x1bf352={};if(_0x24c9d5[_0x1e3d('0x28')]>0x0){_['forEach'](_0x24c9d5,function(_0x3356c2){if(_0x3356c2[_0x1e3d('0x35')]==='string'&&_0x3356c2[_0x1e3d('0x36')]){_0x1bf352[_0x3356c2[_0x1e3d('0x36')]]=_0x3356c2[_0x1e3d('0x37')]['toString']();}else if(_0x3356c2['type']===_0x1e3d('0x38')&&_0x3356c2[_0x1e3d('0x39')]&&_0x3356c2[_0x1e3d('0x36')]){_0x684988[_0x3356c2[_0x1e3d('0x39')]]&&(_0x1bf352[_0x3356c2[_0x1e3d('0x36')]]=_0x684988[_0x3356c2[_0x1e3d('0x39')]][_0x1e3d('0x3a')]());}else if(_0x3356c2[_0x1e3d('0x35')]===_0x1e3d('0x3b')&&_0x3356c2[_0x1e3d('0x3c')]&&_0x3356c2[_0x1e3d('0x3c')][_0x1e3d('0x3d')]&&_0x3356c2[_0x1e3d('0x36')]){_0x684988[_0x3356c2['Variable'][_0x1e3d('0x3d')]['toLowerCase']()]&&(_0x1bf352[_0x3356c2['idField']]=_0x684988[_0x3356c2['Variable'][_0x1e3d('0x3d')]['toLowerCase']()][_0x1e3d('0x3a')]());}});}return _0x1bf352;}function getConnection(_0x22c858){var _0x872262=_0x22c858[_0x1e3d('0x3e')][_0x1e3d('0x3f')](_0x22c858['securityToken']);var _0x4d10bd=new jsforce[(_0x1e3d('0x40'))]({'oauth2':{'loginUrl':_0x22c858[_0x1e3d('0x41')]||'https://login.salesforce.com','clientId':_0x22c858[_0x1e3d('0x42')],'clientSecret':_0x22c858[_0x1e3d('0x43')]}});return _0x4d10bd[_0x1e3d('0x44')](_0x22c858[_0x1e3d('0x45')],_0x872262)[_0x1e3d('0x1a')](function(){logger[_0x1e3d('0x23')](_0x1e3d('0x46'));return _0x4d10bd;});}exports[_0x1e3d('0x47')]=function(_0x478edc,_0x37702c,_0x594469,_0x19404f,_0x1dd6fb,_0x2e7b2a){var _0x1e07e7,_0x3e3ac0,_0x3df026,_0x5778a9;_0x2e7b2a[_0x1e3d('0x48')]=intUtil[_0x1e3d('0x49')](_0x2e7b2a['serverUrl']);_0x2e7b2a[_0x1e3d('0x41')]=intUtil['stripTrailingSlash'](_0x2e7b2a[_0x1e3d('0x41')]);if(_0x1dd6fb&&_0x1dd6fb[_0x1e3d('0x4a')]){logger[_0x1e3d('0x23')](_0x1e3d('0x4b'),_0x1e3d('0x4c'));_0x37702c[_0x1e3d('0x4d')]=util[_0x1e3d('0x2d')](_0x1e3d('0x4e'),_0x2e7b2a[_0x1e3d('0x48')],_0x37702c['uniqueid'],md5(_0x37702c[_0x1e3d('0x4f')]));}else{_0x37702c[_0x1e3d('0x4d')]='';}return getConnection(_0x2e7b2a)[_0x1e3d('0x1a')](function(_0x182969){_0x5778a9=_0x182969;return getUser(_0x2e7b2a,_0x19404f[_0x1e3d('0x50')],_0x5778a9);})[_0x1e3d('0x1a')](function(_0x5e9b40){_0x1e07e7=_0x5e9b40;return getEndUser(_0x2e7b2a,_0x594469,_0x37702c[_0x1e3d('0x51')],_0x37702c[_0x1e3d('0x52')],_0x5778a9);})['then'](function(_0x4d2575){_0x3e3ac0=_0x4d2575;return getTicket(_0x2e7b2a,_0x1e07e7,_0x3e3ac0,_0x594469,_0x37702c,_0x594469[_0x1e3d('0x53')],_0x5778a9,_0x1e3d('0x47'));})[_0x1e3d('0x1a')](function(_0x4beb9c){_0x3df026=_0x4beb9c;logger['info']('[QUEUE]\x20Ticket\x20%s\x20created',_0x3df026['id']);logger[_0x1e3d('0x23')](_0x1e3d('0x54'),_0x3df026['id'],_0x19404f[_0x1e3d('0x3d')],_0x2e7b2a[_0x1e3d('0x35')]);switch(_0x2e7b2a['type']){case _0x1e3d('0x55'):emit(util['format'](_0x1e3d('0x56'),_0x19404f[_0x1e3d('0x3d')]),'trigger:salesforce:display',{'recordId':_0x3df026['id']});break;case _0x1e3d('0x57'):emit(util['format'](_0x1e3d('0x56'),_0x19404f[_0x1e3d('0x3d')]),_0x1e3d('0x58'),{'uri':util['format'](_0x1e3d('0x59'),_0x5778a9[_0x1e3d('0x5a')],_0x3df026['id'])});break;default:logger[_0x1e3d('0x5b')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x1e3d('0x5c')](function(_0x55447e){logger[_0x1e3d('0x5b')](_0x1e3d('0x4b'),JSON[_0x1e3d('0x5d')](_0x55447e));});};exports[_0x1e3d('0x5e')]=function(_0x25cf25,_0x4adf84,_0x333299,_0x53574a,_0x176e37,_0x36d14f,_0x3ba006){var _0x47e091,_0x7a37b9,_0x124956,_0x187593;_0x36d14f[_0x1e3d('0x48')]=intUtil[_0x1e3d('0x49')](_0x36d14f[_0x1e3d('0x48')]);_0x36d14f[_0x1e3d('0x41')]=intUtil['stripTrailingSlash'](_0x36d14f['remoteUri']);if(_0x3ba006&&_0x3ba006[_0x1e3d('0x5f')]&&_0x3ba006[_0x1e3d('0x5f')]!==_0x1e3d('0x60')){logger[_0x1e3d('0x23')]('[OUTBOUND]',_0x1e3d('0x4c'));_0x4adf84[_0x1e3d('0x4d')]=util[_0x1e3d('0x2d')](_0x1e3d('0x4e'),_0x36d14f['serverUrl'],_0x4adf84['uniqueid'],md5(_0x4adf84[_0x1e3d('0x4f')]));}return getConnection(_0x36d14f)[_0x1e3d('0x1a')](function(_0x4987c8){_0x187593=_0x4987c8;return getUser(_0x36d14f,_0x53574a[_0x1e3d('0x50')],_0x187593);})['then'](function(_0x5d3741){_0x47e091=_0x5d3741;return getEndUser(_0x36d14f,_0x333299,_0x4adf84['destcalleridname'],_0x4adf84[_0x1e3d('0x61')],_0x187593);})[_0x1e3d('0x1a')](function(_0x4d9638){_0x7a37b9=_0x4d9638;return getTicket(_0x36d14f,_0x47e091,_0x7a37b9,_0x333299,_0x4adf84,_0x333299[_0x1e3d('0x53')],_0x187593,_0x1e3d('0x5e'));})[_0x1e3d('0x1a')](function(_0x2b31e0){_0x124956=_0x2b31e0;logger[_0x1e3d('0x23')](_0x1e3d('0x62'),_0x124956['id']);logger['info']('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x124956['id'],_0x53574a[_0x1e3d('0x3d')],_0x36d14f[_0x1e3d('0x35')]);switch(_0x36d14f[_0x1e3d('0x35')]){case _0x1e3d('0x55'):emit(util[_0x1e3d('0x2d')](_0x1e3d('0x56'),_0x53574a['name']),_0x1e3d('0x63'),{'recordId':_0x124956['id']});break;case _0x1e3d('0x57'):emit(util[_0x1e3d('0x2d')](_0x1e3d('0x56'),_0x53574a['name']),_0x1e3d('0x58'),{'uri':util[_0x1e3d('0x2d')](_0x1e3d('0x59'),_0x187593['instanceUrl'],_0x124956['id'])});break;default:logger[_0x1e3d('0x5b')](_0x1e3d('0x64'),_0x1e3d('0x65'));}})[_0x1e3d('0x5c')](function(_0x5b6b76){logger[_0x1e3d('0x5b')](_0x1e3d('0x64'),JSON[_0x1e3d('0x5d')](_0x5b6b76));});};exports[_0x1e3d('0x66')]=function(_0xdb5e8,_0x2f891d,_0x340a01,_0x4d359b,_0x172663,_0x2092b2){var _0x432565,_0x33f510,_0x43edf0,_0x41e72b;_0x2092b2[_0x1e3d('0x48')]=intUtil[_0x1e3d('0x49')](_0x2092b2['serverUrl']);_0x2092b2[_0x1e3d('0x41')]=intUtil[_0x1e3d('0x49')](_0x2092b2[_0x1e3d('0x41')]);if(_0x172663&&_0x172663[_0x1e3d('0x4a')]){logger[_0x1e3d('0x23')]('['+_0x2f891d[_0x1e3d('0x67')][_0x1e3d('0x68')]()+']','Recording\x20is\x20enabled!');_0x2f891d['recordingURL']=util['format'](_0x1e3d('0x4e'),_0x2092b2[_0x1e3d('0x48')],_0x2f891d[_0x1e3d('0x4f')],md5(_0x2f891d['uniqueid']));}else{_0x2f891d[_0x1e3d('0x4d')]='';}return getConnection(_0x2092b2)[_0x1e3d('0x1a')](function(_0x1931ca){_0x41e72b=_0x1931ca;if(!_[_0x1e3d('0x16')](_0x4d359b)){return getUser(_0x2092b2,_0x4d359b[_0x1e3d('0x3d')],_0x41e72b);}else{return getUser(_0x2092b2,null,_0x41e72b);}})[_0x1e3d('0x1a')](function(_0xf19df){_0x432565=_0xf19df;return getEndUser(_0x2092b2,_0x340a01,_0x2f891d['calleridname'],_0x2f891d[_0x1e3d('0x52')],_0x41e72b);})[_0x1e3d('0x1a')](function(_0x4bb007){_0x33f510=_0x4bb007;return getTicket(_0x2092b2,_0x432565,_0x33f510,_0x340a01,_0x2f891d,_0x340a01[_0x1e3d('0x53')],_0x41e72b);})[_0x1e3d('0x1a')](function(_0x227aba){_0x43edf0=_0x227aba;logger[_0x1e3d('0x23')]('['+_0x2f891d['lastevent'][_0x1e3d('0x68')]()+_0x1e3d('0x69'),_0x43edf0['id']);logger[_0x1e3d('0x23')]('['+_0x2f891d[_0x1e3d('0x67')][_0x1e3d('0x68')]()+_0x1e3d('0x6a'),_0x2092b2[_0x1e3d('0x35')]);})[_0x1e3d('0x5c')](function(_0x30b760){logger[_0x1e3d('0x5b')]('['+_0x2f891d[_0x1e3d('0x67')][_0x1e3d('0x68')]()+']',JSON['stringify'](_0x30b760));});}; \ No newline at end of file +var _0x0ab0=['utc','Subjects','getString','Descriptions','WhoId','Case','sobject','create','isNil','User','find','execute','then','length','Email','info','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','resolve','user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Contact','Lead','contact','lead','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','upperFirst','forEach','type','string','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','concat','securityToken','https://login.salesforce.com','clientId','clientSecret','login','queue','serverUrl','stripTrailingSlash','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','stringify','outbound','recordingFormat','[OUTBOUND]','destcalleridname','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.','lodash','request-promise','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','emit','ticketType','Task','assign'];(function(_0x38ec6b,_0x3aafe8){var _0x2b6b62=function(_0x18cb64){while(--_0x18cb64){_0x38ec6b['push'](_0x38ec6b['shift']());}};_0x2b6b62(++_0x3aafe8);}(_0x0ab0,0x133));var _0x00ab=function(_0x319ebd,_0xca2c72){_0x319ebd=_0x319ebd-0x0;var _0x513fda=_0x0ab0[_0x319ebd];return _0x513fda;};'use strict';var _=require(_0x00ab('0x0'));var rp=require(_0x00ab('0x1'));var moment=require('moment');var BPromise=require(_0x00ab('0x2'));var md5=require(_0x00ab('0x3'));var jsforce=require(_0x00ab('0x4'));var util=require(_0x00ab('0x5'));var Redis=require(_0x00ab('0x6'));var intUtil=require(_0x00ab('0x7'));var config=require(_0x00ab('0x8'));var logger=require(_0x00ab('0x9'))(_0x00ab('0xa'));config[_0x00ab('0xb')]=_[_0x00ab('0xc')](config[_0x00ab('0xb')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x00ab('0xb')]));function emit(_0x3974d9,_0x1be142,_0x33f401){io['to'](_0x3974d9)[_0x00ab('0xd')](_0x1be142,_0x33f401);}function getTicket(_0xc4ad1b,_0x488789,_0x2673b3,_0x369d04,_0x398a69,_0x41989f,_0x427a38,_0x176e37){var _0x19a796={};if(_0x369d04[_0x00ab('0xe')]===_0x00ab('0xf')){_0x19a796=Object[_0x00ab('0x10')]({},{'OwnerId':_0x488789['id'],'ActivityDate':moment[_0x00ab('0x11')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil['getString'](_0x369d04[_0x00ab('0x12')],_0x398a69,'\x20'),'Description':intUtil[_0x00ab('0x13')](_0x369d04[_0x00ab('0x14')],_0x398a69,'\x0a')},getCustomFields(_0x41989f,_0x398a69));if(_0x2673b3){_0x19a796[_0x00ab('0x15')]=_0x2673b3['id'];}}else if(_0x369d04[_0x00ab('0xe')]===_0x00ab('0x16')){_0x19a796=Object[_0x00ab('0x10')]({},{'OwnerId':_0x488789['id'],'Subject':intUtil[_0x00ab('0x13')](_0x369d04['Subjects'],_0x398a69,'\x20'),'Description':intUtil[_0x00ab('0x13')](_0x369d04[_0x00ab('0x14')],_0x398a69,'\x0a')},getCustomFields(_0x41989f,_0x398a69));if(_0x2673b3){_0x19a796['ContactId']=_0x2673b3['id'];}}return _0x427a38[_0x00ab('0x17')](_0x369d04[_0x00ab('0xe')])[_0x00ab('0x18')](_0x19a796);}function getUser(_0x2e734d,_0x36067e,_0x407eb7){if(!_[_0x00ab('0x19')](_0x36067e)&&intUtil['validateEmail'](_0x36067e)){var _0xd5c03e={'Email':_0x36067e};var _0x1e5bdb={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x407eb7[_0x00ab('0x17')](_0x00ab('0x1a'))[_0x00ab('0x1b')](_0xd5c03e,_0x1e5bdb)[_0x00ab('0x1c')]()[_0x00ab('0x1d')](function(_0xd2f583){if(_0xd2f583[_0x00ab('0x1e')]){var _0x1d4556=_[_0x00ab('0x1b')](_0xd2f583,function(_0xcc48a){return _0xcc48a[_0x00ab('0x1f')]===_0x36067e;});if(_0x1d4556){logger[_0x00ab('0x20')](_0x00ab('0x21'),_0x36067e);return BPromise['resolve']({'id':_0x1d4556['Id'],'name':_0x1d4556[_0x00ab('0x22')]});}}else{logger[_0x00ab('0x20')](_0x00ab('0x23'),_0x36067e);return _0x407eb7[_0x00ab('0x24')]()[_0x00ab('0x1d')](function(_0x350590){return BPromise[_0x00ab('0x25')]({'id':_0x350590[_0x00ab('0x26')],'name':_0x350590['display_name']});});}});}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x36067e);return _0x407eb7['identity']()[_0x00ab('0x1d')](function(_0x58291f){return BPromise[_0x00ab('0x25')]({'id':_0x58291f[_0x00ab('0x26')],'name':_0x58291f['display_name']});});}}function getEndUser(_0x6ad510,_0x3ce62b,_0x44f6dd,_0x3d1af0,_0x1347cf){var _0x1dd72a={'Phone':_0x3d1af0};var _0x3a1c17={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x00ab('0x1d')](function(){if(_0x3ce62b[_0x00ab('0xe')]===_0x00ab('0xf')){logger['info'](_0x00ab('0x27'),_0x3d1af0,_0x3ce62b[_0x00ab('0x28')]);switch(_0x3ce62b['moduleSearch']){case _0x00ab('0x29'):return _0x1347cf[_0x00ab('0x17')](_0x00ab('0x2a'))['find'](_0x1dd72a,_0x3a1c17)[_0x00ab('0x1c')]()[_0x00ab('0x1d')](function(_0xbc65a5){if(_0xbc65a5&&_0xbc65a5[_0x00ab('0x1e')]){return _0xbc65a5;}else{return _0x1347cf['sobject'](_0x00ab('0x2b'))[_0x00ab('0x1b')](_0x1dd72a,_0x3a1c17);}});case _0x00ab('0x2c'):return _0x1347cf[_0x00ab('0x17')](_0x00ab('0x2a'))['find'](_0x1dd72a,_0x3a1c17)['execute']();case _0x00ab('0x2d'):return _0x1347cf['sobject'](_0x00ab('0x2b'))['find'](_0x1dd72a,_0x3a1c17);default:return null;}}else if(_0x3ce62b[_0x00ab('0xe')]===_0x00ab('0x16')){logger[_0x00ab('0x20')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x3d1af0,_0x00ab('0x2c'));return _0x1347cf['sobject'](_0x00ab('0x2a'))[_0x00ab('0x1b')](_0x1dd72a,_0x3a1c17)['execute']();}})[_0x00ab('0x1d')](function(_0x43e39a){if(_0x43e39a&&_0x43e39a[_0x00ab('0x1e')]){var _0x59f6f0=_[_0x00ab('0x1b')](_0x43e39a,function(_0x2f76fb){return _0x2f76fb[_0x00ab('0x2e')]===_0x3d1af0;});if(_0x59f6f0){return BPromise['resolve']({'id':_0x59f6f0['Id'],'name':_0x59f6f0[_0x00ab('0x22')],'phone':_0x59f6f0[_0x00ab('0x2e')]});}}})[_0x00ab('0x1d')](function(_0x577c73){if(_0x577c73){logger[_0x00ab('0x20')](_0x00ab('0x2f'),_0x3d1af0);return BPromise['resolve'](_0x577c73);}else{logger[_0x00ab('0x20')](_0x00ab('0x30'),_0x3d1af0);var _0x5d3991={'LastName':_0x44f6dd!==''?_0x44f6dd:util['format'](_0x00ab('0x31'),_0x3d1af0),'Phone':_0x3d1af0};if(_0x3ce62b['moduleCreate']){if(_0x3ce62b[_0x00ab('0x32')]==='contact'){logger[_0x00ab('0x20')](_0x00ab('0x33'),_0x3d1af0,_0x3ce62b[_0x00ab('0x32')]);}else if(_0x3ce62b[_0x00ab('0x32')]==='lead'&&_0x3ce62b['ticketType']===_0x00ab('0xf')){logger[_0x00ab('0x20')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x3d1af0,_0x3ce62b[_0x00ab('0x32')]);_0x5d3991[_0x00ab('0x34')]=_0x00ab('0x35');}else{return null;}}return _0x1347cf[_0x00ab('0x17')](_[_0x00ab('0x36')](_0x3ce62b[_0x00ab('0x32')]))['create'](_0x5d3991);}});}function getCustomFields(_0x2cd14a,_0x568415){var _0x477f0a={};if(_0x2cd14a[_0x00ab('0x1e')]>0x0){_[_0x00ab('0x37')](_0x2cd14a,function(_0x65cd0e){if(_0x65cd0e[_0x00ab('0x38')]===_0x00ab('0x39')&&_0x65cd0e[_0x00ab('0x3a')]){_0x477f0a[_0x65cd0e[_0x00ab('0x3a')]]=_0x65cd0e[_0x00ab('0x3b')][_0x00ab('0x3c')]();}else if(_0x65cd0e[_0x00ab('0x38')]===_0x00ab('0x3d')&&_0x65cd0e[_0x00ab('0x3e')]&&_0x65cd0e[_0x00ab('0x3a')]){_0x568415[_0x65cd0e['variableName']]&&(_0x477f0a[_0x65cd0e[_0x00ab('0x3a')]]=_0x568415[_0x65cd0e['variableName']][_0x00ab('0x3c')]());}else if(_0x65cd0e[_0x00ab('0x38')]===_0x00ab('0x3f')&&_0x65cd0e[_0x00ab('0x40')]&&_0x65cd0e[_0x00ab('0x40')][_0x00ab('0x41')]&&_0x65cd0e[_0x00ab('0x3a')]){_0x568415[_0x65cd0e[_0x00ab('0x40')][_0x00ab('0x41')][_0x00ab('0x42')]()]&&(_0x477f0a[_0x65cd0e[_0x00ab('0x3a')]]=_0x568415[_0x65cd0e[_0x00ab('0x40')][_0x00ab('0x41')][_0x00ab('0x42')]()][_0x00ab('0x3c')]());}});}return _0x477f0a;}function getConnection(_0x2120f6){var _0x34dca8=_0x2120f6['password'][_0x00ab('0x43')](_0x2120f6[_0x00ab('0x44')]);var _0x1204f4=new jsforce['Connection']({'oauth2':{'loginUrl':_0x2120f6['remoteUri']||_0x00ab('0x45'),'clientId':_0x2120f6[_0x00ab('0x46')],'clientSecret':_0x2120f6[_0x00ab('0x47')]}});return _0x1204f4[_0x00ab('0x48')](_0x2120f6['username'],_0x34dca8)['then'](function(){logger[_0x00ab('0x20')]('Connection\x20established.');return _0x1204f4;});}exports[_0x00ab('0x49')]=function(_0x57f362,_0x1ca26e,_0x3394fb,_0x110a6c,_0x251558,_0xc70299){var _0x17fc96,_0x498c1a,_0x338e97,_0x409829;_0xc70299[_0x00ab('0x4a')]=intUtil[_0x00ab('0x4b')](_0xc70299[_0x00ab('0x4a')]);_0xc70299['remoteUri']=intUtil['stripTrailingSlash'](_0xc70299[_0x00ab('0x4c')]);if(_0x251558&&_0x251558[_0x00ab('0x4d')]){logger['info'](_0x00ab('0x4e'),_0x00ab('0x4f'));_0x1ca26e[_0x00ab('0x50')]=util[_0x00ab('0x51')](_0x00ab('0x52'),_0xc70299[_0x00ab('0x4a')],_0x1ca26e[_0x00ab('0x53')],md5(_0x1ca26e[_0x00ab('0x53')]));}else{_0x1ca26e[_0x00ab('0x50')]='';}return getConnection(_0xc70299)[_0x00ab('0x1d')](function(_0x1c5f44){_0x409829=_0x1c5f44;return getUser(_0xc70299,_0x110a6c[_0x00ab('0x54')],_0x409829);})[_0x00ab('0x1d')](function(_0x5c54c6){_0x17fc96=_0x5c54c6;return getEndUser(_0xc70299,_0x3394fb,_0x1ca26e[_0x00ab('0x55')],_0x1ca26e[_0x00ab('0x56')],_0x409829);})[_0x00ab('0x1d')](function(_0x12ed96){_0x498c1a=_0x12ed96;return getTicket(_0xc70299,_0x17fc96,_0x498c1a,_0x3394fb,_0x1ca26e,_0x3394fb[_0x00ab('0x57')],_0x409829,_0x00ab('0x49'));})[_0x00ab('0x1d')](function(_0x503b1b){_0x338e97=_0x503b1b;logger['info'](_0x00ab('0x58'),_0x338e97['id']);logger[_0x00ab('0x20')](_0x00ab('0x59'),_0x338e97['id'],_0x110a6c['name'],_0xc70299[_0x00ab('0x38')]);switch(_0xc70299['type']){case _0x00ab('0x5a'):emit(util[_0x00ab('0x51')](_0x00ab('0x5b'),_0x110a6c[_0x00ab('0x41')]),'trigger:salesforce:display',{'recordId':_0x338e97['id']});break;case _0x00ab('0x5c'):emit(util[_0x00ab('0x51')]('user:%s',_0x110a6c[_0x00ab('0x41')]),_0x00ab('0x5d'),{'uri':util['format'](_0x00ab('0x5e'),_0x409829[_0x00ab('0x5f')],_0x338e97['id'])});break;default:logger[_0x00ab('0x60')](_0x00ab('0x61'));}})[_0x00ab('0x62')](function(_0x5bbe50){logger['error'](_0x00ab('0x4e'),JSON[_0x00ab('0x63')](_0x5bbe50));});};exports[_0x00ab('0x64')]=function(_0x104368,_0x1000f5,_0x4c6fd6,_0x1f4774,_0xe8c307,_0x296613,_0x5acc29){var _0x2d5cb1,_0x1f9f48,_0x5d4afe,_0x593694;_0x296613[_0x00ab('0x4a')]=intUtil['stripTrailingSlash'](_0x296613[_0x00ab('0x4a')]);_0x296613[_0x00ab('0x4c')]=intUtil[_0x00ab('0x4b')](_0x296613[_0x00ab('0x4c')]);if(_0x5acc29&&_0x5acc29['recordingFormat']&&_0x5acc29[_0x00ab('0x65')]!=='none'){logger[_0x00ab('0x20')](_0x00ab('0x66'),_0x00ab('0x4f'));_0x1000f5[_0x00ab('0x50')]=util[_0x00ab('0x51')](_0x00ab('0x52'),_0x296613[_0x00ab('0x4a')],_0x1000f5[_0x00ab('0x53')],md5(_0x1000f5[_0x00ab('0x53')]));}return getConnection(_0x296613)[_0x00ab('0x1d')](function(_0x460610){_0x593694=_0x460610;return getUser(_0x296613,_0x1f4774[_0x00ab('0x54')],_0x593694);})[_0x00ab('0x1d')](function(_0x3cc417){_0x2d5cb1=_0x3cc417;return getEndUser(_0x296613,_0x4c6fd6,_0x1000f5[_0x00ab('0x67')],_0x1000f5['destcalleridnum'],_0x593694);})[_0x00ab('0x1d')](function(_0x2722c7){_0x1f9f48=_0x2722c7;return getTicket(_0x296613,_0x2d5cb1,_0x1f9f48,_0x4c6fd6,_0x1000f5,_0x4c6fd6[_0x00ab('0x57')],_0x593694,_0x00ab('0x64'));})['then'](function(_0x236f2a){_0x5d4afe=_0x236f2a;logger[_0x00ab('0x20')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x5d4afe['id']);logger[_0x00ab('0x20')](_0x00ab('0x68'),_0x5d4afe['id'],_0x1f4774['name'],_0x296613[_0x00ab('0x38')]);switch(_0x296613[_0x00ab('0x38')]){case _0x00ab('0x5a'):emit(util['format'](_0x00ab('0x5b'),_0x1f4774[_0x00ab('0x41')]),'trigger:salesforce:display',{'recordId':_0x5d4afe['id']});break;case _0x00ab('0x5c'):emit(util[_0x00ab('0x51')](_0x00ab('0x5b'),_0x1f4774[_0x00ab('0x41')]),_0x00ab('0x5d'),{'uri':util['format'](_0x00ab('0x5e'),_0x593694['instanceUrl'],_0x5d4afe['id'])});break;default:logger[_0x00ab('0x60')](_0x00ab('0x66'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x00ab('0x62')](function(_0x4a36a7){logger[_0x00ab('0x60')](_0x00ab('0x66'),JSON[_0x00ab('0x63')](_0x4a36a7));});};exports['unmanaged']=function(_0x48133f,_0xc64a,_0x39b02f,_0x102a9a,_0x39b91b,_0x14fa75){var _0x2db3f2,_0x1c0c31,_0x4ac200,_0x126aa1;_0x14fa75['serverUrl']=intUtil[_0x00ab('0x4b')](_0x14fa75[_0x00ab('0x4a')]);_0x14fa75[_0x00ab('0x4c')]=intUtil[_0x00ab('0x4b')](_0x14fa75[_0x00ab('0x4c')]);if(_0x39b91b&&_0x39b91b['monitor_format']){logger['info']('['+_0xc64a[_0x00ab('0x69')]['toUpperCase']()+']',_0x00ab('0x4f'));_0xc64a[_0x00ab('0x50')]=util[_0x00ab('0x51')](_0x00ab('0x52'),_0x14fa75[_0x00ab('0x4a')],_0xc64a[_0x00ab('0x53')],md5(_0xc64a[_0x00ab('0x53')]));}else{_0xc64a['recordingURL']='';}return getConnection(_0x14fa75)[_0x00ab('0x1d')](function(_0x41c8e2){_0x126aa1=_0x41c8e2;if(!_[_0x00ab('0x19')](_0x102a9a)){return getUser(_0x14fa75,_0x102a9a['name'],_0x126aa1);}else{return getUser(_0x14fa75,null,_0x126aa1);}})['then'](function(_0x30744f){_0x2db3f2=_0x30744f;return getEndUser(_0x14fa75,_0x39b02f,_0xc64a[_0x00ab('0x55')],_0xc64a[_0x00ab('0x56')],_0x126aa1);})[_0x00ab('0x1d')](function(_0x7af855){_0x1c0c31=_0x7af855;return getTicket(_0x14fa75,_0x2db3f2,_0x1c0c31,_0x39b02f,_0xc64a,_0x39b02f['Fields'],_0x126aa1);})[_0x00ab('0x1d')](function(_0x3a7a67){_0x4ac200=_0x3a7a67;logger[_0x00ab('0x20')]('['+_0xc64a['lastevent'][_0x00ab('0x6a')]()+_0x00ab('0x6b'),_0x4ac200['id']);logger[_0x00ab('0x20')]('['+_0xc64a[_0x00ab('0x69')][_0x00ab('0x6a')]()+']\x20Integration\x20account\x20type\x20%s.',_0x14fa75['type']);})[_0x00ab('0x62')](function(_0x417a8e){logger[_0x00ab('0x60')]('['+_0xc64a[_0x00ab('0x69')][_0x00ab('0x6a')]()+']',JSON[_0x00ab('0x63')](_0x417a8e));});}; \ 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 ed5bed7..0dae5fd 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 _0x814b=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','userEmail','],\x20getUser\x20entity','length','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','type','string','nameField','customField','idField','toLowerCase','content','toString','variable','variableName','Variable','name','POST','incident','assign','getString','Subjects','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','number','label','?sysparm_query=name%3D','ticketId','Incident\x20-\x20','forEach','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','trigger:browser:url','username','password','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','format','%s/api/now/table/','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','unmanaged'];(function(_0x489226,_0x2a54d1){var _0x35377f=function(_0x1002dd){while(--_0x1002dd){_0x489226['push'](_0x489226['shift']());}};_0x35377f(++_0x2a54d1);}(_0x814b,0x1a2));var _0xb814=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x814b[_0xc4001c];return _0x49f7bc;};'use strict';var _=require(_0xb814('0x0'));var Promise=require(_0xb814('0x1'));var rp=require(_0xb814('0x2'));var util=require(_0xb814('0x3'));var md5=require(_0xb814('0x4'));var Redis=require(_0xb814('0x5'));var intUtil=require('./util');var config=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));config[_0xb814('0x9')]=_[_0xb814('0xa')](config[_0xb814('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xb814('0xb'))(new Redis(config[_0xb814('0x9')]));function getAdminUser(_0x5c8539,_0x271af9,_0x2913a6,_0x186d5a,_0x41166c,_0x1fea33){return new Promise(function(_0x21d4a5,_0x1086f8){var _0x19aad8={'method':_0xb814('0xc'),'uri':_0x186d5a+_0xb814('0xd')+'&'+_0x41166c+'&'+_0x1fea33,'auth':_0x271af9,'json':!![]};return rp(_0x19aad8)[_0xb814('0xe')](function(_0x4b5f14){if(_0x4b5f14[_0xb814('0xf')]['length']>0x0){_0x2913a6[_0xb814('0x10')]=_0x4b5f14[_0xb814('0xf')][0x0][_0xb814('0x11')];}logger[_0xb814('0x12')]('['+[_0x5c8539[_0xb814('0x13')]()]+_0xb814('0x14'),_0x2913a6);_0x21d4a5(_0x2913a6);})[_0xb814('0x15')](function(_0x41ed7b){logger[_0xb814('0x16')]('['+[_0x5c8539[_0xb814('0x13')]()]+']',_0x41ed7b[_0xb814('0x17')]);_0x1086f8(_0x41ed7b[_0xb814('0x17')]);});});}function getUser(_0x17f5bd,_0x39bfcf,_0x303aca,_0x3a71d6,_0x45e0d0){return function(_0x265a83){logger[_0xb814('0x12')]('['+[_0x17f5bd[_0xb814('0x13')]()]+_0xb814('0x18'),_0x265a83);return new Promise(function(_0x48c9df,_0x168a48){if(intUtil['validateEmail'](_0x265a83[_0xb814('0x19')])){var _0xfac75b={'method':'GET','uri':_0x303aca+'sys_user?sysparm_query=email%3D'+_0x265a83['userEmail']+'&'+_0x3a71d6+'&'+_0x45e0d0,'auth':_0x39bfcf,'json':!![]};logger[_0xb814('0x12')]('['+[_0x17f5bd['toUpperCase']()]+'],\x20getUser\x20rp\x20obj',_0xfac75b);return rp(_0xfac75b)[_0xb814('0xe')](function(_0x24211d){logger[_0xb814('0x12')]('['+[_0x17f5bd['toUpperCase']()]+_0xb814('0x1a'),_0x24211d);if(_0x24211d['result'][_0xb814('0x1b')]>0x0&&String(_0x24211d[_0xb814('0xf')][0x0][_0xb814('0x1c')])===_0xb814('0x1d')){_0x265a83[_0xb814('0x1e')]=_0x24211d[_0xb814('0xf')][0x0][_0xb814('0x11')];}else{_0x265a83['userId']=_0x265a83[_0xb814('0x10')];_0x265a83['userEmail']=_0x265a83[_0xb814('0x1f')];}logger[_0xb814('0x12')]('['+[_0x17f5bd[_0xb814('0x13')]()]+_0xb814('0x20'),_0x265a83);_0x48c9df(_0x265a83);})[_0xb814('0x15')](function(_0xb9e57d){logger[_0xb814('0x16')]('['+[_0x17f5bd['toUpperCase']()]+']',_0xb9e57d[_0xb814('0x17')]);_0x168a48(_0xb9e57d[_0xb814('0x17')]);});}else{logger[_0xb814('0x12')]('['+[_0x17f5bd[_0xb814('0x13')]()]+_0xb814('0x21'));_0x265a83[_0xb814('0x1e')]=_0x265a83[_0xb814('0x10')];_0x265a83[_0xb814('0x19')]=_0x265a83['adminEmail'];_0x48c9df(_0x265a83);}});};}function createEndUser(_0x271aa8,_0x328a08,_0x52ed64,_0x9008b2,_0x37d24d){logger[_0xb814('0x12')]('['+[_0x271aa8['toUpperCase']()]+_0xb814('0x22'),_0x52ed64);return new Promise(function(_0x2051d0,_0x58c3ca){var _0x338a28={'method':'POST','uri':_0x9008b2+_0xb814('0x23')+_0x37d24d,'body':{'user_name':_0x52ed64['endUserNumber'],'roles':'user','first_name':_0x52ed64[_0xb814('0x24')],'active':'true','date_format':_0xb814('0x25'),'phone':_0x52ed64[_0xb814('0x24')]},'auth':_0x328a08,'json':!![]};return rp(_0x338a28)[_0xb814('0xe')](function(_0x599f9f){logger['info']('['+[_0x271aa8[_0xb814('0x13')]()]+_0xb814('0x26'),_0x599f9f['result']);_0x52ed64[_0xb814('0x27')]=_0x599f9f[_0xb814('0xf')][_0xb814('0x11')];_0x2051d0(_0x52ed64);})[_0xb814('0x15')](function(_0x1b78de){logger[_0xb814('0x16')]('['+[_0x271aa8[_0xb814('0x13')]()]+']',_0x1b78de['message']);_0x58c3ca(_0x1b78de[_0xb814('0x17')]);});});}function getEndUser(_0x2263f6,_0x30de5a,_0x424e2b,_0x14100d,_0x4ff31a){return function(_0x16ef82){logger['info']('['+[_0x2263f6[_0xb814('0x13')]()]+_0xb814('0x28'),_0x16ef82);return new Promise(function(_0xe0f509,_0x492d5e){var _0x40b885={'method':_0xb814('0xc'),'uri':_0x424e2b+'sys_user?sysparm_query=phone%3D'+_0x16ef82[_0xb814('0x24')]+'&'+_0x14100d+'&'+_0x4ff31a,'auth':_0x30de5a,'json':!![]};return rp(_0x40b885)[_0xb814('0xe')](function(_0x1a8bd0){if(_0x1a8bd0[_0xb814('0xf')][_0xb814('0x1b')]>0x0){_0x16ef82[_0xb814('0x27')]=_0x1a8bd0['result'][0x0][_0xb814('0x11')];logger['info']('['+[_0x2263f6[_0xb814('0x13')]()]+'],\x20getEndUser\x20crm',_0x16ef82);_0xe0f509(_0x16ef82);}else{return createEndUser(_0x2263f6,_0x30de5a,_0x16ef82,_0x424e2b,_0x14100d)[_0xb814('0xe')](function(_0x4b9233){logger[_0xb814('0x12')]('['+[_0x2263f6[_0xb814('0x13')]()]+'],\x20createEndUser\x20crm',_0x4b9233);_0xe0f509(_0x4b9233);});}})['catch'](function(_0x5dd6bc){logger['error']('['+[_0x2263f6[_0xb814('0x13')]()]+']',_0x5dd6bc[_0xb814('0x17')]);_0x492d5e(_0x5dd6bc[_0xb814('0x17')]);});});};}function getCustomFields(_0x42c2ed,_0x51cdba){var _0x47d782={};if(_0x42c2ed[_0xb814('0x1b')]>0x0){_['forEach'](_0x42c2ed,function(_0x2a93da){if(_0x2a93da[_0xb814('0x29')]===_0xb814('0x2a')&&_0x2a93da[_0xb814('0x2b')]&&!_0x2a93da[_0xb814('0x2c')]){_0x47d782[_0x2a93da[_0xb814('0x2d')][_0xb814('0x2e')]()]=_0x2a93da[_0xb814('0x2f')][_0xb814('0x30')]();}else if(_0x2a93da['type']==='string'&&_0x2a93da['idField']&&_0x2a93da[_0xb814('0x2c')]){_0x47d782[_0x2a93da['idField'][_0xb814('0x2e')]()]=_0x2a93da['content'][_0xb814('0x30')]();}else if(_0x2a93da[_0xb814('0x29')]===_0xb814('0x31')&&_0x2a93da[_0xb814('0x32')]&&_0x2a93da['idField']&&_0x2a93da[_0xb814('0x2c')]){_0x47d782[_0x2a93da[_0xb814('0x2d')][_0xb814('0x2e')]()]=_0x51cdba[_0x2a93da[_0xb814('0x32')]][_0xb814('0x30')]();}else if(_0x2a93da[_0xb814('0x29')]==='customVariable'&&_0x2a93da[_0xb814('0x33')]&&_0x2a93da[_0xb814('0x33')][_0xb814('0x34')]&&_0x2a93da[_0xb814('0x2d')]&&_0x2a93da[_0xb814('0x2c')]){_0x47d782[_0x2a93da[_0xb814('0x2d')][_0xb814('0x2e')]()]=_0x51cdba[_0x2a93da['Variable']['name'][_0xb814('0x2e')]()][_0xb814('0x30')]();}});}return _0x47d782;}function getTicket(_0x4c08d6,_0x2bf906,_0x43f1b,_0x40e627,_0x24b697,_0x40af85){return function(_0x2eb9b6){logger[_0xb814('0x12')]('['+[_0x4c08d6[_0xb814('0x13')]()]+']\x20getTicket\x20input\x20crm',_0x2eb9b6);return new Promise(function(_0x37800a,_0x17510c){var _0x4a76bb=_0x4c08d6[_0xb814('0x2e')]()==='outbound'?_0x2eb9b6[_0xb814('0x1e')]:_0x2eb9b6[_0xb814('0x27')];var _0xc71270={'method':_0xb814('0x35'),'uri':_0x43f1b+_0xb814('0x36')+'?'+_0x40af85,'body':Object[_0xb814('0x37')]({},{'active':_0xb814('0x1d'),'caller_id':_0x4a76bb,'assigned_to':_0x2eb9b6[_0xb814('0x1e')],'short_description':intUtil[_0xb814('0x38')](_0x40e627[_0xb814('0x39')],_0x24b697,'\x20'),'description':intUtil['getString'](_0x40e627['Descriptions'],_0x24b697,'\x0a')},getCustomFields(_0x40e627[_0xb814('0x3a')],_0x24b697)),'auth':_0x2bf906,'json':!![]};return rp(_0xc71270)[_0xb814('0xe')](function(_0x4156d8){logger[_0xb814('0x12')]('['+[_0x4c08d6[_0xb814('0x13')]()]+_0xb814('0x3b'),_0x4156d8[_0xb814('0xf')]);_0x2eb9b6['ticketId']=_0x4156d8[_0xb814('0xf')][_0xb814('0x11')];_0x2eb9b6[_0xb814('0x3c')]=_0x4156d8['result'][_0xb814('0x3d')];logger['info']('['+[_0x4c08d6[_0xb814('0x13')]()]+']\x20getTicket\x20crm',_0x2eb9b6);_0x37800a(_0x2eb9b6);})[_0xb814('0x15')](function(_0x3cf8f8){logger['error']('['+[_0x4c08d6[_0xb814('0x13')]()]+']',_0x3cf8f8[_0xb814('0x17')]);_0x17510c(_0x3cf8f8[_0xb814('0x17')]);});});};}function createRemoteTag(_0x5209d1,_0x3da050,_0x5f0e58,_0x13bdcf){return new Promise(function(_0x158893,_0x4aed78){var _0x39952d={'method':'POST','uri':_0x5f0e58+'label'+'?'+_0x13bdcf,'body':{'short_description':_0x5209d1,'global':!![],'active':!![],'name':_0x5209d1},'auth':_0x3da050,'json':!![]};return rp(_0x39952d)[_0xb814('0xe')](function(_0x35f59a){var _0x34935b=_0x35f59a['result'][_0xb814('0x11')];_0x158893(_0x34935b);});});}function getRemoteTag(_0x538b0f,_0xf88d23,_0x2174e5,_0x58d6e5,_0x2db5a6){return new Promise(function(_0x5c32c2,_0x25a607){var _0x1656ed={'method':_0xb814('0xc'),'uri':_0x2174e5+_0xb814('0x3e')+_0xb814('0x3f')+_0x538b0f+'&'+_0x58d6e5,'auth':_0xf88d23,'json':!![]};return rp(_0x1656ed)[_0xb814('0xe')](function(_0x21d3e9){if(_0x21d3e9[_0xb814('0xf')]['length']>0x0){var _0x374532=_0x21d3e9[_0xb814('0xf')][0x0]['sys_id'];_0x5c32c2(_0x374532);}else{return createRemoteTag(_0x538b0f,_0xf88d23,_0x2174e5,_0x58d6e5)[_0xb814('0xe')](function(_0xe14249){_0x5c32c2(_0xe14249);});}});});}function assignTagToIncident(_0x4d13db,_0x371000,_0x58b9a6,_0x48362c,_0x2114ca){return new Promise(function(_0x5257be,_0x3ff213){var _0xd1cd8b={'method':_0xb814('0x35'),'uri':_0x58b9a6+'label_entry'+'?'+_0x2114ca,'body':{'label':_0x4d13db,'table':_0xb814('0x36'),'id_type':'Incident','table_key':_0x48362c[_0xb814('0x40')],'title':_0xb814('0x41')+_0x48362c[_0xb814('0x3c')],'id_display':_0x48362c[_0xb814('0x3c')]},'auth':_0x371000,'json':!![]};return rp(_0xd1cd8b)[_0xb814('0xe')](function(_0x3b374b){_0x5257be();})[_0xb814('0x15')](function(){_0x5257be();});});}function manageTags(_0x113350,_0x46014f,_0x4d611d,_0x211194,_0x111884,_0x3852ae,_0x1ac6d0){return new Promise(function(_0x3b35a8,_0x3d4843){var _0x52edfa=[];_0x46014f[_0xb814('0x42')](function(_0x4ccd94){_0x52edfa[_0xb814('0x43')](getRemoteTag(_0x4ccd94,_0x4d611d,_0x211194,_0x3852ae,_0x1ac6d0));});return Promise[_0xb814('0x44')](_0x52edfa)[_0xb814('0xe')](function(_0x4c884c){if(_0x4c884c[_0xb814('0x1b')]){logger['info']('['+[_0x113350[_0xb814('0x13')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x4c884c);var _0x2f0c94=[];_0x4c884c[_0xb814('0x42')](function(_0xa03cd2){_0x2f0c94[_0xb814('0x43')](assignTagToIncident(_0xa03cd2,_0x4d611d,_0x211194,_0x111884,_0x3852ae));});return Promise[_0xb814('0x44')](_0x2f0c94)[_0xb814('0xe')](function(){_0x3b35a8();})[_0xb814('0x15')](function(){_0x3b35a8();});}else{_0x3b35a8();}});});}function getTags(_0x4d44e3,_0x44088d,_0x51ca51,_0x255047,_0x22c73f,_0x1b989d){return function(_0x3dcaeb){return new Promise(function(_0x19fa45,_0x139531){var _0x514dab=[];var _0x12882a=_0x255047[_0xb814('0x45')];if(_0x12882a&&_0x12882a['length']>0x0){_0x514dab=_[_0xb814('0x46')](_0x12882a,_0xb814('0x34'));}if(_0x514dab[_0xb814('0x1b')]>0x0){return manageTags(_0x4d44e3,_0x514dab,_0x44088d,_0x51ca51,_0x3dcaeb,_0x22c73f,_0x1b989d)[_0xb814('0xe')](function(){_0x19fa45(_0x3dcaeb);});}else{_0x19fa45(_0x3dcaeb);}});};}function emit(_0x2161eb,_0x51d834,_0x3a4d4b){var _0x5e8e8e=_0xb814('0x47')+_0xb814('0x48')+_0xb814('0x49')+_0xb814('0x4a');var _0x2e39b1={'uri':_0x2161eb+_0xb814('0x4b')+_0x3a4d4b+_0x5e8e8e};io['to'](util['format']('user:%s',_0x51d834))['emit'](_0xb814('0x4c'),_0x2e39b1);}exports['cs']=function(_0x490e5c,_0x45a8b9,_0x1d3954,_0x25db89,_0x5e966c,_0x1b76fa,_0x3e5ce8,_0xee204){var _0x5aabbe={};var _0x30f717={'user':_0x1b76fa[_0xb814('0x4d')],'pass':_0x1b76fa[_0xb814('0x4e')]};var _0x3564e0='sysparm_limit=1';var _0x5dedd7=_0xb814('0x4f');_0x1b76fa[_0xb814('0x50')]=intUtil[_0xb814('0x51')](_0x1b76fa[_0xb814('0x50')]);_0x1b76fa[_0xb814('0x52')]=intUtil[_0xb814('0x51')](_0x1b76fa[_0xb814('0x52')]);var _0xe47442=util[_0xb814('0x53')](_0xb814('0x54'),_0x1b76fa[_0xb814('0x50')]);_0x5aabbe[_0xb814('0x19')]=!_[_0xb814('0x55')](_0x25db89)?_0x25db89[_0xb814('0x56')]:null;_0x5aabbe[_0xb814('0x1f')]=_0x1b76fa['email'];_0x5aabbe[_0xb814('0x24')]=_0xee204[_0xb814('0x2e')]()===_0xb814('0x57')?_0x45a8b9[_0xb814('0x58')]:_0x45a8b9[_0xb814('0x59')];_0x5aabbe[_0xb814('0x5a')]=_0xee204==='queue'||_0xee204===_0xb814('0x5b')?'queue':_0xb814('0x57');var _0x39aa00=util[_0xb814('0x53')](_0xb814('0x5c'),_0x1b76fa[_0xb814('0x52')],_0x45a8b9['uniqueid'],md5(_0x45a8b9['uniqueid']));if(_0x5e966c&&_0x5e966c[_0xb814('0x5d')]){logger[_0xb814('0x12')](_0xb814('0x5e'),_0xb814('0x5f'));_0x45a8b9['recordingURL']=_0x39aa00;}else if(_0x3e5ce8&&_0x3e5ce8[_0xb814('0x60')]&&_0x3e5ce8['recordingFormat']!==_0xb814('0x61')){logger[_0xb814('0x12')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x45a8b9[_0xb814('0x62')]=_0x39aa00;}else{_0x45a8b9['recordingURL']='';}return getAdminUser(_0xee204,_0x30f717,_0x5aabbe,_0xe47442,_0x5dedd7,_0x3564e0)[_0xb814('0xe')](getUser(_0xee204,_0x30f717,_0xe47442,_0x5dedd7,_0x3564e0))[_0xb814('0xe')](getEndUser(_0xee204,_0x30f717,_0xe47442,_0x5dedd7,_0x3564e0))[_0xb814('0xe')](getTicket(_0xee204,_0x30f717,_0xe47442,_0x1d3954,_0x45a8b9,_0x5dedd7))[_0xb814('0xe')](function(_0x46784f){logger[_0xb814('0x12')](util[_0xb814('0x53')]('The\x20ticket\x20ID\x20is:\x20%s',_0x46784f[_0xb814('0x40')]));logger['info'](util[_0xb814('0x53')]('call\x20direction:\x20%s',_0xee204));if(_0xee204!==_0xb814('0x5b')){logger[_0xb814('0x12')]('['+[_0xee204['toUpperCase']()]+']',_0xb814('0x63'));emit(_0x1b76fa['remoteUri'],_0x25db89[_0xb814('0x34')],_0x46784f[_0xb814('0x40')]);}})['catch'](function(_0x5a0c4a){logger[_0xb814('0x16')]('['+[_0xee204[_0xb814('0x13')]()]+_0xb814('0x64'),util[_0xb814('0x65')](_0x5a0c4a,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xc4aa=['all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','sysparm_limit=1','remoteUri','stripTrailingSlash','isNil','email','destcalleridnum','calleridnum','queue','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','none','[OUTBOUND]','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','servicenow','redis','defaults','localhost','socket.io-emitter','GET','then','result','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','info','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','user','],\x20EndUser\x20schema','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','forEach','type','string','nameField','customField','idField','toLowerCase','content','toString','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','label','POST','ticketNumber','push'];(function(_0xf7f847,_0x3ad6fa){var _0x5608c6=function(_0x4aed8d){while(--_0x4aed8d){_0xf7f847['push'](_0xf7f847['shift']());}};_0x5608c6(++_0x3ad6fa);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xc4aa[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require(_0xac4a('0x0'));var Promise=require(_0xac4a('0x1'));var rp=require(_0xac4a('0x2'));var util=require(_0xac4a('0x3'));var md5=require(_0xac4a('0x4'));var Redis=require(_0xac4a('0x5'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xac4a('0x6'));config[_0xac4a('0x7')]=_[_0xac4a('0x8')](config[_0xac4a('0x7')],{'host':_0xac4a('0x9'),'port':0x18eb});var io=require(_0xac4a('0xa'))(new Redis(config[_0xac4a('0x7')]));function getAdminUser(_0x10525b,_0x5c6179,_0x5b8339,_0x1aba6d,_0x2a4d53,_0x26ec84){return new Promise(function(_0x4f4146,_0x1d182e){var _0x3a82de={'method':_0xac4a('0xb'),'uri':_0x1aba6d+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x2a4d53+'&'+_0x26ec84,'auth':_0x5c6179,'json':!![]};return rp(_0x3a82de)[_0xac4a('0xc')](function(_0x488e3c){if(_0x488e3c[_0xac4a('0xd')]['length']>0x0){_0x5b8339[_0xac4a('0xe')]=_0x488e3c[_0xac4a('0xd')][0x0][_0xac4a('0xf')];}logger['info']('['+[_0x10525b[_0xac4a('0x10')]()]+_0xac4a('0x11'),_0x5b8339);_0x4f4146(_0x5b8339);})[_0xac4a('0x12')](function(_0x6e00d4){logger[_0xac4a('0x13')]('['+[_0x10525b[_0xac4a('0x10')]()]+']',_0x6e00d4[_0xac4a('0x14')]);_0x1d182e(_0x6e00d4[_0xac4a('0x14')]);});});}function getUser(_0x190418,_0x42c7fc,_0x11e101,_0x26dbb8,_0x4a2119){return function(_0x402fff){logger[_0xac4a('0x15')]('['+[_0x190418[_0xac4a('0x10')]()]+_0xac4a('0x16'),_0x402fff);return new Promise(function(_0x3e88e3,_0x387a54){if(intUtil[_0xac4a('0x17')](_0x402fff[_0xac4a('0x18')])){var _0x546c5d={'method':'GET','uri':_0x11e101+_0xac4a('0x19')+_0x402fff[_0xac4a('0x18')]+'&'+_0x26dbb8+'&'+_0x4a2119,'auth':_0x42c7fc,'json':!![]};logger[_0xac4a('0x15')]('['+[_0x190418['toUpperCase']()]+_0xac4a('0x1a'),_0x546c5d);return rp(_0x546c5d)[_0xac4a('0xc')](function(_0x3752e4){logger[_0xac4a('0x15')]('['+[_0x190418[_0xac4a('0x10')]()]+_0xac4a('0x1b'),_0x3752e4);if(_0x3752e4[_0xac4a('0xd')][_0xac4a('0x1c')]>0x0&&String(_0x3752e4['result'][0x0][_0xac4a('0x1d')])===_0xac4a('0x1e')){_0x402fff['userId']=_0x3752e4[_0xac4a('0xd')][0x0][_0xac4a('0xf')];}else{_0x402fff[_0xac4a('0x1f')]=_0x402fff[_0xac4a('0xe')];_0x402fff['userEmail']=_0x402fff[_0xac4a('0x20')];}logger[_0xac4a('0x15')]('['+[_0x190418[_0xac4a('0x10')]()]+_0xac4a('0x21'),_0x402fff);_0x3e88e3(_0x402fff);})[_0xac4a('0x12')](function(_0x2b0dc2){logger[_0xac4a('0x13')]('['+[_0x190418[_0xac4a('0x10')]()]+']',_0x2b0dc2[_0xac4a('0x14')]);_0x387a54(_0x2b0dc2[_0xac4a('0x14')]);});}else{logger[_0xac4a('0x15')]('['+[_0x190418[_0xac4a('0x10')]()]+_0xac4a('0x22'));_0x402fff[_0xac4a('0x1f')]=_0x402fff[_0xac4a('0xe')];_0x402fff[_0xac4a('0x18')]=_0x402fff['adminEmail'];_0x3e88e3(_0x402fff);}});};}function createEndUser(_0x23b061,_0x267a22,_0x42a33c,_0x2772fe,_0x116700){logger['info']('['+[_0x23b061['toUpperCase']()]+_0xac4a('0x23'),_0x42a33c);return new Promise(function(_0x7a948b,_0x1f12d5){var _0x546b65={'method':'POST','uri':_0x2772fe+_0xac4a('0x24')+_0x116700,'body':{'user_name':_0x42a33c[_0xac4a('0x25')],'roles':_0xac4a('0x26'),'first_name':_0x42a33c[_0xac4a('0x25')],'active':_0xac4a('0x1e'),'date_format':'System','phone':_0x42a33c[_0xac4a('0x25')]},'auth':_0x267a22,'json':!![]};return rp(_0x546b65)['then'](function(_0x30364b){logger['info']('['+[_0x23b061[_0xac4a('0x10')]()]+_0xac4a('0x27'),_0x30364b[_0xac4a('0xd')]);_0x42a33c[_0xac4a('0x28')]=_0x30364b[_0xac4a('0xd')][_0xac4a('0xf')];_0x7a948b(_0x42a33c);})[_0xac4a('0x12')](function(_0x1f13f3){logger[_0xac4a('0x13')]('['+[_0x23b061[_0xac4a('0x10')]()]+']',_0x1f13f3[_0xac4a('0x14')]);_0x1f12d5(_0x1f13f3[_0xac4a('0x14')]);});});}function getEndUser(_0x1a9be2,_0x1a9d4e,_0x5634e2,_0x30442d,_0x1c41fb){return function(_0x5a4e2b){logger[_0xac4a('0x15')]('['+[_0x1a9be2[_0xac4a('0x10')]()]+'],\x20getEndUser\x20input\x20crm',_0x5a4e2b);return new Promise(function(_0x58804b,_0x11f0be){var _0x1ba096={'method':_0xac4a('0xb'),'uri':_0x5634e2+_0xac4a('0x29')+_0x5a4e2b['endUserNumber']+'&'+_0x30442d+'&'+_0x1c41fb,'auth':_0x1a9d4e,'json':!![]};return rp(_0x1ba096)[_0xac4a('0xc')](function(_0x2e56c6){if(_0x2e56c6['result'][_0xac4a('0x1c')]>0x0){_0x5a4e2b[_0xac4a('0x28')]=_0x2e56c6[_0xac4a('0xd')][0x0]['sys_id'];logger[_0xac4a('0x15')]('['+[_0x1a9be2[_0xac4a('0x10')]()]+_0xac4a('0x2a'),_0x5a4e2b);_0x58804b(_0x5a4e2b);}else{return createEndUser(_0x1a9be2,_0x1a9d4e,_0x5a4e2b,_0x5634e2,_0x30442d)['then'](function(_0x35bc94){logger[_0xac4a('0x15')]('['+[_0x1a9be2['toUpperCase']()]+'],\x20createEndUser\x20crm',_0x35bc94);_0x58804b(_0x35bc94);});}})[_0xac4a('0x12')](function(_0x5e0926){logger['error']('['+[_0x1a9be2['toUpperCase']()]+']',_0x5e0926['message']);_0x11f0be(_0x5e0926[_0xac4a('0x14')]);});});};}function getCustomFields(_0x2bf8e8,_0x37834b){var _0x472484={};if(_0x2bf8e8[_0xac4a('0x1c')]>0x0){_[_0xac4a('0x2b')](_0x2bf8e8,function(_0x4220e2){if(_0x4220e2[_0xac4a('0x2c')]===_0xac4a('0x2d')&&_0x4220e2[_0xac4a('0x2e')]&&!_0x4220e2[_0xac4a('0x2f')]){_0x472484[_0x4220e2[_0xac4a('0x30')]['toLowerCase']()]=_0x4220e2['content']['toString']();}else if(_0x4220e2[_0xac4a('0x2c')]===_0xac4a('0x2d')&&_0x4220e2[_0xac4a('0x30')]&&_0x4220e2[_0xac4a('0x2f')]){_0x472484[_0x4220e2[_0xac4a('0x30')][_0xac4a('0x31')]()]=_0x4220e2[_0xac4a('0x32')][_0xac4a('0x33')]();}else if(_0x4220e2[_0xac4a('0x2c')]===_0xac4a('0x34')&&_0x4220e2['variableName']&&_0x4220e2[_0xac4a('0x30')]&&_0x4220e2[_0xac4a('0x2f')]){_0x472484[_0x4220e2[_0xac4a('0x30')][_0xac4a('0x31')]()]=_0x37834b[_0x4220e2[_0xac4a('0x35')]]['toString']();}else if(_0x4220e2[_0xac4a('0x2c')]===_0xac4a('0x36')&&_0x4220e2['Variable']&&_0x4220e2[_0xac4a('0x37')]['name']&&_0x4220e2[_0xac4a('0x30')]&&_0x4220e2[_0xac4a('0x2f')]){_0x472484[_0x4220e2[_0xac4a('0x30')][_0xac4a('0x31')]()]=_0x37834b[_0x4220e2[_0xac4a('0x37')][_0xac4a('0x38')][_0xac4a('0x31')]()][_0xac4a('0x33')]();}});}return _0x472484;}function getTicket(_0x98e0c4,_0xcb002b,_0x4fa9eb,_0x3b68b3,_0x569812,_0x1646ea){return function(_0x41d11d){logger[_0xac4a('0x15')]('['+[_0x98e0c4['toUpperCase']()]+_0xac4a('0x39'),_0x41d11d);return new Promise(function(_0x19276e,_0x5f54ff){var _0x42969b=_0x98e0c4['toLowerCase']()===_0xac4a('0x3a')?_0x41d11d[_0xac4a('0x1f')]:_0x41d11d[_0xac4a('0x28')];var _0x5e3581={'method':'POST','uri':_0x4fa9eb+_0xac4a('0x3b')+'?'+_0x1646ea,'body':Object['assign']({},{'active':_0xac4a('0x1e'),'caller_id':_0x42969b,'assigned_to':_0x41d11d['userId'],'short_description':intUtil[_0xac4a('0x3c')](_0x3b68b3['Subjects'],_0x569812,'\x20'),'description':intUtil[_0xac4a('0x3c')](_0x3b68b3[_0xac4a('0x3d')],_0x569812,'\x0a')},getCustomFields(_0x3b68b3[_0xac4a('0x3e')],_0x569812)),'auth':_0xcb002b,'json':!![]};return rp(_0x5e3581)[_0xac4a('0xc')](function(_0x54782f){logger[_0xac4a('0x15')]('['+[_0x98e0c4[_0xac4a('0x10')]()]+_0xac4a('0x3f'),_0x54782f[_0xac4a('0xd')]);_0x41d11d[_0xac4a('0x40')]=_0x54782f[_0xac4a('0xd')][_0xac4a('0xf')];_0x41d11d['ticketNumber']=_0x54782f[_0xac4a('0xd')][_0xac4a('0x41')];logger['info']('['+[_0x98e0c4[_0xac4a('0x10')]()]+_0xac4a('0x42'),_0x41d11d);_0x19276e(_0x41d11d);})[_0xac4a('0x12')](function(_0x3ac36e){logger['error']('['+[_0x98e0c4[_0xac4a('0x10')]()]+']',_0x3ac36e[_0xac4a('0x14')]);_0x5f54ff(_0x3ac36e[_0xac4a('0x14')]);});});};}function createRemoteTag(_0x129d58,_0x890910,_0x49fbc3,_0x179373){return new Promise(function(_0x564b10,_0x307441){var _0x2c04af={'method':'POST','uri':_0x49fbc3+'label'+'?'+_0x179373,'body':{'short_description':_0x129d58,'global':!![],'active':!![],'name':_0x129d58},'auth':_0x890910,'json':!![]};return rp(_0x2c04af)[_0xac4a('0xc')](function(_0x70fdc3){var _0x4d448f=_0x70fdc3[_0xac4a('0xd')][_0xac4a('0xf')];_0x564b10(_0x4d448f);});});}function getRemoteTag(_0x26b582,_0x103d05,_0x48900f,_0x3057d6,_0x108f7c){return new Promise(function(_0xb43fdb,_0xb5897b){var _0xdc80e3={'method':_0xac4a('0xb'),'uri':_0x48900f+_0xac4a('0x43')+'?sysparm_query=name%3D'+_0x26b582+'&'+_0x3057d6,'auth':_0x103d05,'json':!![]};return rp(_0xdc80e3)[_0xac4a('0xc')](function(_0xef51d0){if(_0xef51d0[_0xac4a('0xd')][_0xac4a('0x1c')]>0x0){var _0x1b7231=_0xef51d0[_0xac4a('0xd')][0x0][_0xac4a('0xf')];_0xb43fdb(_0x1b7231);}else{return createRemoteTag(_0x26b582,_0x103d05,_0x48900f,_0x3057d6)[_0xac4a('0xc')](function(_0x159e43){_0xb43fdb(_0x159e43);});}});});}function assignTagToIncident(_0x786d9,_0x3b175a,_0x38dd4f,_0x400ac4,_0x2fe7df){return new Promise(function(_0x5222f3,_0x11c753){var _0x492aae={'method':_0xac4a('0x44'),'uri':_0x38dd4f+'label_entry'+'?'+_0x2fe7df,'body':{'label':_0x786d9,'table':_0xac4a('0x3b'),'id_type':'Incident','table_key':_0x400ac4[_0xac4a('0x40')],'title':'Incident\x20-\x20'+_0x400ac4[_0xac4a('0x45')],'id_display':_0x400ac4['ticketNumber']},'auth':_0x3b175a,'json':!![]};return rp(_0x492aae)['then'](function(_0x52c957){_0x5222f3();})[_0xac4a('0x12')](function(){_0x5222f3();});});}function manageTags(_0x3bcae2,_0x3c2f84,_0x2f9940,_0xb7b884,_0x592a4b,_0x1e1ffa,_0x50dece){return new Promise(function(_0x34215e,_0x5d03e5){var _0x347880=[];_0x3c2f84[_0xac4a('0x2b')](function(_0x3da7e7){_0x347880[_0xac4a('0x46')](getRemoteTag(_0x3da7e7,_0x2f9940,_0xb7b884,_0x1e1ffa,_0x50dece));});return Promise[_0xac4a('0x47')](_0x347880)[_0xac4a('0xc')](function(_0x3abd57){if(_0x3abd57[_0xac4a('0x1c')]){logger[_0xac4a('0x15')]('['+[_0x3bcae2[_0xac4a('0x10')]()]+_0xac4a('0x48'),_0x3abd57);var _0x2498ad=[];_0x3abd57[_0xac4a('0x2b')](function(_0x2cc410){_0x2498ad[_0xac4a('0x46')](assignTagToIncident(_0x2cc410,_0x2f9940,_0xb7b884,_0x592a4b,_0x1e1ffa));});return Promise[_0xac4a('0x47')](_0x2498ad)[_0xac4a('0xc')](function(){_0x34215e();})['catch'](function(){_0x34215e();});}else{_0x34215e();}});});}function getTags(_0xa90d71,_0x1672c0,_0x4fb812,_0x3c3576,_0x34bd1c,_0x2d24c7){return function(_0x2b8562){return new Promise(function(_0x357cac,_0x4d1440){var _0x47c6d8=[];var _0x45f3c3=_0x3c3576[_0xac4a('0x49')];if(_0x45f3c3&&_0x45f3c3[_0xac4a('0x1c')]>0x0){_0x47c6d8=_[_0xac4a('0x4a')](_0x45f3c3,_0xac4a('0x38'));}if(_0x47c6d8[_0xac4a('0x1c')]>0x0){return manageTags(_0xa90d71,_0x47c6d8,_0x1672c0,_0x4fb812,_0x2b8562,_0x34bd1c,_0x2d24c7)[_0xac4a('0xc')](function(){_0x357cac(_0x2b8562);});}else{_0x357cac(_0x2b8562);}});};}function emit(_0x2988d7,_0x44c60b,_0x295f21){var _0x278c09='%26sysparm_record_target%3Dincident'+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xac4a('0x4b')+_0xac4a('0x4c');var _0x2954fc={'uri':_0x2988d7+_0xac4a('0x4d')+_0x295f21+_0x278c09};io['to'](util[_0xac4a('0x4e')](_0xac4a('0x4f'),_0x44c60b))[_0xac4a('0x50')](_0xac4a('0x51'),_0x2954fc);}exports['cs']=function(_0x453d62,_0x2a5acc,_0xb09b89,_0xb12cc5,_0x5f0173,_0x13c854,_0xc74ce8,_0x26bd31){var _0x231932={};var _0x513976={'user':_0x13c854[_0xac4a('0x52')],'pass':_0x13c854['password']};var _0xab4305=_0xac4a('0x53');var _0x499abc='sysparm_display_value=true';_0x13c854[_0xac4a('0x54')]=intUtil[_0xac4a('0x55')](_0x13c854[_0xac4a('0x54')]);_0x13c854['serverUrl']=intUtil[_0xac4a('0x55')](_0x13c854['serverUrl']);var _0x114b11=util['format']('%s/api/now/table/',_0x13c854[_0xac4a('0x54')]);_0x231932['userEmail']=!_[_0xac4a('0x56')](_0xb12cc5)?_0xb12cc5['email']:null;_0x231932[_0xac4a('0x20')]=_0x13c854[_0xac4a('0x57')];_0x231932['endUserNumber']=_0x26bd31[_0xac4a('0x31')]()==='outbound'?_0x2a5acc[_0xac4a('0x58')]:_0x2a5acc[_0xac4a('0x59')];_0x231932['callDirection']=_0x26bd31===_0xac4a('0x5a')||_0x26bd31==='unmanaged'?'queue':_0xac4a('0x3a');var _0x4e3129=util[_0xac4a('0x4e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x13c854['serverUrl'],_0x2a5acc[_0xac4a('0x5b')],md5(_0x2a5acc[_0xac4a('0x5b')]));if(_0x5f0173&&_0x5f0173[_0xac4a('0x5c')]){logger['info']('[QUEUE]',_0xac4a('0x5d'));_0x2a5acc[_0xac4a('0x5e')]=_0x4e3129;}else if(_0xc74ce8&&_0xc74ce8['recordingFormat']&&_0xc74ce8['recordingFormat']!==_0xac4a('0x5f')){logger[_0xac4a('0x15')](_0xac4a('0x60'),_0xac4a('0x5d'));_0x2a5acc[_0xac4a('0x5e')]=_0x4e3129;}else{_0x2a5acc[_0xac4a('0x5e')]='';}return getAdminUser(_0x26bd31,_0x513976,_0x231932,_0x114b11,_0x499abc,_0xab4305)[_0xac4a('0xc')](getUser(_0x26bd31,_0x513976,_0x114b11,_0x499abc,_0xab4305))[_0xac4a('0xc')](getEndUser(_0x26bd31,_0x513976,_0x114b11,_0x499abc,_0xab4305))[_0xac4a('0xc')](getTicket(_0x26bd31,_0x513976,_0x114b11,_0xb09b89,_0x2a5acc,_0x499abc))['then'](function(_0x1201e8){logger[_0xac4a('0x15')](util[_0xac4a('0x4e')]('The\x20ticket\x20ID\x20is:\x20%s',_0x1201e8[_0xac4a('0x40')]));logger[_0xac4a('0x15')](util[_0xac4a('0x4e')](_0xac4a('0x61'),_0x26bd31));if(_0x26bd31!==_0xac4a('0x62')){logger['info']('['+[_0x26bd31[_0xac4a('0x10')]()]+']',_0xac4a('0x63'));emit(_0x13c854[_0xac4a('0x54')],_0xb12cc5[_0xac4a('0x38')],_0x1201e8[_0xac4a('0x40')]);}})[_0xac4a('0x12')](function(_0xd7bdd6){logger['error']('['+[_0x26bd31[_0xac4a('0x10')]()]+_0xac4a('0x64'),util[_0xac4a('0x65')](_0xd7bdd6,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/sugarcrm.js b/server/services/ami/trigger/integration/sugarcrm.js index 2cf354e..d51714b 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 _0xdb7e=['recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','unmanaged','lastevent','toUpperCase','isNil','calleridname','calleridnum','Inbound','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','duration_hours','duration_minutes','parent_id','Contacts','parent_name','name','direction','length','variableName','push','idField','JSON','stringify','Basic\x20%s','apiKey','toString','get_server_info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','Agent\x20found!','resolve','value','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','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!','set_entry','first_name','','Caller\x20-\x20%s','Enduser\x20created.','merge','map','forEach','string','customField','nameField','toLowerCase','content','type','custom_fields','variable','customVariable','Variable','login','username','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','Calls','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0xdb7e,0x11a));var _0xedb7=function(_0x518a85,_0x16ceb1){_0x518a85=_0x518a85-0x0;var _0x39646b=_0xdb7e[_0x518a85];return _0x39646b;};'use strict';var _=require(_0xedb7('0x0'));var rp=require(_0xedb7('0x1'));var BPromise=require(_0xedb7('0x2'));var md5=require('md5');var util=require(_0xedb7('0x3'));var Redis=require(_0xedb7('0x4'));var intUtil=require(_0xedb7('0x5'));var config=require('../../../../config/environment');var logger=require(_0xedb7('0x6'))(_0xedb7('0x7'));config[_0xedb7('0x8')]=_[_0xedb7('0x9')](config[_0xedb7('0x8')],{'host':_0xedb7('0xa'),'port':0x18eb});var io=require(_0xedb7('0xb'))(new Redis(config[_0xedb7('0x8')]));var def={'method':_0xedb7('0xc'),'json':!![]};function emit(_0x2ae0f7,_0x5a8650,_0x3540dd){io['to'](_0x2ae0f7)[_0xedb7('0xd')](_0x5a8650,_0x3540dd);}function getTicket(_0x12c7ba,_0x269b94,_0x18e9ee,_0x1d71d9,_0x10dc75,_0x10b19d,_0x103da0,_0x591ec){logger[_0xedb7('0xe')](_0xedb7('0xf'));var _0x351203=new Date();var _0x51fee0=[{'name':'name','value':intUtil[_0xedb7('0x10')](_0x1d71d9[_0xedb7('0x11')],_0x10dc75,'\x20')},{'name':_0xedb7('0x12'),'value':_0x269b94['id']},{'name':_0xedb7('0x13'),'value':_0x269b94['id']},{'name':_0xedb7('0x14'),'value':intUtil[_0xedb7('0x10')](_0x1d71d9[_0xedb7('0x15')],_0x10dc75,'\x0a')},{'name':_0xedb7('0x16'),'value':_0x351203[_0xedb7('0x17')]()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':_0xedb7('0x18'),'value':'0'},{'name':_0xedb7('0x19'),'value':'15'},{'name':_0xedb7('0x1a'),'value':_0x18e9ee['id']},{'name':'parent_type','value':_0xedb7('0x1b')},{'name':_0xedb7('0x1c'),'value':_0x18e9ee[_0xedb7('0x1d')]},{'name':_0xedb7('0x1e'),'value':_0x591ec}];if(_0x10b19d[_0xedb7('0x1f')]){_['forEach'](_0x10b19d,function(_0x5d2d6a){if(_0x10dc75[_0x5d2d6a[_0xedb7('0x20')]]){_0x51fee0[_0xedb7('0x21')]({'name':_0x5d2d6a[_0xedb7('0x22')],'value':_0x10dc75[_0x5d2d6a[_0xedb7('0x20')]]});}});}return request({'form':{'method':'set_entry','input_type':_0xedb7('0x23'),'response_type':_0xedb7('0x23'),'rest_data':JSON[_0xedb7('0x24')]({'session':_0x103da0['id'],'module_name':'Calls','name_value_list':_0x51fee0})}});}function getAuth(_0xecf33d){return util['format'](_0xedb7('0x25'),new Buffer(_0xecf33d[_0xedb7('0x26')]+':X')[_0xedb7('0x27')]('base64'));}function getServerInfo(_0x54d68f){return request({'form':{'method':_0xedb7('0x28'),'input_type':_0xedb7('0x23'),'response_type':'JSON','rest_data':JSON[_0xedb7('0x24')]({'session':_0x54d68f['id']})}});}function getUser(_0xff6827,_0x4cde11,_0x16d887){if(!_['isNil'](_0x4cde11)){logger['info'](_0xedb7('0x29'),_0x4cde11);return request({'form':{'method':_0xedb7('0x2a'),'input_type':'JSON','response_type':_0xedb7('0x23'),'rest_data':JSON[_0xedb7('0x24')]({'session':_0x16d887['id'],'module_name':_0xedb7('0x2b'),'query':util[_0xedb7('0x2c')](_0xedb7('0x2d'),_0x4cde11),'order_by':'','offset':'0','select_fields':['id',_0xedb7('0x1d'),_0xedb7('0x2e')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xedb7('0x2f')](function(_0x4dd696){if(_0x4dd696[_0xedb7('0x30')]['length']){var _0x4d269e=_[_0xedb7('0x31')](_0x4dd696[_0xedb7('0x30')],function(_0x55fe73){return _0x55fe73['name_value_list'][_0xedb7('0x2e')]['value']===_0x4cde11;});if(_0x4d269e){logger[_0xedb7('0xe')](_0xedb7('0x32'));return BPromise[_0xedb7('0x33')]({'id':_0x4d269e['name_value_list']['id'][_0xedb7('0x34')],'name':_0x4d269e[_0xedb7('0x35')][_0xedb7('0x1d')][_0xedb7('0x34')]});}}logger[_0xedb7('0xe')](_0xedb7('0x36'));return BPromise['resolve']({'id':_0x16d887[_0xedb7('0x35')]['user_id'][_0xedb7('0x34')],'name':_0x16d887['name_value_list'][_0xedb7('0x2e')]['value']});});}else{logger[_0xedb7('0xe')](_0xedb7('0x37'));return BPromise[_0xedb7('0x33')]({'id':_0x16d887['name_value_list']['user_id'][_0xedb7('0x34')],'name':_0x16d887[_0xedb7('0x35')][_0xedb7('0x2e')]['value']});}}function getEndUser(_0x1cb974,_0x572e30,_0x3f18cd,_0x182fcc){logger[_0xedb7('0xe')](_0xedb7('0x38'),_0x3f18cd);return request({'form':{'method':_0xedb7('0x2a'),'input_type':_0xedb7('0x23'),'response_type':'JSON','rest_data':JSON[_0xedb7('0x24')]({'session':_0x182fcc['id'],'module_name':_0xedb7('0x1b'),'query':util['format'](_0xedb7('0x39'),_0x3f18cd),'order_by':'','offset':'0','select_fields':['id',_0xedb7('0x1d'),_0xedb7('0x3a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xedb7('0x2f')](function(_0x481a24){if(_0x481a24[_0xedb7('0x30')][_0xedb7('0x1f')]){var _0x197a62=_[_0xedb7('0x31')](_0x481a24[_0xedb7('0x30')],function(_0x33dbc0){return _0x33dbc0[_0xedb7('0x35')][_0xedb7('0x3a')][_0xedb7('0x34')]===_0x3f18cd;});if(_0x197a62){logger['info'](_0xedb7('0x3b'));return BPromise[_0xedb7('0x33')]({'id':_0x197a62[_0xedb7('0x35')]['id'][_0xedb7('0x34')],'name':_0x197a62['name_value_list'][_0xedb7('0x1d')][_0xedb7('0x34')],'phone':_0x197a62[_0xedb7('0x35')][_0xedb7('0x3a')]['value']});}}else{logger[_0xedb7('0xe')](_0xedb7('0x3c'));return request({'form':{'method':_0xedb7('0x3d'),'input_type':_0xedb7('0x23'),'response_type':'JSON','rest_data':JSON[_0xedb7('0x24')]({'session':_0x182fcc['id'],'module_name':_0xedb7('0x1b'),'name_value_list':[{'name':_0xedb7('0x3e'),'value':_0x572e30!==_0xedb7('0x3f')?_0x572e30:util[_0xedb7('0x2c')](_0xedb7('0x40'),_0x3f18cd)},{'name':_0xedb7('0x3a'),'value':_0x3f18cd}]})}})['then'](function(_0x14ebb7){logger['info'](_0xedb7('0x41'));return BPromise[_0xedb7('0x33')]({'id':_0x14ebb7['id'],'name':_0x14ebb7[_0xedb7('0x30')]['first_name'][_0xedb7('0x34')],'phone':_0x14ebb7[_0xedb7('0x30')][_0xedb7('0x3a')][_0xedb7('0x34')]});});}});}function request(_0x2ff566){logger['debug']('[HTTP]',JSON[_0xedb7('0x24')](_0x2ff566));return rp(_[_0xedb7('0x42')](def,_0x2ff566));}function getTags(_0x218dfc,_0x3ca3cc){var _0x372a7c=[];if(_0x218dfc&&_0x218dfc[_0xedb7('0x1f')]>0x0){_0x372a7c=_[_0xedb7('0x43')](_0x218dfc,_0x3ca3cc);}return _0x372a7c;}function getCustomFields(_0x223fbf,_0x1c71af){var _0x157ccf=[];var _0x2711ef={'custom_fields':[]};if(_0x223fbf[_0xedb7('0x1f')]>0x0){_[_0xedb7('0x44')](_0x223fbf,function(_0x46c06d){if(_0x46c06d['type']===_0xedb7('0x45')&&_0x46c06d['nameField']&&!_0x46c06d[_0xedb7('0x46')]){_0x2711ef[_0x46c06d[_0xedb7('0x47')][_0xedb7('0x48')]()]=_0x46c06d[_0xedb7('0x49')][_0xedb7('0x27')]();}else if(_0x46c06d[_0xedb7('0x4a')]===_0xedb7('0x45')&&_0x46c06d[_0xedb7('0x22')]&&_0x46c06d[_0xedb7('0x46')]){_0x2711ef[_0xedb7('0x4b')][_0xedb7('0x21')]({'id':_0x46c06d[_0xedb7('0x22')],'value':_0x46c06d[_0xedb7('0x49')][_0xedb7('0x27')]()});}else if(_0x46c06d[_0xedb7('0x4a')]===_0xedb7('0x4c')&&_0x46c06d['variableName']&&_0x46c06d[_0xedb7('0x22')]&&_0x46c06d[_0xedb7('0x46')]){_0x1c71af[_0x46c06d[_0xedb7('0x20')]]&&_0x2711ef[_0xedb7('0x4b')][_0xedb7('0x21')]({'id':_0x46c06d[_0xedb7('0x22')],'value':_0x1c71af[_0x46c06d[_0xedb7('0x20')]][_0xedb7('0x27')]()});}else if(_0x46c06d[_0xedb7('0x4a')]===_0xedb7('0x4d')&&_0x46c06d[_0xedb7('0x4e')]&&_0x46c06d[_0xedb7('0x4e')][_0xedb7('0x1d')]&&_0x46c06d[_0xedb7('0x22')]&&_0x46c06d[_0xedb7('0x46')]){_0x1c71af[_0x46c06d[_0xedb7('0x4e')][_0xedb7('0x1d')][_0xedb7('0x48')]()]&&_0x2711ef['custom_fields']['push']({'id':_0x46c06d[_0xedb7('0x22')],'value':_0x1c71af[_0x46c06d[_0xedb7('0x4e')][_0xedb7('0x1d')][_0xedb7('0x48')]()][_0xedb7('0x27')]()});}});}return _0x2711ef;}function getConnection(_0x14a11f){return request({'method':'POST','form':{'method':_0xedb7('0x4f'),'input_type':_0xedb7('0x23'),'response_type':'JSON','rest_data':JSON[_0xedb7('0x24')]({'user_auth':{'user_name':_0x14a11f[_0xedb7('0x50')],'password':_0x14a11f['password'],'encryption':'PLAIN'},'application':_0xedb7('0x51')})}})['then'](function(_0x3a1c90){var _0x2d5035=_0x3a1c90;if(_0x2d5035['id']){def['sessionID']=_0x2d5035['id'];return BPromise['resolve'](_0x2d5035);}else{throw new Error(util[_0xedb7('0x2c')](_0xedb7('0x52'),_0x14a11f['id']));}});}function setRelationship(_0x1d19bf,_0x5bf945,_0x2a7384,_0x41d0b0){return request({'form':{'method':'set_relationship','input_type':_0xedb7('0x23'),'response_type':_0xedb7('0x23'),'rest_data':JSON[_0xedb7('0x24')]({'session':_0x1d19bf['id'],'module_name':_0xedb7('0x53'),'module_id':_0x2a7384['id'],'link_field_name':_0x41d0b0,'related_ids':[_0x5bf945['id']]})}});}exports[_0xedb7('0x54')]=function(_0x2cb54a,_0x588920,_0x523175,_0x3ced72,_0x2f546d,_0x2bbf80){var _0x16e046,_0x4516e0,_0x1db5c8,_0x5a8f3a;_0x2bbf80[_0xedb7('0x55')]=intUtil['stripTrailingSlash'](_0x2bbf80[_0xedb7('0x55')]);_0x2bbf80['serverUrl']=intUtil[_0xedb7('0x56')](_0x2bbf80[_0xedb7('0x57')]);def[_0xedb7('0x58')]=util['format'](_0xedb7('0x59'),_0x2bbf80[_0xedb7('0x55')]);if(_0x2f546d&&_0x2f546d[_0xedb7('0x5a')]){logger[_0xedb7('0xe')](_0xedb7('0x5b'),_0xedb7('0x5c'));_0x588920[_0xedb7('0x5d')]=util[_0xedb7('0x2c')](_0xedb7('0x5e'),_0x2bbf80['serverUrl'],_0x588920[_0xedb7('0x5f')],md5(_0x588920['uniqueid']));}else{_0x588920[_0xedb7('0x5d')]='';}return getConnection(_0x2bbf80)[_0xedb7('0x2f')](function(_0x912765){_0x5a8f3a=_0x912765;return getUser(_0x2bbf80,_0x3ced72[_0xedb7('0x1d')],_0x5a8f3a);})[_0xedb7('0x2f')](function(_0xfaadd8){_0x16e046=_0xfaadd8;logger[_0xedb7('0xe')]('The\x20User\x20ID\x20is:',_0x16e046['id']);return getEndUser(_0x2bbf80,_0x588920['calleridname'],_0x588920['calleridnum'],_0x5a8f3a);})[_0xedb7('0x2f')](function(_0x1d3247){_0x4516e0=_0x1d3247;logger['info'](_0xedb7('0x60'),_0x4516e0['id']);return getTicket(_0x2bbf80,_0x16e046,_0x4516e0,_0x523175,_0x588920,_0x523175[_0xedb7('0x61')],_0x5a8f3a,'Inbound');})[_0xedb7('0x2f')](function(_0x5d04cd){_0x1db5c8=_0x5d04cd;logger[_0xedb7('0xe')](_0xedb7('0x62'));logger['info'](_0xedb7('0x63'),_0x1db5c8['id']);return setRelationship(_0x5a8f3a,_0x16e046,_0x1db5c8,_0xedb7('0x64'));})[_0xedb7('0x2f')](function(){return setRelationship(_0x5a8f3a,_0x4516e0,_0x1db5c8,_0xedb7('0x65'));})[_0xedb7('0x2f')](function(){return getServerInfo(_0x5a8f3a);})['then'](function(_0x334ffa){var _0x37ad03=parseInt(_0x334ffa[_0xedb7('0x66')][_0xedb7('0x67')](0x0));var _0x4ac22b=util[_0xedb7('0x2c')](_0xedb7('0x68'),_0x2bbf80[_0xedb7('0x55')],_0x1db5c8['id']);if(_0x37ad03>0x6){_0x4ac22b=util['format'](_0xedb7('0x69'),_0x2bbf80[_0xedb7('0x55')],_0x1db5c8['id']);}logger['info'](_0xedb7('0x5b'),_0xedb7('0x6a'));emit(util[_0xedb7('0x2c')](_0xedb7('0x6b'),_0x3ced72[_0xedb7('0x1d')]),_0xedb7('0x6c'),{'uri':_0x4ac22b});})[_0xedb7('0x6d')](function(_0x1e72e7){logger[_0xedb7('0x6e')](_0xedb7('0x5b'),JSON[_0xedb7('0x24')](_0x1e72e7));});};exports['outbound']=function(_0x554014,_0x54e279,_0x1a7d66,_0x21bc5e,_0x45e42b,_0x4c8e4f,_0x2e1de7){var _0x2b5fb8,_0x56bb6f,_0x40391f,_0x537865;_0x4c8e4f[_0xedb7('0x55')]=intUtil[_0xedb7('0x56')](_0x4c8e4f['remoteUri']);_0x4c8e4f[_0xedb7('0x57')]=intUtil['stripTrailingSlash'](_0x4c8e4f[_0xedb7('0x57')]);def[_0xedb7('0x58')]=util['format']('%s/service/v4_1/rest.php',_0x4c8e4f[_0xedb7('0x55')]);if(_0x2e1de7&&_0x2e1de7[_0xedb7('0x6f')]&&_0x2e1de7[_0xedb7('0x6f')]!==_0xedb7('0x70')){logger[_0xedb7('0xe')](_0xedb7('0x71'),_0xedb7('0x5c'));_0x54e279[_0xedb7('0x5d')]=util[_0xedb7('0x2c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4c8e4f[_0xedb7('0x57')],_0x54e279['uniqueid'],md5(_0x54e279[_0xedb7('0x5f')]));}return getConnection(_0x4c8e4f)[_0xedb7('0x2f')](function(_0x18d142){_0x537865=_0x18d142;return getUser(_0x4c8e4f,_0x21bc5e[_0xedb7('0x1d')],_0x537865);})[_0xedb7('0x2f')](function(_0x28448c){_0x2b5fb8=_0x28448c;logger[_0xedb7('0xe')](_0xedb7('0x72'),_0x2b5fb8['id']);return getEndUser(_0x4c8e4f,_0x54e279[_0xedb7('0x73')],_0x54e279[_0xedb7('0x74')],_0x537865);})[_0xedb7('0x2f')](function(_0x11e29e){_0x56bb6f=_0x11e29e;logger['info'](_0xedb7('0x60'),_0x56bb6f['id']);return getTicket(_0x4c8e4f,_0x2b5fb8,_0x56bb6f,_0x1a7d66,_0x54e279,_0x1a7d66['Fields'],_0x537865,_0xedb7('0x75'));})[_0xedb7('0x2f')](function(_0x479883){_0x40391f=_0x479883;logger[_0xedb7('0xe')]('Ticket\x20created!');logger[_0xedb7('0xe')](_0xedb7('0x63'),_0x40391f['id']);return setRelationship(_0x537865,_0x2b5fb8,_0x40391f,_0xedb7('0x64'));})[_0xedb7('0x2f')](function(){return setRelationship(_0x537865,_0x56bb6f,_0x40391f,_0xedb7('0x65'));})['then'](function(){return getServerInfo(_0x537865);})[_0xedb7('0x2f')](function(_0x59ad35){var _0x4c507e=parseInt(_0x59ad35[_0xedb7('0x66')][_0xedb7('0x67')](0x0));var _0xb3c627=util[_0xedb7('0x2c')](_0xedb7('0x68'),_0x4c8e4f[_0xedb7('0x55')],_0x40391f['id']);if(_0x4c507e>0x6){_0xb3c627=util[_0xedb7('0x2c')](_0xedb7('0x69'),_0x4c8e4f[_0xedb7('0x55')],_0x40391f['id']);}logger[_0xedb7('0xe')](_0xedb7('0x71'),_0xedb7('0x6a'));emit(util[_0xedb7('0x2c')](_0xedb7('0x6b'),_0x21bc5e[_0xedb7('0x1d')]),'trigger:browser:url',{'uri':_0xb3c627});})[_0xedb7('0x6d')](function(_0xac01cf){logger[_0xedb7('0x6e')](_0xedb7('0x71'),JSON['stringify'](_0xac01cf));});};exports[_0xedb7('0x76')]=function(_0x529ebc,_0x19a3e2,_0x513d99,_0x2d807d,_0x5ebe89,_0xc49439){var _0x1d7164,_0x18d32a,_0x5f4532,_0x4a3e38;_0xc49439['remoteUri']=intUtil[_0xedb7('0x56')](_0xc49439['remoteUri']);_0xc49439[_0xedb7('0x57')]=intUtil[_0xedb7('0x56')](_0xc49439[_0xedb7('0x57')]);def['uri']=util[_0xedb7('0x2c')](_0xedb7('0x59'),_0xc49439[_0xedb7('0x55')]);if(_0x5ebe89&&_0x5ebe89[_0xedb7('0x5a')]){logger['info']('['+_0x19a3e2[_0xedb7('0x77')][_0xedb7('0x78')]()+']',_0xedb7('0x5c'));_0x19a3e2[_0xedb7('0x5d')]=util[_0xedb7('0x2c')](_0xedb7('0x5e'),_0xc49439[_0xedb7('0x57')],_0x19a3e2[_0xedb7('0x5f')],md5(_0x19a3e2[_0xedb7('0x5f')]));}else{_0x19a3e2[_0xedb7('0x5d')]='';}return getConnection(_0xc49439)[_0xedb7('0x2f')](function(_0x33c188){_0x4a3e38=_0x33c188;if(!_[_0xedb7('0x79')](_0x2d807d)){return getUser(_0xc49439,_0x2d807d['name'],_0x4a3e38);}else{return getUser(_0xc49439,null,_0x4a3e38);}})[_0xedb7('0x2f')](function(_0x1611d0){_0x1d7164=_0x1611d0;logger[_0xedb7('0xe')](_0xedb7('0x72'),_0x1d7164['id']);return getEndUser(_0xc49439,_0x19a3e2[_0xedb7('0x7a')],_0x19a3e2[_0xedb7('0x7b')],_0x4a3e38);})[_0xedb7('0x2f')](function(_0x4e6c39){_0x18d32a=_0x4e6c39;logger[_0xedb7('0xe')](_0xedb7('0x60'),_0x18d32a['id']);return getTicket(_0xc49439,_0x1d7164,_0x18d32a,_0x513d99,_0x19a3e2,_0x513d99['Fields'],_0x4a3e38,_0xedb7('0x7c'));})[_0xedb7('0x2f')](function(_0x51e1a4){_0x5f4532=_0x51e1a4;logger['info'](_0xedb7('0x62'));logger[_0xedb7('0xe')]('The\x20Ticket\x20ID\x20is:',_0x5f4532['id']);return setRelationship(_0x4a3e38,_0x1d7164,_0x5f4532,_0xedb7('0x64'));})['then'](function(){return setRelationship(_0x4a3e38,_0x18d32a,_0x5f4532,_0xedb7('0x65'));})[_0xedb7('0x2f')](function(){return getServerInfo(_0x4a3e38);})[_0xedb7('0x6d')](function(_0x4b4de2){logger[_0xedb7('0x6e')]('['+_0x19a3e2[_0xedb7('0x77')][_0xedb7('0x78')]()+']',JSON[_0xedb7('0x24')](_0x4b4de2));});}; \ No newline at end of file +var _0x66c7=['util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','defaults','redis','localhost','socket.io-emitter','POST','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','length','forEach','push','idField','variableName','stringify','format','toString','base64','JSON','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','name_value_list','user_name','Agent\x20found!','value','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','find','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','merge','map','type','string','nameField','toLowerCase','content','custom_fields','Variable','customField','username','password','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','outbound','%s/service/v4_1/rest.php','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridnum','The\x20Enduser\x20ID\x20is:','[OUTBOUND]','user:%s','unmanaged','toUpperCase','isNil','Inbound','Ticket\x20created!','error','lastevent','lodash','request-promise','bluebird'];(function(_0x56c6a9,_0x1239ee){var _0xa3ad43=function(_0x386c0a){while(--_0x386c0a){_0x56c6a9['push'](_0x56c6a9['shift']());}};_0xa3ad43(++_0x1239ee);}(_0x66c7,0x15c));var _0x766c=function(_0x4f9da3,_0x1cd374){_0x4f9da3=_0x4f9da3-0x0;var _0x309cf0=_0x66c7[_0x4f9da3];return _0x309cf0;};'use strict';var _=require(_0x766c('0x0'));var rp=require(_0x766c('0x1'));var BPromise=require(_0x766c('0x2'));var md5=require('md5');var util=require(_0x766c('0x3'));var Redis=require(_0x766c('0x4'));var intUtil=require(_0x766c('0x5'));var config=require(_0x766c('0x6'));var logger=require(_0x766c('0x7'))(_0x766c('0x8'));config['redis']=_[_0x766c('0x9')](config[_0x766c('0xa')],{'host':_0x766c('0xb'),'port':0x18eb});var io=require(_0x766c('0xc'))(new Redis(config[_0x766c('0xa')]));var def={'method':_0x766c('0xd'),'json':!![]};function emit(_0x22a524,_0x4488b8,_0x5a4ffb){io['to'](_0x22a524)['emit'](_0x4488b8,_0x5a4ffb);}function getTicket(_0x141744,_0xbd798b,_0x1d8ac1,_0x58cb58,_0x1d360f,_0x4acfc1,_0x2d567f,_0x2f826c){logger[_0x766c('0xe')](_0x766c('0xf'));var _0x2cb982=new Date();var _0x3e3b75=[{'name':_0x766c('0x10'),'value':intUtil[_0x766c('0x11')](_0x58cb58[_0x766c('0x12')],_0x1d360f,'\x20')},{'name':_0x766c('0x13'),'value':_0xbd798b['id']},{'name':_0x766c('0x14'),'value':_0xbd798b['id']},{'name':_0x766c('0x15'),'value':intUtil[_0x766c('0x11')](_0x58cb58[_0x766c('0x16')],_0x1d360f,'\x0a')},{'name':_0x766c('0x17'),'value':_0x2cb982['toISOString']()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':_0x766c('0x18'),'value':'0'},{'name':_0x766c('0x19'),'value':'15'},{'name':_0x766c('0x1a'),'value':_0x1d8ac1['id']},{'name':_0x766c('0x1b'),'value':_0x766c('0x1c')},{'name':_0x766c('0x1d'),'value':_0x1d8ac1['name']},{'name':'direction','value':_0x2f826c}];if(_0x4acfc1[_0x766c('0x1e')]){_[_0x766c('0x1f')](_0x4acfc1,function(_0x105f60){if(_0x1d360f[_0x105f60['variableName']]){_0x3e3b75[_0x766c('0x20')]({'name':_0x105f60[_0x766c('0x21')],'value':_0x1d360f[_0x105f60[_0x766c('0x22')]]});}});}return request({'form':{'method':'set_entry','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x766c('0x23')]({'session':_0x2d567f['id'],'module_name':'Calls','name_value_list':_0x3e3b75})}});}function getAuth(_0x2736d0){return util[_0x766c('0x24')]('Basic\x20%s',new Buffer(_0x2736d0['apiKey']+':X')[_0x766c('0x25')](_0x766c('0x26')));}function getServerInfo(_0x41fa49){return request({'form':{'method':'get_server_info','input_type':_0x766c('0x27'),'response_type':_0x766c('0x27'),'rest_data':JSON['stringify']({'session':_0x41fa49['id']})}});}function getUser(_0x504b05,_0x577000,_0x43d91f){if(!_['isNil'](_0x577000)){logger[_0x766c('0xe')](_0x766c('0x28'),_0x577000);return request({'form':{'method':_0x766c('0x29'),'input_type':'JSON','response_type':_0x766c('0x27'),'rest_data':JSON[_0x766c('0x23')]({'session':_0x43d91f['id'],'module_name':_0x766c('0x2a'),'query':util[_0x766c('0x24')](_0x766c('0x2b'),_0x577000),'order_by':'','offset':'0','select_fields':['id',_0x766c('0x10'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x766c('0x2c')](function(_0x323fc4){if(_0x323fc4[_0x766c('0x2d')][_0x766c('0x1e')]){var _0x1631af=_['find'](_0x323fc4['entry_list'],function(_0x2d7de6){return _0x2d7de6[_0x766c('0x2e')][_0x766c('0x2f')]['value']===_0x577000;});if(_0x1631af){logger[_0x766c('0xe')](_0x766c('0x30'));return BPromise['resolve']({'id':_0x1631af[_0x766c('0x2e')]['id']['value'],'name':_0x1631af['name_value_list'][_0x766c('0x10')][_0x766c('0x31')]});}}logger[_0x766c('0xe')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x766c('0x32')]({'id':_0x43d91f[_0x766c('0x2e')][_0x766c('0x33')][_0x766c('0x31')],'name':_0x43d91f[_0x766c('0x2e')]['user_name']['value']});});}else{logger[_0x766c('0xe')](_0x766c('0x34'));return BPromise[_0x766c('0x32')]({'id':_0x43d91f[_0x766c('0x2e')][_0x766c('0x33')]['value'],'name':_0x43d91f[_0x766c('0x2e')][_0x766c('0x2f')][_0x766c('0x31')]});}}function getEndUser(_0x570f97,_0x17f5c6,_0x4b765c,_0x52e578){logger[_0x766c('0xe')](_0x766c('0x35'),_0x4b765c);return request({'form':{'method':_0x766c('0x29'),'input_type':_0x766c('0x27'),'response_type':_0x766c('0x27'),'rest_data':JSON[_0x766c('0x23')]({'session':_0x52e578['id'],'module_name':'Contacts','query':util['format'](_0x766c('0x36'),_0x4b765c),'order_by':'','offset':'0','select_fields':['id',_0x766c('0x10'),_0x766c('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x766c('0x2c')](function(_0x160f9e){if(_0x160f9e[_0x766c('0x2d')][_0x766c('0x1e')]){var _0x2f11f9=_[_0x766c('0x38')](_0x160f9e[_0x766c('0x2d')],function(_0x2cdc40){return _0x2cdc40[_0x766c('0x2e')][_0x766c('0x37')]['value']===_0x4b765c;});if(_0x2f11f9){logger[_0x766c('0xe')]('Enduser\x20found!');return BPromise[_0x766c('0x32')]({'id':_0x2f11f9['name_value_list']['id'][_0x766c('0x31')],'name':_0x2f11f9[_0x766c('0x2e')]['name'][_0x766c('0x31')],'phone':_0x2f11f9[_0x766c('0x2e')]['phone_home'][_0x766c('0x31')]});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':'set_entry','input_type':_0x766c('0x27'),'response_type':'JSON','rest_data':JSON[_0x766c('0x23')]({'session':_0x52e578['id'],'module_name':_0x766c('0x1c'),'name_value_list':[{'name':_0x766c('0x39'),'value':_0x17f5c6!==_0x766c('0x3a')?_0x17f5c6:util[_0x766c('0x24')](_0x766c('0x3b'),_0x4b765c)},{'name':_0x766c('0x37'),'value':_0x4b765c}]})}})[_0x766c('0x2c')](function(_0x4d536){logger['info'](_0x766c('0x3c'));return BPromise[_0x766c('0x32')]({'id':_0x4d536['id'],'name':_0x4d536['entry_list']['first_name']['value'],'phone':_0x4d536[_0x766c('0x2d')][_0x766c('0x37')]['value']});});}});}function request(_0x2b99d1){logger[_0x766c('0x3d')]('[HTTP]',JSON[_0x766c('0x23')](_0x2b99d1));return rp(_[_0x766c('0x3e')](def,_0x2b99d1));}function getTags(_0x4b90f2,_0x2a9a6d){var _0x4c0bd8=[];if(_0x4b90f2&&_0x4b90f2[_0x766c('0x1e')]>0x0){_0x4c0bd8=_[_0x766c('0x3f')](_0x4b90f2,_0x2a9a6d);}return _0x4c0bd8;}function getCustomFields(_0x3950c0,_0x1db546){var _0x1e573c=[];var _0x534ffc={'custom_fields':[]};if(_0x3950c0[_0x766c('0x1e')]>0x0){_[_0x766c('0x1f')](_0x3950c0,function(_0x51cd5a){if(_0x51cd5a[_0x766c('0x40')]===_0x766c('0x41')&&_0x51cd5a['nameField']&&!_0x51cd5a['customField']){_0x534ffc[_0x51cd5a[_0x766c('0x42')][_0x766c('0x43')]()]=_0x51cd5a[_0x766c('0x44')]['toString']();}else if(_0x51cd5a[_0x766c('0x40')]===_0x766c('0x41')&&_0x51cd5a[_0x766c('0x21')]&&_0x51cd5a['customField']){_0x534ffc[_0x766c('0x45')][_0x766c('0x20')]({'id':_0x51cd5a['idField'],'value':_0x51cd5a[_0x766c('0x44')][_0x766c('0x25')]()});}else if(_0x51cd5a[_0x766c('0x40')]==='variable'&&_0x51cd5a[_0x766c('0x22')]&&_0x51cd5a['idField']&&_0x51cd5a['customField']){_0x1db546[_0x51cd5a['variableName']]&&_0x534ffc[_0x766c('0x45')][_0x766c('0x20')]({'id':_0x51cd5a['idField'],'value':_0x1db546[_0x51cd5a[_0x766c('0x22')]][_0x766c('0x25')]()});}else if(_0x51cd5a[_0x766c('0x40')]==='customVariable'&&_0x51cd5a[_0x766c('0x46')]&&_0x51cd5a['Variable'][_0x766c('0x10')]&&_0x51cd5a[_0x766c('0x21')]&&_0x51cd5a[_0x766c('0x47')]){_0x1db546[_0x51cd5a[_0x766c('0x46')][_0x766c('0x10')][_0x766c('0x43')]()]&&_0x534ffc[_0x766c('0x45')][_0x766c('0x20')]({'id':_0x51cd5a[_0x766c('0x21')],'value':_0x1db546[_0x51cd5a['Variable'][_0x766c('0x10')][_0x766c('0x43')]()][_0x766c('0x25')]()});}});}return _0x534ffc;}function getConnection(_0x41d78c){return request({'method':_0x766c('0xd'),'form':{'method':'login','input_type':'JSON','response_type':_0x766c('0x27'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x41d78c[_0x766c('0x48')],'password':_0x41d78c[_0x766c('0x49')],'encryption':'PLAIN'},'application':_0x766c('0x4a')})}})[_0x766c('0x2c')](function(_0x31a4a3){var _0x1a20c7=_0x31a4a3;if(_0x1a20c7['id']){def['sessionID']=_0x1a20c7['id'];return BPromise[_0x766c('0x32')](_0x1a20c7);}else{throw new Error(util[_0x766c('0x24')](_0x766c('0x4b'),_0x41d78c['id']));}});}function setRelationship(_0x44009f,_0x1f6e23,_0x3ae7d8,_0x1c7796){return request({'form':{'method':_0x766c('0x4c'),'input_type':_0x766c('0x27'),'response_type':_0x766c('0x27'),'rest_data':JSON[_0x766c('0x23')]({'session':_0x44009f['id'],'module_name':'Calls','module_id':_0x3ae7d8['id'],'link_field_name':_0x1c7796,'related_ids':[_0x1f6e23['id']]})}});}exports[_0x766c('0x4d')]=function(_0xddfde2,_0x3215fb,_0x547f0a,_0x4d0781,_0xb38efc,_0x3f94cf){var _0x5a8d25,_0x3e77f0,_0x3029b1,_0x2ec652;_0x3f94cf[_0x766c('0x4e')]=intUtil[_0x766c('0x4f')](_0x3f94cf[_0x766c('0x4e')]);_0x3f94cf[_0x766c('0x50')]=intUtil['stripTrailingSlash'](_0x3f94cf[_0x766c('0x50')]);def[_0x766c('0x51')]=util[_0x766c('0x24')]('%s/service/v4_1/rest.php',_0x3f94cf[_0x766c('0x4e')]);if(_0xb38efc&&_0xb38efc[_0x766c('0x52')]){logger[_0x766c('0xe')](_0x766c('0x53'),'Recording\x20is\x20enabled!');_0x3215fb[_0x766c('0x54')]=util[_0x766c('0x24')](_0x766c('0x55'),_0x3f94cf[_0x766c('0x50')],_0x3215fb[_0x766c('0x56')],md5(_0x3215fb['uniqueid']));}else{_0x3215fb[_0x766c('0x54')]='';}return getConnection(_0x3f94cf)[_0x766c('0x2c')](function(_0x4572f6){_0x2ec652=_0x4572f6;return getUser(_0x3f94cf,_0x4d0781['name'],_0x2ec652);})[_0x766c('0x2c')](function(_0x1e70d1){_0x5a8d25=_0x1e70d1;logger[_0x766c('0xe')](_0x766c('0x57'),_0x5a8d25['id']);return getEndUser(_0x3f94cf,_0x3215fb[_0x766c('0x58')],_0x3215fb[_0x766c('0x59')],_0x2ec652);})['then'](function(_0x45fdf0){_0x3e77f0=_0x45fdf0;logger[_0x766c('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3e77f0['id']);return getTicket(_0x3f94cf,_0x5a8d25,_0x3e77f0,_0x547f0a,_0x3215fb,_0x547f0a[_0x766c('0x5a')],_0x2ec652,'Inbound');})[_0x766c('0x2c')](function(_0x187309){_0x3029b1=_0x187309;logger[_0x766c('0xe')]('Ticket\x20created!');logger[_0x766c('0xe')](_0x766c('0x5b'),_0x3029b1['id']);return setRelationship(_0x2ec652,_0x5a8d25,_0x3029b1,_0x766c('0x5c'));})[_0x766c('0x2c')](function(){return setRelationship(_0x2ec652,_0x3e77f0,_0x3029b1,_0x766c('0x5d'));})['then'](function(){return getServerInfo(_0x2ec652);})['then'](function(_0x49c52d){var _0x43ab82=parseInt(_0x49c52d[_0x766c('0x5e')][_0x766c('0x5f')](0x0));var _0x13f5c8=util[_0x766c('0x24')](_0x766c('0x60'),_0x3f94cf['remoteUri'],_0x3029b1['id']);if(_0x43ab82>0x6){_0x13f5c8=util['format'](_0x766c('0x61'),_0x3f94cf[_0x766c('0x4e')],_0x3029b1['id']);}logger['info'](_0x766c('0x53'),_0x766c('0x62'));emit(util['format']('user:%s',_0x4d0781[_0x766c('0x10')]),_0x766c('0x63'),{'uri':_0x13f5c8});})[_0x766c('0x64')](function(_0x39a6c5){logger['error'](_0x766c('0x53'),JSON[_0x766c('0x23')](_0x39a6c5));});};exports[_0x766c('0x65')]=function(_0x3a2323,_0x5a6012,_0x4b71a2,_0x1eb265,_0xc29cd1,_0x54013d,_0x2d566a){var _0x53a84a,_0x3a7c4e,_0x2a922e,_0x5e3e16;_0x54013d[_0x766c('0x4e')]=intUtil[_0x766c('0x4f')](_0x54013d[_0x766c('0x4e')]);_0x54013d['serverUrl']=intUtil[_0x766c('0x4f')](_0x54013d['serverUrl']);def[_0x766c('0x51')]=util[_0x766c('0x24')](_0x766c('0x66'),_0x54013d[_0x766c('0x4e')]);if(_0x2d566a&&_0x2d566a['recordingFormat']&&_0x2d566a[_0x766c('0x67')]!==_0x766c('0x68')){logger[_0x766c('0xe')]('[OUTBOUND]',_0x766c('0x69'));_0x5a6012[_0x766c('0x54')]=util[_0x766c('0x24')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x54013d['serverUrl'],_0x5a6012['uniqueid'],md5(_0x5a6012[_0x766c('0x56')]));}return getConnection(_0x54013d)[_0x766c('0x2c')](function(_0x36632e){_0x5e3e16=_0x36632e;return getUser(_0x54013d,_0x1eb265[_0x766c('0x10')],_0x5e3e16);})[_0x766c('0x2c')](function(_0x56d717){_0x53a84a=_0x56d717;logger[_0x766c('0xe')](_0x766c('0x57'),_0x53a84a['id']);return getEndUser(_0x54013d,_0x5a6012['destcalleridname'],_0x5a6012[_0x766c('0x6a')],_0x5e3e16);})[_0x766c('0x2c')](function(_0x470a7b){_0x3a7c4e=_0x470a7b;logger[_0x766c('0xe')](_0x766c('0x6b'),_0x3a7c4e['id']);return getTicket(_0x54013d,_0x53a84a,_0x3a7c4e,_0x4b71a2,_0x5a6012,_0x4b71a2['Fields'],_0x5e3e16,'Outbound');})['then'](function(_0x526c7c){_0x2a922e=_0x526c7c;logger['info']('Ticket\x20created!');logger[_0x766c('0xe')](_0x766c('0x5b'),_0x2a922e['id']);return setRelationship(_0x5e3e16,_0x53a84a,_0x2a922e,_0x766c('0x5c'));})['then'](function(){return setRelationship(_0x5e3e16,_0x3a7c4e,_0x2a922e,_0x766c('0x5d'));})[_0x766c('0x2c')](function(){return getServerInfo(_0x5e3e16);})[_0x766c('0x2c')](function(_0x3d9851){var _0x203b42=parseInt(_0x3d9851['version'][_0x766c('0x5f')](0x0));var _0x36a397=util[_0x766c('0x24')](_0x766c('0x60'),_0x54013d[_0x766c('0x4e')],_0x2a922e['id']);if(_0x203b42>0x6){_0x36a397=util['format'](_0x766c('0x61'),_0x54013d['remoteUri'],_0x2a922e['id']);}logger[_0x766c('0xe')](_0x766c('0x6c'),_0x766c('0x62'));emit(util[_0x766c('0x24')](_0x766c('0x6d'),_0x1eb265['name']),_0x766c('0x63'),{'uri':_0x36a397});})['catch'](function(_0x5c771){logger['error'](_0x766c('0x6c'),JSON['stringify'](_0x5c771));});};exports[_0x766c('0x6e')]=function(_0x25381e,_0x223edc,_0x1ddcbd,_0x7d3b4f,_0x45b6b4,_0x47b4ab){var _0x1c03b7,_0x443ac5,_0x266593,_0x175abf;_0x47b4ab[_0x766c('0x4e')]=intUtil[_0x766c('0x4f')](_0x47b4ab[_0x766c('0x4e')]);_0x47b4ab[_0x766c('0x50')]=intUtil[_0x766c('0x4f')](_0x47b4ab['serverUrl']);def[_0x766c('0x51')]=util[_0x766c('0x24')]('%s/service/v4_1/rest.php',_0x47b4ab[_0x766c('0x4e')]);if(_0x45b6b4&&_0x45b6b4[_0x766c('0x52')]){logger[_0x766c('0xe')]('['+_0x223edc['lastevent'][_0x766c('0x6f')]()+']','Recording\x20is\x20enabled!');_0x223edc[_0x766c('0x54')]=util['format'](_0x766c('0x55'),_0x47b4ab[_0x766c('0x50')],_0x223edc['uniqueid'],md5(_0x223edc[_0x766c('0x56')]));}else{_0x223edc['recordingURL']='';}return getConnection(_0x47b4ab)['then'](function(_0x1973bb){_0x175abf=_0x1973bb;if(!_[_0x766c('0x70')](_0x7d3b4f)){return getUser(_0x47b4ab,_0x7d3b4f[_0x766c('0x10')],_0x175abf);}else{return getUser(_0x47b4ab,null,_0x175abf);}})[_0x766c('0x2c')](function(_0x60ba0d){_0x1c03b7=_0x60ba0d;logger['info'](_0x766c('0x57'),_0x1c03b7['id']);return getEndUser(_0x47b4ab,_0x223edc['calleridname'],_0x223edc[_0x766c('0x59')],_0x175abf);})[_0x766c('0x2c')](function(_0x4805de){_0x443ac5=_0x4805de;logger[_0x766c('0xe')]('The\x20Enduser\x20ID\x20is:',_0x443ac5['id']);return getTicket(_0x47b4ab,_0x1c03b7,_0x443ac5,_0x1ddcbd,_0x223edc,_0x1ddcbd[_0x766c('0x5a')],_0x175abf,_0x766c('0x71'));})[_0x766c('0x2c')](function(_0x36b658){_0x266593=_0x36b658;logger['info'](_0x766c('0x72'));logger['info'](_0x766c('0x5b'),_0x266593['id']);return setRelationship(_0x175abf,_0x1c03b7,_0x266593,_0x766c('0x5c'));})[_0x766c('0x2c')](function(){return setRelationship(_0x175abf,_0x443ac5,_0x266593,'contacts');})['then'](function(){return getServerInfo(_0x175abf);})[_0x766c('0x64')](function(_0x274c76){logger[_0x766c('0x73')]('['+_0x223edc[_0x766c('0x74')][_0x766c('0x6f')]()+']',JSON['stringify'](_0x274c76));});}; \ 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 9dc2714..7dcec7e 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 _0xfbc1=['toLowerCase','keyType','key','%s:\x20%s','keyContent','format','join','slice','substring','lastIndexOf','validateEmail','test','util','getString','length','sortBy','type','string','push','variable','variableName','toString','customVariable','Variable','name'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xfbc1,0x183));var _0x1fbc=function(_0x1d80be,_0x3a60ff){_0x1d80be=_0x1d80be-0x0;var _0xf9a4f3=_0xfbc1[_0x1d80be];return _0xf9a4f3;};'use strict';var _=require('lodash');var util=require(_0x1fbc('0x0'));exports[_0x1fbc('0x1')]=function(_0x488dd0,_0x19727a,_0x5619bf){var _0x511c8c=[];if(_0x488dd0[_0x1fbc('0x2')]>0x0){var _0x336c43=_[_0x1fbc('0x3')](_0x488dd0,['id']);for(var _0x57fda7=0x0;_0x57fda7<_0x336c43[_0x1fbc('0x2')];_0x57fda7++){var _0x1e41bc=_0x336c43[_0x57fda7];if(_0x1e41bc[_0x1fbc('0x4')]===_0x1fbc('0x5')){_0x511c8c[_0x1fbc('0x6')](_0x1e41bc['content']);}else if(_0x1e41bc['type']===_0x1fbc('0x7')&&_0x1e41bc[_0x1fbc('0x8')]){_0x19727a[_0x1e41bc[_0x1fbc('0x8')]]&&_0x511c8c['push'](_0x19727a[_0x1e41bc['variableName']][_0x1fbc('0x9')]());}else if(_0x1e41bc[_0x1fbc('0x4')]===_0x1fbc('0xa')&&_0x1e41bc[_0x1fbc('0xb')]&&_0x1e41bc[_0x1fbc('0xb')]['name']){_0x19727a[_0x1e41bc['Variable'][_0x1fbc('0xc')][_0x1fbc('0xd')]()]&&_0x511c8c[_0x1fbc('0x6')](_0x19727a[_0x1e41bc[_0x1fbc('0xb')]['name'][_0x1fbc('0xd')]()][_0x1fbc('0x9')]());}else if(_0x1e41bc[_0x1fbc('0x4')]==='keyValue'){if(_0x1e41bc[_0x1fbc('0xe')]===_0x1fbc('0x5')&&_0x1e41bc[_0x1fbc('0xf')]){_0x511c8c[_0x1fbc('0x6')](util['format'](_0x1fbc('0x10'),_0x1e41bc[_0x1fbc('0xf')],_0x1e41bc[_0x1fbc('0x11')]));}else if(_0x1e41bc[_0x1fbc('0xe')]===_0x1fbc('0x7')&&_0x1e41bc[_0x1fbc('0x8')]&&_0x1e41bc[_0x1fbc('0xf')]){_0x19727a[_0x1e41bc['variableName']]&&_0x511c8c[_0x1fbc('0x6')](util[_0x1fbc('0x12')](_0x1fbc('0x10'),_0x1e41bc[_0x1fbc('0xf')],_0x19727a[_0x1e41bc[_0x1fbc('0x8')]]));}else if(_0x1e41bc[_0x1fbc('0xe')]===_0x1fbc('0xa')&&_0x1e41bc[_0x1fbc('0xb')]&&_0x1e41bc[_0x1fbc('0xb')][_0x1fbc('0xc')]&&_0x1e41bc[_0x1fbc('0xf')]){_0x19727a[_0x1e41bc[_0x1fbc('0xb')][_0x1fbc('0xc')][_0x1fbc('0xd')]()]&&_0x511c8c[_0x1fbc('0x6')](util[_0x1fbc('0x12')](_0x1fbc('0x10'),_0x1e41bc['key'],_0x19727a[_0x1e41bc[_0x1fbc('0xb')][_0x1fbc('0xc')]['toLowerCase']()]));}}}}return _0x511c8c[_0x1fbc('0x13')](_0x5619bf);};exports['stripTrailingSlash']=function(_0x258ed3){var _0x3fdbe9=_0x258ed3[_0x1fbc('0x14')](-0x1);if(_0x3fdbe9==='/'){_0x258ed3=_0x258ed3[_0x1fbc('0x15')](0x0,_0x258ed3[_0x1fbc('0x16')](_0x3fdbe9));}return _0x258ed3;};exports[_0x1fbc('0x17')]=function(_0xd9aca4){if(!_['isNil'](_0xd9aca4)&&_0xd9aca4!==''){var _0x8aa6a2=/^(([^<>()\[\]\\.,;:\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 _0x8aa6a2[_0x1fbc('0x18')](String(_0xd9aca4)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0x137e=['stripTrailingSlash','substring','lastIndexOf','validateEmail','isNil','util','getString','length','type','string','push','content','variableName','toString','customVariable','Variable','toLowerCase','name','format','%s:\x20%s','keyContent','keyType','variable','key','join'];(function(_0x542d80,_0x150561){var _0x1f4492=function(_0x542215){while(--_0x542215){_0x542d80['push'](_0x542d80['shift']());}};_0x1f4492(++_0x150561);}(_0x137e,0xcd));var _0xe137=function(_0xb86ba7,_0x1914b0){_0xb86ba7=_0xb86ba7-0x0;var _0xd5c71d=_0x137e[_0xb86ba7];return _0xd5c71d;};'use strict';var _=require('lodash');var util=require(_0xe137('0x0'));exports[_0xe137('0x1')]=function(_0x49d4fc,_0x56ee5d,_0x636398){var _0x4d8d13=[];if(_0x49d4fc[_0xe137('0x2')]>0x0){var _0x4f0e41=_['sortBy'](_0x49d4fc,['id']);for(var _0x3fc544=0x0;_0x3fc544<_0x4f0e41[_0xe137('0x2')];_0x3fc544++){var _0x392dce=_0x4f0e41[_0x3fc544];if(_0x392dce[_0xe137('0x3')]===_0xe137('0x4')){_0x4d8d13[_0xe137('0x5')](_0x392dce[_0xe137('0x6')]);}else if(_0x392dce[_0xe137('0x3')]==='variable'&&_0x392dce['variableName']){_0x56ee5d[_0x392dce['variableName']]&&_0x4d8d13['push'](_0x56ee5d[_0x392dce[_0xe137('0x7')]][_0xe137('0x8')]());}else if(_0x392dce[_0xe137('0x3')]===_0xe137('0x9')&&_0x392dce['Variable']&&_0x392dce[_0xe137('0xa')]['name']){_0x56ee5d[_0x392dce['Variable']['name'][_0xe137('0xb')]()]&&_0x4d8d13[_0xe137('0x5')](_0x56ee5d[_0x392dce[_0xe137('0xa')][_0xe137('0xc')][_0xe137('0xb')]()]['toString']());}else if(_0x392dce['type']==='keyValue'){if(_0x392dce['keyType']===_0xe137('0x4')&&_0x392dce['key']){_0x4d8d13[_0xe137('0x5')](util[_0xe137('0xd')](_0xe137('0xe'),_0x392dce['key'],_0x392dce[_0xe137('0xf')]));}else if(_0x392dce[_0xe137('0x10')]===_0xe137('0x11')&&_0x392dce[_0xe137('0x7')]&&_0x392dce[_0xe137('0x12')]){_0x56ee5d[_0x392dce[_0xe137('0x7')]]&&_0x4d8d13[_0xe137('0x5')](util[_0xe137('0xd')](_0xe137('0xe'),_0x392dce[_0xe137('0x12')],_0x56ee5d[_0x392dce[_0xe137('0x7')]]));}else if(_0x392dce[_0xe137('0x10')]==='customVariable'&&_0x392dce['Variable']&&_0x392dce[_0xe137('0xa')][_0xe137('0xc')]&&_0x392dce[_0xe137('0x12')]){_0x56ee5d[_0x392dce[_0xe137('0xa')][_0xe137('0xc')][_0xe137('0xb')]()]&&_0x4d8d13[_0xe137('0x5')](util[_0xe137('0xd')](_0xe137('0xe'),_0x392dce[_0xe137('0x12')],_0x56ee5d[_0x392dce['Variable'][_0xe137('0xc')][_0xe137('0xb')]()]));}}}}return _0x4d8d13[_0xe137('0x13')](_0x636398);};exports[_0xe137('0x14')]=function(_0x3297c1){var _0x5f37f7=_0x3297c1['slice'](-0x1);if(_0x5f37f7==='/'){_0x3297c1=_0x3297c1[_0xe137('0x15')](0x0,_0x3297c1[_0xe137('0x16')](_0x5f37f7));}return _0x3297c1;};exports[_0xe137('0x17')]=function(_0x515be7){if(!_[_0xe137('0x18')](_0x515be7)&&_0x515be7!==''){var _0x103473=/^(([^<>()\[\]\\.,;:\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 _0x103473['test'](String(_0x515be7)[_0xe137('0xb')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 24584ad..3c79acf 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 _0xcca3=['Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Contacts','phone','accessKey','getchallenge','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','split','trigger:browser:url','outbound','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','Fields','Ticket\x20created!','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','toUpperCase','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','string','idField','content','toString','type','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','getString','Subjects','format','%s/webservice.php','remoteUri','create','username','sessionName','then','success','resolve','result','stringify','error','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','GET','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','Agent\x20found!','email1','first_name','last_name','userId','admin','getUser','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20end\x20user\x20with\x20phone','query','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname'];(function(_0x5de02c,_0x2bca83){var _0x5bee77=function(_0x447356){while(--_0x447356){_0x5de02c['push'](_0x5de02c['shift']());}};_0x5bee77(++_0x2bca83);}(_0xcca3,0xe7));var _0x3cca=function(_0x30df37,_0x48ad64){_0x30df37=_0x30df37-0x0;var _0x41ab55=_0xcca3[_0x30df37];return _0x41ab55;};'use strict';var _=require('lodash');var rp=require(_0x3cca('0x0'));var BPromise=require(_0x3cca('0x1'));var md5=require(_0x3cca('0x2'));var util=require(_0x3cca('0x3'));var Redis=require(_0x3cca('0x4'));var intUtil=require(_0x3cca('0x5'));var config=require(_0x3cca('0x6'));var logger=require(_0x3cca('0x7'))(_0x3cca('0x8'));config[_0x3cca('0x9')]=_[_0x3cca('0xa')](config[_0x3cca('0x9')],{'host':_0x3cca('0xb'),'port':0x18eb});var io=require(_0x3cca('0xc'))(new Redis(config[_0x3cca('0x9')]));function emit(_0x4d287c,_0x27a567,_0x3280ef){io['to'](_0x4d287c)['emit'](_0x27a567,_0x3280ef);}function getCustomFields(_0x359341,_0x476d0e){var _0x3a1db3={};if(_0x359341[_0x3cca('0xd')]>0x0){_['forEach'](_0x359341,function(_0x4adb7c){if(_0x4adb7c['type']===_0x3cca('0xe')&&_0x4adb7c[_0x3cca('0xf')]){_0x3a1db3[_0x4adb7c['idField']]=_0x4adb7c[_0x3cca('0x10')][_0x3cca('0x11')]();}else if(_0x4adb7c[_0x3cca('0x12')]==='variable'&&_0x4adb7c[_0x3cca('0x13')]&&_0x4adb7c[_0x3cca('0xf')]&&_0x476d0e[_0x4adb7c[_0x3cca('0x13')]]){_0x3a1db3[_0x4adb7c[_0x3cca('0xf')]]=_0x476d0e[_0x4adb7c[_0x3cca('0x13')]][_0x3cca('0x11')]();}else if(_0x4adb7c[_0x3cca('0x12')]===_0x3cca('0x14')&&_0x4adb7c[_0x3cca('0x15')]&&_0x4adb7c[_0x3cca('0x15')]['name']&&_0x4adb7c[_0x3cca('0xf')]&&_0x476d0e[_0x4adb7c['Variable'][_0x3cca('0x16')][_0x3cca('0x17')]()]){_0x3a1db3[_0x4adb7c['idField']]=_0x476d0e[_0x4adb7c[_0x3cca('0x15')][_0x3cca('0x16')][_0x3cca('0x17')]()][_0x3cca('0x11')]();}});}return _0x3a1db3;}function createTicket(_0x1086e6,_0x33a284,_0x43949d,_0x4de889,_0x1e386b,_0x2d6728,_0x2b33c7){logger[_0x3cca('0x18')](_0x3cca('0x19'));var _0x339447=_['merge']({'parent_id':'','assigned_user_id':_0x33a284['id'],'ticketpriorities':_0x3cca('0x1a'),'ticketstatus':_0x3cca('0x1b'),'ticket_title':intUtil[_0x3cca('0x1c')](_0x4de889[_0x3cca('0x1d')],_0x1e386b,'\x20'),'description':intUtil['getString'](_0x4de889['Descriptions'],_0x1e386b,'\x0a'),'contact_id':_0x43949d['id']},getCustomFields(_0x2d6728,_0x1e386b));var _0x10d7b0={'method':'POST','uri':util[_0x3cca('0x1e')](_0x3cca('0x1f'),_0x1086e6[_0x3cca('0x20')]),'form':{'operation':_0x3cca('0x21'),'username':_0x1086e6[_0x3cca('0x22')],'sessionName':_0x2b33c7[_0x3cca('0x23')],'elementType':'HelpDesk','element':JSON['stringify'](_0x339447)},'json':!![]};return request(_0x10d7b0)[_0x3cca('0x24')](function(_0xcccfbb){if(_0xcccfbb[_0x3cca('0x25')]){return BPromise[_0x3cca('0x26')]({'id':_0xcccfbb[_0x3cca('0x27')]['id']});}else{throw new Error(util['format']('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x3cca('0x28')](_0xcccfbb[_0x3cca('0x29')])));}})[_0x3cca('0x2a')](function(_0x57e0cb){var _0x511aaa=_0x57e0cb[_0x3cca('0x2b')]||0x1f4;logger[_0x3cca('0x29')](_0x3cca('0x2c'),_0x3cca('0x2d'),_0x511aaa,JSON[_0x3cca('0x28')](_0x57e0cb));});}function getUser(_0x41dd84,_0x1477ac,_0x5dd612){if(intUtil[_0x3cca('0x2e')](_0x1477ac)){logger[_0x3cca('0x18')]('Getting\x20agent\x20with\x20email',_0x1477ac);return request({'method':_0x3cca('0x2f'),'uri':util[_0x3cca('0x1e')](_0x3cca('0x1f'),_0x41dd84[_0x3cca('0x20')]),'qs':{'operation':'query','username':_0x41dd84[_0x3cca('0x22')],'sessionName':_0x5dd612[_0x3cca('0x23')],'query':util[_0x3cca('0x1e')](_0x3cca('0x30'),_0x1477ac)},'json':!![]})[_0x3cca('0x24')](function(_0xc901e1){if(_0xc901e1[_0x3cca('0x25')]&&_0xc901e1[_0x3cca('0x27')][_0x3cca('0xd')]){logger[_0x3cca('0x18')](_0x3cca('0x31'));return BPromise[_0x3cca('0x26')]({'id':_0xc901e1[_0x3cca('0x27')][0x0]['id'],'email':_0xc901e1[_0x3cca('0x27')][0x0][_0x3cca('0x32')],'name':_0xc901e1[_0x3cca('0x27')][0x0][_0x3cca('0x33')]+'\x20'+_0xc901e1['result'][_0x3cca('0x34')]});}else{logger[_0x3cca('0x18')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x3cca('0x26')]({'id':_0x5dd612[_0x3cca('0x35')],'email':_0x41dd84[_0x3cca('0x22')],'name':_0x3cca('0x36')});}})['catch'](function(_0x41f567){var _0x212e05=_0x41f567[_0x3cca('0x2b')]||0x1f4;logger['error'](_0x3cca('0x2c'),_0x3cca('0x37'),_0x212e05,JSON[_0x3cca('0x28')](_0x41f567));});}else{logger[_0x3cca('0x18')](_0x3cca('0x38'));return BPromise['resolve']({'id':_0x5dd612[_0x3cca('0x35')],'email':_0x41dd84[_0x3cca('0x22')],'name':_0x3cca('0x36')})[_0x3cca('0x2a')](function(_0x13d417){var _0x3fa008=_0x13d417[_0x3cca('0x2b')]||0x1f4;logger[_0x3cca('0x29')](_0x3cca('0x2c'),_0x3cca('0x37'),_0x3fa008,JSON[_0x3cca('0x28')](_0x13d417));});}}function getEndUser(_0x838fba,_0x20c944,_0x5ab2fd,_0x11096e){logger[_0x3cca('0x18')](_0x3cca('0x39'),_0x5ab2fd);return request({'method':'GET','uri':util[_0x3cca('0x1e')](_0x3cca('0x1f'),_0x838fba[_0x3cca('0x20')]),'qs':{'operation':_0x3cca('0x3a'),'username':_0x838fba[_0x3cca('0x22')],'sessionName':_0x11096e[_0x3cca('0x23')],'query':util[_0x3cca('0x1e')](_0x3cca('0x3b'),_0x5ab2fd,_0x5ab2fd,_0x5ab2fd,_0x5ab2fd,_0x5ab2fd)},'json':!![]})[_0x3cca('0x24')](function(_0x583f6c){if(_0x583f6c[_0x3cca('0x25')]&&_0x583f6c[_0x3cca('0x27')][_0x3cca('0xd')]){logger[_0x3cca('0x18')](_0x3cca('0x3c'));return BPromise[_0x3cca('0x26')]({'id':_0x583f6c[_0x3cca('0x27')][0x0]['id'],'name':_0x583f6c[_0x3cca('0x27')][0x0][_0x3cca('0x3d')]+'\x20'+_0x583f6c[_0x3cca('0x27')][0x0][_0x3cca('0x3e')],'phone':_0x5ab2fd});}else{logger[_0x3cca('0x18')](_0x3cca('0x3f'));return request({'method':_0x3cca('0x40'),'uri':util['format'](_0x3cca('0x1f'),_0x838fba[_0x3cca('0x20')]),'form':{'operation':_0x3cca('0x21'),'sessionName':_0x11096e['sessionName'],'elementType':_0x3cca('0x41'),'element':JSON[_0x3cca('0x28')]({'lastname':_0x20c944,'phone':_0x5ab2fd,'assigned_user_id':'\x20'})},'json':!![]})[_0x3cca('0x24')](function(_0x3ab6d6){logger[_0x3cca('0x18')]('Enduser\x20created.');return BPromise['resolve']({'id':_0x3ab6d6[_0x3cca('0x27')]['id'],'name':_0x3ab6d6[_0x3cca('0x27')][_0x3cca('0x3e')],'phone':_0x3ab6d6[_0x3cca('0x27')][_0x3cca('0x42')]});})[_0x3cca('0x2a')](function(_0x2f4458){var _0x4ea00f=_0x2f4458['statusCode']||0x1f4;logger[_0x3cca('0x29')](_0x3cca('0x2c'),'getEndUser',_0x4ea00f,JSON[_0x3cca('0x28')](_0x2f4458));});}});}function getConnection(_0x5034bb){var _0x370db4=_0x5034bb[_0x3cca('0x22')];var _0x3646a=_0x5034bb[_0x3cca('0x43')];return request({'method':_0x3cca('0x2f'),'uri':util['format'](_0x3cca('0x1f'),_0x5034bb[_0x3cca('0x20')]),'qs':{'operation':_0x3cca('0x44'),'username':_0x370db4},'json':!![]})['then'](function(_0x5b1dec){if(_0x5b1dec[_0x3cca('0x25')]){return request({'method':_0x3cca('0x40'),'uri':util['format']('%s/webservice.php',_0x5034bb[_0x3cca('0x20')]),'form':{'operation':'login','username':_0x370db4,'accessKey':md5(_0x5b1dec[_0x3cca('0x27')]['token']+_0x3646a)},'json':!![]});}})[_0x3cca('0x24')](function(_0x206eeb){if(_0x206eeb[_0x3cca('0x25')]){return BPromise['resolve'](_0x206eeb[_0x3cca('0x27')]);}else{throw new Error(util['format'](_0x3cca('0x45'),_0x5034bb['id']));}})[_0x3cca('0x2a')](function(_0x144d5a){var _0x51ef54=_0x144d5a[_0x3cca('0x2b')]||0x1f4;logger[_0x3cca('0x29')](_0x3cca('0x2c'),_0x3cca('0x46'),_0x51ef54,JSON[_0x3cca('0x28')](_0x144d5a));});}function request(_0xbe93eb){logger[_0x3cca('0x18')](_0x3cca('0x47'),JSON[_0x3cca('0x28')](_0xbe93eb));return rp(_0xbe93eb);}exports['queue']=function(_0x45687a,_0x31cf66,_0x43fe73,_0x2df491,_0x10ad22,_0x2bc964){var _0x1dc9c8,_0x53d9fb,_0x399f66,_0x2f3361;_0x2bc964['remoteUri']=intUtil[_0x3cca('0x48')](_0x2bc964['remoteUri']);if(_0x10ad22&&_0x10ad22[_0x3cca('0x49')]){logger[_0x3cca('0x18')](_0x3cca('0x4a'),_0x3cca('0x4b'));_0x31cf66[_0x3cca('0x4c')]=util['format'](_0x3cca('0x4d'),_0x2bc964[_0x3cca('0x4e')],_0x31cf66['uniqueid'],md5(_0x31cf66[_0x3cca('0x4f')]));}else{_0x31cf66[_0x3cca('0x4c')]='';}return getConnection(_0x2bc964)[_0x3cca('0x24')](function(_0x275f42){_0x2f3361=_0x275f42;return getUser(_0x2bc964,_0x2df491['email'],_0x2f3361);})[_0x3cca('0x24')](function(_0x4c990b){_0x1dc9c8=_0x4c990b;logger['info'](_0x3cca('0x50'),_0x1dc9c8['id']);return getEndUser(_0x2bc964,_0x31cf66[_0x3cca('0x51')],_0x31cf66[_0x3cca('0x52')],_0x2f3361);})[_0x3cca('0x24')](function(_0x4fef5b){_0x53d9fb=_0x4fef5b;logger[_0x3cca('0x18')](_0x3cca('0x53'),_0x53d9fb['id']);return createTicket(_0x2bc964,_0x1dc9c8,_0x53d9fb,_0x43fe73,_0x31cf66,_0x43fe73['Fields'],_0x2f3361);})[_0x3cca('0x24')](function(_0xc9c1a0){_0x399f66=_0xc9c1a0;logger[_0x3cca('0x18')]('Ticket\x20created!');logger[_0x3cca('0x18')](_0x3cca('0x54'),_0x399f66['id']);var _0x1bd910=util[_0x3cca('0x1e')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x2bc964['remoteUri'],_[_0x3cca('0x55')](_0x399f66['id'],'x')[0x1]);logger[_0x3cca('0x18')](_0x3cca('0x4a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x3cca('0x1e')]('user:%s',_0x2df491[_0x3cca('0x16')]),_0x3cca('0x56'),{'uri':_0x1bd910});})[_0x3cca('0x2a')](function(_0x3b318d){logger[_0x3cca('0x29')]('[QUEUE]',JSON[_0x3cca('0x28')](_0x3b318d));});};exports[_0x3cca('0x57')]=function(_0x270ab4,_0x33fa84,_0x1af612,_0x1353ac,_0x54aa13,_0x29414e,_0x120944){var _0x1cf295,_0x20c5d2,_0x74a230,_0x238c88;_0x29414e[_0x3cca('0x20')]=intUtil[_0x3cca('0x48')](_0x29414e[_0x3cca('0x20')]);_0x29414e[_0x3cca('0x4e')]=intUtil[_0x3cca('0x48')](_0x29414e[_0x3cca('0x4e')]);if(_0x120944&&_0x120944['recordingFormat']&&_0x120944['recordingFormat']!==_0x3cca('0x58')){logger[_0x3cca('0x18')](_0x3cca('0x59'),_0x3cca('0x4b'));_0x33fa84[_0x3cca('0x4c')]=util['format'](_0x3cca('0x4d'),_0x29414e['serverUrl'],_0x33fa84[_0x3cca('0x4f')],md5(_0x33fa84[_0x3cca('0x4f')]));}return getConnection(_0x29414e)[_0x3cca('0x24')](function(_0x3977c7){_0x238c88=_0x3977c7;return getUser(_0x29414e,_0x1353ac[_0x3cca('0x5a')],_0x238c88);})[_0x3cca('0x24')](function(_0x2775d6){_0x1cf295=_0x2775d6;logger[_0x3cca('0x18')](_0x3cca('0x50'),_0x1cf295['id']);return getEndUser(_0x29414e,_0x33fa84[_0x3cca('0x5b')],_0x33fa84[_0x3cca('0x5c')],_0x238c88);})['then'](function(_0x1b28d3){_0x20c5d2=_0x1b28d3;logger[_0x3cca('0x18')]('The\x20Enduser\x20ID\x20is:',_0x20c5d2['id']);return createTicket(_0x29414e,_0x1cf295,_0x20c5d2,_0x1af612,_0x33fa84,_0x1af612[_0x3cca('0x5d')],_0x238c88);})[_0x3cca('0x24')](function(_0x21cddf){_0x74a230=_0x21cddf;logger['info'](_0x3cca('0x5e'));logger[_0x3cca('0x18')](_0x3cca('0x54'),_0x74a230['id']);var _0x5a2639=util[_0x3cca('0x1e')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x29414e['remoteUri'],_[_0x3cca('0x55')](_0x74a230['id'],'x')[0x1]);logger[_0x3cca('0x18')]('[OUTBOUND]',_0x3cca('0x5f'));emit(util[_0x3cca('0x1e')](_0x3cca('0x60'),_0x1353ac[_0x3cca('0x16')]),_0x3cca('0x56'),{'uri':_0x5a2639});})[_0x3cca('0x2a')](function(_0x2a40c3){logger[_0x3cca('0x29')](_0x3cca('0x59'),JSON['stringify'](_0x2a40c3));});};exports['unmanaged']=function(_0x546541,_0x1dbc40,_0x1ab8ff,_0x591ebe,_0x2a61c3,_0x434119){var _0x3a9aa3,_0x281d87,_0xc82932,_0x2d7c52;_0x434119[_0x3cca('0x20')]=intUtil[_0x3cca('0x48')](_0x434119[_0x3cca('0x20')]);_0x434119[_0x3cca('0x4e')]=intUtil[_0x3cca('0x48')](_0x434119[_0x3cca('0x4e')]);if(_0x2a61c3&&_0x2a61c3['monitor_format']){logger[_0x3cca('0x18')]('['+_0x1dbc40['lastevent'][_0x3cca('0x61')]()+']',_0x3cca('0x4b'));_0x1dbc40[_0x3cca('0x4c')]=util[_0x3cca('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x434119[_0x3cca('0x4e')],_0x1dbc40[_0x3cca('0x4f')],md5(_0x1dbc40[_0x3cca('0x4f')]));}else{_0x1dbc40[_0x3cca('0x4c')]='';}return getConnection(_0x434119)[_0x3cca('0x24')](function(_0x1c36b0){_0x2d7c52=_0x1c36b0;return getUser(_0x434119,'',_0x2d7c52);})[_0x3cca('0x24')](function(_0x405614){_0x3a9aa3=_0x405614;logger['info'](_0x3cca('0x50'),_0x3a9aa3['id']);return getEndUser(_0x434119,_0x1dbc40[_0x3cca('0x51')],_0x1dbc40[_0x3cca('0x52')],_0x2d7c52);})['then'](function(_0x301a09){_0x281d87=_0x301a09;logger[_0x3cca('0x18')](_0x3cca('0x53'),_0x281d87['id']);return createTicket(_0x434119,_0x3a9aa3,_0x281d87,_0x1ab8ff,_0x1dbc40,_0x1ab8ff['Fields'],_0x2d7c52);})[_0x3cca('0x24')](function(_0x4d6299){_0xc82932=_0x4d6299;logger[_0x3cca('0x18')](_0x3cca('0x5e'));logger[_0x3cca('0x18')]('The\x20Ticket\x20ID\x20is:',_0xc82932['id']);})[_0x3cca('0x2a')](function(_0x3bc534){logger[_0x3cca('0x29')]('['+_0x1dbc40['lastevent'][_0x3cca('0x61')]()+']',JSON['stringify'](_0x3bc534));});}; \ No newline at end of file +var _0xb959=['toLowerCase','info','Creating\x20new\x20ticket...','Normal','Subjects','getString','Descriptions','POST','format','remoteUri','create','username','sessionName','stringify','then','success','resolve','result','error','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','Agent\x20found!','email1','first_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','Searching\x20end\x20user\x20with\x20phone','%s/webservice.php','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','lastname','phone','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','split','user:%s','trigger:browser:url','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Fields','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','lastevent','toUpperCase','calleridname','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','localhost','emit','length','string','idField','content','toString','variable','variableName','type','customVariable','Variable','name'];(function(_0x505721,_0x4b0298){var _0x2eba26=function(_0xc623c2){while(--_0xc623c2){_0x505721['push'](_0x505721['shift']());}};_0x2eba26(++_0x4b0298);}(_0xb959,0x110));var _0x9b95=function(_0x4dee84,_0xea443c){_0x4dee84=_0x4dee84-0x0;var _0x28130d=_0xb959[_0x4dee84];return _0x28130d;};'use strict';var _=require(_0x9b95('0x0'));var rp=require(_0x9b95('0x1'));var BPromise=require('bluebird');var md5=require(_0x9b95('0x2'));var util=require(_0x9b95('0x3'));var Redis=require(_0x9b95('0x4'));var intUtil=require(_0x9b95('0x5'));var config=require(_0x9b95('0x6'));var logger=require(_0x9b95('0x7'))('vTiger');config['redis']=_[_0x9b95('0x8')](config['redis'],{'host':_0x9b95('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x1ed2a0,_0x144a2e,_0x5bcb00){io['to'](_0x1ed2a0)[_0x9b95('0xa')](_0x144a2e,_0x5bcb00);}function getCustomFields(_0x2e8f79,_0x52fea5){var _0x2ffffb={};if(_0x2e8f79[_0x9b95('0xb')]>0x0){_['forEach'](_0x2e8f79,function(_0x3f1246){if(_0x3f1246['type']===_0x9b95('0xc')&&_0x3f1246[_0x9b95('0xd')]){_0x2ffffb[_0x3f1246[_0x9b95('0xd')]]=_0x3f1246[_0x9b95('0xe')][_0x9b95('0xf')]();}else if(_0x3f1246['type']===_0x9b95('0x10')&&_0x3f1246[_0x9b95('0x11')]&&_0x3f1246['idField']&&_0x52fea5[_0x3f1246[_0x9b95('0x11')]]){_0x2ffffb[_0x3f1246[_0x9b95('0xd')]]=_0x52fea5[_0x3f1246['variableName']][_0x9b95('0xf')]();}else if(_0x3f1246[_0x9b95('0x12')]===_0x9b95('0x13')&&_0x3f1246[_0x9b95('0x14')]&&_0x3f1246[_0x9b95('0x14')]['name']&&_0x3f1246[_0x9b95('0xd')]&&_0x52fea5[_0x3f1246['Variable'][_0x9b95('0x15')][_0x9b95('0x16')]()]){_0x2ffffb[_0x3f1246['idField']]=_0x52fea5[_0x3f1246[_0x9b95('0x14')][_0x9b95('0x15')][_0x9b95('0x16')]()][_0x9b95('0xf')]();}});}return _0x2ffffb;}function createTicket(_0x1444b8,_0x5d6afe,_0x359f50,_0x549bf3,_0x1f211e,_0x346608,_0x8110dc){logger[_0x9b95('0x17')](_0x9b95('0x18'));var _0x4d3913=_['merge']({'parent_id':'','assigned_user_id':_0x5d6afe['id'],'ticketpriorities':_0x9b95('0x19'),'ticketstatus':'Open','ticket_title':intUtil['getString'](_0x549bf3[_0x9b95('0x1a')],_0x1f211e,'\x20'),'description':intUtil[_0x9b95('0x1b')](_0x549bf3[_0x9b95('0x1c')],_0x1f211e,'\x0a'),'contact_id':_0x359f50['id']},getCustomFields(_0x346608,_0x1f211e));var _0x520dd1={'method':_0x9b95('0x1d'),'uri':util[_0x9b95('0x1e')]('%s/webservice.php',_0x1444b8[_0x9b95('0x1f')]),'form':{'operation':_0x9b95('0x20'),'username':_0x1444b8[_0x9b95('0x21')],'sessionName':_0x8110dc[_0x9b95('0x22')],'elementType':'HelpDesk','element':JSON[_0x9b95('0x23')](_0x4d3913)},'json':!![]};return request(_0x520dd1)[_0x9b95('0x24')](function(_0x4320fa){if(_0x4320fa[_0x9b95('0x25')]){return BPromise[_0x9b95('0x26')]({'id':_0x4320fa[_0x9b95('0x27')]['id']});}else{throw new Error(util[_0x9b95('0x1e')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x9b95('0x23')](_0x4320fa[_0x9b95('0x28')])));}})[_0x9b95('0x29')](function(_0x3b7716){var _0x1c06a5=_0x3b7716[_0x9b95('0x2a')]||0x1f4;logger[_0x9b95('0x28')](_0x9b95('0x2b'),_0x9b95('0x2c'),_0x1c06a5,JSON[_0x9b95('0x23')](_0x3b7716));});}function getUser(_0x157ed1,_0x42a018,_0x5b6eeb){if(intUtil[_0x9b95('0x2d')](_0x42a018)){logger[_0x9b95('0x17')](_0x9b95('0x2e'),_0x42a018);return request({'method':_0x9b95('0x2f'),'uri':util['format']('%s/webservice.php',_0x157ed1['remoteUri']),'qs':{'operation':'query','username':_0x157ed1['username'],'sessionName':_0x5b6eeb[_0x9b95('0x22')],'query':util[_0x9b95('0x1e')]('SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;',_0x42a018)},'json':!![]})['then'](function(_0x46cb40){if(_0x46cb40[_0x9b95('0x25')]&&_0x46cb40['result'][_0x9b95('0xb')]){logger[_0x9b95('0x17')](_0x9b95('0x30'));return BPromise[_0x9b95('0x26')]({'id':_0x46cb40[_0x9b95('0x27')][0x0]['id'],'email':_0x46cb40[_0x9b95('0x27')][0x0][_0x9b95('0x31')],'name':_0x46cb40['result'][0x0][_0x9b95('0x32')]+'\x20'+_0x46cb40['result']['last_name']});}else{logger[_0x9b95('0x17')](_0x9b95('0x33'));return BPromise['resolve']({'id':_0x5b6eeb[_0x9b95('0x34')],'email':_0x157ed1['username'],'name':_0x9b95('0x35')});}})[_0x9b95('0x29')](function(_0x5797cb){var _0x48e7ea=_0x5797cb['statusCode']||0x1f4;logger[_0x9b95('0x28')](_0x9b95('0x2b'),_0x9b95('0x36'),_0x48e7ea,JSON[_0x9b95('0x23')](_0x5797cb));});}else{logger[_0x9b95('0x17')](_0x9b95('0x33'));return BPromise[_0x9b95('0x26')]({'id':_0x5b6eeb[_0x9b95('0x34')],'email':_0x157ed1[_0x9b95('0x21')],'name':_0x9b95('0x35')})[_0x9b95('0x29')](function(_0x30a6ff){var _0x4b6451=_0x30a6ff[_0x9b95('0x2a')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s',_0x9b95('0x36'),_0x4b6451,JSON[_0x9b95('0x23')](_0x30a6ff));});}}function getEndUser(_0x4054ce,_0xf6ffec,_0x21d5f3,_0x54379b){logger['info'](_0x9b95('0x37'),_0x21d5f3);return request({'method':_0x9b95('0x2f'),'uri':util[_0x9b95('0x1e')](_0x9b95('0x38'),_0x4054ce[_0x9b95('0x1f')]),'qs':{'operation':_0x9b95('0x39'),'username':_0x4054ce[_0x9b95('0x21')],'sessionName':_0x54379b[_0x9b95('0x22')],'query':util[_0x9b95('0x1e')](_0x9b95('0x3a'),_0x21d5f3,_0x21d5f3,_0x21d5f3,_0x21d5f3,_0x21d5f3)},'json':!![]})[_0x9b95('0x24')](function(_0x3aea4f){if(_0x3aea4f[_0x9b95('0x25')]&&_0x3aea4f[_0x9b95('0x27')][_0x9b95('0xb')]){logger[_0x9b95('0x17')](_0x9b95('0x3b'));return BPromise[_0x9b95('0x26')]({'id':_0x3aea4f['result'][0x0]['id'],'name':_0x3aea4f[_0x9b95('0x27')][0x0][_0x9b95('0x3c')]+'\x20'+_0x3aea4f[_0x9b95('0x27')][0x0]['lastname'],'phone':_0x21d5f3});}else{logger['info'](_0x9b95('0x3d'));return request({'method':_0x9b95('0x1d'),'uri':util[_0x9b95('0x1e')](_0x9b95('0x38'),_0x4054ce[_0x9b95('0x1f')]),'form':{'operation':'create','sessionName':_0x54379b['sessionName'],'elementType':_0x9b95('0x3e'),'element':JSON[_0x9b95('0x23')]({'lastname':_0xf6ffec,'phone':_0x21d5f3,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x2b0e34){logger[_0x9b95('0x17')]('Enduser\x20created.');return BPromise[_0x9b95('0x26')]({'id':_0x2b0e34[_0x9b95('0x27')]['id'],'name':_0x2b0e34[_0x9b95('0x27')][_0x9b95('0x3f')],'phone':_0x2b0e34[_0x9b95('0x27')][_0x9b95('0x40')]});})[_0x9b95('0x29')](function(_0x6de9b9){var _0x598fb9=_0x6de9b9['statusCode']||0x1f4;logger[_0x9b95('0x28')]('[vTiger],\x20%s,\x20%s,\x20%s','getEndUser',_0x598fb9,JSON[_0x9b95('0x23')](_0x6de9b9));});}});}function getConnection(_0x3cece5){var _0x1516f7=_0x3cece5[_0x9b95('0x21')];var _0x5d0a2c=_0x3cece5['accessKey'];return request({'method':_0x9b95('0x2f'),'uri':util[_0x9b95('0x1e')](_0x9b95('0x38'),_0x3cece5[_0x9b95('0x1f')]),'qs':{'operation':'getchallenge','username':_0x1516f7},'json':!![]})[_0x9b95('0x24')](function(_0x50a283){if(_0x50a283[_0x9b95('0x25')]){return request({'method':_0x9b95('0x1d'),'uri':util['format'](_0x9b95('0x38'),_0x3cece5[_0x9b95('0x1f')]),'form':{'operation':_0x9b95('0x41'),'username':_0x1516f7,'accessKey':md5(_0x50a283[_0x9b95('0x27')][_0x9b95('0x42')]+_0x5d0a2c)},'json':!![]});}})[_0x9b95('0x24')](function(_0x49590e){if(_0x49590e['success']){return BPromise[_0x9b95('0x26')](_0x49590e[_0x9b95('0x27')]);}else{throw new Error(util[_0x9b95('0x1e')](_0x9b95('0x43'),_0x3cece5['id']));}})[_0x9b95('0x29')](function(_0x1db571){var _0x391907=_0x1db571[_0x9b95('0x2a')]||0x1f4;logger[_0x9b95('0x28')](_0x9b95('0x2b'),_0x9b95('0x44'),_0x391907,JSON[_0x9b95('0x23')](_0x1db571));});}function request(_0x47b8a5){logger[_0x9b95('0x17')](_0x9b95('0x45'),JSON[_0x9b95('0x23')](_0x47b8a5));return rp(_0x47b8a5);}exports[_0x9b95('0x46')]=function(_0x1f9905,_0x7a3766,_0x4ac93d,_0x44963e,_0x370669,_0x9ec5e){var _0x2fc0be,_0x22fbc5,_0x5898e3,_0x3e37a6;_0x9ec5e[_0x9b95('0x1f')]=intUtil[_0x9b95('0x47')](_0x9ec5e[_0x9b95('0x1f')]);if(_0x370669&&_0x370669[_0x9b95('0x48')]){logger['info'](_0x9b95('0x49'),_0x9b95('0x4a'));_0x7a3766[_0x9b95('0x4b')]=util['format'](_0x9b95('0x4c'),_0x9ec5e[_0x9b95('0x4d')],_0x7a3766[_0x9b95('0x4e')],md5(_0x7a3766['uniqueid']));}else{_0x7a3766['recordingURL']='';}return getConnection(_0x9ec5e)[_0x9b95('0x24')](function(_0x1b37c1){_0x3e37a6=_0x1b37c1;return getUser(_0x9ec5e,_0x44963e[_0x9b95('0x4f')],_0x3e37a6);})[_0x9b95('0x24')](function(_0x31e94a){_0x2fc0be=_0x31e94a;logger[_0x9b95('0x17')](_0x9b95('0x50'),_0x2fc0be['id']);return getEndUser(_0x9ec5e,_0x7a3766['calleridname'],_0x7a3766[_0x9b95('0x51')],_0x3e37a6);})[_0x9b95('0x24')](function(_0x383643){_0x22fbc5=_0x383643;logger[_0x9b95('0x17')](_0x9b95('0x52'),_0x22fbc5['id']);return createTicket(_0x9ec5e,_0x2fc0be,_0x22fbc5,_0x4ac93d,_0x7a3766,_0x4ac93d['Fields'],_0x3e37a6);})[_0x9b95('0x24')](function(_0x589597){_0x5898e3=_0x589597;logger['info'](_0x9b95('0x53'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x5898e3['id']);var _0x1bc4bb=util[_0x9b95('0x1e')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x9ec5e['remoteUri'],_[_0x9b95('0x54')](_0x5898e3['id'],'x')[0x1]);logger[_0x9b95('0x17')](_0x9b95('0x49'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x9b95('0x1e')](_0x9b95('0x55'),_0x44963e[_0x9b95('0x15')]),_0x9b95('0x56'),{'uri':_0x1bc4bb});})[_0x9b95('0x29')](function(_0x34d76c){logger[_0x9b95('0x28')](_0x9b95('0x49'),JSON[_0x9b95('0x23')](_0x34d76c));});};exports['outbound']=function(_0x3b2a45,_0x5161da,_0x2ae225,_0x55ea7d,_0xc2dd90,_0x3f2881,_0x432c7b){var _0x11e97e,_0x29004c,_0x2aadbd,_0xeeed4a;_0x3f2881['remoteUri']=intUtil[_0x9b95('0x47')](_0x3f2881[_0x9b95('0x1f')]);_0x3f2881[_0x9b95('0x4d')]=intUtil[_0x9b95('0x47')](_0x3f2881[_0x9b95('0x4d')]);if(_0x432c7b&&_0x432c7b[_0x9b95('0x57')]&&_0x432c7b[_0x9b95('0x57')]!==_0x9b95('0x58')){logger[_0x9b95('0x17')](_0x9b95('0x59'),_0x9b95('0x4a'));_0x5161da['recordingURL']=util[_0x9b95('0x1e')](_0x9b95('0x4c'),_0x3f2881[_0x9b95('0x4d')],_0x5161da[_0x9b95('0x4e')],md5(_0x5161da[_0x9b95('0x4e')]));}return getConnection(_0x3f2881)[_0x9b95('0x24')](function(_0x465ff6){_0xeeed4a=_0x465ff6;return getUser(_0x3f2881,_0x55ea7d[_0x9b95('0x4f')],_0xeeed4a);})[_0x9b95('0x24')](function(_0x31680a){_0x11e97e=_0x31680a;logger[_0x9b95('0x17')](_0x9b95('0x50'),_0x11e97e['id']);return getEndUser(_0x3f2881,_0x5161da[_0x9b95('0x5a')],_0x5161da[_0x9b95('0x5b')],_0xeeed4a);})['then'](function(_0x3a997d){_0x29004c=_0x3a997d;logger['info'](_0x9b95('0x52'),_0x29004c['id']);return createTicket(_0x3f2881,_0x11e97e,_0x29004c,_0x2ae225,_0x5161da,_0x2ae225[_0x9b95('0x5c')],_0xeeed4a);})[_0x9b95('0x24')](function(_0x24c07a){_0x2aadbd=_0x24c07a;logger[_0x9b95('0x17')](_0x9b95('0x53'));logger[_0x9b95('0x17')](_0x9b95('0x5d'),_0x2aadbd['id']);var _0xca6aca=util['format']('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x3f2881['remoteUri'],_[_0x9b95('0x54')](_0x2aadbd['id'],'x')[0x1]);logger[_0x9b95('0x17')](_0x9b95('0x59'),_0x9b95('0x5e'));emit(util[_0x9b95('0x1e')](_0x9b95('0x55'),_0x55ea7d['name']),_0x9b95('0x56'),{'uri':_0xca6aca});})['catch'](function(_0x1ab99f){logger['error'](_0x9b95('0x59'),JSON[_0x9b95('0x23')](_0x1ab99f));});};exports['unmanaged']=function(_0x4d033e,_0xc74fba,_0x49babb,_0x13c468,_0xa544b1,_0x4b0d3e){var _0x2c59c6,_0x942d26,_0x720a27,_0x1da81a;_0x4b0d3e[_0x9b95('0x1f')]=intUtil[_0x9b95('0x47')](_0x4b0d3e[_0x9b95('0x1f')]);_0x4b0d3e[_0x9b95('0x4d')]=intUtil['stripTrailingSlash'](_0x4b0d3e[_0x9b95('0x4d')]);if(_0xa544b1&&_0xa544b1[_0x9b95('0x48')]){logger[_0x9b95('0x17')]('['+_0xc74fba[_0x9b95('0x5f')][_0x9b95('0x60')]()+']',_0x9b95('0x4a'));_0xc74fba['recordingURL']=util[_0x9b95('0x1e')](_0x9b95('0x4c'),_0x4b0d3e['serverUrl'],_0xc74fba[_0x9b95('0x4e')],md5(_0xc74fba[_0x9b95('0x4e')]));}else{_0xc74fba[_0x9b95('0x4b')]='';}return getConnection(_0x4b0d3e)[_0x9b95('0x24')](function(_0x3a449d){_0x1da81a=_0x3a449d;return getUser(_0x4b0d3e,'',_0x1da81a);})[_0x9b95('0x24')](function(_0x50f275){_0x2c59c6=_0x50f275;logger[_0x9b95('0x17')](_0x9b95('0x50'),_0x2c59c6['id']);return getEndUser(_0x4b0d3e,_0xc74fba[_0x9b95('0x61')],_0xc74fba[_0x9b95('0x51')],_0x1da81a);})[_0x9b95('0x24')](function(_0x343226){_0x942d26=_0x343226;logger['info'](_0x9b95('0x52'),_0x942d26['id']);return createTicket(_0x4b0d3e,_0x2c59c6,_0x942d26,_0x49babb,_0xc74fba,_0x49babb['Fields'],_0x1da81a);})[_0x9b95('0x24')](function(_0x63f691){_0x720a27=_0x63f691;logger[_0x9b95('0x17')](_0x9b95('0x53'));logger[_0x9b95('0x17')]('The\x20Ticket\x20ID\x20is:',_0x720a27['id']);})['catch'](function(_0x249ca7){logger[_0x9b95('0x28')]('['+_0xc74fba[_0x9b95('0x5f')][_0x9b95('0x60')]()+']',JSON[_0x9b95('0x23')](_0x249ca7));});}; \ 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 06feb7f..c375a5d 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 _0xd52a=['redis','defaults','emit','application/json','info','Creating\x20new\x20ticket...','format','merge','Tags','name','getString','Subjects','Descriptions','then','Ticket\x20created!','ticket','validateEmail','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','%s/users/me.json','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','filter','end-user','length','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','debug','[HTTP]','GET','map','forEach','string','customField','nameField','toLowerCase','content','idField','push','type','variableName','customVariable','Variable','custom_fields','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','email','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','POST','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','toUpperCase','recordingURL','lastevent','\x20Error\x20running\x20Zendesk\x20integration','request-promise','util','ioredis','./util','../../../../config/logger','zendesk'];(function(_0x4d8744,_0x203345){var _0x17fb37=function(_0x216209){while(--_0x216209){_0x4d8744['push'](_0x4d8744['shift']());}};_0x17fb37(++_0x203345);}(_0xd52a,0xca));var _0xad52=function(_0x70fe4d,_0x6b8f){_0x70fe4d=_0x70fe4d-0x0;var _0x108927=_0xd52a[_0x70fe4d];return _0x108927;};'use strict';var _=require('lodash');var rp=require(_0xad52('0x0'));var md5=require('md5');var util=require(_0xad52('0x1'));var Redis=require(_0xad52('0x2'));var intUtil=require(_0xad52('0x3'));var config=require('../../../../config/environment');var logger=require(_0xad52('0x4'))(_0xad52('0x5'));config[_0xad52('0x6')]=_[_0xad52('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xad52('0x6')]));function emit(_0x55f7a7,_0x23fc23,_0x4bbff0){io['to'](_0x55f7a7)[_0xad52('0x8')](_0x23fc23,_0x4bbff0);}var headers={'Content-Type':_0xad52('0x9'),'Accept':'application/json'};function getTicket(_0x39c078,_0x47db32,_0x46fbc5,_0x5ab3d2,_0x125d8a){logger[_0xad52('0xa')](_0xad52('0xb'));return request({'uri':util[_0xad52('0xc')]('%s/tickets.json',_0x39c078['remoteUri']),'method':'POST','body':{'ticket':_[_0xad52('0xd')]({'requester_id':_0x46fbc5['id'],'submitter_id':_0x47db32?_0x47db32['id']:undefined,'assignee_id':_0x47db32?_0x47db32['id']:undefined,'tags':getTags(_0x5ab3d2[_0xad52('0xe')],_0xad52('0xf')),'subject':intUtil[_0xad52('0x10')](_0x5ab3d2[_0xad52('0x11')],_0x125d8a,'\x20'),'description':intUtil[_0xad52('0x10')](_0x5ab3d2[_0xad52('0x12')],_0x125d8a,'\x0a'),'comment':{'public':![],'body':intUtil[_0xad52('0x10')](_0x5ab3d2[_0xad52('0x12')],_0x125d8a,'\x0a')}},getCustomFields(_0x5ab3d2['Fields'],_0x125d8a))}})[_0xad52('0x13')](function(_0x139305){logger[_0xad52('0xa')](_0xad52('0x14'));return _0x139305[_0xad52('0x15')];});}function getUser(_0xcb6cd5,_0x2bbaad){if(intUtil[_0xad52('0x16')](_0x2bbaad)){logger[_0xad52('0xa')]('Getting\x20agent\x20with\x20email',_0x2bbaad);return request({'uri':util['format'](_0xad52('0x17'),_0xcb6cd5[_0xad52('0x18')]),'qs':{'query':util[_0xad52('0xc')](_0xad52('0x19'),_0x2bbaad)}})[_0xad52('0x13')](function(_0x59a5e4){if(_0x59a5e4[_0xad52('0x1a')]){logger['info'](_0xad52('0x1b'));return _[_0xad52('0x1c')](_0x59a5e4[_0xad52('0x1d')],{'email':_0x2bbaad,'role':'agent'});}else{logger[_0xad52('0xa')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xad52('0xc')](_0xad52('0x1e'),_0xcb6cd5[_0xad52('0x18')])})[_0xad52('0x13')](function(_0x2c182f){logger[_0xad52('0xa')]('Admin\x20account\x20selected.');return _0x2c182f[_0xad52('0x1f')];});}});}else{logger['info'](_0xad52('0x20'));return request({'uri':util[_0xad52('0xc')](_0xad52('0x1e'),_0xcb6cd5[_0xad52('0x18')])})[_0xad52('0x13')](function(_0x579b9d){logger['info'](_0xad52('0x21'));return _0x579b9d['user'];});}}function getEndUser(_0x477b47,_0x3a54a1,_0x537df0){logger['info'](_0xad52('0x22'),_0x537df0);return request({'uri':util[_0xad52('0xc')](_0xad52('0x17'),_0x477b47['remoteUri']),'qs':{'query':util[_0xad52('0xc')]('type:user\x20role:end-user\x20phone:%s',_0x537df0)}})[_0xad52('0x13')](function(_0x3b5613){var _0x25fd54;if(_0x3b5613[_0xad52('0x1d')]['length']){_0x3b5613[_0xad52('0x1d')]=_[_0xad52('0x23')](_0x3b5613['results'],{'suspended':![],'role':_0xad52('0x24')});if(_0x3b5613[_0xad52('0x1d')][_0xad52('0x25')]){_0x25fd54=_[_0xad52('0x26')](_0x3b5613[_0xad52('0x1d')]);}}if(_0x25fd54){logger['info']('Enduser\x20found!');return _0x25fd54;}else{logger['info'](_0xad52('0x27'));return request({'uri':util[_0xad52('0xc')](_0xad52('0x28'),_0x477b47['remoteUri']),'method':'POST','body':{'user':{'role':_0xad52('0x24'),'name':util[_0xad52('0xc')](_0xad52('0x29'),_0x3a54a1||_0x537df0),'phone':_0x537df0}}})[_0xad52('0x13')](function(_0x919c28){logger[_0xad52('0xa')]('Enduser\x20created.');return _0x919c28[_0xad52('0x1f')];});}});}function getAuth(_0x1bb823){var _0x44f745;if(_0x1bb823[_0xad52('0x2a')]===_0xad52('0x2b')){_0x44f745=util[_0xad52('0xc')](_0xad52('0x2c'),_0x1bb823[_0xad52('0x2d')],_0x1bb823[_0xad52('0x2b')]);}else if(_0x1bb823[_0xad52('0x2a')]===_0xad52('0x2e')){_0x44f745=util['format'](_0xad52('0x2f'),_0x1bb823[_0xad52('0x2d')],_0x1bb823[_0xad52('0x2e')]);}return util[_0xad52('0xc')](_0xad52('0x30'),new Buffer(_0x44f745)[_0xad52('0x31')]('base64'));}function request(_0x244140){logger[_0xad52('0x32')](_0xad52('0x33'),JSON['stringify'](_0x244140));return rp(_[_0xad52('0x7')](_0x244140,{'method':_0xad52('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x268353,_0x4ad21c){var _0x3e2687=[];if(_0x268353&&_0x268353[_0xad52('0x25')]>0x0){_0x3e2687=_[_0xad52('0x35')](_0x268353,_0x4ad21c);}return _0x3e2687;}function getCustomFields(_0x49260f,_0x964452){var _0x437366=[];var _0xe562e4={'custom_fields':[]};if(_0x49260f[_0xad52('0x25')]>0x0){_[_0xad52('0x36')](_0x49260f,function(_0x2dc1f2){if(_0x2dc1f2['type']===_0xad52('0x37')&&_0x2dc1f2['nameField']&&!_0x2dc1f2[_0xad52('0x38')]){_0xe562e4[_0x2dc1f2[_0xad52('0x39')][_0xad52('0x3a')]()]=_0x2dc1f2[_0xad52('0x3b')][_0xad52('0x31')]();}else if(_0x2dc1f2['type']===_0xad52('0x37')&&_0x2dc1f2[_0xad52('0x3c')]&&_0x2dc1f2[_0xad52('0x38')]){_0xe562e4['custom_fields'][_0xad52('0x3d')]({'id':_0x2dc1f2[_0xad52('0x3c')],'value':_0x2dc1f2[_0xad52('0x3b')]['toString']()});}else if(_0x2dc1f2[_0xad52('0x3e')]==='variable'&&_0x2dc1f2[_0xad52('0x3f')]&&_0x2dc1f2[_0xad52('0x3c')]&&_0x2dc1f2[_0xad52('0x38')]){_0x964452[_0x2dc1f2[_0xad52('0x3f')]]&&_0xe562e4['custom_fields'][_0xad52('0x3d')]({'id':_0x2dc1f2[_0xad52('0x3c')],'value':_0x964452[_0x2dc1f2[_0xad52('0x3f')]][_0xad52('0x31')]()});}else if(_0x2dc1f2[_0xad52('0x3e')]===_0xad52('0x40')&&_0x2dc1f2[_0xad52('0x41')]&&_0x2dc1f2[_0xad52('0x41')]['name']&&_0x2dc1f2[_0xad52('0x3c')]&&_0x2dc1f2['customField']){_0x964452[_0x2dc1f2[_0xad52('0x41')][_0xad52('0xf')][_0xad52('0x3a')]()]&&_0xe562e4[_0xad52('0x42')][_0xad52('0x3d')]({'id':_0x2dc1f2[_0xad52('0x3c')],'value':_0x964452[_0x2dc1f2[_0xad52('0x41')][_0xad52('0xf')][_0xad52('0x3a')]()][_0xad52('0x31')]()});}});}return _0xe562e4;}exports[_0xad52('0x43')]=function(_0xa68d10,_0x4411eb,_0x791225,_0xd00d28,_0x472191,_0x2911de){var _0x5eb35e,_0x711cc6;_0x2911de[_0xad52('0x18')]=intUtil['stripTrailingSlash'](_0x2911de[_0xad52('0x18')]);_0x2911de[_0xad52('0x44')]=intUtil[_0xad52('0x45')](_0x2911de['serverUrl']);if(_0x472191&&_0x472191[_0xad52('0x46')]){logger['info'](_0xad52('0x47'),'Recording\x20is\x20enabled!');_0x4411eb['recordingURL']=util[_0xad52('0xc')](_0xad52('0x48'),_0x2911de[_0xad52('0x44')],_0x4411eb[_0xad52('0x49')],md5(_0x4411eb['uniqueid']));}else{_0x4411eb['recordingURL']='';}headers[_0xad52('0x4a')]=getAuth(_0x2911de);return getUser(_0x2911de,_0xd00d28['email'])[_0xad52('0x13')](function(_0x581f41){_0x5eb35e=_0x581f41;logger[_0xad52('0xa')](_0xad52('0x4b'),_0x5eb35e['id']);return getEndUser(_0x2911de,_0x4411eb[_0xad52('0x4c')],_0x4411eb[_0xad52('0x4d')]);})[_0xad52('0x13')](function(_0x382b60){_0x711cc6=_0x382b60;logger['info'](_0xad52('0x4e'),_0x711cc6['id']);return getTicket(_0x2911de,_0x5eb35e,_0x711cc6,_0x791225,_0x4411eb);})[_0xad52('0x13')](function(_0x44c401){if(_0x44c401){logger[_0xad52('0xa')]('The\x20Ticket\x20ID\x20is:',_0x44c401['id']);switch(_0x2911de[_0xad52('0x3e')]){case _0xad52('0x4f'):logger[_0xad52('0xa')]('[QUEUE]',_0xad52('0x50'));return request({'uri':util[_0xad52('0xc')](_0xad52('0x51'),_0x2911de[_0xad52('0x18')],_0x5eb35e['id'],_0x44c401['id']),'method':'POST'});case _0xad52('0x52'):logger[_0xad52('0xa')](_0xad52('0x47'),_0xad52('0x53'));emit(util[_0xad52('0xc')]('user:%s',_0xd00d28['name']),_0xad52('0x54'),{'uri':util[_0xad52('0xc')](_0xad52('0x55'),_0x2911de[_0xad52('0x18')],_0x44c401['id'])});break;default:logger[_0xad52('0x56')]('[QUEUE]',_0xad52('0x57'));}}})['catch'](function(_0x5fe34c){logger[_0xad52('0x56')](_0xad52('0x58'),util['inspect'](_0x5fe34c,{'showHidden':!![],'depth':null}));});};exports[_0xad52('0x59')]=function(_0x525485,_0x3784b5,_0x4218c6,_0xc95e44,_0x506889,_0x490866,_0xf0fc0d){var _0x4a5def,_0x14154e;_0x490866[_0xad52('0x18')]=intUtil['stripTrailingSlash'](_0x490866[_0xad52('0x18')]);_0x490866['serverUrl']=intUtil[_0xad52('0x45')](_0x490866[_0xad52('0x44')]);if(_0xf0fc0d&&_0xf0fc0d[_0xad52('0x5a')]&&_0xf0fc0d[_0xad52('0x5a')]!=='none'){logger['info'](_0xad52('0x5b'),_0xad52('0x5c'));_0x3784b5['recordingURL']=util[_0xad52('0xc')](_0xad52('0x48'),_0x490866[_0xad52('0x44')],_0x3784b5[_0xad52('0x49')],md5(_0x3784b5['uniqueid']));}headers[_0xad52('0x4a')]=getAuth(_0x490866);return getUser(_0x490866,_0xc95e44[_0xad52('0x5d')])[_0xad52('0x13')](function(_0x4082d7){_0x4a5def=_0x4082d7;logger[_0xad52('0xa')](_0xad52('0x4b'),_0x4a5def['id']);return getEndUser(_0x490866,_0x3784b5[_0xad52('0x5e')],_0x3784b5[_0xad52('0x5f')]);})['then'](function(_0x561d41){_0x14154e=_0x561d41;logger[_0xad52('0xa')](_0xad52('0x4e'),_0x14154e['id']);return getTicket(_0x490866,_0x4a5def,_0x14154e,_0x4218c6,_0x3784b5);})[_0xad52('0x13')](function(_0x4a6ccd){if(_0x4a6ccd){logger[_0xad52('0xa')](_0xad52('0x60'),_0x4a6ccd['id']);switch(_0x490866[_0xad52('0x3e')]){case'integrationTab':logger[_0xad52('0xa')]('[OUTBOUND]',_0xad52('0x50'));return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x490866[_0xad52('0x18')],_0x4a5def['id'],_0x4a6ccd['id']),'method':_0xad52('0x61')});case'newTab':logger['info']('[OUTBOUND]',_0xad52('0x53'));emit(util[_0xad52('0xc')]('user:%s',_0xc95e44[_0xad52('0xf')]),_0xad52('0x54'),{'uri':util[_0xad52('0xc')]('%s/agent/tickets/%s',_0x490866[_0xad52('0x18')],_0x4a6ccd['id'])});break;default:logger[_0xad52('0x56')](_0xad52('0x5b'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x45a065){logger[_0xad52('0x56')](_0xad52('0x62'),util[_0xad52('0x63')](_0x45a065,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x4d6b7a,_0x5d0daf,_0x19a102,_0x5d4abc,_0x122753,_0x3043f7){var _0x9204ff,_0x255008;_0x3043f7[_0xad52('0x18')]=intUtil[_0xad52('0x45')](_0x3043f7[_0xad52('0x18')]);_0x3043f7[_0xad52('0x44')]=intUtil[_0xad52('0x45')](_0x3043f7[_0xad52('0x44')]);if(_0x122753&&_0x122753[_0xad52('0x46')]){logger['info']('['+_0x5d0daf['lastevent'][_0xad52('0x64')]()+']','Recording\x20is\x20enabled!');_0x5d0daf[_0xad52('0x65')]=util[_0xad52('0xc')](_0xad52('0x48'),_0x3043f7['serverUrl'],_0x5d0daf[_0xad52('0x49')],md5(_0x5d0daf['uniqueid']));}else{_0x5d0daf['recordingURL']='';}headers[_0xad52('0x4a')]=getAuth(_0x3043f7);return getUser(_0x3043f7)[_0xad52('0x13')](function(_0x221cae){_0x9204ff=_0x221cae;logger[_0xad52('0xa')](_0xad52('0x4b'),_0x9204ff['id']);return getEndUser(_0x3043f7,_0x5d0daf['calleridname'],_0x5d0daf[_0xad52('0x4d')]);})['then'](function(_0x2d160e){_0x255008=_0x2d160e;logger[_0xad52('0xa')]('The\x20Enduser\x20ID\x20is:',_0x255008['id']);return getTicket(_0x3043f7,_0x9204ff,_0x255008,_0x19a102,_0x5d0daf);})[_0xad52('0x13')](function(_0x42a679){if(_0x42a679){logger[_0xad52('0xa')](_0xad52('0x60'),_0x42a679['id']);}})['catch'](function(_0xeface6){logger[_0xad52('0x56')]('['+_0x5d0daf[_0xad52('0x66')][_0xad52('0x64')]()+']'+_0xad52('0x67'),util[_0xad52('0x63')](_0xeface6,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xcffe=['POST','merge','Tags','name','getString','Subjects','Descriptions','then','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','Agent\x20found!','find','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','type:user\x20role:end-user\x20phone:%s','filter','end-user','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','%s/token:%s','token','toString','base64','[HTTP]','stringify','defaults','map','forEach','type','string','nameField','customField','toLowerCase','content','custom_fields','push','idField','variableName','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','error','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridname','integrationTab','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri'];(function(_0x12dc61,_0x383811){var _0x5e3cf9=function(_0x1d2e51){while(--_0x1d2e51){_0x12dc61['push'](_0x12dc61['shift']());}};_0x5e3cf9(++_0x383811);}(_0xcffe,0x1a1));var _0xecff=function(_0x5ac0f0,_0xee4d98){_0x5ac0f0=_0x5ac0f0-0x0;var _0x4aceec=_0xcffe[_0x5ac0f0];return _0x4aceec;};'use strict';var _=require(_0xecff('0x0'));var rp=require(_0xecff('0x1'));var md5=require(_0xecff('0x2'));var util=require(_0xecff('0x3'));var Redis=require(_0xecff('0x4'));var intUtil=require(_0xecff('0x5'));var config=require(_0xecff('0x6'));var logger=require(_0xecff('0x7'))(_0xecff('0x8'));config[_0xecff('0x9')]=_['defaults'](config['redis'],{'host':_0xecff('0xa'),'port':0x18eb});var io=require(_0xecff('0xb'))(new Redis(config[_0xecff('0x9')]));function emit(_0x38a8f6,_0x50c98b,_0x298c19){io['to'](_0x38a8f6)[_0xecff('0xc')](_0x50c98b,_0x298c19);}var headers={'Content-Type':'application/json','Accept':_0xecff('0xd')};function getTicket(_0x3eefb9,_0x195b15,_0x20ab4f,_0x698e40,_0x4fa444){logger[_0xecff('0xe')](_0xecff('0xf'));return request({'uri':util[_0xecff('0x10')](_0xecff('0x11'),_0x3eefb9[_0xecff('0x12')]),'method':_0xecff('0x13'),'body':{'ticket':_[_0xecff('0x14')]({'requester_id':_0x20ab4f['id'],'submitter_id':_0x195b15?_0x195b15['id']:undefined,'assignee_id':_0x195b15?_0x195b15['id']:undefined,'tags':getTags(_0x698e40[_0xecff('0x15')],_0xecff('0x16')),'subject':intUtil[_0xecff('0x17')](_0x698e40[_0xecff('0x18')],_0x4fa444,'\x20'),'description':intUtil[_0xecff('0x17')](_0x698e40[_0xecff('0x19')],_0x4fa444,'\x0a'),'comment':{'public':![],'body':intUtil[_0xecff('0x17')](_0x698e40['Descriptions'],_0x4fa444,'\x0a')}},getCustomFields(_0x698e40['Fields'],_0x4fa444))}})[_0xecff('0x1a')](function(_0x2e1d6f){logger['info'](_0xecff('0x1b'));return _0x2e1d6f[_0xecff('0x1c')];});}function getUser(_0x3a7623,_0x596b09){if(intUtil['validateEmail'](_0x596b09)){logger[_0xecff('0xe')](_0xecff('0x1d'),_0x596b09);return request({'uri':util['format'](_0xecff('0x1e'),_0x3a7623[_0xecff('0x12')]),'qs':{'query':util[_0xecff('0x10')](_0xecff('0x1f'),_0x596b09)}})[_0xecff('0x1a')](function(_0x1682a2){if(_0x1682a2['count']){logger[_0xecff('0xe')](_0xecff('0x20'));return _[_0xecff('0x21')](_0x1682a2[_0xecff('0x22')],{'email':_0x596b09,'role':'agent'});}else{logger[_0xecff('0xe')](_0xecff('0x23'));return request({'uri':util[_0xecff('0x10')](_0xecff('0x24'),_0x3a7623[_0xecff('0x12')])})[_0xecff('0x1a')](function(_0x494754){logger[_0xecff('0xe')]('Admin\x20account\x20selected.');return _0x494754['user'];});}});}else{logger[_0xecff('0xe')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xecff('0x10')]('%s/users/me.json',_0x3a7623[_0xecff('0x12')])})['then'](function(_0x1fd7c6){logger[_0xecff('0xe')]('Admin\x20account\x20selected.');return _0x1fd7c6[_0xecff('0x25')];});}}function getEndUser(_0x18f4d4,_0x393312,_0x3cadb9){logger[_0xecff('0xe')]('Searching\x20enduser\x20with\x20phone',_0x3cadb9);return request({'uri':util['format'](_0xecff('0x1e'),_0x18f4d4['remoteUri']),'qs':{'query':util[_0xecff('0x10')](_0xecff('0x26'),_0x3cadb9)}})[_0xecff('0x1a')](function(_0x1dfeb6){var _0x5c2360;if(_0x1dfeb6['results']['length']){_0x1dfeb6[_0xecff('0x22')]=_[_0xecff('0x27')](_0x1dfeb6[_0xecff('0x22')],{'suspended':![],'role':_0xecff('0x28')});if(_0x1dfeb6['results'][_0xecff('0x29')]){_0x5c2360=_[_0xecff('0x2a')](_0x1dfeb6[_0xecff('0x22')]);}}if(_0x5c2360){logger['info'](_0xecff('0x2b'));return _0x5c2360;}else{logger[_0xecff('0xe')](_0xecff('0x2c'));return request({'uri':util[_0xecff('0x10')]('%s/users.json',_0x18f4d4[_0xecff('0x12')]),'method':_0xecff('0x13'),'body':{'user':{'role':'end-user','name':util[_0xecff('0x10')](_0xecff('0x2d'),_0x393312||_0x3cadb9),'phone':_0x3cadb9}}})[_0xecff('0x1a')](function(_0x1ca0f3){logger['info'](_0xecff('0x2e'));return _0x1ca0f3[_0xecff('0x25')];});}});}function getAuth(_0x3fe6ce){var _0x55c232;if(_0x3fe6ce[_0xecff('0x2f')]===_0xecff('0x30')){_0x55c232=util[_0xecff('0x10')](_0xecff('0x31'),_0x3fe6ce[_0xecff('0x32')],_0x3fe6ce[_0xecff('0x30')]);}else if(_0x3fe6ce['authType']==='token'){_0x55c232=util['format'](_0xecff('0x33'),_0x3fe6ce['username'],_0x3fe6ce[_0xecff('0x34')]);}return util[_0xecff('0x10')]('Basic\x20%s',new Buffer(_0x55c232)[_0xecff('0x35')](_0xecff('0x36')));}function request(_0x2c17d5){logger['debug'](_0xecff('0x37'),JSON[_0xecff('0x38')](_0x2c17d5));return rp(_[_0xecff('0x39')](_0x2c17d5,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x1c8291,_0x3fce2e){var _0x226c01=[];if(_0x1c8291&&_0x1c8291[_0xecff('0x29')]>0x0){_0x226c01=_[_0xecff('0x3a')](_0x1c8291,_0x3fce2e);}return _0x226c01;}function getCustomFields(_0xcb518b,_0x1cf770){var _0x39a5f3=[];var _0x6d3916={'custom_fields':[]};if(_0xcb518b[_0xecff('0x29')]>0x0){_[_0xecff('0x3b')](_0xcb518b,function(_0x4e15e4){if(_0x4e15e4[_0xecff('0x3c')]===_0xecff('0x3d')&&_0x4e15e4[_0xecff('0x3e')]&&!_0x4e15e4[_0xecff('0x3f')]){_0x6d3916[_0x4e15e4[_0xecff('0x3e')][_0xecff('0x40')]()]=_0x4e15e4[_0xecff('0x41')][_0xecff('0x35')]();}else if(_0x4e15e4['type']===_0xecff('0x3d')&&_0x4e15e4['idField']&&_0x4e15e4[_0xecff('0x3f')]){_0x6d3916[_0xecff('0x42')][_0xecff('0x43')]({'id':_0x4e15e4[_0xecff('0x44')],'value':_0x4e15e4[_0xecff('0x41')][_0xecff('0x35')]()});}else if(_0x4e15e4[_0xecff('0x3c')]==='variable'&&_0x4e15e4[_0xecff('0x45')]&&_0x4e15e4[_0xecff('0x44')]&&_0x4e15e4['customField']){_0x1cf770[_0x4e15e4['variableName']]&&_0x6d3916[_0xecff('0x42')][_0xecff('0x43')]({'id':_0x4e15e4[_0xecff('0x44')],'value':_0x1cf770[_0x4e15e4[_0xecff('0x45')]][_0xecff('0x35')]()});}else if(_0x4e15e4[_0xecff('0x3c')]==='customVariable'&&_0x4e15e4[_0xecff('0x46')]&&_0x4e15e4[_0xecff('0x46')]['name']&&_0x4e15e4[_0xecff('0x44')]&&_0x4e15e4[_0xecff('0x3f')]){_0x1cf770[_0x4e15e4[_0xecff('0x46')][_0xecff('0x16')][_0xecff('0x40')]()]&&_0x6d3916[_0xecff('0x42')]['push']({'id':_0x4e15e4[_0xecff('0x44')],'value':_0x1cf770[_0x4e15e4[_0xecff('0x46')][_0xecff('0x16')]['toLowerCase']()][_0xecff('0x35')]()});}});}return _0x6d3916;}exports[_0xecff('0x47')]=function(_0x267ff5,_0x3c73ca,_0x515440,_0x1accb2,_0x20ed00,_0x58cdfb){var _0x22869d,_0x1d2ac3;_0x58cdfb['remoteUri']=intUtil[_0xecff('0x48')](_0x58cdfb['remoteUri']);_0x58cdfb[_0xecff('0x49')]=intUtil[_0xecff('0x48')](_0x58cdfb[_0xecff('0x49')]);if(_0x20ed00&&_0x20ed00[_0xecff('0x4a')]){logger[_0xecff('0xe')](_0xecff('0x4b'),'Recording\x20is\x20enabled!');_0x3c73ca['recordingURL']=util[_0xecff('0x10')](_0xecff('0x4c'),_0x58cdfb[_0xecff('0x49')],_0x3c73ca[_0xecff('0x4d')],md5(_0x3c73ca[_0xecff('0x4d')]));}else{_0x3c73ca[_0xecff('0x4e')]='';}headers[_0xecff('0x4f')]=getAuth(_0x58cdfb);return getUser(_0x58cdfb,_0x1accb2[_0xecff('0x50')])['then'](function(_0x34a768){_0x22869d=_0x34a768;logger[_0xecff('0xe')]('The\x20User\x20ID\x20is:',_0x22869d['id']);return getEndUser(_0x58cdfb,_0x3c73ca[_0xecff('0x51')],_0x3c73ca['calleridnum']);})[_0xecff('0x1a')](function(_0x453e4c){_0x1d2ac3=_0x453e4c;logger['info'](_0xecff('0x52'),_0x1d2ac3['id']);return getTicket(_0x58cdfb,_0x22869d,_0x1d2ac3,_0x515440,_0x3c73ca);})[_0xecff('0x1a')](function(_0x3e79f9){if(_0x3e79f9){logger[_0xecff('0xe')](_0xecff('0x53'),_0x3e79f9['id']);switch(_0x58cdfb['type']){case'integrationTab':logger[_0xecff('0xe')](_0xecff('0x4b'),_0xecff('0x54'));return request({'uri':util[_0xecff('0x10')](_0xecff('0x55'),_0x58cdfb[_0xecff('0x12')],_0x22869d['id'],_0x3e79f9['id']),'method':_0xecff('0x13')});case _0xecff('0x56'):logger[_0xecff('0xe')]('[QUEUE]',_0xecff('0x57'));emit(util['format'](_0xecff('0x58'),_0x1accb2[_0xecff('0x16')]),_0xecff('0x59'),{'uri':util['format'](_0xecff('0x5a'),_0x58cdfb['remoteUri'],_0x3e79f9['id'])});break;default:logger[_0xecff('0x5b')]('[QUEUE]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xecff('0x5c')](function(_0x5cd819){logger[_0xecff('0x5b')](_0xecff('0x5d'),util['inspect'](_0x5cd819,{'showHidden':!![],'depth':null}));});};exports[_0xecff('0x5e')]=function(_0x3bdf47,_0xe301,_0x1c6f34,_0x181760,_0x162938,_0x74fc77,_0x574c40){var _0x5e1a95,_0x1057be;_0x74fc77[_0xecff('0x12')]=intUtil[_0xecff('0x48')](_0x74fc77[_0xecff('0x12')]);_0x74fc77[_0xecff('0x49')]=intUtil[_0xecff('0x48')](_0x74fc77[_0xecff('0x49')]);if(_0x574c40&&_0x574c40[_0xecff('0x5f')]&&_0x574c40[_0xecff('0x5f')]!==_0xecff('0x60')){logger[_0xecff('0xe')](_0xecff('0x61'),_0xecff('0x62'));_0xe301[_0xecff('0x4e')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x74fc77[_0xecff('0x49')],_0xe301['uniqueid'],md5(_0xe301['uniqueid']));}headers[_0xecff('0x4f')]=getAuth(_0x74fc77);return getUser(_0x74fc77,_0x181760[_0xecff('0x50')])[_0xecff('0x1a')](function(_0x48a737){_0x5e1a95=_0x48a737;logger[_0xecff('0xe')](_0xecff('0x63'),_0x5e1a95['id']);return getEndUser(_0x74fc77,_0xe301[_0xecff('0x64')],_0xe301['destcalleridnum']);})[_0xecff('0x1a')](function(_0x56eefb){_0x1057be=_0x56eefb;logger['info'](_0xecff('0x52'),_0x1057be['id']);return getTicket(_0x74fc77,_0x5e1a95,_0x1057be,_0x1c6f34,_0xe301);})[_0xecff('0x1a')](function(_0x10275d){if(_0x10275d){logger[_0xecff('0xe')](_0xecff('0x53'),_0x10275d['id']);switch(_0x74fc77[_0xecff('0x3c')]){case _0xecff('0x65'):logger[_0xecff('0xe')](_0xecff('0x61'),_0xecff('0x54'));return request({'uri':util[_0xecff('0x10')](_0xecff('0x55'),_0x74fc77[_0xecff('0x12')],_0x5e1a95['id'],_0x10275d['id']),'method':_0xecff('0x13')});case'newTab':logger['info'](_0xecff('0x61'),_0xecff('0x57'));emit(util['format'](_0xecff('0x58'),_0x181760[_0xecff('0x16')]),'trigger:browser:url',{'uri':util[_0xecff('0x10')](_0xecff('0x5a'),_0x74fc77[_0xecff('0x12')],_0x10275d['id'])});break;default:logger[_0xecff('0x5b')](_0xecff('0x61'),_0xecff('0x66'));}}})['catch'](function(_0x1c7d9c){logger[_0xecff('0x5b')](_0xecff('0x67'),util[_0xecff('0x68')](_0x1c7d9c,{'showHidden':!![],'depth':null}));});};exports[_0xecff('0x69')]=function(_0x55ea2d,_0x31cd2d,_0x4ca3c0,_0x6988b9,_0x3e54b8,_0x5661b5){var _0x5988c2,_0x4f7b93;_0x5661b5[_0xecff('0x12')]=intUtil[_0xecff('0x48')](_0x5661b5[_0xecff('0x12')]);_0x5661b5['serverUrl']=intUtil[_0xecff('0x48')](_0x5661b5['serverUrl']);if(_0x3e54b8&&_0x3e54b8[_0xecff('0x4a')]){logger[_0xecff('0xe')]('['+_0x31cd2d[_0xecff('0x6a')][_0xecff('0x6b')]()+']','Recording\x20is\x20enabled!');_0x31cd2d[_0xecff('0x4e')]=util[_0xecff('0x10')](_0xecff('0x4c'),_0x5661b5['serverUrl'],_0x31cd2d['uniqueid'],md5(_0x31cd2d[_0xecff('0x4d')]));}else{_0x31cd2d[_0xecff('0x4e')]='';}headers['Authorization']=getAuth(_0x5661b5);return getUser(_0x5661b5)[_0xecff('0x1a')](function(_0x3756fe){_0x5988c2=_0x3756fe;logger[_0xecff('0xe')](_0xecff('0x63'),_0x5988c2['id']);return getEndUser(_0x5661b5,_0x31cd2d[_0xecff('0x51')],_0x31cd2d['calleridnum']);})['then'](function(_0x333580){_0x4f7b93=_0x333580;logger[_0xecff('0xe')]('The\x20Enduser\x20ID\x20is:',_0x4f7b93['id']);return getTicket(_0x5661b5,_0x5988c2,_0x4f7b93,_0x4ca3c0,_0x31cd2d);})['then'](function(_0xd588df){if(_0xd588df){logger['info'](_0xecff('0x53'),_0xd588df['id']);}})[_0xecff('0x5c')](function(_0x5155c1){logger[_0xecff('0x5b')]('['+_0x31cd2d[_0xecff('0x6a')][_0xecff('0x6b')]()+']'+_0xecff('0x6c'),util[_0xecff('0x68')](_0x5155c1,{'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 6bcdc16..e6ee098 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 _0xd7cf=['destcalleridname','destcalleridnum','trigger:browser:url','unmanaged','toUpperCase','md5','util','moment','ioredis','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','[HTTP]','stringify','length','forEach','type','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','indexOf','isNil','access_token','isBefore','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','expires_in','catch','stack','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','email','info','profile','user','Administrator','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','Error:\x20','log','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','contact','nothing','Creating\x20new\x20call...','Owner','administrator','getString','Description','Who_Id','Full_Name','First_Name','Last_Name','$se_module','talktime','Call_Duration','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','mm:ss','lastevent','called','Call_Result','Called','complete','connect','rejected','Rejected','abandoned','Abandoned','timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','Call\x20created!','err','queue','host','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','Recording\x20is\x20enabled!'];(function(_0xff659d,_0x2283a1){var _0x19c170=function(_0x15358e){while(--_0x15358e){_0xff659d['push'](_0xff659d['shift']());}};_0x19c170(++_0x2283a1);}(_0xd7cf,0x12b));var _0xfd7c=function(_0x2c2980,_0x34282a){_0x2c2980=_0x2c2980-0x0;var _0x2a20a9=_0xd7cf[_0x2c2980];return _0x2a20a9;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xfd7c('0x0'));var util=require(_0xfd7c('0x1'));var intUtil=require('./util');var moment=require(_0xfd7c('0x2'));var Redis=require(_0xfd7c('0x3'));var BPromise=require('bluebird');var config=require('../../../../config/environment');var logger=require(_0xfd7c('0x4'))(_0xfd7c('0x5'));config[_0xfd7c('0x6')]=_[_0xfd7c('0x7')](config['redis'],{'host':_0xfd7c('0x8'),'port':0x18eb});var io=require(_0xfd7c('0x9'))(new Redis(config[_0xfd7c('0x6')]));function emit(_0x2c7574,_0x4aace1,_0x36f338){io['to'](_0x2c7574)[_0xfd7c('0xa')](_0x4aace1,_0x36f338);}function request(_0xbe723c){logger['debug'](_0xfd7c('0xb'),JSON[_0xfd7c('0xc')](_0xbe723c));return rp(_0xbe723c);}function getCustomFields(_0x1adb82,_0x4d4395){var _0x21db6b={};if(_0x1adb82[_0xfd7c('0xd')]>0x0){_[_0xfd7c('0xe')](_0x1adb82,function(_0x3dc2a4){if(_0x3dc2a4[_0xfd7c('0xf')]==='string'&&_0x3dc2a4[_0xfd7c('0x10')]){_0x21db6b[_0x3dc2a4[_0xfd7c('0x10')]]=_0x3dc2a4[_0xfd7c('0x11')][_0xfd7c('0x12')]();}else if(_0x3dc2a4[_0xfd7c('0xf')]==='variable'&&_0x3dc2a4[_0xfd7c('0x13')]&&_0x3dc2a4[_0xfd7c('0x10')]&&_0x4d4395[_0x3dc2a4[_0xfd7c('0x13')]]){_0x21db6b[_0x3dc2a4[_0xfd7c('0x10')]]=_0x4d4395[_0x3dc2a4['variableName']]['toString']();}else if(_0x3dc2a4['type']===_0xfd7c('0x14')&&_0x3dc2a4[_0xfd7c('0x15')]&&_0x3dc2a4['Variable'][_0xfd7c('0x16')]&&_0x3dc2a4[_0xfd7c('0x10')]&&_0x4d4395[_0x3dc2a4['Variable'][_0xfd7c('0x16')][_0xfd7c('0x17')]()]){_0x21db6b[_0x3dc2a4[_0xfd7c('0x10')]]=_0x4d4395[_0x3dc2a4['Variable'][_0xfd7c('0x16')][_0xfd7c('0x17')]()]['toString']();}});}return _0x21db6b;}function getName(_0x2d96cb){if(_0x2d96cb[_0xfd7c('0x18')]('\x20')>0x0){var _0x1e8d4b=_0x2d96cb['split'](/ (.+)/);if(_0x1e8d4b[0x1]){return _0x1e8d4b;}}return[_0x2d96cb,_0x2d96cb];}var accountsTokens={};function getAccessToken(_0x58a155){return new Promise(function(_0x4d86c4,_0x483cc4){if(!_['isNil'](accountsTokens[_0x58a155['id']])&&!_[_0xfd7c('0x19')](accountsTokens[_0x58a155['id']][_0xfd7c('0x1a')])){if(moment()[_0xfd7c('0x1b')](accountsTokens[_0x58a155['id']]['expires_in'])){_0x4d86c4(accountsTokens[_0x58a155['id']][_0xfd7c('0x1a')]);}}var _0x1e62a2;switch(_0x58a155[_0xfd7c('0x1c')]){case'US':_0x1e62a2=_0xfd7c('0x1d');break;case'AU':_0x1e62a2=_0xfd7c('0x1e');break;case'EU':_0x1e62a2=_0xfd7c('0x1f');break;case'IN':_0x1e62a2='https://accounts.zoho.in';break;case'CN':_0x1e62a2=_0xfd7c('0x20');break;default:_0x1e62a2=_0xfd7c('0x1f');break;}var _0x2d7791={'method':_0xfd7c('0x21'),'uri':_0x1e62a2+_0xfd7c('0x22'),'qs':{'refresh_token':_0x58a155[_0xfd7c('0x23')],'client_id':_0x58a155[_0xfd7c('0x24')],'client_secret':_0x58a155[_0xfd7c('0x25')],'grant_type':_0xfd7c('0x26')},'json':!![]};return rp(_0x2d7791)[_0xfd7c('0x27')](function(_0x3cf58a){accountsTokens[_0x58a155['id']]={'access_token':_0x3cf58a['access_token'],'expires_in':moment()[_0xfd7c('0x28')](_0x3cf58a[_0xfd7c('0x29')],'seconds')};_0x4d86c4(_0x3cf58a[_0xfd7c('0x1a')]);})[_0xfd7c('0x2a')](function(_0x339b24){logger['error']('Failing\x20creating\x20the\x20access_token',_0x339b24[_0xfd7c('0x2b')]);_0x483cc4(_0x339b24);});});}function getUser(_0x1bd79b,_0x423407,_0x12a760,_0x59ca9f){logger['info']('Search\x20user');return request({'method':_0xfd7c('0x2c'),'uri':util[_0xfd7c('0x2d')](_0xfd7c('0x2e'),_0x423407),'qs':{'type':_0xfd7c('0x2f')},'headers':{'Authorization':_0xfd7c('0x30')+_0x1bd79b},'json':!![]})[_0xfd7c('0x27')](function(_0x15b6ec){if(_0x15b6ec['users']){var _0x310d40=-0x1;if(_['isArrayLikeObject'](_0x15b6ec[_0xfd7c('0x31')])){if(!_['isNil'](_0x59ca9f)){_0x310d40=_[_0xfd7c('0x32')](_0x15b6ec[_0xfd7c('0x31')],function(_0x4043dc){return _0x4043dc[_0xfd7c('0x33')]===_0x59ca9f;});}if(_0x310d40>=0x0){logger[_0xfd7c('0x34')]('Agent\x20found!');}else{logger[_0xfd7c('0x34')]('Using\x20the\x20admin\x20account!');_0x310d40=_[_0xfd7c('0x32')](_0x15b6ec[_0xfd7c('0x31')],function(_0x259d1e){return _0x259d1e[_0xfd7c('0x35')][_0xfd7c('0x16')]==='Administrator';});}return _0x15b6ec['users'][_0x310d40];}else{if(_0x15b6ec[_0xfd7c('0x36')][_0xfd7c('0x35')]['name']===_0xfd7c('0x37')){logger[_0xfd7c('0x34')]('Using\x20the\x20admin\x20account!');user=_0x15b6ec[_0xfd7c('0x36')];return user;}else{logger[_0xfd7c('0x38')](_0xfd7c('0x39'),JSON[_0xfd7c('0xc')](_0x15b6ec));throw new Error(_0xfd7c('0x3a')+JSON['stringify'](_0x15b6ec));}}}else{logger[_0xfd7c('0x38')](_0xfd7c('0x39'),JSON[_0xfd7c('0xc')](_0x15b6ec));throw new Error(_0xfd7c('0x3a')+JSON[_0xfd7c('0xc')](_0x15b6ec));}})[_0xfd7c('0x2a')](function(_0x37c9f5){console[_0xfd7c('0x38')](_0x37c9f5);});}function getZohoUser(_0x1ea83a,_0x5e3d23){return new BPromise(function(_0x160304,_0x2977aa){request(_0x1ea83a)['then'](function(_0x1470eb){var _0x203cc8=null;if(_0x1470eb){_0x203cc8=_0x1470eb[_0xfd7c('0x3b')][0x0];_0x203cc8[_0xfd7c('0x3c')]=_0x5e3d23;}_0x160304(_0x203cc8);})[_0xfd7c('0x2a')](function(_0x484ebf){_0x2977aa(_0x484ebf);});});}function createEndUser(_0x17ba0e,_0x1fe1aa,_0x16b0a5,_0x405a71,_0xdaabae,_0x570dea){var _0x16b0a5=getName(_0x16b0a5);return request({'method':'POST','uri':_0xfd7c('0x3d')+_0x1fe1aa+_0xfd7c('0x3e')+_[_0xfd7c('0x3f')](_0x570dea[_0xfd7c('0x40')])+'s','body':{'data':[{'Last_Name':_0x16b0a5[0x1],'First_Name':_0x16b0a5[0x0],'Phone':_0x405a71,'Owner':{'name':!_[_0xfd7c('0x19')](_0xdaabae['role']['name'])?_0xdaabae[_0xfd7c('0x41')][_0xfd7c('0x16')]:!_[_0xfd7c('0x19')](_0xdaabae[_0xfd7c('0x42')])?_0xdaabae['first_name']+'\x20'+_0xdaabae[_0xfd7c('0x43')]:_0xdaabae['last_name'],'id':_0xdaabae['id']}}]},'headers':{'Authorization':_0xfd7c('0x30')+_0x17ba0e},'json':!![]})[_0xfd7c('0x27')](function(_0x269c06){if(_0x269c06&&_0x269c06['data'][0x0][_0xfd7c('0x44')]===_0xfd7c('0x45')){var _0x3c30d5=_0x269c06[_0xfd7c('0x3b')][0x0][_0xfd7c('0x46')];_0x3c30d5[_0xfd7c('0x3c')]=_[_0xfd7c('0x3f')](_0x570dea['moduleCreate'])+'s';return _0x3c30d5;}logger[_0xfd7c('0x38')](_0xfd7c('0x39'),JSON['stringify'](data));throw new Error(_0xfd7c('0x47')+JSON[_0xfd7c('0xc')](data));})[_0xfd7c('0x2a')](function(_0x6dbec5){console[_0xfd7c('0x48')]('CREATE\x20ERROR',_0x6dbec5);});}function getEndUser(_0x4775fa,_0x3d5c95,_0x3ea4e9,_0x1f0d66,_0x28adff,_0x266578,_0x4166fb){var _0x38276f={'method':_0xfd7c('0x2c'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4775fa},'json':!![]};switch(_0x4166fb[_0xfd7c('0x49')]){case _0xfd7c('0x4a'):_0x38276f[_0xfd7c('0x4b')]=_0xfd7c('0x3d')+_0x3d5c95+_0xfd7c('0x4c')+_0x28adff+'))';return getZohoUser(_0x38276f,_0xfd7c('0x4d'))[_0xfd7c('0x27')](function(_0x4504f6){if(_0x4504f6)return _0x4504f6;_0x38276f[_0xfd7c('0x4b')]=_0xfd7c('0x3d')+_0x3d5c95+_0xfd7c('0x4e')+_0x28adff+'))';return getZohoUser(_0x38276f,_0xfd7c('0x4f'))[_0xfd7c('0x27')](function(_0x13472c){if(_0x13472c)return _0x13472c;if(_0x4166fb[_0xfd7c('0x40')]!='nothing'){return createEndUser(_0x4775fa,_0x3d5c95,_0x1f0d66,_0x28adff,_0x266578,_0x4166fb);}else{return{};}});});break;case _0xfd7c('0x50'):_0x38276f[_0xfd7c('0x4b')]=_0xfd7c('0x3d')+_0x3d5c95+_0xfd7c('0x4c')+_0x28adff+'))';return getZohoUser(_0x38276f,'Contacts')[_0xfd7c('0x27')](function(_0x4af2d3){if(_0x4af2d3)return _0x4af2d3;if(_0x4166fb['moduleCreate']!=_0xfd7c('0x51')){return createEndUser(_0x4775fa,_0x3d5c95,_0x1f0d66,_0x28adff,_0x266578,_0x4166fb);}else{return{};}});break;case'lead':_0x38276f[_0xfd7c('0x4b')]='https://www.zohoapis.'+_0x3d5c95+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x28adff+'))';return getZohoUser(_0x38276f,'Leads')[_0xfd7c('0x27')](function(_0x3a33bc){if(_0x3a33bc)return _0x3a33bc;if(_0x4166fb['moduleCreate']!=_0xfd7c('0x51')){return createEndUser(_0x4775fa,_0x3d5c95,_0x1f0d66,_0x28adff,_0x266578,_0x4166fb);}else{return{};}});break;}}function getCall(_0x528b0a,_0x4a54ee,_0x26b5f0,_0x23a172,_0x270e5e,_0x25ad1a,_0x22fb87,_0x1b3344){logger[_0xfd7c('0x34')](_0xfd7c('0x52'));var _0x476dbd={};_0x476dbd[_0xfd7c('0x53')]={'name':!_[_0xfd7c('0x19')](_0x23a172[_0xfd7c('0x41')][_0xfd7c('0x16')])&&!_[_0xfd7c('0x19')](_0x23a172[_0xfd7c('0x35')]['name'])&&_0x23a172[_0xfd7c('0x35')][_0xfd7c('0x16')]===_0xfd7c('0x54')?_0x23a172[_0xfd7c('0x41')]['name']:!_[_0xfd7c('0x19')](_0x23a172['first_name'])?_0x23a172[_0xfd7c('0x42')]+'\x20'+_0x23a172[_0xfd7c('0x43')]:_0x23a172[_0xfd7c('0x43')],'id':_0x23a172['id']};_0x476dbd['Subject']=intUtil[_0xfd7c('0x55')](_0x25ad1a['Subjects'],_0x22fb87,'\x20');_0x476dbd[_0xfd7c('0x56')]=intUtil[_0xfd7c('0x55')](_0x25ad1a['Descriptions'],_0x22fb87,'\x0a');if(_0x270e5e['enduserType']===_0xfd7c('0x4d')){_0x476dbd[_0xfd7c('0x57')]={'name':!_[_0xfd7c('0x19')](_0x270e5e[_0xfd7c('0x58')])?_0x270e5e[_0xfd7c('0x58')]:!_[_0xfd7c('0x19')](_0x270e5e['First_Name'])?_0x270e5e[_0xfd7c('0x59')]+'\x20'+_0x270e5e[_0xfd7c('0x5a')]:_0x270e5e[_0xfd7c('0x5a')],'id':_0x270e5e['id']};}if(_0x270e5e[_0xfd7c('0x3c')]===_0xfd7c('0x4f')){_0x476dbd['What_Id']={'name':!_[_0xfd7c('0x19')](_0x270e5e['Full_Name'])?_0x270e5e[_0xfd7c('0x58')]:!_[_0xfd7c('0x19')](_0x270e5e[_0xfd7c('0x59')])?_0x270e5e[_0xfd7c('0x59')]+'\x20'+_0x270e5e[_0xfd7c('0x5a')]:_0x270e5e[_0xfd7c('0x5a')],'id':_0x270e5e['id']};_0x476dbd[_0xfd7c('0x5b')]=_['startCase'](_0x270e5e[_0xfd7c('0x3c')]);}if(_0x22fb87[_0xfd7c('0x5c')]){_0x476dbd[_0xfd7c('0x5d')]=moment['utc'](parseInt(_0x22fb87['talktime'])*0x3e8)[_0xfd7c('0x2d')]('mm:ss');}else if(_0x22fb87[_0xfd7c('0x5e')]&&_0x22fb87[_0xfd7c('0x5f')]){_0x476dbd[_0xfd7c('0x5d')]=moment['utc'](moment(_0x22fb87[_0xfd7c('0x5f')],_0xfd7c('0x60'))[_0xfd7c('0x61')](moment(_0x22fb87[_0xfd7c('0x62')],'YYYY-MM-DDTHH:mm:ss')))['format'](_0xfd7c('0x63'));}switch(_0x22fb87[_0xfd7c('0x64')]){case _0xfd7c('0x65'):_0x476dbd[_0xfd7c('0x66')]=_0xfd7c('0x67');break;case _0xfd7c('0x68'):case _0xfd7c('0x69'):_0x476dbd[_0xfd7c('0x66')]='Answered';break;case _0xfd7c('0x6a'):_0x476dbd[_0xfd7c('0x66')]=_0xfd7c('0x6b');break;case _0xfd7c('0x6c'):_0x476dbd[_0xfd7c('0x66')]=_0xfd7c('0x6d');break;case _0xfd7c('0x6e'):_0x476dbd[_0xfd7c('0x66')]='Timeout';default:}_0x476dbd[_0xfd7c('0x6f')]=(_0x1b3344===_0xfd7c('0x70')?moment(_0x22fb87[_0xfd7c('0x62')])[_0xfd7c('0x2d')](_0xfd7c('0x60')):moment(_0x22fb87[_0xfd7c('0x71')])['format']('YYYY-MM-DDTHH:mm:ss'))||moment()['format'](_0xfd7c('0x60'));_0x476dbd[_0xfd7c('0x72')]=_0x1b3344||_0xfd7c('0x73');_0x476dbd=_[_0xfd7c('0x74')](_0x476dbd,getCustomFields(_0x25ad1a[_0xfd7c('0x75')],_0x22fb87));return request({'method':_0xfd7c('0x21'),'uri':_0xfd7c('0x3d')+_0x4a54ee+'/crm/v2/Calls','headers':{'Authorization':_0xfd7c('0x30')+_0x528b0a},'body':{'data':[_0x476dbd]},'json':!![]})[_0xfd7c('0x27')](function(_0x2be9cf){if(_0x2be9cf&&_0x2be9cf['data'][0x0]['code']===_0xfd7c('0x45')){logger['info'](_0xfd7c('0x76'));return{'id':_0x2be9cf['data'][0x0]['details']['id']};}})['catch'](function(_0x4bfd3e){logger[_0xfd7c('0x34')](_0xfd7c('0x77'),_0x4bfd3e[_0xfd7c('0x2b')]);console[_0xfd7c('0x48')](_0xfd7c('0x77'),_0x4bfd3e);});}exports[_0xfd7c('0x78')]=function(_0x30c4af,_0x3ae837,_0x30d125,_0x17a047,_0x5d54a1,_0x109bee){var _0x3ce11d,_0x5e3ea6,_0x1a65ae;_0x109bee['host']=intUtil['stripTrailingSlash'](_0x109bee[_0xfd7c('0x79')]);_0x109bee[_0xfd7c('0x7a')]=intUtil[_0xfd7c('0x7b')](_0x109bee[_0xfd7c('0x7a')]);if(_0x5d54a1&&_0x5d54a1[_0xfd7c('0x7c')]){logger[_0xfd7c('0x34')](_0xfd7c('0x7d'),'Recording\x20is\x20enabled!');_0x3ae837[_0xfd7c('0x7e')]=_0x109bee[_0xfd7c('0x7a')]+_0xfd7c('0x7f')+_0x3ae837['uniqueid']+_0xfd7c('0x80')+md5(_0x3ae837[_0xfd7c('0x81')]);}else{_0x3ae837['recordingURL']='';}var _0x17bd4f=_0x109bee[_0xfd7c('0x79')]===_0xfd7c('0x82')?'eu':_0xfd7c('0x83');return getAccessToken(_0x109bee)[_0xfd7c('0x27')](function(_0x1d6d7d){_0x1a65ae=_0x1d6d7d;return getUser(_0x1a65ae,_0x17bd4f,_0x109bee,_0x17a047[_0xfd7c('0x33')]);})[_0xfd7c('0x27')](function(_0x4763b9){_0x3ce11d=_0x4763b9;logger[_0xfd7c('0x34')](_0xfd7c('0x84'),_0x3ce11d['id']);return getEndUser(_0x1a65ae,_0x17bd4f,_0x109bee,_0x3ae837[_0xfd7c('0x85')],_0x3ae837[_0xfd7c('0x86')],_0x3ce11d,_0x30d125);})['then'](function(_0x5ac421){_0x5e3ea6=_0x5ac421;return getCall(_0x1a65ae,_0x17bd4f,_0x109bee,_0x3ce11d,_0x5e3ea6,_0x30d125,_0x3ae837,_0xfd7c('0x73'));})[_0xfd7c('0x27')](function(_0x560bc4){if(_0x560bc4){logger[_0xfd7c('0x34')](_0xfd7c('0x87'),_0x560bc4['id']);logger[_0xfd7c('0x34')]('[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xfd7c('0x88'),_0x17a047[_0xfd7c('0x16')]),'trigger:browser:url',{'uri':_0xfd7c('0x89')+_0x109bee[_0xfd7c('0x79')]+_0xfd7c('0x8a')+_0x560bc4['id']});}})[_0xfd7c('0x2a')](function(_0x5165d0){logger[_0xfd7c('0x38')](_0xfd7c('0x7d'),JSON[_0xfd7c('0xc')](_0x5165d0));});};exports[_0xfd7c('0x70')]=function(_0x493aee,_0x2fb80a,_0x43d889,_0x4f3e9f,_0x13da6f,_0x2cb8d3,_0xd6668d){var _0x1cd2e5,_0x18dc35,_0x5420ed;_0x2cb8d3['host']=intUtil['stripTrailingSlash'](_0x2cb8d3['host']);_0x2cb8d3[_0xfd7c('0x7a')]=intUtil['stripTrailingSlash'](_0x2cb8d3[_0xfd7c('0x7a')]);if(_0xd6668d&&_0xd6668d[_0xfd7c('0x8b')]&&_0xd6668d[_0xfd7c('0x8b')]!==_0xfd7c('0x8c')){logger[_0xfd7c('0x34')]('[OUTBOUND]',_0xfd7c('0x8d'));_0x2fb80a[_0xfd7c('0x7e')]=_0x2cb8d3[_0xfd7c('0x7a')]+_0xfd7c('0x7f')+_0x2fb80a[_0xfd7c('0x81')]+'/downloads?type=uniqueid&token='+md5(_0x2fb80a[_0xfd7c('0x81')]);}var _0x508971=_0x2cb8d3[_0xfd7c('0x79')]===_0xfd7c('0x82')?'eu':'com';return getAccessToken(_0x2cb8d3)[_0xfd7c('0x27')](function(_0x5bafb7){_0x5420ed=_0x5bafb7;return getUser(_0x5420ed,_0x508971,_0x2cb8d3,_0x4f3e9f[_0xfd7c('0x33')]);})[_0xfd7c('0x27')](function(_0x4afff9){_0x1cd2e5=_0x4afff9;logger['info'](_0xfd7c('0x84'),_0x1cd2e5['id']);return getEndUser(_0x5420ed,_0x508971,_0x2cb8d3,_0x2fb80a[_0xfd7c('0x8e')],_0x2fb80a[_0xfd7c('0x8f')],_0x1cd2e5,_0x43d889);})['then'](function(_0x3f45f4){_0x18dc35=_0x3f45f4;return getCall(_0x5420ed,_0x508971,_0x2cb8d3,_0x1cd2e5,_0x18dc35,_0x43d889,_0x2fb80a,'Outbound');})['then'](function(_0x2bcea5){if(_0x2bcea5){logger[_0xfd7c('0x34')](_0xfd7c('0x87'),_0x2bcea5['id']);logger[_0xfd7c('0x34')]('[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xfd7c('0x2d')](_0xfd7c('0x88'),_0x4f3e9f['name']),_0xfd7c('0x90'),{'uri':_0xfd7c('0x89')+_0x2cb8d3[_0xfd7c('0x79')]+_0xfd7c('0x8a')+_0x2bcea5['id']});}})[_0xfd7c('0x2a')](function(_0x3307e4){logger[_0xfd7c('0x38')]('[OUTBOUND]',JSON['stringify'](_0x3307e4));});};exports[_0xfd7c('0x91')]=function(_0x48ddde,_0x1d19d9,_0x572af8,_0x468ea6,_0x1cb1a2,_0x52eeaa){var _0x5a42b9,_0x1941bf,_0x24da84;_0x52eeaa['host']=intUtil[_0xfd7c('0x7b')](_0x52eeaa['host']);_0x52eeaa['serverUrl']=intUtil[_0xfd7c('0x7b')](_0x52eeaa['serverUrl']);if(_0x1cb1a2&&_0x1cb1a2[_0xfd7c('0x7c')]){logger['info']('['+_0x1d19d9['lastevent']['toUpperCase']()+']',_0xfd7c('0x8d'));_0x1d19d9[_0xfd7c('0x7e')]=_0x52eeaa[_0xfd7c('0x7a')]+_0xfd7c('0x7f')+_0x1d19d9[_0xfd7c('0x81')]+'/downloads?type=uniqueid&token='+md5(_0x1d19d9[_0xfd7c('0x81')]);}else{_0x1d19d9[_0xfd7c('0x7e')]='';}var _0x44fdee=_0x52eeaa['host']==='zoho.eu'?'eu':_0xfd7c('0x83');return getAccessToken(_0x52eeaa)[_0xfd7c('0x27')](function(_0x376130){_0x24da84=_0x376130;return getUser(_0x24da84,_0x44fdee,_0x52eeaa);})['then'](function(_0x1b5c4e){_0x5a42b9=_0x1b5c4e;logger[_0xfd7c('0x34')](_0xfd7c('0x84'),_0x5a42b9['id']);return getEndUser(_0x24da84,_0x44fdee,_0x52eeaa,_0x1d19d9['calleridname'],_0x1d19d9[_0xfd7c('0x86')],_0x5a42b9,_0x572af8);})[_0xfd7c('0x27')](function(_0x2ecccd){_0x1941bf=_0x2ecccd;return getCall(_0x24da84,_0x44fdee,_0x52eeaa,_0x5a42b9,_0x1941bf,_0x572af8,_0x1d19d9,_0xfd7c('0x73'));})[_0xfd7c('0x27')](function(_0x237a95){if(_0x237a95){logger[_0xfd7c('0x34')]('The\x20Call\x20ID\x20is:',_0x237a95['id']);}})['catch'](function(_0x19da43){logger[_0xfd7c('0x38')]('['+_0x1d19d9['lastevent'][_0xfd7c('0x92')]()+']',JSON[_0xfd7c('0xc')](_0x19da43));});}; \ No newline at end of file +var _0x1c01=['The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','then','data','enduserType','https://www.zohoapis.','/crm/v2/','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','code','SUCCESS','startCase','Error:\x20','log','CREATE\x20ERROR','GET','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','contact','nothing','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Descriptions','Who_Id','Full_Name','First_Name','What_Id','Last_Name','$se_module','talktime','Call_Duration','utc','answertime','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','mm:ss','lastevent','called','Call_Result','complete','connect','rejected','abandoned','Abandoned','timeout','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','err','queue','stripTrailingSlash','host','serverUrl','monitor_format','[QUEUE]','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','trigger:browser:url','unmanaged','toUpperCase','calleridname','lodash','request-promise','md5','util','moment','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','emit','[HTTP]','length','forEach','type','string','idField','variable','variableName','Variable','name','toLowerCase','toString','split','isNil','access_token','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','clientSecret','refresh_token','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','users','isArrayLikeObject','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','stringify'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x1c01,0x190));var _0x11c0=function(_0x54afc0,_0x400ec3){_0x54afc0=_0x54afc0-0x0;var _0x424f7f=_0x1c01[_0x54afc0];return _0x424f7f;};'use strict';var _=require(_0x11c0('0x0'));var rp=require(_0x11c0('0x1'));var md5=require(_0x11c0('0x2'));var util=require(_0x11c0('0x3'));var intUtil=require('./util');var moment=require(_0x11c0('0x4'));var Redis=require('ioredis');var BPromise=require('bluebird');var config=require(_0x11c0('0x5'));var logger=require(_0x11c0('0x6'))(_0x11c0('0x7'));config[_0x11c0('0x8')]=_[_0x11c0('0x9')](config['redis'],{'host':_0x11c0('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x11c0('0x8')]));function emit(_0x558a37,_0x127b2f,_0x5e7e01){io['to'](_0x558a37)[_0x11c0('0xb')](_0x127b2f,_0x5e7e01);}function request(_0x5578e8){logger['debug'](_0x11c0('0xc'),JSON['stringify'](_0x5578e8));return rp(_0x5578e8);}function getCustomFields(_0x426122,_0x39b2ac){var _0xc36416={};if(_0x426122[_0x11c0('0xd')]>0x0){_[_0x11c0('0xe')](_0x426122,function(_0x5c63d0){if(_0x5c63d0[_0x11c0('0xf')]===_0x11c0('0x10')&&_0x5c63d0[_0x11c0('0x11')]){_0xc36416[_0x5c63d0[_0x11c0('0x11')]]=_0x5c63d0['content']['toString']();}else if(_0x5c63d0[_0x11c0('0xf')]===_0x11c0('0x12')&&_0x5c63d0[_0x11c0('0x13')]&&_0x5c63d0[_0x11c0('0x11')]&&_0x39b2ac[_0x5c63d0[_0x11c0('0x13')]]){_0xc36416[_0x5c63d0[_0x11c0('0x11')]]=_0x39b2ac[_0x5c63d0[_0x11c0('0x13')]]['toString']();}else if(_0x5c63d0[_0x11c0('0xf')]==='customVariable'&&_0x5c63d0[_0x11c0('0x14')]&&_0x5c63d0['Variable'][_0x11c0('0x15')]&&_0x5c63d0[_0x11c0('0x11')]&&_0x39b2ac[_0x5c63d0[_0x11c0('0x14')]['name'][_0x11c0('0x16')]()]){_0xc36416[_0x5c63d0[_0x11c0('0x11')]]=_0x39b2ac[_0x5c63d0[_0x11c0('0x14')][_0x11c0('0x15')][_0x11c0('0x16')]()][_0x11c0('0x17')]();}});}return _0xc36416;}function getName(_0x4f2050){if(_0x4f2050['indexOf']('\x20')>0x0){var _0x165860=_0x4f2050[_0x11c0('0x18')](/ (.+)/);if(_0x165860[0x1]){return _0x165860;}}return[_0x4f2050,_0x4f2050];}var accountsTokens={};function getAccessToken(_0x369562){return new Promise(function(_0x205f6a,_0x1ee3b4){if(!_[_0x11c0('0x19')](accountsTokens[_0x369562['id']])&&!_[_0x11c0('0x19')](accountsTokens[_0x369562['id']][_0x11c0('0x1a')])){if(moment()['isBefore'](accountsTokens[_0x369562['id']][_0x11c0('0x1b')])){_0x205f6a(accountsTokens[_0x369562['id']][_0x11c0('0x1a')]);}}var _0x57b6bd;switch(_0x369562[_0x11c0('0x1c')]){case'US':_0x57b6bd=_0x11c0('0x1d');break;case'AU':_0x57b6bd=_0x11c0('0x1e');break;case'EU':_0x57b6bd=_0x11c0('0x1f');break;case'IN':_0x57b6bd=_0x11c0('0x20');break;case'CN':_0x57b6bd='https://accounts.zoho.com.cn';break;default:_0x57b6bd=_0x11c0('0x1f');break;}var _0x3c3dd7={'method':_0x11c0('0x21'),'uri':_0x57b6bd+_0x11c0('0x22'),'qs':{'refresh_token':_0x369562['refreshToken'],'client_id':_0x369562[_0x11c0('0x23')],'client_secret':_0x369562[_0x11c0('0x24')],'grant_type':_0x11c0('0x25')},'json':!![]};return rp(_0x3c3dd7)['then'](function(_0x349ecc){accountsTokens[_0x369562['id']]={'access_token':_0x349ecc[_0x11c0('0x1a')],'expires_in':moment()['add'](_0x349ecc['expires_in'],'seconds')};_0x205f6a(_0x349ecc[_0x11c0('0x1a')]);})[_0x11c0('0x26')](function(_0x73df10){logger[_0x11c0('0x27')](_0x11c0('0x28'),_0x73df10[_0x11c0('0x29')]);_0x1ee3b4(_0x73df10);});});}function getUser(_0x3bf582,_0x2a16a0,_0x2fbe0c,_0x55902c){logger[_0x11c0('0x2a')](_0x11c0('0x2b'));return request({'method':'GET','uri':util[_0x11c0('0x2c')](_0x11c0('0x2d'),_0x2a16a0),'qs':{'type':_0x11c0('0x2e')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3bf582},'json':!![]})['then'](function(_0x4540dc){if(_0x4540dc[_0x11c0('0x2f')]){var _0x8b3c8c=-0x1;if(_[_0x11c0('0x30')](_0x4540dc['users'])){if(!_[_0x11c0('0x19')](_0x55902c)){_0x8b3c8c=_['findIndex'](_0x4540dc[_0x11c0('0x2f')],function(_0x3513e7){return _0x3513e7[_0x11c0('0x31')]===_0x55902c;});}if(_0x8b3c8c>=0x0){logger['info'](_0x11c0('0x32'));}else{logger['info'](_0x11c0('0x33'));_0x8b3c8c=_['findIndex'](_0x4540dc[_0x11c0('0x2f')],function(_0x2f2b56){return _0x2f2b56[_0x11c0('0x34')][_0x11c0('0x15')]===_0x11c0('0x35');});}return _0x4540dc[_0x11c0('0x2f')][_0x8b3c8c];}else{if(_0x4540dc['user'][_0x11c0('0x34')]['name']===_0x11c0('0x35')){logger['info'](_0x11c0('0x33'));user=_0x4540dc[_0x11c0('0x36')];return user;}else{logger['error']('The\x20failing\x20result\x20is',JSON[_0x11c0('0x37')](_0x4540dc));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x11c0('0x37')](_0x4540dc));}}}else{logger[_0x11c0('0x27')](_0x11c0('0x38'),JSON[_0x11c0('0x37')](_0x4540dc));throw new Error(_0x11c0('0x39')+JSON['stringify'](_0x4540dc));}})['catch'](function(_0x1ffcea){console[_0x11c0('0x27')](_0x1ffcea);});}function getZohoUser(_0x470d9b,_0x25a4e0){return new BPromise(function(_0x3fbd3b,_0x308e40){request(_0x470d9b)[_0x11c0('0x3a')](function(_0x19dd89){var _0x57fb27=null;if(_0x19dd89){_0x57fb27=_0x19dd89[_0x11c0('0x3b')][0x0];_0x57fb27[_0x11c0('0x3c')]=_0x25a4e0;}_0x3fbd3b(_0x57fb27);})['catch'](function(_0x175c93){_0x308e40(_0x175c93);});});}function createEndUser(_0x4ef2fb,_0x2c4f37,_0x236a33,_0x5c4c12,_0x250893,_0x4bdc72){var _0x236a33=getName(_0x236a33);return request({'method':_0x11c0('0x21'),'uri':_0x11c0('0x3d')+_0x2c4f37+_0x11c0('0x3e')+_['startCase'](_0x4bdc72[_0x11c0('0x3f')])+'s','body':{'data':[{'Last_Name':_0x236a33[0x1],'First_Name':_0x236a33[0x0],'Phone':_0x5c4c12,'Owner':{'name':!_['isNil'](_0x250893[_0x11c0('0x40')]['name'])?_0x250893['role'][_0x11c0('0x15')]:!_[_0x11c0('0x19')](_0x250893[_0x11c0('0x41')])?_0x250893[_0x11c0('0x41')]+'\x20'+_0x250893[_0x11c0('0x42')]:_0x250893[_0x11c0('0x42')],'id':_0x250893['id']}}]},'headers':{'Authorization':_0x11c0('0x43')+_0x4ef2fb},'json':!![]})[_0x11c0('0x3a')](function(_0x368488){if(_0x368488&&_0x368488['data'][0x0][_0x11c0('0x44')]===_0x11c0('0x45')){var _0x4329e4=_0x368488[_0x11c0('0x3b')][0x0]['details'];_0x4329e4[_0x11c0('0x3c')]=_[_0x11c0('0x46')](_0x4bdc72[_0x11c0('0x3f')])+'s';return _0x4329e4;}logger[_0x11c0('0x27')](_0x11c0('0x38'),JSON[_0x11c0('0x37')](data));throw new Error(_0x11c0('0x47')+JSON[_0x11c0('0x37')](data));})[_0x11c0('0x26')](function(_0x418bef){console[_0x11c0('0x48')](_0x11c0('0x49'),_0x418bef);});}function getEndUser(_0x3c45b2,_0x13dfe8,_0x2a5b02,_0x588ee4,_0xf65150,_0x3011de,_0x4cb23c){var _0x2979a4={'method':_0x11c0('0x4a'),'uri':'','headers':{'Authorization':_0x11c0('0x43')+_0x3c45b2},'json':!![]};switch(_0x4cb23c['moduleSearch']){case _0x11c0('0x4b'):_0x2979a4[_0x11c0('0x4c')]=_0x11c0('0x3d')+_0x13dfe8+_0x11c0('0x4d')+_0xf65150+'))';return getZohoUser(_0x2979a4,_0x11c0('0x4e'))[_0x11c0('0x3a')](function(_0xaf6f1e){if(_0xaf6f1e)return _0xaf6f1e;_0x2979a4[_0x11c0('0x4c')]=_0x11c0('0x3d')+_0x13dfe8+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0xf65150+'))';return getZohoUser(_0x2979a4,'Leads')[_0x11c0('0x3a')](function(_0x572477){if(_0x572477)return _0x572477;if(_0x4cb23c[_0x11c0('0x3f')]!='nothing'){return createEndUser(_0x3c45b2,_0x13dfe8,_0x588ee4,_0xf65150,_0x3011de,_0x4cb23c);}else{return{};}});});break;case _0x11c0('0x4f'):_0x2979a4[_0x11c0('0x4c')]='https://www.zohoapis.'+_0x13dfe8+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0xf65150+'))';return getZohoUser(_0x2979a4,_0x11c0('0x4e'))[_0x11c0('0x3a')](function(_0x4f2e9a){if(_0x4f2e9a)return _0x4f2e9a;if(_0x4cb23c[_0x11c0('0x3f')]!=_0x11c0('0x50')){return createEndUser(_0x3c45b2,_0x13dfe8,_0x588ee4,_0xf65150,_0x3011de,_0x4cb23c);}else{return{};}});break;case _0x11c0('0x51'):_0x2979a4[_0x11c0('0x4c')]=_0x11c0('0x3d')+_0x13dfe8+_0x11c0('0x52')+_0xf65150+'))';return getZohoUser(_0x2979a4,_0x11c0('0x53'))[_0x11c0('0x3a')](function(_0x4643a5){if(_0x4643a5)return _0x4643a5;if(_0x4cb23c[_0x11c0('0x3f')]!=_0x11c0('0x50')){return createEndUser(_0x3c45b2,_0x13dfe8,_0x588ee4,_0xf65150,_0x3011de,_0x4cb23c);}else{return{};}});break;}}function getCall(_0x55ed52,_0x1b4549,_0x221e9a,_0x34e5ef,_0x58803c,_0x46d054,_0x54ecd2,_0x1ba268){logger[_0x11c0('0x2a')](_0x11c0('0x54'));var _0xc469a4={};_0xc469a4[_0x11c0('0x55')]={'name':!_['isNil'](_0x34e5ef['role'][_0x11c0('0x15')])&&!_[_0x11c0('0x19')](_0x34e5ef['profile'][_0x11c0('0x15')])&&_0x34e5ef[_0x11c0('0x34')][_0x11c0('0x15')]===_0x11c0('0x56')?_0x34e5ef[_0x11c0('0x40')]['name']:!_[_0x11c0('0x19')](_0x34e5ef[_0x11c0('0x41')])?_0x34e5ef[_0x11c0('0x41')]+'\x20'+_0x34e5ef['last_name']:_0x34e5ef[_0x11c0('0x42')],'id':_0x34e5ef['id']};_0xc469a4[_0x11c0('0x57')]=intUtil[_0x11c0('0x58')](_0x46d054[_0x11c0('0x59')],_0x54ecd2,'\x20');_0xc469a4['Description']=intUtil[_0x11c0('0x58')](_0x46d054[_0x11c0('0x5a')],_0x54ecd2,'\x0a');if(_0x58803c[_0x11c0('0x3c')]==='Contacts'){_0xc469a4[_0x11c0('0x5b')]={'name':!_[_0x11c0('0x19')](_0x58803c[_0x11c0('0x5c')])?_0x58803c[_0x11c0('0x5c')]:!_['isNil'](_0x58803c[_0x11c0('0x5d')])?_0x58803c[_0x11c0('0x5d')]+'\x20'+_0x58803c['Last_Name']:_0x58803c['Last_Name'],'id':_0x58803c['id']};}if(_0x58803c[_0x11c0('0x3c')]===_0x11c0('0x53')){_0xc469a4[_0x11c0('0x5e')]={'name':!_['isNil'](_0x58803c[_0x11c0('0x5c')])?_0x58803c[_0x11c0('0x5c')]:!_['isNil'](_0x58803c['First_Name'])?_0x58803c[_0x11c0('0x5d')]+'\x20'+_0x58803c['Last_Name']:_0x58803c[_0x11c0('0x5f')],'id':_0x58803c['id']};_0xc469a4[_0x11c0('0x60')]=_[_0x11c0('0x46')](_0x58803c['enduserType']);}if(_0x54ecd2[_0x11c0('0x61')]){_0xc469a4[_0x11c0('0x62')]=moment[_0x11c0('0x63')](parseInt(_0x54ecd2[_0x11c0('0x61')])*0x3e8)[_0x11c0('0x2c')]('mm:ss');}else if(_0x54ecd2[_0x11c0('0x64')]&&_0x54ecd2[_0x11c0('0x65')]){_0xc469a4[_0x11c0('0x62')]=moment['utc'](moment(_0x54ecd2[_0x11c0('0x65')],'YYYY-MM-DDTHH:mm:ss')[_0x11c0('0x66')](moment(_0x54ecd2[_0x11c0('0x67')],_0x11c0('0x68'))))[_0x11c0('0x2c')](_0x11c0('0x69'));}switch(_0x54ecd2[_0x11c0('0x6a')]){case _0x11c0('0x6b'):_0xc469a4[_0x11c0('0x6c')]='Called';break;case _0x11c0('0x6d'):case _0x11c0('0x6e'):_0xc469a4['Call_Result']='Answered';break;case _0x11c0('0x6f'):_0xc469a4[_0x11c0('0x6c')]='Rejected';break;case _0x11c0('0x70'):_0xc469a4['Call_Result']=_0x11c0('0x71');break;case _0x11c0('0x72'):_0xc469a4[_0x11c0('0x6c')]='Timeout';default:}_0xc469a4['Call_Start_Time']=(_0x1ba268==='outbound'?moment(_0x54ecd2[_0x11c0('0x67')])[_0x11c0('0x2c')](_0x11c0('0x68')):moment(_0x54ecd2[_0x11c0('0x73')])['format'](_0x11c0('0x68')))||moment()[_0x11c0('0x2c')](_0x11c0('0x68'));_0xc469a4[_0x11c0('0x74')]=_0x1ba268||_0x11c0('0x75');_0xc469a4=_[_0x11c0('0x76')](_0xc469a4,getCustomFields(_0x46d054[_0x11c0('0x77')],_0x54ecd2));return request({'method':'POST','uri':_0x11c0('0x3d')+_0x1b4549+_0x11c0('0x78'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x55ed52},'body':{'data':[_0xc469a4]},'json':!![]})[_0x11c0('0x3a')](function(_0x5acf4d){if(_0x5acf4d&&_0x5acf4d[_0x11c0('0x3b')][0x0][_0x11c0('0x44')]===_0x11c0('0x45')){logger[_0x11c0('0x2a')]('Call\x20created!');return{'id':_0x5acf4d[_0x11c0('0x3b')][0x0]['details']['id']};}})['catch'](function(_0xb8047e){logger[_0x11c0('0x2a')]('err',_0xb8047e[_0x11c0('0x29')]);console['log'](_0x11c0('0x79'),_0xb8047e);});}exports[_0x11c0('0x7a')]=function(_0x5bc9cc,_0x57dbe2,_0x30e5b2,_0xa17524,_0x1c170d,_0xfaa120){var _0x98288c,_0x4c8445,_0x382f6a;_0xfaa120['host']=intUtil[_0x11c0('0x7b')](_0xfaa120[_0x11c0('0x7c')]);_0xfaa120[_0x11c0('0x7d')]=intUtil['stripTrailingSlash'](_0xfaa120[_0x11c0('0x7d')]);if(_0x1c170d&&_0x1c170d[_0x11c0('0x7e')]){logger[_0x11c0('0x2a')](_0x11c0('0x7f'),'Recording\x20is\x20enabled!');_0x57dbe2[_0x11c0('0x80')]=_0xfaa120[_0x11c0('0x7d')]+_0x11c0('0x81')+_0x57dbe2[_0x11c0('0x82')]+_0x11c0('0x83')+md5(_0x57dbe2[_0x11c0('0x82')]);}else{_0x57dbe2[_0x11c0('0x80')]='';}var _0x193936=_0xfaa120[_0x11c0('0x7c')]===_0x11c0('0x84')?'eu':_0x11c0('0x85');return getAccessToken(_0xfaa120)['then'](function(_0x179c2a){_0x382f6a=_0x179c2a;return getUser(_0x382f6a,_0x193936,_0xfaa120,_0xa17524['email']);})[_0x11c0('0x3a')](function(_0x44b143){_0x98288c=_0x44b143;logger[_0x11c0('0x2a')]('The\x20User\x20ID\x20is:',_0x98288c['id']);return getEndUser(_0x382f6a,_0x193936,_0xfaa120,_0x57dbe2['calleridname'],_0x57dbe2[_0x11c0('0x86')],_0x98288c,_0x30e5b2);})['then'](function(_0x2b586c){_0x4c8445=_0x2b586c;return getCall(_0x382f6a,_0x193936,_0xfaa120,_0x98288c,_0x4c8445,_0x30e5b2,_0x57dbe2,_0x11c0('0x75'));})[_0x11c0('0x3a')](function(_0x3e4520){if(_0x3e4520){logger['info']('The\x20Call\x20ID\x20is:',_0x3e4520['id']);logger[_0x11c0('0x2a')](_0x11c0('0x7f'),_0x11c0('0x87'));emit(util['format'](_0x11c0('0x88'),_0xa17524[_0x11c0('0x15')]),'trigger:browser:url',{'uri':_0x11c0('0x89')+_0xfaa120[_0x11c0('0x7c')]+_0x11c0('0x8a')+_0x3e4520['id']});}})[_0x11c0('0x26')](function(_0x173a0b){logger[_0x11c0('0x27')]('[QUEUE]',JSON[_0x11c0('0x37')](_0x173a0b));});};exports[_0x11c0('0x8b')]=function(_0x47acfb,_0x177e45,_0x415ca1,_0x152a5e,_0x4e6ce2,_0x4d6339,_0x176513){var _0x510832,_0x2ae2c4,_0x1e96a6;_0x4d6339[_0x11c0('0x7c')]=intUtil['stripTrailingSlash'](_0x4d6339[_0x11c0('0x7c')]);_0x4d6339[_0x11c0('0x7d')]=intUtil['stripTrailingSlash'](_0x4d6339['serverUrl']);if(_0x176513&&_0x176513[_0x11c0('0x8c')]&&_0x176513[_0x11c0('0x8c')]!==_0x11c0('0x8d')){logger[_0x11c0('0x2a')](_0x11c0('0x8e'),_0x11c0('0x8f'));_0x177e45[_0x11c0('0x80')]=_0x4d6339['serverUrl']+_0x11c0('0x81')+_0x177e45['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x177e45[_0x11c0('0x82')]);}var _0xfe4155=_0x4d6339[_0x11c0('0x7c')]===_0x11c0('0x84')?'eu':_0x11c0('0x85');return getAccessToken(_0x4d6339)[_0x11c0('0x3a')](function(_0x2ca23f){_0x1e96a6=_0x2ca23f;return getUser(_0x1e96a6,_0xfe4155,_0x4d6339,_0x152a5e['email']);})[_0x11c0('0x3a')](function(_0x38956e){_0x510832=_0x38956e;logger[_0x11c0('0x2a')]('The\x20User\x20ID\x20is:',_0x510832['id']);return getEndUser(_0x1e96a6,_0xfe4155,_0x4d6339,_0x177e45[_0x11c0('0x90')],_0x177e45[_0x11c0('0x91')],_0x510832,_0x415ca1);})[_0x11c0('0x3a')](function(_0x2d539e){_0x2ae2c4=_0x2d539e;return getCall(_0x1e96a6,_0xfe4155,_0x4d6339,_0x510832,_0x2ae2c4,_0x415ca1,_0x177e45,_0x11c0('0x92'));})[_0x11c0('0x3a')](function(_0x1b03e2){if(_0x1b03e2){logger['info'](_0x11c0('0x93'),_0x1b03e2['id']);logger[_0x11c0('0x2a')](_0x11c0('0x8e'),_0x11c0('0x87'));emit(util[_0x11c0('0x2c')](_0x11c0('0x88'),_0x152a5e['name']),_0x11c0('0x94'),{'uri':_0x11c0('0x89')+_0x4d6339[_0x11c0('0x7c')]+_0x11c0('0x8a')+_0x1b03e2['id']});}})['catch'](function(_0x22081b){logger['error']('[OUTBOUND]',JSON[_0x11c0('0x37')](_0x22081b));});};exports[_0x11c0('0x95')]=function(_0x5ab7b3,_0x1e9a79,_0x1eaae9,_0x1780e3,_0x201f9a,_0x1bafdb){var _0x230d9d,_0xc45eaf,_0x5718ea;_0x1bafdb[_0x11c0('0x7c')]=intUtil[_0x11c0('0x7b')](_0x1bafdb[_0x11c0('0x7c')]);_0x1bafdb[_0x11c0('0x7d')]=intUtil[_0x11c0('0x7b')](_0x1bafdb[_0x11c0('0x7d')]);if(_0x201f9a&&_0x201f9a[_0x11c0('0x7e')]){logger[_0x11c0('0x2a')]('['+_0x1e9a79['lastevent'][_0x11c0('0x96')]()+']',_0x11c0('0x8f'));_0x1e9a79['recordingURL']=_0x1bafdb[_0x11c0('0x7d')]+'/api/voice/recordings/'+_0x1e9a79[_0x11c0('0x82')]+_0x11c0('0x83')+md5(_0x1e9a79[_0x11c0('0x82')]);}else{_0x1e9a79['recordingURL']='';}var _0x2b4355=_0x1bafdb[_0x11c0('0x7c')]===_0x11c0('0x84')?'eu':'com';return getAccessToken(_0x1bafdb)[_0x11c0('0x3a')](function(_0x3d5466){_0x5718ea=_0x3d5466;return getUser(_0x5718ea,_0x2b4355,_0x1bafdb);})[_0x11c0('0x3a')](function(_0x7b973c){_0x230d9d=_0x7b973c;logger['info']('The\x20User\x20ID\x20is:',_0x230d9d['id']);return getEndUser(_0x5718ea,_0x2b4355,_0x1bafdb,_0x1e9a79[_0x11c0('0x97')],_0x1e9a79[_0x11c0('0x86')],_0x230d9d,_0x1eaae9);})[_0x11c0('0x3a')](function(_0x173f82){_0xc45eaf=_0x173f82;return getCall(_0x5718ea,_0x2b4355,_0x1bafdb,_0x230d9d,_0xc45eaf,_0x1eaae9,_0x1e9a79,'Inbound');})[_0x11c0('0x3a')](function(_0x561eb4){if(_0x561eb4){logger[_0x11c0('0x2a')]('The\x20Call\x20ID\x20is:',_0x561eb4['id']);}})[_0x11c0('0x26')](function(_0x5cbebe){logger[_0x11c0('0x27')]('['+_0x1e9a79['lastevent'][_0x11c0('0x96')]()+']',JSON['stringify'](_0x5cbebe));});}; \ 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 7ceb3e7..0319e1c 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(_0x3aef5a,_0x3424d5){var _0x2c7331=function(_0x10d7a3){while(--_0x10d7a3){_0x3aef5a['push'](_0x3aef5a['shift']());}};_0x2c7331(++_0x3424d5);}(_0x7a54,0x106));var _0x47a5=function(_0x51f626,_0x41e4e3){_0x51f626=_0x51f626-0x0;var _0x11424d=_0x7a54[_0x51f626];return _0x11424d;};'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(_0x239ab2,_0x4b3bc6){var _0x17d044=function(_0xaba718){while(--_0xaba718){_0x239ab2['push'](_0x239ab2['shift']());}};_0x17d044(++_0x4b3bc6);}(_0x7a54,0x106));var _0x47a5=function(_0x28bfed,_0x195f04){_0x28bfed=_0x28bfed-0x0;var _0xea9f84=_0x7a54[_0x28bfed];return _0xea9f84;};'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 e021ffc..70838d3 100644 --- a/server/services/ami/trigger/urlforward/index.js +++ b/server/services/ami/trigger/urlforward/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['data6','parse','stack','data1','GET','DELETE','POST','PUT','render','data7','body','error','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then',',\x20request\x20body:\x20','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','name','request-promise','util','lodash','../../../../config/logger','trigger','toUpperCase','data2','data5'];(function(_0x2b4eaa,_0x332e1d){var _0x4e4c07=function(_0x1aef54){while(--_0x1aef54){_0x2b4eaa['push'](_0x2b4eaa['shift']());}};_0x4e4c07(++_0x332e1d);}(_0x7a54,0x106));var _0x47a5=function(_0x482645,_0x4afa76){_0x482645=_0x482645-0x0;var _0x31a5ce=_0x7a54[_0x482645];return _0x31a5ce;};'use strict';var rp=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));var Mustache=require('mustache');var logger=require(_0x47a5('0x3'))(_0x47a5('0x4'));exports['exec']=function(_0x5f7f12,_0x11bf85){var _0x2a1a7e,_0x3717e1;var _0xfdf934={'method':_0x5f7f12['data1'][_0x47a5('0x5')](),'uri':Mustache['render'](_0x5f7f12[_0x47a5('0x6')],_0x11bf85),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5f7f12[_0x47a5('0x7')])==='number'&&parseInt(_0x5f7f12[_0x47a5('0x7')])>=0x1&&parseInt(_0x5f7f12['data5'])<=0xa?parseInt(_0x5f7f12['data5'])*0x3e8:0x5*0x3e8};try{_0xfdf934['headers']=_0x5f7f12[_0x47a5('0x8')]?JSON[_0x47a5('0x9')](Mustache['render'](_0x5f7f12[_0x47a5('0x8')],_0x11bf85)):{};}catch(_0x49e844){logger['error'](_0x49e844[_0x47a5('0xa')]);}switch(_0x5f7f12[_0x47a5('0xb')][_0x47a5('0x5')]()){case _0x47a5('0xc'):case _0x47a5('0xd'):_0x2a1a7e=null;_0xfdf934['qs']=_0x11bf85;break;case _0x47a5('0xe'):case _0x47a5('0xf'):if(_0x5f7f12['data7']){try{_0x2a1a7e=JSON[_0x47a5('0x9')](Mustache[_0x47a5('0x10')](_0x5f7f12[_0x47a5('0x11')],_0x11bf85));_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}catch(_0x139f25){logger[_0x47a5('0x13')](_0x139f25[_0x47a5('0xa')]);logger[_0x47a5('0x13')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x2a1a7e=_0x11bf85;_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}break;}logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x16'),_0x5f7f12[_0x47a5('0xb')],_0x5f7f12['data2'],JSON['stringify'](_0xfdf934)));rp(_0xfdf934)[_0x47a5('0x17')](function(_0x4b966e){_0x2a1a7e=!_['isNil'](_0x2a1a7e)?_0x47a5('0x18')+_0x2a1a7e:'';_0x3717e1=typeof _0x4b966e[_0x47a5('0x12')]===_0x47a5('0x19')?JSON[_0x47a5('0x1a')](_0x4b966e[_0x47a5('0x12')]):_0x4b966e[_0x47a5('0x12')];logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x1b'),_0x5f7f12['data1'],_0x5f7f12[_0x47a5('0x6')],_0x4b966e[_0x47a5('0x1c')],_0x3717e1));})['catch'](function(_0x2b0360){logger[_0x47a5('0x13')](util[_0x47a5('0x15')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x5f7f12[_0x47a5('0xb')],_0x5f7f12[_0x47a5('0x6')],_0x2b0360[_0x47a5('0x1c')],_0x2b0360[_0x47a5('0x1d')],_0x2b0360['message']));});}; \ No newline at end of file +var _0x5f2f=['lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util'];(function(_0x54ea4a,_0x37e723){var _0x3a070f=function(_0x27d4bb){while(--_0x27d4bb){_0x54ea4a['push'](_0x54ea4a['shift']());}};_0x3a070f(++_0x37e723);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1c87ee,_0x3b5519){_0x1c87ee=_0x1c87ee-0x0;var _0x4153e8=_0x5f2f[_0x1c87ee];return _0x4153e8;};'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 6f57a9d..48149c4 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 _0xadec=['exports','jayson/promise','bluebird','../../config/logger','routing','client','rpc','error','message','result','catch'];(function(_0x1044e5,_0x498e01){var _0x5ad0dd=function(_0x458548){while(--_0x458548){_0x1044e5['push'](_0x1044e5['shift']());}};_0x5ad0dd(++_0x498e01);}(_0xadec,0x156));var _0xcade=function(_0x38185a,_0x2f3522){_0x38185a=_0x38185a-0x0;var _0x3e531b=_0xadec[_0x38185a];return _0x3e531b;};'use strict';var jayson=require(_0xcade('0x0'));var BPromise=require(_0xcade('0x1'));var logger=require(_0xcade('0x2'))(_0xcade('0x3'));var client=jayson[_0xcade('0x4')]['http']({'port':0x2329});client['Request']=function(_0x570d9c,_0x475533){return new BPromise(function(_0x875b81,_0xc0b40e){return client['request'](_0x570d9c,_0x475533)['then'](function(_0x5c8b77){logger['debug'](_0xcade('0x5'),'routing',_0x570d9c,_0x475533,_0x5c8b77);if(_0x5c8b77[_0xcade('0x6')]){logger['error']('rpc',_0xcade('0x3'),_0x570d9c,_0x5c8b77[_0xcade('0x6')][_0xcade('0x7')],_0x475533);return _0xc0b40e(_0x5c8b77['error'][_0xcade('0x7')]);}else{return _0x875b81(_0x5c8b77[_0xcade('0x8')]);}})[_0xcade('0x9')](function(_0x148930){logger[_0xcade('0x6')](_0xcade('0x5'),_0xcade('0x3'),_0x570d9c,_0x148930,_0x475533);return _0xc0b40e(_0x148930);});});};module[_0xcade('0xa')]=client; \ No newline at end of file +var _0xa98d=['debug','rpc','routing','error','message','catch','exports','jayson/promise','../../config/logger','client','http','request','then'];(function(_0xc3db69,_0x5f366f){var _0x1430f3=function(_0x36cc9){while(--_0x36cc9){_0xc3db69['push'](_0xc3db69['shift']());}};_0x1430f3(++_0x5f366f);}(_0xa98d,0xa3));var _0xda98=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa98d[_0x20a584];return _0x4b41a8;};'use strict';var jayson=require(_0xda98('0x0'));var BPromise=require('bluebird');var logger=require(_0xda98('0x1'))('routing');var client=jayson[_0xda98('0x2')][_0xda98('0x3')]({'port':0x2329});client['Request']=function(_0x5e5a09,_0xf9ae27){return new BPromise(function(_0x3a4432,_0x5ddf11){return client[_0xda98('0x4')](_0x5e5a09,_0xf9ae27)[_0xda98('0x5')](function(_0x218e43){logger[_0xda98('0x6')](_0xda98('0x7'),_0xda98('0x8'),_0x5e5a09,_0xf9ae27,_0x218e43);if(_0x218e43['error']){logger[_0xda98('0x9')]('rpc',_0xda98('0x8'),_0x5e5a09,_0x218e43[_0xda98('0x9')]['message'],_0xf9ae27);return _0x5ddf11(_0x218e43[_0xda98('0x9')][_0xda98('0xa')]);}else{return _0x3a4432(_0x218e43['result']);}})[_0xda98('0xb')](function(_0x5bf8f1){logger[_0xda98('0x9')]('rpc',_0xda98('0x8'),_0x5e5a09,_0x5bf8f1,_0xf9ae27);return _0x5ddf11(_0x5bf8f1);});});};module[_0xda98('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 99758e0..fb4eea9 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 _0x4be6=['listen','Setting','loginMailFrequency','catch','log','./server','./realtime','./lib/email','./rpc/mailAccount','../../mysqldb','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts'];(function(_0x1ff770,_0x2b5842){var _0x2e41da=function(_0x28059c){while(--_0x28059c){_0x1ff770['push'](_0x1ff770['shift']());}};_0x2e41da(++_0x2b5842);}(_0x4be6,0xb5));var _0x64be=function(_0x31a180,_0x3924b9){_0x31a180=_0x31a180-0x0;var _0x4b0502=_0x4be6[_0x31a180];return _0x4b0502;};'use strict';var BPromise=require('bluebird');var server=require(_0x64be('0x0'));var Realtime=require(_0x64be('0x1'));var EmailChannel=require(_0x64be('0x2'));var mailAccount=require(_0x64be('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x64be('0x4'))['db'];function initRealtime(){return BPromise[_0x64be('0x5')]()[_0x64be('0x6')](mailAccount[_0x64be('0x7')]())[_0x64be('0x6')](realtime[_0x64be('0x8')]())['then'](function(){email[_0x64be('0x9')](realtime[_0x64be('0xa')]);return realtime;});}function main(){return server[_0x64be('0xb')](realtime,email)['then'](function(_0x19bdb3){return initRealtime();})[_0x64be('0x6')](function(_0x50d57f){return db[_0x64be('0xc')]['findOne']({'attributes':['id',_0x64be('0xd')],'raw':!![]});})[_0x64be('0x6')](function(_0x490a80){return setInterval(initRealtime,_0x490a80[_0x64be('0xd')]*0x3e8);})[_0x64be('0xe')](function(_0xb45222){console[_0x64be('0xf')](_0xb45222);});}main(); \ No newline at end of file +var _0xb138=['log','bluebird','./server','./realtime','./lib/email','./rpc/mailAccount','../../mysqldb','resolve','getMailAccounts','then','initMailAccounts','refresh','mailAccounts','Setting','findOne','loginMailFrequency','catch'];(function(_0x529f1c,_0x437ed1){var _0x4d57ab=function(_0x39d479){while(--_0x39d479){_0x529f1c['push'](_0x529f1c['shift']());}};_0x4d57ab(++_0x437ed1);}(_0xb138,0x1dd));var _0x8b13=function(_0xbd60c1,_0x5c8e96){_0xbd60c1=_0xbd60c1-0x0;var _0x595ea3=_0xb138[_0xbd60c1];return _0x595ea3;};'use strict';var BPromise=require(_0x8b13('0x0'));var server=require(_0x8b13('0x1'));var Realtime=require(_0x8b13('0x2'));var EmailChannel=require(_0x8b13('0x3'));var mailAccount=require(_0x8b13('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x8b13('0x5'))['db'];function initRealtime(){return BPromise[_0x8b13('0x6')]()['then'](mailAccount[_0x8b13('0x7')]())[_0x8b13('0x8')](realtime[_0x8b13('0x9')]())['then'](function(){email[_0x8b13('0xa')](realtime[_0x8b13('0xb')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0x8b13('0x8')](function(_0x33d1a7){return initRealtime();})[_0x8b13('0x8')](function(_0x498832){return db[_0x8b13('0xc')][_0x8b13('0xd')]({'attributes':['id','loginMailFrequency'],'raw':!![]});})['then'](function(_0x1f2528){return setInterval(initRealtime,_0x1f2528[_0x8b13('0xe')]*0x3e8);})[_0x8b13('0xf')](function(_0x439451){console[_0x8b13('0x10')](_0x439451);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 124d392..3cf5650 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 _0xe1bf=['status','messageStatus','total','isNil','stringify','emit','mailAccount:update','hasOwnProperty','active','box','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','disabled','handleImapBox','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','Smtp','verify','verified','exports','lodash','moment','bluebird','md5','../../../config/environment','email','defaults','redis','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','name','key','Imap'];(function(_0x20befa,_0x1a35ca){var _0x3b136e=function(_0x453d08){while(--_0x453d08){_0x20befa['push'](_0x20befa['shift']());}};_0x3b136e(++_0x1a35ca);}(_0xe1bf,0xf0));var _0xfe1b=function(_0x264b21,_0x34526d){_0x264b21=_0x264b21-0x0;var _0x3560f4=_0xe1bf[_0x264b21];return _0x3560f4;};'use strict';var _=require(_0xfe1b('0x0'));var moment=require(_0xfe1b('0x1'));var BPromise=require(_0xfe1b('0x2'));var md5=require(_0xfe1b('0x3'));var Redis=require('ioredis');var config=require(_0xfe1b('0x4'));var logger=require('../../../config/logger')(_0xfe1b('0x5'));config['redis']=_[_0xfe1b('0x6')](config[_0xfe1b('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfe1b('0x7')]));var EmailImap=require(_0xfe1b('0x8'));var EmailSmtp=require(_0xfe1b('0x9'));var mailAccount=require(_0xfe1b('0xa'));var md5Accounts={};function EmailChannel(_0x2a7d7b){logger[_0xfe1b('0xb')](_0xfe1b('0xc'));this[_0xfe1b('0xd')]=_0x2a7d7b[_0xfe1b('0xd')];this[_0xfe1b('0xe')]={};this[_0xfe1b('0xf')]=new EmailSmtp();}EmailChannel[_0xfe1b('0x10')]['emit']=function(_0x12d619){var _0x23093d=this['mailAccounts'][_0x12d619];var _0x33d5de={'id':_0x23093d['id'],'name':_0x23093d[_0xfe1b('0x11')],'key':_0x23093d[_0xfe1b('0x12')],'active':_0x23093d['active'],'Imap':{'status':_0x23093d[_0xfe1b('0x13')][_0xfe1b('0x14')],'messageStatus':_0x23093d[_0xfe1b('0x13')][_0xfe1b('0x15')],'total':_0x23093d['Imap'][_0xfe1b('0x16')]}};if(_[_0xfe1b('0x17')](md5Accounts[_0x12d619])){md5Accounts[_0x12d619]={};}var _0x326521=md5(JSON[_0xfe1b('0x18')](_0x33d5de));if(md5Accounts[_0x12d619]['md5']!==_0x326521){md5Accounts[_0x12d619][_0xfe1b('0x3')]=_0x326521;io[_0xfe1b('0x19')](_0xfe1b('0x1a'),_0x33d5de);}};EmailChannel['prototype']['refresh']=function(_0x459b5a){for(var _0x3031a8 in _0x459b5a){if(_0x459b5a[_0xfe1b('0x1b')](_0x3031a8)){if(_0x459b5a[_0x3031a8][_0xfe1b('0x13')]&&_0x459b5a[_0x3031a8][_0xfe1b('0x1c')]){var _0xd3a607=_0x459b5a[_0x3031a8][_0xfe1b('0x13')];if(!this[_0xfe1b('0xe')]['hasOwnProperty'](_0xd3a607['id'])){this[_0xfe1b('0xe')][_0xd3a607['id']]=new EmailImap(_0xd3a607,_0x459b5a[_0x3031a8][_0xfe1b('0x5')]);this[_0xfe1b('0xe')][_0xd3a607['id']]['on'](_0xfe1b('0x1d'),this['handleImapBox'][_0xfe1b('0x1e')](this,_0x3031a8));this[_0xfe1b('0xe')][_0xd3a607['id']]['on'](_0xfe1b('0x5'),this[_0xfe1b('0x1f')][_0xfe1b('0x1e')](this,_0x3031a8));this[_0xfe1b('0xe')][_0xd3a607['id']]['on'](_0xfe1b('0x20'),this[_0xfe1b('0x21')][_0xfe1b('0x1e')](this,_0x3031a8));this[_0xfe1b('0xe')][_0xd3a607['id']]['on'](_0xfe1b('0x22'),this[_0xfe1b('0x23')][_0xfe1b('0x1e')](this,_0x3031a8));}}else{if(_[_0xfe1b('0x17')](this[_0xfe1b('0xd')][_0x3031a8][_0xfe1b('0x13')])){this[_0xfe1b('0xd')][_0x3031a8][_0xfe1b('0x13')]={};}this['mailAccounts'][_0x3031a8][_0xfe1b('0x13')][_0xfe1b('0x14')]=_0xfe1b('0x24');this[_0xfe1b('0xd')][_0x3031a8][_0xfe1b('0x13')][_0xfe1b('0x15')]='';this['emit'](_0x3031a8);}}}};EmailChannel[_0xfe1b('0x10')][_0xfe1b('0x25')]=function(_0x492467,_0x53565f){if(this[_0xfe1b('0xd')][_0x492467]){this[_0xfe1b('0xd')][_0x492467]['Imap'][_0xfe1b('0x14')]=_0xfe1b('0x26');this[_0xfe1b('0xd')][_0x492467][_0xfe1b('0x13')]['messageStatus']=_0x53565f[_0xfe1b('0x11')];if(_0x53565f['messages']){this[_0xfe1b('0xd')][_0x492467][_0xfe1b('0x13')][_0xfe1b('0x16')]=_0x53565f[_0xfe1b('0x27')][_0xfe1b('0x16')];}return this[_0xfe1b('0x19')](_0x492467);}};EmailChannel[_0xfe1b('0x10')][_0xfe1b('0x1f')]=function(_0x41ec9b,_0x75d5e5){logger['info'](_0xfe1b('0x28'),_0x75d5e5['firstName'],_0x75d5e5['lastName'],_0x75d5e5[_0xfe1b('0x29')],_0x41ec9b);if(this[_0xfe1b('0xd')][_0x41ec9b]){return mailAccount[_0xfe1b('0x2a')](_0x41ec9b,_0x75d5e5)[_0xfe1b('0x2b')](function(_0xdf012a){if(_0xdf012a){logger[_0xfe1b('0xb')](_0xfe1b('0x2c'));}})[_0xfe1b('0x2d')](function(_0x28130d){logger[_0xfe1b('0x22')](_0xfe1b('0x2e'),JSON[_0xfe1b('0x18')](_0x28130d));});}};EmailChannel['prototype'][_0xfe1b('0x21')]=function(_0x50ce81){if(this[_0xfe1b('0xd')][_0x50ce81]&&this[_0xfe1b('0xd')][_0x50ce81][_0xfe1b('0x13')]){if(this['imapAccounts'][this[_0xfe1b('0xd')][_0x50ce81][_0xfe1b('0x13')]['id']]){delete this[_0xfe1b('0xe')][this['mailAccounts'][_0x50ce81][_0xfe1b('0x13')]['id']];}this[_0xfe1b('0xd')][_0x50ce81][_0xfe1b('0x13')][_0xfe1b('0x2f')]=moment();this['emit'](_0x50ce81);}};EmailChannel[_0xfe1b('0x10')][_0xfe1b('0x23')]=function(_0x1dd2fc,_0x302aac){if(this['mailAccounts'][_0x1dd2fc]){this[_0xfe1b('0xd')][_0x1dd2fc][_0xfe1b('0x13')]['status']=_0xfe1b('0x22');this[_0xfe1b('0xd')][_0x1dd2fc][_0xfe1b('0x13')][_0xfe1b('0x15')]=_0x302aac;return this['emit'](_0x1dd2fc);}};EmailChannel[_0xfe1b('0x10')]['sendMail']=function(_0x3dbca6,_0x43e7ca){return this[_0xfe1b('0xf')]['send'](_0x3dbca6,_0x43e7ca);};EmailChannel['prototype']['verifySmtp']=function(_0x3e8cb3){var _0x13a644=this;if(this['mailAccounts'][_0x3e8cb3['id']]){if(_[_0xfe1b('0x17')](this[_0xfe1b('0xd')][_0x3e8cb3['id']][_0xfe1b('0x30')])){this[_0xfe1b('0xd')][_0x3e8cb3['id']]['Smtp']={};}this[_0xfe1b('0xd')][_0x3e8cb3['id']][_0xfe1b('0x30')][_0xfe1b('0x2f')]=moment();return new BPromise(function(_0x4f650b,_0x242a1f){return _0x13a644[_0xfe1b('0xf')][_0xfe1b('0x31')](_0x3e8cb3)['then'](function(_0x1bb2a2){_0x13a644['mailAccounts'][_0x3e8cb3['id']][_0xfe1b('0x30')]['status']=_0xfe1b('0x32');_0x13a644[_0xfe1b('0xd')][_0x3e8cb3['id']][_0xfe1b('0x30')][_0xfe1b('0x15')]='';_0x13a644[_0xfe1b('0x19')](_0x3e8cb3['id']);_0x4f650b(_0x1bb2a2);})[_0xfe1b('0x2d')](function(_0x1614c1){_0x13a644[_0xfe1b('0xd')][_0x3e8cb3['id']][_0xfe1b('0x30')][_0xfe1b('0x14')]=_0xfe1b('0x22');_0x13a644[_0xfe1b('0xd')][_0x3e8cb3['id']]['Smtp'][_0xfe1b('0x15')]=_0x1614c1;_0x13a644['emit'](_0x3e8cb3['id']);_0x242a1f(_0x1614c1);});});}return this[_0xfe1b('0xf')][_0xfe1b('0x31')](_0x3e8cb3);};module[_0xfe1b('0x33')]=EmailChannel; \ No newline at end of file +var _0x2c0a=['isNil','md5','mailAccount:update','refresh','hasOwnProperty','box','bind','handleImapEmail','end','error','handleImapError','connected','messageStatus','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','then','catch','stringify','sendMail','Smtp','lastSync','verify','verified','lodash','bluebird','ioredis','../../../config/environment','../../../config/logger','email','defaults','redis','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','status','total'];(function(_0x38f788,_0x670486){var _0x3090da=function(_0x88c24d){while(--_0x88c24d){_0x38f788['push'](_0x38f788['shift']());}};_0x3090da(++_0x670486);}(_0x2c0a,0x82));var _0xa2c0=function(_0x26bf51,_0x5e261a){_0x26bf51=_0x26bf51-0x0;var _0x503415=_0x2c0a[_0x26bf51];return _0x503415;};'use strict';var _=require(_0xa2c0('0x0'));var moment=require('moment');var BPromise=require(_0xa2c0('0x1'));var md5=require('md5');var Redis=require(_0xa2c0('0x2'));var config=require(_0xa2c0('0x3'));var logger=require(_0xa2c0('0x4'))(_0xa2c0('0x5'));config['redis']=_[_0xa2c0('0x6')](config[_0xa2c0('0x7')],{'host':_0xa2c0('0x8'),'port':0x18eb});var io=require(_0xa2c0('0x9'))(new Redis(config[_0xa2c0('0x7')]));var EmailImap=require(_0xa2c0('0xa'));var EmailSmtp=require(_0xa2c0('0xb'));var mailAccount=require(_0xa2c0('0xc'));var md5Accounts={};function EmailChannel(_0x62f124){logger[_0xa2c0('0xd')](_0xa2c0('0xe'));this[_0xa2c0('0xf')]=_0x62f124[_0xa2c0('0xf')];this[_0xa2c0('0x10')]={};this[_0xa2c0('0x11')]=new EmailSmtp();}EmailChannel[_0xa2c0('0x12')][_0xa2c0('0x13')]=function(_0x8900c5){var _0x13369a=this[_0xa2c0('0xf')][_0x8900c5];var _0x50cb8c={'id':_0x13369a['id'],'name':_0x13369a[_0xa2c0('0x14')],'key':_0x13369a[_0xa2c0('0x15')],'active':_0x13369a[_0xa2c0('0x16')],'Imap':{'status':_0x13369a[_0xa2c0('0x17')][_0xa2c0('0x18')],'messageStatus':_0x13369a[_0xa2c0('0x17')]['messageStatus'],'total':_0x13369a[_0xa2c0('0x17')][_0xa2c0('0x19')]}};if(_[_0xa2c0('0x1a')](md5Accounts[_0x8900c5])){md5Accounts[_0x8900c5]={};}var _0x2cc679=md5(JSON['stringify'](_0x50cb8c));if(md5Accounts[_0x8900c5]['md5']!==_0x2cc679){md5Accounts[_0x8900c5][_0xa2c0('0x1b')]=_0x2cc679;io['emit'](_0xa2c0('0x1c'),_0x50cb8c);}};EmailChannel[_0xa2c0('0x12')][_0xa2c0('0x1d')]=function(_0x123cbf){for(var _0x528fac in _0x123cbf){if(_0x123cbf[_0xa2c0('0x1e')](_0x528fac)){if(_0x123cbf[_0x528fac][_0xa2c0('0x17')]&&_0x123cbf[_0x528fac][_0xa2c0('0x16')]){var _0xa7cef1=_0x123cbf[_0x528fac]['Imap'];if(!this['imapAccounts'][_0xa2c0('0x1e')](_0xa7cef1['id'])){this[_0xa2c0('0x10')][_0xa7cef1['id']]=new EmailImap(_0xa7cef1,_0x123cbf[_0x528fac][_0xa2c0('0x5')]);this[_0xa2c0('0x10')][_0xa7cef1['id']]['on'](_0xa2c0('0x1f'),this['handleImapBox'][_0xa2c0('0x20')](this,_0x528fac));this[_0xa2c0('0x10')][_0xa7cef1['id']]['on'](_0xa2c0('0x5'),this[_0xa2c0('0x21')][_0xa2c0('0x20')](this,_0x528fac));this['imapAccounts'][_0xa7cef1['id']]['on'](_0xa2c0('0x22'),this['handleImapEnd'][_0xa2c0('0x20')](this,_0x528fac));this['imapAccounts'][_0xa7cef1['id']]['on'](_0xa2c0('0x23'),this[_0xa2c0('0x24')][_0xa2c0('0x20')](this,_0x528fac));}}else{if(_['isNil'](this[_0xa2c0('0xf')][_0x528fac][_0xa2c0('0x17')])){this['mailAccounts'][_0x528fac][_0xa2c0('0x17')]={};}this['mailAccounts'][_0x528fac]['Imap'][_0xa2c0('0x18')]='disabled';this['mailAccounts'][_0x528fac][_0xa2c0('0x17')]['messageStatus']='';this[_0xa2c0('0x13')](_0x528fac);}}}};EmailChannel['prototype']['handleImapBox']=function(_0x22197e,_0x47627b){if(this[_0xa2c0('0xf')][_0x22197e]){this[_0xa2c0('0xf')][_0x22197e][_0xa2c0('0x17')][_0xa2c0('0x18')]=_0xa2c0('0x25');this[_0xa2c0('0xf')][_0x22197e]['Imap'][_0xa2c0('0x26')]=_0x47627b[_0xa2c0('0x14')];if(_0x47627b[_0xa2c0('0x27')]){this[_0xa2c0('0xf')][_0x22197e][_0xa2c0('0x17')]['total']=_0x47627b[_0xa2c0('0x27')]['total'];}return this[_0xa2c0('0x13')](_0x22197e);}};EmailChannel[_0xa2c0('0x12')][_0xa2c0('0x21')]=function(_0x566092,_0x149c4c){logger[_0xa2c0('0xd')](_0xa2c0('0x28'),_0x149c4c[_0xa2c0('0x29')],_0x149c4c[_0xa2c0('0x2a')],_0x149c4c[_0xa2c0('0x2b')],_0x566092);if(this[_0xa2c0('0xf')][_0x566092]){return mailAccount['notify'](_0x566092,_0x149c4c)[_0xa2c0('0x2c')](function(_0x119b64){if(_0x119b64){logger[_0xa2c0('0xd')]('Mail\x20accepted\x20from\x20routing');}})[_0xa2c0('0x2d')](function(_0x2db129){logger['error']('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0xa2c0('0x2e')](_0x2db129));});}};EmailChannel[_0xa2c0('0x12')]['handleImapEnd']=function(_0x55d60a){if(this['mailAccounts'][_0x55d60a]&&this[_0xa2c0('0xf')][_0x55d60a][_0xa2c0('0x17')]){if(this[_0xa2c0('0x10')][this[_0xa2c0('0xf')][_0x55d60a][_0xa2c0('0x17')]['id']]){delete this[_0xa2c0('0x10')][this[_0xa2c0('0xf')][_0x55d60a][_0xa2c0('0x17')]['id']];}this[_0xa2c0('0xf')][_0x55d60a]['Imap']['lastSync']=moment();this[_0xa2c0('0x13')](_0x55d60a);}};EmailChannel[_0xa2c0('0x12')][_0xa2c0('0x24')]=function(_0x43838c,_0x49249c){if(this[_0xa2c0('0xf')][_0x43838c]){this[_0xa2c0('0xf')][_0x43838c][_0xa2c0('0x17')][_0xa2c0('0x18')]=_0xa2c0('0x23');this[_0xa2c0('0xf')][_0x43838c]['Imap'][_0xa2c0('0x26')]=_0x49249c;return this[_0xa2c0('0x13')](_0x43838c);}};EmailChannel[_0xa2c0('0x12')][_0xa2c0('0x2f')]=function(_0xeb746b,_0x2aef55){return this['smtp']['send'](_0xeb746b,_0x2aef55);};EmailChannel['prototype']['verifySmtp']=function(_0x5b9f74){var _0x1d2b5f=this;if(this['mailAccounts'][_0x5b9f74['id']]){if(_[_0xa2c0('0x1a')](this['mailAccounts'][_0x5b9f74['id']][_0xa2c0('0x30')])){this[_0xa2c0('0xf')][_0x5b9f74['id']]['Smtp']={};}this[_0xa2c0('0xf')][_0x5b9f74['id']][_0xa2c0('0x30')][_0xa2c0('0x31')]=moment();return new BPromise(function(_0x493376,_0x13a45a){return _0x1d2b5f[_0xa2c0('0x11')][_0xa2c0('0x32')](_0x5b9f74)[_0xa2c0('0x2c')](function(_0x5e983f){_0x1d2b5f[_0xa2c0('0xf')][_0x5b9f74['id']][_0xa2c0('0x30')][_0xa2c0('0x18')]=_0xa2c0('0x33');_0x1d2b5f[_0xa2c0('0xf')][_0x5b9f74['id']][_0xa2c0('0x30')]['messageStatus']='';_0x1d2b5f[_0xa2c0('0x13')](_0x5b9f74['id']);_0x493376(_0x5e983f);})[_0xa2c0('0x2d')](function(_0x12d866){_0x1d2b5f['mailAccounts'][_0x5b9f74['id']][_0xa2c0('0x30')][_0xa2c0('0x18')]=_0xa2c0('0x23');_0x1d2b5f['mailAccounts'][_0x5b9f74['id']][_0xa2c0('0x30')][_0xa2c0('0x26')]=_0x12d866;_0x1d2b5f[_0xa2c0('0x13')](_0x5b9f74['id']);_0x13a45a(_0x12d866);});});}return this[_0xa2c0('0x11')]['verify'](_0x5b9f74);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 53fc5e8..6139006 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 _0x3489=['attributes','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','email','stringify','textCode','upperFirst','util','lodash','randomstring','mailparser','simpleParser','iconv','Iconv','EventEmitter','./utils','../../../config/logger','mailbox','account','getAccount','imap','once','handleReady','end','handleEnd','bind','handleError','connect','prototype','connTimeout','isNil','authentication','user','password','host','port','tls','autotls','getHost','handleOpenBox','emit','box','readUnseen','search','UNSEEN','handleReadUnseen','handleFetchMessage','error','handleFetchError','handleFetchEnd','closeBox','handleCloseBox'];(function(_0x1e9a57,_0x102485){var _0x348e39=function(_0x6a45ca){while(--_0x6a45ca){_0x1e9a57['push'](_0x1e9a57['shift']());}};_0x348e39(++_0x102485);}(_0x3489,0x1ef));var _0x9348=function(_0x4c668a,_0x47dd1c){_0x4c668a=_0x4c668a-0x0;var _0x61d015=_0x3489[_0x4c668a];return _0x61d015;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x9348('0x0'));var Imap=require('imap');var _=require(_0x9348('0x1'));var rs=require(_0x9348('0x2'));var simpleParser=require(_0x9348('0x3'))[_0x9348('0x4')];var Iconv=require(_0x9348('0x5'))[_0x9348('0x6')];var EventEmitter=require('events')[_0x9348('0x7')];var utils=require(_0x9348('0x8'));var logger=require(_0x9348('0x9'))('email');function EmailImap(_0x41ba59,_0x30f7ae){this[_0x9348('0xa')]='INBOX';this[_0x9348('0xb')]=this[_0x9348('0xc')](_0x41ba59,_0x30f7ae);this[_0x9348('0xd')]=new Imap(this[_0x9348('0xb')]);this['imap'][_0x9348('0xe')]('ready',this[_0x9348('0xf')]['bind'](this));this[_0x9348('0xd')]['once'](_0x9348('0x10'),this[_0x9348('0x11')][_0x9348('0x12')](this));this[_0x9348('0xd')]['on']('error',this[_0x9348('0x13')]['bind'](this));this[_0x9348('0xd')][_0x9348('0x14')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x9348('0x15')][_0x9348('0xc')]=function(_0x2ab184,_0x2a0956){var _0x203b70={'connTimeout':_0x2ab184[_0x9348('0x16')]?_0x2ab184['connTimeout']*0x3e8:0x2710,'authTimeout':_0x2ab184['authTimeout']?_0x2ab184['authTimeout']*0x3e8:0x1388};if(_[_0x9348('0x17')](_0x2ab184['service'])){if(_0x2ab184[_0x9348('0x18')]){_0x203b70[_0x9348('0x19')]=_0x2ab184[_0x9348('0x19')];_0x203b70[_0x9348('0x1a')]=_0x2ab184[_0x9348('0x1a')];}_0x203b70[_0x9348('0x1b')]=_0x2ab184[_0x9348('0x1b')];_0x203b70[_0x9348('0x1c')]=_0x2ab184['port']||0x3e1;if(_0x2ab184[_0x9348('0x1d')]){_0x203b70[_0x9348('0x1d')]=!![];}else{_0x203b70[_0x9348('0x1d')]=![];_0x203b70[_0x9348('0x1e')]='required';}}else{_0x203b70[_0x9348('0x19')]=_0x2ab184[_0x9348('0x19')];_0x203b70['password']=_0x2ab184[_0x9348('0x1a')];_0x203b70['host']=utils[_0x9348('0x1f')](_0x2ab184['service']);_0x203b70[_0x9348('0x1c')]=0x3e1;_0x203b70[_0x9348('0x1d')]=!![];}_0x203b70['email']=_0x2a0956||_0x2ab184[_0x9348('0x19')]||'anonymous@xcally.com';return _0x203b70;};EmailImap[_0x9348('0x15')][_0x9348('0xf')]=function(){this[_0x9348('0xd')]['openBox'](this[_0x9348('0xa')],![],this[_0x9348('0x20')][_0x9348('0x12')](this));};EmailImap[_0x9348('0x15')][_0x9348('0x20')]=function(_0x59142b,_0x26d59b){if(_0x59142b){this['handleError'](_0x59142b,!![]);}else{this[_0x9348('0x21')](_0x9348('0x22'),_0x26d59b);this[_0x9348('0x23')]();}};EmailImap[_0x9348('0x15')]['handleCloseBox']=function(_0x4787ca){if(_0x4787ca){this['handleError'](_0x4787ca,!![]);}else{this[_0x9348('0xd')]['end']();}};EmailImap[_0x9348('0x15')][_0x9348('0x23')]=function(){this['imap'][_0x9348('0x24')]([_0x9348('0x25')],this[_0x9348('0x26')][_0x9348('0x12')](this));};EmailImap[_0x9348('0x15')][_0x9348('0x26')]=function(_0x7d6e50,_0x3663de){if(_0x7d6e50){this[_0x9348('0x13')](_0x7d6e50,!![]);}else{if(_0x3663de['length']){try{var _0x224db7=this[_0x9348('0xd')]['fetch'](_0x3663de,{'bodies':'','markSeen':!![]});_0x224db7['on']('message',this[_0x9348('0x27')][_0x9348('0x12')](this));_0x224db7[_0x9348('0xe')](_0x9348('0x28'),this[_0x9348('0x29')]['bind'](this));_0x224db7[_0x9348('0xe')](_0x9348('0x10'),this[_0x9348('0x2a')][_0x9348('0x12')](this));}catch(_0x39d892){logger[_0x9348('0x28')](_0x39d892);}}else{this[_0x9348('0xd')][_0x9348('0x2b')](!![],this[_0x9348('0x2c')][_0x9348('0x12')](this));}}};EmailImap[_0x9348('0x15')][_0x9348('0x27')]=function(_0x4f6a3b,_0x4c67c3){_0x4f6a3b['on']('body',this['handleMessageBody']['bind'](this));_0x4f6a3b['once'](_0x9348('0x2d'),this[_0x9348('0x2e')][_0x9348('0x12')](this));_0x4f6a3b[_0x9348('0xe')](_0x9348('0x10'),this[_0x9348('0x2f')][_0x9348('0x12')](this));};EmailImap['prototype'][_0x9348('0x30')]=function(_0x33e0fd,_0x44c539){simpleParser(_0x33e0fd,{'Iconv':Iconv},this[_0x9348('0x31')]['bind'](this));};EmailImap['prototype']['handleMessageAttributes']=function(_0x3f5dca){};EmailImap[_0x9348('0x15')][_0x9348('0x2f')]=function(){};EmailImap[_0x9348('0x15')]['handleSimpleParser']=function(_0x3e56f6,_0x4f7731){if(_0x3e56f6){logger[_0x9348('0x28')](_0x3e56f6);}else{var _0x2b51ff=this;utils['parser'](this['account'],_0x4f7731,function(_0x1545d4){_0x2b51ff[_0x9348('0x21')]('email',_0x1545d4);});}};EmailImap[_0x9348('0x15')]['handleFetchEnd']=function(){this[_0x9348('0xd')]['closeBox'](!![],this[_0x9348('0x2c')]['bind'](this));};EmailImap[_0x9348('0x15')][_0x9348('0x29')]=function(_0x34b0eb){this['handleError'](_0x34b0eb);this[_0x9348('0xd')][_0x9348('0x2b')](!![],this[_0x9348('0x2c')][_0x9348('0x12')](this));};EmailImap[_0x9348('0x15')][_0x9348('0x11')]=function(){this['emit']('end');};EmailImap[_0x9348('0x15')]['handleError']=function(_0x513275,_0x4cf8f3){logger['error'](_0x9348('0x13'),this[_0x9348('0xb')][_0x9348('0x32')],JSON[_0x9348('0x33')](_0x513275));var _0x6075b7='';if(_0x513275){if(_0x513275[_0x9348('0x34')]){_0x6075b7=_0x513275[_0x9348('0x34')];}else{for(var _0x12ec32 in _0x513275){if(_0x513275['hasOwnProperty'](_0x12ec32)){_0x6075b7+=_[_0x9348('0x35')](_0x12ec32)+':\x20'+_0x513275[_0x12ec32]+'\x0a';}}}}if(_0x4cf8f3){this[_0x9348('0xd')][_0x9348('0x10')]();}else{this[_0x9348('0x21')]('error',_0x6075b7);this['emit'](_0x9348('0x10'));}};module['exports']=EmailImap; \ No newline at end of file +var _0x595c=['message','closeBox','handleFetchMessage','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleFetchEnd','stringify','textCode','exports','path','imap','lodash','randomstring','mailparser','simpleParser','iconv','Iconv','events','./utils','../../../config/logger','mailbox','getAccount','account','handleReady','bind','once','end','handleEnd','error','handleError','connect','connTimeout','authTimeout','service','authentication','user','password','host','port','tls','autotls','required','getHost','email','anonymous@xcally.com','prototype','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','UNSEEN','handleReadUnseen','length'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x595c,0xbe));var _0xc595=function(_0x304b86,_0x490233){_0x304b86=_0x304b86-0x0;var _0x34d6c9=_0x595c[_0x304b86];return _0x34d6c9;};'use strict';var fs=require('fs');var path=require(_0xc595('0x0'));var util=require('util');var Imap=require(_0xc595('0x1'));var _=require(_0xc595('0x2'));var rs=require(_0xc595('0x3'));var simpleParser=require(_0xc595('0x4'))[_0xc595('0x5')];var Iconv=require(_0xc595('0x6'))[_0xc595('0x7')];var EventEmitter=require(_0xc595('0x8'))['EventEmitter'];var utils=require(_0xc595('0x9'));var logger=require(_0xc595('0xa'))('email');function EmailImap(_0x209837,_0x4d94a7){this[_0xc595('0xb')]='INBOX';this['account']=this[_0xc595('0xc')](_0x209837,_0x4d94a7);this[_0xc595('0x1')]=new Imap(this[_0xc595('0xd')]);this[_0xc595('0x1')]['once']('ready',this[_0xc595('0xe')][_0xc595('0xf')](this));this[_0xc595('0x1')][_0xc595('0x10')](_0xc595('0x11'),this[_0xc595('0x12')][_0xc595('0xf')](this));this[_0xc595('0x1')]['on'](_0xc595('0x13'),this[_0xc595('0x14')]['bind'](this));this['imap'][_0xc595('0x15')]();}util['inherits'](EmailImap,EventEmitter);EmailImap['prototype'][_0xc595('0xc')]=function(_0x409773,_0xfe7105){var _0x39d722={'connTimeout':_0x409773[_0xc595('0x16')]?_0x409773[_0xc595('0x16')]*0x3e8:0x2710,'authTimeout':_0x409773[_0xc595('0x17')]?_0x409773[_0xc595('0x17')]*0x3e8:0x1388};if(_['isNil'](_0x409773[_0xc595('0x18')])){if(_0x409773[_0xc595('0x19')]){_0x39d722[_0xc595('0x1a')]=_0x409773[_0xc595('0x1a')];_0x39d722[_0xc595('0x1b')]=_0x409773[_0xc595('0x1b')];}_0x39d722[_0xc595('0x1c')]=_0x409773['host'];_0x39d722[_0xc595('0x1d')]=_0x409773['port']||0x3e1;if(_0x409773[_0xc595('0x1e')]){_0x39d722['tls']=!![];}else{_0x39d722['tls']=![];_0x39d722[_0xc595('0x1f')]=_0xc595('0x20');}}else{_0x39d722[_0xc595('0x1a')]=_0x409773[_0xc595('0x1a')];_0x39d722[_0xc595('0x1b')]=_0x409773[_0xc595('0x1b')];_0x39d722[_0xc595('0x1c')]=utils[_0xc595('0x21')](_0x409773[_0xc595('0x18')]);_0x39d722[_0xc595('0x1d')]=0x3e1;_0x39d722[_0xc595('0x1e')]=!![];}_0x39d722[_0xc595('0x22')]=_0xfe7105||_0x409773['user']||_0xc595('0x23');return _0x39d722;};EmailImap[_0xc595('0x24')]['handleReady']=function(){this[_0xc595('0x1')][_0xc595('0x25')](this[_0xc595('0xb')],![],this[_0xc595('0x26')][_0xc595('0xf')](this));};EmailImap[_0xc595('0x24')][_0xc595('0x26')]=function(_0xa86c11,_0x5a0c78){if(_0xa86c11){this['handleError'](_0xa86c11,!![]);}else{this[_0xc595('0x27')](_0xc595('0x28'),_0x5a0c78);this[_0xc595('0x29')]();}};EmailImap[_0xc595('0x24')][_0xc595('0x2a')]=function(_0x43eb22){if(_0x43eb22){this['handleError'](_0x43eb22,!![]);}else{this[_0xc595('0x1')][_0xc595('0x11')]();}};EmailImap['prototype'][_0xc595('0x29')]=function(){this[_0xc595('0x1')]['search']([_0xc595('0x2b')],this['handleReadUnseen']['bind'](this));};EmailImap[_0xc595('0x24')][_0xc595('0x2c')]=function(_0x4eb93b,_0x6dd770){if(_0x4eb93b){this[_0xc595('0x14')](_0x4eb93b,!![]);}else{if(_0x6dd770[_0xc595('0x2d')]){try{var _0x5c6f7b=this[_0xc595('0x1')]['fetch'](_0x6dd770,{'bodies':'','markSeen':!![]});_0x5c6f7b['on'](_0xc595('0x2e'),this['handleFetchMessage'][_0xc595('0xf')](this));_0x5c6f7b['once'](_0xc595('0x13'),this['handleFetchError'][_0xc595('0xf')](this));_0x5c6f7b[_0xc595('0x10')](_0xc595('0x11'),this['handleFetchEnd'][_0xc595('0xf')](this));}catch(_0x36eb45){logger[_0xc595('0x13')](_0x36eb45);}}else{this['imap'][_0xc595('0x2f')](!![],this['handleCloseBox']['bind'](this));}}};EmailImap[_0xc595('0x24')][_0xc595('0x30')]=function(_0x5ea2cd,_0x30551c){_0x5ea2cd['on']('body',this[_0xc595('0x31')][_0xc595('0xf')](this));_0x5ea2cd['once'](_0xc595('0x32'),this[_0xc595('0x33')][_0xc595('0xf')](this));_0x5ea2cd[_0xc595('0x10')]('end',this['handleMessageEnd'][_0xc595('0xf')](this));};EmailImap['prototype'][_0xc595('0x31')]=function(_0x100afd,_0x536ae8){simpleParser(_0x100afd,{'Iconv':Iconv},this['handleSimpleParser'][_0xc595('0xf')](this));};EmailImap['prototype'][_0xc595('0x33')]=function(_0x26ca09){};EmailImap[_0xc595('0x24')][_0xc595('0x34')]=function(){};EmailImap[_0xc595('0x24')][_0xc595('0x35')]=function(_0x2ba1d6,_0x3bf664){if(_0x2ba1d6){logger[_0xc595('0x13')](_0x2ba1d6);}else{var _0x59a9eb=this;utils[_0xc595('0x36')](this[_0xc595('0xd')],_0x3bf664,function(_0x255a63){_0x59a9eb[_0xc595('0x27')]('email',_0x255a63);});}};EmailImap[_0xc595('0x24')][_0xc595('0x37')]=function(){this[_0xc595('0x1')]['closeBox'](!![],this[_0xc595('0x2a')][_0xc595('0xf')](this));};EmailImap['prototype']['handleFetchError']=function(_0x2a5a65){this[_0xc595('0x14')](_0x2a5a65);this[_0xc595('0x1')][_0xc595('0x2f')](!![],this[_0xc595('0x2a')][_0xc595('0xf')](this));};EmailImap[_0xc595('0x24')][_0xc595('0x12')]=function(){this[_0xc595('0x27')]('end');};EmailImap['prototype'][_0xc595('0x14')]=function(_0x40fd06,_0xc1d8a3){logger[_0xc595('0x13')](_0xc595('0x14'),this['account'][_0xc595('0x22')],JSON[_0xc595('0x38')](_0x40fd06));var _0xed2dfc='';if(_0x40fd06){if(_0x40fd06[_0xc595('0x39')]){_0xed2dfc=_0x40fd06[_0xc595('0x39')];}else{for(var _0x49f418 in _0x40fd06){if(_0x40fd06['hasOwnProperty'](_0x49f418)){_0xed2dfc+=_['upperFirst'](_0x49f418)+':\x20'+_0x40fd06[_0x49f418]+'\x0a';}}}}if(_0xc1d8a3){this[_0xc595('0x1')][_0xc595('0x11')]();}else{this[_0xc595('0x27')](_0xc595('0x13'),_0xed2dfc);this[_0xc595('0x27')]('end');}};module[_0xc595('0x3a')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 7bee815..96f1650 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 _0x0211=['send','use','sendMail','prototype','verify','toString','Not\x20verifired','exports'];(function(_0x371845,_0x59e055){var _0x3534fc=function(_0x40ed55){while(--_0x40ed55){_0x371845['push'](_0x371845['shift']());}};_0x3534fc(++_0x59e055);}(_0x0211,0x148));var _0x1021=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x0211[_0x4154a6];return _0x3b2786;};'use strict';var nodemailer=require('nodemailer');var BPromise=require('bluebird');var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp['prototype'][_0x1021('0x0')]=function(_0x274dc7,_0x2aaf4e){return new BPromise(function(_0x3caca8,_0x4ceba6){var _0x501127=nodemailer['createTransport'](_0x274dc7);_0x501127[_0x1021('0x1')]('compile',inlineBase64());_0x501127[_0x1021('0x2')](_0x2aaf4e,function(_0x118d7f,_0x538759){if(_0x118d7f){_0x4ceba6(_0x118d7f['toString']());}else{_0x3caca8(_0x538759);}});});};EmailSmtp[_0x1021('0x3')][_0x1021('0x4')]=function(_0x11a3ca){return new BPromise(function(_0x59673b,_0x117038){var _0x26f591=nodemailer['createTransport'](_0x11a3ca);_0x26f591['verify'](function(_0x196345,_0x1c1a12){if(_0x196345){_0x117038(_0x196345[_0x1021('0x5')]());}else{if(_0x1c1a12){_0x59673b(_0x1c1a12);}else{_0x117038(_0x1021('0x6'));}}});});};module[_0x1021('0x7')]=EmailSmtp; \ No newline at end of file +var _0xbeeb=['bluebird','prototype','createTransport','use','sendMail','toString','verify','Not\x20verifired','exports','nodemailer'];(function(_0x11a962,_0x3cc338){var _0x55d423=function(_0xf4b236){while(--_0xf4b236){_0x11a962['push'](_0x11a962['shift']());}};_0x55d423(++_0x3cc338);}(_0xbeeb,0x95));var _0xbbee=function(_0x28330e,_0x369b44){_0x28330e=_0x28330e-0x0;var _0x3b82dc=_0xbeeb[_0x28330e];return _0x3b82dc;};'use strict';var nodemailer=require(_0xbbee('0x0'));var BPromise=require(_0xbbee('0x1'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0xbbee('0x2')]['send']=function(_0x5bb4cd,_0xb204ec){return new BPromise(function(_0x4f6778,_0x48debf){var _0x15a708=nodemailer[_0xbbee('0x3')](_0x5bb4cd);_0x15a708[_0xbbee('0x4')]('compile',inlineBase64());_0x15a708[_0xbbee('0x5')](_0xb204ec,function(_0x1962c1,_0x326d45){if(_0x1962c1){_0x48debf(_0x1962c1[_0xbbee('0x6')]());}else{_0x4f6778(_0x326d45);}});});};EmailSmtp[_0xbbee('0x2')][_0xbbee('0x7')]=function(_0x308f93){return new BPromise(function(_0x1cd665,_0x45883b){var _0x34af02=nodemailer[_0xbbee('0x3')](_0x308f93);_0x34af02['verify'](function(_0x3642ac,_0x539f57){if(_0x3642ac){_0x45883b(_0x3642ac[_0xbbee('0x6')]());}else{if(_0x539f57){_0x1cd665(_0x539f57);}else{_0x45883b(_0xbbee('0x8'));}}});});};module[_0xbbee('0x9')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 6dc6d47..0972041 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 _0xa876=['type','filename','attachment-','root','server/files/attachments/','writeFileSync','content','push','contentType','from','messageId','inReplyTo','date','format','YYYY-MM-DD\x20HH:mm:ss','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','Attachments','Title','Data','

Empty\x20message

','getHost','yahoo','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','lodash','moment','path','util','email','../../../config/environment','head','value','address','anonymous','@xcally.com','name','split','slice','join','Anonymous','length','isEmpty','generate','html','test','replace','body','textAsHtml','0x1?_0x2e89ef['pop']():'';}return'';}function getMails(_0xfa75f3,_0x5bdc75){var _0x59f81e='';for(var _0xf10141=0x0;_0xf10141<_0x5bdc75[_0x6a87('0x7')][_0x6a87('0x10')];_0xf10141+=0x1){if(_0x5bdc75[_0x6a87('0x7')][_0xf10141][_0x6a87('0x8')]!==_0xfa75f3){if(!_[_0x6a87('0x11')](_0x59f81e)){_0x59f81e+=',';}_0x59f81e+=_0x5bdc75['value'][_0xf10141][_0x6a87('0xb')]||_0x5bdc75[_0x6a87('0x7')][_0xf10141][_0x6a87('0x8')]||'';_0x59f81e+='\x20<';_0x59f81e+=_0x5bdc75['value'][_0xf10141][_0x6a87('0x8')]?_0x5bdc75['value'][_0xf10141][_0x6a87('0x8')]:_0x6a87('0x9')+random[_0x6a87('0x12')](0x6)+_0x6a87('0xa');_0x59f81e+='>';}}return _0x59f81e;}function parseEmail(_0x5498b4,_0x36ad70,_0x8e8ce){if(_0x36ad70[_0x6a87('0x13')]){var _0x19927e=/)<[^<]*)*<\/script>/gi;while(_0x19927e[_0x6a87('0x14')](_0x36ad70[_0x6a87('0x13')])){_0x36ad70[_0x6a87('0x13')]=_0x36ad70['html'][_0x6a87('0x15')](_0x19927e,'');}_0x8e8ce['body']=_0x36ad70['html'];}else{_0x8e8ce[_0x6a87('0x16')]=_0x36ad70[_0x6a87('0x17')];}if(_0x8e8ce['body']){_0x8e8ce[_0x6a87('0x16')]=_0x8e8ce['body'][_0x6a87('0x15')](/Empty\x20message

';if(_0x2fd0fa[_0x6a87('0x32')]){for(var _0x124d47=0x0;_0x124d47<_0x2fd0fa[_0x6a87('0x32')][_0x6a87('0x10')];_0x124d47++){var _0x448dfc=_0x2fd0fa[_0x6a87('0x32')][_0x124d47];_0x416242['message']['attachments'][_0x6a87('0x26')]({'filename':_0x448dfc[_0x6a87('0x33')],'content':new Buffer(_0x448dfc[_0x6a87('0x34')])});}}}_0x5ef316(parseEmail(_0x5feee7,_0x296ac9,_0x416242));});}else{_0x296ac9[_0x6a87('0x13')]=_0x6a87('0x35');_0x5ef316(parseEmail(_0x5feee7,_0x296ac9,_0x416242));}}else{_0x5ef316(parseEmail(_0x5feee7,_0x296ac9,_0x416242));}};exports[_0x6a87('0x36')]=function(_0x4f7674){switch(_0x4f7674){case'gmail':return'imap.gmail.com';case _0x6a87('0x37'):return'imap.mail.yahoo.com';case _0x6a87('0x38'):return _0x6a87('0x39');case _0x6a87('0x3a'):return _0x6a87('0x3b');}return'127.0.0.1';}; \ No newline at end of file +var _0x24c2=['BodyHTML','

Empty\x20message

','Attachments','push','Data','getHost','gmail','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','head','value','address','anonymous','generate','@xcally.com','name','split','length','join','html','test','replace','body','textAsHtml','0x1?_0x13659b['pop']():'';}return'';}function getMails(_0x1798a9,_0x2621bb){var _0x5a67d5='';for(var _0x525017=0x0;_0x525017<_0x2621bb[_0x224c('0x9')][_0x224c('0x10')];_0x525017+=0x1){if(_0x2621bb[_0x224c('0x9')][_0x525017][_0x224c('0xa')]!==_0x1798a9){if(!_['isEmpty'](_0x5a67d5)){_0x5a67d5+=',';}_0x5a67d5+=_0x2621bb['value'][_0x525017]['name']||_0x2621bb['value'][_0x525017][_0x224c('0xa')]||'';_0x5a67d5+='\x20<';_0x5a67d5+=_0x2621bb['value'][_0x525017]['address']?_0x2621bb[_0x224c('0x9')][_0x525017][_0x224c('0xa')]:_0x224c('0xb')+random['generate'](0x6)+_0x224c('0xd');_0x5a67d5+='>';}}return _0x5a67d5;}function parseEmail(_0xf8efbf,_0x2e5cae,_0x144096){if(_0x2e5cae[_0x224c('0x12')]){var _0x51168c=/)<[^<]*)*<\/script>/gi;while(_0x51168c[_0x224c('0x13')](_0x2e5cae[_0x224c('0x12')])){_0x2e5cae['html']=_0x2e5cae[_0x224c('0x12')][_0x224c('0x14')](_0x51168c,'');}_0x144096['body']=_0x2e5cae[_0x224c('0x12')];}else{_0x144096[_0x224c('0x15')]=_0x2e5cae[_0x224c('0x16')];}if(_0x144096[_0x224c('0x15')]){_0x144096['body']=_0x144096[_0x224c('0x15')][_0x224c('0x14')](/0x0){if(this[_0x48ece4+_0x11d2('0x29')]>0x0&&this[_0x48ece4+_0x11d2('0x28')]>=this[_0x48ece4+_0x11d2('0x29')]){return'maxcapacity';}else{return _0x11d2('0x2a');}}else{return _0x11d2('0x2b');}};Agent[_0x11d2('0x26')][_0x11d2('0x2c')]=function(){var _0xf8c803=[_0x11d2('0x2d'),_0x11d2('0x2e'),_0x11d2('0x2f'),'fax',_0x11d2('0x30'),_0x11d2('0x31')];for(var _0x51f474=0x0;_0x51f474<_0xf8c803[_0x11d2('0x32')];_0x51f474+=0x1){var _0x51d4b6=this['getChannelStatus'](_0xf8c803[_0x51f474]);if(this[_0xf8c803[_0x51f474]+_0x11d2('0x33')]!==_0x51d4b6){this[_0xf8c803[_0x51f474]+'StatusTime']=_[_0x11d2('0x34')](moment()[_0x11d2('0x35')]('x'));}this[_0xf8c803[_0x51f474]+_0x11d2('0x33')]=_0x51d4b6;}var _0x426523={'id':this['id'],'name':this[_0x11d2('0x7')],'online':this[_0x11d2('0x8')],'voicePause':this[_0x11d2('0x9')],'chatPause':this[_0x11d2('0xa')],'mailPause':this['mailPause'],'smsPause':this[_0x11d2('0xd')],'faxPause':this[_0x11d2('0xc')],'openchannelPause':this[_0x11d2('0xe')],'chatStatus':this[_0x11d2('0xf')],'chatStatusTime':this[_0x11d2('0x36')],'chatCapacity':this[_0x11d2('0x11')],'chatCurrentCapacity':this[_0x11d2('0x12')],'mailStatus':this[_0x11d2('0x13')],'mailStatusTime':this[_0x11d2('0x14')],'mailCapacity':this[_0x11d2('0x15')],'mailCurrentCapacity':this[_0x11d2('0x16')],'faxStatus':this[_0x11d2('0x37')],'faxStatusTime':this[_0x11d2('0x17')],'faxCapacity':this[_0x11d2('0x18')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x11d2('0x1a')],'smsStatusTime':this[_0x11d2('0x1b')],'smsCapacity':this[_0x11d2('0x1c')],'smsCurrentCapacity':this[_0x11d2('0x1d')],'whatsappStatus':this[_0x11d2('0x1e')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x11d2('0x20')],'whatsappCurrentCapacity':this[_0x11d2('0x38')],'openchannelStatus':this[_0x11d2('0x39')],'openchannelStatusTime':this[_0x11d2('0x21')],'openchannelCapacity':this[_0x11d2('0x22')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this[_0x11d2('0x25')]};var _0x435641=md5(JSON[_0x11d2('0x3a')](_0x426523));if(this[_0x11d2('0x2')]!==_0x435641){this[_0x11d2('0x2')]=_0x435641;io['emit']('user:save',_0x426523);}};module[_0x11d2('0x3b')]=Agent; \ No newline at end of file +var _0x9c00=['smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCurrentCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','md5','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','idle','chat','openchannel','sms','whatsapp','length','Status','StatusTime','toNumber','format','name','smsStatus','smsStatusTime','whatsappCapacity','openchannelStatus','stringify','emit','user:save','exports','lodash','moment','../../../config/environment','redis','localhost','socket.io-emitter','online','voicePause','chatPause','mailPause','faxPause'];(function(_0x5da561,_0xc804f9){var _0x14fbde=function(_0x9e73c3){while(--_0x9e73c3){_0x5da561['push'](_0x5da561['shift']());}};_0x14fbde(++_0xc804f9);}(_0x9c00,0x1a0));var _0x09c0=function(_0x1de0b9,_0xc6f046){_0x1de0b9=_0x1de0b9-0x0;var _0x18edae=_0x9c00[_0x1de0b9];return _0x18edae;};'use strict';var _=require(_0x09c0('0x0'));var moment=require(_0x09c0('0x1'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x09c0('0x2'));config[_0x09c0('0x3')]=_['defaults'](config[_0x09c0('0x3')],{'host':_0x09c0('0x4'),'port':0x18eb});var io=require(_0x09c0('0x5'))(new Redis(config[_0x09c0('0x3')]));function Agent(_0x1cbf99){this['id']=_0x1cbf99['id']||0x0;this['name']=_0x1cbf99['name']||'';this[_0x09c0('0x6')]=_0x1cbf99[_0x09c0('0x6')]||!![];this[_0x09c0('0x7')]=_0x1cbf99[_0x09c0('0x7')]||![];this[_0x09c0('0x8')]=_0x1cbf99['chatPause']||![];this[_0x09c0('0x9')]=_0x1cbf99[_0x09c0('0x9')]||![];this[_0x09c0('0xa')]=_0x1cbf99[_0x09c0('0xa')]||![];this[_0x09c0('0xb')]=_0x1cbf99[_0x09c0('0xb')]||![];this[_0x09c0('0xc')]=_0x1cbf99[_0x09c0('0xc')]||![];this[_0x09c0('0xd')]=_0x09c0('0xe');this[_0x09c0('0xf')]=0x0;this[_0x09c0('0x10')]=_0x1cbf99[_0x09c0('0x10')]||0x0;this[_0x09c0('0x11')]=0x0;this[_0x09c0('0x12')]=_0x09c0('0xe');this[_0x09c0('0x13')]=0x0;this[_0x09c0('0x14')]=_0x1cbf99[_0x09c0('0x14')]||0x0;this[_0x09c0('0x15')]=0x0;this[_0x09c0('0x16')]=_0x09c0('0xe');this[_0x09c0('0x17')]=0x0;this[_0x09c0('0x18')]=_0x1cbf99[_0x09c0('0x18')]||0x0;this[_0x09c0('0x19')]=0x0;this['smsStatus']='unknown';this['smsStatusTime']=0x0;this[_0x09c0('0x1a')]=_0x1cbf99[_0x09c0('0x1a')]||0x0;this[_0x09c0('0x1b')]=0x0;this[_0x09c0('0x1c')]='unknown';this[_0x09c0('0x1d')]=0x0;this['whatsappCapacity']=_0x1cbf99['whatsappCapacity']||0x0;this[_0x09c0('0x1e')]=0x0;this['openchannelStatus']=_0x09c0('0xe');this[_0x09c0('0x1f')]=0x0;this[_0x09c0('0x20')]=_0x1cbf99['openchannelCapacity']||0x0;this[_0x09c0('0x21')]=0x0;this[_0x09c0('0x22')]=![];this[_0x09c0('0x23')]=undefined;this[_0x09c0('0x24')]='';this[_0x09c0('0x25')]();}Agent[_0x09c0('0x26')][_0x09c0('0x27')]=function(_0x5d5391){if(this[_0x5d5391+_0x09c0('0x28')]>0x0){if(this[_0x5d5391+_0x09c0('0x29')]>0x0&&this[_0x5d5391+_0x09c0('0x28')]>=this[_0x5d5391+_0x09c0('0x29')]){return'maxcapacity';}else{return'working';}}else{return _0x09c0('0x2a');}};Agent[_0x09c0('0x26')][_0x09c0('0x25')]=function(){var _0x3a5370=['mail',_0x09c0('0x2b'),_0x09c0('0x2c'),'fax',_0x09c0('0x2d'),_0x09c0('0x2e')];for(var _0x2e3d4d=0x0;_0x2e3d4d<_0x3a5370[_0x09c0('0x2f')];_0x2e3d4d+=0x1){var _0x1f8131=this[_0x09c0('0x27')](_0x3a5370[_0x2e3d4d]);if(this[_0x3a5370[_0x2e3d4d]+_0x09c0('0x30')]!==_0x1f8131){this[_0x3a5370[_0x2e3d4d]+_0x09c0('0x31')]=_[_0x09c0('0x32')](moment()[_0x09c0('0x33')]('x'));}this[_0x3a5370[_0x2e3d4d]+_0x09c0('0x30')]=_0x1f8131;}var _0x5e53ac={'id':this['id'],'name':this[_0x09c0('0x34')],'online':this[_0x09c0('0x6')],'voicePause':this['voicePause'],'chatPause':this[_0x09c0('0x8')],'mailPause':this['mailPause'],'smsPause':this[_0x09c0('0xb')],'faxPause':this['faxPause'],'openchannelPause':this[_0x09c0('0xc')],'chatStatus':this[_0x09c0('0xd')],'chatStatusTime':this[_0x09c0('0xf')],'chatCapacity':this[_0x09c0('0x10')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x09c0('0x13')],'mailCapacity':this[_0x09c0('0x14')],'mailCurrentCapacity':this[_0x09c0('0x15')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x09c0('0x17')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x09c0('0x19')],'smsStatus':this[_0x09c0('0x35')],'smsStatusTime':this[_0x09c0('0x36')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x09c0('0x1b')],'whatsappStatus':this[_0x09c0('0x1c')],'whatsappStatusTime':this[_0x09c0('0x1d')],'whatsappCapacity':this[_0x09c0('0x37')],'whatsappCurrentCapacity':this[_0x09c0('0x1e')],'openchannelStatus':this[_0x09c0('0x38')],'openchannelStatusTime':this[_0x09c0('0x1f')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x09c0('0x21')],'busy':this[_0x09c0('0x22')],'busyQueue':this[_0x09c0('0x23')]};var _0x132f6c=md5(JSON[_0x09c0('0x39')](_0x5e53ac));if(this['md5']!==_0x132f6c){this[_0x09c0('0x24')]=_0x132f6c;io[_0x09c0('0x3a')](_0x09c0('0x3b'),_0x5e53ac);}};module[_0x09c0('0x3c')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 55d2a4e..d7f9e84 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 _0x5bfe=['ioredis','defaults','redis','localhost','socket.io-emitter','name','timeout','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','chatPause','available','stringify','format','emit','chat_queue:save','lodash','md5'];(function(_0x1ec506,_0x1e882d){var _0x56381f=function(_0x5bc395){while(--_0x5bc395){_0x1ec506['push'](_0x1ec506['shift']());}};_0x56381f(++_0x1e882d);}(_0x5bfe,0xdf));var _0xe5bf=function(_0x2ff2ff,_0x2563d8){_0x2ff2ff=_0x2ff2ff-0x0;var _0x252433=_0x5bfe[_0x2ff2ff];return _0x252433;};'use strict';var _=require(_0xe5bf('0x0'));var md5=require(_0xe5bf('0x1'));var util=require('util');var Redis=require(_0xe5bf('0x2'));var config=require('../../../config/environment');config['redis']=_[_0xe5bf('0x3')](config[_0xe5bf('0x4')],{'host':_0xe5bf('0x5'),'port':0x18eb});var io=require(_0xe5bf('0x6'))(new Redis(config[_0xe5bf('0x4')]));function ChatQueue(_0x1e2a5f){this['id']=_0x1e2a5f['id']||0x0;this['name']=_0x1e2a5f[_0xe5bf('0x7')]||'';this[_0xe5bf('0x8')]=_0x1e2a5f[_0xe5bf('0x8')]||0xa;this['strategy']=_0x1e2a5f['strategy']||_0xe5bf('0x9');this['Agents']=_0x1e2a5f[_0xe5bf('0xa')];this[_0xe5bf('0xb')]={};this[_0xe5bf('0xc')]=0x0;this[_0xe5bf('0x1')]='';this[_0xe5bf('0xd')]();this[_0xe5bf('0xe')]();}ChatQueue[_0xe5bf('0xf')][_0xe5bf('0xd')]=function(){var _0x48cceb=this[_0xe5bf('0xb')]['_rr'];this[_0xe5bf('0xb')]=_['map'](this[_0xe5bf('0xa')],'id');this[_0xe5bf('0xb')][_0xe5bf('0x10')]=_0x48cceb;};ChatQueue[_0xe5bf('0xf')][_0xe5bf('0xe')]=function(){this[_0xe5bf('0x11')]=0x0;this[_0xe5bf('0x12')]=0x0;for(var _0x11794d=0x0;_0x11794d=0x0?this['available']:0x0;var _0x4a5367={'id':this['id'],'available':this[_0xe5bf('0x14')],'loggedIn':this['loggedIn'],'name':this[_0xe5bf('0x7')],'paused':this[_0xe5bf('0x12')],'waiting':this[_0xe5bf('0xc')]};var _0x339252=md5(JSON[_0xe5bf('0x15')](_0x4a5367));if(this[_0xe5bf('0x1')]!==_0x339252){this[_0xe5bf('0x1')]=_0x339252;io['to'](util[_0xe5bf('0x16')]('chat:queue:%s',_0x4a5367[_0xe5bf('0x7')]))[_0xe5bf('0x17')](_0xe5bf('0x18'),_0x4a5367);}};module['exports']=ChatQueue; \ No newline at end of file +var _0x4424=['lodash','ioredis','redis','defaults','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','md5','updateRealtime','prototype','updateRouting','_rr','map','length','online','loggedIn','chatPause','paused','available','waiting','format','chat_queue:save','exports'];(function(_0x53f87f,_0x5a81cd){var _0x22a0f0=function(_0x49b15b){while(--_0x49b15b){_0x53f87f['push'](_0x53f87f['shift']());}};_0x22a0f0(++_0x5a81cd);}(_0x4424,0x9c));var _0x4442=function(_0x44bf54,_0x5be3d6){_0x44bf54=_0x44bf54-0x0;var _0x2c4a96=_0x4424[_0x44bf54];return _0x2c4a96;};'use strict';var _=require(_0x4442('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x4442('0x1'));var config=require('../../../config/environment');config[_0x4442('0x2')]=_[_0x4442('0x3')](config[_0x4442('0x2')],{'host':'localhost','port':0x18eb});var io=require(_0x4442('0x4'))(new Redis(config[_0x4442('0x2')]));function ChatQueue(_0xa8fab0){this['id']=_0xa8fab0['id']||0x0;this[_0x4442('0x5')]=_0xa8fab0['name']||'';this[_0x4442('0x6')]=_0xa8fab0['timeout']||0xa;this[_0x4442('0x7')]=_0xa8fab0[_0x4442('0x7')]||'beepall';this[_0x4442('0x8')]=_0xa8fab0[_0x4442('0x8')];this[_0x4442('0x9')]={};this['waiting']=0x0;this[_0x4442('0xa')]='';this['updateRouting']();this[_0x4442('0xb')]();}ChatQueue[_0x4442('0xc')][_0x4442('0xd')]=function(){var _0x1141f3=this[_0x4442('0x9')][_0x4442('0xe')];this[_0x4442('0x9')]=_[_0x4442('0xf')](this[_0x4442('0x8')],'id');this[_0x4442('0x9')]['_rr']=_0x1141f3;};ChatQueue['prototype'][_0x4442('0xb')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x16efea=0x0;_0x16efea=0x0?this['available']:0x0;var _0x36d084={'id':this['id'],'available':this[_0x4442('0x15')],'loggedIn':this[_0x4442('0x12')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x4442('0x16')]};var _0x113e73=md5(JSON['stringify'](_0x36d084));if(this[_0x4442('0xa')]!==_0x113e73){this['md5']=_0x113e73;io['to'](util[_0x4442('0x17')]('chat:queue:%s',_0x36d084[_0x4442('0x5')]))['emit'](_0x4442('0x18'),_0x36d084);}};module[_0x4442('0x19')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 59e57e9..4187343 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(_0x92412b,_0x45bce4){var _0x35f1a4=function(_0x1cebc9){while(--_0x1cebc9){_0x92412b['push'](_0x92412b['shift']());}};_0x35f1a4(++_0x45bce4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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(_0x22a759,_0x5b7c22){var _0x4dc74a=function(_0x32df84){while(--_0x32df84){_0x22a759['push'](_0x22a759['shift']());}};_0x4dc74a(++_0x5b7c22);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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 3535d92..2306d45 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 _0x7be6=['exports','Intervals'];(function(_0x5ac1f4,_0x10f637){var _0x1997c1=function(_0x5dffec){while(--_0x5dffec){_0x5ac1f4['push'](_0x5ac1f4['shift']());}};_0x1997c1(++_0x10f637);}(_0x7be6,0x171));var _0x67be=function(_0x340de5,_0x1b5796){_0x340de5=_0x340de5-0x0;var _0x4c40bd=_0x7be6[_0x340de5];return _0x4c40bd;};'use strict';function Interval(_0x4d1f3a){this['id']=_0x4d1f3a['id']||0x0;this['name']=_0x4d1f3a['name']||'';this[_0x67be('0x0')]=_0x4d1f3a[_0x67be('0x0')]||{};}module[_0x67be('0x1')]=Interval; \ No newline at end of file +var _0xbc1d=['name','exports'];(function(_0x2f888d,_0xc4b1e2){var _0x551666=function(_0x22df5f){while(--_0x22df5f){_0x2f888d['push'](_0x2f888d['shift']());}};_0x551666(++_0xc4b1e2);}(_0xbc1d,0x19e));var _0xdbc1=function(_0x272d90,_0x5e70ff){_0x272d90=_0x272d90-0x0;var _0x2bf4a2=_0xbc1d[_0x272d90];return _0x2bf4a2;};'use strict';function Interval(_0xd2a73d){this['id']=_0xd2a73d['id']||0x0;this[_0xdbc1('0x0')]=_0xd2a73d[_0xdbc1('0x0')]||'';this['Intervals']=_0xd2a73d['Intervals']||{};}module[_0xdbc1('0x1')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index e2401c6..d5decde 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 _0x6b3e=['lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','loggedIn','paused','online','mailPause','available','stringify','emit','mail_queue:save','exports'];(function(_0x1eeb62,_0x59c3ea){var _0x498632=function(_0x848fdb){while(--_0x848fdb){_0x1eeb62['push'](_0x1eeb62['shift']());}};_0x498632(++_0x59c3ea);}(_0x6b3e,0x122));var _0xe6b3=function(_0x3dd7d2,_0xae66d8){_0x3dd7d2=_0x3dd7d2-0x0;var _0x1665fa=_0x6b3e[_0x3dd7d2];return _0x1665fa;};'use strict';var _=require(_0xe6b3('0x0'));var md5=require(_0xe6b3('0x1'));var util=require(_0xe6b3('0x2'));var Redis=require(_0xe6b3('0x3'));var config=require(_0xe6b3('0x4'));config['redis']=_[_0xe6b3('0x5')](config[_0xe6b3('0x6')],{'host':_0xe6b3('0x7'),'port':0x18eb});var io=require(_0xe6b3('0x8'))(new Redis(config[_0xe6b3('0x6')]));function MailQueue(_0x546da4){this['id']=_0x546da4['id']||0x0;this[_0xe6b3('0x9')]=_0x546da4[_0xe6b3('0x9')]||'';this['timeout']=_0x546da4[_0xe6b3('0xa')]||0xa;this[_0xe6b3('0xb')]=_0x546da4[_0xe6b3('0xb')]||_0xe6b3('0xc');this[_0xe6b3('0xd')]=_0x546da4[_0xe6b3('0xd')];this['mapAgentsId']={};this[_0xe6b3('0xe')]=0x0;this[_0xe6b3('0x1')]='';this[_0xe6b3('0xf')]();this[_0xe6b3('0x10')]();}MailQueue[_0xe6b3('0x11')]['updateRouting']=function(){var _0xe88bf4=this[_0xe6b3('0x12')][_0xe6b3('0x13')];this['mapAgentsId']=_['map'](this[_0xe6b3('0xd')],'id');this[_0xe6b3('0x12')][_0xe6b3('0x13')]=_0xe88bf4;};MailQueue[_0xe6b3('0x11')]['updateRealtime']=function(){this[_0xe6b3('0x14')]=0x0;this[_0xe6b3('0x15')]=0x0;for(var _0x18a2b5=0x0;_0x18a2b5=0x0?this[_0xe6b3('0x18')]:0x0;var _0x43b618={'id':this['id'],'available':this[_0xe6b3('0x18')],'loggedIn':this[_0xe6b3('0x14')],'name':this[_0xe6b3('0x9')],'paused':this['paused'],'waiting':this[_0xe6b3('0xe')]};var _0x27f70b=md5(JSON[_0xe6b3('0x19')](_0x43b618));if(this[_0xe6b3('0x1')]!==_0x27f70b){this[_0xe6b3('0x1')]=_0x27f70b;io['to'](util['format']('mail:queue:%s',_0x43b618[_0xe6b3('0x9')]))[_0xe6b3('0x1a')](_0xe6b3('0x1b'),_0x43b618);}};module[_0xe6b3('0x1c')]=MailQueue; \ No newline at end of file +var _0xdcb9=['waiting','stringify','emit','mail_queue:save','exports','lodash','md5','util','ioredis','redis','defaults','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','mailPause','available'];(function(_0x16e50a,_0x5aec08){var _0x1bf2b6=function(_0x449873){while(--_0x449873){_0x16e50a['push'](_0x16e50a['shift']());}};_0x1bf2b6(++_0x5aec08);}(_0xdcb9,0x101));var _0x9dcb=function(_0x3e523b,_0x3976da){_0x3e523b=_0x3e523b-0x0;var _0x68adcb=_0xdcb9[_0x3e523b];return _0x68adcb;};'use strict';var _=require(_0x9dcb('0x0'));var md5=require(_0x9dcb('0x1'));var util=require(_0x9dcb('0x2'));var Redis=require(_0x9dcb('0x3'));var config=require('../../../config/environment');config[_0x9dcb('0x4')]=_[_0x9dcb('0x5')](config[_0x9dcb('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x9dcb('0x6'))(new Redis(config[_0x9dcb('0x4')]));function MailQueue(_0x3403db){this['id']=_0x3403db['id']||0x0;this['name']=_0x3403db[_0x9dcb('0x7')]||'';this['timeout']=_0x3403db[_0x9dcb('0x8')]||0xa;this[_0x9dcb('0x9')]=_0x3403db[_0x9dcb('0x9')]||'beepall';this['Agents']=_0x3403db[_0x9dcb('0xa')];this[_0x9dcb('0xb')]={};this['waiting']=0x0;this[_0x9dcb('0x1')]='';this[_0x9dcb('0xc')]();this[_0x9dcb('0xd')]();}MailQueue['prototype'][_0x9dcb('0xc')]=function(){var _0x540b1b=this['mapAgentsId']['_rr'];this[_0x9dcb('0xb')]=_[_0x9dcb('0xe')](this['Agents'],'id');this[_0x9dcb('0xb')][_0x9dcb('0xf')]=_0x540b1b;};MailQueue[_0x9dcb('0x10')][_0x9dcb('0xd')]=function(){this[_0x9dcb('0x11')]=0x0;this[_0x9dcb('0x12')]=0x0;for(var _0x44c38=0x0;_0x44c38=0x0?this[_0x9dcb('0x16')]:0x0;var _0x3c7af3={'id':this['id'],'available':this[_0x9dcb('0x16')],'loggedIn':this[_0x9dcb('0x11')],'name':this[_0x9dcb('0x7')],'paused':this[_0x9dcb('0x12')],'waiting':this[_0x9dcb('0x17')]};var _0x2fd232=md5(JSON[_0x9dcb('0x18')](_0x3c7af3));if(this[_0x9dcb('0x1')]!==_0x2fd232){this[_0x9dcb('0x1')]=_0x2fd232;io['to'](util['format']('mail:queue:%s',_0x3c7af3['name']))[_0x9dcb('0x19')](_0x9dcb('0x1a'),_0x3c7af3);}};module[_0x9dcb('0x1b')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index a0a5faf..5eec744 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 _0x1846=['online','openchannelPause','paused','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','exports','lodash','util','ioredis','defaults','redis','localhost','name','timeout','strategy','Agents','mapAgentsId','waiting','md5','updateRealtime','updateRouting','_rr','map','loggedIn','length'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x1846,0xd5));var _0x6184=function(_0xb39e3b,_0x2be5df){_0xb39e3b=_0xb39e3b-0x0;var _0x40515c=_0x1846[_0xb39e3b];return _0x40515c;};'use strict';var _=require(_0x6184('0x0'));var md5=require('md5');var util=require(_0x6184('0x1'));var Redis=require(_0x6184('0x2'));var config=require('../../../config/environment');config['redis']=_[_0x6184('0x3')](config[_0x6184('0x4')],{'host':_0x6184('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function OpenchannelQueue(_0x4fad59){this['id']=_0x4fad59['id']||0x0;this[_0x6184('0x6')]=_0x4fad59['name']||'';this[_0x6184('0x7')]=_0x4fad59[_0x6184('0x7')]||0xa;this['strategy']=_0x4fad59[_0x6184('0x8')]||'beepall';this[_0x6184('0x9')]=_0x4fad59[_0x6184('0x9')];this[_0x6184('0xa')]={};this[_0x6184('0xb')]=0x0;this[_0x6184('0xc')]='';this['updateRouting']();this[_0x6184('0xd')]();}OpenchannelQueue['prototype'][_0x6184('0xe')]=function(){var _0x474980=this[_0x6184('0xa')][_0x6184('0xf')];this['mapAgentsId']=_[_0x6184('0x10')](this[_0x6184('0x9')],'id');this[_0x6184('0xa')][_0x6184('0xf')]=_0x474980;};OpenchannelQueue['prototype'][_0x6184('0xd')]=function(){this[_0x6184('0x11')]=0x0;this['paused']=0x0;for(var _0x4b0237=0x0;_0x4b0237=0x0?this[_0x6184('0x16')]:0x0;var _0x4bd73c={'id':this['id'],'available':this[_0x6184('0x16')],'loggedIn':this[_0x6184('0x11')],'name':this['name'],'paused':this[_0x6184('0x15')],'waiting':this[_0x6184('0xb')]};var _0x1e85c6=md5(JSON[_0x6184('0x17')](_0x4bd73c));if(this[_0x6184('0xc')]!==_0x1e85c6){this[_0x6184('0xc')]=_0x1e85c6;io['to'](util[_0x6184('0x18')](_0x6184('0x19'),_0x4bd73c[_0x6184('0x6')]))[_0x6184('0x1a')](_0x6184('0x1b'),_0x4bd73c);}};module[_0x6184('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0xe572=['waiting','updateRealtime','updateRouting','mapAgentsId','_rr','prototype','length','openchannelPause','paused','available','loggedIn','stringify','md5','openchannel:queue:%s','exports','lodash','util','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents'];(function(_0x8d55f9,_0x35093a){var _0xe06caa=function(_0x576567){while(--_0x576567){_0x8d55f9['push'](_0x8d55f9['shift']());}};_0xe06caa(++_0x35093a);}(_0xe572,0x1c9));var _0x2e57=function(_0x2c5590,_0x254f35){_0x2c5590=_0x2c5590-0x0;var _0x4845a0=_0xe572[_0x2c5590];return _0x4845a0;};'use strict';var _=require(_0x2e57('0x0'));var md5=require('md5');var util=require(_0x2e57('0x1'));var Redis=require('ioredis');var config=require(_0x2e57('0x2'));config[_0x2e57('0x3')]=_[_0x2e57('0x4')](config[_0x2e57('0x3')],{'host':_0x2e57('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2e57('0x3')]));function OpenchannelQueue(_0x2b0578){this['id']=_0x2b0578['id']||0x0;this[_0x2e57('0x6')]=_0x2b0578[_0x2e57('0x6')]||'';this[_0x2e57('0x7')]=_0x2b0578[_0x2e57('0x7')]||0xa;this[_0x2e57('0x8')]=_0x2b0578[_0x2e57('0x8')]||_0x2e57('0x9');this[_0x2e57('0xa')]=_0x2b0578['Agents'];this['mapAgentsId']={};this[_0x2e57('0xb')]=0x0;this['md5']='';this['updateRouting']();this[_0x2e57('0xc')]();}OpenchannelQueue['prototype'][_0x2e57('0xd')]=function(){var _0x5e35e1=this[_0x2e57('0xe')][_0x2e57('0xf')];this['mapAgentsId']=_['map'](this[_0x2e57('0xa')],'id');this[_0x2e57('0xe')][_0x2e57('0xf')]=_0x5e35e1;};OpenchannelQueue[_0x2e57('0x10')]['updateRealtime']=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x2cd556=0x0;_0x2cd556=0x0?this[_0x2e57('0x14')]:0x0;var _0x119023={'id':this['id'],'available':this[_0x2e57('0x14')],'loggedIn':this[_0x2e57('0x15')],'name':this[_0x2e57('0x6')],'paused':this['paused'],'waiting':this[_0x2e57('0xb')]};var _0x1741ad=md5(JSON[_0x2e57('0x16')](_0x119023));if(this['md5']!==_0x1741ad){this[_0x2e57('0x17')]=_0x1741ad;io['to'](util['format'](_0x2e57('0x18'),_0x119023[_0x2e57('0x6')]))['emit']('openchannel_queue:save',_0x119023);}};module[_0x2e57('0x19')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index b5332b0..5a5e62d 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(_0x560f2c,_0x55b4f1){var _0x44d73a=function(_0x18065e){while(--_0x18065e){_0x560f2c['push'](_0x560f2c['shift']());}};_0x44d73a(++_0x55b4f1);}(_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 _0xb7e7=['util','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','length','online','paused','available','stringify','sms:queue:%s','emit','exports','lodash'];(function(_0x12435b,_0x31a02a){var _0x12d961=function(_0x11ad86){while(--_0x11ad86){_0x12435b['push'](_0x12435b['shift']());}};_0x12d961(++_0x31a02a);}(_0xb7e7,0x121));var _0x7b7e=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xb7e7[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x7b7e('0x0'));var md5=require('md5');var util=require(_0x7b7e('0x1'));var Redis=require('ioredis');var config=require(_0x7b7e('0x2'));config['redis']=_[_0x7b7e('0x3')](config['redis'],{'host':_0x7b7e('0x4'),'port':0x18eb});var io=require(_0x7b7e('0x5'))(new Redis(config[_0x7b7e('0x6')]));function SmsQueue(_0x52047f){this['id']=_0x52047f['id']||0x0;this['name']=_0x52047f[_0x7b7e('0x7')]||'';this[_0x7b7e('0x8')]=_0x52047f[_0x7b7e('0x8')]||0xa;this['strategy']=_0x52047f[_0x7b7e('0x9')]||_0x7b7e('0xa');this[_0x7b7e('0xb')]=_0x52047f[_0x7b7e('0xb')];this[_0x7b7e('0xc')]={};this[_0x7b7e('0xd')]=0x0;this[_0x7b7e('0xe')]='';this['updateRouting']();this[_0x7b7e('0xf')]();}SmsQueue[_0x7b7e('0x10')][_0x7b7e('0x11')]=function(){var _0x29b622=this[_0x7b7e('0xc')][_0x7b7e('0x12')];this[_0x7b7e('0xc')]=_[_0x7b7e('0x13')](this[_0x7b7e('0xb')],'id');this['mapAgentsId'][_0x7b7e('0x12')]=_0x29b622;};SmsQueue[_0x7b7e('0x10')]['updateRealtime']=function(){this[_0x7b7e('0x14')]=0x0;this['paused']=0x0;for(var _0x4c6011=0x0;_0x4c6011=0x0?this[_0x7b7e('0x18')]:0x0;var _0x200ef7={'id':this['id'],'available':this[_0x7b7e('0x18')],'loggedIn':this[_0x7b7e('0x14')],'name':this[_0x7b7e('0x7')],'paused':this[_0x7b7e('0x17')],'waiting':this[_0x7b7e('0xd')]};var _0x3bec7d=md5(JSON[_0x7b7e('0x19')](_0x200ef7));if(this[_0x7b7e('0xe')]!==_0x3bec7d){this[_0x7b7e('0xe')]=_0x3bec7d;io['to'](util['format'](_0x7b7e('0x1a'),_0x200ef7[_0x7b7e('0x7')]))[_0x7b7e('0x1b')]('sms_queue:save',_0x200ef7);}};module[_0x7b7e('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 778a8eb..e0ad364 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 _0xf97b=['_rr','length','online','loggedIn','paused','available','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xf97b,0x97));var _0xbf97=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xf97b[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xbf97('0x0'));var md5=require('md5');var util=require(_0xbf97('0x1'));var Redis=require(_0xbf97('0x2'));var config=require(_0xbf97('0x3'));config[_0xbf97('0x4')]=_['defaults'](config[_0xbf97('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xbf97('0x5'))(new Redis(config[_0xbf97('0x4')]));function WhatsappQueue(_0x176f73){this['id']=_0x176f73['id']||0x0;this['name']=_0x176f73[_0xbf97('0x6')]||'';this[_0xbf97('0x7')]=_0x176f73[_0xbf97('0x7')]||0xa;this['strategy']=_0x176f73[_0xbf97('0x8')]||_0xbf97('0x9');this[_0xbf97('0xa')]=_0x176f73[_0xbf97('0xa')];this[_0xbf97('0xb')]={};this[_0xbf97('0xc')]=0x0;this[_0xbf97('0xd')]='';this[_0xbf97('0xe')]();this[_0xbf97('0xf')]();}WhatsappQueue[_0xbf97('0x10')][_0xbf97('0xe')]=function(){var _0x11872e=this['mapAgentsId'][_0xbf97('0x11')];this[_0xbf97('0xb')]=_['map'](this[_0xbf97('0xa')],'id');this['mapAgentsId']['_rr']=_0x11872e;};WhatsappQueue['prototype'][_0xbf97('0xf')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x4590b8=0x0;_0x4590b8=0x0?this['available']:0x0;var _0x4a29e4={'id':this['id'],'available':this[_0xbf97('0x16')],'loggedIn':this[_0xbf97('0x14')],'name':this[_0xbf97('0x6')],'paused':this[_0xbf97('0x15')],'waiting':this['waiting']};var _0x2bf717=md5(JSON['stringify'](_0x4a29e4));if(this[_0xbf97('0xd')]!==_0x2bf717){this[_0xbf97('0xd')]=_0x2bf717;io['to'](util[_0xbf97('0x17')](_0xbf97('0x18'),_0x4a29e4[_0xbf97('0x6')]))[_0xbf97('0x19')](_0xbf97('0x1a'),_0x4a29e4);}};module[_0xbf97('0x1b')]=WhatsappQueue; \ No newline at end of file +var _0x861c=['updateRealtime','prototype','_rr','loggedIn','length','online','whatsappPause','paused','available','waiting','stringify','format','whatsapp:queue:%s','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','updateRouting'];(function(_0x2de012,_0x5276dd){var _0x5b6423=function(_0x50136d){while(--_0x50136d){_0x2de012['push'](_0x2de012['shift']());}};_0x5b6423(++_0x5276dd);}(_0x861c,0x1d1));var _0xc861=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x861c[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xc861('0x0'));var md5=require(_0xc861('0x1'));var util=require(_0xc861('0x2'));var Redis=require(_0xc861('0x3'));var config=require(_0xc861('0x4'));config[_0xc861('0x5')]=_[_0xc861('0x6')](config[_0xc861('0x5')],{'host':_0xc861('0x7'),'port':0x18eb});var io=require(_0xc861('0x8'))(new Redis(config[_0xc861('0x5')]));function WhatsappQueue(_0x1a6778){this['id']=_0x1a6778['id']||0x0;this['name']=_0x1a6778[_0xc861('0x9')]||'';this[_0xc861('0xa')]=_0x1a6778[_0xc861('0xa')]||0xa;this[_0xc861('0xb')]=_0x1a6778[_0xc861('0xb')]||'beepall';this[_0xc861('0xc')]=_0x1a6778[_0xc861('0xc')];this[_0xc861('0xd')]={};this['waiting']=0x0;this[_0xc861('0x1')]='';this[_0xc861('0xe')]();this[_0xc861('0xf')]();}WhatsappQueue[_0xc861('0x10')][_0xc861('0xe')]=function(){var _0x4b0501=this['mapAgentsId'][_0xc861('0x11')];this[_0xc861('0xd')]=_['map'](this['Agents'],'id');this[_0xc861('0xd')][_0xc861('0x11')]=_0x4b0501;};WhatsappQueue[_0xc861('0x10')][_0xc861('0xf')]=function(){this[_0xc861('0x12')]=0x0;this['paused']=0x0;for(var _0x29c088=0x0;_0x29c088=0x0?this[_0xc861('0x17')]:0x0;var _0x1a4a04={'id':this['id'],'available':this[_0xc861('0x17')],'loggedIn':this[_0xc861('0x12')],'name':this[_0xc861('0x9')],'paused':this['paused'],'waiting':this[_0xc861('0x18')]};var _0x86b88e=md5(JSON[_0xc861('0x19')](_0x1a4a04));if(this[_0xc861('0x1')]!==_0x86b88e){this['md5']=_0x86b88e;io['to'](util[_0xc861('0x1a')](_0xc861('0x1b'),_0x1a4a04['name']))['emit'](_0xc861('0x1c'),_0x1a4a04);}};module[_0xc861('0x1d')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 23b7fad..41fed08 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['initMailQueues','mailQueues','initFaxQueues','faxQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','../model/agent','../model/interval','../model/chatQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','smsQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','length','isUndefined','initIntervals','initOpenchannelQueues','updateRouting','updateRealtime','initChatQueues','initSmsQueues'];(function(_0x3cb30b,_0x504b3e){var _0x2ca717=function(_0x32a3d9){while(--_0x32a3d9){_0x3cb30b['push'](_0x3cb30b['shift']());}};_0x2ca717(++_0x504b3e);}(_0xe14b,0x93));var _0xbe14=function(_0x292941,_0x58ca24){_0x292941=_0x292941-0x0;var _0x32fe89=_0xe14b[_0x292941];return _0x32fe89;};'use strict';var BPromise=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var _=require('lodash');var moment=require('moment');var Agent=require(_0xbe14('0x2'));var Interval=require(_0xbe14('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0xbe14('0x4'));var SmsQueue=require('../model/smsQueue');var MailQueue=require('../model/mailQueue');var FaxQueue=require(_0xbe14('0x5'));var WhatsappQueue=require(_0xbe14('0x6'));var Realtime=function(){this[_0xbe14('0x7')]={};this[_0xbe14('0x8')]={};this[_0xbe14('0x9')]={};this[_0xbe14('0xa')]={};this[_0xbe14('0xb')]={};this['mailQueues']={};this['faxQueues']={};this['whatsappQueues']={};this[_0xbe14('0xc')]={};this[_0xbe14('0xd')]={};this[_0xbe14('0xe')]={};this[_0xbe14('0xf')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x113243,_0x3f70cb,_0x4935cc){var _0x254c3b=_[_0xbe14('0x10')](_0x113243,function(_0x886a5e,_0x3d38c2){return _0x886a5e[_0x4935cc];});for(var _0x27792f in _0x3f70cb){if(_0x3f70cb[_0xbe14('0x11')](_0x27792f)){if(!_0x254c3b[_0x27792f]){delete _0x3f70cb[_0x27792f];}}}}Realtime[_0xbe14('0x12')][_0xbe14('0x13')]=function(_0x16893f,_0xa2cf72){for(var _0x1e4826 in _0xa2cf72){if(_0x16893f[_0xbe14('0x11')](_0x1e4826)){_0x16893f[_0x1e4826]=_0xa2cf72[_0x1e4826];}}};Realtime[_0xbe14('0x12')]['initAgents']=function(){var _0x55b3a7=this;return function(_0x3f58f5){if(_0x3f58f5){freeIsNotKey(_0x3f58f5,_0x55b3a7[_0xbe14('0x7')],'id');for(var _0xf4ac9=0x0,_0x37ce4e={},_0x4e8f34={};_0xf4ac9<_0x3f58f5[_0xbe14('0x14')];_0xf4ac9+=0x1){_0x37ce4e=_0x3f58f5[_0xf4ac9];if(_[_0xbe14('0x15')](_0x55b3a7[_0xbe14('0x7')][_0x37ce4e['id']])){_0x55b3a7[_0xbe14('0x7')][_0x37ce4e['id']]=new Agent(_0x37ce4e);}else{_0x55b3a7[_0xbe14('0x13')](_0x55b3a7[_0xbe14('0x7')][_0x37ce4e['id']],_0x37ce4e);}}}return _0x55b3a7[_0xbe14('0x7')];};};Realtime['prototype'][_0xbe14('0x16')]=function(){var _0x456ca8=this;return function(_0x329588){if(_0x329588){freeIsNotKey(_0x329588,_0x456ca8[_0xbe14('0x8')],'id');for(var _0x3249da=0x0,_0x37e4c1={},_0x59a9e3={};_0x3249da<_0x329588[_0xbe14('0x14')];_0x3249da+=0x1){_0x37e4c1=_0x329588[_0x3249da];if(_[_0xbe14('0x15')](_0x456ca8[_0xbe14('0x8')][_0x37e4c1['id']])){_0x456ca8[_0xbe14('0x8')][_0x37e4c1['id']]=new Interval(_0x37e4c1);}else{_0x456ca8[_0xbe14('0x13')](_0x456ca8['intervals'][_0x37e4c1['id']],_0x37e4c1);}}}return _0x456ca8[_0xbe14('0x8')];};};Realtime['prototype'][_0xbe14('0x17')]=function(){var _0x56e80c=this;return function(_0x32e8eb){if(_0x32e8eb){freeIsNotKey(_0x32e8eb,_0x56e80c['openchannelQueues'],'id');for(var _0x274018=0x0,_0x3d3608={},_0x505dbd={};_0x274018<_0x32e8eb[_0xbe14('0x14')];_0x274018+=0x1){_0x3d3608=_0x32e8eb[_0x274018];if(_['isUndefined'](_0x56e80c[_0xbe14('0x9')][_0x3d3608['id']])){_0x56e80c['openchannelQueues'][_0x3d3608['id']]=new OpenchannelQueue(_0x3d3608);}else{_0x56e80c[_0xbe14('0x13')](_0x56e80c[_0xbe14('0x9')][_0x3d3608['id']],_0x3d3608);}_0x56e80c[_0xbe14('0x9')][_0x3d3608['id']][_0xbe14('0x18')]();_0x56e80c[_0xbe14('0x9')][_0x3d3608['id']][_0xbe14('0x19')]();}}return _0x56e80c['openchannelQueues'];};};Realtime[_0xbe14('0x12')][_0xbe14('0x1a')]=function(){var _0x391556=this;return function(_0x169369){if(_0x169369){freeIsNotKey(_0x169369,_0x391556['chatQueues'],'id');for(var _0x16f884=0x0,_0x29fc64={},_0x59bf34={};_0x16f884<_0x169369[_0xbe14('0x14')];_0x16f884+=0x1){_0x29fc64=_0x169369[_0x16f884];if(_[_0xbe14('0x15')](_0x391556[_0xbe14('0xa')][_0x29fc64['id']])){_0x391556[_0xbe14('0xa')][_0x29fc64['id']]=new ChatQueue(_0x29fc64);}else{_0x391556[_0xbe14('0x13')](_0x391556[_0xbe14('0xa')][_0x29fc64['id']],_0x29fc64);}_0x391556[_0xbe14('0xa')][_0x29fc64['id']][_0xbe14('0x18')]();_0x391556[_0xbe14('0xa')][_0x29fc64['id']][_0xbe14('0x19')]();}}return _0x391556[_0xbe14('0xa')];};};Realtime[_0xbe14('0x12')][_0xbe14('0x1b')]=function(){var _0x10ae36=this;return function(_0x223f7a){if(_0x223f7a){freeIsNotKey(_0x223f7a,_0x10ae36[_0xbe14('0xb')],'id');for(var _0x6ba36c=0x0,_0x2ff48e={},_0x29e76a={};_0x6ba36c<_0x223f7a[_0xbe14('0x14')];_0x6ba36c+=0x1){_0x2ff48e=_0x223f7a[_0x6ba36c];if(_['isUndefined'](_0x10ae36[_0xbe14('0xb')][_0x2ff48e['id']])){_0x10ae36['smsQueues'][_0x2ff48e['id']]=new SmsQueue(_0x2ff48e);}else{_0x10ae36['mergeFromDatabase'](_0x10ae36[_0xbe14('0xb')][_0x2ff48e['id']],_0x2ff48e);}_0x10ae36['smsQueues'][_0x2ff48e['id']][_0xbe14('0x18')]();_0x10ae36[_0xbe14('0xb')][_0x2ff48e['id']]['updateRealtime']();}}return _0x10ae36['smsQueues'];};};Realtime['prototype'][_0xbe14('0x1c')]=function(){var _0xa3d24=this;return function(_0x5f27b6){if(_0x5f27b6){freeIsNotKey(_0x5f27b6,_0xa3d24[_0xbe14('0x1d')],'id');for(var _0x1faf3e=0x0,_0x452635={},_0x1aa849={};_0x1faf3e<_0x5f27b6[_0xbe14('0x14')];_0x1faf3e+=0x1){_0x452635=_0x5f27b6[_0x1faf3e];if(_['isUndefined'](_0xa3d24['mailQueues'][_0x452635['id']])){_0xa3d24[_0xbe14('0x1d')][_0x452635['id']]=new MailQueue(_0x452635);}else{_0xa3d24['mergeFromDatabase'](_0xa3d24['mailQueues'][_0x452635['id']],_0x452635);}_0xa3d24['mailQueues'][_0x452635['id']][_0xbe14('0x18')]();_0xa3d24[_0xbe14('0x1d')][_0x452635['id']][_0xbe14('0x19')]();}}return _0xa3d24[_0xbe14('0x1d')];};};Realtime[_0xbe14('0x12')][_0xbe14('0x1e')]=function(){var _0xcdc50=this;return function(_0x10ec3c){if(_0x10ec3c){freeIsNotKey(_0x10ec3c,_0xcdc50[_0xbe14('0x1f')],'id');for(var _0x2dfd5a=0x0,_0x41652d={},_0x32c59d={};_0x2dfd5a<_0x10ec3c['length'];_0x2dfd5a+=0x1){_0x41652d=_0x10ec3c[_0x2dfd5a];if(_['isUndefined'](_0xcdc50[_0xbe14('0x1f')][_0x41652d['id']])){_0xcdc50[_0xbe14('0x1f')][_0x41652d['id']]=new FaxQueue(_0x41652d);}else{_0xcdc50[_0xbe14('0x13')](_0xcdc50['faxQueues'][_0x41652d['id']],_0x41652d);}_0xcdc50[_0xbe14('0x1f')][_0x41652d['id']][_0xbe14('0x18')]();_0xcdc50[_0xbe14('0x1f')][_0x41652d['id']][_0xbe14('0x19')]();}}return _0xcdc50[_0xbe14('0x1f')];};};Realtime[_0xbe14('0x12')][_0xbe14('0x20')]=function(){var _0x128843=this;return function(_0x1b2608){if(_0x1b2608){freeIsNotKey(_0x1b2608,_0x128843['whatsappQueues'],'id');for(var _0xe51424=0x0,_0x841b71={},_0x3463c4={};_0xe51424<_0x1b2608[_0xbe14('0x14')];_0xe51424+=0x1){_0x841b71=_0x1b2608[_0xe51424];if(_[_0xbe14('0x15')](_0x128843[_0xbe14('0x21')][_0x841b71['id']])){_0x128843['whatsappQueues'][_0x841b71['id']]=new WhatsappQueue(_0x841b71);}else{_0x128843[_0xbe14('0x13')](_0x128843[_0xbe14('0x21')][_0x841b71['id']],_0x841b71);}_0x128843[_0xbe14('0x21')][_0x841b71['id']][_0xbe14('0x18')]();_0x128843['whatsappQueues'][_0x841b71['id']]['updateRealtime']();}}return _0x128843[_0xbe14('0x21')];};};module[_0xbe14('0x22')]=Realtime; \ No newline at end of file +var _0x6aa7=['agents','openchannelQueues','chatQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','prototype','mergeFromDatabase','initAgents','length','intervals','isUndefined','updateRealtime','initChatQueues','updateRouting','initMailQueues','mailQueues','initWhatsappQueues','bluebird','lodash','moment','../model/agent','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0x6aa7,0x178));var _0x76aa=function(_0x191d73,_0x1c26bc){_0x191d73=_0x191d73-0x0;var _0x3287d4=_0x6aa7[_0x191d73];return _0x3287d4;};'use strict';var BPromise=require(_0x76aa('0x0'));var util=require('util');var _=require(_0x76aa('0x1'));var moment=require(_0x76aa('0x2'));var Agent=require(_0x76aa('0x3'));var Interval=require(_0x76aa('0x4'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x76aa('0x5'));var SmsQueue=require(_0x76aa('0x6'));var MailQueue=require(_0x76aa('0x7'));var FaxQueue=require('../model/faxQueue');var WhatsappQueue=require('../model/whatsappQueue');var Realtime=function(){this[_0x76aa('0x8')]={};this['intervals']={};this[_0x76aa('0x9')]={};this[_0x76aa('0xa')]={};this[_0x76aa('0xb')]={};this['mailQueues']={};this[_0x76aa('0xc')]={};this[_0x76aa('0xd')]={};this[_0x76aa('0xe')]={};this['mailQueuesWaitingInteractions']={};this[_0x76aa('0xf')]={};this[_0x76aa('0x10')]={};this[_0x76aa('0x11')]={};this[_0x76aa('0x12')]={};};function freeIsNotKey(_0x37f1ab,_0x128435,_0x2c5075){var _0x8dc35c=_[_0x76aa('0x13')](_0x37f1ab,function(_0x17a417,_0x5e5f47){return _0x17a417[_0x2c5075];});for(var _0x112c39 in _0x128435){if(_0x128435['hasOwnProperty'](_0x112c39)){if(!_0x8dc35c[_0x112c39]){delete _0x128435[_0x112c39];}}}}Realtime[_0x76aa('0x14')][_0x76aa('0x15')]=function(_0x3f8f6b,_0x8e44ed){for(var _0x10432c in _0x8e44ed){if(_0x3f8f6b['hasOwnProperty'](_0x10432c)){_0x3f8f6b[_0x10432c]=_0x8e44ed[_0x10432c];}}};Realtime['prototype'][_0x76aa('0x16')]=function(){var _0x4cfc34=this;return function(_0x180d92){if(_0x180d92){freeIsNotKey(_0x180d92,_0x4cfc34[_0x76aa('0x8')],'id');for(var _0x5cf594=0x0,_0x2111c7={},_0x550d9a={};_0x5cf594<_0x180d92[_0x76aa('0x17')];_0x5cf594+=0x1){_0x2111c7=_0x180d92[_0x5cf594];if(_['isUndefined'](_0x4cfc34[_0x76aa('0x8')][_0x2111c7['id']])){_0x4cfc34[_0x76aa('0x8')][_0x2111c7['id']]=new Agent(_0x2111c7);}else{_0x4cfc34[_0x76aa('0x15')](_0x4cfc34[_0x76aa('0x8')][_0x2111c7['id']],_0x2111c7);}}}return _0x4cfc34[_0x76aa('0x8')];};};Realtime[_0x76aa('0x14')]['initIntervals']=function(){var _0x5d6202=this;return function(_0x256636){if(_0x256636){freeIsNotKey(_0x256636,_0x5d6202[_0x76aa('0x18')],'id');for(var _0xf0711=0x0,_0x15b931={},_0x15109b={};_0xf0711<_0x256636[_0x76aa('0x17')];_0xf0711+=0x1){_0x15b931=_0x256636[_0xf0711];if(_[_0x76aa('0x19')](_0x5d6202[_0x76aa('0x18')][_0x15b931['id']])){_0x5d6202[_0x76aa('0x18')][_0x15b931['id']]=new Interval(_0x15b931);}else{_0x5d6202['mergeFromDatabase'](_0x5d6202[_0x76aa('0x18')][_0x15b931['id']],_0x15b931);}}}return _0x5d6202[_0x76aa('0x18')];};};Realtime[_0x76aa('0x14')]['initOpenchannelQueues']=function(){var _0x41463a=this;return function(_0x189cb6){if(_0x189cb6){freeIsNotKey(_0x189cb6,_0x41463a[_0x76aa('0x9')],'id');for(var _0x2bd2c6=0x0,_0x29c50c={},_0xc1044c={};_0x2bd2c6<_0x189cb6[_0x76aa('0x17')];_0x2bd2c6+=0x1){_0x29c50c=_0x189cb6[_0x2bd2c6];if(_[_0x76aa('0x19')](_0x41463a[_0x76aa('0x9')][_0x29c50c['id']])){_0x41463a[_0x76aa('0x9')][_0x29c50c['id']]=new OpenchannelQueue(_0x29c50c);}else{_0x41463a[_0x76aa('0x15')](_0x41463a[_0x76aa('0x9')][_0x29c50c['id']],_0x29c50c);}_0x41463a[_0x76aa('0x9')][_0x29c50c['id']]['updateRouting']();_0x41463a[_0x76aa('0x9')][_0x29c50c['id']][_0x76aa('0x1a')]();}}return _0x41463a[_0x76aa('0x9')];};};Realtime[_0x76aa('0x14')][_0x76aa('0x1b')]=function(){var _0x2f9316=this;return function(_0x25a803){if(_0x25a803){freeIsNotKey(_0x25a803,_0x2f9316[_0x76aa('0xa')],'id');for(var _0xd12a99=0x0,_0x1bdc3d={},_0x545b06={};_0xd12a99<_0x25a803[_0x76aa('0x17')];_0xd12a99+=0x1){_0x1bdc3d=_0x25a803[_0xd12a99];if(_['isUndefined'](_0x2f9316[_0x76aa('0xa')][_0x1bdc3d['id']])){_0x2f9316[_0x76aa('0xa')][_0x1bdc3d['id']]=new ChatQueue(_0x1bdc3d);}else{_0x2f9316[_0x76aa('0x15')](_0x2f9316[_0x76aa('0xa')][_0x1bdc3d['id']],_0x1bdc3d);}_0x2f9316[_0x76aa('0xa')][_0x1bdc3d['id']][_0x76aa('0x1c')]();_0x2f9316[_0x76aa('0xa')][_0x1bdc3d['id']][_0x76aa('0x1a')]();}}return _0x2f9316[_0x76aa('0xa')];};};Realtime[_0x76aa('0x14')]['initSmsQueues']=function(){var _0x430ad6=this;return function(_0x5532c7){if(_0x5532c7){freeIsNotKey(_0x5532c7,_0x430ad6[_0x76aa('0xb')],'id');for(var _0x928ccf=0x0,_0x458ac3={},_0x38ecd1={};_0x928ccf<_0x5532c7[_0x76aa('0x17')];_0x928ccf+=0x1){_0x458ac3=_0x5532c7[_0x928ccf];if(_['isUndefined'](_0x430ad6[_0x76aa('0xb')][_0x458ac3['id']])){_0x430ad6[_0x76aa('0xb')][_0x458ac3['id']]=new SmsQueue(_0x458ac3);}else{_0x430ad6['mergeFromDatabase'](_0x430ad6[_0x76aa('0xb')][_0x458ac3['id']],_0x458ac3);}_0x430ad6['smsQueues'][_0x458ac3['id']][_0x76aa('0x1c')]();_0x430ad6['smsQueues'][_0x458ac3['id']][_0x76aa('0x1a')]();}}return _0x430ad6['smsQueues'];};};Realtime['prototype'][_0x76aa('0x1d')]=function(){var _0x282c56=this;return function(_0x198fcb){if(_0x198fcb){freeIsNotKey(_0x198fcb,_0x282c56[_0x76aa('0x1e')],'id');for(var _0x595a0f=0x0,_0x592596={},_0xdb18d3={};_0x595a0f<_0x198fcb[_0x76aa('0x17')];_0x595a0f+=0x1){_0x592596=_0x198fcb[_0x595a0f];if(_[_0x76aa('0x19')](_0x282c56[_0x76aa('0x1e')][_0x592596['id']])){_0x282c56[_0x76aa('0x1e')][_0x592596['id']]=new MailQueue(_0x592596);}else{_0x282c56['mergeFromDatabase'](_0x282c56[_0x76aa('0x1e')][_0x592596['id']],_0x592596);}_0x282c56['mailQueues'][_0x592596['id']]['updateRouting']();_0x282c56[_0x76aa('0x1e')][_0x592596['id']][_0x76aa('0x1a')]();}}return _0x282c56[_0x76aa('0x1e')];};};Realtime[_0x76aa('0x14')]['initFaxQueues']=function(){var _0x401c07=this;return function(_0x1c22f7){if(_0x1c22f7){freeIsNotKey(_0x1c22f7,_0x401c07[_0x76aa('0xc')],'id');for(var _0x4e131a=0x0,_0x113770={},_0x1638db={};_0x4e131a<_0x1c22f7[_0x76aa('0x17')];_0x4e131a+=0x1){_0x113770=_0x1c22f7[_0x4e131a];if(_[_0x76aa('0x19')](_0x401c07[_0x76aa('0xc')][_0x113770['id']])){_0x401c07[_0x76aa('0xc')][_0x113770['id']]=new FaxQueue(_0x113770);}else{_0x401c07[_0x76aa('0x15')](_0x401c07[_0x76aa('0xc')][_0x113770['id']],_0x113770);}_0x401c07[_0x76aa('0xc')][_0x113770['id']]['updateRouting']();_0x401c07[_0x76aa('0xc')][_0x113770['id']][_0x76aa('0x1a')]();}}return _0x401c07[_0x76aa('0xc')];};};Realtime[_0x76aa('0x14')][_0x76aa('0x1f')]=function(){var _0x2957aa=this;return function(_0x572fdb){if(_0x572fdb){freeIsNotKey(_0x572fdb,_0x2957aa['whatsappQueues'],'id');for(var _0x153a47=0x0,_0x262906={},_0x426454={};_0x153a47<_0x572fdb[_0x76aa('0x17')];_0x153a47+=0x1){_0x262906=_0x572fdb[_0x153a47];if(_['isUndefined'](_0x2957aa[_0x76aa('0xd')][_0x262906['id']])){_0x2957aa[_0x76aa('0xd')][_0x262906['id']]=new WhatsappQueue(_0x262906);}else{_0x2957aa[_0x76aa('0x15')](_0x2957aa[_0x76aa('0xd')][_0x262906['id']],_0x262906);}_0x2957aa[_0x76aa('0xd')][_0x262906['id']]['updateRouting']();_0x2957aa[_0x76aa('0xd')][_0x262906['id']]['updateRealtime']();}}return _0x2957aa[_0x76aa('0xd')];};};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 0660aed..d611acf 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 _0xdeb5=['addTagsToChatInteraction','updateChatInteraction','Request','AddTagsToChatInteraction'];(function(_0x57c0bd,_0x74a622){var _0x279c96=function(_0x137a41){while(--_0x137a41){_0x57c0bd['push'](_0x57c0bd['shift']());}};_0x279c96(++_0x74a622);}(_0xdeb5,0x179));var _0x5deb=function(_0x39bf4d,_0x13f45b){_0x39bf4d=_0x39bf4d-0x0;var _0x453884=_0xdeb5[_0x39bf4d];return _0x453884;};'use strict';var client=require('../client');exports['update']=function(_0x2320e7,_0xdd5ce1){return client['Request']('UpdateChatInteraction',{'body':_0xdd5ce1,'options':{'where':{'id':_0x2320e7}},'log':_0x5deb('0x0')});};exports['addTags']=function(_0x2c3954,_0xa81416){return client[_0x5deb('0x1')](_0x5deb('0x2'),{'body':_0xa81416,'options':{'where':{'id':_0x2c3954}},'log':_0x5deb('0x3')});}; \ No newline at end of file +var _0xc906=['addTags','Request','addTagsToChatInteraction','../client','update','UpdateChatInteraction','updateChatInteraction'];(function(_0x9fca6,_0xef3bf6){var _0x26a1f0=function(_0x370253){while(--_0x370253){_0x9fca6['push'](_0x9fca6['shift']());}};_0x26a1f0(++_0xef3bf6);}(_0xc906,0xab));var _0x6c90=function(_0x4bd321,_0x2f22f9){_0x4bd321=_0x4bd321-0x0;var _0x2784e8=_0xc906[_0x4bd321];return _0x2784e8;};'use strict';var client=require(_0x6c90('0x0'));exports[_0x6c90('0x1')]=function(_0x24388e,_0x2107ac){return client['Request'](_0x6c90('0x2'),{'body':_0x2107ac,'options':{'where':{'id':_0x24388e}},'log':_0x6c90('0x3')});};exports[_0x6c90('0x4')]=function(_0x2cb380,_0x5489f9){return client[_0x6c90('0x5')]('AddTagsToChatInteraction',{'body':_0x5489f9,'options':{'where':{'id':_0x2cb380}},'log':_0x6c90('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 21cf937..3571899 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 _0x604f=['Request','CreateChatMessage','createChatMessage','../client'];(function(_0x15703d,_0x5cac2e){var _0x364368=function(_0x4bc6f0){while(--_0x4bc6f0){_0x15703d['push'](_0x15703d['shift']());}};_0x364368(++_0x5cac2e);}(_0x604f,0x183));var _0xf604=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x604f[_0x2d2c16];return _0x53f2fb;};'use strict';var client=require(_0xf604('0x0'));exports['create']=function(_0x50e5dc){return client[_0xf604('0x1')](_0xf604('0x2'),{'body':_0x50e5dc,'log':_0xf604('0x3')});}; \ No newline at end of file +var _0x4f5c=['../client','Request'];(function(_0x29d623,_0x1a5c9c){var _0x242e59=function(_0x2c78ab){while(--_0x2c78ab){_0x29d623['push'](_0x29d623['shift']());}};_0x242e59(++_0x1a5c9c);}(_0x4f5c,0x13e));var _0xc4f5=function(_0x2c68d1,_0x3192c5){_0x2c68d1=_0x2c68d1-0x0;var _0x577f41=_0x4f5c[_0x2c68d1];return _0x577f41;};'use strict';var client=require(_0xc4f5('0x0'));exports['create']=function(_0xb0f938){return client[_0xc4f5('0x1')]('CreateChatMessage',{'body':_0xb0f938,'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 f633ea0..8b3146d 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 _0x5984=['GetChatQueue','strategy','User','Agents','online','chatPause','getChatQueues','Request'];(function(_0x445975,_0x3df67c){var _0x4bf86a=function(_0x3fffc5){while(--_0x3fffc5){_0x445975['push'](_0x445975['shift']());}};_0x4bf86a(++_0x3df67c);}(_0x5984,0x12e));var _0x4598=function(_0x1fd0a0,_0x10990d){_0x1fd0a0=_0x1fd0a0-0x0;var _0x16b07a=_0x5984[_0x1fd0a0];return _0x16b07a;};'use strict';var client=require('../client');exports[_0x4598('0x0')]=function(){return function(){return client[_0x4598('0x1')](_0x4598('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x4598('0x3')],'include':[{'model':_0x4598('0x4'),'as':_0x4598('0x5'),'attributes':['id','name',_0x4598('0x6'),_0x4598('0x7')]}]},'log':_0x4598('0x0')});};}; \ No newline at end of file +var _0xe733=['GetChatQueue','name','strategy','User','Agents','chatPause','../client','getChatQueues','Request'];(function(_0x32c9e3,_0x3a1c18){var _0x5d96a3=function(_0x225156){while(--_0x225156){_0x32c9e3['push'](_0x32c9e3['shift']());}};_0x5d96a3(++_0x3a1c18);}(_0xe733,0x9f));var _0x3e73=function(_0x3cb794,_0x50ebdb){_0x3cb794=_0x3cb794-0x0;var _0x165168=_0xe733[_0x3cb794];return _0x165168;};'use strict';var client=require(_0x3e73('0x0'));exports[_0x3e73('0x1')]=function(){return function(){return client[_0x3e73('0x2')](_0x3e73('0x3'),{'options':{'raw':![],'attributes':['id',_0x3e73('0x4'),'timeout',_0x3e73('0x5')],'include':[{'model':_0x3e73('0x6'),'as':_0x3e73('0x7'),'attributes':['id',_0x3e73('0x4'),'online',_0x3e73('0x8')]}]},'log':_0x3e73('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 192b89f..3aa7a71 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 _0x2830=['create','Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client'];(function(_0xb1e999,_0x5f064d){var _0x209e88=function(_0x4b35f4){while(--_0x4b35f4){_0xb1e999['push'](_0xb1e999['shift']());}};_0x209e88(++_0x5f064d);}(_0x2830,0x117));var _0x0283=function(_0xa0accc,_0x25033b){_0xa0accc=_0xa0accc-0x0;var _0x4ca5df=_0x2830[_0xa0accc];return _0x4ca5df;};'use strict';var client=require(_0x0283('0x0'));exports[_0x0283('0x1')]=function(_0x4ee0cd){return client[_0x0283('0x2')](_0x0283('0x3'),{'body':_0x4ee0cd,'log':_0x0283('0x3')});};exports[_0x0283('0x4')]=function(_0x56984a,_0x414c89){return client['Request'](_0x0283('0x5'),{'body':_0x414c89,'options':{'where':{'uniqueid':_0x56984a},'order':[['id',_0x0283('0x6')]],'limit':0x1},'log':_0x0283('0x5')});}; \ No newline at end of file +var _0x2392=['Request','CreateChatQueueReport','UpdateChatQueueReport','DESC','../client','create'];(function(_0x506df2,_0x46761d){var _0x1cf10c=function(_0x245142){while(--_0x245142){_0x506df2['push'](_0x506df2['shift']());}};_0x1cf10c(++_0x46761d);}(_0x2392,0xd0));var _0x2239=function(_0x21616a,_0x3005d1){_0x21616a=_0x21616a-0x0;var _0x5c2090=_0x2392[_0x21616a];return _0x5c2090;};'use strict';var client=require(_0x2239('0x0'));exports[_0x2239('0x1')]=function(_0x4bfc60){return client[_0x2239('0x2')](_0x2239('0x3'),{'body':_0x4bfc60,'log':'CreateChatQueueReport'});};exports['update']=function(_0x277193,_0x420e52){return client[_0x2239('0x2')](_0x2239('0x4'),{'body':_0x420e52,'options':{'where':{'uniqueid':_0x277193},'order':[['id',_0x2239('0x5')]],'limit':0x1},'log':_0x2239('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index c6baf13..25be244 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 _0xa831=['updateFaxInteraction','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','Request','UpdateFaxInteraction'];(function(_0x52d2d4,_0x4b8337){var _0x8925c1=function(_0x464b45){while(--_0x464b45){_0x52d2d4['push'](_0x52d2d4['shift']());}};_0x8925c1(++_0x4b8337);}(_0xa831,0x1ca));var _0x1a83=function(_0x2142c8,_0x3001eb){_0x2142c8=_0x2142c8-0x0;var _0x4286e9=_0xa831[_0x2142c8];return _0x4286e9;};'use strict';var client=require(_0x1a83('0x0'));exports[_0x1a83('0x1')]=function(_0x3c86c0,_0x2db900){return client[_0x1a83('0x2')](_0x1a83('0x3'),{'body':_0x2db900,'options':{'where':{'id':_0x3c86c0}},'log':_0x1a83('0x4')});};exports['addTags']=function(_0x330633,_0x3cd06a){return client[_0x1a83('0x2')](_0x1a83('0x5'),{'body':_0x3cd06a,'options':{'where':{'id':_0x330633}},'log':_0x1a83('0x6')});}; \ No newline at end of file +var _0x1813=['addTagsToFaxInteraction','../client','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0xfee10f,_0x53470e){var _0xb91051=function(_0x3c6d81){while(--_0x3c6d81){_0xfee10f['push'](_0xfee10f['shift']());}};_0xb91051(++_0x53470e);}(_0x1813,0x79));var _0x3181=function(_0x4e68be,_0x1c7e42){_0x4e68be=_0x4e68be-0x0;var _0x1af5af=_0x1813[_0x4e68be];return _0x1af5af;};'use strict';var client=require(_0x3181('0x0'));exports['update']=function(_0x219a4f,_0x1d7397){return client['Request'](_0x3181('0x1'),{'body':_0x1d7397,'options':{'where':{'id':_0x219a4f}},'log':_0x3181('0x2')});};exports[_0x3181('0x3')]=function(_0x464c26,_0x51eb04){return client['Request']('AddTagsToFaxInteraction',{'body':_0x51eb04,'options':{'where':{'id':_0x464c26}},'log':_0x3181('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index a469802..1d355b7 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 _0xcedf=['createFaxMessage','../client','create'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xcedf,0x19f));var _0xfced=function(_0x5a461b,_0x306e5c){_0x5a461b=_0x5a461b-0x0;var _0x118877=_0xcedf[_0x5a461b];return _0x118877;};'use strict';var client=require(_0xfced('0x0'));exports[_0xfced('0x1')]=function(_0x2b9cc7){return client['Request']('CreateFaxMessage',{'body':_0x2b9cc7,'log':_0xfced('0x2')});}; \ No newline at end of file +var _0x69b6=['../client','Request','CreateFaxMessage'];(function(_0x1f69e5,_0xb15db){var _0x2068e8=function(_0x5627fb){while(--_0x5627fb){_0x1f69e5['push'](_0x1f69e5['shift']());}};_0x2068e8(++_0xb15db);}(_0x69b6,0x195));var _0x669b=function(_0x186d17,_0x9fa8ef){_0x186d17=_0x186d17-0x0;var _0x5d4b89=_0x69b6[_0x186d17];return _0x5d4b89;};'use strict';var client=require(_0x669b('0x0'));exports['create']=function(_0x47b54e){return client[_0x669b('0x1')](_0x669b('0x2'),{'body':_0x47b54e,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 8c06f8f..75a731c 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 _0x560f=['getFaxQueues','GetFaxQueue','name','strategy','User','Agents','online','faxPause','../client'];(function(_0x19dd4c,_0x181548){var _0x13b58e=function(_0x12b466){while(--_0x12b466){_0x19dd4c['push'](_0x19dd4c['shift']());}};_0x13b58e(++_0x181548);}(_0x560f,0x74));var _0xf560=function(_0x1cf96e,_0x383742){_0x1cf96e=_0x1cf96e-0x0;var _0xc79dc7=_0x560f[_0x1cf96e];return _0xc79dc7;};'use strict';var client=require(_0xf560('0x0'));exports[_0xf560('0x1')]=function(){return function(){return client['Request'](_0xf560('0x2'),{'options':{'raw':![],'attributes':['id',_0xf560('0x3'),'timeout',_0xf560('0x4')],'include':[{'model':_0xf560('0x5'),'as':_0xf560('0x6'),'attributes':['id',_0xf560('0x3'),_0xf560('0x7'),_0xf560('0x8')]}]},'log':_0xf560('0x1')});};}; \ No newline at end of file +var _0x061a=['User','online','faxPause','../client','getFaxQueues','Request','GetFaxQueue','name','strategy'];(function(_0x151334,_0x1e11ac){var _0x3d03da=function(_0x2099cf){while(--_0x2099cf){_0x151334['push'](_0x151334['shift']());}};_0x3d03da(++_0x1e11ac);}(_0x061a,0x1d7));var _0xa061=function(_0x502cd6,_0xfabffc){_0x502cd6=_0x502cd6-0x0;var _0x32f0c5=_0x061a[_0x502cd6];return _0x32f0c5;};'use strict';var client=require(_0xa061('0x0'));exports[_0xa061('0x1')]=function(){return function(){return client[_0xa061('0x2')](_0xa061('0x3'),{'options':{'raw':![],'attributes':['id',_0xa061('0x4'),'timeout',_0xa061('0x5')],'include':[{'model':_0xa061('0x6'),'as':'Agents','attributes':['id',_0xa061('0x4'),_0xa061('0x7'),_0xa061('0x8')]}]},'log':_0xa061('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 0f8a331..a2a6e6c 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 _0x9a14=['Request','CreateFaxQueueReport','update'];(function(_0x47bc58,_0x1e1998){var _0x4a0860=function(_0x2a5b23){while(--_0x2a5b23){_0x47bc58['push'](_0x47bc58['shift']());}};_0x4a0860(++_0x1e1998);}(_0x9a14,0xa8));var _0x49a1=function(_0x188970,_0x1e51e2){_0x188970=_0x188970-0x0;var _0x134c1f=_0x9a14[_0x188970];return _0x134c1f;};'use strict';var client=require('../client');exports['create']=function(_0xece3f3){return client[_0x49a1('0x0')](_0x49a1('0x1'),{'body':_0xece3f3,'log':_0x49a1('0x1')});};exports[_0x49a1('0x2')]=function(_0x26467b,_0x10de2e){return client[_0x49a1('0x0')]('UpdateFaxQueueReport',{'body':_0x10de2e,'options':{'where':{'uniqueid':_0x26467b},'order':[['id','DESC']],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x9de1=['../client','create','Request','CreateFaxQueueReport','update','DESC','UpdateFaxQueueReport'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x9de1,0x1ea));var _0x19de=function(_0xf58665,_0x4fce09){_0xf58665=_0xf58665-0x0;var _0xbac4b=_0x9de1[_0xf58665];return _0xbac4b;};'use strict';var client=require(_0x19de('0x0'));exports[_0x19de('0x1')]=function(_0x5c52b8){return client[_0x19de('0x2')](_0x19de('0x3'),{'body':_0x5c52b8,'log':'CreateFaxQueueReport'});};exports[_0x19de('0x4')]=function(_0xa0e20d,_0x9d759d){return client[_0x19de('0x2')]('UpdateFaxQueueReport',{'body':_0x9d759d,'options':{'where':{'uniqueid':_0xa0e20d},'order':[['id',_0x19de('0x5')]],'limit':0x1},'log':_0x19de('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index c498b4e..b372df3 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 _0xdd6e=['GetInterval','Interval','Intervals','name','interval','../client','getIntervals','Request'];(function(_0x48026e,_0x2bb295){var _0x4b42aa=function(_0x42c647){while(--_0x42c647){_0x48026e['push'](_0x48026e['shift']());}};_0x4b42aa(++_0x2bb295);}(_0xdd6e,0xa5));var _0xedd6=function(_0x29b90f,_0x1f6cb5){_0x29b90f=_0x29b90f-0x0;var _0x5672d1=_0xdd6e[_0x29b90f];return _0x5672d1;};'use strict';var client=require(_0xedd6('0x0'));exports[_0xedd6('0x1')]=function(){return function(){return client[_0xedd6('0x2')](_0xedd6('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0xedd6('0x4'),'as':_0xedd6('0x5'),'attributes':['id',_0xedd6('0x6'),_0xedd6('0x7')]}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0x4fad=['../client','getIntervals','Request','name','Interval','Intervals','interval'];(function(_0x382ccd,_0x5d8a9a){var _0x311067=function(_0x3dc80d){while(--_0x3dc80d){_0x382ccd['push'](_0x382ccd['shift']());}};_0x311067(++_0x5d8a9a);}(_0x4fad,0xcb));var _0xd4fa=function(_0x1f1ea8,_0x45f535){_0x1f1ea8=_0x1f1ea8-0x0;var _0x365d02=_0x4fad[_0x1f1ea8];return _0x365d02;};'use strict';var client=require(_0xd4fa('0x0'));exports[_0xd4fa('0x1')]=function(){return function(){return client[_0xd4fa('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xd4fa('0x3')],'include':[{'model':_0xd4fa('0x4'),'as':_0xd4fa('0x5'),'attributes':['id',_0xd4fa('0x3'),_0xd4fa('0x6')]}]},'log':_0xd4fa('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 3320afa..dc8773c 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 _0x3bc1=['UpdateMailInteraction','AddTagsToMailInteraction','../client','update','Request'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x3bc1,0x7a));var _0x13bc=function(_0x22dcb7,_0x124a13){_0x22dcb7=_0x22dcb7-0x0;var _0x385622=_0x3bc1[_0x22dcb7];return _0x385622;};'use strict';var client=require(_0x13bc('0x0'));exports[_0x13bc('0x1')]=function(_0x6f611d,_0x71382){return client[_0x13bc('0x2')](_0x13bc('0x3'),{'body':_0x71382,'options':{'where':{'id':_0x6f611d}},'log':'updateMailInteraction'});};exports['addTags']=function(_0xb7c44,_0x565284){return client[_0x13bc('0x2')](_0x13bc('0x4'),{'body':_0x565284,'options':{'where':{'id':_0xb7c44}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x1d6d=['../client','Request','UpdateMailInteraction','addTags','AddTagsToMailInteraction'];(function(_0x4b54f9,_0x4940f9){var _0x1af62c=function(_0x22122e){while(--_0x22122e){_0x4b54f9['push'](_0x4b54f9['shift']());}};_0x1af62c(++_0x4940f9);}(_0x1d6d,0x78));var _0xd1d6=function(_0x4b9ed4,_0x19c89a){_0x4b9ed4=_0x4b9ed4-0x0;var _0x167ac4=_0x1d6d[_0x4b9ed4];return _0x167ac4;};'use strict';var client=require(_0xd1d6('0x0'));exports['update']=function(_0x1fda76,_0x1aad5b){return client[_0xd1d6('0x1')](_0xd1d6('0x2'),{'body':_0x1aad5b,'options':{'where':{'id':_0x1fda76}},'log':'updateMailInteraction'});};exports[_0xd1d6('0x3')]=function(_0x2a8c22,_0x11791e){return client[_0xd1d6('0x1')](_0xd1d6('0x4'),{'body':_0x11791e,'options':{'where':{'id':_0x2a8c22}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 5bbc089..6ce5baa 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 _0xff02=['Request'];(function(_0x157042,_0x5101e7){var _0x18dd54=function(_0x3ac994){while(--_0x3ac994){_0x157042['push'](_0x157042['shift']());}};_0x18dd54(++_0x5101e7);}(_0xff02,0xb4));var _0x2ff0=function(_0x14b748,_0x48ba0b){_0x14b748=_0x14b748-0x0;var _0x5f28e9=_0xff02[_0x14b748];return _0x5f28e9;};'use strict';var client=require('../client');exports['create']=function(_0x561363){return client[_0x2ff0('0x0')]('CreateMailMessage',{'body':_0x561363,'log':'createMailMessage'});}; \ No newline at end of file +var _0x7305=['Request','CreateMailMessage','createMailMessage','../client','create'];(function(_0x30d68b,_0x33d455){var _0xd9d0d0=function(_0xb8dcf6){while(--_0xb8dcf6){_0x30d68b['push'](_0x30d68b['shift']());}};_0xd9d0d0(++_0x33d455);}(_0x7305,0xee));var _0x5730=function(_0x718d1,_0x358a41){_0x718d1=_0x718d1-0x0;var _0x20697b=_0x7305[_0x718d1];return _0x20697b;};'use strict';var client=require(_0x5730('0x0'));exports[_0x5730('0x1')]=function(_0x4fc1a7){return client[_0x5730('0x2')](_0x5730('0x3'),{'body':_0x4fc1a7,'log':_0x5730('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 3eac20f..01f7c77 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 _0x27c8=['online','getMailQueues','GetMailQueue','name','timeout','Agents'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x27c8,0x1db));var _0x827c=function(_0x32aece,_0x18a8da){_0x32aece=_0x32aece-0x0;var _0x1e3683=_0x27c8[_0x32aece];return _0x1e3683;};'use strict';var client=require('../client');exports[_0x827c('0x0')]=function(){return function(){return client['Request'](_0x827c('0x1'),{'options':{'raw':![],'attributes':['id',_0x827c('0x2'),_0x827c('0x3'),'strategy'],'include':[{'model':'User','as':_0x827c('0x4'),'attributes':['id',_0x827c('0x2'),_0x827c('0x5'),'mailPause']}]},'log':_0x827c('0x0')});};}; \ No newline at end of file +var _0x5967=['timeout','strategy','User','mailPause','../client','getMailQueues','Request','name'];(function(_0xf7dd0f,_0x396c3b){var _0x3fc64b=function(_0x41adc1){while(--_0x41adc1){_0xf7dd0f['push'](_0xf7dd0f['shift']());}};_0x3fc64b(++_0x396c3b);}(_0x5967,0x7c));var _0x7596=function(_0x277552,_0x387c0f){_0x277552=_0x277552-0x0;var _0x522869=_0x5967[_0x277552];return _0x522869;};'use strict';var client=require(_0x7596('0x0'));exports[_0x7596('0x1')]=function(){return function(){return client[_0x7596('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x7596('0x3'),_0x7596('0x4'),_0x7596('0x5')],'include':[{'model':_0x7596('0x6'),'as':'Agents','attributes':['id','name','online',_0x7596('0x7')]}]},'log':_0x7596('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 621b018..1b801d0 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 _0x2b13=['DESC','../client','create','Request','CreateMailQueueReport','UpdateMailQueueReport'];(function(_0x4776f8,_0x207e21){var _0x1b5aba=function(_0x36f081){while(--_0x36f081){_0x4776f8['push'](_0x4776f8['shift']());}};_0x1b5aba(++_0x207e21);}(_0x2b13,0x1a5));var _0x32b1=function(_0x5728c8,_0xa240b4){_0x5728c8=_0x5728c8-0x0;var _0x7801a2=_0x2b13[_0x5728c8];return _0x7801a2;};'use strict';var client=require(_0x32b1('0x0'));exports[_0x32b1('0x1')]=function(_0x59bd4e){return client[_0x32b1('0x2')]('CreateMailQueueReport',{'body':_0x59bd4e,'log':_0x32b1('0x3')});};exports['update']=function(_0x5ef3de,_0x994c12){return client[_0x32b1('0x2')](_0x32b1('0x4'),{'body':_0x994c12,'options':{'where':{'uniqueid':_0x5ef3de},'order':[['id',_0x32b1('0x5')]],'limit':0x1},'log':_0x32b1('0x4')});}; \ No newline at end of file +var _0xbcf2=['UpdateMailQueueReport','../client','CreateMailQueueReport','update','Request'];(function(_0x303364,_0x2c81ed){var _0x4cc8b7=function(_0x56903e){while(--_0x56903e){_0x303364['push'](_0x303364['shift']());}};_0x4cc8b7(++_0x2c81ed);}(_0xbcf2,0x155));var _0x2bcf=function(_0x12e898,_0x1ef073){_0x12e898=_0x12e898-0x0;var _0x190631=_0xbcf2[_0x12e898];return _0x190631;};'use strict';var client=require(_0x2bcf('0x0'));exports['create']=function(_0x4dbfd4){return client['Request'](_0x2bcf('0x1'),{'body':_0x4dbfd4,'log':_0x2bcf('0x1')});};exports[_0x2bcf('0x2')]=function(_0x37410c,_0x378fb4){return client[_0x2bcf('0x3')](_0x2bcf('0x4'),{'body':_0x378fb4,'options':{'where':{'uniqueid':_0x37410c},'order':[['id','DESC']],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 32b35b3..a4ff9f9 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 _0xc313=['updateOpenchannelInteraction','addTags','Request','addTagsToChatInteraction','../client','update','UpdateOpenchannelInteraction'];(function(_0x4d3526,_0x2e3181){var _0x5ef3d5=function(_0x45f068){while(--_0x45f068){_0x4d3526['push'](_0x4d3526['shift']());}};_0x5ef3d5(++_0x2e3181);}(_0xc313,0x17e));var _0x3c31=function(_0x2ddd2f,_0x3430aa){_0x2ddd2f=_0x2ddd2f-0x0;var _0x231908=_0xc313[_0x2ddd2f];return _0x231908;};'use strict';var client=require(_0x3c31('0x0'));exports[_0x3c31('0x1')]=function(_0x5b3269,_0x95d259){return client['Request'](_0x3c31('0x2'),{'body':_0x95d259,'options':{'where':{'id':_0x5b3269}},'log':_0x3c31('0x3')});};exports[_0x3c31('0x4')]=function(_0x29009d,_0x31e249){return client[_0x3c31('0x5')]('AddTagsToOpenchannelInteraction',{'body':_0x31e249,'options':{'where':{'id':_0x29009d}},'log':_0x3c31('0x6')});}; \ No newline at end of file +var _0x670c=['Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x670c,0x186));var _0xc670=function(_0x4a0201,_0x136199){_0x4a0201=_0x4a0201-0x0;var _0x1c119b=_0x670c[_0x4a0201];return _0x1c119b;};'use strict';var client=require('../client');exports['update']=function(_0x4fbf81,_0xabd90a){return client[_0xc670('0x0')](_0xc670('0x1'),{'body':_0xabd90a,'options':{'where':{'id':_0x4fbf81}},'log':_0xc670('0x2')});};exports['addTags']=function(_0xa00d49,_0x595d8a){return client[_0xc670('0x0')](_0xc670('0x3'),{'body':_0x595d8a,'options':{'where':{'id':_0xa00d49}},'log':_0xc670('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 329951e..41fb400 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 _0xb43b=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb43b,0x1b2));var _0xbb43=function(_0x2969f3,_0x33aedb){_0x2969f3=_0x2969f3-0x0;var _0x292c7b=_0xb43b[_0x2969f3];return _0x292c7b;};'use strict';var client=require(_0xbb43('0x0'));exports[_0xbb43('0x1')]=function(_0x5c45dd){return client[_0xbb43('0x2')](_0xbb43('0x3'),{'body':_0x5c45dd,'log':_0xbb43('0x4')});}; \ No newline at end of file +var _0x750a=['CreateOpenchannelMessage','createOpenchannelMessage','create'];(function(_0x55d143,_0x4836e2){var _0x29c2f7=function(_0xa65606){while(--_0xa65606){_0x55d143['push'](_0x55d143['shift']());}};_0x29c2f7(++_0x4836e2);}(_0x750a,0x140));var _0xa750=function(_0x53416b,_0x498071){_0x53416b=_0x53416b-0x0;var _0x4f38d5=_0x750a[_0x53416b];return _0x4f38d5;};'use strict';var client=require('../client');exports[_0xa750('0x0')]=function(_0x5368b2){return client['Request'](_0xa750('0x1'),{'body':_0x5368b2,'log':_0xa750('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 62e4a8f..c680d62 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 _0x7356=['GetOpenchannelQueue','name','timeout','strategy','User','openchannelPause','Request'];(function(_0x1ed010,_0x734e0b){var _0x6e22bf=function(_0x1ffe15){while(--_0x1ffe15){_0x1ed010['push'](_0x1ed010['shift']());}};_0x6e22bf(++_0x734e0b);}(_0x7356,0x15d));var _0x6735=function(_0x40783f,_0x3d6472){_0x40783f=_0x40783f-0x0;var _0x4fc23a=_0x7356[_0x40783f];return _0x4fc23a;};'use strict';var client=require('../client');exports['getOpenchannelQueues']=function(){return function(){return client[_0x6735('0x0')](_0x6735('0x1'),{'options':{'raw':![],'attributes':['id',_0x6735('0x2'),_0x6735('0x3'),_0x6735('0x4')],'include':[{'model':_0x6735('0x5'),'as':'Agents','attributes':['id','name','online',_0x6735('0x6')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0x765d=['openchannelPause','../client','getOpenchannelQueues','name','timeout','strategy','User','Agents','online'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x765d,0x172));var _0xd765=function(_0x5d95ba,_0x4f4d5d){_0x5d95ba=_0x5d95ba-0x0;var _0x375929=_0x765d[_0x5d95ba];return _0x375929;};'use strict';var client=require(_0xd765('0x0'));exports[_0xd765('0x1')]=function(){return function(){return client['Request']('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0xd765('0x2'),_0xd765('0x3'),_0xd765('0x4')],'include':[{'model':_0xd765('0x5'),'as':_0xd765('0x6'),'attributes':['id',_0xd765('0x2'),_0xd765('0x7'),_0xd765('0x8')]}]},'log':_0xd765('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 9fd5cc9..6022dd9 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 _0xa5f7=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa5f7,0xec));var _0x7a5f=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xa5f7[_0x5f09c5];return _0x426ad9;};'use strict';var client=require(_0x7a5f('0x0'));exports[_0x7a5f('0x1')]=function(_0x4f7995){return client[_0x7a5f('0x2')](_0x7a5f('0x3'),{'body':_0x4f7995,'log':_0x7a5f('0x3')});};exports[_0x7a5f('0x4')]=function(_0x41976d,_0x5d6a2d){return client[_0x7a5f('0x2')](_0x7a5f('0x5'),{'body':_0x5d6a2d,'options':{'where':{'uniqueid':_0x41976d},'order':[['id',_0x7a5f('0x6')]],'limit':0x1},'log':_0x7a5f('0x5')});}; \ No newline at end of file +var _0x0e2d=['UpdateOpenchannelQueueReport','DESC','create','Request','CreateOpenchannelQueueReport'];(function(_0x45de74,_0x10fab9){var _0x59482c=function(_0x3bc7c2){while(--_0x3bc7c2){_0x45de74['push'](_0x45de74['shift']());}};_0x59482c(++_0x10fab9);}(_0x0e2d,0x101));var _0xd0e2=function(_0x13e17d,_0x37dd2c){_0x13e17d=_0x13e17d-0x0;var _0x408221=_0x0e2d[_0x13e17d];return _0x408221;};'use strict';var client=require('../client');exports[_0xd0e2('0x0')]=function(_0x22684c){return client[_0xd0e2('0x1')](_0xd0e2('0x2'),{'body':_0x22684c,'log':'CreateOpenchannelQueueReport'});};exports['update']=function(_0x3aedad,_0x293fb2){return client[_0xd0e2('0x1')](_0xd0e2('0x3'),{'body':_0x293fb2,'options':{'where':{'uniqueid':_0x3aedad},'order':[['id',_0xd0e2('0x4')]],'limit':0x1},'log':_0xd0e2('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 22059c6..4917343 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 _0x63eb=['updateSmsInteraction','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request'];(function(_0x25f184,_0xad0573){var _0x39feaa=function(_0x3d2a01){while(--_0x3d2a01){_0x25f184['push'](_0x25f184['shift']());}};_0x39feaa(++_0xad0573);}(_0x63eb,0x195));var _0xb63e=function(_0x4d9f51,_0x2c2a44){_0x4d9f51=_0x4d9f51-0x0;var _0x26b34c=_0x63eb[_0x4d9f51];return _0x26b34c;};'use strict';var client=require(_0xb63e('0x0'));exports[_0xb63e('0x1')]=function(_0x11139c,_0x43fd16){return client[_0xb63e('0x2')]('UpdateSmsInteraction',{'body':_0x43fd16,'options':{'where':{'id':_0x11139c}},'log':_0xb63e('0x3')});};exports['addTags']=function(_0x1994f6,_0x455b0d){return client[_0xb63e('0x2')](_0xb63e('0x4'),{'body':_0x455b0d,'options':{'where':{'id':_0x1994f6}},'log':_0xb63e('0x5')});}; \ No newline at end of file +var _0x6a26=['UpdateSmsInteraction','addTags','Request','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update'];(function(_0x2b6828,_0x39b8dd){var _0x11a072=function(_0x5b3d4a){while(--_0x5b3d4a){_0x2b6828['push'](_0x2b6828['shift']());}};_0x11a072(++_0x39b8dd);}(_0x6a26,0xa6));var _0x66a2=function(_0x3262b0,_0x40f575){_0x3262b0=_0x3262b0-0x0;var _0x3e9d0c=_0x6a26[_0x3262b0];return _0x3e9d0c;};'use strict';var client=require(_0x66a2('0x0'));exports[_0x66a2('0x1')]=function(_0x263320,_0xeb22e7){return client['Request'](_0x66a2('0x2'),{'body':_0xeb22e7,'options':{'where':{'id':_0x263320}},'log':'updateSmsInteraction'});};exports[_0x66a2('0x3')]=function(_0x21578b,_0xf8cdcb){return client[_0x66a2('0x4')](_0x66a2('0x5'),{'body':_0xf8cdcb,'options':{'where':{'id':_0x21578b}},'log':_0x66a2('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 007a047..8bf1f4b 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 _0x8e4c=['createSmsMessage','create','Request','CreateSmsMessage'];(function(_0x18307e,_0x1898e8){var _0x24186b=function(_0x5ee12b){while(--_0x5ee12b){_0x18307e['push'](_0x18307e['shift']());}};_0x24186b(++_0x1898e8);}(_0x8e4c,0x69));var _0xc8e4=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x8e4c[_0x16b9ed];return _0x66b1f8;};'use strict';var client=require('../client');exports[_0xc8e4('0x0')]=function(_0x24efb4){return client[_0xc8e4('0x1')](_0xc8e4('0x2'),{'body':_0x24efb4,'log':_0xc8e4('0x3')});}; \ No newline at end of file +var _0xf031=['createSmsMessage','../client','Request'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xf031,0x8e));var _0x1f03=function(_0x4c027f,_0x2a99d9){_0x4c027f=_0x4c027f-0x0;var _0x4d8a97=_0xf031[_0x4c027f];return _0x4d8a97;};'use strict';var client=require(_0x1f03('0x0'));exports['create']=function(_0x322c17){return client[_0x1f03('0x1')]('CreateSmsMessage',{'body':_0x322c17,'log':_0x1f03('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 2ba5c3b..e0556ae 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 _0x102c=['name','strategy','Agents','smsPause','../client','getSmsQueues','Request'];(function(_0x2566a8,_0x5cfd02){var _0x12ea51=function(_0x4a1db6){while(--_0x4a1db6){_0x2566a8['push'](_0x2566a8['shift']());}};_0x12ea51(++_0x5cfd02);}(_0x102c,0xf9));var _0xc102=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0x102c[_0x266618];return _0x54dbf5;};'use strict';var client=require(_0xc102('0x0'));exports[_0xc102('0x1')]=function(){return function(){return client[_0xc102('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0xc102('0x3'),'timeout',_0xc102('0x4')],'include':[{'model':'User','as':_0xc102('0x5'),'attributes':['id',_0xc102('0x3'),'online',_0xc102('0x6')]}]},'log':_0xc102('0x1')});};}; \ No newline at end of file +var _0xdf97=['GetSmsQueue','name','timeout','User','online','getSmsQueues','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdf97,0x11d));var _0x7df9=function(_0x4eae66,_0x1c6bf4){_0x4eae66=_0x4eae66-0x0;var _0x1aa0ec=_0xdf97[_0x4eae66];return _0x1aa0ec;};'use strict';var client=require('../client');exports[_0x7df9('0x0')]=function(){return function(){return client[_0x7df9('0x1')](_0x7df9('0x2'),{'options':{'raw':![],'attributes':['id',_0x7df9('0x3'),_0x7df9('0x4'),'strategy'],'include':[{'model':_0x7df9('0x5'),'as':'Agents','attributes':['id','name',_0x7df9('0x6'),'smsPause']}]},'log':_0x7df9('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 22b3d25..e8b4eeb 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 _0x83e4=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x83e4,0x137));var _0x483e=function(_0x4193b3,_0x2e3447){_0x4193b3=_0x4193b3-0x0;var _0xce194d=_0x83e4[_0x4193b3];return _0xce194d;};'use strict';var client=require(_0x483e('0x0'));exports[_0x483e('0x1')]=function(_0x4ac0b3){return client[_0x483e('0x2')](_0x483e('0x3'),{'body':_0x4ac0b3,'log':_0x483e('0x3')});};exports[_0x483e('0x4')]=function(_0x24804c,_0x5d1fe3){return client[_0x483e('0x2')](_0x483e('0x5'),{'body':_0x5d1fe3,'options':{'where':{'uniqueid':_0x24804c},'order':[['id','DESC']],'limit':0x1},'log':_0x483e('0x5')});}; \ No newline at end of file +var _0xe600=['CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','create','Request'];(function(_0x105c83,_0xc5dfdb){var _0x244003=function(_0x7b63fc){while(--_0x7b63fc){_0x105c83['push'](_0x105c83['shift']());}};_0x244003(++_0xc5dfdb);}(_0xe600,0x160));var _0x0e60=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe600[_0x122ef9];return _0x42fba0;};'use strict';var client=require('../client');exports[_0x0e60('0x0')]=function(_0x42c04e){return client[_0x0e60('0x1')](_0x0e60('0x2'),{'body':_0x42c04e,'log':_0x0e60('0x2')});};exports[_0x0e60('0x3')]=function(_0x4c4dfb,_0x52b412){return client[_0x0e60('0x1')](_0x0e60('0x4'),{'body':_0x52b412,'options':{'where':{'uniqueid':_0x4c4dfb},'order':[['id',_0x0e60('0x5')]],'limit':0x1},'log':_0x0e60('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 6c9c428..32e44fd 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 _0x59a3=['online','faxPause','smsPause','openchannelPause','chatCapacity','mailCapacity','faxCapacity','whatsappCapacity','openchannelCapacity','../client','getAgents','Request','agent'];(function(_0x4decae,_0x140515){var _0x1fc6b5=function(_0x946925){while(--_0x946925){_0x4decae['push'](_0x4decae['shift']());}};_0x1fc6b5(++_0x140515);}(_0x59a3,0x18f));var _0x359a=function(_0x1c2c76,_0x341779){_0x1c2c76=_0x1c2c76-0x0;var _0x2e5751=_0x59a3[_0x1c2c76];return _0x2e5751;};'use strict';var client=require(_0x359a('0x0'));exports[_0x359a('0x1')]=function(){return function(){return client[_0x359a('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':_0x359a('0x3')},'attributes':['id','name',_0x359a('0x4'),'pauseType','lastPauseAt','voicePause','chatPause','mailPause',_0x359a('0x5'),_0x359a('0x6'),'whatsappPause',_0x359a('0x7'),_0x359a('0x8'),_0x359a('0x9'),_0x359a('0xa'),'smsCapacity',_0x359a('0xb'),_0x359a('0xc')]},'log':_0x359a('0x1')});};}; \ No newline at end of file +var _0x819c=['smsCapacity','whatsappCapacity','openchannelCapacity','getAgents','name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','faxPause','smsPause','whatsappPause','openchannelPause','mailCapacity'];(function(_0xe5f5d0,_0x4426dd){var _0xeecc9d=function(_0x5d42f2){while(--_0x5d42f2){_0xe5f5d0['push'](_0xe5f5d0['shift']());}};_0xeecc9d(++_0x4426dd);}(_0x819c,0xb8));var _0xc819=function(_0x4dca0b,_0x38e32d){_0x4dca0b=_0x4dca0b-0x0;var _0xc5cb1a=_0x819c[_0x4dca0b];return _0xc5cb1a;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0xc819('0x0'),'online',_0xc819('0x1'),_0xc819('0x2'),_0xc819('0x3'),_0xc819('0x4'),_0xc819('0x5'),_0xc819('0x6'),_0xc819('0x7'),_0xc819('0x8'),_0xc819('0x9'),'chatCapacity',_0xc819('0xa'),'faxCapacity',_0xc819('0xb'),_0xc819('0xc'),_0xc819('0xd')]},'log':_0xc819('0xe')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 7ee9c86..6209b3f 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 _0x9658=['addTagsToWhatsappInteraction','../client','UpdateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction'];(function(_0x2d9196,_0x26f48d){var _0x4002e3=function(_0x583174){while(--_0x583174){_0x2d9196['push'](_0x2d9196['shift']());}};_0x4002e3(++_0x26f48d);}(_0x9658,0x6f));var _0x8965=function(_0x59342a,_0x16827b){_0x59342a=_0x59342a-0x0;var _0x17abc9=_0x9658[_0x59342a];return _0x17abc9;};'use strict';var client=require(_0x8965('0x0'));exports['update']=function(_0x1f5bb6,_0xa89576){return client['Request'](_0x8965('0x1'),{'body':_0xa89576,'options':{'where':{'id':_0x1f5bb6}},'log':'updateWhatsappInteraction'});};exports[_0x8965('0x2')]=function(_0x761b45,_0x254d05){return client['Request'](_0x8965('0x3'),{'body':_0x254d05,'options':{'where':{'id':_0x761b45}},'log':_0x8965('0x4')});}; \ No newline at end of file +var _0x2a3a=['addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request'];(function(_0x3a70b4,_0x3b8ade){var _0x28d557=function(_0x85b05a){while(--_0x85b05a){_0x3a70b4['push'](_0x3a70b4['shift']());}};_0x28d557(++_0x3b8ade);}(_0x2a3a,0x1bf));var _0xa2a3=function(_0x49211a,_0x54261d){_0x49211a=_0x49211a-0x0;var _0xf6caf=_0x2a3a[_0x49211a];return _0xf6caf;};'use strict';var client=require(_0xa2a3('0x0'));exports[_0xa2a3('0x1')]=function(_0x24c012,_0x1733b1){return client[_0xa2a3('0x2')]('UpdateWhatsappInteraction',{'body':_0x1733b1,'options':{'where':{'id':_0x24c012}},'log':'updateWhatsappInteraction'});};exports[_0xa2a3('0x3')]=function(_0x34d7f9,_0x1e61b2){return client[_0xa2a3('0x2')](_0xa2a3('0x4'),{'body':_0x1e61b2,'options':{'where':{'id':_0x34d7f9}},'log':_0xa2a3('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 647c4fb..fefee7d 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 _0xe677=['createWhatsappMessage','../client','create'];(function(_0x331348,_0x3bfceb){var _0x47705c=function(_0x3f6c48){while(--_0x3f6c48){_0x331348['push'](_0x331348['shift']());}};_0x47705c(++_0x3bfceb);}(_0xe677,0x11b));var _0x7e67=function(_0x4bc65f,_0x39ec43){_0x4bc65f=_0x4bc65f-0x0;var _0x44f85f=_0xe677[_0x4bc65f];return _0x44f85f;};'use strict';var client=require(_0x7e67('0x0'));exports[_0x7e67('0x1')]=function(_0x32f36e){return client['Request']('CreateWhatsappMessage',{'body':_0x32f36e,'log':_0x7e67('0x2')});}; \ No newline at end of file +var _0x914a=['../client','Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x5d7d23,_0x2c60a7){var _0x26fc67=function(_0x50f9bf){while(--_0x50f9bf){_0x5d7d23['push'](_0x5d7d23['shift']());}};_0x26fc67(++_0x2c60a7);}(_0x914a,0x84));var _0xa914=function(_0x205e5a,_0x5c19fb){_0x205e5a=_0x205e5a-0x0;var _0x10da58=_0x914a[_0x205e5a];return _0x10da58;};'use strict';var client=require(_0xa914('0x0'));exports['create']=function(_0x3b9ab5){return client[_0xa914('0x1')](_0xa914('0x2'),{'body':_0x3b9ab5,'log':_0xa914('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 53c7bae..0b7b7ff 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 _0x63a5=['getWhatsappQueues','Request','name','strategy','User','Agents','../client'];(function(_0x19a7d3,_0x487155){var _0x569a8e=function(_0x456e99){while(--_0x456e99){_0x19a7d3['push'](_0x19a7d3['shift']());}};_0x569a8e(++_0x487155);}(_0x63a5,0x18e));var _0x563a=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x63a5[_0x5f1391];return _0x50ebe3;};'use strict';var client=require(_0x563a('0x0'));exports[_0x563a('0x1')]=function(){return function(){return client[_0x563a('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x563a('0x3'),'timeout',_0x563a('0x4')],'include':[{'model':_0x563a('0x5'),'as':_0x563a('0x6'),'attributes':['id',_0x563a('0x3'),'online','whatsappPause']}]},'log':_0x563a('0x1')});};}; \ No newline at end of file +var _0x823c=['online','whatsappPause','getWhatsappQueues','../client','Request','GetWhatsappQueue','name','timeout','strategy','User'];(function(_0x56b15a,_0x138c38){var _0x150681=function(_0x50176e){while(--_0x50176e){_0x56b15a['push'](_0x56b15a['shift']());}};_0x150681(++_0x138c38);}(_0x823c,0x143));var _0xc823=function(_0x4a1f03,_0x1fdc06){_0x4a1f03=_0x4a1f03-0x0;var _0x39519c=_0x823c[_0x4a1f03];return _0x39519c;};'use strict';var client=require(_0xc823('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0xc823('0x1')](_0xc823('0x2'),{'options':{'raw':![],'attributes':['id',_0xc823('0x3'),_0xc823('0x4'),_0xc823('0x5')],'include':[{'model':_0xc823('0x6'),'as':'Agents','attributes':['id',_0xc823('0x3'),_0xc823('0x7'),_0xc823('0x8')]}]},'log':_0xc823('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index c8010bc..13733b4 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 _0x4f69=['DESC','UpdateWhatsappQueueReport','../client','create','Request','CreateWhatsappQueueReport','update'];(function(_0x260e9f,_0x5790ca){var _0x2e799e=function(_0x204d2c){while(--_0x204d2c){_0x260e9f['push'](_0x260e9f['shift']());}};_0x2e799e(++_0x5790ca);}(_0x4f69,0x1c2));var _0x94f6=function(_0x54fea7,_0x33e39c){_0x54fea7=_0x54fea7-0x0;var _0x502ed1=_0x4f69[_0x54fea7];return _0x502ed1;};'use strict';var client=require(_0x94f6('0x0'));exports[_0x94f6('0x1')]=function(_0x2ebef3){return client[_0x94f6('0x2')](_0x94f6('0x3'),{'body':_0x2ebef3,'log':'CreateWhatsappQueueReport'});};exports[_0x94f6('0x4')]=function(_0x2c0f4d,_0x53fe89){return client[_0x94f6('0x2')]('UpdateWhatsappQueueReport',{'body':_0x53fe89,'options':{'where':{'uniqueid':_0x2c0f4d},'order':[['id',_0x94f6('0x5')]],'limit':0x1},'log':_0x94f6('0x6')});}; \ No newline at end of file +var _0xffb6=['update','UpdateWhatsappQueueReport','DESC','create','Request','CreateWhatsappQueueReport'];(function(_0x586fa2,_0x1a45bc){var _0x515be9=function(_0x4e90d5){while(--_0x4e90d5){_0x586fa2['push'](_0x586fa2['shift']());}};_0x515be9(++_0x1a45bc);}(_0xffb6,0xdb));var _0x6ffb=function(_0x4e2f77,_0xe54348){_0x4e2f77=_0x4e2f77-0x0;var _0x47ca41=_0xffb6[_0x4e2f77];return _0x47ca41;};'use strict';var client=require('../client');exports[_0x6ffb('0x0')]=function(_0x4e1d12){return client[_0x6ffb('0x1')](_0x6ffb('0x2'),{'body':_0x4e1d12,'log':_0x6ffb('0x2')});};exports[_0x6ffb('0x3')]=function(_0x4f48dd,_0x39e470){return client[_0x6ffb('0x1')](_0x6ffb('0x4'),{'body':_0x39e470,'options':{'where':{'uniqueid':_0x4f48dd},'order':[['id',_0x6ffb('0x5')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ 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 4947df1..b2c84ce 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 _0x218c=['channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','error','log','[%s][QUEUE]\x20%s','validate','lodash','util','seq-queue','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','consequence','length','map','message','join','stop','find','agents','timeout','createQueue','atimeout'];(function(_0x1f6b07,_0x29b3f5){var _0x41fd7c=function(_0x13ef39){while(--_0x13ef39){_0x1f6b07['push'](_0x1f6b07['shift']());}};_0x41fd7c(++_0x29b3f5);}(_0x218c,0x1ee));var _0xc218=function(_0x235f49,_0x2992b4){_0x235f49=_0x235f49-0x0;var _0x551139=_0x218c[_0x235f49];return _0x551139;};'use strict';var schema=require(_0xc218('0x0'));var _=require(_0xc218('0x1'));var util=require(_0xc218('0x2'));var seqqueue=require(_0xc218('0x3'));var logger=require('../../../../config/logger')(_0xc218('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0xc218('0x5'),'required':!![],'message':_0xc218('0x6')},'timeout':{'type':_0xc218('0x7'),'message':_0xc218('0x8')}});function writeLog(_0x568779,_0x1f1baa,_0xc5251){return logger[_0xc218('0x9')](util[_0xc218('0xa')](_0xc218('0xb'),_0x568779,_0x1f1baa[_0xc218('0xc')],_0xc5251));}function handleFindAgent(_0x3ed954){return function(_0x23a390){return _0x23a390[_0xc218('0xc')]['toLowerCase']()===_0x3ed954['toLowerCase']();};}exports[_0xc218('0xd')]=function(_0x24716b,_0x47252c,_0x1a68b2,_0x38bcab){return function(_0x47ff62){try{var _0x52ef10={'name':_0x47252c[0x0],'timeout':_0x47252c[0x1]};var _0x44023b=queue['validate'](_0x52ef10,{'typecast':!![]});if(_0x44023b[_0xc218('0xe')]){logger['error']('[%s][AGENT]\x20%s',_0x24716b,_[_0xc218('0xf')](_0x44023b,_0xc218('0x10'))[_0xc218('0x11')](',\x20'));_0x47ff62[_0xc218('0x12')]();}else{var _0x5816be=_[_0xc218('0x13')](_0x1a68b2[_0xc218('0x14')],handleFindAgent(_0x52ef10[_0xc218('0xc')]));if(_0x5816be){var _0x4f6f68=(_0x52ef10[_0xc218('0x15')]||0xa)*0x3e8;var _0x361dbc,_0x344be6;var _0x44e246=seqqueue[_0xc218('0x16')](_0x4f6f68);_0x44e246['id']=_0x24716b;_0x44e246[_0xc218('0x17')]=_0x4f6f68;_0x44e246['channel']=_0x38bcab[_0xc218('0x18')];writeLog(_0x24716b,_0x5816be,util[_0xc218('0xa')](_0xc218('0x19'),_0x4f6f68));_0x1a68b2[_0xc218('0x1a')][_0x24716b]['on'](_0xc218('0x1b'),function(){logger['info'](_0xc218('0x1c'),_0x24716b);clearTimeout(_0x344be6);_0x344be6=undefined;_0x44e246[_0xc218('0x1d')]();if(_0x1a68b2[_0xc218('0x1a')][_0x24716b]){delete _0x1a68b2[_0xc218('0x1a')][_0x24716b];}_0x47ff62[_0xc218('0x12')]();});_0x1a68b2[_0xc218('0x1a')][_0x24716b]['on'](_0xc218('0x1e'),function(){if(_0x1a68b2[_0xc218('0x1a')][_0x24716b]){delete _0x1a68b2[_0xc218('0x1a')][_0x24716b];}});_0x344be6=setTimeout(function(){logger['info'](_0xc218('0x1f'),_0x24716b);clearTimeout(_0x344be6);_0x44e246[_0xc218('0x1d')]();_0x47ff62[_0xc218('0x20')]();},_0x4f6f68);strategy[_0xc218('0x21')](_0x44e246,_0x5816be,_0x1a68b2,_0x38bcab);}else{logger[_0xc218('0x22')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x24716b,_0x52ef10[_0xc218('0xc')]);_0x47ff62['stop']();}}}catch(_0x302621){console[_0xc218('0x23')](_0x302621);logger[_0xc218('0x22')](_0xc218('0x24'),_0x24716b,_0x302621['stack']);_0x47ff62[_0xc218('0x12')]();}};}; \ No newline at end of file +var _0x214a=['START:%s','close','rules','complete','[%s][AGENT]\x20ROUTING\x20END','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','stop','log','stack','lodash','util','seq-queue','../../../../config/logger','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','consequence','validate','length','[%s][AGENT]\x20%s','map','message','agents','timeout','atimeout','channel'];(function(_0x1ae98a,_0x1303d8){var _0x20e36e=function(_0x4e4bf7){while(--_0x4e4bf7){_0x1ae98a['push'](_0x1ae98a['shift']());}};_0x20e36e(++_0x1303d8);}(_0x214a,0x121));var _0xa214=function(_0xf6e76c,_0x15c0ce){_0xf6e76c=_0xf6e76c-0x0;var _0x4243d0=_0x214a[_0xf6e76c];return _0x4243d0;};'use strict';var schema=require('validate');var _=require(_0xa214('0x0'));var util=require(_0xa214('0x1'));var seqqueue=require(_0xa214('0x2'));var logger=require(_0xa214('0x3'))('routing');var strategy=require(_0xa214('0x4'));var queue=schema({'name':{'type':_0xa214('0x5'),'required':!![],'message':_0xa214('0x6')},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x351e68,_0x335664,_0x1c3d22){return logger[_0xa214('0x7')](util[_0xa214('0x8')](_0xa214('0x9'),_0x351e68,_0x335664[_0xa214('0xa')],_0x1c3d22));}function handleFindAgent(_0x12ffbb){return function(_0x3ede50){return _0x3ede50[_0xa214('0xa')]['toLowerCase']()===_0x12ffbb['toLowerCase']();};}exports[_0xa214('0xb')]=function(_0x57ac68,_0x44ddc4,_0x1da1fb,_0x479775){return function(_0x493dcd){try{var _0xa33ca4={'name':_0x44ddc4[0x0],'timeout':_0x44ddc4[0x1]};var _0xb60303=queue[_0xa214('0xc')](_0xa33ca4,{'typecast':!![]});if(_0xb60303[_0xa214('0xd')]){logger['error'](_0xa214('0xe'),_0x57ac68,_[_0xa214('0xf')](_0xb60303,_0xa214('0x10'))['join'](',\x20'));_0x493dcd['stop']();}else{var _0x204193=_['find'](_0x1da1fb[_0xa214('0x11')],handleFindAgent(_0xa33ca4['name']));if(_0x204193){var _0x1eb585=(_0xa33ca4[_0xa214('0x12')]||0xa)*0x3e8;var _0x28f533,_0x3f846d;var _0x256ef2=seqqueue['createQueue'](_0x1eb585);_0x256ef2['id']=_0x57ac68;_0x256ef2[_0xa214('0x13')]=_0x1eb585;_0x256ef2[_0xa214('0x14')]=_0x479775['channel'];writeLog(_0x57ac68,_0x204193,util[_0xa214('0x8')](_0xa214('0x15'),_0x1eb585));_0x1da1fb['rules'][_0x57ac68]['on']('end',function(){logger[_0xa214('0x7')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x57ac68);clearTimeout(_0x3f846d);_0x3f846d=undefined;_0x256ef2[_0xa214('0x16')]();if(_0x1da1fb[_0xa214('0x17')][_0x57ac68]){delete _0x1da1fb[_0xa214('0x17')][_0x57ac68];}_0x493dcd['stop']();});_0x1da1fb[_0xa214('0x17')][_0x57ac68]['on'](_0xa214('0x18'),function(){if(_0x1da1fb[_0xa214('0x17')][_0x57ac68]){delete _0x1da1fb['rules'][_0x57ac68];}});_0x3f846d=setTimeout(function(){logger[_0xa214('0x7')](_0xa214('0x19'),_0x57ac68);clearTimeout(_0x3f846d);_0x256ef2[_0xa214('0x16')]();_0x493dcd['next']();},_0x1eb585);strategy[_0xa214('0x1a')](_0x256ef2,_0x204193,_0x1da1fb,_0x479775);}else{logger['error'](_0xa214('0x1b'),_0x57ac68,_0xa33ca4[_0xa214('0xa')]);_0x493dcd[_0xa214('0x1c')]();}}}catch(_0x5073ea){console[_0xa214('0x1d')](_0x5073ea);logger['error']('[%s][QUEUE]\x20%s',_0x57ac68,_0x5073ea[_0xa214('0x1e')]);_0x493dcd[_0xa214('0x1c')]();}};}; \ 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 a361e4c..e722400 100644 --- a/server/services/routing/server/applications/amazonlex.js +++ b/server/services/routing/server/applications/amazonlex.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda19=['../../rpc/whatsappMessage','consequence','isNil','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','account','AccountId','upperFirst','InteractionId','isEmpty','getMustacheRender','Message','create','then','[%s][AMAZONLEX]\x20%s','body','catch','error','info','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','next','amazonlex','dialogState','Failed','stringify','moment','aws-sdk','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage'];(function(_0x57504a,_0x355841){var _0x274712=function(_0xd6b759){while(--_0xd6b759){_0x57504a['push'](_0x57504a['shift']());}};_0x274712(++_0x355841);}(_0xda19,0xd5));var _0x9da1=function(_0x34f0fb,_0x3c78b7){_0x34f0fb=_0x34f0fb-0x0;var _0x35789e=_0xda19[_0x34f0fb];return _0x35789e;};'use strict';var _=require('lodash');var moment=require(_0x9da1('0x0'));var AWS=require(_0x9da1('0x1'));var utils=require('./utils');var logger=require(_0x9da1('0x2'))('routing');var rpc={'chatMessage':require(_0x9da1('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x9da1('0x4')),'smsMessage':require(_0x9da1('0x5')),'faxMessage':require(_0x9da1('0x6')),'whatsappMessage':require(_0x9da1('0x7'))};exports[_0x9da1('0x8')]=function(_0x2dcbc6,_0x23e4f7){return function(_0x2c3cdd){try{if(!_[_0x9da1('0x9')](this[_0x9da1('0xa')]['UserId'])){logger['info']('[%s][AMAZONLEX]\x20%s',_0x2dcbc6,_0x9da1('0xb'));return _0x2c3cdd['next']();}var _0x33cfe5={'ContactId':this[_0x9da1('0xc')]['id'],'sentAt':moment()[_0x9da1('0xd')](_0x9da1('0xe')),'direction':_0x9da1('0xf')};var _0x396e23=this[_0x9da1('0x10')];if(_0x396e23==='chat'){_0x33cfe5['ChatWebsiteId']=this[_0x9da1('0x11')]['id'];}else{_0x33cfe5[_['upperFirst'](_0x396e23)+_0x9da1('0x12')]=this[_0x9da1('0x11')]['id'];}_0x33cfe5[_[_0x9da1('0x13')](_0x396e23)+_0x9da1('0x14')]=this['interaction']['id'];if(this[_0x9da1('0xa')]['created']){var _0x4d17e1=_0x23e4f7[0x4];if(!_[_0x9da1('0x15')](_0x4d17e1)){_0x33cfe5['body']=utils[_0x9da1('0x16')](_0x4d17e1,this);return rpc[_0x396e23+_0x9da1('0x17')][_0x9da1('0x18')](_0x33cfe5)[_0x9da1('0x19')](function(_0x7f1a64){logger['info'](_0x9da1('0x1a'),_0x2dcbc6,_0x33cfe5[_0x9da1('0x1b')]);})[_0x9da1('0x1c')](function(_0x77347a){logger[_0x9da1('0x1d')](_0x9da1('0x1a'),_0x2dcbc6,JSON['stringify'](_0x77347a));})['finally'](function(){logger[_0x9da1('0x1e')](_0x9da1('0x1f'),_0x2dcbc6);_0x2c3cdd[_0x9da1('0x20')]();});}else{logger[_0x9da1('0x1e')](_0x9da1('0x21'),_0x2dcbc6);_0x2c3cdd[_0x9da1('0x20')]();}}else{var _0xe56279=this;var _0x47e5cf=new AWS[(_0x9da1('0x22'))]({'accessKeyId':_0x23e4f7[0x0],'secretAccessKey':_0x23e4f7[0x1],'region':_0x23e4f7[0x2]});var _0x554845={'botAlias':_0x9da1('0x23'),'botName':_0x23e4f7[0x3],'inputText':this[_0x9da1('0x24')][_0x9da1('0x1b')],'userId':this['channel']+':'+this['interaction']['id'][_0x9da1('0x25')]()};_0x47e5cf[_0x9da1('0x26')](_0x554845,function(_0x16ee0c,_0x330219){if(_0x16ee0c){logger[_0x9da1('0x1d')](_0x9da1('0x1a'),_0x2dcbc6,_0x16ee0c['message']);_0x2c3cdd[_0x9da1('0x27')]();}else if(_0x330219&&_0x330219[_0x9da1('0x24')]){_0xe56279['body'][_0x9da1('0x28')]=_0x330219;_0x33cfe5[_0x9da1('0x1b')]=_0x330219['message'];return rpc[_0x396e23+_0x9da1('0x17')][_0x9da1('0x18')](_0x33cfe5)['then'](function(_0x36b87a){logger[_0x9da1('0x1e')]('[%s][AMAZONLEX]\x20%s',_0x2dcbc6,_0x33cfe5['body']);if(_0x330219[_0x9da1('0x29')]==_0x9da1('0x2a')){_0x2c3cdd['next']();}else{_0x2c3cdd[_0x9da1('0x20')]();}})['catch'](function(_0x5a6f2d){logger['error'](_0x9da1('0x1a'),_0x2dcbc6,JSON[_0x9da1('0x2b')](_0x5a6f2d));_0x2c3cdd[_0x9da1('0x27')]();});}else{_0x2c3cdd[_0x9da1('0x27')]();}});}}catch(_0x140c6c){logger['error'](_0x9da1('0x1a'),_0x2dcbc6,JSON['stringify'](_0x140c6c));_0x2c3cdd[_0x9da1('0x20')]();}};}; \ No newline at end of file +var _0x46ed=['create','then','body','catch','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','error','dialogState','Failed','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','chat','account','upperFirst','created','isEmpty','getMustacheRender','Message'];(function(_0x95b64c,_0x5c0d75){var _0x5bfc13=function(_0x2744cb){while(--_0x2744cb){_0x95b64c['push'](_0x95b64c['shift']());}};_0x5bfc13(++_0x5c0d75);}(_0x46ed,0x168));var _0xd46e=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x46ed[_0x11005e];return _0x29338f;};'use strict';var _=require(_0xd46e('0x0'));var moment=require(_0xd46e('0x1'));var AWS=require('aws-sdk');var utils=require(_0xd46e('0x2'));var logger=require(_0xd46e('0x3'))(_0xd46e('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xd46e('0x5')),'mailMessage':require(_0xd46e('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xd46e('0x7')),'whatsappMessage':require(_0xd46e('0x8'))};exports[_0xd46e('0x9')]=function(_0x25cf78,_0x45e680){return function(_0x855f24){try{if(!_[_0xd46e('0xa')](this[_0xd46e('0xb')][_0xd46e('0xc')])){logger[_0xd46e('0xd')](_0xd46e('0xe'),_0x25cf78,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x855f24[_0xd46e('0xf')]();}var _0x81235b={'ContactId':this['contact']['id'],'sentAt':moment()[_0xd46e('0x10')](_0xd46e('0x11')),'direction':_0xd46e('0x12')};var _0x443000=this[_0xd46e('0x13')];if(_0x443000===_0xd46e('0x14')){_0x81235b['ChatWebsiteId']=this[_0xd46e('0x15')]['id'];}else{_0x81235b[_['upperFirst'](_0x443000)+'AccountId']=this[_0xd46e('0x15')]['id'];}_0x81235b[_[_0xd46e('0x16')](_0x443000)+'InteractionId']=this['interaction']['id'];if(this[_0xd46e('0xb')][_0xd46e('0x17')]){var _0x1e9aae=_0x45e680[0x4];if(!_[_0xd46e('0x18')](_0x1e9aae)){_0x81235b['body']=utils[_0xd46e('0x19')](_0x1e9aae,this);return rpc[_0x443000+_0xd46e('0x1a')][_0xd46e('0x1b')](_0x81235b)[_0xd46e('0x1c')](function(_0x36a317){logger['info'](_0xd46e('0xe'),_0x25cf78,_0x81235b[_0xd46e('0x1d')]);})[_0xd46e('0x1e')](function(_0x551358){logger['error'](_0xd46e('0xe'),_0x25cf78,JSON[_0xd46e('0x1f')](_0x551358));})['finally'](function(){logger['info'](_0xd46e('0x20'),_0x25cf78);_0x855f24[_0xd46e('0x21')]();});}else{logger[_0xd46e('0xd')](_0xd46e('0x22'),_0x25cf78);_0x855f24[_0xd46e('0x21')]();}}else{var _0x312d6f=this;var _0x3b5fa4=new AWS[(_0xd46e('0x23'))]({'accessKeyId':_0x45e680[0x0],'secretAccessKey':_0x45e680[0x1],'region':_0x45e680[0x2]});var _0xb4940={'botAlias':_0xd46e('0x24'),'botName':_0x45e680[0x3],'inputText':this[_0xd46e('0x25')]['body'],'userId':this[_0xd46e('0x13')]+':'+this[_0xd46e('0xb')]['id'][_0xd46e('0x26')]()};_0x3b5fa4[_0xd46e('0x27')](_0xb4940,function(_0x128246,_0xc1af7f){if(_0x128246){logger[_0xd46e('0x28')](_0xd46e('0xe'),_0x25cf78,_0x128246[_0xd46e('0x25')]);_0x855f24['next']();}else if(_0xc1af7f&&_0xc1af7f[_0xd46e('0x25')]){_0x312d6f['body']['amazonlex']=_0xc1af7f;_0x81235b[_0xd46e('0x1d')]=_0xc1af7f[_0xd46e('0x25')];return rpc[_0x443000+_0xd46e('0x1a')][_0xd46e('0x1b')](_0x81235b)[_0xd46e('0x1c')](function(_0x180851){logger[_0xd46e('0xd')]('[%s][AMAZONLEX]\x20%s',_0x25cf78,_0x81235b[_0xd46e('0x1d')]);if(_0xc1af7f[_0xd46e('0x29')]==_0xd46e('0x2a')){_0x855f24[_0xd46e('0xf')]();}else{_0x855f24[_0xd46e('0x21')]();}})[_0xd46e('0x1e')](function(_0x58aeef){logger[_0xd46e('0x28')](_0xd46e('0xe'),_0x25cf78,JSON[_0xd46e('0x1f')](_0x58aeef));_0x855f24[_0xd46e('0xf')]();});}else{_0x855f24[_0xd46e('0xf')]();}});}}catch(_0x423ea3){logger[_0xd46e('0x28')](_0xd46e('0xe'),_0x25cf78,JSON[_0xd46e('0x1f')](_0x423ea3));_0x855f24[_0xd46e('0x21')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 1b903af..65df933 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 _0x28c0=['lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../mailRpc','consequence','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','getMustacheRender','contact','YYYY-MM-DD\x20HH:mm:ss','out','message','from','phone','read','subject','startsWith','Re:\x20','channel','chat','ChatWebsiteId','upperFirst','AccountId','InteractionId','Message','mail','account','Smtp','service','port','auth','user','pass','inReplyTo','html','replace','body',''+_[_0x028c('0x2d')](_0x253d2e[_0x028c('0x2e')],'';return mailRpc[_0x028c('0x30')](_0x1ef660,_0x253d2e)[_0x028c('0x31')](function(_0x35ac59){logger[_0x028c('0xd')](_0x028c('0x32'),_0x40576d);_0x253d2e['messageId']=_0x35ac59[_0x028c('0x15')][_0x028c('0x33')];return rpc[_0x13153c+_0x028c('0x22')][_0x028c('0x34')](_0x253d2e);})['then'](function(_0x5a368d){logger['info'](_0x028c('0xe'),_0x40576d,JSON[_0x028c('0x35')](_0x5a368d));})[_0x028c('0x36')](function(_0x4e3847){logger['error'](_0x028c('0x37'),_0x40576d,JSON[_0x028c('0x35')](_0x4e3847));})['finally'](function(){_0x5b8a57[_0x028c('0x10')]();});}else{return rpc[this['channel']+'Message']['create'](_0x253d2e)[_0x028c('0x31')](function(_0xbe082){logger[_0x028c('0xd')]('[%s][AUTOREPLY]\x20%s',_0x40576d,_0x253d2e['body']);})[_0x028c('0x36')](function(_0xddfd43){logger[_0x028c('0x38')]('[%s][AUTOREPLY]\x20%s',_0x40576d,JSON[_0x028c('0x35')](_0xddfd43));})['finally'](function(){_0x5b8a57[_0x028c('0x10')]();});}}}catch(_0x3153de){logger[_0x028c('0x38')](_0x028c('0xe'),_0x40576d,JSON[_0x028c('0x35')](_0x3153de));_0x5b8a57[_0x028c('0x39')]();}};}; \ No newline at end of file +var _0xedd6=['Re:','chat','ChatWebsiteId','account','upperFirst','AccountId','Message','mail','Smtp','service','host','port','authentication','auth','pass','inReplyTo','html','','body','','sendMailMessage','messageId','create','then','stringify','[RPC][%s][AUTOREPLY]\x20%s','finally','error','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../mailRpc','consequence','isNil','created','interaction','info','[%s][AUTOREPLY]\x20%s','next','channel','contact','format','out','message','from','phone','read','subject'];(function(_0x4f0054,_0x6dc732){var _0x507888=function(_0x8bc2f8){while(--_0x8bc2f8){_0x4f0054['push'](_0x4f0054['shift']());}};_0x507888(++_0x6dc732);}(_0xedd6,0x1df));var _0x6edd=function(_0x5c0b97,_0x7e3a87){_0x5c0b97=_0x5c0b97-0x0;var _0xc742fd=_0xedd6[_0x5c0b97];return _0xc742fd;};'use strict';var _=require(_0x6edd('0x0'));var moment=require(_0x6edd('0x1'));var utils=require(_0x6edd('0x2'));var logger=require(_0x6edd('0x3'))(_0x6edd('0x4'));var rpc={'chatMessage':require(_0x6edd('0x5')),'openchannelMessage':require(_0x6edd('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x6edd('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};var mailRpc=require(_0x6edd('0x8'));exports[_0x6edd('0x9')]=function(_0x11d393,_0x5c59e0){return function(_0x1dbc18){try{if(_0x5c59e0[0x0]==='1'&&(_[_0x6edd('0xa')](this['interaction'][_0x6edd('0xb')])||!this[_0x6edd('0xc')][_0x6edd('0xb')])){logger[_0x6edd('0xd')](_0x6edd('0xe'),_0x11d393,'Autoreply\x20already\x20sent');return _0x1dbc18[_0x6edd('0xf')]();}var _0x593298=this[_0x6edd('0x10')];var _0xa19176={'body':utils['getMustacheRender'](_0x5c59e0[0x1],this),'ContactId':this[_0x6edd('0x11')]['id'],'sentAt':moment()[_0x6edd('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x6edd('0x13')};if(this[_0x6edd('0x14')]){_0xa19176['to']=this['message'][_0x6edd('0x15')]||'';_0xa19176['cc']=this['message']['cc']||'';_0xa19176[_0x6edd('0x15')]=this[_0x6edd('0x14')]['to']||'';_0xa19176['phone']=this[_0x6edd('0x14')][_0x6edd('0x16')]||'';_0xa19176[_0x6edd('0x17')]=!![];if(this[_0x6edd('0x14')][_0x6edd('0x18')]){_0xa19176[_0x6edd('0x18')]='';_0xa19176['subject']+=_['startsWith'](this[_0x6edd('0x14')][_0x6edd('0x18')],_0x6edd('0x19'))?'':'Re:\x20';_0xa19176[_0x6edd('0x18')]+=this[_0x6edd('0x14')][_0x6edd('0x18')];}}if(this[_0x6edd('0x10')]===_0x6edd('0x1a')){_0xa19176[_0x6edd('0x1b')]=this[_0x6edd('0x1c')]['id'];}else{_0xa19176[_[_0x6edd('0x1d')](this[_0x6edd('0x10')])+_0x6edd('0x1e')]=this[_0x6edd('0x1c')]['id'];}_0xa19176[_[_0x6edd('0x1d')](this[_0x6edd('0x10')])+'InteractionId']=this[_0x6edd('0xc')]['id'];if(rpc[this[_0x6edd('0x10')]+_0x6edd('0x1f')]){if(this[_0x6edd('0x10')]===_0x6edd('0x20')){var _0x4f435f={'tls':{'rejectUnauthorized':![]}};if(this[_0x6edd('0x1c')][_0x6edd('0x21')][_0x6edd('0x22')]){_0x4f435f[_0x6edd('0x22')]=this[_0x6edd('0x1c')]['Smtp']['service'];}else{_0x4f435f[_0x6edd('0x23')]=this[_0x6edd('0x1c')][_0x6edd('0x21')][_0x6edd('0x23')];_0x4f435f[_0x6edd('0x24')]=this[_0x6edd('0x1c')][_0x6edd('0x21')][_0x6edd('0x24')];_0x4f435f['secure']=this[_0x6edd('0x1c')][_0x6edd('0x21')]['secure'];}if(this[_0x6edd('0x1c')][_0x6edd('0x21')][_0x6edd('0x25')]){_0x4f435f[_0x6edd('0x26')]={'user':this[_0x6edd('0x1c')][_0x6edd('0x21')]['user'],'pass':this[_0x6edd('0x1c')]['Smtp'][_0x6edd('0x27')]};}_0xa19176[_0x6edd('0x28')]=this[_0x6edd('0x14')]['messageId'];_0xa19176[_0x6edd('0x29')]=_0x6edd('0x2a')+_['replace'](_0xa19176[_0x6edd('0x2b')],_0x6edd('0x2c'),_0x6edd('0x2d'))+_0x6edd('0x2e');return mailRpc[_0x6edd('0x2f')](_0x4f435f,_0xa19176)['then'](function(_0x20379a){logger[_0x6edd('0xd')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x11d393);_0xa19176[_0x6edd('0x30')]=_0x20379a['message'][_0x6edd('0x30')];return rpc[_0x593298+'Message'][_0x6edd('0x31')](_0xa19176);})[_0x6edd('0x32')](function(_0x3b066d){logger[_0x6edd('0xd')](_0x6edd('0xe'),_0x11d393,JSON[_0x6edd('0x33')](_0x3b066d));})['catch'](function(_0x199ef4){logger['error'](_0x6edd('0x34'),_0x11d393,JSON['stringify'](_0x199ef4));})[_0x6edd('0x35')](function(){_0x1dbc18[_0x6edd('0xf')]();});}else{return rpc[this['channel']+_0x6edd('0x1f')]['create'](_0xa19176)[_0x6edd('0x32')](function(_0x315d49){logger[_0x6edd('0xd')]('[%s][AUTOREPLY]\x20%s',_0x11d393,_0xa19176[_0x6edd('0x2b')]);})['catch'](function(_0x1540ea){logger[_0x6edd('0x36')](_0x6edd('0xe'),_0x11d393,JSON['stringify'](_0x1540ea));})['finally'](function(){_0x1dbc18[_0x6edd('0xf')]();});}}}catch(_0xaf053e){logger['error'](_0x6edd('0xe'),_0x11d393,JSON[_0x6edd('0x33')](_0xaf053e));_0x1dbc18[_0x6edd('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 4b0f26a..eac77a1 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 _0x4312=['interaction','catch','error','stringify','finally','stop','[%s][CLOSE]\x20%s','routing','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','format','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','update','then'];(function(_0x3fe042,_0x1106f7){var _0x7d4a1f=function(_0x2df987){while(--_0x2df987){_0x3fe042['push'](_0x3fe042['shift']());}};_0x7d4a1f(++_0x1106f7);}(_0x4312,0xaf));var _0x2431=function(_0x2b2dd1,_0x2c6ac7){_0x2b2dd1=_0x2b2dd1-0x0;var _0x5d2ef5=_0x4312[_0x2b2dd1];return _0x5d2ef5;};'use strict';var moment=require('moment');var logger=require('../../../../config/logger')(_0x2431('0x0'));var rpc={'chatInteraction':require(_0x2431('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x2431('0x2')),'mailInteraction':require(_0x2431('0x3')),'faxInteraction':require(_0x2431('0x4')),'whatsappInteraction':require(_0x2431('0x5'))};exports[_0x2431('0x6')]=function(_0xbf4fd6,_0x5bc042,_0x3781eb,_0x54c720){return function(_0xa2cabe){try{logger[_0x2431('0x7')]('[%s][CLOSE]\x20reason\x20%s',_0xbf4fd6,_0x5bc042[0x0]);var _0x9647b4={'closed':0x1,'closedAt':moment()[_0x2431('0x8')](_0x2431('0x9')),'closeReason':'system','disposition':_0x5bc042[0x0]};if(rpc[_0x54c720[_0x2431('0xa')]+_0x2431('0xb')]){rpc[_0x54c720[_0x2431('0xa')]+'Interaction'][_0x2431('0xc')](_0x54c720['interaction']['id'],_0x9647b4)[_0x2431('0xd')](function(_0x22b796){logger[_0x2431('0x7')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0xbf4fd6,_0x54c720[_0x2431('0xe')]['id']);})[_0x2431('0xf')](function(_0xf39eaa){logger[_0x2431('0x10')]('[%s][CLOSE]\x20%s',_0xbf4fd6,JSON[_0x2431('0x11')](_0xf39eaa));})[_0x2431('0x12')](function(){_0xa2cabe[_0x2431('0x13')]();});}}catch(_0x41b8cd){logger[_0x2431('0x10')](_0x2431('0x14'),_0xbf4fd6,JSON[_0x2431('0x11')](_0x41b8cd));_0xa2cabe[_0x2431('0x13')]();}};}; \ No newline at end of file +var _0xb76d=['consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','[%s][CLOSE]\x20%s','finally','error','stringify','stop','moment','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xb76d,0x119));var _0xdb76=function(_0x1632f7,_0x5e5f19){_0x1632f7=_0x1632f7-0x0;var _0x591fac=_0xb76d[_0x1632f7];return _0x591fac;};'use strict';var moment=require(_0xdb76('0x0'));var logger=require('../../../../config/logger')(_0xdb76('0x1'));var rpc={'chatInteraction':require(_0xdb76('0x2')),'openchannelInteraction':require(_0xdb76('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xdb76('0x4')),'faxInteraction':require(_0xdb76('0x5')),'whatsappInteraction':require(_0xdb76('0x6'))};exports[_0xdb76('0x7')]=function(_0x1c501d,_0x2b661a,_0x5d80df,_0xf1a18d){return function(_0x39c442){try{logger[_0xdb76('0x8')](_0xdb76('0x9'),_0x1c501d,_0x2b661a[0x0]);var _0x4e60dc={'closed':0x1,'closedAt':moment()[_0xdb76('0xa')](_0xdb76('0xb')),'closeReason':'system','disposition':_0x2b661a[0x0]};if(rpc[_0xf1a18d[_0xdb76('0xc')]+_0xdb76('0xd')]){rpc[_0xf1a18d[_0xdb76('0xc')]+_0xdb76('0xd')][_0xdb76('0xe')](_0xf1a18d[_0xdb76('0xf')]['id'],_0x4e60dc)[_0xdb76('0x10')](function(_0x5f4099){logger['info'](_0xdb76('0x11'),_0x1c501d,_0xf1a18d[_0xdb76('0xf')]['id']);})[_0xdb76('0x12')](function(_0x579435){logger['error'](_0xdb76('0x13'),_0x1c501d,JSON['stringify'](_0x579435));})[_0xdb76('0x14')](function(){_0x39c442['stop']();});}}catch(_0x4d2970){logger[_0xdb76('0x15')](_0xdb76('0x13'),_0x1c501d,JSON[_0xdb76('0x16')](_0x4d2970));_0x39c442[_0xdb76('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 e9ee835..dac53fb 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 _0x25af=['metadata','endConversation','catch','lodash','md5','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','textRequest','message','dialogflow','result','fulfillment','speech'];(function(_0xc6b2fd,_0x20fede){var _0x17de0f=function(_0x2daccb){while(--_0x2daccb){_0xc6b2fd['push'](_0xc6b2fd['shift']());}};_0x17de0f(++_0x20fede);}(_0x25af,0x117));var _0xf25a=function(_0x482141,_0x2c4fdb){_0x482141=_0x482141-0x0;var _0x121620=_0x25af[_0x482141];return _0x121620;};'use strict';var _=require(_0xf25a('0x0'));var moment=require('moment');var apiai=require('apiai-promise');var md5=require(_0xf25a('0x1'));var utils=require(_0xf25a('0x2'));var logger=require('../../../../config/logger')(_0xf25a('0x3'));var rpc={'chatMessage':require(_0xf25a('0x4')),'openchannelMessage':require(_0xf25a('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xf25a('0x6')),'whatsappMessage':require(_0xf25a('0x7'))};exports[_0xf25a('0x8')]=function(_0x2c4d5e,_0x992427){return function(_0x196902){try{if(!_['isNil'](this[_0xf25a('0x9')][_0xf25a('0xa')])){logger[_0xf25a('0xb')](_0xf25a('0xc'),_0x2c4d5e,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x196902[_0xf25a('0xd')]();}var _0x2a22cf={'ContactId':this[_0xf25a('0xe')]['id'],'sentAt':moment()[_0xf25a('0xf')](_0xf25a('0x10')),'direction':_0xf25a('0x11')};var _0x49e51b=this['channel'];if(_0x49e51b===_0xf25a('0x12')){_0x2a22cf[_0xf25a('0x13')]=this[_0xf25a('0x14')]['id'];}else{_0x2a22cf[_[_0xf25a('0x15')](_0x49e51b)+_0xf25a('0x16')]=this[_0xf25a('0x14')]['id'];}_0x2a22cf[_[_0xf25a('0x15')](_0x49e51b)+_0xf25a('0x17')]=this[_0xf25a('0x9')]['id'];if(this[_0xf25a('0x9')][_0xf25a('0x18')]){var _0x4f78f3=_0x992427[0x2];if(!_[_0xf25a('0x19')](_0x4f78f3)){_0x2a22cf[_0xf25a('0x1a')]=utils[_0xf25a('0x1b')](_0x4f78f3,this);return rpc[_0x49e51b+_0xf25a('0x1c')][_0xf25a('0x1d')](_0x2a22cf)[_0xf25a('0x1e')](function(_0xac057c){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x2c4d5e,_0x2a22cf[_0xf25a('0x1a')]);})['catch'](function(_0x596fe8){logger[_0xf25a('0x1f')](_0xf25a('0xc'),_0x2c4d5e,JSON[_0xf25a('0x20')](_0x596fe8));})[_0xf25a('0x21')](function(){logger[_0xf25a('0xb')](_0xf25a('0x22'),_0x2c4d5e);_0x196902['stop']();});}else{logger[_0xf25a('0xb')](_0xf25a('0x23'),_0x2c4d5e);_0x196902[_0xf25a('0x24')]();}}else{var _0x3edc8b=this;var _0x19362e=apiai(_0x992427[0x0],{'language':_0x992427[0x1]||'en'});return _0x19362e[_0xf25a('0x25')](this[_0xf25a('0x26')]['body'],{'sessionId':md5(this[_0xf25a('0x9')]['id'])})['then'](function(_0x161eab){_0x3edc8b[_0xf25a('0x1a')][_0xf25a('0x27')]=_0x161eab;_0x2a22cf['body']=_0x161eab[_0xf25a('0x28')][_0xf25a('0x29')][_0xf25a('0x2a')];return rpc[_0x49e51b+'Message'][_0xf25a('0x1d')](_0x2a22cf)[_0xf25a('0x1e')](function(_0xc3257b){logger['info'](_0xf25a('0xc'),_0x2c4d5e,_0x2a22cf['body']);if(_0x161eab[_0xf25a('0x28')][_0xf25a('0x2b')][_0xf25a('0x2c')]){_0x196902[_0xf25a('0xd')]();}else{_0x196902['stop']();}})[_0xf25a('0x2d')](function(_0x3310b4){logger[_0xf25a('0x1f')](_0xf25a('0xc'),_0x2c4d5e,JSON[_0xf25a('0x20')](_0x3310b4));_0x196902[_0xf25a('0xd')]();});})['catch'](function(_0x42756b){logger['error'](_0xf25a('0xc'),_0x2c4d5e,_0x42756b[_0xf25a('0x26')]);_0x196902['next']();});}}catch(_0x30f3f7){logger[_0xf25a('0x1f')](_0xf25a('0xc'),_0x2c4d5e,JSON[_0xf25a('0x20')](_0x30f3f7));_0x196902['stop']();}};}; \ No newline at end of file +var _0x4f80=['isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','chat','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','create','then','[%s][DIALOGFLOW]\x20%s','error','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','fulfillment','speech','Message','metadata','endConversation','next','catch','lodash','moment','apiai-promise','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence'];(function(_0x15b192,_0x38c235){var _0x396e73=function(_0x4ba480){while(--_0x4ba480){_0x15b192['push'](_0x15b192['shift']());}};_0x396e73(++_0x38c235);}(_0x4f80,0x1c7));var _0x04f8=function(_0x42d0ed,_0x91a115){_0x42d0ed=_0x42d0ed-0x0;var _0x3f63f6=_0x4f80[_0x42d0ed];return _0x3f63f6;};'use strict';var _=require(_0x04f8('0x0'));var moment=require(_0x04f8('0x1'));var apiai=require(_0x04f8('0x2'));var md5=require('md5');var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x04f8('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x04f8('0x4')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x04f8('0x5'))};exports[_0x04f8('0x6')]=function(_0x2e88ea,_0xe384c1){return function(_0x31c7df){try{if(!_[_0x04f8('0x7')](this[_0x04f8('0x8')][_0x04f8('0x9')])){logger[_0x04f8('0xa')]('[%s][DIALOGFLOW]\x20%s',_0x2e88ea,_0x04f8('0xb'));return _0x31c7df['next']();}var _0x48c486={'ContactId':this['contact']['id'],'sentAt':moment()[_0x04f8('0xc')](_0x04f8('0xd')),'direction':_0x04f8('0xe')};var _0x586001=this[_0x04f8('0xf')];if(_0x586001===_0x04f8('0x10')){_0x48c486['ChatWebsiteId']=this[_0x04f8('0x11')]['id'];}else{_0x48c486[_[_0x04f8('0x12')](_0x586001)+'AccountId']=this[_0x04f8('0x11')]['id'];}_0x48c486[_[_0x04f8('0x12')](_0x586001)+_0x04f8('0x13')]=this[_0x04f8('0x8')]['id'];if(this[_0x04f8('0x8')][_0x04f8('0x14')]){var _0x2557b0=_0xe384c1[0x2];if(!_[_0x04f8('0x15')](_0x2557b0)){_0x48c486[_0x04f8('0x16')]=utils[_0x04f8('0x17')](_0x2557b0,this);return rpc[_0x586001+'Message'][_0x04f8('0x18')](_0x48c486)[_0x04f8('0x19')](function(_0x5ea52){logger[_0x04f8('0xa')](_0x04f8('0x1a'),_0x2e88ea,_0x48c486[_0x04f8('0x16')]);})['catch'](function(_0x43010c){logger[_0x04f8('0x1b')](_0x04f8('0x1a'),_0x2e88ea,JSON['stringify'](_0x43010c));})['finally'](function(){logger[_0x04f8('0xa')](_0x04f8('0x1c'),_0x2e88ea);_0x31c7df[_0x04f8('0x1d')]();});}else{logger[_0x04f8('0xa')](_0x04f8('0x1e'),_0x2e88ea);_0x31c7df['stop']();}}else{var _0x8fa254=this;var _0x49d81b=apiai(_0xe384c1[0x0],{'language':_0xe384c1[0x1]||'en'});return _0x49d81b[_0x04f8('0x1f')](this[_0x04f8('0x20')][_0x04f8('0x16')],{'sessionId':md5(this[_0x04f8('0x8')]['id'])})[_0x04f8('0x19')](function(_0x5b7808){_0x8fa254['body'][_0x04f8('0x21')]=_0x5b7808;_0x48c486[_0x04f8('0x16')]=_0x5b7808[_0x04f8('0x22')][_0x04f8('0x23')][_0x04f8('0x24')];return rpc[_0x586001+_0x04f8('0x25')]['create'](_0x48c486)[_0x04f8('0x19')](function(_0x1072e8){logger[_0x04f8('0xa')](_0x04f8('0x1a'),_0x2e88ea,_0x48c486['body']);if(_0x5b7808['result'][_0x04f8('0x26')][_0x04f8('0x27')]){_0x31c7df[_0x04f8('0x28')]();}else{_0x31c7df[_0x04f8('0x1d')]();}})[_0x04f8('0x29')](function(_0x3758b2){logger[_0x04f8('0x1b')](_0x04f8('0x1a'),_0x2e88ea,JSON['stringify'](_0x3758b2));_0x31c7df['next']();});})[_0x04f8('0x29')](function(_0xcf12d9){logger[_0x04f8('0x1b')](_0x04f8('0x1a'),_0x2e88ea,_0xcf12d9[_0x04f8('0x20')]);_0x31c7df[_0x04f8('0x28')]();});}}catch(_0x45372e){logger[_0x04f8('0x1b')](_0x04f8('0x1a'),_0x2e88ea,JSON['stringify'](_0x45372e));_0x31c7df[_0x04f8('0x1d')]();}};}; \ 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 a5488e0..c41ba65 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 _0x453f=['priority\x20false\x20is\x20a\x20number','consequence','fromString','replace','length','[%s][GOTOIF]\x20%s','map','message','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','validate','lodash','html-to-text','./utils','../../../../config/logger','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number'];(function(_0x40db7f,_0x2c209b){var _0xe98de8=function(_0x636b4e){while(--_0x636b4e){_0x40db7f['push'](_0x40db7f['shift']());}};_0xe98de8(++_0x2c209b);}(_0x453f,0x18d));var _0xf453=function(_0x73d88a,_0x5160c7){_0x73d88a=_0x73d88a-0x0;var _0x9f7072=_0x453f[_0x73d88a];return _0x9f7072;};'use strict';var schema=require(_0xf453('0x0'));var _=require(_0xf453('0x1'));var htmlToText=require(_0xf453('0x2'));var utils=require(_0xf453('0x3'));var logger=require(_0xf453('0x4'))('routing');var gotoif=schema({'condition':{'type':_0xf453('0x5'),'required':!![],'message':_0xf453('0x6')},'priorityTrue':{'type':'number','message':_0xf453('0x7')},'priorityFalse':{'type':'number','message':_0xf453('0x8')}});exports[_0xf453('0x9')]=function(_0x37b3bf,_0x397cc0){return function(_0x451080){try{var _0x4c5398={'condition':htmlToText[_0xf453('0xa')](utils['getMustacheRender'](_0x397cc0[0x0],this),{'wordwrap':![]})[_0xf453('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x397cc0[0x1],'priorityFalse':_0x397cc0[0x2]};var _0x536e3b=gotoif[_0xf453('0x0')](_0x4c5398,{'typecast':!![]});if(_0x536e3b[_0xf453('0xc')]){logger['error'](_0xf453('0xd'),_0x37b3bf,_[_0xf453('0xe')](_0x536e3b,_0xf453('0xf'))['join'](',\x20'));_0x451080[_0xf453('0x10')]();}else{try{var _0x2e5675=eval('('+_0x4c5398[_0xf453('0x11')]+')');var _0x1a6e19=_0x2e5675?_0x4c5398[_0xf453('0x12')]:_0x4c5398[_0xf453('0x13')];logger[_0xf453('0x14')](_0xf453('0x15'),_0x37b3bf,_0x4c5398[_0xf453('0x11')],_0x2e5675,_0x1a6e19||_0xf453('0x16'));if(_0x1a6e19){var _0x3eb66b=_[_0xf453('0x17')](_0x451080[_0xf453('0x18')](),{'p':_0x1a6e19});if(_0x3eb66b>=0x0){logger[_0xf453('0x14')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x37b3bf,_0x1a6e19||_0xf453('0x16'),_0x3eb66b);_0x451080[_0xf453('0x16')](_0x3eb66b);}else{logger[_0xf453('0x14')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x37b3bf,_0x1a6e19||_0xf453('0x16'));_0x451080[_0xf453('0x10')]();}}else{_0x451080[_0xf453('0x16')]();}}catch(_0x114202){logger[_0xf453('0x19')](_0xf453('0x1a'),_0x37b3bf,_0x114202[_0xf453('0xf')]);_0x451080[_0xf453('0x10')]();}}}catch(_0x494d36){logger[_0xf453('0x19')](_0xf453('0xd'),_0x37b3bf,JSON['stringify'](_0x494d36));_0x451080[_0xf453('0x10')]();}};}; \ No newline at end of file +var _0x4580=['condition','priorityFalse','info','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify','lodash','html-to-text','./utils','../../../../config/logger','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','validate','length','error','[%s][GOTOIF]\x20%s','join','stop'];(function(_0x25e463,_0x22ef9f){var _0xd7e88d=function(_0x3c1513){while(--_0x3c1513){_0x25e463['push'](_0x25e463['shift']());}};_0xd7e88d(++_0x22ef9f);}(_0x4580,0x1b9));var _0x0458=function(_0x103e0a,_0x493c68){_0x103e0a=_0x103e0a-0x0;var _0x257a3f=_0x4580[_0x103e0a];return _0x257a3f;};'use strict';var schema=require('validate');var _=require(_0x0458('0x0'));var htmlToText=require(_0x0458('0x1'));var utils=require(_0x0458('0x2'));var logger=require(_0x0458('0x3'))('routing');var gotoif=schema({'condition':{'type':_0x0458('0x4'),'required':!![],'message':_0x0458('0x5')},'priorityTrue':{'type':'number','message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x0458('0x6'),'message':_0x0458('0x7')}});exports[_0x0458('0x8')]=function(_0x329155,_0x2e38bd){return function(_0xa4723){try{var _0x2e4931={'condition':htmlToText[_0x0458('0x9')](utils[_0x0458('0xa')](_0x2e38bd[0x0],this),{'wordwrap':![]})[_0x0458('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x2e38bd[0x1],'priorityFalse':_0x2e38bd[0x2]};var _0x27942b=gotoif[_0x0458('0xc')](_0x2e4931,{'typecast':!![]});if(_0x27942b[_0x0458('0xd')]){logger[_0x0458('0xe')](_0x0458('0xf'),_0x329155,_['map'](_0x27942b,'message')[_0x0458('0x10')](',\x20'));_0xa4723[_0x0458('0x11')]();}else{try{var _0x53f950=eval('('+_0x2e4931[_0x0458('0x12')]+')');var _0x35df66=_0x53f950?_0x2e4931['priorityTrue']:_0x2e4931[_0x0458('0x13')];logger[_0x0458('0x14')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x329155,_0x2e4931[_0x0458('0x12')],_0x53f950,_0x35df66||'next');if(_0x35df66){var _0x563026=_['findIndex'](_0xa4723[_0x0458('0x15')](),{'p':_0x35df66});if(_0x563026>=0x0){logger[_0x0458('0x14')](_0x0458('0x16'),_0x329155,_0x35df66||_0x0458('0x17'),_0x563026);_0xa4723[_0x0458('0x17')](_0x563026);}else{logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x329155,_0x35df66||_0x0458('0x17'));_0xa4723['stop']();}}else{_0xa4723[_0x0458('0x17')]();}}catch(_0x5b583f){logger[_0x0458('0xe')](_0x0458('0x18'),_0x329155,_0x5b583f[_0x0458('0x19')]);_0xa4723[_0x0458('0x11')]();}}}catch(_0x190f08){logger[_0x0458('0xe')](_0x0458('0xf'),_0x329155,JSON[_0x0458('0x1a')](_0x190f08));_0xa4723[_0x0458('0x11')]();}};}; \ 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 9cdb959..00830c6 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 _0x949b=['[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','stringify','validate','lodash','../../../../config/logger','routing','consequence','length','[%s][GOTOP]\x20%s','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','rules'];(function(_0x9f2ab0,_0x1a983a){var _0x21885d=function(_0x41575b){while(--_0x41575b){_0x9f2ab0['push'](_0x9f2ab0['shift']());}};_0x21885d(++_0x1a983a);}(_0x949b,0x7d));var _0xb949=function(_0x521ad0,_0x2b2845){_0x521ad0=_0x521ad0-0x0;var _0x288a5d=_0x949b[_0x521ad0];return _0x288a5d;};'use strict';var schema=require(_0xb949('0x0'));var _=require(_0xb949('0x1'));var logger=require(_0xb949('0x2'))(_0xb949('0x3'));var gotop=schema({'priority':{'type':'number','required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xb949('0x4')]=function(_0x4dd7bc,_0x439351){return function(_0x22d98e){try{var _0x4e944d={'priority':_0x439351[0x0]};var _0x43a0c9=gotop['validate'](_0x4e944d,{'typecast':!![]});if(_0x43a0c9[_0xb949('0x5')]){logger['error'](_0xb949('0x6'),_0x4dd7bc,_[_0xb949('0x7')](_0x43a0c9,_0xb949('0x8'))[_0xb949('0x9')](',\x20'));_0x22d98e[_0xb949('0xa')]();}else{logger[_0xb949('0xb')](_0xb949('0xc'),_0x4dd7bc,_0x4e944d[_0xb949('0xd')]);if(_0x4e944d[_0xb949('0xd')]){var _0x42a6b0=_['findIndex'](_0x22d98e[_0xb949('0xe')](),{'p':_0x4e944d['priority']});if(_0x42a6b0>=0x0){logger[_0xb949('0xb')](_0xb949('0xf'),_0x4dd7bc,_0x4e944d[_0xb949('0xd')]||_0xb949('0x10'),_0x42a6b0);_0x22d98e[_0xb949('0x10')](_0x42a6b0);}else{logger[_0xb949('0xb')](_0xb949('0x11'),_0x4dd7bc,_0x4e944d[_0xb949('0xd')]||'next');_0x22d98e['stop']();}}else{_0x22d98e[_0xb949('0x10')]();}}}catch(_0x2d1823){logger[_0xb949('0x12')](_0xb949('0x6'),_0x4dd7bc,JSON[_0xb949('0x13')](_0x2d1823));_0x22d98e[_0xb949('0xa')]();}};}; \ No newline at end of file +var _0xa87a=['priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','[%s][GOTOP]\x20%s','map','message','join','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','error','stop','validate','lodash','../../../../config/logger'];(function(_0x3a2118,_0x31fc3c){var _0x1d181d=function(_0x26a734){while(--_0x26a734){_0x3a2118['push'](_0x3a2118['shift']());}};_0x1d181d(++_0x31fc3c);}(_0xa87a,0x177));var _0xaa87=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0xa87a[_0x1cb18a];return _0x22442e;};'use strict';var schema=require(_0xaa87('0x0'));var _=require(_0xaa87('0x1'));var logger=require(_0xaa87('0x2'))('routing');var gotop=schema({'priority':{'type':'number','required':!![],'message':_0xaa87('0x3')}});exports[_0xaa87('0x4')]=function(_0x583ddf,_0x3e66a1){return function(_0x327a04){try{var _0x36e363={'priority':_0x3e66a1[0x0]};var _0x3c5e85=gotop[_0xaa87('0x0')](_0x36e363,{'typecast':!![]});if(_0x3c5e85['length']){logger['error'](_0xaa87('0x5'),_0x583ddf,_[_0xaa87('0x6')](_0x3c5e85,_0xaa87('0x7'))[_0xaa87('0x8')](',\x20'));_0x327a04['stop']();}else{logger[_0xaa87('0x9')](_0xaa87('0xa'),_0x583ddf,_0x36e363[_0xaa87('0xb')]);if(_0x36e363[_0xaa87('0xb')]){var _0x5433a0=_[_0xaa87('0xc')](_0x327a04[_0xaa87('0xd')](),{'p':_0x36e363[_0xaa87('0xb')]});if(_0x5433a0>=0x0){logger[_0xaa87('0x9')](_0xaa87('0xe'),_0x583ddf,_0x36e363[_0xaa87('0xb')]||_0xaa87('0xf'),_0x5433a0);_0x327a04[_0xaa87('0xf')](_0x5433a0);}else{logger[_0xaa87('0x9')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x583ddf,_0x36e363[_0xaa87('0xb')]||_0xaa87('0xf'));_0x327a04['stop']();}}else{_0x327a04[_0xaa87('0xf')]();}}}catch(_0x4d88b7){logger[_0xaa87('0x10')](_0xaa87('0x5'),_0x583ddf,JSON['stringify'](_0x4d88b7));_0x327a04[_0xaa87('0x11')]();}};}; \ 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 196d5ad..ad9bc13 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 _0x0577=['catch','stringify','stop','error','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','create','info','[%s][MESSAGE]\x20%s','body','next'];(function(_0x54f3e8,_0x3ed493){var _0x267b37=function(_0x58247e){while(--_0x58247e){_0x54f3e8['push'](_0x54f3e8['shift']());}};_0x267b37(++_0x3ed493);}(_0x0577,0x78));var _0x7057=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x0577[_0x25e7cb];return _0x375d92;};'use strict';var _=require('lodash');var utils=require(_0x7057('0x0'));var logger=require(_0x7057('0x1'))(_0x7057('0x2'));var rpc={'chatMessage':require(_0x7057('0x3')),'openchannelMessage':require(_0x7057('0x4')),'mailMessage':require(_0x7057('0x5')),'smsMessage':require(_0x7057('0x6')),'faxMessage':require(_0x7057('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x7057('0x8')]=function(_0x18a708,_0x18d8e3){return function(_0x37552e){try{var _0x5d4f88={'body':utils[_0x7057('0x9')](_0x18d8e3[0x0],this),'ContactId':this[_0x7057('0xa')]['id']};if(this[_0x7057('0xb')]===_0x7057('0xc')){_0x5d4f88[_0x7057('0xd')]=this[_0x7057('0xe')]['id'];}else{_0x5d4f88[_[_0x7057('0xf')](this['channel'])+_0x7057('0x10')]=this[_0x7057('0xe')]['id'];}_0x5d4f88[_[_0x7057('0xf')](this[_0x7057('0xb')])+_0x7057('0x11')]=this[_0x7057('0x12')]['id'];if(rpc[this[_0x7057('0xb')]+'Message']){return rpc[this[_0x7057('0xb')]+_0x7057('0x13')][_0x7057('0x14')](_0x5d4f88)['then'](function(_0x43cf68){logger[_0x7057('0x15')](_0x7057('0x16'),_0x18a708,_0x5d4f88[_0x7057('0x17')]);_0x37552e[_0x7057('0x18')]();})[_0x7057('0x19')](function(_0x2334de){logger['error']('[%s][MESSAGE]\x20%s',_0x18a708,JSON[_0x7057('0x1a')](_0x2334de));_0x37552e[_0x7057('0x1b')]();});}}catch(_0x41bae3){logger[_0x7057('0x1c')](_0x7057('0x16'),_0x18a708,JSON[_0x7057('0x1a')](_0x41bae3));_0x37552e[_0x7057('0x1b')]();}};}; \ No newline at end of file +var _0xce0c=['../../rpc/smsMessage','../../rpc/faxMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage'];(function(_0x2da347,_0x476137){var _0x32619b=function(_0xc1423b){while(--_0xc1423b){_0x2da347['push'](_0x2da347['shift']());}};_0x32619b(++_0x476137);}(_0xce0c,0x11c));var _0xcce0=function(_0x606fe8,_0x10b084){_0x606fe8=_0x606fe8-0x0;var _0x28b517=_0xce0c[_0x606fe8];return _0x28b517;};'use strict';var _=require('lodash');var utils=require(_0xcce0('0x0'));var logger=require(_0xcce0('0x1'))(_0xcce0('0x2'));var rpc={'chatMessage':require(_0xcce0('0x3')),'openchannelMessage':require(_0xcce0('0x4')),'mailMessage':require(_0xcce0('0x5')),'smsMessage':require(_0xcce0('0x6')),'faxMessage':require(_0xcce0('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xcce0('0x8')]=function(_0x4abcdb,_0x48eb2a){return function(_0x4e233c){try{var _0x5f2997={'body':utils[_0xcce0('0x9')](_0x48eb2a[0x0],this),'ContactId':this[_0xcce0('0xa')]['id']};if(this[_0xcce0('0xb')]===_0xcce0('0xc')){_0x5f2997[_0xcce0('0xd')]=this[_0xcce0('0xe')]['id'];}else{_0x5f2997[_[_0xcce0('0xf')](this['channel'])+_0xcce0('0x10')]=this[_0xcce0('0xe')]['id'];}_0x5f2997[_[_0xcce0('0xf')](this[_0xcce0('0xb')])+_0xcce0('0x11')]=this[_0xcce0('0x12')]['id'];if(rpc[this[_0xcce0('0xb')]+_0xcce0('0x13')]){return rpc[this[_0xcce0('0xb')]+_0xcce0('0x13')]['create'](_0x5f2997)[_0xcce0('0x14')](function(_0xfcfc58){logger[_0xcce0('0x15')](_0xcce0('0x16'),_0x4abcdb,_0x5f2997[_0xcce0('0x17')]);_0x4e233c[_0xcce0('0x18')]();})[_0xcce0('0x19')](function(_0x66139){logger[_0xcce0('0x1a')]('[%s][MESSAGE]\x20%s',_0x4abcdb,JSON[_0xcce0('0x1b')](_0x66139));_0x4e233c['stop']();});}}catch(_0x17be9b){logger['error']('[%s][MESSAGE]\x20%s',_0x4abcdb,JSON[_0xcce0('0x1b')](_0x17be9b));_0x4e233c[_0xcce0('0x1c')]();}};}; \ 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 17d3212..d76847e 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 _0x8a9e=['error','stringify','stop','./utils','../../../../config/logger','routing','consequence','getMustacheRender','next'];(function(_0x1a7b68,_0x30a625){var _0x3b7799=function(_0x1b4bab){while(--_0x1b4bab){_0x1a7b68['push'](_0x1a7b68['shift']());}};_0x3b7799(++_0x30a625);}(_0x8a9e,0xed));var _0xe8a9=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x8a9e[_0x13e741];return _0x3f8bb3;};'use strict';var utils=require(_0xe8a9('0x0'));var logger=require(_0xe8a9('0x1'))(_0xe8a9('0x2'));exports[_0xe8a9('0x3')]=function(_0x25cebd,_0x21ba9b){return function(_0x220fa8){try{logger['info']('[%s][NOOP]\x20%s',_0x25cebd,utils[_0xe8a9('0x4')](_0x21ba9b[0x0],this));_0x220fa8[_0xe8a9('0x5')]();}catch(_0x5c0f85){logger[_0xe8a9('0x6')]('[%s][NOOP]\x20%s',_0x25cebd,JSON[_0xe8a9('0x7')](_0x5c0f85));_0x220fa8[_0xe8a9('0x8')]();}};}; \ No newline at end of file +var _0x2149=['./utils','routing','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify'];(function(_0x24f91b,_0x1d7899){var _0x44f51b=function(_0x35134f){while(--_0x35134f){_0x24f91b['push'](_0x24f91b['shift']());}};_0x44f51b(++_0x1d7899);}(_0x2149,0x1a8));var _0x9214=function(_0x4a615d,_0x13b9c0){_0x4a615d=_0x4a615d-0x0;var _0x597737=_0x2149[_0x4a615d];return _0x597737;};'use strict';var utils=require(_0x9214('0x0'));var logger=require('../../../../config/logger')(_0x9214('0x1'));exports['consequence']=function(_0x3c1a6e,_0x3606d0){return function(_0x13e311){try{logger[_0x9214('0x2')](_0x9214('0x3'),_0x3c1a6e,utils[_0x9214('0x4')](_0x3606d0[0x0],this));_0x13e311[_0x9214('0x5')]();}catch(_0x199afa){logger[_0x9214('0x6')](_0x9214('0x3'),_0x3c1a6e,JSON[_0x9214('0x7')](_0x199afa));_0x13e311['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index d438101..5a800b1 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 _0x3e74=['beepall','log','stack','validate','util','seq-queue','moment','../../../../config/logger','./strategy','redis','defaults','localhost','queue_id','account','queue','from','emit','clone','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','InteractionId','interaction','MessageId','message','channel','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','stop','find','atimeout','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','next','strategy','rrmemory'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x3e74,0x175));var _0x43e7=function(_0xf8c516,_0x22c6ee){_0xf8c516=_0xf8c516-0x0;var _0x2a6eb7=_0x3e74[_0xf8c516];return _0x2a6eb7;};'use strict';var schema=require(_0x43e7('0x0'));var _=require('lodash');var util=require(_0x43e7('0x1'));var seqqueue=require(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require(_0x43e7('0x4'))('routing');var strategy=require(_0x43e7('0x5'));config[_0x43e7('0x6')]=_[_0x43e7('0x7')](config[_0x43e7('0x6')],{'host':_0x43e7('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x43e7('0x6')]));var attributes=['id',_0x43e7('0x9'),_0x43e7('0xa'),_0x43e7('0xb'),_0x43e7('0xc'),'joinAt'];function emit(_0x212c6c,_0x554d44,_0x54948c){io['to'](_0x212c6c)[_0x43e7('0xd')](_0x554d44,_0x54948c);}function emitChannelQueueInteraction(_0x4139c9,_0x5c34f4,_0x2803d9,_0x513707,_0xf7c520,_0x37302c,_0x4ebc8e,_0x3eb206){var _0xc960ea=_[_0x43e7('0xe')](_0x2803d9);_0xc960ea[_0x43e7('0x9')]=_0x3eb206;_0xc960ea['queue']=_0x5c34f4;_0xc960ea['account']=_0x513707;_0xc960ea['id']=_0xf7c520;if(_0x37302c){_0x4ebc8e[util[_0x43e7('0xf')](_0x43e7('0x10'),_0x4139c9)][_0xf7c520]=_[_0x43e7('0x11')](_0xc960ea,attributes);}else{delete _0x4ebc8e[util['format']('%sQueuesWaitingInteractions',_0x4139c9)][_0xf7c520];}emit(util[_0x43e7('0xf')](_0x43e7('0x12'),_0x4139c9,_0x5c34f4),util[_0x43e7('0xf')](_0x43e7('0x13'),_0x4139c9,_0x37302c?'save':'remove'),_[_0x43e7('0x11')](_0xc960ea,attributes));}var rpc={'openchannelQueueReport':require(_0x43e7('0x14')),'mailQueueReport':require(_0x43e7('0x15')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x43e7('0x16')),'whatsappQueueReport':require(_0x43e7('0x17'))};var queue=schema({'name':{'type':_0x43e7('0x18'),'required':!![],'message':_0x43e7('0x19')},'timeout':{'type':_0x43e7('0x1a'),'message':_0x43e7('0x1b')}});function startRouting(_0x619236,_0x1441ef,_0x2377a3,_0xab63cf){if(_0x619236&&_0x1441ef&&_0x2377a3){_0x1441ef[_0x43e7('0x1c')]+=0x1;var _0x177ee1={'uniqueid':_0x619236,'from':_0x2377a3['body']?_0x2377a3[_0x43e7('0x1d')][_0x43e7('0xc')]:'','joinAt':moment()['format'](_0x43e7('0x1e')),'ContactId':_0x2377a3[_0x43e7('0x1f')]?_0x2377a3[_0x43e7('0x1f')]['id']:null,'ListId':_0x2377a3[_0x43e7('0x20')]?_0x2377a3[_0x43e7('0x20')]['id']:null};_0x177ee1[_[_0x43e7('0x21')](_0x2377a3['channel'])+_0x43e7('0x22')]=_0x1441ef['id']||null;_0x177ee1[_['upperFirst'](_0x2377a3['channel'])+_0x43e7('0x23')]=_0x2377a3[_0x43e7('0x24')]?_0x2377a3['interaction']['id']:null;_0x177ee1[_[_0x43e7('0x21')](_0x2377a3['channel'])+_0x43e7('0x25')]=_0x2377a3['message']?_0x2377a3[_0x43e7('0x26')]['id']:null;_0x177ee1[_[_0x43e7('0x21')](_0x2377a3[_0x43e7('0x27')])+(_0x2377a3[_0x43e7('0x27')]!=='chat'?'AccountId':_0x43e7('0x28'))]=_0x2377a3['account']?_0x2377a3[_0x43e7('0xa')]['id']:null;logger[_0x43e7('0x29')](util[_0x43e7('0xf')](_0x43e7('0x2a'),_0x619236,_0x1441ef['name']));emitChannelQueueInteraction(_0x2377a3[_0x43e7('0x27')],_0x1441ef[_0x43e7('0x2b')],_0x177ee1,_0x2377a3[_0x43e7('0xa')][_0x43e7('0x2b')],_0x2377a3[_0x43e7('0x26')]['id'],!![],_0xab63cf,_0x1441ef['id']);if(rpc[_0x2377a3[_0x43e7('0x27')]+_0x43e7('0x2c')]){return rpc[_0x2377a3[_0x43e7('0x27')]+_0x43e7('0x2c')][_0x43e7('0x2d')](_0x177ee1)[_0x43e7('0x2e')](function(_0x19725a){logger[_0x43e7('0x2f')](_0x43e7('0x30'));});}}}function stopRouting(_0x4bdb17,_0x238321,_0x44f6b0,_0x3b8f78){if(_0x4bdb17&&_0x238321){_0x238321[_0x43e7('0x1c')]-=0x1;var _0x4251c8={'leaveAt':moment()['format'](_0x43e7('0x1e')),'acceptAt':moment()[_0x43e7('0xf')](_0x43e7('0x1e')),'reason':_0x43e7('0x31')};logger['info'](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x4bdb17,_0x238321[_0x43e7('0x2b')]));emitChannelQueueInteraction(_0x44f6b0[_0x43e7('0x27')],_0x238321[_0x43e7('0x2b')],_0x44f6b0[_0x43e7('0x1d')],_0x44f6b0[_0x43e7('0xa')][_0x43e7('0x2b')],_0x44f6b0['message']['id'],![],_0x3b8f78,_0x238321['id']);if(rpc[_0x44f6b0['channel']+'QueueReport']){return rpc[_0x44f6b0['channel']+'QueueReport']['update'](_0x4bdb17,_0x4251c8)['catch'](function(_0x14d888){logger['error'](_0x43e7('0x32'));});}}}function endRouting(_0x8e9f40,_0x31bc78,_0x50a2d0,_0x40f72f){if(_0x8e9f40&&_0x31bc78){_0x31bc78[_0x43e7('0x1c')]-=0x1;var _0x101d45={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0x43e7('0x1e')),'reason':_0x43e7('0x33')};logger[_0x43e7('0x29')](util[_0x43e7('0xf')](_0x43e7('0x34'),_0x8e9f40,_0x31bc78[_0x43e7('0x2b')]));emitChannelQueueInteraction(_0x50a2d0[_0x43e7('0x27')],_0x31bc78[_0x43e7('0x2b')],_0x50a2d0['body'],_0x50a2d0[_0x43e7('0xa')][_0x43e7('0x2b')],_0x50a2d0['message']['id'],![],_0x40f72f);if(rpc[_0x50a2d0[_0x43e7('0x27')]+'QueueReport']){return rpc[_0x50a2d0[_0x43e7('0x27')]+_0x43e7('0x2c')][_0x43e7('0x35')](_0x8e9f40,_0x101d45)[_0x43e7('0x2e')](function(_0x35ac85){logger[_0x43e7('0x2f')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x574a93){return function(_0x30dfa9){return _0x30dfa9[_0x43e7('0x2b')][_0x43e7('0x36')]()===_0x574a93[_0x43e7('0x36')]();};}exports[_0x43e7('0x37')]=function(_0x4a4a85,_0x32a451,_0x4227c4,_0x575439){return function(_0x3628e0){try{var _0x51a69c={'name':_0x32a451[0x0],'timeout':_0x32a451[0x1]};var _0x2ad8ef=queue['validate'](_0x51a69c,{'typecast':!![]});if(_0x2ad8ef[_0x43e7('0x38')]){logger[_0x43e7('0x2f')](_0x43e7('0x39'),_0x4a4a85,_[_0x43e7('0x3a')](_0x2ad8ef,'message')['join'](',\x20'));_0x3628e0[_0x43e7('0x3b')]();}else{var _0x40c509=_[_0x43e7('0x3c')](_0x4227c4[_0x575439[_0x43e7('0x27')]+'Queues'],handleFindQueue(_0x51a69c['name']));if(_0x40c509){startRouting(_0x4a4a85,_0x40c509,_0x575439,_0x4227c4);var _0x5dd988=(_0x40c509[_0x43e7('0x33')]||0xa)*0x3e8;var _0x57f5d0=(_0x51a69c[_0x43e7('0x33')]||0x14)*0x3e8;var _0x4b3a59,_0x5b28db;if(_0x5dd988>_0x57f5d0){_0x57f5d0=_0x5dd988;}var _0x46b2e6=seqqueue['createQueue'](_0x5dd988);_0x46b2e6['id']=_0x4a4a85;_0x46b2e6[_0x43e7('0x3d')]=_0x5dd988;_0x46b2e6[_0x43e7('0x3e')]=_0x57f5d0;_0x46b2e6[_0x43e7('0x27')]=_0x575439[_0x43e7('0x27')];_0x4227c4['rules'][_0x4a4a85]['on'](_0x43e7('0x3f'),function(){logger[_0x43e7('0x29')](_0x43e7('0x40'),_0x4a4a85);stopRouting(_0x4a4a85,_0x40c509,_0x575439,_0x4227c4);clearTimeout(_0x4b3a59);_0x4b3a59=undefined;_0x46b2e6[_0x43e7('0x41')](!![]);if(_0x4227c4[_0x43e7('0x42')][_0x4a4a85]){delete _0x4227c4[_0x43e7('0x42')][_0x4a4a85];}_0x3628e0['stop']();});_0x4227c4['rules'][_0x4a4a85]['on'](_0x43e7('0x43'),function(){if(_0x4227c4[_0x43e7('0x42')][_0x4a4a85]){delete _0x4227c4[_0x43e7('0x42')][_0x4a4a85];}});_0x4b3a59=setTimeout(function(){logger['info']('[%s][QUEUE]\x20APPLICATION\x20END',_0x4a4a85);endRouting(_0x4a4a85,_0x40c509,_0x575439,_0x4227c4);clearTimeout(_0x4b3a59);_0x46b2e6['close'](!![]);_0x3628e0[_0x43e7('0x44')]();},_0x57f5d0);switch(_0x40c509[_0x43e7('0x45')]){case'rrmemory':strategy[_0x43e7('0x46')](_0x46b2e6,_0x40c509,_0x4227c4,_0x575439);break;default:strategy[_0x43e7('0x47')](_0x46b2e6,_0x40c509,_0x4227c4,_0x575439);}}else{logger[_0x43e7('0x2f')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x4a4a85,_0x51a69c['name']);_0x3628e0['stop']();}}}catch(_0x4de644){console[_0x43e7('0x48')](_0x4de644);logger[_0x43e7('0x2f')]('[%s][QUEUE]\x20%s',_0x4a4a85,_0x4de644[_0x43e7('0x49')]);_0x3628e0[_0x43e7('0x3b')]();}};}; \ No newline at end of file +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(_0x256999,_0x227454){var _0x4768e3=function(_0x1260ff){while(--_0x1260ff){_0x256999['push'](_0x256999['shift']());}};_0x4768e3(++_0x227454);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'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 ddc8f1f..4d9bcf8 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 _0x62a5=['realtime','push','handleRun','handleTimeout','squeue','timeout','bind','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','isAgentAvailable','channel','busy','writeLog','RINGING','forcedOwnership',':FORCED','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','TIMEOUT','lodash','uuid','routing','notificationId','agent'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x62a5,0x127));var _0x562a=function(_0x5cd3e1,_0x265a3b){_0x5cd3e1=_0x5cd3e1-0x0;var _0x47468a=_0x62a5[_0x5cd3e1];return _0x47468a;};'use strict';var _=require(_0x562a('0x0'));var uuid=require(_0x562a('0x1'));var util=require('./util');var logger=require('../../../../../config/logger')(_0x562a('0x2'));var Agent=function(_0x1d1e89,_0xbc9b5d,_0x23a55f,_0x560ec0){this[_0x562a('0x3')]=uuid['v4']();this['squeue']=_0x1d1e89;this[_0x562a('0x4')]=_0xbc9b5d;this[_0x562a('0x5')]=_0x23a55f;this[_0x562a('0x2')]=_0x560ec0;this['squeue'][_0x562a('0x6')](this[_0x562a('0x7')]['bind'](this),this[_0x562a('0x8')]['bind'](this));this[_0x562a('0x9')]['on'](_0x562a('0xa'),this['handleTimeout'][_0x562a('0xb')](this));this[_0x562a('0x9')]['on'](_0x562a('0xc'),this[_0x562a('0xd')][_0x562a('0xb')](this));};Agent[_0x562a('0xe')]['push']=function(){this['squeue']['push'](this[_0x562a('0x7')][_0x562a('0xb')](this),this[_0x562a('0x8')]['bind'](this));};Agent[_0x562a('0xe')][_0x562a('0xd')]=function(){this[_0x562a('0x8')](!![]);};Agent[_0x562a('0xe')]['handleRun']=function(_0x2786d7){logger[_0x562a('0xf')](_0x562a('0x10'),this['squeue']['id'],this[_0x562a('0x4')]['id']);if(_[_0x562a('0x11')](this[_0x562a('0x5')][_0x562a('0x12')][this[_0x562a('0x4')]['id']])){logger[_0x562a('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x562a('0x9')]['id'],this['agent']['id']);setTimeout(this[_0x562a('0x6')][_0x562a('0xb')](this),0x3e8);}else{if(this[_0x562a('0x2')]['forcedOwnership']||util[_0x562a('0x13')](this[_0x562a('0x9')]['id'],this[_0x562a('0x5')]['agents'][this[_0x562a('0x4')]['id']],this[_0x562a('0x9')][_0x562a('0x14')],![])){this[_0x562a('0x5')][_0x562a('0x12')][this[_0x562a('0x4')]['id']][_0x562a('0x15')]=!![];this[_0x562a('0x5')][_0x562a('0x12')][this[_0x562a('0x4')]['id']]['busyQueue']=undefined;util['showNotification'](this[_0x562a('0x3')],this['squeue']['id'],this[_0x562a('0x5')][_0x562a('0x12')][this[_0x562a('0x4')]['id']],null,this[_0x562a('0x2')]);util[_0x562a('0x16')](this[_0x562a('0x9')]['id'],this[_0x562a('0x5')][_0x562a('0x12')][this['agent']['id']],_0x562a('0x17')+(this[_0x562a('0x2')][_0x562a('0x18')]?_0x562a('0x19'):''));}else{logger['info']('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0x562a('0x9')]['id'],this[_0x562a('0x4')]['id']);setTimeout(this['push'][_0x562a('0xb')](this),0x3e8);}}};Agent[_0x562a('0xe')][_0x562a('0x8')]=function(_0x3dbada){if(_[_0x562a('0x11')](this['realtime'][_0x562a('0x12')][this[_0x562a('0x4')]['id']])){return logger[_0x562a('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0x562a('0x4')]['id']);}else{logger[_0x562a('0xf')](_0x562a('0x1a'),this['squeue']['id'],this[_0x562a('0x4')]['id']);util[_0x562a('0x1b')](this[_0x562a('0x3')],this[_0x562a('0x9')]['id'],this[_0x562a('0x5')]['agents'][this[_0x562a('0x4')]['id']],null,this['routing']);this['realtime'][_0x562a('0x12')][this[_0x562a('0x4')]['id']][_0x562a('0x15')]=![];this['realtime'][_0x562a('0x12')][this[_0x562a('0x4')]['id']][_0x562a('0x1c')]=undefined;util[_0x562a('0x16')](this[_0x562a('0x9')]['id'],this['realtime']['agents'][this[_0x562a('0x4')]['id']],_0x3dbada?'STOP':_0x562a('0x1d'));}if(!_0x3dbada){setTimeout(this[_0x562a('0x6')]['bind'](this),0x3e8);}};function agent(_0x382012,_0x3f26ea,_0x378121,_0x1a0066){return new Agent(_0x382012,_0x3f26ea,_0x378121,_0x1a0066);}module['exports']=agent; \ No newline at end of file +var _0xa12b=['bind','handleTimeout','timeout','handleDrained','prototype','push','agent','isNil','agents','info','forcedOwnership','channel','busy','busyQueue','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing','notificationId','squeue','realtime','handleRun'];(function(_0x2d8f17,_0x47641b){var _0x1ce8e9=function(_0x368253){while(--_0x368253){_0x2d8f17['push'](_0x2d8f17['shift']());}};_0x1ce8e9(++_0x47641b);}(_0xa12b,0xf0));var _0xba12=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa12b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xba12('0x0'));var uuid=require('uuid');var util=require(_0xba12('0x1'));var logger=require(_0xba12('0x2'))(_0xba12('0x3'));var Agent=function(_0x5ea908,_0x1f0231,_0x2d7ff7,_0x5c6070){this[_0xba12('0x4')]=uuid['v4']();this[_0xba12('0x5')]=_0x5ea908;this['agent']=_0x1f0231;this[_0xba12('0x6')]=_0x2d7ff7;this[_0xba12('0x3')]=_0x5c6070;this[_0xba12('0x5')]['push'](this[_0xba12('0x7')][_0xba12('0x8')](this),this[_0xba12('0x9')]['bind'](this));this[_0xba12('0x5')]['on'](_0xba12('0xa'),this[_0xba12('0x9')][_0xba12('0x8')](this));this[_0xba12('0x5')]['on']('drained',this[_0xba12('0xb')][_0xba12('0x8')](this));};Agent[_0xba12('0xc')]['push']=function(){this[_0xba12('0x5')][_0xba12('0xd')](this[_0xba12('0x7')][_0xba12('0x8')](this),this[_0xba12('0x9')][_0xba12('0x8')](this));};Agent[_0xba12('0xc')]['handleDrained']=function(){this[_0xba12('0x9')](!![]);};Agent['prototype'][_0xba12('0x7')]=function(_0x39a878){logger['info']('[%s][AGENT]\x20try\x20with\x20%s',this[_0xba12('0x5')]['id'],this[_0xba12('0xe')]['id']);if(_[_0xba12('0xf')](this[_0xba12('0x6')][_0xba12('0x10')][this['agent']['id']])){logger[_0xba12('0x11')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xba12('0x5')]['id'],this[_0xba12('0xe')]['id']);setTimeout(this['push'][_0xba12('0x8')](this),0x3e8);}else{if(this[_0xba12('0x3')][_0xba12('0x12')]||util['isAgentAvailable'](this[_0xba12('0x5')]['id'],this['realtime']['agents'][this['agent']['id']],this['squeue'][_0xba12('0x13')],![])){this['realtime'][_0xba12('0x10')][this[_0xba12('0xe')]['id']][_0xba12('0x14')]=!![];this[_0xba12('0x6')][_0xba12('0x10')][this[_0xba12('0xe')]['id']][_0xba12('0x15')]=undefined;util[_0xba12('0x16')](this[_0xba12('0x4')],this[_0xba12('0x5')]['id'],this[_0xba12('0x6')]['agents'][this[_0xba12('0xe')]['id']],null,this[_0xba12('0x3')]);util[_0xba12('0x17')](this[_0xba12('0x5')]['id'],this[_0xba12('0x6')][_0xba12('0x10')][this[_0xba12('0xe')]['id']],_0xba12('0x18')+(this['routing'][_0xba12('0x12')]?_0xba12('0x19'):''));}else{logger[_0xba12('0x11')](_0xba12('0x1a'),this['squeue']['id'],this[_0xba12('0xe')]['id']);setTimeout(this[_0xba12('0xd')]['bind'](this),0x3e8);}}};Agent['prototype']['handleTimeout']=function(_0x21c1aa){if(_['isNil'](this[_0xba12('0x6')][_0xba12('0x10')][this[_0xba12('0xe')]['id']])){return logger[_0xba12('0x11')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xba12('0x5')]['id'],this['agent']['id']);}else{logger[_0xba12('0x11')](_0xba12('0x1b'),this[_0xba12('0x5')]['id'],this[_0xba12('0xe')]['id']);util[_0xba12('0x1c')](this[_0xba12('0x4')],this['squeue']['id'],this['realtime'][_0xba12('0x10')][this['agent']['id']],null,this[_0xba12('0x3')]);this[_0xba12('0x6')][_0xba12('0x10')][this['agent']['id']]['busy']=![];this[_0xba12('0x6')][_0xba12('0x10')][this[_0xba12('0xe')]['id']][_0xba12('0x15')]=undefined;util[_0xba12('0x17')](this[_0xba12('0x5')]['id'],this['realtime'][_0xba12('0x10')][this[_0xba12('0xe')]['id']],_0x21c1aa?'STOP':_0xba12('0x1d'));}if(!_0x21c1aa){setTimeout(this[_0xba12('0xd')][_0xba12('0x8')](this),0x3e8);}};function agent(_0x45b108,_0x4b1e8d,_0x4b13ab,_0x475891){return new Agent(_0x45b108,_0x4b1e8d,_0x4b13ab,_0x475891);}module[_0xba12('0x1e')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 155ad7b..27ba9c0 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 _0x99cb=['exports','lodash','uuid','./util','routing','notificationId','squeue','queue','realtime','bind','handleTimeout','drained','handleDrained','prototype','handleRun','isNil','Agents','length','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','writeLog','RINGING','busyQueue','name','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','push','hideNotification','STOP','TIMEOUT','busy'];(function(_0x165cbe,_0x267c13){var _0x734bfc=function(_0x421ecb){while(--_0x421ecb){_0x165cbe['push'](_0x165cbe['shift']());}};_0x734bfc(++_0x267c13);}(_0x99cb,0xa6));var _0xb99c=function(_0x23cc83,_0x5a1a1e){_0x23cc83=_0x23cc83-0x0;var _0x5b1b11=_0x99cb[_0x23cc83];return _0x5b1b11;};'use strict';var _=require(_0xb99c('0x0'));var uuid=require(_0xb99c('0x1'));var util=require(_0xb99c('0x2'));var logger=require('../../../../../config/logger')(_0xb99c('0x3'));var Beepall=function(_0x5d53ac,_0x3a0c6a,_0x1fe886,_0x1a36a0){this[_0xb99c('0x4')]=uuid['v4']();this[_0xb99c('0x5')]=_0x5d53ac;this[_0xb99c('0x6')]=_0x3a0c6a;this[_0xb99c('0x7')]=_0x1fe886;this[_0xb99c('0x3')]=_0x1a36a0;this[_0xb99c('0x5')]['push'](this['handleRun'][_0xb99c('0x8')](this),this[_0xb99c('0x9')]['bind'](this));this[_0xb99c('0x5')]['on']('timeout',this['handleTimeout'][_0xb99c('0x8')](this));this[_0xb99c('0x5')]['on'](_0xb99c('0xa'),this[_0xb99c('0xb')][_0xb99c('0x8')](this));};Beepall[_0xb99c('0xc')]['push']=function(){this[_0xb99c('0x5')]['push'](this[_0xb99c('0xd')]['bind'](this),this[_0xb99c('0x9')][_0xb99c('0x8')](this));};Beepall[_0xb99c('0xc')][_0xb99c('0xb')]=function(_0xc0e2c){this[_0xb99c('0x9')](!![]);};Beepall[_0xb99c('0xc')]['handleRun']=function(_0x297448){var _0x349c7a=!![];if(!_[_0xb99c('0xe')](this[_0xb99c('0x6')])&&!_[_0xb99c('0xe')](this[_0xb99c('0x6')]['Agents'])&&this['queue'][_0xb99c('0xf')][_0xb99c('0x10')]>0x0){for(var _0x15a160=0x0,_0x338591;_0x15a1600x0){for(var _0x2b6587=0x0,_0x2cf14e;_0x2b65870x0&&_0x5a96d5[_0xefbb7d+_0x07c8('0x23')]>=_0x5a96d5[_0xefbb7d+_0x07c8('0x22')]){writeLog(_0x2fe4a4,_0x5a96d5,_0xefbb7d['toUpperCase']()+'\x20MAXCAPACITY');return![];}}return!![];};exports['showNotification']=function(_0x13086a,_0x694f82,_0x5faab8,_0x6dbc13,_0x129455){return sendNotification(!![],_0x13086a,_0x694f82,_0x5faab8,_0x6dbc13,_0x129455);};exports[_0x07c8('0x24')]=function(_0x1ff6b9,_0x5b93c5,_0x2e317d,_0x5cf4b3,_0xd851e0){return sendNotification(![],_0x1ff6b9,_0x5b93c5,_0x2e317d,_0x5cf4b3,_0xd851e0);};exports[_0x07c8('0x25')]=writeLog; \ No newline at end of file +var _0x5829=['notification:%s','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','writeLog','lodash','util','../utils','ioredis','../../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','user:%s','user:save','\x20interaction','name','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','[%s][QUEUE]\x20%s','message','format'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x5829,0xf4));var _0x9582=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x5829[_0x11005e];return _0x29338f;};'use strict';var _=require(_0x9582('0x0'));var util=require(_0x9582('0x1'));var utils=require(_0x9582('0x2'));var Mustache=require('mustache');var Redis=require(_0x9582('0x3'));var config=require('../../../../../config/environment');var logger=require(_0x9582('0x4'))('routing');config[_0x9582('0x5')]=_[_0x9582('0x6')](config[_0x9582('0x5')],{'host':_0x9582('0x7'),'port':0x18eb});var io=require(_0x9582('0x8'))(new Redis(config[_0x9582('0x5')]));function emit(_0xba229f,_0x108adb,_0x2a68b0){io['to'](_0xba229f)[_0x9582('0x9')](_0x108adb,_0x2a68b0);}function sendNotification(_0x3bf9ab,_0x4a1395,_0x379555,_0x54b101,_0x1e61f3,_0x551e0d){io['to'](util['format'](_0x9582('0xa'),_0x54b101['name']))[_0x9582('0x9')](_0x9582('0xb'),_0x54b101);var _0x205ca1=_0x551e0d||{};var _0x54566c=_0x379555['split']('.');var _0x3315d9={'uniqueid':_0x4a1395,'channel':_0x54566c[0x0],'id':_0x54566c[0x1],'title':_0x54566c[0x0]+_0x9582('0xc'),'interactionId':_0x54566c[0x2],'queue':_0x1e61f3?_0x1e61f3[_0x9582('0xd')]:null,'sound':_0x205ca1[_0x9582('0xe')][_0x9582('0xf')],'shake':_0x205ca1[_0x9582('0xe')][_0x9582('0x10')]};try{if(!_0x205ca1[_0x9582('0x11')]){_0x205ca1[_0x9582('0x11')]={};}if(_0x1e61f3){_0x205ca1[_0x9582('0x11')][_0x9582('0x12')]=_0x1e61f3;}else if(_0x205ca1[_0x9582('0x11')][_0x9582('0x12')]){delete _0x205ca1[_0x9582('0x11')]['queue'];}_0x3315d9[_0x9582('0x13')]=utils[_0x9582('0x14')](_0x205ca1[_0x9582('0xe')][_0x9582('0x15')],_0x205ca1);}catch(_0x597a19){_0x3315d9[_0x9582('0x13')]=_0x9582('0x16');logger['error'](util['format'](_0x9582('0x17'),_0x4a1395,_0x597a19[_0x9582('0x18')]));}io['to'](util[_0x9582('0x19')](_0x9582('0xa'),_0x54b101['name']))[_0x9582('0x9')](util[_0x9582('0x19')](_0x9582('0x1a'),_0x3bf9ab?_0x9582('0x1b'):_0x9582('0x1c')),_0x3315d9);}function writeLog(_0x521f7f,_0x2e956d,_0x3587cc){return logger[_0x9582('0x1d')](util[_0x9582('0x19')](_0x9582('0x1e'),_0x521f7f,_0x2e956d['name'],_0x3587cc));}exports[_0x9582('0x1f')]=function(_0x331c26,_0x2a5e50,_0x41af22,_0x33b3e5){if(_0x2a5e50[_0x9582('0x20')]){writeLog(_0x331c26,_0x2a5e50,_0x9582('0x21'));return![];}if(!_0x2a5e50['online']){writeLog(_0x331c26,_0x2a5e50,_0x9582('0x22'));return![];}if(_0x2a5e50[_0x41af22+_0x9582('0x23')]){writeLog(_0x331c26,_0x2a5e50,_0x9582('0x24'));return![];}if(_0x33b3e5&&_0x2a5e50[_0x9582('0x25')](_0x41af22+_0x9582('0x26'))&&_0x2a5e50[_0x9582('0x25')](_0x41af22+_0x9582('0x27'))){if(_0x2a5e50[_0x41af22+_0x9582('0x26')]>0x0&&_0x2a5e50[_0x41af22+_0x9582('0x27')]>=_0x2a5e50[_0x41af22+'Capacity']){writeLog(_0x331c26,_0x2a5e50,_0x41af22[_0x9582('0x28')]()+_0x9582('0x29'));return![];}}return!![];};exports[_0x9582('0x2a')]=function(_0x577cca,_0x5a0824,_0x10d2cd,_0x6b31ef,_0x4d1710){return sendNotification(!![],_0x577cca,_0x5a0824,_0x10d2cd,_0x6b31ef,_0x4d1710);};exports[_0x9582('0x2b')]=function(_0x588841,_0x354eec,_0x3d1c5a,_0x8c5c40,_0x5f409a){return sendNotification(![],_0x588841,_0x354eec,_0x3d1c5a,_0x8c5c40,_0x5f409a);};exports[_0x9582('0x2c')]=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 c177113..27d9855 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 _0x8331=['next','stringify','shelljs','lodash','routing','string','consequence','validate','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','replace','isNil','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body'];(function(_0x3ba527,_0x446a5e){var _0x5ee6ad=function(_0x5978c7){while(--_0x5978c7){_0x3ba527['push'](_0x3ba527['shift']());}};_0x5ee6ad(++_0x446a5e);}(_0x8331,0x16a));var _0x1833=function(_0x3c4a7c,_0x2f4e3c){_0x3c4a7c=_0x3c4a7c-0x0;var _0xf13d1e=_0x8331[_0x3c4a7c];return _0xf13d1e;};'use strict';var schema=require('validate');var sh=require(_0x1833('0x0'));var _=require(_0x1833('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x1833('0x2'));var system=schema({'command':{'type':_0x1833('0x3'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x1833('0x4')]=function(_0x132853,_0x2ef9f2){return function(_0x69f664){try{var _0x1cb964={'command':_0x2ef9f2[0x0]};var _0x45e2cd=system[_0x1833('0x5')](_0x1cb964,{'typecast':!![]});if(_0x45e2cd[_0x1833('0x6')]){logger[_0x1833('0x7')](_0x1833('0x8'),_0x132853,_[_0x1833('0x9')](_0x45e2cd,_0x1833('0xa'))[_0x1833('0xb')](',\x20'));logger[_0x1833('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x132853);_0x69f664['next']();}else{var _0x53e6ed=this;var _0x125fde=utils[_0x1833('0xd')](_0x2ef9f2[0x0],this);logger[_0x1833('0xc')](_0x1833('0xe'),_0x132853,_0x125fde);sh[_0x1833('0xf')](_[_0x1833('0x10')](_0x125fde),function(_0x386885,_0x2458d1){logger[_0x1833('0xc')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x132853,_0x386885);if(_0x386885==0x0){var _0x3e7f76=_0x2458d1[_0x1833('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0x1833('0x12')](_0x2ef9f2[0x1])||_['isEmpty'](_0x2ef9f2[0x1])){logger[_0x1833('0xc')](_0x1833('0x13'),_0x132853);_0x53e6ed['body'][_0x2ef9f2[0x1]]=_0x3e7f76;}else{logger['info'](_0x1833('0x14'),_0x132853,_0x2ef9f2[0x1],_0x3e7f76);_0x53e6ed[_0x1833('0x15')][_0x2ef9f2[0x1]]=_0x3e7f76;}}_0x69f664[_0x1833('0x16')]();});}}catch(_0x367b46){logger[_0x1833('0x7')](_0x1833('0x8'),_0x132853,_['isObject'](_0x367b46)?JSON[_0x1833('0x17')](_0x367b46):_0x367b46);logger[_0x1833('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x132853);_0x69f664[_0x1833('0x16')]();}};}; \ No newline at end of file +var _0x0c0b=['lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','next','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x0c0b,0x14e));var _0xb0c0=function(_0x24a7ed,_0xa5a39f){_0x24a7ed=_0x24a7ed-0x0;var _0x199fcc=_0x0c0b[_0x24a7ed];return _0x199fcc;};'use strict';var schema=require(_0xb0c0('0x0'));var sh=require(_0xb0c0('0x1'));var _=require(_0xb0c0('0x2'));var utils=require(_0xb0c0('0x3'));var logger=require(_0xb0c0('0x4'))(_0xb0c0('0x5'));var system=schema({'command':{'type':_0xb0c0('0x6'),'required':!![],'message':_0xb0c0('0x7')}});exports[_0xb0c0('0x8')]=function(_0x47cc6d,_0x5a141c){return function(_0x7a57fe){try{var _0x427024={'command':_0x5a141c[0x0]};var _0x429323=system['validate'](_0x427024,{'typecast':!![]});if(_0x429323[_0xb0c0('0x9')]){logger[_0xb0c0('0xa')](_0xb0c0('0xb'),_0x47cc6d,_[_0xb0c0('0xc')](_0x429323,_0xb0c0('0xd'))[_0xb0c0('0xe')](',\x20'));logger[_0xb0c0('0xf')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x47cc6d);_0x7a57fe[_0xb0c0('0x10')]();}else{var _0xdbfe6d=this;var _0x3d1ebf=utils['getMustacheRender'](_0x5a141c[0x0],this);logger[_0xb0c0('0xf')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x47cc6d,_0x3d1ebf);sh['exec'](_[_0xb0c0('0x11')](_0x3d1ebf),function(_0x2401f1,_0x4f19b8){logger[_0xb0c0('0xf')](_0xb0c0('0x12'),_0x47cc6d,_0x2401f1);if(_0x2401f1==0x0){var _0x8242ea=_0x4f19b8[_0xb0c0('0x13')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x5a141c[0x1])||_['isEmpty'](_0x5a141c[0x1])){logger[_0xb0c0('0xf')]('[%s][SYSTEM]\x20no\x20variable',_0x47cc6d);_0xdbfe6d[_0xb0c0('0x14')][_0x5a141c[0x1]]=_0x8242ea;}else{logger[_0xb0c0('0xf')](_0xb0c0('0x15'),_0x47cc6d,_0x5a141c[0x1],_0x8242ea);_0xdbfe6d[_0xb0c0('0x14')][_0x5a141c[0x1]]=_0x8242ea;}}_0x7a57fe[_0xb0c0('0x10')]();});}}catch(_0x232abf){logger[_0xb0c0('0xa')]('[%s][SYSTEM]\x20%s',_0x47cc6d,_[_0xb0c0('0x16')](_0x232abf)?JSON['stringify'](_0x232abf):_0x232abf);logger[_0xb0c0('0xf')](_0xb0c0('0x17'),_0x47cc6d);_0x7a57fe[_0xb0c0('0x10')]();}};}; \ 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 670c223..c37ee93 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 _0x5aea=['error','[%s][TAG]\x20%s','map','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','then','interaction','catch','stringify','isObject','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','routing','number','consequence','length'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5aea,0x18e));var _0xa5ae=function(_0x5f43d6,_0x25b98d){_0x5f43d6=_0x5f43d6-0x0;var _0x431701=_0x5aea[_0x5f43d6];return _0x431701;};'use strict';var schema=require(_0xa5ae('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0xa5ae('0x1')),'openchannelInteraction':require(_0xa5ae('0x2')),'smsInteraction':require(_0xa5ae('0x3')),'mailInteraction':require(_0xa5ae('0x4')),'faxInteraction':require(_0xa5ae('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require('../../../../config/logger')(_0xa5ae('0x6'));var tag=schema({'tag':{'type':_0xa5ae('0x7'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xa5ae('0x8')]=function(_0x561555,_0x2de454,_0x311f83,_0x360030){return function(_0x1dcbcd){try{var _0x3fa7d4={'tag':_0x2de454[0x0]};var _0x5aed9d=tag['validate'](_0x3fa7d4,{'typecast':!![]});if(_0x5aed9d[_0xa5ae('0x9')]){logger[_0xa5ae('0xa')](_0xa5ae('0xb'),_0x561555,_[_0xa5ae('0xc')](_0x5aed9d,'message')['join'](',\x20'));logger[_0xa5ae('0xd')](_0xa5ae('0xe'),_0x561555);_0x1dcbcd[_0xa5ae('0xf')]();}else{var _0x4dc026={'ids':[_0x2de454[0x0]]};if(rpc[_0x360030[_0xa5ae('0x10')]+_0xa5ae('0x11')]){rpc[_0x360030[_0xa5ae('0x10')]+_0xa5ae('0x11')][_0xa5ae('0x12')](_0x360030['interaction']['id'],_0x4dc026)[_0xa5ae('0x13')](function(_0x4a5ec5){logger[_0xa5ae('0xd')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x561555,_0x2de454[0x1],_0x360030[_0xa5ae('0x10')],_0x360030[_0xa5ae('0x14')]['id']);})[_0xa5ae('0x15')](function(_0x291e19){logger['error'](_0xa5ae('0xb'),_0x561555,JSON[_0xa5ae('0x16')](_0x291e19));logger[_0xa5ae('0xd')](_0xa5ae('0xe'),_0x561555);})['finally'](function(){_0x1dcbcd[_0xa5ae('0xf')]();});}}}catch(_0x2b31a6){logger['error'](_0xa5ae('0xb'),_0x561555,_[_0xa5ae('0x17')](_0x2b31a6)?JSON[_0xa5ae('0x16')](_0x2b31a6):_0x2b31a6);logger[_0xa5ae('0xd')](_0xa5ae('0xe'),_0x561555);_0x1dcbcd[_0xa5ae('0xf')]();}};}; \ No newline at end of file +var _0x995a=['consequence','length','error','[%s][TAG]\x20%s','map','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','isObject','next','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x995a,0x1d3));var _0xa995=function(_0x31d95d,_0x2b7893){_0x31d95d=_0x31d95d-0x0;var _0x41efe3=_0x995a[_0x31d95d];return _0x41efe3;};'use strict';var schema=require(_0xa995('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0xa995('0x1')),'openchannelInteraction':require(_0xa995('0x2')),'smsInteraction':require(_0xa995('0x3')),'mailInteraction':require(_0xa995('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xa995('0x5'))};var logger=require(_0xa995('0x6'))(_0xa995('0x7'));var tag=schema({'tag':{'type':_0xa995('0x8'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xa995('0x9')]=function(_0x409358,_0x4cd60e,_0x44414f,_0x41caa7){return function(_0x511ac9){try{var _0x3049ed={'tag':_0x4cd60e[0x0]};var _0x264653=tag[_0xa995('0x0')](_0x3049ed,{'typecast':!![]});if(_0x264653[_0xa995('0xa')]){logger[_0xa995('0xb')](_0xa995('0xc'),_0x409358,_[_0xa995('0xd')](_0x264653,_0xa995('0xe'))[_0xa995('0xf')](',\x20'));logger['info'](_0xa995('0x10'),_0x409358);_0x511ac9['next']();}else{var _0x375454={'ids':[_0x4cd60e[0x0]]};if(rpc[_0x41caa7[_0xa995('0x11')]+_0xa995('0x12')]){rpc[_0x41caa7[_0xa995('0x11')]+'Interaction'][_0xa995('0x13')](_0x41caa7[_0xa995('0x14')]['id'],_0x375454)['then'](function(_0x5529b1){logger[_0xa995('0x15')](_0xa995('0x16'),_0x409358,_0x4cd60e[0x1],_0x41caa7[_0xa995('0x11')],_0x41caa7[_0xa995('0x14')]['id']);})[_0xa995('0x17')](function(_0x4378bf){logger[_0xa995('0xb')](_0xa995('0xc'),_0x409358,JSON[_0xa995('0x18')](_0x4378bf));logger[_0xa995('0x15')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x409358);})[_0xa995('0x19')](function(){_0x511ac9['next']();});}}}catch(_0x534cb7){logger['error'](_0xa995('0xc'),_0x409358,_[_0xa995('0x1a')](_0x534cb7)?JSON['stringify'](_0x534cb7):_0x534cb7);logger[_0xa995('0x15')](_0xa995('0x10'),_0x409358);_0x511ac9[_0xa995('0x1b')]();}};}; \ 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 12cb0c1..ef95f14 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 _0x1bb2=['contact','message','account','interaction','list','lodash','exports','merge','body'];(function(_0x5c6319,_0x305706){var _0x4bbf66=function(_0x305625){while(--_0x305625){_0x5c6319['push'](_0x5c6319['shift']());}};_0x4bbf66(++_0x305706);}(_0x1bb2,0x152));var _0x21bb=function(_0x5292fc,_0x325502){_0x5292fc=_0x5292fc-0x0;var _0x583038=_0x1bb2[_0x5292fc];return _0x583038;};'use strict';var Mustache=require('mustache');var _=require(_0x21bb('0x0'));module[_0x21bb('0x1')]={'getMustacheRender':function(_0x29a202,_0x480fcb){return Mustache['render'](_0x29a202,_[_0x21bb('0x2')](_0x480fcb[_0x21bb('0x3')],{'contact':_0x480fcb[_0x21bb('0x4')],'message':_0x480fcb[_0x21bb('0x5')],'account':_0x480fcb[_0x21bb('0x6')],'interaction':_0x480fcb[_0x21bb('0x7')],'list':_0x480fcb[_0x21bb('0x8')]}))||'';}}; \ No newline at end of file +var _0x14ee=['body','contact','message','account','mustache','render','merge'];(function(_0x470238,_0x482d90){var _0x144065=function(_0x378fac){while(--_0x378fac){_0x470238['push'](_0x470238['shift']());}};_0x144065(++_0x482d90);}(_0x14ee,0x115));var _0xe14e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x14ee[_0x3dd15e];return _0x231fd0;};'use strict';var Mustache=require(_0xe14e('0x0'));var _=require('lodash');module['exports']={'getMustacheRender':function(_0xfe268d,_0x43dba9){return Mustache[_0xe14e('0x1')](_0xfe268d,_[_0xe14e('0x2')](_0x43dba9[_0xe14e('0x3')],{'contact':_0x43dba9[_0xe14e('0x4')],'message':_0x43dba9[_0xe14e('0x5')],'account':_0x43dba9[_0xe14e('0x6')],'interaction':_0x43dba9['interaction'],'list':_0x43dba9['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 5f33601..272b3d5 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 _0x4724=['error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','busy','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','paused','waiting','mailQueues','name','openchannelQueues','smsQueues','faxQueues','whatsappQueues','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:','lodash','util','path','jayson/promise','bluebird','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','applications','isArray','existsSync','join','app','appdata','push','slice','length','amazonlex','split','tag','TagId','%s:%s:%s','condition','intervals','consequence','priority','info','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','.js','execute','Applications\x20executed','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','emit','end','QueueReport','update'];(function(_0x28a5ad,_0x520afa){var _0x176b8a=function(_0x3d71b){while(--_0x3d71b){_0x28a5ad['push'](_0x28a5ad['shift']());}};_0x176b8a(++_0x520afa);}(_0x4724,0xcf));var _0x4472=function(_0x30c83b,_0x1773d9){_0x30c83b=_0x30c83b-0x0;var _0x14bbc9=_0x4724[_0x30c83b];return _0x14bbc9;};'use strict';var _=require(_0x4472('0x0'));var util=require(_0x4472('0x1'));var path=require(_0x4472('0x2'));var fs=require('fs');var jayson=require(_0x4472('0x3'));var BPromise=require(_0x4472('0x4'));var uuid=require('uuid');var config=require('../../../config/environment');var logger=require('../../../config/logger')('routing');var rpc={'openchannelQueueReport':require(_0x4472('0x5')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x4472('0x6')),'smsQueueReport':require(_0x4472('0x7')),'faxQueueReport':require(_0x4472('0x8')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x4472('0x9'));function getId(_0x1a8af3,_0x330383,_0x2c079b){return util[_0x4472('0xa')]('%s.%s.%s',_0x1a8af3,_0x330383||0x0,_0x2c079b||0x0);}function getIntervals(_0x5650b6,_0x47f2e8){var _0xfc919b=[];if(!_[_0x4472('0xb')](_0x47f2e8[_0x4472('0xc')])&&!_['isNil'](_0x5650b6[_0x47f2e8[_0x4472('0xc')]])&&!_['isNil'](_0x5650b6[_0x47f2e8[_0x4472('0xc')]][_0x4472('0xd')])){_0xfc919b=_[_0x4472('0xe')](_0x5650b6[_0x47f2e8[_0x4472('0xc')]][_0x4472('0xd')],_0x4472('0xf'));}else if(!_[_0x4472('0xb')](_0x47f2e8[_0x4472('0xf')])){_0xfc919b=[_0x47f2e8[_0x4472('0xf')]];}return _0xfc919b;}exports[_0x4472('0x10')]=function(_0x2328e3){_0x2328e3[_0x4472('0x11')]={};return new BPromise(function(_0x255ad7,_0x359483){var _0x154788={'Start':function(_0x47f325){var _0x3de221=this;return new Promise(function(_0x2165ae,_0x26ea2d){if(_0x47f325){try{var _0x55cf28=[];var _0x22d34c=getId(_0x47f325[_0x4472('0x12')],_0x47f325[_0x4472('0x13')]?_0x47f325['message']['id']:0x0,_0x47f325[_0x4472('0x14')]?_0x47f325[_0x4472('0x14')]['id']:0x0);if(_0x47f325[_0x4472('0x15')]&&_[_0x4472('0x16')](_0x47f325[_0x4472('0x15')])&&_0x47f325[_0x4472('0x15')]['length']){for(var _0x21ce82=0x0;_0x21ce82<_0x47f325[_0x4472('0x15')]['length'];_0x21ce82+=0x1){var _0x547857=_0x47f325[_0x4472('0x15')][_0x21ce82];if(fs[_0x4472('0x17')](path[_0x4472('0x18')](__dirname,_0x4472('0x15'),_0x547857[_0x4472('0x19')]+'.js'))){var _0x236db0=[];switch(_0x547857['app']['toLowerCase']()){case'autoreply':var _0x13b05c=_0x547857[_0x4472('0x1a')]['split'](',');_0x236db0[_0x4472('0x1b')](_0x13b05c[0x0]);_0x236db0[_0x4472('0x1b')](_0x13b05c[_0x4472('0x1c')](0x1,_0x13b05c[_0x4472('0x1d')])[_0x4472('0x18')](','));break;case'dialogflow':var _0x1d3940=_0x547857[_0x4472('0x1a')]['split'](',');_0x236db0[_0x4472('0x1b')](_0x1d3940[0x0]);_0x236db0[_0x4472('0x1b')](_0x1d3940[0x1]);_0x236db0[_0x4472('0x1b')](_0x1d3940[_0x4472('0x1c')](0x2,_0x1d3940[_0x4472('0x1d')])['join'](','));break;case _0x4472('0x1e'):var _0x1acd3f=_0x547857[_0x4472('0x1a')][_0x4472('0x1f')](',');_0x236db0['push'](_0x1acd3f[0x0]);_0x236db0['push'](_0x1acd3f[0x1]);_0x236db0['push'](_0x1acd3f[0x2]);_0x236db0['push'](_0x1acd3f[0x3]);_0x236db0[_0x4472('0x1b')](_0x1acd3f[_0x4472('0x1c')](0x4,_0x1acd3f[_0x4472('0x1d')])[_0x4472('0x18')](','));break;case _0x4472('0x13'):_0x236db0[_0x4472('0x1b')](_0x547857[_0x4472('0x1a')]);break;case _0x4472('0x20'):_0x236db0['push'](_0x547857[_0x4472('0x21')]);_0x236db0[_0x4472('0x1b')](_0x547857[_0x4472('0x1a')]);break;default:_0x236db0=_[_0x4472('0xb')](_0x547857[_0x4472('0x1a')])?[]:_0x547857[_0x4472('0x1a')][_0x4472('0x1f')](',');}var _0x19769b={'id':util[_0x4472('0xa')](_0x4472('0x22'),_0x22d34c,_0x547857['id'],_0x547857[_0x4472('0x19')]),'condition':require('./interval')[_0x4472('0x23')](_0x22d34c,getIntervals(_0x2328e3[_0x4472('0x24')],_0x547857),_0x2328e3),'consequence':require('./applications/'+_0x547857[_0x4472('0x19')])[_0x4472('0x25')](_0x22d34c,_0x236db0,_0x2328e3,_0x47f325),'p':_0x547857[_0x4472('0x26')]||0x0};logger[_0x4472('0x27')]('Push\x20new\x20rule',_0x19769b['id'],_0x4472('0x28'),getIntervals(_0x2328e3[_0x4472('0x24')],_0x547857)['join'](_0x4472('0x29')));_0x55cf28[_0x4472('0x1b')](_0x19769b);}else{logger[_0x4472('0x2a')](_0x4472('0x2b'),path['join'](__dirname,_0x4472('0x15'),_0x547857[_0x4472('0x19')]+_0x4472('0x2c')));}}_0x2328e3[_0x4472('0x11')][_0x22d34c]=new RuleEngine(_0x55cf28);_0x2328e3['rules'][_0x22d34c][_0x4472('0x2d')](_0x47f325,function(_0x125835){logger[_0x4472('0x27')](_0x4472('0x2e'),JSON['stringify'](_0x125835['matchPath']));if(_0x2328e3[_0x4472('0x11')][_0x22d34c]){_0x2328e3[_0x4472('0x11')][_0x22d34c]['emit']('complete');}});return _0x2165ae({'code':0xc8,'message':_0x47f325});}else{logger[_0x4472('0x27')](_0x4472('0x2f'));return _0x2165ae({'code':0xc8,'message':_0x47f325});}}catch(_0x2164f4){logger[_0x4472('0x2a')](_0x2164f4[_0x4472('0x30')]);return _0x26ea2d(_0x3de221['error'](0x1f4,_0x2164f4));}}return _0x26ea2d(_0x4472('0x31'));});},'AcceptMessage':function(_0x3bbaed){var _0x2cb816=this;return new Promise(function(_0xefb4c0,_0xbd2b5f){if(_0x3bbaed[_0x4472('0x13')]&&_0x3bbaed[_0x4472('0x13')]['id']){try{var _0x2e3c23=getId(_0x3bbaed[_0x4472('0x12')],_0x3bbaed[_0x4472('0x13')]?_0x3bbaed['message']['id']:0x0,_0x3bbaed[_0x4472('0x14')]?_0x3bbaed[_0x4472('0x14')]['id']:0x0);if(_0x2328e3['rules'][_0x2e3c23]){_0x2328e3['rules'][_0x2e3c23][_0x4472('0x32')](_0x4472('0x33'));if(rpc[_0x3bbaed[_0x4472('0x12')]+_0x4472('0x34')]){rpc[_0x3bbaed['channel']+'QueueReport'][_0x4472('0x35')](_0x2e3c23,{'UserId':_0x3bbaed[_0x4472('0x13')]['UserId']})['catch'](function(_0x899658){logger[_0x4472('0x2a')](_0x4472('0x36'));});}}return _0xefb4c0({'code':0xc8,'message':_0x3bbaed});}catch(_0x399852){logger[_0x4472('0x2a')](_0x399852[_0x4472('0x30')]);return _0xbd2b5f(_0x2cb816[_0x4472('0x2a')](0x1f4,_0x399852));}}logger[_0x4472('0x2a')](_0x4472('0x37'));return _0xbd2b5f(_0x2cb816[_0x4472('0x2a')](0x1f4,_0x4472('0x37')));});},'RejectMessage':function(_0x261b7f){var _0x5ee230=this;return new Promise(function(_0xf166,_0x4969b1){if(_0x261b7f['agent']&&_0x261b7f[_0x4472('0x38')]['id']){try{if(_0x2328e3[_0x4472('0x39')][_0x261b7f[_0x4472('0x38')]['id']]){_0x2328e3[_0x4472('0x39')][_0x261b7f[_0x4472('0x38')]['id']][_0x4472('0x3a')]=![];_0x2328e3[_0x4472('0x39')][_0x261b7f['agent']['id']]['busyQueue']=undefined;}return _0xf166({'code':0xc8,'message':_0x261b7f});}catch(_0x53130d){logger['error'](_0x53130d[_0x4472('0x30')]);return _0x4969b1(_0x5ee230['error'](0x1f4,_0x53130d));}}logger[_0x4472('0x2a')](_0x4472('0x37'));return _0x4969b1(_0x5ee230[_0x4472('0x2a')](0x1f4,_0x4472('0x37')));});},'AbandonInteraction':function(_0x17366c){var _0x5a41f6=this;return new Promise(function(_0x755129,_0x578f38){if(_0x17366c[_0x4472('0x12')]&&_0x17366c[_0x4472('0x14')]&&_0x17366c['interaction']['id']){try{var _0x361471=getId(_0x17366c[_0x4472('0x12')],_0x17366c['message']?_0x17366c[_0x4472('0x13')]['id']:0x0,_0x17366c[_0x4472('0x14')]?_0x17366c[_0x4472('0x14')]['id']:0x0);if(_0x2328e3[_0x4472('0x11')][_0x361471]){_0x2328e3['rules'][_0x361471][_0x4472('0x32')](_0x4472('0x33'));}return _0x755129({'code':0xc8,'message':_0x17366c});}catch(_0x24cbcd){logger[_0x4472('0x2a')](_0x24cbcd[_0x4472('0x30')]);return _0x578f38(_0x5a41f6[_0x4472('0x2a')](0x1f4,_0x24cbcd));}}logger[_0x4472('0x2a')](_0x4472('0x37'));return _0x578f38(_0x5a41f6[_0x4472('0x2a')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x43c15a){var _0x2041d1=this;return new Promise(function(_0x734750,_0x5142eb){if(_0x2328e3[_0x4472('0x39')][_0x4472('0x3b')](_0x43c15a['id'])){for(var _0x13967b in _0x43c15a[_0x4472('0x3c')]){if(_0x43c15a[_0x4472('0x3c')][_0x4472('0x3b')](_0x13967b)){if(_0x2328e3[_0x4472('0x39')][_0x43c15a['id']][_0x4472('0x3b')](_0x13967b+_0x4472('0x3d'))){_0x2328e3['agents'][_0x43c15a['id']][_0x13967b+'CurrentCapacity']=parseInt(_0x43c15a[_0x4472('0x3c')][_0x13967b],0xa);}}}_0x2328e3[_0x4472('0x39')][_0x43c15a['id']][_0x4472('0x3e')]();return _0x734750({'code':0xc8,'message':_0x2328e3['agents'][_0x43c15a['id']]});}else{return _0x5142eb(_0x2041d1[_0x4472('0x2a')](0x1f4,_0x4472('0x3f')));}});},'Agents':function(_0x2300c1){return new Promise(function(_0x3364aa,_0x40d406){var _0xe57dcb=_[_0x4472('0x40')](_0x2328e3['agents']);_0x3364aa({'count':_0xe57dcb[_0x4472('0x1d')],'rows':_0xe57dcb});});},'ChatQueues':function(_0x4aa449){return new Promise(function(_0x161a3d,_0x20c855){var _0xfb75e3=[];for(var _0x35c860 in _0x2328e3['chatQueues']){if(_0x2328e3['chatQueues'][_0x4472('0x3b')](_0x35c860)){var _0x4495cc=_0x2328e3[_0x4472('0x41')][_0x35c860];var _0x56715b={'id':_0x4495cc['id'],'available':_0x4495cc[_0x4472('0x42')],'loggedIn':_0x4495cc[_0x4472('0x43')],'name':_0x4495cc['name'],'paused':_0x4495cc[_0x4472('0x44')],'waiting':_0x4495cc[_0x4472('0x45')]};_0xfb75e3[_0x4472('0x1b')](_0x56715b);}}_0x161a3d({'count':_0xfb75e3[_0x4472('0x1d')],'rows':_0xfb75e3});});},'MailQueues':function(_0x829ef){return new Promise(function(_0x47a2b2,_0x355040){var _0x18d42a=[];for(var _0x21f125 in _0x2328e3[_0x4472('0x46')]){if(_0x2328e3[_0x4472('0x46')][_0x4472('0x3b')](_0x21f125)){var _0x3ae32f=_0x2328e3[_0x4472('0x46')][_0x21f125];var _0x40646c={'id':_0x3ae32f['id'],'available':_0x3ae32f[_0x4472('0x42')],'loggedIn':_0x3ae32f[_0x4472('0x43')],'name':_0x3ae32f[_0x4472('0x47')],'paused':_0x3ae32f['paused'],'waiting':_0x3ae32f[_0x4472('0x45')]};_0x18d42a['push'](_0x40646c);}}_0x47a2b2({'count':_0x18d42a[_0x4472('0x1d')],'rows':_0x18d42a});});},'OpenchannelQueues':function(_0x19093a){return new Promise(function(_0x2b2b1a,_0x43c677){var _0x189ac6=[];for(var _0x47738e in _0x2328e3[_0x4472('0x48')]){if(_0x2328e3['openchannelQueues'][_0x4472('0x3b')](_0x47738e)){var _0x1e7182=_0x2328e3[_0x4472('0x48')][_0x47738e];var _0x49a779={'id':_0x1e7182['id'],'available':_0x1e7182[_0x4472('0x42')],'loggedIn':_0x1e7182[_0x4472('0x43')],'name':_0x1e7182[_0x4472('0x47')],'paused':_0x1e7182[_0x4472('0x44')],'waiting':_0x1e7182['waiting']};_0x189ac6['push'](_0x49a779);}}_0x2b2b1a({'count':_0x189ac6['length'],'rows':_0x189ac6});});},'SmsQueues':function(_0x164be6){return new Promise(function(_0xc4f6e9,_0x28bb0f){var _0xd07391=[];for(var _0x4d5130 in _0x2328e3['smsQueues']){if(_0x2328e3['smsQueues'][_0x4472('0x3b')](_0x4d5130)){var _0x3769fe=_0x2328e3[_0x4472('0x49')][_0x4d5130];var _0x5a1d3c={'id':_0x3769fe['id'],'available':_0x3769fe[_0x4472('0x42')],'loggedIn':_0x3769fe['loggedIn'],'name':_0x3769fe[_0x4472('0x47')],'paused':_0x3769fe[_0x4472('0x44')],'waiting':_0x3769fe['waiting']};_0xd07391['push'](_0x5a1d3c);}}_0xc4f6e9({'count':_0xd07391[_0x4472('0x1d')],'rows':_0xd07391});});},'FaxQueues':function(_0x17d688){return new Promise(function(_0x404149,_0x26c150){var _0x29bb7b=[];for(var _0x23f303 in _0x2328e3[_0x4472('0x4a')]){if(_0x2328e3[_0x4472('0x4a')][_0x4472('0x3b')](_0x23f303)){var _0x5a47e4=_0x2328e3[_0x4472('0x4a')][_0x23f303];var _0x57f241={'id':_0x5a47e4['id'],'available':_0x5a47e4[_0x4472('0x42')],'loggedIn':_0x5a47e4[_0x4472('0x43')],'name':_0x5a47e4[_0x4472('0x47')],'paused':_0x5a47e4['paused'],'waiting':_0x5a47e4['waiting']};_0x29bb7b[_0x4472('0x1b')](_0x57f241);}}_0x404149({'count':_0x29bb7b[_0x4472('0x1d')],'rows':_0x29bb7b});});},'WhatsappQueues':function(_0x4c7d7b){return new Promise(function(_0x147005,_0x5a9f76){var _0x14d6cf=[];for(var _0x3a1666 in _0x2328e3[_0x4472('0x4b')]){if(_0x2328e3[_0x4472('0x4b')][_0x4472('0x3b')](_0x3a1666)){var _0x2b633a=_0x2328e3[_0x4472('0x4b')][_0x3a1666];var _0x346d4a={'id':_0x2b633a['id'],'available':_0x2b633a['available'],'loggedIn':_0x2b633a[_0x4472('0x43')],'name':_0x2b633a[_0x4472('0x47')],'paused':_0x2b633a['paused'],'waiting':_0x2b633a[_0x4472('0x45')]};_0x14d6cf[_0x4472('0x1b')](_0x346d4a);}}_0x147005({'count':_0x14d6cf[_0x4472('0x1d')],'rows':_0x14d6cf});});},'ChatQueuesWaitingInteractions':function(_0x5ee6b8){return new Promise(function(_0x1472f5,_0x574331){var _0x357aa1=_[_0x4472('0x40')](_0x2328e3[_0x4472('0x4c')]);_0x1472f5({'count':_0x357aa1['length'],'rows':_0x357aa1});});},'MailQueuesWaitingInteractions':function(_0x25d0a5){return new Promise(function(_0x5ea41e,_0x10afc3){var _0x49e14b=_[_0x4472('0x40')](_0x2328e3[_0x4472('0x4d')]);_0x5ea41e({'count':_0x49e14b[_0x4472('0x1d')],'rows':_0x49e14b});});},'OpenchannelQueuesWaitingInteractions':function(_0x233328){return new Promise(function(_0x122a22,_0x462535){var _0x52bfd4=_[_0x4472('0x40')](_0x2328e3[_0x4472('0x4e')]);_0x122a22({'count':_0x52bfd4[_0x4472('0x1d')],'rows':_0x52bfd4});});},'SmsQueuesWaitingInteractions':function(_0x270d01){return new Promise(function(_0x3f9df8,_0xa4a147){var _0x509749=_[_0x4472('0x40')](_0x2328e3[_0x4472('0x4f')]);_0x3f9df8({'count':_0x509749[_0x4472('0x1d')],'rows':_0x509749});});},'FaxQueuesWaitingInteractions':function(_0x2f0dcd){return new Promise(function(_0x4cd6b7,_0x100d79){var _0x3a5766=_[_0x4472('0x40')](_0x2328e3['faxQueuesWaitingInteractions']);_0x4cd6b7({'count':_0x3a5766[_0x4472('0x1d')],'rows':_0x3a5766});});},'WhatsappQueuesWaitingInteractions':function(_0x24248c){return new Promise(function(_0x2ced72,_0x10105a){var _0x305d55=_[_0x4472('0x40')](_0x2328e3[_0x4472('0x50')]);_0x2ced72({'count':_0x305d55[_0x4472('0x1d')],'rows':_0x305d55});});}};var _0x35a36c=jayson[_0x4472('0x51')](_0x154788)[_0x4472('0x52')]();_0x35a36c['on'](_0x4472('0x2a'),function(_0x2e94b3){logger['error'](JSON['stringify'](_0x2e94b3));return _0x359483(_0x2e94b3);});_0x35a36c[_0x4472('0x10')](0x232c,_0x4472('0x53'),function(){console[_0x4472('0x54')](_0x4472('0x55'),0x232c);return _0x255ad7(_0x4472('0x56')+0x232c);});});}; \ No newline at end of file +var _0x2c22=['hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','mailQueues','paused','openchannelQueues','smsQueues','faxQueues','waiting','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','stringify','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','uuid','../../../config/environment','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','%s.%s.%s','IntervalId','isNil','Intervals','interval','listen','rules','channel','message','interaction','isArray','applications','length','join','app','toLowerCase','autoreply','push','dialogflow','appdata','split','slice','format','%s:%s:%s','./interval','condition','intervals','priority','info','Push\x20new\x20rule','on\x20interval','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','end','QueueReport','update','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','busy','busyQueue'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x2c22,0x74));var _0x22c2=function(_0x52fb3d,_0xdcf058){_0x52fb3d=_0x52fb3d-0x0;var _0x28eca5=_0x2c22[_0x52fb3d];return _0x28eca5;};'use strict';var _=require(_0x22c2('0x0'));var util=require('util');var path=require('path');var fs=require('fs');var jayson=require(_0x22c2('0x1'));var BPromise=require('bluebird');var uuid=require(_0x22c2('0x2'));var config=require(_0x22c2('0x3'));var logger=require(_0x22c2('0x4'))('routing');var rpc={'openchannelQueueReport':require(_0x22c2('0x5')),'mailQueueReport':require(_0x22c2('0x6')),'chatQueueReport':require(_0x22c2('0x7')),'smsQueueReport':require(_0x22c2('0x8')),'faxQueueReport':require(_0x22c2('0x9')),'whatsappQueueReport':require(_0x22c2('0xa'))};var RuleEngine=require(_0x22c2('0xb'));function getId(_0x4b098a,_0x22142a,_0x35ae33){return util['format'](_0x22c2('0xc'),_0x4b098a,_0x22142a||0x0,_0x35ae33||0x0);}function getIntervals(_0x5372bf,_0x12c68c){var _0x3fba18=[];if(!_['isNil'](_0x12c68c[_0x22c2('0xd')])&&!_[_0x22c2('0xe')](_0x5372bf[_0x12c68c[_0x22c2('0xd')]])&&!_[_0x22c2('0xe')](_0x5372bf[_0x12c68c[_0x22c2('0xd')]][_0x22c2('0xf')])){_0x3fba18=_['map'](_0x5372bf[_0x12c68c[_0x22c2('0xd')]]['Intervals'],'interval');}else if(!_[_0x22c2('0xe')](_0x12c68c[_0x22c2('0x10')])){_0x3fba18=[_0x12c68c[_0x22c2('0x10')]];}return _0x3fba18;}exports[_0x22c2('0x11')]=function(_0x2034cc){_0x2034cc[_0x22c2('0x12')]={};return new BPromise(function(_0x12c668,_0x554ade){var _0x14ebf6={'Start':function(_0x43fbda){var _0x2fa2c9=this;return new Promise(function(_0x5d219c,_0x1a2b3c){if(_0x43fbda){try{var _0x4fa01d=[];var _0x18fdd6=getId(_0x43fbda[_0x22c2('0x13')],_0x43fbda[_0x22c2('0x14')]?_0x43fbda[_0x22c2('0x14')]['id']:0x0,_0x43fbda[_0x22c2('0x15')]?_0x43fbda[_0x22c2('0x15')]['id']:0x0);if(_0x43fbda['applications']&&_[_0x22c2('0x16')](_0x43fbda[_0x22c2('0x17')])&&_0x43fbda['applications']['length']){for(var _0x4aaf96=0x0;_0x4aaf96<_0x43fbda[_0x22c2('0x17')][_0x22c2('0x18')];_0x4aaf96+=0x1){var _0x458dad=_0x43fbda[_0x22c2('0x17')][_0x4aaf96];if(fs['existsSync'](path[_0x22c2('0x19')](__dirname,_0x22c2('0x17'),_0x458dad[_0x22c2('0x1a')]+'.js'))){var _0x4a2424=[];switch(_0x458dad[_0x22c2('0x1a')][_0x22c2('0x1b')]()){case _0x22c2('0x1c'):var _0x56fcfe=_0x458dad['appdata']['split'](',');_0x4a2424['push'](_0x56fcfe[0x0]);_0x4a2424[_0x22c2('0x1d')](_0x56fcfe['slice'](0x1,_0x56fcfe['length'])['join'](','));break;case _0x22c2('0x1e'):var _0x25c787=_0x458dad[_0x22c2('0x1f')][_0x22c2('0x20')](',');_0x4a2424[_0x22c2('0x1d')](_0x25c787[0x0]);_0x4a2424['push'](_0x25c787[0x1]);_0x4a2424[_0x22c2('0x1d')](_0x25c787[_0x22c2('0x21')](0x2,_0x25c787[_0x22c2('0x18')])['join'](','));break;case'amazonlex':var _0x49eed1=_0x458dad['appdata'][_0x22c2('0x20')](',');_0x4a2424['push'](_0x49eed1[0x0]);_0x4a2424[_0x22c2('0x1d')](_0x49eed1[0x1]);_0x4a2424[_0x22c2('0x1d')](_0x49eed1[0x2]);_0x4a2424[_0x22c2('0x1d')](_0x49eed1[0x3]);_0x4a2424[_0x22c2('0x1d')](_0x49eed1[_0x22c2('0x21')](0x4,_0x49eed1[_0x22c2('0x18')])[_0x22c2('0x19')](','));break;case _0x22c2('0x14'):_0x4a2424[_0x22c2('0x1d')](_0x458dad[_0x22c2('0x1f')]);break;case'tag':_0x4a2424['push'](_0x458dad['TagId']);_0x4a2424[_0x22c2('0x1d')](_0x458dad['appdata']);break;default:_0x4a2424=_[_0x22c2('0xe')](_0x458dad['appdata'])?[]:_0x458dad[_0x22c2('0x1f')]['split'](',');}var _0x28f716={'id':util[_0x22c2('0x22')](_0x22c2('0x23'),_0x18fdd6,_0x458dad['id'],_0x458dad[_0x22c2('0x1a')]),'condition':require(_0x22c2('0x24'))[_0x22c2('0x25')](_0x18fdd6,getIntervals(_0x2034cc[_0x22c2('0x26')],_0x458dad),_0x2034cc),'consequence':require('./applications/'+_0x458dad['app'])['consequence'](_0x18fdd6,_0x4a2424,_0x2034cc,_0x43fbda),'p':_0x458dad[_0x22c2('0x27')]||0x0};logger[_0x22c2('0x28')](_0x22c2('0x29'),_0x28f716['id'],_0x22c2('0x2a'),getIntervals(_0x2034cc[_0x22c2('0x26')],_0x458dad)[_0x22c2('0x19')]('\x20|\x20'));_0x4fa01d[_0x22c2('0x1d')](_0x28f716);}else{logger[_0x22c2('0x2b')](_0x22c2('0x2c'),path[_0x22c2('0x19')](__dirname,_0x22c2('0x17'),_0x458dad[_0x22c2('0x1a')]+'.js'));}}_0x2034cc[_0x22c2('0x12')][_0x18fdd6]=new RuleEngine(_0x4fa01d);_0x2034cc[_0x22c2('0x12')][_0x18fdd6][_0x22c2('0x2d')](_0x43fbda,function(_0x1f92a3){logger['info'](_0x22c2('0x2e'),JSON['stringify'](_0x1f92a3[_0x22c2('0x2f')]));if(_0x2034cc[_0x22c2('0x12')][_0x18fdd6]){_0x2034cc[_0x22c2('0x12')][_0x18fdd6][_0x22c2('0x30')](_0x22c2('0x31'));}});return _0x5d219c({'code':0xc8,'message':_0x43fbda});}else{logger[_0x22c2('0x28')](_0x22c2('0x32'));return _0x5d219c({'code':0xc8,'message':_0x43fbda});}}catch(_0x5777f3){logger[_0x22c2('0x2b')](_0x5777f3[_0x22c2('0x33')]);return _0x1a2b3c(_0x2fa2c9['error'](0x1f4,_0x5777f3));}}return _0x1a2b3c('routing\x20is\x20empty');});},'AcceptMessage':function(_0xd5911b){var _0x4075d5=this;return new Promise(function(_0x12f55d,_0xb509be){if(_0xd5911b[_0x22c2('0x14')]&&_0xd5911b['message']['id']){try{var _0x1b025a=getId(_0xd5911b[_0x22c2('0x13')],_0xd5911b['message']?_0xd5911b[_0x22c2('0x14')]['id']:0x0,_0xd5911b[_0x22c2('0x15')]?_0xd5911b['interaction']['id']:0x0);if(_0x2034cc['rules'][_0x1b025a]){_0x2034cc[_0x22c2('0x12')][_0x1b025a][_0x22c2('0x30')](_0x22c2('0x34'));if(rpc[_0xd5911b['channel']+_0x22c2('0x35')]){rpc[_0xd5911b[_0x22c2('0x13')]+_0x22c2('0x35')][_0x22c2('0x36')](_0x1b025a,{'UserId':_0xd5911b['message'][_0x22c2('0x37')]})['catch'](function(_0x17e64b){logger[_0x22c2('0x2b')](_0x22c2('0x38'));});}}return _0x12f55d({'code':0xc8,'message':_0xd5911b});}catch(_0x920a57){logger[_0x22c2('0x2b')](_0x920a57['stack']);return _0xb509be(_0x4075d5[_0x22c2('0x2b')](0x1f4,_0x920a57));}}logger[_0x22c2('0x2b')](_0x22c2('0x39'));return _0xb509be(_0x4075d5['error'](0x1f4,_0x22c2('0x39')));});},'RejectMessage':function(_0x533d95){var _0x1930ee=this;return new Promise(function(_0x151490,_0x16f50c){if(_0x533d95[_0x22c2('0x3a')]&&_0x533d95[_0x22c2('0x3a')]['id']){try{if(_0x2034cc[_0x22c2('0x3b')][_0x533d95[_0x22c2('0x3a')]['id']]){_0x2034cc[_0x22c2('0x3b')][_0x533d95[_0x22c2('0x3a')]['id']][_0x22c2('0x3c')]=![];_0x2034cc[_0x22c2('0x3b')][_0x533d95[_0x22c2('0x3a')]['id']][_0x22c2('0x3d')]=undefined;}return _0x151490({'code':0xc8,'message':_0x533d95});}catch(_0x146c97){logger['error'](_0x146c97[_0x22c2('0x33')]);return _0x16f50c(_0x1930ee['error'](0x1f4,_0x146c97));}}logger[_0x22c2('0x2b')]('message\x20is\x20empty');return _0x16f50c(_0x1930ee['error'](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x7e5d5e){var _0x9038ab=this;return new Promise(function(_0x149baf,_0x434169){if(_0x7e5d5e[_0x22c2('0x13')]&&_0x7e5d5e['interaction']&&_0x7e5d5e[_0x22c2('0x15')]['id']){try{var _0x47b4b4=getId(_0x7e5d5e[_0x22c2('0x13')],_0x7e5d5e[_0x22c2('0x14')]?_0x7e5d5e[_0x22c2('0x14')]['id']:0x0,_0x7e5d5e['interaction']?_0x7e5d5e[_0x22c2('0x15')]['id']:0x0);if(_0x2034cc[_0x22c2('0x12')][_0x47b4b4]){_0x2034cc[_0x22c2('0x12')][_0x47b4b4][_0x22c2('0x30')]('end');}return _0x149baf({'code':0xc8,'message':_0x7e5d5e});}catch(_0x5ca285){logger[_0x22c2('0x2b')](_0x5ca285[_0x22c2('0x33')]);return _0x434169(_0x9038ab['error'](0x1f4,_0x5ca285));}}logger['error'](_0x22c2('0x39'));return _0x434169(_0x9038ab[_0x22c2('0x2b')](0x1f4,_0x22c2('0x39')));});},'AgentCapacity':function(_0x52eaf1){var _0x3e0c79=this;return new Promise(function(_0x37186e,_0x18e1c6){if(_0x2034cc[_0x22c2('0x3b')][_0x22c2('0x3e')](_0x52eaf1['id'])){for(var _0x2d903d in _0x52eaf1[_0x22c2('0x3f')]){if(_0x52eaf1['capacity'][_0x22c2('0x3e')](_0x2d903d)){if(_0x2034cc[_0x22c2('0x3b')][_0x52eaf1['id']][_0x22c2('0x3e')](_0x2d903d+_0x22c2('0x40'))){_0x2034cc[_0x22c2('0x3b')][_0x52eaf1['id']][_0x2d903d+_0x22c2('0x40')]=parseInt(_0x52eaf1[_0x22c2('0x3f')][_0x2d903d],0xa);}}}_0x2034cc['agents'][_0x52eaf1['id']][_0x22c2('0x41')]();return _0x37186e({'code':0xc8,'message':_0x2034cc['agents'][_0x52eaf1['id']]});}else{return _0x18e1c6(_0x3e0c79[_0x22c2('0x2b')](0x1f4,_0x22c2('0x42')));}});},'Agents':function(_0x4ec77b){return new Promise(function(_0x4b1189,_0xa7cd4b){var _0x4fa863=_[_0x22c2('0x43')](_0x2034cc[_0x22c2('0x3b')]);_0x4b1189({'count':_0x4fa863[_0x22c2('0x18')],'rows':_0x4fa863});});},'ChatQueues':function(_0xb8952){return new Promise(function(_0x36c9b9,_0x8cc4a2){var _0x1f06f8=[];for(var _0x47a56e in _0x2034cc['chatQueues']){if(_0x2034cc[_0x22c2('0x44')]['hasOwnProperty'](_0x47a56e)){var _0x16f558=_0x2034cc['chatQueues'][_0x47a56e];var _0x41d788={'id':_0x16f558['id'],'available':_0x16f558[_0x22c2('0x45')],'loggedIn':_0x16f558[_0x22c2('0x46')],'name':_0x16f558[_0x22c2('0x47')],'paused':_0x16f558['paused'],'waiting':_0x16f558['waiting']};_0x1f06f8[_0x22c2('0x1d')](_0x41d788);}}_0x36c9b9({'count':_0x1f06f8['length'],'rows':_0x1f06f8});});},'MailQueues':function(_0x4b51d7){return new Promise(function(_0x50d091,_0x11fe81){var _0x1dc59c=[];for(var _0x343e93 in _0x2034cc[_0x22c2('0x48')]){if(_0x2034cc[_0x22c2('0x48')][_0x22c2('0x3e')](_0x343e93)){var _0xec2fd8=_0x2034cc[_0x22c2('0x48')][_0x343e93];var _0xb4d4e3={'id':_0xec2fd8['id'],'available':_0xec2fd8[_0x22c2('0x45')],'loggedIn':_0xec2fd8['loggedIn'],'name':_0xec2fd8[_0x22c2('0x47')],'paused':_0xec2fd8[_0x22c2('0x49')],'waiting':_0xec2fd8['waiting']};_0x1dc59c[_0x22c2('0x1d')](_0xb4d4e3);}}_0x50d091({'count':_0x1dc59c[_0x22c2('0x18')],'rows':_0x1dc59c});});},'OpenchannelQueues':function(_0x1b0f01){return new Promise(function(_0x469f55,_0x3437fd){var _0x2e4184=[];for(var _0x2f96bc in _0x2034cc['openchannelQueues']){if(_0x2034cc['openchannelQueues'][_0x22c2('0x3e')](_0x2f96bc)){var _0x3e22c=_0x2034cc[_0x22c2('0x4a')][_0x2f96bc];var _0x58d2c1={'id':_0x3e22c['id'],'available':_0x3e22c[_0x22c2('0x45')],'loggedIn':_0x3e22c[_0x22c2('0x46')],'name':_0x3e22c['name'],'paused':_0x3e22c[_0x22c2('0x49')],'waiting':_0x3e22c['waiting']};_0x2e4184['push'](_0x58d2c1);}}_0x469f55({'count':_0x2e4184[_0x22c2('0x18')],'rows':_0x2e4184});});},'SmsQueues':function(_0x32ce20){return new Promise(function(_0x3da1fa,_0xe872d2){var _0xb7450a=[];for(var _0x289bd8 in _0x2034cc[_0x22c2('0x4b')]){if(_0x2034cc[_0x22c2('0x4b')][_0x22c2('0x3e')](_0x289bd8)){var _0x1007ae=_0x2034cc[_0x22c2('0x4b')][_0x289bd8];var _0x1899bc={'id':_0x1007ae['id'],'available':_0x1007ae[_0x22c2('0x45')],'loggedIn':_0x1007ae[_0x22c2('0x46')],'name':_0x1007ae[_0x22c2('0x47')],'paused':_0x1007ae[_0x22c2('0x49')],'waiting':_0x1007ae['waiting']};_0xb7450a[_0x22c2('0x1d')](_0x1899bc);}}_0x3da1fa({'count':_0xb7450a[_0x22c2('0x18')],'rows':_0xb7450a});});},'FaxQueues':function(_0x2461c7){return new Promise(function(_0x123871,_0x4a90f1){var _0x377593=[];for(var _0x296fdc in _0x2034cc[_0x22c2('0x4c')]){if(_0x2034cc[_0x22c2('0x4c')][_0x22c2('0x3e')](_0x296fdc)){var _0x5a5bca=_0x2034cc['faxQueues'][_0x296fdc];var _0x15ccab={'id':_0x5a5bca['id'],'available':_0x5a5bca[_0x22c2('0x45')],'loggedIn':_0x5a5bca[_0x22c2('0x46')],'name':_0x5a5bca[_0x22c2('0x47')],'paused':_0x5a5bca[_0x22c2('0x49')],'waiting':_0x5a5bca[_0x22c2('0x4d')]};_0x377593[_0x22c2('0x1d')](_0x15ccab);}}_0x123871({'count':_0x377593['length'],'rows':_0x377593});});},'WhatsappQueues':function(_0xad3124){return new Promise(function(_0x4a9310,_0x4dc152){var _0x3b0847=[];for(var _0x13ebc9 in _0x2034cc[_0x22c2('0x4e')]){if(_0x2034cc['whatsappQueues']['hasOwnProperty'](_0x13ebc9)){var _0x191cf2=_0x2034cc['whatsappQueues'][_0x13ebc9];var _0x3c6cfc={'id':_0x191cf2['id'],'available':_0x191cf2[_0x22c2('0x45')],'loggedIn':_0x191cf2[_0x22c2('0x46')],'name':_0x191cf2['name'],'paused':_0x191cf2['paused'],'waiting':_0x191cf2[_0x22c2('0x4d')]};_0x3b0847[_0x22c2('0x1d')](_0x3c6cfc);}}_0x4a9310({'count':_0x3b0847['length'],'rows':_0x3b0847});});},'ChatQueuesWaitingInteractions':function(_0x492c82){return new Promise(function(_0x1df746,_0xad285c){var _0x100d87=_[_0x22c2('0x43')](_0x2034cc[_0x22c2('0x4f')]);_0x1df746({'count':_0x100d87[_0x22c2('0x18')],'rows':_0x100d87});});},'MailQueuesWaitingInteractions':function(_0x4ece24){return new Promise(function(_0x593d6e,_0x536789){var _0x1374d5=_[_0x22c2('0x43')](_0x2034cc['mailQueuesWaitingInteractions']);_0x593d6e({'count':_0x1374d5['length'],'rows':_0x1374d5});});},'OpenchannelQueuesWaitingInteractions':function(_0x3a154d){return new Promise(function(_0x22dcd9,_0x5d3a2d){var _0x1dbe27=_[_0x22c2('0x43')](_0x2034cc[_0x22c2('0x50')]);_0x22dcd9({'count':_0x1dbe27[_0x22c2('0x18')],'rows':_0x1dbe27});});},'SmsQueuesWaitingInteractions':function(_0x495db4){return new Promise(function(_0x365363,_0x35b85e){var _0x27fb90=_[_0x22c2('0x43')](_0x2034cc['smsQueuesWaitingInteractions']);_0x365363({'count':_0x27fb90[_0x22c2('0x18')],'rows':_0x27fb90});});},'FaxQueuesWaitingInteractions':function(_0x1f322f){return new Promise(function(_0x4bf974,_0x148175){var _0x3063f8=_[_0x22c2('0x43')](_0x2034cc[_0x22c2('0x51')]);_0x4bf974({'count':_0x3063f8['length'],'rows':_0x3063f8});});},'WhatsappQueuesWaitingInteractions':function(_0x1a3add){return new Promise(function(_0x16c6f2,_0x3a8655){var _0x381239=_[_0x22c2('0x43')](_0x2034cc[_0x22c2('0x52')]);_0x16c6f2({'count':_0x381239[_0x22c2('0x18')],'rows':_0x381239});});}};var _0x475c9f=jayson[_0x22c2('0x53')](_0x14ebf6)[_0x22c2('0x54')]();_0x475c9f['on'](_0x22c2('0x2b'),function(_0x359475){logger[_0x22c2('0x2b')](JSON[_0x22c2('0x55')](_0x359475));return _0x554ade(_0x359475);});_0x475c9f['listen'](0x232c,_0x22c2('0x56'),function(){console['log'](_0x22c2('0x57'),0x232c);return _0x12c668(_0x22c2('0x58')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 6f3ee70..13586cd 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 _0x51b5=['condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s','message','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','util','bluebird','jayson/promise','lodash','../../../config/logger','client','http','then','error','result','catch'];(function(_0x446d6d,_0x5aa756){var _0x22364d=function(_0x4322f3){while(--_0x4322f3){_0x446d6d['push'](_0x446d6d['shift']());}};_0x22364d(++_0x5aa756);}(_0x51b5,0x135));var _0x551b=function(_0xfdb14f,_0x49d076){_0xfdb14f=_0xfdb14f-0x0;var _0x37daa7=_0x51b5[_0xfdb14f];return _0x37daa7;};'use strict';var util=require(_0x551b('0x0'));var BPromise=require(_0x551b('0x1'));var jayson=require(_0x551b('0x2'));var _=require(_0x551b('0x3'));var logger=require(_0x551b('0x4'))('routing');var client=jayson[_0x551b('0x5')][_0x551b('0x6')]({'port':0x232a});function request(_0x59a71e,_0x31f86c){return new BPromise(function(_0x581e8b,_0x3f4bc5){return client['request'](_0x59a71e,_0x31f86c)[_0x551b('0x7')](function(_0x32e1f8){if(_0x32e1f8['error']){return _0x3f4bc5(_0x32e1f8[_0x551b('0x8')]['message']);}else{return _0x581e8b(_0x32e1f8[_0x551b('0x9')]);}})[_0x551b('0xa')](function(_0x2893df){return _0x3f4bc5(_0x2893df);});});}exports[_0x551b('0xb')]=function(_0x5df08d,_0x1575e1,_0x29bcc8){return function(_0x848a61){if(_0x29bcc8[_0x551b('0xc')]&&!_0x29bcc8[_0x551b('0xc')][_0x5df08d]){logger[_0x551b('0xd')](_0x551b('0xe'),_0x5df08d);return _0x848a61[_0x551b('0xf')]();}var _0x53ff4c=[];for(var _0x1c596e=0x0;_0x1c596e<_0x1575e1[_0x551b('0x10')];_0x1c596e+=0x1){_0x53ff4c[_0x551b('0x11')](request(_0x551b('0x12'),{'command':util[_0x551b('0x13')](_0x551b('0x14'),_0x1575e1[_0x1c596e])})[_0x551b('0x7')](function(_0x1925b9){return _0x1925b9&&_0x1925b9[_0x551b('0x15')]&&_0x1925b9['message'][_0x551b('0x16')](_0x551b('0x17'))>=0x0?!![]:![];})[_0x551b('0xa')](function(_0x5d532b){logger['error'](_0x551b('0x18'),_0x5df08d,_0x1575e1[_0x1c596e]);}));}BPromise[_0x551b('0x19')](_0x53ff4c)[_0x551b('0x7')](function(_0x15822a){var _0x32fad2=_[_0x551b('0x1a')](_0x15822a);logger[_0x551b('0xd')](_0x551b('0x1b'),_0x5df08d,_0x1575e1[_0x551b('0x1c')](_0x551b('0x1d')),_0x32fad2);_0x848a61[_0x551b('0x1e')](_0x32fad2);})[_0x551b('0xa')](function(_0x15d715){console[_0x551b('0x1f')](_0x15d715);logger[_0x551b('0x8')](_0x551b('0x1b'),_0x5df08d,_0x1575e1[_0x551b('0x1c')](_0x551b('0x1d')),_0x15d715['stack']);_0x848a61[_0x551b('0xf')]();});};}; \ No newline at end of file +var _0x4219=['rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','format','iftime\x20%s','indexOf','true','catch','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','when','log','join','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','http','then','error','message'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0x4219,0x1a9));var _0x9421=function(_0x568cb0,_0x1cbc08){_0x568cb0=_0x568cb0-0x0;var _0x2ae280=_0x4219[_0x568cb0];return _0x2ae280;};'use strict';var util=require(_0x9421('0x0'));var BPromise=require(_0x9421('0x1'));var jayson=require(_0x9421('0x2'));var _=require(_0x9421('0x3'));var logger=require(_0x9421('0x4'))(_0x9421('0x5'));var client=jayson['client'][_0x9421('0x6')]({'port':0x232a});function request(_0x581b8e,_0x3f3822){return new BPromise(function(_0x1559ff,_0x230812){return client['request'](_0x581b8e,_0x3f3822)[_0x9421('0x7')](function(_0x57e2a7){if(_0x57e2a7[_0x9421('0x8')]){return _0x230812(_0x57e2a7[_0x9421('0x8')][_0x9421('0x9')]);}else{return _0x1559ff(_0x57e2a7['result']);}})['catch'](function(_0x35072c){return _0x230812(_0x35072c);});});}exports['condition']=function(_0xe3d302,_0x440736,_0x3f4911){return function(_0x558dac){if(_0x3f4911[_0x9421('0xa')]&&!_0x3f4911[_0x9421('0xa')][_0xe3d302]){logger[_0x9421('0xb')](_0x9421('0xc'),_0xe3d302);return _0x558dac['stop']();}var _0x3b9f9c=[];for(var _0x220c79=0x0;_0x220c79<_0x440736[_0x9421('0xd')];_0x220c79+=0x1){_0x3b9f9c[_0x9421('0xe')](request('Command',{'command':util[_0x9421('0xf')](_0x9421('0x10'),_0x440736[_0x220c79])})[_0x9421('0x7')](function(_0x2ad79c){return _0x2ad79c&&_0x2ad79c['message']&&_0x2ad79c[_0x9421('0x9')][_0x9421('0x11')](_0x9421('0x12'))>=0x0?!![]:![];})[_0x9421('0x13')](function(_0x4fe546){logger[_0x9421('0x8')](_0x9421('0x14'),_0xe3d302,_0x440736[_0x220c79]);}));}BPromise[_0x9421('0x15')](_0x3b9f9c)[_0x9421('0x7')](function(_0x5bea42){var _0x39cb2f=_[_0x9421('0x16')](_0x5bea42);logger[_0x9421('0xb')](_0x9421('0x17'),_0xe3d302,_0x440736['join'](_0x9421('0x18')),_0x39cb2f);_0x558dac[_0x9421('0x19')](_0x39cb2f);})[_0x9421('0x13')](function(_0x3da51b){console[_0x9421('0x1a')](_0x3da51b);logger[_0x9421('0x8')]('[%s][INTERVAL]\x20%s\x20%s',_0xe3d302,_0x440736[_0x9421('0x1b')](_0x9421('0x18')),_0x3da51b[_0x9421('0x1c')]);_0x558dac['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 793d382..a6bfed5 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 _0xaf8e=['rejected','indexOf','splice','agent','complete','lodash','util','info','format','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','queue','membername','calleridnum','connectedlinenum','lastevent','type','agentcomplete','acw','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','agentcalledAt','now','called','connectedlinename','error','stack','agentringnoanswer','isNil','agentringnoanswerAt','timeout','ringtime','talktime','push','queuecallerabandon','includes','abandoned','reason','holdtime','agentconnect','agentconnectAt','connect','forIn','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','diffTime','agentcompleteAt','blindtransfer','transfereruniqueid','transfer','transfertype','transferexten','extension','transferuniqueid','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','ATTENDED','transfertargetuniqueid'];(function(_0x867b4a,_0x1441ca){var _0x1260f4=function(_0xae9a96){while(--_0xae9a96){_0x867b4a['push'](_0x867b4a['shift']());}};_0x1260f4(++_0x1441ca);}(_0xaf8e,0x95));var _0xeaf8=function(_0x12cc8f,_0x342dee){_0x12cc8f=_0x12cc8f-0x0;var _0x2e2c9e=_0xaf8e[_0x12cc8f];return _0x2e2c9e;};'use strict';var _=require(_0xeaf8('0x0'));var util=require(_0xeaf8('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x58f12d,_0x1cdeb5){utils[_0xeaf8('0x2')](util[_0xeaf8('0x3')](_0xeaf8('0x4'),_0x58f12d[_0xeaf8('0x5')],_0x58f12d[_0xeaf8('0x6')],_0x58f12d[_0xeaf8('0x7')],_0x58f12d[_0xeaf8('0x8')],_0x58f12d['interface'],_0x58f12d[_0xeaf8('0x9')],_0x58f12d[_0xeaf8('0xa')],_0x58f12d[_0xeaf8('0xb')]));if(_0x58f12d[_0xeaf8('0x7')]){utils['getVoiceQueueByName'](_0x58f12d[_0xeaf8('0x7')])['then'](function(_0x24441a){if(_0x24441a){_0x58f12d[_0xeaf8('0xc')]=_0x24441a['type'];_0x58f12d['agentacw']=_0x58f12d[_0xeaf8('0xd')]?_0x24441a[_0xeaf8('0xe')]:![];_0x58f12d[_0xeaf8('0xf')]=_0x58f12d[_0xeaf8('0x10')]?_0x24441a[_0xeaf8('0x11')]:0x0;}utils[_0xeaf8('0x12')](_0xeaf8('0x13'),_0x58f12d);});}else{utils['request'](_0xeaf8('0x13'),_0x58f12d);}if(_0x1cdeb5){delete transfers[_0x58f12d[_0xeaf8('0x5')]];}else{delete agents[_0x58f12d[_0xeaf8('0x14')]];}}exports[_0xeaf8('0x15')]=function(_0x5ca90e){try{agents[_0x5ca90e['destuniqueid']]=_0x5ca90e;agents[_0x5ca90e[_0xeaf8('0x14')]][_0xeaf8('0x16')]=utils[_0xeaf8('0x17')]();agents[_0x5ca90e['destuniqueid']][_0xeaf8('0xb')]=_0xeaf8('0x18');agents[_0x5ca90e[_0xeaf8('0x14')]][_0xeaf8('0xa')]=null;agents[_0x5ca90e[_0xeaf8('0x14')]][_0xeaf8('0x19')]=null;}catch(_0x45c7bb){utils[_0xeaf8('0x1a')](_0x45c7bb[_0xeaf8('0x1b')]);}};exports[_0xeaf8('0x1c')]=function(_0x3cf307){try{if(!_[_0xeaf8('0x1d')](agents[_0x3cf307[_0xeaf8('0x14')]])){agents[_0x3cf307[_0xeaf8('0x14')]][_0xeaf8('0x1c')]=!![];agents[_0x3cf307[_0xeaf8('0x14')]][_0xeaf8('0x1e')]=utils['now']();agents[_0x3cf307[_0xeaf8('0x14')]][_0xeaf8('0xb')]=_0xeaf8('0x1f');agents[_0x3cf307[_0xeaf8('0x14')]]['reason']='timeout';agents[_0x3cf307[_0xeaf8('0x14')]]['holdtime']=_0x3cf307[_0xeaf8('0x20')]?parseInt(_0x3cf307['ringtime'])/0x3e8:0x0;agents[_0x3cf307[_0xeaf8('0x14')]][_0xeaf8('0x21')]=0x0;unanswered[_0xeaf8('0x22')](_0x3cf307['destuniqueid']);}}catch(_0x2e4d27){utils[_0xeaf8('0x1a')](_0x2e4d27['stack']);}};exports[_0xeaf8('0x23')]=function(_0x8da0c7){try{_['forIn'](agents,function(_0x500435,_0x50aa9e){if(_0x500435[_0xeaf8('0x5')]==_0x8da0c7[_0xeaf8('0x5')]&&!_[_0xeaf8('0x24')](unanswered,_0x500435[_0xeaf8('0x14')])){_0x500435[_0xeaf8('0x1c')]=!![];_0x500435['agentringnoanswerAt']=utils[_0xeaf8('0x17')]();_0x500435['lastevent']=_0xeaf8('0x25');_0x500435[_0xeaf8('0x26')]='abandoned';_0x500435[_0xeaf8('0x27')]=_0x8da0c7['holdtime'];_0x500435[_0xeaf8('0x21')]=0x0;writeDB(_0x500435);}});}catch(_0x3e6caf){utils[_0xeaf8('0x1a')](_0x3e6caf[_0xeaf8('0x1b')]);}};exports[_0xeaf8('0x28')]=function(_0x3fab53){try{if(agents[_0x3fab53[_0xeaf8('0x14')]]){agents[_0x3fab53['destuniqueid']][_0xeaf8('0x29')]=utils[_0xeaf8('0x17')]();agents[_0x3fab53[_0xeaf8('0x14')]][_0xeaf8('0xa')]=_0x3fab53['connectedlinenum'];agents[_0x3fab53['destuniqueid']][_0xeaf8('0x19')]=_0x3fab53['connectedlinename'];agents[_0x3fab53[_0xeaf8('0x14')]]['holdtime']=_0x3fab53[_0xeaf8('0x20')];agents[_0x3fab53['destuniqueid']]['lastevent']=_0xeaf8('0x2a');_[_0xeaf8('0x2b')](agents,function(_0xb5c8ba,_0x2e2428){if(_0xb5c8ba['destuniqueid']!=_0x3fab53[_0xeaf8('0x14')]&&_0xb5c8ba[_0xeaf8('0x5')]==_0x3fab53['uniqueid']){_0xb5c8ba[_0xeaf8('0x21')]=0x0;_0xb5c8ba['holdtime']=_0x3fab53[_0xeaf8('0x20')];_0xb5c8ba[_0xeaf8('0x1c')]=!![];_0xb5c8ba[_0xeaf8('0x1e')]=utils[_0xeaf8('0x17')]();_0xb5c8ba[_0xeaf8('0xb')]=_0xeaf8('0x2c');_0xb5c8ba[_0xeaf8('0x26')]=_0xeaf8('0x2c');_0xb5c8ba[_0xeaf8('0x2d')]=_0x3fab53[_0xeaf8('0x14')];_0xb5c8ba[_0xeaf8('0x2e')]=_0x3fab53['membername'];writeDB(_0xb5c8ba);}});}}catch(_0x122751){utils['error'](_0x122751[_0xeaf8('0x1b')]);}};exports[_0xeaf8('0xd')]=function(_0x33a886){try{if(!_['isNil'](agents[_0x33a886[_0xeaf8('0x14')]])){agents[_0x33a886[_0xeaf8('0x14')]]['agentcomplete']=!![];agents[_0x33a886[_0xeaf8('0x14')]]['agentcompleteAt']=utils[_0xeaf8('0x17')]();agents[_0x33a886[_0xeaf8('0x14')]][_0xeaf8('0x21')]=utils[_0xeaf8('0x2f')](agents[_0x33a886[_0xeaf8('0x14')]][_0xeaf8('0x30')],agents[_0x33a886[_0xeaf8('0x14')]][_0xeaf8('0x29')]);agents[_0x33a886[_0xeaf8('0x14')]][_0xeaf8('0x26')]=_0x33a886[_0xeaf8('0x26')];agents[_0x33a886[_0xeaf8('0x14')]]['lastevent']='complete';writeDB(agents[_0x33a886[_0xeaf8('0x14')]]);}}catch(_0x21c8c3){utils[_0xeaf8('0x1a')](_0x21c8c3[_0xeaf8('0x1b')]);}};exports[_0xeaf8('0x31')]=function(_0x2d8d39){try{if(!_[_0xeaf8('0x1d')](agents[_0x2d8d39[_0xeaf8('0x32')]])){agents[_0x2d8d39[_0xeaf8('0x32')]][_0xeaf8('0x33')]=!![];agents[_0x2d8d39[_0xeaf8('0x32')]][_0xeaf8('0x34')]='blind';agents[_0x2d8d39['transfereruniqueid']][_0xeaf8('0x35')]=_0x2d8d39[_0xeaf8('0x36')];agents[_0x2d8d39[_0xeaf8('0x32')]][_0xeaf8('0x37')]=agents[_0x2d8d39[_0xeaf8('0x32')]][_0xeaf8('0x5')];}}catch(_0x58b145){utils[_0xeaf8('0x1a')](_0x58b145['stack']);}};exports['attendedtransfer']=function(_0xc9756f){try{if(_0xc9756f[_0xeaf8('0x38')]==_0xc9756f[_0xeaf8('0x39')]){if(!_['isNil'](agents[_0xc9756f['secondtransfereruniqueid']])){agents[_0xc9756f[_0xeaf8('0x3a')]][_0xeaf8('0x33')]=!![];agents[_0xc9756f[_0xeaf8('0x3a')]][_0xeaf8('0x34')]='ATTENDED';agents[_0xc9756f[_0xeaf8('0x3a')]][_0xeaf8('0x35')]=_0xc9756f[_0xeaf8('0x3b')];agents[_0xc9756f[_0xeaf8('0x3a')]][_0xeaf8('0x37')]=_0xc9756f[_0xeaf8('0x38')];}if(_0xc9756f[_0xeaf8('0x3c')]&&agents[_0xc9756f[_0xeaf8('0x3c')]]){agents[_0xc9756f[_0xeaf8('0x3c')]][_0xeaf8('0x3d')]=0x1;transfers[_0xc9756f[_0xeaf8('0x3c')]]=_[_0xeaf8('0x3e')](agents[_0xc9756f[_0xeaf8('0x3c')]]);transfers[_0xc9756f[_0xeaf8('0x3c')]][_0xeaf8('0x9')]=agents[_0xc9756f[_0xeaf8('0x3a')]][_0xeaf8('0x9')];transfers[_0xc9756f[_0xeaf8('0x3c')]][_0xeaf8('0x3f')]=agents[_0xc9756f['secondtransfereruniqueid']][_0xeaf8('0x3f')];transfers[_0xc9756f[_0xeaf8('0x3c')]][_0xeaf8('0x16')]=utils[_0xeaf8('0x17')]();transfers[_0xc9756f[_0xeaf8('0x3c')]][_0xeaf8('0x29')]=utils[_0xeaf8('0x17')]();transfers[_0xc9756f['transfereeuniqueid']][_0xeaf8('0x27')]=0x0;transfers[_0xc9756f['transfereeuniqueid']]['agententerreason']=0x2;}}else if(_0xc9756f[_0xeaf8('0x3a')]==_0xc9756f[_0xeaf8('0x40')]){if(!_['isNil'](agents[_0xc9756f[_0xeaf8('0x38')]])){agents[_0xc9756f[_0xeaf8('0x38')]][_0xeaf8('0x33')]=!![];agents[_0xc9756f[_0xeaf8('0x38')]]['transfertype']=_0xeaf8('0x41');agents[_0xc9756f['origtransfereruniqueid']][_0xeaf8('0x35')]=_0xc9756f['secondtransfererexten'];agents[_0xc9756f[_0xeaf8('0x38')]][_0xeaf8('0x37')]=_0xc9756f['secondtransfereruniqueid'];}if(_0xc9756f[_0xeaf8('0x42')]&&agents[_0xc9756f[_0xeaf8('0x42')]]){agents[_0xc9756f['transfertargetuniqueid']][_0xeaf8('0x3d')]=0x1;transfers[_0xc9756f[_0xeaf8('0x42')]]=_[_0xeaf8('0x3e')](agents[_0xc9756f[_0xeaf8('0x42')]]);transfers[_0xc9756f[_0xeaf8('0x42')]][_0xeaf8('0x9')]=agents[_0xc9756f['origtransfereruniqueid']]['calleridnum'];transfers[_0xc9756f['transfertargetuniqueid']][_0xeaf8('0x3f')]=agents[_0xc9756f[_0xeaf8('0x38')]]['calleridname'];transfers[_0xc9756f[_0xeaf8('0x42')]]['agentcalledAt']=utils[_0xeaf8('0x17')]();transfers[_0xc9756f[_0xeaf8('0x42')]][_0xeaf8('0x29')]=utils[_0xeaf8('0x17')]();transfers[_0xc9756f[_0xeaf8('0x42')]][_0xeaf8('0x27')]=0x0;transfers[_0xc9756f[_0xeaf8('0x42')]][_0xeaf8('0x3d')]=0x2;}}}catch(_0x58c5cd){utils[_0xeaf8('0x1a')](_0x58c5cd[_0xeaf8('0x1b')]);}};exports['hangup']=function(_0x2a885a){try{if(agents[_0x2a885a[_0xeaf8('0x5')]]&&agents[_0x2a885a[_0xeaf8('0x5')]][_0xeaf8('0x26')]==='timeout'){if(_0x2a885a['cause']==='21'){agents[_0x2a885a[_0xeaf8('0x5')]][_0xeaf8('0x26')]=_0xeaf8('0x43');agents[_0x2a885a[_0xeaf8('0x5')]][_0xeaf8('0xb')]=_0xeaf8('0x43');}writeDB(agents[_0x2a885a[_0xeaf8('0x5')]]);var _0x3b8d39=unanswered[_0xeaf8('0x44')](_0x2a885a[_0xeaf8('0x5')]);if(_0x3b8d39>-0x1)unanswered[_0xeaf8('0x45')](_0x3b8d39,0x1);}if(transfers[_0x2a885a['uniqueid']]){transfers[_0x2a885a[_0xeaf8('0x5')]]['agentcomplete']=!![];transfers[_0x2a885a[_0xeaf8('0x5')]][_0xeaf8('0x30')]=utils[_0xeaf8('0x17')]();transfers[_0x2a885a[_0xeaf8('0x5')]]['talktime']=utils[_0xeaf8('0x2f')](transfers[_0x2a885a[_0xeaf8('0x5')]][_0xeaf8('0x30')],transfers[_0x2a885a[_0xeaf8('0x5')]]['agentconnectAt']);transfers[_0x2a885a[_0xeaf8('0x5')]][_0xeaf8('0x26')]=_0xeaf8('0x46');transfers[_0x2a885a[_0xeaf8('0x5')]]['lastevent']=_0xeaf8('0x47');writeDB(transfers[_0x2a885a[_0xeaf8('0x5')]],!![]);}if(agents[_0x2a885a[_0xeaf8('0x5')]]&&agents[_0x2a885a['uniqueid']][_0xeaf8('0x29')]){agents[_0x2a885a[_0xeaf8('0x5')]]['agentcomplete']=!![];agents[_0x2a885a[_0xeaf8('0x5')]][_0xeaf8('0x30')]=utils[_0xeaf8('0x17')]();agents[_0x2a885a[_0xeaf8('0x5')]]['talktime']=utils[_0xeaf8('0x2f')](agents[_0x2a885a[_0xeaf8('0x5')]]['agentcompleteAt'],agents[_0x2a885a['uniqueid']]['agentconnectAt']);agents[_0x2a885a[_0xeaf8('0x5')]][_0xeaf8('0x26')]=agents[_0x2a885a[_0xeaf8('0x5')]]['transfer']?_0xeaf8('0x33'):_0xeaf8('0x46');agents[_0x2a885a[_0xeaf8('0x5')]][_0xeaf8('0xb')]=_0xeaf8('0x47');writeDB(agents[_0x2a885a[_0xeaf8('0x5')]]);}}catch(_0x5bb34c){utils[_0xeaf8('0x1a')](_0x5bb34c['stack']);}}; \ No newline at end of file +var _0x183c=['transfereeuniqueid','agententerreason','clone','calleridnum','secondtransfererlinkedid','origtransfereruniqueid','secondtransfererexten','transfertargetuniqueid','calleridname','hangup','rejected','indexOf','splice','diffTime','agent','complete','lodash','util','./utils','info','format','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','queue','membername','interface','connectedlinenum','lastevent','getVoiceQueueByName','then','type','acwtime','agentacw','acwTimeout','CreateVoiceAgentReport','request','destuniqueid','agentcalled','agentcalledAt','now','called','connectedlinename','error','stack','agentringnoanswer','isNil','agentringnoanswerAt','timeout','reason','holdtime','push','queuecallerabandon','forIn','talktime','agentconnect','ringtime','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','agentcomplete','agentcompleteAt','agentconnectAt','transfereruniqueid','blind','transferexten','extension','transferuniqueid','attendedtransfer','origtransfererlinkedid','secondtransfereruniqueid','transfer','transfertype','ATTENDED','origtransfererexten'];(function(_0x4fbe8c,_0x12260f){var _0x30e136=function(_0x5384f7){while(--_0x5384f7){_0x4fbe8c['push'](_0x4fbe8c['shift']());}};_0x30e136(++_0x12260f);}(_0x183c,0x187));var _0xc183=function(_0x37e02b,_0x7f9a5a){_0x37e02b=_0x37e02b-0x0;var _0x575623=_0x183c[_0x37e02b];return _0x575623;};'use strict';var _=require(_0xc183('0x0'));var util=require(_0xc183('0x1'));var utils=require(_0xc183('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1dbd51,_0x36a558){utils[_0xc183('0x3')](util[_0xc183('0x4')](_0xc183('0x5'),_0x1dbd51[_0xc183('0x6')],_0x1dbd51[_0xc183('0x7')],_0x1dbd51[_0xc183('0x8')],_0x1dbd51[_0xc183('0x9')],_0x1dbd51[_0xc183('0xa')],_0x1dbd51['calleridnum'],_0x1dbd51[_0xc183('0xb')],_0x1dbd51[_0xc183('0xc')]));if(_0x1dbd51[_0xc183('0x8')]){utils[_0xc183('0xd')](_0x1dbd51[_0xc183('0x8')])[_0xc183('0xe')](function(_0xd7403c){if(_0xd7403c){_0x1dbd51[_0xc183('0xf')]=_0xd7403c[_0xc183('0xf')];_0x1dbd51['agentacw']=_0x1dbd51['agentcomplete']?_0xd7403c['acw']:![];_0x1dbd51[_0xc183('0x10')]=_0x1dbd51[_0xc183('0x11')]?_0xd7403c[_0xc183('0x12')]:0x0;}utils['request'](_0xc183('0x13'),_0x1dbd51);});}else{utils[_0xc183('0x14')](_0xc183('0x13'),_0x1dbd51);}if(_0x36a558){delete transfers[_0x1dbd51[_0xc183('0x6')]];}else{delete agents[_0x1dbd51[_0xc183('0x15')]];}}exports[_0xc183('0x16')]=function(_0x58e9b9){try{agents[_0x58e9b9[_0xc183('0x15')]]=_0x58e9b9;agents[_0x58e9b9[_0xc183('0x15')]][_0xc183('0x17')]=utils[_0xc183('0x18')]();agents[_0x58e9b9[_0xc183('0x15')]][_0xc183('0xc')]=_0xc183('0x19');agents[_0x58e9b9['destuniqueid']]['connectedlinenum']=null;agents[_0x58e9b9[_0xc183('0x15')]][_0xc183('0x1a')]=null;}catch(_0x240fae){utils[_0xc183('0x1b')](_0x240fae[_0xc183('0x1c')]);}};exports[_0xc183('0x1d')]=function(_0x166185){try{if(!_[_0xc183('0x1e')](agents[_0x166185['destuniqueid']])){agents[_0x166185['destuniqueid']][_0xc183('0x1d')]=!![];agents[_0x166185[_0xc183('0x15')]][_0xc183('0x1f')]=utils[_0xc183('0x18')]();agents[_0x166185[_0xc183('0x15')]][_0xc183('0xc')]=_0xc183('0x20');agents[_0x166185[_0xc183('0x15')]][_0xc183('0x21')]=_0xc183('0x20');agents[_0x166185[_0xc183('0x15')]][_0xc183('0x22')]=_0x166185['ringtime']?parseInt(_0x166185['ringtime'])/0x3e8:0x0;agents[_0x166185[_0xc183('0x15')]]['talktime']=0x0;unanswered[_0xc183('0x23')](_0x166185[_0xc183('0x15')]);}}catch(_0x354a59){utils[_0xc183('0x1b')](_0x354a59[_0xc183('0x1c')]);}};exports[_0xc183('0x24')]=function(_0x3e96f3){try{_[_0xc183('0x25')](agents,function(_0x478085,_0x3817d4){if(_0x478085['uniqueid']==_0x3e96f3['uniqueid']&&!_['includes'](unanswered,_0x478085['destuniqueid'])){_0x478085['agentringnoanswer']=!![];_0x478085[_0xc183('0x1f')]=utils['now']();_0x478085[_0xc183('0xc')]='abandoned';_0x478085['reason']='abandoned';_0x478085['holdtime']=_0x3e96f3[_0xc183('0x22')];_0x478085[_0xc183('0x26')]=0x0;writeDB(_0x478085);}});}catch(_0xeb4537){utils[_0xc183('0x1b')](_0xeb4537[_0xc183('0x1c')]);}};exports[_0xc183('0x27')]=function(_0x59a8fb){try{if(agents[_0x59a8fb['destuniqueid']]){agents[_0x59a8fb['destuniqueid']]['agentconnectAt']=utils['now']();agents[_0x59a8fb[_0xc183('0x15')]][_0xc183('0xb')]=_0x59a8fb['connectedlinenum'];agents[_0x59a8fb[_0xc183('0x15')]][_0xc183('0x1a')]=_0x59a8fb[_0xc183('0x1a')];agents[_0x59a8fb[_0xc183('0x15')]][_0xc183('0x22')]=_0x59a8fb[_0xc183('0x28')];agents[_0x59a8fb[_0xc183('0x15')]][_0xc183('0xc')]=_0xc183('0x29');_['forIn'](agents,function(_0x4cfc19,_0x1fa8ec){if(_0x4cfc19[_0xc183('0x15')]!=_0x59a8fb[_0xc183('0x15')]&&_0x4cfc19[_0xc183('0x6')]==_0x59a8fb['uniqueid']){_0x4cfc19[_0xc183('0x26')]=0x0;_0x4cfc19[_0xc183('0x22')]=_0x59a8fb[_0xc183('0x28')];_0x4cfc19[_0xc183('0x1d')]=!![];_0x4cfc19[_0xc183('0x1f')]=utils['now']();_0x4cfc19[_0xc183('0xc')]=_0xc183('0x2a');_0x4cfc19[_0xc183('0x21')]=_0xc183('0x2a');_0x4cfc19[_0xc183('0x2b')]=_0x59a8fb[_0xc183('0x15')];_0x4cfc19['answeredelsewheremembername']=_0x59a8fb[_0xc183('0x9')];writeDB(_0x4cfc19);}});}}catch(_0x3551b6){utils[_0xc183('0x1b')](_0x3551b6[_0xc183('0x1c')]);}};exports[_0xc183('0x2c')]=function(_0x2e4527){try{if(!_[_0xc183('0x1e')](agents[_0x2e4527[_0xc183('0x15')]])){agents[_0x2e4527['destuniqueid']][_0xc183('0x2c')]=!![];agents[_0x2e4527[_0xc183('0x15')]][_0xc183('0x2d')]=utils[_0xc183('0x18')]();agents[_0x2e4527[_0xc183('0x15')]][_0xc183('0x26')]=utils['diffTime'](agents[_0x2e4527[_0xc183('0x15')]][_0xc183('0x2d')],agents[_0x2e4527[_0xc183('0x15')]][_0xc183('0x2e')]);agents[_0x2e4527[_0xc183('0x15')]][_0xc183('0x21')]=_0x2e4527[_0xc183('0x21')];agents[_0x2e4527[_0xc183('0x15')]][_0xc183('0xc')]='complete';writeDB(agents[_0x2e4527['destuniqueid']]);}}catch(_0x15ebcc){utils[_0xc183('0x1b')](_0x15ebcc['stack']);}};exports['blindtransfer']=function(_0x38b100){try{if(!_[_0xc183('0x1e')](agents[_0x38b100[_0xc183('0x2f')]])){agents[_0x38b100[_0xc183('0x2f')]]['transfer']=!![];agents[_0x38b100[_0xc183('0x2f')]]['transfertype']=_0xc183('0x30');agents[_0x38b100['transfereruniqueid']][_0xc183('0x31')]=_0x38b100[_0xc183('0x32')];agents[_0x38b100['transfereruniqueid']][_0xc183('0x33')]=agents[_0x38b100[_0xc183('0x2f')]][_0xc183('0x6')];}}catch(_0x1e96dd){utils['error'](_0x1e96dd[_0xc183('0x1c')]);}};exports[_0xc183('0x34')]=function(_0x299778){try{if(_0x299778['origtransfereruniqueid']==_0x299778[_0xc183('0x35')]){if(!_[_0xc183('0x1e')](agents[_0x299778[_0xc183('0x36')]])){agents[_0x299778['secondtransfereruniqueid']][_0xc183('0x37')]=!![];agents[_0x299778[_0xc183('0x36')]][_0xc183('0x38')]=_0xc183('0x39');agents[_0x299778[_0xc183('0x36')]]['transferexten']=_0x299778[_0xc183('0x3a')];agents[_0x299778[_0xc183('0x36')]][_0xc183('0x33')]=_0x299778['origtransfereruniqueid'];}if(_0x299778[_0xc183('0x3b')]&&agents[_0x299778[_0xc183('0x3b')]]){agents[_0x299778[_0xc183('0x3b')]][_0xc183('0x3c')]=0x1;transfers[_0x299778['transfereeuniqueid']]=_[_0xc183('0x3d')](agents[_0x299778[_0xc183('0x3b')]]);transfers[_0x299778[_0xc183('0x3b')]][_0xc183('0x3e')]=agents[_0x299778[_0xc183('0x36')]][_0xc183('0x3e')];transfers[_0x299778['transfereeuniqueid']]['calleridname']=agents[_0x299778['secondtransfereruniqueid']]['calleridname'];transfers[_0x299778[_0xc183('0x3b')]][_0xc183('0x17')]=utils['now']();transfers[_0x299778[_0xc183('0x3b')]][_0xc183('0x2e')]=utils[_0xc183('0x18')]();transfers[_0x299778['transfereeuniqueid']][_0xc183('0x22')]=0x0;transfers[_0x299778[_0xc183('0x3b')]][_0xc183('0x3c')]=0x2;}}else if(_0x299778['secondtransfereruniqueid']==_0x299778[_0xc183('0x3f')]){if(!_[_0xc183('0x1e')](agents[_0x299778[_0xc183('0x40')]])){agents[_0x299778[_0xc183('0x40')]][_0xc183('0x37')]=!![];agents[_0x299778[_0xc183('0x40')]][_0xc183('0x38')]=_0xc183('0x39');agents[_0x299778[_0xc183('0x40')]][_0xc183('0x31')]=_0x299778[_0xc183('0x41')];agents[_0x299778[_0xc183('0x40')]][_0xc183('0x33')]=_0x299778[_0xc183('0x36')];}if(_0x299778[_0xc183('0x42')]&&agents[_0x299778[_0xc183('0x42')]]){agents[_0x299778[_0xc183('0x42')]]['agententerreason']=0x1;transfers[_0x299778[_0xc183('0x42')]]=_[_0xc183('0x3d')](agents[_0x299778['transfertargetuniqueid']]);transfers[_0x299778[_0xc183('0x42')]][_0xc183('0x3e')]=agents[_0x299778[_0xc183('0x40')]][_0xc183('0x3e')];transfers[_0x299778[_0xc183('0x42')]][_0xc183('0x43')]=agents[_0x299778['origtransfereruniqueid']]['calleridname'];transfers[_0x299778[_0xc183('0x42')]][_0xc183('0x17')]=utils[_0xc183('0x18')]();transfers[_0x299778[_0xc183('0x42')]]['agentconnectAt']=utils[_0xc183('0x18')]();transfers[_0x299778['transfertargetuniqueid']]['holdtime']=0x0;transfers[_0x299778[_0xc183('0x42')]][_0xc183('0x3c')]=0x2;}}}catch(_0x1ddc63){utils['error'](_0x1ddc63[_0xc183('0x1c')]);}};exports[_0xc183('0x44')]=function(_0x30458a){try{if(agents[_0x30458a['uniqueid']]&&agents[_0x30458a[_0xc183('0x6')]][_0xc183('0x21')]==='timeout'){if(_0x30458a['cause']==='21'){agents[_0x30458a['uniqueid']][_0xc183('0x21')]='rejected';agents[_0x30458a[_0xc183('0x6')]]['lastevent']=_0xc183('0x45');}writeDB(agents[_0x30458a[_0xc183('0x6')]]);var _0x1537c5=unanswered[_0xc183('0x46')](_0x30458a[_0xc183('0x6')]);if(_0x1537c5>-0x1)unanswered[_0xc183('0x47')](_0x1537c5,0x1);}if(transfers[_0x30458a[_0xc183('0x6')]]){transfers[_0x30458a[_0xc183('0x6')]]['agentcomplete']=!![];transfers[_0x30458a[_0xc183('0x6')]][_0xc183('0x2d')]=utils[_0xc183('0x18')]();transfers[_0x30458a[_0xc183('0x6')]][_0xc183('0x26')]=utils[_0xc183('0x48')](transfers[_0x30458a[_0xc183('0x6')]][_0xc183('0x2d')],transfers[_0x30458a[_0xc183('0x6')]][_0xc183('0x2e')]);transfers[_0x30458a['uniqueid']][_0xc183('0x21')]=_0xc183('0x49');transfers[_0x30458a[_0xc183('0x6')]][_0xc183('0xc')]=_0xc183('0x4a');writeDB(transfers[_0x30458a[_0xc183('0x6')]],!![]);}if(agents[_0x30458a[_0xc183('0x6')]]&&agents[_0x30458a[_0xc183('0x6')]][_0xc183('0x2e')]){agents[_0x30458a[_0xc183('0x6')]][_0xc183('0x2c')]=!![];agents[_0x30458a[_0xc183('0x6')]][_0xc183('0x2d')]=utils['now']();agents[_0x30458a['uniqueid']][_0xc183('0x26')]=utils[_0xc183('0x48')](agents[_0x30458a[_0xc183('0x6')]][_0xc183('0x2d')],agents[_0x30458a['uniqueid']][_0xc183('0x2e')]);agents[_0x30458a[_0xc183('0x6')]][_0xc183('0x21')]=agents[_0x30458a[_0xc183('0x6')]][_0xc183('0x37')]?'transfer':_0xc183('0x49');agents[_0x30458a['uniqueid']]['lastevent']=_0xc183('0x4a');writeDB(agents[_0x30458a[_0xc183('0x6')]]);}}catch(_0x211c4c){utils[_0xc183('0x1b')](_0x211c4c[_0xc183('0x1c')]);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 337a76b..18e4977 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 _0x209d=['set','gotoif','lastapplication','application','lodash','util','./utils','FAILED','NO\x20ANSWER','ANSWERED','BUSY','info','format','CALL|%s|%s|%s|%s|%s|%s|%s|%s','channel','type','accountcode','source','destination','getUserByInternal','UserId','request','CreateVoiceCallReport','uniqueid','newchannel','linkedid','OutgoingSpoolFailed','calleridnum','exten','context','now','DOCUMENTATION','stack','newstate','isNil','systemanswertime','channelstate','transfer','answertime','disposition','toNumber','error','callerid','calleridname','endtime','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','transfereechannel','destinationchannel','secondtransfererchannel','userfield','_attended','origtransfererchannel','musiconholdstartAt','musiconholdstop','mohtime','variable','xmd-originatecalleridnum','value','xmd-phone','xmd-callerid-preview','xmd-callerid','xmcs-queue','Queue','xmd-cdrtype','outboundrouteid','routeid','sipcallid','newexten','toLowerCase','startsWith','appdata','cdr','substring','lastIndexOf','noop'];(function(_0x22541b,_0x5c49e3){var _0x2985ce=function(_0x88a1d5){while(--_0x88a1d5){_0x22541b['push'](_0x22541b['shift']());}};_0x2985ce(++_0x5c49e3);}(_0x209d,0x18f));var _0xd209=function(_0x377d25,_0x31c28d){_0x377d25=_0x377d25-0x0;var _0x3cb2e2=_0x209d[_0x377d25];return _0x3cb2e2;};'use strict';var _=require(_0xd209('0x0'));var util=require(_0xd209('0x1'));var utils=require(_0xd209('0x2'));var dispositions=['NO\x20ANSWER',_0xd209('0x3'),_0xd209('0x3'),_0xd209('0x4'),_0xd209('0x4'),_0xd209('0x4'),_0xd209('0x5'),_0xd209('0x6'),'FAILED',_0xd209('0x3'),_0xd209('0x3')];var channels={};function writeDB(_0x46f5a2){utils[_0xd209('0x7')](util[_0xd209('0x8')](_0xd209('0x9'),_0x46f5a2['uniqueid'],_0x46f5a2[_0xd209('0xa')],_0x46f5a2[_0xd209('0xb')],_0x46f5a2[_0xd209('0xc')],_0x46f5a2[_0xd209('0xd')],_0x46f5a2[_0xd209('0xe')],_0x46f5a2['callerid'],_0x46f5a2['disposition']));if(_0x46f5a2['accountcode']){utils[_0xd209('0xf')](_0x46f5a2[_0xd209('0xc')])['then'](function(_0x3f71fc){if(_0x3f71fc){_0x46f5a2[_0xd209('0x10')]=_0x3f71fc['id'];}utils[_0xd209('0x11')](_0xd209('0x12'),_0x46f5a2);});}else{utils[_0xd209('0x11')](_0xd209('0x12'),_0x46f5a2);}if(channels[_0x46f5a2[_0xd209('0x13')]]){delete channels[_0x46f5a2[_0xd209('0x13')]];}}exports[_0xd209('0x14')]=function(_0x57d784){try{if(_0x57d784[_0xd209('0x13')]==_0x57d784[_0xd209('0x15')]&&_0x57d784[_0xd209('0xa')]!=_0xd209('0x16')){channels[_0x57d784['uniqueid']]={'uniqueid':_0x57d784[_0xd209('0x13')],'accountcode':_0x57d784[_0xd209('0xc')],'source':_0x57d784[_0xd209('0x17')],'destination':_0x57d784[_0xd209('0x18')],'destinationcontext':_0x57d784[_0xd209('0x19')],'channel':_0x57d784[_0xd209('0xa')],'starttime':utils[_0xd209('0x1a')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0xd209('0x1b')};}}catch(_0x2e39e7){utils['error'](_0x2e39e7[_0xd209('0x1c')]);}};exports[_0xd209('0x1d')]=function(_0x59c07e){try{if(!_[_0xd209('0x1e')](channels[_0x59c07e['uniqueid']])&&_0x59c07e['channelstate']==0x6){if(_['isNil'](channels[_0x59c07e[_0xd209('0x13')]][_0xd209('0x1f')])){channels[_0x59c07e[_0xd209('0x13')]]['systemanswertime']=utils[_0xd209('0x1a')]();}}else if(!_[_0xd209('0x1e')](channels[_0x59c07e[_0xd209('0x15')]])&&_0x59c07e[_0xd209('0x20')]==0x6&&_0x59c07e['context']!=_0xd209('0x21')){channels[_0x59c07e[_0xd209('0x15')]][_0xd209('0xc')]=_0x59c07e[_0xd209('0xc')];channels[_0x59c07e[_0xd209('0x15')]]['destinationchannel']=_0x59c07e[_0xd209('0xa')];if(_[_0xd209('0x1e')](channels[_0x59c07e[_0xd209('0x15')]][_0xd209('0x22')])){channels[_0x59c07e['linkedid']][_0xd209('0x22')]=utils[_0xd209('0x1a')]();}channels[_0x59c07e['linkedid']][_0xd209('0x23')]=dispositions[_[_0xd209('0x24')](_0x59c07e['channelstate'])]||_0xd209('0x5');}}catch(_0x37ff3e){utils[_0xd209('0x25')](_0x37ff3e[_0xd209('0x1c')]);}};exports['hangup']=function(_0x357aa5){try{if(!_[_0xd209('0x1e')](channels[_0x357aa5[_0xd209('0x13')]])){if(_[_0xd209('0x1e')](channels[_0x357aa5[_0xd209('0x13')]][_0xd209('0x26')])){channels[_0x357aa5['uniqueid']]['callerid']=_0x357aa5[_0xd209('0x27')]+'\x20<'+_0x357aa5[_0xd209('0x17')]+'>';}channels[_0x357aa5[_0xd209('0x13')]][_0xd209('0x28')]=utils[_0xd209('0x1a')]();channels[_0x357aa5[_0xd209('0x13')]]['duration']=utils[_0xd209('0x29')](channels[_0x357aa5[_0xd209('0x13')]]['endtime'],channels[_0x357aa5[_0xd209('0x13')]][_0xd209('0x2a')]);channels[_0x357aa5[_0xd209('0x13')]][_0xd209('0x2b')]=channels[_0x357aa5[_0xd209('0x13')]][_0xd209('0x22')]?utils[_0xd209('0x29')](channels[_0x357aa5['uniqueid']][_0xd209('0x28')],channels[_0x357aa5['uniqueid']][_0xd209('0x22')]):0x0;writeDB(channels[_0x357aa5[_0xd209('0x13')]]);}}catch(_0x3af040){utils[_0xd209('0x25')](_0x3af040[_0xd209('0x1c')]);}};exports[_0xd209('0x2c')]=function(_0x565640){try{if(!_[_0xd209('0x1e')](channels[_0x565640[_0xd209('0x2d')]])){if(channels[_0x565640[_0xd209('0x2d')]]['channel']==_0x565640[_0xd209('0x2e')]){channels[_0x565640['localtwolinkedid']][_0xd209('0x2f')]=_0x565640[_0xd209('0x30')];channels[_0x565640[_0xd209('0x2d')]][_0xd209('0x31')]=_0xd209('0x32');}else if(channels[_0x565640[_0xd209('0x2d')]][_0xd209('0xa')]=_0x565640['transfertargetchannel']){channels[_0x565640[_0xd209('0x2d')]][_0xd209('0x2f')]=_0x565640[_0xd209('0x33')];channels[_0x565640['localtwolinkedid']][_0xd209('0x31')]='_attended';}}}catch(_0xf2ef6f){utils[_0xd209('0x25')](_0xf2ef6f['stack']);}};exports['musiconholdstart']=function(_0x2d3513){try{if(!_[_0xd209('0x1e')](channels[_0x2d3513[_0xd209('0x13')]])){channels[_0x2d3513['uniqueid']][_0xd209('0x34')]=utils[_0xd209('0x1a')]();}}catch(_0x17ee20){utils['error'](_0x17ee20[_0xd209('0x1c')]);}};exports[_0xd209('0x35')]=function(_0x26b90d){try{if(!_[_0xd209('0x1e')](channels[_0x26b90d[_0xd209('0x13')]])){if(!_[_0xd209('0x1e')](channels[_0x26b90d[_0xd209('0x13')]][_0xd209('0x34')])){channels[_0x26b90d[_0xd209('0x13')]][_0xd209('0x36')]+=utils[_0xd209('0x29')](utils[_0xd209('0x1a')](),channels[_0x26b90d['uniqueid']]['musiconholdstartAt']);delete channels[_0x26b90d[_0xd209('0x13')]][_0xd209('0x34')];}}}catch(_0x1f05cf){utils[_0xd209('0x25')](_0x1f05cf['stack']);}};exports['varset']=function(_0x3214e2){try{if(!_[_0xd209('0x1e')](channels[_0x3214e2[_0xd209('0x13')]])){if(!_[_0xd209('0x1e')](_0x3214e2[_0xd209('0x37')][_0xd209('0x38')])){channels[_0x3214e2['uniqueid']][_0xd209('0xd')]=_0x3214e2[_0xd209('0x39')];}if(!_[_0xd209('0x1e')](_0x3214e2[_0xd209('0x37')][_0xd209('0x3a')])){channels[_0x3214e2[_0xd209('0x13')]][_0xd209('0xe')]=_0x3214e2[_0xd209('0x39')];channels[_0x3214e2[_0xd209('0x13')]][_0xd209('0x26')]='\x22'+_0x3214e2[_0xd209('0x39')]+'\x22\x20<'+_0x3214e2[_0xd209('0x39')]+'>';}if(!_['isNil'](_0x3214e2[_0xd209('0x37')][_0xd209('0x3b')])||!_[_0xd209('0x1e')](_0x3214e2[_0xd209('0x37')][_0xd209('0x3c')])){channels[_0x3214e2['uniqueid']]['callerid']=_0x3214e2[_0xd209('0x39')];}if(!_[_0xd209('0x1e')](_0x3214e2[_0xd209('0x37')]['xmd-queue'])||!_[_0xd209('0x1e')](_0x3214e2[_0xd209('0x37')][_0xd209('0x3d')])){channels[_0x3214e2[_0xd209('0x13')]]['lastapplication']=_0xd209('0x3e');channels[_0x3214e2['uniqueid']]['lastdata']=_0x3214e2[_0xd209('0x39')];channels[_0x3214e2[_0xd209('0x13')]]['queue']=!![];}if(!_[_0xd209('0x1e')](_0x3214e2[_0xd209('0x37')]['xmd-contactid'])){channels[_0x3214e2[_0xd209('0x13')]]['ContactId']=_0x3214e2[_0xd209('0x39')];}if(!_[_0xd209('0x1e')](_0x3214e2[_0xd209('0x37')][_0xd209('0x3f')])){channels[_0x3214e2[_0xd209('0x13')]][_0xd209('0xb')]=_0x3214e2['value'];}if(!_['isNil'](_0x3214e2[_0xd209('0x37')][_0xd209('0x40')])){channels[_0x3214e2[_0xd209('0x13')]][_0xd209('0x41')]=_0x3214e2[_0xd209('0x39')];}if(!_[_0xd209('0x1e')](_0x3214e2[_0xd209('0x37')][_0xd209('0x42')])){channels[_0x3214e2[_0xd209('0x13')]][_0xd209('0x42')]=_0x3214e2['value'];}}}catch(_0x580ff3){utils[_0xd209('0x25')](_0x580ff3['stack']);}};exports[_0xd209('0x43')]=function(_0x59be3f){try{if(!_[_0xd209('0x1e')](channels[_0x59be3f[_0xd209('0x13')]])){if(_0x59be3f['application'][_0xd209('0x44')]()=='set'&&_[_0xd209('0x45')](_0x59be3f[_0xd209('0x46')][_0xd209('0x44')](),_0xd209('0x47'))){var _0x45359d=_0x59be3f['appdata']['split']('=');var _0x46b1fa=_0x45359d[0x0][_0xd209('0x48')](_0x45359d[0x0][_0xd209('0x49')]('(')+0x1,_0x45359d[0x0]['lastIndexOf'](')'));var _0x23be0c=_0x45359d[0x1];channels[_0x59be3f[_0xd209('0x13')]][_0x46b1fa]=_0x23be0c;}if(!_['includes'](['hangup',_0xd209('0x4a'),'execif',_0xd209('0x4b'),_0xd209('0x4c')],_0x59be3f['application'][_0xd209('0x44')]())){channels[_0x59be3f[_0xd209('0x13')]][_0xd209('0x4d')]=_0x59be3f[_0xd209('0x4e')];channels[_0x59be3f[_0xd209('0x13')]]['lastdata']=_0x59be3f[_0xd209('0x46')];}}}catch(_0x21d98d){utils['error'](_0x21d98d[_0xd209('0x1c')]);}}; \ No newline at end of file +var _0x7f04=['variable','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','lastdata','queue','xmd-contactid','routeid','sipcallid','newexten','application','toLowerCase','set','appdata','cdr','split','substring','includes','noop','execif','gotoif','lastapplication','lodash','util','NO\x20ANSWER','ANSWERED','BUSY','FAILED','info','format','CALL|%s|%s|%s|%s|%s|%s|%s|%s','channel','type','accountcode','source','destination','callerid','disposition','getUserByInternal','then','UserId','request','CreateVoiceCallReport','uniqueid','linkedid','OutgoingSpoolFailed','calleridnum','exten','context','DOCUMENTATION','error','isNil','channelstate','systemanswertime','now','destinationchannel','answertime','toNumber','stack','hangup','calleridname','endtime','diffTime','starttime','billableseconds','localtwolinkedid','origtransfererchannel','_attended','musiconholdstart','musiconholdstop','musiconholdstartAt','mohtime','varset','xmd-originatecalleridnum','value','xmd-phone','\x22\x20<'];(function(_0x1a882e,_0x3e3000){var _0x596e4d=function(_0x529b84){while(--_0x529b84){_0x1a882e['push'](_0x1a882e['shift']());}};_0x596e4d(++_0x3e3000);}(_0x7f04,0x19d));var _0x47f0=function(_0x36f2b2,_0x4dea08){_0x36f2b2=_0x36f2b2-0x0;var _0x4a0f99=_0x7f04[_0x36f2b2];return _0x4a0f99;};'use strict';var _=require(_0x47f0('0x0'));var util=require(_0x47f0('0x1'));var utils=require('./utils');var dispositions=['NO\x20ANSWER','FAILED','FAILED',_0x47f0('0x2'),'NO\x20ANSWER','NO\x20ANSWER',_0x47f0('0x3'),_0x47f0('0x4'),_0x47f0('0x5'),'FAILED',_0x47f0('0x5')];var channels={};function writeDB(_0x451b1a){utils[_0x47f0('0x6')](util[_0x47f0('0x7')](_0x47f0('0x8'),_0x451b1a['uniqueid'],_0x451b1a[_0x47f0('0x9')],_0x451b1a[_0x47f0('0xa')],_0x451b1a[_0x47f0('0xb')],_0x451b1a[_0x47f0('0xc')],_0x451b1a[_0x47f0('0xd')],_0x451b1a[_0x47f0('0xe')],_0x451b1a[_0x47f0('0xf')]));if(_0x451b1a[_0x47f0('0xb')]){utils[_0x47f0('0x10')](_0x451b1a['accountcode'])[_0x47f0('0x11')](function(_0x8443f3){if(_0x8443f3){_0x451b1a[_0x47f0('0x12')]=_0x8443f3['id'];}utils[_0x47f0('0x13')](_0x47f0('0x14'),_0x451b1a);});}else{utils['request'](_0x47f0('0x14'),_0x451b1a);}if(channels[_0x451b1a[_0x47f0('0x15')]]){delete channels[_0x451b1a[_0x47f0('0x15')]];}}exports['newchannel']=function(_0xd7997b){try{if(_0xd7997b['uniqueid']==_0xd7997b[_0x47f0('0x16')]&&_0xd7997b[_0x47f0('0x9')]!=_0x47f0('0x17')){channels[_0xd7997b[_0x47f0('0x15')]]={'uniqueid':_0xd7997b['uniqueid'],'accountcode':_0xd7997b[_0x47f0('0xb')],'source':_0xd7997b[_0x47f0('0x18')],'destination':_0xd7997b[_0x47f0('0x19')],'destinationcontext':_0xd7997b[_0x47f0('0x1a')],'channel':_0xd7997b[_0x47f0('0x9')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x47f0('0x2'),'amaflags':_0x47f0('0x1b')};}}catch(_0x117650){utils[_0x47f0('0x1c')](_0x117650['stack']);}};exports['newstate']=function(_0x552828){try{if(!_[_0x47f0('0x1d')](channels[_0x552828[_0x47f0('0x15')]])&&_0x552828[_0x47f0('0x1e')]==0x6){if(_[_0x47f0('0x1d')](channels[_0x552828[_0x47f0('0x15')]][_0x47f0('0x1f')])){channels[_0x552828[_0x47f0('0x15')]][_0x47f0('0x1f')]=utils[_0x47f0('0x20')]();}}else if(!_[_0x47f0('0x1d')](channels[_0x552828[_0x47f0('0x16')]])&&_0x552828[_0x47f0('0x1e')]==0x6&&_0x552828[_0x47f0('0x1a')]!='transfer'){channels[_0x552828[_0x47f0('0x16')]]['accountcode']=_0x552828[_0x47f0('0xb')];channels[_0x552828[_0x47f0('0x16')]][_0x47f0('0x21')]=_0x552828['channel'];if(_['isNil'](channels[_0x552828[_0x47f0('0x16')]][_0x47f0('0x22')])){channels[_0x552828[_0x47f0('0x16')]][_0x47f0('0x22')]=utils[_0x47f0('0x20')]();}channels[_0x552828[_0x47f0('0x16')]]['disposition']=dispositions[_[_0x47f0('0x23')](_0x552828['channelstate'])]||'ANSWERED';}}catch(_0x1a09f9){utils[_0x47f0('0x1c')](_0x1a09f9[_0x47f0('0x24')]);}};exports[_0x47f0('0x25')]=function(_0x1ebd9){try{if(!_[_0x47f0('0x1d')](channels[_0x1ebd9[_0x47f0('0x15')]])){if(_[_0x47f0('0x1d')](channels[_0x1ebd9[_0x47f0('0x15')]][_0x47f0('0xe')])){channels[_0x1ebd9[_0x47f0('0x15')]][_0x47f0('0xe')]=_0x1ebd9[_0x47f0('0x26')]+'\x20<'+_0x1ebd9[_0x47f0('0x18')]+'>';}channels[_0x1ebd9['uniqueid']][_0x47f0('0x27')]=utils['now']();channels[_0x1ebd9[_0x47f0('0x15')]]['duration']=utils[_0x47f0('0x28')](channels[_0x1ebd9['uniqueid']][_0x47f0('0x27')],channels[_0x1ebd9[_0x47f0('0x15')]][_0x47f0('0x29')]);channels[_0x1ebd9['uniqueid']][_0x47f0('0x2a')]=channels[_0x1ebd9['uniqueid']][_0x47f0('0x22')]?utils[_0x47f0('0x28')](channels[_0x1ebd9[_0x47f0('0x15')]][_0x47f0('0x27')],channels[_0x1ebd9[_0x47f0('0x15')]][_0x47f0('0x22')]):0x0;writeDB(channels[_0x1ebd9['uniqueid']]);}}catch(_0x2a8fdc){utils[_0x47f0('0x1c')](_0x2a8fdc['stack']);}};exports['attendedtransfer']=function(_0x4b65af){try{if(!_[_0x47f0('0x1d')](channels[_0x4b65af[_0x47f0('0x2b')]])){if(channels[_0x4b65af[_0x47f0('0x2b')]][_0x47f0('0x9')]==_0x4b65af['transfereechannel']){channels[_0x4b65af['localtwolinkedid']][_0x47f0('0x21')]=_0x4b65af['secondtransfererchannel'];channels[_0x4b65af[_0x47f0('0x2b')]]['userfield']='_attended';}else if(channels[_0x4b65af[_0x47f0('0x2b')]][_0x47f0('0x9')]=_0x4b65af['transfertargetchannel']){channels[_0x4b65af['localtwolinkedid']][_0x47f0('0x21')]=_0x4b65af[_0x47f0('0x2c')];channels[_0x4b65af[_0x47f0('0x2b')]]['userfield']=_0x47f0('0x2d');}}}catch(_0x449930){utils['error'](_0x449930[_0x47f0('0x24')]);}};exports[_0x47f0('0x2e')]=function(_0x38687a){try{if(!_[_0x47f0('0x1d')](channels[_0x38687a[_0x47f0('0x15')]])){channels[_0x38687a[_0x47f0('0x15')]]['musiconholdstartAt']=utils[_0x47f0('0x20')]();}}catch(_0x1803af){utils[_0x47f0('0x1c')](_0x1803af[_0x47f0('0x24')]);}};exports[_0x47f0('0x2f')]=function(_0x4f6db5){try{if(!_[_0x47f0('0x1d')](channels[_0x4f6db5[_0x47f0('0x15')]])){if(!_[_0x47f0('0x1d')](channels[_0x4f6db5[_0x47f0('0x15')]][_0x47f0('0x30')])){channels[_0x4f6db5[_0x47f0('0x15')]][_0x47f0('0x31')]+=utils[_0x47f0('0x28')](utils[_0x47f0('0x20')](),channels[_0x4f6db5[_0x47f0('0x15')]]['musiconholdstartAt']);delete channels[_0x4f6db5[_0x47f0('0x15')]][_0x47f0('0x30')];}}}catch(_0x42e2a2){utils[_0x47f0('0x1c')](_0x42e2a2[_0x47f0('0x24')]);}};exports[_0x47f0('0x32')]=function(_0x431387){try{if(!_[_0x47f0('0x1d')](channels[_0x431387['uniqueid']])){if(!_[_0x47f0('0x1d')](_0x431387['variable'][_0x47f0('0x33')])){channels[_0x431387[_0x47f0('0x15')]]['source']=_0x431387[_0x47f0('0x34')];}if(!_[_0x47f0('0x1d')](_0x431387['variable'][_0x47f0('0x35')])){channels[_0x431387['uniqueid']][_0x47f0('0xd')]=_0x431387[_0x47f0('0x34')];channels[_0x431387[_0x47f0('0x15')]]['callerid']='\x22'+_0x431387[_0x47f0('0x34')]+_0x47f0('0x36')+_0x431387['value']+'>';}if(!_['isNil'](_0x431387[_0x47f0('0x37')][_0x47f0('0x38')])||!_[_0x47f0('0x1d')](_0x431387[_0x47f0('0x37')][_0x47f0('0x39')])){channels[_0x431387[_0x47f0('0x15')]][_0x47f0('0xe')]=_0x431387[_0x47f0('0x34')];}if(!_[_0x47f0('0x1d')](_0x431387[_0x47f0('0x37')][_0x47f0('0x3a')])||!_[_0x47f0('0x1d')](_0x431387[_0x47f0('0x37')][_0x47f0('0x3b')])){channels[_0x431387[_0x47f0('0x15')]]['lastapplication']='Queue';channels[_0x431387['uniqueid']][_0x47f0('0x3c')]=_0x431387[_0x47f0('0x34')];channels[_0x431387['uniqueid']][_0x47f0('0x3d')]=!![];}if(!_[_0x47f0('0x1d')](_0x431387[_0x47f0('0x37')][_0x47f0('0x3e')])){channels[_0x431387[_0x47f0('0x15')]]['ContactId']=_0x431387[_0x47f0('0x34')];}if(!_[_0x47f0('0x1d')](_0x431387[_0x47f0('0x37')]['xmd-cdrtype'])){channels[_0x431387[_0x47f0('0x15')]][_0x47f0('0xa')]=_0x431387[_0x47f0('0x34')];}if(!_[_0x47f0('0x1d')](_0x431387[_0x47f0('0x37')]['outboundrouteid'])){channels[_0x431387[_0x47f0('0x15')]][_0x47f0('0x3f')]=_0x431387[_0x47f0('0x34')];}if(!_['isNil'](_0x431387[_0x47f0('0x37')][_0x47f0('0x40')])){channels[_0x431387[_0x47f0('0x15')]][_0x47f0('0x40')]=_0x431387[_0x47f0('0x34')];}}}catch(_0x3fa1b8){utils[_0x47f0('0x1c')](_0x3fa1b8[_0x47f0('0x24')]);}};exports[_0x47f0('0x41')]=function(_0x30c0b5){try{if(!_['isNil'](channels[_0x30c0b5[_0x47f0('0x15')]])){if(_0x30c0b5[_0x47f0('0x42')][_0x47f0('0x43')]()==_0x47f0('0x44')&&_['startsWith'](_0x30c0b5[_0x47f0('0x45')]['toLowerCase'](),_0x47f0('0x46'))){var _0x2056d8=_0x30c0b5[_0x47f0('0x45')][_0x47f0('0x47')]('=');var _0x33b90d=_0x2056d8[0x0][_0x47f0('0x48')](_0x2056d8[0x0]['lastIndexOf']('(')+0x1,_0x2056d8[0x0]['lastIndexOf'](')'));var _0xb0c63e=_0x2056d8[0x1];channels[_0x30c0b5[_0x47f0('0x15')]][_0x33b90d]=_0xb0c63e;}if(!_[_0x47f0('0x49')]([_0x47f0('0x25'),_0x47f0('0x4a'),_0x47f0('0x4b'),_0x47f0('0x44'),_0x47f0('0x4c')],_0x30c0b5[_0x47f0('0x42')][_0x47f0('0x43')]())){channels[_0x30c0b5[_0x47f0('0x15')]][_0x47f0('0x4d')]=_0x30c0b5[_0x47f0('0x42')];channels[_0x30c0b5[_0x47f0('0x15')]]['lastdata']=_0x30c0b5[_0x47f0('0x45')];}}}catch(_0x836189){utils['error'](_0x836189[_0x47f0('0x24')]);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index a2be4bc..4c1c4ab 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 _0x7046=['shutdown','SHUTDOWN','FULLYBOOTED','error','./utils','lodash','connect','info'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0x7046,0x144));var _0x6704=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x7046[_0x4e676e];return _0x336a3c;};'use strict';var utils=require(_0x6704('0x0'));var _=require(_0x6704('0x1'));exports[_0x6704('0x2')]=function(){utils[_0x6704('0x3')]('CONNECTED');};exports[_0x6704('0x4')]=function(){utils[_0x6704('0x3')](_0x6704('0x5'));};exports['fullybooted']=function(){utils[_0x6704('0x3')](_0x6704('0x6'));};exports[_0x6704('0x7')]=function(_0x626a14){utils[_0x6704('0x7')](_0x626a14);};exports['close']=function(){utils[_0x6704('0x3')]('CLOSE');};exports['managerevent']=function(_0x390ace){}; \ No newline at end of file +var _0x90b1=['close','CLOSE','managerevent','./utils','lodash','connect','shutdown','info','SHUTDOWN','fullybooted','error'];(function(_0x1c8318,_0xb26f9f){var _0x35d3e0=function(_0x3ceac6){while(--_0x3ceac6){_0x1c8318['push'](_0x1c8318['shift']());}};_0x35d3e0(++_0xb26f9f);}(_0x90b1,0x1bb));var _0x190b=function(_0x30a31e,_0x31f766){_0x30a31e=_0x30a31e-0x0;var _0x170879=_0x90b1[_0x30a31e];return _0x170879;};'use strict';var utils=require(_0x190b('0x0'));var _=require(_0x190b('0x1'));exports[_0x190b('0x2')]=function(){utils['info']('CONNECTED');};exports[_0x190b('0x3')]=function(){utils[_0x190b('0x4')](_0x190b('0x5'));};exports[_0x190b('0x6')]=function(){utils['info']('FULLYBOOTED');};exports['error']=function(_0x5da9c1){utils[_0x190b('0x7')](_0x5da9c1);};exports[_0x190b('0x8')]=function(){utils[_0x190b('0x4')](_0x190b('0x9'));};exports[_0x190b('0xa')]=function(_0x802924){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 632ca37..23f9a93 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 _0x62a5=['dialend','isNil','dialstatus','ANSWER','answertime','lastevent','duration','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','uniqueid','channel','dialstring','request','CreateVoiceDialReport','application','toLowerCase','appdata','split','stack','varset','value','error','dialbegin','assign','starttime','now','called'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x62a5,0x14b));var _0x562a=function(_0x57e535,_0x2861f7){_0x57e535=_0x57e535-0x0;var _0x40bf4f=_0x62a5[_0x57e535];return _0x40bf4f;};'use strict';var _=require(_0x562a('0x0'));var util=require(_0x562a('0x1'));var utils=require(_0x562a('0x2'));var dials={};function writeDB(_0x2d51f1){utils['info'](util['format']('DIAL|%s|%s|%s|%s|%s|%s',_0x2d51f1[_0x562a('0x3')],_0x2d51f1[_0x562a('0x4')],_0x2d51f1[_0x562a('0x5')],_0x2d51f1['calleridnum'],_0x2d51f1['connectedlinenum'],_0x2d51f1['dialstatus']));utils[_0x562a('0x6')](_0x562a('0x7'),_0x2d51f1);delete dials[_0x2d51f1[_0x562a('0x3')]];}exports['newexten']=function(_0x5e6808){try{if(_0x5e6808[_0x562a('0x8')][_0x562a('0x9')]()=='set'&&_['startsWith'](_0x5e6808[_0x562a('0xa')][_0x562a('0x9')](),'cdr(routeid)')){var _0x3ad706=_0x5e6808[_0x562a('0xa')][_0x562a('0xb')]('=');dials[_0x5e6808[_0x562a('0x3')]]={'routeId':_0x3ad706[0x1]};}}catch(_0x24f128){utils['error'](_0x24f128[_0x562a('0xc')]);}};exports[_0x562a('0xd')]=function(_0x4b87d1){try{if(!_['isNil'](_0x4b87d1['variable']['outboundrouteid'])){dials[_0x4b87d1[_0x562a('0x3')]]={'routeId':_0x4b87d1[_0x562a('0xe')]};}}catch(_0x142863){utils[_0x562a('0xf')](_0x142863[_0x562a('0xc')]);}};exports[_0x562a('0x10')]=function(_0x212ef6){try{if(!_['isNil'](dials[_0x212ef6[_0x562a('0x3')]])){dials[_0x212ef6[_0x562a('0x3')]]=_[_0x562a('0x11')](dials[_0x212ef6[_0x562a('0x3')]],_0x212ef6);dials[_0x212ef6['uniqueid']][_0x562a('0x12')]=utils[_0x562a('0x13')]();dials[_0x212ef6[_0x562a('0x3')]]['lastevent']=_0x562a('0x14');}}catch(_0x23962d){utils[_0x562a('0xf')](_0x23962d['stack']);}};exports[_0x562a('0x15')]=function(_0x19f4c4){try{if(!_[_0x562a('0x16')](dials[_0x19f4c4[_0x562a('0x3')]])){dials[_0x19f4c4['uniqueid']][_0x562a('0x17')]=_0x19f4c4[_0x562a('0x17')];if(_0x19f4c4['dialstatus']==_0x562a('0x18')){dials[_0x19f4c4[_0x562a('0x3')]]=_[_0x562a('0x11')](dials[_0x19f4c4[_0x562a('0x3')]],_0x19f4c4);dials[_0x19f4c4[_0x562a('0x3')]][_0x562a('0x19')]=utils[_0x562a('0x13')]();dials[_0x19f4c4[_0x562a('0x3')]][_0x562a('0x1a')]='connect';}}}catch(_0xabab56){utils[_0x562a('0xf')](_0xabab56[_0x562a('0xc')]);}};exports['hangup']=function(_0x26b4fd){try{if(!_['isNil'](dials[_0x26b4fd['uniqueid']])){dials[_0x26b4fd[_0x562a('0x3')]]=_[_0x562a('0x11')](dials[_0x26b4fd[_0x562a('0x3')]],{'endtime':utils[_0x562a('0x13')](),'lastevent':'complete'});dials[_0x26b4fd[_0x562a('0x3')]][_0x562a('0x1b')]=utils[_0x562a('0x1c')](dials[_0x26b4fd[_0x562a('0x3')]][_0x562a('0x1d')],dials[_0x26b4fd[_0x562a('0x3')]]['starttime']);dials[_0x26b4fd[_0x562a('0x3')]][_0x562a('0x1e')]=utils[_0x562a('0x1c')](dials[_0x26b4fd[_0x562a('0x3')]]['answertime']||dials[_0x26b4fd[_0x562a('0x3')]][_0x562a('0x1d')],dials[_0x26b4fd[_0x562a('0x3')]][_0x562a('0x12')]);dials[_0x26b4fd['uniqueid']][_0x562a('0x1f')]=dials[_0x26b4fd[_0x562a('0x3')]][_0x562a('0x19')]?utils['diffTime'](dials[_0x26b4fd[_0x562a('0x3')]]['endtime'],dials[_0x26b4fd[_0x562a('0x3')]][_0x562a('0x19')]):0x0;writeDB(dials[_0x26b4fd['uniqueid']]);}}catch(_0x4e765d){utils[_0x562a('0xf')](_0x4e765d[_0x562a('0xc')]);}}; \ No newline at end of file +var _0x0854=['set','startsWith','appdata','toLowerCase','cdr(routeid)','split','error','stack','varset','isNil','variable','outboundrouteid','dialbegin','starttime','now','lastevent','called','dialend','ANSWER','assign','connect','complete','duration','diffTime','endtime','answertime','billableseconds','lodash','./utils','format','DIAL|%s|%s|%s|%s|%s|%s','uniqueid','channel','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport'];(function(_0x48c303,_0x267335){var _0x18f65c=function(_0x141686){while(--_0x141686){_0x48c303['push'](_0x48c303['shift']());}};_0x18f65c(++_0x267335);}(_0x0854,0xd9));var _0x4085=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0854[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x4085('0x0'));var util=require('util');var utils=require(_0x4085('0x1'));var dials={};function writeDB(_0x17c9fd){utils['info'](util[_0x4085('0x2')](_0x4085('0x3'),_0x17c9fd[_0x4085('0x4')],_0x17c9fd[_0x4085('0x5')],_0x17c9fd['dialstring'],_0x17c9fd[_0x4085('0x6')],_0x17c9fd[_0x4085('0x7')],_0x17c9fd[_0x4085('0x8')]));utils[_0x4085('0x9')](_0x4085('0xa'),_0x17c9fd);delete dials[_0x17c9fd[_0x4085('0x4')]];}exports['newexten']=function(_0xb10def){try{if(_0xb10def['application']['toLowerCase']()==_0x4085('0xb')&&_[_0x4085('0xc')](_0xb10def[_0x4085('0xd')][_0x4085('0xe')](),_0x4085('0xf'))){var _0x1d9ea8=_0xb10def[_0x4085('0xd')][_0x4085('0x10')]('=');dials[_0xb10def['uniqueid']]={'routeId':_0x1d9ea8[0x1]};}}catch(_0x253c38){utils[_0x4085('0x11')](_0x253c38[_0x4085('0x12')]);}};exports[_0x4085('0x13')]=function(_0x47f7fb){try{if(!_[_0x4085('0x14')](_0x47f7fb[_0x4085('0x15')][_0x4085('0x16')])){dials[_0x47f7fb[_0x4085('0x4')]]={'routeId':_0x47f7fb['value']};}}catch(_0x19d460){utils[_0x4085('0x11')](_0x19d460[_0x4085('0x12')]);}};exports[_0x4085('0x17')]=function(_0x50975a){try{if(!_[_0x4085('0x14')](dials[_0x50975a[_0x4085('0x4')]])){dials[_0x50975a[_0x4085('0x4')]]=_['assign'](dials[_0x50975a[_0x4085('0x4')]],_0x50975a);dials[_0x50975a[_0x4085('0x4')]][_0x4085('0x18')]=utils[_0x4085('0x19')]();dials[_0x50975a[_0x4085('0x4')]][_0x4085('0x1a')]=_0x4085('0x1b');}}catch(_0x110237){utils[_0x4085('0x11')](_0x110237['stack']);}};exports[_0x4085('0x1c')]=function(_0x1a16c8){try{if(!_[_0x4085('0x14')](dials[_0x1a16c8[_0x4085('0x4')]])){dials[_0x1a16c8['uniqueid']][_0x4085('0x8')]=_0x1a16c8[_0x4085('0x8')];if(_0x1a16c8[_0x4085('0x8')]==_0x4085('0x1d')){dials[_0x1a16c8[_0x4085('0x4')]]=_[_0x4085('0x1e')](dials[_0x1a16c8['uniqueid']],_0x1a16c8);dials[_0x1a16c8[_0x4085('0x4')]]['answertime']=utils['now']();dials[_0x1a16c8[_0x4085('0x4')]]['lastevent']=_0x4085('0x1f');}}}catch(_0x15e1a1){utils[_0x4085('0x11')](_0x15e1a1[_0x4085('0x12')]);}};exports['hangup']=function(_0x591c6b){try{if(!_[_0x4085('0x14')](dials[_0x591c6b['uniqueid']])){dials[_0x591c6b['uniqueid']]=_[_0x4085('0x1e')](dials[_0x591c6b['uniqueid']],{'endtime':utils[_0x4085('0x19')](),'lastevent':_0x4085('0x20')});dials[_0x591c6b[_0x4085('0x4')]][_0x4085('0x21')]=utils[_0x4085('0x22')](dials[_0x591c6b['uniqueid']][_0x4085('0x23')],dials[_0x591c6b[_0x4085('0x4')]][_0x4085('0x18')]);dials[_0x591c6b[_0x4085('0x4')]]['holdtime']=utils[_0x4085('0x22')](dials[_0x591c6b['uniqueid']][_0x4085('0x24')]||dials[_0x591c6b[_0x4085('0x4')]][_0x4085('0x23')],dials[_0x591c6b[_0x4085('0x4')]][_0x4085('0x18')]);dials[_0x591c6b[_0x4085('0x4')]][_0x4085('0x25')]=dials[_0x591c6b[_0x4085('0x4')]]['answertime']?utils['diffTime'](dials[_0x591c6b[_0x4085('0x4')]]['endtime'],dials[_0x591c6b[_0x4085('0x4')]][_0x4085('0x24')]):0x0;writeDB(dials[_0x591c6b[_0x4085('0x4')]]);}}catch(_0x2e7366){utils[_0x4085('0x11')](_0x2e7366['stack']);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 5743cd0..f48777d 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 _0x5742=['XDR\x20DISABLED','./agents.controller','./queues.controller','./members.controller','./transfers.controller','./core.controller','connect','fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','asterisk-manager','./utils','port','asterisk','username','password','xdr','disabled','info'];(function(_0x2865f0,_0x470cb7){var _0x4c1878=function(_0x5cb26f){while(--_0x5cb26f){_0x2865f0['push'](_0x2865f0['shift']());}};_0x4c1878(++_0x470cb7);}(_0x5742,0x97));var _0x2574=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x5742[_0x2c7618];return _0x5ce3f0;};var AsteriskManager=require(_0x2574('0x0'));var config=require('../../config/environment');var utils=require(_0x2574('0x1'));var ami=new AsteriskManager(config['asterisk'][_0x2574('0x2')],config[_0x2574('0x3')]['ip'],config[_0x2574('0x3')][_0x2574('0x4')],config['asterisk'][_0x2574('0x5')],!![]);ami['keepConnected']();if(config[_0x2574('0x6')]&&config[_0x2574('0x6')][_0x2574('0x7')]){utils[_0x2574('0x8')](_0x2574('0x9'));}else{var agents=require(_0x2574('0xa'));var calls=require('./calls.controller');var queues=require(_0x2574('0xb'));var recordings=require('./recordings.controller');var members=require(_0x2574('0xc'));var dials=require('./dials.controller');var transfers=require(_0x2574('0xd'));var core=require(_0x2574('0xe'));ami['on'](_0x2574('0xf'),core[_0x2574('0xf')]);ami['on']('shutdown',core['shutdown']);ami['on'](_0x2574('0x10'),core[_0x2574('0x10')]);ami['on'](_0x2574('0x11'),core[_0x2574('0x11')]);ami['on'](_0x2574('0x12'),core[_0x2574('0x12')]);ami['on']('managerevent',core[_0x2574('0x13')]);ami['on'](_0x2574('0x14'),function(_0x298720){try{members[_0x2574('0x14')](_0x298720);}catch(_0x44490b){utils[_0x2574('0x11')](_0x44490b);}});ami['on'](_0x2574('0x15'),function(_0x1687a4){try{agents[_0x2574('0x15')](_0x1687a4);}catch(_0x5907f2){utils[_0x2574('0x11')](_0x5907f2);}});ami['on'](_0x2574('0x16'),function(_0x31ca48){try{agents[_0x2574('0x16')](_0x31ca48);}catch(_0x4f6018){utils[_0x2574('0x11')](_0x4f6018);}});ami['on'](_0x2574('0x17'),function(_0x5d3d6a){try{agents[_0x2574('0x17')](_0x5d3d6a);queues[_0x2574('0x17')](_0x5d3d6a);}catch(_0x2020cd){utils[_0x2574('0x11')](_0x2020cd);}});ami['on']('agentcomplete',function(_0x34c82b){try{agents['agentcomplete'](_0x34c82b);queues['agentcomplete'](_0x34c82b);members[_0x2574('0x18')](_0x34c82b);}catch(_0x53ec0c){utils['error'](_0x53ec0c);}});ami['on'](_0x2574('0x19'),function(_0x5f2272){try{agents[_0x2574('0x19')](_0x5f2272);queues[_0x2574('0x19')](_0x5f2272);}catch(_0x20c524){utils[_0x2574('0x11')](_0x20c524);}});ami['on']('queuecallerjoin',function(_0xd009b6){try{queues[_0x2574('0x1a')](_0xd009b6);recordings[_0x2574('0x1a')](_0xd009b6);}catch(_0x30cc69){utils[_0x2574('0x11')](_0x30cc69);}});ami['on'](_0x2574('0x1b'),function(_0x265166){try{queues['queuecallerleave'](_0x265166);}catch(_0x2067f4){utils[_0x2574('0x11')](_0x2067f4);}});ami['on']('musiconholdstart',function(_0x1ff6e4){try{queues[_0x2574('0x1c')](_0x1ff6e4);calls[_0x2574('0x1c')](_0x1ff6e4);}catch(_0x3c8a93){utils[_0x2574('0x11')](_0x3c8a93);}});ami['on']('musiconholdstop',function(_0x55a0de){try{queues[_0x2574('0x1d')](_0x55a0de);calls[_0x2574('0x1d')](_0x55a0de);}catch(_0x1937c8){utils[_0x2574('0x11')](_0x1937c8);}});ami['on'](_0x2574('0x1e'),function(_0x2be6f7){try{calls['newstate'](_0x2be6f7);recordings[_0x2574('0x1e')](_0x2be6f7);}catch(_0x10e0d0){utils[_0x2574('0x11')](_0x10e0d0);}});ami['on']('hangup',function(_0xb7e7d5){try{calls[_0x2574('0x1f')](_0xb7e7d5);recordings['hangup'](_0xb7e7d5);dials[_0x2574('0x1f')](_0xb7e7d5);agents['hangup'](_0xb7e7d5);queues[_0x2574('0x1f')](_0xb7e7d5);}catch(_0x525b53){utils['error'](_0x525b53);}});ami['on'](_0x2574('0x20'),function(_0x533721){try{members[_0x2574('0x20')](_0x533721);}catch(_0xf4773b){utils['error'](_0xf4773b);}});ami['on'](_0x2574('0x21'),function(_0x5611e7){try{queues['blindtransfer'](_0x5611e7);agents['blindtransfer'](_0x5611e7);transfers['blindtransfer'](_0x5611e7);}catch(_0x3e412c){utils['error'](_0x3e412c);}});ami['on']('attendedtransfer',function(_0x4217d6){try{queues['attendedtransfer'](_0x4217d6);transfers[_0x2574('0x22')](_0x4217d6);agents[_0x2574('0x22')](_0x4217d6);calls['attendedtransfer'](_0x4217d6);}catch(_0x3c4704){utils[_0x2574('0x11')](_0x3c4704);}});ami['on'](_0x2574('0x23'),function(_0x57910f){try{queues['varset'](_0x57910f);recordings[_0x2574('0x23')](_0x57910f);calls[_0x2574('0x23')](_0x57910f);dials[_0x2574('0x23')](_0x57910f);}catch(_0x90a401){utils[_0x2574('0x11')](_0x90a401);}});ami['on'](_0x2574('0x24'),function(_0x422dd7){try{calls[_0x2574('0x24')](_0x422dd7);recordings[_0x2574('0x24')](_0x422dd7);dials[_0x2574('0x24')](_0x422dd7);}catch(_0x4aa49a){utils[_0x2574('0x11')](_0x4aa49a);}});ami['on']('newchannel',function(_0x7a328d){try{calls[_0x2574('0x25')](_0x7a328d);recordings[_0x2574('0x25')](_0x7a328d);}catch(_0x405b71){utils[_0x2574('0x11')](_0x405b71);}});ami['on']('dialbegin',function(_0x314f2b){try{dials[_0x2574('0x26')](_0x314f2b);}catch(_0x4d03ae){utils[_0x2574('0x11')](_0x4d03ae);}});ami['on'](_0x2574('0x27'),function(_0x4637fc){try{dials['dialend'](_0x4637fc);}catch(_0x56b0cb){utils[_0x2574('0x11')](_0x56b0cb);}});} \ No newline at end of file +var _0x2705=['./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','asterisk-manager','../../config/environment','asterisk','port','username','xdr','disabled','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller'];(function(_0x16cea5,_0x4ad08a){var _0x69dd74=function(_0x340f14){while(--_0x340f14){_0x16cea5['push'](_0x16cea5['shift']());}};_0x69dd74(++_0x4ad08a);}(_0x2705,0x144));var _0x5270=function(_0x4e503a,_0xf7b46f){_0x4e503a=_0x4e503a-0x0;var _0x4d2ab2=_0x2705[_0x4e503a];return _0x4d2ab2;};var AsteriskManager=require(_0x5270('0x0'));var config=require(_0x5270('0x1'));var utils=require('./utils');var ami=new AsteriskManager(config[_0x5270('0x2')][_0x5270('0x3')],config[_0x5270('0x2')]['ip'],config[_0x5270('0x2')][_0x5270('0x4')],config[_0x5270('0x2')]['password'],!![]);ami['keepConnected']();if(config[_0x5270('0x5')]&&config['xdr'][_0x5270('0x6')]){utils['info'](_0x5270('0x7'));}else{var agents=require(_0x5270('0x8'));var calls=require(_0x5270('0x9'));var queues=require(_0x5270('0xa'));var recordings=require(_0x5270('0xb'));var members=require(_0x5270('0xc'));var dials=require(_0x5270('0xd'));var transfers=require(_0x5270('0xe'));var core=require(_0x5270('0xf'));ami['on'](_0x5270('0x10'),core[_0x5270('0x10')]);ami['on'](_0x5270('0x11'),core['shutdown']);ami['on'](_0x5270('0x12'),core[_0x5270('0x12')]);ami['on'](_0x5270('0x13'),core['error']);ami['on'](_0x5270('0x14'),core[_0x5270('0x14')]);ami['on']('managerevent',core[_0x5270('0x15')]);ami['on'](_0x5270('0x16'),function(_0x3ced8e){try{members[_0x5270('0x16')](_0x3ced8e);}catch(_0xd9939d){utils[_0x5270('0x13')](_0xd9939d);}});ami['on'](_0x5270('0x17'),function(_0x25d903){try{agents[_0x5270('0x17')](_0x25d903);}catch(_0x5a4c5a){utils[_0x5270('0x13')](_0x5a4c5a);}});ami['on'](_0x5270('0x18'),function(_0x375551){try{agents['agentringnoanswer'](_0x375551);}catch(_0x48efac){utils[_0x5270('0x13')](_0x48efac);}});ami['on'](_0x5270('0x19'),function(_0x10dfc7){try{agents[_0x5270('0x19')](_0x10dfc7);queues['agentconnect'](_0x10dfc7);}catch(_0x26ea0f){utils[_0x5270('0x13')](_0x26ea0f);}});ami['on'](_0x5270('0x1a'),function(_0x24856d){try{agents[_0x5270('0x1a')](_0x24856d);queues[_0x5270('0x1a')](_0x24856d);members[_0x5270('0x1a')](_0x24856d);}catch(_0x16b8c8){utils[_0x5270('0x13')](_0x16b8c8);}});ami['on']('queuecallerabandon',function(_0x3f299e){try{agents[_0x5270('0x1b')](_0x3f299e);queues[_0x5270('0x1b')](_0x3f299e);}catch(_0x5a153a){utils[_0x5270('0x13')](_0x5a153a);}});ami['on'](_0x5270('0x1c'),function(_0x30503d){try{queues[_0x5270('0x1c')](_0x30503d);recordings[_0x5270('0x1c')](_0x30503d);}catch(_0x421555){utils[_0x5270('0x13')](_0x421555);}});ami['on'](_0x5270('0x1d'),function(_0x525dd5){try{queues['queuecallerleave'](_0x525dd5);}catch(_0xe2a2f4){utils[_0x5270('0x13')](_0xe2a2f4);}});ami['on'](_0x5270('0x1e'),function(_0x188993){try{queues[_0x5270('0x1e')](_0x188993);calls[_0x5270('0x1e')](_0x188993);}catch(_0x3ea085){utils[_0x5270('0x13')](_0x3ea085);}});ami['on'](_0x5270('0x1f'),function(_0x26f225){try{queues[_0x5270('0x1f')](_0x26f225);calls[_0x5270('0x1f')](_0x26f225);}catch(_0x5d7b32){utils[_0x5270('0x13')](_0x5d7b32);}});ami['on'](_0x5270('0x20'),function(_0x2a5556){try{calls[_0x5270('0x20')](_0x2a5556);recordings[_0x5270('0x20')](_0x2a5556);}catch(_0x2e1dc3){utils[_0x5270('0x13')](_0x2e1dc3);}});ami['on'](_0x5270('0x21'),function(_0x5bf317){try{calls[_0x5270('0x21')](_0x5bf317);recordings['hangup'](_0x5bf317);dials[_0x5270('0x21')](_0x5bf317);agents['hangup'](_0x5bf317);queues['hangup'](_0x5bf317);}catch(_0x3613db){utils['error'](_0x3613db);}});ami['on'](_0x5270('0x22'),function(_0x1e5820){try{members[_0x5270('0x22')](_0x1e5820);}catch(_0x474923){utils[_0x5270('0x13')](_0x474923);}});ami['on'](_0x5270('0x23'),function(_0x15c261){try{queues['blindtransfer'](_0x15c261);agents[_0x5270('0x23')](_0x15c261);transfers[_0x5270('0x23')](_0x15c261);}catch(_0x370438){utils[_0x5270('0x13')](_0x370438);}});ami['on'](_0x5270('0x24'),function(_0x76234e){try{queues['attendedtransfer'](_0x76234e);transfers[_0x5270('0x24')](_0x76234e);agents[_0x5270('0x24')](_0x76234e);calls['attendedtransfer'](_0x76234e);}catch(_0x3301d5){utils[_0x5270('0x13')](_0x3301d5);}});ami['on'](_0x5270('0x25'),function(_0xa5cd2e){try{queues['varset'](_0xa5cd2e);recordings[_0x5270('0x25')](_0xa5cd2e);calls['varset'](_0xa5cd2e);dials[_0x5270('0x25')](_0xa5cd2e);}catch(_0x2ccbc7){utils[_0x5270('0x13')](_0x2ccbc7);}});ami['on'](_0x5270('0x26'),function(_0x5e1a20){try{calls[_0x5270('0x26')](_0x5e1a20);recordings[_0x5270('0x26')](_0x5e1a20);dials[_0x5270('0x26')](_0x5e1a20);}catch(_0x2ddcb9){utils[_0x5270('0x13')](_0x2ddcb9);}});ami['on'](_0x5270('0x27'),function(_0x2fe656){try{calls[_0x5270('0x27')](_0x2fe656);recordings[_0x5270('0x27')](_0x2fe656);}catch(_0x5410e4){utils[_0x5270('0x13')](_0x5410e4);}});ami['on'](_0x5270('0x28'),function(_0x48f66b){try{dials[_0x5270('0x28')](_0x48f66b);}catch(_0xeb6666){utils[_0x5270('0x13')](_0xeb6666);}});ami['on'](_0x5270('0x29'),function(_0x25b547){try{dials[_0x5270('0x29')](_0x25b547);}catch(_0x1751bb){utils[_0x5270('0x13')](_0x1751bb);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 2009f34..fa6ae46 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 _0x199c=['INUSE','BUSY','device','voice','TALKING','agent','NOT_INUSE','isNil','exitAt','now','duration','diffTime','enterAt','agentcomplete','assign','cdr','split','data1','data3','destination','lodash','util','./utils','Local/_attended@transfer','Queue:','info','MEMBER|%s|%s|%s|%s|%s|%s','uniqueid','interface','channel','data2','membername','type','getUserByInterface','then','request','CreateMemberReport','name','internal','catch','error','some','startsWith','devicestatechange','state'];(function(_0x10fb18,_0x2fce92){var _0x5dd09a=function(_0x43ad4f){while(--_0x43ad4f){_0x10fb18['push'](_0x10fb18['shift']());}};_0x5dd09a(++_0x2fce92);}(_0x199c,0x1d6));var _0xc199=function(_0x410f06,_0x20a84e){_0x410f06=_0x410f06-0x0;var _0x4a8a65=_0x199c[_0x410f06];return _0x4a8a65;};'use strict';var _=require(_0xc199('0x0'));var util=require(_0xc199('0x1'));var utils=require(_0xc199('0x2'));var members={};var exclude=[_0xc199('0x3'),_0xc199('0x4')];function writeDB(_0x35706f){utils[_0xc199('0x5')](util['format'](_0xc199('0x6'),_0x35706f[_0xc199('0x7')],_0x35706f[_0xc199('0x8')],_0x35706f[_0xc199('0x9')],_0x35706f[_0xc199('0xa')],_0x35706f[_0xc199('0xb')],_0x35706f[_0xc199('0xc')]));if(_0x35706f['interface']){utils[_0xc199('0xd')](_0x35706f[_0xc199('0x8')])[_0xc199('0xe')](function(_0x3d8bd3){if(_0x3d8bd3){_0x35706f[_0xc199('0xb')]=_0x3d8bd3['name'];_0x35706f['internal']=_0x3d8bd3['internal'];utils[_0xc199('0xf')](_0xc199('0x10'),_0x35706f);}else{utils['getUserByName'](_0x35706f[_0xc199('0x8')]['split']('/')[0x1])['then'](function(_0x439a7f){if(_0x439a7f){_0x35706f[_0xc199('0xb')]=_0x439a7f[_0xc199('0x11')];_0x35706f[_0xc199('0x12')]=_0x439a7f['internal'];utils[_0xc199('0xf')](_0xc199('0x10'),_0x35706f);}});}})[_0xc199('0x13')](function(_0x20b8ea){utils[_0xc199('0x14')](_0x20b8ea);});}delete members[_0x35706f['interface']];}function startsWith(_0x3efa88,_0x2dc040){return _[_0xc199('0x15')](_0x3efa88,function(_0x4a3507){return _[_0xc199('0x16')](_0x2dc040,_0x4a3507);});}exports[_0xc199('0x17')]=function(_0x4ff570){switch(_0x4ff570[_0xc199('0x18')]){case _0xc199('0x19'):case _0xc199('0x1a'):if(!startsWith(exclude,_0x4ff570[_0xc199('0x1b')])){members[_0x4ff570['device']]={'channel':_0xc199('0x1c'),'interface':_0x4ff570[_0xc199('0x1b')],'type':_0xc199('0x1d'),'enterAt':utils['now'](),'role':_0xc199('0x1e')};}break;case _0xc199('0x1f'):if(!_[_0xc199('0x20')](members[_0x4ff570['device']])){members[_0x4ff570[_0xc199('0x1b')]][_0xc199('0x21')]=utils[_0xc199('0x22')]();members[_0x4ff570[_0xc199('0x1b')]][_0xc199('0x23')]=utils[_0xc199('0x24')](members[_0x4ff570[_0xc199('0x1b')]][_0xc199('0x21')],members[_0x4ff570[_0xc199('0x1b')]][_0xc199('0x25')]);if(members[_0x4ff570[_0xc199('0x1b')]][_0xc199('0x7')]){writeDB(members[_0x4ff570[_0xc199('0x1b')]]);}}default:break;}};exports[_0xc199('0x26')]=function(_0x425c4e){if(!_[_0xc199('0x20')](members[_0x425c4e['interface']])){members[_0x425c4e[_0xc199('0x8')]]=_[_0xc199('0x27')](members[_0x425c4e['interface']],{'data4':_0x425c4e['queue'],'uniqueid':_0x425c4e[_0xc199('0x7')]});}};exports[_0xc199('0x28')]=function(_0x47b7b1){if(_0x47b7b1[_0xc199('0x9')]){var _0x38d9b7=_0x47b7b1[_0xc199('0x9')][_0xc199('0x29')]('-')[0x0];if(!_[_0xc199('0x20')](members[_0x38d9b7])){members[_0x38d9b7]=_[_0xc199('0x27')](members[_0x38d9b7],{'data1':members[_0x38d9b7][_0xc199('0x2a')]||_0x47b7b1[_0xc199('0xc')],'data2':members[_0x38d9b7][_0xc199('0xa')]||_0x47b7b1['source'],'data3':members[_0x38d9b7][_0xc199('0x2b')]||_0x47b7b1[_0xc199('0x2c')],'uniqueid':members[_0x38d9b7]['uniqueid']||_0x47b7b1['uniqueid']});if(members[_0x38d9b7][_0xc199('0x21')]){writeDB(members[_0x38d9b7]);}}}if(_0x47b7b1['destinationchannel']){var _0x257d1b=_0x47b7b1['destinationchannel'][_0xc199('0x29')]('-')[0x0];if(!_[_0xc199('0x20')](members[_0x257d1b])){members[_0x257d1b]=_[_0xc199('0x27')](members[_0x257d1b],{'data1':members[_0x257d1b][_0xc199('0x2a')]||_0x47b7b1[_0xc199('0xc')],'data2':members[_0x257d1b][_0xc199('0xa')]||_0x47b7b1['source'],'data3':members[_0x257d1b][_0xc199('0x2b')]||_0x47b7b1[_0xc199('0x2c')],'uniqueid':members[_0x257d1b]['uniqueid']||_0x47b7b1[_0xc199('0x7')]});if(members[_0x257d1b][_0xc199('0x21')]){writeDB(members[_0x257d1b]);}}}}; \ No newline at end of file +var _0xd761=['cdr','split','data1','source','data3','destination','destinationchannel','util','./utils','Queue:','info','interface','channel','data2','type','getUserByInterface','then','membername','name','internal','request','CreateMemberReport','getUserByName','catch','error','some','state','INUSE','device','TALKING','now','agent','NOT_INUSE','isNil','diffTime','exitAt','enterAt','agentcomplete','assign','uniqueid'];(function(_0x642485,_0x362c69){var _0x164693=function(_0x5224ba){while(--_0x5224ba){_0x642485['push'](_0x642485['shift']());}};_0x164693(++_0x362c69);}(_0xd761,0xcf));var _0x1d76=function(_0x237da8,_0x37b77a){_0x237da8=_0x237da8-0x0;var _0x558825=_0xd761[_0x237da8];return _0x558825;};'use strict';var _=require('lodash');var util=require(_0x1d76('0x0'));var utils=require(_0x1d76('0x1'));var members={};var exclude=['Local/_attended@transfer',_0x1d76('0x2')];function writeDB(_0x5cbe76){utils[_0x1d76('0x3')](util['format']('MEMBER|%s|%s|%s|%s|%s|%s',_0x5cbe76['uniqueid'],_0x5cbe76[_0x1d76('0x4')],_0x5cbe76[_0x1d76('0x5')],_0x5cbe76[_0x1d76('0x6')],_0x5cbe76['membername'],_0x5cbe76[_0x1d76('0x7')]));if(_0x5cbe76[_0x1d76('0x4')]){utils[_0x1d76('0x8')](_0x5cbe76['interface'])[_0x1d76('0x9')](function(_0xe1553c){if(_0xe1553c){_0x5cbe76[_0x1d76('0xa')]=_0xe1553c[_0x1d76('0xb')];_0x5cbe76[_0x1d76('0xc')]=_0xe1553c[_0x1d76('0xc')];utils[_0x1d76('0xd')](_0x1d76('0xe'),_0x5cbe76);}else{utils[_0x1d76('0xf')](_0x5cbe76[_0x1d76('0x4')]['split']('/')[0x1])[_0x1d76('0x9')](function(_0x899e2d){if(_0x899e2d){_0x5cbe76['membername']=_0x899e2d['name'];_0x5cbe76['internal']=_0x899e2d[_0x1d76('0xc')];utils[_0x1d76('0xd')](_0x1d76('0xe'),_0x5cbe76);}});}})[_0x1d76('0x10')](function(_0x302f5a){utils[_0x1d76('0x11')](_0x302f5a);});}delete members[_0x5cbe76[_0x1d76('0x4')]];}function startsWith(_0x3df28a,_0x530da3){return _[_0x1d76('0x12')](_0x3df28a,function(_0x217b88){return _['startsWith'](_0x530da3,_0x217b88);});}exports['devicestatechange']=function(_0x18bbdb){switch(_0x18bbdb[_0x1d76('0x13')]){case _0x1d76('0x14'):case'BUSY':if(!startsWith(exclude,_0x18bbdb[_0x1d76('0x15')])){members[_0x18bbdb[_0x1d76('0x15')]]={'channel':'voice','interface':_0x18bbdb['device'],'type':_0x1d76('0x16'),'enterAt':utils[_0x1d76('0x17')](),'role':_0x1d76('0x18')};}break;case _0x1d76('0x19'):if(!_[_0x1d76('0x1a')](members[_0x18bbdb[_0x1d76('0x15')]])){members[_0x18bbdb[_0x1d76('0x15')]]['exitAt']=utils[_0x1d76('0x17')]();members[_0x18bbdb[_0x1d76('0x15')]]['duration']=utils[_0x1d76('0x1b')](members[_0x18bbdb[_0x1d76('0x15')]][_0x1d76('0x1c')],members[_0x18bbdb[_0x1d76('0x15')]][_0x1d76('0x1d')]);if(members[_0x18bbdb[_0x1d76('0x15')]]['uniqueid']){writeDB(members[_0x18bbdb[_0x1d76('0x15')]]);}}default:break;}};exports[_0x1d76('0x1e')]=function(_0x3947e1){if(!_[_0x1d76('0x1a')](members[_0x3947e1['interface']])){members[_0x3947e1[_0x1d76('0x4')]]=_[_0x1d76('0x1f')](members[_0x3947e1['interface']],{'data4':_0x3947e1['queue'],'uniqueid':_0x3947e1[_0x1d76('0x20')]});}};exports[_0x1d76('0x21')]=function(_0x344da9){if(_0x344da9['channel']){var _0x4b09c1=_0x344da9[_0x1d76('0x5')][_0x1d76('0x22')]('-')[0x0];if(!_[_0x1d76('0x1a')](members[_0x4b09c1])){members[_0x4b09c1]=_[_0x1d76('0x1f')](members[_0x4b09c1],{'data1':members[_0x4b09c1][_0x1d76('0x23')]||_0x344da9[_0x1d76('0x7')],'data2':members[_0x4b09c1]['data2']||_0x344da9[_0x1d76('0x24')],'data3':members[_0x4b09c1][_0x1d76('0x25')]||_0x344da9[_0x1d76('0x26')],'uniqueid':members[_0x4b09c1][_0x1d76('0x20')]||_0x344da9['uniqueid']});if(members[_0x4b09c1][_0x1d76('0x1c')]){writeDB(members[_0x4b09c1]);}}}if(_0x344da9[_0x1d76('0x27')]){var _0x54c9fc=_0x344da9[_0x1d76('0x27')][_0x1d76('0x22')]('-')[0x0];if(!_['isNil'](members[_0x54c9fc])){members[_0x54c9fc]=_[_0x1d76('0x1f')](members[_0x54c9fc],{'data1':members[_0x54c9fc][_0x1d76('0x23')]||_0x344da9[_0x1d76('0x7')],'data2':members[_0x54c9fc]['data2']||_0x344da9[_0x1d76('0x24')],'data3':members[_0x54c9fc][_0x1d76('0x25')]||_0x344da9['destination'],'uniqueid':members[_0x54c9fc][_0x1d76('0x20')]||_0x344da9['uniqueid']});if(members[_0x54c9fc][_0x1d76('0x1c')]){writeDB(members[_0x54c9fc]);}}}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index e642725..5b117eb 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 _0x71ed=['queuecallercompleteAt','queuecallerexitreason','COMPLETEDBYAGENT','queuecallerenterreason','varset','variable','value','toUpperCase','CONTINUE','queueposition','queuecallerabandonAt','queuecallerexitAt','EXITWITHKEY','ABANDONED','queuecallerleave','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','connectedlinename','agentconnect','accountcode','destaccountcode','membername','agentcomplete','assigned','reason','transfer','TRANSFER','blindtransfer','transfereeuniqueid','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','transfertype','ATTENDED','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','error','musiconholdstart','musiconholdstop','musiconholdstartAt','lodash','./utils','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','channel','queue','lastAssignedTo','calleridnum','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','assign','position','now','hangup','isNil','uniqueid','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x71ed,0x128));var _0xd71e=function(_0x133d40,_0x49ebfc){_0x133d40=_0x133d40-0x0;var _0x4e480d=_0x71ed[_0x133d40];return _0x4e480d;};'use strict';var _=require(_0xd71e('0x0'));var util=require('util');var utils=require(_0xd71e('0x1'));var queues={};function writeDB(_0x27ad7d){utils['info'](util[_0xd71e('0x2')](_0xd71e('0x3'),_0x27ad7d['uniqueid'],_0x27ad7d[_0xd71e('0x4')],_0x27ad7d[_0xd71e('0x5')],_0x27ad7d[_0xd71e('0x6')],_0x27ad7d[_0xd71e('0x7')],_0x27ad7d['accountcode'],_0x27ad7d['queuecallerexitreason']));if(_0x27ad7d['queue']){utils['getVoiceQueueByName'](_0x27ad7d[_0xd71e('0x5')])[_0xd71e('0x8')](function(_0x6cfe29){if(_0x6cfe29){_0x27ad7d[_0xd71e('0x9')]=_0x6cfe29['type'];}utils['request']('CreateVoiceQueueReport',_0x27ad7d);});}else{utils[_0xd71e('0xa')](_0xd71e('0xb'),_0x27ad7d);}if(_0x27ad7d[_0xd71e('0xc')]){delete queues[_0x27ad7d['transfereduniqueid']];}else{delete queues[_0x27ad7d['uniqueid']];}}exports[_0xd71e('0xd')]=function(_0x175ad1){queues[_0x175ad1['uniqueid']]=_[_0xd71e('0xe')](_0x175ad1,{'originalposition':_0x175ad1[_0xd71e('0xf')],'queuecallerjoinAt':utils[_0xd71e('0x10')](),'mohtime':0x0});};exports[_0xd71e('0x11')]=function(_0x963bf4){if(!_[_0xd71e('0x12')](queues[_0x963bf4[_0xd71e('0x13')]])){if(queues[_0x963bf4[_0xd71e('0x13')]][_0xd71e('0x14')]){if(!queues[_0x963bf4[_0xd71e('0x13')]][_0xd71e('0x15')]&&!queues[_0x963bf4[_0xd71e('0x13')]][_0xd71e('0x16')]){queues[_0x963bf4[_0xd71e('0x13')]][_0xd71e('0x17')]=!![];queues[_0x963bf4[_0xd71e('0x13')]][_0xd71e('0x18')]=utils['now']();queues[_0x963bf4[_0xd71e('0x13')]][_0xd71e('0x19')]=_0xd71e('0x1a');}writeDB(queues[_0x963bf4[_0xd71e('0x13')]]);}else{if(queues[_0x963bf4[_0xd71e('0x13')]][_0xd71e('0xc')]){queues[queues[_0x963bf4[_0xd71e('0x13')]][_0xd71e('0xc')]]=queues[_0x963bf4['uniqueid']];queues[queues[_0x963bf4['uniqueid']]['transfereduniqueid']][_0xd71e('0x1b')]=0x2;delete queues[_0x963bf4[_0xd71e('0x13')]];}}}};exports[_0xd71e('0x1c')]=function(_0x5500bf){if(!_['isNil'](_0x5500bf[_0xd71e('0x1d')]['queuestatus'])&&_0x5500bf[_0xd71e('0x1e')][_0xd71e('0x1f')]()!==_0xd71e('0x20')){if(!_[_0xd71e('0x12')](queues[_0x5500bf[_0xd71e('0x13')]])){queues[_0x5500bf[_0xd71e('0x13')]]['queuecallerabandon']=![];queues[_0x5500bf[_0xd71e('0x13')]]['queuecallerabandonAt']=null;queues[_0x5500bf[_0xd71e('0x13')]][_0xd71e('0x16')]=!![];queues[_0x5500bf['uniqueid']]['queuecallerexitAt']=utils[_0xd71e('0x10')]();queues[_0x5500bf[_0xd71e('0x13')]][_0xd71e('0x19')]=_0x5500bf[_0xd71e('0x1e')][_0xd71e('0x1f')]();writeDB(queues[_0x5500bf[_0xd71e('0x13')]]);}}else if(!_[_0xd71e('0x12')](_0x5500bf[_0xd71e('0x1d')][_0xd71e('0x21')])){if(!_[_0xd71e('0x12')](queues[_0x5500bf[_0xd71e('0x13')]])&&!queues[_0x5500bf[_0xd71e('0x13')]][_0xd71e('0x15')]){queues[_0x5500bf[_0xd71e('0x13')]][_0xd71e('0x15')]=![];queues[_0x5500bf[_0xd71e('0x13')]][_0xd71e('0x22')]=null;queues[_0x5500bf[_0xd71e('0x13')]][_0xd71e('0x16')]=!![];queues[_0x5500bf['uniqueid']][_0xd71e('0x23')]=utils[_0xd71e('0x10')]();queues[_0x5500bf[_0xd71e('0x13')]][_0xd71e('0x19')]=_0xd71e('0x24');}}};exports[_0xd71e('0x15')]=function(_0x3ac4de){if(!_[_0xd71e('0x12')](queues[_0x3ac4de[_0xd71e('0x13')]])){queues[_0x3ac4de[_0xd71e('0x13')]][_0xd71e('0x16')]=![];queues[_0x3ac4de[_0xd71e('0x13')]][_0xd71e('0x23')]=null;queues[_0x3ac4de[_0xd71e('0x13')]][_0xd71e('0x15')]=!![];queues[_0x3ac4de[_0xd71e('0x13')]][_0xd71e('0x22')]=utils[_0xd71e('0x10')]();queues[_0x3ac4de[_0xd71e('0x13')]][_0xd71e('0x19')]=_0xd71e('0x25');}};exports[_0xd71e('0x26')]=function(_0x268cb7){if(!_['isNil'](queues[_0x268cb7[_0xd71e('0x13')]])){queues[_0x268cb7['uniqueid']][_0xd71e('0x26')]=!![];queues[_0x268cb7[_0xd71e('0x13')]]['queuecallerleaveAt']=utils[_0xd71e('0x10')]();queues[_0x268cb7[_0xd71e('0x13')]][_0xd71e('0x27')]=utils[_0xd71e('0x28')](queues[_0x268cb7['uniqueid']][_0xd71e('0x14')],queues[_0x268cb7[_0xd71e('0x13')]][_0xd71e('0x29')]);queues[_0x268cb7[_0xd71e('0x13')]][_0xd71e('0xf')]=_0x268cb7['position'];queues[_0x268cb7[_0xd71e('0x13')]][_0xd71e('0x2a')]=_0x268cb7[_0xd71e('0x2a')];queues[_0x268cb7[_0xd71e('0x13')]]['connectedlinenum']=_0x268cb7[_0xd71e('0x2b')];queues[_0x268cb7[_0xd71e('0x13')]][_0xd71e('0x2c')]=_0x268cb7['connectedlinename'];}};exports[_0xd71e('0x2d')]=function(_0x4d0de0){if(!_[_0xd71e('0x12')](queues[_0x4d0de0[_0xd71e('0x13')]])){queues[_0x4d0de0[_0xd71e('0x13')]][_0xd71e('0x15')]=![];queues[_0x4d0de0[_0xd71e('0x13')]][_0xd71e('0x15')]=![];queues[_0x4d0de0[_0xd71e('0x13')]][_0xd71e('0x22')]=null;queues[_0x4d0de0[_0xd71e('0x13')]]['queuecallerexit']=![];queues[_0x4d0de0[_0xd71e('0x13')]][_0xd71e('0x19')]=null;queues[_0x4d0de0[_0xd71e('0x13')]]['queuecallerexitAt']=null;queues[_0x4d0de0[_0xd71e('0x13')]]['assigned']=!![];queues[_0x4d0de0[_0xd71e('0x13')]][_0xd71e('0x2e')]=_0x4d0de0[_0xd71e('0x2f')];queues[_0x4d0de0['uniqueid']][_0xd71e('0x6')]=_0x4d0de0[_0xd71e('0x30')];}};exports[_0xd71e('0x31')]=function(_0x44fccf){if(!_[_0xd71e('0x12')](queues[_0x44fccf[_0xd71e('0x13')]])){if(queues[_0x44fccf[_0xd71e('0x13')]][_0xd71e('0x14')]){queues[_0x44fccf[_0xd71e('0x13')]][_0xd71e('0x15')]=![];queues[_0x44fccf[_0xd71e('0x13')]]['queuecallerabandon']=![];queues[_0x44fccf[_0xd71e('0x13')]][_0xd71e('0x22')]=null;queues[_0x44fccf[_0xd71e('0x13')]]['queuecallerexit']=![];queues[_0x44fccf[_0xd71e('0x13')]][_0xd71e('0x23')]=null;queues[_0x44fccf[_0xd71e('0x13')]][_0xd71e('0x32')]=!![];queues[_0x44fccf[_0xd71e('0x13')]]['lastAssignedTo']=_0x44fccf[_0xd71e('0x30')];queues[_0x44fccf[_0xd71e('0x13')]][_0xd71e('0x17')]=!![];queues[_0x44fccf['uniqueid']][_0xd71e('0x18')]=utils[_0xd71e('0x10')]();if(_0x44fccf[_0xd71e('0x33')]==_0xd71e('0x34')){if(!queues[_0x44fccf[_0xd71e('0x13')]]['transfer']){queues[_0x44fccf['uniqueid']][_0xd71e('0x19')]=_0xd71e('0x35');}}else{queues[_0x44fccf['uniqueid']][_0xd71e('0x19')]='COMPLETEDBY'+_0x44fccf['reason']['toUpperCase']();}writeDB(queues[_0x44fccf['uniqueid']]);}}};exports[_0xd71e('0x36')]=function(_0xd38f9e){if(!_[_0xd71e('0x12')](queues[_0xd38f9e[_0xd71e('0x37')]])){queues[_0xd38f9e[_0xd71e('0x37')]]['transfer']=!![];queues[_0xd38f9e[_0xd71e('0x37')]]['transfertype']=_0xd71e('0x38');queues[_0xd38f9e[_0xd71e('0x37')]][_0xd71e('0x39')]=_0xd38f9e[_0xd71e('0x3a')];queues[_0xd38f9e[_0xd71e('0x37')]][_0xd71e('0x3b')]=_0xd38f9e[_0xd71e('0x37')];queues[_0xd38f9e[_0xd71e('0x37')]][_0xd71e('0x19')]=_0xd71e('0x3c');}};exports['attendedtransfer']=function(_0x1ade7a){try{if(_0x1ade7a[_0xd71e('0x3d')]==_0x1ade7a[_0xd71e('0x3e')]){if(!_['isNil'](queues[_0x1ade7a[_0xd71e('0x3f')]])){queues[_0x1ade7a[_0xd71e('0x3f')]][_0xd71e('0x34')]=!![];queues[_0x1ade7a[_0xd71e('0x3f')]][_0xd71e('0x40')]=_0xd71e('0x41');queues[_0x1ade7a[_0xd71e('0x3f')]]['transferexten']=_0x1ade7a[_0xd71e('0x42')];queues[_0x1ade7a[_0xd71e('0x3f')]][_0xd71e('0x3b')]=_0x1ade7a[_0xd71e('0x3d')];queues[_0x1ade7a[_0xd71e('0x3f')]][_0xd71e('0x19')]=_0xd71e('0x43');}if(!_[_0xd71e('0x12')](queues[_0x1ade7a[_0xd71e('0x3e')]])){if(_0x1ade7a[_0xd71e('0x44')]&&queues[_0x1ade7a[_0xd71e('0x44')]]){queues[_0x1ade7a[_0xd71e('0x44')]][_0xd71e('0x1b')]=0x1;queues[_0x1ade7a[_0xd71e('0x37')]]=_[_0xd71e('0x45')](queues[_0x1ade7a[_0xd71e('0x44')]]);queues[_0x1ade7a['transfereeuniqueid']]['transfereduniqueid']=_0x1ade7a[_0xd71e('0x46')];queues[_0x1ade7a[_0xd71e('0x37')]][_0xd71e('0x1b')]=0x2;queues[_0x1ade7a['transfereeuniqueid']][_0xd71e('0x7')]=queues[_0x1ade7a[_0xd71e('0x3f')]][_0xd71e('0x7')];queues[_0x1ade7a[_0xd71e('0x37')]][_0xd71e('0x47')]=queues[_0x1ade7a[_0xd71e('0x3f')]][_0xd71e('0x47')];queues[_0x1ade7a[_0xd71e('0x37')]]['queuecallerjoinAt']=utils[_0xd71e('0x10')]();queues[_0x1ade7a[_0xd71e('0x37')]][_0xd71e('0x14')]=utils['now']();queues[_0x1ade7a['transfereeuniqueid']][_0xd71e('0x27')]=0x0;queues[_0x1ade7a[_0xd71e('0x37')]][_0xd71e('0x48')]=0x0;}else{queues[_0x1ade7a['origtransfererlinkedid']][_0xd71e('0xc')]=_0x1ade7a[_0xd71e('0x3f')];}}}else if(_0x1ade7a[_0xd71e('0x49')]==_0x1ade7a[_0xd71e('0x3f')]){if(!_[_0xd71e('0x12')](queues[_0x1ade7a[_0xd71e('0x3e')]])){queues[_0x1ade7a[_0xd71e('0x3e')]][_0xd71e('0x34')]=!![];queues[_0x1ade7a['origtransfererlinkedid']]['transfertype']='ATTENDED';queues[_0x1ade7a['origtransfererlinkedid']][_0xd71e('0x39')]=_0x1ade7a[_0xd71e('0x4a')];queues[_0x1ade7a[_0xd71e('0x3e')]][_0xd71e('0x3b')]=_0x1ade7a[_0xd71e('0x49')];queues[_0x1ade7a[_0xd71e('0x3e')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_[_0xd71e('0x12')](queues[_0x1ade7a[_0xd71e('0x3f')]])){if(_0x1ade7a[_0xd71e('0x4b')]&&queues[_0x1ade7a['transfertargetlinkedid']]){queues[_0x1ade7a[_0xd71e('0x4b')]]['queuecallerenterreason']=0x1;queues[_0x1ade7a[_0xd71e('0x46')]]=_['clone'](queues[_0x1ade7a[_0xd71e('0x4b')]]);queues[_0x1ade7a[_0xd71e('0x46')]][_0xd71e('0xc')]=_0x1ade7a[_0xd71e('0x46')];queues[_0x1ade7a[_0xd71e('0x46')]][_0xd71e('0x1b')]=0x2;queues[_0x1ade7a[_0xd71e('0x46')]][_0xd71e('0x7')]=queues[_0x1ade7a['origtransfererlinkedid']][_0xd71e('0x7')];queues[_0x1ade7a['transfertargetuniqueid']][_0xd71e('0x47')]=queues[_0x1ade7a['origtransfererlinkedid']][_0xd71e('0x47')];queues[_0x1ade7a[_0xd71e('0x46')]][_0xd71e('0x29')]=utils[_0xd71e('0x10')]();queues[_0x1ade7a[_0xd71e('0x46')]][_0xd71e('0x14')]=utils['now']();queues[_0x1ade7a[_0xd71e('0x46')]][_0xd71e('0x27')]=0x0;queues[_0x1ade7a['transfertargetuniqueid']]['mohtime']=0x0;}else{queues[_0x1ade7a[_0xd71e('0x3f')]][_0xd71e('0xc')]=_0x1ade7a[_0xd71e('0x3e')];}}}}catch(_0x796a1d){utils[_0xd71e('0x4c')](_0x796a1d['stack']);}};exports[_0xd71e('0x4d')]=function(_0x5858e3){if(!_[_0xd71e('0x12')](queues[_0x5858e3[_0xd71e('0x13')]])){queues[_0x5858e3[_0xd71e('0x13')]]['musiconholdstartAt']=utils[_0xd71e('0x10')]();}};exports[_0xd71e('0x4e')]=function(_0x2d7cfe){if(!_[_0xd71e('0x12')](queues[_0x2d7cfe[_0xd71e('0x13')]])){if(!_[_0xd71e('0x12')](queues[_0x2d7cfe[_0xd71e('0x13')]][_0xd71e('0x4f')])){queues[_0x2d7cfe['uniqueid']]['mohtime']+=utils['diffTime'](utils[_0xd71e('0x10')](),queues[_0x2d7cfe[_0xd71e('0x13')]][_0xd71e('0x4f')]);delete queues[_0x2d7cfe[_0xd71e('0x13')]][_0xd71e('0x4f')];}}}; \ No newline at end of file +var _0x1423=['ATTENDED','transferexten','origtransfererexten','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','holdtime','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','mohtime','error','musiconholdstart','musiconholdstartAt','musiconholdstop','lodash','util','./utils','info','QUEUE|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','lastAssignedTo','calleridnum','queuecallerexitreason','queue','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','position','now','hangup','isNil','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','queuecallerenterreason','varset','variable','queuestatus','value','CONTINUE','queuecallerabandonAt','queuecallerexitAt','toUpperCase','queueposition','EXITWITHKEY','ABANDONED','queuecallerleave','diffTime','queuecallerjoinAt','count','connectedlinenum','connectedlinename','assigned','accountcode','destaccountcode','membername','reason','transfer','TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid','transfertype','extension','BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid'];(function(_0x51d129,_0x175d7d){var _0x44c377=function(_0x5ee454){while(--_0x5ee454){_0x51d129['push'](_0x51d129['shift']());}};_0x44c377(++_0x175d7d);}(_0x1423,0x1ec));var _0x3142=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1423[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x3142('0x0'));var util=require(_0x3142('0x1'));var utils=require(_0x3142('0x2'));var queues={};function writeDB(_0x536355){utils[_0x3142('0x3')](util['format'](_0x3142('0x4'),_0x536355[_0x3142('0x5')],_0x536355[_0x3142('0x6')],_0x536355['queue'],_0x536355[_0x3142('0x7')],_0x536355[_0x3142('0x8')],_0x536355['accountcode'],_0x536355[_0x3142('0x9')]));if(_0x536355[_0x3142('0xa')]){utils[_0x3142('0xb')](_0x536355[_0x3142('0xa')])[_0x3142('0xc')](function(_0x31a0c0){if(_0x31a0c0){_0x536355['type']=_0x31a0c0[_0x3142('0xd')];}utils[_0x3142('0xe')](_0x3142('0xf'),_0x536355);});}else{utils['request'](_0x3142('0xf'),_0x536355);}if(_0x536355[_0x3142('0x10')]){delete queues[_0x536355[_0x3142('0x10')]];}else{delete queues[_0x536355[_0x3142('0x5')]];}}exports['queuecallerjoin']=function(_0x45c67){queues[_0x45c67[_0x3142('0x5')]]=_['assign'](_0x45c67,{'originalposition':_0x45c67[_0x3142('0x11')],'queuecallerjoinAt':utils[_0x3142('0x12')](),'mohtime':0x0});};exports[_0x3142('0x13')]=function(_0x212dd8){if(!_[_0x3142('0x14')](queues[_0x212dd8[_0x3142('0x5')]])){if(queues[_0x212dd8[_0x3142('0x5')]][_0x3142('0x15')]){if(!queues[_0x212dd8[_0x3142('0x5')]][_0x3142('0x16')]&&!queues[_0x212dd8[_0x3142('0x5')]][_0x3142('0x17')]){queues[_0x212dd8[_0x3142('0x5')]][_0x3142('0x18')]=!![];queues[_0x212dd8[_0x3142('0x5')]][_0x3142('0x19')]=utils[_0x3142('0x12')]();queues[_0x212dd8[_0x3142('0x5')]][_0x3142('0x9')]='COMPLETEDBYAGENT';}writeDB(queues[_0x212dd8[_0x3142('0x5')]]);}else{if(queues[_0x212dd8[_0x3142('0x5')]][_0x3142('0x10')]){queues[queues[_0x212dd8[_0x3142('0x5')]][_0x3142('0x10')]]=queues[_0x212dd8[_0x3142('0x5')]];queues[queues[_0x212dd8[_0x3142('0x5')]][_0x3142('0x10')]][_0x3142('0x1a')]=0x2;delete queues[_0x212dd8[_0x3142('0x5')]];}}}};exports[_0x3142('0x1b')]=function(_0x11fac0){if(!_[_0x3142('0x14')](_0x11fac0[_0x3142('0x1c')][_0x3142('0x1d')])&&_0x11fac0[_0x3142('0x1e')]['toUpperCase']()!==_0x3142('0x1f')){if(!_['isNil'](queues[_0x11fac0[_0x3142('0x5')]])){queues[_0x11fac0[_0x3142('0x5')]][_0x3142('0x16')]=![];queues[_0x11fac0[_0x3142('0x5')]][_0x3142('0x20')]=null;queues[_0x11fac0[_0x3142('0x5')]]['queuecallerexit']=!![];queues[_0x11fac0[_0x3142('0x5')]][_0x3142('0x21')]=utils[_0x3142('0x12')]();queues[_0x11fac0['uniqueid']][_0x3142('0x9')]=_0x11fac0['value'][_0x3142('0x22')]();writeDB(queues[_0x11fac0[_0x3142('0x5')]]);}}else if(!_[_0x3142('0x14')](_0x11fac0['variable'][_0x3142('0x23')])){if(!_[_0x3142('0x14')](queues[_0x11fac0['uniqueid']])&&!queues[_0x11fac0['uniqueid']]['queuecallerabandon']){queues[_0x11fac0[_0x3142('0x5')]][_0x3142('0x16')]=![];queues[_0x11fac0[_0x3142('0x5')]][_0x3142('0x20')]=null;queues[_0x11fac0[_0x3142('0x5')]][_0x3142('0x17')]=!![];queues[_0x11fac0[_0x3142('0x5')]][_0x3142('0x21')]=utils[_0x3142('0x12')]();queues[_0x11fac0[_0x3142('0x5')]][_0x3142('0x9')]=_0x3142('0x24');}}};exports['queuecallerabandon']=function(_0x15e042){if(!_['isNil'](queues[_0x15e042[_0x3142('0x5')]])){queues[_0x15e042[_0x3142('0x5')]][_0x3142('0x17')]=![];queues[_0x15e042[_0x3142('0x5')]]['queuecallerexitAt']=null;queues[_0x15e042[_0x3142('0x5')]]['queuecallerabandon']=!![];queues[_0x15e042[_0x3142('0x5')]][_0x3142('0x20')]=utils[_0x3142('0x12')]();queues[_0x15e042[_0x3142('0x5')]][_0x3142('0x9')]=_0x3142('0x25');}};exports[_0x3142('0x26')]=function(_0x1f4c98){if(!_[_0x3142('0x14')](queues[_0x1f4c98[_0x3142('0x5')]])){queues[_0x1f4c98[_0x3142('0x5')]][_0x3142('0x26')]=!![];queues[_0x1f4c98[_0x3142('0x5')]]['queuecallerleaveAt']=utils[_0x3142('0x12')]();queues[_0x1f4c98[_0x3142('0x5')]]['holdtime']=utils[_0x3142('0x27')](queues[_0x1f4c98[_0x3142('0x5')]][_0x3142('0x15')],queues[_0x1f4c98['uniqueid']][_0x3142('0x28')]);queues[_0x1f4c98[_0x3142('0x5')]][_0x3142('0x11')]=_0x1f4c98[_0x3142('0x11')];queues[_0x1f4c98['uniqueid']]['count']=_0x1f4c98[_0x3142('0x29')];queues[_0x1f4c98[_0x3142('0x5')]][_0x3142('0x2a')]=_0x1f4c98[_0x3142('0x2a')];queues[_0x1f4c98[_0x3142('0x5')]][_0x3142('0x2b')]=_0x1f4c98[_0x3142('0x2b')];}};exports['agentconnect']=function(_0x311547){if(!_[_0x3142('0x14')](queues[_0x311547['uniqueid']])){queues[_0x311547[_0x3142('0x5')]][_0x3142('0x16')]=![];queues[_0x311547[_0x3142('0x5')]][_0x3142('0x16')]=![];queues[_0x311547[_0x3142('0x5')]]['queuecallerabandonAt']=null;queues[_0x311547[_0x3142('0x5')]][_0x3142('0x17')]=![];queues[_0x311547[_0x3142('0x5')]][_0x3142('0x9')]=null;queues[_0x311547['uniqueid']][_0x3142('0x21')]=null;queues[_0x311547[_0x3142('0x5')]][_0x3142('0x2c')]=!![];queues[_0x311547['uniqueid']][_0x3142('0x2d')]=_0x311547[_0x3142('0x2e')];queues[_0x311547[_0x3142('0x5')]][_0x3142('0x7')]=_0x311547['membername'];}};exports['agentcomplete']=function(_0x5bfd07){if(!_[_0x3142('0x14')](queues[_0x5bfd07[_0x3142('0x5')]])){if(queues[_0x5bfd07[_0x3142('0x5')]][_0x3142('0x15')]){queues[_0x5bfd07[_0x3142('0x5')]][_0x3142('0x16')]=![];queues[_0x5bfd07[_0x3142('0x5')]][_0x3142('0x16')]=![];queues[_0x5bfd07[_0x3142('0x5')]][_0x3142('0x20')]=null;queues[_0x5bfd07[_0x3142('0x5')]]['queuecallerexit']=![];queues[_0x5bfd07[_0x3142('0x5')]][_0x3142('0x21')]=null;queues[_0x5bfd07[_0x3142('0x5')]][_0x3142('0x2c')]=!![];queues[_0x5bfd07[_0x3142('0x5')]][_0x3142('0x7')]=_0x5bfd07[_0x3142('0x2f')];queues[_0x5bfd07[_0x3142('0x5')]]['queuecallercomplete']=!![];queues[_0x5bfd07[_0x3142('0x5')]][_0x3142('0x19')]=utils['now']();if(_0x5bfd07[_0x3142('0x30')]==_0x3142('0x31')){if(!queues[_0x5bfd07[_0x3142('0x5')]][_0x3142('0x31')]){queues[_0x5bfd07[_0x3142('0x5')]][_0x3142('0x9')]=_0x3142('0x32');}}else{queues[_0x5bfd07['uniqueid']]['queuecallerexitreason']=_0x3142('0x33')+_0x5bfd07[_0x3142('0x30')][_0x3142('0x22')]();}writeDB(queues[_0x5bfd07[_0x3142('0x5')]]);}}};exports[_0x3142('0x34')]=function(_0x32859a){if(!_[_0x3142('0x14')](queues[_0x32859a[_0x3142('0x35')]])){queues[_0x32859a[_0x3142('0x35')]]['transfer']=!![];queues[_0x32859a[_0x3142('0x35')]][_0x3142('0x36')]='BLIND';queues[_0x32859a['transfereeuniqueid']]['transferexten']=_0x32859a[_0x3142('0x37')];queues[_0x32859a[_0x3142('0x35')]]['transferuniqueid']=_0x32859a['transfereeuniqueid'];queues[_0x32859a['transfereeuniqueid']][_0x3142('0x9')]=_0x3142('0x38');}};exports[_0x3142('0x39')]=function(_0x3a4c7b){try{if(_0x3a4c7b[_0x3142('0x3a')]==_0x3a4c7b[_0x3142('0x3b')]){if(!_[_0x3142('0x14')](queues[_0x3a4c7b['secondtransfererlinkedid']])){queues[_0x3a4c7b[_0x3142('0x3c')]][_0x3142('0x31')]=!![];queues[_0x3a4c7b[_0x3142('0x3c')]][_0x3142('0x36')]=_0x3142('0x3d');queues[_0x3a4c7b['secondtransfererlinkedid']][_0x3142('0x3e')]=_0x3a4c7b[_0x3142('0x3f')];queues[_0x3a4c7b[_0x3142('0x3c')]][_0x3142('0x40')]=_0x3a4c7b[_0x3142('0x3a')];queues[_0x3a4c7b[_0x3142('0x3c')]][_0x3142('0x9')]=_0x3142('0x41');}if(!_[_0x3142('0x14')](queues[_0x3a4c7b[_0x3142('0x3b')]])){if(_0x3a4c7b[_0x3142('0x42')]&&queues[_0x3a4c7b[_0x3142('0x42')]]){queues[_0x3a4c7b['transfereelinkedid']]['queuecallerenterreason']=0x1;queues[_0x3a4c7b[_0x3142('0x35')]]=_[_0x3142('0x43')](queues[_0x3a4c7b[_0x3142('0x42')]]);queues[_0x3a4c7b[_0x3142('0x35')]][_0x3142('0x10')]=_0x3a4c7b[_0x3142('0x44')];queues[_0x3a4c7b['transfereeuniqueid']]['queuecallerenterreason']=0x2;queues[_0x3a4c7b[_0x3142('0x35')]][_0x3142('0x8')]=queues[_0x3a4c7b[_0x3142('0x3c')]][_0x3142('0x8')];queues[_0x3a4c7b['transfereeuniqueid']][_0x3142('0x45')]=queues[_0x3a4c7b[_0x3142('0x3c')]][_0x3142('0x45')];queues[_0x3a4c7b[_0x3142('0x35')]][_0x3142('0x28')]=utils[_0x3142('0x12')]();queues[_0x3a4c7b[_0x3142('0x35')]][_0x3142('0x15')]=utils[_0x3142('0x12')]();queues[_0x3a4c7b[_0x3142('0x35')]][_0x3142('0x46')]=0x0;queues[_0x3a4c7b['transfereeuniqueid']]['mohtime']=0x0;}else{queues[_0x3a4c7b[_0x3142('0x3b')]]['transfereduniqueid']=_0x3a4c7b['secondtransfererlinkedid'];}}}else if(_0x3a4c7b[_0x3142('0x47')]==_0x3a4c7b[_0x3142('0x3c')]){if(!_[_0x3142('0x14')](queues[_0x3a4c7b[_0x3142('0x3b')]])){queues[_0x3a4c7b[_0x3142('0x3b')]]['transfer']=!![];queues[_0x3a4c7b[_0x3142('0x3b')]]['transfertype']='ATTENDED';queues[_0x3a4c7b['origtransfererlinkedid']][_0x3142('0x3e')]=_0x3a4c7b[_0x3142('0x48')];queues[_0x3a4c7b[_0x3142('0x3b')]][_0x3142('0x40')]=_0x3a4c7b[_0x3142('0x47')];queues[_0x3a4c7b[_0x3142('0x3b')]][_0x3142('0x9')]=_0x3142('0x41');}if(!_['isNil'](queues[_0x3a4c7b['secondtransfererlinkedid']])){if(_0x3a4c7b[_0x3142('0x49')]&&queues[_0x3a4c7b[_0x3142('0x49')]]){queues[_0x3a4c7b['transfertargetlinkedid']][_0x3142('0x1a')]=0x1;queues[_0x3a4c7b[_0x3142('0x44')]]=_[_0x3142('0x43')](queues[_0x3a4c7b[_0x3142('0x49')]]);queues[_0x3a4c7b[_0x3142('0x44')]][_0x3142('0x10')]=_0x3a4c7b['transfertargetuniqueid'];queues[_0x3a4c7b[_0x3142('0x44')]][_0x3142('0x1a')]=0x2;queues[_0x3a4c7b[_0x3142('0x44')]][_0x3142('0x8')]=queues[_0x3a4c7b['origtransfererlinkedid']][_0x3142('0x8')];queues[_0x3a4c7b[_0x3142('0x44')]][_0x3142('0x45')]=queues[_0x3a4c7b['origtransfererlinkedid']]['calleridname'];queues[_0x3a4c7b[_0x3142('0x44')]]['queuecallerjoinAt']=utils['now']();queues[_0x3a4c7b[_0x3142('0x44')]]['queuecallerleaveAt']=utils[_0x3142('0x12')]();queues[_0x3a4c7b[_0x3142('0x44')]]['holdtime']=0x0;queues[_0x3a4c7b[_0x3142('0x44')]][_0x3142('0x4a')]=0x0;}else{queues[_0x3a4c7b[_0x3142('0x3c')]][_0x3142('0x10')]=_0x3a4c7b['origtransfererlinkedid'];}}}}catch(_0x4a6267){utils[_0x3142('0x4b')](_0x4a6267['stack']);}};exports[_0x3142('0x4c')]=function(_0x34815e){if(!_['isNil'](queues[_0x34815e[_0x3142('0x5')]])){queues[_0x34815e[_0x3142('0x5')]][_0x3142('0x4d')]=utils[_0x3142('0x12')]();}};exports[_0x3142('0x4e')]=function(_0x38f4b9){if(!_['isNil'](queues[_0x38f4b9[_0x3142('0x5')]])){if(!_[_0x3142('0x14')](queues[_0x38f4b9['uniqueid']][_0x3142('0x4d')])){queues[_0x38f4b9['uniqueid']][_0x3142('0x4a')]+=utils[_0x3142('0x27')](utils[_0x3142('0x12')](),queues[_0x38f4b9[_0x3142('0x5')]][_0x3142('0x4d')]);delete queues[_0x38f4b9['uniqueid']]['musiconholdstartAt'];}}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index c8bf80c..dced89a 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(_0x63ef0f,_0x27dfd3){var _0x386a8e=function(_0x1dcc9a){while(--_0x1dcc9a){_0x63ef0f['push'](_0x63ef0f['shift']());}};_0x386a8e(++_0x27dfd3);}(_0x9c44,0x178));var _0x49c4=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9c44[_0x2d7f0e];return _0x110b07;};'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 _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(_0x5ceb55,_0x4dec06){var _0x44deb6=function(_0x3c8a47){while(--_0x3c8a47){_0x5ceb55['push'](_0x5ceb55['shift']());}};_0x44deb6(++_0x4dec06);}(_0x9c44,0x178));var _0x49c4=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x9c44[_0x50a0c2];return _0x5ebadd;};'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 diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 1f65f0a..aa9deae 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 _0xcee0=['blind','stack','attendedtransfer','assign','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','attended','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','error','lodash','util','./utils','info','format','TRANSFER|%s','type','request','blindtransfer'];(function(_0x323c04,_0x18c51f){var _0x2f63a3=function(_0x3b84cc){while(--_0x3b84cc){_0x323c04['push'](_0x323c04['shift']());}};_0x2f63a3(++_0x18c51f);}(_0xcee0,0x1e1));var _0x0cee=function(_0x334d1e,_0x28a488){_0x334d1e=_0x334d1e-0x0;var _0x3b33ba=_0xcee0[_0x334d1e];return _0x3b33ba;};'use strict';var _=require(_0x0cee('0x0'));var util=require(_0x0cee('0x1'));var utils=require(_0x0cee('0x2'));function writeDB(_0xdc43c7){utils[_0x0cee('0x3')](util[_0x0cee('0x4')](_0x0cee('0x5'),_0xdc43c7[_0x0cee('0x6')]));utils[_0x0cee('0x7')]('CreateVoiceTransferReport',_0xdc43c7);}exports[_0x0cee('0x8')]=function(_0x29c25c){try{_0x29c25c[_0x0cee('0x6')]=_0x0cee('0x9');writeDB(_0x29c25c);}catch(_0x2af845){utils['error'](_0x2af845[_0x0cee('0xa')]);}};exports[_0x0cee('0xb')]=function(_0x34854d){try{_0x34854d=_[_0x0cee('0xc')](_0x34854d,{'transfererchannel':_0x34854d[_0x0cee('0xd')],'transferercalleridnum':_0x34854d[_0x0cee('0xe')],'transferercalleridname':_0x34854d[_0x0cee('0xf')],'transfererconnectedlinenum':_0x34854d[_0x0cee('0x10')],'transfererconnectedlinename':_0x34854d[_0x0cee('0x11')],'transfereraccountcode':_0x34854d[_0x0cee('0x12')],'transferercontext':_0x34854d[_0x0cee('0x13')],'transfererexten':_0x34854d[_0x0cee('0x14')],'transfererlinkedid':_0x34854d['origtransfererlinkedid'],'context':_0x34854d[_0x0cee('0x15')],'extension':_0x34854d[_0x0cee('0x16')],'type':_0x0cee('0x17')});if(_[_0x0cee('0x18')](_0x34854d[_0x0cee('0x19')])){_0x34854d=_[_0x0cee('0xc')](_0x34854d,{'transfereechannel':_0x34854d[_0x0cee('0x1a')],'transfereecalleridnum':_0x34854d[_0x0cee('0x1b')],'transfereecalleridname':_0x34854d['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x34854d[_0x0cee('0x1c')],'transfereeconnectedlinename':_0x34854d[_0x0cee('0x1d')],'transfereeaccountcode':_0x34854d[_0x0cee('0x1e')],'transfereecontext':_0x34854d[_0x0cee('0x1f')],'transfereeexten':_0x34854d[_0x0cee('0x20')],'transfereelinkedid':_0x34854d[_0x0cee('0x21')]});}writeDB(_0x34854d);}catch(_0x465b35){utils[_0x0cee('0x22')](_0x465b35['stack']);}}; \ No newline at end of file +var _0x3ee5=['transfertargetcontext','transfertargetexten','transfertargetlinkedid','error','util','./utils','info','format','TRANSFER|%s','type','request','CreateVoiceTransferReport','blindtransfer','blind','stack','attendedtransfer','assign','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererexten','attended','isNil','transfereechannel','transfertargetcalleridname','transfertargetconnectedlinenum'];(function(_0x2acc83,_0x4c69c6){var _0x25ff7a=function(_0x5db75e){while(--_0x5db75e){_0x2acc83['push'](_0x2acc83['shift']());}};_0x25ff7a(++_0x4c69c6);}(_0x3ee5,0x1b6));var _0x53ee=function(_0x4e95f7,_0x28001d){_0x4e95f7=_0x4e95f7-0x0;var _0x4a044f=_0x3ee5[_0x4e95f7];return _0x4a044f;};'use strict';var _=require('lodash');var util=require(_0x53ee('0x0'));var utils=require(_0x53ee('0x1'));function writeDB(_0x544fe1){utils[_0x53ee('0x2')](util[_0x53ee('0x3')](_0x53ee('0x4'),_0x544fe1[_0x53ee('0x5')]));utils[_0x53ee('0x6')](_0x53ee('0x7'),_0x544fe1);}exports[_0x53ee('0x8')]=function(_0x26ea34){try{_0x26ea34[_0x53ee('0x5')]=_0x53ee('0x9');writeDB(_0x26ea34);}catch(_0x3173b2){utils['error'](_0x3173b2[_0x53ee('0xa')]);}};exports[_0x53ee('0xb')]=function(_0x1ec296){try{_0x1ec296=_[_0x53ee('0xc')](_0x1ec296,{'transfererchannel':_0x1ec296[_0x53ee('0xd')],'transferercalleridnum':_0x1ec296[_0x53ee('0xe')],'transferercalleridname':_0x1ec296[_0x53ee('0xf')],'transfererconnectedlinenum':_0x1ec296[_0x53ee('0x10')],'transfererconnectedlinename':_0x1ec296[_0x53ee('0x11')],'transfereraccountcode':_0x1ec296[_0x53ee('0x12')],'transferercontext':_0x1ec296[_0x53ee('0x13')],'transfererexten':_0x1ec296[_0x53ee('0x14')],'transfererlinkedid':_0x1ec296['origtransfererlinkedid'],'context':_0x1ec296['origtransferercontext'],'extension':_0x1ec296[_0x53ee('0x15')],'type':_0x53ee('0x16')});if(_[_0x53ee('0x17')](_0x1ec296[_0x53ee('0x18')])){_0x1ec296=_[_0x53ee('0xc')](_0x1ec296,{'transfereechannel':_0x1ec296['transfertargetchannel'],'transfereecalleridnum':_0x1ec296['transfertargetcalleridnum'],'transfereecalleridname':_0x1ec296[_0x53ee('0x19')],'transfereeconnectedlinenum':_0x1ec296[_0x53ee('0x1a')],'transfereeconnectedlinename':_0x1ec296['transfertargetconnectedlinename'],'transfereeaccountcode':_0x1ec296['transfertargetaccountcode'],'transfereecontext':_0x1ec296[_0x53ee('0x1b')],'transfereeexten':_0x1ec296[_0x53ee('0x1c')],'transfereelinkedid':_0x1ec296[_0x53ee('0x1d')]});}writeDB(_0x1ec296);}catch(_0x4be2ca){utils[_0x53ee('0x1e')](_0x4be2ca[_0x53ee('0xa')]);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 9078c53..3838c37 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 _0x0cf5=['name','then','stringify','result','length','NOTFOUND','getUserByInternal','getUserByInterface','getVoiceQueueByName','GetVoiceQueue','type','acw','GETVOICEQUEUEBYNAME|','FOUND','addTime','add','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','seconds','sumTime','now','isAfter','isBefore','jayson/promise','moment','bluebird','client','http','../../config/logger','info','debug','error','stack','request','catch','internal'];(function(_0x1d77b5,_0xedb4ff){var _0x57f0b4=function(_0x2826e5){while(--_0x2826e5){_0x1d77b5['push'](_0x1d77b5['shift']());}};_0x57f0b4(++_0xedb4ff);}(_0x0cf5,0x1c7));var _0x50cf=function(_0x2eed0d,_0x1bc37c){_0x2eed0d=_0x2eed0d-0x0;var _0x2420a5=_0x0cf5[_0x2eed0d];return _0x2420a5;};'use strict';var jayson=require(_0x50cf('0x0'));var moment=require(_0x50cf('0x1'));var BPromise=require(_0x50cf('0x2'));var client=jayson[_0x50cf('0x3')][_0x50cf('0x4')]({'port':0x2329});var logger=require(_0x50cf('0x5'))('xdr');exports[_0x50cf('0x6')]=function(_0x4869d6){logger['info'](_0x4869d6);};exports['debug']=function(_0x4b9504){logger[_0x50cf('0x7')](JSON['stringify'](_0x4b9504));};exports['error']=function(_0x4d337e){logger[_0x50cf('0x8')](_0x4d337e[_0x50cf('0x9')]);};exports[_0x50cf('0xa')]=function(_0x2c93b9,_0x5b09ef){return client[_0x50cf('0xa')](_0x2c93b9,{'body':_0x5b09ef})['then'](function(_0x529fec){logger[_0x50cf('0x7')](JSON['stringify'](_0x529fec));})[_0x50cf('0xb')](function(_0x587b36){logger[_0x50cf('0x8')](_0x587b36[_0x50cf('0x9')]);});};function getUser(_0x24a642){return client[_0x50cf('0xa')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x50cf('0xc'),_0x50cf('0xd'),'interface'],'where':_0x24a642,'limit':0x1}})[_0x50cf('0xe')](function(_0x5d7de7){logger[_0x50cf('0x6')]('GETUSER|'+JSON[_0x50cf('0xf')](_0x24a642)+'|'+(_0x5d7de7[_0x50cf('0x10')][_0x50cf('0x11')]?'FOUND':_0x50cf('0x12')));return _0x5d7de7[_0x50cf('0x10')][_0x50cf('0x11')]?_0x5d7de7[_0x50cf('0x10')][0x0]:null;});}exports[_0x50cf('0x13')]=function(_0x599943){return new BPromise(function(_0x48a34a,_0x86eb49){if(_0x599943){return getUser({'internal':_0x599943})[_0x50cf('0xe')](function(_0x5aff2c){return _0x48a34a(_0x5aff2c);})[_0x50cf('0xb')](function(_0x59a038){logger[_0x50cf('0x8')](_0x59a038[_0x50cf('0x9')]);return _0x48a34a(null);});}else{return _0x48a34a(null);}});};exports[_0x50cf('0x14')]=function(_0x43b4d8){return new BPromise(function(_0x505ed0,_0x5eb92c){if(_0x43b4d8){return getUser({'interface':_0x43b4d8})[_0x50cf('0xe')](function(_0x729c6){return _0x505ed0(_0x729c6);})[_0x50cf('0xb')](function(_0x5858bc){logger[_0x50cf('0x8')](_0x5858bc['stack']);return _0x505ed0(null);});}else{return _0x505ed0(null);}});};exports['getUserByName']=function(_0x1b8bc9){return new BPromise(function(_0x38d6f6,_0x555d0f){if(_0x1b8bc9){return getUser({'name':_0x1b8bc9})['then'](function(_0x5de5f9){return _0x38d6f6(_0x5de5f9);})[_0x50cf('0xb')](function(_0x639173){logger[_0x50cf('0x8')](_0x639173[_0x50cf('0x9')]);return _0x38d6f6(null);});}else{return _0x38d6f6(null);}});};exports[_0x50cf('0x15')]=function(_0x4fb919){return new BPromise(function(_0x2b448c,_0x116d77){if(_0x4fb919){return client[_0x50cf('0xa')](_0x50cf('0x16'),{'options':{'raw':!![],'attributes':['id',_0x50cf('0xd'),_0x50cf('0x17'),_0x50cf('0x18'),'acwTimeout'],'where':{'name':_0x4fb919},'limit':0x1}})['then'](function(_0x50967c){logger[_0x50cf('0x6')](_0x50cf('0x19')+_0x4fb919+'|'+(_0x50967c[_0x50cf('0x10')][_0x50cf('0x11')]?_0x50cf('0x1a'):_0x50cf('0x12')));return _0x2b448c(_0x50967c[_0x50cf('0x10')][_0x50cf('0x11')]?_0x50967c[_0x50cf('0x10')][0x0]:null);})[_0x50cf('0xb')](function(_0x1bcdd8){logger[_0x50cf('0x8')](_0x1bcdd8['stack']);return _0x2b448c(null);});}else{return _0x2b448c(null);}});};exports[_0x50cf('0x1b')]=function(_0x3f3f3f,_0x50af17){return moment(_0x3f3f3f)[_0x50cf('0x1c')](_0x50af17,'seconds')[_0x50cf('0x1d')](_0x50cf('0x1e'));};exports[_0x50cf('0x1f')]=function(_0x30ebbc,_0x3f967e){return moment(_0x30ebbc)[_0x50cf('0x20')](_0x3f967e,'seconds')[_0x50cf('0x1d')](_0x50cf('0x1e'));};exports[_0x50cf('0x21')]=function(_0x5c11cc,_0x1c64a){return moment(_0x5c11cc)['diff'](moment(_0x1c64a),_0x50cf('0x22'));};exports[_0x50cf('0x23')]=function(_0x4a5df9,_0x2cbd2d){return parseInt(_0x4a5df9,0xa)+parseInt(_0x2cbd2d,0xa);};exports[_0x50cf('0x24')]=function(){return moment()[_0x50cf('0x1d')](_0x50cf('0x1e'));};exports['isAfter']=function(_0x5e709c,_0x5decf5){if(_0x5decf5){return moment(_0x5e709c)[_0x50cf('0x25')](_0x5decf5);}else{return!![];}};exports[_0x50cf('0x26')]=function(_0x39d472,_0x5a10e1){if(_0x5a10e1){return moment(_0x39d472)['isBefore'](_0x5a10e1);}else if(_0x39d472){return!![];}else{return![];}}; \ No newline at end of file +var _0x2516=['http','xdr','info','debug','request','then','error','stack','internal','interface','GETUSER|','stringify','length','FOUND','NOTFOUND','result','getUserByInternal','getUserByInterface','catch','getVoiceQueueByName','name','type','acwTimeout','GETVOICEQUEUEBYNAME|','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','sumTime','now','isAfter','isBefore','jayson/promise','moment','bluebird','client'];(function(_0x21ace8,_0x3428aa){var _0x683b20=function(_0x4c20f7){while(--_0x4c20f7){_0x21ace8['push'](_0x21ace8['shift']());}};_0x683b20(++_0x3428aa);}(_0x2516,0x13c));var _0x6251=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x2516[_0x5ddb1c];return _0x354adc;};'use strict';var jayson=require(_0x6251('0x0'));var moment=require(_0x6251('0x1'));var BPromise=require(_0x6251('0x2'));var client=jayson[_0x6251('0x3')][_0x6251('0x4')]({'port':0x2329});var logger=require('../../config/logger')(_0x6251('0x5'));exports['info']=function(_0x407ba7){logger[_0x6251('0x6')](_0x407ba7);};exports[_0x6251('0x7')]=function(_0x40a81c){logger[_0x6251('0x7')](JSON['stringify'](_0x40a81c));};exports['error']=function(_0xe1bd60){logger['error'](_0xe1bd60['stack']);};exports[_0x6251('0x8')]=function(_0x353eb1,_0x4cb325){return client[_0x6251('0x8')](_0x353eb1,{'body':_0x4cb325})[_0x6251('0x9')](function(_0x353124){logger[_0x6251('0x7')](JSON['stringify'](_0x353124));})['catch'](function(_0x5bd92d){logger[_0x6251('0xa')](_0x5bd92d[_0x6251('0xb')]);});};function getUser(_0x529f1e){return client[_0x6251('0x8')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x6251('0xc'),'name',_0x6251('0xd')],'where':_0x529f1e,'limit':0x1}})[_0x6251('0x9')](function(_0x44e13f){logger['info'](_0x6251('0xe')+JSON[_0x6251('0xf')](_0x529f1e)+'|'+(_0x44e13f['result'][_0x6251('0x10')]?_0x6251('0x11'):_0x6251('0x12')));return _0x44e13f[_0x6251('0x13')]['length']?_0x44e13f[_0x6251('0x13')][0x0]:null;});}exports[_0x6251('0x14')]=function(_0x15a0ca){return new BPromise(function(_0x17a2f2,_0x118fad){if(_0x15a0ca){return getUser({'internal':_0x15a0ca})[_0x6251('0x9')](function(_0x1fb8c9){return _0x17a2f2(_0x1fb8c9);})['catch'](function(_0x1555b1){logger[_0x6251('0xa')](_0x1555b1['stack']);return _0x17a2f2(null);});}else{return _0x17a2f2(null);}});};exports[_0x6251('0x15')]=function(_0x38b624){return new BPromise(function(_0x17e16d,_0x347367){if(_0x38b624){return getUser({'interface':_0x38b624})['then'](function(_0x1578a7){return _0x17e16d(_0x1578a7);})[_0x6251('0x16')](function(_0x4b6d08){logger[_0x6251('0xa')](_0x4b6d08['stack']);return _0x17e16d(null);});}else{return _0x17e16d(null);}});};exports['getUserByName']=function(_0x14789b){return new BPromise(function(_0x4b71be,_0x11af6f){if(_0x14789b){return getUser({'name':_0x14789b})[_0x6251('0x9')](function(_0x86db23){return _0x4b71be(_0x86db23);})['catch'](function(_0x55cdb2){logger['error'](_0x55cdb2[_0x6251('0xb')]);return _0x4b71be(null);});}else{return _0x4b71be(null);}});};exports[_0x6251('0x17')]=function(_0x5ee8c7){return new BPromise(function(_0x4925ec,_0x1c3950){if(_0x5ee8c7){return client[_0x6251('0x8')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x6251('0x18'),_0x6251('0x19'),'acw',_0x6251('0x1a')],'where':{'name':_0x5ee8c7},'limit':0x1}})[_0x6251('0x9')](function(_0x141c37){logger['info'](_0x6251('0x1b')+_0x5ee8c7+'|'+(_0x141c37['result']['length']?_0x6251('0x11'):'NOTFOUND'));return _0x4925ec(_0x141c37[_0x6251('0x13')][_0x6251('0x10')]?_0x141c37[_0x6251('0x13')][0x0]:null);})[_0x6251('0x16')](function(_0x5b535b){logger[_0x6251('0xa')](_0x5b535b[_0x6251('0xb')]);return _0x4925ec(null);});}else{return _0x4925ec(null);}});};exports[_0x6251('0x1c')]=function(_0x51af27,_0x5cfd61){return moment(_0x51af27)[_0x6251('0x1d')](_0x5cfd61,_0x6251('0x1e'))[_0x6251('0x1f')](_0x6251('0x20'));};exports[_0x6251('0x21')]=function(_0x58728e,_0x5828ab){return moment(_0x58728e)[_0x6251('0x22')](_0x5828ab,_0x6251('0x1e'))[_0x6251('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x6251('0x23')]=function(_0x4356de,_0x570ffc){return moment(_0x4356de)['diff'](moment(_0x570ffc),'seconds');};exports[_0x6251('0x24')]=function(_0x28d409,_0x44815e){return parseInt(_0x28d409,0xa)+parseInt(_0x44815e,0xa);};exports[_0x6251('0x25')]=function(){return moment()[_0x6251('0x1f')](_0x6251('0x20'));};exports[_0x6251('0x26')]=function(_0x4cfc7e,_0x4f7acb){if(_0x4f7acb){return moment(_0x4cfc7e)[_0x6251('0x26')](_0x4f7acb);}else{return!![];}};exports[_0x6251('0x27')]=function(_0x213bc3,_0x34bd56){if(_0x34bd56){return moment(_0x213bc3)[_0x6251('0x27')](_0x34bd56);}else if(_0x213bc3){return!![];}else{return![];}}; \ No newline at end of file